From: support Date: Tue, 17 Jan 2023 17:34:13 +0000 (+0000) Subject: Built motion from commit c0cdc9d8.|2.6.28 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=91058c28792f2e4e3ce5b2c549cdc652f4bd103d;p=motion2.git Built motion from commit c0cdc9d8.|2.6.28 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 760aae1..9009f87 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-01-17T15:08:59.349Z", + "time": "2023-01-17T17:26:35.591Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 77e428d..c75dc53 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-17T15:08:59.349Z", + "time": "2023-01-17T17:26:35.591Z", "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 419cc3d..baa2a73 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 _0x1b19=['urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x4e69e1,_0x1c8207){var _0x4a30f3=function(_0x322aea){while(--_0x322aea){_0x4e69e1['push'](_0x4e69e1['shift']());}};_0x4a30f3(++_0x1c8207);}(_0x1b19,0x142));var _0x91b1=function(_0x50cfe9,_0x3d3a4b){_0x50cfe9=_0x50cfe9-0x0;var _0x1bd502=_0x1b19[_0x50cfe9];return _0x1bd502;};'use strict';var Sequelize=require(_0x91b1('0x0'));module[_0x91b1('0x1')]={'name':{'type':Sequelize[_0x91b1('0x2')],'get':function(_0x2d1bdd){return this[_0x91b1('0x3')](_0x91b1('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x91b1('0x5'),'integration',_0x91b1('0x6'),_0x91b1('0x7'),_0x91b1('0x8'),_0x91b1('0x9'),_0x91b1('0xa'),_0x91b1('0xb')]],'msg':_0x91b1('0xc')}},'comment':_0x91b1('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x91b1('0xd')},'data2':{'type':Sequelize[_0x91b1('0xe')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x91b1('0xe')](0x1000),'comment':_0x91b1('0xf')},'data4':{'type':Sequelize[_0x91b1('0xe')](0x1000),'comments':_0x91b1('0x10')},'data5':{'type':Sequelize[_0x91b1('0xe')](0x1000),'comments':_0x91b1('0x11')},'data6':{'type':Sequelize['STRING'],'comments':_0x91b1('0x12')},'data7':{'type':Sequelize[_0x91b1('0x13')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x1ac3=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','jscripty','browser','bot','script'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x1ac3,0x17c));var _0x31ac=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x1ac3[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x31ac('0x0'));module[_0x31ac('0x1')]={'name':{'type':Sequelize[_0x31ac('0x2')],'get':function(_0x2be3b7){return this[_0x31ac('0x3')]('action');}},'action':{'type':Sequelize[_0x31ac('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x31ac('0x5'),_0x31ac('0x6'),'motionbar',_0x31ac('0x7'),'urlForward',_0x31ac('0x8'),_0x31ac('0x9'),_0x31ac('0xa')]],'msg':_0x31ac('0xb')}},'comment':_0x31ac('0xb')},'data1':{'type':Sequelize[_0x31ac('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x31ac('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[_0x31ac('0x4')](0x1000),'comment':_0x31ac('0xc')},'data4':{'type':Sequelize[_0x31ac('0x4')](0x1000),'comments':_0x31ac('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x31ac('0x4')],'comments':_0x31ac('0xe')},'data7':{'type':Sequelize[_0x31ac('0xf')],'comments':_0x31ac('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 461a54e..f031bae 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 _0x7528=['send','update','body','Action','find','params','catch','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','name'];(function(_0x5971f8,_0x4348b8){var _0x159e78=function(_0x540565){while(--_0x540565){_0x5971f8['push'](_0x5971f8['shift']());}};_0x159e78(++_0x4348b8);}(_0x7528,0xd9));var _0x8752=function(_0x11c72b,_0x8ca977){_0x11c72b=_0x11c72b-0x0;var _0x488f26=_0x7528[_0x11c72b];return _0x488f26;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8752('0x0'));var jsonpatch=require(_0x8752('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8752('0x2'));var Mustache=require(_0x8752('0x3'));var util=require('util');var path=require(_0x8752('0x4'));var sox=require(_0x8752('0x5'));var csv=require(_0x8752('0x6'));var ejs=require(_0x8752('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8752('0x8'));var squel=require(_0x8752('0x9'));var crypto=require(_0x8752('0xa'));var jsforce=require(_0x8752('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8752('0x6'));var querystring=require('querystring');var Papa=require(_0x8752('0xc'));var Redis=require(_0x8752('0xd'));var authService=require(_0x8752('0xe'));var qs=require(_0x8752('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8752('0x10'));var logger=require(_0x8752('0x11'))(_0x8752('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8752('0x13'))['db'];function respondWithStatusCode(_0x461481,_0x206dd9){_0x206dd9=_0x206dd9||0xcc;return function(_0x11b768){if(_0x11b768){return _0x461481[_0x8752('0x14')](_0x206dd9);}return _0x461481[_0x8752('0x15')](_0x206dd9)[_0x8752('0x16')]();};}function respondWithResult(_0x34c198,_0xd7bbca){_0xd7bbca=_0xd7bbca||0xc8;return function(_0x2a1b84){if(_0x2a1b84){return _0x34c198['status'](_0xd7bbca)['json'](_0x2a1b84);}};}function respondWithFilteredResult(_0x18780d,_0x76d9b7){return function(_0x47bf46){if(_0x47bf46){var _0xc82707=typeof _0x76d9b7[_0x8752('0x17')]===_0x8752('0x18')&&typeof _0x76d9b7[_0x8752('0x19')]===_0x8752('0x18');var _0x46af54=_0x47bf46[_0x8752('0x1a')];var _0x3a864d=_0xc82707?0x0:_0x76d9b7[_0x8752('0x17')];var _0x1886d5=_0xc82707?_0x47bf46[_0x8752('0x1a')]:_0x76d9b7[_0x8752('0x17')]+_0x76d9b7[_0x8752('0x19')];var _0x172bc2;if(_0x1886d5>=_0x46af54){_0x1886d5=_0x46af54;_0x172bc2=0xc8;}else{_0x172bc2=0xce;}_0x18780d[_0x8752('0x15')](_0x172bc2);return _0x18780d['set'](_0x8752('0x1b'),_0x3a864d+'-'+_0x1886d5+'/'+_0x46af54)['json'](_0x47bf46);}return null;};}function patchUpdates(_0x1bf19b){return function(_0x17e665){try{jsonpatch[_0x8752('0x1c')](_0x17e665,_0x1bf19b,!![]);}catch(_0x51aea5){return BPromise[_0x8752('0x1d')](_0x51aea5);}return _0x17e665[_0x8752('0x1e')]();};}function saveUpdates(_0xa49c28,_0x2327bc){return function(_0x2ae4ab){if(_0x2ae4ab){return _0x2ae4ab['update'](_0xa49c28)[_0x8752('0x1f')](function(_0x247aa0){return _0x247aa0;});}return null;};}function removeEntity(_0xc7711,_0x2bd52d){return function(_0x14bf67){if(_0x14bf67){return _0x14bf67[_0x8752('0x20')]()[_0x8752('0x1f')](function(){_0xc7711['status'](0xcc)[_0x8752('0x16')]();});}};}function handleEntityNotFound(_0x5ea197,_0x21526a){return function(_0x3d153a){if(!_0x3d153a){_0x5ea197['sendStatus'](0x194);}return _0x3d153a;};}function handleError(_0x55e6c6,_0x29681e){_0x29681e=_0x29681e||0x1f4;return function(_0x2db8f7){logger[_0x8752('0x21')](_0x2db8f7['stack']);if(_0x2db8f7['name']){delete _0x2db8f7[_0x8752('0x22')];}_0x55e6c6[_0x8752('0x15')](_0x29681e)[_0x8752('0x23')](_0x2db8f7);};}exports[_0x8752('0x24')]=function(_0x3de12f,_0x4ee74a){if(_0x3de12f[_0x8752('0x25')]['id']){delete _0x3de12f[_0x8752('0x25')]['id'];}return db[_0x8752('0x26')][_0x8752('0x27')]({'where':{'id':_0x3de12f[_0x8752('0x28')]['id']}})[_0x8752('0x1f')](handleEntityNotFound(_0x4ee74a,null))[_0x8752('0x1f')](saveUpdates(_0x3de12f['body'],null))[_0x8752('0x1f')](respondWithResult(_0x4ee74a,null))[_0x8752('0x29')](handleError(_0x4ee74a,null));};exports[_0x8752('0x20')]=function(_0x4a1958,_0x4af751){return db[_0x8752('0x26')][_0x8752('0x27')]({'where':{'id':_0x4a1958[_0x8752('0x28')]['id']}})['then'](handleEntityNotFound(_0x4af751,null))[_0x8752('0x1f')](removeEntity(_0x4af751,null))['catch'](handleError(_0x4af751,null));}; \ No newline at end of file +var _0x1668=['rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','update','body','find','params','Action','eml-format'];(function(_0x55f53,_0x3d9ad0){var _0x50ec49=function(_0x561bca){while(--_0x561bca){_0x55f53['push'](_0x55f53['shift']());}};_0x50ec49(++_0x3d9ad0);}(_0x1668,0xfb));var _0x8166=function(_0x3770f6,_0x54236a){_0x3770f6=_0x3770f6-0x0;var _0x440a98=_0x1668[_0x3770f6];return _0x440a98;};'use strict';var emlformat=require(_0x8166('0x0'));var rimraf=require(_0x8166('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8166('0x2'));var rp=require('request-promise');var moment=require(_0x8166('0x3'));var BPromise=require(_0x8166('0x4'));var Mustache=require(_0x8166('0x5'));var util=require(_0x8166('0x6'));var path=require(_0x8166('0x7'));var sox=require(_0x8166('0x8'));var csv=require(_0x8166('0x9'));var ejs=require(_0x8166('0xa'));var fs=require('fs');var fs_extra=require(_0x8166('0xb'));var _=require(_0x8166('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8166('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8166('0x9'));var querystring=require(_0x8166('0xe'));var Papa=require('papaparse');var Redis=require(_0x8166('0xf'));var authService=require(_0x8166('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8166('0x11'));var logger=require('../../config/logger')(_0x8166('0x12'));var utils=require(_0x8166('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8166('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bbea5,_0x591359){_0x591359=_0x591359||0xcc;return function(_0x3d52d0){if(_0x3d52d0){return _0x2bbea5['sendStatus'](_0x591359);}return _0x2bbea5['status'](_0x591359)[_0x8166('0x15')]();};}function respondWithResult(_0x3712f0,_0x487598){_0x487598=_0x487598||0xc8;return function(_0x5df2ae){if(_0x5df2ae){return _0x3712f0[_0x8166('0x16')](_0x487598)[_0x8166('0x17')](_0x5df2ae);}};}function respondWithFilteredResult(_0x136294,_0xad3a8a){return function(_0x7f233e){if(_0x7f233e){var _0x53bdb8=typeof _0xad3a8a[_0x8166('0x18')]===_0x8166('0x19')&&typeof _0xad3a8a[_0x8166('0x1a')]===_0x8166('0x19');var _0x49c3eb=_0x7f233e[_0x8166('0x1b')];var _0x544e19=_0x53bdb8?0x0:_0xad3a8a[_0x8166('0x18')];var _0x23a29c=_0x53bdb8?_0x7f233e['count']:_0xad3a8a[_0x8166('0x18')]+_0xad3a8a[_0x8166('0x1a')];var _0x253f4d;if(_0x23a29c>=_0x49c3eb){_0x23a29c=_0x49c3eb;_0x253f4d=0xc8;}else{_0x253f4d=0xce;}_0x136294['status'](_0x253f4d);return _0x136294[_0x8166('0x1c')](_0x8166('0x1d'),_0x544e19+'-'+_0x23a29c+'/'+_0x49c3eb)[_0x8166('0x17')](_0x7f233e);}return null;};}function patchUpdates(_0x52d6e0){return function(_0x4be767){try{jsonpatch['apply'](_0x4be767,_0x52d6e0,!![]);}catch(_0x2fecae){return BPromise[_0x8166('0x1e')](_0x2fecae);}return _0x4be767[_0x8166('0x1f')]();};}function saveUpdates(_0x169a41,_0x2d3208){return function(_0x4f91e8){if(_0x4f91e8){return _0x4f91e8['update'](_0x169a41)[_0x8166('0x20')](function(_0x4ed564){return _0x4ed564;});}return null;};}function removeEntity(_0x2a1269,_0x541f20){return function(_0x31fa0b){if(_0x31fa0b){return _0x31fa0b[_0x8166('0x21')]()['then'](function(){_0x2a1269[_0x8166('0x16')](0xcc)[_0x8166('0x15')]();});}};}function handleEntityNotFound(_0x17b536,_0x2425d2){return function(_0x4fe428){if(!_0x4fe428){_0x17b536[_0x8166('0x22')](0x194);}return _0x4fe428;};}function handleError(_0x2524e2,_0x422ca7){_0x422ca7=_0x422ca7||0x1f4;return function(_0x513361){logger['error'](_0x513361[_0x8166('0x23')]);if(_0x513361[_0x8166('0x24')]){delete _0x513361[_0x8166('0x24')];}_0x2524e2[_0x8166('0x16')](_0x422ca7)['send'](_0x513361);};}exports[_0x8166('0x25')]=function(_0x1bc30a,_0x254458){if(_0x1bc30a['body']['id']){delete _0x1bc30a[_0x8166('0x26')]['id'];}return db['Action'][_0x8166('0x27')]({'where':{'id':_0x1bc30a[_0x8166('0x28')]['id']}})[_0x8166('0x20')](handleEntityNotFound(_0x254458,null))[_0x8166('0x20')](saveUpdates(_0x1bc30a[_0x8166('0x26')],null))[_0x8166('0x20')](respondWithResult(_0x254458,null))['catch'](handleError(_0x254458,null));};exports[_0x8166('0x21')]=function(_0x303ae3,_0x2aa98b){return db[_0x8166('0x29')][_0x8166('0x27')]({'where':{'id':_0x303ae3[_0x8166('0x28')]['id']}})[_0x8166('0x20')](handleEntityNotFound(_0x2aa98b,null))[_0x8166('0x20')](removeEntity(_0x2aa98b,null))['catch'](handleError(_0x2aa98b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 16cb933..9d97be2 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 _0x2d65=['exports','define','tools_actions','lodash','util','api','bluebird','request-promise','path','rimraf','./action.attributes'];(function(_0x16e0f5,_0x4ec0f3){var _0x4839d5=function(_0x296b8f){while(--_0x296b8f){_0x16e0f5['push'](_0x16e0f5['shift']());}};_0x4839d5(++_0x4ec0f3);}(_0x2d65,0x1f2));var _0x52d6=function(_0x457e76,_0x358d00){_0x457e76=_0x457e76-0x0;var _0x46e847=_0x2d65[_0x457e76];return _0x46e847;};'use strict';var _=require(_0x52d6('0x0'));var util=require(_0x52d6('0x1'));var logger=require('../../config/logger')(_0x52d6('0x2'));var moment=require('moment');var BPromise=require(_0x52d6('0x3'));var rp=require(_0x52d6('0x4'));var fs=require('fs');var path=require(_0x52d6('0x5'));var rimraf=require(_0x52d6('0x6'));var config=require('../../config/environment');var attributes=require(_0x52d6('0x7'));module[_0x52d6('0x8')]=function(_0x15aa48,_0x3d3acc){return _0x15aa48[_0x52d6('0x9')]('Action',attributes,{'tableName':_0x52d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x444e=['rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x5ed29c,_0x2bf85b){var _0x24654c=function(_0x2af753){while(--_0x2af753){_0x5ed29c['push'](_0x5ed29c['shift']());}};_0x24654c(++_0x2bf85b);}(_0x444e,0x180));var _0xe444=function(_0x5a6b08,_0xb8a98e){_0x5a6b08=_0x5a6b08-0x0;var _0x30dbc2=_0x444e[_0x5a6b08];return _0x30dbc2;};'use strict';var _=require(_0xe444('0x0'));var util=require(_0xe444('0x1'));var logger=require(_0xe444('0x2'))(_0xe444('0x3'));var moment=require('moment');var BPromise=require(_0xe444('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe444('0x5'));var rimraf=require(_0xe444('0x6'));var config=require(_0xe444('0x7'));var attributes=require(_0xe444('0x8'));module[_0xe444('0x9')]=function(_0x5991c8,_0x271d9b){return _0x5991c8[_0xe444('0xa')](_0xe444('0xb'),attributes,{'tableName':_0xe444('0xc'),'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 f4f4181..de9c8ac 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x7217,0x19e));var _0x7721=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7217[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x53ec,0x192));var _0xc53e=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x53ec[_0x414f67];return _0x338537;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7988c79..109588b 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 _0xfd69=['./action.controller','put','/:id','isAuthenticated','update','exports','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x504d86,_0x4c45da){var _0x78226f=function(_0x4a58f4){while(--_0x4a58f4){_0x504d86['push'](_0x504d86['shift']());}};_0x78226f(++_0x4c45da);}(_0xfd69,0x156));var _0x9fd6=function(_0x3b00b4,_0x413db0){_0x3b00b4=_0x3b00b4-0x0;var _0x1f83a4=_0xfd69[_0x3b00b4];return _0x1f83a4;};'use strict';var multer=require('multer');var util=require(_0x9fd6('0x0'));var path=require(_0x9fd6('0x1'));var timeout=require('connect-timeout');var express=require(_0x9fd6('0x2'));var router=express[_0x9fd6('0x3')]();var fs_extra=require(_0x9fd6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9fd6('0x5'));var config=require('../../config/environment');var controller=require(_0x9fd6('0x6'));router[_0x9fd6('0x7')](_0x9fd6('0x8'),auth[_0x9fd6('0x9')](),controller[_0x9fd6('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x9fd6('0xb')]=router; \ No newline at end of file +var _0xd9b4=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','delete','multer'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd9b4,0x6f));var _0x4d9b=function(_0x5ccf18,_0x5d96d3){_0x5ccf18=_0x5ccf18-0x0;var _0xc33d73=_0xd9b4[_0x5ccf18];return _0xc33d73;};'use strict';var multer=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var path=require(_0x4d9b('0x2'));var timeout=require(_0x4d9b('0x3'));var express=require(_0x4d9b('0x4'));var router=express[_0x4d9b('0x5')]();var fs_extra=require(_0x4d9b('0x6'));var auth=require(_0x4d9b('0x7'));var interaction=require(_0x4d9b('0x8'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x4d9b('0x9')](_0x4d9b('0xa'),auth[_0x4d9b('0xb')](),controller[_0x4d9b('0xc')]);router[_0x4d9b('0xd')]('/:id',auth[_0x4d9b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index f33e0e9..329a74b 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 _0xae24=['sequelize','STRING'];(function(_0x971634,_0x560d92){var _0x591972=function(_0x53f5b1){while(--_0x53f5b1){_0x971634['push'](_0x971634['shift']());}};_0x591972(++_0x560d92);}(_0xae24,0x182));var _0x4ae2=function(_0xee7c56,_0x3b4b23){_0xee7c56=_0xee7c56-0x0;var _0x367971=_0xae24[_0xee7c56];return _0x367971;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xee14=['STRING','TEXT'];(function(_0x31824a,_0x423ed6){var _0x7f5c89=function(_0x17589e){while(--_0x17589e){_0x31824a['push'](_0x31824a['shift']());}};_0x7f5c89(++_0x423ed6);}(_0xee14,0x13a));var _0x4ee1=function(_0x97b20c,_0x2125c6){_0x97b20c=_0x97b20c-0x0;var _0x44fed2=_0xee14[_0x97b20c];return _0x44fed2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x4ee1('0x0')]},'parent':{'type':Sequelize[_0x4ee1('0x0')]},'table':{'type':Sequelize[_0x4ee1('0x0')]},'conditions':{'type':Sequelize[_0x4ee1('0x1')]},'joins':{'type':Sequelize[_0x4ee1('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 3d44c0f..b4ab3a8 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 _0x94c9=['pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','rawAttributes','include','create','body','user','role','find','params','preview','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','group','rules','field','condition','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','Please\x20insert\x20at\x20least\x20one\x20field','web','%s-%s.%s','randomstring','generate','output','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','operator','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters'];(function(_0x2d0bfd,_0x2ba336){var _0x4d806c=function(_0x47938d){while(--_0x47938d){_0x2d0bfd['push'](_0x2d0bfd['shift']());}};_0x4d806c(++_0x2ba336);}(_0x94c9,0x1a7));var _0x994c=function(_0x3cc575,_0x3e8ae6){_0x3cc575=_0x3cc575-0x0;var _0x276e6b=_0x94c9[_0x3cc575];return _0x276e6b;};'use strict';var emlformat=require(_0x994c('0x0'));var rimraf=require(_0x994c('0x1'));var zipdir=require(_0x994c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x994c('0x3'));var moment=require('moment');var BPromise=require(_0x994c('0x4'));var Mustache=require(_0x994c('0x5'));var util=require(_0x994c('0x6'));var path=require(_0x994c('0x7'));var sox=require(_0x994c('0x8'));var csv=require(_0x994c('0x9'));var ejs=require(_0x994c('0xa'));var fs=require('fs');var fs_extra=require(_0x994c('0xb'));var _=require(_0x994c('0xc'));var squel=require(_0x994c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x994c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x994c('0xf'));var Redis=require(_0x994c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x994c('0x11'));var as=require(_0x994c('0x12'));var hardwareService=require(_0x994c('0x13'));var logger=require(_0x994c('0x14'))(_0x994c('0x15'));var utils=require(_0x994c('0x16'));var config=require(_0x994c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x994c('0x18'))['db'];var dbH=require(_0x994c('0x18'))[_0x994c('0x19')];function respondWithStatusCode(_0x14a6e3,_0x5c1383){_0x5c1383=_0x5c1383||0xcc;return function(_0x4cadf7){if(_0x4cadf7){return _0x14a6e3['sendStatus'](_0x5c1383);}return _0x14a6e3[_0x994c('0x1a')](_0x5c1383)[_0x994c('0x1b')]();};}function respondWithResult(_0x48a799,_0x218af3){_0x218af3=_0x218af3||0xc8;return function(_0x30e52e){if(_0x30e52e){return _0x48a799[_0x994c('0x1a')](_0x218af3)['json'](_0x30e52e);}};}function respondWithFilteredResult(_0x56965c,_0x3d55e5){return function(_0x49d510){if(_0x49d510){var _0x4fa2ab=typeof _0x3d55e5[_0x994c('0x1c')]===_0x994c('0x1d')&&typeof _0x3d55e5['limit']===_0x994c('0x1d');var _0x2f0640=_0x49d510['count'];var _0x536b4b=_0x4fa2ab?0x0:_0x3d55e5['offset'];var _0x158d13=_0x4fa2ab?_0x49d510['count']:_0x3d55e5[_0x994c('0x1c')]+_0x3d55e5[_0x994c('0x1e')];var _0x218077;if(_0x158d13>=_0x2f0640){_0x158d13=_0x2f0640;_0x218077=0xc8;}else{_0x218077=0xce;}_0x56965c[_0x994c('0x1a')](_0x218077);return _0x56965c[_0x994c('0x1f')](_0x994c('0x20'),_0x536b4b+'-'+_0x158d13+'/'+_0x2f0640)[_0x994c('0x21')](_0x49d510);}return null;};}function patchUpdates(_0x5833f6){return function(_0x2cb1b5){try{jsonpatch[_0x994c('0x22')](_0x2cb1b5,_0x5833f6,!![]);}catch(_0x5efae7){return BPromise[_0x994c('0x23')](_0x5efae7);}return _0x2cb1b5[_0x994c('0x24')]();};}function saveUpdates(_0x87be60,_0xa8417f){return function(_0x4b25e6){if(_0x4b25e6){return _0x4b25e6[_0x994c('0x25')](_0x87be60)[_0x994c('0x26')](function(_0x2d6a77){return _0x2d6a77;});}return null;};}function removeEntity(_0x999b85,_0x5808f7){return function(_0x434b58){if(_0x434b58){return _0x434b58[_0x994c('0x27')]()['then'](function(){var _0x2d890d=_0x434b58[_0x994c('0x28')]({'plain':!![]});var _0x343268=_0x994c('0x29');return db[_0x994c('0x2a')][_0x994c('0x27')]({'where':{'type':_0x343268,'resourceId':_0x2d890d['id']}})[_0x994c('0x26')](function(){return _0x434b58;});})[_0x994c('0x26')](function(){_0x999b85[_0x994c('0x1a')](0xcc)[_0x994c('0x1b')]();});}};}function handleEntityNotFound(_0x5b265c,_0x5d35d2){return function(_0x28a213){if(!_0x28a213){_0x5b265c['sendStatus'](0x194);}return _0x28a213;};}function handleError(_0x1122a1,_0x2985ff){_0x2985ff=_0x2985ff||0x1f4;return function(_0xf15830){logger[_0x994c('0x2b')](_0xf15830['stack']);if(_0xf15830['name']){delete _0xf15830[_0x994c('0x2c')];}_0x1122a1[_0x994c('0x1a')](_0x2985ff)[_0x994c('0x2d')](_0xf15830);};}exports[_0x994c('0x2e')]=function(_0x15e06f,_0x39d291){var _0xaf5343={},_0x268cbe={},_0x49c3c6={'count':0x0,'rows':[]};var _0x1f9cfe=_[_0x994c('0x2f')](db[_0x994c('0x30')]['rawAttributes'],function(_0x26ef10){return{'name':_0x26ef10[_0x994c('0x31')],'type':_0x26ef10[_0x994c('0x32')][_0x994c('0x33')]};});_0x268cbe[_0x994c('0x34')]=_[_0x994c('0x2f')](_0x1f9cfe,_0x994c('0x2c'));_0x268cbe[_0x994c('0x35')]=_[_0x994c('0x36')](_0x15e06f[_0x994c('0x35')]);_0x268cbe['filters']=_[_0x994c('0x37')](_0x268cbe['model'],_0x268cbe[_0x994c('0x35')]);_0xaf5343['attributes']=_['intersection'](_0x268cbe[_0x994c('0x34')],qs[_0x994c('0x38')](_0x15e06f[_0x994c('0x35')][_0x994c('0x38')]));_0xaf5343[_0x994c('0x39')]=_0xaf5343[_0x994c('0x39')][_0x994c('0x3a')]?_0xaf5343[_0x994c('0x39')]:_0x268cbe[_0x994c('0x34')];if(!_0x15e06f[_0x994c('0x35')]['hasOwnProperty'](_0x994c('0x3b'))){_0xaf5343[_0x994c('0x1e')]=qs[_0x994c('0x1e')](_0x15e06f[_0x994c('0x35')][_0x994c('0x1e')]);_0xaf5343[_0x994c('0x1c')]=qs[_0x994c('0x1c')](_0x15e06f['query'][_0x994c('0x1c')]);}_0xaf5343['order']=qs[_0x994c('0x3c')](_0x15e06f[_0x994c('0x35')]['sort']);_0xaf5343[_0x994c('0x3d')]=qs[_0x994c('0x3e')](_[_0x994c('0x3f')](_0x15e06f[_0x994c('0x35')],_0x268cbe[_0x994c('0x3e')]),_0x1f9cfe);if(_0x15e06f[_0x994c('0x35')][_0x994c('0x40')]){_0xaf5343[_0x994c('0x3d')]=_['merge'](_0xaf5343[_0x994c('0x3d')],{'$or':_[_0x994c('0x2f')](_0x1f9cfe,function(_0x2c694f){if(_0x2c694f[_0x994c('0x32')]!==_0x994c('0x41')){var _0x25bb9b={};_0x25bb9b[_0x2c694f['name']]={'$like':'%'+_0x15e06f[_0x994c('0x35')][_0x994c('0x40')]+'%'};return _0x25bb9b;}})});}_0xaf5343=_[_0x994c('0x42')]({},_0xaf5343,_0x15e06f[_0x994c('0x43')]);var _0x2713c8={'where':_0xaf5343[_0x994c('0x3d')]};return db['AnalyticCustomReport'][_0x994c('0x44')](_0x2713c8)['then'](function(_0x1b77ab){_0x49c3c6[_0x994c('0x44')]=_0x1b77ab;if(_0x15e06f[_0x994c('0x35')][_0x994c('0x45')]){_0xaf5343['include']=[{'all':!![]}];}return db[_0x994c('0x30')][_0x994c('0x46')](_0xaf5343);})[_0x994c('0x26')](function(_0x1bcebd){_0x49c3c6[_0x994c('0x47')]=_0x1bcebd;return _0x49c3c6;})[_0x994c('0x26')](respondWithFilteredResult(_0x39d291,_0xaf5343))[_0x994c('0x48')](handleError(_0x39d291,null));};exports[_0x994c('0x49')]=function(_0x101e85,_0x4cd941){var _0x51a363={'raw':![],'where':{'id':_0x101e85['params']['id']}},_0x5caaef={};_0x5caaef[_0x994c('0x34')]=_[_0x994c('0x36')](db[_0x994c('0x30')][_0x994c('0x4a')]);_0x5caaef[_0x994c('0x35')]=_[_0x994c('0x36')](_0x101e85[_0x994c('0x35')]);_0x5caaef[_0x994c('0x3e')]=_['intersection'](_0x5caaef[_0x994c('0x34')],_0x5caaef[_0x994c('0x35')]);_0x51a363['attributes']=_['intersection'](_0x5caaef[_0x994c('0x34')],qs[_0x994c('0x38')](_0x101e85[_0x994c('0x35')][_0x994c('0x38')]));_0x51a363[_0x994c('0x39')]=_0x51a363[_0x994c('0x39')]['length']?_0x51a363[_0x994c('0x39')]:_0x5caaef[_0x994c('0x34')];if(_0x101e85[_0x994c('0x35')][_0x994c('0x45')]){_0x51a363[_0x994c('0x4b')]=[{'all':!![]}];}_0x51a363=_[_0x994c('0x42')]({},_0x51a363,_0x101e85[_0x994c('0x43')]);return db['AnalyticCustomReport']['find'](_0x51a363)['then'](handleEntityNotFound(_0x4cd941,null))['then'](respondWithResult(_0x4cd941,null))[_0x994c('0x48')](handleError(_0x4cd941,null));};exports['create']=function(_0xfe85a4,_0x20c953){return db[_0x994c('0x30')][_0x994c('0x4c')](_0xfe85a4[_0x994c('0x4d')],{})[_0x994c('0x26')](function(_0x4e88bd){var _0x2a9360=_0xfe85a4[_0x994c('0x4e')][_0x994c('0x28')]({'plain':!![]});if(!_0x2a9360)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a9360[_0x994c('0x4f')]===_0x994c('0x4e')){var _0x9b67fe=_0x4e88bd['get']({'plain':!![]});var _0x37f422='Reports';return db['UserProfileSection'][_0x994c('0x50')]({'where':{'name':_0x37f422,'userProfileId':_0x2a9360['userProfileId']},'raw':!![]})[_0x994c('0x26')](function(_0x13703e){if(_0x13703e&&_0x13703e['autoAssociation']===0x0){return db[_0x994c('0x2a')][_0x994c('0x4c')]({'name':_0x9b67fe[_0x994c('0x2c')],'resourceId':_0x9b67fe['id'],'type':'CustomReports','sectionId':_0x13703e['id']},{})['then'](function(){return _0x4e88bd;});}else{return _0x4e88bd;}})[_0x994c('0x48')](function(_0x149525){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x149525);throw _0x149525;});}return _0x4e88bd;})['then'](respondWithResult(_0x20c953,0xc9))[_0x994c('0x48')](handleError(_0x20c953,null));};exports['update']=function(_0x3b4c72,_0x28b424){if(_0x3b4c72[_0x994c('0x4d')]['id']){delete _0x3b4c72[_0x994c('0x4d')]['id'];}return db[_0x994c('0x30')][_0x994c('0x50')]({'where':{'id':_0x3b4c72[_0x994c('0x51')]['id']}})[_0x994c('0x26')](handleEntityNotFound(_0x28b424,null))[_0x994c('0x26')](saveUpdates(_0x3b4c72[_0x994c('0x4d')],null))['then'](respondWithResult(_0x28b424,null))[_0x994c('0x48')](handleError(_0x28b424,null));};exports[_0x994c('0x27')]=function(_0x5085b9,_0x1e0edc){return db['AnalyticCustomReport'][_0x994c('0x50')]({'where':{'id':_0x5085b9[_0x994c('0x51')]['id']}})[_0x994c('0x26')](handleEntityNotFound(_0x1e0edc,null))[_0x994c('0x26')](removeEntity(_0x1e0edc,null))['catch'](handleError(_0x1e0edc,null));};exports[_0x994c('0x52')]=function(_0x2640ce,_0x5e3807){var _0x4b73cb=0xa;var _0x1a0b0f=['join',_0x994c('0x53'),_0x994c('0x54'),'cross_join'];var _0x23111b={'SUM':_0x994c('0x55'),'COUNT':_0x994c('0x56'),'COUNT DISTINCT':_0x994c('0x57'),'MAX':_0x994c('0x58'),'MIN':_0x994c('0x59'),'AVG':_0x994c('0x5a'),'GROUP_CONCAT':_0x994c('0x5b'),'GROUP_CONCAT ASC':_0x994c('0x5c'),'GROUP_CONCAT DESC':_0x994c('0x5d')};var _0x23c18e={'SEC_TO_TIME':_0x994c('0x5e'),'DATE':_0x994c('0x5f'),'HOUR':_0x994c('0x60'),'ROUND':_0x994c('0x61'),'UNIX_TIMESTAMP':_0x994c('0x62')};var _0x51a005=function(_0x17fedc){return!_[_0x994c('0x63')]([_0x994c('0x64'),_0x994c('0x65'),_0x994c('0x66'),_0x994c('0x67')],_0x17fedc);};var _0x140a66=function(_0x22986b){if(!_0x22986b||!_0x22986b['rules'][_0x994c('0x3a')]){return'';}for(var _0x3a2831='(',_0x53d0b6=0x0;_0x53d0b6<_0x22986b['rules'][_0x994c('0x3a')];_0x53d0b6+=0x1){_0x53d0b6>0x0&&(_0x3a2831+='\x20'+_0x22986b['operator']+'\x20');_0x3a2831+=_0x22986b['rules'][_0x53d0b6][_0x994c('0x68')]?_0x140a66(_0x22986b[_0x994c('0x69')][_0x53d0b6][_0x994c('0x68')]):_0x22986b[_0x994c('0x69')][_0x53d0b6][_0x994c('0x6a')]+'\x20'+_0x22986b[_0x994c('0x69')][_0x53d0b6][_0x994c('0x6b')]+(_0x51a005(_0x22986b[_0x994c('0x69')][_0x53d0b6][_0x994c('0x6b')])?'\x20'+_0x22986b[_0x994c('0x69')][_0x53d0b6]['value']:'');}return _0x3a2831+')';};var _0xc8d654={'where':{'id':_0x2640ce[_0x994c('0x51')]['id']}},_0x47cd86,_0x414210,_0x578b03,_0x92aa1,_0x192b6e;_0xc8d654=_[_0x994c('0x42')]({},_0xc8d654,_0x2640ce[_0x994c('0x43')]);return db[_0x994c('0x30')][_0x994c('0x50')](_0xc8d654)[_0x994c('0x26')](function(_0xb4f83f){if(_0xb4f83f){_0x47cd86=_0xb4f83f;return _0xb4f83f[_0x994c('0x6c')]();}return null;})[_0x994c('0x26')](function(_0x130500){if(_0x130500){if(!_0x130500[_0x994c('0x3a')]){throw new db[(_0x994c('0x6d'))][(_0x994c('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x414210=_0x130500;return db[_0x994c('0x6f')][_0x994c('0x46')]({'raw':!![]});}return null;})[_0x994c('0x26')](function(_0x23aec3){if(_0x23aec3){_0x578b03=_[_0x994c('0x70')](_0x23aec3,'id');var _0x125ef0;var _0x4834e6=squel[_0x994c('0x71')]();_0x4834e6[_0x994c('0x72')](_0x47cd86[_0x994c('0x73')]);for(var _0x39469d=0x0;_0x39469d<_0x414210[_0x994c('0x3a')];_0x39469d+=0x1){_0x125ef0=_0x414210[_0x39469d][_0x994c('0x74')]?_0x578b03[_0x414210[_0x39469d][_0x994c('0x74')]]['metric']:_0x414210[_0x39469d][_0x994c('0x6a')];_0x125ef0=_0x414210[_0x39469d][_0x994c('0x75')]?_['replace'](_0x23111b[_0x414210[_0x39469d][_0x994c('0x75')]],'%s',_0x125ef0):_0x125ef0;_0x125ef0=_0x414210[_0x39469d][_0x994c('0x76')]?_[_0x994c('0x77')](_0x23c18e[_0x414210[_0x39469d][_0x994c('0x76')]],'%s',_0x125ef0):_0x125ef0;if(_0x414210[_0x39469d][_0x994c('0x78')]){_0x4834e6[_0x994c('0x68')](_0x125ef0);}_0x414210[_0x39469d][_0x994c('0x79')]&&_0x4834e6[_0x994c('0x7a')](_0x125ef0,_0x414210[_0x39469d]['orderBy']===_0x994c('0x7b')?![]:!![]);_0x4834e6[_0x994c('0x6a')](_0x125ef0,_0x414210[_0x39469d][_0x994c('0x7c')]||_0x125ef0);}if(_0x47cd86[_0x994c('0x7d')]){_0x47cd86[_0x994c('0x7d')]=JSON['parse'](_0x47cd86[_0x994c('0x7d')]);for(var _0x2ef87c=0x0;_0x2ef87c<_0x47cd86[_0x994c('0x7d')][_0x994c('0x3a')];_0x2ef87c+=0x1){if(_0x47cd86[_0x994c('0x7d')][_0x2ef87c][_0x994c('0x32')]&&_[_0x994c('0x63')](_0x1a0b0f,_0x47cd86['joins'][_0x2ef87c][_0x994c('0x32')])&&_0x47cd86[_0x994c('0x7d')][_0x2ef87c][_0x994c('0x7e')]&&_0x47cd86['joins'][_0x2ef87c][_0x994c('0x7f')]&&_0x47cd86[_0x994c('0x7d')][_0x2ef87c][_0x994c('0x80')]){_0x4834e6[_0x47cd86[_0x994c('0x7d')][_0x2ef87c][_0x994c('0x32')]](_0x47cd86[_0x994c('0x7d')][_0x2ef87c]['foreignTable'],null,util[_0x994c('0x76')]('%s.%s\x20=\x20%s.%s',_0x47cd86[_0x994c('0x73')],_0x47cd86['joins'][_0x2ef87c][_0x994c('0x7e')],_0x47cd86['joins'][_0x2ef87c][_0x994c('0x7f')],_0x47cd86[_0x994c('0x7d')][_0x2ef87c]['foreignKey']));}}}if(_0x47cd86[_0x994c('0x81')]){_0x47cd86[_0x994c('0x81')]=JSON[_0x994c('0x82')](_0x47cd86[_0x994c('0x81')]);_0x4834e6[_0x994c('0x3d')](_0x140a66(_0x47cd86[_0x994c('0x81')]['group']));}_0x192b6e=_0x4834e6[_0x994c('0x83')]();_0x4834e6[_0x994c('0x1e')](_0x4b73cb);_0x4834e6[_0x994c('0x1c')](0x0);logger[_0x994c('0x84')](_0x994c('0x85'),_0x4834e6[_0x994c('0x86')]());return dbH[_0x994c('0x87')][_0x994c('0x35')](_0x4834e6['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x994c('0x88')]});}})['then'](respondWithResult(_0x5e3807,null))[_0x994c('0x48')](handleError(_0x5e3807,null));};function runReport(_0x4cb2e0,_0x264568,_0x1db0c8){var _0x11bf24=_0x264568[_0x994c('0x2c')];var _0x97df2b=0xa;var _0x25db9c=[_0x994c('0x89'),_0x994c('0x53'),'right_join','cross_join'];var _0x2657a6={'SUM':_0x994c('0x55'),'COUNT':_0x994c('0x56'),'COUNT DISTINCT':_0x994c('0x57'),'MAX':_0x994c('0x58'),'MIN':_0x994c('0x59'),'AVG':_0x994c('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x994c('0x5c'),'GROUP_CONCAT DESC':_0x994c('0x5d')};var _0x284149={'SEC_TO_TIME':_0x994c('0x5e'),'DATE':_0x994c('0x5f'),'HOUR':_0x994c('0x60'),'ROUND':_0x994c('0x61'),'UNIX_TIMESTAMP':_0x994c('0x62')};var _0xe88654=function(_0x98bdb){return!_['includes']([_0x994c('0x64'),_0x994c('0x65'),_0x994c('0x66'),_0x994c('0x67')],_0x98bdb);};var _0x561245=function(_0xf9872b){if(!_0xf9872b||!_0xf9872b['rules']['length']){return'';}for(var _0x559f37='(',_0x430966=0x0;_0x430966<_0xf9872b[_0x994c('0x69')][_0x994c('0x3a')];_0x430966+=0x1){_0x430966>0x0&&(_0x559f37+='\x20'+_0xf9872b['operator']+'\x20');_0x559f37+=_0xf9872b[_0x994c('0x69')][_0x430966][_0x994c('0x68')]?_0x561245(_0xf9872b[_0x994c('0x69')][_0x430966][_0x994c('0x68')]):_0xf9872b[_0x994c('0x69')][_0x430966]['field']+'\x20'+_0xf9872b['rules'][_0x430966][_0x994c('0x6b')]+(_0xe88654(_0xf9872b[_0x994c('0x69')][_0x430966][_0x994c('0x6b')])?'\x20'+_0xf9872b[_0x994c('0x69')][_0x430966]['value']:'');}return _0x559f37+')';};var _0x136975={'where':{'id':_0x4cb2e0['id']}},_0x415398,_0x2fcd54,_0x4f0399,_0x4680c1,_0x3c45d5;_0x136975=_[_0x994c('0x42')]({},_0x136975,_0x1db0c8);return db[_0x994c('0x30')]['find'](_0x136975)['then'](function(_0x412332){if(_0x412332){_0x415398=_0x412332;return _0x412332[_0x994c('0x6c')]();}return null;})[_0x994c('0x26')](function(_0x360fa4){if(_0x360fa4){if(!_0x360fa4[_0x994c('0x3a')]){throw new db[(_0x994c('0x6d'))][(_0x994c('0x6e'))](_0x994c('0x8a'),0x193);}_0x2fcd54=_0x360fa4;return db[_0x994c('0x6f')][_0x994c('0x46')]({'raw':!![]});}return null;})['then'](function(_0x46b495){if(_0x46b495){_0x4f0399=_[_0x994c('0x70')](_0x46b495,'id');var _0x3508b9;var _0x380a45=squel['select']();_0x380a45['from'](_0x415398[_0x994c('0x73')]);for(var _0x50caf6=0x0;_0x50caf6<_0x2fcd54[_0x994c('0x3a')];_0x50caf6+=0x1){_0x3508b9=_0x2fcd54[_0x50caf6]['MetricId']?_0x4f0399[_0x2fcd54[_0x50caf6][_0x994c('0x74')]]['metric']:_0x2fcd54[_0x50caf6]['field'];_0x3508b9=_0x2fcd54[_0x50caf6]['function']?_['replace'](_0x2657a6[_0x2fcd54[_0x50caf6][_0x994c('0x75')]],'%s',_0x3508b9):_0x3508b9;_0x3508b9=_0x2fcd54[_0x50caf6][_0x994c('0x76')]?_['replace'](_0x284149[_0x2fcd54[_0x50caf6][_0x994c('0x76')]],'%s',_0x3508b9):_0x3508b9;if(_0x2fcd54[_0x50caf6]['groupBy']){_0x380a45[_0x994c('0x68')](_0x3508b9);}_0x2fcd54[_0x50caf6][_0x994c('0x79')]&&_0x380a45[_0x994c('0x7a')](_0x3508b9,_0x2fcd54[_0x50caf6][_0x994c('0x79')]==='DESC'?![]:!![]);_0x380a45[_0x994c('0x6a')](_0x3508b9,_0x2fcd54[_0x50caf6][_0x994c('0x7c')]||_0x3508b9);}if(_0x415398[_0x994c('0x7d')]){_0x415398[_0x994c('0x7d')]=JSON['parse'](_0x415398[_0x994c('0x7d')]);for(var _0x50f1ac=0x0;_0x50f1ac<_0x415398[_0x994c('0x7d')][_0x994c('0x3a')];_0x50f1ac+=0x1){if(_0x415398[_0x994c('0x7d')][_0x50f1ac]['type']&&_[_0x994c('0x63')](_0x25db9c,_0x415398[_0x994c('0x7d')][_0x50f1ac][_0x994c('0x32')])&&_0x415398['joins'][_0x50f1ac][_0x994c('0x7e')]&&_0x415398[_0x994c('0x7d')][_0x50f1ac]['foreignTable']&&_0x415398[_0x994c('0x7d')][_0x50f1ac][_0x994c('0x80')]){_0x380a45[_0x415398[_0x994c('0x7d')][_0x50f1ac][_0x994c('0x32')]](_0x415398[_0x994c('0x7d')][_0x50f1ac][_0x994c('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x415398[_0x994c('0x73')],_0x415398[_0x994c('0x7d')][_0x50f1ac][_0x994c('0x7e')],_0x415398[_0x994c('0x7d')][_0x50f1ac][_0x994c('0x7f')],_0x415398['joins'][_0x50f1ac][_0x994c('0x80')]));}}}if(_0x415398[_0x994c('0x81')]){_0x415398[_0x994c('0x81')]=JSON[_0x994c('0x82')](_0x415398[_0x994c('0x81')]);_0x380a45[_0x994c('0x3d')](_0x561245(_0x415398[_0x994c('0x81')][_0x994c('0x68')]));}_0x3c45d5=_0x380a45['clone']();_0x380a45[_0x994c('0x1e')](_0x97df2b);_0x380a45['offset'](0x0);return;}})[_0x994c('0x26')](function(){if(_0x264568['output']===_0x994c('0x8b')){return null;}var _0x21b728=_[_0x994c('0x42')](_0x264568,{'name':_0x264568['fullPath']||_0x264568[_0x994c('0x2c')]||_0x415398[_0x994c('0x2c')],'basename':_0x11bf24,'savename':util[_0x994c('0x76')](_0x994c('0x8c'),_0x264568[_0x994c('0x2c')]||_0x415398[_0x994c('0x2c')],require(_0x994c('0x8d'))[_0x994c('0x8e')](0x4),_0x264568[_0x994c('0x8f')]||_0x994c('0x90')),'reportId':_0x415398['id'],'reportType':_0x994c('0x91')});return db[_0x994c('0x92')][_0x994c('0x4c')](_0x21b728,{'raw':!![]});})[_0x994c('0x26')](function(_0x1bad63){if(_0x415398['table']===_0x994c('0x93')){_0x3c45d5[_0x994c('0x3d')](_0x415398[_0x994c('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x264568[_0x994c('0x94')],_0x264568[_0x994c('0x95')]);}else{_0x3c45d5[_0x994c('0x3d')](_0x415398['table']+_0x994c('0x96'),_0x264568[_0x994c('0x94')],_0x264568[_0x994c('0x95')]);}if(_0x1bad63){logger[_0x994c('0x97')]('Run\x20Query:',_0x3c45d5[_0x994c('0x86')]());require(_0x994c('0x98'))['fork'](path[_0x994c('0x89')](__dirname,_0x994c('0x99'),_0x1bad63[_0x994c('0x8f')]),[_0x1bad63['id'],_0x3c45d5['toString'](),path['join'](__dirname,_0x994c('0x9a'),_0x1bad63[_0x994c('0x9b')]),_0x11bf24]);return _0x1bad63;}else{var _0x4eaf96=squel['select']();_0x4eaf96[_0x994c('0x72')]('('+_0x3c45d5[_0x994c('0x86')]()+')',_0x994c('0x9c'));_0x4eaf96['field'](_0x994c('0x9d'),_0x994c('0x44'));_0x3c45d5[_0x994c('0x1e')](_0x264568[_0x994c('0x1e')]||_0x97df2b);_0x3c45d5[_0x994c('0x1c')](_0x264568['offset']||0x0);return dbH[_0x994c('0x87')][_0x994c('0x35')](_0x4eaf96[_0x994c('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x994c('0x88')]})[_0x994c('0x26')](function(_0x3ae4ff){if(!_0x3ae4ff[_0x994c('0x3a')]){_0x4680c1=0x0;}else{_0x4680c1=_0x3ae4ff[0x0]['count']||0x0;}return dbH['sequelize'][_0x994c('0x35')](_0x3c45d5[_0x994c('0x86')](),{'type':dbH[_0x994c('0x87')]['QueryTypes'][_0x994c('0x88')]});})['then'](function(_0x1e9802){return{'rows':_0x1e9802||[],'count':_0x4680c1};});}});}exports[_0x994c('0x9e')]=function(_0x316804,_0x4ad2cf){return runReport(_0x316804[_0x994c('0x51')],_0x316804['query'],_0x316804['options'])['then'](respondWithResult(_0x4ad2cf,null))[_0x994c('0x48')](handleError(_0x4ad2cf,null));};exports[_0x994c('0x9f')]=runReport;exports[_0x994c('0x35')]=function(_0x141e4f,_0x2c1e53){var _0x30f23e=0xa;var _0x53a014=[_0x994c('0x89'),'left_join',_0x994c('0x54'),'cross_join'];var _0x3d6539={'SUM':_0x994c('0x55'),'COUNT':_0x994c('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x994c('0x58'),'MIN':'MIN(%s)','AVG':_0x994c('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x994c('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x22d56e={'SEC_TO_TIME':_0x994c('0x5e'),'DATE':_0x994c('0x5f'),'HOUR':_0x994c('0x60'),'ROUND':_0x994c('0x61'),'UNIX_TIMESTAMP':_0x994c('0x62')};var _0x38c958=function(_0x1d1950){return!_[_0x994c('0x63')]([_0x994c('0x64'),'IS\x20NOT\x20NULL',_0x994c('0x66'),_0x994c('0x67')],_0x1d1950);};var _0x2c340a=function(_0x5d73af){if(!_0x5d73af||!_0x5d73af['rules'][_0x994c('0x3a')]){return'';}for(var _0x2d7101='(',_0xa1a78d=0x0;_0xa1a78d<_0x5d73af[_0x994c('0x69')]['length'];_0xa1a78d+=0x1){_0xa1a78d>0x0&&(_0x2d7101+='\x20'+_0x5d73af[_0x994c('0xa0')]+'\x20');_0x2d7101+=_0x5d73af[_0x994c('0x69')][_0xa1a78d][_0x994c('0x68')]?_0x2c340a(_0x5d73af[_0x994c('0x69')][_0xa1a78d]['group']):_0x5d73af[_0x994c('0x69')][_0xa1a78d][_0x994c('0x6a')]+'\x20'+_0x5d73af[_0x994c('0x69')][_0xa1a78d][_0x994c('0x6b')]+(_0x38c958(_0x5d73af[_0x994c('0x69')][_0xa1a78d][_0x994c('0x6b')])?'\x20'+_0x5d73af[_0x994c('0x69')][_0xa1a78d]['value']:'');}return _0x2d7101+')';};var _0xfe9640={'where':{'id':_0x141e4f['params']['id']}},_0x30acda,_0x1f5ec4,_0x6acf79,_0x22cc49,_0x39f26b;_0xfe9640=_[_0x994c('0x42')]({},_0xfe9640,_0x141e4f['options']);return db[_0x994c('0x30')][_0x994c('0x50')](_0xfe9640)[_0x994c('0x26')](function(_0x17429c){if(_0x17429c){_0x30acda=_0x17429c;return _0x17429c[_0x994c('0x6c')]();}return null;})[_0x994c('0x26')](function(_0x1f7a70){if(_0x1f7a70){if(!_0x1f7a70[_0x994c('0x3a')]){throw new db[(_0x994c('0x6d'))][(_0x994c('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1f5ec4=_0x1f7a70;return db[_0x994c('0x6f')][_0x994c('0x46')]({'raw':!![]});}return null;})['then'](function(_0x506938){if(_0x506938){_0x6acf79=_[_0x994c('0x70')](_0x506938,'id');var _0x146b1e;var _0x2cfe95=squel['select']();_0x2cfe95[_0x994c('0x72')](_0x30acda[_0x994c('0x73')]);for(var _0x5a9798=0x0;_0x5a9798<_0x1f5ec4[_0x994c('0x3a')];_0x5a9798+=0x1){_0x146b1e=_0x1f5ec4[_0x5a9798][_0x994c('0x74')]?_0x6acf79[_0x1f5ec4[_0x5a9798]['MetricId']]['metric']:_0x1f5ec4[_0x5a9798][_0x994c('0x6a')];_0x146b1e=_0x1f5ec4[_0x5a9798][_0x994c('0x75')]?_[_0x994c('0x77')](_0x3d6539[_0x1f5ec4[_0x5a9798][_0x994c('0x75')]],'%s',_0x146b1e):_0x146b1e;_0x146b1e=_0x1f5ec4[_0x5a9798][_0x994c('0x76')]?_[_0x994c('0x77')](_0x22d56e[_0x1f5ec4[_0x5a9798]['format']],'%s',_0x146b1e):_0x146b1e;if(_0x1f5ec4[_0x5a9798][_0x994c('0x78')]){_0x2cfe95['group'](_0x146b1e);}_0x1f5ec4[_0x5a9798]['orderBy']&&_0x2cfe95[_0x994c('0x7a')](_0x146b1e,_0x1f5ec4[_0x5a9798][_0x994c('0x79')]==='DESC'?![]:!![]);_0x2cfe95[_0x994c('0x6a')](_0x146b1e,_0x1f5ec4[_0x5a9798][_0x994c('0x7c')]||_0x146b1e);}if(_0x30acda[_0x994c('0x7d')]){_0x30acda[_0x994c('0x7d')]=JSON[_0x994c('0x82')](_0x30acda[_0x994c('0x7d')]);for(var _0x50e942=0x0;_0x50e942<_0x30acda['joins']['length'];_0x50e942+=0x1){if(_0x30acda['joins'][_0x50e942][_0x994c('0x32')]&&_[_0x994c('0x63')](_0x53a014,_0x30acda['joins'][_0x50e942][_0x994c('0x32')])&&_0x30acda['joins'][_0x50e942][_0x994c('0x7e')]&&_0x30acda['joins'][_0x50e942][_0x994c('0x7f')]&&_0x30acda[_0x994c('0x7d')][_0x50e942]['foreignKey']){_0x2cfe95[_0x30acda[_0x994c('0x7d')][_0x50e942]['type']](_0x30acda[_0x994c('0x7d')][_0x50e942][_0x994c('0x7f')],null,util[_0x994c('0x76')](_0x994c('0xa1'),_0x30acda[_0x994c('0x73')],_0x30acda[_0x994c('0x7d')][_0x50e942][_0x994c('0x7e')],_0x30acda[_0x994c('0x7d')][_0x50e942][_0x994c('0x7f')],_0x30acda[_0x994c('0x7d')][_0x50e942]['foreignKey']));}}}if(_0x30acda['conditions']){_0x30acda[_0x994c('0x81')]=JSON[_0x994c('0x82')](_0x30acda[_0x994c('0x81')]);_0x2cfe95[_0x994c('0x3d')](_0x2c340a(_0x30acda[_0x994c('0x81')][_0x994c('0x68')]));}_0x39f26b=_0x2cfe95[_0x994c('0x83')]();_0x2cfe95['limit'](_0x30f23e);_0x2cfe95[_0x994c('0x1c')](0x0);logger[_0x994c('0x84')](_0x994c('0x85'),_0x2cfe95[_0x994c('0x86')]());return dbH[_0x994c('0x87')]['query'](_0x2cfe95[_0x994c('0x86')](),{'type':dbH[_0x994c('0x87')]['QueryTypes']['SELECT']});}})[_0x994c('0x26')](function(){return{'sql':_0x39f26b[_0x994c('0x86')]()};})['then'](respondWithResult(_0x2c1e53,null))[_0x994c('0x48')](handleError(_0x2c1e53,null));}; \ No newline at end of file +var _0x5292=['UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','right_join','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','IS\x20NOT\x20NULL','merge','ValidationErrorItem','select','alias','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','create','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','SELECT','runReport','left_join','SUM(%s)','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','dbH','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','json','apply','save','then','destroy','get','CustomReports','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x5292,0x105));var _0x2529=function(_0x8051d7,_0x263ba9){_0x8051d7=_0x8051d7-0x0;var _0x3fb835=_0x5292[_0x8051d7];return _0x3fb835;};'use strict';var emlformat=require(_0x2529('0x0'));var rimraf=require(_0x2529('0x1'));var zipdir=require(_0x2529('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2529('0x3'));var moment=require(_0x2529('0x4'));var BPromise=require(_0x2529('0x5'));var Mustache=require(_0x2529('0x6'));var util=require(_0x2529('0x7'));var path=require(_0x2529('0x8'));var sox=require(_0x2529('0x9'));var csv=require(_0x2529('0xa'));var ejs=require(_0x2529('0xb'));var fs=require('fs');var fs_extra=require(_0x2529('0xc'));var _=require(_0x2529('0xd'));var squel=require(_0x2529('0xe'));var crypto=require('crypto');var jsforce=require(_0x2529('0xf'));var deskjs=require(_0x2529('0x10'));var toCsv=require(_0x2529('0xa'));var querystring=require(_0x2529('0x11'));var Papa=require(_0x2529('0x12'));var Redis=require(_0x2529('0x13'));var authService=require(_0x2529('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2529('0x15'));var hardwareService=require(_0x2529('0x16'));var logger=require(_0x2529('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2529('0x18'))['db'];var dbH=require(_0x2529('0x18'))[_0x2529('0x19')];function respondWithStatusCode(_0x597ae1,_0x4e0d8f){_0x4e0d8f=_0x4e0d8f||0xcc;return function(_0x3c4a8b){if(_0x3c4a8b){return _0x597ae1[_0x2529('0x1a')](_0x4e0d8f);}return _0x597ae1['status'](_0x4e0d8f)[_0x2529('0x1b')]();};}function respondWithResult(_0x5bdf46,_0x40f6b4){_0x40f6b4=_0x40f6b4||0xc8;return function(_0x34bf27){if(_0x34bf27){return _0x5bdf46['status'](_0x40f6b4)['json'](_0x34bf27);}};}function respondWithFilteredResult(_0x2ac5f6,_0x4a81c3){return function(_0x30ca6c){if(_0x30ca6c){var _0x4ebc59=typeof _0x4a81c3[_0x2529('0x1c')]===_0x2529('0x1d')&&typeof _0x4a81c3['limit']==='undefined';var _0x223ccd=_0x30ca6c['count'];var _0x270429=_0x4ebc59?0x0:_0x4a81c3[_0x2529('0x1c')];var _0x1166f2=_0x4ebc59?_0x30ca6c[_0x2529('0x1e')]:_0x4a81c3['offset']+_0x4a81c3[_0x2529('0x1f')];var _0x3f688a;if(_0x1166f2>=_0x223ccd){_0x1166f2=_0x223ccd;_0x3f688a=0xc8;}else{_0x3f688a=0xce;}_0x2ac5f6[_0x2529('0x20')](_0x3f688a);return _0x2ac5f6[_0x2529('0x21')](_0x2529('0x22'),_0x270429+'-'+_0x1166f2+'/'+_0x223ccd)[_0x2529('0x23')](_0x30ca6c);}return null;};}function patchUpdates(_0x9f8f92){return function(_0x3fa315){try{jsonpatch[_0x2529('0x24')](_0x3fa315,_0x9f8f92,!![]);}catch(_0x5e8009){return BPromise['reject'](_0x5e8009);}return _0x3fa315[_0x2529('0x25')]();};}function saveUpdates(_0x43312b,_0x2f6b61){return function(_0x218603){if(_0x218603){return _0x218603['update'](_0x43312b)[_0x2529('0x26')](function(_0x74066b){return _0x74066b;});}return null;};}function removeEntity(_0x1eca6b,_0x1d5414){return function(_0x307c04){if(_0x307c04){return _0x307c04[_0x2529('0x27')]()['then'](function(){var _0x43f6f9=_0x307c04[_0x2529('0x28')]({'plain':!![]});var _0x38cc6c=_0x2529('0x29');return db[_0x2529('0x2a')][_0x2529('0x27')]({'where':{'type':_0x38cc6c,'resourceId':_0x43f6f9['id']}})['then'](function(){return _0x307c04;});})[_0x2529('0x26')](function(){_0x1eca6b[_0x2529('0x20')](0xcc)[_0x2529('0x1b')]();});}};}function handleEntityNotFound(_0xf04ce9,_0x354fe9){return function(_0x9e3d9b){if(!_0x9e3d9b){_0xf04ce9['sendStatus'](0x194);}return _0x9e3d9b;};}function handleError(_0x2f9923,_0x2c32e4){_0x2c32e4=_0x2c32e4||0x1f4;return function(_0x5ed0ff){logger['error'](_0x5ed0ff[_0x2529('0x2b')]);if(_0x5ed0ff[_0x2529('0x2c')]){delete _0x5ed0ff['name'];}_0x2f9923[_0x2529('0x20')](_0x2c32e4)['send'](_0x5ed0ff);};}exports[_0x2529('0x2d')]=function(_0x2174ff,_0x3e73c5){var _0x2ba771={},_0x123962={},_0x268b8e={'count':0x0,'rows':[]};var _0x5f052f=_[_0x2529('0x2e')](db['AnalyticCustomReport'][_0x2529('0x2f')],function(_0x56d34d){return{'name':_0x56d34d[_0x2529('0x30')],'type':_0x56d34d[_0x2529('0x31')]['key']};});_0x123962[_0x2529('0x32')]=_['map'](_0x5f052f,_0x2529('0x2c'));_0x123962[_0x2529('0x33')]=_[_0x2529('0x34')](_0x2174ff[_0x2529('0x33')]);_0x123962[_0x2529('0x35')]=_['intersection'](_0x123962[_0x2529('0x32')],_0x123962[_0x2529('0x33')]);_0x2ba771[_0x2529('0x36')]=_[_0x2529('0x37')](_0x123962[_0x2529('0x32')],qs[_0x2529('0x38')](_0x2174ff['query'][_0x2529('0x38')]));_0x2ba771[_0x2529('0x36')]=_0x2ba771[_0x2529('0x36')][_0x2529('0x39')]?_0x2ba771[_0x2529('0x36')]:_0x123962[_0x2529('0x32')];if(!_0x2174ff['query']['hasOwnProperty'](_0x2529('0x3a'))){_0x2ba771[_0x2529('0x1f')]=qs[_0x2529('0x1f')](_0x2174ff[_0x2529('0x33')][_0x2529('0x1f')]);_0x2ba771[_0x2529('0x1c')]=qs[_0x2529('0x1c')](_0x2174ff[_0x2529('0x33')][_0x2529('0x1c')]);}_0x2ba771[_0x2529('0x3b')]=qs['sort'](_0x2174ff[_0x2529('0x33')][_0x2529('0x3c')]);_0x2ba771[_0x2529('0x3d')]=qs[_0x2529('0x35')](_[_0x2529('0x3e')](_0x2174ff['query'],_0x123962[_0x2529('0x35')]),_0x5f052f);if(_0x2174ff['query'][_0x2529('0x3f')]){_0x2ba771['where']=_['merge'](_0x2ba771[_0x2529('0x3d')],{'$or':_['map'](_0x5f052f,function(_0x5c621c){if(_0x5c621c[_0x2529('0x31')]!==_0x2529('0x40')){var _0x427184={};_0x427184[_0x5c621c['name']]={'$like':'%'+_0x2174ff[_0x2529('0x33')][_0x2529('0x3f')]+'%'};return _0x427184;}})});}_0x2ba771=_['merge']({},_0x2ba771,_0x2174ff[_0x2529('0x41')]);var _0x304110={'where':_0x2ba771[_0x2529('0x3d')]};return db[_0x2529('0x42')][_0x2529('0x1e')](_0x304110)[_0x2529('0x26')](function(_0x5af23d){_0x268b8e[_0x2529('0x1e')]=_0x5af23d;if(_0x2174ff[_0x2529('0x33')][_0x2529('0x43')]){_0x2ba771[_0x2529('0x44')]=[{'all':!![]}];}return db[_0x2529('0x42')][_0x2529('0x45')](_0x2ba771);})[_0x2529('0x26')](function(_0x4a53eb){_0x268b8e[_0x2529('0x46')]=_0x4a53eb;return _0x268b8e;})[_0x2529('0x26')](respondWithFilteredResult(_0x3e73c5,_0x2ba771))[_0x2529('0x47')](handleError(_0x3e73c5,null));};exports[_0x2529('0x48')]=function(_0x4fa47b,_0x36c7eb){var _0x5a57c6={'raw':![],'where':{'id':_0x4fa47b[_0x2529('0x49')]['id']}},_0xc6260e={};_0xc6260e[_0x2529('0x32')]=_[_0x2529('0x34')](db[_0x2529('0x42')][_0x2529('0x2f')]);_0xc6260e[_0x2529('0x33')]=_[_0x2529('0x34')](_0x4fa47b[_0x2529('0x33')]);_0xc6260e[_0x2529('0x35')]=_[_0x2529('0x37')](_0xc6260e[_0x2529('0x32')],_0xc6260e[_0x2529('0x33')]);_0x5a57c6[_0x2529('0x36')]=_['intersection'](_0xc6260e[_0x2529('0x32')],qs[_0x2529('0x38')](_0x4fa47b['query']['fields']));_0x5a57c6['attributes']=_0x5a57c6[_0x2529('0x36')]['length']?_0x5a57c6[_0x2529('0x36')]:_0xc6260e[_0x2529('0x32')];if(_0x4fa47b[_0x2529('0x33')][_0x2529('0x43')]){_0x5a57c6[_0x2529('0x44')]=[{'all':!![]}];}_0x5a57c6=_['merge']({},_0x5a57c6,_0x4fa47b['options']);return db[_0x2529('0x42')]['find'](_0x5a57c6)[_0x2529('0x26')](handleEntityNotFound(_0x36c7eb,null))[_0x2529('0x26')](respondWithResult(_0x36c7eb,null))['catch'](handleError(_0x36c7eb,null));};exports['create']=function(_0x303069,_0x1466eb){return db[_0x2529('0x42')]['create'](_0x303069[_0x2529('0x4a')],{})[_0x2529('0x26')](function(_0x1eec0f){var _0x3feec7=_0x303069[_0x2529('0x4b')][_0x2529('0x28')]({'plain':!![]});if(!_0x3feec7)throw new Error(_0x2529('0x4c'));if(_0x3feec7[_0x2529('0x4d')]===_0x2529('0x4b')){var _0x7bd364=_0x1eec0f[_0x2529('0x28')]({'plain':!![]});var _0x4fc51e=_0x2529('0x4e');return db[_0x2529('0x4f')][_0x2529('0x50')]({'where':{'name':_0x4fc51e,'userProfileId':_0x3feec7[_0x2529('0x51')]},'raw':!![]})['then'](function(_0x30c825){if(_0x30c825&&_0x30c825[_0x2529('0x52')]===0x0){return db[_0x2529('0x2a')]['create']({'name':_0x7bd364[_0x2529('0x2c')],'resourceId':_0x7bd364['id'],'type':'CustomReports','sectionId':_0x30c825['id']},{})[_0x2529('0x26')](function(){return _0x1eec0f;});}else{return _0x1eec0f;}})[_0x2529('0x47')](function(_0x269821){logger[_0x2529('0x53')](_0x2529('0x54'),_0x269821);throw _0x269821;});}return _0x1eec0f;})[_0x2529('0x26')](respondWithResult(_0x1466eb,0xc9))[_0x2529('0x47')](handleError(_0x1466eb,null));};exports['update']=function(_0x5abbd1,_0x136eb4){if(_0x5abbd1[_0x2529('0x4a')]['id']){delete _0x5abbd1[_0x2529('0x4a')]['id'];}return db['AnalyticCustomReport'][_0x2529('0x50')]({'where':{'id':_0x5abbd1[_0x2529('0x49')]['id']}})[_0x2529('0x26')](handleEntityNotFound(_0x136eb4,null))[_0x2529('0x26')](saveUpdates(_0x5abbd1[_0x2529('0x4a')],null))[_0x2529('0x26')](respondWithResult(_0x136eb4,null))[_0x2529('0x47')](handleError(_0x136eb4,null));};exports[_0x2529('0x27')]=function(_0x5edf9c,_0x1194cf){return db[_0x2529('0x42')][_0x2529('0x50')]({'where':{'id':_0x5edf9c[_0x2529('0x49')]['id']}})['then'](handleEntityNotFound(_0x1194cf,null))['then'](removeEntity(_0x1194cf,null))[_0x2529('0x47')](handleError(_0x1194cf,null));};exports[_0x2529('0x55')]=function(_0x55733a,_0x2f78e6){var _0x5412f9=0xa;var _0x3ee888=[_0x2529('0x56'),'left_join','right_join',_0x2529('0x57')];var _0x57093f={'SUM':'SUM(%s)','COUNT':_0x2529('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2529('0x59'),'MIN':_0x2529('0x5a'),'AVG':_0x2529('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2529('0x5c')};var _0x144e57={'SEC_TO_TIME':_0x2529('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x2529('0x5e'),'UNIX_TIMESTAMP':_0x2529('0x5f')};var _0x258ab5=function(_0x3ed085){return!_[_0x2529('0x60')]([_0x2529('0x61'),'IS\x20NOT\x20NULL',_0x2529('0x62'),_0x2529('0x63')],_0x3ed085);};var _0x41119b=function(_0x4318c2){if(!_0x4318c2||!_0x4318c2['rules']['length']){return'';}for(var _0x21ed36='(',_0x3f5e38=0x0;_0x3f5e38<_0x4318c2['rules']['length'];_0x3f5e38+=0x1){_0x3f5e38>0x0&&(_0x21ed36+='\x20'+_0x4318c2[_0x2529('0x64')]+'\x20');_0x21ed36+=_0x4318c2[_0x2529('0x65')][_0x3f5e38][_0x2529('0x66')]?_0x41119b(_0x4318c2[_0x2529('0x65')][_0x3f5e38]['group']):_0x4318c2[_0x2529('0x65')][_0x3f5e38][_0x2529('0x67')]+'\x20'+_0x4318c2[_0x2529('0x65')][_0x3f5e38][_0x2529('0x68')]+(_0x258ab5(_0x4318c2[_0x2529('0x65')][_0x3f5e38]['condition'])?'\x20'+_0x4318c2[_0x2529('0x65')][_0x3f5e38][_0x2529('0x69')]:'');}return _0x21ed36+')';};var _0x59cf66={'where':{'id':_0x55733a[_0x2529('0x49')]['id']}},_0x589782,_0x31a4f3,_0x303607,_0x5f0a85,_0x5ce4b1;_0x59cf66=_['merge']({},_0x59cf66,_0x55733a[_0x2529('0x41')]);return db[_0x2529('0x42')][_0x2529('0x50')](_0x59cf66)['then'](function(_0x397cc3){if(_0x397cc3){_0x589782=_0x397cc3;return _0x397cc3[_0x2529('0x6a')]();}return null;})[_0x2529('0x26')](function(_0x3ac507){if(_0x3ac507){if(!_0x3ac507[_0x2529('0x39')]){throw new db[(_0x2529('0x6b'))]['ValidationErrorItem'](_0x2529('0x6c'),0x193);}_0x31a4f3=_0x3ac507;return db[_0x2529('0x6d')][_0x2529('0x45')]({'raw':!![]});}return null;})[_0x2529('0x26')](function(_0x21b4e1){if(_0x21b4e1){_0x303607=_[_0x2529('0x6e')](_0x21b4e1,'id');var _0x119937;var _0x280d5f=squel['select']();_0x280d5f[_0x2529('0x6f')](_0x589782[_0x2529('0x70')]);for(var _0x566de1=0x0;_0x566de1<_0x31a4f3[_0x2529('0x39')];_0x566de1+=0x1){_0x119937=_0x31a4f3[_0x566de1][_0x2529('0x71')]?_0x303607[_0x31a4f3[_0x566de1][_0x2529('0x71')]][_0x2529('0x72')]:_0x31a4f3[_0x566de1][_0x2529('0x67')];_0x119937=_0x31a4f3[_0x566de1]['function']?_[_0x2529('0x73')](_0x57093f[_0x31a4f3[_0x566de1][_0x2529('0x74')]],'%s',_0x119937):_0x119937;_0x119937=_0x31a4f3[_0x566de1][_0x2529('0x75')]?_['replace'](_0x144e57[_0x31a4f3[_0x566de1][_0x2529('0x75')]],'%s',_0x119937):_0x119937;if(_0x31a4f3[_0x566de1][_0x2529('0x76')]){_0x280d5f[_0x2529('0x66')](_0x119937);}_0x31a4f3[_0x566de1]['orderBy']&&_0x280d5f[_0x2529('0x3b')](_0x119937,_0x31a4f3[_0x566de1][_0x2529('0x77')]===_0x2529('0x78')?![]:!![]);_0x280d5f['field'](_0x119937,_0x31a4f3[_0x566de1]['alias']||_0x119937);}if(_0x589782['joins']){_0x589782[_0x2529('0x79')]=JSON['parse'](_0x589782['joins']);for(var _0x3651c5=0x0;_0x3651c5<_0x589782['joins']['length'];_0x3651c5+=0x1){if(_0x589782['joins'][_0x3651c5][_0x2529('0x31')]&&_[_0x2529('0x60')](_0x3ee888,_0x589782[_0x2529('0x79')][_0x3651c5][_0x2529('0x31')])&&_0x589782[_0x2529('0x79')][_0x3651c5][_0x2529('0x7a')]&&_0x589782[_0x2529('0x79')][_0x3651c5]['foreignTable']&&_0x589782[_0x2529('0x79')][_0x3651c5][_0x2529('0x7b')]){_0x280d5f[_0x589782['joins'][_0x3651c5]['type']](_0x589782[_0x2529('0x79')][_0x3651c5][_0x2529('0x7c')],null,util[_0x2529('0x75')](_0x2529('0x7d'),_0x589782[_0x2529('0x70')],_0x589782[_0x2529('0x79')][_0x3651c5]['parentKey'],_0x589782['joins'][_0x3651c5][_0x2529('0x7c')],_0x589782[_0x2529('0x79')][_0x3651c5][_0x2529('0x7b')]));}}}if(_0x589782['conditions']){_0x589782[_0x2529('0x7e')]=JSON[_0x2529('0x7f')](_0x589782[_0x2529('0x7e')]);_0x280d5f[_0x2529('0x3d')](_0x41119b(_0x589782[_0x2529('0x7e')]['group']));}_0x5ce4b1=_0x280d5f[_0x2529('0x80')]();_0x280d5f[_0x2529('0x1f')](_0x5412f9);_0x280d5f[_0x2529('0x1c')](0x0);logger[_0x2529('0x81')](_0x2529('0x82'),_0x280d5f[_0x2529('0x83')]());return dbH['sequelize'][_0x2529('0x33')](_0x280d5f['toString'](),{'type':dbH[_0x2529('0x84')][_0x2529('0x85')]['SELECT']});}})['then'](respondWithResult(_0x2f78e6,null))[_0x2529('0x47')](handleError(_0x2f78e6,null));};function runReport(_0x3d3daa,_0x159dbb,_0x4dc04d){var _0x2c8430=_0x159dbb[_0x2529('0x2c')];var _0x22d147=0xa;var _0x463bca=[_0x2529('0x56'),'left_join',_0x2529('0x86'),_0x2529('0x57')];var _0x3843a1={'SUM':'SUM(%s)','COUNT':_0x2529('0x58'),'COUNT DISTINCT':_0x2529('0x87'),'MAX':_0x2529('0x59'),'MIN':_0x2529('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2529('0x88'),'GROUP_CONCAT ASC':_0x2529('0x89'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x7eee87={'SEC_TO_TIME':_0x2529('0x5d'),'DATE':_0x2529('0x8a'),'HOUR':_0x2529('0x8b'),'ROUND':_0x2529('0x5e'),'UNIX_TIMESTAMP':_0x2529('0x5f')};var _0x21f9c1=function(_0x2c5f3f){return!_[_0x2529('0x60')](['IS\x20NULL',_0x2529('0x8c'),_0x2529('0x62'),_0x2529('0x63')],_0x2c5f3f);};var _0x2267fc=function(_0x40b22b){if(!_0x40b22b||!_0x40b22b[_0x2529('0x65')]['length']){return'';}for(var _0x21375c='(',_0x41eefc=0x0;_0x41eefc<_0x40b22b[_0x2529('0x65')]['length'];_0x41eefc+=0x1){_0x41eefc>0x0&&(_0x21375c+='\x20'+_0x40b22b[_0x2529('0x64')]+'\x20');_0x21375c+=_0x40b22b[_0x2529('0x65')][_0x41eefc][_0x2529('0x66')]?_0x2267fc(_0x40b22b[_0x2529('0x65')][_0x41eefc][_0x2529('0x66')]):_0x40b22b['rules'][_0x41eefc][_0x2529('0x67')]+'\x20'+_0x40b22b[_0x2529('0x65')][_0x41eefc][_0x2529('0x68')]+(_0x21f9c1(_0x40b22b[_0x2529('0x65')][_0x41eefc][_0x2529('0x68')])?'\x20'+_0x40b22b[_0x2529('0x65')][_0x41eefc][_0x2529('0x69')]:'');}return _0x21375c+')';};var _0x461c79={'where':{'id':_0x3d3daa['id']}},_0x1de417,_0x400b82,_0x31a624,_0x1c29c5,_0x4a6992;_0x461c79=_[_0x2529('0x8d')]({},_0x461c79,_0x4dc04d);return db[_0x2529('0x42')][_0x2529('0x50')](_0x461c79)[_0x2529('0x26')](function(_0x33876b){if(_0x33876b){_0x1de417=_0x33876b;return _0x33876b['getFields']();}return null;})[_0x2529('0x26')](function(_0x1cbb18){if(_0x1cbb18){if(!_0x1cbb18[_0x2529('0x39')]){throw new db[(_0x2529('0x6b'))][(_0x2529('0x8e'))](_0x2529('0x6c'),0x193);}_0x400b82=_0x1cbb18;return db[_0x2529('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2529('0x26')](function(_0x8cb2b7){if(_0x8cb2b7){_0x31a624=_[_0x2529('0x6e')](_0x8cb2b7,'id');var _0xa5a61;var _0x165f8d=squel[_0x2529('0x8f')]();_0x165f8d[_0x2529('0x6f')](_0x1de417[_0x2529('0x70')]);for(var _0x505a5c=0x0;_0x505a5c<_0x400b82[_0x2529('0x39')];_0x505a5c+=0x1){_0xa5a61=_0x400b82[_0x505a5c][_0x2529('0x71')]?_0x31a624[_0x400b82[_0x505a5c][_0x2529('0x71')]][_0x2529('0x72')]:_0x400b82[_0x505a5c][_0x2529('0x67')];_0xa5a61=_0x400b82[_0x505a5c]['function']?_[_0x2529('0x73')](_0x3843a1[_0x400b82[_0x505a5c]['function']],'%s',_0xa5a61):_0xa5a61;_0xa5a61=_0x400b82[_0x505a5c][_0x2529('0x75')]?_[_0x2529('0x73')](_0x7eee87[_0x400b82[_0x505a5c][_0x2529('0x75')]],'%s',_0xa5a61):_0xa5a61;if(_0x400b82[_0x505a5c][_0x2529('0x76')]){_0x165f8d['group'](_0xa5a61);}_0x400b82[_0x505a5c][_0x2529('0x77')]&&_0x165f8d[_0x2529('0x3b')](_0xa5a61,_0x400b82[_0x505a5c][_0x2529('0x77')]===_0x2529('0x78')?![]:!![]);_0x165f8d['field'](_0xa5a61,_0x400b82[_0x505a5c][_0x2529('0x90')]||_0xa5a61);}if(_0x1de417[_0x2529('0x79')]){_0x1de417['joins']=JSON[_0x2529('0x7f')](_0x1de417[_0x2529('0x79')]);for(var _0xd53c1e=0x0;_0xd53c1e<_0x1de417['joins'][_0x2529('0x39')];_0xd53c1e+=0x1){if(_0x1de417[_0x2529('0x79')][_0xd53c1e][_0x2529('0x31')]&&_[_0x2529('0x60')](_0x463bca,_0x1de417[_0x2529('0x79')][_0xd53c1e][_0x2529('0x31')])&&_0x1de417[_0x2529('0x79')][_0xd53c1e]['parentKey']&&_0x1de417[_0x2529('0x79')][_0xd53c1e][_0x2529('0x7c')]&&_0x1de417[_0x2529('0x79')][_0xd53c1e][_0x2529('0x7b')]){_0x165f8d[_0x1de417[_0x2529('0x79')][_0xd53c1e][_0x2529('0x31')]](_0x1de417[_0x2529('0x79')][_0xd53c1e][_0x2529('0x7c')],null,util[_0x2529('0x75')](_0x2529('0x7d'),_0x1de417[_0x2529('0x70')],_0x1de417['joins'][_0xd53c1e][_0x2529('0x7a')],_0x1de417[_0x2529('0x79')][_0xd53c1e][_0x2529('0x7c')],_0x1de417[_0x2529('0x79')][_0xd53c1e][_0x2529('0x7b')]));}}}if(_0x1de417[_0x2529('0x7e')]){_0x1de417[_0x2529('0x7e')]=JSON[_0x2529('0x7f')](_0x1de417[_0x2529('0x7e')]);_0x165f8d[_0x2529('0x3d')](_0x2267fc(_0x1de417['conditions'][_0x2529('0x66')]));}_0x4a6992=_0x165f8d[_0x2529('0x80')]();_0x165f8d[_0x2529('0x1f')](_0x22d147);_0x165f8d['offset'](0x0);return;}})[_0x2529('0x26')](function(){if(_0x159dbb[_0x2529('0x91')]===_0x2529('0x92')){return null;}var _0x36a235=_[_0x2529('0x8d')](_0x159dbb,{'name':_0x159dbb[_0x2529('0x93')]||_0x159dbb['name']||_0x1de417[_0x2529('0x2c')],'basename':_0x2c8430,'savename':util[_0x2529('0x75')](_0x2529('0x94'),_0x159dbb[_0x2529('0x2c')]||_0x1de417['name'],require('randomstring')[_0x2529('0x95')](0x4),_0x159dbb[_0x2529('0x91')]||_0x2529('0x96')),'reportId':_0x1de417['id'],'reportType':_0x2529('0x97')});return db[_0x2529('0x98')][_0x2529('0x99')](_0x36a235,{'raw':!![]});})[_0x2529('0x26')](function(_0x2974ee){if(_0x1de417[_0x2529('0x70')]==='cdr'){_0x4a6992[_0x2529('0x3d')](_0x1de417[_0x2529('0x70')]+_0x2529('0x9a'),_0x159dbb[_0x2529('0x9b')],_0x159dbb['endDate']);}else{_0x4a6992[_0x2529('0x3d')](_0x1de417[_0x2529('0x70')]+_0x2529('0x9c'),_0x159dbb[_0x2529('0x9b')],_0x159dbb[_0x2529('0x9d')]);}if(_0x2974ee){logger[_0x2529('0x9e')](_0x2529('0x9f'),_0x4a6992[_0x2529('0x83')]());require(_0x2529('0xa0'))[_0x2529('0xa1')](path[_0x2529('0x56')](__dirname,_0x2529('0xa2'),_0x2974ee['output']),[_0x2974ee['id'],_0x4a6992[_0x2529('0x83')](),path['join'](__dirname,_0x2529('0xa3'),_0x2974ee[_0x2529('0xa4')]),_0x2c8430]);return _0x2974ee;}else{var _0x37491a=squel[_0x2529('0x8f')]();_0x37491a[_0x2529('0x6f')]('('+_0x4a6992[_0x2529('0x83')]()+')','countTable');_0x37491a['field'](_0x2529('0xa5'),_0x2529('0x1e'));_0x4a6992[_0x2529('0x1f')](_0x159dbb[_0x2529('0x1f')]||_0x22d147);_0x4a6992['offset'](_0x159dbb['offset']||0x0);return dbH['sequelize']['query'](_0x37491a[_0x2529('0x83')](),{'type':dbH[_0x2529('0x84')]['QueryTypes']['SELECT']})[_0x2529('0x26')](function(_0x1ae72e){if(!_0x1ae72e[_0x2529('0x39')]){_0x1c29c5=0x0;}else{_0x1c29c5=_0x1ae72e[0x0][_0x2529('0x1e')]||0x0;}return dbH[_0x2529('0x84')]['query'](_0x4a6992['toString'](),{'type':dbH[_0x2529('0x84')][_0x2529('0x85')][_0x2529('0xa6')]});})[_0x2529('0x26')](function(_0x2496a9){return{'rows':_0x2496a9||[],'count':_0x1c29c5};});}});}exports['run']=function(_0x5accd3,_0x1f4f94){return runReport(_0x5accd3[_0x2529('0x49')],_0x5accd3[_0x2529('0x33')],_0x5accd3[_0x2529('0x41')])[_0x2529('0x26')](respondWithResult(_0x1f4f94,null))[_0x2529('0x47')](handleError(_0x1f4f94,null));};exports[_0x2529('0xa7')]=runReport;exports[_0x2529('0x33')]=function(_0x10d943,_0x4c3da8){var _0x17bbf3=0xa;var _0x329928=[_0x2529('0x56'),_0x2529('0xa8'),_0x2529('0x86'),_0x2529('0x57')];var _0x145df3={'SUM':_0x2529('0xa9'),'COUNT':_0x2529('0x58'),'COUNT DISTINCT':_0x2529('0x87'),'MAX':_0x2529('0x59'),'MIN':_0x2529('0x5a'),'AVG':_0x2529('0x5b'),'GROUP_CONCAT':_0x2529('0x88'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2529('0x5c')};var _0x1bb5e3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2529('0x8a'),'HOUR':_0x2529('0x8b'),'ROUND':_0x2529('0x5e'),'UNIX_TIMESTAMP':_0x2529('0x5f')};var _0x802412=function(_0x135571){return!_['includes']([_0x2529('0x61'),_0x2529('0x8c'),'IS\x20EMPTY',_0x2529('0x63')],_0x135571);};var _0x5b288b=function(_0x34c249){if(!_0x34c249||!_0x34c249[_0x2529('0x65')][_0x2529('0x39')]){return'';}for(var _0x19aaea='(',_0xa7ec40=0x0;_0xa7ec40<_0x34c249[_0x2529('0x65')][_0x2529('0x39')];_0xa7ec40+=0x1){_0xa7ec40>0x0&&(_0x19aaea+='\x20'+_0x34c249[_0x2529('0x64')]+'\x20');_0x19aaea+=_0x34c249[_0x2529('0x65')][_0xa7ec40][_0x2529('0x66')]?_0x5b288b(_0x34c249['rules'][_0xa7ec40][_0x2529('0x66')]):_0x34c249[_0x2529('0x65')][_0xa7ec40][_0x2529('0x67')]+'\x20'+_0x34c249['rules'][_0xa7ec40][_0x2529('0x68')]+(_0x802412(_0x34c249[_0x2529('0x65')][_0xa7ec40][_0x2529('0x68')])?'\x20'+_0x34c249['rules'][_0xa7ec40]['value']:'');}return _0x19aaea+')';};var _0x45139c={'where':{'id':_0x10d943[_0x2529('0x49')]['id']}},_0x29f69e,_0x12bb7f,_0x1b3f35,_0x5e0086,_0x48259d;_0x45139c=_[_0x2529('0x8d')]({},_0x45139c,_0x10d943[_0x2529('0x41')]);return db[_0x2529('0x42')]['find'](_0x45139c)[_0x2529('0x26')](function(_0x435180){if(_0x435180){_0x29f69e=_0x435180;return _0x435180['getFields']();}return null;})[_0x2529('0x26')](function(_0x136009){if(_0x136009){if(!_0x136009['length']){throw new db[(_0x2529('0x6b'))][(_0x2529('0x8e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x12bb7f=_0x136009;return db[_0x2529('0x6d')][_0x2529('0x45')]({'raw':!![]});}return null;})[_0x2529('0x26')](function(_0x27f8fb){if(_0x27f8fb){_0x1b3f35=_[_0x2529('0x6e')](_0x27f8fb,'id');var _0x26ce6c;var _0xf60c93=squel[_0x2529('0x8f')]();_0xf60c93[_0x2529('0x6f')](_0x29f69e[_0x2529('0x70')]);for(var _0x19edde=0x0;_0x19edde<_0x12bb7f[_0x2529('0x39')];_0x19edde+=0x1){_0x26ce6c=_0x12bb7f[_0x19edde][_0x2529('0x71')]?_0x1b3f35[_0x12bb7f[_0x19edde][_0x2529('0x71')]][_0x2529('0x72')]:_0x12bb7f[_0x19edde][_0x2529('0x67')];_0x26ce6c=_0x12bb7f[_0x19edde]['function']?_[_0x2529('0x73')](_0x145df3[_0x12bb7f[_0x19edde][_0x2529('0x74')]],'%s',_0x26ce6c):_0x26ce6c;_0x26ce6c=_0x12bb7f[_0x19edde]['format']?_['replace'](_0x1bb5e3[_0x12bb7f[_0x19edde][_0x2529('0x75')]],'%s',_0x26ce6c):_0x26ce6c;if(_0x12bb7f[_0x19edde]['groupBy']){_0xf60c93[_0x2529('0x66')](_0x26ce6c);}_0x12bb7f[_0x19edde][_0x2529('0x77')]&&_0xf60c93['order'](_0x26ce6c,_0x12bb7f[_0x19edde][_0x2529('0x77')]===_0x2529('0x78')?![]:!![]);_0xf60c93[_0x2529('0x67')](_0x26ce6c,_0x12bb7f[_0x19edde][_0x2529('0x90')]||_0x26ce6c);}if(_0x29f69e[_0x2529('0x79')]){_0x29f69e['joins']=JSON[_0x2529('0x7f')](_0x29f69e[_0x2529('0x79')]);for(var _0x7fd6c=0x0;_0x7fd6c<_0x29f69e[_0x2529('0x79')]['length'];_0x7fd6c+=0x1){if(_0x29f69e[_0x2529('0x79')][_0x7fd6c]['type']&&_['includes'](_0x329928,_0x29f69e[_0x2529('0x79')][_0x7fd6c][_0x2529('0x31')])&&_0x29f69e[_0x2529('0x79')][_0x7fd6c][_0x2529('0x7a')]&&_0x29f69e[_0x2529('0x79')][_0x7fd6c]['foreignTable']&&_0x29f69e['joins'][_0x7fd6c]['foreignKey']){_0xf60c93[_0x29f69e[_0x2529('0x79')][_0x7fd6c][_0x2529('0x31')]](_0x29f69e[_0x2529('0x79')][_0x7fd6c][_0x2529('0x7c')],null,util[_0x2529('0x75')](_0x2529('0x7d'),_0x29f69e[_0x2529('0x70')],_0x29f69e['joins'][_0x7fd6c]['parentKey'],_0x29f69e[_0x2529('0x79')][_0x7fd6c][_0x2529('0x7c')],_0x29f69e[_0x2529('0x79')][_0x7fd6c][_0x2529('0x7b')]));}}}if(_0x29f69e[_0x2529('0x7e')]){_0x29f69e[_0x2529('0x7e')]=JSON['parse'](_0x29f69e[_0x2529('0x7e')]);_0xf60c93[_0x2529('0x3d')](_0x5b288b(_0x29f69e[_0x2529('0x7e')][_0x2529('0x66')]));}_0x48259d=_0xf60c93[_0x2529('0x80')]();_0xf60c93[_0x2529('0x1f')](_0x17bbf3);_0xf60c93[_0x2529('0x1c')](0x0);logger[_0x2529('0x81')](_0x2529('0x82'),_0xf60c93[_0x2529('0x83')]());return dbH[_0x2529('0x84')][_0x2529('0x33')](_0xf60c93['toString'](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x48259d[_0x2529('0x83')]()};})['then'](respondWithResult(_0x4c3da8,null))[_0x2529('0x47')](handleError(_0x4c3da8,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2907a44..1c14434 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 _0x8f84=['../../config/logger','api','moment','bluebird','path','rimraf','exports','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x54d533,_0x8c00e1){var _0x230ad1=function(_0x49f417){while(--_0x49f417){_0x54d533['push'](_0x54d533['shift']());}};_0x230ad1(++_0x8c00e1);}(_0x8f84,0x77));var _0x48f8=function(_0x3cb051,_0x3aac86){_0x3cb051=_0x3cb051-0x0;var _0x21dd99=_0x8f84[_0x3cb051];return _0x21dd99;};'use strict';var _=require(_0x48f8('0x0'));var util=require('util');var logger=require(_0x48f8('0x1'))(_0x48f8('0x2'));var moment=require(_0x48f8('0x3'));var BPromise=require(_0x48f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48f8('0x5'));var rimraf=require(_0x48f8('0x6'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x48f8('0x7')]=function(_0x3d62e7,_0x4dfcf4){return _0x3d62e7['define'](_0x48f8('0x8'),attributes,{'tableName':_0x48f8('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe36c=['bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0xce1b17,_0x2adbf0){var _0x456f0c=function(_0x711fc5){while(--_0x711fc5){_0xce1b17['push'](_0xce1b17['shift']());}};_0x456f0c(++_0x2adbf0);}(_0xe36c,0x12f));var _0xce36=function(_0x33f69e,_0x36d8fc){_0x33f69e=_0x33f69e-0x0;var _0x2294be=_0xe36c[_0x33f69e];return _0x2294be;};'use strict';var _=require(_0xce36('0x0'));var util=require(_0xce36('0x1'));var logger=require(_0xce36('0x2'))(_0xce36('0x3'));var moment=require(_0xce36('0x4'));var BPromise=require(_0xce36('0x5'));var rp=require(_0xce36('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce36('0x7'));var config=require(_0xce36('0x8'));var attributes=require(_0xce36('0x9'));module[_0xce36('0xa')]=function(_0x2f73b7,_0x2aab05){return _0x2f73b7[_0xce36('0xb')](_0xce36('0xc'),attributes,{'tableName':_0xce36('0xd'),'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 95bbf7d..647e841 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 _0x0313=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x32f560,_0x4d79db){var _0x37dbdf=function(_0xb84b41){while(--_0xb84b41){_0x32f560['push'](_0x32f560['shift']());}};_0x37dbdf(++_0x4d79db);}(_0x0313,0x128));var _0x3031=function(_0x81c98a,_0x2f7dd6){_0x81c98a=_0x81c98a-0x0;var _0x2d5c09=_0x0313[_0x81c98a];return _0x2d5c09;};'use strict';var _=require('lodash');var util=require(_0x3031('0x0'));var moment=require(_0x3031('0x1'));var BPromise=require(_0x3031('0x2'));var rs=require(_0x3031('0x3'));var fs=require('fs');var Redis=require(_0x3031('0x4'));var db=require(_0x3031('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3031('0x6'))('rpc');var config=require(_0x3031('0x7'));var jayson=require(_0x3031('0x8'));var client=jayson[_0x3031('0x9')][_0x3031('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x157010,_0x309602,_0x67441d){return new BPromise(function(_0x1441be,_0x2439cc){return client[_0x3031('0xb')](_0x157010,_0x67441d)[_0x3031('0xc')](function(_0x3dda16){logger['info'](_0x3031('0xd'),_0x309602,_0x3031('0xe'));logger[_0x3031('0xf')](_0x3031('0x10'),_0x309602,_0x3031('0xe'),JSON[_0x3031('0x11')](_0x3dda16));if(_0x3dda16[_0x3031('0x12')]){if(_0x3dda16[_0x3031('0x12')][_0x3031('0x13')]===0x1f4){logger['error'](_0x3031('0xd'),_0x309602,_0x3dda16['error'][_0x3031('0x14')]);return _0x2439cc(_0x3dda16['error'][_0x3031('0x14')]);}logger['error'](_0x3031('0xd'),_0x309602,_0x3dda16[_0x3031('0x12')]['message']);return _0x1441be(_0x3dda16['error'][_0x3031('0x14')]);}else{logger[_0x3031('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x309602,_0x3031('0xe'));_0x1441be(_0x3dda16[_0x3031('0x16')][_0x3031('0x14')]);}})[_0x3031('0x17')](function(_0x1a1744){logger[_0x3031('0x12')](_0x3031('0xd'),_0x309602,_0x1a1744);_0x2439cc(_0x1a1744);});});} \ No newline at end of file +var _0xaec4=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xbef04,_0x2973e){var _0x4ca48f=function(_0x17d428){while(--_0x17d428){_0xbef04['push'](_0xbef04['shift']());}};_0x4ca48f(++_0x2973e);}(_0xaec4,0xbb));var _0x4aec=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xaec4[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x4aec('0x0'));var moment=require('moment');var BPromise=require(_0x4aec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4aec('0x2'));var db=require(_0x4aec('0x3'))['db'];var utils=require(_0x4aec('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4aec('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4aec('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4f3938,_0x350d03,_0x416a7d){return new BPromise(function(_0xf8a192,_0xe65772){return client['request'](_0x4f3938,_0x416a7d)['then'](function(_0x136c1e){logger[_0x4aec('0x7')](_0x4aec('0x8'),_0x350d03,_0x4aec('0x9'));logger[_0x4aec('0xa')](_0x4aec('0xb'),_0x350d03,_0x4aec('0x9'),JSON[_0x4aec('0xc')](_0x136c1e));if(_0x136c1e[_0x4aec('0xd')]){if(_0x136c1e[_0x4aec('0xd')][_0x4aec('0xe')]===0x1f4){logger[_0x4aec('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x350d03,_0x136c1e['error'][_0x4aec('0xf')]);return _0xe65772(_0x136c1e[_0x4aec('0xd')][_0x4aec('0xf')]);}logger[_0x4aec('0xd')](_0x4aec('0x8'),_0x350d03,_0x136c1e[_0x4aec('0xd')][_0x4aec('0xf')]);return _0xf8a192(_0x136c1e[_0x4aec('0xd')]['message']);}else{logger[_0x4aec('0x7')]('AnalyticCustomReport,\x20%s,\x20%s',_0x350d03,_0x4aec('0x9'));_0xf8a192(_0x136c1e[_0x4aec('0x10')]['message']);}})['catch'](function(_0x50bc75){logger[_0x4aec('0xd')](_0x4aec('0x8'),_0x350d03,_0x50bc75);_0xe65772(_0x50bc75);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b520d76..a4b29c6 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 _0xbb80=['run','/:id/query','post','create','put','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','/:id/preview','isAuthenticated','preview','/:id/run'];(function(_0x516a58,_0x55347f){var _0x3527f3=function(_0x2b521b){while(--_0x2b521b){_0x516a58['push'](_0x516a58['shift']());}};_0x3527f3(++_0x55347f);}(_0xbb80,0x1eb));var _0x0bb8=function(_0x38c0b2,_0x6a67a5){_0x38c0b2=_0x38c0b2-0x0;var _0x283c00=_0xbb80[_0x38c0b2];return _0x283c00;};'use strict';var multer=require(_0x0bb8('0x0'));var util=require(_0x0bb8('0x1'));var path=require('path');var timeout=require(_0x0bb8('0x2'));var express=require(_0x0bb8('0x3'));var router=express['Router']();var fs_extra=require(_0x0bb8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0bb8('0x5'));var config=require(_0x0bb8('0x6'));var controller=require(_0x0bb8('0x7'));router[_0x0bb8('0x8')]('/',auth['isAuthenticated'](),controller[_0x0bb8('0x9')]);router[_0x0bb8('0x8')](_0x0bb8('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0bb8('0x8')](_0x0bb8('0xb'),auth[_0x0bb8('0xc')](),controller[_0x0bb8('0xd')]);router[_0x0bb8('0x8')](_0x0bb8('0xe'),auth[_0x0bb8('0xc')](),controller[_0x0bb8('0xf')]);router[_0x0bb8('0x8')](_0x0bb8('0x10'),auth['isAuthenticated'](),controller['query']);router[_0x0bb8('0x11')]('/',auth[_0x0bb8('0xc')](),controller[_0x0bb8('0x12')]);router[_0x0bb8('0x13')](_0x0bb8('0xa'),auth[_0x0bb8('0xc')](),controller['update']);router['delete'](_0x0bb8('0xa'),auth['isAuthenticated'](),controller[_0x0bb8('0x14')]);module[_0x0bb8('0x15')]=router; \ No newline at end of file +var _0x7c09=['isAuthenticated','/:id','show','/:id/preview','preview','/:id/query','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','get'];(function(_0x57a11a,_0x3ed00a){var _0x231aa5=function(_0x54a485){while(--_0x54a485){_0x57a11a['push'](_0x57a11a['shift']());}};_0x231aa5(++_0x3ed00a);}(_0x7c09,0x1ae));var _0x97c0=function(_0x157773,_0x51e296){_0x157773=_0x157773-0x0;var _0xd20327=_0x7c09[_0x157773];return _0xd20327;};'use strict';var multer=require(_0x97c0('0x0'));var util=require('util');var path=require(_0x97c0('0x1'));var timeout=require(_0x97c0('0x2'));var express=require(_0x97c0('0x3'));var router=express[_0x97c0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x97c0('0x5'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x97c0('0x6')]('/',auth[_0x97c0('0x7')](),controller['index']);router[_0x97c0('0x6')](_0x97c0('0x8'),auth['isAuthenticated'](),controller[_0x97c0('0x9')]);router[_0x97c0('0x6')](_0x97c0('0xa'),auth[_0x97c0('0x7')](),controller[_0x97c0('0xb')]);router[_0x97c0('0x6')]('/:id/run',auth[_0x97c0('0x7')](),controller['run']);router[_0x97c0('0x6')](_0x97c0('0xc'),auth[_0x97c0('0x7')](),controller['query']);router[_0x97c0('0xd')]('/',auth[_0x97c0('0x7')](),controller[_0x97c0('0xe')]);router['put'](_0x97c0('0x8'),auth[_0x97c0('0x7')](),controller[_0x97c0('0xf')]);router[_0x97c0('0x10')](_0x97c0('0x8'),auth[_0x97c0('0x7')](),controller[_0x97c0('0x11')]);module[_0x97c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 853ab40..55fa30f 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 _0xda19=['exports','STRING','TEXT'];(function(_0x5b012b,_0x45be7a){var _0x11f221=function(_0x5aa9aa){while(--_0x5aa9aa){_0x5b012b['push'](_0x5b012b['shift']());}};_0x11f221(++_0x45be7a);}(_0xda19,0xd5));var _0x9da1=function(_0x391a4f,_0x591b29){_0x391a4f=_0x391a4f-0x0;var _0x172065=_0xda19[_0x391a4f];return _0x172065;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xdbf5=['exports','STRING','TEXT'];(function(_0x448fcf,_0x259661){var _0xc90ab6=function(_0x143f8b){while(--_0x143f8b){_0x448fcf['push'](_0x448fcf['shift']());}};_0xc90ab6(++_0x259661);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x13e33e,_0x55e658){_0x13e33e=_0x13e33e-0x0;var _0x4908dd=_0xdbf5[_0x13e33e];return _0x4908dd;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9cd7ef8..e552859 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 _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x16f668,_0x41806c){var _0x264307=function(_0x4c3706){while(--_0x4c3706){_0x16f668['push'](_0x16f668['shift']());}};_0x264307(++_0x41806c);}(_0x1967,0x173));var _0x7196=function(_0x4256ec,_0x289a7){_0x4256ec=_0x4256ec-0x0;var _0xcc560b=_0x1967[_0x4256ec];return _0xcc560b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x381bce,_0x2bb6d2){var _0x31ee41=function(_0x2852c4){while(--_0x2852c4){_0x381bce['push'](_0x381bce['shift']());}};_0x31ee41(++_0x2bb6d2);}(_0x0295,0x1f0));var _0x5029=function(_0x48ecd2,_0x481ad3){_0x48ecd2=_0x48ecd2-0x0;var _0x5a4457=_0x0295[_0x48ecd2];return _0x5a4457;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b46e833..0e03ee6 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 _0x3a7d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0x3a7d,0x14f));var _0xd3a7=function(_0x485f2c,_0x431e8a){_0x485f2c=_0x485f2c-0x0;var _0x202011=_0x3a7d[_0x485f2c];return _0x202011;};'use strict';var _=require(_0xd3a7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd3a7('0x1'));var moment=require(_0xd3a7('0x2'));var BPromise=require(_0xd3a7('0x3'));var rp=require(_0xd3a7('0x4'));var fs=require('fs');var path=require(_0xd3a7('0x5'));var rimraf=require(_0xd3a7('0x6'));var config=require(_0xd3a7('0x7'));var attributes=require(_0xd3a7('0x8'));module[_0xd3a7('0x9')]=function(_0x25753e,_0xa5ea22){return _0x25753e[_0xd3a7('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0xd3a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008b=['path','rimraf','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','api','bluebird','request-promise'];(function(_0x39f4bd,_0x1faae1){var _0x481c79=function(_0x14add9){while(--_0x14add9){_0x39f4bd['push'](_0x39f4bd['shift']());}};_0x481c79(++_0x1faae1);}(_0x008b,0x1d0));var _0xb008=function(_0x32f08e,_0x53860c){_0x32f08e=_0x32f08e-0x0;var _0x1300e5=_0x008b[_0x32f08e];return _0x1300e5;};'use strict';var _=require(_0xb008('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb008('0x1'));var moment=require('moment');var BPromise=require(_0xb008('0x2'));var rp=require(_0xb008('0x3'));var fs=require('fs');var path=require(_0xb008('0x4'));var rimraf=require(_0xb008('0x5'));var config=require('../../config/environment');var attributes=require(_0xb008('0x6'));module[_0xb008('0x7')]=function(_0x568633,_0x1c097b){return _0x568633['define']('AnalyticDefaultReport',attributes,{'tableName':_0xb008('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index d148ece..d5c6f6f 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 _0x8505=['message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x2dde16,_0x14532e){var _0x2fb0f9=function(_0x329a6b){while(--_0x329a6b){_0x2dde16['push'](_0x2dde16['shift']());}};_0x2fb0f9(++_0x14532e);}(_0x8505,0x117));var _0x5850=function(_0x1f4f08,_0x16a037){_0x1f4f08=_0x1f4f08-0x0;var _0x44701c=_0x8505[_0x1f4f08];return _0x44701c;};'use strict';var _=require(_0x5850('0x0'));var util=require('util');var moment=require(_0x5850('0x1'));var BPromise=require('bluebird');var rs=require(_0x5850('0x2'));var fs=require('fs');var Redis=require(_0x5850('0x3'));var db=require(_0x5850('0x4'))['db'];var utils=require(_0x5850('0x5'));var logger=require(_0x5850('0x6'))(_0x5850('0x7'));var config=require(_0x5850('0x8'));var jayson=require(_0x5850('0x9'));var client=jayson[_0x5850('0xa')][_0x5850('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x575b70,_0xa1ca82,_0x2f805c){return new BPromise(function(_0x49f78b,_0x2f28ba){return client[_0x5850('0xc')](_0x575b70,_0x2f805c)[_0x5850('0xd')](function(_0x2f558d){logger[_0x5850('0xe')](_0x5850('0xf'),_0xa1ca82,_0x5850('0x10'));logger[_0x5850('0x11')](_0x5850('0x12'),_0xa1ca82,_0x5850('0x10'),JSON['stringify'](_0x2f558d));if(_0x2f558d['error']){if(_0x2f558d['error']['code']===0x1f4){logger[_0x5850('0x13')](_0x5850('0xf'),_0xa1ca82,_0x2f558d[_0x5850('0x13')][_0x5850('0x14')]);return _0x2f28ba(_0x2f558d[_0x5850('0x13')][_0x5850('0x14')]);}logger[_0x5850('0x13')](_0x5850('0xf'),_0xa1ca82,_0x2f558d['error'][_0x5850('0x14')]);return _0x49f78b(_0x2f558d[_0x5850('0x13')][_0x5850('0x14')]);}else{logger[_0x5850('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xa1ca82,_0x5850('0x10'));_0x49f78b(_0x2f558d[_0x5850('0x15')]['message']);}})[_0x5850('0x16')](function(_0x242696){logger[_0x5850('0x13')](_0x5850('0xf'),_0xa1ca82,_0x242696);_0x2f28ba(_0x242696);});});} \ No newline at end of file +var _0xd95c=['stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0xbed841,_0x407544){var _0x3bb7f9=function(_0x43ba41){while(--_0x43ba41){_0xbed841['push'](_0xbed841['shift']());}};_0x3bb7f9(++_0x407544);}(_0xd95c,0x15f));var _0xcd95=function(_0x4de87a,_0x51097f){_0x4de87a=_0x4de87a-0x0;var _0x59e1b8=_0xd95c[_0x4de87a];return _0x59e1b8;};'use strict';var _=require(_0xcd95('0x0'));var util=require('util');var moment=require(_0xcd95('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd95('0x2'));var fs=require('fs');var Redis=require(_0xcd95('0x3'));var db=require(_0xcd95('0x4'))['db'];var utils=require(_0xcd95('0x5'));var logger=require('../../config/logger')(_0xcd95('0x6'));var config=require(_0xcd95('0x7'));var jayson=require(_0xcd95('0x8'));var client=jayson[_0xcd95('0x9')][_0xcd95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387d69,_0x1ae510,_0x16cd52){return new BPromise(function(_0x2aebe9,_0x655d87){return client[_0xcd95('0xb')](_0x387d69,_0x16cd52)[_0xcd95('0xc')](function(_0x8696aa){logger[_0xcd95('0xd')](_0xcd95('0xe'),_0x1ae510,_0xcd95('0xf'));logger['debug'](_0xcd95('0x10'),_0x1ae510,'request\x20sent',JSON[_0xcd95('0x11')](_0x8696aa));if(_0x8696aa['error']){if(_0x8696aa['error'][_0xcd95('0x12')]===0x1f4){logger['error'](_0xcd95('0xe'),_0x1ae510,_0x8696aa[_0xcd95('0x13')][_0xcd95('0x14')]);return _0x655d87(_0x8696aa['error'][_0xcd95('0x14')]);}logger[_0xcd95('0x13')](_0xcd95('0xe'),_0x1ae510,_0x8696aa[_0xcd95('0x13')]['message']);return _0x2aebe9(_0x8696aa[_0xcd95('0x13')]['message']);}else{logger[_0xcd95('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1ae510,_0xcd95('0xf'));_0x2aebe9(_0x8696aa[_0xcd95('0x15')][_0xcd95('0x14')]);}})[_0xcd95('0x16')](function(_0xc8125){logger[_0xcd95('0x13')](_0xcd95('0xe'),_0x1ae510,_0xc8125);_0x655d87(_0xc8125);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index b2e17d4..ada6d14 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 _0x18e9=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','post','create'];(function(_0x1ced7c,_0x7c55ad){var _0x511fb1=function(_0x41d0e7){while(--_0x41d0e7){_0x1ced7c['push'](_0x1ced7c['shift']());}};_0x511fb1(++_0x7c55ad);}(_0x18e9,0x1e5));var _0x918e=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x18e9[_0x34325b];return _0x3da348;};'use strict';var multer=require(_0x918e('0x0'));var util=require(_0x918e('0x1'));var path=require(_0x918e('0x2'));var timeout=require(_0x918e('0x3'));var express=require(_0x918e('0x4'));var router=express['Router']();var fs_extra=require(_0x918e('0x5'));var auth=require(_0x918e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x918e('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0x918e('0x8')]('/',auth[_0x918e('0x9')](),controller[_0x918e('0xa')]);router['get'](_0x918e('0xb'),auth[_0x918e('0x9')](),controller['show']);router[_0x918e('0x8')](_0x918e('0xc'),auth[_0x918e('0x9')](),controller[_0x918e('0xd')]);router[_0x918e('0x8')](_0x918e('0xe'),auth[_0x918e('0x9')](),controller[_0x918e('0xf')]);router['get'](_0x918e('0x10'),auth[_0x918e('0x9')](),controller['query']);router[_0x918e('0x11')]('/',auth['isAuthenticated'](),controller[_0x918e('0x12')]);router[_0x918e('0x13')]('/:id',auth[_0x918e('0x9')](),controller[_0x918e('0x14')]);router[_0x918e('0x15')](_0x918e('0xb'),auth[_0x918e('0x9')](),controller[_0x918e('0x16')]);module[_0x918e('0x17')]=router; \ No newline at end of file +var _0xb1ef=['./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5634d2,_0x40ec38){var _0x4150b5=function(_0x44ceef){while(--_0x44ceef){_0x5634d2['push'](_0x5634d2['shift']());}};_0x4150b5(++_0x40ec38);}(_0xb1ef,0x93));var _0xfb1e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ef[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfb1e('0x0'));var util=require(_0xfb1e('0x1'));var path=require('path');var timeout=require(_0xfb1e('0x2'));var express=require(_0xfb1e('0x3'));var router=express[_0xfb1e('0x4')]();var fs_extra=require(_0xfb1e('0x5'));var auth=require(_0xfb1e('0x6'));var interaction=require(_0xfb1e('0x7'));var config=require(_0xfb1e('0x8'));var controller=require(_0xfb1e('0x9'));router['get']('/',auth[_0xfb1e('0xa')](),controller[_0xfb1e('0xb')]);router[_0xfb1e('0xc')](_0xfb1e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xfb1e('0xc')](_0xfb1e('0xe'),auth[_0xfb1e('0xa')](),controller[_0xfb1e('0xf')]);router[_0xfb1e('0xc')](_0xfb1e('0x10'),auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x11')]);router['get'](_0xfb1e('0x12'),auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x13')]);router[_0xfb1e('0x14')]('/',auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x15')]);router[_0xfb1e('0x16')]('/:id',auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x17')]);router['delete'](_0xfb1e('0xd'),auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x18')]);module[_0xfb1e('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 949f3ac..2b5a5d1 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 _0x0ffc=['xlsx','DATE','Loading','ENUM','manual','scheduled','INTEGER','sequelize','exports','STRING','pdf'];(function(_0x405bed,_0x2376c7){var _0x497d26=function(_0x575eb7){while(--_0x575eb7){_0x405bed['push'](_0x405bed['shift']());}};_0x497d26(++_0x2376c7);}(_0x0ffc,0x193));var _0xc0ff=function(_0x52efad,_0x567969){_0x52efad=_0x52efad-0x0;var _0x7681be=_0x0ffc[_0x52efad];return _0x7681be;};'use strict';var Sequelize=require(_0xc0ff('0x0'));var moment=require('moment');module[_0xc0ff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xc0ff('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xc0ff('0x3'),_0xc0ff('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xc0ff('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc0ff('0x5')]},'endDate':{'type':Sequelize[_0xc0ff('0x5')]},'status':{'type':Sequelize[_0xc0ff('0x2')],'defaultValue':_0xc0ff('0x6')},'type':{'type':Sequelize[_0xc0ff('0x7')](_0xc0ff('0x8'),_0xc0ff('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xc0ff('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xc0ff('0x2')]}}; \ No newline at end of file +var _0x5fb0=['DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','xlsx'];(function(_0xce06d0,_0xe944b9){var _0x360347=function(_0x565311){while(--_0x565311){_0xce06d0['push'](_0xce06d0['shift']());}};_0x360347(++_0xe944b9);}(_0x5fb0,0x10e));var _0x05fb=function(_0x1b0165,_0x33a8c0){_0x1b0165=_0x1b0165-0x0;var _0x80ea5c=_0x5fb0[_0x1b0165];return _0x80ea5c;};'use strict';var Sequelize=require(_0x05fb('0x0'));var moment=require(_0x05fb('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x05fb('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x05fb('0x3')](_0x05fb('0x4'),'pdf',_0x05fb('0x5')),'allowNull':![],'defaultValue':_0x05fb('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x05fb('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x05fb('0x7')},'type':{'type':Sequelize[_0x05fb('0x3')](_0x05fb('0x8'),_0x05fb('0x9')),'allowNull':![],'defaultValue':_0x05fb('0x8')},'reportId':{'type':Sequelize[_0x05fb('0xa')](0xb)[_0x05fb('0xb')]},'reportType':{'type':Sequelize[_0x05fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 545c7fa..2d8400d 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 _0xe521=['set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','end','error','name','send','AnalyticExtractedReport','fieldName','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','root','server/files/reports','toLowerCase','eml-format','rimraf','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x4b7b9b,_0xa4aff9){var _0x3be710=function(_0x5b64fa){while(--_0x5b64fa){_0x4b7b9b['push'](_0x4b7b9b['shift']());}};_0x3be710(++_0xa4aff9);}(_0xe521,0x9a));var _0x1e52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe521[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1e52('0x0'));var rimraf=require(_0x1e52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e52('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1e52('0x3'));var util=require('util');var path=require(_0x1e52('0x4'));var sox=require('sox');var csv=require(_0x1e52('0x5'));var ejs=require(_0x1e52('0x6'));var fs=require('fs');var fs_extra=require(_0x1e52('0x7'));var _=require(_0x1e52('0x8'));var squel=require(_0x1e52('0x9'));var crypto=require('crypto');var jsforce=require(_0x1e52('0xa'));var deskjs=require(_0x1e52('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1e52('0xc'));var Papa=require(_0x1e52('0xd'));var Redis=require(_0x1e52('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1e52('0xf'));var as=require(_0x1e52('0x10'));var hardwareService=require(_0x1e52('0x11'));var logger=require(_0x1e52('0x12'))(_0x1e52('0x13'));var utils=require(_0x1e52('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1e52('0x15'));var db=require(_0x1e52('0x16'))['db'];function respondWithStatusCode(_0x558ec4,_0x3dd8bb){_0x3dd8bb=_0x3dd8bb||0xcc;return function(_0x24700){if(_0x24700){return _0x558ec4[_0x1e52('0x17')](_0x3dd8bb);}return _0x558ec4[_0x1e52('0x18')](_0x3dd8bb)['end']();};}function respondWithResult(_0x127633,_0x16a8cf){_0x16a8cf=_0x16a8cf||0xc8;return function(_0xdc2b72){if(_0xdc2b72){return _0x127633[_0x1e52('0x18')](_0x16a8cf)[_0x1e52('0x19')](_0xdc2b72);}};}function respondWithFilteredResult(_0x22a779,_0x59f310){return function(_0x4c0505){if(_0x4c0505){var _0x1e8b0f=typeof _0x59f310[_0x1e52('0x1a')]===_0x1e52('0x1b')&&typeof _0x59f310[_0x1e52('0x1c')]===_0x1e52('0x1b');var _0x16747c=_0x4c0505[_0x1e52('0x1d')];var _0x11f9ab=_0x1e8b0f?0x0:_0x59f310[_0x1e52('0x1a')];var _0x2970c5=_0x1e8b0f?_0x4c0505['count']:_0x59f310[_0x1e52('0x1a')]+_0x59f310[_0x1e52('0x1c')];var _0x28b431;if(_0x2970c5>=_0x16747c){_0x2970c5=_0x16747c;_0x28b431=0xc8;}else{_0x28b431=0xce;}_0x22a779[_0x1e52('0x18')](_0x28b431);return _0x22a779[_0x1e52('0x1e')](_0x1e52('0x1f'),_0x11f9ab+'-'+_0x2970c5+'/'+_0x16747c)[_0x1e52('0x19')](_0x4c0505);}return null;};}function patchUpdates(_0x7e6f4d){return function(_0x44d98c){try{jsonpatch['apply'](_0x44d98c,_0x7e6f4d,!![]);}catch(_0x13d292){return BPromise[_0x1e52('0x20')](_0x13d292);}return _0x44d98c[_0x1e52('0x21')]();};}function saveUpdates(_0x283afd,_0x41e5f3){return function(_0x3b56f2){if(_0x3b56f2){return _0x3b56f2[_0x1e52('0x22')](_0x283afd)[_0x1e52('0x23')](function(_0x48246d){return _0x48246d;});}return null;};}function removeEntity(_0x486174,_0x13ad92){return function(_0x1230bf){if(_0x1230bf){return _0x1230bf[_0x1e52('0x24')]()[_0x1e52('0x23')](function(){var _0x1b3328=_0x1230bf[_0x1e52('0x25')]({'plain':!![]});var _0x1a8718=_0x1e52('0x26');return db[_0x1e52('0x27')][_0x1e52('0x24')]({'where':{'type':_0x1a8718,'resourceId':_0x1b3328['id']}})['then'](function(){return _0x1230bf;});})[_0x1e52('0x23')](function(){_0x486174['status'](0xcc)[_0x1e52('0x28')]();});}};}function handleEntityNotFound(_0x12b70e,_0xcf692e){return function(_0x4781d8){if(!_0x4781d8){_0x12b70e[_0x1e52('0x17')](0x194);}return _0x4781d8;};}function handleError(_0x27a465,_0x1e0e60){_0x1e0e60=_0x1e0e60||0x1f4;return function(_0x228fd7){logger[_0x1e52('0x29')](_0x228fd7['stack']);if(_0x228fd7['name']){delete _0x228fd7[_0x1e52('0x2a')];}_0x27a465[_0x1e52('0x18')](_0x1e0e60)[_0x1e52('0x2b')](_0x228fd7);};}exports['index']=function(_0x42145f,_0x4ed76d){var _0x142c29={},_0x3302c9={},_0x1755b7={'count':0x0,'rows':[]};var _0x30acb3=_['map'](db[_0x1e52('0x2c')]['rawAttributes'],function(_0x23356b){return{'name':_0x23356b[_0x1e52('0x2d')],'type':_0x23356b['type']['key']};});_0x3302c9[_0x1e52('0x2e')]=_[_0x1e52('0x2f')](_0x30acb3,_0x1e52('0x2a'));_0x3302c9['query']=_[_0x1e52('0x30')](_0x42145f[_0x1e52('0x31')]);_0x3302c9['filters']=_[_0x1e52('0x32')](_0x3302c9['model'],_0x3302c9[_0x1e52('0x31')]);_0x142c29[_0x1e52('0x33')]=_[_0x1e52('0x32')](_0x3302c9[_0x1e52('0x2e')],qs[_0x1e52('0x34')](_0x42145f[_0x1e52('0x31')]['fields']));_0x142c29[_0x1e52('0x33')]=_0x142c29[_0x1e52('0x33')]['length']?_0x142c29[_0x1e52('0x33')]:_0x3302c9[_0x1e52('0x2e')];if(!_0x42145f[_0x1e52('0x31')][_0x1e52('0x35')](_0x1e52('0x36'))){_0x142c29['limit']=qs[_0x1e52('0x1c')](_0x42145f[_0x1e52('0x31')][_0x1e52('0x1c')]);_0x142c29[_0x1e52('0x1a')]=qs[_0x1e52('0x1a')](_0x42145f[_0x1e52('0x31')][_0x1e52('0x1a')]);}_0x142c29['order']=qs[_0x1e52('0x37')](_0x42145f[_0x1e52('0x31')][_0x1e52('0x37')]);_0x142c29[_0x1e52('0x38')]=qs[_0x1e52('0x39')](_[_0x1e52('0x3a')](_0x42145f[_0x1e52('0x31')],_0x3302c9['filters']),_0x30acb3);if(_0x42145f[_0x1e52('0x31')][_0x1e52('0x3b')]){_0x142c29[_0x1e52('0x38')]=_[_0x1e52('0x3c')](_0x142c29['where'],{'$or':_[_0x1e52('0x2f')](_0x30acb3,function(_0x5807b2){if(_0x5807b2[_0x1e52('0x3d')]!=='VIRTUAL'){var _0x232109={};_0x232109[_0x5807b2[_0x1e52('0x2a')]]={'$like':'%'+_0x42145f[_0x1e52('0x31')]['filter']+'%'};return _0x232109;}})});}_0x142c29=_[_0x1e52('0x3c')]({},_0x142c29,_0x42145f['options']);var _0xe48fd0={'where':_0x142c29['where']};return db['AnalyticExtractedReport'][_0x1e52('0x1d')](_0xe48fd0)[_0x1e52('0x23')](function(_0x2cbf88){_0x1755b7[_0x1e52('0x1d')]=_0x2cbf88;if(_0x42145f[_0x1e52('0x31')][_0x1e52('0x3e')]){_0x142c29[_0x1e52('0x3f')]=[{'all':!![]}];}return db[_0x1e52('0x2c')][_0x1e52('0x40')](_0x142c29);})[_0x1e52('0x23')](function(_0x3be5eb){_0x1755b7['rows']=_0x3be5eb;return _0x1755b7;})[_0x1e52('0x23')](respondWithFilteredResult(_0x4ed76d,_0x142c29))[_0x1e52('0x41')](handleError(_0x4ed76d,null));};exports[_0x1e52('0x42')]=function(_0x16f393,_0x5e06ed){var _0x4c5b3f={'raw':!![],'where':{'id':_0x16f393[_0x1e52('0x43')]['id']}},_0x3409c0={};_0x3409c0[_0x1e52('0x2e')]=_[_0x1e52('0x30')](db[_0x1e52('0x2c')][_0x1e52('0x44')]);_0x3409c0[_0x1e52('0x31')]=_[_0x1e52('0x30')](_0x16f393['query']);_0x3409c0[_0x1e52('0x39')]=_[_0x1e52('0x32')](_0x3409c0[_0x1e52('0x2e')],_0x3409c0['query']);_0x4c5b3f[_0x1e52('0x33')]=_['intersection'](_0x3409c0[_0x1e52('0x2e')],qs[_0x1e52('0x34')](_0x16f393['query'][_0x1e52('0x34')]));_0x4c5b3f['attributes']=_0x4c5b3f[_0x1e52('0x33')][_0x1e52('0x45')]?_0x4c5b3f['attributes']:_0x3409c0[_0x1e52('0x2e')];if(_0x16f393['query'][_0x1e52('0x3e')]){_0x4c5b3f['include']=[{'all':!![]}];}_0x4c5b3f=_[_0x1e52('0x3c')]({},_0x4c5b3f,_0x16f393[_0x1e52('0x46')]);return db[_0x1e52('0x2c')][_0x1e52('0x47')](_0x4c5b3f)[_0x1e52('0x23')](handleEntityNotFound(_0x5e06ed,null))[_0x1e52('0x23')](respondWithResult(_0x5e06ed,null))[_0x1e52('0x41')](handleError(_0x5e06ed,null));};exports[_0x1e52('0x48')]=function(_0x52e3fe,_0x402c63){return db['AnalyticExtractedReport'][_0x1e52('0x48')](_0x52e3fe[_0x1e52('0x49')],{})[_0x1e52('0x23')](function(_0x5565e1){var _0x31d0a1=_0x52e3fe[_0x1e52('0x4a')][_0x1e52('0x25')]({'plain':!![]});if(!_0x31d0a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31d0a1['role']===_0x1e52('0x4a')){var _0x44aae5=_0x5565e1[_0x1e52('0x25')]({'plain':!![]});var _0x17b56a=_0x1e52('0x26');return db[_0x1e52('0x4b')][_0x1e52('0x47')]({'where':{'name':_0x17b56a,'userProfileId':_0x31d0a1[_0x1e52('0x4c')]},'raw':!![]})['then'](function(_0x13b899){if(_0x13b899&&_0x13b899[_0x1e52('0x4d')]===0x0){return db['UserProfileResource'][_0x1e52('0x48')]({'name':_0x44aae5[_0x1e52('0x2a')],'resourceId':_0x44aae5['id'],'type':_0x13b899[_0x1e52('0x2a')],'sectionId':_0x13b899['id']},{})[_0x1e52('0x23')](function(){return _0x5565e1;});}else{return _0x5565e1;}})[_0x1e52('0x41')](function(_0x3676ed){logger['error'](_0x1e52('0x4e'),_0x3676ed);throw _0x3676ed;});}return _0x5565e1;})[_0x1e52('0x23')](respondWithResult(_0x402c63,0xc9))[_0x1e52('0x41')](handleError(_0x402c63,null));};exports[_0x1e52('0x22')]=function(_0x405a77,_0x10a39a){if(_0x405a77[_0x1e52('0x49')]['id']){delete _0x405a77[_0x1e52('0x49')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x405a77[_0x1e52('0x43')]['id']}})[_0x1e52('0x23')](handleEntityNotFound(_0x10a39a,null))[_0x1e52('0x23')](saveUpdates(_0x405a77[_0x1e52('0x49')],null))[_0x1e52('0x23')](respondWithResult(_0x10a39a,null))[_0x1e52('0x41')](handleError(_0x10a39a,null));};exports['destroy']=function(_0x396e72,_0x5dea94){return db[_0x1e52('0x2c')][_0x1e52('0x47')]({'where':{'id':_0x396e72['params']['id']}})[_0x1e52('0x23')](handleEntityNotFound(_0x5dea94,null))[_0x1e52('0x23')](removeEntity(_0x5dea94,null))[_0x1e52('0x41')](handleError(_0x5dea94,null));};exports[_0x1e52('0x4f')]=function(_0x2007ed,_0x33d8a8,_0x27e214){return db[_0x1e52('0x2c')]['find']({'where':{'id':_0x2007ed[_0x1e52('0x43')]['id']},'attributes':['name',_0x1e52('0x50'),_0x1e52('0x51'),_0x1e52('0x52')],'raw':!![]})[_0x1e52('0x23')](handleEntityNotFound(_0x33d8a8,null))[_0x1e52('0x23')](function(_0x4fcf72){if(_0x4fcf72){if(!fs[_0x1e52('0x53')](path['join'](config['root'],'server/files/reports',_0x4fcf72[_0x1e52('0x51')]))){throw new db[(_0x1e52('0x54'))][(_0x1e52('0x55'))](_0x1e52('0x56'));}if(_0x2007ed[_0x1e52('0x31')][_0x1e52('0x57')]){return _0x33d8a8['sendStatus'](0xc8);}return _0x33d8a8[_0x1e52('0x4f')](path[_0x1e52('0x58')](config[_0x1e52('0x59')],_0x1e52('0x5a'),_0x4fcf72[_0x1e52('0x51')]),util['format']('%s.%s',_0x4fcf72[_0x1e52('0x50')]||_0x4fcf72[_0x1e52('0x2a')],_0x4fcf72[_0x1e52('0x52')][_0x1e52('0x5b')]()));}})[_0x1e52('0x41')](handleError(_0x33d8a8,null));}; \ No newline at end of file +var _0x9c77=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ExtractedReports','error','stack','name','send','map','AnalyticExtractedReport','fieldName','type','key','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','include','rows','catch','show','params','rawAttributes','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','exists','download','join','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','lodash','squel','desk.js','to-csv'];(function(_0x3cd077,_0x55b90f){var _0x5b5b52=function(_0x38ce8b){while(--_0x38ce8b){_0x3cd077['push'](_0x3cd077['shift']());}};_0x5b5b52(++_0x55b90f);}(_0x9c77,0x10a));var _0x79c7=function(_0x48e0ea,_0x5e9c7d){_0x48e0ea=_0x48e0ea-0x0;var _0x97946d=_0x9c77[_0x48e0ea];return _0x97946d;};'use strict';var emlformat=require(_0x79c7('0x0'));var rimraf=require(_0x79c7('0x1'));var zipdir=require(_0x79c7('0x2'));var jsonpatch=require(_0x79c7('0x3'));var rp=require(_0x79c7('0x4'));var moment=require('moment');var BPromise=require(_0x79c7('0x5'));var Mustache=require('mustache');var util=require(_0x79c7('0x6'));var path=require(_0x79c7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x79c7('0x8'));var _=require(_0x79c7('0x9'));var squel=require(_0x79c7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x79c7('0xb'));var toCsv=require(_0x79c7('0xc'));var querystring=require(_0x79c7('0xd'));var Papa=require(_0x79c7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x79c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79c7('0x10'));var logger=require(_0x79c7('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x79c7('0x12'));var db=require(_0x79c7('0x13'))['db'];function respondWithStatusCode(_0x3775e3,_0x51e248){_0x51e248=_0x51e248||0xcc;return function(_0x2ac515){if(_0x2ac515){return _0x3775e3[_0x79c7('0x14')](_0x51e248);}return _0x3775e3[_0x79c7('0x15')](_0x51e248)[_0x79c7('0x16')]();};}function respondWithResult(_0x5611e5,_0x5b1a6a){_0x5b1a6a=_0x5b1a6a||0xc8;return function(_0x529e1a){if(_0x529e1a){return _0x5611e5[_0x79c7('0x15')](_0x5b1a6a)['json'](_0x529e1a);}};}function respondWithFilteredResult(_0x404c69,_0x5690b4){return function(_0x58d20e){if(_0x58d20e){var _0x49ff26=typeof _0x5690b4[_0x79c7('0x17')]===_0x79c7('0x18')&&typeof _0x5690b4[_0x79c7('0x19')]===_0x79c7('0x18');var _0x3b093b=_0x58d20e[_0x79c7('0x1a')];var _0x8f489a=_0x49ff26?0x0:_0x5690b4[_0x79c7('0x17')];var _0x22cede=_0x49ff26?_0x58d20e['count']:_0x5690b4[_0x79c7('0x17')]+_0x5690b4['limit'];var _0x1743e5;if(_0x22cede>=_0x3b093b){_0x22cede=_0x3b093b;_0x1743e5=0xc8;}else{_0x1743e5=0xce;}_0x404c69['status'](_0x1743e5);return _0x404c69[_0x79c7('0x1b')](_0x79c7('0x1c'),_0x8f489a+'-'+_0x22cede+'/'+_0x3b093b)[_0x79c7('0x1d')](_0x58d20e);}return null;};}function patchUpdates(_0x51fff7){return function(_0x540beb){try{jsonpatch[_0x79c7('0x1e')](_0x540beb,_0x51fff7,!![]);}catch(_0x13c055){return BPromise[_0x79c7('0x1f')](_0x13c055);}return _0x540beb[_0x79c7('0x20')]();};}function saveUpdates(_0x2cbc43,_0x4d188c){return function(_0x3fe716){if(_0x3fe716){return _0x3fe716[_0x79c7('0x21')](_0x2cbc43)[_0x79c7('0x22')](function(_0x4a59e6){return _0x4a59e6;});}return null;};}function removeEntity(_0x72c01e,_0x417086){return function(_0x66ca3d){if(_0x66ca3d){return _0x66ca3d[_0x79c7('0x23')]()['then'](function(){var _0x2d9c67=_0x66ca3d[_0x79c7('0x24')]({'plain':!![]});var _0x37b73f=_0x79c7('0x25');return db['UserProfileResource'][_0x79c7('0x23')]({'where':{'type':_0x37b73f,'resourceId':_0x2d9c67['id']}})[_0x79c7('0x22')](function(){return _0x66ca3d;});})[_0x79c7('0x22')](function(){_0x72c01e[_0x79c7('0x15')](0xcc)[_0x79c7('0x16')]();});}};}function handleEntityNotFound(_0x6d6f35,_0x3d64d3){return function(_0x392ed8){if(!_0x392ed8){_0x6d6f35['sendStatus'](0x194);}return _0x392ed8;};}function handleError(_0x18bb1c,_0x2d52d6){_0x2d52d6=_0x2d52d6||0x1f4;return function(_0x2faaad){logger[_0x79c7('0x26')](_0x2faaad[_0x79c7('0x27')]);if(_0x2faaad[_0x79c7('0x28')]){delete _0x2faaad[_0x79c7('0x28')];}_0x18bb1c[_0x79c7('0x15')](_0x2d52d6)[_0x79c7('0x29')](_0x2faaad);};}exports['index']=function(_0x538c0d,_0x461103){var _0x29d2ad={},_0x4ba4ec={},_0x268098={'count':0x0,'rows':[]};var _0x5dd42b=_[_0x79c7('0x2a')](db[_0x79c7('0x2b')]['rawAttributes'],function(_0x1be7ca){return{'name':_0x1be7ca[_0x79c7('0x2c')],'type':_0x1be7ca[_0x79c7('0x2d')][_0x79c7('0x2e')]};});_0x4ba4ec['model']=_[_0x79c7('0x2a')](_0x5dd42b,_0x79c7('0x28'));_0x4ba4ec['query']=_['keys'](_0x538c0d['query']);_0x4ba4ec[_0x79c7('0x2f')]=_[_0x79c7('0x30')](_0x4ba4ec[_0x79c7('0x31')],_0x4ba4ec[_0x79c7('0x32')]);_0x29d2ad[_0x79c7('0x33')]=_[_0x79c7('0x30')](_0x4ba4ec[_0x79c7('0x31')],qs[_0x79c7('0x34')](_0x538c0d[_0x79c7('0x32')][_0x79c7('0x34')]));_0x29d2ad[_0x79c7('0x33')]=_0x29d2ad[_0x79c7('0x33')][_0x79c7('0x35')]?_0x29d2ad[_0x79c7('0x33')]:_0x4ba4ec[_0x79c7('0x31')];if(!_0x538c0d[_0x79c7('0x32')]['hasOwnProperty'](_0x79c7('0x36'))){_0x29d2ad['limit']=qs[_0x79c7('0x19')](_0x538c0d[_0x79c7('0x32')]['limit']);_0x29d2ad[_0x79c7('0x17')]=qs[_0x79c7('0x17')](_0x538c0d[_0x79c7('0x32')]['offset']);}_0x29d2ad[_0x79c7('0x37')]=qs[_0x79c7('0x38')](_0x538c0d[_0x79c7('0x32')][_0x79c7('0x38')]);_0x29d2ad[_0x79c7('0x39')]=qs[_0x79c7('0x2f')](_[_0x79c7('0x3a')](_0x538c0d[_0x79c7('0x32')],_0x4ba4ec['filters']),_0x5dd42b);if(_0x538c0d[_0x79c7('0x32')]['filter']){_0x29d2ad[_0x79c7('0x39')]=_[_0x79c7('0x3b')](_0x29d2ad['where'],{'$or':_[_0x79c7('0x2a')](_0x5dd42b,function(_0x136132){if(_0x136132[_0x79c7('0x2d')]!=='VIRTUAL'){var _0x452fbb={};_0x452fbb[_0x136132[_0x79c7('0x28')]]={'$like':'%'+_0x538c0d[_0x79c7('0x32')][_0x79c7('0x3c')]+'%'};return _0x452fbb;}})});}_0x29d2ad=_[_0x79c7('0x3b')]({},_0x29d2ad,_0x538c0d[_0x79c7('0x3d')]);var _0x47904f={'where':_0x29d2ad[_0x79c7('0x39')]};return db[_0x79c7('0x2b')][_0x79c7('0x1a')](_0x47904f)[_0x79c7('0x22')](function(_0x2ec0fd){_0x268098[_0x79c7('0x1a')]=_0x2ec0fd;if(_0x538c0d[_0x79c7('0x32')]['includeAll']){_0x29d2ad[_0x79c7('0x3e')]=[{'all':!![]}];}return db[_0x79c7('0x2b')]['findAll'](_0x29d2ad);})['then'](function(_0x1f0c2f){_0x268098[_0x79c7('0x3f')]=_0x1f0c2f;return _0x268098;})[_0x79c7('0x22')](respondWithFilteredResult(_0x461103,_0x29d2ad))[_0x79c7('0x40')](handleError(_0x461103,null));};exports[_0x79c7('0x41')]=function(_0x1243b4,_0x8fd221){var _0x25727a={'raw':!![],'where':{'id':_0x1243b4[_0x79c7('0x42')]['id']}},_0x1ae284={};_0x1ae284[_0x79c7('0x31')]=_['keys'](db[_0x79c7('0x2b')][_0x79c7('0x43')]);_0x1ae284[_0x79c7('0x32')]=_[_0x79c7('0x44')](_0x1243b4[_0x79c7('0x32')]);_0x1ae284[_0x79c7('0x2f')]=_[_0x79c7('0x30')](_0x1ae284[_0x79c7('0x31')],_0x1ae284[_0x79c7('0x32')]);_0x25727a[_0x79c7('0x33')]=_[_0x79c7('0x30')](_0x1ae284[_0x79c7('0x31')],qs[_0x79c7('0x34')](_0x1243b4['query'][_0x79c7('0x34')]));_0x25727a['attributes']=_0x25727a['attributes']['length']?_0x25727a[_0x79c7('0x33')]:_0x1ae284[_0x79c7('0x31')];if(_0x1243b4[_0x79c7('0x32')][_0x79c7('0x45')]){_0x25727a[_0x79c7('0x3e')]=[{'all':!![]}];}_0x25727a=_[_0x79c7('0x3b')]({},_0x25727a,_0x1243b4['options']);return db['AnalyticExtractedReport'][_0x79c7('0x46')](_0x25727a)[_0x79c7('0x22')](handleEntityNotFound(_0x8fd221,null))['then'](respondWithResult(_0x8fd221,null))[_0x79c7('0x40')](handleError(_0x8fd221,null));};exports[_0x79c7('0x47')]=function(_0x4a6241,_0x51f1ff){return db[_0x79c7('0x2b')]['create'](_0x4a6241[_0x79c7('0x48')],{})[_0x79c7('0x22')](function(_0x2128e0){var _0x1d0098=_0x4a6241[_0x79c7('0x49')][_0x79c7('0x24')]({'plain':!![]});if(!_0x1d0098)throw new Error(_0x79c7('0x4a'));if(_0x1d0098[_0x79c7('0x4b')]===_0x79c7('0x49')){var _0x353829=_0x2128e0[_0x79c7('0x24')]({'plain':!![]});var _0x10ed6f='ExtractedReports';return db[_0x79c7('0x4c')][_0x79c7('0x46')]({'where':{'name':_0x10ed6f,'userProfileId':_0x1d0098[_0x79c7('0x4d')]},'raw':!![]})['then'](function(_0x330c97){if(_0x330c97&&_0x330c97['autoAssociation']===0x0){return db[_0x79c7('0x4e')][_0x79c7('0x47')]({'name':_0x353829[_0x79c7('0x28')],'resourceId':_0x353829['id'],'type':_0x330c97[_0x79c7('0x28')],'sectionId':_0x330c97['id']},{})[_0x79c7('0x22')](function(){return _0x2128e0;});}else{return _0x2128e0;}})[_0x79c7('0x40')](function(_0x46bed0){logger[_0x79c7('0x26')](_0x79c7('0x4f'),_0x46bed0);throw _0x46bed0;});}return _0x2128e0;})[_0x79c7('0x22')](respondWithResult(_0x51f1ff,0xc9))[_0x79c7('0x40')](handleError(_0x51f1ff,null));};exports[_0x79c7('0x21')]=function(_0x3f68c7,_0x528db2){if(_0x3f68c7[_0x79c7('0x48')]['id']){delete _0x3f68c7['body']['id'];}return db[_0x79c7('0x2b')][_0x79c7('0x46')]({'where':{'id':_0x3f68c7[_0x79c7('0x42')]['id']}})[_0x79c7('0x22')](handleEntityNotFound(_0x528db2,null))[_0x79c7('0x22')](saveUpdates(_0x3f68c7[_0x79c7('0x48')],null))[_0x79c7('0x22')](respondWithResult(_0x528db2,null))[_0x79c7('0x40')](handleError(_0x528db2,null));};exports['destroy']=function(_0x4b5042,_0x3a456f){return db[_0x79c7('0x2b')]['find']({'where':{'id':_0x4b5042[_0x79c7('0x42')]['id']}})[_0x79c7('0x22')](handleEntityNotFound(_0x3a456f,null))[_0x79c7('0x22')](removeEntity(_0x3a456f,null))[_0x79c7('0x40')](handleError(_0x3a456f,null));};exports['download']=function(_0x3681ad,_0x336bb3,_0x3181eb){return db[_0x79c7('0x2b')][_0x79c7('0x46')]({'where':{'id':_0x3681ad[_0x79c7('0x42')]['id']},'attributes':[_0x79c7('0x28'),_0x79c7('0x50'),_0x79c7('0x51'),_0x79c7('0x52')],'raw':!![]})[_0x79c7('0x22')](handleEntityNotFound(_0x336bb3,null))[_0x79c7('0x22')](function(_0xb06e0f){if(_0xb06e0f){if(!fs[_0x79c7('0x53')](path['join'](config[_0x79c7('0x54')],_0x79c7('0x55'),_0xb06e0f[_0x79c7('0x51')]))){throw new db[(_0x79c7('0x56'))][(_0x79c7('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x3681ad[_0x79c7('0x32')][_0x79c7('0x58')]){return _0x336bb3['sendStatus'](0xc8);}return _0x336bb3[_0x79c7('0x59')](path[_0x79c7('0x5a')](config[_0x79c7('0x54')],_0x79c7('0x55'),_0xb06e0f[_0x79c7('0x51')]),util['format'](_0x79c7('0x5b'),_0xb06e0f[_0x79c7('0x50')]||_0xb06e0f[_0x79c7('0x28')],_0xb06e0f[_0x79c7('0x52')][_0x79c7('0x5c')]()));}})['catch'](handleError(_0x336bb3,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 3425ad8..63f30de 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 _0xec6f=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','bluebird','rimraf','exports'];(function(_0x2ce8da,_0x96274c){var _0x1d378f=function(_0x4db209){while(--_0x4db209){_0x2ce8da['push'](_0x2ce8da['shift']());}};_0x1d378f(++_0x96274c);}(_0xec6f,0x135));var _0xfec6=function(_0x40baf1,_0x39a1e3){_0x40baf1=_0x40baf1-0x0;var _0x293477=_0xec6f[_0x40baf1];return _0x293477;};'use strict';var _=require(_0xfec6('0x0'));var util=require(_0xfec6('0x1'));var logger=require('../../config/logger')(_0xfec6('0x2'));var moment=require('moment');var BPromise=require(_0xfec6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfec6('0x4'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0xfec6('0x5')]=function(_0x4b6406,_0x4cb08d){return _0x4b6406[_0xfec6('0x6')](_0xfec6('0x7'),attributes,{'tableName':_0xfec6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2c2=['util','../../config/logger','api','bluebird','path','../../config/environment','exports','AnalyticExtractedReport','lodash'];(function(_0x1a16e7,_0x114313){var _0x34e33a=function(_0x326653){while(--_0x326653){_0x1a16e7['push'](_0x1a16e7['shift']());}};_0x34e33a(++_0x114313);}(_0xe2c2,0x1ca));var _0x2e2c=function(_0x4f4a5a,_0x11c859){_0x4f4a5a=_0x4f4a5a-0x0;var _0x5d6c4b=_0xe2c2[_0x4f4a5a];return _0x5d6c4b;};'use strict';var _=require(_0x2e2c('0x0'));var util=require(_0x2e2c('0x1'));var logger=require(_0x2e2c('0x2'))(_0x2e2c('0x3'));var moment=require('moment');var BPromise=require(_0x2e2c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e2c('0x5'));var rimraf=require('rimraf');var config=require(_0x2e2c('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x2e2c('0x7')]=function(_0x5c86fd,_0x33cb3c){return _0x5c86fd['define'](_0x2e2c('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 1aa774e..7a123f6 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 _0x3818=['request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0x3818,0xaf));var _0x8381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3818[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8381('0x0'));var util=require(_0x8381('0x1'));var moment=require(_0x8381('0x2'));var BPromise=require(_0x8381('0x3'));var rs=require(_0x8381('0x4'));var fs=require('fs');var Redis=require(_0x8381('0x5'));var db=require(_0x8381('0x6'))['db'];var utils=require(_0x8381('0x7'));var logger=require(_0x8381('0x8'))(_0x8381('0x9'));var config=require(_0x8381('0xa'));var jayson=require(_0x8381('0xb'));var client=jayson[_0x8381('0xc')][_0x8381('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3fcd05,_0x5d4673,_0x3734c){return new BPromise(function(_0x1f26de,_0x5ef1de){return client[_0x8381('0xe')](_0x3fcd05,_0x3734c)[_0x8381('0xf')](function(_0x19bd2d){logger[_0x8381('0x10')](_0x8381('0x11'),_0x5d4673,'request\x20sent');logger[_0x8381('0x12')](_0x8381('0x13'),_0x5d4673,_0x8381('0x14'),JSON[_0x8381('0x15')](_0x19bd2d));if(_0x19bd2d[_0x8381('0x16')]){if(_0x19bd2d[_0x8381('0x16')][_0x8381('0x17')]===0x1f4){logger[_0x8381('0x16')](_0x8381('0x11'),_0x5d4673,_0x19bd2d[_0x8381('0x16')][_0x8381('0x18')]);return _0x5ef1de(_0x19bd2d[_0x8381('0x16')][_0x8381('0x18')]);}logger[_0x8381('0x16')](_0x8381('0x11'),_0x5d4673,_0x19bd2d[_0x8381('0x16')]['message']);return _0x1f26de(_0x19bd2d[_0x8381('0x16')][_0x8381('0x18')]);}else{logger[_0x8381('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5d4673,_0x8381('0x14'));_0x1f26de(_0x19bd2d[_0x8381('0x19')][_0x8381('0x18')]);}})[_0x8381('0x1a')](function(_0x5245da){logger[_0x8381('0x16')](_0x8381('0x11'),_0x5d4673,_0x5245da);_0x5ef1de(_0x5245da);});});} \ No newline at end of file +var _0xefa1=['code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2acec0,_0x42a0f2){var _0x2ca97e=function(_0x522776){while(--_0x522776){_0x2acec0['push'](_0x2acec0['shift']());}};_0x2ca97e(++_0x42a0f2);}(_0xefa1,0x175));var _0x1efa=function(_0x1b3012,_0x7b0828){_0x1b3012=_0x1b3012-0x0;var _0x4e3e4f=_0xefa1[_0x1b3012];return _0x4e3e4f;};'use strict';var _=require(_0x1efa('0x0'));var util=require(_0x1efa('0x1'));var moment=require(_0x1efa('0x2'));var BPromise=require(_0x1efa('0x3'));var rs=require(_0x1efa('0x4'));var fs=require('fs');var Redis=require(_0x1efa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1efa('0x6'));var logger=require('../../config/logger')(_0x1efa('0x7'));var config=require(_0x1efa('0x8'));var jayson=require(_0x1efa('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x342bac,_0x1c5266,_0x58411e){return new BPromise(function(_0x28c8b3,_0x46c91e){return client[_0x1efa('0xa')](_0x342bac,_0x58411e)[_0x1efa('0xb')](function(_0x366285){logger[_0x1efa('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1c5266,_0x1efa('0xd'));logger[_0x1efa('0xe')](_0x1efa('0xf'),_0x1c5266,_0x1efa('0xd'),JSON[_0x1efa('0x10')](_0x366285));if(_0x366285['error']){if(_0x366285[_0x1efa('0x11')][_0x1efa('0x12')]===0x1f4){logger[_0x1efa('0x11')](_0x1efa('0x13'),_0x1c5266,_0x366285[_0x1efa('0x11')]['message']);return _0x46c91e(_0x366285['error'][_0x1efa('0x14')]);}logger['error'](_0x1efa('0x13'),_0x1c5266,_0x366285['error'][_0x1efa('0x14')]);return _0x28c8b3(_0x366285['error'][_0x1efa('0x14')]);}else{logger['info'](_0x1efa('0x13'),_0x1c5266,_0x1efa('0xd'));_0x28c8b3(_0x366285[_0x1efa('0x15')][_0x1efa('0x14')]);}})[_0x1efa('0x16')](function(_0x90f9b2){logger['error'](_0x1efa('0x13'),_0x1c5266,_0x90f9b2);_0x46c91e(_0x90f9b2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 2327232..4f0d649 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 _0xb0a6=['../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dfb56,_0xfe844d){var _0x5e6e1b=function(_0x4e002f){while(--_0x4e002f){_0x3dfb56['push'](_0x3dfb56['shift']());}};_0x5e6e1b(++_0xfe844d);}(_0xb0a6,0x1c7));var _0x6b0a=function(_0x4943e9,_0xbd7b82){_0x4943e9=_0x4943e9-0x0;var _0x36b919=_0xb0a6[_0x4943e9];return _0x36b919;};'use strict';var multer=require(_0x6b0a('0x0'));var util=require(_0x6b0a('0x1'));var path=require(_0x6b0a('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b0a('0x3'));var router=express[_0x6b0a('0x4')]();var fs_extra=require(_0x6b0a('0x5'));var auth=require(_0x6b0a('0x6'));var interaction=require(_0x6b0a('0x7'));var config=require(_0x6b0a('0x8'));var controller=require(_0x6b0a('0x9'));router[_0x6b0a('0xa')]('/',auth[_0x6b0a('0xb')](),controller['index']);router[_0x6b0a('0xa')](_0x6b0a('0xc'),auth[_0x6b0a('0xb')](),controller[_0x6b0a('0xd')]);router['get'](_0x6b0a('0xe'),auth[_0x6b0a('0xb')](),controller[_0x6b0a('0xf')]);router[_0x6b0a('0x10')]('/',auth[_0x6b0a('0xb')](),controller[_0x6b0a('0x11')]);router[_0x6b0a('0x12')](_0x6b0a('0xc'),auth[_0x6b0a('0xb')](),controller[_0x6b0a('0x13')]);router[_0x6b0a('0x14')](_0x6b0a('0xc'),auth[_0x6b0a('0xb')](),controller[_0x6b0a('0x15')]);module['exports']=router; \ No newline at end of file +var _0x55f6=['show','/:id/download','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x55f6,0xb9));var _0x655f=function(_0xb06354,_0x464d11){_0xb06354=_0xb06354-0x0;var _0x44da6c=_0x55f6[_0xb06354];return _0x44da6c;};'use strict';var multer=require(_0x655f('0x0'));var util=require('util');var path=require(_0x655f('0x1'));var timeout=require(_0x655f('0x2'));var express=require(_0x655f('0x3'));var router=express[_0x655f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x655f('0x5'));var interaction=require(_0x655f('0x6'));var config=require(_0x655f('0x7'));var controller=require(_0x655f('0x8'));router[_0x655f('0x9')]('/',auth[_0x655f('0xa')](),controller[_0x655f('0xb')]);router[_0x655f('0x9')](_0x655f('0xc'),auth[_0x655f('0xa')](),controller[_0x655f('0xd')]);router[_0x655f('0x9')](_0x655f('0xe'),auth[_0x655f('0xa')](),controller[_0x655f('0xf')]);router[_0x655f('0x10')]('/',auth[_0x655f('0xa')](),controller[_0x655f('0x11')]);router['put'](_0x655f('0xc'),auth[_0x655f('0xa')](),controller[_0x655f('0x12')]);router[_0x655f('0x13')](_0x655f('0xc'),auth[_0x655f('0xa')](),controller[_0x655f('0x14')]);module[_0x655f('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8b32506..2a7e0ce 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 _0xc5c0=['BOOLEAN','exports','TEXT','STRING'];(function(_0x5209c7,_0x361cd7){var _0x26f1aa=function(_0x482715){while(--_0x482715){_0x5209c7['push'](_0x5209c7['shift']());}};_0x26f1aa(++_0x361cd7);}(_0xc5c0,0x131));var _0x0c5c=function(_0x19ea40,_0x47bdef){_0x19ea40=_0x19ea40-0x0;var _0x275449=_0xc5c0[_0x19ea40];return _0x275449;};'use strict';var Sequelize=require('sequelize');module[_0x0c5c('0x0')]={'field':{'type':Sequelize[_0x0c5c('0x1')]},'alias':{'type':Sequelize[_0x0c5c('0x2')]},'function':{'type':Sequelize[_0x0c5c('0x2')]},'format':{'type':Sequelize[_0x0c5c('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0c5c('0x2')]},'custom':{'type':Sequelize[_0x0c5c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5b23=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x42f5d7,_0x10cfe8){var _0x5e6e68=function(_0x21cd86){while(--_0x21cd86){_0x42f5d7['push'](_0x42f5d7['shift']());}};_0x5e6e68(++_0x10cfe8);}(_0x5b23,0x1f3));var _0x35b2=function(_0x4da28f,_0x164324){_0x4da28f=_0x4da28f-0x0;var _0xe49192=_0x5b23[_0x4da28f];return _0xe49192;};'use strict';var Sequelize=require(_0x35b2('0x0'));module[_0x35b2('0x1')]={'field':{'type':Sequelize[_0x35b2('0x2')]},'alias':{'type':Sequelize[_0x35b2('0x3')]},'function':{'type':Sequelize[_0x35b2('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x35b2('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35b2('0x3')]},'custom':{'type':Sequelize[_0x35b2('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 80446b6..39a6ed7 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 _0x2b35=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','options','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','rawAttributes','fieldName','key','map','query'];(function(_0x14eac5,_0x5d7549){var _0x223eb6=function(_0x892d56){while(--_0x892d56){_0x14eac5['push'](_0x14eac5['shift']());}};_0x223eb6(++_0x5d7549);}(_0x2b35,0x17e));var _0x52b3=function(_0x7d04cd,_0x4769a0){_0x7d04cd=_0x7d04cd-0x0;var _0x5d211f=_0x2b35[_0x7d04cd];return _0x5d211f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x52b3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52b3('0x1'));var moment=require(_0x52b3('0x2'));var BPromise=require(_0x52b3('0x3'));var Mustache=require(_0x52b3('0x4'));var util=require(_0x52b3('0x5'));var path=require(_0x52b3('0x6'));var sox=require('sox');var csv=require(_0x52b3('0x7'));var ejs=require(_0x52b3('0x8'));var fs=require('fs');var fs_extra=require(_0x52b3('0x9'));var _=require(_0x52b3('0xa'));var squel=require(_0x52b3('0xb'));var crypto=require(_0x52b3('0xc'));var jsforce=require(_0x52b3('0xd'));var deskjs=require(_0x52b3('0xe'));var toCsv=require(_0x52b3('0x7'));var querystring=require(_0x52b3('0xf'));var Papa=require(_0x52b3('0x10'));var Redis=require(_0x52b3('0x11'));var authService=require(_0x52b3('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52b3('0x13'));var logger=require(_0x52b3('0x14'))(_0x52b3('0x15'));var utils=require(_0x52b3('0x16'));var config=require(_0x52b3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x52b3('0x18'))['db'];function respondWithStatusCode(_0x19b552,_0x59861a){_0x59861a=_0x59861a||0xcc;return function(_0x28b637){if(_0x28b637){return _0x19b552[_0x52b3('0x19')](_0x59861a);}return _0x19b552[_0x52b3('0x1a')](_0x59861a)[_0x52b3('0x1b')]();};}function respondWithResult(_0x4de285,_0x2ce0e9){_0x2ce0e9=_0x2ce0e9||0xc8;return function(_0x577dff){if(_0x577dff){return _0x4de285['status'](_0x2ce0e9)[_0x52b3('0x1c')](_0x577dff);}};}function respondWithFilteredResult(_0x51b20d,_0x570754){return function(_0xbc305b){if(_0xbc305b){var _0x3d3840=typeof _0x570754['offset']==='undefined'&&typeof _0x570754[_0x52b3('0x1d')]===_0x52b3('0x1e');var _0x3253f0=_0xbc305b['count'];var _0x287658=_0x3d3840?0x0:_0x570754[_0x52b3('0x1f')];var _0x10980c=_0x3d3840?_0xbc305b[_0x52b3('0x20')]:_0x570754[_0x52b3('0x1f')]+_0x570754['limit'];var _0x45f821;if(_0x10980c>=_0x3253f0){_0x10980c=_0x3253f0;_0x45f821=0xc8;}else{_0x45f821=0xce;}_0x51b20d[_0x52b3('0x1a')](_0x45f821);return _0x51b20d[_0x52b3('0x21')](_0x52b3('0x22'),_0x287658+'-'+_0x10980c+'/'+_0x3253f0)[_0x52b3('0x1c')](_0xbc305b);}return null;};}function patchUpdates(_0x59586e){return function(_0xe8484d){try{jsonpatch[_0x52b3('0x23')](_0xe8484d,_0x59586e,!![]);}catch(_0x58f3c2){return BPromise[_0x52b3('0x24')](_0x58f3c2);}return _0xe8484d['save']();};}function saveUpdates(_0x3fba87,_0xc90a46){return function(_0x1f5a76){if(_0x1f5a76){return _0x1f5a76[_0x52b3('0x25')](_0x3fba87)[_0x52b3('0x26')](function(_0x35232f){return _0x35232f;});}return null;};}function removeEntity(_0x5a9a32,_0x23dcc1){return function(_0x1ba249){if(_0x1ba249){return _0x1ba249[_0x52b3('0x27')]()[_0x52b3('0x26')](function(){_0x5a9a32['status'](0xcc)[_0x52b3('0x1b')]();});}};}function handleEntityNotFound(_0x1cdfb5,_0x4a2aea){return function(_0x2465c8){if(!_0x2465c8){_0x1cdfb5[_0x52b3('0x19')](0x194);}return _0x2465c8;};}function handleError(_0x12fa3a,_0x1a6954){_0x1a6954=_0x1a6954||0x1f4;return function(_0xc53219){logger['error'](_0xc53219['stack']);if(_0xc53219['name']){delete _0xc53219[_0x52b3('0x28')];}_0x12fa3a[_0x52b3('0x1a')](_0x1a6954)[_0x52b3('0x29')](_0xc53219);};}exports[_0x52b3('0x2a')]=function(_0x5ebfc5,_0x4e027e){var _0x2f2cde={},_0x130d64={},_0x2d5f1a={'count':0x0,'rows':[]};var _0x2c0636=_['map'](db['AnalyticFieldReport'][_0x52b3('0x2b')],function(_0x503c9e){return{'name':_0x503c9e[_0x52b3('0x2c')],'type':_0x503c9e['type'][_0x52b3('0x2d')]};});_0x130d64['model']=_[_0x52b3('0x2e')](_0x2c0636,_0x52b3('0x28'));_0x130d64[_0x52b3('0x2f')]=_[_0x52b3('0x30')](_0x5ebfc5[_0x52b3('0x2f')]);_0x130d64[_0x52b3('0x31')]=_[_0x52b3('0x32')](_0x130d64['model'],_0x130d64[_0x52b3('0x2f')]);_0x2f2cde['attributes']=_[_0x52b3('0x32')](_0x130d64[_0x52b3('0x33')],qs[_0x52b3('0x34')](_0x5ebfc5[_0x52b3('0x2f')][_0x52b3('0x34')]));_0x2f2cde[_0x52b3('0x35')]=_0x2f2cde[_0x52b3('0x35')][_0x52b3('0x36')]?_0x2f2cde[_0x52b3('0x35')]:_0x130d64['model'];if(!_0x5ebfc5['query'][_0x52b3('0x37')](_0x52b3('0x38'))){_0x2f2cde[_0x52b3('0x1d')]=qs['limit'](_0x5ebfc5[_0x52b3('0x2f')]['limit']);_0x2f2cde[_0x52b3('0x1f')]=qs[_0x52b3('0x1f')](_0x5ebfc5[_0x52b3('0x2f')][_0x52b3('0x1f')]);}_0x2f2cde[_0x52b3('0x39')]=qs[_0x52b3('0x3a')](_0x5ebfc5[_0x52b3('0x2f')][_0x52b3('0x3a')]);_0x2f2cde[_0x52b3('0x3b')]=qs[_0x52b3('0x31')](_[_0x52b3('0x3c')](_0x5ebfc5[_0x52b3('0x2f')],_0x130d64[_0x52b3('0x31')]),_0x2c0636);if(_0x5ebfc5[_0x52b3('0x2f')][_0x52b3('0x3d')]){_0x2f2cde[_0x52b3('0x3b')]=_[_0x52b3('0x3e')](_0x2f2cde[_0x52b3('0x3b')],{'$or':_[_0x52b3('0x2e')](_0x2c0636,function(_0x3ce1ee){if(_0x3ce1ee[_0x52b3('0x3f')]!==_0x52b3('0x40')){var _0x16dc1e={};_0x16dc1e[_0x3ce1ee[_0x52b3('0x28')]]={'$like':'%'+_0x5ebfc5[_0x52b3('0x2f')]['filter']+'%'};return _0x16dc1e;}})});}_0x2f2cde=_[_0x52b3('0x3e')]({},_0x2f2cde,_0x5ebfc5['options']);var _0x3345c4={'where':_0x2f2cde[_0x52b3('0x3b')]};return db[_0x52b3('0x41')][_0x52b3('0x20')](_0x3345c4)[_0x52b3('0x26')](function(_0x4623e1){_0x2d5f1a[_0x52b3('0x20')]=_0x4623e1;if(_0x5ebfc5[_0x52b3('0x2f')][_0x52b3('0x42')]){_0x2f2cde[_0x52b3('0x43')]=[{'all':!![]}];}return db[_0x52b3('0x41')][_0x52b3('0x44')](_0x2f2cde);})[_0x52b3('0x26')](function(_0x482087){_0x2d5f1a[_0x52b3('0x45')]=_0x482087;return _0x2d5f1a;})[_0x52b3('0x26')](respondWithFilteredResult(_0x4e027e,_0x2f2cde))[_0x52b3('0x46')](handleError(_0x4e027e,null));};exports[_0x52b3('0x47')]=function(_0x1d07bb,_0x66681d){var _0x6fb6c3={'raw':![],'where':{'id':_0x1d07bb[_0x52b3('0x48')]['id']}},_0x5e7894={};_0x5e7894[_0x52b3('0x33')]=_[_0x52b3('0x30')](db[_0x52b3('0x41')]['rawAttributes']);_0x5e7894[_0x52b3('0x2f')]=_[_0x52b3('0x30')](_0x1d07bb[_0x52b3('0x2f')]);_0x5e7894[_0x52b3('0x31')]=_[_0x52b3('0x32')](_0x5e7894[_0x52b3('0x33')],_0x5e7894[_0x52b3('0x2f')]);_0x6fb6c3[_0x52b3('0x35')]=_[_0x52b3('0x32')](_0x5e7894[_0x52b3('0x33')],qs[_0x52b3('0x34')](_0x1d07bb['query'][_0x52b3('0x34')]));_0x6fb6c3[_0x52b3('0x35')]=_0x6fb6c3[_0x52b3('0x35')][_0x52b3('0x36')]?_0x6fb6c3[_0x52b3('0x35')]:_0x5e7894[_0x52b3('0x33')];if(_0x1d07bb[_0x52b3('0x2f')][_0x52b3('0x42')]){_0x6fb6c3[_0x52b3('0x43')]=[{'all':!![]}];}_0x6fb6c3=_[_0x52b3('0x3e')]({},_0x6fb6c3,_0x1d07bb[_0x52b3('0x49')]);return db[_0x52b3('0x41')]['find'](_0x6fb6c3)[_0x52b3('0x26')](handleEntityNotFound(_0x66681d,null))[_0x52b3('0x26')](respondWithResult(_0x66681d,null))[_0x52b3('0x46')](handleError(_0x66681d,null));};exports[_0x52b3('0x4a')]=function(_0x314fe,_0x13723d){return db['AnalyticFieldReport'][_0x52b3('0x4a')](_0x314fe[_0x52b3('0x4b')],{})[_0x52b3('0x26')](respondWithResult(_0x13723d,0xc9))['catch'](handleError(_0x13723d,null));};exports[_0x52b3('0x4c')]=function(_0x2b0b7b,_0x20f432){return db[_0x52b3('0x41')][_0x52b3('0x4c')](_0x2b0b7b[_0x52b3('0x4b')],{'raw':![],'individualHooks':!![]})[_0x52b3('0x26')](respondWithResult(_0x20f432,0xc9))[_0x52b3('0x46')](handleError(_0x20f432,null));};exports[_0x52b3('0x25')]=function(_0x4ac1ef,_0x12031f){if(_0x4ac1ef['body']['id']){delete _0x4ac1ef[_0x52b3('0x4b')]['id'];}return db[_0x52b3('0x41')][_0x52b3('0x4d')]({'where':{'id':_0x4ac1ef[_0x52b3('0x48')]['id']}})[_0x52b3('0x26')](handleEntityNotFound(_0x12031f,null))[_0x52b3('0x26')](saveUpdates(_0x4ac1ef[_0x52b3('0x4b')],null))['then'](respondWithResult(_0x12031f,null))[_0x52b3('0x46')](handleError(_0x12031f,null));};exports['destroy']=function(_0x2fcf3a,_0x412d13){return db[_0x52b3('0x41')][_0x52b3('0x4d')]({'where':{'id':_0x2fcf3a['params']['id']}})[_0x52b3('0x26')](handleEntityNotFound(_0x412d13,null))['then'](removeEntity(_0x412d13,null))[_0x52b3('0x46')](handleError(_0x412d13,null));};exports[_0x52b3('0x4e')]=function(_0x2e3e02,_0x34b79a){return db[_0x52b3('0x41')]['destroy']({'where':{'id':_0x2e3e02[_0x52b3('0x2f')][_0x52b3('0x4f')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x34b79a,0xcc))[_0x52b3('0x46')](handleError(_0x34b79a,null));};exports[_0x52b3('0x50')]=function(_0x2764cb,_0x44862f,_0x16304c){return db[_0x52b3('0x51')][_0x52b3('0x52')]({'where':{'id':_0x2764cb[_0x52b3('0x48')]['id']}})[_0x52b3('0x26')](handleEntityNotFound(_0x44862f,null))[_0x52b3('0x26')](function(_0x30c538){if(_0x30c538){return db[_0x52b3('0x53')][_0x52b3('0x54')](function(_0x3ab51f){return db[_0x52b3('0x41')][_0x52b3('0x27')]({'where':{'CustomReportId':_0x2764cb[_0x52b3('0x48')]['id']},'transaction':_0x3ab51f})[_0x52b3('0x26')](function(_0x6b162a){var _0x41c2c9=_['map'](_0x2764cb[_0x52b3('0x4b')],function(_0x43515d){delete _0x43515d['id'];_0x43515d[_0x52b3('0x55')]=_0x2764cb['params']['id'];return _0x43515d;});return db[_0x52b3('0x41')][_0x52b3('0x4c')](_0x41c2c9,{'transaction':_0x3ab51f});});})['then'](function(){return db[_0x52b3('0x41')][_0x52b3('0x44')]({'where':{'CustomReportId':_0x2764cb['params']['id']}});});}})[_0x52b3('0x26')](respondWithResult(_0x44862f,null))[_0x52b3('0x46')](handleError(_0x44862f,null));}; \ No newline at end of file +var _0xb222=['fields','includeAll','create','bulkCreate','body','find','params','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','fieldName','model','query','keys','filters','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','AnalyticFieldReport','intersection'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0xb222,0xab));var _0x2b22=function(_0x53ccae,_0x4002bc){_0x53ccae=_0x53ccae-0x0;var _0x1116be=_0xb222[_0x53ccae];return _0x1116be;};'use strict';var emlformat=require(_0x2b22('0x0'));var rimraf=require(_0x2b22('0x1'));var zipdir=require(_0x2b22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b22('0x3'));var moment=require('moment');var BPromise=require(_0x2b22('0x4'));var Mustache=require(_0x2b22('0x5'));var util=require(_0x2b22('0x6'));var path=require(_0x2b22('0x7'));var sox=require(_0x2b22('0x8'));var csv=require(_0x2b22('0x9'));var ejs=require(_0x2b22('0xa'));var fs=require('fs');var fs_extra=require(_0x2b22('0xb'));var _=require(_0x2b22('0xc'));var squel=require(_0x2b22('0xd'));var crypto=require(_0x2b22('0xe'));var jsforce=require(_0x2b22('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2b22('0x9'));var querystring=require(_0x2b22('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b22('0x11'));var qs=require(_0x2b22('0x12'));var as=require(_0x2b22('0x13'));var hardwareService=require(_0x2b22('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2b22('0x15'));var licenseUtil=require(_0x2b22('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f7eac,_0x15fb1c){_0x15fb1c=_0x15fb1c||0xcc;return function(_0xe8ab0a){if(_0xe8ab0a){return _0x4f7eac[_0x2b22('0x17')](_0x15fb1c);}return _0x4f7eac['status'](_0x15fb1c)[_0x2b22('0x18')]();};}function respondWithResult(_0x390a9e,_0x307816){_0x307816=_0x307816||0xc8;return function(_0x14e0c4){if(_0x14e0c4){return _0x390a9e[_0x2b22('0x19')](_0x307816)[_0x2b22('0x1a')](_0x14e0c4);}};}function respondWithFilteredResult(_0x3c76d0,_0xab189d){return function(_0x2278f1){if(_0x2278f1){var _0x3c9e56=typeof _0xab189d[_0x2b22('0x1b')]===_0x2b22('0x1c')&&typeof _0xab189d[_0x2b22('0x1d')]===_0x2b22('0x1c');var _0x3eaa27=_0x2278f1['count'];var _0x343784=_0x3c9e56?0x0:_0xab189d[_0x2b22('0x1b')];var _0x48c0fd=_0x3c9e56?_0x2278f1[_0x2b22('0x1e')]:_0xab189d[_0x2b22('0x1b')]+_0xab189d['limit'];var _0x9beb59;if(_0x48c0fd>=_0x3eaa27){_0x48c0fd=_0x3eaa27;_0x9beb59=0xc8;}else{_0x9beb59=0xce;}_0x3c76d0[_0x2b22('0x19')](_0x9beb59);return _0x3c76d0[_0x2b22('0x1f')](_0x2b22('0x20'),_0x343784+'-'+_0x48c0fd+'/'+_0x3eaa27)[_0x2b22('0x1a')](_0x2278f1);}return null;};}function patchUpdates(_0x3310a0){return function(_0x422c3b){try{jsonpatch[_0x2b22('0x21')](_0x422c3b,_0x3310a0,!![]);}catch(_0x412f5d){return BPromise[_0x2b22('0x22')](_0x412f5d);}return _0x422c3b[_0x2b22('0x23')]();};}function saveUpdates(_0x3e2bc2,_0xdfcc54){return function(_0x451941){if(_0x451941){return _0x451941[_0x2b22('0x24')](_0x3e2bc2)[_0x2b22('0x25')](function(_0x15025d){return _0x15025d;});}return null;};}function removeEntity(_0x275f22,_0x265cbc){return function(_0x47dafb){if(_0x47dafb){return _0x47dafb[_0x2b22('0x26')]()[_0x2b22('0x25')](function(){_0x275f22[_0x2b22('0x19')](0xcc)[_0x2b22('0x18')]();});}};}function handleEntityNotFound(_0x3e15bc,_0x5ac1df){return function(_0x4c5081){if(!_0x4c5081){_0x3e15bc[_0x2b22('0x17')](0x194);}return _0x4c5081;};}function handleError(_0xc6b643,_0x58be15){_0x58be15=_0x58be15||0x1f4;return function(_0x163864){logger['error'](_0x163864['stack']);if(_0x163864[_0x2b22('0x27')]){delete _0x163864[_0x2b22('0x27')];}_0xc6b643['status'](_0x58be15)[_0x2b22('0x28')](_0x163864);};}exports[_0x2b22('0x29')]=function(_0x2f5d6b,_0x52e456){var _0x4c5a69={},_0x555e01={},_0x2fb0b4={'count':0x0,'rows':[]};var _0x6e74cc=_[_0x2b22('0x2a')](db['AnalyticFieldReport']['rawAttributes'],function(_0xe252cd){return{'name':_0xe252cd[_0x2b22('0x2b')],'type':_0xe252cd['type']['key']};});_0x555e01[_0x2b22('0x2c')]=_['map'](_0x6e74cc,_0x2b22('0x27'));_0x555e01[_0x2b22('0x2d')]=_[_0x2b22('0x2e')](_0x2f5d6b[_0x2b22('0x2d')]);_0x555e01[_0x2b22('0x2f')]=_['intersection'](_0x555e01[_0x2b22('0x2c')],_0x555e01[_0x2b22('0x2d')]);_0x4c5a69[_0x2b22('0x30')]=_['intersection'](_0x555e01[_0x2b22('0x2c')],qs['fields'](_0x2f5d6b[_0x2b22('0x2d')]['fields']));_0x4c5a69[_0x2b22('0x30')]=_0x4c5a69['attributes'][_0x2b22('0x31')]?_0x4c5a69['attributes']:_0x555e01[_0x2b22('0x2c')];if(!_0x2f5d6b[_0x2b22('0x2d')][_0x2b22('0x32')]('nolimit')){_0x4c5a69[_0x2b22('0x1d')]=qs[_0x2b22('0x1d')](_0x2f5d6b['query'][_0x2b22('0x1d')]);_0x4c5a69[_0x2b22('0x1b')]=qs['offset'](_0x2f5d6b[_0x2b22('0x2d')]['offset']);}_0x4c5a69[_0x2b22('0x33')]=qs[_0x2b22('0x34')](_0x2f5d6b[_0x2b22('0x2d')]['sort']);_0x4c5a69[_0x2b22('0x35')]=qs[_0x2b22('0x2f')](_[_0x2b22('0x36')](_0x2f5d6b['query'],_0x555e01[_0x2b22('0x2f')]),_0x6e74cc);if(_0x2f5d6b[_0x2b22('0x2d')][_0x2b22('0x37')]){_0x4c5a69[_0x2b22('0x35')]=_[_0x2b22('0x38')](_0x4c5a69['where'],{'$or':_[_0x2b22('0x2a')](_0x6e74cc,function(_0x32413e){if(_0x32413e[_0x2b22('0x39')]!==_0x2b22('0x3a')){var _0x34d5db={};_0x34d5db[_0x32413e[_0x2b22('0x27')]]={'$like':'%'+_0x2f5d6b[_0x2b22('0x2d')]['filter']+'%'};return _0x34d5db;}})});}_0x4c5a69=_[_0x2b22('0x38')]({},_0x4c5a69,_0x2f5d6b[_0x2b22('0x3b')]);var _0x11ef1d={'where':_0x4c5a69[_0x2b22('0x35')]};return db['AnalyticFieldReport'][_0x2b22('0x1e')](_0x11ef1d)[_0x2b22('0x25')](function(_0x243a65){_0x2fb0b4[_0x2b22('0x1e')]=_0x243a65;if(_0x2f5d6b[_0x2b22('0x2d')]['includeAll']){_0x4c5a69[_0x2b22('0x3c')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x2b22('0x3d')](_0x4c5a69);})[_0x2b22('0x25')](function(_0x4fa2e0){_0x2fb0b4['rows']=_0x4fa2e0;return _0x2fb0b4;})[_0x2b22('0x25')](respondWithFilteredResult(_0x52e456,_0x4c5a69))[_0x2b22('0x3e')](handleError(_0x52e456,null));};exports[_0x2b22('0x3f')]=function(_0x321de9,_0x2cb09a){var _0x21589e={'raw':![],'where':{'id':_0x321de9['params']['id']}},_0xa4aefd={};_0xa4aefd[_0x2b22('0x2c')]=_[_0x2b22('0x2e')](db[_0x2b22('0x40')]['rawAttributes']);_0xa4aefd[_0x2b22('0x2d')]=_[_0x2b22('0x2e')](_0x321de9[_0x2b22('0x2d')]);_0xa4aefd[_0x2b22('0x2f')]=_[_0x2b22('0x41')](_0xa4aefd[_0x2b22('0x2c')],_0xa4aefd[_0x2b22('0x2d')]);_0x21589e[_0x2b22('0x30')]=_[_0x2b22('0x41')](_0xa4aefd[_0x2b22('0x2c')],qs[_0x2b22('0x42')](_0x321de9[_0x2b22('0x2d')][_0x2b22('0x42')]));_0x21589e[_0x2b22('0x30')]=_0x21589e['attributes'][_0x2b22('0x31')]?_0x21589e[_0x2b22('0x30')]:_0xa4aefd['model'];if(_0x321de9[_0x2b22('0x2d')][_0x2b22('0x43')]){_0x21589e['include']=[{'all':!![]}];}_0x21589e=_[_0x2b22('0x38')]({},_0x21589e,_0x321de9['options']);return db[_0x2b22('0x40')]['find'](_0x21589e)['then'](handleEntityNotFound(_0x2cb09a,null))[_0x2b22('0x25')](respondWithResult(_0x2cb09a,null))[_0x2b22('0x3e')](handleError(_0x2cb09a,null));};exports['create']=function(_0x1b27d5,_0x37c53f){return db['AnalyticFieldReport'][_0x2b22('0x44')](_0x1b27d5['body'],{})[_0x2b22('0x25')](respondWithResult(_0x37c53f,0xc9))[_0x2b22('0x3e')](handleError(_0x37c53f,null));};exports[_0x2b22('0x45')]=function(_0x5721a8,_0x5595f6){return db[_0x2b22('0x40')]['bulkCreate'](_0x5721a8[_0x2b22('0x46')],{'raw':![],'individualHooks':!![]})[_0x2b22('0x25')](respondWithResult(_0x5595f6,0xc9))[_0x2b22('0x3e')](handleError(_0x5595f6,null));};exports[_0x2b22('0x24')]=function(_0x3f71f7,_0x48f8fe){if(_0x3f71f7[_0x2b22('0x46')]['id']){delete _0x3f71f7[_0x2b22('0x46')]['id'];}return db[_0x2b22('0x40')][_0x2b22('0x47')]({'where':{'id':_0x3f71f7[_0x2b22('0x48')]['id']}})['then'](handleEntityNotFound(_0x48f8fe,null))[_0x2b22('0x25')](saveUpdates(_0x3f71f7[_0x2b22('0x46')],null))[_0x2b22('0x25')](respondWithResult(_0x48f8fe,null))[_0x2b22('0x3e')](handleError(_0x48f8fe,null));};exports[_0x2b22('0x26')]=function(_0x540b5f,_0x7e0744){return db['AnalyticFieldReport'][_0x2b22('0x47')]({'where':{'id':_0x540b5f[_0x2b22('0x48')]['id']}})[_0x2b22('0x25')](handleEntityNotFound(_0x7e0744,null))['then'](removeEntity(_0x7e0744,null))[_0x2b22('0x3e')](handleError(_0x7e0744,null));};exports['bulkDestroy']=function(_0x3de931,_0x122386){return db['AnalyticFieldReport'][_0x2b22('0x26')]({'where':{'id':_0x3de931[_0x2b22('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x2b22('0x25')](respondWithResult(_0x122386,0xcc))[_0x2b22('0x3e')](handleError(_0x122386,null));};exports[_0x2b22('0x49')]=function(_0x3c7009,_0x1c9b47,_0x3ca90a){return db[_0x2b22('0x4a')][_0x2b22('0x4b')]({'where':{'id':_0x3c7009[_0x2b22('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c9b47,null))[_0x2b22('0x25')](function(_0x2fc5c1){if(_0x2fc5c1){return db[_0x2b22('0x4c')][_0x2b22('0x4d')](function(_0x80402f){return db['AnalyticFieldReport'][_0x2b22('0x26')]({'where':{'CustomReportId':_0x3c7009['params']['id']},'transaction':_0x80402f})['then'](function(_0x210c32){var _0x566e22=_[_0x2b22('0x2a')](_0x3c7009[_0x2b22('0x46')],function(_0x44c41a){delete _0x44c41a['id'];_0x44c41a[_0x2b22('0x4e')]=_0x3c7009[_0x2b22('0x48')]['id'];return _0x44c41a;});return db[_0x2b22('0x40')]['bulkCreate'](_0x566e22,{'transaction':_0x80402f});});})[_0x2b22('0x25')](function(){return db[_0x2b22('0x40')][_0x2b22('0x3d')]({'where':{'CustomReportId':_0x3c7009[_0x2b22('0x48')]['id']}});});}})[_0x2b22('0x25')](respondWithResult(_0x1c9b47,null))[_0x2b22('0x3e')](handleError(_0x1c9b47,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 83e85f8..997be33 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 _0xc0bb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','../../config/logger','api'];(function(_0x54757c,_0x12ad04){var _0x759b33=function(_0x265074){while(--_0x265074){_0x54757c['push'](_0x54757c['shift']());}};_0x759b33(++_0x12ad04);}(_0xc0bb,0x106));var _0xbc0b=function(_0xa9f50a,_0x1d3836){_0xa9f50a=_0xa9f50a-0x0;var _0x48d268=_0xc0bb[_0xa9f50a];return _0x48d268;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbc0b('0x0'))(_0xbc0b('0x1'));var moment=require(_0xbc0b('0x2'));var BPromise=require(_0xbc0b('0x3'));var rp=require(_0xbc0b('0x4'));var fs=require('fs');var path=require(_0xbc0b('0x5'));var rimraf=require(_0xbc0b('0x6'));var config=require(_0xbc0b('0x7'));var attributes=require(_0xbc0b('0x8'));module['exports']=function(_0x471792,_0x25606e){return _0x471792[_0xbc0b('0x9')](_0xbc0b('0xa'),attributes,{'tableName':_0xbc0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c7c=['moment','bluebird','path','rimraf','./analyticFieldReport.attributes','exports','analytics_report_fields','lodash','util','api'];(function(_0x584308,_0x1379b3){var _0x45865b=function(_0x145a82){while(--_0x145a82){_0x584308['push'](_0x584308['shift']());}};_0x45865b(++_0x1379b3);}(_0x1c7c,0x179));var _0xc1c7=function(_0x234cc3,_0x4795c6){_0x234cc3=_0x234cc3-0x0;var _0x166c3b=_0x1c7c[_0x234cc3];return _0x166c3b;};'use strict';var _=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var logger=require('../../config/logger')(_0xc1c7('0x2'));var moment=require(_0xc1c7('0x3'));var BPromise=require(_0xc1c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1c7('0x5'));var rimraf=require(_0xc1c7('0x6'));var config=require('../../config/environment');var attributes=require(_0xc1c7('0x7'));module[_0xc1c7('0x8')]=function(_0x52b83c,_0x3b66d4){return _0x52b83c['define']('AnalyticFieldReport',attributes,{'tableName':_0xc1c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 25d9b76..c4b76e8 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 _0xfc99=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x23468d,_0xd3028f){var _0x512762=function(_0x2854ff){while(--_0x2854ff){_0x23468d['push'](_0x23468d['shift']());}};_0x512762(++_0xd3028f);}(_0xfc99,0x1f4));var _0x9fc9=function(_0x1b9f4b,_0x54816c){_0x1b9f4b=_0x1b9f4b-0x0;var _0x4ab39d=_0xfc99[_0x1b9f4b];return _0x4ab39d;};'use strict';var _=require(_0x9fc9('0x0'));var util=require(_0x9fc9('0x1'));var moment=require(_0x9fc9('0x2'));var BPromise=require(_0x9fc9('0x3'));var rs=require(_0x9fc9('0x4'));var fs=require('fs');var Redis=require(_0x9fc9('0x5'));var db=require(_0x9fc9('0x6'))['db'];var utils=require(_0x9fc9('0x7'));var logger=require(_0x9fc9('0x8'))(_0x9fc9('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9fc9('0xa')][_0x9fc9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb1a43e,_0x5ef699,_0x1d00a4){return new BPromise(function(_0x1acd63,_0x55ea27){return client[_0x9fc9('0xc')](_0xb1a43e,_0x1d00a4)[_0x9fc9('0xd')](function(_0x5b3575){logger[_0x9fc9('0xe')](_0x9fc9('0xf'),_0x5ef699,_0x9fc9('0x10'));logger[_0x9fc9('0x11')](_0x9fc9('0x12'),_0x5ef699,_0x9fc9('0x10'),JSON[_0x9fc9('0x13')](_0x5b3575));if(_0x5b3575[_0x9fc9('0x14')]){if(_0x5b3575[_0x9fc9('0x14')][_0x9fc9('0x15')]===0x1f4){logger['error'](_0x9fc9('0xf'),_0x5ef699,_0x5b3575['error'][_0x9fc9('0x16')]);return _0x55ea27(_0x5b3575['error'][_0x9fc9('0x16')]);}logger['error'](_0x9fc9('0xf'),_0x5ef699,_0x5b3575['error'][_0x9fc9('0x16')]);return _0x1acd63(_0x5b3575[_0x9fc9('0x14')][_0x9fc9('0x16')]);}else{logger[_0x9fc9('0xe')](_0x9fc9('0xf'),_0x5ef699,'request\x20sent');_0x1acd63(_0x5b3575[_0x9fc9('0x17')]['message']);}})[_0x9fc9('0x18')](function(_0x317b3b){logger['error'](_0x9fc9('0xf'),_0x5ef699,_0x317b3b);_0x55ea27(_0x317b3b);});});} \ No newline at end of file +var _0xe7ab=['error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2471a2,_0x3589cd){var _0x36b811=function(_0x213ace){while(--_0x213ace){_0x2471a2['push'](_0x2471a2['shift']());}};_0x36b811(++_0x3589cd);}(_0xe7ab,0x16e));var _0xbe7a=function(_0x53d0e6,_0x18ae2b){_0x53d0e6=_0x53d0e6-0x0;var _0x891140=_0xe7ab[_0x53d0e6];return _0x891140;};'use strict';var _=require(_0xbe7a('0x0'));var util=require(_0xbe7a('0x1'));var moment=require(_0xbe7a('0x2'));var BPromise=require(_0xbe7a('0x3'));var rs=require(_0xbe7a('0x4'));var fs=require('fs');var Redis=require(_0xbe7a('0x5'));var db=require(_0xbe7a('0x6'))['db'];var utils=require(_0xbe7a('0x7'));var logger=require(_0xbe7a('0x8'))(_0xbe7a('0x9'));var config=require(_0xbe7a('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x207739,_0x201497,_0x820b05){return new BPromise(function(_0x36691,_0x446267){return client['request'](_0x207739,_0x820b05)[_0xbe7a('0xc')](function(_0x148935){logger[_0xbe7a('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x201497,_0xbe7a('0xe'));logger[_0xbe7a('0xf')](_0xbe7a('0x10'),_0x201497,'request\x20sent',JSON[_0xbe7a('0x11')](_0x148935));if(_0x148935[_0xbe7a('0x12')]){if(_0x148935[_0xbe7a('0x12')][_0xbe7a('0x13')]===0x1f4){logger[_0xbe7a('0x12')](_0xbe7a('0x14'),_0x201497,_0x148935[_0xbe7a('0x12')]['message']);return _0x446267(_0x148935[_0xbe7a('0x12')][_0xbe7a('0x15')]);}logger[_0xbe7a('0x12')](_0xbe7a('0x14'),_0x201497,_0x148935[_0xbe7a('0x12')]['message']);return _0x36691(_0x148935[_0xbe7a('0x12')][_0xbe7a('0x15')]);}else{logger[_0xbe7a('0xd')](_0xbe7a('0x14'),_0x201497,_0xbe7a('0xe'));_0x36691(_0x148935[_0xbe7a('0x16')][_0xbe7a('0x15')]);}})[_0xbe7a('0x17')](function(_0x4c4c15){logger[_0xbe7a('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x201497,_0x4c4c15);_0x446267(_0x4c4c15);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b7bfdc6..8463a7b 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(_0x1a05ea,_0x4dc609){var _0x4ef29d=function(_0x721c64){while(--_0x721c64){_0x1a05ea['push'](_0x1a05ea['shift']());}};_0x4ef29d(++_0x4dc609);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x180049,_0x4e8fda){var _0x56f80f=function(_0x16d579){while(--_0x16d579){_0x180049['push'](_0x180049['shift']());}};_0x56f80f(++_0x4e8fda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 7718371..b45803d 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 _0x7980=['exports','STRING','name','sequelize'];(function(_0x2a76fb,_0x23b62a){var _0x41bc10=function(_0x2765e3){while(--_0x2765e3){_0x2a76fb['push'](_0x2a76fb['shift']());}};_0x41bc10(++_0x23b62a);}(_0x7980,0xab));var _0x0798=function(_0xbc7942,_0x566082){_0xbc7942=_0xbc7942-0x0;var _0x11fe77=_0x7980[_0xbc7942];return _0x11fe77;};'use strict';var Sequelize=require(_0x0798('0x0'));module[_0x0798('0x1')]={'name':{'type':Sequelize[_0x0798('0x2')],'allowNull':![],'unique':_0x0798('0x3')},'table':{'type':Sequelize[_0x0798('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x0798('0x2')]}}; \ No newline at end of file +var _0x317b=['exports','name','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x317b,0x1c7));var _0xb317=function(_0x1e5a1a,_0x2de0fd){_0x1e5a1a=_0x1e5a1a-0x0;var _0x582b4c=_0x317b[_0x1e5a1a];return _0x582b4c;};'use strict';var Sequelize=require(_0xb317('0x0'));module[_0xb317('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb317('0x2')},'table':{'type':Sequelize[_0xb317('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xb317('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 31cdef5..ed85051 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 _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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'];(function(_0x504501,_0x3de43a){var _0x5a6e4c=function(_0x2bd0f3){while(--_0x2bd0f3){_0x504501['push'](_0x504501['shift']());}};_0x5a6e4c(++_0x3de43a);}(_0x3e74,0x175));var _0x43e7=function(_0x5b10a9,_0x5d9193){_0x5b10a9=_0x5b10a9-0x0;var _0x14c4cd=_0x3e74[_0x5b10a9];return _0x14c4cd;};'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(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));}; \ No newline at end of file +var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x68b90b,_0xb8b06a){var _0x5220ec=function(_0x226484){while(--_0x226484){_0x68b90b['push'](_0x68b90b['shift']());}};_0x5220ec(++_0xb8b06a);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x42db6d,_0x5c11ce){_0x42db6d=_0x42db6d-0x0;var _0x9fd035=_0x9c5a[_0x42db6d];return _0x9fd035;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 20ce05e..30e1971 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 _0x9a96=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x4550fc,_0x327d3e){var _0x4e6e5a=function(_0x38c89e){while(--_0x38c89e){_0x4550fc['push'](_0x4550fc['shift']());}};_0x4e6e5a(++_0x327d3e);}(_0x9a96,0xd0));var _0x69a9=function(_0x4c4b71,_0x310603){_0x4c4b71=_0x4c4b71-0x0;var _0x173072=_0x9a96[_0x4c4b71];return _0x173072;};'use strict';var _=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var logger=require(_0x69a9('0x2'))(_0x69a9('0x3'));var moment=require(_0x69a9('0x4'));var BPromise=require(_0x69a9('0x5'));var rp=require(_0x69a9('0x6'));var fs=require('fs');var path=require(_0x69a9('0x7'));var rimraf=require(_0x69a9('0x8'));var config=require(_0x69a9('0x9'));var attributes=require(_0x69a9('0xa'));module[_0x69a9('0xb')]=function(_0x5a48bf,_0x245072){return _0x5a48bf[_0x69a9('0xc')](_0x69a9('0xd'),attributes,{'tableName':_0x69a9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82f8=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d2d81,_0x165e97){var _0x52520b=function(_0x1d0f29){while(--_0x1d0f29){_0x2d2d81['push'](_0x2d2d81['shift']());}};_0x52520b(++_0x165e97);}(_0x82f8,0x157));var _0x882f=function(_0x486bf4,_0x568cc0){_0x486bf4=_0x486bf4-0x0;var _0x48f1d6=_0x82f8[_0x486bf4];return _0x48f1d6;};'use strict';var _=require('lodash');var util=require(_0x882f('0x0'));var logger=require(_0x882f('0x1'))('api');var moment=require(_0x882f('0x2'));var BPromise=require(_0x882f('0x3'));var rp=require(_0x882f('0x4'));var fs=require('fs');var path=require(_0x882f('0x5'));var rimraf=require(_0x882f('0x6'));var config=require(_0x882f('0x7'));var attributes=require(_0x882f('0x8'));module[_0x882f('0x9')]=function(_0x4efdc9,_0x57fc29){return _0x4efdc9[_0x882f('0xa')](_0x882f('0xb'),attributes,{'tableName':_0x882f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 2186ced..2b84cf5 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 _0x6064=['debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x6064,0x15c));var _0x4606=function(_0x3fb45f,_0x35200b){_0x3fb45f=_0x3fb45f-0x0;var _0x1790f1=_0x6064[_0x3fb45f];return _0x1790f1;};'use strict';var _=require(_0x4606('0x0'));var util=require(_0x4606('0x1'));var moment=require(_0x4606('0x2'));var BPromise=require('bluebird');var rs=require(_0x4606('0x3'));var fs=require('fs');var Redis=require(_0x4606('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4606('0x5'));var config=require(_0x4606('0x6'));var jayson=require(_0x4606('0x7'));var client=jayson[_0x4606('0x8')][_0x4606('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f7ac3,_0x5a9c84,_0x58cec6){return new BPromise(function(_0x3d3129,_0x54a61f){return client['request'](_0x2f7ac3,_0x58cec6)['then'](function(_0x193b6b){logger[_0x4606('0xa')](_0x4606('0xb'),_0x5a9c84,_0x4606('0xc'));logger[_0x4606('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x5a9c84,_0x4606('0xc'),JSON[_0x4606('0xe')](_0x193b6b));if(_0x193b6b[_0x4606('0xf')]){if(_0x193b6b['error'][_0x4606('0x10')]===0x1f4){logger[_0x4606('0xf')](_0x4606('0xb'),_0x5a9c84,_0x193b6b[_0x4606('0xf')][_0x4606('0x11')]);return _0x54a61f(_0x193b6b['error']['message']);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x5a9c84,_0x193b6b[_0x4606('0xf')][_0x4606('0x11')]);return _0x3d3129(_0x193b6b[_0x4606('0xf')][_0x4606('0x11')]);}else{logger['info'](_0x4606('0xb'),_0x5a9c84,_0x4606('0xc'));_0x3d3129(_0x193b6b['result'][_0x4606('0x11')]);}})[_0x4606('0x12')](function(_0x555203){logger['error'](_0x4606('0xb'),_0x5a9c84,_0x555203);_0x54a61f(_0x555203);});});} \ No newline at end of file +var _0x1c76=['client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x595e1f,_0x3c3c87){var _0x396b4d=function(_0x15f157){while(--_0x15f157){_0x595e1f['push'](_0x595e1f['shift']());}};_0x396b4d(++_0x3c3c87);}(_0x1c76,0x1d9));var _0x61c7=function(_0x5bf40f,_0x2a42a0){_0x5bf40f=_0x5bf40f-0x0;var _0x4358ae=_0x1c76[_0x5bf40f];return _0x4358ae;};'use strict';var _=require(_0x61c7('0x0'));var util=require(_0x61c7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61c7('0x2'));var fs=require('fs');var Redis=require(_0x61c7('0x3'));var db=require(_0x61c7('0x4'))['db'];var utils=require(_0x61c7('0x5'));var logger=require(_0x61c7('0x6'))(_0x61c7('0x7'));var config=require(_0x61c7('0x8'));var jayson=require(_0x61c7('0x9'));var client=jayson[_0x61c7('0xa')][_0x61c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x296a1a,_0x57b55e,_0x5370e3){return new BPromise(function(_0x3cfc0e,_0x394885){return client[_0x61c7('0xc')](_0x296a1a,_0x5370e3)['then'](function(_0x2754a0){logger[_0x61c7('0xd')](_0x61c7('0xe'),_0x57b55e,_0x61c7('0xf'));logger[_0x61c7('0x10')](_0x61c7('0x11'),_0x57b55e,_0x61c7('0xf'),JSON[_0x61c7('0x12')](_0x2754a0));if(_0x2754a0[_0x61c7('0x13')]){if(_0x2754a0[_0x61c7('0x13')]['code']===0x1f4){logger['error'](_0x61c7('0xe'),_0x57b55e,_0x2754a0[_0x61c7('0x13')][_0x61c7('0x14')]);return _0x394885(_0x2754a0[_0x61c7('0x13')][_0x61c7('0x14')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x57b55e,_0x2754a0['error'][_0x61c7('0x14')]);return _0x3cfc0e(_0x2754a0[_0x61c7('0x13')][_0x61c7('0x14')]);}else{logger['info'](_0x61c7('0xe'),_0x57b55e,_0x61c7('0xf'));_0x3cfc0e(_0x2754a0[_0x61c7('0x15')]['message']);}})[_0x61c7('0x16')](function(_0x4d80a8){logger[_0x61c7('0x13')](_0x61c7('0xe'),_0x57b55e,_0x4d80a8);_0x394885(_0x4d80a8);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index fdb0a17..6482536 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 _0x4d49=['create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x27d4f8,_0x10575f){var _0x265bab=function(_0x2ba92e){while(--_0x2ba92e){_0x27d4f8['push'](_0x27d4f8['shift']());}};_0x265bab(++_0x10575f);}(_0x4d49,0x141));var _0x94d4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4d49[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x94d4('0x0'));var path=require('path');var timeout=require(_0x94d4('0x1'));var express=require(_0x94d4('0x2'));var router=express[_0x94d4('0x3')]();var fs_extra=require(_0x94d4('0x4'));var auth=require(_0x94d4('0x5'));var interaction=require(_0x94d4('0x6'));var config=require(_0x94d4('0x7'));var controller=require(_0x94d4('0x8'));router[_0x94d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x94d4('0xa')]);router[_0x94d4('0x9')](_0x94d4('0xb'),auth[_0x94d4('0xc')](),controller[_0x94d4('0xd')]);router[_0x94d4('0xe')]('/',auth['isAuthenticated'](),controller[_0x94d4('0xf')]);router[_0x94d4('0x10')]('/:id',auth[_0x94d4('0xc')](),controller[_0x94d4('0x11')]);router[_0x94d4('0x12')](_0x94d4('0xb'),auth['isAuthenticated'](),controller[_0x94d4('0x13')]);module[_0x94d4('0x14')]=router; \ No newline at end of file +var _0x3dd6=['update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','index','get','/:id','post','create','put'];(function(_0x3174ea,_0x324949){var _0x4e5e47=function(_0x53a318){while(--_0x53a318){_0x3174ea['push'](_0x3174ea['shift']());}};_0x4e5e47(++_0x324949);}(_0x3dd6,0xcf));var _0x63dd=function(_0x4af23c,_0x50e294){_0x4af23c=_0x4af23c-0x0;var _0x194b63=_0x3dd6[_0x4af23c];return _0x194b63;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x63dd('0x0'));var express=require(_0x63dd('0x1'));var router=express[_0x63dd('0x2')]();var fs_extra=require(_0x63dd('0x3'));var auth=require(_0x63dd('0x4'));var interaction=require(_0x63dd('0x5'));var config=require('../../config/environment');var controller=require(_0x63dd('0x6'));router['get']('/',auth[_0x63dd('0x7')](),controller[_0x63dd('0x8')]);router[_0x63dd('0x9')](_0x63dd('0xa'),auth[_0x63dd('0x7')](),controller['show']);router[_0x63dd('0xb')]('/',auth[_0x63dd('0x7')](),controller[_0x63dd('0xc')]);router[_0x63dd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x63dd('0xe')]);router[_0x63dd('0xf')](_0x63dd('0xa'),auth[_0x63dd('0x7')](),controller[_0x63dd('0x10')]);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 67b9f2e..48e9d9d 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 _0xf8b9=['exports','sequelize'];(function(_0x4953ac,_0x1c41fe){var _0x5b5303=function(_0x4a2143){while(--_0x4a2143){_0x4953ac['push'](_0x4953ac['shift']());}};_0x5b5303(++_0x1c41fe);}(_0xf8b9,0x1e5));var _0x9f8b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8b9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9f8b('0x0'));module[_0x9f8b('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xe240=['sequelize'];(function(_0x3ac882,_0x370ae4){var _0x505c4c=function(_0x2abd9c){while(--_0x2abd9c){_0x3ac882['push'](_0x3ac882['shift']());}};_0x505c4c(++_0x370ae4);}(_0xe240,0x197));var _0x0e24=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xe240[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0x0e24('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index f4a837d..d9dc087 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 _0x4dd4=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x28f0dd,_0x4cddd2){var _0x4f73cd=function(_0x2daf81){while(--_0x2daf81){_0x28f0dd['push'](_0x28f0dd['shift']());}};_0x4f73cd(++_0x4cddd2);}(_0x4dd4,0x1f4));var _0x44dd=function(_0x6703dd,_0x3df42d){_0x6703dd=_0x6703dd-0x0;var _0x1b62fa=_0x4dd4[_0x6703dd];return _0x1b62fa;};'use strict';var emlformat=require(_0x44dd('0x0'));var rimraf=require(_0x44dd('0x1'));var zipdir=require(_0x44dd('0x2'));var jsonpatch=require(_0x44dd('0x3'));var rp=require('request-promise');var moment=require(_0x44dd('0x4'));var BPromise=require(_0x44dd('0x5'));var Mustache=require(_0x44dd('0x6'));var util=require(_0x44dd('0x7'));var path=require(_0x44dd('0x8'));var sox=require(_0x44dd('0x9'));var csv=require(_0x44dd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44dd('0xb'));var _=require('lodash');var squel=require(_0x44dd('0xc'));var crypto=require(_0x44dd('0xd'));var jsforce=require(_0x44dd('0xe'));var deskjs=require(_0x44dd('0xf'));var toCsv=require(_0x44dd('0xa'));var querystring=require(_0x44dd('0x10'));var Papa=require(_0x44dd('0x11'));var Redis=require(_0x44dd('0x12'));var authService=require(_0x44dd('0x13'));var qs=require(_0x44dd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x44dd('0x15'))(_0x44dd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x44dd('0x17'))['db'];function respondWithStatusCode(_0x2ea2d4,_0x40b84d){_0x40b84d=_0x40b84d||0xcc;return function(_0x4ed19b){if(_0x4ed19b){return _0x2ea2d4[_0x44dd('0x18')](_0x40b84d);}return _0x2ea2d4[_0x44dd('0x19')](_0x40b84d)['end']();};}function respondWithResult(_0x7c57ff,_0x44d196){_0x44d196=_0x44d196||0xc8;return function(_0x29e78f){if(_0x29e78f){return _0x7c57ff[_0x44dd('0x19')](_0x44d196)[_0x44dd('0x1a')](_0x29e78f);}};}function respondWithFilteredResult(_0x29991e,_0x3e41f6){return function(_0x407b85){if(_0x407b85){var _0x2e6436=typeof _0x3e41f6[_0x44dd('0x1b')]==='undefined'&&typeof _0x3e41f6[_0x44dd('0x1c')]==='undefined';var _0x114504=_0x407b85['count'];var _0x246ba2=_0x2e6436?0x0:_0x3e41f6['offset'];var _0x145d04=_0x2e6436?_0x407b85[_0x44dd('0x1d')]:_0x3e41f6[_0x44dd('0x1b')]+_0x3e41f6['limit'];var _0x1aa7a0;if(_0x145d04>=_0x114504){_0x145d04=_0x114504;_0x1aa7a0=0xc8;}else{_0x1aa7a0=0xce;}_0x29991e[_0x44dd('0x19')](_0x1aa7a0);return _0x29991e[_0x44dd('0x1e')](_0x44dd('0x1f'),_0x246ba2+'-'+_0x145d04+'/'+_0x114504)[_0x44dd('0x1a')](_0x407b85);}return null;};}function patchUpdates(_0x70494){return function(_0x1f2433){try{jsonpatch[_0x44dd('0x20')](_0x1f2433,_0x70494,!![]);}catch(_0x329a24){return BPromise[_0x44dd('0x21')](_0x329a24);}return _0x1f2433[_0x44dd('0x22')]();};}function saveUpdates(_0x25d685,_0x1428e5){return function(_0xb35875){if(_0xb35875){return _0xb35875[_0x44dd('0x23')](_0x25d685)[_0x44dd('0x24')](function(_0x2e293f){return _0x2e293f;});}return null;};}function removeEntity(_0x29e5e0,_0x4ece09){return function(_0x2622d3){if(_0x2622d3){return _0x2622d3[_0x44dd('0x25')]()[_0x44dd('0x24')](function(){_0x29e5e0[_0x44dd('0x19')](0xcc)[_0x44dd('0x26')]();});}};}function handleEntityNotFound(_0x30497a,_0x432d02){return function(_0x28b29b){if(!_0x28b29b){_0x30497a['sendStatus'](0x194);}return _0x28b29b;};}function handleError(_0x3a0b36,_0x5bd691){_0x5bd691=_0x5bd691||0x1f4;return function(_0x27112d){logger['error'](_0x27112d[_0x44dd('0x27')]);if(_0x27112d[_0x44dd('0x28')]){delete _0x27112d['name'];}_0x3a0b36[_0x44dd('0x19')](_0x5bd691)['send'](_0x27112d);};}exports[_0x44dd('0x29')]=function(_0xd61862,_0x3772c3){var _0x5b4822={},_0x21471d={},_0x5507={'count':0x0,'rows':[]};var _0x54af0c=_[_0x44dd('0x2a')](db[_0x44dd('0x2b')][_0x44dd('0x2c')],function(_0x3e5c9d){return{'name':_0x3e5c9d[_0x44dd('0x2d')],'type':_0x3e5c9d['type'][_0x44dd('0x2e')]};});_0x21471d[_0x44dd('0x2f')]=_[_0x44dd('0x2a')](_0x54af0c,_0x44dd('0x28'));_0x21471d[_0x44dd('0x30')]=_[_0x44dd('0x31')](_0xd61862['query']);_0x21471d[_0x44dd('0x32')]=_['intersection'](_0x21471d[_0x44dd('0x2f')],_0x21471d[_0x44dd('0x30')]);_0x5b4822[_0x44dd('0x33')]=_[_0x44dd('0x34')](_0x21471d[_0x44dd('0x2f')],qs[_0x44dd('0x35')](_0xd61862[_0x44dd('0x30')]['fields']));_0x5b4822[_0x44dd('0x33')]=_0x5b4822[_0x44dd('0x33')][_0x44dd('0x36')]?_0x5b4822[_0x44dd('0x33')]:_0x21471d[_0x44dd('0x2f')];if(!_0xd61862[_0x44dd('0x30')][_0x44dd('0x37')]('nolimit')){_0x5b4822[_0x44dd('0x1c')]=qs[_0x44dd('0x1c')](_0xd61862['query'][_0x44dd('0x1c')]);_0x5b4822[_0x44dd('0x1b')]=qs[_0x44dd('0x1b')](_0xd61862[_0x44dd('0x30')][_0x44dd('0x1b')]);}_0x5b4822['order']=qs['sort'](_0xd61862[_0x44dd('0x30')][_0x44dd('0x38')]);_0x5b4822[_0x44dd('0x39')]=qs[_0x44dd('0x32')](_['pick'](_0xd61862[_0x44dd('0x30')],_0x21471d[_0x44dd('0x32')]),_0x54af0c);if(_0xd61862[_0x44dd('0x30')][_0x44dd('0x3a')]){_0x5b4822[_0x44dd('0x39')]=_[_0x44dd('0x3b')](_0x5b4822[_0x44dd('0x39')],{'$or':_[_0x44dd('0x2a')](_0x54af0c,function(_0x482ca4){if(_0x482ca4[_0x44dd('0x3c')]!==_0x44dd('0x3d')){var _0x1ac65a={};_0x1ac65a[_0x482ca4['name']]={'$like':'%'+_0xd61862[_0x44dd('0x30')][_0x44dd('0x3a')]+'%'};return _0x1ac65a;}})});}_0x5b4822=_[_0x44dd('0x3b')]({},_0x5b4822,_0xd61862[_0x44dd('0x3e')]);var _0x5c2251={'where':_0x5b4822[_0x44dd('0x39')]};return db['AnalyticTreeReport'][_0x44dd('0x1d')](_0x5c2251)[_0x44dd('0x24')](function(_0x124bf1){_0x5507['count']=_0x124bf1;if(_0xd61862['query'][_0x44dd('0x3f')]){_0x5b4822[_0x44dd('0x40')]=[{'all':!![]}];}return db[_0x44dd('0x2b')]['findAll'](_0x5b4822);})['then'](function(_0x5cfdd){_0x5507[_0x44dd('0x41')]=_0x5cfdd;return _0x5507;})[_0x44dd('0x24')](respondWithFilteredResult(_0x3772c3,_0x5b4822))[_0x44dd('0x42')](handleError(_0x3772c3,null));};exports[_0x44dd('0x43')]=function(_0x434970,_0x53dc16){var _0x3a40d2={'raw':!![],'where':{'id':_0x434970[_0x44dd('0x44')]['id']}},_0xab1159={};_0xab1159[_0x44dd('0x2f')]=_['keys'](db[_0x44dd('0x2b')][_0x44dd('0x2c')]);_0xab1159['query']=_[_0x44dd('0x31')](_0x434970[_0x44dd('0x30')]);_0xab1159[_0x44dd('0x32')]=_[_0x44dd('0x34')](_0xab1159[_0x44dd('0x2f')],_0xab1159[_0x44dd('0x30')]);_0x3a40d2[_0x44dd('0x33')]=_[_0x44dd('0x34')](_0xab1159[_0x44dd('0x2f')],qs[_0x44dd('0x35')](_0x434970[_0x44dd('0x30')][_0x44dd('0x35')]));_0x3a40d2[_0x44dd('0x33')]=_0x3a40d2['attributes'][_0x44dd('0x36')]?_0x3a40d2['attributes']:_0xab1159[_0x44dd('0x2f')];if(_0x434970[_0x44dd('0x30')][_0x44dd('0x3f')]){_0x3a40d2[_0x44dd('0x40')]=[{'all':!![]}];}_0x3a40d2=_[_0x44dd('0x3b')]({},_0x3a40d2,_0x434970[_0x44dd('0x3e')]);return db[_0x44dd('0x2b')][_0x44dd('0x45')](_0x3a40d2)[_0x44dd('0x24')](handleEntityNotFound(_0x53dc16,null))[_0x44dd('0x24')](respondWithResult(_0x53dc16,null))[_0x44dd('0x42')](handleError(_0x53dc16,null));};exports[_0x44dd('0x46')]=function(_0x54b43f,_0x291dfb){return db[_0x44dd('0x2b')][_0x44dd('0x46')](_0x54b43f[_0x44dd('0x47')],{})[_0x44dd('0x24')](respondWithResult(_0x291dfb,0xc9))['catch'](handleError(_0x291dfb,null));};exports[_0x44dd('0x23')]=function(_0x214c45,_0x304507){if(_0x214c45['body']['id']){delete _0x214c45[_0x44dd('0x47')]['id'];}return db[_0x44dd('0x2b')][_0x44dd('0x45')]({'where':{'id':_0x214c45['params']['id']}})[_0x44dd('0x24')](handleEntityNotFound(_0x304507,null))[_0x44dd('0x24')](saveUpdates(_0x214c45[_0x44dd('0x47')],null))['then'](respondWithResult(_0x304507,null))[_0x44dd('0x42')](handleError(_0x304507,null));};exports[_0x44dd('0x25')]=function(_0x53113f,_0x33e0c1){return db[_0x44dd('0x2b')]['find']({'where':{'id':_0x53113f[_0x44dd('0x44')]['id']}})[_0x44dd('0x24')](handleEntityNotFound(_0x33e0c1,null))[_0x44dd('0x24')](removeEntity(_0x33e0c1,null))[_0x44dd('0x42')](handleError(_0x33e0c1,null));}; \ No newline at end of file +var _0xf936=['model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','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','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x39413e,_0x18ff2){var _0x10a1de=function(_0x21d589){while(--_0x21d589){_0x39413e['push'](_0x39413e['shift']());}};_0x10a1de(++_0x18ff2);}(_0xf936,0x103));var _0x6f93=function(_0x2d6f,_0x37c891){_0x2d6f=_0x2d6f-0x0;var _0x53dc07=_0xf936[_0x2d6f];return _0x53dc07;};'use strict';var emlformat=require(_0x6f93('0x0'));var rimraf=require(_0x6f93('0x1'));var zipdir=require(_0x6f93('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f93('0x3'));var BPromise=require(_0x6f93('0x4'));var Mustache=require(_0x6f93('0x5'));var util=require('util');var path=require(_0x6f93('0x6'));var sox=require(_0x6f93('0x7'));var csv=require(_0x6f93('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f93('0x9'));var _=require('lodash');var squel=require(_0x6f93('0xa'));var crypto=require(_0x6f93('0xb'));var jsforce=require(_0x6f93('0xc'));var deskjs=require(_0x6f93('0xd'));var toCsv=require(_0x6f93('0x8'));var querystring=require('querystring');var Papa=require(_0x6f93('0xe'));var Redis=require(_0x6f93('0xf'));var authService=require(_0x6f93('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6f93('0x11'));var hardwareService=require(_0x6f93('0x12'));var logger=require(_0x6f93('0x13'))(_0x6f93('0x14'));var utils=require(_0x6f93('0x15'));var config=require(_0x6f93('0x16'));var licenseUtil=require(_0x6f93('0x17'));var db=require(_0x6f93('0x18'))['db'];function respondWithStatusCode(_0xeb1edb,_0x188b4c){_0x188b4c=_0x188b4c||0xcc;return function(_0x16b3e9){if(_0x16b3e9){return _0xeb1edb[_0x6f93('0x19')](_0x188b4c);}return _0xeb1edb[_0x6f93('0x1a')](_0x188b4c)[_0x6f93('0x1b')]();};}function respondWithResult(_0x114a22,_0x5a43c0){_0x5a43c0=_0x5a43c0||0xc8;return function(_0x155b0c){if(_0x155b0c){return _0x114a22['status'](_0x5a43c0)['json'](_0x155b0c);}};}function respondWithFilteredResult(_0x32bb31,_0x171f2c){return function(_0x1dcc7a){if(_0x1dcc7a){var _0x5179d1=typeof _0x171f2c['offset']===_0x6f93('0x1c')&&typeof _0x171f2c['limit']===_0x6f93('0x1c');var _0x5dd865=_0x1dcc7a[_0x6f93('0x1d')];var _0x436e8f=_0x5179d1?0x0:_0x171f2c[_0x6f93('0x1e')];var _0x388d29=_0x5179d1?_0x1dcc7a[_0x6f93('0x1d')]:_0x171f2c['offset']+_0x171f2c[_0x6f93('0x1f')];var _0xf5975;if(_0x388d29>=_0x5dd865){_0x388d29=_0x5dd865;_0xf5975=0xc8;}else{_0xf5975=0xce;}_0x32bb31[_0x6f93('0x1a')](_0xf5975);return _0x32bb31[_0x6f93('0x20')](_0x6f93('0x21'),_0x436e8f+'-'+_0x388d29+'/'+_0x5dd865)['json'](_0x1dcc7a);}return null;};}function patchUpdates(_0xe3276c){return function(_0x6c0adf){try{jsonpatch[_0x6f93('0x22')](_0x6c0adf,_0xe3276c,!![]);}catch(_0x5e6a97){return BPromise[_0x6f93('0x23')](_0x5e6a97);}return _0x6c0adf[_0x6f93('0x24')]();};}function saveUpdates(_0x40af83,_0x46e8a7){return function(_0x9f9812){if(_0x9f9812){return _0x9f9812['update'](_0x40af83)[_0x6f93('0x25')](function(_0x5d7308){return _0x5d7308;});}return null;};}function removeEntity(_0x503d52,_0x3e6aa4){return function(_0x431561){if(_0x431561){return _0x431561[_0x6f93('0x26')]()[_0x6f93('0x25')](function(){_0x503d52[_0x6f93('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4127bc,_0x3d6c1e){return function(_0x18b79c){if(!_0x18b79c){_0x4127bc[_0x6f93('0x19')](0x194);}return _0x18b79c;};}function handleError(_0x33ae38,_0x16519d){_0x16519d=_0x16519d||0x1f4;return function(_0x5bfd8e){logger[_0x6f93('0x27')](_0x5bfd8e[_0x6f93('0x28')]);if(_0x5bfd8e[_0x6f93('0x29')]){delete _0x5bfd8e[_0x6f93('0x29')];}_0x33ae38[_0x6f93('0x1a')](_0x16519d)[_0x6f93('0x2a')](_0x5bfd8e);};}exports[_0x6f93('0x2b')]=function(_0x431706,_0x26e81a){var _0x5cbf9f={},_0x31748a={},_0x363333={'count':0x0,'rows':[]};var _0x424f09=_[_0x6f93('0x2c')](db['AnalyticTreeReport'][_0x6f93('0x2d')],function(_0xe85465){return{'name':_0xe85465[_0x6f93('0x2e')],'type':_0xe85465[_0x6f93('0x2f')][_0x6f93('0x30')]};});_0x31748a['model']=_[_0x6f93('0x2c')](_0x424f09,_0x6f93('0x29'));_0x31748a[_0x6f93('0x31')]=_[_0x6f93('0x32')](_0x431706[_0x6f93('0x31')]);_0x31748a[_0x6f93('0x33')]=_[_0x6f93('0x34')](_0x31748a[_0x6f93('0x35')],_0x31748a[_0x6f93('0x31')]);_0x5cbf9f['attributes']=_['intersection'](_0x31748a['model'],qs['fields'](_0x431706[_0x6f93('0x31')]['fields']));_0x5cbf9f[_0x6f93('0x36')]=_0x5cbf9f[_0x6f93('0x36')][_0x6f93('0x37')]?_0x5cbf9f['attributes']:_0x31748a['model'];if(!_0x431706[_0x6f93('0x31')][_0x6f93('0x38')](_0x6f93('0x39'))){_0x5cbf9f[_0x6f93('0x1f')]=qs[_0x6f93('0x1f')](_0x431706['query'][_0x6f93('0x1f')]);_0x5cbf9f[_0x6f93('0x1e')]=qs[_0x6f93('0x1e')](_0x431706[_0x6f93('0x31')][_0x6f93('0x1e')]);}_0x5cbf9f[_0x6f93('0x3a')]=qs['sort'](_0x431706[_0x6f93('0x31')][_0x6f93('0x3b')]);_0x5cbf9f[_0x6f93('0x3c')]=qs['filters'](_['pick'](_0x431706[_0x6f93('0x31')],_0x31748a[_0x6f93('0x33')]),_0x424f09);if(_0x431706[_0x6f93('0x31')][_0x6f93('0x3d')]){_0x5cbf9f[_0x6f93('0x3c')]=_['merge'](_0x5cbf9f[_0x6f93('0x3c')],{'$or':_[_0x6f93('0x2c')](_0x424f09,function(_0x2473ac){if(_0x2473ac[_0x6f93('0x2f')]!==_0x6f93('0x3e')){var _0x4b18bd={};_0x4b18bd[_0x2473ac[_0x6f93('0x29')]]={'$like':'%'+_0x431706[_0x6f93('0x31')]['filter']+'%'};return _0x4b18bd;}})});}_0x5cbf9f=_[_0x6f93('0x3f')]({},_0x5cbf9f,_0x431706[_0x6f93('0x40')]);var _0x2a936f={'where':_0x5cbf9f['where']};return db[_0x6f93('0x41')][_0x6f93('0x1d')](_0x2a936f)[_0x6f93('0x25')](function(_0x4f4470){_0x363333['count']=_0x4f4470;if(_0x431706[_0x6f93('0x31')][_0x6f93('0x42')]){_0x5cbf9f[_0x6f93('0x43')]=[{'all':!![]}];}return db[_0x6f93('0x41')][_0x6f93('0x44')](_0x5cbf9f);})[_0x6f93('0x25')](function(_0x513ba8){_0x363333[_0x6f93('0x45')]=_0x513ba8;return _0x363333;})[_0x6f93('0x25')](respondWithFilteredResult(_0x26e81a,_0x5cbf9f))[_0x6f93('0x46')](handleError(_0x26e81a,null));};exports[_0x6f93('0x47')]=function(_0x5026ba,_0x55b3c2){var _0x27068d={'raw':!![],'where':{'id':_0x5026ba[_0x6f93('0x48')]['id']}},_0x3d2abe={};_0x3d2abe[_0x6f93('0x35')]=_[_0x6f93('0x32')](db[_0x6f93('0x41')][_0x6f93('0x2d')]);_0x3d2abe[_0x6f93('0x31')]=_[_0x6f93('0x32')](_0x5026ba['query']);_0x3d2abe[_0x6f93('0x33')]=_[_0x6f93('0x34')](_0x3d2abe[_0x6f93('0x35')],_0x3d2abe[_0x6f93('0x31')]);_0x27068d[_0x6f93('0x36')]=_[_0x6f93('0x34')](_0x3d2abe[_0x6f93('0x35')],qs[_0x6f93('0x49')](_0x5026ba[_0x6f93('0x31')][_0x6f93('0x49')]));_0x27068d[_0x6f93('0x36')]=_0x27068d['attributes'][_0x6f93('0x37')]?_0x27068d['attributes']:_0x3d2abe[_0x6f93('0x35')];if(_0x5026ba[_0x6f93('0x31')]['includeAll']){_0x27068d[_0x6f93('0x43')]=[{'all':!![]}];}_0x27068d=_[_0x6f93('0x3f')]({},_0x27068d,_0x5026ba[_0x6f93('0x40')]);return db[_0x6f93('0x41')][_0x6f93('0x4a')](_0x27068d)['then'](handleEntityNotFound(_0x55b3c2,null))['then'](respondWithResult(_0x55b3c2,null))['catch'](handleError(_0x55b3c2,null));};exports[_0x6f93('0x4b')]=function(_0x215fa0,_0x4c53a9){return db['AnalyticTreeReport']['create'](_0x215fa0[_0x6f93('0x4c')],{})[_0x6f93('0x25')](respondWithResult(_0x4c53a9,0xc9))[_0x6f93('0x46')](handleError(_0x4c53a9,null));};exports[_0x6f93('0x4d')]=function(_0x405eb7,_0x1bab80){if(_0x405eb7[_0x6f93('0x4c')]['id']){delete _0x405eb7[_0x6f93('0x4c')]['id'];}return db[_0x6f93('0x41')][_0x6f93('0x4a')]({'where':{'id':_0x405eb7[_0x6f93('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bab80,null))[_0x6f93('0x25')](saveUpdates(_0x405eb7['body'],null))[_0x6f93('0x25')](respondWithResult(_0x1bab80,null))[_0x6f93('0x46')](handleError(_0x1bab80,null));};exports['destroy']=function(_0x160d93,_0x12cc82){return db[_0x6f93('0x41')][_0x6f93('0x4a')]({'where':{'id':_0x160d93['params']['id']}})[_0x6f93('0x25')](handleEntityNotFound(_0x12cc82,null))[_0x6f93('0x25')](removeEntity(_0x12cc82,null))['catch'](handleError(_0x12cc82,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index abbd65a..9141d97 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 _0xb02d=['rimraf','./analyticTreeReport.attributes','define','AnalyticTreeReport','lodash','util','moment','request-promise','path'];(function(_0x3a9e6d,_0x29a891){var _0x4478c0=function(_0x496ff8){while(--_0x496ff8){_0x3a9e6d['push'](_0x3a9e6d['shift']());}};_0x4478c0(++_0x29a891);}(_0xb02d,0x17e));var _0xdb02=function(_0x2623d3,_0x3b0cfc){_0x2623d3=_0x2623d3-0x0;var _0x20a537=_0xb02d[_0x2623d3];return _0x20a537;};'use strict';var _=require(_0xdb02('0x0'));var util=require(_0xdb02('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdb02('0x2'));var BPromise=require('bluebird');var rp=require(_0xdb02('0x3'));var fs=require('fs');var path=require(_0xdb02('0x4'));var rimraf=require(_0xdb02('0x5'));var config=require('../../config/environment');var attributes=require(_0xdb02('0x6'));module['exports']=function(_0x5432d7,_0x505c65){return _0x5432d7[_0xdb02('0x7')](_0xdb02('0x8'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a82=['AnalyticTreeReport','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0xf6f354,_0xe6686c){var _0x416f74=function(_0x1759fe){while(--_0x1759fe){_0xf6f354['push'](_0xf6f354['shift']());}};_0x416f74(++_0xe6686c);}(_0x5a82,0xd3));var _0x25a8=function(_0x23178e,_0x5ae6b4){_0x23178e=_0x23178e-0x0;var _0x12039a=_0x5a82[_0x23178e];return _0x12039a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x25a8('0x0'))(_0x25a8('0x1'));var moment=require('moment');var BPromise=require(_0x25a8('0x2'));var rp=require(_0x25a8('0x3'));var fs=require('fs');var path=require(_0x25a8('0x4'));var rimraf=require(_0x25a8('0x5'));var config=require(_0x25a8('0x6'));var attributes=require(_0x25a8('0x7'));module[_0x25a8('0x8')]=function(_0x37ad44,_0x52ce2c){return _0x37ad44['define'](_0x25a8('0x9'),attributes,{'tableName':'analytics_report_trees','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 76e597d..ed074e1 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x32e941,_0x5ea37b){var _0x22b925=function(_0x1ac467){while(--_0x1ac467){_0x32e941['push'](_0x32e941['shift']());}};_0x22b925(++_0x5ea37b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x592331,_0x283232){_0x592331=_0x592331-0x0;var _0x1c8bba=_0x7a54[_0x592331];return _0x1c8bba;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a950933..e26f270 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 _0xb51f=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x180ae1,_0x920602){var _0x171c5b=function(_0x2b4c7f){while(--_0x2b4c7f){_0x180ae1['push'](_0x180ae1['shift']());}};_0x171c5b(++_0x920602);}(_0xb51f,0x86));var _0xfb51=function(_0x5578ed,_0xb4bcc9){_0x5578ed=_0x5578ed-0x0;var _0x1bdb67=_0xb51f[_0x5578ed];return _0x1bdb67;};'use strict';var multer=require(_0xfb51('0x0'));var util=require(_0xfb51('0x1'));var path=require(_0xfb51('0x2'));var timeout=require(_0xfb51('0x3'));var express=require(_0xfb51('0x4'));var router=express[_0xfb51('0x5')]();var fs_extra=require(_0xfb51('0x6'));var auth=require(_0xfb51('0x7'));var interaction=require(_0xfb51('0x8'));var config=require(_0xfb51('0x9'));var controller=require('./analyticTreeReport.controller');router[_0xfb51('0xa')]('/',auth[_0xfb51('0xb')](),controller[_0xfb51('0xc')]);router[_0xfb51('0xa')](_0xfb51('0xd'),auth['isAuthenticated'](),controller[_0xfb51('0xe')]);router[_0xfb51('0xf')]('/',auth[_0xfb51('0xb')](),controller[_0xfb51('0x10')]);router[_0xfb51('0x11')](_0xfb51('0xd'),auth['isAuthenticated'](),controller[_0xfb51('0x12')]);router[_0xfb51('0x13')](_0xfb51('0xd'),auth[_0xfb51('0xb')](),controller['destroy']);module[_0xfb51('0x14')]=router; \ No newline at end of file +var _0x24a3=['create','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2a4eb7,_0x24fa94){var _0x1be8a0=function(_0x2b6970){while(--_0x2b6970){_0x2a4eb7['push'](_0x2a4eb7['shift']());}};_0x1be8a0(++_0x24fa94);}(_0x24a3,0x1df));var _0x324a=function(_0x2842c8,_0x24aa17){_0x2842c8=_0x2842c8-0x0;var _0x418768=_0x24a3[_0x2842c8];return _0x418768;};'use strict';var multer=require(_0x324a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x324a('0x1'));var express=require(_0x324a('0x2'));var router=express[_0x324a('0x3')]();var fs_extra=require(_0x324a('0x4'));var auth=require(_0x324a('0x5'));var interaction=require(_0x324a('0x6'));var config=require(_0x324a('0x7'));var controller=require(_0x324a('0x8'));router[_0x324a('0x9')]('/',auth[_0x324a('0xa')](),controller[_0x324a('0xb')]);router[_0x324a('0x9')](_0x324a('0xc'),auth[_0x324a('0xa')](),controller[_0x324a('0xd')]);router[_0x324a('0xe')]('/',auth[_0x324a('0xa')](),controller[_0x324a('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x324a('0x10')]);router[_0x324a('0x11')](_0x324a('0xc'),auth[_0x324a('0xa')](),controller[_0x324a('0x12')]);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 68a666d..39807da 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 _0x8f7d=['exports','STRING','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x2ccdc6,_0x3ef64f){_0x2ccdc6=_0x2ccdc6-0x0;var _0x2c6991=_0x8f7d[_0x2ccdc6];return _0x2c6991;};'use strict';var Sequelize=require(_0xd8f7('0x0'));module[_0xd8f7('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xd8f7('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x40ca=['STRING','sequelize'];(function(_0x3456a4,_0x23e94c){var _0x5d8c0b=function(_0x23446b){while(--_0x23446b){_0x3456a4['push'](_0x3456a4['shift']());}};_0x5d8c0b(++_0x23e94c);}(_0x40ca,0x1a1));var _0xa40c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x40ca[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xa40c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xa40c('0x1')]},'type':{'type':Sequelize[_0xa40c('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 4ac3c34..bf1ccc9 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 _0xa3fc=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','include','options','find','clone','get','omit','body','createdAt','updatedAt','create','file','originalname','download','findOne','ChatOfflineMessageId','join','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','Attachment','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xa3fc,0x187));var _0xca3f=function(_0x4b47b2,_0x20185f){_0x4b47b2=_0x4b47b2-0x0;var _0x49574b=_0xa3fc[_0x4b47b2];return _0x49574b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca3f('0x0'));var zipdir=require(_0xca3f('0x1'));var jsonpatch=require(_0xca3f('0x2'));var rp=require(_0xca3f('0x3'));var moment=require(_0xca3f('0x4'));var BPromise=require(_0xca3f('0x5'));var Mustache=require(_0xca3f('0x6'));var util=require(_0xca3f('0x7'));var path=require(_0xca3f('0x8'));var sox=require(_0xca3f('0x9'));var csv=require(_0xca3f('0xa'));var ejs=require(_0xca3f('0xb'));var fs=require('fs');var fs_extra=require(_0xca3f('0xc'));var _=require(_0xca3f('0xd'));var squel=require(_0xca3f('0xe'));var crypto=require(_0xca3f('0xf'));var jsforce=require(_0xca3f('0x10'));var deskjs=require(_0xca3f('0x11'));var toCsv=require('to-csv');var querystring=require(_0xca3f('0x12'));var Papa=require(_0xca3f('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca3f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca3f('0x15'));var logger=require(_0xca3f('0x16'))(_0xca3f('0x17'));var utils=require(_0xca3f('0x18'));var config=require(_0xca3f('0x19'));var licenseUtil=require(_0xca3f('0x1a'));var db=require(_0xca3f('0x1b'))['db'];function respondWithStatusCode(_0x2b21e8,_0x1c624b){_0x1c624b=_0x1c624b||0xcc;return function(_0x2cc4f0){if(_0x2cc4f0){return _0x2b21e8['sendStatus'](_0x1c624b);}return _0x2b21e8[_0xca3f('0x1c')](_0x1c624b)['end']();};}function respondWithResult(_0x435637,_0x4ff9ef){_0x4ff9ef=_0x4ff9ef||0xc8;return function(_0x581421){if(_0x581421){return _0x435637[_0xca3f('0x1c')](_0x4ff9ef)[_0xca3f('0x1d')](_0x581421);}};}function respondWithFilteredResult(_0x40af1b,_0x45c405){return function(_0x294463){if(_0x294463){var _0x533cc3=typeof _0x45c405[_0xca3f('0x1e')]===_0xca3f('0x1f')&&typeof _0x45c405[_0xca3f('0x20')]==='undefined';var _0x53e62d=_0x294463[_0xca3f('0x21')];var _0x5723ba=_0x533cc3?0x0:_0x45c405[_0xca3f('0x1e')];var _0x2b6c03=_0x533cc3?_0x294463[_0xca3f('0x21')]:_0x45c405['offset']+_0x45c405['limit'];var _0xee2898;if(_0x2b6c03>=_0x53e62d){_0x2b6c03=_0x53e62d;_0xee2898=0xc8;}else{_0xee2898=0xce;}_0x40af1b[_0xca3f('0x1c')](_0xee2898);return _0x40af1b[_0xca3f('0x22')](_0xca3f('0x23'),_0x5723ba+'-'+_0x2b6c03+'/'+_0x53e62d)[_0xca3f('0x1d')](_0x294463);}return null;};}function patchUpdates(_0x401215){return function(_0x45a9e9){try{jsonpatch['apply'](_0x45a9e9,_0x401215,!![]);}catch(_0x36cbbe){return BPromise['reject'](_0x36cbbe);}return _0x45a9e9[_0xca3f('0x24')]();};}function saveUpdates(_0x4de96,_0x31fdc8){return function(_0x2734b1){if(_0x2734b1){return _0x2734b1[_0xca3f('0x25')](_0x4de96)[_0xca3f('0x26')](function(_0x3e6a4c){return _0x3e6a4c;});}return null;};}function removeEntity(_0x360f3b,_0x3005c9){return function(_0x41babd){if(_0x41babd){return _0x41babd[_0xca3f('0x27')]()[_0xca3f('0x26')](function(){_0x360f3b[_0xca3f('0x1c')](0xcc)[_0xca3f('0x28')]();});}};}function handleEntityNotFound(_0x9a6050,_0x514728){return function(_0x532c01){if(!_0x532c01){_0x9a6050[_0xca3f('0x29')](0x194);}return _0x532c01;};}function handleError(_0x160b40,_0x88acdb){_0x88acdb=_0x88acdb||0x1f4;return function(_0x254d1d){logger[_0xca3f('0x2a')](_0x254d1d[_0xca3f('0x2b')]);if(_0x254d1d['name']){delete _0x254d1d[_0xca3f('0x2c')];}_0x160b40['status'](_0x88acdb)['send'](_0x254d1d);};}exports[_0xca3f('0x2d')]=function(_0x57f3e4,_0x207145){var _0x3ae11f={},_0x33bc1b={},_0x303563={'count':0x0,'rows':[]};var _0x1e84f4=_[_0xca3f('0x2e')](db[_0xca3f('0x2f')][_0xca3f('0x30')],function(_0x128a87){return{'name':_0x128a87[_0xca3f('0x31')],'type':_0x128a87[_0xca3f('0x32')][_0xca3f('0x33')]};});_0x33bc1b['model']=_['map'](_0x1e84f4,_0xca3f('0x2c'));_0x33bc1b['query']=_['keys'](_0x57f3e4[_0xca3f('0x34')]);_0x33bc1b[_0xca3f('0x35')]=_[_0xca3f('0x36')](_0x33bc1b[_0xca3f('0x37')],_0x33bc1b[_0xca3f('0x34')]);_0x3ae11f[_0xca3f('0x38')]=_[_0xca3f('0x36')](_0x33bc1b['model'],qs[_0xca3f('0x39')](_0x57f3e4[_0xca3f('0x34')][_0xca3f('0x39')]));_0x3ae11f['attributes']=_0x3ae11f[_0xca3f('0x38')][_0xca3f('0x3a')]?_0x3ae11f[_0xca3f('0x38')]:_0x33bc1b[_0xca3f('0x37')];if(!_0x57f3e4[_0xca3f('0x34')][_0xca3f('0x3b')](_0xca3f('0x3c'))){_0x3ae11f[_0xca3f('0x20')]=qs['limit'](_0x57f3e4[_0xca3f('0x34')][_0xca3f('0x20')]);_0x3ae11f[_0xca3f('0x1e')]=qs[_0xca3f('0x1e')](_0x57f3e4[_0xca3f('0x34')]['offset']);}_0x3ae11f[_0xca3f('0x3d')]=qs[_0xca3f('0x3e')](_0x57f3e4[_0xca3f('0x34')][_0xca3f('0x3e')]);_0x3ae11f[_0xca3f('0x3f')]=qs[_0xca3f('0x35')](_[_0xca3f('0x40')](_0x57f3e4[_0xca3f('0x34')],_0x33bc1b[_0xca3f('0x35')]),_0x1e84f4);if(_0x57f3e4[_0xca3f('0x34')][_0xca3f('0x41')]){_0x3ae11f[_0xca3f('0x3f')]=_[_0xca3f('0x42')](_0x3ae11f[_0xca3f('0x3f')],{'$or':_[_0xca3f('0x2e')](_0x1e84f4,function(_0x588fbd){if(_0x588fbd['type']!==_0xca3f('0x43')){var _0x4f1a6d={};_0x4f1a6d[_0x588fbd[_0xca3f('0x2c')]]={'$like':'%'+_0x57f3e4[_0xca3f('0x34')][_0xca3f('0x41')]+'%'};return _0x4f1a6d;}})});}_0x3ae11f=_['merge']({},_0x3ae11f,_0x57f3e4['options']);var _0x28c32e={'where':_0x3ae11f[_0xca3f('0x3f')]};return db[_0xca3f('0x2f')][_0xca3f('0x21')](_0x28c32e)[_0xca3f('0x26')](function(_0x49d597){_0x303563[_0xca3f('0x21')]=_0x49d597;if(_0x57f3e4[_0xca3f('0x34')][_0xca3f('0x44')]){_0x3ae11f['include']=[{'all':!![]}];}return db[_0xca3f('0x2f')][_0xca3f('0x45')](_0x3ae11f);})[_0xca3f('0x26')](function(_0x4cb430){_0x303563[_0xca3f('0x46')]=_0x4cb430;return _0x303563;})[_0xca3f('0x26')](respondWithFilteredResult(_0x207145,_0x3ae11f))[_0xca3f('0x47')](handleError(_0x207145,null));};exports['show']=function(_0x3e9f48,_0x1a91f3){var _0x2dc8dc={'raw':!![],'where':{'id':_0x3e9f48[_0xca3f('0x48')]['id']}},_0x1b897c={};_0x1b897c[_0xca3f('0x37')]=_[_0xca3f('0x49')](db['Attachment'][_0xca3f('0x30')]);_0x1b897c[_0xca3f('0x34')]=_[_0xca3f('0x49')](_0x3e9f48[_0xca3f('0x34')]);_0x1b897c[_0xca3f('0x35')]=_['intersection'](_0x1b897c[_0xca3f('0x37')],_0x1b897c[_0xca3f('0x34')]);_0x2dc8dc[_0xca3f('0x38')]=_['intersection'](_0x1b897c[_0xca3f('0x37')],qs[_0xca3f('0x39')](_0x3e9f48[_0xca3f('0x34')][_0xca3f('0x39')]));_0x2dc8dc['attributes']=_0x2dc8dc[_0xca3f('0x38')]['length']?_0x2dc8dc[_0xca3f('0x38')]:_0x1b897c[_0xca3f('0x37')];if(_0x3e9f48['query'][_0xca3f('0x44')]){_0x2dc8dc[_0xca3f('0x4a')]=[{'all':!![]}];}_0x2dc8dc=_[_0xca3f('0x42')]({},_0x2dc8dc,_0x3e9f48[_0xca3f('0x4b')]);return db['Attachment'][_0xca3f('0x4c')](_0x2dc8dc)[_0xca3f('0x26')](handleEntityNotFound(_0x1a91f3,null))['then'](respondWithResult(_0x1a91f3,null))[_0xca3f('0x47')](handleError(_0x1a91f3,null));};exports[_0xca3f('0x4d')]=function(_0x2f22e2,_0x27bc5c){var _0x14f68d={'where':{'id':_0x2f22e2[_0xca3f('0x48')]['id']}},_0x54b1b4={};_0x54b1b4[_0xca3f('0x37')]=_[_0xca3f('0x49')](db[_0xca3f('0x2f')][_0xca3f('0x30')]);_0x14f68d['attributes']=_[_0xca3f('0x36')](_0x54b1b4[_0xca3f('0x37')],qs[_0xca3f('0x39')](_0x2f22e2['query'][_0xca3f('0x39')]));_0x14f68d[_0xca3f('0x38')]=_0x14f68d[_0xca3f('0x38')][_0xca3f('0x3a')]?_0x14f68d['attributes']:_0x54b1b4[_0xca3f('0x37')];if(_0x2f22e2[_0xca3f('0x34')][_0xca3f('0x44')]){_0x14f68d[_0xca3f('0x4a')]=[{'all':!![]}];}_0x14f68d=_[_0xca3f('0x42')]({},_0x14f68d,_0x2f22e2[_0xca3f('0x4b')]);return db['Attachment'][_0xca3f('0x4c')](_0x14f68d)[_0xca3f('0x26')](handleEntityNotFound(_0x27bc5c,null))[_0xca3f('0x26')](function(_0x3f8dfb){if(_0x3f8dfb){var _0x4967f1=_0x3f8dfb[_0xca3f('0x4e')]({'plain':!![]});_0x4967f1=qs['omit'](_0x4967f1,['id','createdAt','updatedAt']);_0x2f22e2['body']=_[_0xca3f('0x4f')](_0x2f22e2[_0xca3f('0x50')],['id',_0xca3f('0x51'),_0xca3f('0x52')]);return db[_0xca3f('0x2f')]['create'](_[_0xca3f('0x42')](_0x4967f1,_0x2f22e2[_0xca3f('0x50')]),{'include':_0x2f22e2[_0xca3f('0x34')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x27bc5c,0xc9))['catch'](handleError(_0x27bc5c,null));};exports[_0xca3f('0x25')]=function(_0x51142b,_0x16bca1){if(_0x51142b[_0xca3f('0x50')]['id']){delete _0x51142b['body']['id'];}return db[_0xca3f('0x2f')]['find']({'where':{'id':_0x51142b[_0xca3f('0x48')]['id']}})[_0xca3f('0x26')](handleEntityNotFound(_0x16bca1,null))['then'](saveUpdates(_0x51142b[_0xca3f('0x50')],null))['then'](respondWithResult(_0x16bca1,null))[_0xca3f('0x47')](handleError(_0x16bca1,null));};exports[_0xca3f('0x27')]=function(_0x568b58,_0x4b4f2c){return db[_0xca3f('0x2f')][_0xca3f('0x4c')]({'where':{'id':_0x568b58[_0xca3f('0x48')]['id']}})[_0xca3f('0x26')](handleEntityNotFound(_0x4b4f2c,null))[_0xca3f('0x26')](removeEntity(_0x4b4f2c,null))[_0xca3f('0x47')](handleError(_0x4b4f2c,null));};exports[_0xca3f('0x53')]=function(_0x141ded,_0x7a7490,_0x27f6d7){_0x141ded[_0xca3f('0x50')][_0xca3f('0x2c')]=_0x141ded[_0xca3f('0x54')][_0xca3f('0x55')];_0x141ded['body']['basename']=_0x141ded['file']['filename'];_0x141ded[_0xca3f('0x50')][_0xca3f('0x32')]=_0x141ded['file']['mimetype'];return db['Attachment'][_0xca3f('0x53')](_0x141ded[_0xca3f('0x50')])[_0xca3f('0x26')](respondWithResult(_0x7a7490,0xc9))['catch'](handleError(_0x7a7490,null));};exports[_0xca3f('0x56')]=function(_0x5d3f2f,_0x3e3bb8,_0x15c9b6){return db[_0xca3f('0x2f')][_0xca3f('0x57')]({'where':{'id':_0x5d3f2f['params']['id']},'raw':!![]})[_0xca3f('0x26')](handleEntityNotFound(_0x3e3bb8,null))[_0xca3f('0x26')](function(_0x48bde4){if(_0x48bde4){var _0x29ac05=_0x48bde4[_0xca3f('0x58')]!==null;var _0x32412b=path[_0xca3f('0x59')](config['root'],'server/files/attachments/');if(_0x29ac05){_0x32412b=path[_0xca3f('0x59')](_0x32412b,'offline-chat/');}var _0x227787=path[_0xca3f('0x59')](_0x32412b,_0x48bde4['basename']);return _0x3e3bb8[_0xca3f('0x56')](_0x227787);}})[_0xca3f('0x47')](handleError(_0x3e3bb8,null));}; \ No newline at end of file +var _0x1e02=['query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','Attachment','includeAll','include','findAll','catch','show','keys','find','clone','params','omit','createdAt','updatedAt','body','create','destroy','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','error','stack','name','send','map','rawAttributes','type','key'];(function(_0x520407,_0x24a4ce){var _0x45f7a1=function(_0x57ea00){while(--_0x57ea00){_0x520407['push'](_0x520407['shift']());}};_0x45f7a1(++_0x24a4ce);}(_0x1e02,0x85));var _0x21e0=function(_0x3889e3,_0x3ba538){_0x3889e3=_0x3889e3-0x0;var _0x5f0a22=_0x1e02[_0x3889e3];return _0x5f0a22;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x21e0('0x0'));var jsonpatch=require(_0x21e0('0x1'));var rp=require(_0x21e0('0x2'));var moment=require(_0x21e0('0x3'));var BPromise=require(_0x21e0('0x4'));var Mustache=require(_0x21e0('0x5'));var util=require(_0x21e0('0x6'));var path=require(_0x21e0('0x7'));var sox=require(_0x21e0('0x8'));var csv=require('to-csv');var ejs=require(_0x21e0('0x9'));var fs=require('fs');var fs_extra=require(_0x21e0('0xa'));var _=require(_0x21e0('0xb'));var squel=require(_0x21e0('0xc'));var crypto=require(_0x21e0('0xd'));var jsforce=require(_0x21e0('0xe'));var deskjs=require(_0x21e0('0xf'));var toCsv=require(_0x21e0('0x10'));var querystring=require('querystring');var Papa=require(_0x21e0('0x11'));var Redis=require(_0x21e0('0x12'));var authService=require(_0x21e0('0x13'));var qs=require(_0x21e0('0x14'));var as=require(_0x21e0('0x15'));var hardwareService=require(_0x21e0('0x16'));var logger=require(_0x21e0('0x17'))(_0x21e0('0x18'));var utils=require(_0x21e0('0x19'));var config=require(_0x21e0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x21e0('0x1b'))['db'];function respondWithStatusCode(_0x171e9b,_0x3510f0){_0x3510f0=_0x3510f0||0xcc;return function(_0x1f9663){if(_0x1f9663){return _0x171e9b[_0x21e0('0x1c')](_0x3510f0);}return _0x171e9b[_0x21e0('0x1d')](_0x3510f0)[_0x21e0('0x1e')]();};}function respondWithResult(_0x30044f,_0x3da023){_0x3da023=_0x3da023||0xc8;return function(_0x87634c){if(_0x87634c){return _0x30044f[_0x21e0('0x1d')](_0x3da023)[_0x21e0('0x1f')](_0x87634c);}};}function respondWithFilteredResult(_0x376c83,_0x1f0555){return function(_0x3ce049){if(_0x3ce049){var _0x5e25bf=typeof _0x1f0555[_0x21e0('0x20')]===_0x21e0('0x21')&&typeof _0x1f0555['limit']===_0x21e0('0x21');var _0x41d268=_0x3ce049[_0x21e0('0x22')];var _0x1225d5=_0x5e25bf?0x0:_0x1f0555[_0x21e0('0x20')];var _0x507a2c=_0x5e25bf?_0x3ce049[_0x21e0('0x22')]:_0x1f0555['offset']+_0x1f0555[_0x21e0('0x23')];var _0x5c63f5;if(_0x507a2c>=_0x41d268){_0x507a2c=_0x41d268;_0x5c63f5=0xc8;}else{_0x5c63f5=0xce;}_0x376c83['status'](_0x5c63f5);return _0x376c83[_0x21e0('0x24')]('Content-Range',_0x1225d5+'-'+_0x507a2c+'/'+_0x41d268)[_0x21e0('0x1f')](_0x3ce049);}return null;};}function patchUpdates(_0x1e9c1f){return function(_0xb29dd1){try{jsonpatch[_0x21e0('0x25')](_0xb29dd1,_0x1e9c1f,!![]);}catch(_0x211f42){return BPromise[_0x21e0('0x26')](_0x211f42);}return _0xb29dd1[_0x21e0('0x27')]();};}function saveUpdates(_0x20a419,_0x1fa516){return function(_0x5eb5da){if(_0x5eb5da){return _0x5eb5da['update'](_0x20a419)[_0x21e0('0x28')](function(_0x4a01b9){return _0x4a01b9;});}return null;};}function removeEntity(_0x5cbac1,_0x2ed7fa){return function(_0x2b0f9a){if(_0x2b0f9a){return _0x2b0f9a['destroy']()[_0x21e0('0x28')](function(){_0x5cbac1[_0x21e0('0x1d')](0xcc)[_0x21e0('0x1e')]();});}};}function handleEntityNotFound(_0x12cb89,_0x1f92c3){return function(_0xf20223){if(!_0xf20223){_0x12cb89[_0x21e0('0x1c')](0x194);}return _0xf20223;};}function handleError(_0x5c3a10,_0x3dba72){_0x3dba72=_0x3dba72||0x1f4;return function(_0x4fd810){logger[_0x21e0('0x29')](_0x4fd810[_0x21e0('0x2a')]);if(_0x4fd810['name']){delete _0x4fd810[_0x21e0('0x2b')];}_0x5c3a10[_0x21e0('0x1d')](_0x3dba72)[_0x21e0('0x2c')](_0x4fd810);};}exports['index']=function(_0x587384,_0x2c9e80){var _0x5e4d11={},_0xab9858={},_0x3ccedf={'count':0x0,'rows':[]};var _0x32d2b5=_[_0x21e0('0x2d')](db['Attachment'][_0x21e0('0x2e')],function(_0x40a01b){return{'name':_0x40a01b['fieldName'],'type':_0x40a01b[_0x21e0('0x2f')][_0x21e0('0x30')]};});_0xab9858['model']=_[_0x21e0('0x2d')](_0x32d2b5,_0x21e0('0x2b'));_0xab9858[_0x21e0('0x31')]=_['keys'](_0x587384[_0x21e0('0x31')]);_0xab9858['filters']=_['intersection'](_0xab9858[_0x21e0('0x32')],_0xab9858[_0x21e0('0x31')]);_0x5e4d11[_0x21e0('0x33')]=_[_0x21e0('0x34')](_0xab9858['model'],qs[_0x21e0('0x35')](_0x587384['query'][_0x21e0('0x35')]));_0x5e4d11[_0x21e0('0x33')]=_0x5e4d11[_0x21e0('0x33')][_0x21e0('0x36')]?_0x5e4d11[_0x21e0('0x33')]:_0xab9858[_0x21e0('0x32')];if(!_0x587384[_0x21e0('0x31')][_0x21e0('0x37')](_0x21e0('0x38'))){_0x5e4d11['limit']=qs[_0x21e0('0x23')](_0x587384['query'][_0x21e0('0x23')]);_0x5e4d11['offset']=qs[_0x21e0('0x20')](_0x587384['query']['offset']);}_0x5e4d11['order']=qs[_0x21e0('0x39')](_0x587384['query'][_0x21e0('0x39')]);_0x5e4d11[_0x21e0('0x3a')]=qs[_0x21e0('0x3b')](_[_0x21e0('0x3c')](_0x587384[_0x21e0('0x31')],_0xab9858[_0x21e0('0x3b')]),_0x32d2b5);if(_0x587384[_0x21e0('0x31')][_0x21e0('0x3d')]){_0x5e4d11[_0x21e0('0x3a')]=_[_0x21e0('0x3e')](_0x5e4d11[_0x21e0('0x3a')],{'$or':_[_0x21e0('0x2d')](_0x32d2b5,function(_0x4871bd){if(_0x4871bd[_0x21e0('0x2f')]!==_0x21e0('0x3f')){var _0x2ecf72={};_0x2ecf72[_0x4871bd[_0x21e0('0x2b')]]={'$like':'%'+_0x587384[_0x21e0('0x31')][_0x21e0('0x3d')]+'%'};return _0x2ecf72;}})});}_0x5e4d11=_[_0x21e0('0x3e')]({},_0x5e4d11,_0x587384[_0x21e0('0x40')]);var _0x2d671b={'where':_0x5e4d11['where']};return db[_0x21e0('0x41')][_0x21e0('0x22')](_0x2d671b)[_0x21e0('0x28')](function(_0x1d1ef0){_0x3ccedf[_0x21e0('0x22')]=_0x1d1ef0;if(_0x587384[_0x21e0('0x31')][_0x21e0('0x42')]){_0x5e4d11[_0x21e0('0x43')]=[{'all':!![]}];}return db[_0x21e0('0x41')][_0x21e0('0x44')](_0x5e4d11);})[_0x21e0('0x28')](function(_0x4bd8a2){_0x3ccedf['rows']=_0x4bd8a2;return _0x3ccedf;})['then'](respondWithFilteredResult(_0x2c9e80,_0x5e4d11))[_0x21e0('0x45')](handleError(_0x2c9e80,null));};exports[_0x21e0('0x46')]=function(_0x2d0487,_0x467a94){var _0x341753={'raw':!![],'where':{'id':_0x2d0487['params']['id']}},_0x5eea39={};_0x5eea39[_0x21e0('0x32')]=_['keys'](db[_0x21e0('0x41')]['rawAttributes']);_0x5eea39[_0x21e0('0x31')]=_[_0x21e0('0x47')](_0x2d0487[_0x21e0('0x31')]);_0x5eea39[_0x21e0('0x3b')]=_[_0x21e0('0x34')](_0x5eea39[_0x21e0('0x32')],_0x5eea39[_0x21e0('0x31')]);_0x341753[_0x21e0('0x33')]=_['intersection'](_0x5eea39[_0x21e0('0x32')],qs['fields'](_0x2d0487[_0x21e0('0x31')][_0x21e0('0x35')]));_0x341753[_0x21e0('0x33')]=_0x341753['attributes']['length']?_0x341753[_0x21e0('0x33')]:_0x5eea39['model'];if(_0x2d0487['query'][_0x21e0('0x42')]){_0x341753['include']=[{'all':!![]}];}_0x341753=_[_0x21e0('0x3e')]({},_0x341753,_0x2d0487[_0x21e0('0x40')]);return db[_0x21e0('0x41')][_0x21e0('0x48')](_0x341753)['then'](handleEntityNotFound(_0x467a94,null))[_0x21e0('0x28')](respondWithResult(_0x467a94,null))[_0x21e0('0x45')](handleError(_0x467a94,null));};exports[_0x21e0('0x49')]=function(_0x56e75e,_0x480192){var _0x273da9={'where':{'id':_0x56e75e[_0x21e0('0x4a')]['id']}},_0x407b53={};_0x407b53[_0x21e0('0x32')]=_['keys'](db['Attachment'][_0x21e0('0x2e')]);_0x273da9[_0x21e0('0x33')]=_[_0x21e0('0x34')](_0x407b53['model'],qs[_0x21e0('0x35')](_0x56e75e[_0x21e0('0x31')]['fields']));_0x273da9[_0x21e0('0x33')]=_0x273da9[_0x21e0('0x33')][_0x21e0('0x36')]?_0x273da9[_0x21e0('0x33')]:_0x407b53[_0x21e0('0x32')];if(_0x56e75e[_0x21e0('0x31')][_0x21e0('0x42')]){_0x273da9['include']=[{'all':!![]}];}_0x273da9=_[_0x21e0('0x3e')]({},_0x273da9,_0x56e75e[_0x21e0('0x40')]);return db['Attachment'][_0x21e0('0x48')](_0x273da9)['then'](handleEntityNotFound(_0x480192,null))[_0x21e0('0x28')](function(_0x9b9925){if(_0x9b9925){var _0x2970db=_0x9b9925['get']({'plain':!![]});_0x2970db=qs[_0x21e0('0x4b')](_0x2970db,['id',_0x21e0('0x4c'),_0x21e0('0x4d')]);_0x56e75e[_0x21e0('0x4e')]=_['omit'](_0x56e75e[_0x21e0('0x4e')],['id',_0x21e0('0x4c'),_0x21e0('0x4d')]);return db['Attachment'][_0x21e0('0x4f')](_[_0x21e0('0x3e')](_0x2970db,_0x56e75e[_0x21e0('0x4e')]),{'include':_0x56e75e['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x21e0('0x28')](respondWithResult(_0x480192,0xc9))[_0x21e0('0x45')](handleError(_0x480192,null));};exports['update']=function(_0x4a6701,_0x193920){if(_0x4a6701[_0x21e0('0x4e')]['id']){delete _0x4a6701[_0x21e0('0x4e')]['id'];}return db[_0x21e0('0x41')][_0x21e0('0x48')]({'where':{'id':_0x4a6701[_0x21e0('0x4a')]['id']}})[_0x21e0('0x28')](handleEntityNotFound(_0x193920,null))[_0x21e0('0x28')](saveUpdates(_0x4a6701[_0x21e0('0x4e')],null))[_0x21e0('0x28')](respondWithResult(_0x193920,null))['catch'](handleError(_0x193920,null));};exports[_0x21e0('0x50')]=function(_0x46c2d8,_0x3885a1){return db[_0x21e0('0x41')]['find']({'where':{'id':_0x46c2d8['params']['id']}})[_0x21e0('0x28')](handleEntityNotFound(_0x3885a1,null))[_0x21e0('0x28')](removeEntity(_0x3885a1,null))['catch'](handleError(_0x3885a1,null));};exports['create']=function(_0x58b493,_0x15cf2f,_0x10a48d){_0x58b493[_0x21e0('0x4e')][_0x21e0('0x2b')]=_0x58b493[_0x21e0('0x51')][_0x21e0('0x52')];_0x58b493[_0x21e0('0x4e')][_0x21e0('0x53')]=_0x58b493['file'][_0x21e0('0x54')];_0x58b493['body'][_0x21e0('0x2f')]=_0x58b493['file']['mimetype'];return db[_0x21e0('0x41')][_0x21e0('0x4f')](_0x58b493['body'])[_0x21e0('0x28')](respondWithResult(_0x15cf2f,0xc9))[_0x21e0('0x45')](handleError(_0x15cf2f,null));};exports[_0x21e0('0x55')]=function(_0x1ed141,_0x12fef2,_0x33b90c){return db[_0x21e0('0x41')][_0x21e0('0x56')]({'where':{'id':_0x1ed141[_0x21e0('0x4a')]['id']},'raw':!![]})[_0x21e0('0x28')](handleEntityNotFound(_0x12fef2,null))[_0x21e0('0x28')](function(_0x525da3){if(_0x525da3){var _0x5cd0ee=_0x525da3[_0x21e0('0x57')]!==null;var _0x2af57a=path[_0x21e0('0x58')](config[_0x21e0('0x59')],'server/files/attachments/');if(_0x5cd0ee){_0x2af57a=path[_0x21e0('0x58')](_0x2af57a,_0x21e0('0x5a'));}var _0x3473ce=path[_0x21e0('0x58')](_0x2af57a,_0x525da3[_0x21e0('0x53')]);return _0x12fef2['download'](_0x3473ce);}})[_0x21e0('0x45')](handleError(_0x12fef2,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 0eb2c2e..d697d29 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 _0x230b=['exports','define','Attachment','attachments','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x167f65,_0x1612f9){var _0x241eb5=function(_0x3144cd){while(--_0x3144cd){_0x167f65['push'](_0x167f65['shift']());}};_0x241eb5(++_0x1612f9);}(_0x230b,0xba));var _0xb230=function(_0x314d7d,_0xe5783a){_0x314d7d=_0x314d7d-0x0;var _0x2689f6=_0x230b[_0x314d7d];return _0x2689f6;};'use strict';var _=require('lodash');var util=require(_0xb230('0x0'));var logger=require(_0xb230('0x1'))(_0xb230('0x2'));var moment=require(_0xb230('0x3'));var BPromise=require('bluebird');var rp=require(_0xb230('0x4'));var fs=require('fs');var path=require(_0xb230('0x5'));var rimraf=require(_0xb230('0x6'));var config=require(_0xb230('0x7'));var attributes=require(_0xb230('0x8'));module[_0xb230('0x9')]=function(_0x47fa4d,_0x3967f6){return _0x47fa4d[_0xb230('0xa')](_0xb230('0xb'),attributes,{'tableName':_0xb230('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x170c=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','bluebird'];(function(_0x29949e,_0x7666c3){var _0x116dbf=function(_0x58f0d6){while(--_0x58f0d6){_0x29949e['push'](_0x29949e['shift']());}};_0x116dbf(++_0x7666c3);}(_0x170c,0x17d));var _0xc170=function(_0x4d585b,_0x12034f){_0x4d585b=_0x4d585b-0x0;var _0xfa0820=_0x170c[_0x4d585b];return _0xfa0820;};'use strict';var _=require(_0xc170('0x0'));var util=require(_0xc170('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc170('0x2'));var rp=require(_0xc170('0x3'));var fs=require('fs');var path=require(_0xc170('0x4'));var rimraf=require(_0xc170('0x5'));var config=require(_0xc170('0x6'));var attributes=require(_0xc170('0x7'));module[_0xc170('0x8')]=function(_0x50f727,_0x261845){return _0x50f727[_0xc170('0x9')](_0xc170('0xa'),attributes,{'tableName':_0xc170('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index ab465ba..39e7f87 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 _0xffe1=['message','result','catch','Attachment','create','body','options','raw','CreateAttachment','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x591c14,_0x3ef13b){var _0x4cafd7=function(_0x5f5298){while(--_0x5f5298){_0x591c14['push'](_0x591c14['shift']());}};_0x4cafd7(++_0x3ef13b);}(_0xffe1,0x175));var _0x1ffe=function(_0x46de05,_0x3a411d){_0x46de05=_0x46de05-0x0;var _0x2c3fef=_0xffe1[_0x46de05];return _0x2c3fef;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ffe('0x2'));var fs=require('fs');var Redis=require(_0x1ffe('0x3'));var db=require(_0x1ffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ffe('0x5'))(_0x1ffe('0x6'));var config=require(_0x1ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ffe('0x8')][_0x1ffe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6bc1ed,_0x26e370,_0xb34112){return new BPromise(function(_0x8eee2b,_0x4d2a28){return client['request'](_0x6bc1ed,_0xb34112)[_0x1ffe('0xa')](function(_0x13556e){logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');logger[_0x1ffe('0xd')](_0x1ffe('0xe'),_0x26e370,_0x1ffe('0xf'),JSON[_0x1ffe('0x10')](_0x13556e));if(_0x13556e[_0x1ffe('0x11')]){if(_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x12')]===0x1f4){logger[_0x1ffe('0x11')]('Attachment,\x20%s,\x20%s',_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x4d2a28(_0x13556e['error'][_0x1ffe('0x13')]);}logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x8eee2b(_0x13556e['error'][_0x1ffe('0x13')]);}else{logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');_0x8eee2b(_0x13556e[_0x1ffe('0x14')]['message']);}})[_0x1ffe('0x15')](function(_0x565922){logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x565922);_0x4d2a28(_0x565922);});});}exports['CreateAttachment']=function(_0x561670){var _0x4dbd7f=this;return new Promise(function(_0x42b92c,_0x21950f){return db[_0x1ffe('0x16')][_0x1ffe('0x17')](_0x561670[_0x1ffe('0x18')],{'raw':_0x561670[_0x1ffe('0x19')]?_0x561670[_0x1ffe('0x19')][_0x1ffe('0x1a')]===undefined?!![]:![]:!![]})[_0x1ffe('0xa')](function(_0x38f189){logger[_0x1ffe('0xb')](_0x1ffe('0x1b'),_0x561670);logger['debug']('CreateAttachment',_0x561670,JSON[_0x1ffe('0x10')](_0x38f189));_0x42b92c(_0x38f189);})[_0x1ffe('0x15')](function(_0x95071c){logger['error']('CreateAttachment',_0x95071c[_0x1ffe('0x13')],_0x561670);_0x21950f(_0x4dbd7f[_0x1ffe('0x11')](0x1f4,_0x95071c[_0x1ffe('0x13')]));});});}; \ No newline at end of file +var _0xd52a=['../../config/logger','rpc','../../config/environment','request','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','CreateAttachment','create','options','raw','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1d6fc6,_0x857c7){var _0x595a5a=function(_0x26ee91){while(--_0x26ee91){_0x1d6fc6['push'](_0x1d6fc6['shift']());}};_0x595a5a(++_0x857c7);}(_0xd52a,0xca));var _0xad52=function(_0x2bd0e1,_0x4666a6){_0x2bd0e1=_0x2bd0e1-0x0;var _0x4482eb=_0xd52a[_0x2bd0e1];return _0x4482eb;};'use strict';var _=require('lodash');var util=require(_0xad52('0x0'));var moment=require('moment');var BPromise=require(_0xad52('0x1'));var rs=require(_0xad52('0x2'));var fs=require('fs');var Redis=require(_0xad52('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xad52('0x4'));var logger=require(_0xad52('0x5'))(_0xad52('0x6'));var config=require(_0xad52('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ad70b,_0x55f7a7,_0x23fc23){return new BPromise(function(_0x4bbff0,_0x192ba5){return client[_0xad52('0x8')](_0x1ad70b,_0x23fc23)['then'](function(_0x39c078){logger['info'](_0xad52('0x9'),_0x55f7a7,'request\x20sent');logger[_0xad52('0xa')](_0xad52('0xb'),_0x55f7a7,_0xad52('0xc'),JSON[_0xad52('0xd')](_0x39c078));if(_0x39c078['error']){if(_0x39c078['error']['code']===0x1f4){logger[_0xad52('0xe')](_0xad52('0x9'),_0x55f7a7,_0x39c078[_0xad52('0xe')][_0xad52('0xf')]);return _0x192ba5(_0x39c078[_0xad52('0xe')][_0xad52('0xf')]);}logger[_0xad52('0xe')](_0xad52('0x9'),_0x55f7a7,_0x39c078[_0xad52('0xe')]['message']);return _0x4bbff0(_0x39c078[_0xad52('0xe')][_0xad52('0xf')]);}else{logger[_0xad52('0x10')](_0xad52('0x9'),_0x55f7a7,_0xad52('0xc'));_0x4bbff0(_0x39c078[_0xad52('0x11')][_0xad52('0xf')]);}})[_0xad52('0x12')](function(_0x450099){logger['error']('Attachment,\x20%s,\x20%s',_0x55f7a7,_0x450099);_0x192ba5(_0x450099);});});}exports[_0xad52('0x13')]=function(_0x39128c){var _0x351440=this;return new Promise(function(_0x1c19e9,_0x33da89){return db['Attachment'][_0xad52('0x14')](_0x39128c['body'],{'raw':_0x39128c[_0xad52('0x15')]?_0x39128c[_0xad52('0x15')][_0xad52('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x24fb52){logger['info'](_0xad52('0x13'),_0x39128c);logger[_0xad52('0xa')](_0xad52('0x13'),_0x39128c,JSON[_0xad52('0xd')](_0x24fb52));_0x1c19e9(_0x24fb52);})[_0xad52('0x12')](function(_0x2f1526){logger['error'](_0xad52('0x13'),_0x2f1526['message'],_0x39128c);_0x33da89(_0x351440[_0xad52('0xe')](0x1f4,_0x2f1526[_0xad52('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 7ada540..35563c4 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x59ac2c,_0x27ed47){var _0x1437b2=function(_0x3e9f0b){while(--_0x3e9f0b){_0x59ac2c['push'](_0x59ac2c['shift']());}};_0x1437b2(++_0x27ed47);}(_0x2032,0xd9));var _0x2203=function(_0x18ef2b,_0x42873b){_0x18ef2b=_0x18ef2b-0x0;var _0x359d9d=_0x2032[_0x18ef2b];return _0x359d9d;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x4c0da3,_0x2fabd1){var _0xd68cda=function(_0x17a074){while(--_0x17a074){_0x4c0da3['push'](_0x4c0da3['shift']());}};_0xd68cda(++_0x2fabd1);}(_0xadb5,0xad));var _0x5adb=function(_0x3c61fc,_0x1e4ed9){_0x3c61fc=_0x3c61fc-0x0;var _0x379fae=_0xadb5[_0x3c61fc];return _0x379fae;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 2dbc4b8..14a522a 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 _0x1bb0=['blocked','blockedAt','online','admin','user','add','minutes','getLicense','catch','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','api','activedirectory','undefined','baseDN','url','domain','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','Setting','findOne','adSsoEnabled','blockDuration','then','name','password','salt','role'];(function(_0x3aa7fa,_0x2390ae){var _0x13fc86=function(_0x21d33e){while(--_0x21d33e){_0x3aa7fa['push'](_0x3aa7fa['shift']());}};_0x13fc86(++_0x2390ae);}(_0x1bb0,0xc9));var _0x01bb=function(_0x4acc11,_0xe2f74f){_0x4acc11=_0x4acc11-0x0;var _0x2db26d=_0x1bb0[_0x4acc11];return _0x2db26d;};'use strict';var passport=require(_0x01bb('0x0'));var LocalStrategy=require('passport-local')[_0x01bb('0x1')];var moment=require(_0x01bb('0x2'));var ActiveDirectory=require(_0x01bb('0x3'));var BPromise=require(_0x01bb('0x4'));var util=require(_0x01bb('0x5'));var db=require(_0x01bb('0x6'))['db'];var authService=require(_0x01bb('0x7'));var utils=require(_0x01bb('0x8'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x01bb('0x9'));function isActiveDirectoryConfigured(_0x41ce0a){var _0x39510a=![];if(typeof _0x41ce0a[_0x01bb('0xa')]!==_0x01bb('0xb')){_0x39510a=_0x41ce0a['activedirectory'][_0x01bb('0xc')]&&_0x41ce0a['activedirectory'][_0x01bb('0xd')]&&_0x41ce0a[_0x01bb('0xa')][_0x01bb('0xe')];}return _0x39510a;}function adAuthenticate(_0x5e6252,_0x4cf991,_0x40dca3){return new BPromise(function(_0x159c6b,_0xc22278){try{var _0x29101a=new ActiveDirectory(_0x5e6252);_0x29101a['authenticate'](_0x4cf991,_0x40dca3,function(_0x312116,_0x15d25f){if(_0x312116){logger[_0x01bb('0xf')](_0x01bb('0x10'),_0x4cf991,util[_0x01bb('0x11')](_0x312116,{'showHidden':![],'depth':null}));_0xc22278(_0x01bb('0x12'));}else if(!_0x15d25f){logger[_0x01bb('0xf')](_0x01bb('0x13'),_0x4cf991);_0xc22278(_0x01bb('0x12'));}else{_0x159c6b(_0x15d25f);}});}catch(_0x323099){_0xc22278(_0x323099);}});}function ActiveDirectoryAuthenticate(_0x44b3d4,_0x2f4731,_0x441a6a,_0x14cb7b){var _0x4fc00f,_0x5dbcda;if(!isActiveDirectoryConfigured(config)){logger[_0x01bb('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x2f4731);return _0x14cb7b(null,![],{'message':_0x01bb('0x12')});}return db[_0x01bb('0x14')][_0x01bb('0x15')]({'where':{'id':0x1},'attributes':[_0x01bb('0x16'),_0x01bb('0x17')],'raw':!![]})[_0x01bb('0x18')](function(_0x549e3e){_0x4fc00f=_0x549e3e;if(!_0x4fc00f[_0x01bb('0x16')]){logger[_0x01bb('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x2f4731);throw new Error(_0x01bb('0x12'));}return _0x44b3d4[_0x01bb('0x15')]({'attributes':['id',_0x01bb('0x19'),_0x01bb('0x1a'),_0x01bb('0x1b'),_0x01bb('0x1c'),'disabled',_0x01bb('0x1d'),_0x01bb('0x1e'),_0x01bb('0x1f')],'where':{'name':_0x2f4731,'role':{'$or':[_0x01bb('0x20'),_0x01bb('0x21'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x5318a4){if(!_0x5318a4||_0x5318a4&&_0x5318a4['name']!==_0x2f4731){throw new Error(_0x01bb('0x12'));}_0x5dbcda=_0x5318a4;var _0x56331e=_0x5dbcda[_0x01bb('0x19')]+'@'+config[_0x01bb('0xa')][_0x01bb('0xe')];return adAuthenticate(config['activedirectory'],_0x56331e,_0x441a6a);})[_0x01bb('0x18')](function(_0x1aa1c7){if(_0x5dbcda['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x4fc00f[_0x01bb('0x17')]>0x0){if(_0x5dbcda[_0x01bb('0x1d')]){if(moment(_0x5dbcda['blockedAt'])[_0x01bb('0x22')](_0x4fc00f[_0x01bb('0x17')],_0x01bb('0x23'))>moment()){throw new Error(_0x01bb('0x12'));}return utils['clearBlockUser'](_0x5dbcda,0x0,![],null)['then'](function(){return utils[_0x01bb('0x24')](_0x5dbcda);})[_0x01bb('0x18')](function(){return _0x14cb7b(null,_0x5dbcda);});}else{return utils[_0x01bb('0x24')](_0x5dbcda)[_0x01bb('0x18')](function(){return _0x14cb7b(null,_0x5dbcda);});}}else{return utils[_0x01bb('0x24')](_0x5dbcda)['then'](function(){return _0x14cb7b(null,_0x5dbcda);});}})[_0x01bb('0x25')](function(_0x3c49fc){return _0x14cb7b(null,![],_0x3c49fc);});}function handleError(_0xeb80ab,_0x2baccd,_0x330887){return _0xeb80ab['status'](_0x2baccd||0x1f4)['send']({'message':_0x330887?_0x330887['message']||_0x330887:''});}exports[_0x01bb('0x26')]=function(_0x36a655,_0x3e424b,_0x4c2b7a){passport[_0x01bb('0x27')](_0x01bb('0x28'),function(_0x434dc5,_0x3dc422,_0x2386ca){var _0x326073=_0x434dc5||_0x2386ca;if(_0x326073){return handleError(_0x3e424b,0x191,_0x326073);}if(!_0x3dc422){return handleError(_0x3e424b,0x194,{'message':_0x01bb('0x29')});}else{var _0x724e7a={'payload':{'id':_0x3dc422['id'],'role':_0x3dc422[_0x01bb('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x01bb('0x2a')](_0x724e7a)['then'](function(_0x5922ca){_0x3e424b[_0x01bb('0x2b')]({'id':_0x3dc422['id'],'token':_0x5922ca,'statusCall':'','isAlreadyLogged':_0x3dc422[_0x01bb('0x1f')]});});}})(_0x36a655,_0x3e424b,_0x4c2b7a);};passport[_0x01bb('0x2c')](_0x01bb('0x28'),new LocalStrategy({'usernameField':_0x01bb('0x19'),'passwordField':_0x01bb('0x1a')},function(_0x264c3c,_0x5a8338,_0x3b894b){return ActiveDirectoryAuthenticate(db[_0x01bb('0x2d')],_0x264c3c,_0x5a8338,_0x3b894b);})); \ No newline at end of file +var _0x6684=['passport','passport-local','Strategy','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','disabled','blocked','blockedAt','online','user','agent','name','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','ad-login','password','User'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0x6684,0x64));var _0x4668=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0x6684[_0x4067ac];return _0x53d74d;};'use strict';var passport=require(_0x4668('0x0'));var LocalStrategy=require(_0x4668('0x1'))[_0x4668('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x4668('0x3'));var BPromise=require(_0x4668('0x4'));var util=require(_0x4668('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x4668('0x6'));var utils=require(_0x4668('0x7'));var config=require(_0x4668('0x8'));var logger=require(_0x4668('0x9'))(_0x4668('0xa'));function isActiveDirectoryConfigured(_0x20ad61){var _0x106cfb=![];if(typeof _0x20ad61[_0x4668('0xb')]!==_0x4668('0xc')){_0x106cfb=_0x20ad61[_0x4668('0xb')]['baseDN']&&_0x20ad61['activedirectory'][_0x4668('0xd')]&&_0x20ad61[_0x4668('0xb')][_0x4668('0xe')];}return _0x106cfb;}function adAuthenticate(_0x193285,_0x16394b,_0xf6b85a){return new BPromise(function(_0x14bcd4,_0x4502b5){try{var _0x5849e1=new ActiveDirectory(_0x193285);_0x5849e1[_0x4668('0xf')](_0x16394b,_0xf6b85a,function(_0x14f1ad,_0x5df0dc){if(_0x14f1ad){logger[_0x4668('0x10')](_0x4668('0x11'),_0x16394b,util[_0x4668('0x12')](_0x14f1ad,{'showHidden':![],'depth':null}));_0x4502b5(_0x4668('0x13'));}else if(!_0x5df0dc){logger[_0x4668('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x16394b);_0x4502b5(_0x4668('0x13'));}else{_0x14bcd4(_0x5df0dc);}});}catch(_0x2d39bb){_0x4502b5(_0x2d39bb);}});}function ActiveDirectoryAuthenticate(_0x158dc8,_0x1f7901,_0x54a779,_0x29ee06){var _0x2df177,_0x241963;if(!isActiveDirectoryConfigured(config)){logger[_0x4668('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x1f7901);return _0x29ee06(null,![],{'message':_0x4668('0x13')});}return db[_0x4668('0x14')][_0x4668('0x15')]({'where':{'id':0x1},'attributes':[_0x4668('0x16'),_0x4668('0x17')],'raw':!![]})[_0x4668('0x18')](function(_0x5a5589){_0x2df177=_0x5a5589;if(!_0x2df177['adSsoEnabled']){logger['error'](_0x4668('0x19'),_0x1f7901);throw new Error(_0x4668('0x13'));}return _0x158dc8[_0x4668('0x15')]({'attributes':['id','name','password',_0x4668('0x1a'),_0x4668('0x1b'),_0x4668('0x1c'),_0x4668('0x1d'),_0x4668('0x1e'),_0x4668('0x1f')],'where':{'name':_0x1f7901,'role':{'$or':['admin',_0x4668('0x20'),_0x4668('0x21')]},'adSsoEnabled':!![]}});})[_0x4668('0x18')](function(_0x5ba48b){if(!_0x5ba48b||_0x5ba48b&&_0x5ba48b[_0x4668('0x22')]!==_0x1f7901){throw new Error(_0x4668('0x13'));}_0x241963=_0x5ba48b;var _0x100e3c=_0x241963[_0x4668('0x22')]+'@'+config[_0x4668('0xb')][_0x4668('0xe')];return adAuthenticate(config['activedirectory'],_0x100e3c,_0x54a779);})['then'](function(_0x253e16){if(_0x241963[_0x4668('0x1c')]){throw new Error(_0x4668('0x13'));}if(_0x2df177[_0x4668('0x17')]>0x0){if(_0x241963[_0x4668('0x1d')]){if(moment(_0x241963[_0x4668('0x1e')])[_0x4668('0x23')](_0x2df177[_0x4668('0x17')],_0x4668('0x24'))>moment()){throw new Error(_0x4668('0x13'));}return utils[_0x4668('0x25')](_0x241963,0x0,![],null)['then'](function(){return utils[_0x4668('0x26')](_0x241963);})['then'](function(){return _0x29ee06(null,_0x241963);});}else{return utils[_0x4668('0x26')](_0x241963)[_0x4668('0x18')](function(){return _0x29ee06(null,_0x241963);});}}else{return utils[_0x4668('0x26')](_0x241963)[_0x4668('0x18')](function(){return _0x29ee06(null,_0x241963);});}})[_0x4668('0x27')](function(_0x13bff1){return _0x29ee06(null,![],_0x13bff1);});}function handleError(_0x19e107,_0x1b619e,_0x517cd5){return _0x19e107[_0x4668('0x28')](_0x1b619e||0x1f4)[_0x4668('0x29')]({'message':_0x517cd5?_0x517cd5[_0x4668('0x2a')]||_0x517cd5:''});}exports[_0x4668('0x2b')]=function(_0x37364c,_0x48d602,_0x4efa16){passport[_0x4668('0xf')]('ad-login',function(_0x4fca33,_0x2a3e14,_0x503135){var _0x65586=_0x4fca33||_0x503135;if(_0x65586){return handleError(_0x48d602,0x191,_0x65586);}if(!_0x2a3e14){return handleError(_0x48d602,0x194,{'message':_0x4668('0x2c')});}else{var _0x27f891={'payload':{'id':_0x2a3e14['id'],'role':_0x2a3e14[_0x4668('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x4668('0x2d')](_0x27f891)['then'](function(_0x16cd04){_0x48d602['json']({'id':_0x2a3e14['id'],'token':_0x16cd04,'statusCall':'','isAlreadyLogged':_0x2a3e14['online']});});}})(_0x37364c,_0x48d602,_0x4efa16);};passport[_0x4668('0x2e')](_0x4668('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':_0x4668('0x30')},function(_0x593f6e,_0x531809,_0x52d730){return ActiveDirectoryAuthenticate(db[_0x4668('0x31')],_0x593f6e,_0x531809,_0x52d730);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 3aad1fd..ea7ba30 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 _0x5579=['login','exports','Router','post'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x5579,0x8e));var _0x9557=function(_0x211070,_0x35f484){_0x211070=_0x211070-0x0;var _0x5f36b9=_0x5579[_0x211070];return _0x5f36b9;};'use strict';var express=require('express');var router=express[_0x9557('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0x9557('0x1')]('/',controller[_0x9557('0x2')]);module[_0x9557('0x3')]=router; \ No newline at end of file +var _0xa6ea=['exports','Router','./authActiveDirectory.controller','post','login'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa6ea,0xb0));var _0xaa6e=function(_0x395bae,_0x4708e2){_0x395bae=_0x395bae-0x0;var _0x1d658e=_0xa6ea[_0x395bae];return _0x1d658e;};'use strict';var express=require('express');var router=express[_0xaa6e('0x0')]();var controller=require(_0xaa6e('0x1'));router[_0xaa6e('0x2')]('/',controller[_0xaa6e('0x3')]);module[_0xaa6e('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 14b3495..e0339ae 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x42b749,_0x188528){_0x42b749=_0x42b749-0x0;var _0x2c06ab=_0x7a54[_0x42b749];return _0x2c06ab;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _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(_0x3b6027,_0x100fea){var _0x3a9e70=function(_0x44bb5b){while(--_0x44bb5b){_0x3b6027['push'](_0x3b6027['shift']());}};_0x3a9e70(++_0x100fea);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 2347e94..40d1380 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 _0xba34=['setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','login','get','/callback','callback'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xba34,0xb2));var _0x4ba3=function(_0x272c6d,_0x58e5bd){_0x272c6d=_0x272c6d-0x0;var _0x5659ef=_0xba34[_0x272c6d];return _0x5659ef;};'use strict';var express=require(_0x4ba3('0x0'));var passport=require(_0x4ba3('0x1'));var router=express[_0x4ba3('0x2')]();var controller=require(_0x4ba3('0x3'));var userController=require(_0x4ba3('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller[_0x4ba3('0x5')]);router[_0x4ba3('0x6')](_0x4ba3('0x7'),controller[_0x4ba3('0x8')],authService['isMiddleware'],userController['login'],authService[_0x4ba3('0x9')]);module[_0x4ba3('0xa')]=router; \ No newline at end of file +var _0xc8c3=['isMiddleware','express','passport','Router','../../components/auth/service','get','login','callback'];(function(_0x4c3851,_0xbebbfd){var _0x43a1e2=function(_0x271b9f){while(--_0x271b9f){_0x4c3851['push'](_0x4c3851['shift']());}};_0x43a1e2(++_0xbebbfd);}(_0xc8c3,0x1c1));var _0x3c8c=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0xc8c3[_0x4c3070];return _0x536a44;};'use strict';var express=require(_0x3c8c('0x0'));var passport=require(_0x3c8c('0x1'));var router=express[_0x3c8c('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x3c8c('0x3'));router[_0x3c8c('0x4')]('/',controller[_0x3c8c('0x5')]);router['get']('/callback',controller[_0x3c8c('0x6')],authService[_0x3c8c('0x7')],userController[_0x3c8c('0x5')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6033e24..9e00839 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 _0x6081=['\x22%s\x22\x20<%s>','email','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','util','passport','passport-local','Strategy','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','salt','disabled','blocked','blockedAt','loginAttempts','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','clearBlockUser','add','minutes','getLicense','catch','MailServerOut','Smtp','CloudProvider','merge'];(function(_0x36ec43,_0x4449e7){var _0x3af915=function(_0x509e6b){while(--_0x509e6b){_0x36ec43['push'](_0x36ec43['shift']());}};_0x3af915(++_0x4449e7);}(_0x6081,0x76));var _0x1608=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6081[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x1608('0x0'));var passport=require(_0x1608('0x1'));var LocalStrategy=require(_0x1608('0x2'))[_0x1608('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x1608('0x4'));var moment=require(_0x1608('0x5'));var db=require(_0x1608('0x6'))['db'];var authService=require(_0x1608('0x7'));var utils=require(_0x1608('0x8'));var client=jayson[_0x1608('0x9')][_0x1608('0xa')]({'port':0x232b});function localAuthenticate(_0x42b14a,_0x5599aa,_0x58b21f,_0x1a7cb){var _0x5d0ea7,_0x5e0b20;return db[_0x1608('0xb')][_0x1608('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1608('0xd')],'raw':!![]})[_0x1608('0xe')](function(_0x22e372){_0x5d0ea7=_0x22e372;return _0x42b14a[_0x1608('0xc')]({'attributes':['id',_0x1608('0xf'),_0x1608('0x10'),_0x1608('0x11'),'role',_0x1608('0x12'),_0x1608('0x13'),_0x1608('0x14'),_0x1608('0x15')],'where':{'name':_0x5599aa,'role':{'$or':['admin',_0x1608('0x16'),_0x1608('0x17')]}}});})[_0x1608('0xe')](function(_0x2b2b85){if(!_0x2b2b85||_0x2b2b85&&_0x2b2b85[_0x1608('0xf')]!==_0x5599aa){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5e0b20=_0x2b2b85;return _0x5e0b20;}})[_0x1608('0xe')](function(){_0x5e0b20[_0x1608('0x18')](_0x58b21f,function(_0x42fbf1,_0x264c96){var _0x3c8f03=_0x5e0b20['loginAttempts']+0x1;if(_0x42fbf1){return _0x1a7cb(_0x42fbf1);}else if(!_0x264c96){if(_0x5e0b20[_0x1608('0x12')]){return _0x1a7cb(null,![],{'message':_0x1608('0x19')});}else if(_0x5d0ea7[_0x1608('0x1a')]>0x0){if(_0x5e0b20['blocked']){if(_0x5d0ea7[_0x1608('0xd')]>0x0){if(moment(_0x5e0b20[_0x1608('0x14')])['add'](_0x5d0ea7[_0x1608('0xd')],'minutes')>moment()){return _0x1a7cb(null,![],{'message':_0x1608('0x19')});}else{return utils['clearBlockUser'](_0x5e0b20,_0x3c8f03,![],null)[_0x1608('0xe')](function(){return _0x1a7cb(null,![],{'message':_0x1608('0x19')});});}}else{return _0x1a7cb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3c8f03>=_0x5d0ea7['allowedLoginAttempts']){return utils[_0x1608('0x1b')](_0x5e0b20,0x0,!![],moment())[_0x1608('0xe')](function(){return _0x1a7cb(null,![],{'message':_0x1608('0x19')});});}else{return utils['clearBlockUser'](_0x5e0b20,_0x3c8f03,![],null)['then'](function(){return _0x1a7cb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1a7cb(null,![],{'message':_0x1608('0x19')});}}else{if(_0x5e0b20[_0x1608('0x12')]){return _0x1a7cb(null,![],{'message':_0x1608('0x19')});}else if(_0x5d0ea7['allowedLoginAttempts']>0x0){if(_0x5e0b20[_0x1608('0x13')]){if(_0x5d0ea7[_0x1608('0xd')]>0x0){if(moment(_0x5e0b20[_0x1608('0x14')])[_0x1608('0x1c')](_0x5d0ea7['blockDuration'],_0x1608('0x1d'))>moment()){return _0x1a7cb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x1608('0x1b')](_0x5e0b20,0x0,![],null)[_0x1608('0xe')](function(){return utils[_0x1608('0x1e')](_0x5e0b20);})[_0x1608('0xe')](function(){return _0x1a7cb(null,_0x5e0b20);});}}else{return _0x1a7cb(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x5e0b20,0x0,![],null)[_0x1608('0xe')](function(){return utils[_0x1608('0x1e')](_0x5e0b20);})[_0x1608('0xe')](function(){return _0x1a7cb(null,_0x5e0b20);})[_0x1608('0x1f')](function(_0x4ce897){return _0x1a7cb(null,![],_0x4ce897);});}}else{if(_0x5e0b20[_0x1608('0x13')]){return _0x1a7cb(null,![],{'message':_0x1608('0x19')});}else{return utils[_0x1608('0x1e')](_0x5e0b20)[_0x1608('0xe')](function(){return _0x1a7cb(null,_0x5e0b20);});}}}});})[_0x1608('0x1f')](function(_0x361a08){return _0x1a7cb(null,![],_0x361a08);});}function sendServiceMail(_0x1787d5){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x1608('0xf'),'email'],'include':[{'model':db[_0x1608('0x20')],'as':_0x1608('0x21'),'include':[{'model':db['CloudProvider'],'as':_0x1608('0x22')}]}]})[_0x1608('0xe')](function(_0x52a91a){if(!_0x52a91a){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x45d47d=_0x52a91a['getSmtpOptions']();var _0x14a4a7={'account':_0x45d47d,'message':_[_0x1608('0x23')]({'from':util['format'](_0x1608('0x24'),_0x52a91a['name'],_0x52a91a[_0x1608('0x25')]||_0x52a91a[_0x1608('0x21')][_0x1608('0x16')])},_0x1787d5)};return client['request'](_0x1608('0x26'),_0x14a4a7);})['then'](function(_0x11ba70){if(_0x11ba70[_0x1608('0x27')]){throw new Error(util[_0x1608('0x28')](_0x1608('0x29'),_0x11ba70[_0x1608('0x27')][_0x1608('0x2a')]||JSON[_0x1608('0x2b')](_0x11ba70[_0x1608('0x27')])));}return!![];});}function handleError(_0x1ef030,_0xa17340,_0x3718b9){return _0x1ef030[_0x1608('0x2c')](_0xa17340||0x1f4)[_0x1608('0x2d')]({'message':_0x3718b9?_0x3718b9['message']||_0x3718b9:''});}exports['login']=function(_0x44a4cc,_0x53078f,_0x134f5c){passport[_0x1608('0x18')](_0x1608('0x2e'),function(_0x1325f8,_0x43f507,_0x59b9ce){var _0x1ca5e8=_0x1325f8||_0x59b9ce;if(_0x1ca5e8){return handleError(_0x53078f,0x191,_0x1ca5e8);}if(!_0x43f507){return handleError(_0x53078f,0x194,{'message':_0x1608('0x2f')});}else{var _0x200029={'payload':{'id':_0x43f507['id'],'role':_0x43f507['role']},'options':{'expiresIn':0x15180}};return authService[_0x1608('0x30')](_0x200029)[_0x1608('0xe')](function(_0x3420a6){_0x53078f['json']({'id':_0x43f507['id'],'token':_0x3420a6,'statusCall':'','isAlreadyLogged':_0x43f507[_0x1608('0x31')]});});}})(_0x44a4cc,_0x53078f,_0x134f5c);};exports[_0x1608('0x32')]=function(_0x1512e9,_0x300993){if(!_0x1512e9[_0x1608('0x33')][_0x1608('0x25')]){return handleError(_0x300993,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x512058=rs['generate']();_0x1512e9[_0x1608('0x33')][_0x1608('0x25')]=_0x1512e9[_0x1608('0x33')]['email'][_0x1608('0x34')]()[_0x1608('0x35')]();var _0x41d6c9;return db[_0x1608('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x1608('0x1a'),_0x1608('0xd')],'raw':!![]})[_0x1608('0xe')](function(_0x1ea317){_0x41d6c9=_0x1ea317;return db[_0x1608('0x36')][_0x1608('0x37')]({'where':{'email':_0x1512e9[_0x1608('0x33')][_0x1608('0x25')]}});})[_0x1608('0xe')](function(_0x3296a3){if(!_0x3296a3){throw new Error(_0x1608('0x38'));}if(_0x3296a3[_0x1608('0x12')]){throw new Error(_0x1608('0x39'));}if(_0x3296a3[_0x1608('0x13')]){if(moment(_0x3296a3[_0x1608('0x14')])['add'](_0x41d6c9[_0x1608('0xd')],_0x1608('0x1d'))>moment()){throw new Error(_0x1608('0x3a'));}else{_0x3296a3['blocked']=![];_0x3296a3['blockedAt']=null;}}_0x3296a3['resetPasswordToken']=_0x512058;_0x3296a3[_0x1608('0x3b')]=Date[_0x1608('0x3c')]()+0x36ee80;return _0x3296a3[_0x1608('0x3d')]();})[_0x1608('0xe')](function(){return sendServiceMail({'to':_0x1512e9[_0x1608('0x33')][_0x1608('0x25')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x1608('0x3e')+'https://'+_0x1512e9[_0x1608('0x3f')]['host']+_0x1608('0x40')+_0x512058+'\x0a\x0a'+_0x1608('0x41')});})['then'](function(){_0x300993[_0x1608('0x2c')](0xc8)['send']({'message':_0x1608('0x42')});})[_0x1608('0x1f')](function(_0x219850){return handleError(_0x300993,0x1f4,_0x219850);});};exports[_0x1608('0x43')]=function(_0x196e22,_0x2dc33f){return db[_0x1608('0x36')][_0x1608('0x37')]({'where':{'resetPasswordToken':_0x196e22['params'][_0x1608('0x44')],'resetPasswordExpires':{'$gt':Date[_0x1608('0x3c')]()}}})[_0x1608('0xe')](function(_0x2110f6){if(!_0x2110f6){throw new Error(_0x1608('0x45'));}return db[_0x1608('0xb')]['findOne']({'attributes':['id',_0x1608('0x46'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x1608('0xe')](function(_0x272df6){if(_0x272df6[_0x1608('0x46')])authService[_0x1608('0x47')](_0x196e22[_0x1608('0x33')][_0x1608('0x10')]);if(!_0x272df6[_0x1608('0x48')]||!_0x2110f6[_0x1608('0x49')])return _0x2110f6;authService['validatePasswordHistory'](_0x196e22['body'][_0x1608('0x10')],_0x2110f6[_0x1608('0x49')],_0x272df6[_0x1608('0x4a')]);return _0x2110f6;})[_0x1608('0xe')](function(){_0x2110f6[_0x1608('0x10')]=_0x196e22['body'][_0x1608('0x10')];_0x2110f6['resetPasswordToken']=null;_0x2110f6['resetPasswordExpires']=null;return _0x2110f6[_0x1608('0x3d')]();});})[_0x1608('0xe')](function(){_0x2dc33f['status'](0xc8)[_0x1608('0x2d')]({'message':_0x1608('0x4b')});})['catch'](function(_0x1a0112){return handleError(_0x2dc33f,0x1f4,_0x1a0112);});};passport[_0x1608('0x4c')](_0x1608('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x15c9ae,_0x555025,_0x33f3f9){return localAuthenticate(db['User'],_0x15c9ae,_0x555025,_0x33f3f9);})); \ No newline at end of file +var _0x6a1e=['passport-local','jayson/promise','randomstring','moment','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','clearBlockUser','minutes','getLicense','catch','MailAccount','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message','login','local-login','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','email','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','passwordHistoryLimit','use','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a1e,0xf2));var _0xe6a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a1e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xe6a1('0x0'));var passport=require('passport');var LocalStrategy=require(_0xe6a1('0x1'))['Strategy'];var jayson=require(_0xe6a1('0x2'));var _=require('lodash');var rs=require(_0xe6a1('0x3'));var moment=require(_0xe6a1('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xe6a1('0x5'));var utils=require('../../config/utils');var client=jayson[_0xe6a1('0x6')][_0xe6a1('0x7')]({'port':0x232b});function localAuthenticate(_0x161353,_0x1510c6,_0x199117,_0x5eb3f5){var _0x253c1c,_0x263db3;return db[_0xe6a1('0x8')][_0xe6a1('0x9')]({'where':{'id':0x1},'attributes':[_0xe6a1('0xa'),_0xe6a1('0xb')],'raw':!![]})[_0xe6a1('0xc')](function(_0x3de1f9){_0x253c1c=_0x3de1f9;return _0x161353[_0xe6a1('0x9')]({'attributes':['id',_0xe6a1('0xd'),_0xe6a1('0xe'),_0xe6a1('0xf'),_0xe6a1('0x10'),_0xe6a1('0x11'),_0xe6a1('0x12'),_0xe6a1('0x13'),'loginAttempts'],'where':{'name':_0x1510c6,'role':{'$or':[_0xe6a1('0x14'),_0xe6a1('0x15'),_0xe6a1('0x16')]}}});})[_0xe6a1('0xc')](function(_0x5a1023){if(!_0x5a1023||_0x5a1023&&_0x5a1023[_0xe6a1('0xd')]!==_0x1510c6){throw new Error(_0xe6a1('0x17'));}else{_0x263db3=_0x5a1023;return _0x263db3;}})[_0xe6a1('0xc')](function(){_0x263db3[_0xe6a1('0x18')](_0x199117,function(_0x1d4aba,_0x1c027b){var _0x3770f3=_0x263db3[_0xe6a1('0x19')]+0x1;if(_0x1d4aba){return _0x5eb3f5(_0x1d4aba);}else if(!_0x1c027b){if(_0x263db3['disabled']){return _0x5eb3f5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x253c1c[_0xe6a1('0xa')]>0x0){if(_0x263db3['blocked']){if(_0x253c1c['blockDuration']>0x0){if(moment(_0x263db3[_0xe6a1('0x13')])['add'](_0x253c1c[_0xe6a1('0xb')],'minutes')>moment()){return _0x5eb3f5(null,![],{'message':_0xe6a1('0x17')});}else{return utils[_0xe6a1('0x1a')](_0x263db3,_0x3770f3,![],null)['then'](function(){return _0x5eb3f5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5eb3f5(null,![],{'message':_0xe6a1('0x17')});}}else{if(_0x3770f3>=_0x253c1c[_0xe6a1('0xa')]){return utils[_0xe6a1('0x1a')](_0x263db3,0x0,!![],moment())[_0xe6a1('0xc')](function(){return _0x5eb3f5(null,![],{'message':_0xe6a1('0x17')});});}else{return utils[_0xe6a1('0x1a')](_0x263db3,_0x3770f3,![],null)[_0xe6a1('0xc')](function(){return _0x5eb3f5(null,![],{'message':_0xe6a1('0x17')});});}}}else{return _0x5eb3f5(null,![],{'message':_0xe6a1('0x17')});}}else{if(_0x263db3[_0xe6a1('0x11')]){return _0x5eb3f5(null,![],{'message':_0xe6a1('0x17')});}else if(_0x253c1c[_0xe6a1('0xa')]>0x0){if(_0x263db3['blocked']){if(_0x253c1c[_0xe6a1('0xb')]>0x0){if(moment(_0x263db3[_0xe6a1('0x13')])['add'](_0x253c1c[_0xe6a1('0xb')],_0xe6a1('0x1b'))>moment()){return _0x5eb3f5(null,![],{'message':_0xe6a1('0x17')});}else{return utils[_0xe6a1('0x1a')](_0x263db3,0x0,![],null)[_0xe6a1('0xc')](function(){return utils[_0xe6a1('0x1c')](_0x263db3);})[_0xe6a1('0xc')](function(){return _0x5eb3f5(null,_0x263db3);});}}else{return _0x5eb3f5(null,![],{'message':_0xe6a1('0x17')});}}else{return utils[_0xe6a1('0x1a')](_0x263db3,0x0,![],null)[_0xe6a1('0xc')](function(){return utils['getLicense'](_0x263db3);})[_0xe6a1('0xc')](function(){return _0x5eb3f5(null,_0x263db3);})['catch'](function(_0x4340de){return _0x5eb3f5(null,![],_0x4340de);});}}else{if(_0x263db3[_0xe6a1('0x12')]){return _0x5eb3f5(null,![],{'message':_0xe6a1('0x17')});}else{return utils[_0xe6a1('0x1c')](_0x263db3)[_0xe6a1('0xc')](function(){return _0x5eb3f5(null,_0x263db3);});}}}});})[_0xe6a1('0x1d')](function(_0x2f4987){return _0x5eb3f5(null,![],_0x2f4987);});}function sendServiceMail(_0x293b3f){return db[_0xe6a1('0x1e')]['find']({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xe6a1('0x1f')],'as':_0xe6a1('0x20'),'include':[{'model':db['CloudProvider'],'as':_0xe6a1('0x21')}]}]})[_0xe6a1('0xc')](function(_0x2c29f6){if(!_0x2c29f6){throw new Error(_0xe6a1('0x22'));}var _0xb897a1=_0x2c29f6[_0xe6a1('0x23')]();var _0x251eb1={'account':_0xb897a1,'message':_['merge']({'from':util[_0xe6a1('0x24')](_0xe6a1('0x25'),_0x2c29f6[_0xe6a1('0xd')],_0x2c29f6['email']||_0x2c29f6[_0xe6a1('0x20')][_0xe6a1('0x15')])},_0x293b3f)};return client['request']('SendMail',_0x251eb1);})[_0xe6a1('0xc')](function(_0xf778fd){if(_0xf778fd[_0xe6a1('0x26')]){throw new Error(util[_0xe6a1('0x24')](_0xe6a1('0x27'),_0xf778fd[_0xe6a1('0x26')]['message']||JSON['stringify'](_0xf778fd['error'])));}return!![];});}function handleError(_0x88e00c,_0x240a22,_0x4ad68a){return _0x88e00c[_0xe6a1('0x28')](_0x240a22||0x1f4)[_0xe6a1('0x29')]({'message':_0x4ad68a?_0x4ad68a[_0xe6a1('0x2a')]||_0x4ad68a:''});}exports[_0xe6a1('0x2b')]=function(_0xaa8f2c,_0x5292ad,_0x3e655d){passport[_0xe6a1('0x18')](_0xe6a1('0x2c'),function(_0x2a24a6,_0x40611a,_0xe6cbf3){var _0x53e102=_0x2a24a6||_0xe6cbf3;if(_0x53e102){return handleError(_0x5292ad,0x191,_0x53e102);}if(!_0x40611a){return handleError(_0x5292ad,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x57607f={'payload':{'id':_0x40611a['id'],'role':_0x40611a[_0xe6a1('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xe6a1('0x2d')](_0x57607f)['then'](function(_0x4a078f){_0x5292ad[_0xe6a1('0x2e')]({'id':_0x40611a['id'],'token':_0x4a078f,'statusCall':'','isAlreadyLogged':_0x40611a[_0xe6a1('0x2f')]});});}})(_0xaa8f2c,_0x5292ad,_0x3e655d);};exports[_0xe6a1('0x30')]=function(_0x136a32,_0x36c7f1){if(!_0x136a32['body']['email']){return handleError(_0x36c7f1,0x1f4,{'message':_0xe6a1('0x31')});}var _0x5799f4=rs[_0xe6a1('0x32')]();_0x136a32[_0xe6a1('0x33')][_0xe6a1('0x34')]=_0x136a32[_0xe6a1('0x33')]['email'][_0xe6a1('0x35')]()[_0xe6a1('0x36')]();var _0x48c8b0;return db[_0xe6a1('0x8')][_0xe6a1('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe6a1('0xb')],'raw':!![]})[_0xe6a1('0xc')](function(_0x288039){_0x48c8b0=_0x288039;return db[_0xe6a1('0x37')][_0xe6a1('0x38')]({'where':{'email':_0x136a32[_0xe6a1('0x33')][_0xe6a1('0x34')]}});})[_0xe6a1('0xc')](function(_0xc40c5){if(!_0xc40c5){throw new Error(_0xe6a1('0x39'));}if(_0xc40c5[_0xe6a1('0x11')]){throw new Error(_0xe6a1('0x3a'));}if(_0xc40c5[_0xe6a1('0x12')]){if(moment(_0xc40c5[_0xe6a1('0x13')])['add'](_0x48c8b0[_0xe6a1('0xb')],'minutes')>moment()){throw new Error(_0xe6a1('0x3b'));}else{_0xc40c5[_0xe6a1('0x12')]=![];_0xc40c5['blockedAt']=null;}}_0xc40c5[_0xe6a1('0x3c')]=_0x5799f4;_0xc40c5[_0xe6a1('0x3d')]=Date[_0xe6a1('0x3e')]()+0x36ee80;return _0xc40c5[_0xe6a1('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0x136a32[_0xe6a1('0x33')][_0xe6a1('0x34')],'subject':_0xe6a1('0x40'),'text':_0xe6a1('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xe6a1('0x42')+_0x136a32[_0xe6a1('0x43')][_0xe6a1('0x44')]+_0xe6a1('0x45')+_0x5799f4+'\x0a\x0a'+_0xe6a1('0x46')});})[_0xe6a1('0xc')](function(){_0x36c7f1[_0xe6a1('0x28')](0xc8)[_0xe6a1('0x29')]({'message':_0xe6a1('0x47')});})[_0xe6a1('0x1d')](function(_0x9a9d23){return handleError(_0x36c7f1,0x1f4,_0x9a9d23);});};exports[_0xe6a1('0x48')]=function(_0x45e2e7,_0x12b9be){return db[_0xe6a1('0x37')][_0xe6a1('0x38')]({'where':{'resetPasswordToken':_0x45e2e7[_0xe6a1('0x49')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xe6a1('0xc')](function(_0x34d642){if(!_0x34d642){throw new Error(_0xe6a1('0x4a'));}return db['Setting'][_0xe6a1('0x9')]({'attributes':['id',_0xe6a1('0x4b'),_0xe6a1('0x4c'),'passwordHistoryLimit']})[_0xe6a1('0xc')](function(_0xf32fa9){if(_0xf32fa9[_0xe6a1('0x4b')])authService[_0xe6a1('0x4d')](_0x45e2e7[_0xe6a1('0x33')]['password']);if(!_0xf32fa9['enforcePasswordHistory']||!_0x34d642[_0xe6a1('0x4e')])return _0x34d642;authService['validatePasswordHistory'](_0x45e2e7[_0xe6a1('0x33')]['password'],_0x34d642['previousPasswords'],_0xf32fa9[_0xe6a1('0x4f')]);return _0x34d642;})[_0xe6a1('0xc')](function(){_0x34d642[_0xe6a1('0xe')]=_0x45e2e7[_0xe6a1('0x33')][_0xe6a1('0xe')];_0x34d642[_0xe6a1('0x3c')]=null;_0x34d642[_0xe6a1('0x3d')]=null;return _0x34d642[_0xe6a1('0x3f')]();});})[_0xe6a1('0xc')](function(){_0x12b9be[_0xe6a1('0x28')](0xc8)[_0xe6a1('0x29')]({'message':'Password\x20reset!'});})[_0xe6a1('0x1d')](function(_0x200399){return handleError(_0x12b9be,0x1f4,_0x200399);});};passport[_0xe6a1('0x50')]('local-login',new LocalStrategy({'usernameField':_0xe6a1('0xd'),'passwordField':_0xe6a1('0xe')},function(_0x3fe888,_0x2b7841,_0x23d82c){return localAuthenticate(db[_0xe6a1('0x37')],_0x3fe888,_0x2b7841,_0x23d82c);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 7069543..f4e94a5 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 _0xac4d=['post','login','/forgot','/reset/:token','reset','exports','express','Router'];(function(_0x561e27,_0xe63bf0){var _0x5c91fb=function(_0x5e2661){while(--_0x5e2661){_0x561e27['push'](_0x561e27['shift']());}};_0x5c91fb(++_0xe63bf0);}(_0xac4d,0x19e));var _0xdac4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xac4d[_0xa464c9];return _0x3d73c4;};'use strict';var express=require(_0xdac4('0x0'));var router=express[_0xdac4('0x1')]();var controller=require('./authLocal.controller');router[_0xdac4('0x2')]('/',controller[_0xdac4('0x3')]);router[_0xdac4('0x2')](_0xdac4('0x4'),controller['forgot']);router[_0xdac4('0x2')](_0xdac4('0x5'),controller[_0xdac4('0x6')]);module[_0xdac4('0x7')]=router; \ No newline at end of file +var _0x6ff2=['/forgot','forgot','/reset/:token','reset','express','Router','./authLocal.controller','post','login'];(function(_0x20f3bb,_0x3c59ae){var _0x247001=function(_0x537ad3){while(--_0x537ad3){_0x20f3bb['push'](_0x20f3bb['shift']());}};_0x247001(++_0x3c59ae);}(_0x6ff2,0x163));var _0x26ff=function(_0x894607,_0x4e9f66){_0x894607=_0x894607-0x0;var _0x5face3=_0x6ff2[_0x894607];return _0x5face3;};'use strict';var express=require(_0x26ff('0x0'));var router=express[_0x26ff('0x1')]();var controller=require(_0x26ff('0x2'));router[_0x26ff('0x3')]('/',controller[_0x26ff('0x4')]);router[_0x26ff('0x3')](_0x26ff('0x5'),controller[_0x26ff('0x6')]);router[_0x26ff('0x3')](_0x26ff('0x7'),controller[_0x26ff('0x8')]);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 030f798..7a917b9 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 _0xd175=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0xd175,0xbe));var _0x5d17=function(_0x477d58,_0x154115){_0x477d58=_0x477d58-0x0;var _0x72c330=_0xd175[_0x477d58];return _0x72c330;};'use strict';var Sequelize=require(_0x5d17('0x0'));module[_0x5d17('0x1')]={'name':{'type':Sequelize[_0x5d17('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5d17('0x2')]},'status':{'type':Sequelize[_0x5d17('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5d17('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xc9a3=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x534783,_0x26f7a8){var _0x1501a6=function(_0x31d148){while(--_0x31d148){_0x534783['push'](_0x534783['shift']());}};_0x1501a6(++_0x26f7a8);}(_0xc9a3,0x95));var _0x3c9a=function(_0x580e19,_0x5e5615){_0x580e19=_0x580e19-0x0;var _0x5a9247=_0xc9a3[_0x580e19];return _0x5a9247;};'use strict';var Sequelize=require(_0x3c9a('0x0'));module[_0x3c9a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x3c9a('0x2')]},'description':{'type':Sequelize[_0x3c9a('0x2')]},'status':{'type':Sequelize[_0x3c9a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3c9a('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 e33186e..206952b 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 _0x13c0=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','index','map','Automation','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','fields','include','body','find','params','addConditions','Condition','ids','getConditions','findOne','order','Action','omit','getActions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x45ea93,_0x5c86d5){var _0x1eaf65=function(_0x47a7db){while(--_0x47a7db){_0x45ea93['push'](_0x45ea93['shift']());}};_0x1eaf65(++_0x5c86d5);}(_0x13c0,0x93));var _0x013c=function(_0x264e7f,_0x4b8f91){_0x264e7f=_0x264e7f-0x0;var _0x173e6e=_0x13c0[_0x264e7f];return _0x173e6e;};'use strict';var emlformat=require(_0x013c('0x0'));var rimraf=require(_0x013c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x013c('0x2'));var moment=require(_0x013c('0x3'));var BPromise=require(_0x013c('0x4'));var Mustache=require(_0x013c('0x5'));var util=require(_0x013c('0x6'));var path=require(_0x013c('0x7'));var sox=require('sox');var csv=require(_0x013c('0x8'));var ejs=require(_0x013c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x013c('0xa'));var squel=require(_0x013c('0xb'));var crypto=require(_0x013c('0xc'));var jsforce=require(_0x013c('0xd'));var deskjs=require(_0x013c('0xe'));var toCsv=require(_0x013c('0x8'));var querystring=require(_0x013c('0xf'));var Papa=require(_0x013c('0x10'));var Redis=require(_0x013c('0x11'));var authService=require(_0x013c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x013c('0x13'));var logger=require(_0x013c('0x14'))('api');var utils=require(_0x013c('0x15'));var config=require(_0x013c('0x16'));var licenseUtil=require(_0x013c('0x17'));var db=require(_0x013c('0x18'))['db'];function respondWithStatusCode(_0x3e1605,_0x396406){_0x396406=_0x396406||0xcc;return function(_0x47b215){if(_0x47b215){return _0x3e1605[_0x013c('0x19')](_0x396406);}return _0x3e1605['status'](_0x396406)[_0x013c('0x1a')]();};}function respondWithResult(_0x16133c,_0x48742b){_0x48742b=_0x48742b||0xc8;return function(_0x19363e){if(_0x19363e){return _0x16133c[_0x013c('0x1b')](_0x48742b)['json'](_0x19363e);}};}function respondWithFilteredResult(_0x53b1b4,_0x433b14){return function(_0x507213){if(_0x507213){var _0x1019e4=typeof _0x433b14[_0x013c('0x1c')]===_0x013c('0x1d')&&typeof _0x433b14[_0x013c('0x1e')]===_0x013c('0x1d');var _0x43721b=_0x507213[_0x013c('0x1f')];var _0x1c51d5=_0x1019e4?0x0:_0x433b14['offset'];var _0x3feea6=_0x1019e4?_0x507213[_0x013c('0x1f')]:_0x433b14[_0x013c('0x1c')]+_0x433b14[_0x013c('0x1e')];var _0x5d57a2;if(_0x3feea6>=_0x43721b){_0x3feea6=_0x43721b;_0x5d57a2=0xc8;}else{_0x5d57a2=0xce;}_0x53b1b4[_0x013c('0x1b')](_0x5d57a2);return _0x53b1b4[_0x013c('0x20')](_0x013c('0x21'),_0x1c51d5+'-'+_0x3feea6+'/'+_0x43721b)['json'](_0x507213);}return null;};}function patchUpdates(_0x4ed8cb){return function(_0x17456d){try{jsonpatch[_0x013c('0x22')](_0x17456d,_0x4ed8cb,!![]);}catch(_0x504bc3){return BPromise[_0x013c('0x23')](_0x504bc3);}return _0x17456d[_0x013c('0x24')]();};}function saveUpdates(_0x1f7b67,_0xb6246){return function(_0x5f00a6){if(_0x5f00a6){return _0x5f00a6[_0x013c('0x25')](_0x1f7b67)[_0x013c('0x26')](function(_0x103bc0){return _0x103bc0;});}return null;};}function removeEntity(_0x216526,_0x509f77){return function(_0x58ef60){if(_0x58ef60){return _0x58ef60[_0x013c('0x27')]()[_0x013c('0x26')](function(){_0x216526[_0x013c('0x1b')](0xcc)[_0x013c('0x1a')]();});}};}function handleEntityNotFound(_0x2cbd5b,_0x2dfe93){return function(_0x55bc27){if(!_0x55bc27){_0x2cbd5b['sendStatus'](0x194);}return _0x55bc27;};}function handleError(_0x54fdfb,_0x1706f9){_0x1706f9=_0x1706f9||0x1f4;return function(_0x47e4c6){logger['error'](_0x47e4c6['stack']);if(_0x47e4c6[_0x013c('0x28')]){delete _0x47e4c6['name'];}_0x54fdfb[_0x013c('0x1b')](_0x1706f9)['send'](_0x47e4c6);};}exports[_0x013c('0x29')]=function(_0x203e86,_0x279c6e){var _0x5d4fce={},_0x3f31a6={},_0x4e6a83={'count':0x0,'rows':[]};var _0x3ff805=_[_0x013c('0x2a')](db[_0x013c('0x2b')][_0x013c('0x2c')],function(_0x4986d1){return{'name':_0x4986d1['fieldName'],'type':_0x4986d1['type'][_0x013c('0x2d')]};});_0x3f31a6[_0x013c('0x2e')]=_['map'](_0x3ff805,_0x013c('0x28'));_0x3f31a6[_0x013c('0x2f')]=_[_0x013c('0x30')](_0x203e86[_0x013c('0x2f')]);_0x3f31a6['filters']=_[_0x013c('0x31')](_0x3f31a6['model'],_0x3f31a6['query']);_0x5d4fce[_0x013c('0x32')]=_[_0x013c('0x31')](_0x3f31a6[_0x013c('0x2e')],qs['fields'](_0x203e86[_0x013c('0x2f')]['fields']));_0x5d4fce['attributes']=_0x5d4fce[_0x013c('0x32')][_0x013c('0x33')]?_0x5d4fce[_0x013c('0x32')]:_0x3f31a6[_0x013c('0x2e')];if(!_0x203e86[_0x013c('0x2f')][_0x013c('0x34')](_0x013c('0x35'))){_0x5d4fce[_0x013c('0x1e')]=qs[_0x013c('0x1e')](_0x203e86[_0x013c('0x2f')][_0x013c('0x1e')]);_0x5d4fce[_0x013c('0x1c')]=qs['offset'](_0x203e86[_0x013c('0x2f')][_0x013c('0x1c')]);}_0x5d4fce['order']=qs[_0x013c('0x36')](_0x203e86[_0x013c('0x2f')][_0x013c('0x36')]);_0x5d4fce[_0x013c('0x37')]=qs[_0x013c('0x38')](_[_0x013c('0x39')](_0x203e86[_0x013c('0x2f')],_0x3f31a6['filters']),_0x3ff805);if(_0x203e86[_0x013c('0x2f')][_0x013c('0x3a')]){_0x5d4fce[_0x013c('0x37')]=_[_0x013c('0x3b')](_0x5d4fce[_0x013c('0x37')],{'$or':_[_0x013c('0x2a')](_0x3ff805,function(_0x2c2590){if(_0x2c2590['type']!==_0x013c('0x3c')){var _0x589209={};_0x589209[_0x2c2590[_0x013c('0x28')]]={'$like':'%'+_0x203e86[_0x013c('0x2f')][_0x013c('0x3a')]+'%'};return _0x589209;}})});}_0x5d4fce=_[_0x013c('0x3b')]({},_0x5d4fce,_0x203e86[_0x013c('0x3d')]);var _0x2fa37a={'where':_0x5d4fce[_0x013c('0x37')]};return db['Automation']['count'](_0x2fa37a)[_0x013c('0x26')](function(_0x5214d7){_0x4e6a83[_0x013c('0x1f')]=_0x5214d7;if(_0x203e86[_0x013c('0x2f')][_0x013c('0x3e')]){_0x5d4fce['include']=[{'all':!![]}];}return db[_0x013c('0x2b')][_0x013c('0x3f')](_0x5d4fce);})[_0x013c('0x26')](function(_0x72cdd4){_0x4e6a83[_0x013c('0x40')]=_0x72cdd4;return _0x4e6a83;})[_0x013c('0x26')](respondWithFilteredResult(_0x279c6e,_0x5d4fce))[_0x013c('0x41')](handleError(_0x279c6e,null));};exports[_0x013c('0x42')]=function(_0x8d05,_0x24e448){var _0x3a8675={'raw':![],'where':{'id':_0x8d05['params']['id']}},_0x5a22f6={};_0x5a22f6[_0x013c('0x2e')]=_[_0x013c('0x30')](db['Automation'][_0x013c('0x2c')]);_0x5a22f6['query']=_[_0x013c('0x30')](_0x8d05[_0x013c('0x2f')]);_0x5a22f6[_0x013c('0x38')]=_[_0x013c('0x31')](_0x5a22f6[_0x013c('0x2e')],_0x5a22f6['query']);_0x3a8675['attributes']=_[_0x013c('0x31')](_0x5a22f6[_0x013c('0x2e')],qs[_0x013c('0x43')](_0x8d05[_0x013c('0x2f')][_0x013c('0x43')]));_0x3a8675[_0x013c('0x32')]=_0x3a8675[_0x013c('0x32')][_0x013c('0x33')]?_0x3a8675['attributes']:_0x5a22f6[_0x013c('0x2e')];if(_0x8d05[_0x013c('0x2f')][_0x013c('0x3e')]){_0x3a8675[_0x013c('0x44')]=[{'all':!![]}];}_0x3a8675=_[_0x013c('0x3b')]({},_0x3a8675,_0x8d05[_0x013c('0x3d')]);return db[_0x013c('0x2b')]['find'](_0x3a8675)[_0x013c('0x26')](handleEntityNotFound(_0x24e448,null))[_0x013c('0x26')](respondWithResult(_0x24e448,null))[_0x013c('0x41')](handleError(_0x24e448,null));};exports['create']=function(_0x466a5a,_0x43d990){return db['Automation']['create'](_0x466a5a[_0x013c('0x45')],{})[_0x013c('0x26')](respondWithResult(_0x43d990,0xc9))['catch'](handleError(_0x43d990,null));};exports['update']=function(_0x512d1d,_0x11ae7a){if(_0x512d1d[_0x013c('0x45')]['id']){delete _0x512d1d[_0x013c('0x45')]['id'];}return db[_0x013c('0x2b')][_0x013c('0x46')]({'where':{'id':_0x512d1d[_0x013c('0x47')]['id']}})[_0x013c('0x26')](handleEntityNotFound(_0x11ae7a,null))[_0x013c('0x26')](saveUpdates(_0x512d1d[_0x013c('0x45')],null))[_0x013c('0x26')](respondWithResult(_0x11ae7a,null))[_0x013c('0x41')](handleError(_0x11ae7a,null));};exports[_0x013c('0x27')]=function(_0x1a7466,_0x58175c){return db['Automation']['find']({'where':{'id':_0x1a7466['params']['id']}})[_0x013c('0x26')](handleEntityNotFound(_0x58175c,null))[_0x013c('0x26')](removeEntity(_0x58175c,null))[_0x013c('0x41')](handleError(_0x58175c,null));};exports[_0x013c('0x48')]=function(_0x37882d,_0x2816b5,_0xb98a86){return db[_0x013c('0x49')][_0x013c('0x46')]({'where':{'id':_0x37882d['params']['id']}})[_0x013c('0x26')](handleEntityNotFound(_0x2816b5,null))['then'](function(_0x533ca7){if(_0x533ca7){return _0x533ca7[_0x013c('0x48')](_0x37882d[_0x013c('0x45')][_0x013c('0x4a')],_['omit'](_0x37882d[_0x013c('0x45')],[_0x013c('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x2816b5,null))['catch'](handleError(_0x2816b5,null));};exports[_0x013c('0x4b')]=function(_0x49e69f,_0x2dcb9a,_0x25ca22){var _0x4f7875={};var _0x2c61c4={};var _0x37837f;var _0x57e319;return db[_0x013c('0x2b')][_0x013c('0x4c')]({'where':{'id':_0x49e69f['params']['id']}})[_0x013c('0x26')](handleEntityNotFound(_0x2dcb9a,null))[_0x013c('0x26')](function(_0x4f565b){if(_0x4f565b){_0x37837f=_0x4f565b;_0x2c61c4[_0x013c('0x2e')]=_[_0x013c('0x30')](db[_0x013c('0x49')]['rawAttributes']);_0x2c61c4['query']=_[_0x013c('0x30')](_0x49e69f[_0x013c('0x2f')]);_0x2c61c4[_0x013c('0x38')]=_['intersection'](_0x2c61c4['model'],_0x2c61c4['query']);_0x4f7875['attributes']=_['intersection'](_0x2c61c4[_0x013c('0x2e')],qs['fields'](_0x49e69f['query'][_0x013c('0x43')]));_0x4f7875[_0x013c('0x32')]=_0x4f7875[_0x013c('0x32')][_0x013c('0x33')]?_0x4f7875[_0x013c('0x32')]:_0x2c61c4['model'];_0x4f7875[_0x013c('0x4d')]=qs[_0x013c('0x36')](_0x49e69f[_0x013c('0x2f')][_0x013c('0x36')]);_0x4f7875['where']=qs[_0x013c('0x38')](_[_0x013c('0x39')](_0x49e69f['query'],_0x2c61c4[_0x013c('0x38')]));if(_0x49e69f[_0x013c('0x2f')][_0x013c('0x3a')]){_0x4f7875[_0x013c('0x37')]=_[_0x013c('0x3b')](_0x4f7875['where'],{'$or':_[_0x013c('0x2a')](_0x4f7875[_0x013c('0x32')],function(_0x39d104){var _0x11cc64={};_0x11cc64[_0x39d104]={'$like':'%'+_0x49e69f[_0x013c('0x2f')][_0x013c('0x3a')]+'%'};return _0x11cc64;})});}_0x4f7875=_[_0x013c('0x3b')]({},_0x4f7875,_0x49e69f[_0x013c('0x3d')]);return _0x37837f[_0x013c('0x4b')](_0x4f7875);}})['then'](function(_0x4c3ffd){if(_0x4c3ffd){_0x57e319=_0x4c3ffd['length'];if(!_0x49e69f[_0x013c('0x2f')]['hasOwnProperty'](_0x013c('0x35'))){_0x4f7875[_0x013c('0x1e')]=qs[_0x013c('0x1e')](_0x49e69f[_0x013c('0x2f')][_0x013c('0x1e')]);_0x4f7875[_0x013c('0x1c')]=qs[_0x013c('0x1c')](_0x49e69f[_0x013c('0x2f')][_0x013c('0x1c')]);}return _0x37837f[_0x013c('0x4b')](_0x4f7875);}})[_0x013c('0x26')](function(_0x43a55b){if(_0x43a55b){return _0x43a55b?{'count':_0x57e319,'rows':_0x43a55b}:null;}})[_0x013c('0x26')](respondWithResult(_0x2dcb9a,null))['catch'](handleError(_0x2dcb9a,null));};exports['addActions']=function(_0x59f52e,_0x1d6437,_0x57159a){return db[_0x013c('0x4e')][_0x013c('0x46')]({'where':{'id':_0x59f52e[_0x013c('0x47')]['id']}})[_0x013c('0x26')](handleEntityNotFound(_0x1d6437,null))[_0x013c('0x26')](function(_0x2118f8){if(_0x2118f8){return _0x2118f8['addActions'](_0x59f52e[_0x013c('0x45')]['ids'],_[_0x013c('0x4f')](_0x59f52e[_0x013c('0x45')],[_0x013c('0x4a'),'id'])||{});}})[_0x013c('0x26')](respondWithResult(_0x1d6437,null))['catch'](handleError(_0x1d6437,null));};exports[_0x013c('0x50')]=function(_0x340179,_0xd86e8e,_0x257bd0){var _0x26e3b6={};var _0x39d11a={};var _0x363565;var _0x245056;return db[_0x013c('0x2b')]['findOne']({'where':{'id':_0x340179['params']['id']}})[_0x013c('0x26')](handleEntityNotFound(_0xd86e8e,null))[_0x013c('0x26')](function(_0x5a910f){if(_0x5a910f){_0x363565=_0x5a910f;_0x39d11a[_0x013c('0x2e')]=_[_0x013c('0x30')](db[_0x013c('0x4e')][_0x013c('0x2c')]);_0x39d11a[_0x013c('0x2f')]=_['keys'](_0x340179[_0x013c('0x2f')]);_0x39d11a[_0x013c('0x38')]=_[_0x013c('0x31')](_0x39d11a[_0x013c('0x2e')],_0x39d11a[_0x013c('0x2f')]);_0x26e3b6[_0x013c('0x32')]=_[_0x013c('0x31')](_0x39d11a[_0x013c('0x2e')],qs[_0x013c('0x43')](_0x340179['query']['fields']));_0x26e3b6[_0x013c('0x32')]=_0x26e3b6[_0x013c('0x32')][_0x013c('0x33')]?_0x26e3b6[_0x013c('0x32')]:_0x39d11a[_0x013c('0x2e')];_0x26e3b6[_0x013c('0x4d')]=qs['sort'](_0x340179[_0x013c('0x2f')][_0x013c('0x36')]);_0x26e3b6[_0x013c('0x37')]=qs[_0x013c('0x38')](_[_0x013c('0x39')](_0x340179['query'],_0x39d11a['filters']));if(_0x340179[_0x013c('0x2f')][_0x013c('0x3a')]){_0x26e3b6[_0x013c('0x37')]=_[_0x013c('0x3b')](_0x26e3b6['where'],{'$or':_['map'](_0x26e3b6['attributes'],function(_0x4bbe23){var _0x4a33c0={};_0x4a33c0[_0x4bbe23]={'$like':'%'+_0x340179[_0x013c('0x2f')]['filter']+'%'};return _0x4a33c0;})});}_0x26e3b6=_[_0x013c('0x3b')]({},_0x26e3b6,_0x340179[_0x013c('0x3d')]);return _0x363565['getActions'](_0x26e3b6);}})[_0x013c('0x26')](function(_0x462d46){if(_0x462d46){_0x245056=_0x462d46[_0x013c('0x33')];if(!_0x340179[_0x013c('0x2f')]['hasOwnProperty']('nolimit')){_0x26e3b6[_0x013c('0x1e')]=qs['limit'](_0x340179[_0x013c('0x2f')][_0x013c('0x1e')]);_0x26e3b6[_0x013c('0x1c')]=qs[_0x013c('0x1c')](_0x340179[_0x013c('0x2f')]['offset']);}return _0x363565['getActions'](_0x26e3b6);}})['then'](function(_0x58fc0e){if(_0x58fc0e){return _0x58fc0e?{'count':_0x245056,'rows':_0x58fc0e}:null;}})['then'](respondWithResult(_0xd86e8e,null))[_0x013c('0x41')](handleError(_0xd86e8e,null));}; \ No newline at end of file +var _0x305d=['fields','attributes','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','update','destroy','addConditions','Condition','omit','getConditions','nolimit','Action','addActions','ids','getActions','findOne','pick','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection'];(function(_0x473738,_0x15ea31){var _0x1df4ae=function(_0x417a72){while(--_0x417a72){_0x473738['push'](_0x473738['shift']());}};_0x1df4ae(++_0x15ea31);}(_0x305d,0xc9));var _0xd305=function(_0x29f587,_0x839db3){_0x29f587=_0x29f587-0x0;var _0x2f84e0=_0x305d[_0x29f587];return _0x2f84e0;};'use strict';var emlformat=require(_0xd305('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd305('0x1'));var jsonpatch=require(_0xd305('0x2'));var rp=require(_0xd305('0x3'));var moment=require(_0xd305('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd305('0x5'));var util=require(_0xd305('0x6'));var path=require(_0xd305('0x7'));var sox=require(_0xd305('0x8'));var csv=require(_0xd305('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd305('0xa'));var _=require(_0xd305('0xb'));var squel=require('squel');var crypto=require(_0xd305('0xc'));var jsforce=require(_0xd305('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd305('0xe'));var Papa=require(_0xd305('0xf'));var Redis=require(_0xd305('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd305('0x11'));var as=require(_0xd305('0x12'));var hardwareService=require(_0xd305('0x13'));var logger=require(_0xd305('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd305('0x15'))['db'];function respondWithStatusCode(_0xb5e75a,_0x589ad4){_0x589ad4=_0x589ad4||0xcc;return function(_0x5ed25e){if(_0x5ed25e){return _0xb5e75a[_0xd305('0x16')](_0x589ad4);}return _0xb5e75a[_0xd305('0x17')](_0x589ad4)[_0xd305('0x18')]();};}function respondWithResult(_0x297e23,_0x4ab0c3){_0x4ab0c3=_0x4ab0c3||0xc8;return function(_0x55b36c){if(_0x55b36c){return _0x297e23['status'](_0x4ab0c3)[_0xd305('0x19')](_0x55b36c);}};}function respondWithFilteredResult(_0x154056,_0x39a95c){return function(_0x30a694){if(_0x30a694){var _0x1f9eb1=typeof _0x39a95c[_0xd305('0x1a')]===_0xd305('0x1b')&&typeof _0x39a95c['limit']===_0xd305('0x1b');var _0xca2bb2=_0x30a694[_0xd305('0x1c')];var _0x3a37e7=_0x1f9eb1?0x0:_0x39a95c[_0xd305('0x1a')];var _0xeed8db=_0x1f9eb1?_0x30a694['count']:_0x39a95c[_0xd305('0x1a')]+_0x39a95c[_0xd305('0x1d')];var _0x410a6f;if(_0xeed8db>=_0xca2bb2){_0xeed8db=_0xca2bb2;_0x410a6f=0xc8;}else{_0x410a6f=0xce;}_0x154056[_0xd305('0x17')](_0x410a6f);return _0x154056[_0xd305('0x1e')](_0xd305('0x1f'),_0x3a37e7+'-'+_0xeed8db+'/'+_0xca2bb2)['json'](_0x30a694);}return null;};}function patchUpdates(_0x10ec97){return function(_0x1095db){try{jsonpatch['apply'](_0x1095db,_0x10ec97,!![]);}catch(_0x4ade67){return BPromise[_0xd305('0x20')](_0x4ade67);}return _0x1095db[_0xd305('0x21')]();};}function saveUpdates(_0x4af413,_0x30f4a6){return function(_0x34cf04){if(_0x34cf04){return _0x34cf04['update'](_0x4af413)['then'](function(_0x33eff4){return _0x33eff4;});}return null;};}function removeEntity(_0x1fc339,_0x313bb0){return function(_0x1b8ae5){if(_0x1b8ae5){return _0x1b8ae5['destroy']()[_0xd305('0x22')](function(){_0x1fc339[_0xd305('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b7cdd,_0x2a992c){return function(_0x34e24b){if(!_0x34e24b){_0x3b7cdd[_0xd305('0x16')](0x194);}return _0x34e24b;};}function handleError(_0xbc29d1,_0x1ecd18){_0x1ecd18=_0x1ecd18||0x1f4;return function(_0x6b2aa){logger[_0xd305('0x23')](_0x6b2aa[_0xd305('0x24')]);if(_0x6b2aa[_0xd305('0x25')]){delete _0x6b2aa[_0xd305('0x25')];}_0xbc29d1[_0xd305('0x17')](_0x1ecd18)[_0xd305('0x26')](_0x6b2aa);};}exports[_0xd305('0x27')]=function(_0x553a6a,_0xbcf0b1){var _0x4f1702={},_0x16f917={},_0x3cb5f9={'count':0x0,'rows':[]};var _0x499ac5=_['map'](db[_0xd305('0x28')][_0xd305('0x29')],function(_0x34ebc1){return{'name':_0x34ebc1[_0xd305('0x2a')],'type':_0x34ebc1[_0xd305('0x2b')][_0xd305('0x2c')]};});_0x16f917[_0xd305('0x2d')]=_[_0xd305('0x2e')](_0x499ac5,_0xd305('0x25'));_0x16f917[_0xd305('0x2f')]=_[_0xd305('0x30')](_0x553a6a[_0xd305('0x2f')]);_0x16f917[_0xd305('0x31')]=_[_0xd305('0x32')](_0x16f917[_0xd305('0x2d')],_0x16f917[_0xd305('0x2f')]);_0x4f1702['attributes']=_['intersection'](_0x16f917['model'],qs[_0xd305('0x33')](_0x553a6a['query'][_0xd305('0x33')]));_0x4f1702[_0xd305('0x34')]=_0x4f1702[_0xd305('0x34')][_0xd305('0x35')]?_0x4f1702[_0xd305('0x34')]:_0x16f917[_0xd305('0x2d')];if(!_0x553a6a[_0xd305('0x2f')][_0xd305('0x36')]('nolimit')){_0x4f1702[_0xd305('0x1d')]=qs['limit'](_0x553a6a['query']['limit']);_0x4f1702[_0xd305('0x1a')]=qs[_0xd305('0x1a')](_0x553a6a['query'][_0xd305('0x1a')]);}_0x4f1702[_0xd305('0x37')]=qs[_0xd305('0x38')](_0x553a6a[_0xd305('0x2f')][_0xd305('0x38')]);_0x4f1702['where']=qs[_0xd305('0x31')](_['pick'](_0x553a6a['query'],_0x16f917[_0xd305('0x31')]),_0x499ac5);if(_0x553a6a[_0xd305('0x2f')]['filter']){_0x4f1702[_0xd305('0x39')]=_['merge'](_0x4f1702[_0xd305('0x39')],{'$or':_[_0xd305('0x2e')](_0x499ac5,function(_0x1f02be){if(_0x1f02be[_0xd305('0x2b')]!==_0xd305('0x3a')){var _0x2a9a42={};_0x2a9a42[_0x1f02be['name']]={'$like':'%'+_0x553a6a['query'][_0xd305('0x3b')]+'%'};return _0x2a9a42;}})});}_0x4f1702=_[_0xd305('0x3c')]({},_0x4f1702,_0x553a6a[_0xd305('0x3d')]);var _0x1d9ae0={'where':_0x4f1702[_0xd305('0x39')]};return db['Automation'][_0xd305('0x1c')](_0x1d9ae0)[_0xd305('0x22')](function(_0xfdfb89){_0x3cb5f9[_0xd305('0x1c')]=_0xfdfb89;if(_0x553a6a['query'][_0xd305('0x3e')]){_0x4f1702[_0xd305('0x3f')]=[{'all':!![]}];}return db[_0xd305('0x28')]['findAll'](_0x4f1702);})[_0xd305('0x22')](function(_0x3c8517){_0x3cb5f9[_0xd305('0x40')]=_0x3c8517;return _0x3cb5f9;})[_0xd305('0x22')](respondWithFilteredResult(_0xbcf0b1,_0x4f1702))['catch'](handleError(_0xbcf0b1,null));};exports[_0xd305('0x41')]=function(_0x2ed57a,_0x1e8e9c){var _0x5712b4={'raw':![],'where':{'id':_0x2ed57a[_0xd305('0x42')]['id']}},_0x87311f={};_0x87311f[_0xd305('0x2d')]=_[_0xd305('0x30')](db[_0xd305('0x28')][_0xd305('0x29')]);_0x87311f[_0xd305('0x2f')]=_[_0xd305('0x30')](_0x2ed57a['query']);_0x87311f['filters']=_['intersection'](_0x87311f[_0xd305('0x2d')],_0x87311f[_0xd305('0x2f')]);_0x5712b4[_0xd305('0x34')]=_[_0xd305('0x32')](_0x87311f[_0xd305('0x2d')],qs[_0xd305('0x33')](_0x2ed57a[_0xd305('0x2f')]['fields']));_0x5712b4['attributes']=_0x5712b4[_0xd305('0x34')][_0xd305('0x35')]?_0x5712b4[_0xd305('0x34')]:_0x87311f['model'];if(_0x2ed57a[_0xd305('0x2f')]['includeAll']){_0x5712b4[_0xd305('0x3f')]=[{'all':!![]}];}_0x5712b4=_['merge']({},_0x5712b4,_0x2ed57a[_0xd305('0x3d')]);return db[_0xd305('0x28')][_0xd305('0x43')](_0x5712b4)[_0xd305('0x22')](handleEntityNotFound(_0x1e8e9c,null))[_0xd305('0x22')](respondWithResult(_0x1e8e9c,null))[_0xd305('0x44')](handleError(_0x1e8e9c,null));};exports['create']=function(_0x18d1a0,_0x1acbad){return db[_0xd305('0x28')][_0xd305('0x45')](_0x18d1a0[_0xd305('0x46')],{})['then'](respondWithResult(_0x1acbad,0xc9))[_0xd305('0x44')](handleError(_0x1acbad,null));};exports[_0xd305('0x47')]=function(_0x339310,_0x42f847){if(_0x339310[_0xd305('0x46')]['id']){delete _0x339310[_0xd305('0x46')]['id'];}return db[_0xd305('0x28')][_0xd305('0x43')]({'where':{'id':_0x339310['params']['id']}})['then'](handleEntityNotFound(_0x42f847,null))['then'](saveUpdates(_0x339310['body'],null))[_0xd305('0x22')](respondWithResult(_0x42f847,null))[_0xd305('0x44')](handleError(_0x42f847,null));};exports[_0xd305('0x48')]=function(_0x32fc6b,_0x4df0dc){return db[_0xd305('0x28')][_0xd305('0x43')]({'where':{'id':_0x32fc6b[_0xd305('0x42')]['id']}})[_0xd305('0x22')](handleEntityNotFound(_0x4df0dc,null))[_0xd305('0x22')](removeEntity(_0x4df0dc,null))['catch'](handleError(_0x4df0dc,null));};exports[_0xd305('0x49')]=function(_0x8986a0,_0x585a64,_0x8bbe71){return db[_0xd305('0x4a')]['find']({'where':{'id':_0x8986a0[_0xd305('0x42')]['id']}})[_0xd305('0x22')](handleEntityNotFound(_0x585a64,null))[_0xd305('0x22')](function(_0x6a9c60){if(_0x6a9c60){return _0x6a9c60[_0xd305('0x49')](_0x8986a0[_0xd305('0x46')]['ids'],_[_0xd305('0x4b')](_0x8986a0[_0xd305('0x46')],['ids','id'])||{});}})[_0xd305('0x22')](respondWithResult(_0x585a64,null))['catch'](handleError(_0x585a64,null));};exports[_0xd305('0x4c')]=function(_0x2bab03,_0x3678b8,_0x187ea1){var _0xf044ad={};var _0x3621f6={};var _0x46d604;var _0x28f820;return db[_0xd305('0x28')]['findOne']({'where':{'id':_0x2bab03[_0xd305('0x42')]['id']}})[_0xd305('0x22')](handleEntityNotFound(_0x3678b8,null))[_0xd305('0x22')](function(_0x48d1b6){if(_0x48d1b6){_0x46d604=_0x48d1b6;_0x3621f6['model']=_[_0xd305('0x30')](db[_0xd305('0x4a')][_0xd305('0x29')]);_0x3621f6['query']=_[_0xd305('0x30')](_0x2bab03[_0xd305('0x2f')]);_0x3621f6[_0xd305('0x31')]=_[_0xd305('0x32')](_0x3621f6[_0xd305('0x2d')],_0x3621f6[_0xd305('0x2f')]);_0xf044ad['attributes']=_[_0xd305('0x32')](_0x3621f6[_0xd305('0x2d')],qs[_0xd305('0x33')](_0x2bab03[_0xd305('0x2f')][_0xd305('0x33')]));_0xf044ad['attributes']=_0xf044ad[_0xd305('0x34')][_0xd305('0x35')]?_0xf044ad['attributes']:_0x3621f6['model'];_0xf044ad['order']=qs[_0xd305('0x38')](_0x2bab03[_0xd305('0x2f')][_0xd305('0x38')]);_0xf044ad['where']=qs[_0xd305('0x31')](_['pick'](_0x2bab03[_0xd305('0x2f')],_0x3621f6['filters']));if(_0x2bab03[_0xd305('0x2f')][_0xd305('0x3b')]){_0xf044ad['where']=_[_0xd305('0x3c')](_0xf044ad[_0xd305('0x39')],{'$or':_[_0xd305('0x2e')](_0xf044ad[_0xd305('0x34')],function(_0x1557e0){var _0x24cc3e={};_0x24cc3e[_0x1557e0]={'$like':'%'+_0x2bab03[_0xd305('0x2f')][_0xd305('0x3b')]+'%'};return _0x24cc3e;})});}_0xf044ad=_[_0xd305('0x3c')]({},_0xf044ad,_0x2bab03[_0xd305('0x3d')]);return _0x46d604[_0xd305('0x4c')](_0xf044ad);}})[_0xd305('0x22')](function(_0x528b7d){if(_0x528b7d){_0x28f820=_0x528b7d[_0xd305('0x35')];if(!_0x2bab03['query'][_0xd305('0x36')](_0xd305('0x4d'))){_0xf044ad[_0xd305('0x1d')]=qs[_0xd305('0x1d')](_0x2bab03[_0xd305('0x2f')][_0xd305('0x1d')]);_0xf044ad[_0xd305('0x1a')]=qs[_0xd305('0x1a')](_0x2bab03[_0xd305('0x2f')][_0xd305('0x1a')]);}return _0x46d604['getConditions'](_0xf044ad);}})[_0xd305('0x22')](function(_0x8c007d){if(_0x8c007d){return _0x8c007d?{'count':_0x28f820,'rows':_0x8c007d}:null;}})[_0xd305('0x22')](respondWithResult(_0x3678b8,null))[_0xd305('0x44')](handleError(_0x3678b8,null));};exports['addActions']=function(_0x32fb5c,_0x5b1d26,_0x3d64cb){return db[_0xd305('0x4e')]['find']({'where':{'id':_0x32fb5c[_0xd305('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b1d26,null))[_0xd305('0x22')](function(_0x4a94df){if(_0x4a94df){return _0x4a94df[_0xd305('0x4f')](_0x32fb5c[_0xd305('0x46')][_0xd305('0x50')],_[_0xd305('0x4b')](_0x32fb5c[_0xd305('0x46')],['ids','id'])||{});}})[_0xd305('0x22')](respondWithResult(_0x5b1d26,null))[_0xd305('0x44')](handleError(_0x5b1d26,null));};exports[_0xd305('0x51')]=function(_0x1d08fb,_0x22580c,_0x33bfee){var _0xff4232={};var _0x42f6ae={};var _0x30b566;var _0x58a2b0;return db['Automation'][_0xd305('0x52')]({'where':{'id':_0x1d08fb[_0xd305('0x42')]['id']}})[_0xd305('0x22')](handleEntityNotFound(_0x22580c,null))[_0xd305('0x22')](function(_0x19386d){if(_0x19386d){_0x30b566=_0x19386d;_0x42f6ae[_0xd305('0x2d')]=_[_0xd305('0x30')](db[_0xd305('0x4e')][_0xd305('0x29')]);_0x42f6ae[_0xd305('0x2f')]=_[_0xd305('0x30')](_0x1d08fb['query']);_0x42f6ae['filters']=_[_0xd305('0x32')](_0x42f6ae[_0xd305('0x2d')],_0x42f6ae[_0xd305('0x2f')]);_0xff4232[_0xd305('0x34')]=_[_0xd305('0x32')](_0x42f6ae[_0xd305('0x2d')],qs[_0xd305('0x33')](_0x1d08fb[_0xd305('0x2f')][_0xd305('0x33')]));_0xff4232[_0xd305('0x34')]=_0xff4232[_0xd305('0x34')][_0xd305('0x35')]?_0xff4232[_0xd305('0x34')]:_0x42f6ae[_0xd305('0x2d')];_0xff4232[_0xd305('0x37')]=qs['sort'](_0x1d08fb['query'][_0xd305('0x38')]);_0xff4232[_0xd305('0x39')]=qs[_0xd305('0x31')](_[_0xd305('0x53')](_0x1d08fb[_0xd305('0x2f')],_0x42f6ae['filters']));if(_0x1d08fb[_0xd305('0x2f')][_0xd305('0x3b')]){_0xff4232[_0xd305('0x39')]=_[_0xd305('0x3c')](_0xff4232[_0xd305('0x39')],{'$or':_['map'](_0xff4232[_0xd305('0x34')],function(_0x3b37fe){var _0x36cbf5={};_0x36cbf5[_0x3b37fe]={'$like':'%'+_0x1d08fb[_0xd305('0x2f')]['filter']+'%'};return _0x36cbf5;})});}_0xff4232=_['merge']({},_0xff4232,_0x1d08fb['options']);return _0x30b566[_0xd305('0x51')](_0xff4232);}})[_0xd305('0x22')](function(_0x177ba4){if(_0x177ba4){_0x58a2b0=_0x177ba4['length'];if(!_0x1d08fb[_0xd305('0x2f')][_0xd305('0x36')](_0xd305('0x4d'))){_0xff4232[_0xd305('0x1d')]=qs['limit'](_0x1d08fb[_0xd305('0x2f')][_0xd305('0x1d')]);_0xff4232['offset']=qs[_0xd305('0x1a')](_0x1d08fb['query'][_0xd305('0x1a')]);}return _0x30b566['getActions'](_0xff4232);}})[_0xd305('0x22')](function(_0x10f417){if(_0x10f417){return _0x10f417?{'count':_0x58a2b0,'rows':_0x10f417}:null;}})[_0xd305('0x22')](respondWithResult(_0x22580c,null))[_0xd305('0x44')](handleError(_0x22580c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 3e3cac0..8f41746 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 _0x2135=['tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','define','Automation'];(function(_0x3d3ae9,_0x334c52){var _0x31b364=function(_0x6aa61c){while(--_0x6aa61c){_0x3d3ae9['push'](_0x3d3ae9['shift']());}};_0x31b364(++_0x334c52);}(_0x2135,0x11f));var _0x5213=function(_0x347a3c,_0x7ca6a7){_0x347a3c=_0x347a3c-0x0;var _0x4395b4=_0x2135[_0x347a3c];return _0x4395b4;};'use strict';var _=require(_0x5213('0x0'));var util=require(_0x5213('0x1'));var logger=require(_0x5213('0x2'))(_0x5213('0x3'));var moment=require(_0x5213('0x4'));var BPromise=require(_0x5213('0x5'));var rp=require(_0x5213('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5213('0x7'));var config=require(_0x5213('0x8'));var attributes=require(_0x5213('0x9'));module['exports']=function(_0x3b86f9,_0x3ff830){return _0x3b86f9[_0x5213('0xa')](_0x5213('0xb'),attributes,{'tableName':_0x5213('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46c5=['moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','define','lodash','../../config/logger','api'];(function(_0x2b2856,_0x5a00af){var _0x167582=function(_0x2b4468){while(--_0x2b4468){_0x2b2856['push'](_0x2b2856['shift']());}};_0x167582(++_0x5a00af);}(_0x46c5,0x6b));var _0x546c=function(_0x5e9dd6,_0x5286b1){_0x5e9dd6=_0x5e9dd6-0x0;var _0x3266a7=_0x46c5[_0x5e9dd6];return _0x3266a7;};'use strict';var _=require(_0x546c('0x0'));var util=require('util');var logger=require(_0x546c('0x1'))(_0x546c('0x2'));var moment=require(_0x546c('0x3'));var BPromise=require(_0x546c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x546c('0x5'));var rimraf=require(_0x546c('0x6'));var config=require(_0x546c('0x7'));var attributes=require(_0x546c('0x8'));module['exports']=function(_0x198979,_0x216ff1){return _0x198979[_0x546c('0x9')]('Automation',attributes,{'tableName':'tools_automations','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 6d7610d..475dd76 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 _0xa958=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring'];(function(_0x27f972,_0x37dc34){var _0xd73923=function(_0x4ed563){while(--_0x4ed563){_0x27f972['push'](_0x27f972['shift']());}};_0xd73923(++_0x37dc34);}(_0xa958,0x94));var _0x8a95=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa958[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var moment=require(_0x8a95('0x1'));var BPromise=require(_0x8a95('0x2'));var rs=require(_0x8a95('0x3'));var fs=require('fs');var Redis=require(_0x8a95('0x4'));var db=require(_0x8a95('0x5'))['db'];var utils=require(_0x8a95('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a95('0x7'));var jayson=require(_0x8a95('0x8'));var client=jayson[_0x8a95('0x9')][_0x8a95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387db4,_0xdd54e1,_0x161f00){return new BPromise(function(_0x49287d,_0xe03b31){return client[_0x8a95('0xb')](_0x387db4,_0x161f00)[_0x8a95('0xc')](function(_0x240b22){logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));logger['debug'](_0x8a95('0x10'),_0xdd54e1,_0x8a95('0xf'),JSON['stringify'](_0x240b22));if(_0x240b22[_0x8a95('0x11')]){if(_0x240b22['error']['code']===0x1f4){logger[_0x8a95('0x11')]('Automation,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0xe03b31(_0x240b22['error'][_0x8a95('0x12')]);}logger[_0x8a95('0x11')]('Automation,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0x49287d(_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);}else{logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));_0x49287d(_0x240b22['result'][_0x8a95('0x12')]);}})['catch'](function(_0x334b18){logger['error'](_0x8a95('0xe'),_0xdd54e1,_0x334b18);_0xe03b31(_0x334b18);});});} \ No newline at end of file +var _0x75b6=['result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3d4b69,_0x36e918){var _0x2fde5e=function(_0x1a4e39){while(--_0x1a4e39){_0x3d4b69['push'](_0x3d4b69['shift']());}};_0x2fde5e(++_0x36e918);}(_0x75b6,0x1a4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x675b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x675b('0x1'));var rs=require(_0x675b('0x2'));var fs=require('fs');var Redis=require(_0x675b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x675b('0x4'));var logger=require(_0x675b('0x5'))(_0x675b('0x6'));var config=require('../../config/environment');var jayson=require(_0x675b('0x7'));var client=jayson['client'][_0x675b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a7a7a,_0x3f34b8,_0x556239){return new BPromise(function(_0x1bff7d,_0x4f55d4){return client[_0x675b('0x9')](_0x3a7a7a,_0x556239)[_0x675b('0xa')](function(_0x24cf1c){logger[_0x675b('0xb')](_0x675b('0xc'),_0x3f34b8,_0x675b('0xd'));logger[_0x675b('0xe')](_0x675b('0xf'),_0x3f34b8,_0x675b('0xd'),JSON[_0x675b('0x10')](_0x24cf1c));if(_0x24cf1c['error']){if(_0x24cf1c[_0x675b('0x11')][_0x675b('0x12')]===0x1f4){logger[_0x675b('0x11')](_0x675b('0xc'),_0x3f34b8,_0x24cf1c['error']['message']);return _0x4f55d4(_0x24cf1c['error']['message']);}logger['error'](_0x675b('0xc'),_0x3f34b8,_0x24cf1c['error']['message']);return _0x1bff7d(_0x24cf1c[_0x675b('0x11')][_0x675b('0x13')]);}else{logger[_0x675b('0xb')](_0x675b('0xc'),_0x3f34b8,'request\x20sent');_0x1bff7d(_0x24cf1c[_0x675b('0x14')][_0x675b('0x13')]);}})[_0x675b('0x15')](function(_0x17c3fc){logger[_0x675b('0x11')](_0x675b('0xc'),_0x3f34b8,_0x17c3fc);_0x4f55d4(_0x17c3fc);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 7dd3b64..abe443d 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 _0x58f4=['post','create','/:id/conditions','addConditions','addActions','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','getConditions','/:id/actions','getActions'];(function(_0x557783,_0x16d8bb){var _0x728269=function(_0x10402b){while(--_0x10402b){_0x557783['push'](_0x557783['shift']());}};_0x728269(++_0x16d8bb);}(_0x58f4,0x1b2));var _0x458f=function(_0x8d8c0,_0xd3dd86){_0x8d8c0=_0x8d8c0-0x0;var _0xff1b13=_0x58f4[_0x8d8c0];return _0xff1b13;};'use strict';var multer=require('multer');var util=require(_0x458f('0x0'));var path=require(_0x458f('0x1'));var timeout=require(_0x458f('0x2'));var express=require(_0x458f('0x3'));var router=express[_0x458f('0x4')]();var fs_extra=require(_0x458f('0x5'));var auth=require(_0x458f('0x6'));var interaction=require(_0x458f('0x7'));var config=require(_0x458f('0x8'));var controller=require(_0x458f('0x9'));router[_0x458f('0xa')]('/',auth[_0x458f('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x458f('0xc')]);router[_0x458f('0xa')]('/:id/conditions',auth[_0x458f('0xb')](),controller[_0x458f('0xd')]);router[_0x458f('0xa')](_0x458f('0xe'),auth[_0x458f('0xb')](),controller[_0x458f('0xf')]);router[_0x458f('0x10')]('/',auth['isAuthenticated'](),controller[_0x458f('0x11')]);router[_0x458f('0x10')](_0x458f('0x12'),auth[_0x458f('0xb')](),controller[_0x458f('0x13')]);router[_0x458f('0x10')](_0x458f('0xe'),auth[_0x458f('0xb')](),controller[_0x458f('0x14')]);router['put'](_0x458f('0x15'),auth[_0x458f('0xb')](),controller[_0x458f('0x16')]);router['delete'](_0x458f('0x15'),auth['isAuthenticated'](),controller[_0x458f('0x17')]);module[_0x458f('0x18')]=router; \ No newline at end of file +var _0xb7cf=['show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id'];(function(_0x7097e8,_0x53e913){var _0x212772=function(_0x862906){while(--_0x862906){_0x7097e8['push'](_0x7097e8['shift']());}};_0x212772(++_0x53e913);}(_0xb7cf,0xca));var _0xfb7c=function(_0x18894b,_0xb20093){_0x18894b=_0x18894b-0x0;var _0x4b3230=_0xb7cf[_0x18894b];return _0x4b3230;};'use strict';var multer=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var path=require(_0xfb7c('0x2'));var timeout=require(_0xfb7c('0x3'));var express=require(_0xfb7c('0x4'));var router=express['Router']();var fs_extra=require(_0xfb7c('0x5'));var auth=require(_0xfb7c('0x6'));var interaction=require(_0xfb7c('0x7'));var config=require(_0xfb7c('0x8'));var controller=require(_0xfb7c('0x9'));router[_0xfb7c('0xa')]('/',auth[_0xfb7c('0xb')](),controller[_0xfb7c('0xc')]);router[_0xfb7c('0xa')](_0xfb7c('0xd'),auth[_0xfb7c('0xb')](),controller[_0xfb7c('0xe')]);router[_0xfb7c('0xa')](_0xfb7c('0xf'),auth['isAuthenticated'](),controller[_0xfb7c('0x10')]);router[_0xfb7c('0xa')](_0xfb7c('0x11'),auth['isAuthenticated'](),controller[_0xfb7c('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfb7c('0x13')]);router[_0xfb7c('0x14')](_0xfb7c('0xf'),auth[_0xfb7c('0xb')](),controller[_0xfb7c('0x15')]);router[_0xfb7c('0x14')](_0xfb7c('0x11'),auth[_0xfb7c('0xb')](),controller['addActions']);router[_0xfb7c('0x16')](_0xfb7c('0xd'),auth['isAuthenticated'](),controller[_0xfb7c('0x17')]);router[_0xfb7c('0x18')](_0xfb7c('0xd'),auth[_0xfb7c('0xb')](),controller[_0xfb7c('0x19')]);module[_0xfb7c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 804218c..35832d3 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 _0xd0cd=['Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\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)','ENUM','never','onlyIfOpen','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED'];(function(_0x416cf3,_0x53bf9){var _0x32a97a=function(_0x457e79){while(--_0x457e79){_0x416cf3['push'](_0x416cf3['shift']());}};_0x32a97a(++_0x53bf9);}(_0xd0cd,0xe7));var _0xdd0c=function(_0xd6aad,_0x3fd78e){_0xd6aad=_0xd6aad-0x0;var _0x1109e6=_0xd0cd[_0xd6aad];return _0x1109e6;};'use strict';var Sequelize=require(_0xdd0c('0x0'));module[_0xdd0c('0x1')]={'name':{'type':Sequelize[_0xdd0c('0x2')],'unique':_0xdd0c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xdd0c('0x4')),'allowNull':![],'defaultValue':_0xdd0c('0x4')},'description':{'type':Sequelize[_0xdd0c('0x2')]},'active':{'type':Sequelize[_0xdd0c('0x5')],'defaultValue':0x0,'comment':_0xdd0c('0x6')},'limitCalls':{'type':Sequelize[_0xdd0c('0x7')](0x4)[_0xdd0c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xdd0c('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xdd0c('0x7')](0x3)[_0xdd0c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd0c('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd0c('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdd0c('0x7')](0x5)[_0xdd0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xdd0c('0x7')](0x3)[_0xdd0c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xdd0c('0x7')](0x5)[_0xdd0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd0c('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xdd0c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xdd0c('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdd0c('0x7')](0x5)[_0xdd0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd0c('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdd0c('0x7')](0x3)[_0xdd0c('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdd0c('0xf')},'dialTimezone':{'type':Sequelize[_0xdd0c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xdd0c('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xdd0c('0x10')]('always',_0xdd0c('0x11'),_0xdd0c('0x12')),'defaultValue':_0xdd0c('0x13')},'dialAMDActive':{'type':Sequelize[_0xdd0c('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdd0c('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdd0c('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xdd0c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdd0c('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xdd0c('0x7')](0x9)[_0xdd0c('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdd0c('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdd0c('0x7')](0x9)[_0xdd0c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd0c('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xdd0c('0x7')](0x9)[_0xdd0c('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdd0c('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdd0c('0x7')](0x9)[_0xdd0c('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdd0c('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xdd0c('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xdd0c('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xdd0c('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xdd0c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdd0c('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xdd0c('0x10')]('DESC','ASC'),'defaultValue':_0xdd0c('0x1d')},'dialPrefix':{'type':Sequelize[_0xdd0c('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xdd0c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdd0c('0x1e')},'dialCutDigit':{'type':Sequelize[_0xdd0c('0x7')](0x3)[_0xdd0c('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdd0c('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdd0c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd0c('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xdd0c('0x7')](0x5)[_0xdd0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd0c('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0xdd0c('0x7')](0x3)[_0xdd0c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd0c('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0xdd0c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdd0c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd0c('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdd0c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd0c('0x24')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xdd0c('0x7')](0x5)[_0xdd0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd0c('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdd0c('0x7')](0x3)[_0xdd0c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdd0c('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdd0c('0x7')](0x5)[_0xdd0c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdd0c('0x27')}}; \ No newline at end of file +var _0x18cb=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x4b7869,_0x58b7ae){var _0x5546a0=function(_0x35caca){while(--_0x35caca){_0x4b7869['push'](_0x4b7869['shift']());}};_0x5546a0(++_0x58b7ae);}(_0x18cb,0xe6));var _0xb18c=function(_0x1970ea,_0x350f30){_0x1970ea=_0x1970ea-0x0;var _0x15b654=_0x18cb[_0x1970ea];return _0x15b654;};'use strict';var Sequelize=require(_0xb18c('0x0'));module[_0xb18c('0x1')]={'name':{'type':Sequelize[_0xb18c('0x2')],'unique':_0xb18c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb18c('0x4')](_0xb18c('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xb18c('0x2')]},'active':{'type':Sequelize[_0xb18c('0x6')],'defaultValue':0x0,'comment':_0xb18c('0x7')},'limitCalls':{'type':Sequelize[_0xb18c('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb18c('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb18c('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb18c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xb18c('0x8')](0x3)[_0xb18c('0xa')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb18c('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb18c('0x8')](0x3)[_0xb18c('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb18c('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb18c('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb18c('0xd')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb18c('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb18c('0xa')],'defaultValue':0x3,'comment':_0xb18c('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb18c('0x8')](0x5)[_0xb18c('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb18c('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xb18c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb18c('0x2')],'defaultValue':_0xb18c('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xb18c('0x4')](_0xb18c('0x10'),_0xb18c('0x11'),_0xb18c('0x12')),'defaultValue':_0xb18c('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb18c('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xb18c('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb18c('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xb18c('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb18c('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb18c('0x8')](0x9)[_0xb18c('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xb18c('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb18c('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xb18c('0x8')](0x9)[_0xb18c('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb18c('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb18c('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb18c('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb18c('0x8')](0x9)[_0xb18c('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb18c('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb18c('0x8')](0x5)[_0xb18c('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb18c('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb18c('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xb18c('0x1b'),_0xb18c('0x1c')),'defaultValue':_0xb18c('0x1b')},'dialPrefix':{'type':Sequelize[_0xb18c('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb18c('0x8')](0x3)[_0xb18c('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb18c('0x1d')},'dialCutDigit':{'type':Sequelize[_0xb18c('0x8')](0x3)[_0xb18c('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb18c('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb18c('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb18c('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb18c('0x8')](0x5)[_0xb18c('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb18c('0x20')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb18c('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb18c('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xb18c('0x8')](0x5)[_0xb18c('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb18c('0x8')](0x3)[_0xb18c('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb18c('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb18c('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xb18c('0x8')](0x3)[_0xb18c('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xb18c('0x8')](0x5)[_0xb18c('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb18c('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb18c('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb18c('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb18c('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb18c('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 4ca48e7..f9e9710 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 _0x7a4f=['VIRTUAL','options','includeAll','include','findAll','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','omit','createdAt','updatedAt','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','nolimit','CampaignId','filter','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','phone','field','NOW()','ListId','toString','from','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_contacts','cm_hopper_additional_phones','cmHopperId','OrderBy','ci.item','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','removeLists','getBlackLists','addBlackLists','all','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type'];(function(_0x454b10,_0x5a15a5){var _0x50252c=function(_0x5b7326){while(--_0x5b7326){_0x454b10['push'](_0x454b10['shift']());}};_0x50252c(++_0x5a15a5);}(_0x7a4f,0x17a));var _0xf7a4=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x7a4f[_0x87239];return _0x53af1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7a4('0x0'));var zipdir=require(_0xf7a4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7a4('0x2'));var moment=require(_0xf7a4('0x3'));var BPromise=require(_0xf7a4('0x4'));var Mustache=require(_0xf7a4('0x5'));var util=require('util');var path=require(_0xf7a4('0x6'));var sox=require('sox');var csv=require(_0xf7a4('0x7'));var ejs=require(_0xf7a4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7a4('0x9'));var squel=require(_0xf7a4('0xa'));var crypto=require(_0xf7a4('0xb'));var jsforce=require(_0xf7a4('0xc'));var deskjs=require(_0xf7a4('0xd'));var toCsv=require(_0xf7a4('0x7'));var querystring=require(_0xf7a4('0xe'));var Papa=require(_0xf7a4('0xf'));var Redis=require(_0xf7a4('0x10'));var authService=require(_0xf7a4('0x11'));var qs=require(_0xf7a4('0x12'));var as=require(_0xf7a4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7a4('0x14'))(_0xf7a4('0x15'));var utils=require('../../config/utils');var config=require(_0xf7a4('0x16'));var licenseUtil=require(_0xf7a4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19a322,_0x204eb1){_0x204eb1=_0x204eb1||0xcc;return function(_0x10ec23){if(_0x10ec23){return _0x19a322[_0xf7a4('0x18')](_0x204eb1);}return _0x19a322[_0xf7a4('0x19')](_0x204eb1)[_0xf7a4('0x1a')]();};}function respondWithResult(_0x3b7d8c,_0x262e47){_0x262e47=_0x262e47||0xc8;return function(_0x3cca90){if(_0x3cca90){return _0x3b7d8c['status'](_0x262e47)[_0xf7a4('0x1b')](_0x3cca90);}};}function respondWithFilteredResult(_0x3fe552,_0x4cda4a){return function(_0x2a772c){if(_0x2a772c){var _0x4de2eb=typeof _0x4cda4a[_0xf7a4('0x1c')]===_0xf7a4('0x1d')&&typeof _0x4cda4a['limit']==='undefined';var _0x17e52f=_0x2a772c['count'];var _0x3d8f93=_0x4de2eb?0x0:_0x4cda4a['offset'];var _0xd2cd6f=_0x4de2eb?_0x2a772c[_0xf7a4('0x1e')]:_0x4cda4a[_0xf7a4('0x1c')]+_0x4cda4a[_0xf7a4('0x1f')];var _0x25a82a;if(_0xd2cd6f>=_0x17e52f){_0xd2cd6f=_0x17e52f;_0x25a82a=0xc8;}else{_0x25a82a=0xce;}_0x3fe552[_0xf7a4('0x19')](_0x25a82a);return _0x3fe552['set'](_0xf7a4('0x20'),_0x3d8f93+'-'+_0xd2cd6f+'/'+_0x17e52f)[_0xf7a4('0x1b')](_0x2a772c);}return null;};}function patchUpdates(_0x484677){return function(_0x42e04f){try{jsonpatch[_0xf7a4('0x21')](_0x42e04f,_0x484677,!![]);}catch(_0x4621b0){return BPromise[_0xf7a4('0x22')](_0x4621b0);}return _0x42e04f['save']();};}function saveUpdates(_0x3d757f,_0x5336bf){return function(_0x46cdac){if(_0x46cdac){return _0x46cdac[_0xf7a4('0x23')](_0x3d757f)[_0xf7a4('0x24')](function(_0x299eb7){return _0x299eb7;});}return null;};}function removeEntity(_0x2a36c6,_0x299a04){return function(_0x4be70d){if(_0x4be70d){return _0x4be70d[_0xf7a4('0x25')]()['then'](function(){var _0x340ba4=_0x4be70d[_0xf7a4('0x26')]({'plain':!![]});var _0x5e3298=_0xf7a4('0x27');return db[_0xf7a4('0x28')][_0xf7a4('0x25')]({'where':{'type':_0x5e3298,'resourceId':_0x340ba4['id']}})[_0xf7a4('0x24')](function(){return _0x4be70d;});})[_0xf7a4('0x24')](function(){_0x2a36c6[_0xf7a4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cb135,_0x30225d){return function(_0x4984f5){if(!_0x4984f5){_0x4cb135['sendStatus'](0x194);}return _0x4984f5;};}function handleError(_0x1e242c,_0x5e8409){_0x5e8409=_0x5e8409||0x1f4;return function(_0xeef2d5){logger['error'](_0xeef2d5[_0xf7a4('0x29')]);if(_0xeef2d5[_0xf7a4('0x2a')]){delete _0xeef2d5['name'];}_0x1e242c[_0xf7a4('0x19')](_0x5e8409)[_0xf7a4('0x2b')](_0xeef2d5);};}exports[_0xf7a4('0x2c')]=function(_0x164c7e,_0x5aa202){var _0xe87462={},_0x1eea08={},_0x45c1ae={'count':0x0,'rows':[]};var _0x211849=_[_0xf7a4('0x2d')](db[_0xf7a4('0x2e')][_0xf7a4('0x2f')],function(_0x2746a5){return{'name':_0x2746a5[_0xf7a4('0x30')],'type':_0x2746a5['type']['key']};});_0x1eea08[_0xf7a4('0x31')]=_[_0xf7a4('0x2d')](_0x211849,_0xf7a4('0x2a'));_0x1eea08[_0xf7a4('0x32')]=_[_0xf7a4('0x33')](_0x164c7e[_0xf7a4('0x32')]);_0x1eea08[_0xf7a4('0x34')]=_[_0xf7a4('0x35')](_0x1eea08[_0xf7a4('0x31')],_0x1eea08[_0xf7a4('0x32')]);_0xe87462[_0xf7a4('0x36')]=_['intersection'](_0x1eea08[_0xf7a4('0x31')],qs[_0xf7a4('0x37')](_0x164c7e[_0xf7a4('0x32')][_0xf7a4('0x37')]));_0xe87462[_0xf7a4('0x36')]=_0xe87462[_0xf7a4('0x36')]['length']?_0xe87462[_0xf7a4('0x36')]:_0x1eea08[_0xf7a4('0x31')];if(!_0x164c7e[_0xf7a4('0x32')][_0xf7a4('0x38')]('nolimit')){_0xe87462[_0xf7a4('0x1f')]=qs[_0xf7a4('0x1f')](_0x164c7e[_0xf7a4('0x32')][_0xf7a4('0x1f')]);_0xe87462[_0xf7a4('0x1c')]=qs[_0xf7a4('0x1c')](_0x164c7e['query']['offset']);}_0xe87462[_0xf7a4('0x39')]=qs['sort'](_0x164c7e[_0xf7a4('0x32')][_0xf7a4('0x3a')]);_0xe87462[_0xf7a4('0x3b')]=qs[_0xf7a4('0x34')](_[_0xf7a4('0x3c')](_0x164c7e[_0xf7a4('0x32')],_0x1eea08[_0xf7a4('0x34')]),_0x211849);if(_0x164c7e[_0xf7a4('0x32')]['filter']){_0xe87462[_0xf7a4('0x3b')]=_[_0xf7a4('0x3d')](_0xe87462['where'],{'$or':_['map'](_0x211849,function(_0x2eb70c){if(_0x2eb70c[_0xf7a4('0x3e')]!==_0xf7a4('0x3f')){var _0x8664b9={};_0x8664b9[_0x2eb70c['name']]={'$like':'%'+_0x164c7e[_0xf7a4('0x32')]['filter']+'%'};return _0x8664b9;}})});}_0xe87462=_[_0xf7a4('0x3d')]({},_0xe87462,_0x164c7e[_0xf7a4('0x40')]);var _0x14012f={'where':_0xe87462[_0xf7a4('0x3b')]};return db['Campaign'][_0xf7a4('0x1e')](_0x14012f)[_0xf7a4('0x24')](function(_0x316bdc){_0x45c1ae['count']=_0x316bdc;if(_0x164c7e[_0xf7a4('0x32')][_0xf7a4('0x41')]){_0xe87462[_0xf7a4('0x42')]=[{'all':!![]}];}return db['Campaign'][_0xf7a4('0x43')](_0xe87462);})[_0xf7a4('0x24')](function(_0x33ba2f){_0x45c1ae['rows']=_0x33ba2f;return _0x45c1ae;})[_0xf7a4('0x24')](respondWithFilteredResult(_0x5aa202,_0xe87462))['catch'](handleError(_0x5aa202,null));};exports[_0xf7a4('0x44')]=function(_0xdb0d63,_0xdcbb01){var _0x1317de={'raw':![],'where':{'id':_0xdb0d63[_0xf7a4('0x45')]['id']}},_0x3d3a00={};_0x3d3a00[_0xf7a4('0x31')]=_[_0xf7a4('0x33')](db[_0xf7a4('0x2e')][_0xf7a4('0x2f')]);_0x3d3a00['query']=_[_0xf7a4('0x33')](_0xdb0d63[_0xf7a4('0x32')]);_0x3d3a00[_0xf7a4('0x34')]=_['intersection'](_0x3d3a00[_0xf7a4('0x31')],_0x3d3a00['query']);_0x1317de[_0xf7a4('0x36')]=_['intersection'](_0x3d3a00[_0xf7a4('0x31')],qs[_0xf7a4('0x37')](_0xdb0d63[_0xf7a4('0x32')][_0xf7a4('0x37')]));_0x1317de[_0xf7a4('0x36')]=_0x1317de['attributes'][_0xf7a4('0x46')]?_0x1317de[_0xf7a4('0x36')]:_0x3d3a00[_0xf7a4('0x31')];if(_0xdb0d63[_0xf7a4('0x32')][_0xf7a4('0x41')]){_0x1317de[_0xf7a4('0x42')]=[{'all':!![]}];}_0x1317de=_[_0xf7a4('0x3d')]({},_0x1317de,_0xdb0d63[_0xf7a4('0x40')]);return db[_0xf7a4('0x2e')][_0xf7a4('0x47')](_0x1317de)[_0xf7a4('0x24')](handleEntityNotFound(_0xdcbb01,null))[_0xf7a4('0x24')](respondWithResult(_0xdcbb01,null))['catch'](handleError(_0xdcbb01,null));};exports[_0xf7a4('0x48')]=function(_0x1c8a8c,_0x2c3159){return db['Campaign'][_0xf7a4('0x48')](_0x1c8a8c[_0xf7a4('0x49')],{})['then'](function(_0x36928f){var _0x55b752=_0x1c8a8c[_0xf7a4('0x4a')][_0xf7a4('0x26')]({'plain':!![]});if(!_0x55b752)throw new Error(_0xf7a4('0x4b'));if(_0x55b752[_0xf7a4('0x4c')]===_0xf7a4('0x4a')){var _0x2b4d9e=_0x36928f['get']({'plain':!![]});var _0x5407e6=_0xf7a4('0x27');return db[_0xf7a4('0x4d')][_0xf7a4('0x47')]({'where':{'name':_0x5407e6,'userProfileId':_0x55b752[_0xf7a4('0x4e')]},'raw':!![]})['then'](function(_0x4134c3){if(_0x4134c3&&_0x4134c3[_0xf7a4('0x4f')]===0x0){return db[_0xf7a4('0x28')][_0xf7a4('0x48')]({'name':_0x2b4d9e[_0xf7a4('0x2a')],'resourceId':_0x2b4d9e['id'],'type':_0x4134c3[_0xf7a4('0x2a')],'sectionId':_0x4134c3['id']},{})[_0xf7a4('0x24')](function(){return _0x36928f;});}else{return _0x36928f;}})['catch'](function(_0x3dee42){logger[_0xf7a4('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dee42);throw _0x3dee42;});}return _0x36928f;})[_0xf7a4('0x24')](respondWithResult(_0x2c3159,0xc9))['catch'](handleError(_0x2c3159,null));};exports[_0xf7a4('0x51')]=function(_0x3d7346,_0x1f40dd){var _0x3727b8={'where':{'id':_0x3d7346[_0xf7a4('0x45')]['id']}},_0x5c1ce5={};_0x5c1ce5['model']=_[_0xf7a4('0x33')](db['Campaign']['rawAttributes']);_0x3727b8[_0xf7a4('0x36')]=_[_0xf7a4('0x35')](_0x5c1ce5['model'],qs[_0xf7a4('0x37')](_0x3d7346[_0xf7a4('0x32')][_0xf7a4('0x37')]));_0x3727b8[_0xf7a4('0x36')]=_0x3727b8[_0xf7a4('0x36')][_0xf7a4('0x46')]?_0x3727b8[_0xf7a4('0x36')]:_0x5c1ce5[_0xf7a4('0x31')];if(_0x3d7346[_0xf7a4('0x32')]['includeAll']){_0x3727b8[_0xf7a4('0x42')]=[{'all':!![]}];}_0x3727b8=_[_0xf7a4('0x3d')]({},_0x3727b8,_0x3d7346[_0xf7a4('0x40')]);return db[_0xf7a4('0x2e')][_0xf7a4('0x47')](_0x3727b8)['then'](handleEntityNotFound(_0x1f40dd,null))[_0xf7a4('0x24')](function(_0x4fb4df){if(_0x4fb4df){var _0x2d5c8e=_0x4fb4df[_0xf7a4('0x26')]({'plain':!![]});_0x2d5c8e=qs[_0xf7a4('0x52')](_0x2d5c8e,['id','createdAt','updatedAt']);_0x3d7346[_0xf7a4('0x49')]=_['omit'](_0x3d7346[_0xf7a4('0x49')],['id',_0xf7a4('0x53'),_0xf7a4('0x54')]);return db[_0xf7a4('0x2e')][_0xf7a4('0x48')](_[_0xf7a4('0x3d')](_0x2d5c8e,_0x3d7346['body']),{'include':_0x3d7346[_0xf7a4('0x32')][_0xf7a4('0x41')]?[{'all':!![]}]:undefined})[_0xf7a4('0x24')](function(_0x2e7ff7){var _0x11e3a6=_0x3d7346['user'][_0xf7a4('0x26')]({'plain':!![]});if(!_0x11e3a6)throw new Error(_0xf7a4('0x4b'));if(_0x11e3a6[_0xf7a4('0x4c')]===_0xf7a4('0x4a')){var _0xe83e1=_0x2e7ff7[_0xf7a4('0x26')]({'plain':!![]});var _0x233d83=_0xf7a4('0x27');return db[_0xf7a4('0x4d')][_0xf7a4('0x47')]({'where':{'name':_0x233d83,'userProfileId':_0x11e3a6[_0xf7a4('0x4e')]},'raw':!![]})[_0xf7a4('0x24')](function(_0x18cd5a){if(_0x18cd5a&&_0x18cd5a[_0xf7a4('0x4f')]===0x0){return db[_0xf7a4('0x28')]['create']({'name':_0xe83e1[_0xf7a4('0x2a')],'resourceId':_0xe83e1['id'],'type':_0x18cd5a[_0xf7a4('0x2a')],'sectionId':_0x18cd5a['id']},{})['then'](function(){return _0x2e7ff7;});}else{return _0x2e7ff7;}})[_0xf7a4('0x55')](function(_0x316341){logger[_0xf7a4('0x50')](_0xf7a4('0x56'),_0x316341);throw _0x316341;});}return _0x2e7ff7;});}})[_0xf7a4('0x24')](respondWithResult(_0x1f40dd,0xc9))[_0xf7a4('0x55')](handleError(_0x1f40dd,null));};exports[_0xf7a4('0x23')]=function(_0x14a119,_0x6299cd){if(_0x14a119['body']['id']){delete _0x14a119[_0xf7a4('0x49')]['id'];}return db['Campaign'][_0xf7a4('0x47')]({'where':{'id':_0x14a119[_0xf7a4('0x45')]['id']}})[_0xf7a4('0x24')](handleEntityNotFound(_0x6299cd,null))[_0xf7a4('0x24')](saveUpdates(_0x14a119[_0xf7a4('0x49')],null))[_0xf7a4('0x24')](respondWithResult(_0x6299cd,null))[_0xf7a4('0x55')](handleError(_0x6299cd,null));};exports[_0xf7a4('0x25')]=function(_0x33baa7,_0x573814){return db['Campaign']['find']({'where':{'id':_0x33baa7[_0xf7a4('0x45')]['id']}})[_0xf7a4('0x24')](handleEntityNotFound(_0x573814,null))['then'](removeEntity(_0x573814,null))[_0xf7a4('0x55')](handleError(_0x573814,null));};exports[_0xf7a4('0x57')]=function(_0xf39857,_0x170143,_0xfa2968){var _0x4d9827={'raw':!![],'where':{}};var _0x58e263={};var _0x5e0fee={'count':0x0,'rows':[]};return db[_0xf7a4('0x2e')][_0xf7a4('0x58')]({'where':{'id':_0xf39857['params']['id']}})[_0xf7a4('0x24')](handleEntityNotFound(_0x170143,null))[_0xf7a4('0x24')](function(_0x5aa328){if(_0x5aa328){_0x58e263[_0xf7a4('0x31')]=_[_0xf7a4('0x33')](db[_0xf7a4('0x59')][_0xf7a4('0x2f')]);_0x58e263[_0xf7a4('0x32')]=_[_0xf7a4('0x33')](_0xf39857['query']);_0x58e263[_0xf7a4('0x34')]=_[_0xf7a4('0x35')](_0x58e263[_0xf7a4('0x31')],_0x58e263['query']);_0x4d9827[_0xf7a4('0x36')]=_[_0xf7a4('0x35')](_0x58e263[_0xf7a4('0x31')],qs['fields'](_0xf39857[_0xf7a4('0x32')][_0xf7a4('0x37')]));_0x4d9827[_0xf7a4('0x36')]=_0x4d9827[_0xf7a4('0x36')][_0xf7a4('0x46')]?_0x4d9827[_0xf7a4('0x36')]:_0x58e263['model'];if(!_0xf39857[_0xf7a4('0x32')][_0xf7a4('0x38')](_0xf7a4('0x5a'))){_0x4d9827['limit']=qs[_0xf7a4('0x1f')](_0xf39857['query'][_0xf7a4('0x1f')]);_0x4d9827['offset']=qs['offset'](_0xf39857[_0xf7a4('0x32')][_0xf7a4('0x1c')]);}_0x4d9827['order']=qs[_0xf7a4('0x3a')](_0xf39857[_0xf7a4('0x32')][_0xf7a4('0x3a')]);_0x4d9827[_0xf7a4('0x3b')]=qs['filters'](_[_0xf7a4('0x3c')](_0xf39857['query'],_0x58e263[_0xf7a4('0x34')]));_0x4d9827[_0xf7a4('0x3b')][_0xf7a4('0x5b')]=_0x5aa328['id'];if(_0xf39857['query'][_0xf7a4('0x5c')]){_0x4d9827[_0xf7a4('0x3b')]=_[_0xf7a4('0x3d')](_0x4d9827[_0xf7a4('0x3b')],{'$or':_[_0xf7a4('0x2d')](_0x4d9827['attributes'],function(_0x594ac8){var _0x248f15={};_0x248f15[_0x594ac8]={'$like':'%'+_0xf39857[_0xf7a4('0x32')][_0xf7a4('0x5c')]+'%'};return _0x248f15;})});}_0x4d9827=_[_0xf7a4('0x3d')]({},_0x4d9827,_0xf39857['options']);return db[_0xf7a4('0x59')][_0xf7a4('0x1e')]({'where':_0x4d9827[_0xf7a4('0x3b')]})[_0xf7a4('0x24')](function(_0x519e39){_0x5e0fee[_0xf7a4('0x1e')]=_0x519e39;if(_0xf39857[_0xf7a4('0x32')]['includeAll']){_0x4d9827[_0xf7a4('0x42')]=[{'all':!![]}];}return db[_0xf7a4('0x59')]['findAll'](_0x4d9827);})[_0xf7a4('0x24')](function(_0x42943e){_0x5e0fee[_0xf7a4('0x5d')]=_0x42943e;return _0x5e0fee;});}})[_0xf7a4('0x24')](respondWithFilteredResult(_0x170143,_0x4d9827))[_0xf7a4('0x55')](handleError(_0x170143,null));};exports[_0xf7a4('0x5e')]=function(_0x3873b9,_0x3b6911,_0x2eb988){var _0x11efc4={'raw':!![],'where':{}};var _0x14c964={};var _0x5bb70e={'count':0x0,'rows':[]};return db['Campaign'][_0xf7a4('0x58')]({'where':{'id':_0x3873b9[_0xf7a4('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6911,null))['then'](function(_0x197d2f){if(_0x197d2f){_0x14c964[_0xf7a4('0x31')]=_[_0xf7a4('0x33')](db[_0xf7a4('0x5f')][_0xf7a4('0x2f')]);_0x14c964[_0xf7a4('0x32')]=_[_0xf7a4('0x33')](_0x3873b9[_0xf7a4('0x32')]);_0x14c964[_0xf7a4('0x34')]=_[_0xf7a4('0x35')](_0x14c964[_0xf7a4('0x31')],_0x14c964['query']);_0x11efc4[_0xf7a4('0x36')]=_[_0xf7a4('0x35')](_0x14c964[_0xf7a4('0x31')],qs['fields'](_0x3873b9['query']['fields']));_0x11efc4[_0xf7a4('0x36')]=_0x11efc4[_0xf7a4('0x36')][_0xf7a4('0x46')]?_0x11efc4[_0xf7a4('0x36')]:_0x14c964[_0xf7a4('0x31')];if(!_0x3873b9[_0xf7a4('0x32')][_0xf7a4('0x38')](_0xf7a4('0x5a'))){_0x11efc4[_0xf7a4('0x1f')]=qs[_0xf7a4('0x1f')](_0x3873b9[_0xf7a4('0x32')]['limit']);_0x11efc4[_0xf7a4('0x1c')]=qs[_0xf7a4('0x1c')](_0x3873b9[_0xf7a4('0x32')][_0xf7a4('0x1c')]);}_0x11efc4['order']=qs[_0xf7a4('0x3a')](_0x3873b9['query']['sort']);_0x11efc4[_0xf7a4('0x3b')]=qs['filters'](_[_0xf7a4('0x3c')](_0x3873b9[_0xf7a4('0x32')],_0x14c964[_0xf7a4('0x34')]));_0x11efc4['where'][_0xf7a4('0x5b')]=_0x197d2f['id'];if(_0x3873b9[_0xf7a4('0x32')][_0xf7a4('0x5c')]){_0x11efc4[_0xf7a4('0x3b')]=_[_0xf7a4('0x3d')](_0x11efc4['where'],{'$or':_['map'](_0x11efc4[_0xf7a4('0x36')],function(_0x44e080){var _0x1be72c={};_0x1be72c[_0x44e080]={'$like':'%'+_0x3873b9['query'][_0xf7a4('0x5c')]+'%'};return _0x1be72c;})});}_0x11efc4=_[_0xf7a4('0x3d')]({},_0x11efc4,_0x3873b9['options']);return db['CmHopperHistory']['count']({'where':_0x11efc4[_0xf7a4('0x3b')]})[_0xf7a4('0x24')](function(_0x4e91c5){_0x5bb70e['count']=_0x4e91c5;if(_0x3873b9[_0xf7a4('0x32')][_0xf7a4('0x41')]){_0x11efc4[_0xf7a4('0x42')]=[{'all':!![]}];}return db[_0xf7a4('0x5f')][_0xf7a4('0x43')](_0x11efc4);})[_0xf7a4('0x24')](function(_0xd811f7){_0x5bb70e[_0xf7a4('0x5d')]=_0xd811f7;return _0x5bb70e;});}})['then'](respondWithFilteredResult(_0x3b6911,_0x11efc4))[_0xf7a4('0x55')](handleError(_0x3b6911,null));};exports['getHopperFinals']=function(_0x99f87a,_0x1a5ed2,_0x1beb94){var _0x46a706={'raw':!![],'where':{}};var _0xb185f0={};var _0x28da97={'count':0x0,'rows':[]};return db[_0xf7a4('0x2e')][_0xf7a4('0x58')]({'where':{'id':_0x99f87a[_0xf7a4('0x45')]['id']}})[_0xf7a4('0x24')](handleEntityNotFound(_0x1a5ed2,null))['then'](function(_0x41ac0e){if(_0x41ac0e){_0xb185f0[_0xf7a4('0x31')]=_[_0xf7a4('0x33')](db[_0xf7a4('0x60')][_0xf7a4('0x2f')]);_0xb185f0[_0xf7a4('0x32')]=_[_0xf7a4('0x33')](_0x99f87a['query']);_0xb185f0['filters']=_['intersection'](_0xb185f0[_0xf7a4('0x31')],_0xb185f0[_0xf7a4('0x32')]);_0x46a706[_0xf7a4('0x36')]=_['intersection'](_0xb185f0['model'],qs[_0xf7a4('0x37')](_0x99f87a[_0xf7a4('0x32')][_0xf7a4('0x37')]));_0x46a706[_0xf7a4('0x36')]=_0x46a706['attributes'][_0xf7a4('0x46')]?_0x46a706[_0xf7a4('0x36')]:_0xb185f0['model'];if(!_0x99f87a[_0xf7a4('0x32')]['hasOwnProperty']('nolimit')){_0x46a706['limit']=qs[_0xf7a4('0x1f')](_0x99f87a[_0xf7a4('0x32')][_0xf7a4('0x1f')]);_0x46a706[_0xf7a4('0x1c')]=qs[_0xf7a4('0x1c')](_0x99f87a[_0xf7a4('0x32')][_0xf7a4('0x1c')]);}_0x46a706[_0xf7a4('0x39')]=qs['sort'](_0x99f87a[_0xf7a4('0x32')][_0xf7a4('0x3a')]);_0x46a706[_0xf7a4('0x3b')]=qs[_0xf7a4('0x34')](_[_0xf7a4('0x3c')](_0x99f87a['query'],_0xb185f0[_0xf7a4('0x34')]));_0x46a706[_0xf7a4('0x3b')][_0xf7a4('0x5b')]=_0x41ac0e['id'];if(_0x99f87a[_0xf7a4('0x32')][_0xf7a4('0x5c')]){_0x46a706[_0xf7a4('0x3b')]=_[_0xf7a4('0x3d')](_0x46a706['where'],{'$or':_[_0xf7a4('0x2d')](_0x46a706[_0xf7a4('0x36')],function(_0x4ab676){var _0x5c0f30={};_0x5c0f30[_0x4ab676]={'$like':'%'+_0x99f87a[_0xf7a4('0x32')][_0xf7a4('0x5c')]+'%'};return _0x5c0f30;})});}_0x46a706=_[_0xf7a4('0x3d')]({},_0x46a706,_0x99f87a[_0xf7a4('0x40')]);return db['CmHopperFinal'][_0xf7a4('0x1e')]({'where':_0x46a706['where']})['then'](function(_0x55e89c){_0x28da97[_0xf7a4('0x1e')]=_0x55e89c;if(_0x99f87a[_0xf7a4('0x32')][_0xf7a4('0x41')]){_0x46a706[_0xf7a4('0x42')]=[{'all':!![]}];}return db[_0xf7a4('0x60')][_0xf7a4('0x43')](_0x46a706);})[_0xf7a4('0x24')](function(_0x2506a9){_0x28da97[_0xf7a4('0x5d')]=_0x2506a9;return _0x28da97;});}})[_0xf7a4('0x24')](respondWithFilteredResult(_0x1a5ed2,_0x46a706))[_0xf7a4('0x55')](handleError(_0x1a5ed2,null));};exports[_0xf7a4('0x61')]=function(_0x3def56,_0x5af253,_0x1a988f){var _0x56433f={'raw':!![],'where':{}};var _0x103ca4={};var _0x83b95a={'count':0x0,'rows':[]};return db[_0xf7a4('0x2e')][_0xf7a4('0x58')]({'where':{'id':_0x3def56[_0xf7a4('0x45')]['id']}})[_0xf7a4('0x24')](handleEntityNotFound(_0x5af253,null))['then'](function(_0x5ea086){if(_0x5ea086){_0x103ca4['model']=_[_0xf7a4('0x33')](db[_0xf7a4('0x62')][_0xf7a4('0x2f')]);_0x103ca4['query']=_[_0xf7a4('0x33')](_0x3def56['query']);_0x103ca4[_0xf7a4('0x34')]=_[_0xf7a4('0x35')](_0x103ca4[_0xf7a4('0x31')],_0x103ca4[_0xf7a4('0x32')]);_0x56433f[_0xf7a4('0x36')]=_[_0xf7a4('0x35')](_0x103ca4[_0xf7a4('0x31')],qs['fields'](_0x3def56['query'][_0xf7a4('0x37')]));_0x56433f[_0xf7a4('0x36')]=_0x56433f[_0xf7a4('0x36')]['length']?_0x56433f[_0xf7a4('0x36')]:_0x103ca4[_0xf7a4('0x31')];if(!_0x3def56[_0xf7a4('0x32')][_0xf7a4('0x38')](_0xf7a4('0x5a'))){_0x56433f[_0xf7a4('0x1f')]=qs[_0xf7a4('0x1f')](_0x3def56['query']['limit']);_0x56433f[_0xf7a4('0x1c')]=qs[_0xf7a4('0x1c')](_0x3def56[_0xf7a4('0x32')][_0xf7a4('0x1c')]);}_0x56433f[_0xf7a4('0x39')]=qs[_0xf7a4('0x3a')](_0x3def56[_0xf7a4('0x32')][_0xf7a4('0x3a')]);_0x56433f[_0xf7a4('0x3b')]=qs[_0xf7a4('0x34')](_[_0xf7a4('0x3c')](_0x3def56[_0xf7a4('0x32')],_0x103ca4[_0xf7a4('0x34')]));_0x56433f[_0xf7a4('0x3b')][_0xf7a4('0x5b')]=_0x5ea086['id'];if(_0x3def56[_0xf7a4('0x32')]['filter']){_0x56433f[_0xf7a4('0x3b')]=_[_0xf7a4('0x3d')](_0x56433f[_0xf7a4('0x3b')],{'$or':_[_0xf7a4('0x2d')](_0x56433f[_0xf7a4('0x36')],function(_0x413335){var _0x349139={};_0x349139[_0x413335]={'$like':'%'+_0x3def56[_0xf7a4('0x32')][_0xf7a4('0x5c')]+'%'};return _0x349139;})});}_0x56433f=_[_0xf7a4('0x3d')]({},_0x56433f,_0x3def56['options']);return db[_0xf7a4('0x62')][_0xf7a4('0x1e')]({'where':_0x56433f[_0xf7a4('0x3b')]})[_0xf7a4('0x24')](function(_0x3e8a07){_0x83b95a[_0xf7a4('0x1e')]=_0x3e8a07;if(_0x3def56[_0xf7a4('0x32')][_0xf7a4('0x41')]){_0x56433f[_0xf7a4('0x42')]=[{'all':!![]}];}return db[_0xf7a4('0x62')]['findAll'](_0x56433f);})[_0xf7a4('0x24')](function(_0x4f144b){_0x83b95a['rows']=_0x4f144b;return _0x83b95a;});}})[_0xf7a4('0x24')](respondWithFilteredResult(_0x5af253,_0x56433f))[_0xf7a4('0x55')](handleError(_0x5af253,null));};exports[_0xf7a4('0x63')]=function(_0x1165bf,_0x407598,_0x518b19){var _0x920e99={};var _0x17dcb7={};var _0x15c071;var _0x96644b;return db[_0xf7a4('0x2e')]['findOne']({'where':{'id':_0x1165bf[_0xf7a4('0x45')]['id']}})[_0xf7a4('0x24')](handleEntityNotFound(_0x407598,null))['then'](function(_0xda6941){if(_0xda6941){_0x15c071=_0xda6941;_0x17dcb7[_0xf7a4('0x31')]=_['keys'](db[_0xf7a4('0x64')][_0xf7a4('0x2f')]);_0x17dcb7['query']=_[_0xf7a4('0x33')](_0x1165bf[_0xf7a4('0x32')]);_0x17dcb7[_0xf7a4('0x34')]=_[_0xf7a4('0x35')](_0x17dcb7[_0xf7a4('0x31')],_0x17dcb7[_0xf7a4('0x32')]);_0x920e99[_0xf7a4('0x36')]=_[_0xf7a4('0x35')](_0x17dcb7[_0xf7a4('0x31')],qs[_0xf7a4('0x37')](_0x1165bf[_0xf7a4('0x32')][_0xf7a4('0x37')]));_0x920e99['attributes']=_0x920e99[_0xf7a4('0x36')][_0xf7a4('0x46')]?_0x920e99[_0xf7a4('0x36')]:_0x17dcb7[_0xf7a4('0x31')];_0x920e99[_0xf7a4('0x39')]=qs[_0xf7a4('0x3a')](_0x1165bf[_0xf7a4('0x32')][_0xf7a4('0x3a')]);_0x920e99[_0xf7a4('0x3b')]=qs[_0xf7a4('0x34')](_[_0xf7a4('0x3c')](_0x1165bf[_0xf7a4('0x32')],_0x17dcb7[_0xf7a4('0x34')]));if(_0x1165bf[_0xf7a4('0x32')]['filter']){_0x920e99[_0xf7a4('0x3b')]=_[_0xf7a4('0x3d')](_0x920e99['where'],{'$or':_[_0xf7a4('0x2d')](_0x920e99['attributes'],function(_0x2a83ea){var _0xed458f={};_0xed458f[_0x2a83ea]={'$like':'%'+_0x1165bf[_0xf7a4('0x32')][_0xf7a4('0x5c')]+'%'};return _0xed458f;})});}_0x920e99=_[_0xf7a4('0x3d')]({},_0x920e99,_0x1165bf['options']);return _0x15c071[_0xf7a4('0x63')](_0x920e99);}})['then'](function(_0x41a01a){if(_0x41a01a){_0x96644b=_0x41a01a[_0xf7a4('0x46')];if(!_0x1165bf[_0xf7a4('0x32')][_0xf7a4('0x38')]('nolimit')){_0x920e99[_0xf7a4('0x1f')]=qs[_0xf7a4('0x1f')](_0x1165bf['query'][_0xf7a4('0x1f')]);_0x920e99[_0xf7a4('0x1c')]=qs[_0xf7a4('0x1c')](_0x1165bf[_0xf7a4('0x32')]['offset']);}return _0x15c071[_0xf7a4('0x63')](_0x920e99);}})[_0xf7a4('0x24')](function(_0x47f953){if(_0x47f953){return _0x47f953?{'count':_0x96644b,'rows':_0x47f953}:null;}})[_0xf7a4('0x24')](respondWithResult(_0x407598,null))['catch'](handleError(_0x407598,null));};exports[_0xf7a4('0x65')]=function(_0x5b6e2b,_0x4a1ca9,_0x56d611){var _0x50f382,_0x41cb93;var _0xc3a1b0=[];var _0xbe17b7=moment()[_0xf7a4('0x66')](_0xf7a4('0x67'));return db[_0xf7a4('0x2e')][_0xf7a4('0x47')]({'where':{'id':_0x5b6e2b['params']['id']}})[_0xf7a4('0x24')](handleEntityNotFound(_0x4a1ca9,null))[_0xf7a4('0x24')](function(_0x2dc6cf){if(_0x2dc6cf){_0x41cb93=_0x2dc6cf;return _0x2dc6cf['addLists'](_0x5b6e2b['body'][_0xf7a4('0x68')],_['omit'](_0x5b6e2b['body'],[_0xf7a4('0x68'),'id'])||{});}return null;})[_0xf7a4('0x69')](function(_0x3dcaa5){var _0x557765;var _0x545995;_0x50f382=_0x3dcaa5||[];var _0x32a465=[];if(_0x3dcaa5){for(var _0x4db7d3=0x0;_0x4db7d3<_0x3dcaa5[_0xf7a4('0x46')];_0x4db7d3+=0x1){var _0x59f148=_0x3dcaa5[_0x4db7d3]['get']({'plain':!![]});_0x41cb93[_0xf7a4('0x6a')]=_0x5b6e2b[_0xf7a4('0x49')][_0xf7a4('0x6a')]?_0x5b6e2b['body'][_0xf7a4('0x6a')]:_0x41cb93['dialCheckDuplicateType'];switch(_0x41cb93[_0xf7a4('0x6a')]){case'always':_0x557765=squel[_0xf7a4('0x6b')]()[_0xf7a4('0x6c')](_0xf7a4('0x6d'))[_0xf7a4('0x6e')](['phone',_0xf7a4('0x6f'),_0xf7a4('0x70'),'ListId',_0xf7a4('0x5b'),_0xf7a4('0x53'),'updatedAt'],squel[_0xf7a4('0x71')]()['field']('phone',_0xf7a4('0x72'))[_0xf7a4('0x73')](_0xf7a4('0x74'),'scheduledAt')[_0xf7a4('0x73')]('id','ContactId')[_0xf7a4('0x73')](_0x59f148['CmListId']['toString'](),_0xf7a4('0x75'))[_0xf7a4('0x73')](_0x5b6e2b[_0xf7a4('0x45')]['id'][_0xf7a4('0x76')](),'CampaignId')[_0xf7a4('0x73')]('\x27'+_0xbe17b7+'\x27','createdAt')[_0xf7a4('0x73')]('\x27'+_0xbe17b7+'\x27','updatedAt')[_0xf7a4('0x77')]('cm_contacts')[_0xf7a4('0x3b')](_0xf7a4('0x78'))[_0xf7a4('0x3b')]('ListId\x20=\x20?',_0x59f148[_0xf7a4('0x79')][_0xf7a4('0x76')]())[_0xf7a4('0x3b')](_0xf7a4('0x7a'))[_0xf7a4('0x3b')](_0xf7a4('0x7b'),squel[_0xf7a4('0x71')]()[_0xf7a4('0x73')](_0xf7a4('0x7c'))[_0xf7a4('0x77')](_0xf7a4('0x7d'))['where'](_0xf7a4('0x7e'),_0x5b6e2b[_0xf7a4('0x45')]['id'][_0xf7a4('0x76')]()))[_0xf7a4('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf7a4('0x71')]()[_0xf7a4('0x73')]('COALESCE(phone,\x27\x27)')[_0xf7a4('0x77')](_0xf7a4('0x6d'))[_0xf7a4('0x3b')](_0xf7a4('0x7e'),_0x5b6e2b[_0xf7a4('0x45')]['id'][_0xf7a4('0x76')]())))[_0xf7a4('0x76')]();break;case _0xf7a4('0x7f'):_0x557765=squel[_0xf7a4('0x6b')]()[_0xf7a4('0x6c')](_0xf7a4('0x6d'))['fromQuery'](['phone',_0xf7a4('0x6f'),'ContactId','ListId',_0xf7a4('0x5b'),_0xf7a4('0x53'),_0xf7a4('0x54')],squel[_0xf7a4('0x71')]()[_0xf7a4('0x73')](_0xf7a4('0x72'),_0xf7a4('0x72'))[_0xf7a4('0x73')](_0xf7a4('0x74'),_0xf7a4('0x6f'))['field']('id','ContactId')[_0xf7a4('0x73')](_0x59f148[_0xf7a4('0x79')][_0xf7a4('0x76')](),_0xf7a4('0x75'))[_0xf7a4('0x73')](_0x5b6e2b[_0xf7a4('0x45')]['id'][_0xf7a4('0x76')](),_0xf7a4('0x5b'))[_0xf7a4('0x73')]('\x27'+_0xbe17b7+'\x27',_0xf7a4('0x53'))[_0xf7a4('0x73')]('\x27'+_0xbe17b7+'\x27',_0xf7a4('0x54'))['from']('cm_contacts')[_0xf7a4('0x3b')]('deletedAt\x20IS\x20NULL')[_0xf7a4('0x3b')](_0xf7a4('0x80'),_0x59f148[_0xf7a4('0x79')][_0xf7a4('0x76')]())['where'](_0xf7a4('0x7a'))[_0xf7a4('0x3b')](_0xf7a4('0x7b'),squel['select']()['field'](_0xf7a4('0x81'))[_0xf7a4('0x77')](_0xf7a4('0x6d'))[_0xf7a4('0x3b')]('CampaignId\x20=\x20?',_0x5b6e2b[_0xf7a4('0x45')]['id'][_0xf7a4('0x76')]())))[_0xf7a4('0x76')]();break;default:_0x557765=squel[_0xf7a4('0x6b')]()[_0xf7a4('0x6c')]('cm_hopper')[_0xf7a4('0x6e')](['phone',_0xf7a4('0x6f'),_0xf7a4('0x70'),_0xf7a4('0x75'),'CampaignId',_0xf7a4('0x53'),_0xf7a4('0x54')],squel[_0xf7a4('0x71')]()[_0xf7a4('0x73')](_0xf7a4('0x72'),_0xf7a4('0x72'))[_0xf7a4('0x73')](_0xf7a4('0x74'),_0xf7a4('0x6f'))['field']('id',_0xf7a4('0x70'))[_0xf7a4('0x73')](_0x59f148['CmListId']['toString'](),'ListId')[_0xf7a4('0x73')](_0x5b6e2b['params']['id']['toString'](),_0xf7a4('0x5b'))[_0xf7a4('0x73')]('\x27'+_0xbe17b7+'\x27',_0xf7a4('0x53'))[_0xf7a4('0x73')]('\x27'+_0xbe17b7+'\x27',_0xf7a4('0x54'))[_0xf7a4('0x77')](_0xf7a4('0x82'))[_0xf7a4('0x3b')](_0xf7a4('0x78'))[_0xf7a4('0x3b')]('ListId\x20=\x20?',_0x59f148[_0xf7a4('0x79')][_0xf7a4('0x76')]())[_0xf7a4('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0xf7a4('0x76')]();}_0x545995=squel[_0xf7a4('0x6b')]()[_0xf7a4('0x6c')](_0xf7a4('0x83'))[_0xf7a4('0x6e')]([_0xf7a4('0x84'),_0xf7a4('0x6f'),_0xf7a4('0x72'),_0xf7a4('0x85'),_0xf7a4('0x53'),_0xf7a4('0x54')],squel['select']()[_0xf7a4('0x73')]('h.id','id')[_0xf7a4('0x73')](_0xf7a4('0x74'),_0xf7a4('0x6f'))[_0xf7a4('0x73')](_0xf7a4('0x86'),_0xf7a4('0x72'))['field'](_0xf7a4('0x87'),_0xf7a4('0x85'))['field']('\x27'+_0xbe17b7+'\x27',_0xf7a4('0x53'))[_0xf7a4('0x73')]('\x27'+_0xbe17b7+'\x27',_0xf7a4('0x54'))[_0xf7a4('0x77')]('cm_contact_has_items','ci')['join'](_0xf7a4('0x6d'),'h',_0xf7a4('0x88'))['where'](_0xf7a4('0x89'),_0x59f148[_0xf7a4('0x79')][_0xf7a4('0x76')]())[_0xf7a4('0x3b')](_0xf7a4('0x8a'),_0x5b6e2b[_0xf7a4('0x45')]['id'][_0xf7a4('0x76')]())['where'](_0xf7a4('0x8b'),_0xbe17b7))['toString']();_0x32a465[_0xf7a4('0x8c')](db[_0xf7a4('0x8d')][_0xf7a4('0x32')](_0x557765));_0xc3a1b0[_0xf7a4('0x8c')](db[_0xf7a4('0x8d')][_0xf7a4('0x32')](_0x545995));}return BPromise['all'](_0x32a465);}})[_0xf7a4('0x24')](function(){return BPromise['all'](_0xc3a1b0);})[_0xf7a4('0x24')](function(){return _0x50f382;})[_0xf7a4('0x24')](respondWithResult(_0x4a1ca9,null))[_0xf7a4('0x55')](handleError(_0x4a1ca9,null));};exports[_0xf7a4('0x8e')]=function(_0x42f6c7,_0x402585,_0x5b4e7f){return db[_0xf7a4('0x2e')]['find']({'where':{'id':_0x42f6c7[_0xf7a4('0x45')]['id']}})['then'](handleEntityNotFound(_0x402585,null))[_0xf7a4('0x24')](function(_0x6fa15a){if(_0x6fa15a){return _0x6fa15a['removeLists'](_0x42f6c7[_0xf7a4('0x32')]['ids']);}})[_0xf7a4('0x24')](function(_0x19cca7){if(_0x19cca7){return db[_0xf7a4('0x59')][_0xf7a4('0x25')]({'where':{'ListId':_0x42f6c7['query']['ids'],'CampaignId':_0x42f6c7[_0xf7a4('0x45')]['id']}})[_0xf7a4('0x24')](function(){return _0x19cca7;});}})['then'](respondWithStatusCode(_0x402585,null))['catch'](handleError(_0x402585,null));};exports[_0xf7a4('0x8f')]=function(_0x19879e,_0xa8754,_0xcc0e1f){var _0x508d51={};var _0xc5d471={};var _0x4d5b04;var _0x2db325;return db[_0xf7a4('0x2e')][_0xf7a4('0x58')]({'where':{'id':_0x19879e[_0xf7a4('0x45')]['id']}})['then'](handleEntityNotFound(_0xa8754,null))[_0xf7a4('0x24')](function(_0xbe2821){if(_0xbe2821){_0x4d5b04=_0xbe2821;_0xc5d471[_0xf7a4('0x31')]=_['keys'](db[_0xf7a4('0x64')][_0xf7a4('0x2f')]);_0xc5d471[_0xf7a4('0x32')]=_[_0xf7a4('0x33')](_0x19879e['query']);_0xc5d471[_0xf7a4('0x34')]=_[_0xf7a4('0x35')](_0xc5d471[_0xf7a4('0x31')],_0xc5d471[_0xf7a4('0x32')]);_0x508d51[_0xf7a4('0x36')]=_[_0xf7a4('0x35')](_0xc5d471[_0xf7a4('0x31')],qs[_0xf7a4('0x37')](_0x19879e['query']['fields']));_0x508d51[_0xf7a4('0x36')]=_0x508d51[_0xf7a4('0x36')]['length']?_0x508d51[_0xf7a4('0x36')]:_0xc5d471['model'];_0x508d51[_0xf7a4('0x39')]=qs[_0xf7a4('0x3a')](_0x19879e['query'][_0xf7a4('0x3a')]);_0x508d51[_0xf7a4('0x3b')]=qs[_0xf7a4('0x34')](_[_0xf7a4('0x3c')](_0x19879e[_0xf7a4('0x32')],_0xc5d471[_0xf7a4('0x34')]));if(_0x19879e[_0xf7a4('0x32')]['filter']){_0x508d51[_0xf7a4('0x3b')]=_[_0xf7a4('0x3d')](_0x508d51['where'],{'$or':_[_0xf7a4('0x2d')](_0x508d51['attributes'],function(_0x2263cf){var _0x12e8b3={};_0x12e8b3[_0x2263cf]={'$like':'%'+_0x19879e[_0xf7a4('0x32')]['filter']+'%'};return _0x12e8b3;})});}_0x508d51=_[_0xf7a4('0x3d')]({},_0x508d51,_0x19879e[_0xf7a4('0x40')]);return _0x4d5b04['getBlackLists'](_0x508d51);}})[_0xf7a4('0x24')](function(_0x594014){if(_0x594014){_0x2db325=_0x594014[_0xf7a4('0x46')];if(!_0x19879e['query'][_0xf7a4('0x38')](_0xf7a4('0x5a'))){_0x508d51[_0xf7a4('0x1f')]=qs['limit'](_0x19879e[_0xf7a4('0x32')][_0xf7a4('0x1f')]);_0x508d51[_0xf7a4('0x1c')]=qs[_0xf7a4('0x1c')](_0x19879e[_0xf7a4('0x32')][_0xf7a4('0x1c')]);}return _0x4d5b04[_0xf7a4('0x8f')](_0x508d51);}})[_0xf7a4('0x24')](function(_0x56379b){if(_0x56379b){return _0x56379b?{'count':_0x2db325,'rows':_0x56379b}:null;}})[_0xf7a4('0x24')](respondWithResult(_0xa8754,null))['catch'](handleError(_0xa8754,null));};exports[_0xf7a4('0x90')]=function(_0x5a842d,_0x1c7a84,_0x505abd){var _0x3f3cea,_0x5e704c;var _0x24984c=[];var _0x5f21f5=moment()[_0xf7a4('0x66')](_0xf7a4('0x67'));return db['Campaign']['find']({'where':{'id':_0x5a842d[_0xf7a4('0x45')]['id']}})[_0xf7a4('0x24')](handleEntityNotFound(_0x1c7a84,null))[_0xf7a4('0x24')](function(_0x733067){if(_0x733067){_0x5e704c=_0x733067;return _0x733067['addBlackLists'](_0x5a842d[_0xf7a4('0x49')][_0xf7a4('0x68')],_[_0xf7a4('0x52')](_0x5a842d[_0xf7a4('0x49')],[_0xf7a4('0x68'),'id'])||{});}return null;})[_0xf7a4('0x69')](function(_0xafc57e){var _0x2f9b6b;var _0x408358;_0x3f3cea=_0xafc57e||[];var _0xfdc4bb=[];if(_0xafc57e){for(var _0x2240db=0x0;_0x2240db<_0xafc57e[_0xf7a4('0x46')];_0x2240db+=0x1){var _0x569228=_0xafc57e[_0x2240db]['get']({'plain':!![]});_0x2f9b6b=squel[_0xf7a4('0x6b')]()[_0xf7a4('0x6c')]('cm_hopper_black')[_0xf7a4('0x6e')]([_0xf7a4('0x72'),'ContactId','ListId',_0xf7a4('0x5b'),'createdAt',_0xf7a4('0x54')],squel[_0xf7a4('0x71')]()[_0xf7a4('0x73')](_0xf7a4('0x72'),'phone')['field']('id',_0xf7a4('0x70'))[_0xf7a4('0x73')](_0x569228[_0xf7a4('0x79')]['toString'](),_0xf7a4('0x75'))['field'](_0x5a842d['params']['id']['toString'](),_0xf7a4('0x5b'))[_0xf7a4('0x73')]('NOW()',_0xf7a4('0x53'))[_0xf7a4('0x73')]('NOW()',_0xf7a4('0x54'))[_0xf7a4('0x77')]('cm_contacts')[_0xf7a4('0x3b')](_0xf7a4('0x78'))[_0xf7a4('0x3b')](_0xf7a4('0x80'),_0x569228[_0xf7a4('0x79')][_0xf7a4('0x76')]())[_0xf7a4('0x3b')](_0xf7a4('0x7a')))[_0xf7a4('0x76')]();_0xfdc4bb[_0xf7a4('0x8c')](db['sequelize'][_0xf7a4('0x32')](_0x2f9b6b));}return BPromise[_0xf7a4('0x91')](_0xfdc4bb);}})[_0xf7a4('0x24')](function(){return _0x3f3cea;})[_0xf7a4('0x24')](respondWithResult(_0x1c7a84,null))['catch'](handleError(_0x1c7a84,null));};exports['removeBlackLists']=function(_0x54b2fb,_0x4f2dcb,_0x59016f){return db[_0xf7a4('0x2e')][_0xf7a4('0x47')]({'where':{'id':_0x54b2fb['params']['id']}})[_0xf7a4('0x24')](handleEntityNotFound(_0x4f2dcb,null))['then'](function(_0x373eb6){if(_0x373eb6){return _0x373eb6[_0xf7a4('0x92')](_0x54b2fb[_0xf7a4('0x32')][_0xf7a4('0x68')]);}})[_0xf7a4('0x24')](function(_0x540512){if(_0x540512){return db[_0xf7a4('0x62')][_0xf7a4('0x25')]({'where':{'ListId':_0x54b2fb[_0xf7a4('0x32')]['ids'],'CampaignId':_0x54b2fb[_0xf7a4('0x45')]['id']}})[_0xf7a4('0x24')](function(){return _0x540512;});}})[_0xf7a4('0x24')](respondWithStatusCode(_0x4f2dcb,null))[_0xf7a4('0x55')](handleError(_0x4f2dcb,null));}; \ No newline at end of file +var _0xccbf=['into','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','get','IvrCampaigns','UserProfileResource','then','sendStatus','error','stack','name','send','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','body','user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert'];(function(_0x3f938e,_0x4b1e51){var _0x280e4f=function(_0xde6f93){while(--_0xde6f93){_0x3f938e['push'](_0x3f938e['shift']());}};_0x280e4f(++_0x4b1e51);}(_0xccbf,0x1ef));var _0xfccb=function(_0x58bc55,_0x373933){_0x58bc55=_0x58bc55-0x0;var _0x110c3d=_0xccbf[_0x58bc55];return _0x110c3d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfccb('0x0'));var jsonpatch=require(_0xfccb('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfccb('0x2'));var util=require(_0xfccb('0x3'));var path=require(_0xfccb('0x4'));var sox=require(_0xfccb('0x5'));var csv=require(_0xfccb('0x6'));var ejs=require(_0xfccb('0x7'));var fs=require('fs');var fs_extra=require(_0xfccb('0x8'));var _=require(_0xfccb('0x9'));var squel=require(_0xfccb('0xa'));var crypto=require(_0xfccb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfccb('0x6'));var querystring=require('querystring');var Papa=require(_0xfccb('0xc'));var Redis=require(_0xfccb('0xd'));var authService=require(_0xfccb('0xe'));var qs=require(_0xfccb('0xf'));var as=require(_0xfccb('0x10'));var hardwareService=require(_0xfccb('0x11'));var logger=require(_0xfccb('0x12'))('api');var utils=require(_0xfccb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfccb('0x14'));var db=require(_0xfccb('0x15'))['db'];function respondWithStatusCode(_0x294290,_0x6347e){_0x6347e=_0x6347e||0xcc;return function(_0x3feeb8){if(_0x3feeb8){return _0x294290['sendStatus'](_0x6347e);}return _0x294290[_0xfccb('0x16')](_0x6347e)[_0xfccb('0x17')]();};}function respondWithResult(_0x4dbc25,_0x24b877){_0x24b877=_0x24b877||0xc8;return function(_0x1ac34f){if(_0x1ac34f){return _0x4dbc25[_0xfccb('0x16')](_0x24b877)[_0xfccb('0x18')](_0x1ac34f);}};}function respondWithFilteredResult(_0x3ec8f6,_0x4b982c){return function(_0x45f2dc){if(_0x45f2dc){var _0x2c1cdb=typeof _0x4b982c[_0xfccb('0x19')]===_0xfccb('0x1a')&&typeof _0x4b982c['limit']===_0xfccb('0x1a');var _0xa7dde9=_0x45f2dc[_0xfccb('0x1b')];var _0x3ccfaf=_0x2c1cdb?0x0:_0x4b982c[_0xfccb('0x19')];var _0x44bc94=_0x2c1cdb?_0x45f2dc['count']:_0x4b982c[_0xfccb('0x19')]+_0x4b982c['limit'];var _0x2d1282;if(_0x44bc94>=_0xa7dde9){_0x44bc94=_0xa7dde9;_0x2d1282=0xc8;}else{_0x2d1282=0xce;}_0x3ec8f6[_0xfccb('0x16')](_0x2d1282);return _0x3ec8f6[_0xfccb('0x1c')]('Content-Range',_0x3ccfaf+'-'+_0x44bc94+'/'+_0xa7dde9)[_0xfccb('0x18')](_0x45f2dc);}return null;};}function patchUpdates(_0x385272){return function(_0x46c59a){try{jsonpatch[_0xfccb('0x1d')](_0x46c59a,_0x385272,!![]);}catch(_0x121b20){return BPromise[_0xfccb('0x1e')](_0x121b20);}return _0x46c59a[_0xfccb('0x1f')]();};}function saveUpdates(_0x587fe2,_0x5beeef){return function(_0x2baa04){if(_0x2baa04){return _0x2baa04[_0xfccb('0x20')](_0x587fe2)['then'](function(_0x35679f){return _0x35679f;});}return null;};}function removeEntity(_0x23c395,_0x343f15){return function(_0x2087c6){if(_0x2087c6){return _0x2087c6[_0xfccb('0x21')]()['then'](function(){var _0x3a86ed=_0x2087c6[_0xfccb('0x22')]({'plain':!![]});var _0x29e1f9=_0xfccb('0x23');return db[_0xfccb('0x24')][_0xfccb('0x21')]({'where':{'type':_0x29e1f9,'resourceId':_0x3a86ed['id']}})['then'](function(){return _0x2087c6;});})[_0xfccb('0x25')](function(){_0x23c395[_0xfccb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29e5fa,_0x4edf31){return function(_0x2e9e0a){if(!_0x2e9e0a){_0x29e5fa[_0xfccb('0x26')](0x194);}return _0x2e9e0a;};}function handleError(_0x6ba751,_0x2dc7d1){_0x2dc7d1=_0x2dc7d1||0x1f4;return function(_0x54834f){logger[_0xfccb('0x27')](_0x54834f[_0xfccb('0x28')]);if(_0x54834f['name']){delete _0x54834f[_0xfccb('0x29')];}_0x6ba751[_0xfccb('0x16')](_0x2dc7d1)[_0xfccb('0x2a')](_0x54834f);};}exports[_0xfccb('0x2b')]=function(_0x5314b8,_0x3d7e72){var _0x26f6df={},_0xf35e06={},_0x3286f1={'count':0x0,'rows':[]};var _0x301e0b=_['map'](db[_0xfccb('0x2c')][_0xfccb('0x2d')],function(_0x30493f){return{'name':_0x30493f[_0xfccb('0x2e')],'type':_0x30493f[_0xfccb('0x2f')][_0xfccb('0x30')]};});_0xf35e06[_0xfccb('0x31')]=_[_0xfccb('0x32')](_0x301e0b,_0xfccb('0x29'));_0xf35e06[_0xfccb('0x33')]=_['keys'](_0x5314b8[_0xfccb('0x33')]);_0xf35e06[_0xfccb('0x34')]=_[_0xfccb('0x35')](_0xf35e06[_0xfccb('0x31')],_0xf35e06[_0xfccb('0x33')]);_0x26f6df['attributes']=_[_0xfccb('0x35')](_0xf35e06[_0xfccb('0x31')],qs[_0xfccb('0x36')](_0x5314b8[_0xfccb('0x33')][_0xfccb('0x36')]));_0x26f6df['attributes']=_0x26f6df[_0xfccb('0x37')][_0xfccb('0x38')]?_0x26f6df[_0xfccb('0x37')]:_0xf35e06[_0xfccb('0x31')];if(!_0x5314b8[_0xfccb('0x33')][_0xfccb('0x39')](_0xfccb('0x3a'))){_0x26f6df[_0xfccb('0x3b')]=qs[_0xfccb('0x3b')](_0x5314b8[_0xfccb('0x33')][_0xfccb('0x3b')]);_0x26f6df[_0xfccb('0x19')]=qs[_0xfccb('0x19')](_0x5314b8[_0xfccb('0x33')][_0xfccb('0x19')]);}_0x26f6df['order']=qs[_0xfccb('0x3c')](_0x5314b8[_0xfccb('0x33')][_0xfccb('0x3c')]);_0x26f6df[_0xfccb('0x3d')]=qs[_0xfccb('0x34')](_[_0xfccb('0x3e')](_0x5314b8[_0xfccb('0x33')],_0xf35e06['filters']),_0x301e0b);if(_0x5314b8[_0xfccb('0x33')][_0xfccb('0x3f')]){_0x26f6df[_0xfccb('0x3d')]=_[_0xfccb('0x40')](_0x26f6df[_0xfccb('0x3d')],{'$or':_['map'](_0x301e0b,function(_0x2fb449){if(_0x2fb449[_0xfccb('0x2f')]!==_0xfccb('0x41')){var _0x231e27={};_0x231e27[_0x2fb449[_0xfccb('0x29')]]={'$like':'%'+_0x5314b8[_0xfccb('0x33')][_0xfccb('0x3f')]+'%'};return _0x231e27;}})});}_0x26f6df=_[_0xfccb('0x40')]({},_0x26f6df,_0x5314b8[_0xfccb('0x42')]);var _0x6b7a4b={'where':_0x26f6df[_0xfccb('0x3d')]};return db[_0xfccb('0x2c')][_0xfccb('0x1b')](_0x6b7a4b)[_0xfccb('0x25')](function(_0x300eb5){_0x3286f1[_0xfccb('0x1b')]=_0x300eb5;if(_0x5314b8['query'][_0xfccb('0x43')]){_0x26f6df[_0xfccb('0x44')]=[{'all':!![]}];}return db[_0xfccb('0x2c')][_0xfccb('0x45')](_0x26f6df);})['then'](function(_0x16da43){_0x3286f1[_0xfccb('0x46')]=_0x16da43;return _0x3286f1;})[_0xfccb('0x25')](respondWithFilteredResult(_0x3d7e72,_0x26f6df))['catch'](handleError(_0x3d7e72,null));};exports[_0xfccb('0x47')]=function(_0x51cc89,_0x3a6409){var _0x450a82={'raw':![],'where':{'id':_0x51cc89[_0xfccb('0x48')]['id']}},_0x4c1229={};_0x4c1229[_0xfccb('0x31')]=_[_0xfccb('0x49')](db[_0xfccb('0x2c')][_0xfccb('0x2d')]);_0x4c1229[_0xfccb('0x33')]=_[_0xfccb('0x49')](_0x51cc89[_0xfccb('0x33')]);_0x4c1229[_0xfccb('0x34')]=_[_0xfccb('0x35')](_0x4c1229['model'],_0x4c1229[_0xfccb('0x33')]);_0x450a82[_0xfccb('0x37')]=_[_0xfccb('0x35')](_0x4c1229['model'],qs[_0xfccb('0x36')](_0x51cc89[_0xfccb('0x33')][_0xfccb('0x36')]));_0x450a82[_0xfccb('0x37')]=_0x450a82[_0xfccb('0x37')]['length']?_0x450a82[_0xfccb('0x37')]:_0x4c1229['model'];if(_0x51cc89[_0xfccb('0x33')]['includeAll']){_0x450a82[_0xfccb('0x44')]=[{'all':!![]}];}_0x450a82=_['merge']({},_0x450a82,_0x51cc89[_0xfccb('0x42')]);return db[_0xfccb('0x2c')][_0xfccb('0x4a')](_0x450a82)['then'](handleEntityNotFound(_0x3a6409,null))[_0xfccb('0x25')](respondWithResult(_0x3a6409,null))['catch'](handleError(_0x3a6409,null));};exports['create']=function(_0x1dd08b,_0x7bb37c){return db[_0xfccb('0x2c')]['create'](_0x1dd08b[_0xfccb('0x4b')],{})[_0xfccb('0x25')](function(_0x467afe){var _0x11951a=_0x1dd08b[_0xfccb('0x4c')]['get']({'plain':!![]});if(!_0x11951a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11951a[_0xfccb('0x4d')]===_0xfccb('0x4c')){var _0x503c22=_0x467afe[_0xfccb('0x22')]({'plain':!![]});var _0x5045b5=_0xfccb('0x23');return db[_0xfccb('0x4e')][_0xfccb('0x4a')]({'where':{'name':_0x5045b5,'userProfileId':_0x11951a[_0xfccb('0x4f')]},'raw':!![]})[_0xfccb('0x25')](function(_0x237642){if(_0x237642&&_0x237642[_0xfccb('0x50')]===0x0){return db['UserProfileResource'][_0xfccb('0x51')]({'name':_0x503c22['name'],'resourceId':_0x503c22['id'],'type':_0x237642['name'],'sectionId':_0x237642['id']},{})[_0xfccb('0x25')](function(){return _0x467afe;});}else{return _0x467afe;}})['catch'](function(_0x3d86ef){logger['error'](_0xfccb('0x52'),_0x3d86ef);throw _0x3d86ef;});}return _0x467afe;})[_0xfccb('0x25')](respondWithResult(_0x7bb37c,0xc9))[_0xfccb('0x53')](handleError(_0x7bb37c,null));};exports[_0xfccb('0x54')]=function(_0x1d0dad,_0xea2af8){var _0x3a6530={'where':{'id':_0x1d0dad[_0xfccb('0x48')]['id']}},_0x4188c4={};_0x4188c4['model']=_[_0xfccb('0x49')](db[_0xfccb('0x2c')][_0xfccb('0x2d')]);_0x3a6530['attributes']=_[_0xfccb('0x35')](_0x4188c4[_0xfccb('0x31')],qs[_0xfccb('0x36')](_0x1d0dad[_0xfccb('0x33')]['fields']));_0x3a6530[_0xfccb('0x37')]=_0x3a6530['attributes'][_0xfccb('0x38')]?_0x3a6530[_0xfccb('0x37')]:_0x4188c4['model'];if(_0x1d0dad['query'][_0xfccb('0x43')]){_0x3a6530['include']=[{'all':!![]}];}_0x3a6530=_[_0xfccb('0x40')]({},_0x3a6530,_0x1d0dad[_0xfccb('0x42')]);return db[_0xfccb('0x2c')]['find'](_0x3a6530)[_0xfccb('0x25')](handleEntityNotFound(_0xea2af8,null))['then'](function(_0x1497bd){if(_0x1497bd){var _0x3e7319=_0x1497bd[_0xfccb('0x22')]({'plain':!![]});_0x3e7319=qs[_0xfccb('0x55')](_0x3e7319,['id','createdAt',_0xfccb('0x56')]);_0x1d0dad[_0xfccb('0x4b')]=_[_0xfccb('0x55')](_0x1d0dad[_0xfccb('0x4b')],['id',_0xfccb('0x57'),_0xfccb('0x56')]);return db['Campaign'][_0xfccb('0x51')](_[_0xfccb('0x40')](_0x3e7319,_0x1d0dad[_0xfccb('0x4b')]),{'include':_0x1d0dad[_0xfccb('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xfccb('0x25')](function(_0x3f82f9){var _0x6c1e39=_0x1d0dad[_0xfccb('0x4c')][_0xfccb('0x22')]({'plain':!![]});if(!_0x6c1e39)throw new Error(_0xfccb('0x58'));if(_0x6c1e39['role']===_0xfccb('0x4c')){var _0x3db3e4=_0x3f82f9[_0xfccb('0x22')]({'plain':!![]});var _0x5d19eb='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x5d19eb,'userProfileId':_0x6c1e39[_0xfccb('0x4f')]},'raw':!![]})[_0xfccb('0x25')](function(_0x52251a){if(_0x52251a&&_0x52251a[_0xfccb('0x50')]===0x0){return db['UserProfileResource'][_0xfccb('0x51')]({'name':_0x3db3e4[_0xfccb('0x29')],'resourceId':_0x3db3e4['id'],'type':_0x52251a[_0xfccb('0x29')],'sectionId':_0x52251a['id']},{})['then'](function(){return _0x3f82f9;});}else{return _0x3f82f9;}})[_0xfccb('0x53')](function(_0x302b4b){logger[_0xfccb('0x27')](_0xfccb('0x52'),_0x302b4b);throw _0x302b4b;});}return _0x3f82f9;});}})['then'](respondWithResult(_0xea2af8,0xc9))['catch'](handleError(_0xea2af8,null));};exports[_0xfccb('0x20')]=function(_0x5df317,_0xdb6347){if(_0x5df317[_0xfccb('0x4b')]['id']){delete _0x5df317[_0xfccb('0x4b')]['id'];}return db[_0xfccb('0x2c')][_0xfccb('0x4a')]({'where':{'id':_0x5df317['params']['id']}})[_0xfccb('0x25')](handleEntityNotFound(_0xdb6347,null))[_0xfccb('0x25')](saveUpdates(_0x5df317[_0xfccb('0x4b')],null))['then'](respondWithResult(_0xdb6347,null))['catch'](handleError(_0xdb6347,null));};exports[_0xfccb('0x21')]=function(_0x347ed7,_0x121d6c){return db[_0xfccb('0x2c')]['find']({'where':{'id':_0x347ed7[_0xfccb('0x48')]['id']}})[_0xfccb('0x25')](handleEntityNotFound(_0x121d6c,null))['then'](removeEntity(_0x121d6c,null))[_0xfccb('0x53')](handleError(_0x121d6c,null));};exports['getHoppers']=function(_0x2c8fd9,_0x45dd06,_0x2749ae){var _0x4fad84={'raw':!![],'where':{}};var _0x1d03e8={};var _0x2924e4={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x2c8fd9[_0xfccb('0x48')]['id']}})['then'](handleEntityNotFound(_0x45dd06,null))[_0xfccb('0x25')](function(_0x153075){if(_0x153075){_0x1d03e8['model']=_[_0xfccb('0x49')](db[_0xfccb('0x59')][_0xfccb('0x2d')]);_0x1d03e8[_0xfccb('0x33')]=_['keys'](_0x2c8fd9[_0xfccb('0x33')]);_0x1d03e8['filters']=_[_0xfccb('0x35')](_0x1d03e8[_0xfccb('0x31')],_0x1d03e8[_0xfccb('0x33')]);_0x4fad84['attributes']=_[_0xfccb('0x35')](_0x1d03e8[_0xfccb('0x31')],qs[_0xfccb('0x36')](_0x2c8fd9[_0xfccb('0x33')][_0xfccb('0x36')]));_0x4fad84[_0xfccb('0x37')]=_0x4fad84[_0xfccb('0x37')]['length']?_0x4fad84[_0xfccb('0x37')]:_0x1d03e8['model'];if(!_0x2c8fd9[_0xfccb('0x33')]['hasOwnProperty'](_0xfccb('0x3a'))){_0x4fad84[_0xfccb('0x3b')]=qs[_0xfccb('0x3b')](_0x2c8fd9[_0xfccb('0x33')]['limit']);_0x4fad84['offset']=qs[_0xfccb('0x19')](_0x2c8fd9['query']['offset']);}_0x4fad84['order']=qs[_0xfccb('0x3c')](_0x2c8fd9['query'][_0xfccb('0x3c')]);_0x4fad84['where']=qs[_0xfccb('0x34')](_[_0xfccb('0x3e')](_0x2c8fd9[_0xfccb('0x33')],_0x1d03e8[_0xfccb('0x34')]));_0x4fad84[_0xfccb('0x3d')][_0xfccb('0x5a')]=_0x153075['id'];if(_0x2c8fd9[_0xfccb('0x33')]['filter']){_0x4fad84[_0xfccb('0x3d')]=_['merge'](_0x4fad84[_0xfccb('0x3d')],{'$or':_[_0xfccb('0x32')](_0x4fad84[_0xfccb('0x37')],function(_0x5e7fc3){var _0x5c7838={};_0x5c7838[_0x5e7fc3]={'$like':'%'+_0x2c8fd9[_0xfccb('0x33')][_0xfccb('0x3f')]+'%'};return _0x5c7838;})});}_0x4fad84=_[_0xfccb('0x40')]({},_0x4fad84,_0x2c8fd9[_0xfccb('0x42')]);return db[_0xfccb('0x59')][_0xfccb('0x1b')]({'where':_0x4fad84[_0xfccb('0x3d')]})[_0xfccb('0x25')](function(_0x452d7a){_0x2924e4[_0xfccb('0x1b')]=_0x452d7a;if(_0x2c8fd9[_0xfccb('0x33')][_0xfccb('0x43')]){_0x4fad84[_0xfccb('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0xfccb('0x45')](_0x4fad84);})[_0xfccb('0x25')](function(_0x2ab1cc){_0x2924e4[_0xfccb('0x46')]=_0x2ab1cc;return _0x2924e4;});}})[_0xfccb('0x25')](respondWithFilteredResult(_0x45dd06,_0x4fad84))[_0xfccb('0x53')](handleError(_0x45dd06,null));};exports[_0xfccb('0x5b')]=function(_0x363c1e,_0x5c0779,_0x4a6f51){var _0x35c6dd={'raw':!![],'where':{}};var _0x1961a0={};var _0x38d94c={'count':0x0,'rows':[]};return db[_0xfccb('0x2c')][_0xfccb('0x5c')]({'where':{'id':_0x363c1e[_0xfccb('0x48')]['id']}})[_0xfccb('0x25')](handleEntityNotFound(_0x5c0779,null))['then'](function(_0x1b5961){if(_0x1b5961){_0x1961a0[_0xfccb('0x31')]=_[_0xfccb('0x49')](db[_0xfccb('0x5d')][_0xfccb('0x2d')]);_0x1961a0['query']=_[_0xfccb('0x49')](_0x363c1e[_0xfccb('0x33')]);_0x1961a0[_0xfccb('0x34')]=_[_0xfccb('0x35')](_0x1961a0['model'],_0x1961a0[_0xfccb('0x33')]);_0x35c6dd[_0xfccb('0x37')]=_['intersection'](_0x1961a0[_0xfccb('0x31')],qs['fields'](_0x363c1e[_0xfccb('0x33')]['fields']));_0x35c6dd['attributes']=_0x35c6dd['attributes']['length']?_0x35c6dd[_0xfccb('0x37')]:_0x1961a0[_0xfccb('0x31')];if(!_0x363c1e[_0xfccb('0x33')][_0xfccb('0x39')](_0xfccb('0x3a'))){_0x35c6dd['limit']=qs[_0xfccb('0x3b')](_0x363c1e[_0xfccb('0x33')][_0xfccb('0x3b')]);_0x35c6dd[_0xfccb('0x19')]=qs['offset'](_0x363c1e[_0xfccb('0x33')][_0xfccb('0x19')]);}_0x35c6dd[_0xfccb('0x5e')]=qs[_0xfccb('0x3c')](_0x363c1e['query'][_0xfccb('0x3c')]);_0x35c6dd[_0xfccb('0x3d')]=qs['filters'](_[_0xfccb('0x3e')](_0x363c1e[_0xfccb('0x33')],_0x1961a0[_0xfccb('0x34')]));_0x35c6dd[_0xfccb('0x3d')]['CampaignId']=_0x1b5961['id'];if(_0x363c1e[_0xfccb('0x33')][_0xfccb('0x3f')]){_0x35c6dd[_0xfccb('0x3d')]=_[_0xfccb('0x40')](_0x35c6dd[_0xfccb('0x3d')],{'$or':_[_0xfccb('0x32')](_0x35c6dd[_0xfccb('0x37')],function(_0x3b949b){var _0x1afb9e={};_0x1afb9e[_0x3b949b]={'$like':'%'+_0x363c1e[_0xfccb('0x33')][_0xfccb('0x3f')]+'%'};return _0x1afb9e;})});}_0x35c6dd=_[_0xfccb('0x40')]({},_0x35c6dd,_0x363c1e['options']);return db[_0xfccb('0x5d')][_0xfccb('0x1b')]({'where':_0x35c6dd['where']})[_0xfccb('0x25')](function(_0x5783d6){_0x38d94c['count']=_0x5783d6;if(_0x363c1e[_0xfccb('0x33')][_0xfccb('0x43')]){_0x35c6dd[_0xfccb('0x44')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x35c6dd);})[_0xfccb('0x25')](function(_0x3de35e){_0x38d94c[_0xfccb('0x46')]=_0x3de35e;return _0x38d94c;});}})[_0xfccb('0x25')](respondWithFilteredResult(_0x5c0779,_0x35c6dd))['catch'](handleError(_0x5c0779,null));};exports[_0xfccb('0x5f')]=function(_0x4b8674,_0x4aeec8,_0x579a8e){var _0x37fd9f={'raw':!![],'where':{}};var _0x5d2f4a={};var _0x4b8b6f={'count':0x0,'rows':[]};return db[_0xfccb('0x2c')]['findOne']({'where':{'id':_0x4b8674[_0xfccb('0x48')]['id']}})[_0xfccb('0x25')](handleEntityNotFound(_0x4aeec8,null))[_0xfccb('0x25')](function(_0x910d55){if(_0x910d55){_0x5d2f4a[_0xfccb('0x31')]=_[_0xfccb('0x49')](db['CmHopperFinal'][_0xfccb('0x2d')]);_0x5d2f4a['query']=_[_0xfccb('0x49')](_0x4b8674[_0xfccb('0x33')]);_0x5d2f4a[_0xfccb('0x34')]=_[_0xfccb('0x35')](_0x5d2f4a[_0xfccb('0x31')],_0x5d2f4a['query']);_0x37fd9f[_0xfccb('0x37')]=_[_0xfccb('0x35')](_0x5d2f4a[_0xfccb('0x31')],qs[_0xfccb('0x36')](_0x4b8674[_0xfccb('0x33')][_0xfccb('0x36')]));_0x37fd9f['attributes']=_0x37fd9f[_0xfccb('0x37')][_0xfccb('0x38')]?_0x37fd9f[_0xfccb('0x37')]:_0x5d2f4a[_0xfccb('0x31')];if(!_0x4b8674['query']['hasOwnProperty'](_0xfccb('0x3a'))){_0x37fd9f[_0xfccb('0x3b')]=qs[_0xfccb('0x3b')](_0x4b8674[_0xfccb('0x33')][_0xfccb('0x3b')]);_0x37fd9f[_0xfccb('0x19')]=qs[_0xfccb('0x19')](_0x4b8674[_0xfccb('0x33')][_0xfccb('0x19')]);}_0x37fd9f['order']=qs[_0xfccb('0x3c')](_0x4b8674[_0xfccb('0x33')]['sort']);_0x37fd9f[_0xfccb('0x3d')]=qs[_0xfccb('0x34')](_[_0xfccb('0x3e')](_0x4b8674[_0xfccb('0x33')],_0x5d2f4a[_0xfccb('0x34')]));_0x37fd9f['where']['CampaignId']=_0x910d55['id'];if(_0x4b8674[_0xfccb('0x33')][_0xfccb('0x3f')]){_0x37fd9f[_0xfccb('0x3d')]=_[_0xfccb('0x40')](_0x37fd9f[_0xfccb('0x3d')],{'$or':_[_0xfccb('0x32')](_0x37fd9f[_0xfccb('0x37')],function(_0x56a9c2){var _0xe5c83c={};_0xe5c83c[_0x56a9c2]={'$like':'%'+_0x4b8674[_0xfccb('0x33')][_0xfccb('0x3f')]+'%'};return _0xe5c83c;})});}_0x37fd9f=_[_0xfccb('0x40')]({},_0x37fd9f,_0x4b8674['options']);return db[_0xfccb('0x60')][_0xfccb('0x1b')]({'where':_0x37fd9f['where']})[_0xfccb('0x25')](function(_0x1f5192){_0x4b8b6f[_0xfccb('0x1b')]=_0x1f5192;if(_0x4b8674['query']['includeAll']){_0x37fd9f[_0xfccb('0x44')]=[{'all':!![]}];}return db[_0xfccb('0x60')][_0xfccb('0x45')](_0x37fd9f);})[_0xfccb('0x25')](function(_0x4a6911){_0x4b8b6f[_0xfccb('0x46')]=_0x4a6911;return _0x4b8b6f;});}})[_0xfccb('0x25')](respondWithFilteredResult(_0x4aeec8,_0x37fd9f))[_0xfccb('0x53')](handleError(_0x4aeec8,null));};exports[_0xfccb('0x61')]=function(_0x531d94,_0x4c62b2,_0xd710de){var _0x12708a={'raw':!![],'where':{}};var _0x9179f3={};var _0x4904cd={'count':0x0,'rows':[]};return db[_0xfccb('0x2c')][_0xfccb('0x5c')]({'where':{'id':_0x531d94[_0xfccb('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c62b2,null))[_0xfccb('0x25')](function(_0x23e62d){if(_0x23e62d){_0x9179f3[_0xfccb('0x31')]=_['keys'](db[_0xfccb('0x62')]['rawAttributes']);_0x9179f3[_0xfccb('0x33')]=_[_0xfccb('0x49')](_0x531d94[_0xfccb('0x33')]);_0x9179f3['filters']=_[_0xfccb('0x35')](_0x9179f3[_0xfccb('0x31')],_0x9179f3['query']);_0x12708a[_0xfccb('0x37')]=_[_0xfccb('0x35')](_0x9179f3[_0xfccb('0x31')],qs[_0xfccb('0x36')](_0x531d94[_0xfccb('0x33')][_0xfccb('0x36')]));_0x12708a[_0xfccb('0x37')]=_0x12708a[_0xfccb('0x37')][_0xfccb('0x38')]?_0x12708a['attributes']:_0x9179f3[_0xfccb('0x31')];if(!_0x531d94[_0xfccb('0x33')][_0xfccb('0x39')]('nolimit')){_0x12708a[_0xfccb('0x3b')]=qs[_0xfccb('0x3b')](_0x531d94[_0xfccb('0x33')][_0xfccb('0x3b')]);_0x12708a[_0xfccb('0x19')]=qs[_0xfccb('0x19')](_0x531d94[_0xfccb('0x33')][_0xfccb('0x19')]);}_0x12708a[_0xfccb('0x5e')]=qs[_0xfccb('0x3c')](_0x531d94[_0xfccb('0x33')]['sort']);_0x12708a[_0xfccb('0x3d')]=qs[_0xfccb('0x34')](_['pick'](_0x531d94[_0xfccb('0x33')],_0x9179f3['filters']));_0x12708a[_0xfccb('0x3d')][_0xfccb('0x5a')]=_0x23e62d['id'];if(_0x531d94[_0xfccb('0x33')][_0xfccb('0x3f')]){_0x12708a[_0xfccb('0x3d')]=_[_0xfccb('0x40')](_0x12708a[_0xfccb('0x3d')],{'$or':_[_0xfccb('0x32')](_0x12708a['attributes'],function(_0x133c0c){var _0x2c6bc4={};_0x2c6bc4[_0x133c0c]={'$like':'%'+_0x531d94[_0xfccb('0x33')][_0xfccb('0x3f')]+'%'};return _0x2c6bc4;})});}_0x12708a=_[_0xfccb('0x40')]({},_0x12708a,_0x531d94[_0xfccb('0x42')]);return db['CmHopperBlack'][_0xfccb('0x1b')]({'where':_0x12708a[_0xfccb('0x3d')]})[_0xfccb('0x25')](function(_0x46c3f1){_0x4904cd[_0xfccb('0x1b')]=_0x46c3f1;if(_0x531d94[_0xfccb('0x33')][_0xfccb('0x43')]){_0x12708a[_0xfccb('0x44')]=[{'all':!![]}];}return db[_0xfccb('0x62')][_0xfccb('0x45')](_0x12708a);})['then'](function(_0x53a013){_0x4904cd[_0xfccb('0x46')]=_0x53a013;return _0x4904cd;});}})[_0xfccb('0x25')](respondWithFilteredResult(_0x4c62b2,_0x12708a))[_0xfccb('0x53')](handleError(_0x4c62b2,null));};exports[_0xfccb('0x63')]=function(_0x41d3c7,_0x35e71c,_0x4e4042){var _0x14f60e={};var _0x3bee00={};var _0x8c4c08;var _0x332e15;return db['Campaign'][_0xfccb('0x5c')]({'where':{'id':_0x41d3c7[_0xfccb('0x48')]['id']}})[_0xfccb('0x25')](handleEntityNotFound(_0x35e71c,null))[_0xfccb('0x25')](function(_0x2812cf){if(_0x2812cf){_0x8c4c08=_0x2812cf;_0x3bee00[_0xfccb('0x31')]=_[_0xfccb('0x49')](db[_0xfccb('0x64')][_0xfccb('0x2d')]);_0x3bee00['query']=_['keys'](_0x41d3c7[_0xfccb('0x33')]);_0x3bee00['filters']=_['intersection'](_0x3bee00[_0xfccb('0x31')],_0x3bee00[_0xfccb('0x33')]);_0x14f60e[_0xfccb('0x37')]=_[_0xfccb('0x35')](_0x3bee00[_0xfccb('0x31')],qs[_0xfccb('0x36')](_0x41d3c7[_0xfccb('0x33')]['fields']));_0x14f60e[_0xfccb('0x37')]=_0x14f60e[_0xfccb('0x37')][_0xfccb('0x38')]?_0x14f60e['attributes']:_0x3bee00[_0xfccb('0x31')];_0x14f60e['order']=qs[_0xfccb('0x3c')](_0x41d3c7[_0xfccb('0x33')]['sort']);_0x14f60e['where']=qs[_0xfccb('0x34')](_[_0xfccb('0x3e')](_0x41d3c7['query'],_0x3bee00['filters']));if(_0x41d3c7['query'][_0xfccb('0x3f')]){_0x14f60e['where']=_['merge'](_0x14f60e[_0xfccb('0x3d')],{'$or':_[_0xfccb('0x32')](_0x14f60e[_0xfccb('0x37')],function(_0x20a5d5){var _0xc2c5ba={};_0xc2c5ba[_0x20a5d5]={'$like':'%'+_0x41d3c7[_0xfccb('0x33')]['filter']+'%'};return _0xc2c5ba;})});}_0x14f60e=_[_0xfccb('0x40')]({},_0x14f60e,_0x41d3c7[_0xfccb('0x42')]);return _0x8c4c08[_0xfccb('0x63')](_0x14f60e);}})[_0xfccb('0x25')](function(_0x2aae0e){if(_0x2aae0e){_0x332e15=_0x2aae0e[_0xfccb('0x38')];if(!_0x41d3c7[_0xfccb('0x33')][_0xfccb('0x39')](_0xfccb('0x3a'))){_0x14f60e[_0xfccb('0x3b')]=qs[_0xfccb('0x3b')](_0x41d3c7[_0xfccb('0x33')][_0xfccb('0x3b')]);_0x14f60e['offset']=qs[_0xfccb('0x19')](_0x41d3c7[_0xfccb('0x33')][_0xfccb('0x19')]);}return _0x8c4c08[_0xfccb('0x63')](_0x14f60e);}})[_0xfccb('0x25')](function(_0x32728){if(_0x32728){return _0x32728?{'count':_0x332e15,'rows':_0x32728}:null;}})[_0xfccb('0x25')](respondWithResult(_0x35e71c,null))[_0xfccb('0x53')](handleError(_0x35e71c,null));};exports['addLists']=function(_0x5d7f8b,_0x215d9a,_0x7e7bfa){var _0x3f7418,_0x4b7648;var _0x5a1e31=[];var _0x1503ee=moment()[_0xfccb('0x65')](_0xfccb('0x66'));return db[_0xfccb('0x2c')][_0xfccb('0x4a')]({'where':{'id':_0x5d7f8b['params']['id']}})[_0xfccb('0x25')](handleEntityNotFound(_0x215d9a,null))[_0xfccb('0x25')](function(_0x58cc17){if(_0x58cc17){_0x4b7648=_0x58cc17;return _0x58cc17[_0xfccb('0x67')](_0x5d7f8b[_0xfccb('0x4b')][_0xfccb('0x68')],_['omit'](_0x5d7f8b[_0xfccb('0x4b')],[_0xfccb('0x68'),'id'])||{});}return null;})[_0xfccb('0x69')](function(_0x1b1543){var _0xcbc0c;var _0x48f195;_0x3f7418=_0x1b1543||[];var _0x1dcfe3=[];if(_0x1b1543){for(var _0x12edbc=0x0;_0x12edbc<_0x1b1543['length'];_0x12edbc+=0x1){var _0x2ec9b0=_0x1b1543[_0x12edbc][_0xfccb('0x22')]({'plain':!![]});_0x4b7648[_0xfccb('0x6a')]=_0x5d7f8b['body'][_0xfccb('0x6a')]?_0x5d7f8b['body'][_0xfccb('0x6a')]:_0x4b7648['dialCheckDuplicateType'];switch(_0x4b7648[_0xfccb('0x6a')]){case _0xfccb('0x6b'):_0xcbc0c=squel[_0xfccb('0x6c')]()[_0xfccb('0x6d')](_0xfccb('0x6e'))[_0xfccb('0x6f')]([_0xfccb('0x70'),_0xfccb('0x71'),'ContactId',_0xfccb('0x72'),_0xfccb('0x5a'),_0xfccb('0x57'),_0xfccb('0x56')],squel[_0xfccb('0x73')]()[_0xfccb('0x74')](_0xfccb('0x70'),_0xfccb('0x70'))[_0xfccb('0x74')](_0xfccb('0x75'),_0xfccb('0x71'))['field']('id',_0xfccb('0x76'))['field'](_0x2ec9b0[_0xfccb('0x77')][_0xfccb('0x78')](),_0xfccb('0x72'))[_0xfccb('0x74')](_0x5d7f8b[_0xfccb('0x48')]['id']['toString'](),_0xfccb('0x5a'))[_0xfccb('0x74')]('\x27'+_0x1503ee+'\x27','createdAt')['field']('\x27'+_0x1503ee+'\x27','updatedAt')['from'](_0xfccb('0x79'))[_0xfccb('0x3d')](_0xfccb('0x7a'))[_0xfccb('0x3d')]('ListId\x20=\x20?',_0x2ec9b0[_0xfccb('0x77')][_0xfccb('0x78')]())[_0xfccb('0x3d')](_0xfccb('0x7b'))[_0xfccb('0x3d')](_0xfccb('0x7c'),squel['select']()[_0xfccb('0x74')](_0xfccb('0x7d'))[_0xfccb('0x7e')](_0xfccb('0x7f'))[_0xfccb('0x3d')]('CampaignId\x20=\x20?',_0x5d7f8b['params']['id'][_0xfccb('0x78')]()))[_0xfccb('0x3d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfccb('0x73')]()[_0xfccb('0x74')](_0xfccb('0x80'))['from'](_0xfccb('0x6e'))[_0xfccb('0x3d')](_0xfccb('0x81'),_0x5d7f8b[_0xfccb('0x48')]['id']['toString']())))['toString']();break;case _0xfccb('0x82'):_0xcbc0c=squel[_0xfccb('0x6c')]()[_0xfccb('0x6d')](_0xfccb('0x6e'))[_0xfccb('0x6f')]([_0xfccb('0x70'),_0xfccb('0x71'),'ContactId',_0xfccb('0x72'),_0xfccb('0x5a'),'createdAt','updatedAt'],squel['select']()['field']('phone','phone')[_0xfccb('0x74')]('NOW()',_0xfccb('0x71'))['field']('id','ContactId')['field'](_0x2ec9b0['CmListId']['toString'](),_0xfccb('0x72'))[_0xfccb('0x74')](_0x5d7f8b[_0xfccb('0x48')]['id'][_0xfccb('0x78')](),_0xfccb('0x5a'))[_0xfccb('0x74')]('\x27'+_0x1503ee+'\x27',_0xfccb('0x57'))[_0xfccb('0x74')]('\x27'+_0x1503ee+'\x27',_0xfccb('0x56'))[_0xfccb('0x7e')](_0xfccb('0x79'))[_0xfccb('0x3d')](_0xfccb('0x7a'))['where'](_0xfccb('0x83'),_0x2ec9b0[_0xfccb('0x77')][_0xfccb('0x78')]())[_0xfccb('0x3d')](_0xfccb('0x7b'))[_0xfccb('0x3d')](_0xfccb('0x7c'),squel['select']()[_0xfccb('0x74')](_0xfccb('0x80'))[_0xfccb('0x7e')](_0xfccb('0x6e'))[_0xfccb('0x3d')](_0xfccb('0x81'),_0x5d7f8b[_0xfccb('0x48')]['id'][_0xfccb('0x78')]())))[_0xfccb('0x78')]();break;default:_0xcbc0c=squel[_0xfccb('0x6c')]()['into'](_0xfccb('0x6e'))[_0xfccb('0x6f')]([_0xfccb('0x70'),'scheduledAt',_0xfccb('0x76'),_0xfccb('0x72'),_0xfccb('0x5a'),_0xfccb('0x57'),'updatedAt'],squel[_0xfccb('0x73')]()[_0xfccb('0x74')](_0xfccb('0x70'),'phone')['field'](_0xfccb('0x75'),'scheduledAt')[_0xfccb('0x74')]('id','ContactId')[_0xfccb('0x74')](_0x2ec9b0[_0xfccb('0x77')][_0xfccb('0x78')](),_0xfccb('0x72'))[_0xfccb('0x74')](_0x5d7f8b['params']['id'][_0xfccb('0x78')](),'CampaignId')[_0xfccb('0x74')]('\x27'+_0x1503ee+'\x27',_0xfccb('0x57'))[_0xfccb('0x74')]('\x27'+_0x1503ee+'\x27',_0xfccb('0x56'))[_0xfccb('0x7e')](_0xfccb('0x79'))[_0xfccb('0x3d')](_0xfccb('0x7a'))[_0xfccb('0x3d')](_0xfccb('0x83'),_0x2ec9b0[_0xfccb('0x77')][_0xfccb('0x78')]())[_0xfccb('0x3d')](_0xfccb('0x7b')))[_0xfccb('0x78')]();}_0x48f195=squel['insert']()[_0xfccb('0x6d')](_0xfccb('0x84'))['fromQuery']([_0xfccb('0x85'),_0xfccb('0x71'),_0xfccb('0x70'),_0xfccb('0x86'),_0xfccb('0x57'),_0xfccb('0x56')],squel[_0xfccb('0x73')]()['field'](_0xfccb('0x87'),'id')['field'](_0xfccb('0x75'),_0xfccb('0x71'))[_0xfccb('0x74')](_0xfccb('0x88'),_0xfccb('0x70'))[_0xfccb('0x74')](_0xfccb('0x89'),_0xfccb('0x86'))['field']('\x27'+_0x1503ee+'\x27',_0xfccb('0x57'))['field']('\x27'+_0x1503ee+'\x27','updatedAt')[_0xfccb('0x7e')](_0xfccb('0x8a'),'ci')[_0xfccb('0x8b')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0xfccb('0x3d')](_0xfccb('0x8c'),_0x2ec9b0['CmListId'][_0xfccb('0x78')]())['where'](_0xfccb('0x8d'),_0x5d7f8b['params']['id'][_0xfccb('0x78')]())[_0xfccb('0x3d')](_0xfccb('0x8e'),_0x1503ee))['toString']();_0x1dcfe3[_0xfccb('0x8f')](db[_0xfccb('0x90')][_0xfccb('0x33')](_0xcbc0c));_0x5a1e31[_0xfccb('0x8f')](db[_0xfccb('0x90')][_0xfccb('0x33')](_0x48f195));}return BPromise[_0xfccb('0x91')](_0x1dcfe3);}})['then'](function(){return BPromise[_0xfccb('0x91')](_0x5a1e31);})[_0xfccb('0x25')](function(){return _0x3f7418;})[_0xfccb('0x25')](respondWithResult(_0x215d9a,null))[_0xfccb('0x53')](handleError(_0x215d9a,null));};exports[_0xfccb('0x92')]=function(_0x29fbc5,_0x14e165,_0x33d546){return db[_0xfccb('0x2c')][_0xfccb('0x4a')]({'where':{'id':_0x29fbc5['params']['id']}})['then'](handleEntityNotFound(_0x14e165,null))['then'](function(_0x50cb49){if(_0x50cb49){return _0x50cb49[_0xfccb('0x92')](_0x29fbc5['query']['ids']);}})[_0xfccb('0x25')](function(_0x1851ff){if(_0x1851ff){return db[_0xfccb('0x59')]['destroy']({'where':{'ListId':_0x29fbc5[_0xfccb('0x33')][_0xfccb('0x68')],'CampaignId':_0x29fbc5['params']['id']}})['then'](function(){return _0x1851ff;});}})[_0xfccb('0x25')](respondWithStatusCode(_0x14e165,null))['catch'](handleError(_0x14e165,null));};exports[_0xfccb('0x93')]=function(_0x4bec17,_0x14d110,_0x124445){var _0x2842a6={};var _0x1d776e={};var _0x13455a;var _0x1f374b;return db[_0xfccb('0x2c')]['findOne']({'where':{'id':_0x4bec17['params']['id']}})[_0xfccb('0x25')](handleEntityNotFound(_0x14d110,null))[_0xfccb('0x25')](function(_0x1c4c9f){if(_0x1c4c9f){_0x13455a=_0x1c4c9f;_0x1d776e[_0xfccb('0x31')]=_[_0xfccb('0x49')](db[_0xfccb('0x64')][_0xfccb('0x2d')]);_0x1d776e[_0xfccb('0x33')]=_['keys'](_0x4bec17[_0xfccb('0x33')]);_0x1d776e[_0xfccb('0x34')]=_[_0xfccb('0x35')](_0x1d776e['model'],_0x1d776e[_0xfccb('0x33')]);_0x2842a6[_0xfccb('0x37')]=_[_0xfccb('0x35')](_0x1d776e['model'],qs[_0xfccb('0x36')](_0x4bec17[_0xfccb('0x33')]['fields']));_0x2842a6[_0xfccb('0x37')]=_0x2842a6[_0xfccb('0x37')]['length']?_0x2842a6[_0xfccb('0x37')]:_0x1d776e[_0xfccb('0x31')];_0x2842a6[_0xfccb('0x5e')]=qs[_0xfccb('0x3c')](_0x4bec17[_0xfccb('0x33')][_0xfccb('0x3c')]);_0x2842a6['where']=qs[_0xfccb('0x34')](_[_0xfccb('0x3e')](_0x4bec17[_0xfccb('0x33')],_0x1d776e[_0xfccb('0x34')]));if(_0x4bec17[_0xfccb('0x33')]['filter']){_0x2842a6[_0xfccb('0x3d')]=_[_0xfccb('0x40')](_0x2842a6[_0xfccb('0x3d')],{'$or':_[_0xfccb('0x32')](_0x2842a6[_0xfccb('0x37')],function(_0x1855f3){var _0x2dc8a1={};_0x2dc8a1[_0x1855f3]={'$like':'%'+_0x4bec17[_0xfccb('0x33')][_0xfccb('0x3f')]+'%'};return _0x2dc8a1;})});}_0x2842a6=_[_0xfccb('0x40')]({},_0x2842a6,_0x4bec17['options']);return _0x13455a[_0xfccb('0x93')](_0x2842a6);}})[_0xfccb('0x25')](function(_0x184a8d){if(_0x184a8d){_0x1f374b=_0x184a8d[_0xfccb('0x38')];if(!_0x4bec17[_0xfccb('0x33')][_0xfccb('0x39')](_0xfccb('0x3a'))){_0x2842a6['limit']=qs['limit'](_0x4bec17[_0xfccb('0x33')][_0xfccb('0x3b')]);_0x2842a6[_0xfccb('0x19')]=qs[_0xfccb('0x19')](_0x4bec17[_0xfccb('0x33')][_0xfccb('0x19')]);}return _0x13455a[_0xfccb('0x93')](_0x2842a6);}})['then'](function(_0x137e3a){if(_0x137e3a){return _0x137e3a?{'count':_0x1f374b,'rows':_0x137e3a}:null;}})['then'](respondWithResult(_0x14d110,null))[_0xfccb('0x53')](handleError(_0x14d110,null));};exports[_0xfccb('0x94')]=function(_0x1ba756,_0x9b28d1,_0x2ca0fe){var _0x54e402,_0x5d595e;var _0x115be7=[];var _0x39005e=moment()[_0xfccb('0x65')](_0xfccb('0x66'));return db[_0xfccb('0x2c')][_0xfccb('0x4a')]({'where':{'id':_0x1ba756['params']['id']}})['then'](handleEntityNotFound(_0x9b28d1,null))['then'](function(_0x135ef1){if(_0x135ef1){_0x5d595e=_0x135ef1;return _0x135ef1[_0xfccb('0x94')](_0x1ba756[_0xfccb('0x4b')][_0xfccb('0x68')],_[_0xfccb('0x55')](_0x1ba756[_0xfccb('0x4b')],[_0xfccb('0x68'),'id'])||{});}return null;})[_0xfccb('0x69')](function(_0x56f0ed){var _0x14ad3a;var _0x29e6d8;_0x54e402=_0x56f0ed||[];var _0x35baae=[];if(_0x56f0ed){for(var _0x4b5d97=0x0;_0x4b5d97<_0x56f0ed['length'];_0x4b5d97+=0x1){var _0xa91494=_0x56f0ed[_0x4b5d97][_0xfccb('0x22')]({'plain':!![]});_0x14ad3a=squel[_0xfccb('0x6c')]()['into'](_0xfccb('0x95'))['fromQuery']([_0xfccb('0x70'),'ContactId',_0xfccb('0x72'),'CampaignId','createdAt',_0xfccb('0x56')],squel[_0xfccb('0x73')]()['field'](_0xfccb('0x70'),_0xfccb('0x70'))[_0xfccb('0x74')]('id','ContactId')[_0xfccb('0x74')](_0xa91494[_0xfccb('0x77')]['toString'](),_0xfccb('0x72'))[_0xfccb('0x74')](_0x1ba756['params']['id'][_0xfccb('0x78')](),_0xfccb('0x5a'))[_0xfccb('0x74')]('NOW()','createdAt')[_0xfccb('0x74')](_0xfccb('0x75'),_0xfccb('0x56'))[_0xfccb('0x7e')](_0xfccb('0x79'))[_0xfccb('0x3d')](_0xfccb('0x7a'))[_0xfccb('0x3d')](_0xfccb('0x83'),_0xa91494[_0xfccb('0x77')][_0xfccb('0x78')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x35baae['push'](db['sequelize'][_0xfccb('0x33')](_0x14ad3a));}return BPromise[_0xfccb('0x91')](_0x35baae);}})[_0xfccb('0x25')](function(){return _0x54e402;})[_0xfccb('0x25')](respondWithResult(_0x9b28d1,null))[_0xfccb('0x53')](handleError(_0x9b28d1,null));};exports[_0xfccb('0x96')]=function(_0x3eecd3,_0x1492ae,_0x55d87a){return db['Campaign'][_0xfccb('0x4a')]({'where':{'id':_0x3eecd3[_0xfccb('0x48')]['id']}})[_0xfccb('0x25')](handleEntityNotFound(_0x1492ae,null))[_0xfccb('0x25')](function(_0x2444fd){if(_0x2444fd){return _0x2444fd[_0xfccb('0x96')](_0x3eecd3[_0xfccb('0x33')][_0xfccb('0x68')]);}})[_0xfccb('0x25')](function(_0x4a6c52){if(_0x4a6c52){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x3eecd3[_0xfccb('0x33')][_0xfccb('0x68')],'CampaignId':_0x3eecd3[_0xfccb('0x48')]['id']}})[_0xfccb('0x25')](function(){return _0x4a6c52;});}})[_0xfccb('0x25')](respondWithStatusCode(_0x1492ae,null))[_0xfccb('0x53')](handleError(_0x1492ae,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index ad5b338..0b5325b 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x504dee,_0x3cefd3){var _0x3fb6c0=function(_0x188524){while(--_0x188524){_0x504dee['push'](_0x504dee['shift']());}};_0x3fb6c0(++_0x3cefd3);}(_0x7a54,0x106));var _0x47a5=function(_0x546555,_0x2344d4){_0x546555=_0x546555-0x0;var _0x24c347=_0x7a54[_0x546555];return _0x24c347;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x51d26e,_0x5bc3ae){var _0x10c10a=function(_0x21a675){while(--_0x21a675){_0x51d26e['push'](_0x51d26e['shift']());}};_0x10c10a(++_0x5bc3ae);}(_0x7a54,0x106));var _0x47a5=function(_0x567a7f,_0x49da2f){_0x567a7f=_0x567a7f-0x0;var _0x1305cf=_0x7a54[_0x567a7f];return _0x1305cf;};'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 ba5fd60..e0b1159 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 _0xacfe=['where','attributes','limit','map','include','model','then','GetCampaign','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','raw'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xacfe,0xfd));var _0xeacf=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xacfe[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeacf('0x0'));var BPromise=require(_0xeacf('0x1'));var rs=require(_0xeacf('0x2'));var fs=require('fs');var Redis=require(_0xeacf('0x3'));var db=require(_0xeacf('0x4'))['db'];var utils=require(_0xeacf('0x5'));var logger=require(_0xeacf('0x6'))(_0xeacf('0x7'));var config=require(_0xeacf('0x8'));var jayson=require(_0xeacf('0x9'));var client=jayson[_0xeacf('0xa')][_0xeacf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13cba2,_0x5eb516,_0x411634){return new BPromise(function(_0xce0437,_0x17b21c){return client[_0xeacf('0xc')](_0x13cba2,_0x411634)['then'](function(_0xfe344){logger['info'](_0xeacf('0xd'),_0x5eb516,_0xeacf('0xe'));logger[_0xeacf('0xf')](_0xeacf('0x10'),_0x5eb516,_0xeacf('0xe'),JSON[_0xeacf('0x11')](_0xfe344));if(_0xfe344[_0xeacf('0x12')]){if(_0xfe344[_0xeacf('0x12')][_0xeacf('0x13')]===0x1f4){logger[_0xeacf('0x12')]('Campaign,\x20%s,\x20%s',_0x5eb516,_0xfe344[_0xeacf('0x12')][_0xeacf('0x14')]);return _0x17b21c(_0xfe344[_0xeacf('0x12')][_0xeacf('0x14')]);}logger['error'](_0xeacf('0xd'),_0x5eb516,_0xfe344[_0xeacf('0x12')][_0xeacf('0x14')]);return _0xce0437(_0xfe344['error']['message']);}else{logger[_0xeacf('0x15')](_0xeacf('0xd'),_0x5eb516,'request\x20sent');_0xce0437(_0xfe344[_0xeacf('0x16')]['message']);}})[_0xeacf('0x17')](function(_0x1df080){logger['error'](_0xeacf('0xd'),_0x5eb516,_0x1df080);_0x17b21c(_0x1df080);});});}exports['GetCampaign']=function(_0x650730){var _0xe87314=this;return new Promise(function(_0x18de20,_0x118932){return db['Campaign'][_0xeacf('0x18')]({'raw':_0x650730['options']?_0x650730[_0xeacf('0x19')][_0xeacf('0x1a')]===undefined?!![]:![]:!![],'where':_0x650730[_0xeacf('0x19')]?_0x650730['options'][_0xeacf('0x1b')]||null:null,'attributes':_0x650730[_0xeacf('0x19')]?_0x650730[_0xeacf('0x19')][_0xeacf('0x1c')]||null:null,'limit':_0x650730[_0xeacf('0x19')]?_0x650730[_0xeacf('0x19')][_0xeacf('0x1d')]||null:null,'include':_0x650730[_0xeacf('0x19')]?_0x650730[_0xeacf('0x19')]['include']?_[_0xeacf('0x1e')](_0x650730[_0xeacf('0x19')][_0xeacf('0x1f')],function(_0x35338b){return{'model':db[_0x35338b[_0xeacf('0x20')]],'as':_0x35338b['as'],'attributes':_0x35338b[_0xeacf('0x1c')],'include':_0x35338b[_0xeacf('0x1f')]?_['map'](_0x35338b['include'],function(_0x4332b7){return{'model':db[_0x4332b7[_0xeacf('0x20')]],'as':_0x4332b7['as'],'attributes':_0x4332b7['attributes'],'include':_0x4332b7[_0xeacf('0x1f')]?_[_0xeacf('0x1e')](_0x4332b7[_0xeacf('0x1f')],function(_0x1e368a){return{'model':db[_0x1e368a['model']],'as':_0x1e368a['as'],'attributes':_0x1e368a[_0xeacf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeacf('0x21')](function(_0x4c161e){logger[_0xeacf('0x15')](_0xeacf('0x22'),_0x650730);logger[_0xeacf('0xf')](_0xeacf('0x22'),_0x650730,JSON['stringify'](_0x4c161e));_0x18de20(_0x4c161e);})[_0xeacf('0x17')](function(_0x1d375a){logger['error']('GetCampaign',_0x1d375a['message'],_0x650730);_0x118932(_0xe87314['error'](0x1f4,_0x1d375a[_0xeacf('0x14')]));});});}; \ No newline at end of file +var _0x7764=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','attributes','limit','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x35b195,_0x8893d5){var _0x2433bf=function(_0x22be07){while(--_0x22be07){_0x35b195['push'](_0x35b195['shift']());}};_0x2433bf(++_0x8893d5);}(_0x7764,0xa4));var _0x4776=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x7764[_0x1385dc];return _0x2f6469;};'use strict';var _=require(_0x4776('0x0'));var util=require(_0x4776('0x1'));var moment=require(_0x4776('0x2'));var BPromise=require(_0x4776('0x3'));var rs=require(_0x4776('0x4'));var fs=require('fs');var Redis=require(_0x4776('0x5'));var db=require(_0x4776('0x6'))['db'];var utils=require(_0x4776('0x7'));var logger=require(_0x4776('0x8'))(_0x4776('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4776('0xa')][_0x4776('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52f59e,_0x1f9a45,_0x2b61c7){return new BPromise(function(_0x4fcbcc,_0x53f976){return client[_0x4776('0xc')](_0x52f59e,_0x2b61c7)['then'](function(_0x35bf06){logger[_0x4776('0xd')](_0x4776('0xe'),_0x1f9a45,_0x4776('0xf'));logger[_0x4776('0x10')](_0x4776('0x11'),_0x1f9a45,_0x4776('0xf'),JSON[_0x4776('0x12')](_0x35bf06));if(_0x35bf06[_0x4776('0x13')]){if(_0x35bf06[_0x4776('0x13')][_0x4776('0x14')]===0x1f4){logger[_0x4776('0x13')](_0x4776('0xe'),_0x1f9a45,_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);return _0x53f976(_0x35bf06[_0x4776('0x13')]['message']);}logger['error'](_0x4776('0xe'),_0x1f9a45,_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);return _0x4fcbcc(_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);}else{logger[_0x4776('0xd')](_0x4776('0xe'),_0x1f9a45,_0x4776('0xf'));_0x4fcbcc(_0x35bf06[_0x4776('0x16')][_0x4776('0x15')]);}})['catch'](function(_0x46fec7){logger['error'](_0x4776('0xe'),_0x1f9a45,_0x46fec7);_0x53f976(_0x46fec7);});});}exports[_0x4776('0x17')]=function(_0x2366da){var _0xed81b5=this;return new Promise(function(_0xb5c938,_0x4b5f50){return db[_0x4776('0x18')][_0x4776('0x19')]({'raw':_0x2366da['options']?_0x2366da[_0x4776('0x1a')][_0x4776('0x1b')]===undefined?!![]:![]:!![],'where':_0x2366da[_0x4776('0x1a')]?_0x2366da[_0x4776('0x1a')]['where']||null:null,'attributes':_0x2366da[_0x4776('0x1a')]?_0x2366da[_0x4776('0x1a')][_0x4776('0x1c')]||null:null,'limit':_0x2366da[_0x4776('0x1a')]?_0x2366da['options'][_0x4776('0x1d')]||null:null,'include':_0x2366da[_0x4776('0x1a')]?_0x2366da[_0x4776('0x1a')]['include']?_[_0x4776('0x1e')](_0x2366da[_0x4776('0x1a')][_0x4776('0x1f')],function(_0x54f3de){return{'model':db[_0x54f3de['model']],'as':_0x54f3de['as'],'attributes':_0x54f3de['attributes'],'include':_0x54f3de[_0x4776('0x1f')]?_[_0x4776('0x1e')](_0x54f3de[_0x4776('0x1f')],function(_0xdfe443){return{'model':db[_0xdfe443[_0x4776('0x20')]],'as':_0xdfe443['as'],'attributes':_0xdfe443[_0x4776('0x1c')],'include':_0xdfe443[_0x4776('0x1f')]?_['map'](_0xdfe443[_0x4776('0x1f')],function(_0x1de3d1){return{'model':db[_0x1de3d1['model']],'as':_0x1de3d1['as'],'attributes':_0x1de3d1[_0x4776('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4776('0x21')](function(_0x4b8aeb){logger[_0x4776('0xd')](_0x4776('0x17'),_0x2366da);logger[_0x4776('0x10')](_0x4776('0x17'),_0x2366da,JSON[_0x4776('0x12')](_0x4b8aeb));_0xb5c938(_0x4b8aeb);})['catch'](function(_0x4bfd4b){logger[_0x4776('0x13')](_0x4776('0x17'),_0x4bfd4b[_0x4776('0x15')],_0x2366da);_0x4b5f50(_0xed81b5['error'](0x1f4,_0x4bfd4b[_0x4776('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 85094b1..129dafd 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 _0x141a=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0xee397d,_0x5cf526){var _0x1ec970=function(_0x4c2771){while(--_0x4c2771){_0xee397d['push'](_0xee397d['shift']());}};_0x1ec970(++_0x5cf526);}(_0x141a,0xfd));var _0xa141=function(_0x1e797a,_0x2ef1be){_0x1e797a=_0x1e797a-0x0;var _0x3ffe38=_0x141a[_0x1e797a];return _0x3ffe38;};'use strict';var multer=require(_0xa141('0x0'));var util=require(_0xa141('0x1'));var path=require('path');var timeout=require(_0xa141('0x2'));var express=require(_0xa141('0x3'));var router=express[_0xa141('0x4')]();var fs_extra=require(_0xa141('0x5'));var auth=require(_0xa141('0x6'));var interaction=require(_0xa141('0x7'));var config=require(_0xa141('0x8'));var controller=require(_0xa141('0x9'));router[_0xa141('0xa')]('/',auth[_0xa141('0xb')](),controller['index']);router[_0xa141('0xa')](_0xa141('0xc'),auth[_0xa141('0xb')](),controller[_0xa141('0xd')]);router['get'](_0xa141('0xe'),auth[_0xa141('0xb')](),controller[_0xa141('0xf')]);router[_0xa141('0xa')](_0xa141('0x10'),auth[_0xa141('0xb')](),controller[_0xa141('0x11')]);router[_0xa141('0xa')](_0xa141('0x12'),auth['isAuthenticated'](),controller[_0xa141('0x13')]);router[_0xa141('0xa')](_0xa141('0x14'),auth[_0xa141('0xb')](),controller[_0xa141('0x15')]);router['get'](_0xa141('0x16'),auth['isAuthenticated'](),controller['getLists']);router[_0xa141('0xa')](_0xa141('0x17'),auth[_0xa141('0xb')](),controller['getBlackLists']);router[_0xa141('0x18')]('/',auth['isAuthenticated'](),controller[_0xa141('0x19')]);router['post'](_0xa141('0x1a'),auth[_0xa141('0xb')](),controller['clone']);router['post'](_0xa141('0x16'),auth[_0xa141('0xb')](),controller['addLists']);router['post'](_0xa141('0x17'),auth['isAuthenticated'](),controller[_0xa141('0x1b')]);router[_0xa141('0x1c')](_0xa141('0xc'),auth['isAuthenticated'](),controller[_0xa141('0x1d')]);router[_0xa141('0x1e')](_0xa141('0xc'),auth['isAuthenticated'](),controller[_0xa141('0x1f')]);router[_0xa141('0x1e')](_0xa141('0x16'),auth[_0xa141('0xb')](),controller[_0xa141('0x20')]);router[_0xa141('0x1e')](_0xa141('0x17'),auth[_0xa141('0xb')](),controller[_0xa141('0x21')]);module['exports']=router; \ No newline at end of file +var _0x954d=['clone','addLists','addBlackLists','put','update','destroy','removeLists','delete','removeBlackLists','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0x954d,0x196));var _0xd954=function(_0x20a68a,_0x54502e){_0x20a68a=_0x20a68a-0x0;var _0x56c5d4=_0x954d[_0x20a68a];return _0x56c5d4;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd954('0x0'));var express=require(_0xd954('0x1'));var router=express[_0xd954('0x2')]();var fs_extra=require(_0xd954('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd954('0x4'));var config=require(_0xd954('0x5'));var controller=require(_0xd954('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd954('0x7')](_0xd954('0x8'),auth['isAuthenticated'](),controller[_0xd954('0x9')]);router[_0xd954('0x7')](_0xd954('0xa'),auth[_0xd954('0xb')](),controller[_0xd954('0xc')]);router[_0xd954('0x7')](_0xd954('0xd'),auth['isAuthenticated'](),controller[_0xd954('0xe')]);router[_0xd954('0x7')](_0xd954('0xf'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0xd954('0x10'),auth[_0xd954('0xb')](),controller[_0xd954('0x11')]);router[_0xd954('0x7')](_0xd954('0x12'),auth[_0xd954('0xb')](),controller[_0xd954('0x13')]);router[_0xd954('0x7')](_0xd954('0x14'),auth[_0xd954('0xb')](),controller['getBlackLists']);router[_0xd954('0x15')]('/',auth[_0xd954('0xb')](),controller['create']);router[_0xd954('0x15')](_0xd954('0x16'),auth['isAuthenticated'](),controller[_0xd954('0x17')]);router[_0xd954('0x15')]('/:id/lists',auth[_0xd954('0xb')](),controller[_0xd954('0x18')]);router[_0xd954('0x15')]('/:id/blacklists',auth[_0xd954('0xb')](),controller[_0xd954('0x19')]);router[_0xd954('0x1a')](_0xd954('0x8'),auth[_0xd954('0xb')](),controller[_0xd954('0x1b')]);router['delete'](_0xd954('0x8'),auth[_0xd954('0xb')](),controller[_0xd954('0x1c')]);router['delete'](_0xd954('0x12'),auth[_0xd954('0xb')](),controller[_0xd954('0x1d')]);router[_0xd954('0x1e')](_0xd954('0x14'),auth[_0xd954('0xb')](),controller[_0xd954('0x1f')]);module[_0xd954('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 e236220..2ffaf8c 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 _0x2f99=['STRING','TEXT','VIRTUAL','getDataValue','sequelize'];(function(_0x23d946,_0x4e3420){var _0x4699be=function(_0x54ea70){while(--_0x54ea70){_0x23d946['push'](_0x23d946['shift']());}};_0x4699be(++_0x4e3420);}(_0x2f99,0x1f3));var _0x92f9=function(_0x137d0a,_0x5e2ba2){_0x137d0a=_0x137d0a-0x0;var _0x3d4f4e=_0x2f99[_0x137d0a];return _0x3d4f4e;};'use strict';var Sequelize=require(_0x92f9('0x0'));module['exports']={'key':{'type':Sequelize[_0x92f9('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x92f9('0x2')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x92f9('0x1')]},'name':{'type':Sequelize[_0x92f9('0x3')],'get':function(){return this[_0x92f9('0x4')]('key');}}}; \ No newline at end of file +var _0x084f=['exports','STRING','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x4db94d,_0x4b1865){var _0x17139a=function(_0x40a123){while(--_0x40a123){_0x4db94d['push'](_0x4db94d['shift']());}};_0x17139a(++_0x4b1865);}(_0x084f,0x1aa));var _0xf084=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x084f[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require(_0xf084('0x0'));module[_0xf084('0x1')]={'key':{'type':Sequelize[_0xf084('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xf084('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf084('0x2')]},'name':{'type':Sequelize[_0xf084('0x4')],'get':function(){return this[_0xf084('0x5')](_0xf084('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e531769..3699bec 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 _0x1bac=['Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','CannedAnswer','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','findAll','show','params','keys','rawAttributes','includeAll','include','find','catch','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x1bac,0x1bc));var _0xc1ba=function(_0x11f93c,_0x55ef26){_0x11f93c=_0x11f93c-0x0;var _0x4cb995=_0x1bac[_0x11f93c];return _0x4cb995;};'use strict';var emlformat=require(_0xc1ba('0x0'));var rimraf=require(_0xc1ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1ba('0x2'));var rp=require(_0xc1ba('0x3'));var moment=require(_0xc1ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1ba('0x5'));var util=require(_0xc1ba('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc1ba('0x7'));var ejs=require(_0xc1ba('0x8'));var fs=require('fs');var fs_extra=require(_0xc1ba('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc1ba('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc1ba('0xb'));var toCsv=require(_0xc1ba('0x7'));var querystring=require(_0xc1ba('0xc'));var Papa=require(_0xc1ba('0xd'));var Redis=require(_0xc1ba('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc1ba('0xf'));var as=require(_0xc1ba('0x10'));var hardwareService=require(_0xc1ba('0x11'));var logger=require('../../config/logger')(_0xc1ba('0x12'));var utils=require(_0xc1ba('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc1ba('0x14'));var db=require(_0xc1ba('0x15'))['db'];function respondWithStatusCode(_0x55cab7,_0x310576){_0x310576=_0x310576||0xcc;return function(_0x1f428c){if(_0x1f428c){return _0x55cab7[_0xc1ba('0x16')](_0x310576);}return _0x55cab7[_0xc1ba('0x17')](_0x310576)[_0xc1ba('0x18')]();};}function respondWithResult(_0x6e28c1,_0x2031f3){_0x2031f3=_0x2031f3||0xc8;return function(_0x1111e4){if(_0x1111e4){return _0x6e28c1['status'](_0x2031f3)[_0xc1ba('0x19')](_0x1111e4);}};}function respondWithFilteredResult(_0x43cda1,_0x375d89){return function(_0x3309b4){if(_0x3309b4){var _0x243dd0=typeof _0x375d89['offset']==='undefined'&&typeof _0x375d89[_0xc1ba('0x1a')]===_0xc1ba('0x1b');var _0x5674e5=_0x3309b4['count'];var _0x35878e=_0x243dd0?0x0:_0x375d89[_0xc1ba('0x1c')];var _0x2ba3d9=_0x243dd0?_0x3309b4[_0xc1ba('0x1d')]:_0x375d89[_0xc1ba('0x1c')]+_0x375d89[_0xc1ba('0x1a')];var _0x2932c2;if(_0x2ba3d9>=_0x5674e5){_0x2ba3d9=_0x5674e5;_0x2932c2=0xc8;}else{_0x2932c2=0xce;}_0x43cda1['status'](_0x2932c2);return _0x43cda1[_0xc1ba('0x1e')]('Content-Range',_0x35878e+'-'+_0x2ba3d9+'/'+_0x5674e5)[_0xc1ba('0x19')](_0x3309b4);}return null;};}function patchUpdates(_0x848b1){return function(_0x15bd12){try{jsonpatch[_0xc1ba('0x1f')](_0x15bd12,_0x848b1,!![]);}catch(_0x4384b1){return BPromise[_0xc1ba('0x20')](_0x4384b1);}return _0x15bd12[_0xc1ba('0x21')]();};}function saveUpdates(_0x2b7c3d,_0x2ff22f){return function(_0x3fda38){if(_0x3fda38){return _0x3fda38[_0xc1ba('0x22')](_0x2b7c3d)[_0xc1ba('0x23')](function(_0x3d24dd){return _0x3d24dd;});}return null;};}function removeEntity(_0x95fdf2,_0x4b9a8d){return function(_0x301d76){if(_0x301d76){return _0x301d76[_0xc1ba('0x24')]()[_0xc1ba('0x23')](function(){var _0x38e98d=_0x301d76[_0xc1ba('0x25')]({'plain':!![]});var _0x31c620=_0xc1ba('0x26');return db[_0xc1ba('0x27')][_0xc1ba('0x24')]({'where':{'type':_0x31c620,'resourceId':_0x38e98d['id']}})['then'](function(){return _0x301d76;});})[_0xc1ba('0x23')](function(){_0x95fdf2[_0xc1ba('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46baad,_0x33b05c){return function(_0x23ea95){if(!_0x23ea95){_0x46baad[_0xc1ba('0x16')](0x194);}return _0x23ea95;};}function handleError(_0x1a381a,_0x3811ba){_0x3811ba=_0x3811ba||0x1f4;return function(_0x3f8d4c){logger[_0xc1ba('0x28')](_0x3f8d4c['stack']);if(_0x3f8d4c['name']){delete _0x3f8d4c[_0xc1ba('0x29')];}_0x1a381a[_0xc1ba('0x17')](_0x3811ba)[_0xc1ba('0x2a')](_0x3f8d4c);};}exports[_0xc1ba('0x2b')]=function(_0x2c5b04,_0x116b3b){var _0x283ae9={},_0x54ea08={},_0x5c5b41={'count':0x0,'rows':[]};var _0x65930d=_['map'](db[_0xc1ba('0x2c')]['rawAttributes'],function(_0x1a4fb9){return{'name':_0x1a4fb9[_0xc1ba('0x2d')],'type':_0x1a4fb9[_0xc1ba('0x2e')]['key']};});_0x54ea08[_0xc1ba('0x2f')]=_[_0xc1ba('0x30')](_0x65930d,_0xc1ba('0x29'));_0x54ea08[_0xc1ba('0x31')]=_['keys'](_0x2c5b04[_0xc1ba('0x31')]);_0x54ea08[_0xc1ba('0x32')]=_[_0xc1ba('0x33')](_0x54ea08[_0xc1ba('0x2f')],_0x54ea08[_0xc1ba('0x31')]);_0x283ae9[_0xc1ba('0x34')]=_[_0xc1ba('0x33')](_0x54ea08[_0xc1ba('0x2f')],qs['fields'](_0x2c5b04[_0xc1ba('0x31')][_0xc1ba('0x35')]));_0x283ae9[_0xc1ba('0x34')]=_0x283ae9[_0xc1ba('0x34')][_0xc1ba('0x36')]?_0x283ae9['attributes']:_0x54ea08[_0xc1ba('0x2f')];if(!_0x2c5b04[_0xc1ba('0x31')][_0xc1ba('0x37')]('nolimit')){_0x283ae9[_0xc1ba('0x1a')]=qs[_0xc1ba('0x1a')](_0x2c5b04['query'][_0xc1ba('0x1a')]);_0x283ae9[_0xc1ba('0x1c')]=qs[_0xc1ba('0x1c')](_0x2c5b04['query']['offset']);}_0x283ae9[_0xc1ba('0x38')]=qs[_0xc1ba('0x39')](_0x2c5b04[_0xc1ba('0x31')][_0xc1ba('0x39')]);_0x283ae9[_0xc1ba('0x3a')]=qs[_0xc1ba('0x32')](_[_0xc1ba('0x3b')](_0x2c5b04['query'],_0x54ea08[_0xc1ba('0x32')]),_0x65930d);if(_0x2c5b04[_0xc1ba('0x31')][_0xc1ba('0x3c')]){_0x283ae9[_0xc1ba('0x3a')]=_[_0xc1ba('0x3d')](_0x283ae9[_0xc1ba('0x3a')],{'$or':[{'key':{'$like':'%'+_0x2c5b04[_0xc1ba('0x31')][_0xc1ba('0x3c')]+'%'}},{'value':{'$like':'%'+_0x2c5b04[_0xc1ba('0x31')][_0xc1ba('0x3c')]+'%'}}]});}_0x283ae9=_[_0xc1ba('0x3d')]({},_0x283ae9,_0x2c5b04['options']);var _0x1d329f={'where':_0x283ae9[_0xc1ba('0x3a')]};return db['CannedAnswer'][_0xc1ba('0x1d')](_0x1d329f)['then'](function(_0x58e9dd){_0x5c5b41[_0xc1ba('0x1d')]=_0x58e9dd;if(_0x2c5b04['query']['includeAll']){_0x283ae9['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xc1ba('0x3e')](_0x283ae9);})[_0xc1ba('0x23')](function(_0x152ba8){_0x5c5b41['rows']=_0x152ba8;return _0x5c5b41;})[_0xc1ba('0x23')](respondWithFilteredResult(_0x116b3b,_0x283ae9))['catch'](handleError(_0x116b3b,null));};exports[_0xc1ba('0x3f')]=function(_0x3906aa,_0x1295bf){var _0x13f5bd={'raw':!![],'where':{'id':_0x3906aa[_0xc1ba('0x40')]['id']}},_0x27826e={};_0x27826e[_0xc1ba('0x2f')]=_[_0xc1ba('0x41')](db[_0xc1ba('0x2c')][_0xc1ba('0x42')]);_0x27826e[_0xc1ba('0x31')]=_['keys'](_0x3906aa[_0xc1ba('0x31')]);_0x27826e[_0xc1ba('0x32')]=_[_0xc1ba('0x33')](_0x27826e[_0xc1ba('0x2f')],_0x27826e[_0xc1ba('0x31')]);_0x13f5bd[_0xc1ba('0x34')]=_[_0xc1ba('0x33')](_0x27826e[_0xc1ba('0x2f')],qs['fields'](_0x3906aa[_0xc1ba('0x31')][_0xc1ba('0x35')]));_0x13f5bd[_0xc1ba('0x34')]=_0x13f5bd[_0xc1ba('0x34')]['length']?_0x13f5bd['attributes']:_0x27826e['model'];if(_0x3906aa['query'][_0xc1ba('0x43')]){_0x13f5bd[_0xc1ba('0x44')]=[{'all':!![]}];}_0x13f5bd=_[_0xc1ba('0x3d')]({},_0x13f5bd,_0x3906aa['options']);return db[_0xc1ba('0x2c')][_0xc1ba('0x45')](_0x13f5bd)[_0xc1ba('0x23')](handleEntityNotFound(_0x1295bf,null))[_0xc1ba('0x23')](respondWithResult(_0x1295bf,null))[_0xc1ba('0x46')](handleError(_0x1295bf,null));};exports['update']=function(_0x2614e5,_0x4fd2f8){if(_0x2614e5[_0xc1ba('0x47')]['id']){delete _0x2614e5[_0xc1ba('0x47')]['id'];}return db[_0xc1ba('0x2c')][_0xc1ba('0x45')]({'where':{'id':_0x2614e5[_0xc1ba('0x40')]['id']}})[_0xc1ba('0x23')](handleEntityNotFound(_0x4fd2f8,null))[_0xc1ba('0x23')](saveUpdates(_0x2614e5[_0xc1ba('0x47')],null))['then'](respondWithResult(_0x4fd2f8,null))['catch'](handleError(_0x4fd2f8,null));};exports[_0xc1ba('0x24')]=function(_0x3d9993,_0x1f7fc0){return db['CannedAnswer']['find']({'where':{'id':_0x3d9993[_0xc1ba('0x40')]['id']}})[_0xc1ba('0x23')](handleEntityNotFound(_0x1f7fc0,null))[_0xc1ba('0x23')](removeEntity(_0x1f7fc0,null))[_0xc1ba('0x46')](handleError(_0x1f7fc0,null));};exports[_0xc1ba('0x48')]=function(_0x55c1df,_0x228d46){var _0x52b57c={'key':_0x55c1df[_0xc1ba('0x47')][_0xc1ba('0x49')]};if(_0x55c1df[_0xc1ba('0x47')]['MailAccountId']){_0x52b57c[_0xc1ba('0x4a')]=_0x55c1df[_0xc1ba('0x47')][_0xc1ba('0x4a')];}else if(_0x55c1df[_0xc1ba('0x47')][_0xc1ba('0x4b')]){_0x52b57c[_0xc1ba('0x4b')]=_0x55c1df[_0xc1ba('0x47')]['SmsAccountId'];}else if(_0x55c1df[_0xc1ba('0x47')][_0xc1ba('0x4c')]){_0x52b57c[_0xc1ba('0x4c')]=_0x55c1df[_0xc1ba('0x47')]['OpenchannelAccountId'];}else if(_0x55c1df[_0xc1ba('0x47')][_0xc1ba('0x4d')]){_0x52b57c[_0xc1ba('0x4d')]=_0x55c1df[_0xc1ba('0x47')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x52b57c})[_0xc1ba('0x23')](function(_0x58895c){if(_0x58895c){throw new db[(_0xc1ba('0x4e'))][(_0xc1ba('0x4f'))](_0xc1ba('0x50'));}return db[_0xc1ba('0x2c')]['create'](_0x55c1df[_0xc1ba('0x47')]);})[_0xc1ba('0x23')](function(_0x58f972){var _0x363dcc=_0x55c1df[_0xc1ba('0x51')][_0xc1ba('0x25')]({'plain':!![]});if(!_0x363dcc)throw new Error(_0xc1ba('0x52'));if(_0x363dcc[_0xc1ba('0x53')]===_0xc1ba('0x51')){var _0x54b157=_0x58f972[_0xc1ba('0x25')]({'plain':!![]});return db[_0xc1ba('0x54')][_0xc1ba('0x45')]({'where':{'name':_0xc1ba('0x26'),'userProfileId':_0x363dcc[_0xc1ba('0x55')]},'raw':!![]})['then'](function(_0x21175a){if(_0x21175a&&_0x21175a['autoAssociation']===0x0){return db[_0xc1ba('0x27')][_0xc1ba('0x48')]({'name':_0x54b157[_0xc1ba('0x29')],'resourceId':_0x54b157['id'],'type':_0x21175a['name'],'sectionId':_0x21175a['id']},{})[_0xc1ba('0x23')](function(){return _0x58f972;});}else{return _0x58f972;}})['catch'](function(_0x3bd68b){logger[_0xc1ba('0x28')](_0xc1ba('0x56'),_0x3bd68b);throw _0x3bd68b;});}return _0x58f972;})['then'](respondWithResult(_0x228d46,0xc9))[_0xc1ba('0x46')](handleError(_0x228d46,null));}; \ No newline at end of file +var _0xed24=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2fbf2c,_0xb5a8f9){var _0x132005=function(_0xaa95bb){while(--_0xaa95bb){_0x2fbf2c['push'](_0x2fbf2c['shift']());}};_0x132005(++_0xb5a8f9);}(_0xed24,0x1b7));var _0x4ed2=function(_0x3f08ed,_0x2a6344){_0x3f08ed=_0x3f08ed-0x0;var _0x24ad2f=_0xed24[_0x3f08ed];return _0x24ad2f;};'use strict';var emlformat=require(_0x4ed2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ed2('0x1'));var jsonpatch=require(_0x4ed2('0x2'));var rp=require('request-promise');var moment=require(_0x4ed2('0x3'));var BPromise=require(_0x4ed2('0x4'));var Mustache=require(_0x4ed2('0x5'));var util=require(_0x4ed2('0x6'));var path=require('path');var sox=require(_0x4ed2('0x7'));var csv=require(_0x4ed2('0x8'));var ejs=require(_0x4ed2('0x9'));var fs=require('fs');var fs_extra=require(_0x4ed2('0xa'));var _=require(_0x4ed2('0xb'));var squel=require('squel');var crypto=require(_0x4ed2('0xc'));var jsforce=require(_0x4ed2('0xd'));var deskjs=require(_0x4ed2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4ed2('0xf'));var Papa=require(_0x4ed2('0x10'));var Redis=require(_0x4ed2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ed2('0x12'));var as=require(_0x4ed2('0x13'));var hardwareService=require(_0x4ed2('0x14'));var logger=require('../../config/logger')(_0x4ed2('0x15'));var utils=require(_0x4ed2('0x16'));var config=require(_0x4ed2('0x17'));var licenseUtil=require(_0x4ed2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4804fe,_0x27b604){_0x27b604=_0x27b604||0xcc;return function(_0x3bfd17){if(_0x3bfd17){return _0x4804fe[_0x4ed2('0x19')](_0x27b604);}return _0x4804fe[_0x4ed2('0x1a')](_0x27b604)['end']();};}function respondWithResult(_0x50fc8b,_0x354ae9){_0x354ae9=_0x354ae9||0xc8;return function(_0x3d79d8){if(_0x3d79d8){return _0x50fc8b['status'](_0x354ae9)[_0x4ed2('0x1b')](_0x3d79d8);}};}function respondWithFilteredResult(_0x9e6737,_0x59c846){return function(_0x1eedbf){if(_0x1eedbf){var _0x55dd15=typeof _0x59c846[_0x4ed2('0x1c')]===_0x4ed2('0x1d')&&typeof _0x59c846[_0x4ed2('0x1e')]===_0x4ed2('0x1d');var _0x378c2c=_0x1eedbf['count'];var _0x2b0b60=_0x55dd15?0x0:_0x59c846['offset'];var _0x31493f=_0x55dd15?_0x1eedbf[_0x4ed2('0x1f')]:_0x59c846[_0x4ed2('0x1c')]+_0x59c846[_0x4ed2('0x1e')];var _0xddb89;if(_0x31493f>=_0x378c2c){_0x31493f=_0x378c2c;_0xddb89=0xc8;}else{_0xddb89=0xce;}_0x9e6737[_0x4ed2('0x1a')](_0xddb89);return _0x9e6737[_0x4ed2('0x20')](_0x4ed2('0x21'),_0x2b0b60+'-'+_0x31493f+'/'+_0x378c2c)[_0x4ed2('0x1b')](_0x1eedbf);}return null;};}function patchUpdates(_0x37a18c){return function(_0x57706e){try{jsonpatch[_0x4ed2('0x22')](_0x57706e,_0x37a18c,!![]);}catch(_0x36f976){return BPromise['reject'](_0x36f976);}return _0x57706e[_0x4ed2('0x23')]();};}function saveUpdates(_0x4f0e67,_0x1a777e){return function(_0xd0baa2){if(_0xd0baa2){return _0xd0baa2[_0x4ed2('0x24')](_0x4f0e67)[_0x4ed2('0x25')](function(_0x4b56cb){return _0x4b56cb;});}return null;};}function removeEntity(_0x23a36a,_0x2055a4){return function(_0x39a00e){if(_0x39a00e){return _0x39a00e[_0x4ed2('0x26')]()['then'](function(){var _0x5851f0=_0x39a00e[_0x4ed2('0x27')]({'plain':!![]});var _0xef3ef2='CannedAnswers';return db[_0x4ed2('0x28')]['destroy']({'where':{'type':_0xef3ef2,'resourceId':_0x5851f0['id']}})[_0x4ed2('0x25')](function(){return _0x39a00e;});})['then'](function(){_0x23a36a['status'](0xcc)[_0x4ed2('0x29')]();});}};}function handleEntityNotFound(_0x22deeb,_0x5a402c){return function(_0x16434a){if(!_0x16434a){_0x22deeb[_0x4ed2('0x19')](0x194);}return _0x16434a;};}function handleError(_0x4d97e5,_0x2716c4){_0x2716c4=_0x2716c4||0x1f4;return function(_0x545acf){logger[_0x4ed2('0x2a')](_0x545acf[_0x4ed2('0x2b')]);if(_0x545acf['name']){delete _0x545acf[_0x4ed2('0x2c')];}_0x4d97e5['status'](_0x2716c4)[_0x4ed2('0x2d')](_0x545acf);};}exports[_0x4ed2('0x2e')]=function(_0x290ebe,_0x55b390){var _0x5688e4={},_0x408556={},_0x54d4a1={'count':0x0,'rows':[]};var _0x4133b1=_[_0x4ed2('0x2f')](db[_0x4ed2('0x30')][_0x4ed2('0x31')],function(_0x36c87f){return{'name':_0x36c87f[_0x4ed2('0x32')],'type':_0x36c87f[_0x4ed2('0x33')]['key']};});_0x408556['model']=_[_0x4ed2('0x2f')](_0x4133b1,_0x4ed2('0x2c'));_0x408556['query']=_[_0x4ed2('0x34')](_0x290ebe[_0x4ed2('0x35')]);_0x408556[_0x4ed2('0x36')]=_[_0x4ed2('0x37')](_0x408556[_0x4ed2('0x38')],_0x408556[_0x4ed2('0x35')]);_0x5688e4[_0x4ed2('0x39')]=_[_0x4ed2('0x37')](_0x408556['model'],qs[_0x4ed2('0x3a')](_0x290ebe['query']['fields']));_0x5688e4['attributes']=_0x5688e4['attributes'][_0x4ed2('0x3b')]?_0x5688e4['attributes']:_0x408556[_0x4ed2('0x38')];if(!_0x290ebe[_0x4ed2('0x35')]['hasOwnProperty'](_0x4ed2('0x3c'))){_0x5688e4[_0x4ed2('0x1e')]=qs[_0x4ed2('0x1e')](_0x290ebe['query'][_0x4ed2('0x1e')]);_0x5688e4['offset']=qs[_0x4ed2('0x1c')](_0x290ebe[_0x4ed2('0x35')]['offset']);}_0x5688e4[_0x4ed2('0x3d')]=qs['sort'](_0x290ebe[_0x4ed2('0x35')][_0x4ed2('0x3e')]);_0x5688e4[_0x4ed2('0x3f')]=qs[_0x4ed2('0x36')](_[_0x4ed2('0x40')](_0x290ebe['query'],_0x408556[_0x4ed2('0x36')]),_0x4133b1);if(_0x290ebe[_0x4ed2('0x35')][_0x4ed2('0x41')]){_0x5688e4['where']=_['merge'](_0x5688e4[_0x4ed2('0x3f')],{'$or':[{'key':{'$like':'%'+_0x290ebe[_0x4ed2('0x35')][_0x4ed2('0x41')]+'%'}},{'value':{'$like':'%'+_0x290ebe[_0x4ed2('0x35')]['filter']+'%'}}]});}_0x5688e4=_[_0x4ed2('0x42')]({},_0x5688e4,_0x290ebe[_0x4ed2('0x43')]);var _0x19fdf5={'where':_0x5688e4['where']};return db[_0x4ed2('0x30')][_0x4ed2('0x1f')](_0x19fdf5)[_0x4ed2('0x25')](function(_0x85e22){_0x54d4a1[_0x4ed2('0x1f')]=_0x85e22;if(_0x290ebe[_0x4ed2('0x35')][_0x4ed2('0x44')]){_0x5688e4[_0x4ed2('0x45')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4ed2('0x46')](_0x5688e4);})[_0x4ed2('0x25')](function(_0x1c2fe5){_0x54d4a1[_0x4ed2('0x47')]=_0x1c2fe5;return _0x54d4a1;})[_0x4ed2('0x25')](respondWithFilteredResult(_0x55b390,_0x5688e4))[_0x4ed2('0x48')](handleError(_0x55b390,null));};exports[_0x4ed2('0x49')]=function(_0x31a3c2,_0x5cdfac){var _0x42fb37={'raw':!![],'where':{'id':_0x31a3c2[_0x4ed2('0x4a')]['id']}},_0x43271a={};_0x43271a[_0x4ed2('0x38')]=_[_0x4ed2('0x34')](db[_0x4ed2('0x30')][_0x4ed2('0x31')]);_0x43271a[_0x4ed2('0x35')]=_[_0x4ed2('0x34')](_0x31a3c2[_0x4ed2('0x35')]);_0x43271a[_0x4ed2('0x36')]=_[_0x4ed2('0x37')](_0x43271a[_0x4ed2('0x38')],_0x43271a[_0x4ed2('0x35')]);_0x42fb37[_0x4ed2('0x39')]=_[_0x4ed2('0x37')](_0x43271a['model'],qs['fields'](_0x31a3c2[_0x4ed2('0x35')]['fields']));_0x42fb37[_0x4ed2('0x39')]=_0x42fb37[_0x4ed2('0x39')][_0x4ed2('0x3b')]?_0x42fb37['attributes']:_0x43271a[_0x4ed2('0x38')];if(_0x31a3c2[_0x4ed2('0x35')]['includeAll']){_0x42fb37[_0x4ed2('0x45')]=[{'all':!![]}];}_0x42fb37=_[_0x4ed2('0x42')]({},_0x42fb37,_0x31a3c2[_0x4ed2('0x43')]);return db['CannedAnswer'][_0x4ed2('0x4b')](_0x42fb37)[_0x4ed2('0x25')](handleEntityNotFound(_0x5cdfac,null))[_0x4ed2('0x25')](respondWithResult(_0x5cdfac,null))[_0x4ed2('0x48')](handleError(_0x5cdfac,null));};exports['update']=function(_0x1f1eae,_0x424da7){if(_0x1f1eae[_0x4ed2('0x4c')]['id']){delete _0x1f1eae[_0x4ed2('0x4c')]['id'];}return db[_0x4ed2('0x30')][_0x4ed2('0x4b')]({'where':{'id':_0x1f1eae[_0x4ed2('0x4a')]['id']}})[_0x4ed2('0x25')](handleEntityNotFound(_0x424da7,null))['then'](saveUpdates(_0x1f1eae[_0x4ed2('0x4c')],null))[_0x4ed2('0x25')](respondWithResult(_0x424da7,null))[_0x4ed2('0x48')](handleError(_0x424da7,null));};exports[_0x4ed2('0x26')]=function(_0x28dfab,_0x157390){return db[_0x4ed2('0x30')][_0x4ed2('0x4b')]({'where':{'id':_0x28dfab[_0x4ed2('0x4a')]['id']}})[_0x4ed2('0x25')](handleEntityNotFound(_0x157390,null))['then'](removeEntity(_0x157390,null))['catch'](handleError(_0x157390,null));};exports[_0x4ed2('0x4d')]=function(_0x374fca,_0x7bb765){var _0x3fa17c={'key':_0x374fca[_0x4ed2('0x4c')][_0x4ed2('0x4e')]};if(_0x374fca['body'][_0x4ed2('0x4f')]){_0x3fa17c['MailAccountId']=_0x374fca[_0x4ed2('0x4c')][_0x4ed2('0x4f')];}else if(_0x374fca['body']['SmsAccountId']){_0x3fa17c[_0x4ed2('0x50')]=_0x374fca[_0x4ed2('0x4c')][_0x4ed2('0x50')];}else if(_0x374fca[_0x4ed2('0x4c')]['OpenchannelAccountId']){_0x3fa17c[_0x4ed2('0x51')]=_0x374fca[_0x4ed2('0x4c')][_0x4ed2('0x51')];}else if(_0x374fca['body'][_0x4ed2('0x52')]){_0x3fa17c[_0x4ed2('0x52')]=_0x374fca[_0x4ed2('0x4c')][_0x4ed2('0x52')];}return db[_0x4ed2('0x30')][_0x4ed2('0x4b')]({'where':_0x3fa17c})[_0x4ed2('0x25')](function(_0x403ea8){if(_0x403ea8){throw new db[(_0x4ed2('0x53'))]['ValidationError'](_0x4ed2('0x54'));}return db['CannedAnswer'][_0x4ed2('0x4d')](_0x374fca[_0x4ed2('0x4c')]);})[_0x4ed2('0x25')](function(_0x577233){var _0x55de57=_0x374fca[_0x4ed2('0x55')][_0x4ed2('0x27')]({'plain':!![]});if(!_0x55de57)throw new Error(_0x4ed2('0x56'));if(_0x55de57['role']==='user'){var _0x1f521b=_0x577233['get']({'plain':!![]});return db[_0x4ed2('0x57')][_0x4ed2('0x4b')]({'where':{'name':_0x4ed2('0x58'),'userProfileId':_0x55de57[_0x4ed2('0x59')]},'raw':!![]})[_0x4ed2('0x25')](function(_0x10ba5c){if(_0x10ba5c&&_0x10ba5c[_0x4ed2('0x5a')]===0x0){return db[_0x4ed2('0x28')]['create']({'name':_0x1f521b['name'],'resourceId':_0x1f521b['id'],'type':_0x10ba5c[_0x4ed2('0x2c')],'sectionId':_0x10ba5c['id']},{})['then'](function(){return _0x577233;});}else{return _0x577233;}})[_0x4ed2('0x48')](function(_0xa6cbdb){logger[_0x4ed2('0x2a')](_0x4ed2('0x5b'),_0xa6cbdb);throw _0xa6cbdb;});}return _0x577233;})[_0x4ed2('0x25')](respondWithResult(_0x7bb765,0xc9))[_0x4ed2('0x48')](handleError(_0x7bb765,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d5e1e53..b42e91c 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 _0x3107=['rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','path'];(function(_0x459c7d,_0x1771b5){var _0x2e676f=function(_0x1e31e0){while(--_0x1e31e0){_0x459c7d['push'](_0x459c7d['shift']());}};_0x2e676f(++_0x1771b5);}(_0x3107,0x1b8));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7310('0x0'))(_0x7310('0x1'));var moment=require('moment');var BPromise=require(_0x7310('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7310('0x3'));var rimraf=require(_0x7310('0x4'));var config=require(_0x7310('0x5'));var attributes=require(_0x7310('0x6'));module[_0x7310('0x7')]=function(_0x11338c,_0xcb315f){return _0x11338c[_0x7310('0x8')](_0x7310('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7310('0xa'),'collate':_0x7310('0xb')});}; \ No newline at end of file +var _0x17b9=['util','bluebird','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x17b9,0x8b));var _0x917b=function(_0x1282f0,_0x1579d2){_0x1282f0=_0x1282f0-0x0;var _0x51ee8d=_0x17b9[_0x1282f0];return _0x51ee8d;};'use strict';var _=require(_0x917b('0x0'));var util=require(_0x917b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x917b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x917b('0x3'));var config=require(_0x917b('0x4'));var attributes=require(_0x917b('0x5'));module[_0x917b('0x6')]=function(_0x2c1d89,_0x847984){return _0x2c1d89['define'](_0x917b('0x7'),attributes,{'tableName':_0x917b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x917b('0x9')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4dda639..cc306c0 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(_0x1d719e,_0x3fa907){var _0x3ecf44=function(_0x21bc37){while(--_0x21bc37){_0x1d719e['push'](_0x1d719e['shift']());}};_0x3ecf44(++_0x3fa907);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x4d09ec,_0x2b7267){var _0x285698=function(_0xa3bd89){while(--_0xa3bd89){_0x4d09ec['push'](_0x4d09ec['shift']());}};_0x285698(++_0x2b7267);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 86354e0..de5b74d 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 _0x150d=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','create','put','update','/:id','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4f7e2b,_0x591c7a){var _0xcbf189=function(_0x3ec217){while(--_0x3ec217){_0x4f7e2b['push'](_0x4f7e2b['shift']());}};_0xcbf189(++_0x591c7a);}(_0x150d,0xca));var _0xd150=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0x150d[_0x3a4f18];return _0x4c20fc;};'use strict';var multer=require(_0xd150('0x0'));var util=require('util');var path=require(_0xd150('0x1'));var timeout=require('connect-timeout');var express=require(_0xd150('0x2'));var router=express[_0xd150('0x3')]();var fs_extra=require(_0xd150('0x4'));var auth=require(_0xd150('0x5'));var interaction=require(_0xd150('0x6'));var config=require(_0xd150('0x7'));var controller=require(_0xd150('0x8'));router[_0xd150('0x9')]('/',auth[_0xd150('0xa')](),controller['index']);router['get']('/:id',auth[_0xd150('0xa')](),controller['show']);router['post']('/',auth[_0xd150('0xa')](),controller[_0xd150('0xb')]);router[_0xd150('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xd150('0xd')]);router['delete'](_0xd150('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xd150('0xf')]=router; \ No newline at end of file +var _0x46e5=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x24358b,_0x23394b){var _0x44515c=function(_0x3872a4){while(--_0x3872a4){_0x24358b['push'](_0x24358b['shift']());}};_0x44515c(++_0x23394b);}(_0x46e5,0x102));var _0x546e=function(_0x138b14,_0x23e2dd){_0x138b14=_0x138b14-0x0;var _0x156961=_0x46e5[_0x138b14];return _0x156961;};'use strict';var multer=require(_0x546e('0x0'));var util=require(_0x546e('0x1'));var path=require(_0x546e('0x2'));var timeout=require(_0x546e('0x3'));var express=require(_0x546e('0x4'));var router=express[_0x546e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x546e('0x6'));var interaction=require(_0x546e('0x7'));var config=require(_0x546e('0x8'));var controller=require('./cannedAnswer.controller');router[_0x546e('0x9')]('/',auth[_0x546e('0xa')](),controller[_0x546e('0xb')]);router['get'](_0x546e('0xc'),auth[_0x546e('0xa')](),controller[_0x546e('0xd')]);router[_0x546e('0xe')]('/',auth[_0x546e('0xa')](),controller['create']);router[_0x546e('0xf')](_0x546e('0xc'),auth[_0x546e('0xa')](),controller[_0x546e('0x10')]);router[_0x546e('0x11')]('/:id',auth[_0x546e('0xa')](),controller[_0x546e('0x12')]);module[_0x546e('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4c70f53..078205f 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 _0x82fa=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x596b95,_0x42fd0f){var _0x38ac99=function(_0x3372f0){while(--_0x3372f0){_0x596b95['push'](_0x596b95['shift']());}};_0x38ac99(++_0x42fd0f);}(_0x82fa,0x1cc));var _0xa82f=function(_0x6a5b44,_0x29fd9e){_0x6a5b44=_0x6a5b44-0x0;var _0x33a0e9=_0x82fa[_0x6a5b44];return _0x33a0e9;};'use strict';var Sequelize=require(_0xa82f('0x0'));module[_0xa82f('0x1')]={'calldate':{'type':Sequelize[_0xa82f('0x2')],'allowNull':![],'defaultValue':_0xa82f('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xa82f('0x4')]},'channel':{'type':Sequelize[_0xa82f('0x4')]},'dstchannel':{'type':Sequelize[_0xa82f('0x4')]},'lastapp':{'type':Sequelize[_0xa82f('0x4')]},'lastdata':{'type':Sequelize[_0xa82f('0x4')]},'duration':{'type':Sequelize[_0xa82f('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa82f('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa82f('0x4')]},'amaflags':{'type':Sequelize[_0xa82f('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xa82f('0x4')]},'userfield':{'type':Sequelize[_0xa82f('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xa82f('0x4')]},'peeraccount':{'type':Sequelize[_0xa82f('0x4')]},'type':{'type':Sequelize[_0xa82f('0x4')]},'tag':{'type':Sequelize[_0xa82f('0x4')]}}; \ No newline at end of file +var _0x34ab=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x3e7439,_0x51c10e){var _0x51d5d1=function(_0x332172){while(--_0x332172){_0x3e7439['push'](_0x3e7439['shift']());}};_0x51d5d1(++_0x51c10e);}(_0x34ab,0x169));var _0xb34a=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x34ab[_0x53abe5];return _0xc1c37e;};'use strict';var Sequelize=require(_0xb34a('0x0'));module[_0xb34a('0x1')]={'calldate':{'type':Sequelize[_0xb34a('0x2')],'allowNull':![],'defaultValue':_0xb34a('0x3')},'clid':{'type':Sequelize[_0xb34a('0x4')]},'src':{'type':Sequelize[_0xb34a('0x4')]},'dst':{'type':Sequelize[_0xb34a('0x4')]},'dcontext':{'type':Sequelize[_0xb34a('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xb34a('0x4')]},'lastdata':{'type':Sequelize[_0xb34a('0x4')]},'duration':{'type':Sequelize[_0xb34a('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb34a('0x4')]},'amaflags':{'type':Sequelize[_0xb34a('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb34a('0x4')]},'userfield':{'type':Sequelize[_0xb34a('0x4')]},'uniqueid':{'type':Sequelize[_0xb34a('0x4')]},'linkedid':{'type':Sequelize[_0xb34a('0x4')]},'sequence':{'type':Sequelize[_0xb34a('0x4')]},'peeraccount':{'type':Sequelize[_0xb34a('0x4')]},'type':{'type':Sequelize[_0xb34a('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9a88014..5dae8df 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 _0x4006=['findAll','catch','show','keys','include','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','end','error','stack','name','index','Cdr','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll'];(function(_0x32708a,_0x2f186c){var _0xa8fd72=function(_0xc78df1){while(--_0xc78df1){_0x32708a['push'](_0x32708a['shift']());}};_0xa8fd72(++_0x2f186c);}(_0x4006,0x1c7));var _0x6400=function(_0x5e2f79,_0x7c1ce8){_0x5e2f79=_0x5e2f79-0x0;var _0x5d0100=_0x4006[_0x5e2f79];return _0x5d0100;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6400('0x0'));var zipdir=require(_0x6400('0x1'));var jsonpatch=require(_0x6400('0x2'));var rp=require(_0x6400('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6400('0x4'));var util=require('util');var path=require(_0x6400('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6400('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6400('0x7'));var squel=require(_0x6400('0x8'));var crypto=require(_0x6400('0x9'));var jsforce=require(_0x6400('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6400('0xb'));var querystring=require(_0x6400('0xc'));var Papa=require(_0x6400('0xd'));var Redis=require(_0x6400('0xe'));var authService=require(_0x6400('0xf'));var qs=require(_0x6400('0x10'));var as=require(_0x6400('0x11'));var hardwareService=require(_0x6400('0x12'));var logger=require(_0x6400('0x13'))(_0x6400('0x14'));var utils=require(_0x6400('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6400('0x16'));var db=require(_0x6400('0x17'))['db'];function respondWithStatusCode(_0x230c94,_0x36bf00){_0x36bf00=_0x36bf00||0xcc;return function(_0x5a6d31){if(_0x5a6d31){return _0x230c94[_0x6400('0x18')](_0x36bf00);}return _0x230c94[_0x6400('0x19')](_0x36bf00)['end']();};}function respondWithResult(_0x4f8133,_0x559312){_0x559312=_0x559312||0xc8;return function(_0x268f93){if(_0x268f93){return _0x4f8133[_0x6400('0x19')](_0x559312)['json'](_0x268f93);}};}function respondWithFilteredResult(_0x191696,_0x4ae3ea){return function(_0x28eb67){if(_0x28eb67){var _0x5a0c1c=typeof _0x4ae3ea[_0x6400('0x1a')]===_0x6400('0x1b')&&typeof _0x4ae3ea[_0x6400('0x1c')]===_0x6400('0x1b');var _0x49d412=_0x28eb67[_0x6400('0x1d')];var _0x14c036=_0x5a0c1c?0x0:_0x4ae3ea[_0x6400('0x1a')];var _0x50524f=_0x5a0c1c?_0x28eb67[_0x6400('0x1d')]:_0x4ae3ea[_0x6400('0x1a')]+_0x4ae3ea['limit'];var _0x36a8f5;if(_0x50524f>=_0x49d412){_0x50524f=_0x49d412;_0x36a8f5=0xc8;}else{_0x36a8f5=0xce;}_0x191696[_0x6400('0x19')](_0x36a8f5);return _0x191696[_0x6400('0x1e')]('Content-Range',_0x14c036+'-'+_0x50524f+'/'+_0x49d412)[_0x6400('0x1f')](_0x28eb67);}return null;};}function patchUpdates(_0x23c1cd){return function(_0x325bde){try{jsonpatch[_0x6400('0x20')](_0x325bde,_0x23c1cd,!![]);}catch(_0x1c8b72){return BPromise[_0x6400('0x21')](_0x1c8b72);}return _0x325bde[_0x6400('0x22')]();};}function saveUpdates(_0x171e39,_0x22eb63){return function(_0x212f0f){if(_0x212f0f){return _0x212f0f['update'](_0x171e39)[_0x6400('0x23')](function(_0x50c29e){return _0x50c29e;});}return null;};}function removeEntity(_0x589b7c,_0x257d80){return function(_0xb79c62){if(_0xb79c62){return _0xb79c62[_0x6400('0x24')]()[_0x6400('0x23')](function(){_0x589b7c['status'](0xcc)[_0x6400('0x25')]();});}};}function handleEntityNotFound(_0x56d9e6,_0x1acff2){return function(_0x506732){if(!_0x506732){_0x56d9e6[_0x6400('0x18')](0x194);}return _0x506732;};}function handleError(_0x246433,_0x577156){_0x577156=_0x577156||0x1f4;return function(_0x434550){logger[_0x6400('0x26')](_0x434550[_0x6400('0x27')]);if(_0x434550['name']){delete _0x434550[_0x6400('0x28')];}_0x246433['status'](_0x577156)['send'](_0x434550);};}exports[_0x6400('0x29')]=function(_0x4bb214,_0x234670){var _0x197b9d={},_0x50f5e9={},_0x452a2c={'count':0x0,'rows':[]};var _0x52eba1=_['map'](db[_0x6400('0x2a')][_0x6400('0x2b')],function(_0x10005a){return{'name':_0x10005a[_0x6400('0x2c')],'type':_0x10005a[_0x6400('0x2d')]['key']};});_0x50f5e9[_0x6400('0x2e')]=_[_0x6400('0x2f')](_0x52eba1,_0x6400('0x28'));_0x50f5e9[_0x6400('0x30')]=_['keys'](_0x4bb214[_0x6400('0x30')]);_0x50f5e9[_0x6400('0x31')]=_[_0x6400('0x32')](_0x50f5e9['model'],_0x50f5e9[_0x6400('0x30')]);_0x197b9d[_0x6400('0x33')]=_[_0x6400('0x32')](_0x50f5e9[_0x6400('0x2e')],qs['fields'](_0x4bb214[_0x6400('0x30')][_0x6400('0x34')]));_0x197b9d['attributes']=_0x197b9d[_0x6400('0x33')][_0x6400('0x35')]?_0x197b9d['attributes']:_0x50f5e9['model'];if(!_0x4bb214[_0x6400('0x30')][_0x6400('0x36')](_0x6400('0x37'))){_0x197b9d['limit']=qs['limit'](_0x4bb214['query'][_0x6400('0x1c')]);_0x197b9d[_0x6400('0x1a')]=qs[_0x6400('0x1a')](_0x4bb214[_0x6400('0x30')][_0x6400('0x1a')]);}_0x197b9d['order']=qs[_0x6400('0x38')](_0x4bb214[_0x6400('0x30')]['sort']);_0x197b9d['where']=qs[_0x6400('0x31')](_[_0x6400('0x39')](_0x4bb214[_0x6400('0x30')],_0x50f5e9['filters']),_0x52eba1);if(_0x4bb214[_0x6400('0x30')][_0x6400('0x3a')]){_0x197b9d[_0x6400('0x3b')]=_['merge'](_0x197b9d[_0x6400('0x3b')],{'$or':_[_0x6400('0x2f')](_0x52eba1,function(_0xd824bf){if(_0xd824bf['type']!=='VIRTUAL'){var _0x5a0973={};_0x5a0973[_0xd824bf[_0x6400('0x28')]]={'$like':'%'+_0x4bb214['query']['filter']+'%'};return _0x5a0973;}})});}_0x197b9d=_[_0x6400('0x3c')]({},_0x197b9d,_0x4bb214[_0x6400('0x3d')]);var _0x565942={'where':_0x197b9d[_0x6400('0x3b')]};return db[_0x6400('0x2a')][_0x6400('0x1d')](_0x565942)['then'](function(_0x9536e5){_0x452a2c[_0x6400('0x1d')]=_0x9536e5;if(_0x4bb214[_0x6400('0x30')][_0x6400('0x3e')]){_0x197b9d['include']=[{'all':!![]}];}return db['Cdr'][_0x6400('0x3f')](_0x197b9d);})[_0x6400('0x23')](function(_0x1bf820){_0x452a2c['rows']=_0x1bf820;return _0x452a2c;})[_0x6400('0x23')](respondWithFilteredResult(_0x234670,_0x197b9d))[_0x6400('0x40')](handleError(_0x234670,null));};exports[_0x6400('0x41')]=function(_0xe50c96,_0x3069f0){var _0x557133={'raw':!![],'where':{'id':_0xe50c96['params']['id']}},_0x24d0c7={};_0x24d0c7[_0x6400('0x2e')]=_[_0x6400('0x42')](db[_0x6400('0x2a')][_0x6400('0x2b')]);_0x24d0c7['query']=_[_0x6400('0x42')](_0xe50c96[_0x6400('0x30')]);_0x24d0c7[_0x6400('0x31')]=_[_0x6400('0x32')](_0x24d0c7['model'],_0x24d0c7[_0x6400('0x30')]);_0x557133['attributes']=_[_0x6400('0x32')](_0x24d0c7['model'],qs[_0x6400('0x34')](_0xe50c96[_0x6400('0x30')][_0x6400('0x34')]));_0x557133['attributes']=_0x557133[_0x6400('0x33')]['length']?_0x557133[_0x6400('0x33')]:_0x24d0c7[_0x6400('0x2e')];if(_0xe50c96[_0x6400('0x30')][_0x6400('0x3e')]){_0x557133[_0x6400('0x43')]=[{'all':!![]}];}_0x557133=_[_0x6400('0x3c')]({},_0x557133,_0xe50c96[_0x6400('0x3d')]);return db[_0x6400('0x2a')][_0x6400('0x44')](_0x557133)[_0x6400('0x23')](handleEntityNotFound(_0x3069f0,null))[_0x6400('0x23')](respondWithResult(_0x3069f0,null))['catch'](handleError(_0x3069f0,null));};exports[_0x6400('0x45')]=function(_0x3340c7,_0x59a8f2){return db['Cdr'][_0x6400('0x45')](_0x3340c7[_0x6400('0x46')],{})[_0x6400('0x23')](respondWithResult(_0x59a8f2,0xc9))['catch'](handleError(_0x59a8f2,null));};exports[_0x6400('0x47')]=function(_0x54cbfb,_0x518ee4){if(_0x54cbfb['body']['id']){delete _0x54cbfb[_0x6400('0x46')]['id'];}return db[_0x6400('0x2a')]['find']({'where':{'id':_0x54cbfb[_0x6400('0x48')]['id']}})[_0x6400('0x23')](handleEntityNotFound(_0x518ee4,null))['then'](saveUpdates(_0x54cbfb['body'],null))[_0x6400('0x23')](respondWithResult(_0x518ee4,null))[_0x6400('0x40')](handleError(_0x518ee4,null));};exports['destroy']=function(_0x3421b5,_0x205233){return db[_0x6400('0x2a')][_0x6400('0x44')]({'where':{'id':_0x3421b5[_0x6400('0x48')]['id']}})[_0x6400('0x23')](handleEntityNotFound(_0x205233,null))[_0x6400('0x23')](removeEntity(_0x205233,null))['catch'](handleError(_0x205233,null));};exports[_0x6400('0x49')]=function(_0x801179,_0x6905bb){return db[_0x6400('0x2a')][_0x6400('0x49')]()[_0x6400('0x23')](respondWithResult(_0x6905bb,null))[_0x6400('0x40')](handleError(_0x6905bb,null));}; \ No newline at end of file +var _0x814b=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','Cdr','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0xdf19e1,_0x42f160){var _0x1f4379=function(_0x130a4c){while(--_0x130a4c){_0xdf19e1['push'](_0xdf19e1['shift']());}};_0x1f4379(++_0x42f160);}(_0x814b,0x1a2));var _0xb814=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x814b[_0x467488];return _0x56107f;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['Cdr'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['create']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')](_0x338e80[_0xb814('0x49')],{})[_0xb814('0x28')](respondWithResult(_0x55234d,0xc9))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x2cc806,_0x45480e){if(_0x2cc806[_0xb814('0x49')]['id']){delete _0x2cc806[_0xb814('0x49')]['id'];}return db['Cdr']['find']({'where':{'id':_0x2cc806[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45480e,null))[_0xb814('0x28')](saveUpdates(_0x2cc806[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x45480e,null))[_0xb814('0x45')](handleError(_0x45480e,null));};exports[_0xb814('0x29')]=function(_0x4a4f9a,_0x26fd0b){return db[_0xb814('0x41')][_0xb814('0x47')]({'where':{'id':_0x4a4f9a['params']['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x26fd0b,null))['then'](removeEntity(_0x26fd0b,null))[_0xb814('0x45')](handleError(_0x26fd0b,null));};exports['describe']=function(_0x403872,_0x3cf8f8){return db['Cdr'][_0xb814('0x4a')]()[_0xb814('0x28')](respondWithResult(_0x3cf8f8,null))[_0xb814('0x45')](handleError(_0x3cf8f8,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 5032abe..0f73d3b 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x5ab037,_0x49d448){var _0x1f82e3=function(_0x250b00){while(--_0x250b00){_0x5ab037['push'](_0x5ab037['shift']());}};_0x1f82e3(++_0x49d448);}(_0x7a54,0x106));var _0x47a5=function(_0x49ce75,_0x4dd94c){_0x49ce75=_0x49ce75-0x0;var _0x1897d5=_0x7a54[_0x49ce75];return _0x1897d5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x40f923,_0x2cd776){var _0x2b43cf=function(_0x366a3a){while(--_0x366a3a){_0x40f923['push'](_0x40f923['shift']());}};_0x2b43cf(++_0x2cd776);}(_0x7a54,0x106));var _0x47a5=function(_0x4e8097,_0x38e265){_0x4e8097=_0x4e8097-0x0;var _0x424e76=_0x7a54[_0x4e8097];return _0x424e76;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 789a895..b2342ab 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 _0x340f=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x41b369,_0x29e21f){var _0x2af633=function(_0x588c87){while(--_0x588c87){_0x41b369['push'](_0x41b369['shift']());}};_0x2af633(++_0x29e21f);}(_0x340f,0x171));var _0xf340=function(_0x539ff,_0x3bdd68){_0x539ff=_0x539ff-0x0;var _0x3e3cf1=_0x340f[_0x539ff];return _0x3e3cf1;};'use strict';var _=require(_0xf340('0x0'));var util=require(_0xf340('0x1'));var moment=require(_0xf340('0x2'));var BPromise=require(_0xf340('0x3'));var rs=require(_0xf340('0x4'));var fs=require('fs');var Redis=require(_0xf340('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf340('0x6'))('rpc');var config=require(_0xf340('0x7'));var jayson=require(_0xf340('0x8'));var client=jayson[_0xf340('0x9')][_0xf340('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54ee6b,_0x505a7e,_0x5d4fd8){return new BPromise(function(_0x169204,_0x10f59b){return client[_0xf340('0xb')](_0x54ee6b,_0x5d4fd8)['then'](function(_0x37f02d){logger[_0xf340('0xc')](_0xf340('0xd'),_0x505a7e,_0xf340('0xe'));logger[_0xf340('0xf')](_0xf340('0x10'),_0x505a7e,_0xf340('0xe'),JSON['stringify'](_0x37f02d));if(_0x37f02d['error']){if(_0x37f02d['error'][_0xf340('0x11')]===0x1f4){logger['error'](_0xf340('0xd'),_0x505a7e,_0x37f02d['error']['message']);return _0x10f59b(_0x37f02d['error'][_0xf340('0x12')]);}logger[_0xf340('0x13')](_0xf340('0xd'),_0x505a7e,_0x37f02d[_0xf340('0x13')][_0xf340('0x12')]);return _0x169204(_0x37f02d['error'][_0xf340('0x12')]);}else{logger[_0xf340('0xc')]('Cdr,\x20%s,\x20%s',_0x505a7e,'request\x20sent');_0x169204(_0x37f02d[_0xf340('0x14')][_0xf340('0x12')]);}})[_0xf340('0x15')](function(_0x1d4ce7){logger[_0xf340('0x13')](_0xf340('0xd'),_0x505a7e,_0x1d4ce7);_0x10f59b(_0x1d4ce7);});});} \ No newline at end of file +var _0xbea2=['then','info','Cdr,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3d010a,_0x578986){var _0x1b6c57=function(_0x4401f3){while(--_0x4401f3){_0x3d010a['push'](_0x3d010a['shift']());}};_0x1b6c57(++_0x578986);}(_0xbea2,0xca));var _0x2bea=function(_0x14e91c,_0x3af54e){_0x14e91c=_0x14e91c-0x0;var _0x36609e=_0xbea2[_0x14e91c];return _0x36609e;};'use strict';var _=require(_0x2bea('0x0'));var util=require(_0x2bea('0x1'));var moment=require('moment');var BPromise=require(_0x2bea('0x2'));var rs=require(_0x2bea('0x3'));var fs=require('fs');var Redis=require(_0x2bea('0x4'));var db=require(_0x2bea('0x5'))['db'];var utils=require(_0x2bea('0x6'));var logger=require(_0x2bea('0x7'))(_0x2bea('0x8'));var config=require(_0x2bea('0x9'));var jayson=require(_0x2bea('0xa'));var client=jayson[_0x2bea('0xb')][_0x2bea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a4884,_0x4058c8,_0x82cd64){return new BPromise(function(_0x3a2ded,_0x5061eb){return client[_0x2bea('0xd')](_0x2a4884,_0x82cd64)[_0x2bea('0xe')](function(_0x207e1e){logger[_0x2bea('0xf')](_0x2bea('0x10'),_0x4058c8,_0x2bea('0x11'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x4058c8,_0x2bea('0x11'),JSON[_0x2bea('0x12')](_0x207e1e));if(_0x207e1e['error']){if(_0x207e1e['error'][_0x2bea('0x13')]===0x1f4){logger[_0x2bea('0x14')](_0x2bea('0x10'),_0x4058c8,_0x207e1e[_0x2bea('0x14')]['message']);return _0x5061eb(_0x207e1e[_0x2bea('0x14')][_0x2bea('0x15')]);}logger[_0x2bea('0x14')]('Cdr,\x20%s,\x20%s',_0x4058c8,_0x207e1e['error'][_0x2bea('0x15')]);return _0x3a2ded(_0x207e1e['error']['message']);}else{logger[_0x2bea('0xf')](_0x2bea('0x10'),_0x4058c8,_0x2bea('0x11'));_0x3a2ded(_0x207e1e[_0x2bea('0x16')][_0x2bea('0x15')]);}})[_0x2bea('0x17')](function(_0x24644b){logger[_0x2bea('0x14')](_0x2bea('0x10'),_0x4058c8,_0x24644b);_0x5061eb(_0x24644b);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 5542b6f..a2e2f06 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(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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(_0x22c393,_0x1f2389){var _0x161580=function(_0x3bd765){while(--_0x3bd765){_0x22c393['push'](_0x22c393['shift']());}};_0x161580(++_0x1f2389);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 41e268e..3e1d06a 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 _0x5ac3=['STRING','*,*,*,*','sequelize','INTEGER','noop','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ac3,0xce));var _0x35ac=function(_0x551463,_0x197e90){_0x551463=_0x551463-0x0;var _0x4d38f6=_0x5ac3[_0x551463];return _0x4d38f6;};'use strict';var Sequelize=require(_0x35ac('0x0'));module['exports']={'priority':{'type':Sequelize[_0x35ac('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35ac('0x2')},'appdata':{'type':Sequelize[_0x35ac('0x3')]()},'description':{'type':Sequelize[_0x35ac('0x4')]},'interval':{'type':Sequelize[_0x35ac('0x4')],'defaultValue':_0x35ac('0x5')}}; \ No newline at end of file +var _0xfb69=['INTEGER','STRING','sequelize'];(function(_0x3fc209,_0x83e34){var _0x3fd3d=function(_0x73319e){while(--_0x73319e){_0x3fc209['push'](_0x3fc209['shift']());}};_0x3fd3d(++_0x83e34);}(_0xfb69,0x113));var _0x9fb6=function(_0x125580,_0x641673){_0x125580=_0x125580-0x0;var _0x23954a=_0xfb69[_0x125580];return _0x23954a;};'use strict';var Sequelize=require(_0x9fb6('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9fb6('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9fb6('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 48af967..2904ba2 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 _0x2cae=['keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params','model'];(function(_0x89b6b9,_0x1d271e){var _0x294d7b=function(_0x2c54fd){while(--_0x2c54fd){_0x89b6b9['push'](_0x89b6b9['shift']());}};_0x294d7b(++_0x1d271e);}(_0x2cae,0x16b));var _0xe2ca=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x2cae[_0x22f8ab];return _0x2a70e5;};'use strict';var emlformat=require(_0xe2ca('0x0'));var rimraf=require(_0xe2ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe2ca('0x2'));var moment=require(_0xe2ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe2ca('0x4'));var util=require(_0xe2ca('0x5'));var path=require(_0xe2ca('0x6'));var sox=require(_0xe2ca('0x7'));var csv=require('to-csv');var ejs=require(_0xe2ca('0x8'));var fs=require('fs');var fs_extra=require(_0xe2ca('0x9'));var _=require('lodash');var squel=require(_0xe2ca('0xa'));var crypto=require('crypto');var jsforce=require(_0xe2ca('0xb'));var deskjs=require(_0xe2ca('0xc'));var toCsv=require(_0xe2ca('0xd'));var querystring=require(_0xe2ca('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe2ca('0xf'));var hardwareService=require(_0xe2ca('0x10'));var logger=require(_0xe2ca('0x11'))(_0xe2ca('0x12'));var utils=require(_0xe2ca('0x13'));var config=require(_0xe2ca('0x14'));var licenseUtil=require(_0xe2ca('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1138ee,_0x2773cc){_0x2773cc=_0x2773cc||0xcc;return function(_0x199237){if(_0x199237){return _0x1138ee[_0xe2ca('0x16')](_0x2773cc);}return _0x1138ee[_0xe2ca('0x17')](_0x2773cc)['end']();};}function respondWithResult(_0x31f283,_0x3cfcc9){_0x3cfcc9=_0x3cfcc9||0xc8;return function(_0x27c3ad){if(_0x27c3ad){return _0x31f283[_0xe2ca('0x17')](_0x3cfcc9)[_0xe2ca('0x18')](_0x27c3ad);}};}function respondWithFilteredResult(_0x3a9612,_0x1c1514){return function(_0x29cdcf){if(_0x29cdcf){var _0x326340=typeof _0x1c1514[_0xe2ca('0x19')]==='undefined'&&typeof _0x1c1514[_0xe2ca('0x1a')]==='undefined';var _0x4ca8fd=_0x29cdcf[_0xe2ca('0x1b')];var _0x18cd42=_0x326340?0x0:_0x1c1514['offset'];var _0x393c23=_0x326340?_0x29cdcf[_0xe2ca('0x1b')]:_0x1c1514[_0xe2ca('0x19')]+_0x1c1514['limit'];var _0x4380fb;if(_0x393c23>=_0x4ca8fd){_0x393c23=_0x4ca8fd;_0x4380fb=0xc8;}else{_0x4380fb=0xce;}_0x3a9612[_0xe2ca('0x17')](_0x4380fb);return _0x3a9612[_0xe2ca('0x1c')]('Content-Range',_0x18cd42+'-'+_0x393c23+'/'+_0x4ca8fd)[_0xe2ca('0x18')](_0x29cdcf);}return null;};}function patchUpdates(_0x56b574){return function(_0x16f418){try{jsonpatch[_0xe2ca('0x1d')](_0x16f418,_0x56b574,!![]);}catch(_0x60d8e8){return BPromise[_0xe2ca('0x1e')](_0x60d8e8);}return _0x16f418[_0xe2ca('0x1f')]();};}function saveUpdates(_0x1b98d8,_0x50af69){return function(_0x1a1522){if(_0x1a1522){return _0x1a1522[_0xe2ca('0x20')](_0x1b98d8)[_0xe2ca('0x21')](function(_0x2ca129){return _0x2ca129;});}return null;};}function removeEntity(_0x18a6c6,_0x2772b5){return function(_0xa1fa2b){if(_0xa1fa2b){return _0xa1fa2b[_0xe2ca('0x22')]()[_0xe2ca('0x21')](function(){_0x18a6c6['status'](0xcc)[_0xe2ca('0x23')]();});}};}function handleEntityNotFound(_0x272bb3,_0x3f3d6e){return function(_0xc52f5e){if(!_0xc52f5e){_0x272bb3[_0xe2ca('0x16')](0x194);}return _0xc52f5e;};}function handleError(_0x4b2a2e,_0x524b6c){_0x524b6c=_0x524b6c||0x1f4;return function(_0x20ac37){logger[_0xe2ca('0x24')](_0x20ac37[_0xe2ca('0x25')]);if(_0x20ac37[_0xe2ca('0x26')]){delete _0x20ac37[_0xe2ca('0x26')];}_0x4b2a2e[_0xe2ca('0x17')](_0x524b6c)[_0xe2ca('0x27')](_0x20ac37);};}exports[_0xe2ca('0x28')]=function(_0x565e9b,_0x5df46f){var _0x333665={'raw':!![],'where':{'id':_0x565e9b[_0xe2ca('0x29')]['id']}},_0x300d0e={};_0x300d0e[_0xe2ca('0x2a')]=_[_0xe2ca('0x2b')](db[_0xe2ca('0x2c')][_0xe2ca('0x2d')]);_0x300d0e[_0xe2ca('0x2e')]=_[_0xe2ca('0x2b')](_0x565e9b[_0xe2ca('0x2e')]);_0x300d0e[_0xe2ca('0x2f')]=_[_0xe2ca('0x30')](_0x300d0e[_0xe2ca('0x2a')],_0x300d0e[_0xe2ca('0x2e')]);_0x333665['attributes']=_[_0xe2ca('0x30')](_0x300d0e[_0xe2ca('0x2a')],qs[_0xe2ca('0x31')](_0x565e9b[_0xe2ca('0x2e')][_0xe2ca('0x31')]));_0x333665[_0xe2ca('0x32')]=_0x333665[_0xe2ca('0x32')]['length']?_0x333665['attributes']:_0x300d0e['model'];if(_0x565e9b[_0xe2ca('0x2e')][_0xe2ca('0x33')]){_0x333665[_0xe2ca('0x34')]=[{'all':!![]}];}_0x333665=_[_0xe2ca('0x35')]({},_0x333665,_0x565e9b[_0xe2ca('0x36')]);return db['ChatApplication'][_0xe2ca('0x37')](_0x333665)[_0xe2ca('0x21')](handleEntityNotFound(_0x5df46f,null))['then'](respondWithResult(_0x5df46f,null))[_0xe2ca('0x38')](handleError(_0x5df46f,null));};exports[_0xe2ca('0x20')]=function(_0x21d7bf,_0x48b0f8){if(_0x21d7bf[_0xe2ca('0x39')]['id']){delete _0x21d7bf[_0xe2ca('0x39')]['id'];}return db[_0xe2ca('0x2c')]['find']({'where':{'id':_0x21d7bf[_0xe2ca('0x29')]['id']}})['then'](handleEntityNotFound(_0x48b0f8,null))[_0xe2ca('0x21')](saveUpdates(_0x21d7bf['body'],null))['then'](respondWithResult(_0x48b0f8,null))[_0xe2ca('0x38')](handleError(_0x48b0f8,null));};exports[_0xe2ca('0x22')]=function(_0x2dbf5e,_0x57e784){return db[_0xe2ca('0x2c')][_0xe2ca('0x37')]({'where':{'id':_0x2dbf5e[_0xe2ca('0x29')]['id']}})[_0xe2ca('0x21')](handleEntityNotFound(_0x57e784,null))['then'](removeEntity(_0x57e784,null))['catch'](handleError(_0x57e784,null));}; \ No newline at end of file +var _0x6836=['stack','name','send','show','params','keys','ChatApplication','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error'];(function(_0x2e3b30,_0x31b2c0){var _0x3811a0=function(_0x190460){while(--_0x190460){_0x2e3b30['push'](_0x2e3b30['shift']());}};_0x3811a0(++_0x31b2c0);}(_0x6836,0x1c0));var _0x6683=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x6836[_0x13ea00];return _0x1f7347;};'use strict';var emlformat=require(_0x6683('0x0'));var rimraf=require(_0x6683('0x1'));var zipdir=require(_0x6683('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6683('0x3'));var moment=require('moment');var BPromise=require(_0x6683('0x4'));var Mustache=require('mustache');var util=require(_0x6683('0x5'));var path=require('path');var sox=require(_0x6683('0x6'));var csv=require(_0x6683('0x7'));var ejs=require(_0x6683('0x8'));var fs=require('fs');var fs_extra=require(_0x6683('0x9'));var _=require('lodash');var squel=require(_0x6683('0xa'));var crypto=require(_0x6683('0xb'));var jsforce=require(_0x6683('0xc'));var deskjs=require(_0x6683('0xd'));var toCsv=require(_0x6683('0x7'));var querystring=require(_0x6683('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6683('0xf'));var qs=require(_0x6683('0x10'));var as=require(_0x6683('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6683('0x12'))('api');var utils=require(_0x6683('0x13'));var config=require(_0x6683('0x14'));var licenseUtil=require(_0x6683('0x15'));var db=require(_0x6683('0x16'))['db'];function respondWithStatusCode(_0x3479a3,_0x205647){_0x205647=_0x205647||0xcc;return function(_0x4181e2){if(_0x4181e2){return _0x3479a3[_0x6683('0x17')](_0x205647);}return _0x3479a3['status'](_0x205647)[_0x6683('0x18')]();};}function respondWithResult(_0x1bf449,_0x4ccb6){_0x4ccb6=_0x4ccb6||0xc8;return function(_0x28985f){if(_0x28985f){return _0x1bf449[_0x6683('0x19')](_0x4ccb6)['json'](_0x28985f);}};}function respondWithFilteredResult(_0x2a6c74,_0x44e850){return function(_0x3df040){if(_0x3df040){var _0x11fdef=typeof _0x44e850[_0x6683('0x1a')]===_0x6683('0x1b')&&typeof _0x44e850[_0x6683('0x1c')]===_0x6683('0x1b');var _0x47466b=_0x3df040[_0x6683('0x1d')];var _0x4cad41=_0x11fdef?0x0:_0x44e850[_0x6683('0x1a')];var _0x1be466=_0x11fdef?_0x3df040[_0x6683('0x1d')]:_0x44e850[_0x6683('0x1a')]+_0x44e850['limit'];var _0x2dabc1;if(_0x1be466>=_0x47466b){_0x1be466=_0x47466b;_0x2dabc1=0xc8;}else{_0x2dabc1=0xce;}_0x2a6c74[_0x6683('0x19')](_0x2dabc1);return _0x2a6c74[_0x6683('0x1e')](_0x6683('0x1f'),_0x4cad41+'-'+_0x1be466+'/'+_0x47466b)[_0x6683('0x20')](_0x3df040);}return null;};}function patchUpdates(_0x2d3775){return function(_0x1fa733){try{jsonpatch[_0x6683('0x21')](_0x1fa733,_0x2d3775,!![]);}catch(_0x1978a9){return BPromise[_0x6683('0x22')](_0x1978a9);}return _0x1fa733[_0x6683('0x23')]();};}function saveUpdates(_0x248177,_0x34680f){return function(_0x3b63e7){if(_0x3b63e7){return _0x3b63e7[_0x6683('0x24')](_0x248177)[_0x6683('0x25')](function(_0x55aeb3){return _0x55aeb3;});}return null;};}function removeEntity(_0x12ce3f,_0x33cdd3){return function(_0x49c1ce){if(_0x49c1ce){return _0x49c1ce[_0x6683('0x26')]()[_0x6683('0x25')](function(){_0x12ce3f[_0x6683('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b005e,_0x2a2243){return function(_0x43879e){if(!_0x43879e){_0x3b005e[_0x6683('0x17')](0x194);}return _0x43879e;};}function handleError(_0x507b67,_0x1e9c1e){_0x1e9c1e=_0x1e9c1e||0x1f4;return function(_0x40959d){logger[_0x6683('0x27')](_0x40959d[_0x6683('0x28')]);if(_0x40959d['name']){delete _0x40959d[_0x6683('0x29')];}_0x507b67[_0x6683('0x19')](_0x1e9c1e)[_0x6683('0x2a')](_0x40959d);};}exports[_0x6683('0x2b')]=function(_0x1cf62b,_0x1bb6e0){var _0x343f4e={'raw':!![],'where':{'id':_0x1cf62b[_0x6683('0x2c')]['id']}},_0xda3a48={};_0xda3a48['model']=_[_0x6683('0x2d')](db[_0x6683('0x2e')]['rawAttributes']);_0xda3a48[_0x6683('0x2f')]=_[_0x6683('0x2d')](_0x1cf62b['query']);_0xda3a48[_0x6683('0x30')]=_['intersection'](_0xda3a48[_0x6683('0x31')],_0xda3a48[_0x6683('0x2f')]);_0x343f4e[_0x6683('0x32')]=_[_0x6683('0x33')](_0xda3a48['model'],qs[_0x6683('0x34')](_0x1cf62b[_0x6683('0x2f')][_0x6683('0x34')]));_0x343f4e[_0x6683('0x32')]=_0x343f4e[_0x6683('0x32')][_0x6683('0x35')]?_0x343f4e[_0x6683('0x32')]:_0xda3a48[_0x6683('0x31')];if(_0x1cf62b[_0x6683('0x2f')][_0x6683('0x36')]){_0x343f4e[_0x6683('0x37')]=[{'all':!![]}];}_0x343f4e=_[_0x6683('0x38')]({},_0x343f4e,_0x1cf62b[_0x6683('0x39')]);return db[_0x6683('0x2e')][_0x6683('0x3a')](_0x343f4e)['then'](handleEntityNotFound(_0x1bb6e0,null))[_0x6683('0x25')](respondWithResult(_0x1bb6e0,null))['catch'](handleError(_0x1bb6e0,null));};exports['update']=function(_0x2b8188,_0x27ad02){if(_0x2b8188[_0x6683('0x3b')]['id']){delete _0x2b8188[_0x6683('0x3b')]['id'];}return db[_0x6683('0x2e')][_0x6683('0x3a')]({'where':{'id':_0x2b8188[_0x6683('0x2c')]['id']}})[_0x6683('0x25')](handleEntityNotFound(_0x27ad02,null))['then'](saveUpdates(_0x2b8188[_0x6683('0x3b')],null))[_0x6683('0x25')](respondWithResult(_0x27ad02,null))[_0x6683('0x3c')](handleError(_0x27ad02,null));};exports['destroy']=function(_0x4f572b,_0x2bd212){return db['ChatApplication'][_0x6683('0x3a')]({'where':{'id':_0x4f572b[_0x6683('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2bd212,null))[_0x6683('0x25')](removeEntity(_0x2bd212,null))[_0x6683('0x3c')](handleError(_0x2bd212,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index bb89672..b8873a4 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 _0x4946=['request-promise','../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x341cbf,_0x52be4a){var _0x3ebf74=function(_0x2943bd){while(--_0x2943bd){_0x341cbf['push'](_0x341cbf['shift']());}};_0x3ebf74(++_0x52be4a);}(_0x4946,0x1b6));var _0x6494=function(_0x40f451,_0x4bbff8){_0x40f451=_0x40f451-0x0;var _0x4c09b3=_0x4946[_0x40f451];return _0x4c09b3;};'use strict';var _=require(_0x6494('0x0'));var util=require(_0x6494('0x1'));var logger=require('../../config/logger')(_0x6494('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6494('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6494('0x4'));var attributes=require('./chatApplication.attributes');module[_0x6494('0x5')]=function(_0x54e930,_0x3cb2bc){return _0x54e930[_0x6494('0x6')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6494('0x7'),'collate':_0x6494('0x8')});}; \ No newline at end of file +var _0x9f8b=['api','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','util','../../config/logger'];(function(_0xd65c06,_0x33ce28){var _0x419849=function(_0x39f056){while(--_0x39f056){_0xd65c06['push'](_0xd65c06['shift']());}};_0x419849(++_0x33ce28);}(_0x9f8b,0x9a));var _0xb9f8=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0x9f8b[_0x48a96f];return _0x3ff3ef;};'use strict';var _=require('lodash');var util=require(_0xb9f8('0x0'));var logger=require(_0xb9f8('0x1'))(_0xb9f8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb9f8('0x3'));var fs=require('fs');var path=require(_0xb9f8('0x4'));var rimraf=require(_0xb9f8('0x5'));var config=require(_0xb9f8('0x6'));var attributes=require(_0xb9f8('0x7'));module[_0xb9f8('0x8')]=function(_0x7a983b,_0x9c53b3){return _0x7a983b[_0xb9f8('0x9')](_0xb9f8('0xa'),attributes,{'tableName':_0xb9f8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9f8('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f36fc99..f45cc97 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 _0x102d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x434339,_0x2abf5e){var _0x507ca6=function(_0x23770a){while(--_0x23770a){_0x434339['push'](_0x434339['shift']());}};_0x507ca6(++_0x2abf5e);}(_0x102d,0x1dd));var _0xd102=function(_0x41498e,_0xe11de7){_0x41498e=_0x41498e-0x0;var _0x2496e2=_0x102d[_0x41498e];return _0x2496e2;};'use strict';var _=require(_0xd102('0x0'));var util=require(_0xd102('0x1'));var moment=require(_0xd102('0x2'));var BPromise=require(_0xd102('0x3'));var rs=require(_0xd102('0x4'));var fs=require('fs');var Redis=require(_0xd102('0x5'));var db=require(_0xd102('0x6'))['db'];var utils=require(_0xd102('0x7'));var logger=require(_0xd102('0x8'))(_0xd102('0x9'));var config=require(_0xd102('0xa'));var jayson=require(_0xd102('0xb'));var client=jayson[_0xd102('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174b3b,_0x266c1e,_0x3ab5a6){return new BPromise(function(_0x339698,_0x1e37b2){return client['request'](_0x174b3b,_0x3ab5a6)[_0xd102('0xd')](function(_0x5ca006){logger[_0xd102('0xe')](_0xd102('0xf'),_0x266c1e,_0xd102('0x10'));logger[_0xd102('0x11')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x266c1e,'request\x20sent',JSON[_0xd102('0x12')](_0x5ca006));if(_0x5ca006[_0xd102('0x13')]){if(_0x5ca006['error'][_0xd102('0x14')]===0x1f4){logger['error'](_0xd102('0xf'),_0x266c1e,_0x5ca006['error'][_0xd102('0x15')]);return _0x1e37b2(_0x5ca006[_0xd102('0x13')]['message']);}logger['error'](_0xd102('0xf'),_0x266c1e,_0x5ca006[_0xd102('0x13')][_0xd102('0x15')]);return _0x339698(_0x5ca006[_0xd102('0x13')][_0xd102('0x15')]);}else{logger['info'](_0xd102('0xf'),_0x266c1e,'request\x20sent');_0x339698(_0x5ca006[_0xd102('0x16')][_0xd102('0x15')]);}})[_0xd102('0x17')](function(_0x2cfd88){logger[_0xd102('0x13')]('ChatApplication,\x20%s,\x20%s',_0x266c1e,_0x2cfd88);_0x1e37b2(_0x2cfd88);});});} \ No newline at end of file +var _0x75bd=['rpc','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','../../mysqldb'];(function(_0x4746cc,_0xe1e47d){var _0x51b5ad=function(_0x3acadc){while(--_0x3acadc){_0x4746cc['push'](_0x4746cc['shift']());}};_0x51b5ad(++_0xe1e47d);}(_0x75bd,0x119));var _0xd75b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x75bd[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xd75b('0x0'));var moment=require('moment');var BPromise=require(_0xd75b('0x1'));var rs=require(_0xd75b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd75b('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd75b('0x4'));var config=require(_0xd75b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd75b('0x6')][_0xd75b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a403d,_0x3d024b,_0x470b18){return new BPromise(function(_0x16c78a,_0x103f4b){return client[_0xd75b('0x8')](_0x3a403d,_0x470b18)[_0xd75b('0x9')](function(_0x4fd9b6){logger['info']('ChatApplication,\x20%s,\x20%s',_0x3d024b,_0xd75b('0xa'));logger[_0xd75b('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3d024b,_0xd75b('0xa'),JSON[_0xd75b('0xc')](_0x4fd9b6));if(_0x4fd9b6['error']){if(_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0xe')]===0x1f4){logger['error'](_0xd75b('0xf'),_0x3d024b,_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0x10')]);return _0x103f4b(_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0x10')]);}logger[_0xd75b('0xd')](_0xd75b('0xf'),_0x3d024b,_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0x10')]);return _0x16c78a(_0x4fd9b6[_0xd75b('0xd')][_0xd75b('0x10')]);}else{logger[_0xd75b('0x11')](_0xd75b('0xf'),_0x3d024b,_0xd75b('0xa'));_0x16c78a(_0x4fd9b6['result'][_0xd75b('0x10')]);}})[_0xd75b('0x12')](function(_0x2fd927){logger['error'](_0xd75b('0xf'),_0x3d024b,_0x2fd927);_0x103f4b(_0x2fd927);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index e310a0c..d2f09ca 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 _0x44b8=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','util','express'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x44b8,0x175));var _0x844b=function(_0x3b1351,_0x5c61eb){_0x3b1351=_0x3b1351-0x0;var _0x535cb7=_0x44b8[_0x3b1351];return _0x535cb7;};'use strict';var multer=require('multer');var util=require(_0x844b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x844b('0x1'));var router=express[_0x844b('0x2')]();var fs_extra=require(_0x844b('0x3'));var auth=require(_0x844b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x844b('0x5'));var controller=require(_0x844b('0x6'));router[_0x844b('0x7')](_0x844b('0x8'),auth[_0x844b('0x9')](),controller[_0x844b('0xa')]);router[_0x844b('0xb')]('/:id',auth[_0x844b('0x9')](),controller[_0x844b('0xc')]);router[_0x844b('0xd')](_0x844b('0x8'),auth['isAuthenticated'](),controller[_0x844b('0xe')]);module['exports']=router; \ No newline at end of file +var _0xdd10=['isAuthenticated','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','show','/:id','update','delete'];(function(_0x44731a,_0x3417bb){var _0x5541bd=function(_0x26d125){while(--_0x26d125){_0x44731a['push'](_0x44731a['shift']());}};_0x5541bd(++_0x3417bb);}(_0xdd10,0x123));var _0x0dd1=function(_0x1f5ab3,_0x15259c){_0x1f5ab3=_0x1f5ab3-0x0;var _0x12cff0=_0xdd10[_0x1f5ab3];return _0x12cff0;};'use strict';var multer=require(_0x0dd1('0x0'));var util=require(_0x0dd1('0x1'));var path=require(_0x0dd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x0dd1('0x3'));var router=express['Router']();var fs_extra=require(_0x0dd1('0x4'));var auth=require(_0x0dd1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0dd1('0x6'));var controller=require(_0x0dd1('0x7'));router[_0x0dd1('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0dd1('0x9')]);router['put'](_0x0dd1('0xa'),auth['isAuthenticated'](),controller[_0x0dd1('0xb')]);router[_0x0dd1('0xc')](_0x0dd1('0xa'),auth[_0x0dd1('0xd')](),controller[_0x0dd1('0xe')]);module[_0x0dd1('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7ba1954..4b99bae 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 _0x11e5=['STRING','sequelize'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x11e5,0x8b));var _0x511e=function(_0x40f5e0,_0x254544){_0x40f5e0=_0x40f5e0-0x0;var _0x54e0eb=_0x11e5[_0x40f5e0];return _0x54e0eb;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'name':{'type':Sequelize[_0x511e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x511e('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xee00=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2c5dd5,_0x5308de){var _0x4b76db=function(_0x3cff23){while(--_0x3cff23){_0x2c5dd5['push'](_0x2c5dd5['shift']());}};_0x4b76db(++_0x5308de);}(_0xee00,0xd5));var _0x0ee0=function(_0x26c8b5,_0x46f969){_0x26c8b5=_0x26c8b5-0x0;var _0x257d19=_0xee00[_0x26c8b5];return _0x257d19;};'use strict';var Sequelize=require(_0x0ee0('0x0'));module[_0x0ee0('0x1')]={'name':{'type':Sequelize[_0x0ee0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0ee0('0x2')]},'write':{'type':Sequelize[_0x0ee0('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 a031301..d9f22e8 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 _0xbbba=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','ChatInternalMessage','user','addMembers','ids','getMembers','User','fields','filters','hasOwnProperty','removeMembers','addMessage','getMessages','findOne','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x4145f0,_0x193417){var _0x5d58bd=function(_0x4ffe92){while(--_0x4ffe92){_0x4145f0['push'](_0x4145f0['shift']());}};_0x5d58bd(++_0x193417);}(_0xbbba,0xad));var _0xabbb=function(_0x301ca3,_0x4233c5){_0x301ca3=_0x301ca3-0x0;var _0x131292=_0xbbba[_0x301ca3];return _0x131292;};'use strict';var emlformat=require(_0xabbb('0x0'));var rimraf=require(_0xabbb('0x1'));var zipdir=require(_0xabbb('0x2'));var jsonpatch=require(_0xabbb('0x3'));var rp=require(_0xabbb('0x4'));var moment=require(_0xabbb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xabbb('0x6'));var util=require(_0xabbb('0x7'));var path=require(_0xabbb('0x8'));var sox=require(_0xabbb('0x9'));var csv=require(_0xabbb('0xa'));var ejs=require(_0xabbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabbb('0xc'));var squel=require(_0xabbb('0xd'));var crypto=require('crypto');var jsforce=require(_0xabbb('0xe'));var deskjs=require(_0xabbb('0xf'));var toCsv=require('to-csv');var querystring=require(_0xabbb('0x10'));var Papa=require(_0xabbb('0x11'));var Redis=require('ioredis');var authService=require(_0xabbb('0x12'));var qs=require(_0xabbb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xabbb('0x14'))(_0xabbb('0x15'));var utils=require('../../config/utils');var config=require(_0xabbb('0x16'));var licenseUtil=require(_0xabbb('0x17'));var db=require(_0xabbb('0x18'))['db'];config[_0xabbb('0x19')]=_['defaults'](config['redis'],{'host':_0xabbb('0x1a'),'port':0x18eb});var socket=require(_0xabbb('0x1b'))(new Redis(config[_0xabbb('0x19')]));require(_0xabbb('0x1c'))[_0xabbb('0x1d')](socket);function respondWithStatusCode(_0x4490ab,_0x3f4bd9){_0x3f4bd9=_0x3f4bd9||0xcc;return function(_0x4c048c){if(_0x4c048c){return _0x4490ab[_0xabbb('0x1e')](_0x3f4bd9);}return _0x4490ab[_0xabbb('0x1f')](_0x3f4bd9)['end']();};}function respondWithResult(_0x35e933,_0x26ac18){_0x26ac18=_0x26ac18||0xc8;return function(_0x43533c){if(_0x43533c){return _0x35e933[_0xabbb('0x1f')](_0x26ac18)[_0xabbb('0x20')](_0x43533c);}};}function respondWithFilteredResult(_0x3fe69a,_0x35215b){return function(_0x23daaf){if(_0x23daaf){var _0x1933d7=typeof _0x35215b[_0xabbb('0x21')]==='undefined'&&typeof _0x35215b['limit']===_0xabbb('0x22');var _0x1bfeb4=_0x23daaf[_0xabbb('0x23')];var _0x2c8882=_0x1933d7?0x0:_0x35215b[_0xabbb('0x21')];var _0x50e698=_0x1933d7?_0x23daaf[_0xabbb('0x23')]:_0x35215b[_0xabbb('0x21')]+_0x35215b['limit'];var _0x557faf;if(_0x50e698>=_0x1bfeb4){_0x50e698=_0x1bfeb4;_0x557faf=0xc8;}else{_0x557faf=0xce;}_0x3fe69a['status'](_0x557faf);return _0x3fe69a[_0xabbb('0x24')](_0xabbb('0x25'),_0x2c8882+'-'+_0x50e698+'/'+_0x1bfeb4)['json'](_0x23daaf);}return null;};}function patchUpdates(_0x1202d6){return function(_0x384f64){try{jsonpatch[_0xabbb('0x26')](_0x384f64,_0x1202d6,!![]);}catch(_0xdf2f53){return BPromise['reject'](_0xdf2f53);}return _0x384f64[_0xabbb('0x27')]();};}function saveUpdates(_0x1f44c7,_0x3fdaf4){return function(_0x201d13){if(_0x201d13){return _0x201d13[_0xabbb('0x28')](_0x1f44c7)['then'](function(_0x12bdbe){return _0x12bdbe;});}return null;};}function removeEntity(_0x305b5f,_0x47a018){return function(_0x235a1d){if(_0x235a1d){return _0x235a1d[_0xabbb('0x29')]()[_0xabbb('0x2a')](function(){_0x305b5f[_0xabbb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26dad9,_0x5e30c1){return function(_0x295b59){if(!_0x295b59){_0x26dad9[_0xabbb('0x1e')](0x194);}return _0x295b59;};}function handleError(_0x2e731e,_0x25f7ec){_0x25f7ec=_0x25f7ec||0x1f4;return function(_0x29f099){logger[_0xabbb('0x2b')](_0x29f099['stack']);if(_0x29f099['name']){delete _0x29f099[_0xabbb('0x2c')];}_0x2e731e[_0xabbb('0x1f')](_0x25f7ec)[_0xabbb('0x2d')](_0x29f099);};}exports[_0xabbb('0x2e')]=function(_0x49d093,_0x371661){var _0x2af959={},_0x1c8415={},_0x585960={'count':0x0,'rows':[]};var _0x2eb04c=_[_0xabbb('0x2f')](db[_0xabbb('0x30')][_0xabbb('0x31')],function(_0x3f5672){return{'name':_0x3f5672[_0xabbb('0x32')],'type':_0x3f5672[_0xabbb('0x33')]['key']};});_0x1c8415[_0xabbb('0x34')]=_['map'](_0x2eb04c,_0xabbb('0x2c'));_0x1c8415['query']=_[_0xabbb('0x35')](_0x49d093[_0xabbb('0x36')]);_0x1c8415['filters']=_[_0xabbb('0x37')](_0x1c8415[_0xabbb('0x34')],_0x1c8415[_0xabbb('0x36')]);_0x2af959[_0xabbb('0x38')]=_[_0xabbb('0x37')](_0x1c8415[_0xabbb('0x34')],qs['fields'](_0x49d093[_0xabbb('0x36')]['fields']));_0x2af959[_0xabbb('0x38')]=_0x2af959[_0xabbb('0x38')][_0xabbb('0x39')]?_0x2af959[_0xabbb('0x38')]:_0x1c8415['model'];if(!_0x49d093[_0xabbb('0x36')]['hasOwnProperty'](_0xabbb('0x3a'))){_0x2af959[_0xabbb('0x3b')]=qs[_0xabbb('0x3b')](_0x49d093[_0xabbb('0x36')][_0xabbb('0x3b')]);_0x2af959['offset']=qs[_0xabbb('0x21')](_0x49d093[_0xabbb('0x36')]['offset']);}_0x2af959[_0xabbb('0x3c')]=qs[_0xabbb('0x3d')](_0x49d093[_0xabbb('0x36')][_0xabbb('0x3d')]);_0x2af959['where']=qs['filters'](_[_0xabbb('0x3e')](_0x49d093[_0xabbb('0x36')],_0x1c8415['filters']),_0x2eb04c);if(_0x49d093[_0xabbb('0x36')][_0xabbb('0x3f')]){_0x2af959[_0xabbb('0x40')]=_[_0xabbb('0x41')](_0x2af959[_0xabbb('0x40')],{'$or':_['map'](_0x2eb04c,function(_0x3a1d90){if(_0x3a1d90[_0xabbb('0x33')]!==_0xabbb('0x42')){var _0x14b305={};_0x14b305[_0x3a1d90['name']]={'$like':'%'+_0x49d093[_0xabbb('0x36')][_0xabbb('0x3f')]+'%'};return _0x14b305;}})});}_0x2af959=_[_0xabbb('0x41')]({},_0x2af959,_0x49d093[_0xabbb('0x43')]);var _0x55092a={'where':_0x2af959[_0xabbb('0x40')]};return db[_0xabbb('0x30')][_0xabbb('0x23')](_0x55092a)[_0xabbb('0x2a')](function(_0x5f89b8){_0x585960['count']=_0x5f89b8;if(_0x49d093[_0xabbb('0x36')][_0xabbb('0x44')]){_0x2af959['include']=[{'all':!![]}];}return db[_0xabbb('0x30')][_0xabbb('0x45')](_0x2af959);})['then'](function(_0x470d09){_0x585960[_0xabbb('0x46')]=_0x470d09;return _0x585960;})[_0xabbb('0x2a')](respondWithFilteredResult(_0x371661,_0x2af959))[_0xabbb('0x47')](handleError(_0x371661,null));};exports['show']=function(_0x103c4e,_0x2ba581){var _0x31ddd9={'raw':!![],'where':{'id':_0x103c4e[_0xabbb('0x48')]['id']}},_0x3e6a79={};_0x3e6a79[_0xabbb('0x34')]=_[_0xabbb('0x35')](db[_0xabbb('0x30')][_0xabbb('0x31')]);_0x3e6a79[_0xabbb('0x36')]=_[_0xabbb('0x35')](_0x103c4e[_0xabbb('0x36')]);_0x3e6a79['filters']=_[_0xabbb('0x37')](_0x3e6a79[_0xabbb('0x34')],_0x3e6a79[_0xabbb('0x36')]);_0x31ddd9[_0xabbb('0x38')]=_['intersection'](_0x3e6a79[_0xabbb('0x34')],qs['fields'](_0x103c4e[_0xabbb('0x36')]['fields']));_0x31ddd9['attributes']=_0x31ddd9[_0xabbb('0x38')][_0xabbb('0x39')]?_0x31ddd9[_0xabbb('0x38')]:_0x3e6a79['model'];if(_0x103c4e['query'][_0xabbb('0x44')]){_0x31ddd9[_0xabbb('0x49')]=[{'all':!![]}];}_0x31ddd9=_['merge']({},_0x31ddd9,_0x103c4e[_0xabbb('0x43')]);return db['ChatGroup'][_0xabbb('0x4a')](_0x31ddd9)[_0xabbb('0x2a')](handleEntityNotFound(_0x2ba581,null))[_0xabbb('0x2a')](respondWithResult(_0x2ba581,null))['catch'](handleError(_0x2ba581,null));};exports[_0xabbb('0x4b')]=function(_0x250e64,_0x2b6c01){return db[_0xabbb('0x30')][_0xabbb('0x4b')](_0x250e64['body'],{})[_0xabbb('0x2a')](respondWithResult(_0x2b6c01,0xc9))[_0xabbb('0x47')](handleError(_0x2b6c01,null));};exports[_0xabbb('0x28')]=function(_0x3cf782,_0x507597){if(_0x3cf782[_0xabbb('0x4c')]['id']){delete _0x3cf782['body']['id'];}return db[_0xabbb('0x30')][_0xabbb('0x4a')]({'where':{'id':_0x3cf782['params']['id']}})[_0xabbb('0x2a')](handleEntityNotFound(_0x507597,null))[_0xabbb('0x2a')](saveUpdates(_0x3cf782[_0xabbb('0x4c')],null))[_0xabbb('0x2a')](respondWithResult(_0x507597,null))[_0xabbb('0x47')](handleError(_0x507597,null));};exports[_0xabbb('0x29')]=function(_0x2a25f3,_0x273e6e){return db[_0xabbb('0x30')][_0xabbb('0x4a')]({'where':{'id':_0x2a25f3[_0xabbb('0x48')]['id']}})[_0xabbb('0x2a')](handleEntityNotFound(_0x273e6e,null))[_0xabbb('0x2a')](removeEntity(_0x273e6e,null))[_0xabbb('0x47')](handleError(_0x273e6e,null));};exports[_0xabbb('0x4d')]=function(_0x5e04bd,_0x120304){return db[_0xabbb('0x30')]['describe']()[_0xabbb('0x2a')](respondWithResult(_0x120304,null))['catch'](handleError(_0x120304,null));};exports['getUnread']=function(_0x557955,_0x1f3f74,_0x1ff3b1){return db[_0xabbb('0x4e')]['count']({'where':{'ChatGroupId':_0x557955['params']['id'],'ToId':_0x557955[_0xabbb('0x4f')]['id'],'read':![]}})[_0xabbb('0x2a')](function(_0x23eee8){return{'id':_['toInteger'](_0x557955['params']['id']),'count':_0x23eee8};})[_0xabbb('0x2a')](respondWithResult(_0x1f3f74,null))['catch'](handleError(_0x1f3f74,null));};exports[_0xabbb('0x50')]=function(_0x849d91,_0x3d6b36,_0x560765){return db['ChatGroup'][_0xabbb('0x4a')]({'where':{'id':_0x849d91[_0xabbb('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d6b36,null))[_0xabbb('0x2a')](function(_0x4b4e64){if(_0x4b4e64){return _0x4b4e64['addMembers'](_0x849d91[_0xabbb('0x4c')][_0xabbb('0x51')],_['omit'](_0x849d91['body'],[_0xabbb('0x51'),'id'])||{});}})[_0xabbb('0x2a')](respondWithResult(_0x3d6b36,null))[_0xabbb('0x47')](handleError(_0x3d6b36,null));};exports[_0xabbb('0x52')]=function(_0x586ba9,_0x5153c0,_0xbac6ea){var _0x48b6ff={};var _0x259fbb={};var _0x12680c;var _0x20ec39;return db[_0xabbb('0x30')]['findOne']({'where':{'id':_0x586ba9[_0xabbb('0x48')]['id']}})['then'](handleEntityNotFound(_0x5153c0,null))['then'](function(_0x260878){if(_0x260878){_0x12680c=_0x260878;_0x259fbb[_0xabbb('0x34')]=_[_0xabbb('0x35')](db[_0xabbb('0x53')]['rawAttributes']);_0x259fbb['query']=_[_0xabbb('0x35')](_0x586ba9[_0xabbb('0x36')]);_0x259fbb['filters']=_[_0xabbb('0x37')](_0x259fbb[_0xabbb('0x34')],_0x259fbb[_0xabbb('0x36')]);_0x48b6ff[_0xabbb('0x38')]=_[_0xabbb('0x37')](_0x259fbb[_0xabbb('0x34')],qs[_0xabbb('0x54')](_0x586ba9[_0xabbb('0x36')][_0xabbb('0x54')]));_0x48b6ff[_0xabbb('0x38')]=_0x48b6ff['attributes']['length']?_0x48b6ff[_0xabbb('0x38')]:_0x259fbb[_0xabbb('0x34')];_0x48b6ff[_0xabbb('0x3c')]=qs[_0xabbb('0x3d')](_0x586ba9[_0xabbb('0x36')][_0xabbb('0x3d')]);_0x48b6ff[_0xabbb('0x40')]=qs['filters'](_[_0xabbb('0x3e')](_0x586ba9['query'],_0x259fbb[_0xabbb('0x55')]));if(_0x586ba9[_0xabbb('0x36')]['filter']){_0x48b6ff['where']=_['merge'](_0x48b6ff[_0xabbb('0x40')],{'$or':_[_0xabbb('0x2f')](_0x48b6ff[_0xabbb('0x38')],function(_0xca1f3e){var _0x3be164={};_0x3be164[_0xca1f3e]={'$like':'%'+_0x586ba9[_0xabbb('0x36')][_0xabbb('0x3f')]+'%'};return _0x3be164;})});}_0x48b6ff=_[_0xabbb('0x41')]({},_0x48b6ff,_0x586ba9[_0xabbb('0x43')]);return _0x12680c[_0xabbb('0x52')](_0x48b6ff);}})['then'](function(_0x5ad26e){if(_0x5ad26e){_0x20ec39=_0x5ad26e['length'];if(!_0x586ba9[_0xabbb('0x36')][_0xabbb('0x56')](_0xabbb('0x3a'))){_0x48b6ff[_0xabbb('0x3b')]=qs['limit'](_0x586ba9[_0xabbb('0x36')]['limit']);_0x48b6ff['offset']=qs[_0xabbb('0x21')](_0x586ba9[_0xabbb('0x36')]['offset']);}return _0x12680c[_0xabbb('0x52')](_0x48b6ff);}})[_0xabbb('0x2a')](function(_0x73a072){if(_0x73a072){return _0x73a072?{'count':_0x20ec39,'rows':_0x73a072}:null;}})[_0xabbb('0x2a')](respondWithResult(_0x5153c0,null))[_0xabbb('0x47')](handleError(_0x5153c0,null));};exports[_0xabbb('0x57')]=function(_0x31afbb,_0x1f7dca,_0x3809f3){return db['ChatGroup']['find']({'where':{'id':_0x31afbb[_0xabbb('0x48')]['id']}})[_0xabbb('0x2a')](handleEntityNotFound(_0x1f7dca,null))[_0xabbb('0x2a')](function(_0x237f07){if(_0x237f07){return _0x237f07['removeMembers'](_0x31afbb[_0xabbb('0x36')]['ids']);}})[_0xabbb('0x2a')](respondWithStatusCode(_0x1f7dca,null))[_0xabbb('0x47')](handleError(_0x1f7dca,null));};exports[_0xabbb('0x58')]=function(_0x1be6a2,_0xe01aa7,_0x5b02d5){if(_0x1be6a2['body']['id']){delete _0x1be6a2[_0xabbb('0x4c')]['id'];}return db[_0xabbb('0x30')][_0xabbb('0x4a')]({'where':{'id':_0x1be6a2[_0xabbb('0x48')]['id']}})[_0xabbb('0x2a')](handleEntityNotFound(_0xe01aa7,null))['then'](function(_0x45839c){if(_0x45839c){_0x1be6a2[_0xabbb('0x4c')]['ChatGroupId']=_0x45839c['id'];return db[_0xabbb('0x4e')][_0xabbb('0x4b')](_0x1be6a2[_0xabbb('0x4c')]);}})[_0xabbb('0x2a')](respondWithResult(_0xe01aa7,null))['catch'](handleError(_0xe01aa7,null));};exports[_0xabbb('0x59')]=function(_0x6de080,_0x2a5723,_0x6fc117){var _0x65cc0e={};var _0x3fe720={};var _0x8e598f;var _0x47cb86;return db['ChatGroup'][_0xabbb('0x5a')]({'where':{'id':_0x6de080[_0xabbb('0x48')]['id']}})[_0xabbb('0x2a')](handleEntityNotFound(_0x2a5723,null))[_0xabbb('0x2a')](function(_0x5d9f6c){if(_0x5d9f6c){_0x8e598f=_0x5d9f6c;_0x3fe720[_0xabbb('0x34')]=_['keys'](db[_0xabbb('0x4e')]['rawAttributes']);_0x3fe720[_0xabbb('0x36')]=_['keys'](_0x6de080['query']);_0x3fe720[_0xabbb('0x55')]=_['intersection'](_0x3fe720[_0xabbb('0x34')],_0x3fe720[_0xabbb('0x36')]);_0x65cc0e[_0xabbb('0x38')]=_['intersection'](_0x3fe720[_0xabbb('0x34')],qs[_0xabbb('0x54')](_0x6de080['query'][_0xabbb('0x54')]));_0x65cc0e[_0xabbb('0x38')]=_0x65cc0e[_0xabbb('0x38')][_0xabbb('0x39')]?_0x65cc0e[_0xabbb('0x38')]:_0x3fe720[_0xabbb('0x34')];_0x65cc0e[_0xabbb('0x3c')]=qs[_0xabbb('0x3d')](_0x6de080[_0xabbb('0x36')][_0xabbb('0x3d')]);_0x65cc0e[_0xabbb('0x40')]=qs[_0xabbb('0x55')](_['pick'](_0x6de080[_0xabbb('0x36')],_0x3fe720[_0xabbb('0x55')]));if(_0x6de080[_0xabbb('0x36')][_0xabbb('0x3f')]){_0x65cc0e[_0xabbb('0x40')]=_[_0xabbb('0x41')](_0x65cc0e[_0xabbb('0x40')],{'$or':_['map'](_0x65cc0e[_0xabbb('0x38')],function(_0x1499d6){var _0x36235a={};_0x36235a[_0x1499d6]={'$like':'%'+_0x6de080[_0xabbb('0x36')][_0xabbb('0x3f')]+'%'};return _0x36235a;})});}if(_0x6de080[_0xabbb('0x36')][_0xabbb('0x5b')]){var _0x4c4dd9=_0x6de080[_0xabbb('0x36')][_0xabbb('0x5b')][_0xabbb('0x5c')](',');var _0x35362e={};_0x35362e[_0x4c4dd9[0x0]]={'$gte':moment(_0x4c4dd9[0x1])['format'](_0xabbb('0x5d'))};_0x65cc0e[_0xabbb('0x40')]=_['merge'](_0x65cc0e[_0xabbb('0x40')],_0x35362e);}_0x65cc0e=_[_0xabbb('0x41')]({},_0x65cc0e,_0x6de080[_0xabbb('0x43')]);return _0x8e598f[_0xabbb('0x59')](_0x65cc0e);}})[_0xabbb('0x2a')](function(_0x43a47b){if(_0x43a47b){_0x47cb86=_0x43a47b[_0xabbb('0x39')];if(!_0x6de080[_0xabbb('0x36')][_0xabbb('0x56')](_0xabbb('0x3a'))){_0x65cc0e[_0xabbb('0x3b')]=qs[_0xabbb('0x3b')](_0x6de080[_0xabbb('0x36')][_0xabbb('0x3b')]);_0x65cc0e[_0xabbb('0x21')]=qs[_0xabbb('0x21')](_0x6de080[_0xabbb('0x36')][_0xabbb('0x21')]);}return _0x8e598f[_0xabbb('0x59')](_0x65cc0e);}})['then'](function(_0x1b339e){if(_0x1b339e){return _0x1b339e?{'count':_0x47cb86,'rows':_0x1b339e}:null;}})[_0xabbb('0x2a')](respondWithResult(_0x2a5723,null))[_0xabbb('0x47')](handleError(_0x2a5723,null));}; \ No newline at end of file +var _0x204a=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x204a,0x100));var _0xa204=function(_0x39364f,_0x16a94d){_0x39364f=_0x39364f-0x0;var _0x2725c8=_0x204a[_0x39364f];return _0x2725c8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa204('0x0'));var jsonpatch=require(_0xa204('0x1'));var rp=require(_0xa204('0x2'));var moment=require(_0xa204('0x3'));var BPromise=require(_0xa204('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa204('0x5'));var csv=require(_0xa204('0x6'));var ejs=require(_0xa204('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa204('0x8'));var squel=require(_0xa204('0x9'));var crypto=require(_0xa204('0xa'));var jsforce=require(_0xa204('0xb'));var deskjs=require(_0xa204('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa204('0xd'));var Redis=require(_0xa204('0xe'));var authService=require(_0xa204('0xf'));var qs=require(_0xa204('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa204('0x11'));var logger=require(_0xa204('0x12'))('api');var utils=require(_0xa204('0x13'));var config=require(_0xa204('0x14'));var licenseUtil=require(_0xa204('0x15'));var db=require('../../mysqldb')['db'];config[_0xa204('0x16')]=_[_0xa204('0x17')](config[_0xa204('0x16')],{'host':_0xa204('0x18'),'port':0x18eb});var socket=require(_0xa204('0x19'))(new Redis(config[_0xa204('0x16')]));require(_0xa204('0x1a'))['register'](socket);function respondWithStatusCode(_0x1bd94,_0x1e00d4){_0x1e00d4=_0x1e00d4||0xcc;return function(_0x28a03b){if(_0x28a03b){return _0x1bd94[_0xa204('0x1b')](_0x1e00d4);}return _0x1bd94[_0xa204('0x1c')](_0x1e00d4)[_0xa204('0x1d')]();};}function respondWithResult(_0x242a6a,_0x5da322){_0x5da322=_0x5da322||0xc8;return function(_0x1fe92d){if(_0x1fe92d){return _0x242a6a['status'](_0x5da322)[_0xa204('0x1e')](_0x1fe92d);}};}function respondWithFilteredResult(_0x9afb4f,_0x5ac79b){return function(_0x145bd9){if(_0x145bd9){var _0x3126db=typeof _0x5ac79b[_0xa204('0x1f')]===_0xa204('0x20')&&typeof _0x5ac79b[_0xa204('0x21')]===_0xa204('0x20');var _0x2625d3=_0x145bd9[_0xa204('0x22')];var _0x4cb6b1=_0x3126db?0x0:_0x5ac79b[_0xa204('0x1f')];var _0x280cc6=_0x3126db?_0x145bd9[_0xa204('0x22')]:_0x5ac79b[_0xa204('0x1f')]+_0x5ac79b[_0xa204('0x21')];var _0xf10f9c;if(_0x280cc6>=_0x2625d3){_0x280cc6=_0x2625d3;_0xf10f9c=0xc8;}else{_0xf10f9c=0xce;}_0x9afb4f[_0xa204('0x1c')](_0xf10f9c);return _0x9afb4f[_0xa204('0x23')](_0xa204('0x24'),_0x4cb6b1+'-'+_0x280cc6+'/'+_0x2625d3)['json'](_0x145bd9);}return null;};}function patchUpdates(_0x265402){return function(_0x3e75d9){try{jsonpatch[_0xa204('0x25')](_0x3e75d9,_0x265402,!![]);}catch(_0x51d5f7){return BPromise[_0xa204('0x26')](_0x51d5f7);}return _0x3e75d9[_0xa204('0x27')]();};}function saveUpdates(_0x5f1d65,_0x561800){return function(_0x417473){if(_0x417473){return _0x417473[_0xa204('0x28')](_0x5f1d65)[_0xa204('0x29')](function(_0x2e5ed3){return _0x2e5ed3;});}return null;};}function removeEntity(_0x4eea6c,_0x37daf6){return function(_0x459310){if(_0x459310){return _0x459310[_0xa204('0x2a')]()[_0xa204('0x29')](function(){_0x4eea6c[_0xa204('0x1c')](0xcc)[_0xa204('0x1d')]();});}};}function handleEntityNotFound(_0x2ced45,_0x122a39){return function(_0x4ac3ac){if(!_0x4ac3ac){_0x2ced45[_0xa204('0x1b')](0x194);}return _0x4ac3ac;};}function handleError(_0x9b4d9f,_0x5dd31b){_0x5dd31b=_0x5dd31b||0x1f4;return function(_0x4f764a){logger[_0xa204('0x2b')](_0x4f764a[_0xa204('0x2c')]);if(_0x4f764a['name']){delete _0x4f764a['name'];}_0x9b4d9f[_0xa204('0x1c')](_0x5dd31b)[_0xa204('0x2d')](_0x4f764a);};}exports['index']=function(_0x5b712c,_0x6c7b5e){var _0x20a775={},_0x4c0f98={},_0x48e8c7={'count':0x0,'rows':[]};var _0x54dc2f=_[_0xa204('0x2e')](db[_0xa204('0x2f')][_0xa204('0x30')],function(_0x463acd){return{'name':_0x463acd[_0xa204('0x31')],'type':_0x463acd[_0xa204('0x32')][_0xa204('0x33')]};});_0x4c0f98[_0xa204('0x34')]=_[_0xa204('0x2e')](_0x54dc2f,_0xa204('0x35'));_0x4c0f98[_0xa204('0x36')]=_[_0xa204('0x37')](_0x5b712c['query']);_0x4c0f98[_0xa204('0x38')]=_['intersection'](_0x4c0f98[_0xa204('0x34')],_0x4c0f98['query']);_0x20a775[_0xa204('0x39')]=_[_0xa204('0x3a')](_0x4c0f98[_0xa204('0x34')],qs[_0xa204('0x3b')](_0x5b712c[_0xa204('0x36')]['fields']));_0x20a775[_0xa204('0x39')]=_0x20a775[_0xa204('0x39')][_0xa204('0x3c')]?_0x20a775[_0xa204('0x39')]:_0x4c0f98['model'];if(!_0x5b712c[_0xa204('0x36')][_0xa204('0x3d')](_0xa204('0x3e'))){_0x20a775[_0xa204('0x21')]=qs[_0xa204('0x21')](_0x5b712c[_0xa204('0x36')]['limit']);_0x20a775[_0xa204('0x1f')]=qs[_0xa204('0x1f')](_0x5b712c[_0xa204('0x36')]['offset']);}_0x20a775[_0xa204('0x3f')]=qs[_0xa204('0x40')](_0x5b712c['query'][_0xa204('0x40')]);_0x20a775[_0xa204('0x41')]=qs[_0xa204('0x38')](_[_0xa204('0x42')](_0x5b712c[_0xa204('0x36')],_0x4c0f98[_0xa204('0x38')]),_0x54dc2f);if(_0x5b712c[_0xa204('0x36')][_0xa204('0x43')]){_0x20a775[_0xa204('0x41')]=_['merge'](_0x20a775[_0xa204('0x41')],{'$or':_[_0xa204('0x2e')](_0x54dc2f,function(_0x211d65){if(_0x211d65[_0xa204('0x32')]!==_0xa204('0x44')){var _0x469b4f={};_0x469b4f[_0x211d65[_0xa204('0x35')]]={'$like':'%'+_0x5b712c[_0xa204('0x36')]['filter']+'%'};return _0x469b4f;}})});}_0x20a775=_[_0xa204('0x45')]({},_0x20a775,_0x5b712c[_0xa204('0x46')]);var _0x4e24c1={'where':_0x20a775[_0xa204('0x41')]};return db[_0xa204('0x2f')]['count'](_0x4e24c1)[_0xa204('0x29')](function(_0x2d8d0d){_0x48e8c7[_0xa204('0x22')]=_0x2d8d0d;if(_0x5b712c['query'][_0xa204('0x47')]){_0x20a775[_0xa204('0x48')]=[{'all':!![]}];}return db['ChatGroup'][_0xa204('0x49')](_0x20a775);})[_0xa204('0x29')](function(_0x1f8a85){_0x48e8c7['rows']=_0x1f8a85;return _0x48e8c7;})['then'](respondWithFilteredResult(_0x6c7b5e,_0x20a775))['catch'](handleError(_0x6c7b5e,null));};exports[_0xa204('0x4a')]=function(_0x29765b,_0x268dd5){var _0x11bbcb={'raw':!![],'where':{'id':_0x29765b[_0xa204('0x4b')]['id']}},_0x1f298a={};_0x1f298a['model']=_['keys'](db[_0xa204('0x2f')][_0xa204('0x30')]);_0x1f298a[_0xa204('0x36')]=_['keys'](_0x29765b[_0xa204('0x36')]);_0x1f298a[_0xa204('0x38')]=_[_0xa204('0x3a')](_0x1f298a[_0xa204('0x34')],_0x1f298a[_0xa204('0x36')]);_0x11bbcb[_0xa204('0x39')]=_[_0xa204('0x3a')](_0x1f298a[_0xa204('0x34')],qs[_0xa204('0x3b')](_0x29765b[_0xa204('0x36')][_0xa204('0x3b')]));_0x11bbcb['attributes']=_0x11bbcb[_0xa204('0x39')][_0xa204('0x3c')]?_0x11bbcb[_0xa204('0x39')]:_0x1f298a[_0xa204('0x34')];if(_0x29765b['query']['includeAll']){_0x11bbcb['include']=[{'all':!![]}];}_0x11bbcb=_['merge']({},_0x11bbcb,_0x29765b[_0xa204('0x46')]);return db[_0xa204('0x2f')][_0xa204('0x4c')](_0x11bbcb)[_0xa204('0x29')](handleEntityNotFound(_0x268dd5,null))[_0xa204('0x29')](respondWithResult(_0x268dd5,null))[_0xa204('0x4d')](handleError(_0x268dd5,null));};exports[_0xa204('0x4e')]=function(_0xb1a3a0,_0x3f258a){return db['ChatGroup']['create'](_0xb1a3a0[_0xa204('0x4f')],{})[_0xa204('0x29')](respondWithResult(_0x3f258a,0xc9))[_0xa204('0x4d')](handleError(_0x3f258a,null));};exports[_0xa204('0x28')]=function(_0x165c5f,_0x3de32c){if(_0x165c5f[_0xa204('0x4f')]['id']){delete _0x165c5f['body']['id'];}return db[_0xa204('0x2f')]['find']({'where':{'id':_0x165c5f[_0xa204('0x4b')]['id']}})[_0xa204('0x29')](handleEntityNotFound(_0x3de32c,null))[_0xa204('0x29')](saveUpdates(_0x165c5f[_0xa204('0x4f')],null))[_0xa204('0x29')](respondWithResult(_0x3de32c,null))[_0xa204('0x4d')](handleError(_0x3de32c,null));};exports['destroy']=function(_0x5c2219,_0x28707f){return db[_0xa204('0x2f')]['find']({'where':{'id':_0x5c2219['params']['id']}})[_0xa204('0x29')](handleEntityNotFound(_0x28707f,null))['then'](removeEntity(_0x28707f,null))['catch'](handleError(_0x28707f,null));};exports[_0xa204('0x50')]=function(_0x1af238,_0x5d68fd){return db['ChatGroup'][_0xa204('0x50')]()['then'](respondWithResult(_0x5d68fd,null))[_0xa204('0x4d')](handleError(_0x5d68fd,null));};exports[_0xa204('0x51')]=function(_0x4b9d7a,_0x373367,_0xff10a8){return db[_0xa204('0x52')][_0xa204('0x22')]({'where':{'ChatGroupId':_0x4b9d7a['params']['id'],'ToId':_0x4b9d7a['user']['id'],'read':![]}})[_0xa204('0x29')](function(_0x2dafd5){return{'id':_[_0xa204('0x53')](_0x4b9d7a[_0xa204('0x4b')]['id']),'count':_0x2dafd5};})['then'](respondWithResult(_0x373367,null))[_0xa204('0x4d')](handleError(_0x373367,null));};exports[_0xa204('0x54')]=function(_0x683796,_0x243c5b,_0x4a70a4){return db[_0xa204('0x2f')]['find']({'where':{'id':_0x683796[_0xa204('0x4b')]['id']}})[_0xa204('0x29')](handleEntityNotFound(_0x243c5b,null))[_0xa204('0x29')](function(_0x18d731){if(_0x18d731){return _0x18d731['addMembers'](_0x683796['body'][_0xa204('0x55')],_[_0xa204('0x56')](_0x683796[_0xa204('0x4f')],[_0xa204('0x55'),'id'])||{});}})[_0xa204('0x29')](respondWithResult(_0x243c5b,null))[_0xa204('0x4d')](handleError(_0x243c5b,null));};exports[_0xa204('0x57')]=function(_0x3dd42c,_0x4142b6,_0x543bb0){var _0x236e48={};var _0x4cb59a={};var _0x533d76;var _0x2d44ee;return db[_0xa204('0x2f')][_0xa204('0x58')]({'where':{'id':_0x3dd42c[_0xa204('0x4b')]['id']}})[_0xa204('0x29')](handleEntityNotFound(_0x4142b6,null))['then'](function(_0x45a6a2){if(_0x45a6a2){_0x533d76=_0x45a6a2;_0x4cb59a[_0xa204('0x34')]=_[_0xa204('0x37')](db[_0xa204('0x59')][_0xa204('0x30')]);_0x4cb59a[_0xa204('0x36')]=_[_0xa204('0x37')](_0x3dd42c[_0xa204('0x36')]);_0x4cb59a[_0xa204('0x38')]=_[_0xa204('0x3a')](_0x4cb59a[_0xa204('0x34')],_0x4cb59a[_0xa204('0x36')]);_0x236e48[_0xa204('0x39')]=_[_0xa204('0x3a')](_0x4cb59a[_0xa204('0x34')],qs[_0xa204('0x3b')](_0x3dd42c[_0xa204('0x36')][_0xa204('0x3b')]));_0x236e48[_0xa204('0x39')]=_0x236e48[_0xa204('0x39')][_0xa204('0x3c')]?_0x236e48[_0xa204('0x39')]:_0x4cb59a[_0xa204('0x34')];_0x236e48[_0xa204('0x3f')]=qs[_0xa204('0x40')](_0x3dd42c[_0xa204('0x36')][_0xa204('0x40')]);_0x236e48['where']=qs[_0xa204('0x38')](_['pick'](_0x3dd42c['query'],_0x4cb59a['filters']));if(_0x3dd42c[_0xa204('0x36')][_0xa204('0x43')]){_0x236e48['where']=_[_0xa204('0x45')](_0x236e48[_0xa204('0x41')],{'$or':_[_0xa204('0x2e')](_0x236e48[_0xa204('0x39')],function(_0xa27ddb){var _0x504621={};_0x504621[_0xa27ddb]={'$like':'%'+_0x3dd42c['query'][_0xa204('0x43')]+'%'};return _0x504621;})});}_0x236e48=_['merge']({},_0x236e48,_0x3dd42c[_0xa204('0x46')]);return _0x533d76[_0xa204('0x57')](_0x236e48);}})[_0xa204('0x29')](function(_0x24565a){if(_0x24565a){_0x2d44ee=_0x24565a[_0xa204('0x3c')];if(!_0x3dd42c[_0xa204('0x36')][_0xa204('0x3d')](_0xa204('0x3e'))){_0x236e48['limit']=qs[_0xa204('0x21')](_0x3dd42c['query'][_0xa204('0x21')]);_0x236e48[_0xa204('0x1f')]=qs[_0xa204('0x1f')](_0x3dd42c[_0xa204('0x36')][_0xa204('0x1f')]);}return _0x533d76[_0xa204('0x57')](_0x236e48);}})[_0xa204('0x29')](function(_0x55192e){if(_0x55192e){return _0x55192e?{'count':_0x2d44ee,'rows':_0x55192e}:null;}})[_0xa204('0x29')](respondWithResult(_0x4142b6,null))[_0xa204('0x4d')](handleError(_0x4142b6,null));};exports[_0xa204('0x5a')]=function(_0x31fa06,_0x381c24,_0x8bd0f7){return db['ChatGroup']['find']({'where':{'id':_0x31fa06['params']['id']}})[_0xa204('0x29')](handleEntityNotFound(_0x381c24,null))[_0xa204('0x29')](function(_0x2adc1b){if(_0x2adc1b){return _0x2adc1b[_0xa204('0x5a')](_0x31fa06[_0xa204('0x36')]['ids']);}})[_0xa204('0x29')](respondWithStatusCode(_0x381c24,null))['catch'](handleError(_0x381c24,null));};exports[_0xa204('0x5b')]=function(_0xfc4ba1,_0x56b858,_0x4b93e2){if(_0xfc4ba1['body']['id']){delete _0xfc4ba1[_0xa204('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0xfc4ba1[_0xa204('0x4b')]['id']}})[_0xa204('0x29')](handleEntityNotFound(_0x56b858,null))[_0xa204('0x29')](function(_0x30a933){if(_0x30a933){_0xfc4ba1['body'][_0xa204('0x5c')]=_0x30a933['id'];return db[_0xa204('0x52')][_0xa204('0x4e')](_0xfc4ba1['body']);}})['then'](respondWithResult(_0x56b858,null))[_0xa204('0x4d')](handleError(_0x56b858,null));};exports[_0xa204('0x5d')]=function(_0x3d3a03,_0x4fa12f,_0x211edd){var _0x3dae31={};var _0x3a0e92={};var _0xa8b1bc;var _0x186f90;return db[_0xa204('0x2f')]['findOne']({'where':{'id':_0x3d3a03[_0xa204('0x4b')]['id']}})[_0xa204('0x29')](handleEntityNotFound(_0x4fa12f,null))['then'](function(_0x3a9292){if(_0x3a9292){_0xa8b1bc=_0x3a9292;_0x3a0e92[_0xa204('0x34')]=_[_0xa204('0x37')](db[_0xa204('0x52')][_0xa204('0x30')]);_0x3a0e92[_0xa204('0x36')]=_[_0xa204('0x37')](_0x3d3a03[_0xa204('0x36')]);_0x3a0e92[_0xa204('0x38')]=_[_0xa204('0x3a')](_0x3a0e92[_0xa204('0x34')],_0x3a0e92[_0xa204('0x36')]);_0x3dae31[_0xa204('0x39')]=_[_0xa204('0x3a')](_0x3a0e92[_0xa204('0x34')],qs['fields'](_0x3d3a03['query'][_0xa204('0x3b')]));_0x3dae31[_0xa204('0x39')]=_0x3dae31[_0xa204('0x39')]['length']?_0x3dae31[_0xa204('0x39')]:_0x3a0e92['model'];_0x3dae31[_0xa204('0x3f')]=qs[_0xa204('0x40')](_0x3d3a03[_0xa204('0x36')]['sort']);_0x3dae31[_0xa204('0x41')]=qs[_0xa204('0x38')](_[_0xa204('0x42')](_0x3d3a03['query'],_0x3a0e92['filters']));if(_0x3d3a03['query']['filter']){_0x3dae31['where']=_['merge'](_0x3dae31[_0xa204('0x41')],{'$or':_[_0xa204('0x2e')](_0x3dae31['attributes'],function(_0x1a3668){var _0x324ca7={};_0x324ca7[_0x1a3668]={'$like':'%'+_0x3d3a03[_0xa204('0x36')]['filter']+'%'};return _0x324ca7;})});}if(_0x3d3a03[_0xa204('0x36')][_0xa204('0x5e')]){var _0x2b9bc8=_0x3d3a03[_0xa204('0x36')][_0xa204('0x5e')]['split'](',');var _0x39ce1b={};_0x39ce1b[_0x2b9bc8[0x0]]={'$gte':moment(_0x2b9bc8[0x1])[_0xa204('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3dae31[_0xa204('0x41')]=_[_0xa204('0x45')](_0x3dae31['where'],_0x39ce1b);}_0x3dae31=_['merge']({},_0x3dae31,_0x3d3a03[_0xa204('0x46')]);return _0xa8b1bc['getMessages'](_0x3dae31);}})[_0xa204('0x29')](function(_0x204874){if(_0x204874){_0x186f90=_0x204874[_0xa204('0x3c')];if(!_0x3d3a03[_0xa204('0x36')][_0xa204('0x3d')]('nolimit')){_0x3dae31['limit']=qs[_0xa204('0x21')](_0x3d3a03[_0xa204('0x36')][_0xa204('0x21')]);_0x3dae31[_0xa204('0x1f')]=qs[_0xa204('0x1f')](_0x3d3a03[_0xa204('0x36')]['offset']);}return _0xa8b1bc['getMessages'](_0x3dae31);}})['then'](function(_0x22a143){if(_0x22a143){return _0x22a143?{'count':_0x186f90,'rows':_0x22a143}:null;}})[_0xa204('0x29')](respondWithResult(_0x4fa12f,null))[_0xa204('0x4d')](handleError(_0x4fa12f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 8b17a4c..e7c12d4 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 _0xef96=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef96,0x162));var _0x6ef9=function(_0x208b03,_0x82774f){_0x208b03=_0x208b03-0x0;var _0x332d98=_0xef96[_0x208b03];return _0x332d98;};'use strict';var EventEmitter=require(_0x6ef9('0x0'));var ChatGroup=require(_0x6ef9('0x1'))['db'][_0x6ef9('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6ef9('0x3')](0x0);var events={'afterCreate':_0x6ef9('0x4'),'afterUpdate':_0x6ef9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x55b811){return function(_0x1eb2c2,_0x5391ed,_0x500b0c){ChatGroupEvents[_0x6ef9('0x6')](_0x55b811+':'+_0x1eb2c2['id'],_0x1eb2c2);ChatGroupEvents[_0x6ef9('0x6')](_0x55b811,_0x1eb2c2);_0x500b0c(null);};}for(var e in events){if(events[_0x6ef9('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x6ef9('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xede6=['update','remove','emit','hook','exports','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x4f4ea8,_0x6a0f4c){var _0x573a6c=function(_0x53104d){while(--_0x53104d){_0x4f4ea8['push'](_0x4f4ea8['shift']());}};_0x573a6c(++_0x6a0f4c);}(_0xede6,0x10a));var _0x6ede=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xede6[_0x37c22c];return _0x119d79;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x6ede('0x0'))['db'][_0x6ede('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6ede('0x2')](0x0);var events={'afterCreate':_0x6ede('0x3'),'afterUpdate':_0x6ede('0x4'),'afterDestroy':_0x6ede('0x5')};function emitEvent(_0x147fbe){return function(_0x226cef,_0x306b56,_0x22c6cd){ChatGroupEvents[_0x6ede('0x6')](_0x147fbe+':'+_0x226cef['id'],_0x226cef);ChatGroupEvents[_0x6ede('0x6')](_0x147fbe,_0x226cef);_0x22c6cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x6ede('0x7')](e,emitEvent(event));}}module[_0x6ede('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 249619c..645d428 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 _0x8d34=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','chat_groups','lodash'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0x8d34,0x6d));var _0x48d3=function(_0x451353,_0x19710b){_0x451353=_0x451353-0x0;var _0x102315=_0x8d34[_0x451353];return _0x102315;};'use strict';var _=require(_0x48d3('0x0'));var util=require(_0x48d3('0x1'));var logger=require(_0x48d3('0x2'))(_0x48d3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x48d3('0x4'));var fs=require('fs');var path=require(_0x48d3('0x5'));var rimraf=require(_0x48d3('0x6'));var config=require(_0x48d3('0x7'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x1b6607,_0x128537){return _0x1b6607[_0x48d3('0x8')]('ChatGroup',attributes,{'tableName':_0x48d3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3454=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups'];(function(_0x38eb42,_0x46ae11){var _0x44a86f=function(_0x42c1d5){while(--_0x42c1d5){_0x38eb42['push'](_0x38eb42['shift']());}};_0x44a86f(++_0x46ae11);}(_0x3454,0x144));var _0x4345=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3454[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x4345('0x0'));var logger=require(_0x4345('0x1'))(_0x4345('0x2'));var moment=require('moment');var BPromise=require(_0x4345('0x3'));var rp=require(_0x4345('0x4'));var fs=require('fs');var path=require(_0x4345('0x5'));var rimraf=require(_0x4345('0x6'));var config=require(_0x4345('0x7'));var attributes=require(_0x4345('0x8'));module[_0x4345('0x9')]=function(_0x1d091a,_0x9e3be7){return _0x1d091a[_0x4345('0xa')]('ChatGroup',attributes,{'tableName':_0x4345('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 2e29ddf..e540d0f 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 _0x31e7=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info'];(function(_0x9ceba5,_0x303b5a){var _0x4c4071=function(_0x47739a){while(--_0x47739a){_0x9ceba5['push'](_0x9ceba5['shift']());}};_0x4c4071(++_0x303b5a);}(_0x31e7,0x74));var _0x731e=function(_0x409f0c,_0x14ca22){_0x409f0c=_0x409f0c-0x0;var _0x20fc6d=_0x31e7[_0x409f0c];return _0x20fc6d;};'use strict';var _=require('lodash');var util=require(_0x731e('0x0'));var moment=require('moment');var BPromise=require(_0x731e('0x1'));var rs=require(_0x731e('0x2'));var fs=require('fs');var Redis=require(_0x731e('0x3'));var db=require(_0x731e('0x4'))['db'];var utils=require(_0x731e('0x5'));var logger=require(_0x731e('0x6'))(_0x731e('0x7'));var config=require(_0x731e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x731e('0x9')]['http']({'port':0x232a});config['redis']=_[_0x731e('0xa')](config[_0x731e('0xb')],{'host':_0x731e('0xc'),'port':0x18eb});var socket=require(_0x731e('0xd'))(new Redis(config[_0x731e('0xb')]));require(_0x731e('0xe'))[_0x731e('0xf')](socket);function respondWithRpcPromise(_0x5ed856,_0x56896a,_0x4e5784){return new BPromise(function(_0x3b4e6f,_0x1966c9){return client[_0x731e('0x10')](_0x5ed856,_0x4e5784)[_0x731e('0x11')](function(_0x2db10e){logger[_0x731e('0x12')](_0x731e('0x13'),_0x56896a,_0x731e('0x14'));logger[_0x731e('0x15')](_0x731e('0x16'),_0x56896a,_0x731e('0x14'),JSON['stringify'](_0x2db10e));if(_0x2db10e[_0x731e('0x17')]){if(_0x2db10e[_0x731e('0x17')]['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x56896a,_0x2db10e[_0x731e('0x17')][_0x731e('0x18')]);return _0x1966c9(_0x2db10e[_0x731e('0x17')][_0x731e('0x18')]);}logger[_0x731e('0x17')](_0x731e('0x13'),_0x56896a,_0x2db10e[_0x731e('0x17')][_0x731e('0x18')]);return _0x3b4e6f(_0x2db10e['error'][_0x731e('0x18')]);}else{logger[_0x731e('0x12')](_0x731e('0x13'),_0x56896a,'request\x20sent');_0x3b4e6f(_0x2db10e[_0x731e('0x19')]['message']);}})[_0x731e('0x1a')](function(_0x1a3ab9){logger['error'](_0x731e('0x13'),_0x56896a,_0x1a3ab9);_0x1966c9(_0x1a3ab9);});});} \ No newline at end of file +var _0xac5c=['register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket'];(function(_0xff855,_0x2dc5e2){var _0x4a7d45=function(_0xf207a0){while(--_0xf207a0){_0xff855['push'](_0xff855['shift']());}};_0x4a7d45(++_0x2dc5e2);}(_0xac5c,0x10f));var _0xcac5=function(_0x1c95e2,_0x75edfa){_0x1c95e2=_0x1c95e2-0x0;var _0x50cb45=_0xac5c[_0x1c95e2];return _0x50cb45;};'use strict';var _=require(_0xcac5('0x0'));var util=require(_0xcac5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcac5('0x2'));var fs=require('fs');var Redis=require(_0xcac5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcac5('0x4'));var logger=require(_0xcac5('0x5'))(_0xcac5('0x6'));var config=require(_0xcac5('0x7'));var jayson=require(_0xcac5('0x8'));var client=jayson[_0xcac5('0x9')][_0xcac5('0xa')]({'port':0x232a});config['redis']=_[_0xcac5('0xb')](config[_0xcac5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcac5('0xd'))(new Redis(config[_0xcac5('0xc')]));require(_0xcac5('0xe'))[_0xcac5('0xf')](socket);function respondWithRpcPromise(_0x2366e0,_0x4a3746,_0x33ceb1){return new BPromise(function(_0x18f165,_0x43c506){return client[_0xcac5('0x10')](_0x2366e0,_0x33ceb1)[_0xcac5('0x11')](function(_0x58a4c5){logger[_0xcac5('0x12')](_0xcac5('0x13'),_0x4a3746,'request\x20sent');logger[_0xcac5('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4a3746,'request\x20sent',JSON[_0xcac5('0x15')](_0x58a4c5));if(_0x58a4c5[_0xcac5('0x16')]){if(_0x58a4c5[_0xcac5('0x16')][_0xcac5('0x17')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4a3746,_0x58a4c5[_0xcac5('0x16')]['message']);return _0x43c506(_0x58a4c5[_0xcac5('0x16')][_0xcac5('0x18')]);}logger[_0xcac5('0x16')]('ChatGroup,\x20%s,\x20%s',_0x4a3746,_0x58a4c5[_0xcac5('0x16')]['message']);return _0x18f165(_0x58a4c5[_0xcac5('0x16')][_0xcac5('0x18')]);}else{logger[_0xcac5('0x12')]('ChatGroup,\x20%s,\x20%s',_0x4a3746,_0xcac5('0x19'));_0x18f165(_0x58a4c5['result']['message']);}})['catch'](function(_0x37136e){logger[_0xcac5('0x16')](_0xcac5('0x13'),_0x4a3746,_0x37136e);_0x43c506(_0x37136e);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c179b4a..e5176c7 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 _0xb0c7=['length','chatGroup:','./chatGroup.events','save','update','emit','removeListener','register'];(function(_0x5a80a4,_0x654934){var _0x2b311a=function(_0xf8b990){while(--_0xf8b990){_0x5a80a4['push'](_0x5a80a4['shift']());}};_0x2b311a(++_0x654934);}(_0xb0c7,0xca));var _0x7b0c=function(_0x481bdf,_0x231538){_0x481bdf=_0x481bdf-0x0;var _0x281a12=_0xb0c7[_0x481bdf];return _0x281a12;};'use strict';var ChatGroupEvents=require(_0x7b0c('0x0'));var events=[_0x7b0c('0x1'),'remove',_0x7b0c('0x2')];function createListener(_0x302a70,_0x4052e4){return function(_0x151105){_0x4052e4[_0x7b0c('0x3')](_0x302a70,_0x151105);};}function removeListener(_0x1fa30a,_0x349fa5){return function(){ChatGroupEvents[_0x7b0c('0x4')](_0x1fa30a,_0x349fa5);};}exports[_0x7b0c('0x5')]=function(_0x3e8959){for(var _0x2fbd90=0x0,_0x4bb343=events[_0x7b0c('0x6')];_0x2fbd90<_0x4bb343;_0x2fbd90++){var _0x11569e=events[_0x2fbd90];var _0x295842=createListener(_0x7b0c('0x7')+_0x11569e,_0x3e8959);ChatGroupEvents['on'](_0x11569e,_0x295842);}}; \ No newline at end of file +var _0x9c0c=['save','remove','update','emit','removeListener','length','chatGroup:'];(function(_0x14be9e,_0x44e984){var _0x11fd99=function(_0x26cd70){while(--_0x26cd70){_0x14be9e['push'](_0x14be9e['shift']());}};_0x11fd99(++_0x44e984);}(_0x9c0c,0x8c));var _0xc9c0=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x9c0c[_0x54ccd7];return _0x4e667b;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xc9c0('0x0'),_0xc9c0('0x1'),_0xc9c0('0x2')];function createListener(_0x361b75,_0x1ff62e){return function(_0x5998ac){_0x1ff62e[_0xc9c0('0x3')](_0x361b75,_0x5998ac);};}function removeListener(_0x80349,_0xfb0afd){return function(){ChatGroupEvents[_0xc9c0('0x4')](_0x80349,_0xfb0afd);};}exports['register']=function(_0x453a8a){for(var _0x4ea789=0x0,_0x81826d=events[_0xc9c0('0x5')];_0x4ea789<_0x81826d;_0x4ea789++){var _0x3b7c74=events[_0x4ea789];var _0x1a2963=createListener(_0xc9c0('0x6')+_0x3b7c74,_0x453a8a);ChatGroupEvents['on'](_0x3b7c74,_0x1a2963);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 5ea875a..85c18e0 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 _0x63c2=['./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','delete','exports','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x416b32,_0x569f90){var _0x3bf318=function(_0x124310){while(--_0x124310){_0x416b32['push'](_0x416b32['shift']());}};_0x3bf318(++_0x569f90);}(_0x63c2,0xf5));var _0x263c=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x63c2[_0x122096];return _0x3d1966;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x263c('0x0'));var express=require(_0x263c('0x1'));var router=express[_0x263c('0x2')]();var fs_extra=require(_0x263c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x263c('0x4'));var controller=require(_0x263c('0x5'));router[_0x263c('0x6')]('/',auth[_0x263c('0x7')](),controller[_0x263c('0x8')]);router['get'](_0x263c('0x9'),auth['isAuthenticated'](),controller[_0x263c('0xa')]);router[_0x263c('0x6')](_0x263c('0xb'),auth[_0x263c('0x7')](),controller[_0x263c('0xc')]);router['get'](_0x263c('0xd'),auth[_0x263c('0x7')](),controller['getUnread']);router[_0x263c('0x6')](_0x263c('0xe'),auth[_0x263c('0x7')](),controller[_0x263c('0xf')]);router[_0x263c('0x6')](_0x263c('0x10'),auth[_0x263c('0x7')](),controller[_0x263c('0x11')]);router[_0x263c('0x12')]('/',auth[_0x263c('0x7')](),controller[_0x263c('0x13')]);router[_0x263c('0x12')](_0x263c('0xe'),auth['isAuthenticated'](),controller[_0x263c('0x14')]);router[_0x263c('0x12')](_0x263c('0x10'),auth['isAuthenticated'](),controller['addMessage']);router[_0x263c('0x15')](_0x263c('0xb'),auth[_0x263c('0x7')](),controller[_0x263c('0x16')]);router['delete'](_0x263c('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x263c('0x17')](_0x263c('0xe'),auth[_0x263c('0x7')](),controller['removeMembers']);module[_0x263c('0x18')]=router; \ No newline at end of file +var _0x55a4=['describe','/:id','/:id/unread','getUnread','/:id/members','getMessages','post','create','/:id/messages','put','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x2a2f87,_0x24b69f){var _0x652089=function(_0x75e52d){while(--_0x75e52d){_0x2a2f87['push'](_0x2a2f87['shift']());}};_0x652089(++_0x24b69f);}(_0x55a4,0x19d));var _0x455a=function(_0x2ed03b,_0x93378f){_0x2ed03b=_0x2ed03b-0x0;var _0x2646bc=_0x55a4[_0x2ed03b];return _0x2646bc;};'use strict';var multer=require(_0x455a('0x0'));var util=require(_0x455a('0x1'));var path=require(_0x455a('0x2'));var timeout=require(_0x455a('0x3'));var express=require(_0x455a('0x4'));var router=express[_0x455a('0x5')]();var fs_extra=require(_0x455a('0x6'));var auth=require(_0x455a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x455a('0x8'));var controller=require('./chatGroup.controller');router[_0x455a('0x9')]('/',auth[_0x455a('0xa')](),controller['index']);router[_0x455a('0x9')](_0x455a('0xb'),auth['isAuthenticated'](),controller[_0x455a('0xc')]);router['get'](_0x455a('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x455a('0xe'),auth['isAuthenticated'](),controller[_0x455a('0xf')]);router[_0x455a('0x9')](_0x455a('0x10'),auth[_0x455a('0xa')](),controller['getMembers']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x455a('0x11')]);router[_0x455a('0x12')]('/',auth['isAuthenticated'](),controller[_0x455a('0x13')]);router['post']('/:id/members',auth['isAuthenticated'](),controller['addMembers']);router[_0x455a('0x12')](_0x455a('0x14'),auth[_0x455a('0xa')](),controller['addMessage']);router[_0x455a('0x15')](_0x455a('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x455a('0x16')](_0x455a('0xd'),auth[_0x455a('0xa')](),controller[_0x455a('0x17')]);router[_0x455a('0x16')](_0x455a('0x10'),auth[_0x455a('0xa')](),controller[_0x455a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 3a9f652..d63aeb2 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 _0x9fac=['BOOLEAN','sequelize','exports','INTEGER','ENUM','star','thumb','STRING','DATE','TEXT','out'];(function(_0x511dd6,_0x5d294d){var _0x39f16b=function(_0x150692){while(--_0x150692){_0x511dd6['push'](_0x511dd6['shift']());}};_0x39f16b(++_0x5d294d);}(_0x9fac,0x109));var _0xc9fa=function(_0x4c79e6,_0x208f40){_0x4c79e6=_0x4c79e6-0x0;var _0x29715b=_0x9fac[_0x4c79e6];return _0x29715b;};'use strict';var Sequelize=require(_0xc9fa('0x0'));module[_0xc9fa('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc9fa('0x2')]},'ratingType':{'type':Sequelize[_0xc9fa('0x3')](_0xc9fa('0x4'),_0xc9fa('0x5')),'defaultValue':_0xc9fa('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xc9fa('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc9fa('0x7')]},'disposition':{'type':Sequelize[_0xc9fa('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc9fa('0x6')]},'browserName':{'type':Sequelize[_0xc9fa('0x6')]},'browserVersion':{'type':Sequelize[_0xc9fa('0x6')]},'osName':{'type':Sequelize[_0xc9fa('0x6')]},'osVersion':{'type':Sequelize[_0xc9fa('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xc9fa('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xc9fa('0x8')]},'customerIp':{'type':Sequelize[_0xc9fa('0x6')]},'formData':{'type':Sequelize[_0xc9fa('0x8')]('long')},'read1stAt':{'type':Sequelize[_0xc9fa('0x7')]},'lastMsgAt':{'type':Sequelize[_0xc9fa('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc9fa('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc9fa('0x6')]},'customerPort':{'type':Sequelize[_0xc9fa('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xc9fa('0x8')]},'autoreplyExecuted':{'type':Sequelize[_0xc9fa('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc9fa('0x2')]}}; \ No newline at end of file +var _0x99ec=['BOOLEAN','INTEGER','ENUM','thumb','star','STRING','DATE','TEXT','long','exports'];(function(_0x4ff524,_0x3bb234){var _0x2e0f9f=function(_0x29e675){while(--_0x29e675){_0x4ff524['push'](_0x4ff524['shift']());}};_0x2e0f9f(++_0x3bb234);}(_0x99ec,0x171));var _0xc99e=function(_0x5101b8,_0xe57d1d){_0x5101b8=_0x5101b8-0x0;var _0x4644e0=_0x99ec[_0x5101b8];return _0x4644e0;};'use strict';var Sequelize=require('sequelize');module[_0xc99e('0x0')]={'closed':{'type':Sequelize[_0xc99e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc99e('0x2')]},'ratingType':{'type':Sequelize[_0xc99e('0x3')]('star',_0xc99e('0x4')),'defaultValue':_0xc99e('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xc99e('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc99e('0x7')]},'disposition':{'type':Sequelize[_0xc99e('0x6')]},'secondDisposition':{'type':Sequelize[_0xc99e('0x6')]},'thirdDisposition':{'type':Sequelize[_0xc99e('0x6')]},'note':{'type':Sequelize[_0xc99e('0x6')]},'browserName':{'type':Sequelize[_0xc99e('0x6')]},'browserVersion':{'type':Sequelize[_0xc99e('0x6')]},'osName':{'type':Sequelize[_0xc99e('0x6')]},'osVersion':{'type':Sequelize[_0xc99e('0x6')]},'deviceModel':{'type':Sequelize[_0xc99e('0x6')]},'deviceVendor':{'type':Sequelize[_0xc99e('0x6')]},'deviceType':{'type':Sequelize[_0xc99e('0x6')]},'referer':{'type':Sequelize[_0xc99e('0x8')]},'customerIp':{'type':Sequelize[_0xc99e('0x6')]},'formData':{'type':Sequelize[_0xc99e('0x8')](_0xc99e('0x9'))},'read1stAt':{'type':Sequelize[_0xc99e('0x7')]},'lastMsgAt':{'type':Sequelize[_0xc99e('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xc99e('0x8')]},'autoreplyExecuted':{'type':Sequelize[_0xc99e('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc99e('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index eef641d..92dcaa6 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 _0xbecb=['downloadInteraction.ejs','createPdfFromHTML','rimraf','request-promise','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','then','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','count','set','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','key','chat','query','user','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','params','createVidaooSession','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','isNull','follow','vidaooMetadata','parse','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandon','entity\x20not\x20found','sendStatus','UserId','update','closed','disposition','attachmentUpload','originalname','basename','file','filename','type','mimetype','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsite','CmContact','ContactId','%s%d','agentAlias','System','customer','Visitor','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','limit','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','pick','options','includeAgent','push','addTags','setTags','spread','color','removeTags','unix','toString','server','files','tmp','transcript-%d-%s.zip','lastName','attachments','read','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','out','value','renderFile','views'];(function(_0x7f3494,_0xa02e71){var _0x1ace3a=function(_0x2259b5){while(--_0x2259b5){_0x7f3494['push'](_0x7f3494['shift']());}};_0x1ace3a(++_0xa02e71);}(_0xbecb,0x1a2));var _0xbbec=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xbecb[_0x5f1391];return _0x50ebe3;};'use strict';var rimraf=require(_0xbbec('0x0'));var zipdir=require('zip-dir');var rp=require(_0xbbec('0x1'));var moment=require('moment');var BPromise=require(_0xbbec('0x2'));var Mustache=require(_0xbbec('0x3'));var util=require(_0xbbec('0x4'));var path=require(_0xbbec('0x5'));var ejs=require(_0xbbec('0x6'));var fs=require('fs');var _=require(_0xbbec('0x7'));var Redis=require(_0xbbec('0x8'));var interaction=require(_0xbbec('0x9'));var qs=require('../../components/parsers/qs');var pdf=require(_0xbbec('0xa'));var logger=require(_0xbbec('0xb'))(_0xbbec('0xc'));var config=require(_0xbbec('0xd'));var db=require(_0xbbec('0xe'))['db'];config[_0xbbec('0xf')]=_[_0xbbec('0x10')](config[_0xbbec('0xf')],{'host':_0xbbec('0x11'),'port':0x18eb});var socket=require(_0xbbec('0x12'))(new Redis(config['redis']));require(_0xbbec('0x13'))['register'](socket);var jayson=require(_0xbbec('0x14'));var client=jayson[_0xbbec('0x15')][_0xbbec('0x16')]({'port':0x232b});var client9004=jayson[_0xbbec('0x15')][_0xbbec('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x1e3a65,_0x58aa08,_0x14805c,_0x23c5c8){return new BPromise(function(_0x1d7192,_0x3408f3){var _0x4e2a00=_0x23c5c8||client;return _0x4e2a00['request'](_0x1e3a65,_0x14805c)[_0xbbec('0x17')](function(_0x3d4701){logger['info'](_0xbbec('0x18'),_0x58aa08,'request\x20sent');logger[_0xbbec('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x58aa08,_0xbbec('0x1a'),JSON[_0xbbec('0x1b')](_0x3d4701));if(_0x3d4701[_0xbbec('0x1c')]){if(_0x3d4701[_0xbbec('0x1c')][_0xbbec('0x1d')]===0x1f4){logger[_0xbbec('0x1c')](_0xbbec('0x18'),_0x58aa08,_0x3d4701[_0xbbec('0x1c')][_0xbbec('0x1e')]);return _0x3408f3(_0x3d4701[_0xbbec('0x1c')]['message']);}logger['error'](_0xbbec('0x18'),_0x58aa08,_0x3d4701[_0xbbec('0x1c')]['message']);return _0x1d7192(_0x3d4701['error'][_0xbbec('0x1e')]);}else{logger[_0xbbec('0x1f')](_0xbbec('0x18'),_0x58aa08,'request\x20sent');_0x1d7192(_0x3d4701[_0xbbec('0x20')]['message']);}})[_0xbbec('0x21')](function(_0x64df63){logger[_0xbbec('0x1c')](_0xbbec('0x18'),_0x58aa08,_0x64df63);_0x3408f3(_0x64df63);});});}function respondWithStatusCode(_0x2e9ac0,_0xd7ae7e){_0xd7ae7e=_0xd7ae7e||0xcc;return function(_0x8e6a50){if(_0x8e6a50){return _0x2e9ac0['sendStatus'](_0xd7ae7e);}return _0x2e9ac0[_0xbbec('0x22')](_0xd7ae7e)[_0xbbec('0x23')]();};}function respondWithResult(_0x3ff931,_0x31583c){_0x31583c=_0x31583c||0xc8;return function(_0x32789a){if(_0x32789a){return _0x3ff931['status'](_0x31583c)[_0xbbec('0x24')](_0x32789a);}};}function respondWithFilteredResult(_0x19983b,_0x54aec3){return function(_0x2a46b9){if(_0x2a46b9){var _0x55703a=typeof _0x54aec3[_0xbbec('0x25')]===_0xbbec('0x26')&&typeof _0x54aec3['limit']==='undefined';var _0x39f393=_0x2a46b9[_0xbbec('0x27')];var _0x21aeda=_0x55703a?0x0:_0x54aec3[_0xbbec('0x25')];var _0x4f1773=_0x55703a?_0x2a46b9['count']:_0x54aec3[_0xbbec('0x25')]+_0x54aec3['limit'];var _0xdcb6c7;if(_0x4f1773>=_0x39f393){_0x4f1773=_0x39f393;_0xdcb6c7=0xc8;}else{_0xdcb6c7=0xce;}_0x19983b[_0xbbec('0x22')](_0xdcb6c7);return _0x19983b[_0xbbec('0x28')]('Content-Range',_0x21aeda+'-'+_0x4f1773+'/'+_0x39f393)[_0xbbec('0x24')](_0x2a46b9);}return null;};}function saveUpdates(_0x4757c1){return function(_0x3c4c81){if(_0x3c4c81){return _0x3c4c81['update'](_0x4757c1)[_0xbbec('0x17')](function(_0x790264){return _0x790264;});}return null;};}function removeEntity(_0x5050f1){return function(_0x1ae7a8){if(_0x1ae7a8){return _0x1ae7a8[_0xbbec('0x29')]()['then'](function(){_0x5050f1[_0xbbec('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x561110){return function(_0x2e5319){if(!_0x2e5319){_0x561110['sendStatus'](0x194);}return _0x2e5319;};}function handleError(_0x2fe9a4,_0x48fe52){_0x48fe52=_0x48fe52||0x1f4;return function(_0x2a3f75){logger[_0xbbec('0x1c')](_0x2a3f75[_0xbbec('0x2a')]);if(_0x2a3f75[_0xbbec('0x2b')]){delete _0x2a3f75[_0xbbec('0x2b')];}_0x2fe9a4[_0xbbec('0x22')](_0x48fe52)[_0xbbec('0x2c')](_0x2a3f75);};}function getMustacheRender(_0x22c8bf,_0x3ea3ad){return Mustache[_0xbbec('0x2d')](_0x22c8bf,_[_0xbbec('0x2e')](_0x3ea3ad[_0xbbec('0x2f')],{'contact':_0x3ea3ad[_0xbbec('0x30')],'message':_0x3ea3ad[_0xbbec('0x1e')],'agent':_0x3ea3ad[_0xbbec('0x31')],'interaction':_0x3ea3ad[_0xbbec('0x32')],'account':_0x3ea3ad[_0xbbec('0x33')]}))||'';}exports[_0xbbec('0x34')]=function(_0x587ca9,_0x391d6){var _0x4ea069={};var _0x2b75fb=_[_0xbbec('0x35')](db[_0xbbec('0x36')][_0xbbec('0x37')],function(_0x235fb8){return{'name':_0x235fb8[_0xbbec('0x38')],'type':_0x235fb8['type'][_0xbbec('0x39')]};});_0x4ea069=qs['getOptions'](_0x2b75fb,_0x587ca9);return interaction['findAll'](_0xbbec('0x3a'),_0x587ca9[_0xbbec('0x3b')],_0x587ca9[_0xbbec('0x3c')],_0x4ea069,_0x2b75fb)[_0xbbec('0x17')](respondWithFilteredResult(_0x391d6,_0x4ea069))[_0xbbec('0x21')](handleError(_0x391d6,null));};exports[_0xbbec('0x3d')]=function(_0x359c1b,_0xdaf275){var _0x2b382d={'raw':![],'where':{'id':_0x359c1b['params']['id']}},_0x47a77e={};_0x47a77e[_0xbbec('0x3e')]=_[_0xbbec('0x3f')](db[_0xbbec('0x36')][_0xbbec('0x37')]);_0x47a77e[_0xbbec('0x3b')]=_[_0xbbec('0x3f')](_0x359c1b[_0xbbec('0x3b')]);_0x47a77e[_0xbbec('0x40')]=_[_0xbbec('0x41')](_0x47a77e[_0xbbec('0x3e')],_0x47a77e[_0xbbec('0x3b')]);_0x2b382d[_0xbbec('0x42')]=_[_0xbbec('0x41')](_0x47a77e[_0xbbec('0x3e')],qs['fields'](_0x359c1b[_0xbbec('0x3b')][_0xbbec('0x43')]));_0x2b382d[_0xbbec('0x42')]=_0x2b382d['attributes'][_0xbbec('0x44')]?_0x2b382d[_0xbbec('0x42')]:_0x47a77e[_0xbbec('0x3e')];if(_0x359c1b['query'][_0xbbec('0x45')]){_0x2b382d[_0xbbec('0x46')]=[{'all':!![]}];}_0x2b382d=_[_0xbbec('0x2e')]({},_0x2b382d,_0x359c1b['options']);return db[_0xbbec('0x36')][_0xbbec('0x47')](_0x2b382d)[_0xbbec('0x17')](handleEntityNotFound(_0xdaf275,null))[_0xbbec('0x17')](respondWithResult(_0xdaf275,null))['catch'](handleError(_0xdaf275,null));};exports[_0xbbec('0x48')]=function(_0xd0a4e2,_0x4e4553){return db[_0xbbec('0x36')]['create'](_0xd0a4e2[_0xbbec('0x2f')],{})[_0xbbec('0x17')](respondWithResult(_0x4e4553,0xc9))[_0xbbec('0x21')](handleError(_0x4e4553,null));};exports['update']=function(_0x331f4f,_0x84c525){if(_0x331f4f['body']['id']){delete _0x331f4f[_0xbbec('0x2f')]['id'];}return db[_0xbbec('0x36')][_0xbbec('0x47')]({'where':{'id':_0x331f4f[_0xbbec('0x49')]['id']}})[_0xbbec('0x17')](handleEntityNotFound(_0x84c525,null))[_0xbbec('0x17')](saveUpdates(_0x331f4f[_0xbbec('0x2f')],null))[_0xbbec('0x17')](respondWithResult(_0x84c525,null))[_0xbbec('0x21')](handleError(_0x84c525,null));};exports[_0xbbec('0x29')]=function(_0x375328,_0x4ef950){return db[_0xbbec('0x36')][_0xbbec('0x47')]({'where':{'id':_0x375328['params']['id']}})[_0xbbec('0x17')](handleEntityNotFound(_0x4ef950,null))[_0xbbec('0x17')](removeEntity(_0x4ef950,null))[_0xbbec('0x21')](handleError(_0x4ef950,null));};exports['describe']=function(_0x40b86b,_0x1c24fe){return db[_0xbbec('0x36')]['describe']()[_0xbbec('0x17')](respondWithResult(_0x1c24fe,null))[_0xbbec('0x21')](handleError(_0x1c24fe,null));};exports[_0xbbec('0x4a')]=function(_0x4832ef,_0xe75a67){var _0x343ed6=_0x4832ef[_0xbbec('0x49')]['id'];var _0x157ac4;var _0x4fb1cc;var _0x1e086b;return db[_0xbbec('0x36')][_0xbbec('0x4b')]({'where':{'id':_0x343ed6}})[_0xbbec('0x17')](function(_0x2c6ade){_0x157ac4=_0x2c6ade;return db['ChatWebsite']['findOne']({'where':{'id':_0x2c6ade[_0xbbec('0x4c')]},'attributes':['id','vidaooApiKey',_0xbbec('0x4d'),_0xbbec('0x4e'),_0xbbec('0x4f'),'vidaooMetadata'],'raw':!![]});})[_0xbbec('0x17')](function(_0x3b0d14){if(_0x3b0d14&&_0x3b0d14['vidaooApiKey']&&_0x3b0d14[_0xbbec('0x4d')]){_0x4fb1cc=_0x3b0d14;var _0x3c9d28={'interaction':{'id':_0x343ed6},'agent':{'id':_0x4832ef[_0xbbec('0x3c')]['id'],'name':_0x4832ef['user'][_0xbbec('0x2b')],'fullname':_0x4832ef[_0xbbec('0x3c')]['fullname'],'email':_0x4832ef['user'][_0xbbec('0x50')]},'contact':_0x4832ef[_0xbbec('0x2f')]['contact'],'account':_0x4832ef['body'][_0xbbec('0x33')]};var _0x5caffd={'rejectUnauthorized':![],'method':_0xbbec('0x51'),'url':_0xbbec('0x52'),'headers':{'X-APIKEY':_0x3b0d14[_0xbbec('0x53')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4832ef[_0xbbec('0x3c')]['email']],'buttons':null,'topic':_0x4fb1cc[_0xbbec('0x4e')],'note':_[_0xbbec('0x54')](_0x4fb1cc[_0xbbec('0x4f')])?null:getMustacheRender(_0x4fb1cc['vidaooNote'],_0x3c9d28),'metadata':null},'redirect':_0xbbec('0x55'),'json':!![]};try{if(!_[_0xbbec('0x54')](_0x4fb1cc[_0xbbec('0x56')])){var _0x39101a=getMustacheRender(_0x4fb1cc[_0xbbec('0x56')],_0x3c9d28);var _0x501bfc=JSON[_0xbbec('0x57')](_0x39101a);_0x5caffd['body']['metadata']=_0x501bfc;}}catch(_0x2453bf){throw new db[(_0xbbec('0x58'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5caffd);}else{throw new db[(_0xbbec('0x58'))][(_0xbbec('0x59'))](_0xbbec('0x5a'));}})[_0xbbec('0x17')](function(_0x185c8f){_0x1e086b=_0x185c8f;if(_0x1e086b['id']){var _0x1c8cee={'body':_0x1e086b[_0xbbec('0x5b')],'ChatWebsiteId':_0x4fb1cc['id'],'ChatInteractionId':_0x157ac4['id'],'direction':'out','UserId':_0x4832ef[_0xbbec('0x3c')]['id']};return db[_0xbbec('0x5c')][_0xbbec('0x48')](_0x1c8cee,{});}else{throw new db['Sequelize']['ValidationError'](_0xbbec('0x5d'));}})[_0xbbec('0x17')](function(){return _0x157ac4[_0xbbec('0x5e')]({'vidaooSessionId':_0x1e086b['id']});})[_0xbbec('0x17')](respondWithResult(_0xe75a67,null))[_0xbbec('0x21')](handleError(_0xe75a67,null));};exports['customUpdate']=function(_0xbdd718,_0x67e312){if(_0xbdd718['body']['id']){delete _0xbdd718['body']['id'];}return db[_0xbbec('0x36')][_0xbbec('0x47')]({'where':{'id':_0xbdd718[_0xbbec('0x49')]['id']},'include':[{'model':db['CmContact'],'as':_0xbbec('0x5f')}]})['then'](handleEntityNotFound(_0x67e312,null))['then'](saveUpdates(_0xbdd718[_0xbbec('0x2f')],null))[_0xbbec('0x17')](respondWithResult(_0x67e312,null))[_0xbbec('0x21')](handleError(_0x67e312,null));};exports[_0xbbec('0x60')]=function(_0x34d51f,_0xe65d0f){if(_0x34d51f[_0xbbec('0x2f')]['id']){delete _0x34d51f[_0xbbec('0x2f')]['id'];}return db[_0xbbec('0x36')][_0xbbec('0x47')]({'where':{'id':_0x34d51f[_0xbbec('0x49')]['id']}})[_0xbbec('0x17')](function(_0x2b73b4){if(!_0x2b73b4){logger[_0xbbec('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xbbec('0x60'),0x194,_0xbbec('0x61'));_0xe65d0f[_0xbbec('0x62')](0x194);}else{if(_0x2b73b4[_0xbbec('0x63')]){throw new db[(_0xbbec('0x58'))][(_0xbbec('0x59'))]('Interaction\x20already\x20assigned');}}return _0x2b73b4;})[_0xbbec('0x17')](function(_0x16b58d){if(_0x16b58d){return _0x16b58d[_0xbbec('0x64')]({'closed':_0x34d51f[_0xbbec('0x2f')][_0xbbec('0x65')],'disposition':_0x34d51f[_0xbbec('0x2f')][_0xbbec('0x66')]})['then'](function(_0x35e4ee){return _0x35e4ee;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xbbec('0x60'),_0x34d51f[_0xbbec('0x2f')],client9004);})['then'](respondWithResult(_0xe65d0f,null))[_0xbbec('0x21')](handleError(_0xe65d0f,null));};exports[_0xbbec('0x67')]=function(_0x4810d8,_0x2d6823){_0x4810d8[_0xbbec('0x2f')][_0xbbec('0x2b')]=_0x4810d8['file'][_0xbbec('0x68')];_0x4810d8[_0xbbec('0x2f')][_0xbbec('0x69')]=_0x4810d8[_0xbbec('0x6a')][_0xbbec('0x6b')];_0x4810d8['body'][_0xbbec('0x6c')]=_0x4810d8[_0xbbec('0x6a')][_0xbbec('0x6d')];return db[_0xbbec('0x6e')]['create'](_0x4810d8['body'])[_0xbbec('0x17')](respondWithResult(_0x2d6823,0xc9))[_0xbbec('0x21')](handleError(_0x2d6823,null));};exports['attachmentDownload']=function(_0x3f1d0c,_0x3d1469){return db[_0xbbec('0x36')][_0xbbec('0x4b')]({'where':{'id':_0x3f1d0c['params']['id']},'raw':!![]})[_0xbbec('0x17')](handleEntityNotFound(_0x3d1469,null))[_0xbbec('0x17')](function(_0x16fd28){if(_0x16fd28){if(_0x16fd28['closed']){return _0x3d1469[_0xbbec('0x22')](0x193)[_0xbbec('0x24')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0xbbec('0x4b')]({'where':{'id':_0x3f1d0c['query'][_0xbbec('0x6f')]},'raw':!![]})[_0xbbec('0x17')](handleEntityNotFound(_0x3d1469,null));}})[_0xbbec('0x17')](function(_0x3c011a){if(_0x3c011a){var _0x4c5ff1=_0x3c011a[_0xbbec('0x70')]!==null;var _0x3fdfd8=path[_0xbbec('0x71')](config[_0xbbec('0x72')],_0xbbec('0x73'));if(_0x4c5ff1){_0x3fdfd8=path[_0xbbec('0x71')](_0x3fdfd8,_0xbbec('0x74'));}var _0x196d10=path[_0xbbec('0x71')](_0x3fdfd8,_0x3c011a[_0xbbec('0x69')]);return _0x3d1469[_0xbbec('0x75')](_0x196d10);}})[_0xbbec('0x21')](handleError(_0x3d1469,null));};exports[_0xbbec('0x76')]=function(_0x3838fc,_0x333376){var _0x5f2ef0=null;var _0x115023=null;var _0x4073d9=null;if(_0x3838fc['body']['id']){delete _0x3838fc[_0xbbec('0x2f')]['id'];}if(_0x3838fc[_0xbbec('0x2f')][_0xbbec('0x77')]){_0x4073d9=path[_0xbbec('0x71')](config[_0xbbec('0x72')],_0xbbec('0x78'),util[_0xbbec('0x79')](_0xbbec('0x7a'),Date[_0xbbec('0x7b')]()));_0x3838fc[_0xbbec('0x2f')][_0xbbec('0x7c')]=_0x4073d9;}return db[_0xbbec('0x36')][_0xbbec('0x47')]({'where':{'id':_0x3838fc[_0xbbec('0x49')]['id']},'include':[{'model':db[_0xbbec('0x5c')],'as':_0xbbec('0x7d'),'include':[{'model':db['User'],'as':_0xbbec('0x7e')}]}]})[_0xbbec('0x17')](handleEntityNotFound(_0x333376,null))[_0xbbec('0x17')](saveUpdates(_0x3838fc[_0xbbec('0x2f')],null))[_0xbbec('0x17')](function(_0x491bba){if(_0x491bba){_0x5f2ef0=_0x491bba;return db[_0xbbec('0x7f')][_0xbbec('0x47')]({'where':{'id':_0x5f2ef0[_0xbbec('0x4c')]}});}})[_0xbbec('0x17')](function(_0x2b9fca){if(_0x2b9fca){_0x115023=_0x2b9fca;return db[_0xbbec('0x80')]['find']({'where':{'id':_0x5f2ef0[_0xbbec('0x81')]}});}})[_0xbbec('0x17')](function(_0x10c992){if(_0x10c992){if(_0x4073d9){var _0x48e3dd=null;for(var _0x47d797=0x1;_0x47d797<_0x5f2ef0[_0xbbec('0x7d')][_0xbbec('0x44')];++_0x47d797){_0x48e3dd=_0x5f2ef0[_0xbbec('0x7d')][_0x47d797];var _0x296622=_0x48e3dd[_0xbbec('0x63')]?util[_0xbbec('0x79')](_0xbbec('0x82'),_0x115023[_0xbbec('0x83')],_0x48e3dd[_0xbbec('0x63')]):_0xbbec('0x84');var _0x57850e=_0x3838fc['body'][_0xbbec('0x85')]||util[_0xbbec('0x79')](_0xbbec('0x82'),_0xbbec('0x86'),_0x48e3dd['ContactId']);switch(_0x115023['agentIdentifier']){case'website_alias':_0x296622=_0x48e3dd['UserId']?util['format'](_0xbbec('0x82'),_0x115023[_0xbbec('0x83')],_0x48e3dd[_0xbbec('0x63')]):_0xbbec('0x84');break;case'agent_alias':_0x296622=_0x48e3dd[_0xbbec('0x63')]?_0x48e3dd[_0xbbec('0x7e')][_0xbbec('0x87')]||_0x48e3dd[_0xbbec('0x7e')][_0xbbec('0x88')]:_0xbbec('0x84');break;case _0xbbec('0x89'):_0x296622=_0x48e3dd['UserId']?_0x48e3dd[_0xbbec('0x7e')][_0xbbec('0x88')]:'System';break;default:_0x296622=_0x48e3dd[_0xbbec('0x63')]?util[_0xbbec('0x79')](_0xbbec('0x82'),_0x115023['agentAlias'],_0x48e3dd[_0xbbec('0x63')]):_0xbbec('0x84');}var _0x129cad=util[_0xbbec('0x79')](_0xbbec('0x8a'),moment(_0x48e3dd[_0xbbec('0x8b')])[_0xbbec('0x79')](_0xbbec('0x8c')),_0x48e3dd[_0xbbec('0x8d')]==='in'?_0x57850e:_0x296622,_0x48e3dd[_0xbbec('0x2f')]);if(!_0x48e3dd[_0xbbec('0x8e')]){fs[_0xbbec('0x8f')](_0x4073d9,_0x129cad);}}return db[_0xbbec('0x90')][_0xbbec('0x4b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xbbec('0x91'),'raw':!![],'include':[{'model':db[_0xbbec('0x92')],'as':_0xbbec('0x92'),'raw':!![]}]}]});}}})[_0xbbec('0x17')](function(_0x4f49ab){if(!_0x4f49ab||!_0x4f49ab[_0xbbec('0x91')]||!_0x3838fc[_0xbbec('0x2f')])return _0x5f2ef0;var _0x51e0c9=_0x4f49ab[_0xbbec('0x93')]();return respondWithRpcPromise(_0xbbec('0x94'),'sendMail',{'account':_0x51e0c9,'message':{'from':util[_0xbbec('0x79')](_0xbbec('0x95'),_0x4f49ab['name'],_0x4f49ab[_0xbbec('0x50')]||_0x4f49ab[_0xbbec('0x91')][_0xbbec('0x3c')]),'to':_0x3838fc[_0xbbec('0x2f')][_0xbbec('0x77')],'subject':_0xbbec('0x96'),'text':util['format'](_0xbbec('0x97'),_0x3838fc['body'][_0xbbec('0x77')]),'attachments':[{'path':_0x4073d9}]}})[_0xbbec('0x17')](function(){return _0x5f2ef0;})[_0xbbec('0x21')](function(_0x51a6e2){logger['error'](_0x51a6e2);});})[_0xbbec('0x17')](respondWithStatusCode(_0x333376,0xc8))[_0xbbec('0x21')](handleError(_0x333376,null));};exports[_0xbbec('0x98')]=function(_0x3106f4,_0x4f24d2){return db[_0xbbec('0x5c')]['find']({'where':{'id':_0x3106f4[_0xbbec('0x49')]['id']}})[_0xbbec('0x17')](handleEntityNotFound(_0x4f24d2,null))[_0xbbec('0x17')](function(_0x493e2b){if(_0x493e2b){return _0x493e2b[_0xbbec('0x98')](_0x3106f4['body'][_0xbbec('0x99')],_[_0xbbec('0x9a')](_0x3106f4[_0xbbec('0x2f')],['ids','id'])||{});}})[_0xbbec('0x17')](respondWithResult(_0x4f24d2,null))[_0xbbec('0x21')](handleError(_0x4f24d2,null));};exports[_0xbbec('0x9b')]=function(_0x550a4d,_0x40982c){var _0x1c0c00={'raw':![],'where':{}};var _0x4ca62a={};var _0x3227a1={'count':0x0,'rows':[]};return db[_0xbbec('0x36')]['findOne']({'where':{'id':_0x550a4d[_0xbbec('0x49')]['id']}})['then'](handleEntityNotFound(_0x40982c,null))[_0xbbec('0x17')](function(_0x590902){if(_0x590902){_0x4ca62a[_0xbbec('0x3e')]=_['keys'](db[_0xbbec('0x5c')][_0xbbec('0x37')]);_0x4ca62a[_0xbbec('0x3b')]=_[_0xbbec('0x3f')](_0x550a4d[_0xbbec('0x3b')]);_0x4ca62a[_0xbbec('0x40')]=_['intersection'](_0x4ca62a[_0xbbec('0x3e')],_0x4ca62a[_0xbbec('0x3b')]);_0x1c0c00[_0xbbec('0x42')]=_[_0xbbec('0x41')](_0x4ca62a[_0xbbec('0x3e')],qs[_0xbbec('0x43')](_0x550a4d[_0xbbec('0x3b')][_0xbbec('0x43')]));_0x1c0c00['attributes']=_0x1c0c00['attributes']['length']?_0x1c0c00[_0xbbec('0x42')]:_0x4ca62a[_0xbbec('0x3e')];if(!_0x550a4d[_0xbbec('0x3b')][_0xbbec('0x9c')](_0xbbec('0x9d'))){_0x1c0c00['limit']=qs[_0xbbec('0x9e')](_0x550a4d[_0xbbec('0x3b')][_0xbbec('0x9e')]);_0x1c0c00[_0xbbec('0x25')]=qs[_0xbbec('0x25')](_0x550a4d[_0xbbec('0x3b')]['offset']);}_0x1c0c00['order']=qs[_0xbbec('0x9f')](_0x550a4d[_0xbbec('0x3b')][_0xbbec('0x9f')]);_0x1c0c00[_0xbbec('0xa0')]=qs['filters'](_['pick'](_0x550a4d[_0xbbec('0x3b')],_0x4ca62a[_0xbbec('0x40')]));_0x1c0c00[_0xbbec('0xa0')][_0xbbec('0xa1')]=_0x590902['id'];if(_0x550a4d[_0xbbec('0x3b')][_0xbbec('0xa2')]){_0x1c0c00[_0xbbec('0xa0')]=_[_0xbbec('0x2e')](_0x1c0c00[_0xbbec('0xa0')],{'$or':_[_0xbbec('0x35')](_0x1c0c00[_0xbbec('0x42')],function(_0x1b89e0){var _0x24514e={};_0x24514e[_0x1b89e0]={'$like':'%'+_0x550a4d[_0xbbec('0x3b')][_0xbbec('0xa2')]+'%'};return _0x24514e;})});}if(_0x550a4d[_0xbbec('0x3b')][_0xbbec('0xa3')]){var _0x3ad17f=_0x550a4d[_0xbbec('0x3b')][_0xbbec('0xa3')][_0xbbec('0xa4')](',');var _0x48c864={};_0x48c864[_0x3ad17f[0x0]]={'$gte':moment(_0x3ad17f[0x1])[_0xbbec('0x79')](_0xbbec('0xa5'))};_0x1c0c00[_0xbbec('0xa0')]=_[_0xbbec('0x2e')](_0x1c0c00[_0xbbec('0xa0')],_0x48c864);}_0x1c0c00=_[_0xbbec('0x2e')]({},_0x1c0c00,_0x550a4d['options']);return db[_0xbbec('0x5c')][_0xbbec('0x27')]({'where':_0x1c0c00[_0xbbec('0xa0')]})['then'](function(_0x5a28bc){_0x3227a1[_0xbbec('0x27')]=_0x5a28bc;if(_0x550a4d['query'][_0xbbec('0x45')]){_0x1c0c00['include']=[{'all':!![]}];}return db[_0xbbec('0x5c')][_0xbbec('0xa6')](_0x1c0c00);})['then'](function(_0x5798fb){_0x3227a1[_0xbbec('0xa7')]=_0x5798fb;return _0x3227a1;});}})['then'](respondWithFilteredResult(_0x40982c,_0x1c0c00))['catch'](handleError(_0x40982c,null));};exports[_0xbbec('0xa8')]=function(_0x26c33e,_0x3a5607){var _0x42f6c3={'where':{}},_0x432e45={},_0x29a63e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xbbec('0x4b')]({'where':{'id':_0x26c33e[_0xbbec('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a5607,null))[_0xbbec('0x17')](function(_0x54f723){if(_0x54f723){_0x432e45['model']=_[_0xbbec('0x3f')](db[_0xbbec('0x5c')][_0xbbec('0x37')]);_0x432e45['query']=_[_0xbbec('0x3f')](_0x26c33e[_0xbbec('0x3b')]);_0x432e45['filters']=_[_0xbbec('0x41')](_0x432e45[_0xbbec('0x3e')],_0x432e45[_0xbbec('0x3b')]);_0x42f6c3[_0xbbec('0x42')]=_[_0xbbec('0x41')](_0x432e45[_0xbbec('0x3e')],qs[_0xbbec('0x43')](_0x26c33e[_0xbbec('0x3b')]['fields']));_0x42f6c3[_0xbbec('0x42')]=_0x42f6c3['attributes'][_0xbbec('0x44')]?_0x42f6c3[_0xbbec('0x42')]:_0x432e45[_0xbbec('0x3e')];if(!_0x26c33e[_0xbbec('0x3b')][_0xbbec('0x9c')]('nolimit')){_0x42f6c3[_0xbbec('0x9e')]=qs['limit'](_0x26c33e[_0xbbec('0x3b')][_0xbbec('0x9e')]);_0x42f6c3[_0xbbec('0x25')]=qs[_0xbbec('0x25')](_0x26c33e[_0xbbec('0x3b')][_0xbbec('0x25')]);}_0x42f6c3['order']=qs['sort'](_0x26c33e[_0xbbec('0x3b')]['sort']);_0x42f6c3[_0xbbec('0xa0')]=qs[_0xbbec('0x40')](_[_0xbbec('0xa9')](_0x26c33e['query'],_0x432e45[_0xbbec('0x40')]));_0x42f6c3[_0xbbec('0xa0')][_0xbbec('0xa1')]=_0x54f723['id'];if(_0x26c33e[_0xbbec('0x3b')][_0xbbec('0xa2')]){_0x42f6c3[_0xbbec('0xa0')]=_['merge'](_0x42f6c3[_0xbbec('0xa0')],{'$or':_['map'](_0x42f6c3[_0xbbec('0x42')],function(_0x677bc8){var _0x15dd21={};_0x15dd21[_0x677bc8]={'$like':'%'+_0x26c33e[_0xbbec('0x3b')][_0xbbec('0xa2')]+'%'};return _0x15dd21;})});}_0x42f6c3[_0xbbec('0xa0')][_0xbbec('0x8e')]=![];if(_0x26c33e[_0xbbec('0x3b')]['id']){_0x42f6c3[_0xbbec('0xa0')]['id']={'$gt':_0x26c33e[_0xbbec('0x3b')]['id']};}_0x42f6c3=_[_0xbbec('0x2e')]({},_0x42f6c3,_0x26c33e[_0xbbec('0xaa')]);return db[_0xbbec('0x5c')][_0xbbec('0x27')]({'where':_0x42f6c3[_0xbbec('0xa0')]})['then'](function(_0x5b310d){_0x29a63e[_0xbbec('0x27')]=_0x5b310d;_0x42f6c3[_0xbbec('0x46')]=[];if(_0x26c33e[_0xbbec('0x3b')][_0xbbec('0xab')]){_0x42f6c3[_0xbbec('0x46')][_0xbbec('0xac')]({'model':db[_0xbbec('0x7e')],'as':_0xbbec('0x7e'),'attributes':['id','fullname',_0xbbec('0x87')]});}if(_0x26c33e[_0xbbec('0x3b')]['includeAll']){_0x42f6c3['include']=[{'all':!![]}];}return db[_0xbbec('0x5c')][_0xbbec('0xa6')](_0x42f6c3);})[_0xbbec('0x17')](function(_0x42b3cd){_0x29a63e[_0xbbec('0xa7')]=_0x42b3cd;return _0x29a63e;});}})[_0xbbec('0x17')](respondWithFilteredResult(_0x3a5607,_0x42f6c3))[_0xbbec('0x21')](handleError(_0x3a5607,null));};exports[_0xbbec('0xad')]=function(_0x3046b1,_0x103d0e){return db['ChatInteraction'][_0xbbec('0x47')]({'where':{'id':_0x3046b1[_0xbbec('0x49')]['id']}})['then'](handleEntityNotFound(_0x103d0e,null))[_0xbbec('0x17')](function(_0x406f6a){if(_0x406f6a){return _0x406f6a[_0xbbec('0xae')](_0x3046b1[_0xbbec('0x2f')]['ids'],_[_0xbbec('0x9a')](_0x3046b1[_0xbbec('0x2f')],[_0xbbec('0x99'),'id'])||{})[_0xbbec('0xaf')](function(){return db['Tag'][_0xbbec('0xa6')]({'attributes':['id',_0xbbec('0x2b'),_0xbbec('0xb0')],'where':{'id':_0x3046b1[_0xbbec('0x2f')][_0xbbec('0x99')]}});})['then'](function(_0x2c384f){socket['emit']('chatInteractionTags:save',{'id':Number(_0x3046b1['params']['id']),'tags':_0x2c384f||[]});return{'id':Number(_0x3046b1[_0xbbec('0x49')]['id']),'tags':_0x2c384f||[]};});}})[_0xbbec('0x17')](respondWithResult(_0x103d0e,null))[_0xbbec('0x21')](handleError(_0x103d0e,null));};exports[_0xbbec('0xb1')]=function(_0x950df8,_0x233f43){return db['ChatInteraction'][_0xbbec('0x47')]({'where':{'id':_0x950df8[_0xbbec('0x49')]['id']}})[_0xbbec('0x17')](handleEntityNotFound(_0x233f43,null))[_0xbbec('0x17')](function(_0x476a0b){if(_0x476a0b){return _0x476a0b[_0xbbec('0xb1')](_0x950df8[_0xbbec('0x3b')][_0xbbec('0x99')]);}})[_0xbbec('0x17')](respondWithStatusCode(_0x233f43,null))[_0xbbec('0x21')](handleError(_0x233f43,null));};exports[_0xbbec('0x75')]=function(_0x4e4219,_0x3ee3b9){var _0x4d94d4=moment()[_0xbbec('0xb2')]()[_0xbbec('0xb3')]();var _0xa683dc=path[_0xbbec('0x71')](config[_0xbbec('0x72')],_0xbbec('0xb4'),_0xbbec('0xb5'),_0xbbec('0xb6'));var _0x30dbb3=path['join'](config[_0xbbec('0x72')],_0xbbec('0xb4'),_0xbbec('0xb5'),'attachments');var _0x2479bd=path[_0xbbec('0x71')](_0xa683dc,_0x4d94d4);var _0x34d09c=util[_0xbbec('0x79')](_0xbbec('0xb7'),_0x4e4219['params']['id'],_0x4d94d4);var _0xd2a4e0=path[_0xbbec('0x71')](_0xa683dc,_0x34d09c);var _0x2d2e2c=[];_0x2d2e2c[_0xbbec('0xac')]({'model':db[_0xbbec('0x7e')],'as':'User','attributes':['id',_0xbbec('0x88')],'raw':!![]});_0x2d2e2c['push']({'model':db[_0xbbec('0x80')],'as':_0xbbec('0x5f'),'attributes':['id','firstName',_0xbbec('0xb8')],'raw':!![]});if(_0x4e4219[_0xbbec('0x3b')][_0xbbec('0xb9')]){_0x2d2e2c[_0xbbec('0xac')]({'model':db[_0xbbec('0x6e')],'as':_0xbbec('0x6e'),'raw':!![]});}var _0x44c156=[{'model':db[_0xbbec('0x5c')],'as':'Messages','attributes':['id',_0xbbec('0x2f'),'createdAt','direction',_0xbbec('0x8e'),_0xbbec('0xba')],'include':_0x2d2e2c}];_0x44c156['push']({'model':db[_0xbbec('0x7f')],'as':_0xbbec('0xbb'),'attributes':['id',_0xbbec('0x2b')]});_0x44c156[_0xbbec('0xac')]({'model':db[_0xbbec('0x7e')],'as':_0xbbec('0xbc'),'attributes':['id',_0xbbec('0x88')]});return db[_0xbbec('0x36')][_0xbbec('0x47')]({'where':{'id':_0x4e4219[_0xbbec('0x49')]['id']},'include':_0x44c156})[_0xbbec('0x17')](handleEntityNotFound(_0x3ee3b9,null))[_0xbbec('0x17')](function(_0x2adf99){if(_0x2adf99){var _0x4a3dd1=_0x2adf99[_0xbbec('0xbd')]({'plain':!![]});fs[_0xbbec('0xbe')](_0x2479bd);var _0x598aad={'channel':_0xbbec('0xbf'),'account':_0x4a3dd1[_0xbbec('0xbb')][_0xbbec('0x2b')],'agent':_0x4a3dd1[_0xbbec('0xbc')]?_0x4a3dd1[_0xbbec('0xbc')][_0xbbec('0x88')]:_0xbbec('0xc0'),'createdAt':moment(_0x4a3dd1['createdAt'])[_0xbbec('0x79')](_0xbbec('0xa5'))['toString'](),'closedAt':_0x4a3dd1[_0xbbec('0x65')]?moment(_0x4a3dd1['closedAt'])[_0xbbec('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbbec('0xb3')]():'','disposition':_0x4a3dd1[_0xbbec('0x66')],'chatInfo':{'browser':_0x4a3dd1[_0xbbec('0xc1')],'os':_0x4a3dd1[_0xbbec('0xc2')],'referer':_0x4a3dd1[_0xbbec('0xc3')],'customerIp':_0x4a3dd1[_0xbbec('0xc4')],'customerPort':_0x4a3dd1[_0xbbec('0xc5')]?_0x4a3dd1[_0xbbec('0xc5')]:_0xbbec('0xc0')},'messages':_(_0x4a3dd1[_0xbbec('0x7d')])[_0xbbec('0xc6')]()[_0xbbec('0xa2')]({'secret':![]})[_0xbbec('0x35')](function(_0x248b48){if(_0x248b48[_0xbbec('0x6e')]){var _0x4212b7=path['join'](_0x30dbb3,_0x248b48['Attachment']['basename']);if(fs[_0xbbec('0xc7')](_0x4212b7)){fs[_0xbbec('0xc8')](_0x4212b7)[_0xbbec('0xc9')](fs['createWriteStream'](path['join'](_0x2479bd,_0x248b48[_0xbbec('0x6e')]['basename'])));}}return{'date':moment(_0x248b48[_0xbbec('0x8b')])[_0xbbec('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbbec('0xb3')](),'sender':_0x248b48['direction']===_0xbbec('0xca')?_0x248b48[_0xbbec('0x7e')]?_0x248b48['User'][_0xbbec('0x88')]:_0xbbec('0x84'):_0x248b48[_0xbbec('0x5f')]['firstName']+(_0x248b48[_0xbbec('0x5f')][_0xbbec('0xb8')]?'\x20'+_0x248b48['Contact'][_0xbbec('0xb8')]:''),'body':_0x248b48['Attachment']?_0x248b48[_0xbbec('0x6e')][_0xbbec('0x69')]:_0x248b48['body'],'direction':_0x248b48[_0xbbec('0x8d')]===_0xbbec('0xca')?'A':'C','secret':_0x248b48[_0xbbec('0x8e')],'read':_0x248b48['read'],'attachment':_0x248b48[_0xbbec('0x6e')]};})[_0xbbec('0xcb')]()};return ejs[_0xbbec('0xcc')](path['join'](config[_0xbbec('0x72')],_0xbbec('0xb4'),_0xbbec('0xcd'),_0xbbec('0xce')),{'interaction':_0x598aad})[_0xbbec('0x17')](function(_0x160619){var _0x41b01c=path[_0xbbec('0x71')](_0x2479bd,'transcript-'+_0x4a3dd1['id']+'-'+_0x4d94d4+'.pdf');var _0x1ecf0f={'path':_0x41b01c,'channel':_0xbbec('0xbf'),'interactionId':_0x4a3dd1['id']};return pdf[_0xbbec('0xcf')](_0x160619,_0x1ecf0f);})[_0xbbec('0x17')](function(){return new Promise(function(_0x44f768,_0x355195){zipdir(_0x2479bd,{'saveTo':_0xd2a4e0},function(_0x4d502f,_0x43e65c){if(_0x4d502f)return _0x355195(_0x4d502f);return _0x44f768(_0x43e65c);});})[_0xbbec('0x17')](function(){return new BPromise(function(_0x5fe8f,_0x3a21b8){rimraf(_0x2479bd,function(_0x43886d){if(_0x43886d)_0x3a21b8(_0x43886d);return _0x5fe8f();});});})[_0xbbec('0x17')](function(){return _0x3ee3b9[_0xbbec('0x75')](_0xd2a4e0,_0x34d09c,function(_0xc7fbf5){if(_0xc7fbf5){logger[_0xbbec('0x1c')]('err',_0xc7fbf5);}else{fs['unlinkSync'](_0xd2a4e0);}});});});}else{return _0x3ee3b9[_0xbbec('0x62')](0xc8);}})[_0xbbec('0x21')](handleError(_0x3ee3b9,null));}; \ No newline at end of file +var _0xd6a8=['secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','nolimit','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','options','includeAgent','push','alias','addTags','setTags','omit','Tag','emit','removeTags','toString','server','files','tmp','attachments','firstName','read','Account','Owner','Chat','browserName','referer','N.A.','createReadStream','pipe','createWriteStream','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','./chatInteraction.socket','register','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','update','destroy','end','stack','name','merge','body','contact','agent','account','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','user','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','now','pathTranscript','Messages','User','CmContact','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0xd6a8,0x104));var _0x8d6a=function(_0x806639,_0x4e66d1){_0x806639=_0x806639-0x0;var _0x2c99c0=_0xd6a8[_0x806639];return _0x2c99c0;};'use strict';var rimraf=require(_0x8d6a('0x0'));var zipdir=require(_0x8d6a('0x1'));var rp=require(_0x8d6a('0x2'));var moment=require(_0x8d6a('0x3'));var BPromise=require(_0x8d6a('0x4'));var Mustache=require(_0x8d6a('0x5'));var util=require(_0x8d6a('0x6'));var path=require('path');var ejs=require(_0x8d6a('0x7'));var fs=require('fs');var _=require(_0x8d6a('0x8'));var Redis=require(_0x8d6a('0x9'));var interaction=require(_0x8d6a('0xa'));var qs=require(_0x8d6a('0xb'));var pdf=require(_0x8d6a('0xc'));var logger=require(_0x8d6a('0xd'))(_0x8d6a('0xe'));var config=require(_0x8d6a('0xf'));var db=require('../../mysqldb')['db'];config[_0x8d6a('0x10')]=_[_0x8d6a('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d6a('0x10')]));require(_0x8d6a('0x12'))[_0x8d6a('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8d6a('0x14')][_0x8d6a('0x15')]({'port':0x232b});var client9004=jayson[_0x8d6a('0x14')][_0x8d6a('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x1bc985,_0x41316e,_0x449772,_0x3aa064){return new BPromise(function(_0x23b177,_0x3b03cb){var _0x1987a1=_0x3aa064||client;return _0x1987a1['request'](_0x1bc985,_0x449772)[_0x8d6a('0x16')](function(_0x2bf477){logger[_0x8d6a('0x17')](_0x8d6a('0x18'),_0x41316e,_0x8d6a('0x19'));logger[_0x8d6a('0x1a')](_0x8d6a('0x1b'),_0x41316e,'request\x20sent',JSON[_0x8d6a('0x1c')](_0x2bf477));if(_0x2bf477[_0x8d6a('0x1d')]){if(_0x2bf477[_0x8d6a('0x1d')][_0x8d6a('0x1e')]===0x1f4){logger[_0x8d6a('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x41316e,_0x2bf477['error']['message']);return _0x3b03cb(_0x2bf477[_0x8d6a('0x1d')][_0x8d6a('0x1f')]);}logger['error'](_0x8d6a('0x18'),_0x41316e,_0x2bf477['error'][_0x8d6a('0x1f')]);return _0x23b177(_0x2bf477[_0x8d6a('0x1d')][_0x8d6a('0x1f')]);}else{logger[_0x8d6a('0x17')](_0x8d6a('0x18'),_0x41316e,_0x8d6a('0x19'));_0x23b177(_0x2bf477[_0x8d6a('0x20')][_0x8d6a('0x1f')]);}})[_0x8d6a('0x21')](function(_0x47db33){logger[_0x8d6a('0x1d')](_0x8d6a('0x18'),_0x41316e,_0x47db33);_0x3b03cb(_0x47db33);});});}function respondWithStatusCode(_0x5b576c,_0x25d02d){_0x25d02d=_0x25d02d||0xcc;return function(_0x783a6b){if(_0x783a6b){return _0x5b576c[_0x8d6a('0x22')](_0x25d02d);}return _0x5b576c[_0x8d6a('0x23')](_0x25d02d)['end']();};}function respondWithResult(_0x50610c,_0x14d3da){_0x14d3da=_0x14d3da||0xc8;return function(_0x272b61){if(_0x272b61){return _0x50610c['status'](_0x14d3da)[_0x8d6a('0x24')](_0x272b61);}};}function respondWithFilteredResult(_0x1d736d,_0x334555){return function(_0x7f5374){if(_0x7f5374){var _0x357159=typeof _0x334555['offset']===_0x8d6a('0x25')&&typeof _0x334555[_0x8d6a('0x26')]===_0x8d6a('0x25');var _0x3befae=_0x7f5374[_0x8d6a('0x27')];var _0x18d4b3=_0x357159?0x0:_0x334555[_0x8d6a('0x28')];var _0x4a33c5=_0x357159?_0x7f5374[_0x8d6a('0x27')]:_0x334555['offset']+_0x334555['limit'];var _0x13143d;if(_0x4a33c5>=_0x3befae){_0x4a33c5=_0x3befae;_0x13143d=0xc8;}else{_0x13143d=0xce;}_0x1d736d[_0x8d6a('0x23')](_0x13143d);return _0x1d736d['set']('Content-Range',_0x18d4b3+'-'+_0x4a33c5+'/'+_0x3befae)[_0x8d6a('0x24')](_0x7f5374);}return null;};}function saveUpdates(_0xab4786){return function(_0x1bdd7d){if(_0x1bdd7d){return _0x1bdd7d[_0x8d6a('0x29')](_0xab4786)[_0x8d6a('0x16')](function(_0x30cc25){return _0x30cc25;});}return null;};}function removeEntity(_0x224d55){return function(_0x1d1ab3){if(_0x1d1ab3){return _0x1d1ab3[_0x8d6a('0x2a')]()[_0x8d6a('0x16')](function(){_0x224d55[_0x8d6a('0x23')](0xcc)[_0x8d6a('0x2b')]();});}};}function handleEntityNotFound(_0x45550e){return function(_0x168727){if(!_0x168727){_0x45550e[_0x8d6a('0x22')](0x194);}return _0x168727;};}function handleError(_0xf4a341,_0x67e11d){_0x67e11d=_0x67e11d||0x1f4;return function(_0x495763){logger[_0x8d6a('0x1d')](_0x495763[_0x8d6a('0x2c')]);if(_0x495763[_0x8d6a('0x2d')]){delete _0x495763['name'];}_0xf4a341[_0x8d6a('0x23')](_0x67e11d)['send'](_0x495763);};}function getMustacheRender(_0x1c10b3,_0x272eb5){return Mustache['render'](_0x1c10b3,_[_0x8d6a('0x2e')](_0x272eb5[_0x8d6a('0x2f')],{'contact':_0x272eb5[_0x8d6a('0x30')],'message':_0x272eb5[_0x8d6a('0x1f')],'agent':_0x272eb5[_0x8d6a('0x31')],'interaction':_0x272eb5['interaction'],'account':_0x272eb5[_0x8d6a('0x32')]}))||'';}exports['index']=function(_0x3086d6,_0x25be80){var _0x149b3a={};var _0x47c5e8=_[_0x8d6a('0x33')](db[_0x8d6a('0x34')][_0x8d6a('0x35')],function(_0x23c071){return{'name':_0x23c071[_0x8d6a('0x36')],'type':_0x23c071[_0x8d6a('0x37')][_0x8d6a('0x38')]};});_0x149b3a=qs[_0x8d6a('0x39')](_0x47c5e8,_0x3086d6);return interaction[_0x8d6a('0x3a')](_0x8d6a('0x3b'),_0x3086d6[_0x8d6a('0x3c')],_0x3086d6['user'],_0x149b3a,_0x47c5e8)['then'](respondWithFilteredResult(_0x25be80,_0x149b3a))[_0x8d6a('0x21')](handleError(_0x25be80,null));};exports['show']=function(_0x3408c0,_0x2d9015){var _0x25f8fa={'raw':![],'where':{'id':_0x3408c0[_0x8d6a('0x3d')]['id']}},_0x2a4627={};_0x2a4627[_0x8d6a('0x3e')]=_[_0x8d6a('0x3f')](db[_0x8d6a('0x34')]['rawAttributes']);_0x2a4627['query']=_[_0x8d6a('0x3f')](_0x3408c0[_0x8d6a('0x3c')]);_0x2a4627[_0x8d6a('0x40')]=_[_0x8d6a('0x41')](_0x2a4627[_0x8d6a('0x3e')],_0x2a4627['query']);_0x25f8fa[_0x8d6a('0x42')]=_[_0x8d6a('0x41')](_0x2a4627['model'],qs['fields'](_0x3408c0[_0x8d6a('0x3c')][_0x8d6a('0x43')]));_0x25f8fa[_0x8d6a('0x42')]=_0x25f8fa[_0x8d6a('0x42')][_0x8d6a('0x44')]?_0x25f8fa['attributes']:_0x2a4627['model'];if(_0x3408c0[_0x8d6a('0x3c')][_0x8d6a('0x45')]){_0x25f8fa[_0x8d6a('0x46')]=[{'all':!![]}];}_0x25f8fa=_[_0x8d6a('0x2e')]({},_0x25f8fa,_0x3408c0['options']);return db[_0x8d6a('0x34')][_0x8d6a('0x47')](_0x25f8fa)[_0x8d6a('0x16')](handleEntityNotFound(_0x2d9015,null))[_0x8d6a('0x16')](respondWithResult(_0x2d9015,null))[_0x8d6a('0x21')](handleError(_0x2d9015,null));};exports[_0x8d6a('0x48')]=function(_0x407abf,_0x4c1fef){return db[_0x8d6a('0x34')][_0x8d6a('0x48')](_0x407abf['body'],{})[_0x8d6a('0x16')](respondWithResult(_0x4c1fef,0xc9))[_0x8d6a('0x21')](handleError(_0x4c1fef,null));};exports[_0x8d6a('0x29')]=function(_0x5d620c,_0x2eeccc){if(_0x5d620c[_0x8d6a('0x2f')]['id']){delete _0x5d620c[_0x8d6a('0x2f')]['id'];}return db[_0x8d6a('0x34')][_0x8d6a('0x47')]({'where':{'id':_0x5d620c[_0x8d6a('0x3d')]['id']}})[_0x8d6a('0x16')](handleEntityNotFound(_0x2eeccc,null))['then'](saveUpdates(_0x5d620c[_0x8d6a('0x2f')],null))[_0x8d6a('0x16')](respondWithResult(_0x2eeccc,null))['catch'](handleError(_0x2eeccc,null));};exports[_0x8d6a('0x2a')]=function(_0x388a03,_0x5abd93){return db[_0x8d6a('0x34')][_0x8d6a('0x47')]({'where':{'id':_0x388a03[_0x8d6a('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5abd93,null))[_0x8d6a('0x16')](removeEntity(_0x5abd93,null))[_0x8d6a('0x21')](handleError(_0x5abd93,null));};exports[_0x8d6a('0x49')]=function(_0x3f8814,_0x929f40){return db[_0x8d6a('0x34')]['describe']()[_0x8d6a('0x16')](respondWithResult(_0x929f40,null))[_0x8d6a('0x21')](handleError(_0x929f40,null));};exports[_0x8d6a('0x4a')]=function(_0xf651d3,_0x3f5dc4){var _0x4b90fa=_0xf651d3[_0x8d6a('0x3d')]['id'];var _0x34f240;var _0x91eed9;var _0x2eb57d;return db[_0x8d6a('0x34')][_0x8d6a('0x4b')]({'where':{'id':_0x4b90fa}})[_0x8d6a('0x16')](function(_0x46a825){_0x34f240=_0x46a825;return db[_0x8d6a('0x4c')][_0x8d6a('0x4b')]({'where':{'id':_0x46a825[_0x8d6a('0x4d')]},'attributes':['id',_0x8d6a('0x4e'),_0x8d6a('0x4f'),'vidaooTopic',_0x8d6a('0x50'),_0x8d6a('0x51')],'raw':!![]});})[_0x8d6a('0x16')](function(_0x1a34ad){if(_0x1a34ad&&_0x1a34ad[_0x8d6a('0x4e')]&&_0x1a34ad[_0x8d6a('0x4f')]){_0x91eed9=_0x1a34ad;var _0x5a5d3b={'interaction':{'id':_0x4b90fa},'agent':{'id':_0xf651d3[_0x8d6a('0x52')]['id'],'name':_0xf651d3['user']['name'],'fullname':_0xf651d3[_0x8d6a('0x52')][_0x8d6a('0x53')],'email':_0xf651d3[_0x8d6a('0x52')][_0x8d6a('0x54')]},'contact':_0xf651d3[_0x8d6a('0x2f')][_0x8d6a('0x30')],'account':_0xf651d3[_0x8d6a('0x2f')][_0x8d6a('0x32')]};var _0xe1b000={'rejectUnauthorized':![],'method':'POST','url':_0x8d6a('0x55'),'headers':{'X-APIKEY':_0x1a34ad[_0x8d6a('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xf651d3[_0x8d6a('0x52')][_0x8d6a('0x54')]],'buttons':null,'topic':_0x91eed9['vidaooTopic'],'note':_[_0x8d6a('0x56')](_0x91eed9[_0x8d6a('0x50')])?null:getMustacheRender(_0x91eed9['vidaooNote'],_0x5a5d3b),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x8d6a('0x56')](_0x91eed9[_0x8d6a('0x51')])){var _0x54f03c=getMustacheRender(_0x91eed9[_0x8d6a('0x51')],_0x5a5d3b);var _0x1c5a6d=JSON['parse'](_0x54f03c);_0xe1b000['body'][_0x8d6a('0x57')]=_0x1c5a6d;}}catch(_0x1754d1){throw new db['Sequelize']['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xe1b000);}else{throw new db[(_0x8d6a('0x58'))][(_0x8d6a('0x59'))](_0x8d6a('0x5a'));}})[_0x8d6a('0x16')](function(_0x3f45be){_0x2eb57d=_0x3f45be;if(_0x2eb57d['id']){var _0x4aafd0={'body':_0x2eb57d[_0x8d6a('0x5b')],'ChatWebsiteId':_0x91eed9['id'],'ChatInteractionId':_0x34f240['id'],'direction':_0x8d6a('0x5c'),'UserId':_0xf651d3[_0x8d6a('0x52')]['id']};return db[_0x8d6a('0x5d')][_0x8d6a('0x48')](_0x4aafd0,{});}else{throw new db[(_0x8d6a('0x58'))]['ValidationError'](_0x8d6a('0x5e'));}})[_0x8d6a('0x16')](function(){return _0x34f240[_0x8d6a('0x5f')]({'vidaooSessionId':_0x2eb57d['id']});})[_0x8d6a('0x16')](respondWithResult(_0x3f5dc4,null))[_0x8d6a('0x21')](handleError(_0x3f5dc4,null));};exports[_0x8d6a('0x60')]=function(_0x2540ce,_0x3fab02){if(_0x2540ce[_0x8d6a('0x2f')]['id']){delete _0x2540ce[_0x8d6a('0x2f')]['id'];}return db['ChatInteraction'][_0x8d6a('0x47')]({'where':{'id':_0x2540ce[_0x8d6a('0x3d')]['id']},'include':[{'model':db['CmContact'],'as':_0x8d6a('0x61')}]})['then'](handleEntityNotFound(_0x3fab02,null))[_0x8d6a('0x16')](saveUpdates(_0x2540ce[_0x8d6a('0x2f')],null))[_0x8d6a('0x16')](respondWithResult(_0x3fab02,null))[_0x8d6a('0x21')](handleError(_0x3fab02,null));};exports['abandon']=function(_0x507f56,_0x1a371f){if(_0x507f56[_0x8d6a('0x2f')]['id']){delete _0x507f56[_0x8d6a('0x2f')]['id'];}return db[_0x8d6a('0x34')][_0x8d6a('0x47')]({'where':{'id':_0x507f56['params']['id']}})['then'](function(_0x3e5a17){if(!_0x3e5a17){logger[_0x8d6a('0x1d')](_0x8d6a('0x62'),'abandon',0x194,_0x8d6a('0x63'));_0x1a371f['sendStatus'](0x194);}else{if(_0x3e5a17[_0x8d6a('0x64')]){throw new db['Sequelize'][(_0x8d6a('0x59'))](_0x8d6a('0x65'));}}return _0x3e5a17;})[_0x8d6a('0x16')](function(_0x4d0470){if(_0x4d0470){return _0x4d0470[_0x8d6a('0x29')]({'closed':_0x507f56[_0x8d6a('0x2f')][_0x8d6a('0x66')],'disposition':_0x507f56[_0x8d6a('0x2f')][_0x8d6a('0x67')]})[_0x8d6a('0x16')](function(_0x7bd077){return _0x7bd077;});}})[_0x8d6a('0x16')](function(){return respondWithRpcPromise(_0x8d6a('0x68'),_0x8d6a('0x69'),_0x507f56[_0x8d6a('0x2f')],client9004);})['then'](respondWithResult(_0x1a371f,null))[_0x8d6a('0x21')](handleError(_0x1a371f,null));};exports[_0x8d6a('0x6a')]=function(_0x56d4ab,_0x48342c){_0x56d4ab['body'][_0x8d6a('0x2d')]=_0x56d4ab['file'][_0x8d6a('0x6b')];_0x56d4ab[_0x8d6a('0x2f')][_0x8d6a('0x6c')]=_0x56d4ab['file'][_0x8d6a('0x6d')];_0x56d4ab[_0x8d6a('0x2f')][_0x8d6a('0x37')]=_0x56d4ab['file'][_0x8d6a('0x6e')];return db[_0x8d6a('0x6f')][_0x8d6a('0x48')](_0x56d4ab[_0x8d6a('0x2f')])[_0x8d6a('0x16')](respondWithResult(_0x48342c,0xc9))[_0x8d6a('0x21')](handleError(_0x48342c,null));};exports[_0x8d6a('0x70')]=function(_0x1ffcb7,_0x2e6e3f){return db['ChatInteraction'][_0x8d6a('0x4b')]({'where':{'id':_0x1ffcb7[_0x8d6a('0x3d')]['id']},'raw':!![]})[_0x8d6a('0x16')](handleEntityNotFound(_0x2e6e3f,null))['then'](function(_0x273de1){if(_0x273de1){if(_0x273de1[_0x8d6a('0x66')]){return _0x2e6e3f['status'](0x193)['json']({'status':0x193,'message':_0x8d6a('0x71')});}return db[_0x8d6a('0x6f')][_0x8d6a('0x4b')]({'where':{'id':_0x1ffcb7[_0x8d6a('0x3c')]['attachId']},'raw':!![]})[_0x8d6a('0x16')](handleEntityNotFound(_0x2e6e3f,null));}})[_0x8d6a('0x16')](function(_0xfca71f){if(_0xfca71f){var _0x1a40af=_0xfca71f[_0x8d6a('0x72')]!==null;var _0x7e2006=path[_0x8d6a('0x73')](config[_0x8d6a('0x74')],'server/files/attachments/');if(_0x1a40af){_0x7e2006=path[_0x8d6a('0x73')](_0x7e2006,_0x8d6a('0x75'));}var _0x11aac7=path['join'](_0x7e2006,_0xfca71f['basename']);return _0x2e6e3f[_0x8d6a('0x76')](_0x11aac7);}})[_0x8d6a('0x21')](handleError(_0x2e6e3f,null));};exports[_0x8d6a('0x77')]=function(_0x519346,_0x1375d1){var _0x48a687=null;var _0x5b6c42=null;var _0xdd0de9=null;if(_0x519346[_0x8d6a('0x2f')]['id']){delete _0x519346[_0x8d6a('0x2f')]['id'];}if(_0x519346[_0x8d6a('0x2f')][_0x8d6a('0x78')]){_0xdd0de9=path['join'](config[_0x8d6a('0x74')],_0x8d6a('0x79'),util[_0x8d6a('0x7a')]('transcript-%s.txt',Date[_0x8d6a('0x7b')]()));_0x519346[_0x8d6a('0x2f')][_0x8d6a('0x7c')]=_0xdd0de9;}return db[_0x8d6a('0x34')][_0x8d6a('0x47')]({'where':{'id':_0x519346['params']['id']},'include':[{'model':db[_0x8d6a('0x5d')],'as':_0x8d6a('0x7d'),'include':[{'model':db[_0x8d6a('0x7e')],'as':'User'}]}]})[_0x8d6a('0x16')](handleEntityNotFound(_0x1375d1,null))[_0x8d6a('0x16')](saveUpdates(_0x519346['body'],null))[_0x8d6a('0x16')](function(_0x34490c){if(_0x34490c){_0x48a687=_0x34490c;return db[_0x8d6a('0x4c')][_0x8d6a('0x47')]({'where':{'id':_0x48a687['ChatWebsiteId']}});}})['then'](function(_0x3a6e07){if(_0x3a6e07){_0x5b6c42=_0x3a6e07;return db[_0x8d6a('0x7f')][_0x8d6a('0x47')]({'where':{'id':_0x48a687[_0x8d6a('0x80')]}});}})[_0x8d6a('0x16')](function(_0x240bac){if(_0x240bac){if(_0xdd0de9){var _0x1af333=null;for(var _0xdbc3f=0x1;_0xdbc3f<_0x48a687[_0x8d6a('0x7d')]['length'];++_0xdbc3f){_0x1af333=_0x48a687[_0x8d6a('0x7d')][_0xdbc3f];var _0xd5e069=_0x1af333[_0x8d6a('0x64')]?util[_0x8d6a('0x7a')](_0x8d6a('0x81'),_0x5b6c42[_0x8d6a('0x82')],_0x1af333['UserId']):_0x8d6a('0x83');var _0x3e00ba=_0x519346[_0x8d6a('0x2f')][_0x8d6a('0x84')]||util['format'](_0x8d6a('0x81'),_0x8d6a('0x85'),_0x1af333['ContactId']);switch(_0x5b6c42[_0x8d6a('0x86')]){case'website_alias':_0xd5e069=_0x1af333[_0x8d6a('0x64')]?util[_0x8d6a('0x7a')](_0x8d6a('0x81'),_0x5b6c42[_0x8d6a('0x82')],_0x1af333[_0x8d6a('0x64')]):_0x8d6a('0x83');break;case _0x8d6a('0x87'):_0xd5e069=_0x1af333['UserId']?_0x1af333[_0x8d6a('0x7e')]['alias']||_0x1af333[_0x8d6a('0x7e')]['fullname']:'System';break;case _0x8d6a('0x88'):_0xd5e069=_0x1af333[_0x8d6a('0x64')]?_0x1af333[_0x8d6a('0x7e')][_0x8d6a('0x53')]:_0x8d6a('0x83');break;default:_0xd5e069=_0x1af333[_0x8d6a('0x64')]?util['format'](_0x8d6a('0x81'),_0x5b6c42['agentAlias'],_0x1af333[_0x8d6a('0x64')]):'System';}var _0x42e4ec=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x1af333[_0x8d6a('0x89')])[_0x8d6a('0x7a')](_0x8d6a('0x8a')),_0x1af333[_0x8d6a('0x8b')]==='in'?_0x3e00ba:_0xd5e069,_0x1af333[_0x8d6a('0x2f')]);if(!_0x1af333[_0x8d6a('0x8c')]){fs[_0x8d6a('0x8d')](_0xdd0de9,_0x42e4ec);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x8d6a('0x8e')],'as':_0x8d6a('0x8f'),'raw':!![],'include':[{'model':db[_0x8d6a('0x90')],'as':_0x8d6a('0x90'),'raw':!![]}]}]});}}})['then'](function(_0x212588){if(!_0x212588||!_0x212588[_0x8d6a('0x8f')]||!_0x519346[_0x8d6a('0x2f')])return _0x48a687;var _0x29cd99=_0x212588[_0x8d6a('0x91')]();return respondWithRpcPromise(_0x8d6a('0x92'),_0x8d6a('0x93'),{'account':_0x29cd99,'message':{'from':util[_0x8d6a('0x7a')](_0x8d6a('0x94'),_0x212588['name'],_0x212588[_0x8d6a('0x54')]||_0x212588[_0x8d6a('0x8f')][_0x8d6a('0x52')]),'to':_0x519346[_0x8d6a('0x2f')][_0x8d6a('0x78')],'subject':_0x8d6a('0x95'),'text':util[_0x8d6a('0x7a')](_0x8d6a('0x96'),_0x519346[_0x8d6a('0x2f')][_0x8d6a('0x78')]),'attachments':[{'path':_0xdd0de9}]}})[_0x8d6a('0x16')](function(){return _0x48a687;})[_0x8d6a('0x21')](function(_0x528e55){logger[_0x8d6a('0x1d')](_0x528e55);});})[_0x8d6a('0x16')](respondWithStatusCode(_0x1375d1,0xc8))[_0x8d6a('0x21')](handleError(_0x1375d1,null));};exports['addMessage']=function(_0x8f37a6,_0x22f18e){return db[_0x8d6a('0x5d')]['find']({'where':{'id':_0x8f37a6[_0x8d6a('0x3d')]['id']}})[_0x8d6a('0x16')](handleEntityNotFound(_0x22f18e,null))[_0x8d6a('0x16')](function(_0x4f1984){if(_0x4f1984){return _0x4f1984[_0x8d6a('0x97')](_0x8f37a6[_0x8d6a('0x2f')][_0x8d6a('0x98')],_['omit'](_0x8f37a6[_0x8d6a('0x2f')],[_0x8d6a('0x98'),'id'])||{});}})[_0x8d6a('0x16')](respondWithResult(_0x22f18e,null))[_0x8d6a('0x21')](handleError(_0x22f18e,null));};exports[_0x8d6a('0x99')]=function(_0x44aa55,_0xf9ea87){var _0x25a131={'raw':![],'where':{}};var _0x4c4851={};var _0xf853b7={'count':0x0,'rows':[]};return db[_0x8d6a('0x34')][_0x8d6a('0x4b')]({'where':{'id':_0x44aa55['params']['id']}})[_0x8d6a('0x16')](handleEntityNotFound(_0xf9ea87,null))[_0x8d6a('0x16')](function(_0x110868){if(_0x110868){_0x4c4851[_0x8d6a('0x3e')]=_[_0x8d6a('0x3f')](db[_0x8d6a('0x5d')][_0x8d6a('0x35')]);_0x4c4851['query']=_[_0x8d6a('0x3f')](_0x44aa55[_0x8d6a('0x3c')]);_0x4c4851['filters']=_[_0x8d6a('0x41')](_0x4c4851['model'],_0x4c4851[_0x8d6a('0x3c')]);_0x25a131[_0x8d6a('0x42')]=_[_0x8d6a('0x41')](_0x4c4851[_0x8d6a('0x3e')],qs['fields'](_0x44aa55[_0x8d6a('0x3c')]['fields']));_0x25a131[_0x8d6a('0x42')]=_0x25a131['attributes'][_0x8d6a('0x44')]?_0x25a131[_0x8d6a('0x42')]:_0x4c4851['model'];if(!_0x44aa55[_0x8d6a('0x3c')]['hasOwnProperty'](_0x8d6a('0x9a'))){_0x25a131['limit']=qs['limit'](_0x44aa55['query']['limit']);_0x25a131[_0x8d6a('0x28')]=qs['offset'](_0x44aa55[_0x8d6a('0x3c')]['offset']);}_0x25a131['order']=qs[_0x8d6a('0x9b')](_0x44aa55[_0x8d6a('0x3c')][_0x8d6a('0x9b')]);_0x25a131[_0x8d6a('0x9c')]=qs['filters'](_[_0x8d6a('0x9d')](_0x44aa55[_0x8d6a('0x3c')],_0x4c4851['filters']));_0x25a131['where'][_0x8d6a('0x9e')]=_0x110868['id'];if(_0x44aa55['query'][_0x8d6a('0x9f')]){_0x25a131[_0x8d6a('0x9c')]=_[_0x8d6a('0x2e')](_0x25a131[_0x8d6a('0x9c')],{'$or':_[_0x8d6a('0x33')](_0x25a131['attributes'],function(_0xba86f9){var _0x5d4ffa={};_0x5d4ffa[_0xba86f9]={'$like':'%'+_0x44aa55[_0x8d6a('0x3c')]['filter']+'%'};return _0x5d4ffa;})});}if(_0x44aa55[_0x8d6a('0x3c')][_0x8d6a('0xa0')]){var _0x29e33e=_0x44aa55[_0x8d6a('0x3c')][_0x8d6a('0xa0')]['split'](',');var _0x4237a4={};_0x4237a4[_0x29e33e[0x0]]={'$gte':moment(_0x29e33e[0x1])[_0x8d6a('0x7a')](_0x8d6a('0xa1'))};_0x25a131[_0x8d6a('0x9c')]=_[_0x8d6a('0x2e')](_0x25a131['where'],_0x4237a4);}_0x25a131=_[_0x8d6a('0x2e')]({},_0x25a131,_0x44aa55['options']);return db[_0x8d6a('0x5d')][_0x8d6a('0x27')]({'where':_0x25a131[_0x8d6a('0x9c')]})['then'](function(_0x3d9467){_0xf853b7[_0x8d6a('0x27')]=_0x3d9467;if(_0x44aa55[_0x8d6a('0x3c')][_0x8d6a('0x45')]){_0x25a131['include']=[{'all':!![]}];}return db[_0x8d6a('0x5d')][_0x8d6a('0x3a')](_0x25a131);})[_0x8d6a('0x16')](function(_0x310cd9){_0xf853b7[_0x8d6a('0xa2')]=_0x310cd9;return _0xf853b7;});}})[_0x8d6a('0x16')](respondWithFilteredResult(_0xf9ea87,_0x25a131))[_0x8d6a('0x21')](handleError(_0xf9ea87,null));};exports[_0x8d6a('0xa3')]=function(_0x4b4560,_0x3307c3){var _0xdb1498={'where':{}},_0x1d69c6={},_0x3a6ca9={'count':0x0,'rows':[]};return db[_0x8d6a('0x34')][_0x8d6a('0x4b')]({'where':{'id':_0x4b4560[_0x8d6a('0x3d')]['id']}})[_0x8d6a('0x16')](handleEntityNotFound(_0x3307c3,null))[_0x8d6a('0x16')](function(_0x3cb9fa){if(_0x3cb9fa){_0x1d69c6[_0x8d6a('0x3e')]=_[_0x8d6a('0x3f')](db['ChatMessage'][_0x8d6a('0x35')]);_0x1d69c6[_0x8d6a('0x3c')]=_[_0x8d6a('0x3f')](_0x4b4560[_0x8d6a('0x3c')]);_0x1d69c6[_0x8d6a('0x40')]=_[_0x8d6a('0x41')](_0x1d69c6[_0x8d6a('0x3e')],_0x1d69c6[_0x8d6a('0x3c')]);_0xdb1498['attributes']=_[_0x8d6a('0x41')](_0x1d69c6[_0x8d6a('0x3e')],qs[_0x8d6a('0x43')](_0x4b4560[_0x8d6a('0x3c')][_0x8d6a('0x43')]));_0xdb1498[_0x8d6a('0x42')]=_0xdb1498[_0x8d6a('0x42')][_0x8d6a('0x44')]?_0xdb1498[_0x8d6a('0x42')]:_0x1d69c6[_0x8d6a('0x3e')];if(!_0x4b4560[_0x8d6a('0x3c')]['hasOwnProperty'](_0x8d6a('0x9a'))){_0xdb1498[_0x8d6a('0x26')]=qs[_0x8d6a('0x26')](_0x4b4560[_0x8d6a('0x3c')][_0x8d6a('0x26')]);_0xdb1498[_0x8d6a('0x28')]=qs[_0x8d6a('0x28')](_0x4b4560[_0x8d6a('0x3c')]['offset']);}_0xdb1498['order']=qs[_0x8d6a('0x9b')](_0x4b4560[_0x8d6a('0x3c')][_0x8d6a('0x9b')]);_0xdb1498[_0x8d6a('0x9c')]=qs[_0x8d6a('0x40')](_[_0x8d6a('0x9d')](_0x4b4560[_0x8d6a('0x3c')],_0x1d69c6[_0x8d6a('0x40')]));_0xdb1498['where'][_0x8d6a('0x9e')]=_0x3cb9fa['id'];if(_0x4b4560[_0x8d6a('0x3c')][_0x8d6a('0x9f')]){_0xdb1498[_0x8d6a('0x9c')]=_['merge'](_0xdb1498['where'],{'$or':_['map'](_0xdb1498[_0x8d6a('0x42')],function(_0x15493a){var _0x56073f={};_0x56073f[_0x15493a]={'$like':'%'+_0x4b4560[_0x8d6a('0x3c')]['filter']+'%'};return _0x56073f;})});}_0xdb1498[_0x8d6a('0x9c')][_0x8d6a('0x8c')]=![];if(_0x4b4560['query']['id']){_0xdb1498[_0x8d6a('0x9c')]['id']={'$gt':_0x4b4560[_0x8d6a('0x3c')]['id']};}_0xdb1498=_['merge']({},_0xdb1498,_0x4b4560[_0x8d6a('0xa4')]);return db['ChatMessage']['count']({'where':_0xdb1498['where']})['then'](function(_0x21fb79){_0x3a6ca9[_0x8d6a('0x27')]=_0x21fb79;_0xdb1498['include']=[];if(_0x4b4560['query'][_0x8d6a('0xa5')]){_0xdb1498[_0x8d6a('0x46')][_0x8d6a('0xa6')]({'model':db[_0x8d6a('0x7e')],'as':_0x8d6a('0x7e'),'attributes':['id',_0x8d6a('0x53'),_0x8d6a('0xa7')]});}if(_0x4b4560[_0x8d6a('0x3c')][_0x8d6a('0x45')]){_0xdb1498[_0x8d6a('0x46')]=[{'all':!![]}];}return db[_0x8d6a('0x5d')][_0x8d6a('0x3a')](_0xdb1498);})[_0x8d6a('0x16')](function(_0x5eb818){_0x3a6ca9['rows']=_0x5eb818;return _0x3a6ca9;});}})[_0x8d6a('0x16')](respondWithFilteredResult(_0x3307c3,_0xdb1498))[_0x8d6a('0x21')](handleError(_0x3307c3,null));};exports[_0x8d6a('0xa8')]=function(_0x4c20c7,_0x110a3e){return db[_0x8d6a('0x34')][_0x8d6a('0x47')]({'where':{'id':_0x4c20c7['params']['id']}})[_0x8d6a('0x16')](handleEntityNotFound(_0x110a3e,null))['then'](function(_0x224960){if(_0x224960){return _0x224960[_0x8d6a('0xa9')](_0x4c20c7[_0x8d6a('0x2f')][_0x8d6a('0x98')],_[_0x8d6a('0xaa')](_0x4c20c7[_0x8d6a('0x2f')],[_0x8d6a('0x98'),'id'])||{})['spread'](function(){return db[_0x8d6a('0xab')]['findAll']({'attributes':['id',_0x8d6a('0x2d'),'color'],'where':{'id':_0x4c20c7[_0x8d6a('0x2f')][_0x8d6a('0x98')]}});})[_0x8d6a('0x16')](function(_0x39962c){socket[_0x8d6a('0xac')]('chatInteractionTags:save',{'id':Number(_0x4c20c7[_0x8d6a('0x3d')]['id']),'tags':_0x39962c||[]});return{'id':Number(_0x4c20c7['params']['id']),'tags':_0x39962c||[]};});}})['then'](respondWithResult(_0x110a3e,null))[_0x8d6a('0x21')](handleError(_0x110a3e,null));};exports[_0x8d6a('0xad')]=function(_0x5dc93b,_0x580419){return db[_0x8d6a('0x34')][_0x8d6a('0x47')]({'where':{'id':_0x5dc93b[_0x8d6a('0x3d')]['id']}})[_0x8d6a('0x16')](handleEntityNotFound(_0x580419,null))[_0x8d6a('0x16')](function(_0x26743a){if(_0x26743a){return _0x26743a['removeTags'](_0x5dc93b[_0x8d6a('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x580419,null))[_0x8d6a('0x21')](handleError(_0x580419,null));};exports[_0x8d6a('0x76')]=function(_0x52c16d,_0x27c3b4){var _0x1628d6=moment()['unix']()[_0x8d6a('0xae')]();var _0x470841=path[_0x8d6a('0x73')](config['root'],_0x8d6a('0xaf'),_0x8d6a('0xb0'),_0x8d6a('0xb1'));var _0x22b2a3=path[_0x8d6a('0x73')](config[_0x8d6a('0x74')],'server','files',_0x8d6a('0xb2'));var _0x5b0211=path['join'](_0x470841,_0x1628d6);var _0x19330f=util[_0x8d6a('0x7a')]('transcript-%d-%s.zip',_0x52c16d['params']['id'],_0x1628d6);var _0x15445e=path['join'](_0x470841,_0x19330f);var _0x128d52=[];_0x128d52[_0x8d6a('0xa6')]({'model':db[_0x8d6a('0x7e')],'as':_0x8d6a('0x7e'),'attributes':['id','fullname'],'raw':!![]});_0x128d52['push']({'model':db[_0x8d6a('0x7f')],'as':_0x8d6a('0x61'),'attributes':['id',_0x8d6a('0xb3'),'lastName'],'raw':!![]});if(_0x52c16d[_0x8d6a('0x3c')][_0x8d6a('0xb2')]){_0x128d52['push']({'model':db[_0x8d6a('0x6f')],'as':'Attachment','raw':!![]});}var _0x439ce8=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x8d6a('0x2f'),'createdAt',_0x8d6a('0x8b'),_0x8d6a('0x8c'),_0x8d6a('0xb4')],'include':_0x128d52}];_0x439ce8['push']({'model':db[_0x8d6a('0x4c')],'as':_0x8d6a('0xb5'),'attributes':['id','name']});_0x439ce8[_0x8d6a('0xa6')]({'model':db[_0x8d6a('0x7e')],'as':_0x8d6a('0xb6'),'attributes':['id',_0x8d6a('0x53')]});return db[_0x8d6a('0x34')][_0x8d6a('0x47')]({'where':{'id':_0x52c16d[_0x8d6a('0x3d')]['id']},'include':_0x439ce8})[_0x8d6a('0x16')](handleEntityNotFound(_0x27c3b4,null))[_0x8d6a('0x16')](function(_0x192093){if(_0x192093){var _0x129528=_0x192093['get']({'plain':!![]});fs['mkdirSync'](_0x5b0211);var _0x5620f3={'channel':_0x8d6a('0xb7'),'account':_0x129528[_0x8d6a('0xb5')]['name'],'agent':_0x129528[_0x8d6a('0xb6')]?_0x129528[_0x8d6a('0xb6')]['fullname']:'N.A.','createdAt':moment(_0x129528[_0x8d6a('0x89')])['format'](_0x8d6a('0xa1'))[_0x8d6a('0xae')](),'closedAt':_0x129528[_0x8d6a('0x66')]?moment(_0x129528['closedAt'])[_0x8d6a('0x7a')](_0x8d6a('0xa1'))[_0x8d6a('0xae')]():'','disposition':_0x129528[_0x8d6a('0x67')],'chatInfo':{'browser':_0x129528[_0x8d6a('0xb8')],'os':_0x129528['osName'],'referer':_0x129528[_0x8d6a('0xb9')],'customerIp':_0x129528['customerIp'],'customerPort':_0x129528['customerPort']?_0x129528['customerPort']:_0x8d6a('0xba')},'messages':_(_0x129528[_0x8d6a('0x7d')])['tail']()['filter']({'secret':![]})[_0x8d6a('0x33')](function(_0x392b1c){if(_0x392b1c[_0x8d6a('0x6f')]){var _0x2ba28c=path['join'](_0x22b2a3,_0x392b1c[_0x8d6a('0x6f')]['basename']);if(fs['existsSync'](_0x2ba28c)){fs[_0x8d6a('0xbb')](_0x2ba28c)[_0x8d6a('0xbc')](fs[_0x8d6a('0xbd')](path[_0x8d6a('0x73')](_0x5b0211,_0x392b1c['Attachment']['basename'])));}}return{'date':moment(_0x392b1c[_0x8d6a('0x89')])[_0x8d6a('0x7a')](_0x8d6a('0xa1'))['toString'](),'sender':_0x392b1c['direction']==='out'?_0x392b1c['User']?_0x392b1c[_0x8d6a('0x7e')]['fullname']:_0x8d6a('0x83'):_0x392b1c[_0x8d6a('0x61')][_0x8d6a('0xb3')]+(_0x392b1c[_0x8d6a('0x61')][_0x8d6a('0xbe')]?'\x20'+_0x392b1c[_0x8d6a('0x61')]['lastName']:''),'body':_0x392b1c[_0x8d6a('0x6f')]?_0x392b1c[_0x8d6a('0x6f')]['basename']:_0x392b1c[_0x8d6a('0x2f')],'direction':_0x392b1c[_0x8d6a('0x8b')]===_0x8d6a('0x5c')?'A':'C','secret':_0x392b1c[_0x8d6a('0x8c')],'read':_0x392b1c[_0x8d6a('0xb4')],'attachment':_0x392b1c['Attachment']};})[_0x8d6a('0xbf')]()};return ejs[_0x8d6a('0xc0')](path[_0x8d6a('0x73')](config[_0x8d6a('0x74')],'server',_0x8d6a('0xc1'),_0x8d6a('0xc2')),{'interaction':_0x5620f3})['then'](function(_0xb953e5){var _0x15722a=path[_0x8d6a('0x73')](_0x5b0211,_0x8d6a('0xc3')+_0x129528['id']+'-'+_0x1628d6+_0x8d6a('0xc4'));var _0x408965={'path':_0x15722a,'channel':'Chat','interactionId':_0x129528['id']};return pdf[_0x8d6a('0xc5')](_0xb953e5,_0x408965);})[_0x8d6a('0x16')](function(){return new Promise(function(_0x57fd69,_0x373556){zipdir(_0x5b0211,{'saveTo':_0x15445e},function(_0x10644e,_0x33430a){if(_0x10644e)return _0x373556(_0x10644e);return _0x57fd69(_0x33430a);});})['then'](function(){return new BPromise(function(_0x5c9b20,_0x18baa5){rimraf(_0x5b0211,function(_0x1a75b6){if(_0x1a75b6)_0x18baa5(_0x1a75b6);return _0x5c9b20();});});})[_0x8d6a('0x16')](function(){return _0x27c3b4['download'](_0x15445e,_0x19330f,function(_0x4df17d){if(_0x4df17d){logger[_0x8d6a('0x1d')](_0x8d6a('0xc6'),_0x4df17d);}else{fs[_0x8d6a('0xc7')](_0x15445e);}});});});}else{return _0x27c3b4[_0x8d6a('0x22')](0xc8);}})[_0x8d6a('0x21')](handleError(_0x27c3b4,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5c518c8..b18679e 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 _0x0427=['getUsers','then','setDataValue','Users','map','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','remove'];(function(_0x2dec86,_0x16cc68){var _0x496a2c=function(_0x16415c){while(--_0x16415c){_0x2dec86['push'](_0x2dec86['shift']());}};_0x496a2c(++_0x16cc68);}(_0x0427,0x162));var _0x7042=function(_0x240eaf,_0x52caf9){_0x240eaf=_0x240eaf-0x0;var _0x31415e=_0x0427[_0x240eaf];return _0x31415e;};'use strict';var EventEmitter=require(_0x7042('0x0'));var ChatInteraction=require(_0x7042('0x1'))['db'][_0x7042('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x7042('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7042('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7042('0x5')};function emitEvent(_0x3f026e){return function(_0x34214e,_0x54bc67,_0x56179b){_0x34214e[_0x7042('0x6')]({'attributes':['id'],'raw':!![]})[_0x7042('0x7')](function(_0x2a0dd3){_0x34214e[_0x7042('0x8')](_0x7042('0x9'),_0x2a0dd3[_0x7042('0xa')](function(_0x34be9c){return{'id':_0x34be9c['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x34214e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7042('0x7')](function(_0xe3ebae){_0x34214e[_0x7042('0x8')]('unreadMessages',_0xe3ebae['length']);ChatInteractionEvents[_0x7042('0xb')](_0x3f026e+':'+_0x34214e['id'],_0x34214e);ChatInteractionEvents['emit'](_0x3f026e,_0x34214e);_0x56179b(null);})[_0x7042('0xc')](_0x56179b(null));};}for(var e in events){if(events[_0x7042('0xd')](e)){var event=events[e];ChatInteraction[_0x7042('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x42a3=['map','findAll','setDataValue','unreadMessages','length','emit','catch','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','then'];(function(_0x5d33fb,_0x5bf99e){var _0x11733a=function(_0x10b543){while(--_0x10b543){_0x5d33fb['push'](_0x5d33fb['shift']());}};_0x11733a(++_0x5bf99e);}(_0x42a3,0x173));var _0x342a=function(_0x4f13b9,_0x50cdb9){_0x4f13b9=_0x4f13b9-0x0;var _0x524c26=_0x42a3[_0x4f13b9];return _0x524c26;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x342a('0x0'))['db'][_0x342a('0x1')];var ChatMessage=require(_0x342a('0x0'))['db'][_0x342a('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x342a('0x3')](0x0);var events={'afterCreate':_0x342a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x46c6ed){return function(_0x574c5d,_0x417af1,_0x5761b8){_0x574c5d['getUsers']({'attributes':['id'],'raw':!![]})[_0x342a('0x5')](function(_0x28d6fb){_0x574c5d['setDataValue']('Users',_0x28d6fb[_0x342a('0x6')](function(_0x5aca33){return{'id':_0x5aca33['id']};}));return ChatMessage[_0x342a('0x7')]({'where':{'ChatInteractionId':_0x574c5d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x342a('0x5')](function(_0x316fda){_0x574c5d[_0x342a('0x8')](_0x342a('0x9'),_0x316fda[_0x342a('0xa')]);ChatInteractionEvents[_0x342a('0xb')](_0x46c6ed+':'+_0x574c5d['id'],_0x574c5d);ChatInteractionEvents[_0x342a('0xb')](_0x46c6ed,_0x574c5d);_0x5761b8(null);})[_0x342a('0xc')](_0x5761b8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e0f422a..b6522b9 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 _0x983e=['closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatInteraction.attributes','changed','closed'];(function(_0x1a0f96,_0x53d358){var _0x39a842=function(_0x35926b){while(--_0x35926b){_0x1a0f96['push'](_0x1a0f96['shift']());}};_0x39a842(++_0x53d358);}(_0x983e,0x1a8));var _0xe983=function(_0x2ef032,_0x11d73f){_0x2ef032=_0x2ef032-0x0;var _0x151588=_0x983e[_0x2ef032];return _0x151588;};'use strict';var _=require(_0xe983('0x0'));var util=require(_0xe983('0x1'));var logger=require('../../config/logger')(_0xe983('0x2'));var moment=require(_0xe983('0x3'));var BPromise=require(_0xe983('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe983('0x5'));var config=require(_0xe983('0x6'));var attributes=require(_0xe983('0x7'));module['exports']=function(_0x274de9,_0x23d732){return _0x274de9['define']('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x473b3b,_0x5668e4,_0x4725dd){if(_0x473b3b[_0xe983('0x8')](_0xe983('0x9'))){_0x473b3b[_0xe983('0xa')]=moment()['format'](_0xe983('0xb'));}_0x4725dd(null,_0x473b3b);}},'charset':_0xe983('0xc'),'collate':_0xe983('0xd')});}; \ No newline at end of file +var _0xe73b=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe73b,0x17e));var _0xbe73=function(_0x79c6de,_0x10de94){_0x79c6de=_0x79c6de-0x0;var _0x321a56=_0xe73b[_0x79c6de];return _0x321a56;};'use strict';var _=require(_0xbe73('0x0'));var util=require(_0xbe73('0x1'));var logger=require(_0xbe73('0x2'))(_0xbe73('0x3'));var moment=require(_0xbe73('0x4'));var BPromise=require(_0xbe73('0x5'));var rp=require(_0xbe73('0x6'));var fs=require('fs');var path=require(_0xbe73('0x7'));var rimraf=require('rimraf');var config=require(_0xbe73('0x8'));var attributes=require(_0xbe73('0x9'));module[_0xbe73('0xa')]=function(_0x943d51,_0x56cc46){return _0x943d51[_0xbe73('0xb')]('ChatInteraction',attributes,{'tableName':_0xbe73('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x80c887,_0x2f8869,_0x5c49c4){if(_0x80c887[_0xbe73('0xd')](_0xbe73('0xe'))){_0x80c887[_0xbe73('0xf')]=moment()[_0xbe73('0x10')](_0xbe73('0x11'));}_0x5c49c4(null,_0x80c887);}},'charset':_0xbe73('0x12'),'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 333f42d..921e941 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 _0x28df=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatInteraction','body','options','raw','where','attributes','UpdateChatInteraction','AddTagsToChatInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x28df,0x1e6));var _0xf28d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x28df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf28d('0x0'));var util=require(_0xf28d('0x1'));var moment=require(_0xf28d('0x2'));var BPromise=require(_0xf28d('0x3'));var rs=require(_0xf28d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf28d('0x5'));var logger=require(_0xf28d('0x6'))(_0xf28d('0x7'));var config=require(_0xf28d('0x8'));var jayson=require(_0xf28d('0x9'));var client=jayson[_0xf28d('0xa')][_0xf28d('0xb')]({'port':0x232a});config[_0xf28d('0xc')]=_[_0xf28d('0xd')](config[_0xf28d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf28d('0xe'))(new Redis(config[_0xf28d('0xc')]));require(_0xf28d('0xf'))['register'](socket);function respondWithRpcPromise(_0x56f63a,_0x568d81,_0x3fc874){return new BPromise(function(_0x2e3fc9,_0x3a0bf4){return client['request'](_0x56f63a,_0x3fc874)[_0xf28d('0x10')](function(_0x4e83f6){logger[_0xf28d('0x11')](_0xf28d('0x12'),_0x568d81,_0xf28d('0x13'));logger[_0xf28d('0x14')](_0xf28d('0x15'),_0x568d81,_0xf28d('0x13'),JSON[_0xf28d('0x16')](_0x4e83f6));if(_0x4e83f6[_0xf28d('0x17')]){if(_0x4e83f6[_0xf28d('0x17')][_0xf28d('0x18')]===0x1f4){logger[_0xf28d('0x17')](_0xf28d('0x12'),_0x568d81,_0x4e83f6['error'][_0xf28d('0x19')]);return _0x3a0bf4(_0x4e83f6['error'][_0xf28d('0x19')]);}logger[_0xf28d('0x17')](_0xf28d('0x12'),_0x568d81,_0x4e83f6[_0xf28d('0x17')][_0xf28d('0x19')]);return _0x2e3fc9(_0x4e83f6[_0xf28d('0x17')][_0xf28d('0x19')]);}else{logger[_0xf28d('0x11')](_0xf28d('0x12'),_0x568d81,'request\x20sent');_0x2e3fc9(_0x4e83f6[_0xf28d('0x1a')][_0xf28d('0x19')]);}})[_0xf28d('0x1b')](function(_0x4ce1af){logger[_0xf28d('0x17')](_0xf28d('0x12'),_0x568d81,_0x4ce1af);_0x3a0bf4(_0x4ce1af);});});}exports['UpdateChatInteraction']=function(_0x59c552){var _0x5e3279=this;return new Promise(function(_0x290c04,_0x124c2b){return db[_0xf28d('0x1c')]['update'](_0x59c552[_0xf28d('0x1d')],{'raw':_0x59c552['options']?_0x59c552[_0xf28d('0x1e')][_0xf28d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59c552[_0xf28d('0x1e')]?_0x59c552[_0xf28d('0x1e')][_0xf28d('0x20')]||null:null,'attributes':_0x59c552[_0xf28d('0x1e')]?_0x59c552[_0xf28d('0x1e')][_0xf28d('0x21')]||null:null,'limit':_0x59c552[_0xf28d('0x1e')]?_0x59c552[_0xf28d('0x1e')]['limit']||null:null})['then'](function(_0xd21ff3){logger['info']('UpdateChatInteraction',_0x59c552);logger[_0xf28d('0x14')](_0xf28d('0x22'),_0x59c552,JSON[_0xf28d('0x16')](_0xd21ff3));_0x290c04(_0xd21ff3);})['catch'](function(_0xb65cea){logger['error']('UpdateChatInteraction',_0xb65cea[_0xf28d('0x19')],_0x59c552);_0x124c2b(_0x5e3279['error'](0x1f4,_0xb65cea[_0xf28d('0x19')]));});});};exports[_0xf28d('0x23')]=function(_0xa7e155){return new Promise(function(_0xeeea7d,_0x188f79){return db['ChatInteraction'][_0xf28d('0x24')]({'where':_0xa7e155[_0xf28d('0x1e')]?_0xa7e155[_0xf28d('0x1e')]['where']||null:null})[_0xf28d('0x10')](function(_0x24dea5){if(_0x24dea5){return _0x24dea5['addTags'](_0xa7e155[_0xf28d('0x1d')][_0xf28d('0x25')],_[_0xf28d('0x26')](_0xa7e155[_0xf28d('0x1d')],[_0xf28d('0x25'),'id'])||{});}})[_0xf28d('0x27')](function(_0x464fa4){logger[_0xf28d('0x11')]('AddTags',_0xa7e155);logger['debug'](_0xf28d('0x28'),_0xa7e155,JSON[_0xf28d('0x16')](_0x464fa4));_0xeeea7d(_0x464fa4);})[_0xf28d('0x1b')](function(_0x1aeab4){logger[_0xf28d('0x17')]('AddTags',_0x1aeab4[_0xf28d('0x19')],_0xa7e155);_0x188f79(_this[_0xf28d('0x17')](0x1f4,_0x1aeab4['message']));});});}; \ No newline at end of file +var _0x7108=['error','code','ChatInteraction,\x20%s,\x20%s','message','UpdateChatInteraction','ChatInteraction','update','body','options','attributes','stringify','catch','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','./chatInteraction.socket','register','request','then','info','request\x20sent','debug'];(function(_0x9e926a,_0x16a1c6){var _0x5b571a=function(_0xc18e03){while(--_0xc18e03){_0x9e926a['push'](_0x9e926a['shift']());}};_0x5b571a(++_0x16a1c6);}(_0x7108,0xab));var _0x8710=function(_0x490ff4,_0x1b149c){_0x490ff4=_0x490ff4-0x0;var _0x1b800b=_0x7108[_0x490ff4];return _0x1b800b;};'use strict';var _=require(_0x8710('0x0'));var util=require('util');var moment=require(_0x8710('0x1'));var BPromise=require(_0x8710('0x2'));var rs=require(_0x8710('0x3'));var fs=require('fs');var Redis=require(_0x8710('0x4'));var db=require(_0x8710('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8710('0x6'))(_0x8710('0x7'));var config=require('../../config/environment');var jayson=require(_0x8710('0x8'));var client=jayson['client'][_0x8710('0x9')]({'port':0x232a});config[_0x8710('0xa')]=_[_0x8710('0xb')](config[_0x8710('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8710('0xa')]));require(_0x8710('0xc'))[_0x8710('0xd')](socket);function respondWithRpcPromise(_0x4c421a,_0x44a995,_0x37a196){return new BPromise(function(_0x4fc3e0,_0x2cde07){return client[_0x8710('0xe')](_0x4c421a,_0x37a196)[_0x8710('0xf')](function(_0x1cfd4a){logger[_0x8710('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x44a995,_0x8710('0x11'));logger[_0x8710('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x44a995,_0x8710('0x11'),JSON['stringify'](_0x1cfd4a));if(_0x1cfd4a[_0x8710('0x13')]){if(_0x1cfd4a[_0x8710('0x13')][_0x8710('0x14')]===0x1f4){logger[_0x8710('0x13')](_0x8710('0x15'),_0x44a995,_0x1cfd4a[_0x8710('0x13')][_0x8710('0x16')]);return _0x2cde07(_0x1cfd4a[_0x8710('0x13')][_0x8710('0x16')]);}logger['error'](_0x8710('0x15'),_0x44a995,_0x1cfd4a['error'][_0x8710('0x16')]);return _0x4fc3e0(_0x1cfd4a[_0x8710('0x13')][_0x8710('0x16')]);}else{logger[_0x8710('0x10')](_0x8710('0x15'),_0x44a995,_0x8710('0x11'));_0x4fc3e0(_0x1cfd4a['result'][_0x8710('0x16')]);}})['catch'](function(_0x4a788a){logger[_0x8710('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x44a995,_0x4a788a);_0x2cde07(_0x4a788a);});});}exports[_0x8710('0x17')]=function(_0x4e572d){var _0x495f25=this;return new Promise(function(_0x4e2745,_0x2d8f8e){return db[_0x8710('0x18')][_0x8710('0x19')](_0x4e572d[_0x8710('0x1a')],{'raw':_0x4e572d[_0x8710('0x1b')]?_0x4e572d[_0x8710('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e572d['options']?_0x4e572d[_0x8710('0x1b')]['where']||null:null,'attributes':_0x4e572d[_0x8710('0x1b')]?_0x4e572d[_0x8710('0x1b')][_0x8710('0x1c')]||null:null,'limit':_0x4e572d[_0x8710('0x1b')]?_0x4e572d['options']['limit']||null:null})[_0x8710('0xf')](function(_0x247bfa){logger[_0x8710('0x10')]('UpdateChatInteraction',_0x4e572d);logger['debug'](_0x8710('0x17'),_0x4e572d,JSON[_0x8710('0x1d')](_0x247bfa));_0x4e2745(_0x247bfa);})[_0x8710('0x1e')](function(_0x55976a){logger['error'](_0x8710('0x17'),_0x55976a[_0x8710('0x16')],_0x4e572d);_0x2d8f8e(_0x495f25[_0x8710('0x13')](0x1f4,_0x55976a[_0x8710('0x16')]));});});};exports[_0x8710('0x1f')]=function(_0x57eb7e){return new Promise(function(_0xa4b827,_0x4ce0a8){return db[_0x8710('0x18')][_0x8710('0x20')]({'where':_0x57eb7e['options']?_0x57eb7e[_0x8710('0x1b')]['where']||null:null})[_0x8710('0xf')](function(_0x2a7603){if(_0x2a7603){return _0x2a7603[_0x8710('0x21')](_0x57eb7e[_0x8710('0x1a')][_0x8710('0x22')],_[_0x8710('0x23')](_0x57eb7e[_0x8710('0x1a')],[_0x8710('0x22'),'id'])||{});}})[_0x8710('0x24')](function(_0x41a24d){logger[_0x8710('0x10')](_0x8710('0x25'),_0x57eb7e);logger[_0x8710('0x12')](_0x8710('0x25'),_0x57eb7e,JSON[_0x8710('0x1d')](_0x41a24d));_0xa4b827(_0x41a24d);})[_0x8710('0x1e')](function(_0x48172c){logger['error'](_0x8710('0x25'),_0x48172c['message'],_0x57eb7e);_0x4ce0a8(_this[_0x8710('0x13')](0x1f4,_0x48172c[_0x8710('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ca22c89..3dc648d 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 _0xe096=['remove','update','emit','removeListener','./chatInteraction.events','save'];(function(_0x586ac4,_0x390b1b){var _0x2d7364=function(_0x5651d7){while(--_0x5651d7){_0x586ac4['push'](_0x586ac4['shift']());}};_0x2d7364(++_0x390b1b);}(_0xe096,0x13c));var _0x6e09=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0xe096[_0x15a634];return _0xf4f7a0;};'use strict';var ChatInteractionEvents=require(_0x6e09('0x0'));var events=[_0x6e09('0x1'),_0x6e09('0x2'),_0x6e09('0x3')];function createListener(_0x194614,_0x1379c5){return function(_0x498677){_0x1379c5[_0x6e09('0x4')](_0x194614,_0x498677);};}function removeListener(_0xc5fff6,_0x16feae){return function(){ChatInteractionEvents[_0x6e09('0x5')](_0xc5fff6,_0x16feae);};}exports['register']=function(_0x560b7c){for(var _0x5442ec=0x0,_0x19b334=events['length'];_0x5442ec<_0x19b334;_0x5442ec++){var _0x1aadcb=events[_0x5442ec];var _0x3f558e=createListener('chatInteraction:'+_0x1aadcb,_0x560b7c);ChatInteractionEvents['on'](_0x1aadcb,_0x3f558e);}}; \ No newline at end of file +var _0x5a10=['save','remove','update','removeListener'];(function(_0x3bd60e,_0x2069b0){var _0x196c85=function(_0x51a82d){while(--_0x51a82d){_0x3bd60e['push'](_0x3bd60e['shift']());}};_0x196c85(++_0x2069b0);}(_0x5a10,0x1f4));var _0x05a1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a10[_0x14add3];return _0x4a174f;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x05a1('0x0'),_0x05a1('0x1'),_0x05a1('0x2')];function createListener(_0x2faedf,_0x360175){return function(_0x23c771){_0x360175['emit'](_0x2faedf,_0x23c771);};}function removeListener(_0x2ce32,_0x370ecb){return function(){ChatInteractionEvents[_0x05a1('0x3')](_0x2ce32,_0x370ecb);};}exports['register']=function(_0x598fb6){for(var _0x2b82a3=0x0,_0x5ab67c=events['length'];_0x2b82a3<_0x5ab67c;_0x2b82a3++){var _0x5e2092=events[_0x2b82a3];var _0x228756=createListener('chatInteraction:'+_0x5e2092,_0x598fb6);ChatInteractionEvents['on'](_0x5e2092,_0x228756);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 9aa6dbc..b5cc354 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 _0x88e8=['getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','now','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','chatinteraction:addtags','addTags','put','tracked','chat','chatinteraction:update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','destroy','delete','removeTags','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','get','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages'];(function(_0x4c78e0,_0x389694){var _0x33ca4f=function(_0x16bfd2){while(--_0x16bfd2){_0x4c78e0['push'](_0x4c78e0['shift']());}};_0x33ca4f(++_0x389694);}(_0x88e8,0xe7));var _0x888e=function(_0x420fdd,_0x127224){_0x420fdd=_0x420fdd-0x0;var _0x116df3=_0x88e8[_0x420fdd];return _0x116df3;};'use strict';var multer=require(_0x888e('0x0'));var util=require(_0x888e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x888e('0x2'));var router=express[_0x888e('0x3')]();var fs_extra=require(_0x888e('0x4'));var auth=require(_0x888e('0x5'));var interaction=require(_0x888e('0x6'));var config=require(_0x888e('0x7'));var controller=require(_0x888e('0x8'));router['get']('/',auth[_0x888e('0x9')](),controller['index']);router[_0x888e('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x888e('0xb')]);router[_0x888e('0xa')](_0x888e('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x888e('0xd')]);router['get']('/:id/attachment_download',auth[_0x888e('0xe')](),controller[_0x888e('0xf')]);router[_0x888e('0xa')](_0x888e('0x10'),auth[_0x888e('0x9')](),controller[_0x888e('0x11')]);router[_0x888e('0xa')](_0x888e('0x12'),auth[_0x888e('0xe')](),controller[_0x888e('0x13')]);router[_0x888e('0xa')](_0x888e('0x14'),auth[_0x888e('0x9')](),controller['download']);router[_0x888e('0x15')]('/',auth[_0x888e('0x9')](),controller[_0x888e('0x16')]);router[_0x888e('0x15')](_0x888e('0x17'),auth[_0x888e('0x9')](),controller[_0x888e('0x18')]);var upload=multer({'storage':multer[_0x888e('0x19')]({'destination':function(_0x590b40,_0x299a39,_0x3427bc){_0x3427bc(null,path[_0x888e('0x1a')](config['root'],_0x888e('0x1b')));},'filename':function(_0x144cf7,_0x307400,_0x466169){_0x466169(null,util[_0x888e('0x1c')]('%s-%s',Date[_0x888e('0x1d')](),_0x307400['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x888e('0x15')](_0x888e('0x1e'),upload[_0x888e('0x1f')](_0x888e('0x20')),controller[_0x888e('0x21')]);router['post'](_0x888e('0x10'),auth[_0x888e('0xe')](),controller['addMessage']);router[_0x888e('0x15')](_0x888e('0x22'),auth[_0x888e('0x9')](),interaction['tracked']('chat',_0x888e('0x23')),controller[_0x888e('0x24')]);router[_0x888e('0x25')](_0x888e('0xc'),auth[_0x888e('0x9')](),interaction[_0x888e('0x26')](_0x888e('0x27'),_0x888e('0x28')),controller['update']);router[_0x888e('0x25')](_0x888e('0x29'),controller['customUpdate']);router['put'](_0x888e('0x2a'),auth[_0x888e('0xe')](),controller[_0x888e('0x2b')]);router[_0x888e('0x25')](_0x888e('0x2c'),controller[_0x888e('0x2d')]);router['delete'](_0x888e('0xc'),auth[_0x888e('0x9')](),interaction['tracked'](_0x888e('0x27'),'chatinteraction:destroy'),controller[_0x888e('0x2e')]);router[_0x888e('0x2f')](_0x888e('0x22'),auth['isAuthenticated'](),controller[_0x888e('0x30')]);module[_0x888e('0x31')]=router; \ No newline at end of file +var _0x9502=['close','delete','chatinteraction:destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','customUpdate','abandon','/:id/close'];(function(_0x121509,_0x1f9b95){var _0x418e32=function(_0x418fb9){while(--_0x418fb9){_0x121509['push'](_0x121509['shift']());}};_0x418e32(++_0x1f9b95);}(_0x9502,0x1d1));var _0x2950=function(_0x537881,_0x3555b0){_0x537881=_0x537881-0x0;var _0x19ef90=_0x9502[_0x537881];return _0x19ef90;};'use strict';var multer=require(_0x2950('0x0'));var util=require(_0x2950('0x1'));var path=require('path');var timeout=require(_0x2950('0x2'));var express=require('express');var router=express[_0x2950('0x3')]();var fs_extra=require(_0x2950('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2950('0x5'));router['get']('/',auth[_0x2950('0x6')](),controller[_0x2950('0x7')]);router[_0x2950('0x8')](_0x2950('0x9'),auth[_0x2950('0x6')](),controller[_0x2950('0xa')]);router[_0x2950('0x8')]('/:id',auth[_0x2950('0xb')](),controller['show']);router[_0x2950('0x8')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x2950('0x8')](_0x2950('0xc'),auth[_0x2950('0x6')](),controller[_0x2950('0xd')]);router[_0x2950('0x8')](_0x2950('0xe'),auth[_0x2950('0xb')](),controller[_0x2950('0xf')]);router[_0x2950('0x8')](_0x2950('0x10'),auth[_0x2950('0x6')](),controller[_0x2950('0x11')]);router[_0x2950('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2950('0x12')]('/:id/vidaoo',auth[_0x2950('0x6')](),controller[_0x2950('0x13')]);var upload=multer({'storage':multer[_0x2950('0x14')]({'destination':function(_0x176b52,_0x5aa4f0,_0x362c05){_0x362c05(null,path['join'](config[_0x2950('0x15')],_0x2950('0x16')));},'filename':function(_0x5d3c9a,_0x32b67c,_0x1f86f0){_0x1f86f0(null,util[_0x2950('0x17')](_0x2950('0x18'),Date['now'](),_0x32b67c[_0x2950('0x19')][_0x2950('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x2950('0x1b'),upload[_0x2950('0x1c')](_0x2950('0x1d')),controller[_0x2950('0x1e')]);router['post'](_0x2950('0xc'),auth[_0x2950('0xb')](),controller['addMessage']);router[_0x2950('0x12')](_0x2950('0x1f'),auth['isAuthenticated'](),interaction[_0x2950('0x20')](_0x2950('0x21'),_0x2950('0x22')),controller[_0x2950('0x23')]);router[_0x2950('0x24')](_0x2950('0x25'),auth[_0x2950('0x6')](),interaction[_0x2950('0x20')](_0x2950('0x21'),'chatinteraction:update'),controller['update']);router[_0x2950('0x24')]('/:id/custom_update',controller[_0x2950('0x26')]);router[_0x2950('0x24')]('/:id/abandon',auth[_0x2950('0xb')](),controller[_0x2950('0x27')]);router[_0x2950('0x24')](_0x2950('0x28'),controller[_0x2950('0x29')]);router[_0x2950('0x2a')](_0x2950('0x25'),auth[_0x2950('0x6')](),interaction[_0x2950('0x20')]('chat',_0x2950('0x2b')),controller['destroy']);router[_0x2950('0x2a')](_0x2950('0x1f'),auth[_0x2950('0x6')](),controller[_0x2950('0x2c')]);module[_0x2950('0x2d')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 6a24f99..aec48dd 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 _0x5b37=['BOOLEAN','INTEGER','sequelize','exports','medium'];(function(_0x45671c,_0x2d5a15){var _0x8690ab=function(_0x44598f){while(--_0x44598f){_0x45671c['push'](_0x45671c['shift']());}};_0x8690ab(++_0x2d5a15);}(_0x5b37,0x106));var _0x75b3=function(_0x5db569,_0x25707b){_0x5db569=_0x5db569-0x0;var _0x247b44=_0x5b37[_0x5db569];return _0x247b44;};'use strict';var Sequelize=require(_0x75b3('0x0'));module[_0x75b3('0x1')]={'body':{'type':Sequelize['TEXT'](_0x75b3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x75b3('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x75b3('0x4')]}}; \ No newline at end of file +var _0x58fb=['BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x327995,_0x15ab91){var _0x540aa9=function(_0x4b08b5){while(--_0x4b08b5){_0x327995['push'](_0x327995['shift']());}};_0x540aa9(++_0x15ab91);}(_0x58fb,0x178));var _0xb58f=function(_0x49e246,_0x48b258){_0x49e246=_0x49e246-0x0;var _0x5d690d=_0x58fb[_0x49e246];return _0x5d690d;};'use strict';var Sequelize=require(_0xb58f('0x0'));module[_0xb58f('0x1')]={'body':{'type':Sequelize[_0xb58f('0x2')](_0xb58f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb58f('0x4')],'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 570c36f..985bb50 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 _0x5cc9=['describe','get','messages','createdAt','lastMessage','lastMessageAt','format','getUsers','findAll','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','params'];(function(_0x33990e,_0x27b1f4){var _0x366423=function(_0x488cf4){while(--_0x488cf4){_0x33990e['push'](_0x33990e['shift']());}};_0x366423(++_0x27b1f4);}(_0x5cc9,0x16a));var _0x95cc=function(_0xe5ef5b,_0x428332){_0xe5ef5b=_0xe5ef5b-0x0;var _0x376b56=_0x5cc9[_0xe5ef5b];return _0x376b56;};'use strict';var emlformat=require(_0x95cc('0x0'));var rimraf=require(_0x95cc('0x1'));var zipdir=require(_0x95cc('0x2'));var jsonpatch=require(_0x95cc('0x3'));var rp=require(_0x95cc('0x4'));var moment=require(_0x95cc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x95cc('0x6'));var util=require(_0x95cc('0x7'));var path=require('path');var sox=require(_0x95cc('0x8'));var csv=require(_0x95cc('0x9'));var ejs=require(_0x95cc('0xa'));var fs=require('fs');var fs_extra=require(_0x95cc('0xb'));var _=require(_0x95cc('0xc'));var squel=require('squel');var crypto=require(_0x95cc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x95cc('0xe'));var toCsv=require(_0x95cc('0x9'));var querystring=require(_0x95cc('0xf'));var Papa=require('papaparse');var Redis=require(_0x95cc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x95cc('0x11'));var hardwareService=require(_0x95cc('0x12'));var logger=require(_0x95cc('0x13'))(_0x95cc('0x14'));var utils=require(_0x95cc('0x15'));var config=require(_0x95cc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x95cc('0x17')]=_[_0x95cc('0x18')](config['redis'],{'host':_0x95cc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x95cc('0x17')]));require(_0x95cc('0x1a'))[_0x95cc('0x1b')](socket);function respondWithStatusCode(_0x25d508,_0x2112cc){_0x2112cc=_0x2112cc||0xcc;return function(_0x1eedbf){if(_0x1eedbf){return _0x25d508[_0x95cc('0x1c')](_0x2112cc);}return _0x25d508[_0x95cc('0x1d')](_0x2112cc)[_0x95cc('0x1e')]();};}function respondWithResult(_0x4bff06,_0x7304ab){_0x7304ab=_0x7304ab||0xc8;return function(_0x4a2428){if(_0x4a2428){return _0x4bff06[_0x95cc('0x1d')](_0x7304ab)['json'](_0x4a2428);}};}function respondWithFilteredResult(_0x1e6203,_0x2d4b10){return function(_0x6b0917){if(_0x6b0917){var _0x231b39=typeof _0x2d4b10[_0x95cc('0x1f')]===_0x95cc('0x20')&&typeof _0x2d4b10[_0x95cc('0x21')]===_0x95cc('0x20');var _0xb8192e=_0x6b0917[_0x95cc('0x22')];var _0x2276ac=_0x231b39?0x0:_0x2d4b10[_0x95cc('0x1f')];var _0x1eb2a7=_0x231b39?_0x6b0917[_0x95cc('0x22')]:_0x2d4b10[_0x95cc('0x1f')]+_0x2d4b10[_0x95cc('0x21')];var _0x4ea406;if(_0x1eb2a7>=_0xb8192e){_0x1eb2a7=_0xb8192e;_0x4ea406=0xc8;}else{_0x4ea406=0xce;}_0x1e6203[_0x95cc('0x1d')](_0x4ea406);return _0x1e6203[_0x95cc('0x23')](_0x95cc('0x24'),_0x2276ac+'-'+_0x1eb2a7+'/'+_0xb8192e)[_0x95cc('0x25')](_0x6b0917);}return null;};}function patchUpdates(_0x345511){return function(_0xe2d034){try{jsonpatch['apply'](_0xe2d034,_0x345511,!![]);}catch(_0x3552bc){return BPromise[_0x95cc('0x26')](_0x3552bc);}return _0xe2d034[_0x95cc('0x27')]();};}function saveUpdates(_0x282866,_0xe3265a){return function(_0x2e6801){if(_0x2e6801){return _0x2e6801[_0x95cc('0x28')](_0x282866)['then'](function(_0x2fa5a5){return _0x2fa5a5;});}return null;};}function removeEntity(_0x99710d,_0x1e2876){return function(_0x25c56c){if(_0x25c56c){return _0x25c56c[_0x95cc('0x29')]()[_0x95cc('0x2a')](function(){_0x99710d[_0x95cc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d0b6a,_0x5b8c6f){return function(_0x1ed7d5){if(!_0x1ed7d5){_0x4d0b6a[_0x95cc('0x1c')](0x194);}return _0x1ed7d5;};}function handleError(_0x165e9e,_0x549a86){_0x549a86=_0x549a86||0x1f4;return function(_0x12a0e5){logger['error'](_0x12a0e5[_0x95cc('0x2b')]);if(_0x12a0e5[_0x95cc('0x2c')]){delete _0x12a0e5[_0x95cc('0x2c')];}_0x165e9e[_0x95cc('0x1d')](_0x549a86)[_0x95cc('0x2d')](_0x12a0e5);};}exports[_0x95cc('0x2e')]=function(_0xbd98d7,_0x2d3c22){var _0x18124b={},_0x65b551={},_0x3e1fe2={'count':0x0,'rows':[]};var _0x28fb63=_[_0x95cc('0x2f')](db[_0x95cc('0x30')][_0x95cc('0x31')],function(_0x5f4f25){return{'name':_0x5f4f25[_0x95cc('0x32')],'type':_0x5f4f25[_0x95cc('0x33')][_0x95cc('0x34')]};});_0x65b551[_0x95cc('0x35')]=_[_0x95cc('0x2f')](_0x28fb63,_0x95cc('0x2c'));_0x65b551[_0x95cc('0x36')]=_[_0x95cc('0x37')](_0xbd98d7[_0x95cc('0x36')]);_0x65b551['filters']=_['intersection'](_0x65b551[_0x95cc('0x35')],_0x65b551[_0x95cc('0x36')]);_0x18124b[_0x95cc('0x38')]=_[_0x95cc('0x39')](_0x65b551[_0x95cc('0x35')],qs[_0x95cc('0x3a')](_0xbd98d7[_0x95cc('0x36')][_0x95cc('0x3a')]));_0x18124b[_0x95cc('0x38')]=_0x18124b[_0x95cc('0x38')][_0x95cc('0x3b')]?_0x18124b[_0x95cc('0x38')]:_0x65b551[_0x95cc('0x35')];if(!_0xbd98d7['query']['hasOwnProperty']('nolimit')){_0x18124b[_0x95cc('0x21')]=qs[_0x95cc('0x21')](_0xbd98d7[_0x95cc('0x36')][_0x95cc('0x21')]);_0x18124b[_0x95cc('0x1f')]=qs[_0x95cc('0x1f')](_0xbd98d7[_0x95cc('0x36')][_0x95cc('0x1f')]);}_0x18124b[_0x95cc('0x3c')]=qs[_0x95cc('0x3d')](_0xbd98d7[_0x95cc('0x36')][_0x95cc('0x3d')]);_0x18124b[_0x95cc('0x3e')]=qs[_0x95cc('0x3f')](_[_0x95cc('0x40')](_0xbd98d7[_0x95cc('0x36')],_0x65b551[_0x95cc('0x3f')]),_0x28fb63);if(_0xbd98d7[_0x95cc('0x36')][_0x95cc('0x41')]){_0x18124b[_0x95cc('0x3e')]=_['merge'](_0x18124b[_0x95cc('0x3e')],{'$or':_[_0x95cc('0x2f')](_0x28fb63,function(_0x3365f4){if(_0x3365f4[_0x95cc('0x33')]!==_0x95cc('0x42')){var _0x4aa44f={};_0x4aa44f[_0x3365f4[_0x95cc('0x2c')]]={'$like':'%'+_0xbd98d7[_0x95cc('0x36')][_0x95cc('0x41')]+'%'};return _0x4aa44f;}})});}_0x18124b=_[_0x95cc('0x43')]({},_0x18124b,_0xbd98d7[_0x95cc('0x44')]);var _0x4df8a2={'where':_0x18124b['where']};return db[_0x95cc('0x30')]['count'](_0x4df8a2)[_0x95cc('0x2a')](function(_0x36449a){_0x3e1fe2[_0x95cc('0x22')]=_0x36449a;if(_0xbd98d7[_0x95cc('0x36')][_0x95cc('0x45')]){_0x18124b[_0x95cc('0x46')]=[{'all':!![]}];}return db[_0x95cc('0x30')]['findAll'](_0x18124b);})['then'](function(_0x56f623){_0x3e1fe2[_0x95cc('0x47')]=_0x56f623;return _0x3e1fe2;})[_0x95cc('0x2a')](respondWithFilteredResult(_0x2d3c22,_0x18124b))[_0x95cc('0x48')](handleError(_0x2d3c22,null));};exports[_0x95cc('0x49')]=function(_0x4d8dda,_0x33e076){var _0x203dd6={'raw':!![],'where':{'id':_0x4d8dda['params']['id']}},_0x109f84={};_0x109f84['model']=_[_0x95cc('0x37')](db[_0x95cc('0x30')][_0x95cc('0x31')]);_0x109f84[_0x95cc('0x36')]=_[_0x95cc('0x37')](_0x4d8dda[_0x95cc('0x36')]);_0x109f84[_0x95cc('0x3f')]=_[_0x95cc('0x39')](_0x109f84[_0x95cc('0x35')],_0x109f84['query']);_0x203dd6[_0x95cc('0x38')]=_[_0x95cc('0x39')](_0x109f84['model'],qs[_0x95cc('0x3a')](_0x4d8dda['query']['fields']));_0x203dd6[_0x95cc('0x38')]=_0x203dd6[_0x95cc('0x38')][_0x95cc('0x3b')]?_0x203dd6[_0x95cc('0x38')]:_0x109f84[_0x95cc('0x35')];if(_0x4d8dda[_0x95cc('0x36')][_0x95cc('0x45')]){_0x203dd6[_0x95cc('0x46')]=[{'all':!![]}];}_0x203dd6=_[_0x95cc('0x43')]({},_0x203dd6,_0x4d8dda['options']);return db[_0x95cc('0x30')][_0x95cc('0x4a')](_0x203dd6)[_0x95cc('0x2a')](handleEntityNotFound(_0x33e076,null))[_0x95cc('0x2a')](respondWithResult(_0x33e076,null))[_0x95cc('0x48')](handleError(_0x33e076,null));};exports[_0x95cc('0x4b')]=function(_0x1a591d,_0x51e81b){return db[_0x95cc('0x30')][_0x95cc('0x4b')](_0x1a591d[_0x95cc('0x4c')],{})['then'](respondWithResult(_0x51e81b,0xc9))['catch'](handleError(_0x51e81b,null));};exports[_0x95cc('0x28')]=function(_0x523516,_0x37cc0c){if(_0x523516['body']['id']){delete _0x523516[_0x95cc('0x4c')]['id'];}return db[_0x95cc('0x30')][_0x95cc('0x4a')]({'where':{'id':_0x523516[_0x95cc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x37cc0c,null))[_0x95cc('0x2a')](saveUpdates(_0x523516['body'],null))[_0x95cc('0x2a')](respondWithResult(_0x37cc0c,null))[_0x95cc('0x48')](handleError(_0x37cc0c,null));};exports[_0x95cc('0x29')]=function(_0x381965,_0x55dc0b){return db[_0x95cc('0x30')][_0x95cc('0x4a')]({'where':{'id':_0x381965[_0x95cc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x55dc0b,null))[_0x95cc('0x2a')](removeEntity(_0x55dc0b,null))[_0x95cc('0x48')](handleError(_0x55dc0b,null));};exports[_0x95cc('0x4e')]=function(_0x311f06,_0x118c2a){return db[_0x95cc('0x30')][_0x95cc('0x4e')]()[_0x95cc('0x2a')](respondWithResult(_0x118c2a,null))[_0x95cc('0x48')](handleError(_0x118c2a,null));};function wrapUser(_0x3fc946){return function(_0x337a75){var _0x1aae3f=_0x3fc946[_0x95cc('0x4f')]({'plain':!![]});_0x1aae3f[_0x95cc('0x50')]=[];if(_0x337a75){_0x1aae3f['lastMessageAt']=_0x337a75[_0x95cc('0x51')];_0x1aae3f[_0x95cc('0x52')]=_0x337a75;}else{_0x1aae3f[_0x95cc('0x53')]=moment(0x0)[_0x95cc('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x1aae3f['lastMessage']={};}return _0x1aae3f;};}exports[_0x95cc('0x55')]=function(_0x1df6bb,_0x2345d9,_0x10b582){var _0x436c2b=[];return db['User'][_0x95cc('0x56')]({'where':{'role':['agent',_0x95cc('0x57'),_0x95cc('0x58')]},'attributes':['id',_0x95cc('0x59'),'name',_0x95cc('0x5a'),_0x95cc('0x5b'),_0x95cc('0x5c'),_0x95cc('0x5d'),_0x95cc('0x5e'),_0x95cc('0x5f'),_0x95cc('0x60')],'order':qs[_0x95cc('0x3d')](_0x95cc('0x61')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x95cc('0x2c'),'type'],'through':{'attributes':[]}}]})['then'](function(_0x2d8940){if(_0x2d8940){var _0x280945=_0x1df6bb[_0x95cc('0x58')]['get']({'plain':!![]});if(!_0x280945)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x280945['role']===_0x95cc('0x58')){return db[_0x95cc('0x62')][_0x95cc('0x4a')]({'where':{'name':_0x95cc('0x63'),'userProfileId':_0x280945[_0x95cc('0x64')]},'raw':!![]})[_0x95cc('0x2a')](function(_0x598134){if(_0x598134){if(_0x598134['autoAssociation']===0x0){return db[_0x95cc('0x65')][_0x95cc('0x56')]({'where':{'sectionId':_0x598134['id']},'raw':!![]})['then'](function(_0x1c2261){var _0x15a3c2=[];if(_[_0x95cc('0x66')](_0x1c2261)){_0x15a3c2=_[_0x95cc('0x41')](_0x2d8940,function(_0x505395){if(_0x505395['role']!=='agent'){return _0x505395;}});return _0x15a3c2;}else{for(var _0x1a5f2f=0x0;_0x1a5f2f<_0x2d8940[_0x95cc('0x3b')];_0x1a5f2f++){var _0x41aa93=_0x2d8940[_0x1a5f2f];if(_0x41aa93[_0x95cc('0x5a')]===_0x95cc('0x67')){var _0x2b13ac=_[_0x95cc('0x4a')](_0x1c2261,function(_0x3d0a37){return _0x3d0a37[_0x95cc('0x68')]===_0x41aa93['id'];});if(_0x2b13ac)_0x15a3c2['push'](_0x41aa93);}else{_0x15a3c2['push'](_0x41aa93);}}return _0x15a3c2;}});}else{return _0x2d8940;}}else{var _0x4b8ef0=_['filter'](_0x2d8940,function(_0x1a4f1d){if(_0x1a4f1d['role']!=='agent'){return _0x1a4f1d;}});return _0x4b8ef0;}});}else{return _0x2d8940;}}})[_0x95cc('0x2a')](function(_0x393c26){var _0x14b7d6=[];if(_0x393c26){_0x436c2b=_0x393c26;for(var _0x126a79=0x0;_0x126a79<_0x393c26['length'];_0x126a79+=0x1){_0x436c2b[_0x126a79][_0x95cc('0x50')]=[];_0x14b7d6[_0x95cc('0x69')](db[_0x95cc('0x30')][_0x95cc('0x4a')]({'where':{'FromId':[_0x1df6bb['user']['id'],_0x393c26[_0x126a79]['id']],'ToId':[_0x1df6bb[_0x95cc('0x58')]['id'],_0x393c26[_0x126a79]['id']],'ChatGroupId':null},'attributes':['id',_0x95cc('0x51'),_0x95cc('0x6a'),_0x95cc('0x6b'),'read',_0x95cc('0x4c')],'order':qs['sort'](_0x95cc('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x95cc('0x2a')](wrapUser(_0x393c26[_0x126a79])));}return BPromise[_0x95cc('0x6d')](_0x14b7d6);}return[];})['then'](function(_0x170593){return{'rows':_0x170593,'count':_0x170593['length']};})[_0x95cc('0x2a')](respondWithResult(_0x2345d9,null))['catch'](handleError(_0x2345d9,null));}; \ No newline at end of file +var _0x038a=['format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','fullname','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','length','FromId','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ChatInternalMessage','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','describe','get','messages','createdAt','lastMessageAt'];(function(_0x1de3c4,_0x5e7331){var _0x29f90=function(_0x203f45){while(--_0x203f45){_0x1de3c4['push'](_0x1de3c4['shift']());}};_0x29f90(++_0x5e7331);}(_0x038a,0x1df));var _0xa038=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0x038a[_0x49052b];return _0x48c045;};'use strict';var emlformat=require(_0xa038('0x0'));var rimraf=require(_0xa038('0x1'));var zipdir=require(_0xa038('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa038('0x3'));var moment=require('moment');var BPromise=require(_0xa038('0x4'));var Mustache=require('mustache');var util=require(_0xa038('0x5'));var path=require(_0xa038('0x6'));var sox=require(_0xa038('0x7'));var csv=require('to-csv');var ejs=require(_0xa038('0x8'));var fs=require('fs');var fs_extra=require(_0xa038('0x9'));var _=require(_0xa038('0xa'));var squel=require('squel');var crypto=require(_0xa038('0xb'));var jsforce=require(_0xa038('0xc'));var deskjs=require(_0xa038('0xd'));var toCsv=require(_0xa038('0xe'));var querystring=require(_0xa038('0xf'));var Papa=require(_0xa038('0x10'));var Redis=require(_0xa038('0x11'));var authService=require(_0xa038('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa038('0x13'));var hardwareService=require(_0xa038('0x14'));var logger=require(_0xa038('0x15'))('api');var utils=require(_0xa038('0x16'));var config=require(_0xa038('0x17'));var licenseUtil=require(_0xa038('0x18'));var db=require(_0xa038('0x19'))['db'];config[_0xa038('0x1a')]=_[_0xa038('0x1b')](config[_0xa038('0x1a')],{'host':_0xa038('0x1c'),'port':0x18eb});var socket=require(_0xa038('0x1d'))(new Redis(config[_0xa038('0x1a')]));require('./chatInternalMessage.socket')[_0xa038('0x1e')](socket);function respondWithStatusCode(_0x32e39e,_0xc49f3c){_0xc49f3c=_0xc49f3c||0xcc;return function(_0x47ba1a){if(_0x47ba1a){return _0x32e39e['sendStatus'](_0xc49f3c);}return _0x32e39e[_0xa038('0x1f')](_0xc49f3c)[_0xa038('0x20')]();};}function respondWithResult(_0x23b616,_0x50dae2){_0x50dae2=_0x50dae2||0xc8;return function(_0x406e1f){if(_0x406e1f){return _0x23b616[_0xa038('0x1f')](_0x50dae2)['json'](_0x406e1f);}};}function respondWithFilteredResult(_0x182ddf,_0x37b520){return function(_0x4e9574){if(_0x4e9574){var _0xb45a7f=typeof _0x37b520[_0xa038('0x21')]===_0xa038('0x22')&&typeof _0x37b520[_0xa038('0x23')]==='undefined';var _0x5b633e=_0x4e9574[_0xa038('0x24')];var _0x192e42=_0xb45a7f?0x0:_0x37b520['offset'];var _0xef672d=_0xb45a7f?_0x4e9574[_0xa038('0x24')]:_0x37b520[_0xa038('0x21')]+_0x37b520[_0xa038('0x23')];var _0x142e89;if(_0xef672d>=_0x5b633e){_0xef672d=_0x5b633e;_0x142e89=0xc8;}else{_0x142e89=0xce;}_0x182ddf[_0xa038('0x1f')](_0x142e89);return _0x182ddf['set']('Content-Range',_0x192e42+'-'+_0xef672d+'/'+_0x5b633e)['json'](_0x4e9574);}return null;};}function patchUpdates(_0x437999){return function(_0x49d26c){try{jsonpatch[_0xa038('0x25')](_0x49d26c,_0x437999,!![]);}catch(_0x2b6e56){return BPromise[_0xa038('0x26')](_0x2b6e56);}return _0x49d26c[_0xa038('0x27')]();};}function saveUpdates(_0x302c75,_0x2b5c6d){return function(_0x1147c0){if(_0x1147c0){return _0x1147c0[_0xa038('0x28')](_0x302c75)[_0xa038('0x29')](function(_0x4d679a){return _0x4d679a;});}return null;};}function removeEntity(_0x5c4e5e,_0x2dd227){return function(_0xaa7068){if(_0xaa7068){return _0xaa7068[_0xa038('0x2a')]()[_0xa038('0x29')](function(){_0x5c4e5e[_0xa038('0x1f')](0xcc)[_0xa038('0x20')]();});}};}function handleEntityNotFound(_0x47a677,_0x4a1f37){return function(_0x21979c){if(!_0x21979c){_0x47a677[_0xa038('0x2b')](0x194);}return _0x21979c;};}function handleError(_0x2dbabd,_0x3e9f7d){_0x3e9f7d=_0x3e9f7d||0x1f4;return function(_0xae0b40){logger[_0xa038('0x2c')](_0xae0b40[_0xa038('0x2d')]);if(_0xae0b40['name']){delete _0xae0b40[_0xa038('0x2e')];}_0x2dbabd['status'](_0x3e9f7d)[_0xa038('0x2f')](_0xae0b40);};}exports[_0xa038('0x30')]=function(_0x33e6fb,_0x7bd836){var _0xe66002={},_0x4dd000={},_0x127e82={'count':0x0,'rows':[]};var _0x1015e0=_['map'](db[_0xa038('0x31')][_0xa038('0x32')],function(_0x56bfb6){return{'name':_0x56bfb6['fieldName'],'type':_0x56bfb6[_0xa038('0x33')][_0xa038('0x34')]};});_0x4dd000[_0xa038('0x35')]=_[_0xa038('0x36')](_0x1015e0,_0xa038('0x2e'));_0x4dd000['query']=_[_0xa038('0x37')](_0x33e6fb['query']);_0x4dd000[_0xa038('0x38')]=_[_0xa038('0x39')](_0x4dd000[_0xa038('0x35')],_0x4dd000[_0xa038('0x3a')]);_0xe66002[_0xa038('0x3b')]=_['intersection'](_0x4dd000[_0xa038('0x35')],qs[_0xa038('0x3c')](_0x33e6fb[_0xa038('0x3a')][_0xa038('0x3c')]));_0xe66002[_0xa038('0x3b')]=_0xe66002[_0xa038('0x3b')]['length']?_0xe66002[_0xa038('0x3b')]:_0x4dd000[_0xa038('0x35')];if(!_0x33e6fb[_0xa038('0x3a')][_0xa038('0x3d')](_0xa038('0x3e'))){_0xe66002[_0xa038('0x23')]=qs[_0xa038('0x23')](_0x33e6fb[_0xa038('0x3a')][_0xa038('0x23')]);_0xe66002[_0xa038('0x21')]=qs[_0xa038('0x21')](_0x33e6fb[_0xa038('0x3a')][_0xa038('0x21')]);}_0xe66002[_0xa038('0x3f')]=qs['sort'](_0x33e6fb[_0xa038('0x3a')][_0xa038('0x40')]);_0xe66002[_0xa038('0x41')]=qs[_0xa038('0x38')](_[_0xa038('0x42')](_0x33e6fb[_0xa038('0x3a')],_0x4dd000[_0xa038('0x38')]),_0x1015e0);if(_0x33e6fb[_0xa038('0x3a')][_0xa038('0x43')]){_0xe66002[_0xa038('0x41')]=_['merge'](_0xe66002[_0xa038('0x41')],{'$or':_[_0xa038('0x36')](_0x1015e0,function(_0x3ff2f6){if(_0x3ff2f6[_0xa038('0x33')]!==_0xa038('0x44')){var _0x5b4b8c={};_0x5b4b8c[_0x3ff2f6[_0xa038('0x2e')]]={'$like':'%'+_0x33e6fb[_0xa038('0x3a')]['filter']+'%'};return _0x5b4b8c;}})});}_0xe66002=_['merge']({},_0xe66002,_0x33e6fb[_0xa038('0x45')]);var _0x58e496={'where':_0xe66002['where']};return db[_0xa038('0x31')]['count'](_0x58e496)['then'](function(_0x4ac28b){_0x127e82[_0xa038('0x24')]=_0x4ac28b;if(_0x33e6fb[_0xa038('0x3a')]['includeAll']){_0xe66002[_0xa038('0x46')]=[{'all':!![]}];}return db[_0xa038('0x31')][_0xa038('0x47')](_0xe66002);})[_0xa038('0x29')](function(_0x39c9f3){_0x127e82[_0xa038('0x48')]=_0x39c9f3;return _0x127e82;})[_0xa038('0x29')](respondWithFilteredResult(_0x7bd836,_0xe66002))[_0xa038('0x49')](handleError(_0x7bd836,null));};exports[_0xa038('0x4a')]=function(_0xf2ff9f,_0x32fe1b){var _0x3ec38e={'raw':!![],'where':{'id':_0xf2ff9f[_0xa038('0x4b')]['id']}},_0x36bb4c={};_0x36bb4c[_0xa038('0x35')]=_['keys'](db[_0xa038('0x31')][_0xa038('0x32')]);_0x36bb4c[_0xa038('0x3a')]=_[_0xa038('0x37')](_0xf2ff9f[_0xa038('0x3a')]);_0x36bb4c[_0xa038('0x38')]=_[_0xa038('0x39')](_0x36bb4c[_0xa038('0x35')],_0x36bb4c[_0xa038('0x3a')]);_0x3ec38e[_0xa038('0x3b')]=_[_0xa038('0x39')](_0x36bb4c[_0xa038('0x35')],qs['fields'](_0xf2ff9f[_0xa038('0x3a')][_0xa038('0x3c')]));_0x3ec38e[_0xa038('0x3b')]=_0x3ec38e[_0xa038('0x3b')]['length']?_0x3ec38e[_0xa038('0x3b')]:_0x36bb4c['model'];if(_0xf2ff9f[_0xa038('0x3a')][_0xa038('0x4c')]){_0x3ec38e[_0xa038('0x46')]=[{'all':!![]}];}_0x3ec38e=_[_0xa038('0x4d')]({},_0x3ec38e,_0xf2ff9f[_0xa038('0x45')]);return db[_0xa038('0x31')][_0xa038('0x4e')](_0x3ec38e)['then'](handleEntityNotFound(_0x32fe1b,null))[_0xa038('0x29')](respondWithResult(_0x32fe1b,null))['catch'](handleError(_0x32fe1b,null));};exports[_0xa038('0x4f')]=function(_0x1ec3dc,_0xcf252b){return db[_0xa038('0x31')][_0xa038('0x4f')](_0x1ec3dc['body'],{})[_0xa038('0x29')](respondWithResult(_0xcf252b,0xc9))[_0xa038('0x49')](handleError(_0xcf252b,null));};exports[_0xa038('0x28')]=function(_0x460895,_0x909911){if(_0x460895[_0xa038('0x50')]['id']){delete _0x460895[_0xa038('0x50')]['id'];}return db['ChatInternalMessage'][_0xa038('0x4e')]({'where':{'id':_0x460895['params']['id']}})['then'](handleEntityNotFound(_0x909911,null))[_0xa038('0x29')](saveUpdates(_0x460895[_0xa038('0x50')],null))[_0xa038('0x29')](respondWithResult(_0x909911,null))[_0xa038('0x49')](handleError(_0x909911,null));};exports['destroy']=function(_0x1d49ea,_0x188913){return db[_0xa038('0x31')]['find']({'where':{'id':_0x1d49ea[_0xa038('0x4b')]['id']}})[_0xa038('0x29')](handleEntityNotFound(_0x188913,null))['then'](removeEntity(_0x188913,null))[_0xa038('0x49')](handleError(_0x188913,null));};exports[_0xa038('0x51')]=function(_0x513dde,_0x4959a0){return db[_0xa038('0x31')]['describe']()[_0xa038('0x29')](respondWithResult(_0x4959a0,null))[_0xa038('0x49')](handleError(_0x4959a0,null));};function wrapUser(_0x342fd8){return function(_0x2f08e9){var _0xd6263a=_0x342fd8[_0xa038('0x52')]({'plain':!![]});_0xd6263a[_0xa038('0x53')]=[];if(_0x2f08e9){_0xd6263a['lastMessageAt']=_0x2f08e9[_0xa038('0x54')];_0xd6263a['lastMessage']=_0x2f08e9;}else{_0xd6263a[_0xa038('0x55')]=moment(0x0)[_0xa038('0x56')](_0xa038('0x57'));_0xd6263a[_0xa038('0x58')]={};}return _0xd6263a;};}exports[_0xa038('0x59')]=function(_0x495eac,_0x3a681b,_0x740479){var _0x2c181f=[];return db[_0xa038('0x5a')]['findAll']({'where':{'role':[_0xa038('0x5b'),_0xa038('0x5c'),'user']},'attributes':['id',_0xa038('0x5d'),'name','role','userpic',_0xa038('0x5e'),_0xa038('0x5f'),_0xa038('0x60'),'allowmessenger','showWebBar'],'order':qs['sort'](_0xa038('0x61')),'include':[{'model':db[_0xa038('0x62')],'as':_0xa038('0x63'),'attributes':['id',_0xa038('0x2e'),_0xa038('0x33')],'through':{'attributes':[]}}]})[_0xa038('0x29')](function(_0x3bb6f8){if(_0x3bb6f8){var _0x4b6770=_0x495eac[_0xa038('0x64')][_0xa038('0x52')]({'plain':!![]});if(!_0x4b6770)throw new Error(_0xa038('0x65'));if(_0x4b6770[_0xa038('0x66')]===_0xa038('0x64')){return db[_0xa038('0x67')]['find']({'where':{'name':_0xa038('0x68'),'userProfileId':_0x4b6770[_0xa038('0x69')]},'raw':!![]})[_0xa038('0x29')](function(_0x14668f){if(_0x14668f){if(_0x14668f['autoAssociation']===0x0){return db[_0xa038('0x6a')][_0xa038('0x47')]({'where':{'sectionId':_0x14668f['id']},'raw':!![]})[_0xa038('0x29')](function(_0x283081){var _0x48b53=[];if(_[_0xa038('0x6b')](_0x283081)){_0x48b53=_[_0xa038('0x43')](_0x3bb6f8,function(_0xc3d5e6){if(_0xc3d5e6['role']!==_0xa038('0x5b')){return _0xc3d5e6;}});return _0x48b53;}else{for(var _0x42b605=0x0;_0x42b605<_0x3bb6f8['length'];_0x42b605++){var _0x46cb1e=_0x3bb6f8[_0x42b605];if(_0x46cb1e[_0xa038('0x66')]===_0xa038('0x5b')){var _0x434588=_['find'](_0x283081,function(_0x48a71c){return _0x48a71c[_0xa038('0x6c')]===_0x46cb1e['id'];});if(_0x434588)_0x48b53['push'](_0x46cb1e);}else{_0x48b53['push'](_0x46cb1e);}}return _0x48b53;}});}else{return _0x3bb6f8;}}else{var _0x4262a2=_[_0xa038('0x43')](_0x3bb6f8,function(_0x19bffc){if(_0x19bffc[_0xa038('0x66')]!==_0xa038('0x5b')){return _0x19bffc;}});return _0x4262a2;}});}else{return _0x3bb6f8;}}})['then'](function(_0x3921e2){var _0x27920b=[];if(_0x3921e2){_0x2c181f=_0x3921e2;for(var _0x32fa55=0x0;_0x32fa55<_0x3921e2[_0xa038('0x6d')];_0x32fa55+=0x1){_0x2c181f[_0x32fa55][_0xa038('0x53')]=[];_0x27920b['push'](db[_0xa038('0x31')][_0xa038('0x4e')]({'where':{'FromId':[_0x495eac['user']['id'],_0x3921e2[_0x32fa55]['id']],'ToId':[_0x495eac[_0xa038('0x64')]['id'],_0x3921e2[_0x32fa55]['id']],'ChatGroupId':null},'attributes':['id',_0xa038('0x54'),_0xa038('0x6e'),'ToId','read',_0xa038('0x50')],'order':qs[_0xa038('0x40')](_0xa038('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa038('0x29')](wrapUser(_0x3921e2[_0x32fa55])));}return BPromise[_0xa038('0x70')](_0x27920b);}return[];})[_0xa038('0x29')](function(_0x1e0bd2){return{'rows':_0x1e0bd2,'count':_0x1e0bd2[_0xa038('0x6d')]};})[_0xa038('0x29')](respondWithResult(_0x3a681b,null))['catch'](handleError(_0x3a681b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 5476994..2822570 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 _0x2fa7=['events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','exports'];(function(_0x4a4d6b,_0x3306de){var _0x17d85e=function(_0x2dd1a1){while(--_0x2dd1a1){_0x4a4d6b['push'](_0x4a4d6b['shift']());}};_0x17d85e(++_0x3306de);}(_0x2fa7,0xe0));var _0x72fa=function(_0x82cd19,_0x525c63){_0x82cd19=_0x82cd19-0x0;var _0x1cebcc=_0x2fa7[_0x82cd19];return _0x1cebcc;};'use strict';var EventEmitter=require(_0x72fa('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x72fa('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x72fa('0x2')](0x0);var events={'afterCreate':_0x72fa('0x3'),'afterUpdate':_0x72fa('0x4'),'afterDestroy':_0x72fa('0x5')};function emitEvent(_0x3e7e22){return function(_0x3ac74e,_0x287cd1,_0x385932){ChatInternalMessageEvents[_0x72fa('0x6')](_0x3e7e22+':'+_0x3ac74e['id'],_0x3ac74e);ChatInternalMessageEvents[_0x72fa('0x6')](_0x3e7e22,_0x3ac74e);_0x385932(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x72fa('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x327b=['remove','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','save','update'];(function(_0x8b9e62,_0x173b44){var _0x31a9a0=function(_0x5cacf7){while(--_0x5cacf7){_0x8b9e62['push'](_0x8b9e62['shift']());}};_0x31a9a0(++_0x173b44);}(_0x327b,0xfb));var _0xb327=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x327b[_0x2235bf];return _0x4c3a64;};'use strict';var EventEmitter=require(_0xb327('0x0'));var ChatInternalMessage=require(_0xb327('0x1'))['db'][_0xb327('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb327('0x3'),'afterUpdate':_0xb327('0x4'),'afterDestroy':_0xb327('0x5')};function emitEvent(_0x478352){return function(_0x423e90,_0x520185,_0x5b7c49){ChatInternalMessageEvents['emit'](_0x478352+':'+_0x423e90['id'],_0x423e90);ChatInternalMessageEvents['emit'](_0x478352,_0x423e90);_0x5b7c49(null);};}for(var e in events){if(events[_0xb327('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xb327('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 6f72428..3919bda 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 _0xcf06=['request-promise','path','rimraf','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcf06,0xd8));var _0x6cf0=function(_0x5aa2e2,_0x44c8ee){_0x5aa2e2=_0x5aa2e2-0x0;var _0x392dc3=_0xcf06[_0x5aa2e2];return _0x392dc3;};'use strict';var _=require(_0x6cf0('0x0'));var util=require(_0x6cf0('0x1'));var logger=require(_0x6cf0('0x2'))(_0x6cf0('0x3'));var moment=require(_0x6cf0('0x4'));var BPromise=require('bluebird');var rp=require(_0x6cf0('0x5'));var fs=require('fs');var path=require(_0x6cf0('0x6'));var rimraf=require(_0x6cf0('0x7'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x55d1d7,_0x1aecba){return _0x55d1d7[_0x6cf0('0x8')](_0x6cf0('0x9'),attributes,{'tableName':_0x6cf0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6cf0('0xb'),'collate':_0x6cf0('0xc')});}; \ No newline at end of file +var _0x8f5c=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x6ad3b3,_0xafae37){var _0x5ef3d7=function(_0x5af1ab){while(--_0x5af1ab){_0x6ad3b3['push'](_0x6ad3b3['shift']());}};_0x5ef3d7(++_0xafae37);}(_0x8f5c,0x9c));var _0xc8f5=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x8f5c[_0x1f99a0];return _0x1e0849;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc8f5('0x0'))(_0xc8f5('0x1'));var moment=require('moment');var BPromise=require(_0xc8f5('0x2'));var rp=require(_0xc8f5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8f5('0x4'));var config=require(_0xc8f5('0x5'));var attributes=require(_0xc8f5('0x6'));module[_0xc8f5('0x7')]=function(_0x3aa043,_0x45c807){return _0x3aa043[_0xc8f5('0x8')]('ChatInternalMessage',attributes,{'tableName':_0xc8f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8f5('0xa'),'collate':_0xc8f5('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index ccd2d59..3c2d1ea 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 _0x223c=['ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x223c,0x1c9));var _0xc223=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x223c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc223('0x0'));var util=require('util');var moment=require(_0xc223('0x1'));var BPromise=require(_0xc223('0x2'));var rs=require(_0xc223('0x3'));var fs=require('fs');var Redis=require(_0xc223('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc223('0x5'));var logger=require(_0xc223('0x6'))(_0xc223('0x7'));var config=require(_0xc223('0x8'));var jayson=require(_0xc223('0x9'));var client=jayson[_0xc223('0xa')][_0xc223('0xb')]({'port':0x232a});config['redis']=_[_0xc223('0xc')](config['redis'],{'host':_0xc223('0xd'),'port':0x18eb});var socket=require(_0xc223('0xe'))(new Redis(config['redis']));require(_0xc223('0xf'))[_0xc223('0x10')](socket);function respondWithRpcPromise(_0x21564e,_0xc4d363,_0x5a0015){return new BPromise(function(_0x594681,_0x504903){return client[_0xc223('0x11')](_0x21564e,_0x5a0015)['then'](function(_0x5590bc){logger[_0xc223('0x12')](_0xc223('0x13'),_0xc4d363,'request\x20sent');logger[_0xc223('0x14')](_0xc223('0x15'),_0xc4d363,_0xc223('0x16'),JSON[_0xc223('0x17')](_0x5590bc));if(_0x5590bc[_0xc223('0x18')]){if(_0x5590bc[_0xc223('0x18')]['code']===0x1f4){logger[_0xc223('0x18')](_0xc223('0x13'),_0xc4d363,_0x5590bc[_0xc223('0x18')][_0xc223('0x19')]);return _0x504903(_0x5590bc['error']['message']);}logger[_0xc223('0x18')](_0xc223('0x13'),_0xc4d363,_0x5590bc[_0xc223('0x18')][_0xc223('0x19')]);return _0x594681(_0x5590bc[_0xc223('0x18')][_0xc223('0x19')]);}else{logger[_0xc223('0x12')](_0xc223('0x13'),_0xc4d363,_0xc223('0x16'));_0x594681(_0x5590bc[_0xc223('0x1a')][_0xc223('0x19')]);}})[_0xc223('0x1b')](function(_0x50a586){logger[_0xc223('0x18')](_0xc223('0x13'),_0xc4d363,_0x50a586);_0x504903(_0x50a586);});});} \ No newline at end of file +var _0x6302=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6302,0x6c));var _0x2630=function(_0x4b37b0,_0x4ebbd1){_0x4b37b0=_0x4b37b0-0x0;var _0x44c4a6=_0x6302[_0x4b37b0];return _0x44c4a6;};'use strict';var _=require(_0x2630('0x0'));var util=require(_0x2630('0x1'));var moment=require(_0x2630('0x2'));var BPromise=require('bluebird');var rs=require(_0x2630('0x3'));var fs=require('fs');var Redis=require(_0x2630('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2630('0x5'));var logger=require(_0x2630('0x6'))('rpc');var config=require(_0x2630('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2630('0x8')][_0x2630('0x9')]({'port':0x232a});config['redis']=_[_0x2630('0xa')](config[_0x2630('0xb')],{'host':_0x2630('0xc'),'port':0x18eb});var socket=require(_0x2630('0xd'))(new Redis(config[_0x2630('0xb')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4c9b52,_0x5947d7,_0x12356c){return new BPromise(function(_0x3002b0,_0xb15d0d){return client[_0x2630('0xe')](_0x4c9b52,_0x12356c)[_0x2630('0xf')](function(_0x2b39c3){logger[_0x2630('0x10')](_0x2630('0x11'),_0x5947d7,_0x2630('0x12'));logger[_0x2630('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5947d7,_0x2630('0x12'),JSON[_0x2630('0x14')](_0x2b39c3));if(_0x2b39c3[_0x2630('0x15')]){if(_0x2b39c3[_0x2630('0x15')][_0x2630('0x16')]===0x1f4){logger[_0x2630('0x15')](_0x2630('0x11'),_0x5947d7,_0x2b39c3[_0x2630('0x15')][_0x2630('0x17')]);return _0xb15d0d(_0x2b39c3[_0x2630('0x15')]['message']);}logger[_0x2630('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5947d7,_0x2b39c3[_0x2630('0x15')][_0x2630('0x17')]);return _0x3002b0(_0x2b39c3[_0x2630('0x15')][_0x2630('0x17')]);}else{logger[_0x2630('0x10')](_0x2630('0x11'),_0x5947d7,_0x2630('0x12'));_0x3002b0(_0x2b39c3['result'][_0x2630('0x17')]);}})[_0x2630('0x18')](function(_0x38e68a){logger[_0x2630('0x15')](_0x2630('0x11'),_0x5947d7,_0x38e68a);_0xb15d0d(_0x38e68a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 9b262b0..9c1c697 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 _0x7712=['length','chatInternalMessage:','update','emit'];(function(_0x1c2a1e,_0x1da05c){var _0x3a3cd9=function(_0x30cb87){while(--_0x30cb87){_0x1c2a1e['push'](_0x1c2a1e['shift']());}};_0x3a3cd9(++_0x1da05c);}(_0x7712,0x1de));var _0x2771=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7712[_0x1facfa];return _0x9ec701;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove',_0x2771('0x0')];function createListener(_0x43c5cf,_0x154435){return function(_0xcbaf81){_0x154435[_0x2771('0x1')](_0x43c5cf,_0xcbaf81);};}function removeListener(_0x39212d,_0x2ef251){return function(){ChatInternalMessageEvents['removeListener'](_0x39212d,_0x2ef251);};}exports['register']=function(_0xebc9f){for(var _0x1e2eef=0x0,_0x56c633=events[_0x2771('0x2')];_0x1e2eef<_0x56c633;_0x1e2eef++){var _0xaf608=events[_0x1e2eef];var _0x59e10c=createListener(_0x2771('0x3')+_0xaf608,_0xebc9f);ChatInternalMessageEvents['on'](_0xaf608,_0x59e10c);}}; \ No newline at end of file +var _0xeb4e=['removeListener','chatInternalMessage:','./chatInternalMessage.events','update','emit'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0xeb4e,0x1c4));var _0xeeb4=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xeb4e[_0x42245d];return _0x4b211a;};'use strict';var ChatInternalMessageEvents=require(_0xeeb4('0x0'));var events=['save','remove',_0xeeb4('0x1')];function createListener(_0x31c8f2,_0xfe6e67){return function(_0x151506){_0xfe6e67[_0xeeb4('0x2')](_0x31c8f2,_0x151506);};}function removeListener(_0x5dbafb,_0x10017a){return function(){ChatInternalMessageEvents[_0xeeb4('0x3')](_0x5dbafb,_0x10017a);};}exports['register']=function(_0x41ac68){for(var _0x237358=0x0,_0x5d8723=events['length'];_0x237358<_0x5d8723;_0x237358++){var _0xad229a=events[_0x237358];var _0x136ee2=createListener(_0xeeb4('0x4')+_0xad229a,_0x41ac68);ChatInternalMessageEvents['on'](_0xad229a,_0x136ee2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 2867130..82eefab 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 _0xdcbf=['get','isAuthenticated','index','/describe','describe','/users','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x5f5413,_0x49a1f6){var _0x33bff8=function(_0x1e17c9){while(--_0x1e17c9){_0x5f5413['push'](_0x5f5413['shift']());}};_0x33bff8(++_0x49a1f6);}(_0xdcbf,0xce));var _0xfdcb=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xdcbf[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xfdcb('0x0'));var util=require(_0xfdcb('0x1'));var path=require(_0xfdcb('0x2'));var timeout=require(_0xfdcb('0x3'));var express=require('express');var router=express[_0xfdcb('0x4')]();var fs_extra=require(_0xfdcb('0x5'));var auth=require(_0xfdcb('0x6'));var interaction=require(_0xfdcb('0x7'));var config=require(_0xfdcb('0x8'));var controller=require(_0xfdcb('0x9'));router[_0xfdcb('0xa')]('/',auth[_0xfdcb('0xb')](),controller[_0xfdcb('0xc')]);router['get'](_0xfdcb('0xd'),auth[_0xfdcb('0xb')](),controller[_0xfdcb('0xe')]);router[_0xfdcb('0xa')](_0xfdcb('0xf'),auth[_0xfdcb('0xb')](),controller['getUsers']);router[_0xfdcb('0xa')](_0xfdcb('0x10'),auth['isAuthenticated'](),controller[_0xfdcb('0x11')]);router['post']('/',auth[_0xfdcb('0xb')](),controller[_0xfdcb('0x12')]);router[_0xfdcb('0x13')]('/:id',controller[_0xfdcb('0x14')]);router[_0xfdcb('0x15')](_0xfdcb('0x10'),auth[_0xfdcb('0xb')](),controller[_0xfdcb('0x16')]);module[_0xfdcb('0x17')]=router; \ No newline at end of file +var _0x05ef=['/users','getUsers','/:id','show','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x05ef,0xb9));var _0xf05e=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x05ef[_0x21549c];return _0x426cbd;};'use strict';var multer=require(_0xf05e('0x0'));var util=require(_0xf05e('0x1'));var path=require(_0xf05e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf05e('0x3'));var router=express[_0xf05e('0x4')]();var fs_extra=require(_0xf05e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf05e('0x6'));var config=require(_0xf05e('0x7'));var controller=require('./chatInternalMessage.controller');router[_0xf05e('0x8')]('/',auth[_0xf05e('0x9')](),controller[_0xf05e('0xa')]);router['get'](_0xf05e('0xb'),auth[_0xf05e('0x9')](),controller[_0xf05e('0xc')]);router['get'](_0xf05e('0xd'),auth[_0xf05e('0x9')](),controller[_0xf05e('0xe')]);router[_0xf05e('0x8')](_0xf05e('0xf'),auth[_0xf05e('0x9')](),controller[_0xf05e('0x10')]);router[_0xf05e('0x11')]('/',auth['isAuthenticated'](),controller[_0xf05e('0x12')]);router['put'](_0xf05e('0xf'),controller[_0xf05e('0x13')]);router[_0xf05e('0x14')](_0xf05e('0xf'),auth[_0xf05e('0x9')](),controller['destroy']);module[_0xf05e('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index c56e0ab..2c01293 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 _0xaf4c=['out','DATE','STRING','exports','TEXT','BOOLEAN','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x3892f6,_0x58318e){_0x3892f6=_0x3892f6-0x0;var _0x14735c=_0xaf4c[_0x3892f6];return _0x14735c;};'use strict';var Sequelize=require('sequelize');module[_0xcaf4('0x0')]={'body':{'type':Sequelize[_0xcaf4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcaf4('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xcaf4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcaf4('0x3')]('in','out'),'defaultValue':_0xcaf4('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xcaf4('0x5')]},'providerName':{'type':Sequelize[_0xcaf4('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbb59=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb59,0xec));var _0x9bb5=function(_0x27f85f,_0x30e981){_0x27f85f=_0x27f85f-0x0;var _0x32d00e=_0xbb59[_0x27f85f];return _0x32d00e;};'use strict';var Sequelize=require(_0x9bb5('0x0'));module[_0x9bb5('0x1')]={'body':{'type':Sequelize[_0x9bb5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x9bb5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9bb5('0x4')]('in',_0x9bb5('0x5')),'defaultValue':_0x9bb5('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9bb5('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9bb5('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 5fcebb2..ba51078 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 _0x0c3c=['offset','undefined','limit','count','set','apply','reject','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','describe','../../config/logger','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','ChatInteraction','ChatInteractionId','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','User','agent','email','internal','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','ContactId','QueryTypes','SELECT','contact','fullname','interface','SIP/%s','motionChannel','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json'];(function(_0x3a2e28,_0x137ef6){var _0x2d378c=function(_0x130079){while(--_0x130079){_0x3a2e28['push'](_0x3a2e28['shift']());}};_0x2d378c(++_0x137ef6);}(_0x0c3c,0xdd));var _0xc0c3=function(_0x8fa4bc,_0x5cd2af){_0x8fa4bc=_0x8fa4bc-0x0;var _0x35b6a7=_0x0c3c[_0x8fa4bc];return _0x35b6a7;};'use strict';var emlformat=require(_0xc0c3('0x0'));var rimraf=require(_0xc0c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0c3('0x2'));var rp=require(_0xc0c3('0x3'));var moment=require('moment');var BPromise=require(_0xc0c3('0x4'));var Mustache=require(_0xc0c3('0x5'));var util=require('util');var path=require(_0xc0c3('0x6'));var sox=require(_0xc0c3('0x7'));var csv=require(_0xc0c3('0x8'));var ejs=require(_0xc0c3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc0c3('0xa'));var crypto=require(_0xc0c3('0xb'));var jsforce=require(_0xc0c3('0xc'));var deskjs=require(_0xc0c3('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc0c3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc0c3('0xf'));var qs=require(_0xc0c3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc0c3('0x11'));var logger=require('../../config/logger')(_0xc0c3('0x12'));var utils=require(_0xc0c3('0x13'));var config=require(_0xc0c3('0x14'));var licenseUtil=require(_0xc0c3('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc0c3('0x16')](config[_0xc0c3('0x17')],{'host':_0xc0c3('0x18'),'port':0x18eb});var socket=require(_0xc0c3('0x19'))(new Redis(config[_0xc0c3('0x17')]));require(_0xc0c3('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc0c3('0x1b')][_0xc0c3('0x1c')]({'port':0x232c});var client9002=jayson[_0xc0c3('0x1b')][_0xc0c3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3294dd,_0x42ff68,_0x4eb32d,_0x191316){return new BPromise(function(_0xac3572,_0x1061c4){var _0x21d24d=_0x191316||client;return _0x21d24d[_0xc0c3('0x1d')](_0x3294dd,_0x4eb32d)[_0xc0c3('0x1e')](function(_0x5a961a){logger[_0xc0c3('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x42ff68,_0xc0c3('0x20'));logger[_0xc0c3('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x42ff68,'request\x20sent',JSON[_0xc0c3('0x22')](_0x5a961a));if(_0x5a961a[_0xc0c3('0x23')]){if(_0x5a961a[_0xc0c3('0x23')][_0xc0c3('0x24')]===0x1f4){logger['error'](_0xc0c3('0x25'),_0x42ff68,_0x5a961a[_0xc0c3('0x23')][_0xc0c3('0x26')]);return _0x1061c4(_0x5a961a['error'][_0xc0c3('0x26')]);}logger[_0xc0c3('0x23')]('ChatMessage,\x20%s,\x20%s',_0x42ff68,_0x5a961a['error']['message']);return _0xac3572(_0x5a961a[_0xc0c3('0x23')][_0xc0c3('0x26')]);}else{logger['info'](_0xc0c3('0x25'),_0x42ff68,_0xc0c3('0x20'));_0xac3572(_0x5a961a[_0xc0c3('0x27')][_0xc0c3('0x26')]);}})[_0xc0c3('0x28')](function(_0x5ee9e3){logger[_0xc0c3('0x23')]('ChatMessage,\x20%s,\x20%s',_0x42ff68,_0x5ee9e3);_0x1061c4(_0x5ee9e3);});});}function respondWithStatusCode(_0x312c80,_0x25174a){_0x25174a=_0x25174a||0xcc;return function(_0x38583b){if(_0x38583b){return _0x312c80[_0xc0c3('0x29')](_0x25174a);}return _0x312c80[_0xc0c3('0x2a')](_0x25174a)[_0xc0c3('0x2b')]();};}function respondWithResult(_0x3a4c0c,_0x5d412b){_0x5d412b=_0x5d412b||0xc8;return function(_0x4d82dc){if(_0x4d82dc){return _0x3a4c0c['status'](_0x5d412b)[_0xc0c3('0x2c')](_0x4d82dc);}};}function respondWithFilteredResult(_0x358e03,_0x5af9ff){return function(_0x3e36e0){if(_0x3e36e0){var _0x2c2575=typeof _0x5af9ff[_0xc0c3('0x2d')]===_0xc0c3('0x2e')&&typeof _0x5af9ff[_0xc0c3('0x2f')]===_0xc0c3('0x2e');var _0x24e4d7=_0x3e36e0['count'];var _0x2eb570=_0x2c2575?0x0:_0x5af9ff[_0xc0c3('0x2d')];var _0x28dcb6=_0x2c2575?_0x3e36e0[_0xc0c3('0x30')]:_0x5af9ff['offset']+_0x5af9ff[_0xc0c3('0x2f')];var _0x422ac8;if(_0x28dcb6>=_0x24e4d7){_0x28dcb6=_0x24e4d7;_0x422ac8=0xc8;}else{_0x422ac8=0xce;}_0x358e03[_0xc0c3('0x2a')](_0x422ac8);return _0x358e03[_0xc0c3('0x31')]('Content-Range',_0x2eb570+'-'+_0x28dcb6+'/'+_0x24e4d7)['json'](_0x3e36e0);}return null;};}function patchUpdates(_0x333116){return function(_0xc18c90){try{jsonpatch[_0xc0c3('0x32')](_0xc18c90,_0x333116,!![]);}catch(_0x359856){return BPromise[_0xc0c3('0x33')](_0x359856);}return _0xc18c90['save']();};}function saveUpdates(_0x2a7f3c,_0x1d09b3){return function(_0x3f99f8){if(_0x3f99f8){return _0x3f99f8[_0xc0c3('0x34')](_0x2a7f3c)['then'](function(_0x5c423d){return _0x5c423d;});}return null;};}function removeEntity(_0x313c8a,_0x31d449){return function(_0x51ad3e){if(_0x51ad3e){return _0x51ad3e[_0xc0c3('0x35')]()[_0xc0c3('0x1e')](function(){_0x313c8a[_0xc0c3('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e71a2,_0x3f24c2){return function(_0x52b1d7){if(!_0x52b1d7){_0x2e71a2['sendStatus'](0x194);}return _0x52b1d7;};}function handleError(_0x1a4e53,_0xe2b996){_0xe2b996=_0xe2b996||0x1f4;return function(_0x92d9c4){logger['error'](_0x92d9c4[_0xc0c3('0x36')]);if(_0x92d9c4[_0xc0c3('0x37')]){delete _0x92d9c4[_0xc0c3('0x37')];}_0x1a4e53[_0xc0c3('0x2a')](_0xe2b996)[_0xc0c3('0x38')](_0x92d9c4);};}exports[_0xc0c3('0x39')]=function(_0x183fb2,_0x2dfcaf){var _0x2206be={},_0x1a1f04={},_0x970d0a={'count':0x0,'rows':[]};var _0x151c3d=_[_0xc0c3('0x3a')](db[_0xc0c3('0x3b')][_0xc0c3('0x3c')],function(_0x5e025d){return{'name':_0x5e025d[_0xc0c3('0x3d')],'type':_0x5e025d['type'][_0xc0c3('0x3e')]};});_0x1a1f04[_0xc0c3('0x3f')]=_[_0xc0c3('0x3a')](_0x151c3d,'name');_0x1a1f04[_0xc0c3('0x40')]=_[_0xc0c3('0x41')](_0x183fb2['query']);_0x1a1f04[_0xc0c3('0x42')]=_[_0xc0c3('0x43')](_0x1a1f04[_0xc0c3('0x3f')],_0x1a1f04[_0xc0c3('0x40')]);_0x2206be[_0xc0c3('0x44')]=_['intersection'](_0x1a1f04[_0xc0c3('0x3f')],qs['fields'](_0x183fb2['query'][_0xc0c3('0x45')]));_0x2206be[_0xc0c3('0x44')]=_0x2206be[_0xc0c3('0x44')][_0xc0c3('0x46')]?_0x2206be[_0xc0c3('0x44')]:_0x1a1f04[_0xc0c3('0x3f')];if(!_0x183fb2[_0xc0c3('0x40')][_0xc0c3('0x47')]('nolimit')){_0x2206be[_0xc0c3('0x2f')]=qs[_0xc0c3('0x2f')](_0x183fb2[_0xc0c3('0x40')]['limit']);_0x2206be['offset']=qs[_0xc0c3('0x2d')](_0x183fb2['query']['offset']);}_0x2206be[_0xc0c3('0x48')]=qs[_0xc0c3('0x49')](_0x183fb2[_0xc0c3('0x40')][_0xc0c3('0x49')]);_0x2206be[_0xc0c3('0x4a')]=qs[_0xc0c3('0x42')](_[_0xc0c3('0x4b')](_0x183fb2[_0xc0c3('0x40')],_0x1a1f04[_0xc0c3('0x42')]),_0x151c3d);if(_0x183fb2['query'][_0xc0c3('0x4c')]){_0x2206be['where']=_['merge'](_0x2206be[_0xc0c3('0x4a')],{'$or':_['map'](_0x151c3d,function(_0x52d469){if(_0x52d469[_0xc0c3('0x4d')]!==_0xc0c3('0x4e')){var _0x4ef923={};_0x4ef923[_0x52d469[_0xc0c3('0x37')]]={'$like':'%'+_0x183fb2[_0xc0c3('0x40')][_0xc0c3('0x4c')]+'%'};return _0x4ef923;}})});}_0x2206be=_[_0xc0c3('0x4f')]({},_0x2206be,_0x183fb2[_0xc0c3('0x50')]);var _0x4d060c={'where':_0x2206be['where']};return db[_0xc0c3('0x3b')][_0xc0c3('0x30')](_0x4d060c)['then'](function(_0x3f2796){_0x970d0a[_0xc0c3('0x30')]=_0x3f2796;if(_0x183fb2[_0xc0c3('0x40')][_0xc0c3('0x51')]){_0x2206be[_0xc0c3('0x52')]=[{'all':!![]}];}return db[_0xc0c3('0x3b')][_0xc0c3('0x53')](_0x2206be);})[_0xc0c3('0x1e')](function(_0x4f5126){_0x970d0a['rows']=_0x4f5126;return _0x970d0a;})[_0xc0c3('0x1e')](respondWithFilteredResult(_0x2dfcaf,_0x2206be))[_0xc0c3('0x28')](handleError(_0x2dfcaf,null));};exports[_0xc0c3('0x54')]=function(_0x156270,_0x14295e){var _0x8974ca={'raw':!![],'where':{'id':_0x156270[_0xc0c3('0x55')]['id']}},_0x8a904b={};_0x8a904b['model']=_[_0xc0c3('0x41')](db[_0xc0c3('0x3b')]['rawAttributes']);_0x8a904b[_0xc0c3('0x40')]=_[_0xc0c3('0x41')](_0x156270[_0xc0c3('0x40')]);_0x8a904b['filters']=_[_0xc0c3('0x43')](_0x8a904b[_0xc0c3('0x3f')],_0x8a904b['query']);_0x8974ca['attributes']=_[_0xc0c3('0x43')](_0x8a904b[_0xc0c3('0x3f')],qs[_0xc0c3('0x45')](_0x156270[_0xc0c3('0x40')]['fields']));_0x8974ca['attributes']=_0x8974ca[_0xc0c3('0x44')][_0xc0c3('0x46')]?_0x8974ca['attributes']:_0x8a904b['model'];if(_0x156270[_0xc0c3('0x40')]['includeAll']){_0x8974ca[_0xc0c3('0x52')]=[{'all':!![]}];}_0x8974ca=_[_0xc0c3('0x4f')]({},_0x8974ca,_0x156270[_0xc0c3('0x50')]);return db[_0xc0c3('0x3b')][_0xc0c3('0x56')](_0x8974ca)['then'](handleEntityNotFound(_0x14295e,null))[_0xc0c3('0x1e')](respondWithResult(_0x14295e,null))[_0xc0c3('0x28')](handleError(_0x14295e,null));};exports['create']=function(_0x382a46,_0x799041){return db[_0xc0c3('0x3b')][_0xc0c3('0x57')](_0x382a46[_0xc0c3('0x58')],{})[_0xc0c3('0x1e')](respondWithResult(_0x799041,0xc9))[_0xc0c3('0x28')](handleError(_0x799041,null));};exports[_0xc0c3('0x34')]=function(_0x2f6c0f,_0x4f1d7d){if(_0x2f6c0f[_0xc0c3('0x58')]['id']){delete _0x2f6c0f[_0xc0c3('0x58')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x2f6c0f['params']['id']}})[_0xc0c3('0x1e')](handleEntityNotFound(_0x4f1d7d,null))['then'](saveUpdates(_0x2f6c0f['body'],null))['then'](respondWithResult(_0x4f1d7d,null))[_0xc0c3('0x28')](handleError(_0x4f1d7d,null));};exports[_0xc0c3('0x35')]=function(_0x55073a,_0xa3dcd1){return db[_0xc0c3('0x3b')][_0xc0c3('0x56')]({'where':{'id':_0x55073a[_0xc0c3('0x55')]['id']}})[_0xc0c3('0x1e')](handleEntityNotFound(_0xa3dcd1,null))[_0xc0c3('0x1e')](removeEntity(_0xa3dcd1,null))[_0xc0c3('0x28')](handleError(_0xa3dcd1,null));};exports[_0xc0c3('0x59')]=function(_0x339b87,_0x26a138){return db[_0xc0c3('0x3b')]['describe']()[_0xc0c3('0x1e')](respondWithResult(_0x26a138,null))[_0xc0c3('0x28')](handleError(_0x26a138,null));};var interaction_log=require(_0xc0c3('0x5a'))('chat-interactions');exports[_0xc0c3('0x5b')]=function(_0x1ae522,_0x4418be,_0x107914){var _0x28a0f0={'agent':{},'channel':'chat'};if(_0x1ae522['body']['id']){delete _0x1ae522[_0xc0c3('0x58')]['id'];}_0x1ae522[_0xc0c3('0x58')][_0xc0c3('0x5c')]=!![];_0x1ae522[_0xc0c3('0x58')][_0xc0c3('0x5d')]=moment()[_0xc0c3('0x5e')](_0xc0c3('0x5f'));_0x1ae522[_0xc0c3('0x58')]['UserId']=_0x1ae522[_0xc0c3('0x58')]['UserId']||_0x1ae522[_0xc0c3('0x60')]['id'];_0x28a0f0['agent']['id']=_0x1ae522[_0xc0c3('0x58')][_0xc0c3('0x61')];return db[_0xc0c3('0x3b')]['find']({'where':{'id':_0x1ae522['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4418be,null))[_0xc0c3('0x1e')](saveUpdates(_0x1ae522[_0xc0c3('0x58')],null))[_0xc0c3('0x1e')](function(_0x45301e){if(_0x45301e){_0x28a0f0[_0xc0c3('0x26')]=_0x45301e['get']({'plain':!![]});return db[_0xc0c3('0x62')][_0xc0c3('0x56')]({'where':{'id':_0x45301e[_0xc0c3('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x4418be,null))['then'](function(_0x26d8a9){if(_0x26d8a9){return _0x26d8a9[_0xc0c3('0x34')]({'UserId':_0x1ae522['body'][_0xc0c3('0x61')],'read1stAt':_['isNil'](_0x26d8a9[_0xc0c3('0x64')])?moment()[_0xc0c3('0x5e')](_0xc0c3('0x5f')):undefined});}return null;})[_0xc0c3('0x1e')](function(_0x190f3f){if(_0x190f3f){_0x28a0f0[_0xc0c3('0x65')]=_0x190f3f[_0xc0c3('0x66')]({'plain':!![]});interaction_log[_0xc0c3('0x1f')](_0xc0c3('0x67'),_0x1ae522['user']['id'],_0x1ae522[_0xc0c3('0x60')][_0xc0c3('0x37')],_0x1ae522[_0xc0c3('0x60')]['role'],_0x28a0f0[_0xc0c3('0x65')]['id'],_0x1ae522['body']?JSON['stringify'](_0x1ae522[_0xc0c3('0x58')]):_0xc0c3('0x68'));return respondWithRpcPromise(_0xc0c3('0x69'),_0xc0c3('0x6a'),_0x28a0f0);}return null;})[_0xc0c3('0x1e')](function(_0x3b0fae){var _0x511ba3=_0xc0c3('0x6b')+_0x3b0fae['message']['ContactId'];return db['sequelize'][_0xc0c3('0x40')](_0x511ba3,{'type':db[_0xc0c3('0x6c')]['QueryTypes']['SELECT'],'raw':!![]})[_0xc0c3('0x1e')](function(_0x278b95){return _0x278b95;});})[_0xc0c3('0x1e')](function(_0x56accd){if(_0x56accd){_0x28a0f0[_0xc0c3('0x26')]['contact']=_0x56accd[0x0];if(!_0x1ae522['body'][_0xc0c3('0x61')])return;return db[_0xc0c3('0x6d')][_0xc0c3('0x56')]({'where':{'id':_0x1ae522[_0xc0c3('0x58')][_0xc0c3('0x61')],'role':_0xc0c3('0x6e')},'attributes':['id',_0xc0c3('0x37'),'fullname',_0xc0c3('0x6f'),_0xc0c3('0x70')],'raw':!![]});}return null;})[_0xc0c3('0x1e')](function(_0x12c936){if(!_0x12c936)return null;_0x28a0f0[_0xc0c3('0x26')][_0xc0c3('0x6e')]=_0x12c936;return _0x28a0f0;})[_0xc0c3('0x1e')](function(_0x23fe08){if(_0x23fe08){if(_0x1ae522[_0xc0c3('0x58')]['manual']){_0x28a0f0['message']['interface']=util[_0xc0c3('0x5e')]('SIP/%s',_0x1ae522[_0xc0c3('0x60')][_0xc0c3('0x37')]);_0x28a0f0[_0xc0c3('0x26')][_0xc0c3('0x71')]=_0x28a0f0[_0xc0c3('0x71')];_0x28a0f0[_0xc0c3('0x26')]['motionChannel']=_0x28a0f0[_0xc0c3('0x71')];_0x28a0f0['message'][_0xc0c3('0x72')]=_0xc0c3('0x5b');return respondWithRpcPromise(_0xc0c3('0x73'),_0xc0c3('0x73'),{'event':_0xc0c3('0x74'),'message':_[_0xc0c3('0x4f')](_0x28a0f0['message'],JSON[_0xc0c3('0x75')](_0x28a0f0[_0xc0c3('0x65')][_0xc0c3('0x76')]))},client9002)[_0xc0c3('0x1e')](function(){return _0x28a0f0;});}return _0x28a0f0;}return null;})[_0xc0c3('0x1e')](respondWithResult(_0x4418be,null))['catch'](handleError(_0x4418be,null));};var interaction_log=require(_0xc0c3('0x5a'))(_0xc0c3('0x77'));exports[_0xc0c3('0x33')]=function(_0x4913c7,_0x3640d2,_0x1e513d){var _0x44b57f={'agent':{},'channel':_0xc0c3('0x78')};if(_0x4913c7[_0xc0c3('0x58')]['id']){delete _0x4913c7['body']['id'];}_0x4913c7[_0xc0c3('0x58')]['UserId']=_0x4913c7['body']['UserId']||_0x4913c7['user']['id'];_0x44b57f[_0xc0c3('0x6e')]['id']=_0x4913c7[_0xc0c3('0x58')][_0xc0c3('0x61')];return db['ChatMessage'][_0xc0c3('0x56')]({'where':{'id':_0x4913c7[_0xc0c3('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3640d2,null))[_0xc0c3('0x1e')](function(_0x2db76d){if(_0x2db76d){_0x44b57f[_0xc0c3('0x26')]=_0x2db76d[_0xc0c3('0x66')]({'plain':!![]});return db[_0xc0c3('0x62')][_0xc0c3('0x56')]({'where':{'id':_0x2db76d[_0xc0c3('0x63')]}});}return null;})[_0xc0c3('0x1e')](handleEntityNotFound(_0x3640d2,null))[_0xc0c3('0x1e')](function(_0x1ea2cc){if(_0x1ea2cc){_0x44b57f[_0xc0c3('0x65')]=_0x1ea2cc[_0xc0c3('0x66')]({'plain':!![]});interaction_log[_0xc0c3('0x1f')](_0xc0c3('0x79'),_0x4913c7[_0xc0c3('0x60')]['id'],_0x4913c7[_0xc0c3('0x60')][_0xc0c3('0x37')],_0x4913c7[_0xc0c3('0x60')][_0xc0c3('0x7a')],_0x44b57f[_0xc0c3('0x65')]['id'],_0x4913c7[_0xc0c3('0x58')]?JSON[_0xc0c3('0x22')](_0x4913c7[_0xc0c3('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0xc0c3('0x7b'),_0x44b57f);}return null;})[_0xc0c3('0x1e')](function(_0xed26eb){var _0x428c65=_0xc0c3('0x6b')+_0xed26eb[_0xc0c3('0x26')][_0xc0c3('0x7c')];return db['sequelize']['query'](_0x428c65,{'type':db['Sequelize'][_0xc0c3('0x7d')][_0xc0c3('0x7e')],'raw':!![]})[_0xc0c3('0x1e')](function(_0x4860b2){return _0x4860b2;});})['then'](function(_0x3ba500){if(_0x3ba500){_0x44b57f[_0xc0c3('0x26')][_0xc0c3('0x7f')]=_0x3ba500[0x0];if(!_0x4913c7[_0xc0c3('0x58')][_0xc0c3('0x61')])return;return db[_0xc0c3('0x6d')]['find']({'where':{'id':_0x4913c7[_0xc0c3('0x58')][_0xc0c3('0x61')],'role':_0xc0c3('0x6e')},'attributes':['id',_0xc0c3('0x37'),_0xc0c3('0x80'),_0xc0c3('0x6f'),_0xc0c3('0x70')],'raw':!![]});}return null;})[_0xc0c3('0x1e')](function(_0x1e98ef){if(!_0x1e98ef)return null;_0x44b57f['message'][_0xc0c3('0x6e')]=_0x1e98ef;return _0x44b57f;})['then'](function(_0x2f2409){if(_0x2f2409){_0x2f2409['message'][_0xc0c3('0x81')]=util['format'](_0xc0c3('0x82'),_0x4913c7[_0xc0c3('0x60')][_0xc0c3('0x37')]);_0x2f2409[_0xc0c3('0x26')]['channel']=_0x44b57f['channel'];_0x2f2409[_0xc0c3('0x26')][_0xc0c3('0x83')]=_0x44b57f[_0xc0c3('0x71')];_0x2f2409[_0xc0c3('0x26')][_0xc0c3('0x72')]='reject';respondWithRpcPromise(_0xc0c3('0x73'),_0xc0c3('0x73'),{'event':_0xc0c3('0x84'),'message':_[_0xc0c3('0x4f')](_0x44b57f['message'],JSON[_0xc0c3('0x75')](_0x44b57f['interaction'][_0xc0c3('0x76')]))},client9002);return _0x44b57f;}return null;})['then'](respondWithResult(_0x3640d2,null))[_0xc0c3('0x28')](handleError(_0x3640d2,null));}; \ No newline at end of file +var _0x14d5=['sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','chat','null','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','destroy','stack','name','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','show','include','find','ChatMessage','create','body','params','describe','chat-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','user','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x14d5,0x8e));var _0x514d=function(_0x568f96,_0x32d489){_0x568f96=_0x568f96-0x0;var _0x5a053a=_0x14d5[_0x568f96];return _0x5a053a;};'use strict';var emlformat=require(_0x514d('0x0'));var rimraf=require(_0x514d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x514d('0x2'));var rp=require(_0x514d('0x3'));var moment=require('moment');var BPromise=require(_0x514d('0x4'));var Mustache=require(_0x514d('0x5'));var util=require(_0x514d('0x6'));var path=require(_0x514d('0x7'));var sox=require('sox');var csv=require(_0x514d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x514d('0x9'));var squel=require(_0x514d('0xa'));var crypto=require('crypto');var jsforce=require(_0x514d('0xb'));var deskjs=require(_0x514d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x514d('0xd'));var Redis=require(_0x514d('0xe'));var authService=require(_0x514d('0xf'));var qs=require(_0x514d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x514d('0x11'))('api');var utils=require(_0x514d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x514d('0x13'));var db=require(_0x514d('0x14'))['db'];config[_0x514d('0x15')]=_[_0x514d('0x16')](config['redis'],{'host':_0x514d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x514d('0x15')]));require(_0x514d('0x18'))[_0x514d('0x19')](socket);var jayson=require(_0x514d('0x1a'));var client=jayson[_0x514d('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x514d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3e5b2a,_0x18fd9c,_0x40e523,_0x2dc407){return new BPromise(function(_0x39c222,_0x26af24){var _0x2bf064=_0x2dc407||client;return _0x2bf064[_0x514d('0x1d')](_0x3e5b2a,_0x40e523)[_0x514d('0x1e')](function(_0x411538){logger[_0x514d('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x18fd9c,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x18fd9c,'request\x20sent',JSON[_0x514d('0x20')](_0x411538));if(_0x411538[_0x514d('0x21')]){if(_0x411538[_0x514d('0x21')][_0x514d('0x22')]===0x1f4){logger[_0x514d('0x21')](_0x514d('0x23'),_0x18fd9c,_0x411538[_0x514d('0x21')][_0x514d('0x24')]);return _0x26af24(_0x411538['error']['message']);}logger[_0x514d('0x21')](_0x514d('0x23'),_0x18fd9c,_0x411538['error']['message']);return _0x39c222(_0x411538[_0x514d('0x21')][_0x514d('0x24')]);}else{logger['info'](_0x514d('0x23'),_0x18fd9c,_0x514d('0x25'));_0x39c222(_0x411538[_0x514d('0x26')]['message']);}})[_0x514d('0x27')](function(_0x1638b3){logger[_0x514d('0x21')](_0x514d('0x23'),_0x18fd9c,_0x1638b3);_0x26af24(_0x1638b3);});});}function respondWithStatusCode(_0x8b04a5,_0x33abd2){_0x33abd2=_0x33abd2||0xcc;return function(_0x17dd06){if(_0x17dd06){return _0x8b04a5[_0x514d('0x28')](_0x33abd2);}return _0x8b04a5[_0x514d('0x29')](_0x33abd2)[_0x514d('0x2a')]();};}function respondWithResult(_0x58708e,_0x26a7a6){_0x26a7a6=_0x26a7a6||0xc8;return function(_0x36d011){if(_0x36d011){return _0x58708e['status'](_0x26a7a6)[_0x514d('0x2b')](_0x36d011);}};}function respondWithFilteredResult(_0x2c38c3,_0x4cd80a){return function(_0x1789c2){if(_0x1789c2){var _0x3201df=typeof _0x4cd80a[_0x514d('0x2c')]==='undefined'&&typeof _0x4cd80a[_0x514d('0x2d')]===_0x514d('0x2e');var _0x3e8a6e=_0x1789c2[_0x514d('0x2f')];var _0x38b66e=_0x3201df?0x0:_0x4cd80a[_0x514d('0x2c')];var _0x525e8f=_0x3201df?_0x1789c2[_0x514d('0x2f')]:_0x4cd80a[_0x514d('0x2c')]+_0x4cd80a[_0x514d('0x2d')];var _0x5895b5;if(_0x525e8f>=_0x3e8a6e){_0x525e8f=_0x3e8a6e;_0x5895b5=0xc8;}else{_0x5895b5=0xce;}_0x2c38c3[_0x514d('0x29')](_0x5895b5);return _0x2c38c3['set'](_0x514d('0x30'),_0x38b66e+'-'+_0x525e8f+'/'+_0x3e8a6e)['json'](_0x1789c2);}return null;};}function patchUpdates(_0x1c2659){return function(_0x547f9b){try{jsonpatch['apply'](_0x547f9b,_0x1c2659,!![]);}catch(_0x29d4ab){return BPromise[_0x514d('0x31')](_0x29d4ab);}return _0x547f9b['save']();};}function saveUpdates(_0x3a815c,_0x289594){return function(_0x484217){if(_0x484217){return _0x484217[_0x514d('0x32')](_0x3a815c)['then'](function(_0x762e93){return _0x762e93;});}return null;};}function removeEntity(_0x33f509,_0x8cab35){return function(_0x14a1b7){if(_0x14a1b7){return _0x14a1b7[_0x514d('0x33')]()['then'](function(){_0x33f509['status'](0xcc)[_0x514d('0x2a')]();});}};}function handleEntityNotFound(_0x36d244,_0x6fcae3){return function(_0xdcef2a){if(!_0xdcef2a){_0x36d244[_0x514d('0x28')](0x194);}return _0xdcef2a;};}function handleError(_0x19d6ec,_0x3d158d){_0x3d158d=_0x3d158d||0x1f4;return function(_0x14e36c){logger['error'](_0x14e36c[_0x514d('0x34')]);if(_0x14e36c[_0x514d('0x35')]){delete _0x14e36c[_0x514d('0x35')];}_0x19d6ec[_0x514d('0x29')](_0x3d158d)['send'](_0x14e36c);};}exports[_0x514d('0x36')]=function(_0x23a0b9,_0x4ee3a7){var _0x373bbd={},_0x4f5c69={},_0x442c8f={'count':0x0,'rows':[]};var _0x411b6b=_[_0x514d('0x37')](db['ChatMessage'][_0x514d('0x38')],function(_0x27a1f7){return{'name':_0x27a1f7['fieldName'],'type':_0x27a1f7['type']['key']};});_0x4f5c69[_0x514d('0x39')]=_[_0x514d('0x37')](_0x411b6b,'name');_0x4f5c69[_0x514d('0x3a')]=_[_0x514d('0x3b')](_0x23a0b9[_0x514d('0x3a')]);_0x4f5c69[_0x514d('0x3c')]=_[_0x514d('0x3d')](_0x4f5c69[_0x514d('0x39')],_0x4f5c69['query']);_0x373bbd[_0x514d('0x3e')]=_[_0x514d('0x3d')](_0x4f5c69[_0x514d('0x39')],qs['fields'](_0x23a0b9[_0x514d('0x3a')][_0x514d('0x3f')]));_0x373bbd[_0x514d('0x3e')]=_0x373bbd[_0x514d('0x3e')][_0x514d('0x40')]?_0x373bbd[_0x514d('0x3e')]:_0x4f5c69[_0x514d('0x39')];if(!_0x23a0b9['query']['hasOwnProperty'](_0x514d('0x41'))){_0x373bbd[_0x514d('0x2d')]=qs['limit'](_0x23a0b9[_0x514d('0x3a')][_0x514d('0x2d')]);_0x373bbd[_0x514d('0x2c')]=qs[_0x514d('0x2c')](_0x23a0b9['query'][_0x514d('0x2c')]);}_0x373bbd[_0x514d('0x42')]=qs[_0x514d('0x43')](_0x23a0b9[_0x514d('0x3a')]['sort']);_0x373bbd[_0x514d('0x44')]=qs[_0x514d('0x3c')](_['pick'](_0x23a0b9[_0x514d('0x3a')],_0x4f5c69[_0x514d('0x3c')]),_0x411b6b);if(_0x23a0b9[_0x514d('0x3a')][_0x514d('0x45')]){_0x373bbd[_0x514d('0x44')]=_[_0x514d('0x46')](_0x373bbd['where'],{'$or':_[_0x514d('0x37')](_0x411b6b,function(_0x27db0c){if(_0x27db0c[_0x514d('0x47')]!==_0x514d('0x48')){var _0xa82d5d={};_0xa82d5d[_0x27db0c[_0x514d('0x35')]]={'$like':'%'+_0x23a0b9[_0x514d('0x3a')]['filter']+'%'};return _0xa82d5d;}})});}_0x373bbd=_[_0x514d('0x46')]({},_0x373bbd,_0x23a0b9[_0x514d('0x49')]);var _0x24d62a={'where':_0x373bbd[_0x514d('0x44')]};return db['ChatMessage'][_0x514d('0x2f')](_0x24d62a)[_0x514d('0x1e')](function(_0x5e5c51){_0x442c8f[_0x514d('0x2f')]=_0x5e5c51;if(_0x23a0b9[_0x514d('0x3a')]['includeAll']){_0x373bbd['include']=[{'all':!![]}];}return db['ChatMessage'][_0x514d('0x4a')](_0x373bbd);})[_0x514d('0x1e')](function(_0x2fd55a){_0x442c8f[_0x514d('0x4b')]=_0x2fd55a;return _0x442c8f;})['then'](respondWithFilteredResult(_0x4ee3a7,_0x373bbd))[_0x514d('0x27')](handleError(_0x4ee3a7,null));};exports[_0x514d('0x4c')]=function(_0x3b6397,_0xb59be){var _0x277210={'raw':!![],'where':{'id':_0x3b6397['params']['id']}},_0xaa7800={};_0xaa7800[_0x514d('0x39')]=_[_0x514d('0x3b')](db['ChatMessage'][_0x514d('0x38')]);_0xaa7800[_0x514d('0x3a')]=_[_0x514d('0x3b')](_0x3b6397[_0x514d('0x3a')]);_0xaa7800['filters']=_[_0x514d('0x3d')](_0xaa7800[_0x514d('0x39')],_0xaa7800[_0x514d('0x3a')]);_0x277210[_0x514d('0x3e')]=_[_0x514d('0x3d')](_0xaa7800['model'],qs['fields'](_0x3b6397[_0x514d('0x3a')][_0x514d('0x3f')]));_0x277210[_0x514d('0x3e')]=_0x277210[_0x514d('0x3e')][_0x514d('0x40')]?_0x277210[_0x514d('0x3e')]:_0xaa7800[_0x514d('0x39')];if(_0x3b6397[_0x514d('0x3a')]['includeAll']){_0x277210[_0x514d('0x4d')]=[{'all':!![]}];}_0x277210=_[_0x514d('0x46')]({},_0x277210,_0x3b6397[_0x514d('0x49')]);return db['ChatMessage'][_0x514d('0x4e')](_0x277210)[_0x514d('0x1e')](handleEntityNotFound(_0xb59be,null))[_0x514d('0x1e')](respondWithResult(_0xb59be,null))[_0x514d('0x27')](handleError(_0xb59be,null));};exports['create']=function(_0xaad23b,_0x66d192){return db[_0x514d('0x4f')][_0x514d('0x50')](_0xaad23b[_0x514d('0x51')],{})[_0x514d('0x1e')](respondWithResult(_0x66d192,0xc9))['catch'](handleError(_0x66d192,null));};exports[_0x514d('0x32')]=function(_0x29f5a0,_0x1d9c7a){if(_0x29f5a0['body']['id']){delete _0x29f5a0[_0x514d('0x51')]['id'];}return db[_0x514d('0x4f')][_0x514d('0x4e')]({'where':{'id':_0x29f5a0[_0x514d('0x52')]['id']}})['then'](handleEntityNotFound(_0x1d9c7a,null))['then'](saveUpdates(_0x29f5a0[_0x514d('0x51')],null))[_0x514d('0x1e')](respondWithResult(_0x1d9c7a,null))[_0x514d('0x27')](handleError(_0x1d9c7a,null));};exports[_0x514d('0x33')]=function(_0x304740,_0x177685){return db['ChatMessage'][_0x514d('0x4e')]({'where':{'id':_0x304740[_0x514d('0x52')]['id']}})[_0x514d('0x1e')](handleEntityNotFound(_0x177685,null))[_0x514d('0x1e')](removeEntity(_0x177685,null))[_0x514d('0x27')](handleError(_0x177685,null));};exports[_0x514d('0x53')]=function(_0x534e96,_0x29e244){return db[_0x514d('0x4f')][_0x514d('0x53')]()[_0x514d('0x1e')](respondWithResult(_0x29e244,null))[_0x514d('0x27')](handleError(_0x29e244,null));};var interaction_log=require(_0x514d('0x11'))(_0x514d('0x54'));exports['accept']=function(_0x223693,_0x583cef,_0x36e2ed){var _0x483fab={'agent':{},'channel':'chat'};if(_0x223693[_0x514d('0x51')]['id']){delete _0x223693[_0x514d('0x51')]['id'];}_0x223693[_0x514d('0x51')][_0x514d('0x55')]=!![];_0x223693['body'][_0x514d('0x56')]=moment()[_0x514d('0x57')](_0x514d('0x58'));_0x223693[_0x514d('0x51')][_0x514d('0x59')]=_0x223693[_0x514d('0x51')][_0x514d('0x59')]||_0x223693['user']['id'];_0x483fab[_0x514d('0x5a')]['id']=_0x223693[_0x514d('0x51')][_0x514d('0x59')];return db[_0x514d('0x4f')]['find']({'where':{'id':_0x223693[_0x514d('0x52')]['id'],'UserId':null}})[_0x514d('0x1e')](handleEntityNotFound(_0x583cef,null))[_0x514d('0x1e')](saveUpdates(_0x223693[_0x514d('0x51')],null))[_0x514d('0x1e')](function(_0x47cf85){if(_0x47cf85){_0x483fab[_0x514d('0x24')]=_0x47cf85[_0x514d('0x5b')]({'plain':!![]});return db[_0x514d('0x5c')][_0x514d('0x4e')]({'where':{'id':_0x47cf85[_0x514d('0x5d')]}});}return null;})[_0x514d('0x1e')](handleEntityNotFound(_0x583cef,null))[_0x514d('0x1e')](function(_0x154f41){if(_0x154f41){return _0x154f41[_0x514d('0x32')]({'UserId':_0x223693[_0x514d('0x51')]['UserId'],'read1stAt':_[_0x514d('0x5e')](_0x154f41[_0x514d('0x5f')])?moment()['format'](_0x514d('0x58')):undefined});}return null;})['then'](function(_0x557cce){if(_0x557cce){_0x483fab[_0x514d('0x60')]=_0x557cce[_0x514d('0x5b')]({'plain':!![]});interaction_log[_0x514d('0x1f')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x223693[_0x514d('0x61')]['id'],_0x223693[_0x514d('0x61')][_0x514d('0x35')],_0x223693[_0x514d('0x61')][_0x514d('0x62')],_0x483fab[_0x514d('0x60')]['id'],_0x223693[_0x514d('0x51')]?JSON[_0x514d('0x20')](_0x223693[_0x514d('0x51')]):'null');return respondWithRpcPromise('AcceptMessage',_0x514d('0x63'),_0x483fab);}return null;})[_0x514d('0x1e')](function(_0xcba53c){var _0x1aa819=_0x514d('0x64')+_0xcba53c[_0x514d('0x24')][_0x514d('0x65')];return db[_0x514d('0x66')][_0x514d('0x3a')](_0x1aa819,{'type':db[_0x514d('0x67')][_0x514d('0x68')][_0x514d('0x69')],'raw':!![]})[_0x514d('0x1e')](function(_0x42bbb2){return _0x42bbb2;});})[_0x514d('0x1e')](function(_0x345ce0){if(_0x345ce0){_0x483fab['message'][_0x514d('0x6a')]=_0x345ce0[0x0];if(!_0x223693['body']['UserId'])return;return db['User'][_0x514d('0x4e')]({'where':{'id':_0x223693[_0x514d('0x51')][_0x514d('0x59')],'role':_0x514d('0x5a')},'attributes':['id',_0x514d('0x35'),_0x514d('0x6b'),_0x514d('0x6c'),'internal'],'raw':!![]});}return null;})[_0x514d('0x1e')](function(_0x34bd85){if(!_0x34bd85)return null;_0x483fab[_0x514d('0x24')][_0x514d('0x5a')]=_0x34bd85;return _0x483fab;})[_0x514d('0x1e')](function(_0x52839a){if(_0x52839a){if(_0x223693[_0x514d('0x51')]['manual']){_0x483fab[_0x514d('0x24')][_0x514d('0x6d')]=util[_0x514d('0x57')](_0x514d('0x6e'),_0x223693[_0x514d('0x61')]['name']);_0x483fab[_0x514d('0x24')][_0x514d('0x6f')]=_0x483fab[_0x514d('0x6f')];_0x483fab[_0x514d('0x24')][_0x514d('0x70')]=_0x483fab['channel'];_0x483fab['message'][_0x514d('0x71')]='accept';return respondWithRpcPromise('EventManager',_0x514d('0x72'),{'event':'acceptmessage','message':_[_0x514d('0x46')](_0x483fab[_0x514d('0x24')],JSON[_0x514d('0x73')](_0x483fab[_0x514d('0x60')][_0x514d('0x74')]))},client9002)[_0x514d('0x1e')](function(){return _0x483fab;});}return _0x483fab;}return null;})[_0x514d('0x1e')](respondWithResult(_0x583cef,null))[_0x514d('0x27')](handleError(_0x583cef,null));};var interaction_log=require(_0x514d('0x11'))(_0x514d('0x54'));exports[_0x514d('0x31')]=function(_0x660d6f,_0x3725d5,_0x15c2c1){var _0x2a7084={'agent':{},'channel':_0x514d('0x75')};if(_0x660d6f[_0x514d('0x51')]['id']){delete _0x660d6f[_0x514d('0x51')]['id'];}_0x660d6f[_0x514d('0x51')][_0x514d('0x59')]=_0x660d6f[_0x514d('0x51')]['UserId']||_0x660d6f[_0x514d('0x61')]['id'];_0x2a7084[_0x514d('0x5a')]['id']=_0x660d6f['body'][_0x514d('0x59')];return db[_0x514d('0x4f')][_0x514d('0x4e')]({'where':{'id':_0x660d6f['params']['id'],'UserId':null}})[_0x514d('0x1e')](handleEntityNotFound(_0x3725d5,null))[_0x514d('0x1e')](function(_0x47fa73){if(_0x47fa73){_0x2a7084[_0x514d('0x24')]=_0x47fa73[_0x514d('0x5b')]({'plain':!![]});return db[_0x514d('0x5c')][_0x514d('0x4e')]({'where':{'id':_0x47fa73[_0x514d('0x5d')]}});}return null;})[_0x514d('0x1e')](handleEntityNotFound(_0x3725d5,null))[_0x514d('0x1e')](function(_0xde82cf){if(_0xde82cf){_0x2a7084[_0x514d('0x60')]=_0xde82cf[_0x514d('0x5b')]({'plain':!![]});interaction_log[_0x514d('0x1f')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x660d6f['user']['id'],_0x660d6f[_0x514d('0x61')]['name'],_0x660d6f[_0x514d('0x61')][_0x514d('0x62')],_0x2a7084['interaction']['id'],_0x660d6f[_0x514d('0x51')]?JSON[_0x514d('0x20')](_0x660d6f[_0x514d('0x51')]):_0x514d('0x76'));return respondWithRpcPromise(_0x514d('0x77'),_0x514d('0x78'),_0x2a7084);}return null;})['then'](function(_0xa573be){var _0x1e8fe8=_0x514d('0x64')+_0xa573be[_0x514d('0x24')]['ContactId'];return db[_0x514d('0x66')][_0x514d('0x3a')](_0x1e8fe8,{'type':db['Sequelize'][_0x514d('0x68')][_0x514d('0x69')],'raw':!![]})[_0x514d('0x1e')](function(_0x58efdc){return _0x58efdc;});})[_0x514d('0x1e')](function(_0x321d77){if(_0x321d77){_0x2a7084['message'][_0x514d('0x6a')]=_0x321d77[0x0];if(!_0x660d6f[_0x514d('0x51')][_0x514d('0x59')])return;return db['User']['find']({'where':{'id':_0x660d6f[_0x514d('0x51')][_0x514d('0x59')],'role':'agent'},'attributes':['id',_0x514d('0x35'),_0x514d('0x6b'),_0x514d('0x6c'),'internal'],'raw':!![]});}return null;})[_0x514d('0x1e')](function(_0x3169ab){if(!_0x3169ab)return null;_0x2a7084[_0x514d('0x24')][_0x514d('0x5a')]=_0x3169ab;return _0x2a7084;})[_0x514d('0x1e')](function(_0x56ccbf){if(_0x56ccbf){_0x56ccbf[_0x514d('0x24')][_0x514d('0x6d')]=util[_0x514d('0x57')](_0x514d('0x6e'),_0x660d6f[_0x514d('0x61')][_0x514d('0x35')]);_0x56ccbf['message'][_0x514d('0x6f')]=_0x2a7084[_0x514d('0x6f')];_0x56ccbf[_0x514d('0x24')][_0x514d('0x70')]=_0x2a7084[_0x514d('0x6f')];_0x56ccbf['message'][_0x514d('0x71')]=_0x514d('0x31');respondWithRpcPromise('EventManager',_0x514d('0x72'),{'event':_0x514d('0x79'),'message':_[_0x514d('0x46')](_0x2a7084[_0x514d('0x24')],JSON[_0x514d('0x73')](_0x2a7084[_0x514d('0x60')][_0x514d('0x74')]))},client9002);return _0x2a7084;}return null;})['then'](respondWithResult(_0x3725d5,null))[_0x514d('0x27')](handleError(_0x3725d5,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index dafd405..edb7a6e 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 _0x5566=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x169e53,_0x46be55){var _0x252bb3=function(_0x521e7a){while(--_0x521e7a){_0x169e53['push'](_0x169e53['shift']());}};_0x252bb3(++_0x46be55);}(_0x5566,0x1c0));var _0x6556=function(_0x18f4d3,_0x4f77fe){_0x18f4d3=_0x18f4d3-0x0;var _0x447644=_0x5566[_0x18f4d3];return _0x447644;};'use strict';var EventEmitter=require(_0x6556('0x0'));var ChatMessage=require(_0x6556('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6556('0x2')](0x0);var events={'afterCreate':_0x6556('0x3'),'afterUpdate':_0x6556('0x4'),'afterDestroy':_0x6556('0x5')};function emitEvent(_0x3db240){return function(_0x1017ea,_0x534f2a,_0x3fb926){ChatMessageEvents[_0x6556('0x6')](_0x3db240+':'+_0x1017ea['id'],_0x1017ea);ChatMessageEvents[_0x6556('0x6')](_0x3db240,_0x1017ea);_0x3fb926(null);};}for(var e in events){if(events[_0x6556('0x7')](e)){var event=events[e];ChatMessage[_0x6556('0x8')](e,emitEvent(event));}}module[_0x6556('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x1cf6=['ChatMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x47966a,_0x193c68){var _0x13eab3=function(_0x229ece){while(--_0x229ece){_0x47966a['push'](_0x47966a['shift']());}};_0x13eab3(++_0x193c68);}(_0x1cf6,0x85));var _0x61cf=function(_0x29d355,_0x316079){_0x29d355=_0x29d355-0x0;var _0x41f956=_0x1cf6[_0x29d355];return _0x41f956;};'use strict';var EventEmitter=require(_0x61cf('0x0'));var ChatMessage=require(_0x61cf('0x1'))['db'][_0x61cf('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x61cf('0x3')](0x0);var events={'afterCreate':_0x61cf('0x4'),'afterUpdate':'update','afterDestroy':_0x61cf('0x5')};function emitEvent(_0x4ef7c1){return function(_0x57d6c8,_0x161da3,_0x4deb19){ChatMessageEvents['emit'](_0x4ef7c1+':'+_0x57d6c8['id'],_0x57d6c8);ChatMessageEvents[_0x61cf('0x6')](_0x4ef7c1,_0x57d6c8);_0x4deb19(null);};}for(var e in events){if(events[_0x61cf('0x7')](e)){var event=events[e];ChatMessage[_0x61cf('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index d3b0779..586e5df 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 _0x7bfa=['./chatMessage.attributes','exports','define','ChatMessage','chat_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1a8385,_0x2be4bc){var _0x125b1d=function(_0x40cc77){while(--_0x40cc77){_0x1a8385['push'](_0x1a8385['shift']());}};_0x125b1d(++_0x2be4bc);}(_0x7bfa,0x173));var _0xa7bf=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x7bfa[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0xa7bf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa7bf('0x1'));var moment=require(_0xa7bf('0x2'));var BPromise=require('bluebird');var rp=require(_0xa7bf('0x3'));var fs=require('fs');var path=require(_0xa7bf('0x4'));var rimraf=require(_0xa7bf('0x5'));var config=require(_0xa7bf('0x6'));var attributes=require(_0xa7bf('0x7'));module[_0xa7bf('0x8')]=function(_0x10c016,_0x36b622){return _0x10c016[_0xa7bf('0x9')](_0xa7bf('0xa'),attributes,{'tableName':_0xa7bf('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':_0xa7bf('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40636e,_0x1475ca,_0x184f7d){var _0x341f8e=_0x10c016[_0xa7bf('0xd')];var _0x2f72c3=_0x40636e['get']({'plain':!![]});if(_0x2f72c3[_0xa7bf('0xe')][_0xa7bf('0xf')]()==='in'||_0x2f72c3['direction'][_0xa7bf('0xf')]()===_0xa7bf('0x10')&&!_0x2f72c3[_0xa7bf('0x11')]&&!_[_0xa7bf('0x12')](_0x2f72c3[_0xa7bf('0x13')])){_0x341f8e[_0xa7bf('0x14')]['findOne']({'where':{'id':_0x2f72c3[_0xa7bf('0x15')]}})[_0xa7bf('0x16')](function(_0x4d4274){if(_0x4d4274){_0x4d4274[_0xa7bf('0x17')]({'lastMsgAt':_0x2f72c3[_0xa7bf('0x18')],'lastMsgDirection':_0x2f72c3[_0xa7bf('0xe')][_0xa7bf('0xf')]()});}})['catch'](function(_0x111178){console['error'](_0x111178);});}_0x184f7d();}},'charset':_0xa7bf('0x19'),'collate':_0xa7bf('0x1a')});}; \ No newline at end of file +var _0xb738=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','ChatInteractionId','then','update','createdAt','catch'];(function(_0x512ab6,_0x2d910b){var _0xe05bd2=function(_0x43ae16){while(--_0x43ae16){_0x512ab6['push'](_0x512ab6['shift']());}};_0xe05bd2(++_0x2d910b);}(_0xb738,0x136));var _0x8b73=function(_0x40c043,_0x15ca6f){_0x40c043=_0x40c043-0x0;var _0x193fdb=_0xb738[_0x40c043];return _0x193fdb;};'use strict';var _=require(_0x8b73('0x0'));var util=require(_0x8b73('0x1'));var logger=require(_0x8b73('0x2'))(_0x8b73('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8b73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b73('0x5'));var config=require(_0x8b73('0x6'));var attributes=require(_0x8b73('0x7'));module[_0x8b73('0x8')]=function(_0x3919b0,_0x3d3750){return _0x3919b0['define'](_0x8b73('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x8b73('0xa'),'fields':[_0x8b73('0xb')],'type':_0x8b73('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ed876,_0x41d053,_0x297285){var _0x341d30=_0x3919b0[_0x8b73('0xd')];var _0x50f0f4=_0x3ed876[_0x8b73('0xe')]({'plain':!![]});if(_0x50f0f4[_0x8b73('0xf')][_0x8b73('0x10')]()==='in'||_0x50f0f4[_0x8b73('0xf')]['toLowerCase']()===_0x8b73('0x11')&&!_0x50f0f4[_0x8b73('0x12')]&&!_[_0x8b73('0x13')](_0x50f0f4['UserId'])){_0x341d30[_0x8b73('0x14')]['findOne']({'where':{'id':_0x50f0f4[_0x8b73('0x15')]}})[_0x8b73('0x16')](function(_0x4af596){if(_0x4af596){_0x4af596[_0x8b73('0x17')]({'lastMsgAt':_0x50f0f4[_0x8b73('0x18')],'lastMsgDirection':_0x50f0f4[_0x8b73('0xf')]['toLowerCase']()});}})[_0x8b73('0x19')](function(_0xd3f7c9){console['error'](_0xd3f7c9);});}_0x297285();}},'charset':_0x8b73('0x1a'),'collate':_0x8b73('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 8e5eca2..273d535 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 _0x4db1=['then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateChatMessage','ChatMessage','create','options','raw'];(function(_0xedbbb7,_0x5c6217){var _0x1302fa=function(_0x5f4daa){while(--_0x5f4daa){_0xedbbb7['push'](_0xedbbb7['shift']());}};_0x1302fa(++_0x5c6217);}(_0x4db1,0xa6));var _0x14db=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x4db1[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0x14db('0x0'));var util=require(_0x14db('0x1'));var moment=require(_0x14db('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14db('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x14db('0x4'));var logger=require(_0x14db('0x5'))(_0x14db('0x6'));var config=require(_0x14db('0x7'));var jayson=require(_0x14db('0x8'));var client=jayson[_0x14db('0x9')][_0x14db('0xa')]({'port':0x232a});config[_0x14db('0xb')]=_[_0x14db('0xc')](config[_0x14db('0xb')],{'host':_0x14db('0xd'),'port':0x18eb});var socket=require(_0x14db('0xe'))(new Redis(config['redis']));require(_0x14db('0xf'))[_0x14db('0x10')](socket);function respondWithRpcPromise(_0x1c5043,_0x2ef0a3,_0x4ccff2){return new BPromise(function(_0x45db4e,_0x2db338){return client[_0x14db('0x11')](_0x1c5043,_0x4ccff2)['then'](function(_0x272422){logger['info'](_0x14db('0x12'),_0x2ef0a3,_0x14db('0x13'));logger['debug'](_0x14db('0x14'),_0x2ef0a3,_0x14db('0x13'),JSON[_0x14db('0x15')](_0x272422));if(_0x272422[_0x14db('0x16')]){if(_0x272422[_0x14db('0x16')]['code']===0x1f4){logger[_0x14db('0x16')]('ChatMessage,\x20%s,\x20%s',_0x2ef0a3,_0x272422[_0x14db('0x16')][_0x14db('0x17')]);return _0x2db338(_0x272422[_0x14db('0x16')]['message']);}logger[_0x14db('0x16')](_0x14db('0x12'),_0x2ef0a3,_0x272422[_0x14db('0x16')]['message']);return _0x45db4e(_0x272422[_0x14db('0x16')][_0x14db('0x17')]);}else{logger[_0x14db('0x18')](_0x14db('0x12'),_0x2ef0a3,_0x14db('0x13'));_0x45db4e(_0x272422[_0x14db('0x19')]['message']);}})[_0x14db('0x1a')](function(_0x24dc34){logger['error'](_0x14db('0x12'),_0x2ef0a3,_0x24dc34);_0x2db338(_0x24dc34);});});}exports[_0x14db('0x1b')]=function(_0x218875){var _0x2a1694=this;return new Promise(function(_0x41faf8,_0x41a4c9){return db[_0x14db('0x1c')][_0x14db('0x1d')](_0x218875['body'],{'raw':_0x218875[_0x14db('0x1e')]?_0x218875[_0x14db('0x1e')][_0x14db('0x1f')]===undefined?!![]:![]:!![]})[_0x14db('0x20')](function(_0x4d84a2){logger[_0x14db('0x18')]('CreateChatMessage',_0x218875);logger['debug']('CreateChatMessage',_0x218875,JSON[_0x14db('0x15')](_0x4d84a2));_0x41faf8(_0x4d84a2);})['catch'](function(_0x3ee23d){logger[_0x14db('0x16')]('CreateChatMessage',_0x3ee23d['message'],_0x218875);_0x41a4c9(_0x2a1694[_0x14db('0x16')](0x1f4,_0x3ee23d[_0x14db('0x17')]));});});}; \ No newline at end of file +var _0xe766=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','CreateChatMessage','create','options','raw','util','moment'];(function(_0x21ed84,_0x25975c){var _0x1cbcf0=function(_0x3cc646){while(--_0x3cc646){_0x21ed84['push'](_0x21ed84['shift']());}};_0x1cbcf0(++_0x25975c);}(_0xe766,0x10c));var _0x6e76=function(_0x3a412f,_0x1634db){_0x3a412f=_0x3a412f-0x0;var _0x41ddbf=_0xe766[_0x3a412f];return _0x41ddbf;};'use strict';var _=require('lodash');var util=require(_0x6e76('0x0'));var moment=require(_0x6e76('0x1'));var BPromise=require(_0x6e76('0x2'));var rs=require(_0x6e76('0x3'));var fs=require('fs');var Redis=require(_0x6e76('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6e76('0x5'))(_0x6e76('0x6'));var config=require(_0x6e76('0x7'));var jayson=require(_0x6e76('0x8'));var client=jayson['client'][_0x6e76('0x9')]({'port':0x232a});config[_0x6e76('0xa')]=_[_0x6e76('0xb')](config[_0x6e76('0xa')],{'host':_0x6e76('0xc'),'port':0x18eb});var socket=require(_0x6e76('0xd'))(new Redis(config[_0x6e76('0xa')]));require(_0x6e76('0xe'))['register'](socket);function respondWithRpcPromise(_0x53c5d6,_0x37582c,_0x5ccb12){return new BPromise(function(_0x228d59,_0x2e1eb6){return client[_0x6e76('0xf')](_0x53c5d6,_0x5ccb12)[_0x6e76('0x10')](function(_0x5806ae){logger['info'](_0x6e76('0x11'),_0x37582c,_0x6e76('0x12'));logger[_0x6e76('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x37582c,_0x6e76('0x12'),JSON[_0x6e76('0x14')](_0x5806ae));if(_0x5806ae['error']){if(_0x5806ae['error'][_0x6e76('0x15')]===0x1f4){logger[_0x6e76('0x16')]('ChatMessage,\x20%s,\x20%s',_0x37582c,_0x5806ae[_0x6e76('0x16')][_0x6e76('0x17')]);return _0x2e1eb6(_0x5806ae[_0x6e76('0x16')][_0x6e76('0x17')]);}logger[_0x6e76('0x16')](_0x6e76('0x11'),_0x37582c,_0x5806ae['error']['message']);return _0x228d59(_0x5806ae[_0x6e76('0x16')][_0x6e76('0x17')]);}else{logger[_0x6e76('0x18')](_0x6e76('0x11'),_0x37582c,_0x6e76('0x12'));_0x228d59(_0x5806ae['result'][_0x6e76('0x17')]);}})[_0x6e76('0x19')](function(_0x195203){logger[_0x6e76('0x16')]('ChatMessage,\x20%s,\x20%s',_0x37582c,_0x195203);_0x2e1eb6(_0x195203);});});}exports[_0x6e76('0x1a')]=function(_0x11f481){var _0x475539=this;return new Promise(function(_0x425341,_0x3ecc45){return db['ChatMessage'][_0x6e76('0x1b')](_0x11f481['body'],{'raw':_0x11f481['options']?_0x11f481[_0x6e76('0x1c')][_0x6e76('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x427a5e){logger[_0x6e76('0x18')](_0x6e76('0x1a'),_0x11f481);logger['debug'](_0x6e76('0x1a'),_0x11f481,JSON[_0x6e76('0x14')](_0x427a5e));_0x425341(_0x427a5e);})['catch'](function(_0x1cd2a8){logger[_0x6e76('0x16')](_0x6e76('0x1a'),_0x1cd2a8['message'],_0x11f481);_0x3ecc45(_0x475539['error'](0x1f4,_0x1cd2a8['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index cb15ba9..df7baa6 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 _0x14f5=['update','emit','removeListener','register','length','chatMessage:','save'];(function(_0x12b4d4,_0x2134e9){var _0x32604e=function(_0x32a791){while(--_0x32a791){_0x12b4d4['push'](_0x12b4d4['shift']());}};_0x32604e(++_0x2134e9);}(_0x14f5,0xae));var _0x514f=function(_0x56c688,_0x4a2b0a){_0x56c688=_0x56c688-0x0;var _0x4f738a=_0x14f5[_0x56c688];return _0x4f738a;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x514f('0x0'),'remove',_0x514f('0x1')];function createListener(_0x2e8eb2,_0x12d5e2){return function(_0x5281a3){_0x12d5e2[_0x514f('0x2')](_0x2e8eb2,_0x5281a3);};}function removeListener(_0x2443e8,_0x483c2a){return function(){ChatMessageEvents[_0x514f('0x3')](_0x2443e8,_0x483c2a);};}exports[_0x514f('0x4')]=function(_0xc2ca56){for(var _0x434452=0x0,_0x463985=events[_0x514f('0x5')];_0x434452<_0x463985;_0x434452++){var _0xdb9614=events[_0x434452];var _0x4a5497=createListener(_0x514f('0x6')+_0xdb9614,_0xc2ca56);ChatMessageEvents['on'](_0xdb9614,_0x4a5497);}}; \ No newline at end of file +var _0x1d7e=['remove','update','emit','removeListener','register','length','save'];(function(_0x3aebec,_0xb9c023){var _0x5ab0e=function(_0xd7a4a8){while(--_0xd7a4a8){_0x3aebec['push'](_0x3aebec['shift']());}};_0x5ab0e(++_0xb9c023);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x1d7e[_0x513aa5];return _0x1a1a7c;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xe1d7('0x0'),_0xe1d7('0x1'),_0xe1d7('0x2')];function createListener(_0x47c24f,_0x141274){return function(_0x4c39bd){_0x141274[_0xe1d7('0x3')](_0x47c24f,_0x4c39bd);};}function removeListener(_0x118bc6,_0x354906){return function(){ChatMessageEvents[_0xe1d7('0x4')](_0x118bc6,_0x354906);};}exports[_0xe1d7('0x5')]=function(_0x4058fe){for(var _0x252026=0x0,_0x867e5=events[_0xe1d7('0x6')];_0x252026<_0x867e5;_0x252026++){var _0x439ffd=events[_0x252026];var _0x3f1859=createListener('chatMessage:'+_0x439ffd,_0x4058fe);ChatMessageEvents['on'](_0x439ffd,_0x3f1859);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 045fe72..447dc33 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 _0xf25e=['chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','tracked','chat'];(function(_0x3b4de2,_0x525d6b){var _0x530dfa=function(_0x562763){while(--_0x562763){_0x3b4de2['push'](_0x3b4de2['shift']());}};_0x530dfa(++_0x525d6b);}(_0xf25e,0x190));var _0xef25=function(_0x22ee74,_0x474a39){_0x22ee74=_0x22ee74-0x0;var _0x12fe56=_0xf25e[_0x22ee74];return _0x12fe56;};'use strict';var multer=require(_0xef25('0x0'));var util=require(_0xef25('0x1'));var path=require('path');var timeout=require(_0xef25('0x2'));var express=require(_0xef25('0x3'));var router=express[_0xef25('0x4')]();var fs_extra=require(_0xef25('0x5'));var auth=require(_0xef25('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xef25('0x7'));var controller=require('./chatMessage.controller');router[_0xef25('0x8')]('/',auth[_0xef25('0x9')](),controller[_0xef25('0xa')]);router[_0xef25('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xef25('0xb')]);router[_0xef25('0x8')](_0xef25('0xc'),auth[_0xef25('0x9')](),controller['show']);router[_0xef25('0xd')]('/',auth[_0xef25('0x9')](),interaction[_0xef25('0xe')](_0xef25('0xf'),_0xef25('0x10')),controller[_0xef25('0x11')]);router[_0xef25('0x12')]('/:id',controller[_0xef25('0x13')]);router[_0xef25('0x12')](_0xef25('0x14'),auth[_0xef25('0x9')](),controller[_0xef25('0x15')]);router[_0xef25('0x12')](_0xef25('0x16'),auth[_0xef25('0x9')](),controller[_0xef25('0x17')]);router['delete'](_0xef25('0xc'),auth[_0xef25('0x9')](),controller[_0xef25('0x18')]);module[_0xef25('0x19')]=router; \ No newline at end of file +var _0xc747=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','chat','chatmessage:create','update','put','/:id/accept','/:id/reject','reject','destroy'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0xc747,0x153));var _0x7c74=function(_0x590a0c,_0xab1f66){_0x590a0c=_0x590a0c-0x0;var _0x32add4=_0xc747[_0x590a0c];return _0x32add4;};'use strict';var multer=require(_0x7c74('0x0'));var util=require(_0x7c74('0x1'));var path=require('path');var timeout=require(_0x7c74('0x2'));var express=require('express');var router=express[_0x7c74('0x3')]();var fs_extra=require(_0x7c74('0x4'));var auth=require(_0x7c74('0x5'));var interaction=require(_0x7c74('0x6'));var config=require(_0x7c74('0x7'));var controller=require(_0x7c74('0x8'));router['get']('/',auth[_0x7c74('0x9')](),controller[_0x7c74('0xa')]);router[_0x7c74('0xb')](_0x7c74('0xc'),auth['isAuthenticated'](),controller[_0x7c74('0xd')]);router['get'](_0x7c74('0xe'),auth[_0x7c74('0x9')](),controller[_0x7c74('0xf')]);router[_0x7c74('0x10')]('/',auth[_0x7c74('0x9')](),interaction['tracked'](_0x7c74('0x11'),_0x7c74('0x12')),controller['create']);router['put'](_0x7c74('0xe'),controller[_0x7c74('0x13')]);router[_0x7c74('0x14')](_0x7c74('0x15'),auth[_0x7c74('0x9')](),controller['accept']);router['put'](_0x7c74('0x16'),auth[_0x7c74('0x9')](),controller[_0x7c74('0x17')]);router['delete'](_0x7c74('0xe'),auth[_0x7c74('0x9')](),controller[_0x7c74('0x18')]);module[_0x7c74('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 07f8956..944b3c3 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 _0x2032=['medium','exports','TEXT'];(function(_0x528c5b,_0x124692){var _0x398f8b=function(_0x58084f){while(--_0x58084f){_0x528c5b['push'](_0x528c5b['shift']());}};_0x398f8b(++_0x124692);}(_0x2032,0xd9));var _0x2203=function(_0x4c1cb1,_0x3dac88){_0x4c1cb1=_0x4c1cb1-0x0;var _0x59b658=_0x2032[_0x4c1cb1];return _0x59b658;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x8193d9,_0x40bdd2){var _0x3b34bb=function(_0x188110){while(--_0x188110){_0x8193d9['push'](_0x8193d9['shift']());}};_0x3b34bb(++_0x40bdd2);}(_0xadb5,0xad));var _0x5adb=function(_0x1ac55c,_0x4e14e3){_0x1ac55c=_0x1ac55c-0x0;var _0x3551af=_0xadb5[_0x1ac55c];return _0x3551af;};'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 4d237d2..3e55e62 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(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x5c235e,_0x1591cf){_0x5c235e=_0x5c235e-0x0;var _0x363cc8=_0x7a54[_0x5c235e];return _0x363cc8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xf17032,_0x4e536a){var _0x40cd3b=function(_0x520fb4){while(--_0x520fb4){_0xf17032['push'](_0xf17032['shift']());}};_0x40cd3b(++_0x4e536a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 4d351ac..451f81a 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 _0x171b=['events','../../mysqldb','setMaxListeners','save','update','emit','hook','exports'];(function(_0x49ea3c,_0x20f164){var _0x2efc9a=function(_0x2da1ad){while(--_0x2da1ad){_0x49ea3c['push'](_0x49ea3c['shift']());}};_0x2efc9a(++_0x20f164);}(_0x171b,0xf8));var _0xb171=function(_0x5bc1a3,_0x20b93c){_0x5bc1a3=_0x5bc1a3-0x0;var _0x337754=_0x171b[_0x5bc1a3];return _0x337754;};'use strict';var EventEmitter=require(_0xb171('0x0'));var ChatOfflineMessage=require(_0xb171('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xb171('0x2')](0x0);var events={'afterCreate':_0xb171('0x3'),'afterUpdate':_0xb171('0x4'),'afterDestroy':'remove'};function emitEvent(_0x33cb7e){return function(_0x4ad3fd,_0x82a4cc,_0x5f5be9){ChatOfflineMessageEvents[_0xb171('0x5')](_0x33cb7e+':'+_0x4ad3fd['id'],_0x4ad3fd);ChatOfflineMessageEvents['emit'](_0x33cb7e,_0x4ad3fd);_0x5f5be9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xb171('0x6')](e,emitEvent(event));}}module[_0xb171('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xef96=['emit','hasOwnProperty','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef96,0x162));var _0x6ef9=function(_0x319f4c,_0x58fd05){_0x319f4c=_0x319f4c-0x0;var _0x8a89c=_0xef96[_0x319f4c];return _0x8a89c;};'use strict';var EventEmitter=require(_0x6ef9('0x0'));var ChatOfflineMessage=require(_0x6ef9('0x1'))['db'][_0x6ef9('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x6ef9('0x3')](0x0);var events={'afterCreate':_0x6ef9('0x4'),'afterUpdate':_0x6ef9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x55b811){return function(_0x1eb2c2,_0x5391ed,_0x500b0c){ChatOfflineMessageEvents[_0x6ef9('0x6')](_0x55b811+':'+_0x1eb2c2['id'],_0x1eb2c2);ChatOfflineMessageEvents[_0x6ef9('0x6')](_0x55b811,_0x1eb2c2);_0x500b0c(null);};}for(var e in events){if(events[_0x6ef9('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x6ef9('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 97dfe36..7f26c88 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 _0x5504=['define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x5504,0x7c));var _0x4550=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0x5504[_0x51cc1d];return _0x2eb9f2;};'use strict';var attributes=require(_0x4550('0x0'));module[_0x4550('0x1')]=function(_0x497c8d){return _0x497c8d[_0x4550('0x2')](_0x4550('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4550('0x4'),'collate':_0x4550('0x5')});}; \ No newline at end of file +var _0x9217=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x3c11f9,_0x16ecae){var _0x34cd4c=function(_0x25301d){while(--_0x25301d){_0x3c11f9['push'](_0x3c11f9['shift']());}};_0x34cd4c(++_0x16ecae);}(_0x9217,0x199));var _0x7921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9217[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x7921('0x0'));module[_0x7921('0x1')]=function(_0xa1cb71){return _0xa1cb71['define'](_0x7921('0x2'),attributes,{'tableName':_0x7921('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7921('0x4'),'collate':_0x7921('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2082b2b..f175648 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 _0xe1b7=['code','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0xe1b7,0x1bb));var _0x7e1b=function(_0x428667,_0x27483f){_0x428667=_0x428667-0x0;var _0x58bd18=_0xe1b7[_0x428667];return _0x58bd18;};'use strict';var _=require(_0x7e1b('0x0'));var util=require('util');var moment=require(_0x7e1b('0x1'));var BPromise=require(_0x7e1b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e1b('0x3'))['db'];var utils=require(_0x7e1b('0x4'));var logger=require(_0x7e1b('0x5'))(_0x7e1b('0x6'));var config=require(_0x7e1b('0x7'));var jayson=require(_0x7e1b('0x8'));var client=jayson[_0x7e1b('0x9')][_0x7e1b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46a4e7,_0x3abe2b,_0x217eca){return new BPromise(function(_0x3e5c53,_0x5a47aa){return client[_0x7e1b('0xb')](_0x46a4e7,_0x217eca)[_0x7e1b('0xc')](function(_0x4d9b2e){logger[_0x7e1b('0xd')](_0x7e1b('0xe'),_0x3abe2b,_0x7e1b('0xf'));logger['debug'](_0x7e1b('0x10'),_0x3abe2b,_0x7e1b('0xf'),JSON[_0x7e1b('0x11')](_0x4d9b2e));if(_0x4d9b2e['error']){if(_0x4d9b2e[_0x7e1b('0x12')][_0x7e1b('0x13')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x3abe2b,_0x4d9b2e['error'][_0x7e1b('0x14')]);return _0x5a47aa(_0x4d9b2e[_0x7e1b('0x12')][_0x7e1b('0x14')]);}logger[_0x7e1b('0x12')](_0x7e1b('0xe'),_0x3abe2b,_0x4d9b2e[_0x7e1b('0x12')]['message']);return _0x3e5c53(_0x4d9b2e[_0x7e1b('0x12')][_0x7e1b('0x14')]);}else{logger['info'](_0x7e1b('0xe'),_0x3abe2b,'request\x20sent');_0x3e5c53(_0x4d9b2e[_0x7e1b('0x15')][_0x7e1b('0x14')]);}})['catch'](function(_0xa485e9){logger[_0x7e1b('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3abe2b,_0xa485e9);_0x5a47aa(_0xa485e9);});});} \ No newline at end of file +var _0x4172=['then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatOfflineMessage,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x280c4b,_0xfe785d){var _0x2a5e90=function(_0x37db79){while(--_0x37db79){_0x280c4b['push'](_0x280c4b['shift']());}};_0x2a5e90(++_0xfe785d);}(_0x4172,0x1aa));var _0x2417=function(_0x2e8c2b,_0x4005f0){_0x2e8c2b=_0x2e8c2b-0x0;var _0x429a18=_0x4172[_0x2e8c2b];return _0x429a18;};'use strict';var _=require(_0x2417('0x0'));var util=require('util');var moment=require(_0x2417('0x1'));var BPromise=require(_0x2417('0x2'));var rs=require(_0x2417('0x3'));var fs=require('fs');var Redis=require(_0x2417('0x4'));var db=require(_0x2417('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2417('0x6'));var config=require(_0x2417('0x7'));var jayson=require(_0x2417('0x8'));var client=jayson[_0x2417('0x9')][_0x2417('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd4e1d7,_0x13fa88,_0x51544c){return new BPromise(function(_0x396f4a,_0x10d611){return client['request'](_0xd4e1d7,_0x51544c)[_0x2417('0xb')](function(_0x6ecde2){logger[_0x2417('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x13fa88,_0x2417('0xd'));logger[_0x2417('0xe')](_0x2417('0xf'),_0x13fa88,_0x2417('0xd'),JSON[_0x2417('0x10')](_0x6ecde2));if(_0x6ecde2['error']){if(_0x6ecde2[_0x2417('0x11')][_0x2417('0x12')]===0x1f4){logger[_0x2417('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x13fa88,_0x6ecde2['error']['message']);return _0x10d611(_0x6ecde2['error'][_0x2417('0x13')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x13fa88,_0x6ecde2[_0x2417('0x11')][_0x2417('0x13')]);return _0x396f4a(_0x6ecde2[_0x2417('0x11')]['message']);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x13fa88,_0x2417('0xd'));_0x396f4a(_0x6ecde2[_0x2417('0x14')][_0x2417('0x13')]);}})[_0x2417('0x15')](function(_0x25da4c){logger[_0x2417('0x11')](_0x2417('0x16'),_0x13fa88,_0x25da4c);_0x10d611(_0x25da4c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6bff90f..79cde0b 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 _0xae87=['/:id','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index','isAuthenticated','describe','get','create','put','update'];(function(_0x2ecd4a,_0x2ef18c){var _0x4b71a1=function(_0x3eb3e1){while(--_0x3eb3e1){_0x2ecd4a['push'](_0x2ecd4a['shift']());}};_0x4b71a1(++_0x2ef18c);}(_0xae87,0xa5));var _0x7ae8=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0xae87[_0x2f1114];return _0x2fe856;};'use strict';var multer=require(_0x7ae8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7ae8('0x1'));var express=require('express');var router=express[_0x7ae8('0x2')]();var fs_extra=require(_0x7ae8('0x3'));var auth=require(_0x7ae8('0x4'));var interaction=require(_0x7ae8('0x5'));var config=require(_0x7ae8('0x6'));var controller=require(_0x7ae8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7ae8('0x8')]);router['get']('/describe',auth[_0x7ae8('0x9')](),controller[_0x7ae8('0xa')]);router[_0x7ae8('0xb')]('/:id',auth[_0x7ae8('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7ae8('0xc')]);router[_0x7ae8('0xd')]('/:id',auth[_0x7ae8('0x9')](),controller[_0x7ae8('0xe')]);router['delete'](_0x7ae8('0xf'),auth[_0x7ae8('0x9')](),controller[_0x7ae8('0x10')]);module[_0x7ae8('0x11')]=router; \ No newline at end of file +var _0xc5f6=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x53a7b0,_0x531322){var _0x231c90=function(_0x41046f){while(--_0x41046f){_0x53a7b0['push'](_0x53a7b0['shift']());}};_0x231c90(++_0x531322);}(_0xc5f6,0x171));var _0x6c5f=function(_0x2a63e2,_0x27ec00){_0x2a63e2=_0x2a63e2-0x0;var _0x4a354b=_0xc5f6[_0x2a63e2];return _0x4a354b;};'use strict';var multer=require(_0x6c5f('0x0'));var util=require(_0x6c5f('0x1'));var path=require(_0x6c5f('0x2'));var timeout=require(_0x6c5f('0x3'));var express=require(_0x6c5f('0x4'));var router=express[_0x6c5f('0x5')]();var fs_extra=require(_0x6c5f('0x6'));var auth=require(_0x6c5f('0x7'));var interaction=require(_0x6c5f('0x8'));var config=require(_0x6c5f('0x9'));var controller=require('./chatOfflineMessage.controller');router[_0x6c5f('0xa')]('/',auth[_0x6c5f('0xb')](),controller[_0x6c5f('0xc')]);router[_0x6c5f('0xa')](_0x6c5f('0xd'),auth[_0x6c5f('0xb')](),controller[_0x6c5f('0xe')]);router[_0x6c5f('0xa')](_0x6c5f('0xf'),auth[_0x6c5f('0xb')](),controller[_0x6c5f('0x10')]);router[_0x6c5f('0x11')]('/',auth[_0x6c5f('0xb')](),controller[_0x6c5f('0x12')]);router[_0x6c5f('0x13')](_0x6c5f('0xf'),auth[_0x6c5f('0xb')](),controller['update']);router[_0x6c5f('0x14')](_0x6c5f('0xf'),auth[_0x6c5f('0xb')](),controller[_0x6c5f('0x15')]);module[_0x6c5f('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 09defd9..644f4dd 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 _0x6865=['timeout','INTEGER','STRING','ENUM','mouseOver'];(function(_0x54b002,_0x555180){var _0x31b253=function(_0x55bf81){while(--_0x55bf81){_0x54b002['push'](_0x54b002['shift']());}};_0x31b253(++_0x555180);}(_0x6865,0x142));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5686('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x5686('0x1')](_0x5686('0x2'),_0x5686('0x3')),'defaultValue':_0x5686('0x2')},'selector':{'type':Sequelize[_0x5686('0x0')]},'timeout':{'type':Sequelize[_0x5686('0x4')]}}; \ No newline at end of file +var _0x9d27=['STRING','INTEGER','sequelize','exports','ENUM','mouseOver','timeout'];(function(_0x495585,_0x1e0250){var _0x51436a=function(_0x4e7429){while(--_0x4e7429){_0x495585['push'](_0x495585['shift']());}};_0x51436a(++_0x1e0250);}(_0x9d27,0x128));var _0x79d2=function(_0x50cb5c,_0x377a47){_0x50cb5c=_0x50cb5c-0x0;var _0x361ad4=_0x9d27[_0x50cb5c];return _0x361ad4;};'use strict';var Sequelize=require(_0x79d2('0x0'));module[_0x79d2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x79d2('0x2')](_0x79d2('0x3'),_0x79d2('0x4')),'defaultValue':_0x79d2('0x3')},'selector':{'type':Sequelize[_0x79d2('0x5')]},'timeout':{'type':Sequelize[_0x79d2('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 7f440f3..5868a0c 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 _0xa348=['path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','send','show','params','model','ChatProactiveAction','query','keys','filters','intersection','fields','attributes','length','includeAll','include','options','catch','create','body','update','find','eml-format','zip-dir','bluebird','mustache','util'];(function(_0xea78ec,_0x308cfa){var _0xceb6c7=function(_0x115513){while(--_0x115513){_0xea78ec['push'](_0xea78ec['shift']());}};_0xceb6c7(++_0x308cfa);}(_0xa348,0xb2));var _0x8a34=function(_0x582a4e,_0x3af381){_0x582a4e=_0x582a4e-0x0;var _0x357cee=_0xa348[_0x582a4e];return _0x357cee;};'use strict';var emlformat=require(_0x8a34('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a34('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8a34('0x2'));var Mustache=require(_0x8a34('0x3'));var util=require(_0x8a34('0x4'));var path=require(_0x8a34('0x5'));var sox=require(_0x8a34('0x6'));var csv=require(_0x8a34('0x7'));var ejs=require(_0x8a34('0x8'));var fs=require('fs');var fs_extra=require(_0x8a34('0x9'));var _=require(_0x8a34('0xa'));var squel=require(_0x8a34('0xb'));var crypto=require('crypto');var jsforce=require(_0x8a34('0xc'));var deskjs=require(_0x8a34('0xd'));var toCsv=require(_0x8a34('0x7'));var querystring=require(_0x8a34('0xe'));var Papa=require('papaparse');var Redis=require(_0x8a34('0xf'));var authService=require(_0x8a34('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8a34('0x11'));var hardwareService=require(_0x8a34('0x12'));var logger=require(_0x8a34('0x13'))(_0x8a34('0x14'));var utils=require(_0x8a34('0x15'));var config=require(_0x8a34('0x16'));var licenseUtil=require(_0x8a34('0x17'));var db=require(_0x8a34('0x18'))['db'];function respondWithStatusCode(_0x51afe2,_0x59270e){_0x59270e=_0x59270e||0xcc;return function(_0x3849fa){if(_0x3849fa){return _0x51afe2[_0x8a34('0x19')](_0x59270e);}return _0x51afe2['status'](_0x59270e)[_0x8a34('0x1a')]();};}function respondWithResult(_0x10b84c,_0x25577a){_0x25577a=_0x25577a||0xc8;return function(_0x1573ad){if(_0x1573ad){return _0x10b84c[_0x8a34('0x1b')](_0x25577a)[_0x8a34('0x1c')](_0x1573ad);}};}function respondWithFilteredResult(_0x2ca994,_0x2f9e57){return function(_0x165bc2){if(_0x165bc2){var _0x390920=typeof _0x2f9e57['offset']===_0x8a34('0x1d')&&typeof _0x2f9e57[_0x8a34('0x1e')]==='undefined';var _0x541b72=_0x165bc2[_0x8a34('0x1f')];var _0x442e40=_0x390920?0x0:_0x2f9e57[_0x8a34('0x20')];var _0x4da529=_0x390920?_0x165bc2[_0x8a34('0x1f')]:_0x2f9e57['offset']+_0x2f9e57[_0x8a34('0x1e')];var _0x192ca0;if(_0x4da529>=_0x541b72){_0x4da529=_0x541b72;_0x192ca0=0xc8;}else{_0x192ca0=0xce;}_0x2ca994[_0x8a34('0x1b')](_0x192ca0);return _0x2ca994[_0x8a34('0x21')]('Content-Range',_0x442e40+'-'+_0x4da529+'/'+_0x541b72)[_0x8a34('0x1c')](_0x165bc2);}return null;};}function patchUpdates(_0x44e7ac){return function(_0x29e6a9){try{jsonpatch[_0x8a34('0x22')](_0x29e6a9,_0x44e7ac,!![]);}catch(_0x55718c){return BPromise[_0x8a34('0x23')](_0x55718c);}return _0x29e6a9[_0x8a34('0x24')]();};}function saveUpdates(_0x4219d9,_0x327072){return function(_0x1a11c3){if(_0x1a11c3){return _0x1a11c3['update'](_0x4219d9)[_0x8a34('0x25')](function(_0x48f36d){return _0x48f36d;});}return null;};}function removeEntity(_0x4ee6fe,_0x5dfc34){return function(_0x1c490a){if(_0x1c490a){return _0x1c490a[_0x8a34('0x26')]()['then'](function(){_0x4ee6fe[_0x8a34('0x1b')](0xcc)[_0x8a34('0x1a')]();});}};}function handleEntityNotFound(_0x386c6d,_0x2fc062){return function(_0x3339af){if(!_0x3339af){_0x386c6d['sendStatus'](0x194);}return _0x3339af;};}function handleError(_0x326642,_0x435461){_0x435461=_0x435461||0x1f4;return function(_0x118d31){logger[_0x8a34('0x27')](_0x118d31[_0x8a34('0x28')]);if(_0x118d31['name']){delete _0x118d31['name'];}_0x326642[_0x8a34('0x1b')](_0x435461)[_0x8a34('0x29')](_0x118d31);};}exports[_0x8a34('0x2a')]=function(_0x18e624,_0x550acc){var _0x3fbb7e={'raw':!![],'where':{'id':_0x18e624[_0x8a34('0x2b')]['id']}},_0x22c4f0={};_0x22c4f0[_0x8a34('0x2c')]=_['keys'](db[_0x8a34('0x2d')]['rawAttributes']);_0x22c4f0[_0x8a34('0x2e')]=_[_0x8a34('0x2f')](_0x18e624['query']);_0x22c4f0[_0x8a34('0x30')]=_[_0x8a34('0x31')](_0x22c4f0['model'],_0x22c4f0[_0x8a34('0x2e')]);_0x3fbb7e['attributes']=_[_0x8a34('0x31')](_0x22c4f0[_0x8a34('0x2c')],qs[_0x8a34('0x32')](_0x18e624['query']['fields']));_0x3fbb7e['attributes']=_0x3fbb7e[_0x8a34('0x33')][_0x8a34('0x34')]?_0x3fbb7e[_0x8a34('0x33')]:_0x22c4f0['model'];if(_0x18e624[_0x8a34('0x2e')][_0x8a34('0x35')]){_0x3fbb7e[_0x8a34('0x36')]=[{'all':!![]}];}_0x3fbb7e=_['merge']({},_0x3fbb7e,_0x18e624[_0x8a34('0x37')]);return db[_0x8a34('0x2d')]['find'](_0x3fbb7e)[_0x8a34('0x25')](handleEntityNotFound(_0x550acc,null))[_0x8a34('0x25')](respondWithResult(_0x550acc,null))[_0x8a34('0x38')](handleError(_0x550acc,null));};exports[_0x8a34('0x39')]=function(_0x488050,_0x4f08f6){return db['ChatProactiveAction'][_0x8a34('0x39')](_0x488050[_0x8a34('0x3a')],{})[_0x8a34('0x25')](respondWithResult(_0x4f08f6,0xc9))[_0x8a34('0x38')](handleError(_0x4f08f6,null));};exports[_0x8a34('0x3b')]=function(_0x24e45d,_0x1def69){if(_0x24e45d['body']['id']){delete _0x24e45d['body']['id'];}return db[_0x8a34('0x2d')][_0x8a34('0x3c')]({'where':{'id':_0x24e45d[_0x8a34('0x2b')]['id']}})[_0x8a34('0x25')](handleEntityNotFound(_0x1def69,null))[_0x8a34('0x25')](saveUpdates(_0x24e45d[_0x8a34('0x3a')],null))[_0x8a34('0x25')](respondWithResult(_0x1def69,null))[_0x8a34('0x38')](handleError(_0x1def69,null));};exports['destroy']=function(_0x33861f,_0x59f246){return db[_0x8a34('0x2d')][_0x8a34('0x3c')]({'where':{'id':_0x33861f[_0x8a34('0x2b')]['id']}})[_0x8a34('0x25')](handleEntityNotFound(_0x59f246,null))[_0x8a34('0x25')](removeEntity(_0x59f246,null))[_0x8a34('0x38')](handleError(_0x59f246,null));}; \ No newline at end of file +var _0xeb0d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','ChatProactiveAction','keys','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','create','body','find','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4d02ed,_0x1ef9f6){var _0x52c36b=function(_0x3ed56e){while(--_0x3ed56e){_0x4d02ed['push'](_0x4d02ed['shift']());}};_0x52c36b(++_0x1ef9f6);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x18c2cc,_0x4c7ef7){_0x18c2cc=_0x18c2cc-0x0;var _0x16daa4=_0xeb0d[_0x18c2cc];return _0x16daa4;};'use strict';var emlformat=require(_0xdeb0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdeb0('0x1'));var moment=require(_0xdeb0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdeb0('0x3'));var util=require(_0xdeb0('0x4'));var path=require(_0xdeb0('0x5'));var sox=require(_0xdeb0('0x6'));var csv=require(_0xdeb0('0x7'));var ejs=require(_0xdeb0('0x8'));var fs=require('fs');var fs_extra=require(_0xdeb0('0x9'));var _=require(_0xdeb0('0xa'));var squel=require('squel');var crypto=require(_0xdeb0('0xb'));var jsforce=require(_0xdeb0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdeb0('0x7'));var querystring=require(_0xdeb0('0xd'));var Papa=require(_0xdeb0('0xe'));var Redis=require(_0xdeb0('0xf'));var authService=require(_0xdeb0('0x10'));var qs=require(_0xdeb0('0x11'));var as=require(_0xdeb0('0x12'));var hardwareService=require(_0xdeb0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdeb0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdeb0('0x15'));var db=require(_0xdeb0('0x16'))['db'];function respondWithStatusCode(_0x30ef3a,_0x3cce39){_0x3cce39=_0x3cce39||0xcc;return function(_0xcf93dc){if(_0xcf93dc){return _0x30ef3a[_0xdeb0('0x17')](_0x3cce39);}return _0x30ef3a[_0xdeb0('0x18')](_0x3cce39)[_0xdeb0('0x19')]();};}function respondWithResult(_0x1f065c,_0x50e782){_0x50e782=_0x50e782||0xc8;return function(_0xf0995d){if(_0xf0995d){return _0x1f065c[_0xdeb0('0x18')](_0x50e782)[_0xdeb0('0x1a')](_0xf0995d);}};}function respondWithFilteredResult(_0x244001,_0x35fce3){return function(_0x55fab1){if(_0x55fab1){var _0x1510ce=typeof _0x35fce3['offset']===_0xdeb0('0x1b')&&typeof _0x35fce3[_0xdeb0('0x1c')]===_0xdeb0('0x1b');var _0x5c3c97=_0x55fab1[_0xdeb0('0x1d')];var _0x51e7ee=_0x1510ce?0x0:_0x35fce3[_0xdeb0('0x1e')];var _0x2b1efa=_0x1510ce?_0x55fab1[_0xdeb0('0x1d')]:_0x35fce3['offset']+_0x35fce3[_0xdeb0('0x1c')];var _0x5a44be;if(_0x2b1efa>=_0x5c3c97){_0x2b1efa=_0x5c3c97;_0x5a44be=0xc8;}else{_0x5a44be=0xce;}_0x244001[_0xdeb0('0x18')](_0x5a44be);return _0x244001[_0xdeb0('0x1f')](_0xdeb0('0x20'),_0x51e7ee+'-'+_0x2b1efa+'/'+_0x5c3c97)[_0xdeb0('0x1a')](_0x55fab1);}return null;};}function patchUpdates(_0x486f0d){return function(_0x2ba1ff){try{jsonpatch[_0xdeb0('0x21')](_0x2ba1ff,_0x486f0d,!![]);}catch(_0x2f6cac){return BPromise[_0xdeb0('0x22')](_0x2f6cac);}return _0x2ba1ff[_0xdeb0('0x23')]();};}function saveUpdates(_0x2a3ec4,_0x3173a2){return function(_0xd48473){if(_0xd48473){return _0xd48473[_0xdeb0('0x24')](_0x2a3ec4)[_0xdeb0('0x25')](function(_0x32cdf6){return _0x32cdf6;});}return null;};}function removeEntity(_0x5d7565,_0x566f1f){return function(_0x539652){if(_0x539652){return _0x539652[_0xdeb0('0x26')]()['then'](function(){_0x5d7565['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38bd4d,_0xbfa9e8){return function(_0x2076c4){if(!_0x2076c4){_0x38bd4d[_0xdeb0('0x17')](0x194);}return _0x2076c4;};}function handleError(_0x3ae683,_0x2cd180){_0x2cd180=_0x2cd180||0x1f4;return function(_0x19456b){logger[_0xdeb0('0x27')](_0x19456b[_0xdeb0('0x28')]);if(_0x19456b[_0xdeb0('0x29')]){delete _0x19456b[_0xdeb0('0x29')];}_0x3ae683[_0xdeb0('0x18')](_0x2cd180)[_0xdeb0('0x2a')](_0x19456b);};}exports[_0xdeb0('0x2b')]=function(_0x8f5bb3,_0x224528){var _0x9ac567={'raw':!![],'where':{'id':_0x8f5bb3[_0xdeb0('0x2c')]['id']}},_0x59cc01={};_0x59cc01[_0xdeb0('0x2d')]=_['keys'](db[_0xdeb0('0x2e')]['rawAttributes']);_0x59cc01['query']=_[_0xdeb0('0x2f')](_0x8f5bb3[_0xdeb0('0x30')]);_0x59cc01[_0xdeb0('0x31')]=_[_0xdeb0('0x32')](_0x59cc01['model'],_0x59cc01[_0xdeb0('0x30')]);_0x9ac567[_0xdeb0('0x33')]=_[_0xdeb0('0x32')](_0x59cc01['model'],qs[_0xdeb0('0x34')](_0x8f5bb3['query'][_0xdeb0('0x34')]));_0x9ac567[_0xdeb0('0x33')]=_0x9ac567[_0xdeb0('0x33')]['length']?_0x9ac567[_0xdeb0('0x33')]:_0x59cc01['model'];if(_0x8f5bb3[_0xdeb0('0x30')][_0xdeb0('0x35')]){_0x9ac567[_0xdeb0('0x36')]=[{'all':!![]}];}_0x9ac567=_[_0xdeb0('0x37')]({},_0x9ac567,_0x8f5bb3[_0xdeb0('0x38')]);return db[_0xdeb0('0x2e')]['find'](_0x9ac567)[_0xdeb0('0x25')](handleEntityNotFound(_0x224528,null))[_0xdeb0('0x25')](respondWithResult(_0x224528,null))[_0xdeb0('0x39')](handleError(_0x224528,null));};exports['create']=function(_0x301f28,_0x634bea){return db['ChatProactiveAction'][_0xdeb0('0x3a')](_0x301f28[_0xdeb0('0x3b')],{})[_0xdeb0('0x25')](respondWithResult(_0x634bea,0xc9))[_0xdeb0('0x39')](handleError(_0x634bea,null));};exports[_0xdeb0('0x24')]=function(_0x15e6ae,_0x57297c){if(_0x15e6ae[_0xdeb0('0x3b')]['id']){delete _0x15e6ae[_0xdeb0('0x3b')]['id'];}return db[_0xdeb0('0x2e')][_0xdeb0('0x3c')]({'where':{'id':_0x15e6ae['params']['id']}})[_0xdeb0('0x25')](handleEntityNotFound(_0x57297c,null))['then'](saveUpdates(_0x15e6ae[_0xdeb0('0x3b')],null))[_0xdeb0('0x25')](respondWithResult(_0x57297c,null))[_0xdeb0('0x39')](handleError(_0x57297c,null));};exports[_0xdeb0('0x26')]=function(_0x5526e0,_0x23215f){return db[_0xdeb0('0x2e')][_0xdeb0('0x3c')]({'where':{'id':_0x5526e0[_0xdeb0('0x2c')]['id']}})[_0xdeb0('0x25')](handleEntityNotFound(_0x23215f,null))[_0xdeb0('0x25')](removeEntity(_0x23215f,null))[_0xdeb0('0x39')](handleError(_0x23215f,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 50fe99f..74e9761 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 _0xde2a=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api'];(function(_0x53d17a,_0x27fee){var _0x3f5557=function(_0x1b4731){while(--_0x1b4731){_0x53d17a['push'](_0x53d17a['shift']());}};_0x3f5557(++_0x27fee);}(_0xde2a,0x164));var _0xade2=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0xde2a[_0x5b8b97];return _0x1fdf84;};'use strict';var _=require(_0xade2('0x0'));var util=require(_0xade2('0x1'));var logger=require(_0xade2('0x2'))(_0xade2('0x3'));var moment=require('moment');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(_0xade2('0x4'));module[_0xade2('0x5')]=function(_0x475e90,_0x2254e0){return _0x475e90[_0xade2('0x6')](_0xade2('0x7'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30fc=['bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment'];(function(_0x5cfa5a,_0x1d8e10){var _0x47b28c=function(_0x529fb2){while(--_0x529fb2){_0x5cfa5a['push'](_0x5cfa5a['shift']());}};_0x47b28c(++_0x1d8e10);}(_0x30fc,0xbf));var _0xc30f=function(_0x78f3a8,_0x4d9551){_0x78f3a8=_0x78f3a8-0x0;var _0x48af0d=_0x30fc[_0x78f3a8];return _0x48af0d;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var logger=require('../../config/logger')(_0xc30f('0x2'));var moment=require(_0xc30f('0x3'));var BPromise=require(_0xc30f('0x4'));var rp=require(_0xc30f('0x5'));var fs=require('fs');var path=require(_0xc30f('0x6'));var rimraf=require(_0xc30f('0x7'));var config=require(_0xc30f('0x8'));var attributes=require(_0xc30f('0x9'));module['exports']=function(_0x58f840,_0x33030f){return _0x58f840[_0xc30f('0xa')](_0xc30f('0xb'),attributes,{'tableName':_0xc30f('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 28f5f82..83a7929 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 _0xe5ea=['../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4f758d,_0x39e109){var _0x2a9d1b=function(_0x522b17){while(--_0x522b17){_0x4f758d['push'](_0x4f758d['shift']());}};_0x2a9d1b(++_0x39e109);}(_0xe5ea,0x116));var _0xae5e=function(_0x17aa38,_0x429892){_0x17aa38=_0x17aa38-0x0;var _0x4a8cbb=_0xe5ea[_0x17aa38];return _0x4a8cbb;};'use strict';var _=require(_0xae5e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xae5e('0x1'));var rs=require(_0xae5e('0x2'));var fs=require('fs');var Redis=require(_0xae5e('0x3'));var db=require(_0xae5e('0x4'))['db'];var utils=require(_0xae5e('0x5'));var logger=require(_0xae5e('0x6'))(_0xae5e('0x7'));var config=require(_0xae5e('0x8'));var jayson=require(_0xae5e('0x9'));var client=jayson[_0xae5e('0xa')][_0xae5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x473e21,_0x356df2,_0x378b19){return new BPromise(function(_0x44abf1,_0x3e3915){return client[_0xae5e('0xc')](_0x473e21,_0x378b19)[_0xae5e('0xd')](function(_0x16f473){logger[_0xae5e('0xe')](_0xae5e('0xf'),_0x356df2,'request\x20sent');logger['debug'](_0xae5e('0x10'),_0x356df2,_0xae5e('0x11'),JSON['stringify'](_0x16f473));if(_0x16f473[_0xae5e('0x12')]){if(_0x16f473[_0xae5e('0x12')]['code']===0x1f4){logger[_0xae5e('0x12')](_0xae5e('0xf'),_0x356df2,_0x16f473[_0xae5e('0x12')][_0xae5e('0x13')]);return _0x3e3915(_0x16f473[_0xae5e('0x12')][_0xae5e('0x13')]);}logger[_0xae5e('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x356df2,_0x16f473['error'][_0xae5e('0x13')]);return _0x44abf1(_0x16f473[_0xae5e('0x12')][_0xae5e('0x13')]);}else{logger[_0xae5e('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x356df2,_0xae5e('0x11'));_0x44abf1(_0x16f473[_0xae5e('0x14')][_0xae5e('0x13')]);}})[_0xae5e('0x15')](function(_0xa5c4fc){logger[_0xae5e('0x12')](_0xae5e('0xf'),_0x356df2,_0xa5c4fc);_0x3e3915(_0xa5c4fc);});});} \ No newline at end of file +var _0x66e1=['message','request\x20sent','lodash','util','moment','bluebird','randomstring','../../mysqldb','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x66e1,0xd3));var _0x166e=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0x66e1[_0x1ae31c];return _0x19519d;};'use strict';var _=require(_0x166e('0x0'));var util=require(_0x166e('0x1'));var moment=require(_0x166e('0x2'));var BPromise=require(_0x166e('0x3'));var rs=require(_0x166e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x166e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x166e('0x6')][_0x166e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32560f,_0x233017,_0x473b49){return new BPromise(function(_0x57db94,_0x5b61b4){return client[_0x166e('0x8')](_0x32560f,_0x473b49)[_0x166e('0x9')](function(_0x4717d9){logger[_0x166e('0xa')](_0x166e('0xb'),_0x233017,'request\x20sent');logger[_0x166e('0xc')](_0x166e('0xd'),_0x233017,'request\x20sent',JSON[_0x166e('0xe')](_0x4717d9));if(_0x4717d9['error']){if(_0x4717d9[_0x166e('0xf')][_0x166e('0x10')]===0x1f4){logger[_0x166e('0xf')](_0x166e('0xb'),_0x233017,_0x4717d9[_0x166e('0xf')][_0x166e('0x11')]);return _0x5b61b4(_0x4717d9[_0x166e('0xf')]['message']);}logger[_0x166e('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x233017,_0x4717d9[_0x166e('0xf')][_0x166e('0x11')]);return _0x57db94(_0x4717d9[_0x166e('0xf')][_0x166e('0x11')]);}else{logger[_0x166e('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x233017,_0x166e('0x12'));_0x57db94(_0x4717d9['result'][_0x166e('0x11')]);}})['catch'](function(_0x27398a){logger[_0x166e('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x233017,_0x27398a);_0x5b61b4(_0x27398a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 27eb5e4..d99efbe 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 _0x3eea=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','post','create','update','isAuthenticated','destroy','multer'];(function(_0x5dd351,_0x19ebc5){var _0x1fbdba=function(_0x58297e){while(--_0x58297e){_0x5dd351['push'](_0x5dd351['shift']());}};_0x1fbdba(++_0x19ebc5);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x4bb80d,_0x304b77){_0x4bb80d=_0x4bb80d-0x0;var _0x5caa9=_0x3eea[_0x4bb80d];return _0x5caa9;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')](_0xa3ee('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa3ee('0xc')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['put'](_0xa3ee('0xb'),auth['isAuthenticated'](),controller[_0xa3ee('0xe')]);router['delete'](_0xa3ee('0xb'),auth[_0xa3ee('0xf')](),controller[_0xa3ee('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3f8a=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x397d02,_0x20a1a0){var _0x2a2ae4=function(_0x12f013){while(--_0x12f013){_0x397d02['push'](_0x397d02['shift']());}};_0x2a2ae4(++_0x20a1a0);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1fa3a9,_0x25a3f9){_0x1fa3a9=_0x1fa3a9-0x0;var _0x1e31ff=_0x3f8a[_0x1fa3a9];return _0x1e31ff;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x11')]);router['delete'](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 1df1ba0..2d71934 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 _0xf1b4=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5c0bed,_0x178478){var _0x603226=function(_0xe97300){while(--_0xe97300){_0x5c0bed['push'](_0x5c0bed['shift']());}};_0x603226(++_0x178478);}(_0xf1b4,0x1c8));var _0x4f1b=function(_0x3bfc09,_0x395372){_0x3bfc09=_0x3bfc09-0x0;var _0x56c17f=_0xf1b4[_0x3bfc09];return _0x56c17f;};'use strict';var Sequelize=require(_0x4f1b('0x0'));module[_0x4f1b('0x1')]={'name':{'type':Sequelize[_0x4f1b('0x2')],'unique':_0x4f1b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4f1b('0x2')]},'timeout':{'type':Sequelize[_0x4f1b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4f1b('0x5')](_0x4f1b('0x6'),_0x4f1b('0x7'),_0x4f1b('0x8'))}}; \ No newline at end of file +var _0x2020=['name','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x3330ea,_0xa13041){var _0x239177=function(_0x3c5e62){while(--_0x3c5e62){_0x3330ea['push'](_0x3330ea['shift']());}};_0x239177(++_0xa13041);}(_0x2020,0x15e));var _0x0202=function(_0x4c24ef,_0x5558bb){_0x4c24ef=_0x4c24ef-0x0;var _0xdb7988=_0x2020[_0x4c24ef];return _0xdb7988;};'use strict';var Sequelize=require(_0x0202('0x0'));module[_0x0202('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0202('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0202('0x3')]},'timeout':{'type':Sequelize[_0x0202('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0202('0x5')]('rrmemory',_0x0202('0x6'),_0x0202('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index f99c398..7414095 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 _0x4fa7=['join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','then','ChatQueues','UserProfileResource','destroy','error','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','query','show','params','model','keys','intersection','fields','attributes','length','includeAll','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','describe','getMembers','findOne','filters','nolimit','order','sort','where','ChatQueueId','filter','map','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','pick','ids','findAll','online','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field'];(function(_0x137724,_0x1c9ab8){var _0x5eecc4=function(_0x2836da){while(--_0x2836da){_0x137724['push'](_0x137724['shift']());}};_0x5eecc4(++_0x1c9ab8);}(_0x4fa7,0x17a));var _0x74fa=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x4fa7[_0x9e0cb3];return _0x5926b7;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x74fa('0x0'));var squel=require(_0x74fa('0x1'));var Redis=require('ioredis');var qs=require(_0x74fa('0x2'));var logger=require(_0x74fa('0x3'))(_0x74fa('0x4'));var config=require(_0x74fa('0x5'));var db=require(_0x74fa('0x6'))['db'];config['redis']=_[_0x74fa('0x7')](config[_0x74fa('0x8')],{'host':_0x74fa('0x9'),'port':0x18eb});var socket=require(_0x74fa('0xa'))(new Redis(config[_0x74fa('0x8')]));require(_0x74fa('0xb'))[_0x74fa('0xc')](socket);function respondWithStatusCode(_0x3df2a6,_0x16d4bb){_0x16d4bb=_0x16d4bb||0xcc;return function(_0x11e296){if(_0x11e296){return _0x3df2a6[_0x74fa('0xd')](_0x16d4bb);}return _0x3df2a6['status'](_0x16d4bb)[_0x74fa('0xe')]();};}function respondWithResult(_0x18df78,_0x344fc1){_0x344fc1=_0x344fc1||0xc8;return function(_0x39d3ba){if(_0x39d3ba){return _0x18df78[_0x74fa('0xf')](_0x344fc1)[_0x74fa('0x10')](_0x39d3ba);}};}function respondWithFilteredResult(_0x1c04c4,_0x1c96d0){return function(_0x5326b7){if(_0x5326b7){var _0x5e098f=typeof _0x1c96d0[_0x74fa('0x11')]===_0x74fa('0x12')&&typeof _0x1c96d0[_0x74fa('0x13')]===_0x74fa('0x12');var _0x27a323=_0x5326b7[_0x74fa('0x14')];var _0x480d60=_0x5e098f?0x0:_0x1c96d0[_0x74fa('0x11')];var _0x421720=_0x5e098f?_0x5326b7[_0x74fa('0x14')]:_0x1c96d0[_0x74fa('0x11')]+_0x1c96d0[_0x74fa('0x13')];var _0x42680a;if(_0x421720>=_0x27a323){_0x421720=_0x27a323;_0x42680a=0xc8;}else{_0x42680a=0xce;}_0x1c04c4[_0x74fa('0xf')](_0x42680a);return _0x1c04c4['set']('Content-Range',_0x480d60+'-'+_0x421720+'/'+_0x27a323)[_0x74fa('0x10')](_0x5326b7);}return null;};}function saveUpdates(_0x3a1f02){return function(_0x5a0cf6){if(_0x5a0cf6){return _0x5a0cf6['update'](_0x3a1f02)[_0x74fa('0x15')](function(_0x31987e){return _0x31987e;});}return null;};}function removeEntity(_0x624efe){return function(_0x582f48){if(_0x582f48){return _0x582f48['destroy']()[_0x74fa('0x15')](function(){var _0x325674=_0x582f48['get']({'plain':!![]});var _0x15b1c1=_0x74fa('0x16');return db[_0x74fa('0x17')][_0x74fa('0x18')]({'where':{'type':_0x15b1c1,'resourceId':_0x325674['id']}})[_0x74fa('0x15')](function(){return _0x582f48;});})[_0x74fa('0x15')](function(){_0x624efe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe66ee1){return function(_0x2d23e7){if(!_0x2d23e7){_0xe66ee1['sendStatus'](0x194);}return _0x2d23e7;};}function handleError(_0x4d95d3,_0x9f7266){_0x9f7266=_0x9f7266||0x1f4;return function(_0x4f9b19){logger[_0x74fa('0x19')](_0x4f9b19[_0x74fa('0x1a')]);if(_0x4f9b19[_0x74fa('0x1b')]){delete _0x4f9b19[_0x74fa('0x1b')];}_0x4d95d3[_0x74fa('0xf')](_0x9f7266)[_0x74fa('0x1c')](_0x4f9b19);};}exports[_0x74fa('0x1d')]=function(_0x3e9afb,_0x1bf5c4){var _0x429157={};var _0x32b747={'count':0x0,'rows':[]};var _0x3184a8=_['map'](db[_0x74fa('0x1e')][_0x74fa('0x1f')],function(_0x3b666f){return{'name':_0x3b666f[_0x74fa('0x20')],'type':_0x3b666f[_0x74fa('0x21')][_0x74fa('0x22')]};});_0x429157=qs[_0x74fa('0x23')](_0x3184a8,_0x3e9afb);var _0x47a56f={'where':_0x429157['where']};return db[_0x74fa('0x1e')][_0x74fa('0x14')](_0x47a56f)[_0x74fa('0x15')](function(_0x59f0a8){_0x32b747[_0x74fa('0x14')]=_0x59f0a8;_0x429157[_0x74fa('0x24')]=qs[_0x74fa('0x24')](_0x3e9afb[_0x74fa('0x25')]);return db[_0x74fa('0x1e')]['findAll'](_0x429157);})[_0x74fa('0x15')](function(_0x5eb13a){_0x32b747['rows']=_0x5eb13a;return _0x32b747;})[_0x74fa('0x15')](respondWithFilteredResult(_0x1bf5c4,_0x429157))['catch'](handleError(_0x1bf5c4,null));};exports[_0x74fa('0x26')]=function(_0x4f383a,_0x21fe88){var _0x12e9b5={'raw':!![],'where':{'id':_0x4f383a[_0x74fa('0x27')]['id']}},_0x86df7d={};_0x86df7d[_0x74fa('0x28')]=_['keys'](db[_0x74fa('0x1e')][_0x74fa('0x1f')]);_0x86df7d['query']=_[_0x74fa('0x29')](_0x4f383a['query']);_0x86df7d['filters']=_[_0x74fa('0x2a')](_0x86df7d[_0x74fa('0x28')],_0x86df7d[_0x74fa('0x25')]);_0x12e9b5['attributes']=_[_0x74fa('0x2a')](_0x86df7d['model'],qs[_0x74fa('0x2b')](_0x4f383a['query']['fields']));_0x12e9b5[_0x74fa('0x2c')]=_0x12e9b5[_0x74fa('0x2c')][_0x74fa('0x2d')]?_0x12e9b5[_0x74fa('0x2c')]:_0x86df7d[_0x74fa('0x28')];if(_0x4f383a[_0x74fa('0x25')][_0x74fa('0x2e')]){_0x12e9b5[_0x74fa('0x24')]=[{'all':!![]}];}_0x12e9b5=_[_0x74fa('0x2f')]({},_0x12e9b5,_0x4f383a[_0x74fa('0x30')]);return db['ChatQueue'][_0x74fa('0x31')](_0x12e9b5)[_0x74fa('0x15')](handleEntityNotFound(_0x21fe88,null))[_0x74fa('0x15')](respondWithResult(_0x21fe88,null))[_0x74fa('0x32')](handleError(_0x21fe88,null));};exports[_0x74fa('0x33')]=function(_0x2327a1,_0x5cbec2){return db[_0x74fa('0x1e')][_0x74fa('0x33')](_0x2327a1[_0x74fa('0x34')],{})[_0x74fa('0x15')](function(_0x3619a4){var _0x14c624=_0x2327a1[_0x74fa('0x35')][_0x74fa('0x36')]({'plain':!![]});if(!_0x14c624)throw new Error(_0x74fa('0x37'));if(_0x14c624[_0x74fa('0x38')]===_0x74fa('0x35')){var _0xe15db4=_0x3619a4[_0x74fa('0x36')]({'plain':!![]});var _0x32e559=_0x74fa('0x16');return db[_0x74fa('0x39')]['find']({'where':{'name':_0x32e559,'userProfileId':_0x14c624['userProfileId']},'raw':!![]})['then'](function(_0x2e462c){if(_0x2e462c&&_0x2e462c[_0x74fa('0x3a')]===0x0){return db['UserProfileResource']['create']({'name':_0xe15db4[_0x74fa('0x1b')],'resourceId':_0xe15db4['id'],'type':_0x2e462c['name'],'sectionId':_0x2e462c['id']},{})[_0x74fa('0x15')](function(){return _0x3619a4;});}else{return _0x3619a4;}})[_0x74fa('0x32')](function(_0x2f9f66){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f9f66);throw _0x2f9f66;});}return _0x3619a4;})['then'](respondWithResult(_0x5cbec2,0xc9))[_0x74fa('0x32')](handleError(_0x5cbec2,null));};exports[_0x74fa('0x3b')]=function(_0x363859,_0x2deedb){if(_0x363859[_0x74fa('0x34')]['id']){delete _0x363859[_0x74fa('0x34')]['id'];}return db['ChatQueue'][_0x74fa('0x31')]({'where':{'id':_0x363859[_0x74fa('0x27')]['id']}})[_0x74fa('0x15')](handleEntityNotFound(_0x2deedb,null))[_0x74fa('0x15')](saveUpdates(_0x363859[_0x74fa('0x34')],null))[_0x74fa('0x15')](respondWithResult(_0x2deedb,null))[_0x74fa('0x32')](handleError(_0x2deedb,null));};exports['destroy']=function(_0x4cd4e0,_0x22b223){return db[_0x74fa('0x1e')]['find']({'where':{'id':_0x4cd4e0[_0x74fa('0x27')]['id']}})[_0x74fa('0x15')](handleEntityNotFound(_0x22b223,null))[_0x74fa('0x15')](removeEntity(_0x22b223,null))[_0x74fa('0x32')](handleError(_0x22b223,null));};exports[_0x74fa('0x3c')]=function(_0x426b7e,_0x30343b){return db[_0x74fa('0x1e')]['describe']()[_0x74fa('0x15')](respondWithResult(_0x30343b,null))[_0x74fa('0x32')](handleError(_0x30343b,null));};exports[_0x74fa('0x3d')]=function(_0x1df4a5,_0x1da8e2){var _0x4c13cf={'raw':!![],'where':{}},_0x40b451={},_0x36a9a7;return db[_0x74fa('0x1e')][_0x74fa('0x3e')]({'where':{'id':_0x1df4a5[_0x74fa('0x27')]['id']}})[_0x74fa('0x15')](handleEntityNotFound(_0x1da8e2,null))[_0x74fa('0x15')](function(_0x4bb1bc){if(_0x4bb1bc){_0x36a9a7=_0x4bb1bc[_0x74fa('0x36')]({'plain':!![]});_0x40b451[_0x74fa('0x28')]=_[_0x74fa('0x29')](db['UserChatQueue'][_0x74fa('0x1f')]);_0x40b451[_0x74fa('0x25')]=_['keys'](_0x1df4a5[_0x74fa('0x25')]);_0x40b451[_0x74fa('0x3f')]=_['intersection'](_0x40b451[_0x74fa('0x28')],_0x40b451['query']);_0x4c13cf[_0x74fa('0x2c')]=_[_0x74fa('0x2a')](_0x40b451[_0x74fa('0x28')],qs[_0x74fa('0x2b')](_0x1df4a5[_0x74fa('0x25')][_0x74fa('0x2b')]));_0x4c13cf[_0x74fa('0x2c')]=_0x4c13cf[_0x74fa('0x2c')]['length']?_0x4c13cf[_0x74fa('0x2c')]:_0x40b451[_0x74fa('0x28')];if(!_0x1df4a5[_0x74fa('0x25')]['hasOwnProperty'](_0x74fa('0x40'))){_0x4c13cf['limit']=qs[_0x74fa('0x13')](_0x1df4a5[_0x74fa('0x25')]['limit']);_0x4c13cf[_0x74fa('0x11')]=qs['offset'](_0x1df4a5['query'][_0x74fa('0x11')]);}_0x4c13cf[_0x74fa('0x41')]=qs[_0x74fa('0x42')](_0x1df4a5[_0x74fa('0x25')][_0x74fa('0x42')]);_0x4c13cf[_0x74fa('0x43')]=qs['filters'](_['pick'](_0x1df4a5[_0x74fa('0x25')],_0x40b451[_0x74fa('0x3f')]));_0x4c13cf[_0x74fa('0x43')][_0x74fa('0x44')]=_0x4bb1bc['id'];if(_0x1df4a5['query'][_0x74fa('0x45')]){_0x4c13cf['where']=_['merge'](_0x4c13cf[_0x74fa('0x43')],{'$or':_[_0x74fa('0x46')](_0x4c13cf[_0x74fa('0x2c')],function(_0x47ae57){var _0x53d57b={};_0x53d57b[_0x47ae57]={'$like':'%'+_0x1df4a5[_0x74fa('0x25')]['filter']+'%'};return _0x53d57b;})});}_0x4c13cf=_['merge']({},_0x4c13cf,_0x1df4a5[_0x74fa('0x30')]);return db[_0x74fa('0x47')]['findAll'](_0x4c13cf);}})[_0x74fa('0x15')](function(_0xe5d84c){if(_0xe5d84c){return db[_0x74fa('0x48')][_0x74fa('0x49')]({'where':{'id':_[_0x74fa('0x46')](_0xe5d84c,_0x74fa('0x4a')),'role':_0x74fa('0x4b')},'attributes':['id',_0x74fa('0x1b'),_0x74fa('0x4c'),_0x74fa('0x4d'),_0x74fa('0x4e')]});}})[_0x74fa('0x15')](function(_0x37da15){if(_0x37da15){return{'count':_0x37da15[_0x74fa('0x14')],'rows':_[_0x74fa('0x46')](_0x37da15['rows'],function(_0xe8ea79){return{'membername':_0xe8ea79[_0x74fa('0x1b')],'UserId':_0xe8ea79['id'],'queue_name':_0x36a9a7[_0x74fa('0x1b')],'ChatQueueId':_0x36a9a7['id'],'interface':util[_0x74fa('0x4f')]('%s/%s',_0x74fa('0x50'),_0xe8ea79[_0x74fa('0x1b')]),'penalty':0x0,'paused':_0xe8ea79[_0x74fa('0x4c')],'createdAt':_0xe8ea79[_0x74fa('0x4e')],'updatedAt':_0xe8ea79[_0x74fa('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x74fa('0x15')](respondWithFilteredResult(_0x1da8e2,_0x4c13cf))['catch'](handleError(_0x1da8e2,null));};exports[_0x74fa('0x51')]=function(_0x410471,_0x2d6430){var _0xbb9d40={};var _0x1bf250={};var _0x467427;var _0x2c96cb;return db['ChatQueue'][_0x74fa('0x3e')]({'where':{'id':_0x410471[_0x74fa('0x27')]['id']}})[_0x74fa('0x15')](handleEntityNotFound(_0x2d6430,null))[_0x74fa('0x15')](function(_0x42b06b){if(_0x42b06b){_0x467427=_0x42b06b;_0x1bf250[_0x74fa('0x28')]=_[_0x74fa('0x29')](db[_0x74fa('0x52')][_0x74fa('0x1f')]);_0x1bf250[_0x74fa('0x25')]=_[_0x74fa('0x29')](_0x410471[_0x74fa('0x25')]);_0x1bf250['filters']=_[_0x74fa('0x2a')](_0x1bf250['model'],_0x1bf250[_0x74fa('0x25')]);_0xbb9d40[_0x74fa('0x2c')]=_[_0x74fa('0x2a')](_0x1bf250[_0x74fa('0x28')],qs['fields'](_0x410471[_0x74fa('0x25')][_0x74fa('0x2b')]));_0xbb9d40[_0x74fa('0x2c')]=_0xbb9d40[_0x74fa('0x2c')][_0x74fa('0x2d')]?_0xbb9d40['attributes']:_0x1bf250[_0x74fa('0x28')];_0xbb9d40['order']=qs[_0x74fa('0x42')](_0x410471[_0x74fa('0x25')][_0x74fa('0x42')]);_0xbb9d40[_0x74fa('0x43')]=qs[_0x74fa('0x3f')](_[_0x74fa('0x53')](_0x410471[_0x74fa('0x25')],_0x1bf250[_0x74fa('0x3f')]));if(_0x410471['query'][_0x74fa('0x45')]){_0xbb9d40['where']=_[_0x74fa('0x2f')](_0xbb9d40[_0x74fa('0x43')],{'$or':_[_0x74fa('0x46')](_0xbb9d40[_0x74fa('0x2c')],function(_0x506bd8){var _0x4e50bf={};_0x4e50bf[_0x506bd8]={'$like':'%'+_0x410471['query'][_0x74fa('0x45')]+'%'};return _0x4e50bf;})});}_0xbb9d40=_[_0x74fa('0x2f')]({},_0xbb9d40,_0x410471[_0x74fa('0x30')]);return _0x467427['getTeams'](_0xbb9d40);}})[_0x74fa('0x15')](function(_0xfae48b){if(_0xfae48b){_0x2c96cb=_0xfae48b['length'];if(!_0x410471[_0x74fa('0x25')]['hasOwnProperty'](_0x74fa('0x40'))){_0xbb9d40['limit']=qs['limit'](_0x410471['query'][_0x74fa('0x13')]);_0xbb9d40[_0x74fa('0x11')]=qs[_0x74fa('0x11')](_0x410471[_0x74fa('0x25')][_0x74fa('0x11')]);}return _0x467427['getTeams'](_0xbb9d40);}})[_0x74fa('0x15')](function(_0x26f691){if(_0x26f691){return _0x26f691?{'count':_0x2c96cb,'rows':_0x26f691}:null;}})[_0x74fa('0x15')](respondWithResult(_0x2d6430,null))[_0x74fa('0x32')](handleError(_0x2d6430,null));};exports['addTeams']=function(_0x803bda,_0x4afb0a){var _0xad2423=_0x803bda[_0x74fa('0x34')][_0x74fa('0x54')];return db[_0x74fa('0x52')][_0x74fa('0x55')]({'where':{'id':_0xad2423},'attributes':['id'],'include':[{'model':db[_0x74fa('0x48')],'as':'Agents','attributes':['id',_0x74fa('0x1b'),_0x74fa('0x56'),'voicePause','interface'],'raw':!![]}]})[_0x74fa('0x15')](function(_0x5c874e){if(_0x5c874e){var _0x16c3ee=_['flatMap'](_0x5c874e,function(_0x1d3a78){var _0x3fa448=_0x1d3a78[_0x74fa('0x36')]({'plain':!![]});return _0x3fa448[_0x74fa('0x57')];});return db[_0x74fa('0x1e')][_0x74fa('0x31')]({'where':{'id':_0x803bda[_0x74fa('0x27')]['id']}})[_0x74fa('0x15')](function(_0x3a1c7c){return db[_0x74fa('0x58')][_0x74fa('0x59')](function(_0x5bb368){return _0x3a1c7c[_0x74fa('0x5a')](_0xad2423,{'transaction':_0x5bb368})[_0x74fa('0x15')](function(){return BPromise[_0x74fa('0x5b')](_0x16c3ee,function(_0x22b1d7){return db['UserChatQueue'][_0x74fa('0x5c')]({'where':{'UserId':_0x22b1d7['id'],'ChatQueueId':_0x803bda['params']['id']},'transaction':_0x5bb368});});})[_0x74fa('0x15')](function(){_0x16c3ee[_0x74fa('0x5d')](function(_0xca1066){socket[_0x74fa('0x5e')](_0x74fa('0x5f'),{'UserId':_0xca1066['id'],'ChatQueueId':_0x3a1c7c['id']});});});});});}})[_0x74fa('0x15')](respondWithStatusCode(_0x4afb0a,null))[_0x74fa('0x32')](handleError(_0x4afb0a,null));};exports[_0x74fa('0x60')]=function(_0x54af26,_0x2ac93c){return db['Team'][_0x74fa('0x55')]({'where':{'id':_0x54af26[_0x74fa('0x25')][_0x74fa('0x54')]},'attributes':['id'],'include':[{'model':db[_0x74fa('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x74fa('0x15')](handleEntityNotFound(_0x2ac93c,null))[_0x74fa('0x15')](function(_0xced71b){var _0x2c567c=_[_0x74fa('0x46')](_0xced71b,'id');var _0x4f748e=[];var _0x483db3=[];var _0x36912b=squel['select']();_0x36912b[_0x74fa('0x61')]('tq.TeamId')['from']('team_has_chat_queues','tq')[_0x74fa('0x62')]('user_has_teams','ut',_0x74fa('0x63'))[_0x74fa('0x43')](_0x74fa('0x64'),_0x54af26[_0x74fa('0x27')]['id']);for(var _0x10d455=0x0;_0x10d455<_0xced71b[_0x74fa('0x2d')];_0x10d455+=0x1){let _0x40d336=_0xced71b[_0x10d455];for(var _0xd93909=0x0;_0xd93909<_0x40d336[_0x74fa('0x57')][_0x74fa('0x2d')];_0xd93909+=0x1){let _0x1d8359=_0x40d336[_0x74fa('0x57')][_0xd93909];var _0x2897df=_0x36912b[_0x74fa('0x65')]();_0x2897df[_0x74fa('0x43')](_0x74fa('0x66'),_0x1d8359['id']);_0x483db3['push'](db[_0x74fa('0x58')]['query'](_0x2897df[_0x74fa('0x67')](),{'type':db[_0x74fa('0x58')]['QueryTypes'][_0x74fa('0x68')]})['then'](function(_0x3639ed){if(_0x3639ed[_0x74fa('0x2d')]===0x1){return _0x1d8359['id'];}else{var _0x3dd57a=_[_0x74fa('0x69')](_[_0x74fa('0x46')](_0x3639ed,_0x74fa('0x6a')),function(_0x31a9e5){return _[_0x74fa('0x6b')](_0x2c567c,_0x31a9e5);});if(_0x3dd57a){return _0x1d8359['id'];}}}));}}return BPromise[_0x74fa('0x6c')](_0x483db3)[_0x74fa('0x15')](function(_0x29e141){_0x4f748e=_(_0x4f748e)[_0x74fa('0x6d')](_0x29e141)[_0x74fa('0x6e')]()[_0x74fa('0x6f')]();return db[_0x74fa('0x1e')][_0x74fa('0x31')]({'where':{'id':_0x54af26[_0x74fa('0x27')]['id']}})[_0x74fa('0x15')](function(_0x264ea0){return db[_0x74fa('0x58')]['transaction'](function(_0x33a2a1){return _0x264ea0['removeTeams'](_0x54af26[_0x74fa('0x25')]['ids'],{'transaction':_0x33a2a1})['then'](function(){if(!_[_0x74fa('0x70')](_0x4f748e)){return _0x264ea0[_0x74fa('0x71')](_0x4f748e,{'transaction':_0x33a2a1});}})[_0x74fa('0x15')](function(){_0x4f748e[_0x74fa('0x5d')](function(_0x3b0f33){socket[_0x74fa('0x5e')](_0x74fa('0x72'),{'UserId':_0x3b0f33,'ChatQueueId':_0x264ea0['id']});});});});});});})[_0x74fa('0x15')](respondWithStatusCode(_0x2ac93c,null))[_0x74fa('0x32')](handleError(_0x2ac93c,null));};exports[_0x74fa('0x73')]=function(_0x5a536a,_0x5dff50){return db[_0x74fa('0x1e')][_0x74fa('0x31')]({'where':{'id':_0x5a536a[_0x74fa('0x27')]['id']}})[_0x74fa('0x15')](handleEntityNotFound(_0x5dff50,null))[_0x74fa('0x15')](function(_0x37a7c2){if(_0x37a7c2){return _0x37a7c2[_0x74fa('0x73')](_0x5a536a[_0x74fa('0x34')][_0x74fa('0x54')],_[_0x74fa('0x74')](_0x5a536a[_0x74fa('0x34')],[_0x74fa('0x54'),'id'])||{})['spread'](function(_0x106b5d){for(var _0x1a962f=0x0;_0x1a962f<_0x5a536a['body'][_0x74fa('0x54')]['length'];_0x1a962f+=0x1){socket['emit'](_0x74fa('0x5f'),{'UserId':Number(_0x5a536a[_0x74fa('0x34')][_0x74fa('0x54')][_0x1a962f]),'ChatQueueId':Number(_0x5a536a[_0x74fa('0x27')]['id'])});}return _0x106b5d;});}})[_0x74fa('0x15')](respondWithResult(_0x5dff50,null))[_0x74fa('0x32')](handleError(_0x5dff50,null));};exports[_0x74fa('0x71')]=function(_0x196211,_0x2540c6){return db['ChatQueue']['find']({'where':{'id':_0x196211[_0x74fa('0x27')]['id']}})[_0x74fa('0x15')](handleEntityNotFound(_0x2540c6,null))[_0x74fa('0x15')](function(_0x2c009c){if(_0x2c009c){return _0x2c009c[_0x74fa('0x71')](_0x196211[_0x74fa('0x25')][_0x74fa('0x54')])['then'](function(){if(_[_0x74fa('0x75')](_0x196211[_0x74fa('0x25')]['ids'])){for(var _0x54799e=0x0;_0x54799e<_0x196211[_0x74fa('0x25')][_0x74fa('0x54')][_0x74fa('0x2d')];_0x54799e+=0x1){socket[_0x74fa('0x5e')](_0x74fa('0x72'),{'UserId':Number(_0x196211[_0x74fa('0x25')][_0x74fa('0x54')][_0x54799e]),'ChatQueueId':Number(_0x196211[_0x74fa('0x27')]['id'])});}}else{socket[_0x74fa('0x5e')](_0x74fa('0x72'),{'UserId':Number(_0x196211[_0x74fa('0x25')][_0x74fa('0x54')]),'ChatQueueId':Number(_0x196211['params']['id'])});}});}})[_0x74fa('0x15')](respondWithStatusCode(_0x2540c6,null))['catch'](handleError(_0x2540c6,null));};exports[_0x74fa('0x76')]=function(_0x5baf46,_0xcab07b){var _0x53d668={};var _0x199da4={};var _0x4268ff;var _0x112e03;return db[_0x74fa('0x1e')][_0x74fa('0x3e')]({'where':{'id':_0x5baf46[_0x74fa('0x27')]['id']}})['then'](handleEntityNotFound(_0xcab07b,null))[_0x74fa('0x15')](function(_0x74e7bb){if(_0x74e7bb){_0x4268ff=_0x74e7bb;_0x199da4[_0x74fa('0x28')]=_[_0x74fa('0x29')](db[_0x74fa('0x48')][_0x74fa('0x1f')]);_0x199da4[_0x74fa('0x25')]=_[_0x74fa('0x29')](_0x5baf46[_0x74fa('0x25')]);_0x199da4[_0x74fa('0x3f')]=_[_0x74fa('0x2a')](_0x199da4[_0x74fa('0x28')],_0x199da4[_0x74fa('0x25')]);_0x53d668['attributes']=_['intersection'](_0x199da4['model'],qs['fields'](_0x5baf46[_0x74fa('0x25')]['fields']));_0x53d668[_0x74fa('0x2c')]=_0x53d668[_0x74fa('0x2c')][_0x74fa('0x2d')]?_0x53d668[_0x74fa('0x2c')]:_0x199da4[_0x74fa('0x28')];_0x53d668[_0x74fa('0x41')]=qs[_0x74fa('0x42')](_0x5baf46[_0x74fa('0x25')][_0x74fa('0x42')]);_0x53d668[_0x74fa('0x43')]=qs[_0x74fa('0x3f')](_[_0x74fa('0x53')](_0x5baf46[_0x74fa('0x25')],_0x199da4['filters']));if(_0x5baf46[_0x74fa('0x25')][_0x74fa('0x45')]){_0x53d668[_0x74fa('0x43')]=_['merge'](_0x53d668[_0x74fa('0x43')],{'$or':_[_0x74fa('0x46')](_0x53d668[_0x74fa('0x2c')],function(_0x325ac4){var _0x4b2536={};_0x4b2536[_0x325ac4]={'$like':'%'+_0x5baf46['query'][_0x74fa('0x45')]+'%'};return _0x4b2536;})});}_0x53d668=_['merge']({},_0x53d668,_0x5baf46[_0x74fa('0x30')]);return _0x4268ff[_0x74fa('0x76')](_0x53d668);}})[_0x74fa('0x15')](function(_0x1da341){if(_0x1da341){_0x112e03=_0x1da341[_0x74fa('0x2d')];if(!_0x5baf46[_0x74fa('0x25')]['hasOwnProperty'](_0x74fa('0x40'))){_0x53d668[_0x74fa('0x13')]=qs[_0x74fa('0x13')](_0x5baf46[_0x74fa('0x25')][_0x74fa('0x13')]);_0x53d668[_0x74fa('0x11')]=qs[_0x74fa('0x11')](_0x5baf46[_0x74fa('0x25')][_0x74fa('0x11')]);}return _0x4268ff[_0x74fa('0x76')](_0x53d668);}})['then'](function(_0x27149e){if(_0x27149e){return _0x27149e?{'count':_0x112e03,'rows':_0x27149e}:null;}})['then'](respondWithResult(_0xcab07b,null))[_0x74fa('0x32')](handleError(_0xcab07b,null));}; \ No newline at end of file +var _0x2e8e=['query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','sort','pick','ChatQueueId','filter','map','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','Team','order','getTeams','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','includes','all','compact','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','addAgents','omit','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','get','UserProfileResource','stack','name','ChatQueue','rawAttributes','type','key','getOptions','where','include'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0x2e8e,0x1bf));var _0xe2e8=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x2e8e[_0x2f2360];return _0x1cc8d3;};'use strict';var BPromise=require(_0xe2e8('0x0'));var util=require(_0xe2e8('0x1'));var _=require(_0xe2e8('0x2'));var squel=require(_0xe2e8('0x3'));var Redis=require(_0xe2e8('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xe2e8('0x5'))(_0xe2e8('0x6'));var config=require(_0xe2e8('0x7'));var db=require(_0xe2e8('0x8'))['db'];config['redis']=_[_0xe2e8('0x9')](config['redis'],{'host':_0xe2e8('0xa'),'port':0x18eb});var socket=require(_0xe2e8('0xb'))(new Redis(config[_0xe2e8('0xc')]));require(_0xe2e8('0xd'))['register'](socket);function respondWithStatusCode(_0x2de20a,_0x143e84){_0x143e84=_0x143e84||0xcc;return function(_0x34aa0b){if(_0x34aa0b){return _0x2de20a[_0xe2e8('0xe')](_0x143e84);}return _0x2de20a[_0xe2e8('0xf')](_0x143e84)[_0xe2e8('0x10')]();};}function respondWithResult(_0xc6da14,_0x4eea8c){_0x4eea8c=_0x4eea8c||0xc8;return function(_0x225c19){if(_0x225c19){return _0xc6da14['status'](_0x4eea8c)[_0xe2e8('0x11')](_0x225c19);}};}function respondWithFilteredResult(_0x16120d,_0x251bdf){return function(_0x2158d5){if(_0x2158d5){var _0x150491=typeof _0x251bdf[_0xe2e8('0x12')]===_0xe2e8('0x13')&&typeof _0x251bdf[_0xe2e8('0x14')]===_0xe2e8('0x13');var _0x4e5f19=_0x2158d5[_0xe2e8('0x15')];var _0x3f9ec7=_0x150491?0x0:_0x251bdf[_0xe2e8('0x12')];var _0x3df402=_0x150491?_0x2158d5[_0xe2e8('0x15')]:_0x251bdf['offset']+_0x251bdf[_0xe2e8('0x14')];var _0x2b6405;if(_0x3df402>=_0x4e5f19){_0x3df402=_0x4e5f19;_0x2b6405=0xc8;}else{_0x2b6405=0xce;}_0x16120d['status'](_0x2b6405);return _0x16120d[_0xe2e8('0x16')]('Content-Range',_0x3f9ec7+'-'+_0x3df402+'/'+_0x4e5f19)[_0xe2e8('0x11')](_0x2158d5);}return null;};}function saveUpdates(_0x355669){return function(_0x11a09f){if(_0x11a09f){return _0x11a09f[_0xe2e8('0x17')](_0x355669)['then'](function(_0x437a84){return _0x437a84;});}return null;};}function removeEntity(_0x31f618){return function(_0x1410b0){if(_0x1410b0){return _0x1410b0[_0xe2e8('0x18')]()[_0xe2e8('0x19')](function(){var _0x364be2=_0x1410b0[_0xe2e8('0x1a')]({'plain':!![]});var _0x2ef8f9='ChatQueues';return db[_0xe2e8('0x1b')][_0xe2e8('0x18')]({'where':{'type':_0x2ef8f9,'resourceId':_0x364be2['id']}})[_0xe2e8('0x19')](function(){return _0x1410b0;});})[_0xe2e8('0x19')](function(){_0x31f618[_0xe2e8('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cdd13){return function(_0x186725){if(!_0x186725){_0x2cdd13[_0xe2e8('0xe')](0x194);}return _0x186725;};}function handleError(_0x5445fa,_0x5b9962){_0x5b9962=_0x5b9962||0x1f4;return function(_0x4d9c7a){logger['error'](_0x4d9c7a[_0xe2e8('0x1c')]);if(_0x4d9c7a[_0xe2e8('0x1d')]){delete _0x4d9c7a[_0xe2e8('0x1d')];}_0x5445fa['status'](_0x5b9962)['send'](_0x4d9c7a);};}exports['index']=function(_0xdd25d0,_0x261129){var _0x261b0a={};var _0x1a5667={'count':0x0,'rows':[]};var _0x1eafc2=_['map'](db[_0xe2e8('0x1e')][_0xe2e8('0x1f')],function(_0x2dbe12){return{'name':_0x2dbe12['fieldName'],'type':_0x2dbe12[_0xe2e8('0x20')][_0xe2e8('0x21')]};});_0x261b0a=qs[_0xe2e8('0x22')](_0x1eafc2,_0xdd25d0);var _0x15d13a={'where':_0x261b0a[_0xe2e8('0x23')]};return db[_0xe2e8('0x1e')][_0xe2e8('0x15')](_0x15d13a)[_0xe2e8('0x19')](function(_0x5997ab){_0x1a5667[_0xe2e8('0x15')]=_0x5997ab;_0x261b0a[_0xe2e8('0x24')]=qs[_0xe2e8('0x24')](_0xdd25d0[_0xe2e8('0x25')]);return db['ChatQueue']['findAll'](_0x261b0a);})['then'](function(_0x315b8a){_0x1a5667[_0xe2e8('0x26')]=_0x315b8a;return _0x1a5667;})[_0xe2e8('0x19')](respondWithFilteredResult(_0x261129,_0x261b0a))[_0xe2e8('0x27')](handleError(_0x261129,null));};exports[_0xe2e8('0x28')]=function(_0x301856,_0x37556b){var _0x4b14a3={'raw':!![],'where':{'id':_0x301856[_0xe2e8('0x29')]['id']}},_0x573bff={};_0x573bff[_0xe2e8('0x2a')]=_[_0xe2e8('0x2b')](db[_0xe2e8('0x1e')][_0xe2e8('0x1f')]);_0x573bff[_0xe2e8('0x25')]=_[_0xe2e8('0x2b')](_0x301856[_0xe2e8('0x25')]);_0x573bff[_0xe2e8('0x2c')]=_[_0xe2e8('0x2d')](_0x573bff['model'],_0x573bff['query']);_0x4b14a3[_0xe2e8('0x2e')]=_[_0xe2e8('0x2d')](_0x573bff['model'],qs[_0xe2e8('0x2f')](_0x301856[_0xe2e8('0x25')][_0xe2e8('0x2f')]));_0x4b14a3[_0xe2e8('0x2e')]=_0x4b14a3[_0xe2e8('0x2e')][_0xe2e8('0x30')]?_0x4b14a3[_0xe2e8('0x2e')]:_0x573bff[_0xe2e8('0x2a')];if(_0x301856[_0xe2e8('0x25')][_0xe2e8('0x31')]){_0x4b14a3['include']=[{'all':!![]}];}_0x4b14a3=_[_0xe2e8('0x32')]({},_0x4b14a3,_0x301856[_0xe2e8('0x33')]);return db[_0xe2e8('0x1e')][_0xe2e8('0x34')](_0x4b14a3)['then'](handleEntityNotFound(_0x37556b,null))[_0xe2e8('0x19')](respondWithResult(_0x37556b,null))[_0xe2e8('0x27')](handleError(_0x37556b,null));};exports[_0xe2e8('0x35')]=function(_0xee4ff9,_0x2d1ebd){return db[_0xe2e8('0x1e')]['create'](_0xee4ff9[_0xe2e8('0x36')],{})[_0xe2e8('0x19')](function(_0x40c884){var _0x4dc5d5=_0xee4ff9[_0xe2e8('0x37')][_0xe2e8('0x1a')]({'plain':!![]});if(!_0x4dc5d5)throw new Error(_0xe2e8('0x38'));if(_0x4dc5d5[_0xe2e8('0x39')]===_0xe2e8('0x37')){var _0x3d025d=_0x40c884[_0xe2e8('0x1a')]({'plain':!![]});var _0x5e990d='ChatQueues';return db[_0xe2e8('0x3a')][_0xe2e8('0x34')]({'where':{'name':_0x5e990d,'userProfileId':_0x4dc5d5['userProfileId']},'raw':!![]})[_0xe2e8('0x19')](function(_0x2d2ec1){if(_0x2d2ec1&&_0x2d2ec1[_0xe2e8('0x3b')]===0x0){return db[_0xe2e8('0x1b')]['create']({'name':_0x3d025d[_0xe2e8('0x1d')],'resourceId':_0x3d025d['id'],'type':_0x2d2ec1[_0xe2e8('0x1d')],'sectionId':_0x2d2ec1['id']},{})[_0xe2e8('0x19')](function(){return _0x40c884;});}else{return _0x40c884;}})[_0xe2e8('0x27')](function(_0x4cd596){logger['error'](_0xe2e8('0x3c'),_0x4cd596);throw _0x4cd596;});}return _0x40c884;})[_0xe2e8('0x19')](respondWithResult(_0x2d1ebd,0xc9))[_0xe2e8('0x27')](handleError(_0x2d1ebd,null));};exports[_0xe2e8('0x17')]=function(_0xac294e,_0x70190a){if(_0xac294e['body']['id']){delete _0xac294e['body']['id'];}return db[_0xe2e8('0x1e')][_0xe2e8('0x34')]({'where':{'id':_0xac294e[_0xe2e8('0x29')]['id']}})[_0xe2e8('0x19')](handleEntityNotFound(_0x70190a,null))['then'](saveUpdates(_0xac294e[_0xe2e8('0x36')],null))[_0xe2e8('0x19')](respondWithResult(_0x70190a,null))[_0xe2e8('0x27')](handleError(_0x70190a,null));};exports[_0xe2e8('0x18')]=function(_0xa52341,_0x371f74){return db[_0xe2e8('0x1e')]['find']({'where':{'id':_0xa52341['params']['id']}})['then'](handleEntityNotFound(_0x371f74,null))[_0xe2e8('0x19')](removeEntity(_0x371f74,null))[_0xe2e8('0x27')](handleError(_0x371f74,null));};exports[_0xe2e8('0x3d')]=function(_0x3fe9f3,_0x54aeda){return db['ChatQueue'][_0xe2e8('0x3d')]()[_0xe2e8('0x19')](respondWithResult(_0x54aeda,null))['catch'](handleError(_0x54aeda,null));};exports[_0xe2e8('0x3e')]=function(_0x5bf1d7,_0x239fb6){var _0x2e617b={'raw':!![],'where':{}},_0x29672f={},_0x3ba7ed;return db[_0xe2e8('0x1e')][_0xe2e8('0x3f')]({'where':{'id':_0x5bf1d7[_0xe2e8('0x29')]['id']}})[_0xe2e8('0x19')](handleEntityNotFound(_0x239fb6,null))['then'](function(_0x817a30){if(_0x817a30){_0x3ba7ed=_0x817a30[_0xe2e8('0x1a')]({'plain':!![]});_0x29672f[_0xe2e8('0x2a')]=_[_0xe2e8('0x2b')](db[_0xe2e8('0x40')][_0xe2e8('0x1f')]);_0x29672f[_0xe2e8('0x25')]=_['keys'](_0x5bf1d7[_0xe2e8('0x25')]);_0x29672f[_0xe2e8('0x2c')]=_[_0xe2e8('0x2d')](_0x29672f[_0xe2e8('0x2a')],_0x29672f['query']);_0x2e617b['attributes']=_[_0xe2e8('0x2d')](_0x29672f['model'],qs['fields'](_0x5bf1d7[_0xe2e8('0x25')][_0xe2e8('0x2f')]));_0x2e617b['attributes']=_0x2e617b[_0xe2e8('0x2e')][_0xe2e8('0x30')]?_0x2e617b[_0xe2e8('0x2e')]:_0x29672f[_0xe2e8('0x2a')];if(!_0x5bf1d7[_0xe2e8('0x25')][_0xe2e8('0x41')]('nolimit')){_0x2e617b[_0xe2e8('0x14')]=qs[_0xe2e8('0x14')](_0x5bf1d7[_0xe2e8('0x25')]['limit']);_0x2e617b[_0xe2e8('0x12')]=qs[_0xe2e8('0x12')](_0x5bf1d7[_0xe2e8('0x25')][_0xe2e8('0x12')]);}_0x2e617b['order']=qs[_0xe2e8('0x42')](_0x5bf1d7['query'][_0xe2e8('0x42')]);_0x2e617b[_0xe2e8('0x23')]=qs[_0xe2e8('0x2c')](_[_0xe2e8('0x43')](_0x5bf1d7[_0xe2e8('0x25')],_0x29672f['filters']));_0x2e617b['where'][_0xe2e8('0x44')]=_0x817a30['id'];if(_0x5bf1d7[_0xe2e8('0x25')][_0xe2e8('0x45')]){_0x2e617b[_0xe2e8('0x23')]=_[_0xe2e8('0x32')](_0x2e617b[_0xe2e8('0x23')],{'$or':_[_0xe2e8('0x46')](_0x2e617b[_0xe2e8('0x2e')],function(_0x404d8f){var _0x588063={};_0x588063[_0x404d8f]={'$like':'%'+_0x5bf1d7['query'][_0xe2e8('0x45')]+'%'};return _0x588063;})});}_0x2e617b=_[_0xe2e8('0x32')]({},_0x2e617b,_0x5bf1d7[_0xe2e8('0x33')]);return db[_0xe2e8('0x40')][_0xe2e8('0x47')](_0x2e617b);}})[_0xe2e8('0x19')](function(_0x5bc4f3){if(_0x5bc4f3){return db[_0xe2e8('0x48')][_0xe2e8('0x49')]({'where':{'id':_['map'](_0x5bc4f3,_0xe2e8('0x4a')),'role':_0xe2e8('0x4b')},'attributes':['id','name','chatPause',_0xe2e8('0x4c'),_0xe2e8('0x4d')]});}})[_0xe2e8('0x19')](function(_0x52b315){if(_0x52b315){return{'count':_0x52b315['count'],'rows':_[_0xe2e8('0x46')](_0x52b315[_0xe2e8('0x26')],function(_0x1446ae){return{'membername':_0x1446ae[_0xe2e8('0x1d')],'UserId':_0x1446ae['id'],'queue_name':_0x3ba7ed[_0xe2e8('0x1d')],'ChatQueueId':_0x3ba7ed['id'],'interface':util[_0xe2e8('0x4e')](_0xe2e8('0x4f'),_0xe2e8('0x50'),_0x1446ae[_0xe2e8('0x1d')]),'penalty':0x0,'paused':_0x1446ae[_0xe2e8('0x51')],'createdAt':_0x1446ae[_0xe2e8('0x4d')],'updatedAt':_0x1446ae[_0xe2e8('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe2e8('0x19')](respondWithFilteredResult(_0x239fb6,_0x2e617b))['catch'](handleError(_0x239fb6,null));};exports['getTeams']=function(_0x10ef6c,_0x1a8aa3){var _0x9eb785={};var _0x25ff64={};var _0x45ccec;var _0x1c0697;return db[_0xe2e8('0x1e')][_0xe2e8('0x3f')]({'where':{'id':_0x10ef6c[_0xe2e8('0x29')]['id']}})[_0xe2e8('0x19')](handleEntityNotFound(_0x1a8aa3,null))[_0xe2e8('0x19')](function(_0x16a7ab){if(_0x16a7ab){_0x45ccec=_0x16a7ab;_0x25ff64[_0xe2e8('0x2a')]=_[_0xe2e8('0x2b')](db[_0xe2e8('0x52')][_0xe2e8('0x1f')]);_0x25ff64['query']=_[_0xe2e8('0x2b')](_0x10ef6c[_0xe2e8('0x25')]);_0x25ff64[_0xe2e8('0x2c')]=_[_0xe2e8('0x2d')](_0x25ff64['model'],_0x25ff64['query']);_0x9eb785[_0xe2e8('0x2e')]=_['intersection'](_0x25ff64[_0xe2e8('0x2a')],qs[_0xe2e8('0x2f')](_0x10ef6c[_0xe2e8('0x25')]['fields']));_0x9eb785[_0xe2e8('0x2e')]=_0x9eb785[_0xe2e8('0x2e')]['length']?_0x9eb785[_0xe2e8('0x2e')]:_0x25ff64[_0xe2e8('0x2a')];_0x9eb785[_0xe2e8('0x53')]=qs[_0xe2e8('0x42')](_0x10ef6c[_0xe2e8('0x25')][_0xe2e8('0x42')]);_0x9eb785['where']=qs[_0xe2e8('0x2c')](_[_0xe2e8('0x43')](_0x10ef6c[_0xe2e8('0x25')],_0x25ff64[_0xe2e8('0x2c')]));if(_0x10ef6c[_0xe2e8('0x25')][_0xe2e8('0x45')]){_0x9eb785['where']=_['merge'](_0x9eb785[_0xe2e8('0x23')],{'$or':_[_0xe2e8('0x46')](_0x9eb785['attributes'],function(_0x422763){var _0x5024f7={};_0x5024f7[_0x422763]={'$like':'%'+_0x10ef6c[_0xe2e8('0x25')][_0xe2e8('0x45')]+'%'};return _0x5024f7;})});}_0x9eb785=_['merge']({},_0x9eb785,_0x10ef6c[_0xe2e8('0x33')]);return _0x45ccec[_0xe2e8('0x54')](_0x9eb785);}})['then'](function(_0x536c01){if(_0x536c01){_0x1c0697=_0x536c01['length'];if(!_0x10ef6c[_0xe2e8('0x25')]['hasOwnProperty'](_0xe2e8('0x55'))){_0x9eb785['limit']=qs[_0xe2e8('0x14')](_0x10ef6c[_0xe2e8('0x25')][_0xe2e8('0x14')]);_0x9eb785[_0xe2e8('0x12')]=qs[_0xe2e8('0x12')](_0x10ef6c['query']['offset']);}return _0x45ccec['getTeams'](_0x9eb785);}})[_0xe2e8('0x19')](function(_0x1244d0){if(_0x1244d0){return _0x1244d0?{'count':_0x1c0697,'rows':_0x1244d0}:null;}})[_0xe2e8('0x19')](respondWithResult(_0x1a8aa3,null))[_0xe2e8('0x27')](handleError(_0x1a8aa3,null));};exports[_0xe2e8('0x56')]=function(_0x212368,_0x286447){var _0x18ced5=_0x212368[_0xe2e8('0x36')][_0xe2e8('0x57')];return db[_0xe2e8('0x52')][_0xe2e8('0x47')]({'where':{'id':_0x18ced5},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe2e8('0x58'),'attributes':['id','name',_0xe2e8('0x59'),_0xe2e8('0x5a'),_0xe2e8('0x5b')],'raw':!![]}]})[_0xe2e8('0x19')](function(_0x4638e4){if(_0x4638e4){var _0x505773=_[_0xe2e8('0x5c')](_0x4638e4,function(_0x290902){var _0x1d963a=_0x290902[_0xe2e8('0x1a')]({'plain':!![]});return _0x1d963a['Agents'];});return db[_0xe2e8('0x1e')][_0xe2e8('0x34')]({'where':{'id':_0x212368['params']['id']}})['then'](function(_0x55344e){return db['sequelize'][_0xe2e8('0x5d')](function(_0x1a51b7){return _0x55344e[_0xe2e8('0x56')](_0x18ced5,{'transaction':_0x1a51b7})[_0xe2e8('0x19')](function(){return BPromise['each'](_0x505773,function(_0x5de459){return db[_0xe2e8('0x40')]['findOrCreate']({'where':{'UserId':_0x5de459['id'],'ChatQueueId':_0x212368[_0xe2e8('0x29')]['id']},'transaction':_0x1a51b7});});})['then'](function(){_0x505773['forEach'](function(_0x42bbbb){socket['emit']('userChatQueue:save',{'UserId':_0x42bbbb['id'],'ChatQueueId':_0x55344e['id']});});});});});}})['then'](respondWithStatusCode(_0x286447,null))[_0xe2e8('0x27')](handleError(_0x286447,null));};exports[_0xe2e8('0x5e')]=function(_0x451c52,_0x1df9d6){return db['Team'][_0xe2e8('0x47')]({'where':{'id':_0x451c52['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe2e8('0x19')](handleEntityNotFound(_0x1df9d6,null))[_0xe2e8('0x19')](function(_0x1ef956){var _0x3719dd=_['map'](_0x1ef956,'id');var _0x5cffdd=[];var _0xedcb69=[];var _0x5aa19e=squel[_0xe2e8('0x5f')]();_0x5aa19e[_0xe2e8('0x60')](_0xe2e8('0x61'))[_0xe2e8('0x62')](_0xe2e8('0x63'),'tq')[_0xe2e8('0x64')](_0xe2e8('0x65'),'ut',_0xe2e8('0x66'))[_0xe2e8('0x23')](_0xe2e8('0x67'),_0x451c52[_0xe2e8('0x29')]['id']);for(var _0x1a1363=0x0;_0x1a1363<_0x1ef956[_0xe2e8('0x30')];_0x1a1363+=0x1){let _0x1ea3c3=_0x1ef956[_0x1a1363];for(var _0x27398d=0x0;_0x27398d<_0x1ea3c3['Agents'][_0xe2e8('0x30')];_0x27398d+=0x1){let _0x38dd10=_0x1ea3c3[_0xe2e8('0x58')][_0x27398d];var _0x556681=_0x5aa19e[_0xe2e8('0x68')]();_0x556681[_0xe2e8('0x23')](_0xe2e8('0x69'),_0x38dd10['id']);_0xedcb69['push'](db['sequelize'][_0xe2e8('0x25')](_0x556681['toString'](),{'type':db[_0xe2e8('0x6a')][_0xe2e8('0x6b')][_0xe2e8('0x6c')]})[_0xe2e8('0x19')](function(_0x26858d){if(_0x26858d[_0xe2e8('0x30')]===0x1){return _0x38dd10['id'];}else{var _0x20f695=_[_0xe2e8('0x6d')](_[_0xe2e8('0x46')](_0x26858d,'TeamId'),function(_0x49db42){return _[_0xe2e8('0x6e')](_0x3719dd,_0x49db42);});if(_0x20f695){return _0x38dd10['id'];}}}));}}return BPromise[_0xe2e8('0x6f')](_0xedcb69)[_0xe2e8('0x19')](function(_0x14f7d1){_0x5cffdd=_(_0x5cffdd)['union'](_0x14f7d1)[_0xe2e8('0x70')]()['value']();return db['ChatQueue'][_0xe2e8('0x34')]({'where':{'id':_0x451c52[_0xe2e8('0x29')]['id']}})[_0xe2e8('0x19')](function(_0x45df6b){return db['sequelize']['transaction'](function(_0x830bdf){return _0x45df6b[_0xe2e8('0x5e')](_0x451c52[_0xe2e8('0x25')]['ids'],{'transaction':_0x830bdf})[_0xe2e8('0x19')](function(){if(!_[_0xe2e8('0x71')](_0x5cffdd)){return _0x45df6b[_0xe2e8('0x72')](_0x5cffdd,{'transaction':_0x830bdf});}})[_0xe2e8('0x19')](function(){_0x5cffdd[_0xe2e8('0x73')](function(_0x57ab66){socket[_0xe2e8('0x74')](_0xe2e8('0x75'),{'UserId':_0x57ab66,'ChatQueueId':_0x45df6b['id']});});});});});});})[_0xe2e8('0x19')](respondWithStatusCode(_0x1df9d6,null))[_0xe2e8('0x27')](handleError(_0x1df9d6,null));};exports[_0xe2e8('0x76')]=function(_0x15b5b0,_0x4b5f1e){return db[_0xe2e8('0x1e')][_0xe2e8('0x34')]({'where':{'id':_0x15b5b0[_0xe2e8('0x29')]['id']}})[_0xe2e8('0x19')](handleEntityNotFound(_0x4b5f1e,null))['then'](function(_0x1062f1){if(_0x1062f1){return _0x1062f1[_0xe2e8('0x76')](_0x15b5b0[_0xe2e8('0x36')][_0xe2e8('0x57')],_[_0xe2e8('0x77')](_0x15b5b0[_0xe2e8('0x36')],[_0xe2e8('0x57'),'id'])||{})['spread'](function(_0x5c35aa){for(var _0x53c75b=0x0;_0x53c75b<_0x15b5b0[_0xe2e8('0x36')][_0xe2e8('0x57')][_0xe2e8('0x30')];_0x53c75b+=0x1){socket[_0xe2e8('0x74')]('userChatQueue:save',{'UserId':Number(_0x15b5b0[_0xe2e8('0x36')][_0xe2e8('0x57')][_0x53c75b]),'ChatQueueId':Number(_0x15b5b0['params']['id'])});}return _0x5c35aa;});}})[_0xe2e8('0x19')](respondWithResult(_0x4b5f1e,null))['catch'](handleError(_0x4b5f1e,null));};exports['removeAgents']=function(_0x3673de,_0x2b0223){return db['ChatQueue'][_0xe2e8('0x34')]({'where':{'id':_0x3673de[_0xe2e8('0x29')]['id']}})[_0xe2e8('0x19')](handleEntityNotFound(_0x2b0223,null))['then'](function(_0x57fdf3){if(_0x57fdf3){return _0x57fdf3[_0xe2e8('0x72')](_0x3673de[_0xe2e8('0x25')][_0xe2e8('0x57')])['then'](function(){if(_['isArray'](_0x3673de[_0xe2e8('0x25')][_0xe2e8('0x57')])){for(var _0x42cba4=0x0;_0x42cba4<_0x3673de[_0xe2e8('0x25')][_0xe2e8('0x57')][_0xe2e8('0x30')];_0x42cba4+=0x1){socket[_0xe2e8('0x74')](_0xe2e8('0x75'),{'UserId':Number(_0x3673de[_0xe2e8('0x25')][_0xe2e8('0x57')][_0x42cba4]),'ChatQueueId':Number(_0x3673de['params']['id'])});}}else{socket[_0xe2e8('0x74')]('userChatQueue:remove',{'UserId':Number(_0x3673de[_0xe2e8('0x25')][_0xe2e8('0x57')]),'ChatQueueId':Number(_0x3673de['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2b0223,null))['catch'](handleError(_0x2b0223,null));};exports['getAgents']=function(_0x4078b0,_0x23cdc7){var _0x508e9a={};var _0x5306b5={};var _0xfeef13;var _0x3b0b97;return db['ChatQueue'][_0xe2e8('0x3f')]({'where':{'id':_0x4078b0[_0xe2e8('0x29')]['id']}})['then'](handleEntityNotFound(_0x23cdc7,null))[_0xe2e8('0x19')](function(_0x21ea26){if(_0x21ea26){_0xfeef13=_0x21ea26;_0x5306b5['model']=_[_0xe2e8('0x2b')](db[_0xe2e8('0x48')][_0xe2e8('0x1f')]);_0x5306b5[_0xe2e8('0x25')]=_[_0xe2e8('0x2b')](_0x4078b0[_0xe2e8('0x25')]);_0x5306b5[_0xe2e8('0x2c')]=_[_0xe2e8('0x2d')](_0x5306b5[_0xe2e8('0x2a')],_0x5306b5[_0xe2e8('0x25')]);_0x508e9a[_0xe2e8('0x2e')]=_[_0xe2e8('0x2d')](_0x5306b5[_0xe2e8('0x2a')],qs[_0xe2e8('0x2f')](_0x4078b0[_0xe2e8('0x25')][_0xe2e8('0x2f')]));_0x508e9a['attributes']=_0x508e9a[_0xe2e8('0x2e')]['length']?_0x508e9a[_0xe2e8('0x2e')]:_0x5306b5[_0xe2e8('0x2a')];_0x508e9a[_0xe2e8('0x53')]=qs[_0xe2e8('0x42')](_0x4078b0[_0xe2e8('0x25')][_0xe2e8('0x42')]);_0x508e9a[_0xe2e8('0x23')]=qs['filters'](_[_0xe2e8('0x43')](_0x4078b0['query'],_0x5306b5[_0xe2e8('0x2c')]));if(_0x4078b0[_0xe2e8('0x25')][_0xe2e8('0x45')]){_0x508e9a['where']=_[_0xe2e8('0x32')](_0x508e9a[_0xe2e8('0x23')],{'$or':_[_0xe2e8('0x46')](_0x508e9a[_0xe2e8('0x2e')],function(_0x4b6114){var _0x36a201={};_0x36a201[_0x4b6114]={'$like':'%'+_0x4078b0[_0xe2e8('0x25')][_0xe2e8('0x45')]+'%'};return _0x36a201;})});}_0x508e9a=_[_0xe2e8('0x32')]({},_0x508e9a,_0x4078b0[_0xe2e8('0x33')]);return _0xfeef13[_0xe2e8('0x78')](_0x508e9a);}})[_0xe2e8('0x19')](function(_0x66755){if(_0x66755){_0x3b0b97=_0x66755[_0xe2e8('0x30')];if(!_0x4078b0['query']['hasOwnProperty'](_0xe2e8('0x55'))){_0x508e9a[_0xe2e8('0x14')]=qs[_0xe2e8('0x14')](_0x4078b0[_0xe2e8('0x25')][_0xe2e8('0x14')]);_0x508e9a[_0xe2e8('0x12')]=qs['offset'](_0x4078b0[_0xe2e8('0x25')][_0xe2e8('0x12')]);}return _0xfeef13[_0xe2e8('0x78')](_0x508e9a);}})[_0xe2e8('0x19')](function(_0xf511f2){if(_0xf511f2){return _0xf511f2?{'count':_0x3b0b97,'rows':_0xf511f2}:null;}})[_0xe2e8('0x19')](respondWithResult(_0x23cdc7,null))[_0xe2e8('0x27')](handleError(_0x23cdc7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9612b41..d8973ea 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 _0x8d0e=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x1dc69a,_0x386c1c){var _0x519cd8=function(_0x246ce2){while(--_0x246ce2){_0x1dc69a['push'](_0x1dc69a['shift']());}};_0x519cd8(++_0x386c1c);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1d124b,_0x59572c){_0x1d124b=_0x1d124b-0x0;var _0x56d238=_0x8d0e[_0x1d124b];return _0x56d238;};'use strict';var EventEmitter=require(_0xe8d0('0x0'));var ChatQueue=require(_0xe8d0('0x1'))['db'][_0xe8d0('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xe8d0('0x3')](0x0);var events={'afterCreate':_0xe8d0('0x4'),'afterUpdate':_0xe8d0('0x5'),'afterDestroy':_0xe8d0('0x6')};function emitEvent(_0x940176){return function(_0x32cee9,_0x579cb9,_0x39caa6){ChatQueueEvents['emit'](_0x940176+':'+_0x32cee9['id'],_0x32cee9);ChatQueueEvents['emit'](_0x940176,_0x32cee9);_0x39caa6(null);};}for(var e in events){if(events[_0xe8d0('0x7')](e)){var event=events[e];ChatQueue[_0xe8d0('0x8')](e,emitEvent(event));}}module[_0xe8d0('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x6959=['hasOwnProperty','exports','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit'];(function(_0x7dc7b6,_0xa43ae8){var _0x3357a4=function(_0x58682e){while(--_0x58682e){_0x7dc7b6['push'](_0x7dc7b6['shift']());}};_0x3357a4(++_0xa43ae8);}(_0x6959,0x9a));var _0x9695=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6959[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x9695('0x0'))['db'][_0x9695('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9695('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9695('0x3'),'afterDestroy':_0x9695('0x4')};function emitEvent(_0x47b632){return function(_0x17f7dd,_0x4eb47b,_0x4c745b){ChatQueueEvents[_0x9695('0x5')](_0x47b632+':'+_0x17f7dd['id'],_0x17f7dd);ChatQueueEvents[_0x9695('0x5')](_0x47b632,_0x17f7dd);_0x4c745b(null);};}for(var e in events){if(events[_0x9695('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x9695('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index cc9d337..c90b928 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 _0x2a80=['./chatQueue.attributes','define','ChatQueue','chat_queues','../../config/logger','moment','bluebird','../../config/environment'];(function(_0x3288e9,_0x5a0a54){var _0x59f919=function(_0x1ff08f){while(--_0x1ff08f){_0x3288e9['push'](_0x3288e9['shift']());}};_0x59f919(++_0x5a0a54);}(_0x2a80,0x194));var _0x02a8=function(_0x51a467,_0x59d69a){_0x51a467=_0x51a467-0x0;var _0x56458b=_0x2a80[_0x51a467];return _0x56458b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x02a8('0x0'))('api');var moment=require(_0x02a8('0x1'));var BPromise=require(_0x02a8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x02a8('0x3'));var attributes=require(_0x02a8('0x4'));module['exports']=function(_0x1b4b0a,_0x58654a){return _0x1b4b0a[_0x02a8('0x5')](_0x02a8('0x6'),attributes,{'tableName':_0x02a8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x675d=['ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x9add99,_0x3eda3b){var _0x482653=function(_0x3eeaa4){while(--_0x3eeaa4){_0x9add99['push'](_0x9add99['shift']());}};_0x482653(++_0x3eda3b);}(_0x675d,0x92));var _0xd675=function(_0x47f9bd,_0x12799d){_0x47f9bd=_0x47f9bd-0x0;var _0x24b9fe=_0x675d[_0x47f9bd];return _0x24b9fe;};'use strict';var _=require(_0xd675('0x0'));var util=require('util');var logger=require(_0xd675('0x1'))(_0xd675('0x2'));var moment=require(_0xd675('0x3'));var BPromise=require(_0xd675('0x4'));var rp=require(_0xd675('0x5'));var fs=require('fs');var path=require(_0xd675('0x6'));var rimraf=require('rimraf');var config=require(_0xd675('0x7'));var attributes=require('./chatQueue.attributes');module[_0xd675('0x8')]=function(_0xcd7263,_0x25aab9){return _0xcd7263[_0xd675('0x9')](_0xd675('0xa'),attributes,{'tableName':_0xd675('0xb'),'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 af4276d..ef0bc10 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 _0x8c28=['register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetChatQueue','findAll','options','raw','where','limit','include','model','attributes','map','then','ChatQueue','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket'];(function(_0x3d17fb,_0x2aa8f2){var _0x5aa433=function(_0xd50c93){while(--_0xd50c93){_0x3d17fb['push'](_0x3d17fb['shift']());}};_0x5aa433(++_0x2aa8f2);}(_0x8c28,0x1c8));var _0x88c2=function(_0x103aaa,_0x46ac8a){_0x103aaa=_0x103aaa-0x0;var _0x26f127=_0x8c28[_0x103aaa];return _0x26f127;};'use strict';var _=require(_0x88c2('0x0'));var util=require(_0x88c2('0x1'));var moment=require(_0x88c2('0x2'));var BPromise=require(_0x88c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88c2('0x4'));var db=require(_0x88c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x88c2('0x6'))(_0x88c2('0x7'));var config=require(_0x88c2('0x8'));var jayson=require(_0x88c2('0x9'));var client=jayson[_0x88c2('0xa')][_0x88c2('0xb')]({'port':0x232a});config['redis']=_[_0x88c2('0xc')](config[_0x88c2('0xd')],{'host':_0x88c2('0xe'),'port':0x18eb});var socket=require(_0x88c2('0xf'))(new Redis(config[_0x88c2('0xd')]));require(_0x88c2('0x10'))[_0x88c2('0x11')](socket);function respondWithRpcPromise(_0x22a76f,_0x2d4d53,_0x1624fc){return new BPromise(function(_0x31146e,_0x56aa98){return client[_0x88c2('0x12')](_0x22a76f,_0x1624fc)['then'](function(_0x17c1e5){logger[_0x88c2('0x13')](_0x88c2('0x14'),_0x2d4d53,_0x88c2('0x15'));logger[_0x88c2('0x16')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2d4d53,_0x88c2('0x15'),JSON[_0x88c2('0x17')](_0x17c1e5));if(_0x17c1e5['error']){if(_0x17c1e5[_0x88c2('0x18')][_0x88c2('0x19')]===0x1f4){logger[_0x88c2('0x18')](_0x88c2('0x14'),_0x2d4d53,_0x17c1e5[_0x88c2('0x18')][_0x88c2('0x1a')]);return _0x56aa98(_0x17c1e5['error'][_0x88c2('0x1a')]);}logger[_0x88c2('0x18')]('ChatQueue,\x20%s,\x20%s',_0x2d4d53,_0x17c1e5[_0x88c2('0x18')][_0x88c2('0x1a')]);return _0x31146e(_0x17c1e5[_0x88c2('0x18')][_0x88c2('0x1a')]);}else{logger['info'](_0x88c2('0x14'),_0x2d4d53,_0x88c2('0x15'));_0x31146e(_0x17c1e5[_0x88c2('0x1b')][_0x88c2('0x1a')]);}})[_0x88c2('0x1c')](function(_0xd3e60c){logger['error'](_0x88c2('0x14'),_0x2d4d53,_0xd3e60c);_0x56aa98(_0xd3e60c);});});}exports[_0x88c2('0x1d')]=function(_0x419311){var _0x22cef4=this;return new Promise(function(_0x2e2ce4,_0x25e651){return db['ChatQueue'][_0x88c2('0x1e')]({'raw':_0x419311[_0x88c2('0x1f')]?_0x419311[_0x88c2('0x1f')][_0x88c2('0x20')]===undefined?!![]:![]:!![],'where':_0x419311['options']?_0x419311[_0x88c2('0x1f')][_0x88c2('0x21')]||null:null,'attributes':_0x419311[_0x88c2('0x1f')]?_0x419311[_0x88c2('0x1f')]['attributes']||null:null,'limit':_0x419311[_0x88c2('0x1f')]?_0x419311[_0x88c2('0x1f')][_0x88c2('0x22')]||null:null,'include':_0x419311[_0x88c2('0x1f')]?_0x419311[_0x88c2('0x1f')][_0x88c2('0x23')]?_['map'](_0x419311[_0x88c2('0x1f')][_0x88c2('0x23')],function(_0x2312fa){return{'model':db[_0x2312fa[_0x88c2('0x24')]],'as':_0x2312fa['as'],'attributes':_0x2312fa[_0x88c2('0x25')],'include':_0x2312fa[_0x88c2('0x23')]?_[_0x88c2('0x26')](_0x2312fa[_0x88c2('0x23')],function(_0x395a7f){return{'model':db[_0x395a7f[_0x88c2('0x24')]],'as':_0x395a7f['as'],'attributes':_0x395a7f[_0x88c2('0x25')],'include':_0x395a7f[_0x88c2('0x23')]?_[_0x88c2('0x26')](_0x395a7f[_0x88c2('0x23')],function(_0x29c39a){return{'model':db[_0x29c39a[_0x88c2('0x24')]],'as':_0x29c39a['as'],'attributes':_0x29c39a[_0x88c2('0x25')]};}):[]};}):[]};}):[]:[]})[_0x88c2('0x27')](function(_0x27c9dd){logger[_0x88c2('0x13')](_0x88c2('0x1d'),_0x419311);logger[_0x88c2('0x16')](_0x88c2('0x1d'),_0x419311,JSON['stringify'](_0x27c9dd));_0x2e2ce4(_0x27c9dd);})[_0x88c2('0x1c')](function(_0x492229){logger[_0x88c2('0x18')]('GetChatQueue',_0x492229[_0x88c2('0x1a')],_0x419311);_0x25e651(_0x22cef4[_0x88c2('0x18')](0x1f4,_0x492229[_0x88c2('0x1a')]));});});};exports['ShowChatQueue']=function(_0x526b79){var _0x1a3841=this;return new Promise(function(_0x500f7b,_0x34f7cb){return db[_0x88c2('0x28')][_0x88c2('0x29')]({'raw':_0x526b79[_0x88c2('0x1f')]?_0x526b79['options'][_0x88c2('0x20')]===undefined?!![]:![]:!![],'where':_0x526b79[_0x88c2('0x1f')]?_0x526b79[_0x88c2('0x1f')][_0x88c2('0x21')]||null:null,'attributes':_0x526b79[_0x88c2('0x1f')]?_0x526b79[_0x88c2('0x1f')][_0x88c2('0x25')]||null:null,'include':_0x526b79[_0x88c2('0x1f')]?_0x526b79[_0x88c2('0x1f')][_0x88c2('0x23')]?_[_0x88c2('0x26')](_0x526b79[_0x88c2('0x1f')][_0x88c2('0x23')],function(_0x2956d6){return{'model':db[_0x2956d6[_0x88c2('0x24')]],'as':_0x2956d6['as'],'attributes':_0x2956d6[_0x88c2('0x25')],'include':_0x2956d6[_0x88c2('0x23')]?_[_0x88c2('0x26')](_0x2956d6['include'],function(_0x2390e4){return{'model':db[_0x2390e4[_0x88c2('0x24')]],'as':_0x2390e4['as'],'attributes':_0x2390e4[_0x88c2('0x25')],'include':_0x2390e4[_0x88c2('0x23')]?_[_0x88c2('0x26')](_0x2390e4[_0x88c2('0x23')],function(_0x9f00ac){return{'model':db[_0x9f00ac[_0x88c2('0x24')]],'as':_0x9f00ac['as'],'attributes':_0x9f00ac['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x51bb0f){logger[_0x88c2('0x13')](_0x88c2('0x2a'),_0x526b79);logger['debug']('ShowChatQueue',_0x526b79,JSON['stringify'](_0x51bb0f));_0x500f7b(_0x51bb0f);})[_0x88c2('0x1c')](function(_0x5bd060){logger[_0x88c2('0x18')](_0x88c2('0x2a'),_0x5bd060['message'],_0x526b79);_0x34f7cb(_0x1a3841[_0x88c2('0x18')](0x1f4,_0x5bd060['message']));});});}; \ No newline at end of file +var _0x6606=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','ChatQueue','options','raw','where','attributes','limit','include','map','GetChatQueue','catch','ShowChatQueue','find','model','lodash','util','moment','bluebird','randomstring'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x6606,0x6a));var _0x6660=function(_0x120bf3,_0x563252){_0x120bf3=_0x120bf3-0x0;var _0x244d0f=_0x6606[_0x120bf3];return _0x244d0f;};'use strict';var _=require(_0x6660('0x0'));var util=require(_0x6660('0x1'));var moment=require(_0x6660('0x2'));var BPromise=require(_0x6660('0x3'));var rs=require(_0x6660('0x4'));var fs=require('fs');var Redis=require(_0x6660('0x5'));var db=require(_0x6660('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6660('0x7'));var config=require('../../config/environment');var jayson=require(_0x6660('0x8'));var client=jayson[_0x6660('0x9')][_0x6660('0xa')]({'port':0x232a});config[_0x6660('0xb')]=_['defaults'](config[_0x6660('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6660('0xb')]));require(_0x6660('0xc'))[_0x6660('0xd')](socket);function respondWithRpcPromise(_0x44224f,_0x487fb3,_0x57cb0e){return new BPromise(function(_0x5c1b85,_0x16d970){return client['request'](_0x44224f,_0x57cb0e)[_0x6660('0xe')](function(_0x168d2a){logger[_0x6660('0xf')](_0x6660('0x10'),_0x487fb3,'request\x20sent');logger[_0x6660('0x11')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x487fb3,_0x6660('0x12'),JSON[_0x6660('0x13')](_0x168d2a));if(_0x168d2a[_0x6660('0x14')]){if(_0x168d2a[_0x6660('0x14')][_0x6660('0x15')]===0x1f4){logger['error'](_0x6660('0x10'),_0x487fb3,_0x168d2a[_0x6660('0x14')][_0x6660('0x16')]);return _0x16d970(_0x168d2a[_0x6660('0x14')][_0x6660('0x16')]);}logger[_0x6660('0x14')](_0x6660('0x10'),_0x487fb3,_0x168d2a[_0x6660('0x14')]['message']);return _0x5c1b85(_0x168d2a[_0x6660('0x14')][_0x6660('0x16')]);}else{logger[_0x6660('0xf')](_0x6660('0x10'),_0x487fb3,_0x6660('0x12'));_0x5c1b85(_0x168d2a[_0x6660('0x17')][_0x6660('0x16')]);}})['catch'](function(_0x2ae651){logger[_0x6660('0x14')]('ChatQueue,\x20%s,\x20%s',_0x487fb3,_0x2ae651);_0x16d970(_0x2ae651);});});}exports['GetChatQueue']=function(_0x5e0a93){var _0x8ae2b8=this;return new Promise(function(_0x5be55f,_0x52afae){return db[_0x6660('0x18')]['findAll']({'raw':_0x5e0a93['options']?_0x5e0a93[_0x6660('0x19')][_0x6660('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e0a93[_0x6660('0x19')]?_0x5e0a93[_0x6660('0x19')][_0x6660('0x1b')]||null:null,'attributes':_0x5e0a93[_0x6660('0x19')]?_0x5e0a93['options'][_0x6660('0x1c')]||null:null,'limit':_0x5e0a93[_0x6660('0x19')]?_0x5e0a93[_0x6660('0x19')][_0x6660('0x1d')]||null:null,'include':_0x5e0a93[_0x6660('0x19')]?_0x5e0a93['options'][_0x6660('0x1e')]?_[_0x6660('0x1f')](_0x5e0a93[_0x6660('0x19')]['include'],function(_0x5d4f39){return{'model':db[_0x5d4f39['model']],'as':_0x5d4f39['as'],'attributes':_0x5d4f39['attributes'],'include':_0x5d4f39['include']?_[_0x6660('0x1f')](_0x5d4f39['include'],function(_0x65ec94){return{'model':db[_0x65ec94['model']],'as':_0x65ec94['as'],'attributes':_0x65ec94[_0x6660('0x1c')],'include':_0x65ec94[_0x6660('0x1e')]?_['map'](_0x65ec94[_0x6660('0x1e')],function(_0x25be51){return{'model':db[_0x25be51['model']],'as':_0x25be51['as'],'attributes':_0x25be51[_0x6660('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x245e4e){logger[_0x6660('0xf')](_0x6660('0x20'),_0x5e0a93);logger[_0x6660('0x11')]('GetChatQueue',_0x5e0a93,JSON[_0x6660('0x13')](_0x245e4e));_0x5be55f(_0x245e4e);})[_0x6660('0x21')](function(_0x24a9ba){logger[_0x6660('0x14')](_0x6660('0x20'),_0x24a9ba[_0x6660('0x16')],_0x5e0a93);_0x52afae(_0x8ae2b8[_0x6660('0x14')](0x1f4,_0x24a9ba[_0x6660('0x16')]));});});};exports[_0x6660('0x22')]=function(_0x40ec51){var _0xff544e=this;return new Promise(function(_0x2667e0,_0x33b3e2){return db[_0x6660('0x18')][_0x6660('0x23')]({'raw':_0x40ec51[_0x6660('0x19')]?_0x40ec51[_0x6660('0x19')][_0x6660('0x1a')]===undefined?!![]:![]:!![],'where':_0x40ec51[_0x6660('0x19')]?_0x40ec51[_0x6660('0x19')][_0x6660('0x1b')]||null:null,'attributes':_0x40ec51['options']?_0x40ec51[_0x6660('0x19')][_0x6660('0x1c')]||null:null,'include':_0x40ec51[_0x6660('0x19')]?_0x40ec51[_0x6660('0x19')][_0x6660('0x1e')]?_[_0x6660('0x1f')](_0x40ec51['options']['include'],function(_0x872a7d){return{'model':db[_0x872a7d[_0x6660('0x24')]],'as':_0x872a7d['as'],'attributes':_0x872a7d[_0x6660('0x1c')],'include':_0x872a7d[_0x6660('0x1e')]?_[_0x6660('0x1f')](_0x872a7d[_0x6660('0x1e')],function(_0x1f745b){return{'model':db[_0x1f745b[_0x6660('0x24')]],'as':_0x1f745b['as'],'attributes':_0x1f745b[_0x6660('0x1c')],'include':_0x1f745b['include']?_[_0x6660('0x1f')](_0x1f745b[_0x6660('0x1e')],function(_0x31e93f){return{'model':db[_0x31e93f[_0x6660('0x24')]],'as':_0x31e93f['as'],'attributes':_0x31e93f[_0x6660('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6660('0xe')](function(_0x4a42a0){logger[_0x6660('0xf')](_0x6660('0x22'),_0x40ec51);logger[_0x6660('0x11')]('ShowChatQueue',_0x40ec51,JSON[_0x6660('0x13')](_0x4a42a0));_0x2667e0(_0x4a42a0);})[_0x6660('0x21')](function(_0x4ab64f){logger['error'](_0x6660('0x22'),_0x4ab64f[_0x6660('0x16')],_0x40ec51);_0x33b3e2(_0xff544e[_0x6660('0x14')](0x1f4,_0x4ab64f[_0x6660('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a6648ed..c11526b 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 _0x032e=['removeListener','register','length','chatQueue:','./chatQueue.events','remove','update','emit'];(function(_0xd58a14,_0xaaf1f7){var _0x5cffb8=function(_0x54f105){while(--_0x54f105){_0xd58a14['push'](_0xd58a14['shift']());}};_0x5cffb8(++_0xaaf1f7);}(_0x032e,0x124));var _0xe032=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x032e[_0x3b380d];return _0x54502b;};'use strict';var ChatQueueEvents=require(_0xe032('0x0'));var events=['save',_0xe032('0x1'),_0xe032('0x2')];function createListener(_0x5ca562,_0x4afba2){return function(_0x45ab5b){_0x4afba2[_0xe032('0x3')](_0x5ca562,_0x45ab5b);};}function removeListener(_0x2f44f6,_0x1983cc){return function(){ChatQueueEvents[_0xe032('0x4')](_0x2f44f6,_0x1983cc);};}exports[_0xe032('0x5')]=function(_0x2ba8a0){for(var _0x33ad0b=0x0,_0x37432f=events[_0xe032('0x6')];_0x33ad0b<_0x37432f;_0x33ad0b++){var _0x3289b0=events[_0x33ad0b];var _0xd84027=createListener(_0xe032('0x7')+_0x3289b0,_0x2ba8a0);ChatQueueEvents['on'](_0x3289b0,_0xd84027);}}; \ No newline at end of file +var _0xc368=['removeListener','register','length','chatQueue:','save','update','emit'];(function(_0x2dbed7,_0x2962d5){var _0x326efc=function(_0x1713b3){while(--_0x1713b3){_0x2dbed7['push'](_0x2dbed7['shift']());}};_0x326efc(++_0x2962d5);}(_0xc368,0x7b));var _0x8c36=function(_0xeed931,_0x234954){_0xeed931=_0xeed931-0x0;var _0x44de53=_0xc368[_0xeed931];return _0x44de53;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8c36('0x0'),'remove',_0x8c36('0x1')];function createListener(_0x17fa33,_0x20e697){return function(_0x2640c5){_0x20e697[_0x8c36('0x2')](_0x17fa33,_0x2640c5);};}function removeListener(_0x5d3b27,_0x3e9034){return function(){ChatQueueEvents[_0x8c36('0x3')](_0x5d3b27,_0x3e9034);};}exports[_0x8c36('0x4')]=function(_0x1d3660){for(var _0x5ebfc1=0x0,_0x554022=events[_0x8c36('0x5')];_0x5ebfc1<_0x554022;_0x5ebfc1++){var _0x384867=events[_0x5ebfc1];var _0x3e76be=createListener(_0x8c36('0x6')+_0x384867,_0x1d3660);ChatQueueEvents['on'](_0x384867,_0x3e76be);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 0151efa..125516d 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(_0x7e3b11,_0x599592){var _0x3c0a85=function(_0x2d4057){while(--_0x2d4057){_0x7e3b11['push'](_0x7e3b11['shift']());}};_0x3c0a85(++_0x599592);}(_0xe14b,0x93));var _0xbe14=function(_0x40c467,_0x5b9a1e){_0x40c467=_0x40c467-0x0;var _0x4505e2=_0xe14b[_0x40c467];return _0x4505e2;};'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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x5fc3[_0x3f0b30];return _0x2748a5;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 4d3e776..c8fe2ef 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 _0xd781=['sequelize','STRING','DATE'];(function(_0x58e842,_0xea2e71){var _0x50424f=function(_0x4aa62b){while(--_0x4aa62b){_0x58e842['push'](_0x58e842['shift']());}};_0x50424f(++_0xea2e71);}(_0xd781,0x180));var _0x1d78=function(_0x5a0648,_0x4b812e){_0x5a0648=_0x5a0648-0x0;var _0x39a24f=_0xd781[_0x5a0648];return _0x39a24f;};'use strict';var moment=require('moment');var Sequelize=require(_0x1d78('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1d78('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1d78('0x1')]},'joinAt':{'type':Sequelize[_0x1d78('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1d78('0x2')]},'exitAt':{'type':Sequelize[_0x1d78('0x2')]},'reason':{'type':Sequelize[_0x1d78('0x1')]}}; \ No newline at end of file +var _0xa995=['sequelize','exports','STRING','DATE'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xa995,0x144));var _0x5a99=function(_0x118e51,_0x3a92a3){_0x118e51=_0x118e51-0x0;var _0x40ed50=_0xa995[_0x118e51];return _0x40ed50;};'use strict';var moment=require('moment');var Sequelize=require(_0x5a99('0x0'));module[_0x5a99('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5a99('0x2')]},'joinAt':{'type':Sequelize[_0x5a99('0x3')]},'leaveAt':{'type':Sequelize[_0x5a99('0x3')]},'acceptAt':{'type':Sequelize[_0x5a99('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5a99('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8e0b863..a5fe692 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 _0x0960=['offset','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','ChatQueueReport','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','includeAll','include','rows','params','keys','rawAttributes','options','create','body','update','find','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count'];(function(_0x22076d,_0x46afc1){var _0x4b1ffc=function(_0x53b118){while(--_0x53b118){_0x22076d['push'](_0x22076d['shift']());}};_0x4b1ffc(++_0x46afc1);}(_0x0960,0xc2));var _0x0096=function(_0x2f729e,_0x528b56){_0x2f729e=_0x2f729e-0x0;var _0x308707=_0x0960[_0x2f729e];return _0x308707;};'use strict';var emlformat=require(_0x0096('0x0'));var rimraf=require(_0x0096('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0096('0x2'));var rp=require(_0x0096('0x3'));var moment=require(_0x0096('0x4'));var BPromise=require(_0x0096('0x5'));var Mustache=require(_0x0096('0x6'));var util=require(_0x0096('0x7'));var path=require(_0x0096('0x8'));var sox=require(_0x0096('0x9'));var csv=require(_0x0096('0xa'));var ejs=require(_0x0096('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0096('0xc'));var squel=require('squel');var crypto=require(_0x0096('0xd'));var jsforce=require(_0x0096('0xe'));var deskjs=require(_0x0096('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0096('0x10'));var Papa=require(_0x0096('0x11'));var Redis=require(_0x0096('0x12'));var authService=require(_0x0096('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0096('0x14'));var hardwareService=require(_0x0096('0x15'));var logger=require('../../config/logger')(_0x0096('0x16'));var utils=require('../../config/utils');var config=require(_0x0096('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0096('0x18'))['db'];function respondWithStatusCode(_0x25011c,_0x55678a){_0x55678a=_0x55678a||0xcc;return function(_0x2be406){if(_0x2be406){return _0x25011c[_0x0096('0x19')](_0x55678a);}return _0x25011c['status'](_0x55678a)['end']();};}function respondWithResult(_0x753d99,_0x39b6f6){_0x39b6f6=_0x39b6f6||0xc8;return function(_0x407361){if(_0x407361){return _0x753d99[_0x0096('0x1a')](_0x39b6f6)[_0x0096('0x1b')](_0x407361);}};}function respondWithFilteredResult(_0x5c901f,_0x590c96){return function(_0x19db10){if(_0x19db10){var _0x50c804=typeof _0x590c96['offset']===_0x0096('0x1c')&&typeof _0x590c96[_0x0096('0x1d')]==='undefined';var _0x7afa5f=_0x19db10[_0x0096('0x1e')];var _0x5468e2=_0x50c804?0x0:_0x590c96[_0x0096('0x1f')];var _0x27462a=_0x50c804?_0x19db10[_0x0096('0x1e')]:_0x590c96[_0x0096('0x1f')]+_0x590c96[_0x0096('0x1d')];var _0x507463;if(_0x27462a>=_0x7afa5f){_0x27462a=_0x7afa5f;_0x507463=0xc8;}else{_0x507463=0xce;}_0x5c901f[_0x0096('0x1a')](_0x507463);return _0x5c901f[_0x0096('0x20')](_0x0096('0x21'),_0x5468e2+'-'+_0x27462a+'/'+_0x7afa5f)['json'](_0x19db10);}return null;};}function patchUpdates(_0x1f5aad){return function(_0xef7a81){try{jsonpatch[_0x0096('0x22')](_0xef7a81,_0x1f5aad,!![]);}catch(_0x4e6338){return BPromise[_0x0096('0x23')](_0x4e6338);}return _0xef7a81[_0x0096('0x24')]();};}function saveUpdates(_0x4ac6f0,_0x263951){return function(_0x29b2c2){if(_0x29b2c2){return _0x29b2c2['update'](_0x4ac6f0)[_0x0096('0x25')](function(_0xfb20d0){return _0xfb20d0;});}return null;};}function removeEntity(_0x1a8e0e,_0x5ee101){return function(_0x224748){if(_0x224748){return _0x224748[_0x0096('0x26')]()[_0x0096('0x25')](function(){_0x1a8e0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x569a7e,_0x2ea1df){return function(_0x1a6df7){if(!_0x1a6df7){_0x569a7e['sendStatus'](0x194);}return _0x1a6df7;};}function handleError(_0x47abff,_0x230d46){_0x230d46=_0x230d46||0x1f4;return function(_0x3eac07){logger['error'](_0x3eac07['stack']);if(_0x3eac07[_0x0096('0x27')]){delete _0x3eac07[_0x0096('0x27')];}_0x47abff['status'](_0x230d46)[_0x0096('0x28')](_0x3eac07);};}exports[_0x0096('0x29')]=function(_0x204002,_0x205b79){var _0x102346={},_0x48e20f={},_0x511806={'count':0x0,'rows':[]};var _0x3b842b=_[_0x0096('0x2a')](db[_0x0096('0x2b')]['rawAttributes'],function(_0x593074){return{'name':_0x593074[_0x0096('0x2c')],'type':_0x593074['type'][_0x0096('0x2d')]};});_0x48e20f[_0x0096('0x2e')]=_[_0x0096('0x2a')](_0x3b842b,_0x0096('0x27'));_0x48e20f['query']=_['keys'](_0x204002[_0x0096('0x2f')]);_0x48e20f['filters']=_[_0x0096('0x30')](_0x48e20f[_0x0096('0x2e')],_0x48e20f[_0x0096('0x2f')]);_0x102346[_0x0096('0x31')]=_[_0x0096('0x30')](_0x48e20f[_0x0096('0x2e')],qs[_0x0096('0x32')](_0x204002[_0x0096('0x2f')][_0x0096('0x32')]));_0x102346[_0x0096('0x31')]=_0x102346[_0x0096('0x31')][_0x0096('0x33')]?_0x102346['attributes']:_0x48e20f[_0x0096('0x2e')];if(!_0x204002[_0x0096('0x2f')][_0x0096('0x34')](_0x0096('0x35'))){_0x102346[_0x0096('0x1d')]=qs[_0x0096('0x1d')](_0x204002[_0x0096('0x2f')]['limit']);_0x102346[_0x0096('0x1f')]=qs[_0x0096('0x1f')](_0x204002[_0x0096('0x2f')][_0x0096('0x1f')]);}_0x102346[_0x0096('0x36')]=qs[_0x0096('0x37')](_0x204002[_0x0096('0x2f')][_0x0096('0x37')]);_0x102346[_0x0096('0x38')]=qs[_0x0096('0x39')](_[_0x0096('0x3a')](_0x204002[_0x0096('0x2f')],_0x48e20f['filters']),_0x3b842b);if(_0x204002[_0x0096('0x2f')]['filter']){_0x102346[_0x0096('0x38')]=_['merge'](_0x102346['where'],{'$or':_[_0x0096('0x2a')](_0x3b842b,function(_0x179496){if(_0x179496[_0x0096('0x3b')]!==_0x0096('0x3c')){var _0x157a61={};_0x157a61[_0x179496['name']]={'$like':'%'+_0x204002[_0x0096('0x2f')][_0x0096('0x3d')]+'%'};return _0x157a61;}})});}_0x102346=_['merge']({},_0x102346,_0x204002['options']);var _0x505ede={'where':_0x102346[_0x0096('0x38')]};return db[_0x0096('0x2b')][_0x0096('0x1e')](_0x505ede)[_0x0096('0x25')](function(_0x5722b6){_0x511806[_0x0096('0x1e')]=_0x5722b6;if(_0x204002[_0x0096('0x2f')][_0x0096('0x3e')]){_0x102346[_0x0096('0x3f')]=[{'all':!![]}];}return db[_0x0096('0x2b')]['findAll'](_0x102346);})[_0x0096('0x25')](function(_0x2dccba){_0x511806[_0x0096('0x40')]=_0x2dccba;return _0x511806;})[_0x0096('0x25')](respondWithFilteredResult(_0x205b79,_0x102346))['catch'](handleError(_0x205b79,null));};exports['show']=function(_0x4b4ab7,_0x12d010){var _0x543e14={'raw':!![],'where':{'id':_0x4b4ab7[_0x0096('0x41')]['id']}},_0x31f7c0={};_0x31f7c0[_0x0096('0x2e')]=_[_0x0096('0x42')](db['ChatQueueReport'][_0x0096('0x43')]);_0x31f7c0[_0x0096('0x2f')]=_[_0x0096('0x42')](_0x4b4ab7[_0x0096('0x2f')]);_0x31f7c0[_0x0096('0x39')]=_[_0x0096('0x30')](_0x31f7c0['model'],_0x31f7c0[_0x0096('0x2f')]);_0x543e14['attributes']=_[_0x0096('0x30')](_0x31f7c0[_0x0096('0x2e')],qs[_0x0096('0x32')](_0x4b4ab7['query'][_0x0096('0x32')]));_0x543e14[_0x0096('0x31')]=_0x543e14[_0x0096('0x31')]['length']?_0x543e14[_0x0096('0x31')]:_0x31f7c0[_0x0096('0x2e')];if(_0x4b4ab7['query'][_0x0096('0x3e')]){_0x543e14[_0x0096('0x3f')]=[{'all':!![]}];}_0x543e14=_['merge']({},_0x543e14,_0x4b4ab7[_0x0096('0x44')]);return db[_0x0096('0x2b')]['find'](_0x543e14)[_0x0096('0x25')](handleEntityNotFound(_0x12d010,null))[_0x0096('0x25')](respondWithResult(_0x12d010,null))['catch'](handleError(_0x12d010,null));};exports['create']=function(_0x34cc4d,_0x18baac){return db['ChatQueueReport'][_0x0096('0x45')](_0x34cc4d[_0x0096('0x46')],{})['then'](respondWithResult(_0x18baac,0xc9))['catch'](handleError(_0x18baac,null));};exports[_0x0096('0x47')]=function(_0x392ca0,_0x29993c){if(_0x392ca0[_0x0096('0x46')]['id']){delete _0x392ca0[_0x0096('0x46')]['id'];}return db[_0x0096('0x2b')][_0x0096('0x48')]({'where':{'id':_0x392ca0[_0x0096('0x41')]['id']}})[_0x0096('0x25')](handleEntityNotFound(_0x29993c,null))[_0x0096('0x25')](saveUpdates(_0x392ca0['body'],null))['then'](respondWithResult(_0x29993c,null))[_0x0096('0x49')](handleError(_0x29993c,null));};exports[_0x0096('0x26')]=function(_0x2f5f2f,_0x7fc578){return db[_0x0096('0x2b')]['find']({'where':{'id':_0x2f5f2f[_0x0096('0x41')]['id']}})[_0x0096('0x25')](handleEntityNotFound(_0x7fc578,null))[_0x0096('0x25')](removeEntity(_0x7fc578,null))[_0x0096('0x49')](handleError(_0x7fc578,null));};exports['describe']=function(_0x56a7c8,_0x425f60){return db[_0x0096('0x2b')][_0x0096('0x4a')]()[_0x0096('0x25')](respondWithResult(_0x425f60,null))[_0x0096('0x49')](handleError(_0x425f60,null));}; \ No newline at end of file +var _0xaac4=['ChatQueueReport','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','includeAll','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','save','then','destroy','error','name','send','index'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xaac4,0x6c));var _0x4aac=function(_0x12b93f,_0x599896){_0x12b93f=_0x12b93f-0x0;var _0x175640=_0xaac4[_0x12b93f];return _0x175640;};'use strict';var emlformat=require(_0x4aac('0x0'));var rimraf=require(_0x4aac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4aac('0x2'));var rp=require(_0x4aac('0x3'));var moment=require(_0x4aac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4aac('0x5'));var util=require(_0x4aac('0x6'));var path=require(_0x4aac('0x7'));var sox=require(_0x4aac('0x8'));var csv=require(_0x4aac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4aac('0xa'));var _=require(_0x4aac('0xb'));var squel=require(_0x4aac('0xc'));var crypto=require('crypto');var jsforce=require(_0x4aac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4aac('0x9'));var querystring=require(_0x4aac('0xe'));var Papa=require(_0x4aac('0xf'));var Redis=require(_0x4aac('0x10'));var authService=require(_0x4aac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4aac('0x12'));var hardwareService=require(_0x4aac('0x13'));var logger=require(_0x4aac('0x14'))(_0x4aac('0x15'));var utils=require('../../config/utils');var config=require(_0x4aac('0x16'));var licenseUtil=require(_0x4aac('0x17'));var db=require(_0x4aac('0x18'))['db'];function respondWithStatusCode(_0xfec6bd,_0x323eb0){_0x323eb0=_0x323eb0||0xcc;return function(_0x30eefc){if(_0x30eefc){return _0xfec6bd[_0x4aac('0x19')](_0x323eb0);}return _0xfec6bd['status'](_0x323eb0)[_0x4aac('0x1a')]();};}function respondWithResult(_0x5b1b27,_0x35469f){_0x35469f=_0x35469f||0xc8;return function(_0x55cbf4){if(_0x55cbf4){return _0x5b1b27[_0x4aac('0x1b')](_0x35469f)['json'](_0x55cbf4);}};}function respondWithFilteredResult(_0x2c58d3,_0x442883){return function(_0x2dca5b){if(_0x2dca5b){var _0x593782=typeof _0x442883[_0x4aac('0x1c')]===_0x4aac('0x1d')&&typeof _0x442883['limit']==='undefined';var _0x5c02c6=_0x2dca5b['count'];var _0x1539fb=_0x593782?0x0:_0x442883[_0x4aac('0x1c')];var _0x44d2a1=_0x593782?_0x2dca5b['count']:_0x442883[_0x4aac('0x1c')]+_0x442883[_0x4aac('0x1e')];var _0x2f751b;if(_0x44d2a1>=_0x5c02c6){_0x44d2a1=_0x5c02c6;_0x2f751b=0xc8;}else{_0x2f751b=0xce;}_0x2c58d3[_0x4aac('0x1b')](_0x2f751b);return _0x2c58d3[_0x4aac('0x1f')](_0x4aac('0x20'),_0x1539fb+'-'+_0x44d2a1+'/'+_0x5c02c6)[_0x4aac('0x21')](_0x2dca5b);}return null;};}function patchUpdates(_0x2c26cc){return function(_0x331226){try{jsonpatch[_0x4aac('0x22')](_0x331226,_0x2c26cc,!![]);}catch(_0x39d457){return BPromise['reject'](_0x39d457);}return _0x331226[_0x4aac('0x23')]();};}function saveUpdates(_0x16eef9,_0x594ef1){return function(_0x192db5){if(_0x192db5){return _0x192db5['update'](_0x16eef9)[_0x4aac('0x24')](function(_0x23fb33){return _0x23fb33;});}return null;};}function removeEntity(_0x34a384,_0x3d4836){return function(_0x1a9cca){if(_0x1a9cca){return _0x1a9cca[_0x4aac('0x25')]()[_0x4aac('0x24')](function(){_0x34a384['status'](0xcc)[_0x4aac('0x1a')]();});}};}function handleEntityNotFound(_0x279c10,_0x431cd9){return function(_0x516261){if(!_0x516261){_0x279c10[_0x4aac('0x19')](0x194);}return _0x516261;};}function handleError(_0x1f135a,_0x1b57ed){_0x1b57ed=_0x1b57ed||0x1f4;return function(_0x18bafe){logger[_0x4aac('0x26')](_0x18bafe['stack']);if(_0x18bafe[_0x4aac('0x27')]){delete _0x18bafe['name'];}_0x1f135a['status'](_0x1b57ed)[_0x4aac('0x28')](_0x18bafe);};}exports[_0x4aac('0x29')]=function(_0x459028,_0x3a1bd3){var _0x37a98b={},_0x5133b8={},_0x2750f3={'count':0x0,'rows':[]};var _0xf7618d=_['map'](db[_0x4aac('0x2a')][_0x4aac('0x2b')],function(_0x59b69f){return{'name':_0x59b69f[_0x4aac('0x2c')],'type':_0x59b69f['type']['key']};});_0x5133b8[_0x4aac('0x2d')]=_[_0x4aac('0x2e')](_0xf7618d,_0x4aac('0x27'));_0x5133b8['query']=_[_0x4aac('0x2f')](_0x459028[_0x4aac('0x30')]);_0x5133b8[_0x4aac('0x31')]=_[_0x4aac('0x32')](_0x5133b8[_0x4aac('0x2d')],_0x5133b8['query']);_0x37a98b[_0x4aac('0x33')]=_[_0x4aac('0x32')](_0x5133b8[_0x4aac('0x2d')],qs[_0x4aac('0x34')](_0x459028['query'][_0x4aac('0x34')]));_0x37a98b[_0x4aac('0x33')]=_0x37a98b['attributes'][_0x4aac('0x35')]?_0x37a98b[_0x4aac('0x33')]:_0x5133b8['model'];if(!_0x459028[_0x4aac('0x30')][_0x4aac('0x36')](_0x4aac('0x37'))){_0x37a98b['limit']=qs['limit'](_0x459028[_0x4aac('0x30')][_0x4aac('0x1e')]);_0x37a98b['offset']=qs[_0x4aac('0x1c')](_0x459028[_0x4aac('0x30')]['offset']);}_0x37a98b[_0x4aac('0x38')]=qs[_0x4aac('0x39')](_0x459028[_0x4aac('0x30')][_0x4aac('0x39')]);_0x37a98b[_0x4aac('0x3a')]=qs[_0x4aac('0x31')](_[_0x4aac('0x3b')](_0x459028[_0x4aac('0x30')],_0x5133b8[_0x4aac('0x31')]),_0xf7618d);if(_0x459028['query'][_0x4aac('0x3c')]){_0x37a98b[_0x4aac('0x3a')]=_[_0x4aac('0x3d')](_0x37a98b['where'],{'$or':_[_0x4aac('0x2e')](_0xf7618d,function(_0x1717c0){if(_0x1717c0[_0x4aac('0x3e')]!==_0x4aac('0x3f')){var _0x2c9a8f={};_0x2c9a8f[_0x1717c0[_0x4aac('0x27')]]={'$like':'%'+_0x459028[_0x4aac('0x30')][_0x4aac('0x3c')]+'%'};return _0x2c9a8f;}})});}_0x37a98b=_[_0x4aac('0x3d')]({},_0x37a98b,_0x459028[_0x4aac('0x40')]);var _0x331514={'where':_0x37a98b['where']};return db[_0x4aac('0x2a')]['count'](_0x331514)[_0x4aac('0x24')](function(_0x1d1435){_0x2750f3['count']=_0x1d1435;if(_0x459028[_0x4aac('0x30')]['includeAll']){_0x37a98b['include']=[{'all':!![]}];}return db[_0x4aac('0x2a')][_0x4aac('0x41')](_0x37a98b);})[_0x4aac('0x24')](function(_0x3d1cd5){_0x2750f3['rows']=_0x3d1cd5;return _0x2750f3;})[_0x4aac('0x24')](respondWithFilteredResult(_0x3a1bd3,_0x37a98b))[_0x4aac('0x42')](handleError(_0x3a1bd3,null));};exports[_0x4aac('0x43')]=function(_0xf84265,_0x44fb73){var _0x354fed={'raw':!![],'where':{'id':_0xf84265[_0x4aac('0x44')]['id']}},_0x5d09f6={};_0x5d09f6['model']=_[_0x4aac('0x2f')](db[_0x4aac('0x2a')][_0x4aac('0x2b')]);_0x5d09f6['query']=_[_0x4aac('0x2f')](_0xf84265[_0x4aac('0x30')]);_0x5d09f6[_0x4aac('0x31')]=_[_0x4aac('0x32')](_0x5d09f6[_0x4aac('0x2d')],_0x5d09f6[_0x4aac('0x30')]);_0x354fed['attributes']=_['intersection'](_0x5d09f6[_0x4aac('0x2d')],qs['fields'](_0xf84265[_0x4aac('0x30')][_0x4aac('0x34')]));_0x354fed[_0x4aac('0x33')]=_0x354fed[_0x4aac('0x33')][_0x4aac('0x35')]?_0x354fed[_0x4aac('0x33')]:_0x5d09f6[_0x4aac('0x2d')];if(_0xf84265[_0x4aac('0x30')][_0x4aac('0x45')]){_0x354fed['include']=[{'all':!![]}];}_0x354fed=_[_0x4aac('0x3d')]({},_0x354fed,_0xf84265[_0x4aac('0x40')]);return db['ChatQueueReport']['find'](_0x354fed)[_0x4aac('0x24')](handleEntityNotFound(_0x44fb73,null))['then'](respondWithResult(_0x44fb73,null))['catch'](handleError(_0x44fb73,null));};exports['create']=function(_0x5191ba,_0x58c47b){return db['ChatQueueReport'][_0x4aac('0x46')](_0x5191ba[_0x4aac('0x47')],{})[_0x4aac('0x24')](respondWithResult(_0x58c47b,0xc9))[_0x4aac('0x42')](handleError(_0x58c47b,null));};exports[_0x4aac('0x48')]=function(_0x2d25f9,_0x74f0ad){if(_0x2d25f9[_0x4aac('0x47')]['id']){delete _0x2d25f9[_0x4aac('0x47')]['id'];}return db[_0x4aac('0x2a')]['find']({'where':{'id':_0x2d25f9[_0x4aac('0x44')]['id']}})[_0x4aac('0x24')](handleEntityNotFound(_0x74f0ad,null))['then'](saveUpdates(_0x2d25f9[_0x4aac('0x47')],null))[_0x4aac('0x24')](respondWithResult(_0x74f0ad,null))[_0x4aac('0x42')](handleError(_0x74f0ad,null));};exports[_0x4aac('0x25')]=function(_0x1b2179,_0x1164de){return db[_0x4aac('0x2a')][_0x4aac('0x49')]({'where':{'id':_0x1b2179[_0x4aac('0x44')]['id']}})[_0x4aac('0x24')](handleEntityNotFound(_0x1164de,null))[_0x4aac('0x24')](removeEntity(_0x1164de,null))[_0x4aac('0x42')](handleError(_0x1164de,null));};exports[_0x4aac('0x4a')]=function(_0x11419b,_0x1d9197){return db['ChatQueueReport'][_0x4aac('0x4a')]()['then'](respondWithResult(_0x1d9197,null))[_0x4aac('0x42')](handleError(_0x1d9197,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 57a76ef..0190f96 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3a06d2,_0xe4b68e){var _0x44ed07=function(_0x47ff42){while(--_0x47ff42){_0x3a06d2['push'](_0x3a06d2['shift']());}};_0x44ed07(++_0xe4b68e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x3f3631,_0x4c2f36){var _0x43d453=function(_0x46336a){while(--_0x46336a){_0x3f3631['push'](_0x3f3631['shift']());}};_0x43d453(++_0x4c2f36);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0xcb91[_0x5e2152];return _0x5ddcf6;};'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')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c5dd17a..59afe85 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 _0x1255=['options','raw','UpdateChatQueueReport','update','where','limit','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','catch','CreateChatQueueReport','ChatQueueReport','create','body'];(function(_0x1b90af,_0x2cee67){var _0x4222d=function(_0x42d273){while(--_0x42d273){_0x1b90af['push'](_0x1b90af['shift']());}};_0x4222d(++_0x2cee67);}(_0x1255,0x127));var _0x5125=function(_0x453022,_0x4276ba){_0x453022=_0x453022-0x0;var _0x4a2926=_0x1255[_0x453022];return _0x4a2926;};'use strict';var _=require(_0x5125('0x0'));var util=require(_0x5125('0x1'));var moment=require('moment');var BPromise=require(_0x5125('0x2'));var rs=require(_0x5125('0x3'));var fs=require('fs');var Redis=require(_0x5125('0x4'));var db=require(_0x5125('0x5'))['db'];var utils=require(_0x5125('0x6'));var logger=require('../../config/logger')(_0x5125('0x7'));var config=require('../../config/environment');var jayson=require(_0x5125('0x8'));var client=jayson[_0x5125('0x9')][_0x5125('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42bc2d,_0x20f636,_0x215e9b){return new BPromise(function(_0x397a82,_0x3c5603){return client[_0x5125('0xb')](_0x42bc2d,_0x215e9b)['then'](function(_0x743652){logger[_0x5125('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x20f636,_0x5125('0xd'));logger[_0x5125('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x20f636,_0x5125('0xd'),JSON[_0x5125('0xf')](_0x743652));if(_0x743652[_0x5125('0x10')]){if(_0x743652[_0x5125('0x10')][_0x5125('0x11')]===0x1f4){logger[_0x5125('0x10')](_0x5125('0x12'),_0x20f636,_0x743652['error'][_0x5125('0x13')]);return _0x3c5603(_0x743652[_0x5125('0x10')][_0x5125('0x13')]);}logger[_0x5125('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x20f636,_0x743652[_0x5125('0x10')][_0x5125('0x13')]);return _0x397a82(_0x743652[_0x5125('0x10')]['message']);}else{logger[_0x5125('0xc')](_0x5125('0x12'),_0x20f636,_0x5125('0xd'));_0x397a82(_0x743652['result'][_0x5125('0x13')]);}})[_0x5125('0x14')](function(_0x1bf22c){logger[_0x5125('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x20f636,_0x1bf22c);_0x3c5603(_0x1bf22c);});});}exports[_0x5125('0x15')]=function(_0x1e6805){var _0x5e1671=this;return new Promise(function(_0x49226d,_0x2ef3b0){return db[_0x5125('0x16')][_0x5125('0x17')](_0x1e6805[_0x5125('0x18')],{'raw':_0x1e6805['options']?_0x1e6805[_0x5125('0x19')][_0x5125('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1d6f63){logger['info'](_0x5125('0x15'),_0x1e6805);logger[_0x5125('0xe')](_0x5125('0x15'),_0x1e6805,JSON[_0x5125('0xf')](_0x1d6f63));_0x49226d(_0x1d6f63);})[_0x5125('0x14')](function(_0x47cd9e){logger['error'](_0x5125('0x15'),_0x47cd9e[_0x5125('0x13')],_0x1e6805);_0x2ef3b0(_0x5e1671[_0x5125('0x10')](0x1f4,_0x47cd9e['message']));});});};exports[_0x5125('0x1b')]=function(_0x529980){var _0x508e30=this;return new Promise(function(_0xe947b3,_0x114d89){return db[_0x5125('0x16')][_0x5125('0x1c')](_0x529980['body'],{'raw':_0x529980[_0x5125('0x19')]?_0x529980[_0x5125('0x19')][_0x5125('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529980[_0x5125('0x19')]?_0x529980[_0x5125('0x19')][_0x5125('0x1d')]||null:null,'attributes':_0x529980['options']?_0x529980['options']['attributes']||null:null,'limit':_0x529980[_0x5125('0x19')]?_0x529980[_0x5125('0x19')][_0x5125('0x1e')]||null:null})[_0x5125('0x1f')](function(_0x4e94ba){logger[_0x5125('0xc')](_0x5125('0x1b'),_0x529980);logger[_0x5125('0xe')](_0x5125('0x1b'),_0x529980,JSON[_0x5125('0xf')](_0x4e94ba));_0xe947b3(_0x4e94ba);})[_0x5125('0x14')](function(_0x5893e9){logger['error'](_0x5125('0x1b'),_0x5893e9[_0x5125('0x13')],_0x529980);_0x114d89(_0x508e30[_0x5125('0x10')](0x1f4,_0x5893e9['message']));});});}; \ No newline at end of file +var _0xbf03=['../../config/environment','jayson/promise','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateChatQueueReport','create','options','raw','debug','catch','UpdateChatQueueReport','ChatQueueReport','where','attributes','limit','util','bluebird','randomstring','../../mysqldb'];(function(_0x581a20,_0xff8dfa){var _0x38663e=function(_0x4ea3c8){while(--_0x4ea3c8){_0x581a20['push'](_0x581a20['shift']());}};_0x38663e(++_0xff8dfa);}(_0xbf03,0x184));var _0x3bf0=function(_0x54d46b,_0x5b8091){_0x54d46b=_0x54d46b-0x0;var _0x4f2a05=_0xbf03[_0x54d46b];return _0x4f2a05;};'use strict';var _=require('lodash');var util=require(_0x3bf0('0x0'));var moment=require('moment');var BPromise=require(_0x3bf0('0x1'));var rs=require(_0x3bf0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bf0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3bf0('0x4'));var jayson=require(_0x3bf0('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ac378,_0x4b560e,_0x1e25f0){return new BPromise(function(_0x413cc5,_0x4c4f4a){return client[_0x3bf0('0x6')](_0x3ac378,_0x1e25f0)[_0x3bf0('0x7')](function(_0x487d12){logger['info'](_0x3bf0('0x8'),_0x4b560e,_0x3bf0('0x9'));logger['debug'](_0x3bf0('0xa'),_0x4b560e,_0x3bf0('0x9'),JSON[_0x3bf0('0xb')](_0x487d12));if(_0x487d12['error']){if(_0x487d12[_0x3bf0('0xc')][_0x3bf0('0xd')]===0x1f4){logger[_0x3bf0('0xc')](_0x3bf0('0x8'),_0x4b560e,_0x487d12['error']['message']);return _0x4c4f4a(_0x487d12[_0x3bf0('0xc')]['message']);}logger[_0x3bf0('0xc')](_0x3bf0('0x8'),_0x4b560e,_0x487d12[_0x3bf0('0xc')][_0x3bf0('0xe')]);return _0x413cc5(_0x487d12[_0x3bf0('0xc')][_0x3bf0('0xe')]);}else{logger[_0x3bf0('0xf')](_0x3bf0('0x8'),_0x4b560e,'request\x20sent');_0x413cc5(_0x487d12[_0x3bf0('0x10')][_0x3bf0('0xe')]);}})['catch'](function(_0x2198dc){logger[_0x3bf0('0xc')](_0x3bf0('0x8'),_0x4b560e,_0x2198dc);_0x4c4f4a(_0x2198dc);});});}exports[_0x3bf0('0x11')]=function(_0x221243){var _0x55fd1a=this;return new Promise(function(_0x1ec8a1,_0x5c2fa6){return db['ChatQueueReport'][_0x3bf0('0x12')](_0x221243['body'],{'raw':_0x221243[_0x3bf0('0x13')]?_0x221243[_0x3bf0('0x13')][_0x3bf0('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x44c975){logger[_0x3bf0('0xf')](_0x3bf0('0x11'),_0x221243);logger[_0x3bf0('0x15')](_0x3bf0('0x11'),_0x221243,JSON[_0x3bf0('0xb')](_0x44c975));_0x1ec8a1(_0x44c975);})[_0x3bf0('0x16')](function(_0x41c02d){logger[_0x3bf0('0xc')]('CreateChatQueueReport',_0x41c02d['message'],_0x221243);_0x5c2fa6(_0x55fd1a[_0x3bf0('0xc')](0x1f4,_0x41c02d[_0x3bf0('0xe')]));});});};exports[_0x3bf0('0x17')]=function(_0x5c6be4){var _0x309d76=this;return new Promise(function(_0x4dfd07,_0x5803cc){return db[_0x3bf0('0x18')]['update'](_0x5c6be4['body'],{'raw':_0x5c6be4[_0x3bf0('0x13')]?_0x5c6be4['options'][_0x3bf0('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c6be4[_0x3bf0('0x13')]?_0x5c6be4[_0x3bf0('0x13')][_0x3bf0('0x19')]||null:null,'attributes':_0x5c6be4[_0x3bf0('0x13')]?_0x5c6be4['options'][_0x3bf0('0x1a')]||null:null,'limit':_0x5c6be4[_0x3bf0('0x13')]?_0x5c6be4['options'][_0x3bf0('0x1b')]||null:null})[_0x3bf0('0x7')](function(_0x261ea4){logger[_0x3bf0('0xf')]('UpdateChatQueueReport',_0x5c6be4);logger[_0x3bf0('0x15')](_0x3bf0('0x17'),_0x5c6be4,JSON['stringify'](_0x261ea4));_0x4dfd07(_0x261ea4);})['catch'](function(_0x4a7e3a){logger['error'](_0x3bf0('0x17'),_0x4a7e3a[_0x3bf0('0xe')],_0x5c6be4);_0x5803cc(_0x309d76[_0x3bf0('0xc')](0x1f4,_0x4a7e3a[_0x3bf0('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e5411cd..77113c8 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 _0xca93=['isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe'];(function(_0x3d22ab,_0x24479a){var _0x38e407=function(_0x21647b){while(--_0x21647b){_0x3d22ab['push'](_0x3d22ab['shift']());}};_0x38e407(++_0x24479a);}(_0xca93,0x171));var _0x3ca9=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xca93[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x3ca9('0x0'));var util=require(_0x3ca9('0x1'));var path=require(_0x3ca9('0x2'));var timeout=require(_0x3ca9('0x3'));var express=require(_0x3ca9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3ca9('0x5'));var config=require(_0x3ca9('0x6'));var controller=require(_0x3ca9('0x7'));router[_0x3ca9('0x8')]('/',auth['isAuthenticated'](),controller[_0x3ca9('0x9')]);router[_0x3ca9('0x8')](_0x3ca9('0xa'),auth[_0x3ca9('0xb')](),controller['describe']);router[_0x3ca9('0x8')]('/:id',auth[_0x3ca9('0xb')](),controller[_0x3ca9('0xc')]);router[_0x3ca9('0xd')]('/',auth[_0x3ca9('0xb')](),controller[_0x3ca9('0xe')]);router[_0x3ca9('0xf')](_0x3ca9('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x3ca9('0x11')](_0x3ca9('0x10'),auth[_0x3ca9('0xb')](),controller[_0x3ca9('0x12')]);module[_0x3ca9('0x13')]=router; \ No newline at end of file +var _0xb073=['put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x428479,_0x5a5b43){var _0x3386f9=function(_0x368169){while(--_0x368169){_0x428479['push'](_0x428479['shift']());}};_0x3386f9(++_0x5a5b43);}(_0xb073,0xa7));var _0x3b07=function(_0x688082,_0x161ad8){_0x688082=_0x688082-0x0;var _0x1e35b8=_0xb073[_0x688082];return _0x1e35b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3b07('0x0'));var timeout=require(_0x3b07('0x1'));var express=require(_0x3b07('0x2'));var router=express['Router']();var fs_extra=require(_0x3b07('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b07('0x4'));var controller=require('./chatQueueReport.controller');router[_0x3b07('0x5')]('/',auth[_0x3b07('0x6')](),controller[_0x3b07('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3b07('0x8')]);router['get'](_0x3b07('0x9'),auth[_0x3b07('0x6')](),controller[_0x3b07('0xa')]);router[_0x3b07('0xb')]('/',auth[_0x3b07('0x6')](),controller[_0x3b07('0xc')]);router[_0x3b07('0xd')]('/:id',auth[_0x3b07('0x6')](),controller[_0x3b07('0xe')]);router[_0x3b07('0xf')]('/:id',auth[_0x3b07('0x6')](),controller[_0x3b07('0x10')]);module[_0x3b07('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index cc1c852..75e4330 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x483a2f,_0x1d2a9e){_0x483a2f=_0x483a2f-0x0;var _0xdc0560=_0xb43b[_0x483a2f];return _0xdc0560;};'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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3af732,_0x570073){var _0x565568=function(_0x27c8ac){while(--_0x27c8ac){_0x3af732['push'](_0x3af732['shift']());}};_0x565568(++_0x570073);}(_0xf4eb,0xec));var _0xbf4e=function(_0x48592c,_0x13c9f8){_0x48592c=_0x48592c-0x0;var _0x4d1c2d=_0xf4eb[_0x48592c];return _0x4d1c2d;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 833d692..463dbb1 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 _0x1448=['filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','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/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','json','apply','reject','save','destroy','then','sendStatus','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5dea3c,_0x5387bd){var _0x71034f=function(_0x1e84de){while(--_0x1e84de){_0x5dea3c['push'](_0x5dea3c['shift']());}};_0x71034f(++_0x5387bd);}(_0x1448,0x140));var _0x8144=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1448[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8144('0x0'));var zipdir=require(_0x8144('0x1'));var jsonpatch=require(_0x8144('0x2'));var rp=require(_0x8144('0x3'));var moment=require('moment');var BPromise=require(_0x8144('0x4'));var Mustache=require(_0x8144('0x5'));var util=require(_0x8144('0x6'));var path=require('path');var sox=require(_0x8144('0x7'));var csv=require(_0x8144('0x8'));var ejs=require(_0x8144('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8144('0xa'));var squel=require(_0x8144('0xb'));var crypto=require(_0x8144('0xc'));var jsforce=require(_0x8144('0xd'));var deskjs=require(_0x8144('0xe'));var toCsv=require(_0x8144('0x8'));var querystring=require(_0x8144('0xf'));var Papa=require(_0x8144('0x10'));var Redis=require(_0x8144('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8144('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8144('0x13'));var logger=require('../../config/logger')(_0x8144('0x14'));var utils=require(_0x8144('0x15'));var config=require(_0x8144('0x16'));var licenseUtil=require(_0x8144('0x17'));var db=require(_0x8144('0x18'))['db'];function respondWithStatusCode(_0xcabbcd,_0x486c96){_0x486c96=_0x486c96||0xcc;return function(_0x2e5885){if(_0x2e5885){return _0xcabbcd['sendStatus'](_0x486c96);}return _0xcabbcd[_0x8144('0x19')](_0x486c96)[_0x8144('0x1a')]();};}function respondWithResult(_0x57e1a7,_0x2f2fa3){_0x2f2fa3=_0x2f2fa3||0xc8;return function(_0x2814d6){if(_0x2814d6){return _0x57e1a7[_0x8144('0x19')](_0x2f2fa3)['json'](_0x2814d6);}};}function respondWithFilteredResult(_0x53a3a9,_0x1d36d3){return function(_0x2dba35){if(_0x2dba35){var _0x5f2942=typeof _0x1d36d3['offset']===_0x8144('0x1b')&&typeof _0x1d36d3[_0x8144('0x1c')]===_0x8144('0x1b');var _0x52ab9f=_0x2dba35[_0x8144('0x1d')];var _0x56d1e5=_0x5f2942?0x0:_0x1d36d3[_0x8144('0x1e')];var _0x5a04d6=_0x5f2942?_0x2dba35[_0x8144('0x1d')]:_0x1d36d3[_0x8144('0x1e')]+_0x1d36d3[_0x8144('0x1c')];var _0x3b58c3;if(_0x5a04d6>=_0x52ab9f){_0x5a04d6=_0x52ab9f;_0x3b58c3=0xc8;}else{_0x3b58c3=0xce;}_0x53a3a9['status'](_0x3b58c3);return _0x53a3a9['set']('Content-Range',_0x56d1e5+'-'+_0x5a04d6+'/'+_0x52ab9f)[_0x8144('0x1f')](_0x2dba35);}return null;};}function patchUpdates(_0x27d313){return function(_0x7ca9cd){try{jsonpatch[_0x8144('0x20')](_0x7ca9cd,_0x27d313,!![]);}catch(_0x49043f){return BPromise[_0x8144('0x21')](_0x49043f);}return _0x7ca9cd[_0x8144('0x22')]();};}function saveUpdates(_0x249abf,_0x464dbf){return function(_0x2aa6a4){if(_0x2aa6a4){return _0x2aa6a4['update'](_0x249abf)['then'](function(_0x334a13){return _0x334a13;});}return null;};}function removeEntity(_0x34a11a,_0x237b14){return function(_0x2f4985){if(_0x2f4985){return _0x2f4985[_0x8144('0x23')]()[_0x8144('0x24')](function(){_0x34a11a[_0x8144('0x19')](0xcc)[_0x8144('0x1a')]();});}};}function handleEntityNotFound(_0x19b49f,_0x31a55e){return function(_0x1a7385){if(!_0x1a7385){_0x19b49f[_0x8144('0x25')](0x194);}return _0x1a7385;};}function handleError(_0xbeaea3,_0x2c5d19){_0x2c5d19=_0x2c5d19||0x1f4;return function(_0x2b44c7){logger[_0x8144('0x26')](_0x2b44c7[_0x8144('0x27')]);if(_0x2b44c7[_0x8144('0x28')]){delete _0x2b44c7[_0x8144('0x28')];}_0xbeaea3[_0x8144('0x19')](_0x2c5d19)['send'](_0x2b44c7);};}exports[_0x8144('0x29')]=function(_0xe3ac2d,_0x40aef7){var _0x19e869={},_0x4538e1={},_0x3fa41d={'count':0x0,'rows':[]};var _0x51f7d8=_[_0x8144('0x2a')](db[_0x8144('0x2b')][_0x8144('0x2c')],function(_0x213f03){return{'name':_0x213f03[_0x8144('0x2d')],'type':_0x213f03[_0x8144('0x2e')]['key']};});_0x4538e1[_0x8144('0x2f')]=_[_0x8144('0x2a')](_0x51f7d8,_0x8144('0x28'));_0x4538e1['query']=_['keys'](_0xe3ac2d[_0x8144('0x30')]);_0x4538e1[_0x8144('0x31')]=_[_0x8144('0x32')](_0x4538e1[_0x8144('0x2f')],_0x4538e1[_0x8144('0x30')]);_0x19e869['attributes']=_['intersection'](_0x4538e1[_0x8144('0x2f')],qs['fields'](_0xe3ac2d[_0x8144('0x30')][_0x8144('0x33')]));_0x19e869[_0x8144('0x34')]=_0x19e869[_0x8144('0x34')][_0x8144('0x35')]?_0x19e869[_0x8144('0x34')]:_0x4538e1[_0x8144('0x2f')];if(!_0xe3ac2d[_0x8144('0x30')][_0x8144('0x36')](_0x8144('0x37'))){_0x19e869[_0x8144('0x1c')]=qs['limit'](_0xe3ac2d[_0x8144('0x30')][_0x8144('0x1c')]);_0x19e869['offset']=qs[_0x8144('0x1e')](_0xe3ac2d[_0x8144('0x30')][_0x8144('0x1e')]);}_0x19e869[_0x8144('0x38')]=qs[_0x8144('0x39')](_0xe3ac2d[_0x8144('0x30')][_0x8144('0x39')]);_0x19e869[_0x8144('0x3a')]=qs[_0x8144('0x31')](_[_0x8144('0x3b')](_0xe3ac2d['query'],_0x4538e1['filters']),_0x51f7d8);if(_0xe3ac2d[_0x8144('0x30')][_0x8144('0x3c')]){_0x19e869[_0x8144('0x3a')]=_[_0x8144('0x3d')](_0x19e869[_0x8144('0x3a')],{'$or':_['map'](_0x51f7d8,function(_0x52988c){if(_0x52988c[_0x8144('0x2e')]!=='VIRTUAL'){var _0x4c8624={};_0x4c8624[_0x52988c['name']]={'$like':'%'+_0xe3ac2d[_0x8144('0x30')][_0x8144('0x3c')]+'%'};return _0x4c8624;}})});}_0x19e869=_['merge']({},_0x19e869,_0xe3ac2d[_0x8144('0x3e')]);var _0x2a9187={'where':_0x19e869[_0x8144('0x3a')]};return db['ChatTransferReport'][_0x8144('0x1d')](_0x2a9187)[_0x8144('0x24')](function(_0x364821){_0x3fa41d[_0x8144('0x1d')]=_0x364821;if(_0xe3ac2d[_0x8144('0x30')][_0x8144('0x3f')]){_0x19e869[_0x8144('0x40')]=[{'all':!![]}];}return db[_0x8144('0x2b')][_0x8144('0x41')](_0x19e869);})[_0x8144('0x24')](function(_0x39fd69){_0x3fa41d[_0x8144('0x42')]=_0x39fd69;return _0x3fa41d;})[_0x8144('0x24')](respondWithFilteredResult(_0x40aef7,_0x19e869))[_0x8144('0x43')](handleError(_0x40aef7,null));};exports[_0x8144('0x44')]=function(_0x2a95cc,_0x1bfa76){var _0x57ee3={'raw':!![],'where':{'id':_0x2a95cc[_0x8144('0x45')]['id']}},_0x1cd4c4={};_0x1cd4c4[_0x8144('0x2f')]=_[_0x8144('0x46')](db['ChatTransferReport'][_0x8144('0x2c')]);_0x1cd4c4['query']=_[_0x8144('0x46')](_0x2a95cc[_0x8144('0x30')]);_0x1cd4c4[_0x8144('0x31')]=_['intersection'](_0x1cd4c4[_0x8144('0x2f')],_0x1cd4c4[_0x8144('0x30')]);_0x57ee3[_0x8144('0x34')]=_[_0x8144('0x32')](_0x1cd4c4['model'],qs['fields'](_0x2a95cc[_0x8144('0x30')][_0x8144('0x33')]));_0x57ee3[_0x8144('0x34')]=_0x57ee3[_0x8144('0x34')][_0x8144('0x35')]?_0x57ee3[_0x8144('0x34')]:_0x1cd4c4['model'];if(_0x2a95cc['query'][_0x8144('0x3f')]){_0x57ee3[_0x8144('0x40')]=[{'all':!![]}];}_0x57ee3=_[_0x8144('0x3d')]({},_0x57ee3,_0x2a95cc[_0x8144('0x3e')]);return db['ChatTransferReport'][_0x8144('0x47')](_0x57ee3)['then'](handleEntityNotFound(_0x1bfa76,null))[_0x8144('0x24')](respondWithResult(_0x1bfa76,null))[_0x8144('0x43')](handleError(_0x1bfa76,null));};exports[_0x8144('0x48')]=function(_0x11df83,_0x22183d){return db['ChatTransferReport'][_0x8144('0x48')](_0x11df83[_0x8144('0x49')],{})[_0x8144('0x24')](respondWithResult(_0x22183d,0xc9))[_0x8144('0x43')](handleError(_0x22183d,null));};exports[_0x8144('0x4a')]=function(_0x215bef,_0x37be38){if(_0x215bef['body']['id']){delete _0x215bef[_0x8144('0x49')]['id'];}return db[_0x8144('0x2b')][_0x8144('0x47')]({'where':{'id':_0x215bef['params']['id']}})[_0x8144('0x24')](handleEntityNotFound(_0x37be38,null))['then'](saveUpdates(_0x215bef[_0x8144('0x49')],null))['then'](respondWithResult(_0x37be38,null))['catch'](handleError(_0x37be38,null));};exports[_0x8144('0x23')]=function(_0x2ae52e,_0x3c0385){return db[_0x8144('0x2b')][_0x8144('0x47')]({'where':{'id':_0x2ae52e[_0x8144('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c0385,null))['then'](removeEntity(_0x3c0385,null))[_0x8144('0x43')](handleError(_0x3c0385,null));};exports[_0x8144('0x4b')]=function(_0x36e709,_0x4d8390){return db[_0x8144('0x2b')]['describe']()['then'](respondWithResult(_0x4d8390,null))[_0x8144('0x43')](handleError(_0x4d8390,null));}; \ No newline at end of file +var _0x5717=['where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort'];(function(_0x29e46d,_0x104ae0){var _0x45479b=function(_0x7e7a57){while(--_0x7e7a57){_0x29e46d['push'](_0x29e46d['shift']());}};_0x45479b(++_0x104ae0);}(_0x5717,0x1e6));var _0x7571=function(_0x57321a,_0x1e29b0){_0x57321a=_0x57321a-0x0;var _0x27c1ed=_0x5717[_0x57321a];return _0x27c1ed;};'use strict';var emlformat=require(_0x7571('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7571('0x1'));var jsonpatch=require(_0x7571('0x2'));var rp=require(_0x7571('0x3'));var moment=require(_0x7571('0x4'));var BPromise=require(_0x7571('0x5'));var Mustache=require(_0x7571('0x6'));var util=require(_0x7571('0x7'));var path=require('path');var sox=require(_0x7571('0x8'));var csv=require(_0x7571('0x9'));var ejs=require(_0x7571('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7571('0xb'));var squel=require('squel');var crypto=require(_0x7571('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7571('0xd'));var toCsv=require(_0x7571('0x9'));var querystring=require(_0x7571('0xe'));var Papa=require(_0x7571('0xf'));var Redis=require(_0x7571('0x10'));var authService=require(_0x7571('0x11'));var qs=require(_0x7571('0x12'));var as=require(_0x7571('0x13'));var hardwareService=require(_0x7571('0x14'));var logger=require(_0x7571('0x15'))(_0x7571('0x16'));var utils=require(_0x7571('0x17'));var config=require(_0x7571('0x18'));var licenseUtil=require(_0x7571('0x19'));var db=require(_0x7571('0x1a'))['db'];function respondWithStatusCode(_0x2936d4,_0x15161b){_0x15161b=_0x15161b||0xcc;return function(_0x1651a1){if(_0x1651a1){return _0x2936d4[_0x7571('0x1b')](_0x15161b);}return _0x2936d4[_0x7571('0x1c')](_0x15161b)['end']();};}function respondWithResult(_0x31de0a,_0xe0da3){_0xe0da3=_0xe0da3||0xc8;return function(_0xb56b6d){if(_0xb56b6d){return _0x31de0a[_0x7571('0x1c')](_0xe0da3)[_0x7571('0x1d')](_0xb56b6d);}};}function respondWithFilteredResult(_0x2817f6,_0x21e8b6){return function(_0x1f3c62){if(_0x1f3c62){var _0x4f3f83=typeof _0x21e8b6[_0x7571('0x1e')]===_0x7571('0x1f')&&typeof _0x21e8b6[_0x7571('0x20')]===_0x7571('0x1f');var _0x44e34f=_0x1f3c62['count'];var _0x7fb7e7=_0x4f3f83?0x0:_0x21e8b6['offset'];var _0x5ad433=_0x4f3f83?_0x1f3c62[_0x7571('0x21')]:_0x21e8b6['offset']+_0x21e8b6[_0x7571('0x20')];var _0x533f86;if(_0x5ad433>=_0x44e34f){_0x5ad433=_0x44e34f;_0x533f86=0xc8;}else{_0x533f86=0xce;}_0x2817f6[_0x7571('0x1c')](_0x533f86);return _0x2817f6[_0x7571('0x22')](_0x7571('0x23'),_0x7fb7e7+'-'+_0x5ad433+'/'+_0x44e34f)[_0x7571('0x1d')](_0x1f3c62);}return null;};}function patchUpdates(_0x9142a8){return function(_0x12f81c){try{jsonpatch['apply'](_0x12f81c,_0x9142a8,!![]);}catch(_0x9e64ac){return BPromise[_0x7571('0x24')](_0x9e64ac);}return _0x12f81c[_0x7571('0x25')]();};}function saveUpdates(_0xc34183,_0x184395){return function(_0x18cdf8){if(_0x18cdf8){return _0x18cdf8[_0x7571('0x26')](_0xc34183)['then'](function(_0x2e7e78){return _0x2e7e78;});}return null;};}function removeEntity(_0x349eec,_0x532567){return function(_0x47afdd){if(_0x47afdd){return _0x47afdd['destroy']()[_0x7571('0x27')](function(){_0x349eec[_0x7571('0x1c')](0xcc)[_0x7571('0x28')]();});}};}function handleEntityNotFound(_0x43d274,_0x2f6ffa){return function(_0x5b337b){if(!_0x5b337b){_0x43d274[_0x7571('0x1b')](0x194);}return _0x5b337b;};}function handleError(_0xe0bb71,_0x59123a){_0x59123a=_0x59123a||0x1f4;return function(_0x25c21e){logger[_0x7571('0x29')](_0x25c21e[_0x7571('0x2a')]);if(_0x25c21e[_0x7571('0x2b')]){delete _0x25c21e[_0x7571('0x2b')];}_0xe0bb71[_0x7571('0x1c')](_0x59123a)['send'](_0x25c21e);};}exports[_0x7571('0x2c')]=function(_0x277278,_0x564777){var _0x3df5e1={},_0x52ca89={},_0x44bda1={'count':0x0,'rows':[]};var _0xcd931a=_[_0x7571('0x2d')](db[_0x7571('0x2e')][_0x7571('0x2f')],function(_0x2b01fc){return{'name':_0x2b01fc[_0x7571('0x30')],'type':_0x2b01fc['type'][_0x7571('0x31')]};});_0x52ca89[_0x7571('0x32')]=_[_0x7571('0x2d')](_0xcd931a,_0x7571('0x2b'));_0x52ca89['query']=_[_0x7571('0x33')](_0x277278['query']);_0x52ca89[_0x7571('0x34')]=_['intersection'](_0x52ca89[_0x7571('0x32')],_0x52ca89[_0x7571('0x35')]);_0x3df5e1[_0x7571('0x36')]=_[_0x7571('0x37')](_0x52ca89[_0x7571('0x32')],qs[_0x7571('0x38')](_0x277278[_0x7571('0x35')]['fields']));_0x3df5e1[_0x7571('0x36')]=_0x3df5e1[_0x7571('0x36')]['length']?_0x3df5e1['attributes']:_0x52ca89[_0x7571('0x32')];if(!_0x277278[_0x7571('0x35')][_0x7571('0x39')](_0x7571('0x3a'))){_0x3df5e1[_0x7571('0x20')]=qs[_0x7571('0x20')](_0x277278[_0x7571('0x35')][_0x7571('0x20')]);_0x3df5e1[_0x7571('0x1e')]=qs[_0x7571('0x1e')](_0x277278['query'][_0x7571('0x1e')]);}_0x3df5e1['order']=qs[_0x7571('0x3b')](_0x277278[_0x7571('0x35')]['sort']);_0x3df5e1[_0x7571('0x3c')]=qs[_0x7571('0x34')](_[_0x7571('0x3d')](_0x277278[_0x7571('0x35')],_0x52ca89[_0x7571('0x34')]),_0xcd931a);if(_0x277278[_0x7571('0x35')][_0x7571('0x3e')]){_0x3df5e1[_0x7571('0x3c')]=_[_0x7571('0x3f')](_0x3df5e1[_0x7571('0x3c')],{'$or':_[_0x7571('0x2d')](_0xcd931a,function(_0x24e659){if(_0x24e659[_0x7571('0x40')]!==_0x7571('0x41')){var _0x491bd6={};_0x491bd6[_0x24e659['name']]={'$like':'%'+_0x277278['query'][_0x7571('0x3e')]+'%'};return _0x491bd6;}})});}_0x3df5e1=_[_0x7571('0x3f')]({},_0x3df5e1,_0x277278[_0x7571('0x42')]);var _0x5357b4={'where':_0x3df5e1[_0x7571('0x3c')]};return db[_0x7571('0x2e')]['count'](_0x5357b4)['then'](function(_0x4706c8){_0x44bda1[_0x7571('0x21')]=_0x4706c8;if(_0x277278[_0x7571('0x35')][_0x7571('0x43')]){_0x3df5e1[_0x7571('0x44')]=[{'all':!![]}];}return db[_0x7571('0x2e')]['findAll'](_0x3df5e1);})[_0x7571('0x27')](function(_0x2e14f3){_0x44bda1['rows']=_0x2e14f3;return _0x44bda1;})['then'](respondWithFilteredResult(_0x564777,_0x3df5e1))[_0x7571('0x45')](handleError(_0x564777,null));};exports[_0x7571('0x46')]=function(_0x72a996,_0x1fd709){var _0x43a34a={'raw':!![],'where':{'id':_0x72a996[_0x7571('0x47')]['id']}},_0x5166f2={};_0x5166f2['model']=_[_0x7571('0x33')](db[_0x7571('0x2e')][_0x7571('0x2f')]);_0x5166f2[_0x7571('0x35')]=_['keys'](_0x72a996['query']);_0x5166f2['filters']=_['intersection'](_0x5166f2['model'],_0x5166f2['query']);_0x43a34a[_0x7571('0x36')]=_[_0x7571('0x37')](_0x5166f2['model'],qs[_0x7571('0x38')](_0x72a996[_0x7571('0x35')][_0x7571('0x38')]));_0x43a34a['attributes']=_0x43a34a[_0x7571('0x36')][_0x7571('0x48')]?_0x43a34a['attributes']:_0x5166f2[_0x7571('0x32')];if(_0x72a996['query'][_0x7571('0x43')]){_0x43a34a[_0x7571('0x44')]=[{'all':!![]}];}_0x43a34a=_[_0x7571('0x3f')]({},_0x43a34a,_0x72a996[_0x7571('0x42')]);return db[_0x7571('0x2e')][_0x7571('0x49')](_0x43a34a)[_0x7571('0x27')](handleEntityNotFound(_0x1fd709,null))[_0x7571('0x27')](respondWithResult(_0x1fd709,null))['catch'](handleError(_0x1fd709,null));};exports[_0x7571('0x4a')]=function(_0x3a9306,_0x491b85){return db[_0x7571('0x2e')]['create'](_0x3a9306['body'],{})['then'](respondWithResult(_0x491b85,0xc9))[_0x7571('0x45')](handleError(_0x491b85,null));};exports[_0x7571('0x26')]=function(_0x245d24,_0x4d689b){if(_0x245d24[_0x7571('0x4b')]['id']){delete _0x245d24['body']['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x245d24[_0x7571('0x47')]['id']}})[_0x7571('0x27')](handleEntityNotFound(_0x4d689b,null))['then'](saveUpdates(_0x245d24[_0x7571('0x4b')],null))[_0x7571('0x27')](respondWithResult(_0x4d689b,null))['catch'](handleError(_0x4d689b,null));};exports[_0x7571('0x4c')]=function(_0x1146a2,_0x2af3b2){return db[_0x7571('0x2e')][_0x7571('0x49')]({'where':{'id':_0x1146a2[_0x7571('0x47')]['id']}})[_0x7571('0x27')](handleEntityNotFound(_0x2af3b2,null))[_0x7571('0x27')](removeEntity(_0x2af3b2,null))[_0x7571('0x45')](handleError(_0x2af3b2,null));};exports[_0x7571('0x4d')]=function(_0x1d6b84,_0x93b565){return db[_0x7571('0x2e')][_0x7571('0x4d')]()['then'](respondWithResult(_0x93b565,null))[_0x7571('0x45')](handleError(_0x93b565,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3ac0cb2..5c8b4dd 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 _0x9da4=['../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x9da4,0xfe));var _0x49da=function(_0x5e583c,_0x191b41){_0x5e583c=_0x5e583c-0x0;var _0x2b333a=_0x9da4[_0x5e583c];return _0x2b333a;};'use strict';var _=require(_0x49da('0x0'));var util=require('util');var logger=require(_0x49da('0x1'))(_0x49da('0x2'));var moment=require(_0x49da('0x3'));var BPromise=require(_0x49da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x49da('0x5'));var config=require(_0x49da('0x6'));var attributes=require(_0x49da('0x7'));module[_0x49da('0x8')]=function(_0x209c35,_0x48f866){return _0x209c35[_0x49da('0x9')](_0x49da('0xa'),attributes,{'tableName':_0x49da('0xb'),'paranoid':![],'indexes':[{'name':_0x49da('0xc'),'fields':[_0x49da('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x536a=['moment','bluebird','rimraf','./chatTransferReport.attributes','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x26879c,_0x1eb426){var _0x5778eb=function(_0x329c73){while(--_0x329c73){_0x26879c['push'](_0x26879c['shift']());}};_0x5778eb(++_0x1eb426);}(_0x536a,0xc4));var _0xa536=function(_0x29a914,_0x28f274){_0x29a914=_0x29a914-0x0;var _0x4235f6=_0x536a[_0x29a914];return _0x4235f6;};'use strict';var _=require(_0xa536('0x0'));var util=require(_0xa536('0x1'));var logger=require(_0xa536('0x2'))(_0xa536('0x3'));var moment=require(_0xa536('0x4'));var BPromise=require(_0xa536('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa536('0x6'));var config=require('../../config/environment');var attributes=require(_0xa536('0x7'));module['exports']=function(_0x1c5810,_0x3c8aa5){return _0x1c5810[_0xa536('0x8')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xa536('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 240c0d7..b57e2e8 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 _0x93da=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x93da,0xb7));var _0xa93d=function(_0x487654,_0x1782aa){_0x487654=_0x487654-0x0;var _0x31b87a=_0x93da[_0x487654];return _0x31b87a;};'use strict';var _=require(_0xa93d('0x0'));var util=require(_0xa93d('0x1'));var moment=require(_0xa93d('0x2'));var BPromise=require('bluebird');var rs=require(_0xa93d('0x3'));var fs=require('fs');var Redis=require(_0xa93d('0x4'));var db=require(_0xa93d('0x5'))['db'];var utils=require(_0xa93d('0x6'));var logger=require(_0xa93d('0x7'))(_0xa93d('0x8'));var config=require(_0xa93d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa93d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df133,_0x1941de,_0x47e1c2){return new BPromise(function(_0x59d214,_0x5d7d3b){return client[_0xa93d('0xb')](_0x2df133,_0x47e1c2)[_0xa93d('0xc')](function(_0x441ba7){logger[_0xa93d('0xd')](_0xa93d('0xe'),_0x1941de,_0xa93d('0xf'));logger[_0xa93d('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x1941de,_0xa93d('0xf'),JSON[_0xa93d('0x11')](_0x441ba7));if(_0x441ba7['error']){if(_0x441ba7[_0xa93d('0x12')][_0xa93d('0x13')]===0x1f4){logger[_0xa93d('0x12')](_0xa93d('0xe'),_0x1941de,_0x441ba7[_0xa93d('0x12')][_0xa93d('0x14')]);return _0x5d7d3b(_0x441ba7[_0xa93d('0x12')][_0xa93d('0x14')]);}logger[_0xa93d('0x12')](_0xa93d('0xe'),_0x1941de,_0x441ba7[_0xa93d('0x12')][_0xa93d('0x14')]);return _0x59d214(_0x441ba7[_0xa93d('0x12')][_0xa93d('0x14')]);}else{logger[_0xa93d('0xd')](_0xa93d('0xe'),_0x1941de,'request\x20sent');_0x59d214(_0x441ba7[_0xa93d('0x15')][_0xa93d('0x14')]);}})[_0xa93d('0x16')](function(_0x5eea27){logger[_0xa93d('0x12')](_0xa93d('0xe'),_0x1941de,_0x5eea27);_0x5d7d3b(_0x5eea27);});});} \ No newline at end of file +var _0x832b=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0x832b,0x8a));var _0xb832=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x832b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb832('0x0'));var util=require(_0xb832('0x1'));var moment=require(_0xb832('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb832('0x3'));var db=require(_0xb832('0x4'))['db'];var utils=require(_0xb832('0x5'));var logger=require(_0xb832('0x6'))(_0xb832('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb832('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4dbd,_0x26c2f8,_0x56f98a){return new BPromise(function(_0xe9feaa,_0x381c5e){return client['request'](_0x1b4dbd,_0x56f98a)[_0xb832('0x9')](function(_0x5e325f){logger[_0xb832('0xa')](_0xb832('0xb'),_0x26c2f8,_0xb832('0xc'));logger[_0xb832('0xd')](_0xb832('0xe'),_0x26c2f8,_0xb832('0xc'),JSON['stringify'](_0x5e325f));if(_0x5e325f['error']){if(_0x5e325f[_0xb832('0xf')][_0xb832('0x10')]===0x1f4){logger[_0xb832('0xf')](_0xb832('0xb'),_0x26c2f8,_0x5e325f[_0xb832('0xf')][_0xb832('0x11')]);return _0x381c5e(_0x5e325f['error'][_0xb832('0x11')]);}logger[_0xb832('0xf')](_0xb832('0xb'),_0x26c2f8,_0x5e325f[_0xb832('0xf')][_0xb832('0x11')]);return _0xe9feaa(_0x5e325f[_0xb832('0xf')][_0xb832('0x11')]);}else{logger[_0xb832('0xa')](_0xb832('0xb'),_0x26c2f8,_0xb832('0xc'));_0xe9feaa(_0x5e325f[_0xb832('0x12')][_0xb832('0x11')]);}})[_0xb832('0x13')](function(_0x159bff){logger['error'](_0xb832('0xb'),_0x26c2f8,_0x159bff);_0x381c5e(_0x159bff);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1ebeb8d..b21dd22 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 _0xe57c=['./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe57c,0x91));var _0xce57=function(_0x4bbf1a,_0x338546){_0x4bbf1a=_0x4bbf1a-0x0;var _0x1c489a=_0xe57c[_0x4bbf1a];return _0x1c489a;};'use strict';var multer=require(_0xce57('0x0'));var util=require(_0xce57('0x1'));var path=require('path');var timeout=require(_0xce57('0x2'));var express=require('express');var router=express[_0xce57('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xce57('0x4'));var interaction=require(_0xce57('0x5'));var config=require(_0xce57('0x6'));var controller=require(_0xce57('0x7'));router[_0xce57('0x8')]('/',auth[_0xce57('0x9')](),controller[_0xce57('0xa')]);router[_0xce57('0x8')](_0xce57('0xb'),auth[_0xce57('0x9')](),controller['describe']);router[_0xce57('0x8')](_0xce57('0xc'),auth[_0xce57('0x9')](),controller[_0xce57('0xd')]);router['post']('/',auth[_0xce57('0x9')](),controller[_0xce57('0xe')]);router[_0xce57('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xce57('0x10')]('/:id',auth[_0xce57('0x9')](),controller[_0xce57('0x11')]);module[_0xce57('0x12')]=router; \ No newline at end of file +var _0x30f8=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update','delete','destroy'];(function(_0x3e51e4,_0x9c5527){var _0x736e00=function(_0x139245){while(--_0x139245){_0x3e51e4['push'](_0x3e51e4['shift']());}};_0x736e00(++_0x9c5527);}(_0x30f8,0xb5));var _0x830f=function(_0x482dd9,_0x4ec5e5){_0x482dd9=_0x482dd9-0x0;var _0xbb957c=_0x30f8[_0x482dd9];return _0xbb957c;};'use strict';var multer=require(_0x830f('0x0'));var util=require(_0x830f('0x1'));var path=require(_0x830f('0x2'));var timeout=require('connect-timeout');var express=require(_0x830f('0x3'));var router=express[_0x830f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x830f('0x5'));var interaction=require(_0x830f('0x6'));var config=require(_0x830f('0x7'));var controller=require(_0x830f('0x8'));router[_0x830f('0x9')]('/',auth[_0x830f('0xa')](),controller[_0x830f('0xb')]);router['get'](_0x830f('0xc'),auth['isAuthenticated'](),controller[_0x830f('0xd')]);router[_0x830f('0x9')](_0x830f('0xe'),auth[_0x830f('0xa')](),controller['show']);router[_0x830f('0xf')]('/',auth[_0x830f('0xa')](),controller['create']);router['put'](_0x830f('0xe'),auth[_0x830f('0xa')](),controller[_0x830f('0x10')]);router[_0x830f('0x11')](_0x830f('0xe'),auth['isAuthenticated'](),controller[_0x830f('0x12')]);module[_0x830f('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 6eaca4b..d543f74 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 _0xadc6=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','star','thumb','name','text','email','getDataValue','onlineForm','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System'];(function(_0x188e7e,_0xf6325c){var _0xf95a4f=function(_0x1455d2){while(--_0x1455d2){_0x188e7e['push'](_0x188e7e['shift']());}};_0xf95a4f(++_0xf6325c);}(_0xadc6,0x1d8));var _0x6adc=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xadc6[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0x6adc('0x0'));var rs=require(_0x6adc('0x1'));module[_0x6adc('0x2')]={'name':{'type':Sequelize[_0x6adc('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x6adc('0x3')],'allowNull':![],'unique':_0x6adc('0x4')},'description':{'type':Sequelize[_0x6adc('0x3')]},'mapKey':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x5')},'customerAlias':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6adc('0x3')],'allowNull':![],'defaultValue':_0x6adc('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6adc('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6adc('0x3')],'allowNull':![],'defaultValue':_0x6adc('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6adc('0x3')],'allowNull':![],'defaultValue':_0x6adc('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6adc('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6adc('0x3')]},'animation':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6adc('0xa')](_0x6adc('0xb'),_0x6adc('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0xd')},'start_chat_button':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0xf')},'download_transcript':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6adc('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6adc('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x6adc('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6adc('0x14')},'placeholderMessage':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x15')},'closingMessage':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x16')},'closingMessageButton':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x17')},'skipMessageButton':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x18')},'conditionAgreement':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x6adc('0x19'),_0x6adc('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x6adc('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6adc('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6adc('0x1b'),'type':_0x6adc('0x1c'),'required':!![]},'props':{'title':_0x6adc('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0x6adc('0x1d'),'helpText':''},'config':{'required':!![],'placeholder':_0x6adc('0x1d'),'type':_0x6adc('0x1d')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6adc('0x1e')]('onlineForm')?JSON['parse'](this['getDataValue'](_0x6adc('0x1f'))):{};},'set':function(_0x372502){return this[_0x6adc('0x20')](_0x6adc('0x1f'),JSON[_0x6adc('0x21')](_0x372502));}},'offlineForm':{'type':Sequelize[_0x6adc('0x11')],'defaultValue':function(){return JSON[_0x6adc('0x21')]({'items':[{'type':'input','props':{'title':_0x6adc('0x1d'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6adc('0x1d')},'variable':null},{'type':'textarea','config':{'placeholder':_0x6adc('0x22')},'props':{'title':_0x6adc('0x22'),'helpText':_0x6adc('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x6adc('0x1e')](_0x6adc('0x24'))?JSON['parse'](this['getDataValue'](_0x6adc('0x24'))):{};},'set':function(_0x4be586){return this[_0x6adc('0x20')]('offlineForm',JSON[_0x6adc('0x21')](_0x4be586));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6adc('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6adc('0x3')]},'forwardOffline':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6adc('0x3')]},'waitingTitle':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x26')},'waitingMessage':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x28')},'offlineMessageBody':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x29')},'skipUnmanaged':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x18')},'sendUnmanaged':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x17')},'enableCustomerAttachment':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6adc('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6adc('0x11')],'defaultValue':function(){return _0x6adc('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6adc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6adc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x6adc('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x2c')},'messagesAlignment':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6adc('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6adc('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6adc('0x3')],'allowNull':![],'defaultValue':_0x6adc('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6adc('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':_0x6adc('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6adc('0x8')],'comment':_0x6adc('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5b4343){if(!_0x5b4343)this[_0x6adc('0x20')](_0x6adc('0x31'),null);this[_0x6adc('0x20')](_0x6adc('0x32'),_0x5b4343);}},'vidaooEscalation':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6adc('0x3')]},'vidaooTopic':{'type':Sequelize[_0x6adc('0x3')],'allowNull':![],'defaultValue':_0x6adc('0x33')},'vidaooNote':{'type':Sequelize[_0x6adc('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x6adc('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6adc('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6adc('0x11')]}}; \ No newline at end of file +var _0xf3d8=['website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf3d8,0x161));var _0x8f3d=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0xf3d8[_0x265003];return _0x33c743;};'use strict';var Sequelize=require(_0x8f3d('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x8f3d('0x1')],'allowNull':![],'unique':_0x8f3d('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x3')},'mapKeyOffline':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x4')},'customerAlias':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8f3d('0x1')],'allowNull':![],'defaultValue':_0x8f3d('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x8f3d('0x1')],'allowNull':![],'defaultValue':_0x8f3d('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8f3d('0x1')],'allowNull':![],'defaultValue':_0x8f3d('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x8f3d('0x1')],'allowNull':![],'defaultValue':_0x8f3d('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x8f3d('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x8f3d('0x1')]},'animation':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x8f3d('0x9'),_0x8f3d('0xa')),'defaultValue':_0x8f3d('0x9')},'header_online':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8f3d('0xb')},'offline_chat_button':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0xc')},'header_offline':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8f3d('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x11')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8f3d('0x12')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8f3d('0xc')},'skipMessageButton':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x13')},'conditionAgreement':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x14')},'ratingType':{'type':Sequelize['ENUM'](_0x8f3d('0x15'),_0x8f3d('0x16')),'defaultValue':_0x8f3d('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x8f3d('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8f3d('0x17')],'defaultValue':function(){return JSON[_0x8f3d('0x18')]({'items':[{'type':_0x8f3d('0x19'),'variable':null,'config':{'placeholder':_0x8f3d('0x1a'),'type':'text','required':!![]},'props':{'title':_0x8f3d('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0x8f3d('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x8f3d('0x3'),'type':_0x8f3d('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8f3d('0x1b')](_0x8f3d('0x1c'))?JSON[_0x8f3d('0x1d')](this[_0x8f3d('0x1b')](_0x8f3d('0x1c'))):{};},'set':function(_0x399d6d){return this[_0x8f3d('0x1e')](_0x8f3d('0x1c'),JSON[_0x8f3d('0x18')](_0x399d6d));}},'offlineForm':{'type':Sequelize[_0x8f3d('0x17')],'defaultValue':function(){return JSON[_0x8f3d('0x18')]({'items':[{'type':_0x8f3d('0x19'),'props':{'title':_0x8f3d('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x8f3d('0x3')},'variable':null},{'type':_0x8f3d('0x1f'),'config':{'placeholder':_0x8f3d('0x20')},'props':{'title':_0x8f3d('0x20'),'helpText':_0x8f3d('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x8f3d('0x1b')](_0x8f3d('0x22'))?JSON[_0x8f3d('0x1d')](this[_0x8f3d('0x1b')](_0x8f3d('0x22'))):{};},'set':function(_0xc9e607){return this['setDataValue'](_0x8f3d('0x22'),JSON[_0x8f3d('0x18')](_0xc9e607));}},'token':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':function(){return rs[_0x8f3d('0x23')]();}},'autoclose':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8f3d('0x1')]},'forwardOffline':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x8f3d('0x13')},'sendUnmanaged':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8f3d('0x17')]},'showAgentAvatar':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8f3d('0x1')]},'notificationTemplate':{'type':Sequelize[_0x8f3d('0x17')],'defaultValue':function(){return _0x8f3d('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x8f3d('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f3d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8f3d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x28')},'verticalAlignment':{'type':Sequelize[_0x8f3d('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x8f3d('0x29')},'messagesAlignment':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x2a')},'defaultTitle':{'type':Sequelize[_0x8f3d('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8f3d('0x1')],'allowNull':![],'defaultValue':_0x8f3d('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8f3d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8f3d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':_0x8f3d('0x2c')},'systemAvatar':{'type':Sequelize[_0x8f3d('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8f3d('0x2d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x15d4df){if(!_0x15d4df)this[_0x8f3d('0x1e')](_0x8f3d('0x2e'),null);this[_0x8f3d('0x1e')](_0x8f3d('0x2f'),_0x15d4df);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x8f3d('0x1')],'allowNull':![],'defaultValue':_0x8f3d('0x30')},'vidaooNote':{'type':Sequelize[_0x8f3d('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x8f3d('0x17')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8f3d('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8f3d('0x17')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 4da95e1..1234641 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 _0x5e55=['Contact','Owner','fullname','Tag','Tags','tag','getSnippet','increment','chatLicenseExceeded','timezone','ifTime','server/files/chat/iframe.ejs','3.9.0','origin','replace','remote','x-real-ip','remoteAddress','alignment','color','labelText','textColor','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','lodash','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIOutOfIntervalError','handleError','APIConflictError','URL','redis','defaults','localhost','socket.io-emitter','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','undefined','count','Content-Range','json','update','destroy','get','ChatWebsites','UserProfileResource','end','stack','send','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','name','version','format','%s\x20%s','unknown','model','device','vendor','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','include','find','create','testWildcardValidity','address','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','order','ChatWebsiteId','rows','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/','download','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','updatedAt','includes','createdAt','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','DESC','ChatApplication','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','Applications','priority','asc','list','ListId','Contacts','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','queueId','unshift','waitForTheAssignedQueue','Start','startRouting','EventManager','files','Sequelize','ValidationError','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','offline-chat','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions'];(function(_0x41007d,_0x3a338e){var _0x51c71d=function(_0x4255d4){while(--_0x4255d4){_0x41007d['push'](_0x41007d['shift']());}};_0x51c71d(++_0x3a338e);}(_0x5e55,0x15e));var _0x55e5=function(_0x2de5a4,_0x1256d3){_0x2de5a4=_0x2de5a4-0x0;var _0x48a713=_0x5e55[_0x2de5a4];return _0x48a713;};'use strict';var Mustache=require(_0x55e5('0x0'));var util=require(_0x55e5('0x1'));var path=require('path');var ejs=require(_0x55e5('0x2'));var fs=require('fs');var fs_extra=require(_0x55e5('0x3'));var _=require(_0x55e5('0x4'));var querystring=require('querystring');var htmlToText=require(_0x55e5('0x5'));var Redis=require(_0x55e5('0x6'));var jayson=require('jayson/promise');var qs=require(_0x55e5('0x7'));var logger=require(_0x55e5('0x8'))('api');var config=require(_0x55e5('0x9'));var APIBadRequestError=require(_0x55e5('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0x55e5('0xa'))['APINotFoundError'];var APIOutOfIntervalError=require(_0x55e5('0xa'))[_0x55e5('0xb')];var APIHandleError=require(_0x55e5('0xa'))[_0x55e5('0xc')];var APIConflictError=require(_0x55e5('0xa'))[_0x55e5('0xd')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require('url')[_0x55e5('0xe')];var db=require('../../mysqldb')['db'];config[_0x55e5('0xf')]=_[_0x55e5('0x10')](config[_0x55e5('0xf')],{'host':_0x55e5('0x11'),'port':0x18eb});var socket=require(_0x55e5('0x12'))(new Redis(config[_0x55e5('0xf')]));require('./chatWebsite.socket')['register'](socket);var client=jayson['client'][_0x55e5('0x13')]({'port':0x232c});var client9002=jayson[_0x55e5('0x14')]['http']({'port':0x232a});var client9003=jayson[_0x55e5('0x14')][_0x55e5('0x13')]({'port':0x232b});var client9001=jayson[_0x55e5('0x14')]['http']({'port':0x2329});function respondWithRpcPromise(_0x419e5b,_0x318c96,_0x429af4,_0x151bda){return new Promise(function(_0x575d77,_0x4e7628){var _0x3c330c=_0x151bda||client;return _0x3c330c[_0x55e5('0x15')](_0x419e5b,_0x429af4)[_0x55e5('0x16')](function(_0x1c6b72){logger[_0x55e5('0x17')](_0x55e5('0x18'),_0x318c96,_0x55e5('0x19'));logger[_0x55e5('0x1a')](_0x55e5('0x1b'),_0x318c96,'request\x20sent',JSON[_0x55e5('0x1c')](_0x1c6b72));if(_0x1c6b72['error']){if(_0x1c6b72[_0x55e5('0x1d')][_0x55e5('0x1e')]===0x1f4){logger[_0x55e5('0x1d')](_0x55e5('0x18'),_0x318c96,_0x1c6b72[_0x55e5('0x1d')][_0x55e5('0x1f')]);return _0x4e7628(_0x1c6b72[_0x55e5('0x1d')][_0x55e5('0x1f')]);}logger[_0x55e5('0x1d')](_0x55e5('0x18'),_0x318c96,_0x1c6b72[_0x55e5('0x1d')][_0x55e5('0x1f')]);return _0x575d77(_0x1c6b72[_0x55e5('0x1d')]['message']);}else{logger['info'](_0x55e5('0x18'),_0x318c96,_0x55e5('0x19'));_0x575d77(_0x1c6b72[_0x55e5('0x20')][_0x55e5('0x1f')]);}})[_0x55e5('0x21')](function(_0x18c485){logger[_0x55e5('0x1d')](_0x55e5('0x18'),_0x318c96,_0x18c485);_0x4e7628(_0x18c485);});});}function respondWithStatusCode(_0x590957,_0x1f56fe){_0x1f56fe=_0x1f56fe||0xcc;return function(_0x1990a9){if(_0x1990a9){return _0x590957[_0x55e5('0x22')](_0x1f56fe);}return _0x590957[_0x55e5('0x23')](_0x1f56fe)['end']();};}function respondWithResult(_0x22dd85,_0x5651b0){_0x5651b0=_0x5651b0||0xc8;return function(_0x51269e){if(_0x51269e){return _0x22dd85[_0x55e5('0x23')](_0x5651b0)['json'](_0x51269e);}};}function respondWithFilteredResult(_0x28ba3b,_0x1a8412){return function(_0x45252b){if(_0x45252b){var _0x499081=typeof _0x1a8412[_0x55e5('0x24')]==='undefined'&&typeof _0x1a8412[_0x55e5('0x25')]===_0x55e5('0x26');var _0x1b1c39=_0x45252b[_0x55e5('0x27')];var _0x1492c8=_0x499081?0x0:_0x1a8412[_0x55e5('0x24')];var _0x1f11c8=_0x499081?_0x45252b[_0x55e5('0x27')]:_0x1a8412[_0x55e5('0x24')]+_0x1a8412['limit'];var _0x23e7bf;if(_0x1f11c8>=_0x1b1c39){_0x1f11c8=_0x1b1c39;_0x23e7bf=0xc8;}else{_0x23e7bf=0xce;}_0x28ba3b[_0x55e5('0x23')](_0x23e7bf);return _0x28ba3b['set'](_0x55e5('0x28'),_0x1492c8+'-'+_0x1f11c8+'/'+_0x1b1c39)[_0x55e5('0x29')](_0x45252b);}return null;};}function saveUpdates(_0x230b8e){return function(_0x2a5cf5){if(_0x2a5cf5){return _0x2a5cf5[_0x55e5('0x2a')](_0x230b8e)[_0x55e5('0x16')](function(_0x259942){return _0x259942;});}return null;};}function removeEntity(_0x45bb37){return function(_0x23aca5){if(_0x23aca5){return _0x23aca5[_0x55e5('0x2b')]()[_0x55e5('0x16')](function(){var _0x6851f2=_0x23aca5[_0x55e5('0x2c')]({'plain':!![]});var _0x45b87c=_0x55e5('0x2d');return db[_0x55e5('0x2e')][_0x55e5('0x2b')]({'where':{'type':_0x45b87c,'resourceId':_0x6851f2['id']}})[_0x55e5('0x16')](function(){return _0x23aca5;});})[_0x55e5('0x16')](function(){_0x45bb37[_0x55e5('0x23')](0xcc)[_0x55e5('0x2f')]();});}};}function handleEntityNotFound(_0x463105){return function(_0x1d858c){if(!_0x1d858c){_0x463105[_0x55e5('0x22')](0x194);}return _0x1d858c;};}function handleError(_0xba0900,_0x1cfaf3){_0x1cfaf3=_0x1cfaf3||0x1f4;return function(_0x597b34){logger[_0x55e5('0x1d')](_0x597b34[_0x55e5('0x30')]);if(_0x597b34['name']){delete _0x597b34['name'];}_0xba0900[_0x55e5('0x23')](_0x1cfaf3)[_0x55e5('0x31')](_0x597b34);};}function createInteractionObject(_0x15a7ca,_0x23ac06,_0x5766bb,_0x17e4dc){var _0x4b8c41=require(_0x55e5('0x32'));var _0x19753b=new _0x4b8c41();var _0x3e3c75=_0x19753b[_0x55e5('0x33')](_0x5766bb[_0x55e5('0x34')])['getResult']();var _0x32aa04=_0x23ac06[_0x55e5('0x35')];if(_0x5766bb[_0x55e5('0x36')]){_0x32aa04=_0x5766bb[_0x55e5('0x36')];}else if(_0x5766bb['x-forwarded-for']){_0x32aa04=_['first'](_0x5766bb[_0x55e5('0x37')][_0x55e5('0x38')](','));}return{'ContactId':_0x17e4dc['id'],'ChatWebsiteId':_0x15a7ca,'from':(_0x17e4dc[_0x55e5('0x39')]||'')+'\x20'+(_0x17e4dc[_0x55e5('0x3a')]||''),'customerIp':_0x32aa04,'customerPort':_0x5766bb[_0x55e5('0x3b')]?_0x5766bb[_0x55e5('0x3b')]:null,'referer':_0x23ac06[_0x55e5('0x3c')],'browserName':_0x3e3c75[_0x55e5('0x3d')][_0x55e5('0x3e')]&&_0x3e3c75[_0x55e5('0x3d')][_0x55e5('0x3f')]?util[_0x55e5('0x40')](_0x55e5('0x41'),_0x3e3c75[_0x55e5('0x3d')][_0x55e5('0x3e')],_0x3e3c75[_0x55e5('0x3d')][_0x55e5('0x3f')]):_0x55e5('0x42'),'browserVersion':_0x3e3c75[_0x55e5('0x3d')][_0x55e5('0x3f')]||_0x55e5('0x42'),'osName':util['format'](_0x55e5('0x41'),_0x3e3c75['os'][_0x55e5('0x3e')],_0x3e3c75['os'][_0x55e5('0x3f')]),'osVersion':_0x3e3c75['os'][_0x55e5('0x3f')],'deviceModel':_0x3e3c75['device'][_0x55e5('0x43')]&&_0x3e3c75[_0x55e5('0x44')][_0x55e5('0x45')]?util[_0x55e5('0x40')](_0x55e5('0x46'),_0x3e3c75[_0x55e5('0x44')]['model'],_0x3e3c75['device'][_0x55e5('0x45')],_0x3e3c75['device'][_0x55e5('0x47')]):null,'deviceVendor':_0x3e3c75['device'][_0x55e5('0x45')],'deviceType':_0x3e3c75[_0x55e5('0x44')][_0x55e5('0x47')],'formData':JSON['stringify'](_0x23ac06)};}exports['index']=function(_0xb306a8,_0x3d8570){var _0x16cd97={'include':[{'model':db[_0x55e5('0x48')],'as':_0x55e5('0x49')}]},_0x3f7cf7={},_0x13e88d={'count':0x0,'rows':[]};var _0x3d707e=_[_0x55e5('0x4a')](db[_0x55e5('0x4b')][_0x55e5('0x4c')],function(_0x5b5ba7){return{'name':_0x5b5ba7[_0x55e5('0x4d')],'type':_0x5b5ba7[_0x55e5('0x47')][_0x55e5('0x4e')]};});_0x3f7cf7[_0x55e5('0x43')]=_[_0x55e5('0x4a')](_0x3d707e,_0x55e5('0x3e'));_0x3f7cf7[_0x55e5('0x4f')]=_[_0x55e5('0x50')](_0xb306a8[_0x55e5('0x4f')]);_0x3f7cf7[_0x55e5('0x51')]=_[_0x55e5('0x52')](_0x3f7cf7['model'],_0x3f7cf7[_0x55e5('0x4f')]);_0x16cd97[_0x55e5('0x53')]=_[_0x55e5('0x52')](_0x3f7cf7[_0x55e5('0x43')],qs[_0x55e5('0x54')](_0xb306a8['query'][_0x55e5('0x54')]));_0x16cd97[_0x55e5('0x53')]=_0x16cd97['attributes'][_0x55e5('0x55')]?_0x16cd97[_0x55e5('0x53')]:_0x3f7cf7[_0x55e5('0x43')];if(!_0xb306a8['query'][_0x55e5('0x56')](_0x55e5('0x57'))){_0x16cd97['limit']=qs[_0x55e5('0x25')](_0xb306a8[_0x55e5('0x4f')][_0x55e5('0x25')]);_0x16cd97[_0x55e5('0x24')]=qs[_0x55e5('0x24')](_0xb306a8[_0x55e5('0x4f')]['offset']);}_0x16cd97['order']=qs[_0x55e5('0x58')](_0xb306a8['query'][_0x55e5('0x58')]);_0x16cd97[_0x55e5('0x59')]=qs[_0x55e5('0x51')](_[_0x55e5('0x5a')](_0xb306a8['query'],_0x3f7cf7['filters']),_0x3d707e);if(_0xb306a8[_0x55e5('0x4f')][_0x55e5('0x5b')]){_0x16cd97[_0x55e5('0x59')]=_[_0x55e5('0x5c')](_0x16cd97[_0x55e5('0x59')],{'$or':_[_0x55e5('0x4a')](_0x3d707e,function(_0x54a23b){if(_0x54a23b[_0x55e5('0x47')]!==_0x55e5('0x5d')){var _0x2e361f={};_0x2e361f[_0x54a23b['name']]={'$like':'%'+_0xb306a8[_0x55e5('0x4f')][_0x55e5('0x5b')]+'%'};return _0x2e361f;}})});}_0x16cd97=_[_0x55e5('0x5c')]({},_0x16cd97,_0xb306a8[_0x55e5('0x5e')]);var _0x37aaff={'where':_0x16cd97[_0x55e5('0x59')]};return db['ChatWebsite'][_0x55e5('0x27')](_0x37aaff)['then'](function(_0x172247){_0x13e88d[_0x55e5('0x27')]=_0x172247;if(_0xb306a8[_0x55e5('0x4f')][_0x55e5('0x5f')]){_0x16cd97['include']=[{'all':!![]}];}return db[_0x55e5('0x4b')][_0x55e5('0x60')](_0x16cd97);})[_0x55e5('0x16')](function(_0x4ca930){_0x13e88d['rows']=_0x4ca930;return _0x13e88d;})[_0x55e5('0x16')](respondWithFilteredResult(_0x3d8570,_0x16cd97))[_0x55e5('0x21')](handleError(_0x3d8570,null));};exports['show']=function(_0x5033fa,_0x459631){var _0xedd4e7={'raw':![],'where':{'id':_0x5033fa[_0x55e5('0x61')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xe90f3f={};_0xe90f3f[_0x55e5('0x43')]=_[_0x55e5('0x50')](db[_0x55e5('0x4b')][_0x55e5('0x4c')]);_0xe90f3f[_0x55e5('0x4f')]=_[_0x55e5('0x50')](_0x5033fa[_0x55e5('0x4f')]);_0xe90f3f[_0x55e5('0x51')]=_['intersection'](_0xe90f3f[_0x55e5('0x43')],_0xe90f3f[_0x55e5('0x4f')]);_0xedd4e7[_0x55e5('0x53')]=_[_0x55e5('0x52')](_0xe90f3f['model'],qs['fields'](_0x5033fa[_0x55e5('0x4f')]['fields']));_0xedd4e7[_0x55e5('0x53')]=_0xedd4e7[_0x55e5('0x53')]['length']?_0xedd4e7['attributes']:_0xe90f3f['model'];if(_0x5033fa[_0x55e5('0x4f')][_0x55e5('0x5f')]){_0xedd4e7[_0x55e5('0x62')]=[{'all':!![]}];}_0xedd4e7=_[_0x55e5('0x5c')]({},_0xedd4e7,_0x5033fa[_0x55e5('0x5e')]);return db[_0x55e5('0x4b')][_0x55e5('0x63')](_0xedd4e7)['then'](handleEntityNotFound(_0x459631,null))['then'](respondWithResult(_0x459631,null))['catch'](handleError(_0x459631,null));};exports[_0x55e5('0x64')]=function(_0x47b35b,_0x5a0efa){if(!wildcardUtils[_0x55e5('0x65')](_0x47b35b['body'][_0x55e5('0x66')])){return handleError(_0x5a0efa,null)(new APIBadRequestError('\x22'+_0x47b35b['body'][_0x55e5('0x66')]+_0x55e5('0x67')));}return db[_0x55e5('0x4b')][_0x55e5('0x64')](_0x47b35b[_0x55e5('0x68')],{})[_0x55e5('0x16')](function(_0x2e4e3e){var _0x8d4550=_0x47b35b['user'][_0x55e5('0x2c')]({'plain':!![]});if(!_0x8d4550)throw new Error(_0x55e5('0x69'));if(_0x8d4550[_0x55e5('0x6a')]==='user'){var _0x492e30=_0x2e4e3e[_0x55e5('0x2c')]({'plain':!![]});var _0x2125ce=_0x55e5('0x2d');return db[_0x55e5('0x6b')][_0x55e5('0x63')]({'where':{'name':_0x2125ce,'userProfileId':_0x8d4550['userProfileId']},'raw':!![]})['then'](function(_0x4d4a86){if(_0x4d4a86&&_0x4d4a86[_0x55e5('0x6c')]===0x0){return db[_0x55e5('0x2e')][_0x55e5('0x64')]({'name':_0x492e30[_0x55e5('0x3e')],'resourceId':_0x492e30['id'],'type':_0x4d4a86[_0x55e5('0x3e')],'sectionId':_0x4d4a86['id']},{})[_0x55e5('0x16')](function(){return _0x2e4e3e;});}else{return _0x2e4e3e;}})[_0x55e5('0x21')](function(_0x4c8060){logger['error'](_0x55e5('0x6d'),_0x4c8060);throw _0x4c8060;});}return _0x2e4e3e;})[_0x55e5('0x16')](respondWithResult(_0x5a0efa,0xc9))[_0x55e5('0x21')](handleError(_0x5a0efa,null));};exports[_0x55e5('0x2a')]=function(_0x42b9da,_0x19fb9c){if(!wildcardUtils[_0x55e5('0x65')](_0x42b9da[_0x55e5('0x68')]['address'])){return handleError(_0x19fb9c,null)(new APIBadRequestError('\x22'+_0x42b9da[_0x55e5('0x68')]['address']+_0x55e5('0x67')));}if(_0x42b9da[_0x55e5('0x68')]['id']){delete _0x42b9da[_0x55e5('0x68')]['id'];}return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0x42b9da['params']['id']},'include':[{'model':db[_0x55e5('0x48')],'as':'mandatoryDispositionPause'}]})[_0x55e5('0x16')](handleEntityNotFound(_0x19fb9c,null))[_0x55e5('0x16')](saveUpdates(_0x42b9da['body'],null))['then'](respondWithResult(_0x19fb9c,null))[_0x55e5('0x21')](handleError(_0x19fb9c,null));};exports[_0x55e5('0x2b')]=function(_0x1b5db6,_0x3c6c62){return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0x1b5db6['params']['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x3c6c62,null))[_0x55e5('0x16')](removeEntity(_0x3c6c62,null))[_0x55e5('0x21')](handleError(_0x3c6c62,null));};exports[_0x55e5('0x6e')]=function(_0x435163,_0x2fb63f){return db['ChatWebsite']['describe']()[_0x55e5('0x16')](respondWithResult(_0x2fb63f,null))[_0x55e5('0x21')](handleError(_0x2fb63f,null));};exports['addDisposition']=function(_0x530365,_0x53dc85){if(_0x530365['body']['id']){delete _0x530365[_0x55e5('0x68')]['id'];}return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0x530365[_0x55e5('0x61')]['id']}})['then'](handleEntityNotFound(_0x53dc85,null))[_0x55e5('0x16')](function(_0x50303d){if(_0x50303d){_0x530365[_0x55e5('0x68')]['ChatWebsiteId']=_0x50303d['id'];return db[_0x55e5('0x6f')][_0x55e5('0x64')](_0x530365['body']);}})[_0x55e5('0x16')](respondWithResult(_0x53dc85,null))[_0x55e5('0x21')](handleError(_0x53dc85,null));};exports['getDispositions']=function(_0x3685cd,_0x5393d2){var _0x4b5ce2={'raw':![],'where':{}};var _0x2ece56={};var _0x546b86={'count':0x0,'rows':[]};return db[_0x55e5('0x4b')]['findOne']({'where':{'id':_0x3685cd[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x5393d2,null))[_0x55e5('0x16')](function(_0xd02ac8){if(_0xd02ac8){_0x2ece56['model']=_[_0x55e5('0x50')](db[_0x55e5('0x6f')]['rawAttributes']);_0x2ece56[_0x55e5('0x4f')]=_[_0x55e5('0x50')](_0x3685cd[_0x55e5('0x4f')]);_0x2ece56[_0x55e5('0x51')]=_['intersection'](_0x2ece56['model'],_0x2ece56[_0x55e5('0x4f')]);_0x4b5ce2['attributes']=_[_0x55e5('0x52')](_0x2ece56[_0x55e5('0x43')],qs[_0x55e5('0x54')](_0x3685cd[_0x55e5('0x4f')][_0x55e5('0x54')]));_0x4b5ce2[_0x55e5('0x53')]=_0x4b5ce2['attributes'][_0x55e5('0x55')]?_0x4b5ce2[_0x55e5('0x53')]:_0x2ece56[_0x55e5('0x43')];if(!_0x3685cd[_0x55e5('0x4f')][_0x55e5('0x56')](_0x55e5('0x57'))){_0x4b5ce2[_0x55e5('0x25')]=qs[_0x55e5('0x25')](_0x3685cd[_0x55e5('0x4f')][_0x55e5('0x25')]);_0x4b5ce2['offset']=qs[_0x55e5('0x24')](_0x3685cd['query'][_0x55e5('0x24')]);}_0x4b5ce2[_0x55e5('0x70')]=qs[_0x55e5('0x58')](_0x3685cd[_0x55e5('0x4f')][_0x55e5('0x58')]);_0x4b5ce2[_0x55e5('0x59')]=qs[_0x55e5('0x51')](_['pick'](_0x3685cd[_0x55e5('0x4f')],_0x2ece56[_0x55e5('0x51')]));_0x4b5ce2['where'][_0x55e5('0x71')]=_0xd02ac8['id'];if(_0x3685cd[_0x55e5('0x4f')]['filter']){_0x4b5ce2[_0x55e5('0x59')]=_[_0x55e5('0x5c')](_0x4b5ce2[_0x55e5('0x59')],{'$or':_[_0x55e5('0x4a')](_0x4b5ce2[_0x55e5('0x53')],function(_0xe5de3b){var _0xf2c29c={};_0xf2c29c[_0xe5de3b]={'$like':'%'+_0x3685cd[_0x55e5('0x4f')][_0x55e5('0x5b')]+'%'};return _0xf2c29c;})});}_0x4b5ce2=_['merge']({},_0x4b5ce2,_0x3685cd[_0x55e5('0x5e')]);return db['Disposition'][_0x55e5('0x27')]({'where':_0x4b5ce2[_0x55e5('0x59')]})[_0x55e5('0x16')](function(_0x16a64d){_0x546b86[_0x55e5('0x27')]=_0x16a64d;if(_0x3685cd[_0x55e5('0x4f')]['includeAll']){_0x4b5ce2[_0x55e5('0x62')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4b5ce2);})[_0x55e5('0x16')](function(_0x947a57){_0x546b86[_0x55e5('0x72')]=_0x947a57;return _0x546b86;});}})[_0x55e5('0x16')](respondWithFilteredResult(_0x5393d2,_0x4b5ce2))[_0x55e5('0x21')](handleError(_0x5393d2,null));};exports[_0x55e5('0x73')]=function(_0x302d7d,_0x1da52b){return db[_0x55e5('0x4b')]['find']({'where':{'id':_0x302d7d[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x1da52b,null))[_0x55e5('0x16')](function(_0x2565cb){if(_0x2565cb){return _0x2565cb[_0x55e5('0x73')](_0x302d7d[_0x55e5('0x4f')][_0x55e5('0x74')]);}})['then'](respondWithStatusCode(_0x1da52b,null))[_0x55e5('0x21')](handleError(_0x1da52b,null));};exports[_0x55e5('0x75')]=function(_0x13efa7,_0x1570f3){if(_0x13efa7[_0x55e5('0x68')]['id']){delete _0x13efa7[_0x55e5('0x68')]['id'];}return db['ChatWebsite'][_0x55e5('0x63')]({'where':{'id':_0x13efa7[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x1570f3,null))['then'](function(_0x2ac473){if(_0x2ac473){_0x13efa7[_0x55e5('0x68')][_0x55e5('0x71')]=_0x2ac473['id'];return db['CannedAnswer'][_0x55e5('0x64')](_0x13efa7[_0x55e5('0x68')]);}})['then'](respondWithResult(_0x1570f3,null))['catch'](handleError(_0x1570f3,null));};exports['getAnswers']=function(_0x538135,_0x10d74f){var _0x1647e1={'raw':![],'where':{}};var _0x34238b={};var _0x3e1ddd={'count':0x0,'rows':[]};return db[_0x55e5('0x4b')][_0x55e5('0x76')]({'where':{'id':_0x538135[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x10d74f,null))[_0x55e5('0x16')](function(_0x3399d2){if(_0x3399d2){_0x34238b['model']=_['keys'](db['CannedAnswer'][_0x55e5('0x4c')]);_0x34238b[_0x55e5('0x4f')]=_[_0x55e5('0x50')](_0x538135[_0x55e5('0x4f')]);_0x34238b['filters']=_[_0x55e5('0x52')](_0x34238b[_0x55e5('0x43')],_0x34238b['query']);_0x1647e1[_0x55e5('0x53')]=_['intersection'](_0x34238b[_0x55e5('0x43')],qs[_0x55e5('0x54')](_0x538135[_0x55e5('0x4f')][_0x55e5('0x54')]));_0x1647e1[_0x55e5('0x53')]=_0x1647e1[_0x55e5('0x53')][_0x55e5('0x55')]?_0x1647e1['attributes']:_0x34238b[_0x55e5('0x43')];if(!_0x538135[_0x55e5('0x4f')]['hasOwnProperty'](_0x55e5('0x57'))){_0x1647e1[_0x55e5('0x25')]=qs['limit'](_0x538135['query'][_0x55e5('0x25')]);_0x1647e1['offset']=qs['offset'](_0x538135['query'][_0x55e5('0x24')]);}_0x1647e1[_0x55e5('0x70')]=qs[_0x55e5('0x58')](_0x538135[_0x55e5('0x4f')]['sort']);_0x1647e1[_0x55e5('0x59')]=qs[_0x55e5('0x51')](_[_0x55e5('0x5a')](_0x538135['query'],_0x34238b[_0x55e5('0x51')]));_0x1647e1[_0x55e5('0x59')][_0x55e5('0x71')]=_0x3399d2['id'];if(_0x538135[_0x55e5('0x4f')][_0x55e5('0x5b')]){_0x1647e1[_0x55e5('0x59')]=_['merge'](_0x1647e1[_0x55e5('0x59')],{'$or':_[_0x55e5('0x4a')](_0x1647e1['attributes'],function(_0x417a80){var _0x4996a4={};_0x4996a4[_0x417a80]={'$like':'%'+_0x538135[_0x55e5('0x4f')]['filter']+'%'};return _0x4996a4;})});}_0x1647e1=_['merge']({},_0x1647e1,_0x538135[_0x55e5('0x5e')]);return db['CannedAnswer'][_0x55e5('0x27')]({'where':_0x1647e1[_0x55e5('0x59')]})[_0x55e5('0x16')](function(_0x45c64e){_0x3e1ddd[_0x55e5('0x27')]=_0x45c64e;if(_0x538135[_0x55e5('0x4f')][_0x55e5('0x5f')]){_0x1647e1[_0x55e5('0x62')]=[{'all':!![]}];}return db[_0x55e5('0x77')]['findAll'](_0x1647e1);})[_0x55e5('0x16')](function(_0x2728ea){_0x3e1ddd[_0x55e5('0x72')]=_0x2728ea;return _0x3e1ddd;});}})[_0x55e5('0x16')](respondWithFilteredResult(_0x10d74f,_0x1647e1))[_0x55e5('0x21')](handleError(_0x10d74f,null));};exports[_0x55e5('0x78')]=function(_0xf6bdd3,_0x1d0bf6){return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0xf6bdd3[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x1d0bf6,null))['then'](function(_0x20fdae){if(_0x20fdae){return _0x20fdae[_0x55e5('0x78')](_0xf6bdd3[_0x55e5('0x4f')]['ids']);}})[_0x55e5('0x16')](respondWithStatusCode(_0x1d0bf6,null))[_0x55e5('0x21')](handleError(_0x1d0bf6,null));};exports[_0x55e5('0x79')]=function(_0x477ca0,_0x3827b9){_0x477ca0[_0x55e5('0x68')][_0x55e5('0x7a')]=_0x477ca0[_0x55e5('0x7b')][_0x55e5('0x7c')];return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0x477ca0[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x3827b9,null))[_0x55e5('0x16')](saveUpdates(_0x477ca0[_0x55e5('0x68')],null))['then'](respondWithResult(_0x3827b9,null))[_0x55e5('0x21')](handleError(_0x3827b9,null));};exports[_0x55e5('0x7d')]=function(_0x47ca47,_0x4712d6){_0x47ca47[_0x55e5('0x68')][_0x55e5('0x7e')]=_0x47ca47['file'][_0x55e5('0x7c')];return db['ChatWebsite']['find']({'where':{'id':_0x47ca47[_0x55e5('0x61')]['id']}})['then'](handleEntityNotFound(_0x4712d6,null))['then'](saveUpdates(_0x47ca47[_0x55e5('0x68')],null))[_0x55e5('0x16')](respondWithResult(_0x4712d6,null))[_0x55e5('0x21')](handleError(_0x4712d6,null));};exports[_0x55e5('0x7f')]=function(_0x40fd1e,_0x57477f){_0x40fd1e[_0x55e5('0x68')][_0x55e5('0x80')]=_0x40fd1e['file']['filename'];return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0x40fd1e[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x57477f,null))[_0x55e5('0x16')](saveUpdates(_0x40fd1e[_0x55e5('0x68')],null))[_0x55e5('0x16')](respondWithResult(_0x57477f,null))[_0x55e5('0x21')](handleError(_0x57477f,null));};exports[_0x55e5('0x81')]=function(_0x1c688a,_0x512a8c){_0x1c688a[_0x55e5('0x68')][_0x55e5('0x82')]=_0x1c688a[_0x55e5('0x7b')][_0x55e5('0x7c')];return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0x1c688a[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x512a8c,null))['then'](saveUpdates(_0x1c688a[_0x55e5('0x68')],null))['then'](respondWithResult(_0x512a8c,null))['catch'](handleError(_0x512a8c,null));};exports[_0x55e5('0x83')]=function(_0x1ef5cc,_0x29e60d){var _0x4968e6=path[_0x55e5('0x84')](config[_0x55e5('0x85')],_0x55e5('0x86'));var _0x1e1969={'where':{'id':_0x1ef5cc[_0x55e5('0x61')]['id']},'attributes':['id',_0x55e5('0x7a')],'raw':!![]};var _0x89b038=![];return require(_0x55e5('0x87'))[_0x55e5('0x88')]()['then'](function(_0x288868){if(_0x288868){_0x89b038=_0x288868[_0x55e5('0x89')];}})[_0x55e5('0x16')](function(){return db[_0x55e5('0x4b')][_0x55e5('0x63')](_0x1e1969);})[_0x55e5('0x16')](handleEntityNotFound(_0x29e60d,null))['then'](function(_0x3636a3){if(_0x3636a3){if(!_[_0x55e5('0x8a')](_0x3636a3['sitepic'])){if(fs[_0x55e5('0x8b')](path[_0x55e5('0x84')](config[_0x55e5('0x85')],'server/files/images/logos/',_0x3636a3[_0x55e5('0x7a')]))&&_0x89b038){_0x4968e6=path[_0x55e5('0x84')](config[_0x55e5('0x85')],_0x55e5('0x8c'),_0x3636a3['sitepic']);}}return _0x29e60d['download'](_0x4968e6);}})['catch'](handleError(_0x29e60d,null));};exports[_0x55e5('0x8d')]=function(_0x530ba4,_0x23df1a){var _0x4b70a4=path[_0x55e5('0x84')](config[_0x55e5('0x85')],'server/files/images/avatars/default_avatar.png');var _0x394de4={'where':{'id':_0x530ba4[_0x55e5('0x61')]['id']},'attributes':['id',_0x55e5('0x7e')],'raw':!![]};return db[_0x55e5('0x4b')][_0x55e5('0x63')](_0x394de4)[_0x55e5('0x16')](handleEntityNotFound(_0x23df1a,null))[_0x55e5('0x16')](function(_0x5d1143){if(_0x5d1143){if(!_[_0x55e5('0x8a')](_0x5d1143[_0x55e5('0x7e')])){if(fs[_0x55e5('0x8b')](path[_0x55e5('0x84')](config[_0x55e5('0x85')],_0x55e5('0x8e'),_0x5d1143['agentAvatar']))){_0x4b70a4=path['join'](config[_0x55e5('0x85')],_0x55e5('0x8e'),_0x5d1143[_0x55e5('0x7e')]);}}return _0x23df1a[_0x55e5('0x8f')](_0x4b70a4);}})[_0x55e5('0x21')](handleError(_0x23df1a,null));};exports['getCustomerAvatar']=function(_0x20adb8,_0x35fb31){var _0x17c490=path['join'](config[_0x55e5('0x85')],_0x55e5('0x90'));var _0x1eae1d={'where':{'id':_0x20adb8[_0x55e5('0x61')]['id']},'attributes':['id',_0x55e5('0x80'),_0x55e5('0x91')],'raw':!![]};return db['ChatWebsite'][_0x55e5('0x63')](_0x1eae1d)[_0x55e5('0x16')](handleEntityNotFound(_0x35fb31,null))[_0x55e5('0x16')](function(_0xf4fd89){if(_0xf4fd89){if(!_[_0x55e5('0x8a')](_0xf4fd89[_0x55e5('0x80')])){if(fs[_0x55e5('0x8b')](path[_0x55e5('0x84')](config['root'],'server/files/images/avatars/',_0xf4fd89[_0x55e5('0x80')]))&&_0xf4fd89[_0x55e5('0x91')]){_0x17c490=path[_0x55e5('0x84')](config[_0x55e5('0x85')],_0x55e5('0x8e'),_0xf4fd89[_0x55e5('0x80')]);}}return _0x35fb31[_0x55e5('0x8f')](_0x17c490);}})[_0x55e5('0x21')](handleError(_0x35fb31,null));};exports[_0x55e5('0x92')]=function(_0x1f55f7,_0x42d70d){var _0x247893=path[_0x55e5('0x84')](config[_0x55e5('0x85')],_0x55e5('0x93'));var _0x90e29b={'where':{'id':_0x1f55f7[_0x55e5('0x61')]['id']},'attributes':['id',_0x55e5('0x82')],'raw':!![]};return db[_0x55e5('0x4b')][_0x55e5('0x63')](_0x90e29b)[_0x55e5('0x16')](handleEntityNotFound(_0x42d70d,null))[_0x55e5('0x16')](function(_0x1aa746){if(_0x1aa746){if(!_[_0x55e5('0x8a')](_0x1aa746['systemAvatar'])){if(fs[_0x55e5('0x8b')](path['join'](config[_0x55e5('0x85')],_0x55e5('0x8e'),_0x1aa746['systemAvatar']))){_0x247893=path[_0x55e5('0x84')](config[_0x55e5('0x85')],_0x55e5('0x8e'),_0x1aa746[_0x55e5('0x82')]);}}return _0x42d70d[_0x55e5('0x8f')](_0x247893);}})['catch'](handleError(_0x42d70d,null));};function checkWebsiteInterval(_0x5dcc47){var _0x379ebf=_0x5dcc47[_0x55e5('0x94')];if(!_0x379ebf){return Promise[_0x55e5('0x95')](_0x5dcc47);}var _0x32e1c1=_0x5dcc47['timezone']||undefined;return _0x379ebf['ifTime'](_0x32e1c1)[_0x55e5('0x16')](function(_0x2eed07){if(!_0x2eed07){throw new APIOutOfIntervalError();}return _0x5dcc47;});}exports[_0x55e5('0x96')]=function(_0x4021f4,_0x597541){var _0x47f8c8={'body':_0x4021f4['body'],'channel':_0x55e5('0x97')};var _0x3e27fe=[];var _0x196fb4=[];var _0x5cc60f={};var _0x114b51=![];if(_0x4021f4[_0x55e5('0x68')]['id']){delete _0x4021f4[_0x55e5('0x68')]['id'];}if(_[_0x55e5('0x8a')](_0x4021f4['body'][_0x55e5('0x98')])){throw new APIBadRequestError(_0x55e5('0x99'));}if(_[_0x55e5('0x8a')](_0x4021f4[_0x55e5('0x68')][_0x55e5('0x9a')])){throw new APIBadRequestError(_0x55e5('0x9b'));}if(_[_0x55e5('0x9c')](_0x4021f4[_0x55e5('0x68')][_0x55e5('0x68')])){throw new APIBadRequestError(_0x55e5('0x9d'));}var _0x3d22ba=_0x4021f4['body']['customerIp']&&_0x4021f4[_0x55e5('0x68')][_0x55e5('0x3c')];return db[_0x55e5('0x9e')][_0x55e5('0x6e')]()[_0x55e5('0x16')](function(_0x35304f){if(!_0x35304f){throw new Error(_0x55e5('0x9f'));}_0x3e27fe=Object[_0x55e5('0x50')](_0x35304f)['filter'](function(_0x127a7b){return!['createdAt',_0x55e5('0xa0')][_0x55e5('0xa1')](_0x127a7b);});_0x196fb4=Object[_0x55e5('0x50')](_0x35304f)[_0x55e5('0x5b')](function(_0x5231b9){return![_0x55e5('0xa2'),'updatedAt','CompanyId','ListId'][_0x55e5('0xa1')](_0x5231b9);});if(!_[_0x55e5('0xa1')](_0x196fb4,_0x4021f4[_0x55e5('0x68')][_0x55e5('0x9a')])){throw new APIBadRequestError(_0x55e5('0xa3')+_0x196fb4[_0x55e5('0x84')](',\x20'));}_0x5cc60f[_0x4021f4[_0x55e5('0x68')][_0x55e5('0x9a')]]=_0x4021f4['body']['from'];})[_0x55e5('0x16')](function(){return db['ChatWebsite'][_0x55e5('0x63')]({'where':{'id':_0x4021f4[_0x55e5('0x61')]['id']},'include':[{'model':db[_0x55e5('0xa4')],'as':_0x55e5('0xa5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5cc60f,'limit':0x1,'order':[[_0x55e5('0xa0'),_0x55e5('0xa6')]]}]},{'model':db[_0x55e5('0xa7')],'as':'Applications'},{'model':db[_0x55e5('0x94')],'as':_0x55e5('0x94'),'include':[{'model':db[_0x55e5('0x94')],'as':_0x55e5('0xa8'),'attributes':['id',_0x55e5('0xa9')],'raw':!![]}]}]});})[_0x55e5('0x16')](function(_0x59f3e5){if(!_0x59f3e5){throw new APINotFoundError(util['format'](_0x55e5('0xaa'),_0x4021f4[_0x55e5('0x61')]['id']));}if(_0x3d22ba){return checkWebsiteInterval(_0x59f3e5);}return _0x59f3e5;})[_0x55e5('0x16')](function(_0x3dc7c2){_0x47f8c8[_0x55e5('0xab')]=_0x3dc7c2;_0x47f8c8[_0x55e5('0xac')]=_[_0x55e5('0xad')](_0x3dc7c2[_0x55e5('0xae')],[_0x55e5('0xaf')],[_0x55e5('0xb0')]);if(_0x47f8c8[_0x55e5('0xab')][_0x55e5('0xae')]){delete _0x47f8c8['account'][_0x55e5('0xae')];}_0x47f8c8[_0x55e5('0xb1')]=_0x3dc7c2['List']||{'id':_0x3dc7c2[_0x55e5('0xb2')]};if(_0x47f8c8[_0x55e5('0xb1')]&&_0x47f8c8[_0x55e5('0xb1')][_0x55e5('0xb3')][_0x55e5('0x55')]){return _0x47f8c8[_0x55e5('0xb1')][_0x55e5('0xb3')][0x0];}var _0x4c703f=_[_0x55e5('0x10')](_0x4021f4[_0x55e5('0x68')],{'firstName':_0x4021f4[_0x55e5('0x68')][_0x55e5('0x98')],'ListId':_0x3dc7c2['ListId']});_0x4c703f[_0x4021f4[_0x55e5('0x68')][_0x55e5('0x9a')]]=_0x4021f4[_0x55e5('0x68')][_0x55e5('0x98')];return db['CmContact']['create'](_0x4c703f,{'fields':_0x3e27fe,'raw':!![]});})[_0x55e5('0x16')](function(_0x24bbca){_0x47f8c8[_0x55e5('0xb4')]=_0x24bbca;var _0x43b7a3=createInteractionObject(_0x4021f4[_0x55e5('0x61')]['id'],_0x4021f4[_0x55e5('0x68')],_0x4021f4[_0x55e5('0xb5')],_0x24bbca);var _0x28ecfd={'ChatWebsiteId':_0x4021f4[_0x55e5('0x61')]['id']};if(_0x4021f4[_0x55e5('0x68')][_0x55e5('0xb6')]){_0x28ecfd[_0x55e5('0xb6')]=_0x4021f4[_0x55e5('0x68')][_0x55e5('0xb6')];_0x28ecfd[_0x55e5('0xb7')]=![];return db[_0x55e5('0xb8')][_0x55e5('0x63')]({'where':_0x28ecfd})[_0x55e5('0x16')](function(_0x9953b){var _0x548dc2=_0x4021f4['body'][_0x55e5('0x35')]&&_0x4021f4[_0x55e5('0x68')][_0x55e5('0x3c')];if(_0x9953b){_0x114b51=!![];return _0x9953b;}else if(!_0x548dc2&&_0x9953b&&_0x9953b[_0x55e5('0xb7')]){throw new APIConflictError(_0x55e5('0xb9'));}_0x43b7a3['threadId']=_0x4021f4[_0x55e5('0x68')]['threadId'];_0x43b7a3[_0x55e5('0xba')]=_0x4021f4[_0x55e5('0x68')][_0x55e5('0xba')];return db[_0x55e5('0xb8')][_0x55e5('0x64')](_0x43b7a3);});}_0x28ecfd[_0x55e5('0xbb')]=_0x24bbca['id'];if(_0x4021f4[_0x55e5('0x68')]['interaction']&&_0x4021f4['body'][_0x55e5('0xbc')]['id']){_0x28ecfd['id']=_0x4021f4[_0x55e5('0x68')][_0x55e5('0xbc')]['id'];return db['ChatInteraction'][_0x55e5('0x63')]({'where':_0x28ecfd})[_0x55e5('0x16')](function(_0x4d9800){var _0x50f7ea=_0x4021f4[_0x55e5('0x68')][_0x55e5('0x35')]&&_0x4021f4[_0x55e5('0x68')][_0x55e5('0x3c')];if(!_0x50f7ea&&_0x4d9800&&_0x4d9800[_0x55e5('0xb7')]){throw new APIConflictError(_0x55e5('0xb9'));}else if(_0x4d9800){_0x114b51=!![];return _0x4d9800;}else{return db[_0x55e5('0xb8')][_0x55e5('0x64')](_0x43b7a3);}});}return db['ChatInteraction'][_0x55e5('0x64')](_0x43b7a3);})[_0x55e5('0x16')](function(_0x2d4d26){if(!_0x114b51){return _0x2d4d26;}var _0x59a0c3={'from':(_0x47f8c8['contact'][_0x55e5('0x39')]||'')+'\x20'+(_0x47f8c8[_0x55e5('0xb4')][_0x55e5('0x3a')]||'')};if(_0x4021f4[_0x55e5('0x68')][_0x55e5('0xb6')]&&_0x4021f4[_0x55e5('0x68')][_0x55e5('0xbd')]&&_0x4021f4[_0x55e5('0x68')]['threadId']!=_0x4021f4['body']['messageId']){_0x59a0c3[_0x55e5('0xb6')]=_0x4021f4[_0x55e5('0x68')]['messageId'];}return _0x2d4d26[_0x55e5('0x2a')](_0x59a0c3);})[_0x55e5('0x16')](function(_0x3136d1){_0x47f8c8['interaction']=_0x3136d1[_0x55e5('0x2c')]({'plain':!![]});_0x47f8c8[_0x55e5('0xbc')]['created']=!_0x114b51;if(_0x47f8c8['interaction'][_0x55e5('0xbe')]){if(_0x47f8c8[_0x55e5('0xab')]['autoclose']){_0x47f8c8[_0x55e5('0xac')][_0x55e5('0xbf')]({'id':0x0,'priority':_0x47f8c8[_0x55e5('0xac')][_0x55e5('0x55')]+0x1,'app':_0x55e5('0xc0'),'appdata':'unmanaged','interval':_0x55e5('0xc1')});}}return db[_0x55e5('0xc2')]['create']({'body':_0x4021f4[_0x55e5('0x68')][_0x55e5('0x68')],'ChatWebsiteId':_0x4021f4[_0x55e5('0x61')]['id'],'ChatInteractionId':_0x3136d1['id'],'direction':'in','ContactId':_0x47f8c8[_0x55e5('0xb4')]['id'],'AttachmentId':_0x4021f4[_0x55e5('0x68')][_0x55e5('0xc3')]});})[_0x55e5('0x16')](function(_0x2b5cfa){_0x47f8c8[_0x55e5('0x1f')]=_0x2b5cfa;if(!_0x47f8c8[_0x55e5('0xbc')][_0x55e5('0xc4')]){return;}return db[_0x55e5('0xc5')][_0x55e5('0x63')]({'attributes':['id',_0x55e5('0x3e')],'where':{'id':_0x47f8c8[_0x55e5('0xbc')]['UserId']}});})[_0x55e5('0x16')](function(_0x2c71ba){if(_0x2c71ba){_0x47f8c8[_0x55e5('0xac')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2c71ba['name']+','+(_0x47f8c8[_0x55e5('0xab')][_0x55e5('0xc6')]||0xa),'interval':_0x55e5('0xc1')});_0x47f8c8[_0x55e5('0xc7')]=!![];}if(!_0x47f8c8[_0x55e5('0xbc')][_0x55e5('0xc8')]){return;}return db['ChatQueue'][_0x55e5('0x63')]({'attributes':['id','name'],'where':{'id':_0x47f8c8['interaction'][_0x55e5('0xc8')]}});})['then'](function(_0x48aeb2){if(_0x48aeb2){_0x47f8c8[_0x55e5('0xac')][_0x55e5('0xc9')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x48aeb2[_0x55e5('0x3e')]+','+(_0x47f8c8[_0x55e5('0xab')][_0x55e5('0xca')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x55e5('0xcb'),_0x55e5('0xcc'),_0x47f8c8);})['then'](function(_0x3eb572){respondWithRpcPromise(_0x55e5('0xcd'),_0x55e5('0xcd'),{'event':_0x55e5('0x96'),'message':_0x3eb572},client9002);return _0x3eb572;})[_0x55e5('0x16')](respondWithResult(_0x597541,null))[_0x55e5('0x21')](APIHandleError(_0x597541));};exports['offline']=function(_0x2c7aab,_0x270f41){var _0x4abdee,_0x58ede9,_0x1b5ccf;var _0x4bfee5=[];var _0xca0cdb={};var _0x499d64=_0x2c7aab[_0x55e5('0xce')]||[];var _0x1671d6=[];var _0xd9711c;return db['CmContact'][_0x55e5('0x6e')]()[_0x55e5('0x16')](function(_0x507386){if(!_0x507386){throw new db[(_0x55e5('0xcf'))][(_0x55e5('0xd0'))]('no\x20available\x20attributes');}_0x4bfee5=_[_0x55e5('0xd1')](_['keys'](_0x507386),[_0x55e5('0xa2'),_0x55e5('0xa0'),'CompanyId','ListId']);if(_0x2c7aab[_0x55e5('0x68')]['id']){delete _0x2c7aab[_0x55e5('0x68')]['id'];}if(_[_0x55e5('0x8a')](_0x2c7aab[_0x55e5('0x68')][_0x55e5('0x98')])){throw _0x270f41[_0x55e5('0x23')](0x1f4)['send'](new db['Sequelize'][(_0x55e5('0xd0'))](_0x55e5('0xd2')));}if(_[_0x55e5('0x8a')](_0x2c7aab['body'][_0x55e5('0x68')])||_0x2c7aab[_0x55e5('0x68')][_0x55e5('0x68')]===''){throw _0x270f41['status'](0x1f4)[_0x55e5('0x31')](new db['Sequelize'][(_0x55e5('0xd0'))](_0x55e5('0xd3')));}if(_[_0x55e5('0x8a')](_0x2c7aab[_0x55e5('0x68')][_0x55e5('0xd4')])){throw _0x270f41[_0x55e5('0x23')](0x1f4)[_0x55e5('0x31')](new db[(_0x55e5('0xcf'))]['ValidationError'](_0x55e5('0xd5')+_0x4bfee5));}if(!_[_0x55e5('0xa1')](_0x4bfee5,_0x2c7aab[_0x55e5('0x68')][_0x55e5('0xd4')])){throw _0x270f41['status'](0x1f4)[_0x55e5('0x31')](new db[(_0x55e5('0xcf'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4bfee5));}_0xca0cdb[_0x2c7aab[_0x55e5('0x68')][_0x55e5('0xd4')]]=_0x2c7aab[_0x55e5('0x68')][_0x55e5('0x98')];})[_0x55e5('0x16')](function(){return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0x2c7aab[_0x55e5('0x61')]['id']},'include':[{'model':db[_0x55e5('0xa4')],'as':'List'},{'model':db[_0x55e5('0xd6')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x270f41,null))['then'](function(_0x8801a5){if(_0x8801a5&&_0x8801a5['List']){_0x58ede9=_0x8801a5;var _0x2ec8c7=_['defaults'](_0x2c7aab[_0x55e5('0x68')],{'firstName':_0x2c7aab[_0x55e5('0x68')][_0x55e5('0x98')],'phone':_0x2c7aab[_0x55e5('0x68')][_0x55e5('0x98')],'ListId':_0x8801a5['ListId']});_0x2ec8c7[_0x2c7aab[_0x55e5('0x68')][_0x55e5('0xd4')]]=_0x2c7aab[_0x55e5('0x68')][_0x55e5('0x98')];return db['CmContact']['findOrCreate']({'where':_0xca0cdb,'defaults':_0x2ec8c7});}})[_0x55e5('0xd7')](function(_0x1e4b8f){if(_0x1e4b8f){_0x1b5ccf=_0x1e4b8f;var _0x6a5c09=fs[_0x55e5('0xd8')](path[_0x55e5('0x84')](config[_0x55e5('0x85')],_0x55e5('0xd9')),_0x55e5('0xda'));var _0x5e9b31=ejs[_0x55e5('0xdb')](_0x6a5c09,{'body':_['toPairs'](_0x2c7aab[_0x55e5('0x68')][_0x55e5('0x68')]),'bodyTitle':_0x58ede9[_0x55e5('0xdc')]});return db[_0x55e5('0xdd')][_0x55e5('0x64')]({'body':_0x5e9b31,'plainBody':htmlToText[_0x55e5('0xde')](_0x5e9b31),'ContactId':_0x1e4b8f['id'],'ChatWebsiteId':_0x58ede9['id']});}})[_0x55e5('0x16')](function(_0x30156e){_0xd9711c=_0x30156e;if(_0x499d64[_0x55e5('0x55')]){var _0x3bd17b=_0x499d64[_0x55e5('0x4a')](function(_0x5153a4){return{'name':_0x5153a4[_0x55e5('0xdf')],'basename':_0x5153a4[_0x55e5('0x7c')],'type':_0x5153a4[_0x55e5('0xe0')],'ChatOfflineMessageId':_0x30156e['id']};});_0x1671d6=_0x3bd17b['map'](_0x48b350=>{var _0x1c4c1c={'filename':_0x48b350['name'],'path':path['join'](config[_0x55e5('0x85')],_0x55e5('0xe1'),_0x55e5('0xce'),_0x55e5('0xe2'),'offline-chat',_0x48b350['basename'])};return _0x1c4c1c;});if(!_0x58ede9[_0x55e5('0xe3')]){return db[_0x55e5('0xe4')]['transaction'](function(_0x875d70){return db[_0x55e5('0xe5')][_0x55e5('0xe6')](_0x3bd17b,{'transaction':_0x875d70});});}}})['then'](function(){if(_0xd9711c){_0x4abdee=_0xd9711c;return db['MailAccount'][_0x55e5('0x76')]({'where':{'service':!![]},'include':[{'model':db[_0x55e5('0xe7')],'as':_0x55e5('0xe8'),'raw':!![],'include':[{'model':db[_0x55e5('0xe9')],'as':_0x55e5('0xe9'),'raw':!![]}]}]});}})['then'](function(_0x35e086){if(_0x35e086&&_0x35e086['Smtp']&&_0x58ede9[_0x55e5('0xea')]&&_0x58ede9[_0x55e5('0xeb')]){var _0x20147e=_0x35e086['getSmtpOptions']();return respondWithRpcPromise(_0x55e5('0xec'),'sendMail',{'account':_0x20147e,'message':{'from':util[_0x55e5('0x40')](_0x55e5('0xed'),_0x35e086[_0x55e5('0x3e')],_0x35e086[_0x55e5('0xee')]||_0x35e086[_0x55e5('0xe8')]['user']),'to':_0x58ede9[_0x55e5('0xeb')],'subject':_0x58ede9['offlineMessageSubject'],'html':_0x4abdee[_0x55e5('0x68')],'attachments':_0x1671d6}},client9003)[_0x55e5('0x16')](function(){return _0x4abdee;})['catch'](function(_0x1859cf){logger[_0x55e5('0x1d')](_0x1859cf);});}})['then'](function(){if(_0x58ede9&&_0x58ede9[_0x55e5('0xe3')]&&_0x58ede9[_0x55e5('0xef')]){var _0x28a745=[];if(_0x499d64[_0x55e5('0x55')]){_0x28a745=_0x499d64[_0x55e5('0x4a')](function(_0x5e7c97){return{'name':_0x5e7c97['originalname'],'basename':_0x5e7c97['filename'],'type':_0x5e7c97[_0x55e5('0xe0')],'ChatOfflineMessageId':_0xd9711c['id']};});}var _0x1b5623;if(!_[_0x55e5('0x8a')](_0x58ede9[_0x55e5('0xf0')])){var _0x157070=_[_0x55e5('0x4a')](_0x2c7aab[_0x55e5('0x68')],function(_0x46b51d){return _0x46b51d;});var _0x50a065=_[_0x55e5('0xf1')](_0x157070)[0x0];var _0x1e8a86=_[_0x55e5('0xf2')](_0x50a065,function(_0x50237c){return _0x50237c;});_0x1b5623=_0x1e8a86[0x1][_0x58ede9[_0x55e5('0xf0')]];}var _0x5d8d84={'from':_0x1b5ccf[_0x55e5('0xee')],'firstName':_0x1b5ccf[_0x55e5('0x39')],'lastName':_0x1b5ccf['lastName'],'mapKey':_0x55e5('0xee'),'message':{'from':_0x1b5ccf[_0x55e5('0xee')],'to':_0x58ede9[_0x55e5('0xd6')]['email'],'cc':'','subject':_[_0x55e5('0x8a')](_0x1b5623)?_0x58ede9['offlineMessageSubject']:_0x1b5623,'messageId':'','sentAt':new Date(),'attach':_0x28a745[_0x55e5('0x55')],'attachments':_0x28a745,'originChannel':_0x55e5('0xf3'),'ChatWebsiteId':_0x58ede9['id'],'ChatOfflineMessageId':_0x4abdee['id'],'originTo':_0x58ede9[_0x55e5('0xd6')][_0x55e5('0xee')]},'body':_0x4abdee[_0x55e5('0x68')]};var _0x2babf6={'account':{'id':_0x58ede9[_0x55e5('0xef')]},'body':_0x5d8d84,'log':_0x55e5('0xf4')};return respondWithRpcPromise(_0x55e5('0xf4'),'notifyMail',_0x2babf6,client9001)[_0x55e5('0x16')](function(){return _0x4abdee;})[_0x55e5('0x21')](function(_0x3ede48){logger[_0x55e5('0x1d')](_0x3ede48);});}return;})[_0x55e5('0x16')](function(){if(_0x4abdee){return _0x4abdee;}})[_0x55e5('0x16')](respondWithResult(_0x270f41,null))[_0x55e5('0x21')](function(){for(var _0x2c1f72 of _0x499d64){var _0x26ee1b=path[_0x55e5('0x84')](config[_0x55e5('0x85')],_0x55e5('0xe1'),'files',_0x55e5('0xe2'),_0x55e5('0xf5'),_0x2c1f72[_0x55e5('0x7c')]);fs_extra['remove'](_0x26ee1b)[_0x55e5('0x21')](function(_0x331794){logger[_0x55e5('0x1d')](_0x55e5('0xf6'),_0x26ee1b,_0x331794);});}});};exports[_0x55e5('0xf7')]=function(_0x4ca6b5,_0xdfc662){return db['ChatInteraction'][_0x55e5('0x63')]({'where':{'id':_0x4ca6b5[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0xdfc662,null))['then'](function(_0x43f4da){if(_0x43f4da){return _0x43f4da[_0x55e5('0xf7')](_0x4ca6b5['body']['ids'],_[_0x55e5('0xf8')](_0x4ca6b5[_0x55e5('0x68')],[_0x55e5('0x74'),'id'])||{});}})['then'](respondWithResult(_0xdfc662,null))[_0x55e5('0x21')](handleError(_0xdfc662,null));};exports[_0x55e5('0xf9')]=function(_0x4d582c,_0x5d3575){var _0x4e730e={'raw':![],'where':{}};var _0x2154da={};var _0x268133={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x55e5('0x76')]({'where':{'id':_0x4d582c[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x5d3575,null))['then'](function(_0xfcfd88){if(_0xfcfd88){_0x2154da[_0x55e5('0x43')]=_['keys'](db['ChatInteraction'][_0x55e5('0x4c')]);_0x2154da['query']=_['keys'](_0x4d582c[_0x55e5('0x4f')]);_0x2154da['filters']=_[_0x55e5('0x52')](_0x2154da[_0x55e5('0x43')],_0x2154da[_0x55e5('0x4f')]);_0x4e730e['attributes']=_['intersection'](_0x2154da[_0x55e5('0x43')],qs[_0x55e5('0x54')](_0x4d582c[_0x55e5('0x4f')][_0x55e5('0x54')]));_0x4e730e['attributes']=_0x4e730e[_0x55e5('0x53')][_0x55e5('0x55')]?_0x4e730e[_0x55e5('0x53')]:_0x2154da['model'];if(!_0x4d582c[_0x55e5('0x4f')][_0x55e5('0x56')](_0x55e5('0x57'))){_0x4e730e[_0x55e5('0x25')]=qs['limit'](_0x4d582c[_0x55e5('0x4f')]['limit']);_0x4e730e[_0x55e5('0x24')]=qs[_0x55e5('0x24')](_0x4d582c['query'][_0x55e5('0x24')]);}_0x4e730e['order']=qs['sort'](_0x4d582c['query'][_0x55e5('0x58')]);_0x4e730e[_0x55e5('0x59')]=qs[_0x55e5('0x51')](_[_0x55e5('0x5a')](_0x4d582c['query'],_0x2154da[_0x55e5('0x51')]));_0x4e730e[_0x55e5('0x59')][_0x55e5('0x71')]=_0xfcfd88['id'];if(_0x4d582c[_0x55e5('0x4f')][_0x55e5('0x5b')]){_0x4e730e[_0x55e5('0x59')]=_[_0x55e5('0x5c')](_0x4e730e[_0x55e5('0x59')],{'$or':_['map'](_0x4e730e[_0x55e5('0x53')],function(_0x3f1fba){var _0x3b19c8={};_0x3b19c8[_0x3f1fba]={'$like':'%'+_0x4d582c[_0x55e5('0x4f')]['filter']+'%'};return _0x3b19c8;})});}_0x4e730e=_[_0x55e5('0x5c')]({},_0x4e730e,_0x4d582c[_0x55e5('0x5e')]);return db['ChatInteraction']['count']({'where':_0x4e730e['where']})['then'](function(_0x1c376c){_0x268133[_0x55e5('0x27')]=_0x1c376c;if(_0x4d582c[_0x55e5('0x4f')]['includeAll']){_0x4e730e['include']=[{'model':db[_0x55e5('0x9e')],'as':_0x55e5('0xfa'),'required':![]},{'model':db[_0x55e5('0xc5')],'as':_0x55e5('0xfb'),'attributes':['name',_0x55e5('0xfc'),'internal'],'required':![]},{'model':db[_0x55e5('0xfd')],'as':_0x55e5('0xfe'),'attributes':['id',_0x55e5('0x3e'),'color'],'where':_0x4d582c[_0x55e5('0x4f')][_0x55e5('0xff')]?{'id':_0x4d582c[_0x55e5('0x4f')][_0x55e5('0xff')]}:undefined,'required':_0x4d582c[_0x55e5('0x4f')][_0x55e5('0xff')]?!![]:![]}];}return db[_0x55e5('0xb8')]['findAll'](_0x4e730e);})[_0x55e5('0x16')](function(_0x366bc5){_0x268133[_0x55e5('0x72')]=_0x366bc5;return _0x268133;});}})[_0x55e5('0x16')](respondWithFilteredResult(_0x5d3575,_0x4e730e))[_0x55e5('0x21')](handleError(_0x5d3575,null));};exports[_0x55e5('0x100')]=function(_0x370133,_0x578a6d){var _0x98f4f0=0x0;var _0x3117c1=0x0;var _0x1f54b9=![];var _0x2b4e86;var _0x17b29e;return db[_0x55e5('0x4b')]['find']({'where':{'id':_0x370133[_0x55e5('0x61')]['id']},'include':[{'model':db['Interval'],'as':_0x55e5('0x94'),'include':[{'model':db[_0x55e5('0x94')],'as':_0x55e5('0xa8'),'attributes':['id',_0x55e5('0xa9')]}]}]})['then'](handleEntityNotFound(_0x578a6d,null))['then'](function(_0x293aff){if(_0x293aff){_0x2b4e86=_0x293aff;return _0x293aff['getProactiveActions']({'raw':!![]});}})['then'](function(_0x4f8fe8){if(_0x2b4e86){if(_0x4f8fe8){_0x17b29e=_0x4f8fe8;}}return require(_0x55e5('0x87'))[_0x55e5('0x88')]();})['then'](function(_0x2060a5){if(_0x2060a5){_0x3117c1=_0x2060a5['virtual'];_0x1f54b9=_0x2060a5[_0x55e5('0x89')];}})[_0x55e5('0x16')](function(){return db[_0x55e5('0xb8')][_0x55e5('0x27')]({'where':{'closed':![]}});})[_0x55e5('0x16')](function(_0xdc60da){_0x98f4f0=_0xdc60da;if(_0x3117c1&&_0xdc60da>_0x3117c1){return db['License'][_0x55e5('0x76')]({'where':{'id':0x1}})[_0x55e5('0x16')](function(_0x4b7cc5){if(_0x4b7cc5){_0x4b7cc5[_0x55e5('0x101')](_0x55e5('0x102'));}});}})[_0x55e5('0x16')](function(){var _0x56d217=_0x2b4e86[_0x55e5('0x94')];var _0x4727ba=_0x2b4e86[_0x55e5('0x103')]||undefined;return _0x56d217?_0x56d217[_0x55e5('0x104')](_0x4727ba):!![];})[_0x55e5('0x16')](function(_0x336b05){var _0x3abfd2=fs[_0x55e5('0xd8')](path[_0x55e5('0x84')](config[_0x55e5('0x85')],_0x55e5('0x105')),_0x55e5('0xda'));var _0x88915b=_0x55e5('0x106');var _0x2d53ec=![];try{const _0x500e7b=new URL(_0x2b4e86[_0x55e5('0x66')]);_0x2b4e86[_0x55e5('0x66')]=_0x500e7b[_0x55e5('0x107')];}catch(_0x4dadb0){}var _0xa6029d;if(_0x370133[_0x55e5('0xb5')][_0x55e5('0x3c')]){_0x370133['headers'][_0x55e5('0x3c')]=_0x370133[_0x55e5('0xb5')][_0x55e5('0x3c')][_0x55e5('0x108')](/\/$/,'');_0xa6029d=wildcardUtils['testWebsiteWithWildcard'](_0x2b4e86['address'],_0x370133[_0x55e5('0xb5')]['referer']);}else{_0x370133[_0x55e5('0xb5')]['referer']=_0x2b4e86['address'];_0xa6029d=!![];}var _0x498bc8={'chatVersion':_0x88915b,'chatWebsiteAddressOrigin':_0xa6029d?_0x370133['headers'][_0x55e5('0x3c')]:_0x2b4e86[_0x55e5('0x66')],'remote':_0x2b4e86[_0x55e5('0x109')],'query':querystring['stringify'](_[_0x55e5('0x5c')](_0x2b4e86['get']({'plain':!![]}),{'customerIp':_0x370133[_0x55e5('0xb5')][_0x55e5('0x37')]||_0x370133[_0x55e5('0xb5')][_0x55e5('0x10a')]||_0x370133['connection'][_0x55e5('0x10b')]||_0x370133['ip'],'referer':_0x370133[_0x55e5('0xb5')]['referer'],'openedInteractions':_0x98f4f0,'maxInteractions':_0x3117c1,'virtual':_0x1f54b9['virtual'],'online':_0x336b05,'custom':_0x1f54b9,'address':_0xa6029d?_0x370133[_0x55e5('0xb5')][_0x55e5('0x3c')]:null}))[_0x55e5('0x108')](/'/g,'\x5c\x27')};_0x578a6d[_0x55e5('0x31')](ejs[_0x55e5('0xdb')](Mustache[_0x55e5('0xdb')](_0x3abfd2,_0x498bc8),{'proactiveActions':_0x17b29e,'alignment':_0x2b4e86[_0x55e5('0x10c')],'verticalAlignment':_0x2b4e86['verticalAlignment'],'div_color':_0x2b4e86[_0x55e5('0x10d')],'labelText':_0x2b4e86[_0x55e5('0x10e')],'text_color':_0x2b4e86[_0x55e5('0x10f')],'text_button_color':_0x2b4e86['textButtonColor'],'button_color':_0x2b4e86['color_button'],'background_color':_0x2b4e86['backgroundColor'],'hideWhenOffline':_0x2b4e86[_0x55e5('0x110')],'intervalId':_0x2b4e86[_0x55e5('0x111')],'isDevelopment':_0x2d53ec,'chatVersion':_0x88915b}));})[_0x55e5('0x21')](handleError(_0x578a6d,null));};exports[_0x55e5('0x112')]=function(_0x2a6d94,_0x45cfc4){var _0x5c78b1=_0x2a6d94['params']['id'];var _0x43b6ef=_0x2a6d94['body'];var _0x16c8f2=0xc8;var _0x4accca=null;return db[_0x55e5('0xe4')][_0x55e5('0x113')]({'isolationLevel':db[_0x55e5('0xe4')][_0x55e5('0x114')][_0x55e5('0x115')][_0x55e5('0x116')]},function(_0x39d5bc){return db[_0x55e5('0x4b')][_0x55e5('0x76')]({'where':{'id':_0x5c78b1},'transaction':_0x39d5bc})['then'](function(_0x21360a){if(_0x21360a){return db[_0x55e5('0xa7')][_0x55e5('0x2b')]({'where':{'ChatWebsiteId':_0x5c78b1},'transaction':_0x39d5bc})[_0x55e5('0x16')](function(){var _0x3cb0f8=_[_0x55e5('0x4a')](_0x43b6ef,function(_0x47dd28){_0x47dd28[_0x55e5('0x71')]=_0x5c78b1;return _0x47dd28;});return db[_0x55e5('0xa7')]['bulkCreate'](_0x3cb0f8,{'transaction':_0x39d5bc});});}else{_0x16c8f2=0x194;_0x4accca=[];}});})[_0x55e5('0x16')](function(){if(_0x16c8f2!==0x194){return db['ChatApplication'][_0x55e5('0x117')]({'where':{'ChatWebsiteId':_0x5c78b1},'order':_0x55e5('0xaf')})[_0x55e5('0x16')](function(_0x2c1222){_0x4accca=_0x2c1222;});}})[_0x55e5('0x21')](function(_0x4e0d24){_0x16c8f2=0x1f4;logger[_0x55e5('0x1d')](_0x4e0d24[_0x55e5('0x30')]);if(_0x4e0d24[_0x55e5('0x3e')]){delete _0x4e0d24[_0x55e5('0x3e')];}_0x4accca=_0x4e0d24;})[_0x55e5('0x118')](function(){if(_0x4accca===null){_0x45cfc4['sendStatus'](_0x16c8f2);}else{if(_0x16c8f2===0x1f4){_0x45cfc4['status'](_0x16c8f2)[_0x55e5('0x31')](_0x4accca);}else{_0x45cfc4[_0x55e5('0x23')](_0x16c8f2)['json'](_0x4accca);}}});};exports['getApplications']=function(_0xb9b8aa,_0x5dc3ef){var _0x482469={};var _0x5c67de={};var _0x5ba554;var _0x250597;return db['ChatWebsite'][_0x55e5('0x76')]({'where':{'id':_0xb9b8aa[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x5dc3ef,null))[_0x55e5('0x16')](function(_0x5cd73d){if(_0x5cd73d){_0x5ba554=_0x5cd73d;_0x5c67de[_0x55e5('0x43')]=_[_0x55e5('0x50')](db[_0x55e5('0xa7')][_0x55e5('0x4c')]);_0x5c67de['query']=_[_0x55e5('0x50')](_0xb9b8aa[_0x55e5('0x4f')]);_0x5c67de[_0x55e5('0x51')]=_[_0x55e5('0x52')](_0x5c67de[_0x55e5('0x43')],_0x5c67de[_0x55e5('0x4f')]);_0x482469[_0x55e5('0x53')]=_['intersection'](_0x5c67de[_0x55e5('0x43')],qs[_0x55e5('0x54')](_0xb9b8aa[_0x55e5('0x4f')][_0x55e5('0x54')]));_0x482469[_0x55e5('0x53')]=_0x482469[_0x55e5('0x53')]['length']?_0x482469[_0x55e5('0x53')]:_0x5c67de[_0x55e5('0x43')];_0x482469[_0x55e5('0x70')]=qs[_0x55e5('0x58')](_0xb9b8aa[_0x55e5('0x4f')]['sort']);_0x482469[_0x55e5('0x59')]=qs['filters'](_[_0x55e5('0x5a')](_0xb9b8aa[_0x55e5('0x4f')],_0x5c67de[_0x55e5('0x51')]));if(_0xb9b8aa['query'][_0x55e5('0x5b')]){_0x482469[_0x55e5('0x59')]=_[_0x55e5('0x5c')](_0x482469[_0x55e5('0x59')],{'$or':_[_0x55e5('0x4a')](_0x482469[_0x55e5('0x53')],function(_0x14a24d){var _0x738f7d={};_0x738f7d[_0x14a24d]={'$like':'%'+_0xb9b8aa['query'][_0x55e5('0x5b')]+'%'};return _0x738f7d;})});}_0x482469=_[_0x55e5('0x5c')]({},_0x482469,_0xb9b8aa['options']);return _0x5ba554[_0x55e5('0x119')](_0x482469);}})['then'](function(_0x25a44c){if(_0x25a44c){_0x250597=_0x25a44c[_0x55e5('0x55')];if(!_0xb9b8aa[_0x55e5('0x4f')]['hasOwnProperty'](_0x55e5('0x57'))){_0x482469[_0x55e5('0x25')]=qs[_0x55e5('0x25')](_0xb9b8aa[_0x55e5('0x4f')]['limit']);_0x482469['offset']=qs[_0x55e5('0x24')](_0xb9b8aa['query'][_0x55e5('0x24')]);}return _0x5ba554['getApplications'](_0x482469);}})['then'](function(_0x1c5410){if(_0x1c5410){return _0x1c5410?{'count':_0x250597,'rows':_0x1c5410}:null;}})[_0x55e5('0x16')](respondWithResult(_0x5dc3ef,null))[_0x55e5('0x21')](handleError(_0x5dc3ef,null));};exports[_0x55e5('0x11a')]=function(_0x538873,_0x276b8f){return db[_0x55e5('0x11b')][_0x55e5('0x63')]({'where':{'id':_0x538873[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x276b8f,null))['then'](function(_0x487a24){if(_0x487a24){return _0x487a24[_0x55e5('0x11a')](_0x538873[_0x55e5('0x68')][_0x55e5('0x74')],_['omit'](_0x538873[_0x55e5('0x68')],['ids','id'])||{});}})['then'](respondWithResult(_0x276b8f,null))[_0x55e5('0x21')](handleError(_0x276b8f,null));};exports[_0x55e5('0x11c')]=function(_0x4e9c07,_0x4e6387){var _0x47b1dd={};var _0x1eae1f={};var _0x584389;var _0x2e9feb;return db['ChatWebsite'][_0x55e5('0x76')]({'where':{'id':_0x4e9c07['params']['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x4e6387,null))[_0x55e5('0x16')](function(_0x175d9d){if(_0x175d9d){_0x584389=_0x175d9d;_0x1eae1f['model']=_[_0x55e5('0x50')](db[_0x55e5('0x11d')][_0x55e5('0x4c')]);_0x1eae1f[_0x55e5('0x4f')]=_['keys'](_0x4e9c07[_0x55e5('0x4f')]);_0x1eae1f[_0x55e5('0x51')]=_[_0x55e5('0x52')](_0x1eae1f[_0x55e5('0x43')],_0x1eae1f[_0x55e5('0x4f')]);_0x47b1dd[_0x55e5('0x53')]=_['intersection'](_0x1eae1f[_0x55e5('0x43')],qs[_0x55e5('0x54')](_0x4e9c07['query'][_0x55e5('0x54')]));_0x47b1dd[_0x55e5('0x53')]=_0x47b1dd['attributes']['length']?_0x47b1dd[_0x55e5('0x53')]:_0x1eae1f[_0x55e5('0x43')];_0x47b1dd['order']=qs[_0x55e5('0x58')](_0x4e9c07[_0x55e5('0x4f')]['sort']);_0x47b1dd[_0x55e5('0x59')]=qs[_0x55e5('0x51')](_[_0x55e5('0x5a')](_0x4e9c07[_0x55e5('0x4f')],_0x1eae1f[_0x55e5('0x51')]));if(_0x4e9c07[_0x55e5('0x4f')][_0x55e5('0x5b')]){_0x47b1dd[_0x55e5('0x59')]=_['merge'](_0x47b1dd['where'],{'$or':_[_0x55e5('0x4a')](_0x47b1dd[_0x55e5('0x53')],function(_0x8e1783){var _0x4b1e7d={};_0x4b1e7d[_0x8e1783]={'$like':'%'+_0x4e9c07[_0x55e5('0x4f')][_0x55e5('0x5b')]+'%'};return _0x4b1e7d;})});}_0x47b1dd=_[_0x55e5('0x5c')]({},_0x47b1dd,_0x4e9c07[_0x55e5('0x5e')]);return _0x584389['getProactiveActions'](_0x47b1dd);}})['then'](function(_0x34488b){if(_0x34488b){_0x2e9feb=_0x34488b[_0x55e5('0x55')];if(!_0x4e9c07[_0x55e5('0x4f')][_0x55e5('0x56')]('nolimit')){_0x47b1dd[_0x55e5('0x25')]=qs['limit'](_0x4e9c07['query']['limit']);_0x47b1dd[_0x55e5('0x24')]=qs[_0x55e5('0x24')](_0x4e9c07[_0x55e5('0x4f')][_0x55e5('0x24')]);}return _0x584389[_0x55e5('0x11c')](_0x47b1dd);}})[_0x55e5('0x16')](function(_0x3bdec3){if(_0x3bdec3){return _0x3bdec3?{'count':_0x2e9feb,'rows':_0x3bdec3}:null;}})[_0x55e5('0x16')](respondWithResult(_0x4e6387,null))[_0x55e5('0x21')](handleError(_0x4e6387,null));};exports['getFields']=function(_0x39c633,_0x345b74){var _0x441d3a=_0x39c633[_0x55e5('0x4f')][_0x55e5('0x11e')]==='false'?_0x55e5('0x11f'):_0x55e5('0x120');return db['ChatWebsite'][_0x55e5('0x63')]({'attributes':['id',_0x441d3a],'where':{'id':_0x39c633[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x345b74,null))[_0x55e5('0x16')](function(_0x146f90){if(_0x146f90){var _0x4060fe=_0x146f90[_0x441d3a];var _0xa978c7=_0x4060fe&&_0x4060fe[_0x55e5('0x121')]?_0x4060fe['items']:[];_0x345b74[_0x55e5('0x31')]({'fromKey':_[_0x55e5('0x8a')](_0x4060fe[_0x55e5('0x122')])?undefined:_0x4060fe[_0x55e5('0x122')],'count':_0xa978c7[_0x55e5('0x55')],'rows':_0xa978c7});}})[_0x55e5('0x21')](handleError(_0x345b74,null));};exports[_0x55e5('0x123')]=function(_0x291e37,_0x815201){var _0x26dd0a={'raw':![],'where':{}};var _0x513375={};var _0x50edc7={'count':0x0,'rows':[]};return db[_0x55e5('0x4b')][_0x55e5('0x76')]({'where':{'id':_0x291e37[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x815201,null))[_0x55e5('0x16')](function(_0x199652){if(_0x199652){_0x513375['model']=_['keys'](db[_0x55e5('0xdd')][_0x55e5('0x4c')]);_0x513375[_0x55e5('0x4f')]=_[_0x55e5('0x50')](_0x291e37['query']);_0x513375['filters']=_['intersection'](_0x513375[_0x55e5('0x43')],_0x513375[_0x55e5('0x4f')]);_0x26dd0a[_0x55e5('0x53')]=_[_0x55e5('0x52')](_0x513375['model'],qs[_0x55e5('0x54')](_0x291e37[_0x55e5('0x4f')][_0x55e5('0x54')]));_0x26dd0a[_0x55e5('0x53')]=_0x26dd0a[_0x55e5('0x53')][_0x55e5('0x55')]?_0x26dd0a[_0x55e5('0x53')]:_0x513375[_0x55e5('0x43')];if(!_0x291e37[_0x55e5('0x4f')]['hasOwnProperty'](_0x55e5('0x57'))){_0x26dd0a['limit']=qs[_0x55e5('0x25')](_0x291e37[_0x55e5('0x4f')][_0x55e5('0x25')]);_0x26dd0a[_0x55e5('0x24')]=qs[_0x55e5('0x24')](_0x291e37['query'][_0x55e5('0x24')]);}_0x26dd0a[_0x55e5('0x70')]=qs['sort'](_0x291e37[_0x55e5('0x4f')][_0x55e5('0x58')]);_0x26dd0a[_0x55e5('0x59')]=qs[_0x55e5('0x51')](_['pick'](_0x291e37[_0x55e5('0x4f')],_0x513375[_0x55e5('0x51')]));_0x26dd0a[_0x55e5('0x59')][_0x55e5('0x71')]=_0x199652['id'];if(_0x291e37['query'][_0x55e5('0x5b')]){_0x26dd0a[_0x55e5('0x59')]=_[_0x55e5('0x5c')](_0x26dd0a[_0x55e5('0x59')],{'$or':_['map'](_0x26dd0a[_0x55e5('0x53')],function(_0x46cdd3){var _0x294cae={};_0x294cae[_0x46cdd3]={'$like':'%'+_0x291e37[_0x55e5('0x4f')][_0x55e5('0x5b')]+'%'};return _0x294cae;})});}_0x26dd0a=_['merge']({},_0x26dd0a,_0x291e37[_0x55e5('0x5e')]);return db[_0x55e5('0xdd')][_0x55e5('0x27')]({'where':_0x26dd0a[_0x55e5('0x59')]})[_0x55e5('0x16')](function(_0x889571){_0x50edc7[_0x55e5('0x27')]=_0x889571;if(_0x291e37[_0x55e5('0x4f')][_0x55e5('0x5f')]){_0x26dd0a['include']=[{'all':!![]}];}else{_0x26dd0a['include']=[{'model':db[_0x55e5('0x9e')],'as':'Contact','required':![]},{'model':db[_0x55e5('0xe5')],'as':_0x55e5('0x124'),'required':![]}];}return db['ChatOfflineMessage'][_0x55e5('0x60')](_0x26dd0a);})[_0x55e5('0x16')](function(_0x180f28){_0x50edc7[_0x55e5('0x72')]=_0x180f28;return _0x50edc7;});}})[_0x55e5('0x16')](respondWithFilteredResult(_0x815201,_0x26dd0a))['catch'](handleError(_0x815201,null));};exports[_0x55e5('0x125')]=function(_0x39e9d8,_0x472a38){return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0x39e9d8['params']['id']}})['then'](handleEntityNotFound(_0x472a38,null))[_0x55e5('0x16')](function(_0x5c6284){if(_0x5c6284){return _0x5c6284[_0x55e5('0x125')](_0x39e9d8['body'][_0x55e5('0x74')],_['omit'](_0x39e9d8[_0x55e5('0x68')],[_0x55e5('0x74'),'id'])||{})['spread'](function(_0x18e0a8){for(var _0x2f6892=0x0;_0x2f6892<_0x39e9d8[_0x55e5('0x68')][_0x55e5('0x74')][_0x55e5('0x55')];_0x2f6892+=0x1){socket[_0x55e5('0x126')](_0x55e5('0x127'),{'UserId':Number(_0x39e9d8['body'][_0x55e5('0x74')][_0x2f6892]),'ChatWebsiteId':Number(_0x39e9d8[_0x55e5('0x61')]['id'])});}return _0x18e0a8;});}})['then'](respondWithResult(_0x472a38,null))[_0x55e5('0x21')](handleError(_0x472a38,null));};exports[_0x55e5('0x128')]=function(_0x26cad0,_0x569f6d){return db[_0x55e5('0x4b')][_0x55e5('0x63')]({'where':{'id':_0x26cad0[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x569f6d,null))['then'](function(_0xdce87d){if(_0xdce87d){return _0xdce87d[_0x55e5('0x128')](_0x26cad0['query']['ids'])[_0x55e5('0x16')](function(){if(_[_0x55e5('0x129')](_0x26cad0[_0x55e5('0x4f')][_0x55e5('0x74')])){for(var _0x43684b=0x0;_0x43684b<_0x26cad0[_0x55e5('0x4f')]['ids'][_0x55e5('0x55')];_0x43684b+=0x1){socket[_0x55e5('0x126')]('userChatWebsite:remove',{'UserId':Number(_0x26cad0[_0x55e5('0x4f')][_0x55e5('0x74')][_0x43684b]),'ChatWebsiteId':Number(_0x26cad0[_0x55e5('0x61')]['id'])});}}else{socket[_0x55e5('0x126')](_0x55e5('0x12a'),{'UserId':Number(_0x26cad0['query']['ids']),'ChatWebsiteId':Number(_0x26cad0[_0x55e5('0x61')]['id'])});}});}})[_0x55e5('0x16')](respondWithStatusCode(_0x569f6d,null))[_0x55e5('0x21')](handleError(_0x569f6d,null));};exports[_0x55e5('0x12b')]=function(_0x1b4439,_0x2deca6){var _0xa02ee8={};var _0x4f1e47={};var _0x171fe7;var _0x1d509b;return db[_0x55e5('0x4b')][_0x55e5('0x76')]({'where':{'id':_0x1b4439[_0x55e5('0x61')]['id']}})[_0x55e5('0x16')](handleEntityNotFound(_0x2deca6,null))[_0x55e5('0x16')](function(_0x1f3fad){if(_0x1f3fad){_0x171fe7=_0x1f3fad;_0x4f1e47[_0x55e5('0x43')]=_[_0x55e5('0x50')](db[_0x55e5('0xc5')][_0x55e5('0x4c')]);_0x4f1e47[_0x55e5('0x4f')]=_[_0x55e5('0x50')](_0x1b4439['query']);_0x4f1e47[_0x55e5('0x51')]=_['intersection'](_0x4f1e47[_0x55e5('0x43')],_0x4f1e47['query']);_0xa02ee8['attributes']=_[_0x55e5('0x52')](_0x4f1e47[_0x55e5('0x43')],qs[_0x55e5('0x54')](_0x1b4439[_0x55e5('0x4f')][_0x55e5('0x54')]));_0xa02ee8[_0x55e5('0x53')]=_0xa02ee8[_0x55e5('0x53')]['length']?_0xa02ee8[_0x55e5('0x53')]:_0x4f1e47[_0x55e5('0x43')];_0xa02ee8['order']=qs[_0x55e5('0x58')](_0x1b4439[_0x55e5('0x4f')][_0x55e5('0x58')]);_0xa02ee8[_0x55e5('0x59')]=qs[_0x55e5('0x51')](_['pick'](_0x1b4439[_0x55e5('0x4f')],_0x4f1e47['filters']));if(_0x1b4439[_0x55e5('0x4f')][_0x55e5('0x5b')]){_0xa02ee8[_0x55e5('0x59')]=_[_0x55e5('0x5c')](_0xa02ee8[_0x55e5('0x59')],{'$or':_[_0x55e5('0x4a')](_0xa02ee8[_0x55e5('0x53')],function(_0x41d1f6){var _0x3ae380={};_0x3ae380[_0x41d1f6]={'$like':'%'+_0x1b4439[_0x55e5('0x4f')][_0x55e5('0x5b')]+'%'};return _0x3ae380;})});}_0xa02ee8=_[_0x55e5('0x5c')]({},_0xa02ee8,_0x1b4439[_0x55e5('0x5e')]);return _0x171fe7[_0x55e5('0x12b')](_0xa02ee8);}})[_0x55e5('0x16')](function(_0x30c517){if(_0x30c517){_0x1d509b=_0x30c517[_0x55e5('0x55')];if(!_0x1b4439['query'][_0x55e5('0x56')]('nolimit')){_0xa02ee8[_0x55e5('0x25')]=qs['limit'](_0x1b4439['query'][_0x55e5('0x25')]);_0xa02ee8[_0x55e5('0x24')]=qs['offset'](_0x1b4439['query'][_0x55e5('0x24')]);}return _0x171fe7['getAgents'](_0xa02ee8);}})[_0x55e5('0x16')](function(_0x100cbb){if(_0x100cbb){return _0x100cbb?{'count':_0x1d509b,'rows':_0x100cbb}:null;}})['then'](respondWithResult(_0x2deca6,null))['catch'](handleError(_0x2deca6,null));}; \ No newline at end of file +var _0xe088=['fromString','originalname','mimetype','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','options','Contact','fullname','internal','Tag','Tags','color','tag','getSnippet','getProactiveActions','License','increment','3.9.0','origin','replace','remote','x-real-ip','connection','remoteAddress','virtual','alignment','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','READ_COMMITTED','ChatApplication','findAndCountAll','stack','getApplications','addProactiveActions','chatProactiveAction','ids','omit','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','html-to-text','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','../../mysqldb','redis','localhost','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','update','destroy','get','UserProfileResource','end','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','index','Pause','map','ChatWebsite','rawAttributes','fieldName','query','keys','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','fields','find','create','body','address','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','addAvatar','filename','customerAvatar','file','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','root','server/files/images/logos/','download','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','From\x20is\x20mandatory','MapKey\x20is\x20mandatory','isEmpty','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','mapKey','from','List','Contacts','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','orderBy','priority','asc','list','defaults','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','interaction','messageId','created','autoclose','applications','push','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','startRouting','EventManager','offline','files','difference','ValidationError','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','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage'];(function(_0x58c82c,_0x20d6bc){var _0x49364b=function(_0x3eeca6){while(--_0x3eeca6){_0x58c82c['push'](_0x58c82c['shift']());}};_0x49364b(++_0x20d6bc);}(_0xe088,0x17f));var _0x8e08=function(_0x14bf63,_0xdbd373){_0x14bf63=_0x14bf63-0x0;var _0x410d22=_0xe088[_0x14bf63];return _0x410d22;};'use strict';var Mustache=require(_0x8e08('0x0'));var util=require(_0x8e08('0x1'));var path=require(_0x8e08('0x2'));var ejs=require(_0x8e08('0x3'));var fs=require('fs');var fs_extra=require(_0x8e08('0x4'));var _=require(_0x8e08('0x5'));var querystring=require('querystring');var htmlToText=require(_0x8e08('0x6'));var Redis=require('ioredis');var jayson=require(_0x8e08('0x7'));var qs=require(_0x8e08('0x8'));var logger=require(_0x8e08('0x9'))(_0x8e08('0xa'));var config=require(_0x8e08('0xb'));var APIBadRequestError=require('../../errors/api')[_0x8e08('0xc')];var APINotFoundError=require(_0x8e08('0xd'))[_0x8e08('0xe')];var APIOutOfIntervalError=require('../../errors/api')[_0x8e08('0xf')];var APIHandleError=require(_0x8e08('0xd'))[_0x8e08('0x10')];var APIConflictError=require('../../errors/api')['APIConflictError'];var wildcardUtils=require(_0x8e08('0x11'));var URL=require(_0x8e08('0x12'))['URL'];var db=require(_0x8e08('0x13'))['db'];config['redis']=_['defaults'](config[_0x8e08('0x14')],{'host':_0x8e08('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);var client=jayson[_0x8e08('0x16')][_0x8e08('0x17')]({'port':0x232c});var client9002=jayson[_0x8e08('0x16')][_0x8e08('0x17')]({'port':0x232a});var client9003=jayson['client'][_0x8e08('0x17')]({'port':0x232b});var client9001=jayson[_0x8e08('0x16')][_0x8e08('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x992c9b,_0x5c7aca,_0x3f3458,_0x3c25ca){return new Promise(function(_0x126b45,_0x14614b){var _0x44c027=_0x3c25ca||client;return _0x44c027[_0x8e08('0x18')](_0x992c9b,_0x3f3458)[_0x8e08('0x19')](function(_0x353f0f){logger[_0x8e08('0x1a')](_0x8e08('0x1b'),_0x5c7aca,_0x8e08('0x1c'));logger['debug'](_0x8e08('0x1d'),_0x5c7aca,_0x8e08('0x1c'),JSON[_0x8e08('0x1e')](_0x353f0f));if(_0x353f0f['error']){if(_0x353f0f['error'][_0x8e08('0x1f')]===0x1f4){logger[_0x8e08('0x20')](_0x8e08('0x1b'),_0x5c7aca,_0x353f0f[_0x8e08('0x20')]['message']);return _0x14614b(_0x353f0f[_0x8e08('0x20')][_0x8e08('0x21')]);}logger[_0x8e08('0x20')](_0x8e08('0x1b'),_0x5c7aca,_0x353f0f[_0x8e08('0x20')]['message']);return _0x126b45(_0x353f0f[_0x8e08('0x20')][_0x8e08('0x21')]);}else{logger['info'](_0x8e08('0x1b'),_0x5c7aca,_0x8e08('0x1c'));_0x126b45(_0x353f0f[_0x8e08('0x22')]['message']);}})[_0x8e08('0x23')](function(_0x467d8c){logger[_0x8e08('0x20')]('ChatWebsite,\x20%s,\x20%s',_0x5c7aca,_0x467d8c);_0x14614b(_0x467d8c);});});}function respondWithStatusCode(_0xee3f48,_0x243892){_0x243892=_0x243892||0xcc;return function(_0x2d0bd6){if(_0x2d0bd6){return _0xee3f48[_0x8e08('0x24')](_0x243892);}return _0xee3f48[_0x8e08('0x25')](_0x243892)['end']();};}function respondWithResult(_0xb0d32,_0x24ceb8){_0x24ceb8=_0x24ceb8||0xc8;return function(_0x4ce49f){if(_0x4ce49f){return _0xb0d32[_0x8e08('0x25')](_0x24ceb8)[_0x8e08('0x26')](_0x4ce49f);}};}function respondWithFilteredResult(_0x3ca397,_0x125412){return function(_0x266dac){if(_0x266dac){var _0x448dae=typeof _0x125412[_0x8e08('0x27')]==='undefined'&&typeof _0x125412[_0x8e08('0x28')]==='undefined';var _0x4bfc04=_0x266dac[_0x8e08('0x29')];var _0x1d3bbe=_0x448dae?0x0:_0x125412[_0x8e08('0x27')];var _0x2bcfd4=_0x448dae?_0x266dac[_0x8e08('0x29')]:_0x125412['offset']+_0x125412['limit'];var _0x441f2c;if(_0x2bcfd4>=_0x4bfc04){_0x2bcfd4=_0x4bfc04;_0x441f2c=0xc8;}else{_0x441f2c=0xce;}_0x3ca397['status'](_0x441f2c);return _0x3ca397[_0x8e08('0x2a')](_0x8e08('0x2b'),_0x1d3bbe+'-'+_0x2bcfd4+'/'+_0x4bfc04)[_0x8e08('0x26')](_0x266dac);}return null;};}function saveUpdates(_0x35e218){return function(_0x1d2b27){if(_0x1d2b27){return _0x1d2b27[_0x8e08('0x2c')](_0x35e218)[_0x8e08('0x19')](function(_0x5655b7){return _0x5655b7;});}return null;};}function removeEntity(_0x4acc3b){return function(_0xba578b){if(_0xba578b){return _0xba578b[_0x8e08('0x2d')]()[_0x8e08('0x19')](function(){var _0x1360d5=_0xba578b[_0x8e08('0x2e')]({'plain':!![]});var _0x35806e='ChatWebsites';return db[_0x8e08('0x2f')][_0x8e08('0x2d')]({'where':{'type':_0x35806e,'resourceId':_0x1360d5['id']}})['then'](function(){return _0xba578b;});})[_0x8e08('0x19')](function(){_0x4acc3b[_0x8e08('0x25')](0xcc)[_0x8e08('0x30')]();});}};}function handleEntityNotFound(_0x37c7a3){return function(_0x83ae8d){if(!_0x83ae8d){_0x37c7a3[_0x8e08('0x24')](0x194);}return _0x83ae8d;};}function handleError(_0x49d568,_0x73a76b){_0x73a76b=_0x73a76b||0x1f4;return function(_0x177a34){logger[_0x8e08('0x20')](_0x177a34['stack']);if(_0x177a34[_0x8e08('0x31')]){delete _0x177a34[_0x8e08('0x31')];}_0x49d568[_0x8e08('0x25')](_0x73a76b)[_0x8e08('0x32')](_0x177a34);};}function createInteractionObject(_0x20a36b,_0x792267,_0x407f1d,_0x22b571){var _0x3eb5ca=require(_0x8e08('0x33'));var _0x668bf6=new _0x3eb5ca();var _0x3c0809=_0x668bf6[_0x8e08('0x34')](_0x407f1d[_0x8e08('0x35')])[_0x8e08('0x36')]();var _0x87d9ce=_0x792267[_0x8e08('0x37')];if(_0x407f1d[_0x8e08('0x38')]){_0x87d9ce=_0x407f1d[_0x8e08('0x38')];}else if(_0x407f1d[_0x8e08('0x39')]){_0x87d9ce=_[_0x8e08('0x3a')](_0x407f1d['x-forwarded-for']['split'](','));}return{'ContactId':_0x22b571['id'],'ChatWebsiteId':_0x20a36b,'from':(_0x22b571[_0x8e08('0x3b')]||'')+'\x20'+(_0x22b571[_0x8e08('0x3c')]||''),'customerIp':_0x87d9ce,'customerPort':_0x407f1d['x-real-port']?_0x407f1d[_0x8e08('0x3d')]:null,'referer':_0x792267[_0x8e08('0x3e')],'browserName':_0x3c0809['browser'][_0x8e08('0x31')]&&_0x3c0809[_0x8e08('0x3f')][_0x8e08('0x40')]?util[_0x8e08('0x41')](_0x8e08('0x42'),_0x3c0809[_0x8e08('0x3f')][_0x8e08('0x31')],_0x3c0809[_0x8e08('0x3f')][_0x8e08('0x40')]):_0x8e08('0x43'),'browserVersion':_0x3c0809['browser'][_0x8e08('0x40')]||'unknown','osName':util[_0x8e08('0x41')](_0x8e08('0x42'),_0x3c0809['os']['name'],_0x3c0809['os'][_0x8e08('0x40')]),'osVersion':_0x3c0809['os']['version'],'deviceModel':_0x3c0809[_0x8e08('0x44')]['model']&&_0x3c0809[_0x8e08('0x44')][_0x8e08('0x45')]?util[_0x8e08('0x41')](_0x8e08('0x46'),_0x3c0809[_0x8e08('0x44')]['model'],_0x3c0809[_0x8e08('0x44')]['vendor'],_0x3c0809[_0x8e08('0x44')][_0x8e08('0x47')]):null,'deviceVendor':_0x3c0809[_0x8e08('0x44')][_0x8e08('0x45')],'deviceType':_0x3c0809['device']['type'],'formData':JSON['stringify'](_0x792267)};}exports[_0x8e08('0x48')]=function(_0x4d3742,_0xf15ddf){var _0x4c2624={'include':[{'model':db[_0x8e08('0x49')],'as':'mandatoryDispositionPause'}]},_0x48a23d={},_0x375a6f={'count':0x0,'rows':[]};var _0x1c12ad=_[_0x8e08('0x4a')](db[_0x8e08('0x4b')][_0x8e08('0x4c')],function(_0x4d9bf6){return{'name':_0x4d9bf6[_0x8e08('0x4d')],'type':_0x4d9bf6[_0x8e08('0x47')]['key']};});_0x48a23d['model']=_[_0x8e08('0x4a')](_0x1c12ad,_0x8e08('0x31'));_0x48a23d[_0x8e08('0x4e')]=_[_0x8e08('0x4f')](_0x4d3742[_0x8e08('0x4e')]);_0x48a23d[_0x8e08('0x50')]=_['intersection'](_0x48a23d[_0x8e08('0x51')],_0x48a23d[_0x8e08('0x4e')]);_0x4c2624['attributes']=_[_0x8e08('0x52')](_0x48a23d['model'],qs['fields'](_0x4d3742[_0x8e08('0x4e')]['fields']));_0x4c2624[_0x8e08('0x53')]=_0x4c2624[_0x8e08('0x53')][_0x8e08('0x54')]?_0x4c2624[_0x8e08('0x53')]:_0x48a23d[_0x8e08('0x51')];if(!_0x4d3742[_0x8e08('0x4e')][_0x8e08('0x55')](_0x8e08('0x56'))){_0x4c2624['limit']=qs['limit'](_0x4d3742[_0x8e08('0x4e')]['limit']);_0x4c2624[_0x8e08('0x27')]=qs[_0x8e08('0x27')](_0x4d3742['query'][_0x8e08('0x27')]);}_0x4c2624[_0x8e08('0x57')]=qs[_0x8e08('0x58')](_0x4d3742['query'][_0x8e08('0x58')]);_0x4c2624[_0x8e08('0x59')]=qs[_0x8e08('0x50')](_[_0x8e08('0x5a')](_0x4d3742[_0x8e08('0x4e')],_0x48a23d[_0x8e08('0x50')]),_0x1c12ad);if(_0x4d3742[_0x8e08('0x4e')]['filter']){_0x4c2624['where']=_[_0x8e08('0x5b')](_0x4c2624[_0x8e08('0x59')],{'$or':_['map'](_0x1c12ad,function(_0x338e9f){if(_0x338e9f[_0x8e08('0x47')]!=='VIRTUAL'){var _0x287fea={};_0x287fea[_0x338e9f['name']]={'$like':'%'+_0x4d3742[_0x8e08('0x4e')][_0x8e08('0x5c')]+'%'};return _0x287fea;}})});}_0x4c2624=_[_0x8e08('0x5b')]({},_0x4c2624,_0x4d3742['options']);var _0x692712={'where':_0x4c2624['where']};return db[_0x8e08('0x4b')]['count'](_0x692712)[_0x8e08('0x19')](function(_0x4eb101){_0x375a6f[_0x8e08('0x29')]=_0x4eb101;if(_0x4d3742[_0x8e08('0x4e')][_0x8e08('0x5d')]){_0x4c2624[_0x8e08('0x5e')]=[{'all':!![]}];}return db[_0x8e08('0x4b')][_0x8e08('0x5f')](_0x4c2624);})[_0x8e08('0x19')](function(_0x3294ee){_0x375a6f[_0x8e08('0x60')]=_0x3294ee;return _0x375a6f;})[_0x8e08('0x19')](respondWithFilteredResult(_0xf15ddf,_0x4c2624))[_0x8e08('0x23')](handleError(_0xf15ddf,null));};exports[_0x8e08('0x61')]=function(_0x38b3b1,_0x569764){var _0x19e199={'raw':![],'where':{'id':_0x38b3b1[_0x8e08('0x62')]['id']},'include':[{'model':db[_0x8e08('0x49')],'as':'mandatoryDispositionPause'}]},_0x2d1f9b={};_0x2d1f9b[_0x8e08('0x51')]=_['keys'](db[_0x8e08('0x4b')]['rawAttributes']);_0x2d1f9b[_0x8e08('0x4e')]=_[_0x8e08('0x4f')](_0x38b3b1[_0x8e08('0x4e')]);_0x2d1f9b['filters']=_['intersection'](_0x2d1f9b['model'],_0x2d1f9b[_0x8e08('0x4e')]);_0x19e199[_0x8e08('0x53')]=_['intersection'](_0x2d1f9b[_0x8e08('0x51')],qs[_0x8e08('0x63')](_0x38b3b1['query'][_0x8e08('0x63')]));_0x19e199[_0x8e08('0x53')]=_0x19e199[_0x8e08('0x53')][_0x8e08('0x54')]?_0x19e199[_0x8e08('0x53')]:_0x2d1f9b[_0x8e08('0x51')];if(_0x38b3b1[_0x8e08('0x4e')][_0x8e08('0x5d')]){_0x19e199[_0x8e08('0x5e')]=[{'all':!![]}];}_0x19e199=_[_0x8e08('0x5b')]({},_0x19e199,_0x38b3b1['options']);return db[_0x8e08('0x4b')][_0x8e08('0x64')](_0x19e199)[_0x8e08('0x19')](handleEntityNotFound(_0x569764,null))[_0x8e08('0x19')](respondWithResult(_0x569764,null))[_0x8e08('0x23')](handleError(_0x569764,null));};exports[_0x8e08('0x65')]=function(_0x4ed0ee,_0x1ce7ea){if(!wildcardUtils['testWildcardValidity'](_0x4ed0ee['body']['address'])){return handleError(_0x1ce7ea,null)(new APIBadRequestError('\x22'+_0x4ed0ee[_0x8e08('0x66')][_0x8e08('0x67')]+_0x8e08('0x68')));}return db[_0x8e08('0x4b')][_0x8e08('0x65')](_0x4ed0ee['body'],{})[_0x8e08('0x19')](function(_0x70755b){var _0x5896f6=_0x4ed0ee['user']['get']({'plain':!![]});if(!_0x5896f6)throw new Error(_0x8e08('0x69'));if(_0x5896f6[_0x8e08('0x6a')]===_0x8e08('0x6b')){var _0x154c7d=_0x70755b[_0x8e08('0x2e')]({'plain':!![]});var _0x27ef1d='ChatWebsites';return db[_0x8e08('0x6c')][_0x8e08('0x64')]({'where':{'name':_0x27ef1d,'userProfileId':_0x5896f6[_0x8e08('0x6d')]},'raw':!![]})[_0x8e08('0x19')](function(_0xdbe474){if(_0xdbe474&&_0xdbe474['autoAssociation']===0x0){return db[_0x8e08('0x2f')][_0x8e08('0x65')]({'name':_0x154c7d[_0x8e08('0x31')],'resourceId':_0x154c7d['id'],'type':_0xdbe474[_0x8e08('0x31')],'sectionId':_0xdbe474['id']},{})[_0x8e08('0x19')](function(){return _0x70755b;});}else{return _0x70755b;}})[_0x8e08('0x23')](function(_0x9af027){logger[_0x8e08('0x20')](_0x8e08('0x6e'),_0x9af027);throw _0x9af027;});}return _0x70755b;})[_0x8e08('0x19')](respondWithResult(_0x1ce7ea,0xc9))[_0x8e08('0x23')](handleError(_0x1ce7ea,null));};exports['update']=function(_0x44bd16,_0x360172){if(!wildcardUtils[_0x8e08('0x6f')](_0x44bd16[_0x8e08('0x66')][_0x8e08('0x67')])){return handleError(_0x360172,null)(new APIBadRequestError('\x22'+_0x44bd16[_0x8e08('0x66')][_0x8e08('0x67')]+'\x22\x20is\x20not\x20a\x20valid\x20website\x20domain'));}if(_0x44bd16[_0x8e08('0x66')]['id']){delete _0x44bd16[_0x8e08('0x66')]['id'];}return db['ChatWebsite'][_0x8e08('0x64')]({'where':{'id':_0x44bd16['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x8e08('0x19')](handleEntityNotFound(_0x360172,null))[_0x8e08('0x19')](saveUpdates(_0x44bd16[_0x8e08('0x66')],null))['then'](respondWithResult(_0x360172,null))[_0x8e08('0x23')](handleError(_0x360172,null));};exports[_0x8e08('0x2d')]=function(_0x21583a,_0x403fda){return db[_0x8e08('0x4b')]['find']({'where':{'id':_0x21583a['params']['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x403fda,null))[_0x8e08('0x19')](removeEntity(_0x403fda,null))[_0x8e08('0x23')](handleError(_0x403fda,null));};exports[_0x8e08('0x70')]=function(_0x11bff9,_0x39cb17){return db[_0x8e08('0x4b')][_0x8e08('0x70')]()[_0x8e08('0x19')](respondWithResult(_0x39cb17,null))[_0x8e08('0x23')](handleError(_0x39cb17,null));};exports[_0x8e08('0x71')]=function(_0x3b570c,_0x50135b){if(_0x3b570c['body']['id']){delete _0x3b570c[_0x8e08('0x66')]['id'];}return db['ChatWebsite'][_0x8e08('0x64')]({'where':{'id':_0x3b570c['params']['id']}})['then'](handleEntityNotFound(_0x50135b,null))[_0x8e08('0x19')](function(_0x2a6c23){if(_0x2a6c23){_0x3b570c[_0x8e08('0x66')][_0x8e08('0x72')]=_0x2a6c23['id'];return db['Disposition']['create'](_0x3b570c[_0x8e08('0x66')]);}})[_0x8e08('0x19')](respondWithResult(_0x50135b,null))['catch'](handleError(_0x50135b,null));};exports[_0x8e08('0x73')]=function(_0x34380a,_0x30f5a0){var _0x5e4ab7={'raw':![],'where':{}};var _0xb0bda4={};var _0x2ced17={'count':0x0,'rows':[]};return db[_0x8e08('0x4b')][_0x8e08('0x74')]({'where':{'id':_0x34380a[_0x8e08('0x62')]['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x30f5a0,null))[_0x8e08('0x19')](function(_0x57fbd9){if(_0x57fbd9){_0xb0bda4[_0x8e08('0x51')]=_[_0x8e08('0x4f')](db[_0x8e08('0x75')][_0x8e08('0x4c')]);_0xb0bda4[_0x8e08('0x4e')]=_[_0x8e08('0x4f')](_0x34380a[_0x8e08('0x4e')]);_0xb0bda4['filters']=_[_0x8e08('0x52')](_0xb0bda4[_0x8e08('0x51')],_0xb0bda4[_0x8e08('0x4e')]);_0x5e4ab7['attributes']=_['intersection'](_0xb0bda4[_0x8e08('0x51')],qs[_0x8e08('0x63')](_0x34380a[_0x8e08('0x4e')][_0x8e08('0x63')]));_0x5e4ab7[_0x8e08('0x53')]=_0x5e4ab7['attributes']['length']?_0x5e4ab7[_0x8e08('0x53')]:_0xb0bda4[_0x8e08('0x51')];if(!_0x34380a[_0x8e08('0x4e')][_0x8e08('0x55')](_0x8e08('0x56'))){_0x5e4ab7['limit']=qs[_0x8e08('0x28')](_0x34380a[_0x8e08('0x4e')][_0x8e08('0x28')]);_0x5e4ab7[_0x8e08('0x27')]=qs[_0x8e08('0x27')](_0x34380a[_0x8e08('0x4e')][_0x8e08('0x27')]);}_0x5e4ab7[_0x8e08('0x57')]=qs[_0x8e08('0x58')](_0x34380a[_0x8e08('0x4e')][_0x8e08('0x58')]);_0x5e4ab7[_0x8e08('0x59')]=qs[_0x8e08('0x50')](_[_0x8e08('0x5a')](_0x34380a['query'],_0xb0bda4[_0x8e08('0x50')]));_0x5e4ab7[_0x8e08('0x59')]['ChatWebsiteId']=_0x57fbd9['id'];if(_0x34380a['query'][_0x8e08('0x5c')]){_0x5e4ab7[_0x8e08('0x59')]=_[_0x8e08('0x5b')](_0x5e4ab7[_0x8e08('0x59')],{'$or':_['map'](_0x5e4ab7[_0x8e08('0x53')],function(_0x4a811c){var _0x16e3da={};_0x16e3da[_0x4a811c]={'$like':'%'+_0x34380a['query'][_0x8e08('0x5c')]+'%'};return _0x16e3da;})});}_0x5e4ab7=_[_0x8e08('0x5b')]({},_0x5e4ab7,_0x34380a['options']);return db[_0x8e08('0x75')][_0x8e08('0x29')]({'where':_0x5e4ab7[_0x8e08('0x59')]})[_0x8e08('0x19')](function(_0xc799aa){_0x2ced17['count']=_0xc799aa;if(_0x34380a[_0x8e08('0x4e')][_0x8e08('0x5d')]){_0x5e4ab7[_0x8e08('0x5e')]=[{'all':!![]}];}return db[_0x8e08('0x75')][_0x8e08('0x5f')](_0x5e4ab7);})[_0x8e08('0x19')](function(_0x48084b){_0x2ced17[_0x8e08('0x60')]=_0x48084b;return _0x2ced17;});}})['then'](respondWithFilteredResult(_0x30f5a0,_0x5e4ab7))[_0x8e08('0x23')](handleError(_0x30f5a0,null));};exports[_0x8e08('0x76')]=function(_0x5ea7de,_0x592cde){return db[_0x8e08('0x4b')][_0x8e08('0x64')]({'where':{'id':_0x5ea7de['params']['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x592cde,null))[_0x8e08('0x19')](function(_0xc27984){if(_0xc27984){return _0xc27984[_0x8e08('0x76')](_0x5ea7de['query']['ids']);}})[_0x8e08('0x19')](respondWithStatusCode(_0x592cde,null))['catch'](handleError(_0x592cde,null));};exports[_0x8e08('0x77')]=function(_0x4e07a6,_0x151620){if(_0x4e07a6['body']['id']){delete _0x4e07a6[_0x8e08('0x66')]['id'];}return db[_0x8e08('0x4b')][_0x8e08('0x64')]({'where':{'id':_0x4e07a6[_0x8e08('0x62')]['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x151620,null))[_0x8e08('0x19')](function(_0x3fbcd2){if(_0x3fbcd2){_0x4e07a6[_0x8e08('0x66')][_0x8e08('0x72')]=_0x3fbcd2['id'];return db[_0x8e08('0x78')][_0x8e08('0x65')](_0x4e07a6['body']);}})[_0x8e08('0x19')](respondWithResult(_0x151620,null))[_0x8e08('0x23')](handleError(_0x151620,null));};exports[_0x8e08('0x79')]=function(_0x3c8426,_0x2ec663){var _0x39abb0={'raw':![],'where':{}};var _0x3ea1b2={};var _0x107d23={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8e08('0x74')]({'where':{'id':_0x3c8426['params']['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x2ec663,null))['then'](function(_0x4cf16f){if(_0x4cf16f){_0x3ea1b2[_0x8e08('0x51')]=_[_0x8e08('0x4f')](db[_0x8e08('0x78')][_0x8e08('0x4c')]);_0x3ea1b2['query']=_['keys'](_0x3c8426[_0x8e08('0x4e')]);_0x3ea1b2[_0x8e08('0x50')]=_[_0x8e08('0x52')](_0x3ea1b2[_0x8e08('0x51')],_0x3ea1b2[_0x8e08('0x4e')]);_0x39abb0[_0x8e08('0x53')]=_[_0x8e08('0x52')](_0x3ea1b2[_0x8e08('0x51')],qs[_0x8e08('0x63')](_0x3c8426['query'][_0x8e08('0x63')]));_0x39abb0[_0x8e08('0x53')]=_0x39abb0[_0x8e08('0x53')][_0x8e08('0x54')]?_0x39abb0[_0x8e08('0x53')]:_0x3ea1b2[_0x8e08('0x51')];if(!_0x3c8426[_0x8e08('0x4e')][_0x8e08('0x55')]('nolimit')){_0x39abb0[_0x8e08('0x28')]=qs['limit'](_0x3c8426[_0x8e08('0x4e')][_0x8e08('0x28')]);_0x39abb0[_0x8e08('0x27')]=qs['offset'](_0x3c8426[_0x8e08('0x4e')][_0x8e08('0x27')]);}_0x39abb0[_0x8e08('0x57')]=qs['sort'](_0x3c8426[_0x8e08('0x4e')]['sort']);_0x39abb0[_0x8e08('0x59')]=qs[_0x8e08('0x50')](_[_0x8e08('0x5a')](_0x3c8426['query'],_0x3ea1b2['filters']));_0x39abb0[_0x8e08('0x59')]['ChatWebsiteId']=_0x4cf16f['id'];if(_0x3c8426[_0x8e08('0x4e')]['filter']){_0x39abb0[_0x8e08('0x59')]=_[_0x8e08('0x5b')](_0x39abb0[_0x8e08('0x59')],{'$or':_[_0x8e08('0x4a')](_0x39abb0[_0x8e08('0x53')],function(_0x4a20b0){var _0x3db535={};_0x3db535[_0x4a20b0]={'$like':'%'+_0x3c8426[_0x8e08('0x4e')][_0x8e08('0x5c')]+'%'};return _0x3db535;})});}_0x39abb0=_[_0x8e08('0x5b')]({},_0x39abb0,_0x3c8426['options']);return db[_0x8e08('0x78')][_0x8e08('0x29')]({'where':_0x39abb0[_0x8e08('0x59')]})[_0x8e08('0x19')](function(_0x40589e){_0x107d23[_0x8e08('0x29')]=_0x40589e;if(_0x3c8426[_0x8e08('0x4e')][_0x8e08('0x5d')]){_0x39abb0[_0x8e08('0x5e')]=[{'all':!![]}];}return db[_0x8e08('0x78')]['findAll'](_0x39abb0);})['then'](function(_0x30867c){_0x107d23[_0x8e08('0x60')]=_0x30867c;return _0x107d23;});}})['then'](respondWithFilteredResult(_0x2ec663,_0x39abb0))[_0x8e08('0x23')](handleError(_0x2ec663,null));};exports['removeAnswers']=function(_0x2fe77b,_0x57258c){return db[_0x8e08('0x4b')]['find']({'where':{'id':_0x2fe77b[_0x8e08('0x62')]['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x57258c,null))[_0x8e08('0x19')](function(_0x525db5){if(_0x525db5){return _0x525db5[_0x8e08('0x7a')](_0x2fe77b[_0x8e08('0x4e')]['ids']);}})[_0x8e08('0x19')](respondWithStatusCode(_0x57258c,null))['catch'](handleError(_0x57258c,null));};exports['addLogo']=function(_0x3fe7e9,_0x5cc853){_0x3fe7e9[_0x8e08('0x66')][_0x8e08('0x7b')]=_0x3fe7e9['file']['filename'];return db[_0x8e08('0x4b')]['find']({'where':{'id':_0x3fe7e9['params']['id']}})['then'](handleEntityNotFound(_0x5cc853,null))[_0x8e08('0x19')](saveUpdates(_0x3fe7e9[_0x8e08('0x66')],null))['then'](respondWithResult(_0x5cc853,null))[_0x8e08('0x23')](handleError(_0x5cc853,null));};exports[_0x8e08('0x7c')]=function(_0x1e3218,_0x5af382){_0x1e3218[_0x8e08('0x66')]['agentAvatar']=_0x1e3218['file'][_0x8e08('0x7d')];return db[_0x8e08('0x4b')][_0x8e08('0x64')]({'where':{'id':_0x1e3218[_0x8e08('0x62')]['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x5af382,null))[_0x8e08('0x19')](saveUpdates(_0x1e3218[_0x8e08('0x66')],null))[_0x8e08('0x19')](respondWithResult(_0x5af382,null))['catch'](handleError(_0x5af382,null));};exports['addCustomerAvatar']=function(_0x1ffce7,_0x8adb14){_0x1ffce7[_0x8e08('0x66')][_0x8e08('0x7e')]=_0x1ffce7[_0x8e08('0x7f')]['filename'];return db[_0x8e08('0x4b')][_0x8e08('0x64')]({'where':{'id':_0x1ffce7[_0x8e08('0x62')]['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x8adb14,null))['then'](saveUpdates(_0x1ffce7['body'],null))[_0x8e08('0x19')](respondWithResult(_0x8adb14,null))[_0x8e08('0x23')](handleError(_0x8adb14,null));};exports['addSystemAvatar']=function(_0x360971,_0x358673){_0x360971['body'][_0x8e08('0x80')]=_0x360971['file'][_0x8e08('0x7d')];return db['ChatWebsite'][_0x8e08('0x64')]({'where':{'id':_0x360971[_0x8e08('0x62')]['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x358673,null))['then'](saveUpdates(_0x360971['body'],null))['then'](respondWithResult(_0x358673,null))['catch'](handleError(_0x358673,null));};exports[_0x8e08('0x81')]=function(_0x28c61d,_0x5e86c0){var _0xdb3d72=path[_0x8e08('0x82')](config['root'],_0x8e08('0x83'));var _0x1d52f5={'where':{'id':_0x28c61d[_0x8e08('0x62')]['id']},'attributes':['id',_0x8e08('0x7b')],'raw':!![]};var _0x3e3c56=![];return require(_0x8e08('0x84'))[_0x8e08('0x85')]()[_0x8e08('0x19')](function(_0x56d97d){if(_0x56d97d){_0x3e3c56=_0x56d97d[_0x8e08('0x86')];}})[_0x8e08('0x19')](function(){return db[_0x8e08('0x4b')][_0x8e08('0x64')](_0x1d52f5);})[_0x8e08('0x19')](handleEntityNotFound(_0x5e86c0,null))['then'](function(_0x2665ec){if(_0x2665ec){if(!_[_0x8e08('0x87')](_0x2665ec[_0x8e08('0x7b')])){if(fs['existsSync'](path[_0x8e08('0x82')](config[_0x8e08('0x88')],'server/files/images/logos/',_0x2665ec[_0x8e08('0x7b')]))&&_0x3e3c56){_0xdb3d72=path[_0x8e08('0x82')](config[_0x8e08('0x88')],_0x8e08('0x89'),_0x2665ec[_0x8e08('0x7b')]);}}return _0x5e86c0[_0x8e08('0x8a')](_0xdb3d72);}})[_0x8e08('0x23')](handleError(_0x5e86c0,null));};exports['getAvatar']=function(_0x4ea567,_0x235d01){var _0x145e83=path[_0x8e08('0x82')](config[_0x8e08('0x88')],'server/files/images/avatars/default_avatar.png');var _0xd6e221={'where':{'id':_0x4ea567[_0x8e08('0x62')]['id']},'attributes':['id',_0x8e08('0x8b')],'raw':!![]};return db['ChatWebsite']['find'](_0xd6e221)[_0x8e08('0x19')](handleEntityNotFound(_0x235d01,null))[_0x8e08('0x19')](function(_0x29ed3a){if(_0x29ed3a){if(!_[_0x8e08('0x87')](_0x29ed3a[_0x8e08('0x8b')])){if(fs[_0x8e08('0x8c')](path[_0x8e08('0x82')](config[_0x8e08('0x88')],'server/files/images/avatars/',_0x29ed3a[_0x8e08('0x8b')]))){_0x145e83=path[_0x8e08('0x82')](config[_0x8e08('0x88')],_0x8e08('0x8d'),_0x29ed3a[_0x8e08('0x8b')]);}}return _0x235d01[_0x8e08('0x8a')](_0x145e83);}})[_0x8e08('0x23')](handleError(_0x235d01,null));};exports[_0x8e08('0x8e')]=function(_0x1fef24,_0x4df9f0){var _0x4e475d=path[_0x8e08('0x82')](config[_0x8e08('0x88')],_0x8e08('0x8f'));var _0x4fba40={'where':{'id':_0x1fef24[_0x8e08('0x62')]['id']},'attributes':['id',_0x8e08('0x7e'),_0x8e08('0x90')],'raw':!![]};return db[_0x8e08('0x4b')][_0x8e08('0x64')](_0x4fba40)[_0x8e08('0x19')](handleEntityNotFound(_0x4df9f0,null))[_0x8e08('0x19')](function(_0x3c4686){if(_0x3c4686){if(!_['isNil'](_0x3c4686['customerAvatar'])){if(fs[_0x8e08('0x8c')](path[_0x8e08('0x82')](config['root'],_0x8e08('0x8d'),_0x3c4686[_0x8e08('0x7e')]))&&_0x3c4686['showCustomerAvatar']){_0x4e475d=path['join'](config[_0x8e08('0x88')],_0x8e08('0x8d'),_0x3c4686['customerAvatar']);}}return _0x4df9f0[_0x8e08('0x8a')](_0x4e475d);}})[_0x8e08('0x23')](handleError(_0x4df9f0,null));};exports['getSystemAvatar']=function(_0x46121a,_0x515619){var _0x40ba5f=path[_0x8e08('0x82')](config[_0x8e08('0x88')],_0x8e08('0x91'));var _0x308b5={'where':{'id':_0x46121a[_0x8e08('0x62')]['id']},'attributes':['id',_0x8e08('0x80')],'raw':!![]};return db['ChatWebsite']['find'](_0x308b5)['then'](handleEntityNotFound(_0x515619,null))[_0x8e08('0x19')](function(_0x3a2928){if(_0x3a2928){if(!_[_0x8e08('0x87')](_0x3a2928[_0x8e08('0x80')])){if(fs[_0x8e08('0x8c')](path[_0x8e08('0x82')](config[_0x8e08('0x88')],'server/files/images/avatars/',_0x3a2928[_0x8e08('0x80')]))){_0x40ba5f=path[_0x8e08('0x82')](config[_0x8e08('0x88')],'server/files/images/avatars/',_0x3a2928['systemAvatar']);}}return _0x515619[_0x8e08('0x8a')](_0x40ba5f);}})[_0x8e08('0x23')](handleError(_0x515619,null));};function checkWebsiteInterval(_0x17f792){var _0x488ca1=_0x17f792[_0x8e08('0x92')];if(!_0x488ca1){return Promise[_0x8e08('0x93')](_0x17f792);}var _0x1c9d86=_0x17f792[_0x8e08('0x94')]||undefined;return _0x488ca1[_0x8e08('0x95')](_0x1c9d86)[_0x8e08('0x19')](function(_0x7d7ef1){if(!_0x7d7ef1){throw new APIOutOfIntervalError();}return _0x17f792;});}exports[_0x8e08('0x96')]=function(_0x2a5d82,_0x1e8a4f){var _0x5e616f={'body':_0x2a5d82[_0x8e08('0x66')],'channel':_0x8e08('0x97')};var _0x3a77a8=[];var _0x32558b=[];var _0x3a58d7={};var _0x587ec6=![];if(_0x2a5d82[_0x8e08('0x66')]['id']){delete _0x2a5d82[_0x8e08('0x66')]['id'];}if(_[_0x8e08('0x87')](_0x2a5d82[_0x8e08('0x66')]['from'])){throw new APIBadRequestError(_0x8e08('0x98'));}if(_[_0x8e08('0x87')](_0x2a5d82[_0x8e08('0x66')]['mapKey'])){throw new APIBadRequestError(_0x8e08('0x99'));}if(_[_0x8e08('0x9a')](_0x2a5d82['body'][_0x8e08('0x66')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x28facb=_0x2a5d82[_0x8e08('0x66')][_0x8e08('0x37')]&&_0x2a5d82[_0x8e08('0x66')][_0x8e08('0x3e')];return db[_0x8e08('0x9b')][_0x8e08('0x70')]()[_0x8e08('0x19')](function(_0x3be226){if(!_0x3be226){throw new Error(_0x8e08('0x9c'));}_0x3a77a8=Object['keys'](_0x3be226)[_0x8e08('0x5c')](function(_0x4b7b3c){return![_0x8e08('0x9d'),_0x8e08('0x9e')][_0x8e08('0x9f')](_0x4b7b3c);});_0x32558b=Object[_0x8e08('0x4f')](_0x3be226)[_0x8e08('0x5c')](function(_0x3ffc4f){return![_0x8e08('0x9d'),_0x8e08('0x9e'),_0x8e08('0xa0'),_0x8e08('0xa1')][_0x8e08('0x9f')](_0x3ffc4f);});if(!_['includes'](_0x32558b,_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xa2')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x32558b[_0x8e08('0x82')](',\x20'));}_0x3a58d7[_0x2a5d82['body'][_0x8e08('0xa2')]]=_0x2a5d82['body'][_0x8e08('0xa3')];})['then'](function(){return db[_0x8e08('0x4b')][_0x8e08('0x64')]({'where':{'id':_0x2a5d82[_0x8e08('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x8e08('0xa4'),'include':[{'model':db[_0x8e08('0x9b')],'as':_0x8e08('0xa5'),'where':_0x3a58d7,'limit':0x1,'order':[[_0x8e08('0x9e'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x8e08('0xa6')},{'model':db[_0x8e08('0x92')],'as':_0x8e08('0x92'),'include':[{'model':db[_0x8e08('0x92')],'as':_0x8e08('0xa7'),'attributes':['id',_0x8e08('0xa8')],'raw':!![]}]}]});})[_0x8e08('0x19')](function(_0x3790e0){if(!_0x3790e0){throw new APINotFoundError(util[_0x8e08('0x41')](_0x8e08('0xa9'),_0x2a5d82[_0x8e08('0x62')]['id']));}if(_0x28facb){return checkWebsiteInterval(_0x3790e0);}return _0x3790e0;})[_0x8e08('0x19')](function(_0x4e0d93){_0x5e616f[_0x8e08('0xaa')]=_0x4e0d93;_0x5e616f['applications']=_[_0x8e08('0xab')](_0x4e0d93['Applications'],[_0x8e08('0xac')],[_0x8e08('0xad')]);if(_0x5e616f[_0x8e08('0xaa')]['Applications']){delete _0x5e616f[_0x8e08('0xaa')][_0x8e08('0xa6')];}_0x5e616f['list']=_0x4e0d93[_0x8e08('0xa4')]||{'id':_0x4e0d93[_0x8e08('0xa1')]};if(_0x5e616f[_0x8e08('0xae')]&&_0x5e616f[_0x8e08('0xae')][_0x8e08('0xa5')]['length']){return _0x5e616f[_0x8e08('0xae')][_0x8e08('0xa5')][0x0];}var _0x1d530e=_[_0x8e08('0xaf')](_0x2a5d82['body'],{'firstName':_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xa3')],'ListId':_0x4e0d93[_0x8e08('0xa1')]});_0x1d530e[_0x2a5d82['body'][_0x8e08('0xa2')]]=_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xa3')];return db['CmContact'][_0x8e08('0x65')](_0x1d530e,{'fields':_0x3a77a8,'raw':!![]});})[_0x8e08('0x19')](function(_0xdbd84e){_0x5e616f[_0x8e08('0xb0')]=_0xdbd84e;var _0x4522f3=createInteractionObject(_0x2a5d82[_0x8e08('0x62')]['id'],_0x2a5d82['body'],_0x2a5d82[_0x8e08('0xb1')],_0xdbd84e);var _0x4726dc={'ChatWebsiteId':_0x2a5d82[_0x8e08('0x62')]['id']};if(_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xb2')]){_0x4726dc[_0x8e08('0xb2')]=_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xb2')];_0x4726dc[_0x8e08('0xb3')]=![];return db[_0x8e08('0xb4')][_0x8e08('0x64')]({'where':_0x4726dc})['then'](function(_0x275ed9){var _0x126924=_0x2a5d82['body'][_0x8e08('0x37')]&&_0x2a5d82[_0x8e08('0x66')]['referer'];if(_0x275ed9){_0x587ec6=!![];return _0x275ed9;}else if(!_0x126924&&_0x275ed9&&_0x275ed9[_0x8e08('0xb3')]){throw new APIConflictError(_0x8e08('0xb5'));}_0x4522f3[_0x8e08('0xb2')]=_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xb2')];_0x4522f3[_0x8e08('0xb6')]=_0x2a5d82['body'][_0x8e08('0xb6')];return db['ChatInteraction'][_0x8e08('0x65')](_0x4522f3);});}_0x4726dc['ContactId']=_0xdbd84e['id'];if(_0x2a5d82['body']['interaction']&&_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xb7')]['id']){_0x4726dc['id']=_0x2a5d82['body'][_0x8e08('0xb7')]['id'];return db[_0x8e08('0xb4')][_0x8e08('0x64')]({'where':_0x4726dc})[_0x8e08('0x19')](function(_0x4a324a){var _0x1c3ea0=_0x2a5d82['body']['customerIp']&&_0x2a5d82[_0x8e08('0x66')]['referer'];if(!_0x1c3ea0&&_0x4a324a&&_0x4a324a[_0x8e08('0xb3')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x4a324a){_0x587ec6=!![];return _0x4a324a;}else{return db['ChatInteraction'][_0x8e08('0x65')](_0x4522f3);}});}return db[_0x8e08('0xb4')][_0x8e08('0x65')](_0x4522f3);})[_0x8e08('0x19')](function(_0x6581d){if(!_0x587ec6){return _0x6581d;}var _0x41678c={'from':(_0x5e616f[_0x8e08('0xb0')][_0x8e08('0x3b')]||'')+'\x20'+(_0x5e616f[_0x8e08('0xb0')][_0x8e08('0x3c')]||'')};if(_0x2a5d82['body'][_0x8e08('0xb2')]&&_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xb8')]&&_0x2a5d82['body'][_0x8e08('0xb2')]!=_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xb8')]){_0x41678c[_0x8e08('0xb2')]=_0x2a5d82[_0x8e08('0x66')]['messageId'];}return _0x6581d[_0x8e08('0x2c')](_0x41678c);})[_0x8e08('0x19')](function(_0x431711){_0x5e616f[_0x8e08('0xb7')]=_0x431711[_0x8e08('0x2e')]({'plain':!![]});_0x5e616f[_0x8e08('0xb7')][_0x8e08('0xb9')]=!_0x587ec6;if(_0x5e616f[_0x8e08('0xb7')][_0x8e08('0xb9')]){if(_0x5e616f[_0x8e08('0xaa')][_0x8e08('0xba')]){_0x5e616f[_0x8e08('0xbb')][_0x8e08('0xbc')]({'id':0x0,'priority':_0x5e616f[_0x8e08('0xbb')][_0x8e08('0x54')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x8e08('0xbd')][_0x8e08('0x65')]({'body':_0x2a5d82[_0x8e08('0x66')][_0x8e08('0x66')],'ChatWebsiteId':_0x2a5d82[_0x8e08('0x62')]['id'],'ChatInteractionId':_0x431711['id'],'direction':'in','ContactId':_0x5e616f['contact']['id'],'AttachmentId':_0x2a5d82[_0x8e08('0x66')][_0x8e08('0xbe')]});})[_0x8e08('0x19')](function(_0x3662c3){_0x5e616f[_0x8e08('0x21')]=_0x3662c3;if(!_0x5e616f[_0x8e08('0xb7')][_0x8e08('0xbf')]){return;}return db[_0x8e08('0xc0')][_0x8e08('0x64')]({'attributes':['id',_0x8e08('0x31')],'where':{'id':_0x5e616f[_0x8e08('0xb7')][_0x8e08('0xbf')]}});})['then'](function(_0x197ea6){if(_0x197ea6){_0x5e616f[_0x8e08('0xbb')][_0x8e08('0xc1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x197ea6[_0x8e08('0x31')]+','+(_0x5e616f[_0x8e08('0xaa')][_0x8e08('0xc2')]||0xa),'interval':'*,*,*,*'});_0x5e616f[_0x8e08('0xc3')]=!![];}if(!_0x5e616f[_0x8e08('0xb7')][_0x8e08('0xc4')]){return;}return db[_0x8e08('0xc5')]['find']({'attributes':['id',_0x8e08('0x31')],'where':{'id':_0x5e616f[_0x8e08('0xb7')][_0x8e08('0xc4')]}});})[_0x8e08('0x19')](function(_0x1a405a){if(_0x1a405a){_0x5e616f['applications'][_0x8e08('0xc1')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1a405a[_0x8e08('0x31')]+','+(_0x5e616f['account'][_0x8e08('0xc6')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x8e08('0xc7'),_0x5e616f);})[_0x8e08('0x19')](function(_0x3f2b0a){respondWithRpcPromise(_0x8e08('0xc8'),'EventManager',{'event':_0x8e08('0x96'),'message':_0x3f2b0a},client9002);return _0x3f2b0a;})['then'](respondWithResult(_0x1e8a4f,null))['catch'](APIHandleError(_0x1e8a4f));};exports[_0x8e08('0xc9')]=function(_0x3b9b76,_0xb5799d){var _0x478df6,_0x185738,_0x11ea1d;var _0xebc01b=[];var _0xeeb450={};var _0x5cb7cf=_0x3b9b76[_0x8e08('0xca')]||[];var _0x38223c=[];var _0x30bb61;return db[_0x8e08('0x9b')][_0x8e08('0x70')]()[_0x8e08('0x19')](function(_0x22c57e){if(!_0x22c57e){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0xebc01b=_[_0x8e08('0xcb')](_[_0x8e08('0x4f')](_0x22c57e),['createdAt','updatedAt','CompanyId',_0x8e08('0xa1')]);if(_0x3b9b76['body']['id']){delete _0x3b9b76[_0x8e08('0x66')]['id'];}if(_[_0x8e08('0x87')](_0x3b9b76[_0x8e08('0x66')][_0x8e08('0xa3')])){throw _0xb5799d[_0x8e08('0x25')](0x1f4)[_0x8e08('0x32')](new db['Sequelize'][(_0x8e08('0xcc'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x3b9b76[_0x8e08('0x66')][_0x8e08('0x66')])||_0x3b9b76['body']['body']===''){throw _0xb5799d[_0x8e08('0x25')](0x1f4)[_0x8e08('0x32')](new db[(_0x8e08('0xcd'))][(_0x8e08('0xcc'))](_0x8e08('0xce')));}if(_[_0x8e08('0x87')](_0x3b9b76[_0x8e08('0x66')][_0x8e08('0xcf')])){throw _0xb5799d['status'](0x1f4)[_0x8e08('0x32')](new db[(_0x8e08('0xcd'))][(_0x8e08('0xcc'))](_0x8e08('0xd0')+_0xebc01b));}if(!_[_0x8e08('0x9f')](_0xebc01b,_0x3b9b76[_0x8e08('0x66')][_0x8e08('0xcf')])){throw _0xb5799d[_0x8e08('0x25')](0x1f4)[_0x8e08('0x32')](new db[(_0x8e08('0xcd'))][(_0x8e08('0xcc'))](_0x8e08('0xd1')+_0xebc01b));}_0xeeb450[_0x3b9b76[_0x8e08('0x66')]['mapKeyOffline']]=_0x3b9b76[_0x8e08('0x66')][_0x8e08('0xa3')];})[_0x8e08('0x19')](function(){return db[_0x8e08('0x4b')]['find']({'where':{'id':_0x3b9b76[_0x8e08('0x62')]['id']},'include':[{'model':db[_0x8e08('0xd2')],'as':_0x8e08('0xa4')},{'model':db[_0x8e08('0xd3')],'as':_0x8e08('0xd3')}]});})['then'](handleEntityNotFound(_0xb5799d,null))[_0x8e08('0x19')](function(_0x196830){if(_0x196830&&_0x196830[_0x8e08('0xa4')]){_0x185738=_0x196830;var _0x1bd711=_[_0x8e08('0xaf')](_0x3b9b76[_0x8e08('0x66')],{'firstName':_0x3b9b76[_0x8e08('0x66')][_0x8e08('0xa3')],'phone':_0x3b9b76[_0x8e08('0x66')][_0x8e08('0xa3')],'ListId':_0x196830[_0x8e08('0xa1')]});_0x1bd711[_0x3b9b76[_0x8e08('0x66')][_0x8e08('0xcf')]]=_0x3b9b76[_0x8e08('0x66')][_0x8e08('0xa3')];return db[_0x8e08('0x9b')][_0x8e08('0xd4')]({'where':_0xeeb450,'defaults':_0x1bd711});}})['spread'](function(_0x3f19f2){if(_0x3f19f2){_0x11ea1d=_0x3f19f2;var _0x33b246=fs[_0x8e08('0xd5')](path[_0x8e08('0x82')](config[_0x8e08('0x88')],_0x8e08('0xd6')),_0x8e08('0xd7'));var _0x1aee3d=ejs[_0x8e08('0xd8')](_0x33b246,{'body':_[_0x8e08('0xd9')](_0x3b9b76[_0x8e08('0x66')][_0x8e08('0x66')]),'bodyTitle':_0x185738['offlineMessageBody']});return db[_0x8e08('0xda')][_0x8e08('0x65')]({'body':_0x1aee3d,'plainBody':htmlToText[_0x8e08('0xdb')](_0x1aee3d),'ContactId':_0x3f19f2['id'],'ChatWebsiteId':_0x185738['id']});}})['then'](function(_0x3db236){_0x30bb61=_0x3db236;if(_0x5cb7cf[_0x8e08('0x54')]){var _0x286601=_0x5cb7cf[_0x8e08('0x4a')](function(_0xc2a4d5){return{'name':_0xc2a4d5[_0x8e08('0xdc')],'basename':_0xc2a4d5['filename'],'type':_0xc2a4d5[_0x8e08('0xdd')],'ChatOfflineMessageId':_0x3db236['id']};});_0x38223c=_0x286601['map'](_0x200c8e=>{var _0x42373d={'filename':_0x200c8e[_0x8e08('0x31')],'path':path[_0x8e08('0x82')](config['root'],'server','files',_0x8e08('0xde'),_0x8e08('0xdf'),_0x200c8e['basename'])};return _0x42373d;});if(!_0x185738[_0x8e08('0xe0')]){return db[_0x8e08('0xe1')][_0x8e08('0xe2')](function(_0x584e4c){return db[_0x8e08('0xe3')][_0x8e08('0xe4')](_0x286601,{'transaction':_0x584e4c});});}}})[_0x8e08('0x19')](function(){if(_0x30bb61){_0x478df6=_0x30bb61;return db[_0x8e08('0xd3')][_0x8e08('0x74')]({'where':{'service':!![]},'include':[{'model':db[_0x8e08('0xe5')],'as':_0x8e08('0xe6'),'raw':!![],'include':[{'model':db[_0x8e08('0xe7')],'as':_0x8e08('0xe7'),'raw':!![]}]}]});}})[_0x8e08('0x19')](function(_0x472921){if(_0x472921&&_0x472921[_0x8e08('0xe6')]&&_0x185738[_0x8e08('0xe8')]&&_0x185738['forwardOfflineAddress']){var _0x1d5942=_0x472921[_0x8e08('0xe9')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x1d5942,'message':{'from':util[_0x8e08('0x41')](_0x8e08('0xea'),_0x472921[_0x8e08('0x31')],_0x472921['email']||_0x472921[_0x8e08('0xe6')][_0x8e08('0x6b')]),'to':_0x185738[_0x8e08('0xeb')],'subject':_0x185738[_0x8e08('0xec')],'html':_0x478df6[_0x8e08('0x66')],'attachments':_0x38223c}},client9003)['then'](function(){return _0x478df6;})[_0x8e08('0x23')](function(_0x3c7b3e){logger[_0x8e08('0x20')](_0x3c7b3e);});}})['then'](function(){if(_0x185738&&_0x185738[_0x8e08('0xe0')]&&_0x185738[_0x8e08('0xed')]){var _0x61c6a0=[];if(_0x5cb7cf[_0x8e08('0x54')]){_0x61c6a0=_0x5cb7cf[_0x8e08('0x4a')](function(_0x104ece){return{'name':_0x104ece[_0x8e08('0xdc')],'basename':_0x104ece[_0x8e08('0x7d')],'type':_0x104ece[_0x8e08('0xdd')],'ChatOfflineMessageId':_0x30bb61['id']};});}var _0xb242ad;if(!_['isNil'](_0x185738[_0x8e08('0xee')])){var _0x46a25c=_[_0x8e08('0x4a')](_0x3b9b76['body'],function(_0x3d6fa0){return _0x3d6fa0;});var _0x287422=_[_0x8e08('0xef')](_0x46a25c)[0x0];var _0x152088=_[_0x8e08('0xf0')](_0x287422,function(_0x40de9a){return _0x40de9a;});_0xb242ad=_0x152088[0x1][_0x185738[_0x8e08('0xee')]];}var _0x43cdb4={'from':_0x11ea1d[_0x8e08('0xf1')],'firstName':_0x11ea1d['firstName'],'lastName':_0x11ea1d[_0x8e08('0x3c')],'mapKey':_0x8e08('0xf1'),'message':{'from':_0x11ea1d[_0x8e08('0xf1')],'to':_0x185738[_0x8e08('0xd3')][_0x8e08('0xf1')],'cc':'','subject':_['isNil'](_0xb242ad)?_0x185738['offlineMessageSubject']:_0xb242ad,'messageId':'','sentAt':new Date(),'attach':_0x61c6a0[_0x8e08('0x54')],'attachments':_0x61c6a0,'originChannel':_0x8e08('0xf2'),'ChatWebsiteId':_0x185738['id'],'ChatOfflineMessageId':_0x478df6['id'],'originTo':_0x185738[_0x8e08('0xd3')][_0x8e08('0xf1')]},'body':_0x478df6[_0x8e08('0x66')]};var _0xbe20f3={'account':{'id':_0x185738[_0x8e08('0xed')]},'body':_0x43cdb4,'log':_0x8e08('0xf3')};return respondWithRpcPromise(_0x8e08('0xf3'),_0x8e08('0xf4'),_0xbe20f3,client9001)[_0x8e08('0x19')](function(){return _0x478df6;})[_0x8e08('0x23')](function(_0x2e7649){logger[_0x8e08('0x20')](_0x2e7649);});}return;})[_0x8e08('0x19')](function(){if(_0x478df6){return _0x478df6;}})[_0x8e08('0x19')](respondWithResult(_0xb5799d,null))[_0x8e08('0x23')](function(){for(var _0x4c5717 of _0x5cb7cf){var _0x48a0bb=path[_0x8e08('0x82')](config[_0x8e08('0x88')],'server',_0x8e08('0xca'),_0x8e08('0xde'),_0x8e08('0xdf'),_0x4c5717['filename']);fs_extra[_0x8e08('0xf5')](_0x48a0bb)[_0x8e08('0x23')](function(_0x469adc){logger['error'](_0x8e08('0xf6'),_0x48a0bb,_0x469adc);});}});};exports['addInteraction']=function(_0x1d8516,_0x215a3d){return db[_0x8e08('0xb4')][_0x8e08('0x64')]({'where':{'id':_0x1d8516[_0x8e08('0x62')]['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x215a3d,null))[_0x8e08('0x19')](function(_0x23c3f2){if(_0x23c3f2){return _0x23c3f2[_0x8e08('0xf7')](_0x1d8516[_0x8e08('0x66')]['ids'],_['omit'](_0x1d8516[_0x8e08('0x66')],['ids','id'])||{});}})[_0x8e08('0x19')](respondWithResult(_0x215a3d,null))['catch'](handleError(_0x215a3d,null));};exports['getInteractions']=function(_0x33d421,_0x2e5393){var _0x1963f0={'raw':![],'where':{}};var _0x19b87d={};var _0x75956d={'count':0x0,'rows':[]};return db[_0x8e08('0x4b')][_0x8e08('0x74')]({'where':{'id':_0x33d421[_0x8e08('0x62')]['id']}})['then'](handleEntityNotFound(_0x2e5393,null))[_0x8e08('0x19')](function(_0x47ae2e){if(_0x47ae2e){_0x19b87d[_0x8e08('0x51')]=_[_0x8e08('0x4f')](db[_0x8e08('0xb4')][_0x8e08('0x4c')]);_0x19b87d[_0x8e08('0x4e')]=_[_0x8e08('0x4f')](_0x33d421[_0x8e08('0x4e')]);_0x19b87d[_0x8e08('0x50')]=_['intersection'](_0x19b87d['model'],_0x19b87d[_0x8e08('0x4e')]);_0x1963f0[_0x8e08('0x53')]=_[_0x8e08('0x52')](_0x19b87d[_0x8e08('0x51')],qs['fields'](_0x33d421[_0x8e08('0x4e')][_0x8e08('0x63')]));_0x1963f0[_0x8e08('0x53')]=_0x1963f0[_0x8e08('0x53')][_0x8e08('0x54')]?_0x1963f0[_0x8e08('0x53')]:_0x19b87d[_0x8e08('0x51')];if(!_0x33d421[_0x8e08('0x4e')]['hasOwnProperty'](_0x8e08('0x56'))){_0x1963f0['limit']=qs[_0x8e08('0x28')](_0x33d421[_0x8e08('0x4e')]['limit']);_0x1963f0[_0x8e08('0x27')]=qs[_0x8e08('0x27')](_0x33d421[_0x8e08('0x4e')][_0x8e08('0x27')]);}_0x1963f0[_0x8e08('0x57')]=qs[_0x8e08('0x58')](_0x33d421[_0x8e08('0x4e')][_0x8e08('0x58')]);_0x1963f0[_0x8e08('0x59')]=qs[_0x8e08('0x50')](_[_0x8e08('0x5a')](_0x33d421[_0x8e08('0x4e')],_0x19b87d[_0x8e08('0x50')]));_0x1963f0[_0x8e08('0x59')]['ChatWebsiteId']=_0x47ae2e['id'];if(_0x33d421[_0x8e08('0x4e')]['filter']){_0x1963f0['where']=_[_0x8e08('0x5b')](_0x1963f0[_0x8e08('0x59')],{'$or':_[_0x8e08('0x4a')](_0x1963f0[_0x8e08('0x53')],function(_0x4067c6){var _0x4b4c04={};_0x4b4c04[_0x4067c6]={'$like':'%'+_0x33d421['query'][_0x8e08('0x5c')]+'%'};return _0x4b4c04;})});}_0x1963f0=_[_0x8e08('0x5b')]({},_0x1963f0,_0x33d421[_0x8e08('0xf8')]);return db[_0x8e08('0xb4')][_0x8e08('0x29')]({'where':_0x1963f0[_0x8e08('0x59')]})[_0x8e08('0x19')](function(_0x5f2634){_0x75956d[_0x8e08('0x29')]=_0x5f2634;if(_0x33d421[_0x8e08('0x4e')][_0x8e08('0x5d')]){_0x1963f0['include']=[{'model':db['CmContact'],'as':_0x8e08('0xf9'),'required':![]},{'model':db[_0x8e08('0xc0')],'as':'Owner','attributes':['name',_0x8e08('0xfa'),_0x8e08('0xfb')],'required':![]},{'model':db[_0x8e08('0xfc')],'as':_0x8e08('0xfd'),'attributes':['id','name',_0x8e08('0xfe')],'where':_0x33d421['query'][_0x8e08('0xff')]?{'id':_0x33d421[_0x8e08('0x4e')][_0x8e08('0xff')]}:undefined,'required':_0x33d421[_0x8e08('0x4e')]['tag']?!![]:![]}];}return db[_0x8e08('0xb4')][_0x8e08('0x5f')](_0x1963f0);})['then'](function(_0x35381e){_0x75956d[_0x8e08('0x60')]=_0x35381e;return _0x75956d;});}})[_0x8e08('0x19')](respondWithFilteredResult(_0x2e5393,_0x1963f0))['catch'](handleError(_0x2e5393,null));};exports[_0x8e08('0x100')]=function(_0x1b59f0,_0x5d72c5){var _0x514397=0x0;var _0x334251=0x0;var _0x123b68=![];var _0x4fe22a;var _0x7e6393;return db['ChatWebsite'][_0x8e08('0x64')]({'where':{'id':_0x1b59f0[_0x8e08('0x62')]['id']},'include':[{'model':db[_0x8e08('0x92')],'as':_0x8e08('0x92'),'include':[{'model':db[_0x8e08('0x92')],'as':'Intervals','attributes':['id',_0x8e08('0xa8')]}]}]})[_0x8e08('0x19')](handleEntityNotFound(_0x5d72c5,null))['then'](function(_0x2579d5){if(_0x2579d5){_0x4fe22a=_0x2579d5;return _0x2579d5[_0x8e08('0x101')]({'raw':!![]});}})[_0x8e08('0x19')](function(_0x1c3636){if(_0x4fe22a){if(_0x1c3636){_0x7e6393=_0x1c3636;}}return require(_0x8e08('0x84'))[_0x8e08('0x85')]();})[_0x8e08('0x19')](function(_0x360df7){if(_0x360df7){_0x334251=_0x360df7['virtual'];_0x123b68=_0x360df7['custom'];}})['then'](function(){return db[_0x8e08('0xb4')][_0x8e08('0x29')]({'where':{'closed':![]}});})['then'](function(_0x82e183){_0x514397=_0x82e183;if(_0x334251&&_0x82e183>_0x334251){return db[_0x8e08('0x102')][_0x8e08('0x74')]({'where':{'id':0x1}})[_0x8e08('0x19')](function(_0x38460f){if(_0x38460f){_0x38460f[_0x8e08('0x103')]('chatLicenseExceeded');}});}})['then'](function(){var _0x9e7b8=_0x4fe22a['Interval'];var _0x547d8d=_0x4fe22a[_0x8e08('0x94')]||undefined;return _0x9e7b8?_0x9e7b8[_0x8e08('0x95')](_0x547d8d):!![];})[_0x8e08('0x19')](function(_0x2a1020){var _0x10633a=fs[_0x8e08('0xd5')](path[_0x8e08('0x82')](config['root'],'server/files/chat/iframe.ejs'),_0x8e08('0xd7'));var _0x541292=_0x8e08('0x104');var _0x439367=![];try{const _0xbadfc1=new URL(_0x4fe22a[_0x8e08('0x67')]);_0x4fe22a[_0x8e08('0x67')]=_0xbadfc1[_0x8e08('0x105')];}catch(_0x419858){}var _0x152956;if(_0x1b59f0[_0x8e08('0xb1')]['referer']){_0x1b59f0[_0x8e08('0xb1')][_0x8e08('0x3e')]=_0x1b59f0['headers']['referer'][_0x8e08('0x106')](/\/$/,'');_0x152956=wildcardUtils['testWebsiteWithWildcard'](_0x4fe22a['address'],_0x1b59f0[_0x8e08('0xb1')]['referer']);}else{_0x1b59f0[_0x8e08('0xb1')][_0x8e08('0x3e')]=_0x4fe22a['address'];_0x152956=!![];}var _0x370b90={'chatVersion':_0x541292,'chatWebsiteAddressOrigin':_0x152956?_0x1b59f0[_0x8e08('0xb1')][_0x8e08('0x3e')]:_0x4fe22a[_0x8e08('0x67')],'remote':_0x4fe22a[_0x8e08('0x107')],'query':querystring[_0x8e08('0x1e')](_[_0x8e08('0x5b')](_0x4fe22a[_0x8e08('0x2e')]({'plain':!![]}),{'customerIp':_0x1b59f0[_0x8e08('0xb1')][_0x8e08('0x39')]||_0x1b59f0['headers'][_0x8e08('0x108')]||_0x1b59f0[_0x8e08('0x109')][_0x8e08('0x10a')]||_0x1b59f0['ip'],'referer':_0x1b59f0[_0x8e08('0xb1')][_0x8e08('0x3e')],'openedInteractions':_0x514397,'maxInteractions':_0x334251,'virtual':_0x123b68[_0x8e08('0x10b')],'online':_0x2a1020,'custom':_0x123b68,'address':_0x152956?_0x1b59f0['headers'][_0x8e08('0x3e')]:null}))[_0x8e08('0x106')](/'/g,'\x5c\x27')};_0x5d72c5['send'](ejs[_0x8e08('0xd8')](Mustache[_0x8e08('0xd8')](_0x10633a,_0x370b90),{'proactiveActions':_0x7e6393,'alignment':_0x4fe22a[_0x8e08('0x10c')],'verticalAlignment':_0x4fe22a[_0x8e08('0x10d')],'div_color':_0x4fe22a[_0x8e08('0xfe')],'labelText':_0x4fe22a[_0x8e08('0x10e')],'text_color':_0x4fe22a['textColor'],'text_button_color':_0x4fe22a[_0x8e08('0x10f')],'button_color':_0x4fe22a[_0x8e08('0x110')],'background_color':_0x4fe22a[_0x8e08('0x111')],'hideWhenOffline':_0x4fe22a[_0x8e08('0x112')],'intervalId':_0x4fe22a[_0x8e08('0x113')],'isDevelopment':_0x439367,'chatVersion':_0x541292}));})[_0x8e08('0x23')](handleError(_0x5d72c5,null));};exports['addApplications']=function(_0x1275f4,_0x4404e6){var _0x5f4341=_0x1275f4[_0x8e08('0x62')]['id'];var _0x5b057d=_0x1275f4['body'];var _0x12512e=0xc8;var _0x59caef=null;return db[_0x8e08('0xe1')][_0x8e08('0xe2')]({'isolationLevel':db['sequelize'][_0x8e08('0x114')]['ISOLATION_LEVELS'][_0x8e08('0x115')]},function(_0x1b09c3){return db[_0x8e08('0x4b')]['findOne']({'where':{'id':_0x5f4341},'transaction':_0x1b09c3})[_0x8e08('0x19')](function(_0x52a462){if(_0x52a462){return db['ChatApplication'][_0x8e08('0x2d')]({'where':{'ChatWebsiteId':_0x5f4341},'transaction':_0x1b09c3})[_0x8e08('0x19')](function(){var _0x4fe987=_[_0x8e08('0x4a')](_0x5b057d,function(_0x1e16e9){_0x1e16e9[_0x8e08('0x72')]=_0x5f4341;return _0x1e16e9;});return db[_0x8e08('0x116')]['bulkCreate'](_0x4fe987,{'transaction':_0x1b09c3});});}else{_0x12512e=0x194;_0x59caef=[];}});})[_0x8e08('0x19')](function(){if(_0x12512e!==0x194){return db[_0x8e08('0x116')][_0x8e08('0x117')]({'where':{'ChatWebsiteId':_0x5f4341},'order':_0x8e08('0xac')})[_0x8e08('0x19')](function(_0x416b96){_0x59caef=_0x416b96;});}})[_0x8e08('0x23')](function(_0x4d6d33){_0x12512e=0x1f4;logger[_0x8e08('0x20')](_0x4d6d33[_0x8e08('0x118')]);if(_0x4d6d33['name']){delete _0x4d6d33[_0x8e08('0x31')];}_0x59caef=_0x4d6d33;})['finally'](function(){if(_0x59caef===null){_0x4404e6[_0x8e08('0x24')](_0x12512e);}else{if(_0x12512e===0x1f4){_0x4404e6['status'](_0x12512e)[_0x8e08('0x32')](_0x59caef);}else{_0x4404e6['status'](_0x12512e)[_0x8e08('0x26')](_0x59caef);}}});};exports[_0x8e08('0x119')]=function(_0x8f2493,_0x51ae9a){var _0x4acd72={};var _0x16764e={};var _0x2a06d6;var _0xac0e6d;return db[_0x8e08('0x4b')]['findOne']({'where':{'id':_0x8f2493[_0x8e08('0x62')]['id']}})['then'](handleEntityNotFound(_0x51ae9a,null))['then'](function(_0x458513){if(_0x458513){_0x2a06d6=_0x458513;_0x16764e[_0x8e08('0x51')]=_['keys'](db['ChatApplication'][_0x8e08('0x4c')]);_0x16764e[_0x8e08('0x4e')]=_[_0x8e08('0x4f')](_0x8f2493[_0x8e08('0x4e')]);_0x16764e[_0x8e08('0x50')]=_[_0x8e08('0x52')](_0x16764e[_0x8e08('0x51')],_0x16764e['query']);_0x4acd72['attributes']=_[_0x8e08('0x52')](_0x16764e[_0x8e08('0x51')],qs[_0x8e08('0x63')](_0x8f2493['query'][_0x8e08('0x63')]));_0x4acd72[_0x8e08('0x53')]=_0x4acd72[_0x8e08('0x53')][_0x8e08('0x54')]?_0x4acd72[_0x8e08('0x53')]:_0x16764e[_0x8e08('0x51')];_0x4acd72[_0x8e08('0x57')]=qs[_0x8e08('0x58')](_0x8f2493['query'][_0x8e08('0x58')]);_0x4acd72[_0x8e08('0x59')]=qs[_0x8e08('0x50')](_[_0x8e08('0x5a')](_0x8f2493[_0x8e08('0x4e')],_0x16764e[_0x8e08('0x50')]));if(_0x8f2493[_0x8e08('0x4e')][_0x8e08('0x5c')]){_0x4acd72[_0x8e08('0x59')]=_['merge'](_0x4acd72[_0x8e08('0x59')],{'$or':_[_0x8e08('0x4a')](_0x4acd72[_0x8e08('0x53')],function(_0x191850){var _0xcefd9b={};_0xcefd9b[_0x191850]={'$like':'%'+_0x8f2493[_0x8e08('0x4e')][_0x8e08('0x5c')]+'%'};return _0xcefd9b;})});}_0x4acd72=_[_0x8e08('0x5b')]({},_0x4acd72,_0x8f2493[_0x8e08('0xf8')]);return _0x2a06d6[_0x8e08('0x119')](_0x4acd72);}})[_0x8e08('0x19')](function(_0xd75ca5){if(_0xd75ca5){_0xac0e6d=_0xd75ca5[_0x8e08('0x54')];if(!_0x8f2493[_0x8e08('0x4e')]['hasOwnProperty'](_0x8e08('0x56'))){_0x4acd72[_0x8e08('0x28')]=qs[_0x8e08('0x28')](_0x8f2493[_0x8e08('0x4e')]['limit']);_0x4acd72[_0x8e08('0x27')]=qs[_0x8e08('0x27')](_0x8f2493[_0x8e08('0x4e')][_0x8e08('0x27')]);}return _0x2a06d6['getApplications'](_0x4acd72);}})[_0x8e08('0x19')](function(_0x2a40d1){if(_0x2a40d1){return _0x2a40d1?{'count':_0xac0e6d,'rows':_0x2a40d1}:null;}})[_0x8e08('0x19')](respondWithResult(_0x51ae9a,null))[_0x8e08('0x23')](handleError(_0x51ae9a,null));};exports[_0x8e08('0x11a')]=function(_0x3e3a6d,_0x519e9c){return db[_0x8e08('0x11b')][_0x8e08('0x64')]({'where':{'id':_0x3e3a6d['params']['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x519e9c,null))[_0x8e08('0x19')](function(_0x429629){if(_0x429629){return _0x429629[_0x8e08('0x11a')](_0x3e3a6d[_0x8e08('0x66')][_0x8e08('0x11c')],_[_0x8e08('0x11d')](_0x3e3a6d[_0x8e08('0x66')],['ids','id'])||{});}})['then'](respondWithResult(_0x519e9c,null))['catch'](handleError(_0x519e9c,null));};exports['getProactiveActions']=function(_0x521cc1,_0x287c59){var _0x4213c3={};var _0x3fecd2={};var _0x4fbfc4;var _0x37b2d0;return db['ChatWebsite'][_0x8e08('0x74')]({'where':{'id':_0x521cc1['params']['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x287c59,null))[_0x8e08('0x19')](function(_0x37820f){if(_0x37820f){_0x4fbfc4=_0x37820f;_0x3fecd2['model']=_[_0x8e08('0x4f')](db['ChatProactiveAction'][_0x8e08('0x4c')]);_0x3fecd2[_0x8e08('0x4e')]=_['keys'](_0x521cc1['query']);_0x3fecd2[_0x8e08('0x50')]=_[_0x8e08('0x52')](_0x3fecd2[_0x8e08('0x51')],_0x3fecd2[_0x8e08('0x4e')]);_0x4213c3[_0x8e08('0x53')]=_[_0x8e08('0x52')](_0x3fecd2[_0x8e08('0x51')],qs[_0x8e08('0x63')](_0x521cc1[_0x8e08('0x4e')]['fields']));_0x4213c3['attributes']=_0x4213c3[_0x8e08('0x53')][_0x8e08('0x54')]?_0x4213c3[_0x8e08('0x53')]:_0x3fecd2['model'];_0x4213c3[_0x8e08('0x57')]=qs[_0x8e08('0x58')](_0x521cc1[_0x8e08('0x4e')][_0x8e08('0x58')]);_0x4213c3[_0x8e08('0x59')]=qs[_0x8e08('0x50')](_[_0x8e08('0x5a')](_0x521cc1[_0x8e08('0x4e')],_0x3fecd2['filters']));if(_0x521cc1['query'][_0x8e08('0x5c')]){_0x4213c3[_0x8e08('0x59')]=_['merge'](_0x4213c3[_0x8e08('0x59')],{'$or':_[_0x8e08('0x4a')](_0x4213c3['attributes'],function(_0xc73ac3){var _0x3a65d6={};_0x3a65d6[_0xc73ac3]={'$like':'%'+_0x521cc1[_0x8e08('0x4e')]['filter']+'%'};return _0x3a65d6;})});}_0x4213c3=_[_0x8e08('0x5b')]({},_0x4213c3,_0x521cc1[_0x8e08('0xf8')]);return _0x4fbfc4[_0x8e08('0x101')](_0x4213c3);}})[_0x8e08('0x19')](function(_0x1f4d71){if(_0x1f4d71){_0x37b2d0=_0x1f4d71['length'];if(!_0x521cc1[_0x8e08('0x4e')][_0x8e08('0x55')](_0x8e08('0x56'))){_0x4213c3['limit']=qs['limit'](_0x521cc1[_0x8e08('0x4e')]['limit']);_0x4213c3[_0x8e08('0x27')]=qs[_0x8e08('0x27')](_0x521cc1[_0x8e08('0x4e')][_0x8e08('0x27')]);}return _0x4fbfc4[_0x8e08('0x101')](_0x4213c3);}})[_0x8e08('0x19')](function(_0x57eb07){if(_0x57eb07){return _0x57eb07?{'count':_0x37b2d0,'rows':_0x57eb07}:null;}})['then'](respondWithResult(_0x287c59,null))['catch'](handleError(_0x287c59,null));};exports['getFields']=function(_0x944659,_0x2fb3c1){var _0x1b8ff9=_0x944659[_0x8e08('0x4e')][_0x8e08('0x11e')]===_0x8e08('0x11f')?_0x8e08('0x120'):_0x8e08('0x121');return db[_0x8e08('0x4b')][_0x8e08('0x64')]({'attributes':['id',_0x1b8ff9],'where':{'id':_0x944659['params']['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x2fb3c1,null))[_0x8e08('0x19')](function(_0x1ded80){if(_0x1ded80){var _0x47f976=_0x1ded80[_0x1b8ff9];var _0x1d6091=_0x47f976&&_0x47f976['items']?_0x47f976[_0x8e08('0x122')]:[];_0x2fb3c1[_0x8e08('0x32')]({'fromKey':_['isNil'](_0x47f976[_0x8e08('0x123')])?undefined:_0x47f976[_0x8e08('0x123')],'count':_0x1d6091[_0x8e08('0x54')],'rows':_0x1d6091});}})[_0x8e08('0x23')](handleError(_0x2fb3c1,null));};exports[_0x8e08('0x124')]=function(_0x119cf0,_0x3e7b0e){var _0x47ed00={'raw':![],'where':{}};var _0xd5a5aa={};var _0x23c68a={'count':0x0,'rows':[]};return db[_0x8e08('0x4b')]['findOne']({'where':{'id':_0x119cf0[_0x8e08('0x62')]['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x3e7b0e,null))[_0x8e08('0x19')](function(_0x5f36ee){if(_0x5f36ee){_0xd5a5aa[_0x8e08('0x51')]=_[_0x8e08('0x4f')](db[_0x8e08('0xda')][_0x8e08('0x4c')]);_0xd5a5aa[_0x8e08('0x4e')]=_[_0x8e08('0x4f')](_0x119cf0['query']);_0xd5a5aa[_0x8e08('0x50')]=_[_0x8e08('0x52')](_0xd5a5aa[_0x8e08('0x51')],_0xd5a5aa[_0x8e08('0x4e')]);_0x47ed00[_0x8e08('0x53')]=_[_0x8e08('0x52')](_0xd5a5aa[_0x8e08('0x51')],qs[_0x8e08('0x63')](_0x119cf0['query'][_0x8e08('0x63')]));_0x47ed00[_0x8e08('0x53')]=_0x47ed00[_0x8e08('0x53')][_0x8e08('0x54')]?_0x47ed00[_0x8e08('0x53')]:_0xd5a5aa[_0x8e08('0x51')];if(!_0x119cf0[_0x8e08('0x4e')][_0x8e08('0x55')](_0x8e08('0x56'))){_0x47ed00[_0x8e08('0x28')]=qs[_0x8e08('0x28')](_0x119cf0[_0x8e08('0x4e')][_0x8e08('0x28')]);_0x47ed00[_0x8e08('0x27')]=qs['offset'](_0x119cf0[_0x8e08('0x4e')][_0x8e08('0x27')]);}_0x47ed00[_0x8e08('0x57')]=qs[_0x8e08('0x58')](_0x119cf0[_0x8e08('0x4e')]['sort']);_0x47ed00[_0x8e08('0x59')]=qs['filters'](_[_0x8e08('0x5a')](_0x119cf0[_0x8e08('0x4e')],_0xd5a5aa[_0x8e08('0x50')]));_0x47ed00['where'][_0x8e08('0x72')]=_0x5f36ee['id'];if(_0x119cf0[_0x8e08('0x4e')][_0x8e08('0x5c')]){_0x47ed00[_0x8e08('0x59')]=_[_0x8e08('0x5b')](_0x47ed00[_0x8e08('0x59')],{'$or':_['map'](_0x47ed00[_0x8e08('0x53')],function(_0x444194){var _0x466fa0={};_0x466fa0[_0x444194]={'$like':'%'+_0x119cf0[_0x8e08('0x4e')]['filter']+'%'};return _0x466fa0;})});}_0x47ed00=_[_0x8e08('0x5b')]({},_0x47ed00,_0x119cf0[_0x8e08('0xf8')]);return db[_0x8e08('0xda')][_0x8e08('0x29')]({'where':_0x47ed00['where']})['then'](function(_0x51d7e0){_0x23c68a[_0x8e08('0x29')]=_0x51d7e0;if(_0x119cf0[_0x8e08('0x4e')][_0x8e08('0x5d')]){_0x47ed00[_0x8e08('0x5e')]=[{'all':!![]}];}else{_0x47ed00[_0x8e08('0x5e')]=[{'model':db[_0x8e08('0x9b')],'as':_0x8e08('0xf9'),'required':![]},{'model':db[_0x8e08('0xe3')],'as':_0x8e08('0x125'),'required':![]}];}return db['ChatOfflineMessage'][_0x8e08('0x5f')](_0x47ed00);})[_0x8e08('0x19')](function(_0x2f3cac){_0x23c68a[_0x8e08('0x60')]=_0x2f3cac;return _0x23c68a;});}})[_0x8e08('0x19')](respondWithFilteredResult(_0x3e7b0e,_0x47ed00))[_0x8e08('0x23')](handleError(_0x3e7b0e,null));};exports['addAgents']=function(_0x384c69,_0x177197){return db[_0x8e08('0x4b')][_0x8e08('0x64')]({'where':{'id':_0x384c69[_0x8e08('0x62')]['id']}})['then'](handleEntityNotFound(_0x177197,null))[_0x8e08('0x19')](function(_0x1c3e65){if(_0x1c3e65){return _0x1c3e65['addAgents'](_0x384c69[_0x8e08('0x66')][_0x8e08('0x11c')],_['omit'](_0x384c69['body'],['ids','id'])||{})[_0x8e08('0x126')](function(_0x2f5a4b){for(var _0x5cd970=0x0;_0x5cd970<_0x384c69[_0x8e08('0x66')][_0x8e08('0x11c')][_0x8e08('0x54')];_0x5cd970+=0x1){socket[_0x8e08('0x127')](_0x8e08('0x128'),{'UserId':Number(_0x384c69[_0x8e08('0x66')][_0x8e08('0x11c')][_0x5cd970]),'ChatWebsiteId':Number(_0x384c69[_0x8e08('0x62')]['id'])});}return _0x2f5a4b;});}})[_0x8e08('0x19')](respondWithResult(_0x177197,null))[_0x8e08('0x23')](handleError(_0x177197,null));};exports[_0x8e08('0x129')]=function(_0x42a211,_0x8fd91e){return db[_0x8e08('0x4b')][_0x8e08('0x64')]({'where':{'id':_0x42a211[_0x8e08('0x62')]['id']}})['then'](handleEntityNotFound(_0x8fd91e,null))[_0x8e08('0x19')](function(_0xec0c27){if(_0xec0c27){return _0xec0c27[_0x8e08('0x129')](_0x42a211[_0x8e08('0x4e')][_0x8e08('0x11c')])[_0x8e08('0x19')](function(){if(_[_0x8e08('0x12a')](_0x42a211[_0x8e08('0x4e')][_0x8e08('0x11c')])){for(var _0x3bacbd=0x0;_0x3bacbd<_0x42a211['query'][_0x8e08('0x11c')][_0x8e08('0x54')];_0x3bacbd+=0x1){socket[_0x8e08('0x127')](_0x8e08('0x12b'),{'UserId':Number(_0x42a211[_0x8e08('0x4e')][_0x8e08('0x11c')][_0x3bacbd]),'ChatWebsiteId':Number(_0x42a211[_0x8e08('0x62')]['id'])});}}else{socket[_0x8e08('0x127')](_0x8e08('0x12b'),{'UserId':Number(_0x42a211[_0x8e08('0x4e')]['ids']),'ChatWebsiteId':Number(_0x42a211[_0x8e08('0x62')]['id'])});}});}})[_0x8e08('0x19')](respondWithStatusCode(_0x8fd91e,null))[_0x8e08('0x23')](handleError(_0x8fd91e,null));};exports[_0x8e08('0x12c')]=function(_0x3e9d25,_0x1eabc2){var _0x45da8c={};var _0xb06782={};var _0x321437;var _0x40dabb;return db[_0x8e08('0x4b')][_0x8e08('0x74')]({'where':{'id':_0x3e9d25['params']['id']}})[_0x8e08('0x19')](handleEntityNotFound(_0x1eabc2,null))[_0x8e08('0x19')](function(_0x946397){if(_0x946397){_0x321437=_0x946397;_0xb06782[_0x8e08('0x51')]=_[_0x8e08('0x4f')](db[_0x8e08('0xc0')][_0x8e08('0x4c')]);_0xb06782['query']=_[_0x8e08('0x4f')](_0x3e9d25[_0x8e08('0x4e')]);_0xb06782[_0x8e08('0x50')]=_[_0x8e08('0x52')](_0xb06782[_0x8e08('0x51')],_0xb06782['query']);_0x45da8c[_0x8e08('0x53')]=_[_0x8e08('0x52')](_0xb06782['model'],qs[_0x8e08('0x63')](_0x3e9d25['query']['fields']));_0x45da8c['attributes']=_0x45da8c['attributes'][_0x8e08('0x54')]?_0x45da8c[_0x8e08('0x53')]:_0xb06782[_0x8e08('0x51')];_0x45da8c['order']=qs[_0x8e08('0x58')](_0x3e9d25[_0x8e08('0x4e')][_0x8e08('0x58')]);_0x45da8c[_0x8e08('0x59')]=qs[_0x8e08('0x50')](_[_0x8e08('0x5a')](_0x3e9d25[_0x8e08('0x4e')],_0xb06782['filters']));if(_0x3e9d25[_0x8e08('0x4e')][_0x8e08('0x5c')]){_0x45da8c[_0x8e08('0x59')]=_[_0x8e08('0x5b')](_0x45da8c[_0x8e08('0x59')],{'$or':_['map'](_0x45da8c[_0x8e08('0x53')],function(_0x39061a){var _0x2e64b3={};_0x2e64b3[_0x39061a]={'$like':'%'+_0x3e9d25[_0x8e08('0x4e')][_0x8e08('0x5c')]+'%'};return _0x2e64b3;})});}_0x45da8c=_[_0x8e08('0x5b')]({},_0x45da8c,_0x3e9d25[_0x8e08('0xf8')]);return _0x321437[_0x8e08('0x12c')](_0x45da8c);}})[_0x8e08('0x19')](function(_0x2a681e){if(_0x2a681e){_0x40dabb=_0x2a681e[_0x8e08('0x54')];if(!_0x3e9d25[_0x8e08('0x4e')][_0x8e08('0x55')](_0x8e08('0x56'))){_0x45da8c[_0x8e08('0x28')]=qs[_0x8e08('0x28')](_0x3e9d25[_0x8e08('0x4e')]['limit']);_0x45da8c['offset']=qs['offset'](_0x3e9d25[_0x8e08('0x4e')][_0x8e08('0x27')]);}return _0x321437['getAgents'](_0x45da8c);}})['then'](function(_0x22f558){if(_0x22f558){return _0x22f558?{'count':_0x40dabb,'rows':_0x22f558}:null;}})['then'](respondWithResult(_0x1eabc2,null))[_0x8e08('0x23')](handleError(_0x1eabc2,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 14a18f0..dcc9f85 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 _0x00bb=['remove','hook','exports','events','../../mysqldb','ChatWebsite','save'];(function(_0x45833a,_0x106229){var _0xc606a6=function(_0x5357f2){while(--_0x5357f2){_0x45833a['push'](_0x45833a['shift']());}};_0xc606a6(++_0x106229);}(_0x00bb,0x1d8));var _0xb00b=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x00bb[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0xb00b('0x0'));var ChatWebsite=require(_0xb00b('0x1'))['db'][_0xb00b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb00b('0x3'),'afterUpdate':'update','afterDestroy':_0xb00b('0x4')};function emitEvent(_0x464fe7){return function(_0x582ef9,_0x14b5d0,_0x2dbd25){ChatWebsiteEvents['emit'](_0x464fe7+':'+_0x582ef9['id'],_0x582ef9);ChatWebsiteEvents['emit'](_0x464fe7,_0x582ef9);_0x2dbd25(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xb00b('0x5')](e,emitEvent(event));}}module[_0xb00b('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x55ca,0x126));var _0xa55c=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x55ca[_0x9fb081];return _0x43f8b0;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var ChatWebsite=require(_0xa55c('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){ChatWebsiteEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);ChatWebsiteEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];ChatWebsite[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 4223e75..38afb24 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 _0xc4c4=['./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x18a1ed,_0x5c34cd){var _0x2178d2=function(_0xeb9f75){while(--_0xeb9f75){_0x18a1ed['push'](_0x18a1ed['shift']());}};_0x2178d2(++_0x5c34cd);}(_0xc4c4,0xec));var _0x4c4c=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xc4c4[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0x4c4c('0x0'));var util=require(_0x4c4c('0x1'));var logger=require(_0x4c4c('0x2'))('api');var moment=require(_0x4c4c('0x3'));var BPromise=require(_0x4c4c('0x4'));var rp=require(_0x4c4c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4c4c('0x6'));module[_0x4c4c('0x7')]=function(_0x1b1012,_0x4ad8ef){return _0x1b1012[_0x4c4c('0x8')](_0x4c4c('0x9'),attributes,{'tableName':_0x4c4c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x085d=['bluebird','request-promise','path','exports','define','chat_websites','lodash','util','../../config/logger','api','moment'];(function(_0x262357,_0x4ac043){var _0x445224=function(_0x19af89){while(--_0x19af89){_0x262357['push'](_0x262357['shift']());}};_0x445224(++_0x4ac043);}(_0x085d,0x187));var _0xd085=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x085d[_0x1b6563];return _0xdea7b8;};'use strict';var _=require(_0xd085('0x0'));var util=require(_0xd085('0x1'));var logger=require(_0xd085('0x2'))(_0xd085('0x3'));var moment=require(_0xd085('0x4'));var BPromise=require(_0xd085('0x5'));var rp=require(_0xd085('0x6'));var fs=require('fs');var path=require(_0xd085('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0xd085('0x8')]=function(_0x1a2c66,_0xaccfc5){return _0x1a2c66[_0xd085('0x9')]('ChatWebsite',attributes,{'tableName':_0xd085('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 c7309c5..ce2cde9 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 _0xc85c=['http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','client'];(function(_0xfe3e7,_0x2e1251){var _0x5b1381=function(_0x131f57){while(--_0x131f57){_0xfe3e7['push'](_0xfe3e7['shift']());}};_0x5b1381(++_0x2e1251);}(_0xc85c,0x165));var _0xcc85=function(_0x1eb4e0,_0x4ebc2d){_0x1eb4e0=_0x1eb4e0-0x0;var _0x18ec21=_0xc85c[_0x1eb4e0];return _0x18ec21;};'use strict';var _=require(_0xcc85('0x0'));var util=require(_0xcc85('0x1'));var moment=require('moment');var BPromise=require(_0xcc85('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc85('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc85('0x4'))(_0xcc85('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc85('0x6')][_0xcc85('0x7')]({'port':0x232a});config[_0xcc85('0x8')]=_[_0xcc85('0x9')](config[_0xcc85('0x8')],{'host':_0xcc85('0xa'),'port':0x18eb});var socket=require(_0xcc85('0xb'))(new Redis(config['redis']));require(_0xcc85('0xc'))[_0xcc85('0xd')](socket);function respondWithRpcPromise(_0x59399d,_0x235b9e,_0x5d1787){return new BPromise(function(_0x47d961,_0x7398b6){return client[_0xcc85('0xe')](_0x59399d,_0x5d1787)[_0xcc85('0xf')](function(_0x6f5e7d){logger[_0xcc85('0x10')](_0xcc85('0x11'),_0x235b9e,_0xcc85('0x12'));logger['debug'](_0xcc85('0x13'),_0x235b9e,_0xcc85('0x12'),JSON[_0xcc85('0x14')](_0x6f5e7d));if(_0x6f5e7d[_0xcc85('0x15')]){if(_0x6f5e7d['error'][_0xcc85('0x16')]===0x1f4){logger[_0xcc85('0x15')](_0xcc85('0x11'),_0x235b9e,_0x6f5e7d[_0xcc85('0x15')][_0xcc85('0x17')]);return _0x7398b6(_0x6f5e7d[_0xcc85('0x15')][_0xcc85('0x17')]);}logger[_0xcc85('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x235b9e,_0x6f5e7d['error']['message']);return _0x47d961(_0x6f5e7d[_0xcc85('0x15')][_0xcc85('0x17')]);}else{logger[_0xcc85('0x10')](_0xcc85('0x11'),_0x235b9e,_0xcc85('0x12'));_0x47d961(_0x6f5e7d[_0xcc85('0x18')][_0xcc85('0x17')]);}})[_0xcc85('0x19')](function(_0x4a1638){logger['error'](_0xcc85('0x11'),_0x235b9e,_0x4a1638);_0x7398b6(_0x4a1638);});});} \ No newline at end of file +var _0x38aa=['catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x38aa,0xa2));var _0xa38a=function(_0x4aedd8,_0x5636af){_0x4aedd8=_0x4aedd8-0x0;var _0x538ae7=_0x38aa[_0x4aedd8];return _0x538ae7;};'use strict';var _=require('lodash');var util=require(_0xa38a('0x0'));var moment=require(_0xa38a('0x1'));var BPromise=require(_0xa38a('0x2'));var rs=require(_0xa38a('0x3'));var fs=require('fs');var Redis=require(_0xa38a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa38a('0x5'))(_0xa38a('0x6'));var config=require(_0xa38a('0x7'));var jayson=require(_0xa38a('0x8'));var client=jayson[_0xa38a('0x9')]['http']({'port':0x232a});config[_0xa38a('0xa')]=_[_0xa38a('0xb')](config[_0xa38a('0xa')],{'host':_0xa38a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa38a('0xa')]));require(_0xa38a('0xd'))['register'](socket);function respondWithRpcPromise(_0x51b058,_0x38afad,_0x25becf){return new BPromise(function(_0x2bb7d7,_0x54c0d7){return client[_0xa38a('0xe')](_0x51b058,_0x25becf)['then'](function(_0xa1abf7){logger[_0xa38a('0xf')](_0xa38a('0x10'),_0x38afad,_0xa38a('0x11'));logger['debug'](_0xa38a('0x12'),_0x38afad,_0xa38a('0x11'),JSON['stringify'](_0xa1abf7));if(_0xa1abf7[_0xa38a('0x13')]){if(_0xa1abf7[_0xa38a('0x13')][_0xa38a('0x14')]===0x1f4){logger[_0xa38a('0x13')](_0xa38a('0x10'),_0x38afad,_0xa1abf7[_0xa38a('0x13')][_0xa38a('0x15')]);return _0x54c0d7(_0xa1abf7['error'][_0xa38a('0x15')]);}logger[_0xa38a('0x13')](_0xa38a('0x10'),_0x38afad,_0xa1abf7[_0xa38a('0x13')][_0xa38a('0x15')]);return _0x2bb7d7(_0xa1abf7[_0xa38a('0x13')][_0xa38a('0x15')]);}else{logger['info'](_0xa38a('0x10'),_0x38afad,_0xa38a('0x11'));_0x2bb7d7(_0xa1abf7['result'][_0xa38a('0x15')]);}})[_0xa38a('0x16')](function(_0x5961df){logger[_0xa38a('0x13')](_0xa38a('0x10'),_0x38afad,_0x5961df);_0x54c0d7(_0x5961df);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index ee0202c..39081d3 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 _0xb6b4=['update','removeListener','length','chatWebsite:','./chatWebsite.events','save','remove'];(function(_0x1e4d7e,_0x45e3ba){var _0x275eb3=function(_0x4c91e9){while(--_0x4c91e9){_0x1e4d7e['push'](_0x1e4d7e['shift']());}};_0x275eb3(++_0x45e3ba);}(_0xb6b4,0x9e));var _0x4b6b=function(_0x492e92,_0x3fae52){_0x492e92=_0x492e92-0x0;var _0x55975e=_0xb6b4[_0x492e92];return _0x55975e;};'use strict';var ChatWebsiteEvents=require(_0x4b6b('0x0'));var events=[_0x4b6b('0x1'),_0x4b6b('0x2'),_0x4b6b('0x3')];function createListener(_0x2af296,_0x2d1fbb){return function(_0x5de5bf){_0x2d1fbb['emit'](_0x2af296,_0x5de5bf);};}function removeListener(_0x1dbfb9,_0x22316a){return function(){ChatWebsiteEvents[_0x4b6b('0x4')](_0x1dbfb9,_0x22316a);};}exports['register']=function(_0x42c1a6){for(var _0x301556=0x0,_0x213e59=events[_0x4b6b('0x5')];_0x301556<_0x213e59;_0x301556++){var _0x28fd6a=events[_0x301556];var _0x365b60=createListener(_0x4b6b('0x6')+_0x28fd6a,_0x42c1a6);ChatWebsiteEvents['on'](_0x28fd6a,_0x365b60);}}; \ No newline at end of file +var _0x9466=['length','./chatWebsite.events','save','remove','update','emit','removeListener','register'];(function(_0x3aa0ac,_0x5f5da6){var _0x568a11=function(_0x26f47e){while(--_0x26f47e){_0x3aa0ac['push'](_0x3aa0ac['shift']());}};_0x568a11(++_0x5f5da6);}(_0x9466,0x151));var _0x6946=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x9466[_0x11005e];return _0x29338f;};'use strict';var ChatWebsiteEvents=require(_0x6946('0x0'));var events=[_0x6946('0x1'),_0x6946('0x2'),_0x6946('0x3')];function createListener(_0x2518a0,_0x537dda){return function(_0x2eb52d){_0x537dda[_0x6946('0x4')](_0x2518a0,_0x2eb52d);};}function removeListener(_0x453ebe,_0xe04355){return function(){ChatWebsiteEvents[_0x6946('0x5')](_0x453ebe,_0xe04355);};}exports[_0x6946('0x6')]=function(_0x2e1a7a){for(var _0x40c2b4=0x0,_0x235b8e=events[_0x6946('0x7')];_0x40c2b4<_0x235b8e;_0x40c2b4++){var _0x31e84b=events[_0x40c2b4];var _0x44856a=createListener('chatWebsite:'+_0x31e84b,_0x2e1a7a);ChatWebsiteEvents['on'](_0x31e84b,_0x44856a);}}; \ 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 069654c..a941692 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 _0x12fd=['localhost','test','([\x5cw]+)','exports','../../../utils/misc','escapeRegExp','url','URL','replace'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0x12fd,0x199));var _0xd12f=function(_0x5c53b8,_0x32169c){_0x5c53b8=_0x5c53b8-0x0;var _0x352de2=_0x12fd[_0x5c53b8];return _0x352de2;};var escapeRegExp=require(_0xd12f('0x0'))[_0xd12f('0x1')];var URL=require(_0xd12f('0x2'))[_0xd12f('0x3')];function testWildcardValidity(_0x18abfb){let _0x48fb45=!![];try{new URL(_0x18abfb[_0xd12f('0x4')]('*',_0xd12f('0x5')));}catch(_0x13efed){_0x48fb45=![];}return _0x48fb45&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xd12f('0x6')](_0x18abfb);}function testWebsiteWithWildcard(_0x79c5c9,_0x154c72){let _0x55bb7d;const _0x3f733d=escapeRegExp(_0x79c5c9)['replace']('\x5c*',_0xd12f('0x7'));try{new URL(_0x79c5c9[_0xd12f('0x4')]('\x5c*',_0xd12f('0x5')));_0x55bb7d=new RegExp(_0x3f733d)[_0xd12f('0x6')](_0x154c72);}catch(_0x504504){_0x55bb7d=![];}return _0x55bb7d;}module[_0xd12f('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x8f7d=['replace','test','([\x5cw]+)','localhost','exports','../../../utils/misc','escapeRegExp','URL'];(function(_0xe8d029,_0x37a8f6){var _0x8c4ff1=function(_0x333729){while(--_0x333729){_0xe8d029['push'](_0xe8d029['shift']());}};_0x8c4ff1(++_0x37a8f6);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x4f36d1,_0x5dccab){_0x4f36d1=_0x4f36d1-0x0;var _0x536733=_0x8f7d[_0x4f36d1];return _0x536733;};var escapeRegExp=require(_0xd8f7('0x0'))[_0xd8f7('0x1')];var URL=require('url')[_0xd8f7('0x2')];function testWildcardValidity(_0x4a4401){let _0x52384d=!![];try{new URL(_0x4a4401[_0xd8f7('0x3')]('*','localhost'));}catch(_0x9558b6){_0x52384d=![];}return _0x52384d&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xd8f7('0x4')](_0x4a4401);}function testWebsiteWithWildcard(_0x1b9964,_0x3a58c7){let _0x524a2e;const _0x4090c9=escapeRegExp(_0x1b9964)[_0xd8f7('0x3')]('\x5c*',_0xd8f7('0x5'));try{new URL(_0x1b9964[_0xd8f7('0x3')]('\x5c*',_0xd8f7('0x6')));_0x524a2e=new RegExp(_0x4090c9)[_0xd8f7('0x4')](_0x3a58c7);}catch(_0x253fb5){_0x524a2e=![];}return _0x524a2e;}module[_0xd8f7('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 1c5cde5..ae6fcb3 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 _0x3c7b=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','server/files/images/avatars/','addAvatar','/:id/customer_avatar','/:id/notify','notify','server/files','attachments','replace','extname','/:id/offline','any','offline','/:id/interactions','addApplications','/:id/proactive_actions','addAgents','put','delete','destroy','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d3842,_0x3965d6){var _0x580931=function(_0x1383bc){while(--_0x1383bc){_0x3d3842['push'](_0x3d3842['shift']());}};_0x580931(++_0x3965d6);}(_0x3c7b,0xd0));var _0xb3c7=function(_0xa6f525,_0x40e9ba){_0xa6f525=_0xa6f525-0x0;var _0x20c4b2=_0x3c7b[_0xa6f525];return _0x20c4b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb3c7('0x0'));var timeout=require(_0xb3c7('0x1'));var express=require(_0xb3c7('0x2'));var router=express[_0xb3c7('0x3')]();var fs_extra=require(_0xb3c7('0x4'));var auth=require(_0xb3c7('0x5'));var interaction=require(_0xb3c7('0x6'));var config=require(_0xb3c7('0x7'));var controller=require('./chatWebsite.controller');router[_0xb3c7('0x8')]('/',auth[_0xb3c7('0x9')](),controller[_0xb3c7('0xa')]);router[_0xb3c7('0x8')](_0xb3c7('0xb'),auth[_0xb3c7('0x9')](),controller[_0xb3c7('0xc')]);router[_0xb3c7('0x8')](_0xb3c7('0xd'),auth['isAuthenticated'](),controller[_0xb3c7('0xe')]);router['get'](_0xb3c7('0xf'),auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x10')]);router[_0xb3c7('0x8')](_0xb3c7('0x11'),auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x12')]);router[_0xb3c7('0x8')]('/:id/logo',controller[_0xb3c7('0x13')]);router[_0xb3c7('0x8')](_0xb3c7('0x14'),controller[_0xb3c7('0x15')]);router[_0xb3c7('0x8')]('/:id/customer_avatar',controller[_0xb3c7('0x16')]);router[_0xb3c7('0x8')](_0xb3c7('0x17'),controller[_0xb3c7('0x18')]);router[_0xb3c7('0x8')]('/:id/interactions',auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x19')]);router['get'](_0xb3c7('0x1a'),controller[_0xb3c7('0x1b')]);router[_0xb3c7('0x8')](_0xb3c7('0x1c'),auth['isAuthenticated'](),controller[_0xb3c7('0x1d')]);router[_0xb3c7('0x8')]('/:id/proactive_actions',auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x1e')]);router[_0xb3c7('0x8')](_0xb3c7('0x1f'),controller[_0xb3c7('0x20')]);router['get'](_0xb3c7('0x21'),auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x22')]);router['get'](_0xb3c7('0x23'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb3c7('0x24')]('/',auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x25')]);router[_0xb3c7('0x24')](_0xb3c7('0xf'),auth['isAuthenticated'](),controller[_0xb3c7('0x26')]);router['post'](_0xb3c7('0x11'),auth[_0xb3c7('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xb3c7('0x27')]({'destination':function(_0xb51210,_0x29db9b,_0x36d564){_0x36d564(null,path[_0xb3c7('0x28')](config[_0xb3c7('0x29')],_0xb3c7('0x2a')));},'filename':function(_0x4b27fe,_0x2dbaff,_0x16a5f9){_0x16a5f9(null,util[_0xb3c7('0x2b')](_0xb3c7('0x2c'),Date[_0xb3c7('0x2d')](),_0x2dbaff[_0xb3c7('0x2e')]));}})});router[_0xb3c7('0x24')](_0xb3c7('0x2f'),upload[_0xb3c7('0x30')](_0xb3c7('0x31')),controller['addLogo']);var upload=multer({'storage':multer[_0xb3c7('0x27')]({'destination':function(_0x33bacb,_0x1c9b81,_0x4da529){_0x4da529(null,path[_0xb3c7('0x28')](config['root'],_0xb3c7('0x32')));},'filename':function(_0x3d8490,_0x50430b,_0x3c9688){_0x3c9688(null,util['format'](_0xb3c7('0x2c'),Date[_0xb3c7('0x2d')](),_0x50430b[_0xb3c7('0x2e')]));}})});router[_0xb3c7('0x24')](_0xb3c7('0x14'),upload[_0xb3c7('0x30')](_0xb3c7('0x31')),controller[_0xb3c7('0x33')]);var upload=multer({'storage':multer[_0xb3c7('0x27')]({'destination':function(_0x151d76,_0x5af330,_0x140c37){_0x140c37(null,path[_0xb3c7('0x28')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x1dd1fd,_0x4deb02,_0x553525){_0x553525(null,util[_0xb3c7('0x2b')](_0xb3c7('0x2c'),Date[_0xb3c7('0x2d')](),_0x4deb02[_0xb3c7('0x2e')]));}})});router[_0xb3c7('0x24')](_0xb3c7('0x34'),upload['single']('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xb3c7('0x27')]({'destination':function(_0x4118f0,_0x186a85,_0x221dd6){_0x221dd6(null,path[_0xb3c7('0x28')](config['root'],_0xb3c7('0x32')));},'filename':function(_0x202f0e,_0x38324c,_0x374215){_0x374215(null,util[_0xb3c7('0x2b')]('%s-%s',Date[_0xb3c7('0x2d')](),_0x38324c['originalname']));}})});router[_0xb3c7('0x24')](_0xb3c7('0x17'),upload['single'](_0xb3c7('0x31')),controller['addSystemAvatar']);router['post'](_0xb3c7('0x35'),controller[_0xb3c7('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0xb3c7('0x27')]({'destination':function(_0x2e8c5e,_0x43b426,_0x318ce8){const _0x20d29e=path[_0xb3c7('0x28')](config[_0xb3c7('0x29')],_0xb3c7('0x37'),_0xb3c7('0x38'),'offline-chat');fs_extra['ensureDir'](_0x20d29e,function(){_0x318ce8(null,_0x20d29e);});},'filename':function(_0x561ebd,_0x181a2a,_0x15c382){const _0x1dbd27=_0x181a2a[_0xb3c7('0x2e')][_0xb3c7('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1cc9d9=path[_0xb3c7('0x3a')](_0x1dbd27);const _0x5639f7=Date['now']()+'-'+_0x1dbd27[_0xb3c7('0x39')](_0x1cc9d9,'')+_0x1cc9d9;_0x15c382(null,_0x5639f7);}})});router['post'](_0xb3c7('0x3b'),offlineUploadMulter[_0xb3c7('0x3c')](),controller[_0xb3c7('0x3d')]);router['post'](_0xb3c7('0x3e'),auth[_0xb3c7('0x9')](),controller['addInteraction']);router[_0xb3c7('0x24')]('/:id/applications',auth['isAuthenticated'](),controller[_0xb3c7('0x3f')]);router[_0xb3c7('0x24')](_0xb3c7('0x40'),auth[_0xb3c7('0x9')](),controller['addProactiveActions']);router[_0xb3c7('0x24')]('/:id/users',auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x41')]);router[_0xb3c7('0x42')](_0xb3c7('0xd'),auth[_0xb3c7('0x9')](),controller['update']);router[_0xb3c7('0x43')]('/:id',auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x44')]);router['delete'](_0xb3c7('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xb3c7('0x45')]);router[_0xb3c7('0x43')]('/:id/users',auth[_0xb3c7('0x9')](),controller[_0xb3c7('0x46')]);module[_0xb3c7('0x47')]=router; \ No newline at end of file +var _0xe9ec=['diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','single','file','server/files/images/avatars/','format','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addProactiveActions','update','destroy','delete','removeDispositions','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','addDisposition'];(function(_0x58a975,_0x4f7451){var _0x47f055=function(_0x4f57e1){while(--_0x4f57e1){_0x58a975['push'](_0x58a975['shift']());}};_0x47f055(++_0x4f7451);}(_0xe9ec,0x1a5));var _0xce9e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe9ec[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0xce9e('0x0'));var path=require(_0xce9e('0x1'));var timeout=require(_0xce9e('0x2'));var express=require(_0xce9e('0x3'));var router=express['Router']();var fs_extra=require(_0xce9e('0x4'));var auth=require(_0xce9e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xce9e('0x6'));router[_0xce9e('0x7')]('/',auth[_0xce9e('0x8')](),controller['index']);router['get'](_0xce9e('0x9'),auth[_0xce9e('0x8')](),controller[_0xce9e('0xa')]);router['get'](_0xce9e('0xb'),auth[_0xce9e('0x8')](),controller['show']);router[_0xce9e('0x7')](_0xce9e('0xc'),auth[_0xce9e('0x8')](),controller['getDispositions']);router[_0xce9e('0x7')](_0xce9e('0xd'),auth[_0xce9e('0x8')](),controller[_0xce9e('0xe')]);router[_0xce9e('0x7')](_0xce9e('0xf'),controller[_0xce9e('0x10')]);router[_0xce9e('0x7')](_0xce9e('0x11'),controller[_0xce9e('0x12')]);router[_0xce9e('0x7')]('/:id/customer_avatar',controller[_0xce9e('0x13')]);router[_0xce9e('0x7')]('/:id/system_avatar',controller['getSystemAvatar']);router['get'](_0xce9e('0x14'),auth[_0xce9e('0x8')](),controller[_0xce9e('0x15')]);router[_0xce9e('0x7')](_0xce9e('0x16'),controller[_0xce9e('0x17')]);router['get'](_0xce9e('0x18'),auth['isAuthenticated'](),controller[_0xce9e('0x19')]);router['get'](_0xce9e('0x1a'),auth[_0xce9e('0x8')](),controller[_0xce9e('0x1b')]);router[_0xce9e('0x7')](_0xce9e('0x1c'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0xce9e('0x8')](),controller[_0xce9e('0x1d')]);router['get'](_0xce9e('0x1e'),auth[_0xce9e('0x8')](),controller[_0xce9e('0x1f')]);router[_0xce9e('0x20')]('/',auth[_0xce9e('0x8')](),controller['create']);router[_0xce9e('0x20')](_0xce9e('0xc'),auth['isAuthenticated'](),controller[_0xce9e('0x21')]);router[_0xce9e('0x20')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0xce9e('0x22')]({'destination':function(_0xb81761,_0xd4f261,_0x247fef){_0x247fef(null,path[_0xce9e('0x23')](config[_0xce9e('0x24')],_0xce9e('0x25')));},'filename':function(_0x4f575b,_0x1cdb8e,_0x17427a){_0x17427a(null,util['format'](_0xce9e('0x26'),Date[_0xce9e('0x27')](),_0x1cdb8e[_0xce9e('0x28')]));}})});router[_0xce9e('0x20')](_0xce9e('0xf'),upload[_0xce9e('0x29')](_0xce9e('0x2a')),controller['addLogo']);var upload=multer({'storage':multer[_0xce9e('0x22')]({'destination':function(_0x3aa3a5,_0x415337,_0x523316){_0x523316(null,path[_0xce9e('0x23')](config['root'],_0xce9e('0x2b')));},'filename':function(_0x5d9b2b,_0xd9569,_0x1ab85d){_0x1ab85d(null,util[_0xce9e('0x2c')](_0xce9e('0x26'),Date[_0xce9e('0x27')](),_0xd9569[_0xce9e('0x28')]));}})});router['post'](_0xce9e('0x11'),upload['single']('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xce9e('0x22')]({'destination':function(_0x5e3f29,_0x234d17,_0x527a32){_0x527a32(null,path[_0xce9e('0x23')](config['root'],_0xce9e('0x2b')));},'filename':function(_0x51cc2f,_0x5091ce,_0xed6ca0){_0xed6ca0(null,util['format'](_0xce9e('0x26'),Date['now'](),_0x5091ce[_0xce9e('0x28')]));}})});router[_0xce9e('0x20')](_0xce9e('0x2d'),upload[_0xce9e('0x29')]('file'),controller[_0xce9e('0x2e')]);var upload=multer({'storage':multer[_0xce9e('0x22')]({'destination':function(_0x48fb92,_0x558da5,_0x4c45b0){_0x4c45b0(null,path[_0xce9e('0x23')](config['root'],_0xce9e('0x2b')));},'filename':function(_0x4aae17,_0x48c006,_0x51eff7){_0x51eff7(null,util[_0xce9e('0x2c')](_0xce9e('0x26'),Date[_0xce9e('0x27')](),_0x48c006[_0xce9e('0x28')]));}})});router[_0xce9e('0x20')](_0xce9e('0x2f'),upload[_0xce9e('0x29')]('file'),controller[_0xce9e('0x30')]);router[_0xce9e('0x20')](_0xce9e('0x31'),controller[_0xce9e('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0xce9e('0x22')]({'destination':function(_0x523e83,_0x54596b,_0x5b872d){const _0x43cbe6=path[_0xce9e('0x23')](config['root'],_0xce9e('0x33'),'attachments',_0xce9e('0x34'));fs_extra[_0xce9e('0x35')](_0x43cbe6,function(){_0x5b872d(null,_0x43cbe6);});},'filename':function(_0x2c3107,_0x54912b,_0x57de0a){const _0x57e2bb=_0x54912b[_0xce9e('0x28')][_0xce9e('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x6e37d4=path[_0xce9e('0x37')](_0x57e2bb);const _0xc4635f=Date['now']()+'-'+_0x57e2bb[_0xce9e('0x36')](_0x6e37d4,'')+_0x6e37d4;_0x57de0a(null,_0xc4635f);}})});router[_0xce9e('0x20')](_0xce9e('0x38'),offlineUploadMulter[_0xce9e('0x39')](),controller[_0xce9e('0x3a')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router[_0xce9e('0x20')]('/:id/applications',auth[_0xce9e('0x8')](),controller['addApplications']);router[_0xce9e('0x20')](_0xce9e('0x1a'),auth[_0xce9e('0x8')](),controller[_0xce9e('0x3b')]);router[_0xce9e('0x20')](_0xce9e('0x1e'),auth[_0xce9e('0x8')](),controller['addAgents']);router['put'](_0xce9e('0xb'),auth[_0xce9e('0x8')](),controller[_0xce9e('0x3c')]);router['delete'](_0xce9e('0xb'),auth[_0xce9e('0x8')](),controller[_0xce9e('0x3d')]);router[_0xce9e('0x3e')](_0xce9e('0xc'),auth[_0xce9e('0x8')](),controller[_0xce9e('0x3f')]);router[_0xce9e('0x3e')]('/:id/canned_answers',auth[_0xce9e('0x8')](),controller['removeAnswers']);router[_0xce9e('0x3e')](_0xce9e('0x1e'),auth[_0xce9e('0x8')](),controller['removeAgents']);module[_0xce9e('0x40')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index db3aff0..27c6ff0 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 _0x6b30=['get','client-side-logger','use','exports','express','../components/auth/service','../config/environment','Router','env','production','app'];(function(_0x100fb4,_0x3c05cc){var _0x213330=function(_0x5c70ae){while(--_0x5c70ae){_0x100fb4['push'](_0x100fb4['shift']());}};_0x213330(++_0x3c05cc);}(_0x6b30,0x185));var _0x06b3=function(_0x317d61,_0x5e6335){_0x317d61=_0x317d61-0x0;var _0x3abc20=_0x6b30[_0x317d61];return _0x3abc20;};var beaverLogger=require('beaver-logger/server');var express=require(_0x06b3('0x0'));var auth=require(_0x06b3('0x1'));var config=require(_0x06b3('0x2'));var router=express[_0x06b3('0x3')]();var isProduction=config[_0x06b3('0x4')]===_0x06b3('0x5')||![];function clientSideLogs(_0x69fdcc,_0xd850ad,_0x434a85){var _0x361712=_0x69fdcc[_0x06b3('0x6')][_0x06b3('0x7')](_0x06b3('0x8'));if(!_0x361712){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x361712,'enableCors':!isProduction})(_0x69fdcc,_0xd850ad,_0x434a85);}router[_0x06b3('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x06b3('0xa')]=router; \ No newline at end of file +var _0xaad4=['/client-logs','use','exports','express','../components/auth/service','../config/environment','env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!'];(function(_0x43982a,_0x3119bf){var _0x1a2749=function(_0x44c76a){while(--_0x44c76a){_0x43982a['push'](_0x43982a['shift']());}};_0x1a2749(++_0x3119bf);}(_0xaad4,0x1c6));var _0x4aad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xaad4[_0x122ef9];return _0x42fba0;};var beaverLogger=require('beaver-logger/server');var express=require(_0x4aad('0x0'));var auth=require(_0x4aad('0x1'));var config=require(_0x4aad('0x2'));var router=express['Router']();var isProduction=config[_0x4aad('0x3')]==='production'||![];function clientSideLogs(_0x200e98,_0x4106a7,_0x22f966){var _0x4aa20b=_0x200e98[_0x4aad('0x4')][_0x4aad('0x5')](_0x4aad('0x6'));if(!_0x4aa20b){throw new Error(_0x4aad('0x7'));}return beaverLogger['expressEndpoint']({'uri':_0x4aad('0x8'),'logger':_0x4aa20b,'enableCors':!isProduction})(_0x200e98,_0x4106a7,_0x22f966);}router[_0x4aad('0x9')](auth['isAuthenticated'](),clientSideLogs);module[_0x4aad('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 1e87c70..3bc75f7 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 _0x33a4=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x3f3e0b,_0x548752){var _0x586fd0=function(_0x3cfcd1){while(--_0x3cfcd1){_0x3f3e0b['push'](_0x3f3e0b['shift']());}};_0x586fd0(++_0x548752);}(_0x33a4,0x122));var _0x433a=function(_0x3c3c9c,_0x2006e4){_0x3c3c9c=_0x3c3c9c-0x0;var _0x430ef5=_0x33a4[_0x3c3c9c];return _0x430ef5;};'use strict';var Sequelize=require(_0x433a('0x0'));module[_0x433a('0x1')]={'name':{'type':Sequelize[_0x433a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x433a('0x3'),_0x433a('0x4'),_0x433a('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x433a('0x6')](_0x433a('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0x433a('0x2')],'comment':_0x433a('0x8')},'data2':{'type':Sequelize['STRING'],'comment':_0x433a('0x9')},'data3':{'type':Sequelize[_0x433a('0x2')],'comment':_0x433a('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0x433a('0xb')},'data5':{'type':Sequelize[_0x433a('0xc')],'comment':_0x433a('0xd')},'data6':{'type':Sequelize[_0x433a('0xc')],'comment':_0x433a('0xe')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x5907=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x5907,0x80));var _0x7590=function(_0x87d05f,_0x330d3c){_0x87d05f=_0x87d05f-0x0;var _0x2e8a76=_0x5907[_0x87d05f];return _0x2e8a76;};'use strict';var Sequelize=require(_0x7590('0x0'));module[_0x7590('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7590('0x2')]('AmazonAWS','Google',_0x7590('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x7590('0x4'),_0x7590('0x5'))},'data1':{'type':Sequelize[_0x7590('0x6')],'comment':_0x7590('0x7')},'data2':{'type':Sequelize[_0x7590('0x6')],'comment':_0x7590('0x8')},'data3':{'type':Sequelize[_0x7590('0x6')],'comment':_0x7590('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0x7590('0xa')},'data5':{'type':Sequelize[_0x7590('0xb')],'comment':_0x7590('0xc')},'data6':{'type':Sequelize[_0x7590('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x7590('0xb')],'comment':_0x7590('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ac23f60..e09da21 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 _0x85fc=['sort','where','filters','filter','merge','options','then','includeAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','include','create','body','Name\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','access_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','defaults','redis','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x3c7dbe,_0x4165f5){var _0x35c777=function(_0x3b36fe){while(--_0x3b36fe){_0x3c7dbe['push'](_0x3c7dbe['shift']());}};_0x35c777(++_0x4165f5);}(_0x85fc,0xed));var _0xc85f=function(_0x15ca22,_0x3b1f91){_0x15ca22=_0x15ca22-0x0;var _0x509a9e=_0x85fc[_0x15ca22];return _0x509a9e;};'use strict';var _=require(_0xc85f('0x0'));var Redis=require('ioredis');var qs=require(_0xc85f('0x1'));var encryptor=require(_0xc85f('0x2'));var config=require(_0xc85f('0x3'));var logger=require(_0xc85f('0x4'))(_0xc85f('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0xc85f('0x6'));config['redis']=_[_0xc85f('0x7')](config[_0xc85f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc85f('0x9'))(new Redis(config[_0xc85f('0x8')]));var redis=new Redis(config[_0xc85f('0x8')]);function respondWithStatusCode(_0x1bc18a,_0x38ac10){_0x38ac10=_0x38ac10||0xcc;return function(_0x3922d4){if(_0x3922d4){return _0x1bc18a[_0xc85f('0xa')](_0x38ac10);}return _0x1bc18a[_0xc85f('0xb')](_0x38ac10)[_0xc85f('0xc')]();};}function respondWithResult(_0x30f438,_0x4f1f97){_0x4f1f97=_0x4f1f97||0xc8;return function(_0x214fd1){if(_0x214fd1){return _0x30f438[_0xc85f('0xb')](_0x4f1f97)[_0xc85f('0xd')](_0x214fd1);}};}function respondWithFilteredResult(_0x29999e,_0x555b9e){return function(_0x1ba2c5){if(_0x1ba2c5){var _0x324797=typeof _0x555b9e[_0xc85f('0xe')]==='undefined'&&typeof _0x555b9e[_0xc85f('0xf')]===_0xc85f('0x10');var _0x23b7d7=_0x1ba2c5[_0xc85f('0x11')];var _0x1e275f=_0x324797?0x0:_0x555b9e[_0xc85f('0xe')];var _0x424ba6=_0x324797?_0x1ba2c5[_0xc85f('0x11')]:_0x555b9e[_0xc85f('0xe')]+_0x555b9e[_0xc85f('0xf')];var _0x2c180f;if(_0x424ba6>=_0x23b7d7){_0x424ba6=_0x23b7d7;_0x2c180f=0xc8;}else{_0x2c180f=0xce;}_0x29999e[_0xc85f('0xb')](_0x2c180f);return _0x29999e[_0xc85f('0x12')](_0xc85f('0x13'),_0x1e275f+'-'+_0x424ba6+'/'+_0x23b7d7)[_0xc85f('0xd')](_0x1ba2c5);}return null;};}function saveUpdates(_0x48eea6){return function(_0x39a2d4){if(_0x39a2d4){return _0x39a2d4[_0xc85f('0x14')](_0x48eea6)['then'](function(_0x5b43e1){return _0x5b43e1;});}return null;};}function removeEntity(_0x58676b){return function(_0x538d70){if(_0x538d70){return _0x538d70[_0xc85f('0x15')]()['then'](function(){_0x58676b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fb8b0){return function(_0x4ff639){if(!_0x4ff639){_0x2fb8b0[_0xc85f('0xa')](0x194);}return _0x4ff639;};}function handleError(_0x1908a0,_0x2b2a4a){_0x2b2a4a=_0x2b2a4a||0x1f4;return function(_0x5baf38){logger[_0xc85f('0x16')](_0x5baf38[_0xc85f('0x17')]);if(_0x5baf38['name']){delete _0x5baf38[_0xc85f('0x18')];}_0x1908a0['status'](_0x2b2a4a)[_0xc85f('0x19')](_0x5baf38);};}function maskClientSecret(_0x1e2d1f){return _[_0xc85f('0x1a')](_0x1e2d1f['slice'](0x0,0x3),0x14,'*');}exports[_0xc85f('0x1b')]=function(_0x170918,_0x340264){var _0x11bf69={},_0x380a98={},_0x2d2138={'count':0x0,'rows':[]};var _0x4997f8=_[_0xc85f('0x1c')](db[_0xc85f('0x1d')][_0xc85f('0x1e')],function(_0x257a3c){return{'name':_0x257a3c[_0xc85f('0x1f')],'type':_0x257a3c[_0xc85f('0x20')]['key']};});_0x380a98[_0xc85f('0x21')]=_[_0xc85f('0x1c')](_0x4997f8,'name');_0x380a98[_0xc85f('0x22')]=_[_0xc85f('0x23')](_0x170918[_0xc85f('0x22')]);_0x380a98['filters']=_[_0xc85f('0x24')](_0x380a98[_0xc85f('0x21')],_0x380a98[_0xc85f('0x22')]);_0x11bf69[_0xc85f('0x25')]=_[_0xc85f('0x24')](_0x380a98['model'],qs[_0xc85f('0x26')](_0x170918[_0xc85f('0x22')][_0xc85f('0x26')]));_0x11bf69[_0xc85f('0x25')]=_0x11bf69[_0xc85f('0x25')]['length']?_0x11bf69[_0xc85f('0x25')]:_0x380a98['model'];if(!_0x170918[_0xc85f('0x22')][_0xc85f('0x27')](_0xc85f('0x28'))){_0x11bf69[_0xc85f('0xf')]=qs[_0xc85f('0xf')](_0x170918[_0xc85f('0x22')]['limit']);_0x11bf69[_0xc85f('0xe')]=qs[_0xc85f('0xe')](_0x170918['query'][_0xc85f('0xe')]);}_0x11bf69[_0xc85f('0x29')]=qs[_0xc85f('0x2a')](_0x170918[_0xc85f('0x22')][_0xc85f('0x2a')]);_0x11bf69[_0xc85f('0x2b')]=qs['filters'](_['pick'](_0x170918['query'],_0x380a98[_0xc85f('0x2c')]),_0x4997f8);if(_0x170918[_0xc85f('0x22')][_0xc85f('0x2d')]){_0x11bf69['where']=_[_0xc85f('0x2e')](_0x11bf69[_0xc85f('0x2b')],{'$or':_[_0xc85f('0x1c')](_0x4997f8,function(_0x5e6893){if(_0x5e6893[_0xc85f('0x20')]!=='VIRTUAL'){var _0x3572c6={};_0x3572c6[_0x5e6893[_0xc85f('0x18')]]={'$like':'%'+_0x170918['query'][_0xc85f('0x2d')]+'%'};return _0x3572c6;}})});}_0x11bf69=_[_0xc85f('0x2e')]({},_0x11bf69,_0x170918[_0xc85f('0x2f')]);var _0x107079={'where':_0x11bf69[_0xc85f('0x2b')]};return db['CloudProvider'][_0xc85f('0x11')](_0x107079)[_0xc85f('0x30')](function(_0x3f0dc3){_0x2d2138['count']=_0x3f0dc3;if(_0x170918[_0xc85f('0x22')][_0xc85f('0x31')]){_0x11bf69['include']=[{'all':!![]}];}return db[_0xc85f('0x1d')]['findAll'](_0x11bf69);})[_0xc85f('0x30')](function(_0x5156e9){_0x2d2138[_0xc85f('0x32')]=_['map'](_0x5156e9,function(_0x277f00){if(_0x277f00[_0xc85f('0x33')]===_0xc85f('0x34')){var _0x1d5eae=encryptor[_0xc85f('0x35')](_0x277f00[_0xc85f('0x36')]);_0x277f00[_0xc85f('0x36')]=maskClientSecret(_0x1d5eae);}return _0x277f00;});return _0x2d2138;})[_0xc85f('0x30')](respondWithFilteredResult(_0x340264,_0x11bf69))[_0xc85f('0x37')](handleError(_0x340264,null));};exports[_0xc85f('0x38')]=function(_0x1c5b70,_0x18be68){var _0x400a49={'raw':!![],'where':{'id':_0x1c5b70[_0xc85f('0x39')]['id']}},_0x5ed8e6={};_0x5ed8e6[_0xc85f('0x21')]=_[_0xc85f('0x23')](db[_0xc85f('0x1d')]['rawAttributes']);_0x5ed8e6[_0xc85f('0x22')]=_[_0xc85f('0x23')](_0x1c5b70[_0xc85f('0x22')]);_0x5ed8e6[_0xc85f('0x2c')]=_['intersection'](_0x5ed8e6[_0xc85f('0x21')],_0x5ed8e6[_0xc85f('0x22')]);_0x400a49[_0xc85f('0x25')]=_[_0xc85f('0x24')](_0x5ed8e6[_0xc85f('0x21')],qs['fields'](_0x1c5b70[_0xc85f('0x22')]['fields']));_0x400a49[_0xc85f('0x25')]=_0x400a49[_0xc85f('0x25')]['length']?_0x400a49[_0xc85f('0x25')]:_0x5ed8e6[_0xc85f('0x21')];if(_0x1c5b70[_0xc85f('0x22')][_0xc85f('0x31')]){_0x400a49[_0xc85f('0x3a')]=[{'all':!![]}];}_0x400a49=_[_0xc85f('0x2e')]({},_0x400a49,_0x1c5b70[_0xc85f('0x2f')]);return db[_0xc85f('0x1d')]['find'](_0x400a49)['then'](handleEntityNotFound(_0x18be68,null))['then'](function(_0x2fe477){if(_0x2fe477['service']==='MicrosoftAzure'){var _0x4f9451=encryptor[_0xc85f('0x35')](_0x2fe477['data3']);_0x2fe477[_0xc85f('0x36')]=maskClientSecret(_0x4f9451);}return _0x2fe477;})[_0xc85f('0x30')](respondWithResult(_0x18be68,null))['catch'](handleError(_0x18be68,null));};exports[_0xc85f('0x3b')]=function(_0xad569,_0xb77b9){if(!_0xad569[_0xc85f('0x3c')][_0xc85f('0x18')])throw new Error(_0xc85f('0x3d'));if(!_0xad569[_0xc85f('0x3c')][_0xc85f('0x33')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x53fc17=db[_0xc85f('0x1d')][_0xc85f('0x1e')][_0xc85f('0x33')]['values'];if(!_0x53fc17[_0xc85f('0x3e')](_0xad569[_0xc85f('0x3c')]['service']))throw new Error(_0xc85f('0x3f')+_0x53fc17[_0xc85f('0x40')](',\x20'));if(_0xad569[_0xc85f('0x3c')][_0xc85f('0x33')]===_0xc85f('0x34')&&_0xad569[_0xc85f('0x3c')][_0xc85f('0x36')]){_0xad569[_0xc85f('0x3c')]['data3']=encryptor[_0xc85f('0x41')](_0xad569['body']['data3']);}return db[_0xc85f('0x1d')]['create'](_0xad569['body'],{})[_0xc85f('0x30')](respondWithResult(_0xb77b9,0xc9))[_0xc85f('0x37')](handleError(_0xb77b9,null));};exports['update']=function(_0x38e54a,_0x53d785){if(_0x38e54a['body']['id']){delete _0x38e54a[_0xc85f('0x3c')]['id'];}return db['CloudProvider'][_0xc85f('0x42')]({'where':{'id':_0x38e54a[_0xc85f('0x39')]['id']}})[_0xc85f('0x30')](handleEntityNotFound(_0x53d785,null))[_0xc85f('0x30')](function(_0x71905){if(_0x71905[_0xc85f('0x33')]===_0xc85f('0x34')&&_0x38e54a[_0xc85f('0x3c')]['data3']){_0x38e54a[_0xc85f('0x3c')][_0xc85f('0x36')]=encryptor[_0xc85f('0x41')](_0x38e54a[_0xc85f('0x3c')]['data3']);}return _0x71905;})[_0xc85f('0x30')](saveUpdates(_0x38e54a[_0xc85f('0x3c')],null))[_0xc85f('0x30')](respondWithResult(_0x53d785,null))['catch'](handleError(_0x53d785,null));};exports[_0xc85f('0x15')]=function(_0x179a20,_0xe6eccc){return db[_0xc85f('0x1d')][_0xc85f('0x42')]({'where':{'id':_0x179a20['params']['id']}})[_0xc85f('0x30')](handleEntityNotFound(_0xe6eccc,null))[_0xc85f('0x30')](removeEntity(_0xe6eccc,null))['catch'](handleError(_0xe6eccc,null));};exports['oauth2MicrosoftAuthorize']=function(_0x861856,_0x56f54c){return db[_0xc85f('0x1d')][_0xc85f('0x43')]({'where':{'id':_0x861856[_0xc85f('0x39')]['id']},'raw':!![]})['then'](function(_0x31f098){if(!_0x31f098)return _0x56f54c['sendStatus'](0x194);return{'url':oauth[_0xc85f('0x44')](_0x31f098,_0x861856[_0xc85f('0x45')]['id'])};})['then'](respondWithResult(_0x56f54c,null))[_0xc85f('0x37')](handleError(_0x56f54c,null));};exports[_0xc85f('0x46')]=function(_0x8fa724,_0xd66854){var _0x44e9ae=_0x8fa724[_0xc85f('0x3c')];var _0x3fe861;var _0x77ba1d;if(_0x44e9ae['error'])throw _0x44e9ae;redis[_0xc85f('0x47')](_0x44e9ae[_0xc85f('0x48')])[_0xc85f('0x30')](function(_0x5c51c0){if(!_0x5c51c0)throw new Error(_0xc85f('0x49'));_0x3fe861=JSON['parse'](_0x5c51c0);var _0x44c111=Buffer['from'](_0x44e9ae[_0xc85f('0x48')],_0xc85f('0x4a'))[_0xc85f('0x4b')](_0xc85f('0x4c'));_0x77ba1d=JSON[_0xc85f('0x4d')](_0x44c111);if(!oauth[_0xc85f('0x4e')](_0x44e9ae[_0xc85f('0x4f')],_0x3fe861[_0xc85f('0x50')]))throw new Error(_0xc85f('0x51'));redis[_0xc85f('0x52')](_0x44e9ae[_0xc85f('0x48')]);return oauth[_0xc85f('0x53')](_0x44e9ae['code'],_0x3fe861);})[_0xc85f('0x30')](function(_0x2769d2){_0x3fe861['data5']=_0x2769d2[_0xc85f('0x54')];_0x3fe861['data6']=_0x2769d2['refresh_token'];return db[_0xc85f('0x1d')][_0xc85f('0x14')]({'data5':_0x3fe861[_0xc85f('0x55')],'data6':_0x3fe861['data6']},{'where':{'id':_0x3fe861['id']}});})[_0xc85f('0x30')](function(){oauth[_0xc85f('0x56')](_0x3fe861);socket[_0xc85f('0x57')](_0xc85f('0x58'),{'id':_0x77ba1d['id']});return;})[_0xc85f('0x30')](respondWithStatusCode(_0xd66854,null))[_0xc85f('0x37')](function(_0xd3c8ac){if(_0x77ba1d){socket[_0xc85f('0x57')](_0xc85f('0x59'),{'id':_0x77ba1d['id']});}if(!_0x3fe861){logger['error'](_0xc85f('0x5a'),_0xd3c8ac);return _0xd66854[_0xc85f('0xb')](0x1f4)[_0xc85f('0x19')](_0xd3c8ac[_0xc85f('0x5b')]);}logger[_0xc85f('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x3fe861['id'],JSON[_0xc85f('0x5c')](_0xd3c8ac));});}; \ No newline at end of file +var _0xc4a3=['../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','intersection','create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','ascii','isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4a3,0x17e));var _0x3c4a=function(_0x3354d5,_0x203e02){_0x3354d5=_0x3354d5-0x0;var _0x35b6ae=_0xc4a3[_0x3354d5];return _0x35b6ae;};'use strict';var _=require(_0x3c4a('0x0'));var Redis=require(_0x3c4a('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x3c4a('0x2'));var config=require(_0x3c4a('0x3'));var logger=require(_0x3c4a('0x4'))(_0x3c4a('0x5'));var db=require(_0x3c4a('0x6'))['db'];var oauth=require(_0x3c4a('0x7'));config[_0x3c4a('0x8')]=_[_0x3c4a('0x9')](config[_0x3c4a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c4a('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x3c4a('0x8')]);function respondWithStatusCode(_0x2c33d4,_0x224167){_0x224167=_0x224167||0xcc;return function(_0x5065ce){if(_0x5065ce){return _0x2c33d4[_0x3c4a('0xb')](_0x224167);}return _0x2c33d4[_0x3c4a('0xc')](_0x224167)[_0x3c4a('0xd')]();};}function respondWithResult(_0xf8cf29,_0x18c04e){_0x18c04e=_0x18c04e||0xc8;return function(_0x13681e){if(_0x13681e){return _0xf8cf29['status'](_0x18c04e)[_0x3c4a('0xe')](_0x13681e);}};}function respondWithFilteredResult(_0x45ef87,_0x198e0f){return function(_0x2863d1){if(_0x2863d1){var _0x286ded=typeof _0x198e0f[_0x3c4a('0xf')]===_0x3c4a('0x10')&&typeof _0x198e0f[_0x3c4a('0x11')]===_0x3c4a('0x10');var _0x15087c=_0x2863d1['count'];var _0x5d1841=_0x286ded?0x0:_0x198e0f['offset'];var _0x132a16=_0x286ded?_0x2863d1[_0x3c4a('0x12')]:_0x198e0f[_0x3c4a('0xf')]+_0x198e0f[_0x3c4a('0x11')];var _0x109a2c;if(_0x132a16>=_0x15087c){_0x132a16=_0x15087c;_0x109a2c=0xc8;}else{_0x109a2c=0xce;}_0x45ef87[_0x3c4a('0xc')](_0x109a2c);return _0x45ef87[_0x3c4a('0x13')](_0x3c4a('0x14'),_0x5d1841+'-'+_0x132a16+'/'+_0x15087c)[_0x3c4a('0xe')](_0x2863d1);}return null;};}function saveUpdates(_0x5eb7f5){return function(_0x2e1a8c){if(_0x2e1a8c){return _0x2e1a8c[_0x3c4a('0x15')](_0x5eb7f5)[_0x3c4a('0x16')](function(_0x29e296){return _0x29e296;});}return null;};}function removeEntity(_0x53860c){return function(_0x42a7f5){if(_0x42a7f5){return _0x42a7f5['destroy']()[_0x3c4a('0x16')](function(){_0x53860c['status'](0xcc)[_0x3c4a('0xd')]();});}};}function handleEntityNotFound(_0x568cf0){return function(_0x21f2fc){if(!_0x21f2fc){_0x568cf0[_0x3c4a('0xb')](0x194);}return _0x21f2fc;};}function handleError(_0x3891b0,_0x4cb2f1){_0x4cb2f1=_0x4cb2f1||0x1f4;return function(_0x6e0767){logger[_0x3c4a('0x17')](_0x6e0767['stack']);if(_0x6e0767[_0x3c4a('0x18')]){delete _0x6e0767[_0x3c4a('0x18')];}_0x3891b0[_0x3c4a('0xc')](_0x4cb2f1)[_0x3c4a('0x19')](_0x6e0767);};}function maskClientSecret(_0x39bfe2){return _[_0x3c4a('0x1a')](_0x39bfe2[_0x3c4a('0x1b')](0x0,0x3),0x14,'*');}exports[_0x3c4a('0x1c')]=function(_0x1e50f3,_0x2efc0f){var _0x100580={},_0x1a8503={},_0x4150e5={'count':0x0,'rows':[]};var _0x4d485c=_[_0x3c4a('0x1d')](db[_0x3c4a('0x1e')][_0x3c4a('0x1f')],function(_0x5b955e){return{'name':_0x5b955e[_0x3c4a('0x20')],'type':_0x5b955e[_0x3c4a('0x21')][_0x3c4a('0x22')]};});_0x1a8503[_0x3c4a('0x23')]=_['map'](_0x4d485c,_0x3c4a('0x18'));_0x1a8503[_0x3c4a('0x24')]=_['keys'](_0x1e50f3['query']);_0x1a8503['filters']=_['intersection'](_0x1a8503['model'],_0x1a8503[_0x3c4a('0x24')]);_0x100580[_0x3c4a('0x25')]=_['intersection'](_0x1a8503['model'],qs[_0x3c4a('0x26')](_0x1e50f3['query'][_0x3c4a('0x26')]));_0x100580[_0x3c4a('0x25')]=_0x100580[_0x3c4a('0x25')][_0x3c4a('0x27')]?_0x100580['attributes']:_0x1a8503[_0x3c4a('0x23')];if(!_0x1e50f3[_0x3c4a('0x24')][_0x3c4a('0x28')](_0x3c4a('0x29'))){_0x100580[_0x3c4a('0x11')]=qs[_0x3c4a('0x11')](_0x1e50f3['query'][_0x3c4a('0x11')]);_0x100580['offset']=qs[_0x3c4a('0xf')](_0x1e50f3[_0x3c4a('0x24')][_0x3c4a('0xf')]);}_0x100580[_0x3c4a('0x2a')]=qs['sort'](_0x1e50f3[_0x3c4a('0x24')][_0x3c4a('0x2b')]);_0x100580[_0x3c4a('0x2c')]=qs[_0x3c4a('0x2d')](_[_0x3c4a('0x2e')](_0x1e50f3[_0x3c4a('0x24')],_0x1a8503[_0x3c4a('0x2d')]),_0x4d485c);if(_0x1e50f3[_0x3c4a('0x24')][_0x3c4a('0x2f')]){_0x100580[_0x3c4a('0x2c')]=_[_0x3c4a('0x30')](_0x100580[_0x3c4a('0x2c')],{'$or':_[_0x3c4a('0x1d')](_0x4d485c,function(_0x1b2d72){if(_0x1b2d72[_0x3c4a('0x21')]!=='VIRTUAL'){var _0x5ef0de={};_0x5ef0de[_0x1b2d72['name']]={'$like':'%'+_0x1e50f3[_0x3c4a('0x24')]['filter']+'%'};return _0x5ef0de;}})});}_0x100580=_[_0x3c4a('0x30')]({},_0x100580,_0x1e50f3[_0x3c4a('0x31')]);var _0x1c2d91={'where':_0x100580[_0x3c4a('0x2c')]};return db[_0x3c4a('0x1e')][_0x3c4a('0x12')](_0x1c2d91)['then'](function(_0x3c1fa7){_0x4150e5[_0x3c4a('0x12')]=_0x3c1fa7;if(_0x1e50f3[_0x3c4a('0x24')][_0x3c4a('0x32')]){_0x100580[_0x3c4a('0x33')]=[{'all':!![]}];}return db['CloudProvider'][_0x3c4a('0x34')](_0x100580);})[_0x3c4a('0x16')](function(_0x1d57a3){_0x4150e5[_0x3c4a('0x35')]=_[_0x3c4a('0x1d')](_0x1d57a3,function(_0x3dfc6e){if(_0x3dfc6e[_0x3c4a('0x36')]===_0x3c4a('0x37')){var _0x16d296=encryptor[_0x3c4a('0x38')](_0x3dfc6e[_0x3c4a('0x39')]);_0x3dfc6e['data3']=maskClientSecret(_0x16d296);}return _0x3dfc6e;});return _0x4150e5;})[_0x3c4a('0x16')](respondWithFilteredResult(_0x2efc0f,_0x100580))[_0x3c4a('0x3a')](handleError(_0x2efc0f,null));};exports[_0x3c4a('0x3b')]=function(_0x3d7007,_0x3a8e2f){var _0x189255={'raw':!![],'where':{'id':_0x3d7007[_0x3c4a('0x3c')]['id']}},_0x435377={};_0x435377['model']=_[_0x3c4a('0x3d')](db[_0x3c4a('0x1e')][_0x3c4a('0x1f')]);_0x435377[_0x3c4a('0x24')]=_[_0x3c4a('0x3d')](_0x3d7007[_0x3c4a('0x24')]);_0x435377[_0x3c4a('0x2d')]=_['intersection'](_0x435377[_0x3c4a('0x23')],_0x435377[_0x3c4a('0x24')]);_0x189255['attributes']=_[_0x3c4a('0x3e')](_0x435377['model'],qs[_0x3c4a('0x26')](_0x3d7007['query'][_0x3c4a('0x26')]));_0x189255[_0x3c4a('0x25')]=_0x189255['attributes'][_0x3c4a('0x27')]?_0x189255[_0x3c4a('0x25')]:_0x435377[_0x3c4a('0x23')];if(_0x3d7007[_0x3c4a('0x24')][_0x3c4a('0x32')]){_0x189255[_0x3c4a('0x33')]=[{'all':!![]}];}_0x189255=_[_0x3c4a('0x30')]({},_0x189255,_0x3d7007[_0x3c4a('0x31')]);return db[_0x3c4a('0x1e')]['find'](_0x189255)['then'](handleEntityNotFound(_0x3a8e2f,null))[_0x3c4a('0x16')](function(_0x280ecc){if(_0x280ecc[_0x3c4a('0x36')]==='MicrosoftAzure'){var _0x4c845e=encryptor[_0x3c4a('0x38')](_0x280ecc[_0x3c4a('0x39')]);_0x280ecc[_0x3c4a('0x39')]=maskClientSecret(_0x4c845e);}return _0x280ecc;})[_0x3c4a('0x16')](respondWithResult(_0x3a8e2f,null))[_0x3c4a('0x3a')](handleError(_0x3a8e2f,null));};exports[_0x3c4a('0x3f')]=function(_0x115871,_0x3f830d){if(!_0x115871[_0x3c4a('0x40')][_0x3c4a('0x18')])throw new Error(_0x3c4a('0x41'));if(!_0x115871[_0x3c4a('0x40')][_0x3c4a('0x36')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x310b0f=db[_0x3c4a('0x1e')][_0x3c4a('0x1f')][_0x3c4a('0x36')][_0x3c4a('0x42')];if(!_0x310b0f[_0x3c4a('0x43')](_0x115871[_0x3c4a('0x40')][_0x3c4a('0x36')]))throw new Error(_0x3c4a('0x44')+_0x310b0f[_0x3c4a('0x45')](',\x20'));if(_0x115871[_0x3c4a('0x40')][_0x3c4a('0x36')]===_0x3c4a('0x37')&&_0x115871[_0x3c4a('0x40')]['data3']){_0x115871[_0x3c4a('0x40')][_0x3c4a('0x39')]=encryptor[_0x3c4a('0x46')](_0x115871[_0x3c4a('0x40')][_0x3c4a('0x39')]);}return db[_0x3c4a('0x1e')][_0x3c4a('0x3f')](_0x115871['body'],{})[_0x3c4a('0x16')](respondWithResult(_0x3f830d,0xc9))[_0x3c4a('0x3a')](handleError(_0x3f830d,null));};exports[_0x3c4a('0x15')]=function(_0x1743d2,_0x45ffe7){if(_0x1743d2[_0x3c4a('0x40')]['id']){delete _0x1743d2[_0x3c4a('0x40')]['id'];}return db[_0x3c4a('0x1e')][_0x3c4a('0x47')]({'where':{'id':_0x1743d2['params']['id']}})[_0x3c4a('0x16')](handleEntityNotFound(_0x45ffe7,null))['then'](function(_0x2fac1f){if(_0x2fac1f[_0x3c4a('0x36')]===_0x3c4a('0x37')&&_0x1743d2[_0x3c4a('0x40')][_0x3c4a('0x39')]){_0x1743d2[_0x3c4a('0x40')]['data3']=encryptor[_0x3c4a('0x46')](_0x1743d2[_0x3c4a('0x40')]['data3']);}return _0x2fac1f;})[_0x3c4a('0x16')](saveUpdates(_0x1743d2[_0x3c4a('0x40')],null))['then'](respondWithResult(_0x45ffe7,null))['catch'](handleError(_0x45ffe7,null));};exports[_0x3c4a('0x48')]=function(_0x138cad,_0x2c94e2){return db[_0x3c4a('0x1e')]['find']({'where':{'id':_0x138cad[_0x3c4a('0x3c')]['id']}})[_0x3c4a('0x16')](handleEntityNotFound(_0x2c94e2,null))[_0x3c4a('0x16')](removeEntity(_0x2c94e2,null))[_0x3c4a('0x3a')](handleError(_0x2c94e2,null));};exports[_0x3c4a('0x49')]=function(_0x4e4cd7,_0x861350){return db[_0x3c4a('0x1e')][_0x3c4a('0x4a')]({'where':{'id':_0x4e4cd7['params']['id']},'raw':!![]})[_0x3c4a('0x16')](function(_0x3af019){if(!_0x3af019)return _0x861350[_0x3c4a('0xb')](0x194);return{'url':oauth[_0x3c4a('0x4b')](_0x3af019,_0x4e4cd7[_0x3c4a('0x4c')]['id'])};})[_0x3c4a('0x16')](respondWithResult(_0x861350,null))[_0x3c4a('0x3a')](handleError(_0x861350,null));};exports['oauth2MicrosoftCallback']=function(_0x4f4d27,_0x24c1c3){var _0x53562e=_0x4f4d27[_0x3c4a('0x40')];var _0x27cf13;var _0x41f029;if(_0x53562e['error'])throw _0x53562e;redis[_0x3c4a('0x4d')](_0x53562e[_0x3c4a('0x4e')])[_0x3c4a('0x16')](function(_0x356528){if(!_0x356528)throw new Error(_0x3c4a('0x4f'));_0x27cf13=JSON[_0x3c4a('0x50')](_0x356528);var _0x2e0b6b=Buffer[_0x3c4a('0x51')](_0x53562e['state'],'base64')['toString'](_0x3c4a('0x52'));_0x41f029=JSON[_0x3c4a('0x50')](_0x2e0b6b);if(!oauth[_0x3c4a('0x53')](_0x53562e[_0x3c4a('0x54')],_0x27cf13[_0x3c4a('0x55')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x3c4a('0x56')](_0x53562e['state']);return oauth[_0x3c4a('0x57')](_0x53562e[_0x3c4a('0x58')],_0x27cf13);})[_0x3c4a('0x16')](function(_0x3ace28){_0x27cf13[_0x3c4a('0x59')]=_0x3ace28[_0x3c4a('0x5a')];_0x27cf13['data6']=_0x3ace28['refresh_token'];return db[_0x3c4a('0x1e')][_0x3c4a('0x15')]({'data5':_0x27cf13['data5'],'data6':_0x27cf13[_0x3c4a('0x5b')]},{'where':{'id':_0x27cf13['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x27cf13);socket['emit'](_0x3c4a('0x5c'),{'id':_0x41f029['id']});return;})['then'](respondWithStatusCode(_0x24c1c3,null))[_0x3c4a('0x3a')](function(_0x45b091){if(_0x41f029){socket['emit'](_0x3c4a('0x5d'),{'id':_0x41f029['id']});}if(!_0x27cf13){logger['error'](_0x3c4a('0x5e'),_0x45b091);return _0x24c1c3['status'](0x1f4)[_0x3c4a('0x19')](_0x45b091[_0x3c4a('0x5f')]);}logger[_0x3c4a('0x17')](_0x3c4a('0x60'),_0x27cf13['id'],JSON['stringify'](_0x45b091));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7f1acbc..b267690 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 _0x9b15=['./cloudProvider.attributes','CloudProvider','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x131bd5,_0x5d00f2){var _0x114594=function(_0x5e5a5e){while(--_0x5e5a5e){_0x131bd5['push'](_0x131bd5['shift']());}};_0x114594(++_0x5d00f2);}(_0x9b15,0x142));var _0x59b1=function(_0x12cb4a,_0x4c27a3){_0x12cb4a=_0x12cb4a-0x0;var _0x2afd0b=_0x9b15[_0x12cb4a];return _0x2afd0b;};'use strict';var _=require('lodash');var util=require(_0x59b1('0x0'));var logger=require(_0x59b1('0x1'))(_0x59b1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x59b1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59b1('0x4'));var config=require(_0x59b1('0x5'));var attributes=require(_0x59b1('0x6'));module['exports']=function(_0x57b909,_0x33c49d){return _0x57b909['define'](_0x59b1('0x7'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a2f=['CloudProvider','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x4cfd75,_0x19e48a){var _0x33bf80=function(_0x43dee1){while(--_0x43dee1){_0x4cfd75['push'](_0x4cfd75['shift']());}};_0x33bf80(++_0x19e48a);}(_0x1a2f,0x187));var _0xf1a2=function(_0x3cad46,_0xe591cc){_0x3cad46=_0x3cad46-0x0;var _0x35252b=_0x1a2f[_0x3cad46];return _0x35252b;};'use strict';var _=require(_0xf1a2('0x0'));var util=require(_0xf1a2('0x1'));var logger=require(_0xf1a2('0x2'))(_0xf1a2('0x3'));var moment=require(_0xf1a2('0x4'));var BPromise=require(_0xf1a2('0x5'));var rp=require(_0xf1a2('0x6'));var fs=require('fs');var path=require(_0xf1a2('0x7'));var rimraf=require(_0xf1a2('0x8'));var config=require(_0xf1a2('0x9'));var attributes=require(_0xf1a2('0xa'));module[_0xf1a2('0xb')]=function(_0x4fcdef,_0x2c798a){return _0x4fcdef['define'](_0xf1a2('0xc'),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 96fd21c..ac1fb81 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 _0x15f5=['catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/logger','../../config/schedule/cloud-provider','redis','defaults','localhost','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','type','push','data7','/.default','join','Outlook365','code','id_token','from','stringify','toString','base64','hex','client_id','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','login','map','key','value','oauth2Claims','replace','set','decode','issuer','aud','audience','isAfter','exp','CloudProvider','findOne','refresh_token','data6','decryptString','data3','POST','{TENANT_ID}','data2','data5','access_token','update','then','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all'];(function(_0x460b5f,_0xc9f616){var _0x34df7f=function(_0x597641){while(--_0x597641){_0x460b5f['push'](_0x460b5f['shift']());}};_0x34df7f(++_0xc9f616);}(_0x15f5,0xea));var _0x515f=function(_0x3e8519,_0x926890){_0x3e8519=_0x3e8519-0x0;var _0x555b00=_0x15f5[_0x3e8519];return _0x555b00;};'use strict';var _=require(_0x515f('0x0'));var crypto=require(_0x515f('0x1'));var jwt=require(_0x515f('0x2'));var moment=require(_0x515f('0x3'));var Redis=require(_0x515f('0x4'));var rp=require(_0x515f('0x5'));var util=require(_0x515f('0x6'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x515f('0x7'))('api');var schedule=require(_0x515f('0x8'));var db=require('../../mysqldb')['db'];config[_0x515f('0x9')]=_[_0x515f('0xa')](config['redis'],{'host':_0x515f('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x515f('0xc'),'profile',_0x515f('0xd'),'offline_access',_0x515f('0xe'),_0x515f('0xf'),_0x515f('0x10')],'Dynamics365':[_0x515f('0xc'),_0x515f('0x11')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x515f('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5d9c42){var _0x8f52e5=_['map'](AZURE_AUTH_SCOPES[_0x5d9c42['type']]);if(_0x5d9c42[_0x515f('0x13')]==='Dynamics365')_0x8f52e5[_0x515f('0x14')](_0x5d9c42[_0x515f('0x15')]+_0x515f('0x16'));return _0x8f52e5[_0x515f('0x17')]('\x20');}function getAccessTokenScope(_0xef018e){if(_0xef018e[_0x515f('0x13')]===_0x515f('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0xef018e[_0x515f('0x13')]==='Dynamics365')return _0xef018e[_0x515f('0x15')]+_0x515f('0x16');}function generateMicrosoftAuthorizationUrl(_0x420926,_0x54ef2e){var _0x30e275=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x420926['data2']);var _0x4e38df=[_0x515f('0x19'),_0x515f('0x1a')];var _0x444f1e=Buffer[_0x515f('0x1b')](JSON[_0x515f('0x1c')]({'id':_0x54ef2e}))[_0x515f('0x1d')](_0x515f('0x1e'));var _0x7d0cdf=crypto['randomBytes'](0x10)[_0x515f('0x1d')](_0x515f('0x1f'));var _0x14a20d=getAuthorizationScopes(_0x420926);var _0x5387f5=[{'key':_0x515f('0x20'),'value':_0x420926[_0x515f('0x21')]},{'key':_0x515f('0x22'),'value':encodeURIComponent(_0x4e38df[_0x515f('0x17')]('\x20'))},{'key':_0x515f('0x23'),'value':_0x420926[_0x515f('0x24')]},{'key':'response_mode','value':_0x515f('0x25')},{'key':_0x515f('0x26'),'value':encodeURIComponent(_0x14a20d)},{'key':_0x515f('0x27'),'value':_0x444f1e},{'key':_0x515f('0x28'),'value':_0x7d0cdf},{'key':'prompt','value':_0x515f('0x29')}];var _0x36fed5=_0x30e275+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x515f('0x2a')](_0x5387f5,function(_0x3cc0c0){return _0x3cc0c0[_0x515f('0x2b')]+'='+_0x3cc0c0[_0x515f('0x2c')];})['join']('&');_0x420926[_0x515f('0x2d')]={'issuer':_0x30e275[_0x515f('0x2e')]('oauth2/',''),'audience':_0x420926[_0x515f('0x21')],'state':_0x444f1e,'nonce':_0x7d0cdf};redis[_0x515f('0x2f')](_0x444f1e,JSON[_0x515f('0x1c')](_0x420926));return _0x36fed5;}function isValidIdToken(_0x2f3ed3,_0x48c58a){try{var _0x3071ce=jwt[_0x515f('0x30')](_0x2f3ed3,{'complete':!![]});var _0x54eb63=_0x3071ce['payload'];if(_0x54eb63['iss']!==_0x48c58a[_0x515f('0x31')])return![];if(_0x54eb63[_0x515f('0x32')]!==_0x48c58a[_0x515f('0x33')])return![];if(_0x54eb63[_0x515f('0x28')]!==_0x48c58a[_0x515f('0x28')])return![];if(moment()[_0x515f('0x34')](moment['unix'](_0x54eb63[_0x515f('0x35')])))return![];return!![];}catch(_0x44b1e8){throw _0x44b1e8;}}function refreshOauth2MicrosoftAccessToken(_0x51e50a){return Promise['resolve']()['then'](function(){if(_0x51e50a['data3'])return _0x51e50a;return db[_0x515f('0x36')][_0x515f('0x37')]({'where':{'id':_0x51e50a['id']},'raw':!![]});})['then'](function(_0x211d7b){var _0x442ef2={'grant_type':_0x515f('0x38'),'refresh_token':_0x211d7b[_0x515f('0x39')],'scope':getAccessTokenScope(_0x211d7b),'redirect_uri':_0x211d7b['data4'],'client_id':_0x211d7b[_0x515f('0x21')],'client_secret':encryptor[_0x515f('0x3a')](_0x211d7b[_0x515f('0x3b')])};var _0x4d2c22={'method':_0x515f('0x3c'),'uri':MICROSOFT_AUTH_URL['replace'](_0x515f('0x3d'),_0x211d7b[_0x515f('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x442ef2,'json':!![]};return rp(_0x4d2c22);})['then'](function(_0x5721e5){_0x51e50a[_0x515f('0x3f')]=_0x5721e5[_0x515f('0x40')];_0x51e50a['data6']=_0x5721e5['refresh_token'];return db[_0x515f('0x36')][_0x515f('0x41')]({'data5':_0x51e50a[_0x515f('0x3f')],'data6':_0x51e50a['data6']},{'where':{'id':_0x51e50a['id']}});})[_0x515f('0x42')](function(){return _0x51e50a;})['catch'](function(_0xc15114){logger[_0x515f('0x43')](_0x515f('0x44'),_0x51e50a['id'],_0xc15114);});}function getOauth2MicrosoftAccessToken(_0xfccba6,_0xd77dbe){var _0x3eeedc={'grant_type':_0x515f('0x45'),'code':_0xfccba6,'scope':getAccessTokenScope(_0xd77dbe),'redirect_uri':_0xd77dbe[_0x515f('0x24')],'client_id':_0xd77dbe[_0x515f('0x21')],'client_secret':encryptor[_0x515f('0x3a')](_0xd77dbe['data3'])};var _0x143074={'method':_0x515f('0x3c'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0xd77dbe[_0x515f('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3eeedc,'json':!![]};return rp(_0x143074);}function startRefreshInterval(_0x487f1e){var _0x41994f=schedule[_0x515f('0x46')];if(_0x41994f[_0x487f1e['id']])clearInterval(_0x41994f[_0x487f1e['id']]);_0x41994f[_0x487f1e['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x515f('0x47')](this,{'id':_0x487f1e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x515f('0x46')]=_0x41994f;}function startAllRefreshIntervals(){return db[_0x515f('0x36')][_0x515f('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x515f('0x42')](function(_0x5903de){var _0x3de90b=_0x5903de['map'](function(_0x431615){return refreshOauth2MicrosoftAccessToken(_0x431615)[_0x515f('0x42')](function(_0x4fbf06){startRefreshInterval(_0x4fbf06);});});return Promise[_0x515f('0x49')](_0x3de90b);})[_0x515f('0x4a')](function(_0x23aa8b){var _0x5ee607=_0x23aa8b?util['inspect'](_0x23aa8b,{'showHidden':![],'depth':null}):'';logger[_0x515f('0x43')](_0x515f('0x4b'),_0x5ee607);});}module[_0x515f('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xecab=['response_type','redirect_uri','data4','response_mode','form_post','scope','state','login','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','nonce','isAfter','unix','then','data3','findOne','data6','decryptString','data5','access_token','refresh_token','CloudProvider','update','error','authorization_code','intervals','bind','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','/.default','replace','{TENANT_ID}','data2','code','stringify','base64','randomBytes','toString','hex','data1'];(function(_0x1f146c,_0xfb86d6){var _0x2354fb=function(_0x2078d0){while(--_0x2078d0){_0x1f146c['push'](_0x1f146c['shift']());}};_0x2354fb(++_0xfb86d6);}(_0xecab,0x1ac));var _0xbeca=function(_0x5e1a4e,_0xd52259){_0x5e1a4e=_0x5e1a4e-0x0;var _0x4d11f3=_0xecab[_0x5e1a4e];return _0x4d11f3;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0xbeca('0x0'));var moment=require(_0xbeca('0x1'));var Redis=require(_0xbeca('0x2'));var rp=require('request-promise');var util=require(_0xbeca('0x3'));var encryptor=require(_0xbeca('0x4'));var config=require(_0xbeca('0x5'));var logger=require(_0xbeca('0x6'))(_0xbeca('0x7'));var schedule=require(_0xbeca('0x8'));var db=require(_0xbeca('0x9'))['db'];config[_0xbeca('0xa')]=_[_0xbeca('0xb')](config['redis'],{'host':_0xbeca('0xc'),'port':0x18eb});var redis=new Redis(config[_0xbeca('0xa')]);var MICROSOFT_AUTH_URL=_0xbeca('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xbeca('0xe'),_0xbeca('0xf'),_0xbeca('0x10'),_0xbeca('0x11'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0xbeca('0x12'),_0xbeca('0x13')],'Dynamics365':[_0xbeca('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xbeca('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0xbeca('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3f30dc){var _0x3b6c1c=_['map'](AZURE_AUTH_SCOPES[_0x3f30dc[_0xbeca('0x16')]]);if(_0x3f30dc[_0xbeca('0x16')]===_0xbeca('0x17'))_0x3b6c1c[_0xbeca('0x18')](_0x3f30dc[_0xbeca('0x19')]+'/.default');return _0x3b6c1c[_0xbeca('0x1a')]('\x20');}function getAccessTokenScope(_0x38da30){if(_0x38da30['type']===_0xbeca('0x1b'))return _0xbeca('0x1c');if(_0x38da30[_0xbeca('0x16')]===_0xbeca('0x17'))return _0x38da30['data7']+_0xbeca('0x1d');}function generateMicrosoftAuthorizationUrl(_0x1fd535,_0x53af66){var _0x56d2a1=MICROSOFT_AUTH_URL[_0xbeca('0x1e')](_0xbeca('0x1f'),_0x1fd535[_0xbeca('0x20')]);var _0x50a747=[_0xbeca('0x21'),'id_token'];var _0x4d40b5=Buffer['from'](JSON[_0xbeca('0x22')]({'id':_0x53af66}))['toString'](_0xbeca('0x23'));var _0x34250a=crypto[_0xbeca('0x24')](0x10)[_0xbeca('0x25')](_0xbeca('0x26'));var _0x58f248=getAuthorizationScopes(_0x1fd535);var _0x2ae462=[{'key':'client_id','value':_0x1fd535[_0xbeca('0x27')]},{'key':_0xbeca('0x28'),'value':encodeURIComponent(_0x50a747['join']('\x20'))},{'key':_0xbeca('0x29'),'value':_0x1fd535[_0xbeca('0x2a')]},{'key':_0xbeca('0x2b'),'value':_0xbeca('0x2c')},{'key':_0xbeca('0x2d'),'value':encodeURIComponent(_0x58f248)},{'key':_0xbeca('0x2e'),'value':_0x4d40b5},{'key':'nonce','value':_0x34250a},{'key':'prompt','value':_0xbeca('0x2f')}];var _0x392298=_0x56d2a1+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x2ae462,function(_0x49204e){return _0x49204e['key']+'='+_0x49204e[_0xbeca('0x30')];})[_0xbeca('0x1a')]('&');_0x1fd535[_0xbeca('0x31')]={'issuer':_0x56d2a1['replace'](_0xbeca('0x32'),''),'audience':_0x1fd535[_0xbeca('0x27')],'state':_0x4d40b5,'nonce':_0x34250a};redis[_0xbeca('0x33')](_0x4d40b5,JSON['stringify'](_0x1fd535));return _0x392298;}function isValidIdToken(_0x5e6efd,_0x567b44){try{var _0x2cb464=jwt[_0xbeca('0x34')](_0x5e6efd,{'complete':!![]});var _0x5597fa=_0x2cb464[_0xbeca('0x35')];if(_0x5597fa[_0xbeca('0x36')]!==_0x567b44[_0xbeca('0x37')])return![];if(_0x5597fa[_0xbeca('0x38')]!==_0x567b44['audience'])return![];if(_0x5597fa[_0xbeca('0x39')]!==_0x567b44[_0xbeca('0x39')])return![];if(moment()[_0xbeca('0x3a')](moment[_0xbeca('0x3b')](_0x5597fa['exp'])))return![];return!![];}catch(_0x1940a5){throw _0x1940a5;}}function refreshOauth2MicrosoftAccessToken(_0x52c7d8){return Promise['resolve']()[_0xbeca('0x3c')](function(){if(_0x52c7d8[_0xbeca('0x3d')])return _0x52c7d8;return db['CloudProvider'][_0xbeca('0x3e')]({'where':{'id':_0x52c7d8['id']},'raw':!![]});})[_0xbeca('0x3c')](function(_0x1d1c56){var _0x5a9ca3={'grant_type':'refresh_token','refresh_token':_0x1d1c56[_0xbeca('0x3f')],'scope':getAccessTokenScope(_0x1d1c56),'redirect_uri':_0x1d1c56[_0xbeca('0x2a')],'client_id':_0x1d1c56['data1'],'client_secret':encryptor[_0xbeca('0x40')](_0x1d1c56['data3'])};var _0x215bd8={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xbeca('0x1e')]('{TENANT_ID}',_0x1d1c56[_0xbeca('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5a9ca3,'json':!![]};return rp(_0x215bd8);})['then'](function(_0xf34b2c){_0x52c7d8[_0xbeca('0x41')]=_0xf34b2c[_0xbeca('0x42')];_0x52c7d8[_0xbeca('0x3f')]=_0xf34b2c[_0xbeca('0x43')];return db[_0xbeca('0x44')][_0xbeca('0x45')]({'data5':_0x52c7d8['data5'],'data6':_0x52c7d8[_0xbeca('0x3f')]},{'where':{'id':_0x52c7d8['id']}});})[_0xbeca('0x3c')](function(){return _0x52c7d8;})['catch'](function(_0x594941){logger[_0xbeca('0x46')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x52c7d8['id'],_0x594941);});}function getOauth2MicrosoftAccessToken(_0x21b41f,_0x11852c){var _0x5e31da={'grant_type':_0xbeca('0x47'),'code':_0x21b41f,'scope':getAccessTokenScope(_0x11852c),'redirect_uri':_0x11852c[_0xbeca('0x2a')],'client_id':_0x11852c['data1'],'client_secret':encryptor[_0xbeca('0x40')](_0x11852c['data3'])};var _0x28c7f7={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xbeca('0x1e')](_0xbeca('0x1f'),_0x11852c[_0xbeca('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5e31da,'json':!![]};return rp(_0x28c7f7);}function startRefreshInterval(_0x31b892){var _0x3499de=schedule[_0xbeca('0x48')];if(_0x3499de[_0x31b892['id']])clearInterval(_0x3499de[_0x31b892['id']]);_0x3499de[_0x31b892['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xbeca('0x49')](this,{'id':_0x31b892['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x3499de;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x2df4a9){var _0x176504=_0x2df4a9['map'](function(_0x5e9f69){return refreshOauth2MicrosoftAccessToken(_0x5e9f69)[_0xbeca('0x3c')](function(_0x2ed05b){startRefreshInterval(_0x2ed05b);});});return Promise[_0xbeca('0x4a')](_0x176504);})[_0xbeca('0x4b')](function(_0x6c26eb){var _0xd3e8cd=_0x6c26eb?util[_0xbeca('0x4c')](_0x6c26eb,{'showHidden':![],'depth':null}):'';logger[_0xbeca('0x46')](_0xbeca('0x4d'),_0xd3e8cd);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index ca47a2d..80fcf8e 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 _0x5ba3=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','CloudProvider,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5ba3,0x140));var _0x35ba=function(_0x4a0db2,_0x533a26){_0x4a0db2=_0x4a0db2-0x0;var _0x57666d=_0x5ba3[_0x4a0db2];return _0x57666d;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var moment=require(_0x35ba('0x1'));var BPromise=require(_0x35ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ba('0x3'));var db=require(_0x35ba('0x4'))['db'];var utils=require(_0x35ba('0x5'));var logger=require('../../config/logger')(_0x35ba('0x6'));var config=require(_0x35ba('0x7'));var jayson=require(_0x35ba('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20cd5f,_0x3264d3,_0x380ffb){return new BPromise(function(_0x4c55f3,_0x22bed8){return client['request'](_0x20cd5f,_0x380ffb)[_0x35ba('0x9')](function(_0x366ddc){logger[_0x35ba('0xa')](_0x35ba('0xb'),_0x3264d3,'request\x20sent');logger[_0x35ba('0xc')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3264d3,'request\x20sent',JSON['stringify'](_0x366ddc));if(_0x366ddc[_0x35ba('0xd')]){if(_0x366ddc[_0x35ba('0xd')][_0x35ba('0xe')]===0x1f4){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x22bed8(_0x366ddc[_0x35ba('0xd')]['message']);}logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x366ddc[_0x35ba('0xd')][_0x35ba('0xf')]);return _0x4c55f3(_0x366ddc['error'][_0x35ba('0xf')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x3264d3,_0x35ba('0x10'));_0x4c55f3(_0x366ddc[_0x35ba('0x11')]['message']);}})[_0x35ba('0x12')](function(_0x2b6b71){logger[_0x35ba('0xd')](_0x35ba('0xb'),_0x3264d3,_0x2b6b71);_0x22bed8(_0x2b6b71);});});} \ No newline at end of file +var _0x04d5=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57c7f5,_0x3a8ed3){var _0x3e31e3=function(_0x11cdc1){while(--_0x11cdc1){_0x57c7f5['push'](_0x57c7f5['shift']());}};_0x3e31e3(++_0x3a8ed3);}(_0x04d5,0xe1));var _0x504d=function(_0x477c2a,_0x1c0a7c){_0x477c2a=_0x477c2a-0x0;var _0x9ae88=_0x04d5[_0x477c2a];return _0x9ae88;};'use strict';var _=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var moment=require('moment');var BPromise=require(_0x504d('0x2'));var rs=require(_0x504d('0x3'));var fs=require('fs');var Redis=require(_0x504d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x504d('0x5'));var logger=require(_0x504d('0x6'))(_0x504d('0x7'));var config=require(_0x504d('0x8'));var jayson=require(_0x504d('0x9'));var client=jayson['client'][_0x504d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x278262,_0x87bf04,_0x49cb76){return new BPromise(function(_0x5712a7,_0x16da4f){return client[_0x504d('0xb')](_0x278262,_0x49cb76)[_0x504d('0xc')](function(_0x48e0e6){logger[_0x504d('0xd')](_0x504d('0xe'),_0x87bf04,_0x504d('0xf'));logger[_0x504d('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x87bf04,_0x504d('0xf'),JSON[_0x504d('0x11')](_0x48e0e6));if(_0x48e0e6[_0x504d('0x12')]){if(_0x48e0e6[_0x504d('0x12')][_0x504d('0x13')]===0x1f4){logger[_0x504d('0x12')](_0x504d('0xe'),_0x87bf04,_0x48e0e6['error']['message']);return _0x16da4f(_0x48e0e6[_0x504d('0x12')][_0x504d('0x14')]);}logger[_0x504d('0x12')](_0x504d('0xe'),_0x87bf04,_0x48e0e6[_0x504d('0x12')][_0x504d('0x14')]);return _0x5712a7(_0x48e0e6['error'][_0x504d('0x14')]);}else{logger['info'](_0x504d('0xe'),_0x87bf04,_0x504d('0xf'));_0x5712a7(_0x48e0e6['result'][_0x504d('0x14')]);}})[_0x504d('0x15')](function(_0x1e3722){logger[_0x504d('0x12')](_0x504d('0xe'),_0x87bf04,_0x1e3722);_0x16da4f(_0x1e3722);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5781191..ae4172e 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x1261,0x144));var _0x1126=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0x1261[_0x53afe9];return _0x396396;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0xb21ec0,_0x44186e){var _0x185dca=function(_0x4860ed){while(--_0x4860ed){_0xb21ec0['push'](_0xb21ec0['shift']());}};_0x185dca(++_0x44186e);}(_0xdb28,0x106));var _0x8db2=function(_0x40f278,_0x37429a){_0x40f278=_0x40f278-0x0;var _0x23d1aa=_0xdb28[_0x40f278];return _0x23d1aa;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 576f039..f0450d7 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 _0x0da2=['exports','STRING','name','sequelize'];(function(_0x524b60,_0x43f14f){var _0x4c1567=function(_0x475ce5){while(--_0x475ce5){_0x524b60['push'](_0x524b60['shift']());}};_0x4c1567(++_0x43f14f);}(_0x0da2,0x1bb));var _0x20da=function(_0x194ae0,_0x1dcfd1){_0x194ae0=_0x194ae0-0x0;var _0x2d5a05=_0x0da2[_0x194ae0];return _0x2d5a05;};'use strict';var Sequelize=require(_0x20da('0x0'));module[_0x20da('0x1')]={'name':{'type':Sequelize[_0x20da('0x2')],'unique':_0x20da('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x20da('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x20da('0x2')]},'phone':{'type':Sequelize[_0x20da('0x2')]},'fax':{'type':Sequelize[_0x20da('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x20da('0x2')]},'postalCode':{'type':Sequelize[_0x20da('0x2')]},'city':{'type':Sequelize[_0x20da('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x20da('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x20da('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x20da('0x2')]},'sCity':{'type':Sequelize[_0x20da('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x20da('0x2')]}}; \ No newline at end of file +var _0x0807=['name','sequelize','exports','STRING'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0x0807,0x1b5));var _0x7080=function(_0x5ac666,_0x4fb291){_0x5ac666=_0x5ac666-0x0;var _0x2cf776=_0x0807[_0x5ac666];return _0x2cf776;};'use strict';var Sequelize=require(_0x7080('0x0'));module[_0x7080('0x1')]={'name':{'type':Sequelize[_0x7080('0x2')],'unique':_0x7080('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7080('0x2')]},'companyId':{'type':Sequelize[_0x7080('0x2')]},'website':{'type':Sequelize[_0x7080('0x2')]},'phone':{'type':Sequelize[_0x7080('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7080('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7080('0x2')]},'city':{'type':Sequelize[_0x7080('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7080('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x7080('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x7080('0x2')]},'sCountry':{'type':Sequelize[_0x7080('0x2')]},'description':{'type':Sequelize[_0x7080('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 06450a4..940b39d 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 _0xd279=['Companies','end','error','stack','name','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','ids','omit','getContacts','findOne','CmContact','rawAttributes','pick','map','hasOwnProperty','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get'];(function(_0x35011c,_0x3568c5){var _0x4aa873=function(_0x459d2c){while(--_0x459d2c){_0x35011c['push'](_0x35011c['shift']());}};_0x4aa873(++_0x3568c5);}(_0xd279,0x8a));var _0x9d27=function(_0x20fcc6,_0x56b060){_0x20fcc6=_0x20fcc6-0x0;var _0x4621c2=_0xd279[_0x20fcc6];return _0x4621c2;};'use strict';var emlformat=require(_0x9d27('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9d27('0x1'));var rp=require(_0x9d27('0x2'));var moment=require(_0x9d27('0x3'));var BPromise=require(_0x9d27('0x4'));var Mustache=require(_0x9d27('0x5'));var util=require(_0x9d27('0x6'));var path=require(_0x9d27('0x7'));var sox=require(_0x9d27('0x8'));var csv=require('to-csv');var ejs=require(_0x9d27('0x9'));var fs=require('fs');var fs_extra=require(_0x9d27('0xa'));var _=require(_0x9d27('0xb'));var squel=require(_0x9d27('0xc'));var crypto=require(_0x9d27('0xd'));var jsforce=require(_0x9d27('0xe'));var deskjs=require(_0x9d27('0xf'));var toCsv=require(_0x9d27('0x10'));var querystring=require('querystring');var Papa=require(_0x9d27('0x11'));var Redis=require(_0x9d27('0x12'));var authService=require(_0x9d27('0x13'));var qs=require(_0x9d27('0x14'));var as=require(_0x9d27('0x15'));var hardwareService=require(_0x9d27('0x16'));var logger=require(_0x9d27('0x17'))(_0x9d27('0x18'));var utils=require('../../config/utils');var config=require(_0x9d27('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d27('0x1a'))['db'];function respondWithStatusCode(_0x5b33c6,_0x295165){_0x295165=_0x295165||0xcc;return function(_0x23c1ff){if(_0x23c1ff){return _0x5b33c6[_0x9d27('0x1b')](_0x295165);}return _0x5b33c6[_0x9d27('0x1c')](_0x295165)['end']();};}function respondWithResult(_0x2792a4,_0x3e325d){_0x3e325d=_0x3e325d||0xc8;return function(_0x2a69f1){if(_0x2a69f1){return _0x2792a4[_0x9d27('0x1c')](_0x3e325d)[_0x9d27('0x1d')](_0x2a69f1);}};}function respondWithFilteredResult(_0x2fe7d5,_0x1f91ab){return function(_0x3cd025){if(_0x3cd025){var _0x17adac=typeof _0x1f91ab[_0x9d27('0x1e')]===_0x9d27('0x1f')&&typeof _0x1f91ab[_0x9d27('0x20')]===_0x9d27('0x1f');var _0x5a90d8=_0x3cd025[_0x9d27('0x21')];var _0x48b285=_0x17adac?0x0:_0x1f91ab['offset'];var _0xdbce7c=_0x17adac?_0x3cd025[_0x9d27('0x21')]:_0x1f91ab[_0x9d27('0x1e')]+_0x1f91ab[_0x9d27('0x20')];var _0x177411;if(_0xdbce7c>=_0x5a90d8){_0xdbce7c=_0x5a90d8;_0x177411=0xc8;}else{_0x177411=0xce;}_0x2fe7d5[_0x9d27('0x1c')](_0x177411);return _0x2fe7d5[_0x9d27('0x22')](_0x9d27('0x23'),_0x48b285+'-'+_0xdbce7c+'/'+_0x5a90d8)[_0x9d27('0x1d')](_0x3cd025);}return null;};}function patchUpdates(_0x3d2631){return function(_0x407709){try{jsonpatch['apply'](_0x407709,_0x3d2631,!![]);}catch(_0x35d66a){return BPromise[_0x9d27('0x24')](_0x35d66a);}return _0x407709[_0x9d27('0x25')]();};}function saveUpdates(_0x167012,_0xab43f9){return function(_0x42353b){if(_0x42353b){return _0x42353b[_0x9d27('0x26')](_0x167012)[_0x9d27('0x27')](function(_0x715b1d){return _0x715b1d;});}return null;};}function removeEntity(_0x54dbb2,_0x14879d){return function(_0x58361a){if(_0x58361a){return _0x58361a[_0x9d27('0x28')]()[_0x9d27('0x27')](function(){var _0x2e5da8=_0x58361a[_0x9d27('0x29')]({'plain':!![]});var _0x441bb9=_0x9d27('0x2a');return db['UserProfileResource'][_0x9d27('0x28')]({'where':{'type':_0x441bb9,'resourceId':_0x2e5da8['id']}})[_0x9d27('0x27')](function(){return _0x58361a;});})[_0x9d27('0x27')](function(){_0x54dbb2[_0x9d27('0x1c')](0xcc)[_0x9d27('0x2b')]();});}};}function handleEntityNotFound(_0x474dfb,_0x229787){return function(_0x28d7db){if(!_0x28d7db){_0x474dfb['sendStatus'](0x194);}return _0x28d7db;};}function handleError(_0x48ee9a,_0x2dd4ea){_0x2dd4ea=_0x2dd4ea||0x1f4;return function(_0x387ae0){logger[_0x9d27('0x2c')](_0x387ae0[_0x9d27('0x2d')]);if(_0x387ae0[_0x9d27('0x2e')]){delete _0x387ae0[_0x9d27('0x2e')];}_0x48ee9a[_0x9d27('0x1c')](_0x2dd4ea)['send'](_0x387ae0);};}exports['index']=function(_0x2a6f4e,_0x5d7215){var _0x523e3f={},_0x5ae72f={},_0x57f49b={'count':0x0,'rows':[]};return db[_0x9d27('0x2f')][_0x9d27('0x30')]()['then'](function(_0x209718){_0x5ae72f[_0x9d27('0x31')]=_[_0x9d27('0x32')](_0x209718);_0x5ae72f[_0x9d27('0x33')]=_['keys'](_0x2a6f4e['query']);_0x5ae72f[_0x9d27('0x34')]=_[_0x9d27('0x35')](_0x5ae72f['model'],_0x5ae72f[_0x9d27('0x33')]);_0x523e3f[_0x9d27('0x36')]=_[_0x9d27('0x35')](_0x5ae72f['model'],qs[_0x9d27('0x37')](_0x2a6f4e[_0x9d27('0x33')][_0x9d27('0x37')]));_0x523e3f[_0x9d27('0x36')]=_0x523e3f[_0x9d27('0x36')][_0x9d27('0x38')]?_0x523e3f[_0x9d27('0x36')]:_0x5ae72f[_0x9d27('0x31')];if(!_0x2a6f4e['query']['hasOwnProperty'](_0x9d27('0x39'))){_0x523e3f[_0x9d27('0x20')]=qs[_0x9d27('0x20')](_0x2a6f4e[_0x9d27('0x33')][_0x9d27('0x20')]);_0x523e3f[_0x9d27('0x1e')]=qs[_0x9d27('0x1e')](_0x2a6f4e[_0x9d27('0x33')][_0x9d27('0x1e')]);}_0x523e3f[_0x9d27('0x3a')]=qs['sort'](_0x2a6f4e[_0x9d27('0x33')][_0x9d27('0x3b')]);_0x523e3f['where']=qs['filters'](_['pick'](_0x2a6f4e[_0x9d27('0x33')],_0x5ae72f[_0x9d27('0x34')]),_0x209718);if(_0x2a6f4e[_0x9d27('0x33')][_0x9d27('0x3c')]){_0x523e3f[_0x9d27('0x3d')]=_['merge'](_0x523e3f['where'],{'$or':_['map'](_0x523e3f[_0x9d27('0x36')],function(_0x185eec){var _0x1847de={};_0x1847de[_0x185eec]={'$like':'%'+_0x2a6f4e[_0x9d27('0x33')][_0x9d27('0x3c')]+'%'};return _0x1847de;})});}_0x523e3f=_[_0x9d27('0x3e')]({},_0x523e3f,_0x2a6f4e[_0x9d27('0x3f')]);var _0x20f728={'where':_0x523e3f[_0x9d27('0x3d')]};return db[_0x9d27('0x2f')][_0x9d27('0x21')](_0x20f728)[_0x9d27('0x27')](function(_0x448e2b){_0x57f49b['count']=_0x448e2b;if(_0x2a6f4e[_0x9d27('0x33')][_0x9d27('0x40')]){_0x523e3f[_0x9d27('0x41')]=[{'all':!![]}];}return db[_0x9d27('0x2f')][_0x9d27('0x42')](_0x523e3f);})[_0x9d27('0x27')](function(_0x3e0c6a){_0x57f49b[_0x9d27('0x43')]=_0x3e0c6a;return _0x57f49b;})[_0x9d27('0x27')](respondWithFilteredResult(_0x5d7215,_0x523e3f))['catch'](handleError(_0x5d7215,null));})[_0x9d27('0x44')](handleError(_0x5d7215,null));};exports[_0x9d27('0x45')]=function(_0x1686c6,_0x4cc8d1){var _0x58d97f={'raw':![],'where':{'id':_0x1686c6[_0x9d27('0x46')]['id']}},_0x1f599f={};_0x1f599f['model']=_[_0x9d27('0x32')](db['CmCompany']['rawAttributes']);_0x1f599f[_0x9d27('0x33')]=_[_0x9d27('0x32')](_0x1686c6[_0x9d27('0x33')]);_0x1f599f[_0x9d27('0x34')]=_[_0x9d27('0x35')](_0x1f599f['model'],_0x1f599f[_0x9d27('0x33')]);_0x58d97f[_0x9d27('0x36')]=_['intersection'](_0x1f599f[_0x9d27('0x31')],qs[_0x9d27('0x37')](_0x1686c6['query']['fields']));_0x58d97f['attributes']=_0x58d97f[_0x9d27('0x36')]['length']?_0x58d97f['attributes']:_0x1f599f[_0x9d27('0x31')];if(_0x1686c6[_0x9d27('0x33')][_0x9d27('0x40')]){_0x58d97f[_0x9d27('0x41')]=[{'all':!![]}];}_0x58d97f=_[_0x9d27('0x3e')]({},_0x58d97f,_0x1686c6[_0x9d27('0x3f')]);return db[_0x9d27('0x2f')][_0x9d27('0x47')](_0x58d97f)[_0x9d27('0x27')](handleEntityNotFound(_0x4cc8d1,null))[_0x9d27('0x27')](respondWithResult(_0x4cc8d1,null))['catch'](handleError(_0x4cc8d1,null));};exports['create']=function(_0x2e09dc,_0x2407ca){return db['CmCompany'][_0x9d27('0x48')](_0x2e09dc['body'],{})[_0x9d27('0x27')](function(_0x4a172b){var _0x395a28=_0x2e09dc[_0x9d27('0x49')][_0x9d27('0x29')]({'plain':!![]});if(!_0x395a28)throw new Error(_0x9d27('0x4a'));if(_0x395a28[_0x9d27('0x4b')]===_0x9d27('0x49')){var _0x1b76b5=_0x4a172b[_0x9d27('0x29')]({'plain':!![]});var _0x365a36=_0x9d27('0x2a');return db['UserProfileSection'][_0x9d27('0x47')]({'where':{'name':_0x365a36,'userProfileId':_0x395a28[_0x9d27('0x4c')]},'raw':!![]})[_0x9d27('0x27')](function(_0x1a4d5){if(_0x1a4d5&&_0x1a4d5[_0x9d27('0x4d')]===0x0){return db['UserProfileResource'][_0x9d27('0x48')]({'name':_0x1b76b5[_0x9d27('0x2e')],'resourceId':_0x1b76b5['id'],'type':_0x1a4d5[_0x9d27('0x2e')],'sectionId':_0x1a4d5['id']},{})[_0x9d27('0x27')](function(){return _0x4a172b;});}else{return _0x4a172b;}})['catch'](function(_0x4bbf4f){logger['error'](_0x9d27('0x4e'),_0x4bbf4f);throw _0x4bbf4f;});}return _0x4a172b;})['then'](respondWithResult(_0x2407ca,0xc9))[_0x9d27('0x44')](handleError(_0x2407ca,null));};exports[_0x9d27('0x26')]=function(_0x238bc7,_0x371dc0){if(_0x238bc7[_0x9d27('0x4f')]['id']){delete _0x238bc7['body']['id'];}return db['CmCompany'][_0x9d27('0x47')]({'where':{'id':_0x238bc7[_0x9d27('0x46')]['id']}})['then'](handleEntityNotFound(_0x371dc0,null))['then'](saveUpdates(_0x238bc7[_0x9d27('0x4f')],null))['then'](respondWithResult(_0x371dc0,null))[_0x9d27('0x44')](handleError(_0x371dc0,null));};exports[_0x9d27('0x28')]=function(_0x46db1b,_0x5e6aed){return db[_0x9d27('0x2f')]['find']({'where':{'id':_0x46db1b[_0x9d27('0x46')]['id']}})[_0x9d27('0x27')](handleEntityNotFound(_0x5e6aed,null))['then'](removeEntity(_0x5e6aed,null))[_0x9d27('0x44')](handleError(_0x5e6aed,null));};exports[_0x9d27('0x30')]=function(_0x40d16e,_0x2d1e03){return db[_0x9d27('0x2f')][_0x9d27('0x30')]()[_0x9d27('0x27')](respondWithResult(_0x2d1e03,null))[_0x9d27('0x44')](handleError(_0x2d1e03,null));};exports[_0x9d27('0x50')]=function(_0x22f29b,_0x537dae,_0x164c72){return db['CmContact'][_0x9d27('0x47')]({'where':{'id':_0x22f29b[_0x9d27('0x46')]['id']}})['then'](handleEntityNotFound(_0x537dae,null))[_0x9d27('0x27')](function(_0x447cea){if(_0x447cea){return _0x447cea['addContacts'](_0x22f29b[_0x9d27('0x4f')][_0x9d27('0x51')],_[_0x9d27('0x52')](_0x22f29b[_0x9d27('0x4f')],[_0x9d27('0x51'),'id'])||{});}})[_0x9d27('0x27')](respondWithResult(_0x537dae,null))[_0x9d27('0x44')](handleError(_0x537dae,null));};exports[_0x9d27('0x53')]=function(_0x18e250,_0x4fb0e,_0x56eb06){var _0x2c5cdd={};var _0x552d7c={};var _0x32c605;var _0x247304;return db['CmCompany'][_0x9d27('0x54')]({'where':{'id':_0x18e250[_0x9d27('0x46')]['id']}})[_0x9d27('0x27')](handleEntityNotFound(_0x4fb0e,null))[_0x9d27('0x27')](function(_0x382f44){if(_0x382f44){_0x32c605=_0x382f44;_0x552d7c['model']=_[_0x9d27('0x32')](db[_0x9d27('0x55')][_0x9d27('0x56')]);_0x552d7c['query']=_[_0x9d27('0x32')](_0x18e250[_0x9d27('0x33')]);_0x552d7c['filters']=_[_0x9d27('0x35')](_0x552d7c[_0x9d27('0x31')],_0x552d7c['query']);_0x2c5cdd[_0x9d27('0x36')]=_['intersection'](_0x552d7c['model'],qs[_0x9d27('0x37')](_0x18e250[_0x9d27('0x33')][_0x9d27('0x37')]));_0x2c5cdd[_0x9d27('0x36')]=_0x2c5cdd[_0x9d27('0x36')][_0x9d27('0x38')]?_0x2c5cdd[_0x9d27('0x36')]:_0x552d7c[_0x9d27('0x31')];_0x2c5cdd[_0x9d27('0x3a')]=qs[_0x9d27('0x3b')](_0x18e250[_0x9d27('0x33')][_0x9d27('0x3b')]);_0x2c5cdd['where']=qs['filters'](_[_0x9d27('0x57')](_0x18e250[_0x9d27('0x33')],_0x552d7c[_0x9d27('0x34')]));if(_0x18e250[_0x9d27('0x33')][_0x9d27('0x3c')]){_0x2c5cdd[_0x9d27('0x3d')]=_['merge'](_0x2c5cdd[_0x9d27('0x3d')],{'$or':_[_0x9d27('0x58')](_0x2c5cdd[_0x9d27('0x36')],function(_0xb193d8){var _0x55a186={};_0x55a186[_0xb193d8]={'$like':'%'+_0x18e250[_0x9d27('0x33')]['filter']+'%'};return _0x55a186;})});}_0x2c5cdd=_[_0x9d27('0x3e')]({},_0x2c5cdd,_0x18e250[_0x9d27('0x3f')]);return _0x32c605[_0x9d27('0x53')](_0x2c5cdd);}})[_0x9d27('0x27')](function(_0x48b210){if(_0x48b210){_0x247304=_0x48b210['length'];if(!_0x18e250['query'][_0x9d27('0x59')](_0x9d27('0x39'))){_0x2c5cdd[_0x9d27('0x20')]=qs[_0x9d27('0x20')](_0x18e250['query'][_0x9d27('0x20')]);_0x2c5cdd[_0x9d27('0x1e')]=qs[_0x9d27('0x1e')](_0x18e250[_0x9d27('0x33')][_0x9d27('0x1e')]);}return _0x32c605[_0x9d27('0x53')](_0x2c5cdd);}})[_0x9d27('0x27')](function(_0x19426f){if(_0x19426f){return _0x19426f?{'count':_0x247304,'rows':_0x19426f}:null;}})['then'](respondWithResult(_0x4fb0e,null))[_0x9d27('0x44')](handleError(_0x4fb0e,null));}; \ No newline at end of file +var _0x690a=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','addContacts','CmContact','ids','omit','getContacts','hasOwnProperty','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','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','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','stack','name','send','CmCompany','describe','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','map','merge','options','includeAll','rows','catch','params','rawAttributes','include','find','create'];(function(_0x159115,_0x317325){var _0x5dd47f=function(_0xee53e1){while(--_0xee53e1){_0x159115['push'](_0x159115['shift']());}};_0x5dd47f(++_0x317325);}(_0x690a,0x110));var _0xa690=function(_0x39127c,_0x328fd8){_0x39127c=_0x39127c-0x0;var _0x478896=_0x690a[_0x39127c];return _0x478896;};'use strict';var emlformat=require(_0xa690('0x0'));var rimraf=require(_0xa690('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa690('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa690('0x3'));var Mustache=require(_0xa690('0x4'));var util=require(_0xa690('0x5'));var path=require(_0xa690('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa690('0x7'));var fs=require('fs');var fs_extra=require(_0xa690('0x8'));var _=require(_0xa690('0x9'));var squel=require(_0xa690('0xa'));var crypto=require(_0xa690('0xb'));var jsforce=require(_0xa690('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa690('0xd'));var Papa=require('papaparse');var Redis=require(_0xa690('0xe'));var authService=require(_0xa690('0xf'));var qs=require(_0xa690('0x10'));var as=require(_0xa690('0x11'));var hardwareService=require(_0xa690('0x12'));var logger=require(_0xa690('0x13'))(_0xa690('0x14'));var utils=require(_0xa690('0x15'));var config=require(_0xa690('0x16'));var licenseUtil=require(_0xa690('0x17'));var db=require(_0xa690('0x18'))['db'];function respondWithStatusCode(_0x5ec0a5,_0x260962){_0x260962=_0x260962||0xcc;return function(_0x4f6c95){if(_0x4f6c95){return _0x5ec0a5['sendStatus'](_0x260962);}return _0x5ec0a5['status'](_0x260962)[_0xa690('0x19')]();};}function respondWithResult(_0x4fd000,_0x303b03){_0x303b03=_0x303b03||0xc8;return function(_0x314ffe){if(_0x314ffe){return _0x4fd000[_0xa690('0x1a')](_0x303b03)[_0xa690('0x1b')](_0x314ffe);}};}function respondWithFilteredResult(_0x48d821,_0xca8623){return function(_0x16fba0){if(_0x16fba0){var _0x49ebfb=typeof _0xca8623[_0xa690('0x1c')]===_0xa690('0x1d')&&typeof _0xca8623['limit']==='undefined';var _0x1c7699=_0x16fba0[_0xa690('0x1e')];var _0xb32510=_0x49ebfb?0x0:_0xca8623[_0xa690('0x1c')];var _0x5e1933=_0x49ebfb?_0x16fba0[_0xa690('0x1e')]:_0xca8623[_0xa690('0x1c')]+_0xca8623[_0xa690('0x1f')];var _0x35203;if(_0x5e1933>=_0x1c7699){_0x5e1933=_0x1c7699;_0x35203=0xc8;}else{_0x35203=0xce;}_0x48d821[_0xa690('0x1a')](_0x35203);return _0x48d821[_0xa690('0x20')]('Content-Range',_0xb32510+'-'+_0x5e1933+'/'+_0x1c7699)[_0xa690('0x1b')](_0x16fba0);}return null;};}function patchUpdates(_0x1eea0c){return function(_0x59f08f){try{jsonpatch[_0xa690('0x21')](_0x59f08f,_0x1eea0c,!![]);}catch(_0x3d7c73){return BPromise[_0xa690('0x22')](_0x3d7c73);}return _0x59f08f[_0xa690('0x23')]();};}function saveUpdates(_0x4006c3,_0x475ffc){return function(_0x910b89){if(_0x910b89){return _0x910b89[_0xa690('0x24')](_0x4006c3)[_0xa690('0x25')](function(_0x557a53){return _0x557a53;});}return null;};}function removeEntity(_0x4f695,_0x283e41){return function(_0x153a26){if(_0x153a26){return _0x153a26[_0xa690('0x26')]()[_0xa690('0x25')](function(){var _0x58b334=_0x153a26[_0xa690('0x27')]({'plain':!![]});var _0x3edde6=_0xa690('0x28');return db[_0xa690('0x29')][_0xa690('0x26')]({'where':{'type':_0x3edde6,'resourceId':_0x58b334['id']}})[_0xa690('0x25')](function(){return _0x153a26;});})['then'](function(){_0x4f695[_0xa690('0x1a')](0xcc)[_0xa690('0x19')]();});}};}function handleEntityNotFound(_0x2f95e7,_0x5983f8){return function(_0x188f00){if(!_0x188f00){_0x2f95e7['sendStatus'](0x194);}return _0x188f00;};}function handleError(_0x577658,_0x132fa1){_0x132fa1=_0x132fa1||0x1f4;return function(_0x4e3da2){logger['error'](_0x4e3da2[_0xa690('0x2a')]);if(_0x4e3da2[_0xa690('0x2b')]){delete _0x4e3da2[_0xa690('0x2b')];}_0x577658['status'](_0x132fa1)[_0xa690('0x2c')](_0x4e3da2);};}exports['index']=function(_0x595d7d,_0x475f31){var _0x8b9cb={},_0x36cb81={},_0x3d95a={'count':0x0,'rows':[]};return db[_0xa690('0x2d')][_0xa690('0x2e')]()[_0xa690('0x25')](function(_0x4e116d){_0x36cb81['model']=_[_0xa690('0x2f')](_0x4e116d);_0x36cb81[_0xa690('0x30')]=_[_0xa690('0x2f')](_0x595d7d[_0xa690('0x30')]);_0x36cb81[_0xa690('0x31')]=_['intersection'](_0x36cb81[_0xa690('0x32')],_0x36cb81[_0xa690('0x30')]);_0x8b9cb[_0xa690('0x33')]=_[_0xa690('0x34')](_0x36cb81[_0xa690('0x32')],qs[_0xa690('0x35')](_0x595d7d[_0xa690('0x30')][_0xa690('0x35')]));_0x8b9cb['attributes']=_0x8b9cb[_0xa690('0x33')][_0xa690('0x36')]?_0x8b9cb[_0xa690('0x33')]:_0x36cb81[_0xa690('0x32')];if(!_0x595d7d[_0xa690('0x30')]['hasOwnProperty'](_0xa690('0x37'))){_0x8b9cb[_0xa690('0x1f')]=qs[_0xa690('0x1f')](_0x595d7d[_0xa690('0x30')][_0xa690('0x1f')]);_0x8b9cb[_0xa690('0x1c')]=qs[_0xa690('0x1c')](_0x595d7d[_0xa690('0x30')][_0xa690('0x1c')]);}_0x8b9cb[_0xa690('0x38')]=qs[_0xa690('0x39')](_0x595d7d['query']['sort']);_0x8b9cb[_0xa690('0x3a')]=qs['filters'](_[_0xa690('0x3b')](_0x595d7d[_0xa690('0x30')],_0x36cb81['filters']),_0x4e116d);if(_0x595d7d['query'][_0xa690('0x3c')]){_0x8b9cb['where']=_['merge'](_0x8b9cb[_0xa690('0x3a')],{'$or':_[_0xa690('0x3d')](_0x8b9cb['attributes'],function(_0x413d8c){var _0x1146df={};_0x1146df[_0x413d8c]={'$like':'%'+_0x595d7d['query'][_0xa690('0x3c')]+'%'};return _0x1146df;})});}_0x8b9cb=_[_0xa690('0x3e')]({},_0x8b9cb,_0x595d7d[_0xa690('0x3f')]);var _0x246845={'where':_0x8b9cb['where']};return db[_0xa690('0x2d')][_0xa690('0x1e')](_0x246845)[_0xa690('0x25')](function(_0x4678ad){_0x3d95a[_0xa690('0x1e')]=_0x4678ad;if(_0x595d7d['query'][_0xa690('0x40')]){_0x8b9cb['include']=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x8b9cb);})[_0xa690('0x25')](function(_0xf4f1e6){_0x3d95a[_0xa690('0x41')]=_0xf4f1e6;return _0x3d95a;})[_0xa690('0x25')](respondWithFilteredResult(_0x475f31,_0x8b9cb))[_0xa690('0x42')](handleError(_0x475f31,null));})[_0xa690('0x42')](handleError(_0x475f31,null));};exports['show']=function(_0x326f69,_0x7d653e){var _0x24b37d={'raw':![],'where':{'id':_0x326f69[_0xa690('0x43')]['id']}},_0x531194={};_0x531194[_0xa690('0x32')]=_[_0xa690('0x2f')](db[_0xa690('0x2d')][_0xa690('0x44')]);_0x531194[_0xa690('0x30')]=_[_0xa690('0x2f')](_0x326f69[_0xa690('0x30')]);_0x531194[_0xa690('0x31')]=_[_0xa690('0x34')](_0x531194[_0xa690('0x32')],_0x531194[_0xa690('0x30')]);_0x24b37d['attributes']=_[_0xa690('0x34')](_0x531194[_0xa690('0x32')],qs[_0xa690('0x35')](_0x326f69[_0xa690('0x30')][_0xa690('0x35')]));_0x24b37d[_0xa690('0x33')]=_0x24b37d[_0xa690('0x33')]['length']?_0x24b37d[_0xa690('0x33')]:_0x531194['model'];if(_0x326f69[_0xa690('0x30')][_0xa690('0x40')]){_0x24b37d[_0xa690('0x45')]=[{'all':!![]}];}_0x24b37d=_[_0xa690('0x3e')]({},_0x24b37d,_0x326f69['options']);return db[_0xa690('0x2d')][_0xa690('0x46')](_0x24b37d)['then'](handleEntityNotFound(_0x7d653e,null))[_0xa690('0x25')](respondWithResult(_0x7d653e,null))[_0xa690('0x42')](handleError(_0x7d653e,null));};exports[_0xa690('0x47')]=function(_0x3f9496,_0x521915){return db[_0xa690('0x2d')][_0xa690('0x47')](_0x3f9496[_0xa690('0x48')],{})[_0xa690('0x25')](function(_0x1bc5bc){var _0x590bcc=_0x3f9496[_0xa690('0x49')]['get']({'plain':!![]});if(!_0x590bcc)throw new Error(_0xa690('0x4a'));if(_0x590bcc[_0xa690('0x4b')]==='user'){var _0x189299=_0x1bc5bc[_0xa690('0x27')]({'plain':!![]});var _0x51e4bb=_0xa690('0x28');return db[_0xa690('0x4c')]['find']({'where':{'name':_0x51e4bb,'userProfileId':_0x590bcc[_0xa690('0x4d')]},'raw':!![]})[_0xa690('0x25')](function(_0x27a1ec){if(_0x27a1ec&&_0x27a1ec[_0xa690('0x4e')]===0x0){return db[_0xa690('0x29')][_0xa690('0x47')]({'name':_0x189299[_0xa690('0x2b')],'resourceId':_0x189299['id'],'type':_0x27a1ec[_0xa690('0x2b')],'sectionId':_0x27a1ec['id']},{})[_0xa690('0x25')](function(){return _0x1bc5bc;});}else{return _0x1bc5bc;}})[_0xa690('0x42')](function(_0x23a462){logger[_0xa690('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23a462);throw _0x23a462;});}return _0x1bc5bc;})['then'](respondWithResult(_0x521915,0xc9))[_0xa690('0x42')](handleError(_0x521915,null));};exports[_0xa690('0x24')]=function(_0x3670c2,_0x401814){if(_0x3670c2['body']['id']){delete _0x3670c2['body']['id'];}return db[_0xa690('0x2d')][_0xa690('0x46')]({'where':{'id':_0x3670c2['params']['id']}})[_0xa690('0x25')](handleEntityNotFound(_0x401814,null))[_0xa690('0x25')](saveUpdates(_0x3670c2[_0xa690('0x48')],null))['then'](respondWithResult(_0x401814,null))[_0xa690('0x42')](handleError(_0x401814,null));};exports[_0xa690('0x26')]=function(_0x57b0bb,_0x40815d){return db['CmCompany'][_0xa690('0x46')]({'where':{'id':_0x57b0bb[_0xa690('0x43')]['id']}})[_0xa690('0x25')](handleEntityNotFound(_0x40815d,null))[_0xa690('0x25')](removeEntity(_0x40815d,null))[_0xa690('0x42')](handleError(_0x40815d,null));};exports[_0xa690('0x2e')]=function(_0x14444e,_0x4d1f98){return db['CmCompany'][_0xa690('0x2e')]()[_0xa690('0x25')](respondWithResult(_0x4d1f98,null))['catch'](handleError(_0x4d1f98,null));};exports[_0xa690('0x50')]=function(_0x21b480,_0x3840ee,_0x909d0c){return db[_0xa690('0x51')][_0xa690('0x46')]({'where':{'id':_0x21b480[_0xa690('0x43')]['id']}})[_0xa690('0x25')](handleEntityNotFound(_0x3840ee,null))[_0xa690('0x25')](function(_0x156a4a){if(_0x156a4a){return _0x156a4a[_0xa690('0x50')](_0x21b480['body'][_0xa690('0x52')],_[_0xa690('0x53')](_0x21b480[_0xa690('0x48')],[_0xa690('0x52'),'id'])||{});}})[_0xa690('0x25')](respondWithResult(_0x3840ee,null))[_0xa690('0x42')](handleError(_0x3840ee,null));};exports['getContacts']=function(_0x549774,_0x31f46c,_0x4a5ae4){var _0x53f873={};var _0x27204e={};var _0xecb8d3;var _0x1d77fc;return db[_0xa690('0x2d')]['findOne']({'where':{'id':_0x549774[_0xa690('0x43')]['id']}})[_0xa690('0x25')](handleEntityNotFound(_0x31f46c,null))['then'](function(_0x5e489a){if(_0x5e489a){_0xecb8d3=_0x5e489a;_0x27204e[_0xa690('0x32')]=_['keys'](db['CmContact'][_0xa690('0x44')]);_0x27204e[_0xa690('0x30')]=_['keys'](_0x549774[_0xa690('0x30')]);_0x27204e[_0xa690('0x31')]=_[_0xa690('0x34')](_0x27204e['model'],_0x27204e[_0xa690('0x30')]);_0x53f873[_0xa690('0x33')]=_[_0xa690('0x34')](_0x27204e[_0xa690('0x32')],qs[_0xa690('0x35')](_0x549774['query'][_0xa690('0x35')]));_0x53f873['attributes']=_0x53f873[_0xa690('0x33')][_0xa690('0x36')]?_0x53f873[_0xa690('0x33')]:_0x27204e['model'];_0x53f873[_0xa690('0x38')]=qs[_0xa690('0x39')](_0x549774[_0xa690('0x30')]['sort']);_0x53f873[_0xa690('0x3a')]=qs[_0xa690('0x31')](_['pick'](_0x549774['query'],_0x27204e[_0xa690('0x31')]));if(_0x549774[_0xa690('0x30')][_0xa690('0x3c')]){_0x53f873[_0xa690('0x3a')]=_['merge'](_0x53f873['where'],{'$or':_['map'](_0x53f873[_0xa690('0x33')],function(_0x2ea23b){var _0x2d9883={};_0x2d9883[_0x2ea23b]={'$like':'%'+_0x549774[_0xa690('0x30')][_0xa690('0x3c')]+'%'};return _0x2d9883;})});}_0x53f873=_['merge']({},_0x53f873,_0x549774[_0xa690('0x3f')]);return _0xecb8d3[_0xa690('0x54')](_0x53f873);}})[_0xa690('0x25')](function(_0x2680f3){if(_0x2680f3){_0x1d77fc=_0x2680f3[_0xa690('0x36')];if(!_0x549774[_0xa690('0x30')][_0xa690('0x55')]('nolimit')){_0x53f873['limit']=qs['limit'](_0x549774[_0xa690('0x30')][_0xa690('0x1f')]);_0x53f873[_0xa690('0x1c')]=qs[_0xa690('0x1c')](_0x549774['query'][_0xa690('0x1c')]);}return _0xecb8d3['getContacts'](_0x53f873);}})[_0xa690('0x25')](function(_0x539dfa){if(_0x539dfa){return _0x539dfa?{'count':_0x1d77fc,'rows':_0x539dfa}:null;}})[_0xa690('0x25')](respondWithResult(_0x31f46c,null))['catch'](handleError(_0x31f46c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 98f2f87..3a4d2d9 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 _0x37c8=['moment','bluebird','request-promise','path','./cmCompany.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x37c8,0xbb));var _0x837c=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x37c8[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x837c('0x0'));var util=require(_0x837c('0x1'));var logger=require(_0x837c('0x2'))('api');var moment=require(_0x837c('0x3'));var BPromise=require(_0x837c('0x4'));var rp=require(_0x837c('0x5'));var fs=require('fs');var path=require(_0x837c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x837c('0x7'));module[_0x837c('0x8')]=function(_0x28edf6,_0x537be3){return _0x28edf6[_0x837c('0x9')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac2c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash','../../config/logger','api','moment'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xac2c,0x127));var _0xcac2=function(_0x4171a8,_0x2309d6){_0x4171a8=_0x4171a8-0x0;var _0x41e768=_0xac2c[_0x4171a8];return _0x41e768;};'use strict';var _=require(_0xcac2('0x0'));var util=require('util');var logger=require(_0xcac2('0x1'))(_0xcac2('0x2'));var moment=require(_0xcac2('0x3'));var BPromise=require(_0xcac2('0x4'));var rp=require(_0xcac2('0x5'));var fs=require('fs');var path=require(_0xcac2('0x6'));var rimraf=require(_0xcac2('0x7'));var config=require(_0xcac2('0x8'));var attributes=require('./cmCompany.attributes');module[_0xcac2('0x9')]=function(_0x2a8d15,_0x439cb3){return _0x2a8d15[_0xcac2('0xa')](_0xcac2('0xb'),attributes,{'tableName':_0xcac2('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 4dca175..524888c 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 _0x77c4=['client','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa2cf96,_0x143344){var _0x3045e8=function(_0x5a4279){while(--_0x5a4279){_0xa2cf96['push'](_0xa2cf96['shift']());}};_0x3045e8(++_0x143344);}(_0x77c4,0xa6));var _0x477c=function(_0x219000,_0xf20e99){_0x219000=_0x219000-0x0;var _0x364123=_0x77c4[_0x219000];return _0x364123;};'use strict';var _=require('lodash');var util=require(_0x477c('0x0'));var moment=require(_0x477c('0x1'));var BPromise=require(_0x477c('0x2'));var rs=require(_0x477c('0x3'));var fs=require('fs');var Redis=require(_0x477c('0x4'));var db=require(_0x477c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x477c('0x6'))(_0x477c('0x7'));var config=require(_0x477c('0x8'));var jayson=require(_0x477c('0x9'));var client=jayson[_0x477c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c8b05,_0x741028,_0x57afcf){return new BPromise(function(_0x2da1e4,_0x277e5d){return client[_0x477c('0xb')](_0x1c8b05,_0x57afcf)['then'](function(_0x56077d){logger[_0x477c('0xc')](_0x477c('0xd'),_0x741028,_0x477c('0xe'));logger['debug'](_0x477c('0xf'),_0x741028,'request\x20sent',JSON[_0x477c('0x10')](_0x56077d));if(_0x56077d['error']){if(_0x56077d[_0x477c('0x11')][_0x477c('0x12')]===0x1f4){logger[_0x477c('0x11')]('CmCompany,\x20%s,\x20%s',_0x741028,_0x56077d[_0x477c('0x11')][_0x477c('0x13')]);return _0x277e5d(_0x56077d[_0x477c('0x11')][_0x477c('0x13')]);}logger[_0x477c('0x11')]('CmCompany,\x20%s,\x20%s',_0x741028,_0x56077d[_0x477c('0x11')][_0x477c('0x13')]);return _0x2da1e4(_0x56077d[_0x477c('0x11')][_0x477c('0x13')]);}else{logger[_0x477c('0xc')](_0x477c('0xd'),_0x741028,_0x477c('0xe'));_0x2da1e4(_0x56077d[_0x477c('0x14')][_0x477c('0x13')]);}})[_0x477c('0x15')](function(_0x316aca){logger['error'](_0x477c('0xd'),_0x741028,_0x316aca);_0x277e5d(_0x316aca);});});} \ No newline at end of file +var _0xa353=['client','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x16c739,_0x5853f){var _0x2573cd=function(_0x339219){while(--_0x339219){_0x16c739['push'](_0x16c739['shift']());}};_0x2573cd(++_0x5853f);}(_0xa353,0xfc));var _0x3a35=function(_0xd4ae00,_0x3b3254){_0xd4ae00=_0xd4ae00-0x0;var _0x459d12=_0xa353[_0xd4ae00];return _0x459d12;};'use strict';var _=require(_0x3a35('0x0'));var util=require(_0x3a35('0x1'));var moment=require(_0x3a35('0x2'));var BPromise=require(_0x3a35('0x3'));var rs=require(_0x3a35('0x4'));var fs=require('fs');var Redis=require(_0x3a35('0x5'));var db=require(_0x3a35('0x6'))['db'];var utils=require(_0x3a35('0x7'));var logger=require(_0x3a35('0x8'))(_0x3a35('0x9'));var config=require(_0x3a35('0xa'));var jayson=require(_0x3a35('0xb'));var client=jayson[_0x3a35('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26dfec,_0x14656e,_0x40ee90){return new BPromise(function(_0x3007e6,_0x5ec2ee){return client['request'](_0x26dfec,_0x40ee90)[_0x3a35('0xd')](function(_0x344896){logger[_0x3a35('0xe')](_0x3a35('0xf'),_0x14656e,'request\x20sent');logger[_0x3a35('0x10')](_0x3a35('0x11'),_0x14656e,'request\x20sent',JSON[_0x3a35('0x12')](_0x344896));if(_0x344896[_0x3a35('0x13')]){if(_0x344896[_0x3a35('0x13')][_0x3a35('0x14')]===0x1f4){logger[_0x3a35('0x13')]('CmCompany,\x20%s,\x20%s',_0x14656e,_0x344896[_0x3a35('0x13')][_0x3a35('0x15')]);return _0x5ec2ee(_0x344896[_0x3a35('0x13')][_0x3a35('0x15')]);}logger[_0x3a35('0x13')](_0x3a35('0xf'),_0x14656e,_0x344896[_0x3a35('0x13')][_0x3a35('0x15')]);return _0x3007e6(_0x344896[_0x3a35('0x13')]['message']);}else{logger[_0x3a35('0xe')](_0x3a35('0xf'),_0x14656e,_0x3a35('0x16'));_0x3007e6(_0x344896['result'][_0x3a35('0x15')]);}})[_0x3a35('0x17')](function(_0x41bc44){logger['error'](_0x3a35('0xf'),_0x14656e,_0x41bc44);_0x5ec2ee(_0x41bc44);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e07c16c..359baa9 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 _0xcf06=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','describe','/:id','getContacts','post','create','put','update','delete','multer'];(function(_0x15c517,_0x247218){var _0x17d3c9=function(_0x26f92e){while(--_0x26f92e){_0x15c517['push'](_0x15c517['shift']());}};_0x17d3c9(++_0x247218);}(_0xcf06,0x8f));var _0x6cf0=function(_0x14d04b,_0x66bbb1){_0x14d04b=_0x14d04b-0x0;var _0x4d943b=_0xcf06[_0x14d04b];return _0x4d943b;};'use strict';var multer=require(_0x6cf0('0x0'));var util=require(_0x6cf0('0x1'));var path=require(_0x6cf0('0x2'));var timeout=require(_0x6cf0('0x3'));var express=require(_0x6cf0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6cf0('0x5'));var interaction=require(_0x6cf0('0x6'));var config=require('../../config/environment');var controller=require(_0x6cf0('0x7'));router[_0x6cf0('0x8')]('/',auth[_0x6cf0('0x9')](),controller['index']);router[_0x6cf0('0x8')]('/describe',auth[_0x6cf0('0x9')](),controller[_0x6cf0('0xa')]);router[_0x6cf0('0x8')](_0x6cf0('0xb'),auth[_0x6cf0('0x9')](),controller['show']);router[_0x6cf0('0x8')]('/:id/contacts',auth[_0x6cf0('0x9')](),controller[_0x6cf0('0xc')]);router[_0x6cf0('0xd')]('/',auth[_0x6cf0('0x9')](),controller[_0x6cf0('0xe')]);router[_0x6cf0('0xd')]('/:id/contacts',auth[_0x6cf0('0x9')](),controller['addContacts']);router[_0x6cf0('0xf')](_0x6cf0('0xb'),auth['isAuthenticated'](),controller[_0x6cf0('0x10')]);router[_0x6cf0('0x11')](_0x6cf0('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaf05=['../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','show','/:id/contacts','getContacts','post','addContacts','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x377f15,_0xb5b5ca){var _0x2daef2=function(_0x239002){while(--_0x239002){_0x377f15['push'](_0x377f15['shift']());}};_0x2daef2(++_0xb5b5ca);}(_0xaf05,0x137));var _0x5af0=function(_0x1fa2a2,_0x5e9b2d){_0x1fa2a2=_0x1fa2a2-0x0;var _0xb96fb5=_0xaf05[_0x1fa2a2];return _0xb96fb5;};'use strict';var multer=require(_0x5af0('0x0'));var util=require(_0x5af0('0x1'));var path=require(_0x5af0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5af0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5af0('0x4'));var controller=require(_0x5af0('0x5'));router[_0x5af0('0x6')]('/',auth[_0x5af0('0x7')](),controller[_0x5af0('0x8')]);router[_0x5af0('0x6')](_0x5af0('0x9'),auth[_0x5af0('0x7')](),controller['describe']);router[_0x5af0('0x6')]('/:id',auth[_0x5af0('0x7')](),controller[_0x5af0('0xa')]);router[_0x5af0('0x6')](_0x5af0('0xb'),auth[_0x5af0('0x7')](),controller[_0x5af0('0xc')]);router[_0x5af0('0xd')]('/',auth[_0x5af0('0x7')](),controller['create']);router[_0x5af0('0xd')](_0x5af0('0xb'),auth[_0x5af0('0x7')](),controller[_0x5af0('0xe')]);router[_0x5af0('0xf')](_0x5af0('0x10'),auth['isAuthenticated'](),controller[_0x5af0('0x11')]);router[_0x5af0('0x12')](_0x5af0('0x10'),auth[_0x5af0('0x7')](),controller[_0x5af0('0x13')]);module[_0x5af0('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index fba3c54..3c28986 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 _0x8c16=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x745b70,_0x1edb7f){var _0x1e4148=function(_0x3cc70d){while(--_0x3cc70d){_0x745b70['push'](_0x745b70['shift']());}};_0x1e4148(++_0x1edb7f);}(_0x8c16,0xa3));var _0x68c1=function(_0x297d71,_0x316d02){_0x297d71=_0x297d71-0x0;var _0x25e5d7=_0x8c16[_0x297d71];return _0x25e5d7;};'use strict';var _=require(_0x68c1('0x0'));var Sequelize=require(_0x68c1('0x1'));module[_0x68c1('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x68c1('0x3')]},'street':{'type':Sequelize[_0x68c1('0x3')]},'postalCode':{'type':Sequelize[_0x68c1('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x68c1('0x4')]},'phone':{'type':Sequelize[_0x68c1('0x3')]},'mobile':{'type':Sequelize[_0x68c1('0x3')]},'fax':{'type':Sequelize[_0x68c1('0x3')]},'email':{'type':Sequelize[_0x68c1('0x3')]},'url':{'type':Sequelize[_0x68c1('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x68c1('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x68c1('0x3')]},'teams':{'type':Sequelize[_0x68c1('0x3')]},'viber':{'type':Sequelize[_0x68c1('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x68c1('0x3')]},'telegram':{'type':Sequelize[_0x68c1('0x3')]},'UserId':{'type':Sequelize[_0x68c1('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68c1('0x5')](0x2)[_0x68c1('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x68c1('0x7')],'defaultValue':Sequelize[_0x68c1('0x8')]},'dialTimezone':{'type':Sequelize[_0x68c1('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4ddc=['NOW','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x4bb008,_0x52b2a9){var _0x558c5b=function(_0x16efff){while(--_0x16efff){_0x4bb008['push'](_0x4bb008['shift']());}};_0x558c5b(++_0x52b2a9);}(_0x4ddc,0x174));var _0xc4dd=function(_0x2a2d8f,_0x11e70c){_0x2a2d8f=_0x2a2d8f-0x0;var _0x89c89c=_0x4ddc[_0x2a2d8f];return _0x89c89c;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xc4dd('0x0')]={'firstName':{'type':Sequelize[_0xc4dd('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc4dd('0x1')]},'street':{'type':Sequelize[_0xc4dd('0x1')]},'postalCode':{'type':Sequelize[_0xc4dd('0x1')]},'city':{'type':Sequelize[_0xc4dd('0x1')]},'country':{'type':Sequelize[_0xc4dd('0x1')]},'dateOfBirth':{'type':Sequelize[_0xc4dd('0x1')]},'description':{'type':Sequelize[_0xc4dd('0x2')]},'phone':{'type':Sequelize[_0xc4dd('0x1')]},'mobile':{'type':Sequelize[_0xc4dd('0x1')]},'fax':{'type':Sequelize[_0xc4dd('0x1')]},'email':{'type':Sequelize[_0xc4dd('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xc4dd('0x1')]},'fb_data':{'type':Sequelize[_0xc4dd('0x1')]},'twitter':{'type':Sequelize[_0xc4dd('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xc4dd('0x1')]},'viber':{'type':Sequelize[_0xc4dd('0x1')]},'line':{'type':Sequelize[_0xc4dd('0x1')]},'wechat':{'type':Sequelize[_0xc4dd('0x1')]},'telegram':{'type':Sequelize[_0xc4dd('0x1')]},'UserId':{'type':Sequelize[_0xc4dd('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xc4dd('0x1')]},'priority':{'type':Sequelize[_0xc4dd('0x3')](0x2)[_0xc4dd('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc4dd('0x5')],'defaultValue':Sequelize[_0xc4dd('0x6')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xc4dd('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index d9609dd..aec2409 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 _0x0f67=['update','then','end','sendStatus','error','stack','name','send','index','describe','getOptions','query','user','catch','destroy','CmContact','find','params','tags','keys','length','cf_','columnName','displayName','analytics','CmCustomField','findAll','alias','custom','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','hasOwnProperty','push','contact','all','Tag','Tags','color','tag','CmContactHasItem','Phones','ItemType','sequelize','literal','$and','omit','map','format','pickBy','cf_%d','isEmpty','table','setFields','id\x20=\x20?','toParam','text','values','phone','getTags','findOne','model','rawAttributes','intersection','fields','attributes','order','sort','filters','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','include','rows','getHopperHistories','ContactId','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','import','agent','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','mail','chat','sms','openchannel','fax','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','userThirdDisposition','UserId','User','createdAt','DESC','findAndCountAll','startCase','Account','closed','closedAt','note','disposition','thirdDisposition','key','Owner','fullname','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','subject','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','moment','bluebird','util','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','limit','undefined','count','Content-Range'];(function(_0x160434,_0xc59a7f){var _0x323683=function(_0x202646){while(--_0x202646){_0x160434['push'](_0x160434['shift']());}};_0x323683(++_0xc59a7f);}(_0x0f67,0xf1));var _0x70f6=function(_0x2a34ec,_0x5a9e67){_0x2a34ec=_0x2a34ec-0x0;var _0x2cf324=_0x0f67[_0x2a34ec];return _0x2cf324;};'use strict';var moment=require(_0x70f6('0x0'));var BPromise=require(_0x70f6('0x1'));var util=require(_0x70f6('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x70f6('0x3'));var squel=require(_0x70f6('0x4'));var Papa=require(_0x70f6('0x5'));var Redis=require(_0x70f6('0x6'));var contacts=require(_0x70f6('0x7'));var qs=require(_0x70f6('0x8'));var logger=require(_0x70f6('0x9'))(_0x70f6('0xa'));var config=require(_0x70f6('0xb'));var shared=require(_0x70f6('0xc'));var db=require('../../mysqldb')['db'];config[_0x70f6('0xd')]=_['defaults'](config[_0x70f6('0xd')],{'host':_0x70f6('0xe'),'port':0x18eb});var socket=require(_0x70f6('0xf'))(new Redis(config[_0x70f6('0xd')]));require(_0x70f6('0x10'))['register'](socket);function respondWithResult(_0x1fabdb,_0x5a91b7){_0x5a91b7=_0x5a91b7||0xc8;return function(_0x425ea7){if(_0x425ea7){return _0x1fabdb[_0x70f6('0x11')](_0x5a91b7)[_0x70f6('0x12')](_0x425ea7);}};}function respondWithFilteredResult(_0x5d3594,_0xd1873c){return function(_0x2b3240){if(_0x2b3240){var _0xf98c46=typeof _0xd1873c[_0x70f6('0x13')]==='undefined'&&typeof _0xd1873c[_0x70f6('0x14')]===_0x70f6('0x15');var _0x1919d1=_0x2b3240[_0x70f6('0x16')];var _0x106888=_0xf98c46?0x0:_0xd1873c['offset'];var _0x3bbaf3=_0xf98c46?_0x2b3240[_0x70f6('0x16')]:_0xd1873c['offset']+_0xd1873c[_0x70f6('0x14')];var _0x3f58d0;if(_0x3bbaf3>=_0x1919d1){_0x3bbaf3=_0x1919d1;_0x3f58d0=0xc8;}else{_0x3f58d0=0xce;}_0x5d3594['status'](_0x3f58d0);return _0x5d3594['set'](_0x70f6('0x17'),_0x106888+'-'+_0x3bbaf3+'/'+_0x1919d1)['json'](_0x2b3240);}return null;};}function saveUpdates(_0xfde511){return function(_0x485636){if(_0x485636){return _0x485636[_0x70f6('0x18')](_0xfde511)[_0x70f6('0x19')](function(_0x2784a3){return _0x2784a3;});}return null;};}function removeEntity(_0x13255d){return function(_0x2bbebd){if(_0x2bbebd){return _0x2bbebd['destroy']()[_0x70f6('0x19')](function(){_0x13255d[_0x70f6('0x11')](0xcc)[_0x70f6('0x1a')]();});}};}function handleEntityNotFound(_0x1f9620){return function(_0xcb6233){if(!_0xcb6233){_0x1f9620[_0x70f6('0x1b')](0x194);}return _0xcb6233;};}function handleError(_0x1520af,_0x8a98f){_0x8a98f=_0x8a98f||0x1f4;return function(_0x150632){logger[_0x70f6('0x1c')](_0x150632[_0x70f6('0x1d')]);if(_0x150632[_0x70f6('0x1e')]){delete _0x150632[_0x70f6('0x1e')];}_0x1520af[_0x70f6('0x11')](_0x8a98f)[_0x70f6('0x1f')](_0x150632);};}exports[_0x70f6('0x20')]=function(_0x58811c,_0x12defe){var _0x53c091={};return contacts[_0x70f6('0x21')]()[_0x70f6('0x19')](function(_0x3d35a4){_0x53c091=qs[_0x70f6('0x22')](_0x3d35a4,_0x58811c);return contacts['findAll'](_0x58811c[_0x70f6('0x23')],_0x58811c[_0x70f6('0x24')],_0x53c091,_0x3d35a4);})[_0x70f6('0x19')](respondWithFilteredResult(_0x12defe,_0x53c091))[_0x70f6('0x25')](handleError(_0x12defe,null));};exports[_0x70f6('0x26')]=function(_0x5cb283,_0x3311ec){return db[_0x70f6('0x27')][_0x70f6('0x28')]({'where':{'id':_0x5cb283[_0x70f6('0x29')]['id']}})[_0x70f6('0x19')](handleEntityNotFound(_0x3311ec,null))[_0x70f6('0x19')](removeEntity(_0x3311ec,null))[_0x70f6('0x25')](handleError(_0x3311ec,null));};exports[_0x70f6('0x21')]=function(_0x442656,_0x5cef16){return db[_0x70f6('0x27')][_0x70f6('0x21')]()[_0x70f6('0x19')](function(_0x2214d3){delete _0x2214d3[_0x70f6('0x2a')];for(var _0x76c57c=0x0;_0x76c57c0x0){return new Promise(function(_0x6e677b){var _0x3c014b=[];for(var _0x230c8f=0x0;_0x230c8f<_0x37573e[_0x70f6('0x2c')];_0x230c8f++){_0x3c014b[_0x70f6('0x68')](insertAdditionalPhones(_0x37573e[_0x230c8f][_0x70f6('0x69')],_0x37573e[_0x230c8f][_0x70f6('0x5e')]));}Promise[_0x70f6('0x6a')](_0x3c014b)[_0x70f6('0x19')](function(){_0x6e677b(0x1);});})[_0x70f6('0x19')](function(){return{'success':_0x4738d0,'failure':_0x123f39,'duplicates':_0x5047eb};});}else{return{'success':_0x4738d0,'failure':_0x123f39,'duplicates':_0x5047eb};}}})[_0x70f6('0x19')](respondWithResult(_0x288dc4,0xc9))[_0x70f6('0x25')](handleError(_0x288dc4,null));};exports['show']=function(_0x3401bf,_0x4e9793){var _0x299d84;return db[_0x70f6('0x27')][_0x70f6('0x21')]()[_0x70f6('0x19')](function(_0xce035c){return db['CmContact'][_0x70f6('0x28')]({'where':{'id':_0x3401bf['params']['id']},'include':[{'model':db[_0x70f6('0x6b')],'as':_0x70f6('0x6c'),'attributes':['id','name',_0x70f6('0x6d')],'required':_0x3401bf[_0x70f6('0x23')][_0x70f6('0x6e')]?!![]:![]},{'model':db[_0x70f6('0x6f')],'as':_0x70f6('0x70'),'where':{'CmContactId':_0x3401bf[_0x70f6('0x29')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x70f6('0x71')}]}],'order':[db[_0x70f6('0x72')][_0x70f6('0x73')]('Phones.OrderBy')],'attributes':_['keys'](_0xce035c)});})[_0x70f6('0x19')](function(_0xd9a462){if(!_[_0x70f6('0x5b')](_0xd9a462)){_0x299d84=_0xd9a462[_0x70f6('0x3a')]({'plain':!![]});var _0x5a2856={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xd9a462&&_0xd9a462[_0x70f6('0x64')]){if(_0xd9a462[_0x70f6('0x64')]){_0x5a2856[_0x70f6('0x62')][_0x70f6('0x74')][_0x70f6('0x68')]({'ListId':{'$ne':_0xd9a462[_0x70f6('0x64')]}});}}return db[_0x70f6('0x31')]['findAll'](_0x5a2856);}})['then'](function(_0x5eed5a){if(!_[_0x70f6('0x5b')](_0x5eed5a)){return _[_0x70f6('0x75')](_0x299d84,_[_0x70f6('0x76')](_0x5eed5a,function(_0x452a63){return util[_0x70f6('0x77')]('cf_%d',_0x452a63['id']);}));}})[_0x70f6('0x19')](handleEntityNotFound(_0x4e9793,null))[_0x70f6('0x19')](respondWithResult(_0x4e9793,null))['catch'](handleError(_0x4e9793,null));};exports['update']=function(_0x31d1c0,_0x4d6193){var _0x49a860;if(_0x31d1c0[_0x70f6('0x38')]['id']){delete _0x31d1c0[_0x70f6('0x38')]['id'];}if(!_[_0x70f6('0x5b')](_0x31d1c0['body'][_0x70f6('0x5a')])){var _0x1e999b=_0x31d1c0[_0x70f6('0x38')][_0x70f6('0x5a')];if(!_[_0x70f6('0x5b')](shared['timezones'][_0x1e999b]))_0x31d1c0[_0x70f6('0x38')][_0x70f6('0x5d')]=shared[_0x70f6('0x5c')][_0x1e999b][_0x70f6('0x5d')];}return db[_0x70f6('0x27')][_0x70f6('0x28')]({'where':{'id':_0x31d1c0[_0x70f6('0x29')]['id']}})[_0x70f6('0x19')](handleEntityNotFound(_0x4d6193,null))[_0x70f6('0x19')](saveUpdates(_0x31d1c0[_0x70f6('0x38')],null))['then'](function(_0x50418b){_0x49a860=_0x50418b;var _0x279aa0={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x50418b&&_0x50418b['ListId']){if(_0x50418b[_0x70f6('0x64')]){_0x279aa0[_0x70f6('0x62')][_0x70f6('0x74')][_0x70f6('0x68')]({'ListId':{'$ne':_0x50418b[_0x70f6('0x64')]}});}}return db[_0x70f6('0x31')][_0x70f6('0x32')](_0x279aa0);})[_0x70f6('0x19')](function(_0x1dcdc0){if(_0x1dcdc0){return _[_0x70f6('0x75')](_[_0x70f6('0x78')](_0x31d1c0[_0x70f6('0x38')],function(_0xa70abf,_0x931dc5){return _['startsWith'](_0x931dc5,_0x70f6('0x2d'));}),_[_0x70f6('0x76')](_0x1dcdc0,function(_0xd3ba06){return util[_0x70f6('0x77')](_0x70f6('0x79'),_0xd3ba06['id']);}));}})[_0x70f6('0x19')](function(_0x28248b){if(_0x28248b&&!_[_0x70f6('0x7a')](_0x28248b)){var _0x2f606b=squel[_0x70f6('0x18')]()[_0x70f6('0x7b')]('cm_contacts')[_0x70f6('0x7c')](_0x28248b)[_0x70f6('0x62')](_0x70f6('0x7d'),_0x31d1c0[_0x70f6('0x29')]['id'])[_0x70f6('0x7e')]();return db[_0x70f6('0x72')][_0x70f6('0x23')](_0x2f606b[_0x70f6('0x7f')],{'replacements':_0x2f606b[_0x70f6('0x80')]});}})['then'](function(){if(_0x31d1c0[_0x70f6('0x38')][_0x70f6('0x81')]&&_0x49a860){return db[_0x70f6('0x3f')][_0x70f6('0x18')]({'phone':_0x31d1c0[_0x70f6('0x38')][_0x70f6('0x81')],'OrderBy':0x0},{'where':{'ContactId':_0x49a860['id']}});}})[_0x70f6('0x19')](function(){return _0x49a860;})[_0x70f6('0x19')](respondWithResult(_0x4d6193,null))[_0x70f6('0x25')](handleError(_0x4d6193,null));};exports[_0x70f6('0x82')]=function(_0x33258f,_0xecbcce){var _0x21c6ea={};var _0x49a79b={};var _0x262c22;var _0x345540;return db[_0x70f6('0x27')][_0x70f6('0x83')]({'where':{'id':_0x33258f[_0x70f6('0x29')]['id']}})[_0x70f6('0x19')](handleEntityNotFound(_0xecbcce,null))[_0x70f6('0x19')](function(_0xc11c14){if(_0xc11c14){_0x262c22=_0xc11c14;_0x49a79b[_0x70f6('0x84')]=_[_0x70f6('0x2b')](db['Tag'][_0x70f6('0x85')]);_0x49a79b[_0x70f6('0x23')]=_[_0x70f6('0x2b')](_0x33258f[_0x70f6('0x23')]);_0x49a79b['filters']=_[_0x70f6('0x86')](_0x49a79b[_0x70f6('0x84')],_0x49a79b['query']);_0x21c6ea['attributes']=_[_0x70f6('0x86')](_0x49a79b[_0x70f6('0x84')],qs['fields'](_0x33258f[_0x70f6('0x23')][_0x70f6('0x87')]));_0x21c6ea[_0x70f6('0x88')]=_0x21c6ea[_0x70f6('0x88')][_0x70f6('0x2c')]?_0x21c6ea[_0x70f6('0x88')]:_0x49a79b[_0x70f6('0x84')];_0x21c6ea[_0x70f6('0x89')]=qs['sort'](_0x33258f[_0x70f6('0x23')][_0x70f6('0x8a')]);_0x21c6ea['where']=qs[_0x70f6('0x8b')](_[_0x70f6('0x8c')](_0x33258f[_0x70f6('0x23')],_0x49a79b[_0x70f6('0x8b')]));if(_0x33258f['query'][_0x70f6('0x8d')]){_0x21c6ea[_0x70f6('0x62')]=_[_0x70f6('0x37')](_0x21c6ea[_0x70f6('0x62')],{'$or':_[_0x70f6('0x76')](_0x21c6ea[_0x70f6('0x88')],function(_0x2767d0){var _0x19f543={};_0x19f543[_0x2767d0]={'$like':'%'+_0x33258f[_0x70f6('0x23')][_0x70f6('0x8d')]+'%'};return _0x19f543;})});}_0x21c6ea=_[_0x70f6('0x37')]({},_0x21c6ea,_0x33258f[_0x70f6('0x8e')]);return _0x262c22[_0x70f6('0x82')](_0x21c6ea);}})[_0x70f6('0x19')](function(_0x314b32){if(_0x314b32){_0x345540=_0x314b32[_0x70f6('0x2c')];if(!_0x33258f[_0x70f6('0x23')][_0x70f6('0x67')](_0x70f6('0x8f'))){_0x21c6ea[_0x70f6('0x14')]=qs[_0x70f6('0x14')](_0x33258f[_0x70f6('0x23')][_0x70f6('0x14')]);_0x21c6ea[_0x70f6('0x13')]=qs[_0x70f6('0x13')](_0x33258f[_0x70f6('0x23')][_0x70f6('0x13')]);}return _0x262c22[_0x70f6('0x82')](_0x21c6ea);}})[_0x70f6('0x19')](function(_0x5c53e5){if(_0x5c53e5){return _0x5c53e5?{'count':_0x345540,'rows':_0x5c53e5}:null;}})['then'](respondWithResult(_0xecbcce,null))['catch'](handleError(_0xecbcce,null));};exports[_0x70f6('0x90')]=function(_0x1641b8,_0x31b6e7){if(_0x1641b8['body']['id']){delete _0x1641b8[_0x70f6('0x38')]['id'];}return db[_0x70f6('0x27')][_0x70f6('0x83')]({'where':{'id':_0x1641b8[_0x70f6('0x29')]['id']}})['then'](handleEntityNotFound(_0x31b6e7,null))[_0x70f6('0x19')](function(_0x4357d5){if(_0x4357d5){return _0x4357d5[_0x70f6('0x90')](_0x1641b8[_0x70f6('0x38')][_0x70f6('0x91')]||[]);}return null;})[_0x70f6('0x19')](respondWithResult(_0x31b6e7,null))[_0x70f6('0x25')](handleError(_0x31b6e7,null));};exports[_0x70f6('0x92')]=function(_0xc78547,_0x17a7b6){var _0x578586=[];_0x578586[_0x70f6('0x68')](addAdditionalPhones(_0xc78547[_0x70f6('0x38')]));Promise['all'](_0x578586)[_0x70f6('0x19')](function(){_0x578586=[];_0x578586['push'](deleteCmHopperPhones(_0xc78547[_0x70f6('0x38')]['id']));_0x578586[_0x70f6('0x68')](addCmHopperPhones(_0xc78547[_0x70f6('0x38')]['id']));Promise[_0x70f6('0x6a')](_0x578586)[_0x70f6('0x19')](function(){return[0x1];})['then'](respondWithResult(_0x17a7b6,null));});};function addAdditionalPhones(_0x4e627d){var _0x56c7aa;return new Promise(function(_0x30bd3a){return db[_0x70f6('0x6f')][_0x70f6('0x26')]({'where':{'CmContactId':_0x4e627d['id']}})[_0x70f6('0x19')](function(){db[_0x70f6('0x93')][_0x70f6('0x32')]({'raw':!![],'attributes':['id',_0x70f6('0x94')]})[_0x70f6('0x19')](function(_0x530955){var _0x313cfb=[];for(var _0x1ce6b8=0x0;_0x1ce6b8<_0x4e627d[_0x70f6('0x95')][_0x70f6('0x2c')];_0x1ce6b8++){var _0x4e2346=_0x4e627d['item_types']?_[_0x70f6('0x5b')](_0x4e627d[_0x70f6('0x96')][_0x1ce6b8])?'':_0x4e627d[_0x70f6('0x96')][_0x1ce6b8]:_0x4e627d[_0x70f6('0x95')][_0x1ce6b8]['ItemTypeId']?_0x4e627d[_0x70f6('0x95')][_0x1ce6b8][_0x70f6('0x97')]:'';var _0x51bd4c=_[_0x70f6('0x5b')](_0x4e627d[_0x70f6('0x95')][_0x1ce6b8][_0x70f6('0x98')])?'':_0x4e627d[_0x70f6('0x95')][_0x1ce6b8][_0x70f6('0x98')];var _0x229900=_0x4e2346+':'+_0x4e627d[_0x70f6('0x95')][_0x1ce6b8]['phone']+'§'+_0x51bd4c;if(_['isNil'](_0x56c7aa))_0x56c7aa=_0x229900;else _0x56c7aa+=';'+_0x229900;var _0x1c4f28=null;var _0x29f2c0=null;if(_0x4e627d[_0x70f6('0x96')]){if(!_[_0x70f6('0x5b')](_0x4e627d[_0x70f6('0x96')][_0x1ce6b8])){_0x29f2c0=_[_0x70f6('0x28')](_0x530955,function(_0x3a7557){return _0x3a7557['id']===_0x4e627d[_0x70f6('0x96')][_0x1ce6b8];});if(!_[_0x70f6('0x5b')](_0x29f2c0)){_0x1c4f28=_0x29f2c0[_0x70f6('0x94')];}}}else{if(!_[_0x70f6('0x5b')](_0x4e627d[_0x70f6('0x95')][_0x1ce6b8])){_0x29f2c0=_[_0x70f6('0x28')](_0x530955,function(_0x187e9e){return _0x187e9e['id']===_0x4e627d[_0x70f6('0x95')][_0x1ce6b8][_0x70f6('0x97')];});if(!_[_0x70f6('0x5b')](_0x29f2c0)){_0x1c4f28=_0x1ce6b8;}}}if(_[_0x70f6('0x5b')](_0x1c4f28)){_0x1c4f28=0x64;}_0x313cfb[_0x70f6('0x68')](addAdditionalPhone(_0x4e627d['id'],_0x4e627d[_0x70f6('0x95')][_0x1ce6b8]['phone'],_0x4e627d['item_types']?_[_0x70f6('0x5b')](_0x4e627d[_0x70f6('0x96')][_0x1ce6b8])?null:_0x4e627d['item_types'][_0x1ce6b8]:_0x4e627d['items'][_0x1ce6b8]['ItemTypeId']?_0x4e627d['items'][_0x1ce6b8][_0x70f6('0x97')]:null,_0x1c4f28,_0x51bd4c));}Promise[_0x70f6('0x6a')](_0x313cfb)[_0x70f6('0x19')](function(){db[_0x70f6('0x27')]['update']({'AdditionalPhones':_0x56c7aa},{'where':{'id':_0x4e627d['id']}})[_0x70f6('0x19')](function(){_0x30bd3a(0x1);});});});});});}function addAdditionalPhone(_0x35ab12,_0x72f25f,_0x3d320d,_0x467a6b,_0x263032){return db[_0x70f6('0x6f')]['find']({'where':{'CmContactId':_0x35ab12,'item':_0x72f25f}})[_0x70f6('0x19')](function(_0x35b9db){if(_0x35b9db)logger['info'](_0x70f6('0x99'),_0x35b9db);else{db[_0x70f6('0x6f')][_0x70f6('0x43')]({'CmContactId':_0x35ab12,'item':_0x72f25f,'ItemTypeId':_0x3d320d,'OrderBy':_0x467a6b,'ItemClass':'PHONE','description':_0x263032});}});}function deleteCmHopperPhones(_0x3399f4){return new Promise(function(_0x8f2a54){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3399f4}})[_0x70f6('0x19')](function(_0x531b16){db[_0x70f6('0x9a')][_0x70f6('0x26')]({'where':{'CmHopperId':{'$in':_[_0x70f6('0x76')](_0x531b16,'id')}}});})['then'](function(){_0x8f2a54(0x1);});});}function addCmHopperPhones(_0x2d7a31){return new Promise(function(_0x4ab359){return db['CmHopper'][_0x70f6('0x32')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2d7a31}})['then'](function(_0x1e43dd){var _0x777f61=[];_[_0x70f6('0x76')](_0x1e43dd,function(_0xb7fe89){_0x777f61[_0x70f6('0x68')](createCmHopperPhone(_0x2d7a31,_0xb7fe89['id']));});Promise[_0x70f6('0x6a')](_0x777f61)[_0x70f6('0x19')](function(){_0x4ab359(0x1);});});});}function createCmHopperPhone(_0x30298c,_0x236a5e){return new Promise(function(_0x1f84e8){db[_0x70f6('0x6f')]['findAll']({'raw':!![],'attributes':[_0x70f6('0x9b'),'OrderBy'],'where':{'CmContactId':_0x30298c,'ItemClass':_0x70f6('0x9c')},'include':[{'model':db[_0x70f6('0x93')],'attributes':[_0x70f6('0x94')],'as':'ItemType'}],'order':['OrderBy',db[_0x70f6('0x72')][_0x70f6('0x73')](_0x70f6('0x9d'))]})['then'](function(_0x30f10e){var _0x1f9d03=0x1;var _0x134fe8=_[_0x70f6('0x76')](_0x30f10e,function(_0x1622b6){_0x1622b6['CmHopperId']=_0x236a5e;_0x1622b6[_0x70f6('0x81')]=_0x1622b6[_0x70f6('0x9b')];_0x1622b6[_0x70f6('0x94')]=_0x1f9d03;delete _0x1622b6[_0x70f6('0x9e')];_0x1f9d03=_0x1f9d03+0x1;return _0x1622b6;});return db['CmHopperAdditionalPhone'][_0x70f6('0x5f')](_0x134fe8,{});})[_0x70f6('0x19')](function(){_0x1f84e8(0x1);});});}function insertAdditionalPhones(_0x5549bd,_0x3846f4){return new Promise(function(_0x44a8f8){var _0x1bc9fd=[];for(var _0x57f235=0x0;_0x57f235<_0x3846f4[_0x70f6('0x2c')];_0x57f235++){var _0x243777=_0x3846f4[_0x57f235];_0x1bc9fd['push'](parseContactItemType(_0x243777));}Promise[_0x70f6('0x6a')](_0x1bc9fd)['then'](function(){var _0x440f73={'id':_0x5549bd['id'],'items':_0x3846f4};return addAdditionalPhones(_0x440f73)[_0x70f6('0x19')](function(){return addCmHopperPhones(_0x5549bd['id']);});})[_0x70f6('0x19')](function(){_0x44a8f8(_0x5549bd);});});}function parseContactItemType(_0x12a292){return new Promise(function(_0x14f86b){if(_0x12a292[_0x70f6('0x67')](_0x70f6('0x97'))){_0x14f86b(_0x12a292);}else{return db[_0x70f6('0x93')][_0x70f6('0x28')]({'where':{'name':_0x12a292[_0x70f6('0x71')]}})[_0x70f6('0x19')](function(_0x461608){if(_[_0x70f6('0x5b')](_0x461608))_0x12a292[_0x70f6('0x97')]=null;else _0x12a292[_0x70f6('0x97')]=_0x461608['id'];_0x14f86b(_0x12a292);});}});}exports[_0x70f6('0x9f')]=function(_0x59446c,_0x53e16b){return db[_0x70f6('0x6f')]['findAll']({'raw':!![],'where':{'CmContactId':_0x59446c[_0x70f6('0x29')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x70f6('0x93')],'as':_0x70f6('0x71')}],'order':[[_0x70f6('0x94')],[db['sequelize'][_0x70f6('0x73')](_0x70f6('0x9d'))]]})[_0x70f6('0x19')](function(_0xd23c36){return _0xd23c36;})[_0x70f6('0x19')](respondWithResult(_0x53e16b,null))[_0x70f6('0x25')](handleError(_0x53e16b,null));};exports[_0x70f6('0xa0')]=function(_0x502824,_0x35437b){return db[_0x70f6('0x6f')][_0x70f6('0x32')]({'raw':!![],'where':{'CmContactId':_0x502824[_0x70f6('0x38')][_0x70f6('0xa1')]}})[_0x70f6('0x19')](function(_0x256642){var _0x373935=_[_0x70f6('0x76')](_0x256642,function(_0x22bbac){_0x22bbac[_0x70f6('0xa2')]=_0x502824['body'][_0x70f6('0xa3')];return _0x22bbac;});return db[_0x70f6('0x6f')][_0x70f6('0x5f')](_0x373935,{});})['then'](function(){return addCmHopperPhones(_0x502824[_0x70f6('0x38')][_0x70f6('0xa3')]);})[_0x70f6('0x19')](function(){return['ok'];})['then'](respondWithResult(_0x35437b,null))[_0x70f6('0x25')](handleError(_0x35437b,null));};exports[_0x70f6('0xa4')]=function(_0x56685d,_0x356794){var _0x7b4542=[];_0x7b4542[_0x70f6('0x68')](createCmHopperPhone(_0x56685d[_0x70f6('0x38')]['id'],_0x56685d[_0x70f6('0x38')][_0x70f6('0xa5')]));Promise[_0x70f6('0x6a')](_0x7b4542)[_0x70f6('0x19')](function(){return[0x1];})[_0x70f6('0x19')](respondWithResult(_0x356794,null));};exports[_0x70f6('0xa6')]=function(_0x26e727,_0x40a8be){var _0x22f743={'raw':![],'where':{}};var _0x5b7d65={};var _0x1edb06={'count':0x0,'rows':[]};return db['CmContact'][_0x70f6('0x83')]({'where':{'id':_0x26e727[_0x70f6('0x29')]['id']}})[_0x70f6('0x19')](handleEntityNotFound(_0x40a8be,null))[_0x70f6('0x19')](function(_0x30d417){if(_0x30d417){_0x5b7d65[_0x70f6('0x84')]=_[_0x70f6('0x2b')](db[_0x70f6('0x3f')]['rawAttributes']);_0x5b7d65[_0x70f6('0x23')]=_[_0x70f6('0x2b')](_0x26e727[_0x70f6('0x23')]);_0x5b7d65['filters']=_[_0x70f6('0x86')](_0x5b7d65[_0x70f6('0x84')],_0x5b7d65[_0x70f6('0x23')]);_0x22f743['attributes']=_['intersection'](_0x5b7d65[_0x70f6('0x84')],qs[_0x70f6('0x87')](_0x26e727[_0x70f6('0x23')][_0x70f6('0x87')]));_0x22f743[_0x70f6('0x88')]=_0x22f743[_0x70f6('0x88')][_0x70f6('0x2c')]?_0x22f743[_0x70f6('0x88')]:_0x5b7d65[_0x70f6('0x84')];if(!_0x26e727[_0x70f6('0x23')][_0x70f6('0x67')](_0x70f6('0x8f'))){_0x22f743[_0x70f6('0x14')]=qs[_0x70f6('0x14')](_0x26e727[_0x70f6('0x23')][_0x70f6('0x14')]);_0x22f743[_0x70f6('0x13')]=qs[_0x70f6('0x13')](_0x26e727['query'][_0x70f6('0x13')]);}_0x22f743[_0x70f6('0x89')]=qs[_0x70f6('0x8a')](_0x26e727[_0x70f6('0x23')][_0x70f6('0x8a')]);_0x22f743[_0x70f6('0x62')]=qs[_0x70f6('0x8b')](_[_0x70f6('0x8c')](_0x26e727['query'],_0x5b7d65[_0x70f6('0x8b')]));_0x22f743[_0x70f6('0x62')]['ContactId']=_0x30d417['id'];if(_0x26e727['query'][_0x70f6('0x8d')]){_0x22f743[_0x70f6('0x62')]=_[_0x70f6('0x37')](_0x22f743[_0x70f6('0x62')],{'$or':_['map'](_0x22f743[_0x70f6('0x88')],function(_0x9e7bab){var _0x1e4fff={};_0x1e4fff[_0x9e7bab]={'$like':'%'+_0x26e727[_0x70f6('0x23')]['filter']+'%'};return _0x1e4fff;})});}_0x22f743=_[_0x70f6('0x37')]({},_0x22f743,_0x26e727['options']);return db[_0x70f6('0x3f')]['count']({'where':_0x22f743[_0x70f6('0x62')]})['then'](function(_0x64e89a){_0x1edb06['count']=_0x64e89a;if(_0x26e727[_0x70f6('0x23')][_0x70f6('0xa7')]){_0x22f743[_0x70f6('0xa8')]=[{'all':!![]}];}return db['CmHopper'][_0x70f6('0x32')](_0x22f743);})[_0x70f6('0x19')](function(_0xdc6fa0){_0x1edb06[_0x70f6('0xa9')]=_0xdc6fa0;return _0x1edb06;});}})['then'](respondWithFilteredResult(_0x40a8be,_0x22f743))[_0x70f6('0x25')](handleError(_0x40a8be,null));};exports[_0x70f6('0xaa')]=function(_0x2f0eb1,_0x1abf03){var _0x4f2444={'raw':!![],'where':{}};var _0x31fbf2={};var _0x141e90={'count':0x0,'rows':[]};return db[_0x70f6('0x27')][_0x70f6('0x83')]({'where':{'id':_0x2f0eb1[_0x70f6('0x29')]['id']}})[_0x70f6('0x19')](handleEntityNotFound(_0x1abf03,null))[_0x70f6('0x19')](function(_0xb4bcde){if(_0xb4bcde){_0x31fbf2[_0x70f6('0x84')]=_['keys'](db[_0x70f6('0x4e')][_0x70f6('0x85')]);_0x31fbf2[_0x70f6('0x23')]=_['keys'](_0x2f0eb1['query']);_0x31fbf2['filters']=_[_0x70f6('0x86')](_0x31fbf2[_0x70f6('0x84')],_0x31fbf2[_0x70f6('0x23')]);_0x4f2444[_0x70f6('0x88')]=_[_0x70f6('0x86')](_0x31fbf2['model'],qs[_0x70f6('0x87')](_0x2f0eb1[_0x70f6('0x23')][_0x70f6('0x87')]));_0x4f2444['attributes']=_0x4f2444[_0x70f6('0x88')][_0x70f6('0x2c')]?_0x4f2444[_0x70f6('0x88')]:_0x31fbf2[_0x70f6('0x84')];if(!_0x2f0eb1['query'][_0x70f6('0x67')](_0x70f6('0x8f'))){_0x4f2444[_0x70f6('0x14')]=qs[_0x70f6('0x14')](_0x2f0eb1[_0x70f6('0x23')][_0x70f6('0x14')]);_0x4f2444['offset']=qs['offset'](_0x2f0eb1[_0x70f6('0x23')]['offset']);}_0x4f2444[_0x70f6('0x89')]=qs['sort'](_0x2f0eb1[_0x70f6('0x23')]['sort']);_0x4f2444['where']=qs[_0x70f6('0x8b')](_[_0x70f6('0x8c')](_0x2f0eb1['query'],_0x31fbf2[_0x70f6('0x8b')]));_0x4f2444['where']['ContactId']=_0xb4bcde['id'];if(_0x2f0eb1['query'][_0x70f6('0x8d')]){_0x4f2444['where']=_['merge'](_0x4f2444[_0x70f6('0x62')],{'$or':_[_0x70f6('0x76')](_0x4f2444[_0x70f6('0x88')],function(_0x214077){var _0x511246={};_0x511246[_0x214077]={'$like':'%'+_0x2f0eb1[_0x70f6('0x23')]['filter']+'%'};return _0x511246;})});}_0x4f2444=_[_0x70f6('0x37')]({},_0x4f2444,_0x2f0eb1[_0x70f6('0x8e')]);return db[_0x70f6('0x4e')][_0x70f6('0x16')]({'where':_0x4f2444[_0x70f6('0x62')]})[_0x70f6('0x19')](function(_0x4ac224){_0x141e90['count']=_0x4ac224;if(_0x2f0eb1[_0x70f6('0x23')][_0x70f6('0xa7')]){_0x4f2444['include']=[{'all':!![]}];}return db[_0x70f6('0x4e')][_0x70f6('0x32')](_0x4f2444);})[_0x70f6('0x19')](function(_0x431f83){_0x141e90[_0x70f6('0xa9')]=_0x431f83;return _0x141e90;});}})[_0x70f6('0x19')](respondWithFilteredResult(_0x1abf03,_0x4f2444))[_0x70f6('0x25')](handleError(_0x1abf03,null));};exports['getHopperFinals']=function(_0x6a6465,_0x21904e){var _0xb2e144={'raw':!![],'where':{}};var _0x7e9a23={};var _0x9e649b={'count':0x0,'rows':[]};return db['CmContact'][_0x70f6('0x83')]({'where':{'id':_0x6a6465[_0x70f6('0x29')]['id']}})[_0x70f6('0x19')](handleEntityNotFound(_0x21904e,null))[_0x70f6('0x19')](function(_0x27316b){if(_0x27316b){_0x7e9a23[_0x70f6('0x84')]=_[_0x70f6('0x2b')](db['CmHopperFinal']['rawAttributes']);_0x7e9a23['query']=_[_0x70f6('0x2b')](_0x6a6465['query']);_0x7e9a23[_0x70f6('0x8b')]=_['intersection'](_0x7e9a23[_0x70f6('0x84')],_0x7e9a23[_0x70f6('0x23')]);_0xb2e144['attributes']=_['intersection'](_0x7e9a23[_0x70f6('0x84')],qs[_0x70f6('0x87')](_0x6a6465['query'][_0x70f6('0x87')]));_0xb2e144[_0x70f6('0x88')]=_0xb2e144[_0x70f6('0x88')][_0x70f6('0x2c')]?_0xb2e144[_0x70f6('0x88')]:_0x7e9a23[_0x70f6('0x84')];if(!_0x6a6465['query'][_0x70f6('0x67')](_0x70f6('0x8f'))){_0xb2e144[_0x70f6('0x14')]=qs[_0x70f6('0x14')](_0x6a6465[_0x70f6('0x23')][_0x70f6('0x14')]);_0xb2e144[_0x70f6('0x13')]=qs[_0x70f6('0x13')](_0x6a6465['query']['offset']);}_0xb2e144[_0x70f6('0x89')]=qs[_0x70f6('0x8a')](_0x6a6465[_0x70f6('0x23')][_0x70f6('0x8a')]);_0xb2e144['where']=qs[_0x70f6('0x8b')](_[_0x70f6('0x8c')](_0x6a6465[_0x70f6('0x23')],_0x7e9a23['filters']));_0xb2e144[_0x70f6('0x62')][_0x70f6('0xab')]=_0x27316b['id'];if(_0x6a6465[_0x70f6('0x23')][_0x70f6('0x8d')]){_0xb2e144[_0x70f6('0x62')]=_[_0x70f6('0x37')](_0xb2e144['where'],{'$or':_[_0x70f6('0x76')](_0xb2e144[_0x70f6('0x88')],function(_0x1bb41b){var _0x2927e0={};_0x2927e0[_0x1bb41b]={'$like':'%'+_0x6a6465['query'][_0x70f6('0x8d')]+'%'};return _0x2927e0;})});}_0xb2e144=_[_0x70f6('0x37')]({},_0xb2e144,_0x6a6465[_0x70f6('0x8e')]);return db[_0x70f6('0x4d')][_0x70f6('0x16')]({'where':_0xb2e144[_0x70f6('0x62')]})['then'](function(_0x3f339d){_0x9e649b[_0x70f6('0x16')]=_0x3f339d;if(_0x6a6465[_0x70f6('0x23')][_0x70f6('0xa7')]){_0xb2e144['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x70f6('0x32')](_0xb2e144);})[_0x70f6('0x19')](function(_0x5e5059){_0x9e649b[_0x70f6('0xa9')]=_0x5e5059;return _0x9e649b;});}})[_0x70f6('0x19')](respondWithFilteredResult(_0x21904e,_0xb2e144))[_0x70f6('0x25')](handleError(_0x21904e,null));};exports[_0x70f6('0xac')]=function(_0x3be884,_0x3664f4){var _0x1c4c33={'raw':!![],'where':{}};var _0x4c7cf4={};var _0x48b805={'count':0x0,'rows':[]};return db[_0x70f6('0x27')]['findOne']({'where':{'id':_0x3be884['params']['id']}})['then'](handleEntityNotFound(_0x3664f4,null))[_0x70f6('0x19')](function(_0x30e5b0){if(_0x30e5b0){_0x4c7cf4['model']=_['keys'](db[_0x70f6('0x56')][_0x70f6('0x85')]);_0x4c7cf4[_0x70f6('0x23')]=_[_0x70f6('0x2b')](_0x3be884[_0x70f6('0x23')]);_0x4c7cf4['filters']=_['intersection'](_0x4c7cf4['model'],_0x4c7cf4[_0x70f6('0x23')]);_0x1c4c33['attributes']=_[_0x70f6('0x86')](_0x4c7cf4['model'],qs[_0x70f6('0x87')](_0x3be884[_0x70f6('0x23')]['fields']));_0x1c4c33[_0x70f6('0x88')]=_0x1c4c33['attributes'][_0x70f6('0x2c')]?_0x1c4c33[_0x70f6('0x88')]:_0x4c7cf4['model'];if(!_0x3be884['query'][_0x70f6('0x67')](_0x70f6('0x8f'))){_0x1c4c33[_0x70f6('0x14')]=qs[_0x70f6('0x14')](_0x3be884[_0x70f6('0x23')][_0x70f6('0x14')]);_0x1c4c33[_0x70f6('0x13')]=qs[_0x70f6('0x13')](_0x3be884[_0x70f6('0x23')][_0x70f6('0x13')]);}_0x1c4c33[_0x70f6('0x89')]=qs[_0x70f6('0x8a')](_0x3be884['query']['sort']);_0x1c4c33[_0x70f6('0x62')]=qs[_0x70f6('0x8b')](_['pick'](_0x3be884[_0x70f6('0x23')],_0x4c7cf4[_0x70f6('0x8b')]));_0x1c4c33[_0x70f6('0x62')][_0x70f6('0xab')]=_0x30e5b0['id'];if(_0x3be884[_0x70f6('0x23')]['filter']){_0x1c4c33[_0x70f6('0x62')]=_[_0x70f6('0x37')](_0x1c4c33[_0x70f6('0x62')],{'$or':_[_0x70f6('0x76')](_0x1c4c33[_0x70f6('0x88')],function(_0x27cfc7){var _0x407d5b={};_0x407d5b[_0x27cfc7]={'$like':'%'+_0x3be884['query'][_0x70f6('0x8d')]+'%'};return _0x407d5b;})});}_0x1c4c33=_[_0x70f6('0x37')]({},_0x1c4c33,_0x3be884[_0x70f6('0x8e')]);return db[_0x70f6('0x56')][_0x70f6('0x16')]({'where':_0x1c4c33[_0x70f6('0x62')]})[_0x70f6('0x19')](function(_0x528b73){_0x48b805[_0x70f6('0x16')]=_0x528b73;if(_0x3be884[_0x70f6('0x23')][_0x70f6('0xa7')]){_0x1c4c33[_0x70f6('0xa8')]=[{'all':!![]}];}return db[_0x70f6('0x56')][_0x70f6('0x32')](_0x1c4c33);})[_0x70f6('0x19')](function(_0x10b06b){_0x48b805[_0x70f6('0xa9')]=_0x10b06b;return _0x48b805;});}})[_0x70f6('0x19')](respondWithFilteredResult(_0x3664f4,_0x1c4c33))[_0x70f6('0x25')](handleError(_0x3664f4,null));};exports[_0x70f6('0xad')]=function(_0x250346,_0x574966){try{if(!_0x250346[_0x70f6('0x38')][_0x70f6('0x64')]){throw new Error(_0x70f6('0xae'));}if(!_0x250346[_0x70f6('0x38')][_0x70f6('0xaf')]){throw new Error(_0x70f6('0xb0'));}if(!_0x250346[_0x70f6('0x38')][_0x70f6('0xb1')]){throw new Error(_0x70f6('0xb2'));}if(!_0x250346['body'][_0x70f6('0xb3')]){throw new Error(_0x70f6('0xb4'));}var _0x4b0563=_0x250346['body']['binding_keys']['split'](',');var _0x50b6de=_0x250346[_0x70f6('0x38')]['binding_values'][_0x70f6('0xb5')](',');if(!_0x4b0563[_0x70f6('0x2c')]||!_0x50b6de[_0x70f6('0x2c')]||_0x4b0563[_0x70f6('0x2c')]!==_0x50b6de['length']){throw new Error(_0x70f6('0xb6'));}_0x250346[_0x70f6('0x38')][_0x70f6('0x87')]=_['zipObject'](_0x4b0563,_0x50b6de);if(!_0x250346[_0x70f6('0x38')]['fields']['phone']){throw new Error(_0x70f6('0xb7'));}if(!_0x250346[_0x70f6('0x38')][_0x70f6('0x87')][_0x70f6('0xb8')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x1feaa8=path[_0x70f6('0x3d')](config['root'],_0x70f6('0xb9'),_0x250346['file'][_0x70f6('0xba')]);fs[_0x70f6('0xbb')](_0x1feaa8,parseInt(_0x70f6('0xbc'),0x8));var _0x20cf03=require(_0x70f6('0xbd'))[_0x70f6('0xbe')](path[_0x70f6('0x3d')](__dirname,_0x70f6('0xbf')),[_0x1feaa8,_0x250346[_0x70f6('0x38')]['binding_keys'],_0x250346[_0x70f6('0x38')][_0x70f6('0xb1')],_0x250346[_0x70f6('0x38')][_0x70f6('0x64')],_0x250346[_0x70f6('0x38')][_0x70f6('0xc0')],_0x250346[_0x70f6('0x38')][_0x70f6('0x61')],_0x250346[_0x70f6('0x38')][_0x70f6('0xb3')]]);return _0x574966[_0x70f6('0x11')](0xc8)[_0x70f6('0x12')]({'message':_0x70f6('0xc1'),'pid':_0x20cf03[_0x70f6('0xc2')]});}catch(_0x52db17){return _0x574966[_0x70f6('0x11')](0x1f4)['send'](_0x52db17);}};exports[_0x70f6('0xc3')]=function(_0x3cfb47,_0x181d86){var _0x257b4b=fs[_0x70f6('0xc4')](_0x3cfb47[_0x70f6('0xc5')]['path']);Papa[_0x70f6('0xc6')](_0x257b4b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5f4c27){return _0x181d86['status'](0xc8)[_0x70f6('0x12')]({'file':_0x3cfb47[_0x70f6('0xc5')],'fields':_0x5f4c27['meta'][_0x70f6('0x87')]});}});};exports[_0x70f6('0xc7')]=function(_0xd17086,_0x22fad1){return db['User'][_0x70f6('0x32')]({'raw':!![],'attributes':['id'],'where':{'role':_0x70f6('0xc8')}})[_0x70f6('0x19')](function(_0x14f627){var _0x4840cf=![];if(!_0xd17086[_0x70f6('0x38')][_0x70f6('0x64')]){throw new Error(_0x70f6('0xae'));}if(!_0xd17086['body'][_0x70f6('0xc9')][_0x70f6('0x81')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xd17086[_0x70f6('0x38')][_0x70f6('0xc9')][_0x70f6('0xb8')]){throw new Error(_0x70f6('0xca'));}if(!_0xd17086['body'][_0x70f6('0xb3')]){throw new Error(_0x70f6('0xb4'));}var _0xb3ff84=require(_0x70f6('0xbd'))[_0x70f6('0xbe')](path[_0x70f6('0x3d')](__dirname,_0x70f6('0xcb')),[_0xd17086[_0x70f6('0x29')]['id'],JSON[_0x70f6('0xcc')](_0xd17086[_0x70f6('0x38')]),JSON[_0x70f6('0xcc')](_0x14f627)]);_0xb3ff84['on'](_0x70f6('0xcd'),function(){_0x4840cf=!![];return _0x22fad1[_0x70f6('0x11')](0xc8)[_0x70f6('0x12')]({'message':_0x70f6('0xce'),'pid':_0xb3ff84[_0x70f6('0xc2')]});});_0xb3ff84['on'](_0x70f6('0xcf'),function(_0x5c893f){if(_0x5c893f&&!_0x4840cf){return _0x22fad1[_0x70f6('0x11')](0x1f4)[_0x70f6('0x12')]({'message':_0x70f6('0xd0'),'pid':_0xb3ff84[_0x70f6('0xc2')]});}});})[_0x70f6('0x25')](handleError(_0x22fad1,null));};exports['importUpdates']=function(_0x4e3b1f,_0x28d8d4){return db['User'][_0x70f6('0x32')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x70f6('0x19')](function(_0x2946e7){var _0x5a145e=![];if(!_0x4e3b1f[_0x70f6('0x38')]['ListId']){throw new Error(_0x70f6('0xae'));}if(!_0x4e3b1f['body'][_0x70f6('0xc9')][_0x70f6('0x81')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4e3b1f[_0x70f6('0x38')][_0x70f6('0xc9')][_0x70f6('0xb8')]){throw new Error(_0x70f6('0xca'));}if(!_0x4e3b1f[_0x70f6('0x38')][_0x70f6('0xb3')]){throw new Error(_0x70f6('0xb4'));}var _0x25efdf=require('child_process')['fork'](path[_0x70f6('0x3d')](__dirname,_0x70f6('0xd1')),[_0x4e3b1f['params']['id'],JSON[_0x70f6('0xcc')](_0x4e3b1f[_0x70f6('0x38')]),JSON[_0x70f6('0xcc')](_0x2946e7)]);_0x25efdf['on'](_0x70f6('0xcd'),function(){_0x5a145e=!![];return _0x28d8d4[_0x70f6('0x11')](0xc8)[_0x70f6('0x12')]({'message':_0x70f6('0xce'),'pid':_0x25efdf[_0x70f6('0xc2')]});});_0x25efdf['on'](_0x70f6('0xcf'),function(_0x12f8f5){if(_0x12f8f5&&!_0x5a145e){return _0x28d8d4['status'](0x1f4)[_0x70f6('0x12')]({'message':_0x70f6('0xd0'),'pid':_0x25efdf[_0x70f6('0xc2')]});}});})[_0x70f6('0x25')](handleError(_0x28d8d4,null));};exports['getJourney']=function(_0x446de2,_0x518140){var _0x33a247=[_0x70f6('0xd2'),_0x70f6('0xd3'),_0x70f6('0xd4'),_0x70f6('0xd5'),_0x70f6('0xd6'),'whatsapp','voice'];var _0x43bd12={'offset':0x0,'order':qs['sort'](_0x70f6('0xd7'))},_0x516c8d={'count':0x0,'rows':[]};Promise[_0x70f6('0xd8')]()['then'](function(){if(_0x446de2['query'][_0x70f6('0xd9')]){if(!_[_0x70f6('0xda')](_0x33a247,_0x446de2['query'][_0x70f6('0xd9')][_0x70f6('0xdb')]())){throw new Error(_0x70f6('0xdc'));}_0x33a247=[_0x446de2['query'][_0x70f6('0xd9')]['toLowerCase']()];}if(_0x446de2[_0x70f6('0x23')][_0x70f6('0xdd')]){try{var _0xcd26f8=JSON[_0x70f6('0xc6')](_0x446de2[_0x70f6('0x23')][_0x70f6('0xdd')]);if(!moment(_0xcd26f8['from'])[_0x70f6('0xde')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0xcd26f8['to'])['isValid']()){throw new Error(_0x70f6('0xdf'));}}catch(_0x68c0af){throw new Error(_0x70f6('0xe0'));}}if(!_0x446de2['query'][_0x70f6('0x67')](_0x70f6('0x8f'))){_0x43bd12[_0x70f6('0x14')]=qs[_0x70f6('0x14')](_0x446de2[_0x70f6('0x23')][_0x70f6('0x14')]||0xa);_0x43bd12['offset']=qs['offset'](_0x446de2['query']['offset']);}var _0xa08929=_0x33a247[_0x70f6('0x76')](function(_0x370622){if(_0x370622==='voice'){var _0x2264dd={'attributes':['id',_0x70f6('0xe1'),'type',_0x70f6('0xe2'),_0x70f6('0xe3'),_0x70f6('0xe4'),_0x70f6('0xe5'),_0x70f6('0xe6'),_0x70f6('0xe7'),'note','createdAt','userDisposition','userSecondDisposition',_0x70f6('0xe8'),_0x70f6('0xe9')],'where':{'ContactId':_0x446de2['params']['id']},'include':[{'model':db[_0x70f6('0xea')],'as':_0x70f6('0xea'),'attributes':['id',_0x70f6('0x1e'),'fullname',_0x70f6('0x33')]}],'order':[[_0x70f6('0xeb'),_0x70f6('0xec')]]};if(_0x446de2[_0x70f6('0x23')][_0x70f6('0xdd')]){_0x2264dd[_0x70f6('0x62')]['createdAt']={'$gte':_0xcd26f8['from'],'$lte':_0xcd26f8['to']};}return db['VoiceCallReport'][_0x70f6('0xed')](_0x2264dd)[_0x70f6('0x19')](function(_0x115520){_0x516c8d['count']+=_0x115520[_0x70f6('0x16')];return _[_0x70f6('0x76')](_0x115520[_0x70f6('0xa9')],function(_0x2c1471){var _0xd52400=_0x2c1471['get']({'plain':!![]});_0xd52400[_0x70f6('0xd9')]=_0x370622;if(_0xd52400[_0x70f6('0xea')]){_0xd52400['User']={'id':_0xd52400['User']['id'],'name':_0xd52400['User'][_0x70f6('0x1e')],'fullname':_0xd52400['User']['fullname'],'alias':_0xd52400[_0x70f6('0xea')]['alias']};}return _0xd52400;});});}else{var _0x273561=_[_0x70f6('0xee')](_0x370622)+(_0x370622===_0x70f6('0xd3')?'Website':_0x70f6('0xef'));var _0x30cf83={'attributes':['id',_0x70f6('0xf0'),_0x70f6('0xf1'),_0x70f6('0xeb'),_0x70f6('0xf2'),_0x70f6('0xf3'),'secondDisposition',_0x70f6('0xf4'),_0x70f6('0xe9'),_0x273561+'Id'],'where':{'ContactId':_0x446de2[_0x70f6('0x29')]['id']},'include':[{'model':db[_0x273561],'as':_0x70f6('0xef'),'attributes':['id',_0x70f6('0x1e'),_0x70f6('0xf5')]},{'model':db[_0x70f6('0xea')],'as':_0x70f6('0xf6'),'attributes':['id',_0x70f6('0x1e'),_0x70f6('0xf7')]},{'model':db[_0x70f6('0x6b')],'as':_0x70f6('0x6c'),'attributes':['id',_0x70f6('0x1e'),_0x70f6('0x6d')],'through':{'attributes':[]}}],'order':[[_0x70f6('0xeb'),_0x70f6('0xec')]]};if(_0x446de2[_0x70f6('0x23')][_0x70f6('0xdd')]){_0x30cf83[_0x70f6('0x62')][_0x70f6('0xeb')]={'$gte':_0xcd26f8['from'],'$lte':_0xcd26f8['to']};}switch(_0x370622){case _0x70f6('0xd3'):_0x30cf83[_0x70f6('0x88')][_0x70f6('0x68')](_0x70f6('0xf8'),_0x70f6('0xf9'),_0x70f6('0xfa'),_0x70f6('0xfb'),_0x70f6('0xfc'),_0x70f6('0xfd'),_0x70f6('0xfe'),_0x70f6('0xff'),'referer');break;case _0x70f6('0xd2'):_0x30cf83['attributes'][_0x70f6('0x68')](_0x70f6('0x100'),_0x70f6('0x101'));break;case'openchannel':_0x30cf83[_0x70f6('0x88')][_0x70f6('0x68')](_0x70f6('0x102'),_0x70f6('0x103'));break;}return db[_[_0x70f6('0xee')](_0x370622)+_0x70f6('0x104')]['findAndCountAll'](_0x30cf83)['then'](function(_0x356c91){_0x516c8d[_0x70f6('0x16')]+=_0x356c91[_0x70f6('0x16')];return _[_0x70f6('0x76')](_0x356c91[_0x70f6('0xa9')],function(_0x34cc9d){var _0x27949a=_0x34cc9d[_0x70f6('0x3a')]({'plain':!![]});_0x27949a[_0x70f6('0xd9')]=_0x370622;if(_0x27949a['Owner']){_0x27949a[_0x70f6('0xf6')]={'id':_0x27949a['Owner']['id'],'name':_0x27949a[_0x70f6('0xf6')]['name'],'fullname':_0x27949a[_0x70f6('0xf6')]['fullname']};}return _0x27949a;});});}});return Promise['all'](_0xa08929);})[_0x70f6('0x19')](function(_0x59830d){return _(_0x59830d)[_0x70f6('0x105')]()[_0x70f6('0x106')](_0x70f6('0xeb'))[_0x70f6('0x107')]()[_0x70f6('0x108')]();})['then'](function(_0x4275eb){_0x516c8d['rows']=_0x43bd12[_0x70f6('0x14')]?_0x4275eb['slice'](_0x43bd12[_0x70f6('0x13')],_0x43bd12['offset']+_0x43bd12['limit']):_0x4275eb;return _0x516c8d;})[_0x70f6('0x19')](respondWithFilteredResult(_0x518140,_0x43bd12))[_0x70f6('0x25')](handleError(_0x518140,null));}; \ No newline at end of file +var _0x297f=['Interaction','sortBy','reverse','value','slice','moment','bluebird','util','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','json','offset','limit','undefined','count','set','update','then','destroy','end','sendStatus','stack','name','send','index','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','length','cf_','displayName','analytics','columnName','alias','custom','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','duplicates','where','$or','push','ListId','findOrCreate','spread','hasOwnProperty','contact','all','show','Tag','Tags','color','CmContactHasItem','ItemType','sequelize','literal','Phones.OrderBy','$and','CmCustomField','omit','map','format','cf_%d','pickBy','startsWith','isEmpty','table','cm_contacts','setFields','toParam','phone','getTags','findOne','model','rawAttributes','filters','intersection','fields','attributes','order','sort','pick','filter','merge','options','nolimit','setTags','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','item','PHONE','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','rows','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','createReadStream','path','parse','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','type','source','callerid','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','DESC','customerIp','customerPort','deviceModel','osName','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId'];(function(_0x5b6eb2,_0x495e9d){var _0x1c6bc7=function(_0x577701){while(--_0x577701){_0x5b6eb2['push'](_0x5b6eb2['shift']());}};_0x1c6bc7(++_0x495e9d);}(_0x297f,0x105));var _0xf297=function(_0x112bd1,_0x5f43fa){_0x112bd1=_0x112bd1-0x0;var _0x2c132e=_0x297f[_0x112bd1];return _0x2c132e;};'use strict';var moment=require(_0xf297('0x0'));var BPromise=require(_0xf297('0x1'));var util=require(_0xf297('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xf297('0x3'));var squel=require('squel');var Papa=require(_0xf297('0x4'));var Redis=require(_0xf297('0x5'));var contacts=require(_0xf297('0x6'));var qs=require(_0xf297('0x7'));var logger=require('../../config/logger')(_0xf297('0x8'));var config=require(_0xf297('0x9'));var shared=require('../../config/environment/shared');var db=require(_0xf297('0xa'))['db'];config[_0xf297('0xb')]=_['defaults'](config[_0xf297('0xb')],{'host':_0xf297('0xc'),'port':0x18eb});var socket=require(_0xf297('0xd'))(new Redis(config[_0xf297('0xb')]));require('./cmContact.socket')[_0xf297('0xe')](socket);function respondWithResult(_0x228d20,_0x49c687){_0x49c687=_0x49c687||0xc8;return function(_0x51deb3){if(_0x51deb3){return _0x228d20[_0xf297('0xf')](_0x49c687)[_0xf297('0x10')](_0x51deb3);}};}function respondWithFilteredResult(_0x3985e3,_0x34b739){return function(_0x539721){if(_0x539721){var _0x46f3db=typeof _0x34b739[_0xf297('0x11')]==='undefined'&&typeof _0x34b739[_0xf297('0x12')]===_0xf297('0x13');var _0x2d47a6=_0x539721[_0xf297('0x14')];var _0x361727=_0x46f3db?0x0:_0x34b739['offset'];var _0x103d3d=_0x46f3db?_0x539721[_0xf297('0x14')]:_0x34b739[_0xf297('0x11')]+_0x34b739[_0xf297('0x12')];var _0x51870a;if(_0x103d3d>=_0x2d47a6){_0x103d3d=_0x2d47a6;_0x51870a=0xc8;}else{_0x51870a=0xce;}_0x3985e3[_0xf297('0xf')](_0x51870a);return _0x3985e3[_0xf297('0x15')]('Content-Range',_0x361727+'-'+_0x103d3d+'/'+_0x2d47a6)[_0xf297('0x10')](_0x539721);}return null;};}function saveUpdates(_0x4ebe61){return function(_0x1c18eb){if(_0x1c18eb){return _0x1c18eb[_0xf297('0x16')](_0x4ebe61)[_0xf297('0x17')](function(_0x48ee08){return _0x48ee08;});}return null;};}function removeEntity(_0x1be708){return function(_0x2acc5b){if(_0x2acc5b){return _0x2acc5b[_0xf297('0x18')]()[_0xf297('0x17')](function(){_0x1be708['status'](0xcc)[_0xf297('0x19')]();});}};}function handleEntityNotFound(_0x322fca){return function(_0x59c360){if(!_0x59c360){_0x322fca[_0xf297('0x1a')](0x194);}return _0x59c360;};}function handleError(_0x10ffc9,_0x5df93f){_0x5df93f=_0x5df93f||0x1f4;return function(_0x18c128){logger['error'](_0x18c128[_0xf297('0x1b')]);if(_0x18c128[_0xf297('0x1c')]){delete _0x18c128[_0xf297('0x1c')];}_0x10ffc9[_0xf297('0xf')](_0x5df93f)[_0xf297('0x1d')](_0x18c128);};}exports[_0xf297('0x1e')]=function(_0x1c7b00,_0x5a9945){var _0xfa1762={};return contacts[_0xf297('0x1f')]()['then'](function(_0x3db65a){_0xfa1762=qs[_0xf297('0x20')](_0x3db65a,_0x1c7b00);return contacts[_0xf297('0x21')](_0x1c7b00[_0xf297('0x22')],_0x1c7b00[_0xf297('0x23')],_0xfa1762,_0x3db65a);})['then'](respondWithFilteredResult(_0x5a9945,_0xfa1762))[_0xf297('0x24')](handleError(_0x5a9945,null));};exports[_0xf297('0x18')]=function(_0x19b30e,_0x5e2574){return db[_0xf297('0x25')][_0xf297('0x26')]({'where':{'id':_0x19b30e[_0xf297('0x27')]['id']}})[_0xf297('0x17')](handleEntityNotFound(_0x5e2574,null))[_0xf297('0x17')](removeEntity(_0x5e2574,null))[_0xf297('0x24')](handleError(_0x5e2574,null));};exports['describe']=function(_0x13e968,_0xc132f3){return db[_0xf297('0x25')][_0xf297('0x1f')]()['then'](function(_0x4d5f04){delete _0x4d5f04[_0xf297('0x28')];for(var _0xb70acb=0x0;_0xb70acb0x0){return new Promise(function(_0x5f06c3){var _0x4c81f2=[];for(var _0x49a309=0x0;_0x49a309<_0x32ec20[_0xf297('0x2a')];_0x49a309++){_0x4c81f2[_0xf297('0x5c')](insertAdditionalPhones(_0x32ec20[_0x49a309][_0xf297('0x61')],_0x32ec20[_0x49a309]['additionalPhones']));}Promise[_0xf297('0x62')](_0x4c81f2)[_0xf297('0x17')](function(){_0x5f06c3(0x1);});})['then'](function(){return{'success':_0x35abc3,'failure':_0x19591,'duplicates':_0x19480b};});}else{return{'success':_0x35abc3,'failure':_0x19591,'duplicates':_0x19480b};}}})[_0xf297('0x17')](respondWithResult(_0x65f20c,0xc9))['catch'](handleError(_0x65f20c,null));};exports[_0xf297('0x63')]=function(_0x314196,_0x13e0d0){var _0x17cd1c;return db[_0xf297('0x25')][_0xf297('0x1f')]()[_0xf297('0x17')](function(_0x44b7a0){return db[_0xf297('0x25')][_0xf297('0x26')]({'where':{'id':_0x314196[_0xf297('0x27')]['id']},'include':[{'model':db[_0xf297('0x64')],'as':_0xf297('0x65'),'attributes':['id','name',_0xf297('0x66')],'required':_0x314196[_0xf297('0x22')]['tag']?!![]:![]},{'model':db[_0xf297('0x67')],'as':'Phones','where':{'CmContactId':_0x314196['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xf297('0x68')}]}],'order':[db[_0xf297('0x69')][_0xf297('0x6a')](_0xf297('0x6b'))],'attributes':_[_0xf297('0x29')](_0x44b7a0)});})[_0xf297('0x17')](function(_0x4d2ef6){if(!_[_0xf297('0x54')](_0x4d2ef6)){_0x17cd1c=_0x4d2ef6[_0xf297('0x37')]({'plain':!![]});var _0x5b0401={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4d2ef6&&_0x4d2ef6[_0xf297('0x5d')]){if(_0x4d2ef6['ListId']){_0x5b0401['where'][_0xf297('0x6c')]['push']({'ListId':{'$ne':_0x4d2ef6[_0xf297('0x5d')]}});}}return db[_0xf297('0x6d')][_0xf297('0x21')](_0x5b0401);}})[_0xf297('0x17')](function(_0x14d770){if(!_[_0xf297('0x54')](_0x14d770)){return _[_0xf297('0x6e')](_0x17cd1c,_[_0xf297('0x6f')](_0x14d770,function(_0x12603e){return util[_0xf297('0x70')](_0xf297('0x71'),_0x12603e['id']);}));}})[_0xf297('0x17')](handleEntityNotFound(_0x13e0d0,null))['then'](respondWithResult(_0x13e0d0,null))[_0xf297('0x24')](handleError(_0x13e0d0,null));};exports[_0xf297('0x16')]=function(_0xa01a71,_0x597ebf){var _0x45924c;if(_0xa01a71['body']['id']){delete _0xa01a71[_0xf297('0x35')]['id'];}if(!_[_0xf297('0x54')](_0xa01a71[_0xf297('0x35')][_0xf297('0x55')])){var _0x134dbd=_0xa01a71[_0xf297('0x35')]['dialTimezone'];if(!_['isNil'](shared[_0xf297('0x57')][_0x134dbd]))_0xa01a71[_0xf297('0x35')]['utcOffset']=shared[_0xf297('0x57')][_0x134dbd][_0xf297('0x56')];}return db[_0xf297('0x25')][_0xf297('0x26')]({'where':{'id':_0xa01a71[_0xf297('0x27')]['id']}})[_0xf297('0x17')](handleEntityNotFound(_0x597ebf,null))[_0xf297('0x17')](saveUpdates(_0xa01a71['body'],null))[_0xf297('0x17')](function(_0x27f811){_0x45924c=_0x27f811;var _0x288fed={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x27f811&&_0x27f811['ListId']){if(_0x27f811[_0xf297('0x5d')]){_0x288fed['where'][_0xf297('0x6c')][_0xf297('0x5c')]({'ListId':{'$ne':_0x27f811[_0xf297('0x5d')]}});}}return db[_0xf297('0x6d')][_0xf297('0x21')](_0x288fed);})[_0xf297('0x17')](function(_0xd77390){if(_0xd77390){return _['omit'](_[_0xf297('0x72')](_0xa01a71[_0xf297('0x35')],function(_0x468b9d,_0xe3bbdd){return _[_0xf297('0x73')](_0xe3bbdd,_0xf297('0x2b'));}),_[_0xf297('0x6f')](_0xd77390,function(_0x98566d){return util[_0xf297('0x70')](_0xf297('0x71'),_0x98566d['id']);}));}})['then'](function(_0xe3095d){if(_0xe3095d&&!_[_0xf297('0x74')](_0xe3095d)){var _0x54e48b=squel[_0xf297('0x16')]()[_0xf297('0x75')](_0xf297('0x76'))[_0xf297('0x77')](_0xe3095d)['where']('id\x20=\x20?',_0xa01a71[_0xf297('0x27')]['id'])[_0xf297('0x78')]();return db[_0xf297('0x69')][_0xf297('0x22')](_0x54e48b['text'],{'replacements':_0x54e48b['values']});}})[_0xf297('0x17')](function(){if(_0xa01a71[_0xf297('0x35')][_0xf297('0x79')]&&_0x45924c){return db[_0xf297('0x3c')]['update']({'phone':_0xa01a71['body'][_0xf297('0x79')],'OrderBy':0x0},{'where':{'ContactId':_0x45924c['id']}});}})[_0xf297('0x17')](function(){return _0x45924c;})[_0xf297('0x17')](respondWithResult(_0x597ebf,null))['catch'](handleError(_0x597ebf,null));};exports[_0xf297('0x7a')]=function(_0x58abc3,_0x4196a1){var _0x4444e8={};var _0x1026b4={};var _0x542354;var _0x8af30e;return db[_0xf297('0x25')][_0xf297('0x7b')]({'where':{'id':_0x58abc3[_0xf297('0x27')]['id']}})[_0xf297('0x17')](handleEntityNotFound(_0x4196a1,null))[_0xf297('0x17')](function(_0x570900){if(_0x570900){_0x542354=_0x570900;_0x1026b4[_0xf297('0x7c')]=_[_0xf297('0x29')](db[_0xf297('0x64')][_0xf297('0x7d')]);_0x1026b4[_0xf297('0x22')]=_[_0xf297('0x29')](_0x58abc3[_0xf297('0x22')]);_0x1026b4[_0xf297('0x7e')]=_[_0xf297('0x7f')](_0x1026b4[_0xf297('0x7c')],_0x1026b4[_0xf297('0x22')]);_0x4444e8['attributes']=_[_0xf297('0x7f')](_0x1026b4[_0xf297('0x7c')],qs[_0xf297('0x80')](_0x58abc3[_0xf297('0x22')][_0xf297('0x80')]));_0x4444e8[_0xf297('0x81')]=_0x4444e8[_0xf297('0x81')][_0xf297('0x2a')]?_0x4444e8[_0xf297('0x81')]:_0x1026b4['model'];_0x4444e8[_0xf297('0x82')]=qs[_0xf297('0x83')](_0x58abc3[_0xf297('0x22')]['sort']);_0x4444e8[_0xf297('0x5a')]=qs[_0xf297('0x7e')](_[_0xf297('0x84')](_0x58abc3[_0xf297('0x22')],_0x1026b4['filters']));if(_0x58abc3[_0xf297('0x22')][_0xf297('0x85')]){_0x4444e8['where']=_[_0xf297('0x86')](_0x4444e8[_0xf297('0x5a')],{'$or':_['map'](_0x4444e8[_0xf297('0x81')],function(_0x2c578c){var _0x552943={};_0x552943[_0x2c578c]={'$like':'%'+_0x58abc3[_0xf297('0x22')][_0xf297('0x85')]+'%'};return _0x552943;})});}_0x4444e8=_[_0xf297('0x86')]({},_0x4444e8,_0x58abc3[_0xf297('0x87')]);return _0x542354['getTags'](_0x4444e8);}})[_0xf297('0x17')](function(_0x3bc2c1){if(_0x3bc2c1){_0x8af30e=_0x3bc2c1['length'];if(!_0x58abc3['query']['hasOwnProperty'](_0xf297('0x88'))){_0x4444e8[_0xf297('0x12')]=qs[_0xf297('0x12')](_0x58abc3['query'][_0xf297('0x12')]);_0x4444e8['offset']=qs[_0xf297('0x11')](_0x58abc3[_0xf297('0x22')]['offset']);}return _0x542354[_0xf297('0x7a')](_0x4444e8);}})[_0xf297('0x17')](function(_0x2ada3e){if(_0x2ada3e){return _0x2ada3e?{'count':_0x8af30e,'rows':_0x2ada3e}:null;}})[_0xf297('0x17')](respondWithResult(_0x4196a1,null))[_0xf297('0x24')](handleError(_0x4196a1,null));};exports[_0xf297('0x89')]=function(_0x42e903,_0x379877){if(_0x42e903['body']['id']){delete _0x42e903['body']['id'];}return db['CmContact'][_0xf297('0x7b')]({'where':{'id':_0x42e903['params']['id']}})['then'](handleEntityNotFound(_0x379877,null))[_0xf297('0x17')](function(_0x3b7cec){if(_0x3b7cec){return _0x3b7cec[_0xf297('0x89')](_0x42e903['body']['ids']||[]);}return null;})[_0xf297('0x17')](respondWithResult(_0x379877,null))[_0xf297('0x24')](handleError(_0x379877,null));};exports['setAdditionalPhones']=function(_0x46fa35,_0x13982c){var _0xcb366f=[];_0xcb366f['push'](addAdditionalPhones(_0x46fa35['body']));Promise[_0xf297('0x62')](_0xcb366f)['then'](function(){_0xcb366f=[];_0xcb366f[_0xf297('0x5c')](deleteCmHopperPhones(_0x46fa35['body']['id']));_0xcb366f['push'](addCmHopperPhones(_0x46fa35['body']['id']));Promise[_0xf297('0x62')](_0xcb366f)[_0xf297('0x17')](function(){return[0x1];})['then'](respondWithResult(_0x13982c,null));});};function addAdditionalPhones(_0x13d695){var _0x362baf;return new Promise(function(_0x20b390){return db[_0xf297('0x67')][_0xf297('0x18')]({'where':{'CmContactId':_0x13d695['id']}})[_0xf297('0x17')](function(){db[_0xf297('0x8a')][_0xf297('0x21')]({'raw':!![],'attributes':['id',_0xf297('0x8b')]})[_0xf297('0x17')](function(_0x5a10eb){var _0x35de35=[];for(var _0x5a55a4=0x0;_0x5a55a4<_0x13d695[_0xf297('0x8c')][_0xf297('0x2a')];_0x5a55a4++){var _0x2773c0=_0x13d695[_0xf297('0x8d')]?_[_0xf297('0x54')](_0x13d695['item_types'][_0x5a55a4])?'':_0x13d695[_0xf297('0x8d')][_0x5a55a4]:_0x13d695['items'][_0x5a55a4]['ItemTypeId']?_0x13d695[_0xf297('0x8c')][_0x5a55a4][_0xf297('0x8e')]:'';var _0x309d76=_['isNil'](_0x13d695['items'][_0x5a55a4][_0xf297('0x8f')])?'':_0x13d695[_0xf297('0x8c')][_0x5a55a4][_0xf297('0x8f')];var _0xd938e=_0x2773c0+':'+_0x13d695[_0xf297('0x8c')][_0x5a55a4][_0xf297('0x79')]+'§'+_0x309d76;if(_[_0xf297('0x54')](_0x362baf))_0x362baf=_0xd938e;else _0x362baf+=';'+_0xd938e;var _0x1c1bbe=null;var _0x26c5d5=null;if(_0x13d695[_0xf297('0x8d')]){if(!_[_0xf297('0x54')](_0x13d695[_0xf297('0x8d')][_0x5a55a4])){_0x26c5d5=_['find'](_0x5a10eb,function(_0x2af8b1){return _0x2af8b1['id']===_0x13d695[_0xf297('0x8d')][_0x5a55a4];});if(!_[_0xf297('0x54')](_0x26c5d5)){_0x1c1bbe=_0x26c5d5[_0xf297('0x8b')];}}}else{if(!_[_0xf297('0x54')](_0x13d695['items'][_0x5a55a4])){_0x26c5d5=_[_0xf297('0x26')](_0x5a10eb,function(_0x376b22){return _0x376b22['id']===_0x13d695[_0xf297('0x8c')][_0x5a55a4][_0xf297('0x8e')];});if(!_[_0xf297('0x54')](_0x26c5d5)){_0x1c1bbe=_0x5a55a4;}}}if(_[_0xf297('0x54')](_0x1c1bbe)){_0x1c1bbe=0x64;}_0x35de35[_0xf297('0x5c')](addAdditionalPhone(_0x13d695['id'],_0x13d695[_0xf297('0x8c')][_0x5a55a4][_0xf297('0x79')],_0x13d695['item_types']?_[_0xf297('0x54')](_0x13d695['item_types'][_0x5a55a4])?null:_0x13d695[_0xf297('0x8d')][_0x5a55a4]:_0x13d695[_0xf297('0x8c')][_0x5a55a4][_0xf297('0x8e')]?_0x13d695[_0xf297('0x8c')][_0x5a55a4][_0xf297('0x8e')]:null,_0x1c1bbe,_0x309d76));}Promise[_0xf297('0x62')](_0x35de35)[_0xf297('0x17')](function(){db[_0xf297('0x25')][_0xf297('0x16')]({'AdditionalPhones':_0x362baf},{'where':{'id':_0x13d695['id']}})[_0xf297('0x17')](function(){_0x20b390(0x1);});});});});});}function addAdditionalPhone(_0x394969,_0x48b590,_0x5aec99,_0xa7403d,_0x274f51){return db[_0xf297('0x67')][_0xf297('0x26')]({'where':{'CmContactId':_0x394969,'item':_0x48b590}})['then'](function(_0x555810){if(_0x555810)logger[_0xf297('0x32')](_0xf297('0x90'),_0x555810);else{db[_0xf297('0x67')][_0xf297('0x3f')]({'CmContactId':_0x394969,'item':_0x48b590,'ItemTypeId':_0x5aec99,'OrderBy':_0xa7403d,'ItemClass':'PHONE','description':_0x274f51});}});}function deleteCmHopperPhones(_0x2527b2){return new Promise(function(_0x5be607){return db[_0xf297('0x3c')][_0xf297('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2527b2}})[_0xf297('0x17')](function(_0x36d188){db['CmHopperAdditionalPhone'][_0xf297('0x18')]({'where':{'CmHopperId':{'$in':_[_0xf297('0x6f')](_0x36d188,'id')}}});})[_0xf297('0x17')](function(){_0x5be607(0x1);});});}function addCmHopperPhones(_0x185d72){return new Promise(function(_0x4d7b2d){return db[_0xf297('0x3c')][_0xf297('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x185d72}})[_0xf297('0x17')](function(_0x4ae777){var _0x166f74=[];_[_0xf297('0x6f')](_0x4ae777,function(_0x10ea7b){_0x166f74[_0xf297('0x5c')](createCmHopperPhone(_0x185d72,_0x10ea7b['id']));});Promise['all'](_0x166f74)[_0xf297('0x17')](function(){_0x4d7b2d(0x1);});});});}function createCmHopperPhone(_0x544177,_0x3ca9cb){return new Promise(function(_0x3514a9){db[_0xf297('0x67')][_0xf297('0x21')]({'raw':!![],'attributes':[_0xf297('0x91'),_0xf297('0x8b')],'where':{'CmContactId':_0x544177,'ItemClass':_0xf297('0x92')},'include':[{'model':db[_0xf297('0x8a')],'attributes':['OrderBy'],'as':_0xf297('0x68')}],'order':[_0xf297('0x8b'),db[_0xf297('0x69')][_0xf297('0x6a')](_0xf297('0x93'))]})[_0xf297('0x17')](function(_0x11049d){var _0x2f6ade=0x1;var _0x1d9672=_['map'](_0x11049d,function(_0x36ddc0){_0x36ddc0[_0xf297('0x94')]=_0x3ca9cb;_0x36ddc0[_0xf297('0x79')]=_0x36ddc0[_0xf297('0x91')];_0x36ddc0[_0xf297('0x8b')]=_0x2f6ade;delete _0x36ddc0[_0xf297('0x95')];_0x2f6ade=_0x2f6ade+0x1;return _0x36ddc0;});return db[_0xf297('0x96')]['bulkCreate'](_0x1d9672,{});})[_0xf297('0x17')](function(){_0x3514a9(0x1);});});}function insertAdditionalPhones(_0x8f16a0,_0x310613){return new Promise(function(_0x48b2de){var _0x3f8cbf=[];for(var _0x1bc567=0x0;_0x1bc567<_0x310613[_0xf297('0x2a')];_0x1bc567++){var _0x43c1f5=_0x310613[_0x1bc567];_0x3f8cbf[_0xf297('0x5c')](parseContactItemType(_0x43c1f5));}Promise['all'](_0x3f8cbf)[_0xf297('0x17')](function(){var _0x5b92ab={'id':_0x8f16a0['id'],'items':_0x310613};return addAdditionalPhones(_0x5b92ab)[_0xf297('0x17')](function(){return addCmHopperPhones(_0x8f16a0['id']);});})['then'](function(){_0x48b2de(_0x8f16a0);});});}function parseContactItemType(_0x34ce70){return new Promise(function(_0x2a0d86){if(_0x34ce70[_0xf297('0x60')](_0xf297('0x8e'))){_0x2a0d86(_0x34ce70);}else{return db[_0xf297('0x8a')][_0xf297('0x26')]({'where':{'name':_0x34ce70[_0xf297('0x68')]}})[_0xf297('0x17')](function(_0x1296eb){if(_[_0xf297('0x54')](_0x1296eb))_0x34ce70[_0xf297('0x8e')]=null;else _0x34ce70[_0xf297('0x8e')]=_0x1296eb['id'];_0x2a0d86(_0x34ce70);});}});}exports['getAdditionalPhones']=function(_0x52514f,_0x2ce788){return db[_0xf297('0x67')][_0xf297('0x21')]({'raw':!![],'where':{'CmContactId':_0x52514f[_0xf297('0x27')]['id'],'ItemClass':_0xf297('0x92')},'include':[{'model':db[_0xf297('0x8a')],'as':_0xf297('0x68')}],'order':[['OrderBy'],[db[_0xf297('0x69')][_0xf297('0x6a')](_0xf297('0x93'))]]})[_0xf297('0x17')](function(_0x355462){return _0x355462;})[_0xf297('0x17')](respondWithResult(_0x2ce788,null))['catch'](handleError(_0x2ce788,null));};exports[_0xf297('0x97')]=function(_0x57429e,_0x45adef){return db[_0xf297('0x67')][_0xf297('0x21')]({'raw':!![],'where':{'CmContactId':_0x57429e['body'][_0xf297('0x98')]}})[_0xf297('0x17')](function(_0x2c3b9e){var _0x4e5de7=_['map'](_0x2c3b9e,function(_0x378e6b){_0x378e6b[_0xf297('0x99')]=_0x57429e[_0xf297('0x35')][_0xf297('0x9a')];return _0x378e6b;});return db['CmContactHasItem'][_0xf297('0x9b')](_0x4e5de7,{});})[_0xf297('0x17')](function(){return addCmHopperPhones(_0x57429e[_0xf297('0x35')][_0xf297('0x9a')]);})[_0xf297('0x17')](function(){return['ok'];})[_0xf297('0x17')](respondWithResult(_0x45adef,null))['catch'](handleError(_0x45adef,null));};exports[_0xf297('0x9c')]=function(_0x4c6006,_0x1631c7){var _0x37fc5a=[];_0x37fc5a[_0xf297('0x5c')](createCmHopperPhone(_0x4c6006['body']['id'],_0x4c6006[_0xf297('0x35')][_0xf297('0x9d')]));Promise[_0xf297('0x62')](_0x37fc5a)[_0xf297('0x17')](function(){return[0x1];})[_0xf297('0x17')](respondWithResult(_0x1631c7,null));};exports['getHoppers']=function(_0x54e539,_0x284eb0){var _0x3cd9d1={'raw':![],'where':{}};var _0x369b56={};var _0x49913b={'count':0x0,'rows':[]};return db[_0xf297('0x25')][_0xf297('0x7b')]({'where':{'id':_0x54e539['params']['id']}})[_0xf297('0x17')](handleEntityNotFound(_0x284eb0,null))[_0xf297('0x17')](function(_0x44014a){if(_0x44014a){_0x369b56[_0xf297('0x7c')]=_['keys'](db[_0xf297('0x3c')][_0xf297('0x7d')]);_0x369b56[_0xf297('0x22')]=_[_0xf297('0x29')](_0x54e539[_0xf297('0x22')]);_0x369b56[_0xf297('0x7e')]=_[_0xf297('0x7f')](_0x369b56[_0xf297('0x7c')],_0x369b56[_0xf297('0x22')]);_0x3cd9d1[_0xf297('0x81')]=_[_0xf297('0x7f')](_0x369b56['model'],qs[_0xf297('0x80')](_0x54e539[_0xf297('0x22')][_0xf297('0x80')]));_0x3cd9d1[_0xf297('0x81')]=_0x3cd9d1[_0xf297('0x81')][_0xf297('0x2a')]?_0x3cd9d1[_0xf297('0x81')]:_0x369b56[_0xf297('0x7c')];if(!_0x54e539['query']['hasOwnProperty']('nolimit')){_0x3cd9d1['limit']=qs[_0xf297('0x12')](_0x54e539[_0xf297('0x22')][_0xf297('0x12')]);_0x3cd9d1[_0xf297('0x11')]=qs[_0xf297('0x11')](_0x54e539[_0xf297('0x22')][_0xf297('0x11')]);}_0x3cd9d1[_0xf297('0x82')]=qs[_0xf297('0x83')](_0x54e539[_0xf297('0x22')][_0xf297('0x83')]);_0x3cd9d1[_0xf297('0x5a')]=qs['filters'](_[_0xf297('0x84')](_0x54e539[_0xf297('0x22')],_0x369b56[_0xf297('0x7e')]));_0x3cd9d1[_0xf297('0x5a')][_0xf297('0x9e')]=_0x44014a['id'];if(_0x54e539[_0xf297('0x22')][_0xf297('0x85')]){_0x3cd9d1[_0xf297('0x5a')]=_[_0xf297('0x86')](_0x3cd9d1['where'],{'$or':_[_0xf297('0x6f')](_0x3cd9d1[_0xf297('0x81')],function(_0x59eb4a){var _0x479713={};_0x479713[_0x59eb4a]={'$like':'%'+_0x54e539[_0xf297('0x22')][_0xf297('0x85')]+'%'};return _0x479713;})});}_0x3cd9d1=_['merge']({},_0x3cd9d1,_0x54e539[_0xf297('0x87')]);return db[_0xf297('0x3c')][_0xf297('0x14')]({'where':_0x3cd9d1['where']})[_0xf297('0x17')](function(_0xfb3ad9){_0x49913b[_0xf297('0x14')]=_0xfb3ad9;if(_0x54e539[_0xf297('0x22')][_0xf297('0x9f')]){_0x3cd9d1[_0xf297('0xa0')]=[{'all':!![]}];}return db['CmHopper'][_0xf297('0x21')](_0x3cd9d1);})[_0xf297('0x17')](function(_0x199e77){_0x49913b[_0xf297('0xa1')]=_0x199e77;return _0x49913b;});}})[_0xf297('0x17')](respondWithFilteredResult(_0x284eb0,_0x3cd9d1))['catch'](handleError(_0x284eb0,null));};exports['getHopperHistories']=function(_0x3d3f18,_0x438eb2){var _0x1b2bce={'raw':!![],'where':{}};var _0x5b5cb0={};var _0x453dbb={'count':0x0,'rows':[]};return db['CmContact'][_0xf297('0x7b')]({'where':{'id':_0x3d3f18[_0xf297('0x27')]['id']}})[_0xf297('0x17')](handleEntityNotFound(_0x438eb2,null))[_0xf297('0x17')](function(_0x2a60b2){if(_0x2a60b2){_0x5b5cb0['model']=_['keys'](db['CmHopperHistory'][_0xf297('0x7d')]);_0x5b5cb0[_0xf297('0x22')]=_[_0xf297('0x29')](_0x3d3f18[_0xf297('0x22')]);_0x5b5cb0['filters']=_[_0xf297('0x7f')](_0x5b5cb0[_0xf297('0x7c')],_0x5b5cb0[_0xf297('0x22')]);_0x1b2bce[_0xf297('0x81')]=_[_0xf297('0x7f')](_0x5b5cb0[_0xf297('0x7c')],qs[_0xf297('0x80')](_0x3d3f18['query'][_0xf297('0x80')]));_0x1b2bce[_0xf297('0x81')]=_0x1b2bce[_0xf297('0x81')][_0xf297('0x2a')]?_0x1b2bce[_0xf297('0x81')]:_0x5b5cb0[_0xf297('0x7c')];if(!_0x3d3f18[_0xf297('0x22')]['hasOwnProperty']('nolimit')){_0x1b2bce[_0xf297('0x12')]=qs[_0xf297('0x12')](_0x3d3f18[_0xf297('0x22')][_0xf297('0x12')]);_0x1b2bce[_0xf297('0x11')]=qs[_0xf297('0x11')](_0x3d3f18['query'][_0xf297('0x11')]);}_0x1b2bce[_0xf297('0x82')]=qs[_0xf297('0x83')](_0x3d3f18[_0xf297('0x22')][_0xf297('0x83')]);_0x1b2bce[_0xf297('0x5a')]=qs['filters'](_[_0xf297('0x84')](_0x3d3f18['query'],_0x5b5cb0['filters']));_0x1b2bce[_0xf297('0x5a')]['ContactId']=_0x2a60b2['id'];if(_0x3d3f18['query'][_0xf297('0x85')]){_0x1b2bce['where']=_[_0xf297('0x86')](_0x1b2bce['where'],{'$or':_[_0xf297('0x6f')](_0x1b2bce['attributes'],function(_0x45cbb4){var _0x3d01fd={};_0x3d01fd[_0x45cbb4]={'$like':'%'+_0x3d3f18[_0xf297('0x22')][_0xf297('0x85')]+'%'};return _0x3d01fd;})});}_0x1b2bce=_['merge']({},_0x1b2bce,_0x3d3f18[_0xf297('0x87')]);return db['CmHopperHistory'][_0xf297('0x14')]({'where':_0x1b2bce[_0xf297('0x5a')]})[_0xf297('0x17')](function(_0x171fc8){_0x453dbb[_0xf297('0x14')]=_0x171fc8;if(_0x3d3f18['query'][_0xf297('0x9f')]){_0x1b2bce[_0xf297('0xa0')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1b2bce);})['then'](function(_0x5768ef){_0x453dbb['rows']=_0x5768ef;return _0x453dbb;});}})['then'](respondWithFilteredResult(_0x438eb2,_0x1b2bce))['catch'](handleError(_0x438eb2,null));};exports[_0xf297('0xa2')]=function(_0x184d62,_0xa0666b){var _0x12d3b1={'raw':!![],'where':{}};var _0x2ed16a={};var _0x5ce97b={'count':0x0,'rows':[]};return db[_0xf297('0x25')][_0xf297('0x7b')]({'where':{'id':_0x184d62[_0xf297('0x27')]['id']}})[_0xf297('0x17')](handleEntityNotFound(_0xa0666b,null))['then'](function(_0x5968b9){if(_0x5968b9){_0x2ed16a['model']=_[_0xf297('0x29')](db['CmHopperFinal'][_0xf297('0x7d')]);_0x2ed16a[_0xf297('0x22')]=_[_0xf297('0x29')](_0x184d62['query']);_0x2ed16a[_0xf297('0x7e')]=_[_0xf297('0x7f')](_0x2ed16a[_0xf297('0x7c')],_0x2ed16a[_0xf297('0x22')]);_0x12d3b1['attributes']=_[_0xf297('0x7f')](_0x2ed16a[_0xf297('0x7c')],qs['fields'](_0x184d62[_0xf297('0x22')][_0xf297('0x80')]));_0x12d3b1[_0xf297('0x81')]=_0x12d3b1[_0xf297('0x81')]['length']?_0x12d3b1[_0xf297('0x81')]:_0x2ed16a[_0xf297('0x7c')];if(!_0x184d62[_0xf297('0x22')][_0xf297('0x60')](_0xf297('0x88'))){_0x12d3b1[_0xf297('0x12')]=qs[_0xf297('0x12')](_0x184d62[_0xf297('0x22')]['limit']);_0x12d3b1[_0xf297('0x11')]=qs[_0xf297('0x11')](_0x184d62['query'][_0xf297('0x11')]);}_0x12d3b1['order']=qs[_0xf297('0x83')](_0x184d62[_0xf297('0x22')][_0xf297('0x83')]);_0x12d3b1[_0xf297('0x5a')]=qs[_0xf297('0x7e')](_[_0xf297('0x84')](_0x184d62[_0xf297('0x22')],_0x2ed16a[_0xf297('0x7e')]));_0x12d3b1[_0xf297('0x5a')][_0xf297('0x9e')]=_0x5968b9['id'];if(_0x184d62[_0xf297('0x22')][_0xf297('0x85')]){_0x12d3b1[_0xf297('0x5a')]=_[_0xf297('0x86')](_0x12d3b1[_0xf297('0x5a')],{'$or':_[_0xf297('0x6f')](_0x12d3b1[_0xf297('0x81')],function(_0x2d6aa8){var _0x20bf3f={};_0x20bf3f[_0x2d6aa8]={'$like':'%'+_0x184d62['query'][_0xf297('0x85')]+'%'};return _0x20bf3f;})});}_0x12d3b1=_[_0xf297('0x86')]({},_0x12d3b1,_0x184d62[_0xf297('0x87')]);return db['CmHopperFinal'][_0xf297('0x14')]({'where':_0x12d3b1[_0xf297('0x5a')]})[_0xf297('0x17')](function(_0x67388a){_0x5ce97b['count']=_0x67388a;if(_0x184d62[_0xf297('0x22')][_0xf297('0x9f')]){_0x12d3b1[_0xf297('0xa0')]=[{'all':!![]}];}return db[_0xf297('0xa3')]['findAll'](_0x12d3b1);})[_0xf297('0x17')](function(_0x35ea58){_0x5ce97b[_0xf297('0xa1')]=_0x35ea58;return _0x5ce97b;});}})[_0xf297('0x17')](respondWithFilteredResult(_0xa0666b,_0x12d3b1))[_0xf297('0x24')](handleError(_0xa0666b,null));};exports[_0xf297('0xa4')]=function(_0x3da231,_0x53d81a){var _0x413f30={'raw':!![],'where':{}};var _0x426186={};var _0x84f41c={'count':0x0,'rows':[]};return db[_0xf297('0x25')]['findOne']({'where':{'id':_0x3da231[_0xf297('0x27')]['id']}})[_0xf297('0x17')](handleEntityNotFound(_0x53d81a,null))['then'](function(_0xa928c1){if(_0xa928c1){_0x426186[_0xf297('0x7c')]=_['keys'](db['JscriptySessionReport'][_0xf297('0x7d')]);_0x426186[_0xf297('0x22')]=_['keys'](_0x3da231['query']);_0x426186[_0xf297('0x7e')]=_[_0xf297('0x7f')](_0x426186[_0xf297('0x7c')],_0x426186[_0xf297('0x22')]);_0x413f30[_0xf297('0x81')]=_[_0xf297('0x7f')](_0x426186[_0xf297('0x7c')],qs[_0xf297('0x80')](_0x3da231['query'][_0xf297('0x80')]));_0x413f30[_0xf297('0x81')]=_0x413f30[_0xf297('0x81')][_0xf297('0x2a')]?_0x413f30[_0xf297('0x81')]:_0x426186[_0xf297('0x7c')];if(!_0x3da231[_0xf297('0x22')]['hasOwnProperty'](_0xf297('0x88'))){_0x413f30[_0xf297('0x12')]=qs[_0xf297('0x12')](_0x3da231[_0xf297('0x22')]['limit']);_0x413f30[_0xf297('0x11')]=qs[_0xf297('0x11')](_0x3da231[_0xf297('0x22')][_0xf297('0x11')]);}_0x413f30[_0xf297('0x82')]=qs[_0xf297('0x83')](_0x3da231[_0xf297('0x22')]['sort']);_0x413f30[_0xf297('0x5a')]=qs[_0xf297('0x7e')](_[_0xf297('0x84')](_0x3da231[_0xf297('0x22')],_0x426186[_0xf297('0x7e')]));_0x413f30[_0xf297('0x5a')][_0xf297('0x9e')]=_0xa928c1['id'];if(_0x3da231[_0xf297('0x22')][_0xf297('0x85')]){_0x413f30[_0xf297('0x5a')]=_[_0xf297('0x86')](_0x413f30[_0xf297('0x5a')],{'$or':_['map'](_0x413f30[_0xf297('0x81')],function(_0xf6dea3){var _0x36e999={};_0x36e999[_0xf6dea3]={'$like':'%'+_0x3da231[_0xf297('0x22')][_0xf297('0x85')]+'%'};return _0x36e999;})});}_0x413f30=_[_0xf297('0x86')]({},_0x413f30,_0x3da231['options']);return db[_0xf297('0x50')]['count']({'where':_0x413f30['where']})[_0xf297('0x17')](function(_0x4b7827){_0x84f41c[_0xf297('0x14')]=_0x4b7827;if(_0x3da231['query'][_0xf297('0x9f')]){_0x413f30[_0xf297('0xa0')]=[{'all':!![]}];}return db[_0xf297('0x50')][_0xf297('0x21')](_0x413f30);})['then'](function(_0x204f0a){_0x84f41c[_0xf297('0xa1')]=_0x204f0a;return _0x84f41c;});}})[_0xf297('0x17')](respondWithFilteredResult(_0x53d81a,_0x413f30))[_0xf297('0x24')](handleError(_0x53d81a,null));};exports[_0xf297('0xa5')]=function(_0x492ad7,_0x6fdaa8){try{if(!_0x492ad7[_0xf297('0x35')][_0xf297('0x5d')]){throw new Error(_0xf297('0xa6'));}if(!_0x492ad7[_0xf297('0x35')][_0xf297('0xa7')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x492ad7[_0xf297('0x35')]['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x492ad7[_0xf297('0x35')][_0xf297('0xa8')]){throw new Error(_0xf297('0xa9'));}var _0xf05551=_0x492ad7[_0xf297('0x35')][_0xf297('0xa7')][_0xf297('0xaa')](',');var _0x49d741=_0x492ad7[_0xf297('0x35')][_0xf297('0xab')][_0xf297('0xaa')](',');if(!_0xf05551['length']||!_0x49d741[_0xf297('0x2a')]||_0xf05551[_0xf297('0x2a')]!==_0x49d741['length']){throw new Error(_0xf297('0xac'));}_0x492ad7[_0xf297('0x35')][_0xf297('0x80')]=_[_0xf297('0xad')](_0xf05551,_0x49d741);if(!_0x492ad7[_0xf297('0x35')][_0xf297('0x80')][_0xf297('0x79')]){throw new Error(_0xf297('0xae'));}if(!_0x492ad7[_0xf297('0x35')][_0xf297('0x80')][_0xf297('0xaf')]){throw new Error(_0xf297('0xb0'));}var _0x18856c=path[_0xf297('0x3a')](config[_0xf297('0xb1')],_0xf297('0xb2'),_0x492ad7[_0xf297('0xb3')][_0xf297('0xb4')]);fs['chmodSync'](_0x18856c,parseInt(_0xf297('0xb5'),0x8));var _0x18019b=require(_0xf297('0xb6'))[_0xf297('0xb7')](path[_0xf297('0x3a')](__dirname,_0xf297('0xb8')),[_0x18856c,_0x492ad7['body'][_0xf297('0xa7')],_0x492ad7[_0xf297('0x35')][_0xf297('0xab')],_0x492ad7[_0xf297('0x35')][_0xf297('0x5d')],_0x492ad7[_0xf297('0x35')][_0xf297('0xb9')],_0x492ad7[_0xf297('0x35')][_0xf297('0x59')],_0x492ad7[_0xf297('0x35')][_0xf297('0xa8')]]);return _0x6fdaa8['status'](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x18019b[_0xf297('0xba')]});}catch(_0x561577){return _0x6fdaa8[_0xf297('0xf')](0x1f4)['send'](_0x561577);}};exports['upload']=function(_0x4e1a45,_0x5525cd){var _0x4fb08b=fs[_0xf297('0xbb')](_0x4e1a45[_0xf297('0xb3')][_0xf297('0xbc')]);Papa[_0xf297('0xbd')](_0x4fb08b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1780c9){return _0x5525cd[_0xf297('0xf')](0xc8)[_0xf297('0x10')]({'file':_0x4e1a45['file'],'fields':_0x1780c9[_0xf297('0xbe')][_0xf297('0x80')]});}});};exports[_0xf297('0xbf')]=function(_0x5d577d,_0x3bb09a){return db[_0xf297('0xc0')][_0xf297('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xf297('0xc1')}})[_0xf297('0x17')](function(_0x52458a){var _0x123d2b=![];if(!_0x5d577d[_0xf297('0x35')][_0xf297('0x5d')]){throw new Error(_0xf297('0xa6'));}if(!_0x5d577d['body'][_0xf297('0xc2')][_0xf297('0x79')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x5d577d[_0xf297('0x35')]['binding'][_0xf297('0xaf')]){throw new Error(_0xf297('0xb0'));}if(!_0x5d577d[_0xf297('0x35')][_0xf297('0xa8')]){throw new Error(_0xf297('0xa9'));}var _0x2c3946=require(_0xf297('0xb6'))[_0xf297('0xb7')](path[_0xf297('0x3a')](__dirname,_0xf297('0xc3')),[_0x5d577d['params']['id'],JSON[_0xf297('0xc4')](_0x5d577d[_0xf297('0x35')]),JSON[_0xf297('0xc4')](_0x52458a)]);_0x2c3946['on'](_0xf297('0xc5'),function(){_0x123d2b=!![];return _0x3bb09a[_0xf297('0xf')](0xc8)[_0xf297('0x10')]({'message':_0xf297('0xc6'),'pid':_0x2c3946[_0xf297('0xba')]});});_0x2c3946['on'](_0xf297('0xc7'),function(_0xa8372f){if(_0xa8372f&&!_0x123d2b){return _0x3bb09a['status'](0x1f4)['json']({'message':_0xf297('0xc8'),'pid':_0x2c3946[_0xf297('0xba')]});}});})[_0xf297('0x24')](handleError(_0x3bb09a,null));};exports['importUpdates']=function(_0x456abe,_0xc48245){return db[_0xf297('0xc0')][_0xf297('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xf297('0xc1')}})['then'](function(_0x3b8563){var _0x3dd159=![];if(!_0x456abe[_0xf297('0x35')]['ListId']){throw new Error(_0xf297('0xa6'));}if(!_0x456abe[_0xf297('0x35')][_0xf297('0xc2')][_0xf297('0x79')]){throw new Error(_0xf297('0xae'));}if(!_0x456abe[_0xf297('0x35')][_0xf297('0xc2')][_0xf297('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x456abe[_0xf297('0x35')][_0xf297('0xa8')]){throw new Error(_0xf297('0xa9'));}var _0x4a2b26=require(_0xf297('0xb6'))[_0xf297('0xb7')](path[_0xf297('0x3a')](__dirname,_0xf297('0xc9')),[_0x456abe[_0xf297('0x27')]['id'],JSON[_0xf297('0xc4')](_0x456abe['body']),JSON[_0xf297('0xc4')](_0x3b8563)]);_0x4a2b26['on'](_0xf297('0xc5'),function(){_0x3dd159=!![];return _0xc48245['status'](0xc8)[_0xf297('0x10')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x4a2b26[_0xf297('0xba')]});});_0x4a2b26['on'](_0xf297('0xc7'),function(_0x4992d4){if(_0x4992d4&&!_0x3dd159){return _0xc48245[_0xf297('0xf')](0x1f4)[_0xf297('0x10')]({'message':_0xf297('0xc8'),'pid':_0x4a2b26['pid']});}});})[_0xf297('0x24')](handleError(_0xc48245,null));};exports[_0xf297('0xca')]=function(_0x4760b4,_0x2a1c8b){var _0xca5208=[_0xf297('0xcb'),_0xf297('0xcc'),_0xf297('0xcd'),_0xf297('0xce'),_0xf297('0xcf'),_0xf297('0xd0'),_0xf297('0xd1')];var _0x30b78d={'offset':0x0,'order':qs[_0xf297('0x83')](_0xf297('0xd2'))},_0xcd6968={'count':0x0,'rows':[]};Promise[_0xf297('0xd3')]()[_0xf297('0x17')](function(){if(_0x4760b4[_0xf297('0x22')][_0xf297('0xd4')]){if(!_['includes'](_0xca5208,_0x4760b4[_0xf297('0x22')][_0xf297('0xd4')][_0xf297('0xd5')]())){throw new Error('Invalid\x20channel');}_0xca5208=[_0x4760b4[_0xf297('0x22')][_0xf297('0xd4')][_0xf297('0xd5')]()];}if(_0x4760b4['query'][_0xf297('0xd6')]){try{var _0x6ed5df=JSON[_0xf297('0xbd')](_0x4760b4[_0xf297('0x22')]['range']);if(!moment(_0x6ed5df['from'])[_0xf297('0xd7')]()){throw new Error(_0xf297('0xd8'));}if(!moment(_0x6ed5df['to'])['isValid']()){throw new Error(_0xf297('0xd9'));}}catch(_0x20fe90){throw new Error(_0xf297('0xda'));}}if(!_0x4760b4['query'][_0xf297('0x60')](_0xf297('0x88'))){_0x30b78d[_0xf297('0x12')]=qs['limit'](_0x4760b4['query']['limit']||0xa);_0x30b78d['offset']=qs['offset'](_0x4760b4[_0xf297('0x22')][_0xf297('0x11')]);}var _0x26edc0=_0xca5208[_0xf297('0x6f')](function(_0x4c210c){if(_0x4c210c===_0xf297('0xd1')){var _0x4cbddd={'attributes':['id','uniqueid',_0xf297('0xdb'),_0xf297('0xdc'),'destination',_0xf297('0xdd'),'starttime',_0xf297('0xde'),'duration',_0xf297('0xdf'),_0xf297('0xe0'),'userDisposition',_0xf297('0xe1'),_0xf297('0xe2'),_0xf297('0xe3')],'where':{'ContactId':_0x4760b4[_0xf297('0x27')]['id']},'include':[{'model':db['User'],'as':_0xf297('0xc0'),'attributes':['id','name',_0xf297('0xe4'),'alias']}],'order':[[_0xf297('0xe0'),'DESC']]};if(_0x4760b4[_0xf297('0x22')][_0xf297('0xd6')]){_0x4cbddd[_0xf297('0x5a')]['createdAt']={'$gte':_0x6ed5df[_0xf297('0x36')],'$lte':_0x6ed5df['to']};}return db['VoiceCallReport'][_0xf297('0xe5')](_0x4cbddd)[_0xf297('0x17')](function(_0x24ef8a){_0xcd6968['count']+=_0x24ef8a[_0xf297('0x14')];return _[_0xf297('0x6f')](_0x24ef8a['rows'],function(_0x1c029a){var _0x1f1591=_0x1c029a[_0xf297('0x37')]({'plain':!![]});_0x1f1591[_0xf297('0xd4')]=_0x4c210c;if(_0x1f1591[_0xf297('0xc0')]){_0x1f1591[_0xf297('0xc0')]={'id':_0x1f1591[_0xf297('0xc0')]['id'],'name':_0x1f1591[_0xf297('0xc0')][_0xf297('0x1c')],'fullname':_0x1f1591[_0xf297('0xc0')][_0xf297('0xe4')],'alias':_0x1f1591[_0xf297('0xc0')][_0xf297('0x2f')]};}return _0x1f1591;});});}else{var _0x3b6c20=_[_0xf297('0xe6')](_0x4c210c)+(_0x4c210c==='chat'?'Website':_0xf297('0xe7'));var _0x389836={'attributes':['id',_0xf297('0xe8'),_0xf297('0xe9'),_0xf297('0xe0'),_0xf297('0xdf'),_0xf297('0xea'),_0xf297('0xeb'),_0xf297('0xec'),_0xf297('0xe3'),_0x3b6c20+'Id'],'where':{'ContactId':_0x4760b4[_0xf297('0x27')]['id']},'include':[{'model':db[_0x3b6c20],'as':_0xf297('0xe7'),'attributes':['id','name',_0xf297('0xed')]},{'model':db[_0xf297('0xc0')],'as':_0xf297('0xee'),'attributes':['id','name',_0xf297('0xe4')]},{'model':db[_0xf297('0x64')],'as':_0xf297('0x65'),'attributes':['id',_0xf297('0x1c'),'color'],'through':{'attributes':[]}}],'order':[['createdAt',_0xf297('0xef')]]};if(_0x4760b4['query']['range']){_0x389836['where'][_0xf297('0xe0')]={'$gte':_0x6ed5df[_0xf297('0x36')],'$lte':_0x6ed5df['to']};}switch(_0x4c210c){case _0xf297('0xcc'):_0x389836['attributes'][_0xf297('0x5c')]('browserName',_0xf297('0xf0'),_0xf297('0xf1'),_0xf297('0xf2'),_0xf297('0xf3'),'ratingMessage',_0xf297('0xf4'),_0xf297('0xf5'),_0xf297('0xf6'));break;case _0xf297('0xcb'):_0x389836['attributes'][_0xf297('0x5c')](_0xf297('0xf7'),_0xf297('0xf8'));break;case _0xf297('0xce'):_0x389836[_0xf297('0x81')]['push'](_0xf297('0xf9'),_0xf297('0xfa'));break;}return db[_[_0xf297('0xe6')](_0x4c210c)+_0xf297('0xfb')][_0xf297('0xe5')](_0x389836)[_0xf297('0x17')](function(_0x2f0ae1){_0xcd6968['count']+=_0x2f0ae1['count'];return _[_0xf297('0x6f')](_0x2f0ae1[_0xf297('0xa1')],function(_0x35d8e9){var _0x1b9662=_0x35d8e9[_0xf297('0x37')]({'plain':!![]});_0x1b9662[_0xf297('0xd4')]=_0x4c210c;if(_0x1b9662[_0xf297('0xee')]){_0x1b9662['Owner']={'id':_0x1b9662[_0xf297('0xee')]['id'],'name':_0x1b9662['Owner'][_0xf297('0x1c')],'fullname':_0x1b9662[_0xf297('0xee')][_0xf297('0xe4')]};}return _0x1b9662;});});}});return Promise[_0xf297('0x62')](_0x26edc0);})['then'](function(_0x5191b0){return _(_0x5191b0)['flatten']()[_0xf297('0xfc')](_0xf297('0xe0'))[_0xf297('0xfd')]()[_0xf297('0xfe')]();})[_0xf297('0x17')](function(_0x1f6499){_0xcd6968['rows']=_0x30b78d[_0xf297('0x12')]?_0x1f6499[_0xf297('0xff')](_0x30b78d[_0xf297('0x11')],_0x30b78d[_0xf297('0x11')]+_0x30b78d[_0xf297('0x12')]):_0x1f6499;return _0xcd6968;})[_0xf297('0x17')](respondWithFilteredResult(_0x2a1c8b,_0x30b78d))[_0xf297('0x24')](handleError(_0x2a1c8b,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 9490523..f87a3cb 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 _0xd289=['hasOwnProperty','hook','exports','../../mysqldb','CmContact','setMaxListeners','update','emit'];(function(_0x31ab82,_0x4ea319){var _0xe9065d=function(_0x5b0a7e){while(--_0x5b0a7e){_0x31ab82['push'](_0x31ab82['shift']());}};_0xe9065d(++_0x4ea319);}(_0xd289,0x73));var _0x9d28=function(_0x5628b8,_0x145582){_0x5628b8=_0x5628b8-0x0;var _0x3ce423=_0xd289[_0x5628b8];return _0x3ce423;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x9d28('0x0'))['db'][_0x9d28('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9d28('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9d28('0x3'),'afterDestroy':'remove'};function emitEvent(_0x373536){return function(_0x50c4fa,_0x3bd420,_0x52d1a1){CmContactEvents[_0x9d28('0x4')](_0x373536+':'+_0x50c4fa['id'],_0x50c4fa);CmContactEvents[_0x9d28('0x4')](_0x373536,_0x50c4fa);_0x52d1a1(null);};}for(var e in events){if(events[_0x9d28('0x5')](e)){var event=events[e];CmContact[_0x9d28('0x6')](e,emitEvent(event));}}module[_0x9d28('0x7')]=CmContactEvents; \ No newline at end of file +var _0x17b1=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x51ac6b,_0x33600c){var _0x249092=function(_0x5a7287){while(--_0x5a7287){_0x51ac6b['push'](_0x51ac6b['shift']());}};_0x249092(++_0x33600c);}(_0x17b1,0x1aa));var _0x117b=function(_0x5c1449,_0x2af4b4){_0x5c1449=_0x5c1449-0x0;var _0x270473=_0x17b1[_0x5c1449];return _0x270473;};'use strict';var EventEmitter=require(_0x117b('0x0'));var CmContact=require(_0x117b('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x117b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x117b('0x3'),'afterDestroy':_0x117b('0x4')};function emitEvent(_0x328529){return function(_0x157690,_0x1d76a5,_0x152bd0){CmContactEvents[_0x117b('0x5')](_0x328529+':'+_0x157690['id'],_0x157690);CmContactEvents[_0x117b('0x5')](_0x328529,_0x157690);_0x152bd0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x117b('0x6')](e,emitEvent(event));}}module[_0x117b('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 610b9ee..c998960 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 _0xca02=['CmList','Lists','always','findAll','outbound','BlackLists','length','get','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','error','isEmpty','destroy','ContactId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','utcOffset','minutes','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','dialCheckDuplicateType'];(function(_0x5c20bf,_0x2381ee){var _0x19b3f3=function(_0x30f8e6){while(--_0x30f8e6){_0x5c20bf['push'](_0x5c20bf['shift']());}};_0x19b3f3(++_0x2381ee);}(_0xca02,0x16d));var _0x2ca0=function(_0x1475f6,_0x723bfb){_0x1475f6=_0x1475f6-0x0;var _0x24afd0=_0xca02[_0x1475f6];return _0x24afd0;};'use strict';var _=require(_0x2ca0('0x0'));var util=require(_0x2ca0('0x1'));var logger=require(_0x2ca0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ca0('0x3'));var rimraf=require(_0x2ca0('0x4'));var config=require(_0x2ca0('0x5'));var shared=require(_0x2ca0('0x6'));var attributes=require(_0x2ca0('0x7'));module[_0x2ca0('0x8')]=function(_0x1c48df,_0x5d29c9){return _0x1c48df[_0x2ca0('0x9')]('CmContact',attributes,{'tableName':_0x2ca0('0xa'),'paranoid':!![],'indexes':[{'name':_0x2ca0('0xb'),'fields':[_0x2ca0('0xb')]},{'name':_0x2ca0('0xc'),'fields':['firstName',_0x2ca0('0xd'),_0x2ca0('0xb'),_0x2ca0('0xe'),_0x2ca0('0xf'),_0x2ca0('0x10')],'type':_0x2ca0('0x11')}],'timestamps':!![],'charset':_0x2ca0('0x12'),'collate':_0x2ca0('0x13'),'hooks':{'afterCreate':function(_0x3b3055,_0x39eacc,_0x4f9a95){var _0x5bfe75=_0x1c48df[_0x2ca0('0x14')];var _0xbe59ba=_0x3b3055['get']({'plain':!![]});function _0x40f79a(){return function(_0xd5560a){logger['error'](_0x2ca0('0x15'),_0x2ca0('0x16'),util[_0x2ca0('0x17')](_0xd5560a,{'showHidden':![],'depth':null}));};}function _0x594e39(_0x505fb3,_0x334685){var _0x516cd8=_0x334685[_0x2ca0('0x18')]?_0x334685[_0x2ca0('0x18')]:moment()[_0x2ca0('0x19')](_0x2ca0('0x1a'));return new BPromise(function(_0x55e99e,_0x5dbb05){if(_[_0x2ca0('0x1b')](_0x334685[_0x2ca0('0x1c')])){_0x55e99e({'ret':_0x516cd8});}else{_0x5bfe75[_0x2ca0('0x1d')]['findOne']({'where':{'id':_0x505fb3['id']}})[_0x2ca0('0x1e')](function(_0x1719e5){if(!_['isNil'](_0x1719e5)){var _0x4c8f1a=_0x1719e5[_0x2ca0('0x1c')];if(!_[_0x2ca0('0x1b')](_0x4c8f1a)){var _0xf8be1a=shared['timezones'];var _0x564dc4=_0xf8be1a[_0x4c8f1a];var _0x2bb173=_0xf8be1a[_0x334685[_0x2ca0('0x1c')]];if(!_[_0x2ca0('0x1b')](_0x564dc4)&&!_[_0x2ca0('0x1b')](_0x2bb173)){var _0x260a42=_0x564dc4['utcOffset']-_0x2bb173[_0x2ca0('0x1f')];_0x516cd8=_0x334685[_0x2ca0('0x18')]?_0x334685[_0x2ca0('0x18')]:moment();var _0x3e0ba9=moment(_0x516cd8)['add'](_0x260a42,_0x2ca0('0x20'));_0x55e99e({'ret':_0x3e0ba9[_0x2ca0('0x19')](_0x2ca0('0x1a'))});}else _0x55e99e({'ret':_0x516cd8});}else _0x55e99e({'ret':_0x516cd8});}else{_0x55e99e({'ret':_0x516cd8});}});}});return 0xa;}var _0x1941d2=function(_0x1502e2){return new BPromise(function(_0x4ba275,_0x24562a){_0x594e39(_0x1502e2,_0xbe59ba)[_0x2ca0('0x1e')](function(_0x287700){_0xbe59ba[_0x2ca0('0x18')]=_0x287700['ret'];_0x5bfe75[_0x2ca0('0x21')][_0x2ca0('0x22')]({'where':{'phone':_0xbe59ba['phone'],'VoiceQueueId':_0x1502e2['id']}})[_0x2ca0('0x1e')](function(_0x55c5ea){if(!_[_0x2ca0('0x1b')](_0x55c5ea)){throw new Error(_0x2ca0('0x23')+_0xbe59ba['phone']+_0x2ca0('0x24')+_0x1502e2['id']);}return _0x5bfe75['CmHopper']['create']({'phone':_0xbe59ba[_0x2ca0('0xb')],'ContactId':_0xbe59ba['id'],'ListId':_0xbe59ba[_0x2ca0('0x25')],'priority':_0xbe59ba[_0x2ca0('0x26')]?_0xbe59ba['priority']:0x2,'scheduledat':_0xbe59ba[_0x2ca0('0x18')]?_0xbe59ba[_0x2ca0('0x18')]:moment()[_0x2ca0('0x19')](_0x2ca0('0x1a')),'callback':_0xbe59ba['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xbe59ba[_0x2ca0('0x27')]?_0xbe59ba[_0x2ca0('0x27')]:undefined,'callbackat':_0xbe59ba[_0x2ca0('0x27')]?moment()[_0x2ca0('0x19')](_0x2ca0('0x1a')):undefined,'VoiceQueueId':_0x1502e2['id']});})['catch'](function(_0x2eaf7e){_0x24562a(_0x2eaf7e);});});});};var _0x5b7ae0=function(_0x12dee0){return new BPromise(function(_0x5fe0f3,_0xd269df){_0x594e39(_0x12dee0,_0xbe59ba)['then'](function(_0x5b12fe){_0xbe59ba[_0x2ca0('0x18')]=_0x5b12fe['ret'];_0x5bfe75[_0x2ca0('0x21')][_0x2ca0('0x22')]({'where':{'phone':_0xbe59ba[_0x2ca0('0xb')],'VoiceQueueId':_0x12dee0['id']}})[_0x2ca0('0x1e')](function(_0x1e622f){if(!_[_0x2ca0('0x1b')](_0x1e622f)){throw new Error(_0x2ca0('0x23')+_0xbe59ba[_0x2ca0('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x12dee0['id']);}return _0x5bfe75[_0x2ca0('0x28')][_0x2ca0('0x22')]({'where':{'calleridnum':_0xbe59ba[_0x2ca0('0xb')],'VoiceQueueId':_0x12dee0['id']}});})[_0x2ca0('0x1e')](function(_0x47279e){if(!_[_0x2ca0('0x1b')](_0x47279e)){throw new Error('cmContact,\x20afterCreate,\x20'+_0xbe59ba[_0x2ca0('0xb')]+_0x2ca0('0x29')+_0x12dee0['id']);}return _0x5bfe75[_0x2ca0('0x21')][_0x2ca0('0x2a')]({'phone':_0xbe59ba[_0x2ca0('0xb')],'ContactId':_0xbe59ba['id'],'ListId':_0xbe59ba['ListId'],'priority':_0xbe59ba[_0x2ca0('0x26')]?_0xbe59ba['priority']:0x2,'scheduledat':_0xbe59ba[_0x2ca0('0x18')]?_0xbe59ba[_0x2ca0('0x18')]:moment()[_0x2ca0('0x19')](_0x2ca0('0x1a')),'callback':_0xbe59ba[_0x2ca0('0x27')]?!![]:![],'callbackuniqueid':_0xbe59ba[_0x2ca0('0x27')]?_0xbe59ba['callbackUniqueid']:undefined,'callbackat':_0xbe59ba['callbackUniqueid']?moment()['format'](_0x2ca0('0x1a')):undefined,'VoiceQueueId':_0x12dee0['id']});})[_0x2ca0('0x2b')](function(_0x109e97){_0xd269df(_0x109e97);});});});};function _0x48ed67(){return function(_0x5124c7){logger['error']('cmContact',_0x2ca0('0x16'),util[_0x2ca0('0x17')](_0x5124c7,{'showHidden':![],'depth':null}));};}function _0x11acac(_0x1cdf0f,_0x4d90fe){var _0x2010d2=_0x4d90fe[_0x2ca0('0x18')]?_0x4d90fe[_0x2ca0('0x18')]:moment()['format'](_0x2ca0('0x1a'));return new BPromise(function(_0x4c089b,_0x1dc403){if(_[_0x2ca0('0x1b')](_0x4d90fe['dialTimezone'])){_0x4c089b({'ret':_0x2010d2});}else{_0x5bfe75['Campaign'][_0x2ca0('0x22')]({'where':{'id':_0x1cdf0f['id']}})[_0x2ca0('0x1e')](function(_0x1ee935){if(!_[_0x2ca0('0x1b')](_0x1ee935)){var _0x17e4a1=_0x1ee935[_0x2ca0('0x1c')];if(!_[_0x2ca0('0x1b')](_0x17e4a1)){var _0x56cba0=shared['timezones'];var _0x40fb85=_0x56cba0[_0x17e4a1];var _0x5123c6=_0x56cba0[_0x4d90fe[_0x2ca0('0x1c')]];if(!_[_0x2ca0('0x1b')](_0x40fb85)&&!_[_0x2ca0('0x1b')](_0x5123c6)){var _0x72a781=_0x40fb85[_0x2ca0('0x1f')]-_0x5123c6[_0x2ca0('0x1f')];_0x2010d2=_0x4d90fe['scheduledat']?_0x4d90fe[_0x2ca0('0x18')]:moment();var _0x1df670=moment(_0x2010d2)['add'](_0x72a781,_0x2ca0('0x20'));_0x4c089b({'ret':_0x1df670['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x4c089b({'ret':_0x2010d2});}else _0x4c089b({'ret':_0x2010d2});}else{_0x4c089b({'ret':_0x2010d2});}});}});return 0xa;}var _0x38f365=function(_0x3df1d7){return new BPromise(function(_0xaf6df0,_0x357f19){_0x11acac(_0x3df1d7,_0xbe59ba)[_0x2ca0('0x1e')](function(_0x4146db){_0xbe59ba[_0x2ca0('0x18')]=_0x4146db[_0x2ca0('0x2c')];_0x5bfe75[_0x2ca0('0x21')]['findOne']({'where':{'phone':_0xbe59ba['phone'],'CampaignId':_0x3df1d7['id']}})['then'](function(_0x7c0987){if(!_[_0x2ca0('0x1b')](_0x7c0987)){throw new Error('cmContact,\x20afterCreate\x20'+_0xbe59ba['phone']+_0x2ca0('0x2d')+_0x3df1d7['id']);}return _0x5bfe75[_0x2ca0('0x21')][_0x2ca0('0x2a')]({'phone':_0xbe59ba['phone'],'ContactId':_0xbe59ba['id'],'ListId':_0xbe59ba[_0x2ca0('0x25')],'priority':_0xbe59ba[_0x2ca0('0x26')]?_0xbe59ba[_0x2ca0('0x26')]:0x2,'scheduledat':_0xbe59ba[_0x2ca0('0x18')]?_0xbe59ba[_0x2ca0('0x18')]:moment()[_0x2ca0('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xbe59ba[_0x2ca0('0x27')]?!![]:![],'callbackuniqueid':_0xbe59ba[_0x2ca0('0x27')]?_0xbe59ba[_0x2ca0('0x27')]:undefined,'callbackat':_0xbe59ba['callbackUniqueid']?moment()[_0x2ca0('0x19')](_0x2ca0('0x1a')):undefined,'CampaignId':_0x3df1d7['id']});})[_0x2ca0('0x2b')](function(_0x285ed8){_0x357f19(_0x285ed8);});});});};var _0x16135f=function(_0x2275c5){return new BPromise(function(_0xcb9ac3,_0x6cd68d){_0x11acac(_0x2275c5,_0xbe59ba)['then'](function(_0x13e409){_0xbe59ba[_0x2ca0('0x18')]=_0x13e409[_0x2ca0('0x2c')];_0x5bfe75['CmHopper'][_0x2ca0('0x22')]({'where':{'phone':_0xbe59ba['phone'],'CampaignId':_0x2275c5['id']}})[_0x2ca0('0x1e')](function(_0x35230d){if(!_[_0x2ca0('0x1b')](_0x35230d)){throw new Error(_0x2ca0('0x23')+_0xbe59ba[_0x2ca0('0xb')]+_0x2ca0('0x2e')+_0x2275c5['id']);}return _0x5bfe75['CmHopperFinal'][_0x2ca0('0x22')]({'where':{'calleridnum':_0xbe59ba['phone'],'CampaignId':_0x2275c5['id']}});})[_0x2ca0('0x1e')](function(_0xfdc8d7){if(!_[_0x2ca0('0x1b')](_0xfdc8d7)){throw new Error('cmContact,\x20afterCreate,\x20'+_0xbe59ba[_0x2ca0('0xb')]+_0x2ca0('0x2f')+_0x2275c5['id']);}return _0x5bfe75[_0x2ca0('0x21')]['create']({'phone':_0xbe59ba[_0x2ca0('0xb')],'ContactId':_0xbe59ba['id'],'ListId':_0xbe59ba['ListId'],'priority':_0xbe59ba[_0x2ca0('0x26')]?_0xbe59ba[_0x2ca0('0x26')]:0x2,'scheduledat':_0xbe59ba[_0x2ca0('0x18')]?_0xbe59ba[_0x2ca0('0x18')]:moment()['format'](_0x2ca0('0x1a')),'callback':_0xbe59ba[_0x2ca0('0x27')]?!![]:![],'callbackuniqueid':_0xbe59ba[_0x2ca0('0x27')]?_0xbe59ba[_0x2ca0('0x27')]:undefined,'callbackat':_0xbe59ba[_0x2ca0('0x27')]?moment()[_0x2ca0('0x19')](_0x2ca0('0x1a')):undefined,'CampaignId':_0x2275c5['id']});})[_0x2ca0('0x2b')](function(_0x7d686b){_0x6cd68d(_0x7d686b);});});});};if(_0xbe59ba['ListId']){_0x5bfe75['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x2ca0('0x30'),'dialTimezone'],'include':[{'model':_0x5bfe75[_0x2ca0('0x31')],'as':_0x2ca0('0x32'),'where':{'id':_0xbe59ba[_0x2ca0('0x25')]}}]})[_0x2ca0('0x1e')](function(_0x37d8e5){if(_0x37d8e5){var _0x228ff2=[];for(var _0x3e2ddf=0x0,_0x40ff54;_0x3e2ddf<_0x37d8e5['length'];_0x3e2ddf+=0x1){_0x40ff54=_0x37d8e5[_0x3e2ddf]['get']({'plain':!![]});switch(_0x40ff54[_0x2ca0('0x30')]){case _0x2ca0('0x33'):_0x5b7ae0(_0x40ff54)[_0x2ca0('0x2b')](_0x40f79a());break;case'onlyIfOpen':_0x1941d2(_0x40ff54)[_0x2ca0('0x2b')](_0x40f79a());break;default:_0x11acac(_0x40ff54,_0xbe59ba)[_0x2ca0('0x1e')](function(_0x663f19){_0xbe59ba[_0x2ca0('0x18')]=_0x663f19[_0x2ca0('0x2c')];_0x5bfe75[_0x2ca0('0x21')][_0x2ca0('0x2a')]({'phone':_0xbe59ba[_0x2ca0('0xb')],'ContactId':_0xbe59ba['id'],'ListId':_0xbe59ba[_0x2ca0('0x25')],'scheduledat':_0xbe59ba[_0x2ca0('0x18')]?_0xbe59ba[_0x2ca0('0x18')]:moment()['format'](_0x2ca0('0x1a')),'priority':_0xbe59ba[_0x2ca0('0x26')]?_0xbe59ba['priority']:0x2,'callback':_0xbe59ba[_0x2ca0('0x27')]?!![]:![],'callbackuniqueid':_0xbe59ba[_0x2ca0('0x27')]?_0xbe59ba['callbackUniqueid']:undefined,'callbackat':_0xbe59ba[_0x2ca0('0x27')]?moment()['format'](_0x2ca0('0x1a')):undefined,'VoiceQueueId':_0x40ff54['id']})[_0x2ca0('0x2b')](_0x40f79a());});}}}})[_0x2ca0('0x1e')](function(){return _0x5bfe75[_0x2ca0('0x1d')][_0x2ca0('0x34')]({'where':{'type':_0x2ca0('0x35')},'attributes':['id'],'include':[{'model':_0x5bfe75[_0x2ca0('0x31')],'as':_0x2ca0('0x36'),'where':{'id':_0xbe59ba[_0x2ca0('0x25')]}}]})['then'](function(_0x212d23){if(_0x212d23){var _0x165f19=[];for(var _0xc30622=0x0,_0x1ceb2e;_0xc30622<_0x212d23[_0x2ca0('0x37')];_0xc30622+=0x1){_0x1ceb2e=_0x212d23[_0xc30622][_0x2ca0('0x38')]({'plain':!![]});_0x5bfe75[_0x2ca0('0x39')][_0x2ca0('0x2a')]({'phone':_0xbe59ba[_0x2ca0('0xb')],'ContactId':_0xbe59ba['id'],'ListId':_0xbe59ba[_0x2ca0('0x25')],'VoiceQueueId':_0x1ceb2e['id']})['catch'](function(_0x5e118f){logger['error'](_0x2ca0('0x3a'),_0x2ca0('0x16'),_0x5e118f[_0x2ca0('0x3b')]);});}}});})['then'](function(){return _0x5bfe75[_0x2ca0('0x3c')][_0x2ca0('0x34')]({'attributes':['id',_0x2ca0('0x30'),_0x2ca0('0x1c')],'include':[{'model':_0x5bfe75['CmList'],'as':_0x2ca0('0x32'),'where':{'id':_0xbe59ba[_0x2ca0('0x25')]}}]})[_0x2ca0('0x1e')](function(_0x1a5839){if(_0x1a5839){var _0x128395=[];for(var _0x176a2b=0x0,_0x3df57f;_0x176a2b<_0x1a5839[_0x2ca0('0x37')];_0x176a2b+=0x1){_0x3df57f=_0x1a5839[_0x176a2b][_0x2ca0('0x38')]({'plain':!![]});switch(_0x3df57f[_0x2ca0('0x30')]){case'always':_0x16135f(_0x3df57f)[_0x2ca0('0x2b')](_0x48ed67());break;case'onlyIfOpen':_0x38f365(_0x3df57f)['catch'](_0x48ed67());break;default:_0x5bfe75[_0x2ca0('0x21')][_0x2ca0('0x2a')]({'phone':_0xbe59ba['phone'],'ContactId':_0xbe59ba['id'],'ListId':_0xbe59ba['ListId'],'scheduledat':_0xbe59ba[_0x2ca0('0x18')]?_0xbe59ba[_0x2ca0('0x18')]:moment()['format'](_0x2ca0('0x1a')),'priority':_0xbe59ba[_0x2ca0('0x26')]?_0xbe59ba['priority']:0x2,'callback':_0xbe59ba['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xbe59ba[_0x2ca0('0x27')]?_0xbe59ba[_0x2ca0('0x27')]:undefined,'callbackat':_0xbe59ba['callbackUniqueid']?moment()[_0x2ca0('0x19')](_0x2ca0('0x1a')):undefined,'CampaignId':_0x3df57f['id']})[_0x2ca0('0x2b')](_0x48ed67());}}}});})[_0x2ca0('0x1e')](function(){return _0x5bfe75[_0x2ca0('0x3c')][_0x2ca0('0x34')]({'attributes':['id'],'include':[{'model':_0x5bfe75['CmList'],'as':_0x2ca0('0x36'),'where':{'id':_0xbe59ba[_0x2ca0('0x25')]}}]})['then'](function(_0x2a7b23){if(_0x2a7b23){var _0xacc937=[];for(var _0x23814e=0x0,_0x946048;_0x23814e<_0x2a7b23['length'];_0x23814e+=0x1){_0x946048=_0x2a7b23[_0x23814e][_0x2ca0('0x38')]({'plain':!![]});_0x5bfe75[_0x2ca0('0x39')]['create']({'phone':_0xbe59ba['phone'],'ContactId':_0xbe59ba['id'],'ListId':_0xbe59ba['ListId'],'CampaignId':_0x946048['id']})[_0x2ca0('0x2b')](function(_0x28f285){logger[_0x2ca0('0x3d')]('cmContact,\x20%s,\x20%s',_0x2ca0('0x16'),_0x28f285[_0x2ca0('0x3b')]);});}}});})[_0x2ca0('0x1e')](function(){_0x4f9a95();})[_0x2ca0('0x2b')](function(_0x4512a8){logger['error'](_0x2ca0('0x3a'),_0x2ca0('0x16'),_0x4512a8[_0x2ca0('0x3b')]);_0x4f9a95(_0x4512a8);});}else{_0x4f9a95(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x209a7a,_0x3244c7,_0x472d83){var _0x4ac65=_0x1c48df[_0x2ca0('0x14')];var _0x81c769=_0x209a7a[_0x2ca0('0x38')]({'plain':!![]});return _0x4ac65[_0x2ca0('0x21')]['findAll']({'raw':!![],'where':{'ListId':_0x81c769[_0x2ca0('0x25')],'ContactId':_0x81c769['id']}})[_0x2ca0('0x1e')](function(_0x549cfb){if(!_[_0x2ca0('0x3e')](_0x549cfb)){var _0x129454=[];for(var _0x3814d1=0x0;_0x3814d1<_0x549cfb[_0x2ca0('0x37')];_0x3814d1+=0x1){var _0x267395=_0x4ac65[_0x2ca0('0x21')][_0x2ca0('0x3f')]({'where':{'ListId':_0x549cfb[_0x3814d1][_0x2ca0('0x25')],'ContactId':_0x549cfb[_0x3814d1][_0x2ca0('0x40')],'VoiceQueueId':_0x549cfb[_0x3814d1]['VoiceQueueId'],'CampaignId':_0x549cfb[_0x3814d1][_0x2ca0('0x41')]}});_0x129454['push'](_0x267395);}return BPromise['all'](_0x129454);}})[_0x2ca0('0x1e')](function(_0x30f5f5){logger[_0x2ca0('0x42')](_0x2ca0('0x43'),util['inspect'](_0x30f5f5,{'showHidden':![],'depth':null}));_0x472d83();})['catch'](function(_0x4565a7){logger['error'](_0x2ca0('0x44'),util[_0x2ca0('0x17')](_0x4565a7,{'showHidden':![],'depth':null}));_0x472d83(_0x4565a7);});}}});}; \ No newline at end of file +var _0x95e3=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','Lists','length','dialCheckDuplicateType','always','CmList','cmContact,\x20%s,\x20%s','message','Campaign','onlyIfOpen','BlackLists','CmHopperBlack','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','utcOffset','minutes','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','add'];(function(_0x54105c,_0x1b9a42){var _0x46c919=function(_0x46c2c9){while(--_0x46c2c9){_0x54105c['push'](_0x54105c['shift']());}};_0x46c919(++_0x1b9a42);}(_0x95e3,0x14c));var _0x395e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x95e3[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x395e('0x0'))(_0x395e('0x1'));var moment=require(_0x395e('0x2'));var BPromise=require(_0x395e('0x3'));var rp=require(_0x395e('0x4'));var fs=require('fs');var path=require(_0x395e('0x5'));var rimraf=require(_0x395e('0x6'));var config=require(_0x395e('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0x395e('0x8'));module[_0x395e('0x9')]=function(_0x1067ee,_0x448579){return _0x1067ee[_0x395e('0xa')](_0x395e('0xb'),attributes,{'tableName':_0x395e('0xc'),'paranoid':!![],'indexes':[{'name':_0x395e('0xd'),'fields':[_0x395e('0xd')]},{'name':_0x395e('0xe'),'fields':[_0x395e('0xf'),_0x395e('0x10'),_0x395e('0xd'),_0x395e('0x11'),_0x395e('0x12'),_0x395e('0x13')],'type':_0x395e('0x14')}],'timestamps':!![],'charset':_0x395e('0x15'),'collate':_0x395e('0x16'),'hooks':{'afterCreate':function(_0x1f5163,_0x16963c,_0x47a45f){var _0x492aa1=_0x1067ee[_0x395e('0x17')];var _0x220f93=_0x1f5163[_0x395e('0x18')]({'plain':!![]});function _0x4a5b23(){return function(_0x88ac57){logger[_0x395e('0x19')](_0x395e('0x1a'),_0x395e('0x1b'),util[_0x395e('0x1c')](_0x88ac57,{'showHidden':![],'depth':null}));};}function _0xc0f7f2(_0x5ef90a,_0x2d36d0){var _0x40bf00=_0x2d36d0[_0x395e('0x1d')]?_0x2d36d0[_0x395e('0x1d')]:moment()[_0x395e('0x1e')](_0x395e('0x1f'));return new BPromise(function(_0x2aac64,_0x45386b){if(_[_0x395e('0x20')](_0x2d36d0[_0x395e('0x21')])){_0x2aac64({'ret':_0x40bf00});}else{_0x492aa1[_0x395e('0x22')][_0x395e('0x23')]({'where':{'id':_0x5ef90a['id']}})[_0x395e('0x24')](function(_0x3cae11){if(!_[_0x395e('0x20')](_0x3cae11)){var _0x482684=_0x3cae11['dialTimezone'];if(!_[_0x395e('0x20')](_0x482684)){var _0x583eef=shared['timezones'];var _0x8f67e2=_0x583eef[_0x482684];var _0x435ea0=_0x583eef[_0x2d36d0[_0x395e('0x21')]];if(!_[_0x395e('0x20')](_0x8f67e2)&&!_[_0x395e('0x20')](_0x435ea0)){var _0x4d1ce6=_0x8f67e2['utcOffset']-_0x435ea0[_0x395e('0x25')];_0x40bf00=_0x2d36d0['scheduledat']?_0x2d36d0[_0x395e('0x1d')]:moment();var _0x4c93f1=moment(_0x40bf00)['add'](_0x4d1ce6,_0x395e('0x26'));_0x2aac64({'ret':_0x4c93f1[_0x395e('0x1e')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x2aac64({'ret':_0x40bf00});}else _0x2aac64({'ret':_0x40bf00});}else{_0x2aac64({'ret':_0x40bf00});}});}});return 0xa;}var _0x1ab9b8=function(_0x574222){return new BPromise(function(_0x241722,_0x55f2f1){_0xc0f7f2(_0x574222,_0x220f93)[_0x395e('0x24')](function(_0x1204dc){_0x220f93['scheduledat']=_0x1204dc[_0x395e('0x27')];_0x492aa1['CmHopper'][_0x395e('0x23')]({'where':{'phone':_0x220f93[_0x395e('0xd')],'VoiceQueueId':_0x574222['id']}})[_0x395e('0x24')](function(_0x56d44a){if(!_['isNil'](_0x56d44a)){throw new Error(_0x395e('0x28')+_0x220f93[_0x395e('0xd')]+_0x395e('0x29')+_0x574222['id']);}return _0x492aa1[_0x395e('0x2a')]['create']({'phone':_0x220f93['phone'],'ContactId':_0x220f93['id'],'ListId':_0x220f93[_0x395e('0x2b')],'priority':_0x220f93[_0x395e('0x2c')]?_0x220f93[_0x395e('0x2c')]:0x2,'scheduledat':_0x220f93[_0x395e('0x1d')]?_0x220f93[_0x395e('0x1d')]:moment()[_0x395e('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x220f93[_0x395e('0x2d')]?!![]:![],'callbackuniqueid':_0x220f93[_0x395e('0x2d')]?_0x220f93['callbackUniqueid']:undefined,'callbackat':_0x220f93[_0x395e('0x2d')]?moment()[_0x395e('0x1e')](_0x395e('0x1f')):undefined,'VoiceQueueId':_0x574222['id']});})[_0x395e('0x2e')](function(_0x203cca){_0x55f2f1(_0x203cca);});});});};var _0x3a8df2=function(_0x2df7e6){return new BPromise(function(_0x364501,_0x3028bb){_0xc0f7f2(_0x2df7e6,_0x220f93)[_0x395e('0x24')](function(_0x333634){_0x220f93['scheduledat']=_0x333634[_0x395e('0x27')];_0x492aa1[_0x395e('0x2a')][_0x395e('0x23')]({'where':{'phone':_0x220f93[_0x395e('0xd')],'VoiceQueueId':_0x2df7e6['id']}})[_0x395e('0x24')](function(_0x2c9196){if(!_[_0x395e('0x20')](_0x2c9196)){throw new Error(_0x395e('0x28')+_0x220f93[_0x395e('0xd')]+_0x395e('0x2f')+_0x2df7e6['id']);}return _0x492aa1[_0x395e('0x30')]['findOne']({'where':{'calleridnum':_0x220f93[_0x395e('0xd')],'VoiceQueueId':_0x2df7e6['id']}});})['then'](function(_0x842e8){if(!_[_0x395e('0x20')](_0x842e8)){throw new Error(_0x395e('0x31')+_0x220f93['phone']+_0x395e('0x32')+_0x2df7e6['id']);}return _0x492aa1[_0x395e('0x2a')][_0x395e('0x33')]({'phone':_0x220f93[_0x395e('0xd')],'ContactId':_0x220f93['id'],'ListId':_0x220f93['ListId'],'priority':_0x220f93[_0x395e('0x2c')]?_0x220f93['priority']:0x2,'scheduledat':_0x220f93[_0x395e('0x1d')]?_0x220f93['scheduledat']:moment()[_0x395e('0x1e')](_0x395e('0x1f')),'callback':_0x220f93['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x220f93[_0x395e('0x2d')]?_0x220f93[_0x395e('0x2d')]:undefined,'callbackat':_0x220f93['callbackUniqueid']?moment()[_0x395e('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2df7e6['id']});})[_0x395e('0x2e')](function(_0x1dd311){_0x3028bb(_0x1dd311);});});});};function _0x3d7cf7(){return function(_0x162894){logger[_0x395e('0x19')](_0x395e('0x1a'),_0x395e('0x1b'),util[_0x395e('0x1c')](_0x162894,{'showHidden':![],'depth':null}));};}function _0x1bedb7(_0x419367,_0x16196f){var _0x1c9dd9=_0x16196f['scheduledat']?_0x16196f[_0x395e('0x1d')]:moment()['format'](_0x395e('0x1f'));return new BPromise(function(_0x2b798d,_0x2b2990){if(_['isNil'](_0x16196f[_0x395e('0x21')])){_0x2b798d({'ret':_0x1c9dd9});}else{_0x492aa1['Campaign'][_0x395e('0x23')]({'where':{'id':_0x419367['id']}})[_0x395e('0x24')](function(_0x4116fb){if(!_[_0x395e('0x20')](_0x4116fb)){var _0x1404a7=_0x4116fb['dialTimezone'];if(!_['isNil'](_0x1404a7)){var _0x25787e=shared['timezones'];var _0x4a4f39=_0x25787e[_0x1404a7];var _0x1259c2=_0x25787e[_0x16196f[_0x395e('0x21')]];if(!_[_0x395e('0x20')](_0x4a4f39)&&!_['isNil'](_0x1259c2)){var _0x1756e3=_0x4a4f39[_0x395e('0x25')]-_0x1259c2[_0x395e('0x25')];_0x1c9dd9=_0x16196f[_0x395e('0x1d')]?_0x16196f[_0x395e('0x1d')]:moment();var _0x3adce7=moment(_0x1c9dd9)[_0x395e('0x34')](_0x1756e3,_0x395e('0x26'));_0x2b798d({'ret':_0x3adce7[_0x395e('0x1e')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x2b798d({'ret':_0x1c9dd9});}else _0x2b798d({'ret':_0x1c9dd9});}else{_0x2b798d({'ret':_0x1c9dd9});}});}});return 0xa;}var _0x21f75b=function(_0x5c88a9){return new BPromise(function(_0x348428,_0x134968){_0x1bedb7(_0x5c88a9,_0x220f93)[_0x395e('0x24')](function(_0x3f7e4b){_0x220f93[_0x395e('0x1d')]=_0x3f7e4b['ret'];_0x492aa1[_0x395e('0x2a')][_0x395e('0x23')]({'where':{'phone':_0x220f93[_0x395e('0xd')],'CampaignId':_0x5c88a9['id']}})[_0x395e('0x24')](function(_0x1d34b0){if(!_[_0x395e('0x20')](_0x1d34b0)){throw new Error(_0x395e('0x28')+_0x220f93['phone']+_0x395e('0x35')+_0x5c88a9['id']);}return _0x492aa1[_0x395e('0x2a')][_0x395e('0x33')]({'phone':_0x220f93[_0x395e('0xd')],'ContactId':_0x220f93['id'],'ListId':_0x220f93[_0x395e('0x2b')],'priority':_0x220f93[_0x395e('0x2c')]?_0x220f93[_0x395e('0x2c')]:0x2,'scheduledat':_0x220f93[_0x395e('0x1d')]?_0x220f93[_0x395e('0x1d')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x220f93[_0x395e('0x2d')]?!![]:![],'callbackuniqueid':_0x220f93[_0x395e('0x2d')]?_0x220f93['callbackUniqueid']:undefined,'callbackat':_0x220f93[_0x395e('0x2d')]?moment()['format'](_0x395e('0x1f')):undefined,'CampaignId':_0x5c88a9['id']});})[_0x395e('0x2e')](function(_0x3df80d){_0x134968(_0x3df80d);});});});};var _0x210da9=function(_0x86bf6){return new BPromise(function(_0x1f5551,_0x4b0cc0){_0x1bedb7(_0x86bf6,_0x220f93)[_0x395e('0x24')](function(_0x489e62){_0x220f93[_0x395e('0x1d')]=_0x489e62[_0x395e('0x27')];_0x492aa1[_0x395e('0x2a')][_0x395e('0x23')]({'where':{'phone':_0x220f93['phone'],'CampaignId':_0x86bf6['id']}})[_0x395e('0x24')](function(_0x587c5a){if(!_['isNil'](_0x587c5a)){throw new Error('cmContact,\x20afterCreate\x20'+_0x220f93[_0x395e('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x86bf6['id']);}return _0x492aa1[_0x395e('0x30')][_0x395e('0x23')]({'where':{'calleridnum':_0x220f93[_0x395e('0xd')],'CampaignId':_0x86bf6['id']}});})['then'](function(_0x1531cb){if(!_[_0x395e('0x20')](_0x1531cb)){throw new Error(_0x395e('0x31')+_0x220f93[_0x395e('0xd')]+_0x395e('0x36')+_0x86bf6['id']);}return _0x492aa1[_0x395e('0x2a')][_0x395e('0x33')]({'phone':_0x220f93[_0x395e('0xd')],'ContactId':_0x220f93['id'],'ListId':_0x220f93[_0x395e('0x2b')],'priority':_0x220f93['priority']?_0x220f93['priority']:0x2,'scheduledat':_0x220f93['scheduledat']?_0x220f93[_0x395e('0x1d')]:moment()[_0x395e('0x1e')](_0x395e('0x1f')),'callback':_0x220f93['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x220f93[_0x395e('0x2d')]?_0x220f93['callbackUniqueid']:undefined,'callbackat':_0x220f93[_0x395e('0x2d')]?moment()[_0x395e('0x1e')](_0x395e('0x1f')):undefined,'CampaignId':_0x86bf6['id']});})[_0x395e('0x2e')](function(_0x5bdbd3){_0x4b0cc0(_0x5bdbd3);});});});};if(_0x220f93[_0x395e('0x2b')]){_0x492aa1[_0x395e('0x22')][_0x395e('0x37')]({'where':{'type':_0x395e('0x38')},'attributes':['id','dialCheckDuplicateType',_0x395e('0x21')],'include':[{'model':_0x492aa1['CmList'],'as':_0x395e('0x39'),'where':{'id':_0x220f93[_0x395e('0x2b')]}}]})['then'](function(_0x19b3c2){if(_0x19b3c2){var _0x3a2613=[];for(var _0x1c1e01=0x0,_0x39f624;_0x1c1e01<_0x19b3c2[_0x395e('0x3a')];_0x1c1e01+=0x1){_0x39f624=_0x19b3c2[_0x1c1e01][_0x395e('0x18')]({'plain':!![]});switch(_0x39f624[_0x395e('0x3b')]){case _0x395e('0x3c'):_0x3a8df2(_0x39f624)[_0x395e('0x2e')](_0x4a5b23());break;case'onlyIfOpen':_0x1ab9b8(_0x39f624)['catch'](_0x4a5b23());break;default:_0x1bedb7(_0x39f624,_0x220f93)[_0x395e('0x24')](function(_0x41f97c){_0x220f93[_0x395e('0x1d')]=_0x41f97c[_0x395e('0x27')];_0x492aa1[_0x395e('0x2a')]['create']({'phone':_0x220f93[_0x395e('0xd')],'ContactId':_0x220f93['id'],'ListId':_0x220f93[_0x395e('0x2b')],'scheduledat':_0x220f93[_0x395e('0x1d')]?_0x220f93[_0x395e('0x1d')]:moment()[_0x395e('0x1e')](_0x395e('0x1f')),'priority':_0x220f93[_0x395e('0x2c')]?_0x220f93[_0x395e('0x2c')]:0x2,'callback':_0x220f93[_0x395e('0x2d')]?!![]:![],'callbackuniqueid':_0x220f93[_0x395e('0x2d')]?_0x220f93['callbackUniqueid']:undefined,'callbackat':_0x220f93[_0x395e('0x2d')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x39f624['id']})[_0x395e('0x2e')](_0x4a5b23());});}}}})[_0x395e('0x24')](function(){return _0x492aa1[_0x395e('0x22')][_0x395e('0x37')]({'where':{'type':_0x395e('0x38')},'attributes':['id'],'include':[{'model':_0x492aa1[_0x395e('0x3d')],'as':'BlackLists','where':{'id':_0x220f93[_0x395e('0x2b')]}}]})[_0x395e('0x24')](function(_0x113b0d){if(_0x113b0d){var _0x2cbcb1=[];for(var _0x54cc11=0x0,_0x3b5355;_0x54cc11<_0x113b0d[_0x395e('0x3a')];_0x54cc11+=0x1){_0x3b5355=_0x113b0d[_0x54cc11][_0x395e('0x18')]({'plain':!![]});_0x492aa1['CmHopperBlack']['create']({'phone':_0x220f93[_0x395e('0xd')],'ContactId':_0x220f93['id'],'ListId':_0x220f93[_0x395e('0x2b')],'VoiceQueueId':_0x3b5355['id']})[_0x395e('0x2e')](function(_0x472cc0){logger['error'](_0x395e('0x3e'),_0x395e('0x1b'),_0x472cc0[_0x395e('0x3f')]);});}}});})[_0x395e('0x24')](function(){return _0x492aa1[_0x395e('0x40')]['findAll']({'attributes':['id',_0x395e('0x3b'),_0x395e('0x21')],'include':[{'model':_0x492aa1[_0x395e('0x3d')],'as':_0x395e('0x39'),'where':{'id':_0x220f93[_0x395e('0x2b')]}}]})['then'](function(_0x34d49f){if(_0x34d49f){var _0xeb7f=[];for(var _0x296cf5=0x0,_0x17a8be;_0x296cf5<_0x34d49f[_0x395e('0x3a')];_0x296cf5+=0x1){_0x17a8be=_0x34d49f[_0x296cf5]['get']({'plain':!![]});switch(_0x17a8be[_0x395e('0x3b')]){case _0x395e('0x3c'):_0x210da9(_0x17a8be)[_0x395e('0x2e')](_0x3d7cf7());break;case _0x395e('0x41'):_0x21f75b(_0x17a8be)['catch'](_0x3d7cf7());break;default:_0x492aa1['CmHopper'][_0x395e('0x33')]({'phone':_0x220f93[_0x395e('0xd')],'ContactId':_0x220f93['id'],'ListId':_0x220f93['ListId'],'scheduledat':_0x220f93[_0x395e('0x1d')]?_0x220f93['scheduledat']:moment()['format'](_0x395e('0x1f')),'priority':_0x220f93[_0x395e('0x2c')]?_0x220f93[_0x395e('0x2c')]:0x2,'callback':_0x220f93[_0x395e('0x2d')]?!![]:![],'callbackuniqueid':_0x220f93[_0x395e('0x2d')]?_0x220f93[_0x395e('0x2d')]:undefined,'callbackat':_0x220f93[_0x395e('0x2d')]?moment()[_0x395e('0x1e')](_0x395e('0x1f')):undefined,'CampaignId':_0x17a8be['id']})['catch'](_0x3d7cf7());}}}});})[_0x395e('0x24')](function(){return _0x492aa1[_0x395e('0x40')][_0x395e('0x37')]({'attributes':['id'],'include':[{'model':_0x492aa1[_0x395e('0x3d')],'as':_0x395e('0x42'),'where':{'id':_0x220f93['ListId']}}]})[_0x395e('0x24')](function(_0x42a2d7){if(_0x42a2d7){var _0x11d3dd=[];for(var _0x39d7f1=0x0,_0x496991;_0x39d7f1<_0x42a2d7[_0x395e('0x3a')];_0x39d7f1+=0x1){_0x496991=_0x42a2d7[_0x39d7f1][_0x395e('0x18')]({'plain':!![]});_0x492aa1[_0x395e('0x43')][_0x395e('0x33')]({'phone':_0x220f93[_0x395e('0xd')],'ContactId':_0x220f93['id'],'ListId':_0x220f93[_0x395e('0x2b')],'CampaignId':_0x496991['id']})[_0x395e('0x2e')](function(_0x1b6407){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0x1b6407['message']);});}}});})['then'](function(){_0x47a45f();})['catch'](function(_0x4ad6cf){logger[_0x395e('0x19')]('cmContact,\x20%s,\x20%s',_0x395e('0x1b'),_0x4ad6cf[_0x395e('0x3f')]);_0x47a45f(_0x4ad6cf);});}else{_0x47a45f(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0xebb06f,_0x35d6a5,_0xd5b9eb){var _0x36ddac=_0x1067ee['models'];var _0x416ebc=_0xebb06f['get']({'plain':!![]});return _0x36ddac['CmHopper'][_0x395e('0x37')]({'raw':!![],'where':{'ListId':_0x416ebc[_0x395e('0x2b')],'ContactId':_0x416ebc['id']}})[_0x395e('0x24')](function(_0x4e5ab5){if(!_[_0x395e('0x44')](_0x4e5ab5)){var _0x100302=[];for(var _0x3d0839=0x0;_0x3d0839<_0x4e5ab5['length'];_0x3d0839+=0x1){var _0x120c0c=_0x36ddac['CmHopper'][_0x395e('0x45')]({'where':{'ListId':_0x4e5ab5[_0x3d0839][_0x395e('0x2b')],'ContactId':_0x4e5ab5[_0x3d0839][_0x395e('0x46')],'VoiceQueueId':_0x4e5ab5[_0x3d0839][_0x395e('0x47')],'CampaignId':_0x4e5ab5[_0x3d0839][_0x395e('0x48')]}});_0x100302[_0x395e('0x49')](_0x120c0c);}return BPromise[_0x395e('0x4a')](_0x100302);}})[_0x395e('0x24')](function(_0x4d0279){logger[_0x395e('0x4b')]('[CmContact][afterDestroy][Succesfull]',util[_0x395e('0x1c')](_0x4d0279,{'showHidden':![],'depth':null}));_0xd5b9eb();})[_0x395e('0x2e')](function(_0x3c87e3){logger['error'](_0x395e('0x4c'),util['inspect'](_0x3c87e3,{'showHidden':![],'depth':null}));_0xd5b9eb(_0x3c87e3);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 8613670..182c40a 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(_0x45c32f,_0x12978f){var _0x1920c2=function(_0x481b22){while(--_0x481b22){_0x45c32f['push'](_0x45c32f['shift']());}};_0x1920c2(++_0x12978f);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x18519a,_0x3b7830){var _0x190a68=function(_0x3306e6){while(--_0x3306e6){_0x18519a['push'](_0x18519a['shift']());}};_0x190a68(++_0x3b7830);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 79efabd..b4e33d4 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 _0x1da1=['sequelize','exports','INTEGER','STRING'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x1da1,0x1a4));var _0x11da=function(_0x38ca85,_0x346988){_0x38ca85=_0x38ca85-0x0;var _0x7dadb8=_0x1da1[_0x38ca85];return _0x7dadb8;};'use strict';var Sequelize=require(_0x11da('0x0'));module[_0x11da('0x1')]={'CmContactId':{'type':Sequelize[_0x11da('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x11da('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x11da('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x11da('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x11da('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x5178=['exports','INTEGER','STRING'];(function(_0x3aa5cf,_0x4879b3){var _0x22854a=function(_0x3e8a49){while(--_0x3e8a49){_0x3aa5cf['push'](_0x3aa5cf['shift']());}};_0x22854a(++_0x4879b3);}(_0x5178,0x171));var _0x8517=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5178[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x8517('0x0')]={'CmContactId':{'type':Sequelize[_0x8517('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x8517('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x8517('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x8517('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x8517('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index ba63c7a..1ddfa17 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 _0xe7fe=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user'];(function(_0x5eacd5,_0x42a288){var _0x9ecc1=function(_0x1e9f45){while(--_0x1e9f45){_0x5eacd5['push'](_0x5eacd5['shift']());}};_0x9ecc1(++_0x42a288);}(_0xe7fe,0x18c));var _0xee7f=function(_0xfb6d9d,_0x1b5d85){_0xfb6d9d=_0xfb6d9d-0x0;var _0x1102f3=_0xe7fe[_0xfb6d9d];return _0x1102f3;};'use strict';var emlformat=require(_0xee7f('0x0'));var rimraf=require(_0xee7f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee7f('0x2'));var rp=require(_0xee7f('0x3'));var moment=require('moment');var BPromise=require(_0xee7f('0x4'));var Mustache=require('mustache');var util=require(_0xee7f('0x5'));var path=require(_0xee7f('0x6'));var sox=require(_0xee7f('0x7'));var csv=require(_0xee7f('0x8'));var ejs=require(_0xee7f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee7f('0xa'));var squel=require(_0xee7f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xee7f('0xc'));var toCsv=require(_0xee7f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xee7f('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7f('0xe'))('api');var utils=require(_0xee7f('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xee7f('0x10'));var db=require(_0xee7f('0x11'))['db'];function respondWithStatusCode(_0x1e6dde,_0x675b88){_0x675b88=_0x675b88||0xcc;return function(_0x56da7d){if(_0x56da7d){return _0x1e6dde[_0xee7f('0x12')](_0x675b88);}return _0x1e6dde['status'](_0x675b88)[_0xee7f('0x13')]();};}function respondWithResult(_0x45391f,_0xea90d6){_0xea90d6=_0xea90d6||0xc8;return function(_0x160a88){if(_0x160a88){return _0x45391f[_0xee7f('0x14')](_0xea90d6)[_0xee7f('0x15')](_0x160a88);}};}function respondWithFilteredResult(_0xcefd0e,_0x38f918){return function(_0x2a5971){if(_0x2a5971){var _0x5a9a0e=typeof _0x38f918[_0xee7f('0x16')]===_0xee7f('0x17')&&typeof _0x38f918[_0xee7f('0x18')]==='undefined';var _0x494ada=_0x2a5971[_0xee7f('0x19')];var _0x389443=_0x5a9a0e?0x0:_0x38f918['offset'];var _0x33e183=_0x5a9a0e?_0x2a5971[_0xee7f('0x19')]:_0x38f918['offset']+_0x38f918['limit'];var _0x5e4eee;if(_0x33e183>=_0x494ada){_0x33e183=_0x494ada;_0x5e4eee=0xc8;}else{_0x5e4eee=0xce;}_0xcefd0e[_0xee7f('0x14')](_0x5e4eee);return _0xcefd0e[_0xee7f('0x1a')](_0xee7f('0x1b'),_0x389443+'-'+_0x33e183+'/'+_0x494ada)[_0xee7f('0x15')](_0x2a5971);}return null;};}function patchUpdates(_0x2c5da4){return function(_0x7165dd){try{jsonpatch['apply'](_0x7165dd,_0x2c5da4,!![]);}catch(_0x234fa8){return BPromise[_0xee7f('0x1c')](_0x234fa8);}return _0x7165dd['save']();};}function saveUpdates(_0x1ba53f,_0x1d2fa3){return function(_0x1bfee1){if(_0x1bfee1){return _0x1bfee1[_0xee7f('0x1d')](_0x1ba53f)[_0xee7f('0x1e')](function(_0x19475b){return _0x19475b;});}return null;};}function removeEntity(_0x28d69c,_0x418e09){return function(_0x3fe847){if(_0x3fe847){return _0x3fe847[_0xee7f('0x1f')]()['then'](function(){var _0x161e1a=_0x3fe847[_0xee7f('0x20')]({'plain':!![]});var _0x2a26c2=_0xee7f('0x21');return db[_0xee7f('0x22')][_0xee7f('0x1f')]({'where':{'type':_0x2a26c2,'resourceId':_0x161e1a['id']}})[_0xee7f('0x1e')](function(){return _0x3fe847;});})[_0xee7f('0x1e')](function(){_0x28d69c[_0xee7f('0x14')](0xcc)[_0xee7f('0x13')]();});}};}function handleEntityNotFound(_0x5c7677,_0x1580d5){return function(_0x405d75){if(!_0x405d75){_0x5c7677[_0xee7f('0x12')](0x194);}return _0x405d75;};}function handleError(_0x5d639d,_0x9488a4){_0x9488a4=_0x9488a4||0x1f4;return function(_0x2b356b){logger[_0xee7f('0x23')](_0x2b356b[_0xee7f('0x24')]);if(_0x2b356b[_0xee7f('0x25')]){delete _0x2b356b[_0xee7f('0x25')];}_0x5d639d[_0xee7f('0x14')](_0x9488a4)['send'](_0x2b356b);};}exports[_0xee7f('0x26')]=function(_0x4060c0,_0x32da03){var _0x3274f3={},_0x18ee8c={},_0x14554f={'count':0x0,'rows':[]};var _0x55a62c=_[_0xee7f('0x27')](db[_0xee7f('0x28')][_0xee7f('0x29')],function(_0x5b8409){return{'name':_0x5b8409[_0xee7f('0x2a')],'type':_0x5b8409[_0xee7f('0x2b')][_0xee7f('0x2c')]};});_0x18ee8c[_0xee7f('0x2d')]=_[_0xee7f('0x27')](_0x55a62c,_0xee7f('0x25'));_0x18ee8c[_0xee7f('0x2e')]=_['keys'](_0x4060c0['query']);_0x18ee8c[_0xee7f('0x2f')]=_[_0xee7f('0x30')](_0x18ee8c['model'],_0x18ee8c[_0xee7f('0x2e')]);_0x3274f3[_0xee7f('0x31')]=_[_0xee7f('0x30')](_0x18ee8c['model'],qs[_0xee7f('0x32')](_0x4060c0[_0xee7f('0x2e')]['fields']));_0x3274f3[_0xee7f('0x31')]=_0x3274f3['attributes'][_0xee7f('0x33')]?_0x3274f3[_0xee7f('0x31')]:_0x18ee8c[_0xee7f('0x2d')];if(!_0x4060c0['query'][_0xee7f('0x34')]('nolimit')){_0x3274f3[_0xee7f('0x18')]=qs['limit'](_0x4060c0['query'][_0xee7f('0x18')]);_0x3274f3[_0xee7f('0x16')]=qs[_0xee7f('0x16')](_0x4060c0[_0xee7f('0x2e')][_0xee7f('0x16')]);}_0x3274f3[_0xee7f('0x35')]=qs['sort'](_0x4060c0['query'][_0xee7f('0x36')]);_0x3274f3[_0xee7f('0x37')]=qs['filters'](_[_0xee7f('0x38')](_0x4060c0[_0xee7f('0x2e')],_0x18ee8c['filters']),_0x55a62c);if(_0x4060c0[_0xee7f('0x2e')][_0xee7f('0x39')]){_0x3274f3[_0xee7f('0x37')]=_[_0xee7f('0x3a')](_0x3274f3[_0xee7f('0x37')],{'$or':_['map'](_0x55a62c,function(_0x546ba6){if(_0x546ba6['type']!==_0xee7f('0x3b')){var _0x3118c9={};_0x3118c9[_0x546ba6['name']]={'$like':'%'+_0x4060c0[_0xee7f('0x2e')][_0xee7f('0x39')]+'%'};return _0x3118c9;}})});}_0x3274f3=_[_0xee7f('0x3a')]({},_0x3274f3,_0x4060c0[_0xee7f('0x3c')]);var _0x3c2e92={'where':_0x3274f3[_0xee7f('0x37')]};return db['CmContactHasItem'][_0xee7f('0x19')](_0x3c2e92)[_0xee7f('0x1e')](function(_0xc43597){_0x14554f[_0xee7f('0x19')]=_0xc43597;if(_0x4060c0[_0xee7f('0x2e')][_0xee7f('0x3d')]){_0x3274f3[_0xee7f('0x3e')]=[{'all':!![]}];}return db[_0xee7f('0x28')][_0xee7f('0x3f')](_0x3274f3);})['then'](function(_0x3e57ca){_0x14554f['rows']=_0x3e57ca;return _0x14554f;})['then'](respondWithFilteredResult(_0x32da03,_0x3274f3))[_0xee7f('0x40')](handleError(_0x32da03,null));};exports[_0xee7f('0x41')]=function(_0x1fc3a1,_0xfca451){var _0x1f4640={'raw':!![],'where':{'id':_0x1fc3a1[_0xee7f('0x42')]['id']}},_0x3c3075={};_0x3c3075[_0xee7f('0x2d')]=_[_0xee7f('0x43')](db[_0xee7f('0x28')][_0xee7f('0x29')]);_0x3c3075[_0xee7f('0x2e')]=_[_0xee7f('0x43')](_0x1fc3a1[_0xee7f('0x2e')]);_0x3c3075[_0xee7f('0x2f')]=_['intersection'](_0x3c3075[_0xee7f('0x2d')],_0x3c3075[_0xee7f('0x2e')]);_0x1f4640['attributes']=_['intersection'](_0x3c3075['model'],qs[_0xee7f('0x32')](_0x1fc3a1['query'][_0xee7f('0x32')]));_0x1f4640[_0xee7f('0x31')]=_0x1f4640[_0xee7f('0x31')]['length']?_0x1f4640[_0xee7f('0x31')]:_0x3c3075[_0xee7f('0x2d')];if(_0x1fc3a1[_0xee7f('0x2e')][_0xee7f('0x3d')]){_0x1f4640[_0xee7f('0x3e')]=[{'all':!![]}];}_0x1f4640=_['merge']({},_0x1f4640,_0x1fc3a1['options']);return db[_0xee7f('0x28')][_0xee7f('0x44')](_0x1f4640)[_0xee7f('0x1e')](handleEntityNotFound(_0xfca451,null))[_0xee7f('0x1e')](respondWithResult(_0xfca451,null))['catch'](handleError(_0xfca451,null));};exports['create']=function(_0xf7353,_0x201950){return db[_0xee7f('0x28')][_0xee7f('0x45')](_0xf7353[_0xee7f('0x46')],{})[_0xee7f('0x1e')](function(_0x3ffe93){var _0x31b1d9=_0xf7353[_0xee7f('0x47')]['get']({'plain':!![]});if(!_0x31b1d9)throw new Error(_0xee7f('0x48'));if(_0x31b1d9[_0xee7f('0x49')]==='user'){var _0x600bb3=_0x3ffe93[_0xee7f('0x20')]({'plain':!![]});var _0x2a0c81='CmContactHasItems';return db[_0xee7f('0x4a')]['find']({'where':{'name':_0x2a0c81,'userProfileId':_0x31b1d9[_0xee7f('0x4b')]},'raw':!![]})['then'](function(_0x6cc605){if(_0x6cc605&&_0x6cc605[_0xee7f('0x4c')]===0x0){return db[_0xee7f('0x22')][_0xee7f('0x45')]({'name':_0x600bb3['name'],'resourceId':_0x600bb3['id'],'type':_0x6cc605[_0xee7f('0x25')],'sectionId':_0x6cc605['id']},{})[_0xee7f('0x1e')](function(){return _0x3ffe93;});}else{return _0x3ffe93;}})['catch'](function(_0xd05b0b){logger['error'](_0xee7f('0x4d'),_0xd05b0b);throw _0xd05b0b;});}return _0x3ffe93;})[_0xee7f('0x1e')](respondWithResult(_0x201950,0xc9))['catch'](handleError(_0x201950,null));};exports['update']=function(_0x2a3f3f,_0x22effc){if(_0x2a3f3f[_0xee7f('0x46')]['id']){delete _0x2a3f3f[_0xee7f('0x46')]['id'];}return db[_0xee7f('0x28')][_0xee7f('0x44')]({'where':{'id':_0x2a3f3f['params']['id']}})[_0xee7f('0x1e')](handleEntityNotFound(_0x22effc,null))[_0xee7f('0x1e')](saveUpdates(_0x2a3f3f[_0xee7f('0x46')],null))[_0xee7f('0x1e')](respondWithResult(_0x22effc,null))[_0xee7f('0x40')](handleError(_0x22effc,null));};exports[_0xee7f('0x1f')]=function(_0x2c6c54,_0x36ce8f){return db[_0xee7f('0x28')][_0xee7f('0x44')]({'where':{'id':_0x2c6c54[_0xee7f('0x42')]['id']}})['then'](handleEntityNotFound(_0x36ce8f,null))[_0xee7f('0x1e')](removeEntity(_0x36ce8f,null))[_0xee7f('0x40')](handleError(_0x36ce8f,null));}; \ No newline at end of file +var _0x069f=['filter','merge','VIRTUAL','includeAll','rows','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','get','UserProfileResource','destroy','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick'];(function(_0x2ebdde,_0x2df0f8){var _0x57a4aa=function(_0x1f7e76){while(--_0x1f7e76){_0x2ebdde['push'](_0x2ebdde['shift']());}};_0x57a4aa(++_0x2df0f8);}(_0x069f,0xbd));var _0xf069=function(_0x58ef68,_0x275204){_0x58ef68=_0x58ef68-0x0;var _0x169a7f=_0x069f[_0x58ef68];return _0x169a7f;};'use strict';var emlformat=require(_0xf069('0x0'));var rimraf=require(_0xf069('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf069('0x2'));var rp=require(_0xf069('0x3'));var moment=require(_0xf069('0x4'));var BPromise=require(_0xf069('0x5'));var Mustache=require(_0xf069('0x6'));var util=require(_0xf069('0x7'));var path=require(_0xf069('0x8'));var sox=require('sox');var csv=require(_0xf069('0x9'));var ejs=require(_0xf069('0xa'));var fs=require('fs');var fs_extra=require(_0xf069('0xb'));var _=require(_0xf069('0xc'));var squel=require(_0xf069('0xd'));var crypto=require(_0xf069('0xe'));var jsforce=require(_0xf069('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf069('0x10'));var Papa=require(_0xf069('0x11'));var Redis=require(_0xf069('0x12'));var authService=require(_0xf069('0x13'));var qs=require(_0xf069('0x14'));var as=require(_0xf069('0x15'));var hardwareService=require(_0xf069('0x16'));var logger=require('../../config/logger')(_0xf069('0x17'));var utils=require(_0xf069('0x18'));var config=require(_0xf069('0x19'));var licenseUtil=require(_0xf069('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2da928,_0x1a2324){_0x1a2324=_0x1a2324||0xcc;return function(_0x42df37){if(_0x42df37){return _0x2da928[_0xf069('0x1b')](_0x1a2324);}return _0x2da928[_0xf069('0x1c')](_0x1a2324)[_0xf069('0x1d')]();};}function respondWithResult(_0x1fc3e6,_0x2d76d0){_0x2d76d0=_0x2d76d0||0xc8;return function(_0x2fcf0b){if(_0x2fcf0b){return _0x1fc3e6[_0xf069('0x1c')](_0x2d76d0)['json'](_0x2fcf0b);}};}function respondWithFilteredResult(_0xf2e11e,_0x51a1bb){return function(_0x17dd85){if(_0x17dd85){var _0x12d0db=typeof _0x51a1bb[_0xf069('0x1e')]===_0xf069('0x1f')&&typeof _0x51a1bb['limit']==='undefined';var _0x19d021=_0x17dd85[_0xf069('0x20')];var _0x28b00=_0x12d0db?0x0:_0x51a1bb[_0xf069('0x1e')];var _0x1d364b=_0x12d0db?_0x17dd85['count']:_0x51a1bb[_0xf069('0x1e')]+_0x51a1bb[_0xf069('0x21')];var _0x4b258b;if(_0x1d364b>=_0x19d021){_0x1d364b=_0x19d021;_0x4b258b=0xc8;}else{_0x4b258b=0xce;}_0xf2e11e[_0xf069('0x1c')](_0x4b258b);return _0xf2e11e[_0xf069('0x22')](_0xf069('0x23'),_0x28b00+'-'+_0x1d364b+'/'+_0x19d021)[_0xf069('0x24')](_0x17dd85);}return null;};}function patchUpdates(_0x3485ca){return function(_0x56294b){try{jsonpatch['apply'](_0x56294b,_0x3485ca,!![]);}catch(_0x485e39){return BPromise[_0xf069('0x25')](_0x485e39);}return _0x56294b[_0xf069('0x26')]();};}function saveUpdates(_0x1bf4f5,_0x48a36e){return function(_0x2608ec){if(_0x2608ec){return _0x2608ec['update'](_0x1bf4f5)[_0xf069('0x27')](function(_0x319a3f){return _0x319a3f;});}return null;};}function removeEntity(_0x17009c,_0x5a9839){return function(_0x2df609){if(_0x2df609){return _0x2df609['destroy']()[_0xf069('0x27')](function(){var _0x210614=_0x2df609[_0xf069('0x28')]({'plain':!![]});var _0x18c72c='CmContactHasItems';return db[_0xf069('0x29')][_0xf069('0x2a')]({'where':{'type':_0x18c72c,'resourceId':_0x210614['id']}})['then'](function(){return _0x2df609;});})[_0xf069('0x27')](function(){_0x17009c[_0xf069('0x1c')](0xcc)[_0xf069('0x1d')]();});}};}function handleEntityNotFound(_0x1b73e4,_0x5003ce){return function(_0x228cbd){if(!_0x228cbd){_0x1b73e4['sendStatus'](0x194);}return _0x228cbd;};}function handleError(_0x4305e7,_0x39cbd9){_0x39cbd9=_0x39cbd9||0x1f4;return function(_0x410b67){logger['error'](_0x410b67[_0xf069('0x2b')]);if(_0x410b67[_0xf069('0x2c')]){delete _0x410b67[_0xf069('0x2c')];}_0x4305e7['status'](_0x39cbd9)[_0xf069('0x2d')](_0x410b67);};}exports[_0xf069('0x2e')]=function(_0x7834a8,_0x2806b9){var _0x4e66a6={},_0x102560={},_0x30af78={'count':0x0,'rows':[]};var _0x36035b=_[_0xf069('0x2f')](db[_0xf069('0x30')][_0xf069('0x31')],function(_0x58a60f){return{'name':_0x58a60f[_0xf069('0x32')],'type':_0x58a60f[_0xf069('0x33')][_0xf069('0x34')]};});_0x102560[_0xf069('0x35')]=_[_0xf069('0x2f')](_0x36035b,_0xf069('0x2c'));_0x102560['query']=_[_0xf069('0x36')](_0x7834a8[_0xf069('0x37')]);_0x102560['filters']=_[_0xf069('0x38')](_0x102560[_0xf069('0x35')],_0x102560[_0xf069('0x37')]);_0x4e66a6[_0xf069('0x39')]=_[_0xf069('0x38')](_0x102560[_0xf069('0x35')],qs[_0xf069('0x3a')](_0x7834a8[_0xf069('0x37')][_0xf069('0x3a')]));_0x4e66a6['attributes']=_0x4e66a6[_0xf069('0x39')][_0xf069('0x3b')]?_0x4e66a6['attributes']:_0x102560[_0xf069('0x35')];if(!_0x7834a8[_0xf069('0x37')][_0xf069('0x3c')](_0xf069('0x3d'))){_0x4e66a6[_0xf069('0x21')]=qs[_0xf069('0x21')](_0x7834a8[_0xf069('0x37')][_0xf069('0x21')]);_0x4e66a6[_0xf069('0x1e')]=qs[_0xf069('0x1e')](_0x7834a8[_0xf069('0x37')][_0xf069('0x1e')]);}_0x4e66a6['order']=qs[_0xf069('0x3e')](_0x7834a8['query'][_0xf069('0x3e')]);_0x4e66a6[_0xf069('0x3f')]=qs[_0xf069('0x40')](_[_0xf069('0x41')](_0x7834a8[_0xf069('0x37')],_0x102560[_0xf069('0x40')]),_0x36035b);if(_0x7834a8[_0xf069('0x37')][_0xf069('0x42')]){_0x4e66a6['where']=_[_0xf069('0x43')](_0x4e66a6[_0xf069('0x3f')],{'$or':_['map'](_0x36035b,function(_0x3bb0f4){if(_0x3bb0f4[_0xf069('0x33')]!==_0xf069('0x44')){var _0x400196={};_0x400196[_0x3bb0f4['name']]={'$like':'%'+_0x7834a8[_0xf069('0x37')][_0xf069('0x42')]+'%'};return _0x400196;}})});}_0x4e66a6=_[_0xf069('0x43')]({},_0x4e66a6,_0x7834a8['options']);var _0x4dc069={'where':_0x4e66a6[_0xf069('0x3f')]};return db[_0xf069('0x30')][_0xf069('0x20')](_0x4dc069)[_0xf069('0x27')](function(_0x21f334){_0x30af78[_0xf069('0x20')]=_0x21f334;if(_0x7834a8[_0xf069('0x37')][_0xf069('0x45')]){_0x4e66a6['include']=[{'all':!![]}];}return db['CmContactHasItem']['findAll'](_0x4e66a6);})['then'](function(_0x533c77){_0x30af78[_0xf069('0x46')]=_0x533c77;return _0x30af78;})['then'](respondWithFilteredResult(_0x2806b9,_0x4e66a6))['catch'](handleError(_0x2806b9,null));};exports['show']=function(_0x345015,_0x437070){var _0x286f47={'raw':!![],'where':{'id':_0x345015['params']['id']}},_0x3dc96a={};_0x3dc96a[_0xf069('0x35')]=_[_0xf069('0x36')](db[_0xf069('0x30')][_0xf069('0x31')]);_0x3dc96a['query']=_[_0xf069('0x36')](_0x345015[_0xf069('0x37')]);_0x3dc96a[_0xf069('0x40')]=_[_0xf069('0x38')](_0x3dc96a[_0xf069('0x35')],_0x3dc96a[_0xf069('0x37')]);_0x286f47[_0xf069('0x39')]=_[_0xf069('0x38')](_0x3dc96a[_0xf069('0x35')],qs['fields'](_0x345015[_0xf069('0x37')][_0xf069('0x3a')]));_0x286f47[_0xf069('0x39')]=_0x286f47[_0xf069('0x39')][_0xf069('0x3b')]?_0x286f47[_0xf069('0x39')]:_0x3dc96a[_0xf069('0x35')];if(_0x345015[_0xf069('0x37')][_0xf069('0x45')]){_0x286f47['include']=[{'all':!![]}];}_0x286f47=_[_0xf069('0x43')]({},_0x286f47,_0x345015[_0xf069('0x47')]);return db[_0xf069('0x30')][_0xf069('0x48')](_0x286f47)['then'](handleEntityNotFound(_0x437070,null))[_0xf069('0x27')](respondWithResult(_0x437070,null))[_0xf069('0x49')](handleError(_0x437070,null));};exports[_0xf069('0x4a')]=function(_0xbc6942,_0x44f16a){return db[_0xf069('0x30')][_0xf069('0x4a')](_0xbc6942[_0xf069('0x4b')],{})[_0xf069('0x27')](function(_0xd15022){var _0x333cf2=_0xbc6942[_0xf069('0x4c')]['get']({'plain':!![]});if(!_0x333cf2)throw new Error(_0xf069('0x4d'));if(_0x333cf2[_0xf069('0x4e')]===_0xf069('0x4c')){var _0xb6903d=_0xd15022[_0xf069('0x28')]({'plain':!![]});var _0x657174='CmContactHasItems';return db[_0xf069('0x4f')][_0xf069('0x48')]({'where':{'name':_0x657174,'userProfileId':_0x333cf2[_0xf069('0x50')]},'raw':!![]})[_0xf069('0x27')](function(_0x50010f){if(_0x50010f&&_0x50010f[_0xf069('0x51')]===0x0){return db[_0xf069('0x29')][_0xf069('0x4a')]({'name':_0xb6903d['name'],'resourceId':_0xb6903d['id'],'type':_0x50010f['name'],'sectionId':_0x50010f['id']},{})[_0xf069('0x27')](function(){return _0xd15022;});}else{return _0xd15022;}})['catch'](function(_0x14a2ac){logger[_0xf069('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14a2ac);throw _0x14a2ac;});}return _0xd15022;})[_0xf069('0x27')](respondWithResult(_0x44f16a,0xc9))[_0xf069('0x49')](handleError(_0x44f16a,null));};exports[_0xf069('0x53')]=function(_0x30297e,_0x352133){if(_0x30297e['body']['id']){delete _0x30297e[_0xf069('0x4b')]['id'];}return db['CmContactHasItem'][_0xf069('0x48')]({'where':{'id':_0x30297e[_0xf069('0x54')]['id']}})[_0xf069('0x27')](handleEntityNotFound(_0x352133,null))[_0xf069('0x27')](saveUpdates(_0x30297e['body'],null))['then'](respondWithResult(_0x352133,null))['catch'](handleError(_0x352133,null));};exports[_0xf069('0x2a')]=function(_0x145764,_0x2695e9){return db[_0xf069('0x30')][_0xf069('0x48')]({'where':{'id':_0x145764[_0xf069('0x54')]['id']}})[_0xf069('0x27')](handleEntityNotFound(_0x2695e9,null))[_0xf069('0x27')](removeEntity(_0x2695e9,null))['catch'](handleError(_0x2695e9,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 60fd43b..34c60a7 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 _0x605f=['moment','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','util','../../config/logger','api'];(function(_0x21c7ef,_0x255e1d){var _0x567df9=function(_0x17d772){while(--_0x17d772){_0x21c7ef['push'](_0x21c7ef['shift']());}};_0x567df9(++_0x255e1d);}(_0x605f,0xbd));var _0xf605=function(_0xc42052,_0x22e266){_0xc42052=_0xc42052-0x0;var _0x5e1222=_0x605f[_0xc42052];return _0x5e1222;};'use strict';var _=require('lodash');var util=require(_0xf605('0x0'));var logger=require(_0xf605('0x1'))(_0xf605('0x2'));var moment=require(_0xf605('0x3'));var BPromise=require(_0xf605('0x4'));var rp=require(_0xf605('0x5'));var fs=require('fs');var path=require(_0xf605('0x6'));var rimraf=require('rimraf');var config=require(_0xf605('0x7'));var attributes=require(_0xf605('0x8'));module[_0xf605('0x9')]=function(_0x147bf7,_0x3d5d31){return _0x147bf7['define'](_0xf605('0xa'),attributes,{'tableName':_0xf605('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x113a=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','cm_contact_has_items'];(function(_0x4370ab,_0x1c82b9){var _0x5c71b4=function(_0x56cf30){while(--_0x56cf30){_0x4370ab['push'](_0x4370ab['shift']());}};_0x5c71b4(++_0x1c82b9);}(_0x113a,0x114));var _0xa113=function(_0x2ed7dd,_0x12f0cb){_0x2ed7dd=_0x2ed7dd-0x0;var _0x2058dc=_0x113a[_0x2ed7dd];return _0x2058dc;};'use strict';var _=require(_0xa113('0x0'));var util=require(_0xa113('0x1'));var logger=require(_0xa113('0x2'))(_0xa113('0x3'));var moment=require('moment');var BPromise=require(_0xa113('0x4'));var rp=require(_0xa113('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa113('0x6'));var config=require(_0xa113('0x7'));var attributes=require(_0xa113('0x8'));module[_0xa113('0x9')]=function(_0x2df058,_0x2aa48b){return _0x2df058[_0xa113('0xa')]('CmContactHasItem',attributes,{'tableName':_0xa113('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 37cd4c3..e74b484 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 _0x2a5c=['then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2a5c,0x1bf));var _0xc2a5=function(_0x115527,_0x23b693){_0x115527=_0x115527-0x0;var _0x49bd2a=_0x2a5c[_0x115527];return _0x49bd2a;};'use strict';var _=require(_0xc2a5('0x0'));var util=require(_0xc2a5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc2a5('0x2'));var fs=require('fs');var Redis=require(_0xc2a5('0x3'));var db=require(_0xc2a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2a5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc2a5('0x6')][_0xc2a5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x218a6f,_0x4b1c82,_0x59f44e){return new BPromise(function(_0x1da263,_0xf78d55){return client[_0xc2a5('0x8')](_0x218a6f,_0x59f44e)[_0xc2a5('0x9')](function(_0x35e1ee){logger['info'](_0xc2a5('0xa'),_0x4b1c82,_0xc2a5('0xb'));logger[_0xc2a5('0xc')](_0xc2a5('0xd'),_0x4b1c82,'request\x20sent',JSON['stringify'](_0x35e1ee));if(_0x35e1ee['error']){if(_0x35e1ee[_0xc2a5('0xe')][_0xc2a5('0xf')]===0x1f4){logger[_0xc2a5('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x4b1c82,_0x35e1ee[_0xc2a5('0xe')]['message']);return _0xf78d55(_0x35e1ee[_0xc2a5('0xe')]['message']);}logger[_0xc2a5('0xe')](_0xc2a5('0xa'),_0x4b1c82,_0x35e1ee[_0xc2a5('0xe')][_0xc2a5('0x10')]);return _0x1da263(_0x35e1ee[_0xc2a5('0xe')][_0xc2a5('0x10')]);}else{logger[_0xc2a5('0x11')](_0xc2a5('0xa'),_0x4b1c82,'request\x20sent');_0x1da263(_0x35e1ee[_0xc2a5('0x12')]['message']);}})['catch'](function(_0x416a84){logger[_0xc2a5('0xe')](_0xc2a5('0xa'),_0x4b1c82,_0x416a84);_0xf78d55(_0x416a84);});});} \ No newline at end of file +var _0x6ac1=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','error','message','result'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0x6ac1,0x8b));var _0x16ac=function(_0x49a3a5,_0x5a8caf){_0x49a3a5=_0x49a3a5-0x0;var _0xf6b7fb=_0x6ac1[_0x49a3a5];return _0xf6b7fb;};'use strict';var _=require(_0x16ac('0x0'));var util=require(_0x16ac('0x1'));var moment=require(_0x16ac('0x2'));var BPromise=require(_0x16ac('0x3'));var rs=require(_0x16ac('0x4'));var fs=require('fs');var Redis=require(_0x16ac('0x5'));var db=require(_0x16ac('0x6'))['db'];var utils=require(_0x16ac('0x7'));var logger=require(_0x16ac('0x8'))(_0x16ac('0x9'));var config=require(_0x16ac('0xa'));var jayson=require(_0x16ac('0xb'));var client=jayson[_0x16ac('0xc')][_0x16ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x339cde,_0x4b6ca8,_0x33bce5){return new BPromise(function(_0x33f69d,_0xf85a23){return client[_0x16ac('0xe')](_0x339cde,_0x33bce5)[_0x16ac('0xf')](function(_0x52a5d3){logger['info'](_0x16ac('0x10'),_0x4b6ca8,_0x16ac('0x11'));logger[_0x16ac('0x12')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x4b6ca8,_0x16ac('0x11'),JSON['stringify'](_0x52a5d3));if(_0x52a5d3[_0x16ac('0x13')]){if(_0x52a5d3[_0x16ac('0x13')]['code']===0x1f4){logger[_0x16ac('0x13')](_0x16ac('0x10'),_0x4b6ca8,_0x52a5d3['error']['message']);return _0xf85a23(_0x52a5d3['error'][_0x16ac('0x14')]);}logger['error'](_0x16ac('0x10'),_0x4b6ca8,_0x52a5d3[_0x16ac('0x13')][_0x16ac('0x14')]);return _0x33f69d(_0x52a5d3['error'][_0x16ac('0x14')]);}else{logger['info'](_0x16ac('0x10'),_0x4b6ca8,_0x16ac('0x11'));_0x33f69d(_0x52a5d3[_0x16ac('0x15')][_0x16ac('0x14')]);}})[_0x16ac('0x16')](function(_0x25603e){logger[_0x16ac('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x4b6ca8,_0x25603e);_0xf85a23(_0x25603e);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 8557fe7..cd77c9c 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 _0xd2fa=['show','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','index','/:id','isAuthenticated'];(function(_0x367d25,_0x11e20c){var _0x486919=function(_0x48b25c){while(--_0x48b25c){_0x367d25['push'](_0x367d25['shift']());}};_0x486919(++_0x11e20c);}(_0xd2fa,0x16e));var _0xad2f=function(_0x393a95,_0x5d8e38){_0x393a95=_0x393a95-0x0;var _0x4e3f31=_0xd2fa[_0x393a95];return _0x4e3f31;};'use strict';var multer=require(_0xad2f('0x0'));var util=require(_0xad2f('0x1'));var path=require('path');var timeout=require(_0xad2f('0x2'));var express=require('express');var router=express[_0xad2f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xad2f('0x4'));var interaction=require(_0xad2f('0x5'));var config=require(_0xad2f('0x6'));var controller=require(_0xad2f('0x7'));router[_0xad2f('0x8')]('/',auth['isAuthenticated'](),controller[_0xad2f('0x9')]);router[_0xad2f('0x8')](_0xad2f('0xa'),auth[_0xad2f('0xb')](),controller[_0xad2f('0xc')]);router['post']('/',auth[_0xad2f('0xb')](),controller['create']);router[_0xad2f('0xd')](_0xad2f('0xa'),auth[_0xad2f('0xb')](),controller[_0xad2f('0xe')]);router[_0xad2f('0xf')](_0xad2f('0xa'),auth[_0xad2f('0xb')](),controller[_0xad2f('0x10')]);module[_0xad2f('0x11')]=router; \ No newline at end of file +var _0xdf27=['get','isAuthenticated','index','/:id','post','put','update','delete','multer','util','express','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x51a783,_0x1a4250){var _0x16606d=function(_0x5c946a){while(--_0x5c946a){_0x51a783['push'](_0x51a783['shift']());}};_0x16606d(++_0x1a4250);}(_0xdf27,0x104));var _0x7df2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf27[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7df2('0x0'));var util=require(_0x7df2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7df2('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7df2('0x3'));var config=require(_0x7df2('0x4'));var controller=require(_0x7df2('0x5'));router[_0x7df2('0x6')]('/',auth[_0x7df2('0x7')](),controller[_0x7df2('0x8')]);router[_0x7df2('0x6')](_0x7df2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7df2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7df2('0xb')](_0x7df2('0x9'),auth['isAuthenticated'](),controller[_0x7df2('0xc')]);router[_0x7df2('0xd')](_0x7df2('0x9'),auth['isAuthenticated'](),controller['destroy']);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 1dddec3..bfdb162 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 _0x65c8=['getDataValue','alias','setDataValue','name','STRING','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','lodash','exports','VIRTUAL'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x65c8,0x11e));var _0x865c=function(_0x50191c,_0x44cf4e){_0x50191c=_0x50191c-0x0;var _0x56ff89=_0x65c8[_0x50191c];return _0x56ff89;};'use strict';var Sequelize=require('sequelize');var _=require(_0x865c('0x0'));module[_0x865c('0x1')]={'name':{'type':Sequelize[_0x865c('0x2')],'get':function(_0x306307){return this[_0x865c('0x3')](_0x865c('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xbc64bc){this[_0x865c('0x5')](_0x865c('0x4'),_0xbc64bc?_0xbc64bc:this[_0x865c('0x3')](_0x865c('0x6')));}},'type':{'type':Sequelize[_0x865c('0x7')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x865c('0x8')),'get':function(){if(this[_0x865c('0x3')](_0x865c('0x9'))===_0x865c('0xa')){return JSON[_0x865c('0xb')](this[_0x865c('0x3')](_0x865c('0xc')));}else{return this[_0x865c('0x3')](_0x865c('0xc'));}},'set':function(_0x570317){if(Array[_0x865c('0xd')](_0x570317)){this[_0x865c('0x5')](_0x865c('0xc'),JSON[_0x865c('0xe')](_0x570317));}else{this['setDataValue'](_0x865c('0xc'),_0x570317);}}},'required':{'type':Sequelize[_0x865c('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x865c('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x865c('0x10')]('voice')}}; \ No newline at end of file +var _0xbb46=['type','select','parse','values','isArray','setDataValue','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','long'];(function(_0x4a011d,_0x2680ea){var _0xa0d891=function(_0x1e7c36){while(--_0x1e7c36){_0x4a011d['push'](_0x4a011d['shift']());}};_0xa0d891(++_0x2680ea);}(_0xbb46,0x6f));var _0x6bb4=function(_0x5240a9,_0x84dd6d){_0x5240a9=_0x5240a9-0x0;var _0x56a557=_0xbb46[_0x5240a9];return _0x56a557;};'use strict';var Sequelize=require(_0x6bb4('0x0'));var _=require(_0x6bb4('0x1'));module[_0x6bb4('0x2')]={'name':{'type':Sequelize[_0x6bb4('0x3')],'get':function(_0x461f38){return this[_0x6bb4('0x4')](_0x6bb4('0x5'));}},'alias':{'type':Sequelize[_0x6bb4('0x6')],'allowNull':![],'set':function(_0xa4f3f3){this['setDataValue'](_0x6bb4('0x5'),_0xa4f3f3?_0xa4f3f3:this[_0x6bb4('0x4')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x6bb4('0x7')),'get':function(){if(this[_0x6bb4('0x4')](_0x6bb4('0x8'))===_0x6bb4('0x9')){return JSON[_0x6bb4('0xa')](this[_0x6bb4('0x4')](_0x6bb4('0xb')));}else{return this[_0x6bb4('0x4')]('values');}},'set':function(_0x221694){if(Array[_0x6bb4('0xc')](_0x221694)){this[_0x6bb4('0xd')]('values',JSON['stringify'](_0x221694));}else{this[_0x6bb4('0xd')](_0x6bb4('0xb'),_0x221694);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6bb4('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6bb4('0xf')](_0x6bb4('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d54e595..9815535 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 _0xe348=['find','body','create','transaction','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','sequelize','queryInterface','eml-format','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','status','send','index','CmCustomField','rawAttributes','type','key','differenceBy','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x28e90e,_0x55f557){var _0x3f7199=function(_0x28f963){while(--_0x28f963){_0x28e90e['push'](_0x28e90e['shift']());}};_0x3f7199(++_0x55f557);}(_0xe348,0x10b));var _0x8e34=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xe348[_0xd0b415];return _0x2bdf2c;};'use strict';var emlformat=require(_0x8e34('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8e34('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8e34('0x2'));var Mustache=require('mustache');var util=require(_0x8e34('0x3'));var path=require(_0x8e34('0x4'));var sox=require(_0x8e34('0x5'));var csv=require('to-csv');var ejs=require(_0x8e34('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e34('0x7'));var squel=require(_0x8e34('0x8'));var crypto=require(_0x8e34('0x9'));var jsforce=require(_0x8e34('0xa'));var deskjs=require(_0x8e34('0xb'));var toCsv=require(_0x8e34('0xc'));var querystring=require(_0x8e34('0xd'));var Papa=require(_0x8e34('0xe'));var Redis=require(_0x8e34('0xf'));var authService=require(_0x8e34('0x10'));var qs=require(_0x8e34('0x11'));var as=require(_0x8e34('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e34('0x13'))('api');var utils=require(_0x8e34('0x14'));var config=require(_0x8e34('0x15'));var licenseUtil=require(_0x8e34('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f5c45,_0x26a7f6){_0x26a7f6=_0x26a7f6||0xcc;return function(_0x1bef19){if(_0x1bef19){return _0x4f5c45[_0x8e34('0x17')](_0x26a7f6);}return _0x4f5c45['status'](_0x26a7f6)[_0x8e34('0x18')]();};}function respondWithResult(_0x2e1051,_0x5b2dd0){_0x5b2dd0=_0x5b2dd0||0xc8;return function(_0x143380){if(_0x143380){return _0x2e1051['status'](_0x5b2dd0)[_0x8e34('0x19')](_0x143380);}};}function respondWithFilteredResult(_0x197632,_0x351e0f){return function(_0x5a5aae){if(_0x5a5aae){var _0x25ab77=typeof _0x351e0f[_0x8e34('0x1a')]==='undefined'&&typeof _0x351e0f[_0x8e34('0x1b')]==='undefined';var _0x2317a0=_0x5a5aae[_0x8e34('0x1c')];var _0x4296a5=_0x25ab77?0x0:_0x351e0f[_0x8e34('0x1a')];var _0x9b2667=_0x25ab77?_0x5a5aae[_0x8e34('0x1c')]:_0x351e0f[_0x8e34('0x1a')]+_0x351e0f[_0x8e34('0x1b')];var _0x1810c1;if(_0x9b2667>=_0x2317a0){_0x9b2667=_0x2317a0;_0x1810c1=0xc8;}else{_0x1810c1=0xce;}_0x197632['status'](_0x1810c1);return _0x197632[_0x8e34('0x1d')](_0x8e34('0x1e'),_0x4296a5+'-'+_0x9b2667+'/'+_0x2317a0)[_0x8e34('0x19')](_0x5a5aae);}return null;};}function patchUpdates(_0x5d765d){return function(_0x180357){try{jsonpatch[_0x8e34('0x1f')](_0x180357,_0x5d765d,!![]);}catch(_0x12b746){return BPromise['reject'](_0x12b746);}return _0x180357[_0x8e34('0x20')]();};}function saveUpdates(_0x4287c8,_0x1dcbbe){return function(_0xc268e){if(_0xc268e){return _0xc268e[_0x8e34('0x21')](_0x4287c8)['then'](function(_0x4af39){return _0x4af39;});}return null;};}function removeEntity(_0x23895f,_0x3d29e7){return function(_0x2c7ba7){if(_0x2c7ba7){return _0x2c7ba7[_0x8e34('0x22')]()[_0x8e34('0x23')](function(){_0x23895f['status'](0xcc)[_0x8e34('0x18')]();});}};}function handleEntityNotFound(_0x563021,_0x1f6a65){return function(_0x26611e){if(!_0x26611e){_0x563021[_0x8e34('0x17')](0x194);}return _0x26611e;};}function handleError(_0x4ab3dd,_0x1d0c54){_0x1d0c54=_0x1d0c54||0x1f4;return function(_0xb55b5a){logger[_0x8e34('0x24')](_0xb55b5a[_0x8e34('0x25')]);if(_0xb55b5a['name']){delete _0xb55b5a['name'];}_0x4ab3dd[_0x8e34('0x26')](_0x1d0c54)[_0x8e34('0x27')](_0xb55b5a);};}exports[_0x8e34('0x28')]=function(_0x2e000b,_0x1b5457){var _0x223ebb={},_0x30f7b7={},_0x6e5c9c={'count':0x0,'rows':[]};var _0x31b83f=_['map'](db[_0x8e34('0x29')][_0x8e34('0x2a')],function(_0x3216c7){return{'name':_0x3216c7['fieldName'],'type':_0x3216c7[_0x8e34('0x2b')][_0x8e34('0x2c')]};});_0x30f7b7['model']=_[_0x8e34('0x2d')](_['map'](_0x31b83f,_0x8e34('0x2e')),['name']);_0x30f7b7[_0x8e34('0x2f')]=_[_0x8e34('0x30')](_0x2e000b['query']);_0x30f7b7[_0x8e34('0x31')]=_[_0x8e34('0x32')](_0x30f7b7[_0x8e34('0x33')],_0x30f7b7[_0x8e34('0x2f')]);_0x223ebb[_0x8e34('0x34')]=_[_0x8e34('0x32')](_0x30f7b7[_0x8e34('0x33')],qs['fields'](_0x2e000b[_0x8e34('0x2f')][_0x8e34('0x35')]));_0x223ebb[_0x8e34('0x34')]=_0x223ebb[_0x8e34('0x34')][_0x8e34('0x36')]?_0x223ebb[_0x8e34('0x34')]:_0x30f7b7['model'];if(!_0x2e000b[_0x8e34('0x2f')][_0x8e34('0x37')](_0x8e34('0x38'))){_0x223ebb['limit']=qs[_0x8e34('0x1b')](_0x2e000b[_0x8e34('0x2f')][_0x8e34('0x1b')]);_0x223ebb[_0x8e34('0x1a')]=qs[_0x8e34('0x1a')](_0x2e000b[_0x8e34('0x2f')][_0x8e34('0x1a')]);}_0x223ebb[_0x8e34('0x39')]=qs['sort'](_0x2e000b[_0x8e34('0x2f')][_0x8e34('0x3a')]);_0x223ebb[_0x8e34('0x3b')]=qs[_0x8e34('0x31')](_[_0x8e34('0x3c')](_0x2e000b[_0x8e34('0x2f')],_0x30f7b7[_0x8e34('0x31')]),_0x31b83f);if(_0x2e000b['query'][_0x8e34('0x3d')]){_0x223ebb[_0x8e34('0x3b')]=_[_0x8e34('0x3e')](_0x223ebb['where'],{'$or':_[_0x8e34('0x3f')](_0x31b83f,function(_0x446de9){if(_0x446de9[_0x8e34('0x2b')]!==_0x8e34('0x40')){var _0x2370d2={};_0x2370d2[_0x446de9[_0x8e34('0x2e')]]={'$like':'%'+_0x2e000b['query']['filter']+'%'};return _0x2370d2;}})});}_0x223ebb=_[_0x8e34('0x3e')]({},_0x223ebb,_0x2e000b[_0x8e34('0x41')]);var _0xbac13e={'where':_0x223ebb[_0x8e34('0x3b')]};return db[_0x8e34('0x29')]['count'](_0xbac13e)['then'](function(_0xda1f53){_0x6e5c9c[_0x8e34('0x1c')]=_0xda1f53;if(_0x2e000b[_0x8e34('0x2f')][_0x8e34('0x42')]){_0x223ebb[_0x8e34('0x43')]=[{'all':!![]}];}return db[_0x8e34('0x29')][_0x8e34('0x44')](_0x223ebb);})[_0x8e34('0x23')](function(_0x843ea2){_0x6e5c9c[_0x8e34('0x45')]=_0x843ea2;return _0x6e5c9c;})[_0x8e34('0x23')](respondWithFilteredResult(_0x1b5457,_0x223ebb))[_0x8e34('0x46')](handleError(_0x1b5457,null));};exports[_0x8e34('0x47')]=function(_0x2ee968,_0x14ae52){var _0x5bbae3={'raw':!![],'where':{'id':_0x2ee968[_0x8e34('0x48')]['id']}},_0x402f2d={};_0x402f2d[_0x8e34('0x33')]=_[_0x8e34('0x30')](db[_0x8e34('0x29')]['rawAttributes']);_0x402f2d['query']=_[_0x8e34('0x30')](_0x2ee968[_0x8e34('0x2f')]);_0x402f2d[_0x8e34('0x31')]=_[_0x8e34('0x32')](_0x402f2d['model'],_0x402f2d[_0x8e34('0x2f')]);_0x5bbae3['attributes']=_[_0x8e34('0x32')](_0x402f2d[_0x8e34('0x33')],qs[_0x8e34('0x35')](_0x2ee968[_0x8e34('0x2f')]['fields']));_0x5bbae3[_0x8e34('0x34')]=_0x5bbae3['attributes']['length']?_0x5bbae3['attributes']:_0x402f2d['model'];if(_0x2ee968[_0x8e34('0x2f')][_0x8e34('0x42')]){_0x5bbae3[_0x8e34('0x43')]=[{'all':!![]}];}_0x5bbae3=_[_0x8e34('0x3e')]({},_0x5bbae3,_0x2ee968['options']);return db['CmCustomField'][_0x8e34('0x49')](_0x5bbae3)['then'](handleEntityNotFound(_0x14ae52,null))[_0x8e34('0x23')](respondWithResult(_0x14ae52,null))[_0x8e34('0x46')](handleError(_0x14ae52,null));};exports['update']=function(_0x440d63,_0x140082){if(_0x440d63[_0x8e34('0x4a')]['id']){delete _0x440d63[_0x8e34('0x4a')]['id'];}return db[_0x8e34('0x29')][_0x8e34('0x49')]({'where':{'id':_0x440d63[_0x8e34('0x48')]['id']}})[_0x8e34('0x23')](handleEntityNotFound(_0x140082,null))[_0x8e34('0x23')](saveUpdates(_0x440d63[_0x8e34('0x4a')],null))[_0x8e34('0x23')](respondWithResult(_0x140082,null))[_0x8e34('0x46')](handleError(_0x140082,null));};exports['destroy']=function(_0x2b757f,_0x99a2f6){return db['CmCustomField'][_0x8e34('0x49')]({'where':{'id':_0x2b757f[_0x8e34('0x48')]['id']}})[_0x8e34('0x23')](handleEntityNotFound(_0x99a2f6,null))[_0x8e34('0x23')](removeEntity(_0x99a2f6,null))[_0x8e34('0x46')](handleError(_0x99a2f6,null));};exports[_0x8e34('0x4b')]=function(_0x4e80f0,_0x16dfef){var _0x11f759;return db['sequelize'][_0x8e34('0x4c')](function(_0x58c25b){return db[_0x8e34('0x29')][_0x8e34('0x4b')](_0x4e80f0[_0x8e34('0x4a')],{'transaction':_0x58c25b})['then'](function(_0x4b2077){_0x11f759=_0x4b2077;var _0x17c6f9={'type':db[_0x8e34('0x4d')][_0x8e34('0x4e')],'transaction':_0x58c25b};switch(_0x4e80f0[_0x8e34('0x4a')]['type']){case _0x8e34('0x4f'):_0x17c6f9[_0x8e34('0x2b')]=db['Sequelize'][_0x8e34('0x4e')];break;case'number':_0x17c6f9[_0x8e34('0x2b')]=db[_0x8e34('0x4d')]['INTEGER'];break;case _0x8e34('0x50'):_0x17c6f9[_0x8e34('0x2b')]=db[_0x8e34('0x4d')][_0x8e34('0x51')];_0x17c6f9[_0x8e34('0x52')]=![];break;default:}return db[_0x8e34('0x53')][_0x8e34('0x54')]['addColumn']('cm_contacts',util['format']('cf_%d',_0x11f759['id']),_0x17c6f9);})['then'](function(){return _0x11f759;});})[_0x8e34('0x23')](respondWithResult(_0x16dfef,0xc9))['catch'](handleError(_0x16dfef,null));}; \ No newline at end of file +var _0x7427=['send','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','name','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','find','body','destroy','create','sequelize','transaction','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','then','sendStatus','error','stack'];(function(_0x54b77e,_0x1b05ef){var _0x2d1f15=function(_0x6af5dd){while(--_0x6af5dd){_0x54b77e['push'](_0x54b77e['shift']());}};_0x2d1f15(++_0x1b05ef);}(_0x7427,0x194));var _0x7742=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7427[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7742('0x0'));var rimraf=require(_0x7742('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7742('0x2'));var rp=require('request-promise');var moment=require(_0x7742('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7742('0x4'));var util=require(_0x7742('0x5'));var path=require(_0x7742('0x6'));var sox=require(_0x7742('0x7'));var csv=require(_0x7742('0x8'));var ejs=require(_0x7742('0x9'));var fs=require('fs');var fs_extra=require(_0x7742('0xa'));var _=require(_0x7742('0xb'));var squel=require(_0x7742('0xc'));var crypto=require(_0x7742('0xd'));var jsforce=require(_0x7742('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7742('0xf'));var Papa=require(_0x7742('0x10'));var Redis=require(_0x7742('0x11'));var authService=require(_0x7742('0x12'));var qs=require(_0x7742('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7742('0x14'));var logger=require(_0x7742('0x15'))(_0x7742('0x16'));var utils=require(_0x7742('0x17'));var config=require(_0x7742('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7742('0x19'))['db'];function respondWithStatusCode(_0x553cfa,_0x5dacf0){_0x5dacf0=_0x5dacf0||0xcc;return function(_0x3b0061){if(_0x3b0061){return _0x553cfa['sendStatus'](_0x5dacf0);}return _0x553cfa[_0x7742('0x1a')](_0x5dacf0)[_0x7742('0x1b')]();};}function respondWithResult(_0x4cdf16,_0x3a7bff){_0x3a7bff=_0x3a7bff||0xc8;return function(_0x2ff3eb){if(_0x2ff3eb){return _0x4cdf16['status'](_0x3a7bff)['json'](_0x2ff3eb);}};}function respondWithFilteredResult(_0x58d35a,_0x1605e5){return function(_0x3042c4){if(_0x3042c4){var _0x10b609=typeof _0x1605e5['offset']===_0x7742('0x1c')&&typeof _0x1605e5[_0x7742('0x1d')]===_0x7742('0x1c');var _0x3f15e1=_0x3042c4[_0x7742('0x1e')];var _0x326532=_0x10b609?0x0:_0x1605e5[_0x7742('0x1f')];var _0x2fcd2f=_0x10b609?_0x3042c4[_0x7742('0x1e')]:_0x1605e5['offset']+_0x1605e5[_0x7742('0x1d')];var _0x27fc27;if(_0x2fcd2f>=_0x3f15e1){_0x2fcd2f=_0x3f15e1;_0x27fc27=0xc8;}else{_0x27fc27=0xce;}_0x58d35a['status'](_0x27fc27);return _0x58d35a[_0x7742('0x20')](_0x7742('0x21'),_0x326532+'-'+_0x2fcd2f+'/'+_0x3f15e1)[_0x7742('0x22')](_0x3042c4);}return null;};}function patchUpdates(_0x4fc520){return function(_0x33a302){try{jsonpatch['apply'](_0x33a302,_0x4fc520,!![]);}catch(_0x54dac1){return BPromise[_0x7742('0x23')](_0x54dac1);}return _0x33a302[_0x7742('0x24')]();};}function saveUpdates(_0x4b955e,_0x170867){return function(_0x1d23e3){if(_0x1d23e3){return _0x1d23e3['update'](_0x4b955e)[_0x7742('0x25')](function(_0x314a4f){return _0x314a4f;});}return null;};}function removeEntity(_0x483d08,_0x1278a7){return function(_0x176a54){if(_0x176a54){return _0x176a54['destroy']()[_0x7742('0x25')](function(){_0x483d08[_0x7742('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4acc39,_0x1bf886){return function(_0x2ef54a){if(!_0x2ef54a){_0x4acc39[_0x7742('0x26')](0x194);}return _0x2ef54a;};}function handleError(_0x13ca8c,_0x166190){_0x166190=_0x166190||0x1f4;return function(_0x238eff){logger[_0x7742('0x27')](_0x238eff[_0x7742('0x28')]);if(_0x238eff['name']){delete _0x238eff['name'];}_0x13ca8c['status'](_0x166190)[_0x7742('0x29')](_0x238eff);};}exports['index']=function(_0xb05d23,_0x36fa5c){var _0x2e9812={},_0x21b85c={},_0x264293={'count':0x0,'rows':[]};var _0x4455f5=_[_0x7742('0x2a')](db[_0x7742('0x2b')][_0x7742('0x2c')],function(_0x1f6a71){return{'name':_0x1f6a71[_0x7742('0x2d')],'type':_0x1f6a71[_0x7742('0x2e')]['key']};});_0x21b85c[_0x7742('0x2f')]=_[_0x7742('0x30')](_[_0x7742('0x2a')](_0x4455f5,_0x7742('0x31')),[_0x7742('0x31')]);_0x21b85c['query']=_[_0x7742('0x32')](_0xb05d23[_0x7742('0x33')]);_0x21b85c[_0x7742('0x34')]=_['intersection'](_0x21b85c[_0x7742('0x2f')],_0x21b85c[_0x7742('0x33')]);_0x2e9812[_0x7742('0x35')]=_['intersection'](_0x21b85c[_0x7742('0x2f')],qs[_0x7742('0x36')](_0xb05d23[_0x7742('0x33')]['fields']));_0x2e9812[_0x7742('0x35')]=_0x2e9812[_0x7742('0x35')][_0x7742('0x37')]?_0x2e9812[_0x7742('0x35')]:_0x21b85c[_0x7742('0x2f')];if(!_0xb05d23[_0x7742('0x33')][_0x7742('0x38')](_0x7742('0x39'))){_0x2e9812[_0x7742('0x1d')]=qs[_0x7742('0x1d')](_0xb05d23[_0x7742('0x33')]['limit']);_0x2e9812[_0x7742('0x1f')]=qs[_0x7742('0x1f')](_0xb05d23['query'][_0x7742('0x1f')]);}_0x2e9812[_0x7742('0x3a')]=qs[_0x7742('0x3b')](_0xb05d23[_0x7742('0x33')][_0x7742('0x3b')]);_0x2e9812[_0x7742('0x3c')]=qs[_0x7742('0x34')](_[_0x7742('0x3d')](_0xb05d23[_0x7742('0x33')],_0x21b85c[_0x7742('0x34')]),_0x4455f5);if(_0xb05d23[_0x7742('0x33')][_0x7742('0x3e')]){_0x2e9812['where']=_[_0x7742('0x3f')](_0x2e9812[_0x7742('0x3c')],{'$or':_['map'](_0x4455f5,function(_0x56e92b){if(_0x56e92b[_0x7742('0x2e')]!==_0x7742('0x40')){var _0x5e4514={};_0x5e4514[_0x56e92b[_0x7742('0x31')]]={'$like':'%'+_0xb05d23['query'][_0x7742('0x3e')]+'%'};return _0x5e4514;}})});}_0x2e9812=_[_0x7742('0x3f')]({},_0x2e9812,_0xb05d23[_0x7742('0x41')]);var _0x55f553={'where':_0x2e9812[_0x7742('0x3c')]};return db[_0x7742('0x2b')][_0x7742('0x1e')](_0x55f553)[_0x7742('0x25')](function(_0x51d66e){_0x264293[_0x7742('0x1e')]=_0x51d66e;if(_0xb05d23[_0x7742('0x33')]['includeAll']){_0x2e9812[_0x7742('0x42')]=[{'all':!![]}];}return db[_0x7742('0x2b')][_0x7742('0x43')](_0x2e9812);})[_0x7742('0x25')](function(_0x39dbef){_0x264293[_0x7742('0x44')]=_0x39dbef;return _0x264293;})['then'](respondWithFilteredResult(_0x36fa5c,_0x2e9812))[_0x7742('0x45')](handleError(_0x36fa5c,null));};exports[_0x7742('0x46')]=function(_0x285199,_0x88f4e5){var _0x267a57={'raw':!![],'where':{'id':_0x285199[_0x7742('0x47')]['id']}},_0x2659df={};_0x2659df[_0x7742('0x2f')]=_['keys'](db[_0x7742('0x2b')][_0x7742('0x2c')]);_0x2659df[_0x7742('0x33')]=_[_0x7742('0x32')](_0x285199[_0x7742('0x33')]);_0x2659df[_0x7742('0x34')]=_[_0x7742('0x48')](_0x2659df[_0x7742('0x2f')],_0x2659df[_0x7742('0x33')]);_0x267a57['attributes']=_[_0x7742('0x48')](_0x2659df[_0x7742('0x2f')],qs['fields'](_0x285199[_0x7742('0x33')][_0x7742('0x36')]));_0x267a57[_0x7742('0x35')]=_0x267a57[_0x7742('0x35')][_0x7742('0x37')]?_0x267a57[_0x7742('0x35')]:_0x2659df[_0x7742('0x2f')];if(_0x285199['query']['includeAll']){_0x267a57['include']=[{'all':!![]}];}_0x267a57=_[_0x7742('0x3f')]({},_0x267a57,_0x285199[_0x7742('0x41')]);return db[_0x7742('0x2b')][_0x7742('0x49')](_0x267a57)[_0x7742('0x25')](handleEntityNotFound(_0x88f4e5,null))[_0x7742('0x25')](respondWithResult(_0x88f4e5,null))[_0x7742('0x45')](handleError(_0x88f4e5,null));};exports['update']=function(_0x5e4e55,_0x5681c7){if(_0x5e4e55['body']['id']){delete _0x5e4e55[_0x7742('0x4a')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x5e4e55['params']['id']}})['then'](handleEntityNotFound(_0x5681c7,null))[_0x7742('0x25')](saveUpdates(_0x5e4e55[_0x7742('0x4a')],null))['then'](respondWithResult(_0x5681c7,null))[_0x7742('0x45')](handleError(_0x5681c7,null));};exports[_0x7742('0x4b')]=function(_0x436cda,_0x35dbdd){return db['CmCustomField'][_0x7742('0x49')]({'where':{'id':_0x436cda[_0x7742('0x47')]['id']}})[_0x7742('0x25')](handleEntityNotFound(_0x35dbdd,null))[_0x7742('0x25')](removeEntity(_0x35dbdd,null))[_0x7742('0x45')](handleError(_0x35dbdd,null));};exports[_0x7742('0x4c')]=function(_0x35e88f,_0x1470ba){var _0x42580b;return db[_0x7742('0x4d')][_0x7742('0x4e')](function(_0x5b30a7){return db['CmCustomField'][_0x7742('0x4c')](_0x35e88f[_0x7742('0x4a')],{'transaction':_0x5b30a7})['then'](function(_0x322717){_0x42580b=_0x322717;var _0x1fe2fe={'type':db['Sequelize'][_0x7742('0x4f')],'transaction':_0x5b30a7};switch(_0x35e88f[_0x7742('0x4a')][_0x7742('0x2e')]){case _0x7742('0x50'):_0x1fe2fe[_0x7742('0x2e')]=db[_0x7742('0x51')][_0x7742('0x4f')];break;case'number':_0x1fe2fe['type']=db[_0x7742('0x51')][_0x7742('0x52')];break;case _0x7742('0x53'):_0x1fe2fe[_0x7742('0x2e')]=db[_0x7742('0x51')][_0x7742('0x54')];_0x1fe2fe[_0x7742('0x55')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0x7742('0x56'),util[_0x7742('0x57')](_0x7742('0x58'),_0x42580b['id']),_0x1fe2fe);})[_0x7742('0x25')](function(){return _0x42580b;});})[_0x7742('0x25')](respondWithResult(_0x1470ba,0xc9))[_0x7742('0x45')](handleError(_0x1470ba,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d8ebab6..dac348b 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 _0xa5f4=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','cm_custom_fields'];(function(_0x2e9d74,_0xa93c1b){var _0x42df4c=function(_0x2efdb5){while(--_0x2efdb5){_0x2e9d74['push'](_0x2e9d74['shift']());}};_0x42df4c(++_0xa93c1b);}(_0xa5f4,0xc0));var _0x4a5f=function(_0x1b7694,_0x393040){_0x1b7694=_0x1b7694-0x0;var _0x3b7705=_0xa5f4[_0x1b7694];return _0x3b7705;};'use strict';var _=require('lodash');var util=require(_0x4a5f('0x0'));var logger=require(_0x4a5f('0x1'))(_0x4a5f('0x2'));var moment=require(_0x4a5f('0x3'));var BPromise=require(_0x4a5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a5f('0x5'));var rimraf=require(_0x4a5f('0x6'));var config=require(_0x4a5f('0x7'));var attributes=require(_0x4a5f('0x8'));module[_0x4a5f('0x9')]=function(_0x8c92bf,_0x295681){return _0x8c92bf[_0x4a5f('0xa')]('CmCustomField',attributes,{'tableName':_0x4a5f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0384=['cm_custom_fields','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField'];(function(_0x558130,_0x3e16b7){var _0x4b6b0a=function(_0x30d6fa){while(--_0x30d6fa){_0x558130['push'](_0x558130['shift']());}};_0x4b6b0a(++_0x3e16b7);}(_0x0384,0x1a5));var _0x4038=function(_0x19bfa2,_0x8fd330){_0x19bfa2=_0x19bfa2-0x0;var _0x10deda=_0x0384[_0x19bfa2];return _0x10deda;};'use strict';var _=require(_0x4038('0x0'));var util=require(_0x4038('0x1'));var logger=require(_0x4038('0x2'))('api');var moment=require(_0x4038('0x3'));var BPromise=require('bluebird');var rp=require(_0x4038('0x4'));var fs=require('fs');var path=require(_0x4038('0x5'));var rimraf=require(_0x4038('0x6'));var config=require(_0x4038('0x7'));var attributes=require(_0x4038('0x8'));module['exports']=function(_0x1482c3,_0x2d417a){return _0x1482c3[_0x4038('0x9')](_0x4038('0xa'),attributes,{'tableName':_0x4038('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 6382689..0bee600 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 _0x8f08=['http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x590766,_0x26a057){var _0x4e2f10=function(_0x5d96a4){while(--_0x5d96a4){_0x590766['push'](_0x590766['shift']());}};_0x4e2f10(++_0x26a057);}(_0x8f08,0x18d));var _0x88f0=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x8f08[_0x3da612];return _0x1a9d1d;};'use strict';var _=require(_0x88f0('0x0'));var util=require('util');var moment=require(_0x88f0('0x1'));var BPromise=require(_0x88f0('0x2'));var rs=require(_0x88f0('0x3'));var fs=require('fs');var Redis=require(_0x88f0('0x4'));var db=require(_0x88f0('0x5'))['db'];var utils=require(_0x88f0('0x6'));var logger=require('../../config/logger')(_0x88f0('0x7'));var config=require(_0x88f0('0x8'));var jayson=require(_0x88f0('0x9'));var client=jayson[_0x88f0('0xa')][_0x88f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ebe0e,_0x3a6139,_0x1cfcc0){return new BPromise(function(_0x1435a9,_0x55965f){return client[_0x88f0('0xc')](_0x5ebe0e,_0x1cfcc0)[_0x88f0('0xd')](function(_0x4f57a0){logger['info'](_0x88f0('0xe'),_0x3a6139,_0x88f0('0xf'));logger[_0x88f0('0x10')](_0x88f0('0x11'),_0x3a6139,_0x88f0('0xf'),JSON[_0x88f0('0x12')](_0x4f57a0));if(_0x4f57a0['error']){if(_0x4f57a0[_0x88f0('0x13')][_0x88f0('0x14')]===0x1f4){logger[_0x88f0('0x13')](_0x88f0('0xe'),_0x3a6139,_0x4f57a0[_0x88f0('0x13')][_0x88f0('0x15')]);return _0x55965f(_0x4f57a0[_0x88f0('0x13')][_0x88f0('0x15')]);}logger[_0x88f0('0x13')]('CmCustomField,\x20%s,\x20%s',_0x3a6139,_0x4f57a0[_0x88f0('0x13')][_0x88f0('0x15')]);return _0x1435a9(_0x4f57a0['error'][_0x88f0('0x15')]);}else{logger[_0x88f0('0x16')](_0x88f0('0xe'),_0x3a6139,_0x88f0('0xf'));_0x1435a9(_0x4f57a0['result'][_0x88f0('0x15')]);}})[_0x88f0('0x17')](function(_0xb0e817){logger[_0x88f0('0x13')](_0x88f0('0xe'),_0x3a6139,_0xb0e817);_0x55965f(_0xb0e817);});});} \ No newline at end of file +var _0x9604=['../../config/environment','jayson/promise','client','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x3bcc63,_0x4cea77){var _0x5be98a=function(_0x45259c){while(--_0x45259c){_0x3bcc63['push'](_0x3bcc63['shift']());}};_0x5be98a(++_0x4cea77);}(_0x9604,0x7d));var _0x4960=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9604[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4960('0x0'));var util=require('util');var moment=require(_0x4960('0x1'));var BPromise=require(_0x4960('0x2'));var rs=require(_0x4960('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4960('0x4'));var logger=require(_0x4960('0x5'))(_0x4960('0x6'));var config=require(_0x4960('0x7'));var jayson=require(_0x4960('0x8'));var client=jayson[_0x4960('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x475546,_0x5ab718,_0x235f0c){return new BPromise(function(_0x3fd787,_0x4087c3){return client[_0x4960('0xa')](_0x475546,_0x235f0c)[_0x4960('0xb')](function(_0x323b37){logger['info'](_0x4960('0xc'),_0x5ab718,'request\x20sent');logger[_0x4960('0xd')](_0x4960('0xe'),_0x5ab718,_0x4960('0xf'),JSON[_0x4960('0x10')](_0x323b37));if(_0x323b37[_0x4960('0x11')]){if(_0x323b37[_0x4960('0x11')]['code']===0x1f4){logger[_0x4960('0x11')]('CmCustomField,\x20%s,\x20%s',_0x5ab718,_0x323b37[_0x4960('0x11')]['message']);return _0x4087c3(_0x323b37['error']['message']);}logger['error'](_0x4960('0xc'),_0x5ab718,_0x323b37['error'][_0x4960('0x12')]);return _0x3fd787(_0x323b37['error'][_0x4960('0x12')]);}else{logger[_0x4960('0x13')](_0x4960('0xc'),_0x5ab718,'request\x20sent');_0x3fd787(_0x323b37[_0x4960('0x14')]['message']);}})[_0x4960('0x15')](function(_0x3dcb2c){logger[_0x4960('0x11')](_0x4960('0xc'),_0x5ab718,_0x3dcb2c);_0x4087c3(_0x3dcb2c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 8308b92..083e5c8 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 _0xb613=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express'];(function(_0x405385,_0x56f573){var _0x43837b=function(_0x30e20e){while(--_0x30e20e){_0x405385['push'](_0x405385['shift']());}};_0x43837b(++_0x56f573);}(_0xb613,0x9d));var _0x3b61=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xb613[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x3b61('0x0'));var util=require(_0x3b61('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3b61('0x2'));var router=express[_0x3b61('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3b61('0x4'));var interaction=require(_0x3b61('0x5'));var config=require(_0x3b61('0x6'));var controller=require(_0x3b61('0x7'));router[_0x3b61('0x8')]('/',auth[_0x3b61('0x9')](),controller[_0x3b61('0xa')]);router['get'](_0x3b61('0xb'),auth[_0x3b61('0x9')](),controller[_0x3b61('0xc')]);router[_0x3b61('0xd')]('/',auth[_0x3b61('0x9')](),controller[_0x3b61('0xe')]);router[_0x3b61('0xf')](_0x3b61('0xb'),auth[_0x3b61('0x9')](),controller[_0x3b61('0x10')]);router[_0x3b61('0x11')](_0x3b61('0xb'),auth[_0x3b61('0x9')](),controller[_0x3b61('0x12')]);module[_0x3b61('0x13')]=router; \ No newline at end of file +var _0x9f7a=['exports','multer','util','path','connect-timeout','Router','../../config/environment','./cmCustomField.controller','index','show','isAuthenticated','create','put','update','/:id','destroy'];(function(_0x869641,_0x11ead7){var _0x4dfc30=function(_0x50354e){while(--_0x50354e){_0x869641['push'](_0x869641['shift']());}};_0x4dfc30(++_0x11ead7);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9f7a[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var path=require(_0xa9f7('0x2'));var timeout=require(_0xa9f7('0x3'));var express=require('express');var router=express[_0xa9f7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa9f7('0x5'));var controller=require(_0xa9f7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa9f7('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa9f7('0x8')]);router['post']('/',auth[_0xa9f7('0x9')](),controller[_0xa9f7('0xa')]);router[_0xa9f7('0xb')]('/:id',auth[_0xa9f7('0x9')](),controller[_0xa9f7('0xc')]);router['delete'](_0xa9f7('0xd'),auth[_0xa9f7('0x9')](),controller[_0xa9f7('0xe')]);module[_0xa9f7('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index db94224..36ede43 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 _0x2872=['STRING','UNSIGNED','contactListQueue','sequelize','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x2d5a8c,_0x3f6e07){var _0x53db46=function(_0x27c97a){while(--_0x27c97a){_0x2d5a8c['push'](_0x2d5a8c['shift']());}};_0x53db46(++_0x3f6e07);}(_0x2872,0xff));var _0x2287=function(_0x5823d4,_0x4634db){_0x5823d4=_0x5823d4-0x0;var _0x35a0b5=_0x2872[_0x5823d4];return _0x35a0b5;};'use strict';var moment=require('moment');var Sequelize=require(_0x2287('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x2287('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2287('0x2')],'defaultValue':moment()[_0x2287('0x3')](_0x2287('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2287('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x2287('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2287('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x2287('0x5')](0x2)[_0x2287('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x2287('0x8')},'ListId':{'type':Sequelize[_0x2287('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x2287('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x2287('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x2287('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2287('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2287('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2287('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x2287('0x6')]},'recallmeNotifiedDate':{'type':Sequelize[_0x2287('0x2')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x06f9=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','exports','BOOLEAN','DATE','format'];(function(_0x385313,_0x5e5da0){var _0x345add=function(_0x191240){while(--_0x191240){_0x385313['push'](_0x385313['shift']());}};_0x345add(++_0x5e5da0);}(_0x06f9,0x11d));var _0x906f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x06f9[_0x4b055c];return _0x4b62bb;};'use strict';var moment=require(_0x906f('0x0'));var Sequelize=require('sequelize');module[_0x906f('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x906f('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x906f('0x3')],'defaultValue':moment()[_0x906f('0x4')](_0x906f('0x5'))},'countbusyretry':{'type':Sequelize[_0x906f('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x906f('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x906f('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x906f('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x906f('0x3')]},'priority':{'type':Sequelize[_0x906f('0x6')](0x2)[_0x906f('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x906f('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x906f('0x6')],'unique':_0x906f('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x906f('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x906f('0x6')],'unique':_0x906f('0x9')},'CampaignId':{'type':Sequelize[_0x906f('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x906f('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x906f('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x906f('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x906f('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x906f('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x906f('0x3')],'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 03b957a..0c26d43 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 _0xf725=['offset','undefined','count','limit','status','set','Content-Range','update','then','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','$and','$or','$gt','$lt','$lte','$eq','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','updatedAt','state','statedesc','campaign','membername','UserId','deletedat','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','user','dialPreviewAutoRecallMe','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','getPreviewRecall','scheduledat','dialActive','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','push','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json'];(function(_0xcf96ec,_0x2a2b00){var _0x451ea3=function(_0x5d6289){while(--_0x5d6289){_0xcf96ec['push'](_0xcf96ec['shift']());}};_0x451ea3(++_0x2a2b00);}(_0xf725,0x7e));var _0x5f72=function(_0xb0914a,_0x502763){_0xb0914a=_0xb0914a-0x0;var _0x40311b=_0xf725[_0xb0914a];return _0x40311b;};'use strict';var moment=require(_0x5f72('0x0'));var _=require(_0x5f72('0x1'));var qs=require(_0x5f72('0x2'));var logger=require(_0x5f72('0x3'))(_0x5f72('0x4'));var shared=require(_0x5f72('0x5'));var db=require(_0x5f72('0x6'))['db'];function respondWithResult(_0x172588,_0x4200ff){_0x4200ff=_0x4200ff||0xc8;return function(_0x17a5bc){if(_0x17a5bc){return _0x172588['status'](_0x4200ff)[_0x5f72('0x7')](_0x17a5bc);}};}function respondWithFilteredResult(_0x14a92d,_0x3f2ca7){return function(_0x193393){if(_0x193393){var _0x148af8=typeof _0x3f2ca7[_0x5f72('0x8')]===_0x5f72('0x9')&&typeof _0x3f2ca7['limit']==='undefined';var _0x16de9b=_0x193393[_0x5f72('0xa')];var _0x5b74cf=_0x148af8?0x0:_0x3f2ca7[_0x5f72('0x8')];var _0x4735f6=_0x148af8?_0x193393['count']:_0x3f2ca7[_0x5f72('0x8')]+_0x3f2ca7[_0x5f72('0xb')];var _0x115372;if(_0x4735f6>=_0x16de9b){_0x4735f6=_0x16de9b;_0x115372=0xc8;}else{_0x115372=0xce;}_0x14a92d[_0x5f72('0xc')](_0x115372);return _0x14a92d[_0x5f72('0xd')](_0x5f72('0xe'),_0x5b74cf+'-'+_0x4735f6+'/'+_0x16de9b)[_0x5f72('0x7')](_0x193393);}return null;};}function saveUpdates(_0x537d7d,_0x1ac591){return function(_0x3307ed){if(_0x3307ed){return _0x3307ed[_0x5f72('0xf')](_0x537d7d)[_0x5f72('0x10')](function(_0x333d9a){return _0x333d9a;});}return null;};}function handleEntityNotFound(_0x57007a,_0x43d1fd){return function(_0x4f81e9){if(!_0x4f81e9){_0x57007a['sendStatus'](0x194);}return _0x4f81e9;};}function handleError(_0x1665be,_0x5a036c){_0x5a036c=_0x5a036c||0x1f4;return function(_0x3267a){logger['error'](_0x3267a[_0x5f72('0x11')]);if(_0x3267a['name']){delete _0x3267a[_0x5f72('0x12')];}_0x1665be[_0x5f72('0xc')](_0x5a036c)['send'](_0x3267a);};}exports[_0x5f72('0x13')]=function(_0x276323,_0x1497d4){var _0x4af7d3={},_0x490d14={},_0x4b62e1={'count':0x0,'rows':[]};var _0x29c8b8=_[_0x5f72('0x14')](db[_0x5f72('0x15')][_0x5f72('0x16')],function(_0x3428a6){return{'name':_0x3428a6[_0x5f72('0x17')],'type':_0x3428a6[_0x5f72('0x18')]['key']};});_0x490d14[_0x5f72('0x19')]=_[_0x5f72('0x14')](_0x29c8b8,_0x5f72('0x12'));_0x490d14[_0x5f72('0x1a')]=_[_0x5f72('0x1b')](_0x276323[_0x5f72('0x1a')]);_0x490d14[_0x5f72('0x1c')]=_[_0x5f72('0x1d')](_0x490d14[_0x5f72('0x19')],_0x490d14[_0x5f72('0x1a')]);_0x490d14[_0x5f72('0x1c')]=_['concat'](_0x490d14[_0x5f72('0x1c')],[_0x5f72('0x1e'),_0x5f72('0x1f'),_0x5f72('0x20'),'$gte',_0x5f72('0x21'),_0x5f72('0x22'),'$ne',_0x5f72('0x23'),_0x5f72('0x24'),_0x5f72('0x25'),'$notBetween','$in',_0x5f72('0x26'),_0x5f72('0x27'),_0x5f72('0x28'),_0x5f72('0x29'),_0x5f72('0x2a'),_0x5f72('0x27'),_0x5f72('0x2b'),'$contains',_0x5f72('0x2c'),'$any']);_0x4af7d3[_0x5f72('0x2d')]=_[_0x5f72('0x1d')](_0x490d14[_0x5f72('0x19')],qs[_0x5f72('0x2e')](_0x276323[_0x5f72('0x1a')]['fields']));_0x4af7d3['attributes']=_0x4af7d3[_0x5f72('0x2d')][_0x5f72('0x2f')]?_0x4af7d3[_0x5f72('0x2d')]:_0x490d14[_0x5f72('0x19')];if(!_0x276323[_0x5f72('0x1a')][_0x5f72('0x30')](_0x5f72('0x31'))){_0x4af7d3['limit']=qs[_0x5f72('0xb')](_0x276323[_0x5f72('0x1a')][_0x5f72('0xb')]);_0x4af7d3[_0x5f72('0x8')]=qs[_0x5f72('0x8')](_0x276323['query'][_0x5f72('0x8')]);}_0x4af7d3[_0x5f72('0x32')]=qs[_0x5f72('0x33')](_0x276323[_0x5f72('0x1a')][_0x5f72('0x33')]);_0x4af7d3[_0x5f72('0x34')]=qs['filters'](_['pick'](_0x276323[_0x5f72('0x1a')],_0x490d14[_0x5f72('0x1c')]),_0x29c8b8);if(_0x276323['query'][_0x5f72('0x35')]){_0x4af7d3[_0x5f72('0x34')]=_[_0x5f72('0x36')](_0x4af7d3[_0x5f72('0x34')],{'$or':_[_0x5f72('0x14')](_0x29c8b8,function(_0x2ca2ff){if(_0x2ca2ff[_0x5f72('0x18')]!==_0x5f72('0x37')){var _0x2e6b77={};_0x2e6b77[_0x2ca2ff[_0x5f72('0x12')]]={'$like':'%'+_0x276323[_0x5f72('0x1a')][_0x5f72('0x35')]+'%'};return _0x2e6b77;}})});}_0x4af7d3=_[_0x5f72('0x36')]({},_0x4af7d3,_0x276323[_0x5f72('0x38')]);var _0x52fab3={'where':_0x4af7d3[_0x5f72('0x34')]};return db['CmHopper']['count'](_0x52fab3)[_0x5f72('0x10')](function(_0x19b4fa){_0x4b62e1[_0x5f72('0xa')]=_0x19b4fa;if(_0x276323[_0x5f72('0x1a')][_0x5f72('0x39')]){_0x4af7d3[_0x5f72('0x3a')]=[{'all':!![]}];}return db['CmHopper'][_0x5f72('0x3b')](_0x4af7d3);})[_0x5f72('0x10')](function(_0x46f4ce){_0x4b62e1[_0x5f72('0x3c')]=_0x46f4ce;return _0x4b62e1;})[_0x5f72('0x10')](respondWithFilteredResult(_0x1497d4,_0x4af7d3))[_0x5f72('0x3d')](handleError(_0x1497d4,null));};exports[_0x5f72('0x3e')]=function(_0xc742c7,_0x2ef034){var _0x2b8549={'raw':!![],'where':{'id':_0xc742c7[_0x5f72('0x3f')]['id']}},_0x39c2af={};_0x39c2af[_0x5f72('0x19')]=_[_0x5f72('0x1b')](db[_0x5f72('0x15')]['rawAttributes']);_0x39c2af['query']=_[_0x5f72('0x1b')](_0xc742c7['query']);_0x39c2af['filters']=_[_0x5f72('0x1d')](_0x39c2af[_0x5f72('0x19')],_0x39c2af['query']);_0x2b8549[_0x5f72('0x2d')]=_[_0x5f72('0x1d')](_0x39c2af['model'],qs[_0x5f72('0x2e')](_0xc742c7[_0x5f72('0x1a')][_0x5f72('0x2e')]));_0x2b8549[_0x5f72('0x2d')]=_0x2b8549['attributes']['length']?_0x2b8549[_0x5f72('0x2d')]:_0x39c2af[_0x5f72('0x19')];if(_0xc742c7[_0x5f72('0x1a')][_0x5f72('0x39')]){_0x2b8549[_0x5f72('0x3a')]=[{'all':!![]}];}_0x2b8549=_[_0x5f72('0x36')]({},_0x2b8549,_0xc742c7[_0x5f72('0x38')]);return db['CmHopper'][_0x5f72('0x40')](_0x2b8549)[_0x5f72('0x10')](handleEntityNotFound(_0x2ef034,null))[_0x5f72('0x10')](respondWithResult(_0x2ef034,null))[_0x5f72('0x3d')](handleError(_0x2ef034,null));};exports['create']=function(_0x28e912,_0x357e5e){return db[_0x5f72('0x15')][_0x5f72('0x41')](_0x28e912['body'],{})[_0x5f72('0x10')](respondWithResult(_0x357e5e,0xc9))[_0x5f72('0x3d')](handleError(_0x357e5e,null));};exports[_0x5f72('0xf')]=function(_0xd38e5,_0x537287){if(_0xd38e5[_0x5f72('0x42')]['id']){delete _0xd38e5[_0x5f72('0x42')]['id'];}return db['CmHopper'][_0x5f72('0x40')]({'where':{'id':_0xd38e5[_0x5f72('0x3f')]['id']}})['then'](handleEntityNotFound(_0x537287,null))[_0x5f72('0x10')](saveUpdates(_0xd38e5[_0x5f72('0x42')],null))[_0x5f72('0x10')](respondWithResult(_0x537287,null))['catch'](handleError(_0x537287,null));};exports[_0x5f72('0x43')]=function(_0x5efa48,_0x30a9b6){return db[_0x5f72('0x15')]['describe']()[_0x5f72('0x10')](respondWithResult(_0x30a9b6,null))[_0x5f72('0x3d')](handleError(_0x30a9b6,null));};exports[_0x5f72('0x44')]=function(_0x302fff,_0x506774){var _0x41319a;var _0xff5cb5=_0x302fff[_0x5f72('0x3f')]['id'];return db[_0x5f72('0x15')]['find']({'where':{'id':_0x302fff[_0x5f72('0x3f')]['id']}})['then'](handleEntityNotFound(_0x506774,null))[_0x5f72('0x10')](function(_0x7dd3){if(_0x7dd3){return _0x7dd3[_0x5f72('0x44')]()[_0x5f72('0x10')](function(_0x142089){return _0x142089;});}})[_0x5f72('0x10')](function(_0x28008c){_0x41319a=_0x28008c;if(_0x28008c){if(_0x28008c[_0x5f72('0x45')]||_0x28008c[_0x5f72('0x46')]){return db[_0x28008c[_0x5f72('0x45')]?'VoiceQueue':_0x5f72('0x47')][_0x5f72('0x40')]({'where':{'id':_0x28008c[_0x5f72('0x45')]?_0x28008c[_0x5f72('0x45')]:_0x28008c[_0x5f72('0x46')]},'attributes':['id','name'],'raw':!![]});}}})[_0x5f72('0x10')](function(_0x6f9638){var _0x198609={};if(_0x6f9638){_[_0x5f72('0x36')](_0x198609,_[_0x5f72('0x48')](_0x41319a['dataValues'],['createdAt',_0x5f72('0x49'),'id']));_0x198609[_0x5f72('0x4a')]=0x15;_0x198609[_0x5f72('0x4b')]='deleted';_0x198609[_0x5f72('0x4c')]=_0x6f9638[_0x5f72('0x12')];_0x198609[_0x5f72('0x4d')]=_0x302fff['user'][_0x5f72('0x12')];_0x198609[_0x5f72('0x4e')]=_0x302fff['user']['id'];_0x198609['deleted']=!![];_0x198609[_0x5f72('0x4f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x198609[_0x5f72('0x50')]=_0x41319a[_0x5f72('0x51')];_0x198609[_0x5f72('0x52')]=_0x41319a[_0x5f72('0x45')]?_0x5f72('0x53'):_0x5f72('0x54');return db[_0x5f72('0x55')]['find']({'where':{'id':_0x198609[_0x5f72('0x56')]},'attributes':['firstName',_0x5f72('0x57')]})[_0x5f72('0x10')](function(_0x48651e){if(!_[_0x5f72('0x58')](_0x506774)&&!_[_0x5f72('0x58')](_0x48651e[_0x5f72('0x59')])){_0x198609[_0x5f72('0x5a')]=_0x48651e[_0x5f72('0x59')];if(!_['isNil'](_0x48651e[_0x5f72('0x57')])){_0x198609[_0x5f72('0x5a')]+='\x20'+_0x48651e[_0x5f72('0x57')];}}})['finally'](function(){return db[_0x5f72('0x5b')][_0x5f72('0x41')](_0x198609);});}})[_0x5f72('0x10')](function(_0xb1e925){return db[_0x5f72('0x5c')][_0x5f72('0x44')]({'where':{'CmHopperId':_0xff5cb5}});})[_0x5f72('0x10')](function(){return _0x506774[_0x5f72('0xc')](0xcc)[_0x5f72('0x5d')]();})[_0x5f72('0x3d')](handleError(_0x506774,null));};exports[_0x5f72('0x5e')]=function(_0x554dcf,_0x56bfa2){var _0x2545fd=[];return db[_0x5f72('0x55')][_0x5f72('0x43')]()[_0x5f72('0x10')](function(_0xf1d356){_0x2545fd=_[_0x5f72('0x1b')](_0xf1d356);return _0x554dcf['user'][_0x5f72('0x5f')]({'where':{'type':_0x5f72('0x60'),'dialActive':!![],'dialMethod':_0x5f72('0x61')},'attributes':['id',_0x5f72('0x62'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x5f72('0x10')](function(_0x5b119c){if(_0x5b119c&&_0x5b119c[_0x5f72('0x2f')]){return db[_0x5f72('0x63')][_0x5f72('0x64')](function(_0x6b865d){var _0x58b330={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5f72('0x65')](_0x5f72('0x66'))},'VoiceQueueId':{'$in':_[_0x5f72('0x14')](_0x5b119c,'id')},'$or':[{'UserId':null},{'UserId':_0x554dcf[_0x5f72('0x67')]['id']}]};var _0x59af10={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5b119c)['filter']([_0x5f72('0x68'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x554dcf[_0x5f72('0x67')]['id']}]};var _0x1ed9b1={'$or':[_0x58b330,_0x59af10]};var _0x2a5dcb=[];if(_0x554dcf['body'][_0x5f72('0x69')]&&_0x554dcf[_0x5f72('0x42')][_0x5f72('0x69')]===_0x5f72('0x6a')){if(!_[_0x5f72('0x6b')](_0x554dcf[_0x5f72('0x42')][_0x5f72('0x6c')])){_0x1ed9b1['id']={'$in':_0x554dcf[_0x5f72('0x42')][_0x5f72('0x6c')]};}_0x2a5dcb=[[_0x5f72('0x6d'),_0x5f72('0x6e')],[_0x5f72('0x6f'),_0x5b119c[0x0][_0x5f72('0x62')]==='ASC'?_0x5f72('0x70'):_0x5f72('0x6e')],db[_0x5f72('0x63')]['literal'](_0x5f72('0x71')),['id','DESC']];}else{if(!_['isEmpty'](_0x554dcf['body']['hopperIds'])){_0x1ed9b1['id']={'$notIn':_0x554dcf['body'][_0x5f72('0x6c')]};}_0x2a5dcb=[['priority','DESC'],[_0x5f72('0x6f'),_0x5b119c[0x0][_0x5f72('0x62')]],db[_0x5f72('0x63')][_0x5f72('0x72')](_0x5f72('0x73')),['id',_0x5f72('0x6e')]];}return db[_0x5f72('0x15')][_0x5f72('0x74')]({'attributes':['id','scheduledat',_0x5f72('0x51'),_0x5f72('0x75')],'where':_0x1ed9b1,'order':_0x2a5dcb,'transaction':_0x6b865d,'lock':_0x6b865d[_0x5f72('0x76')][_0x5f72('0x77')],'include':[{'model':db[_0x5f72('0x55')],'as':_0x5f72('0x78'),'attributes':_0x2545fd,'include':[{'model':db[_0x5f72('0x79')],'as':_0x5f72('0x7a'),'attributes':['id',_0x5f72('0x12')]}]},{'model':db[_0x5f72('0x7b')],'as':_0x5f72('0x7c'),'attributes':['id',_0x5f72('0x12')]},{'model':db[_0x5f72('0x7d')],'as':_0x5f72('0x7e'),'attributes':['id',_0x5f72('0x12'),'dialActive']}]})[_0x5f72('0x10')](function(_0x34ac8f){if(_0x34ac8f){return _0x34ac8f[_0x5f72('0xf')]({'UserId':_0x554dcf['user']['id']},{'transaction':_0x6b865d});}});});}})[_0x5f72('0x10')](handleEntityNotFound(_0x56bfa2,null))['then'](respondWithResult(_0x56bfa2,null))[_0x5f72('0x3d')](handleError(_0x56bfa2,null));};exports[_0x5f72('0x7f')]=function(_0x43cfc0,_0x4281b7,_0x4ee2f6){var _0x8886b4=[];var _0x1145a1=_0x43cfc0['params']['id'];var _0x32c4e3=_0x43cfc0[_0x5f72('0x67')]['id'];return db[_0x5f72('0x55')][_0x5f72('0x43')]()[_0x5f72('0x10')](function(_0x358ecb){_0x8886b4=_[_0x5f72('0x1b')](_0x358ecb);return db[_0x5f72('0x63')]['transaction'](function(_0x71d3c6){const _0x653bd0={'id':_0x1145a1};return db[_0x5f72('0x15')][_0x5f72('0x74')]({'attributes':['id',_0x5f72('0x80'),_0x5f72('0x75')],'where':_0x653bd0,'transaction':_0x71d3c6,'lock':_0x71d3c6[_0x5f72('0x76')][_0x5f72('0x77')],'include':[{'model':db['CmContact'],'as':_0x5f72('0x78'),'attributes':_0x8886b4,'include':[{'model':db[_0x5f72('0x79')],'as':_0x5f72('0x7a'),'attributes':['id','name']}]},{'model':db[_0x5f72('0x7b')],'as':_0x5f72('0x7c'),'attributes':['id',_0x5f72('0x12')]},{'model':db['VoiceQueue'],'as':_0x5f72('0x7e'),'attributes':['id',_0x5f72('0x12'),_0x5f72('0x81')]}]})[_0x5f72('0x10')](function(_0xc929da){if(_0xc929da){return _0xc929da[_0x5f72('0xf')]({'UserId':_0x32c4e3},{'transaction':_0x71d3c6});}});});})[_0x5f72('0x10')](handleEntityNotFound(_0x4281b7,null))['then'](respondWithResult(_0x4281b7,null))['catch'](handleError(_0x4281b7,null));};exports['getOpenContacts']=function(_0x4d2539,_0x4dd4f9){return _0x4d2539[_0x5f72('0x67')]['getVoiceQueues']({'where':{'type':_0x5f72('0x60'),'dialActive':!![],'dialMethod':_0x5f72('0x61')},'attributes':['id'],'raw':!![]})[_0x5f72('0x10')](function(_0x38a654){if(_0x38a654&&_0x38a654[_0x5f72('0x2f')]){return db[_0x5f72('0x15')][_0x5f72('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5f72('0x65')](_0x5f72('0x66'))},'VoiceQueueId':{'$in':_[_0x5f72('0x14')](_0x38a654,'id')},'$or':[{'UserId':null},{'UserId':_0x4d2539[_0x5f72('0x67')]['id']}]}});}return 0x0;})['then'](function(_0x1cccd9){if(!_[_0x5f72('0x58')](_0x1cccd9)&&_[_0x5f72('0x82')](_0x1cccd9)){return _0x4dd4f9[_0x5f72('0xc')](0xc8)['json']({'contacts':_0x1cccd9});}else{logger[_0x5f72('0x83')](_0x5f72('0x84'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x4dd4f9['sendStatus'](0x194);}})[_0x5f72('0x3d')](handleError(_0x4dd4f9,null));};exports['getTimezones']=function(_0x5bde79,_0x5cd8dc){var _0x170c22=shared['timezones'];var _0x2b25e9=[];_['map'](_0x170c22,function(_0x39eaf8){_0x2b25e9[_0x5f72('0x85')]({'id':_0x39eaf8['name'],'name':_0x39eaf8[_0x5f72('0x12')],'utcOffset':_0x39eaf8['utcOffset']});});return _0x5cd8dc['status'](0xc8)[_0x5f72('0x7')]({'tz':_0x2b25e9});};exports['getTimezone']=function(_0x39e996,_0x5666eb){var _0x5b1a94=shared['timezones'];var _0x3572e3={};if(!_['isNil'](_0x5b1a94[_0x39e996['body']['id']]))_0x3572e3=_0x5b1a94[_0x39e996['body']['id']];return _0x5666eb['status'](0xc8)[_0x5f72('0x7')](_0x3572e3);}; \ No newline at end of file +var _0x0207=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','user','UserId','deletedat','format','calleridnum','phone','campaigntype','ContactId','firstName','lastName','isNil','calleridname','finally','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','List','Queue','dialActive','sequelize','recallme','UPDATE','Company','CmList','getOpenContacts','YYYY-MM-DD\x20HH:mm:ss','isNumber','getTimezones','timezones','push','utcOffset','json','getTimezone','lodash','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','set','Content-Range','update','then','sendStatus','error','name','send','index','map','CmHopper','fieldName','type','key','model','query','keys','intersection','filters','concat','$and','$or','$gte','$lt','$lte','$eq','$in','$like','$iLike','$notILike','$overlap','$contains','$contained','$any'];(function(_0x177a9d,_0x2f9427){var _0x26552d=function(_0x2ae8ac){while(--_0x2ae8ac){_0x177a9d['push'](_0x177a9d['shift']());}};_0x26552d(++_0x2f9427);}(_0x0207,0x162));var _0x7020=function(_0x3d0e12,_0x41e165){_0x3d0e12=_0x3d0e12-0x0;var _0x22da51=_0x0207[_0x3d0e12];return _0x22da51;};'use strict';var moment=require('moment');var _=require(_0x7020('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7020('0x1'));var shared=require(_0x7020('0x2'));var db=require(_0x7020('0x3'))['db'];function respondWithResult(_0x15db09,_0x2e62fd){_0x2e62fd=_0x2e62fd||0xc8;return function(_0x25174b){if(_0x25174b){return _0x15db09[_0x7020('0x4')](_0x2e62fd)['json'](_0x25174b);}};}function respondWithFilteredResult(_0x5074d7,_0x38c320){return function(_0x39263c){if(_0x39263c){var _0x3c6c11=typeof _0x38c320[_0x7020('0x5')]===_0x7020('0x6')&&typeof _0x38c320[_0x7020('0x7')]===_0x7020('0x6');var _0x4fa164=_0x39263c['count'];var _0x11a2e8=_0x3c6c11?0x0:_0x38c320[_0x7020('0x5')];var _0xd4432=_0x3c6c11?_0x39263c['count']:_0x38c320[_0x7020('0x5')]+_0x38c320[_0x7020('0x7')];var _0x4e16da;if(_0xd4432>=_0x4fa164){_0xd4432=_0x4fa164;_0x4e16da=0xc8;}else{_0x4e16da=0xce;}_0x5074d7[_0x7020('0x4')](_0x4e16da);return _0x5074d7[_0x7020('0x8')](_0x7020('0x9'),_0x11a2e8+'-'+_0xd4432+'/'+_0x4fa164)['json'](_0x39263c);}return null;};}function saveUpdates(_0x2d7d79,_0x598198){return function(_0xd41aed){if(_0xd41aed){return _0xd41aed[_0x7020('0xa')](_0x2d7d79)[_0x7020('0xb')](function(_0x5e47f5){return _0x5e47f5;});}return null;};}function handleEntityNotFound(_0x9403e5,_0x5f5872){return function(_0x3b8d60){if(!_0x3b8d60){_0x9403e5[_0x7020('0xc')](0x194);}return _0x3b8d60;};}function handleError(_0x12da12,_0x176190){_0x176190=_0x176190||0x1f4;return function(_0x17260e){logger[_0x7020('0xd')](_0x17260e['stack']);if(_0x17260e[_0x7020('0xe')]){delete _0x17260e['name'];}_0x12da12[_0x7020('0x4')](_0x176190)[_0x7020('0xf')](_0x17260e);};}exports[_0x7020('0x10')]=function(_0x1e3a06,_0x4fe6f1){var _0x3d5d25={},_0x3ac2f6={},_0x33daae={'count':0x0,'rows':[]};var _0x254b8b=_[_0x7020('0x11')](db[_0x7020('0x12')]['rawAttributes'],function(_0x5aa31f){return{'name':_0x5aa31f[_0x7020('0x13')],'type':_0x5aa31f[_0x7020('0x14')][_0x7020('0x15')]};});_0x3ac2f6[_0x7020('0x16')]=_['map'](_0x254b8b,_0x7020('0xe'));_0x3ac2f6[_0x7020('0x17')]=_[_0x7020('0x18')](_0x1e3a06[_0x7020('0x17')]);_0x3ac2f6['filters']=_[_0x7020('0x19')](_0x3ac2f6[_0x7020('0x16')],_0x3ac2f6[_0x7020('0x17')]);_0x3ac2f6[_0x7020('0x1a')]=_[_0x7020('0x1b')](_0x3ac2f6[_0x7020('0x1a')],[_0x7020('0x1c'),_0x7020('0x1d'),'$gt',_0x7020('0x1e'),_0x7020('0x1f'),_0x7020('0x20'),'$ne',_0x7020('0x21'),'$not','$between','$notBetween',_0x7020('0x22'),'$notIn',_0x7020('0x23'),'$notLike',_0x7020('0x24'),_0x7020('0x25'),_0x7020('0x23'),_0x7020('0x26'),_0x7020('0x27'),_0x7020('0x28'),_0x7020('0x29')]);_0x3d5d25[_0x7020('0x2a')]=_[_0x7020('0x19')](_0x3ac2f6[_0x7020('0x16')],qs[_0x7020('0x2b')](_0x1e3a06[_0x7020('0x17')][_0x7020('0x2b')]));_0x3d5d25['attributes']=_0x3d5d25[_0x7020('0x2a')][_0x7020('0x2c')]?_0x3d5d25[_0x7020('0x2a')]:_0x3ac2f6[_0x7020('0x16')];if(!_0x1e3a06[_0x7020('0x17')][_0x7020('0x2d')](_0x7020('0x2e'))){_0x3d5d25[_0x7020('0x7')]=qs[_0x7020('0x7')](_0x1e3a06[_0x7020('0x17')][_0x7020('0x7')]);_0x3d5d25[_0x7020('0x5')]=qs[_0x7020('0x5')](_0x1e3a06[_0x7020('0x17')]['offset']);}_0x3d5d25[_0x7020('0x2f')]=qs[_0x7020('0x30')](_0x1e3a06[_0x7020('0x17')][_0x7020('0x30')]);_0x3d5d25[_0x7020('0x31')]=qs[_0x7020('0x1a')](_[_0x7020('0x32')](_0x1e3a06[_0x7020('0x17')],_0x3ac2f6[_0x7020('0x1a')]),_0x254b8b);if(_0x1e3a06[_0x7020('0x17')][_0x7020('0x33')]){_0x3d5d25[_0x7020('0x31')]=_[_0x7020('0x34')](_0x3d5d25[_0x7020('0x31')],{'$or':_['map'](_0x254b8b,function(_0x20ec6f){if(_0x20ec6f[_0x7020('0x14')]!==_0x7020('0x35')){var _0x5d227b={};_0x5d227b[_0x20ec6f[_0x7020('0xe')]]={'$like':'%'+_0x1e3a06[_0x7020('0x17')][_0x7020('0x33')]+'%'};return _0x5d227b;}})});}_0x3d5d25=_[_0x7020('0x34')]({},_0x3d5d25,_0x1e3a06[_0x7020('0x36')]);var _0x24160e={'where':_0x3d5d25['where']};return db[_0x7020('0x12')]['count'](_0x24160e)['then'](function(_0x47a147){_0x33daae[_0x7020('0x37')]=_0x47a147;if(_0x1e3a06[_0x7020('0x17')][_0x7020('0x38')]){_0x3d5d25[_0x7020('0x39')]=[{'all':!![]}];}return db[_0x7020('0x12')]['findAll'](_0x3d5d25);})['then'](function(_0x2eaee9){_0x33daae[_0x7020('0x3a')]=_0x2eaee9;return _0x33daae;})[_0x7020('0xb')](respondWithFilteredResult(_0x4fe6f1,_0x3d5d25))[_0x7020('0x3b')](handleError(_0x4fe6f1,null));};exports['show']=function(_0x4076e9,_0x514f28){var _0x35ebee={'raw':!![],'where':{'id':_0x4076e9[_0x7020('0x3c')]['id']}},_0x1aaa5e={};_0x1aaa5e['model']=_['keys'](db[_0x7020('0x12')]['rawAttributes']);_0x1aaa5e[_0x7020('0x17')]=_[_0x7020('0x18')](_0x4076e9['query']);_0x1aaa5e[_0x7020('0x1a')]=_[_0x7020('0x19')](_0x1aaa5e[_0x7020('0x16')],_0x1aaa5e['query']);_0x35ebee[_0x7020('0x2a')]=_['intersection'](_0x1aaa5e[_0x7020('0x16')],qs[_0x7020('0x2b')](_0x4076e9[_0x7020('0x17')]['fields']));_0x35ebee[_0x7020('0x2a')]=_0x35ebee[_0x7020('0x2a')][_0x7020('0x2c')]?_0x35ebee[_0x7020('0x2a')]:_0x1aaa5e[_0x7020('0x16')];if(_0x4076e9['query'][_0x7020('0x38')]){_0x35ebee[_0x7020('0x39')]=[{'all':!![]}];}_0x35ebee=_[_0x7020('0x34')]({},_0x35ebee,_0x4076e9[_0x7020('0x36')]);return db['CmHopper'][_0x7020('0x3d')](_0x35ebee)['then'](handleEntityNotFound(_0x514f28,null))['then'](respondWithResult(_0x514f28,null))['catch'](handleError(_0x514f28,null));};exports[_0x7020('0x3e')]=function(_0x569e94,_0x237613){return db[_0x7020('0x12')][_0x7020('0x3e')](_0x569e94['body'],{})[_0x7020('0xb')](respondWithResult(_0x237613,0xc9))['catch'](handleError(_0x237613,null));};exports[_0x7020('0xa')]=function(_0x1f0f9a,_0x19c9d4){if(_0x1f0f9a[_0x7020('0x3f')]['id']){delete _0x1f0f9a[_0x7020('0x3f')]['id'];}return db[_0x7020('0x12')][_0x7020('0x3d')]({'where':{'id':_0x1f0f9a[_0x7020('0x3c')]['id']}})[_0x7020('0xb')](handleEntityNotFound(_0x19c9d4,null))[_0x7020('0xb')](saveUpdates(_0x1f0f9a[_0x7020('0x3f')],null))[_0x7020('0xb')](respondWithResult(_0x19c9d4,null))[_0x7020('0x3b')](handleError(_0x19c9d4,null));};exports[_0x7020('0x40')]=function(_0x3dcf52,_0x241ff1){return db[_0x7020('0x12')][_0x7020('0x40')]()['then'](respondWithResult(_0x241ff1,null))[_0x7020('0x3b')](handleError(_0x241ff1,null));};exports[_0x7020('0x41')]=function(_0x1b8198,_0x2a3344){var _0x41f642;var _0x55a36a=_0x1b8198['params']['id'];return db[_0x7020('0x12')]['find']({'where':{'id':_0x1b8198[_0x7020('0x3c')]['id']}})[_0x7020('0xb')](handleEntityNotFound(_0x2a3344,null))[_0x7020('0xb')](function(_0x470400){if(_0x470400){return _0x470400['destroy']()['then'](function(_0xfbd73a){return _0xfbd73a;});}})[_0x7020('0xb')](function(_0x3690ee){_0x41f642=_0x3690ee;if(_0x3690ee){if(_0x3690ee[_0x7020('0x42')]||_0x3690ee[_0x7020('0x43')]){return db[_0x3690ee[_0x7020('0x42')]?_0x7020('0x44'):_0x7020('0x45')][_0x7020('0x3d')]({'where':{'id':_0x3690ee[_0x7020('0x42')]?_0x3690ee[_0x7020('0x42')]:_0x3690ee[_0x7020('0x43')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x5a6557){var _0x445459={};if(_0x5a6557){_['merge'](_0x445459,_[_0x7020('0x46')](_0x41f642[_0x7020('0x47')],[_0x7020('0x48'),_0x7020('0x49'),'id']));_0x445459[_0x7020('0x4a')]=0x15;_0x445459[_0x7020('0x4b')]=_0x7020('0x4c');_0x445459['campaign']=_0x5a6557[_0x7020('0xe')];_0x445459['membername']=_0x1b8198[_0x7020('0x4d')][_0x7020('0xe')];_0x445459[_0x7020('0x4e')]=_0x1b8198[_0x7020('0x4d')]['id'];_0x445459[_0x7020('0x4c')]=!![];_0x445459[_0x7020('0x4f')]=moment()[_0x7020('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x445459[_0x7020('0x51')]=_0x41f642[_0x7020('0x52')];_0x445459[_0x7020('0x53')]=_0x41f642[_0x7020('0x42')]?'queue':'ivr';return db['CmContact'][_0x7020('0x3d')]({'where':{'id':_0x445459[_0x7020('0x54')]},'attributes':[_0x7020('0x55'),_0x7020('0x56')]})[_0x7020('0xb')](function(_0x42bdb2){if(!_['isNil'](_0x2a3344)&&!_[_0x7020('0x57')](_0x42bdb2[_0x7020('0x55')])){_0x445459[_0x7020('0x58')]=_0x42bdb2[_0x7020('0x55')];if(!_[_0x7020('0x57')](_0x42bdb2[_0x7020('0x56')])){_0x445459[_0x7020('0x58')]+='\x20'+_0x42bdb2[_0x7020('0x56')];}}})[_0x7020('0x59')](function(){return db['CmHopperFinal'][_0x7020('0x3e')](_0x445459);});}})['then'](function(_0x1f1053){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x55a36a}});})[_0x7020('0xb')](function(){return _0x2a3344[_0x7020('0x4')](0xcc)[_0x7020('0x5a')]();})['catch'](handleError(_0x2a3344,null));};exports[_0x7020('0x5b')]=function(_0x3410f3,_0x4107da){var _0x1ae0e8=[];return db[_0x7020('0x5c')][_0x7020('0x40')]()[_0x7020('0xb')](function(_0x251243){_0x1ae0e8=_[_0x7020('0x18')](_0x251243);return _0x3410f3['user'][_0x7020('0x5d')]({'where':{'type':_0x7020('0x5e'),'dialActive':!![],'dialMethod':_0x7020('0x5f')},'attributes':['id',_0x7020('0x60'),_0x7020('0x61')],'raw':!![]});})['then'](function(_0x416839){if(_0x416839&&_0x416839[_0x7020('0x2c')]){return db['sequelize'][_0x7020('0x62')](function(_0x36bf12){var _0x316233={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x7020('0x11')](_0x416839,'id')},'$or':[{'UserId':null},{'UserId':_0x3410f3[_0x7020('0x4d')]['id']}]};var _0x145ca3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x416839)[_0x7020('0x33')]([_0x7020('0x61'),0x0])[_0x7020('0x11')]('id')[_0x7020('0x63')]()},'$or':[{'UserId':null},{'UserId':_0x3410f3[_0x7020('0x4d')]['id']}]};var _0xa19606={'$or':[_0x316233,_0x145ca3]};var _0xbaea43=[];if(_0x3410f3['body']['direction']&&_0x3410f3['body'][_0x7020('0x64')]===_0x7020('0x65')){if(!_[_0x7020('0x66')](_0x3410f3['body'][_0x7020('0x67')])){_0xa19606['id']={'$in':_0x3410f3[_0x7020('0x3f')][_0x7020('0x67')]};}_0xbaea43=[[_0x7020('0x68'),_0x7020('0x69')],[_0x7020('0x6a'),_0x416839[0x0][_0x7020('0x60')]===_0x7020('0x69')?_0x7020('0x6b'):'ASC'],db['sequelize'][_0x7020('0x6c')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x7020('0x66')](_0x3410f3['body']['hopperIds'])){_0xa19606['id']={'$notIn':_0x3410f3[_0x7020('0x3f')][_0x7020('0x67')]};}_0xbaea43=[[_0x7020('0x68'),_0x7020('0x6b')],[_0x7020('0x6a'),_0x416839[0x0]['dialOrderByScheduledAt']],db['sequelize']['literal'](_0x7020('0x6d')),['id',_0x7020('0x69')]];}return db[_0x7020('0x12')][_0x7020('0x6e')]({'attributes':['id',_0x7020('0x6f'),'phone','recallme'],'where':_0xa19606,'order':_0xbaea43,'transaction':_0x36bf12,'lock':_0x36bf12[_0x7020('0x70')]['UPDATE'],'include':[{'model':db[_0x7020('0x5c')],'as':_0x7020('0x71'),'attributes':_0x1ae0e8,'include':[{'model':db[_0x7020('0x72')],'as':'Company','attributes':['id',_0x7020('0xe')]}]},{'model':db['CmList'],'as':_0x7020('0x73'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x7020('0x74'),'attributes':['id',_0x7020('0xe'),_0x7020('0x75')]}]})[_0x7020('0xb')](function(_0x22656a){if(_0x22656a){return _0x22656a[_0x7020('0xa')]({'UserId':_0x3410f3[_0x7020('0x4d')]['id']},{'transaction':_0x36bf12});}});});}})[_0x7020('0xb')](handleEntityNotFound(_0x4107da,null))[_0x7020('0xb')](respondWithResult(_0x4107da,null))['catch'](handleError(_0x4107da,null));};exports['getPreviewRecall']=function(_0x7f044e,_0x488949,_0x3fb181){var _0x50c3e4=[];var _0x45c593=_0x7f044e[_0x7020('0x3c')]['id'];var _0x1ccded=_0x7f044e[_0x7020('0x4d')]['id'];return db[_0x7020('0x5c')][_0x7020('0x40')]()[_0x7020('0xb')](function(_0x2946eb){_0x50c3e4=_['keys'](_0x2946eb);return db[_0x7020('0x76')][_0x7020('0x62')](function(_0x458781){const _0x3c97bc={'id':_0x45c593};return db[_0x7020('0x12')][_0x7020('0x6e')]({'attributes':['id','scheduledat',_0x7020('0x77')],'where':_0x3c97bc,'transaction':_0x458781,'lock':_0x458781[_0x7020('0x70')][_0x7020('0x78')],'include':[{'model':db[_0x7020('0x5c')],'as':_0x7020('0x71'),'attributes':_0x50c3e4,'include':[{'model':db['CmCompany'],'as':_0x7020('0x79'),'attributes':['id',_0x7020('0xe')]}]},{'model':db[_0x7020('0x7a')],'as':_0x7020('0x73'),'attributes':['id','name']},{'model':db[_0x7020('0x44')],'as':_0x7020('0x74'),'attributes':['id','name',_0x7020('0x75')]}]})[_0x7020('0xb')](function(_0x58873d){if(_0x58873d){return _0x58873d['update']({'UserId':_0x1ccded},{'transaction':_0x458781});}});});})['then'](handleEntityNotFound(_0x488949,null))[_0x7020('0xb')](respondWithResult(_0x488949,null))[_0x7020('0x3b')](handleError(_0x488949,null));};exports[_0x7020('0x7b')]=function(_0x393ccc,_0x314d4d){return _0x393ccc[_0x7020('0x4d')][_0x7020('0x5d')]({'where':{'type':_0x7020('0x5e'),'dialActive':!![],'dialMethod':_0x7020('0x5f')},'attributes':['id'],'raw':!![]})['then'](function(_0x4a9048){if(_0x4a9048&&_0x4a9048[_0x7020('0x2c')]){return db[_0x7020('0x12')][_0x7020('0x37')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x7020('0x7c'))},'VoiceQueueId':{'$in':_[_0x7020('0x11')](_0x4a9048,'id')},'$or':[{'UserId':null},{'UserId':_0x393ccc['user']['id']}]}});}return 0x0;})['then'](function(_0x4e40bc){if(!_[_0x7020('0x57')](_0x4e40bc)&&_[_0x7020('0x7d')](_0x4e40bc)){return _0x314d4d['status'](0xc8)['json']({'contacts':_0x4e40bc});}else{logger[_0x7020('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x7020('0x7b'),0x194,'entity\x20not\x20found');_0x314d4d['sendStatus'](0x194);}})[_0x7020('0x3b')](handleError(_0x314d4d,null));};exports[_0x7020('0x7e')]=function(_0x2c72e4,_0x32aa8e){var _0x3f9f3a=shared[_0x7020('0x7f')];var _0x52adb6=[];_[_0x7020('0x11')](_0x3f9f3a,function(_0x4e2d05){_0x52adb6[_0x7020('0x80')]({'id':_0x4e2d05[_0x7020('0xe')],'name':_0x4e2d05[_0x7020('0xe')],'utcOffset':_0x4e2d05[_0x7020('0x81')]});});return _0x32aa8e[_0x7020('0x4')](0xc8)[_0x7020('0x82')]({'tz':_0x52adb6});};exports[_0x7020('0x83')]=function(_0x427d6d,_0x4fb3ad){var _0x2c79f4=shared[_0x7020('0x7f')];var _0x269b6f={};if(!_[_0x7020('0x57')](_0x2c79f4[_0x427d6d[_0x7020('0x3f')]['id']]))_0x269b6f=_0x2c79f4[_0x427d6d[_0x7020('0x3f')]['id']];return _0x4fb3ad[_0x7020('0x4')](0xc8)[_0x7020('0x82')](_0x269b6f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 3a7c226..ef3aee2 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 _0x5fab=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x989afb,_0x22b766){var _0x202f95=function(_0x1595d3){while(--_0x1595d3){_0x989afb['push'](_0x989afb['shift']());}};_0x202f95(++_0x22b766);}(_0x5fab,0x177));var _0xb5fa=function(_0x28278f,_0x574b0d){_0x28278f=_0x28278f-0x0;var _0x3d9f74=_0x5fab[_0x28278f];return _0x3d9f74;};'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':['scheduledat']},{'name':_0xb5fa('0xe'),'fields':[_0xb5fa('0xe')]},{'name':_0xb5fa('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbf5=['define','CmHopper','cm_hopper','scheduledat','phone','priority','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x590610,_0x11cb9c){var _0x20e661=function(_0x3b912e){while(--_0x3b912e){_0x590610['push'](_0x590610['shift']());}};_0x20e661(++_0x11cb9c);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x136bb4,_0x1ff4b0){_0x136bb4=_0x136bb4-0x0;var _0x30a5c8=_0xdbf5[_0x136bb4];return _0x30a5c8;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5dbf('0xc')]},{'name':'phone','fields':[_0x5dbf('0xd')]},{'name':_0x5dbf('0xe'),'fields':[_0x5dbf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 026a0a0..a1b0b5f 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 _0xa9e1=['CmContact','describe','sequelize','transaction','limit','order','LOCK','UPDATE','Contact','keys','User','Agent','name','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','all','GetContactRecallMe','GetContactByPhone','findOne','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','voicePause','CmList','List','lodash','util','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','model','map','then','debug','catch','error','message','ShowCmHopper','find','info','stringify','CreateCmHopper','create','body','UpdateCmHopper','update','active','DestroyCmHopper','GetContactDialer'];(function(_0x1449c6,_0x9cd082){var _0x1ea3bd=function(_0x1a641d){while(--_0x1a641d){_0x1449c6['push'](_0x1449c6['shift']());}};_0x1ea3bd(++_0x9cd082);}(_0xa9e1,0x7a));var _0x1a9e=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xa9e1[_0x4c06a3];return _0x7ff53c;};'use strict';var _=require(_0x1a9e('0x0'));var util=require(_0x1a9e('0x1'));var moment=require('moment');var BPromise=require(_0x1a9e('0x2'));var db=require(_0x1a9e('0x3'))['db'];var logger=require(_0x1a9e('0x4'))('rpc');exports[_0x1a9e('0x5')]=function(_0x480e85){var _0x41dd4f=this;return new Promise(function(_0x4db6c5,_0x203050){return db[_0x1a9e('0x6')][_0x1a9e('0x7')]({'raw':_0x480e85[_0x1a9e('0x8')]?_0x480e85[_0x1a9e('0x8')][_0x1a9e('0x9')]===undefined?!![]:![]:!![],'where':_0x480e85[_0x1a9e('0x8')]?_0x480e85[_0x1a9e('0x8')][_0x1a9e('0xa')]||null:null,'attributes':_0x480e85[_0x1a9e('0x8')]?_0x480e85['options'][_0x1a9e('0xb')]||null:null,'limit':_0x480e85['options']?_0x480e85['options']['limit']||null:null,'include':_0x480e85[_0x1a9e('0x8')]?_0x480e85['options'][_0x1a9e('0xc')]?_['map'](_0x480e85['options'][_0x1a9e('0xc')],function(_0x5159a4){return{'model':db[_0x5159a4[_0x1a9e('0xd')]],'as':_0x5159a4['as'],'attributes':_0x5159a4['attributes'],'include':_0x5159a4[_0x1a9e('0xc')]?_[_0x1a9e('0xe')](_0x5159a4[_0x1a9e('0xc')],function(_0x31ac0b){return{'model':db[_0x31ac0b[_0x1a9e('0xd')]],'as':_0x31ac0b['as'],'attributes':_0x31ac0b[_0x1a9e('0xb')],'include':_0x31ac0b[_0x1a9e('0xc')]?_[_0x1a9e('0xe')](_0x31ac0b['include'],function(_0x2beade){return{'model':db[_0x2beade[_0x1a9e('0xd')]],'as':_0x2beade['as'],'attributes':_0x2beade[_0x1a9e('0xb')]};}):[]};}):[]};}):[]:[]})[_0x1a9e('0xf')](function(_0x1d50e7){logger['info'](_0x1a9e('0x5'),_0x480e85);logger[_0x1a9e('0x10')](_0x1a9e('0x5'),_0x480e85,JSON['stringify'](_0x1d50e7));_0x4db6c5(_0x1d50e7);})[_0x1a9e('0x11')](function(_0x3676d0){logger[_0x1a9e('0x12')](_0x1a9e('0x5'),_0x3676d0[_0x1a9e('0x13')],_0x480e85);_0x203050(_0x41dd4f[_0x1a9e('0x12')](0x1f4,_0x3676d0['message']));});});};exports[_0x1a9e('0x14')]=function(_0x5598dc){var _0x3225a0=this;return new Promise(function(_0x1626c4,_0x89a640){return db[_0x1a9e('0x6')][_0x1a9e('0x15')]({'raw':_0x5598dc[_0x1a9e('0x8')]?_0x5598dc['options'][_0x1a9e('0x9')]===undefined?!![]:![]:!![],'where':_0x5598dc[_0x1a9e('0x8')]?_0x5598dc[_0x1a9e('0x8')][_0x1a9e('0xa')]||null:null,'attributes':_0x5598dc[_0x1a9e('0x8')]?_0x5598dc[_0x1a9e('0x8')][_0x1a9e('0xb')]||null:null,'include':_0x5598dc[_0x1a9e('0x8')]?_0x5598dc[_0x1a9e('0x8')]['include']?_[_0x1a9e('0xe')](_0x5598dc['options'][_0x1a9e('0xc')],function(_0x38af8d){return{'model':db[_0x38af8d[_0x1a9e('0xd')]],'as':_0x38af8d['as'],'attributes':_0x38af8d[_0x1a9e('0xb')],'include':_0x38af8d[_0x1a9e('0xc')]?_[_0x1a9e('0xe')](_0x38af8d[_0x1a9e('0xc')],function(_0x54ba8e){return{'model':db[_0x54ba8e[_0x1a9e('0xd')]],'as':_0x54ba8e['as'],'attributes':_0x54ba8e[_0x1a9e('0xb')],'include':_0x54ba8e['include']?_['map'](_0x54ba8e[_0x1a9e('0xc')],function(_0x111abd){return{'model':db[_0x111abd[_0x1a9e('0xd')]],'as':_0x111abd['as'],'attributes':_0x111abd[_0x1a9e('0xb')]};}):[]};}):[]};}):[]:[]})[_0x1a9e('0xf')](function(_0x3acd58){logger[_0x1a9e('0x16')](_0x1a9e('0x14'),_0x5598dc);logger[_0x1a9e('0x10')](_0x1a9e('0x14'),_0x5598dc,JSON[_0x1a9e('0x17')](_0x3acd58));_0x1626c4(_0x3acd58);})[_0x1a9e('0x11')](function(_0x265f8d){logger[_0x1a9e('0x12')]('ShowCmHopper',_0x265f8d[_0x1a9e('0x13')],_0x5598dc);_0x89a640(_0x3225a0['error'](0x1f4,_0x265f8d[_0x1a9e('0x13')]));});});};exports[_0x1a9e('0x18')]=function(_0xc8a16a){var _0x3e88f6=this;return new Promise(function(_0x2a95c3,_0xaee42a){return db['CmHopper'][_0x1a9e('0x19')](_0xc8a16a[_0x1a9e('0x1a')],{'raw':_0xc8a16a[_0x1a9e('0x8')]?_0xc8a16a[_0x1a9e('0x8')][_0x1a9e('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x1c7059){logger[_0x1a9e('0x16')](_0x1a9e('0x18'),_0xc8a16a);logger[_0x1a9e('0x10')](_0x1a9e('0x18'),_0xc8a16a,JSON['stringify'](_0x1c7059));_0x2a95c3(_0x1c7059);})['catch'](function(_0x55a048){logger[_0x1a9e('0x12')](_0x1a9e('0x18'),_0x55a048[_0x1a9e('0x13')],_0xc8a16a);_0xaee42a(_0x3e88f6['error'](0x1f4,_0x55a048[_0x1a9e('0x13')]));});});};exports[_0x1a9e('0x1b')]=function(_0x5503b4){var _0x2574fa=this;return new Promise(function(_0x119f76,_0x5abb67){return db['CmHopper'][_0x1a9e('0x1c')](_0x5503b4[_0x1a9e('0x1a')],{'raw':_0x5503b4[_0x1a9e('0x8')]?_0x5503b4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5503b4[_0x1a9e('0x8')]?_0x5503b4[_0x1a9e('0x8')]['where']||null:null,'attributes':_0x5503b4[_0x1a9e('0x8')]?_0x5503b4[_0x1a9e('0x8')]['attributes']||null:null,'limit':_0x5503b4[_0x1a9e('0x8')]?_0x5503b4[_0x1a9e('0x8')]['limit']||null:null})[_0x1a9e('0xf')](function(_0x18a726){logger[_0x1a9e('0x16')]('UpdateCmHopper',_0x5503b4);logger[_0x1a9e('0x16')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x1a9e('0x17')](_0x5503b4[_0x1a9e('0x8')][_0x1a9e('0xa')]),_0x5503b4[_0x1a9e('0x1a')][_0x1a9e('0x1d')]);logger['debug']('UpdateCmHopper',_0x5503b4,JSON[_0x1a9e('0x17')](_0x18a726));_0x119f76(_0x18a726);})[_0x1a9e('0x11')](function(_0x468f82){logger[_0x1a9e('0x12')]('UpdateCmHopper',_0x468f82[_0x1a9e('0x13')],_0x5503b4);_0x5abb67(_0x2574fa[_0x1a9e('0x12')](0x1f4,_0x468f82[_0x1a9e('0x13')]));});});};exports[_0x1a9e('0x1e')]=function(_0x9b6078){var _0xeb3e58=this;return new Promise(function(_0xfe59fd,_0x10823d){return db[_0x1a9e('0x6')]['destroy']({'where':_0x9b6078[_0x1a9e('0x8')]?_0x9b6078['options'][_0x1a9e('0xa')]||null:null})[_0x1a9e('0xf')](function(_0xaf42ab){logger[_0x1a9e('0x16')](_0x1a9e('0x1e'),_0x9b6078);logger['debug'](_0x1a9e('0x1e'),_0x9b6078,JSON['stringify'](_0xaf42ab));_0xfe59fd(_0xaf42ab);})[_0x1a9e('0x11')](function(_0x65f153){logger[_0x1a9e('0x12')]('DestroyCmHopper',_0x65f153[_0x1a9e('0x13')],_0x9b6078);_0x10823d(_0xeb3e58[_0x1a9e('0x12')](0x1f4,_0x65f153['message']));});});};exports[_0x1a9e('0x1f')]=function(_0xee35bb){var _0x3247ea=this;return new Promise(function(_0x3fbb7f,_0x5c4a4f){return db[_0x1a9e('0x20')][_0x1a9e('0x21')]()[_0x1a9e('0xf')](function(_0x57721c){return db[_0x1a9e('0x22')][_0x1a9e('0x23')](function(_0x294ec3){return db[_0x1a9e('0x6')][_0x1a9e('0x7')]({'where':_0xee35bb[_0x1a9e('0x8')]?_0xee35bb[_0x1a9e('0x8')][_0x1a9e('0xa')]||null:null,'attributes':_0xee35bb[_0x1a9e('0x8')]?_0xee35bb[_0x1a9e('0x8')]['attributes']||null:null,'limit':_0xee35bb[_0x1a9e('0x8')]?_0xee35bb[_0x1a9e('0x8')][_0x1a9e('0x24')]||null:null,'order':_0xee35bb[_0x1a9e('0x8')]?_0xee35bb['options'][_0x1a9e('0x25')]||null:null,'transaction':_0x294ec3,'lock':_0x294ec3[_0x1a9e('0x26')][_0x1a9e('0x27')],'include':[{'model':db[_0x1a9e('0x20')],'as':_0x1a9e('0x28'),'attributes':_[_0x1a9e('0x29')](_0x57721c)},{'model':db[_0x1a9e('0x2a')],'as':_0x1a9e('0x2b'),'attributes':['id',_0x1a9e('0x2c'),'voicePause']}]})[_0x1a9e('0xf')](function(_0x5aed8e){var _0x557fc9=[];var _0x3d903c=[];for(var _0x157ec9=0x0;_0x157ec9<_0x5aed8e[_0x1a9e('0x2d')];_0x157ec9+=0x1){var _0x18898b=_0x5aed8e[_0x157ec9][_0x1a9e('0x2e')];if(_0x18898b===null){_0x557fc9[_0x1a9e('0x2f')](_0x5aed8e[_0x157ec9][_0x1a9e('0x1c')](_0xee35bb['body'],{'transaction':_0x294ec3}));}else if(!_0x3d903c[_0x1a9e('0x30')](_0x18898b)){_0x3d903c[_0x1a9e('0x2f')](_0x18898b);_0x557fc9[_0x1a9e('0x2f')](_0x5aed8e[_0x157ec9][_0x1a9e('0x1c')](_0xee35bb[_0x1a9e('0x1a')],{'transaction':_0x294ec3}));}}return BPromise['all'](_0x557fc9);});})['then'](function(_0x1fee96){logger['info']('GetContactDialer',_0xee35bb);if(_0x1fee96[_0x1a9e('0x2d')]>0x0){logger[_0x1a9e('0x16')](_0x1a9e('0x31'),_0x1fee96[0x0][_0x1a9e('0x32')]['id'],_0x1fee96[0x0][_0x1a9e('0x32')]['ContactId'],_0x1fee96[0x0]['dataValues']['active']);}logger[_0x1a9e('0x10')]('GetContactDialer',_0xee35bb,JSON[_0x1a9e('0x17')](_0x1fee96));_0x3fbb7f(_0x1fee96);})[_0x1a9e('0x11')](function(_0x49287d){logger[_0x1a9e('0x12')](_0x1a9e('0x1f'),_0x49287d[_0x1a9e('0x13')],_0xee35bb);_0x5c4a4f(_0x3247ea[_0x1a9e('0x12')](0x1f4,_0x49287d['message']));});});});};exports[_0x1a9e('0x33')]=function(_0xbc416b){var _0x50327e=this;return new Promise(function(_0x434fbc,_0x5723ce){return db[_0x1a9e('0x22')][_0x1a9e('0x23')](function(_0x53579e){return db[_0x1a9e('0x34')][_0x1a9e('0x19')](_0xbc416b[_0x1a9e('0x1a')],{'raw':_0xbc416b[_0x1a9e('0x8')]?_0xbc416b[_0x1a9e('0x8')][_0x1a9e('0x9')]===undefined?!![]:![]:!![],'transaction':_0x53579e})[_0x1a9e('0xf')](function(){logger[_0x1a9e('0x16')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x1a9e('0x17')](_0xbc416b[_0x1a9e('0x8')][_0x1a9e('0xa')]),_0xbc416b[_0x1a9e('0x8')][_0x1a9e('0xa')]['active']);return db[_0x1a9e('0x6')][_0x1a9e('0x35')]({'where':_0xbc416b[_0x1a9e('0x8')]?_0xbc416b['options'][_0x1a9e('0xa')]||null:null,'transaction':_0x53579e});});})[_0x1a9e('0xf')](function(_0x14c2d2){logger[_0x1a9e('0x16')]('MoveContactManagedDialer',_0xbc416b);logger[_0x1a9e('0x10')]('MoveContactManagedDialer',_0xbc416b,JSON[_0x1a9e('0x17')](_0x14c2d2));_0x434fbc(_0x14c2d2);})[_0x1a9e('0x11')](function(_0x3df5de){logger['error'](_0x1a9e('0x33'),_0x3df5de[_0x1a9e('0x13')],_0xbc416b);_0x5723ce(_0x50327e['error'](0x1f4,_0x3df5de[_0x1a9e('0x13')]));});});};exports[_0x1a9e('0x36')]=function(_0x45c70c){var _0x16f55b=this;return new Promise(function(_0x3b250d,_0x2dcb44){return db[_0x1a9e('0x6')][_0x1a9e('0x7')]({'raw':_0x45c70c['options']?_0x45c70c[_0x1a9e('0x8')][_0x1a9e('0x9')]===undefined?!![]:![]:!![],'where':_0x45c70c['options']?_0x45c70c['options'][_0x1a9e('0xa')]||null:null,'attributes':[[db[_0x1a9e('0x22')]['fn'](_0x1a9e('0x37'),db[_0x1a9e('0x22')]['fn']('IF',db['sequelize']['literal'](_0x1a9e('0x38')+util[_0x1a9e('0x39')](_0x1a9e('0x3a'),moment()[_0x1a9e('0x39')](_0x1a9e('0x3b')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x1a9e('0xf')](function(_0x3acb58){logger[_0x1a9e('0x16')]('CountReScheduled',_0x45c70c);logger[_0x1a9e('0x10')](_0x1a9e('0x36'),_0x45c70c,JSON[_0x1a9e('0x17')](_0x3acb58));_0x3b250d(_0x3acb58);})['catch'](function(_0x4d5682){logger['error'](_0x1a9e('0x36'),_0x4d5682['message'],_0x45c70c);_0x2dcb44(_0x16f55b[_0x1a9e('0x12')](0x1f4,_0x4d5682[_0x1a9e('0x13')]));});});};exports['GetContactRecallMe']=function(_0x462c55){var _0x5b7fb1=this;return new Promise(function(_0x3937f4,_0x14d02f){return db[_0x1a9e('0x20')][_0x1a9e('0x21')]()[_0x1a9e('0xf')](function(){return db['sequelize']['transaction'](function(_0x5c4b28){return db['CmHopper']['findAll']({'where':_0x462c55['options']?_0x462c55['options']['where']||null:null,'attributes':_0x462c55[_0x1a9e('0x8')]?_0x462c55[_0x1a9e('0x8')]['attributes']||null:null,'limit':0x1,'order':_0x462c55[_0x1a9e('0x8')]?_0x462c55['options'][_0x1a9e('0x25')]||null:null,'group':db[_0x1a9e('0x6')][_0x1a9e('0x2e')],'transaction':_0x5c4b28,'lock':_0x5c4b28[_0x1a9e('0x26')][_0x1a9e('0x27')],'include':_0x462c55[_0x1a9e('0x8')]?_0x462c55['options']['include']?_[_0x1a9e('0xe')](_0x462c55[_0x1a9e('0x8')][_0x1a9e('0xc')],function(_0x9cb582){return{'model':db[_0x9cb582[_0x1a9e('0xd')]],'as':_0x9cb582['as'],'attributes':_0x9cb582[_0x1a9e('0xb')],'include':_0x9cb582['include']?_[_0x1a9e('0xe')](_0x9cb582[_0x1a9e('0xc')],function(_0x481711){return{'model':db[_0x481711['model']],'as':_0x481711['as'],'attributes':_0x481711[_0x1a9e('0xb')],'include':_0x481711['include']?_[_0x1a9e('0xe')](_0x481711[_0x1a9e('0xc')],function(_0x3f54e7){return{'model':db[_0x3f54e7[_0x1a9e('0xd')]],'as':_0x3f54e7['as'],'attributes':_0x3f54e7[_0x1a9e('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1612da){var _0x5a2993=[];for(var _0x4c483e=0x0;_0x4c483e<_0x1612da[_0x1a9e('0x2d')];_0x4c483e+=0x1){_0x5a2993['push'](_0x1612da[_0x4c483e]['update'](_0x462c55['body'],{'transaction':_0x5c4b28}));}return BPromise[_0x1a9e('0x3c')](_0x5a2993);});})[_0x1a9e('0xf')](function(_0x1d75ce){logger['info'](_0x1a9e('0x3d'),_0x462c55);logger[_0x1a9e('0x10')]('GetContactRecallMe',_0x462c55,JSON[_0x1a9e('0x17')](_0x1d75ce));_0x3937f4(_0x1d75ce);})[_0x1a9e('0x11')](function(_0x3ed0d9){logger[_0x1a9e('0x12')](_0x1a9e('0x3d'),_0x3ed0d9[_0x1a9e('0x13')],_0x462c55);_0x14d02f(_0x5b7fb1[_0x1a9e('0x12')](0x1f4,_0x3ed0d9[_0x1a9e('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x4ec68d){var _0x259b08=this;return new Promise(function(_0x595c14,_0xf2c335){db['CmContact']['describe']()[_0x1a9e('0xf')](function(_0x3eb3fc){return db[_0x1a9e('0x6')][_0x1a9e('0x7')]({'raw':_0x4ec68d['options']?_0x4ec68d['options'][_0x1a9e('0x9')]===undefined?!![]:![]:!![],'where':_0x4ec68d['options']?_0x4ec68d[_0x1a9e('0x8')][_0x1a9e('0xa')]||null:null,'attributes':_0x4ec68d['options']?_0x4ec68d[_0x1a9e('0x8')][_0x1a9e('0xb')]||null:null,'limit':_0x4ec68d[_0x1a9e('0x8')]?_0x4ec68d[_0x1a9e('0x8')][_0x1a9e('0x24')]||null:null,'include':_0x4ec68d['options']?_0x4ec68d[_0x1a9e('0x8')][_0x1a9e('0xc')]?_[_0x1a9e('0xe')](_0x4ec68d[_0x1a9e('0x8')][_0x1a9e('0xc')],function(_0x1082c2){return{'model':db[_0x1082c2[_0x1a9e('0xd')]],'as':_0x1082c2['as'],'attributes':_0x1082c2['as']===_0x1a9e('0x28')?_[_0x1a9e('0x29')](_0x3eb3fc):_0x1082c2[_0x1a9e('0xb')],'include':_0x1082c2[_0x1a9e('0xc')]?_[_0x1a9e('0xe')](_0x1082c2[_0x1a9e('0xc')],function(_0x190338){return{'model':db[_0x190338[_0x1a9e('0xd')]],'as':_0x190338['as'],'attributes':_0x190338[_0x1a9e('0xb')],'include':_0x190338[_0x1a9e('0xc')]?_[_0x1a9e('0xe')](_0x190338[_0x1a9e('0xc')],function(_0x507494){return{'model':db[_0x507494[_0x1a9e('0xd')]],'as':_0x507494['as'],'attributes':_0x507494[_0x1a9e('0xb')]};}):[]};}):[]};}):[]:[]})[_0x1a9e('0xf')](function(_0x2381df){logger['info'](_0x1a9e('0x5'),_0x4ec68d);logger[_0x1a9e('0x10')](_0x1a9e('0x5'),_0x4ec68d,JSON['stringify'](_0x2381df));_0x595c14(_0x2381df);})['catch'](function(_0x2e7c3e){logger[_0x1a9e('0x12')](_0x1a9e('0x5'),_0x2e7c3e[_0x1a9e('0x13')],_0x4ec68d);_0xf2c335(_0x259b08['error'](0x1f4,_0x2e7c3e[_0x1a9e('0x13')]));});});});};exports[_0x1a9e('0x3e')]=function(_0x28aa64){var _0x4ff6dc=this;return new Promise(function(_0x3338b7,_0x599a01){return db['CmContact'][_0x1a9e('0x3f')]({'raw':!![],'where':{'phone':_0x28aa64[_0x1a9e('0x8')][_0x1a9e('0xa')]['phone']},'attributes':['id',_0x1a9e('0x40')],'order':[['id','DESC']]})[_0x1a9e('0xf')](function(_0x406fe6){logger['info']('getContactByPhone',_0x28aa64);logger['debug']('getContactByPhone',_0x28aa64,JSON['stringify'](_0x406fe6));_0x3338b7(_0x406fe6);})[_0x1a9e('0x11')](function(_0x3d8539){logger[_0x1a9e('0x12')](_0x1a9e('0x41'),_0x3d8539[_0x1a9e('0x13')],_0x28aa64);_0x599a01(_0x4ff6dc[_0x1a9e('0x12')](0x1f4,_0x3d8539[_0x1a9e('0x13')]));});});};exports[_0x1a9e('0x42')]=function(_0x3ab007){var _0x574eb3=this;return new Promise(function(_0x572faf,_0x53ada2){return db[_0x1a9e('0x22')][_0x1a9e('0x23')](function(_0x17a806){var _0x5376f1=_0x3ab007['options']&&_0x3ab007[_0x1a9e('0x8')]['where']?_0x3ab007[_0x1a9e('0x8')][_0x1a9e('0xa')]:{};return db[_0x1a9e('0x6')][_0x1a9e('0x1c')](_0x3ab007[_0x1a9e('0x1a')],{'where':_0x5376f1,'transaction':_0x17a806})[_0x1a9e('0xf')](function(_0x34dc0d){logger[_0x1a9e('0x16')](_0x1a9e('0x42'),_0x3ab007);logger[_0x1a9e('0x10')]('ResetActiveCalls',_0x3ab007,JSON[_0x1a9e('0x17')](_0x34dc0d));_0x572faf(_0x34dc0d);})[_0x1a9e('0x11')](function(_0x1924bf){logger[_0x1a9e('0x12')]('ResetActiveCalls',_0x1924bf[_0x1a9e('0x13')],_0x3ab007);_0x53ada2(_0x574eb3['error'](0x1f4,_0x1924bf['message']));});});});};exports[_0x1a9e('0x43')]=function(_0x59e550){var _0x5695ec=this;var _0x4b5c3e=_0x59e550[_0x1a9e('0x1a')][_0x1a9e('0xa')][_0x1a9e('0x44')];var _0x21e8bd=_0x59e550['body'][_0x1a9e('0xa')]['interval'];var _0x13b137=_0x59e550[_0x1a9e('0x1a')][_0x1a9e('0xa')][_0x1a9e('0x45')];return new Promise(function(_0x59b506,_0x253a5f){return db[_0x1a9e('0x6')][_0x1a9e('0x7')]({'where':{'voiceQueueId':{'$in':_0x4b5c3e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1a9e('0x22')][_0x1a9e('0x46')](_0x1a9e('0x47')+_0x21e8bd+_0x1a9e('0x48')),'$gt':db[_0x1a9e('0x22')][_0x1a9e('0x46')](_0x1a9e('0x49'))}},'UserId':{'$in':_0x13b137}},'include':[{'model':db[_0x1a9e('0x20')],'as':'Contact'},{'model':db[_0x1a9e('0x2a')],'as':_0x1a9e('0x2b'),'attributes':['id',_0x1a9e('0x2c'),_0x1a9e('0x4a')]},{'model':db[_0x1a9e('0x4b')],'as':_0x1a9e('0x4c')}]})[_0x1a9e('0xf')](function(_0x4c4b06){if(_0x4c4b06[_0x1a9e('0x2d')]>0x0){return db['sequelize'][_0x1a9e('0x23')](function(_0x1d05a1){return db[_0x1a9e('0x6')][_0x1a9e('0x1c')]({'recallmeNotifiedDate':db[_0x1a9e('0x22')][_0x1a9e('0x46')](_0x1a9e('0x49'))},{'where':{'id':{'$in':_['map'](_0x4c4b06,'id')}},'transaction':_0x1d05a1})['then'](function(){_0x59b506(_0x4c4b06);})[_0x1a9e('0x11')](function(_0x5e5e0f){logger[_0x1a9e('0x12')](_0x1a9e('0x43'),_0x5e5e0f[_0x1a9e('0x13')],_0x59e550);_0x253a5f(_0x5695ec[_0x1a9e('0x12')](0x1f4,_0x5e5e0f[_0x1a9e('0x13')]));});})[_0x1a9e('0x11')](function(_0x1ad3ef){logger[_0x1a9e('0x12')](_0x1a9e('0x43'),_0x1ad3ef[_0x1a9e('0x13')],_0x59e550);_0x253a5f(_0x5695ec[_0x1a9e('0x12')](0x1f4,_0x1ad3ef[_0x1a9e('0x13')]));});}else{_0x59b506(_0x4c4b06);}});});}; \ No newline at end of file +var _0x11ad=['attributes','limit','include','model','map','then','info','debug','catch','error','message','ShowCmHopper','where','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','stringify','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','User','name','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','describe','GetCmHopperPreview','keys','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','Agent','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','options','raw'];(function(_0x5806c3,_0x5105d8){var _0x48ac77=function(_0x4826ec){while(--_0x4826ec){_0x5806c3['push'](_0x5806c3['shift']());}};_0x48ac77(++_0x5105d8);}(_0x11ad,0x17c));var _0xd11a=function(_0x35d4a6,_0x400d7a){_0x35d4a6=_0x35d4a6-0x0;var _0x51ec39=_0x11ad[_0x35d4a6];return _0x51ec39;};'use strict';var _=require(_0xd11a('0x0'));var util=require(_0xd11a('0x1'));var moment=require(_0xd11a('0x2'));var BPromise=require(_0xd11a('0x3'));var db=require(_0xd11a('0x4'))['db'];var logger=require('../../config/logger')(_0xd11a('0x5'));exports[_0xd11a('0x6')]=function(_0x51bba5){var _0x1e3766=this;return new Promise(function(_0x3a2858,_0x1a628f){return db[_0xd11a('0x7')]['findAll']({'raw':_0x51bba5[_0xd11a('0x8')]?_0x51bba5[_0xd11a('0x8')][_0xd11a('0x9')]===undefined?!![]:![]:!![],'where':_0x51bba5[_0xd11a('0x8')]?_0x51bba5[_0xd11a('0x8')]['where']||null:null,'attributes':_0x51bba5[_0xd11a('0x8')]?_0x51bba5['options'][_0xd11a('0xa')]||null:null,'limit':_0x51bba5['options']?_0x51bba5[_0xd11a('0x8')][_0xd11a('0xb')]||null:null,'include':_0x51bba5[_0xd11a('0x8')]?_0x51bba5[_0xd11a('0x8')]['include']?_['map'](_0x51bba5[_0xd11a('0x8')][_0xd11a('0xc')],function(_0x449146){return{'model':db[_0x449146['model']],'as':_0x449146['as'],'attributes':_0x449146['attributes'],'include':_0x449146['include']?_['map'](_0x449146[_0xd11a('0xc')],function(_0x29e324){return{'model':db[_0x29e324[_0xd11a('0xd')]],'as':_0x29e324['as'],'attributes':_0x29e324[_0xd11a('0xa')],'include':_0x29e324[_0xd11a('0xc')]?_[_0xd11a('0xe')](_0x29e324[_0xd11a('0xc')],function(_0x524760){return{'model':db[_0x524760['model']],'as':_0x524760['as'],'attributes':_0x524760[_0xd11a('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd11a('0xf')](function(_0x184360){logger[_0xd11a('0x10')](_0xd11a('0x6'),_0x51bba5);logger[_0xd11a('0x11')]('GetCmHopper',_0x51bba5,JSON['stringify'](_0x184360));_0x3a2858(_0x184360);})[_0xd11a('0x12')](function(_0x4f24a8){logger[_0xd11a('0x13')](_0xd11a('0x6'),_0x4f24a8['message'],_0x51bba5);_0x1a628f(_0x1e3766[_0xd11a('0x13')](0x1f4,_0x4f24a8[_0xd11a('0x14')]));});});};exports[_0xd11a('0x15')]=function(_0x30bdcf){var _0x5e9512=this;return new Promise(function(_0x1261e4,_0x3e882a){return db[_0xd11a('0x7')]['find']({'raw':_0x30bdcf['options']?_0x30bdcf[_0xd11a('0x8')][_0xd11a('0x9')]===undefined?!![]:![]:!![],'where':_0x30bdcf[_0xd11a('0x8')]?_0x30bdcf['options'][_0xd11a('0x16')]||null:null,'attributes':_0x30bdcf[_0xd11a('0x8')]?_0x30bdcf[_0xd11a('0x8')][_0xd11a('0xa')]||null:null,'include':_0x30bdcf['options']?_0x30bdcf['options'][_0xd11a('0xc')]?_[_0xd11a('0xe')](_0x30bdcf[_0xd11a('0x8')][_0xd11a('0xc')],function(_0xa6d58d){return{'model':db[_0xa6d58d[_0xd11a('0xd')]],'as':_0xa6d58d['as'],'attributes':_0xa6d58d[_0xd11a('0xa')],'include':_0xa6d58d[_0xd11a('0xc')]?_[_0xd11a('0xe')](_0xa6d58d[_0xd11a('0xc')],function(_0x520c95){return{'model':db[_0x520c95['model']],'as':_0x520c95['as'],'attributes':_0x520c95[_0xd11a('0xa')],'include':_0x520c95['include']?_['map'](_0x520c95[_0xd11a('0xc')],function(_0x263e5f){return{'model':db[_0x263e5f[_0xd11a('0xd')]],'as':_0x263e5f['as'],'attributes':_0x263e5f[_0xd11a('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd11a('0xf')](function(_0x447653){logger['info'](_0xd11a('0x15'),_0x30bdcf);logger['debug']('ShowCmHopper',_0x30bdcf,JSON['stringify'](_0x447653));_0x1261e4(_0x447653);})[_0xd11a('0x12')](function(_0x1ab0b5){logger[_0xd11a('0x13')]('ShowCmHopper',_0x1ab0b5[_0xd11a('0x14')],_0x30bdcf);_0x3e882a(_0x5e9512[_0xd11a('0x13')](0x1f4,_0x1ab0b5[_0xd11a('0x14')]));});});};exports[_0xd11a('0x17')]=function(_0x261a3c){var _0x926083=this;return new Promise(function(_0x5d99e2,_0xfbc3d7){return db[_0xd11a('0x7')][_0xd11a('0x18')](_0x261a3c[_0xd11a('0x19')],{'raw':_0x261a3c[_0xd11a('0x8')]?_0x261a3c[_0xd11a('0x8')][_0xd11a('0x9')]===undefined?!![]:![]:!![]})[_0xd11a('0xf')](function(_0x88fa6e){logger[_0xd11a('0x10')](_0xd11a('0x17'),_0x261a3c);logger['debug']('CreateCmHopper',_0x261a3c,JSON['stringify'](_0x88fa6e));_0x5d99e2(_0x88fa6e);})[_0xd11a('0x12')](function(_0x812124){logger[_0xd11a('0x13')]('CreateCmHopper',_0x812124[_0xd11a('0x14')],_0x261a3c);_0xfbc3d7(_0x926083[_0xd11a('0x13')](0x1f4,_0x812124[_0xd11a('0x14')]));});});};exports[_0xd11a('0x1a')]=function(_0x25104a){var _0x5efb06=this;return new Promise(function(_0x3fb1fe,_0xc0b061){return db[_0xd11a('0x7')][_0xd11a('0x1b')](_0x25104a[_0xd11a('0x19')],{'raw':_0x25104a['options']?_0x25104a[_0xd11a('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25104a[_0xd11a('0x8')]?_0x25104a[_0xd11a('0x8')]['where']||null:null,'attributes':_0x25104a[_0xd11a('0x8')]?_0x25104a[_0xd11a('0x8')]['attributes']||null:null,'limit':_0x25104a[_0xd11a('0x8')]?_0x25104a['options'][_0xd11a('0xb')]||null:null})[_0xd11a('0xf')](function(_0x22532d){logger['info'](_0xd11a('0x1a'),_0x25104a);logger[_0xd11a('0x10')](_0xd11a('0x1c'),JSON['stringify'](_0x25104a['options'][_0xd11a('0x16')]),_0x25104a[_0xd11a('0x19')][_0xd11a('0x1d')]);logger[_0xd11a('0x11')](_0xd11a('0x1a'),_0x25104a,JSON[_0xd11a('0x1e')](_0x22532d));_0x3fb1fe(_0x22532d);})[_0xd11a('0x12')](function(_0x4017d9){logger[_0xd11a('0x13')](_0xd11a('0x1a'),_0x4017d9[_0xd11a('0x14')],_0x25104a);_0xc0b061(_0x5efb06[_0xd11a('0x13')](0x1f4,_0x4017d9['message']));});});};exports[_0xd11a('0x1f')]=function(_0x2841ef){var _0x2ae6c3=this;return new Promise(function(_0x41ba1c,_0x282e3f){return db[_0xd11a('0x7')][_0xd11a('0x20')]({'where':_0x2841ef[_0xd11a('0x8')]?_0x2841ef[_0xd11a('0x8')][_0xd11a('0x16')]||null:null})['then'](function(_0x4a0fbd){logger[_0xd11a('0x10')](_0xd11a('0x1f'),_0x2841ef);logger[_0xd11a('0x11')](_0xd11a('0x1f'),_0x2841ef,JSON[_0xd11a('0x1e')](_0x4a0fbd));_0x41ba1c(_0x4a0fbd);})[_0xd11a('0x12')](function(_0x1b16ce){logger[_0xd11a('0x13')]('DestroyCmHopper',_0x1b16ce[_0xd11a('0x14')],_0x2841ef);_0x282e3f(_0x2ae6c3[_0xd11a('0x13')](0x1f4,_0x1b16ce[_0xd11a('0x14')]));});});};exports[_0xd11a('0x21')]=function(_0x2bea89){var _0x5762cc=this;return new Promise(function(_0x3ed169,_0x4711a7){return db[_0xd11a('0x22')]['describe']()[_0xd11a('0xf')](function(_0x21dcea){return db[_0xd11a('0x23')][_0xd11a('0x24')](function(_0x32d1ed){return db[_0xd11a('0x7')]['findAll']({'where':_0x2bea89[_0xd11a('0x8')]?_0x2bea89[_0xd11a('0x8')][_0xd11a('0x16')]||null:null,'attributes':_0x2bea89[_0xd11a('0x8')]?_0x2bea89['options'][_0xd11a('0xa')]||null:null,'limit':_0x2bea89['options']?_0x2bea89['options']['limit']||null:null,'order':_0x2bea89[_0xd11a('0x8')]?_0x2bea89[_0xd11a('0x8')][_0xd11a('0x25')]||null:null,'transaction':_0x32d1ed,'lock':_0x32d1ed[_0xd11a('0x26')][_0xd11a('0x27')],'include':[{'model':db[_0xd11a('0x22')],'as':_0xd11a('0x28'),'attributes':_['keys'](_0x21dcea)},{'model':db[_0xd11a('0x29')],'as':'Agent','attributes':['id',_0xd11a('0x2a'),_0xd11a('0x2b')]}]})[_0xd11a('0xf')](function(_0x16c15b){var _0x291184=[];var _0x5d1432=[];for(var _0x16918c=0x0;_0x16918c<_0x16c15b[_0xd11a('0x2c')];_0x16918c+=0x1){var _0x2edc9a=_0x16c15b[_0x16918c][_0xd11a('0x2d')];if(_0x2edc9a===null){_0x291184[_0xd11a('0x2e')](_0x16c15b[_0x16918c][_0xd11a('0x1b')](_0x2bea89['body'],{'transaction':_0x32d1ed}));}else if(!_0x5d1432['includes'](_0x2edc9a)){_0x5d1432[_0xd11a('0x2e')](_0x2edc9a);_0x291184[_0xd11a('0x2e')](_0x16c15b[_0x16918c][_0xd11a('0x1b')](_0x2bea89['body'],{'transaction':_0x32d1ed}));}}return BPromise[_0xd11a('0x2f')](_0x291184);});})[_0xd11a('0xf')](function(_0x64760d){logger['info'](_0xd11a('0x21'),_0x2bea89);if(_0x64760d[_0xd11a('0x2c')]>0x0){logger[_0xd11a('0x10')](_0xd11a('0x30'),_0x64760d[0x0][_0xd11a('0x31')]['id'],_0x64760d[0x0][_0xd11a('0x31')]['ContactId'],_0x64760d[0x0][_0xd11a('0x31')][_0xd11a('0x1d')]);}logger[_0xd11a('0x11')](_0xd11a('0x21'),_0x2bea89,JSON[_0xd11a('0x1e')](_0x64760d));_0x3ed169(_0x64760d);})[_0xd11a('0x12')](function(_0x333f0c){logger['error'](_0xd11a('0x21'),_0x333f0c[_0xd11a('0x14')],_0x2bea89);_0x4711a7(_0x5762cc[_0xd11a('0x13')](0x1f4,_0x333f0c[_0xd11a('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x26dbf8){var _0x1fb34a=this;return new Promise(function(_0x51d1f1,_0x3ef5de){return db[_0xd11a('0x23')][_0xd11a('0x24')](function(_0x5a0d13){return db[_0xd11a('0x32')][_0xd11a('0x18')](_0x26dbf8['body'],{'raw':_0x26dbf8[_0xd11a('0x8')]?_0x26dbf8[_0xd11a('0x8')][_0xd11a('0x9')]===undefined?!![]:![]:!![],'transaction':_0x5a0d13})[_0xd11a('0xf')](function(){logger[_0xd11a('0x10')](_0xd11a('0x33'),JSON[_0xd11a('0x1e')](_0x26dbf8[_0xd11a('0x8')]['where']),_0x26dbf8[_0xd11a('0x8')][_0xd11a('0x16')][_0xd11a('0x1d')]);return db[_0xd11a('0x7')]['destroy']({'where':_0x26dbf8[_0xd11a('0x8')]?_0x26dbf8[_0xd11a('0x8')]['where']||null:null,'transaction':_0x5a0d13});});})[_0xd11a('0xf')](function(_0x50ee23){logger[_0xd11a('0x10')](_0xd11a('0x34'),_0x26dbf8);logger[_0xd11a('0x11')](_0xd11a('0x34'),_0x26dbf8,JSON['stringify'](_0x50ee23));_0x51d1f1(_0x50ee23);})[_0xd11a('0x12')](function(_0x30295d){logger[_0xd11a('0x13')]('MoveContactManagedDialer',_0x30295d[_0xd11a('0x14')],_0x26dbf8);_0x3ef5de(_0x1fb34a[_0xd11a('0x13')](0x1f4,_0x30295d[_0xd11a('0x14')]));});});};exports[_0xd11a('0x35')]=function(_0x562d60){var _0x103375=this;return new Promise(function(_0xa34f5a,_0x115ab4){return db['CmHopper'][_0xd11a('0x36')]({'raw':_0x562d60[_0xd11a('0x8')]?_0x562d60[_0xd11a('0x8')][_0xd11a('0x9')]===undefined?!![]:![]:!![],'where':_0x562d60[_0xd11a('0x8')]?_0x562d60[_0xd11a('0x8')][_0xd11a('0x16')]||null:null,'attributes':[[db[_0xd11a('0x23')]['fn'](_0xd11a('0x37'),db[_0xd11a('0x23')]['fn']('IF',db['sequelize'][_0xd11a('0x38')](_0xd11a('0x39')+util[_0xd11a('0x3a')]('\x22%s\x22',moment()[_0xd11a('0x3a')](_0xd11a('0x3b')))+_0xd11a('0x3c')))),'contactsRescheduled']]})[_0xd11a('0xf')](function(_0x10ac25){logger['info'](_0xd11a('0x35'),_0x562d60);logger['debug'](_0xd11a('0x35'),_0x562d60,JSON[_0xd11a('0x1e')](_0x10ac25));_0xa34f5a(_0x10ac25);})['catch'](function(_0x4e73f6){logger[_0xd11a('0x13')](_0xd11a('0x35'),_0x4e73f6['message'],_0x562d60);_0x115ab4(_0x103375[_0xd11a('0x13')](0x1f4,_0x4e73f6[_0xd11a('0x14')]));});});};exports[_0xd11a('0x3d')]=function(_0x3cbd65){var _0x3ac102=this;return new Promise(function(_0x169b69,_0x47d91e){return db[_0xd11a('0x22')][_0xd11a('0x3e')]()['then'](function(){return db[_0xd11a('0x23')][_0xd11a('0x24')](function(_0x153202){return db['CmHopper'][_0xd11a('0x36')]({'where':_0x3cbd65[_0xd11a('0x8')]?_0x3cbd65[_0xd11a('0x8')]['where']||null:null,'attributes':_0x3cbd65[_0xd11a('0x8')]?_0x3cbd65[_0xd11a('0x8')][_0xd11a('0xa')]||null:null,'limit':0x1,'order':_0x3cbd65['options']?_0x3cbd65[_0xd11a('0x8')][_0xd11a('0x25')]||null:null,'group':db['CmHopper'][_0xd11a('0x2d')],'transaction':_0x153202,'lock':_0x153202['LOCK'][_0xd11a('0x27')],'include':_0x3cbd65[_0xd11a('0x8')]?_0x3cbd65['options']['include']?_[_0xd11a('0xe')](_0x3cbd65[_0xd11a('0x8')][_0xd11a('0xc')],function(_0x448bb1){return{'model':db[_0x448bb1[_0xd11a('0xd')]],'as':_0x448bb1['as'],'attributes':_0x448bb1['attributes'],'include':_0x448bb1[_0xd11a('0xc')]?_[_0xd11a('0xe')](_0x448bb1[_0xd11a('0xc')],function(_0xfa35df){return{'model':db[_0xfa35df[_0xd11a('0xd')]],'as':_0xfa35df['as'],'attributes':_0xfa35df[_0xd11a('0xa')],'include':_0xfa35df[_0xd11a('0xc')]?_[_0xd11a('0xe')](_0xfa35df[_0xd11a('0xc')],function(_0x3f9614){return{'model':db[_0x3f9614[_0xd11a('0xd')]],'as':_0x3f9614['as'],'attributes':_0x3f9614['attributes']};}):[]};}):[]};}):[]:[]})[_0xd11a('0xf')](function(_0x1ec0cf){var _0x4e18c9=[];for(var _0xce1eab=0x0;_0xce1eab<_0x1ec0cf[_0xd11a('0x2c')];_0xce1eab+=0x1){_0x4e18c9[_0xd11a('0x2e')](_0x1ec0cf[_0xce1eab]['update'](_0x3cbd65[_0xd11a('0x19')],{'transaction':_0x153202}));}return BPromise[_0xd11a('0x2f')](_0x4e18c9);});})[_0xd11a('0xf')](function(_0x26cc38){logger[_0xd11a('0x10')](_0xd11a('0x3d'),_0x3cbd65);logger[_0xd11a('0x11')](_0xd11a('0x3d'),_0x3cbd65,JSON[_0xd11a('0x1e')](_0x26cc38));_0x169b69(_0x26cc38);})[_0xd11a('0x12')](function(_0x3d12f0){logger['error']('GetContactRecallMe',_0x3d12f0['message'],_0x3cbd65);_0x47d91e(_0x3ac102['error'](0x1f4,_0x3d12f0['message']));});});});};exports[_0xd11a('0x3f')]=function(_0x3cd001){var _0x6b1cc3=this;return new Promise(function(_0x4d03c1,_0xdef88e){db[_0xd11a('0x22')]['describe']()[_0xd11a('0xf')](function(_0x3343ab){return db['CmHopper'][_0xd11a('0x36')]({'raw':_0x3cd001[_0xd11a('0x8')]?_0x3cd001[_0xd11a('0x8')][_0xd11a('0x9')]===undefined?!![]:![]:!![],'where':_0x3cd001[_0xd11a('0x8')]?_0x3cd001['options']['where']||null:null,'attributes':_0x3cd001[_0xd11a('0x8')]?_0x3cd001[_0xd11a('0x8')][_0xd11a('0xa')]||null:null,'limit':_0x3cd001[_0xd11a('0x8')]?_0x3cd001[_0xd11a('0x8')]['limit']||null:null,'include':_0x3cd001[_0xd11a('0x8')]?_0x3cd001[_0xd11a('0x8')][_0xd11a('0xc')]?_[_0xd11a('0xe')](_0x3cd001['options'][_0xd11a('0xc')],function(_0x9a3ce8){return{'model':db[_0x9a3ce8[_0xd11a('0xd')]],'as':_0x9a3ce8['as'],'attributes':_0x9a3ce8['as']===_0xd11a('0x28')?_[_0xd11a('0x40')](_0x3343ab):_0x9a3ce8[_0xd11a('0xa')],'include':_0x9a3ce8[_0xd11a('0xc')]?_[_0xd11a('0xe')](_0x9a3ce8['include'],function(_0x349d12){return{'model':db[_0x349d12[_0xd11a('0xd')]],'as':_0x349d12['as'],'attributes':_0x349d12[_0xd11a('0xa')],'include':_0x349d12['include']?_[_0xd11a('0xe')](_0x349d12[_0xd11a('0xc')],function(_0x25c7d0){return{'model':db[_0x25c7d0[_0xd11a('0xd')]],'as':_0x25c7d0['as'],'attributes':_0x25c7d0[_0xd11a('0xa')]};}):[]};}):[]};}):[]:[]})[_0xd11a('0xf')](function(_0x4c3e35){logger[_0xd11a('0x10')](_0xd11a('0x6'),_0x3cd001);logger['debug'](_0xd11a('0x6'),_0x3cd001,JSON['stringify'](_0x4c3e35));_0x4d03c1(_0x4c3e35);})[_0xd11a('0x12')](function(_0x239366){logger[_0xd11a('0x13')]('GetCmHopper',_0x239366['message'],_0x3cd001);_0xdef88e(_0x6b1cc3[_0xd11a('0x13')](0x1f4,_0x239366[_0xd11a('0x14')]));});});});};exports[_0xd11a('0x41')]=function(_0x1d3f3f){var _0x3877fd=this;return new Promise(function(_0x447af9,_0x274d93){return db[_0xd11a('0x22')][_0xd11a('0x42')]({'raw':!![],'where':{'phone':_0x1d3f3f['options'][_0xd11a('0x16')]['phone']},'attributes':['id',_0xd11a('0x43')],'order':[['id',_0xd11a('0x44')]]})[_0xd11a('0xf')](function(_0x56bbb9){logger[_0xd11a('0x10')](_0xd11a('0x45'),_0x1d3f3f);logger[_0xd11a('0x11')](_0xd11a('0x45'),_0x1d3f3f,JSON[_0xd11a('0x1e')](_0x56bbb9));_0x447af9(_0x56bbb9);})[_0xd11a('0x12')](function(_0x51d8a3){logger[_0xd11a('0x13')](_0xd11a('0x45'),_0x51d8a3['message'],_0x1d3f3f);_0x274d93(_0x3877fd['error'](0x1f4,_0x51d8a3[_0xd11a('0x14')]));});});};exports[_0xd11a('0x46')]=function(_0x3c7e62){var _0xd2ffa7=this;return new Promise(function(_0x26f1f0,_0x5a8c97){return db[_0xd11a('0x23')][_0xd11a('0x24')](function(_0x2afa69){var _0x5240a9=_0x3c7e62['options']&&_0x3c7e62[_0xd11a('0x8')][_0xd11a('0x16')]?_0x3c7e62[_0xd11a('0x8')][_0xd11a('0x16')]:{};return db[_0xd11a('0x7')][_0xd11a('0x1b')](_0x3c7e62[_0xd11a('0x19')],{'where':_0x5240a9,'transaction':_0x2afa69})['then'](function(_0x1c97d1){logger[_0xd11a('0x10')](_0xd11a('0x46'),_0x3c7e62);logger['debug'](_0xd11a('0x46'),_0x3c7e62,JSON[_0xd11a('0x1e')](_0x1c97d1));_0x26f1f0(_0x1c97d1);})[_0xd11a('0x12')](function(_0x61151e){logger[_0xd11a('0x13')]('ResetActiveCalls',_0x61151e[_0xd11a('0x14')],_0x3c7e62);_0x5a8c97(_0xd2ffa7['error'](0x1f4,_0x61151e['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x110fa7){var _0x3a9b2e=this;var _0x4d56f3=_0x110fa7[_0xd11a('0x19')]['where'][_0xd11a('0x47')];var _0x1f028e=_0x110fa7[_0xd11a('0x19')][_0xd11a('0x16')][_0xd11a('0x48')];var _0x481482=_0x110fa7[_0xd11a('0x19')][_0xd11a('0x16')][_0xd11a('0x49')];return new Promise(function(_0x2ddba4,_0x5eeb48){return db[_0xd11a('0x7')][_0xd11a('0x36')]({'where':{'voiceQueueId':{'$in':_0x4d56f3},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd11a('0x23')]['literal'](_0xd11a('0x4a')+_0x1f028e+'\x20MINUTE'),'$gt':db[_0xd11a('0x23')][_0xd11a('0x38')]('NOW()')}},'UserId':{'$in':_0x481482}},'include':[{'model':db[_0xd11a('0x22')],'as':_0xd11a('0x28')},{'model':db[_0xd11a('0x29')],'as':_0xd11a('0x4b'),'attributes':['id',_0xd11a('0x2a'),_0xd11a('0x2b')]},{'model':db[_0xd11a('0x4c')],'as':'List'}]})[_0xd11a('0xf')](function(_0x15d349){if(_0x15d349[_0xd11a('0x2c')]>0x0){return db[_0xd11a('0x23')]['transaction'](function(_0x54d3f3){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0xd11a('0x23')][_0xd11a('0x38')]('NOW()')},{'where':{'id':{'$in':_[_0xd11a('0xe')](_0x15d349,'id')}},'transaction':_0x54d3f3})[_0xd11a('0xf')](function(){_0x2ddba4(_0x15d349);})[_0xd11a('0x12')](function(_0x5e32c9){logger[_0xd11a('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x5e32c9[_0xd11a('0x14')],_0x110fa7);_0x5eeb48(_0x3a9b2e[_0xd11a('0x13')](0x1f4,_0x5e32c9[_0xd11a('0x14')]));});})['catch'](function(_0x59c21a){logger['error'](_0xd11a('0x4d'),_0x59c21a[_0xd11a('0x14')],_0x110fa7);_0x5eeb48(_0x3a9b2e[_0xd11a('0x13')](0x1f4,_0x59c21a[_0xd11a('0x14')]));});}else{_0x2ddba4(_0x15d349);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 695ee47..7e58f19 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 _0x2e37=['Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','getPreview','put','update','delete','destroy','exports'];(function(_0x160a45,_0x4aa7c9){var _0x421451=function(_0xd8d71f){while(--_0xd8d71f){_0x160a45['push'](_0x160a45['shift']());}};_0x421451(++_0x4aa7c9);}(_0x2e37,0xa1));var _0x72e3=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x2e37[_0x19b84f];return _0x18067b;};'use strict';var express=require('express');var router=express[_0x72e3('0x0')]();var auth=require(_0x72e3('0x1'));var controller=require(_0x72e3('0x2'));router[_0x72e3('0x3')]('/',auth[_0x72e3('0x4')](),controller[_0x72e3('0x5')]);router[_0x72e3('0x3')](_0x72e3('0x6'),auth[_0x72e3('0x4')](),controller[_0x72e3('0x7')]);router[_0x72e3('0x3')](_0x72e3('0x8'),auth['isAuthenticated'](),controller[_0x72e3('0x9')]);router[_0x72e3('0x3')](_0x72e3('0xa'),auth['isAuthenticated'](),controller[_0x72e3('0xb')]);router['get'](_0x72e3('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x72e3('0xd'),auth[_0x72e3('0x4')](),controller[_0x72e3('0xe')]);router[_0x72e3('0xf')]('/',auth[_0x72e3('0x4')](),controller[_0x72e3('0x10')]);router[_0x72e3('0xf')]('/preview',auth[_0x72e3('0x4')](),controller[_0x72e3('0x11')]);router[_0x72e3('0xf')]('/timezone',auth[_0x72e3('0x4')](),controller['getTimezone']);router[_0x72e3('0x12')](_0x72e3('0xc'),auth[_0x72e3('0x4')](),controller[_0x72e3('0x13')]);router[_0x72e3('0x14')](_0x72e3('0xc'),auth[_0x72e3('0x4')](),controller[_0x72e3('0x15')]);module[_0x72e3('0x16')]=router; \ No newline at end of file +var _0x98c9=['/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','post','/preview','getTimezone','put','/:id','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x47f975,_0x48b3e2){var _0x11fe5a=function(_0x2ec1f3){while(--_0x2ec1f3){_0x47f975['push'](_0x47f975['shift']());}};_0x11fe5a(++_0x48b3e2);}(_0x98c9,0x12f));var _0x998c=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x98c9[_0x292f93];return _0x5a94b1;};'use strict';var express=require(_0x998c('0x0'));var router=express[_0x998c('0x1')]();var auth=require(_0x998c('0x2'));var controller=require(_0x998c('0x3'));router[_0x998c('0x4')]('/',auth[_0x998c('0x5')](),controller[_0x998c('0x6')]);router['get'](_0x998c('0x7'),auth[_0x998c('0x5')](),controller[_0x998c('0x8')]);router[_0x998c('0x4')](_0x998c('0x9'),auth[_0x998c('0x5')](),controller[_0x998c('0xa')]);router[_0x998c('0x4')](_0x998c('0xb'),auth[_0x998c('0x5')](),controller[_0x998c('0xc')]);router['get']('/:id',auth[_0x998c('0x5')](),controller[_0x998c('0xd')]);router['get'](_0x998c('0xe'),auth[_0x998c('0x5')](),controller['getPreviewRecall']);router[_0x998c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x998c('0xf')](_0x998c('0x10'),auth[_0x998c('0x5')](),controller['getPreview']);router[_0x998c('0xf')]('/timezone',auth[_0x998c('0x5')](),controller[_0x998c('0x11')]);router[_0x998c('0x12')](_0x998c('0x13'),auth[_0x998c('0x5')](),controller[_0x998c('0x14')]);router[_0x998c('0x15')](_0x998c('0x13'),auth[_0x998c('0x5')](),controller[_0x998c('0x16')]);module[_0x998c('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 30ac90d..9d888c4 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 _0x9892=['moment','sequelize','exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x9892,0x188));var _0x2989=function(_0x4ff9e6,_0x2ce37a){_0x4ff9e6=_0x4ff9e6-0x0;var _0x4b4f6c=_0x9892[_0x4ff9e6];return _0x4b4f6c;};'use strict';var moment=require(_0x2989('0x0'));var Sequelize=require(_0x2989('0x1'));module[_0x2989('0x2')]={'CmHopperId':{'type':Sequelize[_0x2989('0x3')]},'phone':{'type':Sequelize[_0x2989('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x2989('0x5')](_0x2989('0x6'))},'countbusyretry':{'type':Sequelize[_0x2989('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2989('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2989('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2989('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2989('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4bae=['YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','INTEGER','DATE','format'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0x4bae,0xcd));var _0xe4ba=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0x4bae[_0x4a209a];return _0x4b3c20;};'use strict';var moment=require('moment');var Sequelize=require(_0xe4ba('0x0'));module[_0xe4ba('0x1')]={'CmHopperId':{'type':Sequelize[_0xe4ba('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xe4ba('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xe4ba('0x3')],'defaultValue':moment()[_0xe4ba('0x4')](_0xe4ba('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe4ba('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe4ba('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe4ba('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 101b542..e1c704c 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 _0x24e7=['query','keys','intersection','attributes','fields','length','order','sort','where','filters','merge','VIRTUAL','filter','include','findAll','catch','show','includeAll','options','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','CmHopperAdditionalPhones','destroy','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model'];(function(_0xe9cc36,_0x3aef0a){var _0x3caca7=function(_0x3e0109){while(--_0x3e0109){_0xe9cc36['push'](_0xe9cc36['shift']());}};_0x3caca7(++_0x3aef0a);}(_0x24e7,0x199));var _0x724e=function(_0x1a9e01,_0x3c2d01){_0x1a9e01=_0x1a9e01-0x0;var _0x4e16c7=_0x24e7[_0x1a9e01];return _0x4e16c7;};'use strict';var emlformat=require(_0x724e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x724e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x724e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x724e('0x3'));var util=require(_0x724e('0x4'));var path=require('path');var sox=require(_0x724e('0x5'));var csv=require(_0x724e('0x6'));var ejs=require(_0x724e('0x7'));var fs=require('fs');var fs_extra=require(_0x724e('0x8'));var _=require('lodash');var squel=require(_0x724e('0x9'));var crypto=require('crypto');var jsforce=require(_0x724e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x724e('0x6'));var querystring=require(_0x724e('0xb'));var Papa=require('papaparse');var Redis=require(_0x724e('0xc'));var authService=require(_0x724e('0xd'));var qs=require(_0x724e('0xe'));var as=require(_0x724e('0xf'));var hardwareService=require(_0x724e('0x10'));var logger=require(_0x724e('0x11'))(_0x724e('0x12'));var utils=require(_0x724e('0x13'));var config=require(_0x724e('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x115cd1,_0x2462be){_0x2462be=_0x2462be||0xcc;return function(_0x259306){if(_0x259306){return _0x115cd1[_0x724e('0x15')](_0x2462be);}return _0x115cd1[_0x724e('0x16')](_0x2462be)[_0x724e('0x17')]();};}function respondWithResult(_0x47da55,_0x3a4019){_0x3a4019=_0x3a4019||0xc8;return function(_0x116606){if(_0x116606){return _0x47da55[_0x724e('0x16')](_0x3a4019)[_0x724e('0x18')](_0x116606);}};}function respondWithFilteredResult(_0x11ee72,_0x15e48a){return function(_0x547670){if(_0x547670){var _0xed4a0=typeof _0x15e48a[_0x724e('0x19')]==='undefined'&&typeof _0x15e48a[_0x724e('0x1a')]==='undefined';var _0x309e14=_0x547670[_0x724e('0x1b')];var _0x6b53cb=_0xed4a0?0x0:_0x15e48a[_0x724e('0x19')];var _0xd7c54c=_0xed4a0?_0x547670[_0x724e('0x1b')]:_0x15e48a['offset']+_0x15e48a[_0x724e('0x1a')];var _0xa42aae;if(_0xd7c54c>=_0x309e14){_0xd7c54c=_0x309e14;_0xa42aae=0xc8;}else{_0xa42aae=0xce;}_0x11ee72[_0x724e('0x16')](_0xa42aae);return _0x11ee72[_0x724e('0x1c')]('Content-Range',_0x6b53cb+'-'+_0xd7c54c+'/'+_0x309e14)[_0x724e('0x18')](_0x547670);}return null;};}function patchUpdates(_0x1e211e){return function(_0x4e3fcb){try{jsonpatch[_0x724e('0x1d')](_0x4e3fcb,_0x1e211e,!![]);}catch(_0x5dd88b){return BPromise[_0x724e('0x1e')](_0x5dd88b);}return _0x4e3fcb[_0x724e('0x1f')]();};}function saveUpdates(_0x35ddc6,_0x489b06){return function(_0x322c50){if(_0x322c50){return _0x322c50[_0x724e('0x20')](_0x35ddc6)['then'](function(_0x48997e){return _0x48997e;});}return null;};}function removeEntity(_0x2f2007,_0x220b39){return function(_0x48912a){if(_0x48912a){return _0x48912a['destroy']()[_0x724e('0x21')](function(){var _0x168143=_0x48912a['get']({'plain':!![]});var _0x1b602b=_0x724e('0x22');return db['UserProfileResource'][_0x724e('0x23')]({'where':{'type':_0x1b602b,'resourceId':_0x168143['id']}})[_0x724e('0x21')](function(){return _0x48912a;});})[_0x724e('0x21')](function(){_0x2f2007[_0x724e('0x16')](0xcc)[_0x724e('0x17')]();});}};}function handleEntityNotFound(_0x3fdd93,_0x4903b7){return function(_0x258ce7){if(!_0x258ce7){_0x3fdd93['sendStatus'](0x194);}return _0x258ce7;};}function handleError(_0x26ac85,_0x26f677){_0x26f677=_0x26f677||0x1f4;return function(_0xbd8d6c){logger[_0x724e('0x24')](_0xbd8d6c[_0x724e('0x25')]);if(_0xbd8d6c[_0x724e('0x26')]){delete _0xbd8d6c[_0x724e('0x26')];}_0x26ac85[_0x724e('0x16')](_0x26f677)[_0x724e('0x27')](_0xbd8d6c);};}exports['index']=function(_0x2255f1,_0x5ec9ab){var _0x4b1b41={},_0x5dec65={},_0xe78e65={'count':0x0,'rows':[]};var _0x46a15e=_[_0x724e('0x28')](db[_0x724e('0x29')][_0x724e('0x2a')],function(_0x1ff65a){return{'name':_0x1ff65a[_0x724e('0x2b')],'type':_0x1ff65a[_0x724e('0x2c')][_0x724e('0x2d')]};});_0x5dec65[_0x724e('0x2e')]=_[_0x724e('0x28')](_0x46a15e,'name');_0x5dec65[_0x724e('0x2f')]=_[_0x724e('0x30')](_0x2255f1[_0x724e('0x2f')]);_0x5dec65['filters']=_[_0x724e('0x31')](_0x5dec65[_0x724e('0x2e')],_0x5dec65[_0x724e('0x2f')]);_0x4b1b41[_0x724e('0x32')]=_[_0x724e('0x31')](_0x5dec65[_0x724e('0x2e')],qs[_0x724e('0x33')](_0x2255f1[_0x724e('0x2f')]['fields']));_0x4b1b41[_0x724e('0x32')]=_0x4b1b41[_0x724e('0x32')][_0x724e('0x34')]?_0x4b1b41[_0x724e('0x32')]:_0x5dec65[_0x724e('0x2e')];if(!_0x2255f1['query']['hasOwnProperty']('nolimit')){_0x4b1b41['limit']=qs['limit'](_0x2255f1[_0x724e('0x2f')][_0x724e('0x1a')]);_0x4b1b41[_0x724e('0x19')]=qs[_0x724e('0x19')](_0x2255f1[_0x724e('0x2f')][_0x724e('0x19')]);}_0x4b1b41[_0x724e('0x35')]=qs[_0x724e('0x36')](_0x2255f1[_0x724e('0x2f')][_0x724e('0x36')]);_0x4b1b41[_0x724e('0x37')]=qs[_0x724e('0x38')](_['pick'](_0x2255f1[_0x724e('0x2f')],_0x5dec65[_0x724e('0x38')]),_0x46a15e);if(_0x2255f1[_0x724e('0x2f')]['filter']){_0x4b1b41['where']=_[_0x724e('0x39')](_0x4b1b41[_0x724e('0x37')],{'$or':_[_0x724e('0x28')](_0x46a15e,function(_0x273030){if(_0x273030[_0x724e('0x2c')]!==_0x724e('0x3a')){var _0x427d83={};_0x427d83[_0x273030[_0x724e('0x26')]]={'$like':'%'+_0x2255f1[_0x724e('0x2f')][_0x724e('0x3b')]+'%'};return _0x427d83;}})});}_0x4b1b41=_['merge']({},_0x4b1b41,_0x2255f1['options']);var _0x39d8a5={'where':_0x4b1b41[_0x724e('0x37')]};return db[_0x724e('0x29')][_0x724e('0x1b')](_0x39d8a5)[_0x724e('0x21')](function(_0x4a606){_0xe78e65[_0x724e('0x1b')]=_0x4a606;if(_0x2255f1['query']['includeAll']){_0x4b1b41[_0x724e('0x3c')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x724e('0x3d')](_0x4b1b41);})[_0x724e('0x21')](function(_0xa65d){_0xe78e65['rows']=_0xa65d;return _0xe78e65;})['then'](respondWithFilteredResult(_0x5ec9ab,_0x4b1b41))[_0x724e('0x3e')](handleError(_0x5ec9ab,null));};exports[_0x724e('0x3f')]=function(_0x249cc2,_0x32263d){var _0x156ea6={'raw':!![],'where':{'id':_0x249cc2['params']['id']}},_0x327add={};_0x327add[_0x724e('0x2e')]=_[_0x724e('0x30')](db[_0x724e('0x29')]['rawAttributes']);_0x327add[_0x724e('0x2f')]=_['keys'](_0x249cc2[_0x724e('0x2f')]);_0x327add['filters']=_['intersection'](_0x327add[_0x724e('0x2e')],_0x327add[_0x724e('0x2f')]);_0x156ea6['attributes']=_[_0x724e('0x31')](_0x327add[_0x724e('0x2e')],qs['fields'](_0x249cc2['query'][_0x724e('0x33')]));_0x156ea6[_0x724e('0x32')]=_0x156ea6['attributes'][_0x724e('0x34')]?_0x156ea6[_0x724e('0x32')]:_0x327add[_0x724e('0x2e')];if(_0x249cc2['query'][_0x724e('0x40')]){_0x156ea6[_0x724e('0x3c')]=[{'all':!![]}];}_0x156ea6=_['merge']({},_0x156ea6,_0x249cc2[_0x724e('0x41')]);return db['CmHopperAdditionalPhone'][_0x724e('0x42')](_0x156ea6)[_0x724e('0x21')](handleEntityNotFound(_0x32263d,null))[_0x724e('0x21')](respondWithResult(_0x32263d,null))[_0x724e('0x3e')](handleError(_0x32263d,null));};exports[_0x724e('0x43')]=function(_0x5c6120,_0x51c8b0){return db['CmHopperAdditionalPhone']['create'](_0x5c6120[_0x724e('0x44')],{})['then'](function(_0x106909){var _0x16407a=_0x5c6120['user']['get']({'plain':!![]});if(!_0x16407a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16407a['role']===_0x724e('0x45')){var _0x28ee4c=_0x106909[_0x724e('0x46')]({'plain':!![]});var _0x1f6d53=_0x724e('0x22');return db[_0x724e('0x47')][_0x724e('0x42')]({'where':{'name':_0x1f6d53,'userProfileId':_0x16407a[_0x724e('0x48')]},'raw':!![]})[_0x724e('0x21')](function(_0x471ea2){if(_0x471ea2&&_0x471ea2[_0x724e('0x49')]===0x0){return db['UserProfileResource'][_0x724e('0x43')]({'name':_0x28ee4c[_0x724e('0x26')],'resourceId':_0x28ee4c['id'],'type':_0x471ea2[_0x724e('0x26')],'sectionId':_0x471ea2['id']},{})[_0x724e('0x21')](function(){return _0x106909;});}else{return _0x106909;}})[_0x724e('0x3e')](function(_0x2b395c){logger[_0x724e('0x24')](_0x724e('0x4a'),_0x2b395c);throw _0x2b395c;});}return _0x106909;})[_0x724e('0x21')](respondWithResult(_0x51c8b0,0xc9))[_0x724e('0x3e')](handleError(_0x51c8b0,null));};exports[_0x724e('0x20')]=function(_0x139813,_0x23dcd0){if(_0x139813['body']['id']){delete _0x139813['body']['id'];}return db[_0x724e('0x29')][_0x724e('0x42')]({'where':{'id':_0x139813[_0x724e('0x4b')]['id']}})[_0x724e('0x21')](handleEntityNotFound(_0x23dcd0,null))[_0x724e('0x21')](saveUpdates(_0x139813[_0x724e('0x44')],null))[_0x724e('0x21')](respondWithResult(_0x23dcd0,null))[_0x724e('0x3e')](handleError(_0x23dcd0,null));};exports[_0x724e('0x23')]=function(_0x567389,_0x9c788a){return db['CmHopperAdditionalPhone'][_0x724e('0x42')]({'where':{'id':_0x567389[_0x724e('0x4b')]['id']}})[_0x724e('0x21')](handleEntityNotFound(_0x9c788a,null))['then'](removeEntity(_0x9c788a,null))[_0x724e('0x3e')](handleError(_0x9c788a,null));}; \ No newline at end of file +var _0x8d69=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','then','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','CmHopperAdditionalPhone','includeAll','include','catch','show','params','merge','find','create','body','user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x8d69,0x12b));var _0x98d6=function(_0xe14629,_0x1624ad){_0xe14629=_0xe14629-0x0;var _0x4d5eff=_0x8d69[_0xe14629];return _0x4d5eff;};'use strict';var emlformat=require(_0x98d6('0x0'));var rimraf=require(_0x98d6('0x1'));var zipdir=require(_0x98d6('0x2'));var jsonpatch=require(_0x98d6('0x3'));var rp=require(_0x98d6('0x4'));var moment=require(_0x98d6('0x5'));var BPromise=require(_0x98d6('0x6'));var Mustache=require(_0x98d6('0x7'));var util=require(_0x98d6('0x8'));var path=require('path');var sox=require(_0x98d6('0x9'));var csv=require(_0x98d6('0xa'));var ejs=require(_0x98d6('0xb'));var fs=require('fs');var fs_extra=require(_0x98d6('0xc'));var _=require('lodash');var squel=require(_0x98d6('0xd'));var crypto=require('crypto');var jsforce=require(_0x98d6('0xe'));var deskjs=require(_0x98d6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x98d6('0x10'));var Papa=require(_0x98d6('0x11'));var Redis=require('ioredis');var authService=require(_0x98d6('0x12'));var qs=require(_0x98d6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98d6('0x14'));var logger=require(_0x98d6('0x15'))(_0x98d6('0x16'));var utils=require(_0x98d6('0x17'));var config=require(_0x98d6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x98d6('0x19'))['db'];function respondWithStatusCode(_0x50d72b,_0x5ac388){_0x5ac388=_0x5ac388||0xcc;return function(_0x2bf2f3){if(_0x2bf2f3){return _0x50d72b['sendStatus'](_0x5ac388);}return _0x50d72b[_0x98d6('0x1a')](_0x5ac388)[_0x98d6('0x1b')]();};}function respondWithResult(_0x545fcc,_0x1ee626){_0x1ee626=_0x1ee626||0xc8;return function(_0x44ab56){if(_0x44ab56){return _0x545fcc[_0x98d6('0x1a')](_0x1ee626)[_0x98d6('0x1c')](_0x44ab56);}};}function respondWithFilteredResult(_0x5f33b9,_0x9ab5e8){return function(_0x3dd103){if(_0x3dd103){var _0x2c33b7=typeof _0x9ab5e8[_0x98d6('0x1d')]===_0x98d6('0x1e')&&typeof _0x9ab5e8[_0x98d6('0x1f')]===_0x98d6('0x1e');var _0x4325bc=_0x3dd103[_0x98d6('0x20')];var _0x335705=_0x2c33b7?0x0:_0x9ab5e8['offset'];var _0x1f1cfd=_0x2c33b7?_0x3dd103['count']:_0x9ab5e8[_0x98d6('0x1d')]+_0x9ab5e8['limit'];var _0x8c1069;if(_0x1f1cfd>=_0x4325bc){_0x1f1cfd=_0x4325bc;_0x8c1069=0xc8;}else{_0x8c1069=0xce;}_0x5f33b9[_0x98d6('0x1a')](_0x8c1069);return _0x5f33b9[_0x98d6('0x21')]('Content-Range',_0x335705+'-'+_0x1f1cfd+'/'+_0x4325bc)[_0x98d6('0x1c')](_0x3dd103);}return null;};}function patchUpdates(_0xf5dbd7){return function(_0x241c60){try{jsonpatch['apply'](_0x241c60,_0xf5dbd7,!![]);}catch(_0x4e95fd){return BPromise[_0x98d6('0x22')](_0x4e95fd);}return _0x241c60[_0x98d6('0x23')]();};}function saveUpdates(_0x1c76c9,_0x15b273){return function(_0x20e085){if(_0x20e085){return _0x20e085['update'](_0x1c76c9)['then'](function(_0x1825d1){return _0x1825d1;});}return null;};}function removeEntity(_0x3dc08e,_0x285364){return function(_0x2e1a36){if(_0x2e1a36){return _0x2e1a36['destroy']()[_0x98d6('0x24')](function(){var _0x163031=_0x2e1a36['get']({'plain':!![]});var _0x4f0531=_0x98d6('0x25');return db[_0x98d6('0x26')]['destroy']({'where':{'type':_0x4f0531,'resourceId':_0x163031['id']}})[_0x98d6('0x24')](function(){return _0x2e1a36;});})[_0x98d6('0x24')](function(){_0x3dc08e[_0x98d6('0x1a')](0xcc)[_0x98d6('0x1b')]();});}};}function handleEntityNotFound(_0x5b025a,_0xf8ea84){return function(_0xf8729b){if(!_0xf8729b){_0x5b025a['sendStatus'](0x194);}return _0xf8729b;};}function handleError(_0x2b22a4,_0x1bc168){_0x1bc168=_0x1bc168||0x1f4;return function(_0x3e50ff){logger[_0x98d6('0x27')](_0x3e50ff[_0x98d6('0x28')]);if(_0x3e50ff[_0x98d6('0x29')]){delete _0x3e50ff[_0x98d6('0x29')];}_0x2b22a4[_0x98d6('0x1a')](_0x1bc168)['send'](_0x3e50ff);};}exports['index']=function(_0x19ce1b,_0x5d472e){var _0x11ddc4={},_0x568951={},_0xb21dda={'count':0x0,'rows':[]};var _0x9cd656=_[_0x98d6('0x2a')](db['CmHopperAdditionalPhone'][_0x98d6('0x2b')],function(_0x2a17cf){return{'name':_0x2a17cf[_0x98d6('0x2c')],'type':_0x2a17cf['type']['key']};});_0x568951[_0x98d6('0x2d')]=_[_0x98d6('0x2a')](_0x9cd656,_0x98d6('0x29'));_0x568951[_0x98d6('0x2e')]=_[_0x98d6('0x2f')](_0x19ce1b['query']);_0x568951[_0x98d6('0x30')]=_[_0x98d6('0x31')](_0x568951['model'],_0x568951[_0x98d6('0x2e')]);_0x11ddc4['attributes']=_[_0x98d6('0x31')](_0x568951[_0x98d6('0x2d')],qs[_0x98d6('0x32')](_0x19ce1b[_0x98d6('0x2e')][_0x98d6('0x32')]));_0x11ddc4['attributes']=_0x11ddc4[_0x98d6('0x33')][_0x98d6('0x34')]?_0x11ddc4['attributes']:_0x568951[_0x98d6('0x2d')];if(!_0x19ce1b[_0x98d6('0x2e')][_0x98d6('0x35')](_0x98d6('0x36'))){_0x11ddc4['limit']=qs['limit'](_0x19ce1b[_0x98d6('0x2e')]['limit']);_0x11ddc4['offset']=qs[_0x98d6('0x1d')](_0x19ce1b[_0x98d6('0x2e')]['offset']);}_0x11ddc4[_0x98d6('0x37')]=qs[_0x98d6('0x38')](_0x19ce1b[_0x98d6('0x2e')][_0x98d6('0x38')]);_0x11ddc4[_0x98d6('0x39')]=qs[_0x98d6('0x30')](_[_0x98d6('0x3a')](_0x19ce1b[_0x98d6('0x2e')],_0x568951[_0x98d6('0x30')]),_0x9cd656);if(_0x19ce1b[_0x98d6('0x2e')][_0x98d6('0x3b')]){_0x11ddc4[_0x98d6('0x39')]=_['merge'](_0x11ddc4['where'],{'$or':_[_0x98d6('0x2a')](_0x9cd656,function(_0x223f93){if(_0x223f93[_0x98d6('0x3c')]!=='VIRTUAL'){var _0x2e30bf={};_0x2e30bf[_0x223f93['name']]={'$like':'%'+_0x19ce1b[_0x98d6('0x2e')][_0x98d6('0x3b')]+'%'};return _0x2e30bf;}})});}_0x11ddc4=_['merge']({},_0x11ddc4,_0x19ce1b[_0x98d6('0x3d')]);var _0x3c4b80={'where':_0x11ddc4[_0x98d6('0x39')]};return db[_0x98d6('0x3e')]['count'](_0x3c4b80)['then'](function(_0x5ab363){_0xb21dda[_0x98d6('0x20')]=_0x5ab363;if(_0x19ce1b['query'][_0x98d6('0x3f')]){_0x11ddc4[_0x98d6('0x40')]=[{'all':!![]}];}return db[_0x98d6('0x3e')]['findAll'](_0x11ddc4);})[_0x98d6('0x24')](function(_0xa4c227){_0xb21dda['rows']=_0xa4c227;return _0xb21dda;})[_0x98d6('0x24')](respondWithFilteredResult(_0x5d472e,_0x11ddc4))[_0x98d6('0x41')](handleError(_0x5d472e,null));};exports[_0x98d6('0x42')]=function(_0x392f59,_0xd4d56e){var _0xcf206c={'raw':!![],'where':{'id':_0x392f59[_0x98d6('0x43')]['id']}},_0x43cae7={};_0x43cae7[_0x98d6('0x2d')]=_[_0x98d6('0x2f')](db[_0x98d6('0x3e')][_0x98d6('0x2b')]);_0x43cae7[_0x98d6('0x2e')]=_[_0x98d6('0x2f')](_0x392f59[_0x98d6('0x2e')]);_0x43cae7['filters']=_[_0x98d6('0x31')](_0x43cae7['model'],_0x43cae7[_0x98d6('0x2e')]);_0xcf206c[_0x98d6('0x33')]=_[_0x98d6('0x31')](_0x43cae7['model'],qs[_0x98d6('0x32')](_0x392f59[_0x98d6('0x2e')][_0x98d6('0x32')]));_0xcf206c[_0x98d6('0x33')]=_0xcf206c['attributes'][_0x98d6('0x34')]?_0xcf206c[_0x98d6('0x33')]:_0x43cae7[_0x98d6('0x2d')];if(_0x392f59[_0x98d6('0x2e')]['includeAll']){_0xcf206c[_0x98d6('0x40')]=[{'all':!![]}];}_0xcf206c=_[_0x98d6('0x44')]({},_0xcf206c,_0x392f59[_0x98d6('0x3d')]);return db[_0x98d6('0x3e')][_0x98d6('0x45')](_0xcf206c)[_0x98d6('0x24')](handleEntityNotFound(_0xd4d56e,null))[_0x98d6('0x24')](respondWithResult(_0xd4d56e,null))[_0x98d6('0x41')](handleError(_0xd4d56e,null));};exports['create']=function(_0x4ac9ea,_0x33dae3){return db[_0x98d6('0x3e')][_0x98d6('0x46')](_0x4ac9ea[_0x98d6('0x47')],{})[_0x98d6('0x24')](function(_0x55b0fd){var _0x2c8089=_0x4ac9ea[_0x98d6('0x48')]['get']({'plain':!![]});if(!_0x2c8089)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c8089[_0x98d6('0x49')]==='user'){var _0x3276c4=_0x55b0fd[_0x98d6('0x4a')]({'plain':!![]});var _0x27fc87='CmHopperAdditionalPhones';return db['UserProfileSection']['find']({'where':{'name':_0x27fc87,'userProfileId':_0x2c8089[_0x98d6('0x4b')]},'raw':!![]})[_0x98d6('0x24')](function(_0x4ac0f6){if(_0x4ac0f6&&_0x4ac0f6[_0x98d6('0x4c')]===0x0){return db[_0x98d6('0x26')][_0x98d6('0x46')]({'name':_0x3276c4[_0x98d6('0x29')],'resourceId':_0x3276c4['id'],'type':_0x4ac0f6[_0x98d6('0x29')],'sectionId':_0x4ac0f6['id']},{})[_0x98d6('0x24')](function(){return _0x55b0fd;});}else{return _0x55b0fd;}})['catch'](function(_0x14cfb0){logger[_0x98d6('0x27')](_0x98d6('0x4d'),_0x14cfb0);throw _0x14cfb0;});}return _0x55b0fd;})[_0x98d6('0x24')](respondWithResult(_0x33dae3,0xc9))[_0x98d6('0x41')](handleError(_0x33dae3,null));};exports[_0x98d6('0x4e')]=function(_0x30e16d,_0xc36673){if(_0x30e16d[_0x98d6('0x47')]['id']){delete _0x30e16d[_0x98d6('0x47')]['id'];}return db[_0x98d6('0x3e')][_0x98d6('0x45')]({'where':{'id':_0x30e16d[_0x98d6('0x43')]['id']}})['then'](handleEntityNotFound(_0xc36673,null))[_0x98d6('0x24')](saveUpdates(_0x30e16d[_0x98d6('0x47')],null))[_0x98d6('0x24')](respondWithResult(_0xc36673,null))['catch'](handleError(_0xc36673,null));};exports[_0x98d6('0x4f')]=function(_0x3ae4ce,_0x4d062d){return db[_0x98d6('0x3e')][_0x98d6('0x45')]({'where':{'id':_0x3ae4ce[_0x98d6('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d062d,null))[_0x98d6('0x24')](removeEntity(_0x4d062d,null))[_0x98d6('0x41')](handleError(_0x4d062d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 7a2cd33..982f2b1 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 _0x99a3=['CmHopperAdditionalPhone','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2adfb1,_0x406e6e){var _0xa52d45=function(_0x2de16c){while(--_0x2de16c){_0x2adfb1['push'](_0x2adfb1['shift']());}};_0xa52d45(++_0x406e6e);}(_0x99a3,0x14b));var _0x399a=function(_0x532a08,_0x1079ab){_0x532a08=_0x532a08-0x0;var _0xd9c5ee=_0x99a3[_0x532a08];return _0xd9c5ee;};'use strict';var _=require(_0x399a('0x0'));var util=require(_0x399a('0x1'));var logger=require(_0x399a('0x2'))(_0x399a('0x3'));var moment=require('moment');var BPromise=require(_0x399a('0x4'));var rp=require(_0x399a('0x5'));var fs=require('fs');var path=require(_0x399a('0x6'));var rimraf=require('rimraf');var config=require(_0x399a('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x399a('0x8')]=function(_0x3762a4,_0x52e383){return _0x3762a4[_0x399a('0x9')](_0x399a('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d3b=['path','rimraf','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','api','moment','bluebird','request-promise'];(function(_0x515f8e,_0x4aef2c){var _0x5553cd=function(_0x473144){while(--_0x473144){_0x515f8e['push'](_0x515f8e['shift']());}};_0x5553cd(++_0x4aef2c);}(_0x7d3b,0x1d9));var _0xb7d3=function(_0x5a326b,_0x5a6263){_0x5a326b=_0x5a326b-0x0;var _0x2d41db=_0x7d3b[_0x5a326b];return _0x2d41db;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb7d3('0x0'));var moment=require(_0xb7d3('0x1'));var BPromise=require(_0xb7d3('0x2'));var rp=require(_0xb7d3('0x3'));var fs=require('fs');var path=require(_0xb7d3('0x4'));var rimraf=require(_0xb7d3('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x4f9d59,_0x2588a6){return _0x4f9d59[_0xb7d3('0x6')](_0xb7d3('0x7'),attributes,{'tableName':_0xb7d3('0x8'),'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 ed73e27..852bfd6 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 _0xe3f6=['phone','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','duration','waitTime','scheduledat','minutes','add','isNil','countcongestionretry','updatedAt','createdAt','sequelize','update'];(function(_0x1259a0,_0x1f3316){var _0x1a8ff2=function(_0x502de8){while(--_0x502de8){_0x1259a0['push'](_0x1259a0['shift']());}};_0x1a8ff2(++_0x1f3316);}(_0xe3f6,0x7a));var _0x6e3f=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xe3f6[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x6e3f('0x0'));var util=require(_0x6e3f('0x1'));var moment=require('moment');var BPromise=require(_0x6e3f('0x2'));var rs=require(_0x6e3f('0x3'));var fs=require('fs');var Redis=require(_0x6e3f('0x4'));var db=require(_0x6e3f('0x5'))['db'];var utils=require(_0x6e3f('0x6'));var logger=require(_0x6e3f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6e3f('0x8'));var client=jayson[_0x6e3f('0x9')][_0x6e3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5537fa,_0x194421,_0x3d7842){return new BPromise(function(_0x4fd676,_0x319277){return client[_0x6e3f('0xb')](_0x5537fa,_0x3d7842)[_0x6e3f('0xc')](function(_0x432316){logger['info'](_0x6e3f('0xd'),_0x194421,_0x6e3f('0xe'));logger[_0x6e3f('0xf')](_0x6e3f('0x10'),_0x194421,_0x6e3f('0xe'),JSON[_0x6e3f('0x11')](_0x432316));if(_0x432316[_0x6e3f('0x12')]){if(_0x432316['error'][_0x6e3f('0x13')]===0x1f4){logger[_0x6e3f('0x12')](_0x6e3f('0xd'),_0x194421,_0x432316['error']['message']);return _0x319277(_0x432316[_0x6e3f('0x12')][_0x6e3f('0x14')]);}logger[_0x6e3f('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x194421,_0x432316['error'][_0x6e3f('0x14')]);return _0x4fd676(_0x432316['error'][_0x6e3f('0x14')]);}else{logger[_0x6e3f('0x15')](_0x6e3f('0xd'),_0x194421,'request\x20sent');_0x4fd676(_0x432316[_0x6e3f('0x16')][_0x6e3f('0x14')]);}})[_0x6e3f('0x17')](function(_0x3157ce){logger[_0x6e3f('0x12')](_0x6e3f('0xd'),_0x194421,_0x3157ce);_0x319277(_0x3157ce);});});}exports[_0x6e3f('0x18')]=function(_0xa3897){var _0x311d7c=this;return new Promise(function(_0x30626c,_0x522799){return db[_0x6e3f('0x19')][_0x6e3f('0x1a')]({'raw':!![],'where':{'ContactId':_0xa3897[_0x6e3f('0x1b')][_0x6e3f('0x1c')],'ListId':_0xa3897[_0x6e3f('0x1b')][_0x6e3f('0x1d')],'VoiceQueueId':_0xa3897[_0x6e3f('0x1b')]['VoiceQueueId']===undefined?null:_0xa3897['body'][_0x6e3f('0x1e')],'CampaignId':_0xa3897['body'][_0x6e3f('0x1f')]===undefined?null:_0xa3897[_0x6e3f('0x1b')][_0x6e3f('0x1f')]}})[_0x6e3f('0xc')](function(_0x630614){if(_0x630614!=null){return db[_0x6e3f('0x20')][_0x6e3f('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x630614['id'],'OrderBy':{'$gt':_0x630614[_0x6e3f('0x21')]}},'order':[[_0x6e3f('0x21'),'ASC']]})['then'](function(_0x43155e){var _0x5240ce=0x0;if(_0x43155e){if(_0x43155e[_0x6e3f('0x22')]+_0x43155e['countcongestionretry']+_0x43155e[_0x6e3f('0x23')]+_0x43155e['countnosuchnumberretry']+_0x43155e[_0x6e3f('0x24')]+_0x43155e['countabandonedretry']+_0x43155e[_0x6e3f('0x25')]+_0x43155e['countagentrejectretry']<_0xa3897['entity']['dialGlobalMaxRetry'])_0x5240ce=0x1;_0x30626c({'additional':_0x5240ce});}else{return db['CmHopperAdditionalPhone'][_0x6e3f('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x630614['id']},'order':[['OrderBy','ASC']]})['then'](function(_0x291581){var _0x4d5d48=0x0;if(_0x291581){if(_0x291581[_0x6e3f('0x22')]+_0x291581['countcongestionretry']+_0x291581[_0x6e3f('0x23')]+_0x291581[_0x6e3f('0x26')]+_0x291581[_0x6e3f('0x24')]+_0x291581[_0x6e3f('0x27')]+_0x291581[_0x6e3f('0x25')]+_0x291581[_0x6e3f('0x28')]<_0xa3897[_0x6e3f('0x29')][_0x6e3f('0x2a')])_0x4d5d48=0x1;_0x30626c({'additional':_0x4d5d48});}else{_0x30626c({'additional':0x0});}})['catch'](function(_0x52adc4){logger[_0x6e3f('0x12')](_0x6e3f('0x18'),_0x52adc4[_0x6e3f('0x14')]);_0x522799(_0x311d7c[_0x6e3f('0x12')](0x1f4,_0x52adc4[_0x6e3f('0x14')]));});}})[_0x6e3f('0x17')](function(_0x4b96a8){logger[_0x6e3f('0x12')]('VerifyAdditionalPhones',_0x4b96a8[_0x6e3f('0x14')]);_0x522799(_0x311d7c[_0x6e3f('0x12')](0x1f4,_0x4b96a8[_0x6e3f('0x14')]));});}else _0x30626c({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x4b12a5){var _0x19134f=this;return new Promise(function(_0x338a9c,_0x3a4c34){return db['CmHopper'][_0x6e3f('0x1a')]({'raw':!![],'where':{'ContactId':_0x4b12a5[_0x6e3f('0x1b')][_0x6e3f('0x1c')],'ListId':_0x4b12a5[_0x6e3f('0x1b')]['ListId'],'VoiceQueueId':_0x4b12a5['body'][_0x6e3f('0x1e')]===undefined?null:_0x4b12a5[_0x6e3f('0x1b')][_0x6e3f('0x1e')],'CampaignId':_0x4b12a5['body'][_0x6e3f('0x1f')]===undefined?null:_0x4b12a5[_0x6e3f('0x1b')][_0x6e3f('0x1f')]}})['then'](function(_0x2fe03c){if(_0x2fe03c!=null){return db[_0x6e3f('0x20')][_0x6e3f('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x2fe03c['id'],'OrderBy':{'$gte':_0x2fe03c[_0x6e3f('0x21')]}},'order':[[_0x6e3f('0x21'),_0x6e3f('0x2b')]]})[_0x6e3f('0xc')](function(_0x43afb7){if(_0x43afb7)return activateAdditionalPhone(_0x2fe03c,_0x4b12a5[_0x6e3f('0x1b')],_0x43afb7,_0x4b12a5[_0x6e3f('0x2c')],_0x4b12a5[_0x6e3f('0x2d')])[_0x6e3f('0xc')](function(_0x54bfba){_0x338a9c(_0x54bfba);});else{return db['CmHopperAdditionalPhone'][_0x6e3f('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x2fe03c['id']},'order':[[_0x6e3f('0x21'),_0x6e3f('0x2b')]]})['then'](function(_0x4ed2b4){if(_0x4ed2b4)return activateAdditionalPhone(_0x2fe03c,_0x4b12a5[_0x6e3f('0x1b')],_0x4ed2b4,_0x4b12a5['duration'],_0x4b12a5['waitTime'])[_0x6e3f('0xc')](function(_0x38d79d){_0x338a9c(_0x38d79d);});else{_0x338a9c({'id':_0x2fe03c['id'],'phone':''});}})[_0x6e3f('0x17')](function(_0x3f41be){logger[_0x6e3f('0x12')](_0x6e3f('0x18'),_0x3f41be[_0x6e3f('0x14')]);_0x3a4c34(_0x19134f[_0x6e3f('0x12')](0x1f4,_0x3f41be[_0x6e3f('0x14')]));});}})[_0x6e3f('0x17')](function(_0x2a4646){logger[_0x6e3f('0x12')](_0x6e3f('0x18'),_0x2a4646[_0x6e3f('0x14')]);_0x3a4c34(_0x19134f[_0x6e3f('0x12')](0x1f4,_0x2a4646[_0x6e3f('0x14')]));});}else _0x338a9c(0x1);});});};function activateAdditionalPhone(_0x4c2084,_0x25040b,_0x3fb2a6,_0x13d347,_0x4c5f76){return new Promise(function(_0x432e70,_0x15c9b3){var _0xf063d5;if(_['isNil'](_0x3fb2a6[_0x6e3f('0x2e')])){_0x3fb2a6['scheduledat']=moment();}if(moment()>moment(_0x3fb2a6[_0x6e3f('0x2e')])){_0xf063d5=moment()['add'](_0x4c5f76||0x3,_0x6e3f('0x2f'));}else{if(_0x3fb2a6[_0x6e3f('0x21')]==0x0){_0xf063d5=moment(_0x3fb2a6[_0x6e3f('0x2e')]);}else{_0xf063d5=moment()[_0x6e3f('0x30')](_0x4c5f76||0x3,_0x6e3f('0x2f'));}}if(_['isNil'](_0xf063d5)){_0xf063d5=moment()[_0x6e3f('0x30')](_0x4c5f76||0x3,_0x6e3f('0x2f'));}var _0x3d742e={'phone':_0x4c2084['phone'],'active':0x0,'OrderBy':_[_0x6e3f('0x31')](_0x4c2084[_0x6e3f('0x21')])?0x0:_0x4c2084['OrderBy'],'scheduledat':moment()[_0x6e3f('0x30')](_0x13d347||0x1,'minutes'),'countbusyretry':_0x25040b[_0x6e3f('0x22')],'countcongestionretry':_0x25040b[_0x6e3f('0x32')],'countnoanswerretry':_0x25040b[_0x6e3f('0x23')],'countnosuchnumberretry':_0x25040b[_0x6e3f('0x26')],'countdropretry':_0x25040b[_0x6e3f('0x24')],'countabandonedretry':_0x25040b[_0x6e3f('0x27')],'countmachineretry':_0x25040b[_0x6e3f('0x25')],'countagentrejectretry':_0x25040b[_0x6e3f('0x28')],'createdAt':_0x25040b['createdAt'],'updatedAt':_0x25040b[_0x6e3f('0x33')]};var _0x1e1b1f={'CmHopperId':_0x4c2084['id'],'phone':_0x3fb2a6['phone'],'active':0x0,'OrderBy':_[_0x6e3f('0x31')](_0x3fb2a6['OrderBy'])?0x0:_0x3fb2a6['OrderBy'],'scheduledat':_0xf063d5,'countbusyretry':_0x3fb2a6['countbusyretry'],'countcongestionretry':_0x3fb2a6[_0x6e3f('0x32')],'countnoanswerretry':_0x3fb2a6[_0x6e3f('0x23')],'countnosuchnumberretry':_0x3fb2a6[_0x6e3f('0x26')],'countdropretry':_0x3fb2a6[_0x6e3f('0x24')],'countabandonedretry':_0x3fb2a6['countabandonedretry'],'countmachineretry':_0x3fb2a6[_0x6e3f('0x25')],'countagentrejectretry':_0x3fb2a6[_0x6e3f('0x28')],'createdAt':_0x3fb2a6[_0x6e3f('0x34')],'updatedAt':_0x3fb2a6['updatedAt']};return db[_0x6e3f('0x35')]['transaction'](function(_0x389457){return db[_0x6e3f('0x20')][_0x6e3f('0x36')](_0x3d742e,{'where':{'id':_0x3fb2a6['id']}},{'transaction':_0x389457})['then'](function(){return db[_0x6e3f('0x19')]['update'](_0x1e1b1f,{'where':{'id':_0x4c2084['id']}},{'transaction':_0x389457});});})[_0x6e3f('0xc')](function(_0x299b78){_0x432e70({'id':_0x4c2084['id'],'phone':_0x3fb2a6[_0x6e3f('0x37')]});})[_0x6e3f('0x17')](function(_0x46408c){logger[_0x6e3f('0x12')](_0x6e3f('0x38'),_0x46408c[_0x6e3f('0x14')]);_0x15c9b3({'error':_0x46408c[_0x6e3f('0x14')]});});});}exports[_0x6e3f('0x39')]=function(_0x292508){var _0x4e7287=this;return new Promise(function(_0x3e036f,_0xf77170){return db[_0x6e3f('0x19')][_0x6e3f('0x36')](_0x292508[_0x6e3f('0x1b')][_0x6e3f('0x3a')],{'where':{'id':_0x292508[_0x6e3f('0x1b')]['id']}})[_0x6e3f('0xc')](function(_0x429199){_0x3e036f(_0x429199);})['catch'](function(_0x500f2d){logger['error'](_0x6e3f('0x39'),_0x500f2d['message']);_0xf77170(_0x4e7287[_0x6e3f('0x12')](0x1f4,_0x500f2d[_0x6e3f('0x14')]));});});}; \ No newline at end of file +var _0x80d4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopper','OrderBy','duration','isNil','scheduledat','minutes','add','countnosuchnumberretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash'];(function(_0x4e14b8,_0x1400ca){var _0x1b4e0a=function(_0x1607fe){while(--_0x1607fe){_0x4e14b8['push'](_0x4e14b8['shift']());}};_0x1b4e0a(++_0x1400ca);}(_0x80d4,0x1e5));var _0x480d=function(_0x3146c2,_0x5ce6a9){_0x3146c2=_0x3146c2-0x0;var _0x560ff3=_0x80d4[_0x3146c2];return _0x560ff3;};'use strict';var _=require(_0x480d('0x0'));var util=require(_0x480d('0x1'));var moment=require(_0x480d('0x2'));var BPromise=require(_0x480d('0x3'));var rs=require(_0x480d('0x4'));var fs=require('fs');var Redis=require(_0x480d('0x5'));var db=require(_0x480d('0x6'))['db'];var utils=require(_0x480d('0x7'));var logger=require('../../config/logger')(_0x480d('0x8'));var config=require(_0x480d('0x9'));var jayson=require(_0x480d('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c10a3,_0x59d4c0,_0x4b8411){return new BPromise(function(_0x2c33cb,_0x2bcef7){return client[_0x480d('0xb')](_0x3c10a3,_0x4b8411)[_0x480d('0xc')](function(_0x363f2d){logger[_0x480d('0xd')](_0x480d('0xe'),_0x59d4c0,_0x480d('0xf'));logger['debug'](_0x480d('0x10'),_0x59d4c0,'request\x20sent',JSON['stringify'](_0x363f2d));if(_0x363f2d['error']){if(_0x363f2d['error']['code']===0x1f4){logger[_0x480d('0x11')](_0x480d('0xe'),_0x59d4c0,_0x363f2d[_0x480d('0x11')]['message']);return _0x2bcef7(_0x363f2d['error'][_0x480d('0x12')]);}logger['error'](_0x480d('0xe'),_0x59d4c0,_0x363f2d[_0x480d('0x11')][_0x480d('0x12')]);return _0x2c33cb(_0x363f2d['error'][_0x480d('0x12')]);}else{logger['info'](_0x480d('0xe'),_0x59d4c0,_0x480d('0xf'));_0x2c33cb(_0x363f2d[_0x480d('0x13')][_0x480d('0x12')]);}})[_0x480d('0x14')](function(_0x51a630){logger[_0x480d('0x11')](_0x480d('0xe'),_0x59d4c0,_0x51a630);_0x2bcef7(_0x51a630);});});}exports[_0x480d('0x15')]=function(_0x3077f5){var _0x30fbd1=this;return new Promise(function(_0x2ff2c1,_0x4b7f9b){return db['CmHopper'][_0x480d('0x16')]({'raw':!![],'where':{'ContactId':_0x3077f5[_0x480d('0x17')][_0x480d('0x18')],'ListId':_0x3077f5[_0x480d('0x17')][_0x480d('0x19')],'VoiceQueueId':_0x3077f5[_0x480d('0x17')][_0x480d('0x1a')]===undefined?null:_0x3077f5[_0x480d('0x17')]['VoiceQueueId'],'CampaignId':_0x3077f5['body']['CampaignId']===undefined?null:_0x3077f5[_0x480d('0x17')][_0x480d('0x1b')]}})['then'](function(_0x43f203){if(_0x43f203!=null){return db[_0x480d('0x1c')][_0x480d('0x16')]({'raw':!![],'where':{'CmHopperId':_0x43f203['id'],'OrderBy':{'$gt':_0x43f203['OrderBy']}},'order':[['OrderBy',_0x480d('0x1d')]]})[_0x480d('0xc')](function(_0x104d47){var _0x54b416=0x0;if(_0x104d47){if(_0x104d47[_0x480d('0x1e')]+_0x104d47[_0x480d('0x1f')]+_0x104d47[_0x480d('0x20')]+_0x104d47['countnosuchnumberretry']+_0x104d47[_0x480d('0x21')]+_0x104d47[_0x480d('0x22')]+_0x104d47[_0x480d('0x23')]+_0x104d47[_0x480d('0x24')]<_0x3077f5[_0x480d('0x25')][_0x480d('0x26')])_0x54b416=0x1;_0x2ff2c1({'additional':_0x54b416});}else{return db['CmHopperAdditionalPhone'][_0x480d('0x16')]({'raw':!![],'where':{'CmHopperId':_0x43f203['id']},'order':[['OrderBy',_0x480d('0x1d')]]})[_0x480d('0xc')](function(_0x4677aa){var _0x4b9b1a=0x0;if(_0x4677aa){if(_0x4677aa[_0x480d('0x1e')]+_0x4677aa['countcongestionretry']+_0x4677aa[_0x480d('0x20')]+_0x4677aa['countnosuchnumberretry']+_0x4677aa[_0x480d('0x21')]+_0x4677aa[_0x480d('0x22')]+_0x4677aa['countmachineretry']+_0x4677aa[_0x480d('0x24')]<_0x3077f5['entity']['dialGlobalMaxRetry'])_0x4b9b1a=0x1;_0x2ff2c1({'additional':_0x4b9b1a});}else{_0x2ff2c1({'additional':0x0});}})[_0x480d('0x14')](function(_0x4b2dc6){logger['error'](_0x480d('0x15'),_0x4b2dc6[_0x480d('0x12')]);_0x4b7f9b(_0x30fbd1[_0x480d('0x11')](0x1f4,_0x4b2dc6[_0x480d('0x12')]));});}})[_0x480d('0x14')](function(_0x16c8b6){logger['error'](_0x480d('0x15'),_0x16c8b6[_0x480d('0x12')]);_0x4b7f9b(_0x30fbd1['error'](0x1f4,_0x16c8b6[_0x480d('0x12')]));});}else _0x2ff2c1({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x4b7429){var _0x3623f1=this;return new Promise(function(_0x5b3389,_0x56a178){return db[_0x480d('0x27')][_0x480d('0x16')]({'raw':!![],'where':{'ContactId':_0x4b7429[_0x480d('0x17')][_0x480d('0x18')],'ListId':_0x4b7429[_0x480d('0x17')]['ListId'],'VoiceQueueId':_0x4b7429[_0x480d('0x17')][_0x480d('0x1a')]===undefined?null:_0x4b7429['body'][_0x480d('0x1a')],'CampaignId':_0x4b7429[_0x480d('0x17')][_0x480d('0x1b')]===undefined?null:_0x4b7429[_0x480d('0x17')][_0x480d('0x1b')]}})[_0x480d('0xc')](function(_0x1e7cb0){if(_0x1e7cb0!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1e7cb0['id'],'OrderBy':{'$gte':_0x1e7cb0[_0x480d('0x28')]}},'order':[[_0x480d('0x28'),_0x480d('0x1d')]]})[_0x480d('0xc')](function(_0x4e9ade){if(_0x4e9ade)return activateAdditionalPhone(_0x1e7cb0,_0x4b7429[_0x480d('0x17')],_0x4e9ade,_0x4b7429[_0x480d('0x29')],_0x4b7429['waitTime'])['then'](function(_0x435f90){_0x5b3389(_0x435f90);});else{return db[_0x480d('0x1c')][_0x480d('0x16')]({'raw':!![],'where':{'CmHopperId':_0x1e7cb0['id']},'order':[[_0x480d('0x28'),_0x480d('0x1d')]]})[_0x480d('0xc')](function(_0x3844be){if(_0x3844be)return activateAdditionalPhone(_0x1e7cb0,_0x4b7429[_0x480d('0x17')],_0x3844be,_0x4b7429[_0x480d('0x29')],_0x4b7429['waitTime'])[_0x480d('0xc')](function(_0x168ddd){_0x5b3389(_0x168ddd);});else{_0x5b3389({'id':_0x1e7cb0['id'],'phone':''});}})[_0x480d('0x14')](function(_0x3cb391){logger[_0x480d('0x11')]('VerifyAdditionalPhones',_0x3cb391[_0x480d('0x12')]);_0x56a178(_0x3623f1['error'](0x1f4,_0x3cb391[_0x480d('0x12')]));});}})[_0x480d('0x14')](function(_0x26f4dc){logger['error'](_0x480d('0x15'),_0x26f4dc[_0x480d('0x12')]);_0x56a178(_0x3623f1[_0x480d('0x11')](0x1f4,_0x26f4dc[_0x480d('0x12')]));});}else _0x5b3389(0x1);});});};function activateAdditionalPhone(_0x1ce652,_0x118c60,_0x5c4f16,_0x5c7fa9,_0x522820){return new Promise(function(_0xd5dae9,_0x1981a6){var _0x4f3891;if(_[_0x480d('0x2a')](_0x5c4f16['scheduledat'])){_0x5c4f16[_0x480d('0x2b')]=moment();}if(moment()>moment(_0x5c4f16[_0x480d('0x2b')])){_0x4f3891=moment()['add'](_0x522820||0x3,_0x480d('0x2c'));}else{if(_0x5c4f16['OrderBy']==0x0){_0x4f3891=moment(_0x5c4f16['scheduledat']);}else{_0x4f3891=moment()[_0x480d('0x2d')](_0x522820||0x3,_0x480d('0x2c'));}}if(_[_0x480d('0x2a')](_0x4f3891)){_0x4f3891=moment()['add'](_0x522820||0x3,_0x480d('0x2c'));}var _0x11c783={'phone':_0x1ce652['phone'],'active':0x0,'OrderBy':_['isNil'](_0x1ce652['OrderBy'])?0x0:_0x1ce652[_0x480d('0x28')],'scheduledat':moment()['add'](_0x5c7fa9||0x1,'minutes'),'countbusyretry':_0x118c60[_0x480d('0x1e')],'countcongestionretry':_0x118c60[_0x480d('0x1f')],'countnoanswerretry':_0x118c60[_0x480d('0x20')],'countnosuchnumberretry':_0x118c60[_0x480d('0x2e')],'countdropretry':_0x118c60[_0x480d('0x21')],'countabandonedretry':_0x118c60[_0x480d('0x22')],'countmachineretry':_0x118c60[_0x480d('0x23')],'countagentrejectretry':_0x118c60['countagentrejectretry'],'createdAt':_0x118c60[_0x480d('0x2f')],'updatedAt':_0x118c60[_0x480d('0x30')]};var _0x15aa78={'CmHopperId':_0x1ce652['id'],'phone':_0x5c4f16['phone'],'active':0x0,'OrderBy':_[_0x480d('0x2a')](_0x5c4f16[_0x480d('0x28')])?0x0:_0x5c4f16['OrderBy'],'scheduledat':_0x4f3891,'countbusyretry':_0x5c4f16[_0x480d('0x1e')],'countcongestionretry':_0x5c4f16[_0x480d('0x1f')],'countnoanswerretry':_0x5c4f16[_0x480d('0x20')],'countnosuchnumberretry':_0x5c4f16[_0x480d('0x2e')],'countdropretry':_0x5c4f16[_0x480d('0x21')],'countabandonedretry':_0x5c4f16[_0x480d('0x22')],'countmachineretry':_0x5c4f16[_0x480d('0x23')],'countagentrejectretry':_0x5c4f16[_0x480d('0x24')],'createdAt':_0x5c4f16[_0x480d('0x2f')],'updatedAt':_0x5c4f16[_0x480d('0x30')]};return db[_0x480d('0x31')]['transaction'](function(_0x1364b5){return db[_0x480d('0x1c')][_0x480d('0x32')](_0x11c783,{'where':{'id':_0x5c4f16['id']}},{'transaction':_0x1364b5})['then'](function(){return db[_0x480d('0x27')][_0x480d('0x32')](_0x15aa78,{'where':{'id':_0x1ce652['id']}},{'transaction':_0x1364b5});});})['then'](function(_0x13b71f){_0xd5dae9({'id':_0x1ce652['id'],'phone':_0x5c4f16['phone']});})[_0x480d('0x14')](function(_0x475175){logger['error'](_0x480d('0x33'),_0x475175[_0x480d('0x12')]);_0x1981a6({'error':_0x475175[_0x480d('0x12')]});});});}exports[_0x480d('0x34')]=function(_0x5732b0){var _0x44ae68=this;return new Promise(function(_0x4dbd22,_0x5682c8){return db['CmHopper'][_0x480d('0x32')](_0x5732b0[_0x480d('0x17')][_0x480d('0x35')],{'where':{'id':_0x5732b0['body']['id']}})[_0x480d('0xc')](function(_0xa43df6){_0x4dbd22(_0xa43df6);})['catch'](function(_0x271020){logger[_0x480d('0x11')](_0x480d('0x34'),_0x271020[_0x480d('0x12')]);_0x5682c8(_0x44ae68[_0x480d('0x11')](0x1f4,_0x271020[_0x480d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index ad56e8f..4e22dfb 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 _0x5eb1=['/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','isAuthenticated','show','post','create','put'];(function(_0x3cd218,_0x12bed8){var _0x26a894=function(_0x28eaf9){while(--_0x28eaf9){_0x3cd218['push'](_0x3cd218['shift']());}};_0x26a894(++_0x12bed8);}(_0x5eb1,0x7c));var _0x15eb=function(_0x4c42ff,_0x3d3d75){_0x4c42ff=_0x4c42ff-0x0;var _0x27387f=_0x5eb1[_0x4c42ff];return _0x27387f;};'use strict';var multer=require('multer');var util=require(_0x15eb('0x0'));var path=require(_0x15eb('0x1'));var timeout=require(_0x15eb('0x2'));var express=require(_0x15eb('0x3'));var router=express[_0x15eb('0x4')]();var fs_extra=require(_0x15eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x15eb('0x6'));var config=require(_0x15eb('0x7'));var controller=require(_0x15eb('0x8'));router[_0x15eb('0x9')]('/',auth['isAuthenticated'](),controller[_0x15eb('0xa')]);router[_0x15eb('0x9')]('/:id',auth[_0x15eb('0xb')](),controller[_0x15eb('0xc')]);router[_0x15eb('0xd')]('/',auth[_0x15eb('0xb')](),controller[_0x15eb('0xe')]);router[_0x15eb('0xf')](_0x15eb('0x10'),auth[_0x15eb('0xb')](),controller[_0x15eb('0x11')]);router[_0x15eb('0x12')](_0x15eb('0x10'),auth[_0x15eb('0xb')](),controller[_0x15eb('0x13')]);module['exports']=router; \ No newline at end of file +var _0xba5a=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0xf00f73,_0x147a86){var _0x38e363=function(_0x5af1d2){while(--_0x5af1d2){_0xf00f73['push'](_0xf00f73['shift']());}};_0x38e363(++_0x147a86);}(_0xba5a,0x1d0));var _0xaba5=function(_0x30853f,_0x4aa320){_0x30853f=_0x30853f-0x0;var _0x3c416d=_0xba5a[_0x30853f];return _0x3c416d;};'use strict';var multer=require('multer');var util=require(_0xaba5('0x0'));var path=require(_0xaba5('0x1'));var timeout=require(_0xaba5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaba5('0x3'));var auth=require(_0xaba5('0x4'));var interaction=require(_0xaba5('0x5'));var config=require(_0xaba5('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xaba5('0x7')]);router['get'](_0xaba5('0x8'),auth[_0xaba5('0x9')](),controller[_0xaba5('0xa')]);router[_0xaba5('0xb')]('/',auth[_0xaba5('0x9')](),controller['create']);router[_0xaba5('0xc')](_0xaba5('0x8'),auth[_0xaba5('0x9')](),controller[_0xaba5('0xd')]);router[_0xaba5('0xe')](_0xaba5('0x8'),auth[_0xaba5('0x9')](),controller[_0xaba5('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 018bd3d..8346a2d 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 _0x6e0e=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x55b34b,_0x11d41c){var _0x1aacad=function(_0xe3b1fe){while(--_0xe3b1fe){_0x55b34b['push'](_0x55b34b['shift']());}};_0x1aacad(++_0x11d41c);}(_0x6e0e,0x90));var _0xe6e0=function(_0x321a71,_0x509b81){_0x321a71=_0x321a71-0x0;var _0x57cea2=_0x6e0e[_0x321a71];return _0x57cea2;};'use strict';var moment=require(_0xe6e0('0x0'));var Sequelize=require(_0xe6e0('0x1'));module[_0xe6e0('0x2')]={'phone':{'type':Sequelize[_0xe6e0('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe6e0('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xe6e0('0x4')],'unique':_0xe6e0('0x5')},'VoiceQueueId':{'type':Sequelize[_0xe6e0('0x4')],'unique':_0xe6e0('0x5')}}; \ No newline at end of file +var _0xe4ce=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x33615a,_0x29c335){var _0x5ccaf5=function(_0x20026a){while(--_0x20026a){_0x33615a['push'](_0x33615a['shift']());}};_0x5ccaf5(++_0x29c335);}(_0xe4ce,0x198));var _0xee4c=function(_0x3d1557,_0x2b4c8e){_0x3d1557=_0x3d1557-0x0;var _0x56cb41=_0xe4ce[_0x3d1557];return _0x56cb41;};'use strict';var moment=require(_0xee4c('0x0'));var Sequelize=require('sequelize');module[_0xee4c('0x1')]={'phone':{'type':Sequelize[_0xee4c('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xee4c('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xee4c('0x3')],'unique':_0xee4c('0x4')},'VoiceQueueId':{'type':Sequelize[_0xee4c('0x3')],'unique':_0xee4c('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 3704063..5884477 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 _0xe643=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','intersection','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xe643,0x84));var _0x3e64=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe643[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x3e64('0x0'));var rimraf=require(_0x3e64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e64('0x2'));var rp=require('request-promise');var moment=require(_0x3e64('0x3'));var BPromise=require(_0x3e64('0x4'));var Mustache=require(_0x3e64('0x5'));var util=require(_0x3e64('0x6'));var path=require(_0x3e64('0x7'));var sox=require('sox');var csv=require(_0x3e64('0x8'));var ejs=require(_0x3e64('0x9'));var fs=require('fs');var fs_extra=require(_0x3e64('0xa'));var _=require(_0x3e64('0xb'));var squel=require(_0x3e64('0xc'));var crypto=require(_0x3e64('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3e64('0xe'));var toCsv=require(_0x3e64('0x8'));var querystring=require(_0x3e64('0xf'));var Papa=require(_0x3e64('0x10'));var Redis=require(_0x3e64('0x11'));var authService=require(_0x3e64('0x12'));var qs=require(_0x3e64('0x13'));var as=require(_0x3e64('0x14'));var hardwareService=require(_0x3e64('0x15'));var logger=require(_0x3e64('0x16'))('api');var utils=require(_0x3e64('0x17'));var config=require(_0x3e64('0x18'));var licenseUtil=require(_0x3e64('0x19'));var db=require(_0x3e64('0x1a'))['db'];function respondWithStatusCode(_0x476a4d,_0x3418cf){_0x3418cf=_0x3418cf||0xcc;return function(_0x2a2186){if(_0x2a2186){return _0x476a4d[_0x3e64('0x1b')](_0x3418cf);}return _0x476a4d[_0x3e64('0x1c')](_0x3418cf)['end']();};}function respondWithResult(_0x7610d5,_0x438b13){_0x438b13=_0x438b13||0xc8;return function(_0x8232e4){if(_0x8232e4){return _0x7610d5['status'](_0x438b13)['json'](_0x8232e4);}};}function respondWithFilteredResult(_0x4eab61,_0x4bafd0){return function(_0x4a8488){if(_0x4a8488){var _0x4d58da=typeof _0x4bafd0[_0x3e64('0x1d')]===_0x3e64('0x1e')&&typeof _0x4bafd0[_0x3e64('0x1f')]===_0x3e64('0x1e');var _0x395fd6=_0x4a8488[_0x3e64('0x20')];var _0x33fb55=_0x4d58da?0x0:_0x4bafd0[_0x3e64('0x1d')];var _0x395e8b=_0x4d58da?_0x4a8488['count']:_0x4bafd0[_0x3e64('0x1d')]+_0x4bafd0['limit'];var _0x5ba990;if(_0x395e8b>=_0x395fd6){_0x395e8b=_0x395fd6;_0x5ba990=0xc8;}else{_0x5ba990=0xce;}_0x4eab61[_0x3e64('0x1c')](_0x5ba990);return _0x4eab61[_0x3e64('0x21')]('Content-Range',_0x33fb55+'-'+_0x395e8b+'/'+_0x395fd6)[_0x3e64('0x22')](_0x4a8488);}return null;};}function patchUpdates(_0x21eff6){return function(_0x1fb49e){try{jsonpatch[_0x3e64('0x23')](_0x1fb49e,_0x21eff6,!![]);}catch(_0x15b382){return BPromise[_0x3e64('0x24')](_0x15b382);}return _0x1fb49e[_0x3e64('0x25')]();};}function saveUpdates(_0x579f31,_0x4c2394){return function(_0x25f208){if(_0x25f208){return _0x25f208[_0x3e64('0x26')](_0x579f31)[_0x3e64('0x27')](function(_0x438507){return _0x438507;});}return null;};}function removeEntity(_0xc086db,_0x38c5e6){return function(_0x39b206){if(_0x39b206){return _0x39b206[_0x3e64('0x28')]()[_0x3e64('0x27')](function(){_0xc086db[_0x3e64('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308448,_0x75fc2a){return function(_0xf36b3d){if(!_0xf36b3d){_0x308448[_0x3e64('0x1b')](0x194);}return _0xf36b3d;};}function handleError(_0x284179,_0x13db72){_0x13db72=_0x13db72||0x1f4;return function(_0x4f3889){logger[_0x3e64('0x29')](_0x4f3889[_0x3e64('0x2a')]);if(_0x4f3889['name']){delete _0x4f3889[_0x3e64('0x2b')];}_0x284179[_0x3e64('0x1c')](_0x13db72)['send'](_0x4f3889);};}exports[_0x3e64('0x2c')]=function(_0x1355e0,_0x35597f){var _0x30f7a2={},_0x3933a9={},_0xaa7891={'count':0x0,'rows':[]};var _0x9450cd=_[_0x3e64('0x2d')](db[_0x3e64('0x2e')]['rawAttributes'],function(_0x2ddd4){return{'name':_0x2ddd4[_0x3e64('0x2f')],'type':_0x2ddd4[_0x3e64('0x30')][_0x3e64('0x31')]};});_0x3933a9[_0x3e64('0x32')]=_[_0x3e64('0x2d')](_0x9450cd,_0x3e64('0x2b'));_0x3933a9[_0x3e64('0x33')]=_[_0x3e64('0x34')](_0x1355e0[_0x3e64('0x33')]);_0x3933a9[_0x3e64('0x35')]=_['intersection'](_0x3933a9[_0x3e64('0x32')],_0x3933a9[_0x3e64('0x33')]);_0x30f7a2[_0x3e64('0x36')]=_['intersection'](_0x3933a9[_0x3e64('0x32')],qs[_0x3e64('0x37')](_0x1355e0[_0x3e64('0x33')][_0x3e64('0x37')]));_0x30f7a2[_0x3e64('0x36')]=_0x30f7a2[_0x3e64('0x36')][_0x3e64('0x38')]?_0x30f7a2['attributes']:_0x3933a9[_0x3e64('0x32')];if(!_0x1355e0[_0x3e64('0x33')][_0x3e64('0x39')]('nolimit')){_0x30f7a2['limit']=qs[_0x3e64('0x1f')](_0x1355e0[_0x3e64('0x33')][_0x3e64('0x1f')]);_0x30f7a2[_0x3e64('0x1d')]=qs[_0x3e64('0x1d')](_0x1355e0[_0x3e64('0x33')][_0x3e64('0x1d')]);}_0x30f7a2[_0x3e64('0x3a')]=qs['sort'](_0x1355e0[_0x3e64('0x33')][_0x3e64('0x3b')]);_0x30f7a2[_0x3e64('0x3c')]=qs[_0x3e64('0x35')](_[_0x3e64('0x3d')](_0x1355e0[_0x3e64('0x33')],_0x3933a9[_0x3e64('0x35')]),_0x9450cd);if(_0x1355e0['query'][_0x3e64('0x3e')]){_0x30f7a2[_0x3e64('0x3c')]=_[_0x3e64('0x3f')](_0x30f7a2['where'],{'$or':_[_0x3e64('0x2d')](_0x9450cd,function(_0x2c0c89){if(_0x2c0c89['type']!==_0x3e64('0x40')){var _0x3b88f0={};_0x3b88f0[_0x2c0c89[_0x3e64('0x2b')]]={'$like':'%'+_0x1355e0[_0x3e64('0x33')]['filter']+'%'};return _0x3b88f0;}})});}_0x30f7a2=_['merge']({},_0x30f7a2,_0x1355e0[_0x3e64('0x41')]);var _0x152644={'where':_0x30f7a2[_0x3e64('0x3c')]};return db[_0x3e64('0x2e')]['count'](_0x152644)[_0x3e64('0x27')](function(_0x3dacbb){_0xaa7891['count']=_0x3dacbb;if(_0x1355e0['query'][_0x3e64('0x42')]){_0x30f7a2[_0x3e64('0x43')]=[{'all':!![]}];}return db[_0x3e64('0x2e')]['findAll'](_0x30f7a2);})[_0x3e64('0x27')](function(_0x55c6ed){_0xaa7891['rows']=_0x55c6ed;return _0xaa7891;})[_0x3e64('0x27')](respondWithFilteredResult(_0x35597f,_0x30f7a2))[_0x3e64('0x44')](handleError(_0x35597f,null));};exports[_0x3e64('0x45')]=function(_0xdfada5,_0x5442e6){var _0x555550={'raw':!![],'where':{'id':_0xdfada5[_0x3e64('0x46')]['id']}},_0x2dc694={};_0x2dc694['model']=_[_0x3e64('0x34')](db[_0x3e64('0x2e')][_0x3e64('0x47')]);_0x2dc694[_0x3e64('0x33')]=_[_0x3e64('0x34')](_0xdfada5[_0x3e64('0x33')]);_0x2dc694[_0x3e64('0x35')]=_[_0x3e64('0x48')](_0x2dc694[_0x3e64('0x32')],_0x2dc694[_0x3e64('0x33')]);_0x555550['attributes']=_['intersection'](_0x2dc694[_0x3e64('0x32')],qs[_0x3e64('0x37')](_0xdfada5['query']['fields']));_0x555550[_0x3e64('0x36')]=_0x555550[_0x3e64('0x36')][_0x3e64('0x38')]?_0x555550[_0x3e64('0x36')]:_0x2dc694[_0x3e64('0x32')];if(_0xdfada5['query'][_0x3e64('0x42')]){_0x555550[_0x3e64('0x43')]=[{'all':!![]}];}_0x555550=_[_0x3e64('0x3f')]({},_0x555550,_0xdfada5[_0x3e64('0x41')]);return db['CmHopperBlack']['find'](_0x555550)['then'](handleEntityNotFound(_0x5442e6,null))[_0x3e64('0x27')](respondWithResult(_0x5442e6,null))[_0x3e64('0x44')](handleError(_0x5442e6,null));};exports[_0x3e64('0x26')]=function(_0x545cfc,_0x203baa){if(_0x545cfc[_0x3e64('0x49')]['id']){delete _0x545cfc[_0x3e64('0x49')]['id'];}return db[_0x3e64('0x2e')][_0x3e64('0x4a')]({'where':{'id':_0x545cfc[_0x3e64('0x46')]['id']}})[_0x3e64('0x27')](handleEntityNotFound(_0x203baa,null))[_0x3e64('0x27')](saveUpdates(_0x545cfc[_0x3e64('0x49')],null))['then'](respondWithResult(_0x203baa,null))[_0x3e64('0x44')](handleError(_0x203baa,null));};exports[_0x3e64('0x28')]=function(_0x2e147e,_0x9a1311){return db[_0x3e64('0x2e')][_0x3e64('0x4a')]({'where':{'id':_0x2e147e['params']['id']}})['then'](handleEntityNotFound(_0x9a1311,null))['then'](removeEntity(_0x9a1311,null))['catch'](handleError(_0x9a1311,null));};exports[_0x3e64('0x4b')]=function(_0x720cda,_0x585f02){return db[_0x3e64('0x2e')][_0x3e64('0x4b')]()['then'](respondWithResult(_0x585f02,null))['catch'](handleError(_0x585f02,null));}; \ No newline at end of file +var _0x7b99=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','options','includeAll','findAll','rows','catch','show','params','keys','include','merge','find','body','describe','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse'];(function(_0x57362,_0x18570d){var _0x13d4fb=function(_0x13d3ec){while(--_0x13d3ec){_0x57362['push'](_0x57362['shift']());}};_0x13d4fb(++_0x18570d);}(_0x7b99,0x1f1));var _0x97b9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7b99[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x97b9('0x0'));var rimraf=require(_0x97b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x97b9('0x2'));var BPromise=require(_0x97b9('0x3'));var Mustache=require(_0x97b9('0x4'));var util=require('util');var path=require(_0x97b9('0x5'));var sox=require(_0x97b9('0x6'));var csv=require(_0x97b9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97b9('0x8'));var _=require(_0x97b9('0x9'));var squel=require(_0x97b9('0xa'));var crypto=require(_0x97b9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x97b9('0xc'));var toCsv=require(_0x97b9('0x7'));var querystring=require('querystring');var Papa=require(_0x97b9('0xd'));var Redis=require(_0x97b9('0xe'));var authService=require(_0x97b9('0xf'));var qs=require(_0x97b9('0x10'));var as=require(_0x97b9('0x11'));var hardwareService=require(_0x97b9('0x12'));var logger=require(_0x97b9('0x13'))(_0x97b9('0x14'));var utils=require(_0x97b9('0x15'));var config=require(_0x97b9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b9ae3,_0x42887b){_0x42887b=_0x42887b||0xcc;return function(_0x199ad5){if(_0x199ad5){return _0x1b9ae3[_0x97b9('0x17')](_0x42887b);}return _0x1b9ae3[_0x97b9('0x18')](_0x42887b)[_0x97b9('0x19')]();};}function respondWithResult(_0x1d911d,_0x3376f0){_0x3376f0=_0x3376f0||0xc8;return function(_0x215228){if(_0x215228){return _0x1d911d[_0x97b9('0x18')](_0x3376f0)[_0x97b9('0x1a')](_0x215228);}};}function respondWithFilteredResult(_0x7a2329,_0x49f284){return function(_0x445e6d){if(_0x445e6d){var _0x4b02db=typeof _0x49f284[_0x97b9('0x1b')]==='undefined'&&typeof _0x49f284['limit']===_0x97b9('0x1c');var _0x58af4a=_0x445e6d[_0x97b9('0x1d')];var _0x1ffa37=_0x4b02db?0x0:_0x49f284[_0x97b9('0x1b')];var _0x1abaf2=_0x4b02db?_0x445e6d[_0x97b9('0x1d')]:_0x49f284[_0x97b9('0x1b')]+_0x49f284[_0x97b9('0x1e')];var _0x4400a4;if(_0x1abaf2>=_0x58af4a){_0x1abaf2=_0x58af4a;_0x4400a4=0xc8;}else{_0x4400a4=0xce;}_0x7a2329[_0x97b9('0x18')](_0x4400a4);return _0x7a2329[_0x97b9('0x1f')](_0x97b9('0x20'),_0x1ffa37+'-'+_0x1abaf2+'/'+_0x58af4a)[_0x97b9('0x1a')](_0x445e6d);}return null;};}function patchUpdates(_0x3ff0bf){return function(_0x4fb384){try{jsonpatch[_0x97b9('0x21')](_0x4fb384,_0x3ff0bf,!![]);}catch(_0x2565ad){return BPromise[_0x97b9('0x22')](_0x2565ad);}return _0x4fb384[_0x97b9('0x23')]();};}function saveUpdates(_0x402e94,_0xbfe81e){return function(_0x2719e6){if(_0x2719e6){return _0x2719e6[_0x97b9('0x24')](_0x402e94)[_0x97b9('0x25')](function(_0x5f33ef){return _0x5f33ef;});}return null;};}function removeEntity(_0x45afb3,_0x1e5df1){return function(_0x3684d8){if(_0x3684d8){return _0x3684d8[_0x97b9('0x26')]()['then'](function(){_0x45afb3[_0x97b9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb8fb7a,_0x17d63a){return function(_0x1b0274){if(!_0x1b0274){_0xb8fb7a[_0x97b9('0x17')](0x194);}return _0x1b0274;};}function handleError(_0x262076,_0x158004){_0x158004=_0x158004||0x1f4;return function(_0x4b4969){logger['error'](_0x4b4969[_0x97b9('0x27')]);if(_0x4b4969[_0x97b9('0x28')]){delete _0x4b4969[_0x97b9('0x28')];}_0x262076[_0x97b9('0x18')](_0x158004)[_0x97b9('0x29')](_0x4b4969);};}exports['index']=function(_0x3d5416,_0x26b242){var _0x1d1828={},_0x5dc2ac={},_0x434a9b={'count':0x0,'rows':[]};var _0x4a54f7=_[_0x97b9('0x2a')](db[_0x97b9('0x2b')][_0x97b9('0x2c')],function(_0x1a6585){return{'name':_0x1a6585[_0x97b9('0x2d')],'type':_0x1a6585[_0x97b9('0x2e')][_0x97b9('0x2f')]};});_0x5dc2ac['model']=_['map'](_0x4a54f7,_0x97b9('0x28'));_0x5dc2ac[_0x97b9('0x30')]=_['keys'](_0x3d5416[_0x97b9('0x30')]);_0x5dc2ac[_0x97b9('0x31')]=_[_0x97b9('0x32')](_0x5dc2ac[_0x97b9('0x33')],_0x5dc2ac[_0x97b9('0x30')]);_0x1d1828[_0x97b9('0x34')]=_[_0x97b9('0x32')](_0x5dc2ac[_0x97b9('0x33')],qs['fields'](_0x3d5416[_0x97b9('0x30')][_0x97b9('0x35')]));_0x1d1828[_0x97b9('0x34')]=_0x1d1828[_0x97b9('0x34')][_0x97b9('0x36')]?_0x1d1828[_0x97b9('0x34')]:_0x5dc2ac[_0x97b9('0x33')];if(!_0x3d5416[_0x97b9('0x30')][_0x97b9('0x37')]('nolimit')){_0x1d1828['limit']=qs[_0x97b9('0x1e')](_0x3d5416[_0x97b9('0x30')][_0x97b9('0x1e')]);_0x1d1828[_0x97b9('0x1b')]=qs[_0x97b9('0x1b')](_0x3d5416[_0x97b9('0x30')][_0x97b9('0x1b')]);}_0x1d1828[_0x97b9('0x38')]=qs[_0x97b9('0x39')](_0x3d5416[_0x97b9('0x30')]['sort']);_0x1d1828['where']=qs['filters'](_['pick'](_0x3d5416[_0x97b9('0x30')],_0x5dc2ac[_0x97b9('0x31')]),_0x4a54f7);if(_0x3d5416['query'][_0x97b9('0x3a')]){_0x1d1828[_0x97b9('0x3b')]=_['merge'](_0x1d1828[_0x97b9('0x3b')],{'$or':_[_0x97b9('0x2a')](_0x4a54f7,function(_0x4e55ee){if(_0x4e55ee['type']!=='VIRTUAL'){var _0xac76f2={};_0xac76f2[_0x4e55ee[_0x97b9('0x28')]]={'$like':'%'+_0x3d5416[_0x97b9('0x30')][_0x97b9('0x3a')]+'%'};return _0xac76f2;}})});}_0x1d1828=_['merge']({},_0x1d1828,_0x3d5416[_0x97b9('0x3c')]);var _0xd807d4={'where':_0x1d1828[_0x97b9('0x3b')]};return db['CmHopperBlack']['count'](_0xd807d4)[_0x97b9('0x25')](function(_0x55ff51){_0x434a9b['count']=_0x55ff51;if(_0x3d5416['query'][_0x97b9('0x3d')]){_0x1d1828['include']=[{'all':!![]}];}return db[_0x97b9('0x2b')][_0x97b9('0x3e')](_0x1d1828);})[_0x97b9('0x25')](function(_0x2fec11){_0x434a9b[_0x97b9('0x3f')]=_0x2fec11;return _0x434a9b;})['then'](respondWithFilteredResult(_0x26b242,_0x1d1828))[_0x97b9('0x40')](handleError(_0x26b242,null));};exports[_0x97b9('0x41')]=function(_0x9b57c0,_0x22b314){var _0x2cce61={'raw':!![],'where':{'id':_0x9b57c0[_0x97b9('0x42')]['id']}},_0x5da1ac={};_0x5da1ac['model']=_[_0x97b9('0x43')](db[_0x97b9('0x2b')]['rawAttributes']);_0x5da1ac[_0x97b9('0x30')]=_[_0x97b9('0x43')](_0x9b57c0[_0x97b9('0x30')]);_0x5da1ac[_0x97b9('0x31')]=_[_0x97b9('0x32')](_0x5da1ac[_0x97b9('0x33')],_0x5da1ac[_0x97b9('0x30')]);_0x2cce61[_0x97b9('0x34')]=_[_0x97b9('0x32')](_0x5da1ac[_0x97b9('0x33')],qs['fields'](_0x9b57c0[_0x97b9('0x30')]['fields']));_0x2cce61[_0x97b9('0x34')]=_0x2cce61['attributes']['length']?_0x2cce61[_0x97b9('0x34')]:_0x5da1ac[_0x97b9('0x33')];if(_0x9b57c0['query'][_0x97b9('0x3d')]){_0x2cce61[_0x97b9('0x44')]=[{'all':!![]}];}_0x2cce61=_[_0x97b9('0x45')]({},_0x2cce61,_0x9b57c0['options']);return db[_0x97b9('0x2b')][_0x97b9('0x46')](_0x2cce61)[_0x97b9('0x25')](handleEntityNotFound(_0x22b314,null))[_0x97b9('0x25')](respondWithResult(_0x22b314,null))[_0x97b9('0x40')](handleError(_0x22b314,null));};exports['update']=function(_0x360cb6,_0x1edaac){if(_0x360cb6['body']['id']){delete _0x360cb6[_0x97b9('0x47')]['id'];}return db[_0x97b9('0x2b')][_0x97b9('0x46')]({'where':{'id':_0x360cb6[_0x97b9('0x42')]['id']}})[_0x97b9('0x25')](handleEntityNotFound(_0x1edaac,null))[_0x97b9('0x25')](saveUpdates(_0x360cb6[_0x97b9('0x47')],null))[_0x97b9('0x25')](respondWithResult(_0x1edaac,null))[_0x97b9('0x40')](handleError(_0x1edaac,null));};exports[_0x97b9('0x26')]=function(_0x5ee695,_0x8bff5){return db[_0x97b9('0x2b')][_0x97b9('0x46')]({'where':{'id':_0x5ee695['params']['id']}})[_0x97b9('0x25')](handleEntityNotFound(_0x8bff5,null))['then'](removeEntity(_0x8bff5,null))[_0x97b9('0x40')](handleError(_0x8bff5,null));};exports['describe']=function(_0x30738e,_0x2a9dcb){return db[_0x97b9('0x2b')][_0x97b9('0x48')]()[_0x97b9('0x25')](respondWithResult(_0x2a9dcb,null))['catch'](handleError(_0x2a9dcb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f62a709..38f5b80 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 _0xfb46=['path','../../config/environment','./cmHopperBlack.attributes','exports','define','lodash','api','moment','bluebird','request-promise'];(function(_0x4a19c2,_0x5893ff){var _0x50606e=function(_0x5ef0dd){while(--_0x5ef0dd){_0x4a19c2['push'](_0x4a19c2['shift']());}};_0x50606e(++_0x5893ff);}(_0xfb46,0xaf));var _0x6fb4=function(_0x5ece84,_0xc06c9f){_0x5ece84=_0x5ece84-0x0;var _0x2a12c4=_0xfb46[_0x5ece84];return _0x2a12c4;};'use strict';var _=require(_0x6fb4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6fb4('0x1'));var moment=require(_0x6fb4('0x2'));var BPromise=require(_0x6fb4('0x3'));var rp=require(_0x6fb4('0x4'));var fs=require('fs');var path=require(_0x6fb4('0x5'));var rimraf=require('rimraf');var config=require(_0x6fb4('0x6'));var attributes=require(_0x6fb4('0x7'));module[_0x6fb4('0x8')]=function(_0x270632,_0x84eaee){return _0x270632[_0x6fb4('0x9')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca3=['bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x552041,_0xc34ee7){var _0x198a1a=function(_0x432f54){while(--_0x432f54){_0x552041['push'](_0x552041['shift']());}};_0x198a1a(++_0xc34ee7);}(_0x6ca3,0x193));var _0x36ca=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x6ca3[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x36ca('0x0'));var util=require(_0x36ca('0x1'));var logger=require(_0x36ca('0x2'))(_0x36ca('0x3'));var moment=require('moment');var BPromise=require(_0x36ca('0x4'));var rp=require(_0x36ca('0x5'));var fs=require('fs');var path=require(_0x36ca('0x6'));var rimraf=require(_0x36ca('0x7'));var config=require('../../config/environment');var attributes=require(_0x36ca('0x8'));module['exports']=function(_0x135b0f,_0x5b3005){return _0x135b0f['define'](_0x36ca('0x9'),attributes,{'tableName':_0x36ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 3ede403..1f0b51e 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 _0x3e08=['then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','include','model','map','debug','UpdateCmHopperBlack','CmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x39f3ed,_0x48bc5e){var _0x3b1802=function(_0x3ca4aa){while(--_0x3ca4aa){_0x39f3ed['push'](_0x39f3ed['shift']());}};_0x3b1802(++_0x48bc5e);}(_0x3e08,0x8e));var _0x83e0=function(_0x3d5351,_0x27bc80){_0x3d5351=_0x3d5351-0x0;var _0x1db4db=_0x3e08[_0x3d5351];return _0x1db4db;};'use strict';var _=require('lodash');var util=require(_0x83e0('0x0'));var moment=require(_0x83e0('0x1'));var BPromise=require(_0x83e0('0x2'));var rs=require(_0x83e0('0x3'));var fs=require('fs');var Redis=require(_0x83e0('0x4'));var db=require(_0x83e0('0x5'))['db'];var utils=require(_0x83e0('0x6'));var logger=require(_0x83e0('0x7'))(_0x83e0('0x8'));var config=require(_0x83e0('0x9'));var jayson=require(_0x83e0('0xa'));var client=jayson[_0x83e0('0xb')][_0x83e0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9145e8,_0x26b853,_0xc74132){return new BPromise(function(_0x488813,_0x27e68d){return client[_0x83e0('0xd')](_0x9145e8,_0xc74132)[_0x83e0('0xe')](function(_0x1811b7){logger[_0x83e0('0xf')](_0x83e0('0x10'),_0x26b853,_0x83e0('0x11'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x26b853,_0x83e0('0x11'),JSON[_0x83e0('0x12')](_0x1811b7));if(_0x1811b7[_0x83e0('0x13')]){if(_0x1811b7[_0x83e0('0x13')]['code']===0x1f4){logger[_0x83e0('0x13')](_0x83e0('0x10'),_0x26b853,_0x1811b7['error'][_0x83e0('0x14')]);return _0x27e68d(_0x1811b7['error'][_0x83e0('0x14')]);}logger['error'](_0x83e0('0x10'),_0x26b853,_0x1811b7['error'][_0x83e0('0x14')]);return _0x488813(_0x1811b7[_0x83e0('0x13')][_0x83e0('0x14')]);}else{logger[_0x83e0('0xf')](_0x83e0('0x10'),_0x26b853,_0x83e0('0x11'));_0x488813(_0x1811b7['result'][_0x83e0('0x14')]);}})[_0x83e0('0x15')](function(_0x1975b1){logger[_0x83e0('0x13')](_0x83e0('0x10'),_0x26b853,_0x1975b1);_0x27e68d(_0x1975b1);});});}exports[_0x83e0('0x16')]=function(_0x5806cf){var _0xc9e76c=this;return new Promise(function(_0x5a9986,_0x1fa9b7){return db['CmHopperBlack'][_0x83e0('0x17')]({'raw':_0x5806cf['options']?_0x5806cf[_0x83e0('0x18')][_0x83e0('0x19')]===undefined?!![]:![]:!![],'where':_0x5806cf[_0x83e0('0x18')]?_0x5806cf['options'][_0x83e0('0x1a')]||null:null,'attributes':_0x5806cf[_0x83e0('0x18')]?_0x5806cf['options'][_0x83e0('0x1b')]||null:null,'limit':_0x5806cf[_0x83e0('0x18')]?_0x5806cf[_0x83e0('0x18')]['limit']||null:null,'include':_0x5806cf[_0x83e0('0x18')]?_0x5806cf[_0x83e0('0x18')][_0x83e0('0x1c')]?_['map'](_0x5806cf['options'][_0x83e0('0x1c')],function(_0x59c219){return{'model':db[_0x59c219[_0x83e0('0x1d')]],'as':_0x59c219['as'],'attributes':_0x59c219[_0x83e0('0x1b')],'include':_0x59c219[_0x83e0('0x1c')]?_[_0x83e0('0x1e')](_0x59c219['include'],function(_0x7c7b46){return{'model':db[_0x7c7b46[_0x83e0('0x1d')]],'as':_0x7c7b46['as'],'attributes':_0x7c7b46[_0x83e0('0x1b')],'include':_0x7c7b46[_0x83e0('0x1c')]?_['map'](_0x7c7b46['include'],function(_0x4bd8a4){return{'model':db[_0x4bd8a4[_0x83e0('0x1d')]],'as':_0x4bd8a4['as'],'attributes':_0x4bd8a4[_0x83e0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x83e0('0xe')](function(_0x47bb82){logger[_0x83e0('0xf')]('GetCmHopperBlack',_0x5806cf);logger[_0x83e0('0x1f')]('GetCmHopperBlack',_0x5806cf,JSON[_0x83e0('0x12')](_0x47bb82));_0x5a9986(_0x47bb82);})[_0x83e0('0x15')](function(_0x1abc91){logger[_0x83e0('0x13')](_0x83e0('0x16'),_0x1abc91[_0x83e0('0x14')],_0x5806cf);_0x1fa9b7(_0xc9e76c[_0x83e0('0x13')](0x1f4,_0x1abc91[_0x83e0('0x14')]));});});};exports[_0x83e0('0x20')]=function(_0x539ef9){var _0x52f8dd=this;return new Promise(function(_0x35b81e,_0x3d1b13){return db[_0x83e0('0x21')][_0x83e0('0x22')](_0x539ef9[_0x83e0('0x23')],{'raw':_0x539ef9['options']?_0x539ef9[_0x83e0('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x539ef9['options']?_0x539ef9[_0x83e0('0x18')][_0x83e0('0x1a')]||null:null,'attributes':_0x539ef9[_0x83e0('0x18')]?_0x539ef9[_0x83e0('0x18')][_0x83e0('0x1b')]||null:null,'limit':_0x539ef9[_0x83e0('0x18')]?_0x539ef9['options'][_0x83e0('0x24')]||null:null})[_0x83e0('0xe')](function(_0x338d02){logger[_0x83e0('0xf')](_0x83e0('0x20'),_0x539ef9);logger[_0x83e0('0x1f')](_0x83e0('0x20'),_0x539ef9,JSON[_0x83e0('0x12')](_0x338d02));_0x35b81e(_0x338d02);})[_0x83e0('0x15')](function(_0x129cc8){logger[_0x83e0('0x13')](_0x83e0('0x20'),_0x129cc8[_0x83e0('0x14')],_0x539ef9);_0x3d1b13(_0x52f8dd[_0x83e0('0x13')](0x1f4,_0x129cc8[_0x83e0('0x14')]));});});};exports[_0x83e0('0x25')]=function(_0x34e354){var _0x36d014=this;return new Promise(function(_0x4960ab,_0x140ab4){return db[_0x83e0('0x21')][_0x83e0('0x26')]({'where':_0x34e354[_0x83e0('0x18')]?_0x34e354[_0x83e0('0x18')]['where']||null:null})[_0x83e0('0xe')](function(_0x24f700){logger[_0x83e0('0xf')](_0x83e0('0x25'),_0x34e354);logger[_0x83e0('0x1f')](_0x83e0('0x25'),_0x34e354,JSON[_0x83e0('0x12')](_0x24f700));_0x4960ab(_0x24f700);})[_0x83e0('0x15')](function(_0x1103ef){logger['error']('DestroyCmHopperBlack',_0x1103ef[_0x83e0('0x14')],_0x34e354);_0x140ab4(_0x36d014[_0x83e0('0x13')](0x1f4,_0x1103ef['message']));});});}; \ No newline at end of file +var _0xd418=['attributes','limit','include','map','model','debug','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where'];(function(_0x270f12,_0x30e82e){var _0x39dfaa=function(_0x127b46){while(--_0x127b46){_0x270f12['push'](_0x270f12['shift']());}};_0x39dfaa(++_0x30e82e);}(_0xd418,0x114));var _0x8d41=function(_0x2645a3,_0x2dac15){_0x2645a3=_0x2645a3-0x0;var _0x467ddf=_0xd418[_0x2645a3];return _0x467ddf;};'use strict';var _=require('lodash');var util=require(_0x8d41('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d41('0x1'));var fs=require('fs');var Redis=require(_0x8d41('0x2'));var db=require(_0x8d41('0x3'))['db'];var utils=require(_0x8d41('0x4'));var logger=require(_0x8d41('0x5'))(_0x8d41('0x6'));var config=require('../../config/environment');var jayson=require(_0x8d41('0x7'));var client=jayson[_0x8d41('0x8')][_0x8d41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x321d5d,_0x3a4f85,_0x17c7c5){return new BPromise(function(_0xe41534,_0x4a0408){return client[_0x8d41('0xa')](_0x321d5d,_0x17c7c5)[_0x8d41('0xb')](function(_0x1d87cd){logger[_0x8d41('0xc')](_0x8d41('0xd'),_0x3a4f85,'request\x20sent');logger['debug'](_0x8d41('0xe'),_0x3a4f85,_0x8d41('0xf'),JSON[_0x8d41('0x10')](_0x1d87cd));if(_0x1d87cd[_0x8d41('0x11')]){if(_0x1d87cd[_0x8d41('0x11')][_0x8d41('0x12')]===0x1f4){logger[_0x8d41('0x11')](_0x8d41('0xd'),_0x3a4f85,_0x1d87cd[_0x8d41('0x11')][_0x8d41('0x13')]);return _0x4a0408(_0x1d87cd[_0x8d41('0x11')][_0x8d41('0x13')]);}logger[_0x8d41('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x3a4f85,_0x1d87cd[_0x8d41('0x11')]['message']);return _0xe41534(_0x1d87cd[_0x8d41('0x11')][_0x8d41('0x13')]);}else{logger['info'](_0x8d41('0xd'),_0x3a4f85,'request\x20sent');_0xe41534(_0x1d87cd[_0x8d41('0x14')][_0x8d41('0x13')]);}})[_0x8d41('0x15')](function(_0x31e24b){logger[_0x8d41('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x3a4f85,_0x31e24b);_0x4a0408(_0x31e24b);});});}exports[_0x8d41('0x16')]=function(_0x3940e3){var _0xfe2dd6=this;return new Promise(function(_0x3b98c4,_0x43ebf3){return db[_0x8d41('0x17')][_0x8d41('0x18')]({'raw':_0x3940e3[_0x8d41('0x19')]?_0x3940e3[_0x8d41('0x19')][_0x8d41('0x1a')]===undefined?!![]:![]:!![],'where':_0x3940e3['options']?_0x3940e3[_0x8d41('0x19')][_0x8d41('0x1b')]||null:null,'attributes':_0x3940e3[_0x8d41('0x19')]?_0x3940e3[_0x8d41('0x19')][_0x8d41('0x1c')]||null:null,'limit':_0x3940e3[_0x8d41('0x19')]?_0x3940e3[_0x8d41('0x19')][_0x8d41('0x1d')]||null:null,'include':_0x3940e3[_0x8d41('0x19')]?_0x3940e3['options'][_0x8d41('0x1e')]?_[_0x8d41('0x1f')](_0x3940e3[_0x8d41('0x19')][_0x8d41('0x1e')],function(_0x1d19ff){return{'model':db[_0x1d19ff['model']],'as':_0x1d19ff['as'],'attributes':_0x1d19ff[_0x8d41('0x1c')],'include':_0x1d19ff[_0x8d41('0x1e')]?_[_0x8d41('0x1f')](_0x1d19ff['include'],function(_0x1db6ba){return{'model':db[_0x1db6ba[_0x8d41('0x20')]],'as':_0x1db6ba['as'],'attributes':_0x1db6ba[_0x8d41('0x1c')],'include':_0x1db6ba[_0x8d41('0x1e')]?_[_0x8d41('0x1f')](_0x1db6ba[_0x8d41('0x1e')],function(_0x404b00){return{'model':db[_0x404b00[_0x8d41('0x20')]],'as':_0x404b00['as'],'attributes':_0x404b00['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fd43a){logger[_0x8d41('0xc')](_0x8d41('0x16'),_0x3940e3);logger[_0x8d41('0x21')]('GetCmHopperBlack',_0x3940e3,JSON[_0x8d41('0x10')](_0x3fd43a));_0x3b98c4(_0x3fd43a);})[_0x8d41('0x15')](function(_0x35f5d4){logger[_0x8d41('0x11')](_0x8d41('0x16'),_0x35f5d4[_0x8d41('0x13')],_0x3940e3);_0x43ebf3(_0xfe2dd6[_0x8d41('0x11')](0x1f4,_0x35f5d4[_0x8d41('0x13')]));});});};exports[_0x8d41('0x22')]=function(_0x5f02c9){var _0x51cdca=this;return new Promise(function(_0x443c96,_0x5b7fe6){return db[_0x8d41('0x17')][_0x8d41('0x23')](_0x5f02c9['body'],{'raw':_0x5f02c9[_0x8d41('0x19')]?_0x5f02c9[_0x8d41('0x19')][_0x8d41('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f02c9['options']?_0x5f02c9[_0x8d41('0x19')][_0x8d41('0x1b')]||null:null,'attributes':_0x5f02c9[_0x8d41('0x19')]?_0x5f02c9[_0x8d41('0x19')][_0x8d41('0x1c')]||null:null,'limit':_0x5f02c9[_0x8d41('0x19')]?_0x5f02c9[_0x8d41('0x19')][_0x8d41('0x1d')]||null:null})[_0x8d41('0xb')](function(_0x899f47){logger[_0x8d41('0xc')](_0x8d41('0x22'),_0x5f02c9);logger[_0x8d41('0x21')]('UpdateCmHopperBlack',_0x5f02c9,JSON[_0x8d41('0x10')](_0x899f47));_0x443c96(_0x899f47);})[_0x8d41('0x15')](function(_0x26a4af){logger['error'](_0x8d41('0x22'),_0x26a4af[_0x8d41('0x13')],_0x5f02c9);_0x5b7fe6(_0x51cdca[_0x8d41('0x11')](0x1f4,_0x26a4af[_0x8d41('0x13')]));});});};exports[_0x8d41('0x24')]=function(_0x4b6066){var _0x18532c=this;return new Promise(function(_0x3ca651,_0x30679a){return db[_0x8d41('0x17')][_0x8d41('0x25')]({'where':_0x4b6066['options']?_0x4b6066[_0x8d41('0x19')][_0x8d41('0x1b')]||null:null})['then'](function(_0xc78dc5){logger[_0x8d41('0xc')](_0x8d41('0x24'),_0x4b6066);logger[_0x8d41('0x21')](_0x8d41('0x24'),_0x4b6066,JSON[_0x8d41('0x10')](_0xc78dc5));_0x3ca651(_0xc78dc5);})['catch'](function(_0x687b33){logger['error'](_0x8d41('0x24'),_0x687b33['message'],_0x4b6066);_0x30679a(_0x18532c[_0x8d41('0x11')](0x1f4,_0x687b33[_0x8d41('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5c3ac78..17ed63c 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 _0xd117=['/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xd117,0x182));var _0x7d11=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0xd117[_0x224f65];return _0x3f921c;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0x12')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['delete']('/:id',auth[_0x7d11('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x326f=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','show','put','/:id','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x326f,0xd1));var _0xf326=function(_0x3ff8a9,_0x1f80f9){_0x3ff8a9=_0x3ff8a9-0x0;var _0xc0703f=_0x326f[_0x3ff8a9];return _0xc0703f;};'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',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')](_0xf326('0xf'),auth[_0xf326('0xa')](),controller[_0xf326('0x10')]);router['delete'](_0xf326('0xf'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);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 16ce2a7..1d046ab 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 _0x1ec1=['diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x1ffd34,_0x5170bf){var _0x1c2fbc=function(_0xa41657){while(--_0xa41657){_0x1ffd34['push'](_0x1ffd34['shift']());}};_0x1c2fbc(++_0x5170bf);}(_0x1ec1,0x1d7));var _0x11ec=function(_0x5878df,_0x4d1e53){_0x5878df=_0x5878df-0x0;var _0x23addf=_0x1ec1[_0x5878df];return _0x23addf;};'use strict';var Sequelize=require(_0x11ec('0x0'));var moment=require(_0x11ec('0x1'));module[_0x11ec('0x2')]={'state':{'type':Sequelize[_0x11ec('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x11ec('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x11ec('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x11ec('0x4')]},'starttime':{'type':Sequelize[_0x11ec('0x5')]},'responsetime':{'type':Sequelize[_0x11ec('0x5')]},'answertime':{'type':Sequelize[_0x11ec('0x5')]},'droptime':{'type':Sequelize[_0x11ec('0x5')]},'endtime':{'type':Sequelize[_0x11ec('0x5')]},'ringtime':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x11ec('0x4')]},'campaigntype':{'type':Sequelize[_0x11ec('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x11ec('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x11ec('0x4')]},'dispositionat':{'type':Sequelize[_0x11ec('0x5')],'set':function(_0x5697e9){var _0x2cfca8=this[_0x11ec('0x6')](_0x11ec('0x7'));if(_0x2cfca8&&_0x5697e9){this[_0x11ec('0x8')](_0x11ec('0x9'),moment(_0x5697e9)[_0x11ec('0xa')](moment(_0x2cfca8),_0x11ec('0xb')));}}},'amd':{'type':Sequelize[_0x11ec('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x11ec('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x11ec('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x11ec('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x11ec('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x11ec('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x11ec('0x5')]},'recallme':{'type':Sequelize[_0x11ec('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x11ec('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x11ec('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ee4=['seconds','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2ee4,0xda));var _0x42ee=function(_0x2067c1,_0x4ad413){_0x2067c1=_0x2067c1-0x0;var _0x4c2968=_0x2ee4[_0x2067c1];return _0x4c2968;};'use strict';var Sequelize=require(_0x42ee('0x0'));var moment=require(_0x42ee('0x1'));module['exports']={'state':{'type':Sequelize[_0x42ee('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x42ee('0x3')]},'scheduledat':{'type':Sequelize[_0x42ee('0x4')]},'countbusyretry':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x42ee('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x42ee('0x3')]},'originatecalleridname':{'type':Sequelize[_0x42ee('0x3')]},'calleridnum':{'type':Sequelize[_0x42ee('0x3')]},'calleridname':{'type':Sequelize[_0x42ee('0x3')]},'starttime':{'type':Sequelize[_0x42ee('0x4')]},'responsetime':{'type':Sequelize[_0x42ee('0x4')]},'answertime':{'type':Sequelize[_0x42ee('0x4')]},'droptime':{'type':Sequelize[_0x42ee('0x4')]},'endtime':{'type':Sequelize[_0x42ee('0x4')]},'ringtime':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x42ee('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x42ee('0x3')]},'membername':{'type':Sequelize[_0x42ee('0x3')]},'reason':{'type':Sequelize[_0x42ee('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x42ee('0x4')],'set':function(_0x338d43){var _0x22ed19=this[_0x42ee('0x5')](_0x42ee('0x6'));if(_0x22ed19&&_0x338d43){this[_0x42ee('0x7')](_0x42ee('0x8'),moment(_0x338d43)[_0x42ee('0x9')](moment(_0x22ed19),_0x42ee('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x42ee('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x42ee('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x42ee('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x42ee('0x4')]},'callback':{'type':Sequelize[_0x42ee('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x42ee('0x4')]},'deleted':{'type':Sequelize[_0x42ee('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x42ee('0x4')]},'recallme':{'type':Sequelize[_0x42ee('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x42ee('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x42ee('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index dc4c910..1ace293 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 _0x814b=['into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','Campaign','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','CmHopperFinal','includeAll','include','findAll','catch','params','find','describe','body','uniqueid','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','COUNT','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x814b,0x1a2));var _0xb814=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x814b[_0x10f6e8];return _0x35bb3c;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}exports[_0xb814('0x2e')]=function(_0x52ed64,_0x9008b2){var _0x37d24d={},_0x530744={},_0x499f22={'count':0x0,'rows':[]};var _0x20577b=_[_0xb814('0x2f')](db['CmHopperFinal'][_0xb814('0x30')],function(_0x526610){return{'name':_0x526610[_0xb814('0x31')],'type':_0x526610['type']['key']};});_0x530744[_0xb814('0x32')]=_['map'](_0x20577b,_0xb814('0x2c'));_0x530744[_0xb814('0x33')]=_[_0xb814('0x34')](_0x52ed64['query']);_0x530744['filters']=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],_0x530744['query']);_0x37d24d[_0xb814('0x36')]=_[_0xb814('0x35')](_0x530744[_0xb814('0x32')],qs[_0xb814('0x37')](_0x52ed64[_0xb814('0x33')][_0xb814('0x37')]));_0x37d24d[_0xb814('0x36')]=_0x37d24d['attributes'][_0xb814('0x38')]?_0x37d24d[_0xb814('0x36')]:_0x530744[_0xb814('0x32')];if(!_0x52ed64[_0xb814('0x33')][_0xb814('0x39')]('nolimit')){_0x37d24d[_0xb814('0x21')]=qs['limit'](_0x52ed64[_0xb814('0x33')][_0xb814('0x21')]);_0x37d24d[_0xb814('0x1f')]=qs['offset'](_0x52ed64[_0xb814('0x33')][_0xb814('0x1f')]);}_0x37d24d['order']=qs[_0xb814('0x3a')](_0x52ed64[_0xb814('0x33')][_0xb814('0x3a')]);_0x37d24d[_0xb814('0x3b')]=qs[_0xb814('0x3c')](_[_0xb814('0x3d')](_0x52ed64['query'],_0x530744[_0xb814('0x3c')]),_0x20577b);if(_0x52ed64['query'][_0xb814('0x3e')]){_0x37d24d['where']=_[_0xb814('0x3f')](_0x37d24d['where'],{'$or':_[_0xb814('0x2f')](_0x20577b,function(_0x26675a){if(_0x26675a['type']!=='VIRTUAL'){var _0x5dd6bc={};_0x5dd6bc[_0x26675a['name']]={'$like':'%'+_0x52ed64[_0xb814('0x33')][_0xb814('0x3e')]+'%'};return _0x5dd6bc;}})});}_0x37d24d=_[_0xb814('0x3f')]({},_0x37d24d,_0x52ed64[_0xb814('0x40')]);var _0x51cdba={'where':_0x37d24d['where']};return db[_0xb814('0x41')]['count'](_0x51cdba)[_0xb814('0x28')](function(_0x1098eb){_0x499f22[_0xb814('0x22')]=_0x1098eb;if(_0x52ed64[_0xb814('0x33')][_0xb814('0x42')]){_0x37d24d[_0xb814('0x43')]=[{'all':!![]}];}return db[_0xb814('0x41')][_0xb814('0x44')](_0x37d24d);})[_0xb814('0x28')](function(_0x4b6ff8){_0x499f22['rows']=_0x4b6ff8;return _0x499f22;})['then'](respondWithFilteredResult(_0x9008b2,_0x37d24d))[_0xb814('0x45')](handleError(_0x9008b2,null));};exports['show']=function(_0x29416a,_0x580171){var _0x411723={'raw':!![],'where':{'id':_0x29416a[_0xb814('0x46')]['id']}},_0x44ff56={};_0x44ff56[_0xb814('0x32')]=_['keys'](db[_0xb814('0x41')][_0xb814('0x30')]);_0x44ff56[_0xb814('0x33')]=_[_0xb814('0x34')](_0x29416a[_0xb814('0x33')]);_0x44ff56[_0xb814('0x3c')]=_['intersection'](_0x44ff56[_0xb814('0x32')],_0x44ff56[_0xb814('0x33')]);_0x411723[_0xb814('0x36')]=_[_0xb814('0x35')](_0x44ff56[_0xb814('0x32')],qs[_0xb814('0x37')](_0x29416a[_0xb814('0x33')]['fields']));_0x411723['attributes']=_0x411723[_0xb814('0x36')][_0xb814('0x38')]?_0x411723[_0xb814('0x36')]:_0x44ff56[_0xb814('0x32')];if(_0x29416a[_0xb814('0x33')][_0xb814('0x42')]){_0x411723[_0xb814('0x43')]=[{'all':!![]}];}_0x411723=_[_0xb814('0x3f')]({},_0x411723,_0x29416a[_0xb814('0x40')]);return db[_0xb814('0x41')][_0xb814('0x47')](_0x411723)['then'](handleEntityNotFound(_0x580171,null))[_0xb814('0x28')](respondWithResult(_0x580171,null))[_0xb814('0x45')](handleError(_0x580171,null));};exports['describe']=function(_0x338e80,_0x55234d){return db[_0xb814('0x41')][_0xb814('0x48')]()[_0xb814('0x28')](respondWithResult(_0x55234d,null))[_0xb814('0x45')](handleError(_0x55234d,null));};exports[_0xb814('0x27')]=function(_0x4096d4,_0x2cc806){if(_0x4096d4[_0xb814('0x49')][_0xb814('0x4a')]){delete _0x4096d4[_0xb814('0x49')]['uniqueid'];}return db['CmHopperFinal'][_0xb814('0x47')]({'where':{'uniqueid':_0x4096d4[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x28')](saveUpdates(_0x4096d4[_0xb814('0x49')],null))[_0xb814('0x28')](respondWithResult(_0x2cc806,null))[_0xb814('0x45')](handleError(_0x2cc806,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x26fd0b,_0x388324,_0xf27a6e){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x26fd0b['params']['id']},'attributes':[[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),_0xb814('0x4d')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x4f')))),'noAnswerContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),'busyContacts'],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x51')))),'congestionContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x53')))),_0xb814('0x54')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x55')))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb814('0x57')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x388324,null))[_0xb814('0x28')](respondWithResult(_0x388324,null))[_0xb814('0x45')](handleError(_0x388324,null));};exports[_0xb814('0x5a')]=function(_0x2e5f99,_0x113350,_0x46014f){return db['CmHopperFinal'][_0xb814('0x44')]({'raw':![],'where':{'CampaignId':_0x2e5f99[_0xb814('0x46')]['id']},'attributes':[[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x4c')))),'noSuchContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0xb814('0x5b')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x50')))),_0xb814('0x5c')],[db[_0xb814('0x4b')]['fn']('COUNT',db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x51')))),_0xb814('0x5d')],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db['sequelize'][_0xb814('0x4e')](_0xb814('0x53')))),'dropContacts'],[db[_0xb814('0x4b')]['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xb814('0x56')],[db['sequelize']['fn'](_0xb814('0x52'),db[_0xb814('0x4b')]['fn']('IF',db[_0xb814('0x4b')][_0xb814('0x4e')](_0xb814('0x5e')))),_0xb814('0x57')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb814('0x4b')]['literal'](_0xb814('0x58')))),_0xb814('0x59')]]})[_0xb814('0x28')](handleEntityNotFound(_0x113350,null))['then'](respondWithResult(_0x113350,null))[_0xb814('0x45')](handleError(_0x113350,null));};exports[_0xb814('0x5f')]=function(_0xee204,_0x5aabbe,_0x30f717){return db[_0xb814('0x60')][_0xb814('0x47')]({'where':{'id':_0xee204[_0xb814('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aabbe,null))['then'](function(_0x28eaf8){var _0x295488;if(_0x28eaf8){_0x295488=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))[_0xb814('0x64')]([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),_0xb814('0x69'),_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('ANY_VALUE(calleridnum)',_0xb814('0x65'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x66'))[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))[_0xb814('0x6d')](_0xb814('0x70'),_0xb814('0x69'))[_0xb814('0x6d')]('NOW()','createdAt')[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6b'))[_0xb814('0x71')]('cm_hopper_final')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())['where']('state\x20=\x20?',_0xee204[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')]('phone')[_0xb814('0x71')]('cm_hopper')[_0xb814('0x3b')]('VoiceQueueId\x20=\x20?',_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]()))['where'](_0xb814('0x74'),squel['select']()[_0xb814('0x6d')](_0xb814('0x75'))['from']('cm_hopper_final')[_0xb814('0x3b')](_0xb814('0x76'),_0xee204[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x77')))[_0xb814('0x78')](_0xb814('0x67')))[_0xb814('0x72')]();return db[_0xb814('0x4b')]['query'](_0x295488);}return[];})['then'](respondWithResult(_0x5aabbe,null))['catch'](handleError(_0x5aabbe,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x52b6da,_0x45a202,_0x75a33){return db[_0xb814('0x79')]['find']({'where':{'id':_0x52b6da[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x45a202,null))[_0xb814('0x28')](function(_0x26ce5b){var _0x161658;if(_0x26ce5b){_0x161658=squel[_0xb814('0x61')]()[_0xb814('0x62')](_0xb814('0x63'))['fromQuery']([_0xb814('0x65'),_0xb814('0x66'),_0xb814('0x67'),_0xb814('0x68'),'CampaignId',_0xb814('0x6a'),_0xb814('0x6b')],squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x7a'),'phone')['field'](_0xb814('0x6e'),'scheduledAt')[_0xb814('0x6d')](_0xb814('0x6f'),'ContactId')[_0xb814('0x6d')]('ANY_VALUE(ListId)',_0xb814('0x68'))['field'](_0xb814('0x7b'),_0xb814('0x7c'))[_0xb814('0x6d')](_0xb814('0x6e'),_0xb814('0x6a'))[_0xb814('0x6d')](_0xb814('0x6e'),'updatedAt')['from'](_0xb814('0x7d'))['where']('CampaignId\x20=\x20?',_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x20?',_0x52b6da[_0xb814('0x49')]['state'][_0xb814('0x72')]())[_0xb814('0x3b')](_0xb814('0x73'))[_0xb814('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x65'))['from'](_0xb814('0x63'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da['params']['id'][_0xb814('0x72')]()))[_0xb814('0x3b')](_0xb814('0x74'),squel[_0xb814('0x6c')]()[_0xb814('0x6d')](_0xb814('0x75'))[_0xb814('0x71')](_0xb814('0x7d'))[_0xb814('0x3b')](_0xb814('0x7e'),_0x52b6da[_0xb814('0x46')]['id'][_0xb814('0x72')]())[_0xb814('0x3b')]('state\x20=\x204'))['group'](_0xb814('0x67')))['toString']();return db[_0xb814('0x4b')][_0xb814('0x33')](_0x161658);}return[];})[_0xb814('0x28')](respondWithResult(_0x45a202,null))[_0xb814('0x45')](handleError(_0x45a202,null));};exports[_0xb814('0x7f')]=function(_0x2f1674,_0xf0610f,_0x5db5d0){return db['CmHopper'][_0xb814('0x80')]({'where':{'VoiceQueueId':_0x2f1674['body'][_0xb814('0x69')],'CampaignId':_0x2f1674[_0xb814('0x49')][_0xb814('0x7c')],'ContactId':_0x2f1674['body'][_0xb814('0x67')]}})[_0xb814('0x28')](handleEntityNotFound(_0xf0610f,null))[_0xb814('0x28')](function(_0x38c6da){if(_0x38c6da){return _0x38c6da;}return null;})[_0xb814('0x28')](respondWithResult(_0xf0610f,null))['catch'](handleError(_0xf0610f,null));}; \ No newline at end of file +var _0xc6ac=['key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','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','CmHopperFinal','rawAttributes','fieldName','type'];(function(_0x1bbc9a,_0xbb2f22){var _0x355b9b=function(_0x1ae3a1){while(--_0x1ae3a1){_0x1bbc9a['push'](_0x1bbc9a['shift']());}};_0x355b9b(++_0xbb2f22);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5930f3,_0x407f51){_0x5930f3=_0x5930f3-0x0;var _0x1efd86=_0xc6ac[_0x5930f3];return _0x1efd86;};'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['CmHopperFinal'][_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['describe']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')]()[_0xcc6a('0x27')](respondWithResult(_0x47c999,null))[_0xcc6a('0x4b')](handleError(_0x47c999,null));};exports['update']=function(_0x1c3bb8,_0x5e7bab){if(_0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')]){delete _0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'uniqueid':_0x1c3bb8['params']['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5e7bab,null))[_0xcc6a('0x27')](saveUpdates(_0x1c3bb8[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x5e7bab,null))[_0xcc6a('0x4b')](handleError(_0x5e7bab,null));};exports[_0xcc6a('0x4f')]=function(_0x431684,_0x392805,_0x31987f){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x431684[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db['sequelize']['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal'](_0xcc6a('0x59')))),'abandonedContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})[_0xcc6a('0x27')](handleEntityNotFound(_0x392805,null))[_0xcc6a('0x27')](respondWithResult(_0x392805,null))[_0xcc6a('0x4b')](handleError(_0x392805,null));};exports[_0xcc6a('0x5d')]=function(_0x3e76d7,_0x42bbc7,_0x2ad9a6){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'CampaignId':_0x3e76d7[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x5e')))),_0xcc6a('0x5f')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x59')))),_0xcc6a('0x60')],[db[_0xcc6a('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x61')))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})['then'](handleEntityNotFound(_0x42bbc7,null))[_0xcc6a('0x27')](respondWithResult(_0x42bbc7,null))[_0xcc6a('0x4b')](handleError(_0x42bbc7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x72e53a,_0x5b61df,_0x3b4ce0){return db['VoiceQueue'][_0xcc6a('0x4a')]({'where':{'id':_0x72e53a[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5b61df,null))['then'](function(_0x3ce1eb){var _0x51390a;if(_0x3ce1eb){_0x51390a=squel[_0xcc6a('0x62')]()['into'](_0xcc6a('0x63'))[_0xcc6a('0x64')]([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'VoiceQueueId',_0xcc6a('0x69'),_0xcc6a('0x6a')],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),'phone')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'scheduledAt')['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(VoiceQueueId)',_0xcc6a('0x71'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x69'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'updatedAt')['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x72e53a['body'][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x65'))[_0xcc6a('0x79')]('cm_hopper')[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())['where'](_0xcc6a('0x7b')))[_0xcc6a('0x7c')](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0x51390a);}return[];})['then'](respondWithResult(_0x5b61df,null))['catch'](handleError(_0x5b61df,null));};exports[_0xcc6a('0x7d')]=function(_0x5be65b,_0xb42e9,_0x35a798){return db[_0xcc6a('0x7e')][_0xcc6a('0x4a')]({'where':{'id':_0x5be65b[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0xb42e9,null))[_0xcc6a('0x27')](function(_0x1746d8){var _0xc0d194;if(_0x1746d8){_0xc0d194=squel[_0xcc6a('0x62')]()[_0xcc6a('0x7f')](_0xcc6a('0x63'))['fromQuery']([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'CampaignId',_0xcc6a('0x69'),'updatedAt'],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),_0xcc6a('0x65'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x66'))['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(CampaignId)',_0xcc6a('0x80'))[_0xcc6a('0x6c')]('NOW()','createdAt')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x6a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))['where'](_0xcc6a('0x81'),_0x5be65b['params']['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x5be65b[_0xcc6a('0x4d')][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))['where'](_0xcc6a('0x78'),squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')]('phone')[_0xcc6a('0x79')](_0xcc6a('0x63'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id']['toString']())['where'](_0xcc6a('0x7b')))['group'](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0xc0d194);}return[];})[_0xcc6a('0x27')](respondWithResult(_0xb42e9,null))[_0xcc6a('0x4b')](handleError(_0xb42e9,null));};exports[_0xcc6a('0x82')]=function(_0x48b6e3,_0x10d731,_0x537e2b){return db['CmHopper'][_0xcc6a('0x83')]({'where':{'VoiceQueueId':_0x48b6e3['body'][_0xcc6a('0x71')],'CampaignId':_0x48b6e3[_0xcc6a('0x4d')]['CampaignId'],'ContactId':_0x48b6e3['body'][_0xcc6a('0x67')]}})['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x27')](function(_0x3df510){if(_0x3df510){return _0x3df510;}return null;})[_0xcc6a('0x27')](respondWithResult(_0x10d731,null))[_0xcc6a('0x4b')](handleError(_0x10d731,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 860e1a1..a629510 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 _0x9740=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final'];(function(_0x3db791,_0xc96e9b){var _0x4d4eb0=function(_0x1e3dcf){while(--_0x1e3dcf){_0x3db791['push'](_0x3db791['shift']());}};_0x4d4eb0(++_0xc96e9b);}(_0x9740,0x172));var _0x0974=function(_0x26e322,_0x56b29c){_0x26e322=_0x26e322-0x0;var _0x56ed11=_0x9740[_0x26e322];return _0x56ed11;};'use strict';var _=require(_0x0974('0x0'));var util=require(_0x0974('0x1'));var logger=require(_0x0974('0x2'))(_0x0974('0x3'));var moment=require(_0x0974('0x4'));var BPromise=require(_0x0974('0x5'));var rp=require(_0x0974('0x6'));var fs=require('fs');var path=require(_0x0974('0x7'));var rimraf=require(_0x0974('0x8'));var config=require(_0x0974('0x9'));var attributes=require(_0x0974('0xa'));module[_0x0974('0xb')]=function(_0x924728,_0x5c0bee){return _0x924728[_0x0974('0xc')]('CmHopperFinal',attributes,{'tableName':_0x0974('0xd'),'paranoid':![],'indexes':[{'name':_0x0974('0xe'),'fields':[_0x0974('0xe')]},{'name':_0x0974('0xf'),'fields':[_0x0974('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x585d=['./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x27a234,_0x5d75a3){var _0xe6031b=function(_0x109176){while(--_0x109176){_0x27a234['push'](_0x27a234['shift']());}};_0xe6031b(++_0x5d75a3);}(_0x585d,0x147));var _0xd585=function(_0x3979db,_0x27398b){_0x3979db=_0x3979db-0x0;var _0x1de1c3=_0x585d[_0x3979db];return _0x1de1c3;};'use strict';var _=require(_0xd585('0x0'));var util=require(_0xd585('0x1'));var logger=require(_0xd585('0x2'))(_0xd585('0x3'));var moment=require(_0xd585('0x4'));var BPromise=require('bluebird');var rp=require(_0xd585('0x5'));var fs=require('fs');var path=require(_0xd585('0x6'));var rimraf=require(_0xd585('0x7'));var config=require(_0xd585('0x8'));var attributes=require(_0xd585('0x9'));module[_0xd585('0xa')]=function(_0x589ccb,_0x31afcf){return _0x589ccb[_0xd585('0xb')](_0xd585('0xc'),attributes,{'tableName':_0xd585('0xd'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xd585('0xe')]},{'name':_0xd585('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index dfe370c..226feeb 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(_0x45a80e,_0x5ba9d0){var _0x415d52=function(_0x2166ae){while(--_0x2166ae){_0x45a80e['push'](_0x45a80e['shift']());}};_0x415d52(++_0x5ba9d0);}(_0xb10b,0x12a));var _0xbb10=function(_0x1caf4f,_0xd0b32d){_0x1caf4f=_0x1caf4f-0x0;var _0x11b9e2=_0xb10b[_0x1caf4f];return _0x11b9e2;};'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(_0x233639,_0x5a0c0e){var _0x3b5aa3=function(_0x570d09){while(--_0x570d09){_0x233639['push'](_0x233639['shift']());}};_0x3b5aa3(++_0x5a0c0e);}(_0x7a54,0x106));var _0x47a5=function(_0x408ee6,_0x53fa75){_0x408ee6=_0x408ee6-0x0;var _0x365781=_0x7a54[_0x408ee6];return _0x365781;};'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 2324752..7e4d8f9 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 _0x0e79=['get','isAuthenticated','index','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller'];(function(_0xd22918,_0x1de1a1){var _0x30c9f9=function(_0x40b277){while(--_0x40b277){_0xd22918['push'](_0xd22918['shift']());}};_0x30c9f9(++_0x1de1a1);}(_0x0e79,0xac));var _0x90e7=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0e79[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x90e7('0x0'));var util=require(_0x90e7('0x1'));var path=require(_0x90e7('0x2'));var timeout=require(_0x90e7('0x3'));var express=require(_0x90e7('0x4'));var router=express['Router']();var fs_extra=require(_0x90e7('0x5'));var auth=require(_0x90e7('0x6'));var interaction=require(_0x90e7('0x7'));var config=require(_0x90e7('0x8'));var controller=require(_0x90e7('0x9'));router[_0x90e7('0xa')]('/',auth[_0x90e7('0xb')](),controller[_0x90e7('0xc')]);router['get']('/describe',auth[_0x90e7('0xb')](),controller['describe']);router[_0x90e7('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x90e7('0xd'),auth[_0x90e7('0xb')](),controller[_0x90e7('0xe')]);router[_0x90e7('0xa')](_0x90e7('0xf'),auth[_0x90e7('0xb')](),controller[_0x90e7('0x10')]);router[_0x90e7('0x11')](_0x90e7('0x12'),auth['isAuthenticated'](),controller[_0x90e7('0x13')]);router[_0x90e7('0x11')](_0x90e7('0x14'),auth[_0x90e7('0xb')](),controller[_0x90e7('0x15')]);router[_0x90e7('0x11')](_0x90e7('0x16'),auth['isAuthenticated'](),controller[_0x90e7('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x90e7('0x18')]);module[_0x90e7('0x19')]=router; \ No newline at end of file +var _0x4c71=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path'];(function(_0x48f683,_0xec583){var _0x13acce=function(_0x26bf13){while(--_0x26bf13){_0x48f683['push'](_0x48f683['shift']());}};_0x13acce(++_0xec583);}(_0x4c71,0x185));var _0x14c7=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4c71[_0x5a776b];return _0xbbef59;};'use strict';var multer=require(_0x14c7('0x0'));var util=require(_0x14c7('0x1'));var path=require(_0x14c7('0x2'));var timeout=require(_0x14c7('0x3'));var express=require(_0x14c7('0x4'));var router=express['Router']();var fs_extra=require(_0x14c7('0x5'));var auth=require(_0x14c7('0x6'));var interaction=require(_0x14c7('0x7'));var config=require(_0x14c7('0x8'));var controller=require(_0x14c7('0x9'));router[_0x14c7('0xa')]('/',auth[_0x14c7('0xb')](),controller[_0x14c7('0xc')]);router[_0x14c7('0xa')](_0x14c7('0xd'),auth[_0x14c7('0xb')](),controller[_0x14c7('0xe')]);router[_0x14c7('0xa')](_0x14c7('0xf'),auth['isAuthenticated'](),controller[_0x14c7('0x10')]);router[_0x14c7('0xa')](_0x14c7('0x11'),auth[_0x14c7('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x14c7('0x12'),auth[_0x14c7('0xb')](),controller[_0x14c7('0x13')]);router[_0x14c7('0x14')](_0x14c7('0x15'),auth[_0x14c7('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x14c7('0x16'),auth['isAuthenticated'](),controller[_0x14c7('0x17')]);router[_0x14c7('0x14')](_0x14c7('0x18'),auth[_0x14c7('0xb')](),controller[_0x14c7('0x19')]);router['put'](_0x14c7('0xf'),auth['isAuthenticated'](),controller[_0x14c7('0x1a')]);module[_0x14c7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index bb3d113..c29bd11 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 _0xbb68=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x558dad,_0x1a9b5a){var _0x1921ea=function(_0x2d44d6){while(--_0x2d44d6){_0x558dad['push'](_0x558dad['shift']());}};_0x1921ea(++_0x1a9b5a);}(_0xbb68,0xad));var _0x8bb6=function(_0x397496,_0x4783d2){_0x397496=_0x397496-0x0;var _0x1a12e2=_0xbb68[_0x397496];return _0x1a12e2;};'use strict';var Sequelize=require(_0x8bb6('0x0'));module[_0x8bb6('0x1')]={'state':{'type':Sequelize[_0x8bb6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8bb6('0x3')]},'scheduledat':{'type':Sequelize[_0x8bb6('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8bb6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8bb6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8bb6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8bb6('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8bb6('0x3')]},'calleridname':{'type':Sequelize[_0x8bb6('0x3')]},'starttime':{'type':Sequelize[_0x8bb6('0x4')]},'responsetime':{'type':Sequelize[_0x8bb6('0x4')]},'answertime':{'type':Sequelize[_0x8bb6('0x4')]},'droptime':{'type':Sequelize[_0x8bb6('0x4')]},'endtime':{'type':Sequelize[_0x8bb6('0x4')]},'ringtime':{'type':Sequelize[_0x8bb6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8bb6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8bb6('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8bb6('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8bb6('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x8bb6('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8bb6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8bb6('0x4')]},'recallme':{'type':Sequelize[_0x8bb6('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8bb6('0x4')]},'edited':{'type':Sequelize[_0x8bb6('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8bb6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8bb6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8bb6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8bb6('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8bb6('0x3')]}}; \ No newline at end of file +var _0xa468=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x2a4fba,_0x38652d){var _0x14b733=function(_0x8ad224){while(--_0x8ad224){_0x2a4fba['push'](_0x2a4fba['shift']());}};_0x14b733(++_0x38652d);}(_0xa468,0x1b1));var _0x8a46=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xa468[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x8a46('0x0'));module[_0x8a46('0x1')]={'state':{'type':Sequelize[_0x8a46('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8a46('0x3')]},'scheduledat':{'type':Sequelize[_0x8a46('0x4')]},'countbusyretry':{'type':Sequelize[_0x8a46('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8a46('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8a46('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8a46('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8a46('0x3')]},'calleridnum':{'type':Sequelize[_0x8a46('0x3')]},'calleridname':{'type':Sequelize[_0x8a46('0x3')]},'starttime':{'type':Sequelize[_0x8a46('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8a46('0x4')]},'endtime':{'type':Sequelize[_0x8a46('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8a46('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8a46('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8a46('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8a46('0x3')]},'campaign':{'type':Sequelize[_0x8a46('0x3')]},'campaigntype':{'type':Sequelize[_0x8a46('0x3')]},'membername':{'type':Sequelize[_0x8a46('0x3')]},'reason':{'type':Sequelize[_0x8a46('0x3')]},'amd':{'type':Sequelize[_0x8a46('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8a46('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8a46('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8a46('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8a46('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8a46('0x4')]},'edited':{'type':Sequelize[_0x8a46('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8a46('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8a46('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8a46('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 8b888c4..03b8d3a 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 _0xafee=['intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','describe','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','model','attributes'];(function(_0x5e7331,_0x3b811b){var _0x192bf1=function(_0x274981){while(--_0x274981){_0x5e7331['push'](_0x5e7331['shift']());}};_0x192bf1(++_0x3b811b);}(_0xafee,0xac));var _0xeafe=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xafee[_0x68c979];return _0x4f0001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeafe('0x0'));var zipdir=require(_0xeafe('0x1'));var jsonpatch=require(_0xeafe('0x2'));var rp=require(_0xeafe('0x3'));var moment=require(_0xeafe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeafe('0x5'));var util=require('util');var path=require(_0xeafe('0x6'));var sox=require(_0xeafe('0x7'));var csv=require(_0xeafe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeafe('0x9'));var squel=require('squel');var crypto=require(_0xeafe('0xa'));var jsforce=require(_0xeafe('0xb'));var deskjs=require(_0xeafe('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeafe('0xd'));var Papa=require('papaparse');var Redis=require(_0xeafe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xeafe('0xf'));var as=require(_0xeafe('0x10'));var hardwareService=require(_0xeafe('0x11'));var logger=require(_0xeafe('0x12'))('api');var utils=require(_0xeafe('0x13'));var config=require(_0xeafe('0x14'));var licenseUtil=require(_0xeafe('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x297058,_0x25504f){_0x25504f=_0x25504f||0xcc;return function(_0x396090){if(_0x396090){return _0x297058['sendStatus'](_0x25504f);}return _0x297058['status'](_0x25504f)[_0xeafe('0x16')]();};}function respondWithResult(_0x446cab,_0xf18c7c){_0xf18c7c=_0xf18c7c||0xc8;return function(_0x50defb){if(_0x50defb){return _0x446cab[_0xeafe('0x17')](_0xf18c7c)[_0xeafe('0x18')](_0x50defb);}};}function respondWithFilteredResult(_0x5904ab,_0x127c23){return function(_0x3b8837){if(_0x3b8837){var _0x2bed8e=typeof _0x127c23[_0xeafe('0x19')]==='undefined'&&typeof _0x127c23[_0xeafe('0x1a')]===_0xeafe('0x1b');var _0x4bf311=_0x3b8837['count'];var _0x478631=_0x2bed8e?0x0:_0x127c23[_0xeafe('0x19')];var _0x2e5504=_0x2bed8e?_0x3b8837[_0xeafe('0x1c')]:_0x127c23[_0xeafe('0x19')]+_0x127c23['limit'];var _0x1be1e1;if(_0x2e5504>=_0x4bf311){_0x2e5504=_0x4bf311;_0x1be1e1=0xc8;}else{_0x1be1e1=0xce;}_0x5904ab[_0xeafe('0x17')](_0x1be1e1);return _0x5904ab[_0xeafe('0x1d')](_0xeafe('0x1e'),_0x478631+'-'+_0x2e5504+'/'+_0x4bf311)[_0xeafe('0x18')](_0x3b8837);}return null;};}function patchUpdates(_0x95f859){return function(_0x4ac0d6){try{jsonpatch[_0xeafe('0x1f')](_0x4ac0d6,_0x95f859,!![]);}catch(_0x2d6c90){return BPromise['reject'](_0x2d6c90);}return _0x4ac0d6[_0xeafe('0x20')]();};}function saveUpdates(_0x1d408a,_0x1be5ad){return function(_0x23f9e5){if(_0x23f9e5){return _0x23f9e5[_0xeafe('0x21')](_0x1d408a)[_0xeafe('0x22')](function(_0x15fdd0){return _0x15fdd0;});}return null;};}function removeEntity(_0x14d94a,_0x46e9d2){return function(_0x4e05f7){if(_0x4e05f7){return _0x4e05f7[_0xeafe('0x23')]()[_0xeafe('0x22')](function(){_0x14d94a[_0xeafe('0x17')](0xcc)[_0xeafe('0x16')]();});}};}function handleEntityNotFound(_0x141cb8,_0x961fef){return function(_0x2456ae){if(!_0x2456ae){_0x141cb8[_0xeafe('0x24')](0x194);}return _0x2456ae;};}function handleError(_0x59a5c4,_0x22bdd0){_0x22bdd0=_0x22bdd0||0x1f4;return function(_0x25b0b8){logger['error'](_0x25b0b8[_0xeafe('0x25')]);if(_0x25b0b8[_0xeafe('0x26')]){delete _0x25b0b8['name'];}_0x59a5c4[_0xeafe('0x17')](_0x22bdd0)[_0xeafe('0x27')](_0x25b0b8);};}exports[_0xeafe('0x28')]=function(_0x47a3df,_0x13851f){var _0x2ca34c={},_0xe528f3={},_0x4f97d5={'count':0x0,'rows':[]};var _0x47a807=_['map'](db['CmHopperHistory'][_0xeafe('0x29')],function(_0x2efd4a){return{'name':_0x2efd4a[_0xeafe('0x2a')],'type':_0x2efd4a[_0xeafe('0x2b')][_0xeafe('0x2c')]};});_0xe528f3['model']=_[_0xeafe('0x2d')](_0x47a807,_0xeafe('0x26'));_0xe528f3[_0xeafe('0x2e')]=_['keys'](_0x47a3df['query']);_0xe528f3[_0xeafe('0x2f')]=_['intersection'](_0xe528f3[_0xeafe('0x30')],_0xe528f3[_0xeafe('0x2e')]);_0x2ca34c[_0xeafe('0x31')]=_[_0xeafe('0x32')](_0xe528f3[_0xeafe('0x30')],qs[_0xeafe('0x33')](_0x47a3df[_0xeafe('0x2e')][_0xeafe('0x33')]));_0x2ca34c[_0xeafe('0x31')]=_0x2ca34c[_0xeafe('0x31')][_0xeafe('0x34')]?_0x2ca34c[_0xeafe('0x31')]:_0xe528f3[_0xeafe('0x30')];if(!_0x47a3df[_0xeafe('0x2e')]['hasOwnProperty'](_0xeafe('0x35'))){_0x2ca34c[_0xeafe('0x1a')]=qs[_0xeafe('0x1a')](_0x47a3df[_0xeafe('0x2e')][_0xeafe('0x1a')]);_0x2ca34c['offset']=qs[_0xeafe('0x19')](_0x47a3df[_0xeafe('0x2e')][_0xeafe('0x19')]);}_0x2ca34c[_0xeafe('0x36')]=qs[_0xeafe('0x37')](_0x47a3df['query'][_0xeafe('0x37')]);_0x2ca34c[_0xeafe('0x38')]=qs[_0xeafe('0x2f')](_['pick'](_0x47a3df['query'],_0xe528f3[_0xeafe('0x2f')]),_0x47a807);if(_0x47a3df[_0xeafe('0x2e')]['filter']){_0x2ca34c['where']=_[_0xeafe('0x39')](_0x2ca34c[_0xeafe('0x38')],{'$or':_[_0xeafe('0x2d')](_0x47a807,function(_0x57e49f){if(_0x57e49f[_0xeafe('0x2b')]!==_0xeafe('0x3a')){var _0x4768ec={};_0x4768ec[_0x57e49f[_0xeafe('0x26')]]={'$like':'%'+_0x47a3df[_0xeafe('0x2e')][_0xeafe('0x3b')]+'%'};return _0x4768ec;}})});}_0x2ca34c=_[_0xeafe('0x39')]({},_0x2ca34c,_0x47a3df['options']);var _0x1662c5={'where':_0x2ca34c[_0xeafe('0x38')]};return db[_0xeafe('0x3c')][_0xeafe('0x1c')](_0x1662c5)['then'](function(_0x13f9ef){_0x4f97d5['count']=_0x13f9ef;if(_0x47a3df[_0xeafe('0x2e')][_0xeafe('0x3d')]){_0x2ca34c[_0xeafe('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xeafe('0x3f')](_0x2ca34c);})[_0xeafe('0x22')](function(_0x11cc88){_0x4f97d5[_0xeafe('0x40')]=_0x11cc88;return _0x4f97d5;})[_0xeafe('0x22')](respondWithFilteredResult(_0x13851f,_0x2ca34c))[_0xeafe('0x41')](handleError(_0x13851f,null));};exports[_0xeafe('0x42')]=function(_0x464ab1,_0x50ac8f){var _0x6cbbf1={'raw':!![],'where':{'id':_0x464ab1[_0xeafe('0x43')]['id']}},_0x106db3={};_0x106db3[_0xeafe('0x30')]=_[_0xeafe('0x44')](db[_0xeafe('0x3c')][_0xeafe('0x29')]);_0x106db3[_0xeafe('0x2e')]=_[_0xeafe('0x44')](_0x464ab1[_0xeafe('0x2e')]);_0x106db3[_0xeafe('0x2f')]=_[_0xeafe('0x32')](_0x106db3['model'],_0x106db3[_0xeafe('0x2e')]);_0x6cbbf1[_0xeafe('0x31')]=_[_0xeafe('0x32')](_0x106db3[_0xeafe('0x30')],qs[_0xeafe('0x33')](_0x464ab1[_0xeafe('0x2e')][_0xeafe('0x33')]));_0x6cbbf1[_0xeafe('0x31')]=_0x6cbbf1[_0xeafe('0x31')][_0xeafe('0x34')]?_0x6cbbf1['attributes']:_0x106db3[_0xeafe('0x30')];if(_0x464ab1['query'][_0xeafe('0x3d')]){_0x6cbbf1[_0xeafe('0x3e')]=[{'all':!![]}];}_0x6cbbf1=_['merge']({},_0x6cbbf1,_0x464ab1[_0xeafe('0x45')]);return db[_0xeafe('0x3c')]['find'](_0x6cbbf1)[_0xeafe('0x22')](handleEntityNotFound(_0x50ac8f,null))[_0xeafe('0x22')](respondWithResult(_0x50ac8f,null))[_0xeafe('0x41')](handleError(_0x50ac8f,null));};exports[_0xeafe('0x46')]=function(_0x14758d,_0x16f9b6){return db[_0xeafe('0x3c')][_0xeafe('0x46')](_0x14758d[_0xeafe('0x47')],{})['then'](respondWithResult(_0x16f9b6,0xc9))[_0xeafe('0x41')](handleError(_0x16f9b6,null));};exports[_0xeafe('0x48')]=function(_0x28b4fb,_0x29c669){return db['CmHopperHistory'][_0xeafe('0x48')]()['then'](respondWithResult(_0x29c669,null))[_0xeafe('0x41')](handleError(_0x29c669,null));};exports['update']=function(_0x2ff806,_0x453515){if(_0x2ff806[_0xeafe('0x47')][_0xeafe('0x49')]){delete _0x2ff806[_0xeafe('0x47')][_0xeafe('0x49')];}return db[_0xeafe('0x3c')]['find']({'where':{'uniqueid':_0x2ff806[_0xeafe('0x43')]['id']}})[_0xeafe('0x22')](handleEntityNotFound(_0x453515,null))[_0xeafe('0x22')](saveUpdates(_0x2ff806[_0xeafe('0x47')],null))[_0xeafe('0x22')](respondWithResult(_0x453515,null))[_0xeafe('0x41')](handleError(_0x453515,null));}; \ No newline at end of file +var _0x0a86=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','CmHopperHistory','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','filters'];(function(_0x20936e,_0x4d5283){var _0x50a212=function(_0x467a9a){while(--_0x467a9a){_0x20936e['push'](_0x20936e['shift']());}};_0x50a212(++_0x4d5283);}(_0x0a86,0xfb));var _0x60a8=function(_0x182094,_0x269200){_0x182094=_0x182094-0x0;var _0x2e74ff=_0x0a86[_0x182094];return _0x2e74ff;};'use strict';var emlformat=require(_0x60a8('0x0'));var rimraf=require(_0x60a8('0x1'));var zipdir=require(_0x60a8('0x2'));var jsonpatch=require(_0x60a8('0x3'));var rp=require('request-promise');var moment=require(_0x60a8('0x4'));var BPromise=require(_0x60a8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x60a8('0x6'));var ejs=require(_0x60a8('0x7'));var fs=require('fs');var fs_extra=require(_0x60a8('0x8'));var _=require('lodash');var squel=require(_0x60a8('0x9'));var crypto=require(_0x60a8('0xa'));var jsforce=require(_0x60a8('0xb'));var deskjs=require(_0x60a8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x60a8('0xd'));var Papa=require(_0x60a8('0xe'));var Redis=require(_0x60a8('0xf'));var authService=require(_0x60a8('0x10'));var qs=require(_0x60a8('0x11'));var as=require(_0x60a8('0x12'));var hardwareService=require(_0x60a8('0x13'));var logger=require(_0x60a8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x60a8('0x15'));var licenseUtil=require(_0x60a8('0x16'));var db=require(_0x60a8('0x17'))['db'];function respondWithStatusCode(_0x5dd772,_0x12d957){_0x12d957=_0x12d957||0xcc;return function(_0xf774b1){if(_0xf774b1){return _0x5dd772[_0x60a8('0x18')](_0x12d957);}return _0x5dd772['status'](_0x12d957)[_0x60a8('0x19')]();};}function respondWithResult(_0x4a9aa5,_0x6e65ad){_0x6e65ad=_0x6e65ad||0xc8;return function(_0x26f5c1){if(_0x26f5c1){return _0x4a9aa5['status'](_0x6e65ad)['json'](_0x26f5c1);}};}function respondWithFilteredResult(_0x1f8ca5,_0x5385d6){return function(_0x5ae456){if(_0x5ae456){var _0xce63bf=typeof _0x5385d6['offset']===_0x60a8('0x1a')&&typeof _0x5385d6[_0x60a8('0x1b')]===_0x60a8('0x1a');var _0x30997e=_0x5ae456[_0x60a8('0x1c')];var _0x13bf9e=_0xce63bf?0x0:_0x5385d6['offset'];var _0x593f13=_0xce63bf?_0x5ae456[_0x60a8('0x1c')]:_0x5385d6[_0x60a8('0x1d')]+_0x5385d6[_0x60a8('0x1b')];var _0xe37f34;if(_0x593f13>=_0x30997e){_0x593f13=_0x30997e;_0xe37f34=0xc8;}else{_0xe37f34=0xce;}_0x1f8ca5[_0x60a8('0x1e')](_0xe37f34);return _0x1f8ca5[_0x60a8('0x1f')](_0x60a8('0x20'),_0x13bf9e+'-'+_0x593f13+'/'+_0x30997e)[_0x60a8('0x21')](_0x5ae456);}return null;};}function patchUpdates(_0x20cd19){return function(_0x1427e3){try{jsonpatch['apply'](_0x1427e3,_0x20cd19,!![]);}catch(_0x2e210e){return BPromise['reject'](_0x2e210e);}return _0x1427e3[_0x60a8('0x22')]();};}function saveUpdates(_0x543a61,_0x35fdc3){return function(_0x23f7b3){if(_0x23f7b3){return _0x23f7b3[_0x60a8('0x23')](_0x543a61)[_0x60a8('0x24')](function(_0xcd3a2a){return _0xcd3a2a;});}return null;};}function removeEntity(_0x58bad3,_0x65f697){return function(_0x21b5c9){if(_0x21b5c9){return _0x21b5c9[_0x60a8('0x25')]()[_0x60a8('0x24')](function(){_0x58bad3[_0x60a8('0x1e')](0xcc)[_0x60a8('0x19')]();});}};}function handleEntityNotFound(_0x467437,_0x375bb7){return function(_0x153546){if(!_0x153546){_0x467437[_0x60a8('0x18')](0x194);}return _0x153546;};}function handleError(_0x3eafdd,_0x205463){_0x205463=_0x205463||0x1f4;return function(_0x39856e){logger[_0x60a8('0x26')](_0x39856e[_0x60a8('0x27')]);if(_0x39856e[_0x60a8('0x28')]){delete _0x39856e[_0x60a8('0x28')];}_0x3eafdd[_0x60a8('0x1e')](_0x205463)[_0x60a8('0x29')](_0x39856e);};}exports[_0x60a8('0x2a')]=function(_0x218446,_0x5aded4){var _0x6d98bb={},_0x4b753a={},_0xbfc38={'count':0x0,'rows':[]};var _0x57d8ed=_[_0x60a8('0x2b')](db['CmHopperHistory'][_0x60a8('0x2c')],function(_0x192b42){return{'name':_0x192b42['fieldName'],'type':_0x192b42[_0x60a8('0x2d')]['key']};});_0x4b753a[_0x60a8('0x2e')]=_[_0x60a8('0x2b')](_0x57d8ed,_0x60a8('0x28'));_0x4b753a[_0x60a8('0x2f')]=_['keys'](_0x218446['query']);_0x4b753a[_0x60a8('0x30')]=_[_0x60a8('0x31')](_0x4b753a['model'],_0x4b753a[_0x60a8('0x2f')]);_0x6d98bb[_0x60a8('0x32')]=_[_0x60a8('0x31')](_0x4b753a['model'],qs[_0x60a8('0x33')](_0x218446[_0x60a8('0x2f')][_0x60a8('0x33')]));_0x6d98bb[_0x60a8('0x32')]=_0x6d98bb['attributes'][_0x60a8('0x34')]?_0x6d98bb['attributes']:_0x4b753a[_0x60a8('0x2e')];if(!_0x218446[_0x60a8('0x2f')][_0x60a8('0x35')](_0x60a8('0x36'))){_0x6d98bb['limit']=qs[_0x60a8('0x1b')](_0x218446[_0x60a8('0x2f')][_0x60a8('0x1b')]);_0x6d98bb[_0x60a8('0x1d')]=qs[_0x60a8('0x1d')](_0x218446[_0x60a8('0x2f')][_0x60a8('0x1d')]);}_0x6d98bb[_0x60a8('0x37')]=qs[_0x60a8('0x38')](_0x218446['query']['sort']);_0x6d98bb[_0x60a8('0x39')]=qs['filters'](_['pick'](_0x218446[_0x60a8('0x2f')],_0x4b753a[_0x60a8('0x30')]),_0x57d8ed);if(_0x218446[_0x60a8('0x2f')]['filter']){_0x6d98bb[_0x60a8('0x39')]=_[_0x60a8('0x3a')](_0x6d98bb['where'],{'$or':_[_0x60a8('0x2b')](_0x57d8ed,function(_0x5284fe){if(_0x5284fe[_0x60a8('0x2d')]!==_0x60a8('0x3b')){var _0x25ac9e={};_0x25ac9e[_0x5284fe[_0x60a8('0x28')]]={'$like':'%'+_0x218446[_0x60a8('0x2f')][_0x60a8('0x3c')]+'%'};return _0x25ac9e;}})});}_0x6d98bb=_[_0x60a8('0x3a')]({},_0x6d98bb,_0x218446['options']);var _0x3baa84={'where':_0x6d98bb[_0x60a8('0x39')]};return db[_0x60a8('0x3d')]['count'](_0x3baa84)[_0x60a8('0x24')](function(_0x5b1e49){_0xbfc38[_0x60a8('0x1c')]=_0x5b1e49;if(_0x218446['query']['includeAll']){_0x6d98bb[_0x60a8('0x3e')]=[{'all':!![]}];}return db[_0x60a8('0x3d')][_0x60a8('0x3f')](_0x6d98bb);})[_0x60a8('0x24')](function(_0x25568a){_0xbfc38[_0x60a8('0x40')]=_0x25568a;return _0xbfc38;})[_0x60a8('0x24')](respondWithFilteredResult(_0x5aded4,_0x6d98bb))[_0x60a8('0x41')](handleError(_0x5aded4,null));};exports[_0x60a8('0x42')]=function(_0x727803,_0x310f37){var _0x2c436d={'raw':!![],'where':{'id':_0x727803['params']['id']}},_0x4e456b={};_0x4e456b[_0x60a8('0x2e')]=_[_0x60a8('0x43')](db['CmHopperHistory'][_0x60a8('0x2c')]);_0x4e456b['query']=_[_0x60a8('0x43')](_0x727803[_0x60a8('0x2f')]);_0x4e456b['filters']=_['intersection'](_0x4e456b[_0x60a8('0x2e')],_0x4e456b['query']);_0x2c436d[_0x60a8('0x32')]=_['intersection'](_0x4e456b[_0x60a8('0x2e')],qs[_0x60a8('0x33')](_0x727803['query']['fields']));_0x2c436d[_0x60a8('0x32')]=_0x2c436d[_0x60a8('0x32')]['length']?_0x2c436d[_0x60a8('0x32')]:_0x4e456b[_0x60a8('0x2e')];if(_0x727803['query'][_0x60a8('0x44')]){_0x2c436d[_0x60a8('0x3e')]=[{'all':!![]}];}_0x2c436d=_[_0x60a8('0x3a')]({},_0x2c436d,_0x727803[_0x60a8('0x45')]);return db['CmHopperHistory'][_0x60a8('0x46')](_0x2c436d)[_0x60a8('0x24')](handleEntityNotFound(_0x310f37,null))['then'](respondWithResult(_0x310f37,null))[_0x60a8('0x41')](handleError(_0x310f37,null));};exports[_0x60a8('0x47')]=function(_0x4deac0,_0x1767c1){return db['CmHopperHistory'][_0x60a8('0x47')](_0x4deac0[_0x60a8('0x48')],{})['then'](respondWithResult(_0x1767c1,0xc9))[_0x60a8('0x41')](handleError(_0x1767c1,null));};exports[_0x60a8('0x49')]=function(_0x3c4d4f,_0x357321){return db[_0x60a8('0x3d')]['describe']()[_0x60a8('0x24')](respondWithResult(_0x357321,null))[_0x60a8('0x41')](handleError(_0x357321,null));};exports[_0x60a8('0x23')]=function(_0x2307d6,_0x49c114){if(_0x2307d6[_0x60a8('0x48')][_0x60a8('0x4a')]){delete _0x2307d6[_0x60a8('0x48')][_0x60a8('0x4a')];}return db[_0x60a8('0x3d')][_0x60a8('0x46')]({'where':{'uniqueid':_0x2307d6['params']['id']}})[_0x60a8('0x24')](handleEntityNotFound(_0x49c114,null))['then'](saveUpdates(_0x2307d6[_0x60a8('0x48')],null))[_0x60a8('0x24')](respondWithResult(_0x49c114,null))['catch'](handleError(_0x49c114,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b4547d1..a78aeb2 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 _0xb931=['cm_hopper_history','endtime','uniqueid','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0xb931,0x155));var _0x1b93=function(_0x287b93,_0x65d733){_0x287b93=_0x287b93-0x0;var _0x13ca78=_0xb931[_0x287b93];return _0x13ca78;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1b93('0x0'))('api');var moment=require('moment');var BPromise=require(_0x1b93('0x1'));var rp=require(_0x1b93('0x2'));var fs=require('fs');var path=require(_0x1b93('0x3'));var rimraf=require(_0x1b93('0x4'));var config=require(_0x1b93('0x5'));var attributes=require(_0x1b93('0x6'));module[_0x1b93('0x7')]=function(_0x3a30b2,_0x701ab1){return _0x3a30b2[_0x1b93('0x8')](_0x1b93('0x9'),attributes,{'tableName':_0x1b93('0xa'),'paranoid':![],'indexes':[{'name':_0x1b93('0xb'),'fields':[_0x1b93('0xb')]},{'name':_0x1b93('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0dc=['bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe0dc,0x190));var _0xce0d=function(_0x54a229,_0x479dd1){_0x54a229=_0x54a229-0x0;var _0x36232e=_0xe0dc[_0x54a229];return _0x36232e;};'use strict';var _=require(_0xce0d('0x0'));var util=require('util');var logger=require(_0xce0d('0x1'))(_0xce0d('0x2'));var moment=require('moment');var BPromise=require(_0xce0d('0x3'));var rp=require(_0xce0d('0x4'));var fs=require('fs');var path=require(_0xce0d('0x5'));var rimraf=require(_0xce0d('0x6'));var config=require('../../config/environment');var attributes=require(_0xce0d('0x7'));module['exports']=function(_0x3e7888,_0x33f430){return _0x3e7888[_0xce0d('0x8')](_0xce0d('0x9'),attributes,{'tableName':_0xce0d('0xa'),'paranoid':![],'indexes':[{'name':_0xce0d('0xb'),'fields':[_0xce0d('0xb')]},{'name':_0xce0d('0xc'),'fields':[_0xce0d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2588cdc..a900849 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 _0x85cf=['options','raw','then','findAll','where','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','debug','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create'];(function(_0x46a4bb,_0x2b1149){var _0x45660f=function(_0x1fe1b5){while(--_0x1fe1b5){_0x46a4bb['push'](_0x46a4bb['shift']());}};_0x45660f(++_0x2b1149);}(_0x85cf,0x76));var _0xf85c=function(_0x2abd03,_0x15bd78){_0x2abd03=_0x2abd03-0x0;var _0x397306=_0x85cf[_0x2abd03];return _0x397306;};'use strict';var _=require('lodash');var util=require(_0xf85c('0x0'));var moment=require(_0xf85c('0x1'));var BPromise=require(_0xf85c('0x2'));var rs=require(_0xf85c('0x3'));var fs=require('fs');var Redis=require(_0xf85c('0x4'));var db=require(_0xf85c('0x5'))['db'];var utils=require(_0xf85c('0x6'));var logger=require(_0xf85c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf85c('0x8'));var client=jayson[_0xf85c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x386a60,_0x41d08d,_0xe1be83){return new BPromise(function(_0x1bebcf,_0x1857d9){return client[_0xf85c('0xa')](_0x386a60,_0xe1be83)['then'](function(_0x25aa6e){logger[_0xf85c('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x41d08d,'request\x20sent');logger[_0xf85c('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x41d08d,_0xf85c('0xd'),JSON[_0xf85c('0xe')](_0x25aa6e));if(_0x25aa6e[_0xf85c('0xf')]){if(_0x25aa6e['error'][_0xf85c('0x10')]===0x1f4){logger[_0xf85c('0xf')](_0xf85c('0x11'),_0x41d08d,_0x25aa6e[_0xf85c('0xf')]['message']);return _0x1857d9(_0x25aa6e[_0xf85c('0xf')][_0xf85c('0x12')]);}logger[_0xf85c('0xf')](_0xf85c('0x11'),_0x41d08d,_0x25aa6e['error'][_0xf85c('0x12')]);return _0x1bebcf(_0x25aa6e['error'][_0xf85c('0x12')]);}else{logger['info'](_0xf85c('0x11'),_0x41d08d,'request\x20sent');_0x1bebcf(_0x25aa6e[_0xf85c('0x13')]['message']);}})[_0xf85c('0x14')](function(_0x30b768){logger[_0xf85c('0xf')](_0xf85c('0x11'),_0x41d08d,_0x30b768);_0x1857d9(_0x30b768);});});}exports[_0xf85c('0x15')]=function(_0x5260c5){var _0x495854=this;return new Promise(function(_0x389693,_0x5a4a80){return db[_0xf85c('0x16')][_0xf85c('0x17')](_0x5260c5['body'],{'raw':_0x5260c5[_0xf85c('0x18')]?_0x5260c5[_0xf85c('0x18')][_0xf85c('0x19')]===undefined?!![]:![]:!![]})[_0xf85c('0x1a')](function(_0x41ff9e){logger['info'](_0xf85c('0x15'),_0x5260c5);logger['debug'](_0xf85c('0x15'),_0x5260c5,JSON[_0xf85c('0xe')](_0x41ff9e));_0x389693(_0x41ff9e);})['catch'](function(_0x5e7c08){logger[_0xf85c('0xf')](_0xf85c('0x15'),_0x5e7c08[_0xf85c('0x12')],_0x5260c5);_0x5a4a80(_0x495854[_0xf85c('0xf')](0x1f4,_0x5e7c08[_0xf85c('0x12')]));});});};exports['AvgHandleTime']=function(_0x903fe6){var _0xae5462=this;return new Promise(function(_0x550cf3,_0x5c819f){return db[_0xf85c('0x16')][_0xf85c('0x1b')]({'raw':_0x903fe6[_0xf85c('0x18')]?_0x903fe6['options'][_0xf85c('0x19')]===undefined?!![]:![]:!![],'where':_0x903fe6['options']?_0x903fe6['options'][_0xf85c('0x1c')]||null:null,'attributes':[[db[_0xf85c('0x1d')]['fn']('COUNT',db[_0xf85c('0x1d')][_0xf85c('0x1e')]('id')),'predictiveIntervalTotalCalls'],[db[_0xf85c('0x1d')]['fn']('COUNT',db[_0xf85c('0x1d')]['fn']('IF',db['sequelize'][_0xf85c('0x1f')](_0xf85c('0x20')))),_0xf85c('0x21')],[db['sequelize']['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db['sequelize'][_0xf85c('0x1f')](_0xf85c('0x23')))),_0xf85c('0x24')],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')][_0xf85c('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0xf85c('0x25')],[db['sequelize']['fn'](_0xf85c('0x26'),db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')][_0xf85c('0x1f')](_0xf85c('0x27')))),_0xf85c('0x28')],[db[_0xf85c('0x1d')]['fn']('AVG',db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')][_0xf85c('0x1f')](_0xf85c('0x29')))),_0xf85c('0x2a')]]})[_0xf85c('0x1a')](function(_0x13c5fd){logger[_0xf85c('0xb')]('AvgHandleTime',_0x903fe6);logger['debug'](_0xf85c('0x2b'),_0x903fe6,JSON['stringify'](_0x13c5fd));_0x550cf3(_0x13c5fd);})[_0xf85c('0x14')](function(_0x3e9355){logger[_0xf85c('0xf')]('AvgHandleTime',_0x3e9355[_0xf85c('0x12')],_0x903fe6);_0x5c819f(_0xae5462[_0xf85c('0xf')](0x1f4,_0x3e9355['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x55c877){var _0x56bac2=this;return new Promise(function(_0x34e08d,_0x3d45f3){return db['CmHopperHistory'][_0xf85c('0x1b')]({'raw':_0x55c877[_0xf85c('0x18')]?_0x55c877[_0xf85c('0x18')][_0xf85c('0x19')]===undefined?!![]:![]:!![],'where':_0x55c877[_0xf85c('0x18')]?_0x55c877['options'][_0xf85c('0x1c')]||null:null,'attributes':[[_0xf85c('0x2c'),_0xf85c('0x2d')],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')]['literal'](_0xf85c('0x2e')))),_0xf85c('0x2f')],[db[_0xf85c('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf85c('0x1d')][_0xf85c('0x1f')](_0xf85c('0x30')))),_0xf85c('0x31')],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db['sequelize'][_0xf85c('0x1f')](_0xf85c('0x20')))),_0xf85c('0x32')],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')][_0xf85c('0x1f')](_0xf85c('0x33')))),_0xf85c('0x34')],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db['sequelize'][_0xf85c('0x1f')](_0xf85c('0x35')))),_0xf85c('0x36')],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')][_0xf85c('0x1f')](_0xf85c('0x37')))),_0xf85c('0x38')],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')][_0xf85c('0x1f')](_0xf85c('0x39')))),_0xf85c('0x3a')],[db[_0xf85c('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf85c('0x1d')]['literal'](_0xf85c('0x3b')))),'outboundUnknownCallsDay'],[db[_0xf85c('0x1d')]['fn']('COUNT',db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0xf85c('0x3c')],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db['sequelize']['fn']('IF',db[_0xf85c('0x1d')][_0xf85c('0x1f')](_0xf85c('0x3d')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xf85c('0x1f')](_0xf85c('0x3e')))),_0xf85c('0x3f')],[db['sequelize']['fn']('COUNT',db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')]['literal'](_0xf85c('0x40')))),_0xf85c('0x41')],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2020,\x201,\x20null'))),_0xf85c('0x3f')],[db['sequelize']['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')]['literal'](_0xf85c('0x42')))),_0xf85c('0x43')]],'group':[_0xf85c('0x2c')]})[_0xf85c('0x1a')](function(_0x1e72ec){logger[_0xf85c('0xb')](_0xf85c('0x44'),_0x55c877);logger['debug'](_0xf85c('0x44'),_0x55c877,JSON[_0xf85c('0xe')](_0x1e72ec));_0x34e08d(_0x1e72ec);})[_0xf85c('0x14')](function(_0x54ec6c){logger[_0xf85c('0xf')](_0xf85c('0x44'),_0x54ec6c[_0xf85c('0x12')],_0x55c877);_0x3d45f3(_0x56bac2[_0xf85c('0xf')](0x1f4,_0x54ec6c['message']));});});};exports[_0xf85c('0x45')]=function(_0x51cd31){var _0x4edb2d=this;return new Promise(function(_0x1bc2ce,_0xd478ad){return db[_0xf85c('0x16')][_0xf85c('0x1b')]({'raw':_0x51cd31['options']?_0x51cd31['options'][_0xf85c('0x19')]===undefined?!![]:![]:!![],'where':_0x51cd31[_0xf85c('0x18')]?_0x51cd31['options']['where']||null:null,'attributes':[['campaign',_0xf85c('0x2d')],[db['sequelize']['fn']('COUNT',db[_0xf85c('0x1d')]['col']('id')),'ivrTotalCallsDays'],[db[_0xf85c('0x1d')]['fn'](_0xf85c('0x22'),db[_0xf85c('0x1d')]['fn']('IF',db[_0xf85c('0x1d')][_0xf85c('0x1f')](_0xf85c('0x20')))),_0xf85c('0x46')]],'group':[_0xf85c('0x2c')]})['then'](function(_0x227a93){logger['info']('GetCampaignHopperHistory',_0x51cd31);logger[_0xf85c('0xc')](_0xf85c('0x45'),_0x51cd31,JSON[_0xf85c('0xe')](_0x227a93));_0x1bc2ce(_0x227a93);})['catch'](function(_0x4601fb){logger[_0xf85c('0xf')](_0xf85c('0x45'),_0x4601fb[_0xf85c('0x12')],_0x51cd31);_0xd478ad(_0x4edb2d['error'](0x1f4,_0x4601fb[_0xf85c('0x12')]));});});}; \ No newline at end of file +var _0x5c9f=['outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','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','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','then','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c9f,0x173));var _0xf5c9=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x5c9f[_0x40822a];return _0x357420;};'use strict';var _=require('lodash');var util=require(_0xf5c9('0x0'));var moment=require(_0xf5c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xf5c9('0x2'));var fs=require('fs');var Redis=require(_0xf5c9('0x3'));var db=require(_0xf5c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5c9('0x5'))(_0xf5c9('0x6'));var config=require('../../config/environment');var jayson=require(_0xf5c9('0x7'));var client=jayson['client'][_0xf5c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f4285,_0x4de023,_0x2b5be8){return new BPromise(function(_0x9ba836,_0x1ebaab){return client[_0xf5c9('0x9')](_0x4f4285,_0x2b5be8)['then'](function(_0x4f2c1d){logger['info'](_0xf5c9('0xa'),_0x4de023,_0xf5c9('0xb'));logger[_0xf5c9('0xc')](_0xf5c9('0xd'),_0x4de023,_0xf5c9('0xb'),JSON[_0xf5c9('0xe')](_0x4f2c1d));if(_0x4f2c1d[_0xf5c9('0xf')]){if(_0x4f2c1d[_0xf5c9('0xf')][_0xf5c9('0x10')]===0x1f4){logger[_0xf5c9('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x4de023,_0x4f2c1d['error'][_0xf5c9('0x11')]);return _0x1ebaab(_0x4f2c1d[_0xf5c9('0xf')]['message']);}logger[_0xf5c9('0xf')](_0xf5c9('0xa'),_0x4de023,_0x4f2c1d['error'][_0xf5c9('0x11')]);return _0x9ba836(_0x4f2c1d[_0xf5c9('0xf')][_0xf5c9('0x11')]);}else{logger[_0xf5c9('0x12')](_0xf5c9('0xa'),_0x4de023,'request\x20sent');_0x9ba836(_0x4f2c1d['result'][_0xf5c9('0x11')]);}})[_0xf5c9('0x13')](function(_0xb2b7c5){logger['error'](_0xf5c9('0xa'),_0x4de023,_0xb2b7c5);_0x1ebaab(_0xb2b7c5);});});}exports[_0xf5c9('0x14')]=function(_0xfecc65){var _0x58967f=this;return new Promise(function(_0x9229ff,_0x54a54b){return db[_0xf5c9('0x15')][_0xf5c9('0x16')](_0xfecc65[_0xf5c9('0x17')],{'raw':_0xfecc65[_0xf5c9('0x18')]?_0xfecc65[_0xf5c9('0x18')][_0xf5c9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2b347a){logger['info'](_0xf5c9('0x14'),_0xfecc65);logger[_0xf5c9('0xc')](_0xf5c9('0x14'),_0xfecc65,JSON[_0xf5c9('0xe')](_0x2b347a));_0x9229ff(_0x2b347a);})[_0xf5c9('0x13')](function(_0x576f36){logger['error'](_0xf5c9('0x14'),_0x576f36[_0xf5c9('0x11')],_0xfecc65);_0x54a54b(_0x58967f['error'](0x1f4,_0x576f36[_0xf5c9('0x11')]));});});};exports[_0xf5c9('0x1a')]=function(_0x2a8994){var _0x5b27cf=this;return new Promise(function(_0x2959cf,_0x37ffc2){return db[_0xf5c9('0x15')][_0xf5c9('0x1b')]({'raw':_0x2a8994[_0xf5c9('0x18')]?_0x2a8994['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a8994[_0xf5c9('0x18')]?_0x2a8994[_0xf5c9('0x18')][_0xf5c9('0x1c')]||null:null,'attributes':[[db[_0xf5c9('0x1d')]['fn']('COUNT',db[_0xf5c9('0x1d')][_0xf5c9('0x1e')]('id')),_0xf5c9('0x1f')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db[_0xf5c9('0x1d')]['fn']('IF',db['sequelize'][_0xf5c9('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xf5c9('0x22')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db[_0xf5c9('0x1d')]['fn']('IF',db[_0xf5c9('0x1d')][_0xf5c9('0x21')](_0xf5c9('0x23')))),_0xf5c9('0x24')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db[_0xf5c9('0x1d')]['fn']('IF',db[_0xf5c9('0x1d')][_0xf5c9('0x21')](_0xf5c9('0x25')))),_0xf5c9('0x26')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x27'),db[_0xf5c9('0x1d')]['fn']('IF',db['sequelize'][_0xf5c9('0x21')](_0xf5c9('0x28')))),_0xf5c9('0x29')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x27'),db[_0xf5c9('0x1d')]['fn']('IF',db[_0xf5c9('0x1d')][_0xf5c9('0x21')](_0xf5c9('0x2a')))),_0xf5c9('0x2b')]]})[_0xf5c9('0x2c')](function(_0x5a14ae){logger['info'](_0xf5c9('0x1a'),_0x2a8994);logger[_0xf5c9('0xc')]('AvgHandleTime',_0x2a8994,JSON[_0xf5c9('0xe')](_0x5a14ae));_0x2959cf(_0x5a14ae);})[_0xf5c9('0x13')](function(_0x3a4d13){logger['error'](_0xf5c9('0x1a'),_0x3a4d13[_0xf5c9('0x11')],_0x2a8994);_0x37ffc2(_0x5b27cf[_0xf5c9('0xf')](0x1f4,_0x3a4d13[_0xf5c9('0x11')]));});});};exports[_0xf5c9('0x2d')]=function(_0x5a369e){var _0x2d16da=this;return new Promise(function(_0x528ab7,_0x27e7f8){return db[_0xf5c9('0x15')][_0xf5c9('0x1b')]({'raw':_0x5a369e['options']?_0x5a369e['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a369e['options']?_0x5a369e[_0xf5c9('0x18')][_0xf5c9('0x1c')]||null:null,'attributes':[[_0xf5c9('0x2e'),_0xf5c9('0x2f')],[db[_0xf5c9('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf5c9('0x1d')]['literal'](_0xf5c9('0x30')))),_0xf5c9('0x31')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db['sequelize']['fn']('IF',db[_0xf5c9('0x1d')][_0xf5c9('0x21')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db['sequelize']['fn']('IF',db[_0xf5c9('0x1d')]['literal'](_0xf5c9('0x32')))),_0xf5c9('0x33')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db[_0xf5c9('0x1d')]['fn']('IF',db[_0xf5c9('0x1d')]['literal'](_0xf5c9('0x34')))),_0xf5c9('0x35')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db[_0xf5c9('0x1d')]['fn']('IF',db[_0xf5c9('0x1d')]['literal'](_0xf5c9('0x36')))),_0xf5c9('0x37')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db[_0xf5c9('0x1d')]['fn']('IF',db['sequelize'][_0xf5c9('0x21')](_0xf5c9('0x38')))),_0xf5c9('0x39')],[db[_0xf5c9('0x1d')]['fn']('COUNT',db[_0xf5c9('0x1d')]['fn']('IF',db[_0xf5c9('0x1d')][_0xf5c9('0x21')](_0xf5c9('0x3a')))),_0xf5c9('0x3b')],[db[_0xf5c9('0x1d')]['fn']('COUNT',db[_0xf5c9('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xf5c9('0x3c')))),_0xf5c9('0x3d')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db[_0xf5c9('0x1d')]['fn']('IF',db['sequelize'][_0xf5c9('0x21')](_0xf5c9('0x3e')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0xf5c9('0x20'),db['sequelize']['fn']('IF',db[_0xf5c9('0x1d')][_0xf5c9('0x21')](_0xf5c9('0x3f')))),'outboundOriginateFailureCallsDay'],[db[_0xf5c9('0x1d')]['fn']('COUNT',db[_0xf5c9('0x1d')]['fn']('IF',db['sequelize'][_0xf5c9('0x21')](_0xf5c9('0x40')))),_0xf5c9('0x41')],[db[_0xf5c9('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf5c9('0x1d')]['literal'](_0xf5c9('0x42')))),'outboundAnswerAgiCallsDay'],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db[_0xf5c9('0x1d')]['fn']('IF',db[_0xf5c9('0x1d')][_0xf5c9('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0xf5c9('0x41')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xf5c9('0x21')](_0xf5c9('0x43')))),_0xf5c9('0x44')]],'group':[_0xf5c9('0x2e')]})['then'](function(_0x943254){logger[_0xf5c9('0x12')](_0xf5c9('0x2d'),_0x5a369e);logger[_0xf5c9('0xc')](_0xf5c9('0x2d'),_0x5a369e,JSON[_0xf5c9('0xe')](_0x943254));_0x528ab7(_0x943254);})[_0xf5c9('0x13')](function(_0xc03c2a){logger['error']('GetVoiceQueueHopperHistory',_0xc03c2a['message'],_0x5a369e);_0x27e7f8(_0x2d16da['error'](0x1f4,_0xc03c2a[_0xf5c9('0x11')]));});});};exports[_0xf5c9('0x45')]=function(_0x20b2ed){var _0x470904=this;return new Promise(function(_0x2d2e68,_0x809397){return db[_0xf5c9('0x15')][_0xf5c9('0x1b')]({'raw':_0x20b2ed[_0xf5c9('0x18')]?_0x20b2ed[_0xf5c9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x20b2ed[_0xf5c9('0x18')]?_0x20b2ed['options']['where']||null:null,'attributes':[['campaign',_0xf5c9('0x2f')],[db[_0xf5c9('0x1d')]['fn']('COUNT',db[_0xf5c9('0x1d')][_0xf5c9('0x1e')]('id')),_0xf5c9('0x46')],[db[_0xf5c9('0x1d')]['fn'](_0xf5c9('0x20'),db['sequelize']['fn']('IF',db[_0xf5c9('0x1d')]['literal'](_0xf5c9('0x32')))),'ivrAnswerCallsDay']],'group':[_0xf5c9('0x2e')]})[_0xf5c9('0x2c')](function(_0x16a7e7){logger[_0xf5c9('0x12')](_0xf5c9('0x45'),_0x20b2ed);logger[_0xf5c9('0xc')](_0xf5c9('0x45'),_0x20b2ed,JSON['stringify'](_0x16a7e7));_0x2d2e68(_0x16a7e7);})[_0xf5c9('0x13')](function(_0x6d39dd){logger[_0xf5c9('0xf')](_0xf5c9('0x45'),_0x6d39dd[_0xf5c9('0x11')],_0x20b2ed);_0x809397(_0x470904[_0xf5c9('0xf')](0x1f4,_0x6d39dd[_0xf5c9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 77772eb..986dd8d 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 _0xfe39=['update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x5e8874,_0x134292){var _0x4bf1de=function(_0x941a8e){while(--_0x941a8e){_0x5e8874['push'](_0x5e8874['shift']());}};_0x4bf1de(++_0x134292);}(_0xfe39,0x123));var _0x9fe3=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xfe39[_0x344a3f];return _0x264712;};'use strict';var multer=require('multer');var util=require(_0x9fe3('0x0'));var path=require('path');var timeout=require(_0x9fe3('0x1'));var express=require(_0x9fe3('0x2'));var router=express[_0x9fe3('0x3')]();var fs_extra=require(_0x9fe3('0x4'));var auth=require(_0x9fe3('0x5'));var interaction=require(_0x9fe3('0x6'));var config=require('../../config/environment');var controller=require(_0x9fe3('0x7'));router[_0x9fe3('0x8')]('/',auth[_0x9fe3('0x9')](),controller[_0x9fe3('0xa')]);router['get'](_0x9fe3('0xb'),auth[_0x9fe3('0x9')](),controller[_0x9fe3('0xc')]);router[_0x9fe3('0x8')](_0x9fe3('0xd'),auth[_0x9fe3('0x9')](),controller['show']);router[_0x9fe3('0xe')]('/',auth[_0x9fe3('0x9')](),controller['create']);router['put'](_0x9fe3('0xd'),auth['isAuthenticated'](),controller[_0x9fe3('0xf')]);module[_0x9fe3('0x10')]=router; \ No newline at end of file +var _0xd3ec=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports','multer','util','path'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0xd3ec,0x1ad));var _0xcd3e=function(_0x28feea,_0x4c5c94){_0x28feea=_0x28feea-0x0;var _0x388762=_0xd3ec[_0x28feea];return _0x388762;};'use strict';var multer=require(_0xcd3e('0x0'));var util=require(_0xcd3e('0x1'));var path=require(_0xcd3e('0x2'));var timeout=require(_0xcd3e('0x3'));var express=require('express');var router=express[_0xcd3e('0x4')]();var fs_extra=require(_0xcd3e('0x5'));var auth=require(_0xcd3e('0x6'));var interaction=require(_0xcd3e('0x7'));var config=require('../../config/environment');var controller=require(_0xcd3e('0x8'));router[_0xcd3e('0x9')]('/',auth[_0xcd3e('0xa')](),controller[_0xcd3e('0xb')]);router[_0xcd3e('0x9')]('/describe',auth[_0xcd3e('0xa')](),controller['describe']);router[_0xcd3e('0x9')](_0xcd3e('0xc'),auth[_0xcd3e('0xa')](),controller[_0xcd3e('0xd')]);router[_0xcd3e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcd3e('0xf')](_0xcd3e('0xc'),auth['isAuthenticated'](),controller[_0xcd3e('0x10')]);module[_0xcd3e('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 221635d..021fb57 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 _0x5b20=['STRING','name','sequelize','exports'];(function(_0x4b7bf6,_0x22b8af){var _0x345a94=function(_0x4a09c1){while(--_0x4a09c1){_0x4b7bf6['push'](_0x4b7bf6['shift']());}};_0x345a94(++_0x22b8af);}(_0x5b20,0x86));var _0x05b2=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5b20[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x05b2('0x0'));module[_0x05b2('0x1')]={'name':{'type':Sequelize[_0x05b2('0x2')],'unique':_0x05b2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x05b2('0x2')]},'dialPrefix':{'type':Sequelize[_0x05b2('0x2')]}}; \ No newline at end of file +var _0x85d8=['sequelize','exports','STRING','name'];(function(_0x19f20f,_0x3b6ce3){var _0x3a95fb=function(_0x59d7ff){while(--_0x59d7ff){_0x19f20f['push'](_0x19f20f['shift']());}};_0x3a95fb(++_0x3b6ce3);}(_0x85d8,0x1b0));var _0x885d=function(_0x5dbef7,_0x263f7c){_0x5dbef7=_0x5dbef7-0x0;var _0x4d134f=_0x85d8[_0x5dbef7];return _0x4d134f;};'use strict';var Sequelize=require(_0x885d('0x0'));module[_0x885d('0x1')]={'name':{'type':Sequelize[_0x885d('0x2')],'unique':_0x885d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x885d('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 8bc1354..ae46251 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 _0x228b=['from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','customField_','alias','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','each','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-type','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','error','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./cmList.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','update','then','destroy','get','Lists','UserProfileResource','stack','name','send','type','key','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','filter','merge','map','VIRTUAL','options','CmList','includeAll','include','findAll','show','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','ListId','getDispositions','findOne','nolimit','order','Disposition','rows','ids','addContacts','CmContact','tags','isArray','push','omit','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','cf_%d','hasOwnProperty','raw','getContacts','ContactItemType','OrderBy','select'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x228b,0x1f3));var _0xb228=function(_0x3cc10e,_0x4f2168){_0x3cc10e=_0x3cc10e-0x0;var _0x5e022b=_0x228b[_0x3cc10e];return _0x5e022b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb228('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb228('0x1'));var rp=require(_0xb228('0x2'));var moment=require(_0xb228('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb228('0x4'));var util=require(_0xb228('0x5'));var path=require(_0xb228('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb228('0x7'));var _=require('lodash');var squel=require(_0xb228('0x8'));var crypto=require(_0xb228('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb228('0xa'));var toCsv=require(_0xb228('0xb'));var querystring=require('querystring');var Papa=require(_0xb228('0xc'));var Redis=require('ioredis');var authService=require(_0xb228('0xd'));var qs=require(_0xb228('0xe'));var as=require(_0xb228('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb228('0x10'))(_0xb228('0x11'));var utils=require(_0xb228('0x12'));var config=require(_0xb228('0x13'));var licenseUtil=require(_0xb228('0x14'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xb228('0x15')]=_[_0xb228('0x16')](config[_0xb228('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb228('0x15')]));require(_0xb228('0x17'))[_0xb228('0x18')](socket);function respondWithStatusCode(_0x20ccf1,_0x114f15){_0x114f15=_0x114f15||0xcc;return function(_0x396ee7){if(_0x396ee7){return _0x20ccf1[_0xb228('0x19')](_0x114f15);}return _0x20ccf1[_0xb228('0x1a')](_0x114f15)[_0xb228('0x1b')]();};}function respondWithResult(_0x81ea6b,_0x532a7b){_0x532a7b=_0x532a7b||0xc8;return function(_0xb2f6d6){if(_0xb2f6d6){return _0x81ea6b[_0xb228('0x1a')](_0x532a7b)[_0xb228('0x1c')](_0xb2f6d6);}};}function respondWithFilteredResult(_0x212934,_0x1bca59){return function(_0x29b8d7){if(_0x29b8d7){var _0x13e8b5=typeof _0x1bca59['offset']==='undefined'&&typeof _0x1bca59['limit']===_0xb228('0x1d');var _0x42738b=_0x29b8d7[_0xb228('0x1e')];var _0x304a82=_0x13e8b5?0x0:_0x1bca59[_0xb228('0x1f')];var _0x2b0a2a=_0x13e8b5?_0x29b8d7[_0xb228('0x1e')]:_0x1bca59[_0xb228('0x1f')]+_0x1bca59[_0xb228('0x20')];var _0x59c882;if(_0x2b0a2a>=_0x42738b){_0x2b0a2a=_0x42738b;_0x59c882=0xc8;}else{_0x59c882=0xce;}_0x212934[_0xb228('0x1a')](_0x59c882);return _0x212934[_0xb228('0x21')]('Content-Range',_0x304a82+'-'+_0x2b0a2a+'/'+_0x42738b)[_0xb228('0x1c')](_0x29b8d7);}return null;};}function patchUpdates(_0x12da05){return function(_0x2b746e){try{jsonpatch[_0xb228('0x22')](_0x2b746e,_0x12da05,!![]);}catch(_0x327df3){return BPromise['reject'](_0x327df3);}return _0x2b746e['save']();};}function saveUpdates(_0x56c049,_0x52df2a){return function(_0x46467d){if(_0x46467d){return _0x46467d[_0xb228('0x23')](_0x56c049)[_0xb228('0x24')](function(_0x29b939){return _0x29b939;});}return null;};}function removeEntity(_0x31da51,_0x21abf1){return function(_0x3d24e7){if(_0x3d24e7){return _0x3d24e7[_0xb228('0x25')]()[_0xb228('0x24')](function(){var _0x38b531=_0x3d24e7[_0xb228('0x26')]({'plain':!![]});var _0x31b184=_0xb228('0x27');return db[_0xb228('0x28')][_0xb228('0x25')]({'where':{'type':_0x31b184,'resourceId':_0x38b531['id']}})[_0xb228('0x24')](function(){return _0x3d24e7;});})[_0xb228('0x24')](function(){_0x31da51['status'](0xcc)[_0xb228('0x1b')]();});}};}function handleEntityNotFound(_0x2273a7,_0x598e6a){return function(_0x317aa5){if(!_0x317aa5){_0x2273a7[_0xb228('0x19')](0x194);}return _0x317aa5;};}function handleError(_0x57d8ac,_0x4a22f9){_0x4a22f9=_0x4a22f9||0x1f4;return function(_0x1412d4){logger['error'](_0x1412d4[_0xb228('0x29')]);if(_0x1412d4[_0xb228('0x2a')]){delete _0x1412d4[_0xb228('0x2a')];}_0x57d8ac['status'](_0x4a22f9)[_0xb228('0x2b')](_0x1412d4);};}exports['index']=function(_0x565678,_0x38726c){var _0xc6ef2e={},_0x1e6e9b={},_0xf997df={'count':0x0,'rows':[]};var _0x27002a=_['map'](db['CmList']['rawAttributes'],function(_0x4e8015){return{'name':_0x4e8015['fieldName'],'type':_0x4e8015[_0xb228('0x2c')][_0xb228('0x2d')]};});_0x1e6e9b[_0xb228('0x2e')]=_['map'](_0x27002a,'name');_0x1e6e9b[_0xb228('0x2f')]=_[_0xb228('0x30')](_0x565678[_0xb228('0x2f')]);_0x1e6e9b[_0xb228('0x31')]=_[_0xb228('0x32')](_0x1e6e9b[_0xb228('0x2e')],_0x1e6e9b['query']);_0xc6ef2e[_0xb228('0x33')]=_[_0xb228('0x32')](_0x1e6e9b[_0xb228('0x2e')],qs['fields'](_0x565678['query'][_0xb228('0x34')]));_0xc6ef2e[_0xb228('0x33')]=_0xc6ef2e['attributes']['length']?_0xc6ef2e['attributes']:_0x1e6e9b[_0xb228('0x2e')];if(!_0x565678[_0xb228('0x2f')]['hasOwnProperty']('nolimit')){_0xc6ef2e[_0xb228('0x20')]=qs[_0xb228('0x20')](_0x565678[_0xb228('0x2f')][_0xb228('0x20')]);_0xc6ef2e['offset']=qs[_0xb228('0x1f')](_0x565678[_0xb228('0x2f')]['offset']);}_0xc6ef2e['order']=qs[_0xb228('0x35')](_0x565678[_0xb228('0x2f')][_0xb228('0x35')]);_0xc6ef2e[_0xb228('0x36')]=qs[_0xb228('0x31')](_[_0xb228('0x37')](_0x565678[_0xb228('0x2f')],_0x1e6e9b[_0xb228('0x31')]),_0x27002a);if(_0x565678['query'][_0xb228('0x38')]){_0xc6ef2e[_0xb228('0x36')]=_[_0xb228('0x39')](_0xc6ef2e[_0xb228('0x36')],{'$or':_[_0xb228('0x3a')](_0x27002a,function(_0x2e7cac){if(_0x2e7cac[_0xb228('0x2c')]!==_0xb228('0x3b')){var _0x5493fa={};_0x5493fa[_0x2e7cac[_0xb228('0x2a')]]={'$like':'%'+_0x565678['query'][_0xb228('0x38')]+'%'};return _0x5493fa;}})});}_0xc6ef2e=_[_0xb228('0x39')]({},_0xc6ef2e,_0x565678[_0xb228('0x3c')]);var _0x19047c={'where':_0xc6ef2e[_0xb228('0x36')]};return db[_0xb228('0x3d')][_0xb228('0x1e')](_0x19047c)[_0xb228('0x24')](function(_0xf3452d){_0xf997df[_0xb228('0x1e')]=_0xf3452d;if(_0x565678[_0xb228('0x2f')][_0xb228('0x3e')]){_0xc6ef2e[_0xb228('0x3f')]=[{'all':!![]}];}return db[_0xb228('0x3d')][_0xb228('0x40')](_0xc6ef2e);})[_0xb228('0x24')](function(_0x1b298d){_0xf997df['rows']=_0x1b298d;return _0xf997df;})['then'](respondWithFilteredResult(_0x38726c,_0xc6ef2e))['catch'](handleError(_0x38726c,null));};exports[_0xb228('0x41')]=function(_0x2c8783,_0x48da23){var _0x21b31f={'raw':![],'where':{'id':_0x2c8783['params']['id']}},_0x2b432b={};_0x2b432b[_0xb228('0x2e')]=_[_0xb228('0x30')](db[_0xb228('0x3d')][_0xb228('0x42')]);_0x2b432b[_0xb228('0x2f')]=_[_0xb228('0x30')](_0x2c8783[_0xb228('0x2f')]);_0x2b432b[_0xb228('0x31')]=_[_0xb228('0x32')](_0x2b432b[_0xb228('0x2e')],_0x2b432b[_0xb228('0x2f')]);_0x21b31f['attributes']=_['intersection'](_0x2b432b['model'],qs[_0xb228('0x34')](_0x2c8783['query'][_0xb228('0x34')]));_0x21b31f['attributes']=_0x21b31f[_0xb228('0x33')][_0xb228('0x43')]?_0x21b31f[_0xb228('0x33')]:_0x2b432b[_0xb228('0x2e')];if(_0x2c8783[_0xb228('0x2f')]['includeAll']){_0x21b31f['include']=[{'all':!![]}];}_0x21b31f=_[_0xb228('0x39')]({},_0x21b31f,_0x2c8783[_0xb228('0x3c')]);return db[_0xb228('0x3d')][_0xb228('0x44')](_0x21b31f)[_0xb228('0x24')](handleEntityNotFound(_0x48da23,null))['then'](respondWithResult(_0x48da23,null))[_0xb228('0x45')](handleError(_0x48da23,null));};exports[_0xb228('0x46')]=function(_0x371f43,_0x2841b3){return db[_0xb228('0x3d')]['create'](_0x371f43[_0xb228('0x47')],{})[_0xb228('0x24')](function(_0x89e1ca){var _0x55a13e=_0x371f43[_0xb228('0x48')]['get']({'plain':!![]});if(!_0x55a13e)throw new Error(_0xb228('0x49'));if(_0x55a13e[_0xb228('0x4a')]===_0xb228('0x48')){var _0x534883=_0x89e1ca[_0xb228('0x26')]({'plain':!![]});var _0x4d8b8b=_0xb228('0x27');return db[_0xb228('0x4b')]['find']({'where':{'name':_0x4d8b8b,'userProfileId':_0x55a13e[_0xb228('0x4c')]},'raw':!![]})[_0xb228('0x24')](function(_0xc31d5e){if(_0xc31d5e&&_0xc31d5e[_0xb228('0x4d')]===0x0){return db[_0xb228('0x28')][_0xb228('0x46')]({'name':_0x534883[_0xb228('0x2a')],'resourceId':_0x534883['id'],'type':_0xc31d5e[_0xb228('0x2a')],'sectionId':_0xc31d5e['id']},{})[_0xb228('0x24')](function(){return _0x89e1ca;});}else{return _0x89e1ca;}})[_0xb228('0x45')](function(_0x595a6b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x595a6b);throw _0x595a6b;});}return _0x89e1ca;})[_0xb228('0x24')](respondWithResult(_0x2841b3,0xc9))['catch'](handleError(_0x2841b3,null));};exports[_0xb228('0x23')]=function(_0x5c8faa,_0x53c073){if(_0x5c8faa[_0xb228('0x47')]['id']){delete _0x5c8faa[_0xb228('0x47')]['id'];}return db['CmList'][_0xb228('0x44')]({'where':{'id':_0x5c8faa[_0xb228('0x4e')]['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x53c073,null))[_0xb228('0x24')](saveUpdates(_0x5c8faa[_0xb228('0x47')],null))[_0xb228('0x24')](respondWithResult(_0x53c073,null))[_0xb228('0x45')](handleError(_0x53c073,null));};exports[_0xb228('0x25')]=function(_0x973bea,_0x193f98){return db[_0xb228('0x3d')][_0xb228('0x44')]({'where':{'id':_0x973bea[_0xb228('0x4e')]['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x193f98,null))[_0xb228('0x24')](removeEntity(_0x193f98,null))['catch'](handleError(_0x193f98,null));};exports[_0xb228('0x4f')]=function(_0x4b1328,_0x220d3c){return db[_0xb228('0x3d')]['describe']()[_0xb228('0x24')](respondWithResult(_0x220d3c,null))['catch'](handleError(_0x220d3c,null));};exports[_0xb228('0x50')]=function(_0x43b874,_0x1b7fd6,_0x21c402){if(_0x43b874[_0xb228('0x47')]['id']){delete _0x43b874[_0xb228('0x47')]['id'];}return db[_0xb228('0x3d')][_0xb228('0x44')]({'where':{'id':_0x43b874['params']['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x1b7fd6,null))[_0xb228('0x24')](function(_0x896e00){if(_0x896e00){_0x43b874['body'][_0xb228('0x51')]=_0x896e00['id'];return db['Disposition']['create'](_0x43b874[_0xb228('0x47')]);}})[_0xb228('0x24')](respondWithResult(_0x1b7fd6,null))[_0xb228('0x45')](handleError(_0x1b7fd6,null));};exports[_0xb228('0x52')]=function(_0xf7de37,_0x31c114,_0x355c59){var _0x905d66={'raw':![],'where':{}};var _0xdcd20c={};var _0x2d14c7={'count':0x0,'rows':[]};return db['CmList'][_0xb228('0x53')]({'where':{'id':_0xf7de37[_0xb228('0x4e')]['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x31c114,null))['then'](function(_0x19e331){if(_0x19e331){_0xdcd20c[_0xb228('0x2e')]=_[_0xb228('0x30')](db['Disposition'][_0xb228('0x42')]);_0xdcd20c[_0xb228('0x2f')]=_[_0xb228('0x30')](_0xf7de37[_0xb228('0x2f')]);_0xdcd20c['filters']=_['intersection'](_0xdcd20c[_0xb228('0x2e')],_0xdcd20c['query']);_0x905d66[_0xb228('0x33')]=_[_0xb228('0x32')](_0xdcd20c[_0xb228('0x2e')],qs[_0xb228('0x34')](_0xf7de37[_0xb228('0x2f')][_0xb228('0x34')]));_0x905d66[_0xb228('0x33')]=_0x905d66[_0xb228('0x33')]['length']?_0x905d66[_0xb228('0x33')]:_0xdcd20c['model'];if(!_0xf7de37[_0xb228('0x2f')]['hasOwnProperty'](_0xb228('0x54'))){_0x905d66[_0xb228('0x20')]=qs[_0xb228('0x20')](_0xf7de37['query'][_0xb228('0x20')]);_0x905d66[_0xb228('0x1f')]=qs[_0xb228('0x1f')](_0xf7de37[_0xb228('0x2f')][_0xb228('0x1f')]);}_0x905d66[_0xb228('0x55')]=qs[_0xb228('0x35')](_0xf7de37[_0xb228('0x2f')][_0xb228('0x35')]);_0x905d66[_0xb228('0x36')]=qs[_0xb228('0x31')](_['pick'](_0xf7de37[_0xb228('0x2f')],_0xdcd20c[_0xb228('0x31')]));_0x905d66[_0xb228('0x36')][_0xb228('0x51')]=_0x19e331['id'];if(_0xf7de37[_0xb228('0x2f')][_0xb228('0x38')]){_0x905d66[_0xb228('0x36')]=_['merge'](_0x905d66[_0xb228('0x36')],{'$or':_['map'](_0x905d66[_0xb228('0x33')],function(_0x305aaf){var _0x544df0={};_0x544df0[_0x305aaf]={'$like':'%'+_0xf7de37['query'][_0xb228('0x38')]+'%'};return _0x544df0;})});}_0x905d66=_[_0xb228('0x39')]({},_0x905d66,_0xf7de37[_0xb228('0x3c')]);return db[_0xb228('0x56')]['count']({'where':_0x905d66[_0xb228('0x36')]})[_0xb228('0x24')](function(_0x3f86eb){_0x2d14c7[_0xb228('0x1e')]=_0x3f86eb;if(_0xf7de37[_0xb228('0x2f')]['includeAll']){_0x905d66['include']=[{'all':!![]}];}return db[_0xb228('0x56')]['findAll'](_0x905d66);})[_0xb228('0x24')](function(_0x16d543){_0x2d14c7[_0xb228('0x57')]=_0x16d543;return _0x2d14c7;});}})[_0xb228('0x24')](respondWithFilteredResult(_0x31c114,_0x905d66))[_0xb228('0x45')](handleError(_0x31c114,null));};exports['removeDispositions']=function(_0x33e225,_0x1d85b7,_0x2f4f8a){return db[_0xb228('0x3d')][_0xb228('0x44')]({'where':{'id':_0x33e225[_0xb228('0x4e')]['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x1d85b7,null))['then'](function(_0x466679){if(_0x466679){return _0x466679['removeDispositions'](_0x33e225[_0xb228('0x2f')][_0xb228('0x58')]);}})[_0xb228('0x24')](respondWithStatusCode(_0x1d85b7,null))[_0xb228('0x45')](handleError(_0x1d85b7,null));};exports[_0xb228('0x59')]=function(_0x478eff,_0x2120f7,_0x1782c5){return db[_0xb228('0x3d')]['find']({'where':{'id':_0x478eff[_0xb228('0x4e')]['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x2120f7,null))[_0xb228('0x24')](function(_0x567fec){if(_0x567fec){var _0x2ffaa8=[];var _0x53eb69={'success':[],'errors':[]};return db[_0xb228('0x5a')][_0xb228('0x4f')]()[_0xb228('0x24')](function(_0x3c5593){if(_0x478eff['body'][_0xb228('0x5b')]&&_[_0xb228('0x5c')](_0x478eff[_0xb228('0x47')][_0xb228('0x5b')])){if(_0x478eff[_0xb228('0x47')][_0xb228('0x5b')][_0xb228('0x43')]){_0x478eff[_0xb228('0x47')][_0xb228('0x5b')]=_0x478eff[_0xb228('0x47')][_0xb228('0x5b')]['join'](';')+';';}else{_0x478eff[_0xb228('0x47')][_0xb228('0x5b')]=null;}}else{_0x478eff[_0xb228('0x47')][_0xb228('0x5b')]=null;}if(_0x478eff[_0xb228('0x47')]&&_[_0xb228('0x5c')](_0x478eff[_0xb228('0x47')])){for(var _0x2f1618=0x0;_0x2f1618<_0x478eff[_0xb228('0x47')][_0xb228('0x43')];_0x2f1618+=0x1){_0x478eff[_0xb228('0x47')][_0x2f1618]['ListId']=_0x478eff[_0xb228('0x4e')]['id'];_0x2ffaa8[_0xb228('0x5d')](_0x478eff[_0xb228('0x47')][_0x2f1618]);}return BPromise['each'](_0x2ffaa8,function(_0x4d227f){return db[_0xb228('0x5a')][_0xb228('0x46')](_[_0xb228('0x5e')](_0x4d227f,['ids','id'])||{},{'fields':_[_0xb228('0x30')](_0x3c5593),'raw':!![]})[_0xb228('0x24')](function(_0x507f6f){_0x53eb69[_0xb228('0x5f')][_0xb228('0x5d')](_0x507f6f[_0xb228('0x60')]);})[_0xb228('0x45')](function(_0x59d74b){_0x53eb69['errors']['push']({'data':_0x4d227f,'error':_0x59d74b[_0xb228('0x61')]});});})[_0xb228('0x24')](function(_0x3f8fd1){return _0x53eb69;})['catch'](function(_0x1619b0){return _0x1619b0;});}else{_0x2120f7[_0xb228('0x1a')](0x190)['json']({'message':_0xb228('0x62')});}});}})[_0xb228('0x24')](respondWithResult(_0x2120f7,null))[_0xb228('0x45')](handleError(_0x2120f7,null));};exports['getContacts']=function(_0x1f5e21,_0xc4e75c,_0x5515ac){var _0x193633;return db['CmList'][_0xb228('0x44')]({'where':{'id':_0x1f5e21[_0xb228('0x4e')]['id']},'include':[{'model':db[_0xb228('0x63')],'as':'CustomFields'}]})[_0xb228('0x24')](handleEntityNotFound(_0xc4e75c,null))[_0xb228('0x24')](function(_0x164dcf){if(_0x164dcf){_0x193633=_0x164dcf;return db[_0xb228('0x5a')][_0xb228('0x42')];}})[_0xb228('0x24')](function(_0x402a7e){if(_0x402a7e){var _0x1bed00={};var _0x2d9c85={};_0x2d9c85[_0xb228('0x2e')]=_[_0xb228('0x64')](_[_0xb228('0x30')](_0x402a7e),_[_0xb228('0x3a')](_0x193633[_0xb228('0x65')],function(_0x419f8d){return util['format'](_0xb228('0x66'),_0x419f8d['id']);}));_0x2d9c85[_0xb228('0x2f')]=_['keys'](_0x1f5e21['query']);_0x2d9c85[_0xb228('0x31')]=_['intersection'](_0x2d9c85['model'],_0x2d9c85[_0xb228('0x2f')]);_0x1bed00[_0xb228('0x33')]=_['intersection'](_0x2d9c85[_0xb228('0x2e')],qs[_0xb228('0x34')](_0x1f5e21[_0xb228('0x2f')]['fields']));_0x1bed00[_0xb228('0x33')]=_0x1bed00[_0xb228('0x33')][_0xb228('0x43')]?_0x1bed00[_0xb228('0x33')]:_0x2d9c85['model'];if(!_0x1f5e21[_0xb228('0x2f')][_0xb228('0x67')](_0xb228('0x54'))){_0x1bed00[_0xb228('0x20')]=qs['limit'](_0x1f5e21[_0xb228('0x2f')][_0xb228('0x20')]);_0x1bed00['offset']=qs[_0xb228('0x1f')](_0x1f5e21[_0xb228('0x2f')][_0xb228('0x1f')]);}_0x1bed00[_0xb228('0x55')]=qs[_0xb228('0x35')](_0x1f5e21[_0xb228('0x2f')][_0xb228('0x35')]);_0x1bed00[_0xb228('0x36')]=qs[_0xb228('0x31')](_[_0xb228('0x37')](_0x1f5e21[_0xb228('0x2f')],_0x2d9c85[_0xb228('0x31')]));_0x1bed00[_0xb228('0x68')]=!![];if(_0x1f5e21[_0xb228('0x2f')][_0xb228('0x38')]){_0x1bed00[_0xb228('0x36')]=_[_0xb228('0x39')](_0x1bed00[_0xb228('0x36')],{'$or':_[_0xb228('0x3a')](_0x1bed00[_0xb228('0x33')],function(_0x5a2b9a){var _0x292327={};_0x292327[_0x5a2b9a]={'$like':'%'+_0x1f5e21[_0xb228('0x2f')]['filter']+'%'};return _0x292327;})});}_0x1bed00=_[_0xb228('0x39')]({},_0x1bed00,_0x1f5e21['options']);return _0x193633[_0xb228('0x69')](_0x1bed00);}})[_0xb228('0x24')](respondWithResult(_0xc4e75c,null))[_0xb228('0x45')](handleError(_0xc4e75c,null));};exports['getContactsCsv']=function(_0x4c611d,_0x42a1ae,_0x3f96fb){var _0x1fc730;var _0x242e43;var _0xd7c5bf;var _0x13ed17=_0x4c611d[_0xb228('0x4e')]['id'];csv_results=[];return db[_0xb228('0x6a')][_0xb228('0x40')]({'attributes':['id',_0xb228('0x2a')],'raw':!![],'order':[_0xb228('0x6b')]})[_0xb228('0x24')](function(_0x3be31f){_0x1fc730=_0x3be31f;var _0x3d9044=_[_0xb228('0x30')](db['CmContact'][_0xb228('0x42')]);return db[_0xb228('0x63')][_0xb228('0x40')]({'raw':!![],'attributes':['id','alias']})[_0xb228('0x24')](function(_0x448c1a){_0x242e43=_0x448c1a;var _0x5b45e6=squel[_0xb228('0x6c')]()[_0xb228('0x34')](_0x3d9044)[_0xb228('0x6d')]('cm_contacts','c')[_0xb228('0x36')](_0xb228('0x6e'),_0x13ed17)['where'](_0xb228('0x6f'))['distinct']();for(var _0x3c6eda=0x0;_0x3c6eda<_0x242e43[_0xb228('0x43')];_0x3c6eda++){_0x5b45e6['field']('c.cf_'+_0x242e43[_0x3c6eda]['id'],_0xb228('0x70')+_0x242e43[_0x3c6eda][_0xb228('0x71')]);}for(var _0x3c6eda=0x0;_0x3c6eda<_0x1fc730['length'];_0x3c6eda++){_0x5b45e6[_0xb228('0x72')](squel[_0xb228('0x6c')]()[_0xb228('0x72')](_0xb228('0x73'))[_0xb228('0x6d')](_0xb228('0x74'))[_0xb228('0x36')](_0xb228('0x75'),_0x1fc730[_0x3c6eda]['id'])[_0xb228('0x36')](_0xb228('0x76')),_0xb228('0x77')+_0x1fc730[_0x3c6eda][_0xb228('0x2a')]);_0x5b45e6[_0xb228('0x72')](squel[_0xb228('0x6c')]()['field']('description')[_0xb228('0x6d')](_0xb228('0x74'))['where'](_0xb228('0x75'),_0x1fc730[_0x3c6eda]['id'])['where'](_0xb228('0x76')),_0xb228('0x78')+_0x1fc730[_0x3c6eda][_0xb228('0x2a')]);}var _0x8f56e6=[];_0x8f56e6['push'](_0x5b45e6['toString']());BPromise[_0xb228('0x79')](_0x8f56e6,handleQuery)['then'](function(_0x4c9d57){handleQuery(_0x5b45e6['toString']());var _0x1492f4=csv_results[0x0];if(!_['isEmpty'](_0x1492f4)){var _0x4d90fb=toCsv(_0x1492f4);var _0x27360c=Date[_0xb228('0x7a')]();fs[_0xb228('0x7b')](util[_0xb228('0x7c')](_0xb228('0x7d'),_0x13ed17,_0x27360c),_0x4d90fb);_0x42a1ae[_0xb228('0x7e')]('Content-disposition','attachment;\x20filename='+util[_0xb228('0x7c')]('list_%d_%s.csv',_0x13ed17,_0x27360c));_0x42a1ae[_0xb228('0x7e')](_0xb228('0x7f'),_0xb228('0x80'));return _0x42a1ae[_0xb228('0x81')](util['format'](_0xb228('0x7d'),_0x13ed17,_0x27360c));}else{return _0x42a1ae[_0xb228('0x19')](0xcc);}});});});};exports['addCustomField']=function(_0x59d232,_0x881e52,_0x14b146){var _0x4d5814;delete _0x59d232[_0xb228('0x47')]['id'];return db[_0xb228('0x3d')]['findOne']({'where':{'id':_0x59d232['params']['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x881e52,null))[_0xb228('0x24')](function(_0x53ba46){if(_0x53ba46){return db[_0xb228('0x82')][_0xb228('0x83')](function(_0x40c4be){return db[_0xb228('0x63')][_0xb228('0x46')](_0x59d232[_0xb228('0x47')],{'transaction':_0x40c4be})[_0xb228('0x24')](function(_0x146407){_0x4d5814=_0x146407;return _0x53ba46[_0xb228('0x84')](_0x146407,{'transaction':_0x40c4be});})['then'](function(){var _0x3af47e={'type':db[_0xb228('0x85')][_0xb228('0x86')],'transaction':_0x40c4be};switch(_0x59d232[_0xb228('0x47')][_0xb228('0x2c')]){case _0xb228('0x87'):_0x3af47e[_0xb228('0x2c')]=db[_0xb228('0x85')][_0xb228('0x86')];break;case _0xb228('0x88'):_0x3af47e['type']=db[_0xb228('0x85')][_0xb228('0x89')];break;case'switch':_0x3af47e[_0xb228('0x2c')]=db['Sequelize']['BOOLEAN'];_0x3af47e['defaultValue']=![];break;default:}return db[_0xb228('0x82')][_0xb228('0x8a')][_0xb228('0x8b')]('cm_contacts',util[_0xb228('0x7c')](_0xb228('0x8c'),_0x4d5814['id']),_0x3af47e);})['then'](function(){return _0x4d5814;});});}})[_0xb228('0x24')](respondWithResult(_0x881e52,null))[_0xb228('0x45')](handleError(_0x881e52,null));};exports[_0xb228('0x8d')]=function(_0x417ba0,_0x33dcdf,_0x15844f){var _0x4da042={};var _0x3257c8={};var _0x8908dc;var _0x26d412;return db[_0xb228('0x3d')][_0xb228('0x53')]({'where':{'id':_0x417ba0[_0xb228('0x4e')]['id']}})['then'](handleEntityNotFound(_0x33dcdf,null))[_0xb228('0x24')](function(_0x4fed16){if(_0x4fed16){_0x8908dc=_0x4fed16;_0x3257c8[_0xb228('0x2e')]=_[_0xb228('0x30')](db['CmCustomField']['rawAttributes']);_0x3257c8[_0xb228('0x2f')]=_[_0xb228('0x30')](_0x417ba0[_0xb228('0x2f')]);_0x3257c8[_0xb228('0x31')]=_[_0xb228('0x32')](_0x3257c8[_0xb228('0x2e')],_0x3257c8[_0xb228('0x2f')]);_0x4da042[_0xb228('0x33')]=_[_0xb228('0x32')](_0x3257c8[_0xb228('0x2e')],qs[_0xb228('0x34')](_0x417ba0[_0xb228('0x2f')][_0xb228('0x34')]));_0x4da042[_0xb228('0x33')]=_0x4da042[_0xb228('0x33')][_0xb228('0x43')]?_0x4da042[_0xb228('0x33')]:_0x3257c8[_0xb228('0x2e')];_0x4da042[_0xb228('0x55')]=qs[_0xb228('0x35')](_0x417ba0[_0xb228('0x2f')][_0xb228('0x35')]);_0x4da042[_0xb228('0x36')]=qs['filters'](_[_0xb228('0x37')](_0x417ba0['query'],_0x3257c8[_0xb228('0x31')]));_0x4da042[_0xb228('0x36')]=_[_0xb228('0x39')](_0x4da042[_0xb228('0x36')],{'$or':[{'ListId':_0x4fed16['id']},{'ListId':null}]});if(_0x417ba0[_0xb228('0x2f')][_0xb228('0x38')]){_0x4da042[_0xb228('0x36')]=_[_0xb228('0x39')](_0x4da042[_0xb228('0x36')],{'$or':_[_0xb228('0x3a')](_0x4da042['attributes'],function(_0x26cb4c){var _0xc43023={};_0xc43023[_0x26cb4c]={'$like':'%'+_0x417ba0[_0xb228('0x2f')][_0xb228('0x38')]+'%'};return _0xc43023;})});}_0x4da042=_['merge']({},_0x4da042,_0x417ba0['options']);return db[_0xb228('0x63')][_0xb228('0x8e')](_0x4da042);}})[_0xb228('0x24')](respondWithResult(_0x33dcdf,null))[_0xb228('0x45')](handleError(_0x33dcdf,null));};exports[_0xb228('0x8f')]=function(_0x15e9d5,_0x46ebf3){return db[_0xb228('0x63')][_0xb228('0x8e')]({'where':{'ListId':null}})[_0xb228('0x24')](handleEntityNotFound(_0x46ebf3,null))[_0xb228('0x24')](function(_0x36ed24){return _0x36ed24;})[_0xb228('0x24')](respondWithResult(_0x46ebf3,null))[_0xb228('0x45')](handleError(_0x46ebf3,null));};exports[_0xb228('0x90')]=function(_0x191a94,_0x32de09,_0x10e3a5){return db[_0xb228('0x3d')][_0xb228('0x44')]({'where':{'id':_0x191a94['params']['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x32de09,null))[_0xb228('0x24')](function(_0x35a3c7){if(_0x35a3c7){return _0x35a3c7[_0xb228('0x90')](_0x191a94[_0xb228('0x47')]['ids'],_['omit'](_0x191a94[_0xb228('0x47')],['ids','id'])||{})[_0xb228('0x91')](function(_0x5ad18d){for(var _0x5e1447=0x0;_0x5e1447<_0x191a94[_0xb228('0x47')][_0xb228('0x58')]['length'];_0x5e1447+=0x1){socket['emit'](_0xb228('0x92'),{'UserId':Number(_0x191a94[_0xb228('0x47')]['ids'][_0x5e1447]),'CmListId':Number(_0x191a94[_0xb228('0x4e')]['id'])});}return _0x5ad18d;});}})[_0xb228('0x24')](respondWithResult(_0x32de09,null))['catch'](handleError(_0x32de09,null));};exports[_0xb228('0x93')]=function(_0x4291c1,_0x52c08b,_0x460dd4){return db['CmList'][_0xb228('0x44')]({'where':{'id':_0x4291c1[_0xb228('0x4e')]['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x52c08b,null))['then'](function(_0xdf0499){if(_0xdf0499){return _0xdf0499[_0xb228('0x93')](_0x4291c1['query'][_0xb228('0x58')])[_0xb228('0x24')](function(){if(_[_0xb228('0x5c')](_0x4291c1[_0xb228('0x2f')][_0xb228('0x58')])){for(var _0xcab883=0x0;_0xcab883<_0x4291c1[_0xb228('0x2f')][_0xb228('0x58')][_0xb228('0x43')];_0xcab883+=0x1){socket[_0xb228('0x94')](_0xb228('0x95'),{'UserId':Number(_0x4291c1['query'][_0xb228('0x58')][_0xcab883]),'CmListId':Number(_0x4291c1[_0xb228('0x4e')]['id'])});}}else{socket[_0xb228('0x94')](_0xb228('0x95'),{'UserId':Number(_0x4291c1[_0xb228('0x2f')][_0xb228('0x58')]),'CmListId':Number(_0x4291c1[_0xb228('0x4e')]['id'])});}});}})[_0xb228('0x24')](respondWithStatusCode(_0x52c08b,null))['catch'](handleError(_0x52c08b,null));};exports['getAgents']=function(_0x5bd822,_0x4dc50e,_0x1f9796){var _0x5e1be6={};var _0x36c88c={};var _0x50d718;var _0xe5265e;return db['CmList'][_0xb228('0x53')]({'where':{'id':_0x5bd822['params']['id']}})[_0xb228('0x24')](handleEntityNotFound(_0x4dc50e,null))[_0xb228('0x24')](function(_0xc0cc45){if(_0xc0cc45){_0x50d718=_0xc0cc45;_0x36c88c[_0xb228('0x2e')]=_[_0xb228('0x30')](db['User'][_0xb228('0x42')]);_0x36c88c[_0xb228('0x2f')]=_[_0xb228('0x30')](_0x5bd822['query']);_0x36c88c[_0xb228('0x31')]=_[_0xb228('0x32')](_0x36c88c[_0xb228('0x2e')],_0x36c88c['query']);_0x5e1be6['attributes']=_[_0xb228('0x32')](_0x36c88c[_0xb228('0x2e')],qs[_0xb228('0x34')](_0x5bd822[_0xb228('0x2f')]['fields']));_0x5e1be6['attributes']=_0x5e1be6[_0xb228('0x33')][_0xb228('0x43')]?_0x5e1be6[_0xb228('0x33')]:_0x36c88c[_0xb228('0x2e')];_0x5e1be6[_0xb228('0x55')]=qs[_0xb228('0x35')](_0x5bd822[_0xb228('0x2f')][_0xb228('0x35')]);_0x5e1be6[_0xb228('0x36')]=qs[_0xb228('0x31')](_[_0xb228('0x37')](_0x5bd822[_0xb228('0x2f')],_0x36c88c[_0xb228('0x31')]));if(_0x5bd822[_0xb228('0x2f')][_0xb228('0x38')]){_0x5e1be6[_0xb228('0x36')]=_[_0xb228('0x39')](_0x5e1be6[_0xb228('0x36')],{'$or':_[_0xb228('0x3a')](_0x5e1be6[_0xb228('0x33')],function(_0xf77e24){var _0x40a7ef={};_0x40a7ef[_0xf77e24]={'$like':'%'+_0x5bd822[_0xb228('0x2f')][_0xb228('0x38')]+'%'};return _0x40a7ef;})});}_0x5e1be6=_[_0xb228('0x39')]({},_0x5e1be6,_0x5bd822['options']);return _0x50d718[_0xb228('0x96')](_0x5e1be6);}})[_0xb228('0x24')](function(_0xb4c75d){if(_0xb4c75d){_0xe5265e=_0xb4c75d[_0xb228('0x43')];if(!_0x5bd822[_0xb228('0x2f')][_0xb228('0x67')](_0xb228('0x54'))){_0x5e1be6[_0xb228('0x20')]=qs['limit'](_0x5bd822['query'][_0xb228('0x20')]);_0x5e1be6[_0xb228('0x1f')]=qs[_0xb228('0x1f')](_0x5bd822[_0xb228('0x2f')][_0xb228('0x1f')]);}return _0x50d718['getAgents'](_0x5e1be6);}})[_0xb228('0x24')](function(_0x2615b6){if(_0x2615b6){return _0x2615b6?{'count':_0xe5265e,'rows':_0x2615b6}:null;}})[_0xb228('0x24')](respondWithResult(_0x4dc50e,null))['catch'](handleError(_0x4dc50e,null));};function handleQuery(_0x136a16){logger['info'](_0x136a16);return db['sequelize']['query'](_0x136a16)[_0xb228('0x91')](function(_0xb1b2d4){csv_results['push'](_0xb1b2d4);})['catch'](function(_0x1b430a){logger[_0xb228('0x97')](_0x1b430a[_0xb228('0x61')]);});} \ No newline at end of file +var _0x012a=['findOne','findAll','removeDispositions','ids','tags','join','isArray','ListId','each','CmContact','omit','success','push','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','alias','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','toString','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./cmList.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','save','destroy','UserProfileResource','then','sendStatus','error','name','index','CmList','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Lists','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition'];(function(_0x5c752c,_0x19f6fb){var _0x31e85b=function(_0x43f4c9){while(--_0x43f4c9){_0x5c752c['push'](_0x5c752c['shift']());}};_0x31e85b(++_0x19f6fb);}(_0x012a,0xec));var _0xa012=function(_0x4e0eb6,_0x330aa6){_0x4e0eb6=_0x4e0eb6-0x0;var _0x575ae9=_0x012a[_0x4e0eb6];return _0x575ae9;};'use strict';var emlformat=require(_0xa012('0x0'));var rimraf=require(_0xa012('0x1'));var zipdir=require(_0xa012('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa012('0x3'));var BPromise=require(_0xa012('0x4'));var Mustache=require(_0xa012('0x5'));var util=require(_0xa012('0x6'));var path=require(_0xa012('0x7'));var sox=require('sox');var csv=require(_0xa012('0x8'));var ejs=require(_0xa012('0x9'));var fs=require('fs');var fs_extra=require(_0xa012('0xa'));var _=require(_0xa012('0xb'));var squel=require(_0xa012('0xc'));var crypto=require(_0xa012('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa012('0xe'));var toCsv=require(_0xa012('0x8'));var querystring=require(_0xa012('0xf'));var Papa=require(_0xa012('0x10'));var Redis=require(_0xa012('0x11'));var authService=require(_0xa012('0x12'));var qs=require(_0xa012('0x13'));var as=require(_0xa012('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa012('0x15'))(_0xa012('0x16'));var utils=require(_0xa012('0x17'));var config=require(_0xa012('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa012('0x19'))['db'];var csv_results;config['redis']=_[_0xa012('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa012('0x1b'))(new Redis(config[_0xa012('0x1c')]));require(_0xa012('0x1d'))[_0xa012('0x1e')](socket);function respondWithStatusCode(_0xf69eae,_0x2cbdc8){_0x2cbdc8=_0x2cbdc8||0xcc;return function(_0x1b6e3b){if(_0x1b6e3b){return _0xf69eae['sendStatus'](_0x2cbdc8);}return _0xf69eae[_0xa012('0x1f')](_0x2cbdc8)[_0xa012('0x20')]();};}function respondWithResult(_0xbe58ad,_0x3ad62b){_0x3ad62b=_0x3ad62b||0xc8;return function(_0x49e8b0){if(_0x49e8b0){return _0xbe58ad[_0xa012('0x1f')](_0x3ad62b)[_0xa012('0x21')](_0x49e8b0);}};}function respondWithFilteredResult(_0x528ccf,_0x1ead9c){return function(_0x596f6f){if(_0x596f6f){var _0x5165ef=typeof _0x1ead9c[_0xa012('0x22')]===_0xa012('0x23')&&typeof _0x1ead9c[_0xa012('0x24')]===_0xa012('0x23');var _0x4d174a=_0x596f6f[_0xa012('0x25')];var _0x576241=_0x5165ef?0x0:_0x1ead9c[_0xa012('0x22')];var _0x5d261c=_0x5165ef?_0x596f6f['count']:_0x1ead9c[_0xa012('0x22')]+_0x1ead9c[_0xa012('0x24')];var _0x4ee93f;if(_0x5d261c>=_0x4d174a){_0x5d261c=_0x4d174a;_0x4ee93f=0xc8;}else{_0x4ee93f=0xce;}_0x528ccf[_0xa012('0x1f')](_0x4ee93f);return _0x528ccf[_0xa012('0x26')](_0xa012('0x27'),_0x576241+'-'+_0x5d261c+'/'+_0x4d174a)['json'](_0x596f6f);}return null;};}function patchUpdates(_0x2a0096){return function(_0x3d4806){try{jsonpatch['apply'](_0x3d4806,_0x2a0096,!![]);}catch(_0x4c0cb2){return BPromise['reject'](_0x4c0cb2);}return _0x3d4806[_0xa012('0x28')]();};}function saveUpdates(_0x414687,_0x8db466){return function(_0x3df8af){if(_0x3df8af){return _0x3df8af['update'](_0x414687)['then'](function(_0x2d6b62){return _0x2d6b62;});}return null;};}function removeEntity(_0x584ada,_0x34260e){return function(_0x139499){if(_0x139499){return _0x139499[_0xa012('0x29')]()['then'](function(){var _0x5b76e5=_0x139499['get']({'plain':!![]});var _0x1c418c='Lists';return db[_0xa012('0x2a')][_0xa012('0x29')]({'where':{'type':_0x1c418c,'resourceId':_0x5b76e5['id']}})[_0xa012('0x2b')](function(){return _0x139499;});})[_0xa012('0x2b')](function(){_0x584ada[_0xa012('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x297971,_0x582f6d){return function(_0x58aae8){if(!_0x58aae8){_0x297971[_0xa012('0x2c')](0x194);}return _0x58aae8;};}function handleError(_0x1b30a2,_0x4f7779){_0x4f7779=_0x4f7779||0x1f4;return function(_0x7f4789){logger[_0xa012('0x2d')](_0x7f4789['stack']);if(_0x7f4789[_0xa012('0x2e')]){delete _0x7f4789['name'];}_0x1b30a2[_0xa012('0x1f')](_0x4f7779)['send'](_0x7f4789);};}exports[_0xa012('0x2f')]=function(_0x50923a,_0x27ebfb){var _0xc10475={},_0x17b9a5={},_0x16f720={'count':0x0,'rows':[]};var _0xd5a4b9=_['map'](db[_0xa012('0x30')][_0xa012('0x31')],function(_0x59d96a){return{'name':_0x59d96a[_0xa012('0x32')],'type':_0x59d96a['type'][_0xa012('0x33')]};});_0x17b9a5[_0xa012('0x34')]=_[_0xa012('0x35')](_0xd5a4b9,_0xa012('0x2e'));_0x17b9a5['query']=_[_0xa012('0x36')](_0x50923a[_0xa012('0x37')]);_0x17b9a5[_0xa012('0x38')]=_['intersection'](_0x17b9a5[_0xa012('0x34')],_0x17b9a5[_0xa012('0x37')]);_0xc10475[_0xa012('0x39')]=_[_0xa012('0x3a')](_0x17b9a5['model'],qs[_0xa012('0x3b')](_0x50923a[_0xa012('0x37')][_0xa012('0x3b')]));_0xc10475[_0xa012('0x39')]=_0xc10475[_0xa012('0x39')]['length']?_0xc10475[_0xa012('0x39')]:_0x17b9a5['model'];if(!_0x50923a['query'][_0xa012('0x3c')](_0xa012('0x3d'))){_0xc10475[_0xa012('0x24')]=qs[_0xa012('0x24')](_0x50923a[_0xa012('0x37')][_0xa012('0x24')]);_0xc10475['offset']=qs[_0xa012('0x22')](_0x50923a[_0xa012('0x37')]['offset']);}_0xc10475[_0xa012('0x3e')]=qs[_0xa012('0x3f')](_0x50923a[_0xa012('0x37')][_0xa012('0x3f')]);_0xc10475[_0xa012('0x40')]=qs[_0xa012('0x38')](_[_0xa012('0x41')](_0x50923a[_0xa012('0x37')],_0x17b9a5[_0xa012('0x38')]),_0xd5a4b9);if(_0x50923a[_0xa012('0x37')][_0xa012('0x42')]){_0xc10475[_0xa012('0x40')]=_[_0xa012('0x43')](_0xc10475[_0xa012('0x40')],{'$or':_[_0xa012('0x35')](_0xd5a4b9,function(_0x1d5c0b){if(_0x1d5c0b[_0xa012('0x44')]!==_0xa012('0x45')){var _0x3bc1cf={};_0x3bc1cf[_0x1d5c0b[_0xa012('0x2e')]]={'$like':'%'+_0x50923a[_0xa012('0x37')]['filter']+'%'};return _0x3bc1cf;}})});}_0xc10475=_[_0xa012('0x43')]({},_0xc10475,_0x50923a['options']);var _0x2f0412={'where':_0xc10475[_0xa012('0x40')]};return db[_0xa012('0x30')][_0xa012('0x25')](_0x2f0412)[_0xa012('0x2b')](function(_0x12c020){_0x16f720[_0xa012('0x25')]=_0x12c020;if(_0x50923a[_0xa012('0x37')][_0xa012('0x46')]){_0xc10475[_0xa012('0x47')]=[{'all':!![]}];}return db[_0xa012('0x30')]['findAll'](_0xc10475);})[_0xa012('0x2b')](function(_0x200e43){_0x16f720[_0xa012('0x48')]=_0x200e43;return _0x16f720;})[_0xa012('0x2b')](respondWithFilteredResult(_0x27ebfb,_0xc10475))[_0xa012('0x49')](handleError(_0x27ebfb,null));};exports[_0xa012('0x4a')]=function(_0x28eae6,_0x5d51cf){var _0x233a60={'raw':![],'where':{'id':_0x28eae6[_0xa012('0x4b')]['id']}},_0x5bf288={};_0x5bf288['model']=_['keys'](db['CmList'][_0xa012('0x31')]);_0x5bf288[_0xa012('0x37')]=_['keys'](_0x28eae6['query']);_0x5bf288[_0xa012('0x38')]=_[_0xa012('0x3a')](_0x5bf288[_0xa012('0x34')],_0x5bf288[_0xa012('0x37')]);_0x233a60[_0xa012('0x39')]=_[_0xa012('0x3a')](_0x5bf288['model'],qs['fields'](_0x28eae6[_0xa012('0x37')][_0xa012('0x3b')]));_0x233a60['attributes']=_0x233a60[_0xa012('0x39')][_0xa012('0x4c')]?_0x233a60[_0xa012('0x39')]:_0x5bf288[_0xa012('0x34')];if(_0x28eae6['query'][_0xa012('0x46')]){_0x233a60[_0xa012('0x47')]=[{'all':!![]}];}_0x233a60=_['merge']({},_0x233a60,_0x28eae6[_0xa012('0x4d')]);return db[_0xa012('0x30')][_0xa012('0x4e')](_0x233a60)[_0xa012('0x2b')](handleEntityNotFound(_0x5d51cf,null))[_0xa012('0x2b')](respondWithResult(_0x5d51cf,null))[_0xa012('0x49')](handleError(_0x5d51cf,null));};exports[_0xa012('0x4f')]=function(_0x14f525,_0x5427f3){return db[_0xa012('0x30')][_0xa012('0x4f')](_0x14f525[_0xa012('0x50')],{})['then'](function(_0x14735a){var _0x289e20=_0x14f525[_0xa012('0x51')]['get']({'plain':!![]});if(!_0x289e20)throw new Error(_0xa012('0x52'));if(_0x289e20[_0xa012('0x53')]===_0xa012('0x51')){var _0x883537=_0x14735a[_0xa012('0x54')]({'plain':!![]});var _0x5569ed=_0xa012('0x55');return db['UserProfileSection'][_0xa012('0x4e')]({'where':{'name':_0x5569ed,'userProfileId':_0x289e20[_0xa012('0x56')]},'raw':!![]})['then'](function(_0x34e000){if(_0x34e000&&_0x34e000[_0xa012('0x57')]===0x0){return db[_0xa012('0x2a')][_0xa012('0x4f')]({'name':_0x883537[_0xa012('0x2e')],'resourceId':_0x883537['id'],'type':_0x34e000[_0xa012('0x2e')],'sectionId':_0x34e000['id']},{})[_0xa012('0x2b')](function(){return _0x14735a;});}else{return _0x14735a;}})[_0xa012('0x49')](function(_0x12b2f7){logger[_0xa012('0x2d')](_0xa012('0x58'),_0x12b2f7);throw _0x12b2f7;});}return _0x14735a;})[_0xa012('0x2b')](respondWithResult(_0x5427f3,0xc9))[_0xa012('0x49')](handleError(_0x5427f3,null));};exports['update']=function(_0x14b757,_0x3ae13f){if(_0x14b757['body']['id']){delete _0x14b757['body']['id'];}return db[_0xa012('0x30')][_0xa012('0x4e')]({'where':{'id':_0x14b757[_0xa012('0x4b')]['id']}})[_0xa012('0x2b')](handleEntityNotFound(_0x3ae13f,null))['then'](saveUpdates(_0x14b757[_0xa012('0x50')],null))[_0xa012('0x2b')](respondWithResult(_0x3ae13f,null))[_0xa012('0x49')](handleError(_0x3ae13f,null));};exports['destroy']=function(_0xccf483,_0x47e964){return db[_0xa012('0x30')][_0xa012('0x4e')]({'where':{'id':_0xccf483[_0xa012('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47e964,null))[_0xa012('0x2b')](removeEntity(_0x47e964,null))[_0xa012('0x49')](handleError(_0x47e964,null));};exports[_0xa012('0x59')]=function(_0x591f7d,_0x201c6e){return db[_0xa012('0x30')]['describe']()[_0xa012('0x2b')](respondWithResult(_0x201c6e,null))[_0xa012('0x49')](handleError(_0x201c6e,null));};exports[_0xa012('0x5a')]=function(_0x211a1d,_0x31ff59,_0x563c49){if(_0x211a1d['body']['id']){delete _0x211a1d[_0xa012('0x50')]['id'];}return db[_0xa012('0x30')]['find']({'where':{'id':_0x211a1d[_0xa012('0x4b')]['id']}})[_0xa012('0x2b')](handleEntityNotFound(_0x31ff59,null))['then'](function(_0x34c643){if(_0x34c643){_0x211a1d[_0xa012('0x50')]['ListId']=_0x34c643['id'];return db[_0xa012('0x5b')][_0xa012('0x4f')](_0x211a1d[_0xa012('0x50')]);}})[_0xa012('0x2b')](respondWithResult(_0x31ff59,null))[_0xa012('0x49')](handleError(_0x31ff59,null));};exports['getDispositions']=function(_0x4579ae,_0x58f937,_0x509941){var _0x598421={'raw':![],'where':{}};var _0x4f28e6={};var _0x300a6a={'count':0x0,'rows':[]};return db[_0xa012('0x30')][_0xa012('0x5c')]({'where':{'id':_0x4579ae[_0xa012('0x4b')]['id']}})[_0xa012('0x2b')](handleEntityNotFound(_0x58f937,null))['then'](function(_0x2095cc){if(_0x2095cc){_0x4f28e6['model']=_[_0xa012('0x36')](db[_0xa012('0x5b')][_0xa012('0x31')]);_0x4f28e6[_0xa012('0x37')]=_[_0xa012('0x36')](_0x4579ae['query']);_0x4f28e6[_0xa012('0x38')]=_[_0xa012('0x3a')](_0x4f28e6[_0xa012('0x34')],_0x4f28e6[_0xa012('0x37')]);_0x598421['attributes']=_[_0xa012('0x3a')](_0x4f28e6[_0xa012('0x34')],qs['fields'](_0x4579ae[_0xa012('0x37')][_0xa012('0x3b')]));_0x598421['attributes']=_0x598421['attributes']['length']?_0x598421[_0xa012('0x39')]:_0x4f28e6['model'];if(!_0x4579ae[_0xa012('0x37')][_0xa012('0x3c')]('nolimit')){_0x598421['limit']=qs[_0xa012('0x24')](_0x4579ae[_0xa012('0x37')][_0xa012('0x24')]);_0x598421[_0xa012('0x22')]=qs[_0xa012('0x22')](_0x4579ae[_0xa012('0x37')]['offset']);}_0x598421[_0xa012('0x3e')]=qs['sort'](_0x4579ae[_0xa012('0x37')][_0xa012('0x3f')]);_0x598421['where']=qs[_0xa012('0x38')](_[_0xa012('0x41')](_0x4579ae[_0xa012('0x37')],_0x4f28e6[_0xa012('0x38')]));_0x598421['where']['ListId']=_0x2095cc['id'];if(_0x4579ae[_0xa012('0x37')][_0xa012('0x42')]){_0x598421[_0xa012('0x40')]=_[_0xa012('0x43')](_0x598421['where'],{'$or':_['map'](_0x598421[_0xa012('0x39')],function(_0x457d3d){var _0x3e052d={};_0x3e052d[_0x457d3d]={'$like':'%'+_0x4579ae['query']['filter']+'%'};return _0x3e052d;})});}_0x598421=_[_0xa012('0x43')]({},_0x598421,_0x4579ae[_0xa012('0x4d')]);return db[_0xa012('0x5b')][_0xa012('0x25')]({'where':_0x598421[_0xa012('0x40')]})[_0xa012('0x2b')](function(_0x41a9dd){_0x300a6a['count']=_0x41a9dd;if(_0x4579ae['query'][_0xa012('0x46')]){_0x598421['include']=[{'all':!![]}];}return db[_0xa012('0x5b')][_0xa012('0x5d')](_0x598421);})[_0xa012('0x2b')](function(_0x47854d){_0x300a6a[_0xa012('0x48')]=_0x47854d;return _0x300a6a;});}})['then'](respondWithFilteredResult(_0x58f937,_0x598421))[_0xa012('0x49')](handleError(_0x58f937,null));};exports[_0xa012('0x5e')]=function(_0xd28f4e,_0x1ae0f1,_0x2eb9db){return db[_0xa012('0x30')][_0xa012('0x4e')]({'where':{'id':_0xd28f4e['params']['id']}})[_0xa012('0x2b')](handleEntityNotFound(_0x1ae0f1,null))[_0xa012('0x2b')](function(_0x25aeba){if(_0x25aeba){return _0x25aeba['removeDispositions'](_0xd28f4e[_0xa012('0x37')][_0xa012('0x5f')]);}})['then'](respondWithStatusCode(_0x1ae0f1,null))['catch'](handleError(_0x1ae0f1,null));};exports['addContacts']=function(_0x228d16,_0x5f1780,_0x29fe8b){return db[_0xa012('0x30')]['find']({'where':{'id':_0x228d16[_0xa012('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5f1780,null))['then'](function(_0x3a3b14){if(_0x3a3b14){var _0x1bf363=[];var _0x453f46={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xa012('0x2b')](function(_0x37b0da){if(_0x228d16[_0xa012('0x50')][_0xa012('0x60')]&&_['isArray'](_0x228d16[_0xa012('0x50')][_0xa012('0x60')])){if(_0x228d16[_0xa012('0x50')][_0xa012('0x60')][_0xa012('0x4c')]){_0x228d16[_0xa012('0x50')]['tags']=_0x228d16['body'][_0xa012('0x60')][_0xa012('0x61')](';')+';';}else{_0x228d16[_0xa012('0x50')][_0xa012('0x60')]=null;}}else{_0x228d16['body'][_0xa012('0x60')]=null;}if(_0x228d16['body']&&_[_0xa012('0x62')](_0x228d16[_0xa012('0x50')])){for(var _0x21a0eb=0x0;_0x21a0eb<_0x228d16[_0xa012('0x50')]['length'];_0x21a0eb+=0x1){_0x228d16[_0xa012('0x50')][_0x21a0eb][_0xa012('0x63')]=_0x228d16[_0xa012('0x4b')]['id'];_0x1bf363['push'](_0x228d16[_0xa012('0x50')][_0x21a0eb]);}return BPromise[_0xa012('0x64')](_0x1bf363,function(_0x341ec2){return db[_0xa012('0x65')][_0xa012('0x4f')](_[_0xa012('0x66')](_0x341ec2,['ids','id'])||{},{'fields':_['keys'](_0x37b0da),'raw':!![]})[_0xa012('0x2b')](function(_0x4b383a){_0x453f46[_0xa012('0x67')][_0xa012('0x68')](_0x4b383a[_0xa012('0x69')]);})[_0xa012('0x49')](function(_0x4be20e){_0x453f46[_0xa012('0x6a')][_0xa012('0x68')]({'data':_0x341ec2,'error':_0x4be20e['message']});});})[_0xa012('0x2b')](function(_0x41263e){return _0x453f46;})['catch'](function(_0x486de5){return _0x486de5;});}else{_0x5f1780[_0xa012('0x1f')](0x190)[_0xa012('0x21')]({'message':_0xa012('0x6b')});}});}})[_0xa012('0x2b')](respondWithResult(_0x5f1780,null))[_0xa012('0x49')](handleError(_0x5f1780,null));};exports[_0xa012('0x6c')]=function(_0x89f6ed,_0x3fcc5e,_0x56da89){var _0xa244cf;return db['CmList'][_0xa012('0x4e')]({'where':{'id':_0x89f6ed[_0xa012('0x4b')]['id']},'include':[{'model':db[_0xa012('0x6d')],'as':_0xa012('0x6e')}]})[_0xa012('0x2b')](handleEntityNotFound(_0x3fcc5e,null))[_0xa012('0x2b')](function(_0xdbbdf4){if(_0xdbbdf4){_0xa244cf=_0xdbbdf4;return db[_0xa012('0x65')]['rawAttributes'];}})[_0xa012('0x2b')](function(_0x420f7e){if(_0x420f7e){var _0x493fbb={};var _0x48dda7={};_0x48dda7[_0xa012('0x34')]=_[_0xa012('0x6f')](_['keys'](_0x420f7e),_[_0xa012('0x35')](_0xa244cf[_0xa012('0x6e')],function(_0x56378a){return util[_0xa012('0x70')](_0xa012('0x71'),_0x56378a['id']);}));_0x48dda7[_0xa012('0x37')]=_[_0xa012('0x36')](_0x89f6ed[_0xa012('0x37')]);_0x48dda7[_0xa012('0x38')]=_['intersection'](_0x48dda7['model'],_0x48dda7[_0xa012('0x37')]);_0x493fbb[_0xa012('0x39')]=_[_0xa012('0x3a')](_0x48dda7['model'],qs[_0xa012('0x3b')](_0x89f6ed['query'][_0xa012('0x3b')]));_0x493fbb[_0xa012('0x39')]=_0x493fbb['attributes']['length']?_0x493fbb[_0xa012('0x39')]:_0x48dda7[_0xa012('0x34')];if(!_0x89f6ed[_0xa012('0x37')][_0xa012('0x3c')]('nolimit')){_0x493fbb[_0xa012('0x24')]=qs['limit'](_0x89f6ed[_0xa012('0x37')][_0xa012('0x24')]);_0x493fbb['offset']=qs[_0xa012('0x22')](_0x89f6ed[_0xa012('0x37')][_0xa012('0x22')]);}_0x493fbb[_0xa012('0x3e')]=qs[_0xa012('0x3f')](_0x89f6ed[_0xa012('0x37')][_0xa012('0x3f')]);_0x493fbb[_0xa012('0x40')]=qs[_0xa012('0x38')](_['pick'](_0x89f6ed[_0xa012('0x37')],_0x48dda7[_0xa012('0x38')]));_0x493fbb[_0xa012('0x72')]=!![];if(_0x89f6ed[_0xa012('0x37')][_0xa012('0x42')]){_0x493fbb[_0xa012('0x40')]=_[_0xa012('0x43')](_0x493fbb[_0xa012('0x40')],{'$or':_[_0xa012('0x35')](_0x493fbb['attributes'],function(_0x36ed92){var _0x3312d1={};_0x3312d1[_0x36ed92]={'$like':'%'+_0x89f6ed['query']['filter']+'%'};return _0x3312d1;})});}_0x493fbb=_[_0xa012('0x43')]({},_0x493fbb,_0x89f6ed[_0xa012('0x4d')]);return _0xa244cf[_0xa012('0x6c')](_0x493fbb);}})[_0xa012('0x2b')](respondWithResult(_0x3fcc5e,null))['catch'](handleError(_0x3fcc5e,null));};exports[_0xa012('0x73')]=function(_0x3696b9,_0x4fc6b2,_0x7e6e0d){var _0x8ba5bf;var _0x354156;var _0x45a1d6;var _0x11c2fc=_0x3696b9[_0xa012('0x4b')]['id'];csv_results=[];return db[_0xa012('0x74')][_0xa012('0x5d')]({'attributes':['id',_0xa012('0x2e')],'raw':!![],'order':[_0xa012('0x75')]})[_0xa012('0x2b')](function(_0x442d0d){_0x8ba5bf=_0x442d0d;var _0x128be2=_[_0xa012('0x36')](db[_0xa012('0x65')][_0xa012('0x31')]);return db[_0xa012('0x6d')]['findAll']({'raw':!![],'attributes':['id','alias']})[_0xa012('0x2b')](function(_0x1cf247){_0x354156=_0x1cf247;var _0xe5e137=squel['select']()[_0xa012('0x3b')](_0x128be2)[_0xa012('0x76')](_0xa012('0x77'),'c')[_0xa012('0x40')](_0xa012('0x78'),_0x11c2fc)['where'](_0xa012('0x79'))['distinct']();for(var _0x1f1479=0x0;_0x1f1479<_0x354156['length'];_0x1f1479++){_0xe5e137[_0xa012('0x7a')](_0xa012('0x7b')+_0x354156[_0x1f1479]['id'],_0xa012('0x7c')+_0x354156[_0x1f1479][_0xa012('0x7d')]);}for(var _0x1f1479=0x0;_0x1f1479<_0x8ba5bf['length'];_0x1f1479++){_0xe5e137[_0xa012('0x7a')](squel[_0xa012('0x7e')]()[_0xa012('0x7a')](_0xa012('0x7f'))[_0xa012('0x76')](_0xa012('0x80'))[_0xa012('0x40')](_0xa012('0x81'),_0x8ba5bf[_0x1f1479]['id'])[_0xa012('0x40')]('CmContactId\x20=\x20c.id'),_0xa012('0x82')+_0x8ba5bf[_0x1f1479][_0xa012('0x2e')]);_0xe5e137[_0xa012('0x7a')](squel[_0xa012('0x7e')]()['field'](_0xa012('0x83'))[_0xa012('0x76')](_0xa012('0x80'))[_0xa012('0x40')](_0xa012('0x81'),_0x8ba5bf[_0x1f1479]['id'])['where'](_0xa012('0x84')),'description_additionalPhone_'+_0x8ba5bf[_0x1f1479][_0xa012('0x2e')]);}var _0x41db0b=[];_0x41db0b[_0xa012('0x68')](_0xe5e137['toString']());BPromise[_0xa012('0x64')](_0x41db0b,handleQuery)[_0xa012('0x2b')](function(_0x5e6ad5){handleQuery(_0xe5e137[_0xa012('0x85')]());var _0x1e1f09=csv_results[0x0];if(!_[_0xa012('0x86')](_0x1e1f09)){var _0xe85bd1=toCsv(_0x1e1f09);var _0x3a9a0f=Date['now']();fs['writeFileSync'](util[_0xa012('0x70')](_0xa012('0x87'),_0x11c2fc,_0x3a9a0f),_0xe85bd1);_0x4fc6b2[_0xa012('0x88')](_0xa012('0x89'),_0xa012('0x8a')+util[_0xa012('0x70')]('list_%d_%s.csv',_0x11c2fc,_0x3a9a0f));_0x4fc6b2['setHeader'](_0xa012('0x8b'),_0xa012('0x8c'));return _0x4fc6b2['download'](util[_0xa012('0x70')](_0xa012('0x87'),_0x11c2fc,_0x3a9a0f));}else{return _0x4fc6b2['sendStatus'](0xcc);}});});});};exports[_0xa012('0x8d')]=function(_0x102573,_0x2633a2,_0xee86a0){var _0x3357d9;delete _0x102573[_0xa012('0x50')]['id'];return db[_0xa012('0x30')]['findOne']({'where':{'id':_0x102573['params']['id']}})['then'](handleEntityNotFound(_0x2633a2,null))[_0xa012('0x2b')](function(_0x2d9102){if(_0x2d9102){return db['sequelize'][_0xa012('0x8e')](function(_0x3c88d0){return db[_0xa012('0x6d')][_0xa012('0x4f')](_0x102573[_0xa012('0x50')],{'transaction':_0x3c88d0})[_0xa012('0x2b')](function(_0x216e2b){_0x3357d9=_0x216e2b;return _0x2d9102[_0xa012('0x8f')](_0x216e2b,{'transaction':_0x3c88d0});})[_0xa012('0x2b')](function(){var _0x201c19={'type':db[_0xa012('0x90')]['TEXT'],'transaction':_0x3c88d0};switch(_0x102573['body'][_0xa012('0x44')]){case'text':_0x201c19[_0xa012('0x44')]=db[_0xa012('0x90')][_0xa012('0x91')];break;case'number':_0x201c19[_0xa012('0x44')]=db[_0xa012('0x90')][_0xa012('0x92')];break;case _0xa012('0x93'):_0x201c19[_0xa012('0x44')]=db[_0xa012('0x90')][_0xa012('0x94')];_0x201c19[_0xa012('0x95')]=![];break;default:}return db[_0xa012('0x96')][_0xa012('0x97')][_0xa012('0x98')]('cm_contacts',util['format']('cf_%s',_0x3357d9['id']),_0x201c19);})[_0xa012('0x2b')](function(){return _0x3357d9;});});}})['then'](respondWithResult(_0x2633a2,null))[_0xa012('0x49')](handleError(_0x2633a2,null));};exports[_0xa012('0x99')]=function(_0x50838d,_0x224f4c,_0x29d7c7){var _0x15a4be={};var _0x6cf527={};var _0x122d08;var _0x2c4d87;return db[_0xa012('0x30')][_0xa012('0x5c')]({'where':{'id':_0x50838d[_0xa012('0x4b')]['id']}})[_0xa012('0x2b')](handleEntityNotFound(_0x224f4c,null))[_0xa012('0x2b')](function(_0x5976d5){if(_0x5976d5){_0x122d08=_0x5976d5;_0x6cf527[_0xa012('0x34')]=_[_0xa012('0x36')](db[_0xa012('0x6d')][_0xa012('0x31')]);_0x6cf527['query']=_[_0xa012('0x36')](_0x50838d[_0xa012('0x37')]);_0x6cf527[_0xa012('0x38')]=_['intersection'](_0x6cf527[_0xa012('0x34')],_0x6cf527[_0xa012('0x37')]);_0x15a4be[_0xa012('0x39')]=_[_0xa012('0x3a')](_0x6cf527['model'],qs[_0xa012('0x3b')](_0x50838d[_0xa012('0x37')]['fields']));_0x15a4be[_0xa012('0x39')]=_0x15a4be[_0xa012('0x39')][_0xa012('0x4c')]?_0x15a4be['attributes']:_0x6cf527['model'];_0x15a4be['order']=qs['sort'](_0x50838d[_0xa012('0x37')][_0xa012('0x3f')]);_0x15a4be[_0xa012('0x40')]=qs['filters'](_['pick'](_0x50838d['query'],_0x6cf527[_0xa012('0x38')]));_0x15a4be[_0xa012('0x40')]=_['merge'](_0x15a4be[_0xa012('0x40')],{'$or':[{'ListId':_0x5976d5['id']},{'ListId':null}]});if(_0x50838d[_0xa012('0x37')][_0xa012('0x42')]){_0x15a4be['where']=_[_0xa012('0x43')](_0x15a4be['where'],{'$or':_[_0xa012('0x35')](_0x15a4be[_0xa012('0x39')],function(_0x3b33e4){var _0x30d38b={};_0x30d38b[_0x3b33e4]={'$like':'%'+_0x50838d[_0xa012('0x37')][_0xa012('0x42')]+'%'};return _0x30d38b;})});}_0x15a4be=_[_0xa012('0x43')]({},_0x15a4be,_0x50838d[_0xa012('0x4d')]);return db[_0xa012('0x6d')][_0xa012('0x9a')](_0x15a4be);}})[_0xa012('0x2b')](respondWithResult(_0x224f4c,null))[_0xa012('0x49')](handleError(_0x224f4c,null));};exports[_0xa012('0x9b')]=function(_0x21aa28,_0xc1572c){return db[_0xa012('0x6d')]['findAndCountAll']({'where':{'ListId':null}})[_0xa012('0x2b')](handleEntityNotFound(_0xc1572c,null))['then'](function(_0x5615a5){return _0x5615a5;})['then'](respondWithResult(_0xc1572c,null))[_0xa012('0x49')](handleError(_0xc1572c,null));};exports[_0xa012('0x9c')]=function(_0x157148,_0x4d0050,_0x1c4713){return db[_0xa012('0x30')]['find']({'where':{'id':_0x157148[_0xa012('0x4b')]['id']}})[_0xa012('0x2b')](handleEntityNotFound(_0x4d0050,null))[_0xa012('0x2b')](function(_0x393cbf){if(_0x393cbf){return _0x393cbf[_0xa012('0x9c')](_0x157148[_0xa012('0x50')][_0xa012('0x5f')],_['omit'](_0x157148[_0xa012('0x50')],[_0xa012('0x5f'),'id'])||{})['spread'](function(_0x5a89bc){for(var _0x40f6cd=0x0;_0x40f6cd<_0x157148[_0xa012('0x50')][_0xa012('0x5f')][_0xa012('0x4c')];_0x40f6cd+=0x1){socket[_0xa012('0x9d')](_0xa012('0x9e'),{'UserId':Number(_0x157148[_0xa012('0x50')]['ids'][_0x40f6cd]),'CmListId':Number(_0x157148[_0xa012('0x4b')]['id'])});}return _0x5a89bc;});}})['then'](respondWithResult(_0x4d0050,null))[_0xa012('0x49')](handleError(_0x4d0050,null));};exports[_0xa012('0x9f')]=function(_0x43869d,_0x4051b2,_0x58ac51){return db[_0xa012('0x30')][_0xa012('0x4e')]({'where':{'id':_0x43869d[_0xa012('0x4b')]['id']}})[_0xa012('0x2b')](handleEntityNotFound(_0x4051b2,null))[_0xa012('0x2b')](function(_0x423968){if(_0x423968){return _0x423968[_0xa012('0x9f')](_0x43869d['query'][_0xa012('0x5f')])[_0xa012('0x2b')](function(){if(_[_0xa012('0x62')](_0x43869d[_0xa012('0x37')][_0xa012('0x5f')])){for(var _0x2ff584=0x0;_0x2ff584<_0x43869d[_0xa012('0x37')][_0xa012('0x5f')][_0xa012('0x4c')];_0x2ff584+=0x1){socket['emit'](_0xa012('0xa0'),{'UserId':Number(_0x43869d[_0xa012('0x37')][_0xa012('0x5f')][_0x2ff584]),'CmListId':Number(_0x43869d['params']['id'])});}}else{socket[_0xa012('0x9d')](_0xa012('0xa0'),{'UserId':Number(_0x43869d['query'][_0xa012('0x5f')]),'CmListId':Number(_0x43869d['params']['id'])});}});}})[_0xa012('0x2b')](respondWithStatusCode(_0x4051b2,null))[_0xa012('0x49')](handleError(_0x4051b2,null));};exports[_0xa012('0xa1')]=function(_0x78d51c,_0x332f53,_0x41b85a){var _0x486be4={};var _0x5b30be={};var _0x5ff8fd;var _0x5772a6;return db[_0xa012('0x30')]['findOne']({'where':{'id':_0x78d51c[_0xa012('0x4b')]['id']}})[_0xa012('0x2b')](handleEntityNotFound(_0x332f53,null))['then'](function(_0x3ff002){if(_0x3ff002){_0x5ff8fd=_0x3ff002;_0x5b30be['model']=_[_0xa012('0x36')](db[_0xa012('0xa2')][_0xa012('0x31')]);_0x5b30be[_0xa012('0x37')]=_['keys'](_0x78d51c[_0xa012('0x37')]);_0x5b30be[_0xa012('0x38')]=_[_0xa012('0x3a')](_0x5b30be[_0xa012('0x34')],_0x5b30be[_0xa012('0x37')]);_0x486be4[_0xa012('0x39')]=_[_0xa012('0x3a')](_0x5b30be[_0xa012('0x34')],qs[_0xa012('0x3b')](_0x78d51c['query'][_0xa012('0x3b')]));_0x486be4[_0xa012('0x39')]=_0x486be4[_0xa012('0x39')][_0xa012('0x4c')]?_0x486be4['attributes']:_0x5b30be[_0xa012('0x34')];_0x486be4[_0xa012('0x3e')]=qs['sort'](_0x78d51c[_0xa012('0x37')][_0xa012('0x3f')]);_0x486be4['where']=qs[_0xa012('0x38')](_[_0xa012('0x41')](_0x78d51c['query'],_0x5b30be['filters']));if(_0x78d51c['query']['filter']){_0x486be4[_0xa012('0x40')]=_[_0xa012('0x43')](_0x486be4[_0xa012('0x40')],{'$or':_[_0xa012('0x35')](_0x486be4['attributes'],function(_0x33a380){var _0x95f12f={};_0x95f12f[_0x33a380]={'$like':'%'+_0x78d51c['query']['filter']+'%'};return _0x95f12f;})});}_0x486be4=_[_0xa012('0x43')]({},_0x486be4,_0x78d51c[_0xa012('0x4d')]);return _0x5ff8fd[_0xa012('0xa1')](_0x486be4);}})[_0xa012('0x2b')](function(_0x277ef8){if(_0x277ef8){_0x5772a6=_0x277ef8[_0xa012('0x4c')];if(!_0x78d51c[_0xa012('0x37')]['hasOwnProperty'](_0xa012('0x3d'))){_0x486be4['limit']=qs[_0xa012('0x24')](_0x78d51c['query'][_0xa012('0x24')]);_0x486be4['offset']=qs['offset'](_0x78d51c[_0xa012('0x37')][_0xa012('0x22')]);}return _0x5ff8fd[_0xa012('0xa1')](_0x486be4);}})[_0xa012('0x2b')](function(_0x482ed7){if(_0x482ed7){return _0x482ed7?{'count':_0x5772a6,'rows':_0x482ed7}:null;}})[_0xa012('0x2b')](respondWithResult(_0x332f53,null))[_0xa012('0x49')](handleError(_0x332f53,null));};function handleQuery(_0xffefc3){logger[_0xa012('0xa3')](_0xffefc3);return db['sequelize'][_0xa012('0x37')](_0xffefc3)['spread'](function(_0xe815fa){csv_results['push'](_0xe815fa);})[_0xa012('0x49')](function(_0x118f89){logger[_0xa012('0x2d')](_0x118f89['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index fe3dcd5..9a46734 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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x1bea7e,_0x3174ee){_0x1bea7e=_0x1bea7e-0x0;var _0x2b9a99=_0x3e74[_0x1bea7e];return _0x2b9a99;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x20fc54,_0x3ce582){_0x20fc54=_0x20fc54-0x0;var _0xd0c26=_0xe14b[_0x20fc54];return _0xd0c26;};'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 5e2919c..762621f 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 _0x6f0d=['./cmList.attributes','define','CmList','cm_lists','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1051fa,_0xfc729d){_0x1051fa=_0x1051fa-0x0;var _0x3c2251=_0x6f0d[_0x1051fa];return _0x3c2251;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird'];(function(_0x196acc,_0x1d2ff){var _0x4a0329=function(_0x315435){while(--_0x315435){_0x196acc['push'](_0x196acc['shift']());}};_0x4a0329(++_0x1d2ff);}(_0xe706,0xa3));var _0x6e70=function(_0xe14ee9,_0x4cd8e1){_0xe14ee9=_0xe14ee9-0x0;var _0x1dda60=_0xe706[_0xe14ee9];return _0x1dda60;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 1c818c9..df01382 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 _0x96ec=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0x96ec,0xae));var _0xc96e=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0x96ec[_0x584291];return _0x4e7d08;};'use strict';var _=require(_0xc96e('0x0'));var util=require('util');var moment=require(_0xc96e('0x1'));var BPromise=require(_0xc96e('0x2'));var rs=require(_0xc96e('0x3'));var fs=require('fs');var Redis=require(_0xc96e('0x4'));var db=require(_0xc96e('0x5'))['db'];var utils=require(_0xc96e('0x6'));var logger=require(_0xc96e('0x7'))(_0xc96e('0x8'));var config=require(_0xc96e('0x9'));var jayson=require(_0xc96e('0xa'));var client=jayson[_0xc96e('0xb')][_0xc96e('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc96e('0xd')],{'host':_0xc96e('0xe'),'port':0x18eb});var socket=require(_0xc96e('0xf'))(new Redis(config[_0xc96e('0xd')]));require('./cmList.socket')[_0xc96e('0x10')](socket);function respondWithRpcPromise(_0x5e84e0,_0x394f63,_0x289263){return new BPromise(function(_0x57af06,_0x3fb550){return client['request'](_0x5e84e0,_0x289263)['then'](function(_0x134c5d){logger[_0xc96e('0x11')](_0xc96e('0x12'),_0x394f63,_0xc96e('0x13'));logger[_0xc96e('0x14')](_0xc96e('0x15'),_0x394f63,_0xc96e('0x13'),JSON[_0xc96e('0x16')](_0x134c5d));if(_0x134c5d[_0xc96e('0x17')]){if(_0x134c5d[_0xc96e('0x17')][_0xc96e('0x18')]===0x1f4){logger[_0xc96e('0x17')](_0xc96e('0x12'),_0x394f63,_0x134c5d['error']['message']);return _0x3fb550(_0x134c5d[_0xc96e('0x17')][_0xc96e('0x19')]);}logger[_0xc96e('0x17')](_0xc96e('0x12'),_0x394f63,_0x134c5d[_0xc96e('0x17')]['message']);return _0x57af06(_0x134c5d[_0xc96e('0x17')]['message']);}else{logger[_0xc96e('0x11')]('CmList,\x20%s,\x20%s',_0x394f63,_0xc96e('0x13'));_0x57af06(_0x134c5d[_0xc96e('0x1a')][_0xc96e('0x19')]);}})[_0xc96e('0x1b')](function(_0x5e5cff){logger[_0xc96e('0x17')](_0xc96e('0x12'),_0x394f63,_0x5e5cff);_0x3fb550(_0x5e5cff);});});} \ No newline at end of file +var _0xb45c=['debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./cmList.socket','then','info','CmList,\x20%s,\x20%s'];(function(_0x886bf3,_0x37ece7){var _0x878940=function(_0x8d1104){while(--_0x8d1104){_0x886bf3['push'](_0x886bf3['shift']());}};_0x878940(++_0x37ece7);}(_0xb45c,0x93));var _0xcb45=function(_0x516722,_0xe3027f){_0x516722=_0x516722-0x0;var _0x5a7485=_0xb45c[_0x516722];return _0x5a7485;};'use strict';var _=require(_0xcb45('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb45('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb45('0x2'));var logger=require(_0xcb45('0x3'))(_0xcb45('0x4'));var config=require(_0xcb45('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcb45('0x6')]({'port':0x232a});config[_0xcb45('0x7')]=_['defaults'](config[_0xcb45('0x7')],{'host':_0xcb45('0x8'),'port':0x18eb});var socket=require(_0xcb45('0x9'))(new Redis(config[_0xcb45('0x7')]));require(_0xcb45('0xa'))['register'](socket);function respondWithRpcPromise(_0x2eb4a3,_0x1fcda0,_0x309244){return new BPromise(function(_0x4fc799,_0x18c016){return client['request'](_0x2eb4a3,_0x309244)[_0xcb45('0xb')](function(_0x3ea8d0){logger[_0xcb45('0xc')](_0xcb45('0xd'),_0x1fcda0,'request\x20sent');logger[_0xcb45('0xe')](_0xcb45('0xf'),_0x1fcda0,'request\x20sent',JSON[_0xcb45('0x10')](_0x3ea8d0));if(_0x3ea8d0[_0xcb45('0x11')]){if(_0x3ea8d0['error'][_0xcb45('0x12')]===0x1f4){logger[_0xcb45('0x11')](_0xcb45('0xd'),_0x1fcda0,_0x3ea8d0['error']['message']);return _0x18c016(_0x3ea8d0[_0xcb45('0x11')][_0xcb45('0x13')]);}logger[_0xcb45('0x11')](_0xcb45('0xd'),_0x1fcda0,_0x3ea8d0['error'][_0xcb45('0x13')]);return _0x4fc799(_0x3ea8d0['error'][_0xcb45('0x13')]);}else{logger[_0xcb45('0xc')]('CmList,\x20%s,\x20%s',_0x1fcda0,_0xcb45('0x14'));_0x4fc799(_0x3ea8d0[_0xcb45('0x15')][_0xcb45('0x13')]);}})[_0xcb45('0x16')](function(_0x2bafe6){logger[_0xcb45('0x11')](_0xcb45('0xd'),_0x1fcda0,_0x2bafe6);_0x18c016(_0x2bafe6);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 62662a1..af78188 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 _0x48ce=['register','cmList:','./cmList.events','remove','emit','removeListener'];(function(_0x459e70,_0x25395e){var _0x56eac6=function(_0x367bf1){while(--_0x367bf1){_0x459e70['push'](_0x459e70['shift']());}};_0x56eac6(++_0x25395e);}(_0x48ce,0x10a));var _0xe48c=function(_0x24018e,_0x598a38){_0x24018e=_0x24018e-0x0;var _0xe10f63=_0x48ce[_0x24018e];return _0xe10f63;};'use strict';var CmListEvents=require(_0xe48c('0x0'));var events=['save',_0xe48c('0x1'),'update'];function createListener(_0x4f852f,_0x207a9f){return function(_0x536614){_0x207a9f[_0xe48c('0x2')](_0x4f852f,_0x536614);};}function removeListener(_0x5586fe,_0x3bbc06){return function(){CmListEvents[_0xe48c('0x3')](_0x5586fe,_0x3bbc06);};}exports[_0xe48c('0x4')]=function(_0x283037){for(var _0x3fc778=0x0,_0x3e34ea=events['length'];_0x3fc778<_0x3e34ea;_0x3fc778++){var _0x2cff88=events[_0x3fc778];var _0x28ee95=createListener(_0xe48c('0x5')+_0x2cff88,_0x283037);CmListEvents['on'](_0x2cff88,_0x28ee95);}}; \ No newline at end of file +var _0x1caa=['remove','emit','removeListener','register','cmList:','./cmList.events'];(function(_0x3ef866,_0xaec787){var _0x2b1c45=function(_0x497405){while(--_0x497405){_0x3ef866['push'](_0x3ef866['shift']());}};_0x2b1c45(++_0xaec787);}(_0x1caa,0xbf));var _0xa1ca=function(_0x2b06c5,_0x3bc312){_0x2b06c5=_0x2b06c5-0x0;var _0x57f31c=_0x1caa[_0x2b06c5];return _0x57f31c;};'use strict';var CmListEvents=require(_0xa1ca('0x0'));var events=['save',_0xa1ca('0x1'),'update'];function createListener(_0x193608,_0x428ccc){return function(_0x425d4a){_0x428ccc[_0xa1ca('0x2')](_0x193608,_0x425d4a);};}function removeListener(_0xd599ba,_0x586653){return function(){CmListEvents[_0xa1ca('0x3')](_0xd599ba,_0x586653);};}exports[_0xa1ca('0x4')]=function(_0x7e6187){for(var _0x4a477a=0x0,_0x2ce3cf=events['length'];_0x4a477a<_0x2ce3cf;_0x4a477a++){var _0x372c42=events[_0x4a477a];var _0x2c3584=createListener(_0xa1ca('0x5')+_0x372c42,_0x7e6187);CmListEvents['on'](_0x372c42,_0x2c3584);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e04ccfe..f096d4b 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 _0xa567=['exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/global_fields','show','/:id/dispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','/:id/contacts','addCustomField','/:id/users','addAgents','/:id','delete','destroy','removeDispositions','removeAgents'];(function(_0x468d3d,_0x37db09){var _0x522534=function(_0x27c4cd){while(--_0x27c4cd){_0x468d3d['push'](_0x468d3d['shift']());}};_0x522534(++_0x37db09);}(_0xa567,0x119));var _0x7a56=function(_0x2525f7,_0x1e59cf){_0x2525f7=_0x2525f7-0x0;var _0x5a1e0d=_0xa567[_0x2525f7];return _0x5a1e0d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7a56('0x0'));var timeout=require(_0x7a56('0x1'));var express=require(_0x7a56('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7a56('0x3'));var config=require(_0x7a56('0x4'));var controller=require('./cmList.controller');router[_0x7a56('0x5')]('/',auth['isAuthenticated'](),controller[_0x7a56('0x6')]);router['get'](_0x7a56('0x7'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x9')]);router[_0x7a56('0x5')](_0x7a56('0xa'),auth[_0x7a56('0x8')](),controller['getGlobalCustomFields']);router[_0x7a56('0x5')]('/:id',auth[_0x7a56('0x8')](),controller[_0x7a56('0xb')]);router[_0x7a56('0x5')](_0x7a56('0xc'),auth[_0x7a56('0x8')](),controller['getDispositions']);router[_0x7a56('0x5')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router['get'](_0x7a56('0xd'),auth[_0x7a56('0x8')](),controller[_0x7a56('0xe')]);router[_0x7a56('0x5')](_0x7a56('0xf'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x10')]);router[_0x7a56('0x5')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x7a56('0x8')](),controller['create']);router[_0x7a56('0x11')](_0x7a56('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x7a56('0x11')](_0x7a56('0x12'),auth[_0x7a56('0x8')](),controller['addContacts']);router['post'](_0x7a56('0xf'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x13')]);router['post'](_0x7a56('0x14'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x15')]);router['put'](_0x7a56('0x16'),auth[_0x7a56('0x8')](),controller['update']);router[_0x7a56('0x17')](_0x7a56('0x16'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x18')]);router['delete'](_0x7a56('0xc'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x19')]);router[_0x7a56('0x17')](_0x7a56('0x14'),auth[_0x7a56('0x8')](),controller[_0x7a56('0x1a')]);module[_0x7a56('0x1b')]=router; \ No newline at end of file +var _0x95fa=['create','addDisposition','addContacts','addCustomField','put','update','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','/describe','describe','/global_fields','isAuthenticated','getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post'];(function(_0x287911,_0x1f4589){var _0x357a9b=function(_0x52abdd){while(--_0x52abdd){_0x287911['push'](_0x287911['shift']());}};_0x357a9b(++_0x1f4589);}(_0x95fa,0x196));var _0xa95f=function(_0x2e7cff,_0x4624bd){_0x2e7cff=_0x2e7cff-0x0;var _0x2b5dd9=_0x95fa[_0x2e7cff];return _0x2b5dd9;};'use strict';var multer=require(_0xa95f('0x0'));var util=require(_0xa95f('0x1'));var path=require('path');var timeout=require(_0xa95f('0x2'));var express=require('express');var router=express[_0xa95f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa95f('0x4'));var interaction=require(_0xa95f('0x5'));var config=require(_0xa95f('0x6'));var controller=require(_0xa95f('0x7'));router[_0xa95f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa95f('0x9'),auth['isAuthenticated'](),controller[_0xa95f('0xa')]);router[_0xa95f('0x8')](_0xa95f('0xb'),auth[_0xa95f('0xc')](),controller[_0xa95f('0xd')]);router[_0xa95f('0x8')](_0xa95f('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xa95f('0x8')](_0xa95f('0xf'),auth['isAuthenticated'](),controller[_0xa95f('0x10')]);router[_0xa95f('0x8')](_0xa95f('0x11'),auth[_0xa95f('0xc')](),controller['getContacts']);router[_0xa95f('0x8')](_0xa95f('0x12'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0xa95f('0x8')](_0xa95f('0x13'),auth[_0xa95f('0xc')](),controller[_0xa95f('0x14')]);router[_0xa95f('0x8')](_0xa95f('0x15'),auth[_0xa95f('0xc')](),controller['getAgents']);router[_0xa95f('0x16')]('/',auth['isAuthenticated'](),controller[_0xa95f('0x17')]);router[_0xa95f('0x16')](_0xa95f('0xf'),auth[_0xa95f('0xc')](),controller[_0xa95f('0x18')]);router[_0xa95f('0x16')](_0xa95f('0x11'),auth[_0xa95f('0xc')](),controller[_0xa95f('0x19')]);router[_0xa95f('0x16')](_0xa95f('0x13'),auth[_0xa95f('0xc')](),controller[_0xa95f('0x1a')]);router['post'](_0xa95f('0x15'),auth[_0xa95f('0xc')](),controller['addAgents']);router[_0xa95f('0x1b')]('/:id',auth[_0xa95f('0xc')](),controller[_0xa95f('0x1c')]);router[_0xa95f('0x1d')](_0xa95f('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xa95f('0x1d')](_0xa95f('0xf'),auth[_0xa95f('0xc')](),controller[_0xa95f('0x1e')]);router[_0xa95f('0x1d')](_0xa95f('0x15'),auth[_0xa95f('0xc')](),controller[_0xa95f('0x1f')]);module[_0xa95f('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 3c164a7..0f18258 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 _0x788e=['sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x19c240,_0x4b71cc){var _0xa6595b=function(_0x59a309){while(--_0x59a309){_0x19c240['push'](_0x19c240['shift']());}};_0xa6595b(++_0x4b71cc);}(_0x788e,0x87));var _0xe788=function(_0x5abbf4,_0x5536cb){_0x5abbf4=_0x5abbf4-0x0;var _0x4768b7=_0x788e[_0x5abbf4];return _0x4768b7;};'use strict';var Sequelize=require(_0xe788('0x0'));module[_0xe788('0x1')]={'name':{'type':Sequelize[_0xe788('0x2')],'get':function(_0x4dd13e){return this[_0xe788('0x3')]('field');}},'field':{'type':Sequelize[_0xe788('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xe788('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xe788('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x0f4b=['field','STRING','getDataValue'];(function(_0x5cc30e,_0x2646b6){var _0x208c6d=function(_0x1abc53){while(--_0x1abc53){_0x5cc30e['push'](_0x5cc30e['shift']());}};_0x208c6d(++_0x2646b6);}(_0x0f4b,0x95));var _0xb0f4=function(_0x330cfa,_0xa88f28){_0x330cfa=_0x330cfa-0x0;var _0x18a95d=_0x0f4b[_0x330cfa];return _0x18a95d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x489696){return this[_0xb0f4('0x0')](_0xb0f4('0x1'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xb0f4('0x2')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 7760c7b..e022fe9 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(_0x30578d,_0x1d8f12){var _0x553fee=function(_0xa3c14e){while(--_0xa3c14e){_0x30578d['push'](_0x30578d['shift']());}};_0x553fee(++_0x1d8f12);}(_0x7a54,0x106));var _0x47a5=function(_0x3881f3,_0x156233){_0x3881f3=_0x3881f3-0x0;var _0x306c82=_0x7a54[_0x3881f3];return _0x306c82;};'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 _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(_0xccdab4,_0x301af7){var _0x2bec21=function(_0xe67061){while(--_0xe67061){_0xccdab4['push'](_0xccdab4['shift']());}};_0x2bec21(++_0x301af7);}(_0x7a54,0x106));var _0x47a5=function(_0x5b6ac1,_0x36ce0b){_0x5b6ac1=_0x5b6ac1-0x0;var _0xb87be=_0x7a54[_0x5b6ac1];return _0xb87be;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 8098096..dd6ab27 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 _0x01b5=['path','rimraf','../../config/environment','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b4b5d,_0x4e0e39){var _0x33c48a=function(_0x458bb9){while(--_0x458bb9){_0x5b4b5d['push'](_0x5b4b5d['shift']());}};_0x33c48a(++_0x4e0e39);}(_0x01b5,0x1f1));var _0x501b=function(_0x2bac49,_0x3ae389){_0x2bac49=_0x2bac49-0x0;var _0x183acc=_0x01b5[_0x2bac49];return _0x183acc;};'use strict';var _=require(_0x501b('0x0'));var util=require(_0x501b('0x1'));var logger=require(_0x501b('0x2'))(_0x501b('0x3'));var moment=require(_0x501b('0x4'));var BPromise=require(_0x501b('0x5'));var rp=require(_0x501b('0x6'));var fs=require('fs');var path=require(_0x501b('0x7'));var rimraf=require(_0x501b('0x8'));var config=require(_0x501b('0x9'));var attributes=require('./condition.attributes');module[_0x501b('0xa')]=function(_0x15e334,_0x1f3203){return _0x15e334[_0x501b('0xb')](_0x501b('0xc'),attributes,{'tableName':_0x501b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d0d=['define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6d0d,0x121));var _0xd6d0=function(_0x29cece,_0x4e9344){_0x29cece=_0x29cece-0x0;var _0x2f5762=_0x6d0d[_0x29cece];return _0x2f5762;};'use strict';var _=require(_0xd6d0('0x0'));var util=require(_0xd6d0('0x1'));var logger=require(_0xd6d0('0x2'))(_0xd6d0('0x3'));var moment=require(_0xd6d0('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6d0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6d0('0x6'));var config=require(_0xd6d0('0x7'));var attributes=require('./condition.attributes');module['exports']=function(_0x2eb70e,_0x1d3524){return _0x2eb70e[_0xd6d0('0x8')](_0xd6d0('0x9'),attributes,{'tableName':_0xd6d0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 9450809..be3ace4 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 _0x1229=['message','result','lodash','util','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1229,0x16a));var _0x9122=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0x1229[_0x872b02];return _0x1a6b24;};'use strict';var _=require(_0x9122('0x0'));var util=require(_0x9122('0x1'));var moment=require('moment');var BPromise=require(_0x9122('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9122('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9122('0x4'));var logger=require('../../config/logger')(_0x9122('0x5'));var config=require('../../config/environment');var jayson=require(_0x9122('0x6'));var client=jayson[_0x9122('0x7')][_0x9122('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48c3b3,_0x2df074,_0x177441){return new BPromise(function(_0x31603e,_0x4b8d8b){return client['request'](_0x48c3b3,_0x177441)['then'](function(_0x330ff6){logger[_0x9122('0x9')](_0x9122('0xa'),_0x2df074,_0x9122('0xb'));logger[_0x9122('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0x2df074,_0x9122('0xb'),JSON[_0x9122('0xd')](_0x330ff6));if(_0x330ff6[_0x9122('0xe')]){if(_0x330ff6[_0x9122('0xe')][_0x9122('0xf')]===0x1f4){logger[_0x9122('0xe')](_0x9122('0xa'),_0x2df074,_0x330ff6[_0x9122('0xe')][_0x9122('0x10')]);return _0x4b8d8b(_0x330ff6[_0x9122('0xe')][_0x9122('0x10')]);}logger[_0x9122('0xe')](_0x9122('0xa'),_0x2df074,_0x330ff6[_0x9122('0xe')][_0x9122('0x10')]);return _0x31603e(_0x330ff6[_0x9122('0xe')][_0x9122('0x10')]);}else{logger[_0x9122('0x9')](_0x9122('0xa'),_0x2df074,_0x9122('0xb'));_0x31603e(_0x330ff6[_0x9122('0x11')][_0x9122('0x10')]);}})['catch'](function(_0x452fcf){logger[_0x9122('0xe')](_0x9122('0xa'),_0x2df074,_0x452fcf);_0x4b8d8b(_0x452fcf);});});} \ No newline at end of file +var _0xa409=['info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa409,0x74));var _0x9a40=function(_0x5cb821,_0x50e1d9){_0x5cb821=_0x5cb821-0x0;var _0x41bcbe=_0xa409[_0x5cb821];return _0x41bcbe;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9a40('0x0'));var BPromise=require(_0x9a40('0x1'));var rs=require(_0x9a40('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a40('0x3'))['db'];var utils=require(_0x9a40('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9a40('0x5'));var jayson=require(_0x9a40('0x6'));var client=jayson[_0x9a40('0x7')][_0x9a40('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fd26f,_0x9e1c84,_0x4f2c66){return new BPromise(function(_0x1f312b,_0x246a4c){return client[_0x9a40('0x9')](_0x3fd26f,_0x4f2c66)['then'](function(_0x4389c7){logger['info'](_0x9a40('0xa'),_0x9e1c84,'request\x20sent');logger[_0x9a40('0xb')](_0x9a40('0xc'),_0x9e1c84,_0x9a40('0xd'),JSON['stringify'](_0x4389c7));if(_0x4389c7[_0x9a40('0xe')]){if(_0x4389c7[_0x9a40('0xe')][_0x9a40('0xf')]===0x1f4){logger[_0x9a40('0xe')]('Condition,\x20%s,\x20%s',_0x9e1c84,_0x4389c7[_0x9a40('0xe')][_0x9a40('0x10')]);return _0x246a4c(_0x4389c7[_0x9a40('0xe')][_0x9a40('0x10')]);}logger[_0x9a40('0xe')]('Condition,\x20%s,\x20%s',_0x9e1c84,_0x4389c7[_0x9a40('0xe')]['message']);return _0x1f312b(_0x4389c7['error'][_0x9a40('0x10')]);}else{logger[_0x9a40('0x11')]('Condition,\x20%s,\x20%s',_0x9e1c84,'request\x20sent');_0x1f312b(_0x4389c7[_0x9a40('0x12')]['message']);}})['catch'](function(_0x3be366){logger[_0x9a40('0xe')]('Condition,\x20%s,\x20%s',_0x9e1c84,_0x3be366);_0x246a4c(_0x3be366);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3ed6e88..6e4fac7 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 _0x7f27=['fs-extra','../../config/environment','./condition.controller','put','update','delete','/:id','isAuthenticated','destroy','multer','util','path','connect-timeout','Router'];(function(_0x356f5f,_0x2ca65f){var _0x25edb6=function(_0x37bd61){while(--_0x37bd61){_0x356f5f['push'](_0x356f5f['shift']());}};_0x25edb6(++_0x2ca65f);}(_0x7f27,0x79));var _0x77f2=function(_0x541475,_0x24f497){_0x541475=_0x541475-0x0;var _0x47e967=_0x7f27[_0x541475];return _0x47e967;};'use strict';var multer=require(_0x77f2('0x0'));var util=require(_0x77f2('0x1'));var path=require(_0x77f2('0x2'));var timeout=require(_0x77f2('0x3'));var express=require('express');var router=express[_0x77f2('0x4')]();var fs_extra=require(_0x77f2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x77f2('0x6'));var controller=require(_0x77f2('0x7'));router[_0x77f2('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x77f2('0x9')]);router[_0x77f2('0xa')](_0x77f2('0xb'),auth[_0x77f2('0xc')](),controller[_0x77f2('0xd')]);module['exports']=router; \ No newline at end of file +var _0xa96f=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x288b02,_0x453dc8){var _0x1c21e2=function(_0x14d385){while(--_0x14d385){_0x288b02['push'](_0x288b02['shift']());}};_0x1c21e2(++_0x453dc8);}(_0xa96f,0x84));var _0xfa96=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xa96f[_0x361d3f];return _0x320229;};'use strict';var multer=require(_0xfa96('0x0'));var util=require(_0xfa96('0x1'));var path=require(_0xfa96('0x2'));var timeout=require(_0xfa96('0x3'));var express=require(_0xfa96('0x4'));var router=express[_0xfa96('0x5')]();var fs_extra=require(_0xfa96('0x6'));var auth=require(_0xfa96('0x7'));var interaction=require(_0xfa96('0x8'));var config=require(_0xfa96('0x9'));var controller=require(_0xfa96('0xa'));router[_0xfa96('0xb')](_0xfa96('0xc'),auth[_0xfa96('0xd')](),controller[_0xfa96('0xe')]);router[_0xfa96('0xf')](_0xfa96('0xc'),auth[_0xfa96('0xd')](),controller[_0xfa96('0x10')]);module[_0xfa96('0x11')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c454154..db91d62 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 _0xb1e8=['exports','STRING','name','sequelize'];(function(_0x534286,_0x2e4da2){var _0x5a7e30=function(_0x270ad6){while(--_0x270ad6){_0x534286['push'](_0x534286['shift']());}};_0x5a7e30(++_0x2e4da2);}(_0xb1e8,0x10b));var _0x8b1e=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0xb1e8[_0x3e5bc8];return _0xfd84bc;};'use strict';var Sequelize=require(_0x8b1e('0x0'));module[_0x8b1e('0x1')]={'name':{'type':Sequelize[_0x8b1e('0x2')],'allowNull':![],'unique':_0x8b1e('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x8b1e('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9d7f=['STRING','name','INTEGER','sequelize','exports'];(function(_0x32d743,_0xdb8714){var _0x1a6971=function(_0x2f9c87){while(--_0x2f9c87){_0x32d743['push'](_0x32d743['shift']());}};_0x1a6971(++_0xdb8714);}(_0x9d7f,0x9e));var _0xf9d7=function(_0x5d9fdf,_0x4bbefa){_0x5d9fdf=_0x5d9fdf-0x0;var _0x361769=_0x9d7f[_0x5d9fdf];return _0x361769;};'use strict';var Sequelize=require(_0xf9d7('0x0'));module[_0xf9d7('0x1')]={'name':{'type':Sequelize[_0xf9d7('0x2')],'allowNull':![],'unique':_0xf9d7('0x3')},'OrderBy':{'type':Sequelize[_0xf9d7('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf9d7('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 0725cec..27e3e87 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 _0xcf2f=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','ContactItemTypes','UserProfileResource','destroy','end','sendStatus','stack','name','send','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','ContactItemType','includeAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x5de533,_0x7444ba){var _0x26eec3=function(_0x2eba52){while(--_0x2eba52){_0x5de533['push'](_0x5de533['shift']());}};_0x26eec3(++_0x7444ba);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x59f222,_0x58ad12){_0x59f222=_0x59f222-0x0;var _0x458b00=_0xcf2f[_0x59f222];return _0x458b00;};'use strict';var emlformat=require(_0xfcf2('0x0'));var rimraf=require(_0xfcf2('0x1'));var zipdir=require(_0xfcf2('0x2'));var jsonpatch=require(_0xfcf2('0x3'));var rp=require(_0xfcf2('0x4'));var moment=require('moment');var BPromise=require(_0xfcf2('0x5'));var Mustache=require(_0xfcf2('0x6'));var util=require(_0xfcf2('0x7'));var path=require(_0xfcf2('0x8'));var sox=require(_0xfcf2('0x9'));var csv=require(_0xfcf2('0xa'));var ejs=require(_0xfcf2('0xb'));var fs=require('fs');var fs_extra=require(_0xfcf2('0xc'));var _=require(_0xfcf2('0xd'));var squel=require(_0xfcf2('0xe'));var crypto=require(_0xfcf2('0xf'));var jsforce=require(_0xfcf2('0x10'));var deskjs=require(_0xfcf2('0x11'));var toCsv=require(_0xfcf2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcf2('0x12'));var qs=require(_0xfcf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf2('0x14'));var logger=require(_0xfcf2('0x15'))(_0xfcf2('0x16'));var utils=require(_0xfcf2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcf2('0x18'))['db'];function respondWithStatusCode(_0x1ba610,_0x175ac9){_0x175ac9=_0x175ac9||0xcc;return function(_0x1be8cc){if(_0x1be8cc){return _0x1ba610['sendStatus'](_0x175ac9);}return _0x1ba610[_0xfcf2('0x19')](_0x175ac9)['end']();};}function respondWithResult(_0x5b414a,_0x5dc04b){_0x5dc04b=_0x5dc04b||0xc8;return function(_0xc87ff4){if(_0xc87ff4){return _0x5b414a['status'](_0x5dc04b)[_0xfcf2('0x1a')](_0xc87ff4);}};}function respondWithFilteredResult(_0x1febf8,_0x245f9a){return function(_0x21f7d1){if(_0x21f7d1){var _0x315b2f=typeof _0x245f9a[_0xfcf2('0x1b')]===_0xfcf2('0x1c')&&typeof _0x245f9a['limit']===_0xfcf2('0x1c');var _0x213125=_0x21f7d1[_0xfcf2('0x1d')];var _0x581d78=_0x315b2f?0x0:_0x245f9a[_0xfcf2('0x1b')];var _0x1b3c89=_0x315b2f?_0x21f7d1[_0xfcf2('0x1d')]:_0x245f9a[_0xfcf2('0x1b')]+_0x245f9a[_0xfcf2('0x1e')];var _0x53c406;if(_0x1b3c89>=_0x213125){_0x1b3c89=_0x213125;_0x53c406=0xc8;}else{_0x53c406=0xce;}_0x1febf8[_0xfcf2('0x19')](_0x53c406);return _0x1febf8[_0xfcf2('0x1f')]('Content-Range',_0x581d78+'-'+_0x1b3c89+'/'+_0x213125)[_0xfcf2('0x1a')](_0x21f7d1);}return null;};}function patchUpdates(_0x23c079){return function(_0x206738){try{jsonpatch[_0xfcf2('0x20')](_0x206738,_0x23c079,!![]);}catch(_0x51e0b7){return BPromise[_0xfcf2('0x21')](_0x51e0b7);}return _0x206738[_0xfcf2('0x22')]();};}function saveUpdates(_0x422c5a,_0x1eeebd){return function(_0x5afab5){if(_0x5afab5){return _0x5afab5[_0xfcf2('0x23')](_0x422c5a)[_0xfcf2('0x24')](function(_0x232f6f){return _0x232f6f;});}return null;};}function removeEntity(_0x584e76,_0x26641a){return function(_0x151aa8){if(_0x151aa8){return _0x151aa8['destroy']()[_0xfcf2('0x24')](function(){var _0xbc8722=_0x151aa8['get']({'plain':!![]});var _0x1e6f14=_0xfcf2('0x25');return db[_0xfcf2('0x26')][_0xfcf2('0x27')]({'where':{'type':_0x1e6f14,'resourceId':_0xbc8722['id']}})['then'](function(){return _0x151aa8;});})[_0xfcf2('0x24')](function(){_0x584e76[_0xfcf2('0x19')](0xcc)[_0xfcf2('0x28')]();});}};}function handleEntityNotFound(_0x3779ee,_0x17c994){return function(_0x2b1d60){if(!_0x2b1d60){_0x3779ee[_0xfcf2('0x29')](0x194);}return _0x2b1d60;};}function handleError(_0x1c8f38,_0x23c09c){_0x23c09c=_0x23c09c||0x1f4;return function(_0x56f839){logger['error'](_0x56f839[_0xfcf2('0x2a')]);if(_0x56f839[_0xfcf2('0x2b')]){delete _0x56f839[_0xfcf2('0x2b')];}_0x1c8f38['status'](_0x23c09c)[_0xfcf2('0x2c')](_0x56f839);};}exports['index']=function(_0x3ce9f8,_0x26651e){var _0x40c1ae={},_0x1a4485={},_0x313884={'count':0x0,'rows':[]};var _0x3760ad=_[_0xfcf2('0x2d')](db['ContactItemType']['rawAttributes'],function(_0xfc3b86){return{'name':_0xfc3b86[_0xfcf2('0x2e')],'type':_0xfc3b86[_0xfcf2('0x2f')][_0xfcf2('0x30')]};});_0x1a4485['model']=_['map'](_0x3760ad,_0xfcf2('0x2b'));_0x1a4485['query']=_[_0xfcf2('0x31')](_0x3ce9f8[_0xfcf2('0x32')]);_0x1a4485['filters']=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],_0x1a4485[_0xfcf2('0x32')]);_0x40c1ae[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x1a4485[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x3ce9f8['query'][_0xfcf2('0x36')]));_0x40c1ae[_0xfcf2('0x35')]=_0x40c1ae['attributes'][_0xfcf2('0x37')]?_0x40c1ae[_0xfcf2('0x35')]:_0x1a4485['model'];if(!_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x38')]('nolimit')){_0x40c1ae[_0xfcf2('0x1e')]=qs[_0xfcf2('0x1e')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1e')]);_0x40c1ae['offset']=qs[_0xfcf2('0x1b')](_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x1b')]);}_0x40c1ae[_0xfcf2('0x39')]=qs[_0xfcf2('0x3a')](_0x3ce9f8['query'][_0xfcf2('0x3a')]);_0x40c1ae[_0xfcf2('0x3b')]=qs[_0xfcf2('0x3c')](_[_0xfcf2('0x3d')](_0x3ce9f8[_0xfcf2('0x32')],_0x1a4485['filters']),_0x3760ad);if(_0x3ce9f8[_0xfcf2('0x32')]['filter']){_0x40c1ae[_0xfcf2('0x3b')]=_[_0xfcf2('0x3e')](_0x40c1ae[_0xfcf2('0x3b')],{'$or':_[_0xfcf2('0x2d')](_0x3760ad,function(_0x2fd2ef){if(_0x2fd2ef['type']!==_0xfcf2('0x3f')){var _0x341505={};_0x341505[_0x2fd2ef[_0xfcf2('0x2b')]]={'$like':'%'+_0x3ce9f8['query'][_0xfcf2('0x40')]+'%'};return _0x341505;}})});}_0x40c1ae=_[_0xfcf2('0x3e')]({},_0x40c1ae,_0x3ce9f8[_0xfcf2('0x41')]);var _0x320c19={'where':_0x40c1ae[_0xfcf2('0x3b')]};return db[_0xfcf2('0x42')]['count'](_0x320c19)['then'](function(_0x526c42){_0x313884[_0xfcf2('0x1d')]=_0x526c42;if(_0x3ce9f8[_0xfcf2('0x32')][_0xfcf2('0x43')]){_0x40c1ae['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x40c1ae);})[_0xfcf2('0x24')](function(_0xab0747){_0x313884[_0xfcf2('0x44')]=_0xab0747;return _0x313884;})[_0xfcf2('0x24')](respondWithFilteredResult(_0x26651e,_0x40c1ae))[_0xfcf2('0x45')](handleError(_0x26651e,null));};exports[_0xfcf2('0x46')]=function(_0x2c8ba2,_0x16cc21){var _0x2b790b={'raw':!![],'where':{'id':_0x2c8ba2[_0xfcf2('0x47')]['id']}},_0x467ecd={};_0x467ecd['model']=_['keys'](db[_0xfcf2('0x42')][_0xfcf2('0x48')]);_0x467ecd[_0xfcf2('0x32')]=_[_0xfcf2('0x31')](_0x2c8ba2[_0xfcf2('0x32')]);_0x467ecd[_0xfcf2('0x3c')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],_0x467ecd[_0xfcf2('0x32')]);_0x2b790b[_0xfcf2('0x35')]=_[_0xfcf2('0x33')](_0x467ecd[_0xfcf2('0x34')],qs[_0xfcf2('0x36')](_0x2c8ba2[_0xfcf2('0x32')][_0xfcf2('0x36')]));_0x2b790b[_0xfcf2('0x35')]=_0x2b790b[_0xfcf2('0x35')]['length']?_0x2b790b[_0xfcf2('0x35')]:_0x467ecd[_0xfcf2('0x34')];if(_0x2c8ba2['query'][_0xfcf2('0x43')]){_0x2b790b['include']=[{'all':!![]}];}_0x2b790b=_[_0xfcf2('0x3e')]({},_0x2b790b,_0x2c8ba2[_0xfcf2('0x41')]);return db[_0xfcf2('0x42')][_0xfcf2('0x49')](_0x2b790b)['then'](handleEntityNotFound(_0x16cc21,null))['then'](respondWithResult(_0x16cc21,null))['catch'](handleError(_0x16cc21,null));};exports[_0xfcf2('0x4a')]=function(_0x37d4bb,_0x20fcab){return db[_0xfcf2('0x42')]['create'](_0x37d4bb[_0xfcf2('0x4b')],{})[_0xfcf2('0x24')](function(_0x3b981c){var _0x548c6c=_0x37d4bb[_0xfcf2('0x4c')][_0xfcf2('0x4d')]({'plain':!![]});if(!_0x548c6c)throw new Error(_0xfcf2('0x4e'));if(_0x548c6c[_0xfcf2('0x4f')]===_0xfcf2('0x4c')){var _0x4af270=_0x3b981c[_0xfcf2('0x4d')]({'plain':!![]});var _0x1260a4=_0xfcf2('0x25');return db[_0xfcf2('0x50')][_0xfcf2('0x49')]({'where':{'name':_0x1260a4,'userProfileId':_0x548c6c[_0xfcf2('0x51')]},'raw':!![]})['then'](function(_0x5d162d){if(_0x5d162d&&_0x5d162d['autoAssociation']===0x0){return db[_0xfcf2('0x26')][_0xfcf2('0x4a')]({'name':_0x4af270['name'],'resourceId':_0x4af270['id'],'type':_0x5d162d['name'],'sectionId':_0x5d162d['id']},{})[_0xfcf2('0x24')](function(){return _0x3b981c;});}else{return _0x3b981c;}})[_0xfcf2('0x45')](function(_0x137a47){logger['error'](_0xfcf2('0x52'),_0x137a47);throw _0x137a47;});}return _0x3b981c;})[_0xfcf2('0x24')](respondWithResult(_0x20fcab,0xc9))['catch'](handleError(_0x20fcab,null));};exports['update']=function(_0xfc4b7b,_0x51f636){if(_0xfc4b7b[_0xfcf2('0x4b')]['id']){delete _0xfc4b7b[_0xfcf2('0x4b')]['id'];}return db['ContactItemType'][_0xfcf2('0x49')]({'where':{'id':_0xfc4b7b['params']['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x51f636,null))['then'](saveUpdates(_0xfc4b7b[_0xfcf2('0x4b')],null))[_0xfcf2('0x24')](respondWithResult(_0x51f636,null))[_0xfcf2('0x45')](handleError(_0x51f636,null));};exports['destroy']=function(_0x235b06,_0x27bae5){return db[_0xfcf2('0x42')][_0xfcf2('0x49')]({'where':{'id':_0x235b06[_0xfcf2('0x47')]['id']}})[_0xfcf2('0x24')](handleEntityNotFound(_0x27bae5,null))[_0xfcf2('0x24')](db['CmContactHasItem'][_0xfcf2('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x235b06[_0xfcf2('0x47')]['id']}}))['then'](removeEntity(_0x27bae5,null))[_0xfcf2('0x45')](handleError(_0x27bae5,null));}; \ No newline at end of file +var _0xe820=['name','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','ContactItemType','includeAll','include','findAll','params','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','CmContactHasItem','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','then','destroy','get','ContactItemTypes','stack'];(function(_0x2a6501,_0x9c5a0e){var _0x34d3ae=function(_0x204c8b){while(--_0x204c8b){_0x2a6501['push'](_0x2a6501['shift']());}};_0x34d3ae(++_0x9c5a0e);}(_0xe820,0xd2));var _0x0e82=function(_0xb0281e,_0x50b924){_0xb0281e=_0xb0281e-0x0;var _0x34544f=_0xe820[_0xb0281e];return _0x34544f;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];function respondWithStatusCode(_0x21c40b,_0x1da28a){_0x1da28a=_0x1da28a||0xcc;return function(_0x166dc2){if(_0x166dc2){return _0x21c40b[_0x0e82('0x18')](_0x1da28a);}return _0x21c40b['status'](_0x1da28a)[_0x0e82('0x19')]();};}function respondWithResult(_0x5c161c,_0x48d99b){_0x48d99b=_0x48d99b||0xc8;return function(_0x1e4ddb){if(_0x1e4ddb){return _0x5c161c['status'](_0x48d99b)['json'](_0x1e4ddb);}};}function respondWithFilteredResult(_0x5a2d28,_0x3298c7){return function(_0x4d1aa0){if(_0x4d1aa0){var _0x585b9b=typeof _0x3298c7[_0x0e82('0x1a')]==='undefined'&&typeof _0x3298c7[_0x0e82('0x1b')]===_0x0e82('0x1c');var _0x233c6d=_0x4d1aa0[_0x0e82('0x1d')];var _0x53622b=_0x585b9b?0x0:_0x3298c7[_0x0e82('0x1a')];var _0x310aac=_0x585b9b?_0x4d1aa0[_0x0e82('0x1d')]:_0x3298c7[_0x0e82('0x1a')]+_0x3298c7[_0x0e82('0x1b')];var _0x1230e6;if(_0x310aac>=_0x233c6d){_0x310aac=_0x233c6d;_0x1230e6=0xc8;}else{_0x1230e6=0xce;}_0x5a2d28[_0x0e82('0x1e')](_0x1230e6);return _0x5a2d28[_0x0e82('0x1f')](_0x0e82('0x20'),_0x53622b+'-'+_0x310aac+'/'+_0x233c6d)[_0x0e82('0x21')](_0x4d1aa0);}return null;};}function patchUpdates(_0x5903c){return function(_0x493280){try{jsonpatch['apply'](_0x493280,_0x5903c,!![]);}catch(_0x294696){return BPromise[_0x0e82('0x22')](_0x294696);}return _0x493280[_0x0e82('0x23')]();};}function saveUpdates(_0xb0a31,_0xd48046){return function(_0x1bdad4){if(_0x1bdad4){return _0x1bdad4[_0x0e82('0x24')](_0xb0a31)[_0x0e82('0x25')](function(_0x56b3ad){return _0x56b3ad;});}return null;};}function removeEntity(_0x1b71b4,_0x13f023){return function(_0x3d6c28){if(_0x3d6c28){return _0x3d6c28[_0x0e82('0x26')]()['then'](function(){var _0xee85dd=_0x3d6c28[_0x0e82('0x27')]({'plain':!![]});var _0x7a9399=_0x0e82('0x28');return db['UserProfileResource'][_0x0e82('0x26')]({'where':{'type':_0x7a9399,'resourceId':_0xee85dd['id']}})['then'](function(){return _0x3d6c28;});})['then'](function(){_0x1b71b4[_0x0e82('0x1e')](0xcc)[_0x0e82('0x19')]();});}};}function handleEntityNotFound(_0x4c5fc1,_0x19b96d){return function(_0xe3c530){if(!_0xe3c530){_0x4c5fc1[_0x0e82('0x18')](0x194);}return _0xe3c530;};}function handleError(_0x5ca9e3,_0x93d2f1){_0x93d2f1=_0x93d2f1||0x1f4;return function(_0x25fa4e){logger['error'](_0x25fa4e[_0x0e82('0x29')]);if(_0x25fa4e['name']){delete _0x25fa4e[_0x0e82('0x2a')];}_0x5ca9e3[_0x0e82('0x1e')](_0x93d2f1)['send'](_0x25fa4e);};}exports[_0x0e82('0x2b')]=function(_0x268af5,_0x661718){var _0x4d74d0={},_0x50adb7={},_0x2dc021={'count':0x0,'rows':[]};var _0x4a8c43=_[_0x0e82('0x2c')](db['ContactItemType'][_0x0e82('0x2d')],function(_0x264022){return{'name':_0x264022[_0x0e82('0x2e')],'type':_0x264022['type'][_0x0e82('0x2f')]};});_0x50adb7['model']=_[_0x0e82('0x2c')](_0x4a8c43,_0x0e82('0x2a'));_0x50adb7[_0x0e82('0x30')]=_[_0x0e82('0x31')](_0x268af5[_0x0e82('0x30')]);_0x50adb7[_0x0e82('0x32')]=_['intersection'](_0x50adb7[_0x0e82('0x33')],_0x50adb7[_0x0e82('0x30')]);_0x4d74d0[_0x0e82('0x34')]=_[_0x0e82('0x35')](_0x50adb7[_0x0e82('0x33')],qs[_0x0e82('0x36')](_0x268af5[_0x0e82('0x30')][_0x0e82('0x36')]));_0x4d74d0[_0x0e82('0x34')]=_0x4d74d0[_0x0e82('0x34')][_0x0e82('0x37')]?_0x4d74d0[_0x0e82('0x34')]:_0x50adb7[_0x0e82('0x33')];if(!_0x268af5[_0x0e82('0x30')][_0x0e82('0x38')]('nolimit')){_0x4d74d0[_0x0e82('0x1b')]=qs[_0x0e82('0x1b')](_0x268af5[_0x0e82('0x30')][_0x0e82('0x1b')]);_0x4d74d0['offset']=qs[_0x0e82('0x1a')](_0x268af5[_0x0e82('0x30')]['offset']);}_0x4d74d0[_0x0e82('0x39')]=qs['sort'](_0x268af5['query'][_0x0e82('0x3a')]);_0x4d74d0[_0x0e82('0x3b')]=qs[_0x0e82('0x32')](_[_0x0e82('0x3c')](_0x268af5[_0x0e82('0x30')],_0x50adb7[_0x0e82('0x32')]),_0x4a8c43);if(_0x268af5[_0x0e82('0x30')]['filter']){_0x4d74d0['where']=_[_0x0e82('0x3d')](_0x4d74d0[_0x0e82('0x3b')],{'$or':_[_0x0e82('0x2c')](_0x4a8c43,function(_0x135c1b){if(_0x135c1b[_0x0e82('0x3e')]!==_0x0e82('0x3f')){var _0x2abed6={};_0x2abed6[_0x135c1b[_0x0e82('0x2a')]]={'$like':'%'+_0x268af5['query'][_0x0e82('0x40')]+'%'};return _0x2abed6;}})});}_0x4d74d0=_[_0x0e82('0x3d')]({},_0x4d74d0,_0x268af5[_0x0e82('0x41')]);var _0x417389={'where':_0x4d74d0[_0x0e82('0x3b')]};return db[_0x0e82('0x42')][_0x0e82('0x1d')](_0x417389)['then'](function(_0x311cb8){_0x2dc021[_0x0e82('0x1d')]=_0x311cb8;if(_0x268af5[_0x0e82('0x30')][_0x0e82('0x43')]){_0x4d74d0[_0x0e82('0x44')]=[{'all':!![]}];}return db[_0x0e82('0x42')][_0x0e82('0x45')](_0x4d74d0);})['then'](function(_0x581764){_0x2dc021['rows']=_0x581764;return _0x2dc021;})['then'](respondWithFilteredResult(_0x661718,_0x4d74d0))['catch'](handleError(_0x661718,null));};exports['show']=function(_0x651c76,_0x182333){var _0x3d37e8={'raw':!![],'where':{'id':_0x651c76[_0x0e82('0x46')]['id']}},_0x199495={};_0x199495[_0x0e82('0x33')]=_[_0x0e82('0x31')](db[_0x0e82('0x42')]['rawAttributes']);_0x199495['query']=_[_0x0e82('0x31')](_0x651c76[_0x0e82('0x30')]);_0x199495[_0x0e82('0x32')]=_[_0x0e82('0x35')](_0x199495[_0x0e82('0x33')],_0x199495[_0x0e82('0x30')]);_0x3d37e8[_0x0e82('0x34')]=_[_0x0e82('0x35')](_0x199495['model'],qs[_0x0e82('0x36')](_0x651c76['query'][_0x0e82('0x36')]));_0x3d37e8['attributes']=_0x3d37e8[_0x0e82('0x34')]['length']?_0x3d37e8[_0x0e82('0x34')]:_0x199495[_0x0e82('0x33')];if(_0x651c76[_0x0e82('0x30')]['includeAll']){_0x3d37e8['include']=[{'all':!![]}];}_0x3d37e8=_[_0x0e82('0x3d')]({},_0x3d37e8,_0x651c76[_0x0e82('0x41')]);return db[_0x0e82('0x42')]['find'](_0x3d37e8)[_0x0e82('0x25')](handleEntityNotFound(_0x182333,null))['then'](respondWithResult(_0x182333,null))[_0x0e82('0x47')](handleError(_0x182333,null));};exports[_0x0e82('0x48')]=function(_0x162890,_0x64406e){return db[_0x0e82('0x42')][_0x0e82('0x48')](_0x162890[_0x0e82('0x49')],{})[_0x0e82('0x25')](function(_0x1bd904){var _0x287abc=_0x162890[_0x0e82('0x4a')][_0x0e82('0x27')]({'plain':!![]});if(!_0x287abc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x287abc[_0x0e82('0x4b')]===_0x0e82('0x4a')){var _0x576726=_0x1bd904[_0x0e82('0x27')]({'plain':!![]});var _0x5f4fbc='ContactItemTypes';return db[_0x0e82('0x4c')]['find']({'where':{'name':_0x5f4fbc,'userProfileId':_0x287abc[_0x0e82('0x4d')]},'raw':!![]})[_0x0e82('0x25')](function(_0x1ed324){if(_0x1ed324&&_0x1ed324[_0x0e82('0x4e')]===0x0){return db[_0x0e82('0x4f')]['create']({'name':_0x576726[_0x0e82('0x2a')],'resourceId':_0x576726['id'],'type':_0x1ed324['name'],'sectionId':_0x1ed324['id']},{})[_0x0e82('0x25')](function(){return _0x1bd904;});}else{return _0x1bd904;}})[_0x0e82('0x47')](function(_0x42c4a7){logger[_0x0e82('0x50')](_0x0e82('0x51'),_0x42c4a7);throw _0x42c4a7;});}return _0x1bd904;})['then'](respondWithResult(_0x64406e,0xc9))[_0x0e82('0x47')](handleError(_0x64406e,null));};exports[_0x0e82('0x24')]=function(_0x183808,_0x4546bd){if(_0x183808[_0x0e82('0x49')]['id']){delete _0x183808['body']['id'];}return db[_0x0e82('0x42')][_0x0e82('0x52')]({'where':{'id':_0x183808[_0x0e82('0x46')]['id']}})[_0x0e82('0x25')](handleEntityNotFound(_0x4546bd,null))[_0x0e82('0x25')](saveUpdates(_0x183808[_0x0e82('0x49')],null))[_0x0e82('0x25')](respondWithResult(_0x4546bd,null))[_0x0e82('0x47')](handleError(_0x4546bd,null));};exports[_0x0e82('0x26')]=function(_0x2852d4,_0x4cc3fd){return db['ContactItemType']['find']({'where':{'id':_0x2852d4[_0x0e82('0x46')]['id']}})['then'](handleEntityNotFound(_0x4cc3fd,null))[_0x0e82('0x25')](db[_0x0e82('0x53')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x2852d4['params']['id']}}))[_0x0e82('0x25')](removeEntity(_0x4cc3fd,null))[_0x0e82('0x47')](handleError(_0x4cc3fd,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 9162159..a332f0d 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 _0x7085=['./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x4c9e17,_0x4b849d){var _0x51146e=function(_0x23fa07){while(--_0x23fa07){_0x4c9e17['push'](_0x4c9e17['shift']());}};_0x51146e(++_0x4b849d);}(_0x7085,0x125));var _0x5708=function(_0x5a70a2,_0xf1e7f9){_0x5a70a2=_0x5a70a2-0x0;var _0x1c88fd=_0x7085[_0x5a70a2];return _0x1c88fd;};'use strict';var _=require(_0x5708('0x0'));var util=require(_0x5708('0x1'));var logger=require(_0x5708('0x2'))(_0x5708('0x3'));var moment=require('moment');var BPromise=require(_0x5708('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5708('0x5'));var rimraf=require('rimraf');var config=require(_0x5708('0x6'));var attributes=require(_0x5708('0x7'));module[_0x5708('0x8')]=function(_0x5c5c6b,_0x16c771){return _0x5c5c6b[_0x5708('0x9')](_0x5708('0xa'),attributes,{'tableName':_0x5708('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7646=['request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util','api','moment','bluebird'];(function(_0x57f4db,_0x364765){var _0x810bc1=function(_0x24e470){while(--_0x24e470){_0x57f4db['push'](_0x57f4db['shift']());}};_0x810bc1(++_0x364765);}(_0x7646,0x174));var _0x6764=function(_0x5684ec,_0x297da6){_0x5684ec=_0x5684ec-0x0;var _0x3d0e3b=_0x7646[_0x5684ec];return _0x3d0e3b;};'use strict';var _=require(_0x6764('0x0'));var util=require(_0x6764('0x1'));var logger=require('../../config/logger')(_0x6764('0x2'));var moment=require(_0x6764('0x3'));var BPromise=require(_0x6764('0x4'));var rp=require(_0x6764('0x5'));var fs=require('fs');var path=require(_0x6764('0x6'));var rimraf=require(_0x6764('0x7'));var config=require(_0x6764('0x8'));var attributes=require(_0x6764('0x9'));module['exports']=function(_0x3ee9a8,_0x3fdad5){return _0x3ee9a8[_0x6764('0xa')](_0x6764('0xb'),attributes,{'tableName':_0x6764('0xc'),'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 814e439..b4c6d15 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 _0x55ab=['request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xd4210,_0x25623d){var _0x264dee=function(_0x37fc7c){while(--_0x37fc7c){_0xd4210['push'](_0xd4210['shift']());}};_0x264dee(++_0x25623d);}(_0x55ab,0xc8));var _0xb55a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x55ab[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb55a('0x0'));var rs=require(_0xb55a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb55a('0x2'))['db'];var utils=require(_0xb55a('0x3'));var logger=require(_0xb55a('0x4'))(_0xb55a('0x5'));var config=require(_0xb55a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb55a('0x7')][_0xb55a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e4f38,_0x523ea3,_0x4f2cf8){return new BPromise(function(_0x46e405,_0x3e38e5){return client[_0xb55a('0x9')](_0x3e4f38,_0x4f2cf8)[_0xb55a('0xa')](function(_0x5abe16){logger[_0xb55a('0xb')](_0xb55a('0xc'),_0x523ea3,_0xb55a('0xd'));logger[_0xb55a('0xe')](_0xb55a('0xf'),_0x523ea3,_0xb55a('0xd'),JSON['stringify'](_0x5abe16));if(_0x5abe16[_0xb55a('0x10')]){if(_0x5abe16[_0xb55a('0x10')][_0xb55a('0x11')]===0x1f4){logger[_0xb55a('0x10')](_0xb55a('0xc'),_0x523ea3,_0x5abe16[_0xb55a('0x10')][_0xb55a('0x12')]);return _0x3e38e5(_0x5abe16[_0xb55a('0x10')][_0xb55a('0x12')]);}logger[_0xb55a('0x10')]('ContactItemType,\x20%s,\x20%s',_0x523ea3,_0x5abe16['error'][_0xb55a('0x12')]);return _0x46e405(_0x5abe16[_0xb55a('0x10')][_0xb55a('0x12')]);}else{logger[_0xb55a('0xb')](_0xb55a('0xc'),_0x523ea3,_0xb55a('0xd'));_0x46e405(_0x5abe16['result'][_0xb55a('0x12')]);}})['catch'](function(_0x4765dc){logger[_0xb55a('0x10')](_0xb55a('0xc'),_0x523ea3,_0x4765dc);_0x3e38e5(_0x4765dc);});});} \ No newline at end of file +var _0xa2d5=['../../config/environment','jayson/promise','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa2d5,0x70));var _0x5a2d=function(_0x1cb347,_0x3871b5){_0x1cb347=_0x1cb347-0x0;var _0x4bebec=_0xa2d5[_0x1cb347];return _0x4bebec;};'use strict';var _=require(_0x5a2d('0x0'));var util=require(_0x5a2d('0x1'));var moment=require('moment');var BPromise=require(_0x5a2d('0x2'));var rs=require(_0x5a2d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a2d('0x4'))['db'];var utils=require(_0x5a2d('0x5'));var logger=require(_0x5a2d('0x6'))(_0x5a2d('0x7'));var config=require(_0x5a2d('0x8'));var jayson=require(_0x5a2d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xda5f50,_0x1ab9ce,_0x26834b){return new BPromise(function(_0x5b5312,_0x1e67e8){return client['request'](_0xda5f50,_0x26834b)[_0x5a2d('0xa')](function(_0x2ac904){logger[_0x5a2d('0xb')](_0x5a2d('0xc'),_0x1ab9ce,_0x5a2d('0xd'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1ab9ce,_0x5a2d('0xd'),JSON[_0x5a2d('0xe')](_0x2ac904));if(_0x2ac904[_0x5a2d('0xf')]){if(_0x2ac904[_0x5a2d('0xf')][_0x5a2d('0x10')]===0x1f4){logger[_0x5a2d('0xf')](_0x5a2d('0xc'),_0x1ab9ce,_0x2ac904[_0x5a2d('0xf')]['message']);return _0x1e67e8(_0x2ac904[_0x5a2d('0xf')][_0x5a2d('0x11')]);}logger[_0x5a2d('0xf')](_0x5a2d('0xc'),_0x1ab9ce,_0x2ac904[_0x5a2d('0xf')][_0x5a2d('0x11')]);return _0x5b5312(_0x2ac904[_0x5a2d('0xf')][_0x5a2d('0x11')]);}else{logger['info'](_0x5a2d('0xc'),_0x1ab9ce,_0x5a2d('0xd'));_0x5b5312(_0x2ac904[_0x5a2d('0x12')]['message']);}})[_0x5a2d('0x13')](function(_0x1ffcf5){logger[_0x5a2d('0xf')](_0x5a2d('0xc'),_0x1ab9ce,_0x1ffcf5);_0x1e67e8(_0x1ffcf5);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index fc98e39..778d42c 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 _0x3d4b=['put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x5a3298,_0x3ed269){var _0x5b3583=function(_0x221152){while(--_0x221152){_0x5a3298['push'](_0x5a3298['shift']());}};_0x5b3583(++_0x3ed269);}(_0x3d4b,0xf1));var _0xb3d4=function(_0x23c89d,_0x1a8b99){_0x23c89d=_0x23c89d-0x0;var _0x4db932=_0x3d4b[_0x23c89d];return _0x4db932;};'use strict';var multer=require('multer');var util=require(_0xb3d4('0x0'));var path=require('path');var timeout=require(_0xb3d4('0x1'));var express=require(_0xb3d4('0x2'));var router=express[_0xb3d4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb3d4('0x4'));var interaction=require(_0xb3d4('0x5'));var config=require(_0xb3d4('0x6'));var controller=require(_0xb3d4('0x7'));router[_0xb3d4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb3d4('0x8')](_0xb3d4('0x9'),auth[_0xb3d4('0xa')](),controller[_0xb3d4('0xb')]);router[_0xb3d4('0xc')]('/',auth[_0xb3d4('0xa')](),controller[_0xb3d4('0xd')]);router[_0xb3d4('0xe')](_0xb3d4('0x9'),auth[_0xb3d4('0xa')](),controller['update']);router[_0xb3d4('0xf')](_0xb3d4('0x9'),auth['isAuthenticated'](),controller[_0xb3d4('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa70b=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','create','put','update','/:id','destroy','util'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0xa70b,0x7d));var _0xba70=function(_0x20afc3,_0x2f189a){_0x20afc3=_0x20afc3-0x0;var _0x4cbb43=_0xa70b[_0x20afc3];return _0x4cbb43;};'use strict';var multer=require('multer');var util=require(_0xba70('0x0'));var path=require(_0xba70('0x1'));var timeout=require(_0xba70('0x2'));var express=require(_0xba70('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xba70('0x4'));var interaction=require(_0xba70('0x5'));var config=require(_0xba70('0x6'));var controller=require(_0xba70('0x7'));router[_0xba70('0x8')]('/',auth[_0xba70('0x9')](),controller[_0xba70('0xa')]);router[_0xba70('0x8')]('/:id',auth[_0xba70('0x9')](),controller[_0xba70('0xb')]);router[_0xba70('0xc')]('/',auth[_0xba70('0x9')](),controller[_0xba70('0xd')]);router[_0xba70('0xe')]('/:id',auth[_0xba70('0x9')](),controller[_0xba70('0xf')]);router['delete'](_0xba70('0x10'),auth[_0xba70('0x9')](),controller[_0xba70('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 7abcf10..d19cd98 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(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xb7e7,0x121));var _0x7b7e=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xb7e7[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x52391e,_0x3b7ad8){var _0x2df8c4=function(_0x191e27){while(--_0x191e27){_0x52391e['push'](_0x52391e['shift']());}};_0x2df8c4(++_0x3b7ad8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index cff0268..82d60cd 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 _0x1f01=['merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','attrEmailAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','CustomDashboards','end','error','stack','name','send','index','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x99f08d,_0x3a5708){var _0x255b15=function(_0x406d87){while(--_0x406d87){_0x99f08d['push'](_0x99f08d['shift']());}};_0x255b15(++_0x3a5708);}(_0x1f01,0x1d9));var _0x11f0=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x1f01[_0x38c699];return _0x3b1ded;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x11f0('0x0'));var zipdir=require(_0x11f0('0x1'));var jsonpatch=require(_0x11f0('0x2'));var rp=require(_0x11f0('0x3'));var moment=require(_0x11f0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x11f0('0x5'));var path=require(_0x11f0('0x6'));var sox=require(_0x11f0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11f0('0x8'));var _=require(_0x11f0('0x9'));var squel=require(_0x11f0('0xa'));var crypto=require(_0x11f0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x11f0('0xc'));var toCsv=require(_0x11f0('0xd'));var querystring=require(_0x11f0('0xe'));var Papa=require(_0x11f0('0xf'));var Redis=require(_0x11f0('0x10'));var authService=require(_0x11f0('0x11'));var qs=require(_0x11f0('0x12'));var as=require(_0x11f0('0x13'));var hardwareService=require(_0x11f0('0x14'));var logger=require('../../config/logger')(_0x11f0('0x15'));var utils=require(_0x11f0('0x16'));var config=require(_0x11f0('0x17'));var licenseUtil=require(_0x11f0('0x18'));var db=require(_0x11f0('0x19'))['db'];config[_0x11f0('0x1a')]=_[_0x11f0('0x1b')](config[_0x11f0('0x1a')],{'host':_0x11f0('0x1c'),'port':0x18eb});var socket=require(_0x11f0('0x1d'))(new Redis(config['redis']));require(_0x11f0('0x1e'))[_0x11f0('0x1f')](socket);function respondWithStatusCode(_0x1ea769,_0x190bb2){_0x190bb2=_0x190bb2||0xcc;return function(_0x1b17dc){if(_0x1b17dc){return _0x1ea769[_0x11f0('0x20')](_0x190bb2);}return _0x1ea769['status'](_0x190bb2)['end']();};}function respondWithResult(_0x428014,_0x3182b5){_0x3182b5=_0x3182b5||0xc8;return function(_0x4817fe){if(_0x4817fe){return _0x428014[_0x11f0('0x21')](_0x3182b5)[_0x11f0('0x22')](_0x4817fe);}};}function respondWithFilteredResult(_0x3e5591,_0x4b867d){return function(_0x5eebd3){if(_0x5eebd3){var _0x10b54d=typeof _0x4b867d[_0x11f0('0x23')]===_0x11f0('0x24')&&typeof _0x4b867d[_0x11f0('0x25')]===_0x11f0('0x24');var _0x28f00d=_0x5eebd3[_0x11f0('0x26')];var _0x5e83e3=_0x10b54d?0x0:_0x4b867d[_0x11f0('0x23')];var _0x33aab5=_0x10b54d?_0x5eebd3[_0x11f0('0x26')]:_0x4b867d[_0x11f0('0x23')]+_0x4b867d['limit'];var _0x5c6898;if(_0x33aab5>=_0x28f00d){_0x33aab5=_0x28f00d;_0x5c6898=0xc8;}else{_0x5c6898=0xce;}_0x3e5591['status'](_0x5c6898);return _0x3e5591['set'](_0x11f0('0x27'),_0x5e83e3+'-'+_0x33aab5+'/'+_0x28f00d)[_0x11f0('0x22')](_0x5eebd3);}return null;};}function patchUpdates(_0xc50271){return function(_0x454078){try{jsonpatch[_0x11f0('0x28')](_0x454078,_0xc50271,!![]);}catch(_0x512742){return BPromise[_0x11f0('0x29')](_0x512742);}return _0x454078[_0x11f0('0x2a')]();};}function saveUpdates(_0x379a8e,_0x34b81a){return function(_0x508e11){if(_0x508e11){return _0x508e11['update'](_0x379a8e)[_0x11f0('0x2b')](function(_0x1b8bd7){return _0x1b8bd7;});}return null;};}function removeEntity(_0x114d2e,_0x133e64){return function(_0x3bacfa){if(_0x3bacfa){return _0x3bacfa[_0x11f0('0x2c')]()[_0x11f0('0x2b')](function(){var _0x2170db=_0x3bacfa['get']({'plain':!![]});var _0x8afa9c=_0x11f0('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x8afa9c,'resourceId':_0x2170db['id']}})[_0x11f0('0x2b')](function(){return _0x3bacfa;});})[_0x11f0('0x2b')](function(){_0x114d2e['status'](0xcc)[_0x11f0('0x2e')]();});}};}function handleEntityNotFound(_0x9b32c8,_0x5273dc){return function(_0x1ab674){if(!_0x1ab674){_0x9b32c8[_0x11f0('0x20')](0x194);}return _0x1ab674;};}function handleError(_0x2ffa5a,_0x4a7b97){_0x4a7b97=_0x4a7b97||0x1f4;return function(_0x1b6cd5){logger[_0x11f0('0x2f')](_0x1b6cd5[_0x11f0('0x30')]);if(_0x1b6cd5[_0x11f0('0x31')]){delete _0x1b6cd5[_0x11f0('0x31')];}_0x2ffa5a['status'](_0x4a7b97)[_0x11f0('0x32')](_0x1b6cd5);};}exports[_0x11f0('0x33')]=function(_0x5a2bc9,_0x5e6bb6){var _0x220e1a={},_0x546340={},_0x2c57df={'count':0x0,'rows':[]};var _0x798d86=_['map'](db[_0x11f0('0x34')]['rawAttributes'],function(_0x3b7fa5){return{'name':_0x3b7fa5[_0x11f0('0x35')],'type':_0x3b7fa5[_0x11f0('0x36')][_0x11f0('0x37')]};});_0x546340[_0x11f0('0x38')]=_['map'](_0x798d86,'name');_0x546340[_0x11f0('0x39')]=_[_0x11f0('0x3a')](_0x5a2bc9[_0x11f0('0x39')]);_0x546340[_0x11f0('0x3b')]=_['intersection'](_0x546340[_0x11f0('0x38')],_0x546340[_0x11f0('0x39')]);_0x220e1a['attributes']=_[_0x11f0('0x3c')](_0x546340['model'],qs[_0x11f0('0x3d')](_0x5a2bc9[_0x11f0('0x39')][_0x11f0('0x3d')]));_0x220e1a['attributes']=_0x220e1a[_0x11f0('0x3e')][_0x11f0('0x3f')]?_0x220e1a[_0x11f0('0x3e')]:_0x546340[_0x11f0('0x38')];if(!_0x5a2bc9[_0x11f0('0x39')][_0x11f0('0x40')](_0x11f0('0x41'))){_0x220e1a[_0x11f0('0x25')]=qs[_0x11f0('0x25')](_0x5a2bc9['query'][_0x11f0('0x25')]);_0x220e1a['offset']=qs[_0x11f0('0x23')](_0x5a2bc9[_0x11f0('0x39')][_0x11f0('0x23')]);}_0x220e1a[_0x11f0('0x42')]=qs[_0x11f0('0x43')](_0x5a2bc9['query']['sort']);_0x220e1a['where']=qs['filters'](_[_0x11f0('0x44')](_0x5a2bc9[_0x11f0('0x39')],_0x546340[_0x11f0('0x3b')]),_0x798d86);if(_0x5a2bc9[_0x11f0('0x39')][_0x11f0('0x45')]){_0x220e1a[_0x11f0('0x46')]=_[_0x11f0('0x47')](_0x220e1a[_0x11f0('0x46')],{'$or':_['map'](_0x798d86,function(_0xa0a3d6){if(_0xa0a3d6['type']!=='VIRTUAL'){var _0x1e7e0a={};_0x1e7e0a[_0xa0a3d6['name']]={'$like':'%'+_0x5a2bc9[_0x11f0('0x39')][_0x11f0('0x45')]+'%'};return _0x1e7e0a;}})});}_0x220e1a=_[_0x11f0('0x47')]({},_0x220e1a,_0x5a2bc9[_0x11f0('0x48')]);var _0x1186b6={'where':_0x220e1a['where']};return db[_0x11f0('0x34')][_0x11f0('0x26')](_0x1186b6)['then'](function(_0x2a76a4){_0x2c57df[_0x11f0('0x26')]=_0x2a76a4;if(_0x5a2bc9['query'][_0x11f0('0x49')]){_0x220e1a[_0x11f0('0x4a')]=[{'all':!![]}];}return db[_0x11f0('0x34')][_0x11f0('0x4b')](_0x220e1a);})[_0x11f0('0x2b')](function(_0x53a4ac){_0x2c57df[_0x11f0('0x4c')]=_0x53a4ac;return _0x2c57df;})[_0x11f0('0x2b')](respondWithFilteredResult(_0x5e6bb6,_0x220e1a))[_0x11f0('0x4d')](handleError(_0x5e6bb6,null));};exports[_0x11f0('0x4e')]=function(_0x31c3c6,_0x5cd41d){var _0x5418b2={'raw':![],'where':{'id':_0x31c3c6['params']['id']}},_0x5df3f8={};_0x5df3f8[_0x11f0('0x38')]=_[_0x11f0('0x3a')](db[_0x11f0('0x34')][_0x11f0('0x4f')]);_0x5df3f8[_0x11f0('0x39')]=_[_0x11f0('0x3a')](_0x31c3c6['query']);_0x5df3f8[_0x11f0('0x3b')]=_[_0x11f0('0x3c')](_0x5df3f8[_0x11f0('0x38')],_0x5df3f8[_0x11f0('0x39')]);_0x5418b2[_0x11f0('0x3e')]=_[_0x11f0('0x3c')](_0x5df3f8[_0x11f0('0x38')],qs['fields'](_0x31c3c6[_0x11f0('0x39')][_0x11f0('0x3d')]));_0x5418b2[_0x11f0('0x3e')]=_0x5418b2[_0x11f0('0x3e')][_0x11f0('0x3f')]?_0x5418b2[_0x11f0('0x3e')]:_0x5df3f8[_0x11f0('0x38')];if(_0x31c3c6[_0x11f0('0x39')][_0x11f0('0x49')]){_0x5418b2['include']=[{'all':!![]}];}_0x5418b2=_[_0x11f0('0x47')]({},_0x5418b2,_0x31c3c6[_0x11f0('0x48')]);return db['Dashboard']['find'](_0x5418b2)[_0x11f0('0x2b')](handleEntityNotFound(_0x5cd41d,null))['then'](respondWithResult(_0x5cd41d,null))[_0x11f0('0x4d')](handleError(_0x5cd41d,null));};exports['create']=function(_0x915566,_0x18a6e9){return db[_0x11f0('0x34')][_0x11f0('0x50')](_0x915566[_0x11f0('0x51')],{})['then'](function(_0x33f950){var _0x4ff3a4=_0x915566[_0x11f0('0x52')][_0x11f0('0x53')]({'plain':!![]});if(!_0x4ff3a4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ff3a4[_0x11f0('0x54')]===_0x11f0('0x52')){var _0x497f12=_0x33f950[_0x11f0('0x53')]({'plain':!![]});var _0x5cd2fe='CustomDashboards';return db[_0x11f0('0x55')][_0x11f0('0x56')]({'where':{'name':_0x5cd2fe,'userProfileId':_0x4ff3a4[_0x11f0('0x57')]},'raw':!![]})[_0x11f0('0x2b')](function(_0x50e02e){if(_0x50e02e&&_0x50e02e[_0x11f0('0x58')]===0x0){return db[_0x11f0('0x59')][_0x11f0('0x50')]({'name':_0x497f12[_0x11f0('0x31')],'resourceId':_0x497f12['id'],'type':_0x50e02e[_0x11f0('0x31')],'sectionId':_0x50e02e['id']},{})[_0x11f0('0x2b')](function(){return _0x33f950;});}else{return _0x33f950;}})[_0x11f0('0x4d')](function(_0x141c3a){logger[_0x11f0('0x2f')](_0x11f0('0x5a'),_0x141c3a);throw _0x141c3a;});}return _0x33f950;})[_0x11f0('0x2b')](respondWithResult(_0x18a6e9,0xc9))[_0x11f0('0x4d')](handleError(_0x18a6e9,null));};exports[_0x11f0('0x5b')]=function(_0x15d109,_0x550f53){var _0xa9e83a={'where':{'id':_0x15d109[_0x11f0('0x5c')]['id']}},_0x3cb5ee={};_0x3cb5ee[_0x11f0('0x38')]=_['keys'](db[_0x11f0('0x34')]['rawAttributes']);_0xa9e83a[_0x11f0('0x3e')]=_[_0x11f0('0x3c')](_0x3cb5ee['model'],qs[_0x11f0('0x3d')](_0x15d109['query']['fields']));_0xa9e83a[_0x11f0('0x3e')]=_0xa9e83a[_0x11f0('0x3e')]['length']?_0xa9e83a[_0x11f0('0x3e')]:_0x3cb5ee[_0x11f0('0x38')];if(_0x15d109[_0x11f0('0x39')][_0x11f0('0x49')]){_0xa9e83a['include']=[{'all':!![]}];}_0xa9e83a=_[_0x11f0('0x47')]({},_0xa9e83a,_0x15d109['options']);return db[_0x11f0('0x34')][_0x11f0('0x56')](_0xa9e83a)[_0x11f0('0x2b')](handleEntityNotFound(_0x550f53,null))['then'](function(_0x180a7f){if(_0x180a7f){var _0x50b658=_0x180a7f[_0x11f0('0x53')]({'plain':!![]});_0x50b658=qs[_0x11f0('0x5d')](_0x50b658,['id',_0x11f0('0x5e'),_0x11f0('0x5f')]);_0x15d109[_0x11f0('0x51')]=_[_0x11f0('0x5d')](_0x15d109[_0x11f0('0x51')],['id',_0x11f0('0x5e'),'updatedAt']);return db['Dashboard'][_0x11f0('0x50')](_['merge'](_0x50b658,_0x15d109[_0x11f0('0x51')]),{'include':_0x15d109[_0x11f0('0x39')][_0x11f0('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x162ebd){var _0x12fc0f=_0x15d109[_0x11f0('0x52')][_0x11f0('0x53')]({'plain':!![]});if(!_0x12fc0f)throw new Error(_0x11f0('0x60'));if(_0x12fc0f[_0x11f0('0x54')]===_0x11f0('0x52')){var _0x47f018=_0x162ebd[_0x11f0('0x53')]({'plain':!![]});var _0x33886e=_0x11f0('0x2d');return db[_0x11f0('0x55')][_0x11f0('0x56')]({'where':{'name':_0x33886e,'userProfileId':_0x12fc0f['userProfileId']},'raw':!![]})[_0x11f0('0x2b')](function(_0x818aaf){if(_0x818aaf&&_0x818aaf[_0x11f0('0x58')]===0x0){return db[_0x11f0('0x59')][_0x11f0('0x50')]({'name':_0x47f018[_0x11f0('0x31')],'resourceId':_0x47f018['id'],'type':_0x818aaf[_0x11f0('0x31')],'sectionId':_0x818aaf['id']},{})['then'](function(){return _0x162ebd;});}else{return _0x162ebd;}})[_0x11f0('0x4d')](function(_0x261711){logger[_0x11f0('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x261711);throw _0x261711;});}return _0x162ebd;});}})['then'](respondWithResult(_0x550f53,0xc9))[_0x11f0('0x4d')](handleError(_0x550f53,null));};exports[_0x11f0('0x61')]=function(_0x23bc22,_0x45777b){if(_0x23bc22['body']['id']){delete _0x23bc22[_0x11f0('0x51')]['id'];}return db[_0x11f0('0x34')]['find']({'where':{'id':_0x23bc22['params']['id']}})['then'](handleEntityNotFound(_0x45777b,null))['then'](saveUpdates(_0x23bc22[_0x11f0('0x51')],null))[_0x11f0('0x2b')](respondWithResult(_0x45777b,null))[_0x11f0('0x4d')](handleError(_0x45777b,null));};exports[_0x11f0('0x2c')]=function(_0x1ad46c,_0x90b13e){return db[_0x11f0('0x34')][_0x11f0('0x56')]({'where':{'id':_0x1ad46c[_0x11f0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x90b13e,null))['then'](removeEntity(_0x90b13e,null))[_0x11f0('0x4d')](handleError(_0x90b13e,null));};function widgetAttributes(_0x4b9d15){try{switch(_0x4b9d15[_0x11f0('0x36')]){case _0x11f0('0x62'):return[{'name':_0x11f0('0x63'),'value':_0x4b9d15[_0x11f0('0x63')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x0]?_0x4b9d15[_0x11f0('0x64')][0x0][_0x11f0('0x65')]:undefined)||_0x11f0('0x66')}];case _0x11f0('0x67'):return[{'name':_0x11f0('0x68'),'value':_0x4b9d15[_0x11f0('0x68')]||(_0x4b9d15['attrs']&&_0x4b9d15[_0x11f0('0x64')][0x0]?_0x4b9d15[_0x11f0('0x64')][0x0]['value']:undefined)||''}];case _0x11f0('0x69'):return[{'name':_0x11f0('0x6a'),'value':_0x4b9d15[_0x11f0('0x6a')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x0]?_0x4b9d15['attrs'][0x0][_0x11f0('0x65')]:undefined)||_0x11f0('0x6b')},{'name':_0x11f0('0x6c'),'value':_0x4b9d15[_0x11f0('0x6c')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x1]?_0x4b9d15[_0x11f0('0x64')][0x1]['value']:undefined)||'0.00'},{'name':_0x11f0('0x6d'),'value':_0x4b9d15[_0x11f0('0x6d')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15['attrs'][0x2]?_0x4b9d15[_0x11f0('0x64')][0x2][_0x11f0('0x65')]:undefined)||0xc}];case _0x11f0('0x6e'):return[{'name':_0x11f0('0x6f'),'value':_0x4b9d15[_0x11f0('0x6f')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x0]?_0x4b9d15[_0x11f0('0x64')][0x0][_0x11f0('0x65')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x4b9d15[_0x11f0('0x70')]||(_0x4b9d15['attrs']&&_0x4b9d15['attrs'][0x1]?_0x4b9d15[_0x11f0('0x64')][0x1][_0x11f0('0x65')]:undefined)||[]},{'name':_0x11f0('0x6d'),'value':_0x4b9d15[_0x11f0('0x6d')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x2]?_0x4b9d15[_0x11f0('0x64')][0x2]['value']:undefined)||0x14},{'name':_0x11f0('0x71'),'value':_0x4b9d15[_0x11f0('0x71')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x3]?_0x4b9d15[_0x11f0('0x64')][0x3][_0x11f0('0x65')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x4b9d15['attrEmailAccounts']||(_0x4b9d15['attrs']&&_0x4b9d15[_0x11f0('0x64')][0x4]?_0x4b9d15[_0x11f0('0x64')][0x4]['value']:undefined)||''},{'name':_0x11f0('0x72'),'value':_0x4b9d15[_0x11f0('0x72')]||(_0x4b9d15['attrs']&&_0x4b9d15[_0x11f0('0x64')][0x5]?_0x4b9d15[_0x11f0('0x64')][0x5][_0x11f0('0x65')]:undefined)||''},{'name':_0x11f0('0x73'),'value':_0x4b9d15[_0x11f0('0x73')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x6]?_0x4b9d15[_0x11f0('0x64')][0x6][_0x11f0('0x65')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4b9d15[_0x11f0('0x74')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x7]?_0x4b9d15[_0x11f0('0x64')][0x7][_0x11f0('0x65')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4b9d15[_0x11f0('0x75')]||(_0x4b9d15['attrs']&&_0x4b9d15[_0x11f0('0x64')][0x8]?_0x4b9d15[_0x11f0('0x64')][0x8][_0x11f0('0x65')]:undefined)||''},{'name':'attrChatWebsites','value':_0x4b9d15[_0x11f0('0x76')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x9]?_0x4b9d15[_0x11f0('0x64')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0x11f0('0x77'):return[{'name':'attrSerie1','value':_0x4b9d15[_0x11f0('0x78')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x0]?_0x4b9d15[_0x11f0('0x64')][0x0][_0x11f0('0x65')]:undefined)||_0x11f0('0x79')},{'name':_0x11f0('0x7a'),'value':_0x4b9d15[_0x11f0('0x7a')]||(_0x4b9d15['attrs']&&_0x4b9d15[_0x11f0('0x64')][0x1]?_0x4b9d15[_0x11f0('0x64')][0x1]['value']:undefined)||null},{'name':_0x11f0('0x7b'),'value':_0x4b9d15[_0x11f0('0x7b')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x2]?_0x4b9d15[_0x11f0('0x64')][0x2]['value']:undefined)||null},{'name':_0x11f0('0x70'),'value':_0x4b9d15[_0x11f0('0x70')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x3]?_0x4b9d15['attrs'][0x3][_0x11f0('0x65')]:undefined)||[]},{'name':_0x11f0('0x71'),'value':_0x4b9d15[_0x11f0('0x71')]||(_0x4b9d15['attrs']&&_0x4b9d15[_0x11f0('0x64')][0x4]?_0x4b9d15['attrs'][0x4][_0x11f0('0x65')]:undefined)||_0x11f0('0x7c')},{'name':_0x11f0('0x7d'),'value':_0x4b9d15['attrEmailAccounts']||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15['attrs'][0x5]?_0x4b9d15[_0x11f0('0x64')][0x5][_0x11f0('0x65')]:undefined)||''},{'name':_0x11f0('0x72'),'value':_0x4b9d15[_0x11f0('0x72')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x6]?_0x4b9d15[_0x11f0('0x64')][0x6][_0x11f0('0x65')]:undefined)||''},{'name':_0x11f0('0x73'),'value':_0x4b9d15['attrSmsAccounts']||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x7]?_0x4b9d15[_0x11f0('0x64')][0x7][_0x11f0('0x65')]:undefined)||''},{'name':_0x11f0('0x74'),'value':_0x4b9d15[_0x11f0('0x74')]||(_0x4b9d15['attrs']&&_0x4b9d15[_0x11f0('0x64')][0x8]?_0x4b9d15[_0x11f0('0x64')][0x8]['value']:undefined)||''},{'name':_0x11f0('0x75'),'value':_0x4b9d15[_0x11f0('0x75')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x9]?_0x4b9d15[_0x11f0('0x64')][0x9][_0x11f0('0x65')]:undefined)||''},{'name':_0x11f0('0x76'),'value':_0x4b9d15[_0x11f0('0x76')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0xa]?_0x4b9d15[_0x11f0('0x64')][0xa][_0x11f0('0x65')]:undefined)||''}];case _0x11f0('0x7e'):return[{'name':_0x11f0('0x7f'),'type':_0x4b9d15[_0x11f0('0x80')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15['attrs'][0x0]?_0x4b9d15[_0x11f0('0x64')][0x0][_0x11f0('0x36')]:undefined)||null,'value':_0x4b9d15[_0x11f0('0x7f')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15['attrs'][0x0]?_0x4b9d15[_0x11f0('0x64')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4b9d15[_0x11f0('0x81')]||(_0x4b9d15[_0x11f0('0x64')]&&_0x4b9d15[_0x11f0('0x64')][0x1]?_0x4b9d15[_0x11f0('0x64')][0x1][_0x11f0('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x4c96db){logger['error'](_0x11f0('0x82'),JSON['stringify'](_0x4c96db));return[];}}exports['addItem']=function(_0x138851,_0x394ec4,_0x52b281){if(_0x138851[_0x11f0('0x51')]['id']){delete _0x138851[_0x11f0('0x51')]['id'];}return db[_0x11f0('0x34')]['find']({'where':{'id':_0x138851[_0x11f0('0x5c')]['id']}})[_0x11f0('0x2b')](handleEntityNotFound(_0x394ec4,null))[_0x11f0('0x2b')](function(_0x343ca7){if(_0x343ca7){_0x138851[_0x11f0('0x51')][_0x11f0('0x83')]=_0x343ca7['id'];_0x138851['body'][_0x11f0('0x64')]=widgetAttributes(_0x138851[_0x11f0('0x51')]);return db[_0x11f0('0x84')][_0x11f0('0x50')](_0x138851[_0x11f0('0x51')]);}})[_0x11f0('0x2b')](respondWithResult(_0x394ec4,null))[_0x11f0('0x4d')](handleError(_0x394ec4,null));};exports[_0x11f0('0x85')]=function(_0x23a4fc,_0x44947c,_0x3d0222){var _0x3b9ae7={};var _0x4bf505={};var _0x161eaa;var _0x391bb4;return db['Dashboard'][_0x11f0('0x86')]({'where':{'id':_0x23a4fc[_0x11f0('0x5c')]['id']}})[_0x11f0('0x2b')](handleEntityNotFound(_0x44947c,null))['then'](function(_0x57ca02){if(_0x57ca02){_0x161eaa=_0x57ca02;_0x4bf505['model']=_[_0x11f0('0x3a')](db[_0x11f0('0x84')]['rawAttributes']);_0x4bf505[_0x11f0('0x39')]=_['keys'](_0x23a4fc[_0x11f0('0x39')]);_0x4bf505[_0x11f0('0x3b')]=_['intersection'](_0x4bf505[_0x11f0('0x38')],_0x4bf505[_0x11f0('0x39')]);_0x3b9ae7[_0x11f0('0x3e')]=_['intersection'](_0x4bf505[_0x11f0('0x38')],qs[_0x11f0('0x3d')](_0x23a4fc[_0x11f0('0x39')][_0x11f0('0x3d')]));_0x3b9ae7[_0x11f0('0x3e')]=_0x3b9ae7['attributes']['length']?_0x3b9ae7['attributes']:_0x4bf505['model'];_0x3b9ae7['order']=qs['sort'](_0x23a4fc[_0x11f0('0x39')][_0x11f0('0x43')]);_0x3b9ae7[_0x11f0('0x46')]=qs[_0x11f0('0x3b')](_[_0x11f0('0x44')](_0x23a4fc[_0x11f0('0x39')],_0x4bf505[_0x11f0('0x3b')]));if(_0x23a4fc[_0x11f0('0x39')][_0x11f0('0x45')]){_0x3b9ae7['where']=_['merge'](_0x3b9ae7[_0x11f0('0x46')],{'$or':_[_0x11f0('0x87')](_0x3b9ae7[_0x11f0('0x3e')],function(_0x242e61){var _0x32f304={};_0x32f304[_0x242e61]={'$like':'%'+_0x23a4fc[_0x11f0('0x39')][_0x11f0('0x45')]+'%'};return _0x32f304;})});}_0x3b9ae7=_['merge']({},_0x3b9ae7,_0x23a4fc['options']);return _0x161eaa[_0x11f0('0x85')](_0x3b9ae7);}})['then'](function(_0x42bb07){if(_0x42bb07){_0x391bb4=_0x42bb07['length'];if(!_0x23a4fc[_0x11f0('0x39')]['hasOwnProperty'](_0x11f0('0x41'))){_0x3b9ae7['limit']=qs[_0x11f0('0x25')](_0x23a4fc['query']['limit']);_0x3b9ae7[_0x11f0('0x23')]=qs['offset'](_0x23a4fc[_0x11f0('0x39')][_0x11f0('0x23')]);}return _0x161eaa['getItems'](_0x3b9ae7);}})[_0x11f0('0x2b')](function(_0x1b19fa){if(_0x1b19fa){return _0x1b19fa?{'count':_0x391bb4,'rows':_0x1b19fa}:null;}})[_0x11f0('0x2b')](respondWithResult(_0x44947c,null))[_0x11f0('0x4d')](handleError(_0x44947c,null));}; \ No newline at end of file +var _0x8c38=['attrVoiceQueues','voice','web-report','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','index','map','Dashboard','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','catch','show','rawAttributes','options','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','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8c38,0x88));var _0x88c3=function(_0x1ef586,_0xde2c5a){_0x1ef586=_0x1ef586-0x0;var _0x86070c=_0x8c38[_0x1ef586];return _0x86070c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88c3('0x0'));var zipdir=require(_0x88c3('0x1'));var jsonpatch=require(_0x88c3('0x2'));var rp=require(_0x88c3('0x3'));var moment=require('moment');var BPromise=require(_0x88c3('0x4'));var Mustache=require(_0x88c3('0x5'));var util=require(_0x88c3('0x6'));var path=require('path');var sox=require(_0x88c3('0x7'));var csv=require('to-csv');var ejs=require(_0x88c3('0x8'));var fs=require('fs');var fs_extra=require(_0x88c3('0x9'));var _=require(_0x88c3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x88c3('0xb'));var Redis=require(_0x88c3('0xc'));var authService=require(_0x88c3('0xd'));var qs=require(_0x88c3('0xe'));var as=require(_0x88c3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88c3('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x88c3('0x11'));var licenseUtil=require(_0x88c3('0x12'));var db=require(_0x88c3('0x13'))['db'];config[_0x88c3('0x14')]=_['defaults'](config[_0x88c3('0x14')],{'host':_0x88c3('0x15'),'port':0x18eb});var socket=require(_0x88c3('0x16'))(new Redis(config[_0x88c3('0x14')]));require(_0x88c3('0x17'))[_0x88c3('0x18')](socket);function respondWithStatusCode(_0x53d2f6,_0x263e71){_0x263e71=_0x263e71||0xcc;return function(_0x420cce){if(_0x420cce){return _0x53d2f6[_0x88c3('0x19')](_0x263e71);}return _0x53d2f6['status'](_0x263e71)[_0x88c3('0x1a')]();};}function respondWithResult(_0xff8c5a,_0x30a2df){_0x30a2df=_0x30a2df||0xc8;return function(_0x3c4771){if(_0x3c4771){return _0xff8c5a['status'](_0x30a2df)['json'](_0x3c4771);}};}function respondWithFilteredResult(_0x25d9b6,_0x36f184){return function(_0x4d88aa){if(_0x4d88aa){var _0x81fe56=typeof _0x36f184[_0x88c3('0x1b')]===_0x88c3('0x1c')&&typeof _0x36f184['limit']===_0x88c3('0x1c');var _0x473175=_0x4d88aa[_0x88c3('0x1d')];var _0xc18561=_0x81fe56?0x0:_0x36f184[_0x88c3('0x1b')];var _0x4c1883=_0x81fe56?_0x4d88aa[_0x88c3('0x1d')]:_0x36f184[_0x88c3('0x1b')]+_0x36f184[_0x88c3('0x1e')];var _0x51134e;if(_0x4c1883>=_0x473175){_0x4c1883=_0x473175;_0x51134e=0xc8;}else{_0x51134e=0xce;}_0x25d9b6[_0x88c3('0x1f')](_0x51134e);return _0x25d9b6[_0x88c3('0x20')](_0x88c3('0x21'),_0xc18561+'-'+_0x4c1883+'/'+_0x473175)['json'](_0x4d88aa);}return null;};}function patchUpdates(_0x3aefa2){return function(_0x34d65b){try{jsonpatch[_0x88c3('0x22')](_0x34d65b,_0x3aefa2,!![]);}catch(_0x2318cf){return BPromise[_0x88c3('0x23')](_0x2318cf);}return _0x34d65b[_0x88c3('0x24')]();};}function saveUpdates(_0x2f78d0,_0x39c451){return function(_0x21c268){if(_0x21c268){return _0x21c268[_0x88c3('0x25')](_0x2f78d0)[_0x88c3('0x26')](function(_0x3893c8){return _0x3893c8;});}return null;};}function removeEntity(_0x12c685,_0xa003c7){return function(_0xb26faa){if(_0xb26faa){return _0xb26faa[_0x88c3('0x27')]()[_0x88c3('0x26')](function(){var _0x24b207=_0xb26faa[_0x88c3('0x28')]({'plain':!![]});var _0x4554b7=_0x88c3('0x29');return db[_0x88c3('0x2a')][_0x88c3('0x27')]({'where':{'type':_0x4554b7,'resourceId':_0x24b207['id']}})[_0x88c3('0x26')](function(){return _0xb26faa;});})['then'](function(){_0x12c685['status'](0xcc)[_0x88c3('0x1a')]();});}};}function handleEntityNotFound(_0x750e82,_0x300c55){return function(_0x58bda5){if(!_0x58bda5){_0x750e82[_0x88c3('0x19')](0x194);}return _0x58bda5;};}function handleError(_0x2aa2b7,_0xdaf09){_0xdaf09=_0xdaf09||0x1f4;return function(_0x1e81b0){logger[_0x88c3('0x2b')](_0x1e81b0['stack']);if(_0x1e81b0['name']){delete _0x1e81b0[_0x88c3('0x2c')];}_0x2aa2b7[_0x88c3('0x1f')](_0xdaf09)['send'](_0x1e81b0);};}exports[_0x88c3('0x2d')]=function(_0x52da38,_0x23bc6f){var _0x3c66a8={},_0x5dc2a8={},_0x5d21fb={'count':0x0,'rows':[]};var _0xfc782e=_[_0x88c3('0x2e')](db[_0x88c3('0x2f')]['rawAttributes'],function(_0x168876){return{'name':_0x168876[_0x88c3('0x30')],'type':_0x168876['type'][_0x88c3('0x31')]};});_0x5dc2a8[_0x88c3('0x32')]=_['map'](_0xfc782e,_0x88c3('0x2c'));_0x5dc2a8[_0x88c3('0x33')]=_[_0x88c3('0x34')](_0x52da38[_0x88c3('0x33')]);_0x5dc2a8['filters']=_['intersection'](_0x5dc2a8['model'],_0x5dc2a8[_0x88c3('0x33')]);_0x3c66a8[_0x88c3('0x35')]=_[_0x88c3('0x36')](_0x5dc2a8[_0x88c3('0x32')],qs[_0x88c3('0x37')](_0x52da38[_0x88c3('0x33')][_0x88c3('0x37')]));_0x3c66a8[_0x88c3('0x35')]=_0x3c66a8[_0x88c3('0x35')][_0x88c3('0x38')]?_0x3c66a8[_0x88c3('0x35')]:_0x5dc2a8['model'];if(!_0x52da38[_0x88c3('0x33')][_0x88c3('0x39')](_0x88c3('0x3a'))){_0x3c66a8['limit']=qs[_0x88c3('0x1e')](_0x52da38['query'][_0x88c3('0x1e')]);_0x3c66a8[_0x88c3('0x1b')]=qs[_0x88c3('0x1b')](_0x52da38[_0x88c3('0x33')][_0x88c3('0x1b')]);}_0x3c66a8[_0x88c3('0x3b')]=qs[_0x88c3('0x3c')](_0x52da38['query'][_0x88c3('0x3c')]);_0x3c66a8[_0x88c3('0x3d')]=qs[_0x88c3('0x3e')](_[_0x88c3('0x3f')](_0x52da38[_0x88c3('0x33')],_0x5dc2a8['filters']),_0xfc782e);if(_0x52da38['query']['filter']){_0x3c66a8[_0x88c3('0x3d')]=_[_0x88c3('0x40')](_0x3c66a8[_0x88c3('0x3d')],{'$or':_[_0x88c3('0x2e')](_0xfc782e,function(_0x5b813d){if(_0x5b813d[_0x88c3('0x41')]!==_0x88c3('0x42')){var _0x4316c3={};_0x4316c3[_0x5b813d[_0x88c3('0x2c')]]={'$like':'%'+_0x52da38[_0x88c3('0x33')][_0x88c3('0x43')]+'%'};return _0x4316c3;}})});}_0x3c66a8=_[_0x88c3('0x40')]({},_0x3c66a8,_0x52da38['options']);var _0x3322ce={'where':_0x3c66a8['where']};return db['Dashboard']['count'](_0x3322ce)[_0x88c3('0x26')](function(_0x35e168){_0x5d21fb[_0x88c3('0x1d')]=_0x35e168;if(_0x52da38[_0x88c3('0x33')][_0x88c3('0x44')]){_0x3c66a8[_0x88c3('0x45')]=[{'all':!![]}];}return db[_0x88c3('0x2f')][_0x88c3('0x46')](_0x3c66a8);})[_0x88c3('0x26')](function(_0x1b6c98){_0x5d21fb['rows']=_0x1b6c98;return _0x5d21fb;})[_0x88c3('0x26')](respondWithFilteredResult(_0x23bc6f,_0x3c66a8))[_0x88c3('0x47')](handleError(_0x23bc6f,null));};exports[_0x88c3('0x48')]=function(_0x1c2135,_0x3329d1){var _0x5406e1={'raw':![],'where':{'id':_0x1c2135['params']['id']}},_0x3ee5c4={};_0x3ee5c4[_0x88c3('0x32')]=_[_0x88c3('0x34')](db['Dashboard'][_0x88c3('0x49')]);_0x3ee5c4['query']=_[_0x88c3('0x34')](_0x1c2135[_0x88c3('0x33')]);_0x3ee5c4[_0x88c3('0x3e')]=_[_0x88c3('0x36')](_0x3ee5c4['model'],_0x3ee5c4[_0x88c3('0x33')]);_0x5406e1['attributes']=_['intersection'](_0x3ee5c4[_0x88c3('0x32')],qs[_0x88c3('0x37')](_0x1c2135['query'][_0x88c3('0x37')]));_0x5406e1[_0x88c3('0x35')]=_0x5406e1[_0x88c3('0x35')]['length']?_0x5406e1['attributes']:_0x3ee5c4[_0x88c3('0x32')];if(_0x1c2135[_0x88c3('0x33')][_0x88c3('0x44')]){_0x5406e1[_0x88c3('0x45')]=[{'all':!![]}];}_0x5406e1=_[_0x88c3('0x40')]({},_0x5406e1,_0x1c2135[_0x88c3('0x4a')]);return db[_0x88c3('0x2f')][_0x88c3('0x4b')](_0x5406e1)[_0x88c3('0x26')](handleEntityNotFound(_0x3329d1,null))[_0x88c3('0x26')](respondWithResult(_0x3329d1,null))['catch'](handleError(_0x3329d1,null));};exports[_0x88c3('0x4c')]=function(_0x5046c0,_0x5d4b05){return db[_0x88c3('0x2f')][_0x88c3('0x4c')](_0x5046c0[_0x88c3('0x4d')],{})['then'](function(_0x16ab36){var _0x5d5740=_0x5046c0[_0x88c3('0x4e')]['get']({'plain':!![]});if(!_0x5d5740)throw new Error(_0x88c3('0x4f'));if(_0x5d5740[_0x88c3('0x50')]===_0x88c3('0x4e')){var _0x141d5a=_0x16ab36[_0x88c3('0x28')]({'plain':!![]});var _0x383d75=_0x88c3('0x29');return db[_0x88c3('0x51')][_0x88c3('0x4b')]({'where':{'name':_0x383d75,'userProfileId':_0x5d5740[_0x88c3('0x52')]},'raw':!![]})[_0x88c3('0x26')](function(_0x53580f){if(_0x53580f&&_0x53580f[_0x88c3('0x53')]===0x0){return db[_0x88c3('0x2a')][_0x88c3('0x4c')]({'name':_0x141d5a[_0x88c3('0x2c')],'resourceId':_0x141d5a['id'],'type':_0x53580f[_0x88c3('0x2c')],'sectionId':_0x53580f['id']},{})[_0x88c3('0x26')](function(){return _0x16ab36;});}else{return _0x16ab36;}})[_0x88c3('0x47')](function(_0x25999d){logger['error'](_0x88c3('0x54'),_0x25999d);throw _0x25999d;});}return _0x16ab36;})['then'](respondWithResult(_0x5d4b05,0xc9))['catch'](handleError(_0x5d4b05,null));};exports['clone']=function(_0x1f04aa,_0x53d16c){var _0x421bd6={'where':{'id':_0x1f04aa[_0x88c3('0x55')]['id']}},_0x5b799d={};_0x5b799d[_0x88c3('0x32')]=_[_0x88c3('0x34')](db[_0x88c3('0x2f')]['rawAttributes']);_0x421bd6['attributes']=_[_0x88c3('0x36')](_0x5b799d[_0x88c3('0x32')],qs[_0x88c3('0x37')](_0x1f04aa[_0x88c3('0x33')][_0x88c3('0x37')]));_0x421bd6['attributes']=_0x421bd6[_0x88c3('0x35')][_0x88c3('0x38')]?_0x421bd6['attributes']:_0x5b799d['model'];if(_0x1f04aa[_0x88c3('0x33')]['includeAll']){_0x421bd6[_0x88c3('0x45')]=[{'all':!![]}];}_0x421bd6=_[_0x88c3('0x40')]({},_0x421bd6,_0x1f04aa[_0x88c3('0x4a')]);return db[_0x88c3('0x2f')][_0x88c3('0x4b')](_0x421bd6)[_0x88c3('0x26')](handleEntityNotFound(_0x53d16c,null))[_0x88c3('0x26')](function(_0x193e49){if(_0x193e49){var _0x4d97fc=_0x193e49[_0x88c3('0x28')]({'plain':!![]});_0x4d97fc=qs[_0x88c3('0x56')](_0x4d97fc,['id',_0x88c3('0x57'),_0x88c3('0x58')]);_0x1f04aa[_0x88c3('0x4d')]=_[_0x88c3('0x56')](_0x1f04aa['body'],['id',_0x88c3('0x57'),_0x88c3('0x58')]);return db[_0x88c3('0x2f')][_0x88c3('0x4c')](_[_0x88c3('0x40')](_0x4d97fc,_0x1f04aa[_0x88c3('0x4d')]),{'include':_0x1f04aa[_0x88c3('0x33')][_0x88c3('0x44')]?[{'all':!![]}]:undefined})[_0x88c3('0x26')](function(_0x55cd56){var _0x5231a6=_0x1f04aa[_0x88c3('0x4e')][_0x88c3('0x28')]({'plain':!![]});if(!_0x5231a6)throw new Error(_0x88c3('0x4f'));if(_0x5231a6['role']==='user'){var _0xd104a6=_0x55cd56['get']({'plain':!![]});var _0x296ab0=_0x88c3('0x29');return db[_0x88c3('0x51')][_0x88c3('0x4b')]({'where':{'name':_0x296ab0,'userProfileId':_0x5231a6[_0x88c3('0x52')]},'raw':!![]})['then'](function(_0x122e1f){if(_0x122e1f&&_0x122e1f[_0x88c3('0x53')]===0x0){return db[_0x88c3('0x2a')][_0x88c3('0x4c')]({'name':_0xd104a6[_0x88c3('0x2c')],'resourceId':_0xd104a6['id'],'type':_0x122e1f['name'],'sectionId':_0x122e1f['id']},{})[_0x88c3('0x26')](function(){return _0x55cd56;});}else{return _0x55cd56;}})['catch'](function(_0x5d9a69){logger[_0x88c3('0x2b')](_0x88c3('0x54'),_0x5d9a69);throw _0x5d9a69;});}return _0x55cd56;});}})[_0x88c3('0x26')](respondWithResult(_0x53d16c,0xc9))[_0x88c3('0x47')](handleError(_0x53d16c,null));};exports[_0x88c3('0x25')]=function(_0x2505ec,_0x1ac730){if(_0x2505ec[_0x88c3('0x4d')]['id']){delete _0x2505ec[_0x88c3('0x4d')]['id'];}return db['Dashboard'][_0x88c3('0x4b')]({'where':{'id':_0x2505ec[_0x88c3('0x55')]['id']}})[_0x88c3('0x26')](handleEntityNotFound(_0x1ac730,null))['then'](saveUpdates(_0x2505ec[_0x88c3('0x4d')],null))['then'](respondWithResult(_0x1ac730,null))[_0x88c3('0x47')](handleError(_0x1ac730,null));};exports[_0x88c3('0x27')]=function(_0x38b012,_0x5c15bf){return db[_0x88c3('0x2f')][_0x88c3('0x4b')]({'where':{'id':_0x38b012['params']['id']}})[_0x88c3('0x26')](handleEntityNotFound(_0x5c15bf,null))['then'](removeEntity(_0x5c15bf,null))['catch'](handleError(_0x5c15bf,null));};function widgetAttributes(_0x4f61cd){try{switch(_0x4f61cd[_0x88c3('0x41')]){case _0x88c3('0x59'):return[{'name':_0x88c3('0x5a'),'value':_0x4f61cd[_0x88c3('0x5a')]||(_0x4f61cd['attrs']&&_0x4f61cd[_0x88c3('0x5b')][0x0]?_0x4f61cd[_0x88c3('0x5b')][0x0][_0x88c3('0x5c')]:undefined)||_0x88c3('0x5d')}];case _0x88c3('0x5e'):return[{'name':_0x88c3('0x5f'),'value':_0x4f61cd['attrPath']||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x0]?_0x4f61cd[_0x88c3('0x5b')][0x0][_0x88c3('0x5c')]:undefined)||''}];case _0x88c3('0x60'):return[{'name':'attrHourFormat','value':_0x4f61cd[_0x88c3('0x61')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x0]?_0x4f61cd[_0x88c3('0x5b')][0x0]['value']:undefined)||_0x88c3('0x62')},{'name':_0x88c3('0x63'),'value':_0x4f61cd['attrTimezone']||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd['attrs'][0x1]?_0x4f61cd[_0x88c3('0x5b')][0x1][_0x88c3('0x5c')]:undefined)||_0x88c3('0x64')},{'name':_0x88c3('0x65'),'value':_0x4f61cd['attrFontSize']||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x2]?_0x4f61cd[_0x88c3('0x5b')][0x2]['value']:undefined)||0xc}];case _0x88c3('0x66'):return[{'name':'attrMetric','value':_0x4f61cd[_0x88c3('0x67')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x0]?_0x4f61cd[_0x88c3('0x5b')][0x0][_0x88c3('0x5c')]:undefined)||_0x88c3('0x68')},{'name':'attrVoiceQueues','value':_0x4f61cd['attrVoiceQueues']||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x1]?_0x4f61cd[_0x88c3('0x5b')][0x1][_0x88c3('0x5c')]:undefined)||[]},{'name':_0x88c3('0x65'),'value':_0x4f61cd['attrFontSize']||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x2]?_0x4f61cd[_0x88c3('0x5b')][0x2]['value']:undefined)||0x14},{'name':_0x88c3('0x69'),'value':_0x4f61cd['attrChannel']||(_0x4f61cd['attrs']&&_0x4f61cd[_0x88c3('0x5b')][0x3]?_0x4f61cd[_0x88c3('0x5b')][0x3][_0x88c3('0x5c')]:undefined)||'voice'},{'name':_0x88c3('0x6a'),'value':_0x4f61cd['attrEmailAccounts']||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x4]?_0x4f61cd[_0x88c3('0x5b')][0x4]['value']:undefined)||''},{'name':_0x88c3('0x6b'),'value':_0x4f61cd[_0x88c3('0x6b')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x5]?_0x4f61cd[_0x88c3('0x5b')][0x5][_0x88c3('0x5c')]:undefined)||''},{'name':_0x88c3('0x6c'),'value':_0x4f61cd['attrSmsAccounts']||(_0x4f61cd['attrs']&&_0x4f61cd['attrs'][0x6]?_0x4f61cd[_0x88c3('0x5b')][0x6][_0x88c3('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4f61cd[_0x88c3('0x6d')]||(_0x4f61cd['attrs']&&_0x4f61cd[_0x88c3('0x5b')][0x7]?_0x4f61cd[_0x88c3('0x5b')][0x7][_0x88c3('0x5c')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4f61cd[_0x88c3('0x6e')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x8]?_0x4f61cd[_0x88c3('0x5b')][0x8][_0x88c3('0x5c')]:undefined)||''},{'name':_0x88c3('0x6f'),'value':_0x4f61cd[_0x88c3('0x6f')]||(_0x4f61cd['attrs']&&_0x4f61cd[_0x88c3('0x5b')][0x9]?_0x4f61cd[_0x88c3('0x5b')][0x9][_0x88c3('0x5c')]:undefined)||''}];case'multibar-chart':case _0x88c3('0x70'):return[{'name':'attrSerie1','value':_0x4f61cd[_0x88c3('0x71')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x0]?_0x4f61cd['attrs'][0x0][_0x88c3('0x5c')]:undefined)||'total'},{'name':_0x88c3('0x72'),'value':_0x4f61cd[_0x88c3('0x72')]||(_0x4f61cd['attrs']&&_0x4f61cd['attrs'][0x1]?_0x4f61cd[_0x88c3('0x5b')][0x1][_0x88c3('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x4f61cd[_0x88c3('0x73')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x2]?_0x4f61cd[_0x88c3('0x5b')][0x2][_0x88c3('0x5c')]:undefined)||null},{'name':_0x88c3('0x74'),'value':_0x4f61cd[_0x88c3('0x74')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x3]?_0x4f61cd[_0x88c3('0x5b')][0x3][_0x88c3('0x5c')]:undefined)||[]},{'name':_0x88c3('0x69'),'value':_0x4f61cd[_0x88c3('0x69')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd['attrs'][0x4]?_0x4f61cd[_0x88c3('0x5b')][0x4][_0x88c3('0x5c')]:undefined)||_0x88c3('0x75')},{'name':_0x88c3('0x6a'),'value':_0x4f61cd[_0x88c3('0x6a')]||(_0x4f61cd['attrs']&&_0x4f61cd[_0x88c3('0x5b')][0x5]?_0x4f61cd[_0x88c3('0x5b')][0x5]['value']:undefined)||''},{'name':_0x88c3('0x6b'),'value':_0x4f61cd[_0x88c3('0x6b')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x6]?_0x4f61cd[_0x88c3('0x5b')][0x6][_0x88c3('0x5c')]:undefined)||''},{'name':_0x88c3('0x6c'),'value':_0x4f61cd['attrSmsAccounts']||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x7]?_0x4f61cd[_0x88c3('0x5b')][0x7][_0x88c3('0x5c')]:undefined)||''},{'name':_0x88c3('0x6d'),'value':_0x4f61cd['attrOpenchannelAccounts']||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x8]?_0x4f61cd[_0x88c3('0x5b')][0x8][_0x88c3('0x5c')]:undefined)||''},{'name':_0x88c3('0x6e'),'value':_0x4f61cd[_0x88c3('0x6e')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x9]?_0x4f61cd['attrs'][0x9][_0x88c3('0x5c')]:undefined)||''},{'name':_0x88c3('0x6f'),'value':_0x4f61cd[_0x88c3('0x6f')]||(_0x4f61cd['attrs']&&_0x4f61cd[_0x88c3('0x5b')][0xa]?_0x4f61cd[_0x88c3('0x5b')][0xa][_0x88c3('0x5c')]:undefined)||''}];case _0x88c3('0x76'):return[{'name':'attrReport','type':_0x4f61cd['reportType']||(_0x4f61cd['attrs']&&_0x4f61cd[_0x88c3('0x5b')][0x0]?_0x4f61cd[_0x88c3('0x5b')][0x0][_0x88c3('0x41')]:undefined)||null,'value':_0x4f61cd['attrReport']||(_0x4f61cd['attrs']&&_0x4f61cd['attrs'][0x0]?_0x4f61cd[_0x88c3('0x5b')][0x0][_0x88c3('0x5c')]:undefined)||null},{'name':_0x88c3('0x77'),'value':_0x4f61cd[_0x88c3('0x77')]||(_0x4f61cd[_0x88c3('0x5b')]&&_0x4f61cd[_0x88c3('0x5b')][0x1]?_0x4f61cd[_0x88c3('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x11fef5){logger[_0x88c3('0x2b')](_0x88c3('0x78'),JSON['stringify'](_0x11fef5));return[];}}exports[_0x88c3('0x79')]=function(_0x34454c,_0xdfbecf,_0x3392b8){if(_0x34454c['body']['id']){delete _0x34454c[_0x88c3('0x4d')]['id'];}return db[_0x88c3('0x2f')]['find']({'where':{'id':_0x34454c[_0x88c3('0x55')]['id']}})['then'](handleEntityNotFound(_0xdfbecf,null))[_0x88c3('0x26')](function(_0x333b90){if(_0x333b90){_0x34454c[_0x88c3('0x4d')][_0x88c3('0x7a')]=_0x333b90['id'];_0x34454c[_0x88c3('0x4d')]['attrs']=widgetAttributes(_0x34454c[_0x88c3('0x4d')]);return db[_0x88c3('0x7b')][_0x88c3('0x4c')](_0x34454c[_0x88c3('0x4d')]);}})[_0x88c3('0x26')](respondWithResult(_0xdfbecf,null))[_0x88c3('0x47')](handleError(_0xdfbecf,null));};exports[_0x88c3('0x7c')]=function(_0x2c747d,_0x3a19eb,_0x20f134){var _0x4ed0cc={};var _0x2e9bdd={};var _0x33cc24;var _0x4ecca2;return db[_0x88c3('0x2f')][_0x88c3('0x7d')]({'where':{'id':_0x2c747d['params']['id']}})[_0x88c3('0x26')](handleEntityNotFound(_0x3a19eb,null))['then'](function(_0x34970f){if(_0x34970f){_0x33cc24=_0x34970f;_0x2e9bdd[_0x88c3('0x32')]=_[_0x88c3('0x34')](db[_0x88c3('0x7b')]['rawAttributes']);_0x2e9bdd[_0x88c3('0x33')]=_[_0x88c3('0x34')](_0x2c747d[_0x88c3('0x33')]);_0x2e9bdd[_0x88c3('0x3e')]=_[_0x88c3('0x36')](_0x2e9bdd[_0x88c3('0x32')],_0x2e9bdd['query']);_0x4ed0cc[_0x88c3('0x35')]=_[_0x88c3('0x36')](_0x2e9bdd[_0x88c3('0x32')],qs[_0x88c3('0x37')](_0x2c747d[_0x88c3('0x33')][_0x88c3('0x37')]));_0x4ed0cc[_0x88c3('0x35')]=_0x4ed0cc['attributes'][_0x88c3('0x38')]?_0x4ed0cc[_0x88c3('0x35')]:_0x2e9bdd[_0x88c3('0x32')];_0x4ed0cc[_0x88c3('0x3b')]=qs[_0x88c3('0x3c')](_0x2c747d[_0x88c3('0x33')][_0x88c3('0x3c')]);_0x4ed0cc[_0x88c3('0x3d')]=qs[_0x88c3('0x3e')](_['pick'](_0x2c747d[_0x88c3('0x33')],_0x2e9bdd['filters']));if(_0x2c747d['query']['filter']){_0x4ed0cc[_0x88c3('0x3d')]=_[_0x88c3('0x40')](_0x4ed0cc[_0x88c3('0x3d')],{'$or':_[_0x88c3('0x2e')](_0x4ed0cc['attributes'],function(_0x113219){var _0x3798cb={};_0x3798cb[_0x113219]={'$like':'%'+_0x2c747d['query'][_0x88c3('0x43')]+'%'};return _0x3798cb;})});}_0x4ed0cc=_[_0x88c3('0x40')]({},_0x4ed0cc,_0x2c747d[_0x88c3('0x4a')]);return _0x33cc24[_0x88c3('0x7c')](_0x4ed0cc);}})[_0x88c3('0x26')](function(_0x4aff47){if(_0x4aff47){_0x4ecca2=_0x4aff47[_0x88c3('0x38')];if(!_0x2c747d['query'][_0x88c3('0x39')](_0x88c3('0x3a'))){_0x4ed0cc[_0x88c3('0x1e')]=qs[_0x88c3('0x1e')](_0x2c747d[_0x88c3('0x33')][_0x88c3('0x1e')]);_0x4ed0cc[_0x88c3('0x1b')]=qs[_0x88c3('0x1b')](_0x2c747d[_0x88c3('0x33')][_0x88c3('0x1b')]);}return _0x33cc24[_0x88c3('0x7c')](_0x4ed0cc);}})[_0x88c3('0x26')](function(_0x1388da){if(_0x1388da){return _0x1388da?{'count':_0x4ecca2,'rows':_0x1388da}:null;}})[_0x88c3('0x26')](respondWithResult(_0x3a19eb,null))['catch'](handleError(_0x3a19eb,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 393a60e..ef891a4 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 _0xa921=['Dashboard','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xa921,0x77));var _0x1a92=function(_0x539a0e,_0x409f14){_0x539a0e=_0x539a0e-0x0;var _0x580747=_0xa921[_0x539a0e];return _0x580747;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x1a92('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1a92('0x1'),'afterUpdate':'update','afterDestroy':_0x1a92('0x2')};function emitEvent(_0x2392de){return function(_0x19fb93,_0x586477,_0x5e7a46){DashboardEvents[_0x1a92('0x3')](_0x2392de+':'+_0x19fb93['id'],_0x19fb93);DashboardEvents[_0x1a92('0x3')](_0x2392de,_0x19fb93);_0x5e7a46(null);};}for(var e in events){if(events[_0x1a92('0x4')](e)){var event=events[e];Dashboard[_0x1a92('0x5')](e,emitEvent(event));}}module[_0x1a92('0x6')]=DashboardEvents; \ No newline at end of file +var _0xf577=['Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xf577,0x8f));var _0x7f57=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xf577[_0x45d3f0];return _0x314b79;};'use strict';var EventEmitter=require(_0x7f57('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x7f57('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7f57('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f57('0x3'),'afterDestroy':_0x7f57('0x4')};function emitEvent(_0x355c61){return function(_0x578a4a,_0x1552a7,_0x40505f){DashboardEvents['emit'](_0x355c61+':'+_0x578a4a['id'],_0x578a4a);DashboardEvents[_0x7f57('0x5')](_0x355c61,_0x578a4a);_0x40505f(null);};}for(var e in events){if(events[_0x7f57('0x6')](e)){var event=events[e];Dashboard[_0x7f57('0x7')](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 c24272c..39e01d9 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 _0x005d=['exports','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x005d,0x64));var _0xd005=function(_0x726b55,_0x5cb39a){_0x726b55=_0x726b55-0x0;var _0x45f87e=_0x005d[_0x726b55];return _0x45f87e;};'use strict';var _=require(_0xd005('0x0'));var util=require('util');var logger=require(_0xd005('0x1'))(_0xd005('0x2'));var moment=require(_0xd005('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd005('0x4'));var rimraf=require(_0xd005('0x5'));var config=require(_0xd005('0x6'));var attributes=require(_0xd005('0x7'));module[_0xd005('0x8')]=function(_0x3fb65f,_0x2c124d){return _0x3fb65f['define']('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf21d=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','./dashboard.attributes','Dashboard','dashboards'];(function(_0x4aa60c,_0x3a4920){var _0x3cb4ac=function(_0x3200da){while(--_0x3200da){_0x4aa60c['push'](_0x4aa60c['shift']());}};_0x3cb4ac(++_0x3a4920);}(_0xf21d,0x8c));var _0xdf21=function(_0x272f84,_0x36ef0a){_0x272f84=_0x272f84-0x0;var _0x12a48a=_0xf21d[_0x272f84];return _0x12a48a;};'use strict';var _=require(_0xdf21('0x0'));var util=require(_0xdf21('0x1'));var logger=require('../../config/logger')(_0xdf21('0x2'));var moment=require(_0xdf21('0x3'));var BPromise=require(_0xdf21('0x4'));var rp=require(_0xdf21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdf21('0x6'));var attributes=require(_0xdf21('0x7'));module['exports']=function(_0x13a32b,_0x5ed037){return _0x13a32b['define'](_0xdf21('0x8'),attributes,{'tableName':_0xdf21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 389e3a7..ba5cdc7 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 _0x9839=['error','code','message','result','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','Dashboard,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0x9839,0x1bd));var _0x9983=function(_0x2091ab,_0x58c84b){_0x2091ab=_0x2091ab-0x0;var _0x399dd6=_0x9839[_0x2091ab];return _0x399dd6;};'use strict';var _=require('lodash');var util=require(_0x9983('0x0'));var moment=require('moment');var BPromise=require(_0x9983('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9983('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x9983('0x3'))(_0x9983('0x4'));var config=require('../../config/environment');var jayson=require(_0x9983('0x5'));var client=jayson[_0x9983('0x6')][_0x9983('0x7')]({'port':0x232a});config[_0x9983('0x8')]=_[_0x9983('0x9')](config['redis'],{'host':_0x9983('0xa'),'port':0x18eb});var socket=require(_0x9983('0xb'))(new Redis(config[_0x9983('0x8')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x2f7e43,_0x49fcd7,_0x33dd07){return new BPromise(function(_0x1fdbff,_0x2f65c9){return client[_0x9983('0xc')](_0x2f7e43,_0x33dd07)['then'](function(_0xa1c672){logger['info'](_0x9983('0xd'),_0x49fcd7,'request\x20sent');logger[_0x9983('0xe')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x49fcd7,_0x9983('0xf'),JSON[_0x9983('0x10')](_0xa1c672));if(_0xa1c672[_0x9983('0x11')]){if(_0xa1c672['error'][_0x9983('0x12')]===0x1f4){logger[_0x9983('0x11')](_0x9983('0xd'),_0x49fcd7,_0xa1c672['error'][_0x9983('0x13')]);return _0x2f65c9(_0xa1c672[_0x9983('0x11')][_0x9983('0x13')]);}logger[_0x9983('0x11')](_0x9983('0xd'),_0x49fcd7,_0xa1c672[_0x9983('0x11')][_0x9983('0x13')]);return _0x1fdbff(_0xa1c672[_0x9983('0x11')][_0x9983('0x13')]);}else{logger['info'](_0x9983('0xd'),_0x49fcd7,_0x9983('0xf'));_0x1fdbff(_0xa1c672[_0x9983('0x14')][_0x9983('0x13')]);}})['catch'](function(_0x1039ce){logger[_0x9983('0x11')]('Dashboard,\x20%s,\x20%s',_0x49fcd7,_0x1039ce);_0x2f65c9(_0x1039ce);});});} \ No newline at end of file +var _0x3884=['./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','localhost'];(function(_0xb8dc94,_0x1053bb){var _0x176ccc=function(_0x4c5eb4){while(--_0x4c5eb4){_0xb8dc94['push'](_0xb8dc94['shift']());}};_0x176ccc(++_0x1053bb);}(_0x3884,0x139));var _0x4388=function(_0x15681c,_0x1de42e){_0x15681c=_0x15681c-0x0;var _0x1cddf6=_0x3884[_0x15681c];return _0x1cddf6;};'use strict';var _=require(_0x4388('0x0'));var util=require(_0x4388('0x1'));var moment=require(_0x4388('0x2'));var BPromise=require('bluebird');var rs=require(_0x4388('0x3'));var fs=require('fs');var Redis=require(_0x4388('0x4'));var db=require(_0x4388('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4388('0x6'));var config=require(_0x4388('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4388('0x8')]({'port':0x232a});config[_0x4388('0x9')]=_[_0x4388('0xa')](config['redis'],{'host':_0x4388('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4388('0x9')]));require(_0x4388('0xc'))[_0x4388('0xd')](socket);function respondWithRpcPromise(_0x2dc308,_0x1d38ba,_0x18a89a){return new BPromise(function(_0x257afd,_0x2c7864){return client[_0x4388('0xe')](_0x2dc308,_0x18a89a)[_0x4388('0xf')](function(_0x367cbe){logger[_0x4388('0x10')](_0x4388('0x11'),_0x1d38ba,_0x4388('0x12'));logger['debug'](_0x4388('0x13'),_0x1d38ba,'request\x20sent',JSON[_0x4388('0x14')](_0x367cbe));if(_0x367cbe['error']){if(_0x367cbe[_0x4388('0x15')][_0x4388('0x16')]===0x1f4){logger[_0x4388('0x15')](_0x4388('0x11'),_0x1d38ba,_0x367cbe[_0x4388('0x15')][_0x4388('0x17')]);return _0x2c7864(_0x367cbe[_0x4388('0x15')][_0x4388('0x17')]);}logger['error'](_0x4388('0x11'),_0x1d38ba,_0x367cbe[_0x4388('0x15')][_0x4388('0x17')]);return _0x257afd(_0x367cbe[_0x4388('0x15')][_0x4388('0x17')]);}else{logger[_0x4388('0x10')](_0x4388('0x11'),_0x1d38ba,_0x4388('0x12'));_0x257afd(_0x367cbe[_0x4388('0x18')][_0x4388('0x17')]);}})['catch'](function(_0x5420f4){logger[_0x4388('0x15')]('Dashboard,\x20%s,\x20%s',_0x1d38ba,_0x5420f4);_0x2c7864(_0x5420f4);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 63c8033..64e5aa1 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 _0x48c4=['register','length','dashboard:','remove','update','emit','removeListener'];(function(_0x35b32f,_0x569250){var _0x3c28c1=function(_0x187900){while(--_0x187900){_0x35b32f['push'](_0x35b32f['shift']());}};_0x3c28c1(++_0x569250);}(_0x48c4,0x129));var _0x448c=function(_0x3cd381,_0x36d8b5){_0x3cd381=_0x3cd381-0x0;var _0x2ecfbd=_0x48c4[_0x3cd381];return _0x2ecfbd;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x448c('0x0'),_0x448c('0x1')];function createListener(_0x1c8803,_0x10cd7f){return function(_0x188489){_0x10cd7f[_0x448c('0x2')](_0x1c8803,_0x188489);};}function removeListener(_0x2324e6,_0x20b36e){return function(){DashboardEvents[_0x448c('0x3')](_0x2324e6,_0x20b36e);};}exports[_0x448c('0x4')]=function(_0x50e13d){for(var _0x4783c0=0x0,_0x4af4ea=events[_0x448c('0x5')];_0x4783c0<_0x4af4ea;_0x4783c0++){var _0xfb5424=events[_0x4783c0];var _0xf9c2c4=createListener(_0x448c('0x6')+_0xfb5424,_0x50e13d);DashboardEvents['on'](_0xfb5424,_0xf9c2c4);}}; \ No newline at end of file +var _0x8d92=['remove','update','removeListener','register','dashboard:','./dashboard.events','save'];(function(_0x547f60,_0x34e56f){var _0x30d1c2=function(_0x578ca9){while(--_0x578ca9){_0x547f60['push'](_0x547f60['shift']());}};_0x30d1c2(++_0x34e56f);}(_0x8d92,0x171));var _0x28d9=function(_0xd07790,_0x3db009){_0xd07790=_0xd07790-0x0;var _0x32f10e=_0x8d92[_0xd07790];return _0x32f10e;};'use strict';var DashboardEvents=require(_0x28d9('0x0'));var events=[_0x28d9('0x1'),_0x28d9('0x2'),_0x28d9('0x3')];function createListener(_0x551604,_0x220e3a){return function(_0x583045){_0x220e3a['emit'](_0x551604,_0x583045);};}function removeListener(_0x6aba4,_0x2943d7){return function(){DashboardEvents[_0x28d9('0x4')](_0x6aba4,_0x2943d7);};}exports[_0x28d9('0x5')]=function(_0x38da31){for(var _0x10c34e=0x0,_0x3a4448=events['length'];_0x10c34e<_0x3a4448;_0x10c34e++){var _0x1d8276=events[_0x10c34e];var _0xc8da3e=createListener(_0x28d9('0x6')+_0x1d8276,_0x38da31);DashboardEvents['on'](_0x1d8276,_0xc8da3e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d2c52d6..2029dbf 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 _0xe3b3=['post','create','clone','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','isAuthenticated','show','getItems'];(function(_0x392f4a,_0x5eb726){var _0x57fb3a=function(_0x4ee1c8){while(--_0x4ee1c8){_0x392f4a['push'](_0x392f4a['shift']());}};_0x57fb3a(++_0x5eb726);}(_0xe3b3,0xcf));var _0x3e3b=function(_0xb4f000,_0x3abace){_0xb4f000=_0xb4f000-0x0;var _0x2c202e=_0xe3b3[_0xb4f000];return _0x2c202e;};'use strict';var multer=require(_0x3e3b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e3b('0x1'));var express=require(_0x3e3b('0x2'));var router=express['Router']();var fs_extra=require(_0x3e3b('0x3'));var auth=require(_0x3e3b('0x4'));var interaction=require(_0x3e3b('0x5'));var config=require(_0x3e3b('0x6'));var controller=require(_0x3e3b('0x7'));router[_0x3e3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x3e3b('0x9')]);router[_0x3e3b('0x8')]('/:id',auth[_0x3e3b('0xa')](),controller[_0x3e3b('0xb')]);router[_0x3e3b('0x8')]('/:id/items',auth['isAuthenticated'](),controller[_0x3e3b('0xc')]);router[_0x3e3b('0xd')]('/',auth[_0x3e3b('0xa')](),controller[_0x3e3b('0xe')]);router[_0x3e3b('0xd')]('/:id/clone',auth[_0x3e3b('0xa')](),controller[_0x3e3b('0xf')]);router[_0x3e3b('0xd')]('/:id/items',auth['isAuthenticated'](),controller['addItem']);router[_0x3e3b('0x10')](_0x3e3b('0x11'),auth[_0x3e3b('0xa')](),controller[_0x3e3b('0x12')]);router[_0x3e3b('0x13')]('/:id',auth[_0x3e3b('0xa')](),controller[_0x3e3b('0x14')]);module[_0x3e3b('0x15')]=router; \ No newline at end of file +var _0x5621=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','delete','destroy','exports','util','path'];(function(_0x1899af,_0x135672){var _0x2fc617=function(_0x28f1ac){while(--_0x28f1ac){_0x1899af['push'](_0x1899af['shift']());}};_0x2fc617(++_0x135672);}(_0x5621,0x9f));var _0x1562=function(_0x4573d3,_0x342207){_0x4573d3=_0x4573d3-0x0;var _0x8727e0=_0x5621[_0x4573d3];return _0x8727e0;};'use strict';var multer=require('multer');var util=require(_0x1562('0x0'));var path=require(_0x1562('0x1'));var timeout=require(_0x1562('0x2'));var express=require(_0x1562('0x3'));var router=express[_0x1562('0x4')]();var fs_extra=require(_0x1562('0x5'));var auth=require(_0x1562('0x6'));var interaction=require(_0x1562('0x7'));var config=require(_0x1562('0x8'));var controller=require(_0x1562('0x9'));router[_0x1562('0xa')]('/',auth[_0x1562('0xb')](),controller[_0x1562('0xc')]);router[_0x1562('0xa')](_0x1562('0xd'),auth[_0x1562('0xb')](),controller[_0x1562('0xe')]);router[_0x1562('0xa')](_0x1562('0xf'),auth['isAuthenticated'](),controller[_0x1562('0x10')]);router[_0x1562('0x11')]('/',auth['isAuthenticated'](),controller[_0x1562('0x12')]);router[_0x1562('0x11')](_0x1562('0x13'),auth[_0x1562('0xb')](),controller['clone']);router[_0x1562('0x11')](_0x1562('0xf'),auth['isAuthenticated'](),controller['addItem']);router['put'](_0x1562('0xd'),auth[_0x1562('0xb')](),controller['update']);router[_0x1562('0x14')](_0x1562('0xd'),auth[_0x1562('0xb')](),controller[_0x1562('0x15')]);module[_0x1562('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b14c8d2..0f03578 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 _0xdbf5=['squel','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x22b046,_0xecf865){var _0x5e40fe=function(_0x27c8eb){while(--_0x27c8eb){_0x22b046['push'](_0x22b046['shift']());}};_0x5e40fe(++_0xecf865);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x23f414,_0x3bce60){_0x23f414=_0x23f414-0x0;var _0xf719a6=_0xdbf5[_0x23f414];return _0xf719a6;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5dbf('0x0'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5dbf('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5dbf('0x2')](_0x5dbf('0x3')),'get':function(){try{return JSON[_0x5dbf('0x4')](this[_0x5dbf('0x5')](_0x5dbf('0x6')));}catch(_0x1decd2){return[];}},'set':function(_0x3f8628){try{this[_0x5dbf('0x7')](_0x5dbf('0x6'),JSON[_0x5dbf('0x8')](_0x3f8628));}catch(_0x93e657){this['setDataValue'](_0x5dbf('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5dbf('0x9')]},'col':{'type':Sequelize[_0x5dbf('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dbf('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5dbf('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x2a07=['setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x405e13,_0x1ed8d3){var _0x5eb8a5=function(_0x3fbeb0){while(--_0x3fbeb0){_0x405e13['push'](_0x405e13['shift']());}};_0x5eb8a5(++_0x1ed8d3);}(_0x2a07,0x74));var _0x72a0=function(_0x361475,_0x32ecc5){_0x361475=_0x361475-0x0;var _0x317cf1=_0x2a07[_0x361475];return _0x317cf1;};'use strict';var Sequelize=require(_0x72a0('0x0'));var squel=require(_0x72a0('0x1'));var _=require(_0x72a0('0x2'));module[_0x72a0('0x3')]={'title':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x72a0('0x5')](_0x72a0('0x6')),'get':function(){try{return JSON[_0x72a0('0x7')](this[_0x72a0('0x8')](_0x72a0('0x9')));}catch(_0xce74c){return[];}},'set':function(_0x3ccf6d){try{this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')](_0x3ccf6d));}catch(_0x21c819){this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x72a0('0xc')]},'background':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':_0x72a0('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x72a0('0x4')]},'titleFontSize':{'type':Sequelize[_0x72a0('0xc')],'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 109797f..a3ad570 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 _0x96fd=['attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','stringify','body','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./dashboardItem.socket','register','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','update','then','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','include','merge','options','DashboardItem','catch','destroy','find','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1'];(function(_0x22f214,_0x33adff){var _0x5a5b8a=function(_0x2c0798){while(--_0x2c0798){_0x22f214['push'](_0x22f214['shift']());}};_0x5a5b8a(++_0x33adff);}(_0x96fd,0x1e9));var _0xd96f=function(_0x19618a,_0x5f15e6){_0x19618a=_0x19618a-0x0;var _0x2e60e8=_0x96fd[_0x19618a];return _0x2e60e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd96f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd96f('0x1'));var rp=require(_0xd96f('0x2'));var moment=require('moment');var BPromise=require(_0xd96f('0x3'));var Mustache=require(_0xd96f('0x4'));var util=require(_0xd96f('0x5'));var path=require(_0xd96f('0x6'));var sox=require('sox');var csv=require(_0xd96f('0x7'));var ejs=require(_0xd96f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd96f('0x9'));var squel=require(_0xd96f('0xa'));var crypto=require(_0xd96f('0xb'));var jsforce=require(_0xd96f('0xc'));var deskjs=require(_0xd96f('0xd'));var toCsv=require(_0xd96f('0x7'));var querystring=require(_0xd96f('0xe'));var Papa=require(_0xd96f('0xf'));var Redis=require(_0xd96f('0x10'));var authService=require(_0xd96f('0x11'));var qs=require(_0xd96f('0x12'));var as=require(_0xd96f('0x13'));var hardwareService=require(_0xd96f('0x14'));var logger=require(_0xd96f('0x15'))(_0xd96f('0x16'));var utils=require(_0xd96f('0x17'));var config=require(_0xd96f('0x18'));var licenseUtil=require(_0xd96f('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd96f('0x1a')](config[_0xd96f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd96f('0x1b')]));require(_0xd96f('0x1c'))[_0xd96f('0x1d')](socket);function respondWithStatusCode(_0x46332d,_0x1c770a){_0x1c770a=_0x1c770a||0xcc;return function(_0x370c03){if(_0x370c03){return _0x46332d[_0xd96f('0x1e')](_0x1c770a);}return _0x46332d[_0xd96f('0x1f')](_0x1c770a)[_0xd96f('0x20')]();};}function respondWithResult(_0x28884d,_0x5e5e65){_0x5e5e65=_0x5e5e65||0xc8;return function(_0x1f6f36){if(_0x1f6f36){return _0x28884d[_0xd96f('0x1f')](_0x5e5e65)['json'](_0x1f6f36);}};}function respondWithFilteredResult(_0x19b141,_0x3420d6){return function(_0x45c990){if(_0x45c990){var _0x15d2d5=typeof _0x3420d6[_0xd96f('0x21')]===_0xd96f('0x22')&&typeof _0x3420d6['limit']===_0xd96f('0x22');var _0x392733=_0x45c990[_0xd96f('0x23')];var _0x519ad4=_0x15d2d5?0x0:_0x3420d6[_0xd96f('0x21')];var _0x1d80de=_0x15d2d5?_0x45c990[_0xd96f('0x23')]:_0x3420d6[_0xd96f('0x21')]+_0x3420d6[_0xd96f('0x24')];var _0x422e34;if(_0x1d80de>=_0x392733){_0x1d80de=_0x392733;_0x422e34=0xc8;}else{_0x422e34=0xce;}_0x19b141[_0xd96f('0x1f')](_0x422e34);return _0x19b141['set'](_0xd96f('0x25'),_0x519ad4+'-'+_0x1d80de+'/'+_0x392733)[_0xd96f('0x26')](_0x45c990);}return null;};}function patchUpdates(_0x4de2ef){return function(_0x3ea026){try{jsonpatch['apply'](_0x3ea026,_0x4de2ef,!![]);}catch(_0x39e7b2){return BPromise['reject'](_0x39e7b2);}return _0x3ea026['save']();};}function saveUpdates(_0x33a00c,_0x4f01b3){return function(_0x565f74){if(_0x565f74){return _0x565f74[_0xd96f('0x27')](_0x33a00c)[_0xd96f('0x28')](function(_0x1b4b26){return _0x1b4b26;});}return null;};}function removeEntity(_0x1a232d,_0xd4cfa){return function(_0xb12a56){if(_0xb12a56){return _0xb12a56['destroy']()[_0xd96f('0x28')](function(){_0x1a232d[_0xd96f('0x1f')](0xcc)[_0xd96f('0x20')]();});}};}function handleEntityNotFound(_0x1e9f49,_0xd4d095){return function(_0x3725cd){if(!_0x3725cd){_0x1e9f49[_0xd96f('0x1e')](0x194);}return _0x3725cd;};}function handleError(_0x24525e,_0x316d98){_0x316d98=_0x316d98||0x1f4;return function(_0x428961){logger[_0xd96f('0x29')](_0x428961[_0xd96f('0x2a')]);if(_0x428961[_0xd96f('0x2b')]){delete _0x428961[_0xd96f('0x2b')];}_0x24525e[_0xd96f('0x1f')](_0x316d98)[_0xd96f('0x2c')](_0x428961);};}exports[_0xd96f('0x2d')]=function(_0x160b0a,_0x22ef06){var _0x1738dd={'raw':![],'where':{'id':_0x160b0a[_0xd96f('0x2e')]['id']}},_0x497b02={};_0x497b02[_0xd96f('0x2f')]=_[_0xd96f('0x30')](db['DashboardItem'][_0xd96f('0x31')]);_0x497b02[_0xd96f('0x32')]=_[_0xd96f('0x30')](_0x160b0a['query']);_0x497b02[_0xd96f('0x33')]=_['intersection'](_0x497b02[_0xd96f('0x2f')],_0x497b02['query']);_0x1738dd[_0xd96f('0x34')]=_[_0xd96f('0x35')](_0x497b02[_0xd96f('0x2f')],qs[_0xd96f('0x36')](_0x160b0a[_0xd96f('0x32')][_0xd96f('0x36')]));_0x1738dd[_0xd96f('0x34')]=_0x1738dd['attributes']['length']?_0x1738dd[_0xd96f('0x34')]:_0x497b02['model'];if(_0x160b0a['query']['includeAll']){_0x1738dd[_0xd96f('0x37')]=[{'all':!![]}];}_0x1738dd=_[_0xd96f('0x38')]({},_0x1738dd,_0x160b0a[_0xd96f('0x39')]);return db[_0xd96f('0x3a')]['find'](_0x1738dd)[_0xd96f('0x28')](handleEntityNotFound(_0x22ef06,null))[_0xd96f('0x28')](respondWithResult(_0x22ef06,null))[_0xd96f('0x3b')](handleError(_0x22ef06,null));};exports[_0xd96f('0x3c')]=function(_0x2b3ee5,_0x475e64){return db[_0xd96f('0x3a')][_0xd96f('0x3d')]({'where':{'id':_0x2b3ee5[_0xd96f('0x2e')]['id']}})[_0xd96f('0x28')](handleEntityNotFound(_0x475e64,null))[_0xd96f('0x28')](removeEntity(_0x475e64,null))[_0xd96f('0x3b')](handleError(_0x475e64,null));};function widgetAttributes(_0x4b0573){try{switch(_0x4b0573[_0xd96f('0x3e')]){case _0xd96f('0x3f'):return[{'name':_0xd96f('0x40'),'value':_0x4b0573[_0xd96f('0x40')]||(_0x4b0573['attrs']&&_0x4b0573[_0xd96f('0x41')][0x0]?_0x4b0573[_0xd96f('0x41')][0x0][_0xd96f('0x42')]:undefined)||_0xd96f('0x43')}];case'custom':return[{'name':'attrPath','value':_0x4b0573[_0xd96f('0x44')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x0]?_0x4b0573[_0xd96f('0x41')][0x0]['value']:undefined)||''}];case _0xd96f('0x45'):return[{'name':_0xd96f('0x46'),'value':_0x4b0573['attrHourFormat']||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x0]?_0x4b0573[_0xd96f('0x41')][0x0][_0xd96f('0x42')]:undefined)||'HH:mm:ss'},{'name':_0xd96f('0x47'),'value':_0x4b0573['attrTimezone']||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x1]?_0x4b0573[_0xd96f('0x41')][0x1][_0xd96f('0x42')]:undefined)||'0.00'},{'name':_0xd96f('0x48'),'value':_0x4b0573[_0xd96f('0x48')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x2]?_0x4b0573[_0xd96f('0x41')][0x2][_0xd96f('0x42')]:undefined)||0xc}];case _0xd96f('0x49'):return[{'name':_0xd96f('0x4a'),'value':_0x4b0573[_0xd96f('0x4a')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x0]?_0x4b0573[_0xd96f('0x41')][0x0][_0xd96f('0x42')]:undefined)||_0xd96f('0x4b')},{'name':_0xd96f('0x4c'),'value':_0x4b0573[_0xd96f('0x4c')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x1]?_0x4b0573['attrs'][0x1]['value']:undefined)||[]},{'name':_0xd96f('0x48'),'value':_0x4b0573['attrFontSize']||(_0x4b0573['attrs']&&_0x4b0573[_0xd96f('0x41')][0x2]?_0x4b0573['attrs'][0x2][_0xd96f('0x42')]:undefined)||0x14},{'name':_0xd96f('0x4d'),'value':_0x4b0573[_0xd96f('0x4d')]||(_0x4b0573['attrs']&&_0x4b0573[_0xd96f('0x41')][0x3]?_0x4b0573[_0xd96f('0x41')][0x3][_0xd96f('0x42')]:undefined)||'voice'},{'name':_0xd96f('0x4e'),'value':_0x4b0573[_0xd96f('0x4e')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x4]?_0x4b0573[_0xd96f('0x41')][0x4][_0xd96f('0x42')]:undefined)||''},{'name':_0xd96f('0x4f'),'value':_0x4b0573[_0xd96f('0x4f')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x5]?_0x4b0573[_0xd96f('0x41')][0x5][_0xd96f('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x4b0573[_0xd96f('0x50')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x6]?_0x4b0573['attrs'][0x6][_0xd96f('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4b0573[_0xd96f('0x51')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x7]?_0x4b0573[_0xd96f('0x41')][0x7][_0xd96f('0x42')]:undefined)||''},{'name':_0xd96f('0x52'),'value':_0x4b0573[_0xd96f('0x52')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x8]?_0x4b0573[_0xd96f('0x41')][0x8][_0xd96f('0x42')]:undefined)||''},{'name':_0xd96f('0x53'),'value':_0x4b0573[_0xd96f('0x53')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x9]?_0x4b0573['attrs'][0x9][_0xd96f('0x42')]:undefined)||''}];case _0xd96f('0x54'):case _0xd96f('0x55'):return[{'name':_0xd96f('0x56'),'value':_0x4b0573['attrSerie1']||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573['attrs'][0x0]?_0x4b0573[_0xd96f('0x41')][0x0][_0xd96f('0x42')]:undefined)||_0xd96f('0x4b')},{'name':'attrSerie2','value':_0x4b0573[_0xd96f('0x57')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x1]?_0x4b0573[_0xd96f('0x41')][0x1]['value']:undefined)||null},{'name':_0xd96f('0x58'),'value':_0x4b0573[_0xd96f('0x58')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x2]?_0x4b0573[_0xd96f('0x41')][0x2][_0xd96f('0x42')]:undefined)||null},{'name':_0xd96f('0x4c'),'value':_0x4b0573['attrVoiceQueues']||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573['attrs'][0x3]?_0x4b0573[_0xd96f('0x41')][0x3]['value']:undefined)||[]},{'name':_0xd96f('0x4d'),'value':_0x4b0573[_0xd96f('0x4d')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x4]?_0x4b0573[_0xd96f('0x41')][0x4][_0xd96f('0x42')]:undefined)||_0xd96f('0x59')},{'name':_0xd96f('0x4e'),'value':_0x4b0573['attrEmailAccounts']||(_0x4b0573['attrs']&&_0x4b0573[_0xd96f('0x41')][0x5]?_0x4b0573[_0xd96f('0x41')][0x5][_0xd96f('0x42')]:undefined)||''},{'name':_0xd96f('0x4f'),'value':_0x4b0573['attrFaxAccounts']||(_0x4b0573['attrs']&&_0x4b0573[_0xd96f('0x41')][0x6]?_0x4b0573[_0xd96f('0x41')][0x6]['value']:undefined)||''},{'name':_0xd96f('0x50'),'value':_0x4b0573['attrSmsAccounts']||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x7]?_0x4b0573['attrs'][0x7][_0xd96f('0x42')]:undefined)||''},{'name':_0xd96f('0x51'),'value':_0x4b0573['attrOpenchannelAccounts']||(_0x4b0573['attrs']&&_0x4b0573[_0xd96f('0x41')][0x8]?_0x4b0573[_0xd96f('0x41')][0x8][_0xd96f('0x42')]:undefined)||''},{'name':_0xd96f('0x52'),'value':_0x4b0573['attrWhatsappAccounts']||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573['attrs'][0x9]?_0x4b0573[_0xd96f('0x41')][0x9][_0xd96f('0x42')]:undefined)||''},{'name':_0xd96f('0x53'),'value':_0x4b0573['attrChatWebsites']||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0xa]?_0x4b0573[_0xd96f('0x41')][0xa][_0xd96f('0x42')]:undefined)||''}];case _0xd96f('0x5a'):return[{'name':_0xd96f('0x5b'),'type':_0x4b0573[_0xd96f('0x5c')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x0]?_0x4b0573[_0xd96f('0x41')][0x0][_0xd96f('0x3e')]:undefined)||null,'value':_0x4b0573[_0xd96f('0x5b')]||(_0x4b0573[_0xd96f('0x41')]&&_0x4b0573[_0xd96f('0x41')][0x0]?_0x4b0573[_0xd96f('0x41')][0x0][_0xd96f('0x42')]:undefined)||null},{'name':_0xd96f('0x5d'),'value':_0x4b0573['attrRefresh']||(_0x4b0573['attrs']&&_0x4b0573[_0xd96f('0x41')][0x1]?_0x4b0573[_0xd96f('0x41')][0x1][_0xd96f('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x2c6d56){logger[_0xd96f('0x29')]('widgetAttributes:\x20%s',JSON[_0xd96f('0x5e')](_0x2c6d56));return[];}}exports['create']=function(_0x4f2e7b,_0x40baeb){if(_0x4f2e7b[_0xd96f('0x5f')]){_0x4f2e7b[_0xd96f('0x5f')][_0xd96f('0x41')]=widgetAttributes(_0x4f2e7b['body']);}return db[_0xd96f('0x3a')]['create'](_0x4f2e7b['body'],{})[_0xd96f('0x28')](respondWithResult(_0x40baeb,0xc9))['catch'](handleError(_0x40baeb,null));};exports['update']=function(_0x48a776,_0x44b052){if(_0x48a776[_0xd96f('0x5f')]['id']){delete _0x48a776['body']['id'];}_0x48a776[_0xd96f('0x5f')][_0xd96f('0x41')]=widgetAttributes(_0x48a776[_0xd96f('0x5f')]);return db[_0xd96f('0x3a')][_0xd96f('0x3d')]({'where':{'id':_0x48a776[_0xd96f('0x2e')]['id']}})[_0xd96f('0x28')](handleEntityNotFound(_0x44b052,null))[_0xd96f('0x28')](saveUpdates(_0x48a776[_0xd96f('0x5f')],null))['then'](respondWithResult(_0x44b052,null))['catch'](handleError(_0x44b052,null));}; \ No newline at end of file +var _0x27a0=['zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','show','params','keys','DashboardItem','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','catch','type','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrSerie1','attrSerie2','attrSerie3','voice','attrWhatsappAccounts','attrChatWebsites','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf'];(function(_0x33a587,_0x5dd997){var _0x56a0c1=function(_0x5b2ed8){while(--_0x5b2ed8){_0x33a587['push'](_0x33a587['shift']());}};_0x56a0c1(++_0x5dd997);}(_0x27a0,0xbf));var _0x027a=function(_0x15f3de,_0x17dd37){_0x15f3de=_0x15f3de-0x0;var _0x80ac31=_0x27a0[_0x15f3de];return _0x80ac31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x027a('0x0'));var zipdir=require(_0x027a('0x1'));var jsonpatch=require(_0x027a('0x2'));var rp=require(_0x027a('0x3'));var moment=require(_0x027a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x027a('0x5'));var csv=require(_0x027a('0x6'));var ejs=require(_0x027a('0x7'));var fs=require('fs');var fs_extra=require(_0x027a('0x8'));var _=require(_0x027a('0x9'));var squel=require(_0x027a('0xa'));var crypto=require('crypto');var jsforce=require(_0x027a('0xb'));var deskjs=require(_0x027a('0xc'));var toCsv=require(_0x027a('0x6'));var querystring=require('querystring');var Papa=require(_0x027a('0xd'));var Redis=require(_0x027a('0xe'));var authService=require(_0x027a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x027a('0x10'));var hardwareService=require(_0x027a('0x11'));var logger=require(_0x027a('0x12'))(_0x027a('0x13'));var utils=require(_0x027a('0x14'));var config=require(_0x027a('0x15'));var licenseUtil=require(_0x027a('0x16'));var db=require(_0x027a('0x17'))['db'];config[_0x027a('0x18')]=_[_0x027a('0x19')](config[_0x027a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x027a('0x1a'))(new Redis(config[_0x027a('0x18')]));require(_0x027a('0x1b'))[_0x027a('0x1c')](socket);function respondWithStatusCode(_0x40fec0,_0x5be540){_0x5be540=_0x5be540||0xcc;return function(_0x5b6165){if(_0x5b6165){return _0x40fec0[_0x027a('0x1d')](_0x5be540);}return _0x40fec0['status'](_0x5be540)[_0x027a('0x1e')]();};}function respondWithResult(_0x559d13,_0x432007){_0x432007=_0x432007||0xc8;return function(_0x5a1224){if(_0x5a1224){return _0x559d13['status'](_0x432007)['json'](_0x5a1224);}};}function respondWithFilteredResult(_0x588f53,_0x2f04e9){return function(_0x826d19){if(_0x826d19){var _0x1fb40b=typeof _0x2f04e9['offset']===_0x027a('0x1f')&&typeof _0x2f04e9[_0x027a('0x20')]==='undefined';var _0x4f8c3d=_0x826d19[_0x027a('0x21')];var _0x57cf67=_0x1fb40b?0x0:_0x2f04e9[_0x027a('0x22')];var _0x5b8fae=_0x1fb40b?_0x826d19['count']:_0x2f04e9['offset']+_0x2f04e9['limit'];var _0x18efe7;if(_0x5b8fae>=_0x4f8c3d){_0x5b8fae=_0x4f8c3d;_0x18efe7=0xc8;}else{_0x18efe7=0xce;}_0x588f53[_0x027a('0x23')](_0x18efe7);return _0x588f53[_0x027a('0x24')](_0x027a('0x25'),_0x57cf67+'-'+_0x5b8fae+'/'+_0x4f8c3d)['json'](_0x826d19);}return null;};}function patchUpdates(_0x2fb1d0){return function(_0x119a5c){try{jsonpatch[_0x027a('0x26')](_0x119a5c,_0x2fb1d0,!![]);}catch(_0x3dee99){return BPromise[_0x027a('0x27')](_0x3dee99);}return _0x119a5c[_0x027a('0x28')]();};}function saveUpdates(_0x595f0e,_0x27741f){return function(_0x5c281f){if(_0x5c281f){return _0x5c281f[_0x027a('0x29')](_0x595f0e)[_0x027a('0x2a')](function(_0x1b1a13){return _0x1b1a13;});}return null;};}function removeEntity(_0x83fe3e,_0x582943){return function(_0x559381){if(_0x559381){return _0x559381[_0x027a('0x2b')]()[_0x027a('0x2a')](function(){_0x83fe3e[_0x027a('0x23')](0xcc)[_0x027a('0x1e')]();});}};}function handleEntityNotFound(_0x511c7a,_0x1b5325){return function(_0x55a8cd){if(!_0x55a8cd){_0x511c7a[_0x027a('0x1d')](0x194);}return _0x55a8cd;};}function handleError(_0x488920,_0x2be389){_0x2be389=_0x2be389||0x1f4;return function(_0x4d5a25){logger['error'](_0x4d5a25[_0x027a('0x2c')]);if(_0x4d5a25['name']){delete _0x4d5a25['name'];}_0x488920[_0x027a('0x23')](_0x2be389)['send'](_0x4d5a25);};}exports[_0x027a('0x2d')]=function(_0x47c57a,_0x2640d8){var _0xc99acc={'raw':![],'where':{'id':_0x47c57a[_0x027a('0x2e')]['id']}},_0x4d9a29={};_0x4d9a29['model']=_[_0x027a('0x2f')](db[_0x027a('0x30')][_0x027a('0x31')]);_0x4d9a29[_0x027a('0x32')]=_[_0x027a('0x2f')](_0x47c57a[_0x027a('0x32')]);_0x4d9a29['filters']=_[_0x027a('0x33')](_0x4d9a29['model'],_0x4d9a29[_0x027a('0x32')]);_0xc99acc['attributes']=_[_0x027a('0x33')](_0x4d9a29[_0x027a('0x34')],qs[_0x027a('0x35')](_0x47c57a[_0x027a('0x32')][_0x027a('0x35')]));_0xc99acc['attributes']=_0xc99acc[_0x027a('0x36')][_0x027a('0x37')]?_0xc99acc[_0x027a('0x36')]:_0x4d9a29[_0x027a('0x34')];if(_0x47c57a[_0x027a('0x32')][_0x027a('0x38')]){_0xc99acc[_0x027a('0x39')]=[{'all':!![]}];}_0xc99acc=_[_0x027a('0x3a')]({},_0xc99acc,_0x47c57a[_0x027a('0x3b')]);return db[_0x027a('0x30')][_0x027a('0x3c')](_0xc99acc)['then'](handleEntityNotFound(_0x2640d8,null))[_0x027a('0x2a')](respondWithResult(_0x2640d8,null))[_0x027a('0x3d')](handleError(_0x2640d8,null));};exports[_0x027a('0x2b')]=function(_0x32c36e,_0x19b476){return db[_0x027a('0x30')][_0x027a('0x3c')]({'where':{'id':_0x32c36e['params']['id']}})[_0x027a('0x2a')](handleEntityNotFound(_0x19b476,null))[_0x027a('0x2a')](removeEntity(_0x19b476,null))[_0x027a('0x3d')](handleError(_0x19b476,null));};function widgetAttributes(_0x5e9130){try{switch(_0x5e9130[_0x027a('0x3e')]){case'iframe':return[{'name':_0x027a('0x3f'),'value':_0x5e9130[_0x027a('0x3f')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130['attrs'][0x0]?_0x5e9130['attrs'][0x0][_0x027a('0x41')]:undefined)||_0x027a('0x42')}];case'custom':return[{'name':_0x027a('0x43'),'value':_0x5e9130[_0x027a('0x43')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x0]?_0x5e9130[_0x027a('0x40')][0x0][_0x027a('0x41')]:undefined)||''}];case _0x027a('0x44'):return[{'name':_0x027a('0x45'),'value':_0x5e9130[_0x027a('0x45')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x0]?_0x5e9130[_0x027a('0x40')][0x0][_0x027a('0x41')]:undefined)||_0x027a('0x46')},{'name':_0x027a('0x47'),'value':_0x5e9130[_0x027a('0x47')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130['attrs'][0x1]?_0x5e9130[_0x027a('0x40')][0x1][_0x027a('0x41')]:undefined)||_0x027a('0x48')},{'name':_0x027a('0x49'),'value':_0x5e9130[_0x027a('0x49')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130['attrs'][0x2]?_0x5e9130[_0x027a('0x40')][0x2][_0x027a('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0x027a('0x4a'),'value':_0x5e9130['attrMetric']||(_0x5e9130['attrs']&&_0x5e9130[_0x027a('0x40')][0x0]?_0x5e9130['attrs'][0x0][_0x027a('0x41')]:undefined)||_0x027a('0x4b')},{'name':_0x027a('0x4c'),'value':_0x5e9130[_0x027a('0x4c')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130['attrs'][0x1]?_0x5e9130[_0x027a('0x40')][0x1][_0x027a('0x41')]:undefined)||[]},{'name':_0x027a('0x49'),'value':_0x5e9130['attrFontSize']||(_0x5e9130['attrs']&&_0x5e9130['attrs'][0x2]?_0x5e9130['attrs'][0x2][_0x027a('0x41')]:undefined)||0x14},{'name':_0x027a('0x4d'),'value':_0x5e9130[_0x027a('0x4d')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x3]?_0x5e9130[_0x027a('0x40')][0x3]['value']:undefined)||'voice'},{'name':_0x027a('0x4e'),'value':_0x5e9130[_0x027a('0x4e')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x4]?_0x5e9130[_0x027a('0x40')][0x4][_0x027a('0x41')]:undefined)||''},{'name':_0x027a('0x4f'),'value':_0x5e9130[_0x027a('0x4f')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130['attrs'][0x5]?_0x5e9130[_0x027a('0x40')][0x5][_0x027a('0x41')]:undefined)||''},{'name':_0x027a('0x50'),'value':_0x5e9130[_0x027a('0x50')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x6]?_0x5e9130[_0x027a('0x40')][0x6][_0x027a('0x41')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5e9130[_0x027a('0x51')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130['attrs'][0x7]?_0x5e9130[_0x027a('0x40')][0x7][_0x027a('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5e9130['attrWhatsappAccounts']||(_0x5e9130['attrs']&&_0x5e9130[_0x027a('0x40')][0x8]?_0x5e9130['attrs'][0x8][_0x027a('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5e9130['attrChatWebsites']||(_0x5e9130['attrs']&&_0x5e9130['attrs'][0x9]?_0x5e9130[_0x027a('0x40')][0x9][_0x027a('0x41')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x027a('0x52'),'value':_0x5e9130[_0x027a('0x52')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x0]?_0x5e9130['attrs'][0x0][_0x027a('0x41')]:undefined)||'total'},{'name':_0x027a('0x53'),'value':_0x5e9130[_0x027a('0x53')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x1]?_0x5e9130[_0x027a('0x40')][0x1][_0x027a('0x41')]:undefined)||null},{'name':_0x027a('0x54'),'value':_0x5e9130[_0x027a('0x54')]||(_0x5e9130['attrs']&&_0x5e9130[_0x027a('0x40')][0x2]?_0x5e9130[_0x027a('0x40')][0x2][_0x027a('0x41')]:undefined)||null},{'name':_0x027a('0x4c'),'value':_0x5e9130[_0x027a('0x4c')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x3]?_0x5e9130['attrs'][0x3][_0x027a('0x41')]:undefined)||[]},{'name':_0x027a('0x4d'),'value':_0x5e9130[_0x027a('0x4d')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x4]?_0x5e9130[_0x027a('0x40')][0x4][_0x027a('0x41')]:undefined)||_0x027a('0x55')},{'name':_0x027a('0x4e'),'value':_0x5e9130[_0x027a('0x4e')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x5]?_0x5e9130[_0x027a('0x40')][0x5][_0x027a('0x41')]:undefined)||''},{'name':_0x027a('0x4f'),'value':_0x5e9130['attrFaxAccounts']||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x6]?_0x5e9130[_0x027a('0x40')][0x6][_0x027a('0x41')]:undefined)||''},{'name':_0x027a('0x50'),'value':_0x5e9130[_0x027a('0x50')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x7]?_0x5e9130[_0x027a('0x40')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5e9130['attrOpenchannelAccounts']||(_0x5e9130['attrs']&&_0x5e9130[_0x027a('0x40')][0x8]?_0x5e9130[_0x027a('0x40')][0x8][_0x027a('0x41')]:undefined)||''},{'name':_0x027a('0x56'),'value':_0x5e9130[_0x027a('0x56')]||(_0x5e9130['attrs']&&_0x5e9130['attrs'][0x9]?_0x5e9130[_0x027a('0x40')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x5e9130[_0x027a('0x57')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0xa]?_0x5e9130[_0x027a('0x40')][0xa][_0x027a('0x41')]:undefined)||''}];case _0x027a('0x58'):return[{'name':_0x027a('0x59'),'type':_0x5e9130[_0x027a('0x5a')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130['attrs'][0x0]?_0x5e9130[_0x027a('0x40')][0x0][_0x027a('0x3e')]:undefined)||null,'value':_0x5e9130[_0x027a('0x59')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x0]?_0x5e9130[_0x027a('0x40')][0x0][_0x027a('0x41')]:undefined)||null},{'name':_0x027a('0x5b'),'value':_0x5e9130[_0x027a('0x5b')]||(_0x5e9130[_0x027a('0x40')]&&_0x5e9130[_0x027a('0x40')][0x1]?_0x5e9130[_0x027a('0x40')][0x1][_0x027a('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x1f547f){logger['error'](_0x027a('0x5c'),JSON[_0x027a('0x5d')](_0x1f547f));return[];}}exports[_0x027a('0x5e')]=function(_0x388626,_0x51afb8){if(_0x388626['body']){_0x388626[_0x027a('0x5f')][_0x027a('0x40')]=widgetAttributes(_0x388626[_0x027a('0x5f')]);}return db[_0x027a('0x30')][_0x027a('0x5e')](_0x388626[_0x027a('0x5f')],{})[_0x027a('0x2a')](respondWithResult(_0x51afb8,0xc9))[_0x027a('0x3d')](handleError(_0x51afb8,null));};exports[_0x027a('0x29')]=function(_0x5d629d,_0x40a920){if(_0x5d629d[_0x027a('0x5f')]['id']){delete _0x5d629d[_0x027a('0x5f')]['id'];}_0x5d629d['body'][_0x027a('0x40')]=widgetAttributes(_0x5d629d[_0x027a('0x5f')]);return db['DashboardItem'][_0x027a('0x3c')]({'where':{'id':_0x5d629d[_0x027a('0x2e')]['id']}})['then'](handleEntityNotFound(_0x40a920,null))['then'](saveUpdates(_0x5d629d[_0x027a('0x5f')],null))[_0x027a('0x2a')](respondWithResult(_0x40a920,null))[_0x027a('0x3d')](handleError(_0x40a920,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index b900fb2..0a3c9d7 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 _0xac8e=['hook','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2acbff,_0xa0d280){var _0xce6335=function(_0x5e09ba){while(--_0x5e09ba){_0x2acbff['push'](_0x2acbff['shift']());}};_0xce6335(++_0xa0d280);}(_0xac8e,0x19f));var _0xeac8=function(_0x21f94e,_0x54a04c){_0x21f94e=_0x21f94e-0x0;var _0x4395bf=_0xac8e[_0x21f94e];return _0x4395bf;};'use strict';var EventEmitter=require(_0xeac8('0x0'));var DashboardItem=require(_0xeac8('0x1'))['db'][_0xeac8('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xeac8('0x3')](0x0);var events={'afterCreate':_0xeac8('0x4'),'afterUpdate':_0xeac8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3aaf53){return function(_0x4e7e7d,_0x40c684,_0x4f51ca){DashboardItemEvents['emit'](_0x3aaf53+':'+_0x4e7e7d['id'],_0x4e7e7d);DashboardItemEvents[_0xeac8('0x6')](_0x3aaf53,_0x4e7e7d);_0x4f51ca(null);};}for(var e in events){if(events[_0xeac8('0x7')](e)){var event=events[e];DashboardItem[_0xeac8('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x22ab=['emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x105b21,_0x1636f1){var _0x727169=function(_0x23bdff){while(--_0x23bdff){_0x105b21['push'](_0x105b21['shift']());}};_0x727169(++_0x1636f1);}(_0x22ab,0x78));var _0xb22a=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0x22ab[_0x149f32];return _0x11f475;};'use strict';var EventEmitter=require(_0xb22a('0x0'));var DashboardItem=require(_0xb22a('0x1'))['db'][_0xb22a('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb22a('0x3')](0x0);var events={'afterCreate':_0xb22a('0x4'),'afterUpdate':_0xb22a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b1739){return function(_0x517e90,_0x40b42f,_0x45ca9e){DashboardItemEvents[_0xb22a('0x6')](_0x5b1739+':'+_0x517e90['id'],_0x517e90);DashboardItemEvents[_0xb22a('0x6')](_0x5b1739,_0x517e90);_0x45ca9e(null);};}for(var e in events){if(events[_0xb22a('0x7')](e)){var event=events[e];DashboardItem[_0xb22a('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index c891f02..4a13e67 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 _0x74ce=['util','../../config/logger','moment','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash'];(function(_0x1f1559,_0x30e911){var _0x5726ac=function(_0x5d39a6){while(--_0x5d39a6){_0x1f1559['push'](_0x1f1559['shift']());}};_0x5726ac(++_0x30e911);}(_0x74ce,0x8e));var _0xe74c=function(_0x4f3e56,_0x54b19d){_0x4f3e56=_0x4f3e56-0x0;var _0x5643a9=_0x74ce[_0x4f3e56];return _0x5643a9;};'use strict';var _=require(_0xe74c('0x0'));var util=require(_0xe74c('0x1'));var logger=require(_0xe74c('0x2'))('api');var moment=require(_0xe74c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe74c('0x4'));var fs=require('fs');var path=require(_0xe74c('0x5'));var rimraf=require('rimraf');var config=require(_0xe74c('0x6'));var attributes=require(_0xe74c('0x7'));module[_0xe74c('0x8')]=function(_0x5a19f8,_0x1d436b){return _0x5a19f8[_0xe74c('0x9')]('DashboardItem',attributes,{'tableName':_0xe74c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x885e=['api','moment','bluebird','request-promise','path','./dashboardItem.attributes','exports','DashboardItem','lodash','util'];(function(_0x554bf8,_0x23c5bb){var _0x395655=function(_0x3b71dd){while(--_0x3b71dd){_0x554bf8['push'](_0x554bf8['shift']());}};_0x395655(++_0x23c5bb);}(_0x885e,0xe4));var _0xe885=function(_0x3e1613,_0x43abac){_0x3e1613=_0x3e1613-0x0;var _0x71cc3c=_0x885e[_0x3e1613];return _0x71cc3c;};'use strict';var _=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var logger=require('../../config/logger')(_0xe885('0x2'));var moment=require(_0xe885('0x3'));var BPromise=require(_0xe885('0x4'));var rp=require(_0xe885('0x5'));var fs=require('fs');var path=require(_0xe885('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe885('0x7'));module[_0xe885('0x8')]=function(_0x33286a,_0x1a5fd6){return _0x33286a['define'](_0xe885('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 802bc20..0617c10 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 _0xe9c3=['request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register'];(function(_0x44dfa0,_0x298ef5){var _0x43d183=function(_0x37e489){while(--_0x37e489){_0x44dfa0['push'](_0x44dfa0['shift']());}};_0x43d183(++_0x298ef5);}(_0xe9c3,0x1a1));var _0x3e9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e9c('0x0'));var util=require(_0x3e9c('0x1'));var moment=require('moment');var BPromise=require(_0x3e9c('0x2'));var rs=require(_0x3e9c('0x3'));var fs=require('fs');var Redis=require(_0x3e9c('0x4'));var db=require(_0x3e9c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3e9c('0x6'));var config=require(_0x3e9c('0x7'));var jayson=require(_0x3e9c('0x8'));var client=jayson['client'][_0x3e9c('0x9')]({'port':0x232a});config[_0x3e9c('0xa')]=_[_0x3e9c('0xb')](config[_0x3e9c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e9c('0xc'))(new Redis(config[_0x3e9c('0xa')]));require(_0x3e9c('0xd'))[_0x3e9c('0xe')](socket);function respondWithRpcPromise(_0x4c8adb,_0x1dca58,_0x49163c){return new BPromise(function(_0x424bfa,_0x2ab028){return client[_0x3e9c('0xf')](_0x4c8adb,_0x49163c)[_0x3e9c('0x10')](function(_0x173f52){logger[_0x3e9c('0x11')](_0x3e9c('0x12'),_0x1dca58,_0x3e9c('0x13'));logger[_0x3e9c('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1dca58,'request\x20sent',JSON[_0x3e9c('0x15')](_0x173f52));if(_0x173f52[_0x3e9c('0x16')]){if(_0x173f52[_0x3e9c('0x16')][_0x3e9c('0x17')]===0x1f4){logger[_0x3e9c('0x16')](_0x3e9c('0x12'),_0x1dca58,_0x173f52[_0x3e9c('0x16')]['message']);return _0x2ab028(_0x173f52['error'][_0x3e9c('0x18')]);}logger[_0x3e9c('0x16')](_0x3e9c('0x12'),_0x1dca58,_0x173f52['error']['message']);return _0x424bfa(_0x173f52[_0x3e9c('0x16')]['message']);}else{logger[_0x3e9c('0x11')]('DashboardItem,\x20%s,\x20%s',_0x1dca58,'request\x20sent');_0x424bfa(_0x173f52[_0x3e9c('0x19')]['message']);}})[_0x3e9c('0x1a')](function(_0x179c96){logger['error'](_0x3e9c('0x12'),_0x1dca58,_0x179c96);_0x2ab028(_0x179c96);});});} \ No newline at end of file +var _0x72a3=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x3b9239,_0x8a3048){var _0xc977da=function(_0x8cecf8){while(--_0x8cecf8){_0x3b9239['push'](_0x3b9239['shift']());}};_0xc977da(++_0x8a3048);}(_0x72a3,0x82));var _0x372a=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x72a3[_0x2675da];return _0x5e6153;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x372a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x372a('0x1'));var db=require(_0x372a('0x2'))['db'];var utils=require(_0x372a('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x372a('0x4'));var jayson=require(_0x372a('0x5'));var client=jayson[_0x372a('0x6')][_0x372a('0x7')]({'port':0x232a});config[_0x372a('0x8')]=_[_0x372a('0x9')](config['redis'],{'host':_0x372a('0xa'),'port':0x18eb});var socket=require(_0x372a('0xb'))(new Redis(config['redis']));require(_0x372a('0xc'))[_0x372a('0xd')](socket);function respondWithRpcPromise(_0x251108,_0x5772b6,_0x1b4e08){return new BPromise(function(_0x1f1b3f,_0x41904b){return client[_0x372a('0xe')](_0x251108,_0x1b4e08)[_0x372a('0xf')](function(_0x434e58){logger[_0x372a('0x10')](_0x372a('0x11'),_0x5772b6,_0x372a('0x12'));logger[_0x372a('0x13')](_0x372a('0x14'),_0x5772b6,_0x372a('0x12'),JSON[_0x372a('0x15')](_0x434e58));if(_0x434e58['error']){if(_0x434e58[_0x372a('0x16')][_0x372a('0x17')]===0x1f4){logger[_0x372a('0x16')](_0x372a('0x11'),_0x5772b6,_0x434e58['error'][_0x372a('0x18')]);return _0x41904b(_0x434e58[_0x372a('0x16')][_0x372a('0x18')]);}logger[_0x372a('0x16')](_0x372a('0x11'),_0x5772b6,_0x434e58['error'][_0x372a('0x18')]);return _0x1f1b3f(_0x434e58[_0x372a('0x16')][_0x372a('0x18')]);}else{logger[_0x372a('0x10')]('DashboardItem,\x20%s,\x20%s',_0x5772b6,_0x372a('0x12'));_0x1f1b3f(_0x434e58[_0x372a('0x19')][_0x372a('0x18')]);}})[_0x372a('0x1a')](function(_0x4eed78){logger[_0x372a('0x16')](_0x372a('0x11'),_0x5772b6,_0x4eed78);_0x41904b(_0x4eed78);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 30a87cc..72968c8 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 _0xb670=['register','length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener'];(function(_0x5d660b,_0x2b6023){var _0x29263a=function(_0x2320ff){while(--_0x2320ff){_0x5d660b['push'](_0x5d660b['shift']());}};_0x29263a(++_0x2b6023);}(_0xb670,0x183));var _0x0b67=function(_0x517930,_0x5113ce){_0x517930=_0x517930-0x0;var _0x40b258=_0xb670[_0x517930];return _0x40b258;};'use strict';var DashboardItemEvents=require(_0x0b67('0x0'));var events=['save',_0x0b67('0x1'),_0x0b67('0x2')];function createListener(_0x57c514,_0x3a94f6){return function(_0x26eb4f){_0x3a94f6[_0x0b67('0x3')](_0x57c514,_0x26eb4f);};}function removeListener(_0x41a9fb,_0x23e498){return function(){DashboardItemEvents[_0x0b67('0x4')](_0x41a9fb,_0x23e498);};}exports[_0x0b67('0x5')]=function(_0xd1f091){for(var _0x219147=0x0,_0x59ae51=events[_0x0b67('0x6')];_0x219147<_0x59ae51;_0x219147++){var _0x484367=events[_0x219147];var _0xfd5d8=createListener(_0x0b67('0x7')+_0x484367,_0xd1f091);DashboardItemEvents['on'](_0x484367,_0xfd5d8);}}; \ No newline at end of file +var _0x4685=['removeListener','register','dashboardItem:','save','remove','update','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4685,0x6c));var _0x5468=function(_0x121cfc,_0x151933){_0x121cfc=_0x121cfc-0x0;var _0x10e5d0=_0x4685[_0x121cfc];return _0x10e5d0;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x5468('0x0'),_0x5468('0x1'),_0x5468('0x2')];function createListener(_0x321f27,_0x474b43){return function(_0xd7b14f){_0x474b43[_0x5468('0x3')](_0x321f27,_0xd7b14f);};}function removeListener(_0x47ac53,_0x1fa3ba){return function(){DashboardItemEvents[_0x5468('0x4')](_0x47ac53,_0x1fa3ba);};}exports[_0x5468('0x5')]=function(_0x514f03){for(var _0x4b514b=0x0,_0x1edcc4=events['length'];_0x4b514b<_0x1edcc4;_0x4b514b++){var _0x3db20c=events[_0x4b514b];var _0x4a94b4=createListener(_0x5468('0x6')+_0x3db20c,_0x514f03);DashboardItemEvents['on'](_0x3db20c,_0x4a94b4);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 7347779..8839f0b 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 _0xb8e1=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb8e1,0x10f));var _0x1b8e=function(_0x407ae9,_0x24b68d){_0x407ae9=_0x407ae9-0x0;var _0x135f55=_0xb8e1[_0x407ae9];return _0x135f55;};'use strict';var multer=require(_0x1b8e('0x0'));var util=require(_0x1b8e('0x1'));var path=require(_0x1b8e('0x2'));var timeout=require(_0x1b8e('0x3'));var express=require(_0x1b8e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1b8e('0x5'));var interaction=require(_0x1b8e('0x6'));var config=require(_0x1b8e('0x7'));var controller=require(_0x1b8e('0x8'));router[_0x1b8e('0x9')](_0x1b8e('0xa'),auth[_0x1b8e('0xb')](),controller[_0x1b8e('0xc')]);router[_0x1b8e('0xd')]('/',auth[_0x1b8e('0xb')](),controller[_0x1b8e('0xe')]);router[_0x1b8e('0xf')](_0x1b8e('0xa'),auth['isAuthenticated'](),controller[_0x1b8e('0x10')]);router[_0x1b8e('0x11')](_0x1b8e('0xa'),auth[_0x1b8e('0xb')](),controller[_0x1b8e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd36e=['fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','post','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xfe76e,_0x5dcf8d){var _0x559429=function(_0x32dceb){while(--_0x32dceb){_0xfe76e['push'](_0xfe76e['shift']());}};_0x559429(++_0x5dcf8d);}(_0xd36e,0xb8));var _0xed36=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd36e[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xed36('0x0'));var util=require(_0xed36('0x1'));var path=require(_0xed36('0x2'));var timeout=require(_0xed36('0x3'));var express=require(_0xed36('0x4'));var router=express[_0xed36('0x5')]();var fs_extra=require(_0xed36('0x6'));var auth=require(_0xed36('0x7'));var interaction=require(_0xed36('0x8'));var config=require('../../config/environment');var controller=require(_0xed36('0x9'));router[_0xed36('0xa')](_0xed36('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xed36('0xc')]('/',auth[_0xed36('0xd')](),controller[_0xed36('0xe')]);router[_0xed36('0xf')](_0xed36('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xed36('0x10')](_0xed36('0xb'),auth[_0xed36('0xd')](),controller[_0xed36('0x11')]);module[_0xed36('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 47bed9e..a108d23 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 _0x041b=['second','third','first','STRING','sequelize','exports','ENUM'];(function(_0x19323e,_0x163042){var _0xf54fa6=function(_0x421f6d){while(--_0x421f6d){_0x19323e['push'](_0x19323e['shift']());}};_0xf54fa6(++_0x163042);}(_0x041b,0x10e));var _0xb041=function(_0x1f39bc,_0x5cab32){_0x1f39bc=_0x1f39bc-0x0;var _0x24a85a=_0x041b[_0x1f39bc];return _0x24a85a;};'use strict';var Sequelize=require(_0xb041('0x0'));module[_0xb041('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xb041('0x2')]('first',_0xb041('0x3'),_0xb041('0x4')),'allowNull':![],'defaultValue':_0xb041('0x5')},'description':{'type':Sequelize[_0xb041('0x6')]}}; \ No newline at end of file +var _0x50da=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x2e88e3,_0xe1412e){var _0x4894f5=function(_0x4f05a1){while(--_0x4f05a1){_0x2e88e3['push'](_0x2e88e3['shift']());}};_0x4894f5(++_0xe1412e);}(_0x50da,0xf6));var _0xa50d=function(_0x5039c0,_0x591ecc){_0x5039c0=_0x5039c0-0x0;var _0xeb8a1c=_0x50da[_0x5039c0];return _0xeb8a1c;};'use strict';var Sequelize=require(_0xa50d('0x0'));module[_0xa50d('0x1')]={'name':{'type':Sequelize[_0xa50d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xa50d('0x3')](_0xa50d('0x4'),_0xa50d('0x5'),_0xa50d('0x6')),'allowNull':![],'defaultValue':_0xa50d('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index bee278e..3687c71 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 _0xf771=['sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','save','update','then','Dispositions','destroy','error','stack','name','send','map','Disposition','fieldName','type','key','model','keys','attributes','intersection','fields','length','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','findAll','rows','show','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf771,0x8e));var _0x1f77=function(_0x2056da,_0x433665){_0x2056da=_0x2056da-0x0;var _0x696728=_0xf771[_0x2056da];return _0x696728;};'use strict';var emlformat=require(_0x1f77('0x0'));var rimraf=require(_0x1f77('0x1'));var zipdir=require(_0x1f77('0x2'));var jsonpatch=require(_0x1f77('0x3'));var rp=require(_0x1f77('0x4'));var moment=require(_0x1f77('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1f77('0x6'));var util=require(_0x1f77('0x7'));var path=require(_0x1f77('0x8'));var sox=require(_0x1f77('0x9'));var csv=require(_0x1f77('0xa'));var ejs=require(_0x1f77('0xb'));var fs=require('fs');var fs_extra=require(_0x1f77('0xc'));var _=require('lodash');var squel=require(_0x1f77('0xd'));var crypto=require(_0x1f77('0xe'));var jsforce=require(_0x1f77('0xf'));var deskjs=require(_0x1f77('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1f77('0x11'));var Papa=require(_0x1f77('0x12'));var Redis=require(_0x1f77('0x13'));var authService=require(_0x1f77('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1f77('0x15'));var hardwareService=require(_0x1f77('0x16'));var logger=require(_0x1f77('0x17'))('api');var utils=require(_0x1f77('0x18'));var config=require(_0x1f77('0x19'));var licenseUtil=require(_0x1f77('0x1a'));var db=require(_0x1f77('0x1b'))['db'];function respondWithStatusCode(_0x27d779,_0x283093){_0x283093=_0x283093||0xcc;return function(_0x3ad570){if(_0x3ad570){return _0x27d779[_0x1f77('0x1c')](_0x283093);}return _0x27d779[_0x1f77('0x1d')](_0x283093)[_0x1f77('0x1e')]();};}function respondWithResult(_0x1542e9,_0x1fd90c){_0x1fd90c=_0x1fd90c||0xc8;return function(_0x53792e){if(_0x53792e){return _0x1542e9[_0x1f77('0x1d')](_0x1fd90c)[_0x1f77('0x1f')](_0x53792e);}};}function respondWithFilteredResult(_0x37215a,_0x664165){return function(_0x5419e5){if(_0x5419e5){var _0x5676aa=typeof _0x664165['offset']==='undefined'&&typeof _0x664165[_0x1f77('0x20')]===_0x1f77('0x21');var _0x17a736=_0x5419e5['count'];var _0x64000e=_0x5676aa?0x0:_0x664165['offset'];var _0x45f1d0=_0x5676aa?_0x5419e5['count']:_0x664165[_0x1f77('0x22')]+_0x664165['limit'];var _0x520da8;if(_0x45f1d0>=_0x17a736){_0x45f1d0=_0x17a736;_0x520da8=0xc8;}else{_0x520da8=0xce;}_0x37215a[_0x1f77('0x1d')](_0x520da8);return _0x37215a[_0x1f77('0x23')](_0x1f77('0x24'),_0x64000e+'-'+_0x45f1d0+'/'+_0x17a736)[_0x1f77('0x1f')](_0x5419e5);}return null;};}function patchUpdates(_0x566ba4){return function(_0x157ac0){try{jsonpatch[_0x1f77('0x25')](_0x157ac0,_0x566ba4,!![]);}catch(_0x149b1b){return BPromise['reject'](_0x149b1b);}return _0x157ac0[_0x1f77('0x26')]();};}function saveUpdates(_0x5c2ff3,_0xf4588d){return function(_0x537e72){if(_0x537e72){return _0x537e72[_0x1f77('0x27')](_0x5c2ff3)[_0x1f77('0x28')](function(_0x27644b){return _0x27644b;});}return null;};}function removeEntity(_0x5b0884,_0x3973a5){return function(_0x2f63d7){if(_0x2f63d7){return _0x2f63d7['destroy']()['then'](function(){var _0x59dfeb=_0x2f63d7['get']({'plain':!![]});var _0x48cabe=_0x1f77('0x29');return db['UserProfileResource'][_0x1f77('0x2a')]({'where':{'type':_0x48cabe,'resourceId':_0x59dfeb['id']}})[_0x1f77('0x28')](function(){return _0x2f63d7;});})['then'](function(){_0x5b0884['status'](0xcc)[_0x1f77('0x1e')]();});}};}function handleEntityNotFound(_0x5c4629,_0x2e9334){return function(_0xd5c1e4){if(!_0xd5c1e4){_0x5c4629['sendStatus'](0x194);}return _0xd5c1e4;};}function handleError(_0x3ac302,_0x8d7d25){_0x8d7d25=_0x8d7d25||0x1f4;return function(_0x29268){logger[_0x1f77('0x2b')](_0x29268[_0x1f77('0x2c')]);if(_0x29268[_0x1f77('0x2d')]){delete _0x29268[_0x1f77('0x2d')];}_0x3ac302[_0x1f77('0x1d')](_0x8d7d25)[_0x1f77('0x2e')](_0x29268);};}exports['index']=function(_0x1b7787,_0x56951){var _0x39ace8={},_0x1313f9={},_0x233294={'count':0x0,'rows':[]};var _0xf46df4=_[_0x1f77('0x2f')](db[_0x1f77('0x30')]['rawAttributes'],function(_0x480198){return{'name':_0x480198[_0x1f77('0x31')],'type':_0x480198[_0x1f77('0x32')][_0x1f77('0x33')]};});_0x1313f9[_0x1f77('0x34')]=_[_0x1f77('0x2f')](_0xf46df4,'name');_0x1313f9['query']=_[_0x1f77('0x35')](_0x1b7787['query']);_0x1313f9['filters']=_['intersection'](_0x1313f9[_0x1f77('0x34')],_0x1313f9['query']);_0x39ace8[_0x1f77('0x36')]=_[_0x1f77('0x37')](_0x1313f9[_0x1f77('0x34')],qs[_0x1f77('0x38')](_0x1b7787['query'][_0x1f77('0x38')]));_0x39ace8['attributes']=_0x39ace8['attributes'][_0x1f77('0x39')]?_0x39ace8[_0x1f77('0x36')]:_0x1313f9[_0x1f77('0x34')];if(!_0x1b7787[_0x1f77('0x3a')][_0x1f77('0x3b')](_0x1f77('0x3c'))){_0x39ace8['limit']=qs[_0x1f77('0x20')](_0x1b7787['query'][_0x1f77('0x20')]);_0x39ace8[_0x1f77('0x22')]=qs[_0x1f77('0x22')](_0x1b7787[_0x1f77('0x3a')][_0x1f77('0x22')]);}_0x39ace8[_0x1f77('0x3d')]=qs[_0x1f77('0x3e')](_0x1b7787[_0x1f77('0x3a')][_0x1f77('0x3e')]);_0x39ace8[_0x1f77('0x3f')]=qs[_0x1f77('0x40')](_[_0x1f77('0x41')](_0x1b7787[_0x1f77('0x3a')],_0x1313f9[_0x1f77('0x40')]),_0xf46df4);if(_0x1b7787[_0x1f77('0x3a')][_0x1f77('0x42')]){_0x39ace8[_0x1f77('0x3f')]=_[_0x1f77('0x43')](_0x39ace8[_0x1f77('0x3f')],{'$or':_[_0x1f77('0x2f')](_0xf46df4,function(_0x1bfbb5){if(_0x1bfbb5[_0x1f77('0x32')]!=='VIRTUAL'){var _0x1ce3cc={};_0x1ce3cc[_0x1bfbb5[_0x1f77('0x2d')]]={'$like':'%'+_0x1b7787['query'][_0x1f77('0x42')]+'%'};return _0x1ce3cc;}})});}_0x39ace8=_['merge']({},_0x39ace8,_0x1b7787[_0x1f77('0x44')]);var _0x24ff61={'where':_0x39ace8[_0x1f77('0x3f')]};return db['Disposition'][_0x1f77('0x45')](_0x24ff61)[_0x1f77('0x28')](function(_0x1bdda9){_0x233294['count']=_0x1bdda9;if(_0x1b7787[_0x1f77('0x3a')]['includeAll']){_0x39ace8['include']=[{'all':!![]}];}return db[_0x1f77('0x30')][_0x1f77('0x46')](_0x39ace8);})[_0x1f77('0x28')](function(_0x292ec1){_0x233294[_0x1f77('0x47')]=_0x292ec1;return _0x233294;})[_0x1f77('0x28')](respondWithFilteredResult(_0x56951,_0x39ace8))['catch'](handleError(_0x56951,null));};exports[_0x1f77('0x48')]=function(_0x60c9c4,_0x117bb4){var _0x36c2fc={'raw':!![],'where':{'id':_0x60c9c4['params']['id']}},_0x543793={};_0x543793[_0x1f77('0x34')]=_[_0x1f77('0x35')](db['Disposition'][_0x1f77('0x49')]);_0x543793[_0x1f77('0x3a')]=_['keys'](_0x60c9c4[_0x1f77('0x3a')]);_0x543793['filters']=_['intersection'](_0x543793['model'],_0x543793[_0x1f77('0x3a')]);_0x36c2fc[_0x1f77('0x36')]=_['intersection'](_0x543793[_0x1f77('0x34')],qs[_0x1f77('0x38')](_0x60c9c4[_0x1f77('0x3a')][_0x1f77('0x38')]));_0x36c2fc[_0x1f77('0x36')]=_0x36c2fc[_0x1f77('0x36')][_0x1f77('0x39')]?_0x36c2fc[_0x1f77('0x36')]:_0x543793[_0x1f77('0x34')];if(_0x60c9c4['query']['includeAll']){_0x36c2fc['include']=[{'all':!![]}];}_0x36c2fc=_[_0x1f77('0x43')]({},_0x36c2fc,_0x60c9c4[_0x1f77('0x44')]);return db[_0x1f77('0x30')]['find'](_0x36c2fc)[_0x1f77('0x28')](handleEntityNotFound(_0x117bb4,null))['then'](respondWithResult(_0x117bb4,null))[_0x1f77('0x4a')](handleError(_0x117bb4,null));};exports[_0x1f77('0x4b')]=function(_0x487eb2,_0x37e703){return db[_0x1f77('0x30')][_0x1f77('0x4b')](_0x487eb2[_0x1f77('0x4c')],{})[_0x1f77('0x28')](function(_0x18b0fc){var _0x369d95=_0x487eb2[_0x1f77('0x4d')][_0x1f77('0x4e')]({'plain':!![]});if(!_0x369d95)throw new Error(_0x1f77('0x4f'));if(_0x369d95[_0x1f77('0x50')]==='user'){var _0x2bae06=_0x18b0fc[_0x1f77('0x4e')]({'plain':!![]});var _0x501be1=_0x1f77('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x501be1,'userProfileId':_0x369d95['userProfileId']},'raw':!![]})[_0x1f77('0x28')](function(_0x48f446){if(_0x48f446&&_0x48f446[_0x1f77('0x51')]===0x0){return db['UserProfileResource'][_0x1f77('0x4b')]({'name':_0x2bae06['name'],'resourceId':_0x2bae06['id'],'type':_0x48f446[_0x1f77('0x2d')],'sectionId':_0x48f446['id']},{})['then'](function(){return _0x18b0fc;});}else{return _0x18b0fc;}})[_0x1f77('0x4a')](function(_0x3ea17c){logger['error'](_0x1f77('0x52'),_0x3ea17c);throw _0x3ea17c;});}return _0x18b0fc;})['then'](respondWithResult(_0x37e703,0xc9))[_0x1f77('0x4a')](handleError(_0x37e703,null));};exports[_0x1f77('0x27')]=function(_0xe7c839,_0x5088c2){if(_0xe7c839['body']['id']){delete _0xe7c839[_0x1f77('0x4c')]['id'];}return db['Disposition'][_0x1f77('0x53')]({'where':{'id':_0xe7c839[_0x1f77('0x54')]['id']}})['then'](handleEntityNotFound(_0x5088c2,null))['then'](saveUpdates(_0xe7c839[_0x1f77('0x4c')],null))[_0x1f77('0x28')](respondWithResult(_0x5088c2,null))[_0x1f77('0x4a')](handleError(_0x5088c2,null));};exports[_0x1f77('0x2a')]=function(_0x252b4a,_0x3fc730){return db[_0x1f77('0x30')][_0x1f77('0x53')]({'where':{'id':_0x252b4a[_0x1f77('0x54')]['id']}})[_0x1f77('0x28')](handleEntityNotFound(_0x3fc730,null))['then'](removeEntity(_0x3fc730,null))[_0x1f77('0x4a')](handleError(_0x3fc730,null));}; \ No newline at end of file +var _0xe590=['intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','filters'];(function(_0x2c2453,_0x53f72a){var _0x85af7b=function(_0x1b38b4){while(--_0x1b38b4){_0x2c2453['push'](_0x2c2453['shift']());}};_0x85af7b(++_0x53f72a);}(_0xe590,0xca));var _0x0e59=function(_0x513acb,_0x36810e){_0x513acb=_0x513acb-0x0;var _0x13dc90=_0xe590[_0x513acb];return _0x13dc90;};'use strict';var emlformat=require(_0x0e59('0x0'));var rimraf=require(_0x0e59('0x1'));var zipdir=require(_0x0e59('0x2'));var jsonpatch=require(_0x0e59('0x3'));var rp=require(_0x0e59('0x4'));var moment=require(_0x0e59('0x5'));var BPromise=require(_0x0e59('0x6'));var Mustache=require(_0x0e59('0x7'));var util=require(_0x0e59('0x8'));var path=require(_0x0e59('0x9'));var sox=require('sox');var csv=require(_0x0e59('0xa'));var ejs=require(_0x0e59('0xb'));var fs=require('fs');var fs_extra=require(_0x0e59('0xc'));var _=require('lodash');var squel=require(_0x0e59('0xd'));var crypto=require('crypto');var jsforce=require(_0x0e59('0xe'));var deskjs=require(_0x0e59('0xf'));var toCsv=require(_0x0e59('0xa'));var querystring=require(_0x0e59('0x10'));var Papa=require(_0x0e59('0x11'));var Redis=require(_0x0e59('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0e59('0x13'));var hardwareService=require(_0x0e59('0x14'));var logger=require(_0x0e59('0x15'))(_0x0e59('0x16'));var utils=require(_0x0e59('0x17'));var config=require(_0x0e59('0x18'));var licenseUtil=require(_0x0e59('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33fa46,_0x562519){_0x562519=_0x562519||0xcc;return function(_0x2421a1){if(_0x2421a1){return _0x33fa46[_0x0e59('0x1a')](_0x562519);}return _0x33fa46[_0x0e59('0x1b')](_0x562519)[_0x0e59('0x1c')]();};}function respondWithResult(_0x3d6fc2,_0x27b1ad){_0x27b1ad=_0x27b1ad||0xc8;return function(_0x1c72d4){if(_0x1c72d4){return _0x3d6fc2[_0x0e59('0x1b')](_0x27b1ad)[_0x0e59('0x1d')](_0x1c72d4);}};}function respondWithFilteredResult(_0x4f3b7d,_0x1867ff){return function(_0x5c267e){if(_0x5c267e){var _0x43fd9a=typeof _0x1867ff[_0x0e59('0x1e')]===_0x0e59('0x1f')&&typeof _0x1867ff['limit']==='undefined';var _0x141d8e=_0x5c267e[_0x0e59('0x20')];var _0x234936=_0x43fd9a?0x0:_0x1867ff[_0x0e59('0x1e')];var _0x3feea2=_0x43fd9a?_0x5c267e[_0x0e59('0x20')]:_0x1867ff['offset']+_0x1867ff[_0x0e59('0x21')];var _0x348dd0;if(_0x3feea2>=_0x141d8e){_0x3feea2=_0x141d8e;_0x348dd0=0xc8;}else{_0x348dd0=0xce;}_0x4f3b7d['status'](_0x348dd0);return _0x4f3b7d[_0x0e59('0x22')](_0x0e59('0x23'),_0x234936+'-'+_0x3feea2+'/'+_0x141d8e)['json'](_0x5c267e);}return null;};}function patchUpdates(_0xa44f28){return function(_0x579579){try{jsonpatch[_0x0e59('0x24')](_0x579579,_0xa44f28,!![]);}catch(_0x2922c4){return BPromise['reject'](_0x2922c4);}return _0x579579['save']();};}function saveUpdates(_0x78aa9f,_0x46bb09){return function(_0x14fc2a){if(_0x14fc2a){return _0x14fc2a[_0x0e59('0x25')](_0x78aa9f)[_0x0e59('0x26')](function(_0x25e1c3){return _0x25e1c3;});}return null;};}function removeEntity(_0xa41464,_0x541828){return function(_0xb8263b){if(_0xb8263b){return _0xb8263b[_0x0e59('0x27')]()[_0x0e59('0x26')](function(){var _0xd23043=_0xb8263b[_0x0e59('0x28')]({'plain':!![]});var _0x518416=_0x0e59('0x29');return db[_0x0e59('0x2a')][_0x0e59('0x27')]({'where':{'type':_0x518416,'resourceId':_0xd23043['id']}})[_0x0e59('0x26')](function(){return _0xb8263b;});})['then'](function(){_0xa41464['status'](0xcc)[_0x0e59('0x1c')]();});}};}function handleEntityNotFound(_0x2c4897,_0x5ad38f){return function(_0x1aaa88){if(!_0x1aaa88){_0x2c4897[_0x0e59('0x1a')](0x194);}return _0x1aaa88;};}function handleError(_0x45b38d,_0x3d7df3){_0x3d7df3=_0x3d7df3||0x1f4;return function(_0x587f91){logger[_0x0e59('0x2b')](_0x587f91[_0x0e59('0x2c')]);if(_0x587f91['name']){delete _0x587f91[_0x0e59('0x2d')];}_0x45b38d[_0x0e59('0x1b')](_0x3d7df3)[_0x0e59('0x2e')](_0x587f91);};}exports[_0x0e59('0x2f')]=function(_0x18c8a2,_0x3a8150){var _0x31dae8={},_0x4553bc={},_0x3618c7={'count':0x0,'rows':[]};var _0x38a235=_[_0x0e59('0x30')](db[_0x0e59('0x31')][_0x0e59('0x32')],function(_0x32c5da){return{'name':_0x32c5da[_0x0e59('0x33')],'type':_0x32c5da['type'][_0x0e59('0x34')]};});_0x4553bc[_0x0e59('0x35')]=_['map'](_0x38a235,_0x0e59('0x2d'));_0x4553bc[_0x0e59('0x36')]=_['keys'](_0x18c8a2[_0x0e59('0x36')]);_0x4553bc[_0x0e59('0x37')]=_[_0x0e59('0x38')](_0x4553bc[_0x0e59('0x35')],_0x4553bc[_0x0e59('0x36')]);_0x31dae8[_0x0e59('0x39')]=_['intersection'](_0x4553bc['model'],qs[_0x0e59('0x3a')](_0x18c8a2['query'][_0x0e59('0x3a')]));_0x31dae8[_0x0e59('0x39')]=_0x31dae8['attributes'][_0x0e59('0x3b')]?_0x31dae8[_0x0e59('0x39')]:_0x4553bc[_0x0e59('0x35')];if(!_0x18c8a2['query'][_0x0e59('0x3c')]('nolimit')){_0x31dae8[_0x0e59('0x21')]=qs[_0x0e59('0x21')](_0x18c8a2['query'][_0x0e59('0x21')]);_0x31dae8[_0x0e59('0x1e')]=qs[_0x0e59('0x1e')](_0x18c8a2['query'][_0x0e59('0x1e')]);}_0x31dae8['order']=qs[_0x0e59('0x3d')](_0x18c8a2[_0x0e59('0x36')][_0x0e59('0x3d')]);_0x31dae8['where']=qs['filters'](_[_0x0e59('0x3e')](_0x18c8a2[_0x0e59('0x36')],_0x4553bc[_0x0e59('0x37')]),_0x38a235);if(_0x18c8a2[_0x0e59('0x36')][_0x0e59('0x3f')]){_0x31dae8[_0x0e59('0x40')]=_['merge'](_0x31dae8[_0x0e59('0x40')],{'$or':_[_0x0e59('0x30')](_0x38a235,function(_0x191b79){if(_0x191b79['type']!==_0x0e59('0x41')){var _0x5a2232={};_0x5a2232[_0x191b79[_0x0e59('0x2d')]]={'$like':'%'+_0x18c8a2['query']['filter']+'%'};return _0x5a2232;}})});}_0x31dae8=_['merge']({},_0x31dae8,_0x18c8a2[_0x0e59('0x42')]);var _0x53fa40={'where':_0x31dae8[_0x0e59('0x40')]};return db['Disposition'][_0x0e59('0x20')](_0x53fa40)[_0x0e59('0x26')](function(_0x401aac){_0x3618c7[_0x0e59('0x20')]=_0x401aac;if(_0x18c8a2[_0x0e59('0x36')][_0x0e59('0x43')]){_0x31dae8[_0x0e59('0x44')]=[{'all':!![]}];}return db[_0x0e59('0x31')][_0x0e59('0x45')](_0x31dae8);})[_0x0e59('0x26')](function(_0x1db97c){_0x3618c7[_0x0e59('0x46')]=_0x1db97c;return _0x3618c7;})[_0x0e59('0x26')](respondWithFilteredResult(_0x3a8150,_0x31dae8))['catch'](handleError(_0x3a8150,null));};exports[_0x0e59('0x47')]=function(_0x26d664,_0x4a9faf){var _0x5c1582={'raw':!![],'where':{'id':_0x26d664['params']['id']}},_0xfec088={};_0xfec088['model']=_[_0x0e59('0x48')](db[_0x0e59('0x31')][_0x0e59('0x32')]);_0xfec088['query']=_[_0x0e59('0x48')](_0x26d664[_0x0e59('0x36')]);_0xfec088[_0x0e59('0x37')]=_[_0x0e59('0x38')](_0xfec088[_0x0e59('0x35')],_0xfec088[_0x0e59('0x36')]);_0x5c1582[_0x0e59('0x39')]=_[_0x0e59('0x38')](_0xfec088[_0x0e59('0x35')],qs[_0x0e59('0x3a')](_0x26d664['query'][_0x0e59('0x3a')]));_0x5c1582[_0x0e59('0x39')]=_0x5c1582[_0x0e59('0x39')][_0x0e59('0x3b')]?_0x5c1582[_0x0e59('0x39')]:_0xfec088[_0x0e59('0x35')];if(_0x26d664[_0x0e59('0x36')][_0x0e59('0x43')]){_0x5c1582[_0x0e59('0x44')]=[{'all':!![]}];}_0x5c1582=_[_0x0e59('0x49')]({},_0x5c1582,_0x26d664[_0x0e59('0x42')]);return db[_0x0e59('0x31')][_0x0e59('0x4a')](_0x5c1582)['then'](handleEntityNotFound(_0x4a9faf,null))['then'](respondWithResult(_0x4a9faf,null))[_0x0e59('0x4b')](handleError(_0x4a9faf,null));};exports[_0x0e59('0x4c')]=function(_0x46200e,_0x72f1b1){return db['Disposition'][_0x0e59('0x4c')](_0x46200e[_0x0e59('0x4d')],{})[_0x0e59('0x26')](function(_0x1607df){var _0x59c0fc=_0x46200e['user'][_0x0e59('0x28')]({'plain':!![]});if(!_0x59c0fc)throw new Error(_0x0e59('0x4e'));if(_0x59c0fc[_0x0e59('0x4f')]===_0x0e59('0x50')){var _0xc28d42=_0x1607df['get']({'plain':!![]});var _0x50bc4c='Dispositions';return db[_0x0e59('0x51')]['find']({'where':{'name':_0x50bc4c,'userProfileId':_0x59c0fc[_0x0e59('0x52')]},'raw':!![]})[_0x0e59('0x26')](function(_0xa4ee98){if(_0xa4ee98&&_0xa4ee98[_0x0e59('0x53')]===0x0){return db[_0x0e59('0x2a')][_0x0e59('0x4c')]({'name':_0xc28d42[_0x0e59('0x2d')],'resourceId':_0xc28d42['id'],'type':_0xa4ee98['name'],'sectionId':_0xa4ee98['id']},{})['then'](function(){return _0x1607df;});}else{return _0x1607df;}})[_0x0e59('0x4b')](function(_0x4bbe67){logger['error'](_0x0e59('0x54'),_0x4bbe67);throw _0x4bbe67;});}return _0x1607df;})[_0x0e59('0x26')](respondWithResult(_0x72f1b1,0xc9))['catch'](handleError(_0x72f1b1,null));};exports['update']=function(_0x5e1157,_0x43032a){if(_0x5e1157[_0x0e59('0x4d')]['id']){delete _0x5e1157[_0x0e59('0x4d')]['id'];}return db[_0x0e59('0x31')]['find']({'where':{'id':_0x5e1157['params']['id']}})[_0x0e59('0x26')](handleEntityNotFound(_0x43032a,null))['then'](saveUpdates(_0x5e1157[_0x0e59('0x4d')],null))[_0x0e59('0x26')](respondWithResult(_0x43032a,null))[_0x0e59('0x4b')](handleError(_0x43032a,null));};exports[_0x0e59('0x27')]=function(_0x119b5d,_0x2ee5f8){return db[_0x0e59('0x31')]['find']({'where':{'id':_0x119b5d[_0x0e59('0x55')]['id']}})[_0x0e59('0x26')](handleEntityNotFound(_0x2ee5f8,null))[_0x0e59('0x26')](removeEntity(_0x2ee5f8,null))['catch'](handleError(_0x2ee5f8,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 742b857..9673e95 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 _0x8c29=['Disposition','tools_dispositions','name_voice','name_chat','name','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','define'];(function(_0x5a5f05,_0x234d2a){var _0x52a1d4=function(_0x4d9e7c){while(--_0x4d9e7c){_0x5a5f05['push'](_0x5a5f05['shift']());}};_0x52a1d4(++_0x234d2a);}(_0x8c29,0x147));var _0x98c2=function(_0x116b81,_0x5cc097){_0x116b81=_0x116b81-0x0;var _0x4b9678=_0x8c29[_0x116b81];return _0x4b9678;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x98c2('0x0'))(_0x98c2('0x1'));var moment=require(_0x98c2('0x2'));var BPromise=require(_0x98c2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98c2('0x4'));var rimraf=require(_0x98c2('0x5'));var config=require(_0x98c2('0x6'));var attributes=require(_0x98c2('0x7'));module['exports']=function(_0x2c1ee4,_0x3f8d56){return _0x2c1ee4[_0x98c2('0x8')](_0x98c2('0x9'),attributes,{'tableName':_0x98c2('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x98c2('0xb'),'fields':['name','ListId']},{'unique':!![],'name':_0x98c2('0xc'),'fields':[_0x98c2('0xd'),_0x98c2('0xe')]},{'unique':!![],'name':_0x98c2('0xf'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x98c2('0x10'),'fields':[_0x98c2('0xd'),_0x98c2('0x11')]},{'unique':!![],'name':_0x98c2('0x12'),'fields':[_0x98c2('0xd'),_0x98c2('0x13')]},{'unique':!![],'name':_0x98c2('0x14'),'fields':[_0x98c2('0xd'),_0x98c2('0x15')]},{'unique':!![],'name':_0x98c2('0x16'),'fields':['name',_0x98c2('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4816=['OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','define','tools_dispositions','name','ListId','name_chat','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x4816,0x1bc));var _0x6481=function(_0x558e45,_0x4f5e4f){_0x558e45=_0x558e45-0x0;var _0x3e9075=_0x4816[_0x558e45];return _0x3e9075;};'use strict';var _=require('lodash');var util=require(_0x6481('0x0'));var logger=require(_0x6481('0x1'))('api');var moment=require(_0x6481('0x2'));var BPromise=require(_0x6481('0x3'));var rp=require(_0x6481('0x4'));var fs=require('fs');var path=require(_0x6481('0x5'));var rimraf=require('rimraf');var config=require(_0x6481('0x6'));var attributes=require(_0x6481('0x7'));module['exports']=function(_0x1aa825,_0x2355e5){return _0x1aa825[_0x6481('0x8')]('Disposition',attributes,{'tableName':_0x6481('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x6481('0xa'),_0x6481('0xb')]},{'unique':!![],'name':_0x6481('0xc'),'fields':[_0x6481('0xa'),'ChatWebsiteId']},{'unique':!![],'name':_0x6481('0xd'),'fields':[_0x6481('0xa'),_0x6481('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0x6481('0xa'),_0x6481('0xf')]},{'unique':!![],'name':_0x6481('0x10'),'fields':[_0x6481('0xa'),'FaxAccountId']},{'unique':!![],'name':_0x6481('0x11'),'fields':[_0x6481('0xa'),_0x6481('0x12')]},{'unique':!![],'name':_0x6481('0x13'),'fields':[_0x6481('0xa'),_0x6481('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 41d0ded..e509889 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(_0x1a7b42,_0x2c373a){var _0x215485=function(_0x5c091d){while(--_0x5c091d){_0x1a7b42['push'](_0x1a7b42['shift']());}};_0x215485(++_0x2c373a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x5464ca,_0x3556c6){var _0x5987a3=function(_0xa70b){while(--_0xa70b){_0x5464ca['push'](_0x5464ca['shift']());}};_0x5987a3(++_0x3556c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index c8b7a99..cfb4310 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 _0x35f6=['index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x22628c,_0x3b19b7){var _0x144398=function(_0x581539){while(--_0x581539){_0x22628c['push'](_0x22628c['shift']());}};_0x144398(++_0x3b19b7);}(_0x35f6,0x1ea));var _0x635f=function(_0x47d5b9,_0x17cb94){_0x47d5b9=_0x47d5b9-0x0;var _0x1bfa17=_0x35f6[_0x47d5b9];return _0x1bfa17;};'use strict';var multer=require('multer');var util=require(_0x635f('0x0'));var path=require(_0x635f('0x1'));var timeout=require(_0x635f('0x2'));var express=require(_0x635f('0x3'));var router=express[_0x635f('0x4')]();var fs_extra=require(_0x635f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x635f('0x6'));var config=require(_0x635f('0x7'));var controller=require(_0x635f('0x8'));router[_0x635f('0x9')]('/',auth['isAuthenticated'](),controller[_0x635f('0xa')]);router[_0x635f('0x9')](_0x635f('0xb'),auth[_0x635f('0xc')](),controller[_0x635f('0xd')]);router[_0x635f('0xe')]('/',auth[_0x635f('0xc')](),controller[_0x635f('0xf')]);router[_0x635f('0x10')](_0x635f('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x635f('0x11')](_0x635f('0xb'),auth[_0x635f('0xc')](),controller[_0x635f('0x12')]);module[_0x635f('0x13')]=router; \ No newline at end of file +var _0x2185=['Router','fs-extra','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post','put','update','destroy','util','path','connect-timeout','express'];(function(_0x5cf3a3,_0x29327c){var _0x349b78=function(_0x465240){while(--_0x465240){_0x5cf3a3['push'](_0x5cf3a3['shift']());}};_0x349b78(++_0x29327c);}(_0x2185,0x10c));var _0x5218=function(_0x25acbd,_0x41f2c0){_0x25acbd=_0x25acbd-0x0;var _0x15b431=_0x2185[_0x25acbd];return _0x15b431;};'use strict';var multer=require('multer');var util=require(_0x5218('0x0'));var path=require(_0x5218('0x1'));var timeout=require(_0x5218('0x2'));var express=require(_0x5218('0x3'));var router=express[_0x5218('0x4')]();var fs_extra=require(_0x5218('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5218('0x6'));var controller=require(_0x5218('0x7'));router[_0x5218('0x8')]('/',auth[_0x5218('0x9')](),controller['index']);router['get'](_0x5218('0xa'),auth[_0x5218('0x9')](),controller[_0x5218('0xb')]);router[_0x5218('0xc')]('/',auth[_0x5218('0x9')](),controller['create']);router[_0x5218('0xd')](_0x5218('0xa'),auth[_0x5218('0x9')](),controller[_0x5218('0xe')]);router['delete'](_0x5218('0xa'),auth[_0x5218('0x9')](),controller[_0x5218('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 99d2085..05f248c 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 _0xb4c7=['12000','14400','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200'];(function(_0x2b1a2b,_0x563b2f){var _0x47b842=function(_0x53b0f7){while(--_0x53b0f7){_0x2b1a2b['push'](_0x2b1a2b['shift']());}};_0x47b842(++_0x563b2f);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x51a139,_0xadd051){_0x51a139=_0x51a139-0x0;var _0x4ef9b1=_0xb4c7[_0x51a139];return _0x4ef9b1;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7b4c('0x2')]},'ecm':{'type':Sequelize[_0x7b4c('0x3')]('yes','no'),'defaultValue':_0x7b4c('0x4')},'headerinfo':{'type':Sequelize[_0x7b4c('0x2')],'defaultValue':_0x7b4c('0x5')},'localstationid':{'type':Sequelize[_0x7b4c('0x2')],'unique':_0x7b4c('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x7b4c('0x7'),_0x7b4c('0x8'),_0x7b4c('0x9'),'9600',_0x7b4c('0xa'),_0x7b4c('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x7b4c('0x3')](_0x7b4c('0x7'),_0x7b4c('0x8'),_0x7b4c('0x9'),_0x7b4c('0xc'),_0x7b4c('0xa'),_0x7b4c('0xb')),'defaultValue':_0x7b4c('0xb')},'modem':{'type':Sequelize[_0x7b4c('0x2')],'defaultValue':_0x7b4c('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7b4c('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7b4c('0x3')](_0x7b4c('0xf'),_0x7b4c('0x10'),_0x7b4c('0x11'),_0x7b4c('0x12')),'defaultValue':_0x7b4c('0xf')},'key':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7b4c('0x13')],'defaultValue':function(){return _0x7b4c('0x14');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7b4c('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7b4c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7b4c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b4c('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7b4c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7b4c('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7b4c('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b4c('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7b4c('0x15')],'defaultValue':![],'comment':_0x7b4c('0x16'),'set':function(_0x15a5a9){if(!_0x15a5a9)this[_0x7b4c('0x17')]('mandatoryDispositionPauseId',null);this[_0x7b4c('0x17')](_0x7b4c('0x18'),_0x15a5a9);}}}; \ No newline at end of file +var _0x6363=['7200','9600','14400','12000','SIP','IAX','DADHI','KHOMP','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','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0x4478a4,_0x37562d){var _0x4f4728=function(_0x445fee){while(--_0x445fee){_0x4478a4['push'](_0x4478a4['shift']());}};_0x4f4728(++_0x37562d);}(_0x6363,0x13a));var _0x3636=function(_0x5d2f96,_0x51d48c){_0x5d2f96=_0x5d2f96-0x0;var _0x277ebf=_0x6363[_0x5d2f96];return _0x277ebf;};'use strict';var Sequelize=require(_0x3636('0x0'));module['exports']={'name':{'type':Sequelize[_0x3636('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3636('0x1')]},'ecm':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x3'),'no'),'defaultValue':_0x3636('0x3')},'headerinfo':{'type':Sequelize[_0x3636('0x1')],'defaultValue':_0x3636('0x4')},'localstationid':{'type':Sequelize[_0x3636('0x1')],'unique':_0x3636('0x5')},'minrate':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x6'),_0x3636('0x7'),_0x3636('0x8'),_0x3636('0x9'),'12000',_0x3636('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x3636('0x2')](_0x3636('0x6'),_0x3636('0x7'),_0x3636('0x8'),_0x3636('0x9'),_0x3636('0xb'),_0x3636('0xa')),'defaultValue':_0x3636('0xa')},'modem':{'type':Sequelize[_0x3636('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3636('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3636('0x2')](_0x3636('0xc'),_0x3636('0xd'),_0x3636('0xe'),_0x3636('0xf')),'defaultValue':_0x3636('0xc')},'key':{'type':Sequelize[_0x3636('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3636('0x10')],'defaultValue':function(){return _0x3636('0x11');}},'notificationSound':{'type':Sequelize[_0x3636('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3636('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3636('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x3636('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xe3be56){if(!_0xe3be56)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x3636('0x15')](_0x3636('0x16'),_0xe3be56);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 21d5ae6..4b52793 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 _0x83fb=['merge','FaxAccount','mandatoryDispositionPause','includeAll','options','find','catch','create','body','role','user','UserProfileSection','autoAssociation','params','addDisposition','Disposition','getDispositions','length','FaxAccountId','include','findAll','rows','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','ids','findOne','CmContact','Contact','User','Owner','fullname','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','exten','localstationid','app','system','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','push','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','root','basename','CheckAfterSend','path','isNil','from','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x5e3863,_0x107a63){var _0x1cbfad=function(_0x3b34d0){while(--_0x3b34d0){_0x5e3863['push'](_0x5e3863['shift']());}};_0x1cbfad(++_0x107a63);}(_0x83fb,0x70));var _0xb83f=function(_0x24e04e,_0x4953b2){_0x24e04e=_0x24e04e-0x0;var _0xe76697=_0x83fb[_0x24e04e];return _0xe76697;};'use strict';var emlformat=require(_0xb83f('0x0'));var rimraf=require(_0xb83f('0x1'));var zipdir=require(_0xb83f('0x2'));var jsonpatch=require(_0xb83f('0x3'));var rp=require(_0xb83f('0x4'));var moment=require('moment');var BPromise=require(_0xb83f('0x5'));var Mustache=require(_0xb83f('0x6'));var util=require(_0xb83f('0x7'));var path=require('path');var sox=require(_0xb83f('0x8'));var csv=require(_0xb83f('0x9'));var ejs=require(_0xb83f('0xa'));var fs=require('fs');var fs_extra=require(_0xb83f('0xb'));var _=require(_0xb83f('0xc'));var squel=require(_0xb83f('0xd'));var crypto=require(_0xb83f('0xe'));var jsforce=require(_0xb83f('0xf'));var deskjs=require(_0xb83f('0x10'));var toCsv=require(_0xb83f('0x9'));var querystring=require(_0xb83f('0x11'));var Papa=require('papaparse');var Redis=require(_0xb83f('0x12'));var authService=require(_0xb83f('0x13'));var qs=require(_0xb83f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb83f('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb83f('0x16'));var config=require(_0xb83f('0x17'));var licenseUtil=require(_0xb83f('0x18'));var db=require(_0xb83f('0x19'))['db'];config[_0xb83f('0x1a')]=_['defaults'](config[_0xb83f('0x1a')],{'host':_0xb83f('0x1b'),'port':0x18eb});var socket=require(_0xb83f('0x1c'))(new Redis(config[_0xb83f('0x1a')]));require('./faxAccount.socket')[_0xb83f('0x1d')](socket);var jayson=require(_0xb83f('0x1e'));var client=jayson[_0xb83f('0x1f')][_0xb83f('0x20')]({'port':0x232c});var client9002=jayson[_0xb83f('0x1f')][_0xb83f('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3a9d43,_0x51d479,_0x4ebba3,_0x8c1526){return new BPromise(function(_0x162974,_0x3f2c76){var _0x45872e=_0x8c1526||client;return _0x45872e['request'](_0x3a9d43,_0x4ebba3)[_0xb83f('0x21')](function(_0x38b617){logger[_0xb83f('0x22')](_0xb83f('0x23'),_0x51d479,_0xb83f('0x24'));logger[_0xb83f('0x25')](_0xb83f('0x26'),_0x51d479,_0xb83f('0x24'),JSON['stringify'](_0x38b617));if(_0x38b617[_0xb83f('0x27')]){if(_0x38b617[_0xb83f('0x27')][_0xb83f('0x28')]===0x1f4){logger[_0xb83f('0x27')]('FaxAccount,\x20%s,\x20%s',_0x51d479,_0x38b617[_0xb83f('0x27')][_0xb83f('0x29')]);return _0x3f2c76(_0x38b617[_0xb83f('0x27')][_0xb83f('0x29')]);}logger[_0xb83f('0x27')](_0xb83f('0x23'),_0x51d479,_0x38b617['error'][_0xb83f('0x29')]);return _0x162974(_0x38b617[_0xb83f('0x27')]['message']);}else{logger[_0xb83f('0x22')]('FaxAccount,\x20%s,\x20%s',_0x51d479,'request\x20sent');_0x162974(_0x38b617[_0xb83f('0x2a')]['message']);}})['catch'](function(_0x3b53a9){logger[_0xb83f('0x27')]('FaxAccount,\x20%s,\x20%s',_0x51d479,_0x3b53a9);_0x3f2c76(_0x3b53a9);});});}function respondWithStatusCode(_0x506988,_0xfcb382){_0xfcb382=_0xfcb382||0xcc;return function(_0x305b45){if(_0x305b45){return _0x506988[_0xb83f('0x2b')](_0xfcb382);}return _0x506988[_0xb83f('0x2c')](_0xfcb382)[_0xb83f('0x2d')]();};}function respondWithResult(_0x2951e,_0x585c16){_0x585c16=_0x585c16||0xc8;return function(_0x44136f){if(_0x44136f){return _0x2951e[_0xb83f('0x2c')](_0x585c16)['json'](_0x44136f);}};}function respondWithFilteredResult(_0x10b474,_0x1fffb5){return function(_0x311223){if(_0x311223){var _0x287a3c=typeof _0x1fffb5[_0xb83f('0x2e')]===_0xb83f('0x2f')&&typeof _0x1fffb5[_0xb83f('0x30')]===_0xb83f('0x2f');var _0x2cd893=_0x311223['count'];var _0x56304a=_0x287a3c?0x0:_0x1fffb5[_0xb83f('0x2e')];var _0x177727=_0x287a3c?_0x311223[_0xb83f('0x31')]:_0x1fffb5['offset']+_0x1fffb5[_0xb83f('0x30')];var _0x1cd5b8;if(_0x177727>=_0x2cd893){_0x177727=_0x2cd893;_0x1cd5b8=0xc8;}else{_0x1cd5b8=0xce;}_0x10b474[_0xb83f('0x2c')](_0x1cd5b8);return _0x10b474[_0xb83f('0x32')](_0xb83f('0x33'),_0x56304a+'-'+_0x177727+'/'+_0x2cd893)[_0xb83f('0x34')](_0x311223);}return null;};}function patchUpdates(_0x35484e){return function(_0x14bc1a){try{jsonpatch[_0xb83f('0x35')](_0x14bc1a,_0x35484e,!![]);}catch(_0x4746d7){return BPromise[_0xb83f('0x36')](_0x4746d7);}return _0x14bc1a[_0xb83f('0x37')]();};}function saveUpdates(_0x305bf6,_0x39609b){return function(_0x4ab1ef){if(_0x4ab1ef){return _0x4ab1ef[_0xb83f('0x38')](_0x305bf6)[_0xb83f('0x21')](function(_0x5b32e3){return _0x5b32e3;});}return null;};}function removeEntity(_0x480d44,_0x5f1d85){return function(_0x6ccc9d){if(_0x6ccc9d){return _0x6ccc9d[_0xb83f('0x39')]()['then'](function(){var _0x268d22=_0x6ccc9d[_0xb83f('0x3a')]({'plain':!![]});var _0x5b328e=_0xb83f('0x3b');return db[_0xb83f('0x3c')][_0xb83f('0x39')]({'where':{'type':_0x5b328e,'resourceId':_0x268d22['id']}})[_0xb83f('0x21')](function(){return _0x6ccc9d;});})['then'](function(){_0x480d44['status'](0xcc)[_0xb83f('0x2d')]();});}};}function handleEntityNotFound(_0x3d32b6,_0x3a7b67){return function(_0x320aa7){if(!_0x320aa7){_0x3d32b6[_0xb83f('0x2b')](0x194);}return _0x320aa7;};}function handleError(_0x2267bb,_0x4aa338){_0x4aa338=_0x4aa338||0x1f4;return function(_0x2fd8ae){logger[_0xb83f('0x27')](_0x2fd8ae[_0xb83f('0x3d')]);if(_0x2fd8ae[_0xb83f('0x3e')]){delete _0x2fd8ae['name'];}_0x2267bb['status'](_0x4aa338)[_0xb83f('0x3f')](_0x2fd8ae);};}exports[_0xb83f('0x40')]=function(_0x19343a,_0xe098da){var _0x35601b={'include':[{'model':db[_0xb83f('0x41')],'as':'mandatoryDispositionPause'}]},_0x1283d9={},_0xd8611c={'count':0x0,'rows':[]};var _0x1e36c5=_['map'](db['FaxAccount'][_0xb83f('0x42')],function(_0x1d4210){return{'name':_0x1d4210[_0xb83f('0x43')],'type':_0x1d4210[_0xb83f('0x44')][_0xb83f('0x45')]};});_0x1283d9[_0xb83f('0x46')]=_[_0xb83f('0x47')](_0x1e36c5,_0xb83f('0x3e'));_0x1283d9[_0xb83f('0x48')]=_[_0xb83f('0x49')](_0x19343a[_0xb83f('0x48')]);_0x1283d9[_0xb83f('0x4a')]=_['intersection'](_0x1283d9[_0xb83f('0x46')],_0x1283d9[_0xb83f('0x48')]);_0x35601b['attributes']=_[_0xb83f('0x4b')](_0x1283d9['model'],qs[_0xb83f('0x4c')](_0x19343a[_0xb83f('0x48')]['fields']));_0x35601b[_0xb83f('0x4d')]=_0x35601b[_0xb83f('0x4d')]['length']?_0x35601b[_0xb83f('0x4d')]:_0x1283d9[_0xb83f('0x46')];if(!_0x19343a[_0xb83f('0x48')][_0xb83f('0x4e')](_0xb83f('0x4f'))){_0x35601b[_0xb83f('0x30')]=qs['limit'](_0x19343a[_0xb83f('0x48')][_0xb83f('0x30')]);_0x35601b[_0xb83f('0x2e')]=qs[_0xb83f('0x2e')](_0x19343a[_0xb83f('0x48')][_0xb83f('0x2e')]);}_0x35601b[_0xb83f('0x50')]=qs[_0xb83f('0x51')](_0x19343a[_0xb83f('0x48')]['sort']);_0x35601b[_0xb83f('0x52')]=qs[_0xb83f('0x4a')](_[_0xb83f('0x53')](_0x19343a[_0xb83f('0x48')],_0x1283d9[_0xb83f('0x4a')]),_0x1e36c5);if(_0x19343a['query'][_0xb83f('0x54')]){_0x35601b['where']=_[_0xb83f('0x55')](_0x35601b[_0xb83f('0x52')],{'$or':_[_0xb83f('0x47')](_0x1e36c5,function(_0x3bda8d){if(_0x3bda8d[_0xb83f('0x44')]!=='VIRTUAL'){var _0x78021d={};_0x78021d[_0x3bda8d[_0xb83f('0x3e')]]={'$like':'%'+_0x19343a['query'][_0xb83f('0x54')]+'%'};return _0x78021d;}})});}_0x35601b=_[_0xb83f('0x55')]({},_0x35601b,_0x19343a['options']);var _0x5568fb={'where':_0x35601b[_0xb83f('0x52')]};return db[_0xb83f('0x56')][_0xb83f('0x31')](_0x5568fb)['then'](function(_0x545e78){_0xd8611c[_0xb83f('0x31')]=_0x545e78;if(_0x19343a[_0xb83f('0x48')]['includeAll']){_0x35601b['include']=[{'all':!![]}];}return db[_0xb83f('0x56')]['findAll'](_0x35601b);})[_0xb83f('0x21')](function(_0x56f3e9){_0xd8611c['rows']=_0x56f3e9;return _0xd8611c;})[_0xb83f('0x21')](respondWithFilteredResult(_0xe098da,_0x35601b))['catch'](handleError(_0xe098da,null));};exports['show']=function(_0x4fa786,_0x15e20a){var _0x55ed1b={'raw':![],'where':{'id':_0x4fa786['params']['id']},'include':[{'model':db[_0xb83f('0x41')],'as':_0xb83f('0x57')}]},_0x44bf37={};_0x44bf37['model']=_[_0xb83f('0x49')](db[_0xb83f('0x56')][_0xb83f('0x42')]);_0x44bf37[_0xb83f('0x48')]=_[_0xb83f('0x49')](_0x4fa786[_0xb83f('0x48')]);_0x44bf37[_0xb83f('0x4a')]=_[_0xb83f('0x4b')](_0x44bf37[_0xb83f('0x46')],_0x44bf37[_0xb83f('0x48')]);_0x55ed1b[_0xb83f('0x4d')]=_['intersection'](_0x44bf37[_0xb83f('0x46')],qs['fields'](_0x4fa786[_0xb83f('0x48')][_0xb83f('0x4c')]));_0x55ed1b[_0xb83f('0x4d')]=_0x55ed1b[_0xb83f('0x4d')]['length']?_0x55ed1b['attributes']:_0x44bf37[_0xb83f('0x46')];if(_0x4fa786[_0xb83f('0x48')][_0xb83f('0x58')]){_0x55ed1b['include']=[{'all':!![]}];}_0x55ed1b=_[_0xb83f('0x55')]({},_0x55ed1b,_0x4fa786[_0xb83f('0x59')]);return db[_0xb83f('0x56')][_0xb83f('0x5a')](_0x55ed1b)['then'](handleEntityNotFound(_0x15e20a,null))[_0xb83f('0x21')](respondWithResult(_0x15e20a,null))[_0xb83f('0x5b')](handleError(_0x15e20a,null));};exports['create']=function(_0xa66fbb,_0x1de66f){return db[_0xb83f('0x56')][_0xb83f('0x5c')](_0xa66fbb[_0xb83f('0x5d')],{})[_0xb83f('0x21')](function(_0x451b58){var _0x234ba5=_0xa66fbb['user'][_0xb83f('0x3a')]({'plain':!![]});if(!_0x234ba5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x234ba5[_0xb83f('0x5e')]===_0xb83f('0x5f')){var _0x2af9=_0x451b58[_0xb83f('0x3a')]({'plain':!![]});var _0xc76992=_0xb83f('0x3b');return db[_0xb83f('0x60')][_0xb83f('0x5a')]({'where':{'name':_0xc76992,'userProfileId':_0x234ba5['userProfileId']},'raw':!![]})['then'](function(_0x5fb12){if(_0x5fb12&&_0x5fb12[_0xb83f('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x2af9[_0xb83f('0x3e')],'resourceId':_0x2af9['id'],'type':_0x5fb12[_0xb83f('0x3e')],'sectionId':_0x5fb12['id']},{})[_0xb83f('0x21')](function(){return _0x451b58;});}else{return _0x451b58;}})[_0xb83f('0x5b')](function(_0x1fd863){logger[_0xb83f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fd863);throw _0x1fd863;});}return _0x451b58;})[_0xb83f('0x21')](respondWithResult(_0x1de66f,0xc9))[_0xb83f('0x5b')](handleError(_0x1de66f,null));};exports[_0xb83f('0x38')]=function(_0x13bb73,_0xb25a72){if(_0x13bb73[_0xb83f('0x5d')]['id']){delete _0x13bb73[_0xb83f('0x5d')]['id'];}return db[_0xb83f('0x56')][_0xb83f('0x5a')]({'where':{'id':_0x13bb73['params']['id']},'include':[{'model':db['Pause'],'as':_0xb83f('0x57')}]})[_0xb83f('0x21')](handleEntityNotFound(_0xb25a72,null))[_0xb83f('0x21')](saveUpdates(_0x13bb73[_0xb83f('0x5d')],null))[_0xb83f('0x21')](respondWithResult(_0xb25a72,null))[_0xb83f('0x5b')](handleError(_0xb25a72,null));};exports[_0xb83f('0x39')]=function(_0x2c95fa,_0x2039e8){return db[_0xb83f('0x56')][_0xb83f('0x5a')]({'where':{'id':_0x2c95fa[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x2039e8,null))[_0xb83f('0x21')](removeEntity(_0x2039e8,null))[_0xb83f('0x5b')](handleError(_0x2039e8,null));};exports['describe']=function(_0x638536,_0x1017da){return db[_0xb83f('0x56')]['describe']()[_0xb83f('0x21')](respondWithResult(_0x1017da,null))[_0xb83f('0x5b')](handleError(_0x1017da,null));};exports[_0xb83f('0x63')]=function(_0x31f782,_0x499019,_0x191a6b){if(_0x31f782['body']['id']){delete _0x31f782[_0xb83f('0x5d')]['id'];}return db[_0xb83f('0x56')][_0xb83f('0x5a')]({'where':{'id':_0x31f782[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x499019,null))[_0xb83f('0x21')](function(_0x1b020e){if(_0x1b020e){_0x31f782['body']['FaxAccountId']=_0x1b020e['id'];return db[_0xb83f('0x64')][_0xb83f('0x5c')](_0x31f782['body']);}})[_0xb83f('0x21')](respondWithResult(_0x499019,null))[_0xb83f('0x5b')](handleError(_0x499019,null));};exports[_0xb83f('0x65')]=function(_0x274538,_0x15b4f9,_0x533d18){var _0x4960db={'raw':![],'where':{}};var _0x19ac1f={};var _0xa4be11={'count':0x0,'rows':[]};return db[_0xb83f('0x56')]['findOne']({'where':{'id':_0x274538[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x15b4f9,null))[_0xb83f('0x21')](function(_0x3d490a){if(_0x3d490a){_0x19ac1f[_0xb83f('0x46')]=_[_0xb83f('0x49')](db[_0xb83f('0x64')][_0xb83f('0x42')]);_0x19ac1f[_0xb83f('0x48')]=_['keys'](_0x274538[_0xb83f('0x48')]);_0x19ac1f[_0xb83f('0x4a')]=_['intersection'](_0x19ac1f[_0xb83f('0x46')],_0x19ac1f[_0xb83f('0x48')]);_0x4960db[_0xb83f('0x4d')]=_['intersection'](_0x19ac1f[_0xb83f('0x46')],qs[_0xb83f('0x4c')](_0x274538[_0xb83f('0x48')][_0xb83f('0x4c')]));_0x4960db[_0xb83f('0x4d')]=_0x4960db[_0xb83f('0x4d')][_0xb83f('0x66')]?_0x4960db['attributes']:_0x19ac1f['model'];if(!_0x274538[_0xb83f('0x48')][_0xb83f('0x4e')](_0xb83f('0x4f'))){_0x4960db[_0xb83f('0x30')]=qs[_0xb83f('0x30')](_0x274538['query'][_0xb83f('0x30')]);_0x4960db['offset']=qs[_0xb83f('0x2e')](_0x274538['query']['offset']);}_0x4960db[_0xb83f('0x50')]=qs[_0xb83f('0x51')](_0x274538['query'][_0xb83f('0x51')]);_0x4960db[_0xb83f('0x52')]=qs[_0xb83f('0x4a')](_[_0xb83f('0x53')](_0x274538['query'],_0x19ac1f[_0xb83f('0x4a')]));_0x4960db[_0xb83f('0x52')][_0xb83f('0x67')]=_0x3d490a['id'];if(_0x274538[_0xb83f('0x48')][_0xb83f('0x54')]){_0x4960db['where']=_[_0xb83f('0x55')](_0x4960db[_0xb83f('0x52')],{'$or':_[_0xb83f('0x47')](_0x4960db[_0xb83f('0x4d')],function(_0x4b226c){var _0x28508c={};_0x28508c[_0x4b226c]={'$like':'%'+_0x274538[_0xb83f('0x48')][_0xb83f('0x54')]+'%'};return _0x28508c;})});}_0x4960db=_[_0xb83f('0x55')]({},_0x4960db,_0x274538[_0xb83f('0x59')]);return db['Disposition'][_0xb83f('0x31')]({'where':_0x4960db[_0xb83f('0x52')]})[_0xb83f('0x21')](function(_0x275c5f){_0xa4be11[_0xb83f('0x31')]=_0x275c5f;if(_0x274538[_0xb83f('0x48')][_0xb83f('0x58')]){_0x4960db[_0xb83f('0x68')]=[{'all':!![]}];}return db[_0xb83f('0x64')][_0xb83f('0x69')](_0x4960db);})[_0xb83f('0x21')](function(_0x383bf4){_0xa4be11[_0xb83f('0x6a')]=_0x383bf4;return _0xa4be11;});}})[_0xb83f('0x21')](respondWithFilteredResult(_0x15b4f9,_0x4960db))[_0xb83f('0x5b')](handleError(_0x15b4f9,null));};exports['removeDispositions']=function(_0x47c426,_0x17a3f1,_0xdb3a2a){return db[_0xb83f('0x56')][_0xb83f('0x5a')]({'where':{'id':_0x47c426[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x17a3f1,null))['then'](function(_0x17af09){if(_0x17af09){return _0x17af09['removeDispositions'](_0x47c426[_0xb83f('0x48')]['ids']);}})[_0xb83f('0x21')](respondWithStatusCode(_0x17a3f1,null))[_0xb83f('0x5b')](handleError(_0x17a3f1,null));};exports[_0xb83f('0x6b')]=function(_0x3e9739,_0x73e4af,_0x4e7554){if(_0x3e9739[_0xb83f('0x5d')]['id']){delete _0x3e9739[_0xb83f('0x5d')]['id'];}return db['FaxAccount'][_0xb83f('0x5a')]({'where':{'id':_0x3e9739[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x73e4af,null))[_0xb83f('0x21')](function(_0x23363e){if(_0x23363e){_0x3e9739['body'][_0xb83f('0x67')]=_0x23363e['id'];return db[_0xb83f('0x6c')][_0xb83f('0x5c')](_0x3e9739[_0xb83f('0x5d')]);}})[_0xb83f('0x21')](respondWithResult(_0x73e4af,null))[_0xb83f('0x5b')](handleError(_0x73e4af,null));};exports[_0xb83f('0x6d')]=function(_0x2dd58b,_0x5192f1,_0x35b8eb){var _0x21856e={'raw':![],'where':{}};var _0x2e99f5={};var _0x71c176={'count':0x0,'rows':[]};return db[_0xb83f('0x56')]['findOne']({'where':{'id':_0x2dd58b[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x5192f1,null))['then'](function(_0x132662){if(_0x132662){_0x2e99f5['model']=_[_0xb83f('0x49')](db[_0xb83f('0x6c')][_0xb83f('0x42')]);_0x2e99f5['query']=_['keys'](_0x2dd58b[_0xb83f('0x48')]);_0x2e99f5[_0xb83f('0x4a')]=_['intersection'](_0x2e99f5['model'],_0x2e99f5[_0xb83f('0x48')]);_0x21856e[_0xb83f('0x4d')]=_['intersection'](_0x2e99f5['model'],qs[_0xb83f('0x4c')](_0x2dd58b[_0xb83f('0x48')]['fields']));_0x21856e['attributes']=_0x21856e[_0xb83f('0x4d')][_0xb83f('0x66')]?_0x21856e[_0xb83f('0x4d')]:_0x2e99f5[_0xb83f('0x46')];if(!_0x2dd58b[_0xb83f('0x48')][_0xb83f('0x4e')](_0xb83f('0x4f'))){_0x21856e[_0xb83f('0x30')]=qs[_0xb83f('0x30')](_0x2dd58b[_0xb83f('0x48')]['limit']);_0x21856e['offset']=qs[_0xb83f('0x2e')](_0x2dd58b['query'][_0xb83f('0x2e')]);}_0x21856e[_0xb83f('0x50')]=qs[_0xb83f('0x51')](_0x2dd58b[_0xb83f('0x48')]['sort']);_0x21856e[_0xb83f('0x52')]=qs['filters'](_[_0xb83f('0x53')](_0x2dd58b[_0xb83f('0x48')],_0x2e99f5['filters']));_0x21856e[_0xb83f('0x52')][_0xb83f('0x67')]=_0x132662['id'];if(_0x2dd58b[_0xb83f('0x48')][_0xb83f('0x54')]){_0x21856e[_0xb83f('0x52')]=_[_0xb83f('0x55')](_0x21856e[_0xb83f('0x52')],{'$or':_[_0xb83f('0x47')](_0x21856e[_0xb83f('0x4d')],function(_0xba208f){var _0x1078f9={};_0x1078f9[_0xba208f]={'$like':'%'+_0x2dd58b[_0xb83f('0x48')]['filter']+'%'};return _0x1078f9;})});}_0x21856e=_[_0xb83f('0x55')]({},_0x21856e,_0x2dd58b[_0xb83f('0x59')]);return db[_0xb83f('0x6c')]['count']({'where':_0x21856e[_0xb83f('0x52')]})[_0xb83f('0x21')](function(_0x358bfc){_0x71c176['count']=_0x358bfc;if(_0x2dd58b['query'][_0xb83f('0x58')]){_0x21856e[_0xb83f('0x68')]=[{'all':!![]}];}return db[_0xb83f('0x6c')][_0xb83f('0x69')](_0x21856e);})[_0xb83f('0x21')](function(_0x2c2fe4){_0x71c176[_0xb83f('0x6a')]=_0x2c2fe4;return _0x71c176;});}})[_0xb83f('0x21')](respondWithFilteredResult(_0x5192f1,_0x21856e))['catch'](handleError(_0x5192f1,null));};exports[_0xb83f('0x6e')]=function(_0x4f1693,_0x30e08a,_0x308052){return db[_0xb83f('0x56')][_0xb83f('0x5a')]({'where':{'id':_0x4f1693[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x30e08a,null))[_0xb83f('0x21')](function(_0x3d35e3){if(_0x3d35e3){return _0x3d35e3['removeAnswers'](_0x4f1693['query']['ids']);}})[_0xb83f('0x21')](respondWithStatusCode(_0x30e08a,null))[_0xb83f('0x5b')](handleError(_0x30e08a,null));};exports[_0xb83f('0x6f')]=function(_0x232459,_0x5f4121,_0x43ede8){return db[_0xb83f('0x70')][_0xb83f('0x5a')]({'where':{'id':_0x232459[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x5f4121,null))[_0xb83f('0x21')](function(_0x5184b9){if(_0x5184b9){return _0x5184b9[_0xb83f('0x6f')](_0x232459[_0xb83f('0x5d')]['ids'],_[_0xb83f('0x71')](_0x232459[_0xb83f('0x5d')],[_0xb83f('0x72'),'id'])||{});}})[_0xb83f('0x21')](respondWithResult(_0x5f4121,null))[_0xb83f('0x5b')](handleError(_0x5f4121,null));};exports['getInteractions']=function(_0x188bab,_0x5a8826,_0x37b3d7){var _0x4f064b={'raw':![],'where':{}};var _0x5a991f={};var _0x16dd24={'count':0x0,'rows':[]};return db[_0xb83f('0x56')][_0xb83f('0x73')]({'where':{'id':_0x188bab[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x5a8826,null))['then'](function(_0x196d76){if(_0x196d76){_0x5a991f[_0xb83f('0x46')]=_[_0xb83f('0x49')](db[_0xb83f('0x70')][_0xb83f('0x42')]);_0x5a991f[_0xb83f('0x48')]=_['keys'](_0x188bab[_0xb83f('0x48')]);_0x5a991f[_0xb83f('0x4a')]=_[_0xb83f('0x4b')](_0x5a991f[_0xb83f('0x46')],_0x5a991f[_0xb83f('0x48')]);_0x4f064b[_0xb83f('0x4d')]=_[_0xb83f('0x4b')](_0x5a991f[_0xb83f('0x46')],qs[_0xb83f('0x4c')](_0x188bab[_0xb83f('0x48')]['fields']));_0x4f064b[_0xb83f('0x4d')]=_0x4f064b[_0xb83f('0x4d')][_0xb83f('0x66')]?_0x4f064b[_0xb83f('0x4d')]:_0x5a991f[_0xb83f('0x46')];if(!_0x188bab[_0xb83f('0x48')]['hasOwnProperty'](_0xb83f('0x4f'))){_0x4f064b['limit']=qs[_0xb83f('0x30')](_0x188bab[_0xb83f('0x48')][_0xb83f('0x30')]);_0x4f064b[_0xb83f('0x2e')]=qs[_0xb83f('0x2e')](_0x188bab[_0xb83f('0x48')][_0xb83f('0x2e')]);}_0x4f064b['order']=qs['sort'](_0x188bab[_0xb83f('0x48')]['sort']);_0x4f064b[_0xb83f('0x52')]=qs[_0xb83f('0x4a')](_['pick'](_0x188bab[_0xb83f('0x48')],_0x5a991f[_0xb83f('0x4a')]));_0x4f064b[_0xb83f('0x52')]['FaxAccountId']=_0x196d76['id'];if(_0x188bab['query'][_0xb83f('0x54')]){_0x4f064b[_0xb83f('0x52')]=_[_0xb83f('0x55')](_0x4f064b[_0xb83f('0x52')],{'$or':_[_0xb83f('0x47')](_0x4f064b[_0xb83f('0x4d')],function(_0x4f4e5b){var _0x5edd9f={};_0x5edd9f[_0x4f4e5b]={'$like':'%'+_0x188bab[_0xb83f('0x48')][_0xb83f('0x54')]+'%'};return _0x5edd9f;})});}_0x4f064b=_[_0xb83f('0x55')]({},_0x4f064b,_0x188bab[_0xb83f('0x59')]);return db[_0xb83f('0x70')]['count']({'where':_0x4f064b[_0xb83f('0x52')]})[_0xb83f('0x21')](function(_0x24feb2){_0x16dd24[_0xb83f('0x31')]=_0x24feb2;if(_0x188bab['query'][_0xb83f('0x58')]){_0x4f064b[_0xb83f('0x68')]=[{'model':db[_0xb83f('0x74')],'as':_0xb83f('0x75'),'required':![]},{'model':db[_0xb83f('0x76')],'as':_0xb83f('0x77'),'attributes':[_0xb83f('0x3e'),_0xb83f('0x78'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xb83f('0x3e'),'color'],'where':_0x188bab[_0xb83f('0x48')]['tag']?{'id':_0x188bab['query'][_0xb83f('0x79')]}:undefined,'required':_0x188bab['query'][_0xb83f('0x79')]?!![]:![]}];}return db[_0xb83f('0x70')][_0xb83f('0x69')](_0x4f064b);})[_0xb83f('0x21')](function(_0x14c809){_0x16dd24[_0xb83f('0x6a')]=_0x14c809;return _0x16dd24;});}})[_0xb83f('0x21')](respondWithFilteredResult(_0x5a8826,_0x4f064b))[_0xb83f('0x5b')](handleError(_0x5a8826,null));};exports[_0xb83f('0x7a')]=function(_0x41dc50,_0x18ed66){var _0x3283a5=_0x41dc50[_0xb83f('0x62')]['id'];var _0x595204=_0x41dc50[_0xb83f('0x5d')];var _0x5749ee=0xc8;var _0x3ed9a2=null;return db[_0xb83f('0x7b')][_0xb83f('0x7c')]({'isolationLevel':db[_0xb83f('0x7b')][_0xb83f('0x7d')][_0xb83f('0x7e')]['READ_COMMITTED']},function(_0x2819ee){return db[_0xb83f('0x56')][_0xb83f('0x73')]({'where':{'id':_0x3283a5},'transaction':_0x2819ee})[_0xb83f('0x21')](function(_0x4a4447){if(_0x4a4447){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x3283a5},'transaction':_0x2819ee})[_0xb83f('0x21')](function(){var _0x44cdc0=_[_0xb83f('0x47')](_0x595204,function(_0x4bb689){_0x4bb689[_0xb83f('0x67')]=_0x3283a5;return _0x4bb689;});return db[_0xb83f('0x7f')][_0xb83f('0x80')](_0x44cdc0,{'transaction':_0x2819ee});});}else{_0x5749ee=0x194;_0x3ed9a2=[];}});})[_0xb83f('0x21')](function(){if(_0x5749ee!==0x194){return db[_0xb83f('0x7f')][_0xb83f('0x81')]({'where':{'FaxAccountId':_0x3283a5},'order':_0xb83f('0x82')})['then'](function(_0x5bb9b6){_0x3ed9a2=_0x5bb9b6;});}})[_0xb83f('0x5b')](function(_0x1c7296){_0x5749ee=0x1f4;logger[_0xb83f('0x27')](_0x1c7296[_0xb83f('0x3d')]);if(_0x1c7296['name']){delete _0x1c7296['name'];}_0x3ed9a2=_0x1c7296;})[_0xb83f('0x83')](function(){if(_0x3ed9a2===null){_0x18ed66[_0xb83f('0x2b')](_0x5749ee);}else{if(_0x5749ee===0x1f4){_0x18ed66[_0xb83f('0x2c')](_0x5749ee)[_0xb83f('0x3f')](_0x3ed9a2);}else{_0x18ed66['status'](_0x5749ee)[_0xb83f('0x34')](_0x3ed9a2);}}});};exports[_0xb83f('0x84')]=function(_0xbb7cd2,_0x140eb0,_0x13dba7){var _0x134d26={};var _0x499baf={};var _0x43d486;var _0x100ab7;return db[_0xb83f('0x56')]['findOne']({'where':{'id':_0xbb7cd2[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x140eb0,null))[_0xb83f('0x21')](function(_0x139b73){if(_0x139b73){_0x43d486=_0x139b73;_0x499baf['model']=_[_0xb83f('0x49')](db[_0xb83f('0x7f')][_0xb83f('0x42')]);_0x499baf[_0xb83f('0x48')]=_[_0xb83f('0x49')](_0xbb7cd2[_0xb83f('0x48')]);_0x499baf[_0xb83f('0x4a')]=_['intersection'](_0x499baf[_0xb83f('0x46')],_0x499baf[_0xb83f('0x48')]);_0x134d26[_0xb83f('0x4d')]=_['intersection'](_0x499baf[_0xb83f('0x46')],qs[_0xb83f('0x4c')](_0xbb7cd2[_0xb83f('0x48')][_0xb83f('0x4c')]));_0x134d26[_0xb83f('0x4d')]=_0x134d26[_0xb83f('0x4d')][_0xb83f('0x66')]?_0x134d26[_0xb83f('0x4d')]:_0x499baf[_0xb83f('0x46')];_0x134d26[_0xb83f('0x50')]=qs[_0xb83f('0x51')](_0xbb7cd2[_0xb83f('0x48')][_0xb83f('0x51')]);_0x134d26[_0xb83f('0x52')]=qs[_0xb83f('0x4a')](_[_0xb83f('0x53')](_0xbb7cd2[_0xb83f('0x48')],_0x499baf[_0xb83f('0x4a')]));if(_0xbb7cd2[_0xb83f('0x48')][_0xb83f('0x54')]){_0x134d26[_0xb83f('0x52')]=_[_0xb83f('0x55')](_0x134d26[_0xb83f('0x52')],{'$or':_[_0xb83f('0x47')](_0x134d26[_0xb83f('0x4d')],function(_0xb54940){var _0xd86be2={};_0xd86be2[_0xb54940]={'$like':'%'+_0xbb7cd2[_0xb83f('0x48')]['filter']+'%'};return _0xd86be2;})});}_0x134d26=_['merge']({},_0x134d26,_0xbb7cd2['options']);return _0x43d486[_0xb83f('0x84')](_0x134d26);}})[_0xb83f('0x21')](function(_0x4971f1){if(_0x4971f1){_0x100ab7=_0x4971f1[_0xb83f('0x66')];if(!_0xbb7cd2[_0xb83f('0x48')][_0xb83f('0x4e')]('nolimit')){_0x134d26[_0xb83f('0x30')]=qs['limit'](_0xbb7cd2['query'][_0xb83f('0x30')]);_0x134d26[_0xb83f('0x2e')]=qs[_0xb83f('0x2e')](_0xbb7cd2[_0xb83f('0x48')][_0xb83f('0x2e')]);}return _0x43d486[_0xb83f('0x84')](_0x134d26);}})['then'](function(_0xf3e804){if(_0xf3e804){return _0xf3e804?{'count':_0x100ab7,'rows':_0xf3e804}:null;}})[_0xb83f('0x21')](respondWithResult(_0x140eb0,null))[_0xb83f('0x5b')](handleError(_0x140eb0,null));};function Extension(_0x1a5fdd,_0x212231,_0x483c17,_0x4d9f8f){this['context']='from-voip-provider';this[_0xb83f('0x85')]=_0x1a5fdd[_0xb83f('0x86')];this[_0xb83f('0x87')]=_0x4d9f8f;this[_0xb83f('0x44')]=_0xb83f('0x88');this['description']=_0xb83f('0x89');this[_0xb83f('0x67')]=_0x1a5fdd['id'];this[_0xb83f('0x82')]=_0x212231;this[_0xb83f('0x8a')]=_0x483c17;}function createExtensionsReciveFax(_0x398474){var _0x1eaae2=0x1;var _0x310411=[];_0x310411['push'](new Extension(_0x398474,_0x1eaae2,'',_0xb83f('0x8b')));_0x1eaae2+=0x1;_0x310411['push'](new Extension(_0x398474,_0x1eaae2,_0xb83f('0x8c'),'Set'));_0x1eaae2+=0x1;for(var _0x3a5235 in _0x398474){if(_0x398474[_0xb83f('0x4e')](_0x3a5235)&&(_0x3a5235===_0xb83f('0x8d')||_0x3a5235===_0xb83f('0x86')||_0x3a5235===_0xb83f('0x8e')||_0x3a5235===_0xb83f('0x8f')||_0x3a5235===_0xb83f('0x90')||_0x3a5235===_0xb83f('0x91')||_0x3a5235===_0xb83f('0x92')||_0x3a5235===_0xb83f('0x93')||_0x3a5235===_0xb83f('0x94'))){_0x310411[_0xb83f('0x95')](new Extension(_0x398474,_0x1eaae2,_0xb83f('0x96')+_0x3a5235+')='+_0x398474[_0x3a5235],_0xb83f('0x97')));_0x1eaae2+=0x1;}}_0x310411[_0xb83f('0x95')](new Extension(_0x398474,_0x1eaae2,'6',_0xb83f('0x98')));_0x1eaae2+=0x1;_0x310411[_0xb83f('0x95')](new Extension(_0x398474,_0x1eaae2,_0xb83f('0x99'),_0xb83f('0x9a')));_0x1eaae2=0x0;return _0x310411;}exports[_0xb83f('0x9b')]=function(_0x55fe15,_0x1ce598,_0x1c128){var _0x213ef6;return db[_0xb83f('0x7b')][_0xb83f('0x7c')](function(_0x3bafe2){return db[_0xb83f('0x56')][_0xb83f('0x5c')](_0x55fe15[_0xb83f('0x5d')],{'transaction':_0x3bafe2})['then'](function(_0x178336){_0x213ef6=_0x178336[_0xb83f('0x3a')]({'plain':!![]});return db[_0xb83f('0x9c')][_0xb83f('0x80')](createExtensionsReciveFax(_0x213ef6),{'transaction':_0x3bafe2});});})[_0xb83f('0x21')](function(){return _0x213ef6;})[_0xb83f('0x21')](respondWithResult(_0x1ce598,null))[_0xb83f('0x5b')](handleError(_0x1ce598,null));};exports[_0xb83f('0x9d')]=function(_0x1165f6,_0x1171c7,_0x43898d){var _0x4e1117;return db[_0xb83f('0x7b')]['transaction'](function(_0x1ffef7){return db[_0xb83f('0x56')][_0xb83f('0x38')](_0x1165f6[_0xb83f('0x5d')],{'where':{'id':_0x1165f6['body']['id']},'transaction':_0x1ffef7})[_0xb83f('0x21')](function(_0x3fa807){return db['VoiceExtension'][_0xb83f('0x39')]({'where':{'FaxAccountId':_0x1165f6['body']['id']},'transaction':_0x1ffef7})[_0xb83f('0x21')](function(_0x42e507){return db['VoiceExtension'][_0xb83f('0x80')](createExtensionsReciveFax(_[_0xb83f('0x71')](_0x1165f6[_0xb83f('0x5d')],[_0xb83f('0x9e'),'key','createdAt',_0xb83f('0x9f'),_0xb83f('0xa0'),_0xb83f('0xa1')])),{'transaction':_0x1ffef7});});});})[_0xb83f('0x21')](function(){return db[_0xb83f('0x56')][_0xb83f('0xa2')](_0x1165f6[_0xb83f('0x5d')]['id']);})[_0xb83f('0x21')](respondWithResult(_0x1171c7,null))[_0xb83f('0x5b')](handleError(_0x1171c7,null));};exports['getMessages']=function(_0x44d4b6,_0x17a60e,_0x8b176d){var _0x120ec4={'raw':!![],'where':{}};var _0x2f6971={};var _0x4cd001={'count':0x0,'rows':[]};return db[_0xb83f('0x56')]['findOne']({'where':{'id':_0x44d4b6['params']['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x17a60e,null))['then'](function(_0x5979fb){if(_0x5979fb){_0x2f6971[_0xb83f('0x46')]=_[_0xb83f('0x49')](db['FaxMessage'][_0xb83f('0x42')]);_0x2f6971[_0xb83f('0x48')]=_[_0xb83f('0x49')](_0x44d4b6['query']);_0x2f6971[_0xb83f('0x4a')]=_[_0xb83f('0x4b')](_0x2f6971['model'],_0x2f6971[_0xb83f('0x48')]);_0x120ec4['attributes']=_[_0xb83f('0x4b')](_0x2f6971[_0xb83f('0x46')],qs[_0xb83f('0x4c')](_0x44d4b6[_0xb83f('0x48')][_0xb83f('0x4c')]));_0x120ec4[_0xb83f('0x4d')]=_0x120ec4[_0xb83f('0x4d')][_0xb83f('0x66')]?_0x120ec4['attributes']:_0x2f6971[_0xb83f('0x46')];if(!_0x44d4b6[_0xb83f('0x48')][_0xb83f('0x4e')](_0xb83f('0x4f'))){_0x120ec4[_0xb83f('0x30')]=qs[_0xb83f('0x30')](_0x44d4b6[_0xb83f('0x48')][_0xb83f('0x30')]);_0x120ec4[_0xb83f('0x2e')]=qs[_0xb83f('0x2e')](_0x44d4b6[_0xb83f('0x48')][_0xb83f('0x2e')]);}_0x120ec4['order']=qs[_0xb83f('0x51')](_0x44d4b6[_0xb83f('0x48')][_0xb83f('0x51')]);_0x120ec4[_0xb83f('0x52')]=qs[_0xb83f('0x4a')](_[_0xb83f('0x53')](_0x44d4b6[_0xb83f('0x48')],_0x2f6971[_0xb83f('0x4a')]));_0x120ec4['where'][_0xb83f('0x67')]=_0x5979fb['id'];if(_0x44d4b6[_0xb83f('0x48')][_0xb83f('0x54')]){_0x120ec4['where']=_[_0xb83f('0x55')](_0x120ec4[_0xb83f('0x52')],{'$or':_[_0xb83f('0x47')](_0x120ec4[_0xb83f('0x4d')],function(_0x312a69){var _0x4ec137={};_0x4ec137[_0x312a69]={'$like':'%'+_0x44d4b6[_0xb83f('0x48')][_0xb83f('0x54')]+'%'};return _0x4ec137;})});}if(_0x44d4b6['query']['$gte']){var _0x5f1ad3=_0x44d4b6[_0xb83f('0x48')]['$gte'][_0xb83f('0xa3')](',');var _0x34fe95={};_0x34fe95[_0x5f1ad3[0x0]]={'$gte':moment(_0x5f1ad3[0x1])[_0xb83f('0xa4')](_0xb83f('0xa5'))};_0x120ec4[_0xb83f('0x52')]=_[_0xb83f('0x55')](_0x120ec4['where'],_0x34fe95);}_0x120ec4=_['merge']({},_0x120ec4,_0x44d4b6[_0xb83f('0x59')]);return db[_0xb83f('0xa6')]['count']({'where':_0x120ec4['where']})[_0xb83f('0x21')](function(_0x8acf09){_0x4cd001[_0xb83f('0x31')]=_0x8acf09;if(_0x44d4b6['query'][_0xb83f('0x58')]){_0x120ec4[_0xb83f('0x68')]=[{'all':!![]}];}return db[_0xb83f('0xa6')]['findAll'](_0x120ec4);})['then'](function(_0x5d7c4d){_0x4cd001['rows']=_0x5d7c4d;return _0x4cd001;});}})[_0xb83f('0x21')](respondWithFilteredResult(_0x17a60e,_0x120ec4))[_0xb83f('0x5b')](handleError(_0x17a60e,null));};exports[_0xb83f('0x3f')]=function(_0xe1fc34,_0xc88b2d,_0x580538){var _0x5bb8be,_0x34e75f={},_0x1af3ac;if(_0xe1fc34[_0xb83f('0x5d')]['to']){_0x1af3ac=_0xe1fc34[_0xb83f('0x5d')]['to'][0x0];}return db[_0xb83f('0x56')][_0xb83f('0x5a')]({'where':{'id':_0xe1fc34[_0xb83f('0x62')]['id']},'include':[{'model':db[_0xb83f('0xa7')],'as':_0xb83f('0xa8'),'include':[{'model':db[_0xb83f('0x74')],'as':_0xb83f('0xa9'),'where':{'fax':_0x1af3ac},'limit':0x1,'order':[[_0xb83f('0x9f'),_0xb83f('0xaa')]]}]}]})[_0xb83f('0x21')](handleEntityNotFound(_0xc88b2d,null))['then'](function(_0x363973){_0x5bb8be=_0x363973;if(_0xe1fc34['body'][_0xb83f('0xab')]&&_0xe1fc34['body'][_0xb83f('0xab')]['length']){for(var _0x216354=0x0;_0x216354<_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][_0xb83f('0x66')];_0x216354+=0x1){_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][_0x216354]={'filename':_0xe1fc34[_0xb83f('0x5d')]['attachments'][_0x216354][_0xb83f('0x3e')],'id':_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][_0x216354]['id'],'path':path['join'](config[_0xb83f('0xac')],'server/files/attachments',_0xe1fc34[_0xb83f('0x5d')]['attachments'][_0x216354][_0xb83f('0xad')])};}}return respondWithRpcPromise(_0xb83f('0xae'),_0xb83f('0xae'),{'FaxAccountId':_['isNil'](_0xe1fc34[_0xb83f('0x62')]['id'])?undefined:_0xe1fc34['params']['id'],'path':_['isNil'](_0xe1fc34['body'][_0xb83f('0xab')][0x0][_0xb83f('0xaf')])?undefined:_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][0x0][_0xb83f('0xaf')],'fax':_['isNil'](_0xe1fc34['body']['to'][0x0])?undefined:_0xe1fc34[_0xb83f('0x5d')]['to'][0x0]},client9002);})[_0xb83f('0x21')](function(){if(_0x5bb8be){if(_[_0xb83f('0xb0')](_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xb1')])){_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xb1')]=util[_0xb83f('0xa4')](_0xb83f('0xb2'),_0x5bb8be[_0xb83f('0x3e')],_0x5bb8be[_0xb83f('0xb3')]);}if(_0x5bb8be[_0xb83f('0xa8')]){if(_0x5bb8be['List'][_0xb83f('0xa9')]['length']){return _0x5bb8be[_0xb83f('0xa8')][_0xb83f('0xa9')][0x0];}else{return db[_0xb83f('0x74')]['create'](_[_0xb83f('0xb4')](_0xe1fc34[_0xb83f('0x5d')],{'firstName':_0xe1fc34[_0xb83f('0x5d')]['to'][0x0],'phone':_0xe1fc34['body']['to'][0x0],'fax':_0xe1fc34[_0xb83f('0x5d')]['to'][0x0],'ListId':_0x5bb8be[_0xb83f('0xa1')]}));}}else{throw new Error(_0xb83f('0xb5'));}}else{throw new Error(_0xb83f('0xb6'));}})['then'](function(_0x44cad2){if(_0x44cad2){return db[_0xb83f('0x70')]['find']({'where':{'ContactId':_0x44cad2['id'],'closed':![],'FaxAccountId':_0x5bb8be['id']}})[_0xb83f('0x21')](function(_0x50cdde){if(_0x50cdde){return[_0x50cdde,![]];}return db[_0xb83f('0x70')][_0xb83f('0x5c')]({'UserId':_0xe1fc34[_0xb83f('0x5f')]['id'],'ContactId':_0x44cad2['id'],'FaxAccountId':_0x5bb8be['id'],'fax':_0xe1fc34[_0xb83f('0x5d')]['to'][0x0],'firstMsgDirection':_0xb83f('0xb7'),'Messages':[_[_0xb83f('0x55')](_0xe1fc34[_0xb83f('0x5d')],{'read':![],'body':_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][0x0][_0xb83f('0xb8')],'FaxAccountId':_0x5bb8be['id'],'UserId':_0xe1fc34[_0xb83f('0x5f')]['id'],'ContactId':_0x44cad2['id'],'AttachmentId':_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][0x0]['id']})]},{'include':[{'model':db[_0xb83f('0xa6')],'as':_0xb83f('0xb9')}]})['then'](function(_0x101f7d){return[_0x101f7d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb83f('0xba')](function(_0x5390c3,_0x239fd6){if(_0x239fd6){return _0x5390c3;}return db[_0xb83f('0xa6')]['create']({'direction':_0xb83f('0xb7'),'read':![],'body':_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][0x0]['filename'],'FaxAccountId':_0x5bb8be['id'],'FaxInteractionId':_0x5390c3['id'],'UserId':_0xe1fc34[_0xb83f('0x5f')]['id'],'ContactId':_0x5390c3[_0xb83f('0xbb')],'AttachmentId':_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][0x0]['id']})['then'](function(_0x12162d){_0x5390c3[_0xb83f('0xbc')][_0xb83f('0xb9')]=[];_0x5390c3[_0xb83f('0xbc')][_0xb83f('0xb9')][_0xb83f('0x95')](_0x12162d[_0xb83f('0xbc')]);return _0x5390c3;});})[_0xb83f('0x21')](function(_0x511d8c){respondWithRpcPromise(_0xb83f('0xbd'),_0xb83f('0xbd'),{'FaxAccountId':_[_0xb83f('0xb0')](_0xe1fc34['params']['id'])?undefined:_0xe1fc34[_0xb83f('0x62')]['id'],'path':_[_0xb83f('0xb0')](_0xe1fc34['body'][_0xb83f('0xab')][0x0][_0xb83f('0xaf')])?undefined:_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][0x0]['path'],'fax':_[_0xb83f('0xb0')](_0xe1fc34['body']['to'][0x0])?undefined:_0xe1fc34[_0xb83f('0x5d')]['to'][0x0],'AttachmentId':_0xe1fc34[_0xb83f('0x5d')][_0xb83f('0xab')][0x0]['id']},client9002)[_0xb83f('0x21')](function(_0x15d940){logger[_0xb83f('0x22')](_0xb83f('0xbe'),_0x15d940);})['catch'](function(_0x4f8237){logger[_0xb83f('0x22')](_0xb83f('0xbe'),_0x4f8237);});return _0x511d8c;})[_0xb83f('0x21')](respondWithResult(_0xc88b2d,null))[_0xb83f('0x5b')](handleError(_0xc88b2d,null));};exports[_0xb83f('0xbf')]=function(_0x13d206,_0x377f63,_0x29e2aa){return db[_0xb83f('0x56')][_0xb83f('0x5a')]({'where':{'id':_0x13d206[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x377f63,null))[_0xb83f('0x21')](function(_0x3d1a72){if(_0x3d1a72){return _0x3d1a72[_0xb83f('0xbf')](_0x13d206[_0xb83f('0x5d')][_0xb83f('0x72')],_[_0xb83f('0x71')](_0x13d206['body'],[_0xb83f('0x72'),'id'])||{})['spread'](function(_0x4a5d31){for(var _0x43a33e=0x0;_0x43a33e<_0x13d206['body'][_0xb83f('0x72')][_0xb83f('0x66')];_0x43a33e+=0x1){socket[_0xb83f('0xc0')]('userFaxAccount:save',{'UserId':Number(_0x13d206['body'][_0xb83f('0x72')][_0x43a33e]),'FaxAccountId':Number(_0x13d206[_0xb83f('0x62')]['id'])});}return _0x4a5d31;});}})[_0xb83f('0x21')](respondWithResult(_0x377f63,null))['catch'](handleError(_0x377f63,null));};exports['removeAgents']=function(_0x2af49a,_0x2778ea,_0xac60e5){return db[_0xb83f('0x56')][_0xb83f('0x5a')]({'where':{'id':_0x2af49a[_0xb83f('0x62')]['id']}})['then'](handleEntityNotFound(_0x2778ea,null))[_0xb83f('0x21')](function(_0x586d45){if(_0x586d45){return _0x586d45[_0xb83f('0xc1')](_0x2af49a[_0xb83f('0x48')][_0xb83f('0x72')])[_0xb83f('0x21')](function(){if(_[_0xb83f('0xc2')](_0x2af49a['query'][_0xb83f('0x72')])){for(var _0x16587a=0x0;_0x16587a<_0x2af49a[_0xb83f('0x48')][_0xb83f('0x72')]['length'];_0x16587a+=0x1){socket[_0xb83f('0xc0')](_0xb83f('0xc3'),{'UserId':Number(_0x2af49a['query']['ids'][_0x16587a]),'FaxAccountId':Number(_0x2af49a['params']['id'])});}}else{socket['emit'](_0xb83f('0xc3'),{'UserId':Number(_0x2af49a['query'][_0xb83f('0x72')]),'FaxAccountId':Number(_0x2af49a[_0xb83f('0x62')]['id'])});}});}})[_0xb83f('0x21')](respondWithStatusCode(_0x2778ea,null))[_0xb83f('0x5b')](handleError(_0x2778ea,null));};exports[_0xb83f('0xc4')]=function(_0x5c06a6,_0x23610,_0x157489){var _0x1c9f0c={};var _0x27568a={};var _0x3e7fc1;var _0x4b6c04;return db[_0xb83f('0x56')][_0xb83f('0x73')]({'where':{'id':_0x5c06a6[_0xb83f('0x62')]['id']}})[_0xb83f('0x21')](handleEntityNotFound(_0x23610,null))[_0xb83f('0x21')](function(_0x4394a8){if(_0x4394a8){_0x3e7fc1=_0x4394a8;_0x27568a[_0xb83f('0x46')]=_[_0xb83f('0x49')](db[_0xb83f('0x76')][_0xb83f('0x42')]);_0x27568a[_0xb83f('0x48')]=_['keys'](_0x5c06a6[_0xb83f('0x48')]);_0x27568a['filters']=_['intersection'](_0x27568a[_0xb83f('0x46')],_0x27568a['query']);_0x1c9f0c[_0xb83f('0x4d')]=_[_0xb83f('0x4b')](_0x27568a[_0xb83f('0x46')],qs['fields'](_0x5c06a6[_0xb83f('0x48')][_0xb83f('0x4c')]));_0x1c9f0c[_0xb83f('0x4d')]=_0x1c9f0c[_0xb83f('0x4d')][_0xb83f('0x66')]?_0x1c9f0c[_0xb83f('0x4d')]:_0x27568a[_0xb83f('0x46')];_0x1c9f0c['order']=qs[_0xb83f('0x51')](_0x5c06a6[_0xb83f('0x48')][_0xb83f('0x51')]);_0x1c9f0c[_0xb83f('0x52')]=qs[_0xb83f('0x4a')](_[_0xb83f('0x53')](_0x5c06a6['query'],_0x27568a['filters']));if(_0x5c06a6[_0xb83f('0x48')][_0xb83f('0x54')]){_0x1c9f0c[_0xb83f('0x52')]=_[_0xb83f('0x55')](_0x1c9f0c[_0xb83f('0x52')],{'$or':_[_0xb83f('0x47')](_0x1c9f0c[_0xb83f('0x4d')],function(_0x450b78){var _0x692f27={};_0x692f27[_0x450b78]={'$like':'%'+_0x5c06a6['query']['filter']+'%'};return _0x692f27;})});}_0x1c9f0c=_[_0xb83f('0x55')]({},_0x1c9f0c,_0x5c06a6['options']);return _0x3e7fc1['getAgents'](_0x1c9f0c);}})[_0xb83f('0x21')](function(_0x542b73){if(_0x542b73){_0x4b6c04=_0x542b73[_0xb83f('0x66')];if(!_0x5c06a6[_0xb83f('0x48')]['hasOwnProperty'](_0xb83f('0x4f'))){_0x1c9f0c[_0xb83f('0x30')]=qs[_0xb83f('0x30')](_0x5c06a6[_0xb83f('0x48')]['limit']);_0x1c9f0c[_0xb83f('0x2e')]=qs[_0xb83f('0x2e')](_0x5c06a6[_0xb83f('0x48')][_0xb83f('0x2e')]);}return _0x3e7fc1[_0xb83f('0xc4')](_0x1c9f0c);}})[_0xb83f('0x21')](function(_0x18adc1){if(_0x18adc1){return _0x18adc1?{'count':_0x4b6c04,'rows':_0x18adc1}:null;}})['then'](respondWithResult(_0x23610,null))['catch'](handleError(_0x23610,null));}; \ No newline at end of file +var _0x1a19=['dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','get','FaxAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','FaxAccount','findAll','rows','catch','show','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','removeDispositions','addAnswer','getAnswers','CannedAnswer','includeAll','removeAnswers','addInteraction','ids','omit','FaxInteraction','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','key','createdAt','TrunkId','ListId','FaxMessage','$gte','format','CmList','List','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','CmContact','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId'];(function(_0x418f0b,_0xe47fcf){var _0x4c0491=function(_0xf1922e){while(--_0xf1922e){_0x418f0b['push'](_0x418f0b['shift']());}};_0x4c0491(++_0xe47fcf);}(_0x1a19,0xce));var _0x91a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a19[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x91a1('0x0'));var rimraf=require(_0x91a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91a1('0x2'));var rp=require(_0x91a1('0x3'));var moment=require(_0x91a1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x91a1('0x5'));var path=require(_0x91a1('0x6'));var sox=require(_0x91a1('0x7'));var csv=require(_0x91a1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91a1('0x9'));var _=require(_0x91a1('0xa'));var squel=require('squel');var crypto=require(_0x91a1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x91a1('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91a1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x91a1('0xe'));var as=require(_0x91a1('0xf'));var hardwareService=require(_0x91a1('0x10'));var logger=require('../../config/logger')(_0x91a1('0x11'));var utils=require(_0x91a1('0x12'));var config=require(_0x91a1('0x13'));var licenseUtil=require(_0x91a1('0x14'));var db=require(_0x91a1('0x15'))['db'];config[_0x91a1('0x16')]=_[_0x91a1('0x17')](config[_0x91a1('0x16')],{'host':_0x91a1('0x18'),'port':0x18eb});var socket=require(_0x91a1('0x19'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x91a1('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x91a1('0x1b')][_0x91a1('0x1c')]({'port':0x232c});var client9002=jayson[_0x91a1('0x1b')][_0x91a1('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x45b04b,_0x35869c,_0x1fab90,_0x1ae287){return new BPromise(function(_0x170aa5,_0x393b1b){var _0x70bdde=_0x1ae287||client;return _0x70bdde[_0x91a1('0x1d')](_0x45b04b,_0x1fab90)[_0x91a1('0x1e')](function(_0x2bd44a){logger[_0x91a1('0x1f')](_0x91a1('0x20'),_0x35869c,_0x91a1('0x21'));logger[_0x91a1('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x35869c,_0x91a1('0x21'),JSON[_0x91a1('0x23')](_0x2bd44a));if(_0x2bd44a[_0x91a1('0x24')]){if(_0x2bd44a[_0x91a1('0x24')][_0x91a1('0x25')]===0x1f4){logger[_0x91a1('0x24')](_0x91a1('0x20'),_0x35869c,_0x2bd44a[_0x91a1('0x24')][_0x91a1('0x26')]);return _0x393b1b(_0x2bd44a[_0x91a1('0x24')][_0x91a1('0x26')]);}logger[_0x91a1('0x24')]('FaxAccount,\x20%s,\x20%s',_0x35869c,_0x2bd44a[_0x91a1('0x24')][_0x91a1('0x26')]);return _0x170aa5(_0x2bd44a[_0x91a1('0x24')][_0x91a1('0x26')]);}else{logger[_0x91a1('0x1f')](_0x91a1('0x20'),_0x35869c,_0x91a1('0x21'));_0x170aa5(_0x2bd44a[_0x91a1('0x27')][_0x91a1('0x26')]);}})['catch'](function(_0x27b537){logger[_0x91a1('0x24')]('FaxAccount,\x20%s,\x20%s',_0x35869c,_0x27b537);_0x393b1b(_0x27b537);});});}function respondWithStatusCode(_0x1c4ab4,_0x4232fe){_0x4232fe=_0x4232fe||0xcc;return function(_0xa3c1f0){if(_0xa3c1f0){return _0x1c4ab4[_0x91a1('0x28')](_0x4232fe);}return _0x1c4ab4[_0x91a1('0x29')](_0x4232fe)['end']();};}function respondWithResult(_0x5e6940,_0x575f31){_0x575f31=_0x575f31||0xc8;return function(_0x15acc7){if(_0x15acc7){return _0x5e6940['status'](_0x575f31)[_0x91a1('0x2a')](_0x15acc7);}};}function respondWithFilteredResult(_0x26167,_0x5bc738){return function(_0x18e860){if(_0x18e860){var _0x34b727=typeof _0x5bc738[_0x91a1('0x2b')]===_0x91a1('0x2c')&&typeof _0x5bc738['limit']==='undefined';var _0xa42e5a=_0x18e860[_0x91a1('0x2d')];var _0x3cd402=_0x34b727?0x0:_0x5bc738[_0x91a1('0x2b')];var _0x1accce=_0x34b727?_0x18e860[_0x91a1('0x2d')]:_0x5bc738['offset']+_0x5bc738[_0x91a1('0x2e')];var _0x273872;if(_0x1accce>=_0xa42e5a){_0x1accce=_0xa42e5a;_0x273872=0xc8;}else{_0x273872=0xce;}_0x26167[_0x91a1('0x29')](_0x273872);return _0x26167[_0x91a1('0x2f')](_0x91a1('0x30'),_0x3cd402+'-'+_0x1accce+'/'+_0xa42e5a)[_0x91a1('0x2a')](_0x18e860);}return null;};}function patchUpdates(_0x3eb5e8){return function(_0xbd06a){try{jsonpatch[_0x91a1('0x31')](_0xbd06a,_0x3eb5e8,!![]);}catch(_0x3f985f){return BPromise[_0x91a1('0x32')](_0x3f985f);}return _0xbd06a['save']();};}function saveUpdates(_0x4c37ef,_0x2b9c84){return function(_0x12b3cb){if(_0x12b3cb){return _0x12b3cb[_0x91a1('0x33')](_0x4c37ef)[_0x91a1('0x1e')](function(_0xd7d857){return _0xd7d857;});}return null;};}function removeEntity(_0x124819,_0x1be0f1){return function(_0x2d3e60){if(_0x2d3e60){return _0x2d3e60['destroy']()[_0x91a1('0x1e')](function(){var _0xce0513=_0x2d3e60[_0x91a1('0x34')]({'plain':!![]});var _0xc78663=_0x91a1('0x35');return db[_0x91a1('0x36')][_0x91a1('0x37')]({'where':{'type':_0xc78663,'resourceId':_0xce0513['id']}})[_0x91a1('0x1e')](function(){return _0x2d3e60;});})[_0x91a1('0x1e')](function(){_0x124819[_0x91a1('0x29')](0xcc)[_0x91a1('0x38')]();});}};}function handleEntityNotFound(_0xa32b7f,_0x14bbe7){return function(_0x5cfc85){if(!_0x5cfc85){_0xa32b7f[_0x91a1('0x28')](0x194);}return _0x5cfc85;};}function handleError(_0x5969b0,_0x472384){_0x472384=_0x472384||0x1f4;return function(_0x152c60){logger[_0x91a1('0x24')](_0x152c60[_0x91a1('0x39')]);if(_0x152c60[_0x91a1('0x3a')]){delete _0x152c60[_0x91a1('0x3a')];}_0x5969b0[_0x91a1('0x29')](_0x472384)[_0x91a1('0x3b')](_0x152c60);};}exports[_0x91a1('0x3c')]=function(_0x5d0e94,_0x366c7e){var _0xb34939={'include':[{'model':db[_0x91a1('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5f19bb={},_0x48e78e={'count':0x0,'rows':[]};var _0x322104=_[_0x91a1('0x3e')](db['FaxAccount'][_0x91a1('0x3f')],function(_0x2a2efa){return{'name':_0x2a2efa[_0x91a1('0x40')],'type':_0x2a2efa[_0x91a1('0x41')]['key']};});_0x5f19bb[_0x91a1('0x42')]=_['map'](_0x322104,_0x91a1('0x3a'));_0x5f19bb[_0x91a1('0x43')]=_[_0x91a1('0x44')](_0x5d0e94[_0x91a1('0x43')]);_0x5f19bb['filters']=_['intersection'](_0x5f19bb[_0x91a1('0x42')],_0x5f19bb['query']);_0xb34939[_0x91a1('0x45')]=_['intersection'](_0x5f19bb[_0x91a1('0x42')],qs[_0x91a1('0x46')](_0x5d0e94[_0x91a1('0x43')][_0x91a1('0x46')]));_0xb34939[_0x91a1('0x45')]=_0xb34939[_0x91a1('0x45')][_0x91a1('0x47')]?_0xb34939[_0x91a1('0x45')]:_0x5f19bb[_0x91a1('0x42')];if(!_0x5d0e94[_0x91a1('0x43')][_0x91a1('0x48')](_0x91a1('0x49'))){_0xb34939[_0x91a1('0x2e')]=qs[_0x91a1('0x2e')](_0x5d0e94[_0x91a1('0x43')][_0x91a1('0x2e')]);_0xb34939[_0x91a1('0x2b')]=qs[_0x91a1('0x2b')](_0x5d0e94[_0x91a1('0x43')][_0x91a1('0x2b')]);}_0xb34939[_0x91a1('0x4a')]=qs[_0x91a1('0x4b')](_0x5d0e94['query']['sort']);_0xb34939[_0x91a1('0x4c')]=qs['filters'](_[_0x91a1('0x4d')](_0x5d0e94[_0x91a1('0x43')],_0x5f19bb[_0x91a1('0x4e')]),_0x322104);if(_0x5d0e94[_0x91a1('0x43')][_0x91a1('0x4f')]){_0xb34939[_0x91a1('0x4c')]=_[_0x91a1('0x50')](_0xb34939[_0x91a1('0x4c')],{'$or':_[_0x91a1('0x3e')](_0x322104,function(_0x33d016){if(_0x33d016[_0x91a1('0x41')]!==_0x91a1('0x51')){var _0x429019={};_0x429019[_0x33d016[_0x91a1('0x3a')]]={'$like':'%'+_0x5d0e94[_0x91a1('0x43')][_0x91a1('0x4f')]+'%'};return _0x429019;}})});}_0xb34939=_[_0x91a1('0x50')]({},_0xb34939,_0x5d0e94['options']);var _0x16a2ba={'where':_0xb34939[_0x91a1('0x4c')]};return db[_0x91a1('0x52')][_0x91a1('0x2d')](_0x16a2ba)[_0x91a1('0x1e')](function(_0x54bf22){_0x48e78e[_0x91a1('0x2d')]=_0x54bf22;if(_0x5d0e94['query']['includeAll']){_0xb34939['include']=[{'all':!![]}];}return db[_0x91a1('0x52')][_0x91a1('0x53')](_0xb34939);})[_0x91a1('0x1e')](function(_0x433bbf){_0x48e78e[_0x91a1('0x54')]=_0x433bbf;return _0x48e78e;})[_0x91a1('0x1e')](respondWithFilteredResult(_0x366c7e,_0xb34939))[_0x91a1('0x55')](handleError(_0x366c7e,null));};exports[_0x91a1('0x56')]=function(_0x353567,_0x46a334){var _0x13c410={'raw':![],'where':{'id':_0x353567['params']['id']},'include':[{'model':db[_0x91a1('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5efed4={};_0x5efed4[_0x91a1('0x42')]=_[_0x91a1('0x44')](db[_0x91a1('0x52')]['rawAttributes']);_0x5efed4[_0x91a1('0x43')]=_[_0x91a1('0x44')](_0x353567[_0x91a1('0x43')]);_0x5efed4[_0x91a1('0x4e')]=_[_0x91a1('0x57')](_0x5efed4[_0x91a1('0x42')],_0x5efed4[_0x91a1('0x43')]);_0x13c410['attributes']=_[_0x91a1('0x57')](_0x5efed4[_0x91a1('0x42')],qs[_0x91a1('0x46')](_0x353567[_0x91a1('0x43')][_0x91a1('0x46')]));_0x13c410[_0x91a1('0x45')]=_0x13c410[_0x91a1('0x45')][_0x91a1('0x47')]?_0x13c410[_0x91a1('0x45')]:_0x5efed4['model'];if(_0x353567[_0x91a1('0x43')]['includeAll']){_0x13c410[_0x91a1('0x58')]=[{'all':!![]}];}_0x13c410=_['merge']({},_0x13c410,_0x353567[_0x91a1('0x59')]);return db['FaxAccount'][_0x91a1('0x5a')](_0x13c410)[_0x91a1('0x1e')](handleEntityNotFound(_0x46a334,null))[_0x91a1('0x1e')](respondWithResult(_0x46a334,null))['catch'](handleError(_0x46a334,null));};exports['create']=function(_0x27ed24,_0x193c5e){return db['FaxAccount'][_0x91a1('0x5b')](_0x27ed24['body'],{})['then'](function(_0x7c2804){var _0x2bf7c1=_0x27ed24[_0x91a1('0x5c')][_0x91a1('0x34')]({'plain':!![]});if(!_0x2bf7c1)throw new Error(_0x91a1('0x5d'));if(_0x2bf7c1[_0x91a1('0x5e')]===_0x91a1('0x5c')){var _0x42bd7d=_0x7c2804['get']({'plain':!![]});var _0xf9468e=_0x91a1('0x35');return db[_0x91a1('0x5f')][_0x91a1('0x5a')]({'where':{'name':_0xf9468e,'userProfileId':_0x2bf7c1['userProfileId']},'raw':!![]})[_0x91a1('0x1e')](function(_0x438fe2){if(_0x438fe2&&_0x438fe2[_0x91a1('0x60')]===0x0){return db[_0x91a1('0x36')][_0x91a1('0x5b')]({'name':_0x42bd7d[_0x91a1('0x3a')],'resourceId':_0x42bd7d['id'],'type':_0x438fe2['name'],'sectionId':_0x438fe2['id']},{})[_0x91a1('0x1e')](function(){return _0x7c2804;});}else{return _0x7c2804;}})[_0x91a1('0x55')](function(_0x154375){logger[_0x91a1('0x24')](_0x91a1('0x61'),_0x154375);throw _0x154375;});}return _0x7c2804;})[_0x91a1('0x1e')](respondWithResult(_0x193c5e,0xc9))[_0x91a1('0x55')](handleError(_0x193c5e,null));};exports[_0x91a1('0x33')]=function(_0x97afe3,_0x3a0188){if(_0x97afe3[_0x91a1('0x62')]['id']){delete _0x97afe3[_0x91a1('0x62')]['id'];}return db[_0x91a1('0x52')]['find']({'where':{'id':_0x97afe3[_0x91a1('0x63')]['id']},'include':[{'model':db[_0x91a1('0x3d')],'as':_0x91a1('0x64')}]})[_0x91a1('0x1e')](handleEntityNotFound(_0x3a0188,null))['then'](saveUpdates(_0x97afe3[_0x91a1('0x62')],null))['then'](respondWithResult(_0x3a0188,null))['catch'](handleError(_0x3a0188,null));};exports[_0x91a1('0x37')]=function(_0x4d5941,_0x3b5aef){return db[_0x91a1('0x52')][_0x91a1('0x5a')]({'where':{'id':_0x4d5941[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x3b5aef,null))[_0x91a1('0x1e')](removeEntity(_0x3b5aef,null))[_0x91a1('0x55')](handleError(_0x3b5aef,null));};exports[_0x91a1('0x65')]=function(_0x1068ca,_0x2130cc){return db[_0x91a1('0x52')]['describe']()[_0x91a1('0x1e')](respondWithResult(_0x2130cc,null))[_0x91a1('0x55')](handleError(_0x2130cc,null));};exports[_0x91a1('0x66')]=function(_0x5a9d75,_0x35e29a,_0x5ec057){if(_0x5a9d75[_0x91a1('0x62')]['id']){delete _0x5a9d75['body']['id'];}return db[_0x91a1('0x52')]['find']({'where':{'id':_0x5a9d75[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x35e29a,null))['then'](function(_0xf8d4c7){if(_0xf8d4c7){_0x5a9d75[_0x91a1('0x62')]['FaxAccountId']=_0xf8d4c7['id'];return db[_0x91a1('0x67')][_0x91a1('0x5b')](_0x5a9d75[_0x91a1('0x62')]);}})[_0x91a1('0x1e')](respondWithResult(_0x35e29a,null))['catch'](handleError(_0x35e29a,null));};exports[_0x91a1('0x68')]=function(_0x309c08,_0x12f7e5,_0x160a2b){var _0x382db5={'raw':![],'where':{}};var _0x4dd9f7={};var _0x10543d={'count':0x0,'rows':[]};return db[_0x91a1('0x52')][_0x91a1('0x69')]({'where':{'id':_0x309c08[_0x91a1('0x63')]['id']}})['then'](handleEntityNotFound(_0x12f7e5,null))[_0x91a1('0x1e')](function(_0x1f0373){if(_0x1f0373){_0x4dd9f7['model']=_['keys'](db[_0x91a1('0x67')]['rawAttributes']);_0x4dd9f7[_0x91a1('0x43')]=_[_0x91a1('0x44')](_0x309c08[_0x91a1('0x43')]);_0x4dd9f7[_0x91a1('0x4e')]=_[_0x91a1('0x57')](_0x4dd9f7[_0x91a1('0x42')],_0x4dd9f7[_0x91a1('0x43')]);_0x382db5[_0x91a1('0x45')]=_[_0x91a1('0x57')](_0x4dd9f7[_0x91a1('0x42')],qs['fields'](_0x309c08[_0x91a1('0x43')]['fields']));_0x382db5[_0x91a1('0x45')]=_0x382db5[_0x91a1('0x45')][_0x91a1('0x47')]?_0x382db5[_0x91a1('0x45')]:_0x4dd9f7[_0x91a1('0x42')];if(!_0x309c08[_0x91a1('0x43')][_0x91a1('0x48')](_0x91a1('0x49'))){_0x382db5[_0x91a1('0x2e')]=qs[_0x91a1('0x2e')](_0x309c08[_0x91a1('0x43')]['limit']);_0x382db5[_0x91a1('0x2b')]=qs[_0x91a1('0x2b')](_0x309c08['query'][_0x91a1('0x2b')]);}_0x382db5['order']=qs[_0x91a1('0x4b')](_0x309c08['query'][_0x91a1('0x4b')]);_0x382db5[_0x91a1('0x4c')]=qs[_0x91a1('0x4e')](_[_0x91a1('0x4d')](_0x309c08['query'],_0x4dd9f7[_0x91a1('0x4e')]));_0x382db5['where'][_0x91a1('0x6a')]=_0x1f0373['id'];if(_0x309c08[_0x91a1('0x43')][_0x91a1('0x4f')]){_0x382db5[_0x91a1('0x4c')]=_[_0x91a1('0x50')](_0x382db5[_0x91a1('0x4c')],{'$or':_[_0x91a1('0x3e')](_0x382db5[_0x91a1('0x45')],function(_0x307c53){var _0x212745={};_0x212745[_0x307c53]={'$like':'%'+_0x309c08[_0x91a1('0x43')][_0x91a1('0x4f')]+'%'};return _0x212745;})});}_0x382db5=_[_0x91a1('0x50')]({},_0x382db5,_0x309c08['options']);return db[_0x91a1('0x67')][_0x91a1('0x2d')]({'where':_0x382db5['where']})[_0x91a1('0x1e')](function(_0x16d2d0){_0x10543d[_0x91a1('0x2d')]=_0x16d2d0;if(_0x309c08[_0x91a1('0x43')]['includeAll']){_0x382db5[_0x91a1('0x58')]=[{'all':!![]}];}return db['Disposition'][_0x91a1('0x53')](_0x382db5);})[_0x91a1('0x1e')](function(_0x276864){_0x10543d[_0x91a1('0x54')]=_0x276864;return _0x10543d;});}})[_0x91a1('0x1e')](respondWithFilteredResult(_0x12f7e5,_0x382db5))[_0x91a1('0x55')](handleError(_0x12f7e5,null));};exports[_0x91a1('0x6b')]=function(_0x5407f7,_0x17c467,_0x1e8306){return db[_0x91a1('0x52')][_0x91a1('0x5a')]({'where':{'id':_0x5407f7[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x17c467,null))[_0x91a1('0x1e')](function(_0x5533d2){if(_0x5533d2){return _0x5533d2[_0x91a1('0x6b')](_0x5407f7[_0x91a1('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x17c467,null))[_0x91a1('0x55')](handleError(_0x17c467,null));};exports[_0x91a1('0x6c')]=function(_0x113b8a,_0x1ee2f7,_0x5c2d7b){if(_0x113b8a['body']['id']){delete _0x113b8a[_0x91a1('0x62')]['id'];}return db[_0x91a1('0x52')][_0x91a1('0x5a')]({'where':{'id':_0x113b8a[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x1ee2f7,null))[_0x91a1('0x1e')](function(_0x25bd85){if(_0x25bd85){_0x113b8a[_0x91a1('0x62')]['FaxAccountId']=_0x25bd85['id'];return db['CannedAnswer'][_0x91a1('0x5b')](_0x113b8a[_0x91a1('0x62')]);}})[_0x91a1('0x1e')](respondWithResult(_0x1ee2f7,null))[_0x91a1('0x55')](handleError(_0x1ee2f7,null));};exports[_0x91a1('0x6d')]=function(_0x1f3e5c,_0x56ede5,_0x5e79de){var _0x5a66c3={'raw':![],'where':{}};var _0xbffb61={};var _0x8ee775={'count':0x0,'rows':[]};return db[_0x91a1('0x52')][_0x91a1('0x69')]({'where':{'id':_0x1f3e5c[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x56ede5,null))['then'](function(_0x49b905){if(_0x49b905){_0xbffb61['model']=_[_0x91a1('0x44')](db[_0x91a1('0x6e')][_0x91a1('0x3f')]);_0xbffb61[_0x91a1('0x43')]=_[_0x91a1('0x44')](_0x1f3e5c[_0x91a1('0x43')]);_0xbffb61[_0x91a1('0x4e')]=_[_0x91a1('0x57')](_0xbffb61[_0x91a1('0x42')],_0xbffb61[_0x91a1('0x43')]);_0x5a66c3['attributes']=_[_0x91a1('0x57')](_0xbffb61[_0x91a1('0x42')],qs[_0x91a1('0x46')](_0x1f3e5c[_0x91a1('0x43')][_0x91a1('0x46')]));_0x5a66c3[_0x91a1('0x45')]=_0x5a66c3[_0x91a1('0x45')]['length']?_0x5a66c3['attributes']:_0xbffb61[_0x91a1('0x42')];if(!_0x1f3e5c[_0x91a1('0x43')][_0x91a1('0x48')](_0x91a1('0x49'))){_0x5a66c3['limit']=qs[_0x91a1('0x2e')](_0x1f3e5c[_0x91a1('0x43')][_0x91a1('0x2e')]);_0x5a66c3[_0x91a1('0x2b')]=qs[_0x91a1('0x2b')](_0x1f3e5c[_0x91a1('0x43')][_0x91a1('0x2b')]);}_0x5a66c3['order']=qs[_0x91a1('0x4b')](_0x1f3e5c[_0x91a1('0x43')][_0x91a1('0x4b')]);_0x5a66c3['where']=qs[_0x91a1('0x4e')](_[_0x91a1('0x4d')](_0x1f3e5c['query'],_0xbffb61[_0x91a1('0x4e')]));_0x5a66c3[_0x91a1('0x4c')][_0x91a1('0x6a')]=_0x49b905['id'];if(_0x1f3e5c[_0x91a1('0x43')][_0x91a1('0x4f')]){_0x5a66c3[_0x91a1('0x4c')]=_[_0x91a1('0x50')](_0x5a66c3[_0x91a1('0x4c')],{'$or':_[_0x91a1('0x3e')](_0x5a66c3[_0x91a1('0x45')],function(_0x5e5a5a){var _0x2e1511={};_0x2e1511[_0x5e5a5a]={'$like':'%'+_0x1f3e5c['query'][_0x91a1('0x4f')]+'%'};return _0x2e1511;})});}_0x5a66c3=_['merge']({},_0x5a66c3,_0x1f3e5c[_0x91a1('0x59')]);return db[_0x91a1('0x6e')][_0x91a1('0x2d')]({'where':_0x5a66c3[_0x91a1('0x4c')]})['then'](function(_0x3815d1){_0x8ee775[_0x91a1('0x2d')]=_0x3815d1;if(_0x1f3e5c['query'][_0x91a1('0x6f')]){_0x5a66c3[_0x91a1('0x58')]=[{'all':!![]}];}return db[_0x91a1('0x6e')]['findAll'](_0x5a66c3);})[_0x91a1('0x1e')](function(_0x423e02){_0x8ee775['rows']=_0x423e02;return _0x8ee775;});}})[_0x91a1('0x1e')](respondWithFilteredResult(_0x56ede5,_0x5a66c3))['catch'](handleError(_0x56ede5,null));};exports[_0x91a1('0x70')]=function(_0x306f1f,_0xf1dfa,_0x39e5a0){return db[_0x91a1('0x52')][_0x91a1('0x5a')]({'where':{'id':_0x306f1f[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0xf1dfa,null))[_0x91a1('0x1e')](function(_0x288a89){if(_0x288a89){return _0x288a89[_0x91a1('0x70')](_0x306f1f[_0x91a1('0x43')]['ids']);}})[_0x91a1('0x1e')](respondWithStatusCode(_0xf1dfa,null))[_0x91a1('0x55')](handleError(_0xf1dfa,null));};exports[_0x91a1('0x71')]=function(_0x5d9a89,_0x1fa0fe,_0x320735){return db['FaxInteraction'][_0x91a1('0x5a')]({'where':{'id':_0x5d9a89[_0x91a1('0x63')]['id']}})['then'](handleEntityNotFound(_0x1fa0fe,null))[_0x91a1('0x1e')](function(_0x3ea0c6){if(_0x3ea0c6){return _0x3ea0c6[_0x91a1('0x71')](_0x5d9a89[_0x91a1('0x62')][_0x91a1('0x72')],_[_0x91a1('0x73')](_0x5d9a89[_0x91a1('0x62')],['ids','id'])||{});}})[_0x91a1('0x1e')](respondWithResult(_0x1fa0fe,null))[_0x91a1('0x55')](handleError(_0x1fa0fe,null));};exports['getInteractions']=function(_0x838c5b,_0x47bcc5,_0x62c2d9){var _0x2340a9={'raw':![],'where':{}};var _0x443017={};var _0x4b08a9={'count':0x0,'rows':[]};return db[_0x91a1('0x52')][_0x91a1('0x69')]({'where':{'id':_0x838c5b[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x47bcc5,null))[_0x91a1('0x1e')](function(_0x19503e){if(_0x19503e){_0x443017['model']=_[_0x91a1('0x44')](db[_0x91a1('0x74')][_0x91a1('0x3f')]);_0x443017['query']=_[_0x91a1('0x44')](_0x838c5b[_0x91a1('0x43')]);_0x443017[_0x91a1('0x4e')]=_[_0x91a1('0x57')](_0x443017['model'],_0x443017[_0x91a1('0x43')]);_0x2340a9[_0x91a1('0x45')]=_[_0x91a1('0x57')](_0x443017['model'],qs[_0x91a1('0x46')](_0x838c5b[_0x91a1('0x43')][_0x91a1('0x46')]));_0x2340a9[_0x91a1('0x45')]=_0x2340a9[_0x91a1('0x45')][_0x91a1('0x47')]?_0x2340a9[_0x91a1('0x45')]:_0x443017[_0x91a1('0x42')];if(!_0x838c5b['query'][_0x91a1('0x48')]('nolimit')){_0x2340a9[_0x91a1('0x2e')]=qs[_0x91a1('0x2e')](_0x838c5b[_0x91a1('0x43')]['limit']);_0x2340a9[_0x91a1('0x2b')]=qs['offset'](_0x838c5b[_0x91a1('0x43')][_0x91a1('0x2b')]);}_0x2340a9['order']=qs[_0x91a1('0x4b')](_0x838c5b[_0x91a1('0x43')][_0x91a1('0x4b')]);_0x2340a9[_0x91a1('0x4c')]=qs[_0x91a1('0x4e')](_[_0x91a1('0x4d')](_0x838c5b['query'],_0x443017[_0x91a1('0x4e')]));_0x2340a9[_0x91a1('0x4c')][_0x91a1('0x6a')]=_0x19503e['id'];if(_0x838c5b[_0x91a1('0x43')]['filter']){_0x2340a9[_0x91a1('0x4c')]=_[_0x91a1('0x50')](_0x2340a9['where'],{'$or':_[_0x91a1('0x3e')](_0x2340a9[_0x91a1('0x45')],function(_0x11ffa8){var _0x13fe5c={};_0x13fe5c[_0x11ffa8]={'$like':'%'+_0x838c5b[_0x91a1('0x43')][_0x91a1('0x4f')]+'%'};return _0x13fe5c;})});}_0x2340a9=_['merge']({},_0x2340a9,_0x838c5b[_0x91a1('0x59')]);return db[_0x91a1('0x74')][_0x91a1('0x2d')]({'where':_0x2340a9[_0x91a1('0x4c')]})[_0x91a1('0x1e')](function(_0xf31a5){_0x4b08a9['count']=_0xf31a5;if(_0x838c5b[_0x91a1('0x43')]['includeAll']){_0x2340a9[_0x91a1('0x58')]=[{'model':db['CmContact'],'as':_0x91a1('0x75'),'required':![]},{'model':db[_0x91a1('0x76')],'as':_0x91a1('0x77'),'attributes':[_0x91a1('0x3a'),_0x91a1('0x78'),_0x91a1('0x79')],'required':![]},{'model':db[_0x91a1('0x7a')],'as':'Tags','attributes':['id','name',_0x91a1('0x7b')],'where':_0x838c5b[_0x91a1('0x43')]['tag']?{'id':_0x838c5b[_0x91a1('0x43')][_0x91a1('0x7c')]}:undefined,'required':_0x838c5b['query']['tag']?!![]:![]}];}return db[_0x91a1('0x74')][_0x91a1('0x53')](_0x2340a9);})[_0x91a1('0x1e')](function(_0x290587){_0x4b08a9[_0x91a1('0x54')]=_0x290587;return _0x4b08a9;});}})['then'](respondWithFilteredResult(_0x47bcc5,_0x2340a9))[_0x91a1('0x55')](handleError(_0x47bcc5,null));};exports[_0x91a1('0x7d')]=function(_0x65b44d,_0x1a620c){var _0x3ceba8=_0x65b44d[_0x91a1('0x63')]['id'];var _0x1f41d9=_0x65b44d[_0x91a1('0x62')];var _0x4cb4cd=0xc8;var _0x54509b=null;return db[_0x91a1('0x7e')]['transaction']({'isolationLevel':db['sequelize'][_0x91a1('0x7f')][_0x91a1('0x80')][_0x91a1('0x81')]},function(_0x1af555){return db[_0x91a1('0x52')][_0x91a1('0x69')]({'where':{'id':_0x3ceba8},'transaction':_0x1af555})['then'](function(_0x5062eb){if(_0x5062eb){return db['FaxApplication'][_0x91a1('0x37')]({'where':{'FaxAccountId':_0x3ceba8},'transaction':_0x1af555})[_0x91a1('0x1e')](function(){var _0x34240f=_[_0x91a1('0x3e')](_0x1f41d9,function(_0x2fc83b){_0x2fc83b[_0x91a1('0x6a')]=_0x3ceba8;return _0x2fc83b;});return db[_0x91a1('0x82')][_0x91a1('0x83')](_0x34240f,{'transaction':_0x1af555});});}else{_0x4cb4cd=0x194;_0x54509b=[];}});})[_0x91a1('0x1e')](function(){if(_0x4cb4cd!==0x194){return db[_0x91a1('0x82')][_0x91a1('0x84')]({'where':{'FaxAccountId':_0x3ceba8},'order':_0x91a1('0x85')})[_0x91a1('0x1e')](function(_0x19c1a9){_0x54509b=_0x19c1a9;});}})[_0x91a1('0x55')](function(_0x76e0b4){_0x4cb4cd=0x1f4;logger[_0x91a1('0x24')](_0x76e0b4['stack']);if(_0x76e0b4[_0x91a1('0x3a')]){delete _0x76e0b4[_0x91a1('0x3a')];}_0x54509b=_0x76e0b4;})[_0x91a1('0x86')](function(){if(_0x54509b===null){_0x1a620c[_0x91a1('0x28')](_0x4cb4cd);}else{if(_0x4cb4cd===0x1f4){_0x1a620c['status'](_0x4cb4cd)[_0x91a1('0x3b')](_0x54509b);}else{_0x1a620c[_0x91a1('0x29')](_0x4cb4cd)[_0x91a1('0x2a')](_0x54509b);}}});};exports[_0x91a1('0x87')]=function(_0x2393e2,_0x3cb9fd,_0x19de03){var _0x4f5a83={};var _0x5e7f6f={};var _0x12bcc6;var _0x491b70;return db[_0x91a1('0x52')]['findOne']({'where':{'id':_0x2393e2[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x3cb9fd,null))[_0x91a1('0x1e')](function(_0xa3053c){if(_0xa3053c){_0x12bcc6=_0xa3053c;_0x5e7f6f[_0x91a1('0x42')]=_['keys'](db['FaxApplication'][_0x91a1('0x3f')]);_0x5e7f6f[_0x91a1('0x43')]=_['keys'](_0x2393e2[_0x91a1('0x43')]);_0x5e7f6f[_0x91a1('0x4e')]=_[_0x91a1('0x57')](_0x5e7f6f[_0x91a1('0x42')],_0x5e7f6f[_0x91a1('0x43')]);_0x4f5a83[_0x91a1('0x45')]=_[_0x91a1('0x57')](_0x5e7f6f[_0x91a1('0x42')],qs[_0x91a1('0x46')](_0x2393e2[_0x91a1('0x43')]['fields']));_0x4f5a83[_0x91a1('0x45')]=_0x4f5a83[_0x91a1('0x45')][_0x91a1('0x47')]?_0x4f5a83[_0x91a1('0x45')]:_0x5e7f6f['model'];_0x4f5a83[_0x91a1('0x4a')]=qs[_0x91a1('0x4b')](_0x2393e2['query'][_0x91a1('0x4b')]);_0x4f5a83[_0x91a1('0x4c')]=qs[_0x91a1('0x4e')](_[_0x91a1('0x4d')](_0x2393e2[_0x91a1('0x43')],_0x5e7f6f['filters']));if(_0x2393e2[_0x91a1('0x43')][_0x91a1('0x4f')]){_0x4f5a83[_0x91a1('0x4c')]=_[_0x91a1('0x50')](_0x4f5a83['where'],{'$or':_['map'](_0x4f5a83[_0x91a1('0x45')],function(_0x5e8577){var _0x58c19a={};_0x58c19a[_0x5e8577]={'$like':'%'+_0x2393e2[_0x91a1('0x43')][_0x91a1('0x4f')]+'%'};return _0x58c19a;})});}_0x4f5a83=_[_0x91a1('0x50')]({},_0x4f5a83,_0x2393e2[_0x91a1('0x59')]);return _0x12bcc6['getApplications'](_0x4f5a83);}})[_0x91a1('0x1e')](function(_0x304820){if(_0x304820){_0x491b70=_0x304820[_0x91a1('0x47')];if(!_0x2393e2[_0x91a1('0x43')][_0x91a1('0x48')](_0x91a1('0x49'))){_0x4f5a83[_0x91a1('0x2e')]=qs['limit'](_0x2393e2[_0x91a1('0x43')][_0x91a1('0x2e')]);_0x4f5a83[_0x91a1('0x2b')]=qs['offset'](_0x2393e2[_0x91a1('0x43')][_0x91a1('0x2b')]);}return _0x12bcc6[_0x91a1('0x87')](_0x4f5a83);}})['then'](function(_0x4b6979){if(_0x4b6979){return _0x4b6979?{'count':_0x491b70,'rows':_0x4b6979}:null;}})[_0x91a1('0x1e')](respondWithResult(_0x3cb9fd,null))[_0x91a1('0x55')](handleError(_0x3cb9fd,null));};function Extension(_0x4e165f,_0x38f0dc,_0x348db7,_0xcad915){this[_0x91a1('0x88')]=_0x91a1('0x89');this[_0x91a1('0x8a')]=_0x4e165f[_0x91a1('0x8b')];this[_0x91a1('0x8c')]=_0xcad915;this['type']=_0x91a1('0x8d');this['description']=_0x91a1('0x8e');this['FaxAccountId']=_0x4e165f['id'];this['priority']=_0x38f0dc;this[_0x91a1('0x8f')]=_0x348db7;}function createExtensionsReciveFax(_0x3e11b1){var _0x285352=0x1;var _0x567881=[];_0x567881['push'](new Extension(_0x3e11b1,_0x285352,'','Answer'));_0x285352+=0x1;_0x567881[_0x91a1('0x90')](new Extension(_0x3e11b1,_0x285352,_0x91a1('0x91'),'Set'));_0x285352+=0x1;for(var _0x363cca in _0x3e11b1){if(_0x3e11b1[_0x91a1('0x48')](_0x363cca)&&(_0x363cca==='ecm'||_0x363cca===_0x91a1('0x8b')||_0x363cca===_0x91a1('0x92')||_0x363cca===_0x91a1('0x93')||_0x363cca===_0x91a1('0x94')||_0x363cca==='maxrate'||_0x363cca==='minrate'||_0x363cca===_0x91a1('0x95')||_0x363cca===_0x91a1('0x96'))){_0x567881[_0x91a1('0x90')](new Extension(_0x3e11b1,_0x285352,_0x91a1('0x97')+_0x363cca+')='+_0x3e11b1[_0x363cca],_0x91a1('0x98')));_0x285352+=0x1;}}_0x567881['push'](new Extension(_0x3e11b1,_0x285352,'6',_0x91a1('0x99')));_0x285352+=0x1;_0x567881[_0x91a1('0x90')](new Extension(_0x3e11b1,_0x285352,_0x91a1('0x9a'),'ReceiveFax'));_0x285352=0x0;return _0x567881;}exports[_0x91a1('0x9b')]=function(_0x57a992,_0x4807e6,_0x312f27){var _0x51fb30;return db[_0x91a1('0x7e')][_0x91a1('0x9c')](function(_0x39250a){return db[_0x91a1('0x52')][_0x91a1('0x5b')](_0x57a992['body'],{'transaction':_0x39250a})[_0x91a1('0x1e')](function(_0x2f73a7){_0x51fb30=_0x2f73a7[_0x91a1('0x34')]({'plain':!![]});return db[_0x91a1('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x51fb30),{'transaction':_0x39250a});});})[_0x91a1('0x1e')](function(){return _0x51fb30;})[_0x91a1('0x1e')](respondWithResult(_0x4807e6,null))[_0x91a1('0x55')](handleError(_0x4807e6,null));};exports[_0x91a1('0x9e')]=function(_0x15361a,_0x5cc07a,_0x4d46c7){var _0x2ce5b3;return db[_0x91a1('0x7e')][_0x91a1('0x9c')](function(_0x535e68){return db[_0x91a1('0x52')][_0x91a1('0x33')](_0x15361a[_0x91a1('0x62')],{'where':{'id':_0x15361a['body']['id']},'transaction':_0x535e68})[_0x91a1('0x1e')](function(_0x557c1f){return db[_0x91a1('0x9d')][_0x91a1('0x37')]({'where':{'FaxAccountId':_0x15361a['body']['id']},'transaction':_0x535e68})['then'](function(_0x466a4c){return db[_0x91a1('0x9d')][_0x91a1('0x83')](createExtensionsReciveFax(_[_0x91a1('0x73')](_0x15361a[_0x91a1('0x62')],['tech',_0x91a1('0x9f'),_0x91a1('0xa0'),'updatedAt',_0x91a1('0xa1'),_0x91a1('0xa2')])),{'transaction':_0x535e68});});});})[_0x91a1('0x1e')](function(){return db[_0x91a1('0x52')]['findById'](_0x15361a['body']['id']);})[_0x91a1('0x1e')](respondWithResult(_0x5cc07a,null))[_0x91a1('0x55')](handleError(_0x5cc07a,null));};exports['getMessages']=function(_0x231bdc,_0x36fe13,_0x410be6){var _0x5a53fd={'raw':!![],'where':{}};var _0x556009={};var _0x194fa2={'count':0x0,'rows':[]};return db[_0x91a1('0x52')][_0x91a1('0x69')]({'where':{'id':_0x231bdc['params']['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x36fe13,null))[_0x91a1('0x1e')](function(_0x59c51b){if(_0x59c51b){_0x556009[_0x91a1('0x42')]=_[_0x91a1('0x44')](db[_0x91a1('0xa3')][_0x91a1('0x3f')]);_0x556009['query']=_[_0x91a1('0x44')](_0x231bdc[_0x91a1('0x43')]);_0x556009[_0x91a1('0x4e')]=_[_0x91a1('0x57')](_0x556009[_0x91a1('0x42')],_0x556009[_0x91a1('0x43')]);_0x5a53fd[_0x91a1('0x45')]=_['intersection'](_0x556009[_0x91a1('0x42')],qs[_0x91a1('0x46')](_0x231bdc[_0x91a1('0x43')][_0x91a1('0x46')]));_0x5a53fd[_0x91a1('0x45')]=_0x5a53fd[_0x91a1('0x45')][_0x91a1('0x47')]?_0x5a53fd[_0x91a1('0x45')]:_0x556009[_0x91a1('0x42')];if(!_0x231bdc[_0x91a1('0x43')][_0x91a1('0x48')]('nolimit')){_0x5a53fd['limit']=qs[_0x91a1('0x2e')](_0x231bdc[_0x91a1('0x43')]['limit']);_0x5a53fd['offset']=qs[_0x91a1('0x2b')](_0x231bdc[_0x91a1('0x43')][_0x91a1('0x2b')]);}_0x5a53fd[_0x91a1('0x4a')]=qs[_0x91a1('0x4b')](_0x231bdc[_0x91a1('0x43')][_0x91a1('0x4b')]);_0x5a53fd[_0x91a1('0x4c')]=qs[_0x91a1('0x4e')](_[_0x91a1('0x4d')](_0x231bdc['query'],_0x556009['filters']));_0x5a53fd['where'][_0x91a1('0x6a')]=_0x59c51b['id'];if(_0x231bdc[_0x91a1('0x43')][_0x91a1('0x4f')]){_0x5a53fd[_0x91a1('0x4c')]=_[_0x91a1('0x50')](_0x5a53fd[_0x91a1('0x4c')],{'$or':_[_0x91a1('0x3e')](_0x5a53fd['attributes'],function(_0x2d45bd){var _0x1a59f0={};_0x1a59f0[_0x2d45bd]={'$like':'%'+_0x231bdc[_0x91a1('0x43')][_0x91a1('0x4f')]+'%'};return _0x1a59f0;})});}if(_0x231bdc[_0x91a1('0x43')][_0x91a1('0xa4')]){var _0x51af5e=_0x231bdc[_0x91a1('0x43')][_0x91a1('0xa4')]['split'](',');var _0x5b22a8={};_0x5b22a8[_0x51af5e[0x0]]={'$gte':moment(_0x51af5e[0x1])[_0x91a1('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5a53fd[_0x91a1('0x4c')]=_[_0x91a1('0x50')](_0x5a53fd['where'],_0x5b22a8);}_0x5a53fd=_[_0x91a1('0x50')]({},_0x5a53fd,_0x231bdc[_0x91a1('0x59')]);return db[_0x91a1('0xa3')][_0x91a1('0x2d')]({'where':_0x5a53fd[_0x91a1('0x4c')]})[_0x91a1('0x1e')](function(_0x25f310){_0x194fa2[_0x91a1('0x2d')]=_0x25f310;if(_0x231bdc[_0x91a1('0x43')]['includeAll']){_0x5a53fd[_0x91a1('0x58')]=[{'all':!![]}];}return db['FaxMessage'][_0x91a1('0x53')](_0x5a53fd);})['then'](function(_0x1bb795){_0x194fa2[_0x91a1('0x54')]=_0x1bb795;return _0x194fa2;});}})[_0x91a1('0x1e')](respondWithFilteredResult(_0x36fe13,_0x5a53fd))[_0x91a1('0x55')](handleError(_0x36fe13,null));};exports['send']=function(_0x2045f6,_0x4e7aee,_0x96b837){var _0x2227c6,_0x4c3166={},_0x8ace12;if(_0x2045f6['body']['to']){_0x8ace12=_0x2045f6[_0x91a1('0x62')]['to'][0x0];}return db['FaxAccount'][_0x91a1('0x5a')]({'where':{'id':_0x2045f6['params']['id']},'include':[{'model':db[_0x91a1('0xa6')],'as':_0x91a1('0xa7'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x8ace12},'limit':0x1,'order':[[_0x91a1('0xa8'),_0x91a1('0xa9')]]}]}]})[_0x91a1('0x1e')](handleEntityNotFound(_0x4e7aee,null))[_0x91a1('0x1e')](function(_0xd7b8c6){_0x2227c6=_0xd7b8c6;if(_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')]&&_0x2045f6['body'][_0x91a1('0xaa')][_0x91a1('0x47')]){for(var _0x209efb=0x0;_0x209efb<_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')]['length'];_0x209efb+=0x1){_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')][_0x209efb]={'filename':_0x2045f6['body'][_0x91a1('0xaa')][_0x209efb][_0x91a1('0x3a')],'id':_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')][_0x209efb]['id'],'path':path[_0x91a1('0xab')](config[_0x91a1('0xac')],_0x91a1('0xad'),_0x2045f6['body'][_0x91a1('0xaa')][_0x209efb][_0x91a1('0xae')])};}}return respondWithRpcPromise(_0x91a1('0xaf'),_0x91a1('0xaf'),{'FaxAccountId':_[_0x91a1('0xb0')](_0x2045f6[_0x91a1('0x63')]['id'])?undefined:_0x2045f6[_0x91a1('0x63')]['id'],'path':_[_0x91a1('0xb0')](_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')][0x0][_0x91a1('0x6')])?undefined:_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')][0x0][_0x91a1('0x6')],'fax':_['isNil'](_0x2045f6['body']['to'][0x0])?undefined:_0x2045f6['body']['to'][0x0]},client9002);})[_0x91a1('0x1e')](function(){if(_0x2227c6){if(_['isNil'](_0x2045f6[_0x91a1('0x62')][_0x91a1('0xb1')])){_0x2045f6[_0x91a1('0x62')][_0x91a1('0xb1')]=util[_0x91a1('0xa5')](_0x91a1('0xb2'),_0x2227c6['name'],_0x2227c6[_0x91a1('0xb3')]);}if(_0x2227c6['List']){if(_0x2227c6[_0x91a1('0xa7')][_0x91a1('0xb4')][_0x91a1('0x47')]){return _0x2227c6[_0x91a1('0xa7')][_0x91a1('0xb4')][0x0];}else{return db[_0x91a1('0xb5')][_0x91a1('0x5b')](_[_0x91a1('0x17')](_0x2045f6[_0x91a1('0x62')],{'firstName':_0x2045f6[_0x91a1('0x62')]['to'][0x0],'phone':_0x2045f6[_0x91a1('0x62')]['to'][0x0],'fax':_0x2045f6[_0x91a1('0x62')]['to'][0x0],'ListId':_0x2227c6[_0x91a1('0xa2')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x91a1('0xb6'));}})['then'](function(_0x27652b){if(_0x27652b){return db[_0x91a1('0x74')][_0x91a1('0x5a')]({'where':{'ContactId':_0x27652b['id'],'closed':![],'FaxAccountId':_0x2227c6['id']}})['then'](function(_0xaaafec){if(_0xaaafec){return[_0xaaafec,![]];}return db[_0x91a1('0x74')][_0x91a1('0x5b')]({'UserId':_0x2045f6['user']['id'],'ContactId':_0x27652b['id'],'FaxAccountId':_0x2227c6['id'],'fax':_0x2045f6[_0x91a1('0x62')]['to'][0x0],'firstMsgDirection':_0x91a1('0xb7'),'Messages':[_[_0x91a1('0x50')](_0x2045f6['body'],{'read':![],'body':_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')][0x0][_0x91a1('0xb8')],'FaxAccountId':_0x2227c6['id'],'UserId':_0x2045f6[_0x91a1('0x5c')]['id'],'ContactId':_0x27652b['id'],'AttachmentId':_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x91a1('0xa3')],'as':_0x91a1('0xb9')}]})[_0x91a1('0x1e')](function(_0x10206c){return[_0x10206c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x91a1('0xba')](function(_0x41d08e,_0x19b7bb){if(_0x19b7bb){return _0x41d08e;}return db[_0x91a1('0xa3')][_0x91a1('0x5b')]({'direction':'out','read':![],'body':_0x2045f6['body'][_0x91a1('0xaa')][0x0][_0x91a1('0xb8')],'FaxAccountId':_0x2227c6['id'],'FaxInteractionId':_0x41d08e['id'],'UserId':_0x2045f6[_0x91a1('0x5c')]['id'],'ContactId':_0x41d08e[_0x91a1('0xbb')],'AttachmentId':_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')][0x0]['id']})[_0x91a1('0x1e')](function(_0x317258){_0x41d08e['dataValues'][_0x91a1('0xb9')]=[];_0x41d08e['dataValues'][_0x91a1('0xb9')][_0x91a1('0x90')](_0x317258[_0x91a1('0xbc')]);return _0x41d08e;});})[_0x91a1('0x1e')](function(_0x2309ec){respondWithRpcPromise(_0x91a1('0xbd'),'SendFax',{'FaxAccountId':_[_0x91a1('0xb0')](_0x2045f6[_0x91a1('0x63')]['id'])?undefined:_0x2045f6['params']['id'],'path':_['isNil'](_0x2045f6['body'][_0x91a1('0xaa')][0x0]['path'])?undefined:_0x2045f6[_0x91a1('0x62')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x2045f6['body']['to'][0x0])?undefined:_0x2045f6['body']['to'][0x0],'AttachmentId':_0x2045f6[_0x91a1('0x62')][_0x91a1('0xaa')][0x0]['id']},client9002)[_0x91a1('0x1e')](function(_0x478fae){logger[_0x91a1('0x1f')](_0x91a1('0xbe'),_0x478fae);})[_0x91a1('0x55')](function(_0x5d58df){logger[_0x91a1('0x1f')](_0x91a1('0xbe'),_0x5d58df);});return _0x2309ec;})[_0x91a1('0x1e')](respondWithResult(_0x4e7aee,null))['catch'](handleError(_0x4e7aee,null));};exports['addAgents']=function(_0x59b95b,_0x751477,_0x712e68){return db[_0x91a1('0x52')][_0x91a1('0x5a')]({'where':{'id':_0x59b95b[_0x91a1('0x63')]['id']}})['then'](handleEntityNotFound(_0x751477,null))[_0x91a1('0x1e')](function(_0xc721e4){if(_0xc721e4){return _0xc721e4[_0x91a1('0xbf')](_0x59b95b['body'][_0x91a1('0x72')],_[_0x91a1('0x73')](_0x59b95b[_0x91a1('0x62')],[_0x91a1('0x72'),'id'])||{})['spread'](function(_0x23ed7a){for(var _0x3e6461=0x0;_0x3e6461<_0x59b95b[_0x91a1('0x62')][_0x91a1('0x72')][_0x91a1('0x47')];_0x3e6461+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x59b95b[_0x91a1('0x62')][_0x91a1('0x72')][_0x3e6461]),'FaxAccountId':Number(_0x59b95b['params']['id'])});}return _0x23ed7a;});}})[_0x91a1('0x1e')](respondWithResult(_0x751477,null))['catch'](handleError(_0x751477,null));};exports[_0x91a1('0xc0')]=function(_0x7c69c4,_0x2e57ba,_0x605931){return db[_0x91a1('0x52')][_0x91a1('0x5a')]({'where':{'id':_0x7c69c4[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x2e57ba,null))[_0x91a1('0x1e')](function(_0x32632){if(_0x32632){return _0x32632['removeAgents'](_0x7c69c4[_0x91a1('0x43')]['ids'])['then'](function(){if(_[_0x91a1('0xc1')](_0x7c69c4[_0x91a1('0x43')][_0x91a1('0x72')])){for(var _0x2fde07=0x0;_0x2fde07<_0x7c69c4['query'][_0x91a1('0x72')][_0x91a1('0x47')];_0x2fde07+=0x1){socket[_0x91a1('0xc2')](_0x91a1('0xc3'),{'UserId':Number(_0x7c69c4[_0x91a1('0x43')][_0x91a1('0x72')][_0x2fde07]),'FaxAccountId':Number(_0x7c69c4[_0x91a1('0x63')]['id'])});}}else{socket[_0x91a1('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x7c69c4[_0x91a1('0x43')][_0x91a1('0x72')]),'FaxAccountId':Number(_0x7c69c4[_0x91a1('0x63')]['id'])});}});}})[_0x91a1('0x1e')](respondWithStatusCode(_0x2e57ba,null))[_0x91a1('0x55')](handleError(_0x2e57ba,null));};exports[_0x91a1('0xc4')]=function(_0x2d03be,_0x4a7fff,_0x500eed){var _0xdd565c={};var _0x11be25={};var _0x391d90;var _0x1b730c;return db[_0x91a1('0x52')][_0x91a1('0x69')]({'where':{'id':_0x2d03be[_0x91a1('0x63')]['id']}})[_0x91a1('0x1e')](handleEntityNotFound(_0x4a7fff,null))['then'](function(_0x4b9264){if(_0x4b9264){_0x391d90=_0x4b9264;_0x11be25[_0x91a1('0x42')]=_[_0x91a1('0x44')](db[_0x91a1('0x76')]['rawAttributes']);_0x11be25[_0x91a1('0x43')]=_[_0x91a1('0x44')](_0x2d03be[_0x91a1('0x43')]);_0x11be25[_0x91a1('0x4e')]=_['intersection'](_0x11be25[_0x91a1('0x42')],_0x11be25[_0x91a1('0x43')]);_0xdd565c['attributes']=_[_0x91a1('0x57')](_0x11be25[_0x91a1('0x42')],qs[_0x91a1('0x46')](_0x2d03be['query']['fields']));_0xdd565c[_0x91a1('0x45')]=_0xdd565c[_0x91a1('0x45')][_0x91a1('0x47')]?_0xdd565c[_0x91a1('0x45')]:_0x11be25[_0x91a1('0x42')];_0xdd565c['order']=qs[_0x91a1('0x4b')](_0x2d03be[_0x91a1('0x43')][_0x91a1('0x4b')]);_0xdd565c[_0x91a1('0x4c')]=qs[_0x91a1('0x4e')](_[_0x91a1('0x4d')](_0x2d03be[_0x91a1('0x43')],_0x11be25[_0x91a1('0x4e')]));if(_0x2d03be[_0x91a1('0x43')][_0x91a1('0x4f')]){_0xdd565c['where']=_[_0x91a1('0x50')](_0xdd565c[_0x91a1('0x4c')],{'$or':_['map'](_0xdd565c[_0x91a1('0x45')],function(_0x35a94b){var _0x1c1fa9={};_0x1c1fa9[_0x35a94b]={'$like':'%'+_0x2d03be[_0x91a1('0x43')][_0x91a1('0x4f')]+'%'};return _0x1c1fa9;})});}_0xdd565c=_[_0x91a1('0x50')]({},_0xdd565c,_0x2d03be[_0x91a1('0x59')]);return _0x391d90[_0x91a1('0xc4')](_0xdd565c);}})[_0x91a1('0x1e')](function(_0x2b0eb7){if(_0x2b0eb7){_0x1b730c=_0x2b0eb7[_0x91a1('0x47')];if(!_0x2d03be[_0x91a1('0x43')][_0x91a1('0x48')](_0x91a1('0x49'))){_0xdd565c['limit']=qs[_0x91a1('0x2e')](_0x2d03be[_0x91a1('0x43')]['limit']);_0xdd565c[_0x91a1('0x2b')]=qs['offset'](_0x2d03be['query'][_0x91a1('0x2b')]);}return _0x391d90[_0x91a1('0xc4')](_0xdd565c);}})[_0x91a1('0x1e')](function(_0x455c32){if(_0x455c32){return _0x455c32?{'count':_0x1b730c,'rows':_0x455c32}:null;}})[_0x91a1('0x1e')](respondWithResult(_0x4a7fff,null))[_0x91a1('0x55')](handleError(_0x4a7fff,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c743fbc..114bd96 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 _0x87cc=['remove','emit','hook','../../mysqldb','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87cc,0xda));var _0xc87c=function(_0x1c539a,_0x4758ec){_0x1c539a=_0x1c539a-0x0;var _0x2351f5=_0x87cc[_0x1c539a];return _0x2351f5;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xc87c('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc87c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc87c('0x2')};function emitEvent(_0x16789a){return function(_0x3b8c9a,_0x3a461e,_0x5a022d){FaxAccountEvents['emit'](_0x16789a+':'+_0x3b8c9a['id'],_0x3b8c9a);FaxAccountEvents[_0xc87c('0x3')](_0x16789a,_0x3b8c9a);_0x5a022d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xc87c('0x4')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x2432=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2432,0x7a));var _0x2243=function(_0x5d73d1,_0x108817){_0x5d73d1=_0x5d73d1-0x0;var _0x3c47db=_0x2432[_0x5d73d1];return _0x3c47db;};'use strict';var EventEmitter=require(_0x2243('0x0'));var FaxAccount=require(_0x2243('0x1'))['db'][_0x2243('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2243('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2243('0x4'),'afterDestroy':'remove'};function emitEvent(_0x183db0){return function(_0x446e79,_0x381cc8,_0xa94cb3){FaxAccountEvents[_0x2243('0x5')](_0x183db0+':'+_0x446e79['id'],_0x446e79);FaxAccountEvents[_0x2243('0x5')](_0x183db0,_0x446e79);_0xa94cb3(null);};}for(var e in events){if(events[_0x2243('0x6')](e)){var event=events[e];FaxAccount[_0x2243('0x7')](e,emitEvent(event));}}module[_0x2243('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 003cabf..bee93c5 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 _0x2787=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x13b4e4,_0x457758){var _0x28fcdc=function(_0x1cf690){while(--_0x1cf690){_0x13b4e4['push'](_0x13b4e4['shift']());}};_0x28fcdc(++_0x457758);}(_0x2787,0x124));var _0x7278=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2787[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7278('0x0'));var util=require(_0x7278('0x1'));var logger=require(_0x7278('0x2'))(_0x7278('0x3'));var moment=require(_0x7278('0x4'));var BPromise=require(_0x7278('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7278('0x6'));var rimraf=require('rimraf');var config=require(_0x7278('0x7'));var attributes=require(_0x7278('0x8'));module[_0x7278('0x9')]=function(_0x10fb7b,_0x4dc5fc){return _0x10fb7b[_0x7278('0xa')](_0x7278('0xb'),attributes,{'tableName':_0x7278('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59b3=['path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x5c2054,_0x2135c3){var _0x13f8a4=function(_0x3a416a){while(--_0x3a416a){_0x5c2054['push'](_0x5c2054['shift']());}};_0x13f8a4(++_0x2135c3);}(_0x59b3,0xf2));var _0x359b=function(_0x5cf133,_0x1bca31){_0x5cf133=_0x5cf133-0x0;var _0x5c7698=_0x59b3[_0x5cf133];return _0x5c7698;};'use strict';var _=require(_0x359b('0x0'));var util=require(_0x359b('0x1'));var logger=require(_0x359b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x359b('0x3'));var rp=require(_0x359b('0x4'));var fs=require('fs');var path=require(_0x359b('0x5'));var rimraf=require(_0x359b('0x6'));var config=require(_0x359b('0x7'));var attributes=require(_0x359b('0x8'));module[_0x359b('0x9')]=function(_0x5116c1,_0xb873af){return _0x5116c1[_0x359b('0xa')](_0x359b('0xb'),attributes,{'tableName':_0x359b('0xc'),'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 3dcb384..522baf9 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 _0x29aa=['asc','Contacts','length','create','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','queueId','FaxQueue','waitForTheAssignedQueue','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','localhost','socket.io-emitter','redis','./faxAccount.socket','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','info','result','catch','options','where','attributes','limit','map','include','model','GetFaxAccount','fax','CmContact','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','body','Sequelize','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','DESC','Applications','List','get','list','applications','orderBy','priority'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x29aa,0x74));var _0xa29a=function(_0x5b6077,_0x5a0ac7){_0x5b6077=_0x5b6077-0x0;var _0xad5f4b=_0x29aa[_0x5b6077];return _0xad5f4b;};'use strict';var _=require(_0xa29a('0x0'));var util=require(_0xa29a('0x1'));var moment=require('moment');var BPromise=require(_0xa29a('0x2'));var rs=require(_0xa29a('0x3'));var fs=require('fs');var Redis=require(_0xa29a('0x4'));var db=require(_0xa29a('0x5'))['db'];var utils=require(_0xa29a('0x6'));var logger=require(_0xa29a('0x7'))(_0xa29a('0x8'));var config=require('../../config/environment');var jayson=require(_0xa29a('0x9'));var client=jayson['client'][_0xa29a('0xa')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':_0xa29a('0xb'),'port':0x18eb});var socket=require(_0xa29a('0xc'))(new Redis(config[_0xa29a('0xd')]));require(_0xa29a('0xe'))['register'](socket);function respondWithRpcPromise(_0x12fdde,_0x4cb322,_0x45b942){return new BPromise(function(_0x335bff,_0xc9e2ad){return client[_0xa29a('0xf')](_0x12fdde,_0x45b942)[_0xa29a('0x10')](function(_0x2e37eb){logger['info']('FaxAccount,\x20%s,\x20%s',_0x4cb322,_0xa29a('0x11'));logger[_0xa29a('0x12')](_0xa29a('0x13'),_0x4cb322,'request\x20sent',JSON[_0xa29a('0x14')](_0x2e37eb));if(_0x2e37eb[_0xa29a('0x15')]){if(_0x2e37eb[_0xa29a('0x15')][_0xa29a('0x16')]===0x1f4){logger[_0xa29a('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4cb322,_0x2e37eb[_0xa29a('0x15')][_0xa29a('0x17')]);return _0xc9e2ad(_0x2e37eb[_0xa29a('0x15')][_0xa29a('0x17')]);}logger[_0xa29a('0x15')](_0xa29a('0x18'),_0x4cb322,_0x2e37eb[_0xa29a('0x15')][_0xa29a('0x17')]);return _0x335bff(_0x2e37eb[_0xa29a('0x15')][_0xa29a('0x17')]);}else{logger[_0xa29a('0x19')](_0xa29a('0x18'),_0x4cb322,_0xa29a('0x11'));_0x335bff(_0x2e37eb[_0xa29a('0x1a')][_0xa29a('0x17')]);}})[_0xa29a('0x1b')](function(_0x56ecb3){logger[_0xa29a('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4cb322,_0x56ecb3);_0xc9e2ad(_0x56ecb3);});});}exports['GetFaxAccount']=function(_0x1f61e5){var _0x13acde=this;return new Promise(function(_0xcb6b16,_0x4917f9){return db['FaxAccount']['findAll']({'raw':_0x1f61e5[_0xa29a('0x1c')]?_0x1f61e5[_0xa29a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1f61e5[_0xa29a('0x1c')]?_0x1f61e5[_0xa29a('0x1c')][_0xa29a('0x1d')]||null:null,'attributes':_0x1f61e5[_0xa29a('0x1c')]?_0x1f61e5[_0xa29a('0x1c')][_0xa29a('0x1e')]||null:null,'limit':_0x1f61e5['options']?_0x1f61e5[_0xa29a('0x1c')][_0xa29a('0x1f')]||null:null,'include':_0x1f61e5[_0xa29a('0x1c')]?_0x1f61e5[_0xa29a('0x1c')]['include']?_[_0xa29a('0x20')](_0x1f61e5['options'][_0xa29a('0x21')],function(_0x30fc6c){return{'model':db[_0x30fc6c['model']],'as':_0x30fc6c['as'],'attributes':_0x30fc6c[_0xa29a('0x1e')],'include':_0x30fc6c[_0xa29a('0x21')]?_[_0xa29a('0x20')](_0x30fc6c[_0xa29a('0x21')],function(_0x8fc68d){return{'model':db[_0x8fc68d[_0xa29a('0x22')]],'as':_0x8fc68d['as'],'attributes':_0x8fc68d['attributes'],'include':_0x8fc68d[_0xa29a('0x21')]?_[_0xa29a('0x20')](_0x8fc68d[_0xa29a('0x21')],function(_0x5c8ad0){return{'model':db[_0x5c8ad0[_0xa29a('0x22')]],'as':_0x5c8ad0['as'],'attributes':_0x5c8ad0[_0xa29a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa29a('0x10')](function(_0x5bb2b4){logger[_0xa29a('0x19')](_0xa29a('0x23'),_0x1f61e5);logger[_0xa29a('0x12')](_0xa29a('0x23'),_0x1f61e5,JSON[_0xa29a('0x14')](_0x5bb2b4));_0xcb6b16(_0x5bb2b4);})[_0xa29a('0x1b')](function(_0x4895a9){logger[_0xa29a('0x15')](_0xa29a('0x23'),_0x4895a9[_0xa29a('0x17')],_0x1f61e5);_0x4917f9(_0x13acde[_0xa29a('0x15')](0x1f4,_0x4895a9[_0xa29a('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x34770e,_0x794321,_0x4f64dc){var _0x410e86=this;return new Promise(function(_0x3dd6dd,_0x346407){var _0x481db7={'body':_0x34770e['body'],'channel':_0xa29a('0x24')};var _0x2c2aaf=[];var _0x2bbb60=[];var _0x18c679={};return db[_0xa29a('0x25')]['describe']()[_0xa29a('0x10')](function(_0x111a06){if(!_0x111a06){throw new db['Sequelize'][(_0xa29a('0x26'))](_0xa29a('0x27'));}_0x2c2aaf=_[_0xa29a('0x28')](_[_0xa29a('0x29')](_0x111a06),[_0xa29a('0x2a'),_0xa29a('0x2b')]);_0x2bbb60=_[_0xa29a('0x28')](_[_0xa29a('0x29')](_0x111a06),[_0xa29a('0x2a'),_0xa29a('0x2b'),'CompanyId',_0xa29a('0x2c')]);if(_0x34770e[_0xa29a('0x2d')]['id']){delete _0x34770e['body']['id'];}if(_['isNil'](_0x34770e['body']['from'])){throw new db[(_0xa29a('0x2e'))][(_0xa29a('0x26'))](_0xa29a('0x2f'));}if(_[_0xa29a('0x30')](_0x34770e[_0xa29a('0x2d')][_0xa29a('0x2d')])||_0x34770e['body'][_0xa29a('0x2d')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa29a('0x30')](_0x34770e[_0xa29a('0x2d')][_0xa29a('0x31')])){throw new db['Sequelize'][(_0xa29a('0x26'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2bbb60);}if(!_[_0xa29a('0x32')](_0x2bbb60,_0x34770e[_0xa29a('0x2d')]['mapKey'])){throw new db[(_0xa29a('0x2e'))][(_0xa29a('0x26'))](_0xa29a('0x33')+_0x2bbb60);}_0x18c679[_0x34770e[_0xa29a('0x2d')][_0xa29a('0x31')]]=_0x34770e[_0xa29a('0x2d')][_0xa29a('0x34')];})[_0xa29a('0x10')](function(){return db['FaxAccount'][_0xa29a('0x35')]({'where':{'id':_0x34770e[_0xa29a('0x36')]['id']},'include':[{'model':db[_0xa29a('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x18c679,'limit':0x1,'order':[[_0xa29a('0x2b'),_0xa29a('0x38')]]}]},{'model':db['FaxApplication'],'as':_0xa29a('0x39')}]});})['then'](function(_0x31f37b){if(_0x31f37b&&_0x31f37b[_0xa29a('0x3a')]){var _0x18fb49=_0x31f37b[_0xa29a('0x3b')]({'plain':!![]});_0x481db7[_0xa29a('0x36')]=_0x18fb49;_0x481db7['applications']=_0x18fb49['Applications'];_0x481db7[_0xa29a('0x3c')]=_0x18fb49[_0xa29a('0x3a')];_0x481db7[_0xa29a('0x3d')]=_[_0xa29a('0x3e')](_0x481db7[_0xa29a('0x3d')],[_0xa29a('0x3f')],[_0xa29a('0x40')]);if(_0x481db7[_0xa29a('0x36')][_0xa29a('0x39')]){delete _0x481db7[_0xa29a('0x36')]['Applications'];}if(_0x481db7['account'][_0xa29a('0x3a')]&&_0x481db7[_0xa29a('0x36')][_0xa29a('0x3a')][_0xa29a('0x41')][_0xa29a('0x42')]){return _0x481db7[_0xa29a('0x36')][_0xa29a('0x3a')][_0xa29a('0x41')][0x0];}var _0xaeeaf9=_['defaults'](_0x34770e[_0xa29a('0x2d')],{'firstName':_0x34770e['body'][_0xa29a('0x34')],'ListId':_0x18fb49[_0xa29a('0x2c')]});_0xaeeaf9[_0x34770e['body']['mapKey']]=_0x34770e[_0xa29a('0x2d')][_0xa29a('0x34')];return db[_0xa29a('0x25')][_0xa29a('0x43')](_0xaeeaf9,{'fields':_0x2c2aaf,'raw':!![]});}})[_0xa29a('0x10')](function(_0x22bf4f){_0x481db7['contact']=_0x22bf4f;if(_0x22bf4f){var _0x52500b={'ContactId':_0x22bf4f['id'],'FaxAccountId':_0x34770e[_0xa29a('0x36')]['id'],'fax':_0x22bf4f[_0xa29a('0x24')]};return db[_0xa29a('0x44')]['find']({'where':{'ContactId':_0x22bf4f['id'],'closed':![],'FaxAccountId':_0x34770e[_0xa29a('0x36')]['id']}})['then'](function(_0x177863){if(_0x177863){return[_0x177863,![]];}return db[_0xa29a('0x44')][_0xa29a('0x43')](_0x52500b)['then'](function(_0x4201a3){return[_0x4201a3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa29a('0x45')](function(_0x42790e,_0x2aac07){var _0x2c6fe6=_0x42790e[_0xa29a('0x3b')]({'plain':!![]});if(_0x2aac07){if(_0x481db7[_0xa29a('0x36')][_0xa29a('0x46')]){_0x481db7[_0xa29a('0x3d')][_0xa29a('0x47')]({'id':0x0,'priority':_0x481db7[_0xa29a('0x3d')][_0xa29a('0x42')]+0x1,'app':_0xa29a('0x48'),'appdata':_0xa29a('0x49'),'interval':_0xa29a('0x4a')});}_0x2c6fe6['created']=!![];}else{_0x2c6fe6[_0xa29a('0x4b')]=![];}_0x481db7['interaction']=_0x2c6fe6;return db[_0xa29a('0x4c')][_0xa29a('0x43')]({'body':_0x34770e[_0xa29a('0x2d')][_0xa29a('0x2d')],'FaxAccountId':_0x34770e[_0xa29a('0x36')]['id'],'FaxInteractionId':_0x42790e['id'],'direction':'in','ContactId':_0x42790e['ContactId'],'AttachmentId':_0x34770e[_0xa29a('0x2d')][_0xa29a('0x4d')]});})['then'](function(_0x413d6b){_0x481db7['message']=_0x413d6b;if(!_0x481db7[_0xa29a('0x4e')][_0xa29a('0x4f')])return;return db[_0xa29a('0x50')]['find']({'attributes':['id','name'],'where':{'id':_0x481db7[_0xa29a('0x4e')][_0xa29a('0x4f')]}});})[_0xa29a('0x10')](function(_0xe66ca3){if(_0xe66ca3){_0x481db7[_0xa29a('0x3d')][_0xa29a('0x51')]({'id':0x0,'priority':0x0,'app':_0xa29a('0x52'),'appdata':_0xe66ca3[_0xa29a('0x53')]+','+(_0x481db7[_0xa29a('0x36')][_0xa29a('0x54')]||0xa),'interval':_0xa29a('0x4a')});}if(!_0x481db7[_0xa29a('0x4e')][_0xa29a('0x55')])return;return db[_0xa29a('0x56')][_0xa29a('0x35')]({'attributes':['id',_0xa29a('0x53')],'where':{'id':_0x481db7['interaction'][_0xa29a('0x55')]}});})[_0xa29a('0x10')](function(_0x378c6d){if(_0x378c6d){_0x481db7[_0xa29a('0x3d')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x378c6d['name']+','+(_0x481db7[_0xa29a('0x36')][_0xa29a('0x57')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa29a('0x58'),_0xa29a('0x59'),_0x481db7);})['then'](function(_0x43df94){_0x3dd6dd(_0x43df94);})[_0xa29a('0x1b')](function(_0x53a0be){_0x346407(_0x410e86['error'](0x1f4,_0x53a0be[_0xa29a('0x17')]));});});}; \ No newline at end of file +var _0xc8d4=['client','redis','localhost','socket.io-emitter','request','then','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','raw','options','where','limit','map','include','model','attributes','debug','NotifyFaxAccount','body','fax','CmContact','describe','difference','keys','createdAt','updatedAt','isNil','ValidationError','from\x20is\x20mandatory','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','find','account','CmList','List','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','defaults','ListId','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise'];(function(_0x361c77,_0x566db7){var _0x29b089=function(_0x31e866){while(--_0x31e866){_0x361c77['push'](_0x361c77['shift']());}};_0x29b089(++_0x566db7);}(_0xc8d4,0x108));var _0x4c8d=function(_0x254eec,_0x70b3dc){_0x254eec=_0x254eec-0x0;var _0x3ba075=_0xc8d4[_0x254eec];return _0x3ba075;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4c8d('0x0'));var rs=require(_0x4c8d('0x1'));var fs=require('fs');var Redis=require(_0x4c8d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c8d('0x3'));var logger=require('../../config/logger')(_0x4c8d('0x4'));var config=require('../../config/environment');var jayson=require(_0x4c8d('0x5'));var client=jayson[_0x4c8d('0x6')]['http']({'port':0x232c});config[_0x4c8d('0x7')]=_['defaults'](config[_0x4c8d('0x7')],{'host':_0x4c8d('0x8'),'port':0x18eb});var socket=require(_0x4c8d('0x9'))(new Redis(config[_0x4c8d('0x7')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x504c2e,_0x465efb,_0x511026){return new BPromise(function(_0x20e3a9,_0x4f796f){return client[_0x4c8d('0xa')](_0x504c2e,_0x511026)[_0x4c8d('0xb')](function(_0x4d6c60){logger[_0x4c8d('0xc')]('FaxAccount,\x20%s,\x20%s',_0x465efb,'request\x20sent');logger['debug'](_0x4c8d('0xd'),_0x465efb,_0x4c8d('0xe'),JSON[_0x4c8d('0xf')](_0x4d6c60));if(_0x4d6c60[_0x4c8d('0x10')]){if(_0x4d6c60[_0x4c8d('0x10')][_0x4c8d('0x11')]===0x1f4){logger[_0x4c8d('0x10')](_0x4c8d('0x12'),_0x465efb,_0x4d6c60[_0x4c8d('0x10')][_0x4c8d('0x13')]);return _0x4f796f(_0x4d6c60[_0x4c8d('0x10')][_0x4c8d('0x13')]);}logger[_0x4c8d('0x10')](_0x4c8d('0x12'),_0x465efb,_0x4d6c60[_0x4c8d('0x10')][_0x4c8d('0x13')]);return _0x20e3a9(_0x4d6c60[_0x4c8d('0x10')]['message']);}else{logger[_0x4c8d('0xc')]('FaxAccount,\x20%s,\x20%s',_0x465efb,_0x4c8d('0xe'));_0x20e3a9(_0x4d6c60[_0x4c8d('0x14')]['message']);}})[_0x4c8d('0x15')](function(_0x1359a1){logger[_0x4c8d('0x10')](_0x4c8d('0x12'),_0x465efb,_0x1359a1);_0x4f796f(_0x1359a1);});});}exports[_0x4c8d('0x16')]=function(_0xff6376){var _0x24fe3e=this;return new Promise(function(_0x407d76,_0x5a36ee){return db[_0x4c8d('0x17')][_0x4c8d('0x18')]({'raw':_0xff6376['options']?_0xff6376['options'][_0x4c8d('0x19')]===undefined?!![]:![]:!![],'where':_0xff6376[_0x4c8d('0x1a')]?_0xff6376['options'][_0x4c8d('0x1b')]||null:null,'attributes':_0xff6376[_0x4c8d('0x1a')]?_0xff6376[_0x4c8d('0x1a')]['attributes']||null:null,'limit':_0xff6376['options']?_0xff6376[_0x4c8d('0x1a')][_0x4c8d('0x1c')]||null:null,'include':_0xff6376[_0x4c8d('0x1a')]?_0xff6376['options']['include']?_[_0x4c8d('0x1d')](_0xff6376[_0x4c8d('0x1a')][_0x4c8d('0x1e')],function(_0x562aca){return{'model':db[_0x562aca[_0x4c8d('0x1f')]],'as':_0x562aca['as'],'attributes':_0x562aca[_0x4c8d('0x20')],'include':_0x562aca[_0x4c8d('0x1e')]?_[_0x4c8d('0x1d')](_0x562aca['include'],function(_0x43be0d){return{'model':db[_0x43be0d[_0x4c8d('0x1f')]],'as':_0x43be0d['as'],'attributes':_0x43be0d[_0x4c8d('0x20')],'include':_0x43be0d[_0x4c8d('0x1e')]?_['map'](_0x43be0d[_0x4c8d('0x1e')],function(_0x46c347){return{'model':db[_0x46c347[_0x4c8d('0x1f')]],'as':_0x46c347['as'],'attributes':_0x46c347[_0x4c8d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4c8d('0xb')](function(_0x311a89){logger[_0x4c8d('0xc')](_0x4c8d('0x16'),_0xff6376);logger[_0x4c8d('0x21')](_0x4c8d('0x16'),_0xff6376,JSON[_0x4c8d('0xf')](_0x311a89));_0x407d76(_0x311a89);})['catch'](function(_0x134447){logger[_0x4c8d('0x10')](_0x4c8d('0x16'),_0x134447['message'],_0xff6376);_0x5a36ee(_0x24fe3e[_0x4c8d('0x10')](0x1f4,_0x134447['message']));});});};exports[_0x4c8d('0x22')]=function(_0x53fa61,_0x5abcf7,_0x3d3018){var _0x22586d=this;return new Promise(function(_0x160abb,_0x58685e){var _0x440a05={'body':_0x53fa61[_0x4c8d('0x23')],'channel':_0x4c8d('0x24')};var _0x5b14d3=[];var _0x24e851=[];var _0x57827b={};return db[_0x4c8d('0x25')][_0x4c8d('0x26')]()[_0x4c8d('0xb')](function(_0x54f684){if(!_0x54f684){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x5b14d3=_[_0x4c8d('0x27')](_[_0x4c8d('0x28')](_0x54f684),[_0x4c8d('0x29'),_0x4c8d('0x2a')]);_0x24e851=_['difference'](_[_0x4c8d('0x28')](_0x54f684),[_0x4c8d('0x29'),'updatedAt','CompanyId','ListId']);if(_0x53fa61[_0x4c8d('0x23')]['id']){delete _0x53fa61[_0x4c8d('0x23')]['id'];}if(_[_0x4c8d('0x2b')](_0x53fa61['body']['from'])){throw new db['Sequelize'][(_0x4c8d('0x2c'))](_0x4c8d('0x2d'));}if(_[_0x4c8d('0x2b')](_0x53fa61[_0x4c8d('0x23')][_0x4c8d('0x23')])||_0x53fa61[_0x4c8d('0x23')][_0x4c8d('0x23')]===''){throw new db[(_0x4c8d('0x2e'))][(_0x4c8d('0x2c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4c8d('0x2b')](_0x53fa61['body']['mapKey'])){throw new db[(_0x4c8d('0x2e'))][(_0x4c8d('0x2c'))](_0x4c8d('0x2f')+_0x24e851);}if(!_[_0x4c8d('0x30')](_0x24e851,_0x53fa61[_0x4c8d('0x23')]['mapKey'])){throw new db[(_0x4c8d('0x2e'))]['ValidationError'](_0x4c8d('0x31')+_0x24e851);}_0x57827b[_0x53fa61['body'][_0x4c8d('0x32')]]=_0x53fa61[_0x4c8d('0x23')][_0x4c8d('0x33')];})[_0x4c8d('0xb')](function(){return db['FaxAccount'][_0x4c8d('0x34')]({'where':{'id':_0x53fa61[_0x4c8d('0x35')]['id']},'include':[{'model':db[_0x4c8d('0x36')],'as':_0x4c8d('0x37'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x57827b,'limit':0x1,'order':[[_0x4c8d('0x2a'),'DESC']]}]},{'model':db[_0x4c8d('0x38')],'as':_0x4c8d('0x39')}]});})[_0x4c8d('0xb')](function(_0xfddfcb){if(_0xfddfcb&&_0xfddfcb['List']){var _0x5224dc=_0xfddfcb[_0x4c8d('0x3a')]({'plain':!![]});_0x440a05['account']=_0x5224dc;_0x440a05[_0x4c8d('0x3b')]=_0x5224dc[_0x4c8d('0x39')];_0x440a05[_0x4c8d('0x3c')]=_0x5224dc[_0x4c8d('0x37')];_0x440a05[_0x4c8d('0x3b')]=_[_0x4c8d('0x3d')](_0x440a05[_0x4c8d('0x3b')],[_0x4c8d('0x3e')],[_0x4c8d('0x3f')]);if(_0x440a05[_0x4c8d('0x35')][_0x4c8d('0x39')]){delete _0x440a05[_0x4c8d('0x35')][_0x4c8d('0x39')];}if(_0x440a05[_0x4c8d('0x35')][_0x4c8d('0x37')]&&_0x440a05[_0x4c8d('0x35')][_0x4c8d('0x37')][_0x4c8d('0x40')][_0x4c8d('0x41')]){return _0x440a05['account'][_0x4c8d('0x37')][_0x4c8d('0x40')][0x0];}var _0x4d97f4=_[_0x4c8d('0x42')](_0x53fa61[_0x4c8d('0x23')],{'firstName':_0x53fa61[_0x4c8d('0x23')]['from'],'ListId':_0x5224dc[_0x4c8d('0x43')]});_0x4d97f4[_0x53fa61['body']['mapKey']]=_0x53fa61[_0x4c8d('0x23')][_0x4c8d('0x33')];return db['CmContact'][_0x4c8d('0x44')](_0x4d97f4,{'fields':_0x5b14d3,'raw':!![]});}})[_0x4c8d('0xb')](function(_0x55112b){_0x440a05['contact']=_0x55112b;if(_0x55112b){var _0x1eac77={'ContactId':_0x55112b['id'],'FaxAccountId':_0x53fa61[_0x4c8d('0x35')]['id'],'fax':_0x55112b[_0x4c8d('0x24')]};return db[_0x4c8d('0x45')][_0x4c8d('0x34')]({'where':{'ContactId':_0x55112b['id'],'closed':![],'FaxAccountId':_0x53fa61['account']['id']}})[_0x4c8d('0xb')](function(_0x308f57){if(_0x308f57){return[_0x308f57,![]];}return db[_0x4c8d('0x45')][_0x4c8d('0x44')](_0x1eac77)[_0x4c8d('0xb')](function(_0x1a027a){return[_0x1a027a,!![]];});});}else{throw new Error(_0x4c8d('0x46'));}})[_0x4c8d('0x47')](function(_0x10dee5,_0x551d5b){var _0x58ab0d=_0x10dee5[_0x4c8d('0x3a')]({'plain':!![]});if(_0x551d5b){if(_0x440a05['account'][_0x4c8d('0x48')]){_0x440a05[_0x4c8d('0x3b')]['push']({'id':0x0,'priority':_0x440a05['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x4c8d('0x49')});}_0x58ab0d[_0x4c8d('0x4a')]=!![];}else{_0x58ab0d[_0x4c8d('0x4a')]=![];}_0x440a05[_0x4c8d('0x4b')]=_0x58ab0d;return db[_0x4c8d('0x4c')][_0x4c8d('0x44')]({'body':_0x53fa61[_0x4c8d('0x23')]['body'],'FaxAccountId':_0x53fa61[_0x4c8d('0x35')]['id'],'FaxInteractionId':_0x10dee5['id'],'direction':'in','ContactId':_0x10dee5[_0x4c8d('0x4d')],'AttachmentId':_0x53fa61['body'][_0x4c8d('0x4e')]});})['then'](function(_0x329d99){_0x440a05['message']=_0x329d99;if(!_0x440a05[_0x4c8d('0x4b')][_0x4c8d('0x4f')])return;return db[_0x4c8d('0x50')][_0x4c8d('0x34')]({'attributes':['id',_0x4c8d('0x51')],'where':{'id':_0x440a05[_0x4c8d('0x4b')][_0x4c8d('0x4f')]}});})[_0x4c8d('0xb')](function(_0xbf7281){if(_0xbf7281){_0x440a05[_0x4c8d('0x3b')][_0x4c8d('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xbf7281[_0x4c8d('0x51')]+','+(_0x440a05[_0x4c8d('0x35')][_0x4c8d('0x53')]||0xa),'interval':'*,*,*,*'});}if(!_0x440a05['interaction'][_0x4c8d('0x54')])return;return db[_0x4c8d('0x55')][_0x4c8d('0x34')]({'attributes':['id',_0x4c8d('0x51')],'where':{'id':_0x440a05['interaction']['queueId']}});})[_0x4c8d('0xb')](function(_0x409fab){if(_0x409fab){_0x440a05[_0x4c8d('0x3b')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4c8d('0x56'),'appdata':_0x409fab[_0x4c8d('0x51')]+','+(_0x440a05[_0x4c8d('0x35')][_0x4c8d('0x57')]||0x12c),'interval':_0x4c8d('0x49')});}return respondWithRpcPromise(_0x4c8d('0x58'),_0x4c8d('0x59'),_0x440a05);})[_0x4c8d('0xb')](function(_0x16e8ff){_0x160abb(_0x16e8ff);})['catch'](function(_0x3b4a1c){_0x58685e(_0x22586d[_0x4c8d('0x10')](0x1f4,_0x3b4a1c[_0x4c8d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 673812e..a8f5596 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 _0x6859=['removeListener','length','faxAccount:','remove','update','emit'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x6859,0x1e9));var _0x9685=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6859[_0x36ed48];return _0x51c63a;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0x9685('0x0'),_0x9685('0x1')];function createListener(_0x514c18,_0x101042){return function(_0x5bff85){_0x101042[_0x9685('0x2')](_0x514c18,_0x5bff85);};}function removeListener(_0x3b8224,_0x40e307){return function(){FaxAccountEvents[_0x9685('0x3')](_0x3b8224,_0x40e307);};}exports['register']=function(_0x4a0adb){for(var _0x40fd98=0x0,_0xcd87d7=events[_0x9685('0x4')];_0x40fd98<_0xcd87d7;_0x40fd98++){var _0x25312f=events[_0x40fd98];var _0xde6b03=createListener(_0x9685('0x5')+_0x25312f,_0x4a0adb);FaxAccountEvents['on'](_0x25312f,_0xde6b03);}}; \ No newline at end of file +var _0xe8ca=['save','remove','emit','removeListener','register','./faxAccount.events'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xe8ca,0x12b));var _0xae8c=function(_0x3f3b53,_0x3d035f){_0x3f3b53=_0x3f3b53-0x0;var _0x3fa180=_0xe8ca[_0x3f3b53];return _0x3fa180;};'use strict';var FaxAccountEvents=require(_0xae8c('0x0'));var events=[_0xae8c('0x1'),_0xae8c('0x2'),'update'];function createListener(_0x416356,_0x514e4e){return function(_0x1176a4){_0x514e4e[_0xae8c('0x3')](_0x416356,_0x1176a4);};}function removeListener(_0x3a31c9,_0x6c2b2b){return function(){FaxAccountEvents[_0xae8c('0x4')](_0x3a31c9,_0x6c2b2b);};}exports[_0xae8c('0x5')]=function(_0x1c1e3a){for(var _0x1a53f7=0x0,_0x5d7227=events['length'];_0x1a53f7<_0x5d7227;_0x1a53f7++){var _0x26a5da=events[_0x1a53f7];var _0x488407=createListener('faxAccount:'+_0x26a5da,_0x1c1e3a);FaxAccountEvents['on'](_0x26a5da,_0x488407);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index aa47efb..834300f 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 _0xa995=['isAuthenticated','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','create','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','send','/:id/users','addAgents','put','/:id','update','delete','removeDispositions','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','index','/describe','describe'];(function(_0x54e552,_0x1216d6){var _0x5e18cb=function(_0x5148b3){while(--_0x5148b3){_0x54e552['push'](_0x54e552['shift']());}};_0x5e18cb(++_0x1216d6);}(_0xa995,0x144));var _0x5a99=function(_0x26fd0a,_0x3c08d2){_0x26fd0a=_0x26fd0a-0x0;var _0x126fa2=_0xa995[_0x26fd0a];return _0x126fa2;};'use strict';var multer=require('multer');var util=require(_0x5a99('0x0'));var path=require(_0x5a99('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a99('0x2'));var router=express[_0x5a99('0x3')]();var fs_extra=require(_0x5a99('0x4'));var auth=require(_0x5a99('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5a99('0x6'));var controller=require(_0x5a99('0x7'));router[_0x5a99('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a99('0x9')]);router['get'](_0x5a99('0xa'),auth['isAuthenticated'](),controller[_0x5a99('0xb')]);router[_0x5a99('0x8')]('/:id',auth[_0x5a99('0xc')](),controller[_0x5a99('0xd')]);router['get'](_0x5a99('0xe'),auth['isAuthenticated'](),controller[_0x5a99('0xf')]);router['get']('/:id/canned_answers',auth[_0x5a99('0xc')](),controller[_0x5a99('0x10')]);router[_0x5a99('0x8')](_0x5a99('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x5a99('0x12'),auth['isAuthenticated'](),controller[_0x5a99('0x13')]);router[_0x5a99('0x8')](_0x5a99('0x14'),auth['isAuthenticated'](),controller[_0x5a99('0x15')]);router[_0x5a99('0x8')]('/:id/users',auth[_0x5a99('0xc')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x5a99('0x16')]);router[_0x5a99('0x17')](_0x5a99('0xe'),auth['isAuthenticated'](),controller[_0x5a99('0x18')]);router[_0x5a99('0x17')](_0x5a99('0x19'),auth[_0x5a99('0xc')](),controller[_0x5a99('0x1a')]);router['post'](_0x5a99('0x11'),auth[_0x5a99('0xc')](),controller[_0x5a99('0x1b')]);router['post'](_0x5a99('0x12'),auth['isAuthenticated'](),controller[_0x5a99('0x1c')]);router[_0x5a99('0x17')](_0x5a99('0x1d'),auth[_0x5a99('0xc')](),controller[_0x5a99('0x1e')]);router[_0x5a99('0x17')](_0x5a99('0x1f'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x5a99('0x17')]('/:id/send',auth[_0x5a99('0xc')](),controller[_0x5a99('0x20')]);router['post'](_0x5a99('0x21'),auth['isAuthenticated'](),controller[_0x5a99('0x22')]);router[_0x5a99('0x23')](_0x5a99('0x24'),auth[_0x5a99('0xc')](),controller[_0x5a99('0x25')]);router['delete'](_0x5a99('0x24'),auth[_0x5a99('0xc')](),controller['destroy']);router[_0x5a99('0x26')](_0x5a99('0xe'),auth['isAuthenticated'](),controller[_0x5a99('0x27')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x5a99('0x21'),auth[_0x5a99('0xc')](),controller[_0x5a99('0x28')]);module[_0x5a99('0x29')]=router; \ No newline at end of file +var _0xc269=['addDisposition','/:id/applications','addApplications','updateAccountApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','getMessages','/:id/users','getAgents','post','create','/:id/dispositions'];(function(_0x2b39d8,_0x2f6178){var _0x159967=function(_0x114885){while(--_0x114885){_0x2b39d8['push'](_0x2b39d8['shift']());}};_0x159967(++_0x2f6178);}(_0xc269,0x127));var _0x9c26=function(_0x5a4546,_0xa7de27){_0x5a4546=_0x5a4546-0x0;var _0x39d31d=_0xc269[_0x5a4546];return _0x39d31d;};'use strict';var multer=require('multer');var util=require(_0x9c26('0x0'));var path=require('path');var timeout=require(_0x9c26('0x1'));var express=require(_0x9c26('0x2'));var router=express[_0x9c26('0x3')]();var fs_extra=require(_0x9c26('0x4'));var auth=require(_0x9c26('0x5'));var interaction=require(_0x9c26('0x6'));var config=require(_0x9c26('0x7'));var controller=require('./faxAccount.controller');router[_0x9c26('0x8')]('/',auth[_0x9c26('0x9')](),controller[_0x9c26('0xa')]);router['get'](_0x9c26('0xb'),auth['isAuthenticated'](),controller[_0x9c26('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9c26('0xd')]);router[_0x9c26('0x8')]('/:id/dispositions',auth[_0x9c26('0x9')](),controller['getDispositions']);router[_0x9c26('0x8')](_0x9c26('0xe'),auth['isAuthenticated'](),controller[_0x9c26('0xf')]);router[_0x9c26('0x8')](_0x9c26('0x10'),auth[_0x9c26('0x9')](),controller[_0x9c26('0x11')]);router['get']('/:id/applications',auth[_0x9c26('0x9')](),controller[_0x9c26('0x12')]);router[_0x9c26('0x8')]('/:id/messages',auth[_0x9c26('0x9')](),controller[_0x9c26('0x13')]);router[_0x9c26('0x8')](_0x9c26('0x14'),auth[_0x9c26('0x9')](),controller[_0x9c26('0x15')]);router[_0x9c26('0x16')]('/',auth[_0x9c26('0x9')](),controller[_0x9c26('0x17')]);router['post'](_0x9c26('0x18'),auth[_0x9c26('0x9')](),controller[_0x9c26('0x19')]);router[_0x9c26('0x16')](_0x9c26('0xe'),auth[_0x9c26('0x9')](),controller['addAnswer']);router[_0x9c26('0x16')]('/:id/interactions',auth[_0x9c26('0x9')](),controller['addInteraction']);router[_0x9c26('0x16')](_0x9c26('0x1a'),auth[_0x9c26('0x9')](),controller[_0x9c26('0x1b')]);router[_0x9c26('0x16')]('/addaccountapplications',auth['isAuthenticated'](),controller['addAccountApplications']);router['post']('/updateaccountapplications',auth[_0x9c26('0x9')](),controller[_0x9c26('0x1c')]);router[_0x9c26('0x16')](_0x9c26('0x1d'),auth[_0x9c26('0x9')](),controller[_0x9c26('0x1e')]);router['post'](_0x9c26('0x14'),auth[_0x9c26('0x9')](),controller[_0x9c26('0x1f')]);router[_0x9c26('0x20')](_0x9c26('0x21'),auth[_0x9c26('0x9')](),controller[_0x9c26('0x22')]);router['delete'](_0x9c26('0x21'),auth['isAuthenticated'](),controller['destroy']);router[_0x9c26('0x23')](_0x9c26('0x18'),auth[_0x9c26('0x9')](),controller[_0x9c26('0x24')]);router[_0x9c26('0x23')]('/:id/canned_answers',auth[_0x9c26('0x9')](),controller[_0x9c26('0x25')]);router[_0x9c26('0x23')](_0x9c26('0x14'),auth[_0x9c26('0x9')](),controller[_0x9c26('0x26')]);module[_0x9c26('0x27')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e11d546..942d93f 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 _0x6c84=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x6c84,0x15c));var _0x46c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6c84[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x46c8('0x0'));module[_0x46c8('0x1')]={'priority':{'type':Sequelize[_0x46c8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x46c8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x46c8('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x46c8('0x3')],'defaultValue':_0x46c8('0x5')}}; \ No newline at end of file +var _0x9b8d=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x9b8d,0x131));var _0xd9b8=function(_0x117576,_0x1ced1a){_0x117576=_0x117576-0x0;var _0x4533f5=_0x9b8d[_0x117576];return _0x4533f5;};'use strict';var Sequelize=require(_0xd9b8('0x0'));module[_0xd9b8('0x1')]={'priority':{'type':Sequelize[_0xd9b8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd9b8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd9b8('0x4')]()},'description':{'type':Sequelize[_0xd9b8('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd9b8('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index f2b367e..c575d51 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 _0x8301=['Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','FaxApplication','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0x8301,0x1cc));var _0x1830=function(_0x58252d,_0x2070b3){_0x58252d=_0x58252d-0x0;var _0x55a98c=_0x8301[_0x58252d];return _0x55a98c;};'use strict';var emlformat=require(_0x1830('0x0'));var rimraf=require(_0x1830('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1830('0x2'));var BPromise=require(_0x1830('0x3'));var Mustache=require(_0x1830('0x4'));var util=require(_0x1830('0x5'));var path=require('path');var sox=require(_0x1830('0x6'));var csv=require(_0x1830('0x7'));var ejs=require(_0x1830('0x8'));var fs=require('fs');var fs_extra=require(_0x1830('0x9'));var _=require('lodash');var squel=require(_0x1830('0xa'));var crypto=require(_0x1830('0xb'));var jsforce=require(_0x1830('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1830('0x7'));var querystring=require(_0x1830('0xd'));var Papa=require(_0x1830('0xe'));var Redis=require('ioredis');var authService=require(_0x1830('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1830('0x10'))(_0x1830('0x11'));var utils=require(_0x1830('0x12'));var config=require(_0x1830('0x13'));var licenseUtil=require(_0x1830('0x14'));var db=require(_0x1830('0x15'))['db'];function respondWithStatusCode(_0x1e9895,_0x15f128){_0x15f128=_0x15f128||0xcc;return function(_0x43e500){if(_0x43e500){return _0x1e9895['sendStatus'](_0x15f128);}return _0x1e9895[_0x1830('0x16')](_0x15f128)[_0x1830('0x17')]();};}function respondWithResult(_0x2b75d0,_0x4521bc){_0x4521bc=_0x4521bc||0xc8;return function(_0x2a6481){if(_0x2a6481){return _0x2b75d0[_0x1830('0x16')](_0x4521bc)[_0x1830('0x18')](_0x2a6481);}};}function respondWithFilteredResult(_0x48f6ab,_0x3f673c){return function(_0x3eb0b4){if(_0x3eb0b4){var _0x3eb4d1=typeof _0x3f673c[_0x1830('0x19')]==='undefined'&&typeof _0x3f673c[_0x1830('0x1a')]===_0x1830('0x1b');var _0x3028ca=_0x3eb0b4[_0x1830('0x1c')];var _0x5378db=_0x3eb4d1?0x0:_0x3f673c[_0x1830('0x19')];var _0x4f7e70=_0x3eb4d1?_0x3eb0b4[_0x1830('0x1c')]:_0x3f673c[_0x1830('0x19')]+_0x3f673c[_0x1830('0x1a')];var _0x3c03a8;if(_0x4f7e70>=_0x3028ca){_0x4f7e70=_0x3028ca;_0x3c03a8=0xc8;}else{_0x3c03a8=0xce;}_0x48f6ab[_0x1830('0x16')](_0x3c03a8);return _0x48f6ab[_0x1830('0x1d')](_0x1830('0x1e'),_0x5378db+'-'+_0x4f7e70+'/'+_0x3028ca)[_0x1830('0x18')](_0x3eb0b4);}return null;};}function patchUpdates(_0x2884a5){return function(_0x3b9340){try{jsonpatch[_0x1830('0x1f')](_0x3b9340,_0x2884a5,!![]);}catch(_0xc74302){return BPromise[_0x1830('0x20')](_0xc74302);}return _0x3b9340['save']();};}function saveUpdates(_0x4c4b18,_0x57bd57){return function(_0x30a201){if(_0x30a201){return _0x30a201[_0x1830('0x21')](_0x4c4b18)[_0x1830('0x22')](function(_0xc4074e){return _0xc4074e;});}return null;};}function removeEntity(_0x4f85f1,_0x4e0902){return function(_0x555a74){if(_0x555a74){return _0x555a74[_0x1830('0x23')]()['then'](function(){_0x4f85f1[_0x1830('0x16')](0xcc)[_0x1830('0x17')]();});}};}function handleEntityNotFound(_0x3f91ff,_0xbf24fe){return function(_0x332a3e){if(!_0x332a3e){_0x3f91ff['sendStatus'](0x194);}return _0x332a3e;};}function handleError(_0x2f0e32,_0x4e1183){_0x4e1183=_0x4e1183||0x1f4;return function(_0x478d9c){logger[_0x1830('0x24')](_0x478d9c[_0x1830('0x25')]);if(_0x478d9c[_0x1830('0x26')]){delete _0x478d9c[_0x1830('0x26')];}_0x2f0e32[_0x1830('0x16')](_0x4e1183)[_0x1830('0x27')](_0x478d9c);};}exports['index']=function(_0x4cd7ed,_0x193471){var _0x343916={},_0x3f82e9={},_0x246efc={'count':0x0,'rows':[]};var _0x5d0df6=_[_0x1830('0x28')](db[_0x1830('0x29')]['rawAttributes'],function(_0x5858f5){return{'name':_0x5858f5[_0x1830('0x2a')],'type':_0x5858f5[_0x1830('0x2b')][_0x1830('0x2c')]};});_0x3f82e9[_0x1830('0x2d')]=_[_0x1830('0x28')](_0x5d0df6,_0x1830('0x26'));_0x3f82e9[_0x1830('0x2e')]=_[_0x1830('0x2f')](_0x4cd7ed['query']);_0x3f82e9[_0x1830('0x30')]=_[_0x1830('0x31')](_0x3f82e9[_0x1830('0x2d')],_0x3f82e9[_0x1830('0x2e')]);_0x343916['attributes']=_[_0x1830('0x31')](_0x3f82e9[_0x1830('0x2d')],qs[_0x1830('0x32')](_0x4cd7ed[_0x1830('0x2e')][_0x1830('0x32')]));_0x343916[_0x1830('0x33')]=_0x343916['attributes'][_0x1830('0x34')]?_0x343916[_0x1830('0x33')]:_0x3f82e9[_0x1830('0x2d')];if(!_0x4cd7ed[_0x1830('0x2e')]['hasOwnProperty']('nolimit')){_0x343916[_0x1830('0x1a')]=qs[_0x1830('0x1a')](_0x4cd7ed[_0x1830('0x2e')][_0x1830('0x1a')]);_0x343916[_0x1830('0x19')]=qs['offset'](_0x4cd7ed['query'][_0x1830('0x19')]);}_0x343916[_0x1830('0x35')]=qs[_0x1830('0x36')](_0x4cd7ed[_0x1830('0x2e')][_0x1830('0x36')]);_0x343916[_0x1830('0x37')]=qs[_0x1830('0x30')](_[_0x1830('0x38')](_0x4cd7ed[_0x1830('0x2e')],_0x3f82e9[_0x1830('0x30')]),_0x5d0df6);if(_0x4cd7ed[_0x1830('0x2e')][_0x1830('0x39')]){_0x343916[_0x1830('0x37')]=_[_0x1830('0x3a')](_0x343916[_0x1830('0x37')],{'$or':_[_0x1830('0x28')](_0x5d0df6,function(_0x2697bb){if(_0x2697bb[_0x1830('0x2b')]!==_0x1830('0x3b')){var _0x241af5={};_0x241af5[_0x2697bb[_0x1830('0x26')]]={'$like':'%'+_0x4cd7ed[_0x1830('0x2e')]['filter']+'%'};return _0x241af5;}})});}_0x343916=_['merge']({},_0x343916,_0x4cd7ed['options']);var _0x48d077={'where':_0x343916[_0x1830('0x37')]};return db[_0x1830('0x29')][_0x1830('0x1c')](_0x48d077)[_0x1830('0x22')](function(_0x2baf8e){_0x246efc[_0x1830('0x1c')]=_0x2baf8e;if(_0x4cd7ed['query'][_0x1830('0x3c')]){_0x343916[_0x1830('0x3d')]=[{'all':!![]}];}return db[_0x1830('0x29')][_0x1830('0x3e')](_0x343916);})[_0x1830('0x22')](function(_0x36fc8d){_0x246efc['rows']=_0x36fc8d;return _0x246efc;})[_0x1830('0x22')](respondWithFilteredResult(_0x193471,_0x343916))[_0x1830('0x3f')](handleError(_0x193471,null));};exports[_0x1830('0x40')]=function(_0x1785e1,_0x37b0c7){var _0x245954={'raw':!![],'where':{'id':_0x1785e1['params']['id']}},_0x3ae901={};_0x3ae901[_0x1830('0x2d')]=_[_0x1830('0x2f')](db[_0x1830('0x29')][_0x1830('0x41')]);_0x3ae901['query']=_[_0x1830('0x2f')](_0x1785e1[_0x1830('0x2e')]);_0x3ae901[_0x1830('0x30')]=_['intersection'](_0x3ae901[_0x1830('0x2d')],_0x3ae901[_0x1830('0x2e')]);_0x245954['attributes']=_[_0x1830('0x31')](_0x3ae901[_0x1830('0x2d')],qs['fields'](_0x1785e1[_0x1830('0x2e')][_0x1830('0x32')]));_0x245954[_0x1830('0x33')]=_0x245954[_0x1830('0x33')]['length']?_0x245954[_0x1830('0x33')]:_0x3ae901[_0x1830('0x2d')];if(_0x1785e1[_0x1830('0x2e')][_0x1830('0x3c')]){_0x245954['include']=[{'all':!![]}];}_0x245954=_[_0x1830('0x3a')]({},_0x245954,_0x1785e1['options']);return db['FaxApplication'][_0x1830('0x42')](_0x245954)['then'](handleEntityNotFound(_0x37b0c7,null))[_0x1830('0x22')](respondWithResult(_0x37b0c7,null))[_0x1830('0x3f')](handleError(_0x37b0c7,null));};exports[_0x1830('0x43')]=function(_0x8d1a3f,_0x1c8556){return db[_0x1830('0x29')]['create'](_0x8d1a3f['body'],{})[_0x1830('0x22')](respondWithResult(_0x1c8556,0xc9))[_0x1830('0x3f')](handleError(_0x1c8556,null));};exports[_0x1830('0x21')]=function(_0x1abfa6,_0x5c4027){if(_0x1abfa6[_0x1830('0x44')]['id']){delete _0x1abfa6['body']['id'];}return db[_0x1830('0x29')][_0x1830('0x42')]({'where':{'id':_0x1abfa6[_0x1830('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c4027,null))['then'](saveUpdates(_0x1abfa6['body'],null))[_0x1830('0x22')](respondWithResult(_0x5c4027,null))[_0x1830('0x3f')](handleError(_0x5c4027,null));};exports[_0x1830('0x23')]=function(_0x3d573b,_0xad9273){return db[_0x1830('0x29')][_0x1830('0x42')]({'where':{'id':_0x3d573b['params']['id']}})[_0x1830('0x22')](handleEntityNotFound(_0xad9273,null))['then'](removeEntity(_0xad9273,null))['catch'](handleError(_0xad9273,null));}; \ No newline at end of file +var _0x9720=['fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','undefined','limit','count','offset','set','Content-Range','update','destroy','error','stack','name','send','map','FaxApplication','type','model','query','filters','intersection','attributes'];(function(_0x16f55d,_0x2f5494){var _0x5c7349=function(_0x2aa6a8){while(--_0x2aa6a8){_0x16f55d['push'](_0x16f55d['shift']());}};_0x5c7349(++_0x2f5494);}(_0x9720,0xeb));var _0x0972=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x9720[_0x24f31b];return _0x488401;};'use strict';var emlformat=require(_0x0972('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0972('0x1'));var jsonpatch=require(_0x0972('0x2'));var rp=require(_0x0972('0x3'));var moment=require('moment');var BPromise=require(_0x0972('0x4'));var Mustache=require(_0x0972('0x5'));var util=require('util');var path=require(_0x0972('0x6'));var sox=require(_0x0972('0x7'));var csv=require(_0x0972('0x8'));var ejs=require(_0x0972('0x9'));var fs=require('fs');var fs_extra=require(_0x0972('0xa'));var _=require(_0x0972('0xb'));var squel=require(_0x0972('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0972('0x8'));var querystring=require(_0x0972('0xd'));var Papa=require(_0x0972('0xe'));var Redis=require(_0x0972('0xf'));var authService=require(_0x0972('0x10'));var qs=require(_0x0972('0x11'));var as=require(_0x0972('0x12'));var hardwareService=require(_0x0972('0x13'));var logger=require(_0x0972('0x14'))(_0x0972('0x15'));var utils=require('../../config/utils');var config=require(_0x0972('0x16'));var licenseUtil=require(_0x0972('0x17'));var db=require(_0x0972('0x18'))['db'];function respondWithStatusCode(_0x58f71b,_0x3486f0){_0x3486f0=_0x3486f0||0xcc;return function(_0x48c9d4){if(_0x48c9d4){return _0x58f71b[_0x0972('0x19')](_0x3486f0);}return _0x58f71b[_0x0972('0x1a')](_0x3486f0)[_0x0972('0x1b')]();};}function respondWithResult(_0x4a64c4,_0xafcd1a){_0xafcd1a=_0xafcd1a||0xc8;return function(_0x87bff9){if(_0x87bff9){return _0x4a64c4[_0x0972('0x1a')](_0xafcd1a)[_0x0972('0x1c')](_0x87bff9);}};}function respondWithFilteredResult(_0x10447a,_0x2f6f77){return function(_0x58c2ea){if(_0x58c2ea){var _0x2a5ffc=typeof _0x2f6f77['offset']===_0x0972('0x1d')&&typeof _0x2f6f77[_0x0972('0x1e')]===_0x0972('0x1d');var _0x570e9c=_0x58c2ea[_0x0972('0x1f')];var _0x2f7f90=_0x2a5ffc?0x0:_0x2f6f77[_0x0972('0x20')];var _0x2accc0=_0x2a5ffc?_0x58c2ea[_0x0972('0x1f')]:_0x2f6f77[_0x0972('0x20')]+_0x2f6f77[_0x0972('0x1e')];var _0x15a8d5;if(_0x2accc0>=_0x570e9c){_0x2accc0=_0x570e9c;_0x15a8d5=0xc8;}else{_0x15a8d5=0xce;}_0x10447a[_0x0972('0x1a')](_0x15a8d5);return _0x10447a[_0x0972('0x21')](_0x0972('0x22'),_0x2f7f90+'-'+_0x2accc0+'/'+_0x570e9c)['json'](_0x58c2ea);}return null;};}function patchUpdates(_0x5ca1bc){return function(_0x25b579){try{jsonpatch['apply'](_0x25b579,_0x5ca1bc,!![]);}catch(_0x48d3bf){return BPromise['reject'](_0x48d3bf);}return _0x25b579['save']();};}function saveUpdates(_0x40566d,_0x76becc){return function(_0x4ae06c){if(_0x4ae06c){return _0x4ae06c[_0x0972('0x23')](_0x40566d)['then'](function(_0x2c6713){return _0x2c6713;});}return null;};}function removeEntity(_0x254fc6,_0xe20f6){return function(_0x4e093b){if(_0x4e093b){return _0x4e093b[_0x0972('0x24')]()['then'](function(){_0x254fc6[_0x0972('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x390d4f,_0x433e21){return function(_0x28ede9){if(!_0x28ede9){_0x390d4f[_0x0972('0x19')](0x194);}return _0x28ede9;};}function handleError(_0x5198ab,_0x5dd640){_0x5dd640=_0x5dd640||0x1f4;return function(_0x484fbc){logger[_0x0972('0x25')](_0x484fbc[_0x0972('0x26')]);if(_0x484fbc[_0x0972('0x27')]){delete _0x484fbc[_0x0972('0x27')];}_0x5198ab[_0x0972('0x1a')](_0x5dd640)[_0x0972('0x28')](_0x484fbc);};}exports['index']=function(_0x38f6b1,_0x388f48){var _0xbf5079={},_0xad12b5={},_0x225f39={'count':0x0,'rows':[]};var _0x26a35c=_[_0x0972('0x29')](db[_0x0972('0x2a')]['rawAttributes'],function(_0x255a1c){return{'name':_0x255a1c['fieldName'],'type':_0x255a1c[_0x0972('0x2b')]['key']};});_0xad12b5[_0x0972('0x2c')]=_[_0x0972('0x29')](_0x26a35c,_0x0972('0x27'));_0xad12b5[_0x0972('0x2d')]=_['keys'](_0x38f6b1[_0x0972('0x2d')]);_0xad12b5[_0x0972('0x2e')]=_[_0x0972('0x2f')](_0xad12b5[_0x0972('0x2c')],_0xad12b5[_0x0972('0x2d')]);_0xbf5079[_0x0972('0x30')]=_[_0x0972('0x2f')](_0xad12b5[_0x0972('0x2c')],qs[_0x0972('0x31')](_0x38f6b1[_0x0972('0x2d')][_0x0972('0x31')]));_0xbf5079[_0x0972('0x30')]=_0xbf5079[_0x0972('0x30')][_0x0972('0x32')]?_0xbf5079[_0x0972('0x30')]:_0xad12b5[_0x0972('0x2c')];if(!_0x38f6b1[_0x0972('0x2d')]['hasOwnProperty'](_0x0972('0x33'))){_0xbf5079[_0x0972('0x1e')]=qs['limit'](_0x38f6b1[_0x0972('0x2d')][_0x0972('0x1e')]);_0xbf5079[_0x0972('0x20')]=qs['offset'](_0x38f6b1[_0x0972('0x2d')][_0x0972('0x20')]);}_0xbf5079[_0x0972('0x34')]=qs['sort'](_0x38f6b1[_0x0972('0x2d')][_0x0972('0x35')]);_0xbf5079['where']=qs[_0x0972('0x2e')](_[_0x0972('0x36')](_0x38f6b1[_0x0972('0x2d')],_0xad12b5['filters']),_0x26a35c);if(_0x38f6b1[_0x0972('0x2d')]['filter']){_0xbf5079[_0x0972('0x37')]=_[_0x0972('0x38')](_0xbf5079[_0x0972('0x37')],{'$or':_[_0x0972('0x29')](_0x26a35c,function(_0x166fc4){if(_0x166fc4[_0x0972('0x2b')]!==_0x0972('0x39')){var _0x32cf9d={};_0x32cf9d[_0x166fc4['name']]={'$like':'%'+_0x38f6b1[_0x0972('0x2d')]['filter']+'%'};return _0x32cf9d;}})});}_0xbf5079=_[_0x0972('0x38')]({},_0xbf5079,_0x38f6b1['options']);var _0x245816={'where':_0xbf5079[_0x0972('0x37')]};return db[_0x0972('0x2a')][_0x0972('0x1f')](_0x245816)[_0x0972('0x3a')](function(_0x287d37){_0x225f39[_0x0972('0x1f')]=_0x287d37;if(_0x38f6b1[_0x0972('0x2d')][_0x0972('0x3b')]){_0xbf5079[_0x0972('0x3c')]=[{'all':!![]}];}return db[_0x0972('0x2a')][_0x0972('0x3d')](_0xbf5079);})[_0x0972('0x3a')](function(_0x1d8bbf){_0x225f39[_0x0972('0x3e')]=_0x1d8bbf;return _0x225f39;})[_0x0972('0x3a')](respondWithFilteredResult(_0x388f48,_0xbf5079))[_0x0972('0x3f')](handleError(_0x388f48,null));};exports['show']=function(_0x51ae8b,_0x1fed22){var _0x4fbc39={'raw':!![],'where':{'id':_0x51ae8b[_0x0972('0x40')]['id']}},_0x2bc144={};_0x2bc144['model']=_['keys'](db[_0x0972('0x2a')][_0x0972('0x41')]);_0x2bc144[_0x0972('0x2d')]=_[_0x0972('0x42')](_0x51ae8b['query']);_0x2bc144['filters']=_['intersection'](_0x2bc144[_0x0972('0x2c')],_0x2bc144[_0x0972('0x2d')]);_0x4fbc39[_0x0972('0x30')]=_['intersection'](_0x2bc144['model'],qs[_0x0972('0x31')](_0x51ae8b[_0x0972('0x2d')]['fields']));_0x4fbc39[_0x0972('0x30')]=_0x4fbc39[_0x0972('0x30')]['length']?_0x4fbc39['attributes']:_0x2bc144['model'];if(_0x51ae8b[_0x0972('0x2d')][_0x0972('0x3b')]){_0x4fbc39[_0x0972('0x3c')]=[{'all':!![]}];}_0x4fbc39=_['merge']({},_0x4fbc39,_0x51ae8b[_0x0972('0x43')]);return db['FaxApplication'][_0x0972('0x44')](_0x4fbc39)['then'](handleEntityNotFound(_0x1fed22,null))[_0x0972('0x3a')](respondWithResult(_0x1fed22,null))['catch'](handleError(_0x1fed22,null));};exports[_0x0972('0x45')]=function(_0x4680da,_0x3939a5){return db[_0x0972('0x2a')][_0x0972('0x45')](_0x4680da[_0x0972('0x46')],{})['then'](respondWithResult(_0x3939a5,0xc9))[_0x0972('0x3f')](handleError(_0x3939a5,null));};exports[_0x0972('0x23')]=function(_0x3f2b70,_0x29abbc){if(_0x3f2b70[_0x0972('0x46')]['id']){delete _0x3f2b70[_0x0972('0x46')]['id'];}return db['FaxApplication'][_0x0972('0x44')]({'where':{'id':_0x3f2b70[_0x0972('0x40')]['id']}})[_0x0972('0x3a')](handleEntityNotFound(_0x29abbc,null))['then'](saveUpdates(_0x3f2b70[_0x0972('0x46')],null))[_0x0972('0x3a')](respondWithResult(_0x29abbc,null))[_0x0972('0x3f')](handleError(_0x29abbc,null));};exports['destroy']=function(_0x208853,_0x3b5455){return db[_0x0972('0x2a')][_0x0972('0x44')]({'where':{'id':_0x208853[_0x0972('0x40')]['id']}})['then'](handleEntityNotFound(_0x3b5455,null))[_0x0972('0x3a')](removeEntity(_0x3b5455,null))[_0x0972('0x3f')](handleError(_0x3b5455,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ce579c4..54a6a9f 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 _0x7bcd=['exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7bcd,0xa1));var _0xd7bc=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0x7bcd[_0x24fa1a];return _0xc5621f;};'use strict';var _=require('lodash');var util=require(_0xd7bc('0x0'));var logger=require('../../config/logger')(_0xd7bc('0x1'));var moment=require(_0xd7bc('0x2'));var BPromise=require(_0xd7bc('0x3'));var rp=require(_0xd7bc('0x4'));var fs=require('fs');var path=require(_0xd7bc('0x5'));var rimraf=require(_0xd7bc('0x6'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0xd7bc('0x7')]=function(_0x126b5b,_0x51ce64){return _0x126b5b[_0xd7bc('0x8')](_0xd7bc('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd7bc('0xa'),'collate':_0xd7bc('0xb')});}; \ No newline at end of file +var _0xfec1=['./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x4b5075,_0xee1fb9){var _0x234617=function(_0x39aef7){while(--_0x39aef7){_0x4b5075['push'](_0x4b5075['shift']());}};_0x234617(++_0xee1fb9);}(_0xfec1,0x165));var _0x1fec=function(_0x4852ff,_0x35118d){_0x4852ff=_0x4852ff-0x0;var _0x3ee92e=_0xfec1[_0x4852ff];return _0x3ee92e;};'use strict';var _=require(_0x1fec('0x0'));var util=require('util');var logger=require(_0x1fec('0x1'))(_0x1fec('0x2'));var moment=require(_0x1fec('0x3'));var BPromise=require(_0x1fec('0x4'));var rp=require(_0x1fec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1fec('0x6'));var attributes=require(_0x1fec('0x7'));module[_0x1fec('0x8')]=function(_0x48d5fd,_0x25c938){return _0x48d5fd[_0x1fec('0x9')](_0x1fec('0xa'),attributes,{'tableName':_0x1fec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1fec('0xc'),'collate':_0x1fec('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index b83f04f..10157e4 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 _0x0806=['attributes','UpdateFaxApplication','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxApplication','update','body','options','raw'];(function(_0x2b11e1,_0x5363eb){var _0x573679=function(_0x27d29d){while(--_0x27d29d){_0x2b11e1['push'](_0x2b11e1['shift']());}};_0x573679(++_0x5363eb);}(_0x0806,0x1ef));var _0x6080=function(_0xdcf024,_0x5ded63){_0xdcf024=_0xdcf024-0x0;var _0x2a3f3c=_0x0806[_0xdcf024];return _0x2a3f3c;};'use strict';var _=require(_0x6080('0x0'));var util=require(_0x6080('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6080('0x2'));var fs=require('fs');var Redis=require(_0x6080('0x3'));var db=require(_0x6080('0x4'))['db'];var utils=require(_0x6080('0x5'));var logger=require(_0x6080('0x6'))('rpc');var config=require(_0x6080('0x7'));var jayson=require(_0x6080('0x8'));var client=jayson[_0x6080('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e07de,_0x35aaa2,_0xc4faac){return new BPromise(function(_0x5174dc,_0x474769){return client[_0x6080('0xa')](_0x2e07de,_0xc4faac)[_0x6080('0xb')](function(_0x37da87){logger[_0x6080('0xc')](_0x6080('0xd'),_0x35aaa2,_0x6080('0xe'));logger[_0x6080('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x35aaa2,_0x6080('0xe'),JSON[_0x6080('0x10')](_0x37da87));if(_0x37da87[_0x6080('0x11')]){if(_0x37da87[_0x6080('0x11')][_0x6080('0x12')]===0x1f4){logger[_0x6080('0x11')](_0x6080('0xd'),_0x35aaa2,_0x37da87[_0x6080('0x11')][_0x6080('0x13')]);return _0x474769(_0x37da87[_0x6080('0x11')][_0x6080('0x13')]);}logger['error'](_0x6080('0xd'),_0x35aaa2,_0x37da87[_0x6080('0x11')]['message']);return _0x5174dc(_0x37da87['error'][_0x6080('0x13')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x35aaa2,_0x6080('0xe'));_0x5174dc(_0x37da87[_0x6080('0x14')][_0x6080('0x13')]);}})[_0x6080('0x15')](function(_0x2ee1b2){logger[_0x6080('0x11')](_0x6080('0xd'),_0x35aaa2,_0x2ee1b2);_0x474769(_0x2ee1b2);});});}exports['UpdateFaxApplication']=function(_0x42f2d7){var _0x438afa=this;return new Promise(function(_0x4ee0dc,_0x27336b){return db[_0x6080('0x16')][_0x6080('0x17')](_0x42f2d7[_0x6080('0x18')],{'raw':_0x42f2d7[_0x6080('0x19')]?_0x42f2d7[_0x6080('0x19')][_0x6080('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42f2d7[_0x6080('0x19')]?_0x42f2d7[_0x6080('0x19')]['where']||null:null,'attributes':_0x42f2d7['options']?_0x42f2d7['options'][_0x6080('0x1b')]||null:null,'limit':_0x42f2d7[_0x6080('0x19')]?_0x42f2d7['options']['limit']||null:null})[_0x6080('0xb')](function(_0x50b654){logger[_0x6080('0xc')](_0x6080('0x1c'),_0x42f2d7);logger[_0x6080('0xf')]('UpdateFaxApplication',_0x42f2d7,JSON[_0x6080('0x10')](_0x50b654));_0x4ee0dc(_0x50b654);})[_0x6080('0x15')](function(_0x5f45be){logger['error']('UpdateFaxApplication',_0x5f45be['message'],_0x42f2d7);_0x27336b(_0x438afa[_0x6080('0x11')](0x1f4,_0x5f45be[_0x6080('0x13')]));});});}; \ No newline at end of file +var _0x212a=['result','catch','FaxApplication','body','options','raw','where','attributes','limit','then','UpdateFaxApplication','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x212a,0x142));var _0xa212=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x212a[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa212('0x0'));var util=require(_0xa212('0x1'));var moment=require(_0xa212('0x2'));var BPromise=require('bluebird');var rs=require(_0xa212('0x3'));var fs=require('fs');var Redis=require(_0xa212('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa212('0x5'));var logger=require(_0xa212('0x6'))(_0xa212('0x7'));var config=require(_0xa212('0x8'));var jayson=require(_0xa212('0x9'));var client=jayson[_0xa212('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x451e0b,_0x5139e2,_0x2a1f61){return new BPromise(function(_0x442a80,_0x9d4ae0){return client[_0xa212('0xb')](_0x451e0b,_0x2a1f61)['then'](function(_0x44c4d8){logger[_0xa212('0xc')](_0xa212('0xd'),_0x5139e2,_0xa212('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5139e2,'request\x20sent',JSON[_0xa212('0xf')](_0x44c4d8));if(_0x44c4d8[_0xa212('0x10')]){if(_0x44c4d8[_0xa212('0x10')][_0xa212('0x11')]===0x1f4){logger[_0xa212('0x10')](_0xa212('0xd'),_0x5139e2,_0x44c4d8[_0xa212('0x10')][_0xa212('0x12')]);return _0x9d4ae0(_0x44c4d8[_0xa212('0x10')]['message']);}logger['error'](_0xa212('0xd'),_0x5139e2,_0x44c4d8[_0xa212('0x10')]['message']);return _0x442a80(_0x44c4d8[_0xa212('0x10')][_0xa212('0x12')]);}else{logger[_0xa212('0xc')](_0xa212('0xd'),_0x5139e2,_0xa212('0xe'));_0x442a80(_0x44c4d8[_0xa212('0x13')]['message']);}})[_0xa212('0x14')](function(_0x14d404){logger[_0xa212('0x10')]('FaxApplication,\x20%s,\x20%s',_0x5139e2,_0x14d404);_0x9d4ae0(_0x14d404);});});}exports['UpdateFaxApplication']=function(_0x41a61b){var _0xb6d781=this;return new Promise(function(_0x28f86b,_0x2dacfe){return db[_0xa212('0x15')]['update'](_0x41a61b[_0xa212('0x16')],{'raw':_0x41a61b[_0xa212('0x17')]?_0x41a61b[_0xa212('0x17')][_0xa212('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41a61b[_0xa212('0x17')]?_0x41a61b['options'][_0xa212('0x19')]||null:null,'attributes':_0x41a61b[_0xa212('0x17')]?_0x41a61b[_0xa212('0x17')][_0xa212('0x1a')]||null:null,'limit':_0x41a61b[_0xa212('0x17')]?_0x41a61b[_0xa212('0x17')][_0xa212('0x1b')]||null:null})[_0xa212('0x1c')](function(_0x2c8cdb){logger[_0xa212('0xc')](_0xa212('0x1d'),_0x41a61b);logger[_0xa212('0x1e')](_0xa212('0x1d'),_0x41a61b,JSON[_0xa212('0xf')](_0x2c8cdb));_0x28f86b(_0x2c8cdb);})[_0xa212('0x14')](function(_0x2604a4){logger[_0xa212('0x10')](_0xa212('0x1d'),_0x2604a4[_0xa212('0x12')],_0x41a61b);_0x2dacfe(_0xb6d781[_0xa212('0x10')](0x1f4,_0x2604a4[_0xa212('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index bd62eec..473857d 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 _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x275427,_0x200c6e){var _0x1ac1f9=function(_0x269e2c){while(--_0x269e2c){_0x275427['push'](_0x275427['shift']());}};_0x1ac1f9(++_0x200c6e);}(_0x34b7,0x196));var _0x734b=function(_0x2ea8fe,_0x13a71f){_0x2ea8fe=_0x2ea8fe-0x0;var _0x138e9f=_0x34b7[_0x2ea8fe];return _0x138e9f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file +var _0x087b=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x18240b,_0x2d7195){var _0x45f076=function(_0x4d3060){while(--_0x4d3060){_0x18240b['push'](_0x18240b['shift']());}};_0x45f076(++_0x2d7195);}(_0x087b,0x11a));var _0xb087=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x087b[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0xd')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0xf')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x10')]);router[_0xb087('0x11')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);module[_0xb087('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4c2c91b..6b8e48f 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 _0x8e3f=['STRING','DATE','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8e3f[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'closed':{'type':Sequelize[_0xf8e3('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf8e3('0x3')]},'secondDisposition':{'type':Sequelize[_0xf8e3('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf8e3('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf8e3('0x4')]},'fax':{'type':Sequelize[_0xf8e3('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf8e3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf8e3('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf8e3('0x6')]('in',_0xf8e3('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfcbb=['STRING','DATE','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x41fa1d,_0x335eee){var _0x473042=function(_0x362a5f){while(--_0x362a5f){_0x41fa1d['push'](_0x41fa1d['shift']());}};_0x473042(++_0x335eee);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x26d3e6,_0x22db29){_0x26d3e6=_0x26d3e6-0x0;var _0x1a1ee1=_0xfcbb[_0x26d3e6];return _0x1a1ee1;};'use strict';var Sequelize=require(_0xbfcb('0x0'));module[_0xbfcb('0x1')]={'closed':{'type':Sequelize[_0xbfcb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbfcb('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbfcb('0x3')]},'note':{'type':Sequelize[_0xbfcb('0x3')]},'read1stAt':{'type':Sequelize[_0xbfcb('0x4')]},'fax':{'type':Sequelize[_0xbfcb('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbfcb('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xbfcb('0x5')]('in',_0xbfcb('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xbfcb('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index b096558..3083f9e 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 _0x8c44=['util','path','lodash','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','destroy','stack','name','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','query','user','catch','model','keys','filters','attributes','intersection','fields','includeAll','merge','options','find','create','update','body','params','describe','addMessage','FaxMessage','ids','hasOwnProperty','nolimit','sort','pick','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','setTags','omit','Tag','color','emit','removeTags','download','toString','join','root','server','tmp','files','push','Attachment','Messages','createdAt','get','mkdirSync','length','createReadStream','createWriteStream','basename','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird'];(function(_0x1e8970,_0x428496){var _0x274ea4=function(_0x3f0c02){while(--_0x3f0c02){_0x1e8970['push'](_0x1e8970['shift']());}};_0x274ea4(++_0x428496);}(_0x8c44,0x128));var _0x48c4=function(_0x5404e9,_0x132866){_0x5404e9=_0x5404e9-0x0;var _0x2d7c75=_0x8c44[_0x5404e9];return _0x2d7c75;};'use strict';var rimraf=require(_0x48c4('0x0'));var zipdir=require(_0x48c4('0x1'));var moment=require(_0x48c4('0x2'));var BPromise=require(_0x48c4('0x3'));var util=require(_0x48c4('0x4'));var path=require(_0x48c4('0x5'));var fs=require('fs');var _=require(_0x48c4('0x6'));var Redis=require(_0x48c4('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x48c4('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x48c4('0x9'));var db=require('../../mysqldb')['db'];config[_0x48c4('0xa')]=_[_0x48c4('0xb')](config[_0x48c4('0xa')],{'host':_0x48c4('0xc'),'port':0x18eb});var socket=require(_0x48c4('0xd'))(new Redis(config[_0x48c4('0xa')]));require(_0x48c4('0xe'))[_0x48c4('0xf')](socket);function respondWithStatusCode(_0x15270c,_0x3eeb40){_0x3eeb40=_0x3eeb40||0xcc;return function(_0x3db0a9){if(_0x3db0a9){return _0x15270c[_0x48c4('0x10')](_0x3eeb40);}return _0x15270c[_0x48c4('0x11')](_0x3eeb40)[_0x48c4('0x12')]();};}function respondWithResult(_0x1b0b8f,_0x413431){_0x413431=_0x413431||0xc8;return function(_0xfabdb9){if(_0xfabdb9){return _0x1b0b8f[_0x48c4('0x11')](_0x413431)[_0x48c4('0x13')](_0xfabdb9);}};}function respondWithFilteredResult(_0x4a0fee,_0x615fd4){return function(_0x45ad9d){if(_0x45ad9d){var _0x52b7f2=typeof _0x615fd4['offset']===_0x48c4('0x14')&&typeof _0x615fd4[_0x48c4('0x15')]==='undefined';var _0x5cfc48=_0x45ad9d[_0x48c4('0x16')];var _0x354673=_0x52b7f2?0x0:_0x615fd4[_0x48c4('0x17')];var _0xe0f67f=_0x52b7f2?_0x45ad9d[_0x48c4('0x16')]:_0x615fd4[_0x48c4('0x17')]+_0x615fd4['limit'];var _0x395f48;if(_0xe0f67f>=_0x5cfc48){_0xe0f67f=_0x5cfc48;_0x395f48=0xc8;}else{_0x395f48=0xce;}_0x4a0fee[_0x48c4('0x11')](_0x395f48);return _0x4a0fee[_0x48c4('0x18')](_0x48c4('0x19'),_0x354673+'-'+_0xe0f67f+'/'+_0x5cfc48)[_0x48c4('0x13')](_0x45ad9d);}return null;};}function saveUpdates(_0x4ce6c4){return function(_0x33b0a2){if(_0x33b0a2){return _0x33b0a2['update'](_0x4ce6c4)[_0x48c4('0x1a')](function(_0x3f2eb5){return _0x3f2eb5;});}return null;};}function removeEntity(_0x5e74e8){return function(_0x47a90c){if(_0x47a90c){return _0x47a90c[_0x48c4('0x1b')]()[_0x48c4('0x1a')](function(){_0x5e74e8[_0x48c4('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ac733){return function(_0x477337){if(!_0x477337){_0x1ac733[_0x48c4('0x10')](0x194);}return _0x477337;};}function handleError(_0xf20cde,_0x47e712){_0x47e712=_0x47e712||0x1f4;return function(_0x24eb20){logger['error'](_0x24eb20[_0x48c4('0x1c')]);if(_0x24eb20[_0x48c4('0x1d')]){delete _0x24eb20[_0x48c4('0x1d')];}_0xf20cde[_0x48c4('0x11')](_0x47e712)['send'](_0x24eb20);};}exports[_0x48c4('0x1e')]=function(_0xd35e99,_0x2b3cb4){var _0xa89c37={};var _0x53fe1f=_[_0x48c4('0x1f')](db[_0x48c4('0x20')][_0x48c4('0x21')],function(_0x4390d8){return{'name':_0x4390d8[_0x48c4('0x22')],'type':_0x4390d8[_0x48c4('0x23')][_0x48c4('0x24')]};});_0xa89c37=qs[_0x48c4('0x25')](_0x53fe1f,_0xd35e99);return interaction['findAll'](_0x48c4('0x26'),_0xd35e99[_0x48c4('0x27')],_0xd35e99[_0x48c4('0x28')],_0xa89c37,_0x53fe1f)[_0x48c4('0x1a')](respondWithFilteredResult(_0x2b3cb4,_0xa89c37))[_0x48c4('0x29')](handleError(_0x2b3cb4,null));};exports['show']=function(_0x391110,_0x2b9fed){var _0x10d8f2={'raw':![],'where':{'id':_0x391110['params']['id']}},_0x440eb4={};_0x440eb4[_0x48c4('0x2a')]=_['keys'](db[_0x48c4('0x20')]['rawAttributes']);_0x440eb4[_0x48c4('0x27')]=_[_0x48c4('0x2b')](_0x391110[_0x48c4('0x27')]);_0x440eb4[_0x48c4('0x2c')]=_['intersection'](_0x440eb4[_0x48c4('0x2a')],_0x440eb4[_0x48c4('0x27')]);_0x10d8f2[_0x48c4('0x2d')]=_[_0x48c4('0x2e')](_0x440eb4[_0x48c4('0x2a')],qs[_0x48c4('0x2f')](_0x391110[_0x48c4('0x27')][_0x48c4('0x2f')]));_0x10d8f2[_0x48c4('0x2d')]=_0x10d8f2[_0x48c4('0x2d')]['length']?_0x10d8f2[_0x48c4('0x2d')]:_0x440eb4[_0x48c4('0x2a')];if(_0x391110[_0x48c4('0x27')][_0x48c4('0x30')]){_0x10d8f2['include']=[{'all':!![]}];}_0x10d8f2=_[_0x48c4('0x31')]({},_0x10d8f2,_0x391110[_0x48c4('0x32')]);return db[_0x48c4('0x20')][_0x48c4('0x33')](_0x10d8f2)['then'](handleEntityNotFound(_0x2b9fed,null))[_0x48c4('0x1a')](respondWithResult(_0x2b9fed,null))[_0x48c4('0x29')](handleError(_0x2b9fed,null));};exports[_0x48c4('0x34')]=function(_0x3d470f,_0x1029d7){return db[_0x48c4('0x20')][_0x48c4('0x34')](_0x3d470f['body'],{})[_0x48c4('0x1a')](respondWithResult(_0x1029d7,0xc9))[_0x48c4('0x29')](handleError(_0x1029d7,null));};exports[_0x48c4('0x35')]=function(_0x2fea30,_0x1636fc){if(_0x2fea30['body']['id']){delete _0x2fea30[_0x48c4('0x36')]['id'];}return db[_0x48c4('0x20')][_0x48c4('0x33')]({'where':{'id':_0x2fea30[_0x48c4('0x37')]['id']}})[_0x48c4('0x1a')](handleEntityNotFound(_0x1636fc,null))[_0x48c4('0x1a')](saveUpdates(_0x2fea30['body'],null))['then'](respondWithResult(_0x1636fc,null))[_0x48c4('0x29')](handleError(_0x1636fc,null));};exports[_0x48c4('0x1b')]=function(_0x29aa22,_0x15b77f){return db[_0x48c4('0x20')][_0x48c4('0x33')]({'where':{'id':_0x29aa22[_0x48c4('0x37')]['id']}})['then'](handleEntityNotFound(_0x15b77f,null))[_0x48c4('0x1a')](removeEntity(_0x15b77f,null))[_0x48c4('0x29')](handleError(_0x15b77f,null));};exports['describe']=function(_0x333169,_0x51ce45){return db[_0x48c4('0x20')][_0x48c4('0x38')]()[_0x48c4('0x1a')](respondWithResult(_0x51ce45,null))[_0x48c4('0x29')](handleError(_0x51ce45,null));};exports[_0x48c4('0x39')]=function(_0x514558,_0x3efb2b){return db[_0x48c4('0x3a')][_0x48c4('0x33')]({'where':{'id':_0x514558[_0x48c4('0x37')]['id']}})[_0x48c4('0x1a')](handleEntityNotFound(_0x3efb2b,null))[_0x48c4('0x1a')](function(_0x1b7c79){if(_0x1b7c79){return _0x1b7c79['addMessage'](_0x514558[_0x48c4('0x36')][_0x48c4('0x3b')],_['omit'](_0x514558[_0x48c4('0x36')],[_0x48c4('0x3b'),'id'])||{});}})[_0x48c4('0x1a')](respondWithResult(_0x3efb2b,null))[_0x48c4('0x29')](handleError(_0x3efb2b,null));};exports['getMessages']=function(_0x1fee33,_0x1c6e7e){var _0x2138d1={'raw':![],'where':{}};var _0xa3960a={};var _0xe64039={'count':0x0,'rows':[]};return db[_0x48c4('0x20')]['findOne']({'where':{'id':_0x1fee33[_0x48c4('0x37')]['id']}})[_0x48c4('0x1a')](handleEntityNotFound(_0x1c6e7e,null))['then'](function(_0x2a4ebc){if(_0x2a4ebc){_0xa3960a[_0x48c4('0x2a')]=_[_0x48c4('0x2b')](db[_0x48c4('0x3a')][_0x48c4('0x21')]);_0xa3960a['query']=_[_0x48c4('0x2b')](_0x1fee33[_0x48c4('0x27')]);_0xa3960a[_0x48c4('0x2c')]=_[_0x48c4('0x2e')](_0xa3960a['model'],_0xa3960a[_0x48c4('0x27')]);_0x2138d1[_0x48c4('0x2d')]=_['intersection'](_0xa3960a[_0x48c4('0x2a')],qs[_0x48c4('0x2f')](_0x1fee33[_0x48c4('0x27')][_0x48c4('0x2f')]));_0x2138d1[_0x48c4('0x2d')]=_0x2138d1[_0x48c4('0x2d')]['length']?_0x2138d1['attributes']:_0xa3960a[_0x48c4('0x2a')];if(!_0x1fee33[_0x48c4('0x27')][_0x48c4('0x3c')](_0x48c4('0x3d'))){_0x2138d1[_0x48c4('0x15')]=qs[_0x48c4('0x15')](_0x1fee33[_0x48c4('0x27')][_0x48c4('0x15')]);_0x2138d1[_0x48c4('0x17')]=qs['offset'](_0x1fee33['query']['offset']);}_0x2138d1['order']=qs[_0x48c4('0x3e')](_0x1fee33['query'][_0x48c4('0x3e')]);_0x2138d1['where']=qs[_0x48c4('0x2c')](_[_0x48c4('0x3f')](_0x1fee33['query'],_0xa3960a[_0x48c4('0x2c')]));_0x2138d1[_0x48c4('0x40')][_0x48c4('0x41')]=_0x2a4ebc['id'];if(_0x1fee33[_0x48c4('0x27')][_0x48c4('0x42')]){_0x2138d1['where']=_[_0x48c4('0x31')](_0x2138d1[_0x48c4('0x40')],{'$or':_[_0x48c4('0x1f')](_0x2138d1['attributes'],function(_0x3c7262){var _0x416788={};_0x416788[_0x3c7262]={'$like':'%'+_0x1fee33[_0x48c4('0x27')]['filter']+'%'};return _0x416788;})});}if(_0x1fee33[_0x48c4('0x27')][_0x48c4('0x43')]){var _0x21e385=_0x1fee33[_0x48c4('0x27')][_0x48c4('0x43')][_0x48c4('0x44')](',');var _0x227f95={};_0x227f95[_0x21e385[0x0]]={'$gte':moment(_0x21e385[0x1])[_0x48c4('0x45')](_0x48c4('0x46'))};_0x2138d1[_0x48c4('0x40')]=_[_0x48c4('0x31')](_0x2138d1[_0x48c4('0x40')],_0x227f95);}_0x2138d1=_[_0x48c4('0x31')]({},_0x2138d1,_0x1fee33[_0x48c4('0x32')]);return db['FaxMessage'][_0x48c4('0x16')]({'where':_0x2138d1['where']})[_0x48c4('0x1a')](function(_0x309b99){_0xe64039[_0x48c4('0x16')]=_0x309b99;if(_0x1fee33[_0x48c4('0x27')][_0x48c4('0x30')]){_0x2138d1[_0x48c4('0x47')]=[{'all':!![]}];}return db[_0x48c4('0x3a')][_0x48c4('0x48')](_0x2138d1);})['then'](function(_0x2a7522){_0xe64039[_0x48c4('0x49')]=_0x2a7522;return _0xe64039;});}})[_0x48c4('0x1a')](respondWithFilteredResult(_0x1c6e7e,_0x2138d1))[_0x48c4('0x29')](handleError(_0x1c6e7e,null));};exports['addTags']=function(_0x168926,_0x47775d){return db[_0x48c4('0x20')]['find']({'where':{'id':_0x168926['params']['id']}})[_0x48c4('0x1a')](handleEntityNotFound(_0x47775d,null))['then'](function(_0x5456fb){if(_0x5456fb){return _0x5456fb[_0x48c4('0x4a')](_0x168926[_0x48c4('0x36')][_0x48c4('0x3b')],_[_0x48c4('0x4b')](_0x168926[_0x48c4('0x36')],[_0x48c4('0x3b'),'id'])||{})['spread'](function(){return db[_0x48c4('0x4c')]['findAll']({'attributes':['id','name',_0x48c4('0x4d')],'where':{'id':_0x168926[_0x48c4('0x36')][_0x48c4('0x3b')]}});})[_0x48c4('0x1a')](function(_0x55d665){socket[_0x48c4('0x4e')]('faxInteractionTags:save',{'id':Number(_0x168926[_0x48c4('0x37')]['id']),'tags':_0x55d665||[]});return{'id':Number(_0x168926['params']['id']),'tags':_0x55d665||[]};});}})[_0x48c4('0x1a')](respondWithResult(_0x47775d,null))[_0x48c4('0x29')](handleError(_0x47775d,null));};exports[_0x48c4('0x4f')]=function(_0x46bf22,_0x47a85d){return db[_0x48c4('0x20')][_0x48c4('0x33')]({'where':{'id':_0x46bf22[_0x48c4('0x37')]['id']}})[_0x48c4('0x1a')](handleEntityNotFound(_0x47a85d,null))[_0x48c4('0x1a')](function(_0x229611){if(_0x229611){return _0x229611[_0x48c4('0x4f')](_0x46bf22[_0x48c4('0x27')][_0x48c4('0x3b')]);}})[_0x48c4('0x1a')](respondWithStatusCode(_0x47a85d,null))[_0x48c4('0x29')](handleError(_0x47a85d,null));};exports[_0x48c4('0x50')]=function(_0x1d1670,_0x176a9f){var _0x16a343=moment()['unix']()[_0x48c4('0x51')]();var _0x4b3922=path[_0x48c4('0x52')](config[_0x48c4('0x53')],_0x48c4('0x54'),'files',_0x48c4('0x55'));var _0x23bf0f=path[_0x48c4('0x52')](config[_0x48c4('0x53')],_0x48c4('0x54'),_0x48c4('0x56'),'attachments');var _0x127017=path[_0x48c4('0x52')](_0x4b3922,_0x16a343);var _0x271d5a=util[_0x48c4('0x45')]('transcript-%d-%s.zip',_0x1d1670[_0x48c4('0x37')]['id'],_0x16a343);var _0x135c7e=path['join'](_0x4b3922,_0x271d5a);var _0x4b0b93=[];_0x4b0b93[_0x48c4('0x57')]({'model':db[_0x48c4('0x58')],'as':'Attachment','raw':!![]});var _0x414882=[{'model':db[_0x48c4('0x3a')],'as':_0x48c4('0x59'),'attributes':['id',_0x48c4('0x36'),_0x48c4('0x5a')],'include':_0x4b0b93}];return db['FaxInteraction'][_0x48c4('0x33')]({'where':{'id':_0x1d1670['params']['id']},'include':_0x414882})['then'](handleEntityNotFound(_0x176a9f,null))[_0x48c4('0x1a')](function(_0x273ef2){if(_0x273ef2&&_0x273ef2[_0x48c4('0x59')]){var _0x213d9d=_0x273ef2[_0x48c4('0x5b')]({'plain':!![]});fs[_0x48c4('0x5c')](_0x127017);for(var _0x6c232b=0x0;_0x6c232b<_0x213d9d[_0x48c4('0x59')][_0x48c4('0x5d')];_0x6c232b++){var _0xed92cf=_0x213d9d['Messages'][_0x6c232b]['Attachment'];if(_0xed92cf){var _0x35d200=path[_0x48c4('0x52')](_0x23bf0f,_0xed92cf['basename']);if(fs['existsSync'](_0x35d200)){fs[_0x48c4('0x5e')](_0x35d200)['pipe'](fs[_0x48c4('0x5f')](path[_0x48c4('0x52')](_0x127017,_0xed92cf[_0x48c4('0x60')])));}}}return BPromise['resolve']()[_0x48c4('0x1a')](function(){return new BPromise(function(_0x349fdc,_0x5540a5){zipdir(_0x127017,{'saveTo':_0x135c7e},function(_0x44c9d4,_0x331828){if(_0x44c9d4)return _0x5540a5(_0x44c9d4);return _0x349fdc(_0x331828);});})[_0x48c4('0x1a')](function(){return new BPromise(function(_0x35f29c,_0x1ff09d){rimraf(_0x127017,function(_0x1ddfab){if(_0x1ddfab)_0x1ff09d(_0x1ddfab);return _0x35f29c();});});})[_0x48c4('0x1a')](function(){return _0x176a9f[_0x48c4('0x50')](_0x135c7e,_0x271d5a,function(_0x32f2a7){if(_0x32f2a7){console[_0x48c4('0x61')](_0x48c4('0x62'),_0x32f2a7);}else{fs[_0x48c4('0x63')](_0x135c7e);}});});});}else{return _0x176a9f['sendStatus'](0xc8);}})[_0x48c4('0x29')](handleError(_0x176a9f,null));}; \ No newline at end of file +var _0x97b3=['query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','update','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where','FaxInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','resolve','log','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','limit','count','then','destroy','sendStatus','error','stack','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll'];(function(_0x368726,_0x4a651d){var _0x3fc2e7=function(_0x484a0b){while(--_0x484a0b){_0x368726['push'](_0x368726['shift']());}};_0x3fc2e7(++_0x4a651d);}(_0x97b3,0x1e7));var _0x397b=function(_0xe2b79a,_0x261908){_0xe2b79a=_0xe2b79a-0x0;var _0x528c94=_0x97b3[_0xe2b79a];return _0x528c94;};'use strict';var rimraf=require(_0x397b('0x0'));var zipdir=require('zip-dir');var moment=require(_0x397b('0x1'));var BPromise=require(_0x397b('0x2'));var util=require(_0x397b('0x3'));var path=require(_0x397b('0x4'));var fs=require('fs');var _=require(_0x397b('0x5'));var Redis=require(_0x397b('0x6'));var interaction=require(_0x397b('0x7'));var qs=require(_0x397b('0x8'));var logger=require(_0x397b('0x9'))(_0x397b('0xa'));var config=require(_0x397b('0xb'));var db=require(_0x397b('0xc'))['db'];config['redis']=_['defaults'](config[_0x397b('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x397b('0xe'))(new Redis(config[_0x397b('0xd')]));require(_0x397b('0xf'))[_0x397b('0x10')](socket);function respondWithStatusCode(_0x5463e7,_0x46bdb9){_0x46bdb9=_0x46bdb9||0xcc;return function(_0x380a1){if(_0x380a1){return _0x5463e7['sendStatus'](_0x46bdb9);}return _0x5463e7[_0x397b('0x11')](_0x46bdb9)[_0x397b('0x12')]();};}function respondWithResult(_0x4c5236,_0x4b0396){_0x4b0396=_0x4b0396||0xc8;return function(_0x3aa7db){if(_0x3aa7db){return _0x4c5236['status'](_0x4b0396)[_0x397b('0x13')](_0x3aa7db);}};}function respondWithFilteredResult(_0x47efdb,_0x4a7fae){return function(_0x44a434){if(_0x44a434){var _0x3aa629=typeof _0x4a7fae[_0x397b('0x14')]===_0x397b('0x15')&&typeof _0x4a7fae[_0x397b('0x16')]===_0x397b('0x15');var _0x4ca5fb=_0x44a434[_0x397b('0x17')];var _0x4fa57f=_0x3aa629?0x0:_0x4a7fae[_0x397b('0x14')];var _0x320685=_0x3aa629?_0x44a434[_0x397b('0x17')]:_0x4a7fae['offset']+_0x4a7fae[_0x397b('0x16')];var _0x5797e7;if(_0x320685>=_0x4ca5fb){_0x320685=_0x4ca5fb;_0x5797e7=0xc8;}else{_0x5797e7=0xce;}_0x47efdb['status'](_0x5797e7);return _0x47efdb['set']('Content-Range',_0x4fa57f+'-'+_0x320685+'/'+_0x4ca5fb)[_0x397b('0x13')](_0x44a434);}return null;};}function saveUpdates(_0x21f7e5){return function(_0x163514){if(_0x163514){return _0x163514['update'](_0x21f7e5)[_0x397b('0x18')](function(_0x1b9b60){return _0x1b9b60;});}return null;};}function removeEntity(_0xda40f8){return function(_0x20d392){if(_0x20d392){return _0x20d392[_0x397b('0x19')]()[_0x397b('0x18')](function(){_0xda40f8['status'](0xcc)[_0x397b('0x12')]();});}};}function handleEntityNotFound(_0x1c3c74){return function(_0x50bd86){if(!_0x50bd86){_0x1c3c74[_0x397b('0x1a')](0x194);}return _0x50bd86;};}function handleError(_0x2e05bf,_0x5b7ca4){_0x5b7ca4=_0x5b7ca4||0x1f4;return function(_0x4d2186){logger[_0x397b('0x1b')](_0x4d2186[_0x397b('0x1c')]);if(_0x4d2186['name']){delete _0x4d2186['name'];}_0x2e05bf[_0x397b('0x11')](_0x5b7ca4)['send'](_0x4d2186);};}exports[_0x397b('0x1d')]=function(_0x23cfd9,_0x26a260){var _0x59ae94={};var _0x4bfd41=_[_0x397b('0x1e')](db[_0x397b('0x1f')][_0x397b('0x20')],function(_0x416e8c){return{'name':_0x416e8c[_0x397b('0x21')],'type':_0x416e8c[_0x397b('0x22')][_0x397b('0x23')]};});_0x59ae94=qs[_0x397b('0x24')](_0x4bfd41,_0x23cfd9);return interaction[_0x397b('0x25')]('fax',_0x23cfd9[_0x397b('0x26')],_0x23cfd9[_0x397b('0x27')],_0x59ae94,_0x4bfd41)[_0x397b('0x18')](respondWithFilteredResult(_0x26a260,_0x59ae94))['catch'](handleError(_0x26a260,null));};exports[_0x397b('0x28')]=function(_0x195c2b,_0x5d85f9){var _0x2d2e75={'raw':![],'where':{'id':_0x195c2b[_0x397b('0x29')]['id']}},_0x4598c7={};_0x4598c7[_0x397b('0x2a')]=_['keys'](db[_0x397b('0x1f')][_0x397b('0x20')]);_0x4598c7[_0x397b('0x26')]=_[_0x397b('0x2b')](_0x195c2b[_0x397b('0x26')]);_0x4598c7[_0x397b('0x2c')]=_[_0x397b('0x2d')](_0x4598c7[_0x397b('0x2a')],_0x4598c7['query']);_0x2d2e75[_0x397b('0x2e')]=_[_0x397b('0x2d')](_0x4598c7[_0x397b('0x2a')],qs[_0x397b('0x2f')](_0x195c2b['query'][_0x397b('0x2f')]));_0x2d2e75[_0x397b('0x2e')]=_0x2d2e75[_0x397b('0x2e')][_0x397b('0x30')]?_0x2d2e75[_0x397b('0x2e')]:_0x4598c7[_0x397b('0x2a')];if(_0x195c2b[_0x397b('0x26')][_0x397b('0x31')]){_0x2d2e75[_0x397b('0x32')]=[{'all':!![]}];}_0x2d2e75=_[_0x397b('0x33')]({},_0x2d2e75,_0x195c2b[_0x397b('0x34')]);return db['FaxInteraction'][_0x397b('0x35')](_0x2d2e75)['then'](handleEntityNotFound(_0x5d85f9,null))[_0x397b('0x18')](respondWithResult(_0x5d85f9,null))[_0x397b('0x36')](handleError(_0x5d85f9,null));};exports[_0x397b('0x37')]=function(_0x5282db,_0x1966f0){return db[_0x397b('0x1f')][_0x397b('0x37')](_0x5282db[_0x397b('0x38')],{})[_0x397b('0x18')](respondWithResult(_0x1966f0,0xc9))[_0x397b('0x36')](handleError(_0x1966f0,null));};exports[_0x397b('0x39')]=function(_0x173a25,_0x1df4a3){if(_0x173a25['body']['id']){delete _0x173a25[_0x397b('0x38')]['id'];}return db['FaxInteraction'][_0x397b('0x35')]({'where':{'id':_0x173a25[_0x397b('0x29')]['id']}})[_0x397b('0x18')](handleEntityNotFound(_0x1df4a3,null))[_0x397b('0x18')](saveUpdates(_0x173a25[_0x397b('0x38')],null))[_0x397b('0x18')](respondWithResult(_0x1df4a3,null))[_0x397b('0x36')](handleError(_0x1df4a3,null));};exports[_0x397b('0x19')]=function(_0x1aa575,_0x2907ec){return db[_0x397b('0x1f')]['find']({'where':{'id':_0x1aa575[_0x397b('0x29')]['id']}})[_0x397b('0x18')](handleEntityNotFound(_0x2907ec,null))[_0x397b('0x18')](removeEntity(_0x2907ec,null))[_0x397b('0x36')](handleError(_0x2907ec,null));};exports['describe']=function(_0x227b1c,_0x3780b7){return db[_0x397b('0x1f')][_0x397b('0x3a')]()['then'](respondWithResult(_0x3780b7,null))[_0x397b('0x36')](handleError(_0x3780b7,null));};exports[_0x397b('0x3b')]=function(_0x412409,_0x1f9935){return db[_0x397b('0x3c')][_0x397b('0x35')]({'where':{'id':_0x412409[_0x397b('0x29')]['id']}})['then'](handleEntityNotFound(_0x1f9935,null))[_0x397b('0x18')](function(_0x3203f4){if(_0x3203f4){return _0x3203f4[_0x397b('0x3b')](_0x412409[_0x397b('0x38')][_0x397b('0x3d')],_[_0x397b('0x3e')](_0x412409[_0x397b('0x38')],['ids','id'])||{});}})[_0x397b('0x18')](respondWithResult(_0x1f9935,null))['catch'](handleError(_0x1f9935,null));};exports[_0x397b('0x3f')]=function(_0x1c0222,_0x2bce99){var _0x1999aa={'raw':![],'where':{}};var _0x8db0fb={};var _0x2d9b6f={'count':0x0,'rows':[]};return db[_0x397b('0x1f')][_0x397b('0x40')]({'where':{'id':_0x1c0222[_0x397b('0x29')]['id']}})[_0x397b('0x18')](handleEntityNotFound(_0x2bce99,null))[_0x397b('0x18')](function(_0x501163){if(_0x501163){_0x8db0fb[_0x397b('0x2a')]=_['keys'](db[_0x397b('0x3c')][_0x397b('0x20')]);_0x8db0fb[_0x397b('0x26')]=_['keys'](_0x1c0222[_0x397b('0x26')]);_0x8db0fb[_0x397b('0x2c')]=_[_0x397b('0x2d')](_0x8db0fb['model'],_0x8db0fb['query']);_0x1999aa[_0x397b('0x2e')]=_['intersection'](_0x8db0fb[_0x397b('0x2a')],qs['fields'](_0x1c0222['query'][_0x397b('0x2f')]));_0x1999aa['attributes']=_0x1999aa[_0x397b('0x2e')][_0x397b('0x30')]?_0x1999aa['attributes']:_0x8db0fb[_0x397b('0x2a')];if(!_0x1c0222['query'][_0x397b('0x41')]('nolimit')){_0x1999aa[_0x397b('0x16')]=qs[_0x397b('0x16')](_0x1c0222[_0x397b('0x26')][_0x397b('0x16')]);_0x1999aa[_0x397b('0x14')]=qs['offset'](_0x1c0222[_0x397b('0x26')][_0x397b('0x14')]);}_0x1999aa[_0x397b('0x42')]=qs[_0x397b('0x43')](_0x1c0222[_0x397b('0x26')][_0x397b('0x43')]);_0x1999aa['where']=qs[_0x397b('0x2c')](_['pick'](_0x1c0222['query'],_0x8db0fb[_0x397b('0x2c')]));_0x1999aa[_0x397b('0x44')][_0x397b('0x45')]=_0x501163['id'];if(_0x1c0222[_0x397b('0x26')]['filter']){_0x1999aa[_0x397b('0x44')]=_[_0x397b('0x33')](_0x1999aa[_0x397b('0x44')],{'$or':_[_0x397b('0x1e')](_0x1999aa[_0x397b('0x2e')],function(_0x356a5a){var _0x2a2dfd={};_0x2a2dfd[_0x356a5a]={'$like':'%'+_0x1c0222['query']['filter']+'%'};return _0x2a2dfd;})});}if(_0x1c0222['query'][_0x397b('0x46')]){var _0x391cab=_0x1c0222[_0x397b('0x26')]['$gte'][_0x397b('0x47')](',');var _0x3ac8d1={};_0x3ac8d1[_0x391cab[0x0]]={'$gte':moment(_0x391cab[0x1])['format'](_0x397b('0x48'))};_0x1999aa[_0x397b('0x44')]=_[_0x397b('0x33')](_0x1999aa[_0x397b('0x44')],_0x3ac8d1);}_0x1999aa=_[_0x397b('0x33')]({},_0x1999aa,_0x1c0222[_0x397b('0x34')]);return db[_0x397b('0x3c')][_0x397b('0x17')]({'where':_0x1999aa['where']})['then'](function(_0xcbc29){_0x2d9b6f[_0x397b('0x17')]=_0xcbc29;if(_0x1c0222[_0x397b('0x26')][_0x397b('0x31')]){_0x1999aa['include']=[{'all':!![]}];}return db[_0x397b('0x3c')][_0x397b('0x25')](_0x1999aa);})[_0x397b('0x18')](function(_0x2288f5){_0x2d9b6f[_0x397b('0x49')]=_0x2288f5;return _0x2d9b6f;});}})[_0x397b('0x18')](respondWithFilteredResult(_0x2bce99,_0x1999aa))['catch'](handleError(_0x2bce99,null));};exports[_0x397b('0x4a')]=function(_0xc33ead,_0xf96b8f){return db['FaxInteraction']['find']({'where':{'id':_0xc33ead[_0x397b('0x29')]['id']}})['then'](handleEntityNotFound(_0xf96b8f,null))[_0x397b('0x18')](function(_0x2cc6ef){if(_0x2cc6ef){return _0x2cc6ef[_0x397b('0x4b')](_0xc33ead[_0x397b('0x38')][_0x397b('0x3d')],_[_0x397b('0x3e')](_0xc33ead[_0x397b('0x38')],[_0x397b('0x3d'),'id'])||{})['spread'](function(){return db[_0x397b('0x4c')]['findAll']({'attributes':['id','name',_0x397b('0x4d')],'where':{'id':_0xc33ead['body']['ids']}});})['then'](function(_0x466e5){socket[_0x397b('0x4e')](_0x397b('0x4f'),{'id':Number(_0xc33ead['params']['id']),'tags':_0x466e5||[]});return{'id':Number(_0xc33ead[_0x397b('0x29')]['id']),'tags':_0x466e5||[]};});}})[_0x397b('0x18')](respondWithResult(_0xf96b8f,null))[_0x397b('0x36')](handleError(_0xf96b8f,null));};exports[_0x397b('0x50')]=function(_0x18eed9,_0x217c6c){return db[_0x397b('0x1f')][_0x397b('0x35')]({'where':{'id':_0x18eed9[_0x397b('0x29')]['id']}})['then'](handleEntityNotFound(_0x217c6c,null))[_0x397b('0x18')](function(_0x4ab7a8){if(_0x4ab7a8){return _0x4ab7a8['removeTags'](_0x18eed9['query'][_0x397b('0x3d')]);}})[_0x397b('0x18')](respondWithStatusCode(_0x217c6c,null))['catch'](handleError(_0x217c6c,null));};exports[_0x397b('0x51')]=function(_0x5eb032,_0x244b0a){var _0x975c5b=moment()[_0x397b('0x52')]()[_0x397b('0x53')]();var _0x480d36=path[_0x397b('0x54')](config['root'],_0x397b('0x55'),_0x397b('0x56'),_0x397b('0x57'));var _0x4a7382=path[_0x397b('0x54')](config[_0x397b('0x58')],_0x397b('0x55'),'files',_0x397b('0x59'));var _0x46951f=path[_0x397b('0x54')](_0x480d36,_0x975c5b);var _0x37365d=util[_0x397b('0x5a')](_0x397b('0x5b'),_0x5eb032[_0x397b('0x29')]['id'],_0x975c5b);var _0x2c438b=path[_0x397b('0x54')](_0x480d36,_0x37365d);var _0x3503ff=[];_0x3503ff[_0x397b('0x5c')]({'model':db[_0x397b('0x5d')],'as':_0x397b('0x5d'),'raw':!![]});var _0x2a4acb=[{'model':db[_0x397b('0x3c')],'as':_0x397b('0x5e'),'attributes':['id','body','createdAt'],'include':_0x3503ff}];return db[_0x397b('0x1f')][_0x397b('0x35')]({'where':{'id':_0x5eb032[_0x397b('0x29')]['id']},'include':_0x2a4acb})[_0x397b('0x18')](handleEntityNotFound(_0x244b0a,null))[_0x397b('0x18')](function(_0x39a0b8){if(_0x39a0b8&&_0x39a0b8[_0x397b('0x5e')]){var _0x4601ba=_0x39a0b8[_0x397b('0x5f')]({'plain':!![]});fs[_0x397b('0x60')](_0x46951f);for(var _0x4389e5=0x0;_0x4389e5<_0x4601ba[_0x397b('0x5e')][_0x397b('0x30')];_0x4389e5++){var _0x2027c9=_0x4601ba[_0x397b('0x5e')][_0x4389e5][_0x397b('0x5d')];if(_0x2027c9){var _0x2e9f87=path[_0x397b('0x54')](_0x4a7382,_0x2027c9[_0x397b('0x61')]);if(fs[_0x397b('0x62')](_0x2e9f87)){fs[_0x397b('0x63')](_0x2e9f87)[_0x397b('0x64')](fs['createWriteStream'](path[_0x397b('0x54')](_0x46951f,_0x2027c9[_0x397b('0x61')])));}}}return BPromise[_0x397b('0x65')]()[_0x397b('0x18')](function(){return new BPromise(function(_0x5261e3,_0x2c1575){zipdir(_0x46951f,{'saveTo':_0x2c438b},function(_0x366df3,_0x4b4dc0){if(_0x366df3)return _0x2c1575(_0x366df3);return _0x5261e3(_0x4b4dc0);});})[_0x397b('0x18')](function(){return new BPromise(function(_0x125c4a,_0x2fab66){rimraf(_0x46951f,function(_0x44e149){if(_0x44e149)_0x2fab66(_0x44e149);return _0x125c4a();});});})[_0x397b('0x18')](function(){return _0x244b0a[_0x397b('0x51')](_0x2c438b,_0x37365d,function(_0x1ed9df){if(_0x1ed9df){console[_0x397b('0x66')](_0x397b('0x67'),_0x1ed9df);}else{fs[_0x397b('0x68')](_0x2c438b);}});});});}else{return _0x244b0a[_0x397b('0x1a')](0xc8);}})['catch'](handleError(_0x244b0a,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b015dd9..9bc1dbd 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 _0x7852=['map','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxInteraction','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x3f6022,_0x2d745f){var _0x2b5537=function(_0x442225){while(--_0x442225){_0x3f6022['push'](_0x3f6022['shift']());}};_0x2b5537(++_0x2d745f);}(_0x7852,0x137));var _0x2785=function(_0x572648,_0x4e2b16){_0x572648=_0x572648-0x0;var _0x3f1e61=_0x7852[_0x572648];return _0x3f1e61;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x2785('0x0'))['db'][_0x2785('0x1')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2785('0x2'),'afterUpdate':_0x2785('0x3'),'afterDestroy':_0x2785('0x4')};function emitEvent(_0x12abd0){return function(_0x5ab051,_0xe21cd0,_0x56efb3){_0x5ab051[_0x2785('0x5')]({'attributes':['id'],'raw':!![]})[_0x2785('0x6')](function(_0x53a3cf){_0x5ab051[_0x2785('0x7')](_0x2785('0x8'),_0x53a3cf[_0x2785('0x9')](function(_0x26be31){return{'id':_0x26be31['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x5ab051['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x35b29b){_0x5ab051['setDataValue'](_0x2785('0xa'),_0x35b29b[_0x2785('0xb')]);FaxInteractionEvents[_0x2785('0xc')](_0x12abd0+':'+_0x5ab051['id'],_0x5ab051);FaxInteractionEvents[_0x2785('0xc')](_0x12abd0,_0x5ab051);_0x56efb3(null);})[_0x2785('0xd')](_0x56efb3(null));};}for(var e in events){if(events[_0x2785('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x2785('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x3a44=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','map'];(function(_0x4fcdce,_0x345fed){var _0x29d7a1=function(_0x186f42){while(--_0x186f42){_0x4fcdce['push'](_0x4fcdce['shift']());}};_0x29d7a1(++_0x345fed);}(_0x3a44,0x1bd));var _0x43a4=function(_0x5249f0,_0x477229){_0x5249f0=_0x5249f0-0x0;var _0x59c1d7=_0x3a44[_0x5249f0];return _0x59c1d7;};'use strict';var EventEmitter=require(_0x43a4('0x0'));var FaxInteraction=require(_0x43a4('0x1'))['db'][_0x43a4('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x43a4('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x43a4('0x4')](0x0);var events={'afterCreate':_0x43a4('0x5'),'afterUpdate':_0x43a4('0x6'),'afterDestroy':'remove'};function emitEvent(_0x347054){return function(_0x369e54,_0x585377,_0x4e4225){_0x369e54[_0x43a4('0x7')]({'attributes':['id'],'raw':!![]})[_0x43a4('0x8')](function(_0x38aea1){_0x369e54[_0x43a4('0x9')]('Users',_0x38aea1[_0x43a4('0xa')](function(_0x35c607){return{'id':_0x35c607['id']};}));return FaxMessage[_0x43a4('0xb')]({'where':{'FaxInteractionId':_0x369e54['id'],'direction':'in','read':![]},'raw':!![]});})[_0x43a4('0x8')](function(_0x1d95f9){_0x369e54[_0x43a4('0x9')](_0x43a4('0xc'),_0x1d95f9[_0x43a4('0xd')]);FaxInteractionEvents[_0x43a4('0xe')](_0x347054+':'+_0x369e54['id'],_0x369e54);FaxInteractionEvents[_0x43a4('0xe')](_0x347054,_0x369e54);_0x4e4225(null);})[_0x43a4('0xf')](_0x4e4225(null));};}for(var e in events){if(events[_0x43a4('0x10')](e)){var event=events[e];FaxInteraction[_0x43a4('0x11')](e,emitEvent(event));}}module[_0x43a4('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 88ccb2a..1889094 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 _0xf273=['api','moment','request-promise','rimraf','./faxInteraction.attributes','exports','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x108c12,_0x457ebf){var _0x322347=function(_0x3050f5){while(--_0x3050f5){_0x108c12['push'](_0x108c12['shift']());}};_0x322347(++_0x457ebf);}(_0xf273,0xce));var _0x3f27=function(_0x230f34,_0x184d05){_0x230f34=_0x230f34-0x0;var _0x307db5=_0xf273[_0x230f34];return _0x307db5;};'use strict';var _=require('lodash');var util=require(_0x3f27('0x0'));var logger=require(_0x3f27('0x1'))(_0x3f27('0x2'));var moment=require(_0x3f27('0x3'));var BPromise=require('bluebird');var rp=require(_0x3f27('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f27('0x5'));var config=require('../../config/environment');var attributes=require(_0x3f27('0x6'));module[_0x3f27('0x7')]=function(_0x35e71f,_0x2f09b7){return _0x35e71f['define']('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a9c3c,_0x5741cf,_0x4e5095){if(_0x5a9c3c[_0x3f27('0x8')](_0x3f27('0x9'))){_0x5a9c3c[_0x3f27('0xa')]=moment()[_0x3f27('0xb')](_0x3f27('0xc'));}_0x4e5095(null,_0x5a9c3c);}}});}; \ No newline at end of file +var _0xff06=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x26c781,_0x79b768){var _0x58ea20=function(_0x471a68){while(--_0x471a68){_0x26c781['push'](_0x26c781['shift']());}};_0x58ea20(++_0x79b768);}(_0xff06,0x1ae));var _0x6ff0=function(_0x2975f1,_0x453f49){_0x2975f1=_0x2975f1-0x0;var _0x2c08d5=_0xff06[_0x2975f1];return _0x2c08d5;};'use strict';var _=require(_0x6ff0('0x0'));var util=require(_0x6ff0('0x1'));var logger=require(_0x6ff0('0x2'))(_0x6ff0('0x3'));var moment=require(_0x6ff0('0x4'));var BPromise=require(_0x6ff0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ff0('0x6'));var rimraf=require(_0x6ff0('0x7'));var config=require(_0x6ff0('0x8'));var attributes=require(_0x6ff0('0x9'));module[_0x6ff0('0xa')]=function(_0x422a8d,_0x21ac90){return _0x422a8d[_0x6ff0('0xb')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3db9bc,_0x560398,_0xbf3b47){if(_0x3db9bc['changed'](_0x6ff0('0xc'))){_0x3db9bc[_0x6ff0('0xd')]=moment()[_0x6ff0('0xe')](_0x6ff0('0xf'));}_0xbf3b47(null,_0x3db9bc);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6feb259..533fe22 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 _0x71bb=['redis','socket.io-emitter','./faxInteraction.socket','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxInteraction,\x20%s,\x20%s','result','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','then','catch','AddTagsToFaxInteraction','find','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','http'];(function(_0x175e2a,_0x864265){var _0x22621c=function(_0x45b01e){while(--_0x45b01e){_0x175e2a['push'](_0x175e2a['shift']());}};_0x22621c(++_0x864265);}(_0x71bb,0x169));var _0xb71b=function(_0x2c763a,_0xabb693){_0x2c763a=_0x2c763a-0x0;var _0x2dff3e=_0x71bb[_0x2c763a];return _0x2dff3e;};'use strict';var _=require(_0xb71b('0x0'));var util=require(_0xb71b('0x1'));var moment=require(_0xb71b('0x2'));var BPromise=require(_0xb71b('0x3'));var rs=require(_0xb71b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb71b('0x5'))['db'];var utils=require(_0xb71b('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb71b('0x7'));var client=jayson['client'][_0xb71b('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb71b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb71b('0xa'))(new Redis(config[_0xb71b('0x9')]));require(_0xb71b('0xb'))['register'](socket);function respondWithRpcPromise(_0xbeecf3,_0x2942cb,_0x14de62){return new BPromise(function(_0xcdda21,_0x3e00fa){return client['request'](_0xbeecf3,_0x14de62)['then'](function(_0x8ce730){logger[_0xb71b('0xc')]('FaxInteraction,\x20%s,\x20%s',_0x2942cb,_0xb71b('0xd'));logger[_0xb71b('0xe')](_0xb71b('0xf'),_0x2942cb,_0xb71b('0xd'),JSON[_0xb71b('0x10')](_0x8ce730));if(_0x8ce730['error']){if(_0x8ce730[_0xb71b('0x11')]['code']===0x1f4){logger[_0xb71b('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x2942cb,_0x8ce730[_0xb71b('0x11')][_0xb71b('0x12')]);return _0x3e00fa(_0x8ce730[_0xb71b('0x11')][_0xb71b('0x12')]);}logger['error'](_0xb71b('0x13'),_0x2942cb,_0x8ce730[_0xb71b('0x11')]['message']);return _0xcdda21(_0x8ce730['error'][_0xb71b('0x12')]);}else{logger[_0xb71b('0xc')]('FaxInteraction,\x20%s,\x20%s',_0x2942cb,_0xb71b('0xd'));_0xcdda21(_0x8ce730[_0xb71b('0x14')][_0xb71b('0x12')]);}})['catch'](function(_0x4eab05){logger[_0xb71b('0x11')](_0xb71b('0x13'),_0x2942cb,_0x4eab05);_0x3e00fa(_0x4eab05);});});}exports[_0xb71b('0x15')]=function(_0xf5eb41){var _0x34ef94=this;return new Promise(function(_0x3baf97,_0x4a694d){return db[_0xb71b('0x16')][_0xb71b('0x17')](_0xf5eb41[_0xb71b('0x18')],{'raw':_0xf5eb41[_0xb71b('0x19')]?_0xf5eb41['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf5eb41['options']?_0xf5eb41[_0xb71b('0x19')][_0xb71b('0x1a')]||null:null,'attributes':_0xf5eb41[_0xb71b('0x19')]?_0xf5eb41[_0xb71b('0x19')][_0xb71b('0x1b')]||null:null,'limit':_0xf5eb41['options']?_0xf5eb41['options'][_0xb71b('0x1c')]||null:null})[_0xb71b('0x1d')](function(_0x39ffee){logger[_0xb71b('0xc')](_0xb71b('0x15'),_0xf5eb41);logger[_0xb71b('0xe')]('UpdateFaxInteraction',_0xf5eb41,JSON['stringify'](_0x39ffee));_0x3baf97(_0x39ffee);})[_0xb71b('0x1e')](function(_0x55c3f2){logger['error'](_0xb71b('0x15'),_0x55c3f2[_0xb71b('0x12')],_0xf5eb41);_0x4a694d(_0x34ef94[_0xb71b('0x11')](0x1f4,_0x55c3f2[_0xb71b('0x12')]));});});};exports[_0xb71b('0x1f')]=function(_0x307cd7){return new Promise(function(_0x453c9c,_0xa6bd19){return db[_0xb71b('0x16')][_0xb71b('0x20')]({'where':_0x307cd7[_0xb71b('0x19')]?_0x307cd7['options']['where']||null:null})[_0xb71b('0x1d')](function(_0x3c85f4){if(_0x3c85f4){return _0x3c85f4['addTags'](_0x307cd7[_0xb71b('0x18')]['ids'],_[_0xb71b('0x21')](_0x307cd7[_0xb71b('0x18')],[_0xb71b('0x22'),'id'])||{});}})[_0xb71b('0x23')](function(_0x2b1e09){logger['info'](_0xb71b('0x24'),_0x307cd7);logger['debug'](_0xb71b('0x24'),_0x307cd7,JSON[_0xb71b('0x10')](_0x2b1e09));_0x453c9c(_0x2b1e09);})[_0xb71b('0x1e')](function(_0x25710d){logger['error'](_0xb71b('0x24'),_0x25710d[_0xb71b('0x12')],_0x307cd7);_0xa6bd19(_this[_0xb71b('0x11')](0x1f4,_0x25710d['message']));});});}; \ No newline at end of file +var _0x1eed=['request\x20sent','debug','stringify','error','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','addTags','ids','omit','spread','AddTags','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0x1eed,0x1f4));var _0xd1ee=function(_0x3ec36a,_0x4f744b){_0x3ec36a=_0x3ec36a-0x0;var _0x4516e2=_0x1eed[_0x3ec36a];return _0x4516e2;};'use strict';var _=require(_0xd1ee('0x0'));var util=require('util');var moment=require(_0xd1ee('0x1'));var BPromise=require(_0xd1ee('0x2'));var rs=require(_0xd1ee('0x3'));var fs=require('fs');var Redis=require(_0xd1ee('0x4'));var db=require(_0xd1ee('0x5'))['db'];var utils=require(_0xd1ee('0x6'));var logger=require(_0xd1ee('0x7'))(_0xd1ee('0x8'));var config=require(_0xd1ee('0x9'));var jayson=require(_0xd1ee('0xa'));var client=jayson[_0xd1ee('0xb')]['http']({'port':0x232a});config[_0xd1ee('0xc')]=_['defaults'](config['redis'],{'host':_0xd1ee('0xd'),'port':0x18eb});var socket=require(_0xd1ee('0xe'))(new Redis(config[_0xd1ee('0xc')]));require(_0xd1ee('0xf'))[_0xd1ee('0x10')](socket);function respondWithRpcPromise(_0x383c45,_0x4fe4ed,_0x1d3e53){return new BPromise(function(_0x5aa59b,_0x95a27f){return client['request'](_0x383c45,_0x1d3e53)[_0xd1ee('0x11')](function(_0x34a09e){logger[_0xd1ee('0x12')](_0xd1ee('0x13'),_0x4fe4ed,_0xd1ee('0x14'));logger[_0xd1ee('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4fe4ed,_0xd1ee('0x14'),JSON[_0xd1ee('0x16')](_0x34a09e));if(_0x34a09e['error']){if(_0x34a09e[_0xd1ee('0x17')]['code']===0x1f4){logger[_0xd1ee('0x17')](_0xd1ee('0x13'),_0x4fe4ed,_0x34a09e['error'][_0xd1ee('0x18')]);return _0x95a27f(_0x34a09e[_0xd1ee('0x17')][_0xd1ee('0x18')]);}logger[_0xd1ee('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x4fe4ed,_0x34a09e[_0xd1ee('0x17')]['message']);return _0x5aa59b(_0x34a09e[_0xd1ee('0x17')]['message']);}else{logger['info'](_0xd1ee('0x13'),_0x4fe4ed,_0xd1ee('0x14'));_0x5aa59b(_0x34a09e[_0xd1ee('0x19')][_0xd1ee('0x18')]);}})['catch'](function(_0x1c94a4){logger[_0xd1ee('0x17')](_0xd1ee('0x13'),_0x4fe4ed,_0x1c94a4);_0x95a27f(_0x1c94a4);});});}exports[_0xd1ee('0x1a')]=function(_0x560863){var _0x8800f1=this;return new Promise(function(_0x5ac5d9,_0x3c974a){return db[_0xd1ee('0x1b')][_0xd1ee('0x1c')](_0x560863[_0xd1ee('0x1d')],{'raw':_0x560863[_0xd1ee('0x1e')]?_0x560863[_0xd1ee('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x560863[_0xd1ee('0x1e')]?_0x560863[_0xd1ee('0x1e')][_0xd1ee('0x1f')]||null:null,'attributes':_0x560863[_0xd1ee('0x1e')]?_0x560863[_0xd1ee('0x1e')][_0xd1ee('0x20')]||null:null,'limit':_0x560863[_0xd1ee('0x1e')]?_0x560863[_0xd1ee('0x1e')][_0xd1ee('0x21')]||null:null})['then'](function(_0x39d84c){logger[_0xd1ee('0x12')](_0xd1ee('0x1a'),_0x560863);logger[_0xd1ee('0x15')](_0xd1ee('0x1a'),_0x560863,JSON[_0xd1ee('0x16')](_0x39d84c));_0x5ac5d9(_0x39d84c);})['catch'](function(_0x1dddea){logger[_0xd1ee('0x17')](_0xd1ee('0x1a'),_0x1dddea[_0xd1ee('0x18')],_0x560863);_0x3c974a(_0x8800f1['error'](0x1f4,_0x1dddea[_0xd1ee('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0xe1702b){return new Promise(function(_0xda6f8e,_0x54ead){return db[_0xd1ee('0x1b')]['find']({'where':_0xe1702b['options']?_0xe1702b[_0xd1ee('0x1e')][_0xd1ee('0x1f')]||null:null})[_0xd1ee('0x11')](function(_0x3434f0){if(_0x3434f0){return _0x3434f0[_0xd1ee('0x22')](_0xe1702b['body'][_0xd1ee('0x23')],_[_0xd1ee('0x24')](_0xe1702b[_0xd1ee('0x1d')],[_0xd1ee('0x23'),'id'])||{});}})[_0xd1ee('0x25')](function(_0x5d2722){logger['info']('AddTags',_0xe1702b);logger[_0xd1ee('0x15')](_0xd1ee('0x26'),_0xe1702b,JSON[_0xd1ee('0x16')](_0x5d2722));_0xda6f8e(_0x5d2722);})[_0xd1ee('0x27')](function(_0x30304a){logger['error'](_0xd1ee('0x26'),_0x30304a[_0xd1ee('0x18')],_0xe1702b);_0x54ead(_this[_0xd1ee('0x17')](0x1f4,_0x30304a[_0xd1ee('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 14b22c5..fb0d75d 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 _0x1d13=['save','remove','update','emit','removeListener','register'];(function(_0xcf51a5,_0x26c87c){var _0x51205c=function(_0x384bd4){while(--_0x384bd4){_0xcf51a5['push'](_0xcf51a5['shift']());}};_0x51205c(++_0x26c87c);}(_0x1d13,0x144));var _0x31d1=function(_0x1dd374,_0x50f2e9){_0x1dd374=_0x1dd374-0x0;var _0x2a0e58=_0x1d13[_0x1dd374];return _0x2a0e58;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x31d1('0x0'),_0x31d1('0x1'),_0x31d1('0x2')];function createListener(_0x2d86fd,_0x3a8a9d){return function(_0x23d785){_0x3a8a9d[_0x31d1('0x3')](_0x2d86fd,_0x23d785);};}function removeListener(_0x4f58bb,_0x85cab9){return function(){FaxInteractionEvents[_0x31d1('0x4')](_0x4f58bb,_0x85cab9);};}exports[_0x31d1('0x5')]=function(_0x5cdc13){for(var _0x249a63=0x0,_0xb25c78=events['length'];_0x249a63<_0xb25c78;_0x249a63++){var _0x198de6=events[_0x249a63];var _0x4aced7=createListener('faxInteraction:'+_0x198de6,_0x5cdc13);FaxInteractionEvents['on'](_0x198de6,_0x4aced7);}}; \ No newline at end of file +var _0xc22f=['save','remove','update','emit','removeListener','register','length'];(function(_0x43f86c,_0x2fdfa0){var _0x154c60=function(_0x5c1d3b){while(--_0x5c1d3b){_0x43f86c['push'](_0x43f86c['shift']());}};_0x154c60(++_0x2fdfa0);}(_0xc22f,0x1b2));var _0xfc22=function(_0x2a11a4,_0x58cd2a){_0x2a11a4=_0x2a11a4-0x0;var _0x2ff985=_0xc22f[_0x2a11a4];return _0x2ff985;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xfc22('0x0'),_0xfc22('0x1'),_0xfc22('0x2')];function createListener(_0x562e89,_0x28d30f){return function(_0x17227d){_0x28d30f[_0xfc22('0x3')](_0x562e89,_0x17227d);};}function removeListener(_0x3b4337,_0x215403){return function(){FaxInteractionEvents[_0xfc22('0x4')](_0x3b4337,_0x215403);};}exports[_0xfc22('0x5')]=function(_0x45d250){for(var _0x1dbb5b=0x0,_0x557e23=events[_0xfc22('0x6')];_0x1dbb5b<_0x557e23;_0x1dbb5b++){var _0x789bdd=events[_0x1dbb5b];var _0x1226ae=createListener('faxInteraction:'+_0x789bdd,_0x45d250);FaxInteractionEvents['on'](_0x789bdd,_0x1226ae);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index e9b42d9..471b277 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 _0xed3c=['create','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','removeTags','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post'];(function(_0x5eeb7d,_0x54a3ae){var _0x34b723=function(_0x4677bd){while(--_0x4677bd){_0x5eeb7d['push'](_0x5eeb7d['shift']());}};_0x34b723(++_0x54a3ae);}(_0xed3c,0xa1));var _0xced3=function(_0x4c76ad,_0x24bdab){_0x4c76ad=_0x4c76ad-0x0;var _0xde0a18=_0xed3c[_0x4c76ad];return _0xde0a18;};'use strict';var multer=require(_0xced3('0x0'));var util=require('util');var path=require(_0xced3('0x1'));var timeout=require(_0xced3('0x2'));var express=require(_0xced3('0x3'));var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xced3('0x7'));var controller=require(_0xced3('0x8'));router[_0xced3('0x9')]('/',auth['isAuthenticated'](),controller[_0xced3('0xa')]);router[_0xced3('0x9')](_0xced3('0xb'),auth[_0xced3('0xc')](),controller[_0xced3('0xd')]);router[_0xced3('0x9')]('/:id',auth[_0xced3('0xc')](),controller[_0xced3('0xe')]);router[_0xced3('0x9')](_0xced3('0xf'),auth[_0xced3('0xc')](),controller[_0xced3('0x10')]);router[_0xced3('0x9')]('/:id/download',auth[_0xced3('0xc')](),controller[_0xced3('0x11')]);router[_0xced3('0x12')]('/',auth[_0xced3('0xc')](),controller[_0xced3('0x13')]);router[_0xced3('0x12')](_0xced3('0xf'),auth[_0xced3('0xc')](),controller['addMessage']);router[_0xced3('0x12')]('/:id/tags',auth[_0xced3('0xc')](),interaction[_0xced3('0x14')](_0xced3('0x15'),_0xced3('0x16')),controller[_0xced3('0x17')]);router[_0xced3('0x18')](_0xced3('0x19'),auth['isAuthenticated'](),interaction[_0xced3('0x14')](_0xced3('0x15'),_0xced3('0x1a')),controller['update']);router[_0xced3('0x1b')](_0xced3('0x19'),auth[_0xced3('0xc')](),interaction[_0xced3('0x14')](_0xced3('0x15'),_0xced3('0x1c')),controller['destroy']);router[_0xced3('0x1b')]('/:id/tags',auth[_0xced3('0xc')](),controller[_0xced3('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x9464=['/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0x9464,0x10d));var _0x4946=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0x9464[_0x277fa3];return _0x2e4520;};'use strict';var multer=require(_0x4946('0x0'));var util=require(_0x4946('0x1'));var path=require(_0x4946('0x2'));var timeout=require('connect-timeout');var express=require(_0x4946('0x3'));var router=express[_0x4946('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4946('0x5'));var interaction=require(_0x4946('0x6'));var config=require(_0x4946('0x7'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0x4946('0x8')](),controller['index']);router[_0x4946('0x9')](_0x4946('0xa'),auth[_0x4946('0x8')](),controller['describe']);router[_0x4946('0x9')](_0x4946('0xb'),auth[_0x4946('0x8')](),controller[_0x4946('0xc')]);router[_0x4946('0x9')](_0x4946('0xd'),auth[_0x4946('0x8')](),controller['getMessages']);router[_0x4946('0x9')](_0x4946('0xe'),auth[_0x4946('0x8')](),controller['download']);router[_0x4946('0xf')]('/',auth[_0x4946('0x8')](),controller[_0x4946('0x10')]);router[_0x4946('0xf')](_0x4946('0xd'),auth[_0x4946('0x8')](),controller[_0x4946('0x11')]);router[_0x4946('0xf')](_0x4946('0x12'),auth[_0x4946('0x8')](),interaction[_0x4946('0x13')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x4946('0x14')](_0x4946('0xb'),auth[_0x4946('0x8')](),interaction[_0x4946('0x13')](_0x4946('0x15'),_0x4946('0x16')),controller[_0x4946('0x17')]);router[_0x4946('0x18')](_0x4946('0xb'),auth[_0x4946('0x8')](),interaction['tracked'](_0x4946('0x15'),_0x4946('0x19')),controller['destroy']);router['delete'](_0x4946('0x12'),auth[_0x4946('0x8')](),controller[_0x4946('0x1a')]);module[_0x4946('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 32e5b54..6b5f185 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 _0x0bde=['ENUM','out','DATE','exports','medium','BOOLEAN'];(function(_0x4311bf,_0x3de857){var _0x1fcc16=function(_0x510076){while(--_0x510076){_0x4311bf['push'](_0x4311bf['shift']());}};_0x1fcc16(++_0x3de857);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe0bd('0x0')]={'body':{'type':Sequelize['TEXT'](_0xe0bd('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xe0bd('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe0bd('0x3')]('in',_0xe0bd('0x4')),'defaultValue':_0xe0bd('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xe0bd('0x5')]}}; \ No newline at end of file +var _0x61a5=['out','DATE','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x350ada,_0x409632){var _0x43ad59=function(_0x2be9fc){while(--_0x2be9fc){_0x350ada['push'](_0x350ada['shift']());}};_0x43ad59(++_0x409632);}(_0x61a5,0xf0));var _0x561a=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0x61a5[_0x295a3d];return _0x23a732;};'use strict';var Sequelize=require(_0x561a('0x0'));module['exports']={'body':{'type':Sequelize[_0x561a('0x1')](_0x561a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x561a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x561a('0x4')]('in',_0x561a('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x561a('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x561a('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 84ec1e3..1d1acf0 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 _0xf897=['sort','pick','filter','where','merge','VIRTUAL','options','findAll','show','params','includeAll','include','find','body','destroy','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','motionChannel','event','EventManager','acceptmessage','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SIP/%s','rejectmessage','create','CmContact','isNil','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','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','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','update','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0xcd81b8,_0x18d9fd){var _0xc3ae18=function(_0x2bd4e0){while(--_0x2bd4e0){_0xcd81b8['push'](_0xcd81b8['shift']());}};_0xc3ae18(++_0x18d9fd);}(_0xf897,0xd5));var _0x7f89=function(_0x3e9160,_0x9faf1d){_0x3e9160=_0x3e9160-0x0;var _0x4c2a8a=_0xf897[_0x3e9160];return _0x4c2a8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f89('0x0'));var zipdir=require(_0x7f89('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f89('0x2'));var moment=require('moment');var BPromise=require(_0x7f89('0x3'));var Mustache=require(_0x7f89('0x4'));var util=require(_0x7f89('0x5'));var path=require(_0x7f89('0x6'));var sox=require('sox');var csv=require(_0x7f89('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f89('0x8'));var _=require(_0x7f89('0x9'));var squel=require(_0x7f89('0xa'));var crypto=require(_0x7f89('0xb'));var jsforce=require(_0x7f89('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7f89('0x7'));var querystring=require(_0x7f89('0xd'));var Papa=require('papaparse');var Redis=require(_0x7f89('0xe'));var authService=require(_0x7f89('0xf'));var qs=require(_0x7f89('0x10'));var as=require(_0x7f89('0x11'));var hardwareService=require(_0x7f89('0x12'));var logger=require(_0x7f89('0x13'))('api');var utils=require(_0x7f89('0x14'));var config=require(_0x7f89('0x15'));var licenseUtil=require(_0x7f89('0x16'));var db=require(_0x7f89('0x17'))['db'];config[_0x7f89('0x18')]=_[_0x7f89('0x19')](config[_0x7f89('0x18')],{'host':_0x7f89('0x1a'),'port':0x18eb});var socket=require(_0x7f89('0x1b'))(new Redis(config[_0x7f89('0x18')]));require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7f89('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x7f89('0x1c')][_0x7f89('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x25ed95,_0xdf1f0e,_0x45eab3,_0x38472b){return new BPromise(function(_0x22b735,_0x25b255){var _0x78345d=_0x38472b||client;return _0x78345d[_0x7f89('0x1e')](_0x25ed95,_0x45eab3)[_0x7f89('0x1f')](function(_0x3db2f2){logger[_0x7f89('0x20')](_0x7f89('0x21'),_0xdf1f0e,'request\x20sent');logger[_0x7f89('0x22')](_0x7f89('0x23'),_0xdf1f0e,_0x7f89('0x24'),JSON[_0x7f89('0x25')](_0x3db2f2));if(_0x3db2f2['error']){if(_0x3db2f2[_0x7f89('0x26')][_0x7f89('0x27')]===0x1f4){logger['error'](_0x7f89('0x21'),_0xdf1f0e,_0x3db2f2[_0x7f89('0x26')][_0x7f89('0x28')]);return _0x25b255(_0x3db2f2[_0x7f89('0x26')][_0x7f89('0x28')]);}logger[_0x7f89('0x26')](_0x7f89('0x21'),_0xdf1f0e,_0x3db2f2[_0x7f89('0x26')][_0x7f89('0x28')]);return _0x22b735(_0x3db2f2[_0x7f89('0x26')][_0x7f89('0x28')]);}else{logger[_0x7f89('0x20')](_0x7f89('0x21'),_0xdf1f0e,_0x7f89('0x24'));_0x22b735(_0x3db2f2[_0x7f89('0x29')][_0x7f89('0x28')]);}})[_0x7f89('0x2a')](function(_0x3414a0){logger[_0x7f89('0x26')](_0x7f89('0x21'),_0xdf1f0e,_0x3414a0);_0x25b255(_0x3414a0);});});}function respondWithStatusCode(_0x594890,_0x21fde4){_0x21fde4=_0x21fde4||0xcc;return function(_0x550888){if(_0x550888){return _0x594890[_0x7f89('0x2b')](_0x21fde4);}return _0x594890['status'](_0x21fde4)[_0x7f89('0x2c')]();};}function respondWithResult(_0x288c5f,_0x2769ec){_0x2769ec=_0x2769ec||0xc8;return function(_0x2c1bba){if(_0x2c1bba){return _0x288c5f[_0x7f89('0x2d')](_0x2769ec)['json'](_0x2c1bba);}};}function respondWithFilteredResult(_0x32d5e8,_0x1c19ae){return function(_0x4ca181){if(_0x4ca181){var _0x34be2f=typeof _0x1c19ae[_0x7f89('0x2e')]==='undefined'&&typeof _0x1c19ae['limit']===_0x7f89('0x2f');var _0x3450c8=_0x4ca181[_0x7f89('0x30')];var _0x55e23b=_0x34be2f?0x0:_0x1c19ae[_0x7f89('0x2e')];var _0x3d9682=_0x34be2f?_0x4ca181[_0x7f89('0x30')]:_0x1c19ae[_0x7f89('0x2e')]+_0x1c19ae[_0x7f89('0x31')];var _0x200621;if(_0x3d9682>=_0x3450c8){_0x3d9682=_0x3450c8;_0x200621=0xc8;}else{_0x200621=0xce;}_0x32d5e8[_0x7f89('0x2d')](_0x200621);return _0x32d5e8['set'](_0x7f89('0x32'),_0x55e23b+'-'+_0x3d9682+'/'+_0x3450c8)[_0x7f89('0x33')](_0x4ca181);}return null;};}function patchUpdates(_0x58d1da){return function(_0x18e833){try{jsonpatch[_0x7f89('0x34')](_0x18e833,_0x58d1da,!![]);}catch(_0x457bbb){return BPromise[_0x7f89('0x35')](_0x457bbb);}return _0x18e833['save']();};}function saveUpdates(_0x5dd872,_0x4314ca){return function(_0x8d493e){if(_0x8d493e){return _0x8d493e[_0x7f89('0x36')](_0x5dd872)[_0x7f89('0x1f')](function(_0x2ebd67){return _0x2ebd67;});}return null;};}function removeEntity(_0x502849,_0x5b8dc9){return function(_0x415724){if(_0x415724){return _0x415724['destroy']()[_0x7f89('0x1f')](function(){_0x502849[_0x7f89('0x2d')](0xcc)[_0x7f89('0x2c')]();});}};}function handleEntityNotFound(_0x3e54c6,_0x35b91a){return function(_0x35951e){if(!_0x35951e){_0x3e54c6[_0x7f89('0x2b')](0x194);}return _0x35951e;};}function handleError(_0x3a6801,_0x14bffa){_0x14bffa=_0x14bffa||0x1f4;return function(_0x41b3ef){logger['error'](_0x41b3ef['stack']);if(_0x41b3ef[_0x7f89('0x37')]){delete _0x41b3ef[_0x7f89('0x37')];}_0x3a6801[_0x7f89('0x2d')](_0x14bffa)[_0x7f89('0x38')](_0x41b3ef);};}exports[_0x7f89('0x39')]=function(_0xf718e2,_0x2b4d6d){var _0x42026f={},_0x1b3820={},_0x381664={'count':0x0,'rows':[]};var _0x3689f1=_[_0x7f89('0x3a')](db[_0x7f89('0x3b')][_0x7f89('0x3c')],function(_0x325c40){return{'name':_0x325c40[_0x7f89('0x3d')],'type':_0x325c40[_0x7f89('0x3e')][_0x7f89('0x3f')]};});_0x1b3820[_0x7f89('0x40')]=_['map'](_0x3689f1,'name');_0x1b3820[_0x7f89('0x41')]=_[_0x7f89('0x42')](_0xf718e2[_0x7f89('0x41')]);_0x1b3820[_0x7f89('0x43')]=_[_0x7f89('0x44')](_0x1b3820[_0x7f89('0x40')],_0x1b3820['query']);_0x42026f[_0x7f89('0x45')]=_[_0x7f89('0x44')](_0x1b3820[_0x7f89('0x40')],qs[_0x7f89('0x46')](_0xf718e2[_0x7f89('0x41')][_0x7f89('0x46')]));_0x42026f['attributes']=_0x42026f[_0x7f89('0x45')][_0x7f89('0x47')]?_0x42026f['attributes']:_0x1b3820[_0x7f89('0x40')];if(!_0xf718e2['query'][_0x7f89('0x48')](_0x7f89('0x49'))){_0x42026f[_0x7f89('0x31')]=qs[_0x7f89('0x31')](_0xf718e2['query'][_0x7f89('0x31')]);_0x42026f['offset']=qs['offset'](_0xf718e2['query']['offset']);}_0x42026f[_0x7f89('0x4a')]=qs[_0x7f89('0x4b')](_0xf718e2[_0x7f89('0x41')]['sort']);_0x42026f['where']=qs[_0x7f89('0x43')](_[_0x7f89('0x4c')](_0xf718e2[_0x7f89('0x41')],_0x1b3820[_0x7f89('0x43')]),_0x3689f1);if(_0xf718e2[_0x7f89('0x41')][_0x7f89('0x4d')]){_0x42026f[_0x7f89('0x4e')]=_[_0x7f89('0x4f')](_0x42026f['where'],{'$or':_[_0x7f89('0x3a')](_0x3689f1,function(_0x4dfaf0){if(_0x4dfaf0[_0x7f89('0x3e')]!==_0x7f89('0x50')){var _0xc93be3={};_0xc93be3[_0x4dfaf0[_0x7f89('0x37')]]={'$like':'%'+_0xf718e2['query'][_0x7f89('0x4d')]+'%'};return _0xc93be3;}})});}_0x42026f=_[_0x7f89('0x4f')]({},_0x42026f,_0xf718e2[_0x7f89('0x51')]);var _0x4f9404={'where':_0x42026f[_0x7f89('0x4e')]};return db['FaxMessage'][_0x7f89('0x30')](_0x4f9404)['then'](function(_0x32f5b8){_0x381664[_0x7f89('0x30')]=_0x32f5b8;if(_0xf718e2[_0x7f89('0x41')]['includeAll']){_0x42026f['include']=[{'all':!![]}];}return db[_0x7f89('0x3b')][_0x7f89('0x52')](_0x42026f);})['then'](function(_0x4e4e82){_0x381664['rows']=_0x4e4e82;return _0x381664;})[_0x7f89('0x1f')](respondWithFilteredResult(_0x2b4d6d,_0x42026f))[_0x7f89('0x2a')](handleError(_0x2b4d6d,null));};exports[_0x7f89('0x53')]=function(_0x26e088,_0x4680c4){var _0x5ab653={'raw':!![],'where':{'id':_0x26e088[_0x7f89('0x54')]['id']}},_0x58e0fc={};_0x58e0fc[_0x7f89('0x40')]=_['keys'](db[_0x7f89('0x3b')][_0x7f89('0x3c')]);_0x58e0fc[_0x7f89('0x41')]=_[_0x7f89('0x42')](_0x26e088[_0x7f89('0x41')]);_0x58e0fc[_0x7f89('0x43')]=_['intersection'](_0x58e0fc['model'],_0x58e0fc[_0x7f89('0x41')]);_0x5ab653[_0x7f89('0x45')]=_[_0x7f89('0x44')](_0x58e0fc[_0x7f89('0x40')],qs[_0x7f89('0x46')](_0x26e088[_0x7f89('0x41')][_0x7f89('0x46')]));_0x5ab653['attributes']=_0x5ab653[_0x7f89('0x45')][_0x7f89('0x47')]?_0x5ab653[_0x7f89('0x45')]:_0x58e0fc['model'];if(_0x26e088[_0x7f89('0x41')][_0x7f89('0x55')]){_0x5ab653[_0x7f89('0x56')]=[{'all':!![]}];}_0x5ab653=_[_0x7f89('0x4f')]({},_0x5ab653,_0x26e088[_0x7f89('0x51')]);return db[_0x7f89('0x3b')][_0x7f89('0x57')](_0x5ab653)[_0x7f89('0x1f')](handleEntityNotFound(_0x4680c4,null))[_0x7f89('0x1f')](respondWithResult(_0x4680c4,null))[_0x7f89('0x2a')](handleError(_0x4680c4,null));};exports[_0x7f89('0x36')]=function(_0x2877d4,_0x4590b6){if(_0x2877d4[_0x7f89('0x58')]['id']){delete _0x2877d4['body']['id'];}return db[_0x7f89('0x3b')]['find']({'where':{'id':_0x2877d4[_0x7f89('0x54')]['id']}})[_0x7f89('0x1f')](handleEntityNotFound(_0x4590b6,null))['then'](saveUpdates(_0x2877d4[_0x7f89('0x58')],null))['then'](respondWithResult(_0x4590b6,null))[_0x7f89('0x2a')](handleError(_0x4590b6,null));};exports[_0x7f89('0x59')]=function(_0x30f5bb,_0x2e4290){return db[_0x7f89('0x3b')]['find']({'where':{'id':_0x30f5bb[_0x7f89('0x54')]['id']}})[_0x7f89('0x1f')](handleEntityNotFound(_0x2e4290,null))['then'](removeEntity(_0x2e4290,null))[_0x7f89('0x2a')](handleError(_0x2e4290,null));};exports['describe']=function(_0x52829b,_0x160508){return db[_0x7f89('0x3b')]['describe']()['then'](respondWithResult(_0x160508,null))[_0x7f89('0x2a')](handleError(_0x160508,null));};var interaction_log=require(_0x7f89('0x13'))(_0x7f89('0x5a'));exports[_0x7f89('0x5b')]=function(_0x538bcd,_0x509948,_0x460c3b){var _0x4e000d={'agent':{},'channel':_0x7f89('0x5c')};if(_0x538bcd[_0x7f89('0x58')]['id']){delete _0x538bcd['body']['id'];}_0x538bcd[_0x7f89('0x58')][_0x7f89('0x5d')]=!![];_0x538bcd['body'][_0x7f89('0x5e')]=moment()[_0x7f89('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x538bcd[_0x7f89('0x58')][_0x7f89('0x60')]=_0x538bcd[_0x7f89('0x58')][_0x7f89('0x60')]||_0x538bcd[_0x7f89('0x61')]['id'];_0x4e000d[_0x7f89('0x62')]['id']=_0x538bcd['body']['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x538bcd[_0x7f89('0x54')]['id'],'UserId':null}})[_0x7f89('0x1f')](handleEntityNotFound(_0x509948,null))[_0x7f89('0x1f')](saveUpdates(_0x538bcd['body'],null))[_0x7f89('0x1f')](function(_0x1ce251){if(_0x1ce251){_0x4e000d[_0x7f89('0x28')]=_0x1ce251[_0x7f89('0x63')]({'plain':!![]});return db[_0x7f89('0x64')]['find']({'where':{'id':_0x1ce251[_0x7f89('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x509948,null))[_0x7f89('0x1f')](function(_0xf251d6){if(_0xf251d6){return _0xf251d6['update']({'UserId':_0x538bcd[_0x7f89('0x58')]['UserId'],'read1stAt':_['isNil'](_0xf251d6[_0x7f89('0x66')])?moment()[_0x7f89('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1393da){if(_0x1393da){_0x4e000d['interaction']=_0x1393da[_0x7f89('0x63')]({'plain':!![]});interaction_log[_0x7f89('0x20')](_0x7f89('0x67'),_0x538bcd[_0x7f89('0x61')]['id'],_0x538bcd['user'][_0x7f89('0x37')],_0x538bcd[_0x7f89('0x61')][_0x7f89('0x68')],_0x4e000d[_0x7f89('0x69')]['id'],_0x538bcd['body']?JSON[_0x7f89('0x25')](_0x538bcd['body']):'null');return respondWithRpcPromise(_0x7f89('0x6a'),_0x7f89('0x6b'),_0x4e000d);}return null;})[_0x7f89('0x1f')](function(_0x509f16){var _0x39e3bb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x509f16[_0x7f89('0x28')][_0x7f89('0x6c')];return db['sequelize'][_0x7f89('0x41')](_0x39e3bb,{'type':db[_0x7f89('0x6d')][_0x7f89('0x6e')][_0x7f89('0x6f')],'raw':!![]})['then'](function(_0x3670a8){return _0x3670a8;});})[_0x7f89('0x1f')](function(_0x5acb6b){if(_0x5acb6b){_0x4e000d[_0x7f89('0x28')][_0x7f89('0x70')]=_0x5acb6b[0x0];if(!_0x538bcd[_0x7f89('0x58')]['UserId'])return;return db[_0x7f89('0x71')][_0x7f89('0x57')]({'where':{'id':_0x538bcd['body'][_0x7f89('0x60')],'role':_0x7f89('0x62')},'attributes':['id','name',_0x7f89('0x72'),_0x7f89('0x73'),_0x7f89('0x74')],'raw':!![]});}return null;})[_0x7f89('0x1f')](function(_0x3af980){if(!_0x3af980)return null;_0x4e000d[_0x7f89('0x28')]['agent']=_0x3af980;return _0x4e000d;})[_0x7f89('0x1f')](function(_0x7ab44f){if(_0x7ab44f){if(_0x538bcd[_0x7f89('0x58')]['manual']){_0x4e000d['message'][_0x7f89('0x75')]=util[_0x7f89('0x5f')]('SIP/%s',_0x538bcd[_0x7f89('0x61')][_0x7f89('0x37')]);_0x4e000d['message'][_0x7f89('0x76')]=_0x4e000d[_0x7f89('0x76')];_0x4e000d[_0x7f89('0x28')][_0x7f89('0x77')]=_0x4e000d[_0x7f89('0x76')];_0x4e000d[_0x7f89('0x28')][_0x7f89('0x78')]=_0x7f89('0x5b');return respondWithRpcPromise(_0x7f89('0x79'),'EventManager',{'event':_0x7f89('0x7a'),'message':_0x4e000d[_0x7f89('0x28')]},client9002)['then'](function(){return _0x4e000d;});}return _0x4e000d;}return null;})[_0x7f89('0x1f')](respondWithResult(_0x509948,null))[_0x7f89('0x2a')](handleError(_0x509948,null));};var interaction_log=require(_0x7f89('0x13'))(_0x7f89('0x5a'));exports[_0x7f89('0x35')]=function(_0x150760,_0x2734d1,_0x3cb433){var _0x3eb1b2={'agent':{},'channel':_0x7f89('0x5c')};if(_0x150760[_0x7f89('0x58')]['id']){delete _0x150760[_0x7f89('0x58')]['id'];}_0x150760[_0x7f89('0x58')][_0x7f89('0x60')]=_0x150760['body']['UserId']||_0x150760['user']['id'];_0x3eb1b2[_0x7f89('0x62')]['id']=_0x150760['body'][_0x7f89('0x60')];return db[_0x7f89('0x3b')]['find']({'where':{'id':_0x150760['params']['id'],'UserId':null}})[_0x7f89('0x1f')](handleEntityNotFound(_0x2734d1,null))[_0x7f89('0x1f')](function(_0x2f6a67){if(_0x2f6a67){_0x3eb1b2['message']=_0x2f6a67[_0x7f89('0x63')]({'plain':!![]});return db[_0x7f89('0x64')]['find']({'where':{'id':_0x2f6a67['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2734d1,null))[_0x7f89('0x1f')](function(_0x4cc2e8){if(_0x4cc2e8){_0x3eb1b2[_0x7f89('0x69')]=_0x4cc2e8[_0x7f89('0x63')]({'plain':!![]});interaction_log[_0x7f89('0x20')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x150760[_0x7f89('0x61')]['id'],_0x150760['user'][_0x7f89('0x37')],_0x150760[_0x7f89('0x61')]['role'],_0x3eb1b2[_0x7f89('0x69')]['id'],_0x150760[_0x7f89('0x58')]?JSON['stringify'](_0x150760[_0x7f89('0x58')]):_0x7f89('0x7b'));return respondWithRpcPromise(_0x7f89('0x7c'),'rejectMessage',_0x3eb1b2);}return null;})[_0x7f89('0x1f')](function(_0x83177b){var _0x257f42=_0x7f89('0x7d')+_0x83177b['message'][_0x7f89('0x6c')];return db['sequelize'][_0x7f89('0x41')](_0x257f42,{'type':db[_0x7f89('0x6d')][_0x7f89('0x6e')]['SELECT'],'raw':!![]})[_0x7f89('0x1f')](function(_0xf8ba78){return _0xf8ba78;});})[_0x7f89('0x1f')](function(_0x2fb425){if(_0x2fb425){_0x3eb1b2[_0x7f89('0x28')][_0x7f89('0x70')]=_0x2fb425[0x0];if(!_0x150760['body'][_0x7f89('0x60')])return;return db[_0x7f89('0x71')][_0x7f89('0x57')]({'where':{'id':_0x150760[_0x7f89('0x58')][_0x7f89('0x60')],'role':'agent'},'attributes':['id',_0x7f89('0x37'),'fullname',_0x7f89('0x73'),_0x7f89('0x74')],'raw':!![]});}return null;})[_0x7f89('0x1f')](function(_0xe57147){if(!_0xe57147)return null;_0x3eb1b2['message'][_0x7f89('0x62')]=_0xe57147;return _0x3eb1b2;})[_0x7f89('0x1f')](function(_0xbed45){if(_0xbed45){_0xbed45[_0x7f89('0x28')][_0x7f89('0x75')]=util[_0x7f89('0x5f')](_0x7f89('0x7e'),_0x150760[_0x7f89('0x61')][_0x7f89('0x37')]);_0xbed45[_0x7f89('0x28')][_0x7f89('0x76')]=_0x3eb1b2[_0x7f89('0x76')];_0xbed45[_0x7f89('0x28')][_0x7f89('0x77')]=_0x3eb1b2[_0x7f89('0x76')];_0xbed45[_0x7f89('0x28')][_0x7f89('0x78')]='reject';respondWithRpcPromise('EventManager',_0x7f89('0x79'),{'event':_0x7f89('0x7f'),'message':_0xbed45[_0x7f89('0x28')]},client9002);return _0x3eb1b2;}return null;})[_0x7f89('0x1f')](respondWithResult(_0x2734d1,null))['catch'](handleError(_0x2734d1,null));};exports[_0x7f89('0x80')]=function(_0x2da601,_0x4f55e2){var _0x932288;return db[_0x7f89('0x3b')][_0x7f89('0x80')](_0x2da601[_0x7f89('0x58')],{})[_0x7f89('0x1f')](function(_0x55aeee){_0x932288=_0x55aeee;return db[_0x7f89('0x81')]['findOne']({'where':{'id':_0x932288[_0x7f89('0x6c')]}});})[_0x7f89('0x1f')](function(_0x23d34a){if(_[_0x7f89('0x82')](_0x23d34a)){return;}else{_0x932288['fax']=_0x23d34a[_0x7f89('0x5c')];return db['Attachment'][_0x7f89('0x83')]({'where':{'id':_0x932288[_0x7f89('0x84')]}});}})[_0x7f89('0x1f')](function(_0x209a97){return respondWithRpcPromise('SendFax',_0x7f89('0x85'),{'FaxAccountId':_[_0x7f89('0x82')](_0x2da601[_0x7f89('0x58')])?undefined:_0x2da601['body'][_0x7f89('0x86')],'path':_[_0x7f89('0x82')](_0x209a97)?undefined:util[_0x7f89('0x5f')](_0x7f89('0x87'),_0x209a97[_0x7f89('0x88')]),'fax':_[_0x7f89('0x82')](_0x932288[_0x7f89('0x5c')])?undefined:_0x932288[_0x7f89('0x5c')],'AttachmentId':_0x932288[_0x7f89('0x84')]},client9002);})[_0x7f89('0x1f')](respondWithResult(_0x4f55e2,0xc9))[_0x7f89('0x2a')](handleError(_0x4f55e2,null));};exports[_0x7f89('0x89')]=function(_0x3ed9a5,_0x3c04d2){var _0x5101e3=path[_0x7f89('0x8a')](config[_0x7f89('0x8b')],_0x7f89('0x8c'),_0x7f89('0x8d'),_0x7f89('0x8e'));return db['FaxMessage'][_0x7f89('0x57')]({'where':{'id':_0x3ed9a5[_0x7f89('0x54')]['id']},'include':[{'model':db[_0x7f89('0x8f')],'as':_0x7f89('0x8f')}]})[_0x7f89('0x1f')](handleEntityNotFound(_0x3c04d2,null))[_0x7f89('0x1f')](function(_0x55f0da){if(_0x55f0da){return _0x3c04d2[_0x7f89('0x89')](path[_0x7f89('0x8a')](_0x5101e3,_0x55f0da[_0x7f89('0x8f')][_0x7f89('0x88')]));}})[_0x7f89('0x2a')](handleError(_0x3c04d2,null));}; \ No newline at end of file +var _0x59d9=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','message','FaxMessage,\x20%s,\x20%s','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','destroy','then','end','stack','index','map','rawAttributes','fieldName','key','model','name','query','filters','fields','attributes','order','sort','pick','filter','where','merge','type','VIRTUAL','options','FaxMessage','includeAll','include','rows','show','params','keys','intersection','find','update','body','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','role','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','motionChannel','event','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','sequelize','reject','EventManager','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','Attachment','join','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x59d9,0x191));var _0x959d=function(_0x5626e3,_0x118688){_0x5626e3=_0x5626e3-0x0;var _0x9af2e3=_0x59d9[_0x5626e3];return _0x9af2e3;};'use strict';var emlformat=require(_0x959d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x959d('0x1'));var jsonpatch=require(_0x959d('0x2'));var rp=require('request-promise');var moment=require(_0x959d('0x3'));var BPromise=require(_0x959d('0x4'));var Mustache=require(_0x959d('0x5'));var util=require(_0x959d('0x6'));var path=require('path');var sox=require(_0x959d('0x7'));var csv=require(_0x959d('0x8'));var ejs=require(_0x959d('0x9'));var fs=require('fs');var fs_extra=require(_0x959d('0xa'));var _=require(_0x959d('0xb'));var squel=require(_0x959d('0xc'));var crypto=require(_0x959d('0xd'));var jsforce=require(_0x959d('0xe'));var deskjs=require(_0x959d('0xf'));var toCsv=require(_0x959d('0x8'));var querystring=require(_0x959d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x959d('0x11'));var qs=require(_0x959d('0x12'));var as=require(_0x959d('0x13'));var hardwareService=require(_0x959d('0x14'));var logger=require(_0x959d('0x15'))('api');var utils=require(_0x959d('0x16'));var config=require(_0x959d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x959d('0x18'))['db'];config[_0x959d('0x19')]=_[_0x959d('0x1a')](config[_0x959d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x959d('0x1b'))(new Redis(config[_0x959d('0x19')]));require(_0x959d('0x1c'))['register'](socket);var jayson=require(_0x959d('0x1d'));var client=jayson[_0x959d('0x1e')][_0x959d('0x1f')]({'port':0x232c});var client9002=jayson[_0x959d('0x1e')][_0x959d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5943fd,_0x3430dc,_0x91023c,_0x3f11b8){return new BPromise(function(_0x2dd6ff,_0x21df20){var _0x4fc737=_0x3f11b8||client;return _0x4fc737[_0x959d('0x20')](_0x5943fd,_0x91023c)['then'](function(_0x5dcd17){logger[_0x959d('0x21')]('FaxMessage,\x20%s,\x20%s',_0x3430dc,_0x959d('0x22'));logger[_0x959d('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3430dc,_0x959d('0x22'),JSON[_0x959d('0x24')](_0x5dcd17));if(_0x5dcd17[_0x959d('0x25')]){if(_0x5dcd17[_0x959d('0x25')]['code']===0x1f4){logger[_0x959d('0x25')]('FaxMessage,\x20%s,\x20%s',_0x3430dc,_0x5dcd17[_0x959d('0x25')][_0x959d('0x26')]);return _0x21df20(_0x5dcd17['error'][_0x959d('0x26')]);}logger[_0x959d('0x25')](_0x959d('0x27'),_0x3430dc,_0x5dcd17[_0x959d('0x25')][_0x959d('0x26')]);return _0x2dd6ff(_0x5dcd17[_0x959d('0x25')]['message']);}else{logger[_0x959d('0x21')](_0x959d('0x27'),_0x3430dc,_0x959d('0x22'));_0x2dd6ff(_0x5dcd17[_0x959d('0x28')][_0x959d('0x26')]);}})[_0x959d('0x29')](function(_0x5ea452){logger['error'](_0x959d('0x27'),_0x3430dc,_0x5ea452);_0x21df20(_0x5ea452);});});}function respondWithStatusCode(_0x5d0317,_0xaaf92a){_0xaaf92a=_0xaaf92a||0xcc;return function(_0x5241ad){if(_0x5241ad){return _0x5d0317[_0x959d('0x2a')](_0xaaf92a);}return _0x5d0317[_0x959d('0x2b')](_0xaaf92a)['end']();};}function respondWithResult(_0x5485a2,_0x43a000){_0x43a000=_0x43a000||0xc8;return function(_0x307236){if(_0x307236){return _0x5485a2[_0x959d('0x2b')](_0x43a000)[_0x959d('0x2c')](_0x307236);}};}function respondWithFilteredResult(_0x34beef,_0x1e9508){return function(_0x39fc14){if(_0x39fc14){var _0x2d687c=typeof _0x1e9508['offset']===_0x959d('0x2d')&&typeof _0x1e9508[_0x959d('0x2e')]===_0x959d('0x2d');var _0x1ef54d=_0x39fc14[_0x959d('0x2f')];var _0x172dbd=_0x2d687c?0x0:_0x1e9508[_0x959d('0x30')];var _0x7f1e29=_0x2d687c?_0x39fc14[_0x959d('0x2f')]:_0x1e9508[_0x959d('0x30')]+_0x1e9508[_0x959d('0x2e')];var _0x5161f2;if(_0x7f1e29>=_0x1ef54d){_0x7f1e29=_0x1ef54d;_0x5161f2=0xc8;}else{_0x5161f2=0xce;}_0x34beef[_0x959d('0x2b')](_0x5161f2);return _0x34beef[_0x959d('0x31')](_0x959d('0x32'),_0x172dbd+'-'+_0x7f1e29+'/'+_0x1ef54d)[_0x959d('0x2c')](_0x39fc14);}return null;};}function patchUpdates(_0x369001){return function(_0x39d634){try{jsonpatch[_0x959d('0x33')](_0x39d634,_0x369001,!![]);}catch(_0x342f0b){return BPromise['reject'](_0x342f0b);}return _0x39d634['save']();};}function saveUpdates(_0x8a5355,_0x29339c){return function(_0x4370fe){if(_0x4370fe){return _0x4370fe['update'](_0x8a5355)['then'](function(_0x1dd228){return _0x1dd228;});}return null;};}function removeEntity(_0x1878b3,_0x4af8d5){return function(_0x4e14c4){if(_0x4e14c4){return _0x4e14c4[_0x959d('0x34')]()[_0x959d('0x35')](function(){_0x1878b3['status'](0xcc)[_0x959d('0x36')]();});}};}function handleEntityNotFound(_0x2fbb01,_0xe50864){return function(_0x54e18c){if(!_0x54e18c){_0x2fbb01[_0x959d('0x2a')](0x194);}return _0x54e18c;};}function handleError(_0x27ffa9,_0x3f7ad9){_0x3f7ad9=_0x3f7ad9||0x1f4;return function(_0x5d783e){logger[_0x959d('0x25')](_0x5d783e[_0x959d('0x37')]);if(_0x5d783e['name']){delete _0x5d783e['name'];}_0x27ffa9['status'](_0x3f7ad9)['send'](_0x5d783e);};}exports[_0x959d('0x38')]=function(_0x3cfe55,_0x461db5){var _0x1c3f9f={},_0x21b312={},_0x4d00dc={'count':0x0,'rows':[]};var _0x21206f=_[_0x959d('0x39')](db['FaxMessage'][_0x959d('0x3a')],function(_0x56b7fd){return{'name':_0x56b7fd[_0x959d('0x3b')],'type':_0x56b7fd['type'][_0x959d('0x3c')]};});_0x21b312[_0x959d('0x3d')]=_[_0x959d('0x39')](_0x21206f,_0x959d('0x3e'));_0x21b312[_0x959d('0x3f')]=_['keys'](_0x3cfe55['query']);_0x21b312[_0x959d('0x40')]=_['intersection'](_0x21b312[_0x959d('0x3d')],_0x21b312[_0x959d('0x3f')]);_0x1c3f9f['attributes']=_['intersection'](_0x21b312[_0x959d('0x3d')],qs[_0x959d('0x41')](_0x3cfe55[_0x959d('0x3f')][_0x959d('0x41')]));_0x1c3f9f['attributes']=_0x1c3f9f[_0x959d('0x42')]['length']?_0x1c3f9f[_0x959d('0x42')]:_0x21b312[_0x959d('0x3d')];if(!_0x3cfe55['query']['hasOwnProperty']('nolimit')){_0x1c3f9f[_0x959d('0x2e')]=qs[_0x959d('0x2e')](_0x3cfe55['query'][_0x959d('0x2e')]);_0x1c3f9f['offset']=qs['offset'](_0x3cfe55['query'][_0x959d('0x30')]);}_0x1c3f9f[_0x959d('0x43')]=qs[_0x959d('0x44')](_0x3cfe55[_0x959d('0x3f')][_0x959d('0x44')]);_0x1c3f9f['where']=qs['filters'](_[_0x959d('0x45')](_0x3cfe55['query'],_0x21b312[_0x959d('0x40')]),_0x21206f);if(_0x3cfe55[_0x959d('0x3f')][_0x959d('0x46')]){_0x1c3f9f[_0x959d('0x47')]=_[_0x959d('0x48')](_0x1c3f9f[_0x959d('0x47')],{'$or':_[_0x959d('0x39')](_0x21206f,function(_0x52b3dc){if(_0x52b3dc[_0x959d('0x49')]!==_0x959d('0x4a')){var _0x24d791={};_0x24d791[_0x52b3dc[_0x959d('0x3e')]]={'$like':'%'+_0x3cfe55[_0x959d('0x3f')][_0x959d('0x46')]+'%'};return _0x24d791;}})});}_0x1c3f9f=_[_0x959d('0x48')]({},_0x1c3f9f,_0x3cfe55[_0x959d('0x4b')]);var _0x1d3e8b={'where':_0x1c3f9f[_0x959d('0x47')]};return db[_0x959d('0x4c')]['count'](_0x1d3e8b)[_0x959d('0x35')](function(_0x2a959c){_0x4d00dc[_0x959d('0x2f')]=_0x2a959c;if(_0x3cfe55[_0x959d('0x3f')][_0x959d('0x4d')]){_0x1c3f9f[_0x959d('0x4e')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1c3f9f);})['then'](function(_0x251f39){_0x4d00dc[_0x959d('0x4f')]=_0x251f39;return _0x4d00dc;})[_0x959d('0x35')](respondWithFilteredResult(_0x461db5,_0x1c3f9f))[_0x959d('0x29')](handleError(_0x461db5,null));};exports[_0x959d('0x50')]=function(_0x5363f4,_0x15e47d){var _0x3c4ef0={'raw':!![],'where':{'id':_0x5363f4[_0x959d('0x51')]['id']}},_0x51fe13={};_0x51fe13[_0x959d('0x3d')]=_[_0x959d('0x52')](db['FaxMessage'][_0x959d('0x3a')]);_0x51fe13[_0x959d('0x3f')]=_[_0x959d('0x52')](_0x5363f4[_0x959d('0x3f')]);_0x51fe13[_0x959d('0x40')]=_[_0x959d('0x53')](_0x51fe13[_0x959d('0x3d')],_0x51fe13['query']);_0x3c4ef0['attributes']=_[_0x959d('0x53')](_0x51fe13[_0x959d('0x3d')],qs[_0x959d('0x41')](_0x5363f4['query']['fields']));_0x3c4ef0[_0x959d('0x42')]=_0x3c4ef0[_0x959d('0x42')]['length']?_0x3c4ef0[_0x959d('0x42')]:_0x51fe13[_0x959d('0x3d')];if(_0x5363f4[_0x959d('0x3f')][_0x959d('0x4d')]){_0x3c4ef0['include']=[{'all':!![]}];}_0x3c4ef0=_[_0x959d('0x48')]({},_0x3c4ef0,_0x5363f4[_0x959d('0x4b')]);return db['FaxMessage'][_0x959d('0x54')](_0x3c4ef0)[_0x959d('0x35')](handleEntityNotFound(_0x15e47d,null))['then'](respondWithResult(_0x15e47d,null))['catch'](handleError(_0x15e47d,null));};exports[_0x959d('0x55')]=function(_0x53a457,_0x393512){if(_0x53a457[_0x959d('0x56')]['id']){delete _0x53a457[_0x959d('0x56')]['id'];}return db[_0x959d('0x4c')][_0x959d('0x54')]({'where':{'id':_0x53a457[_0x959d('0x51')]['id']}})[_0x959d('0x35')](handleEntityNotFound(_0x393512,null))[_0x959d('0x35')](saveUpdates(_0x53a457['body'],null))[_0x959d('0x35')](respondWithResult(_0x393512,null))[_0x959d('0x29')](handleError(_0x393512,null));};exports[_0x959d('0x34')]=function(_0x5deba6,_0xdf4526){return db[_0x959d('0x4c')][_0x959d('0x54')]({'where':{'id':_0x5deba6[_0x959d('0x51')]['id']}})[_0x959d('0x35')](handleEntityNotFound(_0xdf4526,null))[_0x959d('0x35')](removeEntity(_0xdf4526,null))[_0x959d('0x29')](handleError(_0xdf4526,null));};exports[_0x959d('0x57')]=function(_0x1bfc6a,_0x58f541){return db[_0x959d('0x4c')][_0x959d('0x57')]()[_0x959d('0x35')](respondWithResult(_0x58f541,null))[_0x959d('0x29')](handleError(_0x58f541,null));};var interaction_log=require(_0x959d('0x15'))(_0x959d('0x58'));exports[_0x959d('0x59')]=function(_0x5eb7d7,_0x32e2f4,_0x36fbcb){var _0x3ace1d={'agent':{},'channel':_0x959d('0x5a')};if(_0x5eb7d7[_0x959d('0x56')]['id']){delete _0x5eb7d7[_0x959d('0x56')]['id'];}_0x5eb7d7[_0x959d('0x56')][_0x959d('0x5b')]=!![];_0x5eb7d7[_0x959d('0x56')]['readAt']=moment()[_0x959d('0x5c')](_0x959d('0x5d'));_0x5eb7d7['body'][_0x959d('0x5e')]=_0x5eb7d7[_0x959d('0x56')][_0x959d('0x5e')]||_0x5eb7d7[_0x959d('0x5f')]['id'];_0x3ace1d[_0x959d('0x60')]['id']=_0x5eb7d7['body']['UserId'];return db['FaxMessage'][_0x959d('0x54')]({'where':{'id':_0x5eb7d7[_0x959d('0x51')]['id'],'UserId':null}})[_0x959d('0x35')](handleEntityNotFound(_0x32e2f4,null))[_0x959d('0x35')](saveUpdates(_0x5eb7d7[_0x959d('0x56')],null))['then'](function(_0x4645ed){if(_0x4645ed){_0x3ace1d[_0x959d('0x26')]=_0x4645ed[_0x959d('0x61')]({'plain':!![]});return db[_0x959d('0x62')]['find']({'where':{'id':_0x4645ed[_0x959d('0x63')]}});}return null;})[_0x959d('0x35')](handleEntityNotFound(_0x32e2f4,null))[_0x959d('0x35')](function(_0x15d471){if(_0x15d471){return _0x15d471[_0x959d('0x55')]({'UserId':_0x5eb7d7[_0x959d('0x56')][_0x959d('0x5e')],'read1stAt':_[_0x959d('0x64')](_0x15d471[_0x959d('0x65')])?moment()[_0x959d('0x5c')](_0x959d('0x5d')):undefined});}return null;})['then'](function(_0x116f75){if(_0x116f75){_0x3ace1d['interaction']=_0x116f75[_0x959d('0x61')]({'plain':!![]});interaction_log[_0x959d('0x21')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5eb7d7[_0x959d('0x5f')]['id'],_0x5eb7d7[_0x959d('0x5f')][_0x959d('0x3e')],_0x5eb7d7[_0x959d('0x5f')][_0x959d('0x66')],_0x3ace1d[_0x959d('0x67')]['id'],_0x5eb7d7[_0x959d('0x56')]?JSON[_0x959d('0x24')](_0x5eb7d7['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x959d('0x68'),_0x3ace1d);}return null;})[_0x959d('0x35')](function(_0x1241af){var _0xaf3f43=_0x959d('0x69')+_0x1241af[_0x959d('0x26')][_0x959d('0x6a')];return db['sequelize']['query'](_0xaf3f43,{'type':db[_0x959d('0x6b')][_0x959d('0x6c')][_0x959d('0x6d')],'raw':!![]})[_0x959d('0x35')](function(_0x1ca705){return _0x1ca705;});})[_0x959d('0x35')](function(_0x3c7319){if(_0x3c7319){_0x3ace1d[_0x959d('0x26')][_0x959d('0x6e')]=_0x3c7319[0x0];if(!_0x5eb7d7['body'][_0x959d('0x5e')])return;return db[_0x959d('0x6f')]['find']({'where':{'id':_0x5eb7d7[_0x959d('0x56')][_0x959d('0x5e')],'role':_0x959d('0x60')},'attributes':['id',_0x959d('0x3e'),'fullname',_0x959d('0x70'),_0x959d('0x71')],'raw':!![]});}return null;})[_0x959d('0x35')](function(_0x2b7d38){if(!_0x2b7d38)return null;_0x3ace1d[_0x959d('0x26')][_0x959d('0x60')]=_0x2b7d38;return _0x3ace1d;})[_0x959d('0x35')](function(_0xe2e6ac){if(_0xe2e6ac){if(_0x5eb7d7[_0x959d('0x56')][_0x959d('0x72')]){_0x3ace1d[_0x959d('0x26')][_0x959d('0x73')]=util[_0x959d('0x5c')]('SIP/%s',_0x5eb7d7['user'][_0x959d('0x3e')]);_0x3ace1d[_0x959d('0x26')][_0x959d('0x74')]=_0x3ace1d['channel'];_0x3ace1d[_0x959d('0x26')][_0x959d('0x75')]=_0x3ace1d[_0x959d('0x74')];_0x3ace1d[_0x959d('0x26')][_0x959d('0x76')]=_0x959d('0x59');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x959d('0x77'),'message':_0x3ace1d[_0x959d('0x26')]},client9002)['then'](function(){return _0x3ace1d;});}return _0x3ace1d;}return null;})[_0x959d('0x35')](respondWithResult(_0x32e2f4,null))[_0x959d('0x29')](handleError(_0x32e2f4,null));};var interaction_log=require(_0x959d('0x15'))('fax-interactions');exports['reject']=function(_0x2e11ae,_0x358ef1,_0x90e46e){var _0x1a046b={'agent':{},'channel':'fax'};if(_0x2e11ae['body']['id']){delete _0x2e11ae[_0x959d('0x56')]['id'];}_0x2e11ae[_0x959d('0x56')][_0x959d('0x5e')]=_0x2e11ae[_0x959d('0x56')][_0x959d('0x5e')]||_0x2e11ae['user']['id'];_0x1a046b[_0x959d('0x60')]['id']=_0x2e11ae[_0x959d('0x56')][_0x959d('0x5e')];return db[_0x959d('0x4c')]['find']({'where':{'id':_0x2e11ae[_0x959d('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x358ef1,null))[_0x959d('0x35')](function(_0xadeb08){if(_0xadeb08){_0x1a046b[_0x959d('0x26')]=_0xadeb08['get']({'plain':!![]});return db[_0x959d('0x62')]['find']({'where':{'id':_0xadeb08[_0x959d('0x63')]}});}return null;})[_0x959d('0x35')](handleEntityNotFound(_0x358ef1,null))['then'](function(_0x1c2662){if(_0x1c2662){_0x1a046b[_0x959d('0x67')]=_0x1c2662[_0x959d('0x61')]({'plain':!![]});interaction_log[_0x959d('0x21')](_0x959d('0x78'),_0x2e11ae[_0x959d('0x5f')]['id'],_0x2e11ae[_0x959d('0x5f')][_0x959d('0x3e')],_0x2e11ae[_0x959d('0x5f')][_0x959d('0x66')],_0x1a046b[_0x959d('0x67')]['id'],_0x2e11ae['body']?JSON[_0x959d('0x24')](_0x2e11ae[_0x959d('0x56')]):_0x959d('0x79'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1a046b);}return null;})[_0x959d('0x35')](function(_0x39a04e){var _0x5845ed=_0x959d('0x69')+_0x39a04e[_0x959d('0x26')][_0x959d('0x6a')];return db[_0x959d('0x7a')][_0x959d('0x3f')](_0x5845ed,{'type':db['Sequelize'][_0x959d('0x6c')][_0x959d('0x6d')],'raw':!![]})['then'](function(_0x506cb8){return _0x506cb8;});})['then'](function(_0x1cb9cc){if(_0x1cb9cc){_0x1a046b[_0x959d('0x26')][_0x959d('0x6e')]=_0x1cb9cc[0x0];if(!_0x2e11ae[_0x959d('0x56')][_0x959d('0x5e')])return;return db[_0x959d('0x6f')][_0x959d('0x54')]({'where':{'id':_0x2e11ae[_0x959d('0x56')][_0x959d('0x5e')],'role':_0x959d('0x60')},'attributes':['id',_0x959d('0x3e'),'fullname',_0x959d('0x70'),_0x959d('0x71')],'raw':!![]});}return null;})[_0x959d('0x35')](function(_0x1aa5a2){if(!_0x1aa5a2)return null;_0x1a046b['message'][_0x959d('0x60')]=_0x1aa5a2;return _0x1a046b;})[_0x959d('0x35')](function(_0x4f8a58){if(_0x4f8a58){_0x4f8a58[_0x959d('0x26')][_0x959d('0x73')]=util[_0x959d('0x5c')]('SIP/%s',_0x2e11ae['user']['name']);_0x4f8a58['message'][_0x959d('0x74')]=_0x1a046b['channel'];_0x4f8a58[_0x959d('0x26')][_0x959d('0x75')]=_0x1a046b['channel'];_0x4f8a58[_0x959d('0x26')]['event']=_0x959d('0x7b');respondWithRpcPromise(_0x959d('0x7c'),_0x959d('0x7c'),{'event':_0x959d('0x7d'),'message':_0x4f8a58[_0x959d('0x26')]},client9002);return _0x1a046b;}return null;})['then'](respondWithResult(_0x358ef1,null))[_0x959d('0x29')](handleError(_0x358ef1,null));};exports[_0x959d('0x7e')]=function(_0x1a9948,_0x550757){var _0x35c9cf;return db[_0x959d('0x4c')]['create'](_0x1a9948[_0x959d('0x56')],{})['then'](function(_0x8f159d){_0x35c9cf=_0x8f159d;return db[_0x959d('0x7f')]['findOne']({'where':{'id':_0x35c9cf[_0x959d('0x6a')]}});})[_0x959d('0x35')](function(_0x4e1cc9){if(_[_0x959d('0x64')](_0x4e1cc9)){return;}else{_0x35c9cf[_0x959d('0x5a')]=_0x4e1cc9['fax'];return db['Attachment'][_0x959d('0x80')]({'where':{'id':_0x35c9cf[_0x959d('0x81')]}});}})[_0x959d('0x35')](function(_0x597ee8){return respondWithRpcPromise('SendFax',_0x959d('0x82'),{'FaxAccountId':_[_0x959d('0x64')](_0x1a9948[_0x959d('0x56')])?undefined:_0x1a9948[_0x959d('0x56')]['FaxAccountId'],'path':_[_0x959d('0x64')](_0x597ee8)?undefined:util[_0x959d('0x5c')](_0x959d('0x83'),_0x597ee8[_0x959d('0x84')]),'fax':_[_0x959d('0x64')](_0x35c9cf[_0x959d('0x5a')])?undefined:_0x35c9cf['fax'],'AttachmentId':_0x35c9cf[_0x959d('0x81')]},client9002);})[_0x959d('0x35')](respondWithResult(_0x550757,0xc9))['catch'](handleError(_0x550757,null));};exports[_0x959d('0x85')]=function(_0x1b3772,_0x19c4cf){var _0x198666=path['join'](config[_0x959d('0x86')],_0x959d('0x87'),_0x959d('0x88'),_0x959d('0x89'));return db[_0x959d('0x4c')]['find']({'where':{'id':_0x1b3772[_0x959d('0x51')]['id']},'include':[{'model':db[_0x959d('0x8a')],'as':_0x959d('0x8a')}]})[_0x959d('0x35')](handleEntityNotFound(_0x19c4cf,null))[_0x959d('0x35')](function(_0x367635){if(_0x367635){return _0x19c4cf[_0x959d('0x85')](path[_0x959d('0x8b')](_0x198666,_0x367635[_0x959d('0x8a')][_0x959d('0x84')]));}})[_0x959d('0x29')](handleError(_0x19c4cf,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 2f13425..7319e10 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 _0xa49e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update'];(function(_0x1c85df,_0x5be2a6){var _0x582183=function(_0x36dc19){while(--_0x36dc19){_0x1c85df['push'](_0x1c85df['shift']());}};_0x582183(++_0x5be2a6);}(_0xa49e,0x1de));var _0xea49=function(_0x4734d8,_0x479950){_0x4734d8=_0x4734d8-0x0;var _0x3b1120=_0xa49e[_0x4734d8];return _0x3b1120;};'use strict';var EventEmitter=require(_0xea49('0x0'));var FaxMessage=require(_0xea49('0x1'))['db'][_0xea49('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xea49('0x3')](0x0);var events={'afterCreate':_0xea49('0x4'),'afterUpdate':_0xea49('0x5'),'afterDestroy':_0xea49('0x6')};function emitEvent(_0x228052){return function(_0x5e12d0,_0x2ef1ec,_0x439b3d){FaxMessageEvents[_0xea49('0x7')](_0x228052+':'+_0x5e12d0['id'],_0x5e12d0);FaxMessageEvents['emit'](_0x228052,_0x5e12d0);_0x439b3d(null);};}for(var e in events){if(events[_0xea49('0x8')](e)){var event=events[e];FaxMessage[_0xea49('0x9')](e,emitEvent(event));}}module[_0xea49('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0x11e5=['emit','hasOwnProperty','hook','events','FaxMessage','setMaxListeners','update','remove'];(function(_0x18e580,_0x33ad80){var _0x5e63ee=function(_0xa8d1a9){while(--_0xa8d1a9){_0x18e580['push'](_0x18e580['shift']());}};_0x5e63ee(++_0x33ad80);}(_0x11e5,0x8b));var _0x511e=function(_0x220fa9,_0x4255fb){_0x220fa9=_0x220fa9-0x0;var _0x518ed5=_0x11e5[_0x220fa9];return _0x518ed5;};'use strict';var EventEmitter=require(_0x511e('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x511e('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x511e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x511e('0x3'),'afterDestroy':_0x511e('0x4')};function emitEvent(_0x101e06){return function(_0x5cab33,_0x249e4d,_0x4fbd4f){FaxMessageEvents['emit'](_0x101e06+':'+_0x5cab33['id'],_0x5cab33);FaxMessageEvents[_0x511e('0x5')](_0x101e06,_0x5cab33);_0x4fbd4f(null);};}for(var e in events){if(events[_0x511e('0x6')](e)){var event=events[e];FaxMessage[_0x511e('0x7')](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 eedcd5d..4e9ab59 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 _0x987d=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','FaxInteraction','findOne','then','update','createdAt','catch'];(function(_0x4fecb6,_0x45ed64){var _0xa9a47=function(_0x4462bf){while(--_0x4462bf){_0x4fecb6['push'](_0x4fecb6['shift']());}};_0xa9a47(++_0x45ed64);}(_0x987d,0x111));var _0xd987=function(_0x4f28c6,_0x59e963){_0x4f28c6=_0x4f28c6-0x0;var _0x14347f=_0x987d[_0x4f28c6];return _0x14347f;};'use strict';var _=require(_0xd987('0x0'));var util=require(_0xd987('0x1'));var logger=require('../../config/logger')(_0xd987('0x2'));var moment=require(_0xd987('0x3'));var BPromise=require(_0xd987('0x4'));var rp=require(_0xd987('0x5'));var fs=require('fs');var path=require(_0xd987('0x6'));var rimraf=require(_0xd987('0x7'));var config=require('../../config/environment');var attributes=require(_0xd987('0x8'));module[_0xd987('0x9')]=function(_0x2fcf23,_0x259c10){return _0x2fcf23[_0xd987('0xa')](_0xd987('0xb'),attributes,{'tableName':_0xd987('0xc'),'paranoid':![],'indexes':[{'name':_0xd987('0xd'),'fields':[_0xd987('0xe')],'type':_0xd987('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdb30b0,_0x4e6e10,_0x3b83a3){var _0xfa357b=_0x2fcf23[_0xd987('0x10')];var _0x3a5ac3=_0xdb30b0['get']({'plain':!![]});if(_0x3a5ac3[_0xd987('0x11')][_0xd987('0x12')]()==='in'||_0x3a5ac3[_0xd987('0x11')][_0xd987('0x12')]()===_0xd987('0x13')&&!_0x3a5ac3['secret']&&!_[_0xd987('0x14')](_0x3a5ac3['UserId'])){_0xfa357b[_0xd987('0x15')][_0xd987('0x16')]({'where':{'id':_0x3a5ac3['FaxInteractionId']}})[_0xd987('0x17')](function(_0x5882cd){if(_0x5882cd){_0x5882cd[_0xd987('0x18')]({'lastMsgAt':_0x3a5ac3[_0xd987('0x19')],'lastMsgDirection':_0x3a5ac3[_0xd987('0x11')][_0xd987('0x12')]()});}})[_0xd987('0x1a')](function(_0x5cea06){console[_0xd987('0x1b')](_0x5cea06);});}_0x3b83a3();}},'charset':_0xd987('0x1c'),'collate':_0xd987('0x1d')});}; \ No newline at end of file +var _0xb254=['then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','./faxMessage.attributes','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','findOne','FaxInteractionId'];(function(_0x2cda24,_0x246d0a){var _0x4333d0=function(_0x32b0e7){while(--_0x32b0e7){_0x2cda24['push'](_0x2cda24['shift']());}};_0x4333d0(++_0x246d0a);}(_0xb254,0x69));var _0x4b25=function(_0x53d8e8,_0x19560b){_0x53d8e8=_0x53d8e8-0x0;var _0x47484f=_0xb254[_0x53d8e8];return _0x47484f;};'use strict';var _=require(_0x4b25('0x0'));var util=require('util');var logger=require(_0x4b25('0x1'))(_0x4b25('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4b25('0x3'));var fs=require('fs');var path=require(_0x4b25('0x4'));var rimraf=require(_0x4b25('0x5'));var config=require('../../config/environment');var attributes=require(_0x4b25('0x6'));module['exports']=function(_0x27e0c6,_0x240bf8){return _0x27e0c6['define']('FaxMessage',attributes,{'tableName':_0x4b25('0x7'),'paranoid':![],'indexes':[{'name':_0x4b25('0x8'),'fields':[_0x4b25('0x9')],'type':_0x4b25('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a66b1,_0x22b7cc,_0x1ae115){var _0x19da1f=_0x27e0c6[_0x4b25('0xb')];var _0x1cf041=_0x3a66b1[_0x4b25('0xc')]({'plain':!![]});if(_0x1cf041[_0x4b25('0xd')][_0x4b25('0xe')]()==='in'||_0x1cf041[_0x4b25('0xd')]['toLowerCase']()===_0x4b25('0xf')&&!_0x1cf041[_0x4b25('0x10')]&&!_['isNil'](_0x1cf041[_0x4b25('0x11')])){_0x19da1f['FaxInteraction'][_0x4b25('0x12')]({'where':{'id':_0x1cf041[_0x4b25('0x13')]}})[_0x4b25('0x14')](function(_0x5920ea){if(_0x5920ea){_0x5920ea[_0x4b25('0x15')]({'lastMsgAt':_0x1cf041['createdAt'],'lastMsgDirection':_0x1cf041[_0x4b25('0xd')][_0x4b25('0xe')]()});}})[_0x4b25('0x16')](function(_0x4ff6c6){console['error'](_0x4ff6c6);});}_0x1ae115();}},'charset':_0x4b25('0x17'),'collate':_0x4b25('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b6fb2d6..fa4acab 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 _0x17ba=['CreateFaxMessage','FaxMessage','create','options','raw','info','UpdateFaxMessage','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x396601,_0x317c93){var _0x313234=function(_0x379b88){while(--_0x379b88){_0x396601['push'](_0x396601['shift']());}};_0x313234(++_0x317c93);}(_0x17ba,0xab));var _0xa17b=function(_0x50e70d,_0x3fd220){_0x50e70d=_0x50e70d-0x0;var _0x2b6b19=_0x17ba[_0x50e70d];return _0x2b6b19;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});config[_0xa17b('0xd')]=_[_0xa17b('0xe')](config[_0xa17b('0xd')],{'host':_0xa17b('0xf'),'port':0x18eb});var socket=require(_0xa17b('0x10'))(new Redis(config[_0xa17b('0xd')]));require(_0xa17b('0x11'))[_0xa17b('0x12')](socket);function respondWithRpcPromise(_0x578799,_0x2556c4,_0x38b8f1){return new BPromise(function(_0x322dc0,_0x1e799a){return client[_0xa17b('0x13')](_0x578799,_0x38b8f1)[_0xa17b('0x14')](function(_0xc5ef2e){logger['info'](_0xa17b('0x15'),_0x2556c4,_0xa17b('0x16'));logger[_0xa17b('0x17')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'),JSON[_0xa17b('0x18')](_0xc5ef2e));if(_0xc5ef2e[_0xa17b('0x19')]){if(_0xc5ef2e[_0xa17b('0x19')]['code']===0x1f4){logger[_0xa17b('0x19')]('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xc5ef2e[_0xa17b('0x19')][_0xa17b('0x1a')]);return _0x1e799a(_0xc5ef2e['error'][_0xa17b('0x1a')]);}logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0xc5ef2e[_0xa17b('0x19')]['message']);return _0x322dc0(_0xc5ef2e[_0xa17b('0x19')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'));_0x322dc0(_0xc5ef2e[_0xa17b('0x1b')]['message']);}})[_0xa17b('0x1c')](function(_0x166d44){logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0x166d44);_0x1e799a(_0x166d44);});});}exports[_0xa17b('0x1d')]=function(_0x1ecaa2){var _0x24afc2=this;return new Promise(function(_0x584a0a,_0x610c2b){return db[_0xa17b('0x1e')][_0xa17b('0x1f')](_0x1ecaa2['body'],{'raw':_0x1ecaa2[_0xa17b('0x20')]?_0x1ecaa2[_0xa17b('0x20')][_0xa17b('0x21')]===undefined?!![]:![]:!![]})[_0xa17b('0x14')](function(_0x3c7ec2){logger[_0xa17b('0x22')]('CreateFaxMessage',_0x1ecaa2);logger[_0xa17b('0x17')]('CreateFaxMessage',_0x1ecaa2,JSON[_0xa17b('0x18')](_0x3c7ec2));_0x584a0a(_0x3c7ec2);})[_0xa17b('0x1c')](function(_0x4ba608){logger['error'](_0xa17b('0x1d'),_0x4ba608[_0xa17b('0x1a')],_0x1ecaa2);_0x610c2b(_0x24afc2[_0xa17b('0x19')](0x1f4,_0x4ba608[_0xa17b('0x1a')]));});});};exports[_0xa17b('0x23')]=function(_0x3a64f5){var _0x4cd38e=this;return new Promise(function(_0x47aff8,_0x5c98fe){return db['FaxMessage'][_0xa17b('0x24')](_0x3a64f5['body'],{'raw':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5['options'][_0xa17b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x25')]||null:null,'attributes':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x26')]||null:null,'limit':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x27')]||null:null})[_0xa17b('0x14')](function(_0x573585){logger['info']('UpdateFaxMessage',_0x3a64f5);logger[_0xa17b('0x17')](_0xa17b('0x23'),_0x3a64f5,JSON[_0xa17b('0x18')](_0x573585));_0x47aff8(_0x573585);})[_0xa17b('0x1c')](function(_0x16dd1f){logger[_0xa17b('0x19')](_0xa17b('0x23'),_0x16dd1f[_0xa17b('0x1a')],_0x3a64f5);_0x5c98fe(_0x4cd38e['error'](0x1f4,_0x16dd1f[_0xa17b('0x1a')]));});});}; \ No newline at end of file +var _0x4c4e=['localhost','socket.io-emitter','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','debug','stringify','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x322d60,_0x25339b){var _0x476ef1=function(_0x231973){while(--_0x231973){_0x322d60['push'](_0x322d60['shift']());}};_0x476ef1(++_0x25339b);}(_0x4c4e,0x152));var _0xe4c4=function(_0x31a806,_0x1682d6){_0x31a806=_0x31a806-0x0;var _0x1b767b=_0x4c4e[_0x31a806];return _0x1b767b;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});config[_0xe4c4('0xa')]=_[_0xe4c4('0xb')](config[_0xe4c4('0xa')],{'host':_0xe4c4('0xc'),'port':0x18eb});var socket=require(_0xe4c4('0xd'))(new Redis(config[_0xe4c4('0xa')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x31f879,_0x6f2545,_0x27ad42){return new BPromise(function(_0x1bc786,_0x333c08){return client[_0xe4c4('0xe')](_0x31f879,_0x27ad42)['then'](function(_0x303d89){logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));logger['debug'](_0xe4c4('0x12'),_0x6f2545,_0xe4c4('0x11'),JSON['stringify'](_0x303d89));if(_0x303d89[_0xe4c4('0x13')]){if(_0x303d89[_0xe4c4('0x13')]['code']===0x1f4){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89['error'][_0xe4c4('0x14')]);return _0x333c08(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);return _0x1bc786(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}else{logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));_0x1bc786(_0x303d89[_0xe4c4('0x15')][_0xe4c4('0x14')]);}})[_0xe4c4('0x16')](function(_0x5a32b5){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x5a32b5);_0x333c08(_0x5a32b5);});});}exports[_0xe4c4('0x17')]=function(_0x317cc8){var _0x5da165=this;return new Promise(function(_0x3d5856,_0x1cad5d){return db[_0xe4c4('0x18')][_0xe4c4('0x19')](_0x317cc8[_0xe4c4('0x1a')],{'raw':_0x317cc8[_0xe4c4('0x1b')]?_0x317cc8[_0xe4c4('0x1b')][_0xe4c4('0x1c')]===undefined?!![]:![]:!![]})[_0xe4c4('0x1d')](function(_0x1a7690){logger[_0xe4c4('0xf')](_0xe4c4('0x17'),_0x317cc8);logger[_0xe4c4('0x1e')](_0xe4c4('0x17'),_0x317cc8,JSON[_0xe4c4('0x1f')](_0x1a7690));_0x3d5856(_0x1a7690);})['catch'](function(_0x49cadc){logger[_0xe4c4('0x13')]('CreateFaxMessage',_0x49cadc[_0xe4c4('0x14')],_0x317cc8);_0x1cad5d(_0x5da165['error'](0x1f4,_0x49cadc[_0xe4c4('0x14')]));});});};exports['UpdateFaxMessage']=function(_0x34d667){var _0x583393=this;return new Promise(function(_0xba53ef,_0x4a0199){return db['FaxMessage']['update'](_0x34d667['body'],{'raw':_0x34d667[_0xe4c4('0x1b')]?_0x34d667['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d667[_0xe4c4('0x1b')]?_0x34d667[_0xe4c4('0x1b')]['where']||null:null,'attributes':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x20')]||null:null,'limit':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x21')]||null:null})[_0xe4c4('0x1d')](function(_0x48060e){logger['info'](_0xe4c4('0x22'),_0x34d667);logger[_0xe4c4('0x1e')](_0xe4c4('0x22'),_0x34d667,JSON[_0xe4c4('0x1f')](_0x48060e));_0xba53ef(_0x48060e);})['catch'](function(_0x49c913){logger[_0xe4c4('0x13')](_0xe4c4('0x22'),_0x49c913['message'],_0x34d667);_0x4a0199(_0x583393[_0xe4c4('0x13')](0x1f4,_0x49c913[_0xe4c4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b4f9229..64cc522 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 _0x6046=['remove','update','emit','register','length','faxMessage:','./faxMessage.events'];(function(_0x29b94c,_0x1211ef){var _0x514002=function(_0x407689){while(--_0x407689){_0x29b94c['push'](_0x29b94c['shift']());}};_0x514002(++_0x1211ef);}(_0x6046,0x1cd));var _0x6604=function(_0x424335,_0x397e71){_0x424335=_0x424335-0x0;var _0x3e38c1=_0x6046[_0x424335];return _0x3e38c1;};'use strict';var FaxMessageEvents=require(_0x6604('0x0'));var events=['save',_0x6604('0x1'),_0x6604('0x2')];function createListener(_0x361725,_0x2c928c){return function(_0x335532){_0x2c928c[_0x6604('0x3')](_0x361725,_0x335532);};}function removeListener(_0xce4242,_0x1b4551){return function(){FaxMessageEvents['removeListener'](_0xce4242,_0x1b4551);};}exports[_0x6604('0x4')]=function(_0x5f099e){for(var _0x536f0b=0x0,_0x5b7700=events[_0x6604('0x5')];_0x536f0b<_0x5b7700;_0x536f0b++){var _0xcdc366=events[_0x536f0b];var _0x6ad37e=createListener(_0x6604('0x6')+_0xcdc366,_0x5f099e);FaxMessageEvents['on'](_0xcdc366,_0x6ad37e);}}; \ No newline at end of file +var _0xe149=['remove','removeListener','save'];(function(_0x2607f9,_0x168291){var _0x1dcb40=function(_0x3c6ca1){while(--_0x3c6ca1){_0x2607f9['push'](_0x2607f9['shift']());}};_0x1dcb40(++_0x168291);}(_0xe149,0x128));var _0x9e14=function(_0x4c47e5,_0x2794a5){_0x4c47e5=_0x4c47e5-0x0;var _0x44776e=_0xe149[_0x4c47e5];return _0x44776e;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x9e14('0x0'),_0x9e14('0x1'),'update'];function createListener(_0x576bb4,_0x4f23e8){return function(_0x4168fd){_0x4f23e8['emit'](_0x576bb4,_0x4168fd);};}function removeListener(_0x29b9ec,_0x2a55c9){return function(){FaxMessageEvents[_0x9e14('0x2')](_0x29b9ec,_0x2a55c9);};}exports['register']=function(_0x35caea){for(var _0x45cdca=0x0,_0x375c93=events['length'];_0x45cdca<_0x375c93;_0x45cdca++){var _0x150c93=events[_0x45cdca];var _0x4af936=createListener('faxMessage:'+_0x150c93,_0x35caea);FaxMessageEvents['on'](_0x150c93,_0x4af936);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 42029a6..5312f18 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 _0x3c81=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','connect-timeout','express','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4961e0,_0x45e806){var _0x21882f=function(_0x42aa1b){while(--_0x42aa1b){_0x4961e0['push'](_0x4961e0['shift']());}};_0x21882f(++_0x45e806);}(_0x3c81,0x102));var _0x13c8=function(_0x27d3c8,_0x55e0f0){_0x27d3c8=_0x27d3c8-0x0;var _0x3ac8be=_0x3c81[_0x27d3c8];return _0x3ac8be;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('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(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')]('/',auth[_0x13c8('0x7')](),interaction[_0x13c8('0x10')](_0x13c8('0x11'),_0x13c8('0x12')),controller[_0x13c8('0x13')]);router[_0x13c8('0x14')]('/:id',auth[_0x13c8('0x7')](),controller[_0x13c8('0x15')]);router[_0x13c8('0x14')](_0x13c8('0x16'),auth['isAuthenticated'](),controller[_0x13c8('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x13c8('0x18')]);router['delete'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x19')]);module[_0x13c8('0x1a')]=router; \ No newline at end of file +var _0x55e0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','fs-extra'];(function(_0xfab45b,_0x33915f){var _0x278012=function(_0x31059d){while(--_0x31059d){_0xfab45b['push'](_0xfab45b['shift']());}};_0x278012(++_0x33915f);}(_0x55e0,0xdc));var _0x055e=function(_0x1c69e5,_0x47e57b){_0x1c69e5=_0x1c69e5-0x0;var _0x3e792a=_0x55e0[_0x1c69e5];return _0x3e792a;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/describe',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['show']);router[_0x055e('0x9')](_0x055e('0xd'),auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x055e('0x10'),'faxmessage:create'),controller[_0x055e('0x11')]);router[_0x055e('0x12')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller[_0x055e('0x13')]);router[_0x055e('0x12')](_0x055e('0x14'),auth['isAuthenticated'](),controller[_0x055e('0x15')]);router[_0x055e('0x12')](_0x055e('0x16'),auth[_0x055e('0xa')](),controller[_0x055e('0x17')]);router['delete'](_0x055e('0xc'),auth[_0x055e('0xa')](),controller[_0x055e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 91bf5f3..935ea63 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 _0x6de6=['name','INTEGER','ENUM','sequelize','STRING'];(function(_0x5c960e,_0x3caa6b){var _0x34694b=function(_0xcbaa71){while(--_0xcbaa71){_0x5c960e['push'](_0x5c960e['shift']());}};_0x34694b(++_0x3caa6b);}(_0x6de6,0x19d));var _0x66de=function(_0x4fb955,_0x481977){_0x4fb955=_0x4fb955-0x0;var _0x4f9797=_0x6de6[_0x4fb955];return _0x4f9797;};'use strict';var Sequelize=require(_0x66de('0x0'));module['exports']={'name':{'type':Sequelize[_0x66de('0x1')],'unique':_0x66de('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x66de('0x1')]},'timeout':{'type':Sequelize[_0x66de('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x66de('0x4')]('rrmemory','beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x66de('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2f61=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x38be23,_0x559d0b){var _0xf1f969=function(_0xa02d70){while(--_0xa02d70){_0x38be23['push'](_0x38be23['shift']());}};_0xf1f969(++_0x559d0b);}(_0x2f61,0x15c));var _0x12f6=function(_0x559646,_0x1a1f0f){_0x559646=_0x559646-0x0;var _0x3b44ca=_0x2f61[_0x559646];return _0x3b44ca;};'use strict';var Sequelize=require(_0x12f6('0x0'));module[_0x12f6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x12f6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x12f6('0x3')]},'timeout':{'type':Sequelize[_0x12f6('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x12f6('0x5')](_0x12f6('0x6'),_0x12f6('0x7'),_0x12f6('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x12f6('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 82ae569..294305d 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 _0x75dd=['intersection','attributes','fields','length','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','filters','hasOwnProperty','order','sort','FaxQueueId','filter','options','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','nolimit','addTeams','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','compact','transaction','removeTeams','ids','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','get','FaxQueues','UserProfileResource','stack','name','map','FaxQueue','rawAttributes','fieldName','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x75dd,0x1c9));var _0xd75d=function(_0x81af13,_0x105f23){_0x81af13=_0x81af13-0x0;var _0x123745=_0x75dd[_0x81af13];return _0x123745;};'use strict';var BPromise=require(_0xd75d('0x0'));var util=require(_0xd75d('0x1'));var _=require(_0xd75d('0x2'));var squel=require(_0xd75d('0x3'));var Redis=require(_0xd75d('0x4'));var qs=require(_0xd75d('0x5'));var logger=require('../../config/logger')(_0xd75d('0x6'));var config=require(_0xd75d('0x7'));var db=require(_0xd75d('0x8'))['db'];config[_0xd75d('0x9')]=_[_0xd75d('0xa')](config[_0xd75d('0x9')],{'host':_0xd75d('0xb'),'port':0x18eb});var socket=require(_0xd75d('0xc'))(new Redis(config['redis']));require(_0xd75d('0xd'))[_0xd75d('0xe')](socket);function respondWithStatusCode(_0x22b9f1,_0xd24f6b){_0xd24f6b=_0xd24f6b||0xcc;return function(_0x51ff92){if(_0x51ff92){return _0x22b9f1[_0xd75d('0xf')](_0xd24f6b);}return _0x22b9f1[_0xd75d('0x10')](_0xd24f6b)[_0xd75d('0x11')]();};}function respondWithResult(_0x216f91,_0x79e229){_0x79e229=_0x79e229||0xc8;return function(_0x34db4e){if(_0x34db4e){return _0x216f91[_0xd75d('0x10')](_0x79e229)[_0xd75d('0x12')](_0x34db4e);}};}function respondWithFilteredResult(_0x4d5ec1,_0x6104ef){return function(_0x1b325e){if(_0x1b325e){var _0x5e1fbf=typeof _0x6104ef[_0xd75d('0x13')]===_0xd75d('0x14')&&typeof _0x6104ef['limit']===_0xd75d('0x14');var _0x44164=_0x1b325e['count'];var _0x5d9e8c=_0x5e1fbf?0x0:_0x6104ef[_0xd75d('0x13')];var _0x3082bc=_0x5e1fbf?_0x1b325e[_0xd75d('0x15')]:_0x6104ef['offset']+_0x6104ef[_0xd75d('0x16')];var _0x5e0658;if(_0x3082bc>=_0x44164){_0x3082bc=_0x44164;_0x5e0658=0xc8;}else{_0x5e0658=0xce;}_0x4d5ec1['status'](_0x5e0658);return _0x4d5ec1['set'](_0xd75d('0x17'),_0x5d9e8c+'-'+_0x3082bc+'/'+_0x44164)[_0xd75d('0x12')](_0x1b325e);}return null;};}function saveUpdates(_0x5b1c56){return function(_0x5941c2){if(_0x5941c2){return _0x5941c2[_0xd75d('0x18')](_0x5b1c56)[_0xd75d('0x19')](function(_0xb86bbf){return _0xb86bbf;});}return null;};}function removeEntity(_0x53d05b){return function(_0x114b03){if(_0x114b03){return _0x114b03['destroy']()[_0xd75d('0x19')](function(){var _0x3c6ee2=_0x114b03[_0xd75d('0x1a')]({'plain':!![]});var _0x27b536=_0xd75d('0x1b');return db[_0xd75d('0x1c')]['destroy']({'where':{'type':_0x27b536,'resourceId':_0x3c6ee2['id']}})[_0xd75d('0x19')](function(){return _0x114b03;});})[_0xd75d('0x19')](function(){_0x53d05b[_0xd75d('0x10')](0xcc)[_0xd75d('0x11')]();});}};}function handleEntityNotFound(_0x2cc214){return function(_0x13ec15){if(!_0x13ec15){_0x2cc214[_0xd75d('0xf')](0x194);}return _0x13ec15;};}function handleError(_0x5e1e36,_0x67f1b5){_0x67f1b5=_0x67f1b5||0x1f4;return function(_0x3cef5e){logger['error'](_0x3cef5e[_0xd75d('0x1d')]);if(_0x3cef5e[_0xd75d('0x1e')]){delete _0x3cef5e[_0xd75d('0x1e')];}_0x5e1e36[_0xd75d('0x10')](_0x67f1b5)['send'](_0x3cef5e);};}exports['index']=function(_0x475ae4,_0xbc4bd4){var _0x3db450={};var _0x5c0f97={'count':0x0,'rows':[]};var _0x165acb=_[_0xd75d('0x1f')](db[_0xd75d('0x20')][_0xd75d('0x21')],function(_0x1945b5){return{'name':_0x1945b5[_0xd75d('0x22')],'type':_0x1945b5[_0xd75d('0x23')]['key']};});_0x3db450=qs[_0xd75d('0x24')](_0x165acb,_0x475ae4);var _0x544caf={'where':_0x3db450[_0xd75d('0x25')]};return db['FaxQueue']['count'](_0x544caf)[_0xd75d('0x19')](function(_0x4baa60){_0x5c0f97['count']=_0x4baa60;_0x3db450[_0xd75d('0x26')]=qs[_0xd75d('0x26')](_0x475ae4[_0xd75d('0x27')]);return db['FaxQueue'][_0xd75d('0x28')](_0x3db450);})[_0xd75d('0x19')](function(_0x39d434){_0x5c0f97[_0xd75d('0x29')]=_0x39d434;return _0x5c0f97;})['then'](respondWithFilteredResult(_0xbc4bd4,_0x3db450))[_0xd75d('0x2a')](handleError(_0xbc4bd4,null));};exports[_0xd75d('0x2b')]=function(_0x20b352,_0x54a074){var _0x42bbec={'raw':!![],'where':{'id':_0x20b352[_0xd75d('0x2c')]['id']}},_0x5bf955={};_0x5bf955[_0xd75d('0x2d')]=_[_0xd75d('0x2e')](db[_0xd75d('0x20')][_0xd75d('0x21')]);_0x5bf955[_0xd75d('0x27')]=_[_0xd75d('0x2e')](_0x20b352[_0xd75d('0x27')]);_0x5bf955['filters']=_[_0xd75d('0x2f')](_0x5bf955[_0xd75d('0x2d')],_0x5bf955[_0xd75d('0x27')]);_0x42bbec[_0xd75d('0x30')]=_[_0xd75d('0x2f')](_0x5bf955['model'],qs[_0xd75d('0x31')](_0x20b352[_0xd75d('0x27')][_0xd75d('0x31')]));_0x42bbec[_0xd75d('0x30')]=_0x42bbec['attributes'][_0xd75d('0x32')]?_0x42bbec[_0xd75d('0x30')]:_0x5bf955[_0xd75d('0x2d')];if(_0x20b352[_0xd75d('0x27')]['includeAll']){_0x42bbec[_0xd75d('0x26')]=[{'all':!![]}];}_0x42bbec=_[_0xd75d('0x33')]({},_0x42bbec,_0x20b352['options']);return db['FaxQueue'][_0xd75d('0x34')](_0x42bbec)['then'](handleEntityNotFound(_0x54a074,null))[_0xd75d('0x19')](respondWithResult(_0x54a074,null))[_0xd75d('0x2a')](handleError(_0x54a074,null));};exports[_0xd75d('0x35')]=function(_0x3b99be,_0x95ee5b){return db[_0xd75d('0x20')][_0xd75d('0x35')](_0x3b99be[_0xd75d('0x36')],{})['then'](function(_0x90e78f){var _0x2fa136=_0x3b99be['user'][_0xd75d('0x1a')]({'plain':!![]});if(!_0x2fa136)throw new Error(_0xd75d('0x37'));if(_0x2fa136[_0xd75d('0x38')]===_0xd75d('0x39')){var _0x486597=_0x90e78f[_0xd75d('0x1a')]({'plain':!![]});var _0x2a5cbe=_0xd75d('0x1b');return db[_0xd75d('0x3a')][_0xd75d('0x34')]({'where':{'name':_0x2a5cbe,'userProfileId':_0x2fa136[_0xd75d('0x3b')]},'raw':!![]})['then'](function(_0x4a3ac6){if(_0x4a3ac6&&_0x4a3ac6['autoAssociation']===0x0){return db[_0xd75d('0x1c')][_0xd75d('0x35')]({'name':_0x486597['name'],'resourceId':_0x486597['id'],'type':_0x4a3ac6[_0xd75d('0x1e')],'sectionId':_0x4a3ac6['id']},{})[_0xd75d('0x19')](function(){return _0x90e78f;});}else{return _0x90e78f;}})[_0xd75d('0x2a')](function(_0x5d9b57){logger[_0xd75d('0x3c')](_0xd75d('0x3d'),_0x5d9b57);throw _0x5d9b57;});}return _0x90e78f;})[_0xd75d('0x19')](respondWithResult(_0x95ee5b,0xc9))[_0xd75d('0x2a')](handleError(_0x95ee5b,null));};exports[_0xd75d('0x18')]=function(_0x1b53f4,_0x4f14bd){if(_0x1b53f4[_0xd75d('0x36')]['id']){delete _0x1b53f4[_0xd75d('0x36')]['id'];}return db[_0xd75d('0x20')]['find']({'where':{'id':_0x1b53f4[_0xd75d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4f14bd,null))[_0xd75d('0x19')](saveUpdates(_0x1b53f4[_0xd75d('0x36')],null))['then'](respondWithResult(_0x4f14bd,null))[_0xd75d('0x2a')](handleError(_0x4f14bd,null));};exports[_0xd75d('0x3e')]=function(_0x1ab30b,_0x5f0b54){return db[_0xd75d('0x20')][_0xd75d('0x34')]({'where':{'id':_0x1ab30b[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x5f0b54,null))['then'](removeEntity(_0x5f0b54,null))[_0xd75d('0x2a')](handleError(_0x5f0b54,null));};exports['describe']=function(_0x48ef4f,_0x460294){return db[_0xd75d('0x20')][_0xd75d('0x3f')]()['then'](respondWithResult(_0x460294,null))['catch'](handleError(_0x460294,null));};exports[_0xd75d('0x40')]=function(_0x2c5026,_0x2928bd){var _0x4e9e01={'raw':!![],'where':{}},_0x532c23={},_0x1364bd;return db[_0xd75d('0x20')][_0xd75d('0x41')]({'where':{'id':_0x2c5026[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x2928bd,null))[_0xd75d('0x19')](function(_0x26e565){if(_0x26e565){_0x1364bd=_0x26e565[_0xd75d('0x1a')]({'plain':!![]});_0x532c23[_0xd75d('0x2d')]=_[_0xd75d('0x2e')](db['UserFaxQueue'][_0xd75d('0x21')]);_0x532c23[_0xd75d('0x27')]=_[_0xd75d('0x2e')](_0x2c5026['query']);_0x532c23[_0xd75d('0x42')]=_[_0xd75d('0x2f')](_0x532c23['model'],_0x532c23[_0xd75d('0x27')]);_0x4e9e01[_0xd75d('0x30')]=_[_0xd75d('0x2f')](_0x532c23['model'],qs[_0xd75d('0x31')](_0x2c5026[_0xd75d('0x27')][_0xd75d('0x31')]));_0x4e9e01[_0xd75d('0x30')]=_0x4e9e01[_0xd75d('0x30')][_0xd75d('0x32')]?_0x4e9e01[_0xd75d('0x30')]:_0x532c23[_0xd75d('0x2d')];if(!_0x2c5026[_0xd75d('0x27')][_0xd75d('0x43')]('nolimit')){_0x4e9e01[_0xd75d('0x16')]=qs[_0xd75d('0x16')](_0x2c5026[_0xd75d('0x27')][_0xd75d('0x16')]);_0x4e9e01[_0xd75d('0x13')]=qs[_0xd75d('0x13')](_0x2c5026[_0xd75d('0x27')][_0xd75d('0x13')]);}_0x4e9e01[_0xd75d('0x44')]=qs['sort'](_0x2c5026[_0xd75d('0x27')][_0xd75d('0x45')]);_0x4e9e01[_0xd75d('0x25')]=qs[_0xd75d('0x42')](_['pick'](_0x2c5026['query'],_0x532c23['filters']));_0x4e9e01[_0xd75d('0x25')][_0xd75d('0x46')]=_0x26e565['id'];if(_0x2c5026[_0xd75d('0x27')][_0xd75d('0x47')]){_0x4e9e01[_0xd75d('0x25')]=_[_0xd75d('0x33')](_0x4e9e01['where'],{'$or':_[_0xd75d('0x1f')](_0x4e9e01[_0xd75d('0x30')],function(_0x1e653f){var _0x24656d={};_0x24656d[_0x1e653f]={'$like':'%'+_0x2c5026[_0xd75d('0x27')]['filter']+'%'};return _0x24656d;})});}_0x4e9e01=_['merge']({},_0x4e9e01,_0x2c5026[_0xd75d('0x48')]);return db[_0xd75d('0x49')][_0xd75d('0x28')](_0x4e9e01);}})['then'](function(_0x4ccc35){if(_0x4ccc35){return db[_0xd75d('0x4a')][_0xd75d('0x4b')]({'where':{'id':_[_0xd75d('0x1f')](_0x4ccc35,_0xd75d('0x4c')),'role':_0xd75d('0x4d')},'attributes':['id',_0xd75d('0x1e'),_0xd75d('0x4e'),_0xd75d('0x4f'),'createdAt']});}})[_0xd75d('0x19')](function(_0x36f7df){if(_0x36f7df){return{'count':_0x36f7df[_0xd75d('0x15')],'rows':_[_0xd75d('0x1f')](_0x36f7df['rows'],function(_0x1bc506){return{'membername':_0x1bc506[_0xd75d('0x1e')],'UserId':_0x1bc506['id'],'queue_name':_0x1364bd[_0xd75d('0x1e')],'FaxQueueId':_0x1364bd['id'],'interface':util[_0xd75d('0x50')](_0xd75d('0x51'),_0xd75d('0x52'),_0x1bc506['name']),'penalty':0x0,'paused':_0x1bc506[_0xd75d('0x4e')],'createdAt':_0x1bc506[_0xd75d('0x53')],'updatedAt':_0x1bc506[_0xd75d('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2928bd,_0x4e9e01))[_0xd75d('0x2a')](handleError(_0x2928bd,null));};exports[_0xd75d('0x54')]=function(_0x13b450,_0x110a3d){var _0x1f2ab4={};var _0x1c71c1={};var _0xe7c0b1;var _0x290c97;return db[_0xd75d('0x20')][_0xd75d('0x41')]({'where':{'id':_0x13b450[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x110a3d,null))[_0xd75d('0x19')](function(_0x3817cb){if(_0x3817cb){_0xe7c0b1=_0x3817cb;_0x1c71c1[_0xd75d('0x2d')]=_[_0xd75d('0x2e')](db[_0xd75d('0x55')][_0xd75d('0x21')]);_0x1c71c1['query']=_[_0xd75d('0x2e')](_0x13b450[_0xd75d('0x27')]);_0x1c71c1['filters']=_[_0xd75d('0x2f')](_0x1c71c1[_0xd75d('0x2d')],_0x1c71c1['query']);_0x1f2ab4[_0xd75d('0x30')]=_['intersection'](_0x1c71c1['model'],qs[_0xd75d('0x31')](_0x13b450['query'][_0xd75d('0x31')]));_0x1f2ab4['attributes']=_0x1f2ab4[_0xd75d('0x30')][_0xd75d('0x32')]?_0x1f2ab4[_0xd75d('0x30')]:_0x1c71c1[_0xd75d('0x2d')];_0x1f2ab4[_0xd75d('0x44')]=qs[_0xd75d('0x45')](_0x13b450['query'][_0xd75d('0x45')]);_0x1f2ab4[_0xd75d('0x25')]=qs[_0xd75d('0x42')](_['pick'](_0x13b450[_0xd75d('0x27')],_0x1c71c1['filters']));if(_0x13b450[_0xd75d('0x27')][_0xd75d('0x47')]){_0x1f2ab4[_0xd75d('0x25')]=_['merge'](_0x1f2ab4['where'],{'$or':_[_0xd75d('0x1f')](_0x1f2ab4[_0xd75d('0x30')],function(_0x322785){var _0x5db064={};_0x5db064[_0x322785]={'$like':'%'+_0x13b450[_0xd75d('0x27')]['filter']+'%'};return _0x5db064;})});}_0x1f2ab4=_['merge']({},_0x1f2ab4,_0x13b450['options']);return _0xe7c0b1[_0xd75d('0x54')](_0x1f2ab4);}})[_0xd75d('0x19')](function(_0xbd400d){if(_0xbd400d){_0x290c97=_0xbd400d[_0xd75d('0x32')];if(!_0x13b450[_0xd75d('0x27')][_0xd75d('0x43')](_0xd75d('0x56'))){_0x1f2ab4[_0xd75d('0x16')]=qs[_0xd75d('0x16')](_0x13b450['query'][_0xd75d('0x16')]);_0x1f2ab4[_0xd75d('0x13')]=qs['offset'](_0x13b450[_0xd75d('0x27')][_0xd75d('0x13')]);}return _0xe7c0b1[_0xd75d('0x54')](_0x1f2ab4);}})[_0xd75d('0x19')](function(_0x2f3c87){if(_0x2f3c87){return _0x2f3c87?{'count':_0x290c97,'rows':_0x2f3c87}:null;}})['then'](respondWithResult(_0x110a3d,null))[_0xd75d('0x2a')](handleError(_0x110a3d,null));};exports[_0xd75d('0x57')]=function(_0x588f0a,_0x118979){var _0x4a5938=_0x588f0a[_0xd75d('0x36')]['ids'];return db[_0xd75d('0x55')][_0xd75d('0x28')]({'where':{'id':_0x4a5938},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xd75d('0x1e'),'online',_0xd75d('0x58'),_0xd75d('0x59')],'raw':!![]}]})['then'](function(_0x5b8db8){if(_0x5b8db8){var _0x4cae32=_[_0xd75d('0x5a')](_0x5b8db8,function(_0x2ff75d){var _0x1ba11f=_0x2ff75d[_0xd75d('0x1a')]({'plain':!![]});return _0x1ba11f[_0xd75d('0x5b')];});return db[_0xd75d('0x20')][_0xd75d('0x34')]({'where':{'id':_0x588f0a[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](function(_0x1cc2c1){return db[_0xd75d('0x5c')]['transaction'](function(_0x3e0abd){return _0x1cc2c1['addTeams'](_0x4a5938,{'transaction':_0x3e0abd})[_0xd75d('0x19')](function(){return BPromise[_0xd75d('0x5d')](_0x4cae32,function(_0x76480d){return db[_0xd75d('0x49')][_0xd75d('0x5e')]({'where':{'UserId':_0x76480d['id'],'FaxQueueId':_0x588f0a[_0xd75d('0x2c')]['id']},'transaction':_0x3e0abd});});})[_0xd75d('0x19')](function(){_0x4cae32[_0xd75d('0x5f')](function(_0x5b6d74){socket[_0xd75d('0x60')](_0xd75d('0x61'),{'UserId':_0x5b6d74['id'],'FaxQueueId':_0x1cc2c1['id']});});});});});}})[_0xd75d('0x19')](respondWithStatusCode(_0x118979,null))[_0xd75d('0x2a')](handleError(_0x118979,null));};exports['removeTeams']=function(_0x59cda6,_0x1d43ab){return db[_0xd75d('0x55')][_0xd75d('0x28')]({'where':{'id':_0x59cda6[_0xd75d('0x27')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd75d('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xd75d('0x19')](handleEntityNotFound(_0x1d43ab,null))[_0xd75d('0x19')](function(_0x1ca1c6){var _0x637ca1=_[_0xd75d('0x1f')](_0x1ca1c6,'id');var _0x3ae246=[];var _0x2abb7e=[];var _0xa48a21=squel['select']();_0xa48a21[_0xd75d('0x62')](_0xd75d('0x63'))[_0xd75d('0x64')](_0xd75d('0x65'),'tq')[_0xd75d('0x66')](_0xd75d('0x67'),'ut',_0xd75d('0x68'))['where'](_0xd75d('0x69'),_0x59cda6[_0xd75d('0x2c')]['id']);for(var _0x365697=0x0;_0x365697<_0x1ca1c6[_0xd75d('0x32')];_0x365697+=0x1){let _0x41c6ad=_0x1ca1c6[_0x365697];for(var _0x4781af=0x0;_0x4781af<_0x41c6ad['Agents']['length'];_0x4781af+=0x1){let _0x6713b7=_0x41c6ad[_0xd75d('0x5b')][_0x4781af];var _0x535a54=_0xa48a21[_0xd75d('0x6a')]();_0x535a54[_0xd75d('0x25')](_0xd75d('0x6b'),_0x6713b7['id']);_0x2abb7e['push'](db[_0xd75d('0x5c')][_0xd75d('0x27')](_0x535a54[_0xd75d('0x6c')](),{'type':db[_0xd75d('0x5c')][_0xd75d('0x6d')][_0xd75d('0x6e')]})[_0xd75d('0x19')](function(_0x1b60c0){if(_0x1b60c0['length']===0x1){return _0x6713b7['id'];}else{var _0x254523=_[_0xd75d('0x6f')](_[_0xd75d('0x1f')](_0x1b60c0,_0xd75d('0x70')),function(_0x45bdab){return _[_0xd75d('0x71')](_0x637ca1,_0x45bdab);});if(_0x254523){return _0x6713b7['id'];}}}));}}return BPromise['all'](_0x2abb7e)[_0xd75d('0x19')](function(_0x32f2c1){_0x3ae246=_(_0x3ae246)['union'](_0x32f2c1)[_0xd75d('0x72')]()['value']();return db[_0xd75d('0x20')]['find']({'where':{'id':_0x59cda6[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](function(_0x2dd03e){return db[_0xd75d('0x5c')][_0xd75d('0x73')](function(_0x3f20b8){return _0x2dd03e[_0xd75d('0x74')](_0x59cda6[_0xd75d('0x27')][_0xd75d('0x75')],{'transaction':_0x3f20b8})[_0xd75d('0x19')](function(){if(!_[_0xd75d('0x76')](_0x3ae246)){return _0x2dd03e[_0xd75d('0x77')](_0x3ae246,{'transaction':_0x3f20b8});}})[_0xd75d('0x19')](function(){_0x3ae246[_0xd75d('0x5f')](function(_0x4d4c3d){socket[_0xd75d('0x60')](_0xd75d('0x78'),{'UserId':_0x4d4c3d,'FaxQueueId':_0x2dd03e['id']});});});});});});})[_0xd75d('0x19')](respondWithStatusCode(_0x1d43ab,null))['catch'](handleError(_0x1d43ab,null));};exports[_0xd75d('0x79')]=function(_0x184f12,_0x48b6bb){return db['FaxQueue'][_0xd75d('0x34')]({'where':{'id':_0x184f12[_0xd75d('0x2c')]['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x48b6bb,null))[_0xd75d('0x19')](function(_0x15a53d){if(_0x15a53d){return _0x15a53d[_0xd75d('0x79')](_0x184f12[_0xd75d('0x36')][_0xd75d('0x75')],_[_0xd75d('0x7a')](_0x184f12['body'],[_0xd75d('0x75'),'id'])||{})[_0xd75d('0x7b')](function(_0x5c3222){for(var _0x5e90ed=0x0;_0x5e90ed<_0x184f12[_0xd75d('0x36')][_0xd75d('0x75')][_0xd75d('0x32')];_0x5e90ed+=0x1){socket[_0xd75d('0x60')](_0xd75d('0x61'),{'UserId':Number(_0x184f12['body']['ids'][_0x5e90ed]),'FaxQueueId':Number(_0x184f12[_0xd75d('0x2c')]['id'])});}return _0x5c3222;});}})['then'](respondWithResult(_0x48b6bb,null))[_0xd75d('0x2a')](handleError(_0x48b6bb,null));};exports[_0xd75d('0x77')]=function(_0x4aab07,_0x50884c){return db['FaxQueue'][_0xd75d('0x34')]({'where':{'id':_0x4aab07['params']['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x50884c,null))['then'](function(_0x5d3bca){if(_0x5d3bca){return _0x5d3bca[_0xd75d('0x77')](_0x4aab07[_0xd75d('0x27')][_0xd75d('0x75')])[_0xd75d('0x19')](function(){if(_[_0xd75d('0x7c')](_0x4aab07[_0xd75d('0x27')]['ids'])){for(var _0x2b5d30=0x0;_0x2b5d30<_0x4aab07[_0xd75d('0x27')][_0xd75d('0x75')][_0xd75d('0x32')];_0x2b5d30+=0x1){socket[_0xd75d('0x60')](_0xd75d('0x78'),{'UserId':Number(_0x4aab07[_0xd75d('0x27')]['ids'][_0x2b5d30]),'FaxQueueId':Number(_0x4aab07[_0xd75d('0x2c')]['id'])});}}else{socket[_0xd75d('0x60')](_0xd75d('0x78'),{'UserId':Number(_0x4aab07[_0xd75d('0x27')][_0xd75d('0x75')]),'FaxQueueId':Number(_0x4aab07['params']['id'])});}});}})[_0xd75d('0x19')](respondWithStatusCode(_0x50884c,null))[_0xd75d('0x2a')](handleError(_0x50884c,null));};exports[_0xd75d('0x7d')]=function(_0xdcda94,_0x383641){var _0x4a107a={};var _0xe524be={};var _0x1b92d2;var _0x1bfee7;return db['FaxQueue']['findOne']({'where':{'id':_0xdcda94['params']['id']}})[_0xd75d('0x19')](handleEntityNotFound(_0x383641,null))['then'](function(_0x43a01a){if(_0x43a01a){_0x1b92d2=_0x43a01a;_0xe524be['model']=_[_0xd75d('0x2e')](db[_0xd75d('0x4a')][_0xd75d('0x21')]);_0xe524be[_0xd75d('0x27')]=_[_0xd75d('0x2e')](_0xdcda94[_0xd75d('0x27')]);_0xe524be['filters']=_[_0xd75d('0x2f')](_0xe524be['model'],_0xe524be[_0xd75d('0x27')]);_0x4a107a[_0xd75d('0x30')]=_[_0xd75d('0x2f')](_0xe524be[_0xd75d('0x2d')],qs['fields'](_0xdcda94['query'][_0xd75d('0x31')]));_0x4a107a[_0xd75d('0x30')]=_0x4a107a[_0xd75d('0x30')][_0xd75d('0x32')]?_0x4a107a['attributes']:_0xe524be[_0xd75d('0x2d')];_0x4a107a[_0xd75d('0x44')]=qs[_0xd75d('0x45')](_0xdcda94[_0xd75d('0x27')][_0xd75d('0x45')]);_0x4a107a[_0xd75d('0x25')]=qs[_0xd75d('0x42')](_['pick'](_0xdcda94[_0xd75d('0x27')],_0xe524be[_0xd75d('0x42')]));if(_0xdcda94['query'][_0xd75d('0x47')]){_0x4a107a[_0xd75d('0x25')]=_[_0xd75d('0x33')](_0x4a107a[_0xd75d('0x25')],{'$or':_[_0xd75d('0x1f')](_0x4a107a['attributes'],function(_0x8d8ac9){var _0x3d0c84={};_0x3d0c84[_0x8d8ac9]={'$like':'%'+_0xdcda94['query']['filter']+'%'};return _0x3d0c84;})});}_0x4a107a=_[_0xd75d('0x33')]({},_0x4a107a,_0xdcda94['options']);return _0x1b92d2[_0xd75d('0x7d')](_0x4a107a);}})['then'](function(_0x2cea42){if(_0x2cea42){_0x1bfee7=_0x2cea42[_0xd75d('0x32')];if(!_0xdcda94[_0xd75d('0x27')]['hasOwnProperty'](_0xd75d('0x56'))){_0x4a107a['limit']=qs[_0xd75d('0x16')](_0xdcda94[_0xd75d('0x27')]['limit']);_0x4a107a['offset']=qs[_0xd75d('0x13')](_0xdcda94[_0xd75d('0x27')][_0xd75d('0x13')]);}return _0x1b92d2['getAgents'](_0x4a107a);}})[_0xd75d('0x19')](function(_0x82762b){if(_0x82762b){return _0x82762b?{'count':_0x1bfee7,'rows':_0x82762b}:null;}})[_0xd75d('0x19')](respondWithResult(_0x383641,null))[_0xd75d('0x2a')](handleError(_0x383641,null));}; \ No newline at end of file +var _0xa46e=['field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','json','undefined','limit','offset','count','set','then','FaxQueues','UserProfileResource','destroy','error','name','send','rawAttributes','type','getOptions','where','FaxQueue','include','query','rows','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','update','describe','getMembers','findOne','UserFaxQueue','nolimit','order','sort','pick','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','filter','map','hasOwnProperty','addTeams','ids','User','online','voicePause','interface','Agents','sequelize','transaction','forEach','userFaxQueue:save','removeTeams'];(function(_0x277fc1,_0x41f6c7){var _0x217a61=function(_0x32d986){while(--_0x32d986){_0x277fc1['push'](_0x277fc1['shift']());}};_0x217a61(++_0x41f6c7);}(_0xa46e,0x8a));var _0xea46=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xa46e[_0x1caf6a];return _0x1bf493;};'use strict';var BPromise=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var _=require('lodash');var squel=require(_0xea46('0x2'));var Redis=require(_0xea46('0x3'));var qs=require(_0xea46('0x4'));var logger=require('../../config/logger')(_0xea46('0x5'));var config=require('../../config/environment');var db=require(_0xea46('0x6'))['db'];config['redis']=_[_0xea46('0x7')](config['redis'],{'host':_0xea46('0x8'),'port':0x18eb});var socket=require(_0xea46('0x9'))(new Redis(config['redis']));require(_0xea46('0xa'))[_0xea46('0xb')](socket);function respondWithStatusCode(_0xe7d428,_0x3db7a2){_0x3db7a2=_0x3db7a2||0xcc;return function(_0x468322){if(_0x468322){return _0xe7d428['sendStatus'](_0x3db7a2);}return _0xe7d428['status'](_0x3db7a2)['end']();};}function respondWithResult(_0x2c82e,_0x45550a){_0x45550a=_0x45550a||0xc8;return function(_0x5ae8f9){if(_0x5ae8f9){return _0x2c82e[_0xea46('0xc')](_0x45550a)[_0xea46('0xd')](_0x5ae8f9);}};}function respondWithFilteredResult(_0x4560b1,_0x594694){return function(_0xa6d289){if(_0xa6d289){var _0x38e83b=typeof _0x594694['offset']===_0xea46('0xe')&&typeof _0x594694[_0xea46('0xf')]==='undefined';var _0x20955e=_0xa6d289['count'];var _0x3024af=_0x38e83b?0x0:_0x594694[_0xea46('0x10')];var _0x6c4bc4=_0x38e83b?_0xa6d289[_0xea46('0x11')]:_0x594694[_0xea46('0x10')]+_0x594694[_0xea46('0xf')];var _0x81ee45;if(_0x6c4bc4>=_0x20955e){_0x6c4bc4=_0x20955e;_0x81ee45=0xc8;}else{_0x81ee45=0xce;}_0x4560b1[_0xea46('0xc')](_0x81ee45);return _0x4560b1[_0xea46('0x12')]('Content-Range',_0x3024af+'-'+_0x6c4bc4+'/'+_0x20955e)[_0xea46('0xd')](_0xa6d289);}return null;};}function saveUpdates(_0xbf225e){return function(_0x3926cf){if(_0x3926cf){return _0x3926cf['update'](_0xbf225e)['then'](function(_0x19d5c1){return _0x19d5c1;});}return null;};}function removeEntity(_0x3f463d){return function(_0x5cf5dd){if(_0x5cf5dd){return _0x5cf5dd['destroy']()[_0xea46('0x13')](function(){var _0x9b7d04=_0x5cf5dd['get']({'plain':!![]});var _0x40316b=_0xea46('0x14');return db[_0xea46('0x15')][_0xea46('0x16')]({'where':{'type':_0x40316b,'resourceId':_0x9b7d04['id']}})['then'](function(){return _0x5cf5dd;});})[_0xea46('0x13')](function(){_0x3f463d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc43e){return function(_0x59e431){if(!_0x59e431){_0x1bc43e['sendStatus'](0x194);}return _0x59e431;};}function handleError(_0x5064d8,_0x3b25fe){_0x3b25fe=_0x3b25fe||0x1f4;return function(_0x36f982){logger[_0xea46('0x17')](_0x36f982['stack']);if(_0x36f982[_0xea46('0x18')]){delete _0x36f982['name'];}_0x5064d8[_0xea46('0xc')](_0x3b25fe)[_0xea46('0x19')](_0x36f982);};}exports['index']=function(_0xac33c3,_0x5480eb){var _0x2b3a8f={};var _0x114bf9={'count':0x0,'rows':[]};var _0xd4cf78=_['map'](db['FaxQueue'][_0xea46('0x1a')],function(_0x38ac07){return{'name':_0x38ac07['fieldName'],'type':_0x38ac07[_0xea46('0x1b')]['key']};});_0x2b3a8f=qs[_0xea46('0x1c')](_0xd4cf78,_0xac33c3);var _0x51ca27={'where':_0x2b3a8f[_0xea46('0x1d')]};return db[_0xea46('0x1e')][_0xea46('0x11')](_0x51ca27)[_0xea46('0x13')](function(_0x146995){_0x114bf9[_0xea46('0x11')]=_0x146995;_0x2b3a8f['include']=qs[_0xea46('0x1f')](_0xac33c3[_0xea46('0x20')]);return db[_0xea46('0x1e')]['findAll'](_0x2b3a8f);})[_0xea46('0x13')](function(_0x3cdf96){_0x114bf9[_0xea46('0x21')]=_0x3cdf96;return _0x114bf9;})['then'](respondWithFilteredResult(_0x5480eb,_0x2b3a8f))['catch'](handleError(_0x5480eb,null));};exports['show']=function(_0x64e2d0,_0x16f730){var _0x167ee9={'raw':!![],'where':{'id':_0x64e2d0[_0xea46('0x22')]['id']}},_0x17f101={};_0x17f101[_0xea46('0x23')]=_[_0xea46('0x24')](db[_0xea46('0x1e')][_0xea46('0x1a')]);_0x17f101[_0xea46('0x20')]=_[_0xea46('0x24')](_0x64e2d0['query']);_0x17f101[_0xea46('0x25')]=_[_0xea46('0x26')](_0x17f101[_0xea46('0x23')],_0x17f101[_0xea46('0x20')]);_0x167ee9[_0xea46('0x27')]=_[_0xea46('0x26')](_0x17f101[_0xea46('0x23')],qs['fields'](_0x64e2d0[_0xea46('0x20')][_0xea46('0x28')]));_0x167ee9[_0xea46('0x27')]=_0x167ee9[_0xea46('0x27')][_0xea46('0x29')]?_0x167ee9['attributes']:_0x17f101['model'];if(_0x64e2d0[_0xea46('0x20')][_0xea46('0x2a')]){_0x167ee9['include']=[{'all':!![]}];}_0x167ee9=_[_0xea46('0x2b')]({},_0x167ee9,_0x64e2d0[_0xea46('0x2c')]);return db[_0xea46('0x1e')][_0xea46('0x2d')](_0x167ee9)['then'](handleEntityNotFound(_0x16f730,null))['then'](respondWithResult(_0x16f730,null))[_0xea46('0x2e')](handleError(_0x16f730,null));};exports['create']=function(_0x7c34ce,_0xdec374){return db['FaxQueue'][_0xea46('0x2f')](_0x7c34ce[_0xea46('0x30')],{})['then'](function(_0xb90644){var _0xefad3e=_0x7c34ce['user'][_0xea46('0x31')]({'plain':!![]});if(!_0xefad3e)throw new Error(_0xea46('0x32'));if(_0xefad3e[_0xea46('0x33')]===_0xea46('0x34')){var _0x4a0287=_0xb90644[_0xea46('0x31')]({'plain':!![]});var _0x48c2be=_0xea46('0x14');return db[_0xea46('0x35')][_0xea46('0x2d')]({'where':{'name':_0x48c2be,'userProfileId':_0xefad3e['userProfileId']},'raw':!![]})[_0xea46('0x13')](function(_0xdb2e11){if(_0xdb2e11&&_0xdb2e11['autoAssociation']===0x0){return db[_0xea46('0x15')][_0xea46('0x2f')]({'name':_0x4a0287[_0xea46('0x18')],'resourceId':_0x4a0287['id'],'type':_0xdb2e11[_0xea46('0x18')],'sectionId':_0xdb2e11['id']},{})['then'](function(){return _0xb90644;});}else{return _0xb90644;}})[_0xea46('0x2e')](function(_0x1cc8f8){logger[_0xea46('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cc8f8);throw _0x1cc8f8;});}return _0xb90644;})[_0xea46('0x13')](respondWithResult(_0xdec374,0xc9))[_0xea46('0x2e')](handleError(_0xdec374,null));};exports[_0xea46('0x36')]=function(_0x32c81c,_0x3164c5){if(_0x32c81c[_0xea46('0x30')]['id']){delete _0x32c81c[_0xea46('0x30')]['id'];}return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x32c81c[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x3164c5,null))[_0xea46('0x13')](saveUpdates(_0x32c81c[_0xea46('0x30')],null))[_0xea46('0x13')](respondWithResult(_0x3164c5,null))[_0xea46('0x2e')](handleError(_0x3164c5,null));};exports['destroy']=function(_0x4798d1,_0x2299bb){return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x4798d1[_0xea46('0x22')]['id']}})['then'](handleEntityNotFound(_0x2299bb,null))['then'](removeEntity(_0x2299bb,null))['catch'](handleError(_0x2299bb,null));};exports[_0xea46('0x37')]=function(_0x709bd3,_0x53a4d9){return db[_0xea46('0x1e')][_0xea46('0x37')]()[_0xea46('0x13')](respondWithResult(_0x53a4d9,null))[_0xea46('0x2e')](handleError(_0x53a4d9,null));};exports[_0xea46('0x38')]=function(_0x5c5eed,_0x172db7){var _0x4bd3f2={'raw':!![],'where':{}},_0x22d9a2={},_0x18bcbf;return db[_0xea46('0x1e')][_0xea46('0x39')]({'where':{'id':_0x5c5eed[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x172db7,null))[_0xea46('0x13')](function(_0x52f134){if(_0x52f134){_0x18bcbf=_0x52f134[_0xea46('0x31')]({'plain':!![]});_0x22d9a2[_0xea46('0x23')]=_['keys'](db[_0xea46('0x3a')][_0xea46('0x1a')]);_0x22d9a2[_0xea46('0x20')]=_['keys'](_0x5c5eed['query']);_0x22d9a2[_0xea46('0x25')]=_[_0xea46('0x26')](_0x22d9a2[_0xea46('0x23')],_0x22d9a2[_0xea46('0x20')]);_0x4bd3f2[_0xea46('0x27')]=_[_0xea46('0x26')](_0x22d9a2[_0xea46('0x23')],qs[_0xea46('0x28')](_0x5c5eed[_0xea46('0x20')][_0xea46('0x28')]));_0x4bd3f2['attributes']=_0x4bd3f2[_0xea46('0x27')]['length']?_0x4bd3f2[_0xea46('0x27')]:_0x22d9a2[_0xea46('0x23')];if(!_0x5c5eed[_0xea46('0x20')]['hasOwnProperty'](_0xea46('0x3b'))){_0x4bd3f2[_0xea46('0xf')]=qs[_0xea46('0xf')](_0x5c5eed[_0xea46('0x20')]['limit']);_0x4bd3f2['offset']=qs[_0xea46('0x10')](_0x5c5eed[_0xea46('0x20')]['offset']);}_0x4bd3f2[_0xea46('0x3c')]=qs['sort'](_0x5c5eed[_0xea46('0x20')][_0xea46('0x3d')]);_0x4bd3f2[_0xea46('0x1d')]=qs[_0xea46('0x25')](_[_0xea46('0x3e')](_0x5c5eed[_0xea46('0x20')],_0x22d9a2[_0xea46('0x25')]));_0x4bd3f2['where']['FaxQueueId']=_0x52f134['id'];if(_0x5c5eed[_0xea46('0x20')]['filter']){_0x4bd3f2[_0xea46('0x1d')]=_[_0xea46('0x2b')](_0x4bd3f2[_0xea46('0x1d')],{'$or':_['map'](_0x4bd3f2[_0xea46('0x27')],function(_0x4fcd7b){var _0xc12018={};_0xc12018[_0x4fcd7b]={'$like':'%'+_0x5c5eed[_0xea46('0x20')]['filter']+'%'};return _0xc12018;})});}_0x4bd3f2=_['merge']({},_0x4bd3f2,_0x5c5eed[_0xea46('0x2c')]);return db[_0xea46('0x3a')][_0xea46('0x3f')](_0x4bd3f2);}})['then'](function(_0x287a41){if(_0x287a41){return db['User'][_0xea46('0x40')]({'where':{'id':_['map'](_0x287a41,_0xea46('0x41')),'role':_0xea46('0x42')},'attributes':['id',_0xea46('0x18'),_0xea46('0x43'),_0xea46('0x44'),'createdAt']});}})[_0xea46('0x13')](function(_0x2659bd){if(_0x2659bd){return{'count':_0x2659bd[_0xea46('0x11')],'rows':_['map'](_0x2659bd['rows'],function(_0x3f6a07){return{'membername':_0x3f6a07[_0xea46('0x18')],'UserId':_0x3f6a07['id'],'queue_name':_0x18bcbf[_0xea46('0x18')],'FaxQueueId':_0x18bcbf['id'],'interface':util[_0xea46('0x45')](_0xea46('0x46'),_0xea46('0x47'),_0x3f6a07[_0xea46('0x18')]),'penalty':0x0,'paused':_0x3f6a07[_0xea46('0x43')],'createdAt':_0x3f6a07[_0xea46('0x48')],'updatedAt':_0x3f6a07[_0xea46('0x44')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xea46('0x13')](respondWithFilteredResult(_0x172db7,_0x4bd3f2))[_0xea46('0x2e')](handleError(_0x172db7,null));};exports[_0xea46('0x49')]=function(_0x219776,_0x38f80e){var _0x487b4e={};var _0x375875={};var _0x2c248c;var _0x397e98;return db[_0xea46('0x1e')]['findOne']({'where':{'id':_0x219776[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x38f80e,null))['then'](function(_0x17b3ab){if(_0x17b3ab){_0x2c248c=_0x17b3ab;_0x375875[_0xea46('0x23')]=_['keys'](db[_0xea46('0x4a')][_0xea46('0x1a')]);_0x375875[_0xea46('0x20')]=_['keys'](_0x219776[_0xea46('0x20')]);_0x375875[_0xea46('0x25')]=_[_0xea46('0x26')](_0x375875['model'],_0x375875['query']);_0x487b4e['attributes']=_[_0xea46('0x26')](_0x375875[_0xea46('0x23')],qs[_0xea46('0x28')](_0x219776[_0xea46('0x20')][_0xea46('0x28')]));_0x487b4e['attributes']=_0x487b4e[_0xea46('0x27')]['length']?_0x487b4e[_0xea46('0x27')]:_0x375875[_0xea46('0x23')];_0x487b4e[_0xea46('0x3c')]=qs['sort'](_0x219776['query'][_0xea46('0x3d')]);_0x487b4e[_0xea46('0x1d')]=qs['filters'](_[_0xea46('0x3e')](_0x219776[_0xea46('0x20')],_0x375875[_0xea46('0x25')]));if(_0x219776[_0xea46('0x20')][_0xea46('0x4b')]){_0x487b4e['where']=_[_0xea46('0x2b')](_0x487b4e[_0xea46('0x1d')],{'$or':_[_0xea46('0x4c')](_0x487b4e[_0xea46('0x27')],function(_0x2b85ee){var _0xd13bb7={};_0xd13bb7[_0x2b85ee]={'$like':'%'+_0x219776[_0xea46('0x20')][_0xea46('0x4b')]+'%'};return _0xd13bb7;})});}_0x487b4e=_['merge']({},_0x487b4e,_0x219776[_0xea46('0x2c')]);return _0x2c248c[_0xea46('0x49')](_0x487b4e);}})[_0xea46('0x13')](function(_0x7f99b2){if(_0x7f99b2){_0x397e98=_0x7f99b2[_0xea46('0x29')];if(!_0x219776[_0xea46('0x20')][_0xea46('0x4d')]('nolimit')){_0x487b4e['limit']=qs[_0xea46('0xf')](_0x219776[_0xea46('0x20')][_0xea46('0xf')]);_0x487b4e[_0xea46('0x10')]=qs[_0xea46('0x10')](_0x219776[_0xea46('0x20')][_0xea46('0x10')]);}return _0x2c248c[_0xea46('0x49')](_0x487b4e);}})[_0xea46('0x13')](function(_0x4edb04){if(_0x4edb04){return _0x4edb04?{'count':_0x397e98,'rows':_0x4edb04}:null;}})[_0xea46('0x13')](respondWithResult(_0x38f80e,null))['catch'](handleError(_0x38f80e,null));};exports[_0xea46('0x4e')]=function(_0x7fbb17,_0x2f36a1){var _0x3a4709=_0x7fbb17['body'][_0xea46('0x4f')];return db[_0xea46('0x4a')][_0xea46('0x3f')]({'where':{'id':_0x3a4709},'attributes':['id'],'include':[{'model':db[_0xea46('0x50')],'as':'Agents','attributes':['id',_0xea46('0x18'),_0xea46('0x51'),_0xea46('0x52'),_0xea46('0x53')],'raw':!![]}]})['then'](function(_0x427f12){if(_0x427f12){var _0x137bf5=_['flatMap'](_0x427f12,function(_0x574f62){var _0x32a9da=_0x574f62[_0xea46('0x31')]({'plain':!![]});return _0x32a9da[_0xea46('0x54')];});return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x7fbb17[_0xea46('0x22')]['id']}})[_0xea46('0x13')](function(_0xd62207){return db[_0xea46('0x55')][_0xea46('0x56')](function(_0xbafd55){return _0xd62207[_0xea46('0x4e')](_0x3a4709,{'transaction':_0xbafd55})[_0xea46('0x13')](function(){return BPromise['each'](_0x137bf5,function(_0x5fe06e){return db[_0xea46('0x3a')]['findOrCreate']({'where':{'UserId':_0x5fe06e['id'],'FaxQueueId':_0x7fbb17[_0xea46('0x22')]['id']},'transaction':_0xbafd55});});})[_0xea46('0x13')](function(){_0x137bf5[_0xea46('0x57')](function(_0x407f59){socket['emit'](_0xea46('0x58'),{'UserId':_0x407f59['id'],'FaxQueueId':_0xd62207['id']});});});});});}})['then'](respondWithStatusCode(_0x2f36a1,null))[_0xea46('0x2e')](handleError(_0x2f36a1,null));};exports[_0xea46('0x59')]=function(_0x2091aa,_0x199c97){return db['Team'][_0xea46('0x3f')]({'where':{'id':_0x2091aa['query'][_0xea46('0x4f')]},'attributes':['id'],'include':[{'model':db[_0xea46('0x50')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xea46('0x13')](handleEntityNotFound(_0x199c97,null))[_0xea46('0x13')](function(_0x523a2a){var _0xfb75fb=_[_0xea46('0x4c')](_0x523a2a,'id');var _0x5303f2=[];var _0x5e7a2c=[];var _0x47c40b=squel['select']();_0x47c40b[_0xea46('0x5a')](_0xea46('0x5b'))[_0xea46('0x5c')](_0xea46('0x5d'),'tq')[_0xea46('0x5e')](_0xea46('0x5f'),'ut',_0xea46('0x60'))[_0xea46('0x1d')]('FaxQueueId\x20=\x20?',_0x2091aa[_0xea46('0x22')]['id']);for(var _0x3e9151=0x0;_0x3e9151<_0x523a2a[_0xea46('0x29')];_0x3e9151+=0x1){let _0x182cc9=_0x523a2a[_0x3e9151];for(var _0x20875f=0x0;_0x20875f<_0x182cc9['Agents']['length'];_0x20875f+=0x1){let _0x29136d=_0x182cc9[_0xea46('0x54')][_0x20875f];var _0x3b4b90=_0x47c40b[_0xea46('0x61')]();_0x3b4b90[_0xea46('0x1d')]('ut.UserId\x20=\x20?',_0x29136d['id']);_0x5e7a2c[_0xea46('0x62')](db[_0xea46('0x55')]['query'](_0x3b4b90['toString'](),{'type':db[_0xea46('0x55')][_0xea46('0x63')][_0xea46('0x64')]})[_0xea46('0x13')](function(_0x354ff5){if(_0x354ff5['length']===0x1){return _0x29136d['id'];}else{var _0x299a48=_['every'](_[_0xea46('0x4c')](_0x354ff5,_0xea46('0x65')),function(_0x867af8){return _[_0xea46('0x66')](_0xfb75fb,_0x867af8);});if(_0x299a48){return _0x29136d['id'];}}}));}}return BPromise['all'](_0x5e7a2c)[_0xea46('0x13')](function(_0x35e967){_0x5303f2=_(_0x5303f2)[_0xea46('0x67')](_0x35e967)[_0xea46('0x68')]()[_0xea46('0x69')]();return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x2091aa[_0xea46('0x22')]['id']}})[_0xea46('0x13')](function(_0x59b475){return db[_0xea46('0x55')][_0xea46('0x56')](function(_0x4ea522){return _0x59b475[_0xea46('0x59')](_0x2091aa[_0xea46('0x20')][_0xea46('0x4f')],{'transaction':_0x4ea522})[_0xea46('0x13')](function(){if(!_['isEmpty'](_0x5303f2)){return _0x59b475[_0xea46('0x6a')](_0x5303f2,{'transaction':_0x4ea522});}})[_0xea46('0x13')](function(){_0x5303f2['forEach'](function(_0x5e477d){socket[_0xea46('0x6b')](_0xea46('0x6c'),{'UserId':_0x5e477d,'FaxQueueId':_0x59b475['id']});});});});});});})[_0xea46('0x13')](respondWithStatusCode(_0x199c97,null))[_0xea46('0x2e')](handleError(_0x199c97,null));};exports[_0xea46('0x6d')]=function(_0x4799fe,_0x218253){return db[_0xea46('0x1e')]['find']({'where':{'id':_0x4799fe[_0xea46('0x22')]['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x218253,null))[_0xea46('0x13')](function(_0x4e2c45){if(_0x4e2c45){return _0x4e2c45[_0xea46('0x6d')](_0x4799fe[_0xea46('0x30')][_0xea46('0x4f')],_[_0xea46('0x6e')](_0x4799fe['body'],[_0xea46('0x4f'),'id'])||{})[_0xea46('0x6f')](function(_0x2aaf72){for(var _0x20c8a3=0x0;_0x20c8a3<_0x4799fe['body'][_0xea46('0x4f')]['length'];_0x20c8a3+=0x1){socket[_0xea46('0x6b')](_0xea46('0x58'),{'UserId':Number(_0x4799fe[_0xea46('0x30')][_0xea46('0x4f')][_0x20c8a3]),'FaxQueueId':Number(_0x4799fe[_0xea46('0x22')]['id'])});}return _0x2aaf72;});}})[_0xea46('0x13')](respondWithResult(_0x218253,null))[_0xea46('0x2e')](handleError(_0x218253,null));};exports['removeAgents']=function(_0x33f5a3,_0x45a97d){return db[_0xea46('0x1e')][_0xea46('0x2d')]({'where':{'id':_0x33f5a3['params']['id']}})[_0xea46('0x13')](handleEntityNotFound(_0x45a97d,null))['then'](function(_0x20b4bf){if(_0x20b4bf){return _0x20b4bf['removeAgents'](_0x33f5a3['query'][_0xea46('0x4f')])[_0xea46('0x13')](function(){if(_[_0xea46('0x70')](_0x33f5a3[_0xea46('0x20')][_0xea46('0x4f')])){for(var _0x4db97e=0x0;_0x4db97e<_0x33f5a3[_0xea46('0x20')][_0xea46('0x4f')][_0xea46('0x29')];_0x4db97e+=0x1){socket[_0xea46('0x6b')](_0xea46('0x6c'),{'UserId':Number(_0x33f5a3[_0xea46('0x20')]['ids'][_0x4db97e]),'FaxQueueId':Number(_0x33f5a3[_0xea46('0x22')]['id'])});}}else{socket[_0xea46('0x6b')]('userFaxQueue:remove',{'UserId':Number(_0x33f5a3[_0xea46('0x20')]['ids']),'FaxQueueId':Number(_0x33f5a3[_0xea46('0x22')]['id'])});}});}})[_0xea46('0x13')](respondWithStatusCode(_0x45a97d,null))[_0xea46('0x2e')](handleError(_0x45a97d,null));};exports[_0xea46('0x71')]=function(_0x3a8e83,_0x39c6ae){var _0x5e4e96={};var _0x5f0cbc={};var _0x4c5c79;var _0x548ca1;return db[_0xea46('0x1e')]['findOne']({'where':{'id':_0x3a8e83[_0xea46('0x22')]['id']}})['then'](handleEntityNotFound(_0x39c6ae,null))[_0xea46('0x13')](function(_0x38e1ef){if(_0x38e1ef){_0x4c5c79=_0x38e1ef;_0x5f0cbc['model']=_[_0xea46('0x24')](db[_0xea46('0x50')]['rawAttributes']);_0x5f0cbc[_0xea46('0x20')]=_[_0xea46('0x24')](_0x3a8e83[_0xea46('0x20')]);_0x5f0cbc[_0xea46('0x25')]=_[_0xea46('0x26')](_0x5f0cbc[_0xea46('0x23')],_0x5f0cbc[_0xea46('0x20')]);_0x5e4e96[_0xea46('0x27')]=_[_0xea46('0x26')](_0x5f0cbc[_0xea46('0x23')],qs[_0xea46('0x28')](_0x3a8e83['query']['fields']));_0x5e4e96[_0xea46('0x27')]=_0x5e4e96[_0xea46('0x27')]['length']?_0x5e4e96['attributes']:_0x5f0cbc['model'];_0x5e4e96['order']=qs[_0xea46('0x3d')](_0x3a8e83[_0xea46('0x20')][_0xea46('0x3d')]);_0x5e4e96[_0xea46('0x1d')]=qs['filters'](_[_0xea46('0x3e')](_0x3a8e83[_0xea46('0x20')],_0x5f0cbc[_0xea46('0x25')]));if(_0x3a8e83[_0xea46('0x20')][_0xea46('0x4b')]){_0x5e4e96[_0xea46('0x1d')]=_[_0xea46('0x2b')](_0x5e4e96[_0xea46('0x1d')],{'$or':_['map'](_0x5e4e96[_0xea46('0x27')],function(_0xe92069){var _0x3b4067={};_0x3b4067[_0xe92069]={'$like':'%'+_0x3a8e83[_0xea46('0x20')][_0xea46('0x4b')]+'%'};return _0x3b4067;})});}_0x5e4e96=_[_0xea46('0x2b')]({},_0x5e4e96,_0x3a8e83[_0xea46('0x2c')]);return _0x4c5c79[_0xea46('0x71')](_0x5e4e96);}})[_0xea46('0x13')](function(_0x2cebac){if(_0x2cebac){_0x548ca1=_0x2cebac['length'];if(!_0x3a8e83[_0xea46('0x20')][_0xea46('0x4d')](_0xea46('0x3b'))){_0x5e4e96[_0xea46('0xf')]=qs[_0xea46('0xf')](_0x3a8e83[_0xea46('0x20')][_0xea46('0xf')]);_0x5e4e96[_0xea46('0x10')]=qs['offset'](_0x3a8e83[_0xea46('0x20')][_0xea46('0x10')]);}return _0x4c5c79['getAgents'](_0x5e4e96);}})[_0xea46('0x13')](function(_0x4df90c){if(_0x4df90c){return _0x4df90c?{'count':_0x548ca1,'rows':_0x4df90c}:null;}})[_0xea46('0x13')](respondWithResult(_0x39c6ae,null))['catch'](handleError(_0x39c6ae,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 2237671..0d337ab 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 _0xb080=['events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xb080,0x1e0));var _0x0b08=function(_0x13278a,_0x248a1a){_0x13278a=_0x13278a-0x0;var _0x53c9a2=_0xb080[_0x13278a];return _0x53c9a2;};'use strict';var EventEmitter=require(_0x0b08('0x0'));var FaxQueue=require(_0x0b08('0x1'))['db'][_0x0b08('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0b08('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0b08('0x4'),'afterDestroy':_0x0b08('0x5')};function emitEvent(_0x4cd11c){return function(_0x3d13c1,_0x53b4ce,_0x2a8b58){FaxQueueEvents['emit'](_0x4cd11c+':'+_0x3d13c1['id'],_0x3d13c1);FaxQueueEvents[_0x0b08('0x6')](_0x4cd11c,_0x3d13c1);_0x2a8b58(null);};}for(var e in events){if(events[_0x0b08('0x7')](e)){var event=events[e];FaxQueue[_0x0b08('0x8')](e,emitEvent(event));}}module[_0x0b08('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x03f7=['emit','hook','exports','../../mysqldb','FaxQueue','save','update','remove'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0x03f7,0x93));var _0x703f=function(_0x52eccb,_0x1e40a1){_0x52eccb=_0x52eccb-0x0;var _0x247b80=_0x03f7[_0x52eccb];return _0x247b80;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x703f('0x0'))['db'][_0x703f('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x703f('0x2'),'afterUpdate':_0x703f('0x3'),'afterDestroy':_0x703f('0x4')};function emitEvent(_0x17db29){return function(_0x204eef,_0x2615e8,_0x92d8c6){FaxQueueEvents[_0x703f('0x5')](_0x17db29+':'+_0x204eef['id'],_0x204eef);FaxQueueEvents[_0x703f('0x5')](_0x17db29,_0x204eef);_0x92d8c6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x703f('0x6')](e,emitEvent(event));}}module[_0x703f('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 947a1c8..5ee1ce3 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 _0xaa28=['../../config/logger','moment','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util'];(function(_0x28f582,_0x16950e){var _0x2d7e9d=function(_0x5a1fa3){while(--_0x5a1fa3){_0x28f582['push'](_0x28f582['shift']());}};_0x2d7e9d(++_0x16950e);}(_0xaa28,0x76));var _0x8aa2=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xaa28[_0x251e8c];return _0x1e0c1d;};'use strict';var _=require(_0x8aa2('0x0'));var util=require(_0x8aa2('0x1'));var logger=require(_0x8aa2('0x2'))('api');var moment=require(_0x8aa2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8aa2('0x4'));var attributes=require(_0x8aa2('0x5'));module[_0x8aa2('0x6')]=function(_0x4ed3d1,_0x3974b7){return _0x4ed3d1[_0x8aa2('0x7')](_0x8aa2('0x8'),attributes,{'tableName':_0x8aa2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b3f=['path','rimraf','../../config/environment','exports','define','fax_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x11b6d7,_0x192b36){var _0x172bb7=function(_0xcf99fa){while(--_0xcf99fa){_0x11b6d7['push'](_0x11b6d7['shift']());}};_0x172bb7(++_0x192b36);}(_0x7b3f,0x16e));var _0xf7b3=function(_0x5e4941,_0xf4da3d){_0x5e4941=_0x5e4941-0x0;var _0x22ab50=_0x7b3f[_0x5e4941];return _0x22ab50;};'use strict';var _=require(_0xf7b3('0x0'));var util=require(_0xf7b3('0x1'));var logger=require(_0xf7b3('0x2'))(_0xf7b3('0x3'));var moment=require(_0xf7b3('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7b3('0x5'));var fs=require('fs');var path=require(_0xf7b3('0x6'));var rimraf=require(_0xf7b3('0x7'));var config=require(_0xf7b3('0x8'));var attributes=require('./faxQueue.attributes');module[_0xf7b3('0x9')]=function(_0x11b91c,_0x2fe2ea){return _0x11b91c[_0xf7b3('0xa')]('FaxQueue',attributes,{'tableName':_0xf7b3('0xb'),'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 038e677..5ac1147 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 _0xbb81=['info','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowFaxQueue','FaxQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','request','then','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message'];(function(_0xb6c5b5,_0x539e47){var _0x23f441=function(_0x2a1e55){while(--_0x2a1e55){_0xb6c5b5['push'](_0xb6c5b5['shift']());}};_0x23f441(++_0x539e47);}(_0xbb81,0x1bd));var _0x1bb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb81[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1bb8('0x0'));var util=require(_0x1bb8('0x1'));var moment=require('moment');var BPromise=require(_0x1bb8('0x2'));var rs=require(_0x1bb8('0x3'));var fs=require('fs');var Redis=require(_0x1bb8('0x4'));var db=require(_0x1bb8('0x5'))['db'];var utils=require(_0x1bb8('0x6'));var logger=require(_0x1bb8('0x7'))('rpc');var config=require(_0x1bb8('0x8'));var jayson=require(_0x1bb8('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1bb8('0xa')]=_['defaults'](config[_0x1bb8('0xa')],{'host':_0x1bb8('0xb'),'port':0x18eb});var socket=require(_0x1bb8('0xc'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4c36da,_0x3b3a65,_0x2e0155){return new BPromise(function(_0x56b119,_0x4053ab){return client[_0x1bb8('0xd')](_0x4c36da,_0x2e0155)[_0x1bb8('0xe')](function(_0x4c7add){logger['info']('FaxQueue,\x20%s,\x20%s',_0x3b3a65,_0x1bb8('0xf'));logger[_0x1bb8('0x10')](_0x1bb8('0x11'),_0x3b3a65,_0x1bb8('0xf'),JSON[_0x1bb8('0x12')](_0x4c7add));if(_0x4c7add[_0x1bb8('0x13')]){if(_0x4c7add['error'][_0x1bb8('0x14')]===0x1f4){logger[_0x1bb8('0x13')](_0x1bb8('0x15'),_0x3b3a65,_0x4c7add[_0x1bb8('0x13')][_0x1bb8('0x16')]);return _0x4053ab(_0x4c7add[_0x1bb8('0x13')][_0x1bb8('0x16')]);}logger[_0x1bb8('0x13')](_0x1bb8('0x15'),_0x3b3a65,_0x4c7add[_0x1bb8('0x13')][_0x1bb8('0x16')]);return _0x56b119(_0x4c7add[_0x1bb8('0x13')][_0x1bb8('0x16')]);}else{logger[_0x1bb8('0x17')](_0x1bb8('0x15'),_0x3b3a65,_0x1bb8('0xf'));_0x56b119(_0x4c7add[_0x1bb8('0x18')]['message']);}})[_0x1bb8('0x19')](function(_0x28a600){logger[_0x1bb8('0x13')](_0x1bb8('0x15'),_0x3b3a65,_0x28a600);_0x4053ab(_0x28a600);});});}exports[_0x1bb8('0x1a')]=function(_0x479bd7){var _0x7f4ba5=this;return new Promise(function(_0x446c19,_0x2c5bc5){return db['FaxQueue'][_0x1bb8('0x1b')]({'raw':_0x479bd7[_0x1bb8('0x1c')]?_0x479bd7['options'][_0x1bb8('0x1d')]===undefined?!![]:![]:!![],'where':_0x479bd7[_0x1bb8('0x1c')]?_0x479bd7[_0x1bb8('0x1c')][_0x1bb8('0x1e')]||null:null,'attributes':_0x479bd7[_0x1bb8('0x1c')]?_0x479bd7[_0x1bb8('0x1c')][_0x1bb8('0x1f')]||null:null,'limit':_0x479bd7[_0x1bb8('0x1c')]?_0x479bd7[_0x1bb8('0x1c')][_0x1bb8('0x20')]||null:null,'include':_0x479bd7[_0x1bb8('0x1c')]?_0x479bd7[_0x1bb8('0x1c')][_0x1bb8('0x21')]?_['map'](_0x479bd7[_0x1bb8('0x1c')][_0x1bb8('0x21')],function(_0x1e0886){return{'model':db[_0x1e0886[_0x1bb8('0x22')]],'as':_0x1e0886['as'],'attributes':_0x1e0886[_0x1bb8('0x1f')],'include':_0x1e0886[_0x1bb8('0x21')]?_['map'](_0x1e0886[_0x1bb8('0x21')],function(_0x2d9879){return{'model':db[_0x2d9879[_0x1bb8('0x22')]],'as':_0x2d9879['as'],'attributes':_0x2d9879['attributes'],'include':_0x2d9879[_0x1bb8('0x21')]?_[_0x1bb8('0x23')](_0x2d9879[_0x1bb8('0x21')],function(_0x49ed54){return{'model':db[_0x49ed54[_0x1bb8('0x22')]],'as':_0x49ed54['as'],'attributes':_0x49ed54[_0x1bb8('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16a92e){logger[_0x1bb8('0x17')](_0x1bb8('0x1a'),_0x479bd7);logger[_0x1bb8('0x10')](_0x1bb8('0x1a'),_0x479bd7,JSON[_0x1bb8('0x12')](_0x16a92e));_0x446c19(_0x16a92e);})[_0x1bb8('0x19')](function(_0x1501f0){logger[_0x1bb8('0x13')]('GetFaxQueue',_0x1501f0['message'],_0x479bd7);_0x2c5bc5(_0x7f4ba5['error'](0x1f4,_0x1501f0[_0x1bb8('0x16')]));});});};exports[_0x1bb8('0x24')]=function(_0x19c37b){var _0x4507e2=this;return new Promise(function(_0x36d1f5,_0x5cec16){return db[_0x1bb8('0x25')][_0x1bb8('0x26')]({'raw':_0x19c37b[_0x1bb8('0x1c')]?_0x19c37b[_0x1bb8('0x1c')][_0x1bb8('0x1d')]===undefined?!![]:![]:!![],'where':_0x19c37b[_0x1bb8('0x1c')]?_0x19c37b[_0x1bb8('0x1c')][_0x1bb8('0x1e')]||null:null,'attributes':_0x19c37b[_0x1bb8('0x1c')]?_0x19c37b[_0x1bb8('0x1c')][_0x1bb8('0x1f')]||null:null,'include':_0x19c37b['options']?_0x19c37b[_0x1bb8('0x1c')][_0x1bb8('0x21')]?_[_0x1bb8('0x23')](_0x19c37b[_0x1bb8('0x1c')][_0x1bb8('0x21')],function(_0x56c70d){return{'model':db[_0x56c70d['model']],'as':_0x56c70d['as'],'attributes':_0x56c70d[_0x1bb8('0x1f')],'include':_0x56c70d[_0x1bb8('0x21')]?_[_0x1bb8('0x23')](_0x56c70d[_0x1bb8('0x21')],function(_0x2cb166){return{'model':db[_0x2cb166[_0x1bb8('0x22')]],'as':_0x2cb166['as'],'attributes':_0x2cb166[_0x1bb8('0x1f')],'include':_0x2cb166[_0x1bb8('0x21')]?_[_0x1bb8('0x23')](_0x2cb166['include'],function(_0x4afbbc){return{'model':db[_0x4afbbc[_0x1bb8('0x22')]],'as':_0x4afbbc['as'],'attributes':_0x4afbbc[_0x1bb8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1bb8('0xe')](function(_0x174572){logger['info'](_0x1bb8('0x24'),_0x19c37b);logger['debug'](_0x1bb8('0x24'),_0x19c37b,JSON[_0x1bb8('0x12')](_0x174572));_0x36d1f5(_0x174572);})[_0x1bb8('0x19')](function(_0x6e1cdc){logger[_0x1bb8('0x13')]('ShowFaxQueue',_0x6e1cdc[_0x1bb8('0x16')],_0x19c37b);_0x5cec16(_0x4507e2[_0x1bb8('0x13')](0x1f4,_0x6e1cdc[_0x1bb8('0x16')]));});});}; \ No newline at end of file +var _0x543d=['options','raw','where','attributes','include','map','model','ShowFaxQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x543d,0x83));var _0xd543=function(_0x22f67c,_0x4e8f91){_0x22f67c=_0x22f67c-0x0;var _0x270d5a=_0x543d[_0x22f67c];return _0x270d5a;};'use strict';var _=require('lodash');var util=require(_0xd543('0x0'));var moment=require(_0xd543('0x1'));var BPromise=require(_0xd543('0x2'));var rs=require(_0xd543('0x3'));var fs=require('fs');var Redis=require(_0xd543('0x4'));var db=require(_0xd543('0x5'))['db'];var utils=require(_0xd543('0x6'));var logger=require(_0xd543('0x7'))(_0xd543('0x8'));var config=require(_0xd543('0x9'));var jayson=require(_0xd543('0xa'));var client=jayson[_0xd543('0xb')][_0xd543('0xc')]({'port':0x232a});config[_0xd543('0xd')]=_[_0xd543('0xe')](config[_0xd543('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd543('0xf'))(new Redis(config[_0xd543('0xd')]));require('./faxQueue.socket')[_0xd543('0x10')](socket);function respondWithRpcPromise(_0x3cb002,_0x1a8a59,_0x3ca0f8){return new BPromise(function(_0x54de91,_0x5c3d5c){return client[_0xd543('0x11')](_0x3cb002,_0x3ca0f8)[_0xd543('0x12')](function(_0x363a0f){logger[_0xd543('0x13')](_0xd543('0x14'),_0x1a8a59,'request\x20sent');logger[_0xd543('0x15')](_0xd543('0x16'),_0x1a8a59,_0xd543('0x17'),JSON[_0xd543('0x18')](_0x363a0f));if(_0x363a0f[_0xd543('0x19')]){if(_0x363a0f[_0xd543('0x19')][_0xd543('0x1a')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x1a8a59,_0x363a0f[_0xd543('0x19')][_0xd543('0x1b')]);return _0x5c3d5c(_0x363a0f[_0xd543('0x19')][_0xd543('0x1b')]);}logger[_0xd543('0x19')](_0xd543('0x14'),_0x1a8a59,_0x363a0f[_0xd543('0x19')][_0xd543('0x1b')]);return _0x54de91(_0x363a0f['error'][_0xd543('0x1b')]);}else{logger['info'](_0xd543('0x14'),_0x1a8a59,_0xd543('0x17'));_0x54de91(_0x363a0f[_0xd543('0x1c')]['message']);}})[_0xd543('0x1d')](function(_0x3f8b65){logger[_0xd543('0x19')](_0xd543('0x14'),_0x1a8a59,_0x3f8b65);_0x5c3d5c(_0x3f8b65);});});}exports[_0xd543('0x1e')]=function(_0x3ef61f){var _0x2a5d81=this;return new Promise(function(_0x4fbde1,_0x6d6c94){return db[_0xd543('0x1f')][_0xd543('0x20')]({'raw':_0x3ef61f[_0xd543('0x21')]?_0x3ef61f[_0xd543('0x21')][_0xd543('0x22')]===undefined?!![]:![]:!![],'where':_0x3ef61f[_0xd543('0x21')]?_0x3ef61f[_0xd543('0x21')][_0xd543('0x23')]||null:null,'attributes':_0x3ef61f['options']?_0x3ef61f['options'][_0xd543('0x24')]||null:null,'limit':_0x3ef61f[_0xd543('0x21')]?_0x3ef61f[_0xd543('0x21')]['limit']||null:null,'include':_0x3ef61f[_0xd543('0x21')]?_0x3ef61f[_0xd543('0x21')][_0xd543('0x25')]?_[_0xd543('0x26')](_0x3ef61f[_0xd543('0x21')][_0xd543('0x25')],function(_0x1f3c57){return{'model':db[_0x1f3c57[_0xd543('0x27')]],'as':_0x1f3c57['as'],'attributes':_0x1f3c57[_0xd543('0x24')],'include':_0x1f3c57[_0xd543('0x25')]?_['map'](_0x1f3c57[_0xd543('0x25')],function(_0x3b9676){return{'model':db[_0x3b9676[_0xd543('0x27')]],'as':_0x3b9676['as'],'attributes':_0x3b9676[_0xd543('0x24')],'include':_0x3b9676[_0xd543('0x25')]?_[_0xd543('0x26')](_0x3b9676[_0xd543('0x25')],function(_0xdf0caa){return{'model':db[_0xdf0caa['model']],'as':_0xdf0caa['as'],'attributes':_0xdf0caa['attributes']};}):[]};}):[]};}):[]:[]})[_0xd543('0x12')](function(_0x43bf00){logger[_0xd543('0x13')](_0xd543('0x1e'),_0x3ef61f);logger[_0xd543('0x15')]('GetFaxQueue',_0x3ef61f,JSON[_0xd543('0x18')](_0x43bf00));_0x4fbde1(_0x43bf00);})[_0xd543('0x1d')](function(_0x5b3f96){logger[_0xd543('0x19')](_0xd543('0x1e'),_0x5b3f96[_0xd543('0x1b')],_0x3ef61f);_0x6d6c94(_0x2a5d81['error'](0x1f4,_0x5b3f96[_0xd543('0x1b')]));});});};exports[_0xd543('0x28')]=function(_0x571d3f){var _0x17b1c7=this;return new Promise(function(_0x1cf36c,_0x2c2ec1){return db[_0xd543('0x1f')]['find']({'raw':_0x571d3f[_0xd543('0x21')]?_0x571d3f[_0xd543('0x21')][_0xd543('0x22')]===undefined?!![]:![]:!![],'where':_0x571d3f[_0xd543('0x21')]?_0x571d3f[_0xd543('0x21')][_0xd543('0x23')]||null:null,'attributes':_0x571d3f['options']?_0x571d3f[_0xd543('0x21')]['attributes']||null:null,'include':_0x571d3f[_0xd543('0x21')]?_0x571d3f['options'][_0xd543('0x25')]?_[_0xd543('0x26')](_0x571d3f['options']['include'],function(_0x47ac75){return{'model':db[_0x47ac75['model']],'as':_0x47ac75['as'],'attributes':_0x47ac75[_0xd543('0x24')],'include':_0x47ac75[_0xd543('0x25')]?_['map'](_0x47ac75[_0xd543('0x25')],function(_0x511670){return{'model':db[_0x511670[_0xd543('0x27')]],'as':_0x511670['as'],'attributes':_0x511670['attributes'],'include':_0x511670[_0xd543('0x25')]?_['map'](_0x511670['include'],function(_0x3a4eb0){return{'model':db[_0x3a4eb0[_0xd543('0x27')]],'as':_0x3a4eb0['as'],'attributes':_0x3a4eb0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd543('0x12')](function(_0x16aa4c){logger[_0xd543('0x13')]('ShowFaxQueue',_0x571d3f);logger[_0xd543('0x15')](_0xd543('0x28'),_0x571d3f,JSON[_0xd543('0x18')](_0x16aa4c));_0x1cf36c(_0x16aa4c);})[_0xd543('0x1d')](function(_0x19fcd2){logger[_0xd543('0x19')](_0xd543('0x28'),_0x19fcd2[_0xd543('0x1b')],_0x571d3f);_0x2c2ec1(_0x17b1c7['error'](0x1f4,_0x19fcd2[_0xd543('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index c7cb68c..895bae9 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 _0x0763=['remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x48ff3f,_0x4b0c76){var _0x3afe5a=function(_0xcd6f14){while(--_0xcd6f14){_0x48ff3f['push'](_0x48ff3f['shift']());}};_0x3afe5a(++_0x4b0c76);}(_0x0763,0x87));var _0x3076=function(_0x40bc01,_0x22a9a9){_0x40bc01=_0x40bc01-0x0;var _0x42365b=_0x0763[_0x40bc01];return _0x42365b;};'use strict';var FaxQueueEvents=require(_0x3076('0x0'));var events=['save',_0x3076('0x1'),_0x3076('0x2')];function createListener(_0x5d64db,_0x37d1cf){return function(_0xa646e7){_0x37d1cf[_0x3076('0x3')](_0x5d64db,_0xa646e7);};}function removeListener(_0xecc289,_0x55bd44){return function(){FaxQueueEvents[_0x3076('0x4')](_0xecc289,_0x55bd44);};}exports[_0x3076('0x5')]=function(_0x1ce2ff){for(var _0x1b5f4e=0x0,_0x18b4c8=events[_0x3076('0x6')];_0x1b5f4e<_0x18b4c8;_0x1b5f4e++){var _0x2776c8=events[_0x1b5f4e];var _0xf1ee41=createListener(_0x3076('0x7')+_0x2776c8,_0x1ce2ff);FaxQueueEvents['on'](_0x2776c8,_0xf1ee41);}}; \ No newline at end of file +var _0xee54=['faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x211fb5,_0x52efb0){var _0x221845=function(_0x3a29a0){while(--_0x3a29a0){_0x211fb5['push'](_0x211fb5['shift']());}};_0x221845(++_0x52efb0);}(_0xee54,0x1f0));var _0x4ee5=function(_0x3fe702,_0x530ba8){_0x3fe702=_0x3fe702-0x0;var _0x51368e=_0xee54[_0x3fe702];return _0x51368e;};'use strict';var FaxQueueEvents=require(_0x4ee5('0x0'));var events=[_0x4ee5('0x1'),_0x4ee5('0x2'),_0x4ee5('0x3')];function createListener(_0x322922,_0xc9cc8e){return function(_0x2ba822){_0xc9cc8e[_0x4ee5('0x4')](_0x322922,_0x2ba822);};}function removeListener(_0x404bd0,_0x559307){return function(){FaxQueueEvents[_0x4ee5('0x5')](_0x404bd0,_0x559307);};}exports[_0x4ee5('0x6')]=function(_0x4edbd5){for(var _0x244f32=0x0,_0x123dee=events[_0x4ee5('0x7')];_0x244f32<_0x123dee;_0x244f32++){var _0x34c8ff=events[_0x244f32];var _0x1659f0=createListener(_0x4ee5('0x8')+_0x34c8ff,_0x4edbd5);FaxQueueEvents['on'](_0x34c8ff,_0x1659f0);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 45fddcd..40e9732 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 _0x6657=['put','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x6657,0x17f));var _0x7665=function(_0x13f054,_0xd90d91){_0x13f054=_0x13f054-0x0;var _0x253d46=_0x6657[_0x13f054];return _0x253d46;};'use strict';var multer=require(_0x7665('0x0'));var util=require('util');var path=require(_0x7665('0x1'));var timeout=require(_0x7665('0x2'));var express=require(_0x7665('0x3'));var router=express[_0x7665('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7665('0x5'));var interaction=require(_0x7665('0x6'));var config=require(_0x7665('0x7'));var controller=require(_0x7665('0x8'));router[_0x7665('0x9')]('/',auth[_0x7665('0xa')](),controller[_0x7665('0xb')]);router[_0x7665('0x9')]('/describe',auth[_0x7665('0xa')](),controller[_0x7665('0xc')]);router[_0x7665('0x9')](_0x7665('0xd'),auth[_0x7665('0xa')](),controller[_0x7665('0xe')]);router[_0x7665('0x9')](_0x7665('0xf'),auth['isAuthenticated'](),controller[_0x7665('0x10')]);router[_0x7665('0x9')](_0x7665('0x11'),auth['isAuthenticated'](),controller[_0x7665('0x12')]);router['get'](_0x7665('0x13'),auth[_0x7665('0xa')](),controller['getAgents']);router[_0x7665('0x14')]('/',auth[_0x7665('0xa')](),controller['create']);router[_0x7665('0x14')](_0x7665('0x11'),auth['isAuthenticated'](),controller[_0x7665('0x15')]);router[_0x7665('0x14')](_0x7665('0x13'),auth[_0x7665('0xa')](),controller[_0x7665('0x16')]);router[_0x7665('0x17')](_0x7665('0xd'),auth[_0x7665('0xa')](),controller[_0x7665('0x18')]);router[_0x7665('0x19')](_0x7665('0xd'),auth[_0x7665('0xa')](),controller[_0x7665('0x1a')]);router[_0x7665('0x19')](_0x7665('0x11'),auth[_0x7665('0xa')](),controller['removeTeams']);router[_0x7665('0x19')](_0x7665('0x13'),auth['isAuthenticated'](),controller[_0x7665('0x1b')]);module[_0x7665('0x1c')]=router; \ No newline at end of file +var _0x0e4b=['delete','destroy','removeAgents','exports','multer','util','path','express','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','put','update'];(function(_0x5c44bd,_0x294a4b){var _0x5c7817=function(_0x1f6edf){while(--_0x1f6edf){_0x5c44bd['push'](_0x5c44bd['shift']());}};_0x5c7817(++_0x294a4b);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x2d1965,_0x5811b0){_0x2d1965=_0x2d1965-0x0;var _0x38f880=_0x0e4b[_0x2d1965];return _0x38f880;};'use strict';var multer=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require(_0xb0e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0e4('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(_0xb0e4('0x4'));var controller=require(_0xb0e4('0x5'));router['get']('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x7')]);router[_0xb0e4('0x8')](_0xb0e4('0x9'),auth[_0xb0e4('0x6')](),controller['describe']);router['get'](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xb')]);router[_0xb0e4('0x8')](_0xb0e4('0xc'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xd')]);router[_0xb0e4('0x8')](_0xb0e4('0xe'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xf')]);router[_0xb0e4('0x8')](_0xb0e4('0x10'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x11')]);router['post']('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x12')]);router['post'](_0xb0e4('0xe'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x13')]);router[_0xb0e4('0x14')](_0xb0e4('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb0e4('0x15')](_0xb0e4('0xa'),auth['isAuthenticated'](),controller[_0xb0e4('0x16')]);router[_0xb0e4('0x17')](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x18')]);router[_0xb0e4('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xb0e4('0x17')](_0xb0e4('0x10'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x19')]);module[_0xb0e4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1af7371..bcc8f6d 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 _0x9ac5=['DATE','moment','exports','STRING'];(function(_0x1e09f7,_0x36d27c){var _0x599efe=function(_0x32d7b3){while(--_0x32d7b3){_0x1e09f7['push'](_0x1e09f7['shift']());}};_0x599efe(++_0x36d27c);}(_0x9ac5,0x129));var _0x59ac=function(_0x3ffd37,_0x441e14){_0x3ffd37=_0x3ffd37-0x0;var _0x218743=_0x9ac5[_0x3ffd37];return _0x218743;};'use strict';var moment=require(_0x59ac('0x0'));var Sequelize=require('sequelize');module[_0x59ac('0x1')]={'uniqueid':{'type':Sequelize[_0x59ac('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x59ac('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x59ac('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xadae=['moment','sequelize','exports','STRING'];(function(_0x1230d7,_0x532598){var _0x3fbcf1=function(_0x5601ad){while(--_0x5601ad){_0x1230d7['push'](_0x1230d7['shift']());}};_0x3fbcf1(++_0x532598);}(_0xadae,0x134));var _0xeada=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xadae[_0x40ac5e];return _0x2839d6;};'use strict';var moment=require(_0xeada('0x0'));var Sequelize=require(_0xeada('0x1'));module[_0xeada('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xeada('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b447e48..188cec7 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 _0x76bc=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','end','name','send','map','FaxQueueReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0xd728e1,_0x48d56f){var _0x7bcdac=function(_0x388378){while(--_0x388378){_0xd728e1['push'](_0xd728e1['shift']());}};_0x7bcdac(++_0x48d56f);}(_0x76bc,0x17f));var _0xc76b=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0x76bc[_0x13992d];return _0x3d15bf;};'use strict';var emlformat=require(_0xc76b('0x0'));var rimraf=require(_0xc76b('0x1'));var zipdir=require(_0xc76b('0x2'));var jsonpatch=require(_0xc76b('0x3'));var rp=require(_0xc76b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc76b('0x5'));var util=require(_0xc76b('0x6'));var path=require(_0xc76b('0x7'));var sox=require(_0xc76b('0x8'));var csv=require(_0xc76b('0x9'));var ejs=require(_0xc76b('0xa'));var fs=require('fs');var fs_extra=require(_0xc76b('0xb'));var _=require(_0xc76b('0xc'));var squel=require(_0xc76b('0xd'));var crypto=require(_0xc76b('0xe'));var jsforce=require(_0xc76b('0xf'));var deskjs=require(_0xc76b('0x10'));var toCsv=require(_0xc76b('0x9'));var querystring=require(_0xc76b('0x11'));var Papa=require(_0xc76b('0x12'));var Redis=require(_0xc76b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc76b('0x14'));var as=require(_0xc76b('0x15'));var hardwareService=require(_0xc76b('0x16'));var logger=require(_0xc76b('0x17'))(_0xc76b('0x18'));var utils=require(_0xc76b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc76b('0x1a'));var db=require(_0xc76b('0x1b'))['db'];function respondWithStatusCode(_0x30835f,_0xc84b2c){_0xc84b2c=_0xc84b2c||0xcc;return function(_0x4474cd){if(_0x4474cd){return _0x30835f[_0xc76b('0x1c')](_0xc84b2c);}return _0x30835f[_0xc76b('0x1d')](_0xc84b2c)['end']();};}function respondWithResult(_0x538ca8,_0x38a0f1){_0x38a0f1=_0x38a0f1||0xc8;return function(_0x25e4a1){if(_0x25e4a1){return _0x538ca8[_0xc76b('0x1d')](_0x38a0f1)[_0xc76b('0x1e')](_0x25e4a1);}};}function respondWithFilteredResult(_0x25752f,_0x5d1130){return function(_0x21d99a){if(_0x21d99a){var _0x2db167=typeof _0x5d1130[_0xc76b('0x1f')]==='undefined'&&typeof _0x5d1130['limit']===_0xc76b('0x20');var _0x2d3e9d=_0x21d99a[_0xc76b('0x21')];var _0x3e716e=_0x2db167?0x0:_0x5d1130[_0xc76b('0x1f')];var _0x55a61d=_0x2db167?_0x21d99a['count']:_0x5d1130['offset']+_0x5d1130[_0xc76b('0x22')];var _0x164d38;if(_0x55a61d>=_0x2d3e9d){_0x55a61d=_0x2d3e9d;_0x164d38=0xc8;}else{_0x164d38=0xce;}_0x25752f[_0xc76b('0x1d')](_0x164d38);return _0x25752f[_0xc76b('0x23')](_0xc76b('0x24'),_0x3e716e+'-'+_0x55a61d+'/'+_0x2d3e9d)[_0xc76b('0x1e')](_0x21d99a);}return null;};}function patchUpdates(_0x336be9){return function(_0x20aed4){try{jsonpatch[_0xc76b('0x25')](_0x20aed4,_0x336be9,!![]);}catch(_0x393b0b){return BPromise['reject'](_0x393b0b);}return _0x20aed4[_0xc76b('0x26')]();};}function saveUpdates(_0x4bf5a9,_0x51fafe){return function(_0x3bbede){if(_0x3bbede){return _0x3bbede[_0xc76b('0x27')](_0x4bf5a9)[_0xc76b('0x28')](function(_0xac9a7f){return _0xac9a7f;});}return null;};}function removeEntity(_0x18332d,_0xa6a862){return function(_0x24ee9a){if(_0x24ee9a){return _0x24ee9a[_0xc76b('0x29')]()['then'](function(){_0x18332d[_0xc76b('0x1d')](0xcc)[_0xc76b('0x2a')]();});}};}function handleEntityNotFound(_0x5f0a7b,_0xf43320){return function(_0x2ac9de){if(!_0x2ac9de){_0x5f0a7b[_0xc76b('0x1c')](0x194);}return _0x2ac9de;};}function handleError(_0x25ea69,_0x369fc1){_0x369fc1=_0x369fc1||0x1f4;return function(_0x451ee1){logger['error'](_0x451ee1['stack']);if(_0x451ee1[_0xc76b('0x2b')]){delete _0x451ee1[_0xc76b('0x2b')];}_0x25ea69[_0xc76b('0x1d')](_0x369fc1)[_0xc76b('0x2c')](_0x451ee1);};}exports['index']=function(_0xd92178,_0x26c19b){var _0x35d1bc={},_0x4a0918={},_0x24142f={'count':0x0,'rows':[]};var _0x2cbdb7=_[_0xc76b('0x2d')](db[_0xc76b('0x2e')]['rawAttributes'],function(_0x41952f){return{'name':_0x41952f[_0xc76b('0x2f')],'type':_0x41952f[_0xc76b('0x30')][_0xc76b('0x31')]};});_0x4a0918[_0xc76b('0x32')]=_['map'](_0x2cbdb7,_0xc76b('0x2b'));_0x4a0918['query']=_[_0xc76b('0x33')](_0xd92178[_0xc76b('0x34')]);_0x4a0918[_0xc76b('0x35')]=_[_0xc76b('0x36')](_0x4a0918[_0xc76b('0x32')],_0x4a0918[_0xc76b('0x34')]);_0x35d1bc['attributes']=_['intersection'](_0x4a0918[_0xc76b('0x32')],qs[_0xc76b('0x37')](_0xd92178[_0xc76b('0x34')][_0xc76b('0x37')]));_0x35d1bc[_0xc76b('0x38')]=_0x35d1bc[_0xc76b('0x38')][_0xc76b('0x39')]?_0x35d1bc[_0xc76b('0x38')]:_0x4a0918[_0xc76b('0x32')];if(!_0xd92178[_0xc76b('0x34')][_0xc76b('0x3a')](_0xc76b('0x3b'))){_0x35d1bc[_0xc76b('0x22')]=qs[_0xc76b('0x22')](_0xd92178[_0xc76b('0x34')]['limit']);_0x35d1bc[_0xc76b('0x1f')]=qs[_0xc76b('0x1f')](_0xd92178[_0xc76b('0x34')][_0xc76b('0x1f')]);}_0x35d1bc[_0xc76b('0x3c')]=qs[_0xc76b('0x3d')](_0xd92178[_0xc76b('0x34')][_0xc76b('0x3d')]);_0x35d1bc[_0xc76b('0x3e')]=qs[_0xc76b('0x35')](_[_0xc76b('0x3f')](_0xd92178[_0xc76b('0x34')],_0x4a0918[_0xc76b('0x35')]),_0x2cbdb7);if(_0xd92178[_0xc76b('0x34')]['filter']){_0x35d1bc[_0xc76b('0x3e')]=_['merge'](_0x35d1bc[_0xc76b('0x3e')],{'$or':_['map'](_0x2cbdb7,function(_0x3c3ea6){if(_0x3c3ea6[_0xc76b('0x30')]!==_0xc76b('0x40')){var _0xc0d2d2={};_0xc0d2d2[_0x3c3ea6[_0xc76b('0x2b')]]={'$like':'%'+_0xd92178['query'][_0xc76b('0x41')]+'%'};return _0xc0d2d2;}})});}_0x35d1bc=_[_0xc76b('0x42')]({},_0x35d1bc,_0xd92178[_0xc76b('0x43')]);var _0x10be6f={'where':_0x35d1bc[_0xc76b('0x3e')]};return db[_0xc76b('0x2e')][_0xc76b('0x21')](_0x10be6f)[_0xc76b('0x28')](function(_0x40d97c){_0x24142f[_0xc76b('0x21')]=_0x40d97c;if(_0xd92178['query'][_0xc76b('0x44')]){_0x35d1bc['include']=[{'all':!![]}];}return db[_0xc76b('0x2e')][_0xc76b('0x45')](_0x35d1bc);})[_0xc76b('0x28')](function(_0x3f0c4b){_0x24142f[_0xc76b('0x46')]=_0x3f0c4b;return _0x24142f;})[_0xc76b('0x28')](respondWithFilteredResult(_0x26c19b,_0x35d1bc))[_0xc76b('0x47')](handleError(_0x26c19b,null));};exports[_0xc76b('0x48')]=function(_0x4d7e94,_0x2b3d36){var _0x4ba8a9={'raw':!![],'where':{'id':_0x4d7e94[_0xc76b('0x49')]['id']}},_0x4b3485={};_0x4b3485['model']=_[_0xc76b('0x33')](db[_0xc76b('0x2e')][_0xc76b('0x4a')]);_0x4b3485[_0xc76b('0x34')]=_[_0xc76b('0x33')](_0x4d7e94['query']);_0x4b3485[_0xc76b('0x35')]=_[_0xc76b('0x36')](_0x4b3485[_0xc76b('0x32')],_0x4b3485[_0xc76b('0x34')]);_0x4ba8a9[_0xc76b('0x38')]=_[_0xc76b('0x36')](_0x4b3485[_0xc76b('0x32')],qs['fields'](_0x4d7e94[_0xc76b('0x34')]['fields']));_0x4ba8a9[_0xc76b('0x38')]=_0x4ba8a9[_0xc76b('0x38')]['length']?_0x4ba8a9[_0xc76b('0x38')]:_0x4b3485[_0xc76b('0x32')];if(_0x4d7e94['query'][_0xc76b('0x44')]){_0x4ba8a9['include']=[{'all':!![]}];}_0x4ba8a9=_[_0xc76b('0x42')]({},_0x4ba8a9,_0x4d7e94['options']);return db[_0xc76b('0x2e')][_0xc76b('0x4b')](_0x4ba8a9)['then'](handleEntityNotFound(_0x2b3d36,null))[_0xc76b('0x28')](respondWithResult(_0x2b3d36,null))[_0xc76b('0x47')](handleError(_0x2b3d36,null));};exports[_0xc76b('0x4c')]=function(_0x52dd73,_0x43f414){return db[_0xc76b('0x2e')][_0xc76b('0x4c')](_0x52dd73['body'],{})[_0xc76b('0x28')](respondWithResult(_0x43f414,0xc9))[_0xc76b('0x47')](handleError(_0x43f414,null));};exports[_0xc76b('0x27')]=function(_0x126c96,_0x4d65eb){if(_0x126c96[_0xc76b('0x4d')]['id']){delete _0x126c96[_0xc76b('0x4d')]['id'];}return db[_0xc76b('0x2e')][_0xc76b('0x4b')]({'where':{'id':_0x126c96[_0xc76b('0x49')]['id']}})[_0xc76b('0x28')](handleEntityNotFound(_0x4d65eb,null))[_0xc76b('0x28')](saveUpdates(_0x126c96[_0xc76b('0x4d')],null))[_0xc76b('0x28')](respondWithResult(_0x4d65eb,null))['catch'](handleError(_0x4d65eb,null));};exports[_0xc76b('0x29')]=function(_0x12efb0,_0x17b009){return db['FaxQueueReport'][_0xc76b('0x4b')]({'where':{'id':_0x12efb0[_0xc76b('0x49')]['id']}})[_0xc76b('0x28')](handleEntityNotFound(_0x17b009,null))[_0xc76b('0x28')](removeEntity(_0x17b009,null))[_0xc76b('0x47')](handleError(_0x17b009,null));};exports[_0xc76b('0x4e')]=function(_0x4f4f14,_0xddb2ce){return db[_0xc76b('0x2e')][_0xc76b('0x4e')]()[_0xc76b('0x28')](respondWithResult(_0xddb2ce,null))['catch'](handleError(_0xddb2ce,null));}; \ No newline at end of file +var _0x1d2d=['options','FaxQueueReport','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x253215,_0xc8a6a){var _0x20efe7=function(_0x539cb6){while(--_0x539cb6){_0x253215['push'](_0x253215['shift']());}};_0x20efe7(++_0xc8a6a);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x1a8e3a,_0x22cc60){_0x1a8e3a=_0x1a8e3a-0x0;var _0x457e36=_0x1d2d[_0x1a8e3a];return _0x457e36;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){_0x19d535['status'](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x42da6d,_0x41330f){return function(_0x2e1709){if(!_0x2e1709){_0x42da6d[_0xd1d2('0x1b')](0x194);}return _0x2e1709;};}function handleError(_0x39e991,_0x28b8be){_0x28b8be=_0x28b8be||0x1f4;return function(_0x34faf7){logger[_0xd1d2('0x28')](_0x34faf7[_0xd1d2('0x29')]);if(_0x34faf7[_0xd1d2('0x2a')]){delete _0x34faf7['name'];}_0x39e991['status'](_0x28b8be)[_0xd1d2('0x2b')](_0x34faf7);};}exports[_0xd1d2('0x2c')]=function(_0x1e6072,_0x2b4c1f){var _0xc815ea={},_0x48ade1={},_0x39d694={'count':0x0,'rows':[]};var _0x41171c=_[_0xd1d2('0x2d')](db['FaxQueueReport'][_0xd1d2('0x2e')],function(_0x1db17f){return{'name':_0x1db17f[_0xd1d2('0x2f')],'type':_0x1db17f['type'][_0xd1d2('0x30')]};});_0x48ade1[_0xd1d2('0x31')]=_[_0xd1d2('0x2d')](_0x41171c,_0xd1d2('0x2a'));_0x48ade1[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x1e6072[_0xd1d2('0x32')]);_0x48ade1[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],_0x48ade1[_0xd1d2('0x32')]);_0xc815ea[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],qs[_0xd1d2('0x37')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x37')]));_0xc815ea[_0xd1d2('0x36')]=_0xc815ea['attributes'][_0xd1d2('0x38')]?_0xc815ea[_0xd1d2('0x36')]:_0x48ade1[_0xd1d2('0x31')];if(!_0x1e6072['query'][_0xd1d2('0x39')]('nolimit')){_0xc815ea['limit']=qs[_0xd1d2('0x21')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x21')]);_0xc815ea[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1e6072[_0xd1d2('0x32')]['offset']);}_0xc815ea[_0xd1d2('0x3a')]=qs[_0xd1d2('0x3b')](_0x1e6072['query'][_0xd1d2('0x3b')]);_0xc815ea[_0xd1d2('0x3c')]=qs[_0xd1d2('0x34')](_[_0xd1d2('0x3d')](_0x1e6072['query'],_0x48ade1['filters']),_0x41171c);if(_0x1e6072[_0xd1d2('0x32')]['filter']){_0xc815ea['where']=_['merge'](_0xc815ea[_0xd1d2('0x3c')],{'$or':_['map'](_0x41171c,function(_0x3f4fd7){if(_0x3f4fd7['type']!=='VIRTUAL'){var _0x4bcea4={};_0x4bcea4[_0x3f4fd7[_0xd1d2('0x2a')]]={'$like':'%'+_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x3e')]+'%'};return _0x4bcea4;}})});}_0xc815ea=_[_0xd1d2('0x3f')]({},_0xc815ea,_0x1e6072[_0xd1d2('0x40')]);var _0xb5bec2={'where':_0xc815ea[_0xd1d2('0x3c')]};return db[_0xd1d2('0x41')][_0xd1d2('0x22')](_0xb5bec2)[_0xd1d2('0x26')](function(_0x2cedb4){_0x39d694[_0xd1d2('0x22')]=_0x2cedb4;if(_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x42')]){_0xc815ea['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xd1d2('0x43')](_0xc815ea);})[_0xd1d2('0x26')](function(_0x24fc93){_0x39d694['rows']=_0x24fc93;return _0x39d694;})['then'](respondWithFilteredResult(_0x2b4c1f,_0xc815ea))[_0xd1d2('0x44')](handleError(_0x2b4c1f,null));};exports[_0xd1d2('0x45')]=function(_0x4dc730,_0x2fe92a){var _0x4c5d49={'raw':!![],'where':{'id':_0x4dc730[_0xd1d2('0x46')]['id']}},_0x5a3790={};_0x5a3790['model']=_['keys'](db[_0xd1d2('0x41')][_0xd1d2('0x2e')]);_0x5a3790[_0xd1d2('0x32')]=_['keys'](_0x4dc730[_0xd1d2('0x32')]);_0x5a3790[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x5a3790[_0xd1d2('0x31')],_0x5a3790['query']);_0x4c5d49[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x5a3790['model'],qs[_0xd1d2('0x37')](_0x4dc730['query'][_0xd1d2('0x37')]));_0x4c5d49[_0xd1d2('0x36')]=_0x4c5d49[_0xd1d2('0x36')][_0xd1d2('0x38')]?_0x4c5d49[_0xd1d2('0x36')]:_0x5a3790['model'];if(_0x4dc730['query'][_0xd1d2('0x42')]){_0x4c5d49[_0xd1d2('0x47')]=[{'all':!![]}];}_0x4c5d49=_['merge']({},_0x4c5d49,_0x4dc730[_0xd1d2('0x40')]);return db[_0xd1d2('0x41')][_0xd1d2('0x48')](_0x4c5d49)[_0xd1d2('0x26')](handleEntityNotFound(_0x2fe92a,null))[_0xd1d2('0x26')](respondWithResult(_0x2fe92a,null))[_0xd1d2('0x44')](handleError(_0x2fe92a,null));};exports[_0xd1d2('0x49')]=function(_0x57c668,_0xed9e9){return db[_0xd1d2('0x41')]['create'](_0x57c668[_0xd1d2('0x4a')],{})[_0xd1d2('0x26')](respondWithResult(_0xed9e9,0xc9))['catch'](handleError(_0xed9e9,null));};exports['update']=function(_0x3d4fe3,_0x182ea8){if(_0x3d4fe3['body']['id']){delete _0x3d4fe3[_0xd1d2('0x4a')]['id'];}return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0x3d4fe3[_0xd1d2('0x46')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x182ea8,null))['then'](saveUpdates(_0x3d4fe3['body'],null))[_0xd1d2('0x26')](respondWithResult(_0x182ea8,null))['catch'](handleError(_0x182ea8,null));};exports[_0xd1d2('0x27')]=function(_0xcd4b70,_0x4f4cb9){return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0xcd4b70['params']['id']}})['then'](handleEntityNotFound(_0x4f4cb9,null))[_0xd1d2('0x26')](removeEntity(_0x4f4cb9,null))[_0xd1d2('0x44')](handleError(_0x4f4cb9,null));};exports[_0xd1d2('0x4b')]=function(_0xfd8024,_0xa013ce){return db[_0xd1d2('0x41')][_0xd1d2('0x4b')]()[_0xd1d2('0x26')](respondWithResult(_0xa013ce,null))[_0xd1d2('0x44')](handleError(_0xa013ce,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9ecf6e9..3b36a93 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x35c4dc,_0x284c3b){var _0x5a1d35=function(_0x429daf){while(--_0x429daf){_0x35c4dc['push'](_0x35c4dc['shift']());}};_0x5a1d35(++_0x284c3b);}(_0xabce,0x103));var _0xeabc=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xabce[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x7217,0x19e));var _0x7721=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x7217[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index c371c17..64f5cd8 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 _0x08f2=['rpc','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x56c6c6,_0x20fd70){var _0x2e17c1=function(_0x349684){while(--_0x349684){_0x56c6c6['push'](_0x56c6c6['shift']());}};_0x2e17c1(++_0x20fd70);}(_0x08f2,0x13a));var _0x208f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x08f2[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x208f('0x0'));var rs=require(_0x208f('0x1'));var fs=require('fs');var Redis=require(_0x208f('0x2'));var db=require(_0x208f('0x3'))['db'];var utils=require(_0x208f('0x4'));var logger=require(_0x208f('0x5'))(_0x208f('0x6'));var config=require(_0x208f('0x7'));var jayson=require(_0x208f('0x8'));var client=jayson[_0x208f('0x9')][_0x208f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57253c,_0x515bfe,_0x3c31d7){return new BPromise(function(_0x21e587,_0x566301){return client[_0x208f('0xb')](_0x57253c,_0x3c31d7)['then'](function(_0x4eebbc){logger[_0x208f('0xc')](_0x208f('0xd'),_0x515bfe,_0x208f('0xe'));logger[_0x208f('0xf')](_0x208f('0x10'),_0x515bfe,_0x208f('0xe'),JSON[_0x208f('0x11')](_0x4eebbc));if(_0x4eebbc[_0x208f('0x12')]){if(_0x4eebbc[_0x208f('0x12')]['code']===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x515bfe,_0x4eebbc[_0x208f('0x12')][_0x208f('0x13')]);return _0x566301(_0x4eebbc[_0x208f('0x12')][_0x208f('0x13')]);}logger['error'](_0x208f('0xd'),_0x515bfe,_0x4eebbc[_0x208f('0x12')][_0x208f('0x13')]);return _0x21e587(_0x4eebbc['error'][_0x208f('0x13')]);}else{logger[_0x208f('0xc')](_0x208f('0xd'),_0x515bfe,_0x208f('0xe'));_0x21e587(_0x4eebbc[_0x208f('0x14')]['message']);}})[_0x208f('0x15')](function(_0xc19620){logger[_0x208f('0x12')](_0x208f('0xd'),_0x515bfe,_0xc19620);_0x566301(_0xc19620);});});}exports['CreateFaxQueueReport']=function(_0x42eb02){var _0x5bcee4=this;return new Promise(function(_0x337d58,_0x393cbf){return db[_0x208f('0x16')][_0x208f('0x17')](_0x42eb02[_0x208f('0x18')],{'raw':_0x42eb02['options']?_0x42eb02[_0x208f('0x19')][_0x208f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3c442b){logger[_0x208f('0xc')](_0x208f('0x1b'),_0x42eb02);logger[_0x208f('0xf')]('CreateFaxQueueReport',_0x42eb02,JSON[_0x208f('0x11')](_0x3c442b));_0x337d58(_0x3c442b);})[_0x208f('0x15')](function(_0x36dedb){logger[_0x208f('0x12')]('CreateFaxQueueReport',_0x36dedb[_0x208f('0x13')],_0x42eb02);_0x393cbf(_0x5bcee4['error'](0x1f4,_0x36dedb[_0x208f('0x13')]));});});};exports[_0x208f('0x1c')]=function(_0x3e81df){var _0x3c0ffe=this;return new Promise(function(_0x34edd9,_0x3086e8){return db['FaxQueueReport'][_0x208f('0x1d')](_0x3e81df[_0x208f('0x18')],{'raw':_0x3e81df[_0x208f('0x19')]?_0x3e81df['options'][_0x208f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e81df[_0x208f('0x19')]?_0x3e81df['options']['where']||null:null,'attributes':_0x3e81df[_0x208f('0x19')]?_0x3e81df[_0x208f('0x19')][_0x208f('0x1e')]||null:null,'limit':_0x3e81df[_0x208f('0x19')]?_0x3e81df[_0x208f('0x19')][_0x208f('0x1f')]||null:null})['then'](function(_0x109d44){logger['info'](_0x208f('0x1c'),_0x3e81df);logger[_0x208f('0xf')](_0x208f('0x1c'),_0x3e81df,JSON[_0x208f('0x11')](_0x109d44));_0x34edd9(_0x109d44);})[_0x208f('0x15')](function(_0x5af1c6){logger[_0x208f('0x12')](_0x208f('0x1c'),_0x5af1c6[_0x208f('0x13')],_0x3e81df);_0x3086e8(_0x3c0ffe[_0x208f('0x12')](0x1f4,_0x5af1c6[_0x208f('0x13')]));});});}; \ No newline at end of file +var _0xd992=['rpc','jayson/promise','client','request','then','info','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','create','options','raw','stringify','UpdateFaxQueueReport','FaxQueueReport','body','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xd992,0x1ad));var _0x2d99=function(_0x12ef39,_0x18d320){_0x12ef39=_0x12ef39-0x0;var _0x47a734=_0xd992[_0x12ef39];return _0x47a734;};'use strict';var _=require('lodash');var util=require(_0x2d99('0x0'));var moment=require(_0x2d99('0x1'));var BPromise=require(_0x2d99('0x2'));var rs=require(_0x2d99('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d99('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d99('0x5'))(_0x2d99('0x6'));var config=require('../../config/environment');var jayson=require(_0x2d99('0x7'));var client=jayson[_0x2d99('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3542c0,_0x35fab2,_0x22acf3){return new BPromise(function(_0x4bdc95,_0x337194){return client[_0x2d99('0x9')](_0x3542c0,_0x22acf3)[_0x2d99('0xa')](function(_0x3f4857){logger[_0x2d99('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x35fab2,_0x2d99('0xc'));logger['debug'](_0x2d99('0xd'),_0x35fab2,_0x2d99('0xc'),JSON['stringify'](_0x3f4857));if(_0x3f4857[_0x2d99('0xe')]){if(_0x3f4857[_0x2d99('0xe')][_0x2d99('0xf')]===0x1f4){logger['error'](_0x2d99('0x10'),_0x35fab2,_0x3f4857[_0x2d99('0xe')][_0x2d99('0x11')]);return _0x337194(_0x3f4857[_0x2d99('0xe')][_0x2d99('0x11')]);}logger[_0x2d99('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x35fab2,_0x3f4857['error']['message']);return _0x4bdc95(_0x3f4857['error'][_0x2d99('0x11')]);}else{logger[_0x2d99('0xb')](_0x2d99('0x10'),_0x35fab2,_0x2d99('0xc'));_0x4bdc95(_0x3f4857[_0x2d99('0x12')][_0x2d99('0x11')]);}})[_0x2d99('0x13')](function(_0x1116f4){logger[_0x2d99('0xe')](_0x2d99('0x10'),_0x35fab2,_0x1116f4);_0x337194(_0x1116f4);});});}exports[_0x2d99('0x14')]=function(_0x4f44e5){var _0x1fa953=this;return new Promise(function(_0x464b81,_0x245d4a){return db['FaxQueueReport'][_0x2d99('0x15')](_0x4f44e5['body'],{'raw':_0x4f44e5[_0x2d99('0x16')]?_0x4f44e5[_0x2d99('0x16')][_0x2d99('0x17')]===undefined?!![]:![]:!![]})[_0x2d99('0xa')](function(_0x66f5a5){logger[_0x2d99('0xb')](_0x2d99('0x14'),_0x4f44e5);logger['debug'](_0x2d99('0x14'),_0x4f44e5,JSON[_0x2d99('0x18')](_0x66f5a5));_0x464b81(_0x66f5a5);})[_0x2d99('0x13')](function(_0x3b7c28){logger[_0x2d99('0xe')](_0x2d99('0x14'),_0x3b7c28[_0x2d99('0x11')],_0x4f44e5);_0x245d4a(_0x1fa953[_0x2d99('0xe')](0x1f4,_0x3b7c28['message']));});});};exports[_0x2d99('0x19')]=function(_0x501c5c){var _0x11bbbe=this;return new Promise(function(_0x3b41ec,_0x14c8a0){return db[_0x2d99('0x1a')]['update'](_0x501c5c[_0x2d99('0x1b')],{'raw':_0x501c5c[_0x2d99('0x16')]?_0x501c5c['options'][_0x2d99('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x501c5c['options']?_0x501c5c[_0x2d99('0x16')]['where']||null:null,'attributes':_0x501c5c[_0x2d99('0x16')]?_0x501c5c[_0x2d99('0x16')]['attributes']||null:null,'limit':_0x501c5c[_0x2d99('0x16')]?_0x501c5c[_0x2d99('0x16')]['limit']||null:null})['then'](function(_0x19a5ff){logger[_0x2d99('0xb')](_0x2d99('0x19'),_0x501c5c);logger[_0x2d99('0x1c')]('UpdateFaxQueueReport',_0x501c5c,JSON[_0x2d99('0x18')](_0x19a5ff));_0x3b41ec(_0x19a5ff);})[_0x2d99('0x13')](function(_0x182688){logger[_0x2d99('0xe')](_0x2d99('0x19'),_0x182688[_0x2d99('0x11')],_0x501c5c);_0x14c8a0(_0x11bbbe['error'](0x1f4,_0x182688['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 2e86f5b..75f3b3b 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 _0x3f59=['create','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x53a0ce,_0x5eaa86){var _0x491112=function(_0xb4b450){while(--_0xb4b450){_0x53a0ce['push'](_0x53a0ce['shift']());}};_0x491112(++_0x5eaa86);}(_0x3f59,0x97));var _0x93f5=function(_0x5acc8c,_0x2e12e0){_0x5acc8c=_0x5acc8c-0x0;var _0x405e56=_0x3f59[_0x5acc8c];return _0x405e56;};'use strict';var multer=require(_0x93f5('0x0'));var util=require(_0x93f5('0x1'));var path=require(_0x93f5('0x2'));var timeout=require(_0x93f5('0x3'));var express=require('express');var router=express[_0x93f5('0x4')]();var fs_extra=require(_0x93f5('0x5'));var auth=require(_0x93f5('0x6'));var interaction=require(_0x93f5('0x7'));var config=require(_0x93f5('0x8'));var controller=require(_0x93f5('0x9'));router[_0x93f5('0xa')]('/',auth[_0x93f5('0xb')](),controller[_0x93f5('0xc')]);router[_0x93f5('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x93f5('0xd')]);router['get'](_0x93f5('0xe'),auth['isAuthenticated'](),controller[_0x93f5('0xf')]);router[_0x93f5('0x10')]('/',auth[_0x93f5('0xb')](),controller[_0x93f5('0x11')]);router['put'](_0x93f5('0xe'),auth[_0x93f5('0xb')](),controller['update']);router[_0x93f5('0x12')](_0x93f5('0xe'),auth[_0x93f5('0xb')](),controller[_0x93f5('0x13')]);module[_0x93f5('0x14')]=router; \ No newline at end of file +var _0xef05=['delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x5bdb06,_0x3060e9){var _0x10362b=function(_0x3a0ac8){while(--_0x3a0ac8){_0x5bdb06['push'](_0x5bdb06['shift']());}};_0x10362b(++_0x3060e9);}(_0xef05,0xd4));var _0x5ef0=function(_0x2e3edc,_0x409968){_0x2e3edc=_0x2e3edc-0x0;var _0x258fd7=_0xef05[_0x2e3edc];return _0x258fd7;};'use strict';var multer=require(_0x5ef0('0x0'));var util=require(_0x5ef0('0x1'));var path=require(_0x5ef0('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ef0('0x3'));var router=express[_0x5ef0('0x4')]();var fs_extra=require(_0x5ef0('0x5'));var auth=require(_0x5ef0('0x6'));var interaction=require(_0x5ef0('0x7'));var config=require(_0x5ef0('0x8'));var controller=require('./faxQueueReport.controller');router[_0x5ef0('0x9')]('/',auth[_0x5ef0('0xa')](),controller[_0x5ef0('0xb')]);router['get'](_0x5ef0('0xc'),auth[_0x5ef0('0xa')](),controller[_0x5ef0('0xd')]);router[_0x5ef0('0x9')](_0x5ef0('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x5ef0('0xf')]('/',auth[_0x5ef0('0xa')](),controller[_0x5ef0('0x10')]);router[_0x5ef0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5ef0('0x12')]);router[_0x5ef0('0x13')](_0x5ef0('0xe'),auth[_0x5ef0('0xa')](),controller['destroy']);module[_0x5ef0('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 58e52b5..3ec460b 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(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1c4e0d,_0x152977){_0x1c4e0d=_0x1c4e0d-0x0;var _0x1b74aa=_0xb43b[_0x1c4e0d];return _0x1b74aa;};'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(_0x42a850,_0x29fd9b){var _0x392c38=function(_0x392691){while(--_0x392691){_0x42a850['push'](_0x42a850['shift']());}};_0x392c38(++_0x29fd9b);}(_0x70e0,0x17b));var _0x070e=function(_0x15ab0f,_0x1de48c){_0x15ab0f=_0x15ab0f-0x0;var _0x445a03=_0x70e0[_0x15ab0f];return _0x445a03;};'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 71b3539..97e763e 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 _0x1d5f=['limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x37485f,_0x7fcf8e){var _0x496a33=function(_0x536c81){while(--_0x536c81){_0x37485f['push'](_0x37485f['shift']());}};_0x496a33(++_0x7fcf8e);}(_0x1d5f,0xae));var _0xf1d5=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x1d5f[_0x5d31f3];return _0x1cc88c;};'use strict';var emlformat=require(_0xf1d5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf1d5('0x1'));var jsonpatch=require(_0xf1d5('0x2'));var rp=require(_0xf1d5('0x3'));var moment=require('moment');var BPromise=require(_0xf1d5('0x4'));var Mustache=require(_0xf1d5('0x5'));var util=require(_0xf1d5('0x6'));var path=require(_0xf1d5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf1d5('0x8'));var fs=require('fs');var fs_extra=require(_0xf1d5('0x9'));var _=require(_0xf1d5('0xa'));var squel=require('squel');var crypto=require(_0xf1d5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf1d5('0xc'));var toCsv=require(_0xf1d5('0xd'));var querystring=require('querystring');var Papa=require(_0xf1d5('0xe'));var Redis=require(_0xf1d5('0xf'));var authService=require(_0xf1d5('0x10'));var qs=require(_0xf1d5('0x11'));var as=require(_0xf1d5('0x12'));var hardwareService=require(_0xf1d5('0x13'));var logger=require(_0xf1d5('0x14'))(_0xf1d5('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf1d5('0x16'));var db=require(_0xf1d5('0x17'))['db'];function respondWithStatusCode(_0x3de310,_0x472d3f){_0x472d3f=_0x472d3f||0xcc;return function(_0x12db9f){if(_0x12db9f){return _0x3de310[_0xf1d5('0x18')](_0x472d3f);}return _0x3de310[_0xf1d5('0x19')](_0x472d3f)[_0xf1d5('0x1a')]();};}function respondWithResult(_0x12cd46,_0x4a8c9b){_0x4a8c9b=_0x4a8c9b||0xc8;return function(_0x2811d7){if(_0x2811d7){return _0x12cd46['status'](_0x4a8c9b)[_0xf1d5('0x1b')](_0x2811d7);}};}function respondWithFilteredResult(_0x3ade91,_0x411f22){return function(_0x515de8){if(_0x515de8){var _0x185401=typeof _0x411f22[_0xf1d5('0x1c')]==='undefined'&&typeof _0x411f22['limit']===_0xf1d5('0x1d');var _0x5c97ef=_0x515de8[_0xf1d5('0x1e')];var _0x165666=_0x185401?0x0:_0x411f22[_0xf1d5('0x1c')];var _0x509efa=_0x185401?_0x515de8[_0xf1d5('0x1e')]:_0x411f22['offset']+_0x411f22['limit'];var _0x3856e5;if(_0x509efa>=_0x5c97ef){_0x509efa=_0x5c97ef;_0x3856e5=0xc8;}else{_0x3856e5=0xce;}_0x3ade91[_0xf1d5('0x19')](_0x3856e5);return _0x3ade91[_0xf1d5('0x1f')](_0xf1d5('0x20'),_0x165666+'-'+_0x509efa+'/'+_0x5c97ef)[_0xf1d5('0x1b')](_0x515de8);}return null;};}function patchUpdates(_0x5932b2){return function(_0x3fb09c){try{jsonpatch['apply'](_0x3fb09c,_0x5932b2,!![]);}catch(_0x1d6ba7){return BPromise[_0xf1d5('0x21')](_0x1d6ba7);}return _0x3fb09c['save']();};}function saveUpdates(_0x381b3d,_0x2736bd){return function(_0x1cf12e){if(_0x1cf12e){return _0x1cf12e[_0xf1d5('0x22')](_0x381b3d)[_0xf1d5('0x23')](function(_0x4a33ca){return _0x4a33ca;});}return null;};}function removeEntity(_0x5b411e,_0x5f1ed3){return function(_0xdaa572){if(_0xdaa572){return _0xdaa572[_0xf1d5('0x24')]()[_0xf1d5('0x23')](function(){_0x5b411e[_0xf1d5('0x19')](0xcc)[_0xf1d5('0x1a')]();});}};}function handleEntityNotFound(_0x2d63bb,_0x4d23e1){return function(_0x898c0f){if(!_0x898c0f){_0x2d63bb['sendStatus'](0x194);}return _0x898c0f;};}function handleError(_0x59c9cc,_0x537f2c){_0x537f2c=_0x537f2c||0x1f4;return function(_0x1ea60d){logger[_0xf1d5('0x25')](_0x1ea60d[_0xf1d5('0x26')]);if(_0x1ea60d[_0xf1d5('0x27')]){delete _0x1ea60d[_0xf1d5('0x27')];}_0x59c9cc[_0xf1d5('0x19')](_0x537f2c)[_0xf1d5('0x28')](_0x1ea60d);};}exports[_0xf1d5('0x29')]=function(_0x144e40,_0x37908f){var _0x131f2b={},_0x2a4452={},_0x5662f4={'count':0x0,'rows':[]};var _0x362896=_[_0xf1d5('0x2a')](db[_0xf1d5('0x2b')][_0xf1d5('0x2c')],function(_0x17dc88){return{'name':_0x17dc88[_0xf1d5('0x2d')],'type':_0x17dc88[_0xf1d5('0x2e')][_0xf1d5('0x2f')]};});_0x2a4452[_0xf1d5('0x30')]=_[_0xf1d5('0x2a')](_0x362896,_0xf1d5('0x27'));_0x2a4452[_0xf1d5('0x31')]=_['keys'](_0x144e40[_0xf1d5('0x31')]);_0x2a4452[_0xf1d5('0x32')]=_[_0xf1d5('0x33')](_0x2a4452[_0xf1d5('0x30')],_0x2a4452[_0xf1d5('0x31')]);_0x131f2b[_0xf1d5('0x34')]=_[_0xf1d5('0x33')](_0x2a4452[_0xf1d5('0x30')],qs[_0xf1d5('0x35')](_0x144e40['query']['fields']));_0x131f2b[_0xf1d5('0x34')]=_0x131f2b[_0xf1d5('0x34')][_0xf1d5('0x36')]?_0x131f2b['attributes']:_0x2a4452[_0xf1d5('0x30')];if(!_0x144e40['query'][_0xf1d5('0x37')](_0xf1d5('0x38'))){_0x131f2b['limit']=qs[_0xf1d5('0x39')](_0x144e40[_0xf1d5('0x31')][_0xf1d5('0x39')]);_0x131f2b['offset']=qs[_0xf1d5('0x1c')](_0x144e40[_0xf1d5('0x31')]['offset']);}_0x131f2b[_0xf1d5('0x3a')]=qs[_0xf1d5('0x3b')](_0x144e40[_0xf1d5('0x31')][_0xf1d5('0x3b')]);_0x131f2b[_0xf1d5('0x3c')]=qs[_0xf1d5('0x32')](_[_0xf1d5('0x3d')](_0x144e40[_0xf1d5('0x31')],_0x2a4452[_0xf1d5('0x32')]),_0x362896);if(_0x144e40[_0xf1d5('0x31')][_0xf1d5('0x3e')]){_0x131f2b[_0xf1d5('0x3c')]=_[_0xf1d5('0x3f')](_0x131f2b[_0xf1d5('0x3c')],{'$or':_[_0xf1d5('0x2a')](_0x362896,function(_0xe260e9){if(_0xe260e9['type']!==_0xf1d5('0x40')){var _0x243574={};_0x243574[_0xe260e9['name']]={'$like':'%'+_0x144e40[_0xf1d5('0x31')][_0xf1d5('0x3e')]+'%'};return _0x243574;}})});}_0x131f2b=_[_0xf1d5('0x3f')]({},_0x131f2b,_0x144e40['options']);var _0x2f8adb={'where':_0x131f2b[_0xf1d5('0x3c')]};return db[_0xf1d5('0x2b')][_0xf1d5('0x1e')](_0x2f8adb)[_0xf1d5('0x23')](function(_0x2e0a7c){_0x5662f4['count']=_0x2e0a7c;if(_0x144e40[_0xf1d5('0x31')][_0xf1d5('0x41')]){_0x131f2b[_0xf1d5('0x42')]=[{'all':!![]}];}return db[_0xf1d5('0x2b')][_0xf1d5('0x43')](_0x131f2b);})[_0xf1d5('0x23')](function(_0x5b1d02){_0x5662f4['rows']=_0x5b1d02;return _0x5662f4;})[_0xf1d5('0x23')](respondWithFilteredResult(_0x37908f,_0x131f2b))[_0xf1d5('0x44')](handleError(_0x37908f,null));};exports[_0xf1d5('0x45')]=function(_0x26e879,_0x1f31b0){var _0x3f5bc5={'raw':!![],'where':{'id':_0x26e879[_0xf1d5('0x46')]['id']}},_0x4bc4b4={};_0x4bc4b4[_0xf1d5('0x30')]=_[_0xf1d5('0x47')](db[_0xf1d5('0x2b')][_0xf1d5('0x2c')]);_0x4bc4b4[_0xf1d5('0x31')]=_[_0xf1d5('0x47')](_0x26e879[_0xf1d5('0x31')]);_0x4bc4b4[_0xf1d5('0x32')]=_['intersection'](_0x4bc4b4['model'],_0x4bc4b4[_0xf1d5('0x31')]);_0x3f5bc5[_0xf1d5('0x34')]=_[_0xf1d5('0x33')](_0x4bc4b4[_0xf1d5('0x30')],qs['fields'](_0x26e879[_0xf1d5('0x31')][_0xf1d5('0x35')]));_0x3f5bc5[_0xf1d5('0x34')]=_0x3f5bc5[_0xf1d5('0x34')]['length']?_0x3f5bc5[_0xf1d5('0x34')]:_0x4bc4b4[_0xf1d5('0x30')];if(_0x26e879['query'][_0xf1d5('0x41')]){_0x3f5bc5[_0xf1d5('0x42')]=[{'all':!![]}];}_0x3f5bc5=_[_0xf1d5('0x3f')]({},_0x3f5bc5,_0x26e879[_0xf1d5('0x48')]);return db[_0xf1d5('0x2b')][_0xf1d5('0x49')](_0x3f5bc5)[_0xf1d5('0x23')](handleEntityNotFound(_0x1f31b0,null))[_0xf1d5('0x23')](respondWithResult(_0x1f31b0,null))[_0xf1d5('0x44')](handleError(_0x1f31b0,null));};exports[_0xf1d5('0x4a')]=function(_0x51965e,_0x445a99){return db['FaxTransferReport'][_0xf1d5('0x4a')](_0x51965e[_0xf1d5('0x4b')],{})[_0xf1d5('0x23')](respondWithResult(_0x445a99,0xc9))[_0xf1d5('0x44')](handleError(_0x445a99,null));};exports['update']=function(_0x3d98a4,_0x3448d4){if(_0x3d98a4['body']['id']){delete _0x3d98a4[_0xf1d5('0x4b')]['id'];}return db[_0xf1d5('0x2b')][_0xf1d5('0x49')]({'where':{'id':_0x3d98a4['params']['id']}})['then'](handleEntityNotFound(_0x3448d4,null))[_0xf1d5('0x23')](saveUpdates(_0x3d98a4[_0xf1d5('0x4b')],null))[_0xf1d5('0x23')](respondWithResult(_0x3448d4,null))['catch'](handleError(_0x3448d4,null));};exports[_0xf1d5('0x24')]=function(_0x10ea9c,_0x74e269){return db[_0xf1d5('0x2b')]['find']({'where':{'id':_0x10ea9c[_0xf1d5('0x46')]['id']}})[_0xf1d5('0x23')](handleEntityNotFound(_0x74e269,null))[_0xf1d5('0x23')](removeEntity(_0x74e269,null))[_0xf1d5('0x44')](handleError(_0x74e269,null));};exports[_0xf1d5('0x4c')]=function(_0xfb30b8,_0x3d2754){return db['FaxTransferReport'][_0xf1d5('0x4c')]()[_0xf1d5('0x23')](respondWithResult(_0x3d2754,null))['catch'](handleError(_0x3d2754,null));}; \ No newline at end of file +var _0x5bf8=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FaxTransferReport','count','include','findAll','show','params','includeAll','find','catch','create','body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x4b2993,_0xd46430){var _0x480074=function(_0x37e7fc){while(--_0x37e7fc){_0x4b2993['push'](_0x4b2993['shift']());}};_0x480074(++_0xd46430);}(_0x5bf8,0xa9));var _0x85bf=function(_0x4491ef,_0x5153d9){_0x4491ef=_0x4491ef-0x0;var _0x3c72dc=_0x5bf8[_0x4491ef];return _0x3c72dc;};'use strict';var emlformat=require(_0x85bf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x85bf('0x1'));var rp=require(_0x85bf('0x2'));var moment=require('moment');var BPromise=require(_0x85bf('0x3'));var Mustache=require(_0x85bf('0x4'));var util=require(_0x85bf('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x85bf('0x6'));var ejs=require(_0x85bf('0x7'));var fs=require('fs');var fs_extra=require(_0x85bf('0x8'));var _=require(_0x85bf('0x9'));var squel=require(_0x85bf('0xa'));var crypto=require(_0x85bf('0xb'));var jsforce=require(_0x85bf('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x85bf('0xd'));var Redis=require(_0x85bf('0xe'));var authService=require(_0x85bf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x85bf('0x10'));var hardwareService=require(_0x85bf('0x11'));var logger=require(_0x85bf('0x12'))(_0x85bf('0x13'));var utils=require(_0x85bf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x85bf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428bea,_0x378013){_0x378013=_0x378013||0xcc;return function(_0x48c28f){if(_0x48c28f){return _0x428bea[_0x85bf('0x16')](_0x378013);}return _0x428bea[_0x85bf('0x17')](_0x378013)['end']();};}function respondWithResult(_0x4bf1e4,_0x115456){_0x115456=_0x115456||0xc8;return function(_0x114e88){if(_0x114e88){return _0x4bf1e4[_0x85bf('0x17')](_0x115456)[_0x85bf('0x18')](_0x114e88);}};}function respondWithFilteredResult(_0x273c9d,_0x11788e){return function(_0x4b4560){if(_0x4b4560){var _0x5c9163=typeof _0x11788e['offset']===_0x85bf('0x19')&&typeof _0x11788e[_0x85bf('0x1a')]===_0x85bf('0x19');var _0x5e5905=_0x4b4560['count'];var _0x279454=_0x5c9163?0x0:_0x11788e[_0x85bf('0x1b')];var _0x4b7074=_0x5c9163?_0x4b4560['count']:_0x11788e[_0x85bf('0x1b')]+_0x11788e[_0x85bf('0x1a')];var _0x3cdf0a;if(_0x4b7074>=_0x5e5905){_0x4b7074=_0x5e5905;_0x3cdf0a=0xc8;}else{_0x3cdf0a=0xce;}_0x273c9d['status'](_0x3cdf0a);return _0x273c9d[_0x85bf('0x1c')](_0x85bf('0x1d'),_0x279454+'-'+_0x4b7074+'/'+_0x5e5905)[_0x85bf('0x18')](_0x4b4560);}return null;};}function patchUpdates(_0x161d7b){return function(_0x557eee){try{jsonpatch['apply'](_0x557eee,_0x161d7b,!![]);}catch(_0x1eb702){return BPromise[_0x85bf('0x1e')](_0x1eb702);}return _0x557eee[_0x85bf('0x1f')]();};}function saveUpdates(_0x8b98b8,_0x4d782e){return function(_0x334465){if(_0x334465){return _0x334465[_0x85bf('0x20')](_0x8b98b8)[_0x85bf('0x21')](function(_0x1a7f34){return _0x1a7f34;});}return null;};}function removeEntity(_0x4c5385,_0x472ce8){return function(_0x29728e){if(_0x29728e){return _0x29728e[_0x85bf('0x22')]()[_0x85bf('0x21')](function(){_0x4c5385[_0x85bf('0x17')](0xcc)[_0x85bf('0x23')]();});}};}function handleEntityNotFound(_0x1d5919,_0xd109cd){return function(_0x20c723){if(!_0x20c723){_0x1d5919[_0x85bf('0x16')](0x194);}return _0x20c723;};}function handleError(_0x20e375,_0x4f9845){_0x4f9845=_0x4f9845||0x1f4;return function(_0x5c3892){logger['error'](_0x5c3892[_0x85bf('0x24')]);if(_0x5c3892[_0x85bf('0x25')]){delete _0x5c3892[_0x85bf('0x25')];}_0x20e375[_0x85bf('0x17')](_0x4f9845)[_0x85bf('0x26')](_0x5c3892);};}exports[_0x85bf('0x27')]=function(_0x1f3e32,_0xbeb5d5){var _0x318f32={},_0x209acc={},_0x2ae111={'count':0x0,'rows':[]};var _0x242567=_[_0x85bf('0x28')](db['FaxTransferReport'][_0x85bf('0x29')],function(_0x4c5aff){return{'name':_0x4c5aff[_0x85bf('0x2a')],'type':_0x4c5aff[_0x85bf('0x2b')][_0x85bf('0x2c')]};});_0x209acc[_0x85bf('0x2d')]=_[_0x85bf('0x28')](_0x242567,'name');_0x209acc[_0x85bf('0x2e')]=_[_0x85bf('0x2f')](_0x1f3e32[_0x85bf('0x2e')]);_0x209acc[_0x85bf('0x30')]=_[_0x85bf('0x31')](_0x209acc[_0x85bf('0x2d')],_0x209acc['query']);_0x318f32[_0x85bf('0x32')]=_[_0x85bf('0x31')](_0x209acc[_0x85bf('0x2d')],qs['fields'](_0x1f3e32[_0x85bf('0x2e')][_0x85bf('0x33')]));_0x318f32[_0x85bf('0x32')]=_0x318f32[_0x85bf('0x32')][_0x85bf('0x34')]?_0x318f32[_0x85bf('0x32')]:_0x209acc[_0x85bf('0x2d')];if(!_0x1f3e32['query'][_0x85bf('0x35')](_0x85bf('0x36'))){_0x318f32[_0x85bf('0x1a')]=qs[_0x85bf('0x1a')](_0x1f3e32[_0x85bf('0x2e')][_0x85bf('0x1a')]);_0x318f32[_0x85bf('0x1b')]=qs[_0x85bf('0x1b')](_0x1f3e32[_0x85bf('0x2e')][_0x85bf('0x1b')]);}_0x318f32[_0x85bf('0x37')]=qs[_0x85bf('0x38')](_0x1f3e32[_0x85bf('0x2e')]['sort']);_0x318f32[_0x85bf('0x39')]=qs['filters'](_[_0x85bf('0x3a')](_0x1f3e32[_0x85bf('0x2e')],_0x209acc[_0x85bf('0x30')]),_0x242567);if(_0x1f3e32[_0x85bf('0x2e')][_0x85bf('0x3b')]){_0x318f32[_0x85bf('0x39')]=_[_0x85bf('0x3c')](_0x318f32[_0x85bf('0x39')],{'$or':_[_0x85bf('0x28')](_0x242567,function(_0x4366df){if(_0x4366df[_0x85bf('0x2b')]!=='VIRTUAL'){var _0x2f5558={};_0x2f5558[_0x4366df[_0x85bf('0x25')]]={'$like':'%'+_0x1f3e32[_0x85bf('0x2e')][_0x85bf('0x3b')]+'%'};return _0x2f5558;}})});}_0x318f32=_[_0x85bf('0x3c')]({},_0x318f32,_0x1f3e32[_0x85bf('0x3d')]);var _0x3edd4c={'where':_0x318f32[_0x85bf('0x39')]};return db[_0x85bf('0x3e')][_0x85bf('0x3f')](_0x3edd4c)['then'](function(_0x1f1af7){_0x2ae111[_0x85bf('0x3f')]=_0x1f1af7;if(_0x1f3e32['query']['includeAll']){_0x318f32[_0x85bf('0x40')]=[{'all':!![]}];}return db[_0x85bf('0x3e')][_0x85bf('0x41')](_0x318f32);})[_0x85bf('0x21')](function(_0x35c0d3){_0x2ae111['rows']=_0x35c0d3;return _0x2ae111;})['then'](respondWithFilteredResult(_0xbeb5d5,_0x318f32))['catch'](handleError(_0xbeb5d5,null));};exports[_0x85bf('0x42')]=function(_0x3fce32,_0x4f014c){var _0x5ade44={'raw':!![],'where':{'id':_0x3fce32[_0x85bf('0x43')]['id']}},_0x19b4a1={};_0x19b4a1['model']=_[_0x85bf('0x2f')](db['FaxTransferReport'][_0x85bf('0x29')]);_0x19b4a1[_0x85bf('0x2e')]=_[_0x85bf('0x2f')](_0x3fce32['query']);_0x19b4a1[_0x85bf('0x30')]=_['intersection'](_0x19b4a1[_0x85bf('0x2d')],_0x19b4a1[_0x85bf('0x2e')]);_0x5ade44[_0x85bf('0x32')]=_['intersection'](_0x19b4a1['model'],qs[_0x85bf('0x33')](_0x3fce32[_0x85bf('0x2e')][_0x85bf('0x33')]));_0x5ade44[_0x85bf('0x32')]=_0x5ade44[_0x85bf('0x32')][_0x85bf('0x34')]?_0x5ade44[_0x85bf('0x32')]:_0x19b4a1[_0x85bf('0x2d')];if(_0x3fce32[_0x85bf('0x2e')][_0x85bf('0x44')]){_0x5ade44[_0x85bf('0x40')]=[{'all':!![]}];}_0x5ade44=_[_0x85bf('0x3c')]({},_0x5ade44,_0x3fce32[_0x85bf('0x3d')]);return db[_0x85bf('0x3e')][_0x85bf('0x45')](_0x5ade44)['then'](handleEntityNotFound(_0x4f014c,null))[_0x85bf('0x21')](respondWithResult(_0x4f014c,null))[_0x85bf('0x46')](handleError(_0x4f014c,null));};exports['create']=function(_0x200788,_0x5cb717){return db[_0x85bf('0x3e')][_0x85bf('0x47')](_0x200788[_0x85bf('0x48')],{})['then'](respondWithResult(_0x5cb717,0xc9))[_0x85bf('0x46')](handleError(_0x5cb717,null));};exports[_0x85bf('0x20')]=function(_0x5db9b7,_0x239125){if(_0x5db9b7[_0x85bf('0x48')]['id']){delete _0x5db9b7['body']['id'];}return db[_0x85bf('0x3e')][_0x85bf('0x45')]({'where':{'id':_0x5db9b7['params']['id']}})[_0x85bf('0x21')](handleEntityNotFound(_0x239125,null))[_0x85bf('0x21')](saveUpdates(_0x5db9b7[_0x85bf('0x48')],null))[_0x85bf('0x21')](respondWithResult(_0x239125,null))[_0x85bf('0x46')](handleError(_0x239125,null));};exports[_0x85bf('0x22')]=function(_0x14156d,_0x5928d7){return db[_0x85bf('0x3e')]['find']({'where':{'id':_0x14156d[_0x85bf('0x43')]['id']}})[_0x85bf('0x21')](handleEntityNotFound(_0x5928d7,null))[_0x85bf('0x21')](removeEntity(_0x5928d7,null))[_0x85bf('0x46')](handleError(_0x5928d7,null));};exports[_0x85bf('0x49')]=function(_0xc4ae09,_0x1c0a9c){return db[_0x85bf('0x3e')]['describe']()[_0x85bf('0x21')](respondWithResult(_0x1c0a9c,null))[_0x85bf('0x46')](handleError(_0x1c0a9c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 1ab60aa..46167a6 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 _0xa5ea=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','../../config/logger','api','moment'];(function(_0x38ee0b,_0x46b267){var _0x4e3d8b=function(_0x45af68){while(--_0x45af68){_0x38ee0b['push'](_0x38ee0b['shift']());}};_0x4e3d8b(++_0x46b267);}(_0xa5ea,0x1e9));var _0xaa5e=function(_0x4ed790,_0x3b0fe6){_0x4ed790=_0x4ed790-0x0;var _0x1972cd=_0xa5ea[_0x4ed790];return _0x1972cd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa5e('0x0'))(_0xaa5e('0x1'));var moment=require(_0xaa5e('0x2'));var BPromise=require('bluebird');var rp=require(_0xaa5e('0x3'));var fs=require('fs');var path=require(_0xaa5e('0x4'));var rimraf=require(_0xaa5e('0x5'));var config=require(_0xaa5e('0x6'));var attributes=require(_0xaa5e('0x7'));module['exports']=function(_0x57edd3,_0x133617){return _0x57edd3[_0xaa5e('0x8')](_0xaa5e('0x9'),attributes,{'tableName':_0xaa5e('0xa'),'paranoid':![],'indexes':[{'name':_0xaa5e('0xb'),'fields':[_0xaa5e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc692=['exports','report_fax_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xc692,0x15f));var _0x2c69=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xc692[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x2c69('0x0'));var util=require(_0x2c69('0x1'));var logger=require(_0x2c69('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2c69('0x3'));var rp=require(_0x2c69('0x4'));var fs=require('fs');var path=require(_0x2c69('0x5'));var rimraf=require(_0x2c69('0x6'));var config=require(_0x2c69('0x7'));var attributes=require(_0x2c69('0x8'));module[_0x2c69('0x9')]=function(_0x53b84e,_0x17a476){return _0x53b84e['define']('FaxTransferReport',attributes,{'tableName':_0x2c69('0xa'),'paranoid':![],'indexes':[{'name':_0x2c69('0xb'),'fields':[_0x2c69('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 6c52252..df7659b 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 _0x1fa0=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x48fd50,_0x4c5aa9){var _0x5e7788=function(_0x3f910d){while(--_0x3f910d){_0x48fd50['push'](_0x48fd50['shift']());}};_0x5e7788(++_0x4c5aa9);}(_0x1fa0,0x182));var _0x01fa=function(_0x3b2d81,_0x3a5ee8){_0x3b2d81=_0x3b2d81-0x0;var _0x1ac262=_0x1fa0[_0x3b2d81];return _0x1ac262;};'use strict';var _=require(_0x01fa('0x0'));var util=require(_0x01fa('0x1'));var moment=require(_0x01fa('0x2'));var BPromise=require('bluebird');var rs=require(_0x01fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01fa('0x4'))['db'];var utils=require(_0x01fa('0x5'));var logger=require(_0x01fa('0x6'))('rpc');var config=require(_0x01fa('0x7'));var jayson=require(_0x01fa('0x8'));var client=jayson['client'][_0x01fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd6725c,_0x52503f,_0x5357c1){return new BPromise(function(_0x5b013c,_0x3f7c5b){return client[_0x01fa('0xa')](_0xd6725c,_0x5357c1)[_0x01fa('0xb')](function(_0x4b2cb6){logger[_0x01fa('0xc')](_0x01fa('0xd'),_0x52503f,_0x01fa('0xe'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x52503f,_0x01fa('0xe'),JSON[_0x01fa('0xf')](_0x4b2cb6));if(_0x4b2cb6['error']){if(_0x4b2cb6[_0x01fa('0x10')][_0x01fa('0x11')]===0x1f4){logger[_0x01fa('0x10')](_0x01fa('0xd'),_0x52503f,_0x4b2cb6['error'][_0x01fa('0x12')]);return _0x3f7c5b(_0x4b2cb6[_0x01fa('0x10')][_0x01fa('0x12')]);}logger['error'](_0x01fa('0xd'),_0x52503f,_0x4b2cb6[_0x01fa('0x10')][_0x01fa('0x12')]);return _0x5b013c(_0x4b2cb6['error'][_0x01fa('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x52503f,_0x01fa('0xe'));_0x5b013c(_0x4b2cb6['result'][_0x01fa('0x12')]);}})[_0x01fa('0x13')](function(_0x591c50){logger[_0x01fa('0x10')](_0x01fa('0xd'),_0x52503f,_0x591c50);_0x3f7c5b(_0x591c50);});});} \ No newline at end of file +var _0xa42b=['error','code','message','FaxTransferReport,\x20%s,\x20%s','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa42b,0x108));var _0xba42=function(_0x250afd,_0x31f376){_0x250afd=_0x250afd-0x0;var _0x38899a=_0xa42b[_0x250afd];return _0x38899a;};'use strict';var _=require(_0xba42('0x0'));var util=require(_0xba42('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xba42('0x2'));var fs=require('fs');var Redis=require(_0xba42('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xba42('0x4'))(_0xba42('0x5'));var config=require(_0xba42('0x6'));var jayson=require(_0xba42('0x7'));var client=jayson[_0xba42('0x8')][_0xba42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7a015c,_0x5cdba8,_0x8b5dd){return new BPromise(function(_0x3a9aa5,_0x10dc92){return client['request'](_0x7a015c,_0x8b5dd)[_0xba42('0xa')](function(_0x88cb66){logger[_0xba42('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x5cdba8,_0xba42('0xc'));logger[_0xba42('0xd')](_0xba42('0xe'),_0x5cdba8,_0xba42('0xc'),JSON[_0xba42('0xf')](_0x88cb66));if(_0x88cb66[_0xba42('0x10')]){if(_0x88cb66[_0xba42('0x10')][_0xba42('0x11')]===0x1f4){logger[_0xba42('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x5cdba8,_0x88cb66['error'][_0xba42('0x12')]);return _0x10dc92(_0x88cb66[_0xba42('0x10')]['message']);}logger['error'](_0xba42('0x13'),_0x5cdba8,_0x88cb66[_0xba42('0x10')][_0xba42('0x12')]);return _0x3a9aa5(_0x88cb66['error'][_0xba42('0x12')]);}else{logger[_0xba42('0xb')](_0xba42('0x13'),_0x5cdba8,_0xba42('0xc'));_0x3a9aa5(_0x88cb66['result'][_0xba42('0x12')]);}})['catch'](function(_0x12cbd5){logger['error'](_0xba42('0x13'),_0x5cdba8,_0x12cbd5);_0x10dc92(_0x12cbd5);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e024066..858c21e 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 _0xc54d=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x1c490a,_0x217f34){var _0x1e0b1d=function(_0x3ee02b){while(--_0x3ee02b){_0x1c490a['push'](_0x1c490a['shift']());}};_0x1e0b1d(++_0x217f34);}(_0xc54d,0xf2));var _0xdc54=function(_0x230282,_0x120a70){_0x230282=_0x230282-0x0;var _0x52f047=_0xc54d[_0x230282];return _0x52f047;};'use strict';var multer=require(_0xdc54('0x0'));var util=require(_0xdc54('0x1'));var path=require(_0xdc54('0x2'));var timeout=require(_0xdc54('0x3'));var express=require(_0xdc54('0x4'));var router=express[_0xdc54('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdc54('0x6'));var interaction=require(_0xdc54('0x7'));var config=require('../../config/environment');var controller=require(_0xdc54('0x8'));router[_0xdc54('0x9')]('/',auth['isAuthenticated'](),controller[_0xdc54('0xa')]);router['get'](_0xdc54('0xb'),auth[_0xdc54('0xc')](),controller['describe']);router[_0xdc54('0x9')](_0xdc54('0xd'),auth[_0xdc54('0xc')](),controller[_0xdc54('0xe')]);router[_0xdc54('0xf')]('/',auth[_0xdc54('0xc')](),controller[_0xdc54('0x10')]);router[_0xdc54('0x11')](_0xdc54('0xd'),auth[_0xdc54('0xc')](),controller['update']);router[_0xdc54('0x12')]('/:id',auth[_0xdc54('0xc')](),controller['destroy']);module[_0xdc54('0x13')]=router; \ No newline at end of file +var _0xbcaa=['create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./faxTransferReport.controller','get','/describe','describe','/:id','post','isAuthenticated'];(function(_0xd7f81b,_0x34d653){var _0xa932d0=function(_0x4dd59d){while(--_0x4dd59d){_0xd7f81b['push'](_0xd7f81b['shift']());}};_0xa932d0(++_0x34d653);}(_0xbcaa,0xb9));var _0xabca=function(_0x3eef0d,_0x38a38b){_0x3eef0d=_0x3eef0d-0x0;var _0x2c78fc=_0xbcaa[_0x3eef0d];return _0x2c78fc;};'use strict';var multer=require('multer');var util=require(_0xabca('0x0'));var path=require(_0xabca('0x1'));var timeout=require(_0xabca('0x2'));var express=require(_0xabca('0x3'));var router=express['Router']();var fs_extra=require(_0xabca('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xabca('0x5'));var controller=require(_0xabca('0x6'));router[_0xabca('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xabca('0x8'),auth['isAuthenticated'](),controller[_0xabca('0x9')]);router[_0xabca('0x7')](_0xabca('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xabca('0xb')]('/',auth[_0xabca('0xc')](),controller[_0xabca('0xd')]);router[_0xabca('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xabca('0xf')]('/:id',auth[_0xabca('0xc')](),controller[_0xabca('0x10')]);module[_0xabca('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 032d26c..940a9e2 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 _0xff5c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x39c883,_0x3d946a){var _0x267643=function(_0x170f8e){while(--_0x170f8e){_0x39c883['push'](_0x39c883['shift']());}};_0x267643(++_0x3d946a);}(_0xff5c,0x10b));var _0xcff5=function(_0x472bb0,_0x5d302b){_0x472bb0=_0x472bb0-0x0;var _0x52eba3=_0xff5c[_0x472bb0];return _0x52eba3;};'use strict';var multer=require(_0xcff5('0x0'));var util=require(_0xcff5('0x1'));var path=require(_0xcff5('0x2'));var timeout=require('connect-timeout');var express=require(_0xcff5('0x3'));var router=express[_0xcff5('0x4')]();var fs_extra=require(_0xcff5('0x5'));var auth=require(_0xcff5('0x6'));var interaction=require(_0xcff5('0x7'));var config=require(_0xcff5('0x8'));var controller=require(_0xcff5('0x9'));router[_0xcff5('0xa')]('/',auth[_0xcff5('0xb')](),controller[_0xcff5('0xc')]);router['get'](_0xcff5('0xd'),auth[_0xcff5('0xb')](),controller[_0xcff5('0xe')]);router[_0xcff5('0xa')](_0xcff5('0xf'),auth['isAuthenticated'](),controller[_0xcff5('0x10')]);router[_0xcff5('0xa')](_0xcff5('0x11'),auth[_0xcff5('0xb')](),controller[_0xcff5('0x12')]);router[_0xcff5('0x13')]('/',auth[_0xcff5('0xb')](),controller[_0xcff5('0x14')]);router['post'](_0xcff5('0xf'),auth['isAuthenticated'](),controller[_0xcff5('0x15')]);router[_0xcff5('0x16')](_0xcff5('0xd'),auth[_0xcff5('0xb')](),controller[_0xcff5('0x17')]);router[_0xcff5('0x18')](_0xcff5('0xd'),auth['isAuthenticated'](),controller[_0xcff5('0x19')]);module[_0xcff5('0x1a')]=router; \ No newline at end of file +var _0x04ae=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','destroy'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x04ae,0xc1));var _0xe04a=function(_0xc99dc5,_0x2df3c5){_0xc99dc5=_0xc99dc5-0x0;var _0x473bd5=_0x04ae[_0xc99dc5];return _0x473bd5;};'use strict';var multer=require(_0xe04a('0x0'));var util=require('util');var path=require(_0xe04a('0x1'));var timeout=require(_0xe04a('0x2'));var express=require(_0xe04a('0x3'));var router=express['Router']();var fs_extra=require(_0xe04a('0x4'));var auth=require(_0xe04a('0x5'));var interaction=require(_0xe04a('0x6'));var config=require(_0xe04a('0x7'));var controller=require(_0xe04a('0x8'));router[_0xe04a('0x9')]('/',auth[_0xe04a('0xa')](),controller[_0xe04a('0xb')]);router[_0xe04a('0x9')](_0xe04a('0xc'),auth[_0xe04a('0xa')](),controller[_0xe04a('0xd')]);router['get'](_0xe04a('0xe'),auth[_0xe04a('0xa')](),controller[_0xe04a('0xf')]);router[_0xe04a('0x9')](_0xe04a('0x10'),auth[_0xe04a('0xa')](),controller[_0xe04a('0x11')]);router[_0xe04a('0x12')]('/',auth[_0xe04a('0xa')](),controller[_0xe04a('0x13')]);router[_0xe04a('0x12')](_0xe04a('0xe'),auth['isAuthenticated'](),controller[_0xe04a('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe04a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe04a('0x16')]);module[_0xe04a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7a4c37e..540c23f 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 _0x52b3=['newTab','exports','STRING','ENUM','basic'];(function(_0x5a16f7,_0x15e545){var _0x5cb364=function(_0xfa7198){while(--_0xfa7198){_0x5a16f7['push'](_0x5a16f7['shift']());}};_0x5cb364(++_0x15e545);}(_0x52b3,0xfb));var _0x352b=function(_0x79b57f,_0x3c60f7){_0x79b57f=_0x79b57f-0x0;var _0x3a9423=_0x52b3[_0x79b57f];return _0x3a9423;};'use strict';var Sequelize=require('sequelize');module[_0x352b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x352b('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x352b('0x1')]},'authType':{'type':Sequelize[_0x352b('0x2')](_0x352b('0x3')),'defaultValue':_0x352b('0x3')},'password':{'type':Sequelize[_0x352b('0x1')]},'consumerKey':{'type':Sequelize[_0x352b('0x1')]},'consumerSecret':{'type':Sequelize[_0x352b('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x352b('0x1')]},'serverUrl':{'type':Sequelize[_0x352b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x352b('0x2')]('integrationTab',_0x352b('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x5649=['exports','STRING','basic','ENUM','newTab','sequelize'];(function(_0x371dc9,_0x2d1a66){var _0x49716e=function(_0x531bcf){while(--_0x531bcf){_0x371dc9['push'](_0x371dc9['shift']());}};_0x49716e(++_0x2d1a66);}(_0x5649,0x1c1));var _0x9564=function(_0x4ca536,_0x57c8de){_0x4ca536=_0x4ca536-0x0;var _0x3bd35f=_0x5649[_0x4ca536];return _0x3bd35f;};'use strict';var Sequelize=require(_0x9564('0x0'));module[_0x9564('0x1')]={'name':{'type':Sequelize[_0x9564('0x2')]},'description':{'type':Sequelize[_0x9564('0x2')]},'username':{'type':Sequelize[_0x9564('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x9564('0x3')),'defaultValue':_0x9564('0x3')},'password':{'type':Sequelize[_0x9564('0x2')]},'consumerKey':{'type':Sequelize[_0x9564('0x2')]},'consumerSecret':{'type':Sequelize[_0x9564('0x2')]},'token':{'type':Sequelize[_0x9564('0x2')]},'tokenSecret':{'type':Sequelize[_0x9564('0x2')]},'serverUrl':{'type':Sequelize[_0x9564('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9564('0x4')]('integrationTab',_0x9564('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index d42258f..48b735f 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 _0xc8eb=['_embedded','entries','active','label','statusCode','error','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','name','send','index','map','DeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','basic','headers','Authorization','Basic\x20%s','password','toString','concat'];(function(_0x3ae801,_0x506dc6){var _0x35772f=function(_0x21ef79){while(--_0x21ef79){_0x3ae801['push'](_0x3ae801['shift']());}};_0x35772f(++_0x506dc6);}(_0xc8eb,0xe7));var _0xbc8e=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0xc8eb[_0x3bd52b];return _0x1e5b89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc8e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc8e('0x1'));var rp=require('request-promise');var moment=require(_0xbc8e('0x2'));var BPromise=require(_0xbc8e('0x3'));var Mustache=require('mustache');var util=require(_0xbc8e('0x4'));var path=require(_0xbc8e('0x5'));var sox=require(_0xbc8e('0x6'));var csv=require(_0xbc8e('0x7'));var ejs=require(_0xbc8e('0x8'));var fs=require('fs');var fs_extra=require(_0xbc8e('0x9'));var _=require(_0xbc8e('0xa'));var squel=require('squel');var crypto=require(_0xbc8e('0xb'));var jsforce=require(_0xbc8e('0xc'));var deskjs=require(_0xbc8e('0xd'));var toCsv=require(_0xbc8e('0x7'));var querystring=require(_0xbc8e('0xe'));var Papa=require(_0xbc8e('0xf'));var Redis=require(_0xbc8e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbc8e('0x11'));var as=require(_0xbc8e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc8e('0x13'))('api');var utils=require(_0xbc8e('0x14'));var config=require(_0xbc8e('0x15'));var licenseUtil=require(_0xbc8e('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbc8e('0x17'));function respondWithStatusCode(_0x12cb2d,_0x345287){_0x345287=_0x345287||0xcc;return function(_0x1ee04c){if(_0x1ee04c){return _0x12cb2d[_0xbc8e('0x18')](_0x345287);}return _0x12cb2d[_0xbc8e('0x19')](_0x345287)[_0xbc8e('0x1a')]();};}function respondWithResult(_0x52f8d2,_0x887a6c){_0x887a6c=_0x887a6c||0xc8;return function(_0x529d7d){if(_0x529d7d){return _0x52f8d2[_0xbc8e('0x19')](_0x887a6c)[_0xbc8e('0x1b')](_0x529d7d);}};}function respondWithFilteredResult(_0x5285a9,_0x157d54){return function(_0x4c5c84){if(_0x4c5c84){var _0x5426ed=typeof _0x157d54[_0xbc8e('0x1c')]==='undefined'&&typeof _0x157d54['limit']===_0xbc8e('0x1d');var _0x3a2236=_0x4c5c84[_0xbc8e('0x1e')];var _0x42b8a1=_0x5426ed?0x0:_0x157d54['offset'];var _0x2a4d42=_0x5426ed?_0x4c5c84[_0xbc8e('0x1e')]:_0x157d54['offset']+_0x157d54['limit'];var _0x89e4ff;if(_0x2a4d42>=_0x3a2236){_0x2a4d42=_0x3a2236;_0x89e4ff=0xc8;}else{_0x89e4ff=0xce;}_0x5285a9[_0xbc8e('0x19')](_0x89e4ff);return _0x5285a9[_0xbc8e('0x1f')](_0xbc8e('0x20'),_0x42b8a1+'-'+_0x2a4d42+'/'+_0x3a2236)[_0xbc8e('0x1b')](_0x4c5c84);}return null;};}function patchUpdates(_0x2d7556){return function(_0x2baf73){try{jsonpatch['apply'](_0x2baf73,_0x2d7556,!![]);}catch(_0x3da4cb){return BPromise['reject'](_0x3da4cb);}return _0x2baf73['save']();};}function saveUpdates(_0x5db85b,_0xa2cc65){return function(_0x10ff48){if(_0x10ff48){return _0x10ff48[_0xbc8e('0x21')](_0x5db85b)[_0xbc8e('0x22')](function(_0x303967){return _0x303967;});}return null;};}function removeEntity(_0x4e9c7b,_0x208bd7){return function(_0x4e5f3b){if(_0x4e5f3b){return _0x4e5f3b[_0xbc8e('0x23')]()[_0xbc8e('0x22')](function(){_0x4e9c7b[_0xbc8e('0x19')](0xcc)[_0xbc8e('0x1a')]();});}};}function handleEntityNotFound(_0x5bcdbb,_0x5dd18b){return function(_0x5ec8fb){if(!_0x5ec8fb){_0x5bcdbb[_0xbc8e('0x18')](0x194);}return _0x5ec8fb;};}function handleError(_0x439fdd,_0x4be1a3){_0x4be1a3=_0x4be1a3||0x1f4;return function(_0x51173a){logger['error'](_0x51173a['stack']);if(_0x51173a[_0xbc8e('0x24')]){delete _0x51173a['name'];}_0x439fdd[_0xbc8e('0x19')](_0x4be1a3)[_0xbc8e('0x25')](_0x51173a);};}exports[_0xbc8e('0x26')]=function(_0x5c4cf4,_0x23ba83){var _0x114500={},_0x276c65={},_0x43a502={'count':0x0,'rows':[]};var _0x2331b3=_[_0xbc8e('0x27')](db[_0xbc8e('0x28')]['rawAttributes'],function(_0xfd9f46){return{'name':_0xfd9f46[_0xbc8e('0x29')],'type':_0xfd9f46[_0xbc8e('0x2a')][_0xbc8e('0x2b')]};});_0x276c65[_0xbc8e('0x2c')]=_[_0xbc8e('0x27')](_0x2331b3,_0xbc8e('0x24'));_0x276c65[_0xbc8e('0x2d')]=_[_0xbc8e('0x2e')](_0x5c4cf4['query']);_0x276c65[_0xbc8e('0x2f')]=_[_0xbc8e('0x30')](_0x276c65[_0xbc8e('0x2c')],_0x276c65[_0xbc8e('0x2d')]);_0x114500[_0xbc8e('0x31')]=_['intersection'](_0x276c65['model'],qs['fields'](_0x5c4cf4['query']['fields']));_0x114500[_0xbc8e('0x31')]=_0x114500['attributes'][_0xbc8e('0x32')]?_0x114500[_0xbc8e('0x31')]:_0x276c65[_0xbc8e('0x2c')];if(!_0x5c4cf4['query'][_0xbc8e('0x33')](_0xbc8e('0x34'))){_0x114500[_0xbc8e('0x35')]=qs[_0xbc8e('0x35')](_0x5c4cf4[_0xbc8e('0x2d')]['limit']);_0x114500[_0xbc8e('0x1c')]=qs['offset'](_0x5c4cf4['query'][_0xbc8e('0x1c')]);}_0x114500[_0xbc8e('0x36')]=qs['sort'](_0x5c4cf4[_0xbc8e('0x2d')][_0xbc8e('0x37')]);_0x114500[_0xbc8e('0x38')]=qs[_0xbc8e('0x2f')](_[_0xbc8e('0x39')](_0x5c4cf4[_0xbc8e('0x2d')],_0x276c65[_0xbc8e('0x2f')]),_0x2331b3);if(_0x5c4cf4[_0xbc8e('0x2d')][_0xbc8e('0x3a')]){_0x114500[_0xbc8e('0x38')]=_[_0xbc8e('0x3b')](_0x114500[_0xbc8e('0x38')],{'$or':_[_0xbc8e('0x27')](_0x2331b3,function(_0x597ce3){if(_0x597ce3['type']!==_0xbc8e('0x3c')){var _0x3219e5={};_0x3219e5[_0x597ce3[_0xbc8e('0x24')]]={'$like':'%'+_0x5c4cf4[_0xbc8e('0x2d')][_0xbc8e('0x3a')]+'%'};return _0x3219e5;}})});}_0x114500=_[_0xbc8e('0x3b')]({},_0x114500,_0x5c4cf4[_0xbc8e('0x3d')]);var _0x560532={'where':_0x114500['where']};return db[_0xbc8e('0x28')][_0xbc8e('0x1e')](_0x560532)[_0xbc8e('0x22')](function(_0x4196ed){_0x43a502[_0xbc8e('0x1e')]=_0x4196ed;if(_0x5c4cf4[_0xbc8e('0x2d')][_0xbc8e('0x3e')]){_0x114500[_0xbc8e('0x3f')]=[{'all':!![]}];}return db['DeskAccount'][_0xbc8e('0x40')](_0x114500);})[_0xbc8e('0x22')](function(_0x1966d3){_0x43a502[_0xbc8e('0x41')]=_0x1966d3;return _0x43a502;})[_0xbc8e('0x22')](respondWithFilteredResult(_0x23ba83,_0x114500))[_0xbc8e('0x42')](handleError(_0x23ba83,null));};exports[_0xbc8e('0x43')]=function(_0x2e30b7,_0x593cd3){var _0x8ab6c9={'raw':![],'where':{'id':_0x2e30b7[_0xbc8e('0x44')]['id']}},_0x1705ec={};_0x1705ec[_0xbc8e('0x2c')]=_[_0xbc8e('0x2e')](db[_0xbc8e('0x28')]['rawAttributes']);_0x1705ec['query']=_[_0xbc8e('0x2e')](_0x2e30b7[_0xbc8e('0x2d')]);_0x1705ec[_0xbc8e('0x2f')]=_['intersection'](_0x1705ec[_0xbc8e('0x2c')],_0x1705ec[_0xbc8e('0x2d')]);_0x8ab6c9['attributes']=_[_0xbc8e('0x30')](_0x1705ec[_0xbc8e('0x2c')],qs[_0xbc8e('0x45')](_0x2e30b7[_0xbc8e('0x2d')]['fields']));_0x8ab6c9[_0xbc8e('0x31')]=_0x8ab6c9[_0xbc8e('0x31')][_0xbc8e('0x32')]?_0x8ab6c9[_0xbc8e('0x31')]:_0x1705ec[_0xbc8e('0x2c')];if(_0x2e30b7[_0xbc8e('0x2d')][_0xbc8e('0x3e')]){_0x8ab6c9['include']=[{'all':!![]}];}_0x8ab6c9=_['merge']({},_0x8ab6c9,_0x2e30b7[_0xbc8e('0x3d')]);return db[_0xbc8e('0x28')][_0xbc8e('0x46')](_0x8ab6c9)[_0xbc8e('0x22')](handleEntityNotFound(_0x593cd3,null))[_0xbc8e('0x22')](respondWithResult(_0x593cd3,null))[_0xbc8e('0x42')](handleError(_0x593cd3,null));};exports[_0xbc8e('0x47')]=function(_0x132fd6,_0x344420){return db['DeskAccount']['create'](_0x132fd6[_0xbc8e('0x48')],{})[_0xbc8e('0x22')](respondWithResult(_0x344420,0xc9))[_0xbc8e('0x42')](handleError(_0x344420,null));};exports[_0xbc8e('0x21')]=function(_0x13bf8c,_0x320ac2){if(_0x13bf8c[_0xbc8e('0x48')]['id']){delete _0x13bf8c[_0xbc8e('0x48')]['id'];}return db[_0xbc8e('0x28')][_0xbc8e('0x46')]({'where':{'id':_0x13bf8c['params']['id']}})[_0xbc8e('0x22')](handleEntityNotFound(_0x320ac2,null))[_0xbc8e('0x22')](saveUpdates(_0x13bf8c[_0xbc8e('0x48')],null))[_0xbc8e('0x22')](respondWithResult(_0x320ac2,null))[_0xbc8e('0x42')](handleError(_0x320ac2,null));};exports['destroy']=function(_0x3bf0e4,_0x17aa47){return db[_0xbc8e('0x28')][_0xbc8e('0x46')]({'where':{'id':_0x3bf0e4['params']['id']}})[_0xbc8e('0x22')](handleEntityNotFound(_0x17aa47,null))[_0xbc8e('0x22')](removeEntity(_0x17aa47,null))[_0xbc8e('0x42')](handleError(_0x17aa47,null));};exports['getConfigurations']=function(_0x41c722,_0x1c8cbc,_0x299c92){var _0x464b8f={};var _0xe79cc8={};var _0x53ec12;var _0x213cf4;return db[_0xbc8e('0x28')][_0xbc8e('0x49')]({'where':{'id':_0x41c722[_0xbc8e('0x44')]['id']}})['then'](handleEntityNotFound(_0x1c8cbc,null))[_0xbc8e('0x22')](function(_0x3607ac){if(_0x3607ac){_0x53ec12=_0x3607ac;_0xe79cc8[_0xbc8e('0x2c')]=_[_0xbc8e('0x2e')](db[_0xbc8e('0x4a')]['rawAttributes']);_0xe79cc8[_0xbc8e('0x2d')]=_[_0xbc8e('0x2e')](_0x41c722[_0xbc8e('0x2d')]);_0xe79cc8['filters']=_[_0xbc8e('0x30')](_0xe79cc8[_0xbc8e('0x2c')],_0xe79cc8['query']);_0x464b8f[_0xbc8e('0x31')]=_[_0xbc8e('0x30')](_0xe79cc8[_0xbc8e('0x2c')],qs[_0xbc8e('0x45')](_0x41c722['query'][_0xbc8e('0x45')]));_0x464b8f[_0xbc8e('0x31')]=_0x464b8f[_0xbc8e('0x31')]['length']?_0x464b8f[_0xbc8e('0x31')]:_0xe79cc8[_0xbc8e('0x2c')];_0x464b8f[_0xbc8e('0x36')]=qs[_0xbc8e('0x37')](_0x41c722[_0xbc8e('0x2d')]['sort']);_0x464b8f[_0xbc8e('0x38')]=qs[_0xbc8e('0x2f')](_[_0xbc8e('0x39')](_0x41c722[_0xbc8e('0x2d')],_0xe79cc8['filters']));if(_0x41c722[_0xbc8e('0x2d')][_0xbc8e('0x3a')]){_0x464b8f[_0xbc8e('0x38')]=_[_0xbc8e('0x3b')](_0x464b8f[_0xbc8e('0x38')],{'$or':_['map'](_0x464b8f[_0xbc8e('0x31')],function(_0x57f39e){var _0x585d37={};_0x585d37[_0x57f39e]={'$like':'%'+_0x41c722['query'][_0xbc8e('0x3a')]+'%'};return _0x585d37;})});}_0x464b8f=_[_0xbc8e('0x3b')]({},_0x464b8f,_0x41c722[_0xbc8e('0x3d')]);return _0x53ec12[_0xbc8e('0x4b')](_0x464b8f);}})[_0xbc8e('0x22')](function(_0x1fee72){if(_0x1fee72){_0x213cf4=_0x1fee72[_0xbc8e('0x32')];if(!_0x41c722['query']['hasOwnProperty'](_0xbc8e('0x34'))){_0x464b8f[_0xbc8e('0x35')]=qs['limit'](_0x41c722[_0xbc8e('0x2d')]['limit']);_0x464b8f[_0xbc8e('0x1c')]=qs['offset'](_0x41c722[_0xbc8e('0x2d')][_0xbc8e('0x1c')]);}return _0x53ec12[_0xbc8e('0x4b')](_0x464b8f);}})[_0xbc8e('0x22')](function(_0x4e81dc){if(_0x4e81dc){return _0x4e81dc?{'count':_0x213cf4,'rows':_0x4e81dc}:null;}})[_0xbc8e('0x22')](respondWithResult(_0x1c8cbc,null))[_0xbc8e('0x42')](handleError(_0x1c8cbc,null));};exports[_0xbc8e('0x4c')]=function(_0x46df10,_0x52dafe,_0x58c736){if(_0x46df10['body']['id']){delete _0x46df10[_0xbc8e('0x48')]['id'];}return db[_0xbc8e('0x28')][_0xbc8e('0x49')]({'where':{'id':_0x46df10[_0xbc8e('0x44')]['id']}})[_0xbc8e('0x22')](handleEntityNotFound(_0x52dafe,null))['then'](function(_0x18fe39){if(_0x18fe39){_0x46df10['body'][_0xbc8e('0x4d')]=_0x18fe39['id'];_0x46df10['body'][_0xbc8e('0x4e')]=integrations[_0xbc8e('0x4f')](_0x46df10[_0xbc8e('0x48')][_0xbc8e('0x50')],_0x46df10[_0xbc8e('0x48')]['type']);_0x46df10[_0xbc8e('0x48')][_0xbc8e('0x51')]=integrations[_0xbc8e('0x52')](_0x46df10[_0xbc8e('0x48')]['channel'],_0x46df10[_0xbc8e('0x48')][_0xbc8e('0x2a')]);return db[_0xbc8e('0x4a')][_0xbc8e('0x47')](_0x46df10[_0xbc8e('0x48')],{'include':[{'model':db[_0xbc8e('0x53')],'as':_0xbc8e('0x4e')},{'model':db['DeskField'],'as':_0xbc8e('0x51')}]});}return null;})[_0xbc8e('0x22')](respondWithResult(_0x52dafe,null))['catch'](handleError(_0x52dafe,null));};exports[_0xbc8e('0x54')]=function(_0x243ea7,_0x4b535a,_0x3edcf3){var _0x218cdb=[{'name':_0xbc8e('0x55'),'label':_0xbc8e('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3b8081='';return db[_0xbc8e('0x28')][_0xbc8e('0x49')]({'where':{'id':_0x243ea7[_0xbc8e('0x44')]['id']},'attributes':['id',_0xbc8e('0x56'),_0xbc8e('0x57'),_0xbc8e('0x58'),'password',_0xbc8e('0x59'),_0xbc8e('0x5a'),_0xbc8e('0x5b'),_0xbc8e('0x5c')]})[_0xbc8e('0x22')](handleEntityNotFound(_0x4b535a,null))[_0xbc8e('0x22')](function(_0x1aa091){if(_0x1aa091){_0x3b8081=_0x1aa091[_0xbc8e('0x56')];var _0x39e56c=_0x3b8081[_0xbc8e('0x5d')](-0x1);if(_0x39e56c==='/'){_0x3b8081=_0x3b8081[_0xbc8e('0x5e')](0x0,_0x3b8081[_0xbc8e('0x5f')](_0x39e56c));}var _0x521306={'method':'GET','uri':util[_0xbc8e('0x60')](_0xbc8e('0x61'),_0x3b8081),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x1aa091['authType']===_0xbc8e('0x62')){_0x521306[_0xbc8e('0x63')][_0xbc8e('0x64')]=util[_0xbc8e('0x60')](_0xbc8e('0x65'),new Buffer(util['format']('%s:%s',_0x1aa091[_0xbc8e('0x58')],_0x1aa091[_0xbc8e('0x66')]))[_0xbc8e('0x67')]('base64'));}return rp(_0x521306)[_0xbc8e('0x22')](function(_0x396766){return _0x218cdb[_0xbc8e('0x68')](_[_0xbc8e('0x27')](_0x396766[_0xbc8e('0x69')][_0xbc8e('0x6a')],function(_0x3c8a01){return{'id':_0x3c8a01[_0xbc8e('0x24')],'name':_0x3c8a01['name'],'type':_0x3c8a01[_0xbc8e('0x2a')],'active':_0x3c8a01[_0xbc8e('0x6b')],'label':_0x3c8a01[_0xbc8e('0x6c')],'custom':!![]};}));});}})['then'](function(_0x2771e5){return{'count':_0x2771e5[_0xbc8e('0x32')],'rows':_0x2771e5};})[_0xbc8e('0x22')](respondWithResult(_0x4b535a,null))[_0xbc8e('0x42')](function(_0xfec473){var _0x49d766=_0x243ea7[_0xbc8e('0x2d')]['test']?0x1f4:_0xfec473[_0xbc8e('0x6d')]||0x1f4;logger[_0xbc8e('0x6e')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x49d766,JSON['stringify'](_0xfec473));delete _0xfec473['name'];if(_0x49d766===0x191){_0x49d766=0x190;}_0x4b535a[_0xbc8e('0x19')](_0x49d766)[_0xbc8e('0x25')](_0x243ea7[_0xbc8e('0x2d')]['test']?{'message':_0xbc8e('0x6f'),'statusCode':_0xfec473[_0xbc8e('0x6d')]}:_0xfec473);});}; \ No newline at end of file +var _0xfb5a=['include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','channel','getDescriptions','DeskField','priority','remoteUri','password','consumerKey','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','username','base64','concat','_embedded','entries','active','test','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','statusCode','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../components/integrations/configuration','end','status','offset','undefined','limit','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','count','includeAll'];(function(_0x1c8adb,_0x1b9cbd){var _0x22f001=function(_0x47318c){while(--_0x47318c){_0x1c8adb['push'](_0x1c8adb['shift']());}};_0x22f001(++_0x1b9cbd);}(_0xfb5a,0x178));var _0xafb5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfb5a[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xafb5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xafb5('0x1'));var moment=require(_0xafb5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xafb5('0x3'));var util=require(_0xafb5('0x4'));var path=require(_0xafb5('0x5'));var sox=require(_0xafb5('0x6'));var csv=require(_0xafb5('0x7'));var ejs=require(_0xafb5('0x8'));var fs=require('fs');var fs_extra=require(_0xafb5('0x9'));var _=require(_0xafb5('0xa'));var squel=require(_0xafb5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xafb5('0xc'));var toCsv=require(_0xafb5('0x7'));var querystring=require(_0xafb5('0xd'));var Papa=require(_0xafb5('0xe'));var Redis=require(_0xafb5('0xf'));var authService=require(_0xafb5('0x10'));var qs=require(_0xafb5('0x11'));var as=require(_0xafb5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafb5('0x13'))(_0xafb5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xafb5('0x15'));function respondWithStatusCode(_0x288dee,_0x148df2){_0x148df2=_0x148df2||0xcc;return function(_0x12473a){if(_0x12473a){return _0x288dee['sendStatus'](_0x148df2);}return _0x288dee['status'](_0x148df2)[_0xafb5('0x16')]();};}function respondWithResult(_0x529547,_0x4cd494){_0x4cd494=_0x4cd494||0xc8;return function(_0x538b3f){if(_0x538b3f){return _0x529547[_0xafb5('0x17')](_0x4cd494)['json'](_0x538b3f);}};}function respondWithFilteredResult(_0x1afea8,_0x575483){return function(_0x34773d){if(_0x34773d){var _0x130936=typeof _0x575483[_0xafb5('0x18')]===_0xafb5('0x19')&&typeof _0x575483[_0xafb5('0x1a')]===_0xafb5('0x19');var _0x154815=_0x34773d['count'];var _0x547086=_0x130936?0x0:_0x575483['offset'];var _0x4e7797=_0x130936?_0x34773d['count']:_0x575483[_0xafb5('0x18')]+_0x575483['limit'];var _0x526cb3;if(_0x4e7797>=_0x154815){_0x4e7797=_0x154815;_0x526cb3=0xc8;}else{_0x526cb3=0xce;}_0x1afea8[_0xafb5('0x17')](_0x526cb3);return _0x1afea8['set'](_0xafb5('0x1b'),_0x547086+'-'+_0x4e7797+'/'+_0x154815)[_0xafb5('0x1c')](_0x34773d);}return null;};}function patchUpdates(_0x5e736e){return function(_0x1b34b0){try{jsonpatch[_0xafb5('0x1d')](_0x1b34b0,_0x5e736e,!![]);}catch(_0x57614b){return BPromise['reject'](_0x57614b);}return _0x1b34b0[_0xafb5('0x1e')]();};}function saveUpdates(_0x2ff627,_0x2bdb17){return function(_0xaf827b){if(_0xaf827b){return _0xaf827b[_0xafb5('0x1f')](_0x2ff627)[_0xafb5('0x20')](function(_0x398283){return _0x398283;});}return null;};}function removeEntity(_0x3469b9,_0x96dcfc){return function(_0x46d8c6){if(_0x46d8c6){return _0x46d8c6[_0xafb5('0x21')]()[_0xafb5('0x20')](function(){_0x3469b9[_0xafb5('0x17')](0xcc)[_0xafb5('0x16')]();});}};}function handleEntityNotFound(_0x491c06,_0x445de9){return function(_0x40cd8d){if(!_0x40cd8d){_0x491c06[_0xafb5('0x22')](0x194);}return _0x40cd8d;};}function handleError(_0x1868ba,_0x74326f){_0x74326f=_0x74326f||0x1f4;return function(_0x210ae3){logger[_0xafb5('0x23')](_0x210ae3[_0xafb5('0x24')]);if(_0x210ae3[_0xafb5('0x25')]){delete _0x210ae3[_0xafb5('0x25')];}_0x1868ba[_0xafb5('0x17')](_0x74326f)['send'](_0x210ae3);};}exports[_0xafb5('0x26')]=function(_0x51a52b,_0x11f565){var _0x4c5e4a={},_0x51e07f={},_0x4ceda0={'count':0x0,'rows':[]};var _0x2a05c6=_['map'](db[_0xafb5('0x27')][_0xafb5('0x28')],function(_0x5b9317){return{'name':_0x5b9317[_0xafb5('0x29')],'type':_0x5b9317[_0xafb5('0x2a')][_0xafb5('0x2b')]};});_0x51e07f[_0xafb5('0x2c')]=_[_0xafb5('0x2d')](_0x2a05c6,_0xafb5('0x25'));_0x51e07f[_0xafb5('0x2e')]=_[_0xafb5('0x2f')](_0x51a52b[_0xafb5('0x2e')]);_0x51e07f['filters']=_[_0xafb5('0x30')](_0x51e07f[_0xafb5('0x2c')],_0x51e07f['query']);_0x4c5e4a[_0xafb5('0x31')]=_['intersection'](_0x51e07f[_0xafb5('0x2c')],qs['fields'](_0x51a52b['query'][_0xafb5('0x32')]));_0x4c5e4a[_0xafb5('0x31')]=_0x4c5e4a[_0xafb5('0x31')][_0xafb5('0x33')]?_0x4c5e4a['attributes']:_0x51e07f['model'];if(!_0x51a52b[_0xafb5('0x2e')][_0xafb5('0x34')](_0xafb5('0x35'))){_0x4c5e4a[_0xafb5('0x1a')]=qs[_0xafb5('0x1a')](_0x51a52b[_0xafb5('0x2e')]['limit']);_0x4c5e4a[_0xafb5('0x18')]=qs['offset'](_0x51a52b['query'][_0xafb5('0x18')]);}_0x4c5e4a[_0xafb5('0x36')]=qs[_0xafb5('0x37')](_0x51a52b['query'][_0xafb5('0x37')]);_0x4c5e4a[_0xafb5('0x38')]=qs[_0xafb5('0x39')](_['pick'](_0x51a52b[_0xafb5('0x2e')],_0x51e07f['filters']),_0x2a05c6);if(_0x51a52b['query']['filter']){_0x4c5e4a[_0xafb5('0x38')]=_['merge'](_0x4c5e4a[_0xafb5('0x38')],{'$or':_[_0xafb5('0x2d')](_0x2a05c6,function(_0xa45dc7){if(_0xa45dc7[_0xafb5('0x2a')]!==_0xafb5('0x3a')){var _0xb6a82a={};_0xb6a82a[_0xa45dc7['name']]={'$like':'%'+_0x51a52b[_0xafb5('0x2e')][_0xafb5('0x3b')]+'%'};return _0xb6a82a;}})});}_0x4c5e4a=_[_0xafb5('0x3c')]({},_0x4c5e4a,_0x51a52b[_0xafb5('0x3d')]);var _0x18209c={'where':_0x4c5e4a[_0xafb5('0x38')]};return db['DeskAccount'][_0xafb5('0x3e')](_0x18209c)[_0xafb5('0x20')](function(_0x49e0a7){_0x4ceda0[_0xafb5('0x3e')]=_0x49e0a7;if(_0x51a52b[_0xafb5('0x2e')][_0xafb5('0x3f')]){_0x4c5e4a[_0xafb5('0x40')]=[{'all':!![]}];}return db[_0xafb5('0x27')][_0xafb5('0x41')](_0x4c5e4a);})['then'](function(_0x229dd8){_0x4ceda0[_0xafb5('0x42')]=_0x229dd8;return _0x4ceda0;})[_0xafb5('0x20')](respondWithFilteredResult(_0x11f565,_0x4c5e4a))[_0xafb5('0x43')](handleError(_0x11f565,null));};exports[_0xafb5('0x44')]=function(_0x162ead,_0x24b10c){var _0x2cb42d={'raw':![],'where':{'id':_0x162ead[_0xafb5('0x45')]['id']}},_0x3d6ffa={};_0x3d6ffa['model']=_[_0xafb5('0x2f')](db['DeskAccount'][_0xafb5('0x28')]);_0x3d6ffa[_0xafb5('0x2e')]=_[_0xafb5('0x2f')](_0x162ead[_0xafb5('0x2e')]);_0x3d6ffa[_0xafb5('0x39')]=_['intersection'](_0x3d6ffa['model'],_0x3d6ffa[_0xafb5('0x2e')]);_0x2cb42d[_0xafb5('0x31')]=_[_0xafb5('0x30')](_0x3d6ffa[_0xafb5('0x2c')],qs[_0xafb5('0x32')](_0x162ead[_0xafb5('0x2e')][_0xafb5('0x32')]));_0x2cb42d[_0xafb5('0x31')]=_0x2cb42d['attributes'][_0xafb5('0x33')]?_0x2cb42d['attributes']:_0x3d6ffa[_0xafb5('0x2c')];if(_0x162ead[_0xafb5('0x2e')][_0xafb5('0x3f')]){_0x2cb42d['include']=[{'all':!![]}];}_0x2cb42d=_['merge']({},_0x2cb42d,_0x162ead['options']);return db[_0xafb5('0x27')][_0xafb5('0x46')](_0x2cb42d)[_0xafb5('0x20')](handleEntityNotFound(_0x24b10c,null))['then'](respondWithResult(_0x24b10c,null))['catch'](handleError(_0x24b10c,null));};exports[_0xafb5('0x47')]=function(_0x596170,_0x27cb38){return db[_0xafb5('0x27')][_0xafb5('0x47')](_0x596170[_0xafb5('0x48')],{})[_0xafb5('0x20')](respondWithResult(_0x27cb38,0xc9))[_0xafb5('0x43')](handleError(_0x27cb38,null));};exports[_0xafb5('0x1f')]=function(_0x245746,_0x2b49a4){if(_0x245746[_0xafb5('0x48')]['id']){delete _0x245746[_0xafb5('0x48')]['id'];}return db['DeskAccount'][_0xafb5('0x46')]({'where':{'id':_0x245746[_0xafb5('0x45')]['id']}})[_0xafb5('0x20')](handleEntityNotFound(_0x2b49a4,null))[_0xafb5('0x20')](saveUpdates(_0x245746[_0xafb5('0x48')],null))[_0xafb5('0x20')](respondWithResult(_0x2b49a4,null))[_0xafb5('0x43')](handleError(_0x2b49a4,null));};exports[_0xafb5('0x21')]=function(_0x3c4e88,_0x18f328){return db[_0xafb5('0x27')][_0xafb5('0x46')]({'where':{'id':_0x3c4e88[_0xafb5('0x45')]['id']}})[_0xafb5('0x20')](handleEntityNotFound(_0x18f328,null))['then'](removeEntity(_0x18f328,null))[_0xafb5('0x43')](handleError(_0x18f328,null));};exports[_0xafb5('0x49')]=function(_0x445f82,_0x50a608,_0x29dd82){var _0x13d887={};var _0xdb0cc2={};var _0x4072d0;var _0x565410;return db[_0xafb5('0x27')][_0xafb5('0x4a')]({'where':{'id':_0x445f82[_0xafb5('0x45')]['id']}})[_0xafb5('0x20')](handleEntityNotFound(_0x50a608,null))[_0xafb5('0x20')](function(_0x412c13){if(_0x412c13){_0x4072d0=_0x412c13;_0xdb0cc2[_0xafb5('0x2c')]=_[_0xafb5('0x2f')](db[_0xafb5('0x4b')][_0xafb5('0x28')]);_0xdb0cc2[_0xafb5('0x2e')]=_[_0xafb5('0x2f')](_0x445f82[_0xafb5('0x2e')]);_0xdb0cc2['filters']=_[_0xafb5('0x30')](_0xdb0cc2[_0xafb5('0x2c')],_0xdb0cc2[_0xafb5('0x2e')]);_0x13d887['attributes']=_[_0xafb5('0x30')](_0xdb0cc2['model'],qs[_0xafb5('0x32')](_0x445f82[_0xafb5('0x2e')][_0xafb5('0x32')]));_0x13d887[_0xafb5('0x31')]=_0x13d887['attributes'][_0xafb5('0x33')]?_0x13d887['attributes']:_0xdb0cc2[_0xafb5('0x2c')];_0x13d887[_0xafb5('0x36')]=qs[_0xafb5('0x37')](_0x445f82[_0xafb5('0x2e')]['sort']);_0x13d887[_0xafb5('0x38')]=qs['filters'](_['pick'](_0x445f82[_0xafb5('0x2e')],_0xdb0cc2['filters']));if(_0x445f82[_0xafb5('0x2e')][_0xafb5('0x3b')]){_0x13d887[_0xafb5('0x38')]=_[_0xafb5('0x3c')](_0x13d887[_0xafb5('0x38')],{'$or':_[_0xafb5('0x2d')](_0x13d887['attributes'],function(_0x3da6cb){var _0x275254={};_0x275254[_0x3da6cb]={'$like':'%'+_0x445f82['query'][_0xafb5('0x3b')]+'%'};return _0x275254;})});}_0x13d887=_['merge']({},_0x13d887,_0x445f82[_0xafb5('0x3d')]);return _0x4072d0['getConfigurations'](_0x13d887);}})[_0xafb5('0x20')](function(_0x4f9bc0){if(_0x4f9bc0){_0x565410=_0x4f9bc0[_0xafb5('0x33')];if(!_0x445f82[_0xafb5('0x2e')][_0xafb5('0x34')]('nolimit')){_0x13d887[_0xafb5('0x1a')]=qs[_0xafb5('0x1a')](_0x445f82[_0xafb5('0x2e')][_0xafb5('0x1a')]);_0x13d887['offset']=qs['offset'](_0x445f82[_0xafb5('0x2e')]['offset']);}return _0x4072d0[_0xafb5('0x49')](_0x13d887);}})[_0xafb5('0x20')](function(_0x3911f4){if(_0x3911f4){return _0x3911f4?{'count':_0x565410,'rows':_0x3911f4}:null;}})[_0xafb5('0x20')](respondWithResult(_0x50a608,null))[_0xafb5('0x43')](handleError(_0x50a608,null));};exports[_0xafb5('0x4c')]=function(_0x3b6f87,_0x273050,_0x281436){if(_0x3b6f87[_0xafb5('0x48')]['id']){delete _0x3b6f87['body']['id'];}return db[_0xafb5('0x27')][_0xafb5('0x4a')]({'where':{'id':_0x3b6f87[_0xafb5('0x45')]['id']}})['then'](handleEntityNotFound(_0x273050,null))[_0xafb5('0x20')](function(_0x44bcbf){if(_0x44bcbf){_0x3b6f87[_0xafb5('0x48')][_0xafb5('0x4d')]=_0x44bcbf['id'];_0x3b6f87[_0xafb5('0x48')][_0xafb5('0x4e')]=integrations['getSubjects'](_0x3b6f87[_0xafb5('0x48')][_0xafb5('0x4f')],_0x3b6f87['body'][_0xafb5('0x2a')]);_0x3b6f87['body']['Descriptions']=integrations[_0xafb5('0x50')](_0x3b6f87[_0xafb5('0x48')]['channel'],_0x3b6f87[_0xafb5('0x48')][_0xafb5('0x2a')]);return db[_0xafb5('0x4b')][_0xafb5('0x47')](_0x3b6f87[_0xafb5('0x48')],{'include':[{'model':db[_0xafb5('0x51')],'as':_0xafb5('0x4e')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0xafb5('0x20')](respondWithResult(_0x273050,null))['catch'](handleError(_0x273050,null));};exports['getFields']=function(_0xc714d3,_0xe82294,_0x145cef){var _0x5e7405=[{'name':_0xafb5('0x52'),'label':_0xafb5('0x52'),'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 _0x56a82f='';return db[_0xafb5('0x27')][_0xafb5('0x4a')]({'where':{'id':_0xc714d3[_0xafb5('0x45')]['id']},'attributes':['id',_0xafb5('0x53'),'authType','username',_0xafb5('0x54'),_0xafb5('0x55'),'consumerSecret',_0xafb5('0x56'),'tokenSecret']})[_0xafb5('0x20')](handleEntityNotFound(_0xe82294,null))['then'](function(_0x1139cc){if(_0x1139cc){_0x56a82f=_0x1139cc['remoteUri'];var _0x587422=_0x56a82f[_0xafb5('0x57')](-0x1);if(_0x587422==='/'){_0x56a82f=_0x56a82f[_0xafb5('0x58')](0x0,_0x56a82f[_0xafb5('0x59')](_0x587422));}var _0x11347b={'method':_0xafb5('0x5a'),'uri':util[_0xafb5('0x5b')](_0xafb5('0x5c'),_0x56a82f),'headers':{'Content-Type':_0xafb5('0x5d'),'Accept':_0xafb5('0x5d')},'json':!![]};if(_0x1139cc['authType']===_0xafb5('0x5e')){_0x11347b[_0xafb5('0x5f')][_0xafb5('0x60')]=util['format'](_0xafb5('0x61'),new Buffer(util[_0xafb5('0x5b')]('%s:%s',_0x1139cc[_0xafb5('0x62')],_0x1139cc[_0xafb5('0x54')]))['toString'](_0xafb5('0x63')));}return rp(_0x11347b)[_0xafb5('0x20')](function(_0x3919f4){return _0x5e7405[_0xafb5('0x64')](_[_0xafb5('0x2d')](_0x3919f4[_0xafb5('0x65')][_0xafb5('0x66')],function(_0x2b1b12){return{'id':_0x2b1b12['name'],'name':_0x2b1b12[_0xafb5('0x25')],'type':_0x2b1b12[_0xafb5('0x2a')],'active':_0x2b1b12[_0xafb5('0x67')],'label':_0x2b1b12['label'],'custom':!![]};}));});}})[_0xafb5('0x20')](function(_0x341c8f){return{'count':_0x341c8f[_0xafb5('0x33')],'rows':_0x341c8f};})['then'](respondWithResult(_0xe82294,null))[_0xafb5('0x43')](function(_0xbf6dda){var _0x543282=_0xc714d3['query'][_0xafb5('0x68')]?0x1f4:_0xbf6dda['statusCode']||0x1f4;logger[_0xafb5('0x23')](_0xafb5('0x69'),_0xafb5('0x6a'),_0x543282,JSON['stringify'](_0xbf6dda));delete _0xbf6dda[_0xafb5('0x25')];if(_0x543282===0x191){_0x543282=0x190;}_0xe82294['status'](_0x543282)[_0xafb5('0x6b')](_0xc714d3[_0xafb5('0x2e')][_0xafb5('0x68')]?{'message':_0xafb5('0x6c'),'statusCode':_0xbf6dda[_0xafb5('0x6d')]}:_0xbf6dda);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9cc796f..f43a68c 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 _0xf253=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x34160c,_0x1eaa17){var _0x28ab7e=function(_0x20b2e5){while(--_0x20b2e5){_0x34160c['push'](_0x34160c['shift']());}};_0x28ab7e(++_0x1eaa17);}(_0xf253,0xca));var _0x3f25=function(_0x2baa81,_0x2c18db){_0x2baa81=_0x2baa81-0x0;var _0x3c4eee=_0xf253[_0x2baa81];return _0x3c4eee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f25('0x0'))(_0x3f25('0x1'));var moment=require(_0x3f25('0x2'));var BPromise=require(_0x3f25('0x3'));var rp=require(_0x3f25('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f25('0x5'));var config=require(_0x3f25('0x6'));var attributes=require(_0x3f25('0x7'));var integrations=require(_0x3f25('0x8'));module[_0x3f25('0x9')]=function(_0x1db616,_0x2e3895){return _0x1db616[_0x3f25('0xa')](_0x3f25('0xb'),attributes,{'tableName':_0x3f25('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x424b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x5cf9c8,_0x418a21){var _0x46cfb6=function(_0x6d1691){while(--_0x6d1691){_0x5cf9c8['push'](_0x5cf9c8['shift']());}};_0x46cfb6(++_0x418a21);}(_0x424b,0x1e8));var _0xb424=function(_0x30993d,_0x232e6c){_0x30993d=_0x30993d-0x0;var _0x590716=_0x424b[_0x30993d];return _0x590716;};'use strict';var _=require(_0xb424('0x0'));var util=require(_0xb424('0x1'));var logger=require(_0xb424('0x2'))(_0xb424('0x3'));var moment=require(_0xb424('0x4'));var BPromise=require(_0xb424('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb424('0x6'));var rimraf=require(_0xb424('0x7'));var config=require(_0xb424('0x8'));var attributes=require(_0xb424('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xb424('0xa')]=function(_0x5e9ee4,_0x42f77f){return _0x5e9ee4[_0xb424('0xb')](_0xb424('0xc'),attributes,{'tableName':_0xb424('0xd'),'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 7a688ee..5aa2a79 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 _0x36cb=['client','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowDeskAccount','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5f0fcf,_0x5b03b1){var _0x136c7b=function(_0x83b89f){while(--_0x83b89f){_0x5f0fcf['push'](_0x5f0fcf['shift']());}};_0x136c7b(++_0x5b03b1);}(_0x36cb,0x178));var _0xb36c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x36cb[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xb36c('0x0'));var util=require(_0xb36c('0x1'));var moment=require(_0xb36c('0x2'));var BPromise=require(_0xb36c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb36c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb36c('0x5'));var logger=require(_0xb36c('0x6'))('rpc');var config=require(_0xb36c('0x7'));var jayson=require(_0xb36c('0x8'));var client=jayson[_0xb36c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x495bde,_0x263e2a,_0x3cff67){return new BPromise(function(_0x1521f4,_0x38ef82){return client[_0xb36c('0xa')](_0x495bde,_0x3cff67)[_0xb36c('0xb')](function(_0x5bc0e6){logger[_0xb36c('0xc')](_0xb36c('0xd'),_0x263e2a,'request\x20sent');logger[_0xb36c('0xe')](_0xb36c('0xf'),_0x263e2a,_0xb36c('0x10'),JSON['stringify'](_0x5bc0e6));if(_0x5bc0e6['error']){if(_0x5bc0e6[_0xb36c('0x11')][_0xb36c('0x12')]===0x1f4){logger['error'](_0xb36c('0xd'),_0x263e2a,_0x5bc0e6[_0xb36c('0x11')][_0xb36c('0x13')]);return _0x38ef82(_0x5bc0e6['error'][_0xb36c('0x13')]);}logger['error'](_0xb36c('0xd'),_0x263e2a,_0x5bc0e6['error'][_0xb36c('0x13')]);return _0x1521f4(_0x5bc0e6[_0xb36c('0x11')][_0xb36c('0x13')]);}else{logger['info'](_0xb36c('0xd'),_0x263e2a,_0xb36c('0x10'));_0x1521f4(_0x5bc0e6['result'][_0xb36c('0x13')]);}})[_0xb36c('0x14')](function(_0x5acb35){logger[_0xb36c('0x11')]('DeskAccount,\x20%s,\x20%s',_0x263e2a,_0x5acb35);_0x38ef82(_0x5acb35);});});}exports[_0xb36c('0x15')]=function(_0x43c468){var _0x16a492=this;return new Promise(function(_0x2c909d,_0x4c1f84){return db[_0xb36c('0x16')][_0xb36c('0x17')]({'raw':_0x43c468[_0xb36c('0x18')]?_0x43c468['options'][_0xb36c('0x19')]===undefined?!![]:![]:!![],'where':_0x43c468[_0xb36c('0x18')]?_0x43c468['options'][_0xb36c('0x1a')]||null:null,'attributes':_0x43c468[_0xb36c('0x18')]?_0x43c468['options'][_0xb36c('0x1b')]||null:null,'limit':_0x43c468[_0xb36c('0x18')]?_0x43c468['options'][_0xb36c('0x1c')]||null:null,'include':_0x43c468[_0xb36c('0x18')]?_0x43c468[_0xb36c('0x18')][_0xb36c('0x1d')]?_[_0xb36c('0x1e')](_0x43c468[_0xb36c('0x18')][_0xb36c('0x1d')],function(_0x179ac0){return{'model':db[_0x179ac0[_0xb36c('0x1f')]],'as':_0x179ac0['as'],'attributes':_0x179ac0[_0xb36c('0x1b')],'include':_0x179ac0[_0xb36c('0x1d')]?_[_0xb36c('0x1e')](_0x179ac0[_0xb36c('0x1d')],function(_0x23361e){return{'model':db[_0x23361e[_0xb36c('0x1f')]],'as':_0x23361e['as'],'attributes':_0x23361e['attributes'],'include':_0x23361e['include']?_[_0xb36c('0x1e')](_0x23361e[_0xb36c('0x1d')],function(_0x5f7211){return{'model':db[_0x5f7211[_0xb36c('0x1f')]],'as':_0x5f7211['as'],'attributes':_0x5f7211[_0xb36c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d9839){logger[_0xb36c('0xc')]('GetDeskAccount',_0x43c468);logger['debug'](_0xb36c('0x15'),_0x43c468,JSON[_0xb36c('0x20')](_0x1d9839));_0x2c909d(_0x1d9839);})[_0xb36c('0x14')](function(_0x2114e4){logger[_0xb36c('0x11')]('GetDeskAccount',_0x2114e4['message'],_0x43c468);_0x4c1f84(_0x16a492[_0xb36c('0x11')](0x1f4,_0x2114e4[_0xb36c('0x13')]));});});};exports['ShowDeskAccount']=function(_0x327faa){var _0x2f8a62=this;return new Promise(function(_0x536cd3,_0x1a8259){return db[_0xb36c('0x16')][_0xb36c('0x21')]({'raw':_0x327faa[_0xb36c('0x18')]?_0x327faa['options']['raw']===undefined?!![]:![]:!![],'where':_0x327faa[_0xb36c('0x18')]?_0x327faa[_0xb36c('0x18')][_0xb36c('0x1a')]||null:null,'attributes':_0x327faa['options']?_0x327faa[_0xb36c('0x18')]['attributes']||null:null,'include':_0x327faa[_0xb36c('0x18')]?_0x327faa[_0xb36c('0x18')][_0xb36c('0x1d')]?_['map'](_0x327faa[_0xb36c('0x18')]['include'],function(_0x242819){return{'model':db[_0x242819[_0xb36c('0x1f')]],'as':_0x242819['as'],'attributes':_0x242819['attributes'],'include':_0x242819[_0xb36c('0x1d')]?_[_0xb36c('0x1e')](_0x242819['include'],function(_0x35bcab){return{'model':db[_0x35bcab[_0xb36c('0x1f')]],'as':_0x35bcab['as'],'attributes':_0x35bcab[_0xb36c('0x1b')],'include':_0x35bcab[_0xb36c('0x1d')]?_[_0xb36c('0x1e')](_0x35bcab['include'],function(_0x4ca81b){return{'model':db[_0x4ca81b[_0xb36c('0x1f')]],'as':_0x4ca81b['as'],'attributes':_0x4ca81b[_0xb36c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb36c('0xb')](function(_0x1d14dc){logger[_0xb36c('0xc')]('ShowDeskAccount',_0x327faa);logger[_0xb36c('0xe')](_0xb36c('0x22'),_0x327faa,JSON[_0xb36c('0x20')](_0x1d14dc));_0x536cd3(_0x1d14dc);})['catch'](function(_0x51f38f){logger['error'](_0xb36c('0x22'),_0x51f38f[_0xb36c('0x13')],_0x327faa);_0x1a8259(_0x2f8a62[_0xb36c('0x11')](0x1f4,_0x51f38f[_0xb36c('0x13')]));});});}; \ No newline at end of file +var _0x571c=['then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','include','map','model','ShowDeskAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x571c,0x7d));var _0xc571=function(_0x5cac91,_0x585f34){_0x5cac91=_0x5cac91-0x0;var _0xb845ac=_0x571c[_0x5cac91];return _0xb845ac;};'use strict';var _=require(_0xc571('0x0'));var util=require(_0xc571('0x1'));var moment=require('moment');var BPromise=require(_0xc571('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc571('0x3'));var db=require(_0xc571('0x4'))['db'];var utils=require(_0xc571('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc571('0x6'));var jayson=require(_0xc571('0x7'));var client=jayson[_0xc571('0x8')][_0xc571('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534dd1,_0x757ed9,_0x2a57e5){return new BPromise(function(_0x385e28,_0x211afe){return client[_0xc571('0xa')](_0x534dd1,_0x2a57e5)[_0xc571('0xb')](function(_0x54e4f8){logger['info'](_0xc571('0xc'),_0x757ed9,'request\x20sent');logger[_0xc571('0xd')](_0xc571('0xe'),_0x757ed9,_0xc571('0xf'),JSON[_0xc571('0x10')](_0x54e4f8));if(_0x54e4f8[_0xc571('0x11')]){if(_0x54e4f8[_0xc571('0x11')][_0xc571('0x12')]===0x1f4){logger[_0xc571('0x11')](_0xc571('0xc'),_0x757ed9,_0x54e4f8[_0xc571('0x11')]['message']);return _0x211afe(_0x54e4f8['error']['message']);}logger[_0xc571('0x11')](_0xc571('0xc'),_0x757ed9,_0x54e4f8['error'][_0xc571('0x13')]);return _0x385e28(_0x54e4f8[_0xc571('0x11')][_0xc571('0x13')]);}else{logger[_0xc571('0x14')](_0xc571('0xc'),_0x757ed9,_0xc571('0xf'));_0x385e28(_0x54e4f8[_0xc571('0x15')][_0xc571('0x13')]);}})[_0xc571('0x16')](function(_0x59b81d){logger[_0xc571('0x11')](_0xc571('0xc'),_0x757ed9,_0x59b81d);_0x211afe(_0x59b81d);});});}exports[_0xc571('0x17')]=function(_0x146ba1){var _0x3ee4be=this;return new Promise(function(_0x18e1c2,_0xe92c01){return db[_0xc571('0x18')]['findAll']({'raw':_0x146ba1[_0xc571('0x19')]?_0x146ba1['options'][_0xc571('0x1a')]===undefined?!![]:![]:!![],'where':_0x146ba1[_0xc571('0x19')]?_0x146ba1[_0xc571('0x19')][_0xc571('0x1b')]||null:null,'attributes':_0x146ba1[_0xc571('0x19')]?_0x146ba1[_0xc571('0x19')][_0xc571('0x1c')]||null:null,'limit':_0x146ba1[_0xc571('0x19')]?_0x146ba1[_0xc571('0x19')]['limit']||null:null,'include':_0x146ba1['options']?_0x146ba1['options'][_0xc571('0x1d')]?_[_0xc571('0x1e')](_0x146ba1[_0xc571('0x19')]['include'],function(_0x5aca6f){return{'model':db[_0x5aca6f[_0xc571('0x1f')]],'as':_0x5aca6f['as'],'attributes':_0x5aca6f[_0xc571('0x1c')],'include':_0x5aca6f['include']?_[_0xc571('0x1e')](_0x5aca6f[_0xc571('0x1d')],function(_0x748d08){return{'model':db[_0x748d08['model']],'as':_0x748d08['as'],'attributes':_0x748d08[_0xc571('0x1c')],'include':_0x748d08['include']?_[_0xc571('0x1e')](_0x748d08[_0xc571('0x1d')],function(_0x3928c4){return{'model':db[_0x3928c4[_0xc571('0x1f')]],'as':_0x3928c4['as'],'attributes':_0x3928c4[_0xc571('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc571('0xb')](function(_0x16467d){logger['info']('GetDeskAccount',_0x146ba1);logger[_0xc571('0xd')](_0xc571('0x17'),_0x146ba1,JSON[_0xc571('0x10')](_0x16467d));_0x18e1c2(_0x16467d);})[_0xc571('0x16')](function(_0x22d107){logger[_0xc571('0x11')](_0xc571('0x17'),_0x22d107[_0xc571('0x13')],_0x146ba1);_0xe92c01(_0x3ee4be[_0xc571('0x11')](0x1f4,_0x22d107[_0xc571('0x13')]));});});};exports[_0xc571('0x20')]=function(_0xc2282d){var _0xdc861d=this;return new Promise(function(_0x3ced60,_0x4d57a1){return db[_0xc571('0x18')][_0xc571('0x21')]({'raw':_0xc2282d['options']?_0xc2282d[_0xc571('0x19')][_0xc571('0x1a')]===undefined?!![]:![]:!![],'where':_0xc2282d[_0xc571('0x19')]?_0xc2282d[_0xc571('0x19')][_0xc571('0x1b')]||null:null,'attributes':_0xc2282d[_0xc571('0x19')]?_0xc2282d[_0xc571('0x19')][_0xc571('0x1c')]||null:null,'include':_0xc2282d[_0xc571('0x19')]?_0xc2282d['options'][_0xc571('0x1d')]?_[_0xc571('0x1e')](_0xc2282d['options']['include'],function(_0x24ef80){return{'model':db[_0x24ef80['model']],'as':_0x24ef80['as'],'attributes':_0x24ef80[_0xc571('0x1c')],'include':_0x24ef80['include']?_[_0xc571('0x1e')](_0x24ef80[_0xc571('0x1d')],function(_0x22deca){return{'model':db[_0x22deca[_0xc571('0x1f')]],'as':_0x22deca['as'],'attributes':_0x22deca[_0xc571('0x1c')],'include':_0x22deca[_0xc571('0x1d')]?_['map'](_0x22deca[_0xc571('0x1d')],function(_0x4caca5){return{'model':db[_0x4caca5[_0xc571('0x1f')]],'as':_0x4caca5['as'],'attributes':_0x4caca5[_0xc571('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56dea5){logger['info'](_0xc571('0x20'),_0xc2282d);logger[_0xc571('0xd')]('ShowDeskAccount',_0xc2282d,JSON[_0xc571('0x10')](_0x56dea5));_0x3ced60(_0x56dea5);})[_0xc571('0x16')](function(_0x311602){logger[_0xc571('0x11')](_0xc571('0x20'),_0x311602[_0xc571('0x13')],_0xc2282d);_0x4d57a1(_0xdc861d[_0xc571('0x11')](0x1f4,_0x311602['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f7c25e4..4b57ff1 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x13d6d4,_0x466bfe){var _0x4fe709=function(_0x4e40ce){while(--_0x4e40ce){_0x13d6d4['push'](_0x13d6d4['shift']());}};_0x4fe709(++_0x466bfe);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x55ca,0x126));var _0xa55c=function(_0x134058,_0x423995){_0x134058=_0x134058-0x0;var _0x14a1a9=_0x55ca[_0x134058];return _0x14a1a9;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 405ce8f..dfbd705 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 _0xb486=['STRING','sequelize'];(function(_0x262aa4,_0x458481){var _0x5383af=function(_0x28b450){while(--_0x28b450){_0x262aa4['push'](_0x262aa4['shift']());}};_0x5383af(++_0x458481);}(_0xb486,0x143));var _0x6b48=function(_0x28f196,_0x236a06){_0x28f196=_0x28f196-0x0;var _0x3b6af9=_0xb486[_0x28f196];return _0x3b6af9;};'use strict';var Sequelize=require(_0x6b48('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b48('0x1')]},'description':{'type':Sequelize[_0x6b48('0x1')]}}; \ No newline at end of file +var _0x1d9e=['STRING','sequelize','exports'];(function(_0x2b7dcf,_0x4f9a4f){var _0x448baf=function(_0x198647){while(--_0x198647){_0x2b7dcf['push'](_0x2b7dcf['shift']());}};_0x448baf(++_0x4f9a4f);}(_0x1d9e,0x1d2));var _0xe1d9=function(_0x23c044,_0x89b4d3){_0x23c044=_0x23c044-0x0;var _0x3f2829=_0x1d9e[_0x23c044];return _0x3f2829;};'use strict';var Sequelize=require(_0xe1d9('0x0'));module[_0xe1d9('0x1')]={'name':{'type':Sequelize[_0xe1d9('0x2')]},'description':{'type':Sequelize[_0xe1d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 9215454..73d3346 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 _0xc297=['limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','keys','include','find','catch','create','body','getFields','params','DeskField','getSubjects','findOne','getDescriptions','getTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x46969d,_0x1fc7bb){var _0x32d657=function(_0x107fde){while(--_0x107fde){_0x46969d['push'](_0x46969d['shift']());}};_0x32d657(++_0x1fc7bb);}(_0xc297,0x18e));var _0x7c29=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0xc297[_0x3a78a0];return _0x48e917;};'use strict';var emlformat=require(_0x7c29('0x0'));var rimraf=require(_0x7c29('0x1'));var zipdir=require(_0x7c29('0x2'));var jsonpatch=require(_0x7c29('0x3'));var rp=require(_0x7c29('0x4'));var moment=require(_0x7c29('0x5'));var BPromise=require(_0x7c29('0x6'));var Mustache=require(_0x7c29('0x7'));var util=require(_0x7c29('0x8'));var path=require(_0x7c29('0x9'));var sox=require(_0x7c29('0xa'));var csv=require('to-csv');var ejs=require(_0x7c29('0xb'));var fs=require('fs');var fs_extra=require(_0x7c29('0xc'));var _=require(_0x7c29('0xd'));var squel=require(_0x7c29('0xe'));var crypto=require(_0x7c29('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7c29('0x10'));var querystring=require(_0x7c29('0x11'));var Papa=require('papaparse');var Redis=require(_0x7c29('0x12'));var authService=require(_0x7c29('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7c29('0x14'));var hardwareService=require(_0x7c29('0x15'));var logger=require(_0x7c29('0x16'))(_0x7c29('0x17'));var utils=require(_0x7c29('0x18'));var config=require(_0x7c29('0x19'));var licenseUtil=require(_0x7c29('0x1a'));var db=require(_0x7c29('0x1b'))['db'];function respondWithStatusCode(_0x3297c4,_0x2f3ae7){_0x2f3ae7=_0x2f3ae7||0xcc;return function(_0x3c33ec){if(_0x3c33ec){return _0x3297c4['sendStatus'](_0x2f3ae7);}return _0x3297c4[_0x7c29('0x1c')](_0x2f3ae7)[_0x7c29('0x1d')]();};}function respondWithResult(_0x5072a6,_0x1b99d9){_0x1b99d9=_0x1b99d9||0xc8;return function(_0x292653){if(_0x292653){return _0x5072a6[_0x7c29('0x1c')](_0x1b99d9)[_0x7c29('0x1e')](_0x292653);}};}function respondWithFilteredResult(_0xf5dce6,_0x3ce0d4){return function(_0x4fe9e0){if(_0x4fe9e0){var _0xf8a83a=typeof _0x3ce0d4[_0x7c29('0x1f')]==='undefined'&&typeof _0x3ce0d4[_0x7c29('0x20')]===_0x7c29('0x21');var _0x5782d6=_0x4fe9e0[_0x7c29('0x22')];var _0x5403b7=_0xf8a83a?0x0:_0x3ce0d4[_0x7c29('0x1f')];var _0xab9401=_0xf8a83a?_0x4fe9e0[_0x7c29('0x22')]:_0x3ce0d4['offset']+_0x3ce0d4[_0x7c29('0x20')];var _0xae8b7c;if(_0xab9401>=_0x5782d6){_0xab9401=_0x5782d6;_0xae8b7c=0xc8;}else{_0xae8b7c=0xce;}_0xf5dce6[_0x7c29('0x1c')](_0xae8b7c);return _0xf5dce6['set'](_0x7c29('0x23'),_0x5403b7+'-'+_0xab9401+'/'+_0x5782d6)[_0x7c29('0x1e')](_0x4fe9e0);}return null;};}function patchUpdates(_0x39c052){return function(_0x2f1321){try{jsonpatch[_0x7c29('0x24')](_0x2f1321,_0x39c052,!![]);}catch(_0x381193){return BPromise[_0x7c29('0x25')](_0x381193);}return _0x2f1321[_0x7c29('0x26')]();};}function saveUpdates(_0x1f4315,_0x3cd84a){return function(_0x45147f){if(_0x45147f){return _0x45147f[_0x7c29('0x27')](_0x1f4315)[_0x7c29('0x28')](function(_0x5ac746){return _0x5ac746;});}return null;};}function removeEntity(_0x15689f,_0x1897f4){return function(_0x138ae6){if(_0x138ae6){return _0x138ae6[_0x7c29('0x29')]()[_0x7c29('0x28')](function(){_0x15689f[_0x7c29('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x499340,_0x23802f){return function(_0x40bb5b){if(!_0x40bb5b){_0x499340[_0x7c29('0x2a')](0x194);}return _0x40bb5b;};}function handleError(_0x11745d,_0x499d33){_0x499d33=_0x499d33||0x1f4;return function(_0x17745f){logger[_0x7c29('0x2b')](_0x17745f[_0x7c29('0x2c')]);if(_0x17745f[_0x7c29('0x2d')]){delete _0x17745f['name'];}_0x11745d[_0x7c29('0x1c')](_0x499d33)[_0x7c29('0x2e')](_0x17745f);};}exports[_0x7c29('0x2f')]=function(_0x45f563,_0x252920){var _0xa3707a={},_0x478e43={},_0x5aba34={'count':0x0,'rows':[]};var _0x5b66a9=_[_0x7c29('0x30')](db[_0x7c29('0x31')][_0x7c29('0x32')],function(_0x3910cc){return{'name':_0x3910cc['fieldName'],'type':_0x3910cc['type'][_0x7c29('0x33')]};});_0x478e43[_0x7c29('0x34')]=_[_0x7c29('0x30')](_0x5b66a9,_0x7c29('0x2d'));_0x478e43['query']=_['keys'](_0x45f563[_0x7c29('0x35')]);_0x478e43['filters']=_[_0x7c29('0x36')](_0x478e43['model'],_0x478e43[_0x7c29('0x35')]);_0xa3707a['attributes']=_['intersection'](_0x478e43[_0x7c29('0x34')],qs[_0x7c29('0x37')](_0x45f563['query'][_0x7c29('0x37')]));_0xa3707a['attributes']=_0xa3707a[_0x7c29('0x38')][_0x7c29('0x39')]?_0xa3707a['attributes']:_0x478e43[_0x7c29('0x34')];if(!_0x45f563['query'][_0x7c29('0x3a')](_0x7c29('0x3b'))){_0xa3707a[_0x7c29('0x20')]=qs[_0x7c29('0x20')](_0x45f563['query'][_0x7c29('0x20')]);_0xa3707a[_0x7c29('0x1f')]=qs[_0x7c29('0x1f')](_0x45f563[_0x7c29('0x35')][_0x7c29('0x1f')]);}_0xa3707a[_0x7c29('0x3c')]=qs[_0x7c29('0x3d')](_0x45f563[_0x7c29('0x35')][_0x7c29('0x3d')]);_0xa3707a[_0x7c29('0x3e')]=qs[_0x7c29('0x3f')](_[_0x7c29('0x40')](_0x45f563[_0x7c29('0x35')],_0x478e43[_0x7c29('0x3f')]),_0x5b66a9);if(_0x45f563[_0x7c29('0x35')]['filter']){_0xa3707a[_0x7c29('0x3e')]=_[_0x7c29('0x41')](_0xa3707a[_0x7c29('0x3e')],{'$or':_[_0x7c29('0x30')](_0x5b66a9,function(_0x4703b5){if(_0x4703b5[_0x7c29('0x42')]!==_0x7c29('0x43')){var _0xdd8d76={};_0xdd8d76[_0x4703b5[_0x7c29('0x2d')]]={'$like':'%'+_0x45f563[_0x7c29('0x35')][_0x7c29('0x44')]+'%'};return _0xdd8d76;}})});}_0xa3707a=_[_0x7c29('0x41')]({},_0xa3707a,_0x45f563[_0x7c29('0x45')]);var _0x5a82d1={'where':_0xa3707a[_0x7c29('0x3e')]};return db[_0x7c29('0x31')][_0x7c29('0x22')](_0x5a82d1)[_0x7c29('0x28')](function(_0x345652){_0x5aba34['count']=_0x345652;if(_0x45f563[_0x7c29('0x35')][_0x7c29('0x46')]){_0xa3707a['include']=[{'all':!![]}];}return db[_0x7c29('0x31')][_0x7c29('0x47')](_0xa3707a);})[_0x7c29('0x28')](function(_0x5315a2){_0x5aba34['rows']=_0x5315a2;return _0x5aba34;})['then'](respondWithFilteredResult(_0x252920,_0xa3707a))['catch'](handleError(_0x252920,null));};exports['show']=function(_0x2ad7bf,_0x5b2388){var _0x1bdec5={'raw':![],'where':{'id':_0x2ad7bf['params']['id']}},_0x4fcf5e={};_0x4fcf5e['model']=_[_0x7c29('0x48')](db[_0x7c29('0x31')][_0x7c29('0x32')]);_0x4fcf5e[_0x7c29('0x35')]=_['keys'](_0x2ad7bf['query']);_0x4fcf5e[_0x7c29('0x3f')]=_[_0x7c29('0x36')](_0x4fcf5e[_0x7c29('0x34')],_0x4fcf5e['query']);_0x1bdec5[_0x7c29('0x38')]=_[_0x7c29('0x36')](_0x4fcf5e[_0x7c29('0x34')],qs[_0x7c29('0x37')](_0x2ad7bf[_0x7c29('0x35')][_0x7c29('0x37')]));_0x1bdec5['attributes']=_0x1bdec5[_0x7c29('0x38')][_0x7c29('0x39')]?_0x1bdec5[_0x7c29('0x38')]:_0x4fcf5e['model'];if(_0x2ad7bf[_0x7c29('0x35')][_0x7c29('0x46')]){_0x1bdec5[_0x7c29('0x49')]=[{'all':!![]}];}_0x1bdec5=_[_0x7c29('0x41')]({},_0x1bdec5,_0x2ad7bf[_0x7c29('0x45')]);return db[_0x7c29('0x31')][_0x7c29('0x4a')](_0x1bdec5)['then'](handleEntityNotFound(_0x5b2388,null))[_0x7c29('0x28')](respondWithResult(_0x5b2388,null))[_0x7c29('0x4b')](handleError(_0x5b2388,null));};exports['create']=function(_0x4cacb9,_0x54b5b6){return db['DeskConfiguration'][_0x7c29('0x4c')](_0x4cacb9[_0x7c29('0x4d')],{})[_0x7c29('0x28')](respondWithResult(_0x54b5b6,0xc9))[_0x7c29('0x4b')](handleError(_0x54b5b6,null));};exports['update']=function(_0x569b2c,_0x14f255){if(_0x569b2c['body']['id']){delete _0x569b2c[_0x7c29('0x4d')]['id'];}return db[_0x7c29('0x31')][_0x7c29('0x4a')]({'where':{'id':_0x569b2c['params']['id']}})[_0x7c29('0x28')](handleEntityNotFound(_0x14f255,null))[_0x7c29('0x28')](saveUpdates(_0x569b2c['body'],null))[_0x7c29('0x28')](respondWithResult(_0x14f255,null))[_0x7c29('0x4b')](handleError(_0x14f255,null));};exports['destroy']=function(_0x384c29,_0x38b483){return db['DeskConfiguration'][_0x7c29('0x4a')]({'where':{'id':_0x384c29['params']['id']}})[_0x7c29('0x28')](handleEntityNotFound(_0x38b483,null))['then'](removeEntity(_0x38b483,null))[_0x7c29('0x4b')](handleError(_0x38b483,null));};exports[_0x7c29('0x4e')]=function(_0x3e1605,_0x38a533,_0x2c625b){var _0x1b4177={};var _0x1412a6={};var _0x37823a;var _0x20ca8d;return db[_0x7c29('0x31')]['findOne']({'where':{'id':_0x3e1605[_0x7c29('0x4f')]['id']}})[_0x7c29('0x28')](handleEntityNotFound(_0x38a533,null))[_0x7c29('0x28')](function(_0x3a1378){if(_0x3a1378){_0x37823a=_0x3a1378;_0x1412a6[_0x7c29('0x34')]=_[_0x7c29('0x48')](db[_0x7c29('0x50')][_0x7c29('0x32')]);_0x1412a6[_0x7c29('0x35')]=_['keys'](_0x3e1605[_0x7c29('0x35')]);_0x1412a6[_0x7c29('0x3f')]=_['intersection'](_0x1412a6['model'],_0x1412a6[_0x7c29('0x35')]);_0x1b4177[_0x7c29('0x38')]=_[_0x7c29('0x36')](_0x1412a6[_0x7c29('0x34')],qs[_0x7c29('0x37')](_0x3e1605[_0x7c29('0x35')]['fields']));_0x1b4177[_0x7c29('0x38')]=_0x1b4177[_0x7c29('0x38')][_0x7c29('0x39')]?_0x1b4177[_0x7c29('0x38')]:_0x1412a6[_0x7c29('0x34')];_0x1b4177['order']=qs['sort'](_0x3e1605[_0x7c29('0x35')][_0x7c29('0x3d')]);_0x1b4177[_0x7c29('0x3e')]=qs[_0x7c29('0x3f')](_['pick'](_0x3e1605[_0x7c29('0x35')],_0x1412a6[_0x7c29('0x3f')]));if(_0x3e1605[_0x7c29('0x35')][_0x7c29('0x44')]){_0x1b4177['where']=_['merge'](_0x1b4177[_0x7c29('0x3e')],{'$or':_['map'](_0x1b4177[_0x7c29('0x38')],function(_0xad1168){var _0x19d288={};_0x19d288[_0xad1168]={'$like':'%'+_0x3e1605[_0x7c29('0x35')][_0x7c29('0x44')]+'%'};return _0x19d288;})});}_0x1b4177=_['merge']({},_0x1b4177,_0x3e1605[_0x7c29('0x45')]);return _0x37823a[_0x7c29('0x4e')](_0x1b4177);}})[_0x7c29('0x28')](function(_0x39388c){if(_0x39388c){_0x20ca8d=_0x39388c['length'];if(!_0x3e1605['query'][_0x7c29('0x3a')]('nolimit')){_0x1b4177[_0x7c29('0x20')]=qs[_0x7c29('0x20')](_0x3e1605['query'][_0x7c29('0x20')]);_0x1b4177[_0x7c29('0x1f')]=qs[_0x7c29('0x1f')](_0x3e1605['query'][_0x7c29('0x1f')]);}return _0x37823a[_0x7c29('0x4e')](_0x1b4177);}})[_0x7c29('0x28')](function(_0x1a0658){if(_0x1a0658){return _0x1a0658?{'count':_0x20ca8d,'rows':_0x1a0658}:null;}})[_0x7c29('0x28')](respondWithResult(_0x38a533,null))[_0x7c29('0x4b')](handleError(_0x38a533,null));};exports[_0x7c29('0x51')]=function(_0x1d818f,_0x4d2df9,_0x2aa5fd){var _0x33573f={};var _0x3b0200={};var _0x289265;var _0x4d9b01;return db['DeskConfiguration'][_0x7c29('0x52')]({'where':{'id':_0x1d818f['params']['id']}})[_0x7c29('0x28')](handleEntityNotFound(_0x4d2df9,null))[_0x7c29('0x28')](function(_0x1a8482){if(_0x1a8482){_0x289265=_0x1a8482;_0x3b0200[_0x7c29('0x34')]=_[_0x7c29('0x48')](db['DeskField'][_0x7c29('0x32')]);_0x3b0200['query']=_['keys'](_0x1d818f[_0x7c29('0x35')]);_0x3b0200[_0x7c29('0x3f')]=_[_0x7c29('0x36')](_0x3b0200['model'],_0x3b0200[_0x7c29('0x35')]);_0x33573f[_0x7c29('0x38')]=_['intersection'](_0x3b0200[_0x7c29('0x34')],qs[_0x7c29('0x37')](_0x1d818f[_0x7c29('0x35')]['fields']));_0x33573f[_0x7c29('0x38')]=_0x33573f['attributes'][_0x7c29('0x39')]?_0x33573f[_0x7c29('0x38')]:_0x3b0200[_0x7c29('0x34')];_0x33573f[_0x7c29('0x3c')]=qs[_0x7c29('0x3d')](_0x1d818f[_0x7c29('0x35')][_0x7c29('0x3d')]);_0x33573f['where']=qs[_0x7c29('0x3f')](_[_0x7c29('0x40')](_0x1d818f[_0x7c29('0x35')],_0x3b0200[_0x7c29('0x3f')]));if(_0x1d818f[_0x7c29('0x35')][_0x7c29('0x44')]){_0x33573f[_0x7c29('0x3e')]=_[_0x7c29('0x41')](_0x33573f['where'],{'$or':_[_0x7c29('0x30')](_0x33573f[_0x7c29('0x38')],function(_0x365c77){var _0x55bbb4={};_0x55bbb4[_0x365c77]={'$like':'%'+_0x1d818f['query'][_0x7c29('0x44')]+'%'};return _0x55bbb4;})});}_0x33573f=_[_0x7c29('0x41')]({},_0x33573f,_0x1d818f[_0x7c29('0x45')]);return _0x289265['getSubjects'](_0x33573f);}})[_0x7c29('0x28')](function(_0x4705f5){if(_0x4705f5){_0x4d9b01=_0x4705f5[_0x7c29('0x39')];if(!_0x1d818f[_0x7c29('0x35')][_0x7c29('0x3a')](_0x7c29('0x3b'))){_0x33573f[_0x7c29('0x20')]=qs['limit'](_0x1d818f['query'][_0x7c29('0x20')]);_0x33573f[_0x7c29('0x1f')]=qs[_0x7c29('0x1f')](_0x1d818f[_0x7c29('0x35')][_0x7c29('0x1f')]);}return _0x289265[_0x7c29('0x51')](_0x33573f);}})['then'](function(_0x2a79d2){if(_0x2a79d2){return _0x2a79d2?{'count':_0x4d9b01,'rows':_0x2a79d2}:null;}})[_0x7c29('0x28')](respondWithResult(_0x4d2df9,null))[_0x7c29('0x4b')](handleError(_0x4d2df9,null));};exports[_0x7c29('0x53')]=function(_0x2b4d4f,_0x362902,_0x4832cb){var _0x408afe={};var _0x1facbb={};var _0x474c24;var _0x59808f;return db[_0x7c29('0x31')][_0x7c29('0x52')]({'where':{'id':_0x2b4d4f['params']['id']}})['then'](handleEntityNotFound(_0x362902,null))[_0x7c29('0x28')](function(_0x7477cc){if(_0x7477cc){_0x474c24=_0x7477cc;_0x1facbb[_0x7c29('0x34')]=_[_0x7c29('0x48')](db[_0x7c29('0x50')]['rawAttributes']);_0x1facbb[_0x7c29('0x35')]=_[_0x7c29('0x48')](_0x2b4d4f['query']);_0x1facbb[_0x7c29('0x3f')]=_[_0x7c29('0x36')](_0x1facbb[_0x7c29('0x34')],_0x1facbb[_0x7c29('0x35')]);_0x408afe['attributes']=_[_0x7c29('0x36')](_0x1facbb[_0x7c29('0x34')],qs['fields'](_0x2b4d4f[_0x7c29('0x35')][_0x7c29('0x37')]));_0x408afe['attributes']=_0x408afe[_0x7c29('0x38')][_0x7c29('0x39')]?_0x408afe[_0x7c29('0x38')]:_0x1facbb[_0x7c29('0x34')];_0x408afe['order']=qs[_0x7c29('0x3d')](_0x2b4d4f[_0x7c29('0x35')][_0x7c29('0x3d')]);_0x408afe[_0x7c29('0x3e')]=qs[_0x7c29('0x3f')](_[_0x7c29('0x40')](_0x2b4d4f['query'],_0x1facbb[_0x7c29('0x3f')]));if(_0x2b4d4f[_0x7c29('0x35')][_0x7c29('0x44')]){_0x408afe['where']=_[_0x7c29('0x41')](_0x408afe[_0x7c29('0x3e')],{'$or':_[_0x7c29('0x30')](_0x408afe[_0x7c29('0x38')],function(_0x588928){var _0x5d264c={};_0x5d264c[_0x588928]={'$like':'%'+_0x2b4d4f[_0x7c29('0x35')][_0x7c29('0x44')]+'%'};return _0x5d264c;})});}_0x408afe=_[_0x7c29('0x41')]({},_0x408afe,_0x2b4d4f[_0x7c29('0x45')]);return _0x474c24[_0x7c29('0x53')](_0x408afe);}})[_0x7c29('0x28')](function(_0x55e9e6){if(_0x55e9e6){_0x59808f=_0x55e9e6[_0x7c29('0x39')];if(!_0x2b4d4f[_0x7c29('0x35')][_0x7c29('0x3a')](_0x7c29('0x3b'))){_0x408afe[_0x7c29('0x20')]=qs[_0x7c29('0x20')](_0x2b4d4f['query'][_0x7c29('0x20')]);_0x408afe['offset']=qs[_0x7c29('0x1f')](_0x2b4d4f[_0x7c29('0x35')][_0x7c29('0x1f')]);}return _0x474c24['getDescriptions'](_0x408afe);}})[_0x7c29('0x28')](function(_0x2b1ba4){if(_0x2b1ba4){return _0x2b1ba4?{'count':_0x59808f,'rows':_0x2b1ba4}:null;}})['then'](respondWithResult(_0x362902,null))[_0x7c29('0x4b')](handleError(_0x362902,null));};exports['getTags']=function(_0x3e65e1,_0x595756,_0x275047){var _0x4f4a96={};var _0x4505cf={};var _0xf943aa;var _0x20178d;return db[_0x7c29('0x31')]['findOne']({'where':{'id':_0x3e65e1[_0x7c29('0x4f')]['id']}})['then'](handleEntityNotFound(_0x595756,null))['then'](function(_0x38bcf4){if(_0x38bcf4){_0xf943aa=_0x38bcf4;_0x4505cf[_0x7c29('0x34')]=_[_0x7c29('0x48')](db['Tag'][_0x7c29('0x32')]);_0x4505cf[_0x7c29('0x35')]=_[_0x7c29('0x48')](_0x3e65e1[_0x7c29('0x35')]);_0x4505cf[_0x7c29('0x3f')]=_[_0x7c29('0x36')](_0x4505cf[_0x7c29('0x34')],_0x4505cf['query']);_0x4f4a96[_0x7c29('0x38')]=_[_0x7c29('0x36')](_0x4505cf[_0x7c29('0x34')],qs[_0x7c29('0x37')](_0x3e65e1[_0x7c29('0x35')][_0x7c29('0x37')]));_0x4f4a96[_0x7c29('0x38')]=_0x4f4a96['attributes'][_0x7c29('0x39')]?_0x4f4a96[_0x7c29('0x38')]:_0x4505cf[_0x7c29('0x34')];_0x4f4a96[_0x7c29('0x3c')]=qs[_0x7c29('0x3d')](_0x3e65e1[_0x7c29('0x35')][_0x7c29('0x3d')]);_0x4f4a96['where']=qs[_0x7c29('0x3f')](_[_0x7c29('0x40')](_0x3e65e1[_0x7c29('0x35')],_0x4505cf[_0x7c29('0x3f')]));if(_0x3e65e1['query'][_0x7c29('0x44')]){_0x4f4a96['where']=_['merge'](_0x4f4a96[_0x7c29('0x3e')],{'$or':_['map'](_0x4f4a96[_0x7c29('0x38')],function(_0x84bb3a){var _0x551434={};_0x551434[_0x84bb3a]={'$like':'%'+_0x3e65e1[_0x7c29('0x35')][_0x7c29('0x44')]+'%'};return _0x551434;})});}_0x4f4a96=_['merge']({},_0x4f4a96,_0x3e65e1[_0x7c29('0x45')]);return _0xf943aa['getTags'](_0x4f4a96);}})[_0x7c29('0x28')](function(_0x2396ed){if(_0x2396ed){_0x20178d=_0x2396ed[_0x7c29('0x39')];if(!_0x3e65e1[_0x7c29('0x35')]['hasOwnProperty'](_0x7c29('0x3b'))){_0x4f4a96[_0x7c29('0x20')]=qs[_0x7c29('0x20')](_0x3e65e1[_0x7c29('0x35')][_0x7c29('0x20')]);_0x4f4a96['offset']=qs[_0x7c29('0x1f')](_0x3e65e1['query'][_0x7c29('0x1f')]);}return _0xf943aa[_0x7c29('0x54')](_0x4f4a96);}})['then'](function(_0x4e4668){if(_0x4e4668){return _0x4e4668?{'count':_0x20178d,'rows':_0x4e4668}:null;}})[_0x7c29('0x28')](respondWithResult(_0x595756,null))[_0x7c29('0x4b')](handleError(_0x595756,null));};exports['setTags']=function(_0x32b9ed,_0x1dba2e,_0x1f1ec6){if(_0x32b9ed['body']['id']){delete _0x32b9ed['body']['id'];}return db[_0x7c29('0x31')][_0x7c29('0x52')]({'where':{'id':_0x32b9ed[_0x7c29('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1dba2e,null))[_0x7c29('0x28')](function(_0x56a872){if(_0x56a872){return _0x56a872['setTags'](_0x32b9ed[_0x7c29('0x4d')][_0x7c29('0x55')]||[]);}return null;})[_0x7c29('0x28')](respondWithResult(_0x1dba2e,null))[_0x7c29('0x4b')](handleError(_0x1dba2e,null));}; \ No newline at end of file +var _0x6068=['ejs','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','getFields','findOne','DeskField','getSubjects','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv'];(function(_0x9fd712,_0x2a80e2){var _0xabbe5b=function(_0x1a8937){while(--_0x1a8937){_0x9fd712['push'](_0x9fd712['shift']());}};_0xabbe5b(++_0x2a80e2);}(_0x6068,0x94));var _0x8606=function(_0x44843c,_0x2e68fb){_0x44843c=_0x44843c-0x0;var _0x296060=_0x6068[_0x44843c];return _0x296060;};'use strict';var emlformat=require(_0x8606('0x0'));var rimraf=require(_0x8606('0x1'));var zipdir=require(_0x8606('0x2'));var jsonpatch=require(_0x8606('0x3'));var rp=require('request-promise');var moment=require(_0x8606('0x4'));var BPromise=require(_0x8606('0x5'));var Mustache=require(_0x8606('0x6'));var util=require(_0x8606('0x7'));var path=require(_0x8606('0x8'));var sox=require('sox');var csv=require(_0x8606('0x9'));var ejs=require(_0x8606('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8606('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8606('0xc'));var toCsv=require(_0x8606('0x9'));var querystring=require(_0x8606('0xd'));var Papa=require(_0x8606('0xe'));var Redis=require('ioredis');var authService=require(_0x8606('0xf'));var qs=require(_0x8606('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8606('0x11'));var logger=require(_0x8606('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x8606('0x13'));var licenseUtil=require(_0x8606('0x14'));var db=require(_0x8606('0x15'))['db'];function respondWithStatusCode(_0x339dd6,_0x452221){_0x452221=_0x452221||0xcc;return function(_0x5c32af){if(_0x5c32af){return _0x339dd6['sendStatus'](_0x452221);}return _0x339dd6['status'](_0x452221)[_0x8606('0x16')]();};}function respondWithResult(_0x407217,_0x5231b7){_0x5231b7=_0x5231b7||0xc8;return function(_0x11abbf){if(_0x11abbf){return _0x407217[_0x8606('0x17')](_0x5231b7)[_0x8606('0x18')](_0x11abbf);}};}function respondWithFilteredResult(_0x2f4a4f,_0x445637){return function(_0x50f092){if(_0x50f092){var _0x389d8c=typeof _0x445637[_0x8606('0x19')]===_0x8606('0x1a')&&typeof _0x445637[_0x8606('0x1b')]==='undefined';var _0xd45ce9=_0x50f092[_0x8606('0x1c')];var _0x645ffc=_0x389d8c?0x0:_0x445637[_0x8606('0x19')];var _0x54a694=_0x389d8c?_0x50f092[_0x8606('0x1c')]:_0x445637[_0x8606('0x19')]+_0x445637[_0x8606('0x1b')];var _0xb728f0;if(_0x54a694>=_0xd45ce9){_0x54a694=_0xd45ce9;_0xb728f0=0xc8;}else{_0xb728f0=0xce;}_0x2f4a4f[_0x8606('0x17')](_0xb728f0);return _0x2f4a4f[_0x8606('0x1d')](_0x8606('0x1e'),_0x645ffc+'-'+_0x54a694+'/'+_0xd45ce9)['json'](_0x50f092);}return null;};}function patchUpdates(_0xe97def){return function(_0x2d4199){try{jsonpatch[_0x8606('0x1f')](_0x2d4199,_0xe97def,!![]);}catch(_0x3aca10){return BPromise['reject'](_0x3aca10);}return _0x2d4199[_0x8606('0x20')]();};}function saveUpdates(_0x1ff6d1,_0x21112f){return function(_0x206ed0){if(_0x206ed0){return _0x206ed0[_0x8606('0x21')](_0x1ff6d1)['then'](function(_0x5d866b){return _0x5d866b;});}return null;};}function removeEntity(_0x5be169,_0x853dc7){return function(_0xcf8029){if(_0xcf8029){return _0xcf8029[_0x8606('0x22')]()[_0x8606('0x23')](function(){_0x5be169['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49c253,_0x9a91c0){return function(_0x20142c){if(!_0x20142c){_0x49c253['sendStatus'](0x194);}return _0x20142c;};}function handleError(_0x43c78a,_0x43d899){_0x43d899=_0x43d899||0x1f4;return function(_0xa080ac){logger[_0x8606('0x24')](_0xa080ac[_0x8606('0x25')]);if(_0xa080ac['name']){delete _0xa080ac['name'];}_0x43c78a[_0x8606('0x17')](_0x43d899)[_0x8606('0x26')](_0xa080ac);};}exports['index']=function(_0x26a891,_0xd723de){var _0x4ed229={},_0x44f412={},_0x1c6c31={'count':0x0,'rows':[]};var _0x3b3397=_[_0x8606('0x27')](db[_0x8606('0x28')][_0x8606('0x29')],function(_0x1b53f6){return{'name':_0x1b53f6[_0x8606('0x2a')],'type':_0x1b53f6[_0x8606('0x2b')][_0x8606('0x2c')]};});_0x44f412['model']=_[_0x8606('0x27')](_0x3b3397,'name');_0x44f412['query']=_[_0x8606('0x2d')](_0x26a891[_0x8606('0x2e')]);_0x44f412['filters']=_[_0x8606('0x2f')](_0x44f412['model'],_0x44f412[_0x8606('0x2e')]);_0x4ed229[_0x8606('0x30')]=_['intersection'](_0x44f412[_0x8606('0x31')],qs[_0x8606('0x32')](_0x26a891[_0x8606('0x2e')][_0x8606('0x32')]));_0x4ed229['attributes']=_0x4ed229[_0x8606('0x30')][_0x8606('0x33')]?_0x4ed229[_0x8606('0x30')]:_0x44f412[_0x8606('0x31')];if(!_0x26a891[_0x8606('0x2e')][_0x8606('0x34')]('nolimit')){_0x4ed229['limit']=qs[_0x8606('0x1b')](_0x26a891[_0x8606('0x2e')]['limit']);_0x4ed229[_0x8606('0x19')]=qs[_0x8606('0x19')](_0x26a891[_0x8606('0x2e')][_0x8606('0x19')]);}_0x4ed229[_0x8606('0x35')]=qs[_0x8606('0x36')](_0x26a891[_0x8606('0x2e')][_0x8606('0x36')]);_0x4ed229[_0x8606('0x37')]=qs[_0x8606('0x38')](_[_0x8606('0x39')](_0x26a891[_0x8606('0x2e')],_0x44f412[_0x8606('0x38')]),_0x3b3397);if(_0x26a891[_0x8606('0x2e')][_0x8606('0x3a')]){_0x4ed229[_0x8606('0x37')]=_[_0x8606('0x3b')](_0x4ed229[_0x8606('0x37')],{'$or':_[_0x8606('0x27')](_0x3b3397,function(_0x20a93f){if(_0x20a93f['type']!==_0x8606('0x3c')){var _0x59075d={};_0x59075d[_0x20a93f['name']]={'$like':'%'+_0x26a891[_0x8606('0x2e')][_0x8606('0x3a')]+'%'};return _0x59075d;}})});}_0x4ed229=_[_0x8606('0x3b')]({},_0x4ed229,_0x26a891[_0x8606('0x3d')]);var _0x1a5c13={'where':_0x4ed229[_0x8606('0x37')]};return db['DeskConfiguration'][_0x8606('0x1c')](_0x1a5c13)[_0x8606('0x23')](function(_0xccb19c){_0x1c6c31[_0x8606('0x1c')]=_0xccb19c;if(_0x26a891[_0x8606('0x2e')]['includeAll']){_0x4ed229[_0x8606('0x3e')]=[{'all':!![]}];}return db[_0x8606('0x28')][_0x8606('0x3f')](_0x4ed229);})[_0x8606('0x23')](function(_0x44dffc){_0x1c6c31[_0x8606('0x40')]=_0x44dffc;return _0x1c6c31;})[_0x8606('0x23')](respondWithFilteredResult(_0xd723de,_0x4ed229))[_0x8606('0x41')](handleError(_0xd723de,null));};exports['show']=function(_0x5f194c,_0x163c5d){var _0x1959be={'raw':![],'where':{'id':_0x5f194c[_0x8606('0x42')]['id']}},_0x3c8429={};_0x3c8429[_0x8606('0x31')]=_[_0x8606('0x2d')](db[_0x8606('0x28')][_0x8606('0x29')]);_0x3c8429[_0x8606('0x2e')]=_['keys'](_0x5f194c[_0x8606('0x2e')]);_0x3c8429[_0x8606('0x38')]=_[_0x8606('0x2f')](_0x3c8429['model'],_0x3c8429['query']);_0x1959be['attributes']=_[_0x8606('0x2f')](_0x3c8429[_0x8606('0x31')],qs[_0x8606('0x32')](_0x5f194c['query'][_0x8606('0x32')]));_0x1959be[_0x8606('0x30')]=_0x1959be[_0x8606('0x30')][_0x8606('0x33')]?_0x1959be[_0x8606('0x30')]:_0x3c8429['model'];if(_0x5f194c[_0x8606('0x2e')]['includeAll']){_0x1959be[_0x8606('0x3e')]=[{'all':!![]}];}_0x1959be=_[_0x8606('0x3b')]({},_0x1959be,_0x5f194c[_0x8606('0x3d')]);return db[_0x8606('0x28')][_0x8606('0x43')](_0x1959be)[_0x8606('0x23')](handleEntityNotFound(_0x163c5d,null))[_0x8606('0x23')](respondWithResult(_0x163c5d,null))[_0x8606('0x41')](handleError(_0x163c5d,null));};exports[_0x8606('0x44')]=function(_0xe9047e,_0x3588b8){return db[_0x8606('0x28')][_0x8606('0x44')](_0xe9047e['body'],{})['then'](respondWithResult(_0x3588b8,0xc9))[_0x8606('0x41')](handleError(_0x3588b8,null));};exports[_0x8606('0x21')]=function(_0x185686,_0x3e38d0){if(_0x185686[_0x8606('0x45')]['id']){delete _0x185686['body']['id'];}return db[_0x8606('0x28')][_0x8606('0x43')]({'where':{'id':_0x185686[_0x8606('0x42')]['id']}})[_0x8606('0x23')](handleEntityNotFound(_0x3e38d0,null))['then'](saveUpdates(_0x185686[_0x8606('0x45')],null))[_0x8606('0x23')](respondWithResult(_0x3e38d0,null))['catch'](handleError(_0x3e38d0,null));};exports['destroy']=function(_0x1f50f2,_0x539e9e){return db[_0x8606('0x28')]['find']({'where':{'id':_0x1f50f2[_0x8606('0x42')]['id']}})['then'](handleEntityNotFound(_0x539e9e,null))[_0x8606('0x23')](removeEntity(_0x539e9e,null))['catch'](handleError(_0x539e9e,null));};exports[_0x8606('0x46')]=function(_0x587323,_0x3f88ac,_0x43e5c4){var _0x10c608={};var _0xf885bf={};var _0xe3dbab;var _0x280586;return db[_0x8606('0x28')][_0x8606('0x47')]({'where':{'id':_0x587323['params']['id']}})['then'](handleEntityNotFound(_0x3f88ac,null))[_0x8606('0x23')](function(_0x3007c2){if(_0x3007c2){_0xe3dbab=_0x3007c2;_0xf885bf[_0x8606('0x31')]=_[_0x8606('0x2d')](db[_0x8606('0x48')]['rawAttributes']);_0xf885bf[_0x8606('0x2e')]=_['keys'](_0x587323['query']);_0xf885bf[_0x8606('0x38')]=_[_0x8606('0x2f')](_0xf885bf[_0x8606('0x31')],_0xf885bf[_0x8606('0x2e')]);_0x10c608['attributes']=_[_0x8606('0x2f')](_0xf885bf[_0x8606('0x31')],qs[_0x8606('0x32')](_0x587323[_0x8606('0x2e')]['fields']));_0x10c608[_0x8606('0x30')]=_0x10c608[_0x8606('0x30')]['length']?_0x10c608[_0x8606('0x30')]:_0xf885bf[_0x8606('0x31')];_0x10c608[_0x8606('0x35')]=qs[_0x8606('0x36')](_0x587323[_0x8606('0x2e')][_0x8606('0x36')]);_0x10c608[_0x8606('0x37')]=qs['filters'](_['pick'](_0x587323['query'],_0xf885bf[_0x8606('0x38')]));if(_0x587323[_0x8606('0x2e')][_0x8606('0x3a')]){_0x10c608[_0x8606('0x37')]=_[_0x8606('0x3b')](_0x10c608['where'],{'$or':_['map'](_0x10c608['attributes'],function(_0x16db97){var _0x556a21={};_0x556a21[_0x16db97]={'$like':'%'+_0x587323['query'][_0x8606('0x3a')]+'%'};return _0x556a21;})});}_0x10c608=_[_0x8606('0x3b')]({},_0x10c608,_0x587323[_0x8606('0x3d')]);return _0xe3dbab['getFields'](_0x10c608);}})[_0x8606('0x23')](function(_0x3cb153){if(_0x3cb153){_0x280586=_0x3cb153[_0x8606('0x33')];if(!_0x587323['query'][_0x8606('0x34')]('nolimit')){_0x10c608[_0x8606('0x1b')]=qs['limit'](_0x587323[_0x8606('0x2e')][_0x8606('0x1b')]);_0x10c608[_0x8606('0x19')]=qs[_0x8606('0x19')](_0x587323[_0x8606('0x2e')]['offset']);}return _0xe3dbab['getFields'](_0x10c608);}})[_0x8606('0x23')](function(_0x4aaa0){if(_0x4aaa0){return _0x4aaa0?{'count':_0x280586,'rows':_0x4aaa0}:null;}})['then'](respondWithResult(_0x3f88ac,null))[_0x8606('0x41')](handleError(_0x3f88ac,null));};exports[_0x8606('0x49')]=function(_0x2fe99a,_0x56f805,_0x41f695){var _0x6fa815={};var _0x2ac056={};var _0x1dc884;var _0x394202;return db[_0x8606('0x28')]['findOne']({'where':{'id':_0x2fe99a[_0x8606('0x42')]['id']}})[_0x8606('0x23')](handleEntityNotFound(_0x56f805,null))[_0x8606('0x23')](function(_0x4fe130){if(_0x4fe130){_0x1dc884=_0x4fe130;_0x2ac056['model']=_[_0x8606('0x2d')](db[_0x8606('0x48')][_0x8606('0x29')]);_0x2ac056[_0x8606('0x2e')]=_['keys'](_0x2fe99a[_0x8606('0x2e')]);_0x2ac056['filters']=_[_0x8606('0x2f')](_0x2ac056['model'],_0x2ac056[_0x8606('0x2e')]);_0x6fa815[_0x8606('0x30')]=_[_0x8606('0x2f')](_0x2ac056['model'],qs[_0x8606('0x32')](_0x2fe99a[_0x8606('0x2e')][_0x8606('0x32')]));_0x6fa815[_0x8606('0x30')]=_0x6fa815['attributes']['length']?_0x6fa815[_0x8606('0x30')]:_0x2ac056[_0x8606('0x31')];_0x6fa815[_0x8606('0x35')]=qs[_0x8606('0x36')](_0x2fe99a[_0x8606('0x2e')][_0x8606('0x36')]);_0x6fa815[_0x8606('0x37')]=qs['filters'](_[_0x8606('0x39')](_0x2fe99a[_0x8606('0x2e')],_0x2ac056[_0x8606('0x38')]));if(_0x2fe99a[_0x8606('0x2e')]['filter']){_0x6fa815[_0x8606('0x37')]=_[_0x8606('0x3b')](_0x6fa815[_0x8606('0x37')],{'$or':_['map'](_0x6fa815[_0x8606('0x30')],function(_0x21bfab){var _0x3aecf1={};_0x3aecf1[_0x21bfab]={'$like':'%'+_0x2fe99a[_0x8606('0x2e')]['filter']+'%'};return _0x3aecf1;})});}_0x6fa815=_[_0x8606('0x3b')]({},_0x6fa815,_0x2fe99a[_0x8606('0x3d')]);return _0x1dc884['getSubjects'](_0x6fa815);}})[_0x8606('0x23')](function(_0xe31b10){if(_0xe31b10){_0x394202=_0xe31b10['length'];if(!_0x2fe99a['query'][_0x8606('0x34')](_0x8606('0x4a'))){_0x6fa815[_0x8606('0x1b')]=qs['limit'](_0x2fe99a[_0x8606('0x2e')][_0x8606('0x1b')]);_0x6fa815[_0x8606('0x19')]=qs[_0x8606('0x19')](_0x2fe99a[_0x8606('0x2e')]['offset']);}return _0x1dc884['getSubjects'](_0x6fa815);}})[_0x8606('0x23')](function(_0x49caa0){if(_0x49caa0){return _0x49caa0?{'count':_0x394202,'rows':_0x49caa0}:null;}})[_0x8606('0x23')](respondWithResult(_0x56f805,null))[_0x8606('0x41')](handleError(_0x56f805,null));};exports[_0x8606('0x4b')]=function(_0x3a6001,_0x1bbf6b,_0x404a66){var _0x27d33c={};var _0x5b7f0a={};var _0x389785;var _0x3721c8;return db[_0x8606('0x28')]['findOne']({'where':{'id':_0x3a6001['params']['id']}})['then'](handleEntityNotFound(_0x1bbf6b,null))[_0x8606('0x23')](function(_0x56a8a2){if(_0x56a8a2){_0x389785=_0x56a8a2;_0x5b7f0a[_0x8606('0x31')]=_['keys'](db[_0x8606('0x48')][_0x8606('0x29')]);_0x5b7f0a['query']=_[_0x8606('0x2d')](_0x3a6001[_0x8606('0x2e')]);_0x5b7f0a['filters']=_[_0x8606('0x2f')](_0x5b7f0a[_0x8606('0x31')],_0x5b7f0a[_0x8606('0x2e')]);_0x27d33c[_0x8606('0x30')]=_[_0x8606('0x2f')](_0x5b7f0a[_0x8606('0x31')],qs[_0x8606('0x32')](_0x3a6001[_0x8606('0x2e')][_0x8606('0x32')]));_0x27d33c[_0x8606('0x30')]=_0x27d33c[_0x8606('0x30')][_0x8606('0x33')]?_0x27d33c[_0x8606('0x30')]:_0x5b7f0a[_0x8606('0x31')];_0x27d33c['order']=qs[_0x8606('0x36')](_0x3a6001[_0x8606('0x2e')][_0x8606('0x36')]);_0x27d33c[_0x8606('0x37')]=qs[_0x8606('0x38')](_['pick'](_0x3a6001['query'],_0x5b7f0a[_0x8606('0x38')]));if(_0x3a6001['query']['filter']){_0x27d33c[_0x8606('0x37')]=_[_0x8606('0x3b')](_0x27d33c[_0x8606('0x37')],{'$or':_[_0x8606('0x27')](_0x27d33c[_0x8606('0x30')],function(_0x1cb96c){var _0x16f114={};_0x16f114[_0x1cb96c]={'$like':'%'+_0x3a6001['query'][_0x8606('0x3a')]+'%'};return _0x16f114;})});}_0x27d33c=_[_0x8606('0x3b')]({},_0x27d33c,_0x3a6001['options']);return _0x389785[_0x8606('0x4b')](_0x27d33c);}})[_0x8606('0x23')](function(_0x3a7f41){if(_0x3a7f41){_0x3721c8=_0x3a7f41[_0x8606('0x33')];if(!_0x3a6001['query'][_0x8606('0x34')]('nolimit')){_0x27d33c[_0x8606('0x1b')]=qs[_0x8606('0x1b')](_0x3a6001[_0x8606('0x2e')][_0x8606('0x1b')]);_0x27d33c[_0x8606('0x19')]=qs['offset'](_0x3a6001[_0x8606('0x2e')][_0x8606('0x19')]);}return _0x389785[_0x8606('0x4b')](_0x27d33c);}})[_0x8606('0x23')](function(_0x57c7db){if(_0x57c7db){return _0x57c7db?{'count':_0x3721c8,'rows':_0x57c7db}:null;}})[_0x8606('0x23')](respondWithResult(_0x1bbf6b,null))[_0x8606('0x41')](handleError(_0x1bbf6b,null));};exports[_0x8606('0x4c')]=function(_0x4b2af7,_0x4b5c0a,_0x4d397a){var _0x105d8d={};var _0x34493c={};var _0x5c4e4f;var _0x562caf;return db[_0x8606('0x28')][_0x8606('0x47')]({'where':{'id':_0x4b2af7[_0x8606('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b5c0a,null))[_0x8606('0x23')](function(_0x4a484a){if(_0x4a484a){_0x5c4e4f=_0x4a484a;_0x34493c[_0x8606('0x31')]=_['keys'](db['Tag'][_0x8606('0x29')]);_0x34493c[_0x8606('0x2e')]=_[_0x8606('0x2d')](_0x4b2af7[_0x8606('0x2e')]);_0x34493c[_0x8606('0x38')]=_[_0x8606('0x2f')](_0x34493c['model'],_0x34493c[_0x8606('0x2e')]);_0x105d8d[_0x8606('0x30')]=_['intersection'](_0x34493c[_0x8606('0x31')],qs[_0x8606('0x32')](_0x4b2af7['query'][_0x8606('0x32')]));_0x105d8d['attributes']=_0x105d8d[_0x8606('0x30')]['length']?_0x105d8d[_0x8606('0x30')]:_0x34493c[_0x8606('0x31')];_0x105d8d[_0x8606('0x35')]=qs['sort'](_0x4b2af7[_0x8606('0x2e')]['sort']);_0x105d8d['where']=qs['filters'](_[_0x8606('0x39')](_0x4b2af7[_0x8606('0x2e')],_0x34493c[_0x8606('0x38')]));if(_0x4b2af7[_0x8606('0x2e')][_0x8606('0x3a')]){_0x105d8d['where']=_[_0x8606('0x3b')](_0x105d8d[_0x8606('0x37')],{'$or':_[_0x8606('0x27')](_0x105d8d[_0x8606('0x30')],function(_0x30af59){var _0x4ae629={};_0x4ae629[_0x30af59]={'$like':'%'+_0x4b2af7[_0x8606('0x2e')][_0x8606('0x3a')]+'%'};return _0x4ae629;})});}_0x105d8d=_[_0x8606('0x3b')]({},_0x105d8d,_0x4b2af7[_0x8606('0x3d')]);return _0x5c4e4f[_0x8606('0x4c')](_0x105d8d);}})[_0x8606('0x23')](function(_0x5169a8){if(_0x5169a8){_0x562caf=_0x5169a8[_0x8606('0x33')];if(!_0x4b2af7[_0x8606('0x2e')][_0x8606('0x34')](_0x8606('0x4a'))){_0x105d8d[_0x8606('0x1b')]=qs['limit'](_0x4b2af7[_0x8606('0x2e')][_0x8606('0x1b')]);_0x105d8d[_0x8606('0x19')]=qs[_0x8606('0x19')](_0x4b2af7['query'][_0x8606('0x19')]);}return _0x5c4e4f['getTags'](_0x105d8d);}})['then'](function(_0x5dbf04){if(_0x5dbf04){return _0x5dbf04?{'count':_0x562caf,'rows':_0x5dbf04}:null;}})[_0x8606('0x23')](respondWithResult(_0x4b5c0a,null))[_0x8606('0x41')](handleError(_0x4b5c0a,null));};exports[_0x8606('0x4d')]=function(_0x3a0de7,_0x330bb1,_0x252c39){if(_0x3a0de7[_0x8606('0x45')]['id']){delete _0x3a0de7[_0x8606('0x45')]['id'];}return db[_0x8606('0x28')]['findOne']({'where':{'id':_0x3a0de7['params']['id']}})[_0x8606('0x23')](handleEntityNotFound(_0x330bb1,null))[_0x8606('0x23')](function(_0x19129a){if(_0x19129a){return _0x19129a[_0x8606('0x4d')](_0x3a0de7[_0x8606('0x45')][_0x8606('0x4e')]||[]);}return null;})[_0x8606('0x23')](respondWithResult(_0x330bb1,null))[_0x8606('0x41')](handleError(_0x330bb1,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index b7ce1d5..b368af8 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 _0xe110=['request-promise','rimraf','../../config/environment','define','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x576c22,_0x7dac63){var _0x2146f3=function(_0x394e28){while(--_0x394e28){_0x576c22['push'](_0x576c22['shift']());}};_0x2146f3(++_0x7dac63);}(_0xe110,0xaf));var _0x0e11=function(_0x4f54bb,_0x1d2930){_0x4f54bb=_0x4f54bb-0x0;var _0x56e9dd=_0xe110[_0x4f54bb];return _0x56e9dd;};'use strict';var _=require(_0x0e11('0x0'));var util=require('util');var logger=require(_0x0e11('0x1'))(_0x0e11('0x2'));var moment=require(_0x0e11('0x3'));var BPromise=require(_0x0e11('0x4'));var rp=require(_0x0e11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e11('0x6'));var config=require(_0x0e11('0x7'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x4087de,_0x42ec59){return _0x4087de[_0x0e11('0x8')]('DeskConfiguration',attributes,{'tableName':_0x0e11('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e12=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','lodash'];(function(_0x15c8e0,_0x332c04){var _0xcf223b=function(_0x1dbadb){while(--_0x1dbadb){_0x15c8e0['push'](_0x15c8e0['shift']());}};_0xcf223b(++_0x332c04);}(_0x0e12,0x180));var _0x20e1=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x0e12[_0x365be9];return _0x185c12;};'use strict';var _=require(_0x20e1('0x0'));var util=require(_0x20e1('0x1'));var logger=require(_0x20e1('0x2'))(_0x20e1('0x3'));var moment=require(_0x20e1('0x4'));var BPromise=require(_0x20e1('0x5'));var rp=require(_0x20e1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20e1('0x7'));var config=require(_0x20e1('0x8'));var attributes=require(_0x20e1('0x9'));module['exports']=function(_0x2cf10e,_0xc71f92){return _0x2cf10e['define'](_0x20e1('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 6f2f4d8..427671c 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 _0xdc15=['../../mysqldb','../../config/environment','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x5762ee,_0x243d05){var _0x324ce1=function(_0x3dc615){while(--_0x3dc615){_0x5762ee['push'](_0x5762ee['shift']());}};_0x324ce1(++_0x243d05);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x4d6bfd,_0x8d79ff){_0x4d6bfd=_0x4d6bfd-0x0;var _0x243a46=_0xdc15[_0x4d6bfd];return _0x243a46;};'use strict';var _=require(_0x5dc1('0x0'));var util=require('util');var moment=require(_0x5dc1('0x1'));var BPromise=require(_0x5dc1('0x2'));var rs=require(_0x5dc1('0x3'));var fs=require('fs');var Redis=require(_0x5dc1('0x4'));var db=require(_0x5dc1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5dc1('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5dc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ec95f,_0x22d677,_0x12abf9){return new BPromise(function(_0x1c90f6,_0x3e96c1){return client[_0x5dc1('0x8')](_0x2ec95f,_0x12abf9)[_0x5dc1('0x9')](function(_0x1f1293){logger[_0x5dc1('0xa')](_0x5dc1('0xb'),_0x22d677,'request\x20sent');logger['debug'](_0x5dc1('0xc'),_0x22d677,_0x5dc1('0xd'),JSON['stringify'](_0x1f1293));if(_0x1f1293[_0x5dc1('0xe')]){if(_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0xf')]===0x1f4){logger[_0x5dc1('0xe')](_0x5dc1('0xb'),_0x22d677,_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0x10')]);return _0x3e96c1(_0x1f1293['error'][_0x5dc1('0x10')]);}logger[_0x5dc1('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x22d677,_0x1f1293[_0x5dc1('0xe')][_0x5dc1('0x10')]);return _0x1c90f6(_0x1f1293['error'][_0x5dc1('0x10')]);}else{logger[_0x5dc1('0xa')](_0x5dc1('0xb'),_0x22d677,'request\x20sent');_0x1c90f6(_0x1f1293[_0x5dc1('0x11')]['message']);}})['catch'](function(_0x17506b){logger[_0x5dc1('0xe')](_0x5dc1('0xb'),_0x22d677,_0x17506b);_0x3e96c1(_0x17506b);});});} \ No newline at end of file +var _0xbe58=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xbe58,0x19f));var _0x8be5=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xbe58[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8be5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8be5('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x8be5('0x2'));var logger=require(_0x8be5('0x3'))(_0x8be5('0x4'));var config=require(_0x8be5('0x5'));var jayson=require(_0x8be5('0x6'));var client=jayson[_0x8be5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fdbb6,_0x61c95,_0x22ed1f){return new BPromise(function(_0xb9d4df,_0x9d6c40){return client[_0x8be5('0x8')](_0x4fdbb6,_0x22ed1f)['then'](function(_0x364658){logger[_0x8be5('0x9')](_0x8be5('0xa'),_0x61c95,_0x8be5('0xb'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x61c95,_0x8be5('0xb'),JSON['stringify'](_0x364658));if(_0x364658[_0x8be5('0xc')]){if(_0x364658[_0x8be5('0xc')][_0x8be5('0xd')]===0x1f4){logger[_0x8be5('0xc')](_0x8be5('0xa'),_0x61c95,_0x364658['error'][_0x8be5('0xe')]);return _0x9d6c40(_0x364658[_0x8be5('0xc')]['message']);}logger[_0x8be5('0xc')](_0x8be5('0xa'),_0x61c95,_0x364658['error']['message']);return _0xb9d4df(_0x364658['error'][_0x8be5('0xe')]);}else{logger[_0x8be5('0x9')](_0x8be5('0xa'),_0x61c95,_0x8be5('0xb'));_0xb9d4df(_0x364658[_0x8be5('0xf')][_0x8be5('0xe')]);}})[_0x8be5('0x10')](function(_0x3ea19c){logger['error'](_0x8be5('0xa'),_0x61c95,_0x3ea19c);_0x9d6c40(_0x3ea19c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9736584..94d5f9f 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 _0x8156=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x3eff40,_0x1cdf9e){var _0x4ee4fb=function(_0x4b7170){while(--_0x4b7170){_0x3eff40['push'](_0x3eff40['shift']());}};_0x4ee4fb(++_0x1cdf9e);}(_0x8156,0xad));var _0x6815=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8156[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x6815('0x0'));var path=require(_0x6815('0x1'));var timeout=require(_0x6815('0x2'));var express=require(_0x6815('0x3'));var router=express[_0x6815('0x4')]();var fs_extra=require(_0x6815('0x5'));var auth=require(_0x6815('0x6'));var interaction=require(_0x6815('0x7'));var config=require(_0x6815('0x8'));var controller=require(_0x6815('0x9'));router[_0x6815('0xa')]('/',auth[_0x6815('0xb')](),controller[_0x6815('0xc')]);router[_0x6815('0xa')](_0x6815('0xd'),auth[_0x6815('0xb')](),controller[_0x6815('0xe')]);router[_0x6815('0xf')]('/',auth['isAuthenticated'](),controller[_0x6815('0x10')]);router[_0x6815('0x11')](_0x6815('0xd'),auth[_0x6815('0xb')](),controller[_0x6815('0x12')]);router[_0x6815('0x13')](_0x6815('0xd'),auth[_0x6815('0xb')](),controller[_0x6815('0x14')]);module[_0x6815('0x15')]=router; \ No newline at end of file +var _0xdadd=['Router','../../components/auth/service','../../config/environment','./intDeskField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3ffe05,_0x29ab44){var _0xa70520=function(_0x500e99){while(--_0x500e99){_0x3ffe05['push'](_0x3ffe05['shift']());}};_0xa70520(++_0x29ab44);}(_0xdadd,0x18b));var _0xddad=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0xdadd[_0x211bc3];return _0x34c9a2;};'use strict';var multer=require(_0xddad('0x0'));var util=require(_0xddad('0x1'));var path=require('path');var timeout=require(_0xddad('0x2'));var express=require(_0xddad('0x3'));var router=express[_0xddad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xddad('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xddad('0x6'));var controller=require(_0xddad('0x7'));router[_0xddad('0x8')]('/',auth['isAuthenticated'](),controller[_0xddad('0x9')]);router['get'](_0xddad('0xa'),auth[_0xddad('0xb')](),controller[_0xddad('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xddad('0xd')]);router[_0xddad('0xe')](_0xddad('0xa'),auth[_0xddad('0xb')](),controller[_0xddad('0xf')]);router[_0xddad('0x10')](_0xddad('0xa'),auth['isAuthenticated'](),controller[_0xddad('0x11')]);module[_0xddad('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index fbb0b51..f599fcc 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 _0xaa2c=['customVariable','keyValue','STRING','BOOLEAN','ENUM','string','variable'];(function(_0x5707d2,_0x280c70){var _0x4e358d=function(_0x4a741e){while(--_0x4a741e){_0x5707d2['push'](_0x5707d2['shift']());}};_0x4e358d(++_0x280c70);}(_0xaa2c,0x7b));var _0xcaa2=function(_0x5901de,_0x15acad){_0x5901de=_0x5901de-0x0;var _0x13eb83=_0xaa2c[_0x5901de];return _0x13eb83;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xcaa2('0x0')](_0xcaa2('0x1'),_0xcaa2('0x2'),_0xcaa2('0x3'),_0xcaa2('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xcaa2('0x5')]},'key':{'type':Sequelize[_0xcaa2('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xcaa2('0x1'),_0xcaa2('0x2'),_0xcaa2('0x3'))},'keyContent':{'type':Sequelize[_0xcaa2('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcaa2('0x5')]},'customField':{'type':Sequelize[_0xcaa2('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4d9=['string','variable','picklist','STRING','ENUM','BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4d9,0xdf));var _0x9d4d=function(_0x4252e6,_0x22b1e7){_0x4252e6=_0x4252e6-0x0;var _0x9e530c=_0xd4d9[_0x4252e6];return _0x9e530c;};'use strict';var Sequelize=require('sequelize');module[_0x9d4d('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9d4d('0x1'),_0x9d4d('0x2'),'customVariable','keyValue',_0x9d4d('0x3')),'defaultValue':_0x9d4d('0x1')},'content':{'type':Sequelize[_0x9d4d('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9d4d('0x5')](_0x9d4d('0x1'),_0x9d4d('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x9d4d('0x4')]},'idField':{'type':Sequelize[_0x9d4d('0x4')]},'nameField':{'type':Sequelize[_0x9d4d('0x4')]},'customField':{'type':Sequelize[_0x9d4d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d4d('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index e9b7872..7d0e3b0 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 _0x2873=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','params','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','destroy','end','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type'];(function(_0x41ddf6,_0x4c300b){var _0x66e9ca=function(_0x13ae7e){while(--_0x13ae7e){_0x41ddf6['push'](_0x41ddf6['shift']());}};_0x66e9ca(++_0x4c300b);}(_0x2873,0x1f2));var _0x3287=function(_0x5c8226,_0x514c78){_0x5c8226=_0x5c8226-0x0;var _0x59c7a2=_0x2873[_0x5c8226];return _0x59c7a2;};'use strict';var emlformat=require(_0x3287('0x0'));var rimraf=require(_0x3287('0x1'));var zipdir=require(_0x3287('0x2'));var jsonpatch=require(_0x3287('0x3'));var rp=require('request-promise');var moment=require(_0x3287('0x4'));var BPromise=require(_0x3287('0x5'));var Mustache=require('mustache');var util=require(_0x3287('0x6'));var path=require(_0x3287('0x7'));var sox=require('sox');var csv=require(_0x3287('0x8'));var ejs=require(_0x3287('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3287('0xa'));var squel=require('squel');var crypto=require(_0x3287('0xb'));var jsforce=require(_0x3287('0xc'));var deskjs=require(_0x3287('0xd'));var toCsv=require(_0x3287('0x8'));var querystring=require(_0x3287('0xe'));var Papa=require(_0x3287('0xf'));var Redis=require(_0x3287('0x10'));var authService=require(_0x3287('0x11'));var qs=require(_0x3287('0x12'));var as=require(_0x3287('0x13'));var hardwareService=require(_0x3287('0x14'));var logger=require(_0x3287('0x15'))(_0x3287('0x16'));var utils=require(_0x3287('0x17'));var config=require(_0x3287('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26e3b8,_0x3cdbc4){_0x3cdbc4=_0x3cdbc4||0xcc;return function(_0x423c47){if(_0x423c47){return _0x26e3b8[_0x3287('0x19')](_0x3cdbc4);}return _0x26e3b8[_0x3287('0x1a')](_0x3cdbc4)['end']();};}function respondWithResult(_0x3a6a15,_0x1a58af){_0x1a58af=_0x1a58af||0xc8;return function(_0x2c946d){if(_0x2c946d){return _0x3a6a15[_0x3287('0x1a')](_0x1a58af)['json'](_0x2c946d);}};}function respondWithFilteredResult(_0x38d7ef,_0x4c8143){return function(_0x342461){if(_0x342461){var _0x46128a=typeof _0x4c8143[_0x3287('0x1b')]==='undefined'&&typeof _0x4c8143[_0x3287('0x1c')]===_0x3287('0x1d');var _0x2202ba=_0x342461[_0x3287('0x1e')];var _0x1dfb29=_0x46128a?0x0:_0x4c8143['offset'];var _0x554600=_0x46128a?_0x342461[_0x3287('0x1e')]:_0x4c8143['offset']+_0x4c8143[_0x3287('0x1c')];var _0x4a6bd3;if(_0x554600>=_0x2202ba){_0x554600=_0x2202ba;_0x4a6bd3=0xc8;}else{_0x4a6bd3=0xce;}_0x38d7ef[_0x3287('0x1a')](_0x4a6bd3);return _0x38d7ef['set'](_0x3287('0x1f'),_0x1dfb29+'-'+_0x554600+'/'+_0x2202ba)[_0x3287('0x20')](_0x342461);}return null;};}function patchUpdates(_0x40a787){return function(_0x23dc35){try{jsonpatch[_0x3287('0x21')](_0x23dc35,_0x40a787,!![]);}catch(_0x326eeb){return BPromise[_0x3287('0x22')](_0x326eeb);}return _0x23dc35[_0x3287('0x23')]();};}function saveUpdates(_0x132476,_0xc85da3){return function(_0x39ab07){if(_0x39ab07){return _0x39ab07['update'](_0x132476)['then'](function(_0x427226){return _0x427226;});}return null;};}function removeEntity(_0x2d1fab,_0x4bb4dd){return function(_0x1fc384){if(_0x1fc384){return _0x1fc384[_0x3287('0x24')]()['then'](function(){_0x2d1fab[_0x3287('0x1a')](0xcc)[_0x3287('0x25')]();});}};}function handleEntityNotFound(_0x1955c6,_0x111e3a){return function(_0x3f88e9){if(!_0x3f88e9){_0x1955c6[_0x3287('0x19')](0x194);}return _0x3f88e9;};}function handleError(_0x3e6d87,_0x257268){_0x257268=_0x257268||0x1f4;return function(_0x54f5d9){logger[_0x3287('0x26')](_0x54f5d9[_0x3287('0x27')]);if(_0x54f5d9['name']){delete _0x54f5d9[_0x3287('0x28')];}_0x3e6d87[_0x3287('0x1a')](_0x257268)[_0x3287('0x29')](_0x54f5d9);};}exports[_0x3287('0x2a')]=function(_0x207321,_0x5217ca){var _0x4218df={},_0x9e9bee={},_0x579555={'count':0x0,'rows':[]};var _0x32ef52=_[_0x3287('0x2b')](db[_0x3287('0x2c')][_0x3287('0x2d')],function(_0x59c712){return{'name':_0x59c712[_0x3287('0x2e')],'type':_0x59c712[_0x3287('0x2f')][_0x3287('0x30')]};});_0x9e9bee[_0x3287('0x31')]=_['map'](_0x32ef52,_0x3287('0x28'));_0x9e9bee[_0x3287('0x32')]=_[_0x3287('0x33')](_0x207321[_0x3287('0x32')]);_0x9e9bee[_0x3287('0x34')]=_[_0x3287('0x35')](_0x9e9bee[_0x3287('0x31')],_0x9e9bee[_0x3287('0x32')]);_0x4218df['attributes']=_[_0x3287('0x35')](_0x9e9bee[_0x3287('0x31')],qs[_0x3287('0x36')](_0x207321['query'][_0x3287('0x36')]));_0x4218df['attributes']=_0x4218df[_0x3287('0x37')][_0x3287('0x38')]?_0x4218df[_0x3287('0x37')]:_0x9e9bee[_0x3287('0x31')];if(!_0x207321[_0x3287('0x32')][_0x3287('0x39')](_0x3287('0x3a'))){_0x4218df[_0x3287('0x1c')]=qs[_0x3287('0x1c')](_0x207321[_0x3287('0x32')][_0x3287('0x1c')]);_0x4218df[_0x3287('0x1b')]=qs[_0x3287('0x1b')](_0x207321[_0x3287('0x32')][_0x3287('0x1b')]);}_0x4218df[_0x3287('0x3b')]=qs[_0x3287('0x3c')](_0x207321[_0x3287('0x32')]['sort']);_0x4218df[_0x3287('0x3d')]=qs['filters'](_[_0x3287('0x3e')](_0x207321[_0x3287('0x32')],_0x9e9bee[_0x3287('0x34')]),_0x32ef52);if(_0x207321[_0x3287('0x32')][_0x3287('0x3f')]){_0x4218df[_0x3287('0x3d')]=_[_0x3287('0x40')](_0x4218df[_0x3287('0x3d')],{'$or':_[_0x3287('0x2b')](_0x32ef52,function(_0x3a0aa0){if(_0x3a0aa0[_0x3287('0x2f')]!==_0x3287('0x41')){var _0x47c1a4={};_0x47c1a4[_0x3a0aa0['name']]={'$like':'%'+_0x207321[_0x3287('0x32')][_0x3287('0x3f')]+'%'};return _0x47c1a4;}})});}_0x4218df=_['merge']({},_0x4218df,_0x207321[_0x3287('0x42')]);var _0x74af36={'where':_0x4218df[_0x3287('0x3d')]};return db[_0x3287('0x2c')][_0x3287('0x1e')](_0x74af36)['then'](function(_0x469913){_0x579555[_0x3287('0x1e')]=_0x469913;if(_0x207321['query'][_0x3287('0x43')]){_0x4218df[_0x3287('0x44')]=[{'all':!![]}];}return db[_0x3287('0x2c')][_0x3287('0x45')](_0x4218df);})['then'](function(_0x1f57ba){_0x579555[_0x3287('0x46')]=_0x1f57ba;return _0x579555;})[_0x3287('0x47')](respondWithFilteredResult(_0x5217ca,_0x4218df))[_0x3287('0x48')](handleError(_0x5217ca,null));};exports['show']=function(_0x37528c,_0x42e722){var _0x452578={'raw':!![],'where':{'id':_0x37528c[_0x3287('0x49')]['id']}},_0x5add3c={};_0x5add3c[_0x3287('0x31')]=_[_0x3287('0x33')](db[_0x3287('0x2c')][_0x3287('0x2d')]);_0x5add3c[_0x3287('0x32')]=_[_0x3287('0x33')](_0x37528c['query']);_0x5add3c['filters']=_[_0x3287('0x35')](_0x5add3c[_0x3287('0x31')],_0x5add3c[_0x3287('0x32')]);_0x452578[_0x3287('0x37')]=_['intersection'](_0x5add3c[_0x3287('0x31')],qs['fields'](_0x37528c[_0x3287('0x32')][_0x3287('0x36')]));_0x452578[_0x3287('0x37')]=_0x452578[_0x3287('0x37')][_0x3287('0x38')]?_0x452578[_0x3287('0x37')]:_0x5add3c[_0x3287('0x31')];if(_0x37528c[_0x3287('0x32')][_0x3287('0x43')]){_0x452578[_0x3287('0x44')]=[{'all':!![]}];}_0x452578=_[_0x3287('0x40')]({},_0x452578,_0x37528c['options']);return db[_0x3287('0x2c')]['find'](_0x452578)[_0x3287('0x47')](handleEntityNotFound(_0x42e722,null))[_0x3287('0x47')](respondWithResult(_0x42e722,null))['catch'](handleError(_0x42e722,null));};exports[_0x3287('0x4a')]=function(_0x2f87a3,_0x2da4b6){return db[_0x3287('0x2c')]['create'](_0x2f87a3[_0x3287('0x4b')],{})[_0x3287('0x47')](respondWithResult(_0x2da4b6,0xc9))[_0x3287('0x48')](handleError(_0x2da4b6,null));};exports[_0x3287('0x4c')]=function(_0x2b971b,_0x38d183){if(_0x2b971b[_0x3287('0x4b')]['id']){delete _0x2b971b[_0x3287('0x4b')]['id'];}return db[_0x3287('0x2c')][_0x3287('0x4d')]({'where':{'id':_0x2b971b['params']['id']}})['then'](handleEntityNotFound(_0x38d183,null))[_0x3287('0x47')](saveUpdates(_0x2b971b[_0x3287('0x4b')],null))[_0x3287('0x47')](respondWithResult(_0x38d183,null))[_0x3287('0x48')](handleError(_0x38d183,null));};exports[_0x3287('0x24')]=function(_0x224616,_0x4f5795){return db['DeskField']['find']({'where':{'id':_0x224616['params']['id']}})['then'](handleEntityNotFound(_0x4f5795,null))[_0x3287('0x47')](removeEntity(_0x4f5795,null))[_0x3287('0x48')](handleError(_0x4f5795,null));}; \ No newline at end of file +var _0xf8bb=['undefined','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','include','findAll','catch','show','params','length','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x165ca9,_0x36e359){var _0x25f49a=function(_0x3da5e5){while(--_0x3da5e5){_0x165ca9['push'](_0x165ca9['shift']());}};_0x25f49a(++_0x36e359);}(_0xf8bb,0x111));var _0xbf8b=function(_0x1fc2c0,_0x489b7b){_0x1fc2c0=_0x1fc2c0-0x0;var _0x25a4c6=_0xf8bb[_0x1fc2c0];return _0x25a4c6;};'use strict';var emlformat=require(_0xbf8b('0x0'));var rimraf=require(_0xbf8b('0x1'));var zipdir=require(_0xbf8b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf8b('0x3'));var moment=require(_0xbf8b('0x4'));var BPromise=require(_0xbf8b('0x5'));var Mustache=require(_0xbf8b('0x6'));var util=require(_0xbf8b('0x7'));var path=require(_0xbf8b('0x8'));var sox=require(_0xbf8b('0x9'));var csv=require(_0xbf8b('0xa'));var ejs=require(_0xbf8b('0xb'));var fs=require('fs');var fs_extra=require(_0xbf8b('0xc'));var _=require(_0xbf8b('0xd'));var squel=require(_0xbf8b('0xe'));var crypto=require(_0xbf8b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbf8b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf8b('0x11'));var Redis=require('ioredis');var authService=require(_0xbf8b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbf8b('0x13'));var hardwareService=require(_0xbf8b('0x14'));var logger=require(_0xbf8b('0x15'))(_0xbf8b('0x16'));var utils=require(_0xbf8b('0x17'));var config=require(_0xbf8b('0x18'));var licenseUtil=require(_0xbf8b('0x19'));var db=require(_0xbf8b('0x1a'))['db'];function respondWithStatusCode(_0x59055d,_0x3e3bfb){_0x3e3bfb=_0x3e3bfb||0xcc;return function(_0xeffd6d){if(_0xeffd6d){return _0x59055d['sendStatus'](_0x3e3bfb);}return _0x59055d[_0xbf8b('0x1b')](_0x3e3bfb)[_0xbf8b('0x1c')]();};}function respondWithResult(_0x19f654,_0x1ed0d1){_0x1ed0d1=_0x1ed0d1||0xc8;return function(_0x2b7daf){if(_0x2b7daf){return _0x19f654[_0xbf8b('0x1b')](_0x1ed0d1)[_0xbf8b('0x1d')](_0x2b7daf);}};}function respondWithFilteredResult(_0x2709a7,_0x36875d){return function(_0x3b4e5b){if(_0x3b4e5b){var _0x56cb78=typeof _0x36875d[_0xbf8b('0x1e')]===_0xbf8b('0x1f')&&typeof _0x36875d[_0xbf8b('0x20')]===_0xbf8b('0x1f');var _0x3c09f4=_0x3b4e5b['count'];var _0x3bab93=_0x56cb78?0x0:_0x36875d[_0xbf8b('0x1e')];var _0x460f3d=_0x56cb78?_0x3b4e5b['count']:_0x36875d[_0xbf8b('0x1e')]+_0x36875d[_0xbf8b('0x20')];var _0x2d6bda;if(_0x460f3d>=_0x3c09f4){_0x460f3d=_0x3c09f4;_0x2d6bda=0xc8;}else{_0x2d6bda=0xce;}_0x2709a7['status'](_0x2d6bda);return _0x2709a7[_0xbf8b('0x21')](_0xbf8b('0x22'),_0x3bab93+'-'+_0x460f3d+'/'+_0x3c09f4)[_0xbf8b('0x1d')](_0x3b4e5b);}return null;};}function patchUpdates(_0x461bb8){return function(_0x2ba7e4){try{jsonpatch[_0xbf8b('0x23')](_0x2ba7e4,_0x461bb8,!![]);}catch(_0x4b7209){return BPromise['reject'](_0x4b7209);}return _0x2ba7e4['save']();};}function saveUpdates(_0x153c19,_0x4f36e5){return function(_0x3d4b1a){if(_0x3d4b1a){return _0x3d4b1a['update'](_0x153c19)[_0xbf8b('0x24')](function(_0x4dbb2b){return _0x4dbb2b;});}return null;};}function removeEntity(_0x5dc254,_0x3be6ef){return function(_0x35e83f){if(_0x35e83f){return _0x35e83f[_0xbf8b('0x25')]()[_0xbf8b('0x24')](function(){_0x5dc254[_0xbf8b('0x1b')](0xcc)[_0xbf8b('0x1c')]();});}};}function handleEntityNotFound(_0x34089d,_0xd6f4d0){return function(_0x4cc565){if(!_0x4cc565){_0x34089d[_0xbf8b('0x26')](0x194);}return _0x4cc565;};}function handleError(_0x8d94fb,_0x346914){_0x346914=_0x346914||0x1f4;return function(_0x18d1d5){logger['error'](_0x18d1d5[_0xbf8b('0x27')]);if(_0x18d1d5[_0xbf8b('0x28')]){delete _0x18d1d5['name'];}_0x8d94fb[_0xbf8b('0x1b')](_0x346914)[_0xbf8b('0x29')](_0x18d1d5);};}exports[_0xbf8b('0x2a')]=function(_0x276048,_0x1af553){var _0x2ffc94={},_0xc14007={},_0x36722e={'count':0x0,'rows':[]};var _0x3b9275=_[_0xbf8b('0x2b')](db[_0xbf8b('0x2c')][_0xbf8b('0x2d')],function(_0x456269){return{'name':_0x456269['fieldName'],'type':_0x456269[_0xbf8b('0x2e')][_0xbf8b('0x2f')]};});_0xc14007[_0xbf8b('0x30')]=_[_0xbf8b('0x2b')](_0x3b9275,'name');_0xc14007[_0xbf8b('0x31')]=_[_0xbf8b('0x32')](_0x276048[_0xbf8b('0x31')]);_0xc14007[_0xbf8b('0x33')]=_[_0xbf8b('0x34')](_0xc14007[_0xbf8b('0x30')],_0xc14007[_0xbf8b('0x31')]);_0x2ffc94[_0xbf8b('0x35')]=_[_0xbf8b('0x34')](_0xc14007[_0xbf8b('0x30')],qs[_0xbf8b('0x36')](_0x276048[_0xbf8b('0x31')]['fields']));_0x2ffc94[_0xbf8b('0x35')]=_0x2ffc94['attributes']['length']?_0x2ffc94[_0xbf8b('0x35')]:_0xc14007[_0xbf8b('0x30')];if(!_0x276048[_0xbf8b('0x31')][_0xbf8b('0x37')](_0xbf8b('0x38'))){_0x2ffc94['limit']=qs['limit'](_0x276048[_0xbf8b('0x31')][_0xbf8b('0x20')]);_0x2ffc94[_0xbf8b('0x1e')]=qs[_0xbf8b('0x1e')](_0x276048[_0xbf8b('0x31')][_0xbf8b('0x1e')]);}_0x2ffc94[_0xbf8b('0x39')]=qs[_0xbf8b('0x3a')](_0x276048[_0xbf8b('0x31')][_0xbf8b('0x3a')]);_0x2ffc94['where']=qs[_0xbf8b('0x33')](_[_0xbf8b('0x3b')](_0x276048['query'],_0xc14007[_0xbf8b('0x33')]),_0x3b9275);if(_0x276048[_0xbf8b('0x31')][_0xbf8b('0x3c')]){_0x2ffc94[_0xbf8b('0x3d')]=_[_0xbf8b('0x3e')](_0x2ffc94['where'],{'$or':_[_0xbf8b('0x2b')](_0x3b9275,function(_0x4685e1){if(_0x4685e1[_0xbf8b('0x2e')]!==_0xbf8b('0x3f')){var _0x1bdf87={};_0x1bdf87[_0x4685e1[_0xbf8b('0x28')]]={'$like':'%'+_0x276048[_0xbf8b('0x31')][_0xbf8b('0x3c')]+'%'};return _0x1bdf87;}})});}_0x2ffc94=_[_0xbf8b('0x3e')]({},_0x2ffc94,_0x276048['options']);var _0x39eeff={'where':_0x2ffc94[_0xbf8b('0x3d')]};return db[_0xbf8b('0x2c')][_0xbf8b('0x40')](_0x39eeff)[_0xbf8b('0x24')](function(_0x1f0e25){_0x36722e[_0xbf8b('0x40')]=_0x1f0e25;if(_0x276048[_0xbf8b('0x31')]['includeAll']){_0x2ffc94[_0xbf8b('0x41')]=[{'all':!![]}];}return db[_0xbf8b('0x2c')][_0xbf8b('0x42')](_0x2ffc94);})[_0xbf8b('0x24')](function(_0x238df1){_0x36722e['rows']=_0x238df1;return _0x36722e;})['then'](respondWithFilteredResult(_0x1af553,_0x2ffc94))[_0xbf8b('0x43')](handleError(_0x1af553,null));};exports[_0xbf8b('0x44')]=function(_0x5cbe86,_0x4d6a45){var _0x42b1e1={'raw':!![],'where':{'id':_0x5cbe86[_0xbf8b('0x45')]['id']}},_0x263e0c={};_0x263e0c[_0xbf8b('0x30')]=_[_0xbf8b('0x32')](db['DeskField'][_0xbf8b('0x2d')]);_0x263e0c[_0xbf8b('0x31')]=_[_0xbf8b('0x32')](_0x5cbe86[_0xbf8b('0x31')]);_0x263e0c[_0xbf8b('0x33')]=_['intersection'](_0x263e0c[_0xbf8b('0x30')],_0x263e0c[_0xbf8b('0x31')]);_0x42b1e1[_0xbf8b('0x35')]=_['intersection'](_0x263e0c['model'],qs['fields'](_0x5cbe86[_0xbf8b('0x31')][_0xbf8b('0x36')]));_0x42b1e1[_0xbf8b('0x35')]=_0x42b1e1[_0xbf8b('0x35')][_0xbf8b('0x46')]?_0x42b1e1[_0xbf8b('0x35')]:_0x263e0c[_0xbf8b('0x30')];if(_0x5cbe86[_0xbf8b('0x31')][_0xbf8b('0x47')]){_0x42b1e1[_0xbf8b('0x41')]=[{'all':!![]}];}_0x42b1e1=_[_0xbf8b('0x3e')]({},_0x42b1e1,_0x5cbe86[_0xbf8b('0x48')]);return db[_0xbf8b('0x2c')][_0xbf8b('0x49')](_0x42b1e1)[_0xbf8b('0x24')](handleEntityNotFound(_0x4d6a45,null))[_0xbf8b('0x24')](respondWithResult(_0x4d6a45,null))['catch'](handleError(_0x4d6a45,null));};exports[_0xbf8b('0x4a')]=function(_0x355644,_0x1e3076){return db[_0xbf8b('0x2c')]['create'](_0x355644[_0xbf8b('0x4b')],{})[_0xbf8b('0x24')](respondWithResult(_0x1e3076,0xc9))[_0xbf8b('0x43')](handleError(_0x1e3076,null));};exports['update']=function(_0x3c22d0,_0x2ee446){if(_0x3c22d0[_0xbf8b('0x4b')]['id']){delete _0x3c22d0[_0xbf8b('0x4b')]['id'];}return db[_0xbf8b('0x2c')][_0xbf8b('0x49')]({'where':{'id':_0x3c22d0['params']['id']}})['then'](handleEntityNotFound(_0x2ee446,null))['then'](saveUpdates(_0x3c22d0[_0xbf8b('0x4b')],null))[_0xbf8b('0x24')](respondWithResult(_0x2ee446,null))[_0xbf8b('0x43')](handleError(_0x2ee446,null));};exports['destroy']=function(_0x4da94e,_0x395ea1){return db[_0xbf8b('0x2c')]['find']({'where':{'id':_0x4da94e[_0xbf8b('0x45')]['id']}})[_0xbf8b('0x24')](handleEntityNotFound(_0x395ea1,null))[_0xbf8b('0x24')](removeEntity(_0x395ea1,null))[_0xbf8b('0x43')](handleError(_0x395ea1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 83362b3..2e272ed 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 _0x2d44=['define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x2079e7,_0xdc5145){var _0x5a26c9=function(_0x29422d){while(--_0x29422d){_0x2079e7['push'](_0x2079e7['shift']());}};_0x5a26c9(++_0xdc5145);}(_0x2d44,0x1b8));var _0x42d4=function(_0x587f23,_0x1ace44){_0x587f23=_0x587f23-0x0;var _0x339ce6=_0x2d44[_0x587f23];return _0x339ce6;};'use strict';var _=require('lodash');var util=require(_0x42d4('0x0'));var logger=require(_0x42d4('0x1'))(_0x42d4('0x2'));var moment=require(_0x42d4('0x3'));var BPromise=require('bluebird');var rp=require(_0x42d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42d4('0x5'));var config=require(_0x42d4('0x6'));var attributes=require(_0x42d4('0x7'));module['exports']=function(_0x3151db,_0x1d1a87){return _0x3151db[_0x42d4('0x8')](_0x42d4('0x9'),attributes,{'tableName':_0x42d4('0xa'),'paranoid':![],'indexes':[{'name':_0x42d4('0xb'),'fields':[_0x42d4('0xc'),_0x42d4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe200=['./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xe200,0x7f));var _0x0e20=function(_0x4d1f50,_0x292f3c){_0x4d1f50=_0x4d1f50-0x0;var _0x5576d7=_0xe200[_0x4d1f50];return _0x5576d7;};'use strict';var _=require(_0x0e20('0x0'));var util=require(_0x0e20('0x1'));var logger=require(_0x0e20('0x2'))(_0x0e20('0x3'));var moment=require(_0x0e20('0x4'));var BPromise=require(_0x0e20('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0e20('0x6'));var config=require(_0x0e20('0x7'));var attributes=require(_0x0e20('0x8'));module[_0x0e20('0x9')]=function(_0x31f066,_0x521241){return _0x31f066[_0x0e20('0xa')]('DeskField',attributes,{'tableName':_0x0e20('0xb'),'paranoid':![],'indexes':[{'name':_0x0e20('0xc'),'fields':[_0x0e20('0xd'),_0x0e20('0xe')],'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 cce5012..f303fa4 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 _0xbc7d=['moment','bluebird','ioredis','../../mysqldb','../../config/environment','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc7d,0x8e));var _0xdbc7=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0xbc7d[_0xfd9b19];return _0x514918;};'use strict';var _=require(_0xdbc7('0x0'));var util=require(_0xdbc7('0x1'));var moment=require(_0xdbc7('0x2'));var BPromise=require(_0xdbc7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdbc7('0x4'));var db=require(_0xdbc7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdbc7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdbc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x339cee,_0x41d7dc,_0x159f76){return new BPromise(function(_0x1d2725,_0xfa888a){return client[_0xdbc7('0x8')](_0x339cee,_0x159f76)[_0xdbc7('0x9')](function(_0x4d3b06){logger['info'](_0xdbc7('0xa'),_0x41d7dc,_0xdbc7('0xb'));logger[_0xdbc7('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x41d7dc,'request\x20sent',JSON['stringify'](_0x4d3b06));if(_0x4d3b06['error']){if(_0x4d3b06['error']['code']===0x1f4){logger[_0xdbc7('0xd')]('DeskField,\x20%s,\x20%s',_0x41d7dc,_0x4d3b06[_0xdbc7('0xd')][_0xdbc7('0xe')]);return _0xfa888a(_0x4d3b06[_0xdbc7('0xd')]['message']);}logger[_0xdbc7('0xd')](_0xdbc7('0xa'),_0x41d7dc,_0x4d3b06[_0xdbc7('0xd')][_0xdbc7('0xe')]);return _0x1d2725(_0x4d3b06[_0xdbc7('0xd')][_0xdbc7('0xe')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x41d7dc,'request\x20sent');_0x1d2725(_0x4d3b06['result'][_0xdbc7('0xe')]);}})[_0xdbc7('0xf')](function(_0x3fe234){logger[_0xdbc7('0xd')](_0xdbc7('0xa'),_0x41d7dc,_0x3fe234);_0xfa888a(_0x3fe234);});});} \ No newline at end of file +var _0x0c0a=['client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise'];(function(_0xb549e1,_0x4a7ad5){var _0x3954fd=function(_0x291bd7){while(--_0x291bd7){_0xb549e1['push'](_0xb549e1['shift']());}};_0x3954fd(++_0x4a7ad5);}(_0x0c0a,0x1f0));var _0xa0c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c0a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa0c0('0x0'));var util=require('util');var moment=require(_0xa0c0('0x1'));var BPromise=require(_0xa0c0('0x2'));var rs=require(_0xa0c0('0x3'));var fs=require('fs');var Redis=require(_0xa0c0('0x4'));var db=require(_0xa0c0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0c0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa0c0('0x7'));var client=jayson[_0xa0c0('0x8')][_0xa0c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e36ed,_0xb4f997,_0x1677a1){return new BPromise(function(_0x38c233,_0x57d263){return client[_0xa0c0('0xa')](_0x2e36ed,_0x1677a1)[_0xa0c0('0xb')](function(_0x129547){logger[_0xa0c0('0xc')](_0xa0c0('0xd'),_0xb4f997,'request\x20sent');logger[_0xa0c0('0xe')](_0xa0c0('0xf'),_0xb4f997,_0xa0c0('0x10'),JSON['stringify'](_0x129547));if(_0x129547[_0xa0c0('0x11')]){if(_0x129547[_0xa0c0('0x11')][_0xa0c0('0x12')]===0x1f4){logger[_0xa0c0('0x11')](_0xa0c0('0xd'),_0xb4f997,_0x129547[_0xa0c0('0x11')][_0xa0c0('0x13')]);return _0x57d263(_0x129547[_0xa0c0('0x11')][_0xa0c0('0x13')]);}logger[_0xa0c0('0x11')]('DeskField,\x20%s,\x20%s',_0xb4f997,_0x129547[_0xa0c0('0x11')][_0xa0c0('0x13')]);return _0x38c233(_0x129547[_0xa0c0('0x11')][_0xa0c0('0x13')]);}else{logger[_0xa0c0('0xc')]('DeskField,\x20%s,\x20%s',_0xb4f997,_0xa0c0('0x10'));_0x38c233(_0x129547['result'][_0xa0c0('0x13')]);}})[_0xa0c0('0x14')](function(_0x4a93b3){logger['error']('DeskField,\x20%s,\x20%s',_0xb4f997,_0x4a93b3);_0x57d263(_0x4a93b3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index cf32642..caee66d 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 _0xc374=['get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0x43ba50,_0x50c20f){var _0x4382df=function(_0x57393c){while(--_0x57393c){_0x43ba50['push'](_0x43ba50['shift']());}};_0x4382df(++_0x50c20f);}(_0xc374,0x198));var _0x4c37=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc374[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x4c37('0x0'));var util=require(_0x4c37('0x1'));var path=require('path');var timeout=require(_0x4c37('0x2'));var express=require(_0x4c37('0x3'));var router=express[_0x4c37('0x4')]();var fs_extra=require(_0x4c37('0x5'));var auth=require(_0x4c37('0x6'));var interaction=require(_0x4c37('0x7'));var config=require(_0x4c37('0x8'));var controller=require(_0x4c37('0x9'));router[_0x4c37('0xa')]('/',auth[_0x4c37('0xb')](),controller[_0x4c37('0xc')]);router[_0x4c37('0xa')](_0x4c37('0xd'),auth['isAuthenticated'](),controller[_0x4c37('0xe')]);router[_0x4c37('0xa')](_0x4c37('0xf'),auth[_0x4c37('0xb')](),controller['getConfigurations']);router[_0x4c37('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4c37('0x10')]);router[_0x4c37('0x11')]('/',auth[_0x4c37('0xb')](),controller[_0x4c37('0x12')]);router[_0x4c37('0x11')](_0x4c37('0xf'),auth[_0x4c37('0xb')](),controller[_0x4c37('0x13')]);router[_0x4c37('0x14')]('/:id',auth[_0x4c37('0xb')](),controller[_0x4c37('0x15')]);router['delete'](_0x4c37('0xd'),auth[_0x4c37('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2528=['create','post','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','/:id','get','/:id/fields','getFields'];(function(_0x42d340,_0x1f42eb){var _0x34c47d=function(_0x2bfee9){while(--_0x2bfee9){_0x42d340['push'](_0x42d340['shift']());}};_0x34c47d(++_0x1f42eb);}(_0x2528,0x71));var _0x8252=function(_0x2b0a04,_0x24bb9c){_0x2b0a04=_0x2b0a04-0x0;var _0x26f60f=_0x2528[_0x2b0a04];return _0x26f60f;};'use strict';var multer=require(_0x8252('0x0'));var util=require(_0x8252('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8252('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8252('0x3'));var interaction=require(_0x8252('0x4'));var config=require(_0x8252('0x5'));var controller=require(_0x8252('0x6'));router['get']('/',auth[_0x8252('0x7')](),controller[_0x8252('0x8')]);router['get'](_0x8252('0x9'),auth[_0x8252('0x7')](),controller['show']);router['get']('/:id/configurations',auth[_0x8252('0x7')](),controller['getConfigurations']);router[_0x8252('0xa')](_0x8252('0xb'),auth[_0x8252('0x7')](),controller[_0x8252('0xc')]);router['post']('/',auth[_0x8252('0x7')](),controller[_0x8252('0xd')]);router[_0x8252('0xe')](_0x8252('0xf'),auth[_0x8252('0x7')](),controller[_0x8252('0x10')]);router[_0x8252('0x11')](_0x8252('0x9'),auth[_0x8252('0x7')](),controller[_0x8252('0x12')]);router[_0x8252('0x13')]('/:id',auth[_0x8252('0x7')](),controller['destroy']);module[_0x8252('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8b93a6c..e8924ba 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 _0x744c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x744c,0xa0));var _0xc744=function(_0x5e3836,_0x35936a){_0x5e3836=_0x5e3836-0x0;var _0x2a4f95=_0x744c[_0x5e3836];return _0x2a4f95;};'use strict';var Sequelize=require(_0xc744('0x0'));module[_0xc744('0x1')]={'name':{'type':Sequelize[_0xc744('0x2')]},'username':{'type':Sequelize[_0xc744('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc744('0x2')]},'tenantId':{'type':Sequelize[_0xc744('0x2')]},'clientId':{'type':Sequelize[_0xc744('0x2')]},'clientSecret':{'type':Sequelize[_0xc744('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xc744('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x236d=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2dcdad,_0x288367){var _0x2d08dc=function(_0x4b8dc0){while(--_0x4b8dc0){_0x2dcdad['push'](_0x2dcdad['shift']());}};_0x2d08dc(++_0x288367);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd236('0x0'));module[_0xd236('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd236('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd236('0x2')]},'tenantId':{'type':Sequelize[_0xd236('0x2')]},'clientId':{'type':Sequelize[_0xd236('0x2')]},'clientSecret':{'type':Sequelize[_0xd236('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xd236('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 cf4d78d..32a4d5a 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 _0xb7d1=['ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','POST','https://login.microsoftonline.com/','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','concat','error','test','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','Content-Range','then','end','stack','name','send','index','Dynamics365Account','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','findAll','rows','catch','show','params','keys','include','create','body','update','find','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields'];(function(_0x2da5d6,_0xd519de){var _0x2634f9=function(_0x1fefe2){while(--_0x1fefe2){_0x2da5d6['push'](_0x2da5d6['shift']());}};_0x2634f9(++_0xd519de);}(_0xb7d1,0x79));var _0x1b7d=function(_0x4c3d04,_0x435c08){_0x4c3d04=_0x4c3d04-0x0;var _0x427568=_0xb7d1[_0x4c3d04];return _0x427568;};'use strict';var rp=require(_0x1b7d('0x0'));var util=require(_0x1b7d('0x1'));var _=require(_0x1b7d('0x2'));var qs=require(_0x1b7d('0x3'));var logger=require(_0x1b7d('0x4'))(_0x1b7d('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1b7d('0x6'));function respondWithResult(_0x50b219,_0x5af97d){_0x5af97d=_0x5af97d||0xc8;return function(_0x53bb98){if(_0x53bb98){return _0x50b219['status'](_0x5af97d)[_0x1b7d('0x7')](_0x53bb98);}};}function respondWithFilteredResult(_0xcbf80d,_0xe7436b){return function(_0x21d814){if(_0x21d814){var _0x2eb249=typeof _0xe7436b[_0x1b7d('0x8')]===_0x1b7d('0x9')&&typeof _0xe7436b[_0x1b7d('0xa')]===_0x1b7d('0x9');var _0x13d7e6=_0x21d814['count'];var _0xaf2510=_0x2eb249?0x0:_0xe7436b[_0x1b7d('0x8')];var _0xa12fc2=_0x2eb249?_0x21d814[_0x1b7d('0xb')]:_0xe7436b[_0x1b7d('0x8')]+_0xe7436b[_0x1b7d('0xa')];var _0x328c3e;if(_0xa12fc2>=_0x13d7e6){_0xa12fc2=_0x13d7e6;_0x328c3e=0xc8;}else{_0x328c3e=0xce;}_0xcbf80d[_0x1b7d('0xc')](_0x328c3e);return _0xcbf80d[_0x1b7d('0xd')](_0x1b7d('0xe'),_0xaf2510+'-'+_0xa12fc2+'/'+_0x13d7e6)[_0x1b7d('0x7')](_0x21d814);}return null;};}function saveUpdates(_0x288dfd){return function(_0x48853f){if(_0x48853f){return _0x48853f['update'](_0x288dfd)[_0x1b7d('0xf')](function(_0x381865){return _0x381865;});}return null;};}function removeEntity(_0x2c5bfc){return function(_0x1f448f){if(_0x1f448f){return _0x1f448f['destroy']()[_0x1b7d('0xf')](function(){_0x2c5bfc[_0x1b7d('0xc')](0xcc)[_0x1b7d('0x10')]();});}};}function handleEntityNotFound(_0x15ed67){return function(_0x787ad8){if(!_0x787ad8){_0x15ed67['sendStatus'](0x194);}return _0x787ad8;};}function handleError(_0x26ad2e,_0x82c937){_0x82c937=_0x82c937||0x1f4;return function(_0x42d207){logger['error'](_0x42d207[_0x1b7d('0x11')]);if(_0x42d207[_0x1b7d('0x12')]){delete _0x42d207[_0x1b7d('0x12')];}_0x26ad2e[_0x1b7d('0xc')](_0x82c937)[_0x1b7d('0x13')](_0x42d207);};}exports[_0x1b7d('0x14')]=function(_0x327f36,_0x1ad55a){var _0x219ca9={},_0x37a81a={},_0x546a93={'count':0x0,'rows':[]};var _0x1e4fb9=_['map'](db[_0x1b7d('0x15')]['rawAttributes'],function(_0x8a4eb2){return{'name':_0x8a4eb2[_0x1b7d('0x16')],'type':_0x8a4eb2[_0x1b7d('0x17')][_0x1b7d('0x18')]};});_0x37a81a[_0x1b7d('0x19')]=_[_0x1b7d('0x1a')](_0x1e4fb9,_0x1b7d('0x12'));_0x37a81a[_0x1b7d('0x1b')]=_['keys'](_0x327f36['query']);_0x37a81a[_0x1b7d('0x1c')]=_[_0x1b7d('0x1d')](_0x37a81a[_0x1b7d('0x19')],_0x37a81a[_0x1b7d('0x1b')]);_0x219ca9[_0x1b7d('0x1e')]=_[_0x1b7d('0x1d')](_0x37a81a['model'],qs[_0x1b7d('0x1f')](_0x327f36['query'][_0x1b7d('0x1f')]));_0x219ca9[_0x1b7d('0x1e')]=_0x219ca9['attributes'][_0x1b7d('0x20')]?_0x219ca9['attributes']:_0x37a81a[_0x1b7d('0x19')];if(!_0x327f36[_0x1b7d('0x1b')][_0x1b7d('0x21')](_0x1b7d('0x22'))){_0x219ca9[_0x1b7d('0xa')]=qs[_0x1b7d('0xa')](_0x327f36['query'][_0x1b7d('0xa')]);_0x219ca9['offset']=qs[_0x1b7d('0x8')](_0x327f36['query'][_0x1b7d('0x8')]);}_0x219ca9[_0x1b7d('0x23')]=qs['sort'](_0x327f36[_0x1b7d('0x1b')]['sort']);_0x219ca9[_0x1b7d('0x24')]=qs[_0x1b7d('0x1c')](_[_0x1b7d('0x25')](_0x327f36['query'],_0x37a81a[_0x1b7d('0x1c')]),_0x1e4fb9);if(_0x327f36[_0x1b7d('0x1b')][_0x1b7d('0x26')]){_0x219ca9['where']=_[_0x1b7d('0x27')](_0x219ca9['where'],{'$or':_[_0x1b7d('0x1a')](_0x1e4fb9,function(_0x36040c){if(_0x36040c[_0x1b7d('0x17')]!=='VIRTUAL'){var _0x4ac7a1={};_0x4ac7a1[_0x36040c['name']]={'$like':'%'+_0x327f36[_0x1b7d('0x1b')][_0x1b7d('0x26')]+'%'};return _0x4ac7a1;}})});}_0x219ca9=_[_0x1b7d('0x27')]({},_0x219ca9,_0x327f36[_0x1b7d('0x28')]);var _0x690b0a={'where':_0x219ca9['where']};return db[_0x1b7d('0x15')][_0x1b7d('0xb')](_0x690b0a)[_0x1b7d('0xf')](function(_0x49f8e2){_0x546a93['count']=_0x49f8e2;if(_0x327f36[_0x1b7d('0x1b')]['includeAll']){_0x219ca9['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x1b7d('0x29')](_0x219ca9);})[_0x1b7d('0xf')](function(_0x256b40){_0x546a93[_0x1b7d('0x2a')]=_0x256b40;return _0x546a93;})[_0x1b7d('0xf')](respondWithFilteredResult(_0x1ad55a,_0x219ca9))[_0x1b7d('0x2b')](handleError(_0x1ad55a,null));};exports[_0x1b7d('0x2c')]=function(_0x3aaec6,_0x5d0ffa){var _0x209726={'raw':![],'where':{'id':_0x3aaec6[_0x1b7d('0x2d')]['id']}},_0x599faf={};_0x599faf[_0x1b7d('0x19')]=_[_0x1b7d('0x2e')](db[_0x1b7d('0x15')]['rawAttributes']);_0x599faf[_0x1b7d('0x1b')]=_[_0x1b7d('0x2e')](_0x3aaec6[_0x1b7d('0x1b')]);_0x599faf['filters']=_[_0x1b7d('0x1d')](_0x599faf[_0x1b7d('0x19')],_0x599faf['query']);_0x209726[_0x1b7d('0x1e')]=_[_0x1b7d('0x1d')](_0x599faf[_0x1b7d('0x19')],qs[_0x1b7d('0x1f')](_0x3aaec6[_0x1b7d('0x1b')][_0x1b7d('0x1f')]));_0x209726[_0x1b7d('0x1e')]=_0x209726[_0x1b7d('0x1e')][_0x1b7d('0x20')]?_0x209726[_0x1b7d('0x1e')]:_0x599faf[_0x1b7d('0x19')];if(_0x3aaec6[_0x1b7d('0x1b')]['includeAll']){_0x209726[_0x1b7d('0x2f')]=[{'all':!![]}];}_0x209726=_[_0x1b7d('0x27')]({},_0x209726,_0x3aaec6[_0x1b7d('0x28')]);return db[_0x1b7d('0x15')]['find'](_0x209726)[_0x1b7d('0xf')](handleEntityNotFound(_0x5d0ffa,null))[_0x1b7d('0xf')](respondWithResult(_0x5d0ffa,null))['catch'](handleError(_0x5d0ffa,null));};exports[_0x1b7d('0x30')]=function(_0x40b1e5,_0x41e3f5){return db['Dynamics365Account']['create'](_0x40b1e5[_0x1b7d('0x31')],{})['then'](respondWithResult(_0x41e3f5,0xc9))[_0x1b7d('0x2b')](handleError(_0x41e3f5,null));};exports[_0x1b7d('0x32')]=function(_0x2fa759,_0x3f0db6){if(_0x2fa759[_0x1b7d('0x31')]['id']){delete _0x2fa759[_0x1b7d('0x31')]['id'];}return db['Dynamics365Account'][_0x1b7d('0x33')]({'where':{'id':_0x2fa759[_0x1b7d('0x2d')]['id']}})[_0x1b7d('0xf')](handleEntityNotFound(_0x3f0db6,null))[_0x1b7d('0xf')](saveUpdates(_0x2fa759['body'],null))['then'](respondWithResult(_0x3f0db6,null))['catch'](handleError(_0x3f0db6,null));};exports['destroy']=function(_0x2a7f30,_0x3c6afd){return db['Dynamics365Account'][_0x1b7d('0x33')]({'where':{'id':_0x2a7f30[_0x1b7d('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3c6afd,null))[_0x1b7d('0xf')](removeEntity(_0x3c6afd,null))[_0x1b7d('0x2b')](handleError(_0x3c6afd,null));};exports[_0x1b7d('0x34')]=function(_0xd0a704,_0x527127){var _0xb2ced5={};var _0x49582d={};var _0x2f53bd;var _0x5c966f;return db[_0x1b7d('0x15')][_0x1b7d('0x35')]({'where':{'id':_0xd0a704['params']['id']}})[_0x1b7d('0xf')](handleEntityNotFound(_0x527127,null))['then'](function(_0x37e9bc){if(_0x37e9bc){_0x2f53bd=_0x37e9bc;_0x49582d['model']=_['keys'](db[_0x1b7d('0x36')][_0x1b7d('0x37')]);_0x49582d['query']=_[_0x1b7d('0x2e')](_0xd0a704['query']);_0x49582d['filters']=_[_0x1b7d('0x1d')](_0x49582d[_0x1b7d('0x19')],_0x49582d[_0x1b7d('0x1b')]);_0xb2ced5[_0x1b7d('0x1e')]=_[_0x1b7d('0x1d')](_0x49582d[_0x1b7d('0x19')],qs[_0x1b7d('0x1f')](_0xd0a704[_0x1b7d('0x1b')]['fields']));_0xb2ced5['attributes']=_0xb2ced5[_0x1b7d('0x1e')][_0x1b7d('0x20')]?_0xb2ced5['attributes']:_0x49582d[_0x1b7d('0x19')];_0xb2ced5[_0x1b7d('0x23')]=qs[_0x1b7d('0x38')](_0xd0a704[_0x1b7d('0x1b')][_0x1b7d('0x38')]);_0xb2ced5[_0x1b7d('0x24')]=qs[_0x1b7d('0x1c')](_[_0x1b7d('0x25')](_0xd0a704[_0x1b7d('0x1b')],_0x49582d['filters']));if(_0xd0a704[_0x1b7d('0x1b')][_0x1b7d('0x26')]){_0xb2ced5['where']=_[_0x1b7d('0x27')](_0xb2ced5[_0x1b7d('0x24')],{'$or':_['map'](_0xb2ced5[_0x1b7d('0x1e')],function(_0x453683){var _0x11c3ea={};_0x11c3ea[_0x453683]={'$like':'%'+_0xd0a704['query'][_0x1b7d('0x26')]+'%'};return _0x11c3ea;})});}_0xb2ced5=_[_0x1b7d('0x27')]({},_0xb2ced5,_0xd0a704[_0x1b7d('0x28')]);return _0x2f53bd[_0x1b7d('0x34')](_0xb2ced5);}})['then'](function(_0x58aa6a){if(_0x58aa6a){_0x5c966f=_0x58aa6a[_0x1b7d('0x20')];if(!_0xd0a704['query'][_0x1b7d('0x21')](_0x1b7d('0x22'))){_0xb2ced5['limit']=qs['limit'](_0xd0a704[_0x1b7d('0x1b')][_0x1b7d('0xa')]);_0xb2ced5[_0x1b7d('0x8')]=qs[_0x1b7d('0x8')](_0xd0a704['query'][_0x1b7d('0x8')]);}return _0x2f53bd['getConfigurations'](_0xb2ced5);}})[_0x1b7d('0xf')](function(_0x3da757){if(_0x3da757){return _0x3da757?{'count':_0x5c966f,'rows':_0x3da757}:null;}})['then'](respondWithResult(_0x527127,null))[_0x1b7d('0x2b')](handleError(_0x527127,null));};exports[_0x1b7d('0x39')]=function(_0x4367cf,_0x5fc026){if(_0x4367cf[_0x1b7d('0x31')]['id']){delete _0x4367cf[_0x1b7d('0x31')]['id'];}return db[_0x1b7d('0x15')][_0x1b7d('0x35')]({'where':{'id':_0x4367cf[_0x1b7d('0x2d')]['id']}})[_0x1b7d('0xf')](handleEntityNotFound(_0x5fc026,null))[_0x1b7d('0xf')](function(_0x4e951b){if(_0x4e951b){_0x4367cf['body'][_0x1b7d('0x3a')]=_0x4e951b['id'];_0x4367cf[_0x1b7d('0x31')][_0x1b7d('0x3b')]=integrations[_0x1b7d('0x3c')](_0x4367cf[_0x1b7d('0x31')][_0x1b7d('0x3d')],_0x4367cf['body'][_0x1b7d('0x17')]);_0x4367cf[_0x1b7d('0x31')][_0x1b7d('0x3e')]=integrations[_0x1b7d('0x3f')](_0x4367cf[_0x1b7d('0x31')][_0x1b7d('0x3d')],_0x4367cf[_0x1b7d('0x31')][_0x1b7d('0x17')]);return db[_0x1b7d('0x36')]['create'](_0x4367cf['body'],{'include':[{'model':db[_0x1b7d('0x40')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x1b7d('0x3e')}]});}return null;})[_0x1b7d('0xf')](respondWithResult(_0x5fc026,null))[_0x1b7d('0x2b')](handleError(_0x5fc026,null));};function sanitizeRemoteUri(_0x54730e){var _0x52be5d=_0x54730e[_0x1b7d('0x41')](-0x1);if(_0x52be5d==='/')return _0x54730e[_0x1b7d('0x42')](0x0,_0x54730e[_0x1b7d('0x43')](_0x52be5d));return _0x54730e;}function getWebApiUrl(_0x1bab70){return util[_0x1b7d('0x44')](_0x1b7d('0x45'),_0x1bab70);}exports[_0x1b7d('0x46')]=function(_0x46e1d0,_0xedcbee){var _0x1355d0=_0x46e1d0[_0x1b7d('0x1b')][_0x1b7d('0x47')];var _0xb9c1fb=_0x1355d0===_0x1b7d('0x48')?_0x1b7d('0x49'):_0x1b7d('0x4a');var _0x2d37b6='';var _0x56f0c2='';var _0x29bbd5='';var _0x18173a='';var _0x206d97='';var _0x328cf3='';var _0x122640='';var _0x5b3352='';var _0x386844=[_0x1b7d('0x4b'),_0x1b7d('0x4c'),'customerid',_0x1b7d('0x4d'),_0x1b7d('0x4e'),_0x1b7d('0x4f'),_0x1b7d('0x50'),_0x1b7d('0x51'),_0x1b7d('0x52'),_0x1b7d('0x53')];var _0x4a0686=['accountidname',_0x1b7d('0x54'),_0x1b7d('0x55'),_0x1b7d('0x56'),'contactidname',_0x1b7d('0x57'),_0x1b7d('0x58'),_0x1b7d('0x59'),_0x1b7d('0x5a'),_0x1b7d('0x5b'),_0x1b7d('0x5c'),'createdbyyominame',_0x1b7d('0x5d'),_0x1b7d('0x5e'),_0x1b7d('0x5f'),_0x1b7d('0x60'),_0x1b7d('0x61'),'customeridyominame',_0x1b7d('0x62'),_0x1b7d('0x63'),'entityimage_timestamp',_0x1b7d('0x64'),_0x1b7d('0x65'),'exchangerate',_0x1b7d('0x66'),_0x1b7d('0x67'),_0x1b7d('0x68'),_0x1b7d('0x69'),'kbarticleidname',_0x1b7d('0x6a'),_0x1b7d('0x6b'),'modifiedbyexternalpartyname',_0x1b7d('0x6c'),_0x1b7d('0x6d'),_0x1b7d('0x6e'),'modifiedon',_0x1b7d('0x6f'),'modifiedonbehalfbyyominame',_0x1b7d('0x70'),_0x1b7d('0x71'),'numberofchildincidents',_0x1b7d('0x72'),_0x1b7d('0x73'),_0x1b7d('0x74'),_0x1b7d('0x75'),'owneridyominame',_0x1b7d('0x76'),'primarycontactidname',_0x1b7d('0x77'),_0x1b7d('0x78'),_0x1b7d('0x79'),_0x1b7d('0x7a'),_0x1b7d('0x7b'),'resolvebykpiidname',_0x1b7d('0x7c'),_0x1b7d('0x7d'),_0x1b7d('0x7e'),'sentimentvalue',_0x1b7d('0x7f'),_0x1b7d('0x80'),_0x1b7d('0x81'),_0x1b7d('0x82'),_0x1b7d('0x83'),_0x1b7d('0x84'),_0x1b7d('0x85'),_0x1b7d('0x86'),_0x1b7d('0x87'),'traversedpath','utcconversiontimezonecode',_0x1b7d('0x88')];var _0x1b197e=_0x386844['concat'](_0x4a0686);return db['Dynamics365Account'][_0x1b7d('0x35')]({'where':{'id':_0x46e1d0[_0x1b7d('0x2d')]['id']},'attributes':['id',_0x1b7d('0x89'),_0x1b7d('0x8a'),_0x1b7d('0x8b'),_0x1b7d('0x8c'),_0x1b7d('0x8d'),_0x1b7d('0x8e'),'modernAuthentication'],'include':[{'model':db[_0x1b7d('0x8f')],'as':_0x1b7d('0x8f'),'attributes':['id',_0x1b7d('0x90'),_0x1b7d('0x91')]}]})[_0x1b7d('0xf')](handleEntityNotFound(_0xedcbee,null))['then'](function(_0x22a0b0){if(_0x22a0b0){if(_0x22a0b0[_0x1b7d('0x92')]){_0x22a0b0['access_token']=_0x22a0b0[_0x1b7d('0x8f')][_0x1b7d('0x90')];_0x5b3352=sanitizeRemoteUri(_0x22a0b0[_0x1b7d('0x8f')]['data7']);_0x122640=getWebApiUrl(_0x5b3352);return _0x22a0b0;}_0x5b3352=sanitizeRemoteUri(_0x22a0b0[_0x1b7d('0x8b')]);_0x122640=getWebApiUrl(_0x5b3352);var _0x4aab26={'method':_0x1b7d('0x93'),'uri':_0x1b7d('0x94')+_0x22a0b0['tenantId']+'/oauth2/token','form':{'client_id':_0x22a0b0[_0x1b7d('0x8d')],'resource':_0x5b3352,'username':_0x22a0b0[_0x1b7d('0x89')],'password':_0x22a0b0[_0x1b7d('0x8a')],'grant_type':_0x1b7d('0x8a'),'client_secret':_0x22a0b0[_0x1b7d('0x8e')]},'json':!![]};return rp(_0x4aab26);}})[_0x1b7d('0xf')](function(_0x36bf4a){_0x328cf3=_0x36bf4a[_0x1b7d('0x95')];var _0x1d1d11={'method':'GET','uri':encodeURI(_0x122640+_0x1b7d('0x96')+_0xb9c1fb+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x328cf3,'If-None-Match':null,'OData-Version':_0x1b7d('0x97')},'json':!![]};return rp(_0x1d1d11);})[_0x1b7d('0xf')](function(_0x3143d4){var _0x189e17=_0x3143d4[_0x1b7d('0x98')][0x0];var _0x7a90f7=_0x189e17[_0x1b7d('0x99')];var _0x49286c={'method':'GET','uri':_0x122640+_0x1b7d('0x9a')+_0x7a90f7+_0x1b7d('0x9b'),'headers':{'Authorization':_0x1b7d('0x9c')+_0x328cf3,'If-None-Match':null,'OData-Version':_0x1b7d('0x97')},'json':!![]};return rp(_0x49286c);})[_0x1b7d('0xf')](function(_0x22b807){_0x2d37b6=_0x22b807;_0x56f0c2=_0x2d37b6['Attributes'];_0x56f0c2=_[_0x1b7d('0x9d')](_0x56f0c2,function(_0xefa3fd){return!_0x1b197e[_0x1b7d('0x9e')](_0xefa3fd[_0x1b7d('0x9f')]);});var _0x330f36=[];var _0x32b91e=[];_0x56f0c2[_0x1b7d('0xa0')](function(_0x31632c){if(_0x31632c['@odata.type']){var _0x4f058a=_0x31632c[_0x1b7d('0xa1')][_0x1b7d('0x42')](_0x31632c[_0x1b7d('0xa1')]['lastIndexOf']('.')+0x1);if(_0x4f058a===_0x1b7d('0xa2')){_0x330f36[_0x1b7d('0xa3')](getSelectList(_0x122640,_0x1355d0,_0x32b91e,_0x2d37b6[_0x1b7d('0x99')],_0x31632c[_0x1b7d('0x99')],_0x328cf3));}}});return Promise[_0x1b7d('0xa4')](_0x330f36);})['then'](function(_0x34326d){_0x29bbd5=_0x34326d[0x0];var _0x4c6f22=[];var _0xe4d3e2=[];_0x56f0c2['forEach'](function(_0x49817f){if(!_[_0x1b7d('0xa5')](_0x49817f['@odata.type'])){var _0x2fb07a=_0x49817f['@odata.type'][_0x1b7d('0x42')](_0x49817f[_0x1b7d('0xa1')][_0x1b7d('0x43')]('.')+0x1);if(_0x2fb07a==='BooleanAttributeMetadata'){_0x4c6f22[_0x1b7d('0xa3')](getBooleanList(_0x122640,_0x1355d0,_0xe4d3e2,_0x2d37b6[_0x1b7d('0x99')],_0x49817f['MetadataId'],_0x328cf3));}}});return Promise['all'](_0x4c6f22);})[_0x1b7d('0xf')](function(_0x16bb02){_0x18173a=_0x16bb02[0x0];var _0x3e34fe=[];var _0x361681=[];_0x56f0c2[_0x1b7d('0xa0')](function(_0x29311e){if(_0x29311e[_0x1b7d('0xa1')]){var _0x46dc7c=_0x29311e['@odata.type'][_0x1b7d('0x42')](_0x29311e[_0x1b7d('0xa1')][_0x1b7d('0x43')]('.')+0x1);if(_0x46dc7c==='StringAttributeMetadata'||_0x46dc7c==='DoubleAttributeMetadata'||_0x46dc7c===_0x1b7d('0xa6')||_0x46dc7c===_0x1b7d('0xa7')||_0x46dc7c===_0x1b7d('0xa8')||_0x46dc7c===_0x1b7d('0xa9')||_0x46dc7c==='StatusAttributeMetadata'||_0x46dc7c===_0x1b7d('0xaa')||_0x46dc7c===_0x1b7d('0xab')||_0x46dc7c==='DecimalAttributeMetadata'){_0x3e34fe[_0x1b7d('0xa3')](getInputList(_0x122640,_0x1355d0,_0x46dc7c,_0x361681,_0x2d37b6[_0x1b7d('0x99')],_0x29311e[_0x1b7d('0x99')],_0x328cf3));}}});return Promise[_0x1b7d('0xa4')](_0x3e34fe);})[_0x1b7d('0xf')](function(_0x4ce2bd){_0x206d97=_0x4ce2bd[0x0];var _0x5d4e38=_0x29bbd5[_0x1b7d('0xac')](_0x18173a)[_0x1b7d('0xac')](_0x206d97);var _0x103505={'count':_0x5d4e38[_0x1b7d('0x20')],'rows':_0x5d4e38};return _0x103505;})[_0x1b7d('0xf')](respondWithResult(_0xedcbee,null))[_0x1b7d('0x2b')](function(_0xdbc1b6){var _0x4919ff=_0x46e1d0[_0x1b7d('0x1b')]['test']?0x1f4:_0xdbc1b6['statusCode']||0x1f4;logger[_0x1b7d('0xad')](_0xdbc1b6[_0x1b7d('0x11')]);delete _0xdbc1b6[_0x1b7d('0x12')];if(_0x4919ff===0x191){_0x4919ff=0x190;}_0xedcbee[_0x1b7d('0xc')](_0x4919ff)['send'](_0x46e1d0[_0x1b7d('0x1b')][_0x1b7d('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0xdbc1b6['statusCode']}:_0xdbc1b6);});};function getSelectList(_0x1601c9,_0x509a5a,_0x1a7910,_0x2e19f7,_0x2d0249,_0x1a03f8){var _0xa3ebce={'method':_0x1b7d('0xaf'),'uri':_0x1601c9+_0x1b7d('0x9a')+_0x2e19f7+_0x1b7d('0xb0')+_0x2d0249+_0x1b7d('0xb1')+_0x1b7d('0xb2'),'headers':{'Authorization':_0x1b7d('0x9c')+_0x1a03f8,'If-None-Match':null,'OData-Version':_0x1b7d('0x97')},'json':!![]};return rp(_0xa3ebce)[_0x1b7d('0xf')](function(_0x363dde){var _0x15c799=[];var _0x48f55e=_0x363dde[_0x1b7d('0xb3')][_0x1b7d('0xb4')];_0x48f55e[_0x1b7d('0xa0')](function(_0x1acaf0){_0x15c799[_0x1b7d('0xa3')]({'name':_0x1acaf0[_0x1b7d('0xb5')][_0x1b7d('0xb6')][_0x1b7d('0xb5')],'value':String(_0x1acaf0[_0x1b7d('0xb7')])});});var _0x31aa6f={'id':_0x509a5a+'_'+_0x363dde[_0x1b7d('0x9f')],'name':_0x363dde[_0x1b7d('0xb8')][_0x1b7d('0xb6')][_0x1b7d('0xb5')],'custom':![],'options':_0x15c799};_0x1a7910[_0x1b7d('0xa3')](_0x31aa6f);return _0x1a7910;});}function getBooleanList(_0x4d44a2,_0x58ed99,_0x31bf37,_0x44254c,_0x296843,_0x155052){var _0x1b506a={'method':'GET','uri':_0x4d44a2+_0x1b7d('0x9a')+_0x44254c+_0x1b7d('0xb0')+_0x296843+_0x1b7d('0xb9'),'headers':{'Authorization':_0x1b7d('0x9c')+_0x155052,'If-None-Match':null,'OData-Version':_0x1b7d('0x97')},'json':!![]};return rp(_0x1b506a)[_0x1b7d('0xf')](function(_0x52c3b2){var _0x467e6=[];_0x467e6[_0x1b7d('0xa3')]({'name':_0x52c3b2[_0x1b7d('0xb3')][_0x1b7d('0xba')]['Label']['UserLocalizedLabel'][_0x1b7d('0xb5')],'value':_0x1b7d('0xbb')},{'name':_0x52c3b2[_0x1b7d('0xb3')][_0x1b7d('0xbc')]['Label'][_0x1b7d('0xb6')][_0x1b7d('0xb5')],'value':_0x1b7d('0xbd')});var _0x532da2={'id':_0x58ed99+'_'+_0x52c3b2[_0x1b7d('0x9f')],'name':_0x52c3b2[_0x1b7d('0xb8')][_0x1b7d('0xb6')]['Label'],'custom':![],'options':_0x467e6};_0x31bf37[_0x1b7d('0xa3')](_0x532da2);return _0x31bf37;});}function getInputList(_0xb7fa6a,_0x2c1d6b,_0x3adcab,_0x6914bc,_0x2525cc,_0x6555ba,_0x2315e8){var _0x123578={'method':_0x1b7d('0xaf'),'uri':_0xb7fa6a+_0x1b7d('0x9a')+_0x2525cc+_0x1b7d('0xb0')+_0x6555ba+_0x1b7d('0xbe')+_0x3adcab+_0x1b7d('0xbf'),'headers':{'Authorization':_0x1b7d('0x9c')+_0x2315e8,'If-None-Match':null,'OData-Version':_0x1b7d('0x97')},'json':!![]};return rp(_0x123578)['then'](function(_0xdde5b){var _0x1024fe={'id':_0x2c1d6b+'_'+_0xdde5b[_0x1b7d('0x9f')],'name':_0xdde5b[_0x1b7d('0xb8')][_0x1b7d('0xb6')]?_0xdde5b[_0x1b7d('0xb8')][_0x1b7d('0xb6')]['Label']:_0xdde5b[_0x1b7d('0x9f')],'custom':![],'options':[]};_0x6914bc[_0x1b7d('0xa3')](_0x1024fe);return _0x6914bc;});} \ No newline at end of file +var _0xd920=['contactidyominame','contractdetailidname','contractidname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','username','password','clientId','CloudProvider','data5','data7','modernAuthentication','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','error','send','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','count','status','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','Dynamics365Account','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','Dynamics365Field','slice','substring','lastIndexOf','format','getFields','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits'];(function(_0x4a7c0c,_0x58b7aa){var _0x683f22=function(_0x473286){while(--_0x473286){_0x4a7c0c['push'](_0x4a7c0c['shift']());}};_0x683f22(++_0x58b7aa);}(_0xd920,0x1ee));var _0x0d92=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0xd920[_0x1e4a8e];return _0x5408f9;};'use strict';var rp=require('request-promise');var util=require(_0x0d92('0x0'));var _=require(_0x0d92('0x1'));var qs=require(_0x0d92('0x2'));var logger=require(_0x0d92('0x3'))(_0x0d92('0x4'));var db=require(_0x0d92('0x5'))['db'];var integrations=require(_0x0d92('0x6'));function respondWithResult(_0x2d3df4,_0x48c388){_0x48c388=_0x48c388||0xc8;return function(_0x2d7475){if(_0x2d7475){return _0x2d3df4['status'](_0x48c388)[_0x0d92('0x7')](_0x2d7475);}};}function respondWithFilteredResult(_0x3f3a84,_0x3f7b69){return function(_0x150f15){if(_0x150f15){var _0x178602=typeof _0x3f7b69[_0x0d92('0x8')]==='undefined'&&typeof _0x3f7b69['limit']===_0x0d92('0x9');var _0x85b97e=_0x150f15['count'];var _0x48d165=_0x178602?0x0:_0x3f7b69[_0x0d92('0x8')];var _0x2669b5=_0x178602?_0x150f15[_0x0d92('0xa')]:_0x3f7b69[_0x0d92('0x8')]+_0x3f7b69['limit'];var _0x509d5b;if(_0x2669b5>=_0x85b97e){_0x2669b5=_0x85b97e;_0x509d5b=0xc8;}else{_0x509d5b=0xce;}_0x3f3a84[_0x0d92('0xb')](_0x509d5b);return _0x3f3a84[_0x0d92('0xc')](_0x0d92('0xd'),_0x48d165+'-'+_0x2669b5+'/'+_0x85b97e)[_0x0d92('0x7')](_0x150f15);}return null;};}function saveUpdates(_0x25f377){return function(_0x108ec5){if(_0x108ec5){return _0x108ec5[_0x0d92('0xe')](_0x25f377)[_0x0d92('0xf')](function(_0x583581){return _0x583581;});}return null;};}function removeEntity(_0x4b5c4e){return function(_0x39d22e){if(_0x39d22e){return _0x39d22e[_0x0d92('0x10')]()[_0x0d92('0xf')](function(){_0x4b5c4e['status'](0xcc)[_0x0d92('0x11')]();});}};}function handleEntityNotFound(_0x25cad9){return function(_0x446618){if(!_0x446618){_0x25cad9[_0x0d92('0x12')](0x194);}return _0x446618;};}function handleError(_0x2486d8,_0x1aa8bf){_0x1aa8bf=_0x1aa8bf||0x1f4;return function(_0x43961f){logger['error'](_0x43961f[_0x0d92('0x13')]);if(_0x43961f[_0x0d92('0x14')]){delete _0x43961f[_0x0d92('0x14')];}_0x2486d8[_0x0d92('0xb')](_0x1aa8bf)['send'](_0x43961f);};}exports['index']=function(_0x3543f6,_0x53c1a0){var _0xea4fba={},_0x5e3296={},_0x11283e={'count':0x0,'rows':[]};var _0x384caf=_[_0x0d92('0x15')](db['Dynamics365Account'][_0x0d92('0x16')],function(_0x37638e){return{'name':_0x37638e[_0x0d92('0x17')],'type':_0x37638e[_0x0d92('0x18')][_0x0d92('0x19')]};});_0x5e3296[_0x0d92('0x1a')]=_[_0x0d92('0x15')](_0x384caf,_0x0d92('0x14'));_0x5e3296[_0x0d92('0x1b')]=_[_0x0d92('0x1c')](_0x3543f6[_0x0d92('0x1b')]);_0x5e3296[_0x0d92('0x1d')]=_[_0x0d92('0x1e')](_0x5e3296[_0x0d92('0x1a')],_0x5e3296[_0x0d92('0x1b')]);_0xea4fba['attributes']=_[_0x0d92('0x1e')](_0x5e3296[_0x0d92('0x1a')],qs[_0x0d92('0x1f')](_0x3543f6[_0x0d92('0x1b')][_0x0d92('0x1f')]));_0xea4fba['attributes']=_0xea4fba['attributes'][_0x0d92('0x20')]?_0xea4fba[_0x0d92('0x21')]:_0x5e3296['model'];if(!_0x3543f6[_0x0d92('0x1b')]['hasOwnProperty'](_0x0d92('0x22'))){_0xea4fba[_0x0d92('0x23')]=qs[_0x0d92('0x23')](_0x3543f6[_0x0d92('0x1b')][_0x0d92('0x23')]);_0xea4fba[_0x0d92('0x8')]=qs['offset'](_0x3543f6['query'][_0x0d92('0x8')]);}_0xea4fba['order']=qs[_0x0d92('0x24')](_0x3543f6['query'][_0x0d92('0x24')]);_0xea4fba[_0x0d92('0x25')]=qs['filters'](_[_0x0d92('0x26')](_0x3543f6[_0x0d92('0x1b')],_0x5e3296[_0x0d92('0x1d')]),_0x384caf);if(_0x3543f6[_0x0d92('0x1b')][_0x0d92('0x27')]){_0xea4fba[_0x0d92('0x25')]=_[_0x0d92('0x28')](_0xea4fba[_0x0d92('0x25')],{'$or':_[_0x0d92('0x15')](_0x384caf,function(_0x5eca38){if(_0x5eca38[_0x0d92('0x18')]!==_0x0d92('0x29')){var _0x2d2f4f={};_0x2d2f4f[_0x5eca38[_0x0d92('0x14')]]={'$like':'%'+_0x3543f6['query'][_0x0d92('0x27')]+'%'};return _0x2d2f4f;}})});}_0xea4fba=_[_0x0d92('0x28')]({},_0xea4fba,_0x3543f6['options']);var _0x46536={'where':_0xea4fba[_0x0d92('0x25')]};return db[_0x0d92('0x2a')][_0x0d92('0xa')](_0x46536)['then'](function(_0x5a0290){_0x11283e[_0x0d92('0xa')]=_0x5a0290;if(_0x3543f6[_0x0d92('0x1b')][_0x0d92('0x2b')]){_0xea4fba[_0x0d92('0x2c')]=[{'all':!![]}];}return db[_0x0d92('0x2a')][_0x0d92('0x2d')](_0xea4fba);})[_0x0d92('0xf')](function(_0x4cd4db){_0x11283e[_0x0d92('0x2e')]=_0x4cd4db;return _0x11283e;})[_0x0d92('0xf')](respondWithFilteredResult(_0x53c1a0,_0xea4fba))[_0x0d92('0x2f')](handleError(_0x53c1a0,null));};exports[_0x0d92('0x30')]=function(_0x38ab6d,_0x599523){var _0x2bec4b={'raw':![],'where':{'id':_0x38ab6d[_0x0d92('0x31')]['id']}},_0xe52432={};_0xe52432[_0x0d92('0x1a')]=_['keys'](db[_0x0d92('0x2a')][_0x0d92('0x16')]);_0xe52432[_0x0d92('0x1b')]=_[_0x0d92('0x1c')](_0x38ab6d[_0x0d92('0x1b')]);_0xe52432[_0x0d92('0x1d')]=_[_0x0d92('0x1e')](_0xe52432[_0x0d92('0x1a')],_0xe52432['query']);_0x2bec4b[_0x0d92('0x21')]=_['intersection'](_0xe52432[_0x0d92('0x1a')],qs[_0x0d92('0x1f')](_0x38ab6d[_0x0d92('0x1b')][_0x0d92('0x1f')]));_0x2bec4b[_0x0d92('0x21')]=_0x2bec4b[_0x0d92('0x21')][_0x0d92('0x20')]?_0x2bec4b['attributes']:_0xe52432[_0x0d92('0x1a')];if(_0x38ab6d[_0x0d92('0x1b')]['includeAll']){_0x2bec4b[_0x0d92('0x2c')]=[{'all':!![]}];}_0x2bec4b=_['merge']({},_0x2bec4b,_0x38ab6d[_0x0d92('0x32')]);return db['Dynamics365Account'][_0x0d92('0x33')](_0x2bec4b)[_0x0d92('0xf')](handleEntityNotFound(_0x599523,null))[_0x0d92('0xf')](respondWithResult(_0x599523,null))[_0x0d92('0x2f')](handleError(_0x599523,null));};exports['create']=function(_0x577af7,_0x448106){return db[_0x0d92('0x2a')][_0x0d92('0x34')](_0x577af7[_0x0d92('0x35')],{})[_0x0d92('0xf')](respondWithResult(_0x448106,0xc9))[_0x0d92('0x2f')](handleError(_0x448106,null));};exports[_0x0d92('0xe')]=function(_0x215e72,_0xdfe4fd){if(_0x215e72[_0x0d92('0x35')]['id']){delete _0x215e72['body']['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x215e72[_0x0d92('0x31')]['id']}})[_0x0d92('0xf')](handleEntityNotFound(_0xdfe4fd,null))[_0x0d92('0xf')](saveUpdates(_0x215e72[_0x0d92('0x35')],null))['then'](respondWithResult(_0xdfe4fd,null))[_0x0d92('0x2f')](handleError(_0xdfe4fd,null));};exports[_0x0d92('0x10')]=function(_0x524b4a,_0x4f9ab2){return db[_0x0d92('0x2a')][_0x0d92('0x33')]({'where':{'id':_0x524b4a[_0x0d92('0x31')]['id']}})[_0x0d92('0xf')](handleEntityNotFound(_0x4f9ab2,null))[_0x0d92('0xf')](removeEntity(_0x4f9ab2,null))[_0x0d92('0x2f')](handleError(_0x4f9ab2,null));};exports[_0x0d92('0x36')]=function(_0x5715da,_0x4a8ee9){var _0x4dedb7={};var _0x577ee4={};var _0x472c98;var _0x107969;return db[_0x0d92('0x2a')][_0x0d92('0x37')]({'where':{'id':_0x5715da['params']['id']}})[_0x0d92('0xf')](handleEntityNotFound(_0x4a8ee9,null))[_0x0d92('0xf')](function(_0x13dda7){if(_0x13dda7){_0x472c98=_0x13dda7;_0x577ee4[_0x0d92('0x1a')]=_[_0x0d92('0x1c')](db[_0x0d92('0x38')][_0x0d92('0x16')]);_0x577ee4[_0x0d92('0x1b')]=_[_0x0d92('0x1c')](_0x5715da['query']);_0x577ee4[_0x0d92('0x1d')]=_[_0x0d92('0x1e')](_0x577ee4['model'],_0x577ee4[_0x0d92('0x1b')]);_0x4dedb7[_0x0d92('0x21')]=_['intersection'](_0x577ee4[_0x0d92('0x1a')],qs[_0x0d92('0x1f')](_0x5715da[_0x0d92('0x1b')][_0x0d92('0x1f')]));_0x4dedb7[_0x0d92('0x21')]=_0x4dedb7[_0x0d92('0x21')][_0x0d92('0x20')]?_0x4dedb7[_0x0d92('0x21')]:_0x577ee4[_0x0d92('0x1a')];_0x4dedb7['order']=qs['sort'](_0x5715da[_0x0d92('0x1b')][_0x0d92('0x24')]);_0x4dedb7[_0x0d92('0x25')]=qs[_0x0d92('0x1d')](_[_0x0d92('0x26')](_0x5715da[_0x0d92('0x1b')],_0x577ee4[_0x0d92('0x1d')]));if(_0x5715da['query'][_0x0d92('0x27')]){_0x4dedb7[_0x0d92('0x25')]=_[_0x0d92('0x28')](_0x4dedb7[_0x0d92('0x25')],{'$or':_[_0x0d92('0x15')](_0x4dedb7['attributes'],function(_0x46954d){var _0x3ad8bf={};_0x3ad8bf[_0x46954d]={'$like':'%'+_0x5715da['query'][_0x0d92('0x27')]+'%'};return _0x3ad8bf;})});}_0x4dedb7=_[_0x0d92('0x28')]({},_0x4dedb7,_0x5715da[_0x0d92('0x32')]);return _0x472c98['getConfigurations'](_0x4dedb7);}})[_0x0d92('0xf')](function(_0x24ebd2){if(_0x24ebd2){_0x107969=_0x24ebd2['length'];if(!_0x5715da[_0x0d92('0x1b')]['hasOwnProperty'](_0x0d92('0x22'))){_0x4dedb7[_0x0d92('0x23')]=qs[_0x0d92('0x23')](_0x5715da['query'][_0x0d92('0x23')]);_0x4dedb7['offset']=qs[_0x0d92('0x8')](_0x5715da[_0x0d92('0x1b')][_0x0d92('0x8')]);}return _0x472c98[_0x0d92('0x36')](_0x4dedb7);}})['then'](function(_0x4eed0d){if(_0x4eed0d){return _0x4eed0d?{'count':_0x107969,'rows':_0x4eed0d}:null;}})[_0x0d92('0xf')](respondWithResult(_0x4a8ee9,null))[_0x0d92('0x2f')](handleError(_0x4a8ee9,null));};exports[_0x0d92('0x39')]=function(_0x1b0625,_0x411791){if(_0x1b0625[_0x0d92('0x35')]['id']){delete _0x1b0625[_0x0d92('0x35')]['id'];}return db[_0x0d92('0x2a')]['findOne']({'where':{'id':_0x1b0625[_0x0d92('0x31')]['id']}})[_0x0d92('0xf')](handleEntityNotFound(_0x411791,null))['then'](function(_0x466320){if(_0x466320){_0x1b0625['body'][_0x0d92('0x3a')]=_0x466320['id'];_0x1b0625[_0x0d92('0x35')][_0x0d92('0x3b')]=integrations[_0x0d92('0x3c')](_0x1b0625[_0x0d92('0x35')]['channel'],_0x1b0625[_0x0d92('0x35')][_0x0d92('0x18')]);_0x1b0625[_0x0d92('0x35')][_0x0d92('0x3d')]=integrations['getDescriptions'](_0x1b0625[_0x0d92('0x35')][_0x0d92('0x3e')],_0x1b0625['body'][_0x0d92('0x18')]);return db[_0x0d92('0x38')][_0x0d92('0x34')](_0x1b0625[_0x0d92('0x35')],{'include':[{'model':db[_0x0d92('0x3f')],'as':_0x0d92('0x3b')},{'model':db['Dynamics365Field'],'as':_0x0d92('0x3d')}]});}return null;})['then'](respondWithResult(_0x411791,null))[_0x0d92('0x2f')](handleError(_0x411791,null));};function sanitizeRemoteUri(_0x267afa){var _0x55ffab=_0x267afa[_0x0d92('0x40')](-0x1);if(_0x55ffab==='/')return _0x267afa[_0x0d92('0x41')](0x0,_0x267afa[_0x0d92('0x42')](_0x55ffab));return _0x267afa;}function getWebApiUrl(_0x3ad4e3){return util[_0x0d92('0x43')]('%s/api/data/v9.0/',_0x3ad4e3);}exports[_0x0d92('0x44')]=function(_0x32c9e5,_0x397d5c){var _0x141d1a=_0x32c9e5[_0x0d92('0x1b')]['ticketType'];var _0x12ee2b=_0x141d1a==='incident'?_0x0d92('0x45'):_0x0d92('0x46');var _0x10da0c='';var _0x2ed2b5='';var _0x7cf556='';var _0x580a8b='';var _0x35402c='';var _0x4ad750='';var _0x5cb993='';var _0x2e254d='';var _0x4eb72b=[_0x0d92('0x47'),_0x0d92('0x48'),_0x0d92('0x49'),_0x0d92('0x4a'),_0x0d92('0x4b'),'subject','phonenumber',_0x0d92('0x4c'),_0x0d92('0x4d'),'phonecall_activity_parties'];var _0x3f85f5=[_0x0d92('0x4e'),_0x0d92('0x4f'),_0x0d92('0x50'),_0x0d92('0x51'),'contactidname',_0x0d92('0x52'),_0x0d92('0x53'),_0x0d92('0x54'),'createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname',_0x0d92('0x55'),'createdon',_0x0d92('0x56'),_0x0d92('0x57'),_0x0d92('0x58'),_0x0d92('0x59'),_0x0d92('0x5a'),_0x0d92('0x5b'),_0x0d92('0x5c'),_0x0d92('0x5d'),_0x0d92('0x5e'),_0x0d92('0x5f'),'exchangerate',_0x0d92('0x60'),_0x0d92('0x61'),_0x0d92('0x62'),_0x0d92('0x63'),_0x0d92('0x64'),_0x0d92('0x65'),_0x0d92('0x66'),'modifiedbyexternalpartyname',_0x0d92('0x67'),_0x0d92('0x68'),_0x0d92('0x69'),_0x0d92('0x6a'),_0x0d92('0x6b'),'modifiedonbehalfbyyominame',_0x0d92('0x6c'),_0x0d92('0x6d'),_0x0d92('0x6e'),_0x0d92('0x6f'),'overriddencreatedon',_0x0d92('0x70'),'owneridtype',_0x0d92('0x71'),'parentcaseidname',_0x0d92('0x72'),_0x0d92('0x73'),_0x0d92('0x74'),_0x0d92('0x75'),_0x0d92('0x76'),_0x0d92('0x77'),_0x0d92('0x78'),_0x0d92('0x79'),_0x0d92('0x7a'),_0x0d92('0x7b'),_0x0d92('0x7c'),_0x0d92('0x7d'),_0x0d92('0x7e'),'socialprofileidname',_0x0d92('0x7f'),_0x0d92('0x80'),_0x0d92('0x81'),_0x0d92('0x82'),'timezoneruleversionnumber',_0x0d92('0x83'),_0x0d92('0x84'),_0x0d92('0x85'),'versionnumber'];var _0x27abb8=_0x4eb72b['concat'](_0x3f85f5);return db[_0x0d92('0x2a')][_0x0d92('0x37')]({'where':{'id':_0x32c9e5[_0x0d92('0x31')]['id']},'attributes':['id',_0x0d92('0x86'),_0x0d92('0x87'),'remoteUri','tenantId',_0x0d92('0x88'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0x0d92('0x89')],'as':_0x0d92('0x89'),'attributes':['id',_0x0d92('0x8a'),_0x0d92('0x8b')]}]})[_0x0d92('0xf')](handleEntityNotFound(_0x397d5c,null))[_0x0d92('0xf')](function(_0x378846){if(_0x378846){if(_0x378846[_0x0d92('0x8c')]){_0x378846[_0x0d92('0x8d')]=_0x378846[_0x0d92('0x89')]['data5'];_0x2e254d=sanitizeRemoteUri(_0x378846[_0x0d92('0x89')][_0x0d92('0x8b')]);_0x5cb993=getWebApiUrl(_0x2e254d);return _0x378846;}_0x2e254d=sanitizeRemoteUri(_0x378846['remoteUri']);_0x5cb993=getWebApiUrl(_0x2e254d);var _0x1fcce2={'method':_0x0d92('0x8e'),'uri':_0x0d92('0x8f')+_0x378846['tenantId']+_0x0d92('0x90'),'form':{'client_id':_0x378846[_0x0d92('0x88')],'resource':_0x2e254d,'username':_0x378846[_0x0d92('0x86')],'password':_0x378846[_0x0d92('0x87')],'grant_type':_0x0d92('0x87'),'client_secret':_0x378846[_0x0d92('0x91')]},'json':!![]};return rp(_0x1fcce2);}})[_0x0d92('0xf')](function(_0x231eb4){_0x4ad750=_0x231eb4[_0x0d92('0x8d')];var _0x5ddb82={'method':_0x0d92('0x92'),'uri':encodeURI(_0x5cb993+_0x0d92('0x93')+_0x12ee2b+'\x27'),'headers':{'Authorization':_0x0d92('0x94')+_0x4ad750,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5ddb82);})[_0x0d92('0xf')](function(_0x5a4938){var _0x53a802=_0x5a4938[_0x0d92('0x95')][0x0];var _0x26fc9d=_0x53a802[_0x0d92('0x96')];var _0x2ca616={'method':'GET','uri':_0x5cb993+_0x0d92('0x97')+_0x26fc9d+_0x0d92('0x98'),'headers':{'Authorization':_0x0d92('0x94')+_0x4ad750,'If-None-Match':null,'OData-Version':_0x0d92('0x99')},'json':!![]};return rp(_0x2ca616);})[_0x0d92('0xf')](function(_0x432342){_0x10da0c=_0x432342;_0x2ed2b5=_0x10da0c['Attributes'];_0x2ed2b5=_[_0x0d92('0x9a')](_0x2ed2b5,function(_0x3ac13d){return!_0x27abb8[_0x0d92('0x9b')](_0x3ac13d[_0x0d92('0x9c')]);});var _0x4f2da0=[];var _0x166840=[];_0x2ed2b5[_0x0d92('0x9d')](function(_0x87bb98){if(_0x87bb98['@odata.type']){var _0x1b3817=_0x87bb98[_0x0d92('0x9e')]['substring'](_0x87bb98[_0x0d92('0x9e')][_0x0d92('0x42')]('.')+0x1);if(_0x1b3817===_0x0d92('0x9f')){_0x4f2da0[_0x0d92('0xa0')](getSelectList(_0x5cb993,_0x141d1a,_0x166840,_0x10da0c[_0x0d92('0x96')],_0x87bb98[_0x0d92('0x96')],_0x4ad750));}}});return Promise[_0x0d92('0xa1')](_0x4f2da0);})[_0x0d92('0xf')](function(_0x5a8637){_0x7cf556=_0x5a8637[0x0];var _0x112deb=[];var _0x5160cc=[];_0x2ed2b5[_0x0d92('0x9d')](function(_0x40059d){if(!_['isNil'](_0x40059d[_0x0d92('0x9e')])){var _0x23e9f9=_0x40059d[_0x0d92('0x9e')][_0x0d92('0x41')](_0x40059d['@odata.type']['lastIndexOf']('.')+0x1);if(_0x23e9f9===_0x0d92('0xa2')){_0x112deb[_0x0d92('0xa0')](getBooleanList(_0x5cb993,_0x141d1a,_0x5160cc,_0x10da0c[_0x0d92('0x96')],_0x40059d[_0x0d92('0x96')],_0x4ad750));}}});return Promise[_0x0d92('0xa1')](_0x112deb);})[_0x0d92('0xf')](function(_0x2383de){_0x580a8b=_0x2383de[0x0];var _0x516817=[];var _0x515605=[];_0x2ed2b5['forEach'](function(_0x3e6952){if(_0x3e6952[_0x0d92('0x9e')]){var _0x5bbea7=_0x3e6952[_0x0d92('0x9e')][_0x0d92('0x41')](_0x3e6952[_0x0d92('0x9e')][_0x0d92('0x42')]('.')+0x1);if(_0x5bbea7===_0x0d92('0xa3')||_0x5bbea7===_0x0d92('0xa4')||_0x5bbea7===_0x0d92('0xa5')||_0x5bbea7===_0x0d92('0xa6')||_0x5bbea7===_0x0d92('0xa7')||_0x5bbea7===_0x0d92('0xa8')||_0x5bbea7===_0x0d92('0xa9')||_0x5bbea7===_0x0d92('0xaa')||_0x5bbea7===_0x0d92('0xab')||_0x5bbea7===_0x0d92('0xac')){_0x516817[_0x0d92('0xa0')](getInputList(_0x5cb993,_0x141d1a,_0x5bbea7,_0x515605,_0x10da0c[_0x0d92('0x96')],_0x3e6952[_0x0d92('0x96')],_0x4ad750));}}});return Promise[_0x0d92('0xa1')](_0x516817);})[_0x0d92('0xf')](function(_0x500061){_0x35402c=_0x500061[0x0];var _0x406524=_0x7cf556['concat'](_0x580a8b)[_0x0d92('0xad')](_0x35402c);var _0xd1747d={'count':_0x406524['length'],'rows':_0x406524};return _0xd1747d;})['then'](respondWithResult(_0x397d5c,null))[_0x0d92('0x2f')](function(_0x4af1e8){var _0x68fb34=_0x32c9e5[_0x0d92('0x1b')]['test']?0x1f4:_0x4af1e8[_0x0d92('0xae')]||0x1f4;logger[_0x0d92('0xaf')](_0x4af1e8[_0x0d92('0x13')]);delete _0x4af1e8[_0x0d92('0x14')];if(_0x68fb34===0x191){_0x68fb34=0x190;}_0x397d5c['status'](_0x68fb34)[_0x0d92('0xb0')](_0x32c9e5['query'][_0x0d92('0xb1')]?{'message':_0x0d92('0xb2'),'statusCode':_0x4af1e8[_0x0d92('0xae')]}:_0x4af1e8);});};function getSelectList(_0x51a5ab,_0x66bb6d,_0x467042,_0x2c102e,_0x3fedf9,_0x57abd3){var _0x1ac735={'method':_0x0d92('0x92'),'uri':_0x51a5ab+_0x0d92('0x97')+_0x2c102e+_0x0d92('0xb3')+_0x3fedf9+_0x0d92('0xb4')+_0x0d92('0xb5'),'headers':{'Authorization':_0x0d92('0x94')+_0x57abd3,'If-None-Match':null,'OData-Version':_0x0d92('0x99')},'json':!![]};return rp(_0x1ac735)[_0x0d92('0xf')](function(_0x121a10){var _0x8c48ab=[];var _0x131779=_0x121a10[_0x0d92('0xb6')][_0x0d92('0xb7')];_0x131779['forEach'](function(_0x5274a0){_0x8c48ab[_0x0d92('0xa0')]({'name':_0x5274a0[_0x0d92('0xb8')][_0x0d92('0xb9')]['Label'],'value':String(_0x5274a0['Value'])});});var _0xfb86f1={'id':_0x66bb6d+'_'+_0x121a10[_0x0d92('0x9c')],'name':_0x121a10[_0x0d92('0xba')][_0x0d92('0xb9')][_0x0d92('0xb8')],'custom':![],'options':_0x8c48ab};_0x467042[_0x0d92('0xa0')](_0xfb86f1);return _0x467042;});}function getBooleanList(_0x3f4219,_0x51731e,_0x158122,_0x417cc0,_0x5246ce,_0x1698da){var _0x31e698={'method':_0x0d92('0x92'),'uri':_0x3f4219+_0x0d92('0x97')+_0x417cc0+')/Attributes('+_0x5246ce+_0x0d92('0xbb'),'headers':{'Authorization':_0x0d92('0x94')+_0x1698da,'If-None-Match':null,'OData-Version':_0x0d92('0x99')},'json':!![]};return rp(_0x31e698)[_0x0d92('0xf')](function(_0x2d8523){var _0x256ad9=[];_0x256ad9[_0x0d92('0xa0')]({'name':_0x2d8523[_0x0d92('0xb6')][_0x0d92('0xbc')][_0x0d92('0xb8')][_0x0d92('0xb9')][_0x0d92('0xb8')],'value':_0x0d92('0xbd')},{'name':_0x2d8523['OptionSet']['FalseOption'][_0x0d92('0xb8')][_0x0d92('0xb9')]['Label'],'value':_0x0d92('0xbe')});var _0x4ac5f3={'id':_0x51731e+'_'+_0x2d8523[_0x0d92('0x9c')],'name':_0x2d8523[_0x0d92('0xba')]['UserLocalizedLabel'][_0x0d92('0xb8')],'custom':![],'options':_0x256ad9};_0x158122[_0x0d92('0xa0')](_0x4ac5f3);return _0x158122;});}function getInputList(_0x5dd6c9,_0x2b817b,_0xf9fc5d,_0x27ad6d,_0x2e1320,_0x3f28f3,_0x55553b){var _0x2d9ead={'method':_0x0d92('0x92'),'uri':_0x5dd6c9+_0x0d92('0x97')+_0x2e1320+_0x0d92('0xb3')+_0x3f28f3+_0x0d92('0xbf')+_0xf9fc5d+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x55553b,'If-None-Match':null,'OData-Version':_0x0d92('0x99')},'json':!![]};return rp(_0x2d9ead)[_0x0d92('0xf')](function(_0x37e2d9){var _0xfd5023={'id':_0x2b817b+'_'+_0x37e2d9[_0x0d92('0x9c')],'name':_0x37e2d9['DisplayName'][_0x0d92('0xb9')]?_0x37e2d9[_0x0d92('0xba')]['UserLocalizedLabel']['Label']:_0x37e2d9[_0x0d92('0x9c')],'custom':![],'options':[]};_0x27ad6d[_0x0d92('0xa0')](_0xfd5023);return _0x27ad6d;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 82d509f..06b5db9 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x58883c,_0x4d32b7){var _0x3bfbf7=function(_0x20462){while(--_0x20462){_0x58883c['push'](_0x58883c['shift']());}};_0x3bfbf7(++_0x4d32b7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x6eea52,_0x2ce9ba){var _0x33e609=function(_0x1d0667){while(--_0x1d0667){_0x6eea52['push'](_0x6eea52['shift']());}};_0x33e609(++_0x2ce9ba);}(_0xe706,0xa3));var _0x6e70=function(_0x14cb58,_0x214d62){_0x14cb58=_0x14cb58-0x0;var _0x5f097e=_0xe706[_0x14cb58];return _0x5f097e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 42fa750..2087a28 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 _0x0386=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDynamics365Account','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','Dynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0x22420f,_0x536255){var _0x4204b0=function(_0x4c3a14){while(--_0x4c3a14){_0x22420f['push'](_0x22420f['shift']());}};_0x4204b0(++_0x536255);}(_0x0386,0x1b7));var _0x6038=function(_0x1da5e9,_0x4f9a3a){_0x1da5e9=_0x1da5e9-0x0;var _0x1c62f8=_0x0386[_0x1da5e9];return _0x1c62f8;};'use strict';var _=require(_0x6038('0x0'));var util=require(_0x6038('0x1'));var moment=require(_0x6038('0x2'));var BPromise=require(_0x6038('0x3'));var rs=require(_0x6038('0x4'));var fs=require('fs');var Redis=require(_0x6038('0x5'));var db=require(_0x6038('0x6'))['db'];var utils=require(_0x6038('0x7'));var logger=require(_0x6038('0x8'))(_0x6038('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6038('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47b861,_0x54a2c3,_0x3a384d){return new BPromise(function(_0x57135b,_0x10d571){return client[_0x6038('0xb')](_0x47b861,_0x3a384d)[_0x6038('0xc')](function(_0x38ddac){logger[_0x6038('0xd')](_0x6038('0xe'),_0x54a2c3,_0x6038('0xf'));logger[_0x6038('0x10')](_0x6038('0x11'),_0x54a2c3,_0x6038('0xf'),JSON[_0x6038('0x12')](_0x38ddac));if(_0x38ddac[_0x6038('0x13')]){if(_0x38ddac[_0x6038('0x13')][_0x6038('0x14')]===0x1f4){logger[_0x6038('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x54a2c3,_0x38ddac[_0x6038('0x13')][_0x6038('0x15')]);return _0x10d571(_0x38ddac[_0x6038('0x13')][_0x6038('0x15')]);}logger['error'](_0x6038('0xe'),_0x54a2c3,_0x38ddac[_0x6038('0x13')][_0x6038('0x15')]);return _0x57135b(_0x38ddac[_0x6038('0x13')]['message']);}else{logger[_0x6038('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x54a2c3,_0x6038('0xf'));_0x57135b(_0x38ddac['result'][_0x6038('0x15')]);}})[_0x6038('0x16')](function(_0x250f46){logger[_0x6038('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x54a2c3,_0x250f46);_0x10d571(_0x250f46);});});}exports[_0x6038('0x17')]=function(_0x5745c3){var _0x458123=this;return new Promise(function(_0x3ff839,_0x3f08cf){return db['Dynamics365Account']['findAll']({'raw':_0x5745c3[_0x6038('0x18')]?_0x5745c3[_0x6038('0x18')][_0x6038('0x19')]===undefined?!![]:![]:!![],'where':_0x5745c3[_0x6038('0x18')]?_0x5745c3[_0x6038('0x18')][_0x6038('0x1a')]||null:null,'attributes':_0x5745c3['options']?_0x5745c3[_0x6038('0x18')][_0x6038('0x1b')]||null:null,'limit':_0x5745c3[_0x6038('0x18')]?_0x5745c3['options'][_0x6038('0x1c')]||null:null,'include':_0x5745c3['options']?_0x5745c3[_0x6038('0x18')][_0x6038('0x1d')]?_['map'](_0x5745c3['options']['include'],function(_0x4fae90){return{'model':db[_0x4fae90['model']],'as':_0x4fae90['as'],'attributes':_0x4fae90[_0x6038('0x1b')],'include':_0x4fae90[_0x6038('0x1d')]?_[_0x6038('0x1e')](_0x4fae90[_0x6038('0x1d')],function(_0x573215){return{'model':db[_0x573215['model']],'as':_0x573215['as'],'attributes':_0x573215[_0x6038('0x1b')],'include':_0x573215[_0x6038('0x1d')]?_['map'](_0x573215[_0x6038('0x1d')],function(_0xdd7637){return{'model':db[_0xdd7637[_0x6038('0x1f')]],'as':_0xdd7637['as'],'attributes':_0xdd7637['attributes']};}):[]};}):[]};}):[]:[]})[_0x6038('0xc')](function(_0x1f374c){logger[_0x6038('0xd')](_0x6038('0x17'),_0x5745c3);logger[_0x6038('0x10')](_0x6038('0x17'),_0x5745c3,JSON[_0x6038('0x12')](_0x1f374c));_0x3ff839(_0x1f374c);})[_0x6038('0x16')](function(_0xd31f23){logger[_0x6038('0x13')](_0x6038('0x17'),_0xd31f23['message'],_0x5745c3);_0x3f08cf(_0x458123[_0x6038('0x13')](0x1f4,_0xd31f23[_0x6038('0x15')]));});});};exports[_0x6038('0x20')]=function(_0x4d125d){var _0x248e22=this;return new Promise(function(_0x5a51bb,_0x33d97d){return db[_0x6038('0x21')][_0x6038('0x22')]({'raw':_0x4d125d[_0x6038('0x18')]?_0x4d125d['options'][_0x6038('0x19')]===undefined?!![]:![]:!![],'where':_0x4d125d[_0x6038('0x18')]?_0x4d125d[_0x6038('0x18')]['where']||null:null,'attributes':_0x4d125d['options']?_0x4d125d[_0x6038('0x18')][_0x6038('0x1b')]||null:null,'include':_0x4d125d[_0x6038('0x18')]?_0x4d125d['options'][_0x6038('0x1d')]?_[_0x6038('0x1e')](_0x4d125d[_0x6038('0x18')][_0x6038('0x1d')],function(_0x371da9){return{'model':db[_0x371da9[_0x6038('0x1f')]],'as':_0x371da9['as'],'attributes':_0x371da9[_0x6038('0x1b')],'include':_0x371da9['include']?_[_0x6038('0x1e')](_0x371da9[_0x6038('0x1d')],function(_0xa3d3bf){return{'model':db[_0xa3d3bf[_0x6038('0x1f')]],'as':_0xa3d3bf['as'],'attributes':_0xa3d3bf['attributes'],'include':_0xa3d3bf[_0x6038('0x1d')]?_['map'](_0xa3d3bf[_0x6038('0x1d')],function(_0x6c04d3){return{'model':db[_0x6c04d3[_0x6038('0x1f')]],'as':_0x6c04d3['as'],'attributes':_0x6c04d3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x244109){logger[_0x6038('0xd')](_0x6038('0x20'),_0x4d125d);logger[_0x6038('0x10')](_0x6038('0x20'),_0x4d125d,JSON[_0x6038('0x12')](_0x244109));_0x5a51bb(_0x244109);})[_0x6038('0x16')](function(_0x55846a){logger[_0x6038('0x13')](_0x6038('0x20'),_0x55846a['message'],_0x4d125d);_0x33d97d(_0x248e22[_0x6038('0x13')](0x1f4,_0x55846a[_0x6038('0x15')]));});});}; \ No newline at end of file +var _0x673f=['findAll','options','raw','attributes','limit','include','map','model','Dynamics365Account','find','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x673f,0x11b));var _0xf673=function(_0x1cd8a9,_0x52adaf){_0x1cd8a9=_0x1cd8a9-0x0;var _0x171bd1=_0x673f[_0x1cd8a9];return _0x171bd1;};'use strict';var _=require(_0xf673('0x0'));var util=require(_0xf673('0x1'));var moment=require(_0xf673('0x2'));var BPromise=require(_0xf673('0x3'));var rs=require(_0xf673('0x4'));var fs=require('fs');var Redis=require(_0xf673('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf673('0x6'))('rpc');var config=require(_0xf673('0x7'));var jayson=require(_0xf673('0x8'));var client=jayson[_0xf673('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x161e23,_0x3e61b0,_0x5300e8){return new BPromise(function(_0x48110e,_0xa01a75){return client['request'](_0x161e23,_0x5300e8)[_0xf673('0xa')](function(_0x394d7e){logger[_0xf673('0xb')](_0xf673('0xc'),_0x3e61b0,_0xf673('0xd'));logger[_0xf673('0xe')](_0xf673('0xf'),_0x3e61b0,_0xf673('0xd'),JSON[_0xf673('0x10')](_0x394d7e));if(_0x394d7e[_0xf673('0x11')]){if(_0x394d7e['error'][_0xf673('0x12')]===0x1f4){logger[_0xf673('0x11')](_0xf673('0xc'),_0x3e61b0,_0x394d7e['error'][_0xf673('0x13')]);return _0xa01a75(_0x394d7e[_0xf673('0x11')][_0xf673('0x13')]);}logger['error'](_0xf673('0xc'),_0x3e61b0,_0x394d7e['error'][_0xf673('0x13')]);return _0x48110e(_0x394d7e[_0xf673('0x11')][_0xf673('0x13')]);}else{logger[_0xf673('0xb')](_0xf673('0xc'),_0x3e61b0,'request\x20sent');_0x48110e(_0x394d7e[_0xf673('0x14')][_0xf673('0x13')]);}})[_0xf673('0x15')](function(_0x4aa212){logger[_0xf673('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x3e61b0,_0x4aa212);_0xa01a75(_0x4aa212);});});}exports[_0xf673('0x16')]=function(_0x56afe7){var _0x10e70d=this;return new Promise(function(_0x161924,_0x1a6464){return db['Dynamics365Account'][_0xf673('0x17')]({'raw':_0x56afe7[_0xf673('0x18')]?_0x56afe7[_0xf673('0x18')][_0xf673('0x19')]===undefined?!![]:![]:!![],'where':_0x56afe7[_0xf673('0x18')]?_0x56afe7[_0xf673('0x18')]['where']||null:null,'attributes':_0x56afe7[_0xf673('0x18')]?_0x56afe7['options'][_0xf673('0x1a')]||null:null,'limit':_0x56afe7[_0xf673('0x18')]?_0x56afe7[_0xf673('0x18')][_0xf673('0x1b')]||null:null,'include':_0x56afe7[_0xf673('0x18')]?_0x56afe7[_0xf673('0x18')][_0xf673('0x1c')]?_[_0xf673('0x1d')](_0x56afe7[_0xf673('0x18')]['include'],function(_0x51229f){return{'model':db[_0x51229f[_0xf673('0x1e')]],'as':_0x51229f['as'],'attributes':_0x51229f['attributes'],'include':_0x51229f[_0xf673('0x1c')]?_[_0xf673('0x1d')](_0x51229f['include'],function(_0x3a3610){return{'model':db[_0x3a3610[_0xf673('0x1e')]],'as':_0x3a3610['as'],'attributes':_0x3a3610['attributes'],'include':_0x3a3610['include']?_[_0xf673('0x1d')](_0x3a3610[_0xf673('0x1c')],function(_0x3e9b0e){return{'model':db[_0x3e9b0e[_0xf673('0x1e')]],'as':_0x3e9b0e['as'],'attributes':_0x3e9b0e[_0xf673('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf673('0xa')](function(_0x5037c8){logger[_0xf673('0xb')]('GetDynamics365Account',_0x56afe7);logger[_0xf673('0xe')](_0xf673('0x16'),_0x56afe7,JSON[_0xf673('0x10')](_0x5037c8));_0x161924(_0x5037c8);})[_0xf673('0x15')](function(_0x4ab7b3){logger[_0xf673('0x11')](_0xf673('0x16'),_0x4ab7b3[_0xf673('0x13')],_0x56afe7);_0x1a6464(_0x10e70d['error'](0x1f4,_0x4ab7b3[_0xf673('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x444c37){var _0x25368a=this;return new Promise(function(_0x505582,_0x29d29d){return db[_0xf673('0x1f')][_0xf673('0x20')]({'raw':_0x444c37[_0xf673('0x18')]?_0x444c37['options'][_0xf673('0x19')]===undefined?!![]:![]:!![],'where':_0x444c37[_0xf673('0x18')]?_0x444c37[_0xf673('0x18')]['where']||null:null,'attributes':_0x444c37[_0xf673('0x18')]?_0x444c37[_0xf673('0x18')][_0xf673('0x1a')]||null:null,'include':_0x444c37[_0xf673('0x18')]?_0x444c37[_0xf673('0x18')][_0xf673('0x1c')]?_[_0xf673('0x1d')](_0x444c37[_0xf673('0x18')]['include'],function(_0x1605ab){return{'model':db[_0x1605ab[_0xf673('0x1e')]],'as':_0x1605ab['as'],'attributes':_0x1605ab[_0xf673('0x1a')],'include':_0x1605ab['include']?_['map'](_0x1605ab['include'],function(_0xea213d){return{'model':db[_0xea213d['model']],'as':_0xea213d['as'],'attributes':_0xea213d[_0xf673('0x1a')],'include':_0xea213d[_0xf673('0x1c')]?_[_0xf673('0x1d')](_0xea213d['include'],function(_0x25cc50){return{'model':db[_0x25cc50['model']],'as':_0x25cc50['as'],'attributes':_0x25cc50['attributes']};}):[]};}):[]};}):[]:[]})[_0xf673('0xa')](function(_0x43f182){logger[_0xf673('0xb')](_0xf673('0x21'),_0x444c37);logger[_0xf673('0xe')](_0xf673('0x21'),_0x444c37,JSON[_0xf673('0x10')](_0x43f182));_0x505582(_0x43f182);})[_0xf673('0x15')](function(_0xd6ddfd){logger[_0xf673('0x11')](_0xf673('0x21'),_0xd6ddfd[_0xf673('0x13')],_0x444c37);_0x29d29d(_0x25368a[_0xf673('0x11')](0x1f4,_0xd6ddfd[_0xf673('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7a31a7a..745b275 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 _0x4965=['get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index'];(function(_0x2531f5,_0x3c2dc6){var _0x1923a9=function(_0x13fc09){while(--_0x13fc09){_0x2531f5['push'](_0x2531f5['shift']());}};_0x1923a9(++_0x3c2dc6);}(_0x4965,0x16e));var _0x5496=function(_0x572637,_0x216d95){_0x572637=_0x572637-0x0;var _0xb6748=_0x4965[_0x572637];return _0xb6748;};'use strict';var multer=require(_0x5496('0x0'));var util=require(_0x5496('0x1'));var path=require(_0x5496('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5496('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5496('0x4'));var config=require(_0x5496('0x5'));var controller=require(_0x5496('0x6'));router['get']('/',auth[_0x5496('0x7')](),controller[_0x5496('0x8')]);router[_0x5496('0x9')](_0x5496('0xa'),auth['isAuthenticated'](),controller[_0x5496('0xb')]);router['get'](_0x5496('0xc'),auth[_0x5496('0x7')](),controller[_0x5496('0xd')]);router['get'](_0x5496('0xe'),auth[_0x5496('0x7')](),controller[_0x5496('0xf')]);router[_0x5496('0x9')](_0x5496('0x10'),auth[_0x5496('0x7')](),controller[_0x5496('0x11')]);router[_0x5496('0x12')]('/',auth[_0x5496('0x7')](),controller[_0x5496('0x13')]);router[_0x5496('0x14')](_0x5496('0xa'),auth[_0x5496('0x7')](),controller[_0x5496('0x15')]);router[_0x5496('0x16')]('/:id',auth[_0x5496('0x7')](),controller[_0x5496('0x17')]);module[_0x5496('0x18')]=router; \ No newline at end of file +var _0x66b8=['post','create','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','show','/:id/fields','getFields','/:id/subjects','getDescriptions'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x66b8,0x8b));var _0x866b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x66b8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x866b('0x0'));var util=require('util');var path=require(_0x866b('0x1'));var timeout=require(_0x866b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x866b('0x3'));var auth=require(_0x866b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x866b('0x5'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x866b('0x6')](),controller['index']);router[_0x866b('0x7')]('/:id',auth[_0x866b('0x6')](),controller[_0x866b('0x8')]);router[_0x866b('0x7')](_0x866b('0x9'),auth[_0x866b('0x6')](),controller[_0x866b('0xa')]);router[_0x866b('0x7')](_0x866b('0xb'),auth[_0x866b('0x6')](),controller['getSubjects']);router[_0x866b('0x7')]('/:id/descriptions',auth[_0x866b('0x6')](),controller[_0x866b('0xc')]);router[_0x866b('0xd')]('/',auth[_0x866b('0x6')](),controller[_0x866b('0xe')]);router[_0x866b('0xf')](_0x866b('0x10'),auth[_0x866b('0x6')](),controller['update']);router['delete']('/:id',auth[_0x866b('0x6')](),controller[_0x866b('0x11')]);module[_0x866b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 5b8ca2a..3b9feb9 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 _0xab75=['nothing','BOOLEAN','STRING','ENUM','phonecall','incident'];(function(_0x43634a,_0x2a7f51){var _0x2aa5b4=function(_0x6f7a10){while(--_0x6f7a10){_0x43634a['push'](_0x43634a['shift']());}};_0x2aa5b4(++_0x2a7f51);}(_0xab75,0x80));var _0x5ab7=function(_0xdde962,_0xb1a8aa){_0xdde962=_0xdde962-0x0;var _0x44147f=_0xab75[_0xdde962];return _0x44147f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5ab7('0x0')]},'ticketType':{'type':Sequelize[_0x5ab7('0x1')]('incident',_0x5ab7('0x2')),'defaultValue':_0x5ab7('0x3')},'moduleCreate':{'type':Sequelize[_0x5ab7('0x1')]('contact',_0x5ab7('0x4')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5ab7('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5ab7('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0e4a=['STRING','ENUM','phonecall','incident','contact','sequelize','exports'];(function(_0x3967c9,_0x20446d){var _0x3fb498=function(_0x3769b5){while(--_0x3769b5){_0x3967c9['push'](_0x3967c9['shift']());}};_0x3fb498(++_0x20446d);}(_0x0e4a,0x132));var _0xa0e4=function(_0x3959d2,_0x43e00b){_0x3959d2=_0x3959d2-0x0;var _0x5a5e3d=_0x0e4a[_0x3959d2];return _0x5a5e3d;};'use strict';var Sequelize=require(_0xa0e4('0x0'));module[_0xa0e4('0x1')]={'name':{'type':Sequelize[_0xa0e4('0x2')]},'description':{'type':Sequelize[_0xa0e4('0x2')]},'ticketType':{'type':Sequelize[_0xa0e4('0x3')]('incident',_0xa0e4('0x4')),'defaultValue':_0xa0e4('0x5')},'moduleCreate':{'type':Sequelize[_0xa0e4('0x3')]('contact','nothing'),'defaultValue':_0xa0e4('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa0e4('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 1898b1b..311dfe3 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 _0xced9=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','destroy','then','end','error','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','Dynamics365Configuration','includeAll','include','findAll','catch','show','params','create','body','update','find','getFields','findOne','Dynamics365Field','nolimit','getSubjects','getDescriptions'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xced9,0x1ec));var _0x9ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9ced('0x0'));var jsonpatch=require(_0x9ced('0x1'));var rp=require(_0x9ced('0x2'));var moment=require(_0x9ced('0x3'));var BPromise=require(_0x9ced('0x4'));var Mustache=require(_0x9ced('0x5'));var util=require('util');var path=require(_0x9ced('0x6'));var sox=require(_0x9ced('0x7'));var csv=require('to-csv');var ejs=require(_0x9ced('0x8'));var fs=require('fs');var fs_extra=require(_0x9ced('0x9'));var _=require('lodash');var squel=require(_0x9ced('0xa'));var crypto=require('crypto');var jsforce=require(_0x9ced('0xb'));var deskjs=require(_0x9ced('0xc'));var toCsv=require(_0x9ced('0xd'));var querystring=require('querystring');var Papa=require(_0x9ced('0xe'));var Redis=require(_0x9ced('0xf'));var authService=require(_0x9ced('0x10'));var qs=require(_0x9ced('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ced('0x12'));var logger=require(_0x9ced('0x13'))('api');var utils=require(_0x9ced('0x14'));var config=require(_0x9ced('0x15'));var licenseUtil=require(_0x9ced('0x16'));var db=require(_0x9ced('0x17'))['db'];function respondWithStatusCode(_0xaacb0b,_0x55289f){_0x55289f=_0x55289f||0xcc;return function(_0x3836f8){if(_0x3836f8){return _0xaacb0b[_0x9ced('0x18')](_0x55289f);}return _0xaacb0b[_0x9ced('0x19')](_0x55289f)['end']();};}function respondWithResult(_0x5926d5,_0x5f9456){_0x5f9456=_0x5f9456||0xc8;return function(_0x12c6a6){if(_0x12c6a6){return _0x5926d5[_0x9ced('0x19')](_0x5f9456)[_0x9ced('0x1a')](_0x12c6a6);}};}function respondWithFilteredResult(_0xcec3e2,_0x40edad){return function(_0x2a05e0){if(_0x2a05e0){var _0x4d2c82=typeof _0x40edad['offset']===_0x9ced('0x1b')&&typeof _0x40edad['limit']===_0x9ced('0x1b');var _0x2aad4e=_0x2a05e0[_0x9ced('0x1c')];var _0x4a4621=_0x4d2c82?0x0:_0x40edad[_0x9ced('0x1d')];var _0x46db62=_0x4d2c82?_0x2a05e0[_0x9ced('0x1c')]:_0x40edad['offset']+_0x40edad[_0x9ced('0x1e')];var _0x489616;if(_0x46db62>=_0x2aad4e){_0x46db62=_0x2aad4e;_0x489616=0xc8;}else{_0x489616=0xce;}_0xcec3e2[_0x9ced('0x19')](_0x489616);return _0xcec3e2[_0x9ced('0x1f')](_0x9ced('0x20'),_0x4a4621+'-'+_0x46db62+'/'+_0x2aad4e)[_0x9ced('0x1a')](_0x2a05e0);}return null;};}function patchUpdates(_0x1f6bae){return function(_0x52db8c){try{jsonpatch[_0x9ced('0x21')](_0x52db8c,_0x1f6bae,!![]);}catch(_0x57563a){return BPromise[_0x9ced('0x22')](_0x57563a);}return _0x52db8c[_0x9ced('0x23')]();};}function saveUpdates(_0x4ea9ff,_0x2f545b){return function(_0x38d7d9){if(_0x38d7d9){return _0x38d7d9['update'](_0x4ea9ff)['then'](function(_0x33fcb2){return _0x33fcb2;});}return null;};}function removeEntity(_0x2a03ef,_0x2e04c4){return function(_0xdeb53e){if(_0xdeb53e){return _0xdeb53e[_0x9ced('0x24')]()[_0x9ced('0x25')](function(){_0x2a03ef[_0x9ced('0x19')](0xcc)[_0x9ced('0x26')]();});}};}function handleEntityNotFound(_0x241e7f,_0x33ce1f){return function(_0x383805){if(!_0x383805){_0x241e7f['sendStatus'](0x194);}return _0x383805;};}function handleError(_0x25f341,_0x42b63a){_0x42b63a=_0x42b63a||0x1f4;return function(_0x457314){logger[_0x9ced('0x27')](_0x457314['stack']);if(_0x457314[_0x9ced('0x28')]){delete _0x457314[_0x9ced('0x28')];}_0x25f341['status'](_0x42b63a)[_0x9ced('0x29')](_0x457314);};}exports[_0x9ced('0x2a')]=function(_0x4f8e31,_0x4efad7){var _0x4d859d={},_0xdd77e5={},_0x463ae3={'count':0x0,'rows':[]};var _0x4fe713=_['map'](db['Dynamics365Configuration'][_0x9ced('0x2b')],function(_0x53de22){return{'name':_0x53de22[_0x9ced('0x2c')],'type':_0x53de22[_0x9ced('0x2d')][_0x9ced('0x2e')]};});_0xdd77e5[_0x9ced('0x2f')]=_[_0x9ced('0x30')](_0x4fe713,'name');_0xdd77e5['query']=_[_0x9ced('0x31')](_0x4f8e31[_0x9ced('0x32')]);_0xdd77e5[_0x9ced('0x33')]=_[_0x9ced('0x34')](_0xdd77e5[_0x9ced('0x2f')],_0xdd77e5[_0x9ced('0x32')]);_0x4d859d[_0x9ced('0x35')]=_[_0x9ced('0x34')](_0xdd77e5['model'],qs['fields'](_0x4f8e31[_0x9ced('0x32')][_0x9ced('0x36')]));_0x4d859d[_0x9ced('0x35')]=_0x4d859d['attributes'][_0x9ced('0x37')]?_0x4d859d[_0x9ced('0x35')]:_0xdd77e5[_0x9ced('0x2f')];if(!_0x4f8e31[_0x9ced('0x32')][_0x9ced('0x38')]('nolimit')){_0x4d859d[_0x9ced('0x1e')]=qs[_0x9ced('0x1e')](_0x4f8e31[_0x9ced('0x32')][_0x9ced('0x1e')]);_0x4d859d[_0x9ced('0x1d')]=qs[_0x9ced('0x1d')](_0x4f8e31[_0x9ced('0x32')][_0x9ced('0x1d')]);}_0x4d859d[_0x9ced('0x39')]=qs['sort'](_0x4f8e31[_0x9ced('0x32')][_0x9ced('0x3a')]);_0x4d859d[_0x9ced('0x3b')]=qs['filters'](_[_0x9ced('0x3c')](_0x4f8e31['query'],_0xdd77e5['filters']),_0x4fe713);if(_0x4f8e31['query']['filter']){_0x4d859d['where']=_[_0x9ced('0x3d')](_0x4d859d[_0x9ced('0x3b')],{'$or':_[_0x9ced('0x30')](_0x4fe713,function(_0xcd9a05){if(_0xcd9a05['type']!==_0x9ced('0x3e')){var _0x553003={};_0x553003[_0xcd9a05['name']]={'$like':'%'+_0x4f8e31[_0x9ced('0x32')][_0x9ced('0x3f')]+'%'};return _0x553003;}})});}_0x4d859d=_[_0x9ced('0x3d')]({},_0x4d859d,_0x4f8e31[_0x9ced('0x40')]);var _0x38646e={'where':_0x4d859d['where']};return db[_0x9ced('0x41')][_0x9ced('0x1c')](_0x38646e)[_0x9ced('0x25')](function(_0x2c3919){_0x463ae3[_0x9ced('0x1c')]=_0x2c3919;if(_0x4f8e31[_0x9ced('0x32')][_0x9ced('0x42')]){_0x4d859d[_0x9ced('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x9ced('0x44')](_0x4d859d);})[_0x9ced('0x25')](function(_0x12e0b5){_0x463ae3['rows']=_0x12e0b5;return _0x463ae3;})['then'](respondWithFilteredResult(_0x4efad7,_0x4d859d))[_0x9ced('0x45')](handleError(_0x4efad7,null));};exports[_0x9ced('0x46')]=function(_0x4d3eb5,_0x4d30f0){var _0x23069={'raw':![],'where':{'id':_0x4d3eb5[_0x9ced('0x47')]['id']}},_0x10e25e={};_0x10e25e[_0x9ced('0x2f')]=_['keys'](db[_0x9ced('0x41')][_0x9ced('0x2b')]);_0x10e25e[_0x9ced('0x32')]=_[_0x9ced('0x31')](_0x4d3eb5[_0x9ced('0x32')]);_0x10e25e[_0x9ced('0x33')]=_[_0x9ced('0x34')](_0x10e25e[_0x9ced('0x2f')],_0x10e25e[_0x9ced('0x32')]);_0x23069[_0x9ced('0x35')]=_[_0x9ced('0x34')](_0x10e25e[_0x9ced('0x2f')],qs[_0x9ced('0x36')](_0x4d3eb5[_0x9ced('0x32')][_0x9ced('0x36')]));_0x23069[_0x9ced('0x35')]=_0x23069[_0x9ced('0x35')][_0x9ced('0x37')]?_0x23069[_0x9ced('0x35')]:_0x10e25e['model'];if(_0x4d3eb5['query'][_0x9ced('0x42')]){_0x23069[_0x9ced('0x43')]=[{'all':!![]}];}_0x23069=_[_0x9ced('0x3d')]({},_0x23069,_0x4d3eb5[_0x9ced('0x40')]);return db[_0x9ced('0x41')]['find'](_0x23069)[_0x9ced('0x25')](handleEntityNotFound(_0x4d30f0,null))['then'](respondWithResult(_0x4d30f0,null))[_0x9ced('0x45')](handleError(_0x4d30f0,null));};exports[_0x9ced('0x48')]=function(_0x25603d,_0x1ab4c8){return db[_0x9ced('0x41')][_0x9ced('0x48')](_0x25603d[_0x9ced('0x49')],{})['then'](respondWithResult(_0x1ab4c8,0xc9))['catch'](handleError(_0x1ab4c8,null));};exports[_0x9ced('0x4a')]=function(_0x5f265f,_0x509f02){if(_0x5f265f[_0x9ced('0x49')]['id']){delete _0x5f265f['body']['id'];}return db[_0x9ced('0x41')]['find']({'where':{'id':_0x5f265f['params']['id']}})['then'](handleEntityNotFound(_0x509f02,null))['then'](saveUpdates(_0x5f265f[_0x9ced('0x49')],null))[_0x9ced('0x25')](respondWithResult(_0x509f02,null))[_0x9ced('0x45')](handleError(_0x509f02,null));};exports[_0x9ced('0x24')]=function(_0x5b3451,_0x313467){return db[_0x9ced('0x41')][_0x9ced('0x4b')]({'where':{'id':_0x5b3451[_0x9ced('0x47')]['id']}})[_0x9ced('0x25')](handleEntityNotFound(_0x313467,null))[_0x9ced('0x25')](removeEntity(_0x313467,null))[_0x9ced('0x45')](handleError(_0x313467,null));};exports[_0x9ced('0x4c')]=function(_0x8db195,_0x643bee,_0x4c48d7){var _0x2d243c={};var _0x32c97f={};var _0x1261b3;var _0x1af818;return db[_0x9ced('0x41')][_0x9ced('0x4d')]({'where':{'id':_0x8db195[_0x9ced('0x47')]['id']}})['then'](handleEntityNotFound(_0x643bee,null))[_0x9ced('0x25')](function(_0xd1df88){if(_0xd1df88){_0x1261b3=_0xd1df88;_0x32c97f[_0x9ced('0x2f')]=_['keys'](db[_0x9ced('0x4e')][_0x9ced('0x2b')]);_0x32c97f['query']=_[_0x9ced('0x31')](_0x8db195[_0x9ced('0x32')]);_0x32c97f[_0x9ced('0x33')]=_[_0x9ced('0x34')](_0x32c97f[_0x9ced('0x2f')],_0x32c97f[_0x9ced('0x32')]);_0x2d243c[_0x9ced('0x35')]=_[_0x9ced('0x34')](_0x32c97f[_0x9ced('0x2f')],qs[_0x9ced('0x36')](_0x8db195['query'][_0x9ced('0x36')]));_0x2d243c[_0x9ced('0x35')]=_0x2d243c['attributes'][_0x9ced('0x37')]?_0x2d243c[_0x9ced('0x35')]:_0x32c97f[_0x9ced('0x2f')];_0x2d243c[_0x9ced('0x39')]=qs[_0x9ced('0x3a')](_0x8db195[_0x9ced('0x32')][_0x9ced('0x3a')]);_0x2d243c[_0x9ced('0x3b')]=qs[_0x9ced('0x33')](_['pick'](_0x8db195[_0x9ced('0x32')],_0x32c97f['filters']));if(_0x8db195[_0x9ced('0x32')][_0x9ced('0x3f')]){_0x2d243c[_0x9ced('0x3b')]=_['merge'](_0x2d243c[_0x9ced('0x3b')],{'$or':_['map'](_0x2d243c[_0x9ced('0x35')],function(_0x5dab9e){var _0x5b466d={};_0x5b466d[_0x5dab9e]={'$like':'%'+_0x8db195[_0x9ced('0x32')][_0x9ced('0x3f')]+'%'};return _0x5b466d;})});}_0x2d243c=_[_0x9ced('0x3d')]({},_0x2d243c,_0x8db195[_0x9ced('0x40')]);return _0x1261b3[_0x9ced('0x4c')](_0x2d243c);}})[_0x9ced('0x25')](function(_0x4f152a){if(_0x4f152a){_0x1af818=_0x4f152a['length'];if(!_0x8db195[_0x9ced('0x32')][_0x9ced('0x38')](_0x9ced('0x4f'))){_0x2d243c[_0x9ced('0x1e')]=qs[_0x9ced('0x1e')](_0x8db195[_0x9ced('0x32')][_0x9ced('0x1e')]);_0x2d243c[_0x9ced('0x1d')]=qs['offset'](_0x8db195[_0x9ced('0x32')][_0x9ced('0x1d')]);}return _0x1261b3[_0x9ced('0x4c')](_0x2d243c);}})['then'](function(_0x2a589d){if(_0x2a589d){return _0x2a589d?{'count':_0x1af818,'rows':_0x2a589d}:null;}})[_0x9ced('0x25')](respondWithResult(_0x643bee,null))[_0x9ced('0x45')](handleError(_0x643bee,null));};exports[_0x9ced('0x50')]=function(_0x1cc24d,_0x1980b2,_0x3a15f0){var _0x5c7056={};var _0x96f6d7={};var _0x32115f;var _0x5117da;return db[_0x9ced('0x41')][_0x9ced('0x4d')]({'where':{'id':_0x1cc24d[_0x9ced('0x47')]['id']}})[_0x9ced('0x25')](handleEntityNotFound(_0x1980b2,null))[_0x9ced('0x25')](function(_0x345b7d){if(_0x345b7d){_0x32115f=_0x345b7d;_0x96f6d7[_0x9ced('0x2f')]=_[_0x9ced('0x31')](db[_0x9ced('0x4e')][_0x9ced('0x2b')]);_0x96f6d7[_0x9ced('0x32')]=_['keys'](_0x1cc24d['query']);_0x96f6d7[_0x9ced('0x33')]=_['intersection'](_0x96f6d7['model'],_0x96f6d7[_0x9ced('0x32')]);_0x5c7056['attributes']=_[_0x9ced('0x34')](_0x96f6d7[_0x9ced('0x2f')],qs[_0x9ced('0x36')](_0x1cc24d[_0x9ced('0x32')]['fields']));_0x5c7056[_0x9ced('0x35')]=_0x5c7056[_0x9ced('0x35')]['length']?_0x5c7056[_0x9ced('0x35')]:_0x96f6d7[_0x9ced('0x2f')];_0x5c7056[_0x9ced('0x39')]=qs[_0x9ced('0x3a')](_0x1cc24d[_0x9ced('0x32')][_0x9ced('0x3a')]);_0x5c7056[_0x9ced('0x3b')]=qs[_0x9ced('0x33')](_[_0x9ced('0x3c')](_0x1cc24d[_0x9ced('0x32')],_0x96f6d7[_0x9ced('0x33')]));if(_0x1cc24d['query'][_0x9ced('0x3f')]){_0x5c7056[_0x9ced('0x3b')]=_[_0x9ced('0x3d')](_0x5c7056[_0x9ced('0x3b')],{'$or':_[_0x9ced('0x30')](_0x5c7056['attributes'],function(_0x554f17){var _0x36530b={};_0x36530b[_0x554f17]={'$like':'%'+_0x1cc24d[_0x9ced('0x32')][_0x9ced('0x3f')]+'%'};return _0x36530b;})});}_0x5c7056=_[_0x9ced('0x3d')]({},_0x5c7056,_0x1cc24d[_0x9ced('0x40')]);return _0x32115f[_0x9ced('0x50')](_0x5c7056);}})[_0x9ced('0x25')](function(_0x101908){if(_0x101908){_0x5117da=_0x101908[_0x9ced('0x37')];if(!_0x1cc24d[_0x9ced('0x32')][_0x9ced('0x38')](_0x9ced('0x4f'))){_0x5c7056[_0x9ced('0x1e')]=qs[_0x9ced('0x1e')](_0x1cc24d[_0x9ced('0x32')][_0x9ced('0x1e')]);_0x5c7056[_0x9ced('0x1d')]=qs[_0x9ced('0x1d')](_0x1cc24d['query'][_0x9ced('0x1d')]);}return _0x32115f[_0x9ced('0x50')](_0x5c7056);}})[_0x9ced('0x25')](function(_0x3c5edf){if(_0x3c5edf){return _0x3c5edf?{'count':_0x5117da,'rows':_0x3c5edf}:null;}})[_0x9ced('0x25')](respondWithResult(_0x1980b2,null))[_0x9ced('0x45')](handleError(_0x1980b2,null));};exports['getDescriptions']=function(_0x15f47f,_0x5acc7b,_0x42a6a2){var _0x573153={};var _0x3e45c2={};var _0x490b17;var _0x2f81b7;return db[_0x9ced('0x41')]['findOne']({'where':{'id':_0x15f47f[_0x9ced('0x47')]['id']}})[_0x9ced('0x25')](handleEntityNotFound(_0x5acc7b,null))[_0x9ced('0x25')](function(_0x5b099b){if(_0x5b099b){_0x490b17=_0x5b099b;_0x3e45c2['model']=_[_0x9ced('0x31')](db[_0x9ced('0x4e')][_0x9ced('0x2b')]);_0x3e45c2[_0x9ced('0x32')]=_[_0x9ced('0x31')](_0x15f47f[_0x9ced('0x32')]);_0x3e45c2[_0x9ced('0x33')]=_[_0x9ced('0x34')](_0x3e45c2[_0x9ced('0x2f')],_0x3e45c2['query']);_0x573153[_0x9ced('0x35')]=_[_0x9ced('0x34')](_0x3e45c2['model'],qs[_0x9ced('0x36')](_0x15f47f[_0x9ced('0x32')][_0x9ced('0x36')]));_0x573153[_0x9ced('0x35')]=_0x573153[_0x9ced('0x35')][_0x9ced('0x37')]?_0x573153[_0x9ced('0x35')]:_0x3e45c2['model'];_0x573153[_0x9ced('0x39')]=qs[_0x9ced('0x3a')](_0x15f47f[_0x9ced('0x32')][_0x9ced('0x3a')]);_0x573153[_0x9ced('0x3b')]=qs['filters'](_[_0x9ced('0x3c')](_0x15f47f[_0x9ced('0x32')],_0x3e45c2['filters']));if(_0x15f47f[_0x9ced('0x32')][_0x9ced('0x3f')]){_0x573153[_0x9ced('0x3b')]=_['merge'](_0x573153['where'],{'$or':_[_0x9ced('0x30')](_0x573153[_0x9ced('0x35')],function(_0x4c2c78){var _0x13dfd5={};_0x13dfd5[_0x4c2c78]={'$like':'%'+_0x15f47f[_0x9ced('0x32')][_0x9ced('0x3f')]+'%'};return _0x13dfd5;})});}_0x573153=_[_0x9ced('0x3d')]({},_0x573153,_0x15f47f[_0x9ced('0x40')]);return _0x490b17[_0x9ced('0x51')](_0x573153);}})[_0x9ced('0x25')](function(_0x568ca5){if(_0x568ca5){_0x2f81b7=_0x568ca5[_0x9ced('0x37')];if(!_0x15f47f['query'][_0x9ced('0x38')](_0x9ced('0x4f'))){_0x573153[_0x9ced('0x1e')]=qs['limit'](_0x15f47f[_0x9ced('0x32')][_0x9ced('0x1e')]);_0x573153['offset']=qs[_0x9ced('0x1d')](_0x15f47f[_0x9ced('0x32')][_0x9ced('0x1d')]);}return _0x490b17[_0x9ced('0x51')](_0x573153);}})[_0x9ced('0x25')](function(_0x120711){if(_0x120711){return _0x120711?{'count':_0x2f81b7,'rows':_0x120711}:null;}})[_0x9ced('0x25')](respondWithResult(_0x5acc7b,null))['catch'](handleError(_0x5acc7b,null));}; \ No newline at end of file +var _0xd548=['json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','map','Dynamics365Configuration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','getFields','findOne','Dynamics365Field','order','pick','nolimit','getSubjects','hasOwnProperty','getDescriptions','fast-json-patch','moment','bluebird','mustache','util','path','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','../../mysqldb','status','end'];(function(_0x55555f,_0x505b88){var _0x208602=function(_0x1cbc63){while(--_0x1cbc63){_0x55555f['push'](_0x55555f['shift']());}};_0x208602(++_0x505b88);}(_0xd548,0x89));var _0x8d54=function(_0x5c3277,_0x4dfd20){_0x5c3277=_0x5c3277-0x0;var _0x4ebd06=_0xd548[_0x5c3277];return _0x4ebd06;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8d54('0x0'));var rp=require('request-promise');var moment=require(_0x8d54('0x1'));var BPromise=require(_0x8d54('0x2'));var Mustache=require(_0x8d54('0x3'));var util=require(_0x8d54('0x4'));var path=require(_0x8d54('0x5'));var sox=require('sox');var csv=require(_0x8d54('0x6'));var ejs=require(_0x8d54('0x7'));var fs=require('fs');var fs_extra=require(_0x8d54('0x8'));var _=require(_0x8d54('0x9'));var squel=require('squel');var crypto=require(_0x8d54('0xa'));var jsforce=require(_0x8d54('0xb'));var deskjs=require(_0x8d54('0xc'));var toCsv=require(_0x8d54('0x6'));var querystring=require(_0x8d54('0xd'));var Papa=require(_0x8d54('0xe'));var Redis=require(_0x8d54('0xf'));var authService=require(_0x8d54('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8d54('0x11'));var hardwareService=require(_0x8d54('0x12'));var logger=require(_0x8d54('0x13'))(_0x8d54('0x14'));var utils=require(_0x8d54('0x15'));var config=require(_0x8d54('0x16'));var licenseUtil=require(_0x8d54('0x17'));var db=require(_0x8d54('0x18'))['db'];function respondWithStatusCode(_0x70fca,_0x59758a){_0x59758a=_0x59758a||0xcc;return function(_0x137a73){if(_0x137a73){return _0x70fca['sendStatus'](_0x59758a);}return _0x70fca[_0x8d54('0x19')](_0x59758a)[_0x8d54('0x1a')]();};}function respondWithResult(_0xd1c314,_0x3ec00a){_0x3ec00a=_0x3ec00a||0xc8;return function(_0x110066){if(_0x110066){return _0xd1c314[_0x8d54('0x19')](_0x3ec00a)[_0x8d54('0x1b')](_0x110066);}};}function respondWithFilteredResult(_0x2daecb,_0x387f22){return function(_0x5751fe){if(_0x5751fe){var _0xa145ba=typeof _0x387f22[_0x8d54('0x1c')]===_0x8d54('0x1d')&&typeof _0x387f22[_0x8d54('0x1e')]==='undefined';var _0x655182=_0x5751fe[_0x8d54('0x1f')];var _0x4bb173=_0xa145ba?0x0:_0x387f22['offset'];var _0x2c7ccd=_0xa145ba?_0x5751fe[_0x8d54('0x1f')]:_0x387f22['offset']+_0x387f22[_0x8d54('0x1e')];var _0x15e225;if(_0x2c7ccd>=_0x655182){_0x2c7ccd=_0x655182;_0x15e225=0xc8;}else{_0x15e225=0xce;}_0x2daecb['status'](_0x15e225);return _0x2daecb[_0x8d54('0x20')](_0x8d54('0x21'),_0x4bb173+'-'+_0x2c7ccd+'/'+_0x655182)[_0x8d54('0x1b')](_0x5751fe);}return null;};}function patchUpdates(_0x442154){return function(_0x1dbf43){try{jsonpatch['apply'](_0x1dbf43,_0x442154,!![]);}catch(_0x50a358){return BPromise[_0x8d54('0x22')](_0x50a358);}return _0x1dbf43[_0x8d54('0x23')]();};}function saveUpdates(_0x433a34,_0x53cc8f){return function(_0x3da1c9){if(_0x3da1c9){return _0x3da1c9['update'](_0x433a34)[_0x8d54('0x24')](function(_0x12432c){return _0x12432c;});}return null;};}function removeEntity(_0x294918,_0x54c2bd){return function(_0x3bacfe){if(_0x3bacfe){return _0x3bacfe[_0x8d54('0x25')]()[_0x8d54('0x24')](function(){_0x294918[_0x8d54('0x19')](0xcc)[_0x8d54('0x1a')]();});}};}function handleEntityNotFound(_0x5407c7,_0x241db1){return function(_0x20ea0a){if(!_0x20ea0a){_0x5407c7[_0x8d54('0x26')](0x194);}return _0x20ea0a;};}function handleError(_0x4eff2c,_0xc99b0){_0xc99b0=_0xc99b0||0x1f4;return function(_0x100573){logger[_0x8d54('0x27')](_0x100573[_0x8d54('0x28')]);if(_0x100573[_0x8d54('0x29')]){delete _0x100573[_0x8d54('0x29')];}_0x4eff2c[_0x8d54('0x19')](_0xc99b0)[_0x8d54('0x2a')](_0x100573);};}exports['index']=function(_0x2b8f00,_0x44c951){var _0x39cef2={},_0x5acd0e={},_0x23b3f6={'count':0x0,'rows':[]};var _0x9f996d=_[_0x8d54('0x2b')](db[_0x8d54('0x2c')]['rawAttributes'],function(_0x1368af){return{'name':_0x1368af[_0x8d54('0x2d')],'type':_0x1368af[_0x8d54('0x2e')]['key']};});_0x5acd0e[_0x8d54('0x2f')]=_[_0x8d54('0x2b')](_0x9f996d,'name');_0x5acd0e[_0x8d54('0x30')]=_[_0x8d54('0x31')](_0x2b8f00[_0x8d54('0x30')]);_0x5acd0e[_0x8d54('0x32')]=_[_0x8d54('0x33')](_0x5acd0e['model'],_0x5acd0e[_0x8d54('0x30')]);_0x39cef2[_0x8d54('0x34')]=_[_0x8d54('0x33')](_0x5acd0e[_0x8d54('0x2f')],qs[_0x8d54('0x35')](_0x2b8f00['query'][_0x8d54('0x35')]));_0x39cef2[_0x8d54('0x34')]=_0x39cef2[_0x8d54('0x34')][_0x8d54('0x36')]?_0x39cef2[_0x8d54('0x34')]:_0x5acd0e['model'];if(!_0x2b8f00[_0x8d54('0x30')]['hasOwnProperty']('nolimit')){_0x39cef2[_0x8d54('0x1e')]=qs['limit'](_0x2b8f00[_0x8d54('0x30')][_0x8d54('0x1e')]);_0x39cef2[_0x8d54('0x1c')]=qs[_0x8d54('0x1c')](_0x2b8f00['query'][_0x8d54('0x1c')]);}_0x39cef2['order']=qs[_0x8d54('0x37')](_0x2b8f00[_0x8d54('0x30')][_0x8d54('0x37')]);_0x39cef2[_0x8d54('0x38')]=qs[_0x8d54('0x32')](_['pick'](_0x2b8f00[_0x8d54('0x30')],_0x5acd0e[_0x8d54('0x32')]),_0x9f996d);if(_0x2b8f00[_0x8d54('0x30')][_0x8d54('0x39')]){_0x39cef2[_0x8d54('0x38')]=_[_0x8d54('0x3a')](_0x39cef2[_0x8d54('0x38')],{'$or':_[_0x8d54('0x2b')](_0x9f996d,function(_0x5eb111){if(_0x5eb111['type']!==_0x8d54('0x3b')){var _0xbca45d={};_0xbca45d[_0x5eb111[_0x8d54('0x29')]]={'$like':'%'+_0x2b8f00['query'][_0x8d54('0x39')]+'%'};return _0xbca45d;}})});}_0x39cef2=_[_0x8d54('0x3a')]({},_0x39cef2,_0x2b8f00[_0x8d54('0x3c')]);var _0x3b2042={'where':_0x39cef2[_0x8d54('0x38')]};return db[_0x8d54('0x2c')][_0x8d54('0x1f')](_0x3b2042)[_0x8d54('0x24')](function(_0x6c9942){_0x23b3f6['count']=_0x6c9942;if(_0x2b8f00[_0x8d54('0x30')][_0x8d54('0x3d')]){_0x39cef2[_0x8d54('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x8d54('0x3f')](_0x39cef2);})[_0x8d54('0x24')](function(_0x3540e1){_0x23b3f6[_0x8d54('0x40')]=_0x3540e1;return _0x23b3f6;})[_0x8d54('0x24')](respondWithFilteredResult(_0x44c951,_0x39cef2))[_0x8d54('0x41')](handleError(_0x44c951,null));};exports[_0x8d54('0x42')]=function(_0x226f92,_0x2ab309){var _0x14bfb9={'raw':![],'where':{'id':_0x226f92[_0x8d54('0x43')]['id']}},_0x2d8579={};_0x2d8579[_0x8d54('0x2f')]=_[_0x8d54('0x31')](db['Dynamics365Configuration'][_0x8d54('0x44')]);_0x2d8579[_0x8d54('0x30')]=_[_0x8d54('0x31')](_0x226f92['query']);_0x2d8579[_0x8d54('0x32')]=_[_0x8d54('0x33')](_0x2d8579[_0x8d54('0x2f')],_0x2d8579[_0x8d54('0x30')]);_0x14bfb9[_0x8d54('0x34')]=_[_0x8d54('0x33')](_0x2d8579[_0x8d54('0x2f')],qs[_0x8d54('0x35')](_0x226f92[_0x8d54('0x30')][_0x8d54('0x35')]));_0x14bfb9['attributes']=_0x14bfb9['attributes'][_0x8d54('0x36')]?_0x14bfb9['attributes']:_0x2d8579[_0x8d54('0x2f')];if(_0x226f92[_0x8d54('0x30')][_0x8d54('0x3d')]){_0x14bfb9[_0x8d54('0x3e')]=[{'all':!![]}];}_0x14bfb9=_['merge']({},_0x14bfb9,_0x226f92[_0x8d54('0x3c')]);return db['Dynamics365Configuration'][_0x8d54('0x45')](_0x14bfb9)[_0x8d54('0x24')](handleEntityNotFound(_0x2ab309,null))[_0x8d54('0x24')](respondWithResult(_0x2ab309,null))[_0x8d54('0x41')](handleError(_0x2ab309,null));};exports['create']=function(_0x518743,_0x50760e){return db[_0x8d54('0x2c')][_0x8d54('0x46')](_0x518743['body'],{})[_0x8d54('0x24')](respondWithResult(_0x50760e,0xc9))['catch'](handleError(_0x50760e,null));};exports[_0x8d54('0x47')]=function(_0x53ba63,_0x4c4dc9){if(_0x53ba63[_0x8d54('0x48')]['id']){delete _0x53ba63[_0x8d54('0x48')]['id'];}return db[_0x8d54('0x2c')][_0x8d54('0x45')]({'where':{'id':_0x53ba63[_0x8d54('0x43')]['id']}})[_0x8d54('0x24')](handleEntityNotFound(_0x4c4dc9,null))[_0x8d54('0x24')](saveUpdates(_0x53ba63[_0x8d54('0x48')],null))[_0x8d54('0x24')](respondWithResult(_0x4c4dc9,null))[_0x8d54('0x41')](handleError(_0x4c4dc9,null));};exports[_0x8d54('0x25')]=function(_0x4297b3,_0x420a2f){return db['Dynamics365Configuration'][_0x8d54('0x45')]({'where':{'id':_0x4297b3[_0x8d54('0x43')]['id']}})[_0x8d54('0x24')](handleEntityNotFound(_0x420a2f,null))['then'](removeEntity(_0x420a2f,null))['catch'](handleError(_0x420a2f,null));};exports[_0x8d54('0x49')]=function(_0x490231,_0x3f2add,_0x296d76){var _0x1f6d6e={};var _0x34fd92={};var _0x3a0842;var _0x2a5c66;return db['Dynamics365Configuration'][_0x8d54('0x4a')]({'where':{'id':_0x490231[_0x8d54('0x43')]['id']}})[_0x8d54('0x24')](handleEntityNotFound(_0x3f2add,null))[_0x8d54('0x24')](function(_0xbbe88c){if(_0xbbe88c){_0x3a0842=_0xbbe88c;_0x34fd92[_0x8d54('0x2f')]=_[_0x8d54('0x31')](db[_0x8d54('0x4b')][_0x8d54('0x44')]);_0x34fd92[_0x8d54('0x30')]=_[_0x8d54('0x31')](_0x490231['query']);_0x34fd92[_0x8d54('0x32')]=_[_0x8d54('0x33')](_0x34fd92[_0x8d54('0x2f')],_0x34fd92[_0x8d54('0x30')]);_0x1f6d6e['attributes']=_[_0x8d54('0x33')](_0x34fd92[_0x8d54('0x2f')],qs[_0x8d54('0x35')](_0x490231[_0x8d54('0x30')][_0x8d54('0x35')]));_0x1f6d6e[_0x8d54('0x34')]=_0x1f6d6e[_0x8d54('0x34')][_0x8d54('0x36')]?_0x1f6d6e['attributes']:_0x34fd92[_0x8d54('0x2f')];_0x1f6d6e[_0x8d54('0x4c')]=qs[_0x8d54('0x37')](_0x490231[_0x8d54('0x30')][_0x8d54('0x37')]);_0x1f6d6e[_0x8d54('0x38')]=qs[_0x8d54('0x32')](_[_0x8d54('0x4d')](_0x490231['query'],_0x34fd92['filters']));if(_0x490231[_0x8d54('0x30')][_0x8d54('0x39')]){_0x1f6d6e[_0x8d54('0x38')]=_[_0x8d54('0x3a')](_0x1f6d6e[_0x8d54('0x38')],{'$or':_[_0x8d54('0x2b')](_0x1f6d6e[_0x8d54('0x34')],function(_0x1e5d8b){var _0x48da64={};_0x48da64[_0x1e5d8b]={'$like':'%'+_0x490231[_0x8d54('0x30')]['filter']+'%'};return _0x48da64;})});}_0x1f6d6e=_[_0x8d54('0x3a')]({},_0x1f6d6e,_0x490231[_0x8d54('0x3c')]);return _0x3a0842[_0x8d54('0x49')](_0x1f6d6e);}})[_0x8d54('0x24')](function(_0x51431f){if(_0x51431f){_0x2a5c66=_0x51431f['length'];if(!_0x490231[_0x8d54('0x30')]['hasOwnProperty'](_0x8d54('0x4e'))){_0x1f6d6e['limit']=qs[_0x8d54('0x1e')](_0x490231['query'][_0x8d54('0x1e')]);_0x1f6d6e[_0x8d54('0x1c')]=qs[_0x8d54('0x1c')](_0x490231[_0x8d54('0x30')][_0x8d54('0x1c')]);}return _0x3a0842[_0x8d54('0x49')](_0x1f6d6e);}})[_0x8d54('0x24')](function(_0x20484d){if(_0x20484d){return _0x20484d?{'count':_0x2a5c66,'rows':_0x20484d}:null;}})[_0x8d54('0x24')](respondWithResult(_0x3f2add,null))[_0x8d54('0x41')](handleError(_0x3f2add,null));};exports[_0x8d54('0x4f')]=function(_0x62e7d4,_0xbea2e2,_0x1e2b58){var _0x1bf4d5={};var _0x30efb2={};var _0x3495bc;var _0x2286bc;return db[_0x8d54('0x2c')]['findOne']({'where':{'id':_0x62e7d4['params']['id']}})[_0x8d54('0x24')](handleEntityNotFound(_0xbea2e2,null))[_0x8d54('0x24')](function(_0x539dca){if(_0x539dca){_0x3495bc=_0x539dca;_0x30efb2[_0x8d54('0x2f')]=_[_0x8d54('0x31')](db[_0x8d54('0x4b')][_0x8d54('0x44')]);_0x30efb2[_0x8d54('0x30')]=_[_0x8d54('0x31')](_0x62e7d4[_0x8d54('0x30')]);_0x30efb2[_0x8d54('0x32')]=_[_0x8d54('0x33')](_0x30efb2[_0x8d54('0x2f')],_0x30efb2[_0x8d54('0x30')]);_0x1bf4d5[_0x8d54('0x34')]=_[_0x8d54('0x33')](_0x30efb2[_0x8d54('0x2f')],qs['fields'](_0x62e7d4[_0x8d54('0x30')][_0x8d54('0x35')]));_0x1bf4d5[_0x8d54('0x34')]=_0x1bf4d5[_0x8d54('0x34')][_0x8d54('0x36')]?_0x1bf4d5[_0x8d54('0x34')]:_0x30efb2[_0x8d54('0x2f')];_0x1bf4d5[_0x8d54('0x4c')]=qs[_0x8d54('0x37')](_0x62e7d4[_0x8d54('0x30')][_0x8d54('0x37')]);_0x1bf4d5[_0x8d54('0x38')]=qs[_0x8d54('0x32')](_[_0x8d54('0x4d')](_0x62e7d4['query'],_0x30efb2[_0x8d54('0x32')]));if(_0x62e7d4[_0x8d54('0x30')]['filter']){_0x1bf4d5['where']=_[_0x8d54('0x3a')](_0x1bf4d5['where'],{'$or':_[_0x8d54('0x2b')](_0x1bf4d5[_0x8d54('0x34')],function(_0x6535da){var _0x245e42={};_0x245e42[_0x6535da]={'$like':'%'+_0x62e7d4[_0x8d54('0x30')][_0x8d54('0x39')]+'%'};return _0x245e42;})});}_0x1bf4d5=_[_0x8d54('0x3a')]({},_0x1bf4d5,_0x62e7d4[_0x8d54('0x3c')]);return _0x3495bc['getSubjects'](_0x1bf4d5);}})[_0x8d54('0x24')](function(_0x438fd7){if(_0x438fd7){_0x2286bc=_0x438fd7['length'];if(!_0x62e7d4[_0x8d54('0x30')][_0x8d54('0x50')](_0x8d54('0x4e'))){_0x1bf4d5[_0x8d54('0x1e')]=qs[_0x8d54('0x1e')](_0x62e7d4[_0x8d54('0x30')][_0x8d54('0x1e')]);_0x1bf4d5[_0x8d54('0x1c')]=qs['offset'](_0x62e7d4[_0x8d54('0x30')][_0x8d54('0x1c')]);}return _0x3495bc[_0x8d54('0x4f')](_0x1bf4d5);}})['then'](function(_0x4dfa63){if(_0x4dfa63){return _0x4dfa63?{'count':_0x2286bc,'rows':_0x4dfa63}:null;}})[_0x8d54('0x24')](respondWithResult(_0xbea2e2,null))['catch'](handleError(_0xbea2e2,null));};exports[_0x8d54('0x51')]=function(_0x37b3c4,_0x98c77f,_0xafdd14){var _0x2790b8={};var _0x1db7e4={};var _0x3e860e;var _0x2066d7;return db[_0x8d54('0x2c')]['findOne']({'where':{'id':_0x37b3c4[_0x8d54('0x43')]['id']}})[_0x8d54('0x24')](handleEntityNotFound(_0x98c77f,null))['then'](function(_0x3183d6){if(_0x3183d6){_0x3e860e=_0x3183d6;_0x1db7e4[_0x8d54('0x2f')]=_[_0x8d54('0x31')](db[_0x8d54('0x4b')][_0x8d54('0x44')]);_0x1db7e4[_0x8d54('0x30')]=_[_0x8d54('0x31')](_0x37b3c4[_0x8d54('0x30')]);_0x1db7e4['filters']=_[_0x8d54('0x33')](_0x1db7e4[_0x8d54('0x2f')],_0x1db7e4[_0x8d54('0x30')]);_0x2790b8[_0x8d54('0x34')]=_[_0x8d54('0x33')](_0x1db7e4['model'],qs[_0x8d54('0x35')](_0x37b3c4[_0x8d54('0x30')][_0x8d54('0x35')]));_0x2790b8[_0x8d54('0x34')]=_0x2790b8[_0x8d54('0x34')][_0x8d54('0x36')]?_0x2790b8['attributes']:_0x1db7e4[_0x8d54('0x2f')];_0x2790b8[_0x8d54('0x4c')]=qs[_0x8d54('0x37')](_0x37b3c4[_0x8d54('0x30')][_0x8d54('0x37')]);_0x2790b8[_0x8d54('0x38')]=qs[_0x8d54('0x32')](_[_0x8d54('0x4d')](_0x37b3c4[_0x8d54('0x30')],_0x1db7e4['filters']));if(_0x37b3c4[_0x8d54('0x30')][_0x8d54('0x39')]){_0x2790b8[_0x8d54('0x38')]=_[_0x8d54('0x3a')](_0x2790b8[_0x8d54('0x38')],{'$or':_[_0x8d54('0x2b')](_0x2790b8[_0x8d54('0x34')],function(_0x41bbea){var _0x144cbc={};_0x144cbc[_0x41bbea]={'$like':'%'+_0x37b3c4[_0x8d54('0x30')][_0x8d54('0x39')]+'%'};return _0x144cbc;})});}_0x2790b8=_[_0x8d54('0x3a')]({},_0x2790b8,_0x37b3c4[_0x8d54('0x3c')]);return _0x3e860e[_0x8d54('0x51')](_0x2790b8);}})[_0x8d54('0x24')](function(_0x26c43a){if(_0x26c43a){_0x2066d7=_0x26c43a[_0x8d54('0x36')];if(!_0x37b3c4['query'][_0x8d54('0x50')](_0x8d54('0x4e'))){_0x2790b8['limit']=qs['limit'](_0x37b3c4[_0x8d54('0x30')]['limit']);_0x2790b8['offset']=qs[_0x8d54('0x1c')](_0x37b3c4['query']['offset']);}return _0x3e860e[_0x8d54('0x51')](_0x2790b8);}})[_0x8d54('0x24')](function(_0x288e43){if(_0x288e43){return _0x288e43?{'count':_0x2066d7,'rows':_0x288e43}:null;}})[_0x8d54('0x24')](respondWithResult(_0x98c77f,null))['catch'](handleError(_0x98c77f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a888cc9..340cb46 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x502cc4,_0x55af94){var _0x34d4fa=function(_0x24a415){while(--_0x24a415){_0x502cc4['push'](_0x502cc4['shift']());}};_0x34d4fa(++_0x55af94);}(_0x00bb,0x1d8));var _0xb00b=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x00bb[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1d562c,_0x399ad4){_0x1d562c=_0x1d562c-0x0;var _0x3a4f48=_0xe5b3[_0x1d562c];return _0x3a4f48;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x3e5b('0xc'),'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 1e55002..7604543 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 _0x5a95=['Dynamics365Configuration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1b09e8,_0x5c9627){var _0x158835=function(_0x5017ba){while(--_0x5017ba){_0x1b09e8['push'](_0x1b09e8['shift']());}};_0x158835(++_0x5c9627);}(_0x5a95,0xc5));var _0x55a9=function(_0x57be65,_0x1cac09){_0x57be65=_0x57be65-0x0;var _0x2149aa=_0x5a95[_0x57be65];return _0x2149aa;};'use strict';var _=require(_0x55a9('0x0'));var util=require(_0x55a9('0x1'));var moment=require(_0x55a9('0x2'));var BPromise=require(_0x55a9('0x3'));var rs=require(_0x55a9('0x4'));var fs=require('fs');var Redis=require(_0x55a9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x55a9('0x6'));var logger=require('../../config/logger')(_0x55a9('0x7'));var config=require(_0x55a9('0x8'));var jayson=require(_0x55a9('0x9'));var client=jayson[_0x55a9('0xa')][_0x55a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e7df2,_0x8187ad,_0x284992){return new BPromise(function(_0x55b62a,_0x3ced3c){return client[_0x55a9('0xc')](_0x1e7df2,_0x284992)[_0x55a9('0xd')](function(_0x31c843){logger[_0x55a9('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x8187ad,'request\x20sent');logger[_0x55a9('0xf')](_0x55a9('0x10'),_0x8187ad,'request\x20sent',JSON[_0x55a9('0x11')](_0x31c843));if(_0x31c843['error']){if(_0x31c843['error']['code']===0x1f4){logger[_0x55a9('0x12')](_0x55a9('0x13'),_0x8187ad,_0x31c843[_0x55a9('0x12')][_0x55a9('0x14')]);return _0x3ced3c(_0x31c843['error']['message']);}logger[_0x55a9('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x8187ad,_0x31c843[_0x55a9('0x12')]['message']);return _0x55b62a(_0x31c843['error']['message']);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x8187ad,_0x55a9('0x15'));_0x55b62a(_0x31c843[_0x55a9('0x16')][_0x55a9('0x14')]);}})[_0x55a9('0x17')](function(_0x15c38c){logger[_0x55a9('0x12')](_0x55a9('0x13'),_0x8187ad,_0x15c38c);_0x3ced3c(_0x15c38c);});});} \ No newline at end of file +var _0xfcfb=['jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4dbc5d,_0x2d0a51){var _0x45b461=function(_0x3e73ab){while(--_0x3e73ab){_0x4dbc5d['push'](_0x4dbc5d['shift']());}};_0x45b461(++_0x2d0a51);}(_0xfcfb,0x1a7));var _0xbfcf=function(_0x20cf0c,_0x14259b){_0x20cf0c=_0x20cf0c-0x0;var _0x4a5336=_0xfcfb[_0x20cf0c];return _0x4a5336;};'use strict';var _=require(_0xbfcf('0x0'));var util=require(_0xbfcf('0x1'));var moment=require(_0xbfcf('0x2'));var BPromise=require(_0xbfcf('0x3'));var rs=require(_0xbfcf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfcf('0x6'))(_0xbfcf('0x7'));var config=require(_0xbfcf('0x8'));var jayson=require(_0xbfcf('0x9'));var client=jayson[_0xbfcf('0xa')][_0xbfcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x281fd9,_0x1b3de4,_0x1f7390){return new BPromise(function(_0x399d14,_0x5a6f55){return client[_0xbfcf('0xc')](_0x281fd9,_0x1f7390)[_0xbfcf('0xd')](function(_0x3f0f59){logger['info'](_0xbfcf('0xe'),_0x1b3de4,_0xbfcf('0xf'));logger[_0xbfcf('0x10')](_0xbfcf('0x11'),_0x1b3de4,'request\x20sent',JSON['stringify'](_0x3f0f59));if(_0x3f0f59[_0xbfcf('0x12')]){if(_0x3f0f59[_0xbfcf('0x12')][_0xbfcf('0x13')]===0x1f4){logger[_0xbfcf('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1b3de4,_0x3f0f59[_0xbfcf('0x12')]['message']);return _0x5a6f55(_0x3f0f59[_0xbfcf('0x12')]['message']);}logger['error'](_0xbfcf('0xe'),_0x1b3de4,_0x3f0f59[_0xbfcf('0x12')][_0xbfcf('0x14')]);return _0x399d14(_0x3f0f59[_0xbfcf('0x12')][_0xbfcf('0x14')]);}else{logger[_0xbfcf('0x15')](_0xbfcf('0xe'),_0x1b3de4,_0xbfcf('0xf'));_0x399d14(_0x3f0f59[_0xbfcf('0x16')][_0xbfcf('0x14')]);}})[_0xbfcf('0x17')](function(_0x20abb3){logger[_0xbfcf('0x12')](_0xbfcf('0xe'),_0x1b3de4,_0x20abb3);_0x5a6f55(_0x20abb3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index cba42e6..edbf114 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 _0xdd7e=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','destroy'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xdd7e,0xab));var _0xedd7=function(_0xa46b2c,_0x2cb10f){_0xa46b2c=_0xa46b2c-0x0;var _0x2ba9f2=_0xdd7e[_0xa46b2c];return _0x2ba9f2;};'use strict';var multer=require(_0xedd7('0x0'));var util=require('util');var path=require(_0xedd7('0x1'));var timeout=require(_0xedd7('0x2'));var express=require(_0xedd7('0x3'));var router=express[_0xedd7('0x4')]();var fs_extra=require(_0xedd7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xedd7('0x6'));var controller=require('./intDynamics365Field.controller');router[_0xedd7('0x7')]('/',auth[_0xedd7('0x8')](),controller[_0xedd7('0x9')]);router['get'](_0xedd7('0xa'),auth[_0xedd7('0x8')](),controller[_0xedd7('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xedd7('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xedd7('0xd')]);router[_0xedd7('0xe')](_0xedd7('0xa'),auth[_0xedd7('0x8')](),controller[_0xedd7('0xf')]);module[_0xedd7('0x10')]=router; \ No newline at end of file +var _0x8c44=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x16abf7,_0x2c36e1){var _0x2abb12=function(_0x2b5ed5){while(--_0x2b5ed5){_0x16abf7['push'](_0x16abf7['shift']());}};_0x2abb12(++_0x2c36e1);}(_0x8c44,0xa3));var _0x48c4=function(_0x366e97,_0x2fed1f){_0x366e97=_0x366e97-0x0;var _0x152090=_0x8c44[_0x366e97];return _0x152090;};'use strict';var multer=require(_0x48c4('0x0'));var util=require('util');var path=require(_0x48c4('0x1'));var timeout=require(_0x48c4('0x2'));var express=require(_0x48c4('0x3'));var router=express[_0x48c4('0x4')]();var fs_extra=require(_0x48c4('0x5'));var auth=require(_0x48c4('0x6'));var interaction=require(_0x48c4('0x7'));var config=require(_0x48c4('0x8'));var controller=require(_0x48c4('0x9'));router[_0x48c4('0xa')]('/',auth[_0x48c4('0xb')](),controller[_0x48c4('0xc')]);router[_0x48c4('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x48c4('0xd')]);router[_0x48c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x48c4('0xf')]);router[_0x48c4('0x10')](_0x48c4('0x11'),auth[_0x48c4('0xb')](),controller[_0x48c4('0x12')]);router[_0x48c4('0x13')](_0x48c4('0x11'),auth[_0x48c4('0xb')](),controller['destroy']);module[_0x48c4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 17cf744..5380e59 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 _0x6f79=['BOOLEAN','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x13c98c,_0x430dd9){var _0x55a570=function(_0x4dbda4){while(--_0x4dbda4){_0x13c98c['push'](_0x13c98c['shift']());}};_0x55a570(++_0x430dd9);}(_0x6f79,0x64));var _0x96f7=function(_0x2ac1d7,_0x1c4897){_0x2ac1d7=_0x2ac1d7-0x0;var _0x241dcd=_0x6f79[_0x2ac1d7];return _0x241dcd;};'use strict';var Sequelize=require('sequelize');module[_0x96f7('0x0')]={'type':{'type':Sequelize['ENUM'](_0x96f7('0x1'),_0x96f7('0x2'),_0x96f7('0x3'),_0x96f7('0x4'),_0x96f7('0x5')),'defaultValue':_0x96f7('0x1')},'content':{'type':Sequelize[_0x96f7('0x6')]},'key':{'type':Sequelize[_0x96f7('0x6')]},'keyType':{'type':Sequelize[_0x96f7('0x7')]('string','variable',_0x96f7('0x3'))},'keyContent':{'type':Sequelize[_0x96f7('0x6')]},'idField':{'type':Sequelize[_0x96f7('0x6')]},'nameField':{'type':Sequelize[_0x96f7('0x6')]},'customField':{'type':Sequelize[_0x96f7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x96f7('0x6')]}}; \ No newline at end of file +var _0xcf21=['customVariable','keyValue','picklist','STRING','exports','ENUM','string','variable'];(function(_0x2ad02c,_0x10335e){var _0x56bb94=function(_0x56273e){while(--_0x56273e){_0x2ad02c['push'](_0x2ad02c['shift']());}};_0x56bb94(++_0x10335e);}(_0xcf21,0xec));var _0x1cf2=function(_0x281811,_0x54c652){_0x281811=_0x281811-0x0;var _0x30c8bf=_0xcf21[_0x281811];return _0x30c8bf;};'use strict';var Sequelize=require('sequelize');module[_0x1cf2('0x0')]={'type':{'type':Sequelize[_0x1cf2('0x1')](_0x1cf2('0x2'),_0x1cf2('0x3'),_0x1cf2('0x4'),_0x1cf2('0x5'),_0x1cf2('0x6')),'defaultValue':_0x1cf2('0x2')},'content':{'type':Sequelize[_0x1cf2('0x7')]},'key':{'type':Sequelize[_0x1cf2('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x1cf2('0x2'),_0x1cf2('0x3'),_0x1cf2('0x4'))},'keyContent':{'type':Sequelize[_0x1cf2('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1cf2('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1cf2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index a25aa94..5a48bdf 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 _0xaaed=['send','index','map','Dynamics365Field','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','params','rawAttributes','includeAll','catch','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','then','sendStatus','error','stack','name'];(function(_0x35c310,_0x4ec418){var _0x238c0f=function(_0x639139){while(--_0x639139){_0x35c310['push'](_0x35c310['shift']());}};_0x238c0f(++_0x4ec418);}(_0xaaed,0x1ec));var _0xdaae=function(_0x2d6a05,_0x50706d){_0x2d6a05=_0x2d6a05-0x0;var _0x3f24dd=_0xaaed[_0x2d6a05];return _0x3f24dd;};'use strict';var emlformat=require(_0xdaae('0x0'));var rimraf=require(_0xdaae('0x1'));var zipdir=require(_0xdaae('0x2'));var jsonpatch=require(_0xdaae('0x3'));var rp=require(_0xdaae('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdaae('0x5'));var util=require('util');var path=require(_0xdaae('0x6'));var sox=require(_0xdaae('0x7'));var csv=require(_0xdaae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdaae('0x9'));var _=require(_0xdaae('0xa'));var squel=require(_0xdaae('0xb'));var crypto=require(_0xdaae('0xc'));var jsforce=require(_0xdaae('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdaae('0x8'));var querystring=require(_0xdaae('0xe'));var Papa=require(_0xdaae('0xf'));var Redis=require(_0xdaae('0x10'));var authService=require(_0xdaae('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdaae('0x12'));var hardwareService=require(_0xdaae('0x13'));var logger=require(_0xdaae('0x14'))(_0xdaae('0x15'));var utils=require(_0xdaae('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdaae('0x17'));var db=require(_0xdaae('0x18'))['db'];function respondWithStatusCode(_0x311f42,_0x370869){_0x370869=_0x370869||0xcc;return function(_0x2256a1){if(_0x2256a1){return _0x311f42['sendStatus'](_0x370869);}return _0x311f42[_0xdaae('0x19')](_0x370869)[_0xdaae('0x1a')]();};}function respondWithResult(_0x3b4d57,_0x357733){_0x357733=_0x357733||0xc8;return function(_0x266f48){if(_0x266f48){return _0x3b4d57[_0xdaae('0x19')](_0x357733)[_0xdaae('0x1b')](_0x266f48);}};}function respondWithFilteredResult(_0x2847b4,_0x3905bb){return function(_0x4fb6c8){if(_0x4fb6c8){var _0x5563c0=typeof _0x3905bb[_0xdaae('0x1c')]===_0xdaae('0x1d')&&typeof _0x3905bb[_0xdaae('0x1e')]===_0xdaae('0x1d');var _0x4aca56=_0x4fb6c8[_0xdaae('0x1f')];var _0x39843d=_0x5563c0?0x0:_0x3905bb[_0xdaae('0x1c')];var _0xc23aa0=_0x5563c0?_0x4fb6c8[_0xdaae('0x1f')]:_0x3905bb[_0xdaae('0x1c')]+_0x3905bb[_0xdaae('0x1e')];var _0x3b0c35;if(_0xc23aa0>=_0x4aca56){_0xc23aa0=_0x4aca56;_0x3b0c35=0xc8;}else{_0x3b0c35=0xce;}_0x2847b4[_0xdaae('0x19')](_0x3b0c35);return _0x2847b4[_0xdaae('0x20')]('Content-Range',_0x39843d+'-'+_0xc23aa0+'/'+_0x4aca56)[_0xdaae('0x1b')](_0x4fb6c8);}return null;};}function patchUpdates(_0x5e641a){return function(_0x176c29){try{jsonpatch[_0xdaae('0x21')](_0x176c29,_0x5e641a,!![]);}catch(_0x1aea0d){return BPromise[_0xdaae('0x22')](_0x1aea0d);}return _0x176c29['save']();};}function saveUpdates(_0x158fc5,_0x136bba){return function(_0x20a412){if(_0x20a412){return _0x20a412['update'](_0x158fc5)[_0xdaae('0x23')](function(_0x46ffde){return _0x46ffde;});}return null;};}function removeEntity(_0x215096,_0x188372){return function(_0x4df8e7){if(_0x4df8e7){return _0x4df8e7['destroy']()['then'](function(){_0x215096[_0xdaae('0x19')](0xcc)[_0xdaae('0x1a')]();});}};}function handleEntityNotFound(_0x4b9cbc,_0x5c70be){return function(_0x470646){if(!_0x470646){_0x4b9cbc[_0xdaae('0x24')](0x194);}return _0x470646;};}function handleError(_0x56328d,_0x249d23){_0x249d23=_0x249d23||0x1f4;return function(_0x85ca0){logger[_0xdaae('0x25')](_0x85ca0[_0xdaae('0x26')]);if(_0x85ca0['name']){delete _0x85ca0[_0xdaae('0x27')];}_0x56328d[_0xdaae('0x19')](_0x249d23)[_0xdaae('0x28')](_0x85ca0);};}exports[_0xdaae('0x29')]=function(_0x5c44fd,_0xcad218){var _0x40175d={},_0xcbdbe7={},_0x15ec73={'count':0x0,'rows':[]};var _0x13add9=_[_0xdaae('0x2a')](db[_0xdaae('0x2b')]['rawAttributes'],function(_0x68c9fc){return{'name':_0x68c9fc[_0xdaae('0x2c')],'type':_0x68c9fc[_0xdaae('0x2d')][_0xdaae('0x2e')]};});_0xcbdbe7[_0xdaae('0x2f')]=_[_0xdaae('0x2a')](_0x13add9,'name');_0xcbdbe7['query']=_[_0xdaae('0x30')](_0x5c44fd[_0xdaae('0x31')]);_0xcbdbe7['filters']=_[_0xdaae('0x32')](_0xcbdbe7[_0xdaae('0x2f')],_0xcbdbe7[_0xdaae('0x31')]);_0x40175d[_0xdaae('0x33')]=_[_0xdaae('0x32')](_0xcbdbe7[_0xdaae('0x2f')],qs[_0xdaae('0x34')](_0x5c44fd[_0xdaae('0x31')][_0xdaae('0x34')]));_0x40175d[_0xdaae('0x33')]=_0x40175d[_0xdaae('0x33')][_0xdaae('0x35')]?_0x40175d['attributes']:_0xcbdbe7['model'];if(!_0x5c44fd['query'][_0xdaae('0x36')]('nolimit')){_0x40175d[_0xdaae('0x1e')]=qs[_0xdaae('0x1e')](_0x5c44fd[_0xdaae('0x31')][_0xdaae('0x1e')]);_0x40175d[_0xdaae('0x1c')]=qs['offset'](_0x5c44fd[_0xdaae('0x31')][_0xdaae('0x1c')]);}_0x40175d[_0xdaae('0x37')]=qs[_0xdaae('0x38')](_0x5c44fd[_0xdaae('0x31')][_0xdaae('0x38')]);_0x40175d[_0xdaae('0x39')]=qs[_0xdaae('0x3a')](_[_0xdaae('0x3b')](_0x5c44fd[_0xdaae('0x31')],_0xcbdbe7['filters']),_0x13add9);if(_0x5c44fd[_0xdaae('0x31')]['filter']){_0x40175d[_0xdaae('0x39')]=_[_0xdaae('0x3c')](_0x40175d[_0xdaae('0x39')],{'$or':_['map'](_0x13add9,function(_0x138482){if(_0x138482[_0xdaae('0x2d')]!==_0xdaae('0x3d')){var _0x225f5d={};_0x225f5d[_0x138482[_0xdaae('0x27')]]={'$like':'%'+_0x5c44fd['query'][_0xdaae('0x3e')]+'%'};return _0x225f5d;}})});}_0x40175d=_[_0xdaae('0x3c')]({},_0x40175d,_0x5c44fd[_0xdaae('0x3f')]);var _0x13575c={'where':_0x40175d[_0xdaae('0x39')]};return db[_0xdaae('0x2b')][_0xdaae('0x1f')](_0x13575c)[_0xdaae('0x23')](function(_0x3f666c){_0x15ec73[_0xdaae('0x1f')]=_0x3f666c;if(_0x5c44fd['query']['includeAll']){_0x40175d[_0xdaae('0x40')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xdaae('0x41')](_0x40175d);})[_0xdaae('0x23')](function(_0x125603){_0x15ec73[_0xdaae('0x42')]=_0x125603;return _0x15ec73;})[_0xdaae('0x23')](respondWithFilteredResult(_0xcad218,_0x40175d))['catch'](handleError(_0xcad218,null));};exports['show']=function(_0x2b869e,_0x1605d3){var _0x357868={'raw':!![],'where':{'id':_0x2b869e[_0xdaae('0x43')]['id']}},_0x396e3e={};_0x396e3e[_0xdaae('0x2f')]=_[_0xdaae('0x30')](db['Dynamics365Field'][_0xdaae('0x44')]);_0x396e3e[_0xdaae('0x31')]=_[_0xdaae('0x30')](_0x2b869e[_0xdaae('0x31')]);_0x396e3e[_0xdaae('0x3a')]=_[_0xdaae('0x32')](_0x396e3e[_0xdaae('0x2f')],_0x396e3e[_0xdaae('0x31')]);_0x357868[_0xdaae('0x33')]=_[_0xdaae('0x32')](_0x396e3e[_0xdaae('0x2f')],qs[_0xdaae('0x34')](_0x2b869e['query'][_0xdaae('0x34')]));_0x357868[_0xdaae('0x33')]=_0x357868[_0xdaae('0x33')][_0xdaae('0x35')]?_0x357868['attributes']:_0x396e3e[_0xdaae('0x2f')];if(_0x2b869e[_0xdaae('0x31')][_0xdaae('0x45')]){_0x357868[_0xdaae('0x40')]=[{'all':!![]}];}_0x357868=_[_0xdaae('0x3c')]({},_0x357868,_0x2b869e[_0xdaae('0x3f')]);return db[_0xdaae('0x2b')]['find'](_0x357868)[_0xdaae('0x23')](handleEntityNotFound(_0x1605d3,null))[_0xdaae('0x23')](respondWithResult(_0x1605d3,null))[_0xdaae('0x46')](handleError(_0x1605d3,null));};exports[_0xdaae('0x47')]=function(_0x1639d0,_0x22d25a){return db[_0xdaae('0x2b')][_0xdaae('0x47')](_0x1639d0[_0xdaae('0x48')],{})[_0xdaae('0x23')](respondWithResult(_0x22d25a,0xc9))['catch'](handleError(_0x22d25a,null));};exports[_0xdaae('0x49')]=function(_0x51fca3,_0x1fae7d){if(_0x51fca3[_0xdaae('0x48')]['id']){delete _0x51fca3['body']['id'];}return db[_0xdaae('0x2b')][_0xdaae('0x4a')]({'where':{'id':_0x51fca3['params']['id']}})['then'](handleEntityNotFound(_0x1fae7d,null))[_0xdaae('0x23')](saveUpdates(_0x51fca3['body'],null))['then'](respondWithResult(_0x1fae7d,null))[_0xdaae('0x46')](handleError(_0x1fae7d,null));};exports[_0xdaae('0x4b')]=function(_0x40d2d6,_0xfb9943){return db[_0xdaae('0x2b')][_0xdaae('0x4a')]({'where':{'id':_0x40d2d6[_0xdaae('0x43')]['id']}})[_0xdaae('0x23')](handleEntityNotFound(_0xfb9943,null))[_0xdaae('0x23')](removeEntity(_0xfb9943,null))['catch'](handleError(_0xfb9943,null));}; \ No newline at end of file +var _0x11a2=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','query'];(function(_0x12e55e,_0x44b6c7){var _0x368e4b=function(_0x469da6){while(--_0x469da6){_0x12e55e['push'](_0x12e55e['shift']());}};_0x368e4b(++_0x44b6c7);}(_0x11a2,0xb0));var _0x211a=function(_0x320e53,_0x239a20){_0x320e53=_0x320e53-0x0;var _0x1a6265=_0x11a2[_0x320e53];return _0x1a6265;};'use strict';var emlformat=require(_0x211a('0x0'));var rimraf=require(_0x211a('0x1'));var zipdir=require(_0x211a('0x2'));var jsonpatch=require(_0x211a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x211a('0x4'));var path=require(_0x211a('0x5'));var sox=require(_0x211a('0x6'));var csv=require('to-csv');var ejs=require(_0x211a('0x7'));var fs=require('fs');var fs_extra=require(_0x211a('0x8'));var _=require(_0x211a('0x9'));var squel=require(_0x211a('0xa'));var crypto=require(_0x211a('0xb'));var jsforce=require(_0x211a('0xc'));var deskjs=require(_0x211a('0xd'));var toCsv=require(_0x211a('0xe'));var querystring=require(_0x211a('0xf'));var Papa=require(_0x211a('0x10'));var Redis=require('ioredis');var authService=require(_0x211a('0x11'));var qs=require(_0x211a('0x12'));var as=require(_0x211a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x211a('0x14'))(_0x211a('0x15'));var utils=require(_0x211a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x211a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4407a7,_0x57271b){_0x57271b=_0x57271b||0xcc;return function(_0x3fa56d){if(_0x3fa56d){return _0x4407a7[_0x211a('0x18')](_0x57271b);}return _0x4407a7[_0x211a('0x19')](_0x57271b)[_0x211a('0x1a')]();};}function respondWithResult(_0x48e577,_0x1a41d2){_0x1a41d2=_0x1a41d2||0xc8;return function(_0x10b095){if(_0x10b095){return _0x48e577['status'](_0x1a41d2)[_0x211a('0x1b')](_0x10b095);}};}function respondWithFilteredResult(_0x2dd9a3,_0x3d9cad){return function(_0x3b1789){if(_0x3b1789){var _0x34c3d1=typeof _0x3d9cad['offset']===_0x211a('0x1c')&&typeof _0x3d9cad['limit']===_0x211a('0x1c');var _0x551d67=_0x3b1789[_0x211a('0x1d')];var _0x2f0de2=_0x34c3d1?0x0:_0x3d9cad[_0x211a('0x1e')];var _0x578fa1=_0x34c3d1?_0x3b1789['count']:_0x3d9cad[_0x211a('0x1e')]+_0x3d9cad[_0x211a('0x1f')];var _0x233059;if(_0x578fa1>=_0x551d67){_0x578fa1=_0x551d67;_0x233059=0xc8;}else{_0x233059=0xce;}_0x2dd9a3[_0x211a('0x19')](_0x233059);return _0x2dd9a3[_0x211a('0x20')](_0x211a('0x21'),_0x2f0de2+'-'+_0x578fa1+'/'+_0x551d67)[_0x211a('0x1b')](_0x3b1789);}return null;};}function patchUpdates(_0x12b951){return function(_0x4fa8ca){try{jsonpatch[_0x211a('0x22')](_0x4fa8ca,_0x12b951,!![]);}catch(_0x257cff){return BPromise['reject'](_0x257cff);}return _0x4fa8ca['save']();};}function saveUpdates(_0x439349,_0x3c397c){return function(_0x2b7a0e){if(_0x2b7a0e){return _0x2b7a0e[_0x211a('0x23')](_0x439349)[_0x211a('0x24')](function(_0x250ccf){return _0x250ccf;});}return null;};}function removeEntity(_0xc24a3d,_0x28e23e){return function(_0x3c4686){if(_0x3c4686){return _0x3c4686[_0x211a('0x25')]()['then'](function(){_0xc24a3d[_0x211a('0x19')](0xcc)[_0x211a('0x1a')]();});}};}function handleEntityNotFound(_0x2f051d,_0x5be371){return function(_0x436f1e){if(!_0x436f1e){_0x2f051d[_0x211a('0x18')](0x194);}return _0x436f1e;};}function handleError(_0x2b9ee9,_0x5e2499){_0x5e2499=_0x5e2499||0x1f4;return function(_0x1e4bd2){logger[_0x211a('0x26')](_0x1e4bd2[_0x211a('0x27')]);if(_0x1e4bd2['name']){delete _0x1e4bd2[_0x211a('0x28')];}_0x2b9ee9[_0x211a('0x19')](_0x5e2499)[_0x211a('0x29')](_0x1e4bd2);};}exports[_0x211a('0x2a')]=function(_0x3bca22,_0x368d63){var _0x5b7d0a={},_0x49cc82={},_0x320b19={'count':0x0,'rows':[]};var _0x573feb=_[_0x211a('0x2b')](db[_0x211a('0x2c')][_0x211a('0x2d')],function(_0x48d085){return{'name':_0x48d085[_0x211a('0x2e')],'type':_0x48d085['type'][_0x211a('0x2f')]};});_0x49cc82['model']=_['map'](_0x573feb,'name');_0x49cc82[_0x211a('0x30')]=_['keys'](_0x3bca22[_0x211a('0x30')]);_0x49cc82['filters']=_[_0x211a('0x31')](_0x49cc82[_0x211a('0x32')],_0x49cc82[_0x211a('0x30')]);_0x5b7d0a[_0x211a('0x33')]=_[_0x211a('0x31')](_0x49cc82[_0x211a('0x32')],qs[_0x211a('0x34')](_0x3bca22[_0x211a('0x30')]['fields']));_0x5b7d0a['attributes']=_0x5b7d0a[_0x211a('0x33')][_0x211a('0x35')]?_0x5b7d0a[_0x211a('0x33')]:_0x49cc82[_0x211a('0x32')];if(!_0x3bca22[_0x211a('0x30')][_0x211a('0x36')](_0x211a('0x37'))){_0x5b7d0a['limit']=qs['limit'](_0x3bca22['query'][_0x211a('0x1f')]);_0x5b7d0a['offset']=qs[_0x211a('0x1e')](_0x3bca22[_0x211a('0x30')][_0x211a('0x1e')]);}_0x5b7d0a[_0x211a('0x38')]=qs[_0x211a('0x39')](_0x3bca22[_0x211a('0x30')][_0x211a('0x39')]);_0x5b7d0a[_0x211a('0x3a')]=qs[_0x211a('0x3b')](_[_0x211a('0x3c')](_0x3bca22[_0x211a('0x30')],_0x49cc82[_0x211a('0x3b')]),_0x573feb);if(_0x3bca22[_0x211a('0x30')][_0x211a('0x3d')]){_0x5b7d0a[_0x211a('0x3a')]=_[_0x211a('0x3e')](_0x5b7d0a[_0x211a('0x3a')],{'$or':_['map'](_0x573feb,function(_0x26fa7f){if(_0x26fa7f[_0x211a('0x3f')]!==_0x211a('0x40')){var _0x2af530={};_0x2af530[_0x26fa7f[_0x211a('0x28')]]={'$like':'%'+_0x3bca22['query'][_0x211a('0x3d')]+'%'};return _0x2af530;}})});}_0x5b7d0a=_[_0x211a('0x3e')]({},_0x5b7d0a,_0x3bca22[_0x211a('0x41')]);var _0x309868={'where':_0x5b7d0a[_0x211a('0x3a')]};return db[_0x211a('0x2c')][_0x211a('0x1d')](_0x309868)[_0x211a('0x24')](function(_0x296d37){_0x320b19['count']=_0x296d37;if(_0x3bca22[_0x211a('0x30')][_0x211a('0x42')]){_0x5b7d0a['include']=[{'all':!![]}];}return db[_0x211a('0x2c')][_0x211a('0x43')](_0x5b7d0a);})[_0x211a('0x24')](function(_0x879ccd){_0x320b19['rows']=_0x879ccd;return _0x320b19;})['then'](respondWithFilteredResult(_0x368d63,_0x5b7d0a))[_0x211a('0x44')](handleError(_0x368d63,null));};exports[_0x211a('0x45')]=function(_0x19ba89,_0x5731f5){var _0x12fbd2={'raw':!![],'where':{'id':_0x19ba89[_0x211a('0x46')]['id']}},_0x5dd4fe={};_0x5dd4fe[_0x211a('0x32')]=_[_0x211a('0x47')](db[_0x211a('0x2c')]['rawAttributes']);_0x5dd4fe['query']=_[_0x211a('0x47')](_0x19ba89['query']);_0x5dd4fe[_0x211a('0x3b')]=_[_0x211a('0x31')](_0x5dd4fe[_0x211a('0x32')],_0x5dd4fe[_0x211a('0x30')]);_0x12fbd2['attributes']=_[_0x211a('0x31')](_0x5dd4fe['model'],qs['fields'](_0x19ba89[_0x211a('0x30')][_0x211a('0x34')]));_0x12fbd2[_0x211a('0x33')]=_0x12fbd2[_0x211a('0x33')][_0x211a('0x35')]?_0x12fbd2[_0x211a('0x33')]:_0x5dd4fe[_0x211a('0x32')];if(_0x19ba89[_0x211a('0x30')]['includeAll']){_0x12fbd2['include']=[{'all':!![]}];}_0x12fbd2=_[_0x211a('0x3e')]({},_0x12fbd2,_0x19ba89['options']);return db['Dynamics365Field'][_0x211a('0x48')](_0x12fbd2)[_0x211a('0x24')](handleEntityNotFound(_0x5731f5,null))[_0x211a('0x24')](respondWithResult(_0x5731f5,null))[_0x211a('0x44')](handleError(_0x5731f5,null));};exports['create']=function(_0x1d39fd,_0x3038e2){return db[_0x211a('0x2c')][_0x211a('0x49')](_0x1d39fd[_0x211a('0x4a')],{})[_0x211a('0x24')](respondWithResult(_0x3038e2,0xc9))['catch'](handleError(_0x3038e2,null));};exports[_0x211a('0x23')]=function(_0x2f0a49,_0x2da26b){if(_0x2f0a49['body']['id']){delete _0x2f0a49[_0x211a('0x4a')]['id'];}return db[_0x211a('0x2c')]['find']({'where':{'id':_0x2f0a49[_0x211a('0x46')]['id']}})[_0x211a('0x24')](handleEntityNotFound(_0x2da26b,null))[_0x211a('0x24')](saveUpdates(_0x2f0a49[_0x211a('0x4a')],null))[_0x211a('0x24')](respondWithResult(_0x2da26b,null))['catch'](handleError(_0x2da26b,null));};exports[_0x211a('0x25')]=function(_0x45eb15,_0x2f8f66){return db[_0x211a('0x2c')][_0x211a('0x48')]({'where':{'id':_0x45eb15[_0x211a('0x46')]['id']}})[_0x211a('0x24')](handleEntityNotFound(_0x2f8f66,null))[_0x211a('0x24')](removeEntity(_0x2f8f66,null))[_0x211a('0x44')](handleError(_0x2f8f66,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index fbff4ee..768c468 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 _0xf4e6=['request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xf4e6,0x9b));var _0x6f4e=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xf4e6[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x6f4e('0x0'));var util=require(_0x6f4e('0x1'));var logger=require(_0x6f4e('0x2'))(_0x6f4e('0x3'));var moment=require('moment');var BPromise=require(_0x6f4e('0x4'));var rp=require(_0x6f4e('0x5'));var fs=require('fs');var path=require(_0x6f4e('0x6'));var rimraf=require(_0x6f4e('0x7'));var config=require(_0x6f4e('0x8'));var attributes=require(_0x6f4e('0x9'));module[_0x6f4e('0xa')]=function(_0x46ae2d,_0x268ddf){return _0x46ae2d[_0x6f4e('0xb')](_0x6f4e('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x6f4e('0xd'),'fields':[_0x6f4e('0xe'),_0x6f4e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6b1=['path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','api'];(function(_0x4e2ebb,_0x5ecb9c){var _0x269fd9=function(_0x1733ce){while(--_0x1733ce){_0x4e2ebb['push'](_0x4e2ebb['shift']());}};_0x269fd9(++_0x5ecb9c);}(_0xa6b1,0x174));var _0x1a6b=function(_0x2232c8,_0x2e7a41){_0x2232c8=_0x2232c8-0x0;var _0x14cdc7=_0xa6b1[_0x2232c8];return _0x14cdc7;};'use strict';var _=require(_0x1a6b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a6b('0x2'));var rimraf=require(_0x1a6b('0x3'));var config=require(_0x1a6b('0x4'));var attributes=require(_0x1a6b('0x5'));module[_0x1a6b('0x6')]=function(_0xe2bf3b,_0x8697d1){return _0xe2bf3b['define'](_0x1a6b('0x7'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x1a6b('0x8'),'fields':[_0x1a6b('0x9'),_0x1a6b('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 0e8a87e..cc7c49e 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 _0x56a7=['code','Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','debug','stringify','error'];(function(_0x4e30bf,_0x5473ce){var _0x913fd4=function(_0xf5ea40){while(--_0xf5ea40){_0x4e30bf['push'](_0x4e30bf['shift']());}};_0x913fd4(++_0x5473ce);}(_0x56a7,0xb6));var _0x756a=function(_0x51821c,_0x2e39c5){_0x51821c=_0x51821c-0x0;var _0x20bde8=_0x56a7[_0x51821c];return _0x20bde8;};'use strict';var _=require(_0x756a('0x0'));var util=require(_0x756a('0x1'));var moment=require(_0x756a('0x2'));var BPromise=require(_0x756a('0x3'));var rs=require(_0x756a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x756a('0x5'))['db'];var utils=require(_0x756a('0x6'));var logger=require(_0x756a('0x7'))(_0x756a('0x8'));var config=require(_0x756a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x756a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46813b,_0x1c5f1f,_0x54df5e){return new BPromise(function(_0x1a6221,_0x24103e){return client[_0x756a('0xb')](_0x46813b,_0x54df5e)['then'](function(_0x48597c){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x1c5f1f,_0x756a('0xc'));logger[_0x756a('0xd')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x1c5f1f,_0x756a('0xc'),JSON[_0x756a('0xe')](_0x48597c));if(_0x48597c['error']){if(_0x48597c[_0x756a('0xf')][_0x756a('0x10')]===0x1f4){logger['error'](_0x756a('0x11'),_0x1c5f1f,_0x48597c[_0x756a('0xf')][_0x756a('0x12')]);return _0x24103e(_0x48597c[_0x756a('0xf')][_0x756a('0x12')]);}logger[_0x756a('0xf')](_0x756a('0x11'),_0x1c5f1f,_0x48597c[_0x756a('0xf')][_0x756a('0x12')]);return _0x1a6221(_0x48597c[_0x756a('0xf')][_0x756a('0x12')]);}else{logger[_0x756a('0x13')](_0x756a('0x11'),_0x1c5f1f,_0x756a('0xc'));_0x1a6221(_0x48597c[_0x756a('0x14')][_0x756a('0x12')]);}})[_0x756a('0x15')](function(_0x571ba3){logger[_0x756a('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x1c5f1f,_0x571ba3);_0x24103e(_0x571ba3);});});} \ No newline at end of file +var _0xd189=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x39ffb3,_0x348b9e){var _0x481c08=function(_0x14ad18){while(--_0x14ad18){_0x39ffb3['push'](_0x39ffb3['shift']());}};_0x481c08(++_0x348b9e);}(_0xd189,0xbb));var _0x9d18=function(_0x90be49,_0x485dc1){_0x90be49=_0x90be49-0x0;var _0x4c86e0=_0xd189[_0x90be49];return _0x4c86e0;};'use strict';var _=require(_0x9d18('0x0'));var util=require(_0x9d18('0x1'));var moment=require(_0x9d18('0x2'));var BPromise=require(_0x9d18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d18('0x4'))['db'];var utils=require(_0x9d18('0x5'));var logger=require(_0x9d18('0x6'))(_0x9d18('0x7'));var config=require(_0x9d18('0x8'));var jayson=require(_0x9d18('0x9'));var client=jayson[_0x9d18('0xa')][_0x9d18('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2af742,_0x3f0c74,_0x41e1fa){return new BPromise(function(_0x3f896e,_0xfa80a){return client[_0x9d18('0xc')](_0x2af742,_0x41e1fa)[_0x9d18('0xd')](function(_0xde97ce){logger['info'](_0x9d18('0xe'),_0x3f0c74,'request\x20sent');logger[_0x9d18('0xf')](_0x9d18('0x10'),_0x3f0c74,_0x9d18('0x11'),JSON[_0x9d18('0x12')](_0xde97ce));if(_0xde97ce[_0x9d18('0x13')]){if(_0xde97ce['error']['code']===0x1f4){logger[_0x9d18('0x13')](_0x9d18('0xe'),_0x3f0c74,_0xde97ce[_0x9d18('0x13')][_0x9d18('0x14')]);return _0xfa80a(_0xde97ce[_0x9d18('0x13')][_0x9d18('0x14')]);}logger['error'](_0x9d18('0xe'),_0x3f0c74,_0xde97ce[_0x9d18('0x13')][_0x9d18('0x14')]);return _0x3f896e(_0xde97ce[_0x9d18('0x13')][_0x9d18('0x14')]);}else{logger[_0x9d18('0x15')]('Dynamics365Field,\x20%s,\x20%s',_0x3f0c74,_0x9d18('0x11'));_0x3f896e(_0xde97ce[_0x9d18('0x16')][_0x9d18('0x14')]);}})[_0x9d18('0x17')](function(_0x480221){logger[_0x9d18('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x3f0c74,_0x480221);_0xfa80a(_0x480221);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 25ceee0..bf9ac50 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 _0xb37c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','/:id/configurations','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xb37c,0xa3));var _0xcb37=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb37c[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xcb37('0x0'));var util=require(_0xcb37('0x1'));var path=require(_0xcb37('0x2'));var timeout=require(_0xcb37('0x3'));var express=require(_0xcb37('0x4'));var router=express[_0xcb37('0x5')]();var fs_extra=require(_0xcb37('0x6'));var auth=require(_0xcb37('0x7'));var interaction=require(_0xcb37('0x8'));var config=require(_0xcb37('0x9'));var controller=require(_0xcb37('0xa'));router[_0xcb37('0xb')]('/',auth[_0xcb37('0xc')](),controller['index']);router['get'](_0xcb37('0xd'),auth[_0xcb37('0xc')](),controller[_0xcb37('0xe')]);router[_0xcb37('0xb')]('/:id/configurations',auth[_0xcb37('0xc')](),controller['getConfigurations']);router['get'](_0xcb37('0xf'),auth[_0xcb37('0xc')](),controller[_0xcb37('0x10')]);router[_0xcb37('0x11')]('/',auth[_0xcb37('0xc')](),controller['create']);router[_0xcb37('0x11')](_0xcb37('0x12'),auth[_0xcb37('0xc')](),controller['addConfiguration']);router['put'](_0xcb37('0xd'),auth[_0xcb37('0xc')](),controller['update']);router[_0xcb37('0x13')](_0xcb37('0xd'),auth[_0xcb37('0xc')](),controller[_0xcb37('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5a71=['./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5a71,0x74));var _0x15a7=function(_0x5dbfb7,_0x482a03){_0x5dbfb7=_0x5dbfb7-0x0;var _0x359cc4=_0x5a71[_0x5dbfb7];return _0x359cc4;};'use strict';var multer=require(_0x15a7('0x0'));var util=require('util');var path=require(_0x15a7('0x1'));var timeout=require(_0x15a7('0x2'));var express=require(_0x15a7('0x3'));var router=express[_0x15a7('0x4')]();var fs_extra=require(_0x15a7('0x5'));var auth=require(_0x15a7('0x6'));var interaction=require(_0x15a7('0x7'));var config=require(_0x15a7('0x8'));var controller=require(_0x15a7('0x9'));router[_0x15a7('0xa')]('/',auth[_0x15a7('0xb')](),controller[_0x15a7('0xc')]);router[_0x15a7('0xa')](_0x15a7('0xd'),auth[_0x15a7('0xb')](),controller[_0x15a7('0xe')]);router[_0x15a7('0xa')](_0x15a7('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x15a7('0xa')](_0x15a7('0x10'),auth[_0x15a7('0xb')](),controller[_0x15a7('0x11')]);router[_0x15a7('0x12')]('/',auth['isAuthenticated'](),controller[_0x15a7('0x13')]);router[_0x15a7('0x12')](_0x15a7('0xf'),auth['isAuthenticated'](),controller[_0x15a7('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x15a7('0x15')]);router[_0x15a7('0x16')]('/:id',auth[_0x15a7('0xb')](),controller[_0x15a7('0x17')]);module[_0x15a7('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2de5afe..9ffe544 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 _0x955f=['exports','STRING','sequelize'];(function(_0x1584ce,_0x13d537){var _0x6cf42b=function(_0x40e225){while(--_0x40e225){_0x1584ce['push'](_0x1584ce['shift']());}};_0x6cf42b(++_0x13d537);}(_0x955f,0x1eb));var _0xf955=function(_0x3d5148,_0x571174){_0x3d5148=_0x3d5148-0x0;var _0x2ebe2f=_0x955f[_0x3d5148];return _0x2ebe2f;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')]},'description':{'type':Sequelize[_0xf955('0x2')]},'username':{'type':Sequelize[_0xf955('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf955('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa456=['STRING','username','sequelize','exports'];(function(_0x59aca7,_0x110de2){var _0x4353d9=function(_0x51102f){while(--_0x51102f){_0x59aca7['push'](_0x59aca7['shift']());}};_0x4353d9(++_0x110de2);}(_0xa456,0x142));var _0x6a45=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xa456[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require(_0x6a45('0x0'));module[_0x6a45('0x1')]={'name':{'type':Sequelize[_0x6a45('0x2')]},'description':{'type':Sequelize[_0x6a45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6a45('0x3')},'apiKey':{'type':Sequelize[_0x6a45('0x2')]},'remoteUri':{'type':Sequelize[_0x6a45('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6a45('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 700ff29..2ac29a9 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(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0x1c8a,0x140));var _0xa1c8=function(_0x180d08,_0x2880fc){_0x180d08=_0x180d08-0x0;var _0x16c316=_0x1c8a[_0x180d08];return _0x16c316;};'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 _0xe43c=['find','findOne','FreshdeskConfiguration','rawAttributes','pick','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','create','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','apiKey','toString','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','default','custom_text','custom_dropdown','label','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','rows','show','params','options','body','catch'];(function(_0x3fe140,_0xfbff91){var _0x582c8e=function(_0x2c9a84){while(--_0x2c9a84){_0x3fe140['push'](_0x3fe140['shift']());}};_0x582c8e(++_0xfbff91);}(_0xe43c,0x180));var _0xce43=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xe43c[_0x209941];return _0x1e8729;};'use strict';var emlformat=require(_0xce43('0x0'));var rimraf=require(_0xce43('0x1'));var zipdir=require(_0xce43('0x2'));var jsonpatch=require(_0xce43('0x3'));var rp=require(_0xce43('0x4'));var moment=require(_0xce43('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xce43('0x6'));var util=require('util');var path=require(_0xce43('0x7'));var sox=require(_0xce43('0x8'));var csv=require(_0xce43('0x9'));var ejs=require(_0xce43('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce43('0xb'));var squel=require('squel');var crypto=require(_0xce43('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce43('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce43('0xe'));var Redis=require(_0xce43('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce43('0x10'));var logger=require('../../config/logger')(_0xce43('0x11'));var utils=require('../../config/utils');var config=require(_0xce43('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xce43('0x13'))['db'];var integrations=require(_0xce43('0x14'));function respondWithStatusCode(_0x4c092b,_0x226f21){_0x226f21=_0x226f21||0xcc;return function(_0x1a74bf){if(_0x1a74bf){return _0x4c092b[_0xce43('0x15')](_0x226f21);}return _0x4c092b[_0xce43('0x16')](_0x226f21)['end']();};}function respondWithResult(_0x3034c7,_0x607d92){_0x607d92=_0x607d92||0xc8;return function(_0x3cd0f7){if(_0x3cd0f7){return _0x3034c7[_0xce43('0x16')](_0x607d92)['json'](_0x3cd0f7);}};}function respondWithFilteredResult(_0x588ddb,_0x3c0948){return function(_0x3e4218){if(_0x3e4218){var _0x2eb70b=typeof _0x3c0948[_0xce43('0x17')]===_0xce43('0x18')&&typeof _0x3c0948[_0xce43('0x19')]==='undefined';var _0x12014e=_0x3e4218[_0xce43('0x1a')];var _0xbc38f0=_0x2eb70b?0x0:_0x3c0948[_0xce43('0x17')];var _0x4c6a1b=_0x2eb70b?_0x3e4218[_0xce43('0x1a')]:_0x3c0948[_0xce43('0x17')]+_0x3c0948[_0xce43('0x19')];var _0x2506de;if(_0x4c6a1b>=_0x12014e){_0x4c6a1b=_0x12014e;_0x2506de=0xc8;}else{_0x2506de=0xce;}_0x588ddb[_0xce43('0x16')](_0x2506de);return _0x588ddb[_0xce43('0x1b')]('Content-Range',_0xbc38f0+'-'+_0x4c6a1b+'/'+_0x12014e)[_0xce43('0x1c')](_0x3e4218);}return null;};}function patchUpdates(_0x383f69){return function(_0x5973b9){try{jsonpatch[_0xce43('0x1d')](_0x5973b9,_0x383f69,!![]);}catch(_0x7d1421){return BPromise[_0xce43('0x1e')](_0x7d1421);}return _0x5973b9['save']();};}function saveUpdates(_0x57dcd4,_0x37b34e){return function(_0x30f5a1){if(_0x30f5a1){return _0x30f5a1[_0xce43('0x1f')](_0x57dcd4)[_0xce43('0x20')](function(_0x2d8f7d){return _0x2d8f7d;});}return null;};}function removeEntity(_0x2b9874,_0x118a89){return function(_0x4e7611){if(_0x4e7611){return _0x4e7611[_0xce43('0x21')]()[_0xce43('0x20')](function(){_0x2b9874[_0xce43('0x16')](0xcc)[_0xce43('0x22')]();});}};}function handleEntityNotFound(_0x48a448,_0x11d60b){return function(_0x45fec7){if(!_0x45fec7){_0x48a448[_0xce43('0x15')](0x194);}return _0x45fec7;};}function handleError(_0x1bb63f,_0x802b0d){_0x802b0d=_0x802b0d||0x1f4;return function(_0x272b45){logger['error'](_0x272b45[_0xce43('0x23')]);if(_0x272b45['name']){delete _0x272b45[_0xce43('0x24')];}_0x1bb63f[_0xce43('0x16')](_0x802b0d)[_0xce43('0x25')](_0x272b45);};}exports[_0xce43('0x26')]=function(_0x536452,_0xb6527c){var _0x4402f8={},_0x2a2d1d={},_0x44ac56={'count':0x0,'rows':[]};var _0x4b966a=_[_0xce43('0x27')](db[_0xce43('0x28')]['rawAttributes'],function(_0x388279){return{'name':_0x388279[_0xce43('0x29')],'type':_0x388279[_0xce43('0x2a')][_0xce43('0x2b')]};});_0x2a2d1d[_0xce43('0x2c')]=_[_0xce43('0x27')](_0x4b966a,'name');_0x2a2d1d['query']=_[_0xce43('0x2d')](_0x536452[_0xce43('0x2e')]);_0x2a2d1d['filters']=_[_0xce43('0x2f')](_0x2a2d1d[_0xce43('0x2c')],_0x2a2d1d[_0xce43('0x2e')]);_0x4402f8[_0xce43('0x30')]=_[_0xce43('0x2f')](_0x2a2d1d['model'],qs[_0xce43('0x31')](_0x536452[_0xce43('0x2e')][_0xce43('0x31')]));_0x4402f8[_0xce43('0x30')]=_0x4402f8[_0xce43('0x30')][_0xce43('0x32')]?_0x4402f8[_0xce43('0x30')]:_0x2a2d1d[_0xce43('0x2c')];if(!_0x536452[_0xce43('0x2e')][_0xce43('0x33')](_0xce43('0x34'))){_0x4402f8[_0xce43('0x19')]=qs[_0xce43('0x19')](_0x536452[_0xce43('0x2e')][_0xce43('0x19')]);_0x4402f8[_0xce43('0x17')]=qs[_0xce43('0x17')](_0x536452[_0xce43('0x2e')]['offset']);}_0x4402f8[_0xce43('0x35')]=qs[_0xce43('0x36')](_0x536452[_0xce43('0x2e')][_0xce43('0x36')]);_0x4402f8[_0xce43('0x37')]=qs[_0xce43('0x38')](_['pick'](_0x536452[_0xce43('0x2e')],_0x2a2d1d[_0xce43('0x38')]),_0x4b966a);if(_0x536452[_0xce43('0x2e')][_0xce43('0x39')]){_0x4402f8[_0xce43('0x37')]=_['merge'](_0x4402f8['where'],{'$or':_[_0xce43('0x27')](_0x4b966a,function(_0x143eef){if(_0x143eef['type']!==_0xce43('0x3a')){var _0x269d81={};_0x269d81[_0x143eef[_0xce43('0x24')]]={'$like':'%'+_0x536452[_0xce43('0x2e')]['filter']+'%'};return _0x269d81;}})});}_0x4402f8=_[_0xce43('0x3b')]({},_0x4402f8,_0x536452['options']);var _0x83cf22={'where':_0x4402f8[_0xce43('0x37')]};return db['FreshdeskAccount'][_0xce43('0x1a')](_0x83cf22)[_0xce43('0x20')](function(_0x294299){_0x44ac56['count']=_0x294299;if(_0x536452['query'][_0xce43('0x3c')]){_0x4402f8[_0xce43('0x3d')]=[{'all':!![]}];}return db[_0xce43('0x28')]['findAll'](_0x4402f8);})[_0xce43('0x20')](function(_0x149f6a){_0x44ac56[_0xce43('0x3e')]=_0x149f6a;return _0x44ac56;})[_0xce43('0x20')](respondWithFilteredResult(_0xb6527c,_0x4402f8))['catch'](handleError(_0xb6527c,null));};exports[_0xce43('0x3f')]=function(_0x29a516,_0x3b7717){var _0xc55921={'raw':![],'where':{'id':_0x29a516[_0xce43('0x40')]['id']}},_0x3d8734={};_0x3d8734[_0xce43('0x2c')]=_[_0xce43('0x2d')](db[_0xce43('0x28')]['rawAttributes']);_0x3d8734['query']=_[_0xce43('0x2d')](_0x29a516[_0xce43('0x2e')]);_0x3d8734[_0xce43('0x38')]=_[_0xce43('0x2f')](_0x3d8734[_0xce43('0x2c')],_0x3d8734[_0xce43('0x2e')]);_0xc55921[_0xce43('0x30')]=_[_0xce43('0x2f')](_0x3d8734[_0xce43('0x2c')],qs[_0xce43('0x31')](_0x29a516[_0xce43('0x2e')][_0xce43('0x31')]));_0xc55921[_0xce43('0x30')]=_0xc55921[_0xce43('0x30')][_0xce43('0x32')]?_0xc55921[_0xce43('0x30')]:_0x3d8734[_0xce43('0x2c')];if(_0x29a516[_0xce43('0x2e')]['includeAll']){_0xc55921[_0xce43('0x3d')]=[{'all':!![]}];}_0xc55921=_[_0xce43('0x3b')]({},_0xc55921,_0x29a516[_0xce43('0x41')]);return db['FreshdeskAccount']['find'](_0xc55921)[_0xce43('0x20')](handleEntityNotFound(_0x3b7717,null))['then'](respondWithResult(_0x3b7717,null))['catch'](handleError(_0x3b7717,null));};exports['create']=function(_0x4cdd4f,_0x3de6ec){return db[_0xce43('0x28')]['create'](_0x4cdd4f[_0xce43('0x42')],{})['then'](respondWithResult(_0x3de6ec,0xc9))['catch'](handleError(_0x3de6ec,null));};exports[_0xce43('0x1f')]=function(_0x562963,_0x55181e){if(_0x562963[_0xce43('0x42')]['id']){delete _0x562963[_0xce43('0x42')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x562963[_0xce43('0x40')]['id']}})['then'](handleEntityNotFound(_0x55181e,null))[_0xce43('0x20')](saveUpdates(_0x562963[_0xce43('0x42')],null))['then'](respondWithResult(_0x55181e,null))[_0xce43('0x43')](handleError(_0x55181e,null));};exports[_0xce43('0x21')]=function(_0x29ec7d,_0x180fa2){return db[_0xce43('0x28')][_0xce43('0x44')]({'where':{'id':_0x29ec7d[_0xce43('0x40')]['id']}})[_0xce43('0x20')](handleEntityNotFound(_0x180fa2,null))[_0xce43('0x20')](removeEntity(_0x180fa2,null))['catch'](handleError(_0x180fa2,null));};exports['getConfigurations']=function(_0x359330,_0x25fb99,_0x29d911){var _0xc9e65e={};var _0x17b110={};var _0x43ba4f;var _0x59a74d;return db[_0xce43('0x28')][_0xce43('0x45')]({'where':{'id':_0x359330[_0xce43('0x40')]['id']}})[_0xce43('0x20')](handleEntityNotFound(_0x25fb99,null))[_0xce43('0x20')](function(_0x46905b){if(_0x46905b){_0x43ba4f=_0x46905b;_0x17b110[_0xce43('0x2c')]=_[_0xce43('0x2d')](db[_0xce43('0x46')][_0xce43('0x47')]);_0x17b110[_0xce43('0x2e')]=_['keys'](_0x359330[_0xce43('0x2e')]);_0x17b110[_0xce43('0x38')]=_[_0xce43('0x2f')](_0x17b110['model'],_0x17b110[_0xce43('0x2e')]);_0xc9e65e[_0xce43('0x30')]=_[_0xce43('0x2f')](_0x17b110['model'],qs['fields'](_0x359330[_0xce43('0x2e')]['fields']));_0xc9e65e[_0xce43('0x30')]=_0xc9e65e[_0xce43('0x30')][_0xce43('0x32')]?_0xc9e65e['attributes']:_0x17b110['model'];_0xc9e65e['order']=qs['sort'](_0x359330['query']['sort']);_0xc9e65e[_0xce43('0x37')]=qs[_0xce43('0x38')](_[_0xce43('0x48')](_0x359330[_0xce43('0x2e')],_0x17b110['filters']));if(_0x359330['query'][_0xce43('0x39')]){_0xc9e65e[_0xce43('0x37')]=_[_0xce43('0x3b')](_0xc9e65e[_0xce43('0x37')],{'$or':_['map'](_0xc9e65e[_0xce43('0x30')],function(_0xdb94a7){var _0x4b3017={};_0x4b3017[_0xdb94a7]={'$like':'%'+_0x359330[_0xce43('0x2e')][_0xce43('0x39')]+'%'};return _0x4b3017;})});}_0xc9e65e=_[_0xce43('0x3b')]({},_0xc9e65e,_0x359330['options']);return _0x43ba4f[_0xce43('0x49')](_0xc9e65e);}})[_0xce43('0x20')](function(_0x5eba18){if(_0x5eba18){_0x59a74d=_0x5eba18['length'];if(!_0x359330['query'][_0xce43('0x33')]('nolimit')){_0xc9e65e[_0xce43('0x19')]=qs['limit'](_0x359330[_0xce43('0x2e')]['limit']);_0xc9e65e['offset']=qs[_0xce43('0x17')](_0x359330['query'][_0xce43('0x17')]);}return _0x43ba4f[_0xce43('0x49')](_0xc9e65e);}})[_0xce43('0x20')](function(_0x37cadd){if(_0x37cadd){return _0x37cadd?{'count':_0x59a74d,'rows':_0x37cadd}:null;}})[_0xce43('0x20')](respondWithResult(_0x25fb99,null))[_0xce43('0x43')](handleError(_0x25fb99,null));};exports[_0xce43('0x4a')]=function(_0x2e2680,_0x1aa98f,_0x3514fd){if(_0x2e2680[_0xce43('0x42')]['id']){delete _0x2e2680['body']['id'];}return db[_0xce43('0x28')][_0xce43('0x45')]({'where':{'id':_0x2e2680[_0xce43('0x40')]['id']}})[_0xce43('0x20')](handleEntityNotFound(_0x1aa98f,null))[_0xce43('0x20')](function(_0x41c26e){if(_0x41c26e){_0x2e2680[_0xce43('0x42')][_0xce43('0x4b')]=_0x41c26e['id'];_0x2e2680['body']['Subjects']=integrations[_0xce43('0x4c')](_0x2e2680[_0xce43('0x42')]['channel'],_0x2e2680[_0xce43('0x42')]['type']);_0x2e2680['body'][_0xce43('0x4d')]=integrations[_0xce43('0x4e')](_0x2e2680[_0xce43('0x42')][_0xce43('0x4f')],_0x2e2680[_0xce43('0x42')]['type']);return db[_0xce43('0x46')][_0xce43('0x50')](_0x2e2680['body'],{'include':[{'model':db[_0xce43('0x51')],'as':'Subjects'},{'model':db[_0xce43('0x51')],'as':_0xce43('0x4d')}]});}return null;})[_0xce43('0x20')](respondWithResult(_0x1aa98f,null))['catch'](handleError(_0x1aa98f,null));};exports[_0xce43('0x52')]=function(_0x48d113,_0xbaf075,_0x596da4){var _0x29c768='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x48d113['params']['id']},'attributes':['id',_0xce43('0x53'),'apiKey']})['then'](handleEntityNotFound(_0xbaf075,null))[_0xce43('0x20')](function(_0x320f71){if(_0x320f71){_0x29c768=_0x320f71[_0xce43('0x53')];var _0x529064=_0x29c768[_0xce43('0x54')](-0x1);if(_0x529064==='/'){_0x29c768=_0x29c768[_0xce43('0x55')](0x0,_0x29c768[_0xce43('0x56')](_0x529064));}return rp({'method':_0xce43('0x57'),'uri':util['format']('%s/%s',_0x29c768,_0xce43('0x58')),'headers':{'Authorization':util[_0xce43('0x59')](_0xce43('0x5a'),new Buffer(util[_0xce43('0x59')]('%s:X',_0x320f71[_0xce43('0x5b')]))[_0xce43('0x5c')]('base64'))},'json':!![]});}})[_0xce43('0x20')](function(_0x578b38){if(_0x578b38){var _0x2d1bfb=[_0xce43('0x5d'),_0xce43('0x5e'),_0xce43('0x5f'),_0xce43('0x60'),_0xce43('0x16'),_0xce43('0x61'),_0xce43('0x62'),_0xce43('0x63'),_0xce43('0x64'),_0xce43('0x62'),_0xce43('0x65')];_[_0xce43('0x66')](_0x578b38,function(_0x161a06){return _0x2d1bfb['includes'](_0x161a06['name'])||!_0x161a06[_0xce43('0x67')]&&_0x161a06[_0xce43('0x2a')]!==_0xce43('0x68')&&_0x161a06['type']!==_0xce43('0x69');});return{'count':_0x578b38['length'],'rows':_[_0xce43('0x27')](_0x578b38,function(_0x8fd118){return{'id':_0x8fd118['name'],'name':_0x8fd118[_0xce43('0x6a')],'custom':!_0x8fd118[_0xce43('0x67')],'options':_0x8fd118['choices']?_[_0xce43('0x27')](_0x8fd118['choices'],function(_0x41f4a7){return{'name':_[_0xce43('0x6b')](_0x41f4a7),'value':_0x41f4a7};}):[]};})};}})[_0xce43('0x20')](respondWithResult(_0xbaf075,null))[_0xce43('0x43')](function(_0x7f4104){var _0x632fa6=_0x48d113[_0xce43('0x2e')][_0xce43('0x6c')]?0x1f4:_0x7f4104[_0xce43('0x6d')]||0x1f4;logger[_0xce43('0x6e')](_0xce43('0x6f'),'getFields',_0x632fa6,JSON['stringify'](_0x7f4104));delete _0x7f4104['name'];if(_0x632fa6===0x191){_0x632fa6=0x190;}_0xbaf075[_0xce43('0x16')](_0x632fa6)[_0xce43('0x25')](_0x48d113[_0xce43('0x2e')][_0xce43('0x6c')]?{'message':_0xce43('0x70'),'statusCode':_0x7f4104[_0xce43('0x6d')]}:_0x7f4104);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 890375a..6abdcd3 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 _0x7a6e=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports'];(function(_0x7c6564,_0xfab533){var _0x5db005=function(_0x39a8d6){while(--_0x39a8d6){_0x7c6564['push'](_0x7c6564['shift']());}};_0x5db005(++_0xfab533);}(_0x7a6e,0xa8));var _0xe7a6=function(_0x2aacd9,_0x5d455d){_0x2aacd9=_0x2aacd9-0x0;var _0x37bdd6=_0x7a6e[_0x2aacd9];return _0x37bdd6;};'use strict';var _=require(_0xe7a6('0x0'));var util=require(_0xe7a6('0x1'));var logger=require('../../config/logger')(_0xe7a6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe7a6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7a6('0x4'));var config=require(_0xe7a6('0x5'));var attributes=require(_0xe7a6('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xe7a6('0x7')]=function(_0xe53794,_0x589829){return _0xe53794[_0xe7a6('0x8')](_0xe7a6('0x9'),attributes,{'tableName':_0xe7a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60d7=['rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger'];(function(_0x546999,_0x1c65ba){var _0xb57d4f=function(_0xc846af){while(--_0xc846af){_0x546999['push'](_0x546999['shift']());}};_0xb57d4f(++_0x1c65ba);}(_0x60d7,0x10e));var _0x760d=function(_0x4218ff,_0x3e788a){_0x4218ff=_0x4218ff-0x0;var _0x547199=_0x60d7[_0x4218ff];return _0x547199;};'use strict';var _=require(_0x760d('0x0'));var util=require('util');var logger=require(_0x760d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x760d('0x2'));var config=require(_0x760d('0x3'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x760d('0x4'));module[_0x760d('0x5')]=function(_0x563de2,_0x1708c7){return _0x563de2['define'](_0x760d('0x6'),attributes,{'tableName':_0x760d('0x7'),'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 9170483..da83b44 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 _0xdb1a=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','options','raw','where','include','map','model','attributes','info','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','lodash','util'];(function(_0x40fb1a,_0xc40248){var _0x5a7770=function(_0x487e52){while(--_0x487e52){_0x40fb1a['push'](_0x40fb1a['shift']());}};_0x5a7770(++_0xc40248);}(_0xdb1a,0xca));var _0xadb1=function(_0x3c23dd,_0x47d34a){_0x3c23dd=_0x3c23dd-0x0;var _0x167956=_0xdb1a[_0x3c23dd];return _0x167956;};'use strict';var _=require(_0xadb1('0x0'));var util=require(_0xadb1('0x1'));var moment=require(_0xadb1('0x2'));var BPromise=require(_0xadb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb1('0x4'));var db=require(_0xadb1('0x5'))['db'];var utils=require(_0xadb1('0x6'));var logger=require('../../config/logger')(_0xadb1('0x7'));var config=require(_0xadb1('0x8'));var jayson=require(_0xadb1('0x9'));var client=jayson[_0xadb1('0xa')][_0xadb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaedf13,_0x3f2d92,_0x240c91){return new BPromise(function(_0x2b4749,_0x17ccf3){return client[_0xadb1('0xc')](_0xaedf13,_0x240c91)[_0xadb1('0xd')](function(_0x9d0258){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x3f2d92,_0xadb1('0xe'));logger[_0xadb1('0xf')](_0xadb1('0x10'),_0x3f2d92,_0xadb1('0xe'),JSON[_0xadb1('0x11')](_0x9d0258));if(_0x9d0258[_0xadb1('0x12')]){if(_0x9d0258['error'][_0xadb1('0x13')]===0x1f4){logger[_0xadb1('0x12')](_0xadb1('0x14'),_0x3f2d92,_0x9d0258[_0xadb1('0x12')]['message']);return _0x17ccf3(_0x9d0258[_0xadb1('0x12')]['message']);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3f2d92,_0x9d0258[_0xadb1('0x12')]['message']);return _0x2b4749(_0x9d0258[_0xadb1('0x12')][_0xadb1('0x15')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x3f2d92,_0xadb1('0xe'));_0x2b4749(_0x9d0258[_0xadb1('0x16')][_0xadb1('0x15')]);}})['catch'](function(_0x200e77){logger['error'](_0xadb1('0x14'),_0x3f2d92,_0x200e77);_0x17ccf3(_0x200e77);});});}exports['GetFreshdeskAccount']=function(_0x1af420){var _0x2d3372=this;return new Promise(function(_0x489f0d,_0x5e988a){return db['FreshdeskAccount']['findAll']({'raw':_0x1af420[_0xadb1('0x17')]?_0x1af420[_0xadb1('0x17')][_0xadb1('0x18')]===undefined?!![]:![]:!![],'where':_0x1af420[_0xadb1('0x17')]?_0x1af420[_0xadb1('0x17')][_0xadb1('0x19')]||null:null,'attributes':_0x1af420[_0xadb1('0x17')]?_0x1af420[_0xadb1('0x17')]['attributes']||null:null,'limit':_0x1af420[_0xadb1('0x17')]?_0x1af420[_0xadb1('0x17')]['limit']||null:null,'include':_0x1af420[_0xadb1('0x17')]?_0x1af420[_0xadb1('0x17')][_0xadb1('0x1a')]?_[_0xadb1('0x1b')](_0x1af420[_0xadb1('0x17')][_0xadb1('0x1a')],function(_0x47c851){return{'model':db[_0x47c851[_0xadb1('0x1c')]],'as':_0x47c851['as'],'attributes':_0x47c851[_0xadb1('0x1d')],'include':_0x47c851[_0xadb1('0x1a')]?_[_0xadb1('0x1b')](_0x47c851[_0xadb1('0x1a')],function(_0x3afdbc){return{'model':db[_0x3afdbc[_0xadb1('0x1c')]],'as':_0x3afdbc['as'],'attributes':_0x3afdbc[_0xadb1('0x1d')],'include':_0x3afdbc['include']?_['map'](_0x3afdbc['include'],function(_0x8d0fcf){return{'model':db[_0x8d0fcf[_0xadb1('0x1c')]],'as':_0x8d0fcf['as'],'attributes':_0x8d0fcf[_0xadb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xadb1('0xd')](function(_0x140b84){logger[_0xadb1('0x1e')](_0xadb1('0x1f'),_0x1af420);logger[_0xadb1('0xf')](_0xadb1('0x1f'),_0x1af420,JSON[_0xadb1('0x11')](_0x140b84));_0x489f0d(_0x140b84);})['catch'](function(_0x3ffc27){logger[_0xadb1('0x12')](_0xadb1('0x1f'),_0x3ffc27[_0xadb1('0x15')],_0x1af420);_0x5e988a(_0x2d3372[_0xadb1('0x12')](0x1f4,_0x3ffc27[_0xadb1('0x15')]));});});};exports[_0xadb1('0x20')]=function(_0x57d293){var _0x1cf235=this;return new Promise(function(_0x26a2c3,_0x2d9863){return db[_0xadb1('0x21')]['find']({'raw':_0x57d293[_0xadb1('0x17')]?_0x57d293[_0xadb1('0x17')][_0xadb1('0x18')]===undefined?!![]:![]:!![],'where':_0x57d293[_0xadb1('0x17')]?_0x57d293[_0xadb1('0x17')][_0xadb1('0x19')]||null:null,'attributes':_0x57d293[_0xadb1('0x17')]?_0x57d293[_0xadb1('0x17')][_0xadb1('0x1d')]||null:null,'include':_0x57d293[_0xadb1('0x17')]?_0x57d293['options'][_0xadb1('0x1a')]?_['map'](_0x57d293[_0xadb1('0x17')][_0xadb1('0x1a')],function(_0x1fd564){return{'model':db[_0x1fd564[_0xadb1('0x1c')]],'as':_0x1fd564['as'],'attributes':_0x1fd564[_0xadb1('0x1d')],'include':_0x1fd564[_0xadb1('0x1a')]?_[_0xadb1('0x1b')](_0x1fd564[_0xadb1('0x1a')],function(_0x16ef51){return{'model':db[_0x16ef51[_0xadb1('0x1c')]],'as':_0x16ef51['as'],'attributes':_0x16ef51[_0xadb1('0x1d')],'include':_0x16ef51[_0xadb1('0x1a')]?_[_0xadb1('0x1b')](_0x16ef51['include'],function(_0x2d910f){return{'model':db[_0x2d910f[_0xadb1('0x1c')]],'as':_0x2d910f['as'],'attributes':_0x2d910f['attributes']};}):[]};}):[]};}):[]:[]})[_0xadb1('0xd')](function(_0x3a3fca){logger[_0xadb1('0x1e')](_0xadb1('0x20'),_0x57d293);logger[_0xadb1('0xf')](_0xadb1('0x20'),_0x57d293,JSON[_0xadb1('0x11')](_0x3a3fca));_0x26a2c3(_0x3a3fca);})['catch'](function(_0x336949){logger[_0xadb1('0x12')]('ShowFreshdeskAccount',_0x336949[_0xadb1('0x15')],_0x57d293);_0x2d9863(_0x1cf235[_0xadb1('0x12')](0x1f4,_0x336949[_0xadb1('0x15')]));});});}; \ No newline at end of file +var _0x1cde=['include','model','attributes','map','ShowFreshdeskAccount','find','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','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','where'];(function(_0x3cda26,_0x31a42a){var _0x45469f=function(_0x27a69d){while(--_0x27a69d){_0x3cda26['push'](_0x3cda26['shift']());}};_0x45469f(++_0x31a42a);}(_0x1cde,0x1f1));var _0xe1cd=function(_0x14a538,_0xf820cd){_0x14a538=_0x14a538-0x0;var _0x352c5e=_0x1cde[_0x14a538];return _0x352c5e;};'use strict';var _=require('lodash');var util=require(_0xe1cd('0x0'));var moment=require(_0xe1cd('0x1'));var BPromise=require(_0xe1cd('0x2'));var rs=require(_0xe1cd('0x3'));var fs=require('fs');var Redis=require(_0xe1cd('0x4'));var db=require(_0xe1cd('0x5'))['db'];var utils=require(_0xe1cd('0x6'));var logger=require('../../config/logger')(_0xe1cd('0x7'));var config=require(_0xe1cd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe1cd('0x9')][_0xe1cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43439f,_0xc332c9,_0x41149e){return new BPromise(function(_0x1b95dd,_0x36127b){return client[_0xe1cd('0xb')](_0x43439f,_0x41149e)[_0xe1cd('0xc')](function(_0x4fc930){logger[_0xe1cd('0xd')](_0xe1cd('0xe'),_0xc332c9,_0xe1cd('0xf'));logger['debug'](_0xe1cd('0x10'),_0xc332c9,'request\x20sent',JSON[_0xe1cd('0x11')](_0x4fc930));if(_0x4fc930[_0xe1cd('0x12')]){if(_0x4fc930[_0xe1cd('0x12')]['code']===0x1f4){logger[_0xe1cd('0x12')](_0xe1cd('0xe'),_0xc332c9,_0x4fc930[_0xe1cd('0x12')][_0xe1cd('0x13')]);return _0x36127b(_0x4fc930['error'][_0xe1cd('0x13')]);}logger[_0xe1cd('0x12')](_0xe1cd('0xe'),_0xc332c9,_0x4fc930[_0xe1cd('0x12')][_0xe1cd('0x13')]);return _0x1b95dd(_0x4fc930[_0xe1cd('0x12')]['message']);}else{logger[_0xe1cd('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0xc332c9,_0xe1cd('0xf'));_0x1b95dd(_0x4fc930[_0xe1cd('0x14')][_0xe1cd('0x13')]);}})[_0xe1cd('0x15')](function(_0x536509){logger[_0xe1cd('0x12')](_0xe1cd('0xe'),_0xc332c9,_0x536509);_0x36127b(_0x536509);});});}exports[_0xe1cd('0x16')]=function(_0x278b6b){var _0x4bfc3f=this;return new Promise(function(_0x4c55ec,_0x2c9998){return db[_0xe1cd('0x17')][_0xe1cd('0x18')]({'raw':_0x278b6b[_0xe1cd('0x19')]?_0x278b6b['options'][_0xe1cd('0x1a')]===undefined?!![]:![]:!![],'where':_0x278b6b[_0xe1cd('0x19')]?_0x278b6b[_0xe1cd('0x19')][_0xe1cd('0x1b')]||null:null,'attributes':_0x278b6b[_0xe1cd('0x19')]?_0x278b6b[_0xe1cd('0x19')]['attributes']||null:null,'limit':_0x278b6b[_0xe1cd('0x19')]?_0x278b6b[_0xe1cd('0x19')]['limit']||null:null,'include':_0x278b6b['options']?_0x278b6b[_0xe1cd('0x19')][_0xe1cd('0x1c')]?_['map'](_0x278b6b[_0xe1cd('0x19')]['include'],function(_0x26c2a7){return{'model':db[_0x26c2a7['model']],'as':_0x26c2a7['as'],'attributes':_0x26c2a7['attributes'],'include':_0x26c2a7[_0xe1cd('0x1c')]?_['map'](_0x26c2a7[_0xe1cd('0x1c')],function(_0x6321e8){return{'model':db[_0x6321e8[_0xe1cd('0x1d')]],'as':_0x6321e8['as'],'attributes':_0x6321e8[_0xe1cd('0x1e')],'include':_0x6321e8['include']?_[_0xe1cd('0x1f')](_0x6321e8[_0xe1cd('0x1c')],function(_0x211b9b){return{'model':db[_0x211b9b['model']],'as':_0x211b9b['as'],'attributes':_0x211b9b[_0xe1cd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe1cd('0xc')](function(_0x317057){logger[_0xe1cd('0xd')]('GetFreshdeskAccount',_0x278b6b);logger['debug'](_0xe1cd('0x16'),_0x278b6b,JSON[_0xe1cd('0x11')](_0x317057));_0x4c55ec(_0x317057);})[_0xe1cd('0x15')](function(_0x5e5f09){logger['error'](_0xe1cd('0x16'),_0x5e5f09[_0xe1cd('0x13')],_0x278b6b);_0x2c9998(_0x4bfc3f['error'](0x1f4,_0x5e5f09['message']));});});};exports[_0xe1cd('0x20')]=function(_0x1ad720){var _0xee04b0=this;return new Promise(function(_0x5cfb78,_0x21ca51){return db[_0xe1cd('0x17')][_0xe1cd('0x21')]({'raw':_0x1ad720[_0xe1cd('0x19')]?_0x1ad720['options'][_0xe1cd('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ad720[_0xe1cd('0x19')]?_0x1ad720[_0xe1cd('0x19')]['where']||null:null,'attributes':_0x1ad720[_0xe1cd('0x19')]?_0x1ad720[_0xe1cd('0x19')][_0xe1cd('0x1e')]||null:null,'include':_0x1ad720[_0xe1cd('0x19')]?_0x1ad720[_0xe1cd('0x19')][_0xe1cd('0x1c')]?_[_0xe1cd('0x1f')](_0x1ad720[_0xe1cd('0x19')]['include'],function(_0xbce3d8){return{'model':db[_0xbce3d8[_0xe1cd('0x1d')]],'as':_0xbce3d8['as'],'attributes':_0xbce3d8['attributes'],'include':_0xbce3d8['include']?_['map'](_0xbce3d8[_0xe1cd('0x1c')],function(_0x57e8c7){return{'model':db[_0x57e8c7['model']],'as':_0x57e8c7['as'],'attributes':_0x57e8c7['attributes'],'include':_0x57e8c7['include']?_[_0xe1cd('0x1f')](_0x57e8c7[_0xe1cd('0x1c')],function(_0x2eb8d1){return{'model':db[_0x2eb8d1['model']],'as':_0x2eb8d1['as'],'attributes':_0x2eb8d1[_0xe1cd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe1cd('0xc')](function(_0x106739){logger[_0xe1cd('0xd')](_0xe1cd('0x20'),_0x1ad720);logger[_0xe1cd('0x22')](_0xe1cd('0x20'),_0x1ad720,JSON[_0xe1cd('0x11')](_0x106739));_0x5cfb78(_0x106739);})[_0xe1cd('0x15')](function(_0x2e1087){logger[_0xe1cd('0x12')](_0xe1cd('0x20'),_0x2e1087['message'],_0x1ad720);_0x21ca51(_0xee04b0[_0xe1cd('0x12')](0x1f4,_0x2e1087[_0xe1cd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index eabc8af..0e82def 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 _0x255c=['index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0xcdbefc,_0x438db5){var _0x18296d=function(_0x2672e6){while(--_0x2672e6){_0xcdbefc['push'](_0xcdbefc['shift']());}};_0x18296d(++_0x438db5);}(_0x255c,0x146));var _0xc255=function(_0x241929,_0x1700d5){_0x241929=_0x241929-0x0;var _0x3f6ad9=_0x255c[_0x241929];return _0x3f6ad9;};'use strict';var multer=require('multer');var util=require(_0xc255('0x0'));var path=require('path');var timeout=require(_0xc255('0x1'));var express=require(_0xc255('0x2'));var router=express[_0xc255('0x3')]();var fs_extra=require(_0xc255('0x4'));var auth=require(_0xc255('0x5'));var interaction=require(_0xc255('0x6'));var config=require(_0xc255('0x7'));var controller=require(_0xc255('0x8'));router[_0xc255('0x9')]('/',auth['isAuthenticated'](),controller[_0xc255('0xa')]);router[_0xc255('0x9')](_0xc255('0xb'),auth[_0xc255('0xc')](),controller[_0xc255('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xc255('0x9')](_0xc255('0xe'),auth[_0xc255('0xc')](),controller[_0xc255('0xf')]);router[_0xc255('0x9')](_0xc255('0x10'),auth[_0xc255('0xc')](),controller[_0xc255('0x11')]);router[_0xc255('0x9')](_0xc255('0x12'),auth[_0xc255('0xc')](),controller['getTags']);router[_0xc255('0x13')]('/',auth[_0xc255('0xc')](),controller['create']);router[_0xc255('0x13')](_0xc255('0x12'),auth[_0xc255('0xc')](),controller['setTags']);router[_0xc255('0x14')](_0xc255('0xb'),auth[_0xc255('0xc')](),controller[_0xc255('0x15')]);router['delete'](_0xc255('0xb'),auth['isAuthenticated'](),controller[_0xc255('0x16')]);module[_0xc255('0x17')]=router; \ No newline at end of file +var _0x6968=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','update','delete','util','path','connect-timeout'];(function(_0x8b638d,_0x587369){var _0x37ff56=function(_0x51c3de){while(--_0x51c3de){_0x8b638d['push'](_0x8b638d['shift']());}};_0x37ff56(++_0x587369);}(_0x6968,0x6b));var _0x8696=function(_0x3f4027,_0x221cbb){_0x3f4027=_0x3f4027-0x0;var _0x4aea2e=_0x6968[_0x3f4027];return _0x4aea2e;};'use strict';var multer=require('multer');var util=require(_0x8696('0x0'));var path=require(_0x8696('0x1'));var timeout=require(_0x8696('0x2'));var express=require('express');var router=express[_0x8696('0x3')]();var fs_extra=require(_0x8696('0x4'));var auth=require(_0x8696('0x5'));var interaction=require(_0x8696('0x6'));var config=require(_0x8696('0x7'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x8696('0x8')]('/',auth[_0x8696('0x9')](),controller['index']);router['get'](_0x8696('0xa'),auth['isAuthenticated'](),controller[_0x8696('0xb')]);router['get'](_0x8696('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x8696('0x8')](_0x8696('0xd'),auth[_0x8696('0x9')](),controller['getSubjects']);router[_0x8696('0x8')](_0x8696('0xe'),auth['isAuthenticated'](),controller[_0x8696('0xf')]);router[_0x8696('0x8')](_0x8696('0x10'),auth[_0x8696('0x9')](),controller[_0x8696('0x11')]);router[_0x8696('0x12')]('/',auth[_0x8696('0x9')](),controller['create']);router[_0x8696('0x12')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8696('0x13')]);router['put'](_0x8696('0xa'),auth['isAuthenticated'](),controller[_0x8696('0x14')]);router[_0x8696('0x15')]('/:id',auth[_0x8696('0x9')](),controller['destroy']);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 7a74bd8..29b0c5a 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 _0xafcd=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xafcd,0x1d6));var _0xdafc=function(_0x425b10,_0xe4cbbe){_0x425b10=_0x425b10-0x0;var _0x1eecfe=_0xafcd[_0x425b10];return _0x1eecfe;};'use strict';var Sequelize=require(_0xdafc('0x0'));module[_0xdafc('0x1')]={'name':{'type':Sequelize[_0xdafc('0x2')]},'description':{'type':Sequelize[_0xdafc('0x2')]}}; \ No newline at end of file +var _0x95f6=['exports','STRING','sequelize'];(function(_0x4f7ad9,_0x3f6377){var _0x4a9c7c=function(_0x11d791){while(--_0x11d791){_0x4f7ad9['push'](_0x4f7ad9['shift']());}};_0x4a9c7c(++_0x3f6377);}(_0x95f6,0x1d3));var _0x695f=function(_0x4e7fbe,_0x585460){_0x4e7fbe=_0x4e7fbe-0x0;var _0x2e2277=_0x95f6[_0x4e7fbe];return _0x2e2277;};'use strict';var Sequelize=require(_0x695f('0x0'));module[_0x695f('0x1')]={'name':{'type':Sequelize[_0x695f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 66d5a49..7c7aba3 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 _0x509e=['rows','catch','show','include','options','find','create','body','params','destroy','findOne','FreshdeskField','nolimit','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','update','then','sendStatus','error','stack','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll'];(function(_0xba7593,_0x1593c6){var _0x439229=function(_0x51d82c){while(--_0x51d82c){_0xba7593['push'](_0xba7593['shift']());}};_0x439229(++_0x1593c6);}(_0x509e,0xb5));var _0xe509=function(_0xf3e2f6,_0x3953c2){_0xf3e2f6=_0xf3e2f6-0x0;var _0x48dbad=_0x509e[_0xf3e2f6];return _0x48dbad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe509('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe509('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe509('0x2'));var util=require(_0xe509('0x3'));var path=require(_0xe509('0x4'));var sox=require(_0xe509('0x5'));var csv=require(_0xe509('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe509('0x7'));var _=require(_0xe509('0x8'));var squel=require(_0xe509('0x9'));var crypto=require('crypto');var jsforce=require(_0xe509('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe509('0x6'));var querystring=require(_0xe509('0xb'));var Papa=require(_0xe509('0xc'));var Redis=require(_0xe509('0xd'));var authService=require(_0xe509('0xe'));var qs=require(_0xe509('0xf'));var as=require(_0xe509('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe509('0x11'))(_0xe509('0x12'));var utils=require('../../config/utils');var config=require(_0xe509('0x13'));var licenseUtil=require(_0xe509('0x14'));var db=require(_0xe509('0x15'))['db'];function respondWithStatusCode(_0x21c47b,_0x5cec30){_0x5cec30=_0x5cec30||0xcc;return function(_0x302ffe){if(_0x302ffe){return _0x21c47b['sendStatus'](_0x5cec30);}return _0x21c47b[_0xe509('0x16')](_0x5cec30)[_0xe509('0x17')]();};}function respondWithResult(_0x2fbfd1,_0x5ec285){_0x5ec285=_0x5ec285||0xc8;return function(_0x4e1375){if(_0x4e1375){return _0x2fbfd1[_0xe509('0x16')](_0x5ec285)[_0xe509('0x18')](_0x4e1375);}};}function respondWithFilteredResult(_0x1b03aa,_0x279eb1){return function(_0x560074){if(_0x560074){var _0x12a519=typeof _0x279eb1[_0xe509('0x19')]===_0xe509('0x1a')&&typeof _0x279eb1[_0xe509('0x1b')]===_0xe509('0x1a');var _0x444cf0=_0x560074[_0xe509('0x1c')];var _0x3ab1ab=_0x12a519?0x0:_0x279eb1[_0xe509('0x19')];var _0x1f38f7=_0x12a519?_0x560074['count']:_0x279eb1[_0xe509('0x19')]+_0x279eb1['limit'];var _0x9edaa2;if(_0x1f38f7>=_0x444cf0){_0x1f38f7=_0x444cf0;_0x9edaa2=0xc8;}else{_0x9edaa2=0xce;}_0x1b03aa[_0xe509('0x16')](_0x9edaa2);return _0x1b03aa['set'](_0xe509('0x1d'),_0x3ab1ab+'-'+_0x1f38f7+'/'+_0x444cf0)[_0xe509('0x18')](_0x560074);}return null;};}function patchUpdates(_0x2346c7){return function(_0x4150a1){try{jsonpatch['apply'](_0x4150a1,_0x2346c7,!![]);}catch(_0x34df79){return BPromise['reject'](_0x34df79);}return _0x4150a1['save']();};}function saveUpdates(_0x20123e,_0x1ce5f5){return function(_0x4d2e94){if(_0x4d2e94){return _0x4d2e94[_0xe509('0x1e')](_0x20123e)[_0xe509('0x1f')](function(_0x32fdf8){return _0x32fdf8;});}return null;};}function removeEntity(_0x2bdad0,_0x5849fb){return function(_0x2a47b3){if(_0x2a47b3){return _0x2a47b3['destroy']()[_0xe509('0x1f')](function(){_0x2bdad0[_0xe509('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3665f0,_0x4026e2){return function(_0x4a7be6){if(!_0x4a7be6){_0x3665f0[_0xe509('0x20')](0x194);}return _0x4a7be6;};}function handleError(_0x59b4a4,_0x241ed1){_0x241ed1=_0x241ed1||0x1f4;return function(_0x6b376e){logger[_0xe509('0x21')](_0x6b376e[_0xe509('0x22')]);if(_0x6b376e['name']){delete _0x6b376e['name'];}_0x59b4a4[_0xe509('0x16')](_0x241ed1)[_0xe509('0x23')](_0x6b376e);};}exports[_0xe509('0x24')]=function(_0x574a89,_0x147adf){var _0x2f5e27={},_0xd8cb9={},_0x3c6d3c={'count':0x0,'rows':[]};var _0x17c73b=_[_0xe509('0x25')](db[_0xe509('0x26')][_0xe509('0x27')],function(_0x59cdb1){return{'name':_0x59cdb1[_0xe509('0x28')],'type':_0x59cdb1[_0xe509('0x29')][_0xe509('0x2a')]};});_0xd8cb9[_0xe509('0x2b')]=_[_0xe509('0x25')](_0x17c73b,_0xe509('0x2c'));_0xd8cb9[_0xe509('0x2d')]=_[_0xe509('0x2e')](_0x574a89['query']);_0xd8cb9[_0xe509('0x2f')]=_[_0xe509('0x30')](_0xd8cb9[_0xe509('0x2b')],_0xd8cb9['query']);_0x2f5e27['attributes']=_[_0xe509('0x30')](_0xd8cb9[_0xe509('0x2b')],qs[_0xe509('0x31')](_0x574a89['query'][_0xe509('0x31')]));_0x2f5e27[_0xe509('0x32')]=_0x2f5e27[_0xe509('0x32')][_0xe509('0x33')]?_0x2f5e27[_0xe509('0x32')]:_0xd8cb9['model'];if(!_0x574a89['query'][_0xe509('0x34')]('nolimit')){_0x2f5e27[_0xe509('0x1b')]=qs[_0xe509('0x1b')](_0x574a89[_0xe509('0x2d')][_0xe509('0x1b')]);_0x2f5e27['offset']=qs[_0xe509('0x19')](_0x574a89[_0xe509('0x2d')][_0xe509('0x19')]);}_0x2f5e27[_0xe509('0x35')]=qs[_0xe509('0x36')](_0x574a89[_0xe509('0x2d')]['sort']);_0x2f5e27[_0xe509('0x37')]=qs[_0xe509('0x2f')](_[_0xe509('0x38')](_0x574a89[_0xe509('0x2d')],_0xd8cb9['filters']),_0x17c73b);if(_0x574a89[_0xe509('0x2d')]['filter']){_0x2f5e27[_0xe509('0x37')]=_[_0xe509('0x39')](_0x2f5e27[_0xe509('0x37')],{'$or':_[_0xe509('0x25')](_0x17c73b,function(_0x12cdfd){if(_0x12cdfd['type']!==_0xe509('0x3a')){var _0x2f9aee={};_0x2f9aee[_0x12cdfd[_0xe509('0x2c')]]={'$like':'%'+_0x574a89[_0xe509('0x2d')][_0xe509('0x3b')]+'%'};return _0x2f9aee;}})});}_0x2f5e27=_[_0xe509('0x39')]({},_0x2f5e27,_0x574a89['options']);var _0x49ce3d={'where':_0x2f5e27['where']};return db['FreshdeskConfiguration'][_0xe509('0x1c')](_0x49ce3d)[_0xe509('0x1f')](function(_0x6413a1){_0x3c6d3c[_0xe509('0x1c')]=_0x6413a1;if(_0x574a89[_0xe509('0x2d')][_0xe509('0x3c')]){_0x2f5e27['include']=[{'all':!![]}];}return db[_0xe509('0x26')][_0xe509('0x3d')](_0x2f5e27);})[_0xe509('0x1f')](function(_0x5dcccd){_0x3c6d3c[_0xe509('0x3e')]=_0x5dcccd;return _0x3c6d3c;})[_0xe509('0x1f')](respondWithFilteredResult(_0x147adf,_0x2f5e27))[_0xe509('0x3f')](handleError(_0x147adf,null));};exports[_0xe509('0x40')]=function(_0x1bb438,_0xa044c5){var _0x237ec9={'raw':![],'where':{'id':_0x1bb438['params']['id']}},_0x346d53={};_0x346d53[_0xe509('0x2b')]=_[_0xe509('0x2e')](db[_0xe509('0x26')]['rawAttributes']);_0x346d53[_0xe509('0x2d')]=_[_0xe509('0x2e')](_0x1bb438[_0xe509('0x2d')]);_0x346d53[_0xe509('0x2f')]=_['intersection'](_0x346d53[_0xe509('0x2b')],_0x346d53['query']);_0x237ec9[_0xe509('0x32')]=_[_0xe509('0x30')](_0x346d53[_0xe509('0x2b')],qs[_0xe509('0x31')](_0x1bb438['query'][_0xe509('0x31')]));_0x237ec9[_0xe509('0x32')]=_0x237ec9[_0xe509('0x32')][_0xe509('0x33')]?_0x237ec9['attributes']:_0x346d53[_0xe509('0x2b')];if(_0x1bb438[_0xe509('0x2d')]['includeAll']){_0x237ec9[_0xe509('0x41')]=[{'all':!![]}];}_0x237ec9=_[_0xe509('0x39')]({},_0x237ec9,_0x1bb438[_0xe509('0x42')]);return db[_0xe509('0x26')][_0xe509('0x43')](_0x237ec9)[_0xe509('0x1f')](handleEntityNotFound(_0xa044c5,null))[_0xe509('0x1f')](respondWithResult(_0xa044c5,null))[_0xe509('0x3f')](handleError(_0xa044c5,null));};exports[_0xe509('0x44')]=function(_0x3951f7,_0x1be597){return db[_0xe509('0x26')][_0xe509('0x44')](_0x3951f7[_0xe509('0x45')],{})['then'](respondWithResult(_0x1be597,0xc9))[_0xe509('0x3f')](handleError(_0x1be597,null));};exports['update']=function(_0x4ba1d5,_0x266556){if(_0x4ba1d5['body']['id']){delete _0x4ba1d5[_0xe509('0x45')]['id'];}return db[_0xe509('0x26')]['find']({'where':{'id':_0x4ba1d5[_0xe509('0x46')]['id']}})[_0xe509('0x1f')](handleEntityNotFound(_0x266556,null))[_0xe509('0x1f')](saveUpdates(_0x4ba1d5[_0xe509('0x45')],null))[_0xe509('0x1f')](respondWithResult(_0x266556,null))[_0xe509('0x3f')](handleError(_0x266556,null));};exports[_0xe509('0x47')]=function(_0x34fcaf,_0xa5cbe8){return db[_0xe509('0x26')][_0xe509('0x43')]({'where':{'id':_0x34fcaf[_0xe509('0x46')]['id']}})[_0xe509('0x1f')](handleEntityNotFound(_0xa5cbe8,null))['then'](removeEntity(_0xa5cbe8,null))[_0xe509('0x3f')](handleError(_0xa5cbe8,null));};exports['getFields']=function(_0x5ac3cd,_0xc9e3db,_0x2c3a09){var _0x45acbb={};var _0x405afc={};var _0x53b81d;var _0x536b3c;return db[_0xe509('0x26')][_0xe509('0x48')]({'where':{'id':_0x5ac3cd['params']['id']}})[_0xe509('0x1f')](handleEntityNotFound(_0xc9e3db,null))[_0xe509('0x1f')](function(_0x1c35c4){if(_0x1c35c4){_0x53b81d=_0x1c35c4;_0x405afc[_0xe509('0x2b')]=_['keys'](db[_0xe509('0x49')][_0xe509('0x27')]);_0x405afc['query']=_[_0xe509('0x2e')](_0x5ac3cd['query']);_0x405afc['filters']=_[_0xe509('0x30')](_0x405afc[_0xe509('0x2b')],_0x405afc[_0xe509('0x2d')]);_0x45acbb[_0xe509('0x32')]=_[_0xe509('0x30')](_0x405afc['model'],qs[_0xe509('0x31')](_0x5ac3cd[_0xe509('0x2d')][_0xe509('0x31')]));_0x45acbb['attributes']=_0x45acbb[_0xe509('0x32')]['length']?_0x45acbb['attributes']:_0x405afc['model'];_0x45acbb[_0xe509('0x35')]=qs['sort'](_0x5ac3cd[_0xe509('0x2d')][_0xe509('0x36')]);_0x45acbb[_0xe509('0x37')]=qs[_0xe509('0x2f')](_[_0xe509('0x38')](_0x5ac3cd[_0xe509('0x2d')],_0x405afc['filters']));if(_0x5ac3cd[_0xe509('0x2d')][_0xe509('0x3b')]){_0x45acbb[_0xe509('0x37')]=_[_0xe509('0x39')](_0x45acbb[_0xe509('0x37')],{'$or':_[_0xe509('0x25')](_0x45acbb[_0xe509('0x32')],function(_0x249e09){var _0x5583e2={};_0x5583e2[_0x249e09]={'$like':'%'+_0x5ac3cd[_0xe509('0x2d')][_0xe509('0x3b')]+'%'};return _0x5583e2;})});}_0x45acbb=_[_0xe509('0x39')]({},_0x45acbb,_0x5ac3cd[_0xe509('0x42')]);return _0x53b81d['getFields'](_0x45acbb);}})['then'](function(_0x21a06d){if(_0x21a06d){_0x536b3c=_0x21a06d['length'];if(!_0x5ac3cd[_0xe509('0x2d')][_0xe509('0x34')](_0xe509('0x4a'))){_0x45acbb[_0xe509('0x1b')]=qs[_0xe509('0x1b')](_0x5ac3cd[_0xe509('0x2d')][_0xe509('0x1b')]);_0x45acbb[_0xe509('0x19')]=qs[_0xe509('0x19')](_0x5ac3cd[_0xe509('0x2d')][_0xe509('0x19')]);}return _0x53b81d[_0xe509('0x4b')](_0x45acbb);}})['then'](function(_0x31bd53){if(_0x31bd53){return _0x31bd53?{'count':_0x536b3c,'rows':_0x31bd53}:null;}})[_0xe509('0x1f')](respondWithResult(_0xc9e3db,null))[_0xe509('0x3f')](handleError(_0xc9e3db,null));};exports[_0xe509('0x4c')]=function(_0x5af0d4,_0x402c8d,_0x348a58){var _0x1ab068={};var _0x59ecd0={};var _0x4fd84a;var _0x365e0b;return db['FreshdeskConfiguration'][_0xe509('0x48')]({'where':{'id':_0x5af0d4[_0xe509('0x46')]['id']}})[_0xe509('0x1f')](handleEntityNotFound(_0x402c8d,null))['then'](function(_0x41bdd6){if(_0x41bdd6){_0x4fd84a=_0x41bdd6;_0x59ecd0[_0xe509('0x2b')]=_[_0xe509('0x2e')](db[_0xe509('0x49')][_0xe509('0x27')]);_0x59ecd0[_0xe509('0x2d')]=_[_0xe509('0x2e')](_0x5af0d4['query']);_0x59ecd0[_0xe509('0x2f')]=_[_0xe509('0x30')](_0x59ecd0[_0xe509('0x2b')],_0x59ecd0['query']);_0x1ab068[_0xe509('0x32')]=_[_0xe509('0x30')](_0x59ecd0[_0xe509('0x2b')],qs[_0xe509('0x31')](_0x5af0d4[_0xe509('0x2d')][_0xe509('0x31')]));_0x1ab068['attributes']=_0x1ab068[_0xe509('0x32')][_0xe509('0x33')]?_0x1ab068['attributes']:_0x59ecd0[_0xe509('0x2b')];_0x1ab068[_0xe509('0x35')]=qs[_0xe509('0x36')](_0x5af0d4['query'][_0xe509('0x36')]);_0x1ab068[_0xe509('0x37')]=qs['filters'](_[_0xe509('0x38')](_0x5af0d4[_0xe509('0x2d')],_0x59ecd0[_0xe509('0x2f')]));if(_0x5af0d4['query'][_0xe509('0x3b')]){_0x1ab068[_0xe509('0x37')]=_[_0xe509('0x39')](_0x1ab068[_0xe509('0x37')],{'$or':_['map'](_0x1ab068['attributes'],function(_0x974e60){var _0x44008c={};_0x44008c[_0x974e60]={'$like':'%'+_0x5af0d4[_0xe509('0x2d')][_0xe509('0x3b')]+'%'};return _0x44008c;})});}_0x1ab068=_['merge']({},_0x1ab068,_0x5af0d4[_0xe509('0x42')]);return _0x4fd84a[_0xe509('0x4c')](_0x1ab068);}})[_0xe509('0x1f')](function(_0x9a6d43){if(_0x9a6d43){_0x365e0b=_0x9a6d43[_0xe509('0x33')];if(!_0x5af0d4[_0xe509('0x2d')][_0xe509('0x34')]('nolimit')){_0x1ab068[_0xe509('0x1b')]=qs[_0xe509('0x1b')](_0x5af0d4['query'][_0xe509('0x1b')]);_0x1ab068[_0xe509('0x19')]=qs['offset'](_0x5af0d4[_0xe509('0x2d')]['offset']);}return _0x4fd84a['getSubjects'](_0x1ab068);}})[_0xe509('0x1f')](function(_0x3fabe7){if(_0x3fabe7){return _0x3fabe7?{'count':_0x365e0b,'rows':_0x3fabe7}:null;}})[_0xe509('0x1f')](respondWithResult(_0x402c8d,null))[_0xe509('0x3f')](handleError(_0x402c8d,null));};exports[_0xe509('0x4d')]=function(_0x4bcd3b,_0x344f17,_0xcae0b8){var _0x597f20={};var _0x1a0ce7={};var _0x274334;var _0x65703d;return db[_0xe509('0x26')][_0xe509('0x48')]({'where':{'id':_0x4bcd3b[_0xe509('0x46')]['id']}})['then'](handleEntityNotFound(_0x344f17,null))['then'](function(_0x1cf502){if(_0x1cf502){_0x274334=_0x1cf502;_0x1a0ce7[_0xe509('0x2b')]=_[_0xe509('0x2e')](db[_0xe509('0x49')][_0xe509('0x27')]);_0x1a0ce7[_0xe509('0x2d')]=_['keys'](_0x4bcd3b[_0xe509('0x2d')]);_0x1a0ce7[_0xe509('0x2f')]=_[_0xe509('0x30')](_0x1a0ce7['model'],_0x1a0ce7[_0xe509('0x2d')]);_0x597f20[_0xe509('0x32')]=_['intersection'](_0x1a0ce7[_0xe509('0x2b')],qs[_0xe509('0x31')](_0x4bcd3b[_0xe509('0x2d')][_0xe509('0x31')]));_0x597f20['attributes']=_0x597f20[_0xe509('0x32')][_0xe509('0x33')]?_0x597f20[_0xe509('0x32')]:_0x1a0ce7['model'];_0x597f20['order']=qs[_0xe509('0x36')](_0x4bcd3b[_0xe509('0x2d')][_0xe509('0x36')]);_0x597f20[_0xe509('0x37')]=qs[_0xe509('0x2f')](_[_0xe509('0x38')](_0x4bcd3b[_0xe509('0x2d')],_0x1a0ce7[_0xe509('0x2f')]));if(_0x4bcd3b[_0xe509('0x2d')][_0xe509('0x3b')]){_0x597f20[_0xe509('0x37')]=_[_0xe509('0x39')](_0x597f20[_0xe509('0x37')],{'$or':_[_0xe509('0x25')](_0x597f20[_0xe509('0x32')],function(_0x147d4b){var _0x521ecc={};_0x521ecc[_0x147d4b]={'$like':'%'+_0x4bcd3b[_0xe509('0x2d')][_0xe509('0x3b')]+'%'};return _0x521ecc;})});}_0x597f20=_['merge']({},_0x597f20,_0x4bcd3b[_0xe509('0x42')]);return _0x274334[_0xe509('0x4d')](_0x597f20);}})[_0xe509('0x1f')](function(_0x9949a5){if(_0x9949a5){_0x65703d=_0x9949a5[_0xe509('0x33')];if(!_0x4bcd3b[_0xe509('0x2d')][_0xe509('0x34')]('nolimit')){_0x597f20[_0xe509('0x1b')]=qs[_0xe509('0x1b')](_0x4bcd3b['query'][_0xe509('0x1b')]);_0x597f20[_0xe509('0x19')]=qs[_0xe509('0x19')](_0x4bcd3b['query'][_0xe509('0x19')]);}return _0x274334['getDescriptions'](_0x597f20);}})[_0xe509('0x1f')](function(_0x30605b){if(_0x30605b){return _0x30605b?{'count':_0x65703d,'rows':_0x30605b}:null;}})[_0xe509('0x1f')](respondWithResult(_0x344f17,null))[_0xe509('0x3f')](handleError(_0x344f17,null));};exports[_0xe509('0x4e')]=function(_0x58ac15,_0x14dc1d,_0x1c11d2){var _0x2693bb={};var _0x2bea7b={};var _0x599791;var _0x5bbb56;return db[_0xe509('0x26')][_0xe509('0x48')]({'where':{'id':_0x58ac15[_0xe509('0x46')]['id']}})['then'](handleEntityNotFound(_0x14dc1d,null))[_0xe509('0x1f')](function(_0x36dbbb){if(_0x36dbbb){_0x599791=_0x36dbbb;_0x2bea7b[_0xe509('0x2b')]=_[_0xe509('0x2e')](db[_0xe509('0x4f')][_0xe509('0x27')]);_0x2bea7b[_0xe509('0x2d')]=_[_0xe509('0x2e')](_0x58ac15[_0xe509('0x2d')]);_0x2bea7b[_0xe509('0x2f')]=_['intersection'](_0x2bea7b[_0xe509('0x2b')],_0x2bea7b[_0xe509('0x2d')]);_0x2693bb[_0xe509('0x32')]=_[_0xe509('0x30')](_0x2bea7b[_0xe509('0x2b')],qs[_0xe509('0x31')](_0x58ac15[_0xe509('0x2d')][_0xe509('0x31')]));_0x2693bb['attributes']=_0x2693bb[_0xe509('0x32')][_0xe509('0x33')]?_0x2693bb[_0xe509('0x32')]:_0x2bea7b[_0xe509('0x2b')];_0x2693bb[_0xe509('0x35')]=qs[_0xe509('0x36')](_0x58ac15['query'][_0xe509('0x36')]);_0x2693bb[_0xe509('0x37')]=qs['filters'](_[_0xe509('0x38')](_0x58ac15[_0xe509('0x2d')],_0x2bea7b[_0xe509('0x2f')]));if(_0x58ac15[_0xe509('0x2d')][_0xe509('0x3b')]){_0x2693bb[_0xe509('0x37')]=_[_0xe509('0x39')](_0x2693bb[_0xe509('0x37')],{'$or':_['map'](_0x2693bb[_0xe509('0x32')],function(_0x383b57){var _0x3de9db={};_0x3de9db[_0x383b57]={'$like':'%'+_0x58ac15['query'][_0xe509('0x3b')]+'%'};return _0x3de9db;})});}_0x2693bb=_[_0xe509('0x39')]({},_0x2693bb,_0x58ac15['options']);return _0x599791[_0xe509('0x4e')](_0x2693bb);}})[_0xe509('0x1f')](function(_0x434d85){if(_0x434d85){_0x5bbb56=_0x434d85[_0xe509('0x33')];if(!_0x58ac15['query']['hasOwnProperty'](_0xe509('0x4a'))){_0x2693bb[_0xe509('0x1b')]=qs['limit'](_0x58ac15[_0xe509('0x2d')][_0xe509('0x1b')]);_0x2693bb[_0xe509('0x19')]=qs[_0xe509('0x19')](_0x58ac15[_0xe509('0x2d')][_0xe509('0x19')]);}return _0x599791['getTags'](_0x2693bb);}})[_0xe509('0x1f')](function(_0xa3c60e){if(_0xa3c60e){return _0xa3c60e?{'count':_0x5bbb56,'rows':_0xa3c60e}:null;}})[_0xe509('0x1f')](respondWithResult(_0x14dc1d,null))[_0xe509('0x3f')](handleError(_0x14dc1d,null));};exports[_0xe509('0x50')]=function(_0x405e7e,_0x402060,_0x5c85e8){if(_0x405e7e[_0xe509('0x45')]['id']){delete _0x405e7e['body']['id'];}return db['FreshdeskConfiguration'][_0xe509('0x48')]({'where':{'id':_0x405e7e['params']['id']}})['then'](handleEntityNotFound(_0x402060,null))['then'](function(_0x4bf9d2){if(_0x4bf9d2){return _0x4bf9d2[_0xe509('0x50')](_0x405e7e[_0xe509('0x45')]['ids']||[]);}return null;})['then'](respondWithResult(_0x402060,null))['catch'](handleError(_0x402060,null));}; \ No newline at end of file +var _0x1b7d=['model','keys','query','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','then','includeAll','include','rows','catch','show','find','create','body','params','destroy','getFields','findOne','FreshdeskField','order','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','limit','undefined','count','offset','Content-Range','reject','save','update','sendStatus','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key'];(function(_0x1e1432,_0x51a3d7){var _0x37c5a8=function(_0x4881b9){while(--_0x4881b9){_0x1e1432['push'](_0x1e1432['shift']());}};_0x37c5a8(++_0x51a3d7);}(_0x1b7d,0xd3));var _0xd1b7=function(_0x40d199,_0x268cf9){_0x40d199=_0x40d199-0x0;var _0x9fe4ac=_0x1b7d[_0x40d199];return _0x9fe4ac;};'use strict';var emlformat=require(_0xd1b7('0x0'));var rimraf=require(_0xd1b7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd1b7('0x2'));var moment=require(_0xd1b7('0x3'));var BPromise=require(_0xd1b7('0x4'));var Mustache=require('mustache');var util=require(_0xd1b7('0x5'));var path=require(_0xd1b7('0x6'));var sox=require(_0xd1b7('0x7'));var csv=require(_0xd1b7('0x8'));var ejs=require(_0xd1b7('0x9'));var fs=require('fs');var fs_extra=require(_0xd1b7('0xa'));var _=require(_0xd1b7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd1b7('0xc'));var deskjs=require(_0xd1b7('0xd'));var toCsv=require(_0xd1b7('0x8'));var querystring=require(_0xd1b7('0xe'));var Papa=require(_0xd1b7('0xf'));var Redis=require(_0xd1b7('0x10'));var authService=require(_0xd1b7('0x11'));var qs=require(_0xd1b7('0x12'));var as=require(_0xd1b7('0x13'));var hardwareService=require(_0xd1b7('0x14'));var logger=require(_0xd1b7('0x15'))(_0xd1b7('0x16'));var utils=require(_0xd1b7('0x17'));var config=require(_0xd1b7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1b7('0x19'))['db'];function respondWithStatusCode(_0x1d71b8,_0x1d1c04){_0x1d1c04=_0x1d1c04||0xcc;return function(_0x244428){if(_0x244428){return _0x1d71b8['sendStatus'](_0x1d1c04);}return _0x1d71b8[_0xd1b7('0x1a')](_0x1d1c04)[_0xd1b7('0x1b')]();};}function respondWithResult(_0xae45cf,_0x54b60e){_0x54b60e=_0x54b60e||0xc8;return function(_0x5fedf4){if(_0x5fedf4){return _0xae45cf[_0xd1b7('0x1a')](_0x54b60e)['json'](_0x5fedf4);}};}function respondWithFilteredResult(_0x57bf34,_0x28d61a){return function(_0x393697){if(_0x393697){var _0x4700f3=typeof _0x28d61a['offset']==='undefined'&&typeof _0x28d61a[_0xd1b7('0x1c')]===_0xd1b7('0x1d');var _0x26ba2c=_0x393697[_0xd1b7('0x1e')];var _0x5bd27d=_0x4700f3?0x0:_0x28d61a[_0xd1b7('0x1f')];var _0x3089bc=_0x4700f3?_0x393697['count']:_0x28d61a[_0xd1b7('0x1f')]+_0x28d61a[_0xd1b7('0x1c')];var _0x50f481;if(_0x3089bc>=_0x26ba2c){_0x3089bc=_0x26ba2c;_0x50f481=0xc8;}else{_0x50f481=0xce;}_0x57bf34[_0xd1b7('0x1a')](_0x50f481);return _0x57bf34['set'](_0xd1b7('0x20'),_0x5bd27d+'-'+_0x3089bc+'/'+_0x26ba2c)['json'](_0x393697);}return null;};}function patchUpdates(_0x55667a){return function(_0x4bd0c2){try{jsonpatch['apply'](_0x4bd0c2,_0x55667a,!![]);}catch(_0x27e694){return BPromise[_0xd1b7('0x21')](_0x27e694);}return _0x4bd0c2[_0xd1b7('0x22')]();};}function saveUpdates(_0x9643c3,_0xefdbdb){return function(_0x246e16){if(_0x246e16){return _0x246e16[_0xd1b7('0x23')](_0x9643c3)['then'](function(_0x3ffb20){return _0x3ffb20;});}return null;};}function removeEntity(_0x55ddb0,_0x3f0f3d){return function(_0x3920db){if(_0x3920db){return _0x3920db['destroy']()['then'](function(){_0x55ddb0[_0xd1b7('0x1a')](0xcc)[_0xd1b7('0x1b')]();});}};}function handleEntityNotFound(_0x34e812,_0x2daf1e){return function(_0x376d17){if(!_0x376d17){_0x34e812[_0xd1b7('0x24')](0x194);}return _0x376d17;};}function handleError(_0x46addd,_0x20a540){_0x20a540=_0x20a540||0x1f4;return function(_0x52bd0d){logger[_0xd1b7('0x25')](_0x52bd0d[_0xd1b7('0x26')]);if(_0x52bd0d[_0xd1b7('0x27')]){delete _0x52bd0d[_0xd1b7('0x27')];}_0x46addd['status'](_0x20a540)[_0xd1b7('0x28')](_0x52bd0d);};}exports[_0xd1b7('0x29')]=function(_0x23011b,_0x5cf9f1){var _0xb0e5fe={},_0x2232f6={},_0x3c1147={'count':0x0,'rows':[]};var _0x8a0c8d=_[_0xd1b7('0x2a')](db[_0xd1b7('0x2b')][_0xd1b7('0x2c')],function(_0x340311){return{'name':_0x340311[_0xd1b7('0x2d')],'type':_0x340311['type'][_0xd1b7('0x2e')]};});_0x2232f6[_0xd1b7('0x2f')]=_[_0xd1b7('0x2a')](_0x8a0c8d,'name');_0x2232f6['query']=_[_0xd1b7('0x30')](_0x23011b[_0xd1b7('0x31')]);_0x2232f6['filters']=_['intersection'](_0x2232f6[_0xd1b7('0x2f')],_0x2232f6[_0xd1b7('0x31')]);_0xb0e5fe[_0xd1b7('0x32')]=_[_0xd1b7('0x33')](_0x2232f6[_0xd1b7('0x2f')],qs['fields'](_0x23011b[_0xd1b7('0x31')][_0xd1b7('0x34')]));_0xb0e5fe[_0xd1b7('0x32')]=_0xb0e5fe[_0xd1b7('0x32')][_0xd1b7('0x35')]?_0xb0e5fe['attributes']:_0x2232f6[_0xd1b7('0x2f')];if(!_0x23011b[_0xd1b7('0x31')][_0xd1b7('0x36')]('nolimit')){_0xb0e5fe[_0xd1b7('0x1c')]=qs['limit'](_0x23011b[_0xd1b7('0x31')][_0xd1b7('0x1c')]);_0xb0e5fe[_0xd1b7('0x1f')]=qs[_0xd1b7('0x1f')](_0x23011b[_0xd1b7('0x31')]['offset']);}_0xb0e5fe['order']=qs[_0xd1b7('0x37')](_0x23011b[_0xd1b7('0x31')][_0xd1b7('0x37')]);_0xb0e5fe['where']=qs[_0xd1b7('0x38')](_[_0xd1b7('0x39')](_0x23011b[_0xd1b7('0x31')],_0x2232f6['filters']),_0x8a0c8d);if(_0x23011b[_0xd1b7('0x31')][_0xd1b7('0x3a')]){_0xb0e5fe[_0xd1b7('0x3b')]=_[_0xd1b7('0x3c')](_0xb0e5fe[_0xd1b7('0x3b')],{'$or':_['map'](_0x8a0c8d,function(_0x3b509c){if(_0x3b509c[_0xd1b7('0x3d')]!==_0xd1b7('0x3e')){var _0x5aeba9={};_0x5aeba9[_0x3b509c[_0xd1b7('0x27')]]={'$like':'%'+_0x23011b[_0xd1b7('0x31')][_0xd1b7('0x3a')]+'%'};return _0x5aeba9;}})});}_0xb0e5fe=_[_0xd1b7('0x3c')]({},_0xb0e5fe,_0x23011b[_0xd1b7('0x3f')]);var _0x2d48a3={'where':_0xb0e5fe[_0xd1b7('0x3b')]};return db[_0xd1b7('0x2b')][_0xd1b7('0x1e')](_0x2d48a3)[_0xd1b7('0x40')](function(_0x2f88fa){_0x3c1147[_0xd1b7('0x1e')]=_0x2f88fa;if(_0x23011b['query'][_0xd1b7('0x41')]){_0xb0e5fe[_0xd1b7('0x42')]=[{'all':!![]}];}return db[_0xd1b7('0x2b')]['findAll'](_0xb0e5fe);})['then'](function(_0x2efcf1){_0x3c1147[_0xd1b7('0x43')]=_0x2efcf1;return _0x3c1147;})[_0xd1b7('0x40')](respondWithFilteredResult(_0x5cf9f1,_0xb0e5fe))[_0xd1b7('0x44')](handleError(_0x5cf9f1,null));};exports[_0xd1b7('0x45')]=function(_0x2d2a9b,_0x5f1f7b){var _0x240463={'raw':![],'where':{'id':_0x2d2a9b['params']['id']}},_0x3a05c7={};_0x3a05c7[_0xd1b7('0x2f')]=_[_0xd1b7('0x30')](db[_0xd1b7('0x2b')]['rawAttributes']);_0x3a05c7[_0xd1b7('0x31')]=_[_0xd1b7('0x30')](_0x2d2a9b[_0xd1b7('0x31')]);_0x3a05c7[_0xd1b7('0x38')]=_[_0xd1b7('0x33')](_0x3a05c7[_0xd1b7('0x2f')],_0x3a05c7[_0xd1b7('0x31')]);_0x240463[_0xd1b7('0x32')]=_['intersection'](_0x3a05c7[_0xd1b7('0x2f')],qs[_0xd1b7('0x34')](_0x2d2a9b['query']['fields']));_0x240463[_0xd1b7('0x32')]=_0x240463[_0xd1b7('0x32')]['length']?_0x240463['attributes']:_0x3a05c7[_0xd1b7('0x2f')];if(_0x2d2a9b[_0xd1b7('0x31')][_0xd1b7('0x41')]){_0x240463[_0xd1b7('0x42')]=[{'all':!![]}];}_0x240463=_[_0xd1b7('0x3c')]({},_0x240463,_0x2d2a9b[_0xd1b7('0x3f')]);return db[_0xd1b7('0x2b')][_0xd1b7('0x46')](_0x240463)[_0xd1b7('0x40')](handleEntityNotFound(_0x5f1f7b,null))['then'](respondWithResult(_0x5f1f7b,null))[_0xd1b7('0x44')](handleError(_0x5f1f7b,null));};exports[_0xd1b7('0x47')]=function(_0xfe3cee,_0x9511ba){return db[_0xd1b7('0x2b')][_0xd1b7('0x47')](_0xfe3cee[_0xd1b7('0x48')],{})[_0xd1b7('0x40')](respondWithResult(_0x9511ba,0xc9))[_0xd1b7('0x44')](handleError(_0x9511ba,null));};exports['update']=function(_0x19770e,_0x4a9e66){if(_0x19770e[_0xd1b7('0x48')]['id']){delete _0x19770e[_0xd1b7('0x48')]['id'];}return db[_0xd1b7('0x2b')][_0xd1b7('0x46')]({'where':{'id':_0x19770e[_0xd1b7('0x49')]['id']}})[_0xd1b7('0x40')](handleEntityNotFound(_0x4a9e66,null))[_0xd1b7('0x40')](saveUpdates(_0x19770e[_0xd1b7('0x48')],null))[_0xd1b7('0x40')](respondWithResult(_0x4a9e66,null))[_0xd1b7('0x44')](handleError(_0x4a9e66,null));};exports[_0xd1b7('0x4a')]=function(_0x29d5a0,_0x4e9ab1){return db[_0xd1b7('0x2b')][_0xd1b7('0x46')]({'where':{'id':_0x29d5a0[_0xd1b7('0x49')]['id']}})[_0xd1b7('0x40')](handleEntityNotFound(_0x4e9ab1,null))[_0xd1b7('0x40')](removeEntity(_0x4e9ab1,null))[_0xd1b7('0x44')](handleError(_0x4e9ab1,null));};exports[_0xd1b7('0x4b')]=function(_0x49d9bd,_0x20ab6f,_0x8a36fc){var _0x186412={};var _0x4b439f={};var _0x2a2361;var _0x224d59;return db[_0xd1b7('0x2b')][_0xd1b7('0x4c')]({'where':{'id':_0x49d9bd[_0xd1b7('0x49')]['id']}})[_0xd1b7('0x40')](handleEntityNotFound(_0x20ab6f,null))[_0xd1b7('0x40')](function(_0x4b02d2){if(_0x4b02d2){_0x2a2361=_0x4b02d2;_0x4b439f['model']=_[_0xd1b7('0x30')](db[_0xd1b7('0x4d')][_0xd1b7('0x2c')]);_0x4b439f[_0xd1b7('0x31')]=_[_0xd1b7('0x30')](_0x49d9bd[_0xd1b7('0x31')]);_0x4b439f[_0xd1b7('0x38')]=_['intersection'](_0x4b439f[_0xd1b7('0x2f')],_0x4b439f[_0xd1b7('0x31')]);_0x186412[_0xd1b7('0x32')]=_[_0xd1b7('0x33')](_0x4b439f[_0xd1b7('0x2f')],qs['fields'](_0x49d9bd[_0xd1b7('0x31')]['fields']));_0x186412[_0xd1b7('0x32')]=_0x186412[_0xd1b7('0x32')][_0xd1b7('0x35')]?_0x186412[_0xd1b7('0x32')]:_0x4b439f[_0xd1b7('0x2f')];_0x186412[_0xd1b7('0x4e')]=qs['sort'](_0x49d9bd[_0xd1b7('0x31')]['sort']);_0x186412['where']=qs[_0xd1b7('0x38')](_[_0xd1b7('0x39')](_0x49d9bd[_0xd1b7('0x31')],_0x4b439f[_0xd1b7('0x38')]));if(_0x49d9bd[_0xd1b7('0x31')][_0xd1b7('0x3a')]){_0x186412[_0xd1b7('0x3b')]=_['merge'](_0x186412[_0xd1b7('0x3b')],{'$or':_[_0xd1b7('0x2a')](_0x186412[_0xd1b7('0x32')],function(_0x221ee0){var _0x3871ee={};_0x3871ee[_0x221ee0]={'$like':'%'+_0x49d9bd[_0xd1b7('0x31')]['filter']+'%'};return _0x3871ee;})});}_0x186412=_['merge']({},_0x186412,_0x49d9bd[_0xd1b7('0x3f')]);return _0x2a2361[_0xd1b7('0x4b')](_0x186412);}})[_0xd1b7('0x40')](function(_0x185ff3){if(_0x185ff3){_0x224d59=_0x185ff3[_0xd1b7('0x35')];if(!_0x49d9bd[_0xd1b7('0x31')][_0xd1b7('0x36')](_0xd1b7('0x4f'))){_0x186412[_0xd1b7('0x1c')]=qs[_0xd1b7('0x1c')](_0x49d9bd['query'][_0xd1b7('0x1c')]);_0x186412[_0xd1b7('0x1f')]=qs['offset'](_0x49d9bd['query']['offset']);}return _0x2a2361[_0xd1b7('0x4b')](_0x186412);}})[_0xd1b7('0x40')](function(_0x28c8a4){if(_0x28c8a4){return _0x28c8a4?{'count':_0x224d59,'rows':_0x28c8a4}:null;}})[_0xd1b7('0x40')](respondWithResult(_0x20ab6f,null))[_0xd1b7('0x44')](handleError(_0x20ab6f,null));};exports[_0xd1b7('0x50')]=function(_0x7f44f6,_0x49d0d1,_0x25c900){var _0x5529a3={};var _0xdb3269={};var _0x1c5a43;var _0x3469dc;return db[_0xd1b7('0x2b')][_0xd1b7('0x4c')]({'where':{'id':_0x7f44f6[_0xd1b7('0x49')]['id']}})[_0xd1b7('0x40')](handleEntityNotFound(_0x49d0d1,null))[_0xd1b7('0x40')](function(_0x57f717){if(_0x57f717){_0x1c5a43=_0x57f717;_0xdb3269['model']=_[_0xd1b7('0x30')](db[_0xd1b7('0x4d')][_0xd1b7('0x2c')]);_0xdb3269[_0xd1b7('0x31')]=_[_0xd1b7('0x30')](_0x7f44f6[_0xd1b7('0x31')]);_0xdb3269[_0xd1b7('0x38')]=_[_0xd1b7('0x33')](_0xdb3269['model'],_0xdb3269[_0xd1b7('0x31')]);_0x5529a3[_0xd1b7('0x32')]=_['intersection'](_0xdb3269[_0xd1b7('0x2f')],qs[_0xd1b7('0x34')](_0x7f44f6[_0xd1b7('0x31')][_0xd1b7('0x34')]));_0x5529a3['attributes']=_0x5529a3[_0xd1b7('0x32')][_0xd1b7('0x35')]?_0x5529a3['attributes']:_0xdb3269[_0xd1b7('0x2f')];_0x5529a3[_0xd1b7('0x4e')]=qs['sort'](_0x7f44f6['query']['sort']);_0x5529a3['where']=qs[_0xd1b7('0x38')](_[_0xd1b7('0x39')](_0x7f44f6[_0xd1b7('0x31')],_0xdb3269[_0xd1b7('0x38')]));if(_0x7f44f6[_0xd1b7('0x31')]['filter']){_0x5529a3['where']=_[_0xd1b7('0x3c')](_0x5529a3[_0xd1b7('0x3b')],{'$or':_[_0xd1b7('0x2a')](_0x5529a3[_0xd1b7('0x32')],function(_0x36b108){var _0x308473={};_0x308473[_0x36b108]={'$like':'%'+_0x7f44f6[_0xd1b7('0x31')][_0xd1b7('0x3a')]+'%'};return _0x308473;})});}_0x5529a3=_[_0xd1b7('0x3c')]({},_0x5529a3,_0x7f44f6['options']);return _0x1c5a43[_0xd1b7('0x50')](_0x5529a3);}})['then'](function(_0x57f4e4){if(_0x57f4e4){_0x3469dc=_0x57f4e4['length'];if(!_0x7f44f6[_0xd1b7('0x31')]['hasOwnProperty']('nolimit')){_0x5529a3['limit']=qs[_0xd1b7('0x1c')](_0x7f44f6[_0xd1b7('0x31')]['limit']);_0x5529a3[_0xd1b7('0x1f')]=qs[_0xd1b7('0x1f')](_0x7f44f6[_0xd1b7('0x31')][_0xd1b7('0x1f')]);}return _0x1c5a43['getSubjects'](_0x5529a3);}})[_0xd1b7('0x40')](function(_0x333c77){if(_0x333c77){return _0x333c77?{'count':_0x3469dc,'rows':_0x333c77}:null;}})[_0xd1b7('0x40')](respondWithResult(_0x49d0d1,null))[_0xd1b7('0x44')](handleError(_0x49d0d1,null));};exports['getDescriptions']=function(_0x2dd3b7,_0x370fc2,_0x1561cb){var _0x3f0d48={};var _0x51bcf0={};var _0x7ad800;var _0x4c990f;return db[_0xd1b7('0x2b')][_0xd1b7('0x4c')]({'where':{'id':_0x2dd3b7['params']['id']}})[_0xd1b7('0x40')](handleEntityNotFound(_0x370fc2,null))[_0xd1b7('0x40')](function(_0x1f509a){if(_0x1f509a){_0x7ad800=_0x1f509a;_0x51bcf0[_0xd1b7('0x2f')]=_[_0xd1b7('0x30')](db[_0xd1b7('0x4d')][_0xd1b7('0x2c')]);_0x51bcf0[_0xd1b7('0x31')]=_['keys'](_0x2dd3b7[_0xd1b7('0x31')]);_0x51bcf0['filters']=_['intersection'](_0x51bcf0['model'],_0x51bcf0[_0xd1b7('0x31')]);_0x3f0d48[_0xd1b7('0x32')]=_['intersection'](_0x51bcf0[_0xd1b7('0x2f')],qs['fields'](_0x2dd3b7[_0xd1b7('0x31')][_0xd1b7('0x34')]));_0x3f0d48[_0xd1b7('0x32')]=_0x3f0d48[_0xd1b7('0x32')]['length']?_0x3f0d48[_0xd1b7('0x32')]:_0x51bcf0[_0xd1b7('0x2f')];_0x3f0d48[_0xd1b7('0x4e')]=qs[_0xd1b7('0x37')](_0x2dd3b7[_0xd1b7('0x31')][_0xd1b7('0x37')]);_0x3f0d48['where']=qs[_0xd1b7('0x38')](_[_0xd1b7('0x39')](_0x2dd3b7[_0xd1b7('0x31')],_0x51bcf0['filters']));if(_0x2dd3b7['query']['filter']){_0x3f0d48[_0xd1b7('0x3b')]=_[_0xd1b7('0x3c')](_0x3f0d48[_0xd1b7('0x3b')],{'$or':_[_0xd1b7('0x2a')](_0x3f0d48[_0xd1b7('0x32')],function(_0x5e59ec){var _0x5a0b90={};_0x5a0b90[_0x5e59ec]={'$like':'%'+_0x2dd3b7['query'][_0xd1b7('0x3a')]+'%'};return _0x5a0b90;})});}_0x3f0d48=_[_0xd1b7('0x3c')]({},_0x3f0d48,_0x2dd3b7[_0xd1b7('0x3f')]);return _0x7ad800['getDescriptions'](_0x3f0d48);}})['then'](function(_0xc3e340){if(_0xc3e340){_0x4c990f=_0xc3e340['length'];if(!_0x2dd3b7[_0xd1b7('0x31')][_0xd1b7('0x36')](_0xd1b7('0x4f'))){_0x3f0d48[_0xd1b7('0x1c')]=qs[_0xd1b7('0x1c')](_0x2dd3b7[_0xd1b7('0x31')][_0xd1b7('0x1c')]);_0x3f0d48[_0xd1b7('0x1f')]=qs[_0xd1b7('0x1f')](_0x2dd3b7[_0xd1b7('0x31')][_0xd1b7('0x1f')]);}return _0x7ad800[_0xd1b7('0x51')](_0x3f0d48);}})[_0xd1b7('0x40')](function(_0x448929){if(_0x448929){return _0x448929?{'count':_0x4c990f,'rows':_0x448929}:null;}})[_0xd1b7('0x40')](respondWithResult(_0x370fc2,null))[_0xd1b7('0x44')](handleError(_0x370fc2,null));};exports['getTags']=function(_0x2860eb,_0x34b434,_0x5dee9a){var _0x506460={};var _0x2e40ed={};var _0x1e1d18;var _0x80a46b;return db['FreshdeskConfiguration'][_0xd1b7('0x4c')]({'where':{'id':_0x2860eb['params']['id']}})[_0xd1b7('0x40')](handleEntityNotFound(_0x34b434,null))[_0xd1b7('0x40')](function(_0x53a7cd){if(_0x53a7cd){_0x1e1d18=_0x53a7cd;_0x2e40ed[_0xd1b7('0x2f')]=_[_0xd1b7('0x30')](db[_0xd1b7('0x52')][_0xd1b7('0x2c')]);_0x2e40ed[_0xd1b7('0x31')]=_['keys'](_0x2860eb[_0xd1b7('0x31')]);_0x2e40ed[_0xd1b7('0x38')]=_[_0xd1b7('0x33')](_0x2e40ed[_0xd1b7('0x2f')],_0x2e40ed['query']);_0x506460[_0xd1b7('0x32')]=_[_0xd1b7('0x33')](_0x2e40ed[_0xd1b7('0x2f')],qs['fields'](_0x2860eb['query'][_0xd1b7('0x34')]));_0x506460[_0xd1b7('0x32')]=_0x506460[_0xd1b7('0x32')][_0xd1b7('0x35')]?_0x506460[_0xd1b7('0x32')]:_0x2e40ed['model'];_0x506460[_0xd1b7('0x4e')]=qs[_0xd1b7('0x37')](_0x2860eb[_0xd1b7('0x31')][_0xd1b7('0x37')]);_0x506460[_0xd1b7('0x3b')]=qs['filters'](_[_0xd1b7('0x39')](_0x2860eb[_0xd1b7('0x31')],_0x2e40ed[_0xd1b7('0x38')]));if(_0x2860eb[_0xd1b7('0x31')][_0xd1b7('0x3a')]){_0x506460[_0xd1b7('0x3b')]=_[_0xd1b7('0x3c')](_0x506460[_0xd1b7('0x3b')],{'$or':_[_0xd1b7('0x2a')](_0x506460[_0xd1b7('0x32')],function(_0x49cd66){var _0x3a7844={};_0x3a7844[_0x49cd66]={'$like':'%'+_0x2860eb['query'][_0xd1b7('0x3a')]+'%'};return _0x3a7844;})});}_0x506460=_[_0xd1b7('0x3c')]({},_0x506460,_0x2860eb[_0xd1b7('0x3f')]);return _0x1e1d18[_0xd1b7('0x53')](_0x506460);}})[_0xd1b7('0x40')](function(_0x4bb740){if(_0x4bb740){_0x80a46b=_0x4bb740[_0xd1b7('0x35')];if(!_0x2860eb[_0xd1b7('0x31')][_0xd1b7('0x36')](_0xd1b7('0x4f'))){_0x506460[_0xd1b7('0x1c')]=qs[_0xd1b7('0x1c')](_0x2860eb['query'][_0xd1b7('0x1c')]);_0x506460['offset']=qs['offset'](_0x2860eb[_0xd1b7('0x31')][_0xd1b7('0x1f')]);}return _0x1e1d18[_0xd1b7('0x53')](_0x506460);}})[_0xd1b7('0x40')](function(_0x3c3f46){if(_0x3c3f46){return _0x3c3f46?{'count':_0x80a46b,'rows':_0x3c3f46}:null;}})[_0xd1b7('0x40')](respondWithResult(_0x34b434,null))[_0xd1b7('0x44')](handleError(_0x34b434,null));};exports[_0xd1b7('0x54')]=function(_0x5f3de7,_0xcf3dfa,_0x2da511){if(_0x5f3de7[_0xd1b7('0x48')]['id']){delete _0x5f3de7[_0xd1b7('0x48')]['id'];}return db[_0xd1b7('0x2b')][_0xd1b7('0x4c')]({'where':{'id':_0x5f3de7[_0xd1b7('0x49')]['id']}})[_0xd1b7('0x40')](handleEntityNotFound(_0xcf3dfa,null))[_0xd1b7('0x40')](function(_0x3c7084){if(_0x3c7084){return _0x3c7084[_0xd1b7('0x54')](_0x5f3de7[_0xd1b7('0x48')][_0xd1b7('0x55')]||[]);}return null;})[_0xd1b7('0x40')](respondWithResult(_0xcf3dfa,null))[_0xd1b7('0x44')](handleError(_0xcf3dfa,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 79538cf..98c01c2 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 _0x482f=['bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','moment'];(function(_0x1451d1,_0x2b6a56){var _0x4c848e=function(_0x10c32c){while(--_0x10c32c){_0x1451d1['push'](_0x1451d1['shift']());}};_0x4c848e(++_0x2b6a56);}(_0x482f,0x1ac));var _0xf482=function(_0x1f1c0e,_0x5154fd){_0x1f1c0e=_0x1f1c0e-0x0;var _0xf7436a=_0x482f[_0x1f1c0e];return _0xf7436a;};'use strict';var _=require(_0xf482('0x0'));var util=require('util');var logger=require(_0xf482('0x1'))(_0xf482('0x2'));var moment=require(_0xf482('0x3'));var BPromise=require(_0xf482('0x4'));var rp=require(_0xf482('0x5'));var fs=require('fs');var path=require(_0xf482('0x6'));var rimraf=require('rimraf');var config=require(_0xf482('0x7'));var attributes=require(_0xf482('0x8'));module[_0xf482('0x9')]=function(_0x4747c6,_0x35e2af){return _0x4747c6[_0xf482('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0xf482('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4059=['int_freshdesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x4059,0x18d));var _0x9405=function(_0x4f3ac1,_0x55269a){_0x4f3ac1=_0x4f3ac1-0x0;var _0x5857f8=_0x4059[_0x4f3ac1];return _0x5857f8;};'use strict';var _=require('lodash');var util=require(_0x9405('0x0'));var logger=require(_0x9405('0x1'))(_0x9405('0x2'));var moment=require(_0x9405('0x3'));var BPromise=require(_0x9405('0x4'));var rp=require(_0x9405('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9405('0x6'));var config=require('../../config/environment');var attributes=require(_0x9405('0x7'));module[_0x9405('0x8')]=function(_0x4d62a9,_0x58fb4d){return _0x4d62a9[_0x9405('0x9')](_0x9405('0xa'),attributes,{'tableName':_0x9405('0xb'),'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 74ba10d..578016e 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 _0xcd0f=['code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5ed099,_0x304e8a){var _0x46e1d7=function(_0x2b57f1){while(--_0x2b57f1){_0x5ed099['push'](_0x5ed099['shift']());}};_0x46e1d7(++_0x304e8a);}(_0xcd0f,0x147));var _0xfcd0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcd0f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfcd0('0x0'));var util=require('util');var moment=require(_0xfcd0('0x1'));var BPromise=require('bluebird');var rs=require(_0xfcd0('0x2'));var fs=require('fs');var Redis=require(_0xfcd0('0x3'));var db=require(_0xfcd0('0x4'))['db'];var utils=require(_0xfcd0('0x5'));var logger=require('../../config/logger')(_0xfcd0('0x6'));var config=require(_0xfcd0('0x7'));var jayson=require(_0xfcd0('0x8'));var client=jayson[_0xfcd0('0x9')][_0xfcd0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e9946,_0x474c1c,_0x1644f5){return new BPromise(function(_0x5310a6,_0x1c0825){return client[_0xfcd0('0xb')](_0x4e9946,_0x1644f5)['then'](function(_0x176cda){logger[_0xfcd0('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x474c1c,'request\x20sent');logger[_0xfcd0('0xd')](_0xfcd0('0xe'),_0x474c1c,_0xfcd0('0xf'),JSON[_0xfcd0('0x10')](_0x176cda));if(_0x176cda[_0xfcd0('0x11')]){if(_0x176cda['error'][_0xfcd0('0x12')]===0x1f4){logger[_0xfcd0('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x474c1c,_0x176cda[_0xfcd0('0x11')][_0xfcd0('0x13')]);return _0x1c0825(_0x176cda[_0xfcd0('0x11')][_0xfcd0('0x13')]);}logger[_0xfcd0('0x11')](_0xfcd0('0x14'),_0x474c1c,_0x176cda[_0xfcd0('0x11')][_0xfcd0('0x13')]);return _0x5310a6(_0x176cda[_0xfcd0('0x11')][_0xfcd0('0x13')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x474c1c,_0xfcd0('0xf'));_0x5310a6(_0x176cda[_0xfcd0('0x15')][_0xfcd0('0x13')]);}})[_0xfcd0('0x16')](function(_0x227ce0){logger[_0xfcd0('0x11')](_0xfcd0('0x14'),_0x474c1c,_0x227ce0);_0x1c0825(_0x227ce0);});});} \ No newline at end of file +var _0x539d=['stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0xd21fe7,_0x225a39){var _0x14d570=function(_0x3c0674){while(--_0x3c0674){_0xd21fe7['push'](_0xd21fe7['shift']());}};_0x14d570(++_0x225a39);}(_0x539d,0x10b));var _0xd539=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x539d[_0xc8a931];return _0x28bd27;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd539('0x0'));var BPromise=require(_0xd539('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd539('0x2'));var db=require(_0xd539('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd539('0x4'));var config=require(_0xd539('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd539('0x6')][_0xd539('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26e4d2,_0x34c6de,_0x276eae){return new BPromise(function(_0x18badd,_0x20ad5c){return client[_0xd539('0x8')](_0x26e4d2,_0x276eae)[_0xd539('0x9')](function(_0x1f6986){logger[_0xd539('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x34c6de,_0xd539('0xb'));logger[_0xd539('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x34c6de,'request\x20sent',JSON[_0xd539('0xd')](_0x1f6986));if(_0x1f6986['error']){if(_0x1f6986[_0xd539('0xe')][_0xd539('0xf')]===0x1f4){logger[_0xd539('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x34c6de,_0x1f6986[_0xd539('0xe')][_0xd539('0x10')]);return _0x20ad5c(_0x1f6986[_0xd539('0xe')][_0xd539('0x10')]);}logger['error'](_0xd539('0x11'),_0x34c6de,_0x1f6986[_0xd539('0xe')]['message']);return _0x18badd(_0x1f6986[_0xd539('0xe')]['message']);}else{logger['info'](_0xd539('0x11'),_0x34c6de,_0xd539('0xb'));_0x18badd(_0x1f6986[_0xd539('0x12')][_0xd539('0x10')]);}})[_0xd539('0x13')](function(_0x264701){logger[_0xd539('0xe')](_0xd539('0x11'),_0x34c6de,_0x264701);_0x20ad5c(_0x264701);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 8fe8b1f..b97ef29 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 _0xd276=['index','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2d0193,_0x8f73a6){var _0x4b7384=function(_0x8dbda0){while(--_0x8dbda0){_0x2d0193['push'](_0x2d0193['shift']());}};_0x4b7384(++_0x8f73a6);}(_0xd276,0xf3));var _0x6d27=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xd276[_0x3cea78];return _0x33b66b;};'use strict';var multer=require(_0x6d27('0x0'));var util=require(_0x6d27('0x1'));var path=require(_0x6d27('0x2'));var timeout=require('connect-timeout');var express=require(_0x6d27('0x3'));var router=express[_0x6d27('0x4')]();var fs_extra=require(_0x6d27('0x5'));var auth=require(_0x6d27('0x6'));var interaction=require(_0x6d27('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x6d27('0x8')]('/',auth['isAuthenticated'](),controller[_0x6d27('0x9')]);router[_0x6d27('0x8')](_0x6d27('0xa'),auth[_0x6d27('0xb')](),controller['show']);router[_0x6d27('0xc')]('/',auth['isAuthenticated'](),controller[_0x6d27('0xd')]);router[_0x6d27('0xe')](_0x6d27('0xa'),auth[_0x6d27('0xb')](),controller[_0x6d27('0xf')]);router[_0x6d27('0x10')](_0x6d27('0xa'),auth['isAuthenticated'](),controller[_0x6d27('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc75e=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x182c7c,_0x25933d){var _0x5ff461=function(_0x17311f){while(--_0x17311f){_0x182c7c['push'](_0x182c7c['shift']());}};_0x5ff461(++_0x25933d);}(_0xc75e,0x1a9));var _0xec75=function(_0x5d09fa,_0x47c8c2){_0x5d09fa=_0x5d09fa-0x0;var _0x140100=_0xc75e[_0x5d09fa];return _0x140100;};'use strict';var multer=require(_0xec75('0x0'));var util=require(_0xec75('0x1'));var path=require(_0xec75('0x2'));var timeout=require(_0xec75('0x3'));var express=require(_0xec75('0x4'));var router=express['Router']();var fs_extra=require(_0xec75('0x5'));var auth=require(_0xec75('0x6'));var interaction=require(_0xec75('0x7'));var config=require(_0xec75('0x8'));var controller=require('./intFreshdeskField.controller');router[_0xec75('0x9')]('/',auth[_0xec75('0xa')](),controller[_0xec75('0xb')]);router[_0xec75('0x9')](_0xec75('0xc'),auth[_0xec75('0xa')](),controller[_0xec75('0xd')]);router[_0xec75('0xe')]('/',auth[_0xec75('0xa')](),controller['create']);router[_0xec75('0xf')](_0xec75('0xc'),auth[_0xec75('0xa')](),controller['update']);router['delete'](_0xec75('0xc'),auth[_0xec75('0xa')](),controller[_0xec75('0x10')]);module[_0xec75('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 9d2381d..0978cb8 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 _0xa563=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x31fd80,_0x2c675b){var _0x31039c=function(_0x2d9069){while(--_0x2d9069){_0x31fd80['push'](_0x31fd80['shift']());}};_0x31039c(++_0x2c675b);}(_0xa563,0xaf));var _0x3a56=function(_0x71a70,_0x4e1cdd){_0x71a70=_0x71a70-0x0;var _0x3a2b22=_0xa563[_0x71a70];return _0x3a2b22;};'use strict';var Sequelize=require(_0x3a56('0x0'));module[_0x3a56('0x1')]={'type':{'type':Sequelize[_0x3a56('0x2')](_0x3a56('0x3'),_0x3a56('0x4'),_0x3a56('0x5'),_0x3a56('0x6'),_0x3a56('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3a56('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3a56('0x2')](_0x3a56('0x3'),_0x3a56('0x4'),_0x3a56('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3a56('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3a56('0x8')]}}; \ No newline at end of file +var _0x4e97=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x282eab,_0x29f081){var _0x3328f2=function(_0x3e2032){while(--_0x3e2032){_0x282eab['push'](_0x282eab['shift']());}};_0x3328f2(++_0x29f081);}(_0x4e97,0x10e));var _0x74e9=function(_0x211f46,_0x12f787){_0x211f46=_0x211f46-0x0;var _0x2e6135=_0x4e97[_0x211f46];return _0x2e6135;};'use strict';var Sequelize=require(_0x74e9('0x0'));module[_0x74e9('0x1')]={'type':{'type':Sequelize[_0x74e9('0x2')](_0x74e9('0x3'),_0x74e9('0x4'),_0x74e9('0x5'),_0x74e9('0x6'),_0x74e9('0x7')),'defaultValue':_0x74e9('0x3')},'content':{'type':Sequelize[_0x74e9('0x8')]},'key':{'type':Sequelize[_0x74e9('0x8')]},'keyType':{'type':Sequelize[_0x74e9('0x2')](_0x74e9('0x3'),_0x74e9('0x4'),_0x74e9('0x5'))},'keyContent':{'type':Sequelize[_0x74e9('0x8')]},'idField':{'type':Sequelize[_0x74e9('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x74e9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x74e9('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 1f247eb..c855fdd 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(_0x250499,_0x5b7a08){var _0x20acec=function(_0x4db2ab){while(--_0x4db2ab){_0x250499['push'](_0x250499['shift']());}};_0x20acec(++_0x5b7a08);}(_0xc36d,0x7d));var _0xdc36=function(_0xeb4c8b,_0x1dc497){_0xeb4c8b=_0xeb4c8b-0x0;var _0x90b0d0=_0xc36d[_0xeb4c8b];return _0x90b0d0;};'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 _0x705f=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','pick','where','merge','filter','count','includeAll','FreshdeskField','findAll','rows','catch','show','rawAttributes','fields','include','options','find','create','body','params','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit'];(function(_0x1ff0a0,_0x34c2c4){var _0x27d161=function(_0x200b67){while(--_0x200b67){_0x1ff0a0['push'](_0x1ff0a0['shift']());}};_0x27d161(++_0x34c2c4);}(_0x705f,0x75));var _0xf705=function(_0x411d8c,_0x22d9ff){_0x411d8c=_0x411d8c-0x0;var _0x34f6e5=_0x705f[_0x411d8c];return _0x34f6e5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf705('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf705('0x1'));var moment=require(_0xf705('0x2'));var BPromise=require(_0xf705('0x3'));var Mustache=require(_0xf705('0x4'));var util=require(_0xf705('0x5'));var path=require(_0xf705('0x6'));var sox=require(_0xf705('0x7'));var csv=require(_0xf705('0x8'));var ejs=require(_0xf705('0x9'));var fs=require('fs');var fs_extra=require(_0xf705('0xa'));var _=require(_0xf705('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf705('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf705('0x8'));var querystring=require(_0xf705('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf705('0xe'));var qs=require(_0xf705('0xf'));var as=require(_0xf705('0x10'));var hardwareService=require(_0xf705('0x11'));var logger=require(_0xf705('0x12'))(_0xf705('0x13'));var utils=require(_0xf705('0x14'));var config=require(_0xf705('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf705('0x16'))['db'];function respondWithStatusCode(_0x296a62,_0xb50c9f){_0xb50c9f=_0xb50c9f||0xcc;return function(_0xf625da){if(_0xf625da){return _0x296a62[_0xf705('0x17')](_0xb50c9f);}return _0x296a62['status'](_0xb50c9f)['end']();};}function respondWithResult(_0x26cb9a,_0x10763f){_0x10763f=_0x10763f||0xc8;return function(_0x15d2e2){if(_0x15d2e2){return _0x26cb9a[_0xf705('0x18')](_0x10763f)['json'](_0x15d2e2);}};}function respondWithFilteredResult(_0x9c7b75,_0x23a64b){return function(_0x4555a8){if(_0x4555a8){var _0x32f48b=typeof _0x23a64b['offset']===_0xf705('0x19')&&typeof _0x23a64b['limit']===_0xf705('0x19');var _0x1c0778=_0x4555a8['count'];var _0xa9a2ca=_0x32f48b?0x0:_0x23a64b['offset'];var _0x425cd6=_0x32f48b?_0x4555a8['count']:_0x23a64b['offset']+_0x23a64b[_0xf705('0x1a')];var _0xfee2a8;if(_0x425cd6>=_0x1c0778){_0x425cd6=_0x1c0778;_0xfee2a8=0xc8;}else{_0xfee2a8=0xce;}_0x9c7b75[_0xf705('0x18')](_0xfee2a8);return _0x9c7b75['set'](_0xf705('0x1b'),_0xa9a2ca+'-'+_0x425cd6+'/'+_0x1c0778)[_0xf705('0x1c')](_0x4555a8);}return null;};}function patchUpdates(_0x8d5b49){return function(_0x57456a){try{jsonpatch[_0xf705('0x1d')](_0x57456a,_0x8d5b49,!![]);}catch(_0x4d34cd){return BPromise['reject'](_0x4d34cd);}return _0x57456a[_0xf705('0x1e')]();};}function saveUpdates(_0x1052a6,_0x2a2fb7){return function(_0x24622b){if(_0x24622b){return _0x24622b[_0xf705('0x1f')](_0x1052a6)[_0xf705('0x20')](function(_0xcab54f){return _0xcab54f;});}return null;};}function removeEntity(_0x10dfc9,_0x424d4e){return function(_0x39dddb){if(_0x39dddb){return _0x39dddb[_0xf705('0x21')]()['then'](function(){_0x10dfc9[_0xf705('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23bb4a,_0x4ccff8){return function(_0x5eadda){if(!_0x5eadda){_0x23bb4a[_0xf705('0x17')](0x194);}return _0x5eadda;};}function handleError(_0x33da21,_0x593180){_0x593180=_0x593180||0x1f4;return function(_0x4f5435){logger[_0xf705('0x22')](_0x4f5435[_0xf705('0x23')]);if(_0x4f5435[_0xf705('0x24')]){delete _0x4f5435[_0xf705('0x24')];}_0x33da21[_0xf705('0x18')](_0x593180)['send'](_0x4f5435);};}exports[_0xf705('0x25')]=function(_0x2c4a5d,_0x3a6343){var _0x54f905={},_0x4a09ab={},_0x4a0fd3={'count':0x0,'rows':[]};var _0x54ff43=_[_0xf705('0x26')](db['FreshdeskField']['rawAttributes'],function(_0x29ac24){return{'name':_0x29ac24[_0xf705('0x27')],'type':_0x29ac24[_0xf705('0x28')][_0xf705('0x29')]};});_0x4a09ab[_0xf705('0x2a')]=_['map'](_0x54ff43,'name');_0x4a09ab[_0xf705('0x2b')]=_[_0xf705('0x2c')](_0x2c4a5d[_0xf705('0x2b')]);_0x4a09ab[_0xf705('0x2d')]=_[_0xf705('0x2e')](_0x4a09ab[_0xf705('0x2a')],_0x4a09ab[_0xf705('0x2b')]);_0x54f905[_0xf705('0x2f')]=_['intersection'](_0x4a09ab[_0xf705('0x2a')],qs['fields'](_0x2c4a5d[_0xf705('0x2b')]['fields']));_0x54f905[_0xf705('0x2f')]=_0x54f905[_0xf705('0x2f')][_0xf705('0x30')]?_0x54f905[_0xf705('0x2f')]:_0x4a09ab[_0xf705('0x2a')];if(!_0x2c4a5d[_0xf705('0x2b')][_0xf705('0x31')]('nolimit')){_0x54f905[_0xf705('0x1a')]=qs[_0xf705('0x1a')](_0x2c4a5d[_0xf705('0x2b')]['limit']);_0x54f905['offset']=qs[_0xf705('0x32')](_0x2c4a5d['query'][_0xf705('0x32')]);}_0x54f905[_0xf705('0x33')]=qs[_0xf705('0x34')](_0x2c4a5d['query'][_0xf705('0x34')]);_0x54f905['where']=qs[_0xf705('0x2d')](_[_0xf705('0x35')](_0x2c4a5d[_0xf705('0x2b')],_0x4a09ab['filters']),_0x54ff43);if(_0x2c4a5d[_0xf705('0x2b')]['filter']){_0x54f905[_0xf705('0x36')]=_[_0xf705('0x37')](_0x54f905[_0xf705('0x36')],{'$or':_[_0xf705('0x26')](_0x54ff43,function(_0x38f9d5){if(_0x38f9d5[_0xf705('0x28')]!=='VIRTUAL'){var _0x2b9902={};_0x2b9902[_0x38f9d5[_0xf705('0x24')]]={'$like':'%'+_0x2c4a5d[_0xf705('0x2b')][_0xf705('0x38')]+'%'};return _0x2b9902;}})});}_0x54f905=_['merge']({},_0x54f905,_0x2c4a5d['options']);var _0x3b02f7={'where':_0x54f905[_0xf705('0x36')]};return db['FreshdeskField'][_0xf705('0x39')](_0x3b02f7)[_0xf705('0x20')](function(_0x10e28b){_0x4a0fd3['count']=_0x10e28b;if(_0x2c4a5d[_0xf705('0x2b')][_0xf705('0x3a')]){_0x54f905['include']=[{'all':!![]}];}return db[_0xf705('0x3b')][_0xf705('0x3c')](_0x54f905);})[_0xf705('0x20')](function(_0x4382cd){_0x4a0fd3[_0xf705('0x3d')]=_0x4382cd;return _0x4a0fd3;})[_0xf705('0x20')](respondWithFilteredResult(_0x3a6343,_0x54f905))[_0xf705('0x3e')](handleError(_0x3a6343,null));};exports[_0xf705('0x3f')]=function(_0x3355b1,_0x108663){var _0x343f1a={'raw':!![],'where':{'id':_0x3355b1['params']['id']}},_0x50520d={};_0x50520d['model']=_[_0xf705('0x2c')](db[_0xf705('0x3b')][_0xf705('0x40')]);_0x50520d['query']=_[_0xf705('0x2c')](_0x3355b1[_0xf705('0x2b')]);_0x50520d[_0xf705('0x2d')]=_[_0xf705('0x2e')](_0x50520d[_0xf705('0x2a')],_0x50520d[_0xf705('0x2b')]);_0x343f1a['attributes']=_['intersection'](_0x50520d[_0xf705('0x2a')],qs[_0xf705('0x41')](_0x3355b1['query'][_0xf705('0x41')]));_0x343f1a[_0xf705('0x2f')]=_0x343f1a[_0xf705('0x2f')][_0xf705('0x30')]?_0x343f1a['attributes']:_0x50520d[_0xf705('0x2a')];if(_0x3355b1[_0xf705('0x2b')]['includeAll']){_0x343f1a[_0xf705('0x42')]=[{'all':!![]}];}_0x343f1a=_[_0xf705('0x37')]({},_0x343f1a,_0x3355b1[_0xf705('0x43')]);return db[_0xf705('0x3b')][_0xf705('0x44')](_0x343f1a)[_0xf705('0x20')](handleEntityNotFound(_0x108663,null))[_0xf705('0x20')](respondWithResult(_0x108663,null))[_0xf705('0x3e')](handleError(_0x108663,null));};exports[_0xf705('0x45')]=function(_0x4a5a02,_0x5b5463){return db[_0xf705('0x3b')][_0xf705('0x45')](_0x4a5a02['body'],{})[_0xf705('0x20')](respondWithResult(_0x5b5463,0xc9))[_0xf705('0x3e')](handleError(_0x5b5463,null));};exports[_0xf705('0x1f')]=function(_0x2c6861,_0x99c560){if(_0x2c6861[_0xf705('0x46')]['id']){delete _0x2c6861['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x2c6861[_0xf705('0x47')]['id']}})[_0xf705('0x20')](handleEntityNotFound(_0x99c560,null))[_0xf705('0x20')](saveUpdates(_0x2c6861['body'],null))[_0xf705('0x20')](respondWithResult(_0x99c560,null))[_0xf705('0x3e')](handleError(_0x99c560,null));};exports[_0xf705('0x21')]=function(_0x598441,_0x5b8f3f){return db['FreshdeskField'][_0xf705('0x44')]({'where':{'id':_0x598441[_0xf705('0x47')]['id']}})[_0xf705('0x20')](handleEntityNotFound(_0x5b8f3f,null))[_0xf705('0x20')](removeEntity(_0x5b8f3f,null))[_0xf705('0x3e')](handleError(_0x5b8f3f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 3b31936..bb1ab1d 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 _0x00f3=['request-promise','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x20522a,_0x11bb0){var _0x3105e0=function(_0x500ee0){while(--_0x500ee0){_0x20522a['push'](_0x20522a['shift']());}};_0x3105e0(++_0x11bb0);}(_0x00f3,0x168));var _0x300f=function(_0x4372af,_0x2d23b6){_0x4372af=_0x4372af-0x0;var _0x244e6b=_0x00f3[_0x4372af];return _0x244e6b;};'use strict';var _=require(_0x300f('0x0'));var util=require(_0x300f('0x1'));var logger=require(_0x300f('0x2'))(_0x300f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x300f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x300f('0x5'));var attributes=require(_0x300f('0x6'));module[_0x300f('0x7')]=function(_0x308f12,_0x226321){return _0x308f12[_0x300f('0x8')](_0x300f('0x9'),attributes,{'tableName':_0x300f('0xa'),'paranoid':![],'indexes':[{'name':_0x300f('0xb'),'fields':[_0x300f('0xc'),_0x300f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8105=['./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x8105,0x107));var _0x5810=function(_0x1a10e7,_0x4da144){_0x1a10e7=_0x1a10e7-0x0;var _0x34d008=_0x8105[_0x1a10e7];return _0x34d008;};'use strict';var _=require(_0x5810('0x0'));var util=require(_0x5810('0x1'));var logger=require(_0x5810('0x2'))(_0x5810('0x3'));var moment=require(_0x5810('0x4'));var BPromise=require(_0x5810('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5810('0x6'));var rimraf=require(_0x5810('0x7'));var config=require(_0x5810('0x8'));var attributes=require(_0x5810('0x9'));module[_0x5810('0xa')]=function(_0x24fddb,_0x2563fa){return _0x24fddb[_0x5810('0xb')](_0x5810('0xc'),attributes,{'tableName':_0x5810('0xd'),'paranoid':![],'indexes':[{'name':_0x5810('0xe'),'fields':[_0x5810('0xf'),_0x5810('0x10')],'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 ada42f7..1985a34 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 _0x4643=['result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','message'];(function(_0x4fa0ea,_0x2cd534){var _0x51d027=function(_0xe67342){while(--_0xe67342){_0x4fa0ea['push'](_0x4fa0ea['shift']());}};_0x51d027(++_0x2cd534);}(_0x4643,0x1a4));var _0x3464=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4643[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x3464('0x0'));var util=require('util');var moment=require(_0x3464('0x1'));var BPromise=require(_0x3464('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3464('0x3'));var db=require(_0x3464('0x4'))['db'];var utils=require(_0x3464('0x5'));var logger=require(_0x3464('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3464('0x7'));var client=jayson['client'][_0x3464('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbd28a5,_0x128430,_0x440777){return new BPromise(function(_0x10bcae,_0x16f16f){return client[_0x3464('0x9')](_0xbd28a5,_0x440777)[_0x3464('0xa')](function(_0x18c0ef){logger[_0x3464('0xb')](_0x3464('0xc'),_0x128430,_0x3464('0xd'));logger[_0x3464('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x128430,_0x3464('0xd'),JSON['stringify'](_0x18c0ef));if(_0x18c0ef['error']){if(_0x18c0ef[_0x3464('0xf')]['code']===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x128430,_0x18c0ef[_0x3464('0xf')]['message']);return _0x16f16f(_0x18c0ef['error'][_0x3464('0x10')]);}logger[_0x3464('0xf')](_0x3464('0xc'),_0x128430,_0x18c0ef[_0x3464('0xf')]['message']);return _0x10bcae(_0x18c0ef[_0x3464('0xf')][_0x3464('0x10')]);}else{logger[_0x3464('0xb')](_0x3464('0xc'),_0x128430,'request\x20sent');_0x10bcae(_0x18c0ef[_0x3464('0x11')]['message']);}})[_0x3464('0x12')](function(_0x723fcf){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x128430,_0x723fcf);_0x16f16f(_0x723fcf);});});} \ No newline at end of file +var _0x4a9f=['stringify','code','message','error','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x3155e3,_0x5225e6){var _0x1aefef=function(_0x2bd7f8){while(--_0x2bd7f8){_0x3155e3['push'](_0x3155e3['shift']());}};_0x1aefef(++_0x5225e6);}(_0x4a9f,0x99));var _0xf4a9=function(_0x55e855,_0x1d3893){_0x55e855=_0x55e855-0x0;var _0x316acb=_0x4a9f[_0x55e855];return _0x316acb;};'use strict';var _=require(_0xf4a9('0x0'));var util=require(_0xf4a9('0x1'));var moment=require(_0xf4a9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4a9('0x5'))(_0xf4a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xf4a9('0x7'));var client=jayson[_0xf4a9('0x8')][_0xf4a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bf009,_0x32cd30,_0x5ce62f){return new BPromise(function(_0x35df96,_0x526a5b){return client['request'](_0x3bf009,_0x5ce62f)['then'](function(_0x257dd2){logger[_0xf4a9('0xa')](_0xf4a9('0xb'),_0x32cd30,_0xf4a9('0xc'));logger[_0xf4a9('0xd')](_0xf4a9('0xe'),_0x32cd30,_0xf4a9('0xc'),JSON[_0xf4a9('0xf')](_0x257dd2));if(_0x257dd2['error']){if(_0x257dd2['error'][_0xf4a9('0x10')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x32cd30,_0x257dd2['error'][_0xf4a9('0x11')]);return _0x526a5b(_0x257dd2[_0xf4a9('0x12')][_0xf4a9('0x11')]);}logger[_0xf4a9('0x12')](_0xf4a9('0xb'),_0x32cd30,_0x257dd2[_0xf4a9('0x12')][_0xf4a9('0x11')]);return _0x35df96(_0x257dd2[_0xf4a9('0x12')][_0xf4a9('0x11')]);}else{logger[_0xf4a9('0xa')](_0xf4a9('0xb'),_0x32cd30,_0xf4a9('0xc'));_0x35df96(_0x257dd2[_0xf4a9('0x13')]['message']);}})[_0xf4a9('0x14')](function(_0x4dca88){logger[_0xf4a9('0x12')](_0xf4a9('0xb'),_0x32cd30,_0x4dca88);_0x526a5b(_0x4dca88);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 2e270b5..4f94633 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 _0x5ec6=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','./intFreshsalesAccount.controller','isAuthenticated','index','/:id','get','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ec6,0x7f));var _0x65ec=function(_0x229afd,_0x4d2249){_0x229afd=_0x229afd-0x0;var _0x33a03d=_0x5ec6[_0x229afd];return _0x33a03d;};'use strict';var multer=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var path=require(_0x65ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x65ec('0x3'));var router=express['Router']();var fs_extra=require(_0x65ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x65ec('0x5'));var config=require('../../config/environment');var controller=require(_0x65ec('0x6'));router['get']('/',auth[_0x65ec('0x7')](),controller[_0x65ec('0x8')]);router['get'](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller['show']);router[_0x65ec('0xa')](_0x65ec('0xb'),auth[_0x65ec('0x7')](),controller['getConfigurations']);router['get'](_0x65ec('0xc'),auth['isAuthenticated'](),controller[_0x65ec('0xd')]);router[_0x65ec('0xe')]('/',auth['isAuthenticated'](),controller[_0x65ec('0xf')]);router[_0x65ec('0xe')]('/:id/configurations',auth[_0x65ec('0x7')](),controller[_0x65ec('0x10')]);router['put'](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller[_0x65ec('0x11')]);router[_0x65ec('0x12')](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller[_0x65ec('0x13')]);module[_0x65ec('0x14')]=router; \ No newline at end of file +var _0x91a7=['Router','../../components/auth/service','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','update','exports','util','path','connect-timeout'];(function(_0x32e334,_0x3fcbbc){var _0x53c670=function(_0x1be73c){while(--_0x1be73c){_0x32e334['push'](_0x32e334['shift']());}};_0x53c670(++_0x3fcbbc);}(_0x91a7,0xe7));var _0x791a=function(_0x50b86,_0x190c6b){_0x50b86=_0x50b86-0x0;var _0x1773ed=_0x91a7[_0x50b86];return _0x1773ed;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/fields',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0xd')]);router[_0x791a('0xe')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xf')]);router['put']('/:id',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['delete'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 4279a0d..5096e11 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 _0x6343=['STRING','remoteUri'];(function(_0x107e4f,_0x389048){var _0x273536=function(_0xb7b1b3){while(--_0xb7b1b3){_0x107e4f['push'](_0x107e4f['shift']());}};_0x273536(++_0x389048);}(_0x6343,0x168));var _0x3634=function(_0x411ea0,_0x6fece1){_0x411ea0=_0x411ea0-0x0;var _0x32a120=_0x6343[_0x411ea0];return _0x32a120;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3634('0x0')]},'description':{'type':Sequelize[_0x3634('0x0')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3634('0x1')},'serverUrl':{'type':Sequelize[_0x3634('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xf4f4=['exports','STRING','username','sequelize'];(function(_0x4ee5d3,_0x432589){var _0x3a0562=function(_0x442e4a){while(--_0x442e4a){_0x4ee5d3['push'](_0x4ee5d3['shift']());}};_0x3a0562(++_0x432589);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x54c42d,_0x23975d){_0x54c42d=_0x54c42d-0x0;var _0x16d161=_0xf4f4[_0x54c42d];return _0x16d161;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4f4f('0x2')]},'username':{'type':Sequelize[_0x4f4f('0x2')],'unique':_0x4f4f('0x3')},'apiKey':{'type':Sequelize[_0x4f4f('0x2')]},'remoteUri':{'type':Sequelize[_0x4f4f('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4f4f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3c3e5e7..312620f 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 _0xf6e8=['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','params','find','create','update','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','username','remoteUri','apiKey','slice','substring','%s%s','/api/selector/owners','Token\x20token=','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','name','send','map','FreshsalesAccount','rawAttributes'];(function(_0x2a24c7,_0xbbe950){var _0x23ff91=function(_0x46c885){while(--_0x46c885){_0x2a24c7['push'](_0x2a24c7['shift']());}};_0x23ff91(++_0xbbe950);}(_0xf6e8,0x16d));var _0x8f6e=function(_0x599cf5,_0x2e2444){_0x599cf5=_0x599cf5-0x0;var _0x40e46a=_0xf6e8[_0x599cf5];return _0x40e46a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f6e('0x0'));var zipdir=require(_0x8f6e('0x1'));var jsonpatch=require(_0x8f6e('0x2'));var rp=require(_0x8f6e('0x3'));var moment=require(_0x8f6e('0x4'));var BPromise=require(_0x8f6e('0x5'));var Mustache=require(_0x8f6e('0x6'));var util=require(_0x8f6e('0x7'));var path=require(_0x8f6e('0x8'));var sox=require(_0x8f6e('0x9'));var csv=require(_0x8f6e('0xa'));var ejs=require(_0x8f6e('0xb'));var fs=require('fs');var fs_extra=require(_0x8f6e('0xc'));var _=require('lodash');var squel=require(_0x8f6e('0xd'));var crypto=require(_0x8f6e('0xe'));var jsforce=require(_0x8f6e('0xf'));var deskjs=require(_0x8f6e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8f6e('0x11'));var Papa=require('papaparse');var Redis=require(_0x8f6e('0x12'));var authService=require(_0x8f6e('0x13'));var qs=require(_0x8f6e('0x14'));var as=require(_0x8f6e('0x15'));var hardwareService=require(_0x8f6e('0x16'));var logger=require(_0x8f6e('0x17'))('api');var utils=require(_0x8f6e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8f6e('0x19'))['db'];var integrations=require(_0x8f6e('0x1a'));function respondWithStatusCode(_0x256e62,_0x3c007d){_0x3c007d=_0x3c007d||0xcc;return function(_0x15f6a8){if(_0x15f6a8){return _0x256e62['sendStatus'](_0x3c007d);}return _0x256e62[_0x8f6e('0x1b')](_0x3c007d)[_0x8f6e('0x1c')]();};}function respondWithResult(_0x2a1ebb,_0x53d039){_0x53d039=_0x53d039||0xc8;return function(_0x2a72ce){if(_0x2a72ce){return _0x2a1ebb[_0x8f6e('0x1b')](_0x53d039)[_0x8f6e('0x1d')](_0x2a72ce);}};}function respondWithFilteredResult(_0x413ced,_0x50925a){return function(_0xfa83ca){if(_0xfa83ca){var _0x28ee41=typeof _0x50925a[_0x8f6e('0x1e')]===_0x8f6e('0x1f')&&typeof _0x50925a['limit']===_0x8f6e('0x1f');var _0x22a6c3=_0xfa83ca[_0x8f6e('0x20')];var _0x36571a=_0x28ee41?0x0:_0x50925a['offset'];var _0xe1bddb=_0x28ee41?_0xfa83ca[_0x8f6e('0x20')]:_0x50925a[_0x8f6e('0x1e')]+_0x50925a[_0x8f6e('0x21')];var _0x1f9bf2;if(_0xe1bddb>=_0x22a6c3){_0xe1bddb=_0x22a6c3;_0x1f9bf2=0xc8;}else{_0x1f9bf2=0xce;}_0x413ced[_0x8f6e('0x1b')](_0x1f9bf2);return _0x413ced[_0x8f6e('0x22')](_0x8f6e('0x23'),_0x36571a+'-'+_0xe1bddb+'/'+_0x22a6c3)[_0x8f6e('0x1d')](_0xfa83ca);}return null;};}function patchUpdates(_0x9f031c){return function(_0x34b4ce){try{jsonpatch[_0x8f6e('0x24')](_0x34b4ce,_0x9f031c,!![]);}catch(_0x257f4a){return BPromise['reject'](_0x257f4a);}return _0x34b4ce[_0x8f6e('0x25')]();};}function saveUpdates(_0x5d17e1,_0x22cba3){return function(_0x19f211){if(_0x19f211){return _0x19f211['update'](_0x5d17e1)[_0x8f6e('0x26')](function(_0x3b1c1e){return _0x3b1c1e;});}return null;};}function removeEntity(_0x11c802,_0x1b3a87){return function(_0x5e7724){if(_0x5e7724){return _0x5e7724[_0x8f6e('0x27')]()[_0x8f6e('0x26')](function(){_0x11c802[_0x8f6e('0x1b')](0xcc)[_0x8f6e('0x1c')]();});}};}function handleEntityNotFound(_0x11d960,_0x1d20ed){return function(_0x35609b){if(!_0x35609b){_0x11d960[_0x8f6e('0x28')](0x194);}return _0x35609b;};}function handleError(_0x4b1fee,_0x104a38){_0x104a38=_0x104a38||0x1f4;return function(_0x546304){logger[_0x8f6e('0x29')](_0x546304['stack']);if(_0x546304['name']){delete _0x546304[_0x8f6e('0x2a')];}_0x4b1fee[_0x8f6e('0x1b')](_0x104a38)[_0x8f6e('0x2b')](_0x546304);};}exports['index']=function(_0xf94360,_0x2e67ba){var _0x13508f={},_0x5cbbb8={},_0x5e9982={'count':0x0,'rows':[]};var _0x179398=_[_0x8f6e('0x2c')](db[_0x8f6e('0x2d')][_0x8f6e('0x2e')],function(_0x533fd8){return{'name':_0x533fd8[_0x8f6e('0x2f')],'type':_0x533fd8[_0x8f6e('0x30')][_0x8f6e('0x31')]};});_0x5cbbb8[_0x8f6e('0x32')]=_[_0x8f6e('0x2c')](_0x179398,'name');_0x5cbbb8['query']=_[_0x8f6e('0x33')](_0xf94360[_0x8f6e('0x34')]);_0x5cbbb8[_0x8f6e('0x35')]=_[_0x8f6e('0x36')](_0x5cbbb8[_0x8f6e('0x32')],_0x5cbbb8[_0x8f6e('0x34')]);_0x13508f[_0x8f6e('0x37')]=_[_0x8f6e('0x36')](_0x5cbbb8['model'],qs[_0x8f6e('0x38')](_0xf94360[_0x8f6e('0x34')][_0x8f6e('0x38')]));_0x13508f[_0x8f6e('0x37')]=_0x13508f[_0x8f6e('0x37')][_0x8f6e('0x39')]?_0x13508f[_0x8f6e('0x37')]:_0x5cbbb8[_0x8f6e('0x32')];if(!_0xf94360[_0x8f6e('0x34')][_0x8f6e('0x3a')](_0x8f6e('0x3b'))){_0x13508f[_0x8f6e('0x21')]=qs['limit'](_0xf94360[_0x8f6e('0x34')][_0x8f6e('0x21')]);_0x13508f[_0x8f6e('0x1e')]=qs[_0x8f6e('0x1e')](_0xf94360[_0x8f6e('0x34')]['offset']);}_0x13508f[_0x8f6e('0x3c')]=qs['sort'](_0xf94360[_0x8f6e('0x34')][_0x8f6e('0x3d')]);_0x13508f[_0x8f6e('0x3e')]=qs['filters'](_[_0x8f6e('0x3f')](_0xf94360[_0x8f6e('0x34')],_0x5cbbb8[_0x8f6e('0x35')]),_0x179398);if(_0xf94360[_0x8f6e('0x34')][_0x8f6e('0x40')]){_0x13508f[_0x8f6e('0x3e')]=_[_0x8f6e('0x41')](_0x13508f[_0x8f6e('0x3e')],{'$or':_[_0x8f6e('0x2c')](_0x179398,function(_0x1327e5){if(_0x1327e5[_0x8f6e('0x30')]!==_0x8f6e('0x42')){var _0x178cb1={};_0x178cb1[_0x1327e5[_0x8f6e('0x2a')]]={'$like':'%'+_0xf94360[_0x8f6e('0x34')][_0x8f6e('0x40')]+'%'};return _0x178cb1;}})});}_0x13508f=_[_0x8f6e('0x41')]({},_0x13508f,_0xf94360[_0x8f6e('0x43')]);var _0x3c2d5e={'where':_0x13508f[_0x8f6e('0x3e')]};return db['FreshsalesAccount'][_0x8f6e('0x20')](_0x3c2d5e)[_0x8f6e('0x26')](function(_0x1ba469){_0x5e9982['count']=_0x1ba469;if(_0xf94360[_0x8f6e('0x34')][_0x8f6e('0x44')]){_0x13508f[_0x8f6e('0x45')]=[{'all':!![]}];}return db[_0x8f6e('0x2d')][_0x8f6e('0x46')](_0x13508f);})[_0x8f6e('0x26')](function(_0x119e31){_0x5e9982[_0x8f6e('0x47')]=_0x119e31;return _0x5e9982;})['then'](respondWithFilteredResult(_0x2e67ba,_0x13508f))[_0x8f6e('0x48')](handleError(_0x2e67ba,null));};exports['show']=function(_0x235aff,_0x415468){var _0x385d29={'raw':![],'where':{'id':_0x235aff[_0x8f6e('0x49')]['id']}},_0x32aa4f={};_0x32aa4f[_0x8f6e('0x32')]=_[_0x8f6e('0x33')](db[_0x8f6e('0x2d')][_0x8f6e('0x2e')]);_0x32aa4f['query']=_[_0x8f6e('0x33')](_0x235aff[_0x8f6e('0x34')]);_0x32aa4f[_0x8f6e('0x35')]=_[_0x8f6e('0x36')](_0x32aa4f[_0x8f6e('0x32')],_0x32aa4f[_0x8f6e('0x34')]);_0x385d29['attributes']=_[_0x8f6e('0x36')](_0x32aa4f['model'],qs[_0x8f6e('0x38')](_0x235aff[_0x8f6e('0x34')][_0x8f6e('0x38')]));_0x385d29[_0x8f6e('0x37')]=_0x385d29[_0x8f6e('0x37')][_0x8f6e('0x39')]?_0x385d29['attributes']:_0x32aa4f[_0x8f6e('0x32')];if(_0x235aff[_0x8f6e('0x34')][_0x8f6e('0x44')]){_0x385d29[_0x8f6e('0x45')]=[{'all':!![]}];}_0x385d29=_[_0x8f6e('0x41')]({},_0x385d29,_0x235aff['options']);return db[_0x8f6e('0x2d')][_0x8f6e('0x4a')](_0x385d29)[_0x8f6e('0x26')](handleEntityNotFound(_0x415468,null))['then'](respondWithResult(_0x415468,null))[_0x8f6e('0x48')](handleError(_0x415468,null));};exports[_0x8f6e('0x4b')]=function(_0x322961,_0x24dea0){return db[_0x8f6e('0x2d')][_0x8f6e('0x4b')](_0x322961['body'],{})[_0x8f6e('0x26')](respondWithResult(_0x24dea0,0xc9))[_0x8f6e('0x48')](handleError(_0x24dea0,null));};exports[_0x8f6e('0x4c')]=function(_0x248822,_0x47dac5){if(_0x248822[_0x8f6e('0x4d')]['id']){delete _0x248822[_0x8f6e('0x4d')]['id'];}return db[_0x8f6e('0x2d')][_0x8f6e('0x4a')]({'where':{'id':_0x248822[_0x8f6e('0x49')]['id']}})[_0x8f6e('0x26')](handleEntityNotFound(_0x47dac5,null))[_0x8f6e('0x26')](saveUpdates(_0x248822['body'],null))[_0x8f6e('0x26')](respondWithResult(_0x47dac5,null))['catch'](handleError(_0x47dac5,null));};exports[_0x8f6e('0x27')]=function(_0x3bb6d3,_0x42c249){return db[_0x8f6e('0x2d')]['find']({'where':{'id':_0x3bb6d3[_0x8f6e('0x49')]['id']}})['then'](handleEntityNotFound(_0x42c249,null))[_0x8f6e('0x26')](removeEntity(_0x42c249,null))[_0x8f6e('0x48')](handleError(_0x42c249,null));};exports[_0x8f6e('0x4e')]=function(_0x200786,_0x20c4ca,_0x737846){var _0x2e9162={};var _0x6bc744={};var _0x1967e9;var _0x16d2cb;return db[_0x8f6e('0x2d')][_0x8f6e('0x4f')]({'where':{'id':_0x200786['params']['id']}})[_0x8f6e('0x26')](handleEntityNotFound(_0x20c4ca,null))[_0x8f6e('0x26')](function(_0x442f60){if(_0x442f60){_0x1967e9=_0x442f60;_0x6bc744[_0x8f6e('0x32')]=_['keys'](db[_0x8f6e('0x50')][_0x8f6e('0x2e')]);_0x6bc744['query']=_[_0x8f6e('0x33')](_0x200786[_0x8f6e('0x34')]);_0x6bc744['filters']=_[_0x8f6e('0x36')](_0x6bc744[_0x8f6e('0x32')],_0x6bc744[_0x8f6e('0x34')]);_0x2e9162[_0x8f6e('0x37')]=_[_0x8f6e('0x36')](_0x6bc744['model'],qs['fields'](_0x200786[_0x8f6e('0x34')][_0x8f6e('0x38')]));_0x2e9162[_0x8f6e('0x37')]=_0x2e9162[_0x8f6e('0x37')][_0x8f6e('0x39')]?_0x2e9162['attributes']:_0x6bc744[_0x8f6e('0x32')];_0x2e9162[_0x8f6e('0x3c')]=qs['sort'](_0x200786['query'][_0x8f6e('0x3d')]);_0x2e9162[_0x8f6e('0x3e')]=qs[_0x8f6e('0x35')](_[_0x8f6e('0x3f')](_0x200786[_0x8f6e('0x34')],_0x6bc744[_0x8f6e('0x35')]));if(_0x200786[_0x8f6e('0x34')][_0x8f6e('0x40')]){_0x2e9162[_0x8f6e('0x3e')]=_[_0x8f6e('0x41')](_0x2e9162['where'],{'$or':_[_0x8f6e('0x2c')](_0x2e9162[_0x8f6e('0x37')],function(_0x3dd69c){var _0x1b7705={};_0x1b7705[_0x3dd69c]={'$like':'%'+_0x200786['query'][_0x8f6e('0x40')]+'%'};return _0x1b7705;})});}_0x2e9162=_[_0x8f6e('0x41')]({},_0x2e9162,_0x200786[_0x8f6e('0x43')]);return _0x1967e9[_0x8f6e('0x4e')](_0x2e9162);}})[_0x8f6e('0x26')](function(_0x2aaf83){if(_0x2aaf83){_0x16d2cb=_0x2aaf83[_0x8f6e('0x39')];if(!_0x200786[_0x8f6e('0x34')][_0x8f6e('0x3a')](_0x8f6e('0x3b'))){_0x2e9162[_0x8f6e('0x21')]=qs['limit'](_0x200786[_0x8f6e('0x34')][_0x8f6e('0x21')]);_0x2e9162[_0x8f6e('0x1e')]=qs[_0x8f6e('0x1e')](_0x200786[_0x8f6e('0x34')][_0x8f6e('0x1e')]);}return _0x1967e9[_0x8f6e('0x4e')](_0x2e9162);}})[_0x8f6e('0x26')](function(_0x2ce966){if(_0x2ce966){return _0x2ce966?{'count':_0x16d2cb,'rows':_0x2ce966}:null;}})['then'](respondWithResult(_0x20c4ca,null))['catch'](handleError(_0x20c4ca,null));};exports[_0x8f6e('0x51')]=function(_0x37d05b,_0x3eee92,_0x141d04){if(_0x37d05b[_0x8f6e('0x4d')]['id']){delete _0x37d05b[_0x8f6e('0x4d')]['id'];}return db[_0x8f6e('0x2d')][_0x8f6e('0x4f')]({'where':{'id':_0x37d05b['params']['id']}})[_0x8f6e('0x26')](handleEntityNotFound(_0x3eee92,null))[_0x8f6e('0x26')](function(_0x42c366){if(_0x42c366){_0x37d05b[_0x8f6e('0x4d')][_0x8f6e('0x52')]=_0x42c366['id'];_0x37d05b[_0x8f6e('0x4d')][_0x8f6e('0x53')]=integrations[_0x8f6e('0x54')](_0x37d05b[_0x8f6e('0x4d')][_0x8f6e('0x55')],_0x37d05b['body'][_0x8f6e('0x30')]);_0x37d05b['body']['Descriptions']=integrations[_0x8f6e('0x56')](_0x37d05b[_0x8f6e('0x4d')][_0x8f6e('0x55')],_0x37d05b['body']['type']);return db[_0x8f6e('0x50')]['create'](_0x37d05b[_0x8f6e('0x4d')],{'include':[{'model':db[_0x8f6e('0x57')],'as':_0x8f6e('0x53')},{'model':db[_0x8f6e('0x57')],'as':_0x8f6e('0x58')}]});}return null;})[_0x8f6e('0x26')](respondWithResult(_0x3eee92,null))[_0x8f6e('0x48')](handleError(_0x3eee92,null));};exports['getFields']=function(_0x41d80a,_0x90fb59,_0x11f5ab){var _0x4bfc13='';var _0x514312='';return db[_0x8f6e('0x2d')][_0x8f6e('0x4f')]({'where':{'id':_0x41d80a[_0x8f6e('0x49')]['id']},'attributes':['id',_0x8f6e('0x59'),_0x8f6e('0x5a'),_0x8f6e('0x5b')]})[_0x8f6e('0x26')](handleEntityNotFound(_0x90fb59,null))['then'](function(_0x294895){if(_0x294895){_0x514312=_0x294895[_0x8f6e('0x59')];_0x4bfc13=_0x294895[_0x8f6e('0x5a')];var _0x8017ca=_0x294895[_0x8f6e('0x5a')][_0x8f6e('0x5c')](-0x1);if(_0x8017ca==='/'){_0x4bfc13=_0x4bfc13[_0x8f6e('0x5d')](0x0,_0x4bfc13['lastIndexOf'](_0x8017ca));}return rp({'method':'GET','uri':util['format'](_0x8f6e('0x5e'),_0x4bfc13,_0x8f6e('0x5f')),'headers':{'Authorization':_0x8f6e('0x60')+_0x294895[_0x8f6e('0x5b')]},'json':!![]});}})[_0x8f6e('0x26')](function(_0x564dba){if(_0x564dba){var _0xb39211=_0x564dba[_0x8f6e('0x61')];var _0x5b7e87=![];var _0x4eacf6=null;for(_0x4eacf6=0x0;_0x4eacf6<_0xb39211[_0x8f6e('0x39')];_0x4eacf6++){if(_0xb39211[_0x4eacf6][_0x8f6e('0x62')]===_0x514312){_0x5b7e87=!![];}}if(_0x5b7e87){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8f6e('0x26')](respondWithResult(_0x90fb59,null))[_0x8f6e('0x48')](function(_0x3cdc58){var _0x2a9c42=_0x41d80a['query']['test']?0x1f4:_0x3cdc58[_0x8f6e('0x63')]||0x1f4;logger['error'](_0x8f6e('0x64'),'getFields',_0x2a9c42,JSON['stringify'](_0x3cdc58));delete _0x3cdc58['name'];if(_0x2a9c42===0x191){_0x2a9c42=0x190;}_0x90fb59[_0x8f6e('0x1b')](_0x2a9c42)['send'](_0x41d80a[_0x8f6e('0x34')][_0x8f6e('0x65')]?{'message':_0x8f6e('0x66'),'statusCode':_0x3cdc58[_0x8f6e('0x63')]}:_0x3cdc58);});}; \ No newline at end of file +var _0x6545=['save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','findOne','FreshsalesConfiguration','filters','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6545,0xac));var _0x5654=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6545[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x5654('0x0'));var rimraf=require(_0x5654('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5654('0x2'));var moment=require(_0x5654('0x3'));var BPromise=require(_0x5654('0x4'));var Mustache=require(_0x5654('0x5'));var util=require(_0x5654('0x6'));var path=require(_0x5654('0x7'));var sox=require(_0x5654('0x8'));var csv=require(_0x5654('0x9'));var ejs=require(_0x5654('0xa'));var fs=require('fs');var fs_extra=require(_0x5654('0xb'));var _=require(_0x5654('0xc'));var squel=require(_0x5654('0xd'));var crypto=require('crypto');var jsforce=require(_0x5654('0xe'));var deskjs=require(_0x5654('0xf'));var toCsv=require(_0x5654('0x9'));var querystring=require(_0x5654('0x10'));var Papa=require('papaparse');var Redis=require(_0x5654('0x11'));var authService=require(_0x5654('0x12'));var qs=require(_0x5654('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5654('0x14'));var logger=require(_0x5654('0x15'))(_0x5654('0x16'));var utils=require(_0x5654('0x17'));var config=require(_0x5654('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5654('0x19'))['db'];var integrations=require(_0x5654('0x1a'));function respondWithStatusCode(_0x524045,_0xf1bea1){_0xf1bea1=_0xf1bea1||0xcc;return function(_0x3a98b8){if(_0x3a98b8){return _0x524045[_0x5654('0x1b')](_0xf1bea1);}return _0x524045[_0x5654('0x1c')](_0xf1bea1)[_0x5654('0x1d')]();};}function respondWithResult(_0x1702dc,_0x87510c){_0x87510c=_0x87510c||0xc8;return function(_0x25ec10){if(_0x25ec10){return _0x1702dc[_0x5654('0x1c')](_0x87510c)[_0x5654('0x1e')](_0x25ec10);}};}function respondWithFilteredResult(_0x1a932e,_0x3c8cf5){return function(_0x308c67){if(_0x308c67){var _0x2d9f9d=typeof _0x3c8cf5['offset']===_0x5654('0x1f')&&typeof _0x3c8cf5[_0x5654('0x20')]===_0x5654('0x1f');var _0x3bddcf=_0x308c67[_0x5654('0x21')];var _0x49021=_0x2d9f9d?0x0:_0x3c8cf5[_0x5654('0x22')];var _0x586a03=_0x2d9f9d?_0x308c67[_0x5654('0x21')]:_0x3c8cf5[_0x5654('0x22')]+_0x3c8cf5[_0x5654('0x20')];var _0x2edda6;if(_0x586a03>=_0x3bddcf){_0x586a03=_0x3bddcf;_0x2edda6=0xc8;}else{_0x2edda6=0xce;}_0x1a932e[_0x5654('0x1c')](_0x2edda6);return _0x1a932e[_0x5654('0x23')]('Content-Range',_0x49021+'-'+_0x586a03+'/'+_0x3bddcf)['json'](_0x308c67);}return null;};}function patchUpdates(_0x27d0b1){return function(_0x6d1461){try{jsonpatch[_0x5654('0x24')](_0x6d1461,_0x27d0b1,!![]);}catch(_0x1a9b28){return BPromise[_0x5654('0x25')](_0x1a9b28);}return _0x6d1461[_0x5654('0x26')]();};}function saveUpdates(_0x3f3487,_0x200313){return function(_0x3e19e1){if(_0x3e19e1){return _0x3e19e1[_0x5654('0x27')](_0x3f3487)[_0x5654('0x28')](function(_0x184ff0){return _0x184ff0;});}return null;};}function removeEntity(_0x2d6b43,_0x280922){return function(_0x252de5){if(_0x252de5){return _0x252de5[_0x5654('0x29')]()[_0x5654('0x28')](function(){_0x2d6b43[_0x5654('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d652,_0x5f33fe){return function(_0x118e99){if(!_0x118e99){_0x23d652['sendStatus'](0x194);}return _0x118e99;};}function handleError(_0x1aa090,_0x198bbd){_0x198bbd=_0x198bbd||0x1f4;return function(_0x4d9ac4){logger[_0x5654('0x2a')](_0x4d9ac4[_0x5654('0x2b')]);if(_0x4d9ac4['name']){delete _0x4d9ac4[_0x5654('0x2c')];}_0x1aa090[_0x5654('0x1c')](_0x198bbd)[_0x5654('0x2d')](_0x4d9ac4);};}exports[_0x5654('0x2e')]=function(_0x45bcd2,_0xc27517){var _0x47a77b={},_0x3773c5={},_0x3f7ed7={'count':0x0,'rows':[]};var _0x1281fd=_[_0x5654('0x2f')](db[_0x5654('0x30')]['rawAttributes'],function(_0x595656){return{'name':_0x595656['fieldName'],'type':_0x595656[_0x5654('0x31')][_0x5654('0x32')]};});_0x3773c5['model']=_[_0x5654('0x2f')](_0x1281fd,_0x5654('0x2c'));_0x3773c5[_0x5654('0x33')]=_[_0x5654('0x34')](_0x45bcd2['query']);_0x3773c5['filters']=_[_0x5654('0x35')](_0x3773c5['model'],_0x3773c5[_0x5654('0x33')]);_0x47a77b[_0x5654('0x36')]=_[_0x5654('0x35')](_0x3773c5[_0x5654('0x37')],qs[_0x5654('0x38')](_0x45bcd2[_0x5654('0x33')][_0x5654('0x38')]));_0x47a77b[_0x5654('0x36')]=_0x47a77b[_0x5654('0x36')]['length']?_0x47a77b['attributes']:_0x3773c5[_0x5654('0x37')];if(!_0x45bcd2[_0x5654('0x33')][_0x5654('0x39')](_0x5654('0x3a'))){_0x47a77b['limit']=qs[_0x5654('0x20')](_0x45bcd2[_0x5654('0x33')]['limit']);_0x47a77b['offset']=qs[_0x5654('0x22')](_0x45bcd2[_0x5654('0x33')][_0x5654('0x22')]);}_0x47a77b[_0x5654('0x3b')]=qs['sort'](_0x45bcd2[_0x5654('0x33')][_0x5654('0x3c')]);_0x47a77b[_0x5654('0x3d')]=qs['filters'](_['pick'](_0x45bcd2[_0x5654('0x33')],_0x3773c5['filters']),_0x1281fd);if(_0x45bcd2['query']['filter']){_0x47a77b[_0x5654('0x3d')]=_['merge'](_0x47a77b[_0x5654('0x3d')],{'$or':_[_0x5654('0x2f')](_0x1281fd,function(_0x39a315){if(_0x39a315[_0x5654('0x31')]!==_0x5654('0x3e')){var _0x55eb36={};_0x55eb36[_0x39a315[_0x5654('0x2c')]]={'$like':'%'+_0x45bcd2[_0x5654('0x33')][_0x5654('0x3f')]+'%'};return _0x55eb36;}})});}_0x47a77b=_[_0x5654('0x40')]({},_0x47a77b,_0x45bcd2['options']);var _0x47ca57={'where':_0x47a77b['where']};return db[_0x5654('0x30')]['count'](_0x47ca57)[_0x5654('0x28')](function(_0x51e82a){_0x3f7ed7['count']=_0x51e82a;if(_0x45bcd2[_0x5654('0x33')][_0x5654('0x41')]){_0x47a77b[_0x5654('0x42')]=[{'all':!![]}];}return db[_0x5654('0x30')][_0x5654('0x43')](_0x47a77b);})[_0x5654('0x28')](function(_0x5bceb5){_0x3f7ed7[_0x5654('0x44')]=_0x5bceb5;return _0x3f7ed7;})[_0x5654('0x28')](respondWithFilteredResult(_0xc27517,_0x47a77b))[_0x5654('0x45')](handleError(_0xc27517,null));};exports[_0x5654('0x46')]=function(_0x40614e,_0x1a19e){var _0x2c0066={'raw':![],'where':{'id':_0x40614e[_0x5654('0x47')]['id']}},_0x52c11b={};_0x52c11b[_0x5654('0x37')]=_[_0x5654('0x34')](db[_0x5654('0x30')][_0x5654('0x48')]);_0x52c11b[_0x5654('0x33')]=_[_0x5654('0x34')](_0x40614e[_0x5654('0x33')]);_0x52c11b['filters']=_[_0x5654('0x35')](_0x52c11b[_0x5654('0x37')],_0x52c11b[_0x5654('0x33')]);_0x2c0066[_0x5654('0x36')]=_[_0x5654('0x35')](_0x52c11b[_0x5654('0x37')],qs[_0x5654('0x38')](_0x40614e['query']['fields']));_0x2c0066['attributes']=_0x2c0066[_0x5654('0x36')][_0x5654('0x49')]?_0x2c0066['attributes']:_0x52c11b['model'];if(_0x40614e[_0x5654('0x33')][_0x5654('0x41')]){_0x2c0066[_0x5654('0x42')]=[{'all':!![]}];}_0x2c0066=_[_0x5654('0x40')]({},_0x2c0066,_0x40614e[_0x5654('0x4a')]);return db['FreshsalesAccount'][_0x5654('0x4b')](_0x2c0066)['then'](handleEntityNotFound(_0x1a19e,null))[_0x5654('0x28')](respondWithResult(_0x1a19e,null))[_0x5654('0x45')](handleError(_0x1a19e,null));};exports[_0x5654('0x4c')]=function(_0xdb69d4,_0x31aa9a){return db[_0x5654('0x30')][_0x5654('0x4c')](_0xdb69d4[_0x5654('0x4d')],{})['then'](respondWithResult(_0x31aa9a,0xc9))[_0x5654('0x45')](handleError(_0x31aa9a,null));};exports[_0x5654('0x27')]=function(_0x41fe2d,_0x173498){if(_0x41fe2d['body']['id']){delete _0x41fe2d[_0x5654('0x4d')]['id'];}return db[_0x5654('0x30')][_0x5654('0x4b')]({'where':{'id':_0x41fe2d['params']['id']}})[_0x5654('0x28')](handleEntityNotFound(_0x173498,null))[_0x5654('0x28')](saveUpdates(_0x41fe2d['body'],null))['then'](respondWithResult(_0x173498,null))[_0x5654('0x45')](handleError(_0x173498,null));};exports[_0x5654('0x29')]=function(_0x44ed04,_0x3d7802){return db[_0x5654('0x30')]['find']({'where':{'id':_0x44ed04[_0x5654('0x47')]['id']}})[_0x5654('0x28')](handleEntityNotFound(_0x3d7802,null))[_0x5654('0x28')](removeEntity(_0x3d7802,null))[_0x5654('0x45')](handleError(_0x3d7802,null));};exports['getConfigurations']=function(_0x5cce33,_0x4e36bf,_0x30ec64){var _0x5c82f1={};var _0x46a0bf={};var _0x2b948b;var _0x55b75f;return db['FreshsalesAccount'][_0x5654('0x4e')]({'where':{'id':_0x5cce33[_0x5654('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e36bf,null))[_0x5654('0x28')](function(_0x2a32ff){if(_0x2a32ff){_0x2b948b=_0x2a32ff;_0x46a0bf[_0x5654('0x37')]=_[_0x5654('0x34')](db[_0x5654('0x4f')][_0x5654('0x48')]);_0x46a0bf[_0x5654('0x33')]=_[_0x5654('0x34')](_0x5cce33[_0x5654('0x33')]);_0x46a0bf[_0x5654('0x50')]=_[_0x5654('0x35')](_0x46a0bf['model'],_0x46a0bf[_0x5654('0x33')]);_0x5c82f1[_0x5654('0x36')]=_[_0x5654('0x35')](_0x46a0bf[_0x5654('0x37')],qs[_0x5654('0x38')](_0x5cce33[_0x5654('0x33')][_0x5654('0x38')]));_0x5c82f1[_0x5654('0x36')]=_0x5c82f1['attributes'][_0x5654('0x49')]?_0x5c82f1[_0x5654('0x36')]:_0x46a0bf['model'];_0x5c82f1['order']=qs[_0x5654('0x3c')](_0x5cce33[_0x5654('0x33')][_0x5654('0x3c')]);_0x5c82f1[_0x5654('0x3d')]=qs[_0x5654('0x50')](_['pick'](_0x5cce33[_0x5654('0x33')],_0x46a0bf[_0x5654('0x50')]));if(_0x5cce33['query'][_0x5654('0x3f')]){_0x5c82f1['where']=_[_0x5654('0x40')](_0x5c82f1[_0x5654('0x3d')],{'$or':_[_0x5654('0x2f')](_0x5c82f1[_0x5654('0x36')],function(_0x2d9c37){var _0x4944a5={};_0x4944a5[_0x2d9c37]={'$like':'%'+_0x5cce33[_0x5654('0x33')][_0x5654('0x3f')]+'%'};return _0x4944a5;})});}_0x5c82f1=_[_0x5654('0x40')]({},_0x5c82f1,_0x5cce33[_0x5654('0x4a')]);return _0x2b948b[_0x5654('0x51')](_0x5c82f1);}})[_0x5654('0x28')](function(_0x337e50){if(_0x337e50){_0x55b75f=_0x337e50[_0x5654('0x49')];if(!_0x5cce33[_0x5654('0x33')]['hasOwnProperty']('nolimit')){_0x5c82f1[_0x5654('0x20')]=qs[_0x5654('0x20')](_0x5cce33[_0x5654('0x33')]['limit']);_0x5c82f1['offset']=qs[_0x5654('0x22')](_0x5cce33[_0x5654('0x33')][_0x5654('0x22')]);}return _0x2b948b['getConfigurations'](_0x5c82f1);}})[_0x5654('0x28')](function(_0x43f049){if(_0x43f049){return _0x43f049?{'count':_0x55b75f,'rows':_0x43f049}:null;}})[_0x5654('0x28')](respondWithResult(_0x4e36bf,null))[_0x5654('0x45')](handleError(_0x4e36bf,null));};exports[_0x5654('0x52')]=function(_0x370faa,_0x790f35,_0x426480){if(_0x370faa[_0x5654('0x4d')]['id']){delete _0x370faa[_0x5654('0x4d')]['id'];}return db['FreshsalesAccount'][_0x5654('0x4e')]({'where':{'id':_0x370faa[_0x5654('0x47')]['id']}})['then'](handleEntityNotFound(_0x790f35,null))['then'](function(_0x4879a7){if(_0x4879a7){_0x370faa[_0x5654('0x4d')]['AccountId']=_0x4879a7['id'];_0x370faa['body']['Subjects']=integrations[_0x5654('0x53')](_0x370faa[_0x5654('0x4d')][_0x5654('0x54')],_0x370faa[_0x5654('0x4d')][_0x5654('0x31')]);_0x370faa[_0x5654('0x4d')][_0x5654('0x55')]=integrations['getDescriptions'](_0x370faa['body'][_0x5654('0x54')],_0x370faa[_0x5654('0x4d')][_0x5654('0x31')]);return db[_0x5654('0x4f')][_0x5654('0x4c')](_0x370faa[_0x5654('0x4d')],{'include':[{'model':db[_0x5654('0x56')],'as':'Subjects'},{'model':db[_0x5654('0x56')],'as':_0x5654('0x55')}]});}return null;})[_0x5654('0x28')](respondWithResult(_0x790f35,null))['catch'](handleError(_0x790f35,null));};exports[_0x5654('0x57')]=function(_0x20bc89,_0x4686ef,_0x59831f){var _0x2da4ca='';var _0x1d8b27='';return db[_0x5654('0x30')][_0x5654('0x4e')]({'where':{'id':_0x20bc89[_0x5654('0x47')]['id']},'attributes':['id',_0x5654('0x58'),_0x5654('0x59'),_0x5654('0x5a')]})['then'](handleEntityNotFound(_0x4686ef,null))[_0x5654('0x28')](function(_0x4972dc){if(_0x4972dc){_0x1d8b27=_0x4972dc[_0x5654('0x58')];_0x2da4ca=_0x4972dc['remoteUri'];var _0x2d0297=_0x4972dc[_0x5654('0x59')][_0x5654('0x5b')](-0x1);if(_0x2d0297==='/'){_0x2da4ca=_0x2da4ca[_0x5654('0x5c')](0x0,_0x2da4ca[_0x5654('0x5d')](_0x2d0297));}return rp({'method':_0x5654('0x5e'),'uri':util['format'](_0x5654('0x5f'),_0x2da4ca,_0x5654('0x60')),'headers':{'Authorization':_0x5654('0x61')+_0x4972dc[_0x5654('0x5a')]},'json':!![]});}})[_0x5654('0x28')](function(_0x34fec5){if(_0x34fec5){var _0x42131a=_0x34fec5[_0x5654('0x62')];var _0x2fd035=![];var _0x167b8d=null;for(_0x167b8d=0x0;_0x167b8d<_0x42131a[_0x5654('0x49')];_0x167b8d++){if(_0x42131a[_0x167b8d][_0x5654('0x63')]===_0x1d8b27){_0x2fd035=!![];}}if(_0x2fd035){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5654('0x64')});}}})['then'](respondWithResult(_0x4686ef,null))[_0x5654('0x45')](function(_0x4ade3a){var _0x57589d=_0x20bc89[_0x5654('0x33')][_0x5654('0x65')]?0x1f4:_0x4ade3a[_0x5654('0x66')]||0x1f4;logger['error'](_0x5654('0x67'),_0x5654('0x57'),_0x57589d,JSON[_0x5654('0x68')](_0x4ade3a));delete _0x4ade3a[_0x5654('0x2c')];if(_0x57589d===0x191){_0x57589d=0x190;}_0x4686ef[_0x5654('0x1c')](_0x57589d)['send'](_0x20bc89[_0x5654('0x33')][_0x5654('0x65')]?{'message':'Wrong\x20credentials','statusCode':_0x4ade3a[_0x5654('0x66')]}:_0x4ade3a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index adb4d23..9a5bf75 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 _0x4bd3=['define','int_freshsales_accounts','lodash','../../config/logger','api','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x4bd3,0x174));var _0x34bd=function(_0x243fee,_0x3f9d06){_0x243fee=_0x243fee-0x0;var _0xf6907e=_0x4bd3[_0x243fee];return _0xf6907e;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x34bd('0x6'));module[_0x34bd('0x7')]=function(_0x5c2a7a,_0x3e8744){return _0x5c2a7a[_0x34bd('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x34bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','bluebird','request-promise'];(function(_0x7e2aa8,_0x482ce9){var _0xc6dd82=function(_0x2df61e){while(--_0x2df61e){_0x7e2aa8['push'](_0x7e2aa8['shift']());}};_0xc6dd82(++_0x482ce9);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 98cc224..aad8e49 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 _0x781d=['model','map','GetFreshsalesAccount','find','ShowFreshsalesAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x2df724,_0x411382){var _0x1b2504=function(_0x1d3cd1){while(--_0x1d3cd1){_0x2df724['push'](_0x2df724['shift']());}};_0x1b2504(++_0x411382);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['GetFreshsalesAccount']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')]({'raw':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'limit':_0x1407fc[_0xd781('0x19')]?_0x1407fc['options'][_0xd781('0x1c')]||null:null,'include':_0x1407fc['options']?_0x1407fc['options'][_0xd781('0x1d')]?_['map'](_0x1407fc[_0xd781('0x19')][_0xd781('0x1d')],function(_0x395087){return{'model':db[_0x395087[_0xd781('0x1e')]],'as':_0x395087['as'],'attributes':_0x395087[_0xd781('0x1b')],'include':_0x395087[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x395087[_0xd781('0x1d')],function(_0x10940b){return{'model':db[_0x10940b['model']],'as':_0x10940b['as'],'attributes':_0x10940b['attributes'],'include':_0x10940b[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x10940b[_0xd781('0x1d')],function(_0x57b41e){return{'model':db[_0x57b41e[_0xd781('0x1e')]],'as':_0x57b41e['as'],'attributes':_0x57b41e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e29c8){logger['info'](_0xd781('0x20'),_0x1407fc);logger[_0xd781('0xf')]('GetFreshsalesAccount',_0x1407fc,JSON['stringify'](_0x1e29c8));_0x395d9c(_0x1e29c8);})[_0xd781('0x16')](function(_0x5b0464){logger[_0xd781('0x11')]('GetFreshsalesAccount',_0x5b0464[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x5b0464['message']));});});};exports['ShowFreshsalesAccount']=function(_0x432d14){var _0x29e81a=this;return new Promise(function(_0x1c7d83,_0x5a389c){return db['FreshsalesAccount'][_0xd781('0x21')]({'raw':_0x432d14[_0xd781('0x19')]?_0x432d14[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'include':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x432d14[_0xd781('0x19')]['include'],function(_0x23dffb){return{'model':db[_0x23dffb[_0xd781('0x1e')]],'as':_0x23dffb['as'],'attributes':_0x23dffb[_0xd781('0x1b')],'include':_0x23dffb[_0xd781('0x1d')]?_['map'](_0x23dffb[_0xd781('0x1d')],function(_0x3f20e2){return{'model':db[_0x3f20e2['model']],'as':_0x3f20e2['as'],'attributes':_0x3f20e2[_0xd781('0x1b')],'include':_0x3f20e2['include']?_[_0xd781('0x1f')](_0x3f20e2[_0xd781('0x1d')],function(_0x57fdb6){return{'model':db[_0x57fdb6[_0xd781('0x1e')]],'as':_0x57fdb6['as'],'attributes':_0x57fdb6[_0xd781('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a29b7){logger['info'](_0xd781('0x22'),_0x432d14);logger[_0xd781('0xf')]('ShowFreshsalesAccount',_0x432d14,JSON[_0xd781('0x23')](_0x2a29b7));_0x1c7d83(_0x2a29b7);})[_0xd781('0x16')](function(_0x5651de){logger[_0xd781('0x11')](_0xd781('0x22'),_0x5651de[_0xd781('0x13')],_0x432d14);_0x5a389c(_0x29e81a['error'](0x1f4,_0x5651de[_0xd781('0x13')]));});});}; \ No newline at end of file +var _0x0120=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','catch','FreshsalesAccount','find','ShowFreshsalesAccount','lodash','util','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0120,0x6f));var _0x0012=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x0120[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});}exports[_0x0012('0x16')]=function(_0x1d0423){var _0x22ded1=this;return new Promise(function(_0x1e78ee,_0x2eb3fa){return db['FreshsalesAccount'][_0x0012('0x17')]({'raw':_0x1d0423[_0x0012('0x18')]?_0x1d0423['options'][_0x0012('0x19')]===undefined?!![]:![]:!![],'where':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x1d0423['options']?_0x1d0423['options'][_0x0012('0x1b')]||null:null,'limit':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1c')]||null:null,'include':_0x1d0423[_0x0012('0x18')]?_0x1d0423[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x1d0423['options'][_0x0012('0x1d')],function(_0x24a280){return{'model':db[_0x24a280['model']],'as':_0x24a280['as'],'attributes':_0x24a280[_0x0012('0x1b')],'include':_0x24a280[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x24a280[_0x0012('0x1d')],function(_0x42bcd7){return{'model':db[_0x42bcd7['model']],'as':_0x42bcd7['as'],'attributes':_0x42bcd7[_0x0012('0x1b')],'include':_0x42bcd7[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x42bcd7[_0x0012('0x1d')],function(_0x173cb3){return{'model':db[_0x173cb3[_0x0012('0x1f')]],'as':_0x173cb3['as'],'attributes':_0x173cb3[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0012('0x20')](function(_0x300e13){logger[_0x0012('0xd')](_0x0012('0x16'),_0x1d0423);logger[_0x0012('0x21')](_0x0012('0x16'),_0x1d0423,JSON[_0x0012('0x11')](_0x300e13));_0x1e78ee(_0x300e13);})[_0x0012('0x22')](function(_0x276389){logger[_0x0012('0x12')](_0x0012('0x16'),_0x276389[_0x0012('0x14')],_0x1d0423);_0x2eb3fa(_0x22ded1[_0x0012('0x12')](0x1f4,_0x276389[_0x0012('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x283134){var _0x1bb49b=this;return new Promise(function(_0x4c2601,_0x2fa6a2){return db[_0x0012('0x23')][_0x0012('0x24')]({'raw':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1a')]||null:null,'attributes':_0x283134['options']?_0x283134[_0x0012('0x18')][_0x0012('0x1b')]||null:null,'include':_0x283134[_0x0012('0x18')]?_0x283134[_0x0012('0x18')][_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x283134['options'][_0x0012('0x1d')],function(_0x30dfd8){return{'model':db[_0x30dfd8[_0x0012('0x1f')]],'as':_0x30dfd8['as'],'attributes':_0x30dfd8[_0x0012('0x1b')],'include':_0x30dfd8['include']?_['map'](_0x30dfd8[_0x0012('0x1d')],function(_0x30f8a2){return{'model':db[_0x30f8a2[_0x0012('0x1f')]],'as':_0x30f8a2['as'],'attributes':_0x30f8a2[_0x0012('0x1b')],'include':_0x30f8a2[_0x0012('0x1d')]?_[_0x0012('0x1e')](_0x30f8a2[_0x0012('0x1d')],function(_0x4f13b9){return{'model':db[_0x4f13b9[_0x0012('0x1f')]],'as':_0x4f13b9['as'],'attributes':_0x4f13b9[_0x0012('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x196222){logger[_0x0012('0xd')](_0x0012('0x25'),_0x283134);logger[_0x0012('0x21')](_0x0012('0x25'),_0x283134,JSON[_0x0012('0x11')](_0x196222));_0x4c2601(_0x196222);})[_0x0012('0x22')](function(_0x4a4af8){logger[_0x0012('0x12')]('ShowFreshsalesAccount',_0x4a4af8[_0x0012('0x14')],_0x283134);_0x2fa6a2(_0x1bb49b['error'](0x1f4,_0x4a4af8['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6462e55..0c78525 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 _0x78e4=['post','create','put','/:id','exports','multer','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','show','getDescriptions','/:id/fields'];(function(_0x3c21d5,_0x358976){var _0x46f1fe=function(_0xe6f65a){while(--_0xe6f65a){_0x3c21d5['push'](_0x3c21d5['shift']());}};_0x46f1fe(++_0x358976);}(_0x78e4,0x1a9));var _0x478e=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x78e4[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0x478e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x478e('0x1'));var auth=require(_0x478e('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x478e('0x3'));var controller=require(_0x478e('0x4'));router[_0x478e('0x5')]('/',auth[_0x478e('0x6')](),controller['index']);router['get']('/:id',auth[_0x478e('0x6')](),controller[_0x478e('0x7')]);router[_0x478e('0x5')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x478e('0x5')]('/:id/descriptions',auth[_0x478e('0x6')](),controller[_0x478e('0x8')]);router[_0x478e('0x5')](_0x478e('0x9'),auth[_0x478e('0x6')](),controller['getFields']);router[_0x478e('0xa')]('/',auth['isAuthenticated'](),controller[_0x478e('0xb')]);router[_0x478e('0xc')](_0x478e('0xd'),auth[_0x478e('0x6')](),controller['update']);router['delete'](_0x478e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x478e('0xe')]=router; \ No newline at end of file +var _0xd8a1=['Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post','create','put','delete','destroy','exports','multer','path','express'];(function(_0x1d9d45,_0x14e128){var _0x4b8d4c=function(_0x89e545){while(--_0x89e545){_0x1d9d45['push'](_0x1d9d45['shift']());}};_0x4b8d4c(++_0x14e128);}(_0xd8a1,0xb5));var _0x1d8a=function(_0x4c77c8,_0x6dc83d){_0x4c77c8=_0x4c77c8-0x0;var _0x8ad0f7=_0xd8a1[_0x4c77c8];return _0x8ad0f7;};'use strict';var multer=require(_0x1d8a('0x0'));var util=require('util');var path=require(_0x1d8a('0x1'));var timeout=require('connect-timeout');var express=require(_0x1d8a('0x2'));var router=express[_0x1d8a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1d8a('0x4'));var interaction=require(_0x1d8a('0x5'));var config=require('../../config/environment');var controller=require(_0x1d8a('0x6'));router[_0x1d8a('0x7')]('/',auth[_0x1d8a('0x8')](),controller[_0x1d8a('0x9')]);router['get'](_0x1d8a('0xa'),auth[_0x1d8a('0x8')](),controller[_0x1d8a('0xb')]);router['get'](_0x1d8a('0xc'),auth[_0x1d8a('0x8')](),controller[_0x1d8a('0xd')]);router['get'](_0x1d8a('0xe'),auth[_0x1d8a('0x8')](),controller[_0x1d8a('0xf')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x1d8a('0x10')]);router[_0x1d8a('0x11')]('/',auth[_0x1d8a('0x8')](),controller[_0x1d8a('0x12')]);router[_0x1d8a('0x13')](_0x1d8a('0xa'),auth[_0x1d8a('0x8')](),controller['update']);router[_0x1d8a('0x14')](_0x1d8a('0xa'),auth[_0x1d8a('0x8')](),controller[_0x1d8a('0x15')]);module[_0x1d8a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 13407f0..20e1e59 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 _0x8a13=['STRING','sequelize','exports'];(function(_0x4a1ec0,_0x26287b){var _0x49ab91=function(_0x206584){while(--_0x206584){_0x4a1ec0['push'](_0x4a1ec0['shift']());}};_0x49ab91(++_0x26287b);}(_0x8a13,0xe5));var _0x38a1=function(_0x42acfc,_0x349f46){_0x42acfc=_0x42acfc-0x0;var _0x24b053=_0x8a13[_0x42acfc];return _0x24b053;};'use strict';var Sequelize=require(_0x38a1('0x0'));module[_0x38a1('0x1')]={'name':{'type':Sequelize[_0x38a1('0x2')]},'description':{'type':Sequelize[_0x38a1('0x2')]}}; \ No newline at end of file +var _0x6f85=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f85,0xe7));var _0x56f8=function(_0x484bf4,_0x2b975c){_0x484bf4=_0x484bf4-0x0;var _0x31c683=_0x6f85[_0x484bf4];return _0x31c683;};'use strict';var Sequelize=require(_0x56f8('0x0'));module[_0x56f8('0x1')]={'name':{'type':Sequelize[_0x56f8('0x2')]},'description':{'type':Sequelize[_0x56f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 738e7a9..6bf5e0c 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 _0x0fcc=['util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','then','error','stack','name','send','index','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','options','FreshsalesConfiguration','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','getSubjects','findOne','FreshsalesField','rawAttributes','getDescriptions','getFields','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x0fcc,0x8f));var _0xc0fc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0fcc[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc0fc('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0fc('0x1'));var moment=require(_0xc0fc('0x2'));var BPromise=require(_0xc0fc('0x3'));var Mustache=require(_0xc0fc('0x4'));var util=require(_0xc0fc('0x5'));var path=require(_0xc0fc('0x6'));var sox=require(_0xc0fc('0x7'));var csv=require('to-csv');var ejs=require(_0xc0fc('0x8'));var fs=require('fs');var fs_extra=require(_0xc0fc('0x9'));var _=require(_0xc0fc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc0fc('0xb'));var deskjs=require(_0xc0fc('0xc'));var toCsv=require(_0xc0fc('0xd'));var querystring=require('querystring');var Papa=require(_0xc0fc('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc0fc('0xf'));var as=require(_0xc0fc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0fc('0x11'))('api');var utils=require(_0xc0fc('0x12'));var config=require(_0xc0fc('0x13'));var licenseUtil=require(_0xc0fc('0x14'));var db=require(_0xc0fc('0x15'))['db'];function respondWithStatusCode(_0x1bbb49,_0x306e6f){_0x306e6f=_0x306e6f||0xcc;return function(_0xe075c5){if(_0xe075c5){return _0x1bbb49[_0xc0fc('0x16')](_0x306e6f);}return _0x1bbb49['status'](_0x306e6f)['end']();};}function respondWithResult(_0x1363fb,_0x3564a6){_0x3564a6=_0x3564a6||0xc8;return function(_0x287393){if(_0x287393){return _0x1363fb['status'](_0x3564a6)[_0xc0fc('0x17')](_0x287393);}};}function respondWithFilteredResult(_0x72e820,_0x287838){return function(_0x51509b){if(_0x51509b){var _0x1e94f4=typeof _0x287838[_0xc0fc('0x18')]===_0xc0fc('0x19')&&typeof _0x287838[_0xc0fc('0x1a')]==='undefined';var _0x2a38e3=_0x51509b[_0xc0fc('0x1b')];var _0x28aed4=_0x1e94f4?0x0:_0x287838[_0xc0fc('0x18')];var _0x2ae887=_0x1e94f4?_0x51509b['count']:_0x287838['offset']+_0x287838['limit'];var _0x2408d7;if(_0x2ae887>=_0x2a38e3){_0x2ae887=_0x2a38e3;_0x2408d7=0xc8;}else{_0x2408d7=0xce;}_0x72e820[_0xc0fc('0x1c')](_0x2408d7);return _0x72e820[_0xc0fc('0x1d')]('Content-Range',_0x28aed4+'-'+_0x2ae887+'/'+_0x2a38e3)[_0xc0fc('0x17')](_0x51509b);}return null;};}function patchUpdates(_0x57b46f){return function(_0x13913e){try{jsonpatch['apply'](_0x13913e,_0x57b46f,!![]);}catch(_0x89a8c){return BPromise['reject'](_0x89a8c);}return _0x13913e['save']();};}function saveUpdates(_0xa5ce96,_0x4fd934){return function(_0x35f1d7){if(_0x35f1d7){return _0x35f1d7['update'](_0xa5ce96)[_0xc0fc('0x1e')](function(_0x38929c){return _0x38929c;});}return null;};}function removeEntity(_0x40d216,_0x8a5f57){return function(_0x3dca31){if(_0x3dca31){return _0x3dca31['destroy']()[_0xc0fc('0x1e')](function(){_0x40d216[_0xc0fc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f35d7,_0x3c2d75){return function(_0x1af6dc){if(!_0x1af6dc){_0x1f35d7[_0xc0fc('0x16')](0x194);}return _0x1af6dc;};}function handleError(_0x100645,_0x50b999){_0x50b999=_0x50b999||0x1f4;return function(_0x54648b){logger[_0xc0fc('0x1f')](_0x54648b[_0xc0fc('0x20')]);if(_0x54648b[_0xc0fc('0x21')]){delete _0x54648b['name'];}_0x100645['status'](_0x50b999)[_0xc0fc('0x22')](_0x54648b);};}exports[_0xc0fc('0x23')]=function(_0x4344f0,_0x1e4102){var _0x204753={},_0x1c8cf2={},_0x566cb8={'count':0x0,'rows':[]};var _0x326353=_['map'](db['FreshsalesConfiguration']['rawAttributes'],function(_0x3deed0){return{'name':_0x3deed0['fieldName'],'type':_0x3deed0['type'][_0xc0fc('0x24')]};});_0x1c8cf2[_0xc0fc('0x25')]=_[_0xc0fc('0x26')](_0x326353,'name');_0x1c8cf2['query']=_[_0xc0fc('0x27')](_0x4344f0['query']);_0x1c8cf2[_0xc0fc('0x28')]=_['intersection'](_0x1c8cf2[_0xc0fc('0x25')],_0x1c8cf2[_0xc0fc('0x29')]);_0x204753[_0xc0fc('0x2a')]=_[_0xc0fc('0x2b')](_0x1c8cf2[_0xc0fc('0x25')],qs[_0xc0fc('0x2c')](_0x4344f0['query'][_0xc0fc('0x2c')]));_0x204753[_0xc0fc('0x2a')]=_0x204753[_0xc0fc('0x2a')][_0xc0fc('0x2d')]?_0x204753[_0xc0fc('0x2a')]:_0x1c8cf2[_0xc0fc('0x25')];if(!_0x4344f0[_0xc0fc('0x29')][_0xc0fc('0x2e')](_0xc0fc('0x2f'))){_0x204753[_0xc0fc('0x1a')]=qs['limit'](_0x4344f0[_0xc0fc('0x29')][_0xc0fc('0x1a')]);_0x204753[_0xc0fc('0x18')]=qs[_0xc0fc('0x18')](_0x4344f0[_0xc0fc('0x29')]['offset']);}_0x204753[_0xc0fc('0x30')]=qs[_0xc0fc('0x31')](_0x4344f0['query']['sort']);_0x204753['where']=qs[_0xc0fc('0x28')](_[_0xc0fc('0x32')](_0x4344f0['query'],_0x1c8cf2[_0xc0fc('0x28')]),_0x326353);if(_0x4344f0[_0xc0fc('0x29')][_0xc0fc('0x33')]){_0x204753['where']=_[_0xc0fc('0x34')](_0x204753[_0xc0fc('0x35')],{'$or':_['map'](_0x326353,function(_0x2bf90e){if(_0x2bf90e[_0xc0fc('0x36')]!=='VIRTUAL'){var _0x2cbdf3={};_0x2cbdf3[_0x2bf90e[_0xc0fc('0x21')]]={'$like':'%'+_0x4344f0[_0xc0fc('0x29')]['filter']+'%'};return _0x2cbdf3;}})});}_0x204753=_[_0xc0fc('0x34')]({},_0x204753,_0x4344f0[_0xc0fc('0x37')]);var _0x3b810d={'where':_0x204753['where']};return db[_0xc0fc('0x38')][_0xc0fc('0x1b')](_0x3b810d)[_0xc0fc('0x1e')](function(_0x52d553){_0x566cb8['count']=_0x52d553;if(_0x4344f0['query'][_0xc0fc('0x39')]){_0x204753['include']=[{'all':!![]}];}return db[_0xc0fc('0x38')][_0xc0fc('0x3a')](_0x204753);})[_0xc0fc('0x1e')](function(_0x5ef4c0){_0x566cb8[_0xc0fc('0x3b')]=_0x5ef4c0;return _0x566cb8;})[_0xc0fc('0x1e')](respondWithFilteredResult(_0x1e4102,_0x204753))[_0xc0fc('0x3c')](handleError(_0x1e4102,null));};exports[_0xc0fc('0x3d')]=function(_0x158750,_0xa65502){var _0xf2604c={'raw':![],'where':{'id':_0x158750[_0xc0fc('0x3e')]['id']}},_0x20779a={};_0x20779a[_0xc0fc('0x25')]=_[_0xc0fc('0x27')](db[_0xc0fc('0x38')]['rawAttributes']);_0x20779a[_0xc0fc('0x29')]=_['keys'](_0x158750[_0xc0fc('0x29')]);_0x20779a[_0xc0fc('0x28')]=_[_0xc0fc('0x2b')](_0x20779a[_0xc0fc('0x25')],_0x20779a['query']);_0xf2604c[_0xc0fc('0x2a')]=_[_0xc0fc('0x2b')](_0x20779a['model'],qs[_0xc0fc('0x2c')](_0x158750[_0xc0fc('0x29')][_0xc0fc('0x2c')]));_0xf2604c[_0xc0fc('0x2a')]=_0xf2604c[_0xc0fc('0x2a')][_0xc0fc('0x2d')]?_0xf2604c[_0xc0fc('0x2a')]:_0x20779a[_0xc0fc('0x25')];if(_0x158750[_0xc0fc('0x29')]['includeAll']){_0xf2604c[_0xc0fc('0x3f')]=[{'all':!![]}];}_0xf2604c=_[_0xc0fc('0x34')]({},_0xf2604c,_0x158750[_0xc0fc('0x37')]);return db[_0xc0fc('0x38')][_0xc0fc('0x40')](_0xf2604c)[_0xc0fc('0x1e')](handleEntityNotFound(_0xa65502,null))[_0xc0fc('0x1e')](respondWithResult(_0xa65502,null))[_0xc0fc('0x3c')](handleError(_0xa65502,null));};exports[_0xc0fc('0x41')]=function(_0x31f61f,_0x4c06c9){return db[_0xc0fc('0x38')][_0xc0fc('0x41')](_0x31f61f[_0xc0fc('0x42')],{})[_0xc0fc('0x1e')](respondWithResult(_0x4c06c9,0xc9))[_0xc0fc('0x3c')](handleError(_0x4c06c9,null));};exports[_0xc0fc('0x43')]=function(_0x4a898e,_0x2e38ef){if(_0x4a898e['body']['id']){delete _0x4a898e['body']['id'];}return db[_0xc0fc('0x38')][_0xc0fc('0x40')]({'where':{'id':_0x4a898e[_0xc0fc('0x3e')]['id']}})[_0xc0fc('0x1e')](handleEntityNotFound(_0x2e38ef,null))[_0xc0fc('0x1e')](saveUpdates(_0x4a898e[_0xc0fc('0x42')],null))[_0xc0fc('0x1e')](respondWithResult(_0x2e38ef,null))['catch'](handleError(_0x2e38ef,null));};exports['destroy']=function(_0x580598,_0x1ffe17){return db[_0xc0fc('0x38')][_0xc0fc('0x40')]({'where':{'id':_0x580598[_0xc0fc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1ffe17,null))[_0xc0fc('0x1e')](removeEntity(_0x1ffe17,null))['catch'](handleError(_0x1ffe17,null));};exports[_0xc0fc('0x44')]=function(_0xdcc08b,_0x11daad,_0x3a8ab5){var _0x4643da={};var _0x49edaa={};var _0x33eddf;var _0x4d3438;return db[_0xc0fc('0x38')][_0xc0fc('0x45')]({'where':{'id':_0xdcc08b[_0xc0fc('0x3e')]['id']}})[_0xc0fc('0x1e')](handleEntityNotFound(_0x11daad,null))[_0xc0fc('0x1e')](function(_0x35021b){if(_0x35021b){_0x33eddf=_0x35021b;_0x49edaa['model']=_['keys'](db[_0xc0fc('0x46')][_0xc0fc('0x47')]);_0x49edaa['query']=_['keys'](_0xdcc08b[_0xc0fc('0x29')]);_0x49edaa[_0xc0fc('0x28')]=_['intersection'](_0x49edaa[_0xc0fc('0x25')],_0x49edaa[_0xc0fc('0x29')]);_0x4643da[_0xc0fc('0x2a')]=_[_0xc0fc('0x2b')](_0x49edaa['model'],qs[_0xc0fc('0x2c')](_0xdcc08b['query']['fields']));_0x4643da[_0xc0fc('0x2a')]=_0x4643da[_0xc0fc('0x2a')][_0xc0fc('0x2d')]?_0x4643da[_0xc0fc('0x2a')]:_0x49edaa[_0xc0fc('0x25')];_0x4643da[_0xc0fc('0x30')]=qs[_0xc0fc('0x31')](_0xdcc08b[_0xc0fc('0x29')]['sort']);_0x4643da[_0xc0fc('0x35')]=qs[_0xc0fc('0x28')](_[_0xc0fc('0x32')](_0xdcc08b['query'],_0x49edaa[_0xc0fc('0x28')]));if(_0xdcc08b['query']['filter']){_0x4643da[_0xc0fc('0x35')]=_[_0xc0fc('0x34')](_0x4643da['where'],{'$or':_['map'](_0x4643da['attributes'],function(_0x2c4e47){var _0x4b95cc={};_0x4b95cc[_0x2c4e47]={'$like':'%'+_0xdcc08b[_0xc0fc('0x29')][_0xc0fc('0x33')]+'%'};return _0x4b95cc;})});}_0x4643da=_[_0xc0fc('0x34')]({},_0x4643da,_0xdcc08b['options']);return _0x33eddf[_0xc0fc('0x44')](_0x4643da);}})[_0xc0fc('0x1e')](function(_0x2d6245){if(_0x2d6245){_0x4d3438=_0x2d6245[_0xc0fc('0x2d')];if(!_0xdcc08b[_0xc0fc('0x29')][_0xc0fc('0x2e')](_0xc0fc('0x2f'))){_0x4643da[_0xc0fc('0x1a')]=qs[_0xc0fc('0x1a')](_0xdcc08b[_0xc0fc('0x29')]['limit']);_0x4643da['offset']=qs['offset'](_0xdcc08b[_0xc0fc('0x29')][_0xc0fc('0x18')]);}return _0x33eddf[_0xc0fc('0x44')](_0x4643da);}})['then'](function(_0x5c240b){if(_0x5c240b){return _0x5c240b?{'count':_0x4d3438,'rows':_0x5c240b}:null;}})['then'](respondWithResult(_0x11daad,null))[_0xc0fc('0x3c')](handleError(_0x11daad,null));};exports[_0xc0fc('0x48')]=function(_0x191ac0,_0x5a0439,_0x383e31){var _0x1eec64={};var _0x57bd09={};var _0x4dd497;var _0x1e3981;return db[_0xc0fc('0x38')]['findOne']({'where':{'id':_0x191ac0[_0xc0fc('0x3e')]['id']}})[_0xc0fc('0x1e')](handleEntityNotFound(_0x5a0439,null))['then'](function(_0x52345a){if(_0x52345a){_0x4dd497=_0x52345a;_0x57bd09[_0xc0fc('0x25')]=_[_0xc0fc('0x27')](db[_0xc0fc('0x46')][_0xc0fc('0x47')]);_0x57bd09['query']=_['keys'](_0x191ac0[_0xc0fc('0x29')]);_0x57bd09[_0xc0fc('0x28')]=_[_0xc0fc('0x2b')](_0x57bd09['model'],_0x57bd09['query']);_0x1eec64['attributes']=_[_0xc0fc('0x2b')](_0x57bd09['model'],qs[_0xc0fc('0x2c')](_0x191ac0[_0xc0fc('0x29')][_0xc0fc('0x2c')]));_0x1eec64[_0xc0fc('0x2a')]=_0x1eec64[_0xc0fc('0x2a')]['length']?_0x1eec64[_0xc0fc('0x2a')]:_0x57bd09[_0xc0fc('0x25')];_0x1eec64[_0xc0fc('0x30')]=qs[_0xc0fc('0x31')](_0x191ac0[_0xc0fc('0x29')][_0xc0fc('0x31')]);_0x1eec64['where']=qs[_0xc0fc('0x28')](_['pick'](_0x191ac0[_0xc0fc('0x29')],_0x57bd09[_0xc0fc('0x28')]));if(_0x191ac0[_0xc0fc('0x29')][_0xc0fc('0x33')]){_0x1eec64[_0xc0fc('0x35')]=_[_0xc0fc('0x34')](_0x1eec64[_0xc0fc('0x35')],{'$or':_[_0xc0fc('0x26')](_0x1eec64[_0xc0fc('0x2a')],function(_0x24533a){var _0x15ee03={};_0x15ee03[_0x24533a]={'$like':'%'+_0x191ac0[_0xc0fc('0x29')][_0xc0fc('0x33')]+'%'};return _0x15ee03;})});}_0x1eec64=_['merge']({},_0x1eec64,_0x191ac0[_0xc0fc('0x37')]);return _0x4dd497['getDescriptions'](_0x1eec64);}})[_0xc0fc('0x1e')](function(_0x4bb394){if(_0x4bb394){_0x1e3981=_0x4bb394[_0xc0fc('0x2d')];if(!_0x191ac0[_0xc0fc('0x29')][_0xc0fc('0x2e')](_0xc0fc('0x2f'))){_0x1eec64[_0xc0fc('0x1a')]=qs[_0xc0fc('0x1a')](_0x191ac0[_0xc0fc('0x29')][_0xc0fc('0x1a')]);_0x1eec64[_0xc0fc('0x18')]=qs[_0xc0fc('0x18')](_0x191ac0[_0xc0fc('0x29')][_0xc0fc('0x18')]);}return _0x4dd497[_0xc0fc('0x48')](_0x1eec64);}})[_0xc0fc('0x1e')](function(_0x45a459){if(_0x45a459){return _0x45a459?{'count':_0x1e3981,'rows':_0x45a459}:null;}})['then'](respondWithResult(_0x5a0439,null))[_0xc0fc('0x3c')](handleError(_0x5a0439,null));};exports[_0xc0fc('0x49')]=function(_0x22ab6b,_0x24247f,_0x48d029){var _0x33f3a2={};var _0x1a42fb={};var _0x1d81fc;var _0x149648;return db[_0xc0fc('0x38')][_0xc0fc('0x45')]({'where':{'id':_0x22ab6b[_0xc0fc('0x3e')]['id']}})[_0xc0fc('0x1e')](handleEntityNotFound(_0x24247f,null))[_0xc0fc('0x1e')](function(_0x4aaa72){if(_0x4aaa72){_0x1d81fc=_0x4aaa72;_0x1a42fb['model']=_[_0xc0fc('0x27')](db[_0xc0fc('0x46')][_0xc0fc('0x47')]);_0x1a42fb['query']=_[_0xc0fc('0x27')](_0x22ab6b[_0xc0fc('0x29')]);_0x1a42fb['filters']=_['intersection'](_0x1a42fb[_0xc0fc('0x25')],_0x1a42fb[_0xc0fc('0x29')]);_0x33f3a2[_0xc0fc('0x2a')]=_[_0xc0fc('0x2b')](_0x1a42fb[_0xc0fc('0x25')],qs[_0xc0fc('0x2c')](_0x22ab6b[_0xc0fc('0x29')][_0xc0fc('0x2c')]));_0x33f3a2[_0xc0fc('0x2a')]=_0x33f3a2['attributes'][_0xc0fc('0x2d')]?_0x33f3a2[_0xc0fc('0x2a')]:_0x1a42fb['model'];_0x33f3a2[_0xc0fc('0x30')]=qs[_0xc0fc('0x31')](_0x22ab6b[_0xc0fc('0x29')][_0xc0fc('0x31')]);_0x33f3a2[_0xc0fc('0x35')]=qs[_0xc0fc('0x28')](_[_0xc0fc('0x32')](_0x22ab6b[_0xc0fc('0x29')],_0x1a42fb[_0xc0fc('0x28')]));if(_0x22ab6b[_0xc0fc('0x29')][_0xc0fc('0x33')]){_0x33f3a2[_0xc0fc('0x35')]=_['merge'](_0x33f3a2[_0xc0fc('0x35')],{'$or':_[_0xc0fc('0x26')](_0x33f3a2['attributes'],function(_0xa81c30){var _0x14dbe5={};_0x14dbe5[_0xa81c30]={'$like':'%'+_0x22ab6b[_0xc0fc('0x29')][_0xc0fc('0x33')]+'%'};return _0x14dbe5;})});}_0x33f3a2=_[_0xc0fc('0x34')]({},_0x33f3a2,_0x22ab6b[_0xc0fc('0x37')]);return _0x1d81fc[_0xc0fc('0x49')](_0x33f3a2);}})['then'](function(_0x3b72f7){if(_0x3b72f7){_0x149648=_0x3b72f7['length'];if(!_0x22ab6b['query'][_0xc0fc('0x2e')](_0xc0fc('0x2f'))){_0x33f3a2[_0xc0fc('0x1a')]=qs[_0xc0fc('0x1a')](_0x22ab6b[_0xc0fc('0x29')][_0xc0fc('0x1a')]);_0x33f3a2[_0xc0fc('0x18')]=qs[_0xc0fc('0x18')](_0x22ab6b['query']['offset']);}return _0x1d81fc[_0xc0fc('0x49')](_0x33f3a2);}})[_0xc0fc('0x1e')](function(_0x369fd5){if(_0x369fd5){return _0x369fd5?{'count':_0x149648,'rows':_0x369fd5}:null;}})[_0xc0fc('0x1e')](respondWithResult(_0x24247f,null))[_0xc0fc('0x3c')](handleError(_0x24247f,null));}; \ No newline at end of file +var _0x06f2=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','rawAttributes','include','find','create','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','order','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel'];(function(_0x80fec7,_0x326552){var _0xefd5b3=function(_0x452510){while(--_0x452510){_0x80fec7['push'](_0x80fec7['shift']());}};_0xefd5b3(++_0x326552);}(_0x06f2,0x96));var _0x206f=function(_0x4b9380,_0x5b2037){_0x4b9380=_0x4b9380-0x0;var _0x16dc79=_0x06f2[_0x4b9380];return _0x16dc79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x206f('0x0'));var zipdir=require(_0x206f('0x1'));var jsonpatch=require(_0x206f('0x2'));var rp=require(_0x206f('0x3'));var moment=require(_0x206f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x206f('0x5'));var util=require(_0x206f('0x6'));var path=require(_0x206f('0x7'));var sox=require(_0x206f('0x8'));var csv=require(_0x206f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x206f('0xa'));var _=require('lodash');var squel=require(_0x206f('0xb'));var crypto=require(_0x206f('0xc'));var jsforce=require(_0x206f('0xd'));var deskjs=require(_0x206f('0xe'));var toCsv=require(_0x206f('0x9'));var querystring=require(_0x206f('0xf'));var Papa=require(_0x206f('0x10'));var Redis=require('ioredis');var authService=require(_0x206f('0x11'));var qs=require(_0x206f('0x12'));var as=require(_0x206f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x206f('0x14'))(_0x206f('0x15'));var utils=require(_0x206f('0x16'));var config=require(_0x206f('0x17'));var licenseUtil=require(_0x206f('0x18'));var db=require(_0x206f('0x19'))['db'];function respondWithStatusCode(_0x29a280,_0x53b191){_0x53b191=_0x53b191||0xcc;return function(_0x5aef6f){if(_0x5aef6f){return _0x29a280[_0x206f('0x1a')](_0x53b191);}return _0x29a280['status'](_0x53b191)[_0x206f('0x1b')]();};}function respondWithResult(_0x1de892,_0x26da15){_0x26da15=_0x26da15||0xc8;return function(_0x1a08bc){if(_0x1a08bc){return _0x1de892[_0x206f('0x1c')](_0x26da15)['json'](_0x1a08bc);}};}function respondWithFilteredResult(_0x475bb4,_0x526857){return function(_0x57a423){if(_0x57a423){var _0x286bee=typeof _0x526857[_0x206f('0x1d')]===_0x206f('0x1e')&&typeof _0x526857['limit']===_0x206f('0x1e');var _0x20b3d8=_0x57a423['count'];var _0x417065=_0x286bee?0x0:_0x526857[_0x206f('0x1d')];var _0x356907=_0x286bee?_0x57a423[_0x206f('0x1f')]:_0x526857[_0x206f('0x1d')]+_0x526857['limit'];var _0x4855b5;if(_0x356907>=_0x20b3d8){_0x356907=_0x20b3d8;_0x4855b5=0xc8;}else{_0x4855b5=0xce;}_0x475bb4['status'](_0x4855b5);return _0x475bb4[_0x206f('0x20')]('Content-Range',_0x417065+'-'+_0x356907+'/'+_0x20b3d8)['json'](_0x57a423);}return null;};}function patchUpdates(_0x45c3a5){return function(_0x1fc545){try{jsonpatch[_0x206f('0x21')](_0x1fc545,_0x45c3a5,!![]);}catch(_0x1dfa20){return BPromise['reject'](_0x1dfa20);}return _0x1fc545[_0x206f('0x22')]();};}function saveUpdates(_0xec303d,_0x312f56){return function(_0x5ed021){if(_0x5ed021){return _0x5ed021[_0x206f('0x23')](_0xec303d)[_0x206f('0x24')](function(_0x38ef0a){return _0x38ef0a;});}return null;};}function removeEntity(_0x3558ff,_0x33ef80){return function(_0x1ef888){if(_0x1ef888){return _0x1ef888[_0x206f('0x25')]()['then'](function(){_0x3558ff[_0x206f('0x1c')](0xcc)[_0x206f('0x1b')]();});}};}function handleEntityNotFound(_0x3ae7ea,_0x22a84a){return function(_0x46b62a){if(!_0x46b62a){_0x3ae7ea[_0x206f('0x1a')](0x194);}return _0x46b62a;};}function handleError(_0x5edc88,_0x4d535e){_0x4d535e=_0x4d535e||0x1f4;return function(_0x425caf){logger[_0x206f('0x26')](_0x425caf[_0x206f('0x27')]);if(_0x425caf[_0x206f('0x28')]){delete _0x425caf[_0x206f('0x28')];}_0x5edc88[_0x206f('0x1c')](_0x4d535e)[_0x206f('0x29')](_0x425caf);};}exports[_0x206f('0x2a')]=function(_0x58dec2,_0x8e16ce){var _0x334920={},_0x75936d={},_0x44c4f9={'count':0x0,'rows':[]};var _0x30585d=_[_0x206f('0x2b')](db[_0x206f('0x2c')]['rawAttributes'],function(_0x575de8){return{'name':_0x575de8[_0x206f('0x2d')],'type':_0x575de8[_0x206f('0x2e')]['key']};});_0x75936d[_0x206f('0x2f')]=_[_0x206f('0x2b')](_0x30585d,_0x206f('0x28'));_0x75936d[_0x206f('0x30')]=_[_0x206f('0x31')](_0x58dec2[_0x206f('0x30')]);_0x75936d[_0x206f('0x32')]=_[_0x206f('0x33')](_0x75936d[_0x206f('0x2f')],_0x75936d[_0x206f('0x30')]);_0x334920[_0x206f('0x34')]=_[_0x206f('0x33')](_0x75936d['model'],qs['fields'](_0x58dec2[_0x206f('0x30')][_0x206f('0x35')]));_0x334920[_0x206f('0x34')]=_0x334920[_0x206f('0x34')][_0x206f('0x36')]?_0x334920[_0x206f('0x34')]:_0x75936d['model'];if(!_0x58dec2[_0x206f('0x30')][_0x206f('0x37')](_0x206f('0x38'))){_0x334920['limit']=qs[_0x206f('0x39')](_0x58dec2[_0x206f('0x30')][_0x206f('0x39')]);_0x334920[_0x206f('0x1d')]=qs['offset'](_0x58dec2[_0x206f('0x30')]['offset']);}_0x334920['order']=qs[_0x206f('0x3a')](_0x58dec2[_0x206f('0x30')][_0x206f('0x3a')]);_0x334920[_0x206f('0x3b')]=qs[_0x206f('0x32')](_[_0x206f('0x3c')](_0x58dec2[_0x206f('0x30')],_0x75936d[_0x206f('0x32')]),_0x30585d);if(_0x58dec2['query'][_0x206f('0x3d')]){_0x334920['where']=_['merge'](_0x334920[_0x206f('0x3b')],{'$or':_[_0x206f('0x2b')](_0x30585d,function(_0x3860fa){if(_0x3860fa[_0x206f('0x2e')]!==_0x206f('0x3e')){var _0x226644={};_0x226644[_0x3860fa[_0x206f('0x28')]]={'$like':'%'+_0x58dec2[_0x206f('0x30')][_0x206f('0x3d')]+'%'};return _0x226644;}})});}_0x334920=_[_0x206f('0x3f')]({},_0x334920,_0x58dec2[_0x206f('0x40')]);var _0x533bd4={'where':_0x334920[_0x206f('0x3b')]};return db[_0x206f('0x2c')][_0x206f('0x1f')](_0x533bd4)[_0x206f('0x24')](function(_0x429a05){_0x44c4f9[_0x206f('0x1f')]=_0x429a05;if(_0x58dec2[_0x206f('0x30')][_0x206f('0x41')]){_0x334920['include']=[{'all':!![]}];}return db[_0x206f('0x2c')][_0x206f('0x42')](_0x334920);})['then'](function(_0x5f11ae){_0x44c4f9[_0x206f('0x43')]=_0x5f11ae;return _0x44c4f9;})[_0x206f('0x24')](respondWithFilteredResult(_0x8e16ce,_0x334920))[_0x206f('0x44')](handleError(_0x8e16ce,null));};exports['show']=function(_0x345042,_0x3d891e){var _0x208ea6={'raw':![],'where':{'id':_0x345042['params']['id']}},_0x1a845d={};_0x1a845d[_0x206f('0x2f')]=_[_0x206f('0x31')](db['FreshsalesConfiguration'][_0x206f('0x45')]);_0x1a845d[_0x206f('0x30')]=_[_0x206f('0x31')](_0x345042['query']);_0x1a845d['filters']=_[_0x206f('0x33')](_0x1a845d[_0x206f('0x2f')],_0x1a845d[_0x206f('0x30')]);_0x208ea6[_0x206f('0x34')]=_[_0x206f('0x33')](_0x1a845d[_0x206f('0x2f')],qs[_0x206f('0x35')](_0x345042[_0x206f('0x30')]['fields']));_0x208ea6[_0x206f('0x34')]=_0x208ea6[_0x206f('0x34')][_0x206f('0x36')]?_0x208ea6['attributes']:_0x1a845d[_0x206f('0x2f')];if(_0x345042[_0x206f('0x30')][_0x206f('0x41')]){_0x208ea6[_0x206f('0x46')]=[{'all':!![]}];}_0x208ea6=_[_0x206f('0x3f')]({},_0x208ea6,_0x345042[_0x206f('0x40')]);return db['FreshsalesConfiguration'][_0x206f('0x47')](_0x208ea6)[_0x206f('0x24')](handleEntityNotFound(_0x3d891e,null))[_0x206f('0x24')](respondWithResult(_0x3d891e,null))[_0x206f('0x44')](handleError(_0x3d891e,null));};exports[_0x206f('0x48')]=function(_0x3c46cf,_0x3b89dd){return db[_0x206f('0x2c')][_0x206f('0x48')](_0x3c46cf[_0x206f('0x49')],{})['then'](respondWithResult(_0x3b89dd,0xc9))[_0x206f('0x44')](handleError(_0x3b89dd,null));};exports['update']=function(_0x3a3e41,_0xff312a){if(_0x3a3e41['body']['id']){delete _0x3a3e41[_0x206f('0x49')]['id'];}return db['FreshsalesConfiguration'][_0x206f('0x47')]({'where':{'id':_0x3a3e41[_0x206f('0x4a')]['id']}})['then'](handleEntityNotFound(_0xff312a,null))[_0x206f('0x24')](saveUpdates(_0x3a3e41[_0x206f('0x49')],null))[_0x206f('0x24')](respondWithResult(_0xff312a,null))[_0x206f('0x44')](handleError(_0xff312a,null));};exports['destroy']=function(_0x3e3c2e,_0x3ccfb1){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x3e3c2e[_0x206f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3ccfb1,null))[_0x206f('0x24')](removeEntity(_0x3ccfb1,null))[_0x206f('0x44')](handleError(_0x3ccfb1,null));};exports[_0x206f('0x4b')]=function(_0x5d64fe,_0x3de406,_0x3d81ee){var _0x71e03b={};var _0x493a65={};var _0x1b87bf;var _0x154535;return db[_0x206f('0x2c')][_0x206f('0x4c')]({'where':{'id':_0x5d64fe['params']['id']}})['then'](handleEntityNotFound(_0x3de406,null))[_0x206f('0x24')](function(_0x51fe9e){if(_0x51fe9e){_0x1b87bf=_0x51fe9e;_0x493a65[_0x206f('0x2f')]=_[_0x206f('0x31')](db[_0x206f('0x4d')][_0x206f('0x45')]);_0x493a65['query']=_['keys'](_0x5d64fe[_0x206f('0x30')]);_0x493a65[_0x206f('0x32')]=_[_0x206f('0x33')](_0x493a65[_0x206f('0x2f')],_0x493a65['query']);_0x71e03b['attributes']=_[_0x206f('0x33')](_0x493a65[_0x206f('0x2f')],qs[_0x206f('0x35')](_0x5d64fe['query']['fields']));_0x71e03b[_0x206f('0x34')]=_0x71e03b['attributes'][_0x206f('0x36')]?_0x71e03b['attributes']:_0x493a65['model'];_0x71e03b['order']=qs['sort'](_0x5d64fe[_0x206f('0x30')][_0x206f('0x3a')]);_0x71e03b[_0x206f('0x3b')]=qs[_0x206f('0x32')](_[_0x206f('0x3c')](_0x5d64fe[_0x206f('0x30')],_0x493a65['filters']));if(_0x5d64fe[_0x206f('0x30')][_0x206f('0x3d')]){_0x71e03b[_0x206f('0x3b')]=_[_0x206f('0x3f')](_0x71e03b[_0x206f('0x3b')],{'$or':_[_0x206f('0x2b')](_0x71e03b['attributes'],function(_0x2d6751){var _0x4e0e61={};_0x4e0e61[_0x2d6751]={'$like':'%'+_0x5d64fe['query'][_0x206f('0x3d')]+'%'};return _0x4e0e61;})});}_0x71e03b=_[_0x206f('0x3f')]({},_0x71e03b,_0x5d64fe[_0x206f('0x40')]);return _0x1b87bf[_0x206f('0x4b')](_0x71e03b);}})['then'](function(_0x2c6287){if(_0x2c6287){_0x154535=_0x2c6287[_0x206f('0x36')];if(!_0x5d64fe[_0x206f('0x30')]['hasOwnProperty'](_0x206f('0x38'))){_0x71e03b['limit']=qs[_0x206f('0x39')](_0x5d64fe['query'][_0x206f('0x39')]);_0x71e03b[_0x206f('0x1d')]=qs[_0x206f('0x1d')](_0x5d64fe[_0x206f('0x30')][_0x206f('0x1d')]);}return _0x1b87bf[_0x206f('0x4b')](_0x71e03b);}})['then'](function(_0x387cf4){if(_0x387cf4){return _0x387cf4?{'count':_0x154535,'rows':_0x387cf4}:null;}})[_0x206f('0x24')](respondWithResult(_0x3de406,null))[_0x206f('0x44')](handleError(_0x3de406,null));};exports[_0x206f('0x4e')]=function(_0x198ca7,_0x868f2a,_0x1c1e5f){var _0x261bc5={};var _0x371e74={};var _0x16549c;var _0xd2ddf6;return db[_0x206f('0x2c')][_0x206f('0x4c')]({'where':{'id':_0x198ca7['params']['id']}})[_0x206f('0x24')](handleEntityNotFound(_0x868f2a,null))[_0x206f('0x24')](function(_0x5f4358){if(_0x5f4358){_0x16549c=_0x5f4358;_0x371e74[_0x206f('0x2f')]=_[_0x206f('0x31')](db[_0x206f('0x4d')][_0x206f('0x45')]);_0x371e74[_0x206f('0x30')]=_[_0x206f('0x31')](_0x198ca7['query']);_0x371e74[_0x206f('0x32')]=_['intersection'](_0x371e74[_0x206f('0x2f')],_0x371e74[_0x206f('0x30')]);_0x261bc5[_0x206f('0x34')]=_[_0x206f('0x33')](_0x371e74[_0x206f('0x2f')],qs[_0x206f('0x35')](_0x198ca7[_0x206f('0x30')][_0x206f('0x35')]));_0x261bc5[_0x206f('0x34')]=_0x261bc5[_0x206f('0x34')][_0x206f('0x36')]?_0x261bc5[_0x206f('0x34')]:_0x371e74[_0x206f('0x2f')];_0x261bc5[_0x206f('0x4f')]=qs[_0x206f('0x3a')](_0x198ca7[_0x206f('0x30')][_0x206f('0x3a')]);_0x261bc5['where']=qs['filters'](_[_0x206f('0x3c')](_0x198ca7['query'],_0x371e74[_0x206f('0x32')]));if(_0x198ca7[_0x206f('0x30')][_0x206f('0x3d')]){_0x261bc5['where']=_[_0x206f('0x3f')](_0x261bc5[_0x206f('0x3b')],{'$or':_['map'](_0x261bc5[_0x206f('0x34')],function(_0x388f00){var _0x548ca4={};_0x548ca4[_0x388f00]={'$like':'%'+_0x198ca7[_0x206f('0x30')][_0x206f('0x3d')]+'%'};return _0x548ca4;})});}_0x261bc5=_[_0x206f('0x3f')]({},_0x261bc5,_0x198ca7[_0x206f('0x40')]);return _0x16549c[_0x206f('0x4e')](_0x261bc5);}})[_0x206f('0x24')](function(_0x51c6b1){if(_0x51c6b1){_0xd2ddf6=_0x51c6b1['length'];if(!_0x198ca7['query'][_0x206f('0x37')](_0x206f('0x38'))){_0x261bc5[_0x206f('0x39')]=qs[_0x206f('0x39')](_0x198ca7[_0x206f('0x30')][_0x206f('0x39')]);_0x261bc5['offset']=qs[_0x206f('0x1d')](_0x198ca7[_0x206f('0x30')][_0x206f('0x1d')]);}return _0x16549c['getDescriptions'](_0x261bc5);}})[_0x206f('0x24')](function(_0x47d7d1){if(_0x47d7d1){return _0x47d7d1?{'count':_0xd2ddf6,'rows':_0x47d7d1}:null;}})[_0x206f('0x24')](respondWithResult(_0x868f2a,null))[_0x206f('0x44')](handleError(_0x868f2a,null));};exports['getFields']=function(_0x1e09f0,_0x4b5158,_0x489624){var _0x425275={};var _0x4018fc={};var _0x4f1fa1;var _0xf2b44d;return db['FreshsalesConfiguration'][_0x206f('0x4c')]({'where':{'id':_0x1e09f0[_0x206f('0x4a')]['id']}})[_0x206f('0x24')](handleEntityNotFound(_0x4b5158,null))[_0x206f('0x24')](function(_0x184d50){if(_0x184d50){_0x4f1fa1=_0x184d50;_0x4018fc[_0x206f('0x2f')]=_[_0x206f('0x31')](db[_0x206f('0x4d')][_0x206f('0x45')]);_0x4018fc[_0x206f('0x30')]=_['keys'](_0x1e09f0[_0x206f('0x30')]);_0x4018fc[_0x206f('0x32')]=_[_0x206f('0x33')](_0x4018fc[_0x206f('0x2f')],_0x4018fc[_0x206f('0x30')]);_0x425275[_0x206f('0x34')]=_[_0x206f('0x33')](_0x4018fc[_0x206f('0x2f')],qs[_0x206f('0x35')](_0x1e09f0[_0x206f('0x30')][_0x206f('0x35')]));_0x425275['attributes']=_0x425275[_0x206f('0x34')][_0x206f('0x36')]?_0x425275['attributes']:_0x4018fc[_0x206f('0x2f')];_0x425275[_0x206f('0x4f')]=qs[_0x206f('0x3a')](_0x1e09f0['query'][_0x206f('0x3a')]);_0x425275['where']=qs[_0x206f('0x32')](_['pick'](_0x1e09f0[_0x206f('0x30')],_0x4018fc[_0x206f('0x32')]));if(_0x1e09f0[_0x206f('0x30')][_0x206f('0x3d')]){_0x425275[_0x206f('0x3b')]=_[_0x206f('0x3f')](_0x425275[_0x206f('0x3b')],{'$or':_[_0x206f('0x2b')](_0x425275[_0x206f('0x34')],function(_0xd418fd){var _0x4eea83={};_0x4eea83[_0xd418fd]={'$like':'%'+_0x1e09f0[_0x206f('0x30')][_0x206f('0x3d')]+'%'};return _0x4eea83;})});}_0x425275=_[_0x206f('0x3f')]({},_0x425275,_0x1e09f0['options']);return _0x4f1fa1[_0x206f('0x50')](_0x425275);}})[_0x206f('0x24')](function(_0xd7960){if(_0xd7960){_0xf2b44d=_0xd7960[_0x206f('0x36')];if(!_0x1e09f0['query'][_0x206f('0x37')](_0x206f('0x38'))){_0x425275['limit']=qs[_0x206f('0x39')](_0x1e09f0[_0x206f('0x30')][_0x206f('0x39')]);_0x425275[_0x206f('0x1d')]=qs['offset'](_0x1e09f0['query'][_0x206f('0x1d')]);}return _0x4f1fa1[_0x206f('0x50')](_0x425275);}})['then'](function(_0x123492){if(_0x123492){return _0x123492?{'count':_0xf2b44d,'rows':_0x123492}:null;}})[_0x206f('0x24')](respondWithResult(_0x4b5158,null))[_0x206f('0x44')](handleError(_0x4b5158,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index bcfe15a..a248ad6 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 _0xe12d=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x4e0ff4,_0x4a4633){var _0x3bdee=function(_0x2bdee6){while(--_0x2bdee6){_0x4e0ff4['push'](_0x4e0ff4['shift']());}};_0x3bdee(++_0x4a4633);}(_0xe12d,0x198));var _0xde12=function(_0x47a196,_0x49d8f6){_0x47a196=_0x47a196-0x0;var _0x12406d=_0xe12d[_0x47a196];return _0x12406d;};'use strict';var _=require(_0xde12('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xde12('0x1'));var moment=require(_0xde12('0x2'));var BPromise=require(_0xde12('0x3'));var rp=require(_0xde12('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde12('0x5'));var config=require(_0xde12('0x6'));var attributes=require(_0xde12('0x7'));module[_0xde12('0x8')]=function(_0x271f67,_0x50ff9e){return _0x271f67[_0xde12('0x9')](_0xde12('0xa'),attributes,{'tableName':_0xde12('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x480b=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment'];(function(_0x1b83e2,_0xb7dcd0){var _0x2567ad=function(_0x16d598){while(--_0x16d598){_0x1b83e2['push'](_0x1b83e2['shift']());}};_0x2567ad(++_0xb7dcd0);}(_0x480b,0x18f));var _0xb480=function(_0x769907,_0xc41023){_0x769907=_0x769907-0x0;var _0x4b89c4=_0x480b[_0x769907];return _0x4b89c4;};'use strict';var _=require(_0xb480('0x0'));var util=require(_0xb480('0x1'));var logger=require(_0xb480('0x2'))('api');var moment=require(_0xb480('0x3'));var BPromise=require('bluebird');var rp=require(_0xb480('0x4'));var fs=require('fs');var path=require(_0xb480('0x5'));var rimraf=require(_0xb480('0x6'));var config=require(_0xb480('0x7'));var attributes=require(_0xb480('0x8'));module[_0xb480('0x9')]=function(_0x1db5c0,_0x4671a3){return _0x1db5c0[_0xb480('0xa')](_0xb480('0xb'),attributes,{'tableName':_0xb480('0xc'),'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 8039ef7..3c8cd21 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 _0xc3eb=['rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3eb,0x1d2));var _0xbc3e=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0xc3eb[_0x21d0c3];return _0x4df18e;};'use strict';var _=require(_0xbc3e('0x0'));var util=require(_0xbc3e('0x1'));var moment=require(_0xbc3e('0x2'));var BPromise=require(_0xbc3e('0x3'));var rs=require(_0xbc3e('0x4'));var fs=require('fs');var Redis=require(_0xbc3e('0x5'));var db=require(_0xbc3e('0x6'))['db'];var utils=require(_0xbc3e('0x7'));var logger=require(_0xbc3e('0x8'))(_0xbc3e('0x9'));var config=require(_0xbc3e('0xa'));var jayson=require(_0xbc3e('0xb'));var client=jayson[_0xbc3e('0xc')][_0xbc3e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x111ae6,_0x14a218,_0x31ffab){return new BPromise(function(_0x31f6de,_0x510217){return client[_0xbc3e('0xe')](_0x111ae6,_0x31ffab)[_0xbc3e('0xf')](function(_0x493e24){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x14a218,_0xbc3e('0x10'));logger[_0xbc3e('0x11')](_0xbc3e('0x12'),_0x14a218,_0xbc3e('0x10'),JSON[_0xbc3e('0x13')](_0x493e24));if(_0x493e24[_0xbc3e('0x14')]){if(_0x493e24['error'][_0xbc3e('0x15')]===0x1f4){logger[_0xbc3e('0x14')](_0xbc3e('0x16'),_0x14a218,_0x493e24[_0xbc3e('0x14')]['message']);return _0x510217(_0x493e24[_0xbc3e('0x14')][_0xbc3e('0x17')]);}logger['error'](_0xbc3e('0x16'),_0x14a218,_0x493e24[_0xbc3e('0x14')][_0xbc3e('0x17')]);return _0x31f6de(_0x493e24[_0xbc3e('0x14')]['message']);}else{logger['info'](_0xbc3e('0x16'),_0x14a218,_0xbc3e('0x10'));_0x31f6de(_0x493e24[_0xbc3e('0x18')][_0xbc3e('0x17')]);}})['catch'](function(_0x3a5790){logger[_0xbc3e('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x14a218,_0x3a5790);_0x510217(_0x3a5790);});});} \ No newline at end of file +var _0x99ae=['info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x99ae,0x110));var _0xe99a=function(_0x119f82,_0x5bb4f4){_0x119f82=_0x119f82-0x0;var _0x26d4d5=_0x99ae[_0x119f82];return _0x26d4d5;};'use strict';var _=require(_0xe99a('0x0'));var util=require(_0xe99a('0x1'));var moment=require(_0xe99a('0x2'));var BPromise=require(_0xe99a('0x3'));var rs=require(_0xe99a('0x4'));var fs=require('fs');var Redis=require(_0xe99a('0x5'));var db=require(_0xe99a('0x6'))['db'];var utils=require(_0xe99a('0x7'));var logger=require(_0xe99a('0x8'))(_0xe99a('0x9'));var config=require(_0xe99a('0xa'));var jayson=require(_0xe99a('0xb'));var client=jayson[_0xe99a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaa3d8,_0x57a768,_0x2cfccb){return new BPromise(function(_0x490254,_0x261721){return client['request'](_0xaa3d8,_0x2cfccb)[_0xe99a('0xd')](function(_0x8bb1e){logger[_0xe99a('0xe')](_0xe99a('0xf'),_0x57a768,_0xe99a('0x10'));logger[_0xe99a('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x57a768,_0xe99a('0x10'),JSON['stringify'](_0x8bb1e));if(_0x8bb1e[_0xe99a('0x12')]){if(_0x8bb1e[_0xe99a('0x12')][_0xe99a('0x13')]===0x1f4){logger['error'](_0xe99a('0xf'),_0x57a768,_0x8bb1e['error'][_0xe99a('0x14')]);return _0x261721(_0x8bb1e[_0xe99a('0x12')]['message']);}logger[_0xe99a('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x57a768,_0x8bb1e['error'][_0xe99a('0x14')]);return _0x490254(_0x8bb1e[_0xe99a('0x12')][_0xe99a('0x14')]);}else{logger[_0xe99a('0xe')](_0xe99a('0xf'),_0x57a768,_0xe99a('0x10'));_0x490254(_0x8bb1e['result'][_0xe99a('0x14')]);}})[_0xe99a('0x15')](function(_0x235bda){logger[_0xe99a('0x12')](_0xe99a('0xf'),_0x57a768,_0x235bda);_0x261721(_0x235bda);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c0755ea..aef79ad 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 _0x5c37=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','/:id','update','delete','multer','util'];(function(_0x1ec7aa,_0x2506df){var _0x4bafb7=function(_0x5ec3bc){while(--_0x5ec3bc){_0x1ec7aa['push'](_0x1ec7aa['shift']());}};_0x4bafb7(++_0x2506df);}(_0x5c37,0x11e));var _0x75c3=function(_0x29bf80,_0x4af855){_0x29bf80=_0x29bf80-0x0;var _0x932096=_0x5c37[_0x29bf80];return _0x932096;};'use strict';var multer=require(_0x75c3('0x0'));var util=require(_0x75c3('0x1'));var path=require(_0x75c3('0x2'));var timeout=require(_0x75c3('0x3'));var express=require(_0x75c3('0x4'));var router=express[_0x75c3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x75c3('0x6'));var interaction=require(_0x75c3('0x7'));var config=require(_0x75c3('0x8'));var controller=require('./intFreshsalesField.controller');router[_0x75c3('0x9')]('/',auth[_0x75c3('0xa')](),controller[_0x75c3('0xb')]);router[_0x75c3('0x9')]('/:id',auth[_0x75c3('0xa')](),controller['show']);router['post']('/',auth[_0x75c3('0xa')](),controller[_0x75c3('0xc')]);router['put'](_0x75c3('0xd'),auth[_0x75c3('0xa')](),controller[_0x75c3('0xe')]);router[_0x75c3('0xf')](_0x75c3('0xd'),auth[_0x75c3('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5d55=['post','create','put','update','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3aa939,_0x2ca7b3){var _0x2b369d=function(_0x2c53a0){while(--_0x2c53a0){_0x3aa939['push'](_0x3aa939['shift']());}};_0x2b369d(++_0x2ca7b3);}(_0x5d55,0x1a4));var _0x55d5=function(_0x2db50b,_0x509eae){_0x2db50b=_0x2db50b-0x0;var _0x2b9189=_0x5d55[_0x2db50b];return _0x2b9189;};'use strict';var multer=require('multer');var util=require(_0x55d5('0x0'));var path=require('path');var timeout=require(_0x55d5('0x1'));var express=require(_0x55d5('0x2'));var router=express['Router']();var fs_extra=require(_0x55d5('0x3'));var auth=require(_0x55d5('0x4'));var interaction=require(_0x55d5('0x5'));var config=require('../../config/environment');var controller=require(_0x55d5('0x6'));router[_0x55d5('0x7')]('/',auth[_0x55d5('0x8')](),controller[_0x55d5('0x9')]);router[_0x55d5('0x7')](_0x55d5('0xa'),auth[_0x55d5('0x8')](),controller[_0x55d5('0xb')]);router[_0x55d5('0xc')]('/',auth['isAuthenticated'](),controller[_0x55d5('0xd')]);router[_0x55d5('0xe')](_0x55d5('0xa'),auth[_0x55d5('0x8')](),controller[_0x55d5('0xf')]);router['delete'](_0x55d5('0xa'),auth['isAuthenticated'](),controller[_0x55d5('0x10')]);module[_0x55d5('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5445edc..1320ca8 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 _0x178d=['variable','ENUM','customVariable','keyValue','picklist','string','STRING'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x178d,0x19e));var _0xd178=function(_0x36825d,_0x3e5ddd){_0x36825d=_0x36825d-0x0;var _0x21f3fe=_0x178d[_0x36825d];return _0x21f3fe;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xd178('0x0')]('string','variable',_0xd178('0x1'),_0xd178('0x2'),_0xd178('0x3')),'defaultValue':_0xd178('0x4')},'content':{'type':Sequelize[_0xd178('0x5')]},'key':{'type':Sequelize[_0xd178('0x5')]},'keyType':{'type':Sequelize[_0xd178('0x0')]('string',_0xd178('0x6'),_0xd178('0x1'))},'keyContent':{'type':Sequelize[_0xd178('0x5')]},'idField':{'type':Sequelize[_0xd178('0x5')]},'nameField':{'type':Sequelize[_0xd178('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd178('0x5')]}}; \ No newline at end of file +var _0xc19b=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x5e6a99,_0x44e7d3){var _0x4b5e32=function(_0x50febe){while(--_0x50febe){_0x5e6a99['push'](_0x5e6a99['shift']());}};_0x4b5e32(++_0x44e7d3);}(_0xc19b,0x153));var _0xbc19=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0xc19b[_0x17c483];return _0x112bdb;};'use strict';var Sequelize=require(_0xbc19('0x0'));module[_0xbc19('0x1')]={'type':{'type':Sequelize[_0xbc19('0x2')](_0xbc19('0x3'),'variable',_0xbc19('0x4'),_0xbc19('0x5'),_0xbc19('0x6')),'defaultValue':_0xbc19('0x3')},'content':{'type':Sequelize[_0xbc19('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbc19('0x2')](_0xbc19('0x3'),_0xbc19('0x8'),_0xbc19('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbc19('0x7')]},'nameField':{'type':Sequelize[_0xbc19('0x7')]},'customField':{'type':Sequelize[_0xbc19('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 85c97dc..15c2d66 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 _0xb7d3=['body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','then','error','stack','name','send','map','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','FreshsalesField','findAll','rows','catch','show','includeAll','include','merge','find','create'];(function(_0x3e2aee,_0x2e9cc4){var _0xb7dfe5=function(_0x5874d3){while(--_0x5874d3){_0x3e2aee['push'](_0x3e2aee['shift']());}};_0xb7dfe5(++_0x2e9cc4);}(_0xb7d3,0x1ed));var _0x3b7d=function(_0x432d38,_0x201399){_0x432d38=_0x432d38-0x0;var _0x39c577=_0xb7d3[_0x432d38];return _0x39c577;};'use strict';var emlformat=require(_0x3b7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b7d('0x1'));var jsonpatch=require(_0x3b7d('0x2'));var rp=require(_0x3b7d('0x3'));var moment=require(_0x3b7d('0x4'));var BPromise=require(_0x3b7d('0x5'));var Mustache=require('mustache');var util=require(_0x3b7d('0x6'));var path=require('path');var sox=require(_0x3b7d('0x7'));var csv=require(_0x3b7d('0x8'));var ejs=require(_0x3b7d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b7d('0xa'));var squel=require('squel');var crypto=require(_0x3b7d('0xb'));var jsforce=require(_0x3b7d('0xc'));var deskjs=require(_0x3b7d('0xd'));var toCsv=require(_0x3b7d('0x8'));var querystring=require(_0x3b7d('0xe'));var Papa=require(_0x3b7d('0xf'));var Redis=require(_0x3b7d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b7d('0x11'));var logger=require('../../config/logger')(_0x3b7d('0x12'));var utils=require(_0x3b7d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3b7d('0x14'));var db=require(_0x3b7d('0x15'))['db'];function respondWithStatusCode(_0x1f90a8,_0x23b8e5){_0x23b8e5=_0x23b8e5||0xcc;return function(_0x4f3058){if(_0x4f3058){return _0x1f90a8[_0x3b7d('0x16')](_0x23b8e5);}return _0x1f90a8[_0x3b7d('0x17')](_0x23b8e5)[_0x3b7d('0x18')]();};}function respondWithResult(_0x1bf216,_0x31356f){_0x31356f=_0x31356f||0xc8;return function(_0x4cadcc){if(_0x4cadcc){return _0x1bf216[_0x3b7d('0x17')](_0x31356f)[_0x3b7d('0x19')](_0x4cadcc);}};}function respondWithFilteredResult(_0x4a4212,_0x39cb20){return function(_0x56e2dd){if(_0x56e2dd){var _0x2be4c5=typeof _0x39cb20[_0x3b7d('0x1a')]===_0x3b7d('0x1b')&&typeof _0x39cb20['limit']===_0x3b7d('0x1b');var _0x185f32=_0x56e2dd[_0x3b7d('0x1c')];var _0x111647=_0x2be4c5?0x0:_0x39cb20['offset'];var _0x41beaf=_0x2be4c5?_0x56e2dd[_0x3b7d('0x1c')]:_0x39cb20[_0x3b7d('0x1a')]+_0x39cb20[_0x3b7d('0x1d')];var _0x300dad;if(_0x41beaf>=_0x185f32){_0x41beaf=_0x185f32;_0x300dad=0xc8;}else{_0x300dad=0xce;}_0x4a4212[_0x3b7d('0x17')](_0x300dad);return _0x4a4212[_0x3b7d('0x1e')](_0x3b7d('0x1f'),_0x111647+'-'+_0x41beaf+'/'+_0x185f32)[_0x3b7d('0x19')](_0x56e2dd);}return null;};}function patchUpdates(_0x1bb267){return function(_0x21c3bd){try{jsonpatch['apply'](_0x21c3bd,_0x1bb267,!![]);}catch(_0x378171){return BPromise[_0x3b7d('0x20')](_0x378171);}return _0x21c3bd['save']();};}function saveUpdates(_0x25dc12,_0x2b748c){return function(_0x3e7c20){if(_0x3e7c20){return _0x3e7c20['update'](_0x25dc12)[_0x3b7d('0x21')](function(_0x239eae){return _0x239eae;});}return null;};}function removeEntity(_0x466862,_0x4cfa8b){return function(_0x71a463){if(_0x71a463){return _0x71a463['destroy']()[_0x3b7d('0x21')](function(){_0x466862['status'](0xcc)[_0x3b7d('0x18')]();});}};}function handleEntityNotFound(_0x3efe9a,_0x3eceed){return function(_0x5bbaa5){if(!_0x5bbaa5){_0x3efe9a['sendStatus'](0x194);}return _0x5bbaa5;};}function handleError(_0x15b5e3,_0x34ab4e){_0x34ab4e=_0x34ab4e||0x1f4;return function(_0xd7d400){logger[_0x3b7d('0x22')](_0xd7d400[_0x3b7d('0x23')]);if(_0xd7d400[_0x3b7d('0x24')]){delete _0xd7d400[_0x3b7d('0x24')];}_0x15b5e3[_0x3b7d('0x17')](_0x34ab4e)[_0x3b7d('0x25')](_0xd7d400);};}exports['index']=function(_0x3f5e96,_0x526dd4){var _0x204bb0={},_0x2e6604={},_0x588990={'count':0x0,'rows':[]};var _0x53f041=_[_0x3b7d('0x26')](db['FreshsalesField']['rawAttributes'],function(_0x4b670e){return{'name':_0x4b670e[_0x3b7d('0x27')],'type':_0x4b670e[_0x3b7d('0x28')]['key']};});_0x2e6604['model']=_[_0x3b7d('0x26')](_0x53f041,_0x3b7d('0x24'));_0x2e6604['query']=_[_0x3b7d('0x29')](_0x3f5e96[_0x3b7d('0x2a')]);_0x2e6604[_0x3b7d('0x2b')]=_[_0x3b7d('0x2c')](_0x2e6604[_0x3b7d('0x2d')],_0x2e6604[_0x3b7d('0x2a')]);_0x204bb0['attributes']=_[_0x3b7d('0x2c')](_0x2e6604[_0x3b7d('0x2d')],qs[_0x3b7d('0x2e')](_0x3f5e96[_0x3b7d('0x2a')][_0x3b7d('0x2e')]));_0x204bb0[_0x3b7d('0x2f')]=_0x204bb0[_0x3b7d('0x2f')][_0x3b7d('0x30')]?_0x204bb0[_0x3b7d('0x2f')]:_0x2e6604[_0x3b7d('0x2d')];if(!_0x3f5e96['query']['hasOwnProperty'](_0x3b7d('0x31'))){_0x204bb0[_0x3b7d('0x1d')]=qs[_0x3b7d('0x1d')](_0x3f5e96[_0x3b7d('0x2a')][_0x3b7d('0x1d')]);_0x204bb0[_0x3b7d('0x1a')]=qs[_0x3b7d('0x1a')](_0x3f5e96[_0x3b7d('0x2a')][_0x3b7d('0x1a')]);}_0x204bb0[_0x3b7d('0x32')]=qs[_0x3b7d('0x33')](_0x3f5e96['query'][_0x3b7d('0x33')]);_0x204bb0[_0x3b7d('0x34')]=qs[_0x3b7d('0x2b')](_[_0x3b7d('0x35')](_0x3f5e96[_0x3b7d('0x2a')],_0x2e6604['filters']),_0x53f041);if(_0x3f5e96[_0x3b7d('0x2a')][_0x3b7d('0x36')]){_0x204bb0[_0x3b7d('0x34')]=_['merge'](_0x204bb0[_0x3b7d('0x34')],{'$or':_[_0x3b7d('0x26')](_0x53f041,function(_0x6840d4){if(_0x6840d4[_0x3b7d('0x28')]!==_0x3b7d('0x37')){var _0x27427e={};_0x27427e[_0x6840d4[_0x3b7d('0x24')]]={'$like':'%'+_0x3f5e96[_0x3b7d('0x2a')]['filter']+'%'};return _0x27427e;}})});}_0x204bb0=_['merge']({},_0x204bb0,_0x3f5e96[_0x3b7d('0x38')]);var _0x378365={'where':_0x204bb0['where']};return db['FreshsalesField']['count'](_0x378365)['then'](function(_0x17f713){_0x588990[_0x3b7d('0x1c')]=_0x17f713;if(_0x3f5e96['query']['includeAll']){_0x204bb0['include']=[{'all':!![]}];}return db[_0x3b7d('0x39')][_0x3b7d('0x3a')](_0x204bb0);})[_0x3b7d('0x21')](function(_0x174870){_0x588990[_0x3b7d('0x3b')]=_0x174870;return _0x588990;})[_0x3b7d('0x21')](respondWithFilteredResult(_0x526dd4,_0x204bb0))[_0x3b7d('0x3c')](handleError(_0x526dd4,null));};exports[_0x3b7d('0x3d')]=function(_0x4abae6,_0x28206f){var _0x58dc79={'raw':!![],'where':{'id':_0x4abae6['params']['id']}},_0x309ff6={};_0x309ff6[_0x3b7d('0x2d')]=_['keys'](db[_0x3b7d('0x39')]['rawAttributes']);_0x309ff6[_0x3b7d('0x2a')]=_[_0x3b7d('0x29')](_0x4abae6['query']);_0x309ff6[_0x3b7d('0x2b')]=_[_0x3b7d('0x2c')](_0x309ff6['model'],_0x309ff6[_0x3b7d('0x2a')]);_0x58dc79[_0x3b7d('0x2f')]=_[_0x3b7d('0x2c')](_0x309ff6['model'],qs[_0x3b7d('0x2e')](_0x4abae6['query'][_0x3b7d('0x2e')]));_0x58dc79[_0x3b7d('0x2f')]=_0x58dc79[_0x3b7d('0x2f')][_0x3b7d('0x30')]?_0x58dc79[_0x3b7d('0x2f')]:_0x309ff6[_0x3b7d('0x2d')];if(_0x4abae6[_0x3b7d('0x2a')][_0x3b7d('0x3e')]){_0x58dc79[_0x3b7d('0x3f')]=[{'all':!![]}];}_0x58dc79=_[_0x3b7d('0x40')]({},_0x58dc79,_0x4abae6[_0x3b7d('0x38')]);return db[_0x3b7d('0x39')][_0x3b7d('0x41')](_0x58dc79)[_0x3b7d('0x21')](handleEntityNotFound(_0x28206f,null))['then'](respondWithResult(_0x28206f,null))['catch'](handleError(_0x28206f,null));};exports[_0x3b7d('0x42')]=function(_0xf5d74a,_0x1601bd){return db['FreshsalesField']['create'](_0xf5d74a[_0x3b7d('0x43')],{})['then'](respondWithResult(_0x1601bd,0xc9))[_0x3b7d('0x3c')](handleError(_0x1601bd,null));};exports['update']=function(_0xb58f49,_0x59b18f){if(_0xb58f49[_0x3b7d('0x43')]['id']){delete _0xb58f49[_0x3b7d('0x43')]['id'];}return db[_0x3b7d('0x39')][_0x3b7d('0x41')]({'where':{'id':_0xb58f49[_0x3b7d('0x44')]['id']}})['then'](handleEntityNotFound(_0x59b18f,null))[_0x3b7d('0x21')](saveUpdates(_0xb58f49['body'],null))[_0x3b7d('0x21')](respondWithResult(_0x59b18f,null))[_0x3b7d('0x3c')](handleError(_0x59b18f,null));};exports[_0x3b7d('0x45')]=function(_0x1f50ce,_0xd372cb){return db[_0x3b7d('0x39')][_0x3b7d('0x41')]({'where':{'id':_0x1f50ce[_0x3b7d('0x44')]['id']}})[_0x3b7d('0x21')](handleEntityNotFound(_0xd372cb,null))[_0x3b7d('0x21')](removeEntity(_0xd372cb,null))['catch'](handleError(_0xd372cb,null));}; \ No newline at end of file +var _0xbd5a=['then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','json','offset','limit','count','status','set','apply','reject','save'];(function(_0x158f4c,_0x19c670){var _0x3ab9ff=function(_0x5cb773){while(--_0x5cb773){_0x158f4c['push'](_0x158f4c['shift']());}};_0x3ab9ff(++_0x19c670);}(_0xbd5a,0x105));var _0xabd5=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xbd5a[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require(_0xabd5('0x0'));var rimraf=require(_0xabd5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabd5('0x2'));var rp=require(_0xabd5('0x3'));var moment=require(_0xabd5('0x4'));var BPromise=require(_0xabd5('0x5'));var Mustache=require('mustache');var util=require(_0xabd5('0x6'));var path=require(_0xabd5('0x7'));var sox=require(_0xabd5('0x8'));var csv=require(_0xabd5('0x9'));var ejs=require(_0xabd5('0xa'));var fs=require('fs');var fs_extra=require(_0xabd5('0xb'));var _=require(_0xabd5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xabd5('0xd'));var toCsv=require(_0xabd5('0x9'));var querystring=require(_0xabd5('0xe'));var Papa=require('papaparse');var Redis=require(_0xabd5('0xf'));var authService=require(_0xabd5('0x10'));var qs=require(_0xabd5('0x11'));var as=require(_0xabd5('0x12'));var hardwareService=require(_0xabd5('0x13'));var logger=require(_0xabd5('0x14'))(_0xabd5('0x15'));var utils=require('../../config/utils');var config=require(_0xabd5('0x16'));var licenseUtil=require(_0xabd5('0x17'));var db=require(_0xabd5('0x18'))['db'];function respondWithStatusCode(_0x16108f,_0x391e4e){_0x391e4e=_0x391e4e||0xcc;return function(_0x4ec8a6){if(_0x4ec8a6){return _0x16108f[_0xabd5('0x19')](_0x391e4e);}return _0x16108f['status'](_0x391e4e)['end']();};}function respondWithResult(_0x4af57e,_0x2ef7f5){_0x2ef7f5=_0x2ef7f5||0xc8;return function(_0x2d7a41){if(_0x2d7a41){return _0x4af57e['status'](_0x2ef7f5)[_0xabd5('0x1a')](_0x2d7a41);}};}function respondWithFilteredResult(_0x538fcc,_0x397dbf){return function(_0x2d1465){if(_0x2d1465){var _0x5df164=typeof _0x397dbf[_0xabd5('0x1b')]==='undefined'&&typeof _0x397dbf[_0xabd5('0x1c')]==='undefined';var _0x40e4eb=_0x2d1465[_0xabd5('0x1d')];var _0x19103c=_0x5df164?0x0:_0x397dbf[_0xabd5('0x1b')];var _0x4c42cb=_0x5df164?_0x2d1465[_0xabd5('0x1d')]:_0x397dbf['offset']+_0x397dbf['limit'];var _0x1ff848;if(_0x4c42cb>=_0x40e4eb){_0x4c42cb=_0x40e4eb;_0x1ff848=0xc8;}else{_0x1ff848=0xce;}_0x538fcc[_0xabd5('0x1e')](_0x1ff848);return _0x538fcc[_0xabd5('0x1f')]('Content-Range',_0x19103c+'-'+_0x4c42cb+'/'+_0x40e4eb)[_0xabd5('0x1a')](_0x2d1465);}return null;};}function patchUpdates(_0x9bebe4){return function(_0x42430b){try{jsonpatch[_0xabd5('0x20')](_0x42430b,_0x9bebe4,!![]);}catch(_0x79bb29){return BPromise[_0xabd5('0x21')](_0x79bb29);}return _0x42430b[_0xabd5('0x22')]();};}function saveUpdates(_0x426437,_0x155d6f){return function(_0x488939){if(_0x488939){return _0x488939['update'](_0x426437)[_0xabd5('0x23')](function(_0x54811c){return _0x54811c;});}return null;};}function removeEntity(_0x3fc906,_0x2ce574){return function(_0x4014b0){if(_0x4014b0){return _0x4014b0[_0xabd5('0x24')]()[_0xabd5('0x23')](function(){_0x3fc906[_0xabd5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c06c,_0x4bd5ba){return function(_0x53d6ca){if(!_0x53d6ca){_0x10c06c[_0xabd5('0x19')](0x194);}return _0x53d6ca;};}function handleError(_0x324994,_0x56e36f){_0x56e36f=_0x56e36f||0x1f4;return function(_0x343849){logger[_0xabd5('0x25')](_0x343849['stack']);if(_0x343849[_0xabd5('0x26')]){delete _0x343849[_0xabd5('0x26')];}_0x324994[_0xabd5('0x1e')](_0x56e36f)[_0xabd5('0x27')](_0x343849);};}exports[_0xabd5('0x28')]=function(_0x4859dd,_0x5192e9){var _0x456f7d={},_0x2f1695={},_0x47efb5={'count':0x0,'rows':[]};var _0x44653e=_[_0xabd5('0x29')](db[_0xabd5('0x2a')][_0xabd5('0x2b')],function(_0x582ba8){return{'name':_0x582ba8[_0xabd5('0x2c')],'type':_0x582ba8[_0xabd5('0x2d')][_0xabd5('0x2e')]};});_0x2f1695[_0xabd5('0x2f')]=_[_0xabd5('0x29')](_0x44653e,_0xabd5('0x26'));_0x2f1695[_0xabd5('0x30')]=_[_0xabd5('0x31')](_0x4859dd[_0xabd5('0x30')]);_0x2f1695[_0xabd5('0x32')]=_[_0xabd5('0x33')](_0x2f1695[_0xabd5('0x2f')],_0x2f1695[_0xabd5('0x30')]);_0x456f7d[_0xabd5('0x34')]=_['intersection'](_0x2f1695[_0xabd5('0x2f')],qs[_0xabd5('0x35')](_0x4859dd[_0xabd5('0x30')][_0xabd5('0x35')]));_0x456f7d[_0xabd5('0x34')]=_0x456f7d[_0xabd5('0x34')][_0xabd5('0x36')]?_0x456f7d[_0xabd5('0x34')]:_0x2f1695['model'];if(!_0x4859dd[_0xabd5('0x30')][_0xabd5('0x37')](_0xabd5('0x38'))){_0x456f7d['limit']=qs[_0xabd5('0x1c')](_0x4859dd[_0xabd5('0x30')][_0xabd5('0x1c')]);_0x456f7d[_0xabd5('0x1b')]=qs['offset'](_0x4859dd[_0xabd5('0x30')][_0xabd5('0x1b')]);}_0x456f7d['order']=qs[_0xabd5('0x39')](_0x4859dd[_0xabd5('0x30')][_0xabd5('0x39')]);_0x456f7d[_0xabd5('0x3a')]=qs[_0xabd5('0x32')](_[_0xabd5('0x3b')](_0x4859dd[_0xabd5('0x30')],_0x2f1695[_0xabd5('0x32')]),_0x44653e);if(_0x4859dd['query'][_0xabd5('0x3c')]){_0x456f7d[_0xabd5('0x3a')]=_[_0xabd5('0x3d')](_0x456f7d[_0xabd5('0x3a')],{'$or':_[_0xabd5('0x29')](_0x44653e,function(_0x1e8868){if(_0x1e8868[_0xabd5('0x2d')]!==_0xabd5('0x3e')){var _0xb75d61={};_0xb75d61[_0x1e8868[_0xabd5('0x26')]]={'$like':'%'+_0x4859dd['query'][_0xabd5('0x3c')]+'%'};return _0xb75d61;}})});}_0x456f7d=_[_0xabd5('0x3d')]({},_0x456f7d,_0x4859dd[_0xabd5('0x3f')]);var _0x215726={'where':_0x456f7d[_0xabd5('0x3a')]};return db[_0xabd5('0x2a')][_0xabd5('0x1d')](_0x215726)[_0xabd5('0x23')](function(_0x48d530){_0x47efb5[_0xabd5('0x1d')]=_0x48d530;if(_0x4859dd[_0xabd5('0x30')]['includeAll']){_0x456f7d['include']=[{'all':!![]}];}return db[_0xabd5('0x2a')][_0xabd5('0x40')](_0x456f7d);})[_0xabd5('0x23')](function(_0x390847){_0x47efb5[_0xabd5('0x41')]=_0x390847;return _0x47efb5;})[_0xabd5('0x23')](respondWithFilteredResult(_0x5192e9,_0x456f7d))[_0xabd5('0x42')](handleError(_0x5192e9,null));};exports[_0xabd5('0x43')]=function(_0x33f0d3,_0x51913c){var _0x46f241={'raw':!![],'where':{'id':_0x33f0d3[_0xabd5('0x44')]['id']}},_0x96d382={};_0x96d382[_0xabd5('0x2f')]=_[_0xabd5('0x31')](db[_0xabd5('0x2a')]['rawAttributes']);_0x96d382['query']=_[_0xabd5('0x31')](_0x33f0d3['query']);_0x96d382[_0xabd5('0x32')]=_[_0xabd5('0x33')](_0x96d382[_0xabd5('0x2f')],_0x96d382[_0xabd5('0x30')]);_0x46f241[_0xabd5('0x34')]=_[_0xabd5('0x33')](_0x96d382['model'],qs['fields'](_0x33f0d3[_0xabd5('0x30')][_0xabd5('0x35')]));_0x46f241[_0xabd5('0x34')]=_0x46f241[_0xabd5('0x34')][_0xabd5('0x36')]?_0x46f241[_0xabd5('0x34')]:_0x96d382[_0xabd5('0x2f')];if(_0x33f0d3['query'][_0xabd5('0x45')]){_0x46f241[_0xabd5('0x46')]=[{'all':!![]}];}_0x46f241=_[_0xabd5('0x3d')]({},_0x46f241,_0x33f0d3['options']);return db[_0xabd5('0x2a')][_0xabd5('0x47')](_0x46f241)[_0xabd5('0x23')](handleEntityNotFound(_0x51913c,null))[_0xabd5('0x23')](respondWithResult(_0x51913c,null))[_0xabd5('0x42')](handleError(_0x51913c,null));};exports['create']=function(_0x5897fb,_0x596832){return db[_0xabd5('0x2a')][_0xabd5('0x48')](_0x5897fb[_0xabd5('0x49')],{})['then'](respondWithResult(_0x596832,0xc9))[_0xabd5('0x42')](handleError(_0x596832,null));};exports['update']=function(_0x2e83ca,_0x2003ae){if(_0x2e83ca[_0xabd5('0x49')]['id']){delete _0x2e83ca[_0xabd5('0x49')]['id'];}return db[_0xabd5('0x2a')]['find']({'where':{'id':_0x2e83ca[_0xabd5('0x44')]['id']}})[_0xabd5('0x23')](handleEntityNotFound(_0x2003ae,null))[_0xabd5('0x23')](saveUpdates(_0x2e83ca[_0xabd5('0x49')],null))[_0xabd5('0x23')](respondWithResult(_0x2003ae,null))['catch'](handleError(_0x2003ae,null));};exports['destroy']=function(_0x14e690,_0x3b7453){return db[_0xabd5('0x2a')]['find']({'where':{'id':_0x14e690[_0xabd5('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b7453,null))[_0xabd5('0x23')](removeEntity(_0x3b7453,null))['catch'](handleError(_0x3b7453,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 392d33f..d3bcdc7 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 _0xbca0=['util','bluebird','request-promise','path','rimraf','exports','define','idField','FieldId','lodash'];(function(_0x3b507d,_0x3367fd){var _0x36d4f2=function(_0x29b3b1){while(--_0x29b3b1){_0x3b507d['push'](_0x3b507d['shift']());}};_0x36d4f2(++_0x3367fd);}(_0xbca0,0x8b));var _0x0bca=function(_0x317451,_0x10e6dd){_0x317451=_0x317451-0x0;var _0xeb2909=_0xbca0[_0x317451];return _0xeb2909;};'use strict';var _=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0bca('0x2'));var rp=require(_0x0bca('0x3'));var fs=require('fs');var path=require(_0x0bca('0x4'));var rimraf=require(_0x0bca('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x0bca('0x6')]=function(_0x3d1155,_0x3dab5e){return _0x3d1155[_0x0bca('0x7')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x0bca('0x8'),_0x0bca('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa908=['int_freshsales_fields','freshsales_unique_index','idField','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x5bc4ca,_0x21f738){var _0x12bf3b=function(_0x202536){while(--_0x202536){_0x5bc4ca['push'](_0x5bc4ca['shift']());}};_0x12bf3b(++_0x21f738);}(_0xa908,0x1c3));var _0x8a90=function(_0x3233cb,_0x4ba76e){_0x3233cb=_0x3233cb-0x0;var _0x30a7d6=_0xa908[_0x3233cb];return _0x30a7d6;};'use strict';var _=require(_0x8a90('0x0'));var util=require('util');var logger=require(_0x8a90('0x1'))('api');var moment=require(_0x8a90('0x2'));var BPromise=require(_0x8a90('0x3'));var rp=require(_0x8a90('0x4'));var fs=require('fs');var path=require(_0x8a90('0x5'));var rimraf=require(_0x8a90('0x6'));var config=require('../../config/environment');var attributes=require(_0x8a90('0x7'));module[_0x8a90('0x8')]=function(_0x5e41b9,_0x1c516f){return _0x5e41b9[_0x8a90('0x9')](_0x8a90('0xa'),attributes,{'tableName':_0x8a90('0xb'),'paranoid':![],'indexes':[{'name':_0x8a90('0xc'),'fields':[_0x8a90('0xd'),'FieldId'],'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 2fb9c81..1b5753a 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5963bb,_0x40dbf7){var _0x3ac85a=function(_0x432546){while(--_0x432546){_0x5963bb['push'](_0x5963bb['shift']());}};_0x3ac85a(++_0x40dbf7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x5fc3[_0x5c4585];return _0x21dede;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x49e4bd,_0xf8c639){var _0x14458d=function(_0x1359ea){while(--_0x1359ea){_0x49e4bd['push'](_0x49e4bd['shift']());}};_0x14458d(++_0xf8c639);}(_0x90b1,0x1bb));var _0x190b=function(_0x45a244,_0x12f982){_0x45a244=_0x45a244-0x0;var _0x57edbc=_0x90b1[_0x45a244];return _0x57edbc;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index bad778d..75b0d0d 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(_0x3981fc,_0x50f441){var _0x137929=function(_0x178e0e){while(--_0x178e0e){_0x3981fc['push'](_0x3981fc['shift']());}};_0x137929(++_0x50f441);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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(_0x401d84,_0x47b29e){var _0x354e2a=function(_0xfb3579){while(--_0xfb3579){_0x401d84['push'](_0x401d84['shift']());}};_0x354e2a(++_0x47b29e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8338352..9629f08 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 _0x8561=['STRING','newTab','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8561,0x1b2));var _0x1856=function(_0x4a9bdd,_0x5098f5){_0x4a9bdd=_0x4a9bdd-0x0;var _0x1ba3a4=_0x8561[_0x4a9bdd];return _0x1ba3a4;};'use strict';var Sequelize=require('sequelize');module[_0x1856('0x0')]={'name':{'type':Sequelize[_0x1856('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1856('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x1856('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1856('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x1856('0x1')]},'serverUrl':{'type':Sequelize[_0x1856('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x1856('0x2')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x39b2=['newTab','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39b2,0x10f));var _0x239b=function(_0x9a206c,_0x363ae4){_0x9a206c=_0x9a206c-0x0;var _0x15ced8=_0x39b2[_0x9a206c];return _0x15ced8;};'use strict';var Sequelize=require(_0x239b('0x0'));module['exports']={'name':{'type':Sequelize[_0x239b('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x239b('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x239b('0x1')]},'password':{'type':Sequelize[_0x239b('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x239b('0x1')]},'securityToken':{'type':Sequelize[_0x239b('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x239b('0x2')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d932cb4..856ddb6 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 _0x3678=['phone','remove','includes','custom','picklistValues','label','True','true','False','false','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','where','includeAll','rows','show','keys','fields','include','options','catch','create','body','find','getConfigurations','params','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','remoteUri','clientId','password','securityToken','slice','substring','lastIndexOf','clientSecret','username','concat','isNil','ticketType','describe','IsReminderSet','IsRecurrence','Subject','string','int','picklist','boolean'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x3678,0x1ef));var _0x8367=function(_0x425d5e,_0x3b9040){_0x425d5e=_0x425d5e-0x0;var _0x3cc67b=_0x3678[_0x425d5e];return _0x3cc67b;};'use strict';var emlformat=require(_0x8367('0x0'));var rimraf=require(_0x8367('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8367('0x2'));var rp=require(_0x8367('0x3'));var moment=require(_0x8367('0x4'));var BPromise=require(_0x8367('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8367('0x6'));var sox=require(_0x8367('0x7'));var csv=require(_0x8367('0x8'));var ejs=require(_0x8367('0x9'));var fs=require('fs');var fs_extra=require(_0x8367('0xa'));var _=require(_0x8367('0xb'));var squel=require('squel');var crypto=require(_0x8367('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8367('0x8'));var querystring=require(_0x8367('0xd'));var Papa=require(_0x8367('0xe'));var Redis=require(_0x8367('0xf'));var authService=require(_0x8367('0x10'));var qs=require(_0x8367('0x11'));var as=require(_0x8367('0x12'));var hardwareService=require(_0x8367('0x13'));var logger=require(_0x8367('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8367('0x15'));var licenseUtil=require(_0x8367('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x73f80f,_0x526259){_0x526259=_0x526259||0xcc;return function(_0x4327b5){if(_0x4327b5){return _0x73f80f[_0x8367('0x17')](_0x526259);}return _0x73f80f[_0x8367('0x18')](_0x526259)[_0x8367('0x19')]();};}function respondWithResult(_0xdbd6ad,_0x1a4cfd){_0x1a4cfd=_0x1a4cfd||0xc8;return function(_0x383b26){if(_0x383b26){return _0xdbd6ad[_0x8367('0x18')](_0x1a4cfd)[_0x8367('0x1a')](_0x383b26);}};}function respondWithFilteredResult(_0x12063b,_0x148616){return function(_0x4c9f8f){if(_0x4c9f8f){var _0x5d88e6=typeof _0x148616[_0x8367('0x1b')]===_0x8367('0x1c')&&typeof _0x148616[_0x8367('0x1d')]===_0x8367('0x1c');var _0x6bdf95=_0x4c9f8f[_0x8367('0x1e')];var _0xdc7add=_0x5d88e6?0x0:_0x148616[_0x8367('0x1b')];var _0x5f2755=_0x5d88e6?_0x4c9f8f['count']:_0x148616[_0x8367('0x1b')]+_0x148616['limit'];var _0x1edd9f;if(_0x5f2755>=_0x6bdf95){_0x5f2755=_0x6bdf95;_0x1edd9f=0xc8;}else{_0x1edd9f=0xce;}_0x12063b[_0x8367('0x18')](_0x1edd9f);return _0x12063b[_0x8367('0x1f')](_0x8367('0x20'),_0xdc7add+'-'+_0x5f2755+'/'+_0x6bdf95)[_0x8367('0x1a')](_0x4c9f8f);}return null;};}function patchUpdates(_0x5f26e0){return function(_0x209ece){try{jsonpatch[_0x8367('0x21')](_0x209ece,_0x5f26e0,!![]);}catch(_0x3feef5){return BPromise[_0x8367('0x22')](_0x3feef5);}return _0x209ece[_0x8367('0x23')]();};}function saveUpdates(_0x23128a,_0x3e45d5){return function(_0x535361){if(_0x535361){return _0x535361[_0x8367('0x24')](_0x23128a)[_0x8367('0x25')](function(_0x5004c5){return _0x5004c5;});}return null;};}function removeEntity(_0x7b8c9a,_0x3e8bd6){return function(_0x3563bd){if(_0x3563bd){return _0x3563bd[_0x8367('0x26')]()[_0x8367('0x25')](function(){_0x7b8c9a[_0x8367('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a6ef4,_0x55d276){return function(_0x1b6b06){if(!_0x1b6b06){_0x3a6ef4[_0x8367('0x17')](0x194);}return _0x1b6b06;};}function handleError(_0x38770f,_0x5ef380){_0x5ef380=_0x5ef380||0x1f4;return function(_0x2c6015){logger[_0x8367('0x27')](_0x2c6015[_0x8367('0x28')]);if(_0x2c6015[_0x8367('0x29')]){delete _0x2c6015['name'];}_0x38770f['status'](_0x5ef380)[_0x8367('0x2a')](_0x2c6015);};}exports[_0x8367('0x2b')]=function(_0x2ef9de,_0x5c6aff){var _0x5c96eb={},_0x27ea64={},_0x189522={'count':0x0,'rows':[]};var _0x53ef72=_[_0x8367('0x2c')](db[_0x8367('0x2d')][_0x8367('0x2e')],function(_0xfd5a6e){return{'name':_0xfd5a6e[_0x8367('0x2f')],'type':_0xfd5a6e[_0x8367('0x30')]['key']};});_0x27ea64[_0x8367('0x31')]=_[_0x8367('0x2c')](_0x53ef72,_0x8367('0x29'));_0x27ea64[_0x8367('0x32')]=_['keys'](_0x2ef9de['query']);_0x27ea64['filters']=_[_0x8367('0x33')](_0x27ea64[_0x8367('0x31')],_0x27ea64[_0x8367('0x32')]);_0x5c96eb[_0x8367('0x34')]=_['intersection'](_0x27ea64[_0x8367('0x31')],qs['fields'](_0x2ef9de['query']['fields']));_0x5c96eb[_0x8367('0x34')]=_0x5c96eb[_0x8367('0x34')][_0x8367('0x35')]?_0x5c96eb['attributes']:_0x27ea64[_0x8367('0x31')];if(!_0x2ef9de[_0x8367('0x32')][_0x8367('0x36')](_0x8367('0x37'))){_0x5c96eb[_0x8367('0x1d')]=qs[_0x8367('0x1d')](_0x2ef9de[_0x8367('0x32')]['limit']);_0x5c96eb[_0x8367('0x1b')]=qs[_0x8367('0x1b')](_0x2ef9de[_0x8367('0x32')][_0x8367('0x1b')]);}_0x5c96eb[_0x8367('0x38')]=qs['sort'](_0x2ef9de[_0x8367('0x32')][_0x8367('0x39')]);_0x5c96eb['where']=qs[_0x8367('0x3a')](_[_0x8367('0x3b')](_0x2ef9de[_0x8367('0x32')],_0x27ea64[_0x8367('0x3a')]),_0x53ef72);if(_0x2ef9de[_0x8367('0x32')][_0x8367('0x3c')]){_0x5c96eb['where']=_[_0x8367('0x3d')](_0x5c96eb['where'],{'$or':_['map'](_0x53ef72,function(_0x193876){if(_0x193876[_0x8367('0x30')]!==_0x8367('0x3e')){var _0x5819e9={};_0x5819e9[_0x193876[_0x8367('0x29')]]={'$like':'%'+_0x2ef9de[_0x8367('0x32')][_0x8367('0x3c')]+'%'};return _0x5819e9;}})});}_0x5c96eb=_['merge']({},_0x5c96eb,_0x2ef9de['options']);var _0x194d51={'where':_0x5c96eb[_0x8367('0x3f')]};return db[_0x8367('0x2d')][_0x8367('0x1e')](_0x194d51)['then'](function(_0x124c62){_0x189522['count']=_0x124c62;if(_0x2ef9de[_0x8367('0x32')][_0x8367('0x40')]){_0x5c96eb['include']=[{'all':!![]}];}return db[_0x8367('0x2d')]['findAll'](_0x5c96eb);})['then'](function(_0x5a03c6){_0x189522[_0x8367('0x41')]=_0x5a03c6;return _0x189522;})[_0x8367('0x25')](respondWithFilteredResult(_0x5c6aff,_0x5c96eb))['catch'](handleError(_0x5c6aff,null));};exports[_0x8367('0x42')]=function(_0x278f0e,_0x2c2eb2){var _0x49a915={'raw':![],'where':{'id':_0x278f0e['params']['id']}},_0x1ff42c={};_0x1ff42c[_0x8367('0x31')]=_[_0x8367('0x43')](db[_0x8367('0x2d')][_0x8367('0x2e')]);_0x1ff42c[_0x8367('0x32')]=_[_0x8367('0x43')](_0x278f0e['query']);_0x1ff42c['filters']=_[_0x8367('0x33')](_0x1ff42c['model'],_0x1ff42c[_0x8367('0x32')]);_0x49a915[_0x8367('0x34')]=_[_0x8367('0x33')](_0x1ff42c['model'],qs['fields'](_0x278f0e[_0x8367('0x32')][_0x8367('0x44')]));_0x49a915[_0x8367('0x34')]=_0x49a915[_0x8367('0x34')][_0x8367('0x35')]?_0x49a915[_0x8367('0x34')]:_0x1ff42c[_0x8367('0x31')];if(_0x278f0e[_0x8367('0x32')][_0x8367('0x40')]){_0x49a915[_0x8367('0x45')]=[{'all':!![]}];}_0x49a915=_[_0x8367('0x3d')]({},_0x49a915,_0x278f0e[_0x8367('0x46')]);return db[_0x8367('0x2d')]['find'](_0x49a915)[_0x8367('0x25')](handleEntityNotFound(_0x2c2eb2,null))[_0x8367('0x25')](respondWithResult(_0x2c2eb2,null))[_0x8367('0x47')](handleError(_0x2c2eb2,null));};exports[_0x8367('0x48')]=function(_0x17df3e,_0x3e094c){return db[_0x8367('0x2d')]['create'](_0x17df3e[_0x8367('0x49')],{})[_0x8367('0x25')](respondWithResult(_0x3e094c,0xc9))[_0x8367('0x47')](handleError(_0x3e094c,null));};exports[_0x8367('0x24')]=function(_0x18faf8,_0x3d3610){if(_0x18faf8[_0x8367('0x49')]['id']){delete _0x18faf8['body']['id'];}return db[_0x8367('0x2d')][_0x8367('0x4a')]({'where':{'id':_0x18faf8['params']['id']}})[_0x8367('0x25')](handleEntityNotFound(_0x3d3610,null))[_0x8367('0x25')](saveUpdates(_0x18faf8[_0x8367('0x49')],null))[_0x8367('0x25')](respondWithResult(_0x3d3610,null))[_0x8367('0x47')](handleError(_0x3d3610,null));};exports[_0x8367('0x26')]=function(_0x39ded8,_0xfedb63){return db[_0x8367('0x2d')]['find']({'where':{'id':_0x39ded8['params']['id']}})[_0x8367('0x25')](handleEntityNotFound(_0xfedb63,null))['then'](removeEntity(_0xfedb63,null))[_0x8367('0x47')](handleError(_0xfedb63,null));};exports[_0x8367('0x4b')]=function(_0x4727d4,_0x4e1a70,_0x1f679e){var _0x3d7c4f={};var _0x412f78={};var _0x4f0e91;var _0x2f1e1a;return db[_0x8367('0x2d')]['findOne']({'where':{'id':_0x4727d4[_0x8367('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e1a70,null))[_0x8367('0x25')](function(_0xa825f1){if(_0xa825f1){_0x4f0e91=_0xa825f1;_0x412f78[_0x8367('0x31')]=_['keys'](db['SalesforceConfiguration'][_0x8367('0x2e')]);_0x412f78[_0x8367('0x32')]=_[_0x8367('0x43')](_0x4727d4[_0x8367('0x32')]);_0x412f78[_0x8367('0x3a')]=_[_0x8367('0x33')](_0x412f78[_0x8367('0x31')],_0x412f78[_0x8367('0x32')]);_0x3d7c4f[_0x8367('0x34')]=_[_0x8367('0x33')](_0x412f78[_0x8367('0x31')],qs['fields'](_0x4727d4['query'][_0x8367('0x44')]));_0x3d7c4f[_0x8367('0x34')]=_0x3d7c4f['attributes'][_0x8367('0x35')]?_0x3d7c4f[_0x8367('0x34')]:_0x412f78[_0x8367('0x31')];_0x3d7c4f[_0x8367('0x38')]=qs[_0x8367('0x39')](_0x4727d4['query'][_0x8367('0x39')]);_0x3d7c4f[_0x8367('0x3f')]=qs['filters'](_[_0x8367('0x3b')](_0x4727d4[_0x8367('0x32')],_0x412f78[_0x8367('0x3a')]));if(_0x4727d4['query'][_0x8367('0x3c')]){_0x3d7c4f[_0x8367('0x3f')]=_['merge'](_0x3d7c4f['where'],{'$or':_[_0x8367('0x2c')](_0x3d7c4f[_0x8367('0x34')],function(_0x243fa4){var _0x4993b6={};_0x4993b6[_0x243fa4]={'$like':'%'+_0x4727d4[_0x8367('0x32')][_0x8367('0x3c')]+'%'};return _0x4993b6;})});}_0x3d7c4f=_[_0x8367('0x3d')]({},_0x3d7c4f,_0x4727d4[_0x8367('0x46')]);return _0x4f0e91['getConfigurations'](_0x3d7c4f);}})[_0x8367('0x25')](function(_0x53e086){if(_0x53e086){_0x2f1e1a=_0x53e086[_0x8367('0x35')];if(!_0x4727d4[_0x8367('0x32')]['hasOwnProperty'](_0x8367('0x37'))){_0x3d7c4f['limit']=qs[_0x8367('0x1d')](_0x4727d4[_0x8367('0x32')][_0x8367('0x1d')]);_0x3d7c4f[_0x8367('0x1b')]=qs[_0x8367('0x1b')](_0x4727d4[_0x8367('0x32')]['offset']);}return _0x4f0e91[_0x8367('0x4b')](_0x3d7c4f);}})[_0x8367('0x25')](function(_0x13419b){if(_0x13419b){return _0x13419b?{'count':_0x2f1e1a,'rows':_0x13419b}:null;}})['then'](respondWithResult(_0x4e1a70,null))[_0x8367('0x47')](handleError(_0x4e1a70,null));};exports['addConfiguration']=function(_0x4fbf41,_0x1f5df2,_0x460532){if(_0x4fbf41[_0x8367('0x49')]['id']){delete _0x4fbf41[_0x8367('0x49')]['id'];}return db[_0x8367('0x2d')][_0x8367('0x4d')]({'where':{'id':_0x4fbf41[_0x8367('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f5df2,null))[_0x8367('0x25')](function(_0x41c34f){if(_0x41c34f){_0x4fbf41[_0x8367('0x49')][_0x8367('0x4e')]=_0x41c34f['id'];_0x4fbf41['body'][_0x8367('0x4f')]=integrations[_0x8367('0x50')](_0x4fbf41[_0x8367('0x49')][_0x8367('0x51')],_0x4fbf41[_0x8367('0x49')][_0x8367('0x30')]);_0x4fbf41[_0x8367('0x49')][_0x8367('0x52')]=integrations[_0x8367('0x53')](_0x4fbf41[_0x8367('0x49')][_0x8367('0x51')],_0x4fbf41[_0x8367('0x49')]['type']);return db['SalesforceConfiguration']['create'](_0x4fbf41[_0x8367('0x49')],{'include':[{'model':db[_0x8367('0x54')],'as':'Subjects'},{'model':db[_0x8367('0x54')],'as':'Descriptions'}]});}return null;})[_0x8367('0x25')](respondWithResult(_0x1f5df2,null))['catch'](handleError(_0x1f5df2,null));};exports['getFields']=function(_0x5eba54,_0x35d1d8,_0x1cad7f){var _0x4c6e48;var _0x42e31e='';var _0x105d34='Task';return db[_0x8367('0x2d')][_0x8367('0x4d')]({'where':{'id':_0x5eba54[_0x8367('0x4c')]['id']},'attributes':['id',_0x8367('0x55'),_0x8367('0x56'),'clientSecret','username',_0x8367('0x57'),_0x8367('0x58')]})['then'](handleEntityNotFound(_0x35d1d8,null))[_0x8367('0x25')](function(_0x7e5ff9){if(_0x7e5ff9){_0x42e31e=_0x7e5ff9[_0x8367('0x55')];var _0x15391b=_0x42e31e[_0x8367('0x59')](-0x1);if(_0x15391b==='/'){_0x42e31e=_0x42e31e[_0x8367('0x5a')](0x0,_0x42e31e[_0x8367('0x5b')](_0x15391b));}_0x4c6e48=new jsforce['Connection']({'oauth2':{'loginUrl':_0x42e31e,'clientId':_0x7e5ff9['clientId'],'clientSecret':_0x7e5ff9[_0x8367('0x5c')]}});return _0x4c6e48['login'](_0x7e5ff9[_0x8367('0x5d')],_0x7e5ff9[_0x8367('0x57')][_0x8367('0x5e')](_0x7e5ff9['securityToken']));}})[_0x8367('0x25')](function(_0x38839a){if(_0x38839a){if(!_[_0x8367('0x5f')](_0x5eba54[_0x8367('0x32')][_0x8367('0x60')])){_0x105d34=_0x5eba54[_0x8367('0x32')][_0x8367('0x60')];}return _0x4c6e48['sobject'](_0x105d34)[_0x8367('0x61')]();}})[_0x8367('0x25')](function(_0x3b599e){var _0x2ce76f=['OwnerId','ActivityDate',_0x8367('0x62'),_0x8367('0x63'),_0x8367('0x64'),'Description'];var _0x1c2de4=[_0x8367('0x65'),_0x8367('0x66'),_0x8367('0x67'),_0x8367('0x68'),'email','textarea',_0x8367('0x69')];if(_0x3b599e){_[_0x8367('0x6a')](_0x3b599e[_0x8367('0x44')],function(_0x4cf839){return _0x2ce76f[_0x8367('0x6b')](_0x4cf839[_0x8367('0x29')])||!_0x1c2de4[_0x8367('0x6b')](_0x4cf839[_0x8367('0x30')]);});return{'count':_0x3b599e[_0x8367('0x44')][_0x8367('0x35')],'rows':_[_0x8367('0x2c')](_0x3b599e['fields'],function(_0x4f34a8){return{'id':_0x4f34a8[_0x8367('0x29')],'name':_0x4f34a8['label'],'custom':_0x4f34a8[_0x8367('0x6c')],'options':_0x4f34a8[_0x8367('0x6d')][_0x8367('0x35')]>0x0?_['map'](_0x4f34a8['picklistValues'],function(_0x1903b6){return{'name':_0x1903b6[_0x8367('0x6e')],'value':_0x1903b6['value']};}):_0x4f34a8[_0x8367('0x30')]==_0x8367('0x68')?[{'name':_0x8367('0x6f'),'value':_0x8367('0x70')},{'name':_0x8367('0x71'),'value':_0x8367('0x72')}]:[]};})};}})['then'](respondWithResult(_0x35d1d8,null))[_0x8367('0x47')](function(_0x527747){var _0x379bde=_0x5eba54[_0x8367('0x32')][_0x8367('0x73')]?0x1f4:_0x527747[_0x8367('0x74')]||0x1f4;logger[_0x8367('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x8367('0x75'),_0x379bde,JSON[_0x8367('0x76')](_0x527747));delete _0x527747[_0x8367('0x29')];if(_0x379bde===0x191){_0x379bde=0x190;}_0x35d1d8[_0x8367('0x18')](_0x379bde)['send'](_0x5eba54['query']['test']?{'message':_0x8367('0x77'),'statusCode':_0x527747['statusCode']}:_0x527747);});}; \ No newline at end of file +var _0x5ea9=['sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','picklist','email','textarea','remove','includes','custom','picklistValues','label','value','boolean','False','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceAccount','includeAll','include','findAll','show','find','catch','create','body','params','getConfigurations','findOne','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','getFields','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','clientId','login','concat','isNil','ticketType'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5ea9,0x10f));var _0x95ea=function(_0x2c67af,_0x367db4){_0x2c67af=_0x2c67af-0x0;var _0x56bb38=_0x5ea9[_0x2c67af];return _0x56bb38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95ea('0x0'));var zipdir=require(_0x95ea('0x1'));var jsonpatch=require(_0x95ea('0x2'));var rp=require(_0x95ea('0x3'));var moment=require(_0x95ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x95ea('0x5'));var util=require(_0x95ea('0x6'));var path=require(_0x95ea('0x7'));var sox=require('sox');var csv=require(_0x95ea('0x8'));var ejs=require(_0x95ea('0x9'));var fs=require('fs');var fs_extra=require(_0x95ea('0xa'));var _=require(_0x95ea('0xb'));var squel=require(_0x95ea('0xc'));var crypto=require(_0x95ea('0xd'));var jsforce=require(_0x95ea('0xe'));var deskjs=require(_0x95ea('0xf'));var toCsv=require(_0x95ea('0x8'));var querystring=require(_0x95ea('0x10'));var Papa=require(_0x95ea('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x95ea('0x12'));var hardwareService=require(_0x95ea('0x13'));var logger=require(_0x95ea('0x14'))(_0x95ea('0x15'));var utils=require(_0x95ea('0x16'));var config=require(_0x95ea('0x17'));var licenseUtil=require(_0x95ea('0x18'));var db=require(_0x95ea('0x19'))['db'];var integrations=require(_0x95ea('0x1a'));function respondWithStatusCode(_0x3b85f9,_0x467f51){_0x467f51=_0x467f51||0xcc;return function(_0x4594e0){if(_0x4594e0){return _0x3b85f9[_0x95ea('0x1b')](_0x467f51);}return _0x3b85f9[_0x95ea('0x1c')](_0x467f51)[_0x95ea('0x1d')]();};}function respondWithResult(_0x1294cd,_0x2674a5){_0x2674a5=_0x2674a5||0xc8;return function(_0x117240){if(_0x117240){return _0x1294cd['status'](_0x2674a5)['json'](_0x117240);}};}function respondWithFilteredResult(_0x3b82cc,_0x52c5a8){return function(_0x29cca7){if(_0x29cca7){var _0x2fef97=typeof _0x52c5a8['offset']===_0x95ea('0x1e')&&typeof _0x52c5a8[_0x95ea('0x1f')]==='undefined';var _0x2ab498=_0x29cca7[_0x95ea('0x20')];var _0x3d1087=_0x2fef97?0x0:_0x52c5a8['offset'];var _0x2686bf=_0x2fef97?_0x29cca7[_0x95ea('0x20')]:_0x52c5a8['offset']+_0x52c5a8['limit'];var _0x385282;if(_0x2686bf>=_0x2ab498){_0x2686bf=_0x2ab498;_0x385282=0xc8;}else{_0x385282=0xce;}_0x3b82cc[_0x95ea('0x1c')](_0x385282);return _0x3b82cc[_0x95ea('0x21')](_0x95ea('0x22'),_0x3d1087+'-'+_0x2686bf+'/'+_0x2ab498)[_0x95ea('0x23')](_0x29cca7);}return null;};}function patchUpdates(_0x2fbca4){return function(_0x260b12){try{jsonpatch[_0x95ea('0x24')](_0x260b12,_0x2fbca4,!![]);}catch(_0x3b9985){return BPromise['reject'](_0x3b9985);}return _0x260b12['save']();};}function saveUpdates(_0x26c152,_0x346b0b){return function(_0x4023e9){if(_0x4023e9){return _0x4023e9[_0x95ea('0x25')](_0x26c152)[_0x95ea('0x26')](function(_0x38b304){return _0x38b304;});}return null;};}function removeEntity(_0x396314,_0x3b3db7){return function(_0x238a64){if(_0x238a64){return _0x238a64[_0x95ea('0x27')]()[_0x95ea('0x26')](function(){_0x396314['status'](0xcc)[_0x95ea('0x1d')]();});}};}function handleEntityNotFound(_0x515aed,_0x29ef0e){return function(_0x1e1cd5){if(!_0x1e1cd5){_0x515aed[_0x95ea('0x1b')](0x194);}return _0x1e1cd5;};}function handleError(_0x3ef26e,_0x2b15a3){_0x2b15a3=_0x2b15a3||0x1f4;return function(_0x46721e){logger[_0x95ea('0x28')](_0x46721e[_0x95ea('0x29')]);if(_0x46721e['name']){delete _0x46721e['name'];}_0x3ef26e[_0x95ea('0x1c')](_0x2b15a3)[_0x95ea('0x2a')](_0x46721e);};}exports[_0x95ea('0x2b')]=function(_0x6a6476,_0x551c61){var _0x4b14e0={},_0x4d9ad7={},_0x54dcf3={'count':0x0,'rows':[]};var _0x50fb88=_[_0x95ea('0x2c')](db['SalesforceAccount'][_0x95ea('0x2d')],function(_0x3b9034){return{'name':_0x3b9034[_0x95ea('0x2e')],'type':_0x3b9034[_0x95ea('0x2f')][_0x95ea('0x30')]};});_0x4d9ad7[_0x95ea('0x31')]=_['map'](_0x50fb88,_0x95ea('0x32'));_0x4d9ad7['query']=_[_0x95ea('0x33')](_0x6a6476['query']);_0x4d9ad7[_0x95ea('0x34')]=_[_0x95ea('0x35')](_0x4d9ad7['model'],_0x4d9ad7[_0x95ea('0x36')]);_0x4b14e0[_0x95ea('0x37')]=_[_0x95ea('0x35')](_0x4d9ad7[_0x95ea('0x31')],qs[_0x95ea('0x38')](_0x6a6476[_0x95ea('0x36')][_0x95ea('0x38')]));_0x4b14e0[_0x95ea('0x37')]=_0x4b14e0[_0x95ea('0x37')][_0x95ea('0x39')]?_0x4b14e0['attributes']:_0x4d9ad7[_0x95ea('0x31')];if(!_0x6a6476[_0x95ea('0x36')][_0x95ea('0x3a')](_0x95ea('0x3b'))){_0x4b14e0[_0x95ea('0x1f')]=qs['limit'](_0x6a6476['query']['limit']);_0x4b14e0[_0x95ea('0x3c')]=qs['offset'](_0x6a6476[_0x95ea('0x36')][_0x95ea('0x3c')]);}_0x4b14e0[_0x95ea('0x3d')]=qs['sort'](_0x6a6476[_0x95ea('0x36')][_0x95ea('0x3e')]);_0x4b14e0[_0x95ea('0x3f')]=qs['filters'](_[_0x95ea('0x40')](_0x6a6476[_0x95ea('0x36')],_0x4d9ad7['filters']),_0x50fb88);if(_0x6a6476[_0x95ea('0x36')]['filter']){_0x4b14e0[_0x95ea('0x3f')]=_[_0x95ea('0x41')](_0x4b14e0['where'],{'$or':_[_0x95ea('0x2c')](_0x50fb88,function(_0x4d4a23){if(_0x4d4a23['type']!==_0x95ea('0x42')){var _0x1e9840={};_0x1e9840[_0x4d4a23[_0x95ea('0x32')]]={'$like':'%'+_0x6a6476[_0x95ea('0x36')][_0x95ea('0x43')]+'%'};return _0x1e9840;}})});}_0x4b14e0=_[_0x95ea('0x41')]({},_0x4b14e0,_0x6a6476[_0x95ea('0x44')]);var _0x2fc2a9={'where':_0x4b14e0[_0x95ea('0x3f')]};return db[_0x95ea('0x45')][_0x95ea('0x20')](_0x2fc2a9)['then'](function(_0x14be4a){_0x54dcf3['count']=_0x14be4a;if(_0x6a6476[_0x95ea('0x36')][_0x95ea('0x46')]){_0x4b14e0[_0x95ea('0x47')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x95ea('0x48')](_0x4b14e0);})[_0x95ea('0x26')](function(_0x47b1ca){_0x54dcf3['rows']=_0x47b1ca;return _0x54dcf3;})[_0x95ea('0x26')](respondWithFilteredResult(_0x551c61,_0x4b14e0))['catch'](handleError(_0x551c61,null));};exports[_0x95ea('0x49')]=function(_0x4a419a,_0x3b7d02){var _0x2474d1={'raw':![],'where':{'id':_0x4a419a['params']['id']}},_0x26f41c={};_0x26f41c[_0x95ea('0x31')]=_['keys'](db[_0x95ea('0x45')][_0x95ea('0x2d')]);_0x26f41c[_0x95ea('0x36')]=_[_0x95ea('0x33')](_0x4a419a[_0x95ea('0x36')]);_0x26f41c[_0x95ea('0x34')]=_['intersection'](_0x26f41c[_0x95ea('0x31')],_0x26f41c[_0x95ea('0x36')]);_0x2474d1[_0x95ea('0x37')]=_[_0x95ea('0x35')](_0x26f41c['model'],qs[_0x95ea('0x38')](_0x4a419a[_0x95ea('0x36')][_0x95ea('0x38')]));_0x2474d1[_0x95ea('0x37')]=_0x2474d1[_0x95ea('0x37')][_0x95ea('0x39')]?_0x2474d1['attributes']:_0x26f41c[_0x95ea('0x31')];if(_0x4a419a[_0x95ea('0x36')]['includeAll']){_0x2474d1['include']=[{'all':!![]}];}_0x2474d1=_[_0x95ea('0x41')]({},_0x2474d1,_0x4a419a[_0x95ea('0x44')]);return db['SalesforceAccount'][_0x95ea('0x4a')](_0x2474d1)[_0x95ea('0x26')](handleEntityNotFound(_0x3b7d02,null))[_0x95ea('0x26')](respondWithResult(_0x3b7d02,null))[_0x95ea('0x4b')](handleError(_0x3b7d02,null));};exports[_0x95ea('0x4c')]=function(_0x25ee0c,_0x655889){return db[_0x95ea('0x45')][_0x95ea('0x4c')](_0x25ee0c[_0x95ea('0x4d')],{})[_0x95ea('0x26')](respondWithResult(_0x655889,0xc9))[_0x95ea('0x4b')](handleError(_0x655889,null));};exports[_0x95ea('0x25')]=function(_0x3e8be7,_0x3895fe){if(_0x3e8be7[_0x95ea('0x4d')]['id']){delete _0x3e8be7['body']['id'];}return db[_0x95ea('0x45')][_0x95ea('0x4a')]({'where':{'id':_0x3e8be7[_0x95ea('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3895fe,null))[_0x95ea('0x26')](saveUpdates(_0x3e8be7['body'],null))[_0x95ea('0x26')](respondWithResult(_0x3895fe,null))[_0x95ea('0x4b')](handleError(_0x3895fe,null));};exports[_0x95ea('0x27')]=function(_0x19197f,_0x101020){return db[_0x95ea('0x45')][_0x95ea('0x4a')]({'where':{'id':_0x19197f[_0x95ea('0x4e')]['id']}})[_0x95ea('0x26')](handleEntityNotFound(_0x101020,null))[_0x95ea('0x26')](removeEntity(_0x101020,null))[_0x95ea('0x4b')](handleError(_0x101020,null));};exports[_0x95ea('0x4f')]=function(_0x4f495e,_0x9da0fd,_0x92f834){var _0x3c9aa2={};var _0x486766={};var _0x4163ae;var _0x53cde9;return db['SalesforceAccount'][_0x95ea('0x50')]({'where':{'id':_0x4f495e[_0x95ea('0x4e')]['id']}})[_0x95ea('0x26')](handleEntityNotFound(_0x9da0fd,null))[_0x95ea('0x26')](function(_0x1c9bc6){if(_0x1c9bc6){_0x4163ae=_0x1c9bc6;_0x486766[_0x95ea('0x31')]=_[_0x95ea('0x33')](db['SalesforceConfiguration'][_0x95ea('0x2d')]);_0x486766[_0x95ea('0x36')]=_[_0x95ea('0x33')](_0x4f495e[_0x95ea('0x36')]);_0x486766[_0x95ea('0x34')]=_[_0x95ea('0x35')](_0x486766['model'],_0x486766[_0x95ea('0x36')]);_0x3c9aa2[_0x95ea('0x37')]=_['intersection'](_0x486766[_0x95ea('0x31')],qs['fields'](_0x4f495e[_0x95ea('0x36')][_0x95ea('0x38')]));_0x3c9aa2['attributes']=_0x3c9aa2[_0x95ea('0x37')]['length']?_0x3c9aa2[_0x95ea('0x37')]:_0x486766[_0x95ea('0x31')];_0x3c9aa2[_0x95ea('0x3d')]=qs[_0x95ea('0x3e')](_0x4f495e[_0x95ea('0x36')]['sort']);_0x3c9aa2[_0x95ea('0x3f')]=qs['filters'](_['pick'](_0x4f495e[_0x95ea('0x36')],_0x486766[_0x95ea('0x34')]));if(_0x4f495e['query'][_0x95ea('0x43')]){_0x3c9aa2['where']=_[_0x95ea('0x41')](_0x3c9aa2['where'],{'$or':_[_0x95ea('0x2c')](_0x3c9aa2[_0x95ea('0x37')],function(_0x5041a2){var _0x1440f3={};_0x1440f3[_0x5041a2]={'$like':'%'+_0x4f495e[_0x95ea('0x36')][_0x95ea('0x43')]+'%'};return _0x1440f3;})});}_0x3c9aa2=_[_0x95ea('0x41')]({},_0x3c9aa2,_0x4f495e[_0x95ea('0x44')]);return _0x4163ae['getConfigurations'](_0x3c9aa2);}})[_0x95ea('0x26')](function(_0xdd1a3b){if(_0xdd1a3b){_0x53cde9=_0xdd1a3b['length'];if(!_0x4f495e[_0x95ea('0x36')][_0x95ea('0x3a')](_0x95ea('0x3b'))){_0x3c9aa2[_0x95ea('0x1f')]=qs[_0x95ea('0x1f')](_0x4f495e[_0x95ea('0x36')]['limit']);_0x3c9aa2[_0x95ea('0x3c')]=qs[_0x95ea('0x3c')](_0x4f495e[_0x95ea('0x36')]['offset']);}return _0x4163ae['getConfigurations'](_0x3c9aa2);}})[_0x95ea('0x26')](function(_0x29817a){if(_0x29817a){return _0x29817a?{'count':_0x53cde9,'rows':_0x29817a}:null;}})[_0x95ea('0x26')](respondWithResult(_0x9da0fd,null))[_0x95ea('0x4b')](handleError(_0x9da0fd,null));};exports['addConfiguration']=function(_0x596e6c,_0xebfa15,_0x33b5ee){if(_0x596e6c[_0x95ea('0x4d')]['id']){delete _0x596e6c['body']['id'];}return db[_0x95ea('0x45')]['findOne']({'where':{'id':_0x596e6c['params']['id']}})[_0x95ea('0x26')](handleEntityNotFound(_0xebfa15,null))[_0x95ea('0x26')](function(_0x1a98d4){if(_0x1a98d4){_0x596e6c['body']['AccountId']=_0x1a98d4['id'];_0x596e6c[_0x95ea('0x4d')][_0x95ea('0x51')]=integrations[_0x95ea('0x52')](_0x596e6c['body'][_0x95ea('0x53')],_0x596e6c[_0x95ea('0x4d')][_0x95ea('0x2f')]);_0x596e6c['body'][_0x95ea('0x54')]=integrations['getDescriptions'](_0x596e6c[_0x95ea('0x4d')]['channel'],_0x596e6c['body'][_0x95ea('0x2f')]);return db[_0x95ea('0x55')][_0x95ea('0x4c')](_0x596e6c['body'],{'include':[{'model':db[_0x95ea('0x56')],'as':'Subjects'},{'model':db[_0x95ea('0x56')],'as':_0x95ea('0x54')}]});}return null;})[_0x95ea('0x26')](respondWithResult(_0xebfa15,null))['catch'](handleError(_0xebfa15,null));};exports[_0x95ea('0x57')]=function(_0xb9a951,_0x1ce51b,_0x5d5f68){var _0x2bb8f8;var _0x43dd5c='';var _0x527ecd='Task';return db[_0x95ea('0x45')][_0x95ea('0x50')]({'where':{'id':_0xb9a951[_0x95ea('0x4e')]['id']},'attributes':['id',_0x95ea('0x58'),'clientId',_0x95ea('0x59'),_0x95ea('0x5a'),_0x95ea('0x5b'),_0x95ea('0x5c')]})[_0x95ea('0x26')](handleEntityNotFound(_0x1ce51b,null))[_0x95ea('0x26')](function(_0x4bbfc1){if(_0x4bbfc1){_0x43dd5c=_0x4bbfc1['remoteUri'];var _0x21d667=_0x43dd5c[_0x95ea('0x5d')](-0x1);if(_0x21d667==='/'){_0x43dd5c=_0x43dd5c[_0x95ea('0x5e')](0x0,_0x43dd5c[_0x95ea('0x5f')](_0x21d667));}_0x2bb8f8=new jsforce['Connection']({'oauth2':{'loginUrl':_0x43dd5c,'clientId':_0x4bbfc1[_0x95ea('0x60')],'clientSecret':_0x4bbfc1['clientSecret']}});return _0x2bb8f8[_0x95ea('0x61')](_0x4bbfc1[_0x95ea('0x5a')],_0x4bbfc1[_0x95ea('0x5b')][_0x95ea('0x62')](_0x4bbfc1[_0x95ea('0x5c')]));}})[_0x95ea('0x26')](function(_0x15fd3d){if(_0x15fd3d){if(!_[_0x95ea('0x63')](_0xb9a951[_0x95ea('0x36')][_0x95ea('0x64')])){_0x527ecd=_0xb9a951[_0x95ea('0x36')][_0x95ea('0x64')];}return _0x2bb8f8[_0x95ea('0x65')](_0x527ecd)[_0x95ea('0x66')]();}})[_0x95ea('0x26')](function(_0x5bf8c9){var _0x3fb680=[_0x95ea('0x67'),_0x95ea('0x68'),_0x95ea('0x69'),_0x95ea('0x6a'),'Subject',_0x95ea('0x6b')];var _0x32476d=[_0x95ea('0x6c'),'int',_0x95ea('0x6d'),'boolean',_0x95ea('0x6e'),_0x95ea('0x6f'),'phone'];if(_0x5bf8c9){_[_0x95ea('0x70')](_0x5bf8c9[_0x95ea('0x38')],function(_0x5d751b){return _0x3fb680[_0x95ea('0x71')](_0x5d751b[_0x95ea('0x32')])||!_0x32476d[_0x95ea('0x71')](_0x5d751b[_0x95ea('0x2f')]);});return{'count':_0x5bf8c9['fields'][_0x95ea('0x39')],'rows':_[_0x95ea('0x2c')](_0x5bf8c9['fields'],function(_0x3b0363){return{'id':_0x3b0363[_0x95ea('0x32')],'name':_0x3b0363['label'],'custom':_0x3b0363[_0x95ea('0x72')],'options':_0x3b0363[_0x95ea('0x73')][_0x95ea('0x39')]>0x0?_[_0x95ea('0x2c')](_0x3b0363[_0x95ea('0x73')],function(_0x22c970){return{'name':_0x22c970[_0x95ea('0x74')],'value':_0x22c970[_0x95ea('0x75')]};}):_0x3b0363[_0x95ea('0x2f')]==_0x95ea('0x76')?[{'name':'True','value':'true'},{'name':_0x95ea('0x77'),'value':'false'}]:[]};})};}})[_0x95ea('0x26')](respondWithResult(_0x1ce51b,null))[_0x95ea('0x4b')](function(_0x410790){var _0x9acea5=_0xb9a951['query'][_0x95ea('0x78')]?0x1f4:_0x410790[_0x95ea('0x79')]||0x1f4;logger[_0x95ea('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x95ea('0x57'),_0x9acea5,JSON[_0x95ea('0x7a')](_0x410790));delete _0x410790[_0x95ea('0x32')];if(_0x9acea5===0x191){_0x9acea5=0x190;}_0x1ce51b[_0x95ea('0x1c')](_0x9acea5)[_0x95ea('0x2a')](_0xb9a951[_0x95ea('0x36')][_0x95ea('0x78')]?{'message':_0x95ea('0x7b'),'statusCode':_0x410790[_0x95ea('0x79')]}:_0x410790);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 12a1295..8fc6442 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 _0x65b9=['lodash','api','bluebird','request-promise','path','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x49225d,_0x312d6c){var _0x2c228f=function(_0x183ff5){while(--_0x183ff5){_0x49225d['push'](_0x49225d['shift']());}};_0x2c228f(++_0x312d6c);}(_0x65b9,0x154));var _0x965b=function(_0xb24891,_0x55548f){_0xb24891=_0xb24891-0x0;var _0x4f1728=_0x65b9[_0xb24891];return _0x4f1728;};'use strict';var _=require(_0x965b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x965b('0x1'));var moment=require('moment');var BPromise=require(_0x965b('0x2'));var rp=require(_0x965b('0x3'));var fs=require('fs');var path=require(_0x965b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x965b('0x5'));var integrations=require(_0x965b('0x6'));module['exports']=function(_0x5015a3,_0x30ea04){return _0x5015a3[_0x965b('0x7')](_0x965b('0x8'),attributes,{'tableName':_0x965b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99b7=['../../components/integrations/configuration','exports','define','int_salesforce_accounts','lodash','../../config/logger','request-promise','path','rimraf','./intSalesforceAccount.attributes'];(function(_0x57588e,_0x26b5fd){var _0x43f551=function(_0x136be9){while(--_0x136be9){_0x57588e['push'](_0x57588e['shift']());}};_0x43f551(++_0x26b5fd);}(_0x99b7,0x14e));var _0x799b=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x99b7[_0x5eb22e];return _0x27fed5;};'use strict';var _=require(_0x799b('0x0'));var util=require('util');var logger=require(_0x799b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x799b('0x2'));var fs=require('fs');var path=require(_0x799b('0x3'));var rimraf=require(_0x799b('0x4'));var config=require('../../config/environment');var attributes=require(_0x799b('0x5'));var integrations=require(_0x799b('0x6'));module[_0x799b('0x7')]=function(_0x70f082,_0xfd685a){return _0x70f082[_0x799b('0x8')]('SalesforceAccount',attributes,{'tableName':_0x799b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 82d05b8..aadd3c4 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 _0x801e=['GetSalesforceAccount','findAll','options','raw','where','include','model','attributes','map','then','debug','catch','ShowSalesforceAccount','find','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','result'];(function(_0x25111,_0x5e5a11){var _0x8db6e2=function(_0x43f953){while(--_0x43f953){_0x25111['push'](_0x25111['shift']());}};_0x8db6e2(++_0x5e5a11);}(_0x801e,0x141));var _0xe801=function(_0x4bdf9e,_0x6bdf0f){_0x4bdf9e=_0x4bdf9e-0x0;var _0x56063d=_0x801e[_0x4bdf9e];return _0x56063d;};'use strict';var _=require(_0xe801('0x0'));var util=require(_0xe801('0x1'));var moment=require(_0xe801('0x2'));var BPromise=require('bluebird');var rs=require(_0xe801('0x3'));var fs=require('fs');var Redis=require(_0xe801('0x4'));var db=require(_0xe801('0x5'))['db'];var utils=require(_0xe801('0x6'));var logger=require(_0xe801('0x7'))('rpc');var config=require(_0xe801('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe801('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10fa13,_0x2ccf91,_0x346d6e){return new BPromise(function(_0x1b227b,_0x51c308){return client[_0xe801('0xa')](_0x10fa13,_0x346d6e)['then'](function(_0x5c8843){logger[_0xe801('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x2ccf91,_0xe801('0xc'));logger['debug'](_0xe801('0xd'),_0x2ccf91,_0xe801('0xc'),JSON[_0xe801('0xe')](_0x5c8843));if(_0x5c8843['error']){if(_0x5c8843[_0xe801('0xf')][_0xe801('0x10')]===0x1f4){logger[_0xe801('0xf')](_0xe801('0x11'),_0x2ccf91,_0x5c8843['error']['message']);return _0x51c308(_0x5c8843[_0xe801('0xf')]['message']);}logger[_0xe801('0xf')](_0xe801('0x11'),_0x2ccf91,_0x5c8843[_0xe801('0xf')]['message']);return _0x1b227b(_0x5c8843[_0xe801('0xf')]['message']);}else{logger[_0xe801('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x2ccf91,_0xe801('0xc'));_0x1b227b(_0x5c8843[_0xe801('0x12')]['message']);}})['catch'](function(_0x28b0c3){logger[_0xe801('0xf')](_0xe801('0x11'),_0x2ccf91,_0x28b0c3);_0x51c308(_0x28b0c3);});});}exports[_0xe801('0x13')]=function(_0x2e0289){var _0x5ad592=this;return new Promise(function(_0x40184d,_0x3427eb){return db['SalesforceAccount'][_0xe801('0x14')]({'raw':_0x2e0289[_0xe801('0x15')]?_0x2e0289[_0xe801('0x15')][_0xe801('0x16')]===undefined?!![]:![]:!![],'where':_0x2e0289[_0xe801('0x15')]?_0x2e0289[_0xe801('0x15')][_0xe801('0x17')]||null:null,'attributes':_0x2e0289[_0xe801('0x15')]?_0x2e0289[_0xe801('0x15')]['attributes']||null:null,'limit':_0x2e0289[_0xe801('0x15')]?_0x2e0289['options']['limit']||null:null,'include':_0x2e0289[_0xe801('0x15')]?_0x2e0289['options'][_0xe801('0x18')]?_['map'](_0x2e0289['options'][_0xe801('0x18')],function(_0x197659){return{'model':db[_0x197659[_0xe801('0x19')]],'as':_0x197659['as'],'attributes':_0x197659[_0xe801('0x1a')],'include':_0x197659[_0xe801('0x18')]?_['map'](_0x197659[_0xe801('0x18')],function(_0x4e7feb){return{'model':db[_0x4e7feb[_0xe801('0x19')]],'as':_0x4e7feb['as'],'attributes':_0x4e7feb[_0xe801('0x1a')],'include':_0x4e7feb['include']?_[_0xe801('0x1b')](_0x4e7feb[_0xe801('0x18')],function(_0x3b012f){return{'model':db[_0x3b012f[_0xe801('0x19')]],'as':_0x3b012f['as'],'attributes':_0x3b012f[_0xe801('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe801('0x1c')](function(_0xbea984){logger[_0xe801('0xb')](_0xe801('0x13'),_0x2e0289);logger[_0xe801('0x1d')](_0xe801('0x13'),_0x2e0289,JSON[_0xe801('0xe')](_0xbea984));_0x40184d(_0xbea984);})[_0xe801('0x1e')](function(_0x46c071){logger[_0xe801('0xf')]('GetSalesforceAccount',_0x46c071['message'],_0x2e0289);_0x3427eb(_0x5ad592[_0xe801('0xf')](0x1f4,_0x46c071['message']));});});};exports[_0xe801('0x1f')]=function(_0xbda413){var _0x2384bd=this;return new Promise(function(_0x4c8ebf,_0xef5017){return db['SalesforceAccount'][_0xe801('0x20')]({'raw':_0xbda413['options']?_0xbda413[_0xe801('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xbda413[_0xe801('0x15')]?_0xbda413['options'][_0xe801('0x17')]||null:null,'attributes':_0xbda413['options']?_0xbda413[_0xe801('0x15')][_0xe801('0x1a')]||null:null,'include':_0xbda413[_0xe801('0x15')]?_0xbda413['options'][_0xe801('0x18')]?_['map'](_0xbda413[_0xe801('0x15')][_0xe801('0x18')],function(_0x3228c6){return{'model':db[_0x3228c6[_0xe801('0x19')]],'as':_0x3228c6['as'],'attributes':_0x3228c6[_0xe801('0x1a')],'include':_0x3228c6[_0xe801('0x18')]?_[_0xe801('0x1b')](_0x3228c6[_0xe801('0x18')],function(_0x393b1c){return{'model':db[_0x393b1c[_0xe801('0x19')]],'as':_0x393b1c['as'],'attributes':_0x393b1c[_0xe801('0x1a')],'include':_0x393b1c['include']?_[_0xe801('0x1b')](_0x393b1c[_0xe801('0x18')],function(_0x1e57ba){return{'model':db[_0x1e57ba[_0xe801('0x19')]],'as':_0x1e57ba['as'],'attributes':_0x1e57ba[_0xe801('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe801('0x1c')](function(_0x3507f9){logger['info']('ShowSalesforceAccount',_0xbda413);logger[_0xe801('0x1d')](_0xe801('0x1f'),_0xbda413,JSON[_0xe801('0xe')](_0x3507f9));_0x4c8ebf(_0x3507f9);})[_0xe801('0x1e')](function(_0x328453){logger[_0xe801('0xf')]('ShowSalesforceAccount',_0x328453['message'],_0xbda413);_0xef5017(_0x2384bd[_0xe801('0xf')](0x1f4,_0x328453[_0xe801('0x21')]));});});}; \ No newline at end of file +var _0x6564=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','SalesforceAccount,\x20%s,\x20%s','message','catch','SalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','GetSalesforceAccount','debug','ShowSalesforceAccount','lodash','util','moment'];(function(_0x4435c2,_0x3c12f2){var _0x160402=function(_0x45e34b){while(--_0x45e34b){_0x4435c2['push'](_0x4435c2['shift']());}};_0x160402(++_0x3c12f2);}(_0x6564,0x17d));var _0x4656=function(_0x4ae8a4,_0xa28ab7){_0x4ae8a4=_0x4ae8a4-0x0;var _0x198937=_0x6564[_0x4ae8a4];return _0x198937;};'use strict';var _=require(_0x4656('0x0'));var util=require(_0x4656('0x1'));var moment=require(_0x4656('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4656('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4656('0x4'));var logger=require(_0x4656('0x5'))('rpc');var config=require(_0x4656('0x6'));var jayson=require(_0x4656('0x7'));var client=jayson[_0x4656('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x550286,_0x661e18,_0x32c900){return new BPromise(function(_0x1c24d4,_0x55de2c){return client['request'](_0x550286,_0x32c900)['then'](function(_0x2a490f){logger[_0x4656('0x9')]('SalesforceAccount,\x20%s,\x20%s',_0x661e18,'request\x20sent');logger['debug'](_0x4656('0xa'),_0x661e18,_0x4656('0xb'),JSON[_0x4656('0xc')](_0x2a490f));if(_0x2a490f['error']){if(_0x2a490f['error'][_0x4656('0xd')]===0x1f4){logger[_0x4656('0xe')](_0x4656('0xf'),_0x661e18,_0x2a490f[_0x4656('0xe')][_0x4656('0x10')]);return _0x55de2c(_0x2a490f['error'][_0x4656('0x10')]);}logger[_0x4656('0xe')](_0x4656('0xf'),_0x661e18,_0x2a490f[_0x4656('0xe')][_0x4656('0x10')]);return _0x1c24d4(_0x2a490f[_0x4656('0xe')][_0x4656('0x10')]);}else{logger['info'](_0x4656('0xf'),_0x661e18,_0x4656('0xb'));_0x1c24d4(_0x2a490f['result']['message']);}})[_0x4656('0x11')](function(_0x5b4d9c){logger[_0x4656('0xe')](_0x4656('0xf'),_0x661e18,_0x5b4d9c);_0x55de2c(_0x5b4d9c);});});}exports['GetSalesforceAccount']=function(_0x5423e5){var _0xeaf61f=this;return new Promise(function(_0x55febb,_0x39080f){return db[_0x4656('0x12')][_0x4656('0x13')]({'raw':_0x5423e5[_0x4656('0x14')]?_0x5423e5['options'][_0x4656('0x15')]===undefined?!![]:![]:!![],'where':_0x5423e5['options']?_0x5423e5[_0x4656('0x14')][_0x4656('0x16')]||null:null,'attributes':_0x5423e5[_0x4656('0x14')]?_0x5423e5['options']['attributes']||null:null,'limit':_0x5423e5['options']?_0x5423e5['options'][_0x4656('0x17')]||null:null,'include':_0x5423e5['options']?_0x5423e5[_0x4656('0x14')][_0x4656('0x18')]?_[_0x4656('0x19')](_0x5423e5[_0x4656('0x14')][_0x4656('0x18')],function(_0x287d57){return{'model':db[_0x287d57[_0x4656('0x1a')]],'as':_0x287d57['as'],'attributes':_0x287d57[_0x4656('0x1b')],'include':_0x287d57[_0x4656('0x18')]?_[_0x4656('0x19')](_0x287d57[_0x4656('0x18')],function(_0x5a6dc2){return{'model':db[_0x5a6dc2[_0x4656('0x1a')]],'as':_0x5a6dc2['as'],'attributes':_0x5a6dc2[_0x4656('0x1b')],'include':_0x5a6dc2[_0x4656('0x18')]?_[_0x4656('0x19')](_0x5a6dc2[_0x4656('0x18')],function(_0x265121){return{'model':db[_0x265121[_0x4656('0x1a')]],'as':_0x265121['as'],'attributes':_0x265121[_0x4656('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4656('0x1c')](function(_0x3d7799){logger[_0x4656('0x9')](_0x4656('0x1d'),_0x5423e5);logger[_0x4656('0x1e')](_0x4656('0x1d'),_0x5423e5,JSON[_0x4656('0xc')](_0x3d7799));_0x55febb(_0x3d7799);})[_0x4656('0x11')](function(_0x1281b5){logger[_0x4656('0xe')](_0x4656('0x1d'),_0x1281b5[_0x4656('0x10')],_0x5423e5);_0x39080f(_0xeaf61f['error'](0x1f4,_0x1281b5[_0x4656('0x10')]));});});};exports[_0x4656('0x1f')]=function(_0x4ae1c9){var _0x1e38a8=this;return new Promise(function(_0x27f581,_0x3fea7d){return db[_0x4656('0x12')]['find']({'raw':_0x4ae1c9[_0x4656('0x14')]?_0x4ae1c9[_0x4656('0x14')][_0x4656('0x15')]===undefined?!![]:![]:!![],'where':_0x4ae1c9[_0x4656('0x14')]?_0x4ae1c9[_0x4656('0x14')]['where']||null:null,'attributes':_0x4ae1c9['options']?_0x4ae1c9[_0x4656('0x14')]['attributes']||null:null,'include':_0x4ae1c9[_0x4656('0x14')]?_0x4ae1c9['options']['include']?_[_0x4656('0x19')](_0x4ae1c9[_0x4656('0x14')][_0x4656('0x18')],function(_0x15cd1c){return{'model':db[_0x15cd1c[_0x4656('0x1a')]],'as':_0x15cd1c['as'],'attributes':_0x15cd1c[_0x4656('0x1b')],'include':_0x15cd1c[_0x4656('0x18')]?_[_0x4656('0x19')](_0x15cd1c['include'],function(_0x277f19){return{'model':db[_0x277f19[_0x4656('0x1a')]],'as':_0x277f19['as'],'attributes':_0x277f19[_0x4656('0x1b')],'include':_0x277f19[_0x4656('0x18')]?_[_0x4656('0x19')](_0x277f19[_0x4656('0x18')],function(_0x101f93){return{'model':db[_0x101f93[_0x4656('0x1a')]],'as':_0x101f93['as'],'attributes':_0x101f93[_0x4656('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4656('0x1c')](function(_0x38bb47){logger[_0x4656('0x9')](_0x4656('0x1f'),_0x4ae1c9);logger['debug']('ShowSalesforceAccount',_0x4ae1c9,JSON[_0x4656('0xc')](_0x38bb47));_0x27f581(_0x38bb47);})['catch'](function(_0x672728){logger['error']('ShowSalesforceAccount',_0x672728[_0x4656('0x10')],_0x4ae1c9);_0x3fea7d(_0x1e38a8[_0x4656('0xe')](0x1f4,_0x672728['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 585eaca..454c111 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x4d21ab,_0x20babd){var _0xf83890=function(_0x445097){while(--_0x445097){_0x4d21ab['push'](_0x4d21ab['shift']());}};_0xf83890(++_0x20babd);}(_0xadb5,0xad));var _0x5adb=function(_0x97d0dc,_0x284cba){_0x97d0dc=_0x97d0dc-0x0;var _0x57fb01=_0xadb5[_0x97d0dc];return _0x57fb01;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x1f6de8,_0xc1a536){var _0x5bc3c2=function(_0x23edc7){while(--_0x23edc7){_0x1f6de8['push'](_0x1f6de8['shift']());}};_0x5bc3c2(++_0xc1a536);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 14aa187..68c50ac 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 _0x7dec=['contact_lead','nothing','contact','account','exports','STRING','ENUM','Task','lead','account_contact_lead'];(function(_0x1b653d,_0x5cce6e){var _0x5429e7=function(_0x412a6a){while(--_0x412a6a){_0x1b653d['push'](_0x1b653d['shift']());}};_0x5429e7(++_0x5cce6e);}(_0x7dec,0xfe));var _0xc7de=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x7dec[_0x4fbb15];return _0x436338;};'use strict';var Sequelize=require('sequelize');module[_0xc7de('0x0')]={'name':{'type':Sequelize[_0xc7de('0x1')]},'description':{'type':Sequelize[_0xc7de('0x1')]},'ticketType':{'type':Sequelize[_0xc7de('0x2')]('Task','Case'),'defaultValue':_0xc7de('0x3')},'moduleSearch':{'type':Sequelize[_0xc7de('0x2')]('contact_lead','contact',_0xc7de('0x4'),_0xc7de('0x5'),'account'),'defaultValue':_0xc7de('0x6')},'moduleCreate':{'type':Sequelize[_0xc7de('0x2')](_0xc7de('0x7'),_0xc7de('0x8'),'lead',_0xc7de('0x9')),'defaultValue':_0xc7de('0x4')},'leadId':{'type':Sequelize[_0xc7de('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xc7de('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xc7de('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xc7de('0x1')]}}; \ No newline at end of file +var _0x473a=['STRING','ENUM','Task','Case','contact_lead','contact','account_contact_lead','account','nothing','lead','sequelize'];(function(_0x2d4133,_0x4d93f5){var _0x534d58=function(_0x481dd1){while(--_0x481dd1){_0x2d4133['push'](_0x2d4133['shift']());}};_0x534d58(++_0x4d93f5);}(_0x473a,0x1cd));var _0xa473=function(_0x2a7d15,_0x285bf4){_0x2a7d15=_0x2a7d15-0x0;var _0x56b410=_0x473a[_0x2a7d15];return _0x56b410;};'use strict';var Sequelize=require(_0xa473('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa473('0x1')]},'ticketType':{'type':Sequelize[_0xa473('0x2')](_0xa473('0x3'),_0xa473('0x4')),'defaultValue':_0xa473('0x3')},'moduleSearch':{'type':Sequelize[_0xa473('0x2')](_0xa473('0x5'),_0xa473('0x6'),'lead',_0xa473('0x7'),_0xa473('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xa473('0x2')](_0xa473('0x9'),_0xa473('0x6'),_0xa473('0xa'),_0xa473('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa473('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xa473('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xa473('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index dc6b5b4..98429bd 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 _0x46cf=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','error','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x1e126c,_0x3baf09){var _0x5110c4=function(_0x802d2e){while(--_0x802d2e){_0x1e126c['push'](_0x1e126c['shift']());}};_0x5110c4(++_0x3baf09);}(_0x46cf,0x17e));var _0xf46c=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x46cf[_0x58e469];return _0x4c01c5;};'use strict';var emlformat=require(_0xf46c('0x0'));var rimraf=require(_0xf46c('0x1'));var zipdir=require(_0xf46c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf46c('0x3'));var moment=require(_0xf46c('0x4'));var BPromise=require(_0xf46c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf46c('0x6'));var csv=require(_0xf46c('0x7'));var ejs=require(_0xf46c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf46c('0x9'));var squel=require(_0xf46c('0xa'));var crypto=require(_0xf46c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf46c('0xc'));var toCsv=require(_0xf46c('0x7'));var querystring=require(_0xf46c('0xd'));var Papa=require(_0xf46c('0xe'));var Redis=require('ioredis');var authService=require(_0xf46c('0xf'));var qs=require(_0xf46c('0x10'));var as=require(_0xf46c('0x11'));var hardwareService=require(_0xf46c('0x12'));var logger=require(_0xf46c('0x13'))(_0xf46c('0x14'));var utils=require('../../config/utils');var config=require(_0xf46c('0x15'));var licenseUtil=require(_0xf46c('0x16'));var db=require(_0xf46c('0x17'))['db'];function respondWithStatusCode(_0x43a39f,_0x5e27d2){_0x5e27d2=_0x5e27d2||0xcc;return function(_0x461c18){if(_0x461c18){return _0x43a39f[_0xf46c('0x18')](_0x5e27d2);}return _0x43a39f[_0xf46c('0x19')](_0x5e27d2)[_0xf46c('0x1a')]();};}function respondWithResult(_0x1dc56d,_0x1e8db0){_0x1e8db0=_0x1e8db0||0xc8;return function(_0x9a361c){if(_0x9a361c){return _0x1dc56d[_0xf46c('0x19')](_0x1e8db0)['json'](_0x9a361c);}};}function respondWithFilteredResult(_0x270c37,_0x28065f){return function(_0x3d2796){if(_0x3d2796){var _0x47a0ad=typeof _0x28065f['offset']===_0xf46c('0x1b')&&typeof _0x28065f[_0xf46c('0x1c')]==='undefined';var _0x255b03=_0x3d2796[_0xf46c('0x1d')];var _0xe2ddc3=_0x47a0ad?0x0:_0x28065f[_0xf46c('0x1e')];var _0x370f38=_0x47a0ad?_0x3d2796['count']:_0x28065f[_0xf46c('0x1e')]+_0x28065f[_0xf46c('0x1c')];var _0xedeb76;if(_0x370f38>=_0x255b03){_0x370f38=_0x255b03;_0xedeb76=0xc8;}else{_0xedeb76=0xce;}_0x270c37['status'](_0xedeb76);return _0x270c37['set'](_0xf46c('0x1f'),_0xe2ddc3+'-'+_0x370f38+'/'+_0x255b03)[_0xf46c('0x20')](_0x3d2796);}return null;};}function patchUpdates(_0x3a6bf4){return function(_0x1419d4){try{jsonpatch[_0xf46c('0x21')](_0x1419d4,_0x3a6bf4,!![]);}catch(_0x203474){return BPromise[_0xf46c('0x22')](_0x203474);}return _0x1419d4[_0xf46c('0x23')]();};}function saveUpdates(_0x48cf3c,_0x188feb){return function(_0x20bcca){if(_0x20bcca){return _0x20bcca[_0xf46c('0x24')](_0x48cf3c)[_0xf46c('0x25')](function(_0x32625a){return _0x32625a;});}return null;};}function removeEntity(_0x33d8b8,_0x7d8cd5){return function(_0x541a71){if(_0x541a71){return _0x541a71['destroy']()['then'](function(){_0x33d8b8['status'](0xcc)[_0xf46c('0x1a')]();});}};}function handleEntityNotFound(_0x3cc42e,_0x574f61){return function(_0x5961d8){if(!_0x5961d8){_0x3cc42e['sendStatus'](0x194);}return _0x5961d8;};}function handleError(_0x15b799,_0x39b32c){_0x39b32c=_0x39b32c||0x1f4;return function(_0x32b1c1){logger[_0xf46c('0x26')](_0x32b1c1['stack']);if(_0x32b1c1['name']){delete _0x32b1c1['name'];}_0x15b799[_0xf46c('0x19')](_0x39b32c)[_0xf46c('0x27')](_0x32b1c1);};}exports['index']=function(_0x34cf2,_0x5ef577){var _0x639ee4={},_0x25be8d={},_0x2abfe3={'count':0x0,'rows':[]};var _0x1dc3db=_[_0xf46c('0x28')](db[_0xf46c('0x29')][_0xf46c('0x2a')],function(_0x523ac1){return{'name':_0x523ac1[_0xf46c('0x2b')],'type':_0x523ac1[_0xf46c('0x2c')][_0xf46c('0x2d')]};});_0x25be8d[_0xf46c('0x2e')]=_[_0xf46c('0x28')](_0x1dc3db,_0xf46c('0x2f'));_0x25be8d['query']=_[_0xf46c('0x30')](_0x34cf2[_0xf46c('0x31')]);_0x25be8d[_0xf46c('0x32')]=_[_0xf46c('0x33')](_0x25be8d['model'],_0x25be8d['query']);_0x639ee4['attributes']=_['intersection'](_0x25be8d[_0xf46c('0x2e')],qs['fields'](_0x34cf2['query'][_0xf46c('0x34')]));_0x639ee4[_0xf46c('0x35')]=_0x639ee4[_0xf46c('0x35')][_0xf46c('0x36')]?_0x639ee4[_0xf46c('0x35')]:_0x25be8d[_0xf46c('0x2e')];if(!_0x34cf2[_0xf46c('0x31')][_0xf46c('0x37')](_0xf46c('0x38'))){_0x639ee4[_0xf46c('0x1c')]=qs[_0xf46c('0x1c')](_0x34cf2[_0xf46c('0x31')]['limit']);_0x639ee4[_0xf46c('0x1e')]=qs['offset'](_0x34cf2['query'][_0xf46c('0x1e')]);}_0x639ee4[_0xf46c('0x39')]=qs['sort'](_0x34cf2['query'][_0xf46c('0x3a')]);_0x639ee4[_0xf46c('0x3b')]=qs[_0xf46c('0x32')](_[_0xf46c('0x3c')](_0x34cf2[_0xf46c('0x31')],_0x25be8d[_0xf46c('0x32')]),_0x1dc3db);if(_0x34cf2[_0xf46c('0x31')]['filter']){_0x639ee4[_0xf46c('0x3b')]=_[_0xf46c('0x3d')](_0x639ee4['where'],{'$or':_[_0xf46c('0x28')](_0x1dc3db,function(_0x186a38){if(_0x186a38[_0xf46c('0x2c')]!=='VIRTUAL'){var _0x9249ed={};_0x9249ed[_0x186a38[_0xf46c('0x2f')]]={'$like':'%'+_0x34cf2[_0xf46c('0x31')][_0xf46c('0x3e')]+'%'};return _0x9249ed;}})});}_0x639ee4=_[_0xf46c('0x3d')]({},_0x639ee4,_0x34cf2['options']);var _0x454506={'where':_0x639ee4[_0xf46c('0x3b')]};return db[_0xf46c('0x29')][_0xf46c('0x1d')](_0x454506)[_0xf46c('0x25')](function(_0x4b5e48){_0x2abfe3[_0xf46c('0x1d')]=_0x4b5e48;if(_0x34cf2[_0xf46c('0x31')]['includeAll']){_0x639ee4[_0xf46c('0x3f')]=[{'all':!![]}];}return db[_0xf46c('0x29')][_0xf46c('0x40')](_0x639ee4);})[_0xf46c('0x25')](function(_0x36afc0){_0x2abfe3[_0xf46c('0x41')]=_0x36afc0;return _0x2abfe3;})[_0xf46c('0x25')](respondWithFilteredResult(_0x5ef577,_0x639ee4))[_0xf46c('0x42')](handleError(_0x5ef577,null));};exports[_0xf46c('0x43')]=function(_0x94b605,_0x212a3f){var _0x257fac={'raw':![],'where':{'id':_0x94b605[_0xf46c('0x44')]['id']}},_0x149de7={};_0x149de7[_0xf46c('0x2e')]=_[_0xf46c('0x30')](db['SalesforceConfiguration'][_0xf46c('0x2a')]);_0x149de7[_0xf46c('0x31')]=_[_0xf46c('0x30')](_0x94b605[_0xf46c('0x31')]);_0x149de7['filters']=_[_0xf46c('0x33')](_0x149de7['model'],_0x149de7[_0xf46c('0x31')]);_0x257fac[_0xf46c('0x35')]=_[_0xf46c('0x33')](_0x149de7[_0xf46c('0x2e')],qs[_0xf46c('0x34')](_0x94b605['query']['fields']));_0x257fac['attributes']=_0x257fac[_0xf46c('0x35')][_0xf46c('0x36')]?_0x257fac[_0xf46c('0x35')]:_0x149de7[_0xf46c('0x2e')];if(_0x94b605[_0xf46c('0x31')][_0xf46c('0x45')]){_0x257fac[_0xf46c('0x3f')]=[{'all':!![]}];}_0x257fac=_[_0xf46c('0x3d')]({},_0x257fac,_0x94b605[_0xf46c('0x46')]);return db[_0xf46c('0x29')]['find'](_0x257fac)[_0xf46c('0x25')](handleEntityNotFound(_0x212a3f,null))[_0xf46c('0x25')](respondWithResult(_0x212a3f,null))['catch'](handleError(_0x212a3f,null));};exports['create']=function(_0x14ec9f,_0x38f16a){return db[_0xf46c('0x29')][_0xf46c('0x47')](_0x14ec9f[_0xf46c('0x48')],{})[_0xf46c('0x25')](respondWithResult(_0x38f16a,0xc9))[_0xf46c('0x42')](handleError(_0x38f16a,null));};exports[_0xf46c('0x24')]=function(_0x5dea17,_0x1d151a){if(_0x5dea17['body']['id']){delete _0x5dea17[_0xf46c('0x48')]['id'];}return db[_0xf46c('0x29')][_0xf46c('0x49')]({'where':{'id':_0x5dea17['params']['id']}})[_0xf46c('0x25')](handleEntityNotFound(_0x1d151a,null))[_0xf46c('0x25')](saveUpdates(_0x5dea17['body'],null))[_0xf46c('0x25')](respondWithResult(_0x1d151a,null))['catch'](handleError(_0x1d151a,null));};exports['destroy']=function(_0x57a524,_0x52875b){return db['SalesforceConfiguration'][_0xf46c('0x49')]({'where':{'id':_0x57a524[_0xf46c('0x44')]['id']}})[_0xf46c('0x25')](handleEntityNotFound(_0x52875b,null))[_0xf46c('0x25')](removeEntity(_0x52875b,null))['catch'](handleError(_0x52875b,null));};exports[_0xf46c('0x4a')]=function(_0x70c5af,_0x29d2ce,_0x3bed5c){var _0x3d085b={};var _0x489eaa={};var _0x3f33fe;var _0x2ca21d;return db['SalesforceConfiguration'][_0xf46c('0x4b')]({'where':{'id':_0x70c5af['params']['id']}})['then'](handleEntityNotFound(_0x29d2ce,null))['then'](function(_0x5523c2){if(_0x5523c2){_0x3f33fe=_0x5523c2;_0x489eaa[_0xf46c('0x2e')]=_[_0xf46c('0x30')](db[_0xf46c('0x4c')][_0xf46c('0x2a')]);_0x489eaa[_0xf46c('0x31')]=_[_0xf46c('0x30')](_0x70c5af['query']);_0x489eaa[_0xf46c('0x32')]=_['intersection'](_0x489eaa['model'],_0x489eaa[_0xf46c('0x31')]);_0x3d085b[_0xf46c('0x35')]=_[_0xf46c('0x33')](_0x489eaa['model'],qs[_0xf46c('0x34')](_0x70c5af['query']['fields']));_0x3d085b[_0xf46c('0x35')]=_0x3d085b[_0xf46c('0x35')][_0xf46c('0x36')]?_0x3d085b[_0xf46c('0x35')]:_0x489eaa[_0xf46c('0x2e')];_0x3d085b['order']=qs[_0xf46c('0x3a')](_0x70c5af[_0xf46c('0x31')][_0xf46c('0x3a')]);_0x3d085b[_0xf46c('0x3b')]=qs['filters'](_[_0xf46c('0x3c')](_0x70c5af[_0xf46c('0x31')],_0x489eaa[_0xf46c('0x32')]));if(_0x70c5af[_0xf46c('0x31')][_0xf46c('0x3e')]){_0x3d085b[_0xf46c('0x3b')]=_[_0xf46c('0x3d')](_0x3d085b[_0xf46c('0x3b')],{'$or':_[_0xf46c('0x28')](_0x3d085b[_0xf46c('0x35')],function(_0x5a13ef){var _0x2f90b9={};_0x2f90b9[_0x5a13ef]={'$like':'%'+_0x70c5af['query'][_0xf46c('0x3e')]+'%'};return _0x2f90b9;})});}_0x3d085b=_[_0xf46c('0x3d')]({},_0x3d085b,_0x70c5af[_0xf46c('0x46')]);return _0x3f33fe['getFields'](_0x3d085b);}})[_0xf46c('0x25')](function(_0x33439e){if(_0x33439e){_0x2ca21d=_0x33439e[_0xf46c('0x36')];if(!_0x70c5af[_0xf46c('0x31')][_0xf46c('0x37')](_0xf46c('0x38'))){_0x3d085b[_0xf46c('0x1c')]=qs[_0xf46c('0x1c')](_0x70c5af[_0xf46c('0x31')]['limit']);_0x3d085b[_0xf46c('0x1e')]=qs[_0xf46c('0x1e')](_0x70c5af['query'][_0xf46c('0x1e')]);}return _0x3f33fe['getFields'](_0x3d085b);}})[_0xf46c('0x25')](function(_0x3c6814){if(_0x3c6814){return _0x3c6814?{'count':_0x2ca21d,'rows':_0x3c6814}:null;}})[_0xf46c('0x25')](respondWithResult(_0x29d2ce,null))[_0xf46c('0x42')](handleError(_0x29d2ce,null));};exports[_0xf46c('0x4d')]=function(_0x84a26c,_0x56f9ae,_0x55ed4b){var _0x3832b1={};var _0x2518b7={};var _0x5a44c1;var _0x4b39bf;return db[_0xf46c('0x29')][_0xf46c('0x4b')]({'where':{'id':_0x84a26c[_0xf46c('0x44')]['id']}})[_0xf46c('0x25')](handleEntityNotFound(_0x56f9ae,null))[_0xf46c('0x25')](function(_0x423a3f){if(_0x423a3f){_0x5a44c1=_0x423a3f;_0x2518b7['model']=_[_0xf46c('0x30')](db['SalesforceField'][_0xf46c('0x2a')]);_0x2518b7[_0xf46c('0x31')]=_['keys'](_0x84a26c['query']);_0x2518b7['filters']=_[_0xf46c('0x33')](_0x2518b7[_0xf46c('0x2e')],_0x2518b7[_0xf46c('0x31')]);_0x3832b1['attributes']=_[_0xf46c('0x33')](_0x2518b7[_0xf46c('0x2e')],qs[_0xf46c('0x34')](_0x84a26c[_0xf46c('0x31')][_0xf46c('0x34')]));_0x3832b1[_0xf46c('0x35')]=_0x3832b1[_0xf46c('0x35')][_0xf46c('0x36')]?_0x3832b1[_0xf46c('0x35')]:_0x2518b7[_0xf46c('0x2e')];_0x3832b1['order']=qs[_0xf46c('0x3a')](_0x84a26c[_0xf46c('0x31')]['sort']);_0x3832b1['where']=qs['filters'](_[_0xf46c('0x3c')](_0x84a26c[_0xf46c('0x31')],_0x2518b7[_0xf46c('0x32')]));if(_0x84a26c[_0xf46c('0x31')]['filter']){_0x3832b1[_0xf46c('0x3b')]=_[_0xf46c('0x3d')](_0x3832b1[_0xf46c('0x3b')],{'$or':_[_0xf46c('0x28')](_0x3832b1[_0xf46c('0x35')],function(_0x41ca2c){var _0x3da01d={};_0x3da01d[_0x41ca2c]={'$like':'%'+_0x84a26c['query'][_0xf46c('0x3e')]+'%'};return _0x3da01d;})});}_0x3832b1=_[_0xf46c('0x3d')]({},_0x3832b1,_0x84a26c['options']);return _0x5a44c1['getSubjects'](_0x3832b1);}})['then'](function(_0x39eb17){if(_0x39eb17){_0x4b39bf=_0x39eb17[_0xf46c('0x36')];if(!_0x84a26c['query'][_0xf46c('0x37')]('nolimit')){_0x3832b1[_0xf46c('0x1c')]=qs['limit'](_0x84a26c[_0xf46c('0x31')][_0xf46c('0x1c')]);_0x3832b1['offset']=qs[_0xf46c('0x1e')](_0x84a26c['query'][_0xf46c('0x1e')]);}return _0x5a44c1[_0xf46c('0x4d')](_0x3832b1);}})[_0xf46c('0x25')](function(_0x3c74c2){if(_0x3c74c2){return _0x3c74c2?{'count':_0x4b39bf,'rows':_0x3c74c2}:null;}})['then'](respondWithResult(_0x56f9ae,null))[_0xf46c('0x42')](handleError(_0x56f9ae,null));};exports[_0xf46c('0x4e')]=function(_0x4405d3,_0x26554f,_0x3e5570){var _0x59b59c={};var _0x48b39b={};var _0x30ecda;var _0x5b8a68;return db[_0xf46c('0x29')][_0xf46c('0x4b')]({'where':{'id':_0x4405d3[_0xf46c('0x44')]['id']}})[_0xf46c('0x25')](handleEntityNotFound(_0x26554f,null))['then'](function(_0x45eff7){if(_0x45eff7){_0x30ecda=_0x45eff7;_0x48b39b['model']=_[_0xf46c('0x30')](db['SalesforceField'][_0xf46c('0x2a')]);_0x48b39b[_0xf46c('0x31')]=_[_0xf46c('0x30')](_0x4405d3[_0xf46c('0x31')]);_0x48b39b[_0xf46c('0x32')]=_[_0xf46c('0x33')](_0x48b39b['model'],_0x48b39b[_0xf46c('0x31')]);_0x59b59c[_0xf46c('0x35')]=_[_0xf46c('0x33')](_0x48b39b[_0xf46c('0x2e')],qs['fields'](_0x4405d3[_0xf46c('0x31')]['fields']));_0x59b59c[_0xf46c('0x35')]=_0x59b59c[_0xf46c('0x35')][_0xf46c('0x36')]?_0x59b59c[_0xf46c('0x35')]:_0x48b39b['model'];_0x59b59c[_0xf46c('0x39')]=qs[_0xf46c('0x3a')](_0x4405d3['query'][_0xf46c('0x3a')]);_0x59b59c[_0xf46c('0x3b')]=qs[_0xf46c('0x32')](_['pick'](_0x4405d3[_0xf46c('0x31')],_0x48b39b['filters']));if(_0x4405d3[_0xf46c('0x31')][_0xf46c('0x3e')]){_0x59b59c[_0xf46c('0x3b')]=_[_0xf46c('0x3d')](_0x59b59c['where'],{'$or':_[_0xf46c('0x28')](_0x59b59c[_0xf46c('0x35')],function(_0x1d5eba){var _0x240a73={};_0x240a73[_0x1d5eba]={'$like':'%'+_0x4405d3['query'][_0xf46c('0x3e')]+'%'};return _0x240a73;})});}_0x59b59c=_[_0xf46c('0x3d')]({},_0x59b59c,_0x4405d3[_0xf46c('0x46')]);return _0x30ecda[_0xf46c('0x4e')](_0x59b59c);}})['then'](function(_0x2ba13d){if(_0x2ba13d){_0x5b8a68=_0x2ba13d[_0xf46c('0x36')];if(!_0x4405d3[_0xf46c('0x31')][_0xf46c('0x37')](_0xf46c('0x38'))){_0x59b59c['limit']=qs[_0xf46c('0x1c')](_0x4405d3[_0xf46c('0x31')][_0xf46c('0x1c')]);_0x59b59c[_0xf46c('0x1e')]=qs[_0xf46c('0x1e')](_0x4405d3['query']['offset']);}return _0x30ecda[_0xf46c('0x4e')](_0x59b59c);}})[_0xf46c('0x25')](function(_0x358209){if(_0x358209){return _0x358209?{'count':_0x5b8a68,'rows':_0x358209}:null;}})[_0xf46c('0x25')](respondWithResult(_0x26554f,null))[_0xf46c('0x42')](handleError(_0x26554f,null));}; \ No newline at end of file +var _0xf76f=['params','keys','intersection','include','options','find','catch','create','body','getFields','findOne','SalesforceField','merge','getSubjects','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','includeAll','findAll','rows','show'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xf76f,0x19b));var _0xff76=function(_0x4c6790,_0x223ca4){_0x4c6790=_0x4c6790-0x0;var _0x5cf432=_0xf76f[_0x4c6790];return _0x5cf432;};'use strict';var emlformat=require(_0xff76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff76('0x1'));var jsonpatch=require(_0xff76('0x2'));var rp=require(_0xff76('0x3'));var moment=require(_0xff76('0x4'));var BPromise=require(_0xff76('0x5'));var Mustache=require(_0xff76('0x6'));var util=require(_0xff76('0x7'));var path=require(_0xff76('0x8'));var sox=require(_0xff76('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff76('0xa'));var _=require(_0xff76('0xb'));var squel=require(_0xff76('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xff76('0xd'));var querystring=require(_0xff76('0xe'));var Papa=require(_0xff76('0xf'));var Redis=require('ioredis');var authService=require(_0xff76('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xff76('0x11'));var utils=require(_0xff76('0x12'));var config=require(_0xff76('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xff76('0x14'))['db'];function respondWithStatusCode(_0x1e90e3,_0x4076d8){_0x4076d8=_0x4076d8||0xcc;return function(_0x437f3a){if(_0x437f3a){return _0x1e90e3['sendStatus'](_0x4076d8);}return _0x1e90e3[_0xff76('0x15')](_0x4076d8)[_0xff76('0x16')]();};}function respondWithResult(_0x5c4635,_0x544f0a){_0x544f0a=_0x544f0a||0xc8;return function(_0x148f42){if(_0x148f42){return _0x5c4635['status'](_0x544f0a)[_0xff76('0x17')](_0x148f42);}};}function respondWithFilteredResult(_0x248588,_0x158fc8){return function(_0x2f178b){if(_0x2f178b){var _0x54dbe8=typeof _0x158fc8['offset']===_0xff76('0x18')&&typeof _0x158fc8['limit']===_0xff76('0x18');var _0x410db8=_0x2f178b['count'];var _0x18f712=_0x54dbe8?0x0:_0x158fc8['offset'];var _0x357cca=_0x54dbe8?_0x2f178b[_0xff76('0x19')]:_0x158fc8[_0xff76('0x1a')]+_0x158fc8[_0xff76('0x1b')];var _0x4ad31f;if(_0x357cca>=_0x410db8){_0x357cca=_0x410db8;_0x4ad31f=0xc8;}else{_0x4ad31f=0xce;}_0x248588[_0xff76('0x15')](_0x4ad31f);return _0x248588[_0xff76('0x1c')](_0xff76('0x1d'),_0x18f712+'-'+_0x357cca+'/'+_0x410db8)[_0xff76('0x17')](_0x2f178b);}return null;};}function patchUpdates(_0x3de32d){return function(_0x230893){try{jsonpatch[_0xff76('0x1e')](_0x230893,_0x3de32d,!![]);}catch(_0x10c3f1){return BPromise['reject'](_0x10c3f1);}return _0x230893['save']();};}function saveUpdates(_0x27c374,_0x2c0210){return function(_0x426861){if(_0x426861){return _0x426861[_0xff76('0x1f')](_0x27c374)[_0xff76('0x20')](function(_0x512958){return _0x512958;});}return null;};}function removeEntity(_0x4f9466,_0x53ce73){return function(_0x569f83){if(_0x569f83){return _0x569f83[_0xff76('0x21')]()[_0xff76('0x20')](function(){_0x4f9466[_0xff76('0x15')](0xcc)[_0xff76('0x16')]();});}};}function handleEntityNotFound(_0x5bc6da,_0x1bf32f){return function(_0x5a83e3){if(!_0x5a83e3){_0x5bc6da[_0xff76('0x22')](0x194);}return _0x5a83e3;};}function handleError(_0x78bfac,_0x55da11){_0x55da11=_0x55da11||0x1f4;return function(_0x12d25c){logger[_0xff76('0x23')](_0x12d25c[_0xff76('0x24')]);if(_0x12d25c[_0xff76('0x25')]){delete _0x12d25c[_0xff76('0x25')];}_0x78bfac[_0xff76('0x15')](_0x55da11)[_0xff76('0x26')](_0x12d25c);};}exports[_0xff76('0x27')]=function(_0x524286,_0x28e611){var _0x5b32cb={},_0x199405={},_0x41c453={'count':0x0,'rows':[]};var _0x15dde5=_[_0xff76('0x28')](db[_0xff76('0x29')][_0xff76('0x2a')],function(_0x4be62c){return{'name':_0x4be62c[_0xff76('0x2b')],'type':_0x4be62c['type'][_0xff76('0x2c')]};});_0x199405[_0xff76('0x2d')]=_[_0xff76('0x28')](_0x15dde5,'name');_0x199405['query']=_['keys'](_0x524286[_0xff76('0x2e')]);_0x199405[_0xff76('0x2f')]=_['intersection'](_0x199405[_0xff76('0x2d')],_0x199405[_0xff76('0x2e')]);_0x5b32cb[_0xff76('0x30')]=_['intersection'](_0x199405['model'],qs[_0xff76('0x31')](_0x524286['query'][_0xff76('0x31')]));_0x5b32cb['attributes']=_0x5b32cb[_0xff76('0x30')][_0xff76('0x32')]?_0x5b32cb['attributes']:_0x199405[_0xff76('0x2d')];if(!_0x524286[_0xff76('0x2e')][_0xff76('0x33')]('nolimit')){_0x5b32cb[_0xff76('0x1b')]=qs[_0xff76('0x1b')](_0x524286[_0xff76('0x2e')]['limit']);_0x5b32cb[_0xff76('0x1a')]=qs[_0xff76('0x1a')](_0x524286['query']['offset']);}_0x5b32cb[_0xff76('0x34')]=qs[_0xff76('0x35')](_0x524286[_0xff76('0x2e')][_0xff76('0x35')]);_0x5b32cb[_0xff76('0x36')]=qs[_0xff76('0x2f')](_[_0xff76('0x37')](_0x524286[_0xff76('0x2e')],_0x199405['filters']),_0x15dde5);if(_0x524286[_0xff76('0x2e')][_0xff76('0x38')]){_0x5b32cb[_0xff76('0x36')]=_['merge'](_0x5b32cb[_0xff76('0x36')],{'$or':_[_0xff76('0x28')](_0x15dde5,function(_0x2d1dec){if(_0x2d1dec[_0xff76('0x39')]!==_0xff76('0x3a')){var _0x295e58={};_0x295e58[_0x2d1dec[_0xff76('0x25')]]={'$like':'%'+_0x524286[_0xff76('0x2e')][_0xff76('0x38')]+'%'};return _0x295e58;}})});}_0x5b32cb=_['merge']({},_0x5b32cb,_0x524286['options']);var _0xcb8ecc={'where':_0x5b32cb[_0xff76('0x36')]};return db['SalesforceConfiguration'][_0xff76('0x19')](_0xcb8ecc)['then'](function(_0x14a8b1){_0x41c453[_0xff76('0x19')]=_0x14a8b1;if(_0x524286[_0xff76('0x2e')][_0xff76('0x3b')]){_0x5b32cb['include']=[{'all':!![]}];}return db[_0xff76('0x29')][_0xff76('0x3c')](_0x5b32cb);})[_0xff76('0x20')](function(_0x4789f7){_0x41c453[_0xff76('0x3d')]=_0x4789f7;return _0x41c453;})[_0xff76('0x20')](respondWithFilteredResult(_0x28e611,_0x5b32cb))['catch'](handleError(_0x28e611,null));};exports[_0xff76('0x3e')]=function(_0x5c61ea,_0x2b93ad){var _0x57143c={'raw':![],'where':{'id':_0x5c61ea[_0xff76('0x3f')]['id']}},_0x452198={};_0x452198[_0xff76('0x2d')]=_[_0xff76('0x40')](db[_0xff76('0x29')][_0xff76('0x2a')]);_0x452198['query']=_['keys'](_0x5c61ea[_0xff76('0x2e')]);_0x452198['filters']=_[_0xff76('0x41')](_0x452198['model'],_0x452198[_0xff76('0x2e')]);_0x57143c['attributes']=_[_0xff76('0x41')](_0x452198[_0xff76('0x2d')],qs['fields'](_0x5c61ea[_0xff76('0x2e')]['fields']));_0x57143c[_0xff76('0x30')]=_0x57143c['attributes'][_0xff76('0x32')]?_0x57143c[_0xff76('0x30')]:_0x452198[_0xff76('0x2d')];if(_0x5c61ea[_0xff76('0x2e')][_0xff76('0x3b')]){_0x57143c[_0xff76('0x42')]=[{'all':!![]}];}_0x57143c=_['merge']({},_0x57143c,_0x5c61ea[_0xff76('0x43')]);return db[_0xff76('0x29')][_0xff76('0x44')](_0x57143c)['then'](handleEntityNotFound(_0x2b93ad,null))[_0xff76('0x20')](respondWithResult(_0x2b93ad,null))[_0xff76('0x45')](handleError(_0x2b93ad,null));};exports['create']=function(_0x266e10,_0x21f5a3){return db['SalesforceConfiguration'][_0xff76('0x46')](_0x266e10[_0xff76('0x47')],{})[_0xff76('0x20')](respondWithResult(_0x21f5a3,0xc9))['catch'](handleError(_0x21f5a3,null));};exports[_0xff76('0x1f')]=function(_0x37dfe6,_0x53ce86){if(_0x37dfe6[_0xff76('0x47')]['id']){delete _0x37dfe6[_0xff76('0x47')]['id'];}return db['SalesforceConfiguration'][_0xff76('0x44')]({'where':{'id':_0x37dfe6[_0xff76('0x3f')]['id']}})[_0xff76('0x20')](handleEntityNotFound(_0x53ce86,null))['then'](saveUpdates(_0x37dfe6[_0xff76('0x47')],null))[_0xff76('0x20')](respondWithResult(_0x53ce86,null))[_0xff76('0x45')](handleError(_0x53ce86,null));};exports['destroy']=function(_0x3a670b,_0x3a943b){return db['SalesforceConfiguration'][_0xff76('0x44')]({'where':{'id':_0x3a670b[_0xff76('0x3f')]['id']}})[_0xff76('0x20')](handleEntityNotFound(_0x3a943b,null))['then'](removeEntity(_0x3a943b,null))['catch'](handleError(_0x3a943b,null));};exports[_0xff76('0x48')]=function(_0x32e772,_0x284325,_0x50d6c5){var _0x5df8da={};var _0x25641f={};var _0x1f8e9c;var _0x2fce46;return db[_0xff76('0x29')][_0xff76('0x49')]({'where':{'id':_0x32e772['params']['id']}})['then'](handleEntityNotFound(_0x284325,null))[_0xff76('0x20')](function(_0x46c436){if(_0x46c436){_0x1f8e9c=_0x46c436;_0x25641f[_0xff76('0x2d')]=_[_0xff76('0x40')](db[_0xff76('0x4a')][_0xff76('0x2a')]);_0x25641f[_0xff76('0x2e')]=_['keys'](_0x32e772[_0xff76('0x2e')]);_0x25641f[_0xff76('0x2f')]=_[_0xff76('0x41')](_0x25641f['model'],_0x25641f[_0xff76('0x2e')]);_0x5df8da[_0xff76('0x30')]=_[_0xff76('0x41')](_0x25641f[_0xff76('0x2d')],qs['fields'](_0x32e772[_0xff76('0x2e')][_0xff76('0x31')]));_0x5df8da[_0xff76('0x30')]=_0x5df8da[_0xff76('0x30')][_0xff76('0x32')]?_0x5df8da[_0xff76('0x30')]:_0x25641f[_0xff76('0x2d')];_0x5df8da[_0xff76('0x34')]=qs[_0xff76('0x35')](_0x32e772['query']['sort']);_0x5df8da[_0xff76('0x36')]=qs['filters'](_[_0xff76('0x37')](_0x32e772[_0xff76('0x2e')],_0x25641f[_0xff76('0x2f')]));if(_0x32e772['query']['filter']){_0x5df8da['where']=_[_0xff76('0x4b')](_0x5df8da[_0xff76('0x36')],{'$or':_[_0xff76('0x28')](_0x5df8da[_0xff76('0x30')],function(_0x26b221){var _0x575952={};_0x575952[_0x26b221]={'$like':'%'+_0x32e772[_0xff76('0x2e')][_0xff76('0x38')]+'%'};return _0x575952;})});}_0x5df8da=_[_0xff76('0x4b')]({},_0x5df8da,_0x32e772['options']);return _0x1f8e9c['getFields'](_0x5df8da);}})['then'](function(_0x22752c){if(_0x22752c){_0x2fce46=_0x22752c['length'];if(!_0x32e772[_0xff76('0x2e')][_0xff76('0x33')]('nolimit')){_0x5df8da[_0xff76('0x1b')]=qs[_0xff76('0x1b')](_0x32e772[_0xff76('0x2e')]['limit']);_0x5df8da['offset']=qs['offset'](_0x32e772['query'][_0xff76('0x1a')]);}return _0x1f8e9c[_0xff76('0x48')](_0x5df8da);}})[_0xff76('0x20')](function(_0x2d9a61){if(_0x2d9a61){return _0x2d9a61?{'count':_0x2fce46,'rows':_0x2d9a61}:null;}})['then'](respondWithResult(_0x284325,null))[_0xff76('0x45')](handleError(_0x284325,null));};exports[_0xff76('0x4c')]=function(_0x5263b2,_0x36df64,_0xd00d72){var _0x31eb77={};var _0x1e1f5e={};var _0x102537;var _0x21d29e;return db[_0xff76('0x29')][_0xff76('0x49')]({'where':{'id':_0x5263b2['params']['id']}})[_0xff76('0x20')](handleEntityNotFound(_0x36df64,null))[_0xff76('0x20')](function(_0x8a3d28){if(_0x8a3d28){_0x102537=_0x8a3d28;_0x1e1f5e[_0xff76('0x2d')]=_['keys'](db['SalesforceField'][_0xff76('0x2a')]);_0x1e1f5e[_0xff76('0x2e')]=_[_0xff76('0x40')](_0x5263b2[_0xff76('0x2e')]);_0x1e1f5e['filters']=_[_0xff76('0x41')](_0x1e1f5e[_0xff76('0x2d')],_0x1e1f5e[_0xff76('0x2e')]);_0x31eb77[_0xff76('0x30')]=_['intersection'](_0x1e1f5e[_0xff76('0x2d')],qs[_0xff76('0x31')](_0x5263b2[_0xff76('0x2e')][_0xff76('0x31')]));_0x31eb77[_0xff76('0x30')]=_0x31eb77[_0xff76('0x30')][_0xff76('0x32')]?_0x31eb77[_0xff76('0x30')]:_0x1e1f5e[_0xff76('0x2d')];_0x31eb77['order']=qs[_0xff76('0x35')](_0x5263b2[_0xff76('0x2e')][_0xff76('0x35')]);_0x31eb77[_0xff76('0x36')]=qs[_0xff76('0x2f')](_[_0xff76('0x37')](_0x5263b2['query'],_0x1e1f5e[_0xff76('0x2f')]));if(_0x5263b2[_0xff76('0x2e')][_0xff76('0x38')]){_0x31eb77[_0xff76('0x36')]=_[_0xff76('0x4b')](_0x31eb77[_0xff76('0x36')],{'$or':_['map'](_0x31eb77[_0xff76('0x30')],function(_0x4733aa){var _0x3f6a87={};_0x3f6a87[_0x4733aa]={'$like':'%'+_0x5263b2[_0xff76('0x2e')][_0xff76('0x38')]+'%'};return _0x3f6a87;})});}_0x31eb77=_[_0xff76('0x4b')]({},_0x31eb77,_0x5263b2[_0xff76('0x43')]);return _0x102537[_0xff76('0x4c')](_0x31eb77);}})[_0xff76('0x20')](function(_0x1a88ec){if(_0x1a88ec){_0x21d29e=_0x1a88ec[_0xff76('0x32')];if(!_0x5263b2[_0xff76('0x2e')][_0xff76('0x33')](_0xff76('0x4d'))){_0x31eb77[_0xff76('0x1b')]=qs[_0xff76('0x1b')](_0x5263b2['query'][_0xff76('0x1b')]);_0x31eb77['offset']=qs[_0xff76('0x1a')](_0x5263b2['query']['offset']);}return _0x102537['getSubjects'](_0x31eb77);}})[_0xff76('0x20')](function(_0x115c4e){if(_0x115c4e){return _0x115c4e?{'count':_0x21d29e,'rows':_0x115c4e}:null;}})[_0xff76('0x20')](respondWithResult(_0x36df64,null))['catch'](handleError(_0x36df64,null));};exports[_0xff76('0x4e')]=function(_0x456de4,_0x2ee33c,_0x1db646){var _0x36a047={};var _0x324454={};var _0x4dc028;var _0x22ceeb;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x456de4[_0xff76('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ee33c,null))[_0xff76('0x20')](function(_0x26539e){if(_0x26539e){_0x4dc028=_0x26539e;_0x324454[_0xff76('0x2d')]=_[_0xff76('0x40')](db[_0xff76('0x4a')][_0xff76('0x2a')]);_0x324454[_0xff76('0x2e')]=_[_0xff76('0x40')](_0x456de4[_0xff76('0x2e')]);_0x324454[_0xff76('0x2f')]=_['intersection'](_0x324454[_0xff76('0x2d')],_0x324454[_0xff76('0x2e')]);_0x36a047[_0xff76('0x30')]=_['intersection'](_0x324454[_0xff76('0x2d')],qs[_0xff76('0x31')](_0x456de4['query'][_0xff76('0x31')]));_0x36a047[_0xff76('0x30')]=_0x36a047[_0xff76('0x30')][_0xff76('0x32')]?_0x36a047[_0xff76('0x30')]:_0x324454[_0xff76('0x2d')];_0x36a047[_0xff76('0x34')]=qs['sort'](_0x456de4[_0xff76('0x2e')][_0xff76('0x35')]);_0x36a047[_0xff76('0x36')]=qs[_0xff76('0x2f')](_['pick'](_0x456de4[_0xff76('0x2e')],_0x324454[_0xff76('0x2f')]));if(_0x456de4[_0xff76('0x2e')][_0xff76('0x38')]){_0x36a047[_0xff76('0x36')]=_[_0xff76('0x4b')](_0x36a047[_0xff76('0x36')],{'$or':_[_0xff76('0x28')](_0x36a047['attributes'],function(_0x9cb1c9){var _0x13f2e9={};_0x13f2e9[_0x9cb1c9]={'$like':'%'+_0x456de4[_0xff76('0x2e')][_0xff76('0x38')]+'%'};return _0x13f2e9;})});}_0x36a047=_['merge']({},_0x36a047,_0x456de4[_0xff76('0x43')]);return _0x4dc028[_0xff76('0x4e')](_0x36a047);}})[_0xff76('0x20')](function(_0x5948c7){if(_0x5948c7){_0x22ceeb=_0x5948c7[_0xff76('0x32')];if(!_0x456de4[_0xff76('0x2e')][_0xff76('0x33')](_0xff76('0x4d'))){_0x36a047[_0xff76('0x1b')]=qs[_0xff76('0x1b')](_0x456de4[_0xff76('0x2e')][_0xff76('0x1b')]);_0x36a047['offset']=qs[_0xff76('0x1a')](_0x456de4[_0xff76('0x2e')]['offset']);}return _0x4dc028['getDescriptions'](_0x36a047);}})[_0xff76('0x20')](function(_0x615baa){if(_0x615baa){return _0x615baa?{'count':_0x22ceeb,'rows':_0x615baa}:null;}})['then'](respondWithResult(_0x2ee33c,null))[_0xff76('0x45')](handleError(_0x2ee33c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 63d4b25..389b5ed 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 _0xdecb=['bluebird','rimraf','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x494bd6,_0x58b066){var _0x446bec=function(_0x50b852){while(--_0x50b852){_0x494bd6['push'](_0x494bd6['shift']());}};_0x446bec(++_0x58b066);}(_0xdecb,0xed));var _0xbdec=function(_0x3726cb,_0x17a968){_0x3726cb=_0x3726cb-0x0;var _0x177fd1=_0xdecb[_0x3726cb];return _0x177fd1;};'use strict';var _=require(_0xbdec('0x0'));var util=require(_0xbdec('0x1'));var logger=require(_0xbdec('0x2'))(_0xbdec('0x3'));var moment=require(_0xbdec('0x4'));var BPromise=require(_0xbdec('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdec('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0xbdec('0x7')]=function(_0x459a0d,_0x5f19db){return _0x459a0d[_0xbdec('0x8')](_0xbdec('0x9'),attributes,{'tableName':_0xbdec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2874=['../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x2874,0xec));var _0x4287=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x2874[_0x2d1971];return _0x4d7759;};'use strict';var _=require(_0x4287('0x0'));var util=require(_0x4287('0x1'));var logger=require(_0x4287('0x2'))('api');var moment=require(_0x4287('0x3'));var BPromise=require(_0x4287('0x4'));var rp=require(_0x4287('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4287('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x4287('0x7')]=function(_0x1f68b6,_0x5cba30){return _0x1f68b6[_0x4287('0x8')](_0x4287('0x9'),attributes,{'tableName':_0x4287('0xa'),'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 f9319f3..26d5cbf 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 _0x344a=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x344a,0x107));var _0xa344=function(_0x187167,_0xe93836){_0x187167=_0x187167-0x0;var _0x50aed2=_0x344a[_0x187167];return _0x50aed2;};'use strict';var _=require(_0xa344('0x0'));var util=require('util');var moment=require(_0xa344('0x1'));var BPromise=require(_0xa344('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa344('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa344('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa344('0x5'));var client=jayson[_0xa344('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dec9,_0x39b75c,_0x2d9d14){return new BPromise(function(_0x3b0c9b,_0x5303e3){return client['request'](_0x32dec9,_0x2d9d14)['then'](function(_0x536fd7){logger[_0xa344('0x7')](_0xa344('0x8'),_0x39b75c,'request\x20sent');logger[_0xa344('0x9')](_0xa344('0xa'),_0x39b75c,_0xa344('0xb'),JSON[_0xa344('0xc')](_0x536fd7));if(_0x536fd7['error']){if(_0x536fd7[_0xa344('0xd')][_0xa344('0xe')]===0x1f4){logger['error'](_0xa344('0x8'),_0x39b75c,_0x536fd7[_0xa344('0xd')]['message']);return _0x5303e3(_0x536fd7[_0xa344('0xd')][_0xa344('0xf')]);}logger[_0xa344('0xd')](_0xa344('0x8'),_0x39b75c,_0x536fd7[_0xa344('0xd')][_0xa344('0xf')]);return _0x3b0c9b(_0x536fd7[_0xa344('0xd')][_0xa344('0xf')]);}else{logger[_0xa344('0x7')](_0xa344('0x8'),_0x39b75c,_0xa344('0xb'));_0x3b0c9b(_0x536fd7[_0xa344('0x10')][_0xa344('0xf')]);}})['catch'](function(_0x1a85d3){logger['error'](_0xa344('0x8'),_0x39b75c,_0x1a85d3);_0x5303e3(_0x1a85d3);});});} \ No newline at end of file +var _0x561d=['../../config/environment','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x24c410,_0xf275f8){var _0x1d746d=function(_0x310948){while(--_0x310948){_0x24c410['push'](_0x24c410['shift']());}};_0x1d746d(++_0xf275f8);}(_0x561d,0xc0));var _0xd561=function(_0x4ec142,_0x2b13ae){_0x4ec142=_0x4ec142-0x0;var _0x38f700=_0x561d[_0x4ec142];return _0x38f700;};'use strict';var _=require(_0xd561('0x0'));var util=require(_0xd561('0x1'));var moment=require('moment');var BPromise=require(_0xd561('0x2'));var rs=require(_0xd561('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd561('0x4'))['db'];var utils=require(_0xd561('0x5'));var logger=require(_0xd561('0x6'))(_0xd561('0x7'));var config=require(_0xd561('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f446e,_0x29e8b6,_0x248944){return new BPromise(function(_0x172974,_0x5a7862){return client[_0xd561('0x9')](_0x2f446e,_0x248944)[_0xd561('0xa')](function(_0x219ed5){logger[_0xd561('0xb')](_0xd561('0xc'),_0x29e8b6,_0xd561('0xd'));logger[_0xd561('0xe')](_0xd561('0xf'),_0x29e8b6,_0xd561('0xd'),JSON[_0xd561('0x10')](_0x219ed5));if(_0x219ed5[_0xd561('0x11')]){if(_0x219ed5[_0xd561('0x11')]['code']===0x1f4){logger[_0xd561('0x11')](_0xd561('0xc'),_0x29e8b6,_0x219ed5[_0xd561('0x11')][_0xd561('0x12')]);return _0x5a7862(_0x219ed5['error'][_0xd561('0x12')]);}logger['error'](_0xd561('0xc'),_0x29e8b6,_0x219ed5['error'][_0xd561('0x12')]);return _0x172974(_0x219ed5['error'][_0xd561('0x12')]);}else{logger['info'](_0xd561('0xc'),_0x29e8b6,_0xd561('0xd'));_0x172974(_0x219ed5[_0xd561('0x13')][_0xd561('0x12')]);}})['catch'](function(_0x2dd33a){logger[_0xd561('0x11')](_0xd561('0xc'),_0x29e8b6,_0x2dd33a);_0x5a7862(_0x2dd33a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index cc4c34a..84c462e 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 _0x4c5d=['isAuthenticated','create','put','update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','show','post'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4c5d,0x116));var _0xd4c5=function(_0x30a998,_0x37b88b){_0x30a998=_0x30a998-0x0;var _0x587475=_0x4c5d[_0x30a998];return _0x587475;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd4c5('0x0'));var timeout=require('connect-timeout');var express=require(_0xd4c5('0x1'));var router=express[_0xd4c5('0x2')]();var fs_extra=require(_0xd4c5('0x3'));var auth=require(_0xd4c5('0x4'));var interaction=require(_0xd4c5('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd4c5('0x6')](_0xd4c5('0x7'),auth['isAuthenticated'](),controller[_0xd4c5('0x8')]);router[_0xd4c5('0x9')]('/',auth[_0xd4c5('0xa')](),controller[_0xd4c5('0xb')]);router[_0xd4c5('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xd4c5('0xd')]);router['delete']('/:id',auth[_0xd4c5('0xa')](),controller[_0xd4c5('0xe')]);module[_0xd4c5('0xf')]=router; \ No newline at end of file +var _0x064e=['destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','post','create','put','update','delete'];(function(_0x1fa448,_0xfaa03a){var _0x30985=function(_0x91dc1d){while(--_0x91dc1d){_0x1fa448['push'](_0x1fa448['shift']());}};_0x30985(++_0xfaa03a);}(_0x064e,0xbd));var _0xe064=function(_0x47a197,_0x27d80e){_0x47a197=_0x47a197-0x0;var _0x596c6c=_0x064e[_0x47a197];return _0x596c6c;};'use strict';var multer=require('multer');var util=require(_0xe064('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe064('0x1'));var router=express[_0xe064('0x2')]();var fs_extra=require(_0xe064('0x3'));var auth=require(_0xe064('0x4'));var interaction=require(_0xe064('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0xe064('0x6')]('/',auth['isAuthenticated'](),controller[_0xe064('0x7')]);router[_0xe064('0x6')](_0xe064('0x8'),auth[_0xe064('0x9')](),controller['show']);router[_0xe064('0xa')]('/',auth[_0xe064('0x9')](),controller[_0xe064('0xb')]);router[_0xe064('0xc')](_0xe064('0x8'),auth[_0xe064('0x9')](),controller[_0xe064('0xd')]);router[_0xe064('0xe')](_0xe064('0x8'),auth[_0xe064('0x9')](),controller[_0xe064('0xf')]);module[_0xe064('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 081405a..7d43dae 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 _0x7557=['ENUM','picklist','string','STRING','variable','sequelize','exports'];(function(_0x13529f,_0x4973c9){var _0x5ac285=function(_0x5d8c83){while(--_0x5d8c83){_0x13529f['push'](_0x13529f['shift']());}};_0x5ac285(++_0x4973c9);}(_0x7557,0x8a));var _0x7755=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x7557[_0x4aba15];return _0x1c8122;};'use strict';var Sequelize=require(_0x7755('0x0'));module[_0x7755('0x1')]={'type':{'type':Sequelize[_0x7755('0x2')]('string','variable','customVariable','keyValue',_0x7755('0x3')),'defaultValue':_0x7755('0x4')},'content':{'type':Sequelize[_0x7755('0x5')]},'key':{'type':Sequelize[_0x7755('0x5')]},'keyType':{'type':Sequelize[_0x7755('0x2')]('string',_0x7755('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7755('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6e5=['STRING','variable','customVariable','sequelize','exports','ENUM','keyValue','picklist','string'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xd6e5,0x18f));var _0x5d6e=function(_0x242137,_0x4f1c3b){_0x242137=_0x242137-0x0;var _0x71f934=_0xd6e5[_0x242137];return _0x71f934;};'use strict';var Sequelize=require(_0x5d6e('0x0'));module[_0x5d6e('0x1')]={'type':{'type':Sequelize[_0x5d6e('0x2')]('string','variable','customVariable',_0x5d6e('0x3'),_0x5d6e('0x4')),'defaultValue':_0x5d6e('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5d6e('0x6')]},'keyType':{'type':Sequelize[_0x5d6e('0x2')](_0x5d6e('0x5'),_0x5d6e('0x7'),_0x5d6e('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5d6e('0x6')]},'variableName':{'type':Sequelize[_0x5d6e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index efdf95c..46bcc33 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 _0xfb34=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','where','pick','filter','merge','VIRTUAL','options','SalesforceField','include','findAll','catch','show','params','rawAttributes','intersection','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfb34,0x1a0));var _0x4fb3=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xfb34[_0xf26c2e];return _0x46ecb4;};'use strict';var emlformat=require(_0x4fb3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fb3('0x1'));var jsonpatch=require(_0x4fb3('0x2'));var rp=require(_0x4fb3('0x3'));var moment=require(_0x4fb3('0x4'));var BPromise=require(_0x4fb3('0x5'));var Mustache=require(_0x4fb3('0x6'));var util=require(_0x4fb3('0x7'));var path=require(_0x4fb3('0x8'));var sox=require(_0x4fb3('0x9'));var csv=require('to-csv');var ejs=require(_0x4fb3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fb3('0xb'));var squel=require('squel');var crypto=require(_0x4fb3('0xc'));var jsforce=require(_0x4fb3('0xd'));var deskjs=require(_0x4fb3('0xe'));var toCsv=require(_0x4fb3('0xf'));var querystring=require(_0x4fb3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4fb3('0x11'));var qs=require(_0x4fb3('0x12'));var as=require(_0x4fb3('0x13'));var hardwareService=require(_0x4fb3('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4fb3('0x15'));var config=require(_0x4fb3('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ab6c,_0x48d59a){_0x48d59a=_0x48d59a||0xcc;return function(_0x441581){if(_0x441581){return _0x35ab6c[_0x4fb3('0x17')](_0x48d59a);}return _0x35ab6c[_0x4fb3('0x18')](_0x48d59a)[_0x4fb3('0x19')]();};}function respondWithResult(_0x54889e,_0x8f516a){_0x8f516a=_0x8f516a||0xc8;return function(_0x35c83d){if(_0x35c83d){return _0x54889e[_0x4fb3('0x18')](_0x8f516a)[_0x4fb3('0x1a')](_0x35c83d);}};}function respondWithFilteredResult(_0x42e548,_0x250153){return function(_0x5cc15f){if(_0x5cc15f){var _0x419862=typeof _0x250153[_0x4fb3('0x1b')]===_0x4fb3('0x1c')&&typeof _0x250153[_0x4fb3('0x1d')]===_0x4fb3('0x1c');var _0x53fcf6=_0x5cc15f['count'];var _0x5afdc1=_0x419862?0x0:_0x250153[_0x4fb3('0x1b')];var _0x521be5=_0x419862?_0x5cc15f[_0x4fb3('0x1e')]:_0x250153[_0x4fb3('0x1b')]+_0x250153[_0x4fb3('0x1d')];var _0x414aa2;if(_0x521be5>=_0x53fcf6){_0x521be5=_0x53fcf6;_0x414aa2=0xc8;}else{_0x414aa2=0xce;}_0x42e548[_0x4fb3('0x18')](_0x414aa2);return _0x42e548[_0x4fb3('0x1f')](_0x4fb3('0x20'),_0x5afdc1+'-'+_0x521be5+'/'+_0x53fcf6)[_0x4fb3('0x1a')](_0x5cc15f);}return null;};}function patchUpdates(_0x29b537){return function(_0x22c2fb){try{jsonpatch[_0x4fb3('0x21')](_0x22c2fb,_0x29b537,!![]);}catch(_0x56e7ff){return BPromise[_0x4fb3('0x22')](_0x56e7ff);}return _0x22c2fb[_0x4fb3('0x23')]();};}function saveUpdates(_0x529631,_0x5f211e){return function(_0x3b5a5d){if(_0x3b5a5d){return _0x3b5a5d[_0x4fb3('0x24')](_0x529631)[_0x4fb3('0x25')](function(_0x346641){return _0x346641;});}return null;};}function removeEntity(_0x587c2b,_0x1a1d35){return function(_0x25875c){if(_0x25875c){return _0x25875c[_0x4fb3('0x26')]()['then'](function(){_0x587c2b[_0x4fb3('0x18')](0xcc)[_0x4fb3('0x19')]();});}};}function handleEntityNotFound(_0xe0ad55,_0x157001){return function(_0x3dcd35){if(!_0x3dcd35){_0xe0ad55[_0x4fb3('0x17')](0x194);}return _0x3dcd35;};}function handleError(_0x48f500,_0x48c38a){_0x48c38a=_0x48c38a||0x1f4;return function(_0x3cdb98){logger['error'](_0x3cdb98[_0x4fb3('0x27')]);if(_0x3cdb98[_0x4fb3('0x28')]){delete _0x3cdb98['name'];}_0x48f500[_0x4fb3('0x18')](_0x48c38a)[_0x4fb3('0x29')](_0x3cdb98);};}exports[_0x4fb3('0x2a')]=function(_0x4752d3,_0x2f5012){var _0x4bdfd5={},_0x5b9d64={},_0x414078={'count':0x0,'rows':[]};var _0x283b86=_[_0x4fb3('0x2b')](db['SalesforceField']['rawAttributes'],function(_0x389aa0){return{'name':_0x389aa0[_0x4fb3('0x2c')],'type':_0x389aa0['type'][_0x4fb3('0x2d')]};});_0x5b9d64[_0x4fb3('0x2e')]=_[_0x4fb3('0x2b')](_0x283b86,_0x4fb3('0x28'));_0x5b9d64[_0x4fb3('0x2f')]=_[_0x4fb3('0x30')](_0x4752d3[_0x4fb3('0x2f')]);_0x5b9d64[_0x4fb3('0x31')]=_['intersection'](_0x5b9d64[_0x4fb3('0x2e')],_0x5b9d64[_0x4fb3('0x2f')]);_0x4bdfd5[_0x4fb3('0x32')]=_['intersection'](_0x5b9d64[_0x4fb3('0x2e')],qs[_0x4fb3('0x33')](_0x4752d3[_0x4fb3('0x2f')][_0x4fb3('0x33')]));_0x4bdfd5[_0x4fb3('0x32')]=_0x4bdfd5[_0x4fb3('0x32')][_0x4fb3('0x34')]?_0x4bdfd5[_0x4fb3('0x32')]:_0x5b9d64[_0x4fb3('0x2e')];if(!_0x4752d3['query']['hasOwnProperty'](_0x4fb3('0x35'))){_0x4bdfd5[_0x4fb3('0x1d')]=qs['limit'](_0x4752d3[_0x4fb3('0x2f')][_0x4fb3('0x1d')]);_0x4bdfd5['offset']=qs[_0x4fb3('0x1b')](_0x4752d3[_0x4fb3('0x2f')]['offset']);}_0x4bdfd5['order']=qs['sort'](_0x4752d3[_0x4fb3('0x2f')]['sort']);_0x4bdfd5[_0x4fb3('0x36')]=qs['filters'](_[_0x4fb3('0x37')](_0x4752d3[_0x4fb3('0x2f')],_0x5b9d64[_0x4fb3('0x31')]),_0x283b86);if(_0x4752d3[_0x4fb3('0x2f')][_0x4fb3('0x38')]){_0x4bdfd5['where']=_[_0x4fb3('0x39')](_0x4bdfd5['where'],{'$or':_[_0x4fb3('0x2b')](_0x283b86,function(_0x27cad3){if(_0x27cad3['type']!==_0x4fb3('0x3a')){var _0x4e6991={};_0x4e6991[_0x27cad3[_0x4fb3('0x28')]]={'$like':'%'+_0x4752d3['query'][_0x4fb3('0x38')]+'%'};return _0x4e6991;}})});}_0x4bdfd5=_['merge']({},_0x4bdfd5,_0x4752d3[_0x4fb3('0x3b')]);var _0x39806f={'where':_0x4bdfd5[_0x4fb3('0x36')]};return db[_0x4fb3('0x3c')][_0x4fb3('0x1e')](_0x39806f)[_0x4fb3('0x25')](function(_0x4d5b32){_0x414078[_0x4fb3('0x1e')]=_0x4d5b32;if(_0x4752d3[_0x4fb3('0x2f')]['includeAll']){_0x4bdfd5[_0x4fb3('0x3d')]=[{'all':!![]}];}return db[_0x4fb3('0x3c')][_0x4fb3('0x3e')](_0x4bdfd5);})[_0x4fb3('0x25')](function(_0x295a69){_0x414078['rows']=_0x295a69;return _0x414078;})[_0x4fb3('0x25')](respondWithFilteredResult(_0x2f5012,_0x4bdfd5))[_0x4fb3('0x3f')](handleError(_0x2f5012,null));};exports[_0x4fb3('0x40')]=function(_0x31434f,_0x47824b){var _0x37bee3={'raw':!![],'where':{'id':_0x31434f[_0x4fb3('0x41')]['id']}},_0x5a1c23={};_0x5a1c23[_0x4fb3('0x2e')]=_[_0x4fb3('0x30')](db['SalesforceField'][_0x4fb3('0x42')]);_0x5a1c23['query']=_[_0x4fb3('0x30')](_0x31434f[_0x4fb3('0x2f')]);_0x5a1c23[_0x4fb3('0x31')]=_[_0x4fb3('0x43')](_0x5a1c23[_0x4fb3('0x2e')],_0x5a1c23[_0x4fb3('0x2f')]);_0x37bee3[_0x4fb3('0x32')]=_[_0x4fb3('0x43')](_0x5a1c23['model'],qs[_0x4fb3('0x33')](_0x31434f[_0x4fb3('0x2f')]['fields']));_0x37bee3[_0x4fb3('0x32')]=_0x37bee3[_0x4fb3('0x32')][_0x4fb3('0x34')]?_0x37bee3['attributes']:_0x5a1c23[_0x4fb3('0x2e')];if(_0x31434f['query'][_0x4fb3('0x44')]){_0x37bee3['include']=[{'all':!![]}];}_0x37bee3=_['merge']({},_0x37bee3,_0x31434f[_0x4fb3('0x3b')]);return db[_0x4fb3('0x3c')]['find'](_0x37bee3)['then'](handleEntityNotFound(_0x47824b,null))[_0x4fb3('0x25')](respondWithResult(_0x47824b,null))[_0x4fb3('0x3f')](handleError(_0x47824b,null));};exports[_0x4fb3('0x45')]=function(_0x5f06a0,_0x1c0c4d){return db['SalesforceField']['create'](_0x5f06a0[_0x4fb3('0x46')],{})[_0x4fb3('0x25')](respondWithResult(_0x1c0c4d,0xc9))[_0x4fb3('0x3f')](handleError(_0x1c0c4d,null));};exports[_0x4fb3('0x24')]=function(_0x34769b,_0x256ef0){if(_0x34769b[_0x4fb3('0x46')]['id']){delete _0x34769b['body']['id'];}return db[_0x4fb3('0x3c')][_0x4fb3('0x47')]({'where':{'id':_0x34769b[_0x4fb3('0x41')]['id']}})[_0x4fb3('0x25')](handleEntityNotFound(_0x256ef0,null))[_0x4fb3('0x25')](saveUpdates(_0x34769b['body'],null))[_0x4fb3('0x25')](respondWithResult(_0x256ef0,null))[_0x4fb3('0x3f')](handleError(_0x256ef0,null));};exports[_0x4fb3('0x26')]=function(_0x45ff0f,_0x32a4af){return db[_0x4fb3('0x3c')][_0x4fb3('0x47')]({'where':{'id':_0x45ff0f[_0x4fb3('0x41')]['id']}})[_0x4fb3('0x25')](handleEntityNotFound(_0x32a4af,null))[_0x4fb3('0x25')](removeEntity(_0x32a4af,null))[_0x4fb3('0x3f')](handleError(_0x32a4af,null));}; \ No newline at end of file +var _0x1c68=['filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceField','fieldName','type','key','query','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1c68,0xe9));var _0x81c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c68[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x81c6('0x0'));var rimraf=require(_0x81c6('0x1'));var zipdir=require(_0x81c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81c6('0x3'));var moment=require(_0x81c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x81c6('0x5'));var util=require('util');var path=require(_0x81c6('0x6'));var sox=require(_0x81c6('0x7'));var csv=require(_0x81c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81c6('0x9'));var _=require(_0x81c6('0xa'));var squel=require(_0x81c6('0xb'));var crypto=require(_0x81c6('0xc'));var jsforce=require(_0x81c6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x81c6('0x8'));var querystring=require(_0x81c6('0xe'));var Papa=require('papaparse');var Redis=require(_0x81c6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x81c6('0x10'));var as=require(_0x81c6('0x11'));var hardwareService=require(_0x81c6('0x12'));var logger=require(_0x81c6('0x13'))(_0x81c6('0x14'));var utils=require(_0x81c6('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x244d49,_0x56671c){_0x56671c=_0x56671c||0xcc;return function(_0x54d9be){if(_0x54d9be){return _0x244d49[_0x81c6('0x16')](_0x56671c);}return _0x244d49[_0x81c6('0x17')](_0x56671c)[_0x81c6('0x18')]();};}function respondWithResult(_0x1c777c,_0x1430ea){_0x1430ea=_0x1430ea||0xc8;return function(_0x333476){if(_0x333476){return _0x1c777c[_0x81c6('0x17')](_0x1430ea)['json'](_0x333476);}};}function respondWithFilteredResult(_0x298d26,_0x1c1746){return function(_0x1259b4){if(_0x1259b4){var _0x420a01=typeof _0x1c1746[_0x81c6('0x19')]==='undefined'&&typeof _0x1c1746[_0x81c6('0x1a')]===_0x81c6('0x1b');var _0x12e2c5=_0x1259b4[_0x81c6('0x1c')];var _0x51143c=_0x420a01?0x0:_0x1c1746['offset'];var _0x455a22=_0x420a01?_0x1259b4['count']:_0x1c1746[_0x81c6('0x19')]+_0x1c1746[_0x81c6('0x1a')];var _0xc194dc;if(_0x455a22>=_0x12e2c5){_0x455a22=_0x12e2c5;_0xc194dc=0xc8;}else{_0xc194dc=0xce;}_0x298d26[_0x81c6('0x17')](_0xc194dc);return _0x298d26[_0x81c6('0x1d')]('Content-Range',_0x51143c+'-'+_0x455a22+'/'+_0x12e2c5)[_0x81c6('0x1e')](_0x1259b4);}return null;};}function patchUpdates(_0xe4e9a2){return function(_0x16be6a){try{jsonpatch['apply'](_0x16be6a,_0xe4e9a2,!![]);}catch(_0x1ac13d){return BPromise[_0x81c6('0x1f')](_0x1ac13d);}return _0x16be6a['save']();};}function saveUpdates(_0x20ddb0,_0x47a6a3){return function(_0x20cf6c){if(_0x20cf6c){return _0x20cf6c[_0x81c6('0x20')](_0x20ddb0)[_0x81c6('0x21')](function(_0x5cc9ad){return _0x5cc9ad;});}return null;};}function removeEntity(_0x45cddf,_0x36ef69){return function(_0xe5f62b){if(_0xe5f62b){return _0xe5f62b[_0x81c6('0x22')]()[_0x81c6('0x21')](function(){_0x45cddf[_0x81c6('0x17')](0xcc)[_0x81c6('0x18')]();});}};}function handleEntityNotFound(_0x15ae60,_0x4d9fe9){return function(_0x21abde){if(!_0x21abde){_0x15ae60[_0x81c6('0x16')](0x194);}return _0x21abde;};}function handleError(_0x3dca3c,_0x52b121){_0x52b121=_0x52b121||0x1f4;return function(_0x530a5a){logger[_0x81c6('0x23')](_0x530a5a[_0x81c6('0x24')]);if(_0x530a5a[_0x81c6('0x25')]){delete _0x530a5a[_0x81c6('0x25')];}_0x3dca3c[_0x81c6('0x17')](_0x52b121)[_0x81c6('0x26')](_0x530a5a);};}exports[_0x81c6('0x27')]=function(_0x235489,_0x26fcbd){var _0x3fec70={},_0x4ed7e7={},_0x1a0fdf={'count':0x0,'rows':[]};var _0xc25ded=_[_0x81c6('0x28')](db[_0x81c6('0x29')]['rawAttributes'],function(_0x120f02){return{'name':_0x120f02[_0x81c6('0x2a')],'type':_0x120f02[_0x81c6('0x2b')][_0x81c6('0x2c')]};});_0x4ed7e7['model']=_[_0x81c6('0x28')](_0xc25ded,'name');_0x4ed7e7[_0x81c6('0x2d')]=_[_0x81c6('0x2e')](_0x235489['query']);_0x4ed7e7[_0x81c6('0x2f')]=_[_0x81c6('0x30')](_0x4ed7e7[_0x81c6('0x31')],_0x4ed7e7[_0x81c6('0x2d')]);_0x3fec70['attributes']=_[_0x81c6('0x30')](_0x4ed7e7[_0x81c6('0x31')],qs[_0x81c6('0x32')](_0x235489['query'][_0x81c6('0x32')]));_0x3fec70['attributes']=_0x3fec70['attributes']['length']?_0x3fec70[_0x81c6('0x33')]:_0x4ed7e7[_0x81c6('0x31')];if(!_0x235489[_0x81c6('0x2d')][_0x81c6('0x34')]('nolimit')){_0x3fec70[_0x81c6('0x1a')]=qs[_0x81c6('0x1a')](_0x235489[_0x81c6('0x2d')][_0x81c6('0x1a')]);_0x3fec70[_0x81c6('0x19')]=qs['offset'](_0x235489[_0x81c6('0x2d')][_0x81c6('0x19')]);}_0x3fec70[_0x81c6('0x35')]=qs[_0x81c6('0x36')](_0x235489[_0x81c6('0x2d')]['sort']);_0x3fec70[_0x81c6('0x37')]=qs['filters'](_['pick'](_0x235489['query'],_0x4ed7e7[_0x81c6('0x2f')]),_0xc25ded);if(_0x235489[_0x81c6('0x2d')][_0x81c6('0x38')]){_0x3fec70[_0x81c6('0x37')]=_[_0x81c6('0x39')](_0x3fec70[_0x81c6('0x37')],{'$or':_[_0x81c6('0x28')](_0xc25ded,function(_0x7a274e){if(_0x7a274e[_0x81c6('0x2b')]!==_0x81c6('0x3a')){var _0x4d086e={};_0x4d086e[_0x7a274e[_0x81c6('0x25')]]={'$like':'%'+_0x235489['query']['filter']+'%'};return _0x4d086e;}})});}_0x3fec70=_[_0x81c6('0x39')]({},_0x3fec70,_0x235489['options']);var _0x3f4fbf={'where':_0x3fec70['where']};return db[_0x81c6('0x29')]['count'](_0x3f4fbf)[_0x81c6('0x21')](function(_0x579dc2){_0x1a0fdf[_0x81c6('0x1c')]=_0x579dc2;if(_0x235489[_0x81c6('0x2d')][_0x81c6('0x3b')]){_0x3fec70[_0x81c6('0x3c')]=[{'all':!![]}];}return db[_0x81c6('0x29')][_0x81c6('0x3d')](_0x3fec70);})[_0x81c6('0x21')](function(_0x119ff2){_0x1a0fdf[_0x81c6('0x3e')]=_0x119ff2;return _0x1a0fdf;})[_0x81c6('0x21')](respondWithFilteredResult(_0x26fcbd,_0x3fec70))[_0x81c6('0x3f')](handleError(_0x26fcbd,null));};exports[_0x81c6('0x40')]=function(_0x283f3d,_0x466f73){var _0x4bf2d0={'raw':!![],'where':{'id':_0x283f3d[_0x81c6('0x41')]['id']}},_0x18f433={};_0x18f433[_0x81c6('0x31')]=_['keys'](db[_0x81c6('0x29')]['rawAttributes']);_0x18f433[_0x81c6('0x2d')]=_[_0x81c6('0x2e')](_0x283f3d[_0x81c6('0x2d')]);_0x18f433[_0x81c6('0x2f')]=_[_0x81c6('0x30')](_0x18f433[_0x81c6('0x31')],_0x18f433[_0x81c6('0x2d')]);_0x4bf2d0[_0x81c6('0x33')]=_[_0x81c6('0x30')](_0x18f433[_0x81c6('0x31')],qs['fields'](_0x283f3d[_0x81c6('0x2d')][_0x81c6('0x32')]));_0x4bf2d0['attributes']=_0x4bf2d0[_0x81c6('0x33')][_0x81c6('0x42')]?_0x4bf2d0[_0x81c6('0x33')]:_0x18f433['model'];if(_0x283f3d[_0x81c6('0x2d')][_0x81c6('0x3b')]){_0x4bf2d0[_0x81c6('0x3c')]=[{'all':!![]}];}_0x4bf2d0=_['merge']({},_0x4bf2d0,_0x283f3d['options']);return db[_0x81c6('0x29')][_0x81c6('0x43')](_0x4bf2d0)[_0x81c6('0x21')](handleEntityNotFound(_0x466f73,null))['then'](respondWithResult(_0x466f73,null))['catch'](handleError(_0x466f73,null));};exports['create']=function(_0x333ab3,_0x8d123a){return db[_0x81c6('0x29')][_0x81c6('0x44')](_0x333ab3[_0x81c6('0x45')],{})[_0x81c6('0x21')](respondWithResult(_0x8d123a,0xc9))['catch'](handleError(_0x8d123a,null));};exports[_0x81c6('0x20')]=function(_0x256b9a,_0x3650e3){if(_0x256b9a[_0x81c6('0x45')]['id']){delete _0x256b9a['body']['id'];}return db['SalesforceField'][_0x81c6('0x43')]({'where':{'id':_0x256b9a[_0x81c6('0x41')]['id']}})[_0x81c6('0x21')](handleEntityNotFound(_0x3650e3,null))[_0x81c6('0x21')](saveUpdates(_0x256b9a[_0x81c6('0x45')],null))[_0x81c6('0x21')](respondWithResult(_0x3650e3,null))[_0x81c6('0x3f')](handleError(_0x3650e3,null));};exports[_0x81c6('0x22')]=function(_0x22f8cc,_0x328b46){return db[_0x81c6('0x29')]['find']({'where':{'id':_0x22f8cc[_0x81c6('0x41')]['id']}})[_0x81c6('0x21')](handleEntityNotFound(_0x328b46,null))[_0x81c6('0x21')](removeEntity(_0x328b46,null))[_0x81c6('0x3f')](handleError(_0x328b46,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index f8b0915..39d5729 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 _0x5e59=['idField','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x196138,_0x49e7eb){var _0x564081=function(_0x3679ed){while(--_0x3679ed){_0x196138['push'](_0x196138['shift']());}};_0x564081(++_0x49e7eb);}(_0x5e59,0xb7));var _0x95e5=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x5e59[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0x95e5('0x0'));var util=require(_0x95e5('0x1'));var logger=require(_0x95e5('0x2'))(_0x95e5('0x3'));var moment=require(_0x95e5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x95e5('0x5'));var rimraf=require(_0x95e5('0x6'));var config=require(_0x95e5('0x7'));var attributes=require(_0x95e5('0x8'));module['exports']=function(_0x44c2ef,_0x590c6d){return _0x44c2ef['define'](_0x95e5('0x9'),attributes,{'tableName':_0x95e5('0xa'),'paranoid':![],'indexes':[{'name':_0x95e5('0xb'),'fields':[_0x95e5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22a8=['request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','moment'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x22a8,0x1bc));var _0x822a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x22a8[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x822a('0x0'));var util=require(_0x822a('0x1'));var logger=require(_0x822a('0x2'))('api');var moment=require(_0x822a('0x3'));var BPromise=require('bluebird');var rp=require(_0x822a('0x4'));var fs=require('fs');var path=require(_0x822a('0x5'));var rimraf=require('rimraf');var config=require(_0x822a('0x6'));var attributes=require(_0x822a('0x7'));module[_0x822a('0x8')]=function(_0x32c67f,_0x460f90){return _0x32c67f[_0x822a('0x9')](_0x822a('0xa'),attributes,{'tableName':_0x822a('0xb'),'paranoid':![],'indexes':[{'name':_0x822a('0xc'),'fields':[_0x822a('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 232a5a1..bd0601c 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 _0x3c12=['SalesforceField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x3c12,0x17b));var _0x23c1=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0x3c12[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require('lodash');var util=require(_0x23c1('0x0'));var moment=require(_0x23c1('0x1'));var BPromise=require(_0x23c1('0x2'));var rs=require(_0x23c1('0x3'));var fs=require('fs');var Redis=require(_0x23c1('0x4'));var db=require(_0x23c1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23c1('0x6'))(_0x23c1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x23c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x449976,_0x593288,_0x5d2241){return new BPromise(function(_0x4e4995,_0x1fbe4d){return client[_0x23c1('0x9')](_0x449976,_0x5d2241)[_0x23c1('0xa')](function(_0x3564fe){logger['info']('SalesforceField,\x20%s,\x20%s',_0x593288,_0x23c1('0xb'));logger[_0x23c1('0xc')](_0x23c1('0xd'),_0x593288,'request\x20sent',JSON[_0x23c1('0xe')](_0x3564fe));if(_0x3564fe['error']){if(_0x3564fe[_0x23c1('0xf')][_0x23c1('0x10')]===0x1f4){logger[_0x23c1('0xf')](_0x23c1('0x11'),_0x593288,_0x3564fe[_0x23c1('0xf')][_0x23c1('0x12')]);return _0x1fbe4d(_0x3564fe[_0x23c1('0xf')][_0x23c1('0x12')]);}logger[_0x23c1('0xf')](_0x23c1('0x11'),_0x593288,_0x3564fe[_0x23c1('0xf')]['message']);return _0x4e4995(_0x3564fe['error'][_0x23c1('0x12')]);}else{logger[_0x23c1('0x13')](_0x23c1('0x11'),_0x593288,_0x23c1('0xb'));_0x4e4995(_0x3564fe[_0x23c1('0x14')][_0x23c1('0x12')]);}})[_0x23c1('0x15')](function(_0xad1dd6){logger[_0x23c1('0xf')]('SalesforceField,\x20%s,\x20%s',_0x593288,_0xad1dd6);_0x1fbe4d(_0xad1dd6);});});} \ No newline at end of file +var _0x91fc=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x33f8a4,_0x310378){var _0x1eba50=function(_0x4a64c2){while(--_0x4a64c2){_0x33f8a4['push'](_0x33f8a4['shift']());}};_0x1eba50(++_0x310378);}(_0x91fc,0x11e));var _0xc91f=function(_0x1ebf81,_0x1f684e){_0x1ebf81=_0x1ebf81-0x0;var _0x266c66=_0x91fc[_0x1ebf81];return _0x266c66;};'use strict';var _=require('lodash');var util=require(_0xc91f('0x0'));var moment=require(_0xc91f('0x1'));var BPromise=require(_0xc91f('0x2'));var rs=require(_0xc91f('0x3'));var fs=require('fs');var Redis=require(_0xc91f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc91f('0x5'));var logger=require(_0xc91f('0x6'))('rpc');var config=require(_0xc91f('0x7'));var jayson=require(_0xc91f('0x8'));var client=jayson[_0xc91f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe00544,_0x38d3a7,_0x28d167){return new BPromise(function(_0x2fd9d6,_0x31e3a5){return client[_0xc91f('0xa')](_0xe00544,_0x28d167)[_0xc91f('0xb')](function(_0xdcdd2c){logger[_0xc91f('0xc')](_0xc91f('0xd'),_0x38d3a7,_0xc91f('0xe'));logger['debug'](_0xc91f('0xf'),_0x38d3a7,_0xc91f('0xe'),JSON[_0xc91f('0x10')](_0xdcdd2c));if(_0xdcdd2c['error']){if(_0xdcdd2c[_0xc91f('0x11')][_0xc91f('0x12')]===0x1f4){logger[_0xc91f('0x11')](_0xc91f('0xd'),_0x38d3a7,_0xdcdd2c['error'][_0xc91f('0x13')]);return _0x31e3a5(_0xdcdd2c['error'][_0xc91f('0x13')]);}logger[_0xc91f('0x11')](_0xc91f('0xd'),_0x38d3a7,_0xdcdd2c[_0xc91f('0x11')][_0xc91f('0x13')]);return _0x2fd9d6(_0xdcdd2c['error'][_0xc91f('0x13')]);}else{logger[_0xc91f('0xc')](_0xc91f('0xd'),_0x38d3a7,_0xc91f('0xe'));_0x2fd9d6(_0xdcdd2c[_0xc91f('0x14')][_0xc91f('0x13')]);}})[_0xc91f('0x15')](function(_0x5a0908){logger[_0xc91f('0x11')](_0xc91f('0xd'),_0x38d3a7,_0x5a0908);_0x31e3a5(_0x5a0908);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 8cf7a46..fcb808a 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 _0x8150=['addConfiguration','put','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x8150,0x1a7));var _0x0815=function(_0x5d7141,_0x51567a){_0x5d7141=_0x5d7141-0x0;var _0x2c00a9=_0x8150[_0x5d7141];return _0x2c00a9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0815('0x0'));var express=require(_0x0815('0x1'));var router=express[_0x0815('0x2')]();var fs_extra=require(_0x0815('0x3'));var auth=require(_0x0815('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0815('0x5'));var controller=require('./intServicenowAccount.controller');router[_0x0815('0x6')]('/',auth[_0x0815('0x7')](),controller[_0x0815('0x8')]);router['get'](_0x0815('0x9'),auth[_0x0815('0x7')](),controller[_0x0815('0xa')]);router[_0x0815('0x6')](_0x0815('0xb'),auth[_0x0815('0x7')](),controller[_0x0815('0xc')]);router[_0x0815('0x6')](_0x0815('0xd'),auth[_0x0815('0x7')](),controller[_0x0815('0xe')]);router[_0x0815('0xf')]('/',auth['isAuthenticated'](),controller[_0x0815('0x10')]);router[_0x0815('0xf')]('/:id/configurations',auth[_0x0815('0x7')](),controller[_0x0815('0x11')]);router[_0x0815('0x12')]('/:id',auth[_0x0815('0x7')](),controller[_0x0815('0x13')]);router[_0x0815('0x14')](_0x0815('0x9'),auth[_0x0815('0x7')](),controller['destroy']);module[_0x0815('0x15')]=router; \ No newline at end of file +var _0x8b2b=['../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','create','post','addConfiguration','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x485424,_0x42fa1c){var _0x4a94d0=function(_0x156297){while(--_0x156297){_0x485424['push'](_0x485424['shift']());}};_0x4a94d0(++_0x42fa1c);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x4a0c81,_0x51da83){_0x4a0c81=_0x4a0c81-0x0;var _0x55cab3=_0x8b2b[_0x4a0c81];return _0x55cab3;};'use strict';var multer=require(_0xb8b2('0x0'));var util=require(_0xb8b2('0x1'));var path=require(_0xb8b2('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8b2('0x3'));var router=express[_0xb8b2('0x4')]();var fs_extra=require(_0xb8b2('0x5'));var auth=require(_0xb8b2('0x6'));var interaction=require(_0xb8b2('0x7'));var config=require(_0xb8b2('0x8'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0xb8b2('0x9')](),controller[_0xb8b2('0xa')]);router[_0xb8b2('0xb')](_0xb8b2('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb8b2('0xb')](_0xb8b2('0xd'),auth[_0xb8b2('0x9')](),controller[_0xb8b2('0xe')]);router[_0xb8b2('0xb')]('/:id/fields',auth[_0xb8b2('0x9')](),controller['getFields']);router['post']('/',auth[_0xb8b2('0x9')](),controller[_0xb8b2('0xf')]);router[_0xb8b2('0x10')](_0xb8b2('0xd'),auth[_0xb8b2('0x9')](),controller[_0xb8b2('0x11')]);router['put'](_0xb8b2('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb8b2('0xc'),auth[_0xb8b2('0x9')](),controller['destroy']);module[_0xb8b2('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 9215b77..38cb07a 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 _0xbcbb=['STRING','username','remoteUri','sequelize','exports'];(function(_0x10346c,_0x53d695){var _0x59330d=function(_0x189f09){while(--_0x189f09){_0x10346c['push'](_0x10346c['shift']());}};_0x59330d(++_0x53d695);}(_0xbcbb,0x111));var _0xbbcb=function(_0x3434d7,_0x4d4eb0){_0x3434d7=_0x3434d7-0x0;var _0x51eebd=_0xbcbb[_0x3434d7];return _0x51eebd;};'use strict';var Sequelize=require(_0xbbcb('0x0'));module[_0xbbcb('0x1')]={'name':{'type':Sequelize[_0xbbcb('0x2')]},'description':{'type':Sequelize[_0xbbcb('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xbbcb('0x3')},'password':{'type':Sequelize[_0xbbcb('0x2')]},'email':{'type':Sequelize[_0xbbcb('0x2')]},'remoteUri':{'type':Sequelize[_0xbbcb('0x2')],'unique':_0xbbcb('0x4')},'serverUrl':{'type':Sequelize[_0xbbcb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x44ad=['STRING','username','remoteUri','sequelize','exports'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x44ad,0xb2));var _0xd44a=function(_0x2787e4,_0x3a4e67){_0x2787e4=_0x2787e4-0x0;var _0x530722=_0x44ad[_0x2787e4];return _0x530722;};'use strict';var Sequelize=require(_0xd44a('0x0'));module[_0xd44a('0x1')]={'name':{'type':Sequelize[_0xd44a('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xd44a('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd44a('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd44a('0x4')},'serverUrl':{'type':Sequelize[_0xd44a('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 75f35eb..589d4c6 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 _0x8690=['format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','GET','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','send','index','map','ServicenowAccount','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','update','body','getConfigurations','addConfiguration','Subjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','close_code','notify','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','knowledge','order','calendar_stc','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','business_duration','group_list','work_end','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','category','findOne','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf'];(function(_0x448af8,_0x557881){var _0x201bf9=function(_0xaea341){while(--_0xaea341){_0x448af8['push'](_0x448af8['shift']());}};_0x201bf9(++_0x557881);}(_0x8690,0x192));var _0x0869=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x8690[_0x288f5e];return _0x476cc9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0869('0x0'));var zipdir=require(_0x0869('0x1'));var jsonpatch=require(_0x0869('0x2'));var rp=require(_0x0869('0x3'));var moment=require(_0x0869('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0869('0x5'));var util=require(_0x0869('0x6'));var path=require(_0x0869('0x7'));var sox=require(_0x0869('0x8'));var csv=require(_0x0869('0x9'));var ejs=require(_0x0869('0xa'));var fs=require('fs');var fs_extra=require(_0x0869('0xb'));var _=require(_0x0869('0xc'));var squel=require('squel');var crypto=require(_0x0869('0xd'));var jsforce=require(_0x0869('0xe'));var deskjs=require(_0x0869('0xf'));var toCsv=require(_0x0869('0x9'));var querystring=require(_0x0869('0x10'));var Papa=require(_0x0869('0x11'));var Redis=require(_0x0869('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0869('0x13'));var hardwareService=require(_0x0869('0x14'));var logger=require(_0x0869('0x15'))(_0x0869('0x16'));var utils=require(_0x0869('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0869('0x18'));var db=require(_0x0869('0x19'))['db'];var integrations=require(_0x0869('0x1a'));function respondWithStatusCode(_0x24c5d3,_0x46ff6b){_0x46ff6b=_0x46ff6b||0xcc;return function(_0x33c0e1){if(_0x33c0e1){return _0x24c5d3[_0x0869('0x1b')](_0x46ff6b);}return _0x24c5d3[_0x0869('0x1c')](_0x46ff6b)[_0x0869('0x1d')]();};}function respondWithResult(_0x44f41a,_0x25d87f){_0x25d87f=_0x25d87f||0xc8;return function(_0x30b4cb){if(_0x30b4cb){return _0x44f41a[_0x0869('0x1c')](_0x25d87f)[_0x0869('0x1e')](_0x30b4cb);}};}function respondWithFilteredResult(_0x227dee,_0x4b4faa){return function(_0x4a3fbc){if(_0x4a3fbc){var _0x1b7766=typeof _0x4b4faa[_0x0869('0x1f')]===_0x0869('0x20')&&typeof _0x4b4faa[_0x0869('0x21')]==='undefined';var _0x836340=_0x4a3fbc[_0x0869('0x22')];var _0x248112=_0x1b7766?0x0:_0x4b4faa[_0x0869('0x1f')];var _0x10594a=_0x1b7766?_0x4a3fbc[_0x0869('0x22')]:_0x4b4faa[_0x0869('0x1f')]+_0x4b4faa[_0x0869('0x21')];var _0x492b31;if(_0x10594a>=_0x836340){_0x10594a=_0x836340;_0x492b31=0xc8;}else{_0x492b31=0xce;}_0x227dee[_0x0869('0x1c')](_0x492b31);return _0x227dee['set']('Content-Range',_0x248112+'-'+_0x10594a+'/'+_0x836340)['json'](_0x4a3fbc);}return null;};}function patchUpdates(_0x347948){return function(_0x5cbae9){try{jsonpatch[_0x0869('0x23')](_0x5cbae9,_0x347948,!![]);}catch(_0x19758e){return BPromise[_0x0869('0x24')](_0x19758e);}return _0x5cbae9[_0x0869('0x25')]();};}function saveUpdates(_0x1fdc51,_0x4e7f9b){return function(_0x27602e){if(_0x27602e){return _0x27602e['update'](_0x1fdc51)[_0x0869('0x26')](function(_0x1654bd){return _0x1654bd;});}return null;};}function removeEntity(_0x5152e6,_0x5ab088){return function(_0x478875){if(_0x478875){return _0x478875[_0x0869('0x27')]()['then'](function(){_0x5152e6[_0x0869('0x1c')](0xcc)[_0x0869('0x1d')]();});}};}function handleEntityNotFound(_0x541687,_0x4d5816){return function(_0x3a9f4e){if(!_0x3a9f4e){_0x541687[_0x0869('0x1b')](0x194);}return _0x3a9f4e;};}function handleError(_0x2ef7ba,_0x551983){_0x551983=_0x551983||0x1f4;return function(_0x347407){logger[_0x0869('0x28')](_0x347407[_0x0869('0x29')]);if(_0x347407['name']){delete _0x347407[_0x0869('0x2a')];}_0x2ef7ba[_0x0869('0x1c')](_0x551983)[_0x0869('0x2b')](_0x347407);};}exports[_0x0869('0x2c')]=function(_0x200f60,_0x556e10){var _0x3f83f7={},_0x17c346={},_0x53031a={'count':0x0,'rows':[]};var _0x2d9a7b=_[_0x0869('0x2d')](db[_0x0869('0x2e')]['rawAttributes'],function(_0x2ec900){return{'name':_0x2ec900['fieldName'],'type':_0x2ec900[_0x0869('0x2f')][_0x0869('0x30')]};});_0x17c346[_0x0869('0x31')]=_[_0x0869('0x2d')](_0x2d9a7b,_0x0869('0x2a'));_0x17c346[_0x0869('0x32')]=_['keys'](_0x200f60[_0x0869('0x32')]);_0x17c346['filters']=_[_0x0869('0x33')](_0x17c346['model'],_0x17c346['query']);_0x3f83f7[_0x0869('0x34')]=_[_0x0869('0x33')](_0x17c346[_0x0869('0x31')],qs['fields'](_0x200f60['query'][_0x0869('0x35')]));_0x3f83f7[_0x0869('0x34')]=_0x3f83f7[_0x0869('0x34')]['length']?_0x3f83f7['attributes']:_0x17c346['model'];if(!_0x200f60['query'][_0x0869('0x36')](_0x0869('0x37'))){_0x3f83f7[_0x0869('0x21')]=qs[_0x0869('0x21')](_0x200f60['query'][_0x0869('0x21')]);_0x3f83f7[_0x0869('0x1f')]=qs[_0x0869('0x1f')](_0x200f60['query'][_0x0869('0x1f')]);}_0x3f83f7['order']=qs[_0x0869('0x38')](_0x200f60[_0x0869('0x32')][_0x0869('0x38')]);_0x3f83f7[_0x0869('0x39')]=qs[_0x0869('0x3a')](_[_0x0869('0x3b')](_0x200f60[_0x0869('0x32')],_0x17c346['filters']),_0x2d9a7b);if(_0x200f60[_0x0869('0x32')][_0x0869('0x3c')]){_0x3f83f7[_0x0869('0x39')]=_[_0x0869('0x3d')](_0x3f83f7['where'],{'$or':_['map'](_0x2d9a7b,function(_0x1b48bc){if(_0x1b48bc[_0x0869('0x2f')]!==_0x0869('0x3e')){var _0x30347a={};_0x30347a[_0x1b48bc[_0x0869('0x2a')]]={'$like':'%'+_0x200f60[_0x0869('0x32')]['filter']+'%'};return _0x30347a;}})});}_0x3f83f7=_[_0x0869('0x3d')]({},_0x3f83f7,_0x200f60[_0x0869('0x3f')]);var _0x1d25c7={'where':_0x3f83f7[_0x0869('0x39')]};return db[_0x0869('0x2e')][_0x0869('0x22')](_0x1d25c7)['then'](function(_0x1a6602){_0x53031a['count']=_0x1a6602;if(_0x200f60[_0x0869('0x32')][_0x0869('0x40')]){_0x3f83f7[_0x0869('0x41')]=[{'all':!![]}];}return db[_0x0869('0x2e')][_0x0869('0x42')](_0x3f83f7);})[_0x0869('0x26')](function(_0x257d92){_0x53031a['rows']=_0x257d92;return _0x53031a;})[_0x0869('0x26')](respondWithFilteredResult(_0x556e10,_0x3f83f7))[_0x0869('0x43')](handleError(_0x556e10,null));};exports[_0x0869('0x44')]=function(_0x9e227a,_0x1a484a){var _0x410244={'raw':![],'where':{'id':_0x9e227a[_0x0869('0x45')]['id']}},_0x5961cf={};_0x5961cf[_0x0869('0x31')]=_[_0x0869('0x46')](db[_0x0869('0x2e')][_0x0869('0x47')]);_0x5961cf[_0x0869('0x32')]=_[_0x0869('0x46')](_0x9e227a[_0x0869('0x32')]);_0x5961cf['filters']=_[_0x0869('0x33')](_0x5961cf['model'],_0x5961cf[_0x0869('0x32')]);_0x410244[_0x0869('0x34')]=_[_0x0869('0x33')](_0x5961cf[_0x0869('0x31')],qs[_0x0869('0x35')](_0x9e227a['query'][_0x0869('0x35')]));_0x410244[_0x0869('0x34')]=_0x410244[_0x0869('0x34')][_0x0869('0x48')]?_0x410244[_0x0869('0x34')]:_0x5961cf[_0x0869('0x31')];if(_0x9e227a[_0x0869('0x32')][_0x0869('0x40')]){_0x410244[_0x0869('0x41')]=[{'all':!![]}];}_0x410244=_['merge']({},_0x410244,_0x9e227a['options']);return db[_0x0869('0x2e')][_0x0869('0x49')](_0x410244)[_0x0869('0x26')](handleEntityNotFound(_0x1a484a,null))[_0x0869('0x26')](respondWithResult(_0x1a484a,null))[_0x0869('0x43')](handleError(_0x1a484a,null));};exports[_0x0869('0x4a')]=function(_0x26f0fe,_0x1d952f){return db[_0x0869('0x2e')][_0x0869('0x4a')](_0x26f0fe['body'],{})[_0x0869('0x26')](respondWithResult(_0x1d952f,0xc9))[_0x0869('0x43')](handleError(_0x1d952f,null));};exports[_0x0869('0x4b')]=function(_0xc2a6d6,_0x45d573){if(_0xc2a6d6[_0x0869('0x4c')]['id']){delete _0xc2a6d6[_0x0869('0x4c')]['id'];}return db[_0x0869('0x2e')][_0x0869('0x49')]({'where':{'id':_0xc2a6d6[_0x0869('0x45')]['id']}})[_0x0869('0x26')](handleEntityNotFound(_0x45d573,null))['then'](saveUpdates(_0xc2a6d6[_0x0869('0x4c')],null))[_0x0869('0x26')](respondWithResult(_0x45d573,null))[_0x0869('0x43')](handleError(_0x45d573,null));};exports[_0x0869('0x27')]=function(_0x4dbfc3,_0x58e92c){return db[_0x0869('0x2e')][_0x0869('0x49')]({'where':{'id':_0x4dbfc3[_0x0869('0x45')]['id']}})[_0x0869('0x26')](handleEntityNotFound(_0x58e92c,null))[_0x0869('0x26')](removeEntity(_0x58e92c,null))['catch'](handleError(_0x58e92c,null));};exports[_0x0869('0x4d')]=function(_0x4ce5a5,_0x3c8029,_0x1565ab){var _0x2da3e3={};var _0x7d97a2={};var _0x59e6ab;var _0x3ff16e;return db[_0x0869('0x2e')]['findOne']({'where':{'id':_0x4ce5a5[_0x0869('0x45')]['id']}})[_0x0869('0x26')](handleEntityNotFound(_0x3c8029,null))['then'](function(_0x157bfb){if(_0x157bfb){_0x59e6ab=_0x157bfb;_0x7d97a2[_0x0869('0x31')]=_['keys'](db['ServicenowConfiguration'][_0x0869('0x47')]);_0x7d97a2[_0x0869('0x32')]=_[_0x0869('0x46')](_0x4ce5a5[_0x0869('0x32')]);_0x7d97a2[_0x0869('0x3a')]=_[_0x0869('0x33')](_0x7d97a2[_0x0869('0x31')],_0x7d97a2[_0x0869('0x32')]);_0x2da3e3['attributes']=_['intersection'](_0x7d97a2[_0x0869('0x31')],qs[_0x0869('0x35')](_0x4ce5a5[_0x0869('0x32')][_0x0869('0x35')]));_0x2da3e3[_0x0869('0x34')]=_0x2da3e3[_0x0869('0x34')][_0x0869('0x48')]?_0x2da3e3[_0x0869('0x34')]:_0x7d97a2[_0x0869('0x31')];_0x2da3e3['order']=qs['sort'](_0x4ce5a5[_0x0869('0x32')]['sort']);_0x2da3e3[_0x0869('0x39')]=qs['filters'](_['pick'](_0x4ce5a5[_0x0869('0x32')],_0x7d97a2[_0x0869('0x3a')]));if(_0x4ce5a5['query'][_0x0869('0x3c')]){_0x2da3e3[_0x0869('0x39')]=_['merge'](_0x2da3e3[_0x0869('0x39')],{'$or':_[_0x0869('0x2d')](_0x2da3e3[_0x0869('0x34')],function(_0x165f4f){var _0x2b1d26={};_0x2b1d26[_0x165f4f]={'$like':'%'+_0x4ce5a5[_0x0869('0x32')][_0x0869('0x3c')]+'%'};return _0x2b1d26;})});}_0x2da3e3=_[_0x0869('0x3d')]({},_0x2da3e3,_0x4ce5a5['options']);return _0x59e6ab['getConfigurations'](_0x2da3e3);}})[_0x0869('0x26')](function(_0x4243c0){if(_0x4243c0){_0x3ff16e=_0x4243c0[_0x0869('0x48')];if(!_0x4ce5a5[_0x0869('0x32')][_0x0869('0x36')]('nolimit')){_0x2da3e3['limit']=qs[_0x0869('0x21')](_0x4ce5a5['query']['limit']);_0x2da3e3[_0x0869('0x1f')]=qs[_0x0869('0x1f')](_0x4ce5a5[_0x0869('0x32')][_0x0869('0x1f')]);}return _0x59e6ab['getConfigurations'](_0x2da3e3);}})[_0x0869('0x26')](function(_0x538b6b){if(_0x538b6b){return _0x538b6b?{'count':_0x3ff16e,'rows':_0x538b6b}:null;}})[_0x0869('0x26')](respondWithResult(_0x3c8029,null))[_0x0869('0x43')](handleError(_0x3c8029,null));};exports[_0x0869('0x4e')]=function(_0x448309,_0x4a7e31,_0x26e426){if(_0x448309['body']['id']){delete _0x448309['body']['id'];}return db[_0x0869('0x2e')]['findOne']({'where':{'id':_0x448309[_0x0869('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a7e31,null))[_0x0869('0x26')](function(_0x502b01){if(_0x502b01){_0x448309[_0x0869('0x4c')]['AccountId']=_0x502b01['id'];_0x448309[_0x0869('0x4c')][_0x0869('0x4f')]=integrations['getSubjects'](_0x448309[_0x0869('0x4c')][_0x0869('0x50')],_0x448309['body'][_0x0869('0x2f')]);_0x448309[_0x0869('0x4c')]['Descriptions']=integrations[_0x0869('0x51')](_0x448309[_0x0869('0x4c')]['channel'],_0x448309['body'][_0x0869('0x2f')]);return db[_0x0869('0x52')][_0x0869('0x4a')](_0x448309[_0x0869('0x4c')],{'include':[{'model':db[_0x0869('0x53')],'as':_0x0869('0x4f')},{'model':db[_0x0869('0x53')],'as':'Descriptions'}]});}return null;})[_0x0869('0x26')](respondWithResult(_0x4a7e31,null))['catch'](handleError(_0x4a7e31,null));};exports[_0x0869('0x54')]=function(_0x425471,_0x1e15c5,_0x2aca1e){var _0x42cb91=[_0x0869('0x55'),_0x0869('0x56'),'knowledge','subcategory',_0x0869('0x57'),_0x0869('0x58'),_0x0869('0x59'),_0x0869('0x5a'),'category'];var _0x5bf811=[_0x0869('0x5b'),_0x0869('0x55'),_0x0869('0x5c'),'watch_list',_0x0869('0x5d'),_0x0869('0x5e'),_0x0869('0x5f'),_0x0869('0x56'),_0x0869('0x60'),_0x0869('0x61'),_0x0869('0x62'),'sys_updated_by',_0x0869('0x63'),_0x0869('0x64'),_0x0869('0x65'),_0x0869('0x66'),_0x0869('0x67'),'sys_created_by',_0x0869('0x68'),_0x0869('0x69'),_0x0869('0x6a'),'closed_at','cmdb_ci',_0x0869('0x6b'),'impact',_0x0869('0x6c'),_0x0869('0x6d'),_0x0869('0x6e'),_0x0869('0x6f'),_0x0869('0x70'),'rfc',_0x0869('0x71'),_0x0869('0x72'),'opened_at',_0x0869('0x73'),_0x0869('0x74'),_0x0869('0x75'),'reopened_time','resolved_at',_0x0869('0x76'),_0x0869('0x77'),_0x0869('0x78'),_0x0869('0x79'),_0x0869('0x7a'),_0x0869('0x57'),_0x0869('0x7b'),_0x0869('0x7c'),'work_start',_0x0869('0x7d'),_0x0869('0x7e'),'additional_assignee_list',_0x0869('0x7f'),_0x0869('0x80'),_0x0869('0x58'),'sys_class_name',_0x0869('0x81'),_0x0869('0x82'),_0x0869('0x83'),_0x0869('0x84'),_0x0869('0x85'),_0x0869('0x86'),'reopened_by',_0x0869('0x59'),_0x0869('0x87'),_0x0869('0x88'),_0x0869('0x89'),'reassignment_count',_0x0869('0x8a'),_0x0869('0x8b'),'severity',_0x0869('0x8c'),_0x0869('0x8d'),_0x0869('0x8e'),'comments_and_work_notes',_0x0869('0x8f'),_0x0869('0x90'),_0x0869('0x91'),_0x0869('0x92'),_0x0869('0x93'),'upon_approval',_0x0869('0x94'),_0x0869('0x95'),_0x0869('0x96')];var _0x133814='';var _0x2bc757='';var _0x2fa638=[];var _0x31cabd='';var _0x4263bf='';var _0x12476b=[];var _0x3dd76c='';var _0x5619cb='';var _0x52d432={};var _0x440898='';return db[_0x0869('0x2e')][_0x0869('0x97')]({'where':{'id':_0x425471[_0x0869('0x45')]['id']},'attributes':['id',_0x0869('0x98'),_0x0869('0x99'),'email',_0x0869('0x9a'),_0x0869('0x9b')]})['then'](handleEntityNotFound(_0x1e15c5,null))[_0x0869('0x26')](function(_0x3a3d56){if(_0x3a3d56){_0x440898=_0x3a3d56[_0x0869('0x9a')];var _0x507231=_0x440898[_0x0869('0x9c')](-0x1);if(_0x507231==='/'){_0x440898=_0x440898[_0x0869('0x9d')](0x0,_0x440898[_0x0869('0x9e')](_0x507231));}_0x5619cb=util[_0x0869('0x9f')](_0x0869('0xa0'),_0x440898);_0x3dd76c=util[_0x0869('0x9f')](_0x0869('0xa1'),_0x440898);_0x52d432={'user':_0x3a3d56[_0x0869('0x98')],'pass':_0x3a3d56[_0x0869('0x99')]};var _0x249e0e={'method':'GET','uri':_0x5619cb+_0x0869('0xa2'),'auth':_0x52d432,'json':!![]};return rp(_0x249e0e);}})[_0x0869('0x26')](function(_0x45c428){if(_0x45c428['result'][_0x0869('0x48')]>0x0){_0x133814=_0x45c428[_0x0869('0xa3')];}console[_0x0869('0xa4')](_0x0869('0xa5'),_0x133814);_0x12476b=[];_0x2bc757=Object[_0x0869('0xa6')]([],_0x133814);_[_0x0869('0xa7')](_0x2bc757,function(_0x6f25d9){return!_0x42cb91[_0x0869('0xa8')](_0x6f25d9[_0x0869('0x2a')]);});_0x2bc757[_0x0869('0xa9')](function(_0x1f915f){var _0x1e7b51=createFieldObject(_0x3dd76c,_0x52d432,_0x1f915f[_0x0869('0xaa')],_0x1f915f[_0x0869('0x2a')],_0x1f915f[_0x0869('0xab')],![]);_0x12476b[_0x0869('0xac')](_0x1e7b51);});return Promise['all'](_0x12476b);})[_0x0869('0x26')](function(_0x2f9362){_0x2fa638=_0x2f9362;_0x31cabd=Object['assign']([],_0x133814);console['log']('TCL:\x20_object',_0x133814);_[_0x0869('0xa7')](_0x31cabd,function(_0x5632f2){return _0x5bf811[_0x0869('0xa8')](_0x5632f2[_0x0869('0x2a')]);});console[_0x0869('0xa4')](_0x0869('0xad'),_0x31cabd);_0x12476b=[];_0x31cabd[_0x0869('0xa9')](function(_0x395909){var _0x1b4a12=createFieldObject(_0x3dd76c,_0x52d432,_0x395909[_0x0869('0xaa')],_0x395909[_0x0869('0x2a')],_0x395909[_0x0869('0xab')],!![]);_0x12476b[_0x0869('0xac')](_0x1b4a12);});return Promise[_0x0869('0xae')](_0x12476b);})[_0x0869('0x26')](function(_0x3fb2f0){_0x4263bf=_0x3fb2f0;var _0x51e151=_0x2fa638[_0x0869('0xaf')](_0x4263bf);return{'count':_0x51e151[_0x0869('0x48')],'rows':_0x51e151};})['then'](respondWithResult(_0x1e15c5,null))[_0x0869('0x43')](function(_0x433c3e){console['log'](_0x0869('0xb0')+_0x433c3e);var _0x5c7efb=_0x425471['query'][_0x0869('0xb1')]?0x1f4:_0x433c3e[_0x0869('0xb2')]||0x1f4;logger[_0x0869('0x28')](_0x433c3e[_0x0869('0x29')]);delete _0x433c3e[_0x0869('0x2a')];if(_0x5c7efb===0x191){_0x5c7efb=0x190;}_0x1e15c5[_0x0869('0x1c')](_0x5c7efb)[_0x0869('0x2b')](_0x425471[_0x0869('0x32')]['test']?{'message':_0x0869('0xb3'),'statusCode':_0x433c3e['statusCode']}:_0x433c3e);});};function createFieldObject(_0x3c2834,_0x154f8d,_0x47d623,_0x9e435d,_0x58c8d4,_0x3265da){return new Promise(function(_0x2dd198,_0x14914a){var _0x2951e1={'id':_0x9e435d,'name':_0x58c8d4,'custom':_0x3265da};if(_0x47d623===_0x0869('0xb4')){_0x2951e1['options']=[{'name':_0x0869('0xb5'),'value':_0x0869('0xb6')},{'name':_0x0869('0xb7'),'value':'false'}];_0x2dd198(_0x2951e1);}else{var _0x44f376={'method':_0x0869('0xb8'),'uri':_0x3c2834+_0x0869('0xb9')+_0x9e435d,'auth':_0x154f8d,'json':!![]};return rp(_0x44f376)['then'](function(_0xe7d077){var _0x2ca167=[];if(_0xe7d077[_0x0869('0xa3')][_0x0869('0x48')]>0x0){_0xe7d077[_0x0869('0xa3')]['forEach'](function(_0x188f8d){if(_0x188f8d[_0x0869('0xba')]==='false'){var _0x5cefd6={'name':_0x188f8d[_0x0869('0xab')],'value':_0x188f8d['value']};_0x2ca167[_0x0869('0xac')](_0x5cefd6);}});}_0x2951e1['options']=_0x2ca167;if(_0x2951e1[_0x0869('0x3f')][_0x0869('0x48')]>0x0){_0x2dd198(_0x2951e1);}else{if(_0x3265da==![]){_0x2dd198();}else{_0x2dd198(_0x2951e1);}}});}});} \ No newline at end of file +var _0xdaed=['time_worked','opened_at','group_list','work_end','reopened_time','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','name','ServicenowAccount','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','Subjects','getSubjects','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','notify','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','approval_history','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','business_service','sys_domain_path','rfc'];(function(_0x2d8fdb,_0x30e70c){var _0x3bc1c2=function(_0x592716){while(--_0x592716){_0x2d8fdb['push'](_0x2d8fdb['shift']());}};_0x3bc1c2(++_0x30e70c);}(_0xdaed,0x1bd));var _0xddae=function(_0x5eb54b,_0x1a00a7){_0x5eb54b=_0x5eb54b-0x0;var _0x1b659e=_0xdaed[_0x5eb54b];return _0x1b659e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xddae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddae('0x1'));var rp=require('request-promise');var moment=require(_0xddae('0x2'));var BPromise=require(_0xddae('0x3'));var Mustache=require(_0xddae('0x4'));var util=require(_0xddae('0x5'));var path=require(_0xddae('0x6'));var sox=require(_0xddae('0x7'));var csv=require(_0xddae('0x8'));var ejs=require(_0xddae('0x9'));var fs=require('fs');var fs_extra=require(_0xddae('0xa'));var _=require(_0xddae('0xb'));var squel=require(_0xddae('0xc'));var crypto=require('crypto');var jsforce=require(_0xddae('0xd'));var deskjs=require(_0xddae('0xe'));var toCsv=require(_0xddae('0x8'));var querystring=require(_0xddae('0xf'));var Papa=require(_0xddae('0x10'));var Redis=require(_0xddae('0x11'));var authService=require(_0xddae('0x12'));var qs=require(_0xddae('0x13'));var as=require(_0xddae('0x14'));var hardwareService=require(_0xddae('0x15'));var logger=require(_0xddae('0x16'))(_0xddae('0x17'));var utils=require(_0xddae('0x18'));var config=require(_0xddae('0x19'));var licenseUtil=require(_0xddae('0x1a'));var db=require(_0xddae('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x214c3e,_0x129e19){_0x129e19=_0x129e19||0xcc;return function(_0x44e2f1){if(_0x44e2f1){return _0x214c3e[_0xddae('0x1c')](_0x129e19);}return _0x214c3e[_0xddae('0x1d')](_0x129e19)[_0xddae('0x1e')]();};}function respondWithResult(_0x3ec2be,_0x36320e){_0x36320e=_0x36320e||0xc8;return function(_0xa549f6){if(_0xa549f6){return _0x3ec2be[_0xddae('0x1d')](_0x36320e)[_0xddae('0x1f')](_0xa549f6);}};}function respondWithFilteredResult(_0x641b89,_0x9b9cc9){return function(_0x471cc1){if(_0x471cc1){var _0x3344ad=typeof _0x9b9cc9[_0xddae('0x20')]===_0xddae('0x21')&&typeof _0x9b9cc9[_0xddae('0x22')]==='undefined';var _0x59e896=_0x471cc1[_0xddae('0x23')];var _0x4ad7c1=_0x3344ad?0x0:_0x9b9cc9[_0xddae('0x20')];var _0x2df599=_0x3344ad?_0x471cc1[_0xddae('0x23')]:_0x9b9cc9['offset']+_0x9b9cc9[_0xddae('0x22')];var _0x13552b;if(_0x2df599>=_0x59e896){_0x2df599=_0x59e896;_0x13552b=0xc8;}else{_0x13552b=0xce;}_0x641b89[_0xddae('0x1d')](_0x13552b);return _0x641b89['set'](_0xddae('0x24'),_0x4ad7c1+'-'+_0x2df599+'/'+_0x59e896)[_0xddae('0x1f')](_0x471cc1);}return null;};}function patchUpdates(_0x18210f){return function(_0x2e91f){try{jsonpatch[_0xddae('0x25')](_0x2e91f,_0x18210f,!![]);}catch(_0x49848a){return BPromise[_0xddae('0x26')](_0x49848a);}return _0x2e91f[_0xddae('0x27')]();};}function saveUpdates(_0x2f13d8,_0x190914){return function(_0x153bc3){if(_0x153bc3){return _0x153bc3['update'](_0x2f13d8)['then'](function(_0x5c637a){return _0x5c637a;});}return null;};}function removeEntity(_0x20522a,_0x519acb){return function(_0x48a630){if(_0x48a630){return _0x48a630[_0xddae('0x28')]()[_0xddae('0x29')](function(){_0x20522a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38369f,_0x2d1a63){return function(_0x277cd6){if(!_0x277cd6){_0x38369f[_0xddae('0x1c')](0x194);}return _0x277cd6;};}function handleError(_0xbaabcf,_0x29ed0d){_0x29ed0d=_0x29ed0d||0x1f4;return function(_0x57e762){logger[_0xddae('0x2a')](_0x57e762['stack']);if(_0x57e762['name']){delete _0x57e762[_0xddae('0x2b')];}_0xbaabcf[_0xddae('0x1d')](_0x29ed0d)['send'](_0x57e762);};}exports['index']=function(_0x16d0e2,_0x349209){var _0x2e3774={},_0x2d9648={},_0x1cf7d8={'count':0x0,'rows':[]};var _0x4933a8=_['map'](db[_0xddae('0x2c')]['rawAttributes'],function(_0x217df0){return{'name':_0x217df0[_0xddae('0x2d')],'type':_0x217df0[_0xddae('0x2e')][_0xddae('0x2f')]};});_0x2d9648['model']=_[_0xddae('0x30')](_0x4933a8,_0xddae('0x2b'));_0x2d9648[_0xddae('0x31')]=_[_0xddae('0x32')](_0x16d0e2[_0xddae('0x31')]);_0x2d9648[_0xddae('0x33')]=_[_0xddae('0x34')](_0x2d9648[_0xddae('0x35')],_0x2d9648['query']);_0x2e3774[_0xddae('0x36')]=_[_0xddae('0x34')](_0x2d9648[_0xddae('0x35')],qs[_0xddae('0x37')](_0x16d0e2['query'][_0xddae('0x37')]));_0x2e3774['attributes']=_0x2e3774[_0xddae('0x36')][_0xddae('0x38')]?_0x2e3774[_0xddae('0x36')]:_0x2d9648[_0xddae('0x35')];if(!_0x16d0e2[_0xddae('0x31')]['hasOwnProperty']('nolimit')){_0x2e3774[_0xddae('0x22')]=qs[_0xddae('0x22')](_0x16d0e2[_0xddae('0x31')][_0xddae('0x22')]);_0x2e3774[_0xddae('0x20')]=qs[_0xddae('0x20')](_0x16d0e2[_0xddae('0x31')][_0xddae('0x20')]);}_0x2e3774[_0xddae('0x39')]=qs['sort'](_0x16d0e2[_0xddae('0x31')][_0xddae('0x3a')]);_0x2e3774[_0xddae('0x3b')]=qs[_0xddae('0x33')](_['pick'](_0x16d0e2[_0xddae('0x31')],_0x2d9648[_0xddae('0x33')]),_0x4933a8);if(_0x16d0e2[_0xddae('0x31')][_0xddae('0x3c')]){_0x2e3774[_0xddae('0x3b')]=_[_0xddae('0x3d')](_0x2e3774[_0xddae('0x3b')],{'$or':_[_0xddae('0x30')](_0x4933a8,function(_0x17c54d){if(_0x17c54d['type']!==_0xddae('0x3e')){var _0x23fab9={};_0x23fab9[_0x17c54d[_0xddae('0x2b')]]={'$like':'%'+_0x16d0e2[_0xddae('0x31')]['filter']+'%'};return _0x23fab9;}})});}_0x2e3774=_['merge']({},_0x2e3774,_0x16d0e2[_0xddae('0x3f')]);var _0x5bf12d={'where':_0x2e3774[_0xddae('0x3b')]};return db[_0xddae('0x2c')][_0xddae('0x23')](_0x5bf12d)[_0xddae('0x29')](function(_0x31be55){_0x1cf7d8['count']=_0x31be55;if(_0x16d0e2[_0xddae('0x31')][_0xddae('0x40')]){_0x2e3774[_0xddae('0x41')]=[{'all':!![]}];}return db[_0xddae('0x2c')][_0xddae('0x42')](_0x2e3774);})['then'](function(_0x26b5fd){_0x1cf7d8[_0xddae('0x43')]=_0x26b5fd;return _0x1cf7d8;})[_0xddae('0x29')](respondWithFilteredResult(_0x349209,_0x2e3774))[_0xddae('0x44')](handleError(_0x349209,null));};exports[_0xddae('0x45')]=function(_0x20c493,_0x390e9f){var _0x385815={'raw':![],'where':{'id':_0x20c493[_0xddae('0x46')]['id']}},_0x2f6cf2={};_0x2f6cf2[_0xddae('0x35')]=_[_0xddae('0x32')](db[_0xddae('0x2c')][_0xddae('0x47')]);_0x2f6cf2[_0xddae('0x31')]=_[_0xddae('0x32')](_0x20c493[_0xddae('0x31')]);_0x2f6cf2[_0xddae('0x33')]=_[_0xddae('0x34')](_0x2f6cf2['model'],_0x2f6cf2[_0xddae('0x31')]);_0x385815[_0xddae('0x36')]=_['intersection'](_0x2f6cf2[_0xddae('0x35')],qs[_0xddae('0x37')](_0x20c493[_0xddae('0x31')][_0xddae('0x37')]));_0x385815[_0xddae('0x36')]=_0x385815[_0xddae('0x36')]['length']?_0x385815[_0xddae('0x36')]:_0x2f6cf2['model'];if(_0x20c493['query'][_0xddae('0x40')]){_0x385815['include']=[{'all':!![]}];}_0x385815=_['merge']({},_0x385815,_0x20c493[_0xddae('0x3f')]);return db[_0xddae('0x2c')][_0xddae('0x48')](_0x385815)['then'](handleEntityNotFound(_0x390e9f,null))[_0xddae('0x29')](respondWithResult(_0x390e9f,null))[_0xddae('0x44')](handleError(_0x390e9f,null));};exports[_0xddae('0x49')]=function(_0x2093d9,_0x27f78d){return db[_0xddae('0x2c')][_0xddae('0x49')](_0x2093d9['body'],{})['then'](respondWithResult(_0x27f78d,0xc9))['catch'](handleError(_0x27f78d,null));};exports[_0xddae('0x4a')]=function(_0x355804,_0x34ccbc){if(_0x355804[_0xddae('0x4b')]['id']){delete _0x355804[_0xddae('0x4b')]['id'];}return db[_0xddae('0x2c')][_0xddae('0x48')]({'where':{'id':_0x355804[_0xddae('0x46')]['id']}})['then'](handleEntityNotFound(_0x34ccbc,null))['then'](saveUpdates(_0x355804['body'],null))[_0xddae('0x29')](respondWithResult(_0x34ccbc,null))[_0xddae('0x44')](handleError(_0x34ccbc,null));};exports[_0xddae('0x28')]=function(_0x379145,_0x4d7349){return db['ServicenowAccount'][_0xddae('0x48')]({'where':{'id':_0x379145['params']['id']}})[_0xddae('0x29')](handleEntityNotFound(_0x4d7349,null))['then'](removeEntity(_0x4d7349,null))[_0xddae('0x44')](handleError(_0x4d7349,null));};exports[_0xddae('0x4c')]=function(_0x137dcf,_0x3e0b58,_0x330a98){var _0x1ec819={};var _0x4acc5a={};var _0x2fac63;var _0x4e588e;return db['ServicenowAccount'][_0xddae('0x4d')]({'where':{'id':_0x137dcf[_0xddae('0x46')]['id']}})[_0xddae('0x29')](handleEntityNotFound(_0x3e0b58,null))[_0xddae('0x29')](function(_0x3476a5){if(_0x3476a5){_0x2fac63=_0x3476a5;_0x4acc5a['model']=_[_0xddae('0x32')](db[_0xddae('0x4e')]['rawAttributes']);_0x4acc5a['query']=_[_0xddae('0x32')](_0x137dcf[_0xddae('0x31')]);_0x4acc5a[_0xddae('0x33')]=_[_0xddae('0x34')](_0x4acc5a[_0xddae('0x35')],_0x4acc5a[_0xddae('0x31')]);_0x1ec819['attributes']=_[_0xddae('0x34')](_0x4acc5a['model'],qs[_0xddae('0x37')](_0x137dcf['query'][_0xddae('0x37')]));_0x1ec819[_0xddae('0x36')]=_0x1ec819[_0xddae('0x36')][_0xddae('0x38')]?_0x1ec819[_0xddae('0x36')]:_0x4acc5a['model'];_0x1ec819[_0xddae('0x39')]=qs[_0xddae('0x3a')](_0x137dcf['query']['sort']);_0x1ec819[_0xddae('0x3b')]=qs[_0xddae('0x33')](_[_0xddae('0x4f')](_0x137dcf[_0xddae('0x31')],_0x4acc5a[_0xddae('0x33')]));if(_0x137dcf['query'][_0xddae('0x3c')]){_0x1ec819[_0xddae('0x3b')]=_[_0xddae('0x3d')](_0x1ec819[_0xddae('0x3b')],{'$or':_['map'](_0x1ec819[_0xddae('0x36')],function(_0x365173){var _0x15cc8a={};_0x15cc8a[_0x365173]={'$like':'%'+_0x137dcf[_0xddae('0x31')][_0xddae('0x3c')]+'%'};return _0x15cc8a;})});}_0x1ec819=_['merge']({},_0x1ec819,_0x137dcf[_0xddae('0x3f')]);return _0x2fac63[_0xddae('0x4c')](_0x1ec819);}})[_0xddae('0x29')](function(_0x3a35d9){if(_0x3a35d9){_0x4e588e=_0x3a35d9[_0xddae('0x38')];if(!_0x137dcf[_0xddae('0x31')][_0xddae('0x50')](_0xddae('0x51'))){_0x1ec819[_0xddae('0x22')]=qs[_0xddae('0x22')](_0x137dcf[_0xddae('0x31')]['limit']);_0x1ec819[_0xddae('0x20')]=qs[_0xddae('0x20')](_0x137dcf[_0xddae('0x31')]['offset']);}return _0x2fac63[_0xddae('0x4c')](_0x1ec819);}})[_0xddae('0x29')](function(_0x2539d0){if(_0x2539d0){return _0x2539d0?{'count':_0x4e588e,'rows':_0x2539d0}:null;}})[_0xddae('0x29')](respondWithResult(_0x3e0b58,null))[_0xddae('0x44')](handleError(_0x3e0b58,null));};exports[_0xddae('0x52')]=function(_0x3bf26f,_0x29a3e1,_0x2f26d4){if(_0x3bf26f[_0xddae('0x4b')]['id']){delete _0x3bf26f['body']['id'];}return db[_0xddae('0x2c')]['findOne']({'where':{'id':_0x3bf26f['params']['id']}})[_0xddae('0x29')](handleEntityNotFound(_0x29a3e1,null))[_0xddae('0x29')](function(_0x5ba7b0){if(_0x5ba7b0){_0x3bf26f[_0xddae('0x4b')]['AccountId']=_0x5ba7b0['id'];_0x3bf26f[_0xddae('0x4b')][_0xddae('0x53')]=integrations[_0xddae('0x54')](_0x3bf26f[_0xddae('0x4b')]['channel'],_0x3bf26f['body'][_0xddae('0x2e')]);_0x3bf26f['body']['Descriptions']=integrations[_0xddae('0x55')](_0x3bf26f[_0xddae('0x4b')]['channel'],_0x3bf26f[_0xddae('0x4b')][_0xddae('0x2e')]);return db[_0xddae('0x4e')][_0xddae('0x49')](_0x3bf26f[_0xddae('0x4b')],{'include':[{'model':db[_0xddae('0x56')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0xddae('0x57')}]});}return null;})[_0xddae('0x29')](respondWithResult(_0x29a3e1,null))[_0xddae('0x44')](handleError(_0x29a3e1,null));};exports[_0xddae('0x58')]=function(_0x22571d,_0x14d442,_0x580039){var _0x5cd40d=[_0xddae('0x59'),_0xddae('0x5a'),'knowledge','subcategory','close_code',_0xddae('0x5b'),_0xddae('0x5c'),_0xddae('0x5d'),'category'];var _0x558499=[_0xddae('0x5e'),_0xddae('0x59'),_0xddae('0x5f'),'watch_list',_0xddae('0x60'),_0xddae('0x61'),'child_incidents',_0xddae('0x5a'),_0xddae('0x62'),'number','resolved_by',_0xddae('0x63'),_0xddae('0x64'),_0xddae('0x65'),_0xddae('0x66'),_0xddae('0x67'),'state',_0xddae('0x68'),_0xddae('0x69'),_0xddae('0x39'),_0xddae('0x6a'),_0xddae('0x6b'),_0xddae('0x6c'),_0xddae('0x6d'),'impact','active','work_notes_list',_0xddae('0x6e'),'priority',_0xddae('0x6f'),_0xddae('0x70'),_0xddae('0x71'),'expected_start',_0xddae('0x72'),'business_duration',_0xddae('0x73'),_0xddae('0x74'),_0xddae('0x75'),'resolved_at',_0xddae('0x76'),_0xddae('0x77'),_0xddae('0x78'),_0xddae('0x79'),_0xddae('0x7a'),'close_code',_0xddae('0x7b'),_0xddae('0x7c'),_0xddae('0x7d'),_0xddae('0x7e'),'business_stc','additional_assignee_list',_0xddae('0x7f'),_0xddae('0x80'),_0xddae('0x5b'),_0xddae('0x81'),'close_notes',_0xddae('0x82'),_0xddae('0x83'),_0xddae('0x84'),_0xddae('0x85'),_0xddae('0x86'),_0xddae('0x87'),'incident_state',_0xddae('0x88'),_0xddae('0x89'),_0xddae('0x8a'),_0xddae('0x8b'),_0xddae('0x8c'),'assigned_to',_0xddae('0x5d'),_0xddae('0x8d'),_0xddae('0x8e'),_0xddae('0x8f'),_0xddae('0x90'),_0xddae('0x91'),'sys_mod_count',_0xddae('0x92'),'sys_tags',_0xddae('0x93'),_0xddae('0x94'),_0xddae('0x95'),_0xddae('0x96'),'category'];var _0xcfcdbf='';var _0x289452='';var _0x596527=[];var _0x597a8c='';var _0x172120='';var _0x392ef8=[];var _0x159ce1='';var _0xa76ae9='';var _0x11b8d8={};var _0x4fac9a='';return db[_0xddae('0x2c')][_0xddae('0x4d')]({'where':{'id':_0x22571d[_0xddae('0x46')]['id']},'attributes':['id',_0xddae('0x97'),_0xddae('0x98'),_0xddae('0x99'),_0xddae('0x9a'),_0xddae('0x9b')]})[_0xddae('0x29')](handleEntityNotFound(_0x14d442,null))[_0xddae('0x29')](function(_0x2d7274){if(_0x2d7274){_0x4fac9a=_0x2d7274[_0xddae('0x9a')];var _0x1bd287=_0x4fac9a[_0xddae('0x9c')](-0x1);if(_0x1bd287==='/'){_0x4fac9a=_0x4fac9a['substring'](0x0,_0x4fac9a[_0xddae('0x9d')](_0x1bd287));}_0xa76ae9=util['format'](_0xddae('0x9e'),_0x4fac9a);_0x159ce1=util['format']('%s/api/now/table/',_0x4fac9a);_0x11b8d8={'user':_0x2d7274[_0xddae('0x97')],'pass':_0x2d7274[_0xddae('0x98')]};var _0x36d89c={'method':_0xddae('0x9f'),'uri':_0xa76ae9+_0xddae('0xa0'),'auth':_0x11b8d8,'json':!![]};return rp(_0x36d89c);}})[_0xddae('0x29')](function(_0x232c69){if(_0x232c69[_0xddae('0xa1')]['length']>0x0){_0xcfcdbf=_0x232c69[_0xddae('0xa1')];}console[_0xddae('0xa2')](_0xddae('0xa3'),_0xcfcdbf);_0x392ef8=[];_0x289452=Object[_0xddae('0xa4')]([],_0xcfcdbf);_[_0xddae('0xa5')](_0x289452,function(_0x42d164){return!_0x5cd40d[_0xddae('0xa6')](_0x42d164[_0xddae('0x2b')]);});_0x289452['forEach'](function(_0x24e035){var _0x27327=createFieldObject(_0x159ce1,_0x11b8d8,_0x24e035[_0xddae('0xa7')],_0x24e035[_0xddae('0x2b')],_0x24e035[_0xddae('0xa8')],![]);_0x392ef8[_0xddae('0xa9')](_0x27327);});return Promise[_0xddae('0xaa')](_0x392ef8);})[_0xddae('0x29')](function(_0x289728){_0x596527=_0x289728;_0x597a8c=Object[_0xddae('0xa4')]([],_0xcfcdbf);console[_0xddae('0xa2')](_0xddae('0xab'),_0xcfcdbf);_[_0xddae('0xa5')](_0x597a8c,function(_0x1b418c){return _0x558499[_0xddae('0xa6')](_0x1b418c['name']);});console[_0xddae('0xa2')](_0xddae('0xac'),_0x597a8c);_0x392ef8=[];_0x597a8c[_0xddae('0xad')](function(_0x89e0a0){var _0x12b750=createFieldObject(_0x159ce1,_0x11b8d8,_0x89e0a0[_0xddae('0xa7')],_0x89e0a0['name'],_0x89e0a0['label'],!![]);_0x392ef8[_0xddae('0xa9')](_0x12b750);});return Promise[_0xddae('0xaa')](_0x392ef8);})[_0xddae('0x29')](function(_0xe65a4c){_0x172120=_0xe65a4c;var _0x17cbab=_0x596527[_0xddae('0xae')](_0x172120);return{'count':_0x17cbab['length'],'rows':_0x17cbab};})[_0xddae('0x29')](respondWithResult(_0x14d442,null))['catch'](function(_0xb1c577){console[_0xddae('0xa2')](_0xddae('0xaf')+_0xb1c577);var _0x4b049c=_0x22571d[_0xddae('0x31')][_0xddae('0xb0')]?0x1f4:_0xb1c577[_0xddae('0xb1')]||0x1f4;logger[_0xddae('0x2a')](_0xb1c577['stack']);delete _0xb1c577['name'];if(_0x4b049c===0x191){_0x4b049c=0x190;}_0x14d442['status'](_0x4b049c)[_0xddae('0xb2')](_0x22571d[_0xddae('0x31')][_0xddae('0xb0')]?{'message':_0xddae('0xb3'),'statusCode':_0xb1c577[_0xddae('0xb1')]}:_0xb1c577);});};function createFieldObject(_0x2cd0d4,_0xd09b52,_0x4ea715,_0x5b496f,_0x390188,_0x3aad9a){return new Promise(function(_0x12bcf5,_0x2bbe29){var _0x23afad={'id':_0x5b496f,'name':_0x390188,'custom':_0x3aad9a};if(_0x4ea715==='boolean'){_0x23afad[_0xddae('0x3f')]=[{'name':_0xddae('0xb4'),'value':_0xddae('0xb5')},{'name':_0xddae('0xb6'),'value':_0xddae('0xb7')}];_0x12bcf5(_0x23afad);}else{var _0xe5d00c={'method':_0xddae('0x9f'),'uri':_0x2cd0d4+_0xddae('0xb8')+_0x5b496f,'auth':_0xd09b52,'json':!![]};return rp(_0xe5d00c)[_0xddae('0x29')](function(_0x536554){var _0x7f392e=[];if(_0x536554[_0xddae('0xa1')][_0xddae('0x38')]>0x0){_0x536554[_0xddae('0xa1')][_0xddae('0xad')](function(_0x1cd601){if(_0x1cd601['inactive']===_0xddae('0xb7')){var _0x4e36fe={'name':_0x1cd601[_0xddae('0xa8')],'value':_0x1cd601[_0xddae('0xb9')]};_0x7f392e[_0xddae('0xa9')](_0x4e36fe);}});}_0x23afad[_0xddae('0x3f')]=_0x7f392e;if(_0x23afad[_0xddae('0x3f')][_0xddae('0x38')]>0x0){_0x12bcf5(_0x23afad);}else{if(_0x3aad9a==![]){_0x12bcf5();}else{_0x12bcf5(_0x23afad);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 669458c..7b42dde 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 _0xd8fb=['../../components/integrations/configuration','define','int_servicenow_accounts','lodash','util','../../config/logger','api','path','rimraf','./intServicenowAccount.attributes'];(function(_0x7850cd,_0x2a7577){var _0x9f319a=function(_0x3230a3){while(--_0x3230a3){_0x7850cd['push'](_0x7850cd['shift']());}};_0x9f319a(++_0x2a7577);}(_0xd8fb,0x99));var _0xbd8f=function(_0xdec56c,_0x38e3f9){_0xdec56c=_0xdec56c-0x0;var _0x29d25a=_0xd8fb[_0xdec56c];return _0x29d25a;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));var integrations=require(_0xbd8f('0x7'));module['exports']=function(_0x33d541,_0x4e97cf){return _0x33d541[_0xbd8f('0x8')]('ServicenowAccount',attributes,{'tableName':_0xbd8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['exports','define','ServicenowAccount','lodash','util','../../config/logger','api','bluebird','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x328fc4,_0x2dc965){var _0x26f37e=function(_0x542dc3){while(--_0x542dc3){_0x328fc4['push'](_0x328fc4['shift']());}};_0x26f37e(++_0x2dc965);}(_0x4c60,0xc1));var _0x04c6=function(_0x327b3a,_0x1638b0){_0x327b3a=_0x327b3a-0x0;var _0x2668c1=_0x4c60[_0x327b3a];return _0x2668c1;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));var integrations=require(_0x04c6('0x6'));module[_0x04c6('0x7')]=function(_0x12bd5d,_0x2b9041){return _0x12bd5d[_0x04c6('0x8')](_0x04c6('0x9'),attributes,{'tableName':'int_servicenow_accounts','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 36e7435..1e042f5 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 _0x4eb4=['request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','catch','findAll','options','raw','where','attributes','include','map','model','then','debug','GetServicenowAccount','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info'];(function(_0x54daa5,_0x222a44){var _0x3cea80=function(_0x22a673){while(--_0x22a673){_0x54daa5['push'](_0x54daa5['shift']());}};_0x3cea80(++_0x222a44);}(_0x4eb4,0x1a1));var _0x44eb=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x4eb4[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x44eb('0x0'));var util=require(_0x44eb('0x1'));var moment=require('moment');var BPromise=require(_0x44eb('0x2'));var rs=require(_0x44eb('0x3'));var fs=require('fs');var Redis=require(_0x44eb('0x4'));var db=require(_0x44eb('0x5'))['db'];var utils=require(_0x44eb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x44eb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x44eb('0x8')][_0x44eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57ac01,_0x397f6d,_0x52c5c8){return new BPromise(function(_0x49ca41,_0x5ede8d){return client[_0x44eb('0xa')](_0x57ac01,_0x52c5c8)['then'](function(_0x3a94d0){logger[_0x44eb('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x397f6d,_0x44eb('0xc'));logger['debug'](_0x44eb('0xd'),_0x397f6d,_0x44eb('0xc'),JSON[_0x44eb('0xe')](_0x3a94d0));if(_0x3a94d0[_0x44eb('0xf')]){if(_0x3a94d0['error'][_0x44eb('0x10')]===0x1f4){logger[_0x44eb('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x397f6d,_0x3a94d0[_0x44eb('0xf')][_0x44eb('0x11')]);return _0x5ede8d(_0x3a94d0[_0x44eb('0xf')][_0x44eb('0x11')]);}logger[_0x44eb('0xf')](_0x44eb('0x12'),_0x397f6d,_0x3a94d0[_0x44eb('0xf')]['message']);return _0x49ca41(_0x3a94d0['error'][_0x44eb('0x11')]);}else{logger[_0x44eb('0xb')](_0x44eb('0x12'),_0x397f6d,_0x44eb('0xc'));_0x49ca41(_0x3a94d0['result']['message']);}})[_0x44eb('0x13')](function(_0x3a1823){logger[_0x44eb('0xf')](_0x44eb('0x12'),_0x397f6d,_0x3a1823);_0x5ede8d(_0x3a1823);});});}exports['GetServicenowAccount']=function(_0x5c30a9){var _0x4dab08=this;return new Promise(function(_0x2773bc,_0x500085){return db['ServicenowAccount'][_0x44eb('0x14')]({'raw':_0x5c30a9[_0x44eb('0x15')]?_0x5c30a9[_0x44eb('0x15')][_0x44eb('0x16')]===undefined?!![]:![]:!![],'where':_0x5c30a9[_0x44eb('0x15')]?_0x5c30a9[_0x44eb('0x15')][_0x44eb('0x17')]||null:null,'attributes':_0x5c30a9['options']?_0x5c30a9['options'][_0x44eb('0x18')]||null:null,'limit':_0x5c30a9['options']?_0x5c30a9[_0x44eb('0x15')]['limit']||null:null,'include':_0x5c30a9[_0x44eb('0x15')]?_0x5c30a9[_0x44eb('0x15')][_0x44eb('0x19')]?_[_0x44eb('0x1a')](_0x5c30a9[_0x44eb('0x15')][_0x44eb('0x19')],function(_0x576e55){return{'model':db[_0x576e55[_0x44eb('0x1b')]],'as':_0x576e55['as'],'attributes':_0x576e55[_0x44eb('0x18')],'include':_0x576e55['include']?_[_0x44eb('0x1a')](_0x576e55[_0x44eb('0x19')],function(_0x4f03a6){return{'model':db[_0x4f03a6['model']],'as':_0x4f03a6['as'],'attributes':_0x4f03a6[_0x44eb('0x18')],'include':_0x4f03a6[_0x44eb('0x19')]?_[_0x44eb('0x1a')](_0x4f03a6['include'],function(_0x4f2faf){return{'model':db[_0x4f2faf[_0x44eb('0x1b')]],'as':_0x4f2faf['as'],'attributes':_0x4f2faf[_0x44eb('0x18')]};}):[]};}):[]};}):[]:[]})[_0x44eb('0x1c')](function(_0x1bc0a4){logger[_0x44eb('0xb')]('GetServicenowAccount',_0x5c30a9);logger[_0x44eb('0x1d')](_0x44eb('0x1e'),_0x5c30a9,JSON['stringify'](_0x1bc0a4));_0x2773bc(_0x1bc0a4);})[_0x44eb('0x13')](function(_0x1520c5){logger['error']('GetServicenowAccount',_0x1520c5['message'],_0x5c30a9);_0x500085(_0x4dab08[_0x44eb('0xf')](0x1f4,_0x1520c5[_0x44eb('0x11')]));});});};exports[_0x44eb('0x1f')]=function(_0x1906ae){var _0x5cd06f=this;return new Promise(function(_0x2703b2,_0x5a10e6){return db['ServicenowAccount'][_0x44eb('0x20')]({'raw':_0x1906ae[_0x44eb('0x15')]?_0x1906ae[_0x44eb('0x15')][_0x44eb('0x16')]===undefined?!![]:![]:!![],'where':_0x1906ae['options']?_0x1906ae['options'][_0x44eb('0x17')]||null:null,'attributes':_0x1906ae[_0x44eb('0x15')]?_0x1906ae[_0x44eb('0x15')][_0x44eb('0x18')]||null:null,'include':_0x1906ae[_0x44eb('0x15')]?_0x1906ae[_0x44eb('0x15')][_0x44eb('0x19')]?_[_0x44eb('0x1a')](_0x1906ae[_0x44eb('0x15')][_0x44eb('0x19')],function(_0x556050){return{'model':db[_0x556050[_0x44eb('0x1b')]],'as':_0x556050['as'],'attributes':_0x556050[_0x44eb('0x18')],'include':_0x556050[_0x44eb('0x19')]?_['map'](_0x556050[_0x44eb('0x19')],function(_0xb0f3fa){return{'model':db[_0xb0f3fa[_0x44eb('0x1b')]],'as':_0xb0f3fa['as'],'attributes':_0xb0f3fa[_0x44eb('0x18')],'include':_0xb0f3fa['include']?_[_0x44eb('0x1a')](_0xb0f3fa['include'],function(_0x31c8e7){return{'model':db[_0x31c8e7['model']],'as':_0x31c8e7['as'],'attributes':_0x31c8e7[_0x44eb('0x18')]};}):[]};}):[]};}):[]:[]})[_0x44eb('0x1c')](function(_0x5e80cb){logger[_0x44eb('0xb')](_0x44eb('0x1f'),_0x1906ae);logger[_0x44eb('0x1d')](_0x44eb('0x1f'),_0x1906ae,JSON[_0x44eb('0xe')](_0x5e80cb));_0x2703b2(_0x5e80cb);})[_0x44eb('0x13')](function(_0x3fbe6c){logger[_0x44eb('0xf')](_0x44eb('0x1f'),_0x3fbe6c[_0x44eb('0x11')],_0x1906ae);_0x5a10e6(_0x5cd06f[_0x44eb('0xf')](0x1f4,_0x3fbe6c[_0x44eb('0x11')]));});});}; \ No newline at end of file +var _0xa5a5=['info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa5a5,0x105));var _0x5a5a=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xa5a5[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x5a5a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5a5a('0x1'));var fs=require('fs');var Redis=require(_0x5a5a('0x2'));var db=require(_0x5a5a('0x3'))['db'];var utils=require(_0x5a5a('0x4'));var logger=require('../../config/logger')(_0x5a5a('0x5'));var config=require(_0x5a5a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5a5a('0x7')][_0x5a5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d72b1,_0x24536e,_0x25225c){return new BPromise(function(_0x367976,_0x536de8){return client[_0x5a5a('0x9')](_0x1d72b1,_0x25225c)[_0x5a5a('0xa')](function(_0x48faa1){logger[_0x5a5a('0xb')](_0x5a5a('0xc'),_0x24536e,_0x5a5a('0xd'));logger[_0x5a5a('0xe')](_0x5a5a('0xf'),_0x24536e,_0x5a5a('0xd'),JSON[_0x5a5a('0x10')](_0x48faa1));if(_0x48faa1['error']){if(_0x48faa1['error'][_0x5a5a('0x11')]===0x1f4){logger[_0x5a5a('0x12')](_0x5a5a('0xc'),_0x24536e,_0x48faa1[_0x5a5a('0x12')][_0x5a5a('0x13')]);return _0x536de8(_0x48faa1[_0x5a5a('0x12')][_0x5a5a('0x13')]);}logger[_0x5a5a('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x24536e,_0x48faa1[_0x5a5a('0x12')][_0x5a5a('0x13')]);return _0x367976(_0x48faa1[_0x5a5a('0x12')][_0x5a5a('0x13')]);}else{logger['info'](_0x5a5a('0xc'),_0x24536e,'request\x20sent');_0x367976(_0x48faa1[_0x5a5a('0x14')]['message']);}})[_0x5a5a('0x15')](function(_0xb15310){logger[_0x5a5a('0x12')](_0x5a5a('0xc'),_0x24536e,_0xb15310);_0x536de8(_0xb15310);});});}exports[_0x5a5a('0x16')]=function(_0x178860){var _0x487069=this;return new Promise(function(_0x1776ca,_0x1ddd37){return db['ServicenowAccount'][_0x5a5a('0x17')]({'raw':_0x178860[_0x5a5a('0x18')]?_0x178860[_0x5a5a('0x18')][_0x5a5a('0x19')]===undefined?!![]:![]:!![],'where':_0x178860[_0x5a5a('0x18')]?_0x178860[_0x5a5a('0x18')][_0x5a5a('0x1a')]||null:null,'attributes':_0x178860['options']?_0x178860[_0x5a5a('0x18')][_0x5a5a('0x1b')]||null:null,'limit':_0x178860[_0x5a5a('0x18')]?_0x178860[_0x5a5a('0x18')][_0x5a5a('0x1c')]||null:null,'include':_0x178860[_0x5a5a('0x18')]?_0x178860[_0x5a5a('0x18')][_0x5a5a('0x1d')]?_[_0x5a5a('0x1e')](_0x178860[_0x5a5a('0x18')][_0x5a5a('0x1d')],function(_0x3f76ad){return{'model':db[_0x3f76ad[_0x5a5a('0x1f')]],'as':_0x3f76ad['as'],'attributes':_0x3f76ad[_0x5a5a('0x1b')],'include':_0x3f76ad[_0x5a5a('0x1d')]?_[_0x5a5a('0x1e')](_0x3f76ad[_0x5a5a('0x1d')],function(_0x3f1666){return{'model':db[_0x3f1666[_0x5a5a('0x1f')]],'as':_0x3f1666['as'],'attributes':_0x3f1666[_0x5a5a('0x1b')],'include':_0x3f1666[_0x5a5a('0x1d')]?_[_0x5a5a('0x1e')](_0x3f1666[_0x5a5a('0x1d')],function(_0x15d3da){return{'model':db[_0x15d3da[_0x5a5a('0x1f')]],'as':_0x15d3da['as'],'attributes':_0x15d3da['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a5a('0xa')](function(_0x1f9562){logger['info'](_0x5a5a('0x16'),_0x178860);logger[_0x5a5a('0xe')](_0x5a5a('0x16'),_0x178860,JSON[_0x5a5a('0x10')](_0x1f9562));_0x1776ca(_0x1f9562);})[_0x5a5a('0x15')](function(_0x397b12){logger['error'](_0x5a5a('0x16'),_0x397b12[_0x5a5a('0x13')],_0x178860);_0x1ddd37(_0x487069['error'](0x1f4,_0x397b12['message']));});});};exports[_0x5a5a('0x20')]=function(_0x4c88d3){var _0x3b836b=this;return new Promise(function(_0x238d28,_0x3a817a){return db[_0x5a5a('0x21')]['find']({'raw':_0x4c88d3['options']?_0x4c88d3[_0x5a5a('0x18')][_0x5a5a('0x19')]===undefined?!![]:![]:!![],'where':_0x4c88d3[_0x5a5a('0x18')]?_0x4c88d3['options'][_0x5a5a('0x1a')]||null:null,'attributes':_0x4c88d3[_0x5a5a('0x18')]?_0x4c88d3[_0x5a5a('0x18')][_0x5a5a('0x1b')]||null:null,'include':_0x4c88d3[_0x5a5a('0x18')]?_0x4c88d3[_0x5a5a('0x18')][_0x5a5a('0x1d')]?_[_0x5a5a('0x1e')](_0x4c88d3[_0x5a5a('0x18')][_0x5a5a('0x1d')],function(_0x49819f){return{'model':db[_0x49819f[_0x5a5a('0x1f')]],'as':_0x49819f['as'],'attributes':_0x49819f['attributes'],'include':_0x49819f['include']?_[_0x5a5a('0x1e')](_0x49819f[_0x5a5a('0x1d')],function(_0x31fd5f){return{'model':db[_0x31fd5f[_0x5a5a('0x1f')]],'as':_0x31fd5f['as'],'attributes':_0x31fd5f['attributes'],'include':_0x31fd5f[_0x5a5a('0x1d')]?_[_0x5a5a('0x1e')](_0x31fd5f[_0x5a5a('0x1d')],function(_0x47c787){return{'model':db[_0x47c787[_0x5a5a('0x1f')]],'as':_0x47c787['as'],'attributes':_0x47c787[_0x5a5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5a5a('0xa')](function(_0x4b9184){logger[_0x5a5a('0xb')](_0x5a5a('0x20'),_0x4c88d3);logger[_0x5a5a('0xe')](_0x5a5a('0x20'),_0x4c88d3,JSON[_0x5a5a('0x10')](_0x4b9184));_0x238d28(_0x4b9184);})[_0x5a5a('0x15')](function(_0xf208fe){logger[_0x5a5a('0x12')](_0x5a5a('0x20'),_0xf208fe[_0x5a5a('0x13')],_0x4c88d3);_0x3a817a(_0x3b836b['error'](0x1f4,_0xf208fe['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index baa0031..acfdbef 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 _0xb8de=['create','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/descriptions'];(function(_0x993b1d,_0x293a10){var _0x2849c6=function(_0x4c83eb){while(--_0x4c83eb){_0x993b1d['push'](_0x993b1d['shift']());}};_0x2849c6(++_0x293a10);}(_0xb8de,0x193));var _0xeb8d=function(_0x30be07,_0x22f563){_0x30be07=_0x30be07-0x0;var _0x21d2c0=_0xb8de[_0x30be07];return _0x21d2c0;};'use strict';var multer=require(_0xeb8d('0x0'));var util=require(_0xeb8d('0x1'));var path=require(_0xeb8d('0x2'));var timeout=require(_0xeb8d('0x3'));var express=require('express');var router=express[_0xeb8d('0x4')]();var fs_extra=require(_0xeb8d('0x5'));var auth=require(_0xeb8d('0x6'));var interaction=require(_0xeb8d('0x7'));var config=require(_0xeb8d('0x8'));var controller=require(_0xeb8d('0x9'));router[_0xeb8d('0xa')]('/',auth[_0xeb8d('0xb')](),controller['index']);router[_0xeb8d('0xa')](_0xeb8d('0xc'),auth['isAuthenticated'](),controller[_0xeb8d('0xd')]);router['get'](_0xeb8d('0xe'),auth[_0xeb8d('0xb')](),controller[_0xeb8d('0xf')]);router['get']('/:id/subjects',auth[_0xeb8d('0xb')](),controller['getSubjects']);router['get'](_0xeb8d('0x10'),auth[_0xeb8d('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0xeb8d('0xb')](),controller[_0xeb8d('0x11')]);router['put'](_0xeb8d('0xc'),auth[_0xeb8d('0xb')](),controller[_0xeb8d('0x12')]);router[_0xeb8d('0x13')](_0xeb8d('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdb2a=['connect-timeout','express','fs-extra','../../components/auth/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x19ac2b,_0x27ec8c){var _0x4913ce=function(_0x38a0fd){while(--_0x38a0fd){_0x19ac2b['push'](_0x19ac2b['shift']());}};_0x4913ce(++_0x27ec8c);}(_0xdb2a,0x185));var _0xadb2=function(_0x3e44f4,_0x2fd1a5){_0x3e44f4=_0x3e44f4-0x0;var _0x357176=_0xdb2a[_0x3e44f4];return _0x357176;};'use strict';var multer=require(_0xadb2('0x0'));var util=require(_0xadb2('0x1'));var path=require('path');var timeout=require(_0xadb2('0x2'));var express=require(_0xadb2('0x3'));var router=express['Router']();var fs_extra=require(_0xadb2('0x4'));var auth=require(_0xadb2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xadb2('0x6'));router[_0xadb2('0x7')]('/',auth[_0xadb2('0x8')](),controller[_0xadb2('0x9')]);router[_0xadb2('0x7')](_0xadb2('0xa'),auth[_0xadb2('0x8')](),controller['show']);router['get'](_0xadb2('0xb'),auth[_0xadb2('0x8')](),controller[_0xadb2('0xc')]);router[_0xadb2('0x7')]('/:id/subjects',auth[_0xadb2('0x8')](),controller[_0xadb2('0xd')]);router['get'](_0xadb2('0xe'),auth[_0xadb2('0x8')](),controller[_0xadb2('0xf')]);router[_0xadb2('0x10')]('/',auth[_0xadb2('0x8')](),controller[_0xadb2('0x11')]);router[_0xadb2('0x12')](_0xadb2('0xa'),auth[_0xadb2('0x8')](),controller[_0xadb2('0x13')]);router[_0xadb2('0x14')]('/:id',auth[_0xadb2('0x8')](),controller[_0xadb2('0x15')]);module[_0xadb2('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 eb08aa1..d2687b6 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 _0x3692=['STRING'];(function(_0x43de86,_0x34edd7){var _0x1bc154=function(_0x192b2b){while(--_0x192b2b){_0x43de86['push'](_0x43de86['shift']());}};_0x1bc154(++_0x34edd7);}(_0x3692,0x180));var _0x2369=function(_0x11a84d,_0x4dbd0e){_0x11a84d=_0x11a84d-0x0;var _0x1e6b48=_0x3692[_0x11a84d];return _0x1e6b48;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2369('0x0')]},'description':{'type':Sequelize[_0x2369('0x0')]}}; \ No newline at end of file +var _0x77ab=['exports','STRING','sequelize'];(function(_0x5f2542,_0x25cfe7){var _0x57bd87=function(_0x5cfc4d){while(--_0x5cfc4d){_0x5f2542['push'](_0x5f2542['shift']());}};_0x57bd87(++_0x25cfe7);}(_0x77ab,0x1a6));var _0xb77a=function(_0xdfe5d0,_0x32e056){_0xdfe5d0=_0xdfe5d0-0x0;var _0x7003ee=_0x77ab[_0xdfe5d0];return _0x7003ee;};'use strict';var Sequelize=require(_0xb77a('0x0'));module[_0xb77a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb77a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a80fa93..98d6cce 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 _0xe58e=['lodash','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','name','send','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','getFields','ServicenowField','options','nolimit','findOne','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs'];(function(_0xd8f3c5,_0x22c497){var _0x18bb19=function(_0xbcc3d1){while(--_0xbcc3d1){_0xd8f3c5['push'](_0xd8f3c5['shift']());}};_0x18bb19(++_0x22c497);}(_0xe58e,0x1ad));var _0xee58=function(_0x474b98,_0x1cc878){_0x474b98=_0x474b98-0x0;var _0xaa1e5d=_0xe58e[_0x474b98];return _0xaa1e5d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xee58('0x0'));var zipdir=require(_0xee58('0x1'));var jsonpatch=require(_0xee58('0x2'));var rp=require(_0xee58('0x3'));var moment=require(_0xee58('0x4'));var BPromise=require(_0xee58('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xee58('0x6'));var csv=require(_0xee58('0x7'));var ejs=require(_0xee58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee58('0x9'));var squel=require('squel');var crypto=require(_0xee58('0xa'));var jsforce=require(_0xee58('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee58('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xee58('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xee58('0xd'));var as=require(_0xee58('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee58('0xf'))(_0xee58('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cce4b,_0x912030){_0x912030=_0x912030||0xcc;return function(_0x33055d){if(_0x33055d){return _0x3cce4b[_0xee58('0x11')](_0x912030);}return _0x3cce4b[_0xee58('0x12')](_0x912030)[_0xee58('0x13')]();};}function respondWithResult(_0x1a1964,_0x972400){_0x972400=_0x972400||0xc8;return function(_0x34f222){if(_0x34f222){return _0x1a1964[_0xee58('0x12')](_0x972400)[_0xee58('0x14')](_0x34f222);}};}function respondWithFilteredResult(_0x468e9f,_0x48a6dd){return function(_0x1e0475){if(_0x1e0475){var _0x80f050=typeof _0x48a6dd['offset']===_0xee58('0x15')&&typeof _0x48a6dd[_0xee58('0x16')]==='undefined';var _0xa2831a=_0x1e0475[_0xee58('0x17')];var _0x24f638=_0x80f050?0x0:_0x48a6dd[_0xee58('0x18')];var _0x299036=_0x80f050?_0x1e0475[_0xee58('0x17')]:_0x48a6dd[_0xee58('0x18')]+_0x48a6dd[_0xee58('0x16')];var _0x5cafe8;if(_0x299036>=_0xa2831a){_0x299036=_0xa2831a;_0x5cafe8=0xc8;}else{_0x5cafe8=0xce;}_0x468e9f[_0xee58('0x12')](_0x5cafe8);return _0x468e9f[_0xee58('0x19')](_0xee58('0x1a'),_0x24f638+'-'+_0x299036+'/'+_0xa2831a)[_0xee58('0x14')](_0x1e0475);}return null;};}function patchUpdates(_0x1a8497){return function(_0x135060){try{jsonpatch[_0xee58('0x1b')](_0x135060,_0x1a8497,!![]);}catch(_0x71062f){return BPromise['reject'](_0x71062f);}return _0x135060[_0xee58('0x1c')]();};}function saveUpdates(_0x3604e0,_0x2c891f){return function(_0x47bd59){if(_0x47bd59){return _0x47bd59[_0xee58('0x1d')](_0x3604e0)[_0xee58('0x1e')](function(_0xa9b662){return _0xa9b662;});}return null;};}function removeEntity(_0x3988dd,_0x2088b8){return function(_0x47ba86){if(_0x47ba86){return _0x47ba86['destroy']()[_0xee58('0x1e')](function(){_0x3988dd[_0xee58('0x12')](0xcc)[_0xee58('0x13')]();});}};}function handleEntityNotFound(_0x2f47e9,_0x26d0d2){return function(_0x3508f3){if(!_0x3508f3){_0x2f47e9['sendStatus'](0x194);}return _0x3508f3;};}function handleError(_0xe11c1,_0x4139b5){_0x4139b5=_0x4139b5||0x1f4;return function(_0xc90b80){logger[_0xee58('0x1f')](_0xc90b80['stack']);if(_0xc90b80[_0xee58('0x20')]){delete _0xc90b80[_0xee58('0x20')];}_0xe11c1['status'](_0x4139b5)[_0xee58('0x21')](_0xc90b80);};}exports['index']=function(_0x18a21f,_0x2b59ba){var _0x10bbb1={},_0x20abcd={},_0x176350={'count':0x0,'rows':[]};var _0x254082=_['map'](db[_0xee58('0x22')][_0xee58('0x23')],function(_0x11ad79){return{'name':_0x11ad79[_0xee58('0x24')],'type':_0x11ad79['type'][_0xee58('0x25')]};});_0x20abcd[_0xee58('0x26')]=_[_0xee58('0x27')](_0x254082,_0xee58('0x20'));_0x20abcd[_0xee58('0x28')]=_[_0xee58('0x29')](_0x18a21f[_0xee58('0x28')]);_0x20abcd[_0xee58('0x2a')]=_[_0xee58('0x2b')](_0x20abcd['model'],_0x20abcd[_0xee58('0x28')]);_0x10bbb1[_0xee58('0x2c')]=_[_0xee58('0x2b')](_0x20abcd[_0xee58('0x26')],qs[_0xee58('0x2d')](_0x18a21f[_0xee58('0x28')][_0xee58('0x2d')]));_0x10bbb1[_0xee58('0x2c')]=_0x10bbb1['attributes'][_0xee58('0x2e')]?_0x10bbb1[_0xee58('0x2c')]:_0x20abcd[_0xee58('0x26')];if(!_0x18a21f[_0xee58('0x28')][_0xee58('0x2f')]('nolimit')){_0x10bbb1['limit']=qs[_0xee58('0x16')](_0x18a21f[_0xee58('0x28')][_0xee58('0x16')]);_0x10bbb1[_0xee58('0x18')]=qs[_0xee58('0x18')](_0x18a21f[_0xee58('0x28')][_0xee58('0x18')]);}_0x10bbb1[_0xee58('0x30')]=qs[_0xee58('0x31')](_0x18a21f[_0xee58('0x28')][_0xee58('0x31')]);_0x10bbb1[_0xee58('0x32')]=qs['filters'](_[_0xee58('0x33')](_0x18a21f[_0xee58('0x28')],_0x20abcd[_0xee58('0x2a')]),_0x254082);if(_0x18a21f['query'][_0xee58('0x34')]){_0x10bbb1[_0xee58('0x32')]=_['merge'](_0x10bbb1[_0xee58('0x32')],{'$or':_[_0xee58('0x27')](_0x254082,function(_0x39a568){if(_0x39a568[_0xee58('0x35')]!==_0xee58('0x36')){var _0x4643d6={};_0x4643d6[_0x39a568[_0xee58('0x20')]]={'$like':'%'+_0x18a21f[_0xee58('0x28')][_0xee58('0x34')]+'%'};return _0x4643d6;}})});}_0x10bbb1=_['merge']({},_0x10bbb1,_0x18a21f['options']);var _0x5e7831={'where':_0x10bbb1[_0xee58('0x32')]};return db[_0xee58('0x22')][_0xee58('0x17')](_0x5e7831)[_0xee58('0x1e')](function(_0x173a0e){_0x176350['count']=_0x173a0e;if(_0x18a21f[_0xee58('0x28')][_0xee58('0x37')]){_0x10bbb1[_0xee58('0x38')]=[{'all':!![]}];}return db[_0xee58('0x22')][_0xee58('0x39')](_0x10bbb1);})[_0xee58('0x1e')](function(_0xb7823d){_0x176350[_0xee58('0x3a')]=_0xb7823d;return _0x176350;})[_0xee58('0x1e')](respondWithFilteredResult(_0x2b59ba,_0x10bbb1))[_0xee58('0x3b')](handleError(_0x2b59ba,null));};exports[_0xee58('0x3c')]=function(_0x53058f,_0x45380f){var _0x12a9a5={'raw':![],'where':{'id':_0x53058f[_0xee58('0x3d')]['id']}},_0x32b28a={};_0x32b28a[_0xee58('0x26')]=_[_0xee58('0x29')](db[_0xee58('0x22')]['rawAttributes']);_0x32b28a[_0xee58('0x28')]=_[_0xee58('0x29')](_0x53058f[_0xee58('0x28')]);_0x32b28a[_0xee58('0x2a')]=_['intersection'](_0x32b28a[_0xee58('0x26')],_0x32b28a['query']);_0x12a9a5[_0xee58('0x2c')]=_[_0xee58('0x2b')](_0x32b28a[_0xee58('0x26')],qs[_0xee58('0x2d')](_0x53058f[_0xee58('0x28')]['fields']));_0x12a9a5[_0xee58('0x2c')]=_0x12a9a5[_0xee58('0x2c')]['length']?_0x12a9a5[_0xee58('0x2c')]:_0x32b28a[_0xee58('0x26')];if(_0x53058f[_0xee58('0x28')]['includeAll']){_0x12a9a5[_0xee58('0x38')]=[{'all':!![]}];}_0x12a9a5=_[_0xee58('0x3e')]({},_0x12a9a5,_0x53058f['options']);return db[_0xee58('0x22')][_0xee58('0x3f')](_0x12a9a5)[_0xee58('0x1e')](handleEntityNotFound(_0x45380f,null))[_0xee58('0x1e')](respondWithResult(_0x45380f,null))[_0xee58('0x3b')](handleError(_0x45380f,null));};exports[_0xee58('0x40')]=function(_0x358c36,_0x2c0d04){return db[_0xee58('0x22')]['create'](_0x358c36[_0xee58('0x41')],{})[_0xee58('0x1e')](respondWithResult(_0x2c0d04,0xc9))['catch'](handleError(_0x2c0d04,null));};exports[_0xee58('0x1d')]=function(_0x2ba303,_0x40e192){if(_0x2ba303[_0xee58('0x41')]['id']){delete _0x2ba303[_0xee58('0x41')]['id'];}return db[_0xee58('0x22')][_0xee58('0x3f')]({'where':{'id':_0x2ba303[_0xee58('0x3d')]['id']}})[_0xee58('0x1e')](handleEntityNotFound(_0x40e192,null))[_0xee58('0x1e')](saveUpdates(_0x2ba303['body'],null))[_0xee58('0x1e')](respondWithResult(_0x40e192,null))[_0xee58('0x3b')](handleError(_0x40e192,null));};exports['destroy']=function(_0x630d50,_0x3cc25a){return db[_0xee58('0x22')][_0xee58('0x3f')]({'where':{'id':_0x630d50['params']['id']}})[_0xee58('0x1e')](handleEntityNotFound(_0x3cc25a,null))[_0xee58('0x1e')](removeEntity(_0x3cc25a,null))[_0xee58('0x3b')](handleError(_0x3cc25a,null));};exports[_0xee58('0x42')]=function(_0x564a8a,_0xc5c093,_0x21d2cb){var _0x20ec4e={};var _0x9da4c0={};var _0x4ab067;var _0x59f478;return db[_0xee58('0x22')]['findOne']({'where':{'id':_0x564a8a['params']['id']}})[_0xee58('0x1e')](handleEntityNotFound(_0xc5c093,null))[_0xee58('0x1e')](function(_0x3bfab4){if(_0x3bfab4){_0x4ab067=_0x3bfab4;_0x9da4c0[_0xee58('0x26')]=_[_0xee58('0x29')](db[_0xee58('0x43')][_0xee58('0x23')]);_0x9da4c0[_0xee58('0x28')]=_[_0xee58('0x29')](_0x564a8a[_0xee58('0x28')]);_0x9da4c0[_0xee58('0x2a')]=_[_0xee58('0x2b')](_0x9da4c0[_0xee58('0x26')],_0x9da4c0[_0xee58('0x28')]);_0x20ec4e['attributes']=_[_0xee58('0x2b')](_0x9da4c0[_0xee58('0x26')],qs[_0xee58('0x2d')](_0x564a8a[_0xee58('0x28')][_0xee58('0x2d')]));_0x20ec4e[_0xee58('0x2c')]=_0x20ec4e['attributes'][_0xee58('0x2e')]?_0x20ec4e[_0xee58('0x2c')]:_0x9da4c0[_0xee58('0x26')];_0x20ec4e[_0xee58('0x30')]=qs[_0xee58('0x31')](_0x564a8a[_0xee58('0x28')][_0xee58('0x31')]);_0x20ec4e[_0xee58('0x32')]=qs['filters'](_[_0xee58('0x33')](_0x564a8a[_0xee58('0x28')],_0x9da4c0[_0xee58('0x2a')]));if(_0x564a8a['query']['filter']){_0x20ec4e[_0xee58('0x32')]=_[_0xee58('0x3e')](_0x20ec4e[_0xee58('0x32')],{'$or':_[_0xee58('0x27')](_0x20ec4e[_0xee58('0x2c')],function(_0x5966f0){var _0x1a7dde={};_0x1a7dde[_0x5966f0]={'$like':'%'+_0x564a8a[_0xee58('0x28')][_0xee58('0x34')]+'%'};return _0x1a7dde;})});}_0x20ec4e=_[_0xee58('0x3e')]({},_0x20ec4e,_0x564a8a[_0xee58('0x44')]);return _0x4ab067[_0xee58('0x42')](_0x20ec4e);}})['then'](function(_0x5b6f4c){if(_0x5b6f4c){_0x59f478=_0x5b6f4c[_0xee58('0x2e')];if(!_0x564a8a[_0xee58('0x28')][_0xee58('0x2f')](_0xee58('0x45'))){_0x20ec4e['limit']=qs[_0xee58('0x16')](_0x564a8a[_0xee58('0x28')][_0xee58('0x16')]);_0x20ec4e['offset']=qs['offset'](_0x564a8a['query'][_0xee58('0x18')]);}return _0x4ab067[_0xee58('0x42')](_0x20ec4e);}})['then'](function(_0x4c43b7){if(_0x4c43b7){return _0x4c43b7?{'count':_0x59f478,'rows':_0x4c43b7}:null;}})[_0xee58('0x1e')](respondWithResult(_0xc5c093,null))[_0xee58('0x3b')](handleError(_0xc5c093,null));};exports['getSubjects']=function(_0x6be87a,_0x360901,_0x2fb9e5){var _0x585b89={};var _0x10da51={};var _0x21ac4d;var _0xc2f3c5;return db['ServicenowConfiguration'][_0xee58('0x46')]({'where':{'id':_0x6be87a[_0xee58('0x3d')]['id']}})[_0xee58('0x1e')](handleEntityNotFound(_0x360901,null))['then'](function(_0x29b1dc){if(_0x29b1dc){_0x21ac4d=_0x29b1dc;_0x10da51['model']=_['keys'](db[_0xee58('0x43')][_0xee58('0x23')]);_0x10da51['query']=_[_0xee58('0x29')](_0x6be87a['query']);_0x10da51[_0xee58('0x2a')]=_[_0xee58('0x2b')](_0x10da51['model'],_0x10da51[_0xee58('0x28')]);_0x585b89[_0xee58('0x2c')]=_[_0xee58('0x2b')](_0x10da51[_0xee58('0x26')],qs[_0xee58('0x2d')](_0x6be87a[_0xee58('0x28')]['fields']));_0x585b89[_0xee58('0x2c')]=_0x585b89[_0xee58('0x2c')][_0xee58('0x2e')]?_0x585b89[_0xee58('0x2c')]:_0x10da51['model'];_0x585b89[_0xee58('0x30')]=qs['sort'](_0x6be87a[_0xee58('0x28')]['sort']);_0x585b89[_0xee58('0x32')]=qs['filters'](_[_0xee58('0x33')](_0x6be87a[_0xee58('0x28')],_0x10da51[_0xee58('0x2a')]));if(_0x6be87a[_0xee58('0x28')][_0xee58('0x34')]){_0x585b89[_0xee58('0x32')]=_[_0xee58('0x3e')](_0x585b89['where'],{'$or':_[_0xee58('0x27')](_0x585b89[_0xee58('0x2c')],function(_0x5f336c){var _0x4e82de={};_0x4e82de[_0x5f336c]={'$like':'%'+_0x6be87a[_0xee58('0x28')][_0xee58('0x34')]+'%'};return _0x4e82de;})});}_0x585b89=_['merge']({},_0x585b89,_0x6be87a[_0xee58('0x44')]);return _0x21ac4d[_0xee58('0x47')](_0x585b89);}})['then'](function(_0x3cfdcf){if(_0x3cfdcf){_0xc2f3c5=_0x3cfdcf[_0xee58('0x2e')];if(!_0x6be87a['query']['hasOwnProperty'](_0xee58('0x45'))){_0x585b89['limit']=qs[_0xee58('0x16')](_0x6be87a['query'][_0xee58('0x16')]);_0x585b89['offset']=qs['offset'](_0x6be87a[_0xee58('0x28')]['offset']);}return _0x21ac4d[_0xee58('0x47')](_0x585b89);}})['then'](function(_0x11a624){if(_0x11a624){return _0x11a624?{'count':_0xc2f3c5,'rows':_0x11a624}:null;}})[_0xee58('0x1e')](respondWithResult(_0x360901,null))['catch'](handleError(_0x360901,null));};exports[_0xee58('0x48')]=function(_0x154924,_0x5e6f03,_0x739ba8){var _0x29dc50={};var _0x2cd3c8={};var _0x103127;var _0x39fba5;return db[_0xee58('0x22')][_0xee58('0x46')]({'where':{'id':_0x154924[_0xee58('0x3d')]['id']}})[_0xee58('0x1e')](handleEntityNotFound(_0x5e6f03,null))[_0xee58('0x1e')](function(_0x2dfcbf){if(_0x2dfcbf){_0x103127=_0x2dfcbf;_0x2cd3c8[_0xee58('0x26')]=_[_0xee58('0x29')](db[_0xee58('0x43')][_0xee58('0x23')]);_0x2cd3c8[_0xee58('0x28')]=_[_0xee58('0x29')](_0x154924['query']);_0x2cd3c8['filters']=_[_0xee58('0x2b')](_0x2cd3c8[_0xee58('0x26')],_0x2cd3c8['query']);_0x29dc50[_0xee58('0x2c')]=_[_0xee58('0x2b')](_0x2cd3c8[_0xee58('0x26')],qs[_0xee58('0x2d')](_0x154924['query'][_0xee58('0x2d')]));_0x29dc50['attributes']=_0x29dc50['attributes'][_0xee58('0x2e')]?_0x29dc50[_0xee58('0x2c')]:_0x2cd3c8[_0xee58('0x26')];_0x29dc50[_0xee58('0x30')]=qs[_0xee58('0x31')](_0x154924['query'][_0xee58('0x31')]);_0x29dc50[_0xee58('0x32')]=qs[_0xee58('0x2a')](_[_0xee58('0x33')](_0x154924[_0xee58('0x28')],_0x2cd3c8['filters']));if(_0x154924[_0xee58('0x28')]['filter']){_0x29dc50['where']=_[_0xee58('0x3e')](_0x29dc50[_0xee58('0x32')],{'$or':_[_0xee58('0x27')](_0x29dc50['attributes'],function(_0x263896){var _0x5e8d39={};_0x5e8d39[_0x263896]={'$like':'%'+_0x154924[_0xee58('0x28')][_0xee58('0x34')]+'%'};return _0x5e8d39;})});}_0x29dc50=_['merge']({},_0x29dc50,_0x154924[_0xee58('0x44')]);return _0x103127[_0xee58('0x48')](_0x29dc50);}})[_0xee58('0x1e')](function(_0xbd658a){if(_0xbd658a){_0x39fba5=_0xbd658a[_0xee58('0x2e')];if(!_0x154924[_0xee58('0x28')][_0xee58('0x2f')]('nolimit')){_0x29dc50[_0xee58('0x16')]=qs['limit'](_0x154924['query'][_0xee58('0x16')]);_0x29dc50[_0xee58('0x18')]=qs['offset'](_0x154924[_0xee58('0x28')][_0xee58('0x18')]);}return _0x103127[_0xee58('0x48')](_0x29dc50);}})['then'](function(_0x4bedba){if(_0x4bedba){return _0x4bedba?{'count':_0x39fba5,'rows':_0x4bedba}:null;}})[_0xee58('0x1e')](respondWithResult(_0x5e6f03,null))[_0xee58('0x3b')](handleError(_0x5e6f03,null));}; \ No newline at end of file +var _0xe750=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ServicenowConfiguration','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','keys','find','catch','create','body','findOne','ServicenowField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs'];(function(_0x53a081,_0x5d23c1){var _0x14a2d8=function(_0x3881d1){while(--_0x3881d1){_0x53a081['push'](_0x53a081['shift']());}};_0x14a2d8(++_0x5d23c1);}(_0xe750,0x1cf));var _0x0e75=function(_0x39e380,_0x9e4937){_0x39e380=_0x39e380-0x0;var _0x18c1ce=_0xe750[_0x39e380];return _0x18c1ce;};'use strict';var emlformat=require(_0x0e75('0x0'));var rimraf=require(_0x0e75('0x1'));var zipdir=require(_0x0e75('0x2'));var jsonpatch=require(_0x0e75('0x3'));var rp=require(_0x0e75('0x4'));var moment=require(_0x0e75('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0e75('0x6'));var util=require('util');var path=require(_0x0e75('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e75('0x8'));var fs=require('fs');var fs_extra=require(_0x0e75('0x9'));var _=require(_0x0e75('0xa'));var squel=require(_0x0e75('0xb'));var crypto=require('crypto');var jsforce=require(_0x0e75('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0e75('0xd'));var querystring=require(_0x0e75('0xe'));var Papa=require(_0x0e75('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e75('0x10'));var as=require(_0x0e75('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e75('0x12'))(_0x0e75('0x13'));var utils=require(_0x0e75('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0e75('0x15'));var db=require(_0x0e75('0x16'))['db'];function respondWithStatusCode(_0x5d0d8f,_0x513a9c){_0x513a9c=_0x513a9c||0xcc;return function(_0x11c24a){if(_0x11c24a){return _0x5d0d8f[_0x0e75('0x17')](_0x513a9c);}return _0x5d0d8f[_0x0e75('0x18')](_0x513a9c)[_0x0e75('0x19')]();};}function respondWithResult(_0x4b82a6,_0x15dde0){_0x15dde0=_0x15dde0||0xc8;return function(_0x4d8667){if(_0x4d8667){return _0x4b82a6[_0x0e75('0x18')](_0x15dde0)[_0x0e75('0x1a')](_0x4d8667);}};}function respondWithFilteredResult(_0xb43db,_0x3fded4){return function(_0x4418ef){if(_0x4418ef){var _0x1261fa=typeof _0x3fded4[_0x0e75('0x1b')]==='undefined'&&typeof _0x3fded4[_0x0e75('0x1c')]===_0x0e75('0x1d');var _0x41b52c=_0x4418ef[_0x0e75('0x1e')];var _0x4cc335=_0x1261fa?0x0:_0x3fded4['offset'];var _0x172c14=_0x1261fa?_0x4418ef[_0x0e75('0x1e')]:_0x3fded4[_0x0e75('0x1b')]+_0x3fded4['limit'];var _0x3a1ab6;if(_0x172c14>=_0x41b52c){_0x172c14=_0x41b52c;_0x3a1ab6=0xc8;}else{_0x3a1ab6=0xce;}_0xb43db[_0x0e75('0x18')](_0x3a1ab6);return _0xb43db['set'](_0x0e75('0x1f'),_0x4cc335+'-'+_0x172c14+'/'+_0x41b52c)[_0x0e75('0x1a')](_0x4418ef);}return null;};}function patchUpdates(_0x3fc29c){return function(_0x33667a){try{jsonpatch[_0x0e75('0x20')](_0x33667a,_0x3fc29c,!![]);}catch(_0x3b6035){return BPromise[_0x0e75('0x21')](_0x3b6035);}return _0x33667a['save']();};}function saveUpdates(_0x167433,_0x3c92f4){return function(_0x563966){if(_0x563966){return _0x563966[_0x0e75('0x22')](_0x167433)[_0x0e75('0x23')](function(_0x252362){return _0x252362;});}return null;};}function removeEntity(_0x4edca9,_0x5f56bc){return function(_0x3e9793){if(_0x3e9793){return _0x3e9793[_0x0e75('0x24')]()[_0x0e75('0x23')](function(){_0x4edca9[_0x0e75('0x18')](0xcc)[_0x0e75('0x19')]();});}};}function handleEntityNotFound(_0x125e8a,_0x1c9679){return function(_0x30387b){if(!_0x30387b){_0x125e8a['sendStatus'](0x194);}return _0x30387b;};}function handleError(_0x13e6e6,_0x564f72){_0x564f72=_0x564f72||0x1f4;return function(_0xed87ae){logger[_0x0e75('0x25')](_0xed87ae[_0x0e75('0x26')]);if(_0xed87ae[_0x0e75('0x27')]){delete _0xed87ae[_0x0e75('0x27')];}_0x13e6e6[_0x0e75('0x18')](_0x564f72)[_0x0e75('0x28')](_0xed87ae);};}exports[_0x0e75('0x29')]=function(_0x37efcb,_0x18d1d1){var _0x3ceee2={},_0x2a3512={},_0x4afa00={'count':0x0,'rows':[]};var _0xa03516=_['map'](db[_0x0e75('0x2a')]['rawAttributes'],function(_0x44f649){return{'name':_0x44f649[_0x0e75('0x2b')],'type':_0x44f649[_0x0e75('0x2c')][_0x0e75('0x2d')]};});_0x2a3512[_0x0e75('0x2e')]=_[_0x0e75('0x2f')](_0xa03516,'name');_0x2a3512[_0x0e75('0x30')]=_['keys'](_0x37efcb[_0x0e75('0x30')]);_0x2a3512[_0x0e75('0x31')]=_[_0x0e75('0x32')](_0x2a3512[_0x0e75('0x2e')],_0x2a3512[_0x0e75('0x30')]);_0x3ceee2[_0x0e75('0x33')]=_[_0x0e75('0x32')](_0x2a3512[_0x0e75('0x2e')],qs['fields'](_0x37efcb[_0x0e75('0x30')][_0x0e75('0x34')]));_0x3ceee2[_0x0e75('0x33')]=_0x3ceee2['attributes'][_0x0e75('0x35')]?_0x3ceee2[_0x0e75('0x33')]:_0x2a3512['model'];if(!_0x37efcb[_0x0e75('0x30')][_0x0e75('0x36')]('nolimit')){_0x3ceee2[_0x0e75('0x1c')]=qs[_0x0e75('0x1c')](_0x37efcb[_0x0e75('0x30')][_0x0e75('0x1c')]);_0x3ceee2[_0x0e75('0x1b')]=qs[_0x0e75('0x1b')](_0x37efcb[_0x0e75('0x30')][_0x0e75('0x1b')]);}_0x3ceee2[_0x0e75('0x37')]=qs[_0x0e75('0x38')](_0x37efcb['query'][_0x0e75('0x38')]);_0x3ceee2[_0x0e75('0x39')]=qs[_0x0e75('0x31')](_[_0x0e75('0x3a')](_0x37efcb[_0x0e75('0x30')],_0x2a3512['filters']),_0xa03516);if(_0x37efcb[_0x0e75('0x30')][_0x0e75('0x3b')]){_0x3ceee2['where']=_[_0x0e75('0x3c')](_0x3ceee2[_0x0e75('0x39')],{'$or':_[_0x0e75('0x2f')](_0xa03516,function(_0x32dc3f){if(_0x32dc3f[_0x0e75('0x2c')]!==_0x0e75('0x3d')){var _0x24636b={};_0x24636b[_0x32dc3f[_0x0e75('0x27')]]={'$like':'%'+_0x37efcb[_0x0e75('0x30')][_0x0e75('0x3b')]+'%'};return _0x24636b;}})});}_0x3ceee2=_[_0x0e75('0x3c')]({},_0x3ceee2,_0x37efcb[_0x0e75('0x3e')]);var _0x2dabbd={'where':_0x3ceee2[_0x0e75('0x39')]};return db[_0x0e75('0x2a')][_0x0e75('0x1e')](_0x2dabbd)[_0x0e75('0x23')](function(_0x3236d3){_0x4afa00[_0x0e75('0x1e')]=_0x3236d3;if(_0x37efcb[_0x0e75('0x30')][_0x0e75('0x3f')]){_0x3ceee2[_0x0e75('0x40')]=[{'all':!![]}];}return db[_0x0e75('0x2a')][_0x0e75('0x41')](_0x3ceee2);})[_0x0e75('0x23')](function(_0x1e52ac){_0x4afa00[_0x0e75('0x42')]=_0x1e52ac;return _0x4afa00;})[_0x0e75('0x23')](respondWithFilteredResult(_0x18d1d1,_0x3ceee2))['catch'](handleError(_0x18d1d1,null));};exports['show']=function(_0x583b3b,_0x2a0fb4){var _0x29c49b={'raw':![],'where':{'id':_0x583b3b[_0x0e75('0x43')]['id']}},_0x17e697={};_0x17e697[_0x0e75('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0x0e75('0x44')]);_0x17e697[_0x0e75('0x30')]=_[_0x0e75('0x45')](_0x583b3b[_0x0e75('0x30')]);_0x17e697[_0x0e75('0x31')]=_[_0x0e75('0x32')](_0x17e697[_0x0e75('0x2e')],_0x17e697[_0x0e75('0x30')]);_0x29c49b[_0x0e75('0x33')]=_[_0x0e75('0x32')](_0x17e697[_0x0e75('0x2e')],qs[_0x0e75('0x34')](_0x583b3b[_0x0e75('0x30')][_0x0e75('0x34')]));_0x29c49b['attributes']=_0x29c49b['attributes'][_0x0e75('0x35')]?_0x29c49b[_0x0e75('0x33')]:_0x17e697[_0x0e75('0x2e')];if(_0x583b3b[_0x0e75('0x30')][_0x0e75('0x3f')]){_0x29c49b[_0x0e75('0x40')]=[{'all':!![]}];}_0x29c49b=_[_0x0e75('0x3c')]({},_0x29c49b,_0x583b3b[_0x0e75('0x3e')]);return db['ServicenowConfiguration'][_0x0e75('0x46')](_0x29c49b)[_0x0e75('0x23')](handleEntityNotFound(_0x2a0fb4,null))[_0x0e75('0x23')](respondWithResult(_0x2a0fb4,null))[_0x0e75('0x47')](handleError(_0x2a0fb4,null));};exports[_0x0e75('0x48')]=function(_0x349330,_0x3050f2){return db[_0x0e75('0x2a')][_0x0e75('0x48')](_0x349330[_0x0e75('0x49')],{})['then'](respondWithResult(_0x3050f2,0xc9))['catch'](handleError(_0x3050f2,null));};exports[_0x0e75('0x22')]=function(_0xeb6941,_0x533d30){if(_0xeb6941[_0x0e75('0x49')]['id']){delete _0xeb6941[_0x0e75('0x49')]['id'];}return db[_0x0e75('0x2a')][_0x0e75('0x46')]({'where':{'id':_0xeb6941[_0x0e75('0x43')]['id']}})['then'](handleEntityNotFound(_0x533d30,null))['then'](saveUpdates(_0xeb6941['body'],null))['then'](respondWithResult(_0x533d30,null))[_0x0e75('0x47')](handleError(_0x533d30,null));};exports[_0x0e75('0x24')]=function(_0x2bd9a6,_0x5f56bb){return db[_0x0e75('0x2a')]['find']({'where':{'id':_0x2bd9a6[_0x0e75('0x43')]['id']}})[_0x0e75('0x23')](handleEntityNotFound(_0x5f56bb,null))['then'](removeEntity(_0x5f56bb,null))[_0x0e75('0x47')](handleError(_0x5f56bb,null));};exports['getFields']=function(_0x5b24b6,_0xdd20df,_0x12cc74){var _0x3127df={};var _0x5aaf26={};var _0x27955e;var _0x286ce3;return db[_0x0e75('0x2a')][_0x0e75('0x4a')]({'where':{'id':_0x5b24b6[_0x0e75('0x43')]['id']}})[_0x0e75('0x23')](handleEntityNotFound(_0xdd20df,null))[_0x0e75('0x23')](function(_0x46ad06){if(_0x46ad06){_0x27955e=_0x46ad06;_0x5aaf26[_0x0e75('0x2e')]=_[_0x0e75('0x45')](db[_0x0e75('0x4b')][_0x0e75('0x44')]);_0x5aaf26[_0x0e75('0x30')]=_[_0x0e75('0x45')](_0x5b24b6[_0x0e75('0x30')]);_0x5aaf26[_0x0e75('0x31')]=_['intersection'](_0x5aaf26[_0x0e75('0x2e')],_0x5aaf26[_0x0e75('0x30')]);_0x3127df[_0x0e75('0x33')]=_['intersection'](_0x5aaf26[_0x0e75('0x2e')],qs[_0x0e75('0x34')](_0x5b24b6[_0x0e75('0x30')][_0x0e75('0x34')]));_0x3127df['attributes']=_0x3127df[_0x0e75('0x33')][_0x0e75('0x35')]?_0x3127df[_0x0e75('0x33')]:_0x5aaf26['model'];_0x3127df[_0x0e75('0x37')]=qs[_0x0e75('0x38')](_0x5b24b6[_0x0e75('0x30')]['sort']);_0x3127df['where']=qs[_0x0e75('0x31')](_[_0x0e75('0x3a')](_0x5b24b6[_0x0e75('0x30')],_0x5aaf26['filters']));if(_0x5b24b6[_0x0e75('0x30')][_0x0e75('0x3b')]){_0x3127df[_0x0e75('0x39')]=_['merge'](_0x3127df['where'],{'$or':_[_0x0e75('0x2f')](_0x3127df['attributes'],function(_0x52246e){var _0x5768e0={};_0x5768e0[_0x52246e]={'$like':'%'+_0x5b24b6[_0x0e75('0x30')][_0x0e75('0x3b')]+'%'};return _0x5768e0;})});}_0x3127df=_[_0x0e75('0x3c')]({},_0x3127df,_0x5b24b6[_0x0e75('0x3e')]);return _0x27955e[_0x0e75('0x4c')](_0x3127df);}})[_0x0e75('0x23')](function(_0x22796f){if(_0x22796f){_0x286ce3=_0x22796f[_0x0e75('0x35')];if(!_0x5b24b6[_0x0e75('0x30')][_0x0e75('0x36')](_0x0e75('0x4d'))){_0x3127df[_0x0e75('0x1c')]=qs[_0x0e75('0x1c')](_0x5b24b6['query'][_0x0e75('0x1c')]);_0x3127df['offset']=qs[_0x0e75('0x1b')](_0x5b24b6[_0x0e75('0x30')][_0x0e75('0x1b')]);}return _0x27955e[_0x0e75('0x4c')](_0x3127df);}})[_0x0e75('0x23')](function(_0x573023){if(_0x573023){return _0x573023?{'count':_0x286ce3,'rows':_0x573023}:null;}})[_0x0e75('0x23')](respondWithResult(_0xdd20df,null))[_0x0e75('0x47')](handleError(_0xdd20df,null));};exports['getSubjects']=function(_0x9ae95a,_0x428b32,_0x5226a2){var _0x58e950={};var _0x6ddfb4={};var _0x627e4;var _0x38099b;return db[_0x0e75('0x2a')][_0x0e75('0x4a')]({'where':{'id':_0x9ae95a[_0x0e75('0x43')]['id']}})[_0x0e75('0x23')](handleEntityNotFound(_0x428b32,null))[_0x0e75('0x23')](function(_0x14b1a3){if(_0x14b1a3){_0x627e4=_0x14b1a3;_0x6ddfb4[_0x0e75('0x2e')]=_[_0x0e75('0x45')](db['ServicenowField'][_0x0e75('0x44')]);_0x6ddfb4['query']=_[_0x0e75('0x45')](_0x9ae95a[_0x0e75('0x30')]);_0x6ddfb4[_0x0e75('0x31')]=_['intersection'](_0x6ddfb4[_0x0e75('0x2e')],_0x6ddfb4[_0x0e75('0x30')]);_0x58e950['attributes']=_[_0x0e75('0x32')](_0x6ddfb4[_0x0e75('0x2e')],qs[_0x0e75('0x34')](_0x9ae95a[_0x0e75('0x30')][_0x0e75('0x34')]));_0x58e950[_0x0e75('0x33')]=_0x58e950[_0x0e75('0x33')][_0x0e75('0x35')]?_0x58e950[_0x0e75('0x33')]:_0x6ddfb4[_0x0e75('0x2e')];_0x58e950[_0x0e75('0x37')]=qs[_0x0e75('0x38')](_0x9ae95a[_0x0e75('0x30')]['sort']);_0x58e950['where']=qs['filters'](_['pick'](_0x9ae95a['query'],_0x6ddfb4[_0x0e75('0x31')]));if(_0x9ae95a[_0x0e75('0x30')][_0x0e75('0x3b')]){_0x58e950['where']=_[_0x0e75('0x3c')](_0x58e950['where'],{'$or':_[_0x0e75('0x2f')](_0x58e950[_0x0e75('0x33')],function(_0x40fb17){var _0x28a4c5={};_0x28a4c5[_0x40fb17]={'$like':'%'+_0x9ae95a[_0x0e75('0x30')]['filter']+'%'};return _0x28a4c5;})});}_0x58e950=_[_0x0e75('0x3c')]({},_0x58e950,_0x9ae95a['options']);return _0x627e4[_0x0e75('0x4e')](_0x58e950);}})[_0x0e75('0x23')](function(_0x1f4c6e){if(_0x1f4c6e){_0x38099b=_0x1f4c6e['length'];if(!_0x9ae95a['query'][_0x0e75('0x36')]('nolimit')){_0x58e950[_0x0e75('0x1c')]=qs[_0x0e75('0x1c')](_0x9ae95a[_0x0e75('0x30')]['limit']);_0x58e950['offset']=qs[_0x0e75('0x1b')](_0x9ae95a[_0x0e75('0x30')]['offset']);}return _0x627e4['getSubjects'](_0x58e950);}})[_0x0e75('0x23')](function(_0x24cf3d){if(_0x24cf3d){return _0x24cf3d?{'count':_0x38099b,'rows':_0x24cf3d}:null;}})['then'](respondWithResult(_0x428b32,null))['catch'](handleError(_0x428b32,null));};exports['getDescriptions']=function(_0x87ee12,_0x410301,_0x30986d){var _0x1029e9={};var _0x4d9ba3={};var _0x2bb0b6;var _0x70d6d3;return db[_0x0e75('0x2a')]['findOne']({'where':{'id':_0x87ee12[_0x0e75('0x43')]['id']}})[_0x0e75('0x23')](handleEntityNotFound(_0x410301,null))[_0x0e75('0x23')](function(_0x31860b){if(_0x31860b){_0x2bb0b6=_0x31860b;_0x4d9ba3['model']=_[_0x0e75('0x45')](db['ServicenowField'][_0x0e75('0x44')]);_0x4d9ba3['query']=_[_0x0e75('0x45')](_0x87ee12['query']);_0x4d9ba3[_0x0e75('0x31')]=_[_0x0e75('0x32')](_0x4d9ba3[_0x0e75('0x2e')],_0x4d9ba3['query']);_0x1029e9[_0x0e75('0x33')]=_[_0x0e75('0x32')](_0x4d9ba3[_0x0e75('0x2e')],qs[_0x0e75('0x34')](_0x87ee12['query'][_0x0e75('0x34')]));_0x1029e9['attributes']=_0x1029e9[_0x0e75('0x33')][_0x0e75('0x35')]?_0x1029e9[_0x0e75('0x33')]:_0x4d9ba3[_0x0e75('0x2e')];_0x1029e9[_0x0e75('0x37')]=qs['sort'](_0x87ee12[_0x0e75('0x30')][_0x0e75('0x38')]);_0x1029e9[_0x0e75('0x39')]=qs[_0x0e75('0x31')](_['pick'](_0x87ee12[_0x0e75('0x30')],_0x4d9ba3[_0x0e75('0x31')]));if(_0x87ee12[_0x0e75('0x30')][_0x0e75('0x3b')]){_0x1029e9['where']=_[_0x0e75('0x3c')](_0x1029e9[_0x0e75('0x39')],{'$or':_['map'](_0x1029e9[_0x0e75('0x33')],function(_0x256924){var _0x3d1de3={};_0x3d1de3[_0x256924]={'$like':'%'+_0x87ee12[_0x0e75('0x30')][_0x0e75('0x3b')]+'%'};return _0x3d1de3;})});}_0x1029e9=_[_0x0e75('0x3c')]({},_0x1029e9,_0x87ee12[_0x0e75('0x3e')]);return _0x2bb0b6[_0x0e75('0x4f')](_0x1029e9);}})[_0x0e75('0x23')](function(_0x58745d){if(_0x58745d){_0x70d6d3=_0x58745d[_0x0e75('0x35')];if(!_0x87ee12[_0x0e75('0x30')]['hasOwnProperty'](_0x0e75('0x4d'))){_0x1029e9[_0x0e75('0x1c')]=qs[_0x0e75('0x1c')](_0x87ee12[_0x0e75('0x30')][_0x0e75('0x1c')]);_0x1029e9['offset']=qs[_0x0e75('0x1b')](_0x87ee12['query'][_0x0e75('0x1b')]);}return _0x2bb0b6[_0x0e75('0x4f')](_0x1029e9);}})[_0x0e75('0x23')](function(_0x399d24){if(_0x399d24){return _0x399d24?{'count':_0x70d6d3,'rows':_0x399d24}:null;}})[_0x0e75('0x23')](respondWithResult(_0x410301,null))[_0x0e75('0x47')](handleError(_0x410301,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7d88cd6..87cdd1b 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 _0x3306=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x515793,_0x2a5d62){var _0x9c326e=function(_0x51d1c9){while(--_0x51d1c9){_0x515793['push'](_0x515793['shift']());}};_0x9c326e(++_0x2a5d62);}(_0x3306,0x107));var _0x6330=function(_0xb7b0b1,_0x5427e1){_0xb7b0b1=_0xb7b0b1-0x0;var _0x3e5678=_0x3306[_0xb7b0b1];return _0x3e5678;};'use strict';var _=require(_0x6330('0x0'));var util=require(_0x6330('0x1'));var logger=require(_0x6330('0x2'))(_0x6330('0x3'));var moment=require('moment');var BPromise=require(_0x6330('0x4'));var rp=require(_0x6330('0x5'));var fs=require('fs');var path=require(_0x6330('0x6'));var rimraf=require(_0x6330('0x7'));var config=require(_0x6330('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x6330('0x9')]=function(_0x457797,_0x2942ec){return _0x457797[_0x6330('0xa')](_0x6330('0xb'),attributes,{'tableName':_0x6330('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['ServicenowConfiguration','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define'];(function(_0x4a9e48,_0x31b595){var _0x1b2c65=function(_0x1bf8d8){while(--_0x1bf8d8){_0x4a9e48['push'](_0x4a9e48['shift']());}};_0x1b2c65(++_0x31b595);}(_0xb7e7,0x121));var _0x7b7e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb7e7[_0x502c7d];return _0x30b7ed;};'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':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 34c449e..cabe5ed 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 _0x4607=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x4607,0x121));var _0x7460=function(_0xbc4481,_0x2539cc){_0xbc4481=_0xbc4481-0x0;var _0x16ad58=_0x4607[_0xbc4481];return _0x16ad58;};'use strict';var _=require(_0x7460('0x0'));var util=require(_0x7460('0x1'));var moment=require(_0x7460('0x2'));var BPromise=require(_0x7460('0x3'));var rs=require(_0x7460('0x4'));var fs=require('fs');var Redis=require(_0x7460('0x5'));var db=require(_0x7460('0x6'))['db'];var utils=require(_0x7460('0x7'));var logger=require(_0x7460('0x8'))('rpc');var config=require(_0x7460('0x9'));var jayson=require(_0x7460('0xa'));var client=jayson[_0x7460('0xb')][_0x7460('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a8f14,_0x2b68fb,_0x13006b){return new BPromise(function(_0x3bbe4b,_0x272455){return client['request'](_0x1a8f14,_0x13006b)[_0x7460('0xd')](function(_0x13d180){logger[_0x7460('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2b68fb,_0x7460('0xf'));logger[_0x7460('0x10')](_0x7460('0x11'),_0x2b68fb,_0x7460('0xf'),JSON[_0x7460('0x12')](_0x13d180));if(_0x13d180[_0x7460('0x13')]){if(_0x13d180[_0x7460('0x13')]['code']===0x1f4){logger[_0x7460('0x13')](_0x7460('0x14'),_0x2b68fb,_0x13d180[_0x7460('0x13')][_0x7460('0x15')]);return _0x272455(_0x13d180[_0x7460('0x13')]['message']);}logger[_0x7460('0x13')](_0x7460('0x14'),_0x2b68fb,_0x13d180['error'][_0x7460('0x15')]);return _0x3bbe4b(_0x13d180[_0x7460('0x13')][_0x7460('0x15')]);}else{logger[_0x7460('0xe')](_0x7460('0x14'),_0x2b68fb,_0x7460('0xf'));_0x3bbe4b(_0x13d180[_0x7460('0x16')]['message']);}})[_0x7460('0x17')](function(_0x4ca132){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x2b68fb,_0x4ca132);_0x272455(_0x4ca132);});});} \ No newline at end of file +var _0x66e2=['request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x66e2,0x105));var _0x266e=function(_0x4492e4,_0x1a02c6){_0x4492e4=_0x4492e4-0x0;var _0x198c32=_0x66e2[_0x4492e4];return _0x198c32;};'use strict';var _=require(_0x266e('0x0'));var util=require(_0x266e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x266e('0x2'));var fs=require('fs');var Redis=require(_0x266e('0x3'));var db=require(_0x266e('0x4'))['db'];var utils=require(_0x266e('0x5'));var logger=require(_0x266e('0x6'))(_0x266e('0x7'));var config=require('../../config/environment');var jayson=require(_0x266e('0x8'));var client=jayson[_0x266e('0x9')][_0x266e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1107d0,_0x22e475,_0x2ddd10){return new BPromise(function(_0x51442e,_0x325279){return client[_0x266e('0xb')](_0x1107d0,_0x2ddd10)[_0x266e('0xc')](function(_0x1e7de0){logger[_0x266e('0xd')](_0x266e('0xe'),_0x22e475,_0x266e('0xf'));logger[_0x266e('0x10')](_0x266e('0x11'),_0x22e475,'request\x20sent',JSON[_0x266e('0x12')](_0x1e7de0));if(_0x1e7de0[_0x266e('0x13')]){if(_0x1e7de0[_0x266e('0x13')][_0x266e('0x14')]===0x1f4){logger[_0x266e('0x13')](_0x266e('0xe'),_0x22e475,_0x1e7de0[_0x266e('0x13')][_0x266e('0x15')]);return _0x325279(_0x1e7de0[_0x266e('0x13')][_0x266e('0x15')]);}logger[_0x266e('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x22e475,_0x1e7de0['error']['message']);return _0x51442e(_0x1e7de0[_0x266e('0x13')][_0x266e('0x15')]);}else{logger[_0x266e('0xd')](_0x266e('0xe'),_0x22e475,_0x266e('0xf'));_0x51442e(_0x1e7de0[_0x266e('0x16')][_0x266e('0x15')]);}})['catch'](function(_0x48c265){logger[_0x266e('0x13')](_0x266e('0xe'),_0x22e475,_0x48c265);_0x325279(_0x48c265);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 77677e7..612e899 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 _0xa2a9=['isAuthenticated','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intServicenowField.controller','index','get','/:id','show','post'];(function(_0x2d7a95,_0x2aca2a){var _0x562465=function(_0x51b099){while(--_0x51b099){_0x2d7a95['push'](_0x2d7a95['shift']());}};_0x562465(++_0x2aca2a);}(_0xa2a9,0x8b));var _0x9a2a=function(_0x2df55b,_0x222015){_0x2df55b=_0x2df55b-0x0;var _0x25c5d6=_0xa2a9[_0x2df55b];return _0x25c5d6;};'use strict';var multer=require('multer');var util=require(_0x9a2a('0x0'));var path=require(_0x9a2a('0x1'));var timeout=require(_0x9a2a('0x2'));var express=require(_0x9a2a('0x3'));var router=express[_0x9a2a('0x4')]();var fs_extra=require(_0x9a2a('0x5'));var auth=require(_0x9a2a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a2a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x9a2a('0x8')]);router[_0x9a2a('0x9')](_0x9a2a('0xa'),auth['isAuthenticated'](),controller[_0x9a2a('0xb')]);router[_0x9a2a('0xc')]('/',auth[_0x9a2a('0xd')](),controller[_0x9a2a('0xe')]);router['put'](_0x9a2a('0xa'),auth[_0x9a2a('0xd')](),controller[_0x9a2a('0xf')]);router[_0x9a2a('0x10')]('/:id',auth[_0x9a2a('0xd')](),controller[_0x9a2a('0x11')]);module[_0x9a2a('0x12')]=router; \ No newline at end of file +var _0x38f7=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','path','express','fs-extra'];(function(_0x36bb07,_0x401074){var _0x44bd81=function(_0x43b736){while(--_0x43b736){_0x36bb07['push'](_0x36bb07['shift']());}};_0x44bd81(++_0x401074);}(_0x38f7,0x137));var _0x738f=function(_0x393f00,_0x255e8b){_0x393f00=_0x393f00-0x0;var _0x463749=_0x38f7[_0x393f00];return _0x463749;};'use strict';var multer=require(_0x738f('0x0'));var util=require('util');var path=require(_0x738f('0x1'));var timeout=require('connect-timeout');var express=require(_0x738f('0x2'));var router=express['Router']();var fs_extra=require(_0x738f('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x738f('0x4'));var controller=require('./intServicenowField.controller');router[_0x738f('0x5')]('/',auth[_0x738f('0x6')](),controller[_0x738f('0x7')]);router[_0x738f('0x5')](_0x738f('0x8'),auth['isAuthenticated'](),controller[_0x738f('0x9')]);router[_0x738f('0xa')]('/',auth[_0x738f('0x6')](),controller[_0x738f('0xb')]);router[_0x738f('0xc')]('/:id',auth[_0x738f('0x6')](),controller['update']);router[_0x738f('0xd')](_0x738f('0x8'),auth[_0x738f('0x6')](),controller['destroy']);module[_0x738f('0xe')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 9e619d2..c85d231 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 _0xc788=['picklist','STRING','variable','exports','ENUM','string','customVariable','keyValue'];(function(_0x4e9b81,_0x1857e0){var _0x19e4e9=function(_0x78160c){while(--_0x78160c){_0x4e9b81['push'](_0x4e9b81['shift']());}};_0x19e4e9(++_0x1857e0);}(_0xc788,0x123));var _0x8c78=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0xc788[_0x2be240];return _0x123543;};'use strict';var Sequelize=require('sequelize');module[_0x8c78('0x0')]={'type':{'type':Sequelize[_0x8c78('0x1')](_0x8c78('0x2'),'variable',_0x8c78('0x3'),_0x8c78('0x4'),_0x8c78('0x5')),'defaultValue':_0x8c78('0x2')},'content':{'type':Sequelize[_0x8c78('0x6')]},'key':{'type':Sequelize[_0x8c78('0x6')]},'keyType':{'type':Sequelize[_0x8c78('0x1')](_0x8c78('0x2'),_0x8c78('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x8c78('0x6')]},'idField':{'type':Sequelize[_0x8c78('0x6')]},'nameField':{'type':Sequelize[_0x8c78('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc86e=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xc86e,0x1b9));var _0xec86=function(_0x5d88eb,_0x71165a){_0x5d88eb=_0x5d88eb-0x0;var _0x35e618=_0xc86e[_0x5d88eb];return _0x35e618;};'use strict';var Sequelize=require(_0xec86('0x0'));module[_0xec86('0x1')]={'type':{'type':Sequelize[_0xec86('0x2')](_0xec86('0x3'),'variable',_0xec86('0x4'),_0xec86('0x5'),_0xec86('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xec86('0x7')]},'keyType':{'type':Sequelize[_0xec86('0x2')](_0xec86('0x3'),_0xec86('0x8'),_0xec86('0x4'))},'keyContent':{'type':Sequelize[_0xec86('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xec86('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 9aa9963..bf46179 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 _0x3164=['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','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','ServicenowField','include','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3bb45b,_0x2dcc0b){var _0x513162=function(_0x46f44b){while(--_0x46f44b){_0x3bb45b['push'](_0x3bb45b['shift']());}};_0x513162(++_0x2dcc0b);}(_0x3164,0x182));var _0x4316=function(_0x169efd,_0x1d3c20){_0x169efd=_0x169efd-0x0;var _0x52d4d4=_0x3164[_0x169efd];return _0x52d4d4;};'use strict';var emlformat=require(_0x4316('0x0'));var rimraf=require(_0x4316('0x1'));var zipdir=require(_0x4316('0x2'));var jsonpatch=require(_0x4316('0x3'));var rp=require(_0x4316('0x4'));var moment=require('moment');var BPromise=require(_0x4316('0x5'));var Mustache=require(_0x4316('0x6'));var util=require(_0x4316('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4316('0x8'));var ejs=require(_0x4316('0x9'));var fs=require('fs');var fs_extra=require(_0x4316('0xa'));var _=require(_0x4316('0xb'));var squel=require(_0x4316('0xc'));var crypto=require(_0x4316('0xd'));var jsforce=require(_0x4316('0xe'));var deskjs=require(_0x4316('0xf'));var toCsv=require(_0x4316('0x8'));var querystring=require(_0x4316('0x10'));var Papa=require(_0x4316('0x11'));var Redis=require(_0x4316('0x12'));var authService=require(_0x4316('0x13'));var qs=require(_0x4316('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4316('0x15'));var logger=require(_0x4316('0x16'))(_0x4316('0x17'));var utils=require(_0x4316('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4316('0x19'));var db=require(_0x4316('0x1a'))['db'];function respondWithStatusCode(_0x1e8f1a,_0x2a1f2c){_0x2a1f2c=_0x2a1f2c||0xcc;return function(_0x5cf490){if(_0x5cf490){return _0x1e8f1a[_0x4316('0x1b')](_0x2a1f2c);}return _0x1e8f1a['status'](_0x2a1f2c)['end']();};}function respondWithResult(_0x524c3c,_0x266777){_0x266777=_0x266777||0xc8;return function(_0x3bb6cf){if(_0x3bb6cf){return _0x524c3c['status'](_0x266777)[_0x4316('0x1c')](_0x3bb6cf);}};}function respondWithFilteredResult(_0x486a64,_0x133121){return function(_0x3e9ab8){if(_0x3e9ab8){var _0x211d87=typeof _0x133121[_0x4316('0x1d')]===_0x4316('0x1e')&&typeof _0x133121[_0x4316('0x1f')]===_0x4316('0x1e');var _0x38e68c=_0x3e9ab8[_0x4316('0x20')];var _0x3bf044=_0x211d87?0x0:_0x133121['offset'];var _0x43069f=_0x211d87?_0x3e9ab8[_0x4316('0x20')]:_0x133121['offset']+_0x133121['limit'];var _0x40f660;if(_0x43069f>=_0x38e68c){_0x43069f=_0x38e68c;_0x40f660=0xc8;}else{_0x40f660=0xce;}_0x486a64[_0x4316('0x21')](_0x40f660);return _0x486a64[_0x4316('0x22')](_0x4316('0x23'),_0x3bf044+'-'+_0x43069f+'/'+_0x38e68c)[_0x4316('0x1c')](_0x3e9ab8);}return null;};}function patchUpdates(_0x5865a3){return function(_0x888097){try{jsonpatch[_0x4316('0x24')](_0x888097,_0x5865a3,!![]);}catch(_0x599c48){return BPromise[_0x4316('0x25')](_0x599c48);}return _0x888097[_0x4316('0x26')]();};}function saveUpdates(_0x38195f,_0x494f82){return function(_0x1736d0){if(_0x1736d0){return _0x1736d0[_0x4316('0x27')](_0x38195f)[_0x4316('0x28')](function(_0x4f42aa){return _0x4f42aa;});}return null;};}function removeEntity(_0x3b994a,_0x3388ae){return function(_0x37043c){if(_0x37043c){return _0x37043c[_0x4316('0x29')]()[_0x4316('0x28')](function(){_0x3b994a[_0x4316('0x21')](0xcc)[_0x4316('0x2a')]();});}};}function handleEntityNotFound(_0x46bd61,_0x184624){return function(_0x43c015){if(!_0x43c015){_0x46bd61[_0x4316('0x1b')](0x194);}return _0x43c015;};}function handleError(_0x40ca68,_0x89e0d7){_0x89e0d7=_0x89e0d7||0x1f4;return function(_0x1f7391){logger[_0x4316('0x2b')](_0x1f7391[_0x4316('0x2c')]);if(_0x1f7391[_0x4316('0x2d')]){delete _0x1f7391['name'];}_0x40ca68['status'](_0x89e0d7)[_0x4316('0x2e')](_0x1f7391);};}exports[_0x4316('0x2f')]=function(_0xa8dd01,_0x334f61){var _0xa1cb87={},_0x55cfb2={},_0xf66a01={'count':0x0,'rows':[]};var _0x4b13aa=_[_0x4316('0x30')](db['ServicenowField'][_0x4316('0x31')],function(_0x50e099){return{'name':_0x50e099[_0x4316('0x32')],'type':_0x50e099[_0x4316('0x33')]['key']};});_0x55cfb2[_0x4316('0x34')]=_['map'](_0x4b13aa,_0x4316('0x2d'));_0x55cfb2[_0x4316('0x35')]=_[_0x4316('0x36')](_0xa8dd01[_0x4316('0x35')]);_0x55cfb2[_0x4316('0x37')]=_[_0x4316('0x38')](_0x55cfb2[_0x4316('0x34')],_0x55cfb2[_0x4316('0x35')]);_0xa1cb87['attributes']=_[_0x4316('0x38')](_0x55cfb2[_0x4316('0x34')],qs['fields'](_0xa8dd01['query'][_0x4316('0x39')]));_0xa1cb87[_0x4316('0x3a')]=_0xa1cb87[_0x4316('0x3a')][_0x4316('0x3b')]?_0xa1cb87[_0x4316('0x3a')]:_0x55cfb2['model'];if(!_0xa8dd01[_0x4316('0x35')][_0x4316('0x3c')](_0x4316('0x3d'))){_0xa1cb87[_0x4316('0x1f')]=qs[_0x4316('0x1f')](_0xa8dd01[_0x4316('0x35')]['limit']);_0xa1cb87[_0x4316('0x1d')]=qs['offset'](_0xa8dd01[_0x4316('0x35')]['offset']);}_0xa1cb87[_0x4316('0x3e')]=qs[_0x4316('0x3f')](_0xa8dd01[_0x4316('0x35')][_0x4316('0x3f')]);_0xa1cb87['where']=qs[_0x4316('0x37')](_[_0x4316('0x40')](_0xa8dd01['query'],_0x55cfb2[_0x4316('0x37')]),_0x4b13aa);if(_0xa8dd01[_0x4316('0x35')][_0x4316('0x41')]){_0xa1cb87['where']=_[_0x4316('0x42')](_0xa1cb87[_0x4316('0x43')],{'$or':_[_0x4316('0x30')](_0x4b13aa,function(_0x14994b){if(_0x14994b[_0x4316('0x33')]!==_0x4316('0x44')){var _0xb05f2={};_0xb05f2[_0x14994b[_0x4316('0x2d')]]={'$like':'%'+_0xa8dd01[_0x4316('0x35')][_0x4316('0x41')]+'%'};return _0xb05f2;}})});}_0xa1cb87=_[_0x4316('0x42')]({},_0xa1cb87,_0xa8dd01[_0x4316('0x45')]);var _0x12402c={'where':_0xa1cb87[_0x4316('0x43')]};return db[_0x4316('0x46')][_0x4316('0x20')](_0x12402c)[_0x4316('0x28')](function(_0x1ff4bc){_0xf66a01[_0x4316('0x20')]=_0x1ff4bc;if(_0xa8dd01[_0x4316('0x35')]['includeAll']){_0xa1cb87[_0x4316('0x47')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0xa1cb87);})[_0x4316('0x28')](function(_0xf98933){_0xf66a01[_0x4316('0x48')]=_0xf98933;return _0xf66a01;})['then'](respondWithFilteredResult(_0x334f61,_0xa1cb87))[_0x4316('0x49')](handleError(_0x334f61,null));};exports[_0x4316('0x4a')]=function(_0x51c34a,_0x421fd3){var _0x5a0ba6={'raw':!![],'where':{'id':_0x51c34a[_0x4316('0x4b')]['id']}},_0x410532={};_0x410532[_0x4316('0x34')]=_[_0x4316('0x36')](db['ServicenowField'][_0x4316('0x31')]);_0x410532[_0x4316('0x35')]=_[_0x4316('0x36')](_0x51c34a[_0x4316('0x35')]);_0x410532['filters']=_[_0x4316('0x38')](_0x410532[_0x4316('0x34')],_0x410532[_0x4316('0x35')]);_0x5a0ba6[_0x4316('0x3a')]=_['intersection'](_0x410532['model'],qs['fields'](_0x51c34a[_0x4316('0x35')][_0x4316('0x39')]));_0x5a0ba6['attributes']=_0x5a0ba6[_0x4316('0x3a')][_0x4316('0x3b')]?_0x5a0ba6[_0x4316('0x3a')]:_0x410532['model'];if(_0x51c34a['query'][_0x4316('0x4c')]){_0x5a0ba6[_0x4316('0x47')]=[{'all':!![]}];}_0x5a0ba6=_['merge']({},_0x5a0ba6,_0x51c34a['options']);return db['ServicenowField'][_0x4316('0x4d')](_0x5a0ba6)[_0x4316('0x28')](handleEntityNotFound(_0x421fd3,null))[_0x4316('0x28')](respondWithResult(_0x421fd3,null))[_0x4316('0x49')](handleError(_0x421fd3,null));};exports[_0x4316('0x4e')]=function(_0x34b967,_0x5c7c86){return db[_0x4316('0x46')][_0x4316('0x4e')](_0x34b967[_0x4316('0x4f')],{})['then'](respondWithResult(_0x5c7c86,0xc9))[_0x4316('0x49')](handleError(_0x5c7c86,null));};exports[_0x4316('0x27')]=function(_0x3ceb88,_0x5e6155){if(_0x3ceb88[_0x4316('0x4f')]['id']){delete _0x3ceb88[_0x4316('0x4f')]['id'];}return db[_0x4316('0x46')][_0x4316('0x4d')]({'where':{'id':_0x3ceb88[_0x4316('0x4b')]['id']}})[_0x4316('0x28')](handleEntityNotFound(_0x5e6155,null))['then'](saveUpdates(_0x3ceb88[_0x4316('0x4f')],null))[_0x4316('0x28')](respondWithResult(_0x5e6155,null))[_0x4316('0x49')](handleError(_0x5e6155,null));};exports[_0x4316('0x29')]=function(_0x56d541,_0x2205f3){return db['ServicenowField']['find']({'where':{'id':_0x56d541['params']['id']}})[_0x4316('0x28')](handleEntityNotFound(_0x2205f3,null))['then'](removeEntity(_0x2205f3,null))[_0x4316('0x49')](handleError(_0x2205f3,null));}; \ No newline at end of file +var _0x3c14=['undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x41f0fb,_0x155b08){var _0x494a7f=function(_0x491c0d){while(--_0x491c0d){_0x41f0fb['push'](_0x41f0fb['shift']());}};_0x494a7f(++_0x155b08);}(_0x3c14,0x7e));var _0x43c1=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0x3c14[_0x1fa759];return _0x2da9f4;};'use strict';var emlformat=require(_0x43c1('0x0'));var rimraf=require(_0x43c1('0x1'));var zipdir=require(_0x43c1('0x2'));var jsonpatch=require(_0x43c1('0x3'));var rp=require(_0x43c1('0x4'));var moment=require(_0x43c1('0x5'));var BPromise=require(_0x43c1('0x6'));var Mustache=require(_0x43c1('0x7'));var util=require(_0x43c1('0x8'));var path=require(_0x43c1('0x9'));var sox=require(_0x43c1('0xa'));var csv=require(_0x43c1('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43c1('0xc'));var _=require(_0x43c1('0xd'));var squel=require(_0x43c1('0xe'));var crypto=require(_0x43c1('0xf'));var jsforce=require(_0x43c1('0x10'));var deskjs=require(_0x43c1('0x11'));var toCsv=require(_0x43c1('0xb'));var querystring=require(_0x43c1('0x12'));var Papa=require(_0x43c1('0x13'));var Redis=require(_0x43c1('0x14'));var authService=require(_0x43c1('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x43c1('0x16'));var hardwareService=require(_0x43c1('0x17'));var logger=require(_0x43c1('0x18'))(_0x43c1('0x19'));var utils=require('../../config/utils');var config=require(_0x43c1('0x1a'));var licenseUtil=require(_0x43c1('0x1b'));var db=require(_0x43c1('0x1c'))['db'];function respondWithStatusCode(_0x256f31,_0x4f8a3d){_0x4f8a3d=_0x4f8a3d||0xcc;return function(_0x3f08b3){if(_0x3f08b3){return _0x256f31[_0x43c1('0x1d')](_0x4f8a3d);}return _0x256f31[_0x43c1('0x1e')](_0x4f8a3d)[_0x43c1('0x1f')]();};}function respondWithResult(_0x2b2d4c,_0x21304d){_0x21304d=_0x21304d||0xc8;return function(_0x5e4594){if(_0x5e4594){return _0x2b2d4c[_0x43c1('0x1e')](_0x21304d)[_0x43c1('0x20')](_0x5e4594);}};}function respondWithFilteredResult(_0x4a56d3,_0x9219aa){return function(_0x3bb96d){if(_0x3bb96d){var _0x1b7935=typeof _0x9219aa[_0x43c1('0x21')]===_0x43c1('0x22')&&typeof _0x9219aa[_0x43c1('0x23')]===_0x43c1('0x22');var _0xc5f339=_0x3bb96d[_0x43c1('0x24')];var _0x5189ea=_0x1b7935?0x0:_0x9219aa[_0x43c1('0x21')];var _0x342263=_0x1b7935?_0x3bb96d[_0x43c1('0x24')]:_0x9219aa[_0x43c1('0x21')]+_0x9219aa['limit'];var _0x4dbb11;if(_0x342263>=_0xc5f339){_0x342263=_0xc5f339;_0x4dbb11=0xc8;}else{_0x4dbb11=0xce;}_0x4a56d3['status'](_0x4dbb11);return _0x4a56d3['set'](_0x43c1('0x25'),_0x5189ea+'-'+_0x342263+'/'+_0xc5f339)[_0x43c1('0x20')](_0x3bb96d);}return null;};}function patchUpdates(_0x1e404e){return function(_0x47dc80){try{jsonpatch['apply'](_0x47dc80,_0x1e404e,!![]);}catch(_0x3d1d19){return BPromise[_0x43c1('0x26')](_0x3d1d19);}return _0x47dc80[_0x43c1('0x27')]();};}function saveUpdates(_0x2b41a1,_0x332487){return function(_0x27dbff){if(_0x27dbff){return _0x27dbff[_0x43c1('0x28')](_0x2b41a1)[_0x43c1('0x29')](function(_0x1bc4d8){return _0x1bc4d8;});}return null;};}function removeEntity(_0x3b5f4f,_0x4405f8){return function(_0x4c32ba){if(_0x4c32ba){return _0x4c32ba[_0x43c1('0x2a')]()['then'](function(){_0x3b5f4f[_0x43c1('0x1e')](0xcc)[_0x43c1('0x1f')]();});}};}function handleEntityNotFound(_0x429659,_0x15b3c5){return function(_0x870183){if(!_0x870183){_0x429659[_0x43c1('0x1d')](0x194);}return _0x870183;};}function handleError(_0x5483ac,_0x596241){_0x596241=_0x596241||0x1f4;return function(_0x265053){logger[_0x43c1('0x2b')](_0x265053[_0x43c1('0x2c')]);if(_0x265053['name']){delete _0x265053[_0x43c1('0x2d')];}_0x5483ac['status'](_0x596241)[_0x43c1('0x2e')](_0x265053);};}exports[_0x43c1('0x2f')]=function(_0x1382f0,_0x53e692){var _0x4646da={},_0x34bc14={},_0x35fe64={'count':0x0,'rows':[]};var _0x2a1cae=_[_0x43c1('0x30')](db[_0x43c1('0x31')]['rawAttributes'],function(_0x44b6cb){return{'name':_0x44b6cb[_0x43c1('0x32')],'type':_0x44b6cb[_0x43c1('0x33')][_0x43c1('0x34')]};});_0x34bc14[_0x43c1('0x35')]=_[_0x43c1('0x30')](_0x2a1cae,'name');_0x34bc14[_0x43c1('0x36')]=_[_0x43c1('0x37')](_0x1382f0[_0x43c1('0x36')]);_0x34bc14['filters']=_['intersection'](_0x34bc14['model'],_0x34bc14[_0x43c1('0x36')]);_0x4646da['attributes']=_[_0x43c1('0x38')](_0x34bc14[_0x43c1('0x35')],qs[_0x43c1('0x39')](_0x1382f0[_0x43c1('0x36')][_0x43c1('0x39')]));_0x4646da['attributes']=_0x4646da[_0x43c1('0x3a')][_0x43c1('0x3b')]?_0x4646da[_0x43c1('0x3a')]:_0x34bc14['model'];if(!_0x1382f0[_0x43c1('0x36')]['hasOwnProperty'](_0x43c1('0x3c'))){_0x4646da[_0x43c1('0x23')]=qs[_0x43c1('0x23')](_0x1382f0[_0x43c1('0x36')][_0x43c1('0x23')]);_0x4646da[_0x43c1('0x21')]=qs[_0x43c1('0x21')](_0x1382f0[_0x43c1('0x36')][_0x43c1('0x21')]);}_0x4646da['order']=qs[_0x43c1('0x3d')](_0x1382f0['query']['sort']);_0x4646da[_0x43c1('0x3e')]=qs['filters'](_[_0x43c1('0x3f')](_0x1382f0[_0x43c1('0x36')],_0x34bc14[_0x43c1('0x40')]),_0x2a1cae);if(_0x1382f0['query'][_0x43c1('0x41')]){_0x4646da[_0x43c1('0x3e')]=_[_0x43c1('0x42')](_0x4646da[_0x43c1('0x3e')],{'$or':_[_0x43c1('0x30')](_0x2a1cae,function(_0x23570e){if(_0x23570e[_0x43c1('0x33')]!==_0x43c1('0x43')){var _0x14e45b={};_0x14e45b[_0x23570e[_0x43c1('0x2d')]]={'$like':'%'+_0x1382f0[_0x43c1('0x36')][_0x43c1('0x41')]+'%'};return _0x14e45b;}})});}_0x4646da=_[_0x43c1('0x42')]({},_0x4646da,_0x1382f0[_0x43c1('0x44')]);var _0x1200c1={'where':_0x4646da[_0x43c1('0x3e')]};return db[_0x43c1('0x31')][_0x43c1('0x24')](_0x1200c1)[_0x43c1('0x29')](function(_0x124e70){_0x35fe64[_0x43c1('0x24')]=_0x124e70;if(_0x1382f0[_0x43c1('0x36')]['includeAll']){_0x4646da[_0x43c1('0x45')]=[{'all':!![]}];}return db[_0x43c1('0x31')][_0x43c1('0x46')](_0x4646da);})[_0x43c1('0x29')](function(_0x2be7cd){_0x35fe64[_0x43c1('0x47')]=_0x2be7cd;return _0x35fe64;})[_0x43c1('0x29')](respondWithFilteredResult(_0x53e692,_0x4646da))[_0x43c1('0x48')](handleError(_0x53e692,null));};exports[_0x43c1('0x49')]=function(_0x1bc2ee,_0x3c9e91){var _0x3e5ad9={'raw':!![],'where':{'id':_0x1bc2ee[_0x43c1('0x4a')]['id']}},_0x214e48={};_0x214e48[_0x43c1('0x35')]=_['keys'](db[_0x43c1('0x31')][_0x43c1('0x4b')]);_0x214e48[_0x43c1('0x36')]=_['keys'](_0x1bc2ee[_0x43c1('0x36')]);_0x214e48[_0x43c1('0x40')]=_[_0x43c1('0x38')](_0x214e48[_0x43c1('0x35')],_0x214e48['query']);_0x3e5ad9['attributes']=_['intersection'](_0x214e48['model'],qs[_0x43c1('0x39')](_0x1bc2ee[_0x43c1('0x36')][_0x43c1('0x39')]));_0x3e5ad9[_0x43c1('0x3a')]=_0x3e5ad9[_0x43c1('0x3a')][_0x43c1('0x3b')]?_0x3e5ad9[_0x43c1('0x3a')]:_0x214e48[_0x43c1('0x35')];if(_0x1bc2ee[_0x43c1('0x36')][_0x43c1('0x4c')]){_0x3e5ad9[_0x43c1('0x45')]=[{'all':!![]}];}_0x3e5ad9=_[_0x43c1('0x42')]({},_0x3e5ad9,_0x1bc2ee[_0x43c1('0x44')]);return db[_0x43c1('0x31')][_0x43c1('0x4d')](_0x3e5ad9)[_0x43c1('0x29')](handleEntityNotFound(_0x3c9e91,null))['then'](respondWithResult(_0x3c9e91,null))[_0x43c1('0x48')](handleError(_0x3c9e91,null));};exports[_0x43c1('0x4e')]=function(_0x31df41,_0x59b9fb){return db[_0x43c1('0x31')]['create'](_0x31df41['body'],{})[_0x43c1('0x29')](respondWithResult(_0x59b9fb,0xc9))['catch'](handleError(_0x59b9fb,null));};exports['update']=function(_0x2f5825,_0x4f83b8){if(_0x2f5825[_0x43c1('0x4f')]['id']){delete _0x2f5825['body']['id'];}return db['ServicenowField'][_0x43c1('0x4d')]({'where':{'id':_0x2f5825[_0x43c1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f83b8,null))[_0x43c1('0x29')](saveUpdates(_0x2f5825[_0x43c1('0x4f')],null))[_0x43c1('0x29')](respondWithResult(_0x4f83b8,null))[_0x43c1('0x48')](handleError(_0x4f83b8,null));};exports[_0x43c1('0x2a')]=function(_0x357aee,_0x36a438){return db[_0x43c1('0x31')][_0x43c1('0x4d')]({'where':{'id':_0x357aee[_0x43c1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x36a438,null))[_0x43c1('0x29')](removeEntity(_0x36a438,null))['catch'](handleError(_0x36a438,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4eeb380..f3fd70c 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 _0xb677=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util'];(function(_0x18b410,_0x561a8a){var _0x3f9d5e=function(_0x334ca6){while(--_0x334ca6){_0x18b410['push'](_0x18b410['shift']());}};_0x3f9d5e(++_0x561a8a);}(_0xb677,0x187));var _0x7b67=function(_0x1320a0,_0x4310c6){_0x1320a0=_0x1320a0-0x0;var _0x1c2d0e=_0xb677[_0x1320a0];return _0x1c2d0e;};'use strict';var _=require('lodash');var util=require(_0x7b67('0x0'));var logger=require(_0x7b67('0x1'))(_0x7b67('0x2'));var moment=require('moment');var BPromise=require(_0x7b67('0x3'));var rp=require(_0x7b67('0x4'));var fs=require('fs');var path=require(_0x7b67('0x5'));var rimraf=require('rimraf');var config=require(_0x7b67('0x6'));var attributes=require('./intServicenowField.attributes');module[_0x7b67('0x7')]=function(_0x3e464c,_0x428890){return _0x3e464c[_0x7b67('0x8')](_0x7b67('0x9'),attributes,{'tableName':_0x7b67('0xa'),'paranoid':![],'indexes':[{'name':_0x7b67('0xb'),'fields':[_0x7b67('0xc'),_0x7b67('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x365d=['path','rimraf','../../config/environment','./intServicenowField.attributes','define','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','api','request-promise'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x365d,0x140));var _0xd365=function(_0x10e4e5,_0x36a9ed){_0x10e4e5=_0x10e4e5-0x0;var _0x44d353=_0x365d[_0x10e4e5];return _0x44d353;};'use strict';var _=require(_0xd365('0x0'));var util=require(_0xd365('0x1'));var logger=require(_0xd365('0x2'))(_0xd365('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd365('0x4'));var fs=require('fs');var path=require(_0xd365('0x5'));var rimraf=require(_0xd365('0x6'));var config=require(_0xd365('0x7'));var attributes=require(_0xd365('0x8'));module['exports']=function(_0x527f5e,_0x449ac0){return _0x527f5e[_0xd365('0x9')]('ServicenowField',attributes,{'tableName':_0xd365('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xd365('0xb'),_0xd365('0xc')],'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 c7100a5..1498036 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x166107,_0x3363f1){var _0x575448=function(_0x3cdf04){while(--_0x3cdf04){_0x166107['push'](_0x166107['shift']());}};_0x575448(++_0x3363f1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _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(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0xda3f,0xec));var _0xfda3=function(_0x9eac88,_0x3c6b2a){_0x9eac88=_0x9eac88-0x0;var _0xcc7a51=_0xda3f[_0x9eac88];return _0xcc7a51;};'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 diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ee2ccd2..344b6c7 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x42d6da,_0x3c8613){var _0x37ddd3=function(_0x529230){while(--_0x529230){_0x42d6da['push'](_0x42d6da['shift']());}};_0x37ddd3(++_0x3c8613);}(_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/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3c6ac9,_0x12bd80){var _0x21d6eb=function(_0x1fab37){while(--_0x1fab37){_0x3c6ac9['push'](_0x3c6ac9['shift']());}};_0x21d6eb(++_0x12bd80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 30d82fa..6d5009d 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(_0x133802,_0x2a57f1){var _0x59048=function(_0x144996){while(--_0x144996){_0x133802['push'](_0x133802['shift']());}};_0x59048(++_0x2a57f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x223470,_0x49df2f){var _0x179d15=function(_0x17b475){while(--_0x17b475){_0x223470['push'](_0x223470['shift']());}};_0x179d15(++_0x49df2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 f6e9ff4..6bfc214 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 _0xd6a1=['value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','SugarcrmAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','lastIndexOf','POST','%s%s','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','Calls','values','module_fields','remove','includes','label'];(function(_0x6d9398,_0x4eaa93){var _0x4994b5=function(_0x545101){while(--_0x545101){_0x6d9398['push'](_0x6d9398['shift']());}};_0x4994b5(++_0x4eaa93);}(_0xd6a1,0x82));var _0x1d6a=function(_0x17f17a,_0x21f728){_0x17f17a=_0x17f17a-0x0;var _0x11301e=_0xd6a1[_0x17f17a];return _0x11301e;};'use strict';var emlformat=require(_0x1d6a('0x0'));var rimraf=require(_0x1d6a('0x1'));var zipdir=require(_0x1d6a('0x2'));var jsonpatch=require(_0x1d6a('0x3'));var rp=require(_0x1d6a('0x4'));var moment=require(_0x1d6a('0x5'));var BPromise=require(_0x1d6a('0x6'));var Mustache=require('mustache');var util=require(_0x1d6a('0x7'));var path=require(_0x1d6a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1d6a('0x9'));var fs=require('fs');var fs_extra=require(_0x1d6a('0xa'));var _=require(_0x1d6a('0xb'));var squel=require(_0x1d6a('0xc'));var crypto=require(_0x1d6a('0xd'));var jsforce=require(_0x1d6a('0xe'));var deskjs=require(_0x1d6a('0xf'));var toCsv=require(_0x1d6a('0x10'));var querystring=require(_0x1d6a('0x11'));var Papa=require(_0x1d6a('0x12'));var Redis=require('ioredis');var authService=require(_0x1d6a('0x13'));var qs=require(_0x1d6a('0x14'));var as=require(_0x1d6a('0x15'));var hardwareService=require(_0x1d6a('0x16'));var logger=require(_0x1d6a('0x17'))(_0x1d6a('0x18'));var utils=require(_0x1d6a('0x19'));var config=require(_0x1d6a('0x1a'));var licenseUtil=require(_0x1d6a('0x1b'));var db=require(_0x1d6a('0x1c'))['db'];var integrations=require(_0x1d6a('0x1d'));function respondWithStatusCode(_0xeb1a4b,_0x2465b3){_0x2465b3=_0x2465b3||0xcc;return function(_0x10c9aa){if(_0x10c9aa){return _0xeb1a4b[_0x1d6a('0x1e')](_0x2465b3);}return _0xeb1a4b[_0x1d6a('0x1f')](_0x2465b3)[_0x1d6a('0x20')]();};}function respondWithResult(_0x40a1f2,_0x6140b5){_0x6140b5=_0x6140b5||0xc8;return function(_0x439551){if(_0x439551){return _0x40a1f2[_0x1d6a('0x1f')](_0x6140b5)[_0x1d6a('0x21')](_0x439551);}};}function respondWithFilteredResult(_0x39c47d,_0x3d4f7f){return function(_0x2da8ef){if(_0x2da8ef){var _0x3a75ac=typeof _0x3d4f7f['offset']==='undefined'&&typeof _0x3d4f7f[_0x1d6a('0x22')]===_0x1d6a('0x23');var _0x5cdc13=_0x2da8ef[_0x1d6a('0x24')];var _0x4e0843=_0x3a75ac?0x0:_0x3d4f7f[_0x1d6a('0x25')];var _0x1436f0=_0x3a75ac?_0x2da8ef[_0x1d6a('0x24')]:_0x3d4f7f[_0x1d6a('0x25')]+_0x3d4f7f['limit'];var _0x41a385;if(_0x1436f0>=_0x5cdc13){_0x1436f0=_0x5cdc13;_0x41a385=0xc8;}else{_0x41a385=0xce;}_0x39c47d[_0x1d6a('0x1f')](_0x41a385);return _0x39c47d[_0x1d6a('0x26')](_0x1d6a('0x27'),_0x4e0843+'-'+_0x1436f0+'/'+_0x5cdc13)[_0x1d6a('0x21')](_0x2da8ef);}return null;};}function patchUpdates(_0x175c25){return function(_0x10c433){try{jsonpatch[_0x1d6a('0x28')](_0x10c433,_0x175c25,!![]);}catch(_0x143ed9){return BPromise[_0x1d6a('0x29')](_0x143ed9);}return _0x10c433[_0x1d6a('0x2a')]();};}function saveUpdates(_0xd44d44,_0x50b349){return function(_0x52ea4b){if(_0x52ea4b){return _0x52ea4b[_0x1d6a('0x2b')](_0xd44d44)[_0x1d6a('0x2c')](function(_0x397ce3){return _0x397ce3;});}return null;};}function removeEntity(_0x1aa63c,_0x171806){return function(_0x59ba80){if(_0x59ba80){return _0x59ba80[_0x1d6a('0x2d')]()['then'](function(){_0x1aa63c[_0x1d6a('0x1f')](0xcc)[_0x1d6a('0x20')]();});}};}function handleEntityNotFound(_0x3c2d35,_0x5eaeaa){return function(_0x3eb7a9){if(!_0x3eb7a9){_0x3c2d35[_0x1d6a('0x1e')](0x194);}return _0x3eb7a9;};}function handleError(_0x249495,_0x44b723){_0x44b723=_0x44b723||0x1f4;return function(_0x516087){logger[_0x1d6a('0x2e')](_0x516087[_0x1d6a('0x2f')]);if(_0x516087[_0x1d6a('0x30')]){delete _0x516087[_0x1d6a('0x30')];}_0x249495[_0x1d6a('0x1f')](_0x44b723)['send'](_0x516087);};}exports['index']=function(_0x4c43ea,_0x769526){var _0x4f5aae={},_0x3183d1={},_0x15bbcc={'count':0x0,'rows':[]};var _0x312766=_[_0x1d6a('0x31')](db[_0x1d6a('0x32')][_0x1d6a('0x33')],function(_0x1b0905){return{'name':_0x1b0905[_0x1d6a('0x34')],'type':_0x1b0905[_0x1d6a('0x35')]['key']};});_0x3183d1[_0x1d6a('0x36')]=_['map'](_0x312766,_0x1d6a('0x30'));_0x3183d1['query']=_[_0x1d6a('0x37')](_0x4c43ea[_0x1d6a('0x38')]);_0x3183d1[_0x1d6a('0x39')]=_['intersection'](_0x3183d1[_0x1d6a('0x36')],_0x3183d1[_0x1d6a('0x38')]);_0x4f5aae[_0x1d6a('0x3a')]=_[_0x1d6a('0x3b')](_0x3183d1[_0x1d6a('0x36')],qs[_0x1d6a('0x3c')](_0x4c43ea[_0x1d6a('0x38')][_0x1d6a('0x3c')]));_0x4f5aae[_0x1d6a('0x3a')]=_0x4f5aae[_0x1d6a('0x3a')]['length']?_0x4f5aae[_0x1d6a('0x3a')]:_0x3183d1[_0x1d6a('0x36')];if(!_0x4c43ea['query'][_0x1d6a('0x3d')](_0x1d6a('0x3e'))){_0x4f5aae['limit']=qs[_0x1d6a('0x22')](_0x4c43ea[_0x1d6a('0x38')]['limit']);_0x4f5aae[_0x1d6a('0x25')]=qs[_0x1d6a('0x25')](_0x4c43ea[_0x1d6a('0x38')]['offset']);}_0x4f5aae[_0x1d6a('0x3f')]=qs[_0x1d6a('0x40')](_0x4c43ea[_0x1d6a('0x38')][_0x1d6a('0x40')]);_0x4f5aae[_0x1d6a('0x41')]=qs['filters'](_[_0x1d6a('0x42')](_0x4c43ea[_0x1d6a('0x38')],_0x3183d1[_0x1d6a('0x39')]),_0x312766);if(_0x4c43ea[_0x1d6a('0x38')][_0x1d6a('0x43')]){_0x4f5aae[_0x1d6a('0x41')]=_[_0x1d6a('0x44')](_0x4f5aae[_0x1d6a('0x41')],{'$or':_[_0x1d6a('0x31')](_0x312766,function(_0x2fb99f){if(_0x2fb99f[_0x1d6a('0x35')]!=='VIRTUAL'){var _0x5f589d={};_0x5f589d[_0x2fb99f['name']]={'$like':'%'+_0x4c43ea[_0x1d6a('0x38')][_0x1d6a('0x43')]+'%'};return _0x5f589d;}})});}_0x4f5aae=_['merge']({},_0x4f5aae,_0x4c43ea[_0x1d6a('0x45')]);var _0x8a7533={'where':_0x4f5aae[_0x1d6a('0x41')]};return db[_0x1d6a('0x32')][_0x1d6a('0x24')](_0x8a7533)[_0x1d6a('0x2c')](function(_0x5d3984){_0x15bbcc[_0x1d6a('0x24')]=_0x5d3984;if(_0x4c43ea[_0x1d6a('0x38')][_0x1d6a('0x46')]){_0x4f5aae[_0x1d6a('0x47')]=[{'all':!![]}];}return db[_0x1d6a('0x32')][_0x1d6a('0x48')](_0x4f5aae);})[_0x1d6a('0x2c')](function(_0x5bca62){_0x15bbcc[_0x1d6a('0x49')]=_0x5bca62;return _0x15bbcc;})[_0x1d6a('0x2c')](respondWithFilteredResult(_0x769526,_0x4f5aae))[_0x1d6a('0x4a')](handleError(_0x769526,null));};exports[_0x1d6a('0x4b')]=function(_0x3f7269,_0x4dddc0){var _0x3f5581={'raw':![],'where':{'id':_0x3f7269['params']['id']}},_0x46fda0={};_0x46fda0['model']=_[_0x1d6a('0x37')](db['SugarcrmAccount'][_0x1d6a('0x33')]);_0x46fda0['query']=_[_0x1d6a('0x37')](_0x3f7269['query']);_0x46fda0[_0x1d6a('0x39')]=_[_0x1d6a('0x3b')](_0x46fda0[_0x1d6a('0x36')],_0x46fda0[_0x1d6a('0x38')]);_0x3f5581['attributes']=_[_0x1d6a('0x3b')](_0x46fda0['model'],qs[_0x1d6a('0x3c')](_0x3f7269['query'][_0x1d6a('0x3c')]));_0x3f5581[_0x1d6a('0x3a')]=_0x3f5581['attributes'][_0x1d6a('0x4c')]?_0x3f5581[_0x1d6a('0x3a')]:_0x46fda0[_0x1d6a('0x36')];if(_0x3f7269[_0x1d6a('0x38')]['includeAll']){_0x3f5581['include']=[{'all':!![]}];}_0x3f5581=_[_0x1d6a('0x44')]({},_0x3f5581,_0x3f7269[_0x1d6a('0x45')]);return db['SugarcrmAccount'][_0x1d6a('0x4d')](_0x3f5581)['then'](handleEntityNotFound(_0x4dddc0,null))[_0x1d6a('0x2c')](respondWithResult(_0x4dddc0,null))['catch'](handleError(_0x4dddc0,null));};exports[_0x1d6a('0x4e')]=function(_0x3d1480,_0x525324){return db[_0x1d6a('0x32')][_0x1d6a('0x4e')](_0x3d1480[_0x1d6a('0x4f')],{})[_0x1d6a('0x2c')](respondWithResult(_0x525324,0xc9))[_0x1d6a('0x4a')](handleError(_0x525324,null));};exports[_0x1d6a('0x2b')]=function(_0xd5f9c,_0x173b92){if(_0xd5f9c[_0x1d6a('0x4f')]['id']){delete _0xd5f9c[_0x1d6a('0x4f')]['id'];}return db[_0x1d6a('0x32')][_0x1d6a('0x4d')]({'where':{'id':_0xd5f9c[_0x1d6a('0x50')]['id']}})[_0x1d6a('0x2c')](handleEntityNotFound(_0x173b92,null))[_0x1d6a('0x2c')](saveUpdates(_0xd5f9c[_0x1d6a('0x4f')],null))[_0x1d6a('0x2c')](respondWithResult(_0x173b92,null))[_0x1d6a('0x4a')](handleError(_0x173b92,null));};exports[_0x1d6a('0x2d')]=function(_0x58f75a,_0x1ced88){return db[_0x1d6a('0x32')][_0x1d6a('0x4d')]({'where':{'id':_0x58f75a[_0x1d6a('0x50')]['id']}})[_0x1d6a('0x2c')](handleEntityNotFound(_0x1ced88,null))['then'](removeEntity(_0x1ced88,null))[_0x1d6a('0x4a')](handleError(_0x1ced88,null));};exports[_0x1d6a('0x51')]=function(_0xbe9680,_0x4a4c20,_0x1d9341){var _0x2b6867={};var _0x37dca8={};var _0x14a7aa;var _0x16b101;return db[_0x1d6a('0x32')][_0x1d6a('0x52')]({'where':{'id':_0xbe9680[_0x1d6a('0x50')]['id']}})[_0x1d6a('0x2c')](handleEntityNotFound(_0x4a4c20,null))[_0x1d6a('0x2c')](function(_0x236515){if(_0x236515){_0x14a7aa=_0x236515;_0x37dca8[_0x1d6a('0x36')]=_[_0x1d6a('0x37')](db[_0x1d6a('0x53')]['rawAttributes']);_0x37dca8[_0x1d6a('0x38')]=_[_0x1d6a('0x37')](_0xbe9680[_0x1d6a('0x38')]);_0x37dca8[_0x1d6a('0x39')]=_[_0x1d6a('0x3b')](_0x37dca8[_0x1d6a('0x36')],_0x37dca8[_0x1d6a('0x38')]);_0x2b6867[_0x1d6a('0x3a')]=_[_0x1d6a('0x3b')](_0x37dca8[_0x1d6a('0x36')],qs[_0x1d6a('0x3c')](_0xbe9680[_0x1d6a('0x38')][_0x1d6a('0x3c')]));_0x2b6867[_0x1d6a('0x3a')]=_0x2b6867[_0x1d6a('0x3a')]['length']?_0x2b6867[_0x1d6a('0x3a')]:_0x37dca8[_0x1d6a('0x36')];_0x2b6867[_0x1d6a('0x3f')]=qs[_0x1d6a('0x40')](_0xbe9680[_0x1d6a('0x38')]['sort']);_0x2b6867['where']=qs[_0x1d6a('0x39')](_[_0x1d6a('0x42')](_0xbe9680['query'],_0x37dca8[_0x1d6a('0x39')]));if(_0xbe9680[_0x1d6a('0x38')][_0x1d6a('0x43')]){_0x2b6867[_0x1d6a('0x41')]=_[_0x1d6a('0x44')](_0x2b6867['where'],{'$or':_['map'](_0x2b6867[_0x1d6a('0x3a')],function(_0x58bc6a){var _0x4aad78={};_0x4aad78[_0x58bc6a]={'$like':'%'+_0xbe9680[_0x1d6a('0x38')][_0x1d6a('0x43')]+'%'};return _0x4aad78;})});}_0x2b6867=_[_0x1d6a('0x44')]({},_0x2b6867,_0xbe9680[_0x1d6a('0x45')]);return _0x14a7aa['getConfigurations'](_0x2b6867);}})[_0x1d6a('0x2c')](function(_0x11e5d8){if(_0x11e5d8){_0x16b101=_0x11e5d8['length'];if(!_0xbe9680[_0x1d6a('0x38')]['hasOwnProperty']('nolimit')){_0x2b6867[_0x1d6a('0x22')]=qs[_0x1d6a('0x22')](_0xbe9680[_0x1d6a('0x38')][_0x1d6a('0x22')]);_0x2b6867['offset']=qs[_0x1d6a('0x25')](_0xbe9680[_0x1d6a('0x38')][_0x1d6a('0x25')]);}return _0x14a7aa[_0x1d6a('0x51')](_0x2b6867);}})[_0x1d6a('0x2c')](function(_0x34b9ba){if(_0x34b9ba){return _0x34b9ba?{'count':_0x16b101,'rows':_0x34b9ba}:null;}})[_0x1d6a('0x2c')](respondWithResult(_0x4a4c20,null))[_0x1d6a('0x4a')](handleError(_0x4a4c20,null));};exports[_0x1d6a('0x54')]=function(_0x209b46,_0x3b71aa,_0x2307e9){if(_0x209b46['body']['id']){delete _0x209b46[_0x1d6a('0x4f')]['id'];}return db[_0x1d6a('0x32')][_0x1d6a('0x52')]({'where':{'id':_0x209b46[_0x1d6a('0x50')]['id']}})['then'](handleEntityNotFound(_0x3b71aa,null))['then'](function(_0x255d91){if(_0x255d91){_0x209b46[_0x1d6a('0x4f')][_0x1d6a('0x55')]=_0x255d91['id'];_0x209b46[_0x1d6a('0x4f')][_0x1d6a('0x56')]=integrations[_0x1d6a('0x57')](_0x209b46[_0x1d6a('0x4f')][_0x1d6a('0x58')],_0x209b46['body'][_0x1d6a('0x35')]);_0x209b46[_0x1d6a('0x4f')][_0x1d6a('0x59')]=integrations['getDescriptions'](_0x209b46['body'][_0x1d6a('0x58')],_0x209b46[_0x1d6a('0x4f')][_0x1d6a('0x35')]);return db[_0x1d6a('0x53')][_0x1d6a('0x4e')](_0x209b46[_0x1d6a('0x4f')],{'include':[{'model':db['SugarcrmField'],'as':_0x1d6a('0x56')},{'model':db['SugarcrmField'],'as':_0x1d6a('0x59')}]});}return null;})[_0x1d6a('0x2c')](respondWithResult(_0x3b71aa,null))[_0x1d6a('0x4a')](handleError(_0x3b71aa,null));};exports[_0x1d6a('0x5a')]=function(_0x3f7f95,_0x194ef6,_0x231c10){var _0x63e2b8='';var _0x3d8963=['id','name','assigned_user_id',_0x1d6a('0x5b'),_0x1d6a('0x5c'),_0x1d6a('0x5d'),_0x1d6a('0x5e'),_0x1d6a('0x5f'),_0x1d6a('0x60'),_0x1d6a('0x61'),_0x1d6a('0x62'),'direction'];return db['SugarcrmAccount'][_0x1d6a('0x52')]({'where':{'id':_0x3f7f95[_0x1d6a('0x50')]['id']},'attributes':['id',_0x1d6a('0x63'),_0x1d6a('0x64'),_0x1d6a('0x65')]})[_0x1d6a('0x2c')](handleEntityNotFound(_0x194ef6,null))['then'](function(_0x49cebf){if(_0x49cebf){_0x63e2b8=_0x49cebf['remoteUri'];var _0x495ade=_0x63e2b8[_0x1d6a('0x66')](-0x1);if(_0x495ade==='/'){_0x63e2b8=_0x63e2b8['substring'](0x0,_0x63e2b8[_0x1d6a('0x67')](_0x495ade));}return rp({'method':_0x1d6a('0x68'),'uri':util['format'](_0x1d6a('0x69'),_0x63e2b8,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1d6a('0x6a'),'input_type':'JSON','response_type':_0x1d6a('0x6b'),'rest_data':JSON[_0x1d6a('0x6c')]({'user_auth':{'user_name':_0x49cebf[_0x1d6a('0x63')],'password':_0x49cebf[_0x1d6a('0x64')],'encryption':'PLAIN'},'application':_0x1d6a('0x6d')})}});}})['then'](function(_0x228a9b){if(_0x228a9b&&_0x228a9b['name']!==_0x1d6a('0x6e')&&_0x228a9b[_0x1d6a('0x30')]!=='Password\x20Expired'){return rp({'method':_0x1d6a('0x68'),'uri':util[_0x1d6a('0x6f')](_0x1d6a('0x69'),_0x63e2b8,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x1d6a('0x6b'),'response_type':'JSON','rest_data':JSON[_0x1d6a('0x6c')]({'session':_0x228a9b['id'],'module_name':_0x1d6a('0x70')})}})[_0x1d6a('0x2c')](function(_0x1a32e6){if(_0x1a32e6){var _0x552013=_[_0x1d6a('0x71')](_0x1a32e6[_0x1d6a('0x72')]);_[_0x1d6a('0x73')](_0x552013,function(_0x240615){return _0x3d8963[_0x1d6a('0x74')](_0x240615[_0x1d6a('0x30')]);});return{'count':_0x552013['length'],'rows':_['map'](_0x552013,function(_0x3482d7){return{'id':_0x3482d7[_0x1d6a('0x30')],'name':_0x3482d7[_0x1d6a('0x75')],'custom':_['endsWith'](_0x3482d7['name'],'_c')?!![]:![],'options':_0x3482d7['options']?_[_0x1d6a('0x31')](_[_0x1d6a('0x71')](_0x3482d7[_0x1d6a('0x45')]),function(_0x2d98a3){return{'name':_0x2d98a3[_0x1d6a('0x76')],'value':_0x2d98a3['name']};}):[]};})};}})[_0x1d6a('0x2c')](respondWithResult(_0x194ef6,null))[_0x1d6a('0x4a')](function(_0x39a179){var _0x26cacc=_0x3f7f95['query']['test']?0x1f4:_0x39a179[_0x1d6a('0x77')]||0x1f4;logger[_0x1d6a('0x2e')](_0x1d6a('0x78'),'getFields',_0x26cacc,JSON[_0x1d6a('0x6c')](_0x39a179));delete _0x39a179['name'];if(_0x26cacc===0x191){_0x26cacc=0x190;}_0x194ef6[_0x1d6a('0x1f')](_0x26cacc)[_0x1d6a('0x79')](_0x3f7f95[_0x1d6a('0x38')][_0x1d6a('0x7a')]?{'message':_0x1d6a('0x7b'),'statusCode':_0x39a179['statusCode']}:_0x39a179);});}else{var _0xbf358d=0x1f4;_0x194ef6[_0x1d6a('0x1f')](_0xbf358d)[_0x1d6a('0x79')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x6dc2=['map','filter','options','SugarcrmAccount','includeAll','findAll','rows','catch','show','params','length','include','find','body','destroy','getConfigurations','SugarcrmConfiguration','pick','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_type','parent_name','findOne','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','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','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','merge'];(function(_0x206276,_0x3619af){var _0x301ae0=function(_0x490370){while(--_0x490370){_0x206276['push'](_0x206276['shift']());}};_0x301ae0(++_0x3619af);}(_0x6dc2,0x1a9));var _0x26dc=function(_0x57b2f8,_0x5a7b60){_0x57b2f8=_0x57b2f8-0x0;var _0x170dfa=_0x6dc2[_0x57b2f8];return _0x170dfa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x26dc('0x0'));var jsonpatch=require(_0x26dc('0x1'));var rp=require(_0x26dc('0x2'));var moment=require(_0x26dc('0x3'));var BPromise=require(_0x26dc('0x4'));var Mustache=require('mustache');var util=require(_0x26dc('0x5'));var path=require('path');var sox=require(_0x26dc('0x6'));var csv=require(_0x26dc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26dc('0x8'));var _=require(_0x26dc('0x9'));var squel=require(_0x26dc('0xa'));var crypto=require(_0x26dc('0xb'));var jsforce=require(_0x26dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x26dc('0x7'));var querystring=require(_0x26dc('0xd'));var Papa=require('papaparse');var Redis=require(_0x26dc('0xe'));var authService=require(_0x26dc('0xf'));var qs=require(_0x26dc('0x10'));var as=require(_0x26dc('0x11'));var hardwareService=require(_0x26dc('0x12'));var logger=require(_0x26dc('0x13'))(_0x26dc('0x14'));var utils=require(_0x26dc('0x15'));var config=require(_0x26dc('0x16'));var licenseUtil=require(_0x26dc('0x17'));var db=require(_0x26dc('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e3c18,_0x31c909){_0x31c909=_0x31c909||0xcc;return function(_0x37403c){if(_0x37403c){return _0x3e3c18[_0x26dc('0x19')](_0x31c909);}return _0x3e3c18[_0x26dc('0x1a')](_0x31c909)[_0x26dc('0x1b')]();};}function respondWithResult(_0x32103f,_0x36e017){_0x36e017=_0x36e017||0xc8;return function(_0x1e4152){if(_0x1e4152){return _0x32103f[_0x26dc('0x1a')](_0x36e017)[_0x26dc('0x1c')](_0x1e4152);}};}function respondWithFilteredResult(_0x32973b,_0x5bfcb0){return function(_0x246d9c){if(_0x246d9c){var _0x19f357=typeof _0x5bfcb0[_0x26dc('0x1d')]==='undefined'&&typeof _0x5bfcb0[_0x26dc('0x1e')]==='undefined';var _0x35af4f=_0x246d9c[_0x26dc('0x1f')];var _0x34ff4a=_0x19f357?0x0:_0x5bfcb0[_0x26dc('0x1d')];var _0x1ce6cb=_0x19f357?_0x246d9c['count']:_0x5bfcb0[_0x26dc('0x1d')]+_0x5bfcb0[_0x26dc('0x1e')];var _0x190308;if(_0x1ce6cb>=_0x35af4f){_0x1ce6cb=_0x35af4f;_0x190308=0xc8;}else{_0x190308=0xce;}_0x32973b[_0x26dc('0x1a')](_0x190308);return _0x32973b[_0x26dc('0x20')](_0x26dc('0x21'),_0x34ff4a+'-'+_0x1ce6cb+'/'+_0x35af4f)['json'](_0x246d9c);}return null;};}function patchUpdates(_0x24dc80){return function(_0x1fca0b){try{jsonpatch[_0x26dc('0x22')](_0x1fca0b,_0x24dc80,!![]);}catch(_0x2fd792){return BPromise[_0x26dc('0x23')](_0x2fd792);}return _0x1fca0b['save']();};}function saveUpdates(_0x4d3e66,_0x2bd3de){return function(_0x58302f){if(_0x58302f){return _0x58302f[_0x26dc('0x24')](_0x4d3e66)[_0x26dc('0x25')](function(_0x44cef2){return _0x44cef2;});}return null;};}function removeEntity(_0x21be9c,_0x45d381){return function(_0x2c4a4d){if(_0x2c4a4d){return _0x2c4a4d['destroy']()[_0x26dc('0x25')](function(){_0x21be9c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b48eb,_0x13307d){return function(_0x44348b){if(!_0x44348b){_0x2b48eb['sendStatus'](0x194);}return _0x44348b;};}function handleError(_0x5cd6de,_0x1359be){_0x1359be=_0x1359be||0x1f4;return function(_0x50227e){logger[_0x26dc('0x26')](_0x50227e[_0x26dc('0x27')]);if(_0x50227e[_0x26dc('0x28')]){delete _0x50227e[_0x26dc('0x28')];}_0x5cd6de['status'](_0x1359be)[_0x26dc('0x29')](_0x50227e);};}exports[_0x26dc('0x2a')]=function(_0x41f712,_0x11d123){var _0x51a97e={},_0x3fb48c={},_0x136ed9={'count':0x0,'rows':[]};var _0x331f63=_['map'](db['SugarcrmAccount'][_0x26dc('0x2b')],function(_0x2a7e00){return{'name':_0x2a7e00[_0x26dc('0x2c')],'type':_0x2a7e00[_0x26dc('0x2d')]['key']};});_0x3fb48c[_0x26dc('0x2e')]=_['map'](_0x331f63,_0x26dc('0x28'));_0x3fb48c[_0x26dc('0x2f')]=_[_0x26dc('0x30')](_0x41f712[_0x26dc('0x2f')]);_0x3fb48c['filters']=_[_0x26dc('0x31')](_0x3fb48c[_0x26dc('0x2e')],_0x3fb48c['query']);_0x51a97e[_0x26dc('0x32')]=_['intersection'](_0x3fb48c[_0x26dc('0x2e')],qs[_0x26dc('0x33')](_0x41f712[_0x26dc('0x2f')][_0x26dc('0x33')]));_0x51a97e[_0x26dc('0x32')]=_0x51a97e['attributes']['length']?_0x51a97e[_0x26dc('0x32')]:_0x3fb48c[_0x26dc('0x2e')];if(!_0x41f712[_0x26dc('0x2f')][_0x26dc('0x34')](_0x26dc('0x35'))){_0x51a97e[_0x26dc('0x1e')]=qs[_0x26dc('0x1e')](_0x41f712[_0x26dc('0x2f')][_0x26dc('0x1e')]);_0x51a97e['offset']=qs[_0x26dc('0x1d')](_0x41f712['query']['offset']);}_0x51a97e[_0x26dc('0x36')]=qs['sort'](_0x41f712[_0x26dc('0x2f')][_0x26dc('0x37')]);_0x51a97e['where']=qs[_0x26dc('0x38')](_['pick'](_0x41f712[_0x26dc('0x2f')],_0x3fb48c[_0x26dc('0x38')]),_0x331f63);if(_0x41f712['query']['filter']){_0x51a97e[_0x26dc('0x39')]=_[_0x26dc('0x3a')](_0x51a97e['where'],{'$or':_[_0x26dc('0x3b')](_0x331f63,function(_0x1d9f69){if(_0x1d9f69[_0x26dc('0x2d')]!=='VIRTUAL'){var _0x1ea8f3={};_0x1ea8f3[_0x1d9f69['name']]={'$like':'%'+_0x41f712[_0x26dc('0x2f')][_0x26dc('0x3c')]+'%'};return _0x1ea8f3;}})});}_0x51a97e=_[_0x26dc('0x3a')]({},_0x51a97e,_0x41f712[_0x26dc('0x3d')]);var _0x4db777={'where':_0x51a97e[_0x26dc('0x39')]};return db[_0x26dc('0x3e')][_0x26dc('0x1f')](_0x4db777)[_0x26dc('0x25')](function(_0x5e43af){_0x136ed9[_0x26dc('0x1f')]=_0x5e43af;if(_0x41f712['query'][_0x26dc('0x3f')]){_0x51a97e['include']=[{'all':!![]}];}return db[_0x26dc('0x3e')][_0x26dc('0x40')](_0x51a97e);})[_0x26dc('0x25')](function(_0x26b772){_0x136ed9[_0x26dc('0x41')]=_0x26b772;return _0x136ed9;})[_0x26dc('0x25')](respondWithFilteredResult(_0x11d123,_0x51a97e))[_0x26dc('0x42')](handleError(_0x11d123,null));};exports[_0x26dc('0x43')]=function(_0x5ed266,_0x13c841){var _0x3a66eb={'raw':![],'where':{'id':_0x5ed266[_0x26dc('0x44')]['id']}},_0x1251ec={};_0x1251ec[_0x26dc('0x2e')]=_[_0x26dc('0x30')](db['SugarcrmAccount'][_0x26dc('0x2b')]);_0x1251ec[_0x26dc('0x2f')]=_[_0x26dc('0x30')](_0x5ed266[_0x26dc('0x2f')]);_0x1251ec[_0x26dc('0x38')]=_[_0x26dc('0x31')](_0x1251ec['model'],_0x1251ec[_0x26dc('0x2f')]);_0x3a66eb['attributes']=_[_0x26dc('0x31')](_0x1251ec['model'],qs[_0x26dc('0x33')](_0x5ed266['query']['fields']));_0x3a66eb['attributes']=_0x3a66eb['attributes'][_0x26dc('0x45')]?_0x3a66eb[_0x26dc('0x32')]:_0x1251ec[_0x26dc('0x2e')];if(_0x5ed266[_0x26dc('0x2f')][_0x26dc('0x3f')]){_0x3a66eb[_0x26dc('0x46')]=[{'all':!![]}];}_0x3a66eb=_[_0x26dc('0x3a')]({},_0x3a66eb,_0x5ed266[_0x26dc('0x3d')]);return db[_0x26dc('0x3e')][_0x26dc('0x47')](_0x3a66eb)['then'](handleEntityNotFound(_0x13c841,null))[_0x26dc('0x25')](respondWithResult(_0x13c841,null))[_0x26dc('0x42')](handleError(_0x13c841,null));};exports['create']=function(_0x3f1aa7,_0x491a46){return db[_0x26dc('0x3e')]['create'](_0x3f1aa7[_0x26dc('0x48')],{})['then'](respondWithResult(_0x491a46,0xc9))[_0x26dc('0x42')](handleError(_0x491a46,null));};exports[_0x26dc('0x24')]=function(_0x470f5b,_0x2e7755){if(_0x470f5b['body']['id']){delete _0x470f5b['body']['id'];}return db['SugarcrmAccount'][_0x26dc('0x47')]({'where':{'id':_0x470f5b[_0x26dc('0x44')]['id']}})[_0x26dc('0x25')](handleEntityNotFound(_0x2e7755,null))['then'](saveUpdates(_0x470f5b[_0x26dc('0x48')],null))[_0x26dc('0x25')](respondWithResult(_0x2e7755,null))[_0x26dc('0x42')](handleError(_0x2e7755,null));};exports[_0x26dc('0x49')]=function(_0x50f69c,_0x158f7c){return db[_0x26dc('0x3e')][_0x26dc('0x47')]({'where':{'id':_0x50f69c[_0x26dc('0x44')]['id']}})['then'](handleEntityNotFound(_0x158f7c,null))[_0x26dc('0x25')](removeEntity(_0x158f7c,null))[_0x26dc('0x42')](handleError(_0x158f7c,null));};exports[_0x26dc('0x4a')]=function(_0x251b15,_0x223d6f,_0x3cc218){var _0x43dba9={};var _0x59de59={};var _0x3c3bbe;var _0xb0a6e5;return db[_0x26dc('0x3e')]['findOne']({'where':{'id':_0x251b15[_0x26dc('0x44')]['id']}})['then'](handleEntityNotFound(_0x223d6f,null))['then'](function(_0x146bbd){if(_0x146bbd){_0x3c3bbe=_0x146bbd;_0x59de59[_0x26dc('0x2e')]=_['keys'](db[_0x26dc('0x4b')]['rawAttributes']);_0x59de59[_0x26dc('0x2f')]=_[_0x26dc('0x30')](_0x251b15[_0x26dc('0x2f')]);_0x59de59[_0x26dc('0x38')]=_[_0x26dc('0x31')](_0x59de59[_0x26dc('0x2e')],_0x59de59[_0x26dc('0x2f')]);_0x43dba9['attributes']=_['intersection'](_0x59de59[_0x26dc('0x2e')],qs[_0x26dc('0x33')](_0x251b15[_0x26dc('0x2f')]['fields']));_0x43dba9[_0x26dc('0x32')]=_0x43dba9['attributes'][_0x26dc('0x45')]?_0x43dba9[_0x26dc('0x32')]:_0x59de59[_0x26dc('0x2e')];_0x43dba9[_0x26dc('0x36')]=qs[_0x26dc('0x37')](_0x251b15['query'][_0x26dc('0x37')]);_0x43dba9[_0x26dc('0x39')]=qs['filters'](_[_0x26dc('0x4c')](_0x251b15[_0x26dc('0x2f')],_0x59de59[_0x26dc('0x38')]));if(_0x251b15['query']['filter']){_0x43dba9[_0x26dc('0x39')]=_[_0x26dc('0x3a')](_0x43dba9['where'],{'$or':_[_0x26dc('0x3b')](_0x43dba9['attributes'],function(_0x181f0f){var _0x13e46d={};_0x13e46d[_0x181f0f]={'$like':'%'+_0x251b15[_0x26dc('0x2f')][_0x26dc('0x3c')]+'%'};return _0x13e46d;})});}_0x43dba9=_['merge']({},_0x43dba9,_0x251b15['options']);return _0x3c3bbe[_0x26dc('0x4a')](_0x43dba9);}})[_0x26dc('0x25')](function(_0xb26b9d){if(_0xb26b9d){_0xb0a6e5=_0xb26b9d[_0x26dc('0x45')];if(!_0x251b15['query'][_0x26dc('0x34')](_0x26dc('0x35'))){_0x43dba9[_0x26dc('0x1e')]=qs[_0x26dc('0x1e')](_0x251b15[_0x26dc('0x2f')][_0x26dc('0x1e')]);_0x43dba9[_0x26dc('0x1d')]=qs['offset'](_0x251b15[_0x26dc('0x2f')]['offset']);}return _0x3c3bbe[_0x26dc('0x4a')](_0x43dba9);}})[_0x26dc('0x25')](function(_0x10d0a7){if(_0x10d0a7){return _0x10d0a7?{'count':_0xb0a6e5,'rows':_0x10d0a7}:null;}})['then'](respondWithResult(_0x223d6f,null))[_0x26dc('0x42')](handleError(_0x223d6f,null));};exports['addConfiguration']=function(_0x155315,_0xf1b462,_0x33fb6d){if(_0x155315[_0x26dc('0x48')]['id']){delete _0x155315['body']['id'];}return db[_0x26dc('0x3e')]['findOne']({'where':{'id':_0x155315['params']['id']}})[_0x26dc('0x25')](handleEntityNotFound(_0xf1b462,null))[_0x26dc('0x25')](function(_0x26a965){if(_0x26a965){_0x155315[_0x26dc('0x48')][_0x26dc('0x4d')]=_0x26a965['id'];_0x155315[_0x26dc('0x48')][_0x26dc('0x4e')]=integrations[_0x26dc('0x4f')](_0x155315[_0x26dc('0x48')]['channel'],_0x155315[_0x26dc('0x48')][_0x26dc('0x2d')]);_0x155315[_0x26dc('0x48')][_0x26dc('0x50')]=integrations[_0x26dc('0x51')](_0x155315['body'][_0x26dc('0x52')],_0x155315['body']['type']);return db[_0x26dc('0x4b')][_0x26dc('0x53')](_0x155315[_0x26dc('0x48')],{'include':[{'model':db['SugarcrmField'],'as':_0x26dc('0x4e')},{'model':db[_0x26dc('0x54')],'as':_0x26dc('0x50')}]});}return null;})[_0x26dc('0x25')](respondWithResult(_0xf1b462,null))['catch'](handleError(_0xf1b462,null));};exports['getFields']=function(_0x4fcfe6,_0x1f2d91,_0x1365ac){var _0xe767bf='';var _0x11bdc3=['id',_0x26dc('0x28'),_0x26dc('0x55'),_0x26dc('0x56'),'description',_0x26dc('0x57'),_0x26dc('0x58'),_0x26dc('0x59'),'parent_id',_0x26dc('0x5a'),_0x26dc('0x5b'),'direction'];return db['SugarcrmAccount'][_0x26dc('0x5c')]({'where':{'id':_0x4fcfe6[_0x26dc('0x44')]['id']},'attributes':['id',_0x26dc('0x5d'),_0x26dc('0x5e'),_0x26dc('0x5f')]})[_0x26dc('0x25')](handleEntityNotFound(_0x1f2d91,null))[_0x26dc('0x25')](function(_0x235450){if(_0x235450){_0xe767bf=_0x235450[_0x26dc('0x5f')];var _0x2c310f=_0xe767bf[_0x26dc('0x60')](-0x1);if(_0x2c310f==='/'){_0xe767bf=_0xe767bf[_0x26dc('0x61')](0x0,_0xe767bf['lastIndexOf'](_0x2c310f));}return rp({'method':_0x26dc('0x62'),'uri':util[_0x26dc('0x63')](_0x26dc('0x64'),_0xe767bf,_0x26dc('0x65')),'json':!![],'form':{'method':_0x26dc('0x66'),'input_type':'JSON','response_type':_0x26dc('0x67'),'rest_data':JSON[_0x26dc('0x68')]({'user_auth':{'user_name':_0x235450[_0x26dc('0x5d')],'password':_0x235450[_0x26dc('0x5e')],'encryption':_0x26dc('0x69')},'application':_0x26dc('0x6a')})}});}})[_0x26dc('0x25')](function(_0x4b7c11){if(_0x4b7c11&&_0x4b7c11[_0x26dc('0x28')]!==_0x26dc('0x6b')&&_0x4b7c11[_0x26dc('0x28')]!=='Password\x20Expired'){return rp({'method':_0x26dc('0x62'),'uri':util[_0x26dc('0x63')]('%s%s',_0xe767bf,_0x26dc('0x65')),'json':!![],'form':{'method':_0x26dc('0x6c'),'input_type':_0x26dc('0x67'),'response_type':_0x26dc('0x67'),'rest_data':JSON[_0x26dc('0x68')]({'session':_0x4b7c11['id'],'module_name':_0x26dc('0x6d')})}})['then'](function(_0x2c5103){if(_0x2c5103){var _0x32a7b6=_['values'](_0x2c5103[_0x26dc('0x6e')]);_[_0x26dc('0x6f')](_0x32a7b6,function(_0x1feaaa){return _0x11bdc3[_0x26dc('0x70')](_0x1feaaa[_0x26dc('0x28')]);});return{'count':_0x32a7b6[_0x26dc('0x45')],'rows':_[_0x26dc('0x3b')](_0x32a7b6,function(_0x140beb){return{'id':_0x140beb[_0x26dc('0x28')],'name':_0x140beb[_0x26dc('0x71')],'custom':_[_0x26dc('0x72')](_0x140beb['name'],'_c')?!![]:![],'options':_0x140beb['options']?_[_0x26dc('0x3b')](_[_0x26dc('0x73')](_0x140beb[_0x26dc('0x3d')]),function(_0x6840f7){return{'name':_0x6840f7['value'],'value':_0x6840f7[_0x26dc('0x28')]};}):[]};})};}})[_0x26dc('0x25')](respondWithResult(_0x1f2d91,null))[_0x26dc('0x42')](function(_0x4b7001){var _0x5c051b=_0x4fcfe6['query'][_0x26dc('0x74')]?0x1f4:_0x4b7001[_0x26dc('0x75')]||0x1f4;logger[_0x26dc('0x26')](_0x26dc('0x76'),_0x26dc('0x77'),_0x5c051b,JSON[_0x26dc('0x68')](_0x4b7001));delete _0x4b7001[_0x26dc('0x28')];if(_0x5c051b===0x191){_0x5c051b=0x190;}_0x1f2d91[_0x26dc('0x1a')](_0x5c051b)[_0x26dc('0x29')](_0x4fcfe6['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x4b7001[_0x26dc('0x75')]}:_0x4b7001);});}else{var _0x29fc51=0x1f4;_0x1f2d91[_0x26dc('0x1a')](_0x29fc51)[_0x26dc('0x29')]({'message':_0x26dc('0x78'),'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 32143ef..2f11224 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 _0x23b6=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','lodash','util','api','moment','bluebird'];(function(_0x23fda9,_0x3e6beb){var _0x2c6584=function(_0x4bb268){while(--_0x4bb268){_0x23fda9['push'](_0x23fda9['shift']());}};_0x2c6584(++_0x3e6beb);}(_0x23b6,0xd7));var _0x623b=function(_0x2803ab,_0x1c33f2){_0x2803ab=_0x2803ab-0x0;var _0x3d6e8e=_0x23b6[_0x2803ab];return _0x3d6e8e;};'use strict';var _=require(_0x623b('0x0'));var util=require(_0x623b('0x1'));var logger=require('../../config/logger')(_0x623b('0x2'));var moment=require(_0x623b('0x3'));var BPromise=require(_0x623b('0x4'));var rp=require(_0x623b('0x5'));var fs=require('fs');var path=require(_0x623b('0x6'));var rimraf=require(_0x623b('0x7'));var config=require(_0x623b('0x8'));var attributes=require(_0x623b('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5cb588,_0x4ce139){return _0x5cb588[_0x623b('0xa')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc953=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x56c4cc,_0x2e9510){var _0x1d2067=function(_0x46929e){while(--_0x46929e){_0x56c4cc['push'](_0x56c4cc['shift']());}};_0x1d2067(++_0x2e9510);}(_0xc953,0x84));var _0x3c95=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0xc953[_0x52121d];return _0x448627;};'use strict';var _=require(_0x3c95('0x0'));var util=require(_0x3c95('0x1'));var logger=require(_0x3c95('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3c95('0x3'));var rp=require(_0x3c95('0x4'));var fs=require('fs');var path=require(_0x3c95('0x5'));var rimraf=require(_0x3c95('0x6'));var config=require(_0x3c95('0x7'));var attributes=require(_0x3c95('0x8'));var integrations=require(_0x3c95('0x9'));module[_0x3c95('0xa')]=function(_0x5dc307,_0x5d99fb){return _0x5dc307[_0x3c95('0xb')](_0x3c95('0xc'),attributes,{'tableName':_0x3c95('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 f3574d3..c98ca99 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 _0xd326=['client','http','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','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/environment'];(function(_0x5d36d0,_0x2aacd4){var _0xc8bba0=function(_0x48adf5){while(--_0x48adf5){_0x5d36d0['push'](_0x5d36d0['shift']());}};_0xc8bba0(++_0x2aacd4);}(_0xd326,0x82));var _0x6d32=function(_0x1a1155,_0x56e693){_0x1a1155=_0x1a1155-0x0;var _0x4219b6=_0xd326[_0x1a1155];return _0x4219b6;};'use strict';var _=require(_0x6d32('0x0'));var util=require('util');var moment=require(_0x6d32('0x1'));var BPromise=require(_0x6d32('0x2'));var rs=require(_0x6d32('0x3'));var fs=require('fs');var Redis=require(_0x6d32('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6d32('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6d32('0x6')][_0x6d32('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f4054,_0x3394c2,_0x1fb0df){return new BPromise(function(_0x301815,_0x107c2c){return client[_0x6d32('0x8')](_0x2f4054,_0x1fb0df)[_0x6d32('0x9')](function(_0x108360){logger[_0x6d32('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x3394c2,_0x6d32('0xb'));logger[_0x6d32('0xc')](_0x6d32('0xd'),_0x3394c2,_0x6d32('0xb'),JSON[_0x6d32('0xe')](_0x108360));if(_0x108360['error']){if(_0x108360[_0x6d32('0xf')][_0x6d32('0x10')]===0x1f4){logger[_0x6d32('0xf')](_0x6d32('0x11'),_0x3394c2,_0x108360[_0x6d32('0xf')][_0x6d32('0x12')]);return _0x107c2c(_0x108360[_0x6d32('0xf')][_0x6d32('0x12')]);}logger[_0x6d32('0xf')](_0x6d32('0x11'),_0x3394c2,_0x108360[_0x6d32('0xf')][_0x6d32('0x12')]);return _0x301815(_0x108360[_0x6d32('0xf')]['message']);}else{logger[_0x6d32('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x3394c2,_0x6d32('0xb'));_0x301815(_0x108360[_0x6d32('0x13')][_0x6d32('0x12')]);}})[_0x6d32('0x14')](function(_0x3d2f47){logger[_0x6d32('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x3394c2,_0x3d2f47);_0x107c2c(_0x3d2f47);});});}exports[_0x6d32('0x15')]=function(_0x36e6d0){var _0x4aab9b=this;return new Promise(function(_0x3ca517,_0x3e8807){return db[_0x6d32('0x16')][_0x6d32('0x17')]({'raw':_0x36e6d0[_0x6d32('0x18')]?_0x36e6d0['options'][_0x6d32('0x19')]===undefined?!![]:![]:!![],'where':_0x36e6d0[_0x6d32('0x18')]?_0x36e6d0[_0x6d32('0x18')][_0x6d32('0x1a')]||null:null,'attributes':_0x36e6d0['options']?_0x36e6d0['options'][_0x6d32('0x1b')]||null:null,'limit':_0x36e6d0[_0x6d32('0x18')]?_0x36e6d0[_0x6d32('0x18')][_0x6d32('0x1c')]||null:null,'include':_0x36e6d0[_0x6d32('0x18')]?_0x36e6d0[_0x6d32('0x18')][_0x6d32('0x1d')]?_['map'](_0x36e6d0[_0x6d32('0x18')][_0x6d32('0x1d')],function(_0x1557b1){return{'model':db[_0x1557b1['model']],'as':_0x1557b1['as'],'attributes':_0x1557b1[_0x6d32('0x1b')],'include':_0x1557b1['include']?_[_0x6d32('0x1e')](_0x1557b1[_0x6d32('0x1d')],function(_0x14c937){return{'model':db[_0x14c937['model']],'as':_0x14c937['as'],'attributes':_0x14c937[_0x6d32('0x1b')],'include':_0x14c937[_0x6d32('0x1d')]?_[_0x6d32('0x1e')](_0x14c937[_0x6d32('0x1d')],function(_0x4e8e73){return{'model':db[_0x4e8e73[_0x6d32('0x1f')]],'as':_0x4e8e73['as'],'attributes':_0x4e8e73[_0x6d32('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6d32('0x9')](function(_0x5123a5){logger[_0x6d32('0xa')]('GetSugarcrmAccount',_0x36e6d0);logger[_0x6d32('0xc')](_0x6d32('0x15'),_0x36e6d0,JSON['stringify'](_0x5123a5));_0x3ca517(_0x5123a5);})[_0x6d32('0x14')](function(_0x2fd04b){logger[_0x6d32('0xf')](_0x6d32('0x15'),_0x2fd04b[_0x6d32('0x12')],_0x36e6d0);_0x3e8807(_0x4aab9b[_0x6d32('0xf')](0x1f4,_0x2fd04b[_0x6d32('0x12')]));});});};exports[_0x6d32('0x20')]=function(_0x531bb3){var _0x4a62d5=this;return new Promise(function(_0x276fdc,_0x4199b4){return db[_0x6d32('0x16')][_0x6d32('0x21')]({'raw':_0x531bb3[_0x6d32('0x18')]?_0x531bb3[_0x6d32('0x18')][_0x6d32('0x19')]===undefined?!![]:![]:!![],'where':_0x531bb3[_0x6d32('0x18')]?_0x531bb3[_0x6d32('0x18')]['where']||null:null,'attributes':_0x531bb3['options']?_0x531bb3[_0x6d32('0x18')]['attributes']||null:null,'include':_0x531bb3[_0x6d32('0x18')]?_0x531bb3[_0x6d32('0x18')]['include']?_[_0x6d32('0x1e')](_0x531bb3[_0x6d32('0x18')]['include'],function(_0x50f73d){return{'model':db[_0x50f73d['model']],'as':_0x50f73d['as'],'attributes':_0x50f73d['attributes'],'include':_0x50f73d[_0x6d32('0x1d')]?_[_0x6d32('0x1e')](_0x50f73d['include'],function(_0x4345fa){return{'model':db[_0x4345fa[_0x6d32('0x1f')]],'as':_0x4345fa['as'],'attributes':_0x4345fa['attributes'],'include':_0x4345fa[_0x6d32('0x1d')]?_[_0x6d32('0x1e')](_0x4345fa[_0x6d32('0x1d')],function(_0x1863d9){return{'model':db[_0x1863d9[_0x6d32('0x1f')]],'as':_0x1863d9['as'],'attributes':_0x1863d9['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d32('0x9')](function(_0x12ec42){logger[_0x6d32('0xa')]('ShowSugarcrmAccount',_0x531bb3);logger['debug'](_0x6d32('0x20'),_0x531bb3,JSON[_0x6d32('0xe')](_0x12ec42));_0x276fdc(_0x12ec42);})[_0x6d32('0x14')](function(_0x287247){logger['error']('ShowSugarcrmAccount',_0x287247[_0x6d32('0x12')],_0x531bb3);_0x4199b4(_0x4a62d5[_0x6d32('0xf')](0x1f4,_0x287247[_0x6d32('0x12')]));});});}; \ No newline at end of file +var _0x5ea6=['rpc','../../config/environment','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options','attributes','include','map','model','debug','stringify','ShowSugarcrmAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x31c9dc,_0x24c945){var _0x326c0f=function(_0xf3cecc){while(--_0xf3cecc){_0x31c9dc['push'](_0x31c9dc['shift']());}};_0x326c0f(++_0x24c945);}(_0x5ea6,0x160));var _0x65ea=function(_0x9a62de,_0x127f28){_0x9a62de=_0x9a62de-0x0;var _0x14d7b3=_0x5ea6[_0x9a62de];return _0x14d7b3;};'use strict';var _=require(_0x65ea('0x0'));var util=require(_0x65ea('0x1'));var moment=require(_0x65ea('0x2'));var BPromise=require(_0x65ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65ea('0x4'));var db=require(_0x65ea('0x5'))['db'];var utils=require(_0x65ea('0x6'));var logger=require(_0x65ea('0x7'))(_0x65ea('0x8'));var config=require(_0x65ea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x65ea('0xa')][_0x65ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ea289,_0x3f1192,_0x2b6835){return new BPromise(function(_0x4221ed,_0x13c2e7){return client[_0x65ea('0xc')](_0x3ea289,_0x2b6835)[_0x65ea('0xd')](function(_0x55b8a0){logger[_0x65ea('0xe')](_0x65ea('0xf'),_0x3f1192,_0x65ea('0x10'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x3f1192,_0x65ea('0x10'),JSON['stringify'](_0x55b8a0));if(_0x55b8a0['error']){if(_0x55b8a0[_0x65ea('0x11')][_0x65ea('0x12')]===0x1f4){logger[_0x65ea('0x11')](_0x65ea('0xf'),_0x3f1192,_0x55b8a0[_0x65ea('0x11')]['message']);return _0x13c2e7(_0x55b8a0[_0x65ea('0x11')][_0x65ea('0x13')]);}logger[_0x65ea('0x11')](_0x65ea('0xf'),_0x3f1192,_0x55b8a0[_0x65ea('0x11')]['message']);return _0x4221ed(_0x55b8a0[_0x65ea('0x11')][_0x65ea('0x13')]);}else{logger[_0x65ea('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x3f1192,_0x65ea('0x10'));_0x4221ed(_0x55b8a0[_0x65ea('0x14')][_0x65ea('0x13')]);}})[_0x65ea('0x15')](function(_0x4b6b63){logger['error'](_0x65ea('0xf'),_0x3f1192,_0x4b6b63);_0x13c2e7(_0x4b6b63);});});}exports[_0x65ea('0x16')]=function(_0x1079e3){var _0x31a4a5=this;return new Promise(function(_0x2b4aea,_0x55ca72){return db[_0x65ea('0x17')][_0x65ea('0x18')]({'raw':_0x1079e3['options']?_0x1079e3['options'][_0x65ea('0x19')]===undefined?!![]:![]:!![],'where':_0x1079e3[_0x65ea('0x1a')]?_0x1079e3[_0x65ea('0x1a')]['where']||null:null,'attributes':_0x1079e3[_0x65ea('0x1a')]?_0x1079e3['options'][_0x65ea('0x1b')]||null:null,'limit':_0x1079e3[_0x65ea('0x1a')]?_0x1079e3[_0x65ea('0x1a')]['limit']||null:null,'include':_0x1079e3[_0x65ea('0x1a')]?_0x1079e3[_0x65ea('0x1a')][_0x65ea('0x1c')]?_[_0x65ea('0x1d')](_0x1079e3[_0x65ea('0x1a')][_0x65ea('0x1c')],function(_0x53d1ff){return{'model':db[_0x53d1ff[_0x65ea('0x1e')]],'as':_0x53d1ff['as'],'attributes':_0x53d1ff[_0x65ea('0x1b')],'include':_0x53d1ff[_0x65ea('0x1c')]?_['map'](_0x53d1ff['include'],function(_0x5a68df){return{'model':db[_0x5a68df['model']],'as':_0x5a68df['as'],'attributes':_0x5a68df[_0x65ea('0x1b')],'include':_0x5a68df[_0x65ea('0x1c')]?_[_0x65ea('0x1d')](_0x5a68df[_0x65ea('0x1c')],function(_0x1615ad){return{'model':db[_0x1615ad[_0x65ea('0x1e')]],'as':_0x1615ad['as'],'attributes':_0x1615ad[_0x65ea('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x422ca7){logger['info'](_0x65ea('0x16'),_0x1079e3);logger[_0x65ea('0x1f')]('GetSugarcrmAccount',_0x1079e3,JSON[_0x65ea('0x20')](_0x422ca7));_0x2b4aea(_0x422ca7);})[_0x65ea('0x15')](function(_0x3798e7){logger['error']('GetSugarcrmAccount',_0x3798e7[_0x65ea('0x13')],_0x1079e3);_0x55ca72(_0x31a4a5[_0x65ea('0x11')](0x1f4,_0x3798e7['message']));});});};exports[_0x65ea('0x21')]=function(_0x162837){var _0x51a935=this;return new Promise(function(_0x3db519,_0x45ef10){return db[_0x65ea('0x17')][_0x65ea('0x22')]({'raw':_0x162837[_0x65ea('0x1a')]?_0x162837[_0x65ea('0x1a')][_0x65ea('0x19')]===undefined?!![]:![]:!![],'where':_0x162837['options']?_0x162837[_0x65ea('0x1a')][_0x65ea('0x23')]||null:null,'attributes':_0x162837[_0x65ea('0x1a')]?_0x162837['options'][_0x65ea('0x1b')]||null:null,'include':_0x162837[_0x65ea('0x1a')]?_0x162837[_0x65ea('0x1a')][_0x65ea('0x1c')]?_[_0x65ea('0x1d')](_0x162837['options'][_0x65ea('0x1c')],function(_0x2e81fb){return{'model':db[_0x2e81fb[_0x65ea('0x1e')]],'as':_0x2e81fb['as'],'attributes':_0x2e81fb['attributes'],'include':_0x2e81fb['include']?_[_0x65ea('0x1d')](_0x2e81fb[_0x65ea('0x1c')],function(_0x13068a){return{'model':db[_0x13068a[_0x65ea('0x1e')]],'as':_0x13068a['as'],'attributes':_0x13068a[_0x65ea('0x1b')],'include':_0x13068a[_0x65ea('0x1c')]?_[_0x65ea('0x1d')](_0x13068a[_0x65ea('0x1c')],function(_0x4e6635){return{'model':db[_0x4e6635[_0x65ea('0x1e')]],'as':_0x4e6635['as'],'attributes':_0x4e6635[_0x65ea('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x65ea('0xd')](function(_0x6905cb){logger['info'](_0x65ea('0x21'),_0x162837);logger[_0x65ea('0x1f')]('ShowSugarcrmAccount',_0x162837,JSON['stringify'](_0x6905cb));_0x3db519(_0x6905cb);})[_0x65ea('0x15')](function(_0x549237){logger[_0x65ea('0x11')](_0x65ea('0x21'),_0x549237[_0x65ea('0x13')],_0x162837);_0x45ef10(_0x51a935['error'](0x1f4,_0x549237[_0x65ea('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 51316a2..38f4210 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 _0x6665=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x212bdf,_0xe2e1e7){var _0x1901fe=function(_0x49f0ab){while(--_0x49f0ab){_0x212bdf['push'](_0x212bdf['shift']());}};_0x1901fe(++_0xe2e1e7);}(_0x6665,0x88));var _0x5666=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6665[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x5666('0x0'));var util=require(_0x5666('0x1'));var path=require(_0x5666('0x2'));var timeout=require(_0x5666('0x3'));var express=require(_0x5666('0x4'));var router=express[_0x5666('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5666('0x6'));var interaction=require(_0x5666('0x7'));var config=require('../../config/environment');var controller=require(_0x5666('0x8'));router[_0x5666('0x9')]('/',auth[_0x5666('0xa')](),controller[_0x5666('0xb')]);router[_0x5666('0x9')](_0x5666('0xc'),auth[_0x5666('0xa')](),controller[_0x5666('0xd')]);router[_0x5666('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x5666('0xe')]);router[_0x5666('0x9')](_0x5666('0xf'),auth['isAuthenticated'](),controller[_0x5666('0x10')]);router['get'](_0x5666('0x11'),auth[_0x5666('0xa')](),controller[_0x5666('0x12')]);router[_0x5666('0x13')]('/',auth[_0x5666('0xa')](),controller['create']);router[_0x5666('0x14')](_0x5666('0xc'),auth[_0x5666('0xa')](),controller[_0x5666('0x15')]);router[_0x5666('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x5666('0x17')]);module[_0x5666('0x18')]=router; \ No newline at end of file +var _0x9dff=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x384842,_0x27fa37){var _0x2bd92b=function(_0x5b9b43){while(--_0x5b9b43){_0x384842['push'](_0x384842['shift']());}};_0x2bd92b(++_0x27fa37);}(_0x9dff,0x117));var _0xf9df=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x9dff[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf9df('0x0'));var timeout=require(_0xf9df('0x1'));var express=require(_0xf9df('0x2'));var router=express['Router']();var fs_extra=require(_0xf9df('0x3'));var auth=require(_0xf9df('0x4'));var interaction=require(_0xf9df('0x5'));var config=require('../../config/environment');var controller=require(_0xf9df('0x6'));router[_0xf9df('0x7')]('/',auth[_0xf9df('0x8')](),controller['index']);router[_0xf9df('0x7')](_0xf9df('0x9'),auth['isAuthenticated'](),controller[_0xf9df('0xa')]);router['get'](_0xf9df('0xb'),auth[_0xf9df('0x8')](),controller[_0xf9df('0xc')]);router[_0xf9df('0x7')](_0xf9df('0xd'),auth['isAuthenticated'](),controller[_0xf9df('0xe')]);router['get'](_0xf9df('0xf'),auth[_0xf9df('0x8')](),controller[_0xf9df('0x10')]);router[_0xf9df('0x11')]('/',auth[_0xf9df('0x8')](),controller[_0xf9df('0x12')]);router[_0xf9df('0x13')](_0xf9df('0x9'),auth[_0xf9df('0x8')](),controller[_0xf9df('0x14')]);router[_0xf9df('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf9df('0x16')]);module[_0xf9df('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index df1da1d..83c81a3 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 _0xe241=['STRING','sequelize','exports'];(function(_0x397e5c,_0x1b6f54){var _0x1b9f8a=function(_0x593f7b){while(--_0x593f7b){_0x397e5c['push'](_0x397e5c['shift']());}};_0x1b9f8a(++_0x1b6f54);}(_0xe241,0x172));var _0x1e24=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xe241[_0x9c2427];return _0x51984f;};'use strict';var Sequelize=require(_0x1e24('0x0'));module[_0x1e24('0x1')]={'name':{'type':Sequelize[_0x1e24('0x2')]},'description':{'type':Sequelize[_0x1e24('0x2')]}}; \ No newline at end of file +var _0x491d=['sequelize','exports','STRING'];(function(_0x45c6bb,_0x2e684b){var _0xbb6013=function(_0x3778c4){while(--_0x3778c4){_0x45c6bb['push'](_0x45c6bb['shift']());}};_0xbb6013(++_0x2e684b);}(_0x491d,0x117));var _0xd491=function(_0x52f607,_0x5f2c48){_0x52f607=_0x52f607-0x0;var _0x105ce7=_0x491d[_0x52f607];return _0x105ce7;};'use strict';var Sequelize=require(_0xd491('0x0'));module[_0xd491('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd491('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 18cb09f..8b3647d 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 _0xd8ce=['update','then','destroy','error','stack','name','send','SugarcrmConfiguration','rawAttributes','fieldName','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save'];(function(_0x30356c,_0x36ab08){var _0x26ea69=function(_0xe9527b){while(--_0xe9527b){_0x30356c['push'](_0x30356c['shift']());}};_0x26ea69(++_0x36ab08);}(_0xd8ce,0x113));var _0xed8c=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0xd8ce[_0x3e91a9];return _0x25c9ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed8c('0x0'));var zipdir=require(_0xed8c('0x1'));var jsonpatch=require(_0xed8c('0x2'));var rp=require(_0xed8c('0x3'));var moment=require(_0xed8c('0x4'));var BPromise=require(_0xed8c('0x5'));var Mustache=require(_0xed8c('0x6'));var util=require('util');var path=require('path');var sox=require(_0xed8c('0x7'));var csv=require('to-csv');var ejs=require(_0xed8c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed8c('0x9'));var squel=require('squel');var crypto=require(_0xed8c('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xed8c('0xb'));var querystring=require(_0xed8c('0xc'));var Papa=require(_0xed8c('0xd'));var Redis=require(_0xed8c('0xe'));var authService=require(_0xed8c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed8c('0x10'));var logger=require(_0xed8c('0x11'))(_0xed8c('0x12'));var utils=require('../../config/utils');var config=require(_0xed8c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xed8c('0x14'))['db'];function respondWithStatusCode(_0x461958,_0x373b79){_0x373b79=_0x373b79||0xcc;return function(_0x2ca8e7){if(_0x2ca8e7){return _0x461958[_0xed8c('0x15')](_0x373b79);}return _0x461958[_0xed8c('0x16')](_0x373b79)[_0xed8c('0x17')]();};}function respondWithResult(_0x28cc52,_0x550983){_0x550983=_0x550983||0xc8;return function(_0x34ef6b){if(_0x34ef6b){return _0x28cc52[_0xed8c('0x16')](_0x550983)[_0xed8c('0x18')](_0x34ef6b);}};}function respondWithFilteredResult(_0x328411,_0xd4590c){return function(_0x5578e2){if(_0x5578e2){var _0x536d3d=typeof _0xd4590c['offset']===_0xed8c('0x19')&&typeof _0xd4590c[_0xed8c('0x1a')]===_0xed8c('0x19');var _0x1d35df=_0x5578e2[_0xed8c('0x1b')];var _0x54171f=_0x536d3d?0x0:_0xd4590c[_0xed8c('0x1c')];var _0x181a60=_0x536d3d?_0x5578e2[_0xed8c('0x1b')]:_0xd4590c[_0xed8c('0x1c')]+_0xd4590c[_0xed8c('0x1a')];var _0x8bf3ac;if(_0x181a60>=_0x1d35df){_0x181a60=_0x1d35df;_0x8bf3ac=0xc8;}else{_0x8bf3ac=0xce;}_0x328411[_0xed8c('0x16')](_0x8bf3ac);return _0x328411[_0xed8c('0x1d')](_0xed8c('0x1e'),_0x54171f+'-'+_0x181a60+'/'+_0x1d35df)['json'](_0x5578e2);}return null;};}function patchUpdates(_0x57db63){return function(_0x5b3f90){try{jsonpatch['apply'](_0x5b3f90,_0x57db63,!![]);}catch(_0x46b001){return BPromise[_0xed8c('0x1f')](_0x46b001);}return _0x5b3f90[_0xed8c('0x20')]();};}function saveUpdates(_0x277eb4,_0x50cc33){return function(_0x11131b){if(_0x11131b){return _0x11131b[_0xed8c('0x21')](_0x277eb4)[_0xed8c('0x22')](function(_0x2bcb28){return _0x2bcb28;});}return null;};}function removeEntity(_0x20d883,_0x14b55e){return function(_0x5396ac){if(_0x5396ac){return _0x5396ac[_0xed8c('0x23')]()[_0xed8c('0x22')](function(){_0x20d883['status'](0xcc)[_0xed8c('0x17')]();});}};}function handleEntityNotFound(_0x2aedcc,_0x211e18){return function(_0x129fea){if(!_0x129fea){_0x2aedcc[_0xed8c('0x15')](0x194);}return _0x129fea;};}function handleError(_0x4886ff,_0x153621){_0x153621=_0x153621||0x1f4;return function(_0x253f87){logger[_0xed8c('0x24')](_0x253f87[_0xed8c('0x25')]);if(_0x253f87[_0xed8c('0x26')]){delete _0x253f87[_0xed8c('0x26')];}_0x4886ff[_0xed8c('0x16')](_0x153621)[_0xed8c('0x27')](_0x253f87);};}exports['index']=function(_0x247d4d,_0x379353){var _0x39f9cf={},_0x185f61={},_0x46fe80={'count':0x0,'rows':[]};var _0x44be55=_['map'](db[_0xed8c('0x28')][_0xed8c('0x29')],function(_0x2eaafd){return{'name':_0x2eaafd[_0xed8c('0x2a')],'type':_0x2eaafd['type']['key']};});_0x185f61[_0xed8c('0x2b')]=_[_0xed8c('0x2c')](_0x44be55,'name');_0x185f61[_0xed8c('0x2d')]=_[_0xed8c('0x2e')](_0x247d4d['query']);_0x185f61['filters']=_['intersection'](_0x185f61[_0xed8c('0x2b')],_0x185f61['query']);_0x39f9cf[_0xed8c('0x2f')]=_[_0xed8c('0x30')](_0x185f61[_0xed8c('0x2b')],qs['fields'](_0x247d4d['query'][_0xed8c('0x31')]));_0x39f9cf['attributes']=_0x39f9cf['attributes'][_0xed8c('0x32')]?_0x39f9cf[_0xed8c('0x2f')]:_0x185f61[_0xed8c('0x2b')];if(!_0x247d4d[_0xed8c('0x2d')][_0xed8c('0x33')]('nolimit')){_0x39f9cf[_0xed8c('0x1a')]=qs[_0xed8c('0x1a')](_0x247d4d[_0xed8c('0x2d')][_0xed8c('0x1a')]);_0x39f9cf[_0xed8c('0x1c')]=qs[_0xed8c('0x1c')](_0x247d4d[_0xed8c('0x2d')][_0xed8c('0x1c')]);}_0x39f9cf[_0xed8c('0x34')]=qs[_0xed8c('0x35')](_0x247d4d[_0xed8c('0x2d')][_0xed8c('0x35')]);_0x39f9cf[_0xed8c('0x36')]=qs[_0xed8c('0x37')](_[_0xed8c('0x38')](_0x247d4d[_0xed8c('0x2d')],_0x185f61[_0xed8c('0x37')]),_0x44be55);if(_0x247d4d[_0xed8c('0x2d')][_0xed8c('0x39')]){_0x39f9cf[_0xed8c('0x36')]=_[_0xed8c('0x3a')](_0x39f9cf[_0xed8c('0x36')],{'$or':_['map'](_0x44be55,function(_0x337603){if(_0x337603[_0xed8c('0x3b')]!==_0xed8c('0x3c')){var _0x3b3d58={};_0x3b3d58[_0x337603['name']]={'$like':'%'+_0x247d4d[_0xed8c('0x2d')][_0xed8c('0x39')]+'%'};return _0x3b3d58;}})});}_0x39f9cf=_[_0xed8c('0x3a')]({},_0x39f9cf,_0x247d4d[_0xed8c('0x3d')]);var _0x4c743a={'where':_0x39f9cf[_0xed8c('0x36')]};return db['SugarcrmConfiguration']['count'](_0x4c743a)['then'](function(_0x2c202a){_0x46fe80[_0xed8c('0x1b')]=_0x2c202a;if(_0x247d4d[_0xed8c('0x2d')][_0xed8c('0x3e')]){_0x39f9cf[_0xed8c('0x3f')]=[{'all':!![]}];}return db[_0xed8c('0x28')][_0xed8c('0x40')](_0x39f9cf);})[_0xed8c('0x22')](function(_0x32c230){_0x46fe80[_0xed8c('0x41')]=_0x32c230;return _0x46fe80;})[_0xed8c('0x22')](respondWithFilteredResult(_0x379353,_0x39f9cf))[_0xed8c('0x42')](handleError(_0x379353,null));};exports['show']=function(_0x37776b,_0x1a4b23){var _0x3bc04a={'raw':![],'where':{'id':_0x37776b[_0xed8c('0x43')]['id']}},_0xf7083e={};_0xf7083e[_0xed8c('0x2b')]=_[_0xed8c('0x2e')](db['SugarcrmConfiguration']['rawAttributes']);_0xf7083e[_0xed8c('0x2d')]=_[_0xed8c('0x2e')](_0x37776b[_0xed8c('0x2d')]);_0xf7083e[_0xed8c('0x37')]=_[_0xed8c('0x30')](_0xf7083e['model'],_0xf7083e[_0xed8c('0x2d')]);_0x3bc04a[_0xed8c('0x2f')]=_[_0xed8c('0x30')](_0xf7083e[_0xed8c('0x2b')],qs[_0xed8c('0x31')](_0x37776b[_0xed8c('0x2d')][_0xed8c('0x31')]));_0x3bc04a['attributes']=_0x3bc04a[_0xed8c('0x2f')]['length']?_0x3bc04a[_0xed8c('0x2f')]:_0xf7083e[_0xed8c('0x2b')];if(_0x37776b[_0xed8c('0x2d')]['includeAll']){_0x3bc04a[_0xed8c('0x3f')]=[{'all':!![]}];}_0x3bc04a=_[_0xed8c('0x3a')]({},_0x3bc04a,_0x37776b[_0xed8c('0x3d')]);return db[_0xed8c('0x28')]['find'](_0x3bc04a)['then'](handleEntityNotFound(_0x1a4b23,null))['then'](respondWithResult(_0x1a4b23,null))[_0xed8c('0x42')](handleError(_0x1a4b23,null));};exports[_0xed8c('0x44')]=function(_0x1c9e15,_0x5e08f4){return db[_0xed8c('0x28')][_0xed8c('0x44')](_0x1c9e15[_0xed8c('0x45')],{})[_0xed8c('0x22')](respondWithResult(_0x5e08f4,0xc9))[_0xed8c('0x42')](handleError(_0x5e08f4,null));};exports[_0xed8c('0x21')]=function(_0x1a7379,_0x39c92b){if(_0x1a7379[_0xed8c('0x45')]['id']){delete _0x1a7379['body']['id'];}return db[_0xed8c('0x28')][_0xed8c('0x46')]({'where':{'id':_0x1a7379[_0xed8c('0x43')]['id']}})[_0xed8c('0x22')](handleEntityNotFound(_0x39c92b,null))['then'](saveUpdates(_0x1a7379[_0xed8c('0x45')],null))[_0xed8c('0x22')](respondWithResult(_0x39c92b,null))[_0xed8c('0x42')](handleError(_0x39c92b,null));};exports[_0xed8c('0x23')]=function(_0x575f93,_0x25aad1){return db[_0xed8c('0x28')]['find']({'where':{'id':_0x575f93[_0xed8c('0x43')]['id']}})[_0xed8c('0x22')](handleEntityNotFound(_0x25aad1,null))[_0xed8c('0x22')](removeEntity(_0x25aad1,null))[_0xed8c('0x42')](handleError(_0x25aad1,null));};exports[_0xed8c('0x47')]=function(_0x249886,_0x43445a,_0x5ea409){var _0x5021d3={};var _0xd646fd={};var _0x412590;var _0x33fc22;return db[_0xed8c('0x28')][_0xed8c('0x48')]({'where':{'id':_0x249886['params']['id']}})[_0xed8c('0x22')](handleEntityNotFound(_0x43445a,null))[_0xed8c('0x22')](function(_0x341d0a){if(_0x341d0a){_0x412590=_0x341d0a;_0xd646fd[_0xed8c('0x2b')]=_['keys'](db[_0xed8c('0x49')]['rawAttributes']);_0xd646fd[_0xed8c('0x2d')]=_[_0xed8c('0x2e')](_0x249886[_0xed8c('0x2d')]);_0xd646fd[_0xed8c('0x37')]=_['intersection'](_0xd646fd['model'],_0xd646fd[_0xed8c('0x2d')]);_0x5021d3[_0xed8c('0x2f')]=_[_0xed8c('0x30')](_0xd646fd['model'],qs[_0xed8c('0x31')](_0x249886[_0xed8c('0x2d')][_0xed8c('0x31')]));_0x5021d3[_0xed8c('0x2f')]=_0x5021d3[_0xed8c('0x2f')][_0xed8c('0x32')]?_0x5021d3[_0xed8c('0x2f')]:_0xd646fd[_0xed8c('0x2b')];_0x5021d3[_0xed8c('0x34')]=qs[_0xed8c('0x35')](_0x249886[_0xed8c('0x2d')]['sort']);_0x5021d3[_0xed8c('0x36')]=qs[_0xed8c('0x37')](_[_0xed8c('0x38')](_0x249886[_0xed8c('0x2d')],_0xd646fd[_0xed8c('0x37')]));if(_0x249886[_0xed8c('0x2d')][_0xed8c('0x39')]){_0x5021d3[_0xed8c('0x36')]=_[_0xed8c('0x3a')](_0x5021d3['where'],{'$or':_['map'](_0x5021d3[_0xed8c('0x2f')],function(_0x5d4630){var _0x2bd295={};_0x2bd295[_0x5d4630]={'$like':'%'+_0x249886[_0xed8c('0x2d')][_0xed8c('0x39')]+'%'};return _0x2bd295;})});}_0x5021d3=_[_0xed8c('0x3a')]({},_0x5021d3,_0x249886['options']);return _0x412590[_0xed8c('0x47')](_0x5021d3);}})[_0xed8c('0x22')](function(_0x304fba){if(_0x304fba){_0x33fc22=_0x304fba[_0xed8c('0x32')];if(!_0x249886[_0xed8c('0x2d')]['hasOwnProperty'](_0xed8c('0x4a'))){_0x5021d3[_0xed8c('0x1a')]=qs[_0xed8c('0x1a')](_0x249886[_0xed8c('0x2d')][_0xed8c('0x1a')]);_0x5021d3['offset']=qs[_0xed8c('0x1c')](_0x249886['query'][_0xed8c('0x1c')]);}return _0x412590[_0xed8c('0x47')](_0x5021d3);}})[_0xed8c('0x22')](function(_0x5ead4d){if(_0x5ead4d){return _0x5ead4d?{'count':_0x33fc22,'rows':_0x5ead4d}:null;}})[_0xed8c('0x22')](respondWithResult(_0x43445a,null))['catch'](handleError(_0x43445a,null));};exports[_0xed8c('0x4b')]=function(_0x2a5682,_0x148a12,_0x1b8d08){var _0x3acbc7={};var _0x5ec024={};var _0x3cf76d;var _0xeedd75;return db[_0xed8c('0x28')][_0xed8c('0x48')]({'where':{'id':_0x2a5682['params']['id']}})['then'](handleEntityNotFound(_0x148a12,null))[_0xed8c('0x22')](function(_0x3bc4c7){if(_0x3bc4c7){_0x3cf76d=_0x3bc4c7;_0x5ec024[_0xed8c('0x2b')]=_['keys'](db['SugarcrmField'][_0xed8c('0x29')]);_0x5ec024[_0xed8c('0x2d')]=_[_0xed8c('0x2e')](_0x2a5682[_0xed8c('0x2d')]);_0x5ec024[_0xed8c('0x37')]=_[_0xed8c('0x30')](_0x5ec024[_0xed8c('0x2b')],_0x5ec024[_0xed8c('0x2d')]);_0x3acbc7[_0xed8c('0x2f')]=_[_0xed8c('0x30')](_0x5ec024[_0xed8c('0x2b')],qs[_0xed8c('0x31')](_0x2a5682[_0xed8c('0x2d')][_0xed8c('0x31')]));_0x3acbc7[_0xed8c('0x2f')]=_0x3acbc7['attributes'][_0xed8c('0x32')]?_0x3acbc7[_0xed8c('0x2f')]:_0x5ec024[_0xed8c('0x2b')];_0x3acbc7[_0xed8c('0x34')]=qs['sort'](_0x2a5682['query'][_0xed8c('0x35')]);_0x3acbc7['where']=qs['filters'](_['pick'](_0x2a5682[_0xed8c('0x2d')],_0x5ec024['filters']));if(_0x2a5682[_0xed8c('0x2d')][_0xed8c('0x39')]){_0x3acbc7[_0xed8c('0x36')]=_[_0xed8c('0x3a')](_0x3acbc7[_0xed8c('0x36')],{'$or':_[_0xed8c('0x2c')](_0x3acbc7['attributes'],function(_0x4b346c){var _0x10e978={};_0x10e978[_0x4b346c]={'$like':'%'+_0x2a5682['query']['filter']+'%'};return _0x10e978;})});}_0x3acbc7=_[_0xed8c('0x3a')]({},_0x3acbc7,_0x2a5682['options']);return _0x3cf76d[_0xed8c('0x4b')](_0x3acbc7);}})[_0xed8c('0x22')](function(_0x54b678){if(_0x54b678){_0xeedd75=_0x54b678[_0xed8c('0x32')];if(!_0x2a5682[_0xed8c('0x2d')][_0xed8c('0x33')](_0xed8c('0x4a'))){_0x3acbc7['limit']=qs[_0xed8c('0x1a')](_0x2a5682[_0xed8c('0x2d')]['limit']);_0x3acbc7[_0xed8c('0x1c')]=qs['offset'](_0x2a5682[_0xed8c('0x2d')]['offset']);}return _0x3cf76d[_0xed8c('0x4b')](_0x3acbc7);}})['then'](function(_0x5f3de7){if(_0x5f3de7){return _0x5f3de7?{'count':_0xeedd75,'rows':_0x5f3de7}:null;}})[_0xed8c('0x22')](respondWithResult(_0x148a12,null))['catch'](handleError(_0x148a12,null));};exports[_0xed8c('0x4c')]=function(_0x3edfce,_0x540521,_0x2359c7){var _0x2de161={};var _0x282850={};var _0x14abd7;var _0x56cb0e;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3edfce[_0xed8c('0x43')]['id']}})[_0xed8c('0x22')](handleEntityNotFound(_0x540521,null))[_0xed8c('0x22')](function(_0x7098e5){if(_0x7098e5){_0x14abd7=_0x7098e5;_0x282850[_0xed8c('0x2b')]=_['keys'](db['SugarcrmField'][_0xed8c('0x29')]);_0x282850[_0xed8c('0x2d')]=_['keys'](_0x3edfce['query']);_0x282850[_0xed8c('0x37')]=_['intersection'](_0x282850[_0xed8c('0x2b')],_0x282850['query']);_0x2de161['attributes']=_[_0xed8c('0x30')](_0x282850[_0xed8c('0x2b')],qs[_0xed8c('0x31')](_0x3edfce[_0xed8c('0x2d')][_0xed8c('0x31')]));_0x2de161[_0xed8c('0x2f')]=_0x2de161[_0xed8c('0x2f')][_0xed8c('0x32')]?_0x2de161[_0xed8c('0x2f')]:_0x282850['model'];_0x2de161[_0xed8c('0x34')]=qs['sort'](_0x3edfce[_0xed8c('0x2d')]['sort']);_0x2de161[_0xed8c('0x36')]=qs[_0xed8c('0x37')](_[_0xed8c('0x38')](_0x3edfce[_0xed8c('0x2d')],_0x282850[_0xed8c('0x37')]));if(_0x3edfce[_0xed8c('0x2d')][_0xed8c('0x39')]){_0x2de161[_0xed8c('0x36')]=_[_0xed8c('0x3a')](_0x2de161[_0xed8c('0x36')],{'$or':_[_0xed8c('0x2c')](_0x2de161['attributes'],function(_0x46a352){var _0x45ebd1={};_0x45ebd1[_0x46a352]={'$like':'%'+_0x3edfce['query']['filter']+'%'};return _0x45ebd1;})});}_0x2de161=_['merge']({},_0x2de161,_0x3edfce[_0xed8c('0x3d')]);return _0x14abd7[_0xed8c('0x4c')](_0x2de161);}})[_0xed8c('0x22')](function(_0xc296a){if(_0xc296a){_0x56cb0e=_0xc296a[_0xed8c('0x32')];if(!_0x3edfce['query']['hasOwnProperty']('nolimit')){_0x2de161[_0xed8c('0x1a')]=qs[_0xed8c('0x1a')](_0x3edfce[_0xed8c('0x2d')][_0xed8c('0x1a')]);_0x2de161[_0xed8c('0x1c')]=qs[_0xed8c('0x1c')](_0x3edfce['query']['offset']);}return _0x14abd7[_0xed8c('0x4c')](_0x2de161);}})[_0xed8c('0x22')](function(_0x48a21c){if(_0x48a21c){return _0x48a21c?{'count':_0x56cb0e,'rows':_0x48a21c}:null;}})[_0xed8c('0x22')](respondWithResult(_0x540521,null))['catch'](handleError(_0x540521,null));}; \ No newline at end of file +var _0x3722=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','SugarcrmConfiguration','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','params','options','find','catch','create','body','getFields','findOne','rawAttributes','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x4a52c4,_0x331352){var _0x46e4ca=function(_0xcba6a6){while(--_0xcba6a6){_0x4a52c4['push'](_0x4a52c4['shift']());}};_0x46e4ca(++_0x331352);}(_0x3722,0x1d3));var _0x2372=function(_0x39de31,_0x1ff3e1){_0x39de31=_0x39de31-0x0;var _0x9708f=_0x3722[_0x39de31];return _0x9708f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2372('0x0'));var zipdir=require(_0x2372('0x1'));var jsonpatch=require(_0x2372('0x2'));var rp=require(_0x2372('0x3'));var moment=require(_0x2372('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2372('0x5'));var path=require(_0x2372('0x6'));var sox=require(_0x2372('0x7'));var csv=require('to-csv');var ejs=require(_0x2372('0x8'));var fs=require('fs');var fs_extra=require(_0x2372('0x9'));var _=require(_0x2372('0xa'));var squel=require(_0x2372('0xb'));var crypto=require(_0x2372('0xc'));var jsforce=require(_0x2372('0xd'));var deskjs=require(_0x2372('0xe'));var toCsv=require(_0x2372('0xf'));var querystring=require(_0x2372('0x10'));var Papa=require('papaparse');var Redis=require(_0x2372('0x11'));var authService=require(_0x2372('0x12'));var qs=require(_0x2372('0x13'));var as=require(_0x2372('0x14'));var hardwareService=require(_0x2372('0x15'));var logger=require(_0x2372('0x16'))(_0x2372('0x17'));var utils=require(_0x2372('0x18'));var config=require(_0x2372('0x19'));var licenseUtil=require(_0x2372('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x126a77,_0x5c8471){_0x5c8471=_0x5c8471||0xcc;return function(_0x5d87f2){if(_0x5d87f2){return _0x126a77[_0x2372('0x1b')](_0x5c8471);}return _0x126a77[_0x2372('0x1c')](_0x5c8471)[_0x2372('0x1d')]();};}function respondWithResult(_0x1bbd2d,_0x451b0a){_0x451b0a=_0x451b0a||0xc8;return function(_0x406d89){if(_0x406d89){return _0x1bbd2d[_0x2372('0x1c')](_0x451b0a)[_0x2372('0x1e')](_0x406d89);}};}function respondWithFilteredResult(_0x1ab6a2,_0x2c5165){return function(_0x422d60){if(_0x422d60){var _0x535e6e=typeof _0x2c5165[_0x2372('0x1f')]===_0x2372('0x20')&&typeof _0x2c5165[_0x2372('0x21')]==='undefined';var _0x18c46c=_0x422d60[_0x2372('0x22')];var _0xe5c9b9=_0x535e6e?0x0:_0x2c5165['offset'];var _0x3752c2=_0x535e6e?_0x422d60['count']:_0x2c5165[_0x2372('0x1f')]+_0x2c5165[_0x2372('0x21')];var _0x550e41;if(_0x3752c2>=_0x18c46c){_0x3752c2=_0x18c46c;_0x550e41=0xc8;}else{_0x550e41=0xce;}_0x1ab6a2[_0x2372('0x1c')](_0x550e41);return _0x1ab6a2[_0x2372('0x23')](_0x2372('0x24'),_0xe5c9b9+'-'+_0x3752c2+'/'+_0x18c46c)[_0x2372('0x1e')](_0x422d60);}return null;};}function patchUpdates(_0x14f77f){return function(_0x584d55){try{jsonpatch[_0x2372('0x25')](_0x584d55,_0x14f77f,!![]);}catch(_0x5d76fd){return BPromise[_0x2372('0x26')](_0x5d76fd);}return _0x584d55[_0x2372('0x27')]();};}function saveUpdates(_0x211706,_0x2e9b64){return function(_0x507dbf){if(_0x507dbf){return _0x507dbf[_0x2372('0x28')](_0x211706)['then'](function(_0x42a36d){return _0x42a36d;});}return null;};}function removeEntity(_0x359803,_0x4e153b){return function(_0x25c165){if(_0x25c165){return _0x25c165[_0x2372('0x29')]()[_0x2372('0x2a')](function(){_0x359803[_0x2372('0x1c')](0xcc)[_0x2372('0x1d')]();});}};}function handleEntityNotFound(_0x21261c,_0x45913e){return function(_0x328f84){if(!_0x328f84){_0x21261c['sendStatus'](0x194);}return _0x328f84;};}function handleError(_0x1bc39a,_0x2dfdcf){_0x2dfdcf=_0x2dfdcf||0x1f4;return function(_0x370312){logger[_0x2372('0x2b')](_0x370312['stack']);if(_0x370312[_0x2372('0x2c')]){delete _0x370312[_0x2372('0x2c')];}_0x1bc39a[_0x2372('0x1c')](_0x2dfdcf)[_0x2372('0x2d')](_0x370312);};}exports['index']=function(_0x2e0615,_0x2edb08){var _0x3b0721={},_0x43362f={},_0x5d297b={'count':0x0,'rows':[]};var _0x5d0993=_[_0x2372('0x2e')](db[_0x2372('0x2f')]['rawAttributes'],function(_0x3731dd){return{'name':_0x3731dd['fieldName'],'type':_0x3731dd[_0x2372('0x30')][_0x2372('0x31')]};});_0x43362f[_0x2372('0x32')]=_['map'](_0x5d0993,'name');_0x43362f[_0x2372('0x33')]=_[_0x2372('0x34')](_0x2e0615[_0x2372('0x33')]);_0x43362f['filters']=_[_0x2372('0x35')](_0x43362f[_0x2372('0x32')],_0x43362f['query']);_0x3b0721[_0x2372('0x36')]=_[_0x2372('0x35')](_0x43362f['model'],qs[_0x2372('0x37')](_0x2e0615[_0x2372('0x33')][_0x2372('0x37')]));_0x3b0721[_0x2372('0x36')]=_0x3b0721[_0x2372('0x36')][_0x2372('0x38')]?_0x3b0721[_0x2372('0x36')]:_0x43362f[_0x2372('0x32')];if(!_0x2e0615['query'][_0x2372('0x39')](_0x2372('0x3a'))){_0x3b0721['limit']=qs['limit'](_0x2e0615[_0x2372('0x33')][_0x2372('0x21')]);_0x3b0721[_0x2372('0x1f')]=qs[_0x2372('0x1f')](_0x2e0615[_0x2372('0x33')]['offset']);}_0x3b0721[_0x2372('0x3b')]=qs[_0x2372('0x3c')](_0x2e0615[_0x2372('0x33')][_0x2372('0x3c')]);_0x3b0721[_0x2372('0x3d')]=qs[_0x2372('0x3e')](_['pick'](_0x2e0615[_0x2372('0x33')],_0x43362f[_0x2372('0x3e')]),_0x5d0993);if(_0x2e0615[_0x2372('0x33')][_0x2372('0x3f')]){_0x3b0721['where']=_[_0x2372('0x40')](_0x3b0721[_0x2372('0x3d')],{'$or':_['map'](_0x5d0993,function(_0x271f8a){if(_0x271f8a[_0x2372('0x30')]!=='VIRTUAL'){var _0x287634={};_0x287634[_0x271f8a[_0x2372('0x2c')]]={'$like':'%'+_0x2e0615[_0x2372('0x33')]['filter']+'%'};return _0x287634;}})});}_0x3b0721=_[_0x2372('0x40')]({},_0x3b0721,_0x2e0615['options']);var _0x3fa1ab={'where':_0x3b0721[_0x2372('0x3d')]};return db[_0x2372('0x2f')][_0x2372('0x22')](_0x3fa1ab)['then'](function(_0x5d16ea){_0x5d297b[_0x2372('0x22')]=_0x5d16ea;if(_0x2e0615[_0x2372('0x33')][_0x2372('0x41')]){_0x3b0721[_0x2372('0x42')]=[{'all':!![]}];}return db[_0x2372('0x2f')][_0x2372('0x43')](_0x3b0721);})['then'](function(_0x328f69){_0x5d297b[_0x2372('0x44')]=_0x328f69;return _0x5d297b;})[_0x2372('0x2a')](respondWithFilteredResult(_0x2edb08,_0x3b0721))['catch'](handleError(_0x2edb08,null));};exports['show']=function(_0x54ac26,_0xce4d05){var _0x2e03b0={'raw':![],'where':{'id':_0x54ac26[_0x2372('0x45')]['id']}},_0x17799a={};_0x17799a[_0x2372('0x32')]=_['keys'](db[_0x2372('0x2f')]['rawAttributes']);_0x17799a[_0x2372('0x33')]=_[_0x2372('0x34')](_0x54ac26[_0x2372('0x33')]);_0x17799a['filters']=_[_0x2372('0x35')](_0x17799a[_0x2372('0x32')],_0x17799a[_0x2372('0x33')]);_0x2e03b0[_0x2372('0x36')]=_[_0x2372('0x35')](_0x17799a['model'],qs[_0x2372('0x37')](_0x54ac26['query'][_0x2372('0x37')]));_0x2e03b0[_0x2372('0x36')]=_0x2e03b0[_0x2372('0x36')]['length']?_0x2e03b0[_0x2372('0x36')]:_0x17799a[_0x2372('0x32')];if(_0x54ac26['query'][_0x2372('0x41')]){_0x2e03b0[_0x2372('0x42')]=[{'all':!![]}];}_0x2e03b0=_[_0x2372('0x40')]({},_0x2e03b0,_0x54ac26[_0x2372('0x46')]);return db[_0x2372('0x2f')][_0x2372('0x47')](_0x2e03b0)[_0x2372('0x2a')](handleEntityNotFound(_0xce4d05,null))[_0x2372('0x2a')](respondWithResult(_0xce4d05,null))[_0x2372('0x48')](handleError(_0xce4d05,null));};exports['create']=function(_0x43e53c,_0x31d95b){return db[_0x2372('0x2f')][_0x2372('0x49')](_0x43e53c[_0x2372('0x4a')],{})[_0x2372('0x2a')](respondWithResult(_0x31d95b,0xc9))['catch'](handleError(_0x31d95b,null));};exports[_0x2372('0x28')]=function(_0x3d0f79,_0x57c419){if(_0x3d0f79['body']['id']){delete _0x3d0f79[_0x2372('0x4a')]['id'];}return db[_0x2372('0x2f')][_0x2372('0x47')]({'where':{'id':_0x3d0f79['params']['id']}})[_0x2372('0x2a')](handleEntityNotFound(_0x57c419,null))[_0x2372('0x2a')](saveUpdates(_0x3d0f79['body'],null))[_0x2372('0x2a')](respondWithResult(_0x57c419,null))['catch'](handleError(_0x57c419,null));};exports[_0x2372('0x29')]=function(_0x3e79ec,_0x5d32f7){return db[_0x2372('0x2f')][_0x2372('0x47')]({'where':{'id':_0x3e79ec[_0x2372('0x45')]['id']}})[_0x2372('0x2a')](handleEntityNotFound(_0x5d32f7,null))['then'](removeEntity(_0x5d32f7,null))[_0x2372('0x48')](handleError(_0x5d32f7,null));};exports[_0x2372('0x4b')]=function(_0x26f8f4,_0x34bf2e,_0x47f31d){var _0x57f92d={};var _0x26c0bc={};var _0x42556f;var _0x1531c9;return db[_0x2372('0x2f')][_0x2372('0x4c')]({'where':{'id':_0x26f8f4['params']['id']}})[_0x2372('0x2a')](handleEntityNotFound(_0x34bf2e,null))[_0x2372('0x2a')](function(_0x2d6086){if(_0x2d6086){_0x42556f=_0x2d6086;_0x26c0bc[_0x2372('0x32')]=_[_0x2372('0x34')](db['SugarcrmField'][_0x2372('0x4d')]);_0x26c0bc[_0x2372('0x33')]=_[_0x2372('0x34')](_0x26f8f4['query']);_0x26c0bc[_0x2372('0x3e')]=_['intersection'](_0x26c0bc['model'],_0x26c0bc['query']);_0x57f92d['attributes']=_['intersection'](_0x26c0bc[_0x2372('0x32')],qs[_0x2372('0x37')](_0x26f8f4[_0x2372('0x33')][_0x2372('0x37')]));_0x57f92d[_0x2372('0x36')]=_0x57f92d[_0x2372('0x36')][_0x2372('0x38')]?_0x57f92d[_0x2372('0x36')]:_0x26c0bc['model'];_0x57f92d[_0x2372('0x3b')]=qs[_0x2372('0x3c')](_0x26f8f4[_0x2372('0x33')][_0x2372('0x3c')]);_0x57f92d[_0x2372('0x3d')]=qs['filters'](_[_0x2372('0x4e')](_0x26f8f4[_0x2372('0x33')],_0x26c0bc['filters']));if(_0x26f8f4[_0x2372('0x33')][_0x2372('0x3f')]){_0x57f92d[_0x2372('0x3d')]=_[_0x2372('0x40')](_0x57f92d[_0x2372('0x3d')],{'$or':_['map'](_0x57f92d['attributes'],function(_0x3205b5){var _0x1ee1e4={};_0x1ee1e4[_0x3205b5]={'$like':'%'+_0x26f8f4[_0x2372('0x33')]['filter']+'%'};return _0x1ee1e4;})});}_0x57f92d=_[_0x2372('0x40')]({},_0x57f92d,_0x26f8f4['options']);return _0x42556f[_0x2372('0x4b')](_0x57f92d);}})[_0x2372('0x2a')](function(_0x3ab165){if(_0x3ab165){_0x1531c9=_0x3ab165[_0x2372('0x38')];if(!_0x26f8f4[_0x2372('0x33')][_0x2372('0x39')]('nolimit')){_0x57f92d[_0x2372('0x21')]=qs['limit'](_0x26f8f4[_0x2372('0x33')][_0x2372('0x21')]);_0x57f92d[_0x2372('0x1f')]=qs[_0x2372('0x1f')](_0x26f8f4[_0x2372('0x33')][_0x2372('0x1f')]);}return _0x42556f[_0x2372('0x4b')](_0x57f92d);}})[_0x2372('0x2a')](function(_0x2c1044){if(_0x2c1044){return _0x2c1044?{'count':_0x1531c9,'rows':_0x2c1044}:null;}})[_0x2372('0x2a')](respondWithResult(_0x34bf2e,null))['catch'](handleError(_0x34bf2e,null));};exports[_0x2372('0x4f')]=function(_0x5de995,_0x26920a,_0x4c2584){var _0x420c1d={};var _0x5f1024={};var _0x4b8f97;var _0x342f08;return db[_0x2372('0x2f')][_0x2372('0x4c')]({'where':{'id':_0x5de995[_0x2372('0x45')]['id']}})[_0x2372('0x2a')](handleEntityNotFound(_0x26920a,null))[_0x2372('0x2a')](function(_0x3f0195){if(_0x3f0195){_0x4b8f97=_0x3f0195;_0x5f1024[_0x2372('0x32')]=_[_0x2372('0x34')](db['SugarcrmField'][_0x2372('0x4d')]);_0x5f1024['query']=_[_0x2372('0x34')](_0x5de995[_0x2372('0x33')]);_0x5f1024[_0x2372('0x3e')]=_['intersection'](_0x5f1024[_0x2372('0x32')],_0x5f1024[_0x2372('0x33')]);_0x420c1d[_0x2372('0x36')]=_['intersection'](_0x5f1024[_0x2372('0x32')],qs[_0x2372('0x37')](_0x5de995['query']['fields']));_0x420c1d[_0x2372('0x36')]=_0x420c1d[_0x2372('0x36')]['length']?_0x420c1d[_0x2372('0x36')]:_0x5f1024[_0x2372('0x32')];_0x420c1d[_0x2372('0x3b')]=qs[_0x2372('0x3c')](_0x5de995[_0x2372('0x33')][_0x2372('0x3c')]);_0x420c1d[_0x2372('0x3d')]=qs[_0x2372('0x3e')](_[_0x2372('0x4e')](_0x5de995[_0x2372('0x33')],_0x5f1024['filters']));if(_0x5de995[_0x2372('0x33')][_0x2372('0x3f')]){_0x420c1d[_0x2372('0x3d')]=_['merge'](_0x420c1d['where'],{'$or':_['map'](_0x420c1d[_0x2372('0x36')],function(_0x79aade){var _0x476923={};_0x476923[_0x79aade]={'$like':'%'+_0x5de995[_0x2372('0x33')][_0x2372('0x3f')]+'%'};return _0x476923;})});}_0x420c1d=_['merge']({},_0x420c1d,_0x5de995['options']);return _0x4b8f97[_0x2372('0x4f')](_0x420c1d);}})[_0x2372('0x2a')](function(_0x216c8a){if(_0x216c8a){_0x342f08=_0x216c8a['length'];if(!_0x5de995[_0x2372('0x33')]['hasOwnProperty'](_0x2372('0x3a'))){_0x420c1d[_0x2372('0x21')]=qs[_0x2372('0x21')](_0x5de995['query']['limit']);_0x420c1d[_0x2372('0x1f')]=qs[_0x2372('0x1f')](_0x5de995[_0x2372('0x33')][_0x2372('0x1f')]);}return _0x4b8f97['getSubjects'](_0x420c1d);}})[_0x2372('0x2a')](function(_0x4ac6f0){if(_0x4ac6f0){return _0x4ac6f0?{'count':_0x342f08,'rows':_0x4ac6f0}:null;}})[_0x2372('0x2a')](respondWithResult(_0x26920a,null))[_0x2372('0x48')](handleError(_0x26920a,null));};exports[_0x2372('0x50')]=function(_0x58e9f3,_0x5929c6,_0x31e69a){var _0x205500={};var _0x58ffa2={};var _0x3a0eb2;var _0x5692ca;return db[_0x2372('0x2f')][_0x2372('0x4c')]({'where':{'id':_0x58e9f3['params']['id']}})['then'](handleEntityNotFound(_0x5929c6,null))[_0x2372('0x2a')](function(_0xfba6c9){if(_0xfba6c9){_0x3a0eb2=_0xfba6c9;_0x58ffa2['model']=_[_0x2372('0x34')](db['SugarcrmField'][_0x2372('0x4d')]);_0x58ffa2[_0x2372('0x33')]=_[_0x2372('0x34')](_0x58e9f3[_0x2372('0x33')]);_0x58ffa2[_0x2372('0x3e')]=_[_0x2372('0x35')](_0x58ffa2['model'],_0x58ffa2[_0x2372('0x33')]);_0x205500[_0x2372('0x36')]=_[_0x2372('0x35')](_0x58ffa2[_0x2372('0x32')],qs['fields'](_0x58e9f3[_0x2372('0x33')][_0x2372('0x37')]));_0x205500[_0x2372('0x36')]=_0x205500['attributes'][_0x2372('0x38')]?_0x205500[_0x2372('0x36')]:_0x58ffa2[_0x2372('0x32')];_0x205500[_0x2372('0x3b')]=qs[_0x2372('0x3c')](_0x58e9f3[_0x2372('0x33')][_0x2372('0x3c')]);_0x205500['where']=qs[_0x2372('0x3e')](_[_0x2372('0x4e')](_0x58e9f3[_0x2372('0x33')],_0x58ffa2[_0x2372('0x3e')]));if(_0x58e9f3['query'][_0x2372('0x3f')]){_0x205500[_0x2372('0x3d')]=_[_0x2372('0x40')](_0x205500[_0x2372('0x3d')],{'$or':_[_0x2372('0x2e')](_0x205500['attributes'],function(_0x1307b5){var _0x307e58={};_0x307e58[_0x1307b5]={'$like':'%'+_0x58e9f3[_0x2372('0x33')]['filter']+'%'};return _0x307e58;})});}_0x205500=_[_0x2372('0x40')]({},_0x205500,_0x58e9f3['options']);return _0x3a0eb2[_0x2372('0x50')](_0x205500);}})[_0x2372('0x2a')](function(_0x220a1a){if(_0x220a1a){_0x5692ca=_0x220a1a[_0x2372('0x38')];if(!_0x58e9f3['query'][_0x2372('0x39')](_0x2372('0x3a'))){_0x205500[_0x2372('0x21')]=qs['limit'](_0x58e9f3[_0x2372('0x33')]['limit']);_0x205500[_0x2372('0x1f')]=qs[_0x2372('0x1f')](_0x58e9f3['query']['offset']);}return _0x3a0eb2[_0x2372('0x50')](_0x205500);}})['then'](function(_0x2e95f4){if(_0x2e95f4){return _0x2e95f4?{'count':_0x5692ca,'rows':_0x2e95f4}:null;}})[_0x2372('0x2a')](respondWithResult(_0x5929c6,null))['catch'](handleError(_0x5929c6,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ea19153..7e6acf5 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 _0x8f11=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x5c0b22,_0x56d46a){var _0x16a8a6=function(_0x268ef6){while(--_0x268ef6){_0x5c0b22['push'](_0x5c0b22['shift']());}};_0x16a8a6(++_0x56d46a);}(_0x8f11,0x78));var _0x18f1=function(_0x26a01d,_0x58ca58){_0x26a01d=_0x26a01d-0x0;var _0xec4ef3=_0x8f11[_0x26a01d];return _0xec4ef3;};'use strict';var _=require('lodash');var util=require(_0x18f1('0x0'));var logger=require(_0x18f1('0x1'))(_0x18f1('0x2'));var moment=require(_0x18f1('0x3'));var BPromise=require(_0x18f1('0x4'));var rp=require(_0x18f1('0x5'));var fs=require('fs');var path=require(_0x18f1('0x6'));var rimraf=require(_0x18f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x18f1('0x8'));module[_0x18f1('0x9')]=function(_0x48f0ff,_0x269f00){return _0x48f0ff['define'](_0x18f1('0xa'),attributes,{'tableName':_0x18f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f82=['rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','api','moment','path'];(function(_0x473b5a,_0x17fa75){var _0x32dea3=function(_0x530019){while(--_0x530019){_0x473b5a['push'](_0x473b5a['shift']());}};_0x32dea3(++_0x17fa75);}(_0x0f82,0x92));var _0x20f8=function(_0x3abd63,_0x49de10){_0x3abd63=_0x3abd63-0x0;var _0x365275=_0x0f82[_0x3abd63];return _0x365275;};'use strict';var _=require(_0x20f8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x20f8('0x1'));var moment=require(_0x20f8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x20f8('0x3'));var rimraf=require(_0x20f8('0x4'));var config=require('../../config/environment');var attributes=require(_0x20f8('0x5'));module[_0x20f8('0x6')]=function(_0x25450b,_0x4105e2){return _0x25450b[_0x20f8('0x7')](_0x20f8('0x8'),attributes,{'tableName':_0x20f8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 5e2ce7c..410fa88 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 _0xaad4=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xaad4,0x13b));var _0x4aad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaad4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4aad('0x0'));var util=require(_0x4aad('0x1'));var moment=require(_0x4aad('0x2'));var BPromise=require(_0x4aad('0x3'));var rs=require(_0x4aad('0x4'));var fs=require('fs');var Redis=require(_0x4aad('0x5'));var db=require(_0x4aad('0x6'))['db'];var utils=require(_0x4aad('0x7'));var logger=require('../../config/logger')(_0x4aad('0x8'));var config=require('../../config/environment');var jayson=require(_0x4aad('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x301c3b,_0x433c7d,_0x44eec3){return new BPromise(function(_0xcb4bf9,_0x4571dd){return client[_0x4aad('0xa')](_0x301c3b,_0x44eec3)[_0x4aad('0xb')](function(_0x51766a){logger[_0x4aad('0xc')](_0x4aad('0xd'),_0x433c7d,_0x4aad('0xe'));logger['debug'](_0x4aad('0xf'),_0x433c7d,_0x4aad('0xe'),JSON[_0x4aad('0x10')](_0x51766a));if(_0x51766a[_0x4aad('0x11')]){if(_0x51766a[_0x4aad('0x11')][_0x4aad('0x12')]===0x1f4){logger['error'](_0x4aad('0xd'),_0x433c7d,_0x51766a[_0x4aad('0x11')][_0x4aad('0x13')]);return _0x4571dd(_0x51766a[_0x4aad('0x11')][_0x4aad('0x13')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x433c7d,_0x51766a[_0x4aad('0x11')][_0x4aad('0x13')]);return _0xcb4bf9(_0x51766a[_0x4aad('0x11')]['message']);}else{logger[_0x4aad('0xc')](_0x4aad('0xd'),_0x433c7d,_0x4aad('0xe'));_0xcb4bf9(_0x51766a['result'][_0x4aad('0x13')]);}})[_0x4aad('0x14')](function(_0x1b7ba8){logger[_0x4aad('0x11')](_0x4aad('0xd'),_0x433c7d,_0x1b7ba8);_0x4571dd(_0x1b7ba8);});});} \ No newline at end of file +var _0xc32b=['stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0xc32b,0x9c));var _0xbc32=function(_0x3998c5,_0x42fd0d){_0x3998c5=_0x3998c5-0x0;var _0x202acc=_0xc32b[_0x3998c5];return _0x202acc;};'use strict';var _=require(_0xbc32('0x0'));var util=require(_0xbc32('0x1'));var moment=require(_0xbc32('0x2'));var BPromise=require(_0xbc32('0x3'));var rs=require(_0xbc32('0x4'));var fs=require('fs');var Redis=require(_0xbc32('0x5'));var db=require(_0xbc32('0x6'))['db'];var utils=require(_0xbc32('0x7'));var logger=require(_0xbc32('0x8'))(_0xbc32('0x9'));var config=require(_0xbc32('0xa'));var jayson=require(_0xbc32('0xb'));var client=jayson[_0xbc32('0xc')][_0xbc32('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1bedea,_0x11fd85,_0x4629bc){return new BPromise(function(_0x103cbc,_0x2d3d05){return client[_0xbc32('0xe')](_0x1bedea,_0x4629bc)['then'](function(_0x221017){logger['info'](_0xbc32('0xf'),_0x11fd85,'request\x20sent');logger[_0xbc32('0x10')](_0xbc32('0x11'),_0x11fd85,_0xbc32('0x12'),JSON[_0xbc32('0x13')](_0x221017));if(_0x221017['error']){if(_0x221017['error'][_0xbc32('0x14')]===0x1f4){logger[_0xbc32('0x15')](_0xbc32('0xf'),_0x11fd85,_0x221017[_0xbc32('0x15')][_0xbc32('0x16')]);return _0x2d3d05(_0x221017['error']['message']);}logger[_0xbc32('0x15')](_0xbc32('0xf'),_0x11fd85,_0x221017['error'][_0xbc32('0x16')]);return _0x103cbc(_0x221017['error'][_0xbc32('0x16')]);}else{logger['info'](_0xbc32('0xf'),_0x11fd85,'request\x20sent');_0x103cbc(_0x221017[_0xbc32('0x17')][_0xbc32('0x16')]);}})[_0xbc32('0x18')](function(_0x28071a){logger['error'](_0xbc32('0xf'),_0x11fd85,_0x28071a);_0x2d3d05(_0x28071a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index ac2adc6..a62f045 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 _0xdc04=['get','/:id','post','create','put','update','delete','destroy','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index'];(function(_0x53d1ef,_0x59c30d){var _0x57a6df=function(_0x1ae886){while(--_0x1ae886){_0x53d1ef['push'](_0x53d1ef['shift']());}};_0x57a6df(++_0x59c30d);}(_0xdc04,0x1b2));var _0x4dc0=function(_0x1a085f,_0x1499a1){_0x1a085f=_0x1a085f-0x0;var _0x2611af=_0xdc04[_0x1a085f];return _0x2611af;};'use strict';var multer=require(_0x4dc0('0x0'));var util=require('util');var path=require(_0x4dc0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4dc0('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4dc0('0x3'));var config=require(_0x4dc0('0x4'));var controller=require(_0x4dc0('0x5'));router['get']('/',auth[_0x4dc0('0x6')](),controller[_0x4dc0('0x7')]);router[_0x4dc0('0x8')](_0x4dc0('0x9'),auth[_0x4dc0('0x6')](),controller['show']);router[_0x4dc0('0xa')]('/',auth[_0x4dc0('0x6')](),controller[_0x4dc0('0xb')]);router[_0x4dc0('0xc')](_0x4dc0('0x9'),auth[_0x4dc0('0x6')](),controller[_0x4dc0('0xd')]);router[_0x4dc0('0xe')](_0x4dc0('0x9'),auth[_0x4dc0('0x6')](),controller[_0x4dc0('0xf')]);module[_0x4dc0('0x10')]=router; \ No newline at end of file +var _0xc2d9=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xc2d9,0x10b));var _0x9c2d=function(_0x241c08,_0x3bb8e5){_0x241c08=_0x241c08-0x0;var _0x46c849=_0xc2d9[_0x241c08];return _0x46c849;};'use strict';var multer=require(_0x9c2d('0x0'));var util=require(_0x9c2d('0x1'));var path=require(_0x9c2d('0x2'));var timeout=require(_0x9c2d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9c2d('0x4'));var interaction=require(_0x9c2d('0x5'));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[_0x9c2d('0x9')](),controller[_0x9c2d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9c2d('0xd')]);router[_0x9c2d('0xe')](_0x9c2d('0xb'),auth['isAuthenticated'](),controller[_0x9c2d('0xf')]);router[_0x9c2d('0x10')](_0x9c2d('0xb'),auth['isAuthenticated'](),controller[_0x9c2d('0x11')]);module[_0x9c2d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index b82c495..26b1fb9 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 _0xe149=['variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize'];(function(_0xc582b4,_0x3eecca){var _0x386664=function(_0x4a9638){while(--_0x4a9638){_0xc582b4['push'](_0xc582b4['shift']());}};_0x386664(++_0x3eecca);}(_0xe149,0x167));var _0x9e14=function(_0x4a9744,_0x11c98e){_0x4a9744=_0x4a9744-0x0;var _0x59a9a4=_0xe149[_0x4a9744];return _0x59a9a4;};'use strict';var Sequelize=require(_0x9e14('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x9e14('0x1'),_0x9e14('0x2'),_0x9e14('0x3'),_0x9e14('0x4')),'defaultValue':_0x9e14('0x5')},'content':{'type':Sequelize[_0x9e14('0x6')]},'key':{'type':Sequelize[_0x9e14('0x6')]},'keyType':{'type':Sequelize[_0x9e14('0x7')]('string','variable',_0x9e14('0x2'))},'keyContent':{'type':Sequelize[_0x9e14('0x6')]},'idField':{'type':Sequelize[_0x9e14('0x6')]},'nameField':{'type':Sequelize[_0x9e14('0x6')]},'customField':{'type':Sequelize[_0x9e14('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x290c=['keyValue','STRING','variable','sequelize','ENUM','string','customVariable'];(function(_0x54131c,_0x2036a5){var _0x38e67e=function(_0x29dbbf){while(--_0x29dbbf){_0x54131c['push'](_0x54131c['shift']());}};_0x38e67e(++_0x2036a5);}(_0x290c,0x137));var _0xc290=function(_0x522eef,_0x34975d){_0x522eef=_0x522eef-0x0;var _0x467d7a=_0x290c[_0x522eef];return _0x467d7a;};'use strict';var Sequelize=require(_0xc290('0x0'));module['exports']={'type':{'type':Sequelize[_0xc290('0x1')](_0xc290('0x2'),'variable',_0xc290('0x3'),_0xc290('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc290('0x5')]},'key':{'type':Sequelize[_0xc290('0x5')]},'keyType':{'type':Sequelize[_0xc290('0x1')](_0xc290('0x2'),_0xc290('0x6'),_0xc290('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc290('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e7e1c42..4762240 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 _0x2767=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SugarcrmField'];(function(_0x502036,_0x502686){var _0x485247=function(_0x135ee3){while(--_0x135ee3){_0x502036['push'](_0x502036['shift']());}};_0x485247(++_0x502686);}(_0x2767,0x10c));var _0x7276=function(_0xa423ec,_0x36aff0){_0xa423ec=_0xa423ec-0x0;var _0x264cb7=_0x2767[_0xa423ec];return _0x264cb7;};'use strict';var emlformat=require(_0x7276('0x0'));var rimraf=require(_0x7276('0x1'));var zipdir=require(_0x7276('0x2'));var jsonpatch=require(_0x7276('0x3'));var rp=require(_0x7276('0x4'));var moment=require(_0x7276('0x5'));var BPromise=require(_0x7276('0x6'));var Mustache=require(_0x7276('0x7'));var util=require(_0x7276('0x8'));var path=require(_0x7276('0x9'));var sox=require(_0x7276('0xa'));var csv=require(_0x7276('0xb'));var ejs=require(_0x7276('0xc'));var fs=require('fs');var fs_extra=require(_0x7276('0xd'));var _=require(_0x7276('0xe'));var squel=require('squel');var crypto=require(_0x7276('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7276('0xb'));var querystring=require(_0x7276('0x10'));var Papa=require(_0x7276('0x11'));var Redis=require(_0x7276('0x12'));var authService=require(_0x7276('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7276('0x14'));var logger=require(_0x7276('0x15'))(_0x7276('0x16'));var utils=require(_0x7276('0x17'));var config=require(_0x7276('0x18'));var licenseUtil=require(_0x7276('0x19'));var db=require(_0x7276('0x1a'))['db'];function respondWithStatusCode(_0x53e588,_0x105766){_0x105766=_0x105766||0xcc;return function(_0x52c3a4){if(_0x52c3a4){return _0x53e588[_0x7276('0x1b')](_0x105766);}return _0x53e588[_0x7276('0x1c')](_0x105766)[_0x7276('0x1d')]();};}function respondWithResult(_0x1fce84,_0x4f9273){_0x4f9273=_0x4f9273||0xc8;return function(_0x39e6f){if(_0x39e6f){return _0x1fce84[_0x7276('0x1c')](_0x4f9273)[_0x7276('0x1e')](_0x39e6f);}};}function respondWithFilteredResult(_0x579d63,_0x44a0e1){return function(_0x4076a1){if(_0x4076a1){var _0x204c5e=typeof _0x44a0e1['offset']===_0x7276('0x1f')&&typeof _0x44a0e1['limit']==='undefined';var _0x10cebf=_0x4076a1[_0x7276('0x20')];var _0x15befc=_0x204c5e?0x0:_0x44a0e1[_0x7276('0x21')];var _0x587a7f=_0x204c5e?_0x4076a1[_0x7276('0x20')]:_0x44a0e1[_0x7276('0x21')]+_0x44a0e1[_0x7276('0x22')];var _0x43a98f;if(_0x587a7f>=_0x10cebf){_0x587a7f=_0x10cebf;_0x43a98f=0xc8;}else{_0x43a98f=0xce;}_0x579d63[_0x7276('0x1c')](_0x43a98f);return _0x579d63[_0x7276('0x23')](_0x7276('0x24'),_0x15befc+'-'+_0x587a7f+'/'+_0x10cebf)[_0x7276('0x1e')](_0x4076a1);}return null;};}function patchUpdates(_0x1c1d7f){return function(_0x3b3ad7){try{jsonpatch[_0x7276('0x25')](_0x3b3ad7,_0x1c1d7f,!![]);}catch(_0x49aba5){return BPromise[_0x7276('0x26')](_0x49aba5);}return _0x3b3ad7[_0x7276('0x27')]();};}function saveUpdates(_0x5bdaad,_0x4a4436){return function(_0x249ad2){if(_0x249ad2){return _0x249ad2[_0x7276('0x28')](_0x5bdaad)[_0x7276('0x29')](function(_0x5c2984){return _0x5c2984;});}return null;};}function removeEntity(_0x1b4152,_0x2d4a67){return function(_0x1fb300){if(_0x1fb300){return _0x1fb300['destroy']()[_0x7276('0x29')](function(){_0x1b4152['status'](0xcc)[_0x7276('0x1d')]();});}};}function handleEntityNotFound(_0x27f71e,_0x55c778){return function(_0x3eb574){if(!_0x3eb574){_0x27f71e[_0x7276('0x1b')](0x194);}return _0x3eb574;};}function handleError(_0x5224bd,_0x4cd922){_0x4cd922=_0x4cd922||0x1f4;return function(_0x5dd620){logger['error'](_0x5dd620[_0x7276('0x2a')]);if(_0x5dd620[_0x7276('0x2b')]){delete _0x5dd620[_0x7276('0x2b')];}_0x5224bd[_0x7276('0x1c')](_0x4cd922)[_0x7276('0x2c')](_0x5dd620);};}exports[_0x7276('0x2d')]=function(_0x3512af,_0x24389c){var _0x2e8cd9={},_0x35e0a6={},_0xe9fbad={'count':0x0,'rows':[]};var _0x1a06c8=_[_0x7276('0x2e')](db[_0x7276('0x2f')][_0x7276('0x30')],function(_0x50e957){return{'name':_0x50e957[_0x7276('0x31')],'type':_0x50e957[_0x7276('0x32')][_0x7276('0x33')]};});_0x35e0a6[_0x7276('0x34')]=_['map'](_0x1a06c8,_0x7276('0x2b'));_0x35e0a6[_0x7276('0x35')]=_['keys'](_0x3512af[_0x7276('0x35')]);_0x35e0a6[_0x7276('0x36')]=_[_0x7276('0x37')](_0x35e0a6[_0x7276('0x34')],_0x35e0a6[_0x7276('0x35')]);_0x2e8cd9[_0x7276('0x38')]=_[_0x7276('0x37')](_0x35e0a6[_0x7276('0x34')],qs[_0x7276('0x39')](_0x3512af[_0x7276('0x35')][_0x7276('0x39')]));_0x2e8cd9[_0x7276('0x38')]=_0x2e8cd9['attributes'][_0x7276('0x3a')]?_0x2e8cd9['attributes']:_0x35e0a6[_0x7276('0x34')];if(!_0x3512af[_0x7276('0x35')][_0x7276('0x3b')]('nolimit')){_0x2e8cd9[_0x7276('0x22')]=qs['limit'](_0x3512af[_0x7276('0x35')][_0x7276('0x22')]);_0x2e8cd9[_0x7276('0x21')]=qs[_0x7276('0x21')](_0x3512af[_0x7276('0x35')][_0x7276('0x21')]);}_0x2e8cd9[_0x7276('0x3c')]=qs['sort'](_0x3512af['query'][_0x7276('0x3d')]);_0x2e8cd9[_0x7276('0x3e')]=qs[_0x7276('0x36')](_[_0x7276('0x3f')](_0x3512af[_0x7276('0x35')],_0x35e0a6[_0x7276('0x36')]),_0x1a06c8);if(_0x3512af[_0x7276('0x35')]['filter']){_0x2e8cd9[_0x7276('0x3e')]=_[_0x7276('0x40')](_0x2e8cd9['where'],{'$or':_['map'](_0x1a06c8,function(_0x35a264){if(_0x35a264[_0x7276('0x32')]!=='VIRTUAL'){var _0x2f1a58={};_0x2f1a58[_0x35a264[_0x7276('0x2b')]]={'$like':'%'+_0x3512af[_0x7276('0x35')][_0x7276('0x41')]+'%'};return _0x2f1a58;}})});}_0x2e8cd9=_['merge']({},_0x2e8cd9,_0x3512af[_0x7276('0x42')]);var _0x24511f={'where':_0x2e8cd9[_0x7276('0x3e')]};return db['SugarcrmField'][_0x7276('0x20')](_0x24511f)[_0x7276('0x29')](function(_0x35fe71){_0xe9fbad['count']=_0x35fe71;if(_0x3512af[_0x7276('0x35')][_0x7276('0x43')]){_0x2e8cd9[_0x7276('0x44')]=[{'all':!![]}];}return db[_0x7276('0x2f')][_0x7276('0x45')](_0x2e8cd9);})[_0x7276('0x29')](function(_0x522366){_0xe9fbad[_0x7276('0x46')]=_0x522366;return _0xe9fbad;})[_0x7276('0x29')](respondWithFilteredResult(_0x24389c,_0x2e8cd9))[_0x7276('0x47')](handleError(_0x24389c,null));};exports[_0x7276('0x48')]=function(_0x2b2787,_0x2f882b){var _0x6e7cb7={'raw':!![],'where':{'id':_0x2b2787[_0x7276('0x49')]['id']}},_0x3aed76={};_0x3aed76[_0x7276('0x34')]=_[_0x7276('0x4a')](db[_0x7276('0x2f')][_0x7276('0x30')]);_0x3aed76['query']=_[_0x7276('0x4a')](_0x2b2787[_0x7276('0x35')]);_0x3aed76[_0x7276('0x36')]=_[_0x7276('0x37')](_0x3aed76[_0x7276('0x34')],_0x3aed76['query']);_0x6e7cb7[_0x7276('0x38')]=_[_0x7276('0x37')](_0x3aed76['model'],qs[_0x7276('0x39')](_0x2b2787['query'][_0x7276('0x39')]));_0x6e7cb7[_0x7276('0x38')]=_0x6e7cb7[_0x7276('0x38')][_0x7276('0x3a')]?_0x6e7cb7[_0x7276('0x38')]:_0x3aed76[_0x7276('0x34')];if(_0x2b2787[_0x7276('0x35')][_0x7276('0x43')]){_0x6e7cb7[_0x7276('0x44')]=[{'all':!![]}];}_0x6e7cb7=_[_0x7276('0x40')]({},_0x6e7cb7,_0x2b2787[_0x7276('0x42')]);return db['SugarcrmField'][_0x7276('0x4b')](_0x6e7cb7)['then'](handleEntityNotFound(_0x2f882b,null))[_0x7276('0x29')](respondWithResult(_0x2f882b,null))[_0x7276('0x47')](handleError(_0x2f882b,null));};exports[_0x7276('0x4c')]=function(_0x152c18,_0x2726be){return db[_0x7276('0x2f')][_0x7276('0x4c')](_0x152c18[_0x7276('0x4d')],{})['then'](respondWithResult(_0x2726be,0xc9))[_0x7276('0x47')](handleError(_0x2726be,null));};exports[_0x7276('0x28')]=function(_0x1558e0,_0x556c0f){if(_0x1558e0['body']['id']){delete _0x1558e0[_0x7276('0x4d')]['id'];}return db[_0x7276('0x2f')][_0x7276('0x4b')]({'where':{'id':_0x1558e0[_0x7276('0x49')]['id']}})[_0x7276('0x29')](handleEntityNotFound(_0x556c0f,null))[_0x7276('0x29')](saveUpdates(_0x1558e0[_0x7276('0x4d')],null))[_0x7276('0x29')](respondWithResult(_0x556c0f,null))[_0x7276('0x47')](handleError(_0x556c0f,null));};exports[_0x7276('0x4e')]=function(_0x1cebe4,_0x2881dc){return db[_0x7276('0x2f')][_0x7276('0x4b')]({'where':{'id':_0x1cebe4[_0x7276('0x49')]['id']}})[_0x7276('0x29')](handleEntityNotFound(_0x2881dc,null))[_0x7276('0x29')](removeEntity(_0x2881dc,null))[_0x7276('0x47')](handleError(_0x2881dc,null));}; \ No newline at end of file +var _0xce64=['limit','undefined','count','offset','Content-Range','json','apply','reject','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0xce64,0xca));var _0x4ce6=function(_0x579a21,_0x2c647c){_0x579a21=_0x579a21-0x0;var _0x316aff=_0xce64[_0x579a21];return _0x316aff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4ce6('0x0'));var rp=require(_0x4ce6('0x1'));var moment=require(_0x4ce6('0x2'));var BPromise=require(_0x4ce6('0x3'));var Mustache=require(_0x4ce6('0x4'));var util=require(_0x4ce6('0x5'));var path=require(_0x4ce6('0x6'));var sox=require('sox');var csv=require(_0x4ce6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ce6('0x8'));var _=require(_0x4ce6('0x9'));var squel=require(_0x4ce6('0xa'));var crypto=require('crypto');var jsforce=require(_0x4ce6('0xb'));var deskjs=require(_0x4ce6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4ce6('0xd'));var Papa=require('papaparse');var Redis=require(_0x4ce6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4ce6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ce6('0x10'));var logger=require(_0x4ce6('0x11'))(_0x4ce6('0x12'));var utils=require(_0x4ce6('0x13'));var config=require(_0x4ce6('0x14'));var licenseUtil=require(_0x4ce6('0x15'));var db=require(_0x4ce6('0x16'))['db'];function respondWithStatusCode(_0x573e6a,_0x4ebd2a){_0x4ebd2a=_0x4ebd2a||0xcc;return function(_0x3d64d1){if(_0x3d64d1){return _0x573e6a[_0x4ce6('0x17')](_0x4ebd2a);}return _0x573e6a[_0x4ce6('0x18')](_0x4ebd2a)[_0x4ce6('0x19')]();};}function respondWithResult(_0x265fb3,_0x3299b4){_0x3299b4=_0x3299b4||0xc8;return function(_0x3dc429){if(_0x3dc429){return _0x265fb3[_0x4ce6('0x18')](_0x3299b4)['json'](_0x3dc429);}};}function respondWithFilteredResult(_0x398b2a,_0x88f410){return function(_0x9b6878){if(_0x9b6878){var _0xf10c0d=typeof _0x88f410['offset']==='undefined'&&typeof _0x88f410[_0x4ce6('0x1a')]===_0x4ce6('0x1b');var _0x1e0644=_0x9b6878[_0x4ce6('0x1c')];var _0x1c9bfb=_0xf10c0d?0x0:_0x88f410[_0x4ce6('0x1d')];var _0x5df1eb=_0xf10c0d?_0x9b6878[_0x4ce6('0x1c')]:_0x88f410[_0x4ce6('0x1d')]+_0x88f410[_0x4ce6('0x1a')];var _0x13766e;if(_0x5df1eb>=_0x1e0644){_0x5df1eb=_0x1e0644;_0x13766e=0xc8;}else{_0x13766e=0xce;}_0x398b2a['status'](_0x13766e);return _0x398b2a['set'](_0x4ce6('0x1e'),_0x1c9bfb+'-'+_0x5df1eb+'/'+_0x1e0644)[_0x4ce6('0x1f')](_0x9b6878);}return null;};}function patchUpdates(_0x4029c7){return function(_0x4783bf){try{jsonpatch[_0x4ce6('0x20')](_0x4783bf,_0x4029c7,!![]);}catch(_0x389e4c){return BPromise[_0x4ce6('0x21')](_0x389e4c);}return _0x4783bf['save']();};}function saveUpdates(_0x4b30a8,_0x31c268){return function(_0x43983e){if(_0x43983e){return _0x43983e['update'](_0x4b30a8)['then'](function(_0x2a17c5){return _0x2a17c5;});}return null;};}function removeEntity(_0x38f87d,_0x31f935){return function(_0x21e654){if(_0x21e654){return _0x21e654['destroy']()[_0x4ce6('0x22')](function(){_0x38f87d[_0x4ce6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8e5f3d,_0x368c8d){return function(_0x2744dd){if(!_0x2744dd){_0x8e5f3d[_0x4ce6('0x17')](0x194);}return _0x2744dd;};}function handleError(_0x4d4e52,_0x1ac870){_0x1ac870=_0x1ac870||0x1f4;return function(_0x1cf6d0){logger[_0x4ce6('0x23')](_0x1cf6d0[_0x4ce6('0x24')]);if(_0x1cf6d0['name']){delete _0x1cf6d0[_0x4ce6('0x25')];}_0x4d4e52[_0x4ce6('0x18')](_0x1ac870)[_0x4ce6('0x26')](_0x1cf6d0);};}exports[_0x4ce6('0x27')]=function(_0x16f7d7,_0x2165ea){var _0x547575={},_0x283dae={},_0x45d2cc={'count':0x0,'rows':[]};var _0x28cb51=_[_0x4ce6('0x28')](db['SugarcrmField'][_0x4ce6('0x29')],function(_0xe7d7b3){return{'name':_0xe7d7b3[_0x4ce6('0x2a')],'type':_0xe7d7b3['type'][_0x4ce6('0x2b')]};});_0x283dae[_0x4ce6('0x2c')]=_[_0x4ce6('0x28')](_0x28cb51,'name');_0x283dae[_0x4ce6('0x2d')]=_[_0x4ce6('0x2e')](_0x16f7d7[_0x4ce6('0x2d')]);_0x283dae[_0x4ce6('0x2f')]=_['intersection'](_0x283dae[_0x4ce6('0x2c')],_0x283dae[_0x4ce6('0x2d')]);_0x547575[_0x4ce6('0x30')]=_[_0x4ce6('0x31')](_0x283dae[_0x4ce6('0x2c')],qs[_0x4ce6('0x32')](_0x16f7d7[_0x4ce6('0x2d')]['fields']));_0x547575['attributes']=_0x547575[_0x4ce6('0x30')][_0x4ce6('0x33')]?_0x547575[_0x4ce6('0x30')]:_0x283dae['model'];if(!_0x16f7d7['query'][_0x4ce6('0x34')](_0x4ce6('0x35'))){_0x547575['limit']=qs[_0x4ce6('0x1a')](_0x16f7d7[_0x4ce6('0x2d')][_0x4ce6('0x1a')]);_0x547575[_0x4ce6('0x1d')]=qs[_0x4ce6('0x1d')](_0x16f7d7['query'][_0x4ce6('0x1d')]);}_0x547575[_0x4ce6('0x36')]=qs[_0x4ce6('0x37')](_0x16f7d7[_0x4ce6('0x2d')][_0x4ce6('0x37')]);_0x547575[_0x4ce6('0x38')]=qs[_0x4ce6('0x2f')](_[_0x4ce6('0x39')](_0x16f7d7[_0x4ce6('0x2d')],_0x283dae[_0x4ce6('0x2f')]),_0x28cb51);if(_0x16f7d7[_0x4ce6('0x2d')][_0x4ce6('0x3a')]){_0x547575['where']=_[_0x4ce6('0x3b')](_0x547575[_0x4ce6('0x38')],{'$or':_['map'](_0x28cb51,function(_0x19d770){if(_0x19d770[_0x4ce6('0x3c')]!==_0x4ce6('0x3d')){var _0x579c34={};_0x579c34[_0x19d770[_0x4ce6('0x25')]]={'$like':'%'+_0x16f7d7[_0x4ce6('0x2d')][_0x4ce6('0x3a')]+'%'};return _0x579c34;}})});}_0x547575=_[_0x4ce6('0x3b')]({},_0x547575,_0x16f7d7[_0x4ce6('0x3e')]);var _0x2bb28e={'where':_0x547575[_0x4ce6('0x38')]};return db[_0x4ce6('0x3f')][_0x4ce6('0x1c')](_0x2bb28e)[_0x4ce6('0x22')](function(_0x2f5d2b){_0x45d2cc['count']=_0x2f5d2b;if(_0x16f7d7['query'][_0x4ce6('0x40')]){_0x547575[_0x4ce6('0x41')]=[{'all':!![]}];}return db[_0x4ce6('0x3f')][_0x4ce6('0x42')](_0x547575);})['then'](function(_0xe9f36f){_0x45d2cc[_0x4ce6('0x43')]=_0xe9f36f;return _0x45d2cc;})[_0x4ce6('0x22')](respondWithFilteredResult(_0x2165ea,_0x547575))[_0x4ce6('0x44')](handleError(_0x2165ea,null));};exports[_0x4ce6('0x45')]=function(_0x47ea5b,_0x40a3f4){var _0x58004b={'raw':!![],'where':{'id':_0x47ea5b[_0x4ce6('0x46')]['id']}},_0x5af8a6={};_0x5af8a6[_0x4ce6('0x2c')]=_['keys'](db['SugarcrmField'][_0x4ce6('0x29')]);_0x5af8a6['query']=_[_0x4ce6('0x2e')](_0x47ea5b['query']);_0x5af8a6['filters']=_[_0x4ce6('0x31')](_0x5af8a6[_0x4ce6('0x2c')],_0x5af8a6[_0x4ce6('0x2d')]);_0x58004b[_0x4ce6('0x30')]=_[_0x4ce6('0x31')](_0x5af8a6[_0x4ce6('0x2c')],qs['fields'](_0x47ea5b['query']['fields']));_0x58004b[_0x4ce6('0x30')]=_0x58004b['attributes']['length']?_0x58004b[_0x4ce6('0x30')]:_0x5af8a6[_0x4ce6('0x2c')];if(_0x47ea5b[_0x4ce6('0x2d')][_0x4ce6('0x40')]){_0x58004b[_0x4ce6('0x41')]=[{'all':!![]}];}_0x58004b=_['merge']({},_0x58004b,_0x47ea5b['options']);return db[_0x4ce6('0x3f')]['find'](_0x58004b)[_0x4ce6('0x22')](handleEntityNotFound(_0x40a3f4,null))[_0x4ce6('0x22')](respondWithResult(_0x40a3f4,null))['catch'](handleError(_0x40a3f4,null));};exports[_0x4ce6('0x47')]=function(_0x4ddf09,_0x25264a){return db[_0x4ce6('0x3f')][_0x4ce6('0x47')](_0x4ddf09['body'],{})[_0x4ce6('0x22')](respondWithResult(_0x25264a,0xc9))[_0x4ce6('0x44')](handleError(_0x25264a,null));};exports[_0x4ce6('0x48')]=function(_0x2e2741,_0x492e4c){if(_0x2e2741['body']['id']){delete _0x2e2741[_0x4ce6('0x49')]['id'];}return db[_0x4ce6('0x3f')][_0x4ce6('0x4a')]({'where':{'id':_0x2e2741['params']['id']}})[_0x4ce6('0x22')](handleEntityNotFound(_0x492e4c,null))['then'](saveUpdates(_0x2e2741[_0x4ce6('0x49')],null))[_0x4ce6('0x22')](respondWithResult(_0x492e4c,null))[_0x4ce6('0x44')](handleError(_0x492e4c,null));};exports[_0x4ce6('0x4b')]=function(_0x4f28cf,_0x1988e6){return db[_0x4ce6('0x3f')][_0x4ce6('0x4a')]({'where':{'id':_0x4f28cf['params']['id']}})[_0x4ce6('0x22')](handleEntityNotFound(_0x1988e6,null))[_0x4ce6('0x22')](removeEntity(_0x1988e6,null))[_0x4ce6('0x44')](handleError(_0x1988e6,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index af46cf7..71e451c 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 _0xa085=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','FieldId','lodash','util','../../config/logger','api'];(function(_0x95b0f2,_0x1a5be0){var _0xf879c7=function(_0x180b6e){while(--_0x180b6e){_0x95b0f2['push'](_0x95b0f2['shift']());}};_0xf879c7(++_0x1a5be0);}(_0xa085,0x1e6));var _0x5a08=function(_0x38a301,_0x4112f3){_0x38a301=_0x38a301-0x0;var _0x554d85=_0xa085[_0x38a301];return _0x554d85;};'use strict';var _=require(_0x5a08('0x0'));var util=require(_0x5a08('0x1'));var logger=require(_0x5a08('0x2'))(_0x5a08('0x3'));var moment=require(_0x5a08('0x4'));var BPromise=require(_0x5a08('0x5'));var rp=require(_0x5a08('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a08('0x7'));var config=require(_0x5a08('0x8'));var attributes=require(_0x5a08('0x9'));module[_0x5a08('0xa')]=function(_0x253759,_0x3bf86f){return _0x253759[_0x5a08('0xb')]('SugarcrmField',attributes,{'tableName':_0x5a08('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x5a08('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf51b=['idField','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x3001ee,_0x5e716e){var _0xa405c8=function(_0x404f72){while(--_0x404f72){_0x3001ee['push'](_0x3001ee['shift']());}};_0xa405c8(++_0x5e716e);}(_0xf51b,0x1e1));var _0xbf51=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf51b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbf51('0x0'));var util=require(_0xbf51('0x1'));var logger=require(_0xbf51('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbf51('0x3'));var rp=require(_0xbf51('0x4'));var fs=require('fs');var path=require(_0xbf51('0x5'));var rimraf=require(_0xbf51('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf51('0x7'));module[_0xbf51('0x8')]=function(_0x1f013d,_0x1f6159){return _0x1f013d[_0xbf51('0x9')](_0xbf51('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xbf51('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index edf657b..327364f 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 _0x96e5=['../../mysqldb','rpc','jayson/promise','client','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x96e5,0x126));var _0x596e=function(_0x3a3292,_0x44bb68){_0x3a3292=_0x3a3292-0x0;var _0x2e8bed=_0x96e5[_0x3a3292];return _0x2e8bed;};'use strict';var _=require(_0x596e('0x0'));var util=require(_0x596e('0x1'));var moment=require(_0x596e('0x2'));var BPromise=require(_0x596e('0x3'));var rs=require(_0x596e('0x4'));var fs=require('fs');var Redis=require(_0x596e('0x5'));var db=require(_0x596e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x596e('0x7'));var config=require('../../config/environment');var jayson=require(_0x596e('0x8'));var client=jayson[_0x596e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2a81,_0x1445e4,_0x1b9d37){return new BPromise(function(_0x4e5402,_0x2f6cdb){return client['request'](_0x5b2a81,_0x1b9d37)['then'](function(_0x4127d7){logger[_0x596e('0xa')](_0x596e('0xb'),_0x1445e4,_0x596e('0xc'));logger[_0x596e('0xd')](_0x596e('0xe'),_0x1445e4,'request\x20sent',JSON[_0x596e('0xf')](_0x4127d7));if(_0x4127d7[_0x596e('0x10')]){if(_0x4127d7[_0x596e('0x10')]['code']===0x1f4){logger[_0x596e('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x1445e4,_0x4127d7[_0x596e('0x10')][_0x596e('0x11')]);return _0x2f6cdb(_0x4127d7['error'][_0x596e('0x11')]);}logger[_0x596e('0x10')](_0x596e('0xb'),_0x1445e4,_0x4127d7['error']['message']);return _0x4e5402(_0x4127d7['error']['message']);}else{logger[_0x596e('0xa')](_0x596e('0xb'),_0x1445e4,'request\x20sent');_0x4e5402(_0x4127d7[_0x596e('0x12')][_0x596e('0x11')]);}})[_0x596e('0x13')](function(_0x5c04de){logger[_0x596e('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x1445e4,_0x5c04de);_0x2f6cdb(_0x5c04de);});});} \ No newline at end of file +var _0x2ab4=['client','http','request','then','info','request\x20sent','stringify','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4f7dbe,_0x5ec8eb){var _0x301a7c=function(_0x39feca){while(--_0x39feca){_0x4f7dbe['push'](_0x4f7dbe['shift']());}};_0x301a7c(++_0x5ec8eb);}(_0x2ab4,0xe8));var _0x42ab=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x2ab4[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x42ab('0x0'));var util=require('util');var moment=require(_0x42ab('0x1'));var BPromise=require(_0x42ab('0x2'));var rs=require(_0x42ab('0x3'));var fs=require('fs');var Redis=require(_0x42ab('0x4'));var db=require(_0x42ab('0x5'))['db'];var utils=require(_0x42ab('0x6'));var logger=require('../../config/logger')(_0x42ab('0x7'));var config=require(_0x42ab('0x8'));var jayson=require(_0x42ab('0x9'));var client=jayson[_0x42ab('0xa')][_0x42ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x580a46,_0x24f2ca,_0x24b45d){return new BPromise(function(_0xeb0cb0,_0x6d9f2c){return client[_0x42ab('0xc')](_0x580a46,_0x24b45d)[_0x42ab('0xd')](function(_0x5b0e34){logger[_0x42ab('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x24f2ca,_0x42ab('0xf'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x24f2ca,_0x42ab('0xf'),JSON[_0x42ab('0x10')](_0x5b0e34));if(_0x5b0e34[_0x42ab('0x11')]){if(_0x5b0e34[_0x42ab('0x11')]['code']===0x1f4){logger[_0x42ab('0x11')](_0x42ab('0x12'),_0x24f2ca,_0x5b0e34['error']['message']);return _0x6d9f2c(_0x5b0e34[_0x42ab('0x11')]['message']);}logger[_0x42ab('0x11')](_0x42ab('0x12'),_0x24f2ca,_0x5b0e34['error'][_0x42ab('0x13')]);return _0xeb0cb0(_0x5b0e34[_0x42ab('0x11')]['message']);}else{logger['info'](_0x42ab('0x12'),_0x24f2ca,_0x42ab('0xf'));_0xeb0cb0(_0x5b0e34[_0x42ab('0x14')][_0x42ab('0x13')]);}})[_0x42ab('0x15')](function(_0x138d43){logger[_0x42ab('0x11')](_0x42ab('0x12'),_0x24f2ca,_0x138d43);_0x6d9f2c(_0x138d43);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b72d744..ed310f8 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 _0x8e52=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','post','/:id/configurations','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x8ac6b3,_0x20b0e1){var _0x1d6427=function(_0x323615){while(--_0x323615){_0x8ac6b3['push'](_0x8ac6b3['shift']());}};_0x1d6427(++_0x20b0e1);}(_0x8e52,0x1c6));var _0x28e5=function(_0x52b24f,_0xca062d){_0x52b24f=_0x52b24f-0x0;var _0x46ea6b=_0x8e52[_0x52b24f];return _0x46ea6b;};'use strict';var multer=require('multer');var util=require(_0x28e5('0x0'));var path=require(_0x28e5('0x1'));var timeout=require(_0x28e5('0x2'));var express=require(_0x28e5('0x3'));var router=express[_0x28e5('0x4')]();var fs_extra=require(_0x28e5('0x5'));var auth=require(_0x28e5('0x6'));var interaction=require(_0x28e5('0x7'));var config=require(_0x28e5('0x8'));var controller=require(_0x28e5('0x9'));router[_0x28e5('0xa')]('/',auth[_0x28e5('0xb')](),controller[_0x28e5('0xc')]);router[_0x28e5('0xa')](_0x28e5('0xd'),auth['isAuthenticated'](),controller[_0x28e5('0xe')]);router[_0x28e5('0xa')]('/:id/configurations',auth[_0x28e5('0xb')](),controller['getConfigurations']);router[_0x28e5('0xa')](_0x28e5('0xf'),auth[_0x28e5('0xb')](),controller[_0x28e5('0x10')]);router[_0x28e5('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x28e5('0x12'),auth[_0x28e5('0xb')](),controller['addConfiguration']);router[_0x28e5('0x13')](_0x28e5('0xd'),auth[_0x28e5('0xb')](),controller['update']);router[_0x28e5('0x14')]('/:id',auth[_0x28e5('0xb')](),controller[_0x28e5('0x15')]);module[_0x28e5('0x16')]=router; \ No newline at end of file +var _0x9ec3=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id/configurations','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x9ec3,0xcd));var _0x39ec=function(_0x3312ee,_0x686154){_0x3312ee=_0x3312ee-0x0;var _0x5e5fbf=_0x9ec3[_0x3312ee];return _0x5e5fbf;};'use strict';var multer=require(_0x39ec('0x0'));var util=require(_0x39ec('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x39ec('0x2'));var router=express['Router']();var fs_extra=require(_0x39ec('0x3'));var auth=require(_0x39ec('0x4'));var interaction=require(_0x39ec('0x5'));var config=require(_0x39ec('0x6'));var controller=require(_0x39ec('0x7'));router[_0x39ec('0x8')]('/',auth[_0x39ec('0x9')](),controller[_0x39ec('0xa')]);router['get']('/:id',auth[_0x39ec('0x9')](),controller['show']);router[_0x39ec('0x8')](_0x39ec('0xb'),auth[_0x39ec('0x9')](),controller['getConfigurations']);router[_0x39ec('0x8')]('/:id/fields',auth[_0x39ec('0x9')](),controller[_0x39ec('0xc')]);router['post']('/',auth[_0x39ec('0x9')](),controller[_0x39ec('0xd')]);router[_0x39ec('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x39ec('0xf')]);router[_0x39ec('0x10')]('/:id',auth[_0x39ec('0x9')](),controller[_0x39ec('0x11')]);router[_0x39ec('0x12')]('/:id',auth[_0x39ec('0x9')](),controller[_0x39ec('0x13')]);module[_0x39ec('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 25a622b..4032d8d 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 _0x3898=['STRING','HelpDesk'];(function(_0x33b507,_0xe48ac3){var _0x4d4309=function(_0x238168){while(--_0x238168){_0x33b507['push'](_0x33b507['shift']());}};_0x4d4309(++_0xe48ac3);}(_0x3898,0x1ba));var _0x8389=function(_0x267031,_0x303b48){_0x267031=_0x267031-0x0;var _0x1dc1cd=_0x3898[_0x267031];return _0x1dc1cd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8389('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x8389('0x0')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8389('0x0')],'allowNull':![],'defaultValue':_0x8389('0x1')},'remoteUri':{'type':Sequelize[_0x8389('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8389('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8389('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0b88=['HelpDesk','STRING'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x0b88,0x19b));var _0x80b8=function(_0x458a85,_0x202334){_0x458a85=_0x458a85-0x0;var _0x36e112=_0x0b88[_0x458a85];return _0x36e112;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x80b8('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x80b8('0x0')]},'username':{'type':Sequelize[_0x80b8('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x80b8('0x0')],'allowNull':![],'defaultValue':_0x80b8('0x1')},'remoteUri':{'type':Sequelize[_0x80b8('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x80b8('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x80b8('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 795b86e..dfc4677 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 _0x2ea4=['hasOwnProperty','order','sort','where','filter','merge','options','includeAll','findAll','rows','params','rawAttributes','include','catch','create','body','find','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','username','description','moduleName','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','describe','sessionName','autogenerated','reference','owner','remove','startsWith','picklist','label','value','vTiger\x20error:\x20','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x5505d5,_0x2f5945){var _0x155814=function(_0x3262e3){while(--_0x3262e3){_0x5505d5['push'](_0x5505d5['shift']());}};_0x155814(++_0x2f5945);}(_0x2ea4,0xad));var _0x42ea=function(_0x34052f,_0xa3ed34){_0x34052f=_0x34052f-0x0;var _0xf40062=_0x2ea4[_0x34052f];return _0xf40062;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42ea('0x0'));var zipdir=require(_0x42ea('0x1'));var jsonpatch=require(_0x42ea('0x2'));var rp=require(_0x42ea('0x3'));var moment=require(_0x42ea('0x4'));var BPromise=require(_0x42ea('0x5'));var Mustache=require(_0x42ea('0x6'));var util=require(_0x42ea('0x7'));var path=require(_0x42ea('0x8'));var sox=require(_0x42ea('0x9'));var csv=require(_0x42ea('0xa'));var ejs=require(_0x42ea('0xb'));var fs=require('fs');var fs_extra=require(_0x42ea('0xc'));var _=require(_0x42ea('0xd'));var squel=require(_0x42ea('0xe'));var crypto=require(_0x42ea('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x42ea('0x10'));var toCsv=require('to-csv');var querystring=require(_0x42ea('0x11'));var Papa=require('papaparse');var Redis=require(_0x42ea('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x42ea('0x13'));var as=require(_0x42ea('0x14'));var hardwareService=require(_0x42ea('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x42ea('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42ea('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x7185df,_0x1e0edc){_0x1e0edc=_0x1e0edc||0xcc;return function(_0x1a63b5){if(_0x1a63b5){return _0x7185df[_0x42ea('0x18')](_0x1e0edc);}return _0x7185df['status'](_0x1e0edc)[_0x42ea('0x19')]();};}function respondWithResult(_0x3c398d,_0x2ef78e){_0x2ef78e=_0x2ef78e||0xc8;return function(_0x43acc1){if(_0x43acc1){return _0x3c398d[_0x42ea('0x1a')](_0x2ef78e)[_0x42ea('0x1b')](_0x43acc1);}};}function respondWithFilteredResult(_0x21e596,_0x2e5344){return function(_0x192a0d){if(_0x192a0d){var _0x43dc24=typeof _0x2e5344[_0x42ea('0x1c')]===_0x42ea('0x1d')&&typeof _0x2e5344['limit']===_0x42ea('0x1d');var _0x3b8a85=_0x192a0d['count'];var _0x2dfc8e=_0x43dc24?0x0:_0x2e5344['offset'];var _0x1e5d9d=_0x43dc24?_0x192a0d[_0x42ea('0x1e')]:_0x2e5344[_0x42ea('0x1c')]+_0x2e5344[_0x42ea('0x1f')];var _0xd423ae;if(_0x1e5d9d>=_0x3b8a85){_0x1e5d9d=_0x3b8a85;_0xd423ae=0xc8;}else{_0xd423ae=0xce;}_0x21e596[_0x42ea('0x1a')](_0xd423ae);return _0x21e596['set'](_0x42ea('0x20'),_0x2dfc8e+'-'+_0x1e5d9d+'/'+_0x3b8a85)[_0x42ea('0x1b')](_0x192a0d);}return null;};}function patchUpdates(_0x2445c3){return function(_0x21ee8e){try{jsonpatch['apply'](_0x21ee8e,_0x2445c3,!![]);}catch(_0x145484){return BPromise[_0x42ea('0x21')](_0x145484);}return _0x21ee8e[_0x42ea('0x22')]();};}function saveUpdates(_0x17b74e,_0x44496e){return function(_0x2c7376){if(_0x2c7376){return _0x2c7376[_0x42ea('0x23')](_0x17b74e)[_0x42ea('0x24')](function(_0x10e0e5){return _0x10e0e5;});}return null;};}function removeEntity(_0x2da5a1,_0x3eeea3){return function(_0x57e230){if(_0x57e230){return _0x57e230[_0x42ea('0x25')]()[_0x42ea('0x24')](function(){_0x2da5a1[_0x42ea('0x1a')](0xcc)[_0x42ea('0x19')]();});}};}function handleEntityNotFound(_0x133455,_0x564f8b){return function(_0xa437c8){if(!_0xa437c8){_0x133455[_0x42ea('0x18')](0x194);}return _0xa437c8;};}function handleError(_0x3997ca,_0x4ec4ec){_0x4ec4ec=_0x4ec4ec||0x1f4;return function(_0xb75c2c){logger[_0x42ea('0x26')](_0xb75c2c['stack']);if(_0xb75c2c[_0x42ea('0x27')]){delete _0xb75c2c[_0x42ea('0x27')];}_0x3997ca[_0x42ea('0x1a')](_0x4ec4ec)[_0x42ea('0x28')](_0xb75c2c);};}exports[_0x42ea('0x29')]=function(_0x2cf0b0,_0x26de63){var _0x5aad0b={},_0x34a239={},_0x37f898={'count':0x0,'rows':[]};var _0x750f8e=_[_0x42ea('0x2a')](db[_0x42ea('0x2b')]['rawAttributes'],function(_0x497961){return{'name':_0x497961[_0x42ea('0x2c')],'type':_0x497961[_0x42ea('0x2d')][_0x42ea('0x2e')]};});_0x34a239[_0x42ea('0x2f')]=_[_0x42ea('0x2a')](_0x750f8e,'name');_0x34a239[_0x42ea('0x30')]=_[_0x42ea('0x31')](_0x2cf0b0[_0x42ea('0x30')]);_0x34a239[_0x42ea('0x32')]=_[_0x42ea('0x33')](_0x34a239[_0x42ea('0x2f')],_0x34a239[_0x42ea('0x30')]);_0x5aad0b[_0x42ea('0x34')]=_[_0x42ea('0x33')](_0x34a239['model'],qs[_0x42ea('0x35')](_0x2cf0b0['query']['fields']));_0x5aad0b[_0x42ea('0x34')]=_0x5aad0b[_0x42ea('0x34')][_0x42ea('0x36')]?_0x5aad0b['attributes']:_0x34a239[_0x42ea('0x2f')];if(!_0x2cf0b0[_0x42ea('0x30')][_0x42ea('0x37')]('nolimit')){_0x5aad0b[_0x42ea('0x1f')]=qs['limit'](_0x2cf0b0[_0x42ea('0x30')]['limit']);_0x5aad0b[_0x42ea('0x1c')]=qs[_0x42ea('0x1c')](_0x2cf0b0['query']['offset']);}_0x5aad0b[_0x42ea('0x38')]=qs[_0x42ea('0x39')](_0x2cf0b0['query'][_0x42ea('0x39')]);_0x5aad0b[_0x42ea('0x3a')]=qs[_0x42ea('0x32')](_['pick'](_0x2cf0b0['query'],_0x34a239['filters']),_0x750f8e);if(_0x2cf0b0[_0x42ea('0x30')][_0x42ea('0x3b')]){_0x5aad0b[_0x42ea('0x3a')]=_[_0x42ea('0x3c')](_0x5aad0b[_0x42ea('0x3a')],{'$or':_[_0x42ea('0x2a')](_0x750f8e,function(_0x5a9bbf){if(_0x5a9bbf[_0x42ea('0x2d')]!=='VIRTUAL'){var _0x3f3de4={};_0x3f3de4[_0x5a9bbf[_0x42ea('0x27')]]={'$like':'%'+_0x2cf0b0[_0x42ea('0x30')][_0x42ea('0x3b')]+'%'};return _0x3f3de4;}})});}_0x5aad0b=_[_0x42ea('0x3c')]({},_0x5aad0b,_0x2cf0b0[_0x42ea('0x3d')]);var _0x161287={'where':_0x5aad0b[_0x42ea('0x3a')]};return db[_0x42ea('0x2b')][_0x42ea('0x1e')](_0x161287)[_0x42ea('0x24')](function(_0x4c419a){_0x37f898[_0x42ea('0x1e')]=_0x4c419a;if(_0x2cf0b0[_0x42ea('0x30')][_0x42ea('0x3e')]){_0x5aad0b['include']=[{'all':!![]}];}return db[_0x42ea('0x2b')][_0x42ea('0x3f')](_0x5aad0b);})['then'](function(_0x2c0980){_0x37f898[_0x42ea('0x40')]=_0x2c0980;return _0x37f898;})[_0x42ea('0x24')](respondWithFilteredResult(_0x26de63,_0x5aad0b))['catch'](handleError(_0x26de63,null));};exports['show']=function(_0x456516,_0x2b8eef){var _0x4df249={'raw':![],'where':{'id':_0x456516[_0x42ea('0x41')]['id']}},_0x1004df={};_0x1004df[_0x42ea('0x2f')]=_[_0x42ea('0x31')](db[_0x42ea('0x2b')][_0x42ea('0x42')]);_0x1004df[_0x42ea('0x30')]=_[_0x42ea('0x31')](_0x456516[_0x42ea('0x30')]);_0x1004df[_0x42ea('0x32')]=_[_0x42ea('0x33')](_0x1004df[_0x42ea('0x2f')],_0x1004df[_0x42ea('0x30')]);_0x4df249['attributes']=_[_0x42ea('0x33')](_0x1004df[_0x42ea('0x2f')],qs[_0x42ea('0x35')](_0x456516['query'][_0x42ea('0x35')]));_0x4df249['attributes']=_0x4df249[_0x42ea('0x34')][_0x42ea('0x36')]?_0x4df249[_0x42ea('0x34')]:_0x1004df['model'];if(_0x456516[_0x42ea('0x30')][_0x42ea('0x3e')]){_0x4df249[_0x42ea('0x43')]=[{'all':!![]}];}_0x4df249=_['merge']({},_0x4df249,_0x456516[_0x42ea('0x3d')]);return db[_0x42ea('0x2b')]['find'](_0x4df249)[_0x42ea('0x24')](handleEntityNotFound(_0x2b8eef,null))[_0x42ea('0x24')](respondWithResult(_0x2b8eef,null))[_0x42ea('0x44')](handleError(_0x2b8eef,null));};exports[_0x42ea('0x45')]=function(_0x20942d,_0x36302d){return db[_0x42ea('0x2b')][_0x42ea('0x45')](_0x20942d['body'],{})[_0x42ea('0x24')](respondWithResult(_0x36302d,0xc9))[_0x42ea('0x44')](handleError(_0x36302d,null));};exports[_0x42ea('0x23')]=function(_0x59c6cb,_0x5923f5){if(_0x59c6cb[_0x42ea('0x46')]['id']){delete _0x59c6cb[_0x42ea('0x46')]['id'];}return db[_0x42ea('0x2b')][_0x42ea('0x47')]({'where':{'id':_0x59c6cb[_0x42ea('0x41')]['id']}})[_0x42ea('0x24')](handleEntityNotFound(_0x5923f5,null))[_0x42ea('0x24')](saveUpdates(_0x59c6cb[_0x42ea('0x46')],null))[_0x42ea('0x24')](respondWithResult(_0x5923f5,null))[_0x42ea('0x44')](handleError(_0x5923f5,null));};exports[_0x42ea('0x25')]=function(_0x94e94e,_0x58a048){return db[_0x42ea('0x2b')][_0x42ea('0x47')]({'where':{'id':_0x94e94e['params']['id']}})['then'](handleEntityNotFound(_0x58a048,null))[_0x42ea('0x24')](removeEntity(_0x58a048,null))['catch'](handleError(_0x58a048,null));};exports[_0x42ea('0x48')]=function(_0x95883f,_0x260e06,_0x3f7418){var _0x539a84={};var _0x4ba39f={};var _0xf88032;var _0x4a86d2;return db[_0x42ea('0x2b')][_0x42ea('0x49')]({'where':{'id':_0x95883f[_0x42ea('0x41')]['id']}})[_0x42ea('0x24')](handleEntityNotFound(_0x260e06,null))['then'](function(_0x50f88b){if(_0x50f88b){_0xf88032=_0x50f88b;_0x4ba39f['model']=_['keys'](db[_0x42ea('0x4a')][_0x42ea('0x42')]);_0x4ba39f[_0x42ea('0x30')]=_[_0x42ea('0x31')](_0x95883f['query']);_0x4ba39f[_0x42ea('0x32')]=_[_0x42ea('0x33')](_0x4ba39f[_0x42ea('0x2f')],_0x4ba39f[_0x42ea('0x30')]);_0x539a84[_0x42ea('0x34')]=_[_0x42ea('0x33')](_0x4ba39f['model'],qs['fields'](_0x95883f[_0x42ea('0x30')]['fields']));_0x539a84[_0x42ea('0x34')]=_0x539a84[_0x42ea('0x34')][_0x42ea('0x36')]?_0x539a84['attributes']:_0x4ba39f[_0x42ea('0x2f')];_0x539a84[_0x42ea('0x38')]=qs[_0x42ea('0x39')](_0x95883f[_0x42ea('0x30')][_0x42ea('0x39')]);_0x539a84[_0x42ea('0x3a')]=qs[_0x42ea('0x32')](_['pick'](_0x95883f[_0x42ea('0x30')],_0x4ba39f[_0x42ea('0x32')]));if(_0x95883f[_0x42ea('0x30')]['filter']){_0x539a84[_0x42ea('0x3a')]=_[_0x42ea('0x3c')](_0x539a84[_0x42ea('0x3a')],{'$or':_[_0x42ea('0x2a')](_0x539a84['attributes'],function(_0x1a3eed){var _0x5c03b7={};_0x5c03b7[_0x1a3eed]={'$like':'%'+_0x95883f[_0x42ea('0x30')]['filter']+'%'};return _0x5c03b7;})});}_0x539a84=_[_0x42ea('0x3c')]({},_0x539a84,_0x95883f[_0x42ea('0x3d')]);return _0xf88032[_0x42ea('0x48')](_0x539a84);}})['then'](function(_0x339e65){if(_0x339e65){_0x4a86d2=_0x339e65[_0x42ea('0x36')];if(!_0x95883f[_0x42ea('0x30')][_0x42ea('0x37')]('nolimit')){_0x539a84[_0x42ea('0x1f')]=qs[_0x42ea('0x1f')](_0x95883f[_0x42ea('0x30')][_0x42ea('0x1f')]);_0x539a84[_0x42ea('0x1c')]=qs['offset'](_0x95883f[_0x42ea('0x30')][_0x42ea('0x1c')]);}return _0xf88032[_0x42ea('0x48')](_0x539a84);}})[_0x42ea('0x24')](function(_0x4ff83e){if(_0x4ff83e){return _0x4ff83e?{'count':_0x4a86d2,'rows':_0x4ff83e}:null;}})[_0x42ea('0x24')](respondWithResult(_0x260e06,null))[_0x42ea('0x44')](handleError(_0x260e06,null));};exports['addConfiguration']=function(_0x202020,_0x45610c,_0x52df2d){if(_0x202020[_0x42ea('0x46')]['id']){delete _0x202020[_0x42ea('0x46')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x202020['params']['id']}})[_0x42ea('0x24')](handleEntityNotFound(_0x45610c,null))[_0x42ea('0x24')](function(_0x5c07b5){if(_0x5c07b5){_0x202020[_0x42ea('0x46')][_0x42ea('0x4b')]=_0x5c07b5['id'];_0x202020[_0x42ea('0x46')][_0x42ea('0x4c')]=integrations[_0x42ea('0x4d')](_0x202020['body']['channel'],_0x202020[_0x42ea('0x46')][_0x42ea('0x2d')]);_0x202020[_0x42ea('0x46')][_0x42ea('0x4e')]=integrations[_0x42ea('0x4f')](_0x202020[_0x42ea('0x46')][_0x42ea('0x50')],_0x202020[_0x42ea('0x46')][_0x42ea('0x2d')]);return db['VtigerConfiguration'][_0x42ea('0x45')](_0x202020[_0x42ea('0x46')],{'include':[{'model':db[_0x42ea('0x51')],'as':'Subjects'},{'model':db[_0x42ea('0x51')],'as':_0x42ea('0x4e')}]});}return null;})['then'](respondWithResult(_0x45610c,null))[_0x42ea('0x44')](handleError(_0x45610c,null));};var md5=require(_0x42ea('0x52'));exports['getFields']=function(_0x5debe5,_0x4eb113,_0x21e4ff){var _0x489de4=null;var _0x339fe5=null;var _0x26acbc=null;var _0x491251=null;var _0x58086d='';return db[_0x42ea('0x2b')][_0x42ea('0x49')]({'where':{'id':_0x5debe5['params']['id']},'attributes':['id','name',_0x42ea('0x53'),_0x42ea('0x54'),_0x42ea('0x55'),'remoteUri',_0x42ea('0x56'),_0x42ea('0x57')]})[_0x42ea('0x24')](handleEntityNotFound(_0x4eb113,null))[_0x42ea('0x24')](function(_0x55abcd){if(_0x55abcd){_0x489de4=_0x55abcd[_0x42ea('0x53')];_0x339fe5=_0x55abcd[_0x42ea('0x57')];_0x26acbc=_0x55abcd[_0x42ea('0x55')];_0x58086d=_0x55abcd['remoteUri'];var _0x2c579a=_0x58086d[_0x42ea('0x58')](-0x1);if(_0x2c579a==='/'){_0x58086d=_0x58086d['substring'](0x0,_0x58086d[_0x42ea('0x59')](_0x2c579a));}_0x491251=util[_0x42ea('0x5a')](_0x42ea('0x5b'),_0x58086d);var _0x559512={'method':_0x42ea('0x5c'),'uri':_0x491251,'qs':{'operation':_0x42ea('0x5d'),'username':_0x55abcd[_0x42ea('0x53')]},'json':!![]};return rp(_0x559512);}})['then'](function(_0x216a8f){if(_0x216a8f[_0x42ea('0x5e')]){var _0x1255f2={'method':_0x42ea('0x5f'),'uri':_0x491251,'form':{'operation':_0x42ea('0x60'),'username':_0x489de4,'accessKey':md5(_0x216a8f[_0x42ea('0x61')]['token']+_0x339fe5)},'json':!![]};return rp(_0x1255f2);}})[_0x42ea('0x24')](function(_0x1c30af){if(_0x1c30af[_0x42ea('0x5e')]){var _0xb4d629={'method':_0x42ea('0x5c'),'uri':_0x491251,'qs':{'operation':_0x42ea('0x62'),'username':_0x489de4,'sessionName':_0x1c30af[_0x42ea('0x61')][_0x42ea('0x63')],'elementType':_0x26acbc},'json':!![]};return rp(_0xb4d629);}})[_0x42ea('0x24')](function(_0x42eb3d){if(_0x42eb3d['success']){var _0x168496=[_0x42ea('0x64'),_0x42ea('0x65'),_0x42ea('0x66')];_['remove'](_0x42eb3d[_0x42ea('0x61')][_0x42ea('0x35')],function(_0x43c9ac){return _0x168496['includes'](_0x43c9ac[_0x42ea('0x2d')][_0x42ea('0x27')]);});_[_0x42ea('0x67')](_0x42eb3d[_0x42ea('0x61')][_0x42ea('0x35')],function(_0x8711ac){return _0x8711ac['editable']==='false';});return{'count':_0x42eb3d[_0x42ea('0x61')][_0x42ea('0x35')][_0x42ea('0x36')],'rows':_[_0x42ea('0x2a')](_0x42eb3d['result']['fields'],function(_0x2e45c2){return{'id':_0x2e45c2[_0x42ea('0x27')],'name':_0x2e45c2['label'],'custom':_[_0x42ea('0x68')](_0x2e45c2['name'],'cf_')?!![]:![],'options':_0x2e45c2[_0x42ea('0x2d')][_0x42ea('0x27')]===_0x42ea('0x69')&&_0x2e45c2[_0x42ea('0x2d')]['picklistValues'][_0x42ea('0x36')]>0x0?_['map'](_0x2e45c2['type']['picklistValues'],function(_0x14843f){return{'name':_0x14843f[_0x42ea('0x6a')],'value':_0x14843f[_0x42ea('0x6b')]};}):[]};})};}})[_0x42ea('0x24')](respondWithResult(_0x4eb113,null))[_0x42ea('0x44')](function(_0x213878){console['log'](_0x42ea('0x6c')+_0x213878);var _0x31a206=_0x5debe5['query']['test']?0x1f4:_0x213878['statusCode']||0x1f4;logger[_0x42ea('0x26')](_0x42ea('0x6d'),_0x42ea('0x6e'),_0x31a206,JSON[_0x42ea('0x6f')](_0x213878));delete _0x213878['name'];if(_0x31a206===0x191){_0x31a206=0x190;}_0x4eb113[_0x42ea('0x1a')](_0x31a206)[_0x42ea('0x28')](_0x5debe5['query']['test']?{'message':_0x42ea('0x70'),'statusCode':_0x213878[_0x42ea('0x71')]}:_0x213878);});}; \ No newline at end of file +var _0x8ba5=['options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','addConfiguration','Subjects','getSubjects','Descriptions','channel','VtigerField','getFields','username','description','remoteUri','serverUrl','accessKey','slice','lastIndexOf','GET','getchallenge','success','POST','login','result','token','describe','sessionName','reference','remove','includes','editable','false','label','picklist','picklistValues','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','map','VtigerAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x4b9806,_0x1517c0){var _0x12f4d4=function(_0x2f0984){while(--_0x2f0984){_0x4b9806['push'](_0x4b9806['shift']());}};_0x12f4d4(++_0x1517c0);}(_0x8ba5,0x19d));var _0x58ba=function(_0x21afd5,_0x57b9ba){_0x21afd5=_0x21afd5-0x0;var _0x59b71d=_0x8ba5[_0x21afd5];return _0x59b71d;};'use strict';var emlformat=require(_0x58ba('0x0'));var rimraf=require(_0x58ba('0x1'));var zipdir=require(_0x58ba('0x2'));var jsonpatch=require(_0x58ba('0x3'));var rp=require(_0x58ba('0x4'));var moment=require(_0x58ba('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x58ba('0x6'));var util=require('util');var path=require(_0x58ba('0x7'));var sox=require(_0x58ba('0x8'));var csv=require(_0x58ba('0x9'));var ejs=require(_0x58ba('0xa'));var fs=require('fs');var fs_extra=require(_0x58ba('0xb'));var _=require(_0x58ba('0xc'));var squel=require(_0x58ba('0xd'));var crypto=require('crypto');var jsforce=require(_0x58ba('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x58ba('0x9'));var querystring=require(_0x58ba('0xf'));var Papa=require(_0x58ba('0x10'));var Redis=require('ioredis');var authService=require(_0x58ba('0x11'));var qs=require(_0x58ba('0x12'));var as=require(_0x58ba('0x13'));var hardwareService=require(_0x58ba('0x14'));var logger=require(_0x58ba('0x15'))(_0x58ba('0x16'));var utils=require(_0x58ba('0x17'));var config=require(_0x58ba('0x18'));var licenseUtil=require(_0x58ba('0x19'));var db=require(_0x58ba('0x1a'))['db'];var integrations=require(_0x58ba('0x1b'));function respondWithStatusCode(_0x43feda,_0xcec613){_0xcec613=_0xcec613||0xcc;return function(_0x30cca9){if(_0x30cca9){return _0x43feda['sendStatus'](_0xcec613);}return _0x43feda['status'](_0xcec613)[_0x58ba('0x1c')]();};}function respondWithResult(_0x38e4bc,_0x4b1665){_0x4b1665=_0x4b1665||0xc8;return function(_0x1d7d96){if(_0x1d7d96){return _0x38e4bc['status'](_0x4b1665)[_0x58ba('0x1d')](_0x1d7d96);}};}function respondWithFilteredResult(_0x24c699,_0x3fd0a3){return function(_0x5d911d){if(_0x5d911d){var _0x54e938=typeof _0x3fd0a3[_0x58ba('0x1e')]==='undefined'&&typeof _0x3fd0a3['limit']===_0x58ba('0x1f');var _0x2395fd=_0x5d911d[_0x58ba('0x20')];var _0x4e6d80=_0x54e938?0x0:_0x3fd0a3[_0x58ba('0x1e')];var _0x2c174f=_0x54e938?_0x5d911d[_0x58ba('0x20')]:_0x3fd0a3[_0x58ba('0x1e')]+_0x3fd0a3['limit'];var _0x43eb56;if(_0x2c174f>=_0x2395fd){_0x2c174f=_0x2395fd;_0x43eb56=0xc8;}else{_0x43eb56=0xce;}_0x24c699[_0x58ba('0x21')](_0x43eb56);return _0x24c699[_0x58ba('0x22')](_0x58ba('0x23'),_0x4e6d80+'-'+_0x2c174f+'/'+_0x2395fd)[_0x58ba('0x1d')](_0x5d911d);}return null;};}function patchUpdates(_0x38ffd9){return function(_0x16873c){try{jsonpatch[_0x58ba('0x24')](_0x16873c,_0x38ffd9,!![]);}catch(_0x119011){return BPromise[_0x58ba('0x25')](_0x119011);}return _0x16873c[_0x58ba('0x26')]();};}function saveUpdates(_0x1eb40b,_0xf26af3){return function(_0x361ba0){if(_0x361ba0){return _0x361ba0[_0x58ba('0x27')](_0x1eb40b)['then'](function(_0x2e3ba0){return _0x2e3ba0;});}return null;};}function removeEntity(_0x417f70,_0x1a5733){return function(_0x3632f8){if(_0x3632f8){return _0x3632f8[_0x58ba('0x28')]()[_0x58ba('0x29')](function(){_0x417f70[_0x58ba('0x21')](0xcc)[_0x58ba('0x1c')]();});}};}function handleEntityNotFound(_0x5b7d6f,_0x5c41cb){return function(_0x5eeffe){if(!_0x5eeffe){_0x5b7d6f[_0x58ba('0x2a')](0x194);}return _0x5eeffe;};}function handleError(_0x1e5fe7,_0x968013){_0x968013=_0x968013||0x1f4;return function(_0x59608b){logger[_0x58ba('0x2b')](_0x59608b['stack']);if(_0x59608b[_0x58ba('0x2c')]){delete _0x59608b['name'];}_0x1e5fe7[_0x58ba('0x21')](_0x968013)[_0x58ba('0x2d')](_0x59608b);};}exports['index']=function(_0x2195e7,_0x50a620){var _0x5b3687={},_0x5b8c2e={},_0x13aad4={'count':0x0,'rows':[]};var _0xc3cf2f=_[_0x58ba('0x2e')](db[_0x58ba('0x2f')][_0x58ba('0x30')],function(_0x1635bf){return{'name':_0x1635bf['fieldName'],'type':_0x1635bf[_0x58ba('0x31')][_0x58ba('0x32')]};});_0x5b8c2e[_0x58ba('0x33')]=_['map'](_0xc3cf2f,_0x58ba('0x2c'));_0x5b8c2e[_0x58ba('0x34')]=_[_0x58ba('0x35')](_0x2195e7[_0x58ba('0x34')]);_0x5b8c2e[_0x58ba('0x36')]=_[_0x58ba('0x37')](_0x5b8c2e[_0x58ba('0x33')],_0x5b8c2e[_0x58ba('0x34')]);_0x5b3687[_0x58ba('0x38')]=_[_0x58ba('0x37')](_0x5b8c2e['model'],qs['fields'](_0x2195e7[_0x58ba('0x34')][_0x58ba('0x39')]));_0x5b3687[_0x58ba('0x38')]=_0x5b3687[_0x58ba('0x38')][_0x58ba('0x3a')]?_0x5b3687[_0x58ba('0x38')]:_0x5b8c2e[_0x58ba('0x33')];if(!_0x2195e7[_0x58ba('0x34')]['hasOwnProperty'](_0x58ba('0x3b'))){_0x5b3687[_0x58ba('0x3c')]=qs['limit'](_0x2195e7['query'][_0x58ba('0x3c')]);_0x5b3687[_0x58ba('0x1e')]=qs['offset'](_0x2195e7[_0x58ba('0x34')][_0x58ba('0x1e')]);}_0x5b3687['order']=qs['sort'](_0x2195e7[_0x58ba('0x34')][_0x58ba('0x3d')]);_0x5b3687[_0x58ba('0x3e')]=qs[_0x58ba('0x36')](_[_0x58ba('0x3f')](_0x2195e7[_0x58ba('0x34')],_0x5b8c2e['filters']),_0xc3cf2f);if(_0x2195e7[_0x58ba('0x34')][_0x58ba('0x40')]){_0x5b3687[_0x58ba('0x3e')]=_[_0x58ba('0x41')](_0x5b3687[_0x58ba('0x3e')],{'$or':_[_0x58ba('0x2e')](_0xc3cf2f,function(_0x18d73f){if(_0x18d73f[_0x58ba('0x31')]!==_0x58ba('0x42')){var _0x48564e={};_0x48564e[_0x18d73f[_0x58ba('0x2c')]]={'$like':'%'+_0x2195e7['query'][_0x58ba('0x40')]+'%'};return _0x48564e;}})});}_0x5b3687=_['merge']({},_0x5b3687,_0x2195e7[_0x58ba('0x43')]);var _0x34e24f={'where':_0x5b3687[_0x58ba('0x3e')]};return db[_0x58ba('0x2f')]['count'](_0x34e24f)[_0x58ba('0x29')](function(_0x3d3c3d){_0x13aad4[_0x58ba('0x20')]=_0x3d3c3d;if(_0x2195e7['query'][_0x58ba('0x44')]){_0x5b3687[_0x58ba('0x45')]=[{'all':!![]}];}return db['VtigerAccount'][_0x58ba('0x46')](_0x5b3687);})[_0x58ba('0x29')](function(_0x5e5f37){_0x13aad4[_0x58ba('0x47')]=_0x5e5f37;return _0x13aad4;})[_0x58ba('0x29')](respondWithFilteredResult(_0x50a620,_0x5b3687))[_0x58ba('0x48')](handleError(_0x50a620,null));};exports[_0x58ba('0x49')]=function(_0x31cc23,_0x47b14c){var _0x2ca4ea={'raw':![],'where':{'id':_0x31cc23[_0x58ba('0x4a')]['id']}},_0x204d80={};_0x204d80[_0x58ba('0x33')]=_['keys'](db[_0x58ba('0x2f')][_0x58ba('0x30')]);_0x204d80[_0x58ba('0x34')]=_['keys'](_0x31cc23[_0x58ba('0x34')]);_0x204d80[_0x58ba('0x36')]=_['intersection'](_0x204d80[_0x58ba('0x33')],_0x204d80[_0x58ba('0x34')]);_0x2ca4ea[_0x58ba('0x38')]=_[_0x58ba('0x37')](_0x204d80['model'],qs['fields'](_0x31cc23[_0x58ba('0x34')][_0x58ba('0x39')]));_0x2ca4ea[_0x58ba('0x38')]=_0x2ca4ea[_0x58ba('0x38')][_0x58ba('0x3a')]?_0x2ca4ea[_0x58ba('0x38')]:_0x204d80[_0x58ba('0x33')];if(_0x31cc23[_0x58ba('0x34')][_0x58ba('0x44')]){_0x2ca4ea[_0x58ba('0x45')]=[{'all':!![]}];}_0x2ca4ea=_[_0x58ba('0x41')]({},_0x2ca4ea,_0x31cc23[_0x58ba('0x43')]);return db[_0x58ba('0x2f')][_0x58ba('0x4b')](_0x2ca4ea)[_0x58ba('0x29')](handleEntityNotFound(_0x47b14c,null))['then'](respondWithResult(_0x47b14c,null))[_0x58ba('0x48')](handleError(_0x47b14c,null));};exports[_0x58ba('0x4c')]=function(_0x5eafc6,_0x1e3dcd){return db[_0x58ba('0x2f')][_0x58ba('0x4c')](_0x5eafc6[_0x58ba('0x4d')],{})[_0x58ba('0x29')](respondWithResult(_0x1e3dcd,0xc9))[_0x58ba('0x48')](handleError(_0x1e3dcd,null));};exports['update']=function(_0x5d50ec,_0x46b7b2){if(_0x5d50ec[_0x58ba('0x4d')]['id']){delete _0x5d50ec[_0x58ba('0x4d')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x5d50ec[_0x58ba('0x4a')]['id']}})[_0x58ba('0x29')](handleEntityNotFound(_0x46b7b2,null))['then'](saveUpdates(_0x5d50ec[_0x58ba('0x4d')],null))['then'](respondWithResult(_0x46b7b2,null))[_0x58ba('0x48')](handleError(_0x46b7b2,null));};exports['destroy']=function(_0x317d43,_0x1f08e3){return db[_0x58ba('0x2f')][_0x58ba('0x4b')]({'where':{'id':_0x317d43[_0x58ba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f08e3,null))[_0x58ba('0x29')](removeEntity(_0x1f08e3,null))[_0x58ba('0x48')](handleError(_0x1f08e3,null));};exports[_0x58ba('0x4e')]=function(_0x222df5,_0x4dc1fe,_0x1c0dcc){var _0x19bb89={};var _0x11a5cc={};var _0x21b0ab;var _0x3a0154;return db['VtigerAccount'][_0x58ba('0x4f')]({'where':{'id':_0x222df5[_0x58ba('0x4a')]['id']}})[_0x58ba('0x29')](handleEntityNotFound(_0x4dc1fe,null))['then'](function(_0x45e381){if(_0x45e381){_0x21b0ab=_0x45e381;_0x11a5cc[_0x58ba('0x33')]=_[_0x58ba('0x35')](db[_0x58ba('0x50')][_0x58ba('0x30')]);_0x11a5cc[_0x58ba('0x34')]=_[_0x58ba('0x35')](_0x222df5[_0x58ba('0x34')]);_0x11a5cc[_0x58ba('0x36')]=_[_0x58ba('0x37')](_0x11a5cc['model'],_0x11a5cc[_0x58ba('0x34')]);_0x19bb89[_0x58ba('0x38')]=_['intersection'](_0x11a5cc[_0x58ba('0x33')],qs[_0x58ba('0x39')](_0x222df5['query'][_0x58ba('0x39')]));_0x19bb89[_0x58ba('0x38')]=_0x19bb89['attributes'][_0x58ba('0x3a')]?_0x19bb89[_0x58ba('0x38')]:_0x11a5cc[_0x58ba('0x33')];_0x19bb89[_0x58ba('0x51')]=qs[_0x58ba('0x3d')](_0x222df5['query']['sort']);_0x19bb89['where']=qs[_0x58ba('0x36')](_[_0x58ba('0x3f')](_0x222df5[_0x58ba('0x34')],_0x11a5cc[_0x58ba('0x36')]));if(_0x222df5[_0x58ba('0x34')]['filter']){_0x19bb89[_0x58ba('0x3e')]=_['merge'](_0x19bb89['where'],{'$or':_[_0x58ba('0x2e')](_0x19bb89[_0x58ba('0x38')],function(_0x1d730c){var _0x168740={};_0x168740[_0x1d730c]={'$like':'%'+_0x222df5[_0x58ba('0x34')][_0x58ba('0x40')]+'%'};return _0x168740;})});}_0x19bb89=_['merge']({},_0x19bb89,_0x222df5['options']);return _0x21b0ab['getConfigurations'](_0x19bb89);}})[_0x58ba('0x29')](function(_0x1d64de){if(_0x1d64de){_0x3a0154=_0x1d64de[_0x58ba('0x3a')];if(!_0x222df5[_0x58ba('0x34')][_0x58ba('0x52')](_0x58ba('0x3b'))){_0x19bb89[_0x58ba('0x3c')]=qs[_0x58ba('0x3c')](_0x222df5[_0x58ba('0x34')]['limit']);_0x19bb89['offset']=qs[_0x58ba('0x1e')](_0x222df5[_0x58ba('0x34')][_0x58ba('0x1e')]);}return _0x21b0ab[_0x58ba('0x4e')](_0x19bb89);}})['then'](function(_0x543ba4){if(_0x543ba4){return _0x543ba4?{'count':_0x3a0154,'rows':_0x543ba4}:null;}})['then'](respondWithResult(_0x4dc1fe,null))[_0x58ba('0x48')](handleError(_0x4dc1fe,null));};exports[_0x58ba('0x53')]=function(_0x1eafb4,_0x30af0e,_0x41df73){if(_0x1eafb4['body']['id']){delete _0x1eafb4[_0x58ba('0x4d')]['id'];}return db[_0x58ba('0x2f')][_0x58ba('0x4f')]({'where':{'id':_0x1eafb4[_0x58ba('0x4a')]['id']}})[_0x58ba('0x29')](handleEntityNotFound(_0x30af0e,null))[_0x58ba('0x29')](function(_0x6d39ff){if(_0x6d39ff){_0x1eafb4[_0x58ba('0x4d')]['AccountId']=_0x6d39ff['id'];_0x1eafb4[_0x58ba('0x4d')][_0x58ba('0x54')]=integrations[_0x58ba('0x55')](_0x1eafb4[_0x58ba('0x4d')]['channel'],_0x1eafb4[_0x58ba('0x4d')][_0x58ba('0x31')]);_0x1eafb4[_0x58ba('0x4d')][_0x58ba('0x56')]=integrations['getDescriptions'](_0x1eafb4['body'][_0x58ba('0x57')],_0x1eafb4[_0x58ba('0x4d')][_0x58ba('0x31')]);return db[_0x58ba('0x50')][_0x58ba('0x4c')](_0x1eafb4['body'],{'include':[{'model':db[_0x58ba('0x58')],'as':_0x58ba('0x54')},{'model':db[_0x58ba('0x58')],'as':_0x58ba('0x56')}]});}return null;})[_0x58ba('0x29')](respondWithResult(_0x30af0e,null))[_0x58ba('0x48')](handleError(_0x30af0e,null));};var md5=require('md5');exports[_0x58ba('0x59')]=function(_0xd8c802,_0x30bf04,_0x11587a){var _0x30c6a3=null;var _0x15db76=null;var _0x2e2f8d=null;var _0x2ac804=null;var _0x23929b='';return db[_0x58ba('0x2f')]['findOne']({'where':{'id':_0xd8c802[_0x58ba('0x4a')]['id']},'attributes':['id',_0x58ba('0x2c'),_0x58ba('0x5a'),_0x58ba('0x5b'),'moduleName',_0x58ba('0x5c'),_0x58ba('0x5d'),_0x58ba('0x5e')]})[_0x58ba('0x29')](handleEntityNotFound(_0x30bf04,null))[_0x58ba('0x29')](function(_0x372ce9){if(_0x372ce9){_0x30c6a3=_0x372ce9['username'];_0x15db76=_0x372ce9[_0x58ba('0x5e')];_0x2e2f8d=_0x372ce9['moduleName'];_0x23929b=_0x372ce9[_0x58ba('0x5c')];var _0x536112=_0x23929b[_0x58ba('0x5f')](-0x1);if(_0x536112==='/'){_0x23929b=_0x23929b['substring'](0x0,_0x23929b[_0x58ba('0x60')](_0x536112));}_0x2ac804=util['format']('%s/webservice.php',_0x23929b);var _0xaa93a8={'method':_0x58ba('0x61'),'uri':_0x2ac804,'qs':{'operation':_0x58ba('0x62'),'username':_0x372ce9['username']},'json':!![]};return rp(_0xaa93a8);}})[_0x58ba('0x29')](function(_0x230ea0){if(_0x230ea0[_0x58ba('0x63')]){var _0x512f78={'method':_0x58ba('0x64'),'uri':_0x2ac804,'form':{'operation':_0x58ba('0x65'),'username':_0x30c6a3,'accessKey':md5(_0x230ea0[_0x58ba('0x66')][_0x58ba('0x67')]+_0x15db76)},'json':!![]};return rp(_0x512f78);}})[_0x58ba('0x29')](function(_0x5b8ef3){if(_0x5b8ef3[_0x58ba('0x63')]){var _0x4ee52a={'method':_0x58ba('0x61'),'uri':_0x2ac804,'qs':{'operation':_0x58ba('0x68'),'username':_0x30c6a3,'sessionName':_0x5b8ef3['result'][_0x58ba('0x69')],'elementType':_0x2e2f8d},'json':!![]};return rp(_0x4ee52a);}})[_0x58ba('0x29')](function(_0x11a7b3){if(_0x11a7b3[_0x58ba('0x63')]){var _0x1a593a=['autogenerated',_0x58ba('0x6a'),'owner'];_[_0x58ba('0x6b')](_0x11a7b3[_0x58ba('0x66')]['fields'],function(_0x3fd7b1){return _0x1a593a[_0x58ba('0x6c')](_0x3fd7b1['type'][_0x58ba('0x2c')]);});_[_0x58ba('0x6b')](_0x11a7b3[_0x58ba('0x66')]['fields'],function(_0x3e888f){return _0x3e888f[_0x58ba('0x6d')]===_0x58ba('0x6e');});return{'count':_0x11a7b3[_0x58ba('0x66')]['fields'][_0x58ba('0x3a')],'rows':_[_0x58ba('0x2e')](_0x11a7b3[_0x58ba('0x66')]['fields'],function(_0x3c7247){return{'id':_0x3c7247[_0x58ba('0x2c')],'name':_0x3c7247[_0x58ba('0x6f')],'custom':_['startsWith'](_0x3c7247[_0x58ba('0x2c')],'cf_')?!![]:![],'options':_0x3c7247[_0x58ba('0x31')][_0x58ba('0x2c')]===_0x58ba('0x70')&&_0x3c7247[_0x58ba('0x31')][_0x58ba('0x71')]['length']>0x0?_[_0x58ba('0x2e')](_0x3c7247[_0x58ba('0x31')][_0x58ba('0x71')],function(_0x2cf877){return{'name':_0x2cf877[_0x58ba('0x6f')],'value':_0x2cf877[_0x58ba('0x72')]};}):[]};})};}})[_0x58ba('0x29')](respondWithResult(_0x30bf04,null))[_0x58ba('0x48')](function(_0x284cba){console[_0x58ba('0x73')]('vTiger\x20error:\x20'+_0x284cba);var _0x4a9055=_0xd8c802[_0x58ba('0x34')]['test']?0x1f4:_0x284cba[_0x58ba('0x74')]||0x1f4;logger[_0x58ba('0x2b')](_0x58ba('0x75'),_0x58ba('0x59'),_0x4a9055,JSON['stringify'](_0x284cba));delete _0x284cba[_0x58ba('0x2c')];if(_0x4a9055===0x191){_0x4a9055=0x190;}_0x30bf04['status'](_0x4a9055)['send'](_0xd8c802[_0x58ba('0x34')][_0x58ba('0x76')]?{'message':_0x58ba('0x77'),'statusCode':_0x284cba['statusCode']}:_0x284cba);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e51abd3..982954a 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 _0x8a3a=['api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','lodash'];(function(_0x3a1337,_0x284388){var _0xd65bd4=function(_0x3de59e){while(--_0x3de59e){_0x3a1337['push'](_0x3a1337['shift']());}};_0xd65bd4(++_0x284388);}(_0x8a3a,0x18b));var _0xa8a3=function(_0x43b942,_0x4de494){_0x43b942=_0x43b942-0x0;var _0x214dd3=_0x8a3a[_0x43b942];return _0x214dd3;};'use strict';var _=require(_0xa8a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa8a3('0x1'));var moment=require('moment');var BPromise=require(_0xa8a3('0x2'));var rp=require(_0xa8a3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8a3('0x4'));var config=require(_0xa8a3('0x5'));var attributes=require(_0xa8a3('0x6'));var integrations=require(_0xa8a3('0x7'));module['exports']=function(_0x22e136,_0x1d5c34){return _0x22e136[_0xa8a3('0x8')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6bc=['moment','bluebird','rimraf','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd6bc,0x1a0));var _0xcd6b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd6bc[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xcd6b('0x0'));var util=require(_0xcd6b('0x1'));var logger=require(_0xcd6b('0x2'))(_0xcd6b('0x3'));var moment=require(_0xcd6b('0x4'));var BPromise=require(_0xcd6b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcd6b('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xcd6b('0x7'));module[_0xcd6b('0x8')]=function(_0x1b3272,_0x108abd){return _0x1b3272[_0xcd6b('0x9')](_0xcd6b('0xa'),attributes,{'tableName':_0xcd6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 829c03d..77e2f85 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 _0x57f8=['request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','where','attributes','include','model','map','debug','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2fc684,_0x39d381){var _0x960409=function(_0x317657){while(--_0x317657){_0x2fc684['push'](_0x2fc684['shift']());}};_0x960409(++_0x39d381);}(_0x57f8,0x198));var _0x857f=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0x57f8[_0x1ca890];return _0x3f8e01;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var moment=require(_0x857f('0x1'));var BPromise=require(_0x857f('0x2'));var rs=require(_0x857f('0x3'));var fs=require('fs');var Redis=require(_0x857f('0x4'));var db=require(_0x857f('0x5'))['db'];var utils=require(_0x857f('0x6'));var logger=require(_0x857f('0x7'))(_0x857f('0x8'));var config=require(_0x857f('0x9'));var jayson=require(_0x857f('0xa'));var client=jayson[_0x857f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8380e8,_0x197098,_0x1aaeea){return new BPromise(function(_0x577fc3,_0x5f6a66){return client[_0x857f('0xc')](_0x8380e8,_0x1aaeea)[_0x857f('0xd')](function(_0x4f2b09){logger[_0x857f('0xe')](_0x857f('0xf'),_0x197098,_0x857f('0x10'));logger['debug'](_0x857f('0x11'),_0x197098,_0x857f('0x10'),JSON[_0x857f('0x12')](_0x4f2b09));if(_0x4f2b09[_0x857f('0x13')]){if(_0x4f2b09[_0x857f('0x13')][_0x857f('0x14')]===0x1f4){logger[_0x857f('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x197098,_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);return _0x5f6a66(_0x4f2b09[_0x857f('0x13')][_0x857f('0x15')]);}logger[_0x857f('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x197098,_0x4f2b09['error'][_0x857f('0x15')]);return _0x577fc3(_0x4f2b09['error'][_0x857f('0x15')]);}else{logger['info'](_0x857f('0xf'),_0x197098,_0x857f('0x10'));_0x577fc3(_0x4f2b09['result'][_0x857f('0x15')]);}})[_0x857f('0x16')](function(_0xdf14fe){logger[_0x857f('0x13')](_0x857f('0xf'),_0x197098,_0xdf14fe);_0x5f6a66(_0xdf14fe);});});}exports[_0x857f('0x17')]=function(_0x1a9ef8){var _0x429e23=this;return new Promise(function(_0x1014ca,_0x38a242){return db[_0x857f('0x18')]['findAll']({'raw':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')][_0x857f('0x1a')]||null:null,'attributes':_0x1a9ef8['options']?_0x1a9ef8['options'][_0x857f('0x1b')]||null:null,'limit':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')]['limit']||null:null,'include':_0x1a9ef8[_0x857f('0x19')]?_0x1a9ef8[_0x857f('0x19')][_0x857f('0x1c')]?_['map'](_0x1a9ef8[_0x857f('0x19')][_0x857f('0x1c')],function(_0x50bfb7){return{'model':db[_0x50bfb7[_0x857f('0x1d')]],'as':_0x50bfb7['as'],'attributes':_0x50bfb7[_0x857f('0x1b')],'include':_0x50bfb7[_0x857f('0x1c')]?_[_0x857f('0x1e')](_0x50bfb7[_0x857f('0x1c')],function(_0x3b23a7){return{'model':db[_0x3b23a7[_0x857f('0x1d')]],'as':_0x3b23a7['as'],'attributes':_0x3b23a7[_0x857f('0x1b')],'include':_0x3b23a7[_0x857f('0x1c')]?_[_0x857f('0x1e')](_0x3b23a7[_0x857f('0x1c')],function(_0x4782ab){return{'model':db[_0x4782ab[_0x857f('0x1d')]],'as':_0x4782ab['as'],'attributes':_0x4782ab[_0x857f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17e415){logger[_0x857f('0xe')](_0x857f('0x17'),_0x1a9ef8);logger[_0x857f('0x1f')]('GetVtigerAccount',_0x1a9ef8,JSON[_0x857f('0x12')](_0x17e415));_0x1014ca(_0x17e415);})['catch'](function(_0x1b405a){logger[_0x857f('0x13')](_0x857f('0x17'),_0x1b405a[_0x857f('0x15')],_0x1a9ef8);_0x38a242(_0x429e23[_0x857f('0x13')](0x1f4,_0x1b405a[_0x857f('0x15')]));});});};exports[_0x857f('0x20')]=function(_0xe79241){var _0x17e7b6=this;return new Promise(function(_0x41f832,_0x24adc2){return db[_0x857f('0x18')][_0x857f('0x21')]({'raw':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x22')]===undefined?!![]:![]:!![],'where':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x1a')]||null:null,'attributes':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x1b')]||null:null,'include':_0xe79241['options']?_0xe79241[_0x857f('0x19')][_0x857f('0x1c')]?_[_0x857f('0x1e')](_0xe79241[_0x857f('0x19')]['include'],function(_0x596b2f){return{'model':db[_0x596b2f[_0x857f('0x1d')]],'as':_0x596b2f['as'],'attributes':_0x596b2f[_0x857f('0x1b')],'include':_0x596b2f['include']?_[_0x857f('0x1e')](_0x596b2f['include'],function(_0x1ff000){return{'model':db[_0x1ff000[_0x857f('0x1d')]],'as':_0x1ff000['as'],'attributes':_0x1ff000[_0x857f('0x1b')],'include':_0x1ff000[_0x857f('0x1c')]?_[_0x857f('0x1e')](_0x1ff000['include'],function(_0x47cfed){return{'model':db[_0x47cfed[_0x857f('0x1d')]],'as':_0x47cfed['as'],'attributes':_0x47cfed['attributes']};}):[]};}):[]};}):[]:[]})[_0x857f('0xd')](function(_0x227602){logger[_0x857f('0xe')]('ShowVtigerAccount',_0xe79241);logger[_0x857f('0x1f')](_0x857f('0x20'),_0xe79241,JSON[_0x857f('0x12')](_0x227602));_0x41f832(_0x227602);})[_0x857f('0x16')](function(_0x36e6bd){logger[_0x857f('0x13')](_0x857f('0x20'),_0x36e6bd['message'],_0xe79241);_0x24adc2(_0x17e7b6[_0x857f('0x13')](0x1f4,_0x36e6bd[_0x857f('0x15')]));});});}; \ No newline at end of file +var _0x1775=['stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','limit','map','include','model','ShowVtigerAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2c7253,_0x1311ab){var _0x262c5f=function(_0x50c306){while(--_0x50c306){_0x2c7253['push'](_0x2c7253['shift']());}};_0x262c5f(++_0x1311ab);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['findAll']({'raw':_0x1b4102[_0x5177('0x1c')]?_0x1b4102['options'][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1e')]||null:null,'attributes':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'limit':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x20')]||null:null,'include':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')]['include']?_[_0x5177('0x21')](_0x1b4102['options'][_0x5177('0x22')],function(_0x2c68d8){return{'model':db[_0x2c68d8[_0x5177('0x23')]],'as':_0x2c68d8['as'],'attributes':_0x2c68d8[_0x5177('0x1f')],'include':_0x2c68d8['include']?_[_0x5177('0x21')](_0x2c68d8['include'],function(_0x564139){return{'model':db[_0x564139[_0x5177('0x23')]],'as':_0x564139['as'],'attributes':_0x564139[_0x5177('0x1f')],'include':_0x564139['include']?_[_0x5177('0x21')](_0x564139['include'],function(_0x231d35){return{'model':db[_0x231d35[_0x5177('0x23')]],'as':_0x231d35['as'],'attributes':_0x231d35['attributes']};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x2554ec){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON['stringify'](_0x2554ec));_0x3e6944(_0x2554ec);})['catch'](function(_0x45cf20){logger[_0x5177('0x14')](_0x5177('0x1a'),_0x45cf20[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4[_0x5177('0x14')](0x1f4,_0x45cf20[_0x5177('0x17')]));});});};exports[_0x5177('0x24')]=function(_0x72dced){var _0x49f6f1=this;return new Promise(function(_0x42e1db,_0x2233a2){return db['VtigerAccount'][_0x5177('0x25')]({'raw':_0x72dced['options']?_0x72dced[_0x5177('0x1c')][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x72dced[_0x5177('0x1c')]?_0x72dced['options']['where']||null:null,'attributes':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'include':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x22')]?_[_0x5177('0x21')](_0x72dced[_0x5177('0x1c')]['include'],function(_0x459ac6){return{'model':db[_0x459ac6[_0x5177('0x23')]],'as':_0x459ac6['as'],'attributes':_0x459ac6['attributes'],'include':_0x459ac6[_0x5177('0x22')]?_[_0x5177('0x21')](_0x459ac6[_0x5177('0x22')],function(_0x8727c6){return{'model':db[_0x8727c6[_0x5177('0x23')]],'as':_0x8727c6['as'],'attributes':_0x8727c6[_0x5177('0x1f')],'include':_0x8727c6['include']?_[_0x5177('0x21')](_0x8727c6[_0x5177('0x22')],function(_0x28b1d5){return{'model':db[_0x28b1d5[_0x5177('0x23')]],'as':_0x28b1d5['as'],'attributes':_0x28b1d5[_0x5177('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x1bb1e3){logger['info'](_0x5177('0x24'),_0x72dced);logger[_0x5177('0x10')]('ShowVtigerAccount',_0x72dced,JSON['stringify'](_0x1bb1e3));_0x42e1db(_0x1bb1e3);})[_0x5177('0x19')](function(_0x188cec){logger[_0x5177('0x14')](_0x5177('0x24'),_0x188cec[_0x5177('0x17')],_0x72dced);_0x2233a2(_0x49f6f1[_0x5177('0x14')](0x1f4,_0x188cec[_0x5177('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3b4967c..c8be0da 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 _0xbfb9=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','show','get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','delete','destroy','util','path'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xbfb9,0x16e));var _0x9bfb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbfb9[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x9bfb('0x0'));var path=require(_0x9bfb('0x1'));var timeout=require('connect-timeout');var express=require(_0x9bfb('0x2'));var router=express[_0x9bfb('0x3')]();var fs_extra=require(_0x9bfb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9bfb('0x5'));var config=require(_0x9bfb('0x6'));var controller=require(_0x9bfb('0x7'));router['get']('/',auth[_0x9bfb('0x8')](),controller[_0x9bfb('0x9')]);router['get']('/:id',auth[_0x9bfb('0x8')](),controller[_0x9bfb('0xa')]);router[_0x9bfb('0xb')](_0x9bfb('0xc'),auth[_0x9bfb('0x8')](),controller['getFields']);router[_0x9bfb('0xb')](_0x9bfb('0xd'),auth[_0x9bfb('0x8')](),controller[_0x9bfb('0xe')]);router[_0x9bfb('0xb')](_0x9bfb('0xf'),auth[_0x9bfb('0x8')](),controller['getDescriptions']);router[_0x9bfb('0x10')]('/',auth['isAuthenticated'](),controller[_0x9bfb('0x11')]);router[_0x9bfb('0x12')](_0x9bfb('0x13'),auth[_0x9bfb('0x8')](),controller[_0x9bfb('0x14')]);router[_0x9bfb('0x15')](_0x9bfb('0x13'),auth[_0x9bfb('0x8')](),controller[_0x9bfb('0x16')]);module['exports']=router; \ No newline at end of file +var _0x99e6=['../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','multer','path','connect-timeout','express','fs-extra'];(function(_0x155839,_0x3f679d){var _0x51d322=function(_0xf96e28){while(--_0xf96e28){_0x155839['push'](_0x155839['shift']());}};_0x51d322(++_0x3f679d);}(_0x99e6,0xdf));var _0x699e=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x99e6[_0x34eb31];return _0x254994;};'use strict';var multer=require(_0x699e('0x0'));var util=require('util');var path=require(_0x699e('0x1'));var timeout=require(_0x699e('0x2'));var express=require(_0x699e('0x3'));var router=express['Router']();var fs_extra=require(_0x699e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x699e('0x5'));var config=require('../../config/environment');var controller=require(_0x699e('0x6'));router[_0x699e('0x7')]('/',auth[_0x699e('0x8')](),controller[_0x699e('0x9')]);router[_0x699e('0x7')](_0x699e('0xa'),auth[_0x699e('0x8')](),controller['show']);router[_0x699e('0x7')]('/:id/fields',auth[_0x699e('0x8')](),controller['getFields']);router[_0x699e('0x7')](_0x699e('0xb'),auth[_0x699e('0x8')](),controller[_0x699e('0xc')]);router[_0x699e('0x7')](_0x699e('0xd'),auth[_0x699e('0x8')](),controller[_0x699e('0xe')]);router['post']('/',auth[_0x699e('0x8')](),controller[_0x699e('0xf')]);router[_0x699e('0x10')](_0x699e('0xa'),auth[_0x699e('0x8')](),controller[_0x699e('0x11')]);router['delete']('/:id',auth[_0x699e('0x8')](),controller[_0x699e('0x12')]);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 8cf1671..b910c79 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 _0x0b10=['sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0b10,0x1e9));var _0x00b1=function(_0xf1fbbc,_0xa67f9a){_0xf1fbbc=_0xf1fbbc-0x0;var _0x2a20b7=_0x0b10[_0xf1fbbc];return _0x2a20b7;};'use strict';var Sequelize=require(_0x00b1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdb97=['STRING','sequelize'];(function(_0x57d6f6,_0x17da89){var _0x360a5b=function(_0x3d54b0){while(--_0x3d54b0){_0x57d6f6['push'](_0x57d6f6['shift']());}};_0x360a5b(++_0x17da89);}(_0xdb97,0x19b));var _0x7db9=function(_0xd0a565,_0x1ac7cb){_0xd0a565=_0xd0a565-0x0;var _0x32a0e4=_0xdb97[_0xd0a565];return _0x32a0e4;};'use strict';var Sequelize=require(_0x7db9('0x0'));module['exports']={'name':{'type':Sequelize[_0x7db9('0x1')]},'description':{'type':Sequelize[_0x7db9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 1b494eb..5021755 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 _0xb5ed=['key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','VtigerConfiguration','findAll','rows','show','params','fields','catch','create','body','find','getFields','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xb5ed,0x1a4));var _0xdb5e=function(_0x46656f,_0x33c326){_0x46656f=_0x46656f-0x0;var _0x1bdb73=_0xb5ed[_0x46656f];return _0x1bdb73;};'use strict';var emlformat=require(_0xdb5e('0x0'));var rimraf=require(_0xdb5e('0x1'));var zipdir=require(_0xdb5e('0x2'));var jsonpatch=require(_0xdb5e('0x3'));var rp=require('request-promise');var moment=require(_0xdb5e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdb5e('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdb5e('0x6'));var ejs=require(_0xdb5e('0x7'));var fs=require('fs');var fs_extra=require(_0xdb5e('0x8'));var _=require(_0xdb5e('0x9'));var squel=require(_0xdb5e('0xa'));var crypto=require(_0xdb5e('0xb'));var jsforce=require(_0xdb5e('0xc'));var deskjs=require(_0xdb5e('0xd'));var toCsv=require(_0xdb5e('0x6'));var querystring=require(_0xdb5e('0xe'));var Papa=require(_0xdb5e('0xf'));var Redis=require(_0xdb5e('0x10'));var authService=require(_0xdb5e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdb5e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb5e('0x13'));var utils=require(_0xdb5e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a81f,_0x19af5b){_0x19af5b=_0x19af5b||0xcc;return function(_0x53528a){if(_0x53528a){return _0x15a81f[_0xdb5e('0x15')](_0x19af5b);}return _0x15a81f[_0xdb5e('0x16')](_0x19af5b)[_0xdb5e('0x17')]();};}function respondWithResult(_0x219f19,_0x5454c9){_0x5454c9=_0x5454c9||0xc8;return function(_0x415387){if(_0x415387){return _0x219f19[_0xdb5e('0x16')](_0x5454c9)['json'](_0x415387);}};}function respondWithFilteredResult(_0x21cc18,_0x4f29c0){return function(_0x444cb9){if(_0x444cb9){var _0x5d1588=typeof _0x4f29c0[_0xdb5e('0x18')]==='undefined'&&typeof _0x4f29c0[_0xdb5e('0x19')]===_0xdb5e('0x1a');var _0x33c9bb=_0x444cb9[_0xdb5e('0x1b')];var _0x117dda=_0x5d1588?0x0:_0x4f29c0[_0xdb5e('0x18')];var _0x2b27ba=_0x5d1588?_0x444cb9[_0xdb5e('0x1b')]:_0x4f29c0['offset']+_0x4f29c0[_0xdb5e('0x19')];var _0x3cf173;if(_0x2b27ba>=_0x33c9bb){_0x2b27ba=_0x33c9bb;_0x3cf173=0xc8;}else{_0x3cf173=0xce;}_0x21cc18['status'](_0x3cf173);return _0x21cc18['set'](_0xdb5e('0x1c'),_0x117dda+'-'+_0x2b27ba+'/'+_0x33c9bb)['json'](_0x444cb9);}return null;};}function patchUpdates(_0x4ba613){return function(_0x4c4b28){try{jsonpatch[_0xdb5e('0x1d')](_0x4c4b28,_0x4ba613,!![]);}catch(_0x1fc4fb){return BPromise[_0xdb5e('0x1e')](_0x1fc4fb);}return _0x4c4b28[_0xdb5e('0x1f')]();};}function saveUpdates(_0x24591d,_0x2734a8){return function(_0x2f7a57){if(_0x2f7a57){return _0x2f7a57[_0xdb5e('0x20')](_0x24591d)[_0xdb5e('0x21')](function(_0x478954){return _0x478954;});}return null;};}function removeEntity(_0x2f08cb,_0x197c56){return function(_0x56b123){if(_0x56b123){return _0x56b123[_0xdb5e('0x22')]()[_0xdb5e('0x21')](function(){_0x2f08cb[_0xdb5e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58ce6c,_0x488819){return function(_0x362ddd){if(!_0x362ddd){_0x58ce6c['sendStatus'](0x194);}return _0x362ddd;};}function handleError(_0x4c239f,_0x5b2cbb){_0x5b2cbb=_0x5b2cbb||0x1f4;return function(_0x4f9f03){logger[_0xdb5e('0x23')](_0x4f9f03[_0xdb5e('0x24')]);if(_0x4f9f03['name']){delete _0x4f9f03[_0xdb5e('0x25')];}_0x4c239f[_0xdb5e('0x16')](_0x5b2cbb)[_0xdb5e('0x26')](_0x4f9f03);};}exports[_0xdb5e('0x27')]=function(_0x227a4e,_0x27f1db){var _0x465b76={},_0x145076={},_0xf7695c={'count':0x0,'rows':[]};var _0x358c89=_[_0xdb5e('0x28')](db['VtigerConfiguration'][_0xdb5e('0x29')],function(_0x29c9ed){return{'name':_0x29c9ed['fieldName'],'type':_0x29c9ed['type'][_0xdb5e('0x2a')]};});_0x145076[_0xdb5e('0x2b')]=_[_0xdb5e('0x28')](_0x358c89,_0xdb5e('0x25'));_0x145076[_0xdb5e('0x2c')]=_[_0xdb5e('0x2d')](_0x227a4e[_0xdb5e('0x2c')]);_0x145076[_0xdb5e('0x2e')]=_['intersection'](_0x145076[_0xdb5e('0x2b')],_0x145076[_0xdb5e('0x2c')]);_0x465b76[_0xdb5e('0x2f')]=_[_0xdb5e('0x30')](_0x145076[_0xdb5e('0x2b')],qs['fields'](_0x227a4e[_0xdb5e('0x2c')]['fields']));_0x465b76[_0xdb5e('0x2f')]=_0x465b76[_0xdb5e('0x2f')][_0xdb5e('0x31')]?_0x465b76[_0xdb5e('0x2f')]:_0x145076[_0xdb5e('0x2b')];if(!_0x227a4e[_0xdb5e('0x2c')][_0xdb5e('0x32')](_0xdb5e('0x33'))){_0x465b76[_0xdb5e('0x19')]=qs['limit'](_0x227a4e['query']['limit']);_0x465b76[_0xdb5e('0x18')]=qs[_0xdb5e('0x18')](_0x227a4e[_0xdb5e('0x2c')][_0xdb5e('0x18')]);}_0x465b76[_0xdb5e('0x34')]=qs[_0xdb5e('0x35')](_0x227a4e['query']['sort']);_0x465b76['where']=qs[_0xdb5e('0x2e')](_[_0xdb5e('0x36')](_0x227a4e[_0xdb5e('0x2c')],_0x145076[_0xdb5e('0x2e')]),_0x358c89);if(_0x227a4e[_0xdb5e('0x2c')][_0xdb5e('0x37')]){_0x465b76[_0xdb5e('0x38')]=_['merge'](_0x465b76['where'],{'$or':_[_0xdb5e('0x28')](_0x358c89,function(_0x4972c3){if(_0x4972c3[_0xdb5e('0x39')]!==_0xdb5e('0x3a')){var _0x18fe2b={};_0x18fe2b[_0x4972c3['name']]={'$like':'%'+_0x227a4e[_0xdb5e('0x2c')]['filter']+'%'};return _0x18fe2b;}})});}_0x465b76=_[_0xdb5e('0x3b')]({},_0x465b76,_0x227a4e[_0xdb5e('0x3c')]);var _0x532d95={'where':_0x465b76[_0xdb5e('0x38')]};return db['VtigerConfiguration'][_0xdb5e('0x1b')](_0x532d95)[_0xdb5e('0x21')](function(_0x5e1c92){_0xf7695c['count']=_0x5e1c92;if(_0x227a4e['query'][_0xdb5e('0x3d')]){_0x465b76[_0xdb5e('0x3e')]=[{'all':!![]}];}return db[_0xdb5e('0x3f')][_0xdb5e('0x40')](_0x465b76);})['then'](function(_0x36d4d8){_0xf7695c[_0xdb5e('0x41')]=_0x36d4d8;return _0xf7695c;})[_0xdb5e('0x21')](respondWithFilteredResult(_0x27f1db,_0x465b76))['catch'](handleError(_0x27f1db,null));};exports[_0xdb5e('0x42')]=function(_0x4b176f,_0x47a724){var _0x6f150e={'raw':![],'where':{'id':_0x4b176f[_0xdb5e('0x43')]['id']}},_0x1176c5={};_0x1176c5[_0xdb5e('0x2b')]=_[_0xdb5e('0x2d')](db[_0xdb5e('0x3f')][_0xdb5e('0x29')]);_0x1176c5[_0xdb5e('0x2c')]=_['keys'](_0x4b176f[_0xdb5e('0x2c')]);_0x1176c5[_0xdb5e('0x2e')]=_[_0xdb5e('0x30')](_0x1176c5[_0xdb5e('0x2b')],_0x1176c5[_0xdb5e('0x2c')]);_0x6f150e[_0xdb5e('0x2f')]=_[_0xdb5e('0x30')](_0x1176c5[_0xdb5e('0x2b')],qs[_0xdb5e('0x44')](_0x4b176f[_0xdb5e('0x2c')]['fields']));_0x6f150e[_0xdb5e('0x2f')]=_0x6f150e[_0xdb5e('0x2f')]['length']?_0x6f150e['attributes']:_0x1176c5['model'];if(_0x4b176f[_0xdb5e('0x2c')][_0xdb5e('0x3d')]){_0x6f150e[_0xdb5e('0x3e')]=[{'all':!![]}];}_0x6f150e=_[_0xdb5e('0x3b')]({},_0x6f150e,_0x4b176f[_0xdb5e('0x3c')]);return db[_0xdb5e('0x3f')]['find'](_0x6f150e)[_0xdb5e('0x21')](handleEntityNotFound(_0x47a724,null))[_0xdb5e('0x21')](respondWithResult(_0x47a724,null))[_0xdb5e('0x45')](handleError(_0x47a724,null));};exports[_0xdb5e('0x46')]=function(_0x10a1dd,_0x20b209){return db['VtigerConfiguration'][_0xdb5e('0x46')](_0x10a1dd[_0xdb5e('0x47')],{})[_0xdb5e('0x21')](respondWithResult(_0x20b209,0xc9))['catch'](handleError(_0x20b209,null));};exports['update']=function(_0xe6987,_0x3ed847){if(_0xe6987[_0xdb5e('0x47')]['id']){delete _0xe6987[_0xdb5e('0x47')]['id'];}return db[_0xdb5e('0x3f')][_0xdb5e('0x48')]({'where':{'id':_0xe6987[_0xdb5e('0x43')]['id']}})[_0xdb5e('0x21')](handleEntityNotFound(_0x3ed847,null))[_0xdb5e('0x21')](saveUpdates(_0xe6987[_0xdb5e('0x47')],null))[_0xdb5e('0x21')](respondWithResult(_0x3ed847,null))['catch'](handleError(_0x3ed847,null));};exports['destroy']=function(_0x144530,_0x17a33c){return db[_0xdb5e('0x3f')][_0xdb5e('0x48')]({'where':{'id':_0x144530[_0xdb5e('0x43')]['id']}})[_0xdb5e('0x21')](handleEntityNotFound(_0x17a33c,null))[_0xdb5e('0x21')](removeEntity(_0x17a33c,null))[_0xdb5e('0x45')](handleError(_0x17a33c,null));};exports[_0xdb5e('0x49')]=function(_0x34a74e,_0x5eeee2,_0x273465){var _0x18cfa2={};var _0x47bdf6={};var _0xb0d273;var _0x3aa1a1;return db[_0xdb5e('0x3f')][_0xdb5e('0x4a')]({'where':{'id':_0x34a74e[_0xdb5e('0x43')]['id']}})[_0xdb5e('0x21')](handleEntityNotFound(_0x5eeee2,null))[_0xdb5e('0x21')](function(_0x29c0ce){if(_0x29c0ce){_0xb0d273=_0x29c0ce;_0x47bdf6[_0xdb5e('0x2b')]=_[_0xdb5e('0x2d')](db['VtigerField'][_0xdb5e('0x29')]);_0x47bdf6[_0xdb5e('0x2c')]=_[_0xdb5e('0x2d')](_0x34a74e[_0xdb5e('0x2c')]);_0x47bdf6[_0xdb5e('0x2e')]=_['intersection'](_0x47bdf6[_0xdb5e('0x2b')],_0x47bdf6[_0xdb5e('0x2c')]);_0x18cfa2[_0xdb5e('0x2f')]=_[_0xdb5e('0x30')](_0x47bdf6[_0xdb5e('0x2b')],qs[_0xdb5e('0x44')](_0x34a74e['query']['fields']));_0x18cfa2['attributes']=_0x18cfa2[_0xdb5e('0x2f')][_0xdb5e('0x31')]?_0x18cfa2[_0xdb5e('0x2f')]:_0x47bdf6[_0xdb5e('0x2b')];_0x18cfa2[_0xdb5e('0x34')]=qs[_0xdb5e('0x35')](_0x34a74e[_0xdb5e('0x2c')]['sort']);_0x18cfa2['where']=qs[_0xdb5e('0x2e')](_[_0xdb5e('0x36')](_0x34a74e[_0xdb5e('0x2c')],_0x47bdf6['filters']));if(_0x34a74e[_0xdb5e('0x2c')][_0xdb5e('0x37')]){_0x18cfa2[_0xdb5e('0x38')]=_[_0xdb5e('0x3b')](_0x18cfa2[_0xdb5e('0x38')],{'$or':_[_0xdb5e('0x28')](_0x18cfa2['attributes'],function(_0x4a32c0){var _0x84ec96={};_0x84ec96[_0x4a32c0]={'$like':'%'+_0x34a74e[_0xdb5e('0x2c')][_0xdb5e('0x37')]+'%'};return _0x84ec96;})});}_0x18cfa2=_[_0xdb5e('0x3b')]({},_0x18cfa2,_0x34a74e[_0xdb5e('0x3c')]);return _0xb0d273['getFields'](_0x18cfa2);}})[_0xdb5e('0x21')](function(_0x4ec802){if(_0x4ec802){_0x3aa1a1=_0x4ec802[_0xdb5e('0x31')];if(!_0x34a74e[_0xdb5e('0x2c')][_0xdb5e('0x32')](_0xdb5e('0x33'))){_0x18cfa2['limit']=qs['limit'](_0x34a74e['query'][_0xdb5e('0x19')]);_0x18cfa2[_0xdb5e('0x18')]=qs['offset'](_0x34a74e[_0xdb5e('0x2c')][_0xdb5e('0x18')]);}return _0xb0d273[_0xdb5e('0x49')](_0x18cfa2);}})[_0xdb5e('0x21')](function(_0x23048a){if(_0x23048a){return _0x23048a?{'count':_0x3aa1a1,'rows':_0x23048a}:null;}})[_0xdb5e('0x21')](respondWithResult(_0x5eeee2,null))[_0xdb5e('0x45')](handleError(_0x5eeee2,null));};exports['getSubjects']=function(_0x197850,_0x8b4276,_0x191873){var _0x470a67={};var _0x25c084={};var _0x200893;var _0x3feecc;return db['VtigerConfiguration'][_0xdb5e('0x4a')]({'where':{'id':_0x197850['params']['id']}})[_0xdb5e('0x21')](handleEntityNotFound(_0x8b4276,null))[_0xdb5e('0x21')](function(_0x2df565){if(_0x2df565){_0x200893=_0x2df565;_0x25c084[_0xdb5e('0x2b')]=_['keys'](db['VtigerField'][_0xdb5e('0x29')]);_0x25c084['query']=_['keys'](_0x197850[_0xdb5e('0x2c')]);_0x25c084[_0xdb5e('0x2e')]=_['intersection'](_0x25c084[_0xdb5e('0x2b')],_0x25c084[_0xdb5e('0x2c')]);_0x470a67[_0xdb5e('0x2f')]=_[_0xdb5e('0x30')](_0x25c084['model'],qs['fields'](_0x197850[_0xdb5e('0x2c')][_0xdb5e('0x44')]));_0x470a67[_0xdb5e('0x2f')]=_0x470a67[_0xdb5e('0x2f')][_0xdb5e('0x31')]?_0x470a67[_0xdb5e('0x2f')]:_0x25c084[_0xdb5e('0x2b')];_0x470a67[_0xdb5e('0x34')]=qs['sort'](_0x197850[_0xdb5e('0x2c')][_0xdb5e('0x35')]);_0x470a67[_0xdb5e('0x38')]=qs[_0xdb5e('0x2e')](_[_0xdb5e('0x36')](_0x197850[_0xdb5e('0x2c')],_0x25c084[_0xdb5e('0x2e')]));if(_0x197850[_0xdb5e('0x2c')][_0xdb5e('0x37')]){_0x470a67[_0xdb5e('0x38')]=_[_0xdb5e('0x3b')](_0x470a67['where'],{'$or':_[_0xdb5e('0x28')](_0x470a67[_0xdb5e('0x2f')],function(_0x53398){var _0x1ca012={};_0x1ca012[_0x53398]={'$like':'%'+_0x197850[_0xdb5e('0x2c')][_0xdb5e('0x37')]+'%'};return _0x1ca012;})});}_0x470a67=_[_0xdb5e('0x3b')]({},_0x470a67,_0x197850[_0xdb5e('0x3c')]);return _0x200893[_0xdb5e('0x4b')](_0x470a67);}})['then'](function(_0x1585f5){if(_0x1585f5){_0x3feecc=_0x1585f5[_0xdb5e('0x31')];if(!_0x197850[_0xdb5e('0x2c')][_0xdb5e('0x32')]('nolimit')){_0x470a67[_0xdb5e('0x19')]=qs[_0xdb5e('0x19')](_0x197850[_0xdb5e('0x2c')]['limit']);_0x470a67[_0xdb5e('0x18')]=qs[_0xdb5e('0x18')](_0x197850['query'][_0xdb5e('0x18')]);}return _0x200893[_0xdb5e('0x4b')](_0x470a67);}})[_0xdb5e('0x21')](function(_0x40ec4d){if(_0x40ec4d){return _0x40ec4d?{'count':_0x3feecc,'rows':_0x40ec4d}:null;}})['then'](respondWithResult(_0x8b4276,null))[_0xdb5e('0x45')](handleError(_0x8b4276,null));};exports[_0xdb5e('0x4c')]=function(_0x55a133,_0x1511c6,_0x3052aa){var _0x654ecc={};var _0x1ccf14={};var _0x32648b;var _0x2fd646;return db[_0xdb5e('0x3f')]['findOne']({'where':{'id':_0x55a133[_0xdb5e('0x43')]['id']}})[_0xdb5e('0x21')](handleEntityNotFound(_0x1511c6,null))[_0xdb5e('0x21')](function(_0x166622){if(_0x166622){_0x32648b=_0x166622;_0x1ccf14[_0xdb5e('0x2b')]=_[_0xdb5e('0x2d')](db['VtigerField']['rawAttributes']);_0x1ccf14[_0xdb5e('0x2c')]=_[_0xdb5e('0x2d')](_0x55a133[_0xdb5e('0x2c')]);_0x1ccf14[_0xdb5e('0x2e')]=_[_0xdb5e('0x30')](_0x1ccf14[_0xdb5e('0x2b')],_0x1ccf14[_0xdb5e('0x2c')]);_0x654ecc[_0xdb5e('0x2f')]=_[_0xdb5e('0x30')](_0x1ccf14['model'],qs[_0xdb5e('0x44')](_0x55a133[_0xdb5e('0x2c')][_0xdb5e('0x44')]));_0x654ecc[_0xdb5e('0x2f')]=_0x654ecc[_0xdb5e('0x2f')][_0xdb5e('0x31')]?_0x654ecc[_0xdb5e('0x2f')]:_0x1ccf14[_0xdb5e('0x2b')];_0x654ecc['order']=qs[_0xdb5e('0x35')](_0x55a133[_0xdb5e('0x2c')][_0xdb5e('0x35')]);_0x654ecc[_0xdb5e('0x38')]=qs[_0xdb5e('0x2e')](_['pick'](_0x55a133[_0xdb5e('0x2c')],_0x1ccf14['filters']));if(_0x55a133[_0xdb5e('0x2c')][_0xdb5e('0x37')]){_0x654ecc[_0xdb5e('0x38')]=_['merge'](_0x654ecc['where'],{'$or':_[_0xdb5e('0x28')](_0x654ecc[_0xdb5e('0x2f')],function(_0x1cb68a){var _0x2beeca={};_0x2beeca[_0x1cb68a]={'$like':'%'+_0x55a133[_0xdb5e('0x2c')][_0xdb5e('0x37')]+'%'};return _0x2beeca;})});}_0x654ecc=_[_0xdb5e('0x3b')]({},_0x654ecc,_0x55a133[_0xdb5e('0x3c')]);return _0x32648b[_0xdb5e('0x4c')](_0x654ecc);}})[_0xdb5e('0x21')](function(_0x16d69c){if(_0x16d69c){_0x2fd646=_0x16d69c['length'];if(!_0x55a133['query'][_0xdb5e('0x32')](_0xdb5e('0x33'))){_0x654ecc['limit']=qs[_0xdb5e('0x19')](_0x55a133[_0xdb5e('0x2c')][_0xdb5e('0x19')]);_0x654ecc['offset']=qs[_0xdb5e('0x18')](_0x55a133[_0xdb5e('0x2c')][_0xdb5e('0x18')]);}return _0x32648b[_0xdb5e('0x4c')](_0x654ecc);}})['then'](function(_0x5dabd5){if(_0x5dabd5){return _0x5dabd5?{'count':_0x2fd646,'rows':_0x5dabd5}:null;}})[_0xdb5e('0x21')](respondWithResult(_0x1511c6,null))[_0xdb5e('0x45')](handleError(_0x1511c6,null));}; \ No newline at end of file +var _0x09b2=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','update','then','destroy','error','stack','name','index','map','VtigerConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','VtigerField','sort','pick','hasOwnProperty','getSubjects','nolimit','getDescriptions','rawAttributes'];(function(_0x24c9ff,_0x3347df){var _0x4c3714=function(_0x6317d0){while(--_0x6317d0){_0x24c9ff['push'](_0x24c9ff['shift']());}};_0x4c3714(++_0x3347df);}(_0x09b2,0x150));var _0x209b=function(_0x4e22ed,_0x474f9e){_0x4e22ed=_0x4e22ed-0x0;var _0x5a953f=_0x09b2[_0x4e22ed];return _0x5a953f;};'use strict';var emlformat=require(_0x209b('0x0'));var rimraf=require(_0x209b('0x1'));var zipdir=require(_0x209b('0x2'));var jsonpatch=require(_0x209b('0x3'));var rp=require('request-promise');var moment=require(_0x209b('0x4'));var BPromise=require(_0x209b('0x5'));var Mustache=require(_0x209b('0x6'));var util=require(_0x209b('0x7'));var path=require(_0x209b('0x8'));var sox=require(_0x209b('0x9'));var csv=require(_0x209b('0xa'));var ejs=require(_0x209b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x209b('0xc'));var squel=require(_0x209b('0xd'));var crypto=require(_0x209b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x209b('0xf'));var toCsv=require(_0x209b('0xa'));var querystring=require(_0x209b('0x10'));var Papa=require(_0x209b('0x11'));var Redis=require(_0x209b('0x12'));var authService=require(_0x209b('0x13'));var qs=require(_0x209b('0x14'));var as=require(_0x209b('0x15'));var hardwareService=require(_0x209b('0x16'));var logger=require(_0x209b('0x17'))(_0x209b('0x18'));var utils=require(_0x209b('0x19'));var config=require(_0x209b('0x1a'));var licenseUtil=require(_0x209b('0x1b'));var db=require(_0x209b('0x1c'))['db'];function respondWithStatusCode(_0xc4afd4,_0x2bd447){_0x2bd447=_0x2bd447||0xcc;return function(_0x397216){if(_0x397216){return _0xc4afd4[_0x209b('0x1d')](_0x2bd447);}return _0xc4afd4[_0x209b('0x1e')](_0x2bd447)[_0x209b('0x1f')]();};}function respondWithResult(_0x18a4ce,_0x3328d8){_0x3328d8=_0x3328d8||0xc8;return function(_0x4cd14c){if(_0x4cd14c){return _0x18a4ce[_0x209b('0x1e')](_0x3328d8)[_0x209b('0x20')](_0x4cd14c);}};}function respondWithFilteredResult(_0x186e9a,_0x4ca220){return function(_0x194073){if(_0x194073){var _0x4718cd=typeof _0x4ca220[_0x209b('0x21')]==='undefined'&&typeof _0x4ca220[_0x209b('0x22')]===_0x209b('0x23');var _0x1ab96e=_0x194073['count'];var _0x1da714=_0x4718cd?0x0:_0x4ca220[_0x209b('0x21')];var _0x3eefe8=_0x4718cd?_0x194073[_0x209b('0x24')]:_0x4ca220[_0x209b('0x21')]+_0x4ca220['limit'];var _0x39f8d5;if(_0x3eefe8>=_0x1ab96e){_0x3eefe8=_0x1ab96e;_0x39f8d5=0xc8;}else{_0x39f8d5=0xce;}_0x186e9a[_0x209b('0x1e')](_0x39f8d5);return _0x186e9a['set']('Content-Range',_0x1da714+'-'+_0x3eefe8+'/'+_0x1ab96e)[_0x209b('0x20')](_0x194073);}return null;};}function patchUpdates(_0x62186a){return function(_0x24bd23){try{jsonpatch[_0x209b('0x25')](_0x24bd23,_0x62186a,!![]);}catch(_0x810ec){return BPromise[_0x209b('0x26')](_0x810ec);}return _0x24bd23['save']();};}function saveUpdates(_0x1c67f1,_0x2ab186){return function(_0x40df85){if(_0x40df85){return _0x40df85[_0x209b('0x27')](_0x1c67f1)[_0x209b('0x28')](function(_0x453794){return _0x453794;});}return null;};}function removeEntity(_0x17dbfb,_0x8ff99b){return function(_0x36655a){if(_0x36655a){return _0x36655a[_0x209b('0x29')]()[_0x209b('0x28')](function(){_0x17dbfb[_0x209b('0x1e')](0xcc)[_0x209b('0x1f')]();});}};}function handleEntityNotFound(_0x1d7836,_0x1db69f){return function(_0x446f2e){if(!_0x446f2e){_0x1d7836[_0x209b('0x1d')](0x194);}return _0x446f2e;};}function handleError(_0x71a865,_0x2d3c5f){_0x2d3c5f=_0x2d3c5f||0x1f4;return function(_0x1af9b4){logger[_0x209b('0x2a')](_0x1af9b4[_0x209b('0x2b')]);if(_0x1af9b4[_0x209b('0x2c')]){delete _0x1af9b4[_0x209b('0x2c')];}_0x71a865[_0x209b('0x1e')](_0x2d3c5f)['send'](_0x1af9b4);};}exports[_0x209b('0x2d')]=function(_0x5780eb,_0x4abcc9){var _0x5a9344={},_0x8e3ea6={},_0x213bbe={'count':0x0,'rows':[]};var _0x352be9=_[_0x209b('0x2e')](db[_0x209b('0x2f')]['rawAttributes'],function(_0x5b12c1){return{'name':_0x5b12c1['fieldName'],'type':_0x5b12c1[_0x209b('0x30')][_0x209b('0x31')]};});_0x8e3ea6[_0x209b('0x32')]=_['map'](_0x352be9,_0x209b('0x2c'));_0x8e3ea6[_0x209b('0x33')]=_[_0x209b('0x34')](_0x5780eb['query']);_0x8e3ea6[_0x209b('0x35')]=_[_0x209b('0x36')](_0x8e3ea6['model'],_0x8e3ea6[_0x209b('0x33')]);_0x5a9344[_0x209b('0x37')]=_[_0x209b('0x36')](_0x8e3ea6[_0x209b('0x32')],qs[_0x209b('0x38')](_0x5780eb[_0x209b('0x33')][_0x209b('0x38')]));_0x5a9344[_0x209b('0x37')]=_0x5a9344[_0x209b('0x37')][_0x209b('0x39')]?_0x5a9344[_0x209b('0x37')]:_0x8e3ea6[_0x209b('0x32')];if(!_0x5780eb[_0x209b('0x33')]['hasOwnProperty']('nolimit')){_0x5a9344[_0x209b('0x22')]=qs[_0x209b('0x22')](_0x5780eb[_0x209b('0x33')][_0x209b('0x22')]);_0x5a9344['offset']=qs[_0x209b('0x21')](_0x5780eb['query'][_0x209b('0x21')]);}_0x5a9344[_0x209b('0x3a')]=qs['sort'](_0x5780eb['query']['sort']);_0x5a9344[_0x209b('0x3b')]=qs[_0x209b('0x35')](_['pick'](_0x5780eb['query'],_0x8e3ea6['filters']),_0x352be9);if(_0x5780eb[_0x209b('0x33')][_0x209b('0x3c')]){_0x5a9344[_0x209b('0x3b')]=_[_0x209b('0x3d')](_0x5a9344[_0x209b('0x3b')],{'$or':_[_0x209b('0x2e')](_0x352be9,function(_0x9de39){if(_0x9de39[_0x209b('0x30')]!==_0x209b('0x3e')){var _0x5c3c03={};_0x5c3c03[_0x9de39[_0x209b('0x2c')]]={'$like':'%'+_0x5780eb['query'][_0x209b('0x3c')]+'%'};return _0x5c3c03;}})});}_0x5a9344=_[_0x209b('0x3d')]({},_0x5a9344,_0x5780eb[_0x209b('0x3f')]);var _0x5aeb4a={'where':_0x5a9344['where']};return db[_0x209b('0x2f')][_0x209b('0x24')](_0x5aeb4a)[_0x209b('0x28')](function(_0x9e6476){_0x213bbe['count']=_0x9e6476;if(_0x5780eb[_0x209b('0x33')][_0x209b('0x40')]){_0x5a9344[_0x209b('0x41')]=[{'all':!![]}];}return db[_0x209b('0x2f')][_0x209b('0x42')](_0x5a9344);})[_0x209b('0x28')](function(_0x3cb822){_0x213bbe[_0x209b('0x43')]=_0x3cb822;return _0x213bbe;})[_0x209b('0x28')](respondWithFilteredResult(_0x4abcc9,_0x5a9344))[_0x209b('0x44')](handleError(_0x4abcc9,null));};exports[_0x209b('0x45')]=function(_0x33ae4f,_0x1010db){var _0x347b63={'raw':![],'where':{'id':_0x33ae4f[_0x209b('0x46')]['id']}},_0x48e16a={};_0x48e16a[_0x209b('0x32')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x48e16a[_0x209b('0x33')]=_[_0x209b('0x34')](_0x33ae4f[_0x209b('0x33')]);_0x48e16a[_0x209b('0x35')]=_[_0x209b('0x36')](_0x48e16a[_0x209b('0x32')],_0x48e16a[_0x209b('0x33')]);_0x347b63[_0x209b('0x37')]=_['intersection'](_0x48e16a[_0x209b('0x32')],qs[_0x209b('0x38')](_0x33ae4f['query'][_0x209b('0x38')]));_0x347b63[_0x209b('0x37')]=_0x347b63[_0x209b('0x37')][_0x209b('0x39')]?_0x347b63[_0x209b('0x37')]:_0x48e16a['model'];if(_0x33ae4f[_0x209b('0x33')][_0x209b('0x40')]){_0x347b63[_0x209b('0x41')]=[{'all':!![]}];}_0x347b63=_[_0x209b('0x3d')]({},_0x347b63,_0x33ae4f['options']);return db[_0x209b('0x2f')][_0x209b('0x47')](_0x347b63)[_0x209b('0x28')](handleEntityNotFound(_0x1010db,null))['then'](respondWithResult(_0x1010db,null))[_0x209b('0x44')](handleError(_0x1010db,null));};exports[_0x209b('0x48')]=function(_0x568edc,_0x54015f){return db[_0x209b('0x2f')]['create'](_0x568edc[_0x209b('0x49')],{})[_0x209b('0x28')](respondWithResult(_0x54015f,0xc9))[_0x209b('0x44')](handleError(_0x54015f,null));};exports[_0x209b('0x27')]=function(_0x580f8f,_0x196379){if(_0x580f8f[_0x209b('0x49')]['id']){delete _0x580f8f[_0x209b('0x49')]['id'];}return db[_0x209b('0x2f')][_0x209b('0x47')]({'where':{'id':_0x580f8f[_0x209b('0x46')]['id']}})[_0x209b('0x28')](handleEntityNotFound(_0x196379,null))[_0x209b('0x28')](saveUpdates(_0x580f8f['body'],null))[_0x209b('0x28')](respondWithResult(_0x196379,null))[_0x209b('0x44')](handleError(_0x196379,null));};exports['destroy']=function(_0x45a35a,_0x187de0){return db[_0x209b('0x2f')][_0x209b('0x47')]({'where':{'id':_0x45a35a[_0x209b('0x46')]['id']}})[_0x209b('0x28')](handleEntityNotFound(_0x187de0,null))[_0x209b('0x28')](removeEntity(_0x187de0,null))[_0x209b('0x44')](handleError(_0x187de0,null));};exports[_0x209b('0x4a')]=function(_0x24ee40,_0x3e99f1,_0x1d1179){var _0x4c5576={};var _0x5e7cc5={};var _0x2ad605;var _0x27de00;return db[_0x209b('0x2f')][_0x209b('0x4b')]({'where':{'id':_0x24ee40[_0x209b('0x46')]['id']}})[_0x209b('0x28')](handleEntityNotFound(_0x3e99f1,null))['then'](function(_0x196c08){if(_0x196c08){_0x2ad605=_0x196c08;_0x5e7cc5[_0x209b('0x32')]=_['keys'](db[_0x209b('0x4c')]['rawAttributes']);_0x5e7cc5[_0x209b('0x33')]=_['keys'](_0x24ee40[_0x209b('0x33')]);_0x5e7cc5[_0x209b('0x35')]=_['intersection'](_0x5e7cc5['model'],_0x5e7cc5[_0x209b('0x33')]);_0x4c5576[_0x209b('0x37')]=_['intersection'](_0x5e7cc5[_0x209b('0x32')],qs['fields'](_0x24ee40[_0x209b('0x33')][_0x209b('0x38')]));_0x4c5576['attributes']=_0x4c5576['attributes'][_0x209b('0x39')]?_0x4c5576['attributes']:_0x5e7cc5[_0x209b('0x32')];_0x4c5576[_0x209b('0x3a')]=qs['sort'](_0x24ee40[_0x209b('0x33')][_0x209b('0x4d')]);_0x4c5576['where']=qs['filters'](_[_0x209b('0x4e')](_0x24ee40[_0x209b('0x33')],_0x5e7cc5['filters']));if(_0x24ee40[_0x209b('0x33')][_0x209b('0x3c')]){_0x4c5576['where']=_['merge'](_0x4c5576['where'],{'$or':_['map'](_0x4c5576[_0x209b('0x37')],function(_0x286733){var _0x65eadc={};_0x65eadc[_0x286733]={'$like':'%'+_0x24ee40[_0x209b('0x33')]['filter']+'%'};return _0x65eadc;})});}_0x4c5576=_['merge']({},_0x4c5576,_0x24ee40[_0x209b('0x3f')]);return _0x2ad605[_0x209b('0x4a')](_0x4c5576);}})['then'](function(_0x6559fe){if(_0x6559fe){_0x27de00=_0x6559fe[_0x209b('0x39')];if(!_0x24ee40[_0x209b('0x33')][_0x209b('0x4f')]('nolimit')){_0x4c5576[_0x209b('0x22')]=qs[_0x209b('0x22')](_0x24ee40[_0x209b('0x33')][_0x209b('0x22')]);_0x4c5576[_0x209b('0x21')]=qs[_0x209b('0x21')](_0x24ee40[_0x209b('0x33')][_0x209b('0x21')]);}return _0x2ad605[_0x209b('0x4a')](_0x4c5576);}})['then'](function(_0x10be28){if(_0x10be28){return _0x10be28?{'count':_0x27de00,'rows':_0x10be28}:null;}})[_0x209b('0x28')](respondWithResult(_0x3e99f1,null))[_0x209b('0x44')](handleError(_0x3e99f1,null));};exports[_0x209b('0x50')]=function(_0x344e80,_0x249da5,_0x2bb266){var _0x450e5a={};var _0x4ba7e6={};var _0x1fa60a;var _0x1b5b86;return db[_0x209b('0x2f')]['findOne']({'where':{'id':_0x344e80['params']['id']}})[_0x209b('0x28')](handleEntityNotFound(_0x249da5,null))[_0x209b('0x28')](function(_0x275fd5){if(_0x275fd5){_0x1fa60a=_0x275fd5;_0x4ba7e6[_0x209b('0x32')]=_[_0x209b('0x34')](db[_0x209b('0x4c')]['rawAttributes']);_0x4ba7e6[_0x209b('0x33')]=_['keys'](_0x344e80[_0x209b('0x33')]);_0x4ba7e6['filters']=_[_0x209b('0x36')](_0x4ba7e6[_0x209b('0x32')],_0x4ba7e6[_0x209b('0x33')]);_0x450e5a[_0x209b('0x37')]=_[_0x209b('0x36')](_0x4ba7e6['model'],qs[_0x209b('0x38')](_0x344e80['query'][_0x209b('0x38')]));_0x450e5a['attributes']=_0x450e5a[_0x209b('0x37')]['length']?_0x450e5a['attributes']:_0x4ba7e6[_0x209b('0x32')];_0x450e5a[_0x209b('0x3a')]=qs[_0x209b('0x4d')](_0x344e80[_0x209b('0x33')][_0x209b('0x4d')]);_0x450e5a[_0x209b('0x3b')]=qs['filters'](_[_0x209b('0x4e')](_0x344e80[_0x209b('0x33')],_0x4ba7e6[_0x209b('0x35')]));if(_0x344e80['query'][_0x209b('0x3c')]){_0x450e5a['where']=_['merge'](_0x450e5a[_0x209b('0x3b')],{'$or':_[_0x209b('0x2e')](_0x450e5a['attributes'],function(_0x43c6f3){var _0xc64868={};_0xc64868[_0x43c6f3]={'$like':'%'+_0x344e80[_0x209b('0x33')][_0x209b('0x3c')]+'%'};return _0xc64868;})});}_0x450e5a=_[_0x209b('0x3d')]({},_0x450e5a,_0x344e80['options']);return _0x1fa60a[_0x209b('0x50')](_0x450e5a);}})[_0x209b('0x28')](function(_0x14a7ef){if(_0x14a7ef){_0x1b5b86=_0x14a7ef[_0x209b('0x39')];if(!_0x344e80[_0x209b('0x33')][_0x209b('0x4f')](_0x209b('0x51'))){_0x450e5a[_0x209b('0x22')]=qs[_0x209b('0x22')](_0x344e80[_0x209b('0x33')][_0x209b('0x22')]);_0x450e5a[_0x209b('0x21')]=qs[_0x209b('0x21')](_0x344e80[_0x209b('0x33')]['offset']);}return _0x1fa60a['getSubjects'](_0x450e5a);}})['then'](function(_0x4e1687){if(_0x4e1687){return _0x4e1687?{'count':_0x1b5b86,'rows':_0x4e1687}:null;}})[_0x209b('0x28')](respondWithResult(_0x249da5,null))['catch'](handleError(_0x249da5,null));};exports[_0x209b('0x52')]=function(_0x3995ae,_0x15da12,_0x4c2fa7){var _0x14a8a8={};var _0x4f6c6a={};var _0x56f84f;var _0x1b7f25;return db[_0x209b('0x2f')]['findOne']({'where':{'id':_0x3995ae[_0x209b('0x46')]['id']}})[_0x209b('0x28')](handleEntityNotFound(_0x15da12,null))['then'](function(_0x414317){if(_0x414317){_0x56f84f=_0x414317;_0x4f6c6a[_0x209b('0x32')]=_[_0x209b('0x34')](db['VtigerField'][_0x209b('0x53')]);_0x4f6c6a[_0x209b('0x33')]=_[_0x209b('0x34')](_0x3995ae[_0x209b('0x33')]);_0x4f6c6a[_0x209b('0x35')]=_[_0x209b('0x36')](_0x4f6c6a['model'],_0x4f6c6a['query']);_0x14a8a8[_0x209b('0x37')]=_[_0x209b('0x36')](_0x4f6c6a[_0x209b('0x32')],qs[_0x209b('0x38')](_0x3995ae['query'][_0x209b('0x38')]));_0x14a8a8[_0x209b('0x37')]=_0x14a8a8['attributes'][_0x209b('0x39')]?_0x14a8a8['attributes']:_0x4f6c6a[_0x209b('0x32')];_0x14a8a8[_0x209b('0x3a')]=qs[_0x209b('0x4d')](_0x3995ae[_0x209b('0x33')]['sort']);_0x14a8a8[_0x209b('0x3b')]=qs[_0x209b('0x35')](_[_0x209b('0x4e')](_0x3995ae[_0x209b('0x33')],_0x4f6c6a[_0x209b('0x35')]));if(_0x3995ae[_0x209b('0x33')][_0x209b('0x3c')]){_0x14a8a8['where']=_[_0x209b('0x3d')](_0x14a8a8[_0x209b('0x3b')],{'$or':_['map'](_0x14a8a8['attributes'],function(_0x2ba167){var _0x1b712e={};_0x1b712e[_0x2ba167]={'$like':'%'+_0x3995ae[_0x209b('0x33')][_0x209b('0x3c')]+'%'};return _0x1b712e;})});}_0x14a8a8=_[_0x209b('0x3d')]({},_0x14a8a8,_0x3995ae['options']);return _0x56f84f['getDescriptions'](_0x14a8a8);}})['then'](function(_0x5f16a5){if(_0x5f16a5){_0x1b7f25=_0x5f16a5[_0x209b('0x39')];if(!_0x3995ae[_0x209b('0x33')][_0x209b('0x4f')]('nolimit')){_0x14a8a8[_0x209b('0x22')]=qs[_0x209b('0x22')](_0x3995ae['query'][_0x209b('0x22')]);_0x14a8a8[_0x209b('0x21')]=qs[_0x209b('0x21')](_0x3995ae[_0x209b('0x33')][_0x209b('0x21')]);}return _0x56f84f[_0x209b('0x52')](_0x14a8a8);}})[_0x209b('0x28')](function(_0x3f851f){if(_0x3f851f){return _0x3f851f?{'count':_0x1b7f25,'rows':_0x3f851f}:null;}})[_0x209b('0x28')](respondWithResult(_0x15da12,null))['catch'](handleError(_0x15da12,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1a714ae..c1d06df 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 _0x7a9b=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3e8fe3,_0x1277a0){var _0x73e1ab=function(_0x14cc5d){while(--_0x14cc5d){_0x3e8fe3['push'](_0x3e8fe3['shift']());}};_0x73e1ab(++_0x1277a0);}(_0x7a9b,0xf6));var _0xb7a9=function(_0x249f71,_0x2a0cde){_0x249f71=_0x249f71-0x0;var _0x38dbaa=_0x7a9b[_0x249f71];return _0x38dbaa;};'use strict';var _=require(_0xb7a9('0x0'));var util=require(_0xb7a9('0x1'));var logger=require(_0xb7a9('0x2'))(_0xb7a9('0x3'));var moment=require('moment');var BPromise=require(_0xb7a9('0x4'));var rp=require(_0xb7a9('0x5'));var fs=require('fs');var path=require(_0xb7a9('0x6'));var rimraf=require('rimraf');var config=require(_0xb7a9('0x7'));var attributes=require(_0xb7a9('0x8'));module[_0xb7a9('0x9')]=function(_0x190af7,_0x43b8f1){return _0x190af7[_0xb7a9('0xa')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe138=['int_vtiger_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration'];(function(_0x259e77,_0x52f430){var _0x1f93bd=function(_0x3c9ffe){while(--_0x3c9ffe){_0x259e77['push'](_0x259e77['shift']());}};_0x1f93bd(++_0x52f430);}(_0xe138,0x121));var _0x8e13=function(_0x37b2ca,_0x2e588f){_0x37b2ca=_0x37b2ca-0x0;var _0x379472=_0xe138[_0x37b2ca];return _0x379472;};'use strict';var _=require(_0x8e13('0x0'));var util=require(_0x8e13('0x1'));var logger=require(_0x8e13('0x2'))('api');var moment=require(_0x8e13('0x3'));var BPromise=require(_0x8e13('0x4'));var rp=require(_0x8e13('0x5'));var fs=require('fs');var path=require(_0x8e13('0x6'));var rimraf=require('rimraf');var config=require(_0x8e13('0x7'));var attributes=require(_0x8e13('0x8'));module['exports']=function(_0x29fabf,_0x778f1f){return _0x29fabf[_0x8e13('0x9')](_0x8e13('0xa'),attributes,{'tableName':_0x8e13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 5760547..bd656a8 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 _0x8f24=['error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0x8f24,0x82));var _0x48f2=function(_0x22fd75,_0x26b4bb){_0x22fd75=_0x22fd75-0x0;var _0x1cfc12=_0x8f24[_0x22fd75];return _0x1cfc12;};'use strict';var _=require(_0x48f2('0x0'));var util=require(_0x48f2('0x1'));var moment=require('moment');var BPromise=require(_0x48f2('0x2'));var rs=require(_0x48f2('0x3'));var fs=require('fs');var Redis=require(_0x48f2('0x4'));var db=require(_0x48f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x48f2('0x6'));var jayson=require(_0x48f2('0x7'));var client=jayson[_0x48f2('0x8')][_0x48f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59645c,_0x59f174,_0x45c07a){return new BPromise(function(_0x3ba199,_0x516349){return client[_0x48f2('0xa')](_0x59645c,_0x45c07a)[_0x48f2('0xb')](function(_0x3c3e9c){logger[_0x48f2('0xc')](_0x48f2('0xd'),_0x59f174,'request\x20sent');logger['debug'](_0x48f2('0xe'),_0x59f174,_0x48f2('0xf'),JSON[_0x48f2('0x10')](_0x3c3e9c));if(_0x3c3e9c['error']){if(_0x3c3e9c['error']['code']===0x1f4){logger[_0x48f2('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x59f174,_0x3c3e9c[_0x48f2('0x11')]['message']);return _0x516349(_0x3c3e9c[_0x48f2('0x11')]['message']);}logger[_0x48f2('0x11')](_0x48f2('0xd'),_0x59f174,_0x3c3e9c[_0x48f2('0x11')][_0x48f2('0x12')]);return _0x3ba199(_0x3c3e9c[_0x48f2('0x11')]['message']);}else{logger['info'](_0x48f2('0xd'),_0x59f174,_0x48f2('0xf'));_0x3ba199(_0x3c3e9c[_0x48f2('0x13')][_0x48f2('0x12')]);}})[_0x48f2('0x14')](function(_0x1858a0){logger[_0x48f2('0x11')](_0x48f2('0xd'),_0x59f174,_0x1858a0);_0x516349(_0x1858a0);});});} \ No newline at end of file +var _0x0a7d=['code','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x118d01,_0x42967e){var _0x3dd4a0=function(_0x206647){while(--_0x206647){_0x118d01['push'](_0x118d01['shift']());}};_0x3dd4a0(++_0x42967e);}(_0x0a7d,0x114));var _0xd0a7=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0x0a7d[_0x7b173];return _0x1c598c;};'use strict';var _=require(_0xd0a7('0x0'));var util=require(_0xd0a7('0x1'));var moment=require(_0xd0a7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0a7('0x3'))['db'];var utils=require(_0xd0a7('0x4'));var logger=require(_0xd0a7('0x5'))(_0xd0a7('0x6'));var config=require(_0xd0a7('0x7'));var jayson=require(_0xd0a7('0x8'));var client=jayson[_0xd0a7('0x9')][_0xd0a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3894a0,_0x206880,_0x253390){return new BPromise(function(_0x242a67,_0x1db98f){return client[_0xd0a7('0xb')](_0x3894a0,_0x253390)['then'](function(_0x1fb659){logger[_0xd0a7('0xc')](_0xd0a7('0xd'),_0x206880,_0xd0a7('0xe'));logger[_0xd0a7('0xf')](_0xd0a7('0x10'),_0x206880,_0xd0a7('0xe'),JSON['stringify'](_0x1fb659));if(_0x1fb659[_0xd0a7('0x11')]){if(_0x1fb659[_0xd0a7('0x11')][_0xd0a7('0x12')]===0x1f4){logger[_0xd0a7('0x11')](_0xd0a7('0xd'),_0x206880,_0x1fb659[_0xd0a7('0x11')][_0xd0a7('0x13')]);return _0x1db98f(_0x1fb659[_0xd0a7('0x11')][_0xd0a7('0x13')]);}logger[_0xd0a7('0x11')](_0xd0a7('0xd'),_0x206880,_0x1fb659[_0xd0a7('0x11')][_0xd0a7('0x13')]);return _0x242a67(_0x1fb659[_0xd0a7('0x11')]['message']);}else{logger['info'](_0xd0a7('0xd'),_0x206880,_0xd0a7('0xe'));_0x242a67(_0x1fb659[_0xd0a7('0x14')][_0xd0a7('0x13')]);}})['catch'](function(_0x5c7a38){logger[_0xd0a7('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x206880,_0x5c7a38);_0x1db98f(_0x5c7a38);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 07ef193..6f58c3d 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 _0x3cc0=['../../components/auth/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','exports','util','path','connect-timeout','Router','fs-extra'];(function(_0x4384e8,_0x38d6c4){var _0x5b82bf=function(_0x223873){while(--_0x223873){_0x4384e8['push'](_0x4384e8['shift']());}};_0x5b82bf(++_0x38d6c4);}(_0x3cc0,0x13b));var _0x03cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3cc0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x03cc('0x0'));var path=require(_0x03cc('0x1'));var timeout=require(_0x03cc('0x2'));var express=require('express');var router=express[_0x03cc('0x3')]();var fs_extra=require(_0x03cc('0x4'));var auth=require(_0x03cc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x03cc('0x6'));router[_0x03cc('0x7')]('/',auth[_0x03cc('0x8')](),controller[_0x03cc('0x9')]);router[_0x03cc('0x7')](_0x03cc('0xa'),auth[_0x03cc('0x8')](),controller[_0x03cc('0xb')]);router['post']('/',auth[_0x03cc('0x8')](),controller[_0x03cc('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x03cc('0xd')]);router['delete'](_0x03cc('0xa'),auth[_0x03cc('0x8')](),controller[_0x03cc('0xe')]);module[_0x03cc('0xf')]=router; \ No newline at end of file +var _0x76bf=['../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x57b5c9,_0x537b2c){var _0x310b88=function(_0x458da4){while(--_0x458da4){_0x57b5c9['push'](_0x57b5c9['shift']());}};_0x310b88(++_0x537b2c);}(_0x76bf,0xe5));var _0xf76b=function(_0x53e87a,_0x73c04d){_0x53e87a=_0x53e87a-0x0;var _0x334c04=_0x76bf[_0x53e87a];return _0x334c04;};'use strict';var multer=require(_0xf76b('0x0'));var util=require(_0xf76b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xf76b('0x2'));var auth=require(_0xf76b('0x3'));var interaction=require(_0xf76b('0x4'));var config=require(_0xf76b('0x5'));var controller=require(_0xf76b('0x6'));router[_0xf76b('0x7')]('/',auth[_0xf76b('0x8')](),controller[_0xf76b('0x9')]);router[_0xf76b('0x7')](_0xf76b('0xa'),auth[_0xf76b('0x8')](),controller[_0xf76b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf76b('0xc')]);router[_0xf76b('0xd')](_0xf76b('0xa'),auth['isAuthenticated'](),controller[_0xf76b('0xe')]);router[_0xf76b('0xf')](_0xf76b('0xa'),auth['isAuthenticated'](),controller[_0xf76b('0x10')]);module[_0xf76b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 1400827..555bcb2 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 _0x0205=['ENUM','customVariable','keyValue','picklist','string','variable','STRING','BOOLEAN','sequelize','exports'];(function(_0x16dd98,_0x11d346){var _0xfc7fb3=function(_0x40d7d8){while(--_0x40d7d8){_0x16dd98['push'](_0x16dd98['shift']());}};_0xfc7fb3(++_0x11d346);}(_0x0205,0xd0));var _0x5020=function(_0x1723c5,_0x5baaa4){_0x1723c5=_0x1723c5-0x0;var _0x475953=_0x0205[_0x1723c5];return _0x475953;};'use strict';var Sequelize=require(_0x5020('0x0'));module[_0x5020('0x1')]={'type':{'type':Sequelize[_0x5020('0x2')]('string','variable',_0x5020('0x3'),_0x5020('0x4'),_0x5020('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5020('0x2')](_0x5020('0x6'),_0x5020('0x7'),_0x5020('0x3'))},'keyContent':{'type':Sequelize[_0x5020('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5020('0x8')]},'customField':{'type':Sequelize[_0x5020('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5020('0x8')]}}; \ No newline at end of file +var _0x7786=['STRING','customVariable','BOOLEAN','sequelize','ENUM','string','keyValue','picklist'];(function(_0x5dde9e,_0xb25ca5){var _0x544971=function(_0x4a8a52){while(--_0x4a8a52){_0x5dde9e['push'](_0x5dde9e['shift']());}};_0x544971(++_0xb25ca5);}(_0x7786,0x1f3));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6778('0x0'));module['exports']={'type':{'type':Sequelize[_0x6778('0x1')](_0x6778('0x2'),'variable','customVariable',_0x6778('0x3'),_0x6778('0x4')),'defaultValue':_0x6778('0x2')},'content':{'type':Sequelize[_0x6778('0x5')]},'key':{'type':Sequelize[_0x6778('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x6778('0x6'))},'keyContent':{'type':Sequelize[_0x6778('0x5')]},'idField':{'type':Sequelize[_0x6778('0x5')]},'nameField':{'type':Sequelize[_0x6778('0x5')]},'customField':{'type':Sequelize[_0x6778('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6778('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f080da5..3cf64e7 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 _0x0ebb=['merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x18f283,_0x540391){var _0x8acaa0=function(_0x20e539){while(--_0x20e539){_0x18f283['push'](_0x18f283['shift']());}};_0x8acaa0(++_0x540391);}(_0x0ebb,0xa5));var _0xb0eb=function(_0x2cc28e,_0x2138ce){_0x2cc28e=_0x2cc28e-0x0;var _0x4e3fb3=_0x0ebb[_0x2cc28e];return _0x4e3fb3;};'use strict';var emlformat=require(_0xb0eb('0x0'));var rimraf=require(_0xb0eb('0x1'));var zipdir=require(_0xb0eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb0eb('0x3'));var BPromise=require(_0xb0eb('0x4'));var Mustache=require('mustache');var util=require(_0xb0eb('0x5'));var path=require('path');var sox=require(_0xb0eb('0x6'));var csv=require(_0xb0eb('0x7'));var ejs=require(_0xb0eb('0x8'));var fs=require('fs');var fs_extra=require(_0xb0eb('0x9'));var _=require('lodash');var squel=require(_0xb0eb('0xa'));var crypto=require(_0xb0eb('0xb'));var jsforce=require(_0xb0eb('0xc'));var deskjs=require(_0xb0eb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb0eb('0xe'));var Papa=require('papaparse');var Redis=require(_0xb0eb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb0eb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb0eb('0x11'));var logger=require(_0xb0eb('0x12'))(_0xb0eb('0x13'));var utils=require(_0xb0eb('0x14'));var config=require(_0xb0eb('0x15'));var licenseUtil=require(_0xb0eb('0x16'));var db=require(_0xb0eb('0x17'))['db'];function respondWithStatusCode(_0x19a045,_0x7d62af){_0x7d62af=_0x7d62af||0xcc;return function(_0x288ac2){if(_0x288ac2){return _0x19a045[_0xb0eb('0x18')](_0x7d62af);}return _0x19a045[_0xb0eb('0x19')](_0x7d62af)['end']();};}function respondWithResult(_0x526085,_0x60bc73){_0x60bc73=_0x60bc73||0xc8;return function(_0x5880e9){if(_0x5880e9){return _0x526085[_0xb0eb('0x19')](_0x60bc73)[_0xb0eb('0x1a')](_0x5880e9);}};}function respondWithFilteredResult(_0x3d14ed,_0x18fb13){return function(_0x42383d){if(_0x42383d){var _0x1c7e62=typeof _0x18fb13[_0xb0eb('0x1b')]===_0xb0eb('0x1c')&&typeof _0x18fb13[_0xb0eb('0x1d')]===_0xb0eb('0x1c');var _0x4259f7=_0x42383d[_0xb0eb('0x1e')];var _0x41e001=_0x1c7e62?0x0:_0x18fb13[_0xb0eb('0x1b')];var _0x3d3e73=_0x1c7e62?_0x42383d[_0xb0eb('0x1e')]:_0x18fb13[_0xb0eb('0x1b')]+_0x18fb13[_0xb0eb('0x1d')];var _0x420a8d;if(_0x3d3e73>=_0x4259f7){_0x3d3e73=_0x4259f7;_0x420a8d=0xc8;}else{_0x420a8d=0xce;}_0x3d14ed[_0xb0eb('0x19')](_0x420a8d);return _0x3d14ed[_0xb0eb('0x1f')](_0xb0eb('0x20'),_0x41e001+'-'+_0x3d3e73+'/'+_0x4259f7)['json'](_0x42383d);}return null;};}function patchUpdates(_0x5e5bcb){return function(_0x646cf){try{jsonpatch[_0xb0eb('0x21')](_0x646cf,_0x5e5bcb,!![]);}catch(_0x434652){return BPromise['reject'](_0x434652);}return _0x646cf[_0xb0eb('0x22')]();};}function saveUpdates(_0x54f3b4,_0x490d2d){return function(_0x91842){if(_0x91842){return _0x91842[_0xb0eb('0x23')](_0x54f3b4)[_0xb0eb('0x24')](function(_0x8fcab7){return _0x8fcab7;});}return null;};}function removeEntity(_0x5dd596,_0x4211b8){return function(_0x4b1069){if(_0x4b1069){return _0x4b1069[_0xb0eb('0x25')]()[_0xb0eb('0x24')](function(){_0x5dd596[_0xb0eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18cc5d,_0x3fc7d0){return function(_0x49d986){if(!_0x49d986){_0x18cc5d[_0xb0eb('0x18')](0x194);}return _0x49d986;};}function handleError(_0x6dc645,_0x4e2de5){_0x4e2de5=_0x4e2de5||0x1f4;return function(_0x3af8e8){logger[_0xb0eb('0x26')](_0x3af8e8[_0xb0eb('0x27')]);if(_0x3af8e8[_0xb0eb('0x28')]){delete _0x3af8e8['name'];}_0x6dc645[_0xb0eb('0x19')](_0x4e2de5)[_0xb0eb('0x29')](_0x3af8e8);};}exports[_0xb0eb('0x2a')]=function(_0x3e6f2b,_0x1cc9e5){var _0x1420a9={},_0x3fd9c3={},_0x4d9dae={'count':0x0,'rows':[]};var _0x305cca=_[_0xb0eb('0x2b')](db[_0xb0eb('0x2c')]['rawAttributes'],function(_0x12a2f4){return{'name':_0x12a2f4[_0xb0eb('0x2d')],'type':_0x12a2f4[_0xb0eb('0x2e')][_0xb0eb('0x2f')]};});_0x3fd9c3[_0xb0eb('0x30')]=_['map'](_0x305cca,_0xb0eb('0x28'));_0x3fd9c3[_0xb0eb('0x31')]=_[_0xb0eb('0x32')](_0x3e6f2b[_0xb0eb('0x31')]);_0x3fd9c3[_0xb0eb('0x33')]=_[_0xb0eb('0x34')](_0x3fd9c3[_0xb0eb('0x30')],_0x3fd9c3[_0xb0eb('0x31')]);_0x1420a9[_0xb0eb('0x35')]=_[_0xb0eb('0x34')](_0x3fd9c3[_0xb0eb('0x30')],qs['fields'](_0x3e6f2b[_0xb0eb('0x31')][_0xb0eb('0x36')]));_0x1420a9[_0xb0eb('0x35')]=_0x1420a9[_0xb0eb('0x35')][_0xb0eb('0x37')]?_0x1420a9[_0xb0eb('0x35')]:_0x3fd9c3[_0xb0eb('0x30')];if(!_0x3e6f2b[_0xb0eb('0x31')][_0xb0eb('0x38')](_0xb0eb('0x39'))){_0x1420a9[_0xb0eb('0x1d')]=qs[_0xb0eb('0x1d')](_0x3e6f2b[_0xb0eb('0x31')]['limit']);_0x1420a9[_0xb0eb('0x1b')]=qs[_0xb0eb('0x1b')](_0x3e6f2b['query'][_0xb0eb('0x1b')]);}_0x1420a9[_0xb0eb('0x3a')]=qs[_0xb0eb('0x3b')](_0x3e6f2b[_0xb0eb('0x31')][_0xb0eb('0x3b')]);_0x1420a9['where']=qs[_0xb0eb('0x33')](_[_0xb0eb('0x3c')](_0x3e6f2b['query'],_0x3fd9c3[_0xb0eb('0x33')]),_0x305cca);if(_0x3e6f2b[_0xb0eb('0x31')][_0xb0eb('0x3d')]){_0x1420a9[_0xb0eb('0x3e')]=_[_0xb0eb('0x3f')](_0x1420a9[_0xb0eb('0x3e')],{'$or':_['map'](_0x305cca,function(_0x59a6e2){if(_0x59a6e2[_0xb0eb('0x2e')]!==_0xb0eb('0x40')){var _0x44f88b={};_0x44f88b[_0x59a6e2[_0xb0eb('0x28')]]={'$like':'%'+_0x3e6f2b[_0xb0eb('0x31')]['filter']+'%'};return _0x44f88b;}})});}_0x1420a9=_[_0xb0eb('0x3f')]({},_0x1420a9,_0x3e6f2b['options']);var _0x29e023={'where':_0x1420a9['where']};return db[_0xb0eb('0x2c')][_0xb0eb('0x1e')](_0x29e023)['then'](function(_0x569a35){_0x4d9dae[_0xb0eb('0x1e')]=_0x569a35;if(_0x3e6f2b[_0xb0eb('0x31')][_0xb0eb('0x41')]){_0x1420a9[_0xb0eb('0x42')]=[{'all':!![]}];}return db['VtigerField'][_0xb0eb('0x43')](_0x1420a9);})[_0xb0eb('0x24')](function(_0x1b509a){_0x4d9dae['rows']=_0x1b509a;return _0x4d9dae;})[_0xb0eb('0x24')](respondWithFilteredResult(_0x1cc9e5,_0x1420a9))[_0xb0eb('0x44')](handleError(_0x1cc9e5,null));};exports[_0xb0eb('0x45')]=function(_0x21072c,_0x45a58a){var _0xec6f7={'raw':!![],'where':{'id':_0x21072c[_0xb0eb('0x46')]['id']}},_0x4e468d={};_0x4e468d[_0xb0eb('0x30')]=_[_0xb0eb('0x32')](db[_0xb0eb('0x2c')][_0xb0eb('0x47')]);_0x4e468d[_0xb0eb('0x31')]=_[_0xb0eb('0x32')](_0x21072c[_0xb0eb('0x31')]);_0x4e468d['filters']=_[_0xb0eb('0x34')](_0x4e468d[_0xb0eb('0x30')],_0x4e468d[_0xb0eb('0x31')]);_0xec6f7[_0xb0eb('0x35')]=_[_0xb0eb('0x34')](_0x4e468d[_0xb0eb('0x30')],qs[_0xb0eb('0x36')](_0x21072c[_0xb0eb('0x31')][_0xb0eb('0x36')]));_0xec6f7[_0xb0eb('0x35')]=_0xec6f7[_0xb0eb('0x35')][_0xb0eb('0x37')]?_0xec6f7[_0xb0eb('0x35')]:_0x4e468d[_0xb0eb('0x30')];if(_0x21072c[_0xb0eb('0x31')]['includeAll']){_0xec6f7['include']=[{'all':!![]}];}_0xec6f7=_[_0xb0eb('0x3f')]({},_0xec6f7,_0x21072c[_0xb0eb('0x48')]);return db[_0xb0eb('0x2c')][_0xb0eb('0x49')](_0xec6f7)[_0xb0eb('0x24')](handleEntityNotFound(_0x45a58a,null))[_0xb0eb('0x24')](respondWithResult(_0x45a58a,null))[_0xb0eb('0x44')](handleError(_0x45a58a,null));};exports[_0xb0eb('0x4a')]=function(_0x1a31be,_0x249553){return db[_0xb0eb('0x2c')]['create'](_0x1a31be[_0xb0eb('0x4b')],{})[_0xb0eb('0x24')](respondWithResult(_0x249553,0xc9))[_0xb0eb('0x44')](handleError(_0x249553,null));};exports['update']=function(_0x410863,_0x47c73d){if(_0x410863[_0xb0eb('0x4b')]['id']){delete _0x410863[_0xb0eb('0x4b')]['id'];}return db[_0xb0eb('0x2c')][_0xb0eb('0x49')]({'where':{'id':_0x410863[_0xb0eb('0x46')]['id']}})[_0xb0eb('0x24')](handleEntityNotFound(_0x47c73d,null))[_0xb0eb('0x24')](saveUpdates(_0x410863[_0xb0eb('0x4b')],null))[_0xb0eb('0x24')](respondWithResult(_0x47c73d,null))['catch'](handleError(_0x47c73d,null));};exports[_0xb0eb('0x25')]=function(_0x5bbfa5,_0x2e7895){return db[_0xb0eb('0x2c')]['find']({'where':{'id':_0x5bbfa5[_0xb0eb('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e7895,null))[_0xb0eb('0x24')](removeEntity(_0x2e7895,null))['catch'](handleError(_0x2e7895,null));}; \ No newline at end of file +var _0x98f0=['findAll','rows','show','params','rawAttributes','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','stack','name','index','map','VtigerField','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include'];(function(_0x4e77c6,_0x4c359c){var _0x3e326c=function(_0x50e425){while(--_0x50e425){_0x4e77c6['push'](_0x4e77c6['shift']());}};_0x3e326c(++_0x4c359c);}(_0x98f0,0xdc));var _0x098f=function(_0x540286,_0x4dc75a){_0x540286=_0x540286-0x0;var _0x48854f=_0x98f0[_0x540286];return _0x48854f;};'use strict';var emlformat=require(_0x098f('0x0'));var rimraf=require(_0x098f('0x1'));var zipdir=require(_0x098f('0x2'));var jsonpatch=require(_0x098f('0x3'));var rp=require(_0x098f('0x4'));var moment=require('moment');var BPromise=require(_0x098f('0x5'));var Mustache=require(_0x098f('0x6'));var util=require(_0x098f('0x7'));var path=require(_0x098f('0x8'));var sox=require('sox');var csv=require(_0x098f('0x9'));var ejs=require(_0x098f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x098f('0xb'));var squel=require(_0x098f('0xc'));var crypto=require(_0x098f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x098f('0xe'));var Papa=require('papaparse');var Redis=require(_0x098f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x098f('0x10'))(_0x098f('0x11'));var utils=require(_0x098f('0x12'));var config=require(_0x098f('0x13'));var licenseUtil=require(_0x098f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fcf95,_0x27a1e0){_0x27a1e0=_0x27a1e0||0xcc;return function(_0x115d14){if(_0x115d14){return _0x3fcf95[_0x098f('0x15')](_0x27a1e0);}return _0x3fcf95[_0x098f('0x16')](_0x27a1e0)[_0x098f('0x17')]();};}function respondWithResult(_0x17498a,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xc8;return function(_0x3b7c94){if(_0x3b7c94){return _0x17498a[_0x098f('0x16')](_0x5c07e1)[_0x098f('0x18')](_0x3b7c94);}};}function respondWithFilteredResult(_0x378169,_0x262939){return function(_0x425d33){if(_0x425d33){var _0x30acc4=typeof _0x262939[_0x098f('0x19')]===_0x098f('0x1a')&&typeof _0x262939['limit']==='undefined';var _0x43cd72=_0x425d33[_0x098f('0x1b')];var _0x266e14=_0x30acc4?0x0:_0x262939['offset'];var _0xf50c4d=_0x30acc4?_0x425d33[_0x098f('0x1b')]:_0x262939[_0x098f('0x19')]+_0x262939[_0x098f('0x1c')];var _0x31bcd8;if(_0xf50c4d>=_0x43cd72){_0xf50c4d=_0x43cd72;_0x31bcd8=0xc8;}else{_0x31bcd8=0xce;}_0x378169['status'](_0x31bcd8);return _0x378169[_0x098f('0x1d')]('Content-Range',_0x266e14+'-'+_0xf50c4d+'/'+_0x43cd72)['json'](_0x425d33);}return null;};}function patchUpdates(_0x26c46b){return function(_0x168194){try{jsonpatch[_0x098f('0x1e')](_0x168194,_0x26c46b,!![]);}catch(_0x28b78d){return BPromise[_0x098f('0x1f')](_0x28b78d);}return _0x168194[_0x098f('0x20')]();};}function saveUpdates(_0xe0de47,_0x14b9f6){return function(_0x1a7a40){if(_0x1a7a40){return _0x1a7a40['update'](_0xe0de47)[_0x098f('0x21')](function(_0x4ba187){return _0x4ba187;});}return null;};}function removeEntity(_0xb98e8f,_0x56e0e1){return function(_0x283b14){if(_0x283b14){return _0x283b14[_0x098f('0x22')]()[_0x098f('0x21')](function(){_0xb98e8f[_0x098f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc7ba96,_0x5a6ea4){return function(_0x3399e8){if(!_0x3399e8){_0xc7ba96['sendStatus'](0x194);}return _0x3399e8;};}function handleError(_0x225eaf,_0x4d9536){_0x4d9536=_0x4d9536||0x1f4;return function(_0x10941b){logger['error'](_0x10941b[_0x098f('0x23')]);if(_0x10941b[_0x098f('0x24')]){delete _0x10941b[_0x098f('0x24')];}_0x225eaf[_0x098f('0x16')](_0x4d9536)['send'](_0x10941b);};}exports[_0x098f('0x25')]=function(_0x35963d,_0x5cb307){var _0x27c4e8={},_0x34f7f5={},_0x3e22f5={'count':0x0,'rows':[]};var _0xf9f7fd=_[_0x098f('0x26')](db[_0x098f('0x27')]['rawAttributes'],function(_0xfaf3dd){return{'name':_0xfaf3dd[_0x098f('0x28')],'type':_0xfaf3dd[_0x098f('0x29')]['key']};});_0x34f7f5[_0x098f('0x2a')]=_[_0x098f('0x26')](_0xf9f7fd,'name');_0x34f7f5[_0x098f('0x2b')]=_[_0x098f('0x2c')](_0x35963d['query']);_0x34f7f5[_0x098f('0x2d')]=_['intersection'](_0x34f7f5['model'],_0x34f7f5[_0x098f('0x2b')]);_0x27c4e8['attributes']=_[_0x098f('0x2e')](_0x34f7f5[_0x098f('0x2a')],qs[_0x098f('0x2f')](_0x35963d[_0x098f('0x2b')][_0x098f('0x2f')]));_0x27c4e8[_0x098f('0x30')]=_0x27c4e8[_0x098f('0x30')][_0x098f('0x31')]?_0x27c4e8[_0x098f('0x30')]:_0x34f7f5[_0x098f('0x2a')];if(!_0x35963d[_0x098f('0x2b')]['hasOwnProperty'](_0x098f('0x32'))){_0x27c4e8['limit']=qs['limit'](_0x35963d['query'][_0x098f('0x1c')]);_0x27c4e8[_0x098f('0x19')]=qs[_0x098f('0x19')](_0x35963d['query'][_0x098f('0x19')]);}_0x27c4e8[_0x098f('0x33')]=qs['sort'](_0x35963d['query'][_0x098f('0x34')]);_0x27c4e8[_0x098f('0x35')]=qs[_0x098f('0x2d')](_[_0x098f('0x36')](_0x35963d['query'],_0x34f7f5[_0x098f('0x2d')]),_0xf9f7fd);if(_0x35963d['query'][_0x098f('0x37')]){_0x27c4e8[_0x098f('0x35')]=_[_0x098f('0x38')](_0x27c4e8[_0x098f('0x35')],{'$or':_[_0x098f('0x26')](_0xf9f7fd,function(_0x7b56ee){if(_0x7b56ee[_0x098f('0x29')]!==_0x098f('0x39')){var _0x164f80={};_0x164f80[_0x7b56ee[_0x098f('0x24')]]={'$like':'%'+_0x35963d['query'][_0x098f('0x37')]+'%'};return _0x164f80;}})});}_0x27c4e8=_['merge']({},_0x27c4e8,_0x35963d['options']);var _0x51f79f={'where':_0x27c4e8[_0x098f('0x35')]};return db['VtigerField'][_0x098f('0x1b')](_0x51f79f)[_0x098f('0x21')](function(_0x2ae403){_0x3e22f5['count']=_0x2ae403;if(_0x35963d['query'][_0x098f('0x3a')]){_0x27c4e8[_0x098f('0x3b')]=[{'all':!![]}];}return db['VtigerField'][_0x098f('0x3c')](_0x27c4e8);})[_0x098f('0x21')](function(_0x4da2e9){_0x3e22f5[_0x098f('0x3d')]=_0x4da2e9;return _0x3e22f5;})[_0x098f('0x21')](respondWithFilteredResult(_0x5cb307,_0x27c4e8))['catch'](handleError(_0x5cb307,null));};exports[_0x098f('0x3e')]=function(_0x31002d,_0x18ed66){var _0x1620fe={'raw':!![],'where':{'id':_0x31002d[_0x098f('0x3f')]['id']}},_0x3ad690={};_0x3ad690[_0x098f('0x2a')]=_[_0x098f('0x2c')](db[_0x098f('0x27')][_0x098f('0x40')]);_0x3ad690['query']=_['keys'](_0x31002d[_0x098f('0x2b')]);_0x3ad690[_0x098f('0x2d')]=_[_0x098f('0x2e')](_0x3ad690[_0x098f('0x2a')],_0x3ad690[_0x098f('0x2b')]);_0x1620fe[_0x098f('0x30')]=_['intersection'](_0x3ad690[_0x098f('0x2a')],qs[_0x098f('0x2f')](_0x31002d[_0x098f('0x2b')][_0x098f('0x2f')]));_0x1620fe[_0x098f('0x30')]=_0x1620fe['attributes'][_0x098f('0x31')]?_0x1620fe[_0x098f('0x30')]:_0x3ad690[_0x098f('0x2a')];if(_0x31002d[_0x098f('0x2b')][_0x098f('0x3a')]){_0x1620fe[_0x098f('0x3b')]=[{'all':!![]}];}_0x1620fe=_[_0x098f('0x38')]({},_0x1620fe,_0x31002d['options']);return db['VtigerField'][_0x098f('0x41')](_0x1620fe)[_0x098f('0x21')](handleEntityNotFound(_0x18ed66,null))[_0x098f('0x21')](respondWithResult(_0x18ed66,null))[_0x098f('0x42')](handleError(_0x18ed66,null));};exports['create']=function(_0x2d0653,_0x43deee){return db[_0x098f('0x27')][_0x098f('0x43')](_0x2d0653[_0x098f('0x44')],{})[_0x098f('0x21')](respondWithResult(_0x43deee,0xc9))[_0x098f('0x42')](handleError(_0x43deee,null));};exports[_0x098f('0x45')]=function(_0x2fb115,_0x5b6953){if(_0x2fb115['body']['id']){delete _0x2fb115[_0x098f('0x44')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x2fb115[_0x098f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5b6953,null))['then'](saveUpdates(_0x2fb115[_0x098f('0x44')],null))[_0x098f('0x21')](respondWithResult(_0x5b6953,null))[_0x098f('0x42')](handleError(_0x5b6953,null));};exports['destroy']=function(_0x22194d,_0xc9d520){return db[_0x098f('0x27')][_0x098f('0x41')]({'where':{'id':_0x22194d[_0x098f('0x3f')]['id']}})[_0x098f('0x21')](handleEntityNotFound(_0xc9d520,null))[_0x098f('0x21')](removeEntity(_0xc9d520,null))[_0x098f('0x42')](handleError(_0xc9d520,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 87563bd..7a70a93 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 _0xbaf3=['lodash','../../config/logger','api','path','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xbaf3,0x84));var _0x3baf=function(_0x4de86b,_0x5eb642){_0x4de86b=_0x4de86b-0x0;var _0x306c57=_0xbaf3[_0x4de86b];return _0x306c57;};'use strict';var _=require(_0x3baf('0x0'));var util=require('util');var logger=require(_0x3baf('0x1'))(_0x3baf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3baf('0x3'));var rimraf=require('rimraf');var config=require(_0x3baf('0x4'));var attributes=require(_0x3baf('0x5'));module[_0x3baf('0x6')]=function(_0x3daa2f,_0x3865c9){return _0x3daa2f[_0x3baf('0x7')](_0x3baf('0x8'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x3baf('0x9'),'fields':[_0x3baf('0xa'),_0x3baf('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd074=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId'];(function(_0x276af0,_0xfcc8e1){var _0x4d2483=function(_0x21df7c){while(--_0x21df7c){_0x276af0['push'](_0x276af0['shift']());}};_0x4d2483(++_0xfcc8e1);}(_0xd074,0x1ad));var _0x4d07=function(_0x1e85db,_0x432aad){_0x1e85db=_0x1e85db-0x0;var _0x11066d=_0xd074[_0x1e85db];return _0x11066d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4d07('0x0'))('api');var moment=require(_0x4d07('0x1'));var BPromise=require('bluebird');var rp=require(_0x4d07('0x2'));var fs=require('fs');var path=require(_0x4d07('0x3'));var rimraf=require(_0x4d07('0x4'));var config=require(_0x4d07('0x5'));var attributes=require(_0x4d07('0x6'));module[_0x4d07('0x7')]=function(_0x1aaa08,_0x5ad24a){return _0x1aaa08[_0x4d07('0x8')](_0x4d07('0x9'),attributes,{'tableName':_0x4d07('0xa'),'paranoid':![],'indexes':[{'name':_0x4d07('0xb'),'fields':['idField',_0x4d07('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 22ab10c..4bf851d 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 _0xa244=['info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x38e9d7,_0x1d1f7b){var _0x6fdf49=function(_0x88b5fb){while(--_0x88b5fb){_0x38e9d7['push'](_0x38e9d7['shift']());}};_0x6fdf49(++_0x1d1f7b);}(_0xa244,0xd8));var _0x4a24=function(_0x3b9d8b,_0x42333b){_0x3b9d8b=_0x3b9d8b-0x0;var _0x566fe5=_0xa244[_0x3b9d8b];return _0x566fe5;};'use strict';var _=require(_0x4a24('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a24('0x1'));var rs=require(_0x4a24('0x2'));var fs=require('fs');var Redis=require(_0x4a24('0x3'));var db=require(_0x4a24('0x4'))['db'];var utils=require(_0x4a24('0x5'));var logger=require(_0x4a24('0x6'))(_0x4a24('0x7'));var config=require(_0x4a24('0x8'));var jayson=require(_0x4a24('0x9'));var client=jayson[_0x4a24('0xa')][_0x4a24('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22b135,_0x1f5ac8,_0x59739e){return new BPromise(function(_0x4dfc00,_0xf2681){return client[_0x4a24('0xc')](_0x22b135,_0x59739e)[_0x4a24('0xd')](function(_0x2085f9){logger[_0x4a24('0xe')](_0x4a24('0xf'),_0x1f5ac8,_0x4a24('0x10'));logger[_0x4a24('0x11')](_0x4a24('0x12'),_0x1f5ac8,'request\x20sent',JSON[_0x4a24('0x13')](_0x2085f9));if(_0x2085f9[_0x4a24('0x14')]){if(_0x2085f9['error']['code']===0x1f4){logger[_0x4a24('0x14')](_0x4a24('0xf'),_0x1f5ac8,_0x2085f9['error']['message']);return _0xf2681(_0x2085f9['error']['message']);}logger[_0x4a24('0x14')](_0x4a24('0xf'),_0x1f5ac8,_0x2085f9['error']['message']);return _0x4dfc00(_0x2085f9[_0x4a24('0x14')][_0x4a24('0x15')]);}else{logger[_0x4a24('0xe')](_0x4a24('0xf'),_0x1f5ac8,_0x4a24('0x10'));_0x4dfc00(_0x2085f9['result']['message']);}})[_0x4a24('0x16')](function(_0x3d680f){logger[_0x4a24('0x14')](_0x4a24('0xf'),_0x1f5ac8,_0x3d680f);_0xf2681(_0x3d680f);});});} \ No newline at end of file +var _0x56f1=['request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\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'];(function(_0x1441d3,_0x46efa9){var _0x2d49dc=function(_0xa17bcd){while(--_0xa17bcd){_0x1441d3['push'](_0x1441d3['shift']());}};_0x2d49dc(++_0x46efa9);}(_0x56f1,0x1b5));var _0x156f=function(_0x3ca597,_0x2aff6e){_0x3ca597=_0x3ca597-0x0;var _0x91e264=_0x56f1[_0x3ca597];return _0x91e264;};'use strict';var _=require(_0x156f('0x0'));var util=require(_0x156f('0x1'));var moment=require(_0x156f('0x2'));var BPromise=require('bluebird');var rs=require(_0x156f('0x3'));var fs=require('fs');var Redis=require(_0x156f('0x4'));var db=require(_0x156f('0x5'))['db'];var utils=require(_0x156f('0x6'));var logger=require(_0x156f('0x7'))(_0x156f('0x8'));var config=require(_0x156f('0x9'));var jayson=require(_0x156f('0xa'));var client=jayson[_0x156f('0xb')][_0x156f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x295cfb,_0x4a6df4,_0xe72552){return new BPromise(function(_0x554956,_0xb9490d){return client[_0x156f('0xd')](_0x295cfb,_0xe72552)[_0x156f('0xe')](function(_0x56f8c2){logger['info'](_0x156f('0xf'),_0x4a6df4,_0x156f('0x10'));logger[_0x156f('0x11')](_0x156f('0x12'),_0x4a6df4,_0x156f('0x10'),JSON[_0x156f('0x13')](_0x56f8c2));if(_0x56f8c2[_0x156f('0x14')]){if(_0x56f8c2[_0x156f('0x14')][_0x156f('0x15')]===0x1f4){logger[_0x156f('0x14')]('VtigerField,\x20%s,\x20%s',_0x4a6df4,_0x56f8c2['error'][_0x156f('0x16')]);return _0xb9490d(_0x56f8c2[_0x156f('0x14')][_0x156f('0x16')]);}logger[_0x156f('0x14')]('VtigerField,\x20%s,\x20%s',_0x4a6df4,_0x56f8c2[_0x156f('0x14')]['message']);return _0x554956(_0x56f8c2[_0x156f('0x14')][_0x156f('0x16')]);}else{logger['info'](_0x156f('0xf'),_0x4a6df4,_0x156f('0x10'));_0x554956(_0x56f8c2[_0x156f('0x17')]['message']);}})[_0x156f('0x18')](function(_0x422942){logger['error'](_0x156f('0xf'),_0x4a6df4,_0x422942);_0xb9490d(_0x422942);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 201c10e..df906c6 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 _0x8313=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x369ae9,_0x48e933){var _0x8b8ae4=function(_0x3903cf){while(--_0x3903cf){_0x369ae9['push'](_0x369ae9['shift']());}};_0x8b8ae4(++_0x48e933);}(_0x8313,0x19e));var _0x3831=function(_0x5139dd,_0x4cfa18){_0x5139dd=_0x5139dd-0x0;var _0x1bb972=_0x8313[_0x5139dd];return _0x1bb972;};'use strict';var multer=require(_0x3831('0x0'));var util=require(_0x3831('0x1'));var path=require(_0x3831('0x2'));var timeout=require('connect-timeout');var express=require(_0x3831('0x3'));var router=express['Router']();var fs_extra=require(_0x3831('0x4'));var auth=require(_0x3831('0x5'));var interaction=require(_0x3831('0x6'));var config=require(_0x3831('0x7'));var controller=require(_0x3831('0x8'));router[_0x3831('0x9')]('/',auth[_0x3831('0xa')](),controller['index']);router[_0x3831('0x9')](_0x3831('0xb'),auth[_0x3831('0xa')](),controller['show']);router['get'](_0x3831('0xc'),auth[_0x3831('0xa')](),controller[_0x3831('0xd')]);router[_0x3831('0x9')](_0x3831('0xe'),auth[_0x3831('0xa')](),controller['getFields']);router[_0x3831('0xf')]('/',auth[_0x3831('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0x3831('0xa')](),controller[_0x3831('0x10')]);router[_0x3831('0x11')](_0x3831('0xb'),auth[_0x3831('0xa')](),controller[_0x3831('0x12')]);router[_0x3831('0x13')](_0x3831('0xb'),auth[_0x3831('0xa')](),controller[_0x3831('0x14')]);module[_0x3831('0x15')]=router; \ No newline at end of file +var _0xb128=['./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0xb128,0x1f1));var _0x8b12=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xb128[_0x2b9b7f];return _0x4ed19a;};'use strict';var multer=require('multer');var util=require(_0x8b12('0x0'));var path=require(_0x8b12('0x1'));var timeout=require(_0x8b12('0x2'));var express=require(_0x8b12('0x3'));var router=express[_0x8b12('0x4')]();var fs_extra=require(_0x8b12('0x5'));var auth=require(_0x8b12('0x6'));var interaction=require(_0x8b12('0x7'));var config=require(_0x8b12('0x8'));var controller=require(_0x8b12('0x9'));router[_0x8b12('0xa')]('/',auth[_0x8b12('0xb')](),controller[_0x8b12('0xc')]);router[_0x8b12('0xa')](_0x8b12('0xd'),auth[_0x8b12('0xb')](),controller[_0x8b12('0xe')]);router[_0x8b12('0xa')]('/:id/configurations',auth[_0x8b12('0xb')](),controller[_0x8b12('0xf')]);router[_0x8b12('0xa')](_0x8b12('0x10'),auth[_0x8b12('0xb')](),controller['getFields']);router[_0x8b12('0x11')]('/',auth[_0x8b12('0xb')](),controller[_0x8b12('0x12')]);router[_0x8b12('0x11')]('/:id/configurations',auth[_0x8b12('0xb')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8b12('0x13')]);router[_0x8b12('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8b12('0x15')]);module[_0x8b12('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5cabafb..9667b62 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 _0xf2e3=['integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','token','password'];(function(_0x2cb321,_0x4966fe){var _0x24c609=function(_0x4ed75d){while(--_0x4ed75d){_0x2cb321['push'](_0x2cb321['shift']());}};_0x24c609(++_0x4966fe);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xf2e3[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f2e('0x1')]},'description':{'type':Sequelize[_0x3f2e('0x1')]},'username':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x2')},'password':{'type':Sequelize[_0x3f2e('0x1')]},'token':{'type':Sequelize[_0x3f2e('0x1')]},'remoteUri':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x3')},'authType':{'type':Sequelize[_0x3f2e('0x4')]('password',_0x3f2e('0x5')),'defaultValue':_0x3f2e('0x6')},'serverUrl':{'type':Sequelize[_0x3f2e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3f2e('0x4')](_0x3f2e('0x7'),_0x3f2e('0x8')),'defaultValue':_0x3f2e('0x7')}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0x7b84,0x17c));var _0x47b8=function(_0xdb3f0e,_0x435f21){_0xdb3f0e=_0xdb3f0e-0x0;var _0xfb297d=_0x7b84[_0xdb3f0e];return _0xfb297d;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'name':{'type':Sequelize[_0x47b8('0x2')]},'description':{'type':Sequelize[_0x47b8('0x2')]},'username':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x3')},'password':{'type':Sequelize[_0x47b8('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x4')},'authType':{'type':Sequelize[_0x47b8('0x5')](_0x47b8('0x6'),_0x47b8('0x7')),'defaultValue':_0x47b8('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x47b8('0x5')](_0x47b8('0x8'),_0x47b8('0x9')),'defaultValue':_0x47b8('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 388f37d..ea73ca3 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 _0x3c81=['toString','base64','headers','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','name','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','ZendeskAccount','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','getConfigurations','findOne','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','ZendeskConfiguration','ZendeskField','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','authType','Basic\x20%s','%s:%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3c81,0x102));var _0x13c8=function(_0x181399,_0x45b52d){_0x181399=_0x181399-0x0;var _0x4f633e=_0x3c81[_0x181399];return _0x4f633e;};'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'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x21442d,_0x7b6da8){_0x7b6da8=_0x7b6da8||0xcc;return function(_0x2304b5){if(_0x2304b5){return _0x21442d[_0x13c8('0x19')](_0x7b6da8);}return _0x21442d['status'](_0x7b6da8)[_0x13c8('0x1a')]();};}function respondWithResult(_0x515681,_0x4d7a88){_0x4d7a88=_0x4d7a88||0xc8;return function(_0x589636){if(_0x589636){return _0x515681[_0x13c8('0x1b')](_0x4d7a88)['json'](_0x589636);}};}function respondWithFilteredResult(_0x337397,_0x17a3c1){return function(_0x23f64e){if(_0x23f64e){var _0x7cbfb=typeof _0x17a3c1['offset']===_0x13c8('0x1c')&&typeof _0x17a3c1[_0x13c8('0x1d')]===_0x13c8('0x1c');var _0x3bc5a9=_0x23f64e[_0x13c8('0x1e')];var _0x28f07e=_0x7cbfb?0x0:_0x17a3c1[_0x13c8('0x1f')];var _0x251c38=_0x7cbfb?_0x23f64e[_0x13c8('0x1e')]:_0x17a3c1[_0x13c8('0x1f')]+_0x17a3c1[_0x13c8('0x1d')];var _0x5ac776;if(_0x251c38>=_0x3bc5a9){_0x251c38=_0x3bc5a9;_0x5ac776=0xc8;}else{_0x5ac776=0xce;}_0x337397[_0x13c8('0x1b')](_0x5ac776);return _0x337397[_0x13c8('0x20')](_0x13c8('0x21'),_0x28f07e+'-'+_0x251c38+'/'+_0x3bc5a9)[_0x13c8('0x22')](_0x23f64e);}return null;};}function patchUpdates(_0x513085){return function(_0x1fb714){try{jsonpatch[_0x13c8('0x23')](_0x1fb714,_0x513085,!![]);}catch(_0x3e3951){return BPromise[_0x13c8('0x24')](_0x3e3951);}return _0x1fb714[_0x13c8('0x25')]();};}function saveUpdates(_0x2fc123,_0x5ab47f){return function(_0x28f99c){if(_0x28f99c){return _0x28f99c[_0x13c8('0x26')](_0x2fc123)[_0x13c8('0x27')](function(_0xcf41d2){return _0xcf41d2;});}return null;};}function removeEntity(_0x577df6,_0x1770e5){return function(_0x458217){if(_0x458217){return _0x458217['destroy']()['then'](function(){_0x577df6[_0x13c8('0x1b')](0xcc)[_0x13c8('0x1a')]();});}};}function handleEntityNotFound(_0x47e8ae,_0x5ad0dc){return function(_0x288c3c){if(!_0x288c3c){_0x47e8ae[_0x13c8('0x19')](0x194);}return _0x288c3c;};}function handleError(_0x53ada9,_0x4df077){_0x4df077=_0x4df077||0x1f4;return function(_0x196983){logger['error'](_0x196983['stack']);if(_0x196983[_0x13c8('0x28')]){delete _0x196983[_0x13c8('0x28')];}_0x53ada9[_0x13c8('0x1b')](_0x4df077)['send'](_0x196983);};}exports['index']=function(_0x277a89,_0x1071a0){var _0x399840={},_0x441182={},_0x138017={'count':0x0,'rows':[]};var _0x220d40=_[_0x13c8('0x29')](db['ZendeskAccount'][_0x13c8('0x2a')],function(_0xcbc9b7){return{'name':_0xcbc9b7['fieldName'],'type':_0xcbc9b7['type'][_0x13c8('0x2b')]};});_0x441182[_0x13c8('0x2c')]=_['map'](_0x220d40,_0x13c8('0x28'));_0x441182[_0x13c8('0x2d')]=_['keys'](_0x277a89[_0x13c8('0x2d')]);_0x441182[_0x13c8('0x2e')]=_[_0x13c8('0x2f')](_0x441182[_0x13c8('0x2c')],_0x441182[_0x13c8('0x2d')]);_0x399840[_0x13c8('0x30')]=_[_0x13c8('0x2f')](_0x441182[_0x13c8('0x2c')],qs['fields'](_0x277a89['query'][_0x13c8('0x31')]));_0x399840[_0x13c8('0x30')]=_0x399840['attributes'][_0x13c8('0x32')]?_0x399840['attributes']:_0x441182[_0x13c8('0x2c')];if(!_0x277a89['query'][_0x13c8('0x33')](_0x13c8('0x34'))){_0x399840[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x277a89[_0x13c8('0x2d')][_0x13c8('0x1d')]);_0x399840[_0x13c8('0x1f')]=qs['offset'](_0x277a89[_0x13c8('0x2d')][_0x13c8('0x1f')]);}_0x399840['order']=qs[_0x13c8('0x35')](_0x277a89[_0x13c8('0x2d')][_0x13c8('0x35')]);_0x399840['where']=qs['filters'](_['pick'](_0x277a89[_0x13c8('0x2d')],_0x441182[_0x13c8('0x2e')]),_0x220d40);if(_0x277a89[_0x13c8('0x2d')][_0x13c8('0x36')]){_0x399840[_0x13c8('0x37')]=_[_0x13c8('0x38')](_0x399840[_0x13c8('0x37')],{'$or':_[_0x13c8('0x29')](_0x220d40,function(_0xf818be){if(_0xf818be['type']!=='VIRTUAL'){var _0x27e11b={};_0x27e11b[_0xf818be[_0x13c8('0x28')]]={'$like':'%'+_0x277a89[_0x13c8('0x2d')][_0x13c8('0x36')]+'%'};return _0x27e11b;}})});}_0x399840=_['merge']({},_0x399840,_0x277a89[_0x13c8('0x39')]);var _0x4bd627={'where':_0x399840[_0x13c8('0x37')]};return db[_0x13c8('0x3a')][_0x13c8('0x1e')](_0x4bd627)[_0x13c8('0x27')](function(_0xbb1d49){_0x138017[_0x13c8('0x1e')]=_0xbb1d49;if(_0x277a89[_0x13c8('0x2d')][_0x13c8('0x3b')]){_0x399840[_0x13c8('0x3c')]=[{'all':!![]}];}return db[_0x13c8('0x3a')][_0x13c8('0x3d')](_0x399840);})[_0x13c8('0x27')](function(_0x89bbab){_0x138017[_0x13c8('0x3e')]=_0x89bbab;return _0x138017;})[_0x13c8('0x27')](respondWithFilteredResult(_0x1071a0,_0x399840))[_0x13c8('0x3f')](handleError(_0x1071a0,null));};exports[_0x13c8('0x40')]=function(_0x1505fb,_0xc5eb86){var _0x1cff99={'raw':![],'where':{'id':_0x1505fb[_0x13c8('0x41')]['id']}},_0x3622d6={};_0x3622d6[_0x13c8('0x2c')]=_[_0x13c8('0x42')](db[_0x13c8('0x3a')]['rawAttributes']);_0x3622d6[_0x13c8('0x2d')]=_[_0x13c8('0x42')](_0x1505fb[_0x13c8('0x2d')]);_0x3622d6[_0x13c8('0x2e')]=_[_0x13c8('0x2f')](_0x3622d6['model'],_0x3622d6['query']);_0x1cff99[_0x13c8('0x30')]=_[_0x13c8('0x2f')](_0x3622d6[_0x13c8('0x2c')],qs['fields'](_0x1505fb['query']['fields']));_0x1cff99[_0x13c8('0x30')]=_0x1cff99['attributes'][_0x13c8('0x32')]?_0x1cff99['attributes']:_0x3622d6[_0x13c8('0x2c')];if(_0x1505fb[_0x13c8('0x2d')][_0x13c8('0x3b')]){_0x1cff99[_0x13c8('0x3c')]=[{'all':!![]}];}_0x1cff99=_[_0x13c8('0x38')]({},_0x1cff99,_0x1505fb[_0x13c8('0x39')]);return db['ZendeskAccount'][_0x13c8('0x43')](_0x1cff99)[_0x13c8('0x27')](handleEntityNotFound(_0xc5eb86,null))['then'](respondWithResult(_0xc5eb86,null))[_0x13c8('0x3f')](handleError(_0xc5eb86,null));};exports[_0x13c8('0x44')]=function(_0x2e925f,_0x162918){return db[_0x13c8('0x3a')]['create'](_0x2e925f[_0x13c8('0x45')],{})[_0x13c8('0x27')](respondWithResult(_0x162918,0xc9))[_0x13c8('0x3f')](handleError(_0x162918,null));};exports[_0x13c8('0x26')]=function(_0x185d18,_0x59ec9f){if(_0x185d18[_0x13c8('0x45')]['id']){delete _0x185d18[_0x13c8('0x45')]['id'];}return db[_0x13c8('0x3a')][_0x13c8('0x43')]({'where':{'id':_0x185d18[_0x13c8('0x41')]['id']}})[_0x13c8('0x27')](handleEntityNotFound(_0x59ec9f,null))[_0x13c8('0x27')](saveUpdates(_0x185d18[_0x13c8('0x45')],null))[_0x13c8('0x27')](respondWithResult(_0x59ec9f,null))[_0x13c8('0x3f')](handleError(_0x59ec9f,null));};exports[_0x13c8('0x46')]=function(_0x5e1fe5,_0x10ba7c){return db[_0x13c8('0x3a')][_0x13c8('0x43')]({'where':{'id':_0x5e1fe5[_0x13c8('0x41')]['id']}})[_0x13c8('0x27')](handleEntityNotFound(_0x10ba7c,null))[_0x13c8('0x27')](removeEntity(_0x10ba7c,null))['catch'](handleError(_0x10ba7c,null));};exports[_0x13c8('0x47')]=function(_0x416e4f,_0x2f1e83,_0x481205){var _0x54e0c8={};var _0x3d4863={};var _0x14a738;var _0x55d353;return db[_0x13c8('0x3a')][_0x13c8('0x48')]({'where':{'id':_0x416e4f['params']['id']}})[_0x13c8('0x27')](handleEntityNotFound(_0x2f1e83,null))['then'](function(_0x242791){if(_0x242791){_0x14a738=_0x242791;_0x3d4863[_0x13c8('0x2c')]=_[_0x13c8('0x42')](db['ZendeskConfiguration'][_0x13c8('0x2a')]);_0x3d4863[_0x13c8('0x2d')]=_['keys'](_0x416e4f[_0x13c8('0x2d')]);_0x3d4863['filters']=_[_0x13c8('0x2f')](_0x3d4863[_0x13c8('0x2c')],_0x3d4863[_0x13c8('0x2d')]);_0x54e0c8[_0x13c8('0x30')]=_[_0x13c8('0x2f')](_0x3d4863['model'],qs[_0x13c8('0x31')](_0x416e4f['query']['fields']));_0x54e0c8['attributes']=_0x54e0c8['attributes']['length']?_0x54e0c8[_0x13c8('0x30')]:_0x3d4863[_0x13c8('0x2c')];_0x54e0c8[_0x13c8('0x49')]=qs[_0x13c8('0x35')](_0x416e4f[_0x13c8('0x2d')][_0x13c8('0x35')]);_0x54e0c8[_0x13c8('0x37')]=qs['filters'](_['pick'](_0x416e4f[_0x13c8('0x2d')],_0x3d4863[_0x13c8('0x2e')]));if(_0x416e4f[_0x13c8('0x2d')][_0x13c8('0x36')]){_0x54e0c8[_0x13c8('0x37')]=_[_0x13c8('0x38')](_0x54e0c8[_0x13c8('0x37')],{'$or':_[_0x13c8('0x29')](_0x54e0c8['attributes'],function(_0x371410){var _0x326f90={};_0x326f90[_0x371410]={'$like':'%'+_0x416e4f['query'][_0x13c8('0x36')]+'%'};return _0x326f90;})});}_0x54e0c8=_[_0x13c8('0x38')]({},_0x54e0c8,_0x416e4f[_0x13c8('0x39')]);return _0x14a738[_0x13c8('0x47')](_0x54e0c8);}})[_0x13c8('0x27')](function(_0x1f823f){if(_0x1f823f){_0x55d353=_0x1f823f[_0x13c8('0x32')];if(!_0x416e4f[_0x13c8('0x2d')][_0x13c8('0x33')](_0x13c8('0x34'))){_0x54e0c8[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x416e4f[_0x13c8('0x2d')][_0x13c8('0x1d')]);_0x54e0c8[_0x13c8('0x1f')]=qs[_0x13c8('0x1f')](_0x416e4f['query'][_0x13c8('0x1f')]);}return _0x14a738['getConfigurations'](_0x54e0c8);}})[_0x13c8('0x27')](function(_0xe861ad){if(_0xe861ad){return _0xe861ad?{'count':_0x55d353,'rows':_0xe861ad}:null;}})['then'](respondWithResult(_0x2f1e83,null))[_0x13c8('0x3f')](handleError(_0x2f1e83,null));};exports[_0x13c8('0x4a')]=function(_0x5539e8,_0x38fd82,_0x19330c){if(_0x5539e8[_0x13c8('0x45')]['id']){delete _0x5539e8[_0x13c8('0x45')]['id'];}return db[_0x13c8('0x3a')][_0x13c8('0x48')]({'where':{'id':_0x5539e8[_0x13c8('0x41')]['id']}})[_0x13c8('0x27')](handleEntityNotFound(_0x38fd82,null))[_0x13c8('0x27')](function(_0xee69b){if(_0xee69b){_0x5539e8[_0x13c8('0x45')]['AccountId']=_0xee69b['id'];_0x5539e8[_0x13c8('0x45')][_0x13c8('0x4b')]=integrations[_0x13c8('0x4c')](_0x5539e8[_0x13c8('0x45')][_0x13c8('0x4d')],_0x5539e8[_0x13c8('0x45')]['type']);_0x5539e8[_0x13c8('0x45')][_0x13c8('0x4e')]=integrations[_0x13c8('0x4f')](_0x5539e8['body'][_0x13c8('0x4d')],_0x5539e8[_0x13c8('0x45')][_0x13c8('0x50')]);return db[_0x13c8('0x51')][_0x13c8('0x44')](_0x5539e8[_0x13c8('0x45')],{'include':[{'model':db['ZendeskField'],'as':_0x13c8('0x4b')},{'model':db[_0x13c8('0x52')],'as':_0x13c8('0x4e')}]});}return null;})[_0x13c8('0x27')](respondWithResult(_0x38fd82,null))['catch'](handleError(_0x38fd82,null));};exports[_0x13c8('0x53')]=function(_0x2d552d,_0x258447,_0x308482){var _0x179a86='';return db[_0x13c8('0x3a')][_0x13c8('0x48')]({'where':{'id':_0x2d552d['params']['id']},'attributes':['id',_0x13c8('0x54'),_0x13c8('0x55'),_0x13c8('0x56'),'authType',_0x13c8('0x57')]})[_0x13c8('0x27')](handleEntityNotFound(_0x258447,null))['then'](function(_0x58728a){if(_0x58728a){_0x179a86=_0x58728a[_0x13c8('0x57')];var _0x5eb649=_0x179a86[_0x13c8('0x58')](-0x1);if(_0x5eb649==='/'){_0x179a86=_0x179a86['substring'](0x0,_0x179a86[_0x13c8('0x59')](_0x5eb649));}var _0x39aefc={'method':_0x13c8('0x5a'),'uri':util[_0x13c8('0x5b')](_0x13c8('0x5c'),_0x179a86,'ticket_fields'),'json':!![]};switch(_0x58728a[_0x13c8('0x5d')]){case _0x13c8('0x55'):_0x39aefc['headers']={'Authorization':util[_0x13c8('0x5b')](_0x13c8('0x5e'),new Buffer(util[_0x13c8('0x5b')](_0x13c8('0x5f'),_0x58728a[_0x13c8('0x54')],_0x58728a[_0x13c8('0x55')]))[_0x13c8('0x60')](_0x13c8('0x61')))};break;case _0x13c8('0x56'):_0x39aefc[_0x13c8('0x62')]={'Authorization':util['format'](_0x13c8('0x5e'),new Buffer(util[_0x13c8('0x5b')]('%s/token:%s',_0x58728a['username'],_0x58728a[_0x13c8('0x56')]))[_0x13c8('0x60')](_0x13c8('0x61')))};break;default:throw new db[(_0x13c8('0x63'))][(_0x13c8('0x64'))](_0x13c8('0x65'));}return rp(_0x39aefc);}})['then'](function(_0x18afe7){if(_0x18afe7){var _0x368f45=[_0x13c8('0x66'),_0x13c8('0x67'),_0x13c8('0x68'),'assignee'];_[_0x13c8('0x69')](_0x18afe7[_0x13c8('0x6a')],function(_0x564cc9){return _0x368f45[_0x13c8('0x6b')](_0x564cc9[_0x13c8('0x50')]);});return{'count':_0x18afe7['ticket_fields'][_0x13c8('0x32')],'rows':_['map'](_0x18afe7[_0x13c8('0x6a')],function(_0x5a4e0a){return{'id':_0x5a4e0a['id'],'name':_0x5a4e0a[_0x13c8('0x6c')]>0x7?_0x5a4e0a[_0x13c8('0x6d')]:_0x5a4e0a[_0x13c8('0x50')],'custom':_0x5a4e0a['position']>0x7?!![]:![],'options':_0x5a4e0a[_0x13c8('0x6e')]?_0x5a4e0a['system_field_options']:_0x5a4e0a['custom_field_options']?_0x5a4e0a[_0x13c8('0x6f')]:[]};})};}})[_0x13c8('0x27')](respondWithResult(_0x258447,null))[_0x13c8('0x3f')](function(_0x1e3097){var _0x4d6477=_0x2d552d['query'][_0x13c8('0x70')]?0x1f4:_0x1e3097['statusCode']||0x1f4;logger['error'](_0x13c8('0x71'),_0x13c8('0x53'),_0x4d6477,JSON[_0x13c8('0x72')](_0x1e3097));delete _0x1e3097[_0x13c8('0x28')];if(_0x4d6477===0x191){_0x4d6477=0x190;}_0x258447['status'](_0x4d6477)[_0x13c8('0x73')](_0x2d552d['query']['test']?{'message':_0x13c8('0x74'),'statusCode':_0x1e3097[_0x13c8('0x75')]}:_0x1e3097);});}; \ No newline at end of file +var _0x757a=['rimraf','zip-dir','bluebird','mustache','util','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','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','name','ZendeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','getConfigurations','findOne','ZendeskConfiguration','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials'];(function(_0x647e25,_0x42f0c8){var _0x1f674e=function(_0x3815c5){while(--_0x3815c5){_0x647e25['push'](_0x647e25['shift']());}};_0x1f674e(++_0x42f0c8);}(_0x757a,0xde));var _0xa757=function(_0x126313,_0x331d05){_0x126313=_0x126313-0x0;var _0x6aa57d=_0x757a[_0x126313];return _0x6aa57d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));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(_0x421040,_0x544b45){_0x544b45=_0x544b45||0xcc;return function(_0x564187){if(_0x564187){return _0x421040[_0xa757('0x15')](_0x544b45);}return _0x421040['status'](_0x544b45)['end']();};}function respondWithResult(_0x32112b,_0x1b670e){_0x1b670e=_0x1b670e||0xc8;return function(_0x355f0a){if(_0x355f0a){return _0x32112b[_0xa757('0x16')](_0x1b670e)[_0xa757('0x17')](_0x355f0a);}};}function respondWithFilteredResult(_0x31cfd2,_0xf12b68){return function(_0x2f7947){if(_0x2f7947){var _0x185011=typeof _0xf12b68[_0xa757('0x18')]==='undefined'&&typeof _0xf12b68[_0xa757('0x19')]===_0xa757('0x1a');var _0xde8248=_0x2f7947['count'];var _0x54b305=_0x185011?0x0:_0xf12b68[_0xa757('0x18')];var _0x468d45=_0x185011?_0x2f7947[_0xa757('0x1b')]:_0xf12b68[_0xa757('0x18')]+_0xf12b68[_0xa757('0x19')];var _0xe2d567;if(_0x468d45>=_0xde8248){_0x468d45=_0xde8248;_0xe2d567=0xc8;}else{_0xe2d567=0xce;}_0x31cfd2['status'](_0xe2d567);return _0x31cfd2[_0xa757('0x1c')]('Content-Range',_0x54b305+'-'+_0x468d45+'/'+_0xde8248)[_0xa757('0x17')](_0x2f7947);}return null;};}function patchUpdates(_0x167640){return function(_0x14014c){try{jsonpatch[_0xa757('0x1d')](_0x14014c,_0x167640,!![]);}catch(_0x4d598c){return BPromise['reject'](_0x4d598c);}return _0x14014c[_0xa757('0x1e')]();};}function saveUpdates(_0x2159cf,_0x2ba923){return function(_0x8d121f){if(_0x8d121f){return _0x8d121f[_0xa757('0x1f')](_0x2159cf)[_0xa757('0x20')](function(_0x2ca10d){return _0x2ca10d;});}return null;};}function removeEntity(_0x21f1af,_0x2bf276){return function(_0x59fae6){if(_0x59fae6){return _0x59fae6[_0xa757('0x21')]()['then'](function(){_0x21f1af[_0xa757('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40551d,_0x3859ce){return function(_0x37c7e6){if(!_0x37c7e6){_0x40551d['sendStatus'](0x194);}return _0x37c7e6;};}function handleError(_0x2b19d5,_0xcd98bd){_0xcd98bd=_0xcd98bd||0x1f4;return function(_0x471e84){logger[_0xa757('0x22')](_0x471e84['stack']);if(_0x471e84[_0xa757('0x23')]){delete _0x471e84['name'];}_0x2b19d5['status'](_0xcd98bd)['send'](_0x471e84);};}exports['index']=function(_0xfdf69d,_0x596ae2){var _0x2208f9={},_0x3bc24c={},_0x55c5f8={'count':0x0,'rows':[]};var _0x2a0c9a=_['map'](db[_0xa757('0x24')][_0xa757('0x25')],function(_0x5307c3){return{'name':_0x5307c3[_0xa757('0x26')],'type':_0x5307c3['type'][_0xa757('0x27')]};});_0x3bc24c[_0xa757('0x28')]=_[_0xa757('0x29')](_0x2a0c9a,_0xa757('0x23'));_0x3bc24c[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0xfdf69d[_0xa757('0x2a')]);_0x3bc24c[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],_0x3bc24c[_0xa757('0x2a')]);_0x2208f9[_0xa757('0x2e')]=_[_0xa757('0x2d')](_0x3bc24c[_0xa757('0x28')],qs[_0xa757('0x2f')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x2f')]));_0x2208f9[_0xa757('0x2e')]=_0x2208f9[_0xa757('0x2e')][_0xa757('0x30')]?_0x2208f9[_0xa757('0x2e')]:_0x3bc24c[_0xa757('0x28')];if(!_0xfdf69d[_0xa757('0x2a')][_0xa757('0x31')]('nolimit')){_0x2208f9[_0xa757('0x19')]=qs[_0xa757('0x19')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x19')]);_0x2208f9[_0xa757('0x18')]=qs['offset'](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x18')]);}_0x2208f9[_0xa757('0x32')]=qs[_0xa757('0x33')](_0xfdf69d[_0xa757('0x2a')][_0xa757('0x33')]);_0x2208f9['where']=qs[_0xa757('0x2c')](_[_0xa757('0x34')](_0xfdf69d[_0xa757('0x2a')],_0x3bc24c[_0xa757('0x2c')]),_0x2a0c9a);if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x35')]){_0x2208f9[_0xa757('0x36')]=_[_0xa757('0x37')](_0x2208f9[_0xa757('0x36')],{'$or':_['map'](_0x2a0c9a,function(_0x300be4){if(_0x300be4[_0xa757('0x38')]!==_0xa757('0x39')){var _0x35c15a={};_0x35c15a[_0x300be4[_0xa757('0x23')]]={'$like':'%'+_0xfdf69d[_0xa757('0x2a')]['filter']+'%'};return _0x35c15a;}})});}_0x2208f9=_[_0xa757('0x37')]({},_0x2208f9,_0xfdf69d[_0xa757('0x3a')]);var _0x48cde9={'where':_0x2208f9['where']};return db[_0xa757('0x24')][_0xa757('0x1b')](_0x48cde9)['then'](function(_0x51c3d1){_0x55c5f8[_0xa757('0x1b')]=_0x51c3d1;if(_0xfdf69d[_0xa757('0x2a')][_0xa757('0x3b')]){_0x2208f9['include']=[{'all':!![]}];}return db[_0xa757('0x24')][_0xa757('0x3c')](_0x2208f9);})[_0xa757('0x20')](function(_0x1ba399){_0x55c5f8[_0xa757('0x3d')]=_0x1ba399;return _0x55c5f8;})['then'](respondWithFilteredResult(_0x596ae2,_0x2208f9))[_0xa757('0x3e')](handleError(_0x596ae2,null));};exports['show']=function(_0x564d40,_0x43329c){var _0x57298b={'raw':![],'where':{'id':_0x564d40[_0xa757('0x3f')]['id']}},_0x373747={};_0x373747[_0xa757('0x28')]=_['keys'](db['ZendeskAccount'][_0xa757('0x25')]);_0x373747[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x564d40[_0xa757('0x2a')]);_0x373747[_0xa757('0x2c')]=_[_0xa757('0x2d')](_0x373747['model'],_0x373747[_0xa757('0x2a')]);_0x57298b[_0xa757('0x2e')]=_['intersection'](_0x373747[_0xa757('0x28')],qs['fields'](_0x564d40[_0xa757('0x2a')][_0xa757('0x2f')]));_0x57298b['attributes']=_0x57298b[_0xa757('0x2e')][_0xa757('0x30')]?_0x57298b['attributes']:_0x373747[_0xa757('0x28')];if(_0x564d40[_0xa757('0x2a')][_0xa757('0x3b')]){_0x57298b[_0xa757('0x40')]=[{'all':!![]}];}_0x57298b=_['merge']({},_0x57298b,_0x564d40[_0xa757('0x3a')]);return db[_0xa757('0x24')][_0xa757('0x41')](_0x57298b)[_0xa757('0x20')](handleEntityNotFound(_0x43329c,null))['then'](respondWithResult(_0x43329c,null))[_0xa757('0x3e')](handleError(_0x43329c,null));};exports['create']=function(_0x50c131,_0x2acf88){return db[_0xa757('0x24')][_0xa757('0x42')](_0x50c131['body'],{})[_0xa757('0x20')](respondWithResult(_0x2acf88,0xc9))['catch'](handleError(_0x2acf88,null));};exports[_0xa757('0x1f')]=function(_0x151cc3,_0x265793){if(_0x151cc3[_0xa757('0x43')]['id']){delete _0x151cc3[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x151cc3[_0xa757('0x3f')]['id']}})['then'](handleEntityNotFound(_0x265793,null))[_0xa757('0x20')](saveUpdates(_0x151cc3[_0xa757('0x43')],null))[_0xa757('0x20')](respondWithResult(_0x265793,null))[_0xa757('0x3e')](handleError(_0x265793,null));};exports[_0xa757('0x21')]=function(_0x1f10cf,_0x15bad7){return db[_0xa757('0x24')][_0xa757('0x41')]({'where':{'id':_0x1f10cf[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x15bad7,null))[_0xa757('0x20')](removeEntity(_0x15bad7,null))[_0xa757('0x3e')](handleError(_0x15bad7,null));};exports[_0xa757('0x44')]=function(_0x388573,_0x23caca,_0x492e7e){var _0x3b5116={};var _0x51157e={};var _0x48af6e;var _0x311c25;return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x388573['params']['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x23caca,null))[_0xa757('0x20')](function(_0x8614f9){if(_0x8614f9){_0x48af6e=_0x8614f9;_0x51157e[_0xa757('0x28')]=_['keys'](db[_0xa757('0x46')][_0xa757('0x25')]);_0x51157e[_0xa757('0x2a')]=_[_0xa757('0x2b')](_0x388573[_0xa757('0x2a')]);_0x51157e[_0xa757('0x2c')]=_['intersection'](_0x51157e['model'],_0x51157e['query']);_0x3b5116['attributes']=_[_0xa757('0x2d')](_0x51157e[_0xa757('0x28')],qs[_0xa757('0x2f')](_0x388573[_0xa757('0x2a')][_0xa757('0x2f')]));_0x3b5116[_0xa757('0x2e')]=_0x3b5116['attributes'][_0xa757('0x30')]?_0x3b5116[_0xa757('0x2e')]:_0x51157e[_0xa757('0x28')];_0x3b5116[_0xa757('0x32')]=qs['sort'](_0x388573[_0xa757('0x2a')][_0xa757('0x33')]);_0x3b5116['where']=qs[_0xa757('0x2c')](_['pick'](_0x388573[_0xa757('0x2a')],_0x51157e['filters']));if(_0x388573[_0xa757('0x2a')]['filter']){_0x3b5116['where']=_[_0xa757('0x37')](_0x3b5116[_0xa757('0x36')],{'$or':_[_0xa757('0x29')](_0x3b5116[_0xa757('0x2e')],function(_0x14e226){var _0xc5ae37={};_0xc5ae37[_0x14e226]={'$like':'%'+_0x388573['query']['filter']+'%'};return _0xc5ae37;})});}_0x3b5116=_[_0xa757('0x37')]({},_0x3b5116,_0x388573[_0xa757('0x3a')]);return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})['then'](function(_0x55a7d2){if(_0x55a7d2){_0x311c25=_0x55a7d2[_0xa757('0x30')];if(!_0x388573[_0xa757('0x2a')][_0xa757('0x31')](_0xa757('0x47'))){_0x3b5116[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x388573['query'][_0xa757('0x19')]);_0x3b5116[_0xa757('0x18')]=qs[_0xa757('0x18')](_0x388573[_0xa757('0x2a')][_0xa757('0x18')]);}return _0x48af6e[_0xa757('0x44')](_0x3b5116);}})[_0xa757('0x20')](function(_0x13dd81){if(_0x13dd81){return _0x13dd81?{'count':_0x311c25,'rows':_0x13dd81}:null;}})[_0xa757('0x20')](respondWithResult(_0x23caca,null))[_0xa757('0x3e')](handleError(_0x23caca,null));};exports['addConfiguration']=function(_0x9e96e6,_0x5c803a,_0x5851fd){if(_0x9e96e6[_0xa757('0x43')]['id']){delete _0x9e96e6[_0xa757('0x43')]['id'];}return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x9e96e6[_0xa757('0x3f')]['id']}})[_0xa757('0x20')](handleEntityNotFound(_0x5c803a,null))[_0xa757('0x20')](function(_0x32e0b9){if(_0x32e0b9){_0x9e96e6[_0xa757('0x43')][_0xa757('0x48')]=_0x32e0b9['id'];_0x9e96e6[_0xa757('0x43')]['Subjects']=integrations[_0xa757('0x49')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')][_0xa757('0x38')]);_0x9e96e6[_0xa757('0x43')][_0xa757('0x4a')]=integrations[_0xa757('0x4b')](_0x9e96e6[_0xa757('0x43')]['channel'],_0x9e96e6[_0xa757('0x43')]['type']);return db[_0xa757('0x46')][_0xa757('0x42')](_0x9e96e6[_0xa757('0x43')],{'include':[{'model':db[_0xa757('0x4c')],'as':_0xa757('0x4d')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xa757('0x20')](respondWithResult(_0x5c803a,null))[_0xa757('0x3e')](handleError(_0x5c803a,null));};exports[_0xa757('0x4e')]=function(_0x5f450f,_0x115a94,_0x55bc0f){var _0x34982a='';return db[_0xa757('0x24')][_0xa757('0x45')]({'where':{'id':_0x5f450f[_0xa757('0x3f')]['id']},'attributes':['id',_0xa757('0x4f'),_0xa757('0x50'),'token',_0xa757('0x51'),_0xa757('0x52')]})[_0xa757('0x20')](handleEntityNotFound(_0x115a94,null))[_0xa757('0x20')](function(_0x1c35bc){if(_0x1c35bc){_0x34982a=_0x1c35bc['remoteUri'];var _0x2586f9=_0x34982a[_0xa757('0x53')](-0x1);if(_0x2586f9==='/'){_0x34982a=_0x34982a[_0xa757('0x54')](0x0,_0x34982a[_0xa757('0x55')](_0x2586f9));}var _0x43cc0a={'method':'GET','uri':util[_0xa757('0x56')](_0xa757('0x57'),_0x34982a,_0xa757('0x58')),'json':!![]};switch(_0x1c35bc['authType']){case _0xa757('0x50'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util[_0xa757('0x56')](_0xa757('0x5b'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc[_0xa757('0x50')]))[_0xa757('0x5c')](_0xa757('0x5d')))};break;case _0xa757('0x5e'):_0x43cc0a[_0xa757('0x59')]={'Authorization':util[_0xa757('0x56')](_0xa757('0x5a'),new Buffer(util['format'](_0xa757('0x5f'),_0x1c35bc[_0xa757('0x4f')],_0x1c35bc['token']))[_0xa757('0x5c')](_0xa757('0x5d')))};break;default:throw new db['Sequelize'][(_0xa757('0x60'))](_0xa757('0x61'));}return rp(_0x43cc0a);}})[_0xa757('0x20')](function(_0x2e1198){if(_0x2e1198){var _0x3a00ef=[_0xa757('0x62'),_0xa757('0x63'),_0xa757('0x64'),_0xa757('0x65')];_[_0xa757('0x66')](_0x2e1198[_0xa757('0x58')],function(_0x189195){return _0x3a00ef[_0xa757('0x67')](_0x189195[_0xa757('0x38')]);});return{'count':_0x2e1198[_0xa757('0x58')][_0xa757('0x30')],'rows':_['map'](_0x2e1198[_0xa757('0x58')],function(_0x56ba75){return{'id':_0x56ba75['id'],'name':_0x56ba75[_0xa757('0x68')]>0x7?_0x56ba75[_0xa757('0x69')]:_0x56ba75[_0xa757('0x38')],'custom':_0x56ba75[_0xa757('0x68')]>0x7?!![]:![],'options':_0x56ba75[_0xa757('0x6a')]?_0x56ba75['system_field_options']:_0x56ba75[_0xa757('0x6b')]?_0x56ba75[_0xa757('0x6b')]:[]};})};}})[_0xa757('0x20')](respondWithResult(_0x115a94,null))['catch'](function(_0x3317d8){var _0x3619ec=_0x5f450f[_0xa757('0x2a')]['test']?0x1f4:_0x3317d8['statusCode']||0x1f4;logger[_0xa757('0x22')](_0xa757('0x6c'),_0xa757('0x4e'),_0x3619ec,JSON['stringify'](_0x3317d8));delete _0x3317d8[_0xa757('0x23')];if(_0x3619ec===0x191){_0x3619ec=0x190;}_0x115a94['status'](_0x3619ec)['send'](_0x5f450f[_0xa757('0x2a')][_0xa757('0x6d')]?{'message':_0xa757('0x6e'),'statusCode':_0x3317d8['statusCode']}:_0x3317d8);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index ed0b809..defe80f 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 _0x579e=['util','../../config/logger','api','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','ZendeskAccount','int_zendesk_accounts'];(function(_0x48d3fa,_0x3808a6){var _0x4c4995=function(_0x3fab11){while(--_0x3fab11){_0x48d3fa['push'](_0x48d3fa['shift']());}};_0x4c4995(++_0x3808a6);}(_0x579e,0x17c));var _0xe579=function(_0x226fc3,_0x480f7c){_0x226fc3=_0x226fc3-0x0;var _0x116cbc=_0x579e[_0x226fc3];return _0x116cbc;};'use strict';var _=require('lodash');var util=require(_0xe579('0x0'));var logger=require(_0xe579('0x1'))(_0xe579('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe579('0x3'));var fs=require('fs');var path=require(_0xe579('0x4'));var rimraf=require(_0xe579('0x5'));var config=require('../../config/environment');var attributes=require(_0xe579('0x6'));var integrations=require(_0xe579('0x7'));module['exports']=function(_0x557072,_0x69c550){return _0x557072['define'](_0xe579('0x8'),attributes,{'tableName':_0xe579('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x030e=['define','ZendeskAccount','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x29f34e,_0x443dfd){var _0x1f86f1=function(_0x5533ae){while(--_0x5533ae){_0x29f34e['push'](_0x29f34e['shift']());}};_0x1f86f1(++_0x443dfd);}(_0x030e,0xac));var _0xe030=function(_0x27e959,_0x4c8be1){_0x27e959=_0x27e959-0x0;var _0xe1df65=_0x030e[_0x27e959];return _0xe1df65;};'use strict';var _=require(_0xe030('0x0'));var util=require('util');var logger=require(_0xe030('0x1'))('api');var moment=require(_0xe030('0x2'));var BPromise=require(_0xe030('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe030('0x4'));var config=require(_0xe030('0x5'));var attributes=require(_0xe030('0x6'));var integrations=require(_0xe030('0x7'));module['exports']=function(_0x53fc03,_0x41fe0f){return _0x53fc03[_0xe030('0x8')](_0xe030('0x9'),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 b15b9e4..5888172 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 _0x2bc6=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','map','include','model','ShowZendeskAccount','find','lodash'];(function(_0x52da1e,_0x57bfd9){var _0x589959=function(_0x52fe4d){while(--_0x52fe4d){_0x52da1e['push'](_0x52da1e['shift']());}};_0x589959(++_0x57bfd9);}(_0x2bc6,0x8b));var _0x62bc=function(_0xee7e43,_0x37c59a){_0xee7e43=_0xee7e43-0x0;var _0x25b4f4=_0x2bc6[_0xee7e43];return _0x25b4f4;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var moment=require(_0x62bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x62bc('0x3'));var fs=require('fs');var Redis=require(_0x62bc('0x4'));var db=require(_0x62bc('0x5'))['db'];var utils=require(_0x62bc('0x6'));var logger=require(_0x62bc('0x7'))(_0x62bc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x62bc('0x9')][_0x62bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cdf6d,_0x151e5c,_0x1d806b){return new BPromise(function(_0xf90627,_0x5ea60f){return client[_0x62bc('0xb')](_0x5cdf6d,_0x1d806b)[_0x62bc('0xc')](function(_0x502d27){logger[_0x62bc('0xd')](_0x62bc('0xe'),_0x151e5c,_0x62bc('0xf'));logger[_0x62bc('0x10')](_0x62bc('0x11'),_0x151e5c,'request\x20sent',JSON[_0x62bc('0x12')](_0x502d27));if(_0x502d27[_0x62bc('0x13')]){if(_0x502d27[_0x62bc('0x13')][_0x62bc('0x14')]===0x1f4){logger[_0x62bc('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x151e5c,_0x502d27[_0x62bc('0x13')][_0x62bc('0x15')]);return _0x5ea60f(_0x502d27['error'][_0x62bc('0x15')]);}logger[_0x62bc('0x13')](_0x62bc('0xe'),_0x151e5c,_0x502d27[_0x62bc('0x13')][_0x62bc('0x15')]);return _0xf90627(_0x502d27[_0x62bc('0x13')][_0x62bc('0x15')]);}else{logger[_0x62bc('0xd')](_0x62bc('0xe'),_0x151e5c,_0x62bc('0xf'));_0xf90627(_0x502d27[_0x62bc('0x16')][_0x62bc('0x15')]);}})[_0x62bc('0x17')](function(_0x1f4689){logger[_0x62bc('0x13')](_0x62bc('0xe'),_0x151e5c,_0x1f4689);_0x5ea60f(_0x1f4689);});});}exports[_0x62bc('0x18')]=function(_0x414197){var _0x613dfa=this;return new Promise(function(_0x7af9a5,_0xb1ee17){return db[_0x62bc('0x19')]['findAll']({'raw':_0x414197['options']?_0x414197[_0x62bc('0x1a')][_0x62bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x414197[_0x62bc('0x1a')]?_0x414197[_0x62bc('0x1a')][_0x62bc('0x1c')]||null:null,'attributes':_0x414197[_0x62bc('0x1a')]?_0x414197[_0x62bc('0x1a')][_0x62bc('0x1d')]||null:null,'limit':_0x414197[_0x62bc('0x1a')]?_0x414197['options']['limit']||null:null,'include':_0x414197['options']?_0x414197[_0x62bc('0x1a')]['include']?_[_0x62bc('0x1e')](_0x414197['options'][_0x62bc('0x1f')],function(_0x58e3ce){return{'model':db[_0x58e3ce['model']],'as':_0x58e3ce['as'],'attributes':_0x58e3ce['attributes'],'include':_0x58e3ce[_0x62bc('0x1f')]?_[_0x62bc('0x1e')](_0x58e3ce[_0x62bc('0x1f')],function(_0x3e1e3a){return{'model':db[_0x3e1e3a[_0x62bc('0x20')]],'as':_0x3e1e3a['as'],'attributes':_0x3e1e3a[_0x62bc('0x1d')],'include':_0x3e1e3a[_0x62bc('0x1f')]?_[_0x62bc('0x1e')](_0x3e1e3a[_0x62bc('0x1f')],function(_0x11f3c0){return{'model':db[_0x11f3c0['model']],'as':_0x11f3c0['as'],'attributes':_0x11f3c0[_0x62bc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x62bc('0xc')](function(_0x4afa31){logger[_0x62bc('0xd')](_0x62bc('0x18'),_0x414197);logger['debug'](_0x62bc('0x18'),_0x414197,JSON['stringify'](_0x4afa31));_0x7af9a5(_0x4afa31);})[_0x62bc('0x17')](function(_0x3b17b2){logger[_0x62bc('0x13')](_0x62bc('0x18'),_0x3b17b2[_0x62bc('0x15')],_0x414197);_0xb1ee17(_0x613dfa[_0x62bc('0x13')](0x1f4,_0x3b17b2[_0x62bc('0x15')]));});});};exports[_0x62bc('0x21')]=function(_0x5a9514){var _0x25fb4b=this;return new Promise(function(_0x5c58a4,_0x4c37e2){return db[_0x62bc('0x19')][_0x62bc('0x22')]({'raw':_0x5a9514[_0x62bc('0x1a')]?_0x5a9514[_0x62bc('0x1a')][_0x62bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a9514['options']?_0x5a9514[_0x62bc('0x1a')][_0x62bc('0x1c')]||null:null,'attributes':_0x5a9514[_0x62bc('0x1a')]?_0x5a9514[_0x62bc('0x1a')]['attributes']||null:null,'include':_0x5a9514[_0x62bc('0x1a')]?_0x5a9514['options']['include']?_[_0x62bc('0x1e')](_0x5a9514[_0x62bc('0x1a')][_0x62bc('0x1f')],function(_0x542f49){return{'model':db[_0x542f49[_0x62bc('0x20')]],'as':_0x542f49['as'],'attributes':_0x542f49[_0x62bc('0x1d')],'include':_0x542f49[_0x62bc('0x1f')]?_[_0x62bc('0x1e')](_0x542f49[_0x62bc('0x1f')],function(_0x2a1060){return{'model':db[_0x2a1060['model']],'as':_0x2a1060['as'],'attributes':_0x2a1060['attributes'],'include':_0x2a1060[_0x62bc('0x1f')]?_[_0x62bc('0x1e')](_0x2a1060[_0x62bc('0x1f')],function(_0x5e7fef){return{'model':db[_0x5e7fef[_0x62bc('0x20')]],'as':_0x5e7fef['as'],'attributes':_0x5e7fef[_0x62bc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x62bc('0xc')](function(_0x8c7483){logger[_0x62bc('0xd')](_0x62bc('0x21'),_0x5a9514);logger[_0x62bc('0x10')](_0x62bc('0x21'),_0x5a9514,JSON[_0x62bc('0x12')](_0x8c7483));_0x5c58a4(_0x8c7483);})[_0x62bc('0x17')](function(_0x464a8e){logger['error'](_0x62bc('0x21'),_0x464a8e[_0x62bc('0x15')],_0x5a9514);_0x4c37e2(_0x25fb4b[_0x62bc('0x13')](0x1f4,_0x464a8e[_0x62bc('0x15')]));});});}; \ No newline at end of file +var _0xc7de=['where','attributes','limit','include','map','model','GetZendeskAccount','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ZendeskAccount','options','raw'];(function(_0x320831,_0x58a9ea){var _0x11e9e7=function(_0x483888){while(--_0x483888){_0x320831['push'](_0x320831['shift']());}};_0x11e9e7(++_0x58a9ea);}(_0xc7de,0x9d));var _0xec7d=function(_0x1fa873,_0x1319ab){_0x1fa873=_0x1fa873-0x0;var _0x599fbc=_0xc7de[_0x1fa873];return _0x599fbc;};'use strict';var _=require(_0xec7d('0x0'));var util=require('util');var moment=require(_0xec7d('0x1'));var BPromise=require(_0xec7d('0x2'));var rs=require(_0xec7d('0x3'));var fs=require('fs');var Redis=require(_0xec7d('0x4'));var db=require(_0xec7d('0x5'))['db'];var utils=require(_0xec7d('0x6'));var logger=require('../../config/logger')(_0xec7d('0x7'));var config=require(_0xec7d('0x8'));var jayson=require(_0xec7d('0x9'));var client=jayson[_0xec7d('0xa')][_0xec7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3060d8,_0x1e2486,_0xe723d7){return new BPromise(function(_0x41778e,_0x3e3332){return client[_0xec7d('0xc')](_0x3060d8,_0xe723d7)[_0xec7d('0xd')](function(_0x1a3cec){logger[_0xec7d('0xe')](_0xec7d('0xf'),_0x1e2486,'request\x20sent');logger[_0xec7d('0x10')](_0xec7d('0x11'),_0x1e2486,_0xec7d('0x12'),JSON[_0xec7d('0x13')](_0x1a3cec));if(_0x1a3cec[_0xec7d('0x14')]){if(_0x1a3cec[_0xec7d('0x14')][_0xec7d('0x15')]===0x1f4){logger[_0xec7d('0x14')](_0xec7d('0xf'),_0x1e2486,_0x1a3cec[_0xec7d('0x14')][_0xec7d('0x16')]);return _0x3e3332(_0x1a3cec[_0xec7d('0x14')][_0xec7d('0x16')]);}logger[_0xec7d('0x14')](_0xec7d('0xf'),_0x1e2486,_0x1a3cec[_0xec7d('0x14')][_0xec7d('0x16')]);return _0x41778e(_0x1a3cec[_0xec7d('0x14')][_0xec7d('0x16')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x1e2486,_0xec7d('0x12'));_0x41778e(_0x1a3cec[_0xec7d('0x17')][_0xec7d('0x16')]);}})[_0xec7d('0x18')](function(_0x317a27){logger['error'](_0xec7d('0xf'),_0x1e2486,_0x317a27);_0x3e3332(_0x317a27);});});}exports['GetZendeskAccount']=function(_0xa7b50){var _0x18f812=this;return new Promise(function(_0x2c1407,_0x515619){return db[_0xec7d('0x19')]['findAll']({'raw':_0xa7b50[_0xec7d('0x1a')]?_0xa7b50['options'][_0xec7d('0x1b')]===undefined?!![]:![]:!![],'where':_0xa7b50['options']?_0xa7b50['options'][_0xec7d('0x1c')]||null:null,'attributes':_0xa7b50[_0xec7d('0x1a')]?_0xa7b50[_0xec7d('0x1a')][_0xec7d('0x1d')]||null:null,'limit':_0xa7b50[_0xec7d('0x1a')]?_0xa7b50[_0xec7d('0x1a')][_0xec7d('0x1e')]||null:null,'include':_0xa7b50[_0xec7d('0x1a')]?_0xa7b50[_0xec7d('0x1a')][_0xec7d('0x1f')]?_[_0xec7d('0x20')](_0xa7b50[_0xec7d('0x1a')][_0xec7d('0x1f')],function(_0x4e1f19){return{'model':db[_0x4e1f19[_0xec7d('0x21')]],'as':_0x4e1f19['as'],'attributes':_0x4e1f19['attributes'],'include':_0x4e1f19[_0xec7d('0x1f')]?_['map'](_0x4e1f19['include'],function(_0x33b842){return{'model':db[_0x33b842[_0xec7d('0x21')]],'as':_0x33b842['as'],'attributes':_0x33b842[_0xec7d('0x1d')],'include':_0x33b842[_0xec7d('0x1f')]?_[_0xec7d('0x20')](_0x33b842[_0xec7d('0x1f')],function(_0x299ba1){return{'model':db[_0x299ba1['model']],'as':_0x299ba1['as'],'attributes':_0x299ba1[_0xec7d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xec7d('0xd')](function(_0x23a87b){logger[_0xec7d('0xe')](_0xec7d('0x22'),_0xa7b50);logger[_0xec7d('0x10')](_0xec7d('0x22'),_0xa7b50,JSON[_0xec7d('0x13')](_0x23a87b));_0x2c1407(_0x23a87b);})['catch'](function(_0x238b9){logger[_0xec7d('0x14')](_0xec7d('0x22'),_0x238b9[_0xec7d('0x16')],_0xa7b50);_0x515619(_0x18f812[_0xec7d('0x14')](0x1f4,_0x238b9['message']));});});};exports[_0xec7d('0x23')]=function(_0x33ecf8){var _0x332968=this;return new Promise(function(_0x10654f,_0x4a224f){return db[_0xec7d('0x19')][_0xec7d('0x24')]({'raw':_0x33ecf8['options']?_0x33ecf8[_0xec7d('0x1a')][_0xec7d('0x1b')]===undefined?!![]:![]:!![],'where':_0x33ecf8['options']?_0x33ecf8[_0xec7d('0x1a')][_0xec7d('0x1c')]||null:null,'attributes':_0x33ecf8[_0xec7d('0x1a')]?_0x33ecf8[_0xec7d('0x1a')][_0xec7d('0x1d')]||null:null,'include':_0x33ecf8['options']?_0x33ecf8[_0xec7d('0x1a')][_0xec7d('0x1f')]?_[_0xec7d('0x20')](_0x33ecf8[_0xec7d('0x1a')][_0xec7d('0x1f')],function(_0x46606c){return{'model':db[_0x46606c[_0xec7d('0x21')]],'as':_0x46606c['as'],'attributes':_0x46606c[_0xec7d('0x1d')],'include':_0x46606c['include']?_['map'](_0x46606c[_0xec7d('0x1f')],function(_0x1df75b){return{'model':db[_0x1df75b[_0xec7d('0x21')]],'as':_0x1df75b['as'],'attributes':_0x1df75b[_0xec7d('0x1d')],'include':_0x1df75b[_0xec7d('0x1f')]?_[_0xec7d('0x20')](_0x1df75b['include'],function(_0x2ae58b){return{'model':db[_0x2ae58b['model']],'as':_0x2ae58b['as'],'attributes':_0x2ae58b[_0xec7d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4444c9){logger[_0xec7d('0xe')](_0xec7d('0x23'),_0x33ecf8);logger[_0xec7d('0x10')](_0xec7d('0x23'),_0x33ecf8,JSON[_0xec7d('0x13')](_0x4444c9));_0x10654f(_0x4444c9);})[_0xec7d('0x18')](function(_0x2d3f16){logger[_0xec7d('0x14')](_0xec7d('0x23'),_0x2d3f16[_0xec7d('0x16')],_0x33ecf8);_0x4a224f(_0x332968[_0xec7d('0x14')](0x1f4,_0x2d3f16[_0xec7d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 02828ec..83ab7b7 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 _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x5771c7,_0x3d65fe){var _0x31a571=function(_0x212452){while(--_0x212452){_0x5771c7['push'](_0x5771c7['shift']());}};_0x31a571(++_0x3d65fe);}(_0x0bb5,0x148));var _0x50bb=function(_0x16e37c,_0x46a4af){_0x16e37c=_0x16e37c-0x0;var _0x4243df=_0x0bb5[_0x16e37c];return _0x4243df;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x171359,_0x4b1af0){var _0x1b7b97=function(_0xa7f7e8){while(--_0xa7f7e8){_0x171359['push'](_0x171359['shift']());}};_0x1b7b97(++_0x4b1af0);}(_0xb10b,0x12a));var _0xbb10=function(_0x450e22,_0x3ba125){_0x450e22=_0x450e22-0x0;var _0x5e3b1d=_0xb10b[_0x450e22];return _0x5e3b1d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 5d55249..9e3476f 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 _0x6faf=['STRING','sequelize','exports'];(function(_0x46c30c,_0x1ac896){var _0x45c5c1=function(_0x21ad77){while(--_0x21ad77){_0x46c30c['push'](_0x46c30c['shift']());}};_0x45c5c1(++_0x1ac896);}(_0x6faf,0x1c9));var _0xf6fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6faf[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf6fa('0x0'));module[_0xf6fa('0x1')]={'name':{'type':Sequelize[_0xf6fa('0x2')]},'description':{'type':Sequelize[_0xf6fa('0x2')]}}; \ No newline at end of file +var _0x9f98=['exports','STRING','sequelize'];(function(_0x2d329f,_0x36589a){var _0x855018=function(_0xe24938){while(--_0xe24938){_0x2d329f['push'](_0x2d329f['shift']());}};_0x855018(++_0x36589a);}(_0x9f98,0x143));var _0x89f9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9f98[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x89f9('0x0'));module[_0x89f9('0x1')]={'name':{'type':Sequelize[_0x89f9('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 75d7b8f..906cfd9 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 _0xc67f=['filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','count','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','findOne','ZendeskField','nolimit','getFields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model'];(function(_0x5700be,_0x4b6136){var _0x31e915=function(_0x3be5f4){while(--_0x3be5f4){_0x5700be['push'](_0x5700be['shift']());}};_0x31e915(++_0x4b6136);}(_0xc67f,0x180));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfc67('0x0'));var rimraf=require(_0xfc67('0x1'));var zipdir=require(_0xfc67('0x2'));var jsonpatch=require(_0xfc67('0x3'));var rp=require(_0xfc67('0x4'));var moment=require(_0xfc67('0x5'));var BPromise=require(_0xfc67('0x6'));var Mustache=require(_0xfc67('0x7'));var util=require(_0xfc67('0x8'));var path=require(_0xfc67('0x9'));var sox=require(_0xfc67('0xa'));var csv=require(_0xfc67('0xb'));var ejs=require(_0xfc67('0xc'));var fs=require('fs');var fs_extra=require(_0xfc67('0xd'));var _=require(_0xfc67('0xe'));var squel=require(_0xfc67('0xf'));var crypto=require('crypto');var jsforce=require(_0xfc67('0x10'));var deskjs=require(_0xfc67('0x11'));var toCsv=require(_0xfc67('0xb'));var querystring=require(_0xfc67('0x12'));var Papa=require(_0xfc67('0x13'));var Redis=require(_0xfc67('0x14'));var authService=require(_0xfc67('0x15'));var qs=require(_0xfc67('0x16'));var as=require(_0xfc67('0x17'));var hardwareService=require(_0xfc67('0x18'));var logger=require('../../config/logger')(_0xfc67('0x19'));var utils=require('../../config/utils');var config=require(_0xfc67('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc67('0x1b'))['db'];function respondWithStatusCode(_0xb9bb0b,_0x1c538f){_0x1c538f=_0x1c538f||0xcc;return function(_0x4227af){if(_0x4227af){return _0xb9bb0b[_0xfc67('0x1c')](_0x1c538f);}return _0xb9bb0b[_0xfc67('0x1d')](_0x1c538f)[_0xfc67('0x1e')]();};}function respondWithResult(_0x1bd2a3,_0xd845){_0xd845=_0xd845||0xc8;return function(_0x5a66b1){if(_0x5a66b1){return _0x1bd2a3['status'](_0xd845)['json'](_0x5a66b1);}};}function respondWithFilteredResult(_0x13f141,_0x1e5ae4){return function(_0x5c4f99){if(_0x5c4f99){var _0x3ddae4=typeof _0x1e5ae4[_0xfc67('0x1f')]===_0xfc67('0x20')&&typeof _0x1e5ae4['limit']===_0xfc67('0x20');var _0x1354aa=_0x5c4f99['count'];var _0x1e6b01=_0x3ddae4?0x0:_0x1e5ae4[_0xfc67('0x1f')];var _0x3ebb75=_0x3ddae4?_0x5c4f99['count']:_0x1e5ae4[_0xfc67('0x1f')]+_0x1e5ae4[_0xfc67('0x21')];var _0x4720b2;if(_0x3ebb75>=_0x1354aa){_0x3ebb75=_0x1354aa;_0x4720b2=0xc8;}else{_0x4720b2=0xce;}_0x13f141[_0xfc67('0x1d')](_0x4720b2);return _0x13f141[_0xfc67('0x22')](_0xfc67('0x23'),_0x1e6b01+'-'+_0x3ebb75+'/'+_0x1354aa)['json'](_0x5c4f99);}return null;};}function patchUpdates(_0x42ced3){return function(_0x3c9874){try{jsonpatch[_0xfc67('0x24')](_0x3c9874,_0x42ced3,!![]);}catch(_0x245df7){return BPromise['reject'](_0x245df7);}return _0x3c9874[_0xfc67('0x25')]();};}function saveUpdates(_0x489b58,_0x18e35b){return function(_0x976f82){if(_0x976f82){return _0x976f82[_0xfc67('0x26')](_0x489b58)[_0xfc67('0x27')](function(_0x40cdd8){return _0x40cdd8;});}return null;};}function removeEntity(_0x503bbe,_0x5b9112){return function(_0x425f5e){if(_0x425f5e){return _0x425f5e[_0xfc67('0x28')]()[_0xfc67('0x27')](function(){_0x503bbe[_0xfc67('0x1d')](0xcc)[_0xfc67('0x1e')]();});}};}function handleEntityNotFound(_0x42f7be,_0x2e93b5){return function(_0x57a4fb){if(!_0x57a4fb){_0x42f7be[_0xfc67('0x1c')](0x194);}return _0x57a4fb;};}function handleError(_0xc3c94c,_0x59c75e){_0x59c75e=_0x59c75e||0x1f4;return function(_0x22599d){logger['error'](_0x22599d[_0xfc67('0x29')]);if(_0x22599d[_0xfc67('0x2a')]){delete _0x22599d[_0xfc67('0x2a')];}_0xc3c94c[_0xfc67('0x1d')](_0x59c75e)[_0xfc67('0x2b')](_0x22599d);};}exports[_0xfc67('0x2c')]=function(_0x456ba2,_0x3194d9){var _0x3bd4aa={},_0x3e571b={},_0x1ce08d={'count':0x0,'rows':[]};var _0x1887f1=_[_0xfc67('0x2d')](db[_0xfc67('0x2e')][_0xfc67('0x2f')],function(_0x588abf){return{'name':_0x588abf['fieldName'],'type':_0x588abf[_0xfc67('0x30')][_0xfc67('0x31')]};});_0x3e571b[_0xfc67('0x32')]=_[_0xfc67('0x2d')](_0x1887f1,_0xfc67('0x2a'));_0x3e571b['query']=_['keys'](_0x456ba2['query']);_0x3e571b[_0xfc67('0x33')]=_[_0xfc67('0x34')](_0x3e571b[_0xfc67('0x32')],_0x3e571b[_0xfc67('0x35')]);_0x3bd4aa[_0xfc67('0x36')]=_['intersection'](_0x3e571b[_0xfc67('0x32')],qs[_0xfc67('0x37')](_0x456ba2['query'][_0xfc67('0x37')]));_0x3bd4aa[_0xfc67('0x36')]=_0x3bd4aa[_0xfc67('0x36')][_0xfc67('0x38')]?_0x3bd4aa[_0xfc67('0x36')]:_0x3e571b[_0xfc67('0x32')];if(!_0x456ba2[_0xfc67('0x35')][_0xfc67('0x39')]('nolimit')){_0x3bd4aa[_0xfc67('0x21')]=qs['limit'](_0x456ba2[_0xfc67('0x35')][_0xfc67('0x21')]);_0x3bd4aa[_0xfc67('0x1f')]=qs[_0xfc67('0x1f')](_0x456ba2['query'][_0xfc67('0x1f')]);}_0x3bd4aa[_0xfc67('0x3a')]=qs[_0xfc67('0x3b')](_0x456ba2['query']['sort']);_0x3bd4aa[_0xfc67('0x3c')]=qs[_0xfc67('0x33')](_[_0xfc67('0x3d')](_0x456ba2[_0xfc67('0x35')],_0x3e571b[_0xfc67('0x33')]),_0x1887f1);if(_0x456ba2[_0xfc67('0x35')]['filter']){_0x3bd4aa['where']=_['merge'](_0x3bd4aa[_0xfc67('0x3c')],{'$or':_['map'](_0x1887f1,function(_0x5e497d){if(_0x5e497d[_0xfc67('0x30')]!==_0xfc67('0x3e')){var _0x400e0b={};_0x400e0b[_0x5e497d[_0xfc67('0x2a')]]={'$like':'%'+_0x456ba2[_0xfc67('0x35')][_0xfc67('0x3f')]+'%'};return _0x400e0b;}})});}_0x3bd4aa=_[_0xfc67('0x40')]({},_0x3bd4aa,_0x456ba2[_0xfc67('0x41')]);var _0x4c7d7a={'where':_0x3bd4aa['where']};return db[_0xfc67('0x2e')]['count'](_0x4c7d7a)[_0xfc67('0x27')](function(_0x2483c5){_0x1ce08d[_0xfc67('0x42')]=_0x2483c5;if(_0x456ba2[_0xfc67('0x35')]['includeAll']){_0x3bd4aa['include']=[{'all':!![]}];}return db[_0xfc67('0x2e')][_0xfc67('0x43')](_0x3bd4aa);})['then'](function(_0x106308){_0x1ce08d[_0xfc67('0x44')]=_0x106308;return _0x1ce08d;})[_0xfc67('0x27')](respondWithFilteredResult(_0x3194d9,_0x3bd4aa))[_0xfc67('0x45')](handleError(_0x3194d9,null));};exports[_0xfc67('0x46')]=function(_0x37c091,_0x5bd4b1){var _0x52fb5e={'raw':![],'where':{'id':_0x37c091[_0xfc67('0x47')]['id']}},_0x152faa={};_0x152faa[_0xfc67('0x32')]=_['keys'](db[_0xfc67('0x2e')][_0xfc67('0x2f')]);_0x152faa[_0xfc67('0x35')]=_[_0xfc67('0x48')](_0x37c091[_0xfc67('0x35')]);_0x152faa[_0xfc67('0x33')]=_[_0xfc67('0x34')](_0x152faa['model'],_0x152faa['query']);_0x52fb5e[_0xfc67('0x36')]=_['intersection'](_0x152faa[_0xfc67('0x32')],qs[_0xfc67('0x37')](_0x37c091[_0xfc67('0x35')][_0xfc67('0x37')]));_0x52fb5e[_0xfc67('0x36')]=_0x52fb5e[_0xfc67('0x36')][_0xfc67('0x38')]?_0x52fb5e[_0xfc67('0x36')]:_0x152faa[_0xfc67('0x32')];if(_0x37c091['query'][_0xfc67('0x49')]){_0x52fb5e[_0xfc67('0x4a')]=[{'all':!![]}];}_0x52fb5e=_[_0xfc67('0x40')]({},_0x52fb5e,_0x37c091[_0xfc67('0x41')]);return db[_0xfc67('0x2e')][_0xfc67('0x4b')](_0x52fb5e)[_0xfc67('0x27')](handleEntityNotFound(_0x5bd4b1,null))[_0xfc67('0x27')](respondWithResult(_0x5bd4b1,null))['catch'](handleError(_0x5bd4b1,null));};exports[_0xfc67('0x4c')]=function(_0x437ebe,_0x4b46c5){return db[_0xfc67('0x2e')][_0xfc67('0x4c')](_0x437ebe[_0xfc67('0x4d')],{})[_0xfc67('0x27')](respondWithResult(_0x4b46c5,0xc9))[_0xfc67('0x45')](handleError(_0x4b46c5,null));};exports['update']=function(_0x2c1483,_0x471420){if(_0x2c1483[_0xfc67('0x4d')]['id']){delete _0x2c1483[_0xfc67('0x4d')]['id'];}return db[_0xfc67('0x2e')][_0xfc67('0x4b')]({'where':{'id':_0x2c1483[_0xfc67('0x47')]['id']}})['then'](handleEntityNotFound(_0x471420,null))[_0xfc67('0x27')](saveUpdates(_0x2c1483[_0xfc67('0x4d')],null))[_0xfc67('0x27')](respondWithResult(_0x471420,null))[_0xfc67('0x45')](handleError(_0x471420,null));};exports[_0xfc67('0x28')]=function(_0x411c34,_0x285e4c){return db[_0xfc67('0x2e')][_0xfc67('0x4b')]({'where':{'id':_0x411c34[_0xfc67('0x47')]['id']}})['then'](handleEntityNotFound(_0x285e4c,null))[_0xfc67('0x27')](removeEntity(_0x285e4c,null))['catch'](handleError(_0x285e4c,null));};exports['getFields']=function(_0x39d337,_0x3e27b5,_0x576cb5){var _0x343243={};var _0x10c067={};var _0x154667;var _0xb30650;return db[_0xfc67('0x2e')][_0xfc67('0x4e')]({'where':{'id':_0x39d337[_0xfc67('0x47')]['id']}})[_0xfc67('0x27')](handleEntityNotFound(_0x3e27b5,null))[_0xfc67('0x27')](function(_0x386c93){if(_0x386c93){_0x154667=_0x386c93;_0x10c067[_0xfc67('0x32')]=_[_0xfc67('0x48')](db[_0xfc67('0x4f')][_0xfc67('0x2f')]);_0x10c067[_0xfc67('0x35')]=_['keys'](_0x39d337[_0xfc67('0x35')]);_0x10c067[_0xfc67('0x33')]=_[_0xfc67('0x34')](_0x10c067[_0xfc67('0x32')],_0x10c067[_0xfc67('0x35')]);_0x343243[_0xfc67('0x36')]=_[_0xfc67('0x34')](_0x10c067[_0xfc67('0x32')],qs[_0xfc67('0x37')](_0x39d337[_0xfc67('0x35')][_0xfc67('0x37')]));_0x343243['attributes']=_0x343243[_0xfc67('0x36')]['length']?_0x343243[_0xfc67('0x36')]:_0x10c067[_0xfc67('0x32')];_0x343243[_0xfc67('0x3a')]=qs[_0xfc67('0x3b')](_0x39d337[_0xfc67('0x35')][_0xfc67('0x3b')]);_0x343243[_0xfc67('0x3c')]=qs[_0xfc67('0x33')](_['pick'](_0x39d337[_0xfc67('0x35')],_0x10c067[_0xfc67('0x33')]));if(_0x39d337[_0xfc67('0x35')][_0xfc67('0x3f')]){_0x343243['where']=_['merge'](_0x343243['where'],{'$or':_[_0xfc67('0x2d')](_0x343243[_0xfc67('0x36')],function(_0x898a48){var _0x52433a={};_0x52433a[_0x898a48]={'$like':'%'+_0x39d337[_0xfc67('0x35')][_0xfc67('0x3f')]+'%'};return _0x52433a;})});}_0x343243=_[_0xfc67('0x40')]({},_0x343243,_0x39d337[_0xfc67('0x41')]);return _0x154667['getFields'](_0x343243);}})[_0xfc67('0x27')](function(_0x368027){if(_0x368027){_0xb30650=_0x368027[_0xfc67('0x38')];if(!_0x39d337['query'][_0xfc67('0x39')](_0xfc67('0x50'))){_0x343243['limit']=qs[_0xfc67('0x21')](_0x39d337[_0xfc67('0x35')][_0xfc67('0x21')]);_0x343243[_0xfc67('0x1f')]=qs['offset'](_0x39d337[_0xfc67('0x35')][_0xfc67('0x1f')]);}return _0x154667[_0xfc67('0x51')](_0x343243);}})['then'](function(_0xe5b76c){if(_0xe5b76c){return _0xe5b76c?{'count':_0xb30650,'rows':_0xe5b76c}:null;}})[_0xfc67('0x27')](respondWithResult(_0x3e27b5,null))['catch'](handleError(_0x3e27b5,null));};exports['getSubjects']=function(_0x1810ec,_0x4c5822,_0x286249){var _0x36892b={};var _0x10a79a={};var _0x1895ba;var _0x4b4d09;return db[_0xfc67('0x2e')]['findOne']({'where':{'id':_0x1810ec['params']['id']}})['then'](handleEntityNotFound(_0x4c5822,null))[_0xfc67('0x27')](function(_0x51d4b7){if(_0x51d4b7){_0x1895ba=_0x51d4b7;_0x10a79a[_0xfc67('0x32')]=_['keys'](db['ZendeskField'][_0xfc67('0x2f')]);_0x10a79a['query']=_[_0xfc67('0x48')](_0x1810ec[_0xfc67('0x35')]);_0x10a79a['filters']=_['intersection'](_0x10a79a[_0xfc67('0x32')],_0x10a79a[_0xfc67('0x35')]);_0x36892b[_0xfc67('0x36')]=_[_0xfc67('0x34')](_0x10a79a['model'],qs[_0xfc67('0x37')](_0x1810ec[_0xfc67('0x35')][_0xfc67('0x37')]));_0x36892b[_0xfc67('0x36')]=_0x36892b[_0xfc67('0x36')]['length']?_0x36892b['attributes']:_0x10a79a[_0xfc67('0x32')];_0x36892b[_0xfc67('0x3a')]=qs[_0xfc67('0x3b')](_0x1810ec[_0xfc67('0x35')]['sort']);_0x36892b['where']=qs[_0xfc67('0x33')](_[_0xfc67('0x3d')](_0x1810ec[_0xfc67('0x35')],_0x10a79a[_0xfc67('0x33')]));if(_0x1810ec['query'][_0xfc67('0x3f')]){_0x36892b[_0xfc67('0x3c')]=_[_0xfc67('0x40')](_0x36892b[_0xfc67('0x3c')],{'$or':_[_0xfc67('0x2d')](_0x36892b[_0xfc67('0x36')],function(_0x3ee798){var _0x1087af={};_0x1087af[_0x3ee798]={'$like':'%'+_0x1810ec[_0xfc67('0x35')][_0xfc67('0x3f')]+'%'};return _0x1087af;})});}_0x36892b=_[_0xfc67('0x40')]({},_0x36892b,_0x1810ec[_0xfc67('0x41')]);return _0x1895ba[_0xfc67('0x52')](_0x36892b);}})[_0xfc67('0x27')](function(_0x5ce6f3){if(_0x5ce6f3){_0x4b4d09=_0x5ce6f3[_0xfc67('0x38')];if(!_0x1810ec[_0xfc67('0x35')][_0xfc67('0x39')](_0xfc67('0x50'))){_0x36892b[_0xfc67('0x21')]=qs['limit'](_0x1810ec[_0xfc67('0x35')][_0xfc67('0x21')]);_0x36892b['offset']=qs['offset'](_0x1810ec[_0xfc67('0x35')][_0xfc67('0x1f')]);}return _0x1895ba['getSubjects'](_0x36892b);}})[_0xfc67('0x27')](function(_0x4330df){if(_0x4330df){return _0x4330df?{'count':_0x4b4d09,'rows':_0x4330df}:null;}})[_0xfc67('0x27')](respondWithResult(_0x4c5822,null))[_0xfc67('0x45')](handleError(_0x4c5822,null));};exports['getDescriptions']=function(_0x57599f,_0x4015cb,_0x28cff3){var _0x3190b6={};var _0x42a94e={};var _0x17f94d;var _0x2b334f;return db[_0xfc67('0x2e')][_0xfc67('0x4e')]({'where':{'id':_0x57599f['params']['id']}})[_0xfc67('0x27')](handleEntityNotFound(_0x4015cb,null))[_0xfc67('0x27')](function(_0x266373){if(_0x266373){_0x17f94d=_0x266373;_0x42a94e[_0xfc67('0x32')]=_[_0xfc67('0x48')](db[_0xfc67('0x4f')][_0xfc67('0x2f')]);_0x42a94e[_0xfc67('0x35')]=_[_0xfc67('0x48')](_0x57599f[_0xfc67('0x35')]);_0x42a94e['filters']=_[_0xfc67('0x34')](_0x42a94e[_0xfc67('0x32')],_0x42a94e[_0xfc67('0x35')]);_0x3190b6['attributes']=_['intersection'](_0x42a94e[_0xfc67('0x32')],qs[_0xfc67('0x37')](_0x57599f[_0xfc67('0x35')][_0xfc67('0x37')]));_0x3190b6[_0xfc67('0x36')]=_0x3190b6[_0xfc67('0x36')][_0xfc67('0x38')]?_0x3190b6[_0xfc67('0x36')]:_0x42a94e[_0xfc67('0x32')];_0x3190b6[_0xfc67('0x3a')]=qs[_0xfc67('0x3b')](_0x57599f[_0xfc67('0x35')][_0xfc67('0x3b')]);_0x3190b6[_0xfc67('0x3c')]=qs['filters'](_[_0xfc67('0x3d')](_0x57599f[_0xfc67('0x35')],_0x42a94e[_0xfc67('0x33')]));if(_0x57599f[_0xfc67('0x35')][_0xfc67('0x3f')]){_0x3190b6[_0xfc67('0x3c')]=_[_0xfc67('0x40')](_0x3190b6[_0xfc67('0x3c')],{'$or':_[_0xfc67('0x2d')](_0x3190b6[_0xfc67('0x36')],function(_0x3be67e){var _0xa58e55={};_0xa58e55[_0x3be67e]={'$like':'%'+_0x57599f[_0xfc67('0x35')][_0xfc67('0x3f')]+'%'};return _0xa58e55;})});}_0x3190b6=_[_0xfc67('0x40')]({},_0x3190b6,_0x57599f[_0xfc67('0x41')]);return _0x17f94d[_0xfc67('0x53')](_0x3190b6);}})['then'](function(_0x491761){if(_0x491761){_0x2b334f=_0x491761[_0xfc67('0x38')];if(!_0x57599f[_0xfc67('0x35')][_0xfc67('0x39')](_0xfc67('0x50'))){_0x3190b6[_0xfc67('0x21')]=qs[_0xfc67('0x21')](_0x57599f[_0xfc67('0x35')][_0xfc67('0x21')]);_0x3190b6['offset']=qs[_0xfc67('0x1f')](_0x57599f[_0xfc67('0x35')][_0xfc67('0x1f')]);}return _0x17f94d[_0xfc67('0x53')](_0x3190b6);}})[_0xfc67('0x27')](function(_0x26c910){if(_0x26c910){return _0x26c910?{'count':_0x2b334f,'rows':_0x26c910}:null;}})[_0xfc67('0x27')](respondWithResult(_0x4015cb,null))[_0xfc67('0x45')](handleError(_0x4015cb,null));};exports[_0xfc67('0x54')]=function(_0x442a7c,_0x47b785,_0x43b37f){var _0x20b95d={};var _0x487f37={};var _0x26acbc;var _0xfed8af;return db['ZendeskConfiguration'][_0xfc67('0x4e')]({'where':{'id':_0x442a7c[_0xfc67('0x47')]['id']}})[_0xfc67('0x27')](handleEntityNotFound(_0x47b785,null))[_0xfc67('0x27')](function(_0x5017e6){if(_0x5017e6){_0x26acbc=_0x5017e6;_0x487f37[_0xfc67('0x32')]=_['keys'](db['Tag']['rawAttributes']);_0x487f37[_0xfc67('0x35')]=_[_0xfc67('0x48')](_0x442a7c[_0xfc67('0x35')]);_0x487f37['filters']=_['intersection'](_0x487f37[_0xfc67('0x32')],_0x487f37[_0xfc67('0x35')]);_0x20b95d['attributes']=_[_0xfc67('0x34')](_0x487f37[_0xfc67('0x32')],qs[_0xfc67('0x37')](_0x442a7c[_0xfc67('0x35')]['fields']));_0x20b95d['attributes']=_0x20b95d[_0xfc67('0x36')]['length']?_0x20b95d[_0xfc67('0x36')]:_0x487f37[_0xfc67('0x32')];_0x20b95d[_0xfc67('0x3a')]=qs[_0xfc67('0x3b')](_0x442a7c['query']['sort']);_0x20b95d[_0xfc67('0x3c')]=qs['filters'](_[_0xfc67('0x3d')](_0x442a7c[_0xfc67('0x35')],_0x487f37[_0xfc67('0x33')]));if(_0x442a7c['query'][_0xfc67('0x3f')]){_0x20b95d['where']=_['merge'](_0x20b95d[_0xfc67('0x3c')],{'$or':_[_0xfc67('0x2d')](_0x20b95d['attributes'],function(_0x10bc15){var _0xbe598b={};_0xbe598b[_0x10bc15]={'$like':'%'+_0x442a7c[_0xfc67('0x35')][_0xfc67('0x3f')]+'%'};return _0xbe598b;})});}_0x20b95d=_['merge']({},_0x20b95d,_0x442a7c[_0xfc67('0x41')]);return _0x26acbc[_0xfc67('0x54')](_0x20b95d);}})[_0xfc67('0x27')](function(_0x43e183){if(_0x43e183){_0xfed8af=_0x43e183[_0xfc67('0x38')];if(!_0x442a7c[_0xfc67('0x35')][_0xfc67('0x39')](_0xfc67('0x50'))){_0x20b95d[_0xfc67('0x21')]=qs['limit'](_0x442a7c[_0xfc67('0x35')]['limit']);_0x20b95d[_0xfc67('0x1f')]=qs['offset'](_0x442a7c[_0xfc67('0x35')][_0xfc67('0x1f')]);}return _0x26acbc[_0xfc67('0x54')](_0x20b95d);}})[_0xfc67('0x27')](function(_0x4e841b){if(_0x4e841b){return _0x4e841b?{'count':_0xfed8af,'rows':_0x4e841b}:null;}})[_0xfc67('0x27')](respondWithResult(_0x47b785,null))[_0xfc67('0x45')](handleError(_0x47b785,null));};exports[_0xfc67('0x55')]=function(_0x257948,_0x4743d,_0x52789a){if(_0x257948[_0xfc67('0x4d')]['id']){delete _0x257948['body']['id'];}return db['ZendeskConfiguration'][_0xfc67('0x4e')]({'where':{'id':_0x257948[_0xfc67('0x47')]['id']}})[_0xfc67('0x27')](handleEntityNotFound(_0x4743d,null))[_0xfc67('0x27')](function(_0x185abd){if(_0x185abd){return _0x185abd[_0xfc67('0x55')](_0x257948[_0xfc67('0x4d')][_0xfc67('0x56')]||[]);}return null;})[_0xfc67('0x27')](respondWithResult(_0x4743d,null))['catch'](handleError(_0x4743d,null));}; \ No newline at end of file +var _0xb8aa=['findAll','rows','catch','show','params','keys','fields','length','includeAll','find','create','body','getFields','ZendeskField','nolimit','findOne','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include'];(function(_0x5b16cc,_0x24f22e){var _0x461289=function(_0x217b92){while(--_0x217b92){_0x5b16cc['push'](_0x5b16cc['shift']());}};_0x461289(++_0x24f22e);}(_0xb8aa,0x69));var _0xab8a=function(_0xcea1c7,_0x33f445){_0xcea1c7=_0xcea1c7-0x0;var _0x2c2525=_0xb8aa[_0xcea1c7];return _0x2c2525;};'use strict';var emlformat=require(_0xab8a('0x0'));var rimraf=require(_0xab8a('0x1'));var zipdir=require(_0xab8a('0x2'));var jsonpatch=require(_0xab8a('0x3'));var rp=require(_0xab8a('0x4'));var moment=require(_0xab8a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab8a('0x6'));var path=require(_0xab8a('0x7'));var sox=require(_0xab8a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab8a('0x9'));var _=require(_0xab8a('0xa'));var squel=require('squel');var crypto=require(_0xab8a('0xb'));var jsforce=require(_0xab8a('0xc'));var deskjs=require(_0xab8a('0xd'));var toCsv=require(_0xab8a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab8a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xab8a('0x10'));var as=require(_0xab8a('0x11'));var hardwareService=require(_0xab8a('0x12'));var logger=require('../../config/logger')(_0xab8a('0x13'));var utils=require('../../config/utils');var config=require(_0xab8a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xab8a('0x15'))['db'];function respondWithStatusCode(_0x1771c8,_0x2dc3d4){_0x2dc3d4=_0x2dc3d4||0xcc;return function(_0x1fa995){if(_0x1fa995){return _0x1771c8[_0xab8a('0x16')](_0x2dc3d4);}return _0x1771c8[_0xab8a('0x17')](_0x2dc3d4)[_0xab8a('0x18')]();};}function respondWithResult(_0x39e69a,_0x563198){_0x563198=_0x563198||0xc8;return function(_0x57f3f9){if(_0x57f3f9){return _0x39e69a[_0xab8a('0x17')](_0x563198)[_0xab8a('0x19')](_0x57f3f9);}};}function respondWithFilteredResult(_0x16f71c,_0xe03b6f){return function(_0x17d204){if(_0x17d204){var _0x12eb49=typeof _0xe03b6f['offset']===_0xab8a('0x1a')&&typeof _0xe03b6f[_0xab8a('0x1b')]==='undefined';var _0xc09c79=_0x17d204[_0xab8a('0x1c')];var _0x1b4ab2=_0x12eb49?0x0:_0xe03b6f['offset'];var _0x111ad2=_0x12eb49?_0x17d204[_0xab8a('0x1c')]:_0xe03b6f[_0xab8a('0x1d')]+_0xe03b6f[_0xab8a('0x1b')];var _0x208b15;if(_0x111ad2>=_0xc09c79){_0x111ad2=_0xc09c79;_0x208b15=0xc8;}else{_0x208b15=0xce;}_0x16f71c[_0xab8a('0x17')](_0x208b15);return _0x16f71c['set'](_0xab8a('0x1e'),_0x1b4ab2+'-'+_0x111ad2+'/'+_0xc09c79)['json'](_0x17d204);}return null;};}function patchUpdates(_0x157689){return function(_0x2e418a){try{jsonpatch[_0xab8a('0x1f')](_0x2e418a,_0x157689,!![]);}catch(_0x231116){return BPromise[_0xab8a('0x20')](_0x231116);}return _0x2e418a[_0xab8a('0x21')]();};}function saveUpdates(_0x596294,_0x59ee58){return function(_0x185b5d){if(_0x185b5d){return _0x185b5d[_0xab8a('0x22')](_0x596294)[_0xab8a('0x23')](function(_0x563dc2){return _0x563dc2;});}return null;};}function removeEntity(_0x560d03,_0x5556fd){return function(_0x33fedc){if(_0x33fedc){return _0x33fedc[_0xab8a('0x24')]()[_0xab8a('0x23')](function(){_0x560d03['status'](0xcc)[_0xab8a('0x18')]();});}};}function handleEntityNotFound(_0x535fa,_0x141a63){return function(_0x40b9bf){if(!_0x40b9bf){_0x535fa[_0xab8a('0x16')](0x194);}return _0x40b9bf;};}function handleError(_0x249259,_0x4c8042){_0x4c8042=_0x4c8042||0x1f4;return function(_0x4b53c9){logger[_0xab8a('0x25')](_0x4b53c9[_0xab8a('0x26')]);if(_0x4b53c9['name']){delete _0x4b53c9[_0xab8a('0x27')];}_0x249259[_0xab8a('0x17')](_0x4c8042)[_0xab8a('0x28')](_0x4b53c9);};}exports[_0xab8a('0x29')]=function(_0x4320e6,_0x1e634c){var _0x41930c={},_0x233551={},_0xfb485={'count':0x0,'rows':[]};var _0x1f3707=_[_0xab8a('0x2a')](db[_0xab8a('0x2b')][_0xab8a('0x2c')],function(_0x5e7d37){return{'name':_0x5e7d37[_0xab8a('0x2d')],'type':_0x5e7d37[_0xab8a('0x2e')][_0xab8a('0x2f')]};});_0x233551[_0xab8a('0x30')]=_[_0xab8a('0x2a')](_0x1f3707,_0xab8a('0x27'));_0x233551[_0xab8a('0x31')]=_['keys'](_0x4320e6[_0xab8a('0x31')]);_0x233551['filters']=_[_0xab8a('0x32')](_0x233551[_0xab8a('0x30')],_0x233551[_0xab8a('0x31')]);_0x41930c['attributes']=_['intersection'](_0x233551['model'],qs['fields'](_0x4320e6[_0xab8a('0x31')]['fields']));_0x41930c[_0xab8a('0x33')]=_0x41930c[_0xab8a('0x33')]['length']?_0x41930c[_0xab8a('0x33')]:_0x233551['model'];if(!_0x4320e6[_0xab8a('0x31')][_0xab8a('0x34')]('nolimit')){_0x41930c[_0xab8a('0x1b')]=qs[_0xab8a('0x1b')](_0x4320e6['query'][_0xab8a('0x1b')]);_0x41930c['offset']=qs['offset'](_0x4320e6[_0xab8a('0x31')][_0xab8a('0x1d')]);}_0x41930c[_0xab8a('0x35')]=qs[_0xab8a('0x36')](_0x4320e6[_0xab8a('0x31')][_0xab8a('0x36')]);_0x41930c[_0xab8a('0x37')]=qs[_0xab8a('0x38')](_[_0xab8a('0x39')](_0x4320e6[_0xab8a('0x31')],_0x233551[_0xab8a('0x38')]),_0x1f3707);if(_0x4320e6[_0xab8a('0x31')][_0xab8a('0x3a')]){_0x41930c[_0xab8a('0x37')]=_[_0xab8a('0x3b')](_0x41930c[_0xab8a('0x37')],{'$or':_['map'](_0x1f3707,function(_0xd57936){if(_0xd57936[_0xab8a('0x2e')]!==_0xab8a('0x3c')){var _0x3a1fce={};_0x3a1fce[_0xd57936['name']]={'$like':'%'+_0x4320e6[_0xab8a('0x31')][_0xab8a('0x3a')]+'%'};return _0x3a1fce;}})});}_0x41930c=_['merge']({},_0x41930c,_0x4320e6[_0xab8a('0x3d')]);var _0x45a33b={'where':_0x41930c[_0xab8a('0x37')]};return db[_0xab8a('0x2b')][_0xab8a('0x1c')](_0x45a33b)[_0xab8a('0x23')](function(_0x553f82){_0xfb485['count']=_0x553f82;if(_0x4320e6[_0xab8a('0x31')]['includeAll']){_0x41930c[_0xab8a('0x3e')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xab8a('0x3f')](_0x41930c);})['then'](function(_0x43f558){_0xfb485[_0xab8a('0x40')]=_0x43f558;return _0xfb485;})[_0xab8a('0x23')](respondWithFilteredResult(_0x1e634c,_0x41930c))[_0xab8a('0x41')](handleError(_0x1e634c,null));};exports[_0xab8a('0x42')]=function(_0x110552,_0x23f1da){var _0x317c90={'raw':![],'where':{'id':_0x110552[_0xab8a('0x43')]['id']}},_0x2e189d={};_0x2e189d[_0xab8a('0x30')]=_[_0xab8a('0x44')](db['ZendeskConfiguration']['rawAttributes']);_0x2e189d[_0xab8a('0x31')]=_[_0xab8a('0x44')](_0x110552[_0xab8a('0x31')]);_0x2e189d['filters']=_[_0xab8a('0x32')](_0x2e189d[_0xab8a('0x30')],_0x2e189d[_0xab8a('0x31')]);_0x317c90[_0xab8a('0x33')]=_[_0xab8a('0x32')](_0x2e189d[_0xab8a('0x30')],qs['fields'](_0x110552[_0xab8a('0x31')][_0xab8a('0x45')]));_0x317c90['attributes']=_0x317c90[_0xab8a('0x33')][_0xab8a('0x46')]?_0x317c90[_0xab8a('0x33')]:_0x2e189d[_0xab8a('0x30')];if(_0x110552['query'][_0xab8a('0x47')]){_0x317c90['include']=[{'all':!![]}];}_0x317c90=_[_0xab8a('0x3b')]({},_0x317c90,_0x110552[_0xab8a('0x3d')]);return db[_0xab8a('0x2b')][_0xab8a('0x48')](_0x317c90)[_0xab8a('0x23')](handleEntityNotFound(_0x23f1da,null))[_0xab8a('0x23')](respondWithResult(_0x23f1da,null))[_0xab8a('0x41')](handleError(_0x23f1da,null));};exports[_0xab8a('0x49')]=function(_0x1b584f,_0x587df0){return db[_0xab8a('0x2b')]['create'](_0x1b584f[_0xab8a('0x4a')],{})['then'](respondWithResult(_0x587df0,0xc9))[_0xab8a('0x41')](handleError(_0x587df0,null));};exports[_0xab8a('0x22')]=function(_0xaf1ebd,_0x47732a){if(_0xaf1ebd['body']['id']){delete _0xaf1ebd[_0xab8a('0x4a')]['id'];}return db[_0xab8a('0x2b')][_0xab8a('0x48')]({'where':{'id':_0xaf1ebd['params']['id']}})[_0xab8a('0x23')](handleEntityNotFound(_0x47732a,null))[_0xab8a('0x23')](saveUpdates(_0xaf1ebd[_0xab8a('0x4a')],null))[_0xab8a('0x23')](respondWithResult(_0x47732a,null))['catch'](handleError(_0x47732a,null));};exports['destroy']=function(_0xea6d12,_0x20d898){return db[_0xab8a('0x2b')]['find']({'where':{'id':_0xea6d12[_0xab8a('0x43')]['id']}})[_0xab8a('0x23')](handleEntityNotFound(_0x20d898,null))['then'](removeEntity(_0x20d898,null))[_0xab8a('0x41')](handleError(_0x20d898,null));};exports[_0xab8a('0x4b')]=function(_0x57814b,_0x1e6b0d,_0x5015f7){var _0x4147d6={};var _0x3220de={};var _0xbb9582;var _0x181649;return db[_0xab8a('0x2b')]['findOne']({'where':{'id':_0x57814b[_0xab8a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e6b0d,null))[_0xab8a('0x23')](function(_0x4b8798){if(_0x4b8798){_0xbb9582=_0x4b8798;_0x3220de[_0xab8a('0x30')]=_[_0xab8a('0x44')](db[_0xab8a('0x4c')]['rawAttributes']);_0x3220de[_0xab8a('0x31')]=_[_0xab8a('0x44')](_0x57814b[_0xab8a('0x31')]);_0x3220de[_0xab8a('0x38')]=_[_0xab8a('0x32')](_0x3220de['model'],_0x3220de['query']);_0x4147d6['attributes']=_[_0xab8a('0x32')](_0x3220de[_0xab8a('0x30')],qs[_0xab8a('0x45')](_0x57814b[_0xab8a('0x31')]['fields']));_0x4147d6[_0xab8a('0x33')]=_0x4147d6['attributes']['length']?_0x4147d6[_0xab8a('0x33')]:_0x3220de['model'];_0x4147d6[_0xab8a('0x35')]=qs['sort'](_0x57814b[_0xab8a('0x31')][_0xab8a('0x36')]);_0x4147d6['where']=qs[_0xab8a('0x38')](_[_0xab8a('0x39')](_0x57814b[_0xab8a('0x31')],_0x3220de['filters']));if(_0x57814b[_0xab8a('0x31')][_0xab8a('0x3a')]){_0x4147d6[_0xab8a('0x37')]=_['merge'](_0x4147d6[_0xab8a('0x37')],{'$or':_['map'](_0x4147d6[_0xab8a('0x33')],function(_0x2aa535){var _0x2070f1={};_0x2070f1[_0x2aa535]={'$like':'%'+_0x57814b[_0xab8a('0x31')]['filter']+'%'};return _0x2070f1;})});}_0x4147d6=_['merge']({},_0x4147d6,_0x57814b[_0xab8a('0x3d')]);return _0xbb9582[_0xab8a('0x4b')](_0x4147d6);}})['then'](function(_0x2862cf){if(_0x2862cf){_0x181649=_0x2862cf[_0xab8a('0x46')];if(!_0x57814b['query'][_0xab8a('0x34')](_0xab8a('0x4d'))){_0x4147d6[_0xab8a('0x1b')]=qs['limit'](_0x57814b['query']['limit']);_0x4147d6['offset']=qs[_0xab8a('0x1d')](_0x57814b[_0xab8a('0x31')][_0xab8a('0x1d')]);}return _0xbb9582['getFields'](_0x4147d6);}})['then'](function(_0x43e6c8){if(_0x43e6c8){return _0x43e6c8?{'count':_0x181649,'rows':_0x43e6c8}:null;}})[_0xab8a('0x23')](respondWithResult(_0x1e6b0d,null))[_0xab8a('0x41')](handleError(_0x1e6b0d,null));};exports['getSubjects']=function(_0x58d996,_0x3560cb,_0xa18596){var _0x49f9f7={};var _0x18e1b3={};var _0x38f7f6;var _0x117dc3;return db[_0xab8a('0x2b')][_0xab8a('0x4e')]({'where':{'id':_0x58d996['params']['id']}})[_0xab8a('0x23')](handleEntityNotFound(_0x3560cb,null))[_0xab8a('0x23')](function(_0x3c5f7d){if(_0x3c5f7d){_0x38f7f6=_0x3c5f7d;_0x18e1b3[_0xab8a('0x30')]=_[_0xab8a('0x44')](db[_0xab8a('0x4c')][_0xab8a('0x2c')]);_0x18e1b3['query']=_[_0xab8a('0x44')](_0x58d996[_0xab8a('0x31')]);_0x18e1b3[_0xab8a('0x38')]=_[_0xab8a('0x32')](_0x18e1b3[_0xab8a('0x30')],_0x18e1b3[_0xab8a('0x31')]);_0x49f9f7[_0xab8a('0x33')]=_['intersection'](_0x18e1b3[_0xab8a('0x30')],qs['fields'](_0x58d996['query'][_0xab8a('0x45')]));_0x49f9f7[_0xab8a('0x33')]=_0x49f9f7[_0xab8a('0x33')][_0xab8a('0x46')]?_0x49f9f7[_0xab8a('0x33')]:_0x18e1b3['model'];_0x49f9f7[_0xab8a('0x35')]=qs[_0xab8a('0x36')](_0x58d996[_0xab8a('0x31')][_0xab8a('0x36')]);_0x49f9f7[_0xab8a('0x37')]=qs[_0xab8a('0x38')](_[_0xab8a('0x39')](_0x58d996[_0xab8a('0x31')],_0x18e1b3[_0xab8a('0x38')]));if(_0x58d996[_0xab8a('0x31')][_0xab8a('0x3a')]){_0x49f9f7[_0xab8a('0x37')]=_[_0xab8a('0x3b')](_0x49f9f7['where'],{'$or':_[_0xab8a('0x2a')](_0x49f9f7[_0xab8a('0x33')],function(_0x4ae76d){var _0x3f1c70={};_0x3f1c70[_0x4ae76d]={'$like':'%'+_0x58d996[_0xab8a('0x31')][_0xab8a('0x3a')]+'%'};return _0x3f1c70;})});}_0x49f9f7=_['merge']({},_0x49f9f7,_0x58d996[_0xab8a('0x3d')]);return _0x38f7f6[_0xab8a('0x4f')](_0x49f9f7);}})['then'](function(_0xc16c95){if(_0xc16c95){_0x117dc3=_0xc16c95[_0xab8a('0x46')];if(!_0x58d996[_0xab8a('0x31')][_0xab8a('0x34')](_0xab8a('0x4d'))){_0x49f9f7[_0xab8a('0x1b')]=qs[_0xab8a('0x1b')](_0x58d996[_0xab8a('0x31')][_0xab8a('0x1b')]);_0x49f9f7[_0xab8a('0x1d')]=qs['offset'](_0x58d996[_0xab8a('0x31')][_0xab8a('0x1d')]);}return _0x38f7f6[_0xab8a('0x4f')](_0x49f9f7);}})[_0xab8a('0x23')](function(_0x560d93){if(_0x560d93){return _0x560d93?{'count':_0x117dc3,'rows':_0x560d93}:null;}})[_0xab8a('0x23')](respondWithResult(_0x3560cb,null))['catch'](handleError(_0x3560cb,null));};exports[_0xab8a('0x50')]=function(_0xf8d3c0,_0x481849,_0x40910f){var _0x1d1aa1={};var _0x155778={};var _0x315da7;var _0x1e64a8;return db[_0xab8a('0x2b')][_0xab8a('0x4e')]({'where':{'id':_0xf8d3c0['params']['id']}})[_0xab8a('0x23')](handleEntityNotFound(_0x481849,null))[_0xab8a('0x23')](function(_0x138295){if(_0x138295){_0x315da7=_0x138295;_0x155778[_0xab8a('0x30')]=_[_0xab8a('0x44')](db[_0xab8a('0x4c')][_0xab8a('0x2c')]);_0x155778[_0xab8a('0x31')]=_[_0xab8a('0x44')](_0xf8d3c0['query']);_0x155778[_0xab8a('0x38')]=_[_0xab8a('0x32')](_0x155778['model'],_0x155778[_0xab8a('0x31')]);_0x1d1aa1[_0xab8a('0x33')]=_[_0xab8a('0x32')](_0x155778[_0xab8a('0x30')],qs['fields'](_0xf8d3c0['query'][_0xab8a('0x45')]));_0x1d1aa1[_0xab8a('0x33')]=_0x1d1aa1[_0xab8a('0x33')][_0xab8a('0x46')]?_0x1d1aa1['attributes']:_0x155778[_0xab8a('0x30')];_0x1d1aa1[_0xab8a('0x35')]=qs['sort'](_0xf8d3c0[_0xab8a('0x31')][_0xab8a('0x36')]);_0x1d1aa1[_0xab8a('0x37')]=qs[_0xab8a('0x38')](_['pick'](_0xf8d3c0[_0xab8a('0x31')],_0x155778[_0xab8a('0x38')]));if(_0xf8d3c0['query']['filter']){_0x1d1aa1[_0xab8a('0x37')]=_['merge'](_0x1d1aa1['where'],{'$or':_[_0xab8a('0x2a')](_0x1d1aa1[_0xab8a('0x33')],function(_0x45e168){var _0x549465={};_0x549465[_0x45e168]={'$like':'%'+_0xf8d3c0[_0xab8a('0x31')][_0xab8a('0x3a')]+'%'};return _0x549465;})});}_0x1d1aa1=_[_0xab8a('0x3b')]({},_0x1d1aa1,_0xf8d3c0[_0xab8a('0x3d')]);return _0x315da7[_0xab8a('0x50')](_0x1d1aa1);}})[_0xab8a('0x23')](function(_0x535c5f){if(_0x535c5f){_0x1e64a8=_0x535c5f[_0xab8a('0x46')];if(!_0xf8d3c0[_0xab8a('0x31')][_0xab8a('0x34')](_0xab8a('0x4d'))){_0x1d1aa1[_0xab8a('0x1b')]=qs[_0xab8a('0x1b')](_0xf8d3c0[_0xab8a('0x31')][_0xab8a('0x1b')]);_0x1d1aa1['offset']=qs[_0xab8a('0x1d')](_0xf8d3c0['query'][_0xab8a('0x1d')]);}return _0x315da7[_0xab8a('0x50')](_0x1d1aa1);}})[_0xab8a('0x23')](function(_0x3de2f1){if(_0x3de2f1){return _0x3de2f1?{'count':_0x1e64a8,'rows':_0x3de2f1}:null;}})[_0xab8a('0x23')](respondWithResult(_0x481849,null))['catch'](handleError(_0x481849,null));};exports[_0xab8a('0x51')]=function(_0x5df35d,_0x40dba4,_0x7079eb){var _0x27792f={};var _0x47a957={};var _0x3b9ced;var _0x20638a;return db[_0xab8a('0x2b')]['findOne']({'where':{'id':_0x5df35d[_0xab8a('0x43')]['id']}})[_0xab8a('0x23')](handleEntityNotFound(_0x40dba4,null))[_0xab8a('0x23')](function(_0x35a095){if(_0x35a095){_0x3b9ced=_0x35a095;_0x47a957['model']=_[_0xab8a('0x44')](db[_0xab8a('0x52')][_0xab8a('0x2c')]);_0x47a957[_0xab8a('0x31')]=_[_0xab8a('0x44')](_0x5df35d[_0xab8a('0x31')]);_0x47a957['filters']=_[_0xab8a('0x32')](_0x47a957['model'],_0x47a957['query']);_0x27792f[_0xab8a('0x33')]=_['intersection'](_0x47a957[_0xab8a('0x30')],qs[_0xab8a('0x45')](_0x5df35d[_0xab8a('0x31')]['fields']));_0x27792f[_0xab8a('0x33')]=_0x27792f[_0xab8a('0x33')][_0xab8a('0x46')]?_0x27792f[_0xab8a('0x33')]:_0x47a957[_0xab8a('0x30')];_0x27792f[_0xab8a('0x35')]=qs['sort'](_0x5df35d[_0xab8a('0x31')][_0xab8a('0x36')]);_0x27792f[_0xab8a('0x37')]=qs[_0xab8a('0x38')](_[_0xab8a('0x39')](_0x5df35d['query'],_0x47a957[_0xab8a('0x38')]));if(_0x5df35d[_0xab8a('0x31')][_0xab8a('0x3a')]){_0x27792f['where']=_[_0xab8a('0x3b')](_0x27792f[_0xab8a('0x37')],{'$or':_[_0xab8a('0x2a')](_0x27792f[_0xab8a('0x33')],function(_0x297a79){var _0x1ab165={};_0x1ab165[_0x297a79]={'$like':'%'+_0x5df35d[_0xab8a('0x31')]['filter']+'%'};return _0x1ab165;})});}_0x27792f=_[_0xab8a('0x3b')]({},_0x27792f,_0x5df35d[_0xab8a('0x3d')]);return _0x3b9ced[_0xab8a('0x51')](_0x27792f);}})['then'](function(_0x40cbfa){if(_0x40cbfa){_0x20638a=_0x40cbfa[_0xab8a('0x46')];if(!_0x5df35d['query']['hasOwnProperty']('nolimit')){_0x27792f[_0xab8a('0x1b')]=qs['limit'](_0x5df35d[_0xab8a('0x31')][_0xab8a('0x1b')]);_0x27792f[_0xab8a('0x1d')]=qs[_0xab8a('0x1d')](_0x5df35d['query'][_0xab8a('0x1d')]);}return _0x3b9ced['getTags'](_0x27792f);}})[_0xab8a('0x23')](function(_0x38d93c){if(_0x38d93c){return _0x38d93c?{'count':_0x20638a,'rows':_0x38d93c}:null;}})[_0xab8a('0x23')](respondWithResult(_0x40dba4,null))[_0xab8a('0x41')](handleError(_0x40dba4,null));};exports['setTags']=function(_0x5b5f77,_0x1b10b7,_0x5cf5e9){if(_0x5b5f77[_0xab8a('0x4a')]['id']){delete _0x5b5f77[_0xab8a('0x4a')]['id'];}return db[_0xab8a('0x2b')][_0xab8a('0x4e')]({'where':{'id':_0x5b5f77[_0xab8a('0x43')]['id']}})[_0xab8a('0x23')](handleEntityNotFound(_0x1b10b7,null))['then'](function(_0x1e717d){if(_0x1e717d){return _0x1e717d['setTags'](_0x5b5f77[_0xab8a('0x4a')][_0xab8a('0x53')]||[]);}return null;})['then'](respondWithResult(_0x1b10b7,null))[_0xab8a('0x41')](handleError(_0x1b10b7,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 41c8a0f..044d1be 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 _0x77e6=['path','../../config/environment','./intZendeskConfiguration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1da454,_0x3d5991){var _0x34ed29=function(_0xb7c5de){while(--_0xb7c5de){_0x1da454['push'](_0x1da454['shift']());}};_0x34ed29(++_0x3d5991);}(_0x77e6,0x1a6));var _0x677e=function(_0x14dc94,_0x4de889){_0x14dc94=_0x14dc94-0x0;var _0x5302a2=_0x77e6[_0x14dc94];return _0x5302a2;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var logger=require(_0x677e('0x2'))(_0x677e('0x3'));var moment=require(_0x677e('0x4'));var BPromise=require(_0x677e('0x5'));var rp=require(_0x677e('0x6'));var fs=require('fs');var path=require(_0x677e('0x7'));var rimraf=require('rimraf');var config=require(_0x677e('0x8'));var attributes=require(_0x677e('0x9'));module['exports']=function(_0x18c5e1,_0x591b21){return _0x18c5e1[_0x677e('0xa')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x440a16,_0x2ebffa){_0x440a16=_0x440a16-0x0;var _0x36b2ff=_0xd7d1[_0x440a16];return _0x36b2ff;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index d3284f1..ebfb160 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 _0x77ff=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message'];(function(_0x325673,_0x13c10b){var _0x741c5b=function(_0x33eeb2){while(--_0x33eeb2){_0x325673['push'](_0x325673['shift']());}};_0x741c5b(++_0x13c10b);}(_0x77ff,0x65));var _0xf77f=function(_0x42a5a7,_0x5a7809){_0x42a5a7=_0x42a5a7-0x0;var _0x10709f=_0x77ff[_0x42a5a7];return _0x10709f;};'use strict';var _=require(_0xf77f('0x0'));var util=require(_0xf77f('0x1'));var moment=require(_0xf77f('0x2'));var BPromise=require(_0xf77f('0x3'));var rs=require(_0xf77f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf77f('0x5'))['db'];var utils=require(_0xf77f('0x6'));var logger=require(_0xf77f('0x7'))(_0xf77f('0x8'));var config=require(_0xf77f('0x9'));var jayson=require(_0xf77f('0xa'));var client=jayson[_0xf77f('0xb')][_0xf77f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c702e,_0x36b297,_0x3a2dea){return new BPromise(function(_0x4a45d9,_0x662d93){return client[_0xf77f('0xd')](_0x5c702e,_0x3a2dea)[_0xf77f('0xe')](function(_0x163a5e){logger[_0xf77f('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x36b297,_0xf77f('0x10'));logger[_0xf77f('0x11')](_0xf77f('0x12'),_0x36b297,_0xf77f('0x10'),JSON[_0xf77f('0x13')](_0x163a5e));if(_0x163a5e[_0xf77f('0x14')]){if(_0x163a5e['error'][_0xf77f('0x15')]===0x1f4){logger[_0xf77f('0x14')](_0xf77f('0x16'),_0x36b297,_0x163a5e[_0xf77f('0x14')][_0xf77f('0x17')]);return _0x662d93(_0x163a5e[_0xf77f('0x14')][_0xf77f('0x17')]);}logger['error'](_0xf77f('0x16'),_0x36b297,_0x163a5e[_0xf77f('0x14')][_0xf77f('0x17')]);return _0x4a45d9(_0x163a5e[_0xf77f('0x14')][_0xf77f('0x17')]);}else{logger[_0xf77f('0xf')](_0xf77f('0x16'),_0x36b297,_0xf77f('0x10'));_0x4a45d9(_0x163a5e['result'][_0xf77f('0x17')]);}})[_0xf77f('0x18')](function(_0x1f4b56){logger[_0xf77f('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x36b297,_0x1f4b56);_0x662d93(_0x1f4b56);});});} \ No newline at end of file +var _0xd548=['info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0xbe4161,_0x23f99d){var _0x2ec1c2=function(_0xadcd2d){while(--_0xadcd2d){_0xbe4161['push'](_0xbe4161['shift']());}};_0x2ec1c2(++_0x23f99d);}(_0xd548,0xff));var _0x8d54=function(_0x2f77ee,_0x2bff02){_0x2f77ee=_0x2f77ee-0x0;var _0x38d29a=_0xd548[_0x2f77ee];return _0x38d29a;};'use strict';var _=require('lodash');var util=require(_0x8d54('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d54('0x1'));var fs=require('fs');var Redis=require(_0x8d54('0x2'));var db=require(_0x8d54('0x3'))['db'];var utils=require(_0x8d54('0x4'));var logger=require('../../config/logger')(_0x8d54('0x5'));var config=require(_0x8d54('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8d54('0x7')][_0x8d54('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x408b8d,_0x3c35b0,_0x411894){return new BPromise(function(_0x5489f5,_0x2b4096){return client['request'](_0x408b8d,_0x411894)[_0x8d54('0x9')](function(_0x2aed4d){logger['info'](_0x8d54('0xa'),_0x3c35b0,'request\x20sent');logger[_0x8d54('0xb')](_0x8d54('0xc'),_0x3c35b0,_0x8d54('0xd'),JSON[_0x8d54('0xe')](_0x2aed4d));if(_0x2aed4d['error']){if(_0x2aed4d['error'][_0x8d54('0xf')]===0x1f4){logger[_0x8d54('0x10')](_0x8d54('0xa'),_0x3c35b0,_0x2aed4d['error'][_0x8d54('0x11')]);return _0x2b4096(_0x2aed4d['error']['message']);}logger['error'](_0x8d54('0xa'),_0x3c35b0,_0x2aed4d[_0x8d54('0x10')][_0x8d54('0x11')]);return _0x5489f5(_0x2aed4d[_0x8d54('0x10')][_0x8d54('0x11')]);}else{logger[_0x8d54('0x12')](_0x8d54('0xa'),_0x3c35b0,'request\x20sent');_0x5489f5(_0x2aed4d[_0x8d54('0x13')][_0x8d54('0x11')]);}})[_0x8d54('0x14')](function(_0x23303c){logger[_0x8d54('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3c35b0,_0x23303c);_0x2b4096(_0x23303c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7a4874f..98e7f33 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 _0xd811=['index','/:id','isAuthenticated','show','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x12bc0d,_0x1e40ca){var _0x18cf40=function(_0x7517e4){while(--_0x7517e4){_0x12bc0d['push'](_0x12bc0d['shift']());}};_0x18cf40(++_0x1e40ca);}(_0xd811,0x104));var _0x1d81=function(_0x1afda3,_0xf74e14){_0x1afda3=_0x1afda3-0x0;var _0x454b7c=_0xd811[_0x1afda3];return _0x454b7c;};'use strict';var multer=require(_0x1d81('0x0'));var util=require('util');var path=require(_0x1d81('0x1'));var timeout=require(_0x1d81('0x2'));var express=require(_0x1d81('0x3'));var router=express[_0x1d81('0x4')]();var fs_extra=require(_0x1d81('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1d81('0x6'));var config=require(_0x1d81('0x7'));var controller=require(_0x1d81('0x8'));router[_0x1d81('0x9')]('/',auth['isAuthenticated'](),controller[_0x1d81('0xa')]);router['get'](_0x1d81('0xb'),auth[_0x1d81('0xc')](),controller[_0x1d81('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1d81('0xe')]);router[_0x1d81('0xf')](_0x1d81('0xb'),auth['isAuthenticated'](),controller[_0x1d81('0x10')]);router[_0x1d81('0x11')]('/:id',auth[_0x1d81('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8633=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0xe72008,_0x585e49){var _0x3214e0=function(_0x4779c5){while(--_0x4779c5){_0xe72008['push'](_0xe72008['shift']());}};_0x3214e0(++_0x585e49);}(_0x8633,0x172));var _0x3863=function(_0x56364e,_0x38bdf1){_0x56364e=_0x56364e-0x0;var _0x4ec8cf=_0x8633[_0x56364e];return _0x4ec8cf;};'use strict';var multer=require(_0x3863('0x0'));var util=require(_0x3863('0x1'));var path=require(_0x3863('0x2'));var timeout=require(_0x3863('0x3'));var express=require(_0x3863('0x4'));var router=express[_0x3863('0x5')]();var fs_extra=require(_0x3863('0x6'));var auth=require(_0x3863('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3863('0x8'));var controller=require(_0x3863('0x9'));router['get']('/',auth[_0x3863('0xa')](),controller[_0x3863('0xb')]);router['get']('/:id',auth[_0x3863('0xa')](),controller['show']);router['post']('/',auth[_0x3863('0xa')](),controller[_0x3863('0xc')]);router[_0x3863('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3863('0xe')]);router['delete']('/:id',auth[_0x3863('0xa')](),controller[_0x3863('0xf')]);module[_0x3863('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index e3bb2b4..04fb4c4 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 _0x36ab=['keyValue','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x1e6bc1,_0x1e3986){var _0x1d148c=function(_0x4a7023){while(--_0x4a7023){_0x1e6bc1['push'](_0x1e6bc1['shift']());}};_0x1d148c(++_0x1e3986);}(_0x36ab,0xbc));var _0xb36a=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x36ab[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require(_0xb36a('0x0'));module['exports']={'type':{'type':Sequelize[_0xb36a('0x1')](_0xb36a('0x2'),_0xb36a('0x3'),'customVariable',_0xb36a('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xb36a('0x5')]},'key':{'type':Sequelize[_0xb36a('0x5')]},'keyType':{'type':Sequelize[_0xb36a('0x1')](_0xb36a('0x2'),_0xb36a('0x3'),_0xb36a('0x6'))},'keyContent':{'type':Sequelize[_0xb36a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb36a('0x5')]},'customField':{'type':Sequelize[_0xb36a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf092=['customVariable','BOOLEAN','exports','variable','keyValue','picklist','string','STRING','ENUM'];(function(_0x385fe6,_0x8ca61f){var _0x592030=function(_0x472eb3){while(--_0x472eb3){_0x385fe6['push'](_0x385fe6['shift']());}};_0x592030(++_0x8ca61f);}(_0xf092,0x122));var _0x2f09=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0xf092[_0x55daf2];return _0x1c8500;};'use strict';var Sequelize=require('sequelize');module[_0x2f09('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x2f09('0x1'),'customVariable',_0x2f09('0x2'),_0x2f09('0x3')),'defaultValue':_0x2f09('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2f09('0x5')]},'keyType':{'type':Sequelize[_0x2f09('0x6')](_0x2f09('0x4'),_0x2f09('0x1'),_0x2f09('0x7'))},'keyContent':{'type':Sequelize[_0x2f09('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2f09('0x5')]},'customField':{'type':Sequelize[_0x2f09('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2f09('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index c73687c..65a6702 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 _0x53d5=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','ZendeskField','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','eml-format','rimraf'];(function(_0x3fbcf9,_0x528109){var _0x4413bf=function(_0x1983d1){while(--_0x1983d1){_0x3fbcf9['push'](_0x3fbcf9['shift']());}};_0x4413bf(++_0x528109);}(_0x53d5,0x1cc));var _0x553d=function(_0x41de93,_0x54761e){_0x41de93=_0x41de93-0x0;var _0x492bd8=_0x53d5[_0x41de93];return _0x492bd8;};'use strict';var emlformat=require(_0x553d('0x0'));var rimraf=require(_0x553d('0x1'));var zipdir=require(_0x553d('0x2'));var jsonpatch=require(_0x553d('0x3'));var rp=require(_0x553d('0x4'));var moment=require(_0x553d('0x5'));var BPromise=require(_0x553d('0x6'));var Mustache=require('mustache');var util=require(_0x553d('0x7'));var path=require(_0x553d('0x8'));var sox=require(_0x553d('0x9'));var csv=require(_0x553d('0xa'));var ejs=require(_0x553d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x553d('0xc'));var squel=require(_0x553d('0xd'));var crypto=require(_0x553d('0xe'));var jsforce=require(_0x553d('0xf'));var deskjs=require(_0x553d('0x10'));var toCsv=require(_0x553d('0xa'));var querystring=require(_0x553d('0x11'));var Papa=require(_0x553d('0x12'));var Redis=require(_0x553d('0x13'));var authService=require(_0x553d('0x14'));var qs=require(_0x553d('0x15'));var as=require(_0x553d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x553d('0x17'));var utils=require('../../config/utils');var config=require(_0x553d('0x18'));var licenseUtil=require(_0x553d('0x19'));var db=require(_0x553d('0x1a'))['db'];function respondWithStatusCode(_0x1a54ea,_0x41f6c1){_0x41f6c1=_0x41f6c1||0xcc;return function(_0x4285c0){if(_0x4285c0){return _0x1a54ea[_0x553d('0x1b')](_0x41f6c1);}return _0x1a54ea[_0x553d('0x1c')](_0x41f6c1)[_0x553d('0x1d')]();};}function respondWithResult(_0x32b169,_0x3cb13c){_0x3cb13c=_0x3cb13c||0xc8;return function(_0xd11e74){if(_0xd11e74){return _0x32b169['status'](_0x3cb13c)[_0x553d('0x1e')](_0xd11e74);}};}function respondWithFilteredResult(_0x5caa96,_0x1d4f35){return function(_0x2de0c1){if(_0x2de0c1){var _0x12b505=typeof _0x1d4f35['offset']==='undefined'&&typeof _0x1d4f35[_0x553d('0x1f')]===_0x553d('0x20');var _0x2857c5=_0x2de0c1['count'];var _0x2ab468=_0x12b505?0x0:_0x1d4f35[_0x553d('0x21')];var _0x343ce5=_0x12b505?_0x2de0c1[_0x553d('0x22')]:_0x1d4f35[_0x553d('0x21')]+_0x1d4f35[_0x553d('0x1f')];var _0x719651;if(_0x343ce5>=_0x2857c5){_0x343ce5=_0x2857c5;_0x719651=0xc8;}else{_0x719651=0xce;}_0x5caa96[_0x553d('0x1c')](_0x719651);return _0x5caa96[_0x553d('0x23')](_0x553d('0x24'),_0x2ab468+'-'+_0x343ce5+'/'+_0x2857c5)[_0x553d('0x1e')](_0x2de0c1);}return null;};}function patchUpdates(_0x4950e7){return function(_0x11bc86){try{jsonpatch[_0x553d('0x25')](_0x11bc86,_0x4950e7,!![]);}catch(_0x4c5f0f){return BPromise[_0x553d('0x26')](_0x4c5f0f);}return _0x11bc86[_0x553d('0x27')]();};}function saveUpdates(_0x4d00e3,_0x5bbd2d){return function(_0x4a6e0e){if(_0x4a6e0e){return _0x4a6e0e['update'](_0x4d00e3)[_0x553d('0x28')](function(_0x53b217){return _0x53b217;});}return null;};}function removeEntity(_0x82dd3a,_0xacc984){return function(_0x2e4f1b){if(_0x2e4f1b){return _0x2e4f1b[_0x553d('0x29')]()[_0x553d('0x28')](function(){_0x82dd3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caed9,_0x491dc2){return function(_0x576c56){if(!_0x576c56){_0x2caed9[_0x553d('0x1b')](0x194);}return _0x576c56;};}function handleError(_0x517a1c,_0x677832){_0x677832=_0x677832||0x1f4;return function(_0x2c0484){logger[_0x553d('0x2a')](_0x2c0484['stack']);if(_0x2c0484[_0x553d('0x2b')]){delete _0x2c0484[_0x553d('0x2b')];}_0x517a1c[_0x553d('0x1c')](_0x677832)['send'](_0x2c0484);};}exports[_0x553d('0x2c')]=function(_0x39943d,_0x2bf05d){var _0x50fbc3={},_0x37ddd7={},_0x180a66={'count':0x0,'rows':[]};var _0xc3d157=_['map'](db[_0x553d('0x2d')]['rawAttributes'],function(_0x174fea){return{'name':_0x174fea[_0x553d('0x2e')],'type':_0x174fea[_0x553d('0x2f')][_0x553d('0x30')]};});_0x37ddd7[_0x553d('0x31')]=_[_0x553d('0x32')](_0xc3d157,_0x553d('0x2b'));_0x37ddd7[_0x553d('0x33')]=_['keys'](_0x39943d[_0x553d('0x33')]);_0x37ddd7[_0x553d('0x34')]=_[_0x553d('0x35')](_0x37ddd7[_0x553d('0x31')],_0x37ddd7[_0x553d('0x33')]);_0x50fbc3[_0x553d('0x36')]=_[_0x553d('0x35')](_0x37ddd7[_0x553d('0x31')],qs['fields'](_0x39943d[_0x553d('0x33')][_0x553d('0x37')]));_0x50fbc3[_0x553d('0x36')]=_0x50fbc3['attributes'][_0x553d('0x38')]?_0x50fbc3[_0x553d('0x36')]:_0x37ddd7[_0x553d('0x31')];if(!_0x39943d[_0x553d('0x33')][_0x553d('0x39')](_0x553d('0x3a'))){_0x50fbc3[_0x553d('0x1f')]=qs[_0x553d('0x1f')](_0x39943d['query']['limit']);_0x50fbc3[_0x553d('0x21')]=qs[_0x553d('0x21')](_0x39943d['query'][_0x553d('0x21')]);}_0x50fbc3['order']=qs['sort'](_0x39943d[_0x553d('0x33')]['sort']);_0x50fbc3[_0x553d('0x3b')]=qs['filters'](_[_0x553d('0x3c')](_0x39943d[_0x553d('0x33')],_0x37ddd7['filters']),_0xc3d157);if(_0x39943d['query'][_0x553d('0x3d')]){_0x50fbc3[_0x553d('0x3b')]=_[_0x553d('0x3e')](_0x50fbc3[_0x553d('0x3b')],{'$or':_['map'](_0xc3d157,function(_0x19ed0e){if(_0x19ed0e[_0x553d('0x2f')]!=='VIRTUAL'){var _0xfac8ee={};_0xfac8ee[_0x19ed0e['name']]={'$like':'%'+_0x39943d[_0x553d('0x33')][_0x553d('0x3d')]+'%'};return _0xfac8ee;}})});}_0x50fbc3=_[_0x553d('0x3e')]({},_0x50fbc3,_0x39943d[_0x553d('0x3f')]);var _0x50776a={'where':_0x50fbc3['where']};return db[_0x553d('0x2d')][_0x553d('0x22')](_0x50776a)[_0x553d('0x28')](function(_0x32dfb8){_0x180a66[_0x553d('0x22')]=_0x32dfb8;if(_0x39943d[_0x553d('0x33')][_0x553d('0x40')]){_0x50fbc3[_0x553d('0x41')]=[{'all':!![]}];}return db[_0x553d('0x2d')][_0x553d('0x42')](_0x50fbc3);})['then'](function(_0x431fdb){_0x180a66[_0x553d('0x43')]=_0x431fdb;return _0x180a66;})['then'](respondWithFilteredResult(_0x2bf05d,_0x50fbc3))[_0x553d('0x44')](handleError(_0x2bf05d,null));};exports[_0x553d('0x45')]=function(_0x5cfbbc,_0x1caab8){var _0x60cdd3={'raw':!![],'where':{'id':_0x5cfbbc[_0x553d('0x46')]['id']}},_0x40bc7a={};_0x40bc7a[_0x553d('0x31')]=_[_0x553d('0x47')](db['ZendeskField'][_0x553d('0x48')]);_0x40bc7a[_0x553d('0x33')]=_[_0x553d('0x47')](_0x5cfbbc['query']);_0x40bc7a[_0x553d('0x34')]=_[_0x553d('0x35')](_0x40bc7a['model'],_0x40bc7a[_0x553d('0x33')]);_0x60cdd3[_0x553d('0x36')]=_[_0x553d('0x35')](_0x40bc7a[_0x553d('0x31')],qs[_0x553d('0x37')](_0x5cfbbc[_0x553d('0x33')][_0x553d('0x37')]));_0x60cdd3[_0x553d('0x36')]=_0x60cdd3[_0x553d('0x36')]['length']?_0x60cdd3[_0x553d('0x36')]:_0x40bc7a['model'];if(_0x5cfbbc[_0x553d('0x33')]['includeAll']){_0x60cdd3[_0x553d('0x41')]=[{'all':!![]}];}_0x60cdd3=_[_0x553d('0x3e')]({},_0x60cdd3,_0x5cfbbc['options']);return db[_0x553d('0x2d')][_0x553d('0x49')](_0x60cdd3)[_0x553d('0x28')](handleEntityNotFound(_0x1caab8,null))[_0x553d('0x28')](respondWithResult(_0x1caab8,null))[_0x553d('0x44')](handleError(_0x1caab8,null));};exports['create']=function(_0x28a20b,_0x545dbf){return db[_0x553d('0x2d')][_0x553d('0x4a')](_0x28a20b[_0x553d('0x4b')],{})[_0x553d('0x28')](respondWithResult(_0x545dbf,0xc9))[_0x553d('0x44')](handleError(_0x545dbf,null));};exports[_0x553d('0x4c')]=function(_0xb6b182,_0x29259a){if(_0xb6b182[_0x553d('0x4b')]['id']){delete _0xb6b182[_0x553d('0x4b')]['id'];}return db[_0x553d('0x2d')][_0x553d('0x49')]({'where':{'id':_0xb6b182[_0x553d('0x46')]['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x29259a,null))[_0x553d('0x28')](saveUpdates(_0xb6b182[_0x553d('0x4b')],null))[_0x553d('0x28')](respondWithResult(_0x29259a,null))['catch'](handleError(_0x29259a,null));};exports[_0x553d('0x29')]=function(_0x1ed718,_0x2e1ff6){return db[_0x553d('0x2d')]['find']({'where':{'id':_0x1ed718['params']['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x2e1ff6,null))[_0x553d('0x28')](removeEntity(_0x2e1ff6,null))[_0x553d('0x44')](handleError(_0x2e1ff6,null));}; \ No newline at end of file +var _0x62c8=['destroy','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','includeAll','find','catch','create','body','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','update','then'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0x62c8,0x1ad));var _0x862c=function(_0xece11a,_0x2c5eeb){_0xece11a=_0xece11a-0x0;var _0x322c46=_0x62c8[_0xece11a];return _0x322c46;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x862c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x862c('0x1'));var BPromise=require(_0x862c('0x2'));var Mustache=require(_0x862c('0x3'));var util=require(_0x862c('0x4'));var path=require(_0x862c('0x5'));var sox=require(_0x862c('0x6'));var csv=require('to-csv');var ejs=require(_0x862c('0x7'));var fs=require('fs');var fs_extra=require(_0x862c('0x8'));var _=require(_0x862c('0x9'));var squel=require(_0x862c('0xa'));var crypto=require(_0x862c('0xb'));var jsforce=require(_0x862c('0xc'));var deskjs=require(_0x862c('0xd'));var toCsv=require(_0x862c('0xe'));var querystring=require(_0x862c('0xf'));var Papa=require(_0x862c('0x10'));var Redis=require(_0x862c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x862c('0x12'));var as=require(_0x862c('0x13'));var hardwareService=require(_0x862c('0x14'));var logger=require(_0x862c('0x15'))(_0x862c('0x16'));var utils=require('../../config/utils');var config=require(_0x862c('0x17'));var licenseUtil=require(_0x862c('0x18'));var db=require(_0x862c('0x19'))['db'];function respondWithStatusCode(_0x2018f6,_0xc2a8f1){_0xc2a8f1=_0xc2a8f1||0xcc;return function(_0xe32af7){if(_0xe32af7){return _0x2018f6[_0x862c('0x1a')](_0xc2a8f1);}return _0x2018f6[_0x862c('0x1b')](_0xc2a8f1)[_0x862c('0x1c')]();};}function respondWithResult(_0x468c58,_0xcc78c8){_0xcc78c8=_0xcc78c8||0xc8;return function(_0x3755ce){if(_0x3755ce){return _0x468c58[_0x862c('0x1b')](_0xcc78c8)[_0x862c('0x1d')](_0x3755ce);}};}function respondWithFilteredResult(_0x3aa366,_0x5213e1){return function(_0x2cc463){if(_0x2cc463){var _0x5a7f05=typeof _0x5213e1['offset']===_0x862c('0x1e')&&typeof _0x5213e1['limit']===_0x862c('0x1e');var _0x28c2c5=_0x2cc463[_0x862c('0x1f')];var _0x13f6b2=_0x5a7f05?0x0:_0x5213e1[_0x862c('0x20')];var _0xb78a09=_0x5a7f05?_0x2cc463[_0x862c('0x1f')]:_0x5213e1[_0x862c('0x20')]+_0x5213e1[_0x862c('0x21')];var _0x1109e7;if(_0xb78a09>=_0x28c2c5){_0xb78a09=_0x28c2c5;_0x1109e7=0xc8;}else{_0x1109e7=0xce;}_0x3aa366[_0x862c('0x1b')](_0x1109e7);return _0x3aa366[_0x862c('0x22')]('Content-Range',_0x13f6b2+'-'+_0xb78a09+'/'+_0x28c2c5)[_0x862c('0x1d')](_0x2cc463);}return null;};}function patchUpdates(_0x3828e0){return function(_0x483bda){try{jsonpatch['apply'](_0x483bda,_0x3828e0,!![]);}catch(_0x8a540f){return BPromise[_0x862c('0x23')](_0x8a540f);}return _0x483bda[_0x862c('0x24')]();};}function saveUpdates(_0x575963,_0x1279c3){return function(_0x11276d){if(_0x11276d){return _0x11276d[_0x862c('0x25')](_0x575963)[_0x862c('0x26')](function(_0x4a82e4){return _0x4a82e4;});}return null;};}function removeEntity(_0x171a07,_0x1e0d60){return function(_0x46f245){if(_0x46f245){return _0x46f245[_0x862c('0x27')]()[_0x862c('0x26')](function(){_0x171a07[_0x862c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d97bc,_0x4b5331){return function(_0x280a10){if(!_0x280a10){_0x1d97bc[_0x862c('0x1a')](0x194);}return _0x280a10;};}function handleError(_0x185f7f,_0x1504a7){_0x1504a7=_0x1504a7||0x1f4;return function(_0x2e16a0){logger[_0x862c('0x28')](_0x2e16a0[_0x862c('0x29')]);if(_0x2e16a0[_0x862c('0x2a')]){delete _0x2e16a0[_0x862c('0x2a')];}_0x185f7f[_0x862c('0x1b')](_0x1504a7)[_0x862c('0x2b')](_0x2e16a0);};}exports['index']=function(_0x2405fd,_0x522b01){var _0x332209={},_0x55bbd0={},_0x119f6c={'count':0x0,'rows':[]};var _0x3feeb9=_[_0x862c('0x2c')](db[_0x862c('0x2d')][_0x862c('0x2e')],function(_0x563e2f){return{'name':_0x563e2f[_0x862c('0x2f')],'type':_0x563e2f[_0x862c('0x30')][_0x862c('0x31')]};});_0x55bbd0[_0x862c('0x32')]=_[_0x862c('0x2c')](_0x3feeb9,_0x862c('0x2a'));_0x55bbd0[_0x862c('0x33')]=_['keys'](_0x2405fd[_0x862c('0x33')]);_0x55bbd0[_0x862c('0x34')]=_[_0x862c('0x35')](_0x55bbd0['model'],_0x55bbd0[_0x862c('0x33')]);_0x332209['attributes']=_['intersection'](_0x55bbd0[_0x862c('0x32')],qs[_0x862c('0x36')](_0x2405fd[_0x862c('0x33')][_0x862c('0x36')]));_0x332209[_0x862c('0x37')]=_0x332209[_0x862c('0x37')]['length']?_0x332209[_0x862c('0x37')]:_0x55bbd0[_0x862c('0x32')];if(!_0x2405fd[_0x862c('0x33')][_0x862c('0x38')](_0x862c('0x39'))){_0x332209[_0x862c('0x21')]=qs[_0x862c('0x21')](_0x2405fd[_0x862c('0x33')][_0x862c('0x21')]);_0x332209['offset']=qs[_0x862c('0x20')](_0x2405fd['query']['offset']);}_0x332209[_0x862c('0x3a')]=qs[_0x862c('0x3b')](_0x2405fd[_0x862c('0x33')][_0x862c('0x3b')]);_0x332209[_0x862c('0x3c')]=qs[_0x862c('0x34')](_[_0x862c('0x3d')](_0x2405fd['query'],_0x55bbd0[_0x862c('0x34')]),_0x3feeb9);if(_0x2405fd[_0x862c('0x33')][_0x862c('0x3e')]){_0x332209[_0x862c('0x3c')]=_[_0x862c('0x3f')](_0x332209[_0x862c('0x3c')],{'$or':_['map'](_0x3feeb9,function(_0x2891ee){if(_0x2891ee[_0x862c('0x30')]!==_0x862c('0x40')){var _0x12b0b4={};_0x12b0b4[_0x2891ee['name']]={'$like':'%'+_0x2405fd[_0x862c('0x33')][_0x862c('0x3e')]+'%'};return _0x12b0b4;}})});}_0x332209=_['merge']({},_0x332209,_0x2405fd[_0x862c('0x41')]);var _0x3d6b52={'where':_0x332209['where']};return db[_0x862c('0x2d')][_0x862c('0x1f')](_0x3d6b52)[_0x862c('0x26')](function(_0x2af05d){_0x119f6c[_0x862c('0x1f')]=_0x2af05d;if(_0x2405fd[_0x862c('0x33')]['includeAll']){_0x332209[_0x862c('0x42')]=[{'all':!![]}];}return db['ZendeskField'][_0x862c('0x43')](_0x332209);})[_0x862c('0x26')](function(_0x167d9f){_0x119f6c[_0x862c('0x44')]=_0x167d9f;return _0x119f6c;})[_0x862c('0x26')](respondWithFilteredResult(_0x522b01,_0x332209))['catch'](handleError(_0x522b01,null));};exports[_0x862c('0x45')]=function(_0x3e6015,_0x184c87){var _0x11d01b={'raw':!![],'where':{'id':_0x3e6015[_0x862c('0x46')]['id']}},_0x41124c={};_0x41124c[_0x862c('0x32')]=_['keys'](db[_0x862c('0x2d')][_0x862c('0x2e')]);_0x41124c[_0x862c('0x33')]=_[_0x862c('0x47')](_0x3e6015['query']);_0x41124c[_0x862c('0x34')]=_[_0x862c('0x35')](_0x41124c['model'],_0x41124c[_0x862c('0x33')]);_0x11d01b[_0x862c('0x37')]=_[_0x862c('0x35')](_0x41124c['model'],qs[_0x862c('0x36')](_0x3e6015[_0x862c('0x33')][_0x862c('0x36')]));_0x11d01b['attributes']=_0x11d01b[_0x862c('0x37')][_0x862c('0x48')]?_0x11d01b[_0x862c('0x37')]:_0x41124c[_0x862c('0x32')];if(_0x3e6015[_0x862c('0x33')][_0x862c('0x49')]){_0x11d01b[_0x862c('0x42')]=[{'all':!![]}];}_0x11d01b=_[_0x862c('0x3f')]({},_0x11d01b,_0x3e6015[_0x862c('0x41')]);return db[_0x862c('0x2d')][_0x862c('0x4a')](_0x11d01b)['then'](handleEntityNotFound(_0x184c87,null))['then'](respondWithResult(_0x184c87,null))[_0x862c('0x4b')](handleError(_0x184c87,null));};exports['create']=function(_0x41c490,_0x1a9ef1){return db['ZendeskField'][_0x862c('0x4c')](_0x41c490[_0x862c('0x4d')],{})[_0x862c('0x26')](respondWithResult(_0x1a9ef1,0xc9))[_0x862c('0x4b')](handleError(_0x1a9ef1,null));};exports['update']=function(_0x485b2d,_0x4de26c){if(_0x485b2d[_0x862c('0x4d')]['id']){delete _0x485b2d[_0x862c('0x4d')]['id'];}return db[_0x862c('0x2d')][_0x862c('0x4a')]({'where':{'id':_0x485b2d[_0x862c('0x46')]['id']}})[_0x862c('0x26')](handleEntityNotFound(_0x4de26c,null))[_0x862c('0x26')](saveUpdates(_0x485b2d['body'],null))[_0x862c('0x26')](respondWithResult(_0x4de26c,null))['catch'](handleError(_0x4de26c,null));};exports['destroy']=function(_0x143040,_0x8f49dc){return db[_0x862c('0x2d')]['find']({'where':{'id':_0x143040[_0x862c('0x46')]['id']}})[_0x862c('0x26')](handleEntityNotFound(_0x8f49dc,null))[_0x862c('0x26')](removeEntity(_0x8f49dc,null))[_0x862c('0x4b')](handleError(_0x8f49dc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 9b08962..3f29119 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 _0x396d=['../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','FieldId','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x396d,0x18d));var _0xd396=function(_0x1abaae,_0x18db95){_0x1abaae=_0x1abaae-0x0;var _0x5ba039=_0x396d[_0x1abaae];return _0x5ba039;};'use strict';var _=require(_0xd396('0x0'));var util=require(_0xd396('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd396('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd396('0x3'));var attributes=require(_0xd396('0x4'));module[_0xd396('0x5')]=function(_0x5a11c4,_0x49137a){return _0x5a11c4[_0xd396('0x6')](_0xd396('0x7'),attributes,{'tableName':_0xd396('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xd396('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafa9=['api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','idField','lodash','util'];(function(_0x452fda,_0x2dd516){var _0xa173d6=function(_0x5b98da){while(--_0x5b98da){_0x452fda['push'](_0x452fda['shift']());}};_0xa173d6(++_0x2dd516);}(_0xafa9,0x1ec));var _0x9afa=function(_0x2ace95,_0x186b37){_0x2ace95=_0x2ace95-0x0;var _0x35ecfa=_0xafa9[_0x2ace95];return _0x35ecfa;};'use strict';var _=require(_0x9afa('0x0'));var util=require(_0x9afa('0x1'));var logger=require('../../config/logger')(_0x9afa('0x2'));var moment=require(_0x9afa('0x3'));var BPromise=require(_0x9afa('0x4'));var rp=require(_0x9afa('0x5'));var fs=require('fs');var path=require(_0x9afa('0x6'));var rimraf=require(_0x9afa('0x7'));var config=require('../../config/environment');var attributes=require(_0x9afa('0x8'));module['exports']=function(_0x282f61,_0x145281){return _0x282f61[_0x9afa('0x9')]('ZendeskField',attributes,{'tableName':_0x9afa('0xa'),'paranoid':![],'indexes':[{'name':_0x9afa('0xb'),'fields':[_0x9afa('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 3effbbc..e3d926f 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 _0x4087=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x90334d,_0x3ec517){var _0x42c8cf=function(_0x28520a){while(--_0x28520a){_0x90334d['push'](_0x90334d['shift']());}};_0x42c8cf(++_0x3ec517);}(_0x4087,0x131));var _0x7408=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4087[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7408('0x0'));var util=require(_0x7408('0x1'));var moment=require('moment');var BPromise=require(_0x7408('0x2'));var rs=require(_0x7408('0x3'));var fs=require('fs');var Redis=require(_0x7408('0x4'));var db=require(_0x7408('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7408('0x6'))(_0x7408('0x7'));var config=require('../../config/environment');var jayson=require(_0x7408('0x8'));var client=jayson['client'][_0x7408('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fa560,_0x3b91c3,_0x6a41c3){return new BPromise(function(_0x48af2e,_0x3ef335){return client[_0x7408('0xa')](_0x1fa560,_0x6a41c3)[_0x7408('0xb')](function(_0xcf6c3a){logger[_0x7408('0xc')](_0x7408('0xd'),_0x3b91c3,_0x7408('0xe'));logger[_0x7408('0xf')](_0x7408('0x10'),_0x3b91c3,'request\x20sent',JSON[_0x7408('0x11')](_0xcf6c3a));if(_0xcf6c3a['error']){if(_0xcf6c3a[_0x7408('0x12')][_0x7408('0x13')]===0x1f4){logger[_0x7408('0x12')](_0x7408('0xd'),_0x3b91c3,_0xcf6c3a[_0x7408('0x12')][_0x7408('0x14')]);return _0x3ef335(_0xcf6c3a['error'][_0x7408('0x14')]);}logger[_0x7408('0x12')](_0x7408('0xd'),_0x3b91c3,_0xcf6c3a[_0x7408('0x12')][_0x7408('0x14')]);return _0x48af2e(_0xcf6c3a[_0x7408('0x12')][_0x7408('0x14')]);}else{logger[_0x7408('0xc')](_0x7408('0xd'),_0x3b91c3,_0x7408('0xe'));_0x48af2e(_0xcf6c3a[_0x7408('0x15')]['message']);}})[_0x7408('0x16')](function(_0x38c75d){logger[_0x7408('0x12')](_0x7408('0xd'),_0x3b91c3,_0x38c75d);_0x3ef335(_0x38c75d);});});} \ No newline at end of file +var _0xa117=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0xa117,0x1aa));var _0x7a11=function(_0x49bd45,_0x307def){_0x49bd45=_0x49bd45-0x0;var _0xaaf984=_0xa117[_0x49bd45];return _0xaaf984;};'use strict';var _=require(_0x7a11('0x0'));var util=require(_0x7a11('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7a11('0x2'));var fs=require('fs');var Redis=require(_0x7a11('0x3'));var db=require(_0x7a11('0x4'))['db'];var utils=require(_0x7a11('0x5'));var logger=require(_0x7a11('0x6'))('rpc');var config=require(_0x7a11('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7a11('0x8')][_0x7a11('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14b983,_0x44dcb7,_0x35bdac){return new BPromise(function(_0x4974a5,_0x14369e){return client[_0x7a11('0xa')](_0x14b983,_0x35bdac)[_0x7a11('0xb')](function(_0x55b016){logger['info'](_0x7a11('0xc'),_0x44dcb7,_0x7a11('0xd'));logger['debug'](_0x7a11('0xe'),_0x44dcb7,_0x7a11('0xd'),JSON[_0x7a11('0xf')](_0x55b016));if(_0x55b016['error']){if(_0x55b016[_0x7a11('0x10')][_0x7a11('0x11')]===0x1f4){logger[_0x7a11('0x10')]('ZendeskField,\x20%s,\x20%s',_0x44dcb7,_0x55b016['error'][_0x7a11('0x12')]);return _0x14369e(_0x55b016[_0x7a11('0x10')]['message']);}logger[_0x7a11('0x10')]('ZendeskField,\x20%s,\x20%s',_0x44dcb7,_0x55b016[_0x7a11('0x10')][_0x7a11('0x12')]);return _0x4974a5(_0x55b016['error'][_0x7a11('0x12')]);}else{logger['info'](_0x7a11('0xc'),_0x44dcb7,_0x7a11('0xd'));_0x4974a5(_0x55b016[_0x7a11('0x13')][_0x7a11('0x12')]);}})['catch'](function(_0x2f34ee){logger[_0x7a11('0x10')](_0x7a11('0xc'),_0x44dcb7,_0x2f34ee);_0x14369e(_0x2f34ee);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3871f32..7d5df91 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 _0xe613=['addConfiguration','put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/configurations','isAuthenticated','post'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xe613,0x7d));var _0x3e61=function(_0x75f783,_0xa95d9){_0x75f783=_0x75f783-0x0;var _0x3e2b42=_0xe613[_0x75f783];return _0x3e2b42;};'use strict';var multer=require('multer');var util=require(_0x3e61('0x0'));var path=require(_0x3e61('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e61('0x2'));var router=express[_0x3e61('0x3')]();var fs_extra=require(_0x3e61('0x4'));var auth=require(_0x3e61('0x5'));var interaction=require(_0x3e61('0x6'));var config=require(_0x3e61('0x7'));var controller=require('./intZohoAccount.controller');router[_0x3e61('0x8')]('/',auth['isAuthenticated'](),controller[_0x3e61('0x9')]);router[_0x3e61('0x8')](_0x3e61('0xa'),auth['isAuthenticated'](),controller[_0x3e61('0xb')]);router[_0x3e61('0x8')](_0x3e61('0xc'),auth[_0x3e61('0xd')](),controller['getConfigurations']);router[_0x3e61('0x8')]('/:id/fields',auth[_0x3e61('0xd')](),controller['getFields']);router[_0x3e61('0xe')]('/',auth[_0x3e61('0xd')](),controller['create']);router[_0x3e61('0xe')](_0x3e61('0xc'),auth[_0x3e61('0xd')](),controller[_0x3e61('0xf')]);router[_0x3e61('0x10')](_0x3e61('0xa'),auth[_0x3e61('0xd')](),controller[_0x3e61('0x11')]);router[_0x3e61('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3e61('0x13')]);module['exports']=router; \ No newline at end of file +var _0x690f=['/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','put','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index'];(function(_0x1fcedf,_0x584d1d){var _0x3c0e1b=function(_0x49d40f){while(--_0x49d40f){_0x1fcedf['push'](_0x1fcedf['shift']());}};_0x3c0e1b(++_0x584d1d);}(_0x690f,0x172));var _0xf690=function(_0x7b8f3b,_0x57354f){_0x7b8f3b=_0x7b8f3b-0x0;var _0x4e1f0f=_0x690f[_0x7b8f3b];return _0x4e1f0f;};'use strict';var multer=require(_0xf690('0x0'));var util=require(_0xf690('0x1'));var path=require(_0xf690('0x2'));var timeout=require(_0xf690('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf690('0x4'));var interaction=require(_0xf690('0x5'));var config=require(_0xf690('0x6'));var controller=require(_0xf690('0x7'));router[_0xf690('0x8')]('/',auth['isAuthenticated'](),controller[_0xf690('0x9')]);router[_0xf690('0x8')](_0xf690('0xa'),auth[_0xf690('0xb')](),controller['show']);router[_0xf690('0x8')]('/:id/configurations',auth[_0xf690('0xb')](),controller[_0xf690('0xc')]);router[_0xf690('0x8')](_0xf690('0xd'),auth[_0xf690('0xb')](),controller[_0xf690('0xe')]);router[_0xf690('0xf')]('/',auth[_0xf690('0xb')](),controller[_0xf690('0x10')]);router[_0xf690('0xf')]('/:id/configurations',auth[_0xf690('0xb')](),controller['addConfiguration']);router[_0xf690('0x11')](_0xf690('0xa'),auth[_0xf690('0xb')](),controller['update']);router[_0xf690('0x12')](_0xf690('0xa'),auth[_0xf690('0xb')](),controller[_0xf690('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index cb9a1db..e93e471 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 _0x4c4e=['sequelize','STRING'];(function(_0x313913,_0x49e3e9){var _0x4b04f2=function(_0x7e4d05){while(--_0x7e4d05){_0x313913['push'](_0x313913['shift']());}};_0x4b04f2(++_0x49e3e9);}(_0x4c4e,0x152));var _0xe4c4=function(_0x2a9f91,_0x27b569){_0x2a9f91=_0x2a9f91-0x0;var _0xb9b7c1=_0x4c4e[_0x2a9f91];return _0xb9b7c1;};'use strict';var Sequelize=require(_0xe4c4('0x0'));module['exports']={'name':{'type':Sequelize[_0xe4c4('0x1')]},'description':{'type':Sequelize[_0xe4c4('0x1')]},'host':{'type':Sequelize[_0xe4c4('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe4c4('0x1')]},'clientSecret':{'type':Sequelize[_0xe4c4('0x1')]},'serverUrl':{'type':Sequelize[_0xe4c4('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xe4c4('0x1')]}}; \ No newline at end of file +var _0xee5b=['sequelize','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xee5b,0x1f4));var _0xbee5=function(_0x300d20,_0x3b4ef5){_0x300d20=_0x300d20-0x0;var _0x3843ae=_0xee5b[_0x300d20];return _0x3843ae;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'name':{'type':Sequelize[_0xbee5('0x1')]},'description':{'type':Sequelize[_0xbee5('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbee5('0x1')]},'clientId':{'type':Sequelize[_0xbee5('0x1')]},'clientSecret':{'type':Sequelize[_0xbee5('0x1')]},'serverUrl':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index fbb4b31..6e8d0f8 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 _0xa6e3=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','ZohoAccount','findAll','catch','show','params','keys','include','merge','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','clientSecret','serverUrl','code','host','zoho.eu','com','slice','substring','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration'];(function(_0x1c28e9,_0x304609){var _0x58bd0b=function(_0x336f32){while(--_0x336f32){_0x1c28e9['push'](_0x1c28e9['shift']());}};_0x58bd0b(++_0x304609);}(_0xa6e3,0xf6));var _0x3a6e=function(_0x4fd994,_0x199a8a){_0x4fd994=_0x4fd994-0x0;var _0x5034ec=_0xa6e3[_0x4fd994];return _0x5034ec;};'use strict';var emlformat=require(_0x3a6e('0x0'));var rimraf=require(_0x3a6e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a6e('0x2'));var rp=require(_0x3a6e('0x3'));var moment=require(_0x3a6e('0x4'));var BPromise=require(_0x3a6e('0x5'));var Mustache=require(_0x3a6e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3a6e('0x7'));var csv=require(_0x3a6e('0x8'));var ejs=require(_0x3a6e('0x9'));var fs=require('fs');var fs_extra=require(_0x3a6e('0xa'));var _=require(_0x3a6e('0xb'));var squel=require('squel');var crypto=require(_0x3a6e('0xc'));var jsforce=require(_0x3a6e('0xd'));var deskjs=require(_0x3a6e('0xe'));var toCsv=require(_0x3a6e('0x8'));var querystring=require(_0x3a6e('0xf'));var Papa=require(_0x3a6e('0x10'));var Redis=require(_0x3a6e('0x11'));var authService=require(_0x3a6e('0x12'));var qs=require(_0x3a6e('0x13'));var as=require(_0x3a6e('0x14'));var hardwareService=require(_0x3a6e('0x15'));var logger=require('../../config/logger')(_0x3a6e('0x16'));var utils=require(_0x3a6e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3a6e('0x18'))['db'];var integrations=require(_0x3a6e('0x19'));function respondWithStatusCode(_0xd44154,_0x48c68f){_0x48c68f=_0x48c68f||0xcc;return function(_0x10df06){if(_0x10df06){return _0xd44154[_0x3a6e('0x1a')](_0x48c68f);}return _0xd44154[_0x3a6e('0x1b')](_0x48c68f)['end']();};}function respondWithResult(_0x2c8803,_0x1f9322){_0x1f9322=_0x1f9322||0xc8;return function(_0x32083c){if(_0x32083c){return _0x2c8803[_0x3a6e('0x1b')](_0x1f9322)[_0x3a6e('0x1c')](_0x32083c);}};}function respondWithFilteredResult(_0x3a9c1e,_0x1f5db1){return function(_0x5b0304){if(_0x5b0304){var _0x54a6dc=typeof _0x1f5db1[_0x3a6e('0x1d')]===_0x3a6e('0x1e')&&typeof _0x1f5db1[_0x3a6e('0x1f')]===_0x3a6e('0x1e');var _0x2277f4=_0x5b0304[_0x3a6e('0x20')];var _0x9cc89d=_0x54a6dc?0x0:_0x1f5db1[_0x3a6e('0x1d')];var _0xdebf66=_0x54a6dc?_0x5b0304[_0x3a6e('0x20')]:_0x1f5db1[_0x3a6e('0x1d')]+_0x1f5db1[_0x3a6e('0x1f')];var _0x28b000;if(_0xdebf66>=_0x2277f4){_0xdebf66=_0x2277f4;_0x28b000=0xc8;}else{_0x28b000=0xce;}_0x3a9c1e[_0x3a6e('0x1b')](_0x28b000);return _0x3a9c1e[_0x3a6e('0x21')](_0x3a6e('0x22'),_0x9cc89d+'-'+_0xdebf66+'/'+_0x2277f4)['json'](_0x5b0304);}return null;};}function patchUpdates(_0x33e41e){return function(_0x1bfd3f){try{jsonpatch[_0x3a6e('0x23')](_0x1bfd3f,_0x33e41e,!![]);}catch(_0x7283ac){return BPromise[_0x3a6e('0x24')](_0x7283ac);}return _0x1bfd3f['save']();};}function saveUpdates(_0x526a55,_0x36406c){return function(_0xeb8e3){if(_0xeb8e3){return _0xeb8e3[_0x3a6e('0x25')](_0x526a55)['then'](function(_0x1219e8){return _0x1219e8;});}return null;};}function removeEntity(_0x427ad0,_0x493db8){return function(_0x196f15){if(_0x196f15){return _0x196f15[_0x3a6e('0x26')]()[_0x3a6e('0x27')](function(){_0x427ad0[_0x3a6e('0x1b')](0xcc)[_0x3a6e('0x28')]();});}};}function handleEntityNotFound(_0x4b238f,_0x1da390){return function(_0x3c04a9){if(!_0x3c04a9){_0x4b238f[_0x3a6e('0x1a')](0x194);}return _0x3c04a9;};}function handleError(_0x593763,_0x13c33f){_0x13c33f=_0x13c33f||0x1f4;return function(_0x95360f){logger[_0x3a6e('0x29')](_0x95360f[_0x3a6e('0x2a')]);if(_0x95360f['name']){delete _0x95360f[_0x3a6e('0x2b')];}_0x593763[_0x3a6e('0x1b')](_0x13c33f)[_0x3a6e('0x2c')](_0x95360f);};}exports[_0x3a6e('0x2d')]=function(_0x52855c,_0x20e5fd){var _0x2d3118={},_0x4778f6={},_0x782b6f={'count':0x0,'rows':[]};var _0x16bb7b=_[_0x3a6e('0x2e')](db['ZohoAccount'][_0x3a6e('0x2f')],function(_0x919f6c){return{'name':_0x919f6c[_0x3a6e('0x30')],'type':_0x919f6c[_0x3a6e('0x31')][_0x3a6e('0x32')]};});_0x4778f6[_0x3a6e('0x33')]=_[_0x3a6e('0x2e')](_0x16bb7b,_0x3a6e('0x2b'));_0x4778f6['query']=_['keys'](_0x52855c[_0x3a6e('0x34')]);_0x4778f6[_0x3a6e('0x35')]=_[_0x3a6e('0x36')](_0x4778f6['model'],_0x4778f6[_0x3a6e('0x34')]);_0x2d3118[_0x3a6e('0x37')]=_['intersection'](_0x4778f6[_0x3a6e('0x33')],qs[_0x3a6e('0x38')](_0x52855c[_0x3a6e('0x34')][_0x3a6e('0x38')]));_0x2d3118['attributes']=_0x2d3118[_0x3a6e('0x37')][_0x3a6e('0x39')]?_0x2d3118[_0x3a6e('0x37')]:_0x4778f6[_0x3a6e('0x33')];if(!_0x52855c[_0x3a6e('0x34')][_0x3a6e('0x3a')](_0x3a6e('0x3b'))){_0x2d3118[_0x3a6e('0x1f')]=qs[_0x3a6e('0x1f')](_0x52855c[_0x3a6e('0x34')][_0x3a6e('0x1f')]);_0x2d3118[_0x3a6e('0x1d')]=qs['offset'](_0x52855c['query'][_0x3a6e('0x1d')]);}_0x2d3118[_0x3a6e('0x3c')]=qs[_0x3a6e('0x3d')](_0x52855c['query'][_0x3a6e('0x3d')]);_0x2d3118[_0x3a6e('0x3e')]=qs[_0x3a6e('0x35')](_[_0x3a6e('0x3f')](_0x52855c[_0x3a6e('0x34')],_0x4778f6[_0x3a6e('0x35')]),_0x16bb7b);if(_0x52855c[_0x3a6e('0x34')][_0x3a6e('0x40')]){_0x2d3118['where']=_['merge'](_0x2d3118[_0x3a6e('0x3e')],{'$or':_[_0x3a6e('0x2e')](_0x16bb7b,function(_0x196663){if(_0x196663[_0x3a6e('0x31')]!==_0x3a6e('0x41')){var _0x5806da={};_0x5806da[_0x196663['name']]={'$like':'%'+_0x52855c[_0x3a6e('0x34')][_0x3a6e('0x40')]+'%'};return _0x5806da;}})});}_0x2d3118=_['merge']({},_0x2d3118,_0x52855c[_0x3a6e('0x42')]);var _0x39f4db={'where':_0x2d3118[_0x3a6e('0x3e')]};return db['ZohoAccount'][_0x3a6e('0x20')](_0x39f4db)[_0x3a6e('0x27')](function(_0x1273fa){_0x782b6f[_0x3a6e('0x20')]=_0x1273fa;if(_0x52855c[_0x3a6e('0x34')][_0x3a6e('0x43')]){_0x2d3118['include']=[{'all':!![]}];}return db[_0x3a6e('0x44')][_0x3a6e('0x45')](_0x2d3118);})[_0x3a6e('0x27')](function(_0x1682fd){_0x782b6f['rows']=_0x1682fd;return _0x782b6f;})[_0x3a6e('0x27')](respondWithFilteredResult(_0x20e5fd,_0x2d3118))[_0x3a6e('0x46')](handleError(_0x20e5fd,null));};exports[_0x3a6e('0x47')]=function(_0x3b2823,_0x2d798f){var _0x5b0c82={'raw':![],'where':{'id':_0x3b2823[_0x3a6e('0x48')]['id']}},_0x1c81ef={};_0x1c81ef[_0x3a6e('0x33')]=_[_0x3a6e('0x49')](db['ZohoAccount'][_0x3a6e('0x2f')]);_0x1c81ef[_0x3a6e('0x34')]=_['keys'](_0x3b2823[_0x3a6e('0x34')]);_0x1c81ef[_0x3a6e('0x35')]=_[_0x3a6e('0x36')](_0x1c81ef[_0x3a6e('0x33')],_0x1c81ef[_0x3a6e('0x34')]);_0x5b0c82[_0x3a6e('0x37')]=_[_0x3a6e('0x36')](_0x1c81ef[_0x3a6e('0x33')],qs['fields'](_0x3b2823[_0x3a6e('0x34')]['fields']));_0x5b0c82[_0x3a6e('0x37')]=_0x5b0c82[_0x3a6e('0x37')][_0x3a6e('0x39')]?_0x5b0c82[_0x3a6e('0x37')]:_0x1c81ef[_0x3a6e('0x33')];if(_0x3b2823[_0x3a6e('0x34')][_0x3a6e('0x43')]){_0x5b0c82[_0x3a6e('0x4a')]=[{'all':!![]}];}_0x5b0c82=_[_0x3a6e('0x4b')]({},_0x5b0c82,_0x3b2823[_0x3a6e('0x42')]);return db[_0x3a6e('0x44')][_0x3a6e('0x4c')](_0x5b0c82)['then'](handleEntityNotFound(_0x2d798f,null))[_0x3a6e('0x27')](respondWithResult(_0x2d798f,null))['catch'](handleError(_0x2d798f,null));};exports[_0x3a6e('0x4d')]=function(_0x32ef2a,_0x31d2a5){return db[_0x3a6e('0x44')][_0x3a6e('0x4d')](_0x32ef2a[_0x3a6e('0x4e')],{})[_0x3a6e('0x27')](respondWithResult(_0x31d2a5,0xc9))['catch'](handleError(_0x31d2a5,null));};exports[_0x3a6e('0x25')]=function(_0x25e1d1,_0x5974f4){if(_0x25e1d1[_0x3a6e('0x4e')]['id']){delete _0x25e1d1[_0x3a6e('0x4e')]['id'];}return db[_0x3a6e('0x44')]['find']({'where':{'id':_0x25e1d1[_0x3a6e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5974f4,null))[_0x3a6e('0x27')](saveUpdates(_0x25e1d1['body'],null))[_0x3a6e('0x27')](respondWithResult(_0x5974f4,null))[_0x3a6e('0x46')](handleError(_0x5974f4,null));};exports['destroy']=function(_0x3d2385,_0x5d2dc7){return db[_0x3a6e('0x44')][_0x3a6e('0x4c')]({'where':{'id':_0x3d2385[_0x3a6e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d2dc7,null))['then'](removeEntity(_0x5d2dc7,null))[_0x3a6e('0x46')](handleError(_0x5d2dc7,null));};exports[_0x3a6e('0x4f')]=function(_0x45ae10,_0x37e158,_0xf0390d){var _0xb7118f={};var _0x388bca={};var _0x2c3619;var _0x4545ed;return db[_0x3a6e('0x44')][_0x3a6e('0x50')]({'where':{'id':_0x45ae10['params']['id']}})[_0x3a6e('0x27')](handleEntityNotFound(_0x37e158,null))[_0x3a6e('0x27')](function(_0xca5111){if(_0xca5111){_0x2c3619=_0xca5111;_0x388bca['model']=_['keys'](db[_0x3a6e('0x51')][_0x3a6e('0x2f')]);_0x388bca[_0x3a6e('0x34')]=_['keys'](_0x45ae10[_0x3a6e('0x34')]);_0x388bca[_0x3a6e('0x35')]=_[_0x3a6e('0x36')](_0x388bca[_0x3a6e('0x33')],_0x388bca['query']);_0xb7118f[_0x3a6e('0x37')]=_['intersection'](_0x388bca[_0x3a6e('0x33')],qs[_0x3a6e('0x38')](_0x45ae10[_0x3a6e('0x34')][_0x3a6e('0x38')]));_0xb7118f[_0x3a6e('0x37')]=_0xb7118f[_0x3a6e('0x37')][_0x3a6e('0x39')]?_0xb7118f['attributes']:_0x388bca['model'];_0xb7118f['order']=qs[_0x3a6e('0x3d')](_0x45ae10[_0x3a6e('0x34')][_0x3a6e('0x3d')]);_0xb7118f[_0x3a6e('0x3e')]=qs['filters'](_['pick'](_0x45ae10['query'],_0x388bca[_0x3a6e('0x35')]));if(_0x45ae10[_0x3a6e('0x34')][_0x3a6e('0x40')]){_0xb7118f['where']=_['merge'](_0xb7118f[_0x3a6e('0x3e')],{'$or':_['map'](_0xb7118f[_0x3a6e('0x37')],function(_0x4b3948){var _0x415943={};_0x415943[_0x4b3948]={'$like':'%'+_0x45ae10[_0x3a6e('0x34')][_0x3a6e('0x40')]+'%'};return _0x415943;})});}_0xb7118f=_[_0x3a6e('0x4b')]({},_0xb7118f,_0x45ae10['options']);return _0x2c3619[_0x3a6e('0x4f')](_0xb7118f);}})[_0x3a6e('0x27')](function(_0x2a7681){if(_0x2a7681){_0x4545ed=_0x2a7681[_0x3a6e('0x39')];if(!_0x45ae10[_0x3a6e('0x34')][_0x3a6e('0x3a')](_0x3a6e('0x3b'))){_0xb7118f[_0x3a6e('0x1f')]=qs['limit'](_0x45ae10[_0x3a6e('0x34')][_0x3a6e('0x1f')]);_0xb7118f[_0x3a6e('0x1d')]=qs[_0x3a6e('0x1d')](_0x45ae10[_0x3a6e('0x34')]['offset']);}return _0x2c3619[_0x3a6e('0x4f')](_0xb7118f);}})['then'](function(_0x315484){if(_0x315484){return _0x315484?{'count':_0x4545ed,'rows':_0x315484}:null;}})['then'](respondWithResult(_0x37e158,null))['catch'](handleError(_0x37e158,null));};exports[_0x3a6e('0x52')]=function(_0x2be597,_0x4e485c,_0x5b63cc){if(_0x2be597['body']['id']){delete _0x2be597['body']['id'];}return db[_0x3a6e('0x44')]['findOne']({'where':{'id':_0x2be597['params']['id']}})[_0x3a6e('0x27')](handleEntityNotFound(_0x4e485c,null))[_0x3a6e('0x27')](function(_0x12f3dc){if(_0x12f3dc){_0x2be597[_0x3a6e('0x4e')]['AccountId']=_0x12f3dc['id'];_0x2be597['body'][_0x3a6e('0x53')]=integrations[_0x3a6e('0x54')](_0x2be597[_0x3a6e('0x4e')][_0x3a6e('0x55')],_0x2be597[_0x3a6e('0x4e')][_0x3a6e('0x31')]);_0x2be597[_0x3a6e('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x2be597[_0x3a6e('0x4e')][_0x3a6e('0x55')],_0x2be597[_0x3a6e('0x4e')][_0x3a6e('0x31')]);return db[_0x3a6e('0x51')][_0x3a6e('0x4d')](_0x2be597[_0x3a6e('0x4e')],{'include':[{'model':db[_0x3a6e('0x56')],'as':_0x3a6e('0x53')},{'model':db[_0x3a6e('0x56')],'as':_0x3a6e('0x57')}]});}return null;})[_0x3a6e('0x27')](respondWithResult(_0x4e485c,null))[_0x3a6e('0x46')](handleError(_0x4e485c,null));};function getAccessToken(_0x38cb13){return new Promise(function(_0x582165,_0x2010f7){var _0x425fa6;switch(_0x38cb13[_0x3a6e('0x58')]){case'US':_0x425fa6=_0x3a6e('0x59');break;case'AU':_0x425fa6=_0x3a6e('0x5a');break;case'EU':_0x425fa6='https://accounts.zoho.eu';break;case'IN':_0x425fa6=_0x3a6e('0x5b');break;case'CN':_0x425fa6=_0x3a6e('0x5c');break;default:_0x425fa6=_0x3a6e('0x5d');break;}var _0x44e570={'method':_0x3a6e('0x5e'),'uri':_0x425fa6+_0x3a6e('0x5f'),'qs':{'refresh_token':_0x38cb13[_0x3a6e('0x60')],'client_id':_0x38cb13[_0x3a6e('0x61')],'client_secret':_0x38cb13['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x44e570)[_0x3a6e('0x27')](function(_0x4c1595){if(_0x4c1595[_0x3a6e('0x62')]){_0x582165(_0x4c1595[_0x3a6e('0x62')]);}else{_0x2010f7(_0x3a6e('0x63'));}})[_0x3a6e('0x46')](function(_0x5af522){_0x2010f7(_0x5af522);});});}exports['getFields']=function(_0x11e3f3,_0x3fdf43,_0x267d64){var _0x3118c8,_0x114b2f,_0x19db2a,_0x2a9f7d,_0x318de6;return db['ZohoAccount']['findOne']({'where':{'id':_0x11e3f3[_0x3a6e('0x48')]['id']},'attributes':['id','host',_0x3a6e('0x58'),_0x3a6e('0x61'),_0x3a6e('0x64'),_0x3a6e('0x65'),_0x3a6e('0x66'),_0x3a6e('0x60')]})[_0x3a6e('0x27')](handleEntityNotFound(_0x3fdf43,null))[_0x3a6e('0x27')](function(_0x33623f){_0x318de6=_0x33623f;_0x3118c8=_0x318de6[_0x3a6e('0x67')];_0x114b2f=_0x3118c8===_0x3a6e('0x68')?'eu':_0x3a6e('0x69');_0x19db2a=_0x318de6['serverUrl'];var _0x2682d0=_0x19db2a[_0x3a6e('0x6a')](-0x1);if(_0x2682d0==='/'||_0x2682d0==='\x5c'||_0x2682d0===':'){_0x19db2a=_0x19db2a[_0x3a6e('0x6b')](0x0,_0x19db2a[_0x3a6e('0x6c')](_0x2682d0));}if(!_0x318de6[_0x3a6e('0x60')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x318de6);})['then'](function(_0x4afcf1){if(_0x4afcf1){return rp({'method':'GET','uri':util[_0x3a6e('0x6d')](_0x3a6e('0x6e'),_0x114b2f),'qs':{'module':'Calls'},'headers':{'Authorization':_0x3a6e('0x6f')+_0x4afcf1},'json':!![]});}})[_0x3a6e('0x27')](function(_0x5b3564){if(_0x5b3564){if(_0x5b3564[_0x3a6e('0x70')]&&_0x5b3564[_0x3a6e('0x70')][_0x3a6e('0x29')]){throw new Error(_0x5b3564[_0x3a6e('0x70')][_0x3a6e('0x29')][_0x3a6e('0x71')]);}var _0xd3c665=[];var _0x2a2e4b=[];var _0x2d8e68=[_0x3a6e('0x72'),_0x3a6e('0x73'),'Description',_0x3a6e('0x74'),_0x3a6e('0x75'),_0x3a6e('0x76'),_0x3a6e('0x77'),_0x3a6e('0x78')];_0x2a2e4b=_[_0x3a6e('0x79')](_0x5b3564['fields'],function(_0x5c3768){return _0x2d8e68['includes'](_0x5c3768[_0x3a6e('0x7a')]);});for(var _0x493c90=0x0;_0x493c90<_0x2a2e4b[_0x3a6e('0x39')];_0x493c90++){if(_0x2a2e4b[_0x493c90][_0x3a6e('0x7b')]===![]){_0xd3c665[_0x3a6e('0x7c')]({'id':_0x2a2e4b[_0x493c90]['id'],'name':_0x2a2e4b[_0x493c90][_0x3a6e('0x7d')],'custom':_0x2a2e4b[_0x493c90][_0x3a6e('0x7e')],'options':_0x2a2e4b[_0x493c90][_0x3a6e('0x7f')]===_0x3a6e('0x80')&&_0x2a2e4b[_0x493c90]['pick_list_values'][_0x3a6e('0x39')]>-0x1?_[_0x3a6e('0x2e')](_0x2a2e4b[_0x493c90][_0x3a6e('0x81')],function(_0x55ce94){return{'name':_0x55ce94,'value':_0x55ce94};}):[]});}}return{'count':_0xd3c665[_0x3a6e('0x39')],'rows':_0xd3c665};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3fdf43,null))[_0x3a6e('0x46')](function(_0x54e8b2){var _0x49ab05=_0x11e3f3['query'][_0x3a6e('0x82')]?0x1f4:_0x54e8b2[_0x3a6e('0x83')]||0x1f4;logger['error'](_0x3a6e('0x84'),_0x3a6e('0x85'),_0x49ab05,JSON[_0x3a6e('0x86')](_0x54e8b2));delete _0x54e8b2['name'];if(_0x49ab05===0x191){_0x49ab05=0x190;}_0x3fdf43['status'](_0x49ab05)[_0x3a6e('0x2c')](_0x11e3f3[_0x3a6e('0x34')][_0x3a6e('0x82')]?{'message':_0x3a6e('0x87'),'statusCode':_0x54e8b2[_0x3a6e('0x83')]}:_0x54e8b2);});}; \ No newline at end of file +var _0xb7f8=['Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','ZohoAccount','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Duration'];(function(_0x5479fd,_0x55ad0e){var _0x521dd2=function(_0xfd59d2){while(--_0xfd59d2){_0x5479fd['push'](_0x5479fd['shift']());}};_0x521dd2(++_0x55ad0e);}(_0xb7f8,0x19e));var _0x8b7f=function(_0x27cc59,_0xdab1fe){_0x27cc59=_0x27cc59-0x0;var _0x45357c=_0xb7f8[_0x27cc59];return _0x45357c;};'use strict';var emlformat=require(_0x8b7f('0x0'));var rimraf=require(_0x8b7f('0x1'));var zipdir=require(_0x8b7f('0x2'));var jsonpatch=require(_0x8b7f('0x3'));var rp=require(_0x8b7f('0x4'));var moment=require(_0x8b7f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b7f('0x6'));var util=require(_0x8b7f('0x7'));var path=require(_0x8b7f('0x8'));var sox=require(_0x8b7f('0x9'));var csv=require(_0x8b7f('0xa'));var ejs=require(_0x8b7f('0xb'));var fs=require('fs');var fs_extra=require(_0x8b7f('0xc'));var _=require(_0x8b7f('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8b7f('0xe'));var deskjs=require(_0x8b7f('0xf'));var toCsv=require(_0x8b7f('0xa'));var querystring=require(_0x8b7f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b7f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b7f('0x12'));var hardwareService=require(_0x8b7f('0x13'));var logger=require(_0x8b7f('0x14'))(_0x8b7f('0x15'));var utils=require(_0x8b7f('0x16'));var config=require(_0x8b7f('0x17'));var licenseUtil=require(_0x8b7f('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8b7f('0x19'));function respondWithStatusCode(_0x120b76,_0x59233a){_0x59233a=_0x59233a||0xcc;return function(_0x24f720){if(_0x24f720){return _0x120b76['sendStatus'](_0x59233a);}return _0x120b76[_0x8b7f('0x1a')](_0x59233a)['end']();};}function respondWithResult(_0x4e2367,_0x90c6a2){_0x90c6a2=_0x90c6a2||0xc8;return function(_0x4b2224){if(_0x4b2224){return _0x4e2367[_0x8b7f('0x1a')](_0x90c6a2)[_0x8b7f('0x1b')](_0x4b2224);}};}function respondWithFilteredResult(_0x4d6da8,_0x106118){return function(_0x8b144a){if(_0x8b144a){var _0x170a01=typeof _0x106118[_0x8b7f('0x1c')]===_0x8b7f('0x1d')&&typeof _0x106118[_0x8b7f('0x1e')]===_0x8b7f('0x1d');var _0x1939e1=_0x8b144a[_0x8b7f('0x1f')];var _0x217852=_0x170a01?0x0:_0x106118[_0x8b7f('0x1c')];var _0x212576=_0x170a01?_0x8b144a[_0x8b7f('0x1f')]:_0x106118[_0x8b7f('0x1c')]+_0x106118[_0x8b7f('0x1e')];var _0x9054a5;if(_0x212576>=_0x1939e1){_0x212576=_0x1939e1;_0x9054a5=0xc8;}else{_0x9054a5=0xce;}_0x4d6da8['status'](_0x9054a5);return _0x4d6da8[_0x8b7f('0x20')]('Content-Range',_0x217852+'-'+_0x212576+'/'+_0x1939e1)[_0x8b7f('0x1b')](_0x8b144a);}return null;};}function patchUpdates(_0x4a8c55){return function(_0x2138a0){try{jsonpatch[_0x8b7f('0x21')](_0x2138a0,_0x4a8c55,!![]);}catch(_0x446fce){return BPromise[_0x8b7f('0x22')](_0x446fce);}return _0x2138a0[_0x8b7f('0x23')]();};}function saveUpdates(_0x341f3c,_0x5634d2){return function(_0x14dfed){if(_0x14dfed){return _0x14dfed['update'](_0x341f3c)[_0x8b7f('0x24')](function(_0x47d1a6){return _0x47d1a6;});}return null;};}function removeEntity(_0x17d6d2,_0x29b74f){return function(_0x19d488){if(_0x19d488){return _0x19d488[_0x8b7f('0x25')]()[_0x8b7f('0x24')](function(){_0x17d6d2['status'](0xcc)[_0x8b7f('0x26')]();});}};}function handleEntityNotFound(_0x3c856f,_0x2aeaf5){return function(_0x25050c){if(!_0x25050c){_0x3c856f[_0x8b7f('0x27')](0x194);}return _0x25050c;};}function handleError(_0x5066c1,_0xe69eb2){_0xe69eb2=_0xe69eb2||0x1f4;return function(_0x33713c){logger[_0x8b7f('0x28')](_0x33713c[_0x8b7f('0x29')]);if(_0x33713c[_0x8b7f('0x2a')]){delete _0x33713c[_0x8b7f('0x2a')];}_0x5066c1[_0x8b7f('0x1a')](_0xe69eb2)[_0x8b7f('0x2b')](_0x33713c);};}exports[_0x8b7f('0x2c')]=function(_0x5c4bc1,_0x55797a){var _0x5f2e84={},_0x2e8008={},_0x27b9af={'count':0x0,'rows':[]};var _0x2f3776=_[_0x8b7f('0x2d')](db['ZohoAccount']['rawAttributes'],function(_0x3f428e){return{'name':_0x3f428e['fieldName'],'type':_0x3f428e[_0x8b7f('0x2e')][_0x8b7f('0x2f')]};});_0x2e8008[_0x8b7f('0x30')]=_[_0x8b7f('0x2d')](_0x2f3776,_0x8b7f('0x2a'));_0x2e8008[_0x8b7f('0x31')]=_[_0x8b7f('0x32')](_0x5c4bc1[_0x8b7f('0x31')]);_0x2e8008['filters']=_[_0x8b7f('0x33')](_0x2e8008['model'],_0x2e8008['query']);_0x5f2e84[_0x8b7f('0x34')]=_[_0x8b7f('0x33')](_0x2e8008[_0x8b7f('0x30')],qs['fields'](_0x5c4bc1['query'][_0x8b7f('0x35')]));_0x5f2e84[_0x8b7f('0x34')]=_0x5f2e84['attributes'][_0x8b7f('0x36')]?_0x5f2e84[_0x8b7f('0x34')]:_0x2e8008[_0x8b7f('0x30')];if(!_0x5c4bc1[_0x8b7f('0x31')][_0x8b7f('0x37')](_0x8b7f('0x38'))){_0x5f2e84[_0x8b7f('0x1e')]=qs[_0x8b7f('0x1e')](_0x5c4bc1[_0x8b7f('0x31')]['limit']);_0x5f2e84[_0x8b7f('0x1c')]=qs[_0x8b7f('0x1c')](_0x5c4bc1[_0x8b7f('0x31')][_0x8b7f('0x1c')]);}_0x5f2e84[_0x8b7f('0x39')]=qs['sort'](_0x5c4bc1[_0x8b7f('0x31')][_0x8b7f('0x3a')]);_0x5f2e84[_0x8b7f('0x3b')]=qs['filters'](_[_0x8b7f('0x3c')](_0x5c4bc1['query'],_0x2e8008[_0x8b7f('0x3d')]),_0x2f3776);if(_0x5c4bc1['query'][_0x8b7f('0x3e')]){_0x5f2e84[_0x8b7f('0x3b')]=_[_0x8b7f('0x3f')](_0x5f2e84['where'],{'$or':_[_0x8b7f('0x2d')](_0x2f3776,function(_0x160ae2){if(_0x160ae2[_0x8b7f('0x2e')]!==_0x8b7f('0x40')){var _0x3e1b8b={};_0x3e1b8b[_0x160ae2['name']]={'$like':'%'+_0x5c4bc1['query']['filter']+'%'};return _0x3e1b8b;}})});}_0x5f2e84=_[_0x8b7f('0x3f')]({},_0x5f2e84,_0x5c4bc1[_0x8b7f('0x41')]);var _0x228256={'where':_0x5f2e84['where']};return db[_0x8b7f('0x42')][_0x8b7f('0x1f')](_0x228256)[_0x8b7f('0x24')](function(_0x53bf14){_0x27b9af[_0x8b7f('0x1f')]=_0x53bf14;if(_0x5c4bc1['query']['includeAll']){_0x5f2e84[_0x8b7f('0x43')]=[{'all':!![]}];}return db[_0x8b7f('0x42')]['findAll'](_0x5f2e84);})[_0x8b7f('0x24')](function(_0x1c52d9){_0x27b9af[_0x8b7f('0x44')]=_0x1c52d9;return _0x27b9af;})[_0x8b7f('0x24')](respondWithFilteredResult(_0x55797a,_0x5f2e84))[_0x8b7f('0x45')](handleError(_0x55797a,null));};exports[_0x8b7f('0x46')]=function(_0x7cd1ac,_0x352e86){var _0x366070={'raw':![],'where':{'id':_0x7cd1ac[_0x8b7f('0x47')]['id']}},_0x312dbe={};_0x312dbe[_0x8b7f('0x30')]=_[_0x8b7f('0x32')](db[_0x8b7f('0x42')][_0x8b7f('0x48')]);_0x312dbe[_0x8b7f('0x31')]=_[_0x8b7f('0x32')](_0x7cd1ac[_0x8b7f('0x31')]);_0x312dbe['filters']=_[_0x8b7f('0x33')](_0x312dbe['model'],_0x312dbe[_0x8b7f('0x31')]);_0x366070[_0x8b7f('0x34')]=_[_0x8b7f('0x33')](_0x312dbe['model'],qs[_0x8b7f('0x35')](_0x7cd1ac[_0x8b7f('0x31')]['fields']));_0x366070[_0x8b7f('0x34')]=_0x366070['attributes'][_0x8b7f('0x36')]?_0x366070[_0x8b7f('0x34')]:_0x312dbe[_0x8b7f('0x30')];if(_0x7cd1ac[_0x8b7f('0x31')][_0x8b7f('0x49')]){_0x366070[_0x8b7f('0x43')]=[{'all':!![]}];}_0x366070=_[_0x8b7f('0x3f')]({},_0x366070,_0x7cd1ac[_0x8b7f('0x41')]);return db[_0x8b7f('0x42')][_0x8b7f('0x4a')](_0x366070)['then'](handleEntityNotFound(_0x352e86,null))[_0x8b7f('0x24')](respondWithResult(_0x352e86,null))[_0x8b7f('0x45')](handleError(_0x352e86,null));};exports[_0x8b7f('0x4b')]=function(_0x353a1e,_0x994b7e){return db[_0x8b7f('0x42')][_0x8b7f('0x4b')](_0x353a1e[_0x8b7f('0x4c')],{})[_0x8b7f('0x24')](respondWithResult(_0x994b7e,0xc9))[_0x8b7f('0x45')](handleError(_0x994b7e,null));};exports['update']=function(_0xa5d717,_0x19270d){if(_0xa5d717[_0x8b7f('0x4c')]['id']){delete _0xa5d717['body']['id'];}return db[_0x8b7f('0x42')][_0x8b7f('0x4a')]({'where':{'id':_0xa5d717[_0x8b7f('0x47')]['id']}})[_0x8b7f('0x24')](handleEntityNotFound(_0x19270d,null))[_0x8b7f('0x24')](saveUpdates(_0xa5d717[_0x8b7f('0x4c')],null))[_0x8b7f('0x24')](respondWithResult(_0x19270d,null))['catch'](handleError(_0x19270d,null));};exports[_0x8b7f('0x25')]=function(_0x1315ae,_0x3f17ab){return db[_0x8b7f('0x42')][_0x8b7f('0x4a')]({'where':{'id':_0x1315ae[_0x8b7f('0x47')]['id']}})[_0x8b7f('0x24')](handleEntityNotFound(_0x3f17ab,null))['then'](removeEntity(_0x3f17ab,null))[_0x8b7f('0x45')](handleError(_0x3f17ab,null));};exports[_0x8b7f('0x4d')]=function(_0x200cf3,_0xa3acd6,_0x3edfde){var _0x354c02={};var _0x2ae803={};var _0x14337b;var _0x225fb7;return db[_0x8b7f('0x42')][_0x8b7f('0x4e')]({'where':{'id':_0x200cf3['params']['id']}})[_0x8b7f('0x24')](handleEntityNotFound(_0xa3acd6,null))[_0x8b7f('0x24')](function(_0x4898bf){if(_0x4898bf){_0x14337b=_0x4898bf;_0x2ae803[_0x8b7f('0x30')]=_[_0x8b7f('0x32')](db[_0x8b7f('0x4f')]['rawAttributes']);_0x2ae803[_0x8b7f('0x31')]=_[_0x8b7f('0x32')](_0x200cf3[_0x8b7f('0x31')]);_0x2ae803['filters']=_[_0x8b7f('0x33')](_0x2ae803[_0x8b7f('0x30')],_0x2ae803[_0x8b7f('0x31')]);_0x354c02[_0x8b7f('0x34')]=_[_0x8b7f('0x33')](_0x2ae803[_0x8b7f('0x30')],qs[_0x8b7f('0x35')](_0x200cf3[_0x8b7f('0x31')]['fields']));_0x354c02['attributes']=_0x354c02[_0x8b7f('0x34')][_0x8b7f('0x36')]?_0x354c02[_0x8b7f('0x34')]:_0x2ae803[_0x8b7f('0x30')];_0x354c02[_0x8b7f('0x39')]=qs[_0x8b7f('0x3a')](_0x200cf3[_0x8b7f('0x31')][_0x8b7f('0x3a')]);_0x354c02[_0x8b7f('0x3b')]=qs[_0x8b7f('0x3d')](_['pick'](_0x200cf3[_0x8b7f('0x31')],_0x2ae803[_0x8b7f('0x3d')]));if(_0x200cf3['query'][_0x8b7f('0x3e')]){_0x354c02[_0x8b7f('0x3b')]=_['merge'](_0x354c02['where'],{'$or':_[_0x8b7f('0x2d')](_0x354c02[_0x8b7f('0x34')],function(_0x38b596){var _0x17a37f={};_0x17a37f[_0x38b596]={'$like':'%'+_0x200cf3[_0x8b7f('0x31')]['filter']+'%'};return _0x17a37f;})});}_0x354c02=_['merge']({},_0x354c02,_0x200cf3[_0x8b7f('0x41')]);return _0x14337b[_0x8b7f('0x4d')](_0x354c02);}})[_0x8b7f('0x24')](function(_0x354bb7){if(_0x354bb7){_0x225fb7=_0x354bb7['length'];if(!_0x200cf3[_0x8b7f('0x31')][_0x8b7f('0x37')](_0x8b7f('0x38'))){_0x354c02[_0x8b7f('0x1e')]=qs[_0x8b7f('0x1e')](_0x200cf3[_0x8b7f('0x31')][_0x8b7f('0x1e')]);_0x354c02['offset']=qs[_0x8b7f('0x1c')](_0x200cf3['query'][_0x8b7f('0x1c')]);}return _0x14337b['getConfigurations'](_0x354c02);}})[_0x8b7f('0x24')](function(_0x4ebf6e){if(_0x4ebf6e){return _0x4ebf6e?{'count':_0x225fb7,'rows':_0x4ebf6e}:null;}})[_0x8b7f('0x24')](respondWithResult(_0xa3acd6,null))[_0x8b7f('0x45')](handleError(_0xa3acd6,null));};exports[_0x8b7f('0x50')]=function(_0x2eb890,_0x7d3df2,_0x14d8d5){if(_0x2eb890[_0x8b7f('0x4c')]['id']){delete _0x2eb890[_0x8b7f('0x4c')]['id'];}return db[_0x8b7f('0x42')]['findOne']({'where':{'id':_0x2eb890[_0x8b7f('0x47')]['id']}})['then'](handleEntityNotFound(_0x7d3df2,null))['then'](function(_0x5996d5){if(_0x5996d5){_0x2eb890[_0x8b7f('0x4c')][_0x8b7f('0x51')]=_0x5996d5['id'];_0x2eb890['body']['Subjects']=integrations[_0x8b7f('0x52')](_0x2eb890[_0x8b7f('0x4c')][_0x8b7f('0x53')],_0x2eb890['body'][_0x8b7f('0x2e')]);_0x2eb890[_0x8b7f('0x4c')]['Descriptions']=integrations[_0x8b7f('0x54')](_0x2eb890[_0x8b7f('0x4c')]['channel'],_0x2eb890['body'][_0x8b7f('0x2e')]);return db[_0x8b7f('0x4f')][_0x8b7f('0x4b')](_0x2eb890[_0x8b7f('0x4c')],{'include':[{'model':db[_0x8b7f('0x55')],'as':'Subjects'},{'model':db[_0x8b7f('0x55')],'as':_0x8b7f('0x56')}]});}return null;})[_0x8b7f('0x24')](respondWithResult(_0x7d3df2,null))['catch'](handleError(_0x7d3df2,null));};function getAccessToken(_0x55dc5c){return new Promise(function(_0x50a232,_0x46a5d1){var _0x41a013;switch(_0x55dc5c[_0x8b7f('0x57')]){case'US':_0x41a013='https://accounts.zoho.com';break;case'AU':_0x41a013=_0x8b7f('0x58');break;case'EU':_0x41a013=_0x8b7f('0x59');break;case'IN':_0x41a013=_0x8b7f('0x5a');break;case'CN':_0x41a013=_0x8b7f('0x5b');break;default:_0x41a013='https://accounts.zoho.eu';break;}var _0x23f502={'method':'POST','uri':_0x41a013+_0x8b7f('0x5c'),'qs':{'refresh_token':_0x55dc5c[_0x8b7f('0x5d')],'client_id':_0x55dc5c[_0x8b7f('0x5e')],'client_secret':_0x55dc5c[_0x8b7f('0x5f')],'grant_type':_0x8b7f('0x60')},'json':!![]};return rp(_0x23f502)[_0x8b7f('0x24')](function(_0x559127){if(_0x559127[_0x8b7f('0x61')]){_0x50a232(_0x559127['access_token']);}else{_0x46a5d1(_0x8b7f('0x62'));}})[_0x8b7f('0x45')](function(_0x3de08e){_0x46a5d1(_0x3de08e);});});}exports[_0x8b7f('0x63')]=function(_0x5f1ebe,_0x3c9e3f,_0x11616f){var _0x31afe8,_0x351797,_0x260675,_0x1aa7e2,_0x1a021b;return db[_0x8b7f('0x42')][_0x8b7f('0x4e')]({'where':{'id':_0x5f1ebe['params']['id']},'attributes':['id',_0x8b7f('0x64'),_0x8b7f('0x57'),_0x8b7f('0x5e'),'clientSecret','serverUrl',_0x8b7f('0x65'),_0x8b7f('0x5d')]})[_0x8b7f('0x24')](handleEntityNotFound(_0x3c9e3f,null))[_0x8b7f('0x24')](function(_0x380cb1){_0x1a021b=_0x380cb1;_0x31afe8=_0x1a021b[_0x8b7f('0x64')];_0x351797=_0x31afe8===_0x8b7f('0x66')?'eu':_0x8b7f('0x67');_0x260675=_0x1a021b['serverUrl'];var _0x5aca4f=_0x260675[_0x8b7f('0x68')](-0x1);if(_0x5aca4f==='/'||_0x5aca4f==='\x5c'||_0x5aca4f===':'){_0x260675=_0x260675['substring'](0x0,_0x260675[_0x8b7f('0x69')](_0x5aca4f));}if(!_0x1a021b['refreshToken']){throw new Error(_0x8b7f('0x6a'));}return getAccessToken(_0x1a021b);})[_0x8b7f('0x24')](function(_0x104182){if(_0x104182){return rp({'method':_0x8b7f('0x6b'),'uri':util[_0x8b7f('0x6c')](_0x8b7f('0x6d'),_0x351797),'qs':{'module':_0x8b7f('0x6e')},'headers':{'Authorization':_0x8b7f('0x6f')+_0x104182},'json':!![]});}})[_0x8b7f('0x24')](function(_0xb36ec5){if(_0xb36ec5){if(_0xb36ec5['response']&&_0xb36ec5[_0x8b7f('0x70')][_0x8b7f('0x28')]){throw new Error(_0xb36ec5['response'][_0x8b7f('0x28')][_0x8b7f('0x71')]);}var _0x2e1e5c=[];var _0xf72346=[];var _0x46dde0=[_0x8b7f('0x72'),_0x8b7f('0x73'),_0x8b7f('0x74'),'WhoId',_0x8b7f('0x75'),_0x8b7f('0x76'),_0x8b7f('0x77'),_0x8b7f('0x78')];_0xf72346=_[_0x8b7f('0x79')](_0xb36ec5[_0x8b7f('0x35')],function(_0x22160a){return _0x46dde0[_0x8b7f('0x7a')](_0x22160a[_0x8b7f('0x7b')]);});for(var _0x27a98e=0x0;_0x27a98e<_0xf72346[_0x8b7f('0x36')];_0x27a98e++){if(_0xf72346[_0x27a98e]['system_mandatory']===![]){_0x2e1e5c['push']({'id':_0xf72346[_0x27a98e]['id'],'name':_0xf72346[_0x27a98e]['display_label'],'custom':_0xf72346[_0x27a98e][_0x8b7f('0x7c')],'options':_0xf72346[_0x27a98e][_0x8b7f('0x7d')]===_0x8b7f('0x7e')&&_0xf72346[_0x27a98e][_0x8b7f('0x7f')][_0x8b7f('0x36')]>-0x1?_[_0x8b7f('0x2d')](_0xf72346[_0x27a98e][_0x8b7f('0x7f')],function(_0x3f43f0){return{'name':_0x3f43f0,'value':_0x3f43f0};}):[]});}}return{'count':_0x2e1e5c['length'],'rows':_0x2e1e5c};}else{return{'count':0x0,'rows':[]};}})[_0x8b7f('0x24')](respondWithResult(_0x3c9e3f,null))[_0x8b7f('0x45')](function(_0xc52ce6){var _0x546b50=_0x5f1ebe['query']['test']?0x1f4:_0xc52ce6[_0x8b7f('0x80')]||0x1f4;logger['error'](_0x8b7f('0x81'),'getFields',_0x546b50,JSON[_0x8b7f('0x82')](_0xc52ce6));delete _0xc52ce6[_0x8b7f('0x2a')];if(_0x546b50===0x191){_0x546b50=0x190;}_0x3c9e3f['status'](_0x546b50)[_0x8b7f('0x2b')](_0x5f1ebe[_0x8b7f('0x31')][_0x8b7f('0x83')]?{'message':_0x8b7f('0x84'),'statusCode':_0xc52ce6[_0x8b7f('0x80')]}:_0xc52ce6);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 490e0db..aa3806b 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 _0x9471=['./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','/oauth/v2/token','application/x-www-form-urlencoded','catch','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x9471,0xd3));var _0x1947=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9471[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1947('0x0'));var logger=require(_0x1947('0x1'))(_0x1947('0x2'));var moment=require(_0x1947('0x3'));var BPromise=require(_0x1947('0x4'));var rp=require(_0x1947('0x5'));var fs=require('fs');var path=require(_0x1947('0x6'));var rimraf=require(_0x1947('0x7'));var config=require(_0x1947('0x8'));var attributes=require(_0x1947('0x9'));var integrations=require(_0x1947('0xa'));module['exports']=function(_0x268cab,_0x1f8389){return _0x268cab[_0x1947('0xb')](_0x1947('0xc'),attributes,{'tableName':_0x1947('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b5d04,_0x255f2c,_0x5b7a8b){if(_0x3b5d04[_0x1947('0xe')](_0x1947('0xf'))||_0x3b5d04[_0x1947('0xe')](_0x1947('0x10'))||_0x3b5d04[_0x1947('0xe')](_0x1947('0x11'))||_0x3b5d04[_0x1947('0xe')](_0x1947('0x12'))||_0x3b5d04['changed'](_0x1947('0x13'))||_0x3b5d04['changed'](_0x1947('0x14'))){var _0x39dfd5,_0x5cfc47;_0x39dfd5=_0x3b5d04['serverUrl'];var _0x4c050d=_0x39dfd5[_0x1947('0x15')](-0x1);if(_0x4c050d==='/'||_0x4c050d==='\x5c'||_0x4c050d===':'){_0x39dfd5=_0x39dfd5[_0x1947('0x16')](0x0,_0x39dfd5[_0x1947('0x17')](_0x4c050d));}switch(_0x3b5d04[_0x1947('0xf')]){case'US':_0x5cfc47=_0x1947('0x18');break;case'AU':_0x5cfc47=_0x1947('0x19');break;case'IN':_0x5cfc47=_0x1947('0x1a');break;case'CN':_0x5cfc47=_0x1947('0x1b');break;default:_0x5cfc47=_0x1947('0x1c');break;}var _0x1e1f3c={'method':_0x1947('0x1d'),'uri':_0x5cfc47+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3b5d04['clientId'],'client_secret':_0x3b5d04[_0x1947('0x12')],'redirect_uri':_0x3b5d04['serverUrl'],'code':_0x3b5d04[_0x1947('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1e1f3c)[_0x1947('0x1e')](function(_0x49d52e){var _0x1b4a86=JSON[_0x1947('0x1f')](_0x49d52e);if(_0x1b4a86[_0x1947('0x20')]){_0x3b5d04[_0x1947('0x21')]=_0x1b4a86['refresh_token'];logger[_0x1947('0x22')](util[_0x1947('0x23')](_0x1947('0x24'),_0x3b5d04[_0x1947('0x25')],_0x3b5d04['id']));}else{logger[_0x1947('0x26')](util[_0x1947('0x23')](_0x1947('0x27'),_0x3b5d04[_0x1947('0x25')],_0x3b5d04['id']),util[_0x1947('0x28')](_0x1b4a86,{'showHidden':![],'depth':null}));}return _0x5b7a8b(null,_0x255f2c);})['catch'](function(_0x20c45a){logger[_0x1947('0x26')](util[_0x1947('0x23')](_0x1947('0x27'),_0x3b5d04[_0x1947('0x25')],_0x3b5d04['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5b7a8b(_0x20c45a);});}else{return _0x5b7a8b(null,_0x255f2c);}},'beforeUpdate':function(_0x508067,_0x13a6fd,_0x1ca886){if(_0x508067['changed']('zone')||_0x508067[_0x1947('0xe')](_0x1947('0x10'))||_0x508067[_0x1947('0xe')]('clientId')||_0x508067['changed'](_0x1947('0x12'))||_0x508067['changed'](_0x1947('0x13'))||_0x508067[_0x1947('0xe')](_0x1947('0x14'))){var _0x476245,_0x403ff7;_0x476245=_0x508067[_0x1947('0x10')];var _0x2704f8=_0x476245['slice'](-0x1);if(_0x2704f8==='/'||_0x2704f8==='\x5c'||_0x2704f8===':'){_0x476245=_0x476245[_0x1947('0x16')](0x0,_0x476245[_0x1947('0x17')](_0x2704f8));}switch(_0x508067[_0x1947('0xf')]){case'US':_0x403ff7=_0x1947('0x18');break;case'AU':_0x403ff7=_0x1947('0x19');break;case'IN':_0x403ff7='https://accounts.zoho.in';break;case'CN':_0x403ff7=_0x1947('0x1b');break;default:_0x403ff7=_0x1947('0x1c');break;}var _0x2fcac2={'method':_0x1947('0x1d'),'uri':_0x403ff7+_0x1947('0x29'),'form':{'grant_type':'authorization_code','client_id':_0x508067[_0x1947('0x11')],'client_secret':_0x508067[_0x1947('0x12')],'redirect_uri':_0x508067['serverUrl'],'code':_0x508067[_0x1947('0x13')]},'headers':{'Content-Type':_0x1947('0x2a')}};return rp(_0x2fcac2)[_0x1947('0x1e')](function(_0x449679){var _0x4e2a6c=JSON[_0x1947('0x1f')](_0x449679);if(_0x4e2a6c[_0x1947('0x20')]){_0x508067[_0x1947('0x21')]=_0x4e2a6c[_0x1947('0x20')];logger[_0x1947('0x22')](util[_0x1947('0x23')](_0x1947('0x24'),_0x508067['name'],_0x508067['id']));}else{logger['error'](util['format'](_0x1947('0x27'),_0x508067[_0x1947('0x25')],_0x508067['id']),util['inspect'](_0x4e2a6c,{'showHidden':![],'depth':null}));}return _0x1ca886(null,_0x13a6fd);})[_0x1947('0x2b')](function(_0x31e3fa){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x508067['name'],_0x508067['id']),util[_0x1947('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x1ca886(_0x31e3fa);});}else{return _0x1ca886(null,_0x13a6fd);}}}});}; \ No newline at end of file +var _0x632a=['POST','/oauth/v2/token','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','host','https://accounts.zoho.com','authorization_code','lodash','util','api','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','zone','changed','serverUrl','clientId','code','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu'];(function(_0x10eb11,_0x1c2aaa){var _0x1aad42=function(_0x2192f6){while(--_0x2192f6){_0x10eb11['push'](_0x10eb11['shift']());}};_0x1aad42(++_0x1c2aaa);}(_0x632a,0x163));var _0xa632=function(_0x415029,_0x55ec3f){_0x415029=_0x415029-0x0;var _0x3d82f5=_0x632a[_0x415029];return _0x3d82f5;};'use strict';var _=require(_0xa632('0x0'));var util=require(_0xa632('0x1'));var logger=require('../../config/logger')(_0xa632('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa632('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa632('0x4'));var config=require(_0xa632('0x5'));var attributes=require(_0xa632('0x6'));var integrations=require(_0xa632('0x7'));module[_0xa632('0x8')]=function(_0x40a04f,_0xc965d4){return _0x40a04f[_0xa632('0x9')](_0xa632('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x337f5a,_0x27a212,_0x12dd4d){if(_0x337f5a['changed'](_0xa632('0xb'))||_0x337f5a[_0xa632('0xc')](_0xa632('0xd'))||_0x337f5a['changed'](_0xa632('0xe'))||_0x337f5a[_0xa632('0xc')]('clientSecret')||_0x337f5a[_0xa632('0xc')](_0xa632('0xf'))||_0x337f5a['changed']('host')){var _0x5695a2,_0x17caad;_0x5695a2=_0x337f5a[_0xa632('0xd')];var _0x5b07de=_0x5695a2[_0xa632('0x10')](-0x1);if(_0x5b07de==='/'||_0x5b07de==='\x5c'||_0x5b07de===':'){_0x5695a2=_0x5695a2[_0xa632('0x11')](0x0,_0x5695a2[_0xa632('0x12')](_0x5b07de));}switch(_0x337f5a[_0xa632('0xb')]){case'US':_0x17caad='https://accounts.zoho.com';break;case'AU':_0x17caad=_0xa632('0x13');break;case'IN':_0x17caad=_0xa632('0x14');break;case'CN':_0x17caad=_0xa632('0x15');break;default:_0x17caad=_0xa632('0x16');break;}var _0x5d949c={'method':_0xa632('0x17'),'uri':_0x17caad+_0xa632('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x337f5a[_0xa632('0xe')],'client_secret':_0x337f5a[_0xa632('0x19')],'redirect_uri':_0x337f5a[_0xa632('0xd')],'code':_0x337f5a[_0xa632('0xf')]},'headers':{'Content-Type':_0xa632('0x1a')}};return rp(_0x5d949c)[_0xa632('0x1b')](function(_0x5ce87d){var _0x233171=JSON[_0xa632('0x1c')](_0x5ce87d);if(_0x233171[_0xa632('0x1d')]){_0x337f5a[_0xa632('0x1e')]=_0x233171['refresh_token'];logger[_0xa632('0x1f')](util[_0xa632('0x20')](_0xa632('0x21'),_0x337f5a[_0xa632('0x22')],_0x337f5a['id']));}else{logger['error'](util[_0xa632('0x20')](_0xa632('0x23'),_0x337f5a['name'],_0x337f5a['id']),util[_0xa632('0x24')](_0x233171,{'showHidden':![],'depth':null}));}return _0x12dd4d(null,_0x27a212);})[_0xa632('0x25')](function(_0xc8b785){logger[_0xa632('0x26')](util['format'](_0xa632('0x23'),_0x337f5a['name'],_0x337f5a['id']),util[_0xa632('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x12dd4d(_0xc8b785);});}else{return _0x12dd4d(null,_0x27a212);}},'beforeUpdate':function(_0x501537,_0x16816f,_0x16de72){if(_0x501537[_0xa632('0xc')](_0xa632('0xb'))||_0x501537[_0xa632('0xc')](_0xa632('0xd'))||_0x501537[_0xa632('0xc')](_0xa632('0xe'))||_0x501537[_0xa632('0xc')](_0xa632('0x19'))||_0x501537[_0xa632('0xc')](_0xa632('0xf'))||_0x501537[_0xa632('0xc')](_0xa632('0x27'))){var _0x4c7a38,_0x34ebba;_0x4c7a38=_0x501537['serverUrl'];var _0x2be427=_0x4c7a38[_0xa632('0x10')](-0x1);if(_0x2be427==='/'||_0x2be427==='\x5c'||_0x2be427===':'){_0x4c7a38=_0x4c7a38[_0xa632('0x11')](0x0,_0x4c7a38['lastIndexOf'](_0x2be427));}switch(_0x501537[_0xa632('0xb')]){case'US':_0x34ebba=_0xa632('0x28');break;case'AU':_0x34ebba=_0xa632('0x13');break;case'IN':_0x34ebba=_0xa632('0x14');break;case'CN':_0x34ebba=_0xa632('0x15');break;default:_0x34ebba=_0xa632('0x16');break;}var _0x2f5eb1={'method':_0xa632('0x17'),'uri':_0x34ebba+'/oauth/v2/token','form':{'grant_type':_0xa632('0x29'),'client_id':_0x501537[_0xa632('0xe')],'client_secret':_0x501537['clientSecret'],'redirect_uri':_0x501537['serverUrl'],'code':_0x501537[_0xa632('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2f5eb1)['then'](function(_0x3fbecf){var _0x12530d=JSON[_0xa632('0x1c')](_0x3fbecf);if(_0x12530d[_0xa632('0x1d')]){_0x501537[_0xa632('0x1e')]=_0x12530d[_0xa632('0x1d')];logger[_0xa632('0x1f')](util[_0xa632('0x20')](_0xa632('0x21'),_0x501537[_0xa632('0x22')],_0x501537['id']));}else{logger[_0xa632('0x26')](util[_0xa632('0x20')](_0xa632('0x23'),_0x501537[_0xa632('0x22')],_0x501537['id']),util[_0xa632('0x24')](_0x12530d,{'showHidden':![],'depth':null}));}return _0x16de72(null,_0x16816f);})[_0xa632('0x25')](function(_0x71d8db){logger['error'](util[_0xa632('0x20')](_0xa632('0x23'),_0x501537[_0xa632('0x22')],_0x501537['id']),util[_0xa632('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x16de72(_0x71d8db);});}else{return _0x16de72(null,_0x16816f);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 32565d6..601dc8d 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 _0x8ff9=['model','then','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x1fc997,_0x536877){var _0x4e5985=function(_0x84e87d){while(--_0x84e87d){_0x1fc997['push'](_0x1fc997['shift']());}};_0x4e5985(++_0x536877);}(_0x8ff9,0x1a6));var _0x98ff=function(_0xdf18de,_0x39ca70){_0xdf18de=_0xdf18de-0x0;var _0xae7373=_0x8ff9[_0xdf18de];return _0xae7373;};'use strict';var _=require(_0x98ff('0x0'));var util=require(_0x98ff('0x1'));var moment=require(_0x98ff('0x2'));var BPromise=require(_0x98ff('0x3'));var rs=require(_0x98ff('0x4'));var fs=require('fs');var Redis=require(_0x98ff('0x5'));var db=require(_0x98ff('0x6'))['db'];var utils=require(_0x98ff('0x7'));var logger=require(_0x98ff('0x8'))(_0x98ff('0x9'));var config=require(_0x98ff('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x98ff('0xb')][_0x98ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13537e,_0x21d840,_0x12d3fe){return new BPromise(function(_0xbe13f3,_0x51fbd8){return client[_0x98ff('0xd')](_0x13537e,_0x12d3fe)['then'](function(_0x4bbf37){logger[_0x98ff('0xe')](_0x98ff('0xf'),_0x21d840,_0x98ff('0x10'));logger[_0x98ff('0x11')](_0x98ff('0x12'),_0x21d840,'request\x20sent',JSON[_0x98ff('0x13')](_0x4bbf37));if(_0x4bbf37['error']){if(_0x4bbf37[_0x98ff('0x14')]['code']===0x1f4){logger['error'](_0x98ff('0xf'),_0x21d840,_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);return _0x51fbd8(_0x4bbf37['error'][_0x98ff('0x15')]);}logger['error'](_0x98ff('0xf'),_0x21d840,_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);return _0xbe13f3(_0x4bbf37[_0x98ff('0x14')][_0x98ff('0x15')]);}else{logger[_0x98ff('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x21d840,_0x98ff('0x10'));_0xbe13f3(_0x4bbf37[_0x98ff('0x16')][_0x98ff('0x15')]);}})[_0x98ff('0x17')](function(_0x3751b9){logger[_0x98ff('0x14')](_0x98ff('0xf'),_0x21d840,_0x3751b9);_0x51fbd8(_0x3751b9);});});}exports[_0x98ff('0x18')]=function(_0x268121){var _0x3c04d4=this;return new Promise(function(_0x91e31c,_0x1611b5){return db[_0x98ff('0x19')][_0x98ff('0x1a')]({'raw':_0x268121['options']?_0x268121[_0x98ff('0x1b')][_0x98ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x268121[_0x98ff('0x1b')]?_0x268121[_0x98ff('0x1b')][_0x98ff('0x1d')]||null:null,'attributes':_0x268121[_0x98ff('0x1b')]?_0x268121[_0x98ff('0x1b')][_0x98ff('0x1e')]||null:null,'limit':_0x268121[_0x98ff('0x1b')]?_0x268121[_0x98ff('0x1b')][_0x98ff('0x1f')]||null:null,'include':_0x268121[_0x98ff('0x1b')]?_0x268121[_0x98ff('0x1b')]['include']?_['map'](_0x268121['options'][_0x98ff('0x20')],function(_0x3ee01b){return{'model':db[_0x3ee01b['model']],'as':_0x3ee01b['as'],'attributes':_0x3ee01b[_0x98ff('0x1e')],'include':_0x3ee01b['include']?_[_0x98ff('0x21')](_0x3ee01b[_0x98ff('0x20')],function(_0x308efd){return{'model':db[_0x308efd[_0x98ff('0x22')]],'as':_0x308efd['as'],'attributes':_0x308efd[_0x98ff('0x1e')],'include':_0x308efd['include']?_['map'](_0x308efd[_0x98ff('0x20')],function(_0x1a4ebd){return{'model':db[_0x1a4ebd[_0x98ff('0x22')]],'as':_0x1a4ebd['as'],'attributes':_0x1a4ebd[_0x98ff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x98ff('0x23')](function(_0x231e00){logger[_0x98ff('0xe')](_0x98ff('0x18'),_0x268121);logger[_0x98ff('0x11')](_0x98ff('0x18'),_0x268121,JSON['stringify'](_0x231e00));_0x91e31c(_0x231e00);})[_0x98ff('0x17')](function(_0x256823){logger[_0x98ff('0x14')](_0x98ff('0x18'),_0x256823[_0x98ff('0x15')],_0x268121);_0x1611b5(_0x3c04d4[_0x98ff('0x14')](0x1f4,_0x256823[_0x98ff('0x15')]));});});};exports[_0x98ff('0x24')]=function(_0x42213a){var _0x205d85=this;return new Promise(function(_0x3fa70c,_0x1472cb){return db[_0x98ff('0x19')][_0x98ff('0x25')]({'raw':_0x42213a[_0x98ff('0x1b')]?_0x42213a[_0x98ff('0x1b')][_0x98ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x42213a[_0x98ff('0x1b')]?_0x42213a[_0x98ff('0x1b')][_0x98ff('0x1d')]||null:null,'attributes':_0x42213a[_0x98ff('0x1b')]?_0x42213a['options'][_0x98ff('0x1e')]||null:null,'include':_0x42213a[_0x98ff('0x1b')]?_0x42213a[_0x98ff('0x1b')][_0x98ff('0x20')]?_[_0x98ff('0x21')](_0x42213a['options'][_0x98ff('0x20')],function(_0x56b676){return{'model':db[_0x56b676[_0x98ff('0x22')]],'as':_0x56b676['as'],'attributes':_0x56b676[_0x98ff('0x1e')],'include':_0x56b676[_0x98ff('0x20')]?_[_0x98ff('0x21')](_0x56b676[_0x98ff('0x20')],function(_0x8dfe4d){return{'model':db[_0x8dfe4d[_0x98ff('0x22')]],'as':_0x8dfe4d['as'],'attributes':_0x8dfe4d[_0x98ff('0x1e')],'include':_0x8dfe4d[_0x98ff('0x20')]?_[_0x98ff('0x21')](_0x8dfe4d['include'],function(_0x20c907){return{'model':db[_0x20c907[_0x98ff('0x22')]],'as':_0x20c907['as'],'attributes':_0x20c907[_0x98ff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x98ff('0x23')](function(_0x34219e){logger[_0x98ff('0xe')](_0x98ff('0x24'),_0x42213a);logger[_0x98ff('0x11')]('ShowZohoAccount',_0x42213a,JSON[_0x98ff('0x13')](_0x34219e));_0x3fa70c(_0x34219e);})['catch'](function(_0x13f7b1){logger[_0x98ff('0x14')](_0x98ff('0x24'),_0x13f7b1[_0x98ff('0x15')],_0x42213a);_0x1472cb(_0x205d85[_0x98ff('0x14')](0x1f4,_0x13f7b1['message']));});});}; \ No newline at end of file +var _0xbd8e=['../../config/logger','rpc','../../config/environment','client','http','request','then','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','info','ShowZohoAccount','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x2cfff6,_0x4197e0){var _0xcf7394=function(_0x4ec940){while(--_0x4ec940){_0x2cfff6['push'](_0x2cfff6['shift']());}};_0xcf7394(++_0x4197e0);}(_0xbd8e,0x1b5));var _0xebd8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbd8e[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xebd8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebd8('0x3'))['db'];var utils=require(_0xebd8('0x4'));var logger=require(_0xebd8('0x5'))(_0xebd8('0x6'));var config=require(_0xebd8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xebd8('0x8')][_0xebd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f2b2e,_0x3740bd,_0x3b92b9){return new BPromise(function(_0x4ac0d0,_0x19c8ee){return client[_0xebd8('0xa')](_0x3f2b2e,_0x3b92b9)[_0xebd8('0xb')](function(_0x13afa5){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x3740bd,'request\x20sent');logger[_0xebd8('0xc')](_0xebd8('0xd'),_0x3740bd,_0xebd8('0xe'),JSON[_0xebd8('0xf')](_0x13afa5));if(_0x13afa5[_0xebd8('0x10')]){if(_0x13afa5['error'][_0xebd8('0x11')]===0x1f4){logger['error'](_0xebd8('0x12'),_0x3740bd,_0x13afa5[_0xebd8('0x10')]['message']);return _0x19c8ee(_0x13afa5[_0xebd8('0x10')][_0xebd8('0x13')]);}logger[_0xebd8('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3740bd,_0x13afa5[_0xebd8('0x10')]['message']);return _0x4ac0d0(_0x13afa5[_0xebd8('0x10')]['message']);}else{logger['info'](_0xebd8('0x12'),_0x3740bd,_0xebd8('0xe'));_0x4ac0d0(_0x13afa5[_0xebd8('0x14')][_0xebd8('0x13')]);}})[_0xebd8('0x15')](function(_0x2b6ac4){logger[_0xebd8('0x10')](_0xebd8('0x12'),_0x3740bd,_0x2b6ac4);_0x19c8ee(_0x2b6ac4);});});}exports[_0xebd8('0x16')]=function(_0x3e0293){var _0x22152a=this;return new Promise(function(_0x46a956,_0x204593){return db[_0xebd8('0x17')]['findAll']({'raw':_0x3e0293[_0xebd8('0x18')]?_0x3e0293[_0xebd8('0x18')][_0xebd8('0x19')]===undefined?!![]:![]:!![],'where':_0x3e0293[_0xebd8('0x18')]?_0x3e0293[_0xebd8('0x18')][_0xebd8('0x1a')]||null:null,'attributes':_0x3e0293[_0xebd8('0x18')]?_0x3e0293[_0xebd8('0x18')][_0xebd8('0x1b')]||null:null,'limit':_0x3e0293['options']?_0x3e0293[_0xebd8('0x18')][_0xebd8('0x1c')]||null:null,'include':_0x3e0293[_0xebd8('0x18')]?_0x3e0293[_0xebd8('0x18')][_0xebd8('0x1d')]?_[_0xebd8('0x1e')](_0x3e0293[_0xebd8('0x18')][_0xebd8('0x1d')],function(_0x43903b){return{'model':db[_0x43903b[_0xebd8('0x1f')]],'as':_0x43903b['as'],'attributes':_0x43903b[_0xebd8('0x1b')],'include':_0x43903b[_0xebd8('0x1d')]?_[_0xebd8('0x1e')](_0x43903b['include'],function(_0x3e1654){return{'model':db[_0x3e1654['model']],'as':_0x3e1654['as'],'attributes':_0x3e1654[_0xebd8('0x1b')],'include':_0x3e1654[_0xebd8('0x1d')]?_[_0xebd8('0x1e')](_0x3e1654[_0xebd8('0x1d')],function(_0x552db7){return{'model':db[_0x552db7['model']],'as':_0x552db7['as'],'attributes':_0x552db7[_0xebd8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xebd8('0xb')](function(_0x1fd2b3){logger[_0xebd8('0x20')](_0xebd8('0x16'),_0x3e0293);logger[_0xebd8('0xc')](_0xebd8('0x16'),_0x3e0293,JSON['stringify'](_0x1fd2b3));_0x46a956(_0x1fd2b3);})['catch'](function(_0x352a96){logger['error'](_0xebd8('0x16'),_0x352a96['message'],_0x3e0293);_0x204593(_0x22152a[_0xebd8('0x10')](0x1f4,_0x352a96[_0xebd8('0x13')]));});});};exports['ShowZohoAccount']=function(_0x197a05){var _0x51200a=this;return new Promise(function(_0x1dc147,_0x30d364){return db[_0xebd8('0x17')]['find']({'raw':_0x197a05['options']?_0x197a05[_0xebd8('0x18')][_0xebd8('0x19')]===undefined?!![]:![]:!![],'where':_0x197a05[_0xebd8('0x18')]?_0x197a05['options'][_0xebd8('0x1a')]||null:null,'attributes':_0x197a05[_0xebd8('0x18')]?_0x197a05[_0xebd8('0x18')][_0xebd8('0x1b')]||null:null,'include':_0x197a05[_0xebd8('0x18')]?_0x197a05[_0xebd8('0x18')][_0xebd8('0x1d')]?_[_0xebd8('0x1e')](_0x197a05[_0xebd8('0x18')][_0xebd8('0x1d')],function(_0x1ba754){return{'model':db[_0x1ba754[_0xebd8('0x1f')]],'as':_0x1ba754['as'],'attributes':_0x1ba754[_0xebd8('0x1b')],'include':_0x1ba754[_0xebd8('0x1d')]?_[_0xebd8('0x1e')](_0x1ba754[_0xebd8('0x1d')],function(_0x2f8775){return{'model':db[_0x2f8775[_0xebd8('0x1f')]],'as':_0x2f8775['as'],'attributes':_0x2f8775['attributes'],'include':_0x2f8775[_0xebd8('0x1d')]?_[_0xebd8('0x1e')](_0x2f8775['include'],function(_0x38a5c4){return{'model':db[_0x38a5c4[_0xebd8('0x1f')]],'as':_0x38a5c4['as'],'attributes':_0x38a5c4[_0xebd8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xebd8('0xb')](function(_0x90cfe8){logger['info'](_0xebd8('0x21'),_0x197a05);logger[_0xebd8('0xc')](_0xebd8('0x21'),_0x197a05,JSON[_0xebd8('0xf')](_0x90cfe8));_0x1dc147(_0x90cfe8);})[_0xebd8('0x15')](function(_0x132539){logger[_0xebd8('0x10')](_0xebd8('0x21'),_0x132539['message'],_0x197a05);_0x30d364(_0x51200a[_0xebd8('0x10')](0x1f4,_0x132539[_0xebd8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 24fc5eb..5f221c6 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 _0x2cc6=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','/:id','show','get'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x2cc6,0xea));var _0x62cc=function(_0x4f0ac9,_0xf8844e){_0x4f0ac9=_0x4f0ac9-0x0;var _0x1d1f24=_0x2cc6[_0x4f0ac9];return _0x1d1f24;};'use strict';var multer=require(_0x62cc('0x0'));var util=require(_0x62cc('0x1'));var path=require(_0x62cc('0x2'));var timeout=require(_0x62cc('0x3'));var express=require(_0x62cc('0x4'));var router=express[_0x62cc('0x5')]();var fs_extra=require(_0x62cc('0x6'));var auth=require(_0x62cc('0x7'));var interaction=require(_0x62cc('0x8'));var config=require(_0x62cc('0x9'));var controller=require(_0x62cc('0xa'));router['get']('/',auth[_0x62cc('0xb')](),controller[_0x62cc('0xc')]);router['get'](_0x62cc('0xd'),auth[_0x62cc('0xb')](),controller[_0x62cc('0xe')]);router[_0x62cc('0xf')]('/:id/fields',auth[_0x62cc('0xb')](),controller['getFields']);router[_0x62cc('0xf')](_0x62cc('0x10'),auth['isAuthenticated'](),controller[_0x62cc('0x11')]);router[_0x62cc('0xf')](_0x62cc('0x12'),auth[_0x62cc('0xb')](),controller[_0x62cc('0x13')]);router[_0x62cc('0x14')]('/',auth[_0x62cc('0xb')](),controller[_0x62cc('0x15')]);router[_0x62cc('0x16')](_0x62cc('0xd'),auth[_0x62cc('0xb')](),controller['update']);router['delete'](_0x62cc('0xd'),auth[_0x62cc('0xb')](),controller[_0x62cc('0x17')]);module[_0x62cc('0x18')]=router; \ No newline at end of file +var _0x6284=['/:id/descriptions','create','put','update','destroy','multer','connect-timeout','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0x6284,0x1e1));var _0x4628=function(_0x28ab11,_0x185d57){_0x28ab11=_0x28ab11-0x0;var _0x36de82=_0x6284[_0x28ab11];return _0x36de82;};'use strict';var multer=require(_0x4628('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4628('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4628('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x4628('0x3'));var config=require('../../config/environment');var controller=require(_0x4628('0x4'));router[_0x4628('0x5')]('/',auth[_0x4628('0x6')](),controller[_0x4628('0x7')]);router[_0x4628('0x5')](_0x4628('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x4628('0x5')](_0x4628('0x9'),auth[_0x4628('0x6')](),controller['getFields']);router[_0x4628('0x5')](_0x4628('0xa'),auth[_0x4628('0x6')](),controller[_0x4628('0xb')]);router[_0x4628('0x5')](_0x4628('0xc'),auth[_0x4628('0x6')](),controller['getDescriptions']);router['post']('/',auth[_0x4628('0x6')](),controller[_0x4628('0xd')]);router[_0x4628('0xe')]('/:id',auth[_0x4628('0x6')](),controller[_0x4628('0xf')]);router['delete'](_0x4628('0x8'),auth[_0x4628('0x6')](),controller[_0x4628('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 90aded6..73cbb83 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 _0xe02c=['ENUM','contact_lead','STRING','sequelize','lead','contact','nothing'];(function(_0x11dce1,_0x47613b){var _0x1f2862=function(_0x4168f0){while(--_0x4168f0){_0x11dce1['push'](_0x11dce1['shift']());}};_0x1f2862(++_0x47613b);}(_0xe02c,0x81));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xce02('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xce02('0x1'),_0xce02('0x2'),_0xce02('0x3')),'defaultValue':_0xce02('0x1')},'moduleSearch':{'type':Sequelize[_0xce02('0x4')](_0xce02('0x5'),_0xce02('0x2'),_0xce02('0x1')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xce02('0x6')]}}; \ No newline at end of file +var _0x8756=['ENUM','contact_lead','sequelize','exports','STRING','lead','contact','nothing'];(function(_0x226cfb,_0x1e6283){var _0x2ef7e9=function(_0x106762){while(--_0x106762){_0x226cfb['push'](_0x226cfb['shift']());}};_0x2ef7e9(++_0x1e6283);}(_0x8756,0xc2));var _0x6875=function(_0x48bb13,_0x5bbf43){_0x48bb13=_0x48bb13-0x0;var _0x2a0ef4=_0x8756[_0x48bb13];return _0x2a0ef4;};'use strict';var Sequelize=require(_0x6875('0x0'));module[_0x6875('0x1')]={'name':{'type':Sequelize[_0x6875('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x6875('0x3'),_0x6875('0x4'),_0x6875('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x6875('0x6')](_0x6875('0x7'),_0x6875('0x4'),_0x6875('0x3')),'defaultValue':_0x6875('0x7')},'description':{'type':Sequelize[_0x6875('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5c0e246..5606e44 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 _0x1f5d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','ZohoConfiguration','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','catch','body','destroy','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x3fd41b,_0x1544b9){var _0x54fc15=function(_0xd5b848){while(--_0xd5b848){_0x3fd41b['push'](_0x3fd41b['shift']());}};_0x54fc15(++_0x1544b9);}(_0x1f5d,0x8f));var _0xd1f5=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0x1f5d[_0x2077c2];return _0x312f9f;};'use strict';var emlformat=require(_0xd1f5('0x0'));var rimraf=require(_0xd1f5('0x1'));var zipdir=require(_0xd1f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd1f5('0x3'));var BPromise=require(_0xd1f5('0x4'));var Mustache=require(_0xd1f5('0x5'));var util=require(_0xd1f5('0x6'));var path=require(_0xd1f5('0x7'));var sox=require(_0xd1f5('0x8'));var csv=require(_0xd1f5('0x9'));var ejs=require(_0xd1f5('0xa'));var fs=require('fs');var fs_extra=require(_0xd1f5('0xb'));var _=require(_0xd1f5('0xc'));var squel=require(_0xd1f5('0xd'));var crypto=require(_0xd1f5('0xe'));var jsforce=require(_0xd1f5('0xf'));var deskjs=require(_0xd1f5('0x10'));var toCsv=require(_0xd1f5('0x9'));var querystring=require(_0xd1f5('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd1f5('0x12'));var qs=require(_0xd1f5('0x13'));var as=require(_0xd1f5('0x14'));var hardwareService=require(_0xd1f5('0x15'));var logger=require(_0xd1f5('0x16'))(_0xd1f5('0x17'));var utils=require('../../config/utils');var config=require(_0xd1f5('0x18'));var licenseUtil=require(_0xd1f5('0x19'));var db=require(_0xd1f5('0x1a'))['db'];function respondWithStatusCode(_0x5dd7f6,_0x228760){_0x228760=_0x228760||0xcc;return function(_0x122441){if(_0x122441){return _0x5dd7f6[_0xd1f5('0x1b')](_0x228760);}return _0x5dd7f6[_0xd1f5('0x1c')](_0x228760)[_0xd1f5('0x1d')]();};}function respondWithResult(_0x24b316,_0x5870b0){_0x5870b0=_0x5870b0||0xc8;return function(_0x5a3a05){if(_0x5a3a05){return _0x24b316[_0xd1f5('0x1c')](_0x5870b0)['json'](_0x5a3a05);}};}function respondWithFilteredResult(_0x1b1c78,_0xdab120){return function(_0x1e5764){if(_0x1e5764){var _0xfa9215=typeof _0xdab120['offset']===_0xd1f5('0x1e')&&typeof _0xdab120[_0xd1f5('0x1f')]===_0xd1f5('0x1e');var _0x4a5b19=_0x1e5764[_0xd1f5('0x20')];var _0x3481a4=_0xfa9215?0x0:_0xdab120[_0xd1f5('0x21')];var _0x5926dd=_0xfa9215?_0x1e5764[_0xd1f5('0x20')]:_0xdab120[_0xd1f5('0x21')]+_0xdab120['limit'];var _0x125e0f;if(_0x5926dd>=_0x4a5b19){_0x5926dd=_0x4a5b19;_0x125e0f=0xc8;}else{_0x125e0f=0xce;}_0x1b1c78['status'](_0x125e0f);return _0x1b1c78[_0xd1f5('0x22')](_0xd1f5('0x23'),_0x3481a4+'-'+_0x5926dd+'/'+_0x4a5b19)['json'](_0x1e5764);}return null;};}function patchUpdates(_0x5d6fbd){return function(_0x5ba325){try{jsonpatch[_0xd1f5('0x24')](_0x5ba325,_0x5d6fbd,!![]);}catch(_0x1b7ef9){return BPromise['reject'](_0x1b7ef9);}return _0x5ba325[_0xd1f5('0x25')]();};}function saveUpdates(_0x12a22b,_0x48106c){return function(_0x2f21f6){if(_0x2f21f6){return _0x2f21f6[_0xd1f5('0x26')](_0x12a22b)[_0xd1f5('0x27')](function(_0x53d6cd){return _0x53d6cd;});}return null;};}function removeEntity(_0x46b7f7,_0x36049f){return function(_0x3f89fd){if(_0x3f89fd){return _0x3f89fd['destroy']()[_0xd1f5('0x27')](function(){_0x46b7f7['status'](0xcc)[_0xd1f5('0x1d')]();});}};}function handleEntityNotFound(_0x2470dc,_0x68bf55){return function(_0x23e04e){if(!_0x23e04e){_0x2470dc['sendStatus'](0x194);}return _0x23e04e;};}function handleError(_0x324248,_0x2815a8){_0x2815a8=_0x2815a8||0x1f4;return function(_0x3979a7){logger['error'](_0x3979a7[_0xd1f5('0x28')]);if(_0x3979a7['name']){delete _0x3979a7[_0xd1f5('0x29')];}_0x324248[_0xd1f5('0x1c')](_0x2815a8)[_0xd1f5('0x2a')](_0x3979a7);};}exports['index']=function(_0x26557d,_0x4713e7){var _0xd69308={},_0xd22929={},_0x4572b4={'count':0x0,'rows':[]};var _0x310d46=_['map'](db[_0xd1f5('0x2b')][_0xd1f5('0x2c')],function(_0x279c3d){return{'name':_0x279c3d['fieldName'],'type':_0x279c3d[_0xd1f5('0x2d')][_0xd1f5('0x2e')]};});_0xd22929['model']=_[_0xd1f5('0x2f')](_0x310d46,'name');_0xd22929[_0xd1f5('0x30')]=_[_0xd1f5('0x31')](_0x26557d[_0xd1f5('0x30')]);_0xd22929[_0xd1f5('0x32')]=_[_0xd1f5('0x33')](_0xd22929[_0xd1f5('0x34')],_0xd22929['query']);_0xd69308[_0xd1f5('0x35')]=_[_0xd1f5('0x33')](_0xd22929[_0xd1f5('0x34')],qs[_0xd1f5('0x36')](_0x26557d[_0xd1f5('0x30')][_0xd1f5('0x36')]));_0xd69308[_0xd1f5('0x35')]=_0xd69308['attributes'][_0xd1f5('0x37')]?_0xd69308[_0xd1f5('0x35')]:_0xd22929[_0xd1f5('0x34')];if(!_0x26557d[_0xd1f5('0x30')][_0xd1f5('0x38')](_0xd1f5('0x39'))){_0xd69308[_0xd1f5('0x1f')]=qs[_0xd1f5('0x1f')](_0x26557d[_0xd1f5('0x30')][_0xd1f5('0x1f')]);_0xd69308['offset']=qs['offset'](_0x26557d[_0xd1f5('0x30')][_0xd1f5('0x21')]);}_0xd69308[_0xd1f5('0x3a')]=qs[_0xd1f5('0x3b')](_0x26557d[_0xd1f5('0x30')][_0xd1f5('0x3b')]);_0xd69308[_0xd1f5('0x3c')]=qs['filters'](_[_0xd1f5('0x3d')](_0x26557d[_0xd1f5('0x30')],_0xd22929['filters']),_0x310d46);if(_0x26557d[_0xd1f5('0x30')][_0xd1f5('0x3e')]){_0xd69308[_0xd1f5('0x3c')]=_[_0xd1f5('0x3f')](_0xd69308[_0xd1f5('0x3c')],{'$or':_['map'](_0x310d46,function(_0x119320){if(_0x119320['type']!=='VIRTUAL'){var _0x5e864d={};_0x5e864d[_0x119320['name']]={'$like':'%'+_0x26557d[_0xd1f5('0x30')]['filter']+'%'};return _0x5e864d;}})});}_0xd69308=_[_0xd1f5('0x3f')]({},_0xd69308,_0x26557d[_0xd1f5('0x40')]);var _0x2f9dcf={'where':_0xd69308[_0xd1f5('0x3c')]};return db[_0xd1f5('0x2b')][_0xd1f5('0x20')](_0x2f9dcf)[_0xd1f5('0x27')](function(_0x5ebec2){_0x4572b4[_0xd1f5('0x20')]=_0x5ebec2;if(_0x26557d[_0xd1f5('0x30')][_0xd1f5('0x41')]){_0xd69308['include']=[{'all':!![]}];}return db[_0xd1f5('0x2b')][_0xd1f5('0x42')](_0xd69308);})['then'](function(_0x4c332d){_0x4572b4[_0xd1f5('0x43')]=_0x4c332d;return _0x4572b4;})[_0xd1f5('0x27')](respondWithFilteredResult(_0x4713e7,_0xd69308))['catch'](handleError(_0x4713e7,null));};exports[_0xd1f5('0x44')]=function(_0x4e2e1e,_0x232190){var _0x47d8bf={'raw':![],'where':{'id':_0x4e2e1e[_0xd1f5('0x45')]['id']}},_0x5d6b23={};_0x5d6b23[_0xd1f5('0x34')]=_[_0xd1f5('0x31')](db['ZohoConfiguration']['rawAttributes']);_0x5d6b23[_0xd1f5('0x30')]=_['keys'](_0x4e2e1e[_0xd1f5('0x30')]);_0x5d6b23[_0xd1f5('0x32')]=_[_0xd1f5('0x33')](_0x5d6b23[_0xd1f5('0x34')],_0x5d6b23[_0xd1f5('0x30')]);_0x47d8bf[_0xd1f5('0x35')]=_[_0xd1f5('0x33')](_0x5d6b23[_0xd1f5('0x34')],qs[_0xd1f5('0x36')](_0x4e2e1e[_0xd1f5('0x30')][_0xd1f5('0x36')]));_0x47d8bf[_0xd1f5('0x35')]=_0x47d8bf[_0xd1f5('0x35')][_0xd1f5('0x37')]?_0x47d8bf[_0xd1f5('0x35')]:_0x5d6b23[_0xd1f5('0x34')];if(_0x4e2e1e[_0xd1f5('0x30')][_0xd1f5('0x41')]){_0x47d8bf[_0xd1f5('0x46')]=[{'all':!![]}];}_0x47d8bf=_[_0xd1f5('0x3f')]({},_0x47d8bf,_0x4e2e1e[_0xd1f5('0x40')]);return db[_0xd1f5('0x2b')][_0xd1f5('0x47')](_0x47d8bf)[_0xd1f5('0x27')](handleEntityNotFound(_0x232190,null))[_0xd1f5('0x27')](respondWithResult(_0x232190,null))['catch'](handleError(_0x232190,null));};exports[_0xd1f5('0x48')]=function(_0x3bc0a5,_0x427389){return db['ZohoConfiguration']['create'](_0x3bc0a5['body'],{})[_0xd1f5('0x27')](respondWithResult(_0x427389,0xc9))[_0xd1f5('0x49')](handleError(_0x427389,null));};exports[_0xd1f5('0x26')]=function(_0x500da0,_0x192877){if(_0x500da0[_0xd1f5('0x4a')]['id']){delete _0x500da0[_0xd1f5('0x4a')]['id'];}return db[_0xd1f5('0x2b')][_0xd1f5('0x47')]({'where':{'id':_0x500da0[_0xd1f5('0x45')]['id']}})['then'](handleEntityNotFound(_0x192877,null))[_0xd1f5('0x27')](saveUpdates(_0x500da0[_0xd1f5('0x4a')],null))[_0xd1f5('0x27')](respondWithResult(_0x192877,null))[_0xd1f5('0x49')](handleError(_0x192877,null));};exports[_0xd1f5('0x4b')]=function(_0x10ff00,_0x45e5fc){return db[_0xd1f5('0x2b')][_0xd1f5('0x47')]({'where':{'id':_0x10ff00['params']['id']}})[_0xd1f5('0x27')](handleEntityNotFound(_0x45e5fc,null))[_0xd1f5('0x27')](removeEntity(_0x45e5fc,null))[_0xd1f5('0x49')](handleError(_0x45e5fc,null));};exports[_0xd1f5('0x4c')]=function(_0x55a646,_0x2b5591,_0x331ddc){var _0x4a636b={};var _0x40fe3c={};var _0x5ec3bd;var _0x1ad9d0;return db[_0xd1f5('0x2b')][_0xd1f5('0x4d')]({'where':{'id':_0x55a646[_0xd1f5('0x45')]['id']}})[_0xd1f5('0x27')](handleEntityNotFound(_0x2b5591,null))[_0xd1f5('0x27')](function(_0x13db55){if(_0x13db55){_0x5ec3bd=_0x13db55;_0x40fe3c['model']=_[_0xd1f5('0x31')](db[_0xd1f5('0x4e')][_0xd1f5('0x2c')]);_0x40fe3c[_0xd1f5('0x30')]=_[_0xd1f5('0x31')](_0x55a646[_0xd1f5('0x30')]);_0x40fe3c['filters']=_[_0xd1f5('0x33')](_0x40fe3c['model'],_0x40fe3c[_0xd1f5('0x30')]);_0x4a636b['attributes']=_[_0xd1f5('0x33')](_0x40fe3c[_0xd1f5('0x34')],qs[_0xd1f5('0x36')](_0x55a646['query'][_0xd1f5('0x36')]));_0x4a636b[_0xd1f5('0x35')]=_0x4a636b[_0xd1f5('0x35')][_0xd1f5('0x37')]?_0x4a636b['attributes']:_0x40fe3c[_0xd1f5('0x34')];_0x4a636b['order']=qs[_0xd1f5('0x3b')](_0x55a646[_0xd1f5('0x30')][_0xd1f5('0x3b')]);_0x4a636b[_0xd1f5('0x3c')]=qs['filters'](_[_0xd1f5('0x3d')](_0x55a646['query'],_0x40fe3c['filters']));if(_0x55a646[_0xd1f5('0x30')][_0xd1f5('0x3e')]){_0x4a636b[_0xd1f5('0x3c')]=_[_0xd1f5('0x3f')](_0x4a636b[_0xd1f5('0x3c')],{'$or':_[_0xd1f5('0x2f')](_0x4a636b[_0xd1f5('0x35')],function(_0x505c48){var _0x172bd1={};_0x172bd1[_0x505c48]={'$like':'%'+_0x55a646[_0xd1f5('0x30')][_0xd1f5('0x3e')]+'%'};return _0x172bd1;})});}_0x4a636b=_['merge']({},_0x4a636b,_0x55a646[_0xd1f5('0x40')]);return _0x5ec3bd[_0xd1f5('0x4c')](_0x4a636b);}})[_0xd1f5('0x27')](function(_0x542113){if(_0x542113){_0x1ad9d0=_0x542113[_0xd1f5('0x37')];if(!_0x55a646[_0xd1f5('0x30')][_0xd1f5('0x38')](_0xd1f5('0x39'))){_0x4a636b[_0xd1f5('0x1f')]=qs[_0xd1f5('0x1f')](_0x55a646['query'][_0xd1f5('0x1f')]);_0x4a636b['offset']=qs[_0xd1f5('0x21')](_0x55a646['query'][_0xd1f5('0x21')]);}return _0x5ec3bd['getFields'](_0x4a636b);}})['then'](function(_0xe9af7d){if(_0xe9af7d){return _0xe9af7d?{'count':_0x1ad9d0,'rows':_0xe9af7d}:null;}})[_0xd1f5('0x27')](respondWithResult(_0x2b5591,null))[_0xd1f5('0x49')](handleError(_0x2b5591,null));};exports[_0xd1f5('0x4f')]=function(_0x232d3e,_0x531843,_0x1765de){var _0x418d23={};var _0x210a1c={};var _0xc40c6f;var _0x1b5ea7;return db['ZohoConfiguration'][_0xd1f5('0x4d')]({'where':{'id':_0x232d3e['params']['id']}})[_0xd1f5('0x27')](handleEntityNotFound(_0x531843,null))[_0xd1f5('0x27')](function(_0x3a6bef){if(_0x3a6bef){_0xc40c6f=_0x3a6bef;_0x210a1c[_0xd1f5('0x34')]=_[_0xd1f5('0x31')](db[_0xd1f5('0x4e')][_0xd1f5('0x2c')]);_0x210a1c[_0xd1f5('0x30')]=_[_0xd1f5('0x31')](_0x232d3e[_0xd1f5('0x30')]);_0x210a1c[_0xd1f5('0x32')]=_[_0xd1f5('0x33')](_0x210a1c[_0xd1f5('0x34')],_0x210a1c[_0xd1f5('0x30')]);_0x418d23['attributes']=_['intersection'](_0x210a1c[_0xd1f5('0x34')],qs['fields'](_0x232d3e[_0xd1f5('0x30')][_0xd1f5('0x36')]));_0x418d23[_0xd1f5('0x35')]=_0x418d23[_0xd1f5('0x35')][_0xd1f5('0x37')]?_0x418d23[_0xd1f5('0x35')]:_0x210a1c[_0xd1f5('0x34')];_0x418d23[_0xd1f5('0x3a')]=qs[_0xd1f5('0x3b')](_0x232d3e[_0xd1f5('0x30')][_0xd1f5('0x3b')]);_0x418d23[_0xd1f5('0x3c')]=qs[_0xd1f5('0x32')](_[_0xd1f5('0x3d')](_0x232d3e[_0xd1f5('0x30')],_0x210a1c[_0xd1f5('0x32')]));if(_0x232d3e[_0xd1f5('0x30')][_0xd1f5('0x3e')]){_0x418d23[_0xd1f5('0x3c')]=_[_0xd1f5('0x3f')](_0x418d23[_0xd1f5('0x3c')],{'$or':_[_0xd1f5('0x2f')](_0x418d23['attributes'],function(_0xf5852e){var _0x2f7a8a={};_0x2f7a8a[_0xf5852e]={'$like':'%'+_0x232d3e[_0xd1f5('0x30')][_0xd1f5('0x3e')]+'%'};return _0x2f7a8a;})});}_0x418d23=_['merge']({},_0x418d23,_0x232d3e[_0xd1f5('0x40')]);return _0xc40c6f[_0xd1f5('0x4f')](_0x418d23);}})[_0xd1f5('0x27')](function(_0x382d5e){if(_0x382d5e){_0x1b5ea7=_0x382d5e[_0xd1f5('0x37')];if(!_0x232d3e['query'][_0xd1f5('0x38')]('nolimit')){_0x418d23[_0xd1f5('0x1f')]=qs[_0xd1f5('0x1f')](_0x232d3e['query'][_0xd1f5('0x1f')]);_0x418d23[_0xd1f5('0x21')]=qs[_0xd1f5('0x21')](_0x232d3e[_0xd1f5('0x30')]['offset']);}return _0xc40c6f['getSubjects'](_0x418d23);}})[_0xd1f5('0x27')](function(_0x3716ad){if(_0x3716ad){return _0x3716ad?{'count':_0x1b5ea7,'rows':_0x3716ad}:null;}})[_0xd1f5('0x27')](respondWithResult(_0x531843,null))[_0xd1f5('0x49')](handleError(_0x531843,null));};exports[_0xd1f5('0x50')]=function(_0x4d036b,_0x3825b4,_0x49ba10){var _0x17d1a4={};var _0x4260d7={};var _0x36c42d;var _0x1b7570;return db[_0xd1f5('0x2b')][_0xd1f5('0x4d')]({'where':{'id':_0x4d036b['params']['id']}})[_0xd1f5('0x27')](handleEntityNotFound(_0x3825b4,null))[_0xd1f5('0x27')](function(_0x12d37f){if(_0x12d37f){_0x36c42d=_0x12d37f;_0x4260d7['model']=_[_0xd1f5('0x31')](db[_0xd1f5('0x4e')][_0xd1f5('0x2c')]);_0x4260d7['query']=_[_0xd1f5('0x31')](_0x4d036b[_0xd1f5('0x30')]);_0x4260d7[_0xd1f5('0x32')]=_['intersection'](_0x4260d7[_0xd1f5('0x34')],_0x4260d7[_0xd1f5('0x30')]);_0x17d1a4[_0xd1f5('0x35')]=_['intersection'](_0x4260d7['model'],qs['fields'](_0x4d036b['query'][_0xd1f5('0x36')]));_0x17d1a4[_0xd1f5('0x35')]=_0x17d1a4['attributes'][_0xd1f5('0x37')]?_0x17d1a4[_0xd1f5('0x35')]:_0x4260d7[_0xd1f5('0x34')];_0x17d1a4[_0xd1f5('0x3a')]=qs['sort'](_0x4d036b[_0xd1f5('0x30')][_0xd1f5('0x3b')]);_0x17d1a4[_0xd1f5('0x3c')]=qs[_0xd1f5('0x32')](_[_0xd1f5('0x3d')](_0x4d036b['query'],_0x4260d7['filters']));if(_0x4d036b[_0xd1f5('0x30')][_0xd1f5('0x3e')]){_0x17d1a4[_0xd1f5('0x3c')]=_[_0xd1f5('0x3f')](_0x17d1a4[_0xd1f5('0x3c')],{'$or':_[_0xd1f5('0x2f')](_0x17d1a4[_0xd1f5('0x35')],function(_0x2e3fc1){var _0x240b8d={};_0x240b8d[_0x2e3fc1]={'$like':'%'+_0x4d036b[_0xd1f5('0x30')][_0xd1f5('0x3e')]+'%'};return _0x240b8d;})});}_0x17d1a4=_['merge']({},_0x17d1a4,_0x4d036b[_0xd1f5('0x40')]);return _0x36c42d[_0xd1f5('0x50')](_0x17d1a4);}})[_0xd1f5('0x27')](function(_0x3a1ef4){if(_0x3a1ef4){_0x1b7570=_0x3a1ef4[_0xd1f5('0x37')];if(!_0x4d036b[_0xd1f5('0x30')][_0xd1f5('0x38')]('nolimit')){_0x17d1a4[_0xd1f5('0x1f')]=qs['limit'](_0x4d036b[_0xd1f5('0x30')][_0xd1f5('0x1f')]);_0x17d1a4[_0xd1f5('0x21')]=qs[_0xd1f5('0x21')](_0x4d036b['query'][_0xd1f5('0x21')]);}return _0x36c42d[_0xd1f5('0x50')](_0x17d1a4);}})[_0xd1f5('0x27')](function(_0x3a5e44){if(_0x3a5e44){return _0x3a5e44?{'count':_0x1b7570,'rows':_0x3a5e44}:null;}})[_0xd1f5('0x27')](respondWithResult(_0x3825b4,null))[_0xd1f5('0x49')](handleError(_0x3825b4,null));}; \ No newline at end of file +var _0x0a71=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','length','include','create','update','body','find','findOne','ZohoField','filter','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x143db6,_0x524cc6){var _0x575728=function(_0x386cbe){while(--_0x386cbe){_0x143db6['push'](_0x143db6['shift']());}};_0x575728(++_0x524cc6);}(_0x0a71,0x14c));var _0x10a7=function(_0x42aba0,_0x5a06e6){_0x42aba0=_0x42aba0-0x0;var _0x3a6d38=_0x0a71[_0x42aba0];return _0x3a6d38;};'use strict';var emlformat=require(_0x10a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10a7('0x1'));var jsonpatch=require(_0x10a7('0x2'));var rp=require(_0x10a7('0x3'));var moment=require('moment');var BPromise=require(_0x10a7('0x4'));var Mustache=require(_0x10a7('0x5'));var util=require(_0x10a7('0x6'));var path=require(_0x10a7('0x7'));var sox=require(_0x10a7('0x8'));var csv=require(_0x10a7('0x9'));var ejs=require(_0x10a7('0xa'));var fs=require('fs');var fs_extra=require(_0x10a7('0xb'));var _=require(_0x10a7('0xc'));var squel=require(_0x10a7('0xd'));var crypto=require('crypto');var jsforce=require(_0x10a7('0xe'));var deskjs=require(_0x10a7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x10a7('0x10'));var Papa=require(_0x10a7('0x11'));var Redis=require(_0x10a7('0x12'));var authService=require(_0x10a7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x10a7('0x14'));var hardwareService=require(_0x10a7('0x15'));var logger=require(_0x10a7('0x16'))(_0x10a7('0x17'));var utils=require(_0x10a7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x10a7('0x19'));var db=require(_0x10a7('0x1a'))['db'];function respondWithStatusCode(_0x5a6617,_0x461bcd){_0x461bcd=_0x461bcd||0xcc;return function(_0x1078bc){if(_0x1078bc){return _0x5a6617[_0x10a7('0x1b')](_0x461bcd);}return _0x5a6617[_0x10a7('0x1c')](_0x461bcd)['end']();};}function respondWithResult(_0x46b649,_0x29a897){_0x29a897=_0x29a897||0xc8;return function(_0x24cd4c){if(_0x24cd4c){return _0x46b649['status'](_0x29a897)[_0x10a7('0x1d')](_0x24cd4c);}};}function respondWithFilteredResult(_0xcf44e,_0x528bba){return function(_0x249b80){if(_0x249b80){var _0x5bb53a=typeof _0x528bba[_0x10a7('0x1e')]===_0x10a7('0x1f')&&typeof _0x528bba['limit']==='undefined';var _0x441c82=_0x249b80['count'];var _0x5207fb=_0x5bb53a?0x0:_0x528bba['offset'];var _0x41f3c6=_0x5bb53a?_0x249b80[_0x10a7('0x20')]:_0x528bba[_0x10a7('0x1e')]+_0x528bba[_0x10a7('0x21')];var _0x3ba408;if(_0x41f3c6>=_0x441c82){_0x41f3c6=_0x441c82;_0x3ba408=0xc8;}else{_0x3ba408=0xce;}_0xcf44e[_0x10a7('0x1c')](_0x3ba408);return _0xcf44e[_0x10a7('0x22')](_0x10a7('0x23'),_0x5207fb+'-'+_0x41f3c6+'/'+_0x441c82)[_0x10a7('0x1d')](_0x249b80);}return null;};}function patchUpdates(_0x377e6c){return function(_0x4fbe3b){try{jsonpatch[_0x10a7('0x24')](_0x4fbe3b,_0x377e6c,!![]);}catch(_0x313684){return BPromise[_0x10a7('0x25')](_0x313684);}return _0x4fbe3b[_0x10a7('0x26')]();};}function saveUpdates(_0x22e921,_0x1a16b2){return function(_0x14692b){if(_0x14692b){return _0x14692b['update'](_0x22e921)[_0x10a7('0x27')](function(_0x4880de){return _0x4880de;});}return null;};}function removeEntity(_0x5ba597,_0x3cdb1f){return function(_0x45d7cc){if(_0x45d7cc){return _0x45d7cc[_0x10a7('0x28')]()['then'](function(){_0x5ba597['status'](0xcc)[_0x10a7('0x29')]();});}};}function handleEntityNotFound(_0x2db83e,_0x10ed92){return function(_0x23764b){if(!_0x23764b){_0x2db83e[_0x10a7('0x1b')](0x194);}return _0x23764b;};}function handleError(_0x38d22d,_0x4994e2){_0x4994e2=_0x4994e2||0x1f4;return function(_0x308e23){logger[_0x10a7('0x2a')](_0x308e23[_0x10a7('0x2b')]);if(_0x308e23[_0x10a7('0x2c')]){delete _0x308e23[_0x10a7('0x2c')];}_0x38d22d[_0x10a7('0x1c')](_0x4994e2)[_0x10a7('0x2d')](_0x308e23);};}exports[_0x10a7('0x2e')]=function(_0x557064,_0x22099e){var _0x2bb05b={},_0x58addf={},_0x4379a7={'count':0x0,'rows':[]};var _0x757e7c=_[_0x10a7('0x2f')](db[_0x10a7('0x30')][_0x10a7('0x31')],function(_0x55ada2){return{'name':_0x55ada2[_0x10a7('0x32')],'type':_0x55ada2[_0x10a7('0x33')][_0x10a7('0x34')]};});_0x58addf['model']=_[_0x10a7('0x2f')](_0x757e7c,_0x10a7('0x2c'));_0x58addf[_0x10a7('0x35')]=_[_0x10a7('0x36')](_0x557064[_0x10a7('0x35')]);_0x58addf[_0x10a7('0x37')]=_[_0x10a7('0x38')](_0x58addf[_0x10a7('0x39')],_0x58addf[_0x10a7('0x35')]);_0x2bb05b['attributes']=_[_0x10a7('0x38')](_0x58addf[_0x10a7('0x39')],qs[_0x10a7('0x3a')](_0x557064[_0x10a7('0x35')][_0x10a7('0x3a')]));_0x2bb05b[_0x10a7('0x3b')]=_0x2bb05b[_0x10a7('0x3b')]['length']?_0x2bb05b[_0x10a7('0x3b')]:_0x58addf[_0x10a7('0x39')];if(!_0x557064['query']['hasOwnProperty'](_0x10a7('0x3c'))){_0x2bb05b[_0x10a7('0x21')]=qs[_0x10a7('0x21')](_0x557064['query'][_0x10a7('0x21')]);_0x2bb05b[_0x10a7('0x1e')]=qs[_0x10a7('0x1e')](_0x557064[_0x10a7('0x35')][_0x10a7('0x1e')]);}_0x2bb05b[_0x10a7('0x3d')]=qs[_0x10a7('0x3e')](_0x557064[_0x10a7('0x35')][_0x10a7('0x3e')]);_0x2bb05b[_0x10a7('0x3f')]=qs['filters'](_[_0x10a7('0x40')](_0x557064['query'],_0x58addf[_0x10a7('0x37')]),_0x757e7c);if(_0x557064[_0x10a7('0x35')]['filter']){_0x2bb05b[_0x10a7('0x3f')]=_['merge'](_0x2bb05b[_0x10a7('0x3f')],{'$or':_[_0x10a7('0x2f')](_0x757e7c,function(_0x422579){if(_0x422579[_0x10a7('0x33')]!==_0x10a7('0x41')){var _0x3b0f06={};_0x3b0f06[_0x422579['name']]={'$like':'%'+_0x557064[_0x10a7('0x35')]['filter']+'%'};return _0x3b0f06;}})});}_0x2bb05b=_[_0x10a7('0x42')]({},_0x2bb05b,_0x557064[_0x10a7('0x43')]);var _0x26e9fa={'where':_0x2bb05b[_0x10a7('0x3f')]};return db['ZohoConfiguration'][_0x10a7('0x20')](_0x26e9fa)[_0x10a7('0x27')](function(_0x172221){_0x4379a7[_0x10a7('0x20')]=_0x172221;if(_0x557064[_0x10a7('0x35')][_0x10a7('0x44')]){_0x2bb05b['include']=[{'all':!![]}];}return db[_0x10a7('0x30')][_0x10a7('0x45')](_0x2bb05b);})[_0x10a7('0x27')](function(_0x33fdac){_0x4379a7[_0x10a7('0x46')]=_0x33fdac;return _0x4379a7;})[_0x10a7('0x27')](respondWithFilteredResult(_0x22099e,_0x2bb05b))[_0x10a7('0x47')](handleError(_0x22099e,null));};exports[_0x10a7('0x48')]=function(_0x1f9303,_0x4d99c1){var _0x114c90={'raw':![],'where':{'id':_0x1f9303[_0x10a7('0x49')]['id']}},_0x117c48={};_0x117c48['model']=_['keys'](db[_0x10a7('0x30')][_0x10a7('0x31')]);_0x117c48['query']=_[_0x10a7('0x36')](_0x1f9303[_0x10a7('0x35')]);_0x117c48[_0x10a7('0x37')]=_[_0x10a7('0x38')](_0x117c48[_0x10a7('0x39')],_0x117c48[_0x10a7('0x35')]);_0x114c90[_0x10a7('0x3b')]=_[_0x10a7('0x38')](_0x117c48['model'],qs[_0x10a7('0x3a')](_0x1f9303[_0x10a7('0x35')][_0x10a7('0x3a')]));_0x114c90['attributes']=_0x114c90[_0x10a7('0x3b')][_0x10a7('0x4a')]?_0x114c90['attributes']:_0x117c48[_0x10a7('0x39')];if(_0x1f9303['query'][_0x10a7('0x44')]){_0x114c90[_0x10a7('0x4b')]=[{'all':!![]}];}_0x114c90=_[_0x10a7('0x42')]({},_0x114c90,_0x1f9303[_0x10a7('0x43')]);return db[_0x10a7('0x30')]['find'](_0x114c90)['then'](handleEntityNotFound(_0x4d99c1,null))[_0x10a7('0x27')](respondWithResult(_0x4d99c1,null))[_0x10a7('0x47')](handleError(_0x4d99c1,null));};exports['create']=function(_0x2e8563,_0x5d4009){return db[_0x10a7('0x30')][_0x10a7('0x4c')](_0x2e8563['body'],{})['then'](respondWithResult(_0x5d4009,0xc9))[_0x10a7('0x47')](handleError(_0x5d4009,null));};exports[_0x10a7('0x4d')]=function(_0x2b3e62,_0x236ce3){if(_0x2b3e62['body']['id']){delete _0x2b3e62[_0x10a7('0x4e')]['id'];}return db[_0x10a7('0x30')]['find']({'where':{'id':_0x2b3e62[_0x10a7('0x49')]['id']}})[_0x10a7('0x27')](handleEntityNotFound(_0x236ce3,null))[_0x10a7('0x27')](saveUpdates(_0x2b3e62['body'],null))[_0x10a7('0x27')](respondWithResult(_0x236ce3,null))[_0x10a7('0x47')](handleError(_0x236ce3,null));};exports[_0x10a7('0x28')]=function(_0x45a1ce,_0x22007b){return db['ZohoConfiguration'][_0x10a7('0x4f')]({'where':{'id':_0x45a1ce['params']['id']}})[_0x10a7('0x27')](handleEntityNotFound(_0x22007b,null))['then'](removeEntity(_0x22007b,null))[_0x10a7('0x47')](handleError(_0x22007b,null));};exports['getFields']=function(_0x53eeee,_0x5bc5f0,_0x39bcff){var _0x142fe4={};var _0x535557={};var _0x84bf7a;var _0x5dfe4d;return db[_0x10a7('0x30')][_0x10a7('0x50')]({'where':{'id':_0x53eeee['params']['id']}})[_0x10a7('0x27')](handleEntityNotFound(_0x5bc5f0,null))[_0x10a7('0x27')](function(_0x473287){if(_0x473287){_0x84bf7a=_0x473287;_0x535557['model']=_[_0x10a7('0x36')](db[_0x10a7('0x51')]['rawAttributes']);_0x535557['query']=_['keys'](_0x53eeee[_0x10a7('0x35')]);_0x535557['filters']=_[_0x10a7('0x38')](_0x535557['model'],_0x535557[_0x10a7('0x35')]);_0x142fe4[_0x10a7('0x3b')]=_[_0x10a7('0x38')](_0x535557['model'],qs[_0x10a7('0x3a')](_0x53eeee['query'][_0x10a7('0x3a')]));_0x142fe4[_0x10a7('0x3b')]=_0x142fe4[_0x10a7('0x3b')][_0x10a7('0x4a')]?_0x142fe4[_0x10a7('0x3b')]:_0x535557['model'];_0x142fe4['order']=qs[_0x10a7('0x3e')](_0x53eeee['query']['sort']);_0x142fe4[_0x10a7('0x3f')]=qs[_0x10a7('0x37')](_[_0x10a7('0x40')](_0x53eeee[_0x10a7('0x35')],_0x535557[_0x10a7('0x37')]));if(_0x53eeee[_0x10a7('0x35')]['filter']){_0x142fe4['where']=_[_0x10a7('0x42')](_0x142fe4[_0x10a7('0x3f')],{'$or':_[_0x10a7('0x2f')](_0x142fe4[_0x10a7('0x3b')],function(_0x9c53cf){var _0x32b5a6={};_0x32b5a6[_0x9c53cf]={'$like':'%'+_0x53eeee['query'][_0x10a7('0x52')]+'%'};return _0x32b5a6;})});}_0x142fe4=_[_0x10a7('0x42')]({},_0x142fe4,_0x53eeee[_0x10a7('0x43')]);return _0x84bf7a[_0x10a7('0x53')](_0x142fe4);}})[_0x10a7('0x27')](function(_0x2039f3){if(_0x2039f3){_0x5dfe4d=_0x2039f3[_0x10a7('0x4a')];if(!_0x53eeee[_0x10a7('0x35')][_0x10a7('0x54')](_0x10a7('0x3c'))){_0x142fe4['limit']=qs['limit'](_0x53eeee[_0x10a7('0x35')][_0x10a7('0x21')]);_0x142fe4[_0x10a7('0x1e')]=qs[_0x10a7('0x1e')](_0x53eeee[_0x10a7('0x35')][_0x10a7('0x1e')]);}return _0x84bf7a['getFields'](_0x142fe4);}})['then'](function(_0x39b64c){if(_0x39b64c){return _0x39b64c?{'count':_0x5dfe4d,'rows':_0x39b64c}:null;}})[_0x10a7('0x27')](respondWithResult(_0x5bc5f0,null))['catch'](handleError(_0x5bc5f0,null));};exports[_0x10a7('0x55')]=function(_0x174d41,_0x1461d7,_0x53c6af){var _0x37f0a9={};var _0x10c0e3={};var _0x1e5596;var _0xf60f42;return db[_0x10a7('0x30')][_0x10a7('0x50')]({'where':{'id':_0x174d41['params']['id']}})['then'](handleEntityNotFound(_0x1461d7,null))[_0x10a7('0x27')](function(_0x939489){if(_0x939489){_0x1e5596=_0x939489;_0x10c0e3[_0x10a7('0x39')]=_['keys'](db[_0x10a7('0x51')][_0x10a7('0x31')]);_0x10c0e3[_0x10a7('0x35')]=_['keys'](_0x174d41[_0x10a7('0x35')]);_0x10c0e3['filters']=_[_0x10a7('0x38')](_0x10c0e3[_0x10a7('0x39')],_0x10c0e3['query']);_0x37f0a9[_0x10a7('0x3b')]=_[_0x10a7('0x38')](_0x10c0e3['model'],qs[_0x10a7('0x3a')](_0x174d41[_0x10a7('0x35')][_0x10a7('0x3a')]));_0x37f0a9[_0x10a7('0x3b')]=_0x37f0a9['attributes'][_0x10a7('0x4a')]?_0x37f0a9[_0x10a7('0x3b')]:_0x10c0e3['model'];_0x37f0a9[_0x10a7('0x3d')]=qs[_0x10a7('0x3e')](_0x174d41[_0x10a7('0x35')][_0x10a7('0x3e')]);_0x37f0a9['where']=qs[_0x10a7('0x37')](_['pick'](_0x174d41[_0x10a7('0x35')],_0x10c0e3[_0x10a7('0x37')]));if(_0x174d41['query'][_0x10a7('0x52')]){_0x37f0a9[_0x10a7('0x3f')]=_[_0x10a7('0x42')](_0x37f0a9[_0x10a7('0x3f')],{'$or':_[_0x10a7('0x2f')](_0x37f0a9[_0x10a7('0x3b')],function(_0x2e78ec){var _0x4420bb={};_0x4420bb[_0x2e78ec]={'$like':'%'+_0x174d41[_0x10a7('0x35')][_0x10a7('0x52')]+'%'};return _0x4420bb;})});}_0x37f0a9=_[_0x10a7('0x42')]({},_0x37f0a9,_0x174d41[_0x10a7('0x43')]);return _0x1e5596[_0x10a7('0x55')](_0x37f0a9);}})[_0x10a7('0x27')](function(_0x599bdc){if(_0x599bdc){_0xf60f42=_0x599bdc[_0x10a7('0x4a')];if(!_0x174d41[_0x10a7('0x35')][_0x10a7('0x54')](_0x10a7('0x3c'))){_0x37f0a9[_0x10a7('0x21')]=qs['limit'](_0x174d41['query'][_0x10a7('0x21')]);_0x37f0a9[_0x10a7('0x1e')]=qs[_0x10a7('0x1e')](_0x174d41['query']['offset']);}return _0x1e5596[_0x10a7('0x55')](_0x37f0a9);}})[_0x10a7('0x27')](function(_0x4195d8){if(_0x4195d8){return _0x4195d8?{'count':_0xf60f42,'rows':_0x4195d8}:null;}})[_0x10a7('0x27')](respondWithResult(_0x1461d7,null))['catch'](handleError(_0x1461d7,null));};exports[_0x10a7('0x56')]=function(_0x2f5e00,_0x36d525,_0x1ba9c7){var _0xb1d083={};var _0x1133ce={};var _0x4bb5d5;var _0x2f26e9;return db['ZohoConfiguration'][_0x10a7('0x50')]({'where':{'id':_0x2f5e00[_0x10a7('0x49')]['id']}})['then'](handleEntityNotFound(_0x36d525,null))[_0x10a7('0x27')](function(_0xb6ffef){if(_0xb6ffef){_0x4bb5d5=_0xb6ffef;_0x1133ce[_0x10a7('0x39')]=_[_0x10a7('0x36')](db[_0x10a7('0x51')]['rawAttributes']);_0x1133ce[_0x10a7('0x35')]=_[_0x10a7('0x36')](_0x2f5e00[_0x10a7('0x35')]);_0x1133ce[_0x10a7('0x37')]=_['intersection'](_0x1133ce[_0x10a7('0x39')],_0x1133ce['query']);_0xb1d083['attributes']=_['intersection'](_0x1133ce['model'],qs[_0x10a7('0x3a')](_0x2f5e00['query'][_0x10a7('0x3a')]));_0xb1d083[_0x10a7('0x3b')]=_0xb1d083[_0x10a7('0x3b')][_0x10a7('0x4a')]?_0xb1d083[_0x10a7('0x3b')]:_0x1133ce['model'];_0xb1d083[_0x10a7('0x3d')]=qs[_0x10a7('0x3e')](_0x2f5e00['query'][_0x10a7('0x3e')]);_0xb1d083[_0x10a7('0x3f')]=qs['filters'](_[_0x10a7('0x40')](_0x2f5e00[_0x10a7('0x35')],_0x1133ce[_0x10a7('0x37')]));if(_0x2f5e00[_0x10a7('0x35')][_0x10a7('0x52')]){_0xb1d083[_0x10a7('0x3f')]=_['merge'](_0xb1d083['where'],{'$or':_[_0x10a7('0x2f')](_0xb1d083['attributes'],function(_0xa1d80){var _0x557f55={};_0x557f55[_0xa1d80]={'$like':'%'+_0x2f5e00[_0x10a7('0x35')][_0x10a7('0x52')]+'%'};return _0x557f55;})});}_0xb1d083=_['merge']({},_0xb1d083,_0x2f5e00[_0x10a7('0x43')]);return _0x4bb5d5[_0x10a7('0x56')](_0xb1d083);}})[_0x10a7('0x27')](function(_0x5dc751){if(_0x5dc751){_0x2f26e9=_0x5dc751[_0x10a7('0x4a')];if(!_0x2f5e00[_0x10a7('0x35')][_0x10a7('0x54')]('nolimit')){_0xb1d083[_0x10a7('0x21')]=qs[_0x10a7('0x21')](_0x2f5e00['query'][_0x10a7('0x21')]);_0xb1d083[_0x10a7('0x1e')]=qs[_0x10a7('0x1e')](_0x2f5e00[_0x10a7('0x35')]['offset']);}return _0x4bb5d5['getDescriptions'](_0xb1d083);}})[_0x10a7('0x27')](function(_0x42ac35){if(_0x42ac35){return _0x42ac35?{'count':_0x2f26e9,'rows':_0x42ac35}:null;}})[_0x10a7('0x27')](respondWithResult(_0x36d525,null))[_0x10a7('0x47')](handleError(_0x36d525,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 3869a14..3ca94ab 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 _0x028d=['./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x36895a,_0x5af2bf){var _0x91d9d6=function(_0x589966){while(--_0x589966){_0x36895a['push'](_0x36895a['shift']());}};_0x91d9d6(++_0x5af2bf);}(_0x028d,0x131));var _0xd028=function(_0x186ed3,_0x3ac342){_0x186ed3=_0x186ed3-0x0;var _0x31c314=_0x028d[_0x186ed3];return _0x31c314;};'use strict';var _=require(_0xd028('0x0'));var util=require('util');var logger=require(_0xd028('0x1'))('api');var moment=require(_0xd028('0x2'));var BPromise=require('bluebird');var rp=require(_0xd028('0x3'));var fs=require('fs');var path=require(_0xd028('0x4'));var rimraf=require(_0xd028('0x5'));var config=require(_0xd028('0x6'));var attributes=require(_0xd028('0x7'));module[_0xd028('0x8')]=function(_0x56cb24,_0x53dbf9){return _0x56cb24[_0xd028('0x9')](_0xd028('0xa'),attributes,{'tableName':_0xd028('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb654=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0xb654,0x16e));var _0x4b65=function(_0x1b2bcc,_0x51d235){_0x1b2bcc=_0x1b2bcc-0x0;var _0x3910b7=_0xb654[_0x1b2bcc];return _0x3910b7;};'use strict';var _=require(_0x4b65('0x0'));var util=require(_0x4b65('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4b65('0x2'));var BPromise=require(_0x4b65('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b65('0x4'));var rimraf=require(_0x4b65('0x5'));var config=require(_0x4b65('0x6'));var attributes=require(_0x4b65('0x7'));module['exports']=function(_0x36c140,_0x4b129d){return _0x36c140[_0x4b65('0x8')](_0x4b65('0x9'),attributes,{'tableName':_0x4b65('0xa'),'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 5ee2188..2901bb0 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 _0xed52=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message'];(function(_0x19ea54,_0x3687cd){var _0x62a49c=function(_0x2b2aac){while(--_0x2b2aac){_0x19ea54['push'](_0x19ea54['shift']());}};_0x62a49c(++_0x3687cd);}(_0xed52,0xc1));var _0x2ed5=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xed52[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x2ed5('0x0'));var util=require(_0x2ed5('0x1'));var moment=require(_0x2ed5('0x2'));var BPromise=require(_0x2ed5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ed5('0x4'));var db=require(_0x2ed5('0x5'))['db'];var utils=require(_0x2ed5('0x6'));var logger=require(_0x2ed5('0x7'))(_0x2ed5('0x8'));var config=require(_0x2ed5('0x9'));var jayson=require(_0x2ed5('0xa'));var client=jayson['client'][_0x2ed5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e0c84,_0x463280,_0x3ef673){return new BPromise(function(_0x4b30ea,_0x9ad4c0){return client[_0x2ed5('0xc')](_0x5e0c84,_0x3ef673)[_0x2ed5('0xd')](function(_0x1d8045){logger[_0x2ed5('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x463280,'request\x20sent');logger[_0x2ed5('0xf')](_0x2ed5('0x10'),_0x463280,_0x2ed5('0x11'),JSON[_0x2ed5('0x12')](_0x1d8045));if(_0x1d8045[_0x2ed5('0x13')]){if(_0x1d8045[_0x2ed5('0x13')][_0x2ed5('0x14')]===0x1f4){logger[_0x2ed5('0x13')](_0x2ed5('0x15'),_0x463280,_0x1d8045[_0x2ed5('0x13')][_0x2ed5('0x16')]);return _0x9ad4c0(_0x1d8045[_0x2ed5('0x13')][_0x2ed5('0x16')]);}logger[_0x2ed5('0x13')](_0x2ed5('0x15'),_0x463280,_0x1d8045[_0x2ed5('0x13')]['message']);return _0x4b30ea(_0x1d8045[_0x2ed5('0x13')][_0x2ed5('0x16')]);}else{logger[_0x2ed5('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x463280,'request\x20sent');_0x4b30ea(_0x1d8045['result']['message']);}})[_0x2ed5('0x17')](function(_0x383fc2){logger['error'](_0x2ed5('0x15'),_0x463280,_0x383fc2);_0x9ad4c0(_0x383fc2);});});} \ No newline at end of file +var _0x664f=['../../config/logger','rpc','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa0154a,_0x4721fb){var _0x3bd19d=function(_0x321d84){while(--_0x321d84){_0xa0154a['push'](_0xa0154a['shift']());}};_0x3bd19d(++_0x4721fb);}(_0x664f,0x13a));var _0xf664=function(_0x378752,_0x158b32){_0x378752=_0x378752-0x0;var _0xd5a262=_0x664f[_0x378752];return _0xd5a262;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf664('0x0'));var BPromise=require(_0xf664('0x1'));var rs=require(_0xf664('0x2'));var fs=require('fs');var Redis=require(_0xf664('0x3'));var db=require(_0xf664('0x4'))['db'];var utils=require(_0xf664('0x5'));var logger=require(_0xf664('0x6'))(_0xf664('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf664('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32c38c,_0x55c53f,_0x38c154){return new BPromise(function(_0x316b1b,_0x1c1b54){return client['request'](_0x32c38c,_0x38c154)[_0xf664('0x9')](function(_0x3bdfc8){logger[_0xf664('0xa')](_0xf664('0xb'),_0x55c53f,_0xf664('0xc'));logger[_0xf664('0xd')](_0xf664('0xe'),_0x55c53f,_0xf664('0xc'),JSON['stringify'](_0x3bdfc8));if(_0x3bdfc8[_0xf664('0xf')]){if(_0x3bdfc8[_0xf664('0xf')][_0xf664('0x10')]===0x1f4){logger[_0xf664('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x55c53f,_0x3bdfc8[_0xf664('0xf')][_0xf664('0x11')]);return _0x1c1b54(_0x3bdfc8[_0xf664('0xf')][_0xf664('0x11')]);}logger[_0xf664('0xf')](_0xf664('0xb'),_0x55c53f,_0x3bdfc8[_0xf664('0xf')][_0xf664('0x11')]);return _0x316b1b(_0x3bdfc8['error'][_0xf664('0x11')]);}else{logger[_0xf664('0xa')](_0xf664('0xb'),_0x55c53f,_0xf664('0xc'));_0x316b1b(_0x3bdfc8[_0xf664('0x12')][_0xf664('0x11')]);}})[_0xf664('0x13')](function(_0x347508){logger[_0xf664('0xf')](_0xf664('0xb'),_0x55c53f,_0x347508);_0x1c1b54(_0x347508);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 8d9182e..50fbf4b 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 _0x06fe=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','/:id','show','post','create','update','delete'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x06fe,0x1dd));var _0xe06f=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x06fe[_0x2d9c6a];return _0xf3c918;};'use strict';var multer=require(_0xe06f('0x0'));var util=require(_0xe06f('0x1'));var path=require(_0xe06f('0x2'));var timeout=require('connect-timeout');var express=require(_0xe06f('0x3'));var router=express['Router']();var fs_extra=require(_0xe06f('0x4'));var auth=require(_0xe06f('0x5'));var interaction=require(_0xe06f('0x6'));var config=require(_0xe06f('0x7'));var controller=require(_0xe06f('0x8'));router['get']('/',auth[_0xe06f('0x9')](),controller['index']);router[_0xe06f('0xa')](_0xe06f('0xb'),auth[_0xe06f('0x9')](),controller[_0xe06f('0xc')]);router[_0xe06f('0xd')]('/',auth[_0xe06f('0x9')](),controller[_0xe06f('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe06f('0xf')]);router[_0xe06f('0x10')](_0xe06f('0xb'),auth['isAuthenticated'](),controller[_0xe06f('0x11')]);module[_0xe06f('0x12')]=router; \ No newline at end of file +var _0xd230=['update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd230,0xd5));var _0x0d23=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xd230[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0d23('0x0'));var util=require(_0x0d23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d23('0x2')]();var fs_extra=require(_0x0d23('0x3'));var auth=require(_0x0d23('0x4'));var interaction=require(_0x0d23('0x5'));var config=require(_0x0d23('0x6'));var controller=require('./intZohoField.controller');router[_0x0d23('0x7')]('/',auth[_0x0d23('0x8')](),controller[_0x0d23('0x9')]);router[_0x0d23('0x7')](_0x0d23('0xa'),auth[_0x0d23('0x8')](),controller[_0x0d23('0xb')]);router[_0x0d23('0xc')]('/',auth['isAuthenticated'](),controller[_0x0d23('0xd')]);router[_0x0d23('0xe')]('/:id',auth[_0x0d23('0x8')](),controller[_0x0d23('0xf')]);router[_0x0d23('0x10')](_0x0d23('0xa'),auth[_0x0d23('0x8')](),controller[_0x0d23('0x11')]);module[_0x0d23('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 1a6d7c1..e4a91ac 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 _0x727a=['BOOLEAN','sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x727a,0x1f0));var _0xa727=function(_0x3c3d15,_0x120d77){_0x3c3d15=_0x3c3d15-0x0;var _0x2145fa=_0x727a[_0x3c3d15];return _0x2145fa;};'use strict';var Sequelize=require(_0xa727('0x0'));module[_0xa727('0x1')]={'type':{'type':Sequelize[_0xa727('0x2')](_0xa727('0x3'),_0xa727('0x4'),'customVariable','keyValue',_0xa727('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa727('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa727('0x2')](_0xa727('0x3'),_0xa727('0x4'),_0xa727('0x7'))},'keyContent':{'type':Sequelize[_0xa727('0x6')]},'idField':{'type':Sequelize[_0xa727('0x6')]},'nameField':{'type':Sequelize[_0xa727('0x6')]},'customField':{'type':Sequelize[_0xa727('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9eec=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','STRING'];(function(_0x112730,_0x27d014){var _0x4ebf88=function(_0x1bd77d){while(--_0x1bd77d){_0x112730['push'](_0x112730['shift']());}};_0x4ebf88(++_0x27d014);}(_0x9eec,0x71));var _0xc9ee=function(_0x4c1206,_0x14e36a){_0x4c1206=_0x4c1206-0x0;var _0x23b51f=_0x9eec[_0x4c1206];return _0x23b51f;};'use strict';var Sequelize=require(_0xc9ee('0x0'));module[_0xc9ee('0x1')]={'type':{'type':Sequelize[_0xc9ee('0x2')](_0xc9ee('0x3'),'variable',_0xc9ee('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc9ee('0x5')]},'keyType':{'type':Sequelize[_0xc9ee('0x2')](_0xc9ee('0x3'),'variable',_0xc9ee('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc9ee('0x5')]},'nameField':{'type':Sequelize[_0xc9ee('0x5')]},'customField':{'type':Sequelize[_0xc9ee('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b4245e7..035b5d8 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 _0xb8d5=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','end','name','map','ZohoField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','create','body','find','params','eml-format'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0xb8d5,0xd4));var _0x5b8d=function(_0x15ed0b,_0x3c6cd2){_0x15ed0b=_0x15ed0b-0x0;var _0x2d4431=_0xb8d5[_0x15ed0b];return _0x2d4431;};'use strict';var emlformat=require(_0x5b8d('0x0'));var rimraf=require(_0x5b8d('0x1'));var zipdir=require(_0x5b8d('0x2'));var jsonpatch=require(_0x5b8d('0x3'));var rp=require(_0x5b8d('0x4'));var moment=require(_0x5b8d('0x5'));var BPromise=require(_0x5b8d('0x6'));var Mustache=require('mustache');var util=require(_0x5b8d('0x7'));var path=require(_0x5b8d('0x8'));var sox=require(_0x5b8d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b8d('0xa'));var _=require(_0x5b8d('0xb'));var squel=require('squel');var crypto=require(_0x5b8d('0xc'));var jsforce=require(_0x5b8d('0xd'));var deskjs=require(_0x5b8d('0xe'));var toCsv=require(_0x5b8d('0xf'));var querystring=require(_0x5b8d('0x10'));var Papa=require(_0x5b8d('0x11'));var Redis=require('ioredis');var authService=require(_0x5b8d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5b8d('0x13'));var hardwareService=require(_0x5b8d('0x14'));var logger=require(_0x5b8d('0x15'))('api');var utils=require(_0x5b8d('0x16'));var config=require(_0x5b8d('0x17'));var licenseUtil=require(_0x5b8d('0x18'));var db=require(_0x5b8d('0x19'))['db'];function respondWithStatusCode(_0x28140c,_0x4b333b){_0x4b333b=_0x4b333b||0xcc;return function(_0x3725eb){if(_0x3725eb){return _0x28140c[_0x5b8d('0x1a')](_0x4b333b);}return _0x28140c[_0x5b8d('0x1b')](_0x4b333b)['end']();};}function respondWithResult(_0x1e35f7,_0x34159d){_0x34159d=_0x34159d||0xc8;return function(_0x17bbb0){if(_0x17bbb0){return _0x1e35f7[_0x5b8d('0x1b')](_0x34159d)[_0x5b8d('0x1c')](_0x17bbb0);}};}function respondWithFilteredResult(_0x20a6b2,_0x4135ae){return function(_0xd20484){if(_0xd20484){var _0x332a17=typeof _0x4135ae[_0x5b8d('0x1d')]===_0x5b8d('0x1e')&&typeof _0x4135ae[_0x5b8d('0x1f')]==='undefined';var _0x30ec92=_0xd20484[_0x5b8d('0x20')];var _0x256f7a=_0x332a17?0x0:_0x4135ae[_0x5b8d('0x1d')];var _0x14c5b6=_0x332a17?_0xd20484['count']:_0x4135ae[_0x5b8d('0x1d')]+_0x4135ae[_0x5b8d('0x1f')];var _0x19663f;if(_0x14c5b6>=_0x30ec92){_0x14c5b6=_0x30ec92;_0x19663f=0xc8;}else{_0x19663f=0xce;}_0x20a6b2[_0x5b8d('0x1b')](_0x19663f);return _0x20a6b2[_0x5b8d('0x21')]('Content-Range',_0x256f7a+'-'+_0x14c5b6+'/'+_0x30ec92)[_0x5b8d('0x1c')](_0xd20484);}return null;};}function patchUpdates(_0x14a5c2){return function(_0x3c5e72){try{jsonpatch[_0x5b8d('0x22')](_0x3c5e72,_0x14a5c2,!![]);}catch(_0x5df0b3){return BPromise[_0x5b8d('0x23')](_0x5df0b3);}return _0x3c5e72['save']();};}function saveUpdates(_0x52868e,_0x398f48){return function(_0x1c80a8){if(_0x1c80a8){return _0x1c80a8[_0x5b8d('0x24')](_0x52868e)['then'](function(_0x41e094){return _0x41e094;});}return null;};}function removeEntity(_0x5d173a,_0x53158b){return function(_0x8ea4a6){if(_0x8ea4a6){return _0x8ea4a6[_0x5b8d('0x25')]()[_0x5b8d('0x26')](function(){_0x5d173a[_0x5b8d('0x1b')](0xcc)[_0x5b8d('0x27')]();});}};}function handleEntityNotFound(_0x18c6de,_0x4eee14){return function(_0x2e4493){if(!_0x2e4493){_0x18c6de[_0x5b8d('0x1a')](0x194);}return _0x2e4493;};}function handleError(_0x308a7d,_0x2cfe26){_0x2cfe26=_0x2cfe26||0x1f4;return function(_0x30877c){logger['error'](_0x30877c['stack']);if(_0x30877c[_0x5b8d('0x28')]){delete _0x30877c[_0x5b8d('0x28')];}_0x308a7d[_0x5b8d('0x1b')](_0x2cfe26)['send'](_0x30877c);};}exports['index']=function(_0x554ebf,_0x632016){var _0x3981bb={},_0x18b94c={},_0x39704b={'count':0x0,'rows':[]};var _0x2f3186=_[_0x5b8d('0x29')](db[_0x5b8d('0x2a')][_0x5b8d('0x2b')],function(_0x2a8ab6){return{'name':_0x2a8ab6['fieldName'],'type':_0x2a8ab6['type'][_0x5b8d('0x2c')]};});_0x18b94c[_0x5b8d('0x2d')]=_[_0x5b8d('0x29')](_0x2f3186,_0x5b8d('0x28'));_0x18b94c[_0x5b8d('0x2e')]=_[_0x5b8d('0x2f')](_0x554ebf[_0x5b8d('0x2e')]);_0x18b94c[_0x5b8d('0x30')]=_[_0x5b8d('0x31')](_0x18b94c[_0x5b8d('0x2d')],_0x18b94c[_0x5b8d('0x2e')]);_0x3981bb[_0x5b8d('0x32')]=_[_0x5b8d('0x31')](_0x18b94c[_0x5b8d('0x2d')],qs[_0x5b8d('0x33')](_0x554ebf[_0x5b8d('0x2e')][_0x5b8d('0x33')]));_0x3981bb[_0x5b8d('0x32')]=_0x3981bb['attributes'][_0x5b8d('0x34')]?_0x3981bb[_0x5b8d('0x32')]:_0x18b94c[_0x5b8d('0x2d')];if(!_0x554ebf[_0x5b8d('0x2e')][_0x5b8d('0x35')](_0x5b8d('0x36'))){_0x3981bb[_0x5b8d('0x1f')]=qs[_0x5b8d('0x1f')](_0x554ebf[_0x5b8d('0x2e')]['limit']);_0x3981bb['offset']=qs[_0x5b8d('0x1d')](_0x554ebf[_0x5b8d('0x2e')][_0x5b8d('0x1d')]);}_0x3981bb['order']=qs[_0x5b8d('0x37')](_0x554ebf['query'][_0x5b8d('0x37')]);_0x3981bb['where']=qs['filters'](_[_0x5b8d('0x38')](_0x554ebf[_0x5b8d('0x2e')],_0x18b94c['filters']),_0x2f3186);if(_0x554ebf['query'][_0x5b8d('0x39')]){_0x3981bb[_0x5b8d('0x3a')]=_[_0x5b8d('0x3b')](_0x3981bb[_0x5b8d('0x3a')],{'$or':_[_0x5b8d('0x29')](_0x2f3186,function(_0xb02533){if(_0xb02533[_0x5b8d('0x3c')]!==_0x5b8d('0x3d')){var _0x246dc6={};_0x246dc6[_0xb02533[_0x5b8d('0x28')]]={'$like':'%'+_0x554ebf['query'][_0x5b8d('0x39')]+'%'};return _0x246dc6;}})});}_0x3981bb=_['merge']({},_0x3981bb,_0x554ebf[_0x5b8d('0x3e')]);var _0x3ededd={'where':_0x3981bb[_0x5b8d('0x3a')]};return db['ZohoField'][_0x5b8d('0x20')](_0x3ededd)['then'](function(_0x5658f3){_0x39704b[_0x5b8d('0x20')]=_0x5658f3;if(_0x554ebf[_0x5b8d('0x2e')][_0x5b8d('0x3f')]){_0x3981bb[_0x5b8d('0x40')]=[{'all':!![]}];}return db[_0x5b8d('0x2a')][_0x5b8d('0x41')](_0x3981bb);})[_0x5b8d('0x26')](function(_0x1cde91){_0x39704b['rows']=_0x1cde91;return _0x39704b;})[_0x5b8d('0x26')](respondWithFilteredResult(_0x632016,_0x3981bb))[_0x5b8d('0x42')](handleError(_0x632016,null));};exports['show']=function(_0x4abb5e,_0x14776e){var _0x294761={'raw':!![],'where':{'id':_0x4abb5e['params']['id']}},_0x49a8a6={};_0x49a8a6[_0x5b8d('0x2d')]=_[_0x5b8d('0x2f')](db[_0x5b8d('0x2a')][_0x5b8d('0x2b')]);_0x49a8a6[_0x5b8d('0x2e')]=_[_0x5b8d('0x2f')](_0x4abb5e[_0x5b8d('0x2e')]);_0x49a8a6[_0x5b8d('0x30')]=_['intersection'](_0x49a8a6[_0x5b8d('0x2d')],_0x49a8a6[_0x5b8d('0x2e')]);_0x294761[_0x5b8d('0x32')]=_[_0x5b8d('0x31')](_0x49a8a6[_0x5b8d('0x2d')],qs[_0x5b8d('0x33')](_0x4abb5e[_0x5b8d('0x2e')][_0x5b8d('0x33')]));_0x294761[_0x5b8d('0x32')]=_0x294761['attributes']['length']?_0x294761[_0x5b8d('0x32')]:_0x49a8a6[_0x5b8d('0x2d')];if(_0x4abb5e[_0x5b8d('0x2e')][_0x5b8d('0x3f')]){_0x294761[_0x5b8d('0x40')]=[{'all':!![]}];}_0x294761=_['merge']({},_0x294761,_0x4abb5e[_0x5b8d('0x3e')]);return db[_0x5b8d('0x2a')]['find'](_0x294761)[_0x5b8d('0x26')](handleEntityNotFound(_0x14776e,null))[_0x5b8d('0x26')](respondWithResult(_0x14776e,null))[_0x5b8d('0x42')](handleError(_0x14776e,null));};exports['create']=function(_0x53eefb,_0x5281ac){return db[_0x5b8d('0x2a')][_0x5b8d('0x43')](_0x53eefb['body'],{})[_0x5b8d('0x26')](respondWithResult(_0x5281ac,0xc9))[_0x5b8d('0x42')](handleError(_0x5281ac,null));};exports[_0x5b8d('0x24')]=function(_0x3c37d9,_0x576f78){if(_0x3c37d9[_0x5b8d('0x44')]['id']){delete _0x3c37d9[_0x5b8d('0x44')]['id'];}return db[_0x5b8d('0x2a')][_0x5b8d('0x45')]({'where':{'id':_0x3c37d9[_0x5b8d('0x46')]['id']}})[_0x5b8d('0x26')](handleEntityNotFound(_0x576f78,null))[_0x5b8d('0x26')](saveUpdates(_0x3c37d9['body'],null))[_0x5b8d('0x26')](respondWithResult(_0x576f78,null))[_0x5b8d('0x42')](handleError(_0x576f78,null));};exports[_0x5b8d('0x25')]=function(_0x3df942,_0x391b96){return db[_0x5b8d('0x2a')][_0x5b8d('0x45')]({'where':{'id':_0x3df942[_0x5b8d('0x46')]['id']}})[_0x5b8d('0x26')](handleEntityNotFound(_0x391b96,null))['then'](removeEntity(_0x391b96,null))[_0x5b8d('0x42')](handleError(_0x391b96,null));}; \ No newline at end of file +var _0x96cf=['reject','save','update','then','destroy','stack','name','index','map','ZohoField','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','rows','show','params','keys','options','find','create','body','catch','eml-format','rimraf','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x55b6ee,_0x1a60a4){var _0x419f61=function(_0x56ef8a){while(--_0x56ef8a){_0x55b6ee['push'](_0x55b6ee['shift']());}};_0x419f61(++_0x1a60a4);}(_0x96cf,0x143));var _0xf96c=function(_0x3ee093,_0x9a7bdc){_0x3ee093=_0x3ee093-0x0;var _0x54307c=_0x96cf[_0x3ee093];return _0x54307c;};'use strict';var emlformat=require(_0xf96c('0x0'));var rimraf=require(_0xf96c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf96c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf96c('0x3'));var util=require('util');var path=require(_0xf96c('0x4'));var sox=require(_0xf96c('0x5'));var csv=require('to-csv');var ejs=require(_0xf96c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf96c('0x7'));var squel=require(_0xf96c('0x8'));var crypto=require(_0xf96c('0x9'));var jsforce=require(_0xf96c('0xa'));var deskjs=require(_0xf96c('0xb'));var toCsv=require(_0xf96c('0xc'));var querystring=require(_0xf96c('0xd'));var Papa=require('papaparse');var Redis=require(_0xf96c('0xe'));var authService=require(_0xf96c('0xf'));var qs=require(_0xf96c('0x10'));var as=require(_0xf96c('0x11'));var hardwareService=require(_0xf96c('0x12'));var logger=require(_0xf96c('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf96c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d69b,_0x5f5384){_0x5f5384=_0x5f5384||0xcc;return function(_0x2ec4ce){if(_0x2ec4ce){return _0x44d69b[_0xf96c('0x15')](_0x5f5384);}return _0x44d69b[_0xf96c('0x16')](_0x5f5384)[_0xf96c('0x17')]();};}function respondWithResult(_0x250199,_0x4ce4df){_0x4ce4df=_0x4ce4df||0xc8;return function(_0x5bc171){if(_0x5bc171){return _0x250199['status'](_0x4ce4df)[_0xf96c('0x18')](_0x5bc171);}};}function respondWithFilteredResult(_0x3a0ac8,_0x4065ac){return function(_0x40f56f){if(_0x40f56f){var _0x23e6cb=typeof _0x4065ac[_0xf96c('0x19')]===_0xf96c('0x1a')&&typeof _0x4065ac[_0xf96c('0x1b')]===_0xf96c('0x1a');var _0x4aa987=_0x40f56f[_0xf96c('0x1c')];var _0x50f76e=_0x23e6cb?0x0:_0x4065ac['offset'];var _0xfffcad=_0x23e6cb?_0x40f56f[_0xf96c('0x1c')]:_0x4065ac[_0xf96c('0x19')]+_0x4065ac[_0xf96c('0x1b')];var _0x4d755d;if(_0xfffcad>=_0x4aa987){_0xfffcad=_0x4aa987;_0x4d755d=0xc8;}else{_0x4d755d=0xce;}_0x3a0ac8[_0xf96c('0x16')](_0x4d755d);return _0x3a0ac8[_0xf96c('0x1d')](_0xf96c('0x1e'),_0x50f76e+'-'+_0xfffcad+'/'+_0x4aa987)[_0xf96c('0x18')](_0x40f56f);}return null;};}function patchUpdates(_0x3de816){return function(_0x4ad1ba){try{jsonpatch[_0xf96c('0x1f')](_0x4ad1ba,_0x3de816,!![]);}catch(_0x35fe42){return BPromise[_0xf96c('0x20')](_0x35fe42);}return _0x4ad1ba[_0xf96c('0x21')]();};}function saveUpdates(_0x2b2f7a,_0x52cff0){return function(_0x18cdde){if(_0x18cdde){return _0x18cdde[_0xf96c('0x22')](_0x2b2f7a)[_0xf96c('0x23')](function(_0x45a142){return _0x45a142;});}return null;};}function removeEntity(_0x25d722,_0x877ffe){return function(_0x4d01bb){if(_0x4d01bb){return _0x4d01bb[_0xf96c('0x24')]()[_0xf96c('0x23')](function(){_0x25d722['status'](0xcc)[_0xf96c('0x17')]();});}};}function handleEntityNotFound(_0x4c3533,_0x3f0d10){return function(_0x36b8d7){if(!_0x36b8d7){_0x4c3533['sendStatus'](0x194);}return _0x36b8d7;};}function handleError(_0x3bd114,_0x2651be){_0x2651be=_0x2651be||0x1f4;return function(_0x1d12b5){logger['error'](_0x1d12b5[_0xf96c('0x25')]);if(_0x1d12b5['name']){delete _0x1d12b5[_0xf96c('0x26')];}_0x3bd114[_0xf96c('0x16')](_0x2651be)['send'](_0x1d12b5);};}exports[_0xf96c('0x27')]=function(_0x438b6b,_0x2f1d3b){var _0x910d3={},_0x49af6f={},_0x7a1616={'count':0x0,'rows':[]};var _0x55ddd8=_[_0xf96c('0x28')](db[_0xf96c('0x29')][_0xf96c('0x2a')],function(_0x403a62){return{'name':_0x403a62[_0xf96c('0x2b')],'type':_0x403a62['type'][_0xf96c('0x2c')]};});_0x49af6f[_0xf96c('0x2d')]=_[_0xf96c('0x28')](_0x55ddd8,_0xf96c('0x26'));_0x49af6f['query']=_['keys'](_0x438b6b[_0xf96c('0x2e')]);_0x49af6f['filters']=_[_0xf96c('0x2f')](_0x49af6f[_0xf96c('0x2d')],_0x49af6f['query']);_0x910d3[_0xf96c('0x30')]=_['intersection'](_0x49af6f[_0xf96c('0x2d')],qs[_0xf96c('0x31')](_0x438b6b['query'][_0xf96c('0x31')]));_0x910d3['attributes']=_0x910d3[_0xf96c('0x30')][_0xf96c('0x32')]?_0x910d3['attributes']:_0x49af6f[_0xf96c('0x2d')];if(!_0x438b6b[_0xf96c('0x2e')][_0xf96c('0x33')]('nolimit')){_0x910d3[_0xf96c('0x1b')]=qs['limit'](_0x438b6b[_0xf96c('0x2e')]['limit']);_0x910d3[_0xf96c('0x19')]=qs[_0xf96c('0x19')](_0x438b6b[_0xf96c('0x2e')][_0xf96c('0x19')]);}_0x910d3[_0xf96c('0x34')]=qs['sort'](_0x438b6b[_0xf96c('0x2e')]['sort']);_0x910d3[_0xf96c('0x35')]=qs[_0xf96c('0x36')](_[_0xf96c('0x37')](_0x438b6b['query'],_0x49af6f[_0xf96c('0x36')]),_0x55ddd8);if(_0x438b6b[_0xf96c('0x2e')][_0xf96c('0x38')]){_0x910d3[_0xf96c('0x35')]=_['merge'](_0x910d3[_0xf96c('0x35')],{'$or':_[_0xf96c('0x28')](_0x55ddd8,function(_0x1b4d26){if(_0x1b4d26[_0xf96c('0x39')]!==_0xf96c('0x3a')){var _0x5a407d={};_0x5a407d[_0x1b4d26[_0xf96c('0x26')]]={'$like':'%'+_0x438b6b[_0xf96c('0x2e')]['filter']+'%'};return _0x5a407d;}})});}_0x910d3=_[_0xf96c('0x3b')]({},_0x910d3,_0x438b6b['options']);var _0x414930={'where':_0x910d3[_0xf96c('0x35')]};return db['ZohoField'][_0xf96c('0x1c')](_0x414930)[_0xf96c('0x23')](function(_0x54f698){_0x7a1616['count']=_0x54f698;if(_0x438b6b[_0xf96c('0x2e')][_0xf96c('0x3c')]){_0x910d3[_0xf96c('0x3d')]=[{'all':!![]}];}return db[_0xf96c('0x29')]['findAll'](_0x910d3);})[_0xf96c('0x23')](function(_0x111a82){_0x7a1616[_0xf96c('0x3e')]=_0x111a82;return _0x7a1616;})['then'](respondWithFilteredResult(_0x2f1d3b,_0x910d3))['catch'](handleError(_0x2f1d3b,null));};exports[_0xf96c('0x3f')]=function(_0x1c86cb,_0x445962){var _0x3b63a7={'raw':!![],'where':{'id':_0x1c86cb[_0xf96c('0x40')]['id']}},_0x35857d={};_0x35857d['model']=_[_0xf96c('0x41')](db[_0xf96c('0x29')][_0xf96c('0x2a')]);_0x35857d[_0xf96c('0x2e')]=_[_0xf96c('0x41')](_0x1c86cb[_0xf96c('0x2e')]);_0x35857d[_0xf96c('0x36')]=_[_0xf96c('0x2f')](_0x35857d[_0xf96c('0x2d')],_0x35857d['query']);_0x3b63a7['attributes']=_[_0xf96c('0x2f')](_0x35857d[_0xf96c('0x2d')],qs['fields'](_0x1c86cb[_0xf96c('0x2e')][_0xf96c('0x31')]));_0x3b63a7[_0xf96c('0x30')]=_0x3b63a7[_0xf96c('0x30')][_0xf96c('0x32')]?_0x3b63a7[_0xf96c('0x30')]:_0x35857d['model'];if(_0x1c86cb['query'][_0xf96c('0x3c')]){_0x3b63a7['include']=[{'all':!![]}];}_0x3b63a7=_['merge']({},_0x3b63a7,_0x1c86cb[_0xf96c('0x42')]);return db[_0xf96c('0x29')][_0xf96c('0x43')](_0x3b63a7)[_0xf96c('0x23')](handleEntityNotFound(_0x445962,null))[_0xf96c('0x23')](respondWithResult(_0x445962,null))['catch'](handleError(_0x445962,null));};exports[_0xf96c('0x44')]=function(_0xd7257d,_0x9acb9b){return db['ZohoField'][_0xf96c('0x44')](_0xd7257d[_0xf96c('0x45')],{})[_0xf96c('0x23')](respondWithResult(_0x9acb9b,0xc9))[_0xf96c('0x46')](handleError(_0x9acb9b,null));};exports['update']=function(_0x47e638,_0x5ca763){if(_0x47e638[_0xf96c('0x45')]['id']){delete _0x47e638[_0xf96c('0x45')]['id'];}return db[_0xf96c('0x29')][_0xf96c('0x43')]({'where':{'id':_0x47e638['params']['id']}})[_0xf96c('0x23')](handleEntityNotFound(_0x5ca763,null))['then'](saveUpdates(_0x47e638[_0xf96c('0x45')],null))[_0xf96c('0x23')](respondWithResult(_0x5ca763,null))[_0xf96c('0x46')](handleError(_0x5ca763,null));};exports[_0xf96c('0x24')]=function(_0x20b1ad,_0x102c27){return db[_0xf96c('0x29')]['find']({'where':{'id':_0x20b1ad[_0xf96c('0x40')]['id']}})[_0xf96c('0x23')](handleEntityNotFound(_0x102c27,null))['then'](removeEntity(_0x102c27,null))[_0xf96c('0x46')](handleError(_0x102c27,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a186d59..650f888 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 _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x247aab,_0x6d308){var _0x198cd0=function(_0x2bf3a4){while(--_0x2bf3a4){_0x247aab['push'](_0x247aab['shift']());}};_0x198cd0(++_0x6d308);}(_0x2a07,0x74));var _0x72a0=function(_0x1acefc,_0x5da0bf){_0x1acefc=_0x1acefc-0x0;var _0x543527=_0x2a07[_0x1acefc];return _0x543527;};'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('0xf'),_0x72a0('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_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'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xf'),_0x901d('0x10')],'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 1a9aea6..da9ce6d 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 _0x4011=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x4011,0x89));var _0x1401=function(_0x111fec,_0x55932a){_0x111fec=_0x111fec-0x0;var _0x13b1a4=_0x4011[_0x111fec];return _0x13b1a4;};'use strict';var _=require(_0x1401('0x0'));var util=require(_0x1401('0x1'));var moment=require(_0x1401('0x2'));var BPromise=require(_0x1401('0x3'));var rs=require(_0x1401('0x4'));var fs=require('fs');var Redis=require(_0x1401('0x5'));var db=require(_0x1401('0x6'))['db'];var utils=require(_0x1401('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1401('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1401('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dfe27,_0x32c772,_0x37fe0c){return new BPromise(function(_0x5195e3,_0x170ae7){return client[_0x1401('0xa')](_0x2dfe27,_0x37fe0c)['then'](function(_0x1b7441){logger[_0x1401('0xb')](_0x1401('0xc'),_0x32c772,_0x1401('0xd'));logger[_0x1401('0xe')](_0x1401('0xf'),_0x32c772,'request\x20sent',JSON[_0x1401('0x10')](_0x1b7441));if(_0x1b7441['error']){if(_0x1b7441[_0x1401('0x11')][_0x1401('0x12')]===0x1f4){logger[_0x1401('0x11')]('ZohoField,\x20%s,\x20%s',_0x32c772,_0x1b7441[_0x1401('0x11')][_0x1401('0x13')]);return _0x170ae7(_0x1b7441['error'][_0x1401('0x13')]);}logger[_0x1401('0x11')](_0x1401('0xc'),_0x32c772,_0x1b7441['error'][_0x1401('0x13')]);return _0x5195e3(_0x1b7441[_0x1401('0x11')][_0x1401('0x13')]);}else{logger[_0x1401('0xb')](_0x1401('0xc'),_0x32c772,_0x1401('0xd'));_0x5195e3(_0x1b7441[_0x1401('0x14')][_0x1401('0x13')]);}})[_0x1401('0x15')](function(_0x113dfc){logger['error'](_0x1401('0xc'),_0x32c772,_0x113dfc);_0x170ae7(_0x113dfc);});});} \ No newline at end of file +var _0x492e=['then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x15e3e3,_0x4f1602){var _0x1a0ce0=function(_0xfd8fa3){while(--_0xfd8fa3){_0x15e3e3['push'](_0x15e3e3['shift']());}};_0x1a0ce0(++_0x4f1602);}(_0x492e,0x137));var _0xe492=function(_0x2a0875,_0x47ef45){_0x2a0875=_0x2a0875-0x0;var _0x43e74b=_0x492e[_0x2a0875];return _0x43e74b;};'use strict';var _=require(_0xe492('0x0'));var util=require('util');var moment=require(_0xe492('0x1'));var BPromise=require('bluebird');var rs=require(_0xe492('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe492('0x3'))['db'];var utils=require(_0xe492('0x4'));var logger=require(_0xe492('0x5'))(_0xe492('0x6'));var config=require(_0xe492('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe492('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57f359,_0x2ca3b7,_0x3fe615){return new BPromise(function(_0x1a3098,_0x4b88ed){return client['request'](_0x57f359,_0x3fe615)[_0xe492('0x9')](function(_0x5b7f32){logger['info'](_0xe492('0xa'),_0x2ca3b7,_0xe492('0xb'));logger['debug'](_0xe492('0xc'),_0x2ca3b7,_0xe492('0xb'),JSON[_0xe492('0xd')](_0x5b7f32));if(_0x5b7f32[_0xe492('0xe')]){if(_0x5b7f32['error'][_0xe492('0xf')]===0x1f4){logger[_0xe492('0xe')]('ZohoField,\x20%s,\x20%s',_0x2ca3b7,_0x5b7f32[_0xe492('0xe')]['message']);return _0x4b88ed(_0x5b7f32[_0xe492('0xe')][_0xe492('0x10')]);}logger[_0xe492('0xe')](_0xe492('0xa'),_0x2ca3b7,_0x5b7f32['error'][_0xe492('0x10')]);return _0x1a3098(_0x5b7f32[_0xe492('0xe')][_0xe492('0x10')]);}else{logger[_0xe492('0x11')]('ZohoField,\x20%s,\x20%s',_0x2ca3b7,_0xe492('0xb'));_0x1a3098(_0x5b7f32[_0xe492('0x12')][_0xe492('0x10')]);}})[_0xe492('0x13')](function(_0x4f30d9){logger[_0xe492('0xe')]('ZohoField,\x20%s,\x20%s',_0x2ca3b7,_0x4f30d9);_0x4b88ed(_0x4f30d9);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 3979f68..eed874f 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(_0x4dc7f5,_0x312c14){var _0x3e37db=function(_0x820d0e){while(--_0x820d0e){_0x4dc7f5['push'](_0x4dc7f5['shift']());}};_0x3e37db(++_0x312c14);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x367284,_0x26688c){var _0xe5c015=function(_0x19705e){while(--_0x19705e){_0x367284['push'](_0x367284['shift']());}};_0xe5c015(++_0x26688c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 82119f3..a921cf4 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 _0xf7f7=['STRING','unique_name_and_version','app.js','INTEGER','state','sequelize','exports'];(function(_0x20aa0f,_0x16368b){var _0x466faf=function(_0x3fa6f7){while(--_0x3fa6f7){_0x20aa0f['push'](_0x20aa0f['shift']());}};_0x466faf(++_0x16368b);}(_0xf7f7,0xf3));var _0x7f7f=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0xf7f7[_0x3be7ff];return _0x186721;};'use strict';var Sequelize=require(_0x7f7f('0x0'));module[_0x7f7f('0x1')]={'name':{'type':Sequelize[_0x7f7f('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x7f7f('0x2')],'allowNull':![],'unique':_0x7f7f('0x3')},'main':{'type':Sequelize[_0x7f7f('0x2')],'defaultValue':_0x7f7f('0x4')},'filename':{'type':Sequelize[_0x7f7f('0x2')]},'path':{'type':Sequelize[_0x7f7f('0x2')]},'type':{'type':Sequelize[_0x7f7f('0x2')]},'size':{'type':Sequelize[_0x7f7f('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x7f7f('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x7f7f('0x6')},'description':{'type':Sequelize[_0x7f7f('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7f7f('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x82df=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x82df,0x164));var _0xf82d=function(_0x6cdf62,_0x25d4f5){_0x6cdf62=_0x6cdf62-0x0;var _0x24a12a=_0x82df[_0x6cdf62];return _0x24a12a;};'use strict';var Sequelize=require(_0xf82d('0x0'));module[_0xf82d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xf82d('0x2')],'allowNull':![],'unique':_0xf82d('0x3')},'main':{'type':Sequelize[_0xf82d('0x2')],'defaultValue':_0xf82d('0x4')},'filename':{'type':Sequelize[_0xf82d('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf82d('0x2')]},'size':{'type':Sequelize[_0xf82d('0x5')]},'active':{'type':Sequelize[_0xf82d('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xf82d('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xf82d('0x2')],'unique':_0xf82d('0x7')},'description':{'type':Sequelize[_0xf82d('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf82d('0x2')]},'link':{'type':Sequelize[_0xf82d('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 84971dd..edfeed8 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 _0x57ca=['bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','Integration','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','rimraf','zip-dir','request-promise','moment'];(function(_0x34628b,_0x25629d){var _0x366c7e=function(_0x46e380){while(--_0x46e380){_0x34628b['push'](_0x34628b['shift']());}};_0x366c7e(++_0x25629d);}(_0x57ca,0x108));var _0xa57c=function(_0x229a14,_0x1904c0){_0x229a14=_0x229a14-0x0;var _0x33c4f2=_0x57ca[_0x229a14];return _0x33c4f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['Integration']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['Integration'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));}; \ No newline at end of file +var _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x2a2bf2,_0x5e9281){var _0x45c494=function(_0x4da6b3){while(--_0x4da6b3){_0x2a2bf2['push'](_0x2a2bf2['shift']());}};_0x45c494(++_0x5e9281);}(_0x7096,0x10c));var _0x6709=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7096[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 21ab496..e9d6c50 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 _0x0bcd=['exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0bcd,0x1ee));var _0xd0bc=function(_0x1ad9a6,_0x6cb54c){_0x1ad9a6=_0x1ad9a6-0x0;var _0x4dffdb=_0x0bcd[_0x1ad9a6];return _0x4dffdb;};'use strict';var _=require(_0xd0bc('0x0'));var util=require(_0xd0bc('0x1'));var logger=require(_0xd0bc('0x2'))(_0xd0bc('0x3'));var moment=require(_0xd0bc('0x4'));var BPromise=require(_0xd0bc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0bc('0x6'));var rimraf=require(_0xd0bc('0x7'));var config=require(_0xd0bc('0x8'));var attributes=require(_0xd0bc('0x9'));module[_0xd0bc('0xa')]=function(_0xa371e2,_0x4a5e6d){return _0xa371e2[_0xd0bc('0xb')](_0xd0bc('0xc'),attributes,{'tableName':_0xd0bc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ca5=['api','moment','bluebird','request-promise','path','exports','define','integrations','lodash','util','../../config/logger'];(function(_0x313eda,_0x28dc3f){var _0x33d9d4=function(_0x19657a){while(--_0x19657a){_0x313eda['push'](_0x313eda['shift']());}};_0x33d9d4(++_0x28dc3f);}(_0x6ca5,0xfa));var _0x56ca=function(_0x473911,_0x1899cf){_0x473911=_0x473911-0x0;var _0x4b8864=_0x6ca5[_0x473911];return _0x4b8864;};'use strict';var _=require(_0x56ca('0x0'));var util=require(_0x56ca('0x1'));var logger=require(_0x56ca('0x2'))(_0x56ca('0x3'));var moment=require(_0x56ca('0x4'));var BPromise=require(_0x56ca('0x5'));var rp=require(_0x56ca('0x6'));var fs=require('fs');var path=require(_0x56ca('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0x56ca('0x8')]=function(_0x31c9d3,_0xac5f3c){return _0x31c9d3[_0x56ca('0x9')]('Integration',attributes,{'tableName':_0x56ca('0xa'),'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 e70a4d6..0c5eb50 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 _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0x0b0e,0x187));var _0xe0b0=function(_0x308a1d,_0x3d379d){_0x308a1d=_0x308a1d-0x0;var _0x5eb875=_0x0b0e[_0x308a1d];return _0x5eb875;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2297a4,_0x768cf7){var _0x1c618a=function(_0xaab795){while(--_0xaab795){_0x2297a4['push'](_0x2297a4['shift']());}};_0x1c618a(++_0x768cf7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29c810,_0x3e1ae5){_0x29c810=_0x29c810-0x0;var _0x1b0a2d=_0x5f2f[_0x29c810];return _0x1b0a2d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 4d6565b..0f35632 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 _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x5aaadb,_0xeeab51){var _0x379c74=function(_0x10319a){while(--_0x10319a){_0x5aaadb['push'](_0x5aaadb['shift']());}};_0x379c74(++_0xeeab51);}(_0x187d,0x93));var _0xd187=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x187d[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('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 b1b625e..5de89f6 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 _0xd324=['TEXT','ENUM','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x28d1dc,_0x450cd8){var _0x357ee1=function(_0x45001b){while(--_0x45001b){_0x28d1dc['push'](_0x28d1dc['shift']());}};_0x357ee1(++_0x450cd8);}(_0xd324,0x172));var _0x4d32=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0xd324[_0x3efe87];return _0x56a4cc;};'use strict';var Sequelize=require(_0x4d32('0x0'));module[_0x4d32('0x1')]={'integration':{'type':Sequelize[_0x4d32('0x2')]},'eventChannel':{'type':Sequelize[_0x4d32('0x2')]},'exitStatus':{'type':Sequelize[_0x4d32('0x2')]},'ticketId':{'type':Sequelize[_0x4d32('0x2')]},'integrationId':{'type':Sequelize[_0x4d32('0x3')]},'contacts':{'type':Sequelize[_0x4d32('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4d32('0x2')]},'calleridname':{'type':Sequelize[_0x4d32('0x2')]},'queue':{'type':Sequelize[_0x4d32('0x2')]},'interface':{'type':Sequelize[_0x4d32('0x2')]},'membername':{'type':Sequelize[_0x4d32('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4d32('0x4')]},'holdtime':{'type':Sequelize[_0x4d32('0x3')]},'agentcomplete':{'type':Sequelize[_0x4d32('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4d32('0x4')]},'talktime':{'type':Sequelize[_0x4d32('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4d32('0x3')]},'reason':{'type':Sequelize[_0x4d32('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x4d32('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4d32('0x4')]},'agentdump':{'type':Sequelize[_0x4d32('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4d32('0x4')]},'lastevent':{'type':Sequelize[_0x4d32('0x2')]},'channel':{'type':Sequelize[_0x4d32('0x2')]},'channelstate':{'type':Sequelize[_0x4d32('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4d32('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4d32('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4d32('0x2')]},'accountcode':{'type':Sequelize[_0x4d32('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4d32('0x2')]},'priority':{'type':Sequelize[_0x4d32('0x2')]},'destchannel':{'type':Sequelize[_0x4d32('0x2')]},'destchannelstate':{'type':Sequelize[_0x4d32('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x4d32('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4d32('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4d32('0x2')]},'destlanguage':{'type':Sequelize[_0x4d32('0x2')]},'destaccountcode':{'type':Sequelize[_0x4d32('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x4d32('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x4d32('0x2')]},'from':{'type':Sequelize[_0x4d32('0x2')]},'to':{'type':Sequelize[_0x4d32('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x4d32('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x4d32('0x6')]},'status':{'type':Sequelize[_0x4d32('0x7')]('SENT','SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize[_0x4d32('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4d32('0x2')]},'projectId':{'type':Sequelize[_0x4d32('0x3')]}}; \ No newline at end of file +var _0xef53=['exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xef53,0x6d));var _0x3ef5=function(_0x59de2a,_0x264f62){_0x59de2a=_0x59de2a-0x0;var _0x1d18d2=_0xef53[_0x59de2a];return _0x1d18d2;};'use strict';var Sequelize=require(_0x3ef5('0x0'));module[_0x3ef5('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x3ef5('0x2')]},'exitStatus':{'type':Sequelize[_0x3ef5('0x2')]},'ticketId':{'type':Sequelize[_0x3ef5('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x3ef5('0x2')]},'uniqueid':{'type':Sequelize[_0x3ef5('0x2')]},'calleridnum':{'type':Sequelize[_0x3ef5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3ef5('0x2')]},'interface':{'type':Sequelize[_0x3ef5('0x2')]},'membername':{'type':Sequelize[_0x3ef5('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3ef5('0x3')]},'agentconnectAt':{'type':Sequelize[_0x3ef5('0x3')]},'holdtime':{'type':Sequelize[_0x3ef5('0x4')]},'agentcomplete':{'type':Sequelize[_0x3ef5('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3ef5('0x3')]},'talktime':{'type':Sequelize[_0x3ef5('0x4')]},'agentacw':{'type':Sequelize[_0x3ef5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x3ef5('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x3ef5('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3ef5('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3ef5('0x3')]},'lastevent':{'type':Sequelize[_0x3ef5('0x2')]},'channel':{'type':Sequelize[_0x3ef5('0x2')]},'channelstate':{'type':Sequelize[_0x3ef5('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x3ef5('0x2')]},'connectedlinename':{'type':Sequelize[_0x3ef5('0x2')]},'language':{'type':Sequelize[_0x3ef5('0x2')]},'accountcode':{'type':Sequelize[_0x3ef5('0x2')]},'context':{'type':Sequelize[_0x3ef5('0x2')]},'exten':{'type':Sequelize[_0x3ef5('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x3ef5('0x2')]},'destchannelstate':{'type':Sequelize[_0x3ef5('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x3ef5('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3ef5('0x2')]},'destcalleridname':{'type':Sequelize[_0x3ef5('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x3ef5('0x2')]},'destaccountcode':{'type':Sequelize[_0x3ef5('0x2')]},'destcontext':{'type':Sequelize[_0x3ef5('0x2')]},'destexten':{'type':Sequelize[_0x3ef5('0x2')]},'destpriority':{'type':Sequelize[_0x3ef5('0x2')]},'destuniqueid':{'type':Sequelize[_0x3ef5('0x2')]},'messageId':{'type':Sequelize[_0x3ef5('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x3ef5('0x2')]},'from':{'type':Sequelize[_0x3ef5('0x2')]},'to':{'type':Sequelize[_0x3ef5('0x2')]},'cc':{'type':Sequelize[_0x3ef5('0x2')]},'attachment':{'type':Sequelize[_0x3ef5('0x6')]},'html':{'type':Sequelize[_0x3ef5('0x6')]},'text':{'type':Sequelize[_0x3ef5('0x6')]},'status':{'type':Sequelize[_0x3ef5('0x7')]('SENT',_0x3ef5('0x8'),_0x3ef5('0x9'),_0x3ef5('0xa'))},'url':{'type':Sequelize[_0x3ef5('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x3ef5('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 91602e4..13a95ae 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 _0x70cf=['where','merge','VIRTUAL','includeAll','include','rows','catch','params','intersection','options','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','name','IntegrationReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','nolimit','order','sort','pick','filter'];(function(_0x2e0d05,_0x268558){var _0x5480f8=function(_0x3517b6){while(--_0x3517b6){_0x2e0d05['push'](_0x2e0d05['shift']());}};_0x5480f8(++_0x268558);}(_0x70cf,0xea));var _0xf70c=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x70cf[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0xf70c('0x0'));var rimraf=require(_0xf70c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf70c('0x2'));var rp=require(_0xf70c('0x3'));var moment=require(_0xf70c('0x4'));var BPromise=require(_0xf70c('0x5'));var Mustache=require(_0xf70c('0x6'));var util=require(_0xf70c('0x7'));var path=require(_0xf70c('0x8'));var sox=require(_0xf70c('0x9'));var csv=require(_0xf70c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf70c('0xb'));var _=require(_0xf70c('0xc'));var squel=require(_0xf70c('0xd'));var crypto=require('crypto');var jsforce=require(_0xf70c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf70c('0xa'));var querystring=require(_0xf70c('0xf'));var Papa=require('papaparse');var Redis=require(_0xf70c('0x10'));var authService=require(_0xf70c('0x11'));var qs=require(_0xf70c('0x12'));var as=require(_0xf70c('0x13'));var hardwareService=require(_0xf70c('0x14'));var logger=require(_0xf70c('0x15'))('api');var utils=require(_0xf70c('0x16'));var config=require(_0xf70c('0x17'));var licenseUtil=require(_0xf70c('0x18'));var db=require(_0xf70c('0x19'))['db'];function respondWithStatusCode(_0x46a684,_0x2b1c21){_0x2b1c21=_0x2b1c21||0xcc;return function(_0x5cc0f6){if(_0x5cc0f6){return _0x46a684['sendStatus'](_0x2b1c21);}return _0x46a684[_0xf70c('0x1a')](_0x2b1c21)[_0xf70c('0x1b')]();};}function respondWithResult(_0x348699,_0x44214e){_0x44214e=_0x44214e||0xc8;return function(_0x31067d){if(_0x31067d){return _0x348699['status'](_0x44214e)[_0xf70c('0x1c')](_0x31067d);}};}function respondWithFilteredResult(_0x238712,_0x2b0350){return function(_0x35fe2e){if(_0x35fe2e){var _0x4a07cc=typeof _0x2b0350[_0xf70c('0x1d')]===_0xf70c('0x1e')&&typeof _0x2b0350['limit']==='undefined';var _0x5d8dd9=_0x35fe2e[_0xf70c('0x1f')];var _0x4469c6=_0x4a07cc?0x0:_0x2b0350['offset'];var _0x4fb151=_0x4a07cc?_0x35fe2e[_0xf70c('0x1f')]:_0x2b0350[_0xf70c('0x1d')]+_0x2b0350[_0xf70c('0x20')];var _0x2d9726;if(_0x4fb151>=_0x5d8dd9){_0x4fb151=_0x5d8dd9;_0x2d9726=0xc8;}else{_0x2d9726=0xce;}_0x238712[_0xf70c('0x1a')](_0x2d9726);return _0x238712[_0xf70c('0x21')](_0xf70c('0x22'),_0x4469c6+'-'+_0x4fb151+'/'+_0x5d8dd9)[_0xf70c('0x1c')](_0x35fe2e);}return null;};}function patchUpdates(_0x1cbd9a){return function(_0x11c629){try{jsonpatch[_0xf70c('0x23')](_0x11c629,_0x1cbd9a,!![]);}catch(_0x5e5165){return BPromise[_0xf70c('0x24')](_0x5e5165);}return _0x11c629[_0xf70c('0x25')]();};}function saveUpdates(_0x58daa3,_0x5cb6f2){return function(_0x8ee679){if(_0x8ee679){return _0x8ee679['update'](_0x58daa3)[_0xf70c('0x26')](function(_0x4a9696){return _0x4a9696;});}return null;};}function removeEntity(_0x35a378,_0x4c3ce6){return function(_0x3de36b){if(_0x3de36b){return _0x3de36b['destroy']()[_0xf70c('0x26')](function(){_0x35a378[_0xf70c('0x1a')](0xcc)[_0xf70c('0x1b')]();});}};}function handleEntityNotFound(_0x32a1fb,_0x2c17d0){return function(_0x249b0b){if(!_0x249b0b){_0x32a1fb[_0xf70c('0x27')](0x194);}return _0x249b0b;};}function handleError(_0x11d6b2,_0x3eb71f){_0x3eb71f=_0x3eb71f||0x1f4;return function(_0x2b6e43){logger['error'](_0x2b6e43['stack']);if(_0x2b6e43[_0xf70c('0x28')]){delete _0x2b6e43['name'];}_0x11d6b2[_0xf70c('0x1a')](_0x3eb71f)['send'](_0x2b6e43);};}exports['index']=function(_0x55af5b,_0x33cd4a){var _0x3503bd={},_0x360521={},_0x40e42f={'count':0x0,'rows':[]};var _0x290ea5=_['map'](db[_0xf70c('0x29')][_0xf70c('0x2a')],function(_0x2afc6c){return{'name':_0x2afc6c[_0xf70c('0x2b')],'type':_0x2afc6c[_0xf70c('0x2c')][_0xf70c('0x2d')]};});_0x360521[_0xf70c('0x2e')]=_[_0xf70c('0x2f')](_0x290ea5,_0xf70c('0x28'));_0x360521['query']=_[_0xf70c('0x30')](_0x55af5b[_0xf70c('0x31')]);_0x360521[_0xf70c('0x32')]=_['intersection'](_0x360521[_0xf70c('0x2e')],_0x360521['query']);_0x3503bd[_0xf70c('0x33')]=_['intersection'](_0x360521[_0xf70c('0x2e')],qs[_0xf70c('0x34')](_0x55af5b[_0xf70c('0x31')][_0xf70c('0x34')]));_0x3503bd[_0xf70c('0x33')]=_0x3503bd[_0xf70c('0x33')]['length']?_0x3503bd['attributes']:_0x360521[_0xf70c('0x2e')];if(!_0x55af5b['query']['hasOwnProperty'](_0xf70c('0x35'))){_0x3503bd[_0xf70c('0x20')]=qs['limit'](_0x55af5b[_0xf70c('0x31')][_0xf70c('0x20')]);_0x3503bd[_0xf70c('0x1d')]=qs[_0xf70c('0x1d')](_0x55af5b['query'][_0xf70c('0x1d')]);}_0x3503bd[_0xf70c('0x36')]=qs[_0xf70c('0x37')](_0x55af5b['query']['sort']);_0x3503bd['where']=qs['filters'](_[_0xf70c('0x38')](_0x55af5b[_0xf70c('0x31')],_0x360521['filters']),_0x290ea5);if(_0x55af5b['query'][_0xf70c('0x39')]){_0x3503bd[_0xf70c('0x3a')]=_[_0xf70c('0x3b')](_0x3503bd['where'],{'$or':_[_0xf70c('0x2f')](_0x290ea5,function(_0x199c02){if(_0x199c02[_0xf70c('0x2c')]!==_0xf70c('0x3c')){var _0x368b0a={};_0x368b0a[_0x199c02[_0xf70c('0x28')]]={'$like':'%'+_0x55af5b[_0xf70c('0x31')][_0xf70c('0x39')]+'%'};return _0x368b0a;}})});}_0x3503bd=_[_0xf70c('0x3b')]({},_0x3503bd,_0x55af5b['options']);var _0x48418e={'where':_0x3503bd[_0xf70c('0x3a')]};return db[_0xf70c('0x29')][_0xf70c('0x1f')](_0x48418e)['then'](function(_0x47d77a){_0x40e42f['count']=_0x47d77a;if(_0x55af5b[_0xf70c('0x31')][_0xf70c('0x3d')]){_0x3503bd[_0xf70c('0x3e')]=[{'all':!![]}];}return db[_0xf70c('0x29')]['findAll'](_0x3503bd);})[_0xf70c('0x26')](function(_0xfc76c6){_0x40e42f[_0xf70c('0x3f')]=_0xfc76c6;return _0x40e42f;})[_0xf70c('0x26')](respondWithFilteredResult(_0x33cd4a,_0x3503bd))[_0xf70c('0x40')](handleError(_0x33cd4a,null));};exports['show']=function(_0x1477f0,_0x4f55bc){var _0x396f5d={'raw':![],'where':{'id':_0x1477f0[_0xf70c('0x41')]['id']}},_0x1cdc7f={};_0x1cdc7f['model']=_[_0xf70c('0x30')](db['IntegrationReport'][_0xf70c('0x2a')]);_0x1cdc7f['query']=_[_0xf70c('0x30')](_0x1477f0[_0xf70c('0x31')]);_0x1cdc7f[_0xf70c('0x32')]=_['intersection'](_0x1cdc7f[_0xf70c('0x2e')],_0x1cdc7f['query']);_0x396f5d[_0xf70c('0x33')]=_[_0xf70c('0x42')](_0x1cdc7f[_0xf70c('0x2e')],qs['fields'](_0x1477f0[_0xf70c('0x31')][_0xf70c('0x34')]));_0x396f5d[_0xf70c('0x33')]=_0x396f5d[_0xf70c('0x33')]['length']?_0x396f5d['attributes']:_0x1cdc7f['model'];if(_0x1477f0[_0xf70c('0x31')]['includeAll']){_0x396f5d['include']=[{'all':!![]}];}_0x396f5d=_[_0xf70c('0x3b')]({},_0x396f5d,_0x1477f0[_0xf70c('0x43')]);return db[_0xf70c('0x29')][_0xf70c('0x44')](_0x396f5d)[_0xf70c('0x26')](handleEntityNotFound(_0x4f55bc,null))[_0xf70c('0x26')](respondWithResult(_0x4f55bc,null))['catch'](handleError(_0x4f55bc,null));};exports[_0xf70c('0x45')]=function(_0x5eea1a,_0x46f414){return db[_0xf70c('0x29')]['create'](_0x5eea1a['body'],{})[_0xf70c('0x26')](respondWithResult(_0x46f414,0xc9))[_0xf70c('0x40')](handleError(_0x46f414,null));};exports[_0xf70c('0x46')]=function(_0xf60f49,_0x5cbb63){if(_0xf60f49[_0xf70c('0x47')]['id']){delete _0xf60f49[_0xf70c('0x47')]['id'];}return db[_0xf70c('0x29')][_0xf70c('0x44')]({'where':{'id':_0xf60f49[_0xf70c('0x41')]['id']}})[_0xf70c('0x26')](handleEntityNotFound(_0x5cbb63,null))[_0xf70c('0x26')](saveUpdates(_0xf60f49['body'],null))[_0xf70c('0x26')](respondWithResult(_0x5cbb63,null))[_0xf70c('0x40')](handleError(_0x5cbb63,null));};exports['destroy']=function(_0x4ba9ec,_0x520081){return db[_0xf70c('0x29')][_0xf70c('0x44')]({'where':{'id':_0x4ba9ec[_0xf70c('0x41')]['id']}})['then'](handleEntityNotFound(_0x520081,null))[_0xf70c('0x26')](removeEntity(_0x520081,null))[_0xf70c('0x40')](handleError(_0x520081,null));};exports['describe']=function(_0x15b60a,_0x44d7be){return db['IntegrationReport'][_0xf70c('0x48')]()[_0xf70c('0x26')](respondWithResult(_0x44d7be,null))[_0xf70c('0x40')](handleError(_0x44d7be,null));}; \ No newline at end of file +var _0x8ef1=['nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','error','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x2965ea,_0x4778ec){var _0x44d7aa=function(_0x53b946){while(--_0x53b946){_0x2965ea['push'](_0x2965ea['shift']());}};_0x44d7aa(++_0x4778ec);}(_0x8ef1,0x1cf));var _0x18ef=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x8ef1[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0x18ef('0x0'));var rimraf=require(_0x18ef('0x1'));var zipdir=require(_0x18ef('0x2'));var jsonpatch=require(_0x18ef('0x3'));var rp=require(_0x18ef('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x18ef('0x5'));var util=require(_0x18ef('0x6'));var path=require(_0x18ef('0x7'));var sox=require(_0x18ef('0x8'));var csv=require(_0x18ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18ef('0xa'));var _=require(_0x18ef('0xb'));var squel=require(_0x18ef('0xc'));var crypto=require(_0x18ef('0xd'));var jsforce=require(_0x18ef('0xe'));var deskjs=require(_0x18ef('0xf'));var toCsv=require(_0x18ef('0x9'));var querystring=require(_0x18ef('0x10'));var Papa=require(_0x18ef('0x11'));var Redis=require(_0x18ef('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x18ef('0x13'));var as=require(_0x18ef('0x14'));var hardwareService=require(_0x18ef('0x15'));var logger=require('../../config/logger')(_0x18ef('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x18ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a740e,_0x575a3e){_0x575a3e=_0x575a3e||0xcc;return function(_0x30e8d8){if(_0x30e8d8){return _0x3a740e[_0x18ef('0x18')](_0x575a3e);}return _0x3a740e[_0x18ef('0x19')](_0x575a3e)[_0x18ef('0x1a')]();};}function respondWithResult(_0x3966f5,_0x311cc8){_0x311cc8=_0x311cc8||0xc8;return function(_0x1e115f){if(_0x1e115f){return _0x3966f5['status'](_0x311cc8)[_0x18ef('0x1b')](_0x1e115f);}};}function respondWithFilteredResult(_0x4c2cff,_0x69ed71){return function(_0x54fbe2){if(_0x54fbe2){var _0x1ce67e=typeof _0x69ed71['offset']===_0x18ef('0x1c')&&typeof _0x69ed71[_0x18ef('0x1d')]==='undefined';var _0x20a35d=_0x54fbe2[_0x18ef('0x1e')];var _0x2930e5=_0x1ce67e?0x0:_0x69ed71[_0x18ef('0x1f')];var _0x304f13=_0x1ce67e?_0x54fbe2[_0x18ef('0x1e')]:_0x69ed71[_0x18ef('0x1f')]+_0x69ed71[_0x18ef('0x1d')];var _0x5e3515;if(_0x304f13>=_0x20a35d){_0x304f13=_0x20a35d;_0x5e3515=0xc8;}else{_0x5e3515=0xce;}_0x4c2cff[_0x18ef('0x19')](_0x5e3515);return _0x4c2cff[_0x18ef('0x20')]('Content-Range',_0x2930e5+'-'+_0x304f13+'/'+_0x20a35d)[_0x18ef('0x1b')](_0x54fbe2);}return null;};}function patchUpdates(_0x2a2b58){return function(_0xe559b8){try{jsonpatch['apply'](_0xe559b8,_0x2a2b58,!![]);}catch(_0x2df7c0){return BPromise[_0x18ef('0x21')](_0x2df7c0);}return _0xe559b8[_0x18ef('0x22')]();};}function saveUpdates(_0x26075,_0x5e3cb0){return function(_0x48a108){if(_0x48a108){return _0x48a108[_0x18ef('0x23')](_0x26075)[_0x18ef('0x24')](function(_0x216f46){return _0x216f46;});}return null;};}function removeEntity(_0xae40bd,_0x354547){return function(_0x4937a1){if(_0x4937a1){return _0x4937a1[_0x18ef('0x25')]()[_0x18ef('0x24')](function(){_0xae40bd[_0x18ef('0x19')](0xcc)[_0x18ef('0x1a')]();});}};}function handleEntityNotFound(_0xeca40b,_0x463833){return function(_0x3c326d){if(!_0x3c326d){_0xeca40b[_0x18ef('0x18')](0x194);}return _0x3c326d;};}function handleError(_0x457abb,_0x57efe9){_0x57efe9=_0x57efe9||0x1f4;return function(_0x100a31){logger[_0x18ef('0x26')](_0x100a31['stack']);if(_0x100a31[_0x18ef('0x27')]){delete _0x100a31[_0x18ef('0x27')];}_0x457abb[_0x18ef('0x19')](_0x57efe9)[_0x18ef('0x28')](_0x100a31);};}exports['index']=function(_0x1e5b2a,_0x77bf47){var _0x55f9c0={},_0x43facb={},_0x40ebdc={'count':0x0,'rows':[]};var _0x494e63=_[_0x18ef('0x29')](db[_0x18ef('0x2a')][_0x18ef('0x2b')],function(_0x10330b){return{'name':_0x10330b[_0x18ef('0x2c')],'type':_0x10330b[_0x18ef('0x2d')][_0x18ef('0x2e')]};});_0x43facb[_0x18ef('0x2f')]=_['map'](_0x494e63,_0x18ef('0x27'));_0x43facb['query']=_[_0x18ef('0x30')](_0x1e5b2a[_0x18ef('0x31')]);_0x43facb['filters']=_['intersection'](_0x43facb[_0x18ef('0x2f')],_0x43facb[_0x18ef('0x31')]);_0x55f9c0[_0x18ef('0x32')]=_[_0x18ef('0x33')](_0x43facb['model'],qs[_0x18ef('0x34')](_0x1e5b2a[_0x18ef('0x31')]['fields']));_0x55f9c0[_0x18ef('0x32')]=_0x55f9c0[_0x18ef('0x32')][_0x18ef('0x35')]?_0x55f9c0[_0x18ef('0x32')]:_0x43facb[_0x18ef('0x2f')];if(!_0x1e5b2a[_0x18ef('0x31')][_0x18ef('0x36')](_0x18ef('0x37'))){_0x55f9c0[_0x18ef('0x1d')]=qs[_0x18ef('0x1d')](_0x1e5b2a[_0x18ef('0x31')][_0x18ef('0x1d')]);_0x55f9c0[_0x18ef('0x1f')]=qs[_0x18ef('0x1f')](_0x1e5b2a[_0x18ef('0x31')][_0x18ef('0x1f')]);}_0x55f9c0[_0x18ef('0x38')]=qs[_0x18ef('0x39')](_0x1e5b2a[_0x18ef('0x31')]['sort']);_0x55f9c0['where']=qs[_0x18ef('0x3a')](_[_0x18ef('0x3b')](_0x1e5b2a[_0x18ef('0x31')],_0x43facb[_0x18ef('0x3a')]),_0x494e63);if(_0x1e5b2a['query'][_0x18ef('0x3c')]){_0x55f9c0[_0x18ef('0x3d')]=_['merge'](_0x55f9c0[_0x18ef('0x3d')],{'$or':_[_0x18ef('0x29')](_0x494e63,function(_0x42dcdd){if(_0x42dcdd[_0x18ef('0x2d')]!==_0x18ef('0x3e')){var _0x291689={};_0x291689[_0x42dcdd[_0x18ef('0x27')]]={'$like':'%'+_0x1e5b2a['query']['filter']+'%'};return _0x291689;}})});}_0x55f9c0=_['merge']({},_0x55f9c0,_0x1e5b2a[_0x18ef('0x3f')]);var _0x27c9af={'where':_0x55f9c0['where']};return db['IntegrationReport'][_0x18ef('0x1e')](_0x27c9af)['then'](function(_0x56e048){_0x40ebdc[_0x18ef('0x1e')]=_0x56e048;if(_0x1e5b2a[_0x18ef('0x31')][_0x18ef('0x40')]){_0x55f9c0[_0x18ef('0x41')]=[{'all':!![]}];}return db[_0x18ef('0x2a')][_0x18ef('0x42')](_0x55f9c0);})[_0x18ef('0x24')](function(_0xb7d96e){_0x40ebdc[_0x18ef('0x43')]=_0xb7d96e;return _0x40ebdc;})[_0x18ef('0x24')](respondWithFilteredResult(_0x77bf47,_0x55f9c0))[_0x18ef('0x44')](handleError(_0x77bf47,null));};exports['show']=function(_0x422319,_0x12337c){var _0x318836={'raw':![],'where':{'id':_0x422319['params']['id']}},_0xbb6ab6={};_0xbb6ab6['model']=_[_0x18ef('0x30')](db['IntegrationReport'][_0x18ef('0x2b')]);_0xbb6ab6[_0x18ef('0x31')]=_['keys'](_0x422319[_0x18ef('0x31')]);_0xbb6ab6[_0x18ef('0x3a')]=_['intersection'](_0xbb6ab6['model'],_0xbb6ab6['query']);_0x318836[_0x18ef('0x32')]=_['intersection'](_0xbb6ab6[_0x18ef('0x2f')],qs['fields'](_0x422319[_0x18ef('0x31')][_0x18ef('0x34')]));_0x318836['attributes']=_0x318836[_0x18ef('0x32')][_0x18ef('0x35')]?_0x318836[_0x18ef('0x32')]:_0xbb6ab6[_0x18ef('0x2f')];if(_0x422319[_0x18ef('0x31')][_0x18ef('0x40')]){_0x318836[_0x18ef('0x41')]=[{'all':!![]}];}_0x318836=_['merge']({},_0x318836,_0x422319[_0x18ef('0x3f')]);return db['IntegrationReport']['find'](_0x318836)['then'](handleEntityNotFound(_0x12337c,null))['then'](respondWithResult(_0x12337c,null))[_0x18ef('0x44')](handleError(_0x12337c,null));};exports[_0x18ef('0x45')]=function(_0x518753,_0x2718ea){return db[_0x18ef('0x2a')][_0x18ef('0x45')](_0x518753[_0x18ef('0x46')],{})[_0x18ef('0x24')](respondWithResult(_0x2718ea,0xc9))[_0x18ef('0x44')](handleError(_0x2718ea,null));};exports[_0x18ef('0x23')]=function(_0x29411e,_0x221ce2){if(_0x29411e[_0x18ef('0x46')]['id']){delete _0x29411e[_0x18ef('0x46')]['id'];}return db[_0x18ef('0x2a')][_0x18ef('0x47')]({'where':{'id':_0x29411e['params']['id']}})['then'](handleEntityNotFound(_0x221ce2,null))['then'](saveUpdates(_0x29411e['body'],null))['then'](respondWithResult(_0x221ce2,null))[_0x18ef('0x44')](handleError(_0x221ce2,null));};exports[_0x18ef('0x25')]=function(_0x3c8eac,_0x366590){return db[_0x18ef('0x2a')][_0x18ef('0x47')]({'where':{'id':_0x3c8eac[_0x18ef('0x48')]['id']}})[_0x18ef('0x24')](handleEntityNotFound(_0x366590,null))[_0x18ef('0x24')](removeEntity(_0x366590,null))[_0x18ef('0x44')](handleError(_0x366590,null));};exports[_0x18ef('0x49')]=function(_0xa7d0ec,_0xc05318){return db[_0x18ef('0x2a')]['describe']()[_0x18ef('0x24')](respondWithResult(_0xc05318,null))[_0x18ef('0x44')](handleError(_0xc05318,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 10ba8a0..1ec9d77 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 _0xaacb=['path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3fb903,_0x31fdea){var _0x3fbb09=function(_0x560e25){while(--_0x560e25){_0x3fb903['push'](_0x3fb903['shift']());}};_0x3fbb09(++_0x31fdea);}(_0xaacb,0x149));var _0xbaac=function(_0x515099,_0x46bdbd){_0x515099=_0x515099-0x0;var _0x26e0a7=_0xaacb[_0x515099];return _0x26e0a7;};'use strict';var _=require(_0xbaac('0x0'));var util=require(_0xbaac('0x1'));var logger=require(_0xbaac('0x2'))(_0xbaac('0x3'));var moment=require(_0xbaac('0x4'));var BPromise=require(_0xbaac('0x5'));var rp=require(_0xbaac('0x6'));var fs=require('fs');var path=require(_0xbaac('0x7'));var rimraf=require(_0xbaac('0x8'));var config=require(_0xbaac('0x9'));var attributes=require(_0xbaac('0xa'));module[_0xbaac('0xb')]=function(_0x2cbfa4,_0x50678c){return _0x2cbfa4[_0xbaac('0xc')](_0xbaac('0xd'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00a5=['rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','moment','request-promise'];(function(_0x2defc4,_0x25dbea){var _0x10e80a=function(_0x2c13c1){while(--_0x2c13c1){_0x2defc4['push'](_0x2defc4['shift']());}};_0x10e80a(++_0x25dbea);}(_0x00a5,0xde));var _0x500a=function(_0xe5a89c,_0x3e9a55){_0xe5a89c=_0xe5a89c-0x0;var _0xcf382c=_0x00a5[_0xe5a89c];return _0xcf382c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x500a('0x0'));var BPromise=require('bluebird');var rp=require(_0x500a('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x500a('0x2'));var config=require(_0x500a('0x3'));var attributes=require(_0x500a('0x4'));module[_0x500a('0x5')]=function(_0x3cb4c4,_0x11bc64){return _0x3cb4c4[_0x500a('0x6')](_0x500a('0x7'),attributes,{'tableName':'report_integration','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 334ffd4..666df9c 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x58f3e1,_0x11d328){var _0x5742c7=function(_0x5f0193){while(--_0x5f0193){_0x58f3e1['push'](_0x58f3e1['shift']());}};_0x5742c7(++_0x11d328);}(_0xabce,0x103));var _0xeabc=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xabce[_0x31cb5f];return _0x586042;};'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')]('IntegrationReport,\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 _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5f2f8b,_0x150198){var _0x543754=function(_0x347efe){while(--_0x347efe){_0x5f2f8b['push'](_0x5f2f8b['shift']());}};_0x543754(++_0x150198);}(_0x57ca,0x108));var _0xa57c=function(_0x19e7b8,_0x491053){_0x19e7b8=_0x19e7b8-0x0;var _0x88c7bd=_0x57ca[_0x19e7b8];return _0x88c7bd;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1620c99..a0a84e4 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 _0xddd2=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','create'];(function(_0x4c32f5,_0x3dbbf1){var _0x19cae9=function(_0x3c77cd){while(--_0x3c77cd){_0x4c32f5['push'](_0x4c32f5['shift']());}};_0x19cae9(++_0x3dbbf1);}(_0xddd2,0x1e2));var _0x2ddd=function(_0x60305c,_0x229fb0){_0x60305c=_0x60305c-0x0;var _0x279236=_0xddd2[_0x60305c];return _0x279236;};'use strict';var multer=require(_0x2ddd('0x0'));var util=require('util');var path=require(_0x2ddd('0x1'));var timeout=require('connect-timeout');var express=require(_0x2ddd('0x2'));var router=express[_0x2ddd('0x3')]();var fs_extra=require(_0x2ddd('0x4'));var auth=require(_0x2ddd('0x5'));var interaction=require(_0x2ddd('0x6'));var config=require(_0x2ddd('0x7'));var controller=require(_0x2ddd('0x8'));router['get']('/',auth[_0x2ddd('0x9')](),controller[_0x2ddd('0xa')]);router[_0x2ddd('0xb')](_0x2ddd('0xc'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0xd')]);router['get'](_0x2ddd('0xe'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0xf')]);router[_0x2ddd('0x10')]('/',auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x11')]);router[_0x2ddd('0x10')](_0x2ddd('0xe'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x12')]);router['post'](_0x2ddd('0x13'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x14')]);router[_0x2ddd('0x15')](_0x2ddd('0xc'),auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x16')]);router[_0x2ddd('0x17')]('/:id',auth[_0x2ddd('0x9')](),controller[_0x2ddd('0x18')]);module['exports']=router; \ No newline at end of file +var _0x77f7=['get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','create','addInterval','addIntervals','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x77f7,0xbd));var _0x777f=function(_0x35e5b6,_0xf44d9){_0x35e5b6=_0x35e5b6-0x0;var _0x21a128=_0x77f7[_0x35e5b6];return _0x21a128;};'use strict';var multer=require(_0x777f('0x0'));var util=require(_0x777f('0x1'));var path=require(_0x777f('0x2'));var timeout=require(_0x777f('0x3'));var express=require(_0x777f('0x4'));var router=express[_0x777f('0x5')]();var fs_extra=require(_0x777f('0x6'));var auth=require(_0x777f('0x7'));var interaction=require(_0x777f('0x8'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x777f('0x9')]('/',auth[_0x777f('0xa')](),controller[_0x777f('0xb')]);router[_0x777f('0x9')](_0x777f('0xc'),auth[_0x777f('0xa')](),controller[_0x777f('0xd')]);router[_0x777f('0x9')](_0x777f('0xe'),auth[_0x777f('0xa')](),controller['getIntervals']);router[_0x777f('0xf')]('/',auth['isAuthenticated'](),controller[_0x777f('0x10')]);router[_0x777f('0xf')]('/:id/sub_intervals',auth[_0x777f('0xa')](),controller[_0x777f('0x11')]);router[_0x777f('0xf')]('/:id/sub_intervals/create_many',auth[_0x777f('0xa')](),controller[_0x777f('0x12')]);router[_0x777f('0x13')](_0x777f('0xc'),auth[_0x777f('0xa')](),controller[_0x777f('0x14')]);router['delete'](_0x777f('0xc'),auth[_0x777f('0xa')](),controller['destroy']);module[_0x777f('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 8acf34b..c34f362 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 _0xba72=['STRING','sequelize'];(function(_0x1f181f,_0x186d06){var _0xf11b8c=function(_0xbfde95){while(--_0xbfde95){_0x1f181f['push'](_0x1f181f['shift']());}};_0xf11b8c(++_0x186d06);}(_0xba72,0x1a9));var _0x2ba7=function(_0x533381,_0x8a69fa){_0x533381=_0x533381-0x0;var _0x2877ed=_0xba72[_0x533381];return _0x2877ed;};'use strict';var Sequelize=require(_0x2ba7('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2ba7('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x58a7=['STRING','exports'];(function(_0x43f0c6,_0x4b0dae){var _0x3f4ce6=function(_0x403257){while(--_0x403257){_0x43f0c6['push'](_0x43f0c6['shift']());}};_0x3f4ce6(++_0x4b0dae);}(_0x58a7,0x18f));var _0x758a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x58a7[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x758a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x758a('0x1')]},'interval':{'type':Sequelize[_0x758a('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 96ed94d..ed71c6e 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 _0xfcf6=['addIntervals','findOne','transaction','IntervalId','bulkCreate','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','then','sendStatus','error','stack','send','index','map','Interval','rawAttributes','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals'];(function(_0x23a061,_0x503206){var _0x1371bd=function(_0x3c8b13){while(--_0x3c8b13){_0x23a061['push'](_0x23a061['shift']());}};_0x1371bd(++_0x503206);}(_0xfcf6,0x1bd));var _0x6fcf=function(_0x163db1,_0x1bd35a){_0x163db1=_0x163db1-0x0;var _0x5b105e=_0xfcf6[_0x163db1];return _0x5b105e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6fcf('0x0'));var zipdir=require(_0x6fcf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fcf('0x2'));var moment=require('moment');var BPromise=require(_0x6fcf('0x3'));var Mustache=require(_0x6fcf('0x4'));var util=require(_0x6fcf('0x5'));var path=require(_0x6fcf('0x6'));var sox=require(_0x6fcf('0x7'));var csv=require(_0x6fcf('0x8'));var ejs=require(_0x6fcf('0x9'));var fs=require('fs');var fs_extra=require(_0x6fcf('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6fcf('0xb'));var jsforce=require(_0x6fcf('0xc'));var deskjs=require(_0x6fcf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6fcf('0xe'));var Papa=require(_0x6fcf('0xf'));var Redis=require('ioredis');var authService=require(_0x6fcf('0x10'));var qs=require(_0x6fcf('0x11'));var as=require(_0x6fcf('0x12'));var hardwareService=require(_0x6fcf('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6fcf('0x14'));var licenseUtil=require(_0x6fcf('0x15'));var db=require(_0x6fcf('0x16'))['db'];var extensions=require(_0x6fcf('0x17'));function respondWithStatusCode(_0x4e06df,_0x3513ae){_0x3513ae=_0x3513ae||0xcc;return function(_0x200c0b){if(_0x200c0b){return _0x4e06df['sendStatus'](_0x3513ae);}return _0x4e06df[_0x6fcf('0x18')](_0x3513ae)[_0x6fcf('0x19')]();};}function respondWithResult(_0x265698,_0x30ec76){_0x30ec76=_0x30ec76||0xc8;return function(_0x2597ec){if(_0x2597ec){return _0x265698[_0x6fcf('0x18')](_0x30ec76)[_0x6fcf('0x1a')](_0x2597ec);}};}function respondWithFilteredResult(_0x38a2f8,_0x1cab4d){return function(_0x45bcb2){if(_0x45bcb2){var _0x580bdc=typeof _0x1cab4d['offset']==='undefined'&&typeof _0x1cab4d['limit']==='undefined';var _0xd43057=_0x45bcb2[_0x6fcf('0x1b')];var _0x40d356=_0x580bdc?0x0:_0x1cab4d['offset'];var _0x1ec427=_0x580bdc?_0x45bcb2[_0x6fcf('0x1b')]:_0x1cab4d[_0x6fcf('0x1c')]+_0x1cab4d[_0x6fcf('0x1d')];var _0x484a9b;if(_0x1ec427>=_0xd43057){_0x1ec427=_0xd43057;_0x484a9b=0xc8;}else{_0x484a9b=0xce;}_0x38a2f8[_0x6fcf('0x18')](_0x484a9b);return _0x38a2f8[_0x6fcf('0x1e')](_0x6fcf('0x1f'),_0x40d356+'-'+_0x1ec427+'/'+_0xd43057)[_0x6fcf('0x1a')](_0x45bcb2);}return null;};}function patchUpdates(_0x18c823){return function(_0x423e3a){try{jsonpatch[_0x6fcf('0x20')](_0x423e3a,_0x18c823,!![]);}catch(_0x17f1e3){return BPromise[_0x6fcf('0x21')](_0x17f1e3);}return _0x423e3a[_0x6fcf('0x22')]();};}function saveUpdates(_0xc650e8,_0x1ec4b5){return function(_0x49a91b){if(_0x49a91b){return _0x49a91b['update'](_0xc650e8)['then'](function(_0x12dc0a){return _0x12dc0a;});}return null;};}function removeEntity(_0x2a0749,_0x1d50e4){return function(_0xe4e204){if(_0xe4e204){return _0xe4e204[_0x6fcf('0x23')]()['then'](function(){var _0x35f80b=_0xe4e204[_0x6fcf('0x24')]({'plain':!![]});var _0x463be0='Intervals';return db[_0x6fcf('0x25')][_0x6fcf('0x23')]({'where':{'type':_0x463be0,'resourceId':_0x35f80b['id']}})['then'](function(){return _0xe4e204;});})[_0x6fcf('0x26')](function(){_0x2a0749[_0x6fcf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b9dbe,_0x5b1761){return function(_0x53e3ff){if(!_0x53e3ff){_0x3b9dbe[_0x6fcf('0x27')](0x194);}return _0x53e3ff;};}function handleError(_0x2fd23a,_0x33fdda){_0x33fdda=_0x33fdda||0x1f4;return function(_0x36f52f){logger[_0x6fcf('0x28')](_0x36f52f[_0x6fcf('0x29')]);if(_0x36f52f['name']){delete _0x36f52f['name'];}_0x2fd23a[_0x6fcf('0x18')](_0x33fdda)[_0x6fcf('0x2a')](_0x36f52f);};}exports[_0x6fcf('0x2b')]=function(_0x4a4297,_0x3ad87c){var _0x145cc4={},_0x31fa12={},_0x3e6ef6={'count':0x0,'rows':[]};var _0x1a4155=_[_0x6fcf('0x2c')](db[_0x6fcf('0x2d')][_0x6fcf('0x2e')],function(_0x123b57){return{'name':_0x123b57['fieldName'],'type':_0x123b57[_0x6fcf('0x2f')][_0x6fcf('0x30')]};});_0x31fa12[_0x6fcf('0x31')]=_[_0x6fcf('0x2c')](_0x1a4155,_0x6fcf('0x32'));_0x31fa12[_0x6fcf('0x33')]=_[_0x6fcf('0x34')](_0x4a4297[_0x6fcf('0x33')]);_0x31fa12[_0x6fcf('0x35')]=_['intersection'](_0x31fa12[_0x6fcf('0x31')],_0x31fa12[_0x6fcf('0x33')]);_0x145cc4[_0x6fcf('0x36')]=_[_0x6fcf('0x37')](_0x31fa12['model'],qs[_0x6fcf('0x38')](_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x38')]));_0x145cc4['attributes']=_0x145cc4[_0x6fcf('0x36')][_0x6fcf('0x39')]?_0x145cc4[_0x6fcf('0x36')]:_0x31fa12[_0x6fcf('0x31')];if(!_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x3a')](_0x6fcf('0x3b'))){_0x145cc4[_0x6fcf('0x1d')]=qs['limit'](_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x1d')]);_0x145cc4[_0x6fcf('0x1c')]=qs['offset'](_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x1c')]);}_0x145cc4['order']=qs[_0x6fcf('0x3c')](_0x4a4297['query'][_0x6fcf('0x3c')]);_0x145cc4[_0x6fcf('0x3d')]=qs[_0x6fcf('0x35')](_[_0x6fcf('0x3e')](_0x4a4297['query'],_0x31fa12[_0x6fcf('0x35')]),_0x1a4155);if(_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x3f')]){_0x145cc4['where']=_[_0x6fcf('0x40')](_0x145cc4['where'],{'$or':_['map'](_0x1a4155,function(_0x1e2780){if(_0x1e2780['type']!==_0x6fcf('0x41')){var _0x23c0b2={};_0x23c0b2[_0x1e2780['name']]={'$like':'%'+_0x4a4297[_0x6fcf('0x33')][_0x6fcf('0x3f')]+'%'};return _0x23c0b2;}})});}_0x145cc4=_[_0x6fcf('0x40')]({},_0x145cc4,_0x4a4297[_0x6fcf('0x42')]);var _0x5be435={'where':_0x145cc4['where']};return db[_0x6fcf('0x2d')]['count'](_0x5be435)['then'](function(_0x15e1fb){_0x3e6ef6[_0x6fcf('0x1b')]=_0x15e1fb;if(_0x4a4297[_0x6fcf('0x33')]['includeAll']){_0x145cc4[_0x6fcf('0x43')]=[{'all':!![]}];}return db['Interval'][_0x6fcf('0x44')](_0x145cc4);})[_0x6fcf('0x26')](function(_0x4af3b1){_0x3e6ef6['rows']=_0x4af3b1;return _0x3e6ef6;})[_0x6fcf('0x26')](respondWithFilteredResult(_0x3ad87c,_0x145cc4))[_0x6fcf('0x45')](handleError(_0x3ad87c,null));};exports[_0x6fcf('0x46')]=function(_0x433583,_0x196eb0){var _0x3b3bc7={'raw':!![],'where':{'id':_0x433583[_0x6fcf('0x47')]['id']}},_0x21f7e1={};_0x21f7e1[_0x6fcf('0x31')]=_[_0x6fcf('0x34')](db[_0x6fcf('0x2d')]['rawAttributes']);_0x21f7e1['query']=_[_0x6fcf('0x34')](_0x433583[_0x6fcf('0x33')]);_0x21f7e1['filters']=_[_0x6fcf('0x37')](_0x21f7e1[_0x6fcf('0x31')],_0x21f7e1[_0x6fcf('0x33')]);_0x3b3bc7[_0x6fcf('0x36')]=_[_0x6fcf('0x37')](_0x21f7e1[_0x6fcf('0x31')],qs[_0x6fcf('0x38')](_0x433583[_0x6fcf('0x33')][_0x6fcf('0x38')]));_0x3b3bc7[_0x6fcf('0x36')]=_0x3b3bc7[_0x6fcf('0x36')][_0x6fcf('0x39')]?_0x3b3bc7['attributes']:_0x21f7e1['model'];if(_0x433583[_0x6fcf('0x33')][_0x6fcf('0x48')]){_0x3b3bc7[_0x6fcf('0x43')]=[{'all':!![]}];}_0x3b3bc7=_[_0x6fcf('0x40')]({},_0x3b3bc7,_0x433583[_0x6fcf('0x42')]);return db[_0x6fcf('0x2d')][_0x6fcf('0x49')](_0x3b3bc7)[_0x6fcf('0x26')](handleEntityNotFound(_0x196eb0,null))[_0x6fcf('0x26')](respondWithResult(_0x196eb0,null))[_0x6fcf('0x45')](handleError(_0x196eb0,null));};exports[_0x6fcf('0x4a')]=function(_0x563c2d,_0x1e1d9b){return db[_0x6fcf('0x2d')][_0x6fcf('0x4a')](_0x563c2d[_0x6fcf('0x4b')],{})[_0x6fcf('0x26')](function(_0x42c778){var _0x1a5a76=_0x563c2d['user'][_0x6fcf('0x24')]({'plain':!![]});if(!_0x1a5a76)throw new Error(_0x6fcf('0x4c'));if(_0x1a5a76[_0x6fcf('0x4d')]===_0x6fcf('0x4e')){var _0x404a71=_0x42c778[_0x6fcf('0x24')]({'plain':!![]});var _0x3f06ff='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x3f06ff,'userProfileId':_0x1a5a76['userProfileId']},'raw':!![]})[_0x6fcf('0x26')](function(_0xeba3b6){if(_0xeba3b6&&_0xeba3b6[_0x6fcf('0x4f')]===0x0){return db[_0x6fcf('0x25')][_0x6fcf('0x4a')]({'name':_0x404a71[_0x6fcf('0x32')],'resourceId':_0x404a71['id'],'type':_0xeba3b6['name'],'sectionId':_0xeba3b6['id']},{})[_0x6fcf('0x26')](function(){return _0x42c778;});}else{return _0x42c778;}})[_0x6fcf('0x45')](function(_0x769821){logger[_0x6fcf('0x28')](_0x6fcf('0x50'),_0x769821);throw _0x769821;});}return _0x42c778;})[_0x6fcf('0x26')](respondWithResult(_0x1e1d9b,0xc9))[_0x6fcf('0x45')](handleError(_0x1e1d9b,null));};exports['update']=function(_0x2284af,_0x54d6c7){if(_0x2284af[_0x6fcf('0x4b')]['id']){delete _0x2284af[_0x6fcf('0x4b')]['id'];}return db[_0x6fcf('0x2d')][_0x6fcf('0x49')]({'where':{'id':_0x2284af[_0x6fcf('0x47')]['id']}})['then'](handleEntityNotFound(_0x54d6c7,null))['then'](saveUpdates(_0x2284af[_0x6fcf('0x4b')],null))[_0x6fcf('0x26')](respondWithResult(_0x54d6c7,null))['catch'](handleError(_0x54d6c7,null));};exports[_0x6fcf('0x23')]=function(_0x341493,_0x25f550){return db[_0x6fcf('0x2d')]['find']({'where':{'id':_0x341493[_0x6fcf('0x47')]['id']}})[_0x6fcf('0x26')](handleEntityNotFound(_0x25f550,null))[_0x6fcf('0x26')](removeEntity(_0x25f550,null))['catch'](handleError(_0x25f550,null));};exports[_0x6fcf('0x51')]=function(_0x3e7f27,_0x479cbd,_0x538882){if(_0x3e7f27[_0x6fcf('0x4b')]['id']){delete _0x3e7f27[_0x6fcf('0x4b')]['id'];}return db[_0x6fcf('0x2d')]['find']({'where':{'id':_0x3e7f27['params']['id']}})[_0x6fcf('0x26')](handleEntityNotFound(_0x479cbd,null))['then'](function(_0x49e305){if(_0x49e305){_0x3e7f27[_0x6fcf('0x4b')]['IntervalId']=_0x49e305['id'];return db[_0x6fcf('0x2d')][_0x6fcf('0x4a')](_0x3e7f27[_0x6fcf('0x4b')]);}})[_0x6fcf('0x26')](respondWithResult(_0x479cbd,null))['catch'](handleError(_0x479cbd,null));};exports['getIntervals']=function(_0x5d610b,_0x53c5de,_0x580c50){var _0x1eee21={};var _0x44386a={};var _0xe7e4cd;var _0x5dd282;return db[_0x6fcf('0x2d')]['findOne']({'where':{'id':_0x5d610b['params']['id']}})[_0x6fcf('0x26')](handleEntityNotFound(_0x53c5de,null))[_0x6fcf('0x26')](function(_0x44d0e6){if(_0x44d0e6){_0xe7e4cd=_0x44d0e6;_0x44386a['model']=_['keys'](db[_0x6fcf('0x2d')][_0x6fcf('0x2e')]);_0x44386a[_0x6fcf('0x33')]=_['keys'](_0x5d610b[_0x6fcf('0x33')]);_0x44386a[_0x6fcf('0x35')]=_['intersection'](_0x44386a[_0x6fcf('0x31')],_0x44386a['query']);_0x1eee21[_0x6fcf('0x36')]=_[_0x6fcf('0x37')](_0x44386a['model'],qs[_0x6fcf('0x38')](_0x5d610b['query'][_0x6fcf('0x38')]));_0x1eee21[_0x6fcf('0x36')]=_0x1eee21[_0x6fcf('0x36')][_0x6fcf('0x39')]?_0x1eee21['attributes']:_0x44386a[_0x6fcf('0x31')];_0x1eee21['order']=qs['sort'](_0x5d610b['query'][_0x6fcf('0x3c')]);_0x1eee21[_0x6fcf('0x3d')]=qs[_0x6fcf('0x35')](_['pick'](_0x5d610b['query'],_0x44386a[_0x6fcf('0x35')]));if(_0x5d610b[_0x6fcf('0x33')][_0x6fcf('0x3f')]){_0x1eee21[_0x6fcf('0x3d')]=_[_0x6fcf('0x40')](_0x1eee21[_0x6fcf('0x3d')],{'$or':_[_0x6fcf('0x2c')](_0x1eee21[_0x6fcf('0x36')],function(_0xcba8c0){var _0x20389e={};_0x20389e[_0xcba8c0]={'$like':'%'+_0x5d610b[_0x6fcf('0x33')][_0x6fcf('0x3f')]+'%'};return _0x20389e;})});}_0x1eee21=_[_0x6fcf('0x40')]({},_0x1eee21,_0x5d610b[_0x6fcf('0x42')]);return _0xe7e4cd[_0x6fcf('0x52')](_0x1eee21);}})[_0x6fcf('0x26')](function(_0x42eccc){if(_0x42eccc){_0x5dd282=_0x42eccc['length'];if(!_0x5d610b[_0x6fcf('0x33')][_0x6fcf('0x3a')]('nolimit')){_0x1eee21[_0x6fcf('0x1d')]=qs['limit'](_0x5d610b['query'][_0x6fcf('0x1d')]);_0x1eee21[_0x6fcf('0x1c')]=qs['offset'](_0x5d610b[_0x6fcf('0x33')][_0x6fcf('0x1c')]);}return _0xe7e4cd[_0x6fcf('0x52')](_0x1eee21);}})[_0x6fcf('0x26')](function(_0x4d8d9a){if(_0x4d8d9a){return _0x4d8d9a?{'count':_0x5dd282,'rows':_0x4d8d9a}:null;}})['then'](respondWithResult(_0x53c5de,null))[_0x6fcf('0x45')](handleError(_0x53c5de,null));};exports[_0x6fcf('0x53')]=function(_0x3844ca,_0x4309bc,_0x571de2){return db[_0x6fcf('0x2d')][_0x6fcf('0x54')]({'where':{'id':_0x3844ca[_0x6fcf('0x47')]['id']}})[_0x6fcf('0x26')](handleEntityNotFound(_0x4309bc,null))[_0x6fcf('0x26')](function(_0x33681f){if(_0x33681f){return db['sequelize'][_0x6fcf('0x55')](function(_0x4fac17){return db[_0x6fcf('0x2d')][_0x6fcf('0x23')]({'where':{'IntervalId':_0x3844ca[_0x6fcf('0x47')]['id']},'transaction':_0x4fac17})[_0x6fcf('0x26')](function(_0x229c18){var _0x59eb27=_[_0x6fcf('0x2c')](_0x3844ca[_0x6fcf('0x4b')],function(_0x3df18a){delete _0x3df18a['id'];_0x3df18a[_0x6fcf('0x56')]=_0x3844ca[_0x6fcf('0x47')]['id'];return _0x3df18a;});return db[_0x6fcf('0x2d')][_0x6fcf('0x57')](_0x59eb27,{'transaction':_0x4fac17});});})[_0x6fcf('0x26')](function(){return db[_0x6fcf('0x2d')][_0x6fcf('0x44')]({'where':{'IntervalId':_0x3844ca[_0x6fcf('0x47')]['id']}});});}})['then'](respondWithResult(_0x4309bc,null))[_0x6fcf('0x45')](handleError(_0x4309bc,null));}; \ No newline at end of file +var _0xb788=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','get','Intervals','end','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','keys','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x55f7da,_0x186b0a){var _0x451c7f=function(_0x436a67){while(--_0x436a67){_0x55f7da['push'](_0x55f7da['shift']());}};_0x451c7f(++_0x186b0a);}(_0xb788,0x1d4));var _0x8b78=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xb788[_0x540133];return _0x26b6e9;};'use strict';var emlformat=require(_0x8b78('0x0'));var rimraf=require(_0x8b78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b78('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8b78('0x3'));var Mustache=require(_0x8b78('0x4'));var util=require(_0x8b78('0x5'));var path=require(_0x8b78('0x6'));var sox=require(_0x8b78('0x7'));var csv=require(_0x8b78('0x8'));var ejs=require(_0x8b78('0x9'));var fs=require('fs');var fs_extra=require(_0x8b78('0xa'));var _=require(_0x8b78('0xb'));var squel=require(_0x8b78('0xc'));var crypto=require(_0x8b78('0xd'));var jsforce=require(_0x8b78('0xe'));var deskjs=require(_0x8b78('0xf'));var toCsv=require(_0x8b78('0x8'));var querystring=require(_0x8b78('0x10'));var Papa=require(_0x8b78('0x11'));var Redis=require(_0x8b78('0x12'));var authService=require(_0x8b78('0x13'));var qs=require(_0x8b78('0x14'));var as=require(_0x8b78('0x15'));var hardwareService=require(_0x8b78('0x16'));var logger=require(_0x8b78('0x17'))(_0x8b78('0x18'));var utils=require(_0x8b78('0x19'));var config=require(_0x8b78('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b78('0x1b'))['db'];var extensions=require(_0x8b78('0x1c'));function respondWithStatusCode(_0x47af90,_0x658c08){_0x658c08=_0x658c08||0xcc;return function(_0x4bc545){if(_0x4bc545){return _0x47af90[_0x8b78('0x1d')](_0x658c08);}return _0x47af90[_0x8b78('0x1e')](_0x658c08)['end']();};}function respondWithResult(_0x587e5f,_0x2c7fdc){_0x2c7fdc=_0x2c7fdc||0xc8;return function(_0x52940c){if(_0x52940c){return _0x587e5f['status'](_0x2c7fdc)[_0x8b78('0x1f')](_0x52940c);}};}function respondWithFilteredResult(_0x213800,_0x48bbf5){return function(_0x1eaca4){if(_0x1eaca4){var _0x4bb437=typeof _0x48bbf5[_0x8b78('0x20')]==='undefined'&&typeof _0x48bbf5['limit']==='undefined';var _0x2e71f9=_0x1eaca4[_0x8b78('0x21')];var _0x25c6dd=_0x4bb437?0x0:_0x48bbf5[_0x8b78('0x20')];var _0x224f1f=_0x4bb437?_0x1eaca4[_0x8b78('0x21')]:_0x48bbf5['offset']+_0x48bbf5[_0x8b78('0x22')];var _0x1bd869;if(_0x224f1f>=_0x2e71f9){_0x224f1f=_0x2e71f9;_0x1bd869=0xc8;}else{_0x1bd869=0xce;}_0x213800[_0x8b78('0x1e')](_0x1bd869);return _0x213800[_0x8b78('0x23')](_0x8b78('0x24'),_0x25c6dd+'-'+_0x224f1f+'/'+_0x2e71f9)[_0x8b78('0x1f')](_0x1eaca4);}return null;};}function patchUpdates(_0x280f59){return function(_0x51ec01){try{jsonpatch[_0x8b78('0x25')](_0x51ec01,_0x280f59,!![]);}catch(_0x17274d){return BPromise['reject'](_0x17274d);}return _0x51ec01[_0x8b78('0x26')]();};}function saveUpdates(_0x1b870e,_0x439020){return function(_0xefe345){if(_0xefe345){return _0xefe345[_0x8b78('0x27')](_0x1b870e)[_0x8b78('0x28')](function(_0x5de532){return _0x5de532;});}return null;};}function removeEntity(_0x2bd382,_0x1ec99b){return function(_0x4c9649){if(_0x4c9649){return _0x4c9649[_0x8b78('0x29')]()['then'](function(){var _0x340ea3=_0x4c9649[_0x8b78('0x2a')]({'plain':!![]});var _0x3c554d=_0x8b78('0x2b');return db['UserProfileResource'][_0x8b78('0x29')]({'where':{'type':_0x3c554d,'resourceId':_0x340ea3['id']}})['then'](function(){return _0x4c9649;});})['then'](function(){_0x2bd382[_0x8b78('0x1e')](0xcc)[_0x8b78('0x2c')]();});}};}function handleEntityNotFound(_0x578d1e,_0x394ba2){return function(_0x12509c){if(!_0x12509c){_0x578d1e['sendStatus'](0x194);}return _0x12509c;};}function handleError(_0x4e33e0,_0x1dce8f){_0x1dce8f=_0x1dce8f||0x1f4;return function(_0x20830f){logger['error'](_0x20830f[_0x8b78('0x2d')]);if(_0x20830f[_0x8b78('0x2e')]){delete _0x20830f[_0x8b78('0x2e')];}_0x4e33e0[_0x8b78('0x1e')](_0x1dce8f)[_0x8b78('0x2f')](_0x20830f);};}exports[_0x8b78('0x30')]=function(_0x3da1e0,_0x3adb7c){var _0x43ce1d={},_0x6f6bc1={},_0x345198={'count':0x0,'rows':[]};var _0x153f22=_[_0x8b78('0x31')](db[_0x8b78('0x32')][_0x8b78('0x33')],function(_0x544992){return{'name':_0x544992[_0x8b78('0x34')],'type':_0x544992[_0x8b78('0x35')]['key']};});_0x6f6bc1[_0x8b78('0x36')]=_[_0x8b78('0x31')](_0x153f22,_0x8b78('0x2e'));_0x6f6bc1['query']=_['keys'](_0x3da1e0[_0x8b78('0x37')]);_0x6f6bc1[_0x8b78('0x38')]=_['intersection'](_0x6f6bc1['model'],_0x6f6bc1[_0x8b78('0x37')]);_0x43ce1d[_0x8b78('0x39')]=_[_0x8b78('0x3a')](_0x6f6bc1['model'],qs[_0x8b78('0x3b')](_0x3da1e0['query'][_0x8b78('0x3b')]));_0x43ce1d[_0x8b78('0x39')]=_0x43ce1d[_0x8b78('0x39')][_0x8b78('0x3c')]?_0x43ce1d['attributes']:_0x6f6bc1[_0x8b78('0x36')];if(!_0x3da1e0['query'][_0x8b78('0x3d')](_0x8b78('0x3e'))){_0x43ce1d[_0x8b78('0x22')]=qs[_0x8b78('0x22')](_0x3da1e0['query'][_0x8b78('0x22')]);_0x43ce1d[_0x8b78('0x20')]=qs[_0x8b78('0x20')](_0x3da1e0[_0x8b78('0x37')][_0x8b78('0x20')]);}_0x43ce1d[_0x8b78('0x3f')]=qs[_0x8b78('0x40')](_0x3da1e0[_0x8b78('0x37')][_0x8b78('0x40')]);_0x43ce1d[_0x8b78('0x41')]=qs['filters'](_[_0x8b78('0x42')](_0x3da1e0['query'],_0x6f6bc1[_0x8b78('0x38')]),_0x153f22);if(_0x3da1e0[_0x8b78('0x37')][_0x8b78('0x43')]){_0x43ce1d[_0x8b78('0x41')]=_[_0x8b78('0x44')](_0x43ce1d['where'],{'$or':_[_0x8b78('0x31')](_0x153f22,function(_0x3423a0){if(_0x3423a0['type']!==_0x8b78('0x45')){var _0x2cd086={};_0x2cd086[_0x3423a0[_0x8b78('0x2e')]]={'$like':'%'+_0x3da1e0[_0x8b78('0x37')][_0x8b78('0x43')]+'%'};return _0x2cd086;}})});}_0x43ce1d=_[_0x8b78('0x44')]({},_0x43ce1d,_0x3da1e0['options']);var _0x1c15fa={'where':_0x43ce1d[_0x8b78('0x41')]};return db['Interval'][_0x8b78('0x21')](_0x1c15fa)[_0x8b78('0x28')](function(_0x1f6f0a){_0x345198['count']=_0x1f6f0a;if(_0x3da1e0[_0x8b78('0x37')][_0x8b78('0x46')]){_0x43ce1d[_0x8b78('0x47')]=[{'all':!![]}];}return db[_0x8b78('0x32')][_0x8b78('0x48')](_0x43ce1d);})[_0x8b78('0x28')](function(_0xcaffd8){_0x345198[_0x8b78('0x49')]=_0xcaffd8;return _0x345198;})['then'](respondWithFilteredResult(_0x3adb7c,_0x43ce1d))[_0x8b78('0x4a')](handleError(_0x3adb7c,null));};exports[_0x8b78('0x4b')]=function(_0x13baf6,_0x5d676f){var _0x502f4d={'raw':!![],'where':{'id':_0x13baf6[_0x8b78('0x4c')]['id']}},_0x412205={};_0x412205[_0x8b78('0x36')]=_['keys'](db['Interval']['rawAttributes']);_0x412205[_0x8b78('0x37')]=_['keys'](_0x13baf6[_0x8b78('0x37')]);_0x412205[_0x8b78('0x38')]=_['intersection'](_0x412205[_0x8b78('0x36')],_0x412205[_0x8b78('0x37')]);_0x502f4d[_0x8b78('0x39')]=_[_0x8b78('0x3a')](_0x412205[_0x8b78('0x36')],qs[_0x8b78('0x3b')](_0x13baf6[_0x8b78('0x37')]['fields']));_0x502f4d[_0x8b78('0x39')]=_0x502f4d[_0x8b78('0x39')][_0x8b78('0x3c')]?_0x502f4d['attributes']:_0x412205[_0x8b78('0x36')];if(_0x13baf6[_0x8b78('0x37')][_0x8b78('0x46')]){_0x502f4d[_0x8b78('0x47')]=[{'all':!![]}];}_0x502f4d=_[_0x8b78('0x44')]({},_0x502f4d,_0x13baf6[_0x8b78('0x4d')]);return db[_0x8b78('0x32')][_0x8b78('0x4e')](_0x502f4d)[_0x8b78('0x28')](handleEntityNotFound(_0x5d676f,null))['then'](respondWithResult(_0x5d676f,null))[_0x8b78('0x4a')](handleError(_0x5d676f,null));};exports[_0x8b78('0x4f')]=function(_0x3d4256,_0x20dfd4){return db['Interval'][_0x8b78('0x4f')](_0x3d4256[_0x8b78('0x50')],{})[_0x8b78('0x28')](function(_0x1c8742){var _0x43c564=_0x3d4256[_0x8b78('0x51')]['get']({'plain':!![]});if(!_0x43c564)throw new Error(_0x8b78('0x52'));if(_0x43c564['role']===_0x8b78('0x51')){var _0x490180=_0x1c8742['get']({'plain':!![]});var _0x250805=_0x8b78('0x2b');return db[_0x8b78('0x53')][_0x8b78('0x4e')]({'where':{'name':_0x250805,'userProfileId':_0x43c564[_0x8b78('0x54')]},'raw':!![]})[_0x8b78('0x28')](function(_0xb3cc7b){if(_0xb3cc7b&&_0xb3cc7b[_0x8b78('0x55')]===0x0){return db[_0x8b78('0x56')][_0x8b78('0x4f')]({'name':_0x490180[_0x8b78('0x2e')],'resourceId':_0x490180['id'],'type':_0xb3cc7b[_0x8b78('0x2e')],'sectionId':_0xb3cc7b['id']},{})[_0x8b78('0x28')](function(){return _0x1c8742;});}else{return _0x1c8742;}})[_0x8b78('0x4a')](function(_0x315f91){logger[_0x8b78('0x57')](_0x8b78('0x58'),_0x315f91);throw _0x315f91;});}return _0x1c8742;})['then'](respondWithResult(_0x20dfd4,0xc9))[_0x8b78('0x4a')](handleError(_0x20dfd4,null));};exports[_0x8b78('0x27')]=function(_0x22eced,_0x167f7c){if(_0x22eced[_0x8b78('0x50')]['id']){delete _0x22eced[_0x8b78('0x50')]['id'];}return db['Interval']['find']({'where':{'id':_0x22eced[_0x8b78('0x4c')]['id']}})['then'](handleEntityNotFound(_0x167f7c,null))[_0x8b78('0x28')](saveUpdates(_0x22eced[_0x8b78('0x50')],null))['then'](respondWithResult(_0x167f7c,null))['catch'](handleError(_0x167f7c,null));};exports[_0x8b78('0x29')]=function(_0x28eb77,_0x5588d2){return db[_0x8b78('0x32')][_0x8b78('0x4e')]({'where':{'id':_0x28eb77[_0x8b78('0x4c')]['id']}})[_0x8b78('0x28')](handleEntityNotFound(_0x5588d2,null))[_0x8b78('0x28')](removeEntity(_0x5588d2,null))[_0x8b78('0x4a')](handleError(_0x5588d2,null));};exports[_0x8b78('0x59')]=function(_0x1297c1,_0x41aba8,_0x422be8){if(_0x1297c1[_0x8b78('0x50')]['id']){delete _0x1297c1[_0x8b78('0x50')]['id'];}return db['Interval'][_0x8b78('0x4e')]({'where':{'id':_0x1297c1[_0x8b78('0x4c')]['id']}})[_0x8b78('0x28')](handleEntityNotFound(_0x41aba8,null))[_0x8b78('0x28')](function(_0x5a1f83){if(_0x5a1f83){_0x1297c1['body']['IntervalId']=_0x5a1f83['id'];return db[_0x8b78('0x32')][_0x8b78('0x4f')](_0x1297c1['body']);}})[_0x8b78('0x28')](respondWithResult(_0x41aba8,null))[_0x8b78('0x4a')](handleError(_0x41aba8,null));};exports[_0x8b78('0x5a')]=function(_0x50fe33,_0xbf5ea9,_0xd0ac59){var _0x5b0185={};var _0x4816e3={};var _0x5ebf2a;var _0x1de98e;return db[_0x8b78('0x32')]['findOne']({'where':{'id':_0x50fe33['params']['id']}})[_0x8b78('0x28')](handleEntityNotFound(_0xbf5ea9,null))['then'](function(_0x4b1b51){if(_0x4b1b51){_0x5ebf2a=_0x4b1b51;_0x4816e3[_0x8b78('0x36')]=_[_0x8b78('0x5b')](db[_0x8b78('0x32')][_0x8b78('0x33')]);_0x4816e3[_0x8b78('0x37')]=_['keys'](_0x50fe33[_0x8b78('0x37')]);_0x4816e3['filters']=_[_0x8b78('0x3a')](_0x4816e3['model'],_0x4816e3['query']);_0x5b0185[_0x8b78('0x39')]=_[_0x8b78('0x3a')](_0x4816e3['model'],qs[_0x8b78('0x3b')](_0x50fe33[_0x8b78('0x37')]['fields']));_0x5b0185[_0x8b78('0x39')]=_0x5b0185['attributes']['length']?_0x5b0185['attributes']:_0x4816e3[_0x8b78('0x36')];_0x5b0185['order']=qs[_0x8b78('0x40')](_0x50fe33[_0x8b78('0x37')][_0x8b78('0x40')]);_0x5b0185[_0x8b78('0x41')]=qs['filters'](_[_0x8b78('0x42')](_0x50fe33[_0x8b78('0x37')],_0x4816e3['filters']));if(_0x50fe33[_0x8b78('0x37')][_0x8b78('0x43')]){_0x5b0185['where']=_['merge'](_0x5b0185['where'],{'$or':_[_0x8b78('0x31')](_0x5b0185[_0x8b78('0x39')],function(_0xe1dc4a){var _0x239c98={};_0x239c98[_0xe1dc4a]={'$like':'%'+_0x50fe33[_0x8b78('0x37')][_0x8b78('0x43')]+'%'};return _0x239c98;})});}_0x5b0185=_[_0x8b78('0x44')]({},_0x5b0185,_0x50fe33[_0x8b78('0x4d')]);return _0x5ebf2a['getIntervals'](_0x5b0185);}})['then'](function(_0x29c3e3){if(_0x29c3e3){_0x1de98e=_0x29c3e3[_0x8b78('0x3c')];if(!_0x50fe33[_0x8b78('0x37')][_0x8b78('0x3d')](_0x8b78('0x3e'))){_0x5b0185[_0x8b78('0x22')]=qs[_0x8b78('0x22')](_0x50fe33['query'][_0x8b78('0x22')]);_0x5b0185['offset']=qs[_0x8b78('0x20')](_0x50fe33[_0x8b78('0x37')]['offset']);}return _0x5ebf2a[_0x8b78('0x5a')](_0x5b0185);}})[_0x8b78('0x28')](function(_0x85364e){if(_0x85364e){return _0x85364e?{'count':_0x1de98e,'rows':_0x85364e}:null;}})[_0x8b78('0x28')](respondWithResult(_0xbf5ea9,null))[_0x8b78('0x4a')](handleError(_0xbf5ea9,null));};exports[_0x8b78('0x5c')]=function(_0x3d4aa0,_0x2add4f,_0x4f6e89){return db[_0x8b78('0x32')]['findOne']({'where':{'id':_0x3d4aa0['params']['id']}})[_0x8b78('0x28')](handleEntityNotFound(_0x2add4f,null))[_0x8b78('0x28')](function(_0x59fb06){if(_0x59fb06){return db[_0x8b78('0x5d')][_0x8b78('0x5e')](function(_0x5aca9c){return db['Interval'][_0x8b78('0x29')]({'where':{'IntervalId':_0x3d4aa0[_0x8b78('0x4c')]['id']},'transaction':_0x5aca9c})[_0x8b78('0x28')](function(_0x247fec){var _0x2a3def=_[_0x8b78('0x31')](_0x3d4aa0[_0x8b78('0x50')],function(_0x1d79bb){delete _0x1d79bb['id'];_0x1d79bb[_0x8b78('0x5f')]=_0x3d4aa0[_0x8b78('0x4c')]['id'];return _0x1d79bb;});return db[_0x8b78('0x32')][_0x8b78('0x60')](_0x2a3def,{'transaction':_0x5aca9c});});})[_0x8b78('0x28')](function(){return db['Interval'][_0x8b78('0x48')]({'where':{'IntervalId':_0x3d4aa0['params']['id']}});});}})[_0x8b78('0x28')](respondWithResult(_0x2add4f,null))['catch'](handleError(_0x2add4f,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6a44ba7..fa90006 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 _0xa38a=['then','all','map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','rewrite','interval','string','getIntervals'];(function(_0x99f5d,_0x4aef98){var _0x21a3fa=function(_0x16e028){while(--_0x16e028){_0x99f5d['push'](_0x99f5d['shift']());}};_0x21a3fa(++_0x4aef98);}(_0xa38a,0x19a));var _0xaa38=function(_0x229b03,_0x2f249f){_0x229b03=_0x229b03-0x0;var _0x149731=_0xa38a[_0x229b03];return _0x149731;};'use strict';var attributes=require(_0xaa38('0x0'));var extensions=require(_0xaa38('0x1'));var iftime=require(_0xaa38('0x2'))['iftime'];module[_0xaa38('0x3')]=function(_0x2b32b0){return _0x2b32b0[_0xaa38('0x4')](_0xaa38('0x5'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x29f42f){extensions[_0xaa38('0x6')](_0x2b32b0,_0x29f42f);},'afterBulkCreate':function(_0x30e8b4,_0x15cb92,_0x3c9293){_0x3c9293();extensions[_0xaa38('0x6')](_0x2b32b0,_0x30e8b4[0x0]);},'afterUpdate':function(_0x20e743){extensions[_0xaa38('0x6')](_0x2b32b0,_0x20e743);},'afterDestroy':function(_0x4d58c0){extensions[_0xaa38('0x6')](_0x2b32b0,_0x4d58c0);}},'instanceMethods':{'ifTime':function(_0x2a69e1=undefined,_0x2dfc64=new Date()){if(typeof this[_0xaa38('0x7')]===_0xaa38('0x8')){return iftime(this['interval'],_0x2a69e1,_0x2dfc64);}else{return this[_0xaa38('0x9')]()[_0xaa38('0xa')](function(_0x37dfc6){return Promise[_0xaa38('0xb')](_0x37dfc6[_0xaa38('0xc')](function(_0x4b45b3){return _0x4b45b3[_0xaa38('0xd')](_0x2a69e1,_0x2dfc64);}));})[_0xaa38('0xa')](function(_0x4837c7){return _0x4837c7[_0xaa38('0xe')](function(_0x32729a,_0x5242b0){return _0x32729a||_0x5242b0;},![]);});}}}});}; \ No newline at end of file +var _0xfa03=['tools_intervals','rewrite','interval','then','all','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','define'];(function(_0x5a47cc,_0x30d203){var _0x2eec86=function(_0x122f3a){while(--_0x122f3a){_0x5a47cc['push'](_0x5a47cc['shift']());}};_0x2eec86(++_0x30d203);}(_0xfa03,0xf8));var _0x3fa0=function(_0x449d8a,_0x373121){_0x449d8a=_0x449d8a-0x0;var _0x1c19a4=_0xfa03[_0x449d8a];return _0x1c19a4;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x3fa0('0x0'));var iftime=require(_0x3fa0('0x1'))[_0x3fa0('0x2')];module['exports']=function(_0x34dee2){return _0x34dee2[_0x3fa0('0x3')]('Interval',attributes,{'tableName':_0x3fa0('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f721f){extensions['rewrite'](_0x34dee2,_0x4f721f);},'afterBulkCreate':function(_0xe6a5e9,_0x1eb5a6,_0x351666){_0x351666();extensions[_0x3fa0('0x5')](_0x34dee2,_0xe6a5e9[0x0]);},'afterUpdate':function(_0x137415){extensions[_0x3fa0('0x5')](_0x34dee2,_0x137415);},'afterDestroy':function(_0x3ff548){extensions[_0x3fa0('0x5')](_0x34dee2,_0x3ff548);}},'instanceMethods':{'ifTime':function(_0x4f2cd7=undefined,_0x31bc85=new Date()){if(typeof this[_0x3fa0('0x6')]==='string'){return iftime(this[_0x3fa0('0x6')],_0x4f2cd7,_0x31bc85);}else{return this['getIntervals']()[_0x3fa0('0x7')](function(_0x3f8bba){return Promise[_0x3fa0('0x8')](_0x3f8bba[_0x3fa0('0x9')](function(_0x407688){return _0x407688[_0x3fa0('0xa')](_0x4f2cd7,_0x31bc85);}));})[_0x3fa0('0x7')](function(_0x22c11a){return _0x22c11a[_0x3fa0('0xb')](function(_0x509da6,_0x4d9b11){return _0x509da6||_0x4d9b11;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5ab212d..ef1b895 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 _0xc046=['ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','intervalIds','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','resolve','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','include','map','model','attributes','then','info','debug','stringify','error','message','ShowInterval','find','catch','all'];(function(_0x41428b,_0xe6dbc7){var _0x3d32df=function(_0x2cd3c9){while(--_0x2cd3c9){_0x41428b['push'](_0x41428b['shift']());}};_0x3d32df(++_0xe6dbc7);}(_0xc046,0x18a));var _0x6c04=function(_0x10d283,_0x4a73b9){_0x10d283=_0x10d283-0x0;var _0x5d95a3=_0xc046[_0x10d283];return _0x5d95a3;};'use strict';var _=require('lodash');var util=require(_0x6c04('0x0'));var db=require(_0x6c04('0x1'))['db'];var iftime=require(_0x6c04('0x2'))[_0x6c04('0x3')];var logger=require(_0x6c04('0x4'))(_0x6c04('0x5'));exports[_0x6c04('0x6')]=function(_0x41e2d8){var _0x46d3b5=this;return new Promise(function(_0xedfa75,_0x363b4d){return db[_0x6c04('0x7')][_0x6c04('0x8')]({'raw':_0x41e2d8[_0x6c04('0x9')]?_0x41e2d8[_0x6c04('0x9')][_0x6c04('0xa')]===undefined?!![]:![]:!![],'where':_0x41e2d8[_0x6c04('0x9')]?_0x41e2d8[_0x6c04('0x9')][_0x6c04('0xb')]||null:null,'attributes':_0x41e2d8[_0x6c04('0x9')]?_0x41e2d8[_0x6c04('0x9')]['attributes']||null:null,'limit':_0x41e2d8[_0x6c04('0x9')]?_0x41e2d8[_0x6c04('0x9')]['limit']||null:null,'include':_0x41e2d8['options']?_0x41e2d8[_0x6c04('0x9')][_0x6c04('0xc')]?_[_0x6c04('0xd')](_0x41e2d8['options']['include'],function(_0x5f5b31){return{'model':db[_0x5f5b31[_0x6c04('0xe')]],'as':_0x5f5b31['as'],'attributes':_0x5f5b31[_0x6c04('0xf')],'include':_0x5f5b31[_0x6c04('0xc')]?_[_0x6c04('0xd')](_0x5f5b31[_0x6c04('0xc')],function(_0x4dcbcb){return{'model':db[_0x4dcbcb[_0x6c04('0xe')]],'as':_0x4dcbcb['as'],'attributes':_0x4dcbcb[_0x6c04('0xf')],'include':_0x4dcbcb[_0x6c04('0xc')]?_[_0x6c04('0xd')](_0x4dcbcb[_0x6c04('0xc')],function(_0x19702d){return{'model':db[_0x19702d[_0x6c04('0xe')]],'as':_0x19702d['as'],'attributes':_0x19702d[_0x6c04('0xf')]};}):[]};}):[]};}):[]:[]})[_0x6c04('0x10')](function(_0x23bb66){logger[_0x6c04('0x11')](_0x6c04('0x6'),_0x41e2d8);logger[_0x6c04('0x12')](_0x6c04('0x6'),_0x41e2d8,JSON[_0x6c04('0x13')](_0x23bb66));_0xedfa75(_0x23bb66);})['catch'](function(_0x33d78d){logger[_0x6c04('0x14')](_0x6c04('0x6'),_0x33d78d[_0x6c04('0x15')],_0x41e2d8);_0x363b4d(_0x46d3b5[_0x6c04('0x14')](0x1f4,_0x33d78d[_0x6c04('0x15')]));});});};exports[_0x6c04('0x16')]=function(_0x19970d){var _0x2a7228=this;return new Promise(function(_0x2c7294,_0x31d60e){return db[_0x6c04('0x7')][_0x6c04('0x17')]({'raw':_0x19970d[_0x6c04('0x9')]?_0x19970d[_0x6c04('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x19970d[_0x6c04('0x9')]?_0x19970d['options'][_0x6c04('0xb')]||null:null,'attributes':_0x19970d[_0x6c04('0x9')]?_0x19970d[_0x6c04('0x9')][_0x6c04('0xf')]||null:null,'include':_0x19970d[_0x6c04('0x9')]?_0x19970d[_0x6c04('0x9')][_0x6c04('0xc')]?_[_0x6c04('0xd')](_0x19970d[_0x6c04('0x9')][_0x6c04('0xc')],function(_0x3ec95b){return{'model':db[_0x3ec95b[_0x6c04('0xe')]],'as':_0x3ec95b['as'],'attributes':_0x3ec95b[_0x6c04('0xf')],'include':_0x3ec95b[_0x6c04('0xc')]?_['map'](_0x3ec95b[_0x6c04('0xc')],function(_0x7a0259){return{'model':db[_0x7a0259['model']],'as':_0x7a0259['as'],'attributes':_0x7a0259[_0x6c04('0xf')],'include':_0x7a0259[_0x6c04('0xc')]?_[_0x6c04('0xd')](_0x7a0259[_0x6c04('0xc')],function(_0x36c615){return{'model':db[_0x36c615['model']],'as':_0x36c615['as'],'attributes':_0x36c615[_0x6c04('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cf82b){logger[_0x6c04('0x11')]('ShowInterval',_0x19970d);logger[_0x6c04('0x12')](_0x6c04('0x16'),_0x19970d,JSON[_0x6c04('0x13')](_0x2cf82b));_0x2c7294(_0x2cf82b);})[_0x6c04('0x18')](function(_0x10bd27){logger[_0x6c04('0x14')](_0x6c04('0x16'),_0x10bd27[_0x6c04('0x15')],_0x19970d);_0x31d60e(_0x2a7228[_0x6c04('0x14')](0x1f4,_0x10bd27['message']));});});};function checkArrayOfIntervals(_0x19ea86,_0x3e4c79){var _0x4b8eae=[];return db[_0x6c04('0x7')]['findAll']({'where':{'id':_0x19ea86}})[_0x6c04('0x10')](function(_0xd4a5c8){_0x4b8eae=_0xd4a5c8;return Promise[_0x6c04('0x19')](_0x4b8eae[_0x6c04('0xd')](function(_0x52fa5d){return _0x52fa5d[_0x6c04('0x1a')](_0x3e4c79);}));})[_0x6c04('0x10')](function(_0x3df0c7){var _0x39f0e7=_0x3df0c7[_0x6c04('0x1b')](function(_0x2f3227,_0x321443){return _0x2f3227||_0x321443;},![]);logger['info'](util[_0x6c04('0x1c')](_0x6c04('0x1d'),_0x4b8eae[_0x6c04('0xd')](function(_0x409dd8){return _0x409dd8['name'];})[_0x6c04('0x1e')](',\x20'),_0x4b8eae[_0x6c04('0xd')](function(_0x4be77e){return _0x4be77e['id'];})[_0x6c04('0x1e')](',\x20')));return _0x39f0e7;});}function checkSingleInterval(_0x25f7e5,_0x3ecb80){return db[_0x6c04('0x7')][_0x6c04('0x1f')](_0x25f7e5)[_0x6c04('0x10')](function(_0xc607){if(_0xc607){logger[_0x6c04('0x11')](util[_0x6c04('0x1c')](_0x6c04('0x20'),_0xc607[_0x6c04('0x21')],_0xc607['id']));return _0xc607[_0x6c04('0x1a')](_0x3ecb80);}});}exports[_0x6c04('0x22')]=function(_0x476e2a){var _0x4dbdec=_0x476e2a[_0x6c04('0x23')];var _0x130638=Array['isArray'](_0x476e2a[_0x6c04('0x24')])?_0x476e2a[_0x6c04('0x24')]:typeof _0x476e2a[_0x6c04('0x24')]===_0x6c04('0x25')?[_0x476e2a[_0x6c04('0x24')]]:[];var _0x48dc5e=_0x476e2a['timezone']||undefined;var _0x53b273=![];if(_0x130638[_0x6c04('0x26')]){logger[_0x6c04('0x11')](util[_0x6c04('0x1c')](_0x6c04('0x27'),_0x130638[_0x6c04('0x1e')](';\x20')));}if(_0x48dc5e){logger['info'](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x48dc5e));}logger[_0x6c04('0x12')](_0x6c04('0x28'),_0x53b273);logger['silly']('IntervalIftime',_0x476e2a);return Promise[_0x6c04('0x29')]()[_0x6c04('0x10')](function(){if(Array['isArray'](_0x4dbdec)){return checkArrayOfIntervals(_0x4dbdec,_0x48dc5e);}else if(_0x4dbdec){return checkSingleInterval(_0x4dbdec,_0x48dc5e);}})[_0x6c04('0x10')](function(_0x4c955c){var _0x1f007f=_0x130638[_0x6c04('0x1b')](function(_0x4253b3,_0x5f4df8){return _0x4253b3||iftime(_0x5f4df8,_0x48dc5e);},![]);_0x53b273=_0x4c955c||_0x1f007f;return _0x53b273;})[_0x6c04('0x18')](function(_0x16090b){logger[_0x6c04('0x14')]('IntervalIftime',_0x476e2a,_0x16090b);throw this[_0x6c04('0x14')](0x1f4,_0x16090b['message']);});}; \ No newline at end of file +var _0x513c=['map','model','then','debug','stringify','catch','error','message','ShowInterval','find','info','findAll','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','lodash','util','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','options','raw','where','attributes','include'];(function(_0x46647b,_0x4e8678){var _0x2bef5d=function(_0x336266){while(--_0x336266){_0x46647b['push'](_0x46647b['shift']());}};_0x2bef5d(++_0x4e8678);}(_0x513c,0xc6));var _0xc513=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0x513c[_0x4c630b];return _0x181259;};'use strict';var _=require(_0xc513('0x0'));var util=require(_0xc513('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0xc513('0x2'))[_0xc513('0x3')];var logger=require(_0xc513('0x4'))('rpc');exports[_0xc513('0x5')]=function(_0x2d9f19){var _0x49024d=this;return new Promise(function(_0x5be973,_0x165574){return db[_0xc513('0x6')]['findAll']({'raw':_0x2d9f19[_0xc513('0x7')]?_0x2d9f19['options'][_0xc513('0x8')]===undefined?!![]:![]:!![],'where':_0x2d9f19[_0xc513('0x7')]?_0x2d9f19['options'][_0xc513('0x9')]||null:null,'attributes':_0x2d9f19['options']?_0x2d9f19[_0xc513('0x7')][_0xc513('0xa')]||null:null,'limit':_0x2d9f19[_0xc513('0x7')]?_0x2d9f19[_0xc513('0x7')]['limit']||null:null,'include':_0x2d9f19[_0xc513('0x7')]?_0x2d9f19[_0xc513('0x7')][_0xc513('0xb')]?_[_0xc513('0xc')](_0x2d9f19[_0xc513('0x7')][_0xc513('0xb')],function(_0x519622){return{'model':db[_0x519622[_0xc513('0xd')]],'as':_0x519622['as'],'attributes':_0x519622[_0xc513('0xa')],'include':_0x519622['include']?_['map'](_0x519622[_0xc513('0xb')],function(_0x284eb6){return{'model':db[_0x284eb6[_0xc513('0xd')]],'as':_0x284eb6['as'],'attributes':_0x284eb6[_0xc513('0xa')],'include':_0x284eb6['include']?_[_0xc513('0xc')](_0x284eb6['include'],function(_0x2cb6eb){return{'model':db[_0x2cb6eb['model']],'as':_0x2cb6eb['as'],'attributes':_0x2cb6eb[_0xc513('0xa')]};}):[]};}):[]};}):[]:[]})[_0xc513('0xe')](function(_0x1e7725){logger['info'](_0xc513('0x5'),_0x2d9f19);logger[_0xc513('0xf')](_0xc513('0x5'),_0x2d9f19,JSON[_0xc513('0x10')](_0x1e7725));_0x5be973(_0x1e7725);})[_0xc513('0x11')](function(_0x1b0499){logger[_0xc513('0x12')]('GetInterval',_0x1b0499[_0xc513('0x13')],_0x2d9f19);_0x165574(_0x49024d[_0xc513('0x12')](0x1f4,_0x1b0499[_0xc513('0x13')]));});});};exports[_0xc513('0x14')]=function(_0x43fc5c){var _0x5fa6c5=this;return new Promise(function(_0xe4908,_0x3aab00){return db[_0xc513('0x6')][_0xc513('0x15')]({'raw':_0x43fc5c[_0xc513('0x7')]?_0x43fc5c['options']['raw']===undefined?!![]:![]:!![],'where':_0x43fc5c[_0xc513('0x7')]?_0x43fc5c[_0xc513('0x7')][_0xc513('0x9')]||null:null,'attributes':_0x43fc5c[_0xc513('0x7')]?_0x43fc5c[_0xc513('0x7')][_0xc513('0xa')]||null:null,'include':_0x43fc5c[_0xc513('0x7')]?_0x43fc5c[_0xc513('0x7')][_0xc513('0xb')]?_[_0xc513('0xc')](_0x43fc5c[_0xc513('0x7')]['include'],function(_0x448656){return{'model':db[_0x448656[_0xc513('0xd')]],'as':_0x448656['as'],'attributes':_0x448656['attributes'],'include':_0x448656[_0xc513('0xb')]?_['map'](_0x448656[_0xc513('0xb')],function(_0x6d6d26){return{'model':db[_0x6d6d26['model']],'as':_0x6d6d26['as'],'attributes':_0x6d6d26['attributes'],'include':_0x6d6d26[_0xc513('0xb')]?_['map'](_0x6d6d26[_0xc513('0xb')],function(_0x534d8e){return{'model':db[_0x534d8e[_0xc513('0xd')]],'as':_0x534d8e['as'],'attributes':_0x534d8e[_0xc513('0xa')]};}):[]};}):[]};}):[]:[]})[_0xc513('0xe')](function(_0x43db8b){logger[_0xc513('0x16')](_0xc513('0x14'),_0x43fc5c);logger[_0xc513('0xf')](_0xc513('0x14'),_0x43fc5c,JSON[_0xc513('0x10')](_0x43db8b));_0xe4908(_0x43db8b);})[_0xc513('0x11')](function(_0x201fcd){logger['error'](_0xc513('0x14'),_0x201fcd[_0xc513('0x13')],_0x43fc5c);_0x3aab00(_0x5fa6c5[_0xc513('0x12')](0x1f4,_0x201fcd['message']));});});};function checkArrayOfIntervals(_0x4ff638,_0x31b0ef){var _0x30b5fb=[];return db[_0xc513('0x6')][_0xc513('0x17')]({'where':{'id':_0x4ff638}})[_0xc513('0xe')](function(_0x32c14d){_0x30b5fb=_0x32c14d;return Promise['all'](_0x30b5fb[_0xc513('0xc')](function(_0x32b9a8){return _0x32b9a8[_0xc513('0x18')](_0x31b0ef);}));})[_0xc513('0xe')](function(_0x29b4f8){var _0x1bfa12=_0x29b4f8[_0xc513('0x19')](function(_0x4b4c91,_0x2adabf){return _0x4b4c91||_0x2adabf;},![]);logger[_0xc513('0x16')](util[_0xc513('0x1a')](_0xc513('0x1b'),_0x30b5fb['map'](function(_0x3cd36e){return _0x3cd36e['name'];})[_0xc513('0x1c')](',\x20'),_0x30b5fb[_0xc513('0xc')](function(_0x4868bf){return _0x4868bf['id'];})[_0xc513('0x1c')](',\x20')));return _0x1bfa12;});}function checkSingleInterval(_0x273c7c,_0x2efcf0){return db['Interval'][_0xc513('0x1d')](_0x273c7c)[_0xc513('0xe')](function(_0x4d9817){if(_0x4d9817){logger[_0xc513('0x16')](util[_0xc513('0x1a')](_0xc513('0x1e'),_0x4d9817[_0xc513('0x1f')],_0x4d9817['id']));return _0x4d9817['ifTime'](_0x2efcf0);}});}exports[_0xc513('0x20')]=function(_0x1921ea){var _0x1fb8ae=_0x1921ea[_0xc513('0x21')];var _0x554de3=Array[_0xc513('0x22')](_0x1921ea[_0xc513('0x23')])?_0x1921ea['intervals']:typeof _0x1921ea[_0xc513('0x23')]===_0xc513('0x24')?[_0x1921ea['intervals']]:[];var _0xb238ed=_0x1921ea['timezone']||undefined;var _0x4ec33e=![];if(_0x554de3[_0xc513('0x25')]){logger['info'](util[_0xc513('0x1a')](_0xc513('0x26'),_0x554de3['join'](';\x20')));}if(_0xb238ed){logger[_0xc513('0x16')](util[_0xc513('0x1a')](_0xc513('0x27'),_0xb238ed));}logger['debug'](_0xc513('0x28'),_0x4ec33e);logger['silly'](_0xc513('0x20'),_0x1921ea);return Promise[_0xc513('0x29')]()[_0xc513('0xe')](function(){if(Array[_0xc513('0x22')](_0x1fb8ae)){return checkArrayOfIntervals(_0x1fb8ae,_0xb238ed);}else if(_0x1fb8ae){return checkSingleInterval(_0x1fb8ae,_0xb238ed);}})['then'](function(_0x1d596e){var _0x584396=_0x554de3[_0xc513('0x19')](function(_0x232d9d,_0x18b343){return _0x232d9d||iftime(_0x18b343,_0xb238ed);},![]);_0x4ec33e=_0x1d596e||_0x584396;return _0x4ec33e;})[_0xc513('0x11')](function(_0x5e69fb){logger[_0xc513('0x12')](_0xc513('0x20'),_0x1921ea,_0x5e69fb);throw this['error'](0x1f4,_0x5e69fb[_0xc513('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 669cfa7..232ed99 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x4b2461,_0x23e6f8){var _0x32ffcb=function(_0x34bfc0){while(--_0x34bfc0){_0x4b2461['push'](_0x4b2461['shift']());}};_0x32ffcb(++_0x23e6f8);}(_0x2032,0xd9));var _0x2203=function(_0x5554db,_0x32937d){_0x5554db=_0x5554db-0x0;var _0x1b60e4=_0x2032[_0x5554db];return _0x1b60e4;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x375fcb,_0x36b9a3){var _0x4f46c1=function(_0x40523f){while(--_0x40523f){_0x375fcb['push'](_0x375fcb['shift']());}};_0x4f46c1(++_0x36b9a3);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f5c76,_0x355857){_0x3f5c76=_0x3f5c76-0x0;var _0x5eb40e=_0x2ef3[_0x3f5c76];return _0x5eb40e;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index f87476c..6d3c1f4 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 _0xea32=['statusCode','json','parse','api.jira','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','email','oldToken','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','utf8','end','status'];(function(_0x2dc252,_0x5decba){var _0x26bf1c=function(_0x55b99a){while(--_0x55b99a){_0x2dc252['push'](_0x2dc252['shift']());}};_0x26bf1c(++_0x5decba);}(_0xea32,0xaf));var _0x2ea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea32[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')('api');var USERNAME=_0x2ea3('0x0');var PASSWORD=_0x2ea3('0x1');function openIssue(_0x40564c,_0x4c7b09){var _0x1af331={'fields':{'project':{'key':_0x40564c[_0x2ea3('0x2')]||_0x2ea3('0x3')},'summary':(_0x40564c[_0x2ea3('0x4')]||_0x2ea3('0x5'))+_0x2ea3('0x6')+_0x40564c['ip'],'description':_0x40564c[_0x2ea3('0x7')]||JSON[_0x2ea3('0x8')](_0x40564c),'issuetype':{'name':_0x40564c[_0x2ea3('0x9')]||_0x2ea3('0xa')}}};_0x1af331['fields']['customfield_11500']=_0x40564c[_0x2ea3('0xb')];_0x1af331['fields']['customfield_11501']=_0x40564c[_0x2ea3('0xc')];_0x1af331[_0x2ea3('0xd')][_0x2ea3('0xe')]=_0x40564c[_0x2ea3('0xf')];_0x1af331[_0x2ea3('0xd')][_0x2ea3('0x10')]=_0x40564c[_0x2ea3('0x11')];_0x1af331[_0x2ea3('0xd')][_0x2ea3('0x12')]=_0x40564c[_0x2ea3('0x13')];_0x1af331[_0x2ea3('0xd')]['customfield_10102']=_0x40564c['ip'];var _0x673c53={'host':_0x2ea3('0x14'),'port':0x1bb,'path':_0x2ea3('0x15'),'method':_0x2ea3('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x2ea3('0x17'),'Authorization':_0x2ea3('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x2ea3('0x19')](_0x2ea3('0x1a'))}};var _0xc76a5b=JSON[_0x2ea3('0x8')](_0x1af331);var _0x13db28=https['request'](_0x673c53,function(_0x50ea46){_0x50ea46['setEncoding'](_0x2ea3('0x1b'));var _0x416f9d='';_0x50ea46['on']('data',function(_0x409f0c){_0x416f9d+=_0x409f0c;});_0x50ea46['on'](_0x2ea3('0x1c'),function(){if(_0x4c7b09){return _0x4c7b09[_0x2ea3('0x1d')](_0x50ea46[_0x2ea3('0x1e')])[_0x2ea3('0x1f')](JSON[_0x2ea3('0x20')](_0x416f9d));}});});_0x13db28['on']('error',function(_0x19e622){if(_0x4c7b09){return _0x4c7b09[_0x2ea3('0x1d')](0x1f4)[_0x2ea3('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x2ea3('0x21')}]});}});_0x13db28['write'](_0xc76a5b);_0x13db28[_0x2ea3('0x1c')]();}exports['openIssue']=openIssue;exports[_0x2ea3('0x22')]=function(_0x8a3100,_0x268efe){_0x8a3100['body']['ip']=_0x8a3100[_0x2ea3('0x23')][_0x2ea3('0x24')]||_0x8a3100[_0x2ea3('0x25')][_0x2ea3('0x26')]||_0x8a3100[_0x2ea3('0x27')][_0x2ea3('0x26')]||_0x8a3100[_0x2ea3('0x25')]['socket'][_0x2ea3('0x26')];return openIssue(_0x8a3100[_0x2ea3('0x28')],_0x268efe);}; \ No newline at end of file +var _0x7d76=['customfield_11504','reason','customfield_10102','/rest/api/2/issue','Basic\x20','toString','base64','request','setEncoding','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','headers','x-forwarded-for','remoteAddress','socket','connection','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7d76,0xcd));var _0x67d7=function(_0x43c89a,_0x3bdbfd){_0x43c89a=_0x43c89a-0x0;var _0x52701e=_0x7d76[_0x43c89a];return _0x52701e;};'use strict';var BPromise=require(_0x67d7('0x0'));var https=require(_0x67d7('0x1'));var logger=require(_0x67d7('0x2'))(_0x67d7('0x3'));var USERNAME=_0x67d7('0x4');var PASSWORD=_0x67d7('0x5');function openIssue(_0x37c69b,_0x186c4b){var _0x193d52={'fields':{'project':{'key':_0x37c69b[_0x67d7('0x6')]||_0x67d7('0x7')},'summary':(_0x37c69b[_0x67d7('0x8')]||_0x67d7('0x9'))+_0x67d7('0xa')+_0x37c69b['ip'],'description':_0x37c69b['description']||JSON[_0x67d7('0xb')](_0x37c69b),'issuetype':{'name':_0x37c69b[_0x67d7('0xc')]||'Bug'}}};_0x193d52[_0x67d7('0xd')][_0x67d7('0xe')]=_0x37c69b[_0x67d7('0xf')];_0x193d52[_0x67d7('0xd')]['customfield_11501']=_0x37c69b[_0x67d7('0x10')];_0x193d52[_0x67d7('0xd')][_0x67d7('0x11')]=_0x37c69b[_0x67d7('0x12')];_0x193d52[_0x67d7('0xd')][_0x67d7('0x13')]=_0x37c69b['name'];_0x193d52[_0x67d7('0xd')][_0x67d7('0x14')]=_0x37c69b[_0x67d7('0x15')];_0x193d52[_0x67d7('0xd')][_0x67d7('0x16')]=_0x37c69b['ip'];var _0x26d0a6={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x67d7('0x17'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x67d7('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x67d7('0x19')](_0x67d7('0x1a'))}};var _0x1a2964=JSON[_0x67d7('0xb')](_0x193d52);var _0x185e12=https[_0x67d7('0x1b')](_0x26d0a6,function(_0x4234f7){_0x4234f7[_0x67d7('0x1c')]('utf8');var _0x10d778='';_0x4234f7['on'](_0x67d7('0x1d'),function(_0x2d00da){_0x10d778+=_0x2d00da;});_0x4234f7['on'](_0x67d7('0x1e'),function(){if(_0x186c4b){return _0x186c4b[_0x67d7('0x1f')](_0x4234f7[_0x67d7('0x20')])[_0x67d7('0x21')](JSON['parse'](_0x10d778));}});});_0x185e12['on'](_0x67d7('0x22'),function(_0x5a7ca0){if(_0x186c4b){return _0x186c4b[_0x67d7('0x1f')](0x1f4)['json']({'errors':[{'message':_0x67d7('0x23'),'type':_0x67d7('0x24')}]});}});_0x185e12['write'](_0x1a2964);_0x185e12[_0x67d7('0x1e')]();}exports[_0x67d7('0x25')]=openIssue;exports[_0x67d7('0x26')]=function(_0x2abbbb,_0x263354){_0x2abbbb['body']['ip']=_0x2abbbb[_0x67d7('0x27')][_0x67d7('0x28')]||_0x2abbbb['connection'][_0x67d7('0x29')]||_0x2abbbb[_0x67d7('0x2a')][_0x67d7('0x29')]||_0x2abbbb[_0x67d7('0x2b')][_0x67d7('0x2a')]['remoteAddress'];return openIssue(_0x2abbbb[_0x67d7('0x2c')],_0x263354);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b26d062..1f1ce64 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 _0xa8a8=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xa8a8,0xec));var _0x8a8a=function(_0x31aa8f,_0x7179d7){_0x31aa8f=_0x31aa8f-0x0;var _0x5b1e14=_0xa8a8[_0x31aa8f];return _0x5b1e14;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8a8a('0x10')]('/',auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);router[_0x8a8a('0x12')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x13')]);router[_0x8a8a('0x14')]('/:id',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x15')]);module[_0x8a8a('0x16')]=router; \ No newline at end of file +var _0x6f7a=['isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x55289f,_0x937017){var _0x34c2f2=function(_0x2b15f7){while(--_0x2b15f7){_0x55289f['push'](_0x55289f['shift']());}};_0x34c2f2(++_0x937017);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1151ca,_0xb92cdf){_0x1151ca=_0x1151ca-0x0;var _0x50d5e8=_0x6f7a[_0x1151ca];return _0x50d5e8;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xa6f7('0xa')](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6f7('0x11')](_0xa6f7('0xe'),auth['isAuthenticated'](),controller[_0xa6f7('0x12')]);router['delete'](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x13')]);module[_0xa6f7('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 7d275f3..79b06ef 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(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7a54,0x106));var _0x47a5=function(_0x2c0d76,_0x3e662f){_0x2c0d76=_0x2c0d76-0x0;var _0x425051=_0x7a54[_0x2c0d76];return _0x425051;};'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(_0x8b352d,_0x32bc62){_0x8b352d=_0x8b352d-0x0;var _0x28180c=_0x7a54[_0x8b352d];return _0x28180c;};'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 06d0fe3..fa58db3 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 _0xfdcd=['body','catch','find','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','filter','includeAll','findAll','rows','show','keys','include','merge','options','create'];(function(_0x51dbbb,_0x2d6a59){var _0x4d16b0=function(_0x25b3c7){while(--_0x25b3c7){_0x51dbbb['push'](_0x51dbbb['shift']());}};_0x4d16b0(++_0x2d6a59);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfdc('0x0'));var zipdir=require(_0xdfdc('0x1'));var jsonpatch=require(_0xdfdc('0x2'));var rp=require('request-promise');var moment=require(_0xdfdc('0x3'));var BPromise=require(_0xdfdc('0x4'));var Mustache=require(_0xdfdc('0x5'));var util=require(_0xdfdc('0x6'));var path=require(_0xdfdc('0x7'));var sox=require(_0xdfdc('0x8'));var csv=require(_0xdfdc('0x9'));var ejs=require(_0xdfdc('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdc('0xb'));var _=require(_0xdfdc('0xc'));var squel=require(_0xdfdc('0xd'));var crypto=require(_0xdfdc('0xe'));var jsforce=require(_0xdfdc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdfdc('0x9'));var querystring=require(_0xdfdc('0x10'));var Papa=require('papaparse');var Redis=require(_0xdfdc('0x11'));var authService=require(_0xdfdc('0x12'));var qs=require(_0xdfdc('0x13'));var as=require(_0xdfdc('0x14'));var hardwareService=require(_0xdfdc('0x15'));var logger=require('../../config/logger')(_0xdfdc('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdfdc('0x17'));var db=require(_0xdfdc('0x18'))['db'];function respondWithStatusCode(_0x2307b0,_0x382a49){_0x382a49=_0x382a49||0xcc;return function(_0x1d9e16){if(_0x1d9e16){return _0x2307b0[_0xdfdc('0x19')](_0x382a49);}return _0x2307b0[_0xdfdc('0x1a')](_0x382a49)['end']();};}function respondWithResult(_0x2f6e11,_0x33d8f0){_0x33d8f0=_0x33d8f0||0xc8;return function(_0x32451d){if(_0x32451d){return _0x2f6e11['status'](_0x33d8f0)[_0xdfdc('0x1b')](_0x32451d);}};}function respondWithFilteredResult(_0x1d90d3,_0x2b29bc){return function(_0x54a982){if(_0x54a982){var _0x1584a7=typeof _0x2b29bc['offset']===_0xdfdc('0x1c')&&typeof _0x2b29bc[_0xdfdc('0x1d')]==='undefined';var _0x137a48=_0x54a982['count'];var _0x32c616=_0x1584a7?0x0:_0x2b29bc[_0xdfdc('0x1e')];var _0x23a3be=_0x1584a7?_0x54a982[_0xdfdc('0x1f')]:_0x2b29bc['offset']+_0x2b29bc[_0xdfdc('0x1d')];var _0x97bbb7;if(_0x23a3be>=_0x137a48){_0x23a3be=_0x137a48;_0x97bbb7=0xc8;}else{_0x97bbb7=0xce;}_0x1d90d3[_0xdfdc('0x1a')](_0x97bbb7);return _0x1d90d3['set'](_0xdfdc('0x20'),_0x32c616+'-'+_0x23a3be+'/'+_0x137a48)[_0xdfdc('0x1b')](_0x54a982);}return null;};}function patchUpdates(_0x583c9d){return function(_0x4b0cb8){try{jsonpatch[_0xdfdc('0x21')](_0x4b0cb8,_0x583c9d,!![]);}catch(_0x55428a){return BPromise[_0xdfdc('0x22')](_0x55428a);}return _0x4b0cb8[_0xdfdc('0x23')]();};}function saveUpdates(_0x1d058a,_0x1bb542){return function(_0x1a2b57){if(_0x1a2b57){return _0x1a2b57[_0xdfdc('0x24')](_0x1d058a)[_0xdfdc('0x25')](function(_0x109017){return _0x109017;});}return null;};}function removeEntity(_0x588d8b,_0x3ebe2b){return function(_0x1b01b8){if(_0x1b01b8){return _0x1b01b8[_0xdfdc('0x26')]()[_0xdfdc('0x25')](function(){_0x588d8b[_0xdfdc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x585494,_0x540cdf){return function(_0x28f124){if(!_0x28f124){_0x585494[_0xdfdc('0x19')](0x194);}return _0x28f124;};}function handleError(_0x108225,_0x1f44f1){_0x1f44f1=_0x1f44f1||0x1f4;return function(_0x3e3b93){logger['error'](_0x3e3b93[_0xdfdc('0x27')]);if(_0x3e3b93[_0xdfdc('0x28')]){delete _0x3e3b93[_0xdfdc('0x28')];}_0x108225['status'](_0x1f44f1)['send'](_0x3e3b93);};}exports[_0xdfdc('0x29')]=function(_0xc27517,_0x299528){var _0x223b48={},_0x3cfe49={},_0xbbb349={'count':0x0,'rows':[]};var _0x283df7=_['map'](db[_0xdfdc('0x2a')][_0xdfdc('0x2b')],function(_0x14d26a){return{'name':_0x14d26a[_0xdfdc('0x2c')],'type':_0x14d26a[_0xdfdc('0x2d')][_0xdfdc('0x2e')]};});_0x3cfe49[_0xdfdc('0x2f')]=_[_0xdfdc('0x30')](_0x283df7,_0xdfdc('0x28'));_0x3cfe49[_0xdfdc('0x31')]=_['keys'](_0xc27517['query']);_0x3cfe49['filters']=_[_0xdfdc('0x32')](_0x3cfe49[_0xdfdc('0x2f')],_0x3cfe49[_0xdfdc('0x31')]);_0x223b48[_0xdfdc('0x33')]=_[_0xdfdc('0x32')](_0x3cfe49[_0xdfdc('0x2f')],qs[_0xdfdc('0x34')](_0xc27517[_0xdfdc('0x31')][_0xdfdc('0x34')]));_0x223b48[_0xdfdc('0x33')]=_0x223b48[_0xdfdc('0x33')][_0xdfdc('0x35')]?_0x223b48[_0xdfdc('0x33')]:_0x3cfe49['model'];if(!_0xc27517[_0xdfdc('0x31')][_0xdfdc('0x36')](_0xdfdc('0x37'))){_0x223b48[_0xdfdc('0x1d')]=qs['limit'](_0xc27517[_0xdfdc('0x31')][_0xdfdc('0x1d')]);_0x223b48[_0xdfdc('0x1e')]=qs[_0xdfdc('0x1e')](_0xc27517['query'][_0xdfdc('0x1e')]);}_0x223b48[_0xdfdc('0x38')]=qs[_0xdfdc('0x39')](_0xc27517[_0xdfdc('0x31')]['sort']);_0x223b48['where']=qs[_0xdfdc('0x3a')](_['pick'](_0xc27517[_0xdfdc('0x31')],_0x3cfe49['filters']),_0x283df7);if(_0xc27517['query']['filter']){_0x223b48[_0xdfdc('0x3b')]=_['merge'](_0x223b48[_0xdfdc('0x3b')],{'$or':_[_0xdfdc('0x30')](_0x283df7,function(_0x136411){if(_0x136411[_0xdfdc('0x2d')]!==_0xdfdc('0x3c')){var _0x49bfd7={};_0x49bfd7[_0x136411[_0xdfdc('0x28')]]={'$like':'%'+_0xc27517['query'][_0xdfdc('0x3d')]+'%'};return _0x49bfd7;}})});}_0x223b48=_['merge']({},_0x223b48,_0xc27517['options']);var _0xb7142d={'where':_0x223b48['where']};return db['JscriptyAnswerReport'][_0xdfdc('0x1f')](_0xb7142d)[_0xdfdc('0x25')](function(_0x40e6b1){_0xbbb349[_0xdfdc('0x1f')]=_0x40e6b1;if(_0xc27517[_0xdfdc('0x31')][_0xdfdc('0x3e')]){_0x223b48['include']=[{'all':!![]}];}return db[_0xdfdc('0x2a')][_0xdfdc('0x3f')](_0x223b48);})[_0xdfdc('0x25')](function(_0x20dc1f){_0xbbb349[_0xdfdc('0x40')]=_0x20dc1f;return _0xbbb349;})['then'](respondWithFilteredResult(_0x299528,_0x223b48))['catch'](handleError(_0x299528,null));};exports[_0xdfdc('0x41')]=function(_0x227309,_0xac59e2){var _0x4a9f94={'raw':!![],'where':{'id':_0x227309['params']['id']}},_0x339e38={};_0x339e38[_0xdfdc('0x2f')]=_['keys'](db[_0xdfdc('0x2a')][_0xdfdc('0x2b')]);_0x339e38[_0xdfdc('0x31')]=_[_0xdfdc('0x42')](_0x227309['query']);_0x339e38['filters']=_[_0xdfdc('0x32')](_0x339e38[_0xdfdc('0x2f')],_0x339e38[_0xdfdc('0x31')]);_0x4a9f94['attributes']=_['intersection'](_0x339e38['model'],qs[_0xdfdc('0x34')](_0x227309[_0xdfdc('0x31')]['fields']));_0x4a9f94[_0xdfdc('0x33')]=_0x4a9f94[_0xdfdc('0x33')][_0xdfdc('0x35')]?_0x4a9f94[_0xdfdc('0x33')]:_0x339e38[_0xdfdc('0x2f')];if(_0x227309['query'][_0xdfdc('0x3e')]){_0x4a9f94[_0xdfdc('0x43')]=[{'all':!![]}];}_0x4a9f94=_[_0xdfdc('0x44')]({},_0x4a9f94,_0x227309[_0xdfdc('0x45')]);return db[_0xdfdc('0x2a')]['find'](_0x4a9f94)[_0xdfdc('0x25')](handleEntityNotFound(_0xac59e2,null))[_0xdfdc('0x25')](respondWithResult(_0xac59e2,null))['catch'](handleError(_0xac59e2,null));};exports[_0xdfdc('0x46')]=function(_0x185925,_0x5ee598){return db[_0xdfdc('0x2a')][_0xdfdc('0x46')](_0x185925[_0xdfdc('0x47')],{})[_0xdfdc('0x25')](respondWithResult(_0x5ee598,0xc9))[_0xdfdc('0x48')](handleError(_0x5ee598,null));};exports[_0xdfdc('0x24')]=function(_0x1a1456,_0x5e645c){if(_0x1a1456[_0xdfdc('0x47')]['id']){delete _0x1a1456[_0xdfdc('0x47')]['id'];}return db[_0xdfdc('0x2a')][_0xdfdc('0x49')]({'where':{'id':_0x1a1456[_0xdfdc('0x4a')]['id']}})[_0xdfdc('0x25')](handleEntityNotFound(_0x5e645c,null))[_0xdfdc('0x25')](saveUpdates(_0x1a1456[_0xdfdc('0x47')],null))[_0xdfdc('0x25')](respondWithResult(_0x5e645c,null))[_0xdfdc('0x48')](handleError(_0x5e645c,null));};exports[_0xdfdc('0x26')]=function(_0x1f6daa,_0xc186d4){return db['JscriptyAnswerReport'][_0xdfdc('0x49')]({'where':{'id':_0x1f6daa[_0xdfdc('0x4a')]['id']}})[_0xdfdc('0x25')](handleEntityNotFound(_0xc186d4,null))[_0xdfdc('0x25')](removeEntity(_0xc186d4,null))[_0xdfdc('0x48')](handleError(_0xc186d4,null));};exports[_0xdfdc('0x4b')]=function(_0x55c6d4,_0x31dff5){return db['JscriptyAnswerReport'][_0xdfdc('0x4b')]()[_0xdfdc('0x25')](respondWithResult(_0x31dff5,null))['catch'](handleError(_0x31dff5,null));}; \ No newline at end of file +var _0x8784=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3e043c,_0x152ec3){var _0x526fe5=function(_0xd6f280){while(--_0xd6f280){_0x3e043c['push'](_0x3e043c['shift']());}};_0x526fe5(++_0x152ec3);}(_0x8784,0x172));var _0x4878=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0x8784[_0x4cf0b7];return _0x545f10;};'use strict';var emlformat=require(_0x4878('0x0'));var rimraf=require(_0x4878('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4878('0x2'));var rp=require(_0x4878('0x3'));var moment=require(_0x4878('0x4'));var BPromise=require(_0x4878('0x5'));var Mustache=require(_0x4878('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4878('0x7'));var csv=require(_0x4878('0x8'));var ejs=require(_0x4878('0x9'));var fs=require('fs');var fs_extra=require(_0x4878('0xa'));var _=require(_0x4878('0xb'));var squel=require(_0x4878('0xc'));var crypto=require(_0x4878('0xd'));var jsforce=require(_0x4878('0xe'));var deskjs=require(_0x4878('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4878('0x10'));var Papa=require(_0x4878('0x11'));var Redis=require(_0x4878('0x12'));var authService=require(_0x4878('0x13'));var qs=require(_0x4878('0x14'));var as=require(_0x4878('0x15'));var hardwareService=require(_0x4878('0x16'));var logger=require(_0x4878('0x17'))(_0x4878('0x18'));var utils=require(_0x4878('0x19'));var config=require(_0x4878('0x1a'));var licenseUtil=require(_0x4878('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa3b6c,_0x462485){_0x462485=_0x462485||0xcc;return function(_0x188e81){if(_0x188e81){return _0xa3b6c['sendStatus'](_0x462485);}return _0xa3b6c[_0x4878('0x1c')](_0x462485)[_0x4878('0x1d')]();};}function respondWithResult(_0x4f6486,_0x32c5ea){_0x32c5ea=_0x32c5ea||0xc8;return function(_0x5e67cc){if(_0x5e67cc){return _0x4f6486['status'](_0x32c5ea)[_0x4878('0x1e')](_0x5e67cc);}};}function respondWithFilteredResult(_0x41fefd,_0x2b7ccc){return function(_0x297b43){if(_0x297b43){var _0x37a150=typeof _0x2b7ccc['offset']===_0x4878('0x1f')&&typeof _0x2b7ccc[_0x4878('0x20')]==='undefined';var _0x4319a8=_0x297b43['count'];var _0x2c2529=_0x37a150?0x0:_0x2b7ccc['offset'];var _0x5267ff=_0x37a150?_0x297b43[_0x4878('0x21')]:_0x2b7ccc[_0x4878('0x22')]+_0x2b7ccc[_0x4878('0x20')];var _0x3219f7;if(_0x5267ff>=_0x4319a8){_0x5267ff=_0x4319a8;_0x3219f7=0xc8;}else{_0x3219f7=0xce;}_0x41fefd[_0x4878('0x1c')](_0x3219f7);return _0x41fefd['set'](_0x4878('0x23'),_0x2c2529+'-'+_0x5267ff+'/'+_0x4319a8)[_0x4878('0x1e')](_0x297b43);}return null;};}function patchUpdates(_0x35a0e1){return function(_0x436f62){try{jsonpatch[_0x4878('0x24')](_0x436f62,_0x35a0e1,!![]);}catch(_0x3ffa0c){return BPromise['reject'](_0x3ffa0c);}return _0x436f62[_0x4878('0x25')]();};}function saveUpdates(_0x7767d1,_0x3f3f11){return function(_0x5482f5){if(_0x5482f5){return _0x5482f5[_0x4878('0x26')](_0x7767d1)[_0x4878('0x27')](function(_0x57d9b3){return _0x57d9b3;});}return null;};}function removeEntity(_0x21d4d7,_0x10e25d){return function(_0x3b2d57){if(_0x3b2d57){return _0x3b2d57['destroy']()[_0x4878('0x27')](function(){_0x21d4d7[_0x4878('0x1c')](0xcc)[_0x4878('0x1d')]();});}};}function handleEntityNotFound(_0x476ec3,_0x2938f9){return function(_0x5b1222){if(!_0x5b1222){_0x476ec3[_0x4878('0x28')](0x194);}return _0x5b1222;};}function handleError(_0x4458fb,_0x522157){_0x522157=_0x522157||0x1f4;return function(_0x48f8f){logger[_0x4878('0x29')](_0x48f8f[_0x4878('0x2a')]);if(_0x48f8f[_0x4878('0x2b')]){delete _0x48f8f[_0x4878('0x2b')];}_0x4458fb[_0x4878('0x1c')](_0x522157)[_0x4878('0x2c')](_0x48f8f);};}exports[_0x4878('0x2d')]=function(_0xcff66b,_0xe7a731){var _0x3b09f1={},_0x38400b={},_0x1a8da4={'count':0x0,'rows':[]};var _0x480631=_[_0x4878('0x2e')](db[_0x4878('0x2f')]['rawAttributes'],function(_0x4c8f6b){return{'name':_0x4c8f6b[_0x4878('0x30')],'type':_0x4c8f6b[_0x4878('0x31')][_0x4878('0x32')]};});_0x38400b[_0x4878('0x33')]=_[_0x4878('0x2e')](_0x480631,_0x4878('0x2b'));_0x38400b[_0x4878('0x34')]=_['keys'](_0xcff66b[_0x4878('0x34')]);_0x38400b[_0x4878('0x35')]=_[_0x4878('0x36')](_0x38400b[_0x4878('0x33')],_0x38400b[_0x4878('0x34')]);_0x3b09f1['attributes']=_['intersection'](_0x38400b['model'],qs[_0x4878('0x37')](_0xcff66b[_0x4878('0x34')][_0x4878('0x37')]));_0x3b09f1['attributes']=_0x3b09f1[_0x4878('0x38')][_0x4878('0x39')]?_0x3b09f1['attributes']:_0x38400b[_0x4878('0x33')];if(!_0xcff66b['query'][_0x4878('0x3a')]('nolimit')){_0x3b09f1['limit']=qs[_0x4878('0x20')](_0xcff66b['query'][_0x4878('0x20')]);_0x3b09f1[_0x4878('0x22')]=qs['offset'](_0xcff66b[_0x4878('0x34')][_0x4878('0x22')]);}_0x3b09f1['order']=qs[_0x4878('0x3b')](_0xcff66b[_0x4878('0x34')]['sort']);_0x3b09f1[_0x4878('0x3c')]=qs['filters'](_[_0x4878('0x3d')](_0xcff66b[_0x4878('0x34')],_0x38400b[_0x4878('0x35')]),_0x480631);if(_0xcff66b[_0x4878('0x34')]['filter']){_0x3b09f1[_0x4878('0x3c')]=_[_0x4878('0x3e')](_0x3b09f1[_0x4878('0x3c')],{'$or':_[_0x4878('0x2e')](_0x480631,function(_0x5e1709){if(_0x5e1709[_0x4878('0x31')]!=='VIRTUAL'){var _0x1b4380={};_0x1b4380[_0x5e1709[_0x4878('0x2b')]]={'$like':'%'+_0xcff66b['query'][_0x4878('0x3f')]+'%'};return _0x1b4380;}})});}_0x3b09f1=_[_0x4878('0x3e')]({},_0x3b09f1,_0xcff66b[_0x4878('0x40')]);var _0x2a12d3={'where':_0x3b09f1[_0x4878('0x3c')]};return db[_0x4878('0x2f')][_0x4878('0x21')](_0x2a12d3)[_0x4878('0x27')](function(_0x12c15f){_0x1a8da4['count']=_0x12c15f;if(_0xcff66b[_0x4878('0x34')][_0x4878('0x41')]){_0x3b09f1[_0x4878('0x42')]=[{'all':!![]}];}return db[_0x4878('0x2f')][_0x4878('0x43')](_0x3b09f1);})[_0x4878('0x27')](function(_0x286b9f){_0x1a8da4['rows']=_0x286b9f;return _0x1a8da4;})[_0x4878('0x27')](respondWithFilteredResult(_0xe7a731,_0x3b09f1))[_0x4878('0x44')](handleError(_0xe7a731,null));};exports[_0x4878('0x45')]=function(_0x24bda7,_0x1af9fd){var _0xed6918={'raw':!![],'where':{'id':_0x24bda7[_0x4878('0x46')]['id']}},_0x12e555={};_0x12e555[_0x4878('0x33')]=_['keys'](db[_0x4878('0x2f')][_0x4878('0x47')]);_0x12e555['query']=_[_0x4878('0x48')](_0x24bda7[_0x4878('0x34')]);_0x12e555['filters']=_['intersection'](_0x12e555[_0x4878('0x33')],_0x12e555['query']);_0xed6918[_0x4878('0x38')]=_['intersection'](_0x12e555[_0x4878('0x33')],qs[_0x4878('0x37')](_0x24bda7[_0x4878('0x34')][_0x4878('0x37')]));_0xed6918[_0x4878('0x38')]=_0xed6918[_0x4878('0x38')]['length']?_0xed6918['attributes']:_0x12e555[_0x4878('0x33')];if(_0x24bda7[_0x4878('0x34')][_0x4878('0x41')]){_0xed6918[_0x4878('0x42')]=[{'all':!![]}];}_0xed6918=_[_0x4878('0x3e')]({},_0xed6918,_0x24bda7['options']);return db['JscriptyAnswerReport'][_0x4878('0x49')](_0xed6918)[_0x4878('0x27')](handleEntityNotFound(_0x1af9fd,null))['then'](respondWithResult(_0x1af9fd,null))['catch'](handleError(_0x1af9fd,null));};exports[_0x4878('0x4a')]=function(_0x3c044b,_0xe69885){return db[_0x4878('0x2f')]['create'](_0x3c044b[_0x4878('0x4b')],{})[_0x4878('0x27')](respondWithResult(_0xe69885,0xc9))[_0x4878('0x44')](handleError(_0xe69885,null));};exports[_0x4878('0x26')]=function(_0x4f1e52,_0x4bf7de){if(_0x4f1e52[_0x4878('0x4b')]['id']){delete _0x4f1e52['body']['id'];}return db[_0x4878('0x2f')][_0x4878('0x49')]({'where':{'id':_0x4f1e52[_0x4878('0x46')]['id']}})[_0x4878('0x27')](handleEntityNotFound(_0x4bf7de,null))[_0x4878('0x27')](saveUpdates(_0x4f1e52[_0x4878('0x4b')],null))[_0x4878('0x27')](respondWithResult(_0x4bf7de,null))[_0x4878('0x44')](handleError(_0x4bf7de,null));};exports[_0x4878('0x4c')]=function(_0x3ed0df,_0xcf2e36){return db[_0x4878('0x2f')]['find']({'where':{'id':_0x3ed0df[_0x4878('0x46')]['id']}})['then'](handleEntityNotFound(_0xcf2e36,null))['then'](removeEntity(_0xcf2e36,null))[_0x4878('0x44')](handleError(_0xcf2e36,null));};exports[_0x4878('0x4d')]=function(_0x577678,_0x4029fb){return db[_0x4878('0x2f')][_0x4878('0x4d')]()[_0x4878('0x27')](respondWithResult(_0x4029fb,null))['catch'](handleError(_0x4029fb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index c5caaf2..1351f84 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 _0xc96c=['rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','api','moment','bluebird','request-promise','path'];(function(_0x3ce90e,_0x45392f){var _0x5bc63e=function(_0x5615f9){while(--_0x5615f9){_0x3ce90e['push'](_0x3ce90e['shift']());}};_0x5bc63e(++_0x45392f);}(_0xc96c,0x166));var _0xcc96=function(_0x46e5fc,_0x5db9aa){_0x46e5fc=_0x46e5fc-0x0;var _0x52f4e6=_0xc96c[_0x46e5fc];return _0x52f4e6;};'use strict';var _=require('lodash');var util=require(_0xcc96('0x0'));var logger=require('../../config/logger')(_0xcc96('0x1'));var moment=require(_0xcc96('0x2'));var BPromise=require(_0xcc96('0x3'));var rp=require(_0xcc96('0x4'));var fs=require('fs');var path=require(_0xcc96('0x5'));var rimraf=require(_0xcc96('0x6'));var config=require(_0xcc96('0x7'));var attributes=require(_0xcc96('0x8'));module[_0xcc96('0x9')]=function(_0x4c77e5,_0x226e30){return _0x4c77e5[_0xcc96('0xa')](_0xcc96('0xb'),attributes,{'tableName':_0xcc96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbd9=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util'];(function(_0x31cc0e,_0x24ba4c){var _0x144862=function(_0x4d236e){while(--_0x4d236e){_0x31cc0e['push'](_0x31cc0e['shift']());}};_0x144862(++_0x24ba4c);}(_0xdbd9,0x1c6));var _0x9dbd=function(_0x1ce18f,_0x41ad0d){_0x1ce18f=_0x1ce18f-0x0;var _0x38ce58=_0xdbd9[_0x1ce18f];return _0x38ce58;};'use strict';var _=require(_0x9dbd('0x0'));var util=require(_0x9dbd('0x1'));var logger=require(_0x9dbd('0x2'))('api');var moment=require(_0x9dbd('0x3'));var BPromise=require(_0x9dbd('0x4'));var rp=require(_0x9dbd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9dbd('0x6'));var config=require(_0x9dbd('0x7'));var attributes=require(_0x9dbd('0x8'));module[_0x9dbd('0x9')]=function(_0xcb01a9,_0xbaaeb4){return _0xcb01a9[_0x9dbd('0xa')](_0x9dbd('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 81e4166..553d8ce 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 _0xd29d=['then','JscriptyAnswerReport,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request'];(function(_0xfa9b9c,_0x5297f0){var _0x10c1a7=function(_0x20dcc1){while(--_0x20dcc1){_0xfa9b9c['push'](_0xfa9b9c['shift']());}};_0x10c1a7(++_0x5297f0);}(_0xd29d,0x145));var _0xdd29=function(_0x2f601e,_0x349f96){_0x2f601e=_0x2f601e-0x0;var _0x21a1f5=_0xd29d[_0x2f601e];return _0x21a1f5;};'use strict';var _=require('lodash');var util=require(_0xdd29('0x0'));var moment=require(_0xdd29('0x1'));var BPromise=require(_0xdd29('0x2'));var rs=require(_0xdd29('0x3'));var fs=require('fs');var Redis=require(_0xdd29('0x4'));var db=require(_0xdd29('0x5'))['db'];var utils=require(_0xdd29('0x6'));var logger=require(_0xdd29('0x7'))(_0xdd29('0x8'));var config=require('../../config/environment');var jayson=require(_0xdd29('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e001f,_0x37f187,_0x3ad449){return new BPromise(function(_0x426f62,_0x5007f4){return client[_0xdd29('0xa')](_0x2e001f,_0x3ad449)[_0xdd29('0xb')](function(_0x2cebb0){logger['info'](_0xdd29('0xc'),_0x37f187,'request\x20sent');logger[_0xdd29('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x37f187,'request\x20sent',JSON[_0xdd29('0xe')](_0x2cebb0));if(_0x2cebb0[_0xdd29('0xf')]){if(_0x2cebb0['error'][_0xdd29('0x10')]===0x1f4){logger[_0xdd29('0xf')](_0xdd29('0xc'),_0x37f187,_0x2cebb0[_0xdd29('0xf')][_0xdd29('0x11')]);return _0x5007f4(_0x2cebb0[_0xdd29('0xf')]['message']);}logger[_0xdd29('0xf')](_0xdd29('0xc'),_0x37f187,_0x2cebb0[_0xdd29('0xf')][_0xdd29('0x11')]);return _0x426f62(_0x2cebb0[_0xdd29('0xf')][_0xdd29('0x11')]);}else{logger[_0xdd29('0x12')](_0xdd29('0xc'),_0x37f187,_0xdd29('0x13'));_0x426f62(_0x2cebb0['result'][_0xdd29('0x11')]);}})[_0xdd29('0x14')](function(_0x6dcefd){logger[_0xdd29('0xf')](_0xdd29('0xc'),_0x37f187,_0x6dcefd);_0x5007f4(_0x6dcefd);});});} \ No newline at end of file +var _0x9204=['../../config/logger','rpc','jayson/promise','client','http','request','info','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x57b01a,_0x211182){var _0x45e972=function(_0x5c404e){while(--_0x5c404e){_0x57b01a['push'](_0x57b01a['shift']());}};_0x45e972(++_0x211182);}(_0x9204,0x6c));var _0x4920=function(_0x17e81a,_0x3f5b9){_0x17e81a=_0x17e81a-0x0;var _0xc0e312=_0x9204[_0x17e81a];return _0xc0e312;};'use strict';var _=require(_0x4920('0x0'));var util=require(_0x4920('0x1'));var moment=require(_0x4920('0x2'));var BPromise=require(_0x4920('0x3'));var rs=require(_0x4920('0x4'));var fs=require('fs');var Redis=require(_0x4920('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4920('0x6'));var logger=require(_0x4920('0x7'))(_0x4920('0x8'));var config=require('../../config/environment');var jayson=require(_0x4920('0x9'));var client=jayson[_0x4920('0xa')][_0x4920('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bf8a7,_0x155075,_0x5c7d32){return new BPromise(function(_0x687b6a,_0x2410f9){return client[_0x4920('0xc')](_0x3bf8a7,_0x5c7d32)['then'](function(_0x31ac03){logger[_0x4920('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x155075,'request\x20sent');logger[_0x4920('0xe')](_0x4920('0xf'),_0x155075,_0x4920('0x10'),JSON[_0x4920('0x11')](_0x31ac03));if(_0x31ac03[_0x4920('0x12')]){if(_0x31ac03[_0x4920('0x12')][_0x4920('0x13')]===0x1f4){logger[_0x4920('0x12')](_0x4920('0x14'),_0x155075,_0x31ac03[_0x4920('0x12')][_0x4920('0x15')]);return _0x2410f9(_0x31ac03[_0x4920('0x12')]['message']);}logger[_0x4920('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x155075,_0x31ac03[_0x4920('0x12')][_0x4920('0x15')]);return _0x687b6a(_0x31ac03['error'][_0x4920('0x15')]);}else{logger[_0x4920('0xd')](_0x4920('0x14'),_0x155075,_0x4920('0x10'));_0x687b6a(_0x31ac03[_0x4920('0x16')][_0x4920('0x15')]);}})['catch'](function(_0x56bab2){logger[_0x4920('0x12')](_0x4920('0x14'),_0x155075,_0x56bab2);_0x2410f9(_0x56bab2);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 866a398..c256efd 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 _0x74f0=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','post','create','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer'];(function(_0x37c812,_0x2b830f){var _0x55261a=function(_0x5d9073){while(--_0x5d9073){_0x37c812['push'](_0x37c812['shift']());}};_0x55261a(++_0x2b830f);}(_0x74f0,0xa7));var _0x074f=function(_0x3e5f6d,_0x121db6){_0x3e5f6d=_0x3e5f6d-0x0;var _0x1bea6e=_0x74f0[_0x3e5f6d];return _0x1bea6e;};'use strict';var multer=require(_0x074f('0x0'));var util=require(_0x074f('0x1'));var path=require(_0x074f('0x2'));var timeout=require(_0x074f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x074f('0x4'));var auth=require(_0x074f('0x5'));var interaction=require(_0x074f('0x6'));var config=require(_0x074f('0x7'));var controller=require(_0x074f('0x8'));router[_0x074f('0x9')]('/',auth[_0x074f('0xa')](),controller[_0x074f('0xb')]);router[_0x074f('0x9')]('/:id',auth[_0x074f('0xa')](),controller[_0x074f('0xc')]);router[_0x074f('0x9')](_0x074f('0xd'),auth[_0x074f('0xa')](),controller[_0x074f('0xe')]);router[_0x074f('0x9')](_0x074f('0xf'),auth[_0x074f('0xa')](),controller[_0x074f('0x10')]);router[_0x074f('0x9')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x074f('0x11')),controller['getSummary']);router[_0x074f('0x12')]('/',auth['isAuthenticated'](),controller[_0x074f('0x13')]);router['post'](_0x074f('0x14'),auth[_0x074f('0xa')](),controller[_0x074f('0x15')]);router[_0x074f('0x16')](_0x074f('0x17'),auth[_0x074f('0xa')](),controller[_0x074f('0x18')]);router[_0x074f('0x19')](_0x074f('0x17'),auth[_0x074f('0xa')](),controller[_0x074f('0x1a')]);module[_0x074f('0x1b')]=router; \ No newline at end of file +var _0xd945=['util','connect-timeout','fs-extra','../../components/interaction/service','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','getSessions','getAnswers','/:id/summary','30s','post','create','put','exports','multer'];(function(_0x3afcfb,_0x16fecd){var _0x575d0a=function(_0x90b391){while(--_0x90b391){_0x3afcfb['push'](_0x3afcfb['shift']());}};_0x575d0a(++_0x16fecd);}(_0xd945,0x1b4));var _0x5d94=function(_0x393954,_0x4a9c21){_0x393954=_0x393954-0x0;var _0xdbb5cc=_0xd945[_0x393954];return _0xdbb5cc;};'use strict';var multer=require(_0x5d94('0x0'));var util=require(_0x5d94('0x1'));var path=require('path');var timeout=require(_0x5d94('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d94('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5d94('0x4'));var config=require('../../config/environment');var controller=require(_0x5d94('0x5'));router['get']('/',auth[_0x5d94('0x6')](),controller[_0x5d94('0x7')]);router[_0x5d94('0x8')](_0x5d94('0x9'),auth[_0x5d94('0x6')](),controller[_0x5d94('0xa')]);router[_0x5d94('0x8')]('/:id/sessions',auth[_0x5d94('0x6')](),controller[_0x5d94('0xb')]);router[_0x5d94('0x8')]('/:id/answers',auth[_0x5d94('0x6')](),controller[_0x5d94('0xc')]);router[_0x5d94('0x8')](_0x5d94('0xd'),auth[_0x5d94('0x6')](),timeout(_0x5d94('0xe')),controller['getSummary']);router[_0x5d94('0xf')]('/',auth[_0x5d94('0x6')](),controller[_0x5d94('0x10')]);router[_0x5d94('0xf')]('/:id/clone',auth[_0x5d94('0x6')](),controller['clone']);router[_0x5d94('0x11')](_0x5d94('0x9'),auth[_0x5d94('0x6')](),controller['update']);router['delete'](_0x5d94('0x9'),auth[_0x5d94('0x6')](),controller['destroy']);module[_0x5d94('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index d88dcda..39105f4 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 _0x36f4=['description','BOOLEAN','util','exports','STRING','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x54382f,_0x3c2a85){var _0x3d6985=function(_0x2f7181){while(--_0x2f7181){_0x54382f['push'](_0x54382f['shift']());}};_0x3d6985(++_0x3c2a85);}(_0x36f4,0x160));var _0x436f=function(_0x572bbf,_0x505ef0){_0x572bbf=_0x572bbf-0x0;var _0x529787=_0x36f4[_0x572bbf];return _0x529787;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x436f('0x0'));module[_0x436f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x436f('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x436f('0x3')),'set':function(_0x34bcd6){if(_[_0x436f('0x4')](_0x34bcd6)){this[_0x436f('0x5')](_0x436f('0x6'),JSON[_0x436f('0x7')](_0x34bcd6));}else if(_[_0x436f('0x8')](_0x34bcd6)){this[_0x436f('0x5')](_0x436f('0x6'),_0x34bcd6);}else{this['setDataValue']('formData',util[_0x436f('0x9')](_0x436f('0xa'),this[_0x436f('0xb')]('name')||'',this[_0x436f('0xb')](_0x436f('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x436f('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xb851=['name','TEXT','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','exports','STRING'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xb851,0x10b));var _0x1b85=function(_0x134e55,_0x27254a){_0x134e55=_0x134e55-0x0;var _0x533f2d=_0xb851[_0x134e55];return _0x533f2d;};'use strict';var Sequelize=require(_0x1b85('0x0'));var _=require('lodash');var util=require('util');module[_0x1b85('0x1')]={'name':{'type':Sequelize[_0x1b85('0x2')],'unique':_0x1b85('0x3')},'description':{'type':Sequelize[_0x1b85('0x2')]},'formData':{'type':Sequelize[_0x1b85('0x4')](_0x1b85('0x5')),'set':function(_0x36a886){if(_['isObjectLike'](_0x36a886)){this[_0x1b85('0x6')](_0x1b85('0x7'),JSON[_0x1b85('0x8')](_0x36a886));}else if(_[_0x1b85('0x9')](_0x36a886)){this[_0x1b85('0x6')]('formData',_0x36a886);}else{this[_0x1b85('0x6')](_0x1b85('0x7'),util[_0x1b85('0xa')](_0x1b85('0xb'),this[_0x1b85('0xc')](_0x1b85('0x3'))||'',this[_0x1b85('0xc')](_0x1b85('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1b85('0xe')],'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 f10145a..3e07239 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 _0x7582=['download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyProject','findAll','rows','catch','show','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7582,0x167));var _0x2758=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x7582[_0x5be795];return _0x4e8a3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2758('0x0'));var zipdir=require(_0x2758('0x1'));var jsonpatch=require(_0x2758('0x2'));var rp=require('request-promise');var moment=require(_0x2758('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2758('0x4'));var util=require(_0x2758('0x5'));var path=require(_0x2758('0x6'));var sox=require(_0x2758('0x7'));var csv=require('to-csv');var ejs=require(_0x2758('0x8'));var fs=require('fs');var fs_extra=require(_0x2758('0x9'));var _=require('lodash');var squel=require(_0x2758('0xa'));var crypto=require(_0x2758('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2758('0xc'));var toCsv=require(_0x2758('0xd'));var querystring=require(_0x2758('0xe'));var Papa=require('papaparse');var Redis=require(_0x2758('0xf'));var authService=require(_0x2758('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2758('0x11'));var logger=require(_0x2758('0x12'))(_0x2758('0x13'));var utils=require(_0x2758('0x14'));var config=require(_0x2758('0x15'));var licenseUtil=require(_0x2758('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x493357,_0x4caa8b){_0x4caa8b=_0x4caa8b||0xcc;return function(_0x1846cd){if(_0x1846cd){return _0x493357[_0x2758('0x17')](_0x4caa8b);}return _0x493357[_0x2758('0x18')](_0x4caa8b)[_0x2758('0x19')]();};}function respondWithResult(_0x3233af,_0x9db637){_0x9db637=_0x9db637||0xc8;return function(_0x3e1a7e){if(_0x3e1a7e){return _0x3233af[_0x2758('0x18')](_0x9db637)[_0x2758('0x1a')](_0x3e1a7e);}};}function respondWithFilteredResult(_0xad4346,_0x414a0b){return function(_0x361f14){if(_0x361f14){var _0x280ccc=typeof _0x414a0b[_0x2758('0x1b')]==='undefined'&&typeof _0x414a0b['limit']==='undefined';var _0x2b0ce0=_0x361f14[_0x2758('0x1c')];var _0x358358=_0x280ccc?0x0:_0x414a0b[_0x2758('0x1b')];var _0x1bccd9=_0x280ccc?_0x361f14[_0x2758('0x1c')]:_0x414a0b['offset']+_0x414a0b[_0x2758('0x1d')];var _0x4202e5;if(_0x1bccd9>=_0x2b0ce0){_0x1bccd9=_0x2b0ce0;_0x4202e5=0xc8;}else{_0x4202e5=0xce;}_0xad4346['status'](_0x4202e5);return _0xad4346[_0x2758('0x1e')](_0x2758('0x1f'),_0x358358+'-'+_0x1bccd9+'/'+_0x2b0ce0)[_0x2758('0x1a')](_0x361f14);}return null;};}function patchUpdates(_0x4100a0){return function(_0x50526b){try{jsonpatch[_0x2758('0x20')](_0x50526b,_0x4100a0,!![]);}catch(_0x4fa215){return BPromise[_0x2758('0x21')](_0x4fa215);}return _0x50526b[_0x2758('0x22')]();};}function saveUpdates(_0x27a887,_0x2797fe){return function(_0x4699c4){if(_0x4699c4){return _0x4699c4[_0x2758('0x23')](_0x27a887)[_0x2758('0x24')](function(_0x222601){return _0x222601;});}return null;};}function removeEntity(_0x38c483,_0x2ef395){return function(_0x1f645d){if(_0x1f645d){return _0x1f645d[_0x2758('0x25')]()['then'](function(){var _0x4f92f2=_0x1f645d[_0x2758('0x26')]({'plain':!![]});var _0x277f69=_0x2758('0x27');return db[_0x2758('0x28')][_0x2758('0x25')]({'where':{'type':_0x277f69,'resourceId':_0x4f92f2['id']}})[_0x2758('0x24')](function(){return _0x1f645d;});})['then'](function(){_0x38c483['status'](0xcc)[_0x2758('0x19')]();});}};}function handleEntityNotFound(_0x28c1f2,_0xee59e6){return function(_0x1d56cd){if(!_0x1d56cd){_0x28c1f2['sendStatus'](0x194);}return _0x1d56cd;};}function handleError(_0x47c969,_0x3e4cd7){_0x3e4cd7=_0x3e4cd7||0x1f4;return function(_0x230f28){logger[_0x2758('0x29')](_0x230f28['stack']);if(_0x230f28[_0x2758('0x2a')]){delete _0x230f28['name'];}_0x47c969[_0x2758('0x18')](_0x3e4cd7)[_0x2758('0x2b')](_0x230f28);};}exports[_0x2758('0x2c')]=function(_0x348d0d,_0x2e0613){var _0x2000de={},_0x2d44e4={},_0x11efa6={'count':0x0,'rows':[]};var _0x225f6f=_[_0x2758('0x2d')](db['JscriptyProject'][_0x2758('0x2e')],function(_0x89c340){return{'name':_0x89c340[_0x2758('0x2f')],'type':_0x89c340[_0x2758('0x30')]['key']};});_0x2d44e4['model']=_[_0x2758('0x2d')](_0x225f6f,_0x2758('0x2a'));_0x2d44e4['query']=_[_0x2758('0x31')](_0x348d0d['query']);_0x2d44e4[_0x2758('0x32')]=_['intersection'](_0x2d44e4[_0x2758('0x33')],_0x2d44e4[_0x2758('0x34')]);_0x2000de['attributes']=_[_0x2758('0x35')](_0x2d44e4[_0x2758('0x33')],qs[_0x2758('0x36')](_0x348d0d[_0x2758('0x34')][_0x2758('0x36')]));_0x2000de[_0x2758('0x37')]=_0x2000de[_0x2758('0x37')][_0x2758('0x38')]?_0x2000de['attributes']:_0x2d44e4[_0x2758('0x33')];if(!_0x348d0d[_0x2758('0x34')][_0x2758('0x39')](_0x2758('0x3a'))){_0x2000de[_0x2758('0x1d')]=qs[_0x2758('0x1d')](_0x348d0d[_0x2758('0x34')][_0x2758('0x1d')]);_0x2000de[_0x2758('0x1b')]=qs['offset'](_0x348d0d['query'][_0x2758('0x1b')]);}_0x2000de[_0x2758('0x3b')]=qs[_0x2758('0x3c')](_0x348d0d[_0x2758('0x34')][_0x2758('0x3c')]);_0x2000de[_0x2758('0x3d')]=qs['filters'](_[_0x2758('0x3e')](_0x348d0d[_0x2758('0x34')],_0x2d44e4['filters']),_0x225f6f);if(_0x348d0d['query']['filter']){_0x2000de[_0x2758('0x3d')]=_[_0x2758('0x3f')](_0x2000de[_0x2758('0x3d')],{'$or':_[_0x2758('0x2d')](_0x225f6f,function(_0x564462){if(_0x564462[_0x2758('0x30')]!==_0x2758('0x40')){var _0x276ca0={};_0x276ca0[_0x564462[_0x2758('0x2a')]]={'$like':'%'+_0x348d0d[_0x2758('0x34')][_0x2758('0x41')]+'%'};return _0x276ca0;}})});}_0x2000de=_['merge']({},_0x2000de,_0x348d0d[_0x2758('0x42')]);var _0x3ceab5={'where':_0x2000de[_0x2758('0x3d')]};return db[_0x2758('0x43')][_0x2758('0x1c')](_0x3ceab5)[_0x2758('0x24')](function(_0xf0df8e){_0x11efa6[_0x2758('0x1c')]=_0xf0df8e;if(_0x348d0d[_0x2758('0x34')]['includeAll']){_0x2000de['include']=[{'all':!![]}];}return db[_0x2758('0x43')][_0x2758('0x44')](_0x2000de);})['then'](function(_0x2d19d8){_0x11efa6[_0x2758('0x45')]=_0x2d19d8;return _0x11efa6;})['then'](respondWithFilteredResult(_0x2e0613,_0x2000de))[_0x2758('0x46')](handleError(_0x2e0613,null));};exports[_0x2758('0x47')]=function(_0x1a5d64,_0x372862){var _0x291344={'raw':![],'where':{'id':_0x1a5d64['params']['id']}},_0x5a98d5={};_0x5a98d5['model']=_[_0x2758('0x31')](db[_0x2758('0x43')][_0x2758('0x2e')]);_0x5a98d5[_0x2758('0x34')]=_[_0x2758('0x31')](_0x1a5d64[_0x2758('0x34')]);_0x5a98d5[_0x2758('0x32')]=_[_0x2758('0x35')](_0x5a98d5['model'],_0x5a98d5['query']);_0x291344[_0x2758('0x37')]=_[_0x2758('0x35')](_0x5a98d5[_0x2758('0x33')],qs['fields'](_0x1a5d64['query'][_0x2758('0x36')]));_0x291344[_0x2758('0x37')]=_0x291344['attributes'][_0x2758('0x38')]?_0x291344[_0x2758('0x37')]:_0x5a98d5[_0x2758('0x33')];if(_0x1a5d64[_0x2758('0x34')][_0x2758('0x48')]){_0x291344[_0x2758('0x49')]=[{'all':!![]}];}_0x291344=_[_0x2758('0x3f')]({},_0x291344,_0x1a5d64[_0x2758('0x42')]);return db[_0x2758('0x43')][_0x2758('0x4a')](_0x291344)['then'](handleEntityNotFound(_0x372862,null))['then'](respondWithResult(_0x372862,null))[_0x2758('0x46')](handleError(_0x372862,null));};exports[_0x2758('0x4b')]=function(_0x43af2b,_0x2121df){return db[_0x2758('0x43')]['create'](_0x43af2b[_0x2758('0x4c')],{})['then'](function(_0x451458){var _0x264a11=_0x43af2b[_0x2758('0x4d')][_0x2758('0x26')]({'plain':!![]});if(!_0x264a11)throw new Error(_0x2758('0x4e'));if(_0x264a11['role']===_0x2758('0x4d')){var _0x5704c6=_0x451458[_0x2758('0x26')]({'plain':!![]});var _0x2e5c51='Projects';return db[_0x2758('0x4f')][_0x2758('0x4a')]({'where':{'name':_0x2e5c51,'userProfileId':_0x264a11[_0x2758('0x50')]},'raw':!![]})[_0x2758('0x24')](function(_0x20649c){if(_0x20649c&&_0x20649c[_0x2758('0x51')]===0x0){return db[_0x2758('0x28')]['create']({'name':_0x5704c6[_0x2758('0x2a')],'resourceId':_0x5704c6['id'],'type':_0x20649c[_0x2758('0x2a')],'sectionId':_0x20649c['id']},{})[_0x2758('0x24')](function(){return _0x451458;});}else{return _0x451458;}})['catch'](function(_0x5b1b01){logger[_0x2758('0x29')](_0x2758('0x52'),_0x5b1b01);throw _0x5b1b01;});}return _0x451458;})[_0x2758('0x24')](respondWithResult(_0x2121df,0xc9))['catch'](handleError(_0x2121df,null));};exports[_0x2758('0x53')]=function(_0x191b3f,_0x52a01d){var _0x850f9b={'where':{'id':_0x191b3f[_0x2758('0x54')]['id']}},_0x3ee3ad={};_0x3ee3ad['model']=_[_0x2758('0x31')](db[_0x2758('0x43')][_0x2758('0x2e')]);_0x850f9b[_0x2758('0x37')]=_['intersection'](_0x3ee3ad['model'],qs[_0x2758('0x36')](_0x191b3f[_0x2758('0x34')][_0x2758('0x36')]));_0x850f9b[_0x2758('0x37')]=_0x850f9b[_0x2758('0x37')][_0x2758('0x38')]?_0x850f9b[_0x2758('0x37')]:_0x3ee3ad['model'];if(_0x191b3f[_0x2758('0x34')][_0x2758('0x48')]){_0x850f9b[_0x2758('0x49')]=[{'all':!![]}];}_0x850f9b=_[_0x2758('0x3f')]({},_0x850f9b,_0x191b3f[_0x2758('0x42')]);return db['JscriptyProject']['find'](_0x850f9b)['then'](handleEntityNotFound(_0x52a01d,null))['then'](function(_0x5396c3){if(_0x5396c3){var _0x43d0cb=_0x5396c3[_0x2758('0x26')]({'plain':!![]});_0x43d0cb=qs['omit'](_0x43d0cb,['id',_0x2758('0x55'),_0x2758('0x56')]);_0x191b3f[_0x2758('0x4c')]=_['omit'](_0x191b3f[_0x2758('0x4c')],['id',_0x2758('0x55'),_0x2758('0x56')]);return db[_0x2758('0x43')]['create'](_['merge'](_0x43d0cb,_0x191b3f['body']),{'include':_0x191b3f[_0x2758('0x34')][_0x2758('0x48')]?[{'all':!![]}]:undefined})[_0x2758('0x24')](function(_0x3a7b43){var _0x49eb53=_0x191b3f[_0x2758('0x4d')][_0x2758('0x26')]({'plain':!![]});if(!_0x49eb53)throw new Error(_0x2758('0x4e'));if(_0x49eb53['role']===_0x2758('0x4d')){var _0x22e389=_0x3a7b43[_0x2758('0x26')]({'plain':!![]});var _0x2f7591='Projects';return db[_0x2758('0x4f')][_0x2758('0x4a')]({'where':{'name':_0x2f7591,'userProfileId':_0x49eb53[_0x2758('0x50')]},'raw':!![]})[_0x2758('0x24')](function(_0x45302b){if(_0x45302b&&_0x45302b[_0x2758('0x51')]===0x0){return db[_0x2758('0x28')][_0x2758('0x4b')]({'name':_0x22e389[_0x2758('0x2a')],'resourceId':_0x22e389['id'],'type':_0x45302b[_0x2758('0x2a')],'sectionId':_0x45302b['id']},{})[_0x2758('0x24')](function(){return _0x3a7b43;});}else{return _0x3a7b43;}})[_0x2758('0x46')](function(_0x37ef08){logger[_0x2758('0x29')](_0x2758('0x52'),_0x37ef08);throw _0x37ef08;});}return _0x3a7b43;});}})['then'](respondWithResult(_0x52a01d,0xc9))[_0x2758('0x46')](handleError(_0x52a01d,null));};exports[_0x2758('0x23')]=function(_0x1e7853,_0x1e3ce5){if(_0x1e7853[_0x2758('0x4c')]['id']){delete _0x1e7853['body']['id'];}return db[_0x2758('0x43')][_0x2758('0x4a')]({'where':{'id':_0x1e7853[_0x2758('0x54')]['id']}})[_0x2758('0x24')](handleEntityNotFound(_0x1e3ce5,null))[_0x2758('0x24')](saveUpdates(_0x1e7853[_0x2758('0x4c')],null))[_0x2758('0x24')](respondWithResult(_0x1e3ce5,null))['catch'](handleError(_0x1e3ce5,null));};exports[_0x2758('0x25')]=function(_0x2e4db4,_0x2e1128){return db[_0x2758('0x43')][_0x2758('0x4a')]({'where':{'id':_0x2e4db4[_0x2758('0x54')]['id']}})[_0x2758('0x24')](handleEntityNotFound(_0x2e1128,null))[_0x2758('0x24')](removeEntity(_0x2e1128,null))['catch'](handleError(_0x2e1128,null));};exports[_0x2758('0x57')]=function(_0x228829,_0x475748,_0x41d3ff){var _0x47ddb5={'raw':!![],'where':{}};var _0x3ae88e={};var _0x3aebb0={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x2758('0x58')]({'where':{'id':_0x228829[_0x2758('0x54')]['id']}})['then'](handleEntityNotFound(_0x475748,null))[_0x2758('0x24')](function(_0x111e49){if(_0x111e49){_0x3ae88e[_0x2758('0x33')]=_[_0x2758('0x31')](db['JscriptySessionReport'][_0x2758('0x2e')]);_0x3ae88e['query']=_['keys'](_0x228829[_0x2758('0x34')]);_0x3ae88e[_0x2758('0x32')]=_[_0x2758('0x35')](_0x3ae88e[_0x2758('0x33')],_0x3ae88e[_0x2758('0x34')]);_0x47ddb5['attributes']=_[_0x2758('0x35')](_0x3ae88e['model'],qs[_0x2758('0x36')](_0x228829[_0x2758('0x34')][_0x2758('0x36')]));_0x47ddb5[_0x2758('0x37')]=_0x47ddb5[_0x2758('0x37')][_0x2758('0x38')]?_0x47ddb5[_0x2758('0x37')]:_0x3ae88e[_0x2758('0x33')];if(!_0x228829['query']['hasOwnProperty']('nolimit')){_0x47ddb5['limit']=qs['limit'](_0x228829[_0x2758('0x34')][_0x2758('0x1d')]);_0x47ddb5[_0x2758('0x1b')]=qs[_0x2758('0x1b')](_0x228829[_0x2758('0x34')][_0x2758('0x1b')]);}_0x47ddb5[_0x2758('0x3b')]=qs[_0x2758('0x3c')](_0x228829['query'][_0x2758('0x3c')]);_0x47ddb5[_0x2758('0x3d')]=qs[_0x2758('0x32')](_[_0x2758('0x3e')](_0x228829[_0x2758('0x34')],_0x3ae88e[_0x2758('0x32')]));_0x47ddb5[_0x2758('0x3d')][_0x2758('0x59')]=_0x111e49['id'];if(_0x228829[_0x2758('0x34')][_0x2758('0x41')]){_0x47ddb5[_0x2758('0x3d')]=_[_0x2758('0x3f')](_0x47ddb5[_0x2758('0x3d')],{'$or':_['map'](_0x47ddb5[_0x2758('0x37')],function(_0x1b5aff){var _0x2e8cec={};_0x2e8cec[_0x1b5aff]={'$like':'%'+_0x228829['query'][_0x2758('0x41')]+'%'};return _0x2e8cec;})});}_0x47ddb5=_[_0x2758('0x3f')]({},_0x47ddb5,_0x228829[_0x2758('0x42')]);return db[_0x2758('0x5a')][_0x2758('0x1c')]({'where':_0x47ddb5[_0x2758('0x3d')]})[_0x2758('0x24')](function(_0x3932c3){_0x3aebb0[_0x2758('0x1c')]=_0x3932c3;if(_0x228829[_0x2758('0x34')][_0x2758('0x48')]){_0x47ddb5[_0x2758('0x49')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x2758('0x44')](_0x47ddb5);})[_0x2758('0x24')](function(_0x31292c){_0x3aebb0[_0x2758('0x45')]=_0x31292c;return _0x3aebb0;});}})['then'](respondWithFilteredResult(_0x475748,_0x47ddb5))[_0x2758('0x46')](handleError(_0x475748,null));};exports[_0x2758('0x5b')]=function(_0x515eae,_0xcda34b,_0x26fb03){var _0x398cab={'raw':!![],'where':{}};var _0x301fe5={};var _0x3a92d4={'count':0x0,'rows':[]};return db[_0x2758('0x43')][_0x2758('0x58')]({'where':{'id':_0x515eae[_0x2758('0x54')]['id']}})[_0x2758('0x24')](handleEntityNotFound(_0xcda34b,null))[_0x2758('0x24')](function(_0x4c816d){if(_0x4c816d){_0x301fe5[_0x2758('0x33')]=_[_0x2758('0x31')](db['JscriptyAnswerReport'][_0x2758('0x2e')]);_0x301fe5[_0x2758('0x34')]=_['keys'](_0x515eae[_0x2758('0x34')]);_0x301fe5[_0x2758('0x32')]=_[_0x2758('0x35')](_0x301fe5[_0x2758('0x33')],_0x301fe5[_0x2758('0x34')]);_0x398cab[_0x2758('0x37')]=_[_0x2758('0x35')](_0x301fe5[_0x2758('0x33')],qs[_0x2758('0x36')](_0x515eae[_0x2758('0x34')][_0x2758('0x36')]));_0x398cab[_0x2758('0x37')]=_0x398cab[_0x2758('0x37')][_0x2758('0x38')]?_0x398cab[_0x2758('0x37')]:_0x301fe5['model'];if(!_0x515eae[_0x2758('0x34')][_0x2758('0x39')](_0x2758('0x3a'))){_0x398cab[_0x2758('0x1d')]=qs[_0x2758('0x1d')](_0x515eae[_0x2758('0x34')][_0x2758('0x1d')]);_0x398cab['offset']=qs['offset'](_0x515eae[_0x2758('0x34')][_0x2758('0x1b')]);}_0x398cab[_0x2758('0x3b')]=qs[_0x2758('0x3c')](_0x515eae[_0x2758('0x34')]['sort']);_0x398cab[_0x2758('0x3d')]=qs[_0x2758('0x32')](_[_0x2758('0x3e')](_0x515eae['query'],_0x301fe5[_0x2758('0x32')]));_0x398cab['where'][_0x2758('0x59')]=_0x4c816d['id'];if(_0x515eae[_0x2758('0x34')][_0x2758('0x41')]){_0x398cab[_0x2758('0x3d')]=_[_0x2758('0x3f')](_0x398cab[_0x2758('0x3d')],{'$or':_[_0x2758('0x2d')](_0x398cab['attributes'],function(_0xa63291){var _0x247fa0={};_0x247fa0[_0xa63291]={'$like':'%'+_0x515eae[_0x2758('0x34')][_0x2758('0x41')]+'%'};return _0x247fa0;})});}_0x398cab=_['merge']({},_0x398cab,_0x515eae[_0x2758('0x42')]);return db[_0x2758('0x5c')][_0x2758('0x1c')]({'where':_0x398cab[_0x2758('0x3d')]})[_0x2758('0x24')](function(_0x222c8e){_0x3a92d4['count']=_0x222c8e;if(_0x515eae[_0x2758('0x34')][_0x2758('0x48')]){_0x398cab['include']=[{'all':!![]}];}return db[_0x2758('0x5c')][_0x2758('0x44')](_0x398cab);})[_0x2758('0x24')](function(_0x36c849){_0x3a92d4['rows']=_0x36c849;return _0x3a92d4;});}})[_0x2758('0x24')](respondWithFilteredResult(_0xcda34b,_0x398cab))[_0x2758('0x46')](handleError(_0xcda34b,null));};function char(_0x5cbff7){return _0x2758('0x5d')===typeof _0x5cbff7?String['fromCharCode'][_0x2758('0x20')](null,arguments):_0x5cbff7;}function needsEncapsulation(_0x530303){return!!_0x530303&&(_0x530303[_0x2758('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x530303[_0x2758('0x5e')]()[_0x2758('0x5f')](char(0xa))>=0x0||_0x530303[_0x2758('0x5e')]()[_0x2758('0x5f')](char(0x2c))>=0x0||_0x530303[_0x2758('0x5e')]()[_0x2758('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x6c65f5){var _0x3c58c2=char(0x22),_0x121d5c='\x5c'+char(0x22),_0x22e8bb=_0x6c65f5[_0x2758('0x5e')]()[_0x2758('0x60')](new RegExp(_0x3c58c2,'g'),_0x121d5c);return _0x3c58c2+_0x22e8bb+_0x3c58c2;}exports[_0x2758('0x61')]=function(_0x5ab9ab,_0x25897a,_0x1b862d){var _0x298203,_0x43a9ab;var _0x52520a={'where':{'ProjectId':_0x5ab9ab[_0x2758('0x54')]['id']}};if(_0x5ab9ab[_0x2758('0x34')]['startTime']){_0x52520a['where'][_0x2758('0x62')]=JSON[_0x2758('0x63')](_0x5ab9ab[_0x2758('0x34')][_0x2758('0x64')]);}return db[_0x2758('0x5a')][_0x2758('0x44')](_0x52520a)[_0x2758('0x24')](handleEntityNotFound(_0x25897a,null))[_0x2758('0x24')](function(_0x400cd1){if(_0x400cd1){_0x298203=_0x400cd1;return db[_0x2758('0x65')]['findAll']({'where':{'SessionId':{'$in':_[_0x2758('0x2d')](_0x298203,'id')},'ProjectId':_0x5ab9ab[_0x2758('0x54')]['id']},'order':_0x2758('0x66')});}})[_0x2758('0x24')](handleEntityNotFound(_0x25897a,null))[_0x2758('0x24')](function(_0x35b104){if(_0x35b104){_0x43a9ab=_0x35b104;var _0x5cb64d={};for(var _0x4920b6=0x0,_0x744491=_0x43a9ab[_0x2758('0x38')];_0x4920b6<_0x744491;_0x4920b6++){if(!_0x5cb64d[_0x2758('0x39')](_0x43a9ab[_0x4920b6][_0x2758('0x67')])){_0x5cb64d[_0x43a9ab[_0x4920b6][_0x2758('0x67')]]=needsEncapsulation(_0x43a9ab[_0x4920b6]['question'])?encapsulate(_0x43a9ab[_0x4920b6][_0x2758('0x68')]):_0x43a9ab[_0x4920b6][_0x2758('0x68')];}}var _0x317992=[],_0x372f9b={};for(var _0x542a3c=0x0,_0x549d7f=_0x298203[_0x2758('0x38')];_0x542a3c<_0x549d7f;_0x542a3c++){_0x372f9b={'ProjectId':_0x5ab9ab[_0x2758('0x54')]['id'],'SessionId':_0x298203[_0x542a3c]['id'],'StartTime':moment(_0x298203[_0x542a3c][_0x2758('0x62')])[_0x2758('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x27ca4e=0x0,_0x5e90a1=_0x43a9ab[_0x2758('0x38')];_0x27ca4e<_0x5e90a1;_0x27ca4e++){if(_0x43a9ab[_0x27ca4e][_0x2758('0x6a')]==_0x298203[_0x542a3c]['id']&&_0x5cb64d[_0x2758('0x39')](_0x43a9ab[_0x27ca4e][_0x2758('0x67')])){_0x372f9b[_0x5cb64d[_0x43a9ab[_0x27ca4e][_0x2758('0x67')]]]=_0x43a9ab[_0x27ca4e][_0x2758('0x6b')];}}for(var _0x2d9282 in _0x5cb64d){if(!_0x372f9b[_0x2758('0x39')](_0x5cb64d[_0x2d9282])){_0x372f9b[_0x5cb64d[_0x2d9282]]=null;}}_0x317992[_0x2758('0x6c')](_0x372f9b);}return _0x317992;}})['then'](function(_0x1b3ddb){if(!_[_0x2758('0x6d')](_0x1b3ddb)){var _0x5d4611=toCsv(_0x1b3ddb);var _0x13a334=Date[_0x2758('0x6e')]();fs[_0x2758('0x6f')](util[_0x2758('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5ab9ab[_0x2758('0x54')]['id'],_0x13a334),_0x5d4611);_0x25897a[_0x2758('0x70')](_0x2758('0x71'),'attachment;\x20filename='+util[_0x2758('0x69')](_0x2758('0x72'),_0x5ab9ab[_0x2758('0x54')]['id'],_0x13a334));_0x25897a['setHeader'](_0x2758('0x73'),_0x2758('0x74'));return _0x25897a[_0x2758('0x75')](util[_0x2758('0x69')](_0x2758('0x76'),_0x5ab9ab[_0x2758('0x54')]['id'],_0x13a334));}else{return _0x25897a[_0x2758('0x17')](0xcc);}})[_0x2758('0x46')](handleError(_0x25897a,null));}; \ No newline at end of file +var _0x5ab9=['type','options','includeAll','findAll','catch','show','params','length','include','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getSessions','findOne','JscriptySessionReport','rows','getAnswers','JscriptyAnswerReport','ProjectId','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','now','writeFileSync','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','fast-json-patch','request-promise','moment','mustache','util','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/license/util','end','status','offset','limit','undefined','count','Content-Range','json','reject','update','destroy','then','get','Projects','sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where'];(function(_0x5bb9ac,_0x417c09){var _0x38fd65=function(_0x17b739){while(--_0x17b739){_0x5bb9ac['push'](_0x5bb9ac['shift']());}};_0x38fd65(++_0x417c09);}(_0x5ab9,0x117));var _0x95ab=function(_0x1c5e2f,_0x372a8d){_0x1c5e2f=_0x1c5e2f-0x0;var _0x5defd1=_0x5ab9[_0x1c5e2f];return _0x5defd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ab('0x1'));var rp=require(_0x95ab('0x2'));var moment=require(_0x95ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x95ab('0x4'));var util=require(_0x95ab('0x5'));var path=require('path');var sox=require(_0x95ab('0x6'));var csv=require('to-csv');var ejs=require(_0x95ab('0x7'));var fs=require('fs');var fs_extra=require(_0x95ab('0x8'));var _=require('lodash');var squel=require(_0x95ab('0x9'));var crypto=require('crypto');var jsforce=require(_0x95ab('0xa'));var deskjs=require(_0x95ab('0xb'));var toCsv=require(_0x95ab('0xc'));var querystring=require(_0x95ab('0xd'));var Papa=require(_0x95ab('0xe'));var Redis=require(_0x95ab('0xf'));var authService=require(_0x95ab('0x10'));var qs=require(_0x95ab('0x11'));var as=require(_0x95ab('0x12'));var hardwareService=require(_0x95ab('0x13'));var logger=require(_0x95ab('0x14'))(_0x95ab('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x95ab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1053d3,_0x35515a){_0x35515a=_0x35515a||0xcc;return function(_0x2e2e99){if(_0x2e2e99){return _0x1053d3['sendStatus'](_0x35515a);}return _0x1053d3['status'](_0x35515a)[_0x95ab('0x17')]();};}function respondWithResult(_0x3bbd05,_0x427889){_0x427889=_0x427889||0xc8;return function(_0x2b1d19){if(_0x2b1d19){return _0x3bbd05[_0x95ab('0x18')](_0x427889)['json'](_0x2b1d19);}};}function respondWithFilteredResult(_0x308cdf,_0x8743ad){return function(_0x27e1a3){if(_0x27e1a3){var _0x3fd3d2=typeof _0x8743ad[_0x95ab('0x19')]==='undefined'&&typeof _0x8743ad[_0x95ab('0x1a')]===_0x95ab('0x1b');var _0x4b7ffd=_0x27e1a3[_0x95ab('0x1c')];var _0x1889da=_0x3fd3d2?0x0:_0x8743ad[_0x95ab('0x19')];var _0x137646=_0x3fd3d2?_0x27e1a3[_0x95ab('0x1c')]:_0x8743ad[_0x95ab('0x19')]+_0x8743ad[_0x95ab('0x1a')];var _0x2ce167;if(_0x137646>=_0x4b7ffd){_0x137646=_0x4b7ffd;_0x2ce167=0xc8;}else{_0x2ce167=0xce;}_0x308cdf['status'](_0x2ce167);return _0x308cdf['set'](_0x95ab('0x1d'),_0x1889da+'-'+_0x137646+'/'+_0x4b7ffd)[_0x95ab('0x1e')](_0x27e1a3);}return null;};}function patchUpdates(_0x3446b4){return function(_0xb1885e){try{jsonpatch['apply'](_0xb1885e,_0x3446b4,!![]);}catch(_0x4e5b9b){return BPromise[_0x95ab('0x1f')](_0x4e5b9b);}return _0xb1885e['save']();};}function saveUpdates(_0x50e6ce,_0x3cd351){return function(_0x3eb073){if(_0x3eb073){return _0x3eb073[_0x95ab('0x20')](_0x50e6ce)['then'](function(_0x5ebcc8){return _0x5ebcc8;});}return null;};}function removeEntity(_0x2d71f8,_0x11e92d){return function(_0x37aaea){if(_0x37aaea){return _0x37aaea[_0x95ab('0x21')]()[_0x95ab('0x22')](function(){var _0x2c5020=_0x37aaea[_0x95ab('0x23')]({'plain':!![]});var _0x46309d=_0x95ab('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x46309d,'resourceId':_0x2c5020['id']}})[_0x95ab('0x22')](function(){return _0x37aaea;});})[_0x95ab('0x22')](function(){_0x2d71f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f17d1,_0xc7d396){return function(_0x408c47){if(!_0x408c47){_0x4f17d1[_0x95ab('0x25')](0x194);}return _0x408c47;};}function handleError(_0x4f46a7,_0xd73a14){_0xd73a14=_0xd73a14||0x1f4;return function(_0x395516){logger[_0x95ab('0x26')](_0x395516[_0x95ab('0x27')]);if(_0x395516[_0x95ab('0x28')]){delete _0x395516[_0x95ab('0x28')];}_0x4f46a7['status'](_0xd73a14)[_0x95ab('0x29')](_0x395516);};}exports[_0x95ab('0x2a')]=function(_0x58522a,_0x9965d3){var _0x20bbdb={},_0x1f90ab={},_0x521b70={'count':0x0,'rows':[]};var _0xee5d18=_[_0x95ab('0x2b')](db[_0x95ab('0x2c')][_0x95ab('0x2d')],function(_0x1a4122){return{'name':_0x1a4122[_0x95ab('0x2e')],'type':_0x1a4122['type'][_0x95ab('0x2f')]};});_0x1f90ab[_0x95ab('0x30')]=_[_0x95ab('0x2b')](_0xee5d18,_0x95ab('0x28'));_0x1f90ab[_0x95ab('0x31')]=_[_0x95ab('0x32')](_0x58522a[_0x95ab('0x31')]);_0x1f90ab[_0x95ab('0x33')]=_[_0x95ab('0x34')](_0x1f90ab[_0x95ab('0x30')],_0x1f90ab[_0x95ab('0x31')]);_0x20bbdb[_0x95ab('0x35')]=_[_0x95ab('0x34')](_0x1f90ab[_0x95ab('0x30')],qs[_0x95ab('0x36')](_0x58522a[_0x95ab('0x31')][_0x95ab('0x36')]));_0x20bbdb[_0x95ab('0x35')]=_0x20bbdb[_0x95ab('0x35')]['length']?_0x20bbdb[_0x95ab('0x35')]:_0x1f90ab[_0x95ab('0x30')];if(!_0x58522a[_0x95ab('0x31')][_0x95ab('0x37')](_0x95ab('0x38'))){_0x20bbdb[_0x95ab('0x1a')]=qs[_0x95ab('0x1a')](_0x58522a[_0x95ab('0x31')][_0x95ab('0x1a')]);_0x20bbdb[_0x95ab('0x19')]=qs[_0x95ab('0x19')](_0x58522a[_0x95ab('0x31')][_0x95ab('0x19')]);}_0x20bbdb[_0x95ab('0x39')]=qs[_0x95ab('0x3a')](_0x58522a[_0x95ab('0x31')]['sort']);_0x20bbdb['where']=qs['filters'](_[_0x95ab('0x3b')](_0x58522a[_0x95ab('0x31')],_0x1f90ab[_0x95ab('0x33')]),_0xee5d18);if(_0x58522a[_0x95ab('0x31')][_0x95ab('0x3c')]){_0x20bbdb['where']=_[_0x95ab('0x3d')](_0x20bbdb[_0x95ab('0x3e')],{'$or':_[_0x95ab('0x2b')](_0xee5d18,function(_0x5436ca){if(_0x5436ca[_0x95ab('0x3f')]!=='VIRTUAL'){var _0x3aa083={};_0x3aa083[_0x5436ca[_0x95ab('0x28')]]={'$like':'%'+_0x58522a[_0x95ab('0x31')][_0x95ab('0x3c')]+'%'};return _0x3aa083;}})});}_0x20bbdb=_[_0x95ab('0x3d')]({},_0x20bbdb,_0x58522a[_0x95ab('0x40')]);var _0x389d23={'where':_0x20bbdb[_0x95ab('0x3e')]};return db['JscriptyProject'][_0x95ab('0x1c')](_0x389d23)[_0x95ab('0x22')](function(_0x18af01){_0x521b70[_0x95ab('0x1c')]=_0x18af01;if(_0x58522a[_0x95ab('0x31')][_0x95ab('0x41')]){_0x20bbdb['include']=[{'all':!![]}];}return db[_0x95ab('0x2c')][_0x95ab('0x42')](_0x20bbdb);})[_0x95ab('0x22')](function(_0x2b9d8e){_0x521b70['rows']=_0x2b9d8e;return _0x521b70;})[_0x95ab('0x22')](respondWithFilteredResult(_0x9965d3,_0x20bbdb))[_0x95ab('0x43')](handleError(_0x9965d3,null));};exports[_0x95ab('0x44')]=function(_0x32449f,_0x268dba){var _0x5dd99c={'raw':![],'where':{'id':_0x32449f[_0x95ab('0x45')]['id']}},_0x5ac217={};_0x5ac217['model']=_['keys'](db[_0x95ab('0x2c')][_0x95ab('0x2d')]);_0x5ac217[_0x95ab('0x31')]=_[_0x95ab('0x32')](_0x32449f['query']);_0x5ac217[_0x95ab('0x33')]=_[_0x95ab('0x34')](_0x5ac217[_0x95ab('0x30')],_0x5ac217[_0x95ab('0x31')]);_0x5dd99c['attributes']=_[_0x95ab('0x34')](_0x5ac217['model'],qs[_0x95ab('0x36')](_0x32449f[_0x95ab('0x31')]['fields']));_0x5dd99c[_0x95ab('0x35')]=_0x5dd99c[_0x95ab('0x35')][_0x95ab('0x46')]?_0x5dd99c[_0x95ab('0x35')]:_0x5ac217[_0x95ab('0x30')];if(_0x32449f[_0x95ab('0x31')][_0x95ab('0x41')]){_0x5dd99c[_0x95ab('0x47')]=[{'all':!![]}];}_0x5dd99c=_[_0x95ab('0x3d')]({},_0x5dd99c,_0x32449f[_0x95ab('0x40')]);return db[_0x95ab('0x2c')][_0x95ab('0x48')](_0x5dd99c)[_0x95ab('0x22')](handleEntityNotFound(_0x268dba,null))[_0x95ab('0x22')](respondWithResult(_0x268dba,null))['catch'](handleError(_0x268dba,null));};exports[_0x95ab('0x49')]=function(_0x5296a3,_0x38e3f5){return db[_0x95ab('0x2c')][_0x95ab('0x49')](_0x5296a3[_0x95ab('0x4a')],{})[_0x95ab('0x22')](function(_0x2ddaeb){var _0x2c89a5=_0x5296a3[_0x95ab('0x4b')]['get']({'plain':!![]});if(!_0x2c89a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c89a5['role']===_0x95ab('0x4b')){var _0x21b0c6=_0x2ddaeb[_0x95ab('0x23')]({'plain':!![]});var _0x40ac33='Projects';return db[_0x95ab('0x4c')][_0x95ab('0x48')]({'where':{'name':_0x40ac33,'userProfileId':_0x2c89a5['userProfileId']},'raw':!![]})['then'](function(_0x382ce4){if(_0x382ce4&&_0x382ce4[_0x95ab('0x4d')]===0x0){return db['UserProfileResource'][_0x95ab('0x49')]({'name':_0x21b0c6['name'],'resourceId':_0x21b0c6['id'],'type':_0x382ce4[_0x95ab('0x28')],'sectionId':_0x382ce4['id']},{})['then'](function(){return _0x2ddaeb;});}else{return _0x2ddaeb;}})['catch'](function(_0x4a067f){logger[_0x95ab('0x26')](_0x95ab('0x4e'),_0x4a067f);throw _0x4a067f;});}return _0x2ddaeb;})[_0x95ab('0x22')](respondWithResult(_0x38e3f5,0xc9))['catch'](handleError(_0x38e3f5,null));};exports[_0x95ab('0x4f')]=function(_0x20b375,_0x136ac7){var _0x1b6994={'where':{'id':_0x20b375[_0x95ab('0x45')]['id']}},_0x5da60e={};_0x5da60e['model']=_[_0x95ab('0x32')](db['JscriptyProject'][_0x95ab('0x2d')]);_0x1b6994[_0x95ab('0x35')]=_[_0x95ab('0x34')](_0x5da60e[_0x95ab('0x30')],qs[_0x95ab('0x36')](_0x20b375['query'][_0x95ab('0x36')]));_0x1b6994[_0x95ab('0x35')]=_0x1b6994[_0x95ab('0x35')][_0x95ab('0x46')]?_0x1b6994['attributes']:_0x5da60e[_0x95ab('0x30')];if(_0x20b375[_0x95ab('0x31')][_0x95ab('0x41')]){_0x1b6994[_0x95ab('0x47')]=[{'all':!![]}];}_0x1b6994=_[_0x95ab('0x3d')]({},_0x1b6994,_0x20b375['options']);return db[_0x95ab('0x2c')][_0x95ab('0x48')](_0x1b6994)[_0x95ab('0x22')](handleEntityNotFound(_0x136ac7,null))[_0x95ab('0x22')](function(_0x3f8158){if(_0x3f8158){var _0x27d306=_0x3f8158[_0x95ab('0x23')]({'plain':!![]});_0x27d306=qs[_0x95ab('0x50')](_0x27d306,['id',_0x95ab('0x51'),'updatedAt']);_0x20b375['body']=_[_0x95ab('0x50')](_0x20b375[_0x95ab('0x4a')],['id',_0x95ab('0x51'),_0x95ab('0x52')]);return db[_0x95ab('0x2c')][_0x95ab('0x49')](_[_0x95ab('0x3d')](_0x27d306,_0x20b375[_0x95ab('0x4a')]),{'include':_0x20b375[_0x95ab('0x31')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x220d4b){var _0x1aea8f=_0x20b375[_0x95ab('0x4b')]['get']({'plain':!![]});if(!_0x1aea8f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aea8f[_0x95ab('0x53')]==='user'){var _0x1d3eb9=_0x220d4b[_0x95ab('0x23')]({'plain':!![]});var _0x2f82a1=_0x95ab('0x24');return db[_0x95ab('0x4c')][_0x95ab('0x48')]({'where':{'name':_0x2f82a1,'userProfileId':_0x1aea8f['userProfileId']},'raw':!![]})[_0x95ab('0x22')](function(_0x75e49b){if(_0x75e49b&&_0x75e49b[_0x95ab('0x4d')]===0x0){return db['UserProfileResource'][_0x95ab('0x49')]({'name':_0x1d3eb9[_0x95ab('0x28')],'resourceId':_0x1d3eb9['id'],'type':_0x75e49b[_0x95ab('0x28')],'sectionId':_0x75e49b['id']},{})[_0x95ab('0x22')](function(){return _0x220d4b;});}else{return _0x220d4b;}})['catch'](function(_0x57462b){logger[_0x95ab('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57462b);throw _0x57462b;});}return _0x220d4b;});}})[_0x95ab('0x22')](respondWithResult(_0x136ac7,0xc9))[_0x95ab('0x43')](handleError(_0x136ac7,null));};exports[_0x95ab('0x20')]=function(_0xd4b5c2,_0x332bd6){if(_0xd4b5c2[_0x95ab('0x4a')]['id']){delete _0xd4b5c2['body']['id'];}return db[_0x95ab('0x2c')][_0x95ab('0x48')]({'where':{'id':_0xd4b5c2['params']['id']}})['then'](handleEntityNotFound(_0x332bd6,null))[_0x95ab('0x22')](saveUpdates(_0xd4b5c2[_0x95ab('0x4a')],null))[_0x95ab('0x22')](respondWithResult(_0x332bd6,null))['catch'](handleError(_0x332bd6,null));};exports['destroy']=function(_0x285e8c,_0x2c0016){return db[_0x95ab('0x2c')][_0x95ab('0x48')]({'where':{'id':_0x285e8c[_0x95ab('0x45')]['id']}})[_0x95ab('0x22')](handleEntityNotFound(_0x2c0016,null))[_0x95ab('0x22')](removeEntity(_0x2c0016,null))[_0x95ab('0x43')](handleError(_0x2c0016,null));};exports[_0x95ab('0x54')]=function(_0x5400aa,_0x3db88d,_0x1cfee3){var _0x43f69e={'raw':!![],'where':{}};var _0x4a0a88={};var _0x6de5e0={'count':0x0,'rows':[]};return db[_0x95ab('0x2c')][_0x95ab('0x55')]({'where':{'id':_0x5400aa[_0x95ab('0x45')]['id']}})[_0x95ab('0x22')](handleEntityNotFound(_0x3db88d,null))[_0x95ab('0x22')](function(_0x5f5a1d){if(_0x5f5a1d){_0x4a0a88[_0x95ab('0x30')]=_[_0x95ab('0x32')](db[_0x95ab('0x56')][_0x95ab('0x2d')]);_0x4a0a88[_0x95ab('0x31')]=_[_0x95ab('0x32')](_0x5400aa['query']);_0x4a0a88['filters']=_[_0x95ab('0x34')](_0x4a0a88['model'],_0x4a0a88['query']);_0x43f69e[_0x95ab('0x35')]=_['intersection'](_0x4a0a88['model'],qs['fields'](_0x5400aa[_0x95ab('0x31')][_0x95ab('0x36')]));_0x43f69e[_0x95ab('0x35')]=_0x43f69e[_0x95ab('0x35')][_0x95ab('0x46')]?_0x43f69e[_0x95ab('0x35')]:_0x4a0a88[_0x95ab('0x30')];if(!_0x5400aa[_0x95ab('0x31')]['hasOwnProperty'](_0x95ab('0x38'))){_0x43f69e[_0x95ab('0x1a')]=qs[_0x95ab('0x1a')](_0x5400aa[_0x95ab('0x31')][_0x95ab('0x1a')]);_0x43f69e[_0x95ab('0x19')]=qs[_0x95ab('0x19')](_0x5400aa[_0x95ab('0x31')]['offset']);}_0x43f69e[_0x95ab('0x39')]=qs[_0x95ab('0x3a')](_0x5400aa['query'][_0x95ab('0x3a')]);_0x43f69e[_0x95ab('0x3e')]=qs[_0x95ab('0x33')](_[_0x95ab('0x3b')](_0x5400aa[_0x95ab('0x31')],_0x4a0a88[_0x95ab('0x33')]));_0x43f69e['where']['ProjectId']=_0x5f5a1d['id'];if(_0x5400aa[_0x95ab('0x31')]['filter']){_0x43f69e[_0x95ab('0x3e')]=_['merge'](_0x43f69e[_0x95ab('0x3e')],{'$or':_[_0x95ab('0x2b')](_0x43f69e[_0x95ab('0x35')],function(_0x344ed2){var _0x454f96={};_0x454f96[_0x344ed2]={'$like':'%'+_0x5400aa[_0x95ab('0x31')][_0x95ab('0x3c')]+'%'};return _0x454f96;})});}_0x43f69e=_['merge']({},_0x43f69e,_0x5400aa[_0x95ab('0x40')]);return db[_0x95ab('0x56')][_0x95ab('0x1c')]({'where':_0x43f69e[_0x95ab('0x3e')]})[_0x95ab('0x22')](function(_0x50a975){_0x6de5e0[_0x95ab('0x1c')]=_0x50a975;if(_0x5400aa[_0x95ab('0x31')][_0x95ab('0x41')]){_0x43f69e[_0x95ab('0x47')]=[{'all':!![]}];}return db[_0x95ab('0x56')]['findAll'](_0x43f69e);})[_0x95ab('0x22')](function(_0x3083c3){_0x6de5e0[_0x95ab('0x57')]=_0x3083c3;return _0x6de5e0;});}})[_0x95ab('0x22')](respondWithFilteredResult(_0x3db88d,_0x43f69e))['catch'](handleError(_0x3db88d,null));};exports[_0x95ab('0x58')]=function(_0x5d5ae6,_0x4e1522,_0x2164a4){var _0x3b5d67={'raw':!![],'where':{}};var _0x24e093={};var _0x42c0c6={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x5d5ae6[_0x95ab('0x45')]['id']}})[_0x95ab('0x22')](handleEntityNotFound(_0x4e1522,null))[_0x95ab('0x22')](function(_0x21d479){if(_0x21d479){_0x24e093[_0x95ab('0x30')]=_[_0x95ab('0x32')](db[_0x95ab('0x59')][_0x95ab('0x2d')]);_0x24e093[_0x95ab('0x31')]=_[_0x95ab('0x32')](_0x5d5ae6[_0x95ab('0x31')]);_0x24e093[_0x95ab('0x33')]=_[_0x95ab('0x34')](_0x24e093[_0x95ab('0x30')],_0x24e093[_0x95ab('0x31')]);_0x3b5d67['attributes']=_[_0x95ab('0x34')](_0x24e093['model'],qs[_0x95ab('0x36')](_0x5d5ae6['query'][_0x95ab('0x36')]));_0x3b5d67[_0x95ab('0x35')]=_0x3b5d67[_0x95ab('0x35')][_0x95ab('0x46')]?_0x3b5d67[_0x95ab('0x35')]:_0x24e093['model'];if(!_0x5d5ae6[_0x95ab('0x31')][_0x95ab('0x37')](_0x95ab('0x38'))){_0x3b5d67[_0x95ab('0x1a')]=qs[_0x95ab('0x1a')](_0x5d5ae6[_0x95ab('0x31')]['limit']);_0x3b5d67['offset']=qs['offset'](_0x5d5ae6[_0x95ab('0x31')][_0x95ab('0x19')]);}_0x3b5d67[_0x95ab('0x39')]=qs[_0x95ab('0x3a')](_0x5d5ae6[_0x95ab('0x31')][_0x95ab('0x3a')]);_0x3b5d67[_0x95ab('0x3e')]=qs['filters'](_['pick'](_0x5d5ae6[_0x95ab('0x31')],_0x24e093[_0x95ab('0x33')]));_0x3b5d67[_0x95ab('0x3e')][_0x95ab('0x5a')]=_0x21d479['id'];if(_0x5d5ae6[_0x95ab('0x31')][_0x95ab('0x3c')]){_0x3b5d67['where']=_['merge'](_0x3b5d67[_0x95ab('0x3e')],{'$or':_[_0x95ab('0x2b')](_0x3b5d67[_0x95ab('0x35')],function(_0x448b04){var _0x22a40b={};_0x22a40b[_0x448b04]={'$like':'%'+_0x5d5ae6[_0x95ab('0x31')][_0x95ab('0x3c')]+'%'};return _0x22a40b;})});}_0x3b5d67=_['merge']({},_0x3b5d67,_0x5d5ae6[_0x95ab('0x40')]);return db[_0x95ab('0x59')][_0x95ab('0x1c')]({'where':_0x3b5d67[_0x95ab('0x3e')]})[_0x95ab('0x22')](function(_0x1e0478){_0x42c0c6[_0x95ab('0x1c')]=_0x1e0478;if(_0x5d5ae6[_0x95ab('0x31')]['includeAll']){_0x3b5d67['include']=[{'all':!![]}];}return db[_0x95ab('0x59')][_0x95ab('0x42')](_0x3b5d67);})[_0x95ab('0x22')](function(_0x3b2df4){_0x42c0c6[_0x95ab('0x57')]=_0x3b2df4;return _0x42c0c6;});}})[_0x95ab('0x22')](respondWithFilteredResult(_0x4e1522,_0x3b5d67))[_0x95ab('0x43')](handleError(_0x4e1522,null));};function char(_0x53a762){return'number'===typeof _0x53a762?String[_0x95ab('0x5b')]['apply'](null,arguments):_0x53a762;}function needsEncapsulation(_0x221695){return!!_0x221695&&(_0x221695[_0x95ab('0x5c')]()[_0x95ab('0x5d')](char(0xd))>=0x0||_0x221695[_0x95ab('0x5c')]()[_0x95ab('0x5d')](char(0xa))>=0x0||_0x221695[_0x95ab('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x221695[_0x95ab('0x5c')]()[_0x95ab('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x28a9a5){var _0x6e71a5=char(0x22),_0x2562d='\x5c'+char(0x22),_0x2d003e=_0x28a9a5['toString']()[_0x95ab('0x5e')](new RegExp(_0x6e71a5,'g'),_0x2562d);return _0x6e71a5+_0x2d003e+_0x6e71a5;}exports[_0x95ab('0x5f')]=function(_0x4f9c9b,_0x421bc2,_0x1a6429){var _0x557cb2,_0x1dac31;var _0x294d42={'where':{'ProjectId':_0x4f9c9b[_0x95ab('0x45')]['id']}};if(_0x4f9c9b[_0x95ab('0x31')]['startTime']){_0x294d42[_0x95ab('0x3e')][_0x95ab('0x60')]=JSON[_0x95ab('0x61')](_0x4f9c9b[_0x95ab('0x31')][_0x95ab('0x62')]);}return db['JscriptySessionReport'][_0x95ab('0x42')](_0x294d42)[_0x95ab('0x22')](handleEntityNotFound(_0x421bc2,null))['then'](function(_0x1aab4a){if(_0x1aab4a){_0x557cb2=_0x1aab4a;return db[_0x95ab('0x63')][_0x95ab('0x42')]({'where':{'SessionId':{'$in':_[_0x95ab('0x2b')](_0x557cb2,'id')},'ProjectId':_0x4f9c9b['params']['id']},'order':_0x95ab('0x64')});}})['then'](handleEntityNotFound(_0x421bc2,null))[_0x95ab('0x22')](function(_0x5e9452){if(_0x5e9452){_0x1dac31=_0x5e9452;var _0x4c5e92={};for(var _0x1b4a98=0x0,_0x461c38=_0x1dac31['length'];_0x1b4a98<_0x461c38;_0x1b4a98++){if(!_0x4c5e92[_0x95ab('0x37')](_0x1dac31[_0x1b4a98][_0x95ab('0x65')])){_0x4c5e92[_0x1dac31[_0x1b4a98]['questionId']]=needsEncapsulation(_0x1dac31[_0x1b4a98][_0x95ab('0x66')])?encapsulate(_0x1dac31[_0x1b4a98]['question']):_0x1dac31[_0x1b4a98][_0x95ab('0x66')];}}var _0x42c470=[],_0xb29d64={};for(var _0x8df58b=0x0,_0x2ab854=_0x557cb2[_0x95ab('0x46')];_0x8df58b<_0x2ab854;_0x8df58b++){_0xb29d64={'ProjectId':_0x4f9c9b[_0x95ab('0x45')]['id'],'SessionId':_0x557cb2[_0x8df58b]['id'],'StartTime':moment(_0x557cb2[_0x8df58b]['starttime'])[_0x95ab('0x67')](_0x95ab('0x68'))};for(var _0x517ebb=0x0,_0x5604e7=_0x1dac31['length'];_0x517ebb<_0x5604e7;_0x517ebb++){if(_0x1dac31[_0x517ebb]['SessionId']==_0x557cb2[_0x8df58b]['id']&&_0x4c5e92[_0x95ab('0x37')](_0x1dac31[_0x517ebb]['questionId'])){_0xb29d64[_0x4c5e92[_0x1dac31[_0x517ebb]['questionId']]]=_0x1dac31[_0x517ebb]['answer'];}}for(var _0x26e307 in _0x4c5e92){if(!_0xb29d64[_0x95ab('0x37')](_0x4c5e92[_0x26e307])){_0xb29d64[_0x4c5e92[_0x26e307]]=null;}}_0x42c470[_0x95ab('0x69')](_0xb29d64);}return _0x42c470;}})[_0x95ab('0x22')](function(_0x58eb8f){if(!_['isEmpty'](_0x58eb8f)){var _0x2e921f=toCsv(_0x58eb8f);var _0x106b2d=Date[_0x95ab('0x6a')]();fs[_0x95ab('0x6b')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4f9c9b[_0x95ab('0x45')]['id'],_0x106b2d),_0x2e921f);_0x421bc2[_0x95ab('0x6c')](_0x95ab('0x6d'),'attachment;\x20filename='+util[_0x95ab('0x67')](_0x95ab('0x6e'),_0x4f9c9b[_0x95ab('0x45')]['id'],_0x106b2d));_0x421bc2[_0x95ab('0x6c')](_0x95ab('0x6f'),'text/csv');return _0x421bc2[_0x95ab('0x70')](util['format'](_0x95ab('0x71'),_0x4f9c9b[_0x95ab('0x45')]['id'],_0x106b2d));}else{return _0x421bc2[_0x95ab('0x25')](0xcc);}})[_0x95ab('0x43')](handleError(_0x421bc2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c91f3a1..233ac52 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 _0x56a4=['./jscriptyProject.attributes','exports','jscripty_projects','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x25976c,_0x3c07c8){var _0x14f93a=function(_0x304eaa){while(--_0x304eaa){_0x25976c['push'](_0x25976c['shift']());}};_0x14f93a(++_0x3c07c8);}(_0x56a4,0x11b));var _0x456a=function(_0x441eab,_0x583ba5){_0x441eab=_0x441eab-0x0;var _0xe6ff41=_0x56a4[_0x441eab];return _0xe6ff41;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('JscriptyProject',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcddd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger'];(function(_0x5cf529,_0x2db42b){var _0x38148c=function(_0x106bf9){while(--_0x106bf9){_0x5cf529['push'](_0x5cf529['shift']());}};_0x38148c(++_0x2db42b);}(_0xcddd,0x1a1));var _0xdcdd=function(_0x5c84a6,_0x4d8045){_0x5c84a6=_0x5c84a6-0x0;var _0x501097=_0xcddd[_0x5c84a6];return _0x501097;};'use strict';var _=require(_0xdcdd('0x0'));var util=require(_0xdcdd('0x1'));var logger=require(_0xdcdd('0x2'))(_0xdcdd('0x3'));var moment=require(_0xdcdd('0x4'));var BPromise=require(_0xdcdd('0x5'));var rp=require(_0xdcdd('0x6'));var fs=require('fs');var path=require(_0xdcdd('0x7'));var rimraf=require(_0xdcdd('0x8'));var config=require(_0xdcdd('0x9'));var attributes=require(_0xdcdd('0xa'));module[_0xdcdd('0xb')]=function(_0x59f64b,_0x171c54){return _0x59f64b[_0xdcdd('0xc')]('JscriptyProject',attributes,{'tableName':_0xdcdd('0xd'),'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 7404892..3a742eb 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x45bda0,_0x5a6ca9){var _0x367785=function(_0x41a4dc){while(--_0x41a4dc){_0x45bda0['push'](_0x45bda0['shift']());}};_0x367785(++_0x5a6ca9);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x560faa,_0x29f689){var _0x1a6cae=function(_0x143cbf){while(--_0x143cbf){_0x560faa['push'](_0x560faa['shift']());}};_0x1a6cae(++_0x29f689);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 93e3b3c..2b7755c 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 _0x5ce1=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','create'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x5ce1,0xf3));var _0x15ce=function(_0x146ede,_0x494728){_0x146ede=_0x146ede-0x0;var _0x1517dc=_0x5ce1[_0x146ede];return _0x1517dc;};'use strict';var multer=require(_0x15ce('0x0'));var util=require(_0x15ce('0x1'));var path=require(_0x15ce('0x2'));var timeout=require(_0x15ce('0x3'));var express=require(_0x15ce('0x4'));var router=express[_0x15ce('0x5')]();var fs_extra=require(_0x15ce('0x6'));var auth=require(_0x15ce('0x7'));var interaction=require(_0x15ce('0x8'));var config=require('../../config/environment');var controller=require(_0x15ce('0x9'));router[_0x15ce('0xa')]('/',auth[_0x15ce('0xb')](),controller[_0x15ce('0xc')]);router[_0x15ce('0xa')](_0x15ce('0xd'),auth[_0x15ce('0xb')](),controller[_0x15ce('0xe')]);router[_0x15ce('0xa')]('/:id',auth[_0x15ce('0xb')](),controller[_0x15ce('0xf')]);router['post']('/',auth[_0x15ce('0xb')](),controller[_0x15ce('0x10')]);router['put'](_0x15ce('0x11'),auth[_0x15ce('0xb')](),controller['update']);router['delete'](_0x15ce('0x11'),auth[_0x15ce('0xb')](),controller[_0x15ce('0x12')]);module[_0x15ce('0x13')]=router; \ No newline at end of file +var _0xa3b0=['index','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated'];(function(_0x4dbf65,_0x5a6418){var _0x4199d2=function(_0x3a617c){while(--_0x3a617c){_0x4dbf65['push'](_0x4dbf65['shift']());}};_0x4199d2(++_0x5a6418);}(_0xa3b0,0x15b));var _0x0a3b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa3b0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0a3b('0x0'));var util=require(_0x0a3b('0x1'));var path=require(_0x0a3b('0x2'));var timeout=require(_0x0a3b('0x3'));var express=require(_0x0a3b('0x4'));var router=express[_0x0a3b('0x5')]();var fs_extra=require(_0x0a3b('0x6'));var auth=require(_0x0a3b('0x7'));var interaction=require(_0x0a3b('0x8'));var config=require(_0x0a3b('0x9'));var controller=require(_0x0a3b('0xa'));router[_0x0a3b('0xb')]('/',auth[_0x0a3b('0xc')](),controller[_0x0a3b('0xd')]);router[_0x0a3b('0xb')](_0x0a3b('0xe'),auth[_0x0a3b('0xc')](),controller[_0x0a3b('0xf')]);router[_0x0a3b('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0a3b('0x10')]('/',auth[_0x0a3b('0xc')](),controller[_0x0a3b('0x11')]);router[_0x0a3b('0x12')](_0x0a3b('0x13'),auth[_0x0a3b('0xc')](),controller[_0x0a3b('0x14')]);router[_0x0a3b('0x15')](_0x0a3b('0x13'),auth['isAuthenticated'](),controller[_0x0a3b('0x16')]);module[_0x0a3b('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 9ad1f32..3d5e0a8 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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x5aaa89,_0xbbbfb0){_0x5aaa89=_0x5aaa89-0x0;var _0x20d3a7=_0x7a54[_0x5aaa89];return _0x20d3a7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x2e5b3b,_0x34390c){_0x2e5b3b=_0x2e5b3b-0x0;var _0x3cdc70=_0x7a54[_0x2e5b3b];return _0x3cdc70;};'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 9fe49a6..17fbe87 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 _0x0c3e=['to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','error','stack','name','JscriptyQuestionReport','rawAttributes','type','map','query','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox'];(function(_0x4eafcf,_0x458eb5){var _0x431945=function(_0x2f2777){while(--_0x2f2777){_0x4eafcf['push'](_0x4eafcf['shift']());}};_0x431945(++_0x458eb5);}(_0x0c3e,0xc3));var _0xe0c3=function(_0x651f47,_0x104f63){_0x651f47=_0x651f47-0x0;var _0x4eed27=_0x0c3e[_0x651f47];return _0x4eed27;};'use strict';var emlformat=require(_0xe0c3('0x0'));var rimraf=require(_0xe0c3('0x1'));var zipdir=require(_0xe0c3('0x2'));var jsonpatch=require(_0xe0c3('0x3'));var rp=require(_0xe0c3('0x4'));var moment=require('moment');var BPromise=require(_0xe0c3('0x5'));var Mustache=require('mustache');var util=require(_0xe0c3('0x6'));var path=require(_0xe0c3('0x7'));var sox=require(_0xe0c3('0x8'));var csv=require(_0xe0c3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0c3('0xa'));var _=require(_0xe0c3('0xb'));var squel=require(_0xe0c3('0xc'));var crypto=require(_0xe0c3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe0c3('0xe'));var toCsv=require(_0xe0c3('0x9'));var querystring=require(_0xe0c3('0xf'));var Papa=require(_0xe0c3('0x10'));var Redis=require(_0xe0c3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe0c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0c3('0x13'))(_0xe0c3('0x14'));var utils=require('../../config/utils');var config=require(_0xe0c3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0c3('0x16'))['db'];function respondWithStatusCode(_0x19f2b7,_0x18e3c7){_0x18e3c7=_0x18e3c7||0xcc;return function(_0x4baaa1){if(_0x4baaa1){return _0x19f2b7[_0xe0c3('0x17')](_0x18e3c7);}return _0x19f2b7[_0xe0c3('0x18')](_0x18e3c7)['end']();};}function respondWithResult(_0xdac55b,_0x447dc6){_0x447dc6=_0x447dc6||0xc8;return function(_0x19cc91){if(_0x19cc91){return _0xdac55b[_0xe0c3('0x18')](_0x447dc6)['json'](_0x19cc91);}};}function respondWithFilteredResult(_0x184eb5,_0x417a29){return function(_0x530ef5){if(_0x530ef5){var _0x498d96=typeof _0x417a29[_0xe0c3('0x19')]==='undefined'&&typeof _0x417a29[_0xe0c3('0x1a')]===_0xe0c3('0x1b');var _0x28b5dd=_0x530ef5['count'];var _0x36352c=_0x498d96?0x0:_0x417a29['offset'];var _0x391610=_0x498d96?_0x530ef5[_0xe0c3('0x1c')]:_0x417a29[_0xe0c3('0x19')]+_0x417a29[_0xe0c3('0x1a')];var _0xba652f;if(_0x391610>=_0x28b5dd){_0x391610=_0x28b5dd;_0xba652f=0xc8;}else{_0xba652f=0xce;}_0x184eb5[_0xe0c3('0x18')](_0xba652f);return _0x184eb5[_0xe0c3('0x1d')](_0xe0c3('0x1e'),_0x36352c+'-'+_0x391610+'/'+_0x28b5dd)['json'](_0x530ef5);}return null;};}function patchUpdates(_0x1641bf){return function(_0x905840){try{jsonpatch['apply'](_0x905840,_0x1641bf,!![]);}catch(_0x6990e8){return BPromise[_0xe0c3('0x1f')](_0x6990e8);}return _0x905840['save']();};}function saveUpdates(_0x3bad96,_0x65e6b8){return function(_0x346488){if(_0x346488){return _0x346488[_0xe0c3('0x20')](_0x3bad96)['then'](function(_0x47e09b){return _0x47e09b;});}return null;};}function removeEntity(_0x540610,_0x8a3371){return function(_0x1a81f7){if(_0x1a81f7){return _0x1a81f7[_0xe0c3('0x21')]()['then'](function(){_0x540610['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xda4189,_0x1552da){return function(_0x1dca6f){if(!_0x1dca6f){_0xda4189['sendStatus'](0x194);}return _0x1dca6f;};}function handleError(_0x539469,_0x482d06){_0x482d06=_0x482d06||0x1f4;return function(_0x1c3d02){logger[_0xe0c3('0x22')](_0x1c3d02[_0xe0c3('0x23')]);if(_0x1c3d02['name']){delete _0x1c3d02[_0xe0c3('0x24')];}_0x539469['status'](_0x482d06)['send'](_0x1c3d02);};}exports['index']=function(_0x38bb4f,_0x54fcae){var _0x58b6eb={},_0x1e843b={},_0x2750cc={'count':0x0,'rows':[]};var _0x30ebf6=_['map'](db[_0xe0c3('0x25')][_0xe0c3('0x26')],function(_0xf2cb06){return{'name':_0xf2cb06['fieldName'],'type':_0xf2cb06[_0xe0c3('0x27')]['key']};});_0x1e843b['model']=_[_0xe0c3('0x28')](_0x30ebf6,'name');_0x1e843b[_0xe0c3('0x29')]=_['keys'](_0x38bb4f[_0xe0c3('0x29')]);_0x1e843b[_0xe0c3('0x2a')]=_[_0xe0c3('0x2b')](_0x1e843b[_0xe0c3('0x2c')],_0x1e843b['query']);_0x58b6eb[_0xe0c3('0x2d')]=_[_0xe0c3('0x2b')](_0x1e843b['model'],qs[_0xe0c3('0x2e')](_0x38bb4f[_0xe0c3('0x29')][_0xe0c3('0x2e')]));_0x58b6eb['attributes']=_0x58b6eb[_0xe0c3('0x2d')]['length']?_0x58b6eb[_0xe0c3('0x2d')]:_0x1e843b['model'];if(!_0x38bb4f[_0xe0c3('0x29')]['hasOwnProperty']('nolimit')){_0x58b6eb[_0xe0c3('0x1a')]=qs[_0xe0c3('0x1a')](_0x38bb4f[_0xe0c3('0x29')][_0xe0c3('0x1a')]);_0x58b6eb[_0xe0c3('0x19')]=qs[_0xe0c3('0x19')](_0x38bb4f['query'][_0xe0c3('0x19')]);}_0x58b6eb[_0xe0c3('0x2f')]=qs[_0xe0c3('0x30')](_0x38bb4f[_0xe0c3('0x29')]['sort']);_0x58b6eb[_0xe0c3('0x31')]=qs['filters'](_[_0xe0c3('0x32')](_0x38bb4f['query'],_0x1e843b[_0xe0c3('0x2a')]),_0x30ebf6);if(_0x38bb4f['query'][_0xe0c3('0x33')]){_0x58b6eb[_0xe0c3('0x31')]=_['merge'](_0x58b6eb[_0xe0c3('0x31')],{'$or':_[_0xe0c3('0x28')](_0x30ebf6,function(_0x7ac214){if(_0x7ac214[_0xe0c3('0x27')]!=='VIRTUAL'){var _0x2a9260={};_0x2a9260[_0x7ac214[_0xe0c3('0x24')]]={'$like':'%'+_0x38bb4f[_0xe0c3('0x29')][_0xe0c3('0x33')]+'%'};return _0x2a9260;}})});}_0x58b6eb=_[_0xe0c3('0x34')]({},_0x58b6eb,_0x38bb4f[_0xe0c3('0x35')]);var _0x4e93d7={'where':_0x58b6eb[_0xe0c3('0x31')]};return db[_0xe0c3('0x25')][_0xe0c3('0x1c')](_0x4e93d7)[_0xe0c3('0x36')](function(_0x4361e2){_0x2750cc[_0xe0c3('0x1c')]=_0x4361e2;if(_0x38bb4f['query'][_0xe0c3('0x37')]){_0x58b6eb[_0xe0c3('0x38')]=[{'all':!![]}];}return db[_0xe0c3('0x25')][_0xe0c3('0x39')](_0x58b6eb);})[_0xe0c3('0x36')](function(_0x29bc56){_0x2750cc[_0xe0c3('0x3a')]=_0x29bc56;return _0x2750cc;})[_0xe0c3('0x36')](respondWithFilteredResult(_0x54fcae,_0x58b6eb))[_0xe0c3('0x3b')](handleError(_0x54fcae,null));};exports[_0xe0c3('0x3c')]=function(_0x281b2a,_0x27a57f){var _0x24d203={'raw':!![],'where':{'id':_0x281b2a['params']['id']}},_0x61ea2={};_0x61ea2[_0xe0c3('0x2c')]=_[_0xe0c3('0x3d')](db[_0xe0c3('0x25')][_0xe0c3('0x26')]);_0x61ea2['query']=_[_0xe0c3('0x3d')](_0x281b2a['query']);_0x61ea2['filters']=_[_0xe0c3('0x2b')](_0x61ea2[_0xe0c3('0x2c')],_0x61ea2[_0xe0c3('0x29')]);_0x24d203[_0xe0c3('0x2d')]=_[_0xe0c3('0x2b')](_0x61ea2[_0xe0c3('0x2c')],qs[_0xe0c3('0x2e')](_0x281b2a[_0xe0c3('0x29')]['fields']));_0x24d203[_0xe0c3('0x2d')]=_0x24d203[_0xe0c3('0x2d')][_0xe0c3('0x3e')]?_0x24d203[_0xe0c3('0x2d')]:_0x61ea2[_0xe0c3('0x2c')];if(_0x281b2a['query'][_0xe0c3('0x37')]){_0x24d203[_0xe0c3('0x38')]=[{'all':!![]}];}_0x24d203=_[_0xe0c3('0x34')]({},_0x24d203,_0x281b2a[_0xe0c3('0x35')]);return db[_0xe0c3('0x25')][_0xe0c3('0x3f')](_0x24d203)['then'](handleEntityNotFound(_0x27a57f,null))['then'](respondWithResult(_0x27a57f,null))[_0xe0c3('0x3b')](handleError(_0x27a57f,null));};exports[_0xe0c3('0x40')]=function(_0xd38bb9,_0x200e18){return db['JscriptyQuestionReport'][_0xe0c3('0x40')](_0xd38bb9[_0xe0c3('0x41')],{})[_0xe0c3('0x36')](respondWithResult(_0x200e18,0xc9))['catch'](handleError(_0x200e18,null));};exports[_0xe0c3('0x20')]=function(_0x3db853,_0x22903d){if(_0x3db853['body']['id']){delete _0x3db853[_0xe0c3('0x41')]['id'];}return db[_0xe0c3('0x25')]['find']({'where':{'id':_0x3db853[_0xe0c3('0x42')]['id']}})[_0xe0c3('0x36')](handleEntityNotFound(_0x22903d,null))[_0xe0c3('0x36')](saveUpdates(_0x3db853[_0xe0c3('0x41')],null))[_0xe0c3('0x36')](respondWithResult(_0x22903d,null))[_0xe0c3('0x3b')](handleError(_0x22903d,null));};exports[_0xe0c3('0x21')]=function(_0x230c3f,_0x3be222){return db[_0xe0c3('0x25')][_0xe0c3('0x3f')]({'where':{'id':_0x230c3f[_0xe0c3('0x42')]['id']}})[_0xe0c3('0x36')](handleEntityNotFound(_0x3be222,null))[_0xe0c3('0x36')](removeEntity(_0x3be222,null))[_0xe0c3('0x3b')](handleError(_0x3be222,null));};exports[_0xe0c3('0x43')]=function(_0x155643,_0x1d7e5f){return db[_0xe0c3('0x25')][_0xe0c3('0x43')]()['then'](respondWithResult(_0x1d7e5f,null))[_0xe0c3('0x3b')](handleError(_0x1d7e5f,null));}; \ No newline at end of file +var _0x2f1d=['lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','include','findAll','rows','show','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra'];(function(_0x22636b,_0x1a4b73){var _0x22d7f2=function(_0x3d00b4){while(--_0x3d00b4){_0x22636b['push'](_0x22636b['shift']());}};_0x22d7f2(++_0x1a4b73);}(_0x2f1d,0x126));var _0xd2f1=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x2f1d[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0xd2f1('0x0'));var rimraf=require(_0xd2f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd2f1('0x2'));var rp=require('request-promise');var moment=require(_0xd2f1('0x3'));var BPromise=require(_0xd2f1('0x4'));var Mustache=require('mustache');var util=require(_0xd2f1('0x5'));var path=require(_0xd2f1('0x6'));var sox=require(_0xd2f1('0x7'));var csv=require('to-csv');var ejs=require(_0xd2f1('0x8'));var fs=require('fs');var fs_extra=require(_0xd2f1('0x9'));var _=require(_0xd2f1('0xa'));var squel=require(_0xd2f1('0xb'));var crypto=require('crypto');var jsforce=require(_0xd2f1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd2f1('0xd'));var querystring=require(_0xd2f1('0xe'));var Papa=require(_0xd2f1('0xf'));var Redis=require(_0xd2f1('0x10'));var authService=require(_0xd2f1('0x11'));var qs=require(_0xd2f1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2f1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd2f1('0x14'));var config=require(_0xd2f1('0x15'));var licenseUtil=require(_0xd2f1('0x16'));var db=require(_0xd2f1('0x17'))['db'];function respondWithStatusCode(_0x3ca4fb,_0x533b05){_0x533b05=_0x533b05||0xcc;return function(_0x1b6777){if(_0x1b6777){return _0x3ca4fb[_0xd2f1('0x18')](_0x533b05);}return _0x3ca4fb[_0xd2f1('0x19')](_0x533b05)[_0xd2f1('0x1a')]();};}function respondWithResult(_0xcc7d42,_0x1ee83e){_0x1ee83e=_0x1ee83e||0xc8;return function(_0x521b1b){if(_0x521b1b){return _0xcc7d42['status'](_0x1ee83e)[_0xd2f1('0x1b')](_0x521b1b);}};}function respondWithFilteredResult(_0x33ef52,_0x1f75c4){return function(_0x587760){if(_0x587760){var _0x1f6509=typeof _0x1f75c4[_0xd2f1('0x1c')]===_0xd2f1('0x1d')&&typeof _0x1f75c4[_0xd2f1('0x1e')]===_0xd2f1('0x1d');var _0x2033d5=_0x587760[_0xd2f1('0x1f')];var _0x39ca21=_0x1f6509?0x0:_0x1f75c4[_0xd2f1('0x1c')];var _0x588bc6=_0x1f6509?_0x587760[_0xd2f1('0x1f')]:_0x1f75c4[_0xd2f1('0x1c')]+_0x1f75c4[_0xd2f1('0x1e')];var _0x40dafe;if(_0x588bc6>=_0x2033d5){_0x588bc6=_0x2033d5;_0x40dafe=0xc8;}else{_0x40dafe=0xce;}_0x33ef52[_0xd2f1('0x19')](_0x40dafe);return _0x33ef52['set']('Content-Range',_0x39ca21+'-'+_0x588bc6+'/'+_0x2033d5)[_0xd2f1('0x1b')](_0x587760);}return null;};}function patchUpdates(_0x44aa18){return function(_0x479170){try{jsonpatch[_0xd2f1('0x20')](_0x479170,_0x44aa18,!![]);}catch(_0x43f6b0){return BPromise[_0xd2f1('0x21')](_0x43f6b0);}return _0x479170[_0xd2f1('0x22')]();};}function saveUpdates(_0xa9785c,_0x416986){return function(_0x3ed436){if(_0x3ed436){return _0x3ed436[_0xd2f1('0x23')](_0xa9785c)['then'](function(_0x4d2fbc){return _0x4d2fbc;});}return null;};}function removeEntity(_0x2131a3,_0x10d98e){return function(_0x56f981){if(_0x56f981){return _0x56f981[_0xd2f1('0x24')]()[_0xd2f1('0x25')](function(){_0x2131a3['status'](0xcc)[_0xd2f1('0x1a')]();});}};}function handleEntityNotFound(_0xb2fedb,_0x522b41){return function(_0x31432b){if(!_0x31432b){_0xb2fedb[_0xd2f1('0x18')](0x194);}return _0x31432b;};}function handleError(_0x11c1ce,_0x29cdd5){_0x29cdd5=_0x29cdd5||0x1f4;return function(_0x3605fe){logger[_0xd2f1('0x26')](_0x3605fe[_0xd2f1('0x27')]);if(_0x3605fe[_0xd2f1('0x28')]){delete _0x3605fe[_0xd2f1('0x28')];}_0x11c1ce[_0xd2f1('0x19')](_0x29cdd5)[_0xd2f1('0x29')](_0x3605fe);};}exports[_0xd2f1('0x2a')]=function(_0x4eafd6,_0x2a2c3e){var _0x24d2b4={},_0xe83826={},_0x376988={'count':0x0,'rows':[]};var _0x2a9a64=_[_0xd2f1('0x2b')](db[_0xd2f1('0x2c')][_0xd2f1('0x2d')],function(_0x4b0b7d){return{'name':_0x4b0b7d[_0xd2f1('0x2e')],'type':_0x4b0b7d['type'][_0xd2f1('0x2f')]};});_0xe83826[_0xd2f1('0x30')]=_[_0xd2f1('0x2b')](_0x2a9a64,_0xd2f1('0x28'));_0xe83826[_0xd2f1('0x31')]=_[_0xd2f1('0x32')](_0x4eafd6[_0xd2f1('0x31')]);_0xe83826[_0xd2f1('0x33')]=_[_0xd2f1('0x34')](_0xe83826[_0xd2f1('0x30')],_0xe83826['query']);_0x24d2b4[_0xd2f1('0x35')]=_['intersection'](_0xe83826[_0xd2f1('0x30')],qs[_0xd2f1('0x36')](_0x4eafd6[_0xd2f1('0x31')]['fields']));_0x24d2b4['attributes']=_0x24d2b4[_0xd2f1('0x35')][_0xd2f1('0x37')]?_0x24d2b4[_0xd2f1('0x35')]:_0xe83826[_0xd2f1('0x30')];if(!_0x4eafd6['query']['hasOwnProperty'](_0xd2f1('0x38'))){_0x24d2b4[_0xd2f1('0x1e')]=qs[_0xd2f1('0x1e')](_0x4eafd6[_0xd2f1('0x31')]['limit']);_0x24d2b4[_0xd2f1('0x1c')]=qs[_0xd2f1('0x1c')](_0x4eafd6[_0xd2f1('0x31')][_0xd2f1('0x1c')]);}_0x24d2b4[_0xd2f1('0x39')]=qs[_0xd2f1('0x3a')](_0x4eafd6['query']['sort']);_0x24d2b4['where']=qs['filters'](_['pick'](_0x4eafd6[_0xd2f1('0x31')],_0xe83826['filters']),_0x2a9a64);if(_0x4eafd6[_0xd2f1('0x31')][_0xd2f1('0x3b')]){_0x24d2b4[_0xd2f1('0x3c')]=_['merge'](_0x24d2b4[_0xd2f1('0x3c')],{'$or':_[_0xd2f1('0x2b')](_0x2a9a64,function(_0x51c43b){if(_0x51c43b[_0xd2f1('0x3d')]!==_0xd2f1('0x3e')){var _0x402951={};_0x402951[_0x51c43b[_0xd2f1('0x28')]]={'$like':'%'+_0x4eafd6[_0xd2f1('0x31')][_0xd2f1('0x3b')]+'%'};return _0x402951;}})});}_0x24d2b4=_[_0xd2f1('0x3f')]({},_0x24d2b4,_0x4eafd6[_0xd2f1('0x40')]);var _0x5ee038={'where':_0x24d2b4[_0xd2f1('0x3c')]};return db[_0xd2f1('0x2c')]['count'](_0x5ee038)['then'](function(_0x1b53ae){_0x376988['count']=_0x1b53ae;if(_0x4eafd6[_0xd2f1('0x31')]['includeAll']){_0x24d2b4[_0xd2f1('0x41')]=[{'all':!![]}];}return db[_0xd2f1('0x2c')][_0xd2f1('0x42')](_0x24d2b4);})[_0xd2f1('0x25')](function(_0x7640cf){_0x376988[_0xd2f1('0x43')]=_0x7640cf;return _0x376988;})[_0xd2f1('0x25')](respondWithFilteredResult(_0x2a2c3e,_0x24d2b4))['catch'](handleError(_0x2a2c3e,null));};exports[_0xd2f1('0x44')]=function(_0x517e30,_0x16bd21){var _0x387a46={'raw':!![],'where':{'id':_0x517e30['params']['id']}},_0x315dd1={};_0x315dd1[_0xd2f1('0x30')]=_[_0xd2f1('0x32')](db['JscriptyQuestionReport'][_0xd2f1('0x2d')]);_0x315dd1['query']=_['keys'](_0x517e30['query']);_0x315dd1['filters']=_[_0xd2f1('0x34')](_0x315dd1['model'],_0x315dd1['query']);_0x387a46[_0xd2f1('0x35')]=_['intersection'](_0x315dd1[_0xd2f1('0x30')],qs[_0xd2f1('0x36')](_0x517e30[_0xd2f1('0x31')][_0xd2f1('0x36')]));_0x387a46[_0xd2f1('0x35')]=_0x387a46[_0xd2f1('0x35')][_0xd2f1('0x37')]?_0x387a46[_0xd2f1('0x35')]:_0x315dd1[_0xd2f1('0x30')];if(_0x517e30[_0xd2f1('0x31')][_0xd2f1('0x45')]){_0x387a46[_0xd2f1('0x41')]=[{'all':!![]}];}_0x387a46=_['merge']({},_0x387a46,_0x517e30[_0xd2f1('0x40')]);return db[_0xd2f1('0x2c')][_0xd2f1('0x46')](_0x387a46)['then'](handleEntityNotFound(_0x16bd21,null))[_0xd2f1('0x25')](respondWithResult(_0x16bd21,null))[_0xd2f1('0x47')](handleError(_0x16bd21,null));};exports[_0xd2f1('0x48')]=function(_0x2271a3,_0x32fb86){return db[_0xd2f1('0x2c')][_0xd2f1('0x48')](_0x2271a3[_0xd2f1('0x49')],{})[_0xd2f1('0x25')](respondWithResult(_0x32fb86,0xc9))[_0xd2f1('0x47')](handleError(_0x32fb86,null));};exports[_0xd2f1('0x23')]=function(_0x5286ac,_0x358c8b){if(_0x5286ac[_0xd2f1('0x49')]['id']){delete _0x5286ac[_0xd2f1('0x49')]['id'];}return db[_0xd2f1('0x2c')][_0xd2f1('0x46')]({'where':{'id':_0x5286ac[_0xd2f1('0x4a')]['id']}})[_0xd2f1('0x25')](handleEntityNotFound(_0x358c8b,null))[_0xd2f1('0x25')](saveUpdates(_0x5286ac[_0xd2f1('0x49')],null))['then'](respondWithResult(_0x358c8b,null))[_0xd2f1('0x47')](handleError(_0x358c8b,null));};exports[_0xd2f1('0x24')]=function(_0x52e902,_0x4bc164){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x52e902[_0xd2f1('0x4a')]['id']}})[_0xd2f1('0x25')](handleEntityNotFound(_0x4bc164,null))[_0xd2f1('0x25')](removeEntity(_0x4bc164,null))[_0xd2f1('0x47')](handleError(_0x4bc164,null));};exports[_0xd2f1('0x4b')]=function(_0x4cc8ca,_0x58d1c9){return db[_0xd2f1('0x2c')]['describe']()[_0xd2f1('0x25')](respondWithResult(_0x58d1c9,null))[_0xd2f1('0x47')](handleError(_0x58d1c9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 7cf02f6..2dca954 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 _0xa18d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x2517e7,_0x3da808){var _0x2d0b25=function(_0x2a5a4f){while(--_0x2a5a4f){_0x2517e7['push'](_0x2517e7['shift']());}};_0x2d0b25(++_0x3da808);}(_0xa18d,0x1ad));var _0xda18=function(_0x2d7fa8,_0x148b07){_0x2d7fa8=_0x2d7fa8-0x0;var _0x5d175d=_0xa18d[_0x2d7fa8];return _0x5d175d;};'use strict';var _=require(_0xda18('0x0'));var util=require(_0xda18('0x1'));var logger=require(_0xda18('0x2'))(_0xda18('0x3'));var moment=require(_0xda18('0x4'));var BPromise=require(_0xda18('0x5'));var rp=require(_0xda18('0x6'));var fs=require('fs');var path=require(_0xda18('0x7'));var rimraf=require(_0xda18('0x8'));var config=require(_0xda18('0x9'));var attributes=require(_0xda18('0xa'));module['exports']=function(_0x14b983,_0x18cad9){return _0x14b983['define'](_0xda18('0xb'),attributes,{'tableName':_0xda18('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ba=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport'];(function(_0x54dbbf,_0x1fef2f){var _0x370d34=function(_0xe032f9){while(--_0xe032f9){_0x54dbbf['push'](_0x54dbbf['shift']());}};_0x370d34(++_0x1fef2f);}(_0xa4ba,0xeb));var _0xaa4b=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xa4ba[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xaa4b('0x0'));var util=require(_0xaa4b('0x1'));var logger=require(_0xaa4b('0x2'))(_0xaa4b('0x3'));var moment=require(_0xaa4b('0x4'));var BPromise=require(_0xaa4b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa4b('0x6'));var rimraf=require(_0xaa4b('0x7'));var config=require(_0xaa4b('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xaa4b('0x9')]=function(_0x308bad,_0x3b5398){return _0x308bad[_0xaa4b('0xa')](_0xaa4b('0xb'),attributes,{'tableName':_0xaa4b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index c0aab73..1286f60 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 _0xa8b7=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0xa8b7,0xa0));var _0x7a8b=function(_0x3cb07d,_0x11a783){_0x3cb07d=_0x3cb07d-0x0;var _0x50b2b4=_0xa8b7[_0x3cb07d];return _0x50b2b4;};'use strict';var _=require(_0x7a8b('0x0'));var util=require(_0x7a8b('0x1'));var moment=require(_0x7a8b('0x2'));var BPromise=require(_0x7a8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a8b('0x4'));var db=require(_0x7a8b('0x5'))['db'];var utils=require(_0x7a8b('0x6'));var logger=require('../../config/logger')(_0x7a8b('0x7'));var config=require(_0x7a8b('0x8'));var jayson=require(_0x7a8b('0x9'));var client=jayson[_0x7a8b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40a03f,_0x4e9e15,_0x2022f3){return new BPromise(function(_0x956751,_0x33ab98){return client['request'](_0x40a03f,_0x2022f3)[_0x7a8b('0xb')](function(_0x384b49){logger[_0x7a8b('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4e9e15,_0x7a8b('0xd'));logger[_0x7a8b('0xe')](_0x7a8b('0xf'),_0x4e9e15,'request\x20sent',JSON[_0x7a8b('0x10')](_0x384b49));if(_0x384b49[_0x7a8b('0x11')]){if(_0x384b49[_0x7a8b('0x11')][_0x7a8b('0x12')]===0x1f4){logger['error'](_0x7a8b('0x13'),_0x4e9e15,_0x384b49[_0x7a8b('0x11')][_0x7a8b('0x14')]);return _0x33ab98(_0x384b49['error'][_0x7a8b('0x14')]);}logger['error'](_0x7a8b('0x13'),_0x4e9e15,_0x384b49[_0x7a8b('0x11')][_0x7a8b('0x14')]);return _0x956751(_0x384b49[_0x7a8b('0x11')][_0x7a8b('0x14')]);}else{logger[_0x7a8b('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4e9e15,_0x7a8b('0xd'));_0x956751(_0x384b49[_0x7a8b('0x15')][_0x7a8b('0x14')]);}})[_0x7a8b('0x16')](function(_0x5be1e0){logger[_0x7a8b('0x11')](_0x7a8b('0x13'),_0x4e9e15,_0x5be1e0);_0x33ab98(_0x5be1e0);});});} \ No newline at end of file +var _0x6746=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x126f31,_0x4adba5){var _0x4a94bd=function(_0x349948){while(--_0x349948){_0x126f31['push'](_0x126f31['shift']());}};_0x4a94bd(++_0x4adba5);}(_0x6746,0xf7));var _0x6674=function(_0x323591,_0x518650){_0x323591=_0x323591-0x0;var _0x423982=_0x6746[_0x323591];return _0x423982;};'use strict';var _=require('lodash');var util=require(_0x6674('0x0'));var moment=require(_0x6674('0x1'));var BPromise=require(_0x6674('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6674('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6674('0x4'));var logger=require(_0x6674('0x5'))(_0x6674('0x6'));var config=require(_0x6674('0x7'));var jayson=require(_0x6674('0x8'));var client=jayson[_0x6674('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33e693,_0x81c34b,_0x3ef60b){return new BPromise(function(_0x17f777,_0xec40d4){return client[_0x6674('0xa')](_0x33e693,_0x3ef60b)['then'](function(_0x4225b5){logger[_0x6674('0xb')](_0x6674('0xc'),_0x81c34b,'request\x20sent');logger['debug'](_0x6674('0xd'),_0x81c34b,_0x6674('0xe'),JSON['stringify'](_0x4225b5));if(_0x4225b5[_0x6674('0xf')]){if(_0x4225b5['error'][_0x6674('0x10')]===0x1f4){logger[_0x6674('0xf')](_0x6674('0xc'),_0x81c34b,_0x4225b5[_0x6674('0xf')][_0x6674('0x11')]);return _0xec40d4(_0x4225b5[_0x6674('0xf')][_0x6674('0x11')]);}logger[_0x6674('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x81c34b,_0x4225b5[_0x6674('0xf')][_0x6674('0x11')]);return _0x17f777(_0x4225b5[_0x6674('0xf')][_0x6674('0x11')]);}else{logger['info'](_0x6674('0xc'),_0x81c34b,_0x6674('0xe'));_0x17f777(_0x4225b5[_0x6674('0x12')][_0x6674('0x11')]);}})[_0x6674('0x13')](function(_0xc826ae){logger['error'](_0x6674('0xc'),_0x81c34b,_0xc826ae);_0xec40d4(_0xc826ae);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4ccd427..87fbaad 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 _0x0863=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','getQuestions','post','create','put','delete'];(function(_0x4bc941,_0x30e0aa){var _0x72acc7=function(_0x278b0f){while(--_0x278b0f){_0x4bc941['push'](_0x4bc941['shift']());}};_0x72acc7(++_0x30e0aa);}(_0x0863,0x141));var _0x3086=function(_0x39a4e9,_0x23f05c){_0x39a4e9=_0x39a4e9-0x0;var _0x2823f0=_0x0863[_0x39a4e9];return _0x2823f0;};'use strict';var multer=require(_0x3086('0x0'));var util=require(_0x3086('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3086('0x2'));var router=express[_0x3086('0x3')]();var fs_extra=require(_0x3086('0x4'));var auth=require(_0x3086('0x5'));var interaction=require(_0x3086('0x6'));var config=require('../../config/environment');var controller=require(_0x3086('0x7'));router[_0x3086('0x8')]('/',auth['isAuthenticated'](),controller[_0x3086('0x9')]);router[_0x3086('0x8')](_0x3086('0xa'),auth[_0x3086('0xb')](),controller[_0x3086('0xc')]);router[_0x3086('0x8')](_0x3086('0xd'),auth[_0x3086('0xb')](),controller['show']);router[_0x3086('0x8')]('/:id/questions',auth[_0x3086('0xb')](),controller[_0x3086('0xe')]);router[_0x3086('0xf')]('/',auth[_0x3086('0xb')](),controller[_0x3086('0x10')]);router[_0x3086('0x11')](_0x3086('0xd'),auth[_0x3086('0xb')](),controller['update']);router[_0x3086('0x12')](_0x3086('0xd'),auth[_0x3086('0xb')](),controller['destroy']);module[_0x3086('0x13')]=router; \ No newline at end of file +var _0xb476=['/:id/questions','getQuestions','post','create','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x22172f,_0x2f4bf2){var _0x38ec78=function(_0x40fe3a){while(--_0x40fe3a){_0x22172f['push'](_0x22172f['shift']());}};_0x38ec78(++_0x2f4bf2);}(_0xb476,0x193));var _0x6b47=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xb476[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0x6b47('0x0'));var util=require('util');var path=require(_0x6b47('0x1'));var timeout=require(_0x6b47('0x2'));var express=require('express');var router=express[_0x6b47('0x3')]();var fs_extra=require(_0x6b47('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6b47('0x5'));var config=require(_0x6b47('0x6'));var controller=require(_0x6b47('0x7'));router[_0x6b47('0x8')]('/',auth[_0x6b47('0x9')](),controller[_0x6b47('0xa')]);router[_0x6b47('0x8')](_0x6b47('0xb'),auth['isAuthenticated'](),controller[_0x6b47('0xc')]);router['get'](_0x6b47('0xd'),auth[_0x6b47('0x9')](),controller[_0x6b47('0xe')]);router[_0x6b47('0x8')](_0x6b47('0xf'),auth['isAuthenticated'](),controller[_0x6b47('0x10')]);router[_0x6b47('0x11')]('/',auth[_0x6b47('0x9')](),controller[_0x6b47('0x12')]);router[_0x6b47('0x13')](_0x6b47('0xd'),auth[_0x6b47('0x9')](),controller[_0x6b47('0x14')]);router[_0x6b47('0x15')](_0x6b47('0xd'),auth[_0x6b47('0x9')](),controller['destroy']);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 ad51113..0411d88 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 _0x1ae0=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue','endtime'];(function(_0x3a4938,_0x2d38bc){var _0x2ce7ca=function(_0x269969){while(--_0x269969){_0x3a4938['push'](_0x3a4938['shift']());}};_0x2ce7ca(++_0x2d38bc);}(_0x1ae0,0xb8));var _0x01ae=function(_0x172d2c,_0x9bb44a){_0x172d2c=_0x172d2c-0x0;var _0x41c113=_0x1ae0[_0x172d2c];return _0x41c113;};'use strict';var moment=require('moment');var Sequelize=require(_0x01ae('0x0'));module[_0x01ae('0x1')]={'starttime':{'type':Sequelize[_0x01ae('0x2')],'set':function(_0x26e264){this[_0x01ae('0x3')]('starttime',_0x26e264);this[_0x01ae('0x3')](_0x01ae('0x4'),moment()[_0x01ae('0x5')](_0x01ae('0x6')));}},'endtime':{'type':Sequelize[_0x01ae('0x2')]},'membername':{'type':Sequelize[_0x01ae('0x7')]},'projectname':{'type':Sequelize[_0x01ae('0x7')]},'queue':{'type':Sequelize[_0x01ae('0x7')]},'uniqueid':{'type':Sequelize[_0x01ae('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x01ae('0x7')]},'completed':{'type':Sequelize[_0x01ae('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x16e7=['setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE'];(function(_0x5f5bc8,_0xafa0c4){var _0x47e72e=function(_0x1f7a3d){while(--_0x1f7a3d){_0x5f5bc8['push'](_0x5f5bc8['shift']());}};_0x47e72e(++_0xafa0c4);}(_0x16e7,0x17d));var _0x716e=function(_0x340d3e,_0x3491de){_0x340d3e=_0x340d3e-0x0;var _0x1d0330=_0x16e7[_0x340d3e];return _0x1d0330;};'use strict';var moment=require(_0x716e('0x0'));var Sequelize=require('sequelize');module[_0x716e('0x1')]={'starttime':{'type':Sequelize[_0x716e('0x2')],'set':function(_0x4c4db7){this[_0x716e('0x3')]('starttime',_0x4c4db7);this[_0x716e('0x3')](_0x716e('0x4'),moment()['format'](_0x716e('0x5')));}},'endtime':{'type':Sequelize[_0x716e('0x2')]},'membername':{'type':Sequelize[_0x716e('0x6')]},'projectname':{'type':Sequelize[_0x716e('0x6')]},'queue':{'type':Sequelize[_0x716e('0x6')]},'uniqueid':{'type':Sequelize[_0x716e('0x6')]},'calleridname':{'type':Sequelize[_0x716e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x716e('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 d48d917..f8aee95 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 _0xcf7b=['order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','getQuestions','findOne','nolimit','pick','SessionId','options','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x288478,_0x23303e){var _0x234c05=function(_0x4ff5a5){while(--_0x4ff5a5){_0x288478['push'](_0x288478['shift']());}};_0x234c05(++_0x23303e);}(_0xcf7b,0x160));var _0xbcf7=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xcf7b[_0x45d55e];return _0x29812a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcf7('0x0'));var zipdir=require(_0xbcf7('0x1'));var jsonpatch=require(_0xbcf7('0x2'));var rp=require(_0xbcf7('0x3'));var moment=require(_0xbcf7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbcf7('0x5'));var util=require(_0xbcf7('0x6'));var path=require(_0xbcf7('0x7'));var sox=require(_0xbcf7('0x8'));var csv=require(_0xbcf7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcf7('0xa'));var squel=require('squel');var crypto=require(_0xbcf7('0xb'));var jsforce=require(_0xbcf7('0xc'));var deskjs=require(_0xbcf7('0xd'));var toCsv=require(_0xbcf7('0x9'));var querystring=require(_0xbcf7('0xe'));var Papa=require(_0xbcf7('0xf'));var Redis=require('ioredis');var authService=require(_0xbcf7('0x10'));var qs=require(_0xbcf7('0x11'));var as=require(_0xbcf7('0x12'));var hardwareService=require(_0xbcf7('0x13'));var logger=require(_0xbcf7('0x14'))(_0xbcf7('0x15'));var utils=require(_0xbcf7('0x16'));var config=require(_0xbcf7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbcf7('0x18'))['db'];function respondWithStatusCode(_0x4ab929,_0x41f2d6){_0x41f2d6=_0x41f2d6||0xcc;return function(_0x43793e){if(_0x43793e){return _0x4ab929[_0xbcf7('0x19')](_0x41f2d6);}return _0x4ab929['status'](_0x41f2d6)[_0xbcf7('0x1a')]();};}function respondWithResult(_0x78b9d2,_0x2e36d5){_0x2e36d5=_0x2e36d5||0xc8;return function(_0xfb642c){if(_0xfb642c){return _0x78b9d2[_0xbcf7('0x1b')](_0x2e36d5)[_0xbcf7('0x1c')](_0xfb642c);}};}function respondWithFilteredResult(_0x44ad41,_0x40d28d){return function(_0x4ff2af){if(_0x4ff2af){var _0x5b034f=typeof _0x40d28d[_0xbcf7('0x1d')]===_0xbcf7('0x1e')&&typeof _0x40d28d[_0xbcf7('0x1f')]===_0xbcf7('0x1e');var _0x1462a5=_0x4ff2af[_0xbcf7('0x20')];var _0x5155e5=_0x5b034f?0x0:_0x40d28d[_0xbcf7('0x1d')];var _0x32f7e5=_0x5b034f?_0x4ff2af['count']:_0x40d28d[_0xbcf7('0x1d')]+_0x40d28d[_0xbcf7('0x1f')];var _0x39fda3;if(_0x32f7e5>=_0x1462a5){_0x32f7e5=_0x1462a5;_0x39fda3=0xc8;}else{_0x39fda3=0xce;}_0x44ad41[_0xbcf7('0x1b')](_0x39fda3);return _0x44ad41[_0xbcf7('0x21')](_0xbcf7('0x22'),_0x5155e5+'-'+_0x32f7e5+'/'+_0x1462a5)['json'](_0x4ff2af);}return null;};}function patchUpdates(_0x1ab51f){return function(_0x3ecedb){try{jsonpatch[_0xbcf7('0x23')](_0x3ecedb,_0x1ab51f,!![]);}catch(_0x184dc5){return BPromise[_0xbcf7('0x24')](_0x184dc5);}return _0x3ecedb['save']();};}function saveUpdates(_0x14a460,_0x24d32b){return function(_0x5267ff){if(_0x5267ff){return _0x5267ff[_0xbcf7('0x25')](_0x14a460)['then'](function(_0x1f7588){return _0x1f7588;});}return null;};}function removeEntity(_0x355506,_0xbf587){return function(_0xe4a370){if(_0xe4a370){return _0xe4a370[_0xbcf7('0x26')]()[_0xbcf7('0x27')](function(){_0x355506[_0xbcf7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58308d,_0x19e1ef){return function(_0x11d7c7){if(!_0x11d7c7){_0x58308d[_0xbcf7('0x19')](0x194);}return _0x11d7c7;};}function handleError(_0x2d3e94,_0x1aa6f2){_0x1aa6f2=_0x1aa6f2||0x1f4;return function(_0x7cc7a4){logger['error'](_0x7cc7a4[_0xbcf7('0x28')]);if(_0x7cc7a4[_0xbcf7('0x29')]){delete _0x7cc7a4[_0xbcf7('0x29')];}_0x2d3e94['status'](_0x1aa6f2)[_0xbcf7('0x2a')](_0x7cc7a4);};}exports[_0xbcf7('0x2b')]=function(_0x5b9ffd,_0x5ca61f){var _0xc221e4={},_0x288553={},_0x5133d4={'count':0x0,'rows':[]};var _0x3b1998=_[_0xbcf7('0x2c')](db[_0xbcf7('0x2d')][_0xbcf7('0x2e')],function(_0x54efc4){return{'name':_0x54efc4[_0xbcf7('0x2f')],'type':_0x54efc4[_0xbcf7('0x30')][_0xbcf7('0x31')]};});_0x288553[_0xbcf7('0x32')]=_[_0xbcf7('0x2c')](_0x3b1998,_0xbcf7('0x29'));_0x288553[_0xbcf7('0x33')]=_[_0xbcf7('0x34')](_0x5b9ffd[_0xbcf7('0x33')]);_0x288553[_0xbcf7('0x35')]=_[_0xbcf7('0x36')](_0x288553[_0xbcf7('0x32')],_0x288553[_0xbcf7('0x33')]);_0xc221e4[_0xbcf7('0x37')]=_[_0xbcf7('0x36')](_0x288553[_0xbcf7('0x32')],qs['fields'](_0x5b9ffd[_0xbcf7('0x33')][_0xbcf7('0x38')]));_0xc221e4['attributes']=_0xc221e4[_0xbcf7('0x37')]['length']?_0xc221e4['attributes']:_0x288553['model'];if(!_0x5b9ffd['query'][_0xbcf7('0x39')]('nolimit')){_0xc221e4[_0xbcf7('0x1f')]=qs[_0xbcf7('0x1f')](_0x5b9ffd['query'][_0xbcf7('0x1f')]);_0xc221e4[_0xbcf7('0x1d')]=qs[_0xbcf7('0x1d')](_0x5b9ffd[_0xbcf7('0x33')][_0xbcf7('0x1d')]);}_0xc221e4[_0xbcf7('0x3a')]=qs['sort'](_0x5b9ffd[_0xbcf7('0x33')][_0xbcf7('0x3b')]);_0xc221e4['where']=qs[_0xbcf7('0x35')](_['pick'](_0x5b9ffd['query'],_0x288553[_0xbcf7('0x35')]),_0x3b1998);if(_0x5b9ffd['query'][_0xbcf7('0x3c')]){_0xc221e4[_0xbcf7('0x3d')]=_[_0xbcf7('0x3e')](_0xc221e4[_0xbcf7('0x3d')],{'$or':_[_0xbcf7('0x2c')](_0x3b1998,function(_0xa26d79){if(_0xa26d79[_0xbcf7('0x30')]!==_0xbcf7('0x3f')){var _0x30e2ff={};_0x30e2ff[_0xa26d79[_0xbcf7('0x29')]]={'$like':'%'+_0x5b9ffd['query'][_0xbcf7('0x3c')]+'%'};return _0x30e2ff;}})});}_0xc221e4=_[_0xbcf7('0x3e')]({},_0xc221e4,_0x5b9ffd['options']);var _0x49ae83={'where':_0xc221e4[_0xbcf7('0x3d')]};return db[_0xbcf7('0x2d')]['count'](_0x49ae83)[_0xbcf7('0x27')](function(_0x232843){_0x5133d4[_0xbcf7('0x20')]=_0x232843;if(_0x5b9ffd[_0xbcf7('0x33')][_0xbcf7('0x40')]){_0xc221e4[_0xbcf7('0x41')]=[{'all':!![]}];}return db[_0xbcf7('0x2d')][_0xbcf7('0x42')](_0xc221e4);})['then'](function(_0x5b06dc){_0x5133d4[_0xbcf7('0x43')]=_0x5b06dc;return _0x5133d4;})[_0xbcf7('0x27')](respondWithFilteredResult(_0x5ca61f,_0xc221e4))[_0xbcf7('0x44')](handleError(_0x5ca61f,null));};exports['show']=function(_0x5f0420,_0x398b90){var _0x15b8e0={'raw':!![],'where':{'id':_0x5f0420['params']['id']}},_0xa5d0bc={};_0xa5d0bc['model']=_[_0xbcf7('0x34')](db[_0xbcf7('0x2d')][_0xbcf7('0x2e')]);_0xa5d0bc['query']=_[_0xbcf7('0x34')](_0x5f0420[_0xbcf7('0x33')]);_0xa5d0bc['filters']=_['intersection'](_0xa5d0bc[_0xbcf7('0x32')],_0xa5d0bc[_0xbcf7('0x33')]);_0x15b8e0[_0xbcf7('0x37')]=_[_0xbcf7('0x36')](_0xa5d0bc[_0xbcf7('0x32')],qs[_0xbcf7('0x38')](_0x5f0420[_0xbcf7('0x33')][_0xbcf7('0x38')]));_0x15b8e0[_0xbcf7('0x37')]=_0x15b8e0[_0xbcf7('0x37')][_0xbcf7('0x45')]?_0x15b8e0[_0xbcf7('0x37')]:_0xa5d0bc[_0xbcf7('0x32')];if(_0x5f0420[_0xbcf7('0x33')]['includeAll']){_0x15b8e0[_0xbcf7('0x41')]=[{'all':!![]}];}_0x15b8e0=_['merge']({},_0x15b8e0,_0x5f0420['options']);return db[_0xbcf7('0x2d')][_0xbcf7('0x46')](_0x15b8e0)[_0xbcf7('0x27')](handleEntityNotFound(_0x398b90,null))[_0xbcf7('0x27')](respondWithResult(_0x398b90,null))[_0xbcf7('0x44')](handleError(_0x398b90,null));};exports['create']=function(_0x180389,_0x48250d){return db['JscriptySessionReport'][_0xbcf7('0x47')](_0x180389[_0xbcf7('0x48')],{})[_0xbcf7('0x27')](respondWithResult(_0x48250d,0xc9))['catch'](handleError(_0x48250d,null));};exports[_0xbcf7('0x25')]=function(_0x5b0532,_0x23bdbf){if(_0x5b0532[_0xbcf7('0x48')]['id']){delete _0x5b0532[_0xbcf7('0x48')]['id'];}return db[_0xbcf7('0x2d')][_0xbcf7('0x46')]({'where':{'id':_0x5b0532[_0xbcf7('0x49')]['id']}})['then'](handleEntityNotFound(_0x23bdbf,null))[_0xbcf7('0x27')](saveUpdates(_0x5b0532[_0xbcf7('0x48')],null))[_0xbcf7('0x27')](respondWithResult(_0x23bdbf,null))[_0xbcf7('0x44')](handleError(_0x23bdbf,null));};exports['destroy']=function(_0x15b867,_0x3f46c3){return db['JscriptySessionReport'][_0xbcf7('0x46')]({'where':{'id':_0x15b867[_0xbcf7('0x49')]['id']}})[_0xbcf7('0x27')](handleEntityNotFound(_0x3f46c3,null))[_0xbcf7('0x27')](removeEntity(_0x3f46c3,null))['catch'](handleError(_0x3f46c3,null));};exports[_0xbcf7('0x4a')]=function(_0xa3de7f,_0xcf77f9){return db[_0xbcf7('0x2d')]['describe']()[_0xbcf7('0x27')](respondWithResult(_0xcf77f9,null))[_0xbcf7('0x44')](handleError(_0xcf77f9,null));};exports[_0xbcf7('0x4b')]=function(_0x12061c,_0x42bda8,_0x1371a4){var _0x20cc5f={'raw':!![],'where':{}};var _0x1cc4e3={};var _0x6d7fdb={'count':0x0,'rows':[]};return db[_0xbcf7('0x2d')][_0xbcf7('0x4c')]({'where':{'id':_0x12061c[_0xbcf7('0x49')]['id']}})[_0xbcf7('0x27')](handleEntityNotFound(_0x42bda8,null))[_0xbcf7('0x27')](function(_0x1dd93b){if(_0x1dd93b){_0x1cc4e3[_0xbcf7('0x32')]=_[_0xbcf7('0x34')](db['JscriptyQuestionReport'][_0xbcf7('0x2e')]);_0x1cc4e3[_0xbcf7('0x33')]=_['keys'](_0x12061c[_0xbcf7('0x33')]);_0x1cc4e3[_0xbcf7('0x35')]=_['intersection'](_0x1cc4e3[_0xbcf7('0x32')],_0x1cc4e3['query']);_0x20cc5f[_0xbcf7('0x37')]=_['intersection'](_0x1cc4e3['model'],qs[_0xbcf7('0x38')](_0x12061c[_0xbcf7('0x33')]['fields']));_0x20cc5f[_0xbcf7('0x37')]=_0x20cc5f[_0xbcf7('0x37')]['length']?_0x20cc5f[_0xbcf7('0x37')]:_0x1cc4e3[_0xbcf7('0x32')];if(!_0x12061c['query'][_0xbcf7('0x39')](_0xbcf7('0x4d'))){_0x20cc5f[_0xbcf7('0x1f')]=qs[_0xbcf7('0x1f')](_0x12061c[_0xbcf7('0x33')][_0xbcf7('0x1f')]);_0x20cc5f[_0xbcf7('0x1d')]=qs[_0xbcf7('0x1d')](_0x12061c[_0xbcf7('0x33')][_0xbcf7('0x1d')]);}_0x20cc5f[_0xbcf7('0x3a')]=qs[_0xbcf7('0x3b')](_0x12061c[_0xbcf7('0x33')]['sort']);_0x20cc5f['where']=qs[_0xbcf7('0x35')](_[_0xbcf7('0x4e')](_0x12061c['query'],_0x1cc4e3[_0xbcf7('0x35')]));_0x20cc5f[_0xbcf7('0x3d')][_0xbcf7('0x4f')]=_0x1dd93b['id'];if(_0x12061c[_0xbcf7('0x33')][_0xbcf7('0x3c')]){_0x20cc5f[_0xbcf7('0x3d')]=_['merge'](_0x20cc5f[_0xbcf7('0x3d')],{'$or':_['map'](_0x20cc5f['attributes'],function(_0xa409f9){var _0x15f725={};_0x15f725[_0xa409f9]={'$like':'%'+_0x12061c['query'][_0xbcf7('0x3c')]+'%'};return _0x15f725;})});}_0x20cc5f=_[_0xbcf7('0x3e')]({},_0x20cc5f,_0x12061c[_0xbcf7('0x50')]);return db[_0xbcf7('0x51')][_0xbcf7('0x20')]({'where':_0x20cc5f[_0xbcf7('0x3d')]})['then'](function(_0x372830){_0x6d7fdb[_0xbcf7('0x20')]=_0x372830;if(_0x12061c[_0xbcf7('0x33')]['includeAll']){_0x20cc5f['include']=[{'all':!![]}];}return db[_0xbcf7('0x51')][_0xbcf7('0x42')](_0x20cc5f);})[_0xbcf7('0x27')](function(_0x1cd2d4){_0x6d7fdb[_0xbcf7('0x43')]=_0x1cd2d4;return _0x6d7fdb;});}})[_0xbcf7('0x27')](respondWithFilteredResult(_0x42bda8,_0x20cc5f))[_0xbcf7('0x44')](handleError(_0x42bda8,null));}; \ No newline at end of file +var _0x794e=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','JscriptySessionReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','findOne','JscriptyQuestionReport','order','pick','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x191a62,_0x4ed3c3){var _0x165426=function(_0x36d57c){while(--_0x36d57c){_0x191a62['push'](_0x191a62['shift']());}};_0x165426(++_0x4ed3c3);}(_0x794e,0x91));var _0xe794=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x794e[_0x513aa5];return _0x1a1a7c;};'use strict';var emlformat=require(_0xe794('0x0'));var rimraf=require(_0xe794('0x1'));var zipdir=require(_0xe794('0x2'));var jsonpatch=require(_0xe794('0x3'));var rp=require('request-promise');var moment=require(_0xe794('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe794('0x5'));var util=require(_0xe794('0x6'));var path=require(_0xe794('0x7'));var sox=require(_0xe794('0x8'));var csv=require(_0xe794('0x9'));var ejs=require(_0xe794('0xa'));var fs=require('fs');var fs_extra=require(_0xe794('0xb'));var _=require(_0xe794('0xc'));var squel=require(_0xe794('0xd'));var crypto=require(_0xe794('0xe'));var jsforce=require(_0xe794('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe794('0x9'));var querystring=require(_0xe794('0x10'));var Papa=require(_0xe794('0x11'));var Redis=require('ioredis');var authService=require(_0xe794('0x12'));var qs=require(_0xe794('0x13'));var as=require(_0xe794('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe794('0x15'))('api');var utils=require(_0xe794('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe794('0x17'));var db=require(_0xe794('0x18'))['db'];function respondWithStatusCode(_0x238461,_0x1bdd5b){_0x1bdd5b=_0x1bdd5b||0xcc;return function(_0x1a86d6){if(_0x1a86d6){return _0x238461[_0xe794('0x19')](_0x1bdd5b);}return _0x238461['status'](_0x1bdd5b)[_0xe794('0x1a')]();};}function respondWithResult(_0x106768,_0x32370c){_0x32370c=_0x32370c||0xc8;return function(_0x44144f){if(_0x44144f){return _0x106768[_0xe794('0x1b')](_0x32370c)[_0xe794('0x1c')](_0x44144f);}};}function respondWithFilteredResult(_0x1e3bc6,_0x148407){return function(_0x5e8f4c){if(_0x5e8f4c){var _0x4c068b=typeof _0x148407['offset']===_0xe794('0x1d')&&typeof _0x148407[_0xe794('0x1e')]===_0xe794('0x1d');var _0x4a99a9=_0x5e8f4c[_0xe794('0x1f')];var _0x3e3623=_0x4c068b?0x0:_0x148407[_0xe794('0x20')];var _0x3dde91=_0x4c068b?_0x5e8f4c[_0xe794('0x1f')]:_0x148407[_0xe794('0x20')]+_0x148407[_0xe794('0x1e')];var _0x12cbef;if(_0x3dde91>=_0x4a99a9){_0x3dde91=_0x4a99a9;_0x12cbef=0xc8;}else{_0x12cbef=0xce;}_0x1e3bc6[_0xe794('0x1b')](_0x12cbef);return _0x1e3bc6[_0xe794('0x21')](_0xe794('0x22'),_0x3e3623+'-'+_0x3dde91+'/'+_0x4a99a9)[_0xe794('0x1c')](_0x5e8f4c);}return null;};}function patchUpdates(_0x1a16ab){return function(_0xb2bb62){try{jsonpatch['apply'](_0xb2bb62,_0x1a16ab,!![]);}catch(_0x475ffc){return BPromise[_0xe794('0x23')](_0x475ffc);}return _0xb2bb62[_0xe794('0x24')]();};}function saveUpdates(_0x5d7817,_0x37da77){return function(_0x207dd9){if(_0x207dd9){return _0x207dd9[_0xe794('0x25')](_0x5d7817)[_0xe794('0x26')](function(_0x41446a){return _0x41446a;});}return null;};}function removeEntity(_0x3200fd,_0x436c90){return function(_0x3cf422){if(_0x3cf422){return _0x3cf422[_0xe794('0x27')]()[_0xe794('0x26')](function(){_0x3200fd[_0xe794('0x1b')](0xcc)[_0xe794('0x1a')]();});}};}function handleEntityNotFound(_0x5251f1,_0x7c0dbe){return function(_0x1ddfb2){if(!_0x1ddfb2){_0x5251f1['sendStatus'](0x194);}return _0x1ddfb2;};}function handleError(_0x3eb48e,_0xa8f6f8){_0xa8f6f8=_0xa8f6f8||0x1f4;return function(_0x218499){logger[_0xe794('0x28')](_0x218499[_0xe794('0x29')]);if(_0x218499[_0xe794('0x2a')]){delete _0x218499[_0xe794('0x2a')];}_0x3eb48e[_0xe794('0x1b')](_0xa8f6f8)[_0xe794('0x2b')](_0x218499);};}exports['index']=function(_0x1e8707,_0x3630d7){var _0x35653e={},_0xdc42e2={},_0x48e40a={'count':0x0,'rows':[]};var _0x19aa56=_[_0xe794('0x2c')](db[_0xe794('0x2d')]['rawAttributes'],function(_0x57844a){return{'name':_0x57844a[_0xe794('0x2e')],'type':_0x57844a[_0xe794('0x2f')][_0xe794('0x30')]};});_0xdc42e2[_0xe794('0x31')]=_[_0xe794('0x2c')](_0x19aa56,_0xe794('0x2a'));_0xdc42e2['query']=_[_0xe794('0x32')](_0x1e8707[_0xe794('0x33')]);_0xdc42e2[_0xe794('0x34')]=_[_0xe794('0x35')](_0xdc42e2[_0xe794('0x31')],_0xdc42e2[_0xe794('0x33')]);_0x35653e[_0xe794('0x36')]=_[_0xe794('0x35')](_0xdc42e2[_0xe794('0x31')],qs[_0xe794('0x37')](_0x1e8707[_0xe794('0x33')][_0xe794('0x37')]));_0x35653e[_0xe794('0x36')]=_0x35653e[_0xe794('0x36')][_0xe794('0x38')]?_0x35653e[_0xe794('0x36')]:_0xdc42e2[_0xe794('0x31')];if(!_0x1e8707[_0xe794('0x33')][_0xe794('0x39')](_0xe794('0x3a'))){_0x35653e[_0xe794('0x1e')]=qs['limit'](_0x1e8707['query'][_0xe794('0x1e')]);_0x35653e[_0xe794('0x20')]=qs[_0xe794('0x20')](_0x1e8707[_0xe794('0x33')][_0xe794('0x20')]);}_0x35653e['order']=qs[_0xe794('0x3b')](_0x1e8707[_0xe794('0x33')]['sort']);_0x35653e['where']=qs['filters'](_['pick'](_0x1e8707[_0xe794('0x33')],_0xdc42e2[_0xe794('0x34')]),_0x19aa56);if(_0x1e8707[_0xe794('0x33')][_0xe794('0x3c')]){_0x35653e['where']=_[_0xe794('0x3d')](_0x35653e[_0xe794('0x3e')],{'$or':_[_0xe794('0x2c')](_0x19aa56,function(_0x269465){if(_0x269465[_0xe794('0x2f')]!=='VIRTUAL'){var _0x17f365={};_0x17f365[_0x269465[_0xe794('0x2a')]]={'$like':'%'+_0x1e8707[_0xe794('0x33')][_0xe794('0x3c')]+'%'};return _0x17f365;}})});}_0x35653e=_['merge']({},_0x35653e,_0x1e8707[_0xe794('0x3f')]);var _0x4bee2b={'where':_0x35653e[_0xe794('0x3e')]};return db['JscriptySessionReport'][_0xe794('0x1f')](_0x4bee2b)[_0xe794('0x26')](function(_0x452db2){_0x48e40a['count']=_0x452db2;if(_0x1e8707['query'][_0xe794('0x40')]){_0x35653e[_0xe794('0x41')]=[{'all':!![]}];}return db[_0xe794('0x2d')][_0xe794('0x42')](_0x35653e);})[_0xe794('0x26')](function(_0x23f55c){_0x48e40a[_0xe794('0x43')]=_0x23f55c;return _0x48e40a;})[_0xe794('0x26')](respondWithFilteredResult(_0x3630d7,_0x35653e))[_0xe794('0x44')](handleError(_0x3630d7,null));};exports[_0xe794('0x45')]=function(_0x492307,_0x65abb){var _0x1ec06f={'raw':!![],'where':{'id':_0x492307['params']['id']}},_0x2b9e95={};_0x2b9e95['model']=_[_0xe794('0x32')](db[_0xe794('0x2d')][_0xe794('0x46')]);_0x2b9e95[_0xe794('0x33')]=_[_0xe794('0x32')](_0x492307[_0xe794('0x33')]);_0x2b9e95[_0xe794('0x34')]=_['intersection'](_0x2b9e95[_0xe794('0x31')],_0x2b9e95[_0xe794('0x33')]);_0x1ec06f['attributes']=_[_0xe794('0x35')](_0x2b9e95[_0xe794('0x31')],qs[_0xe794('0x37')](_0x492307[_0xe794('0x33')][_0xe794('0x37')]));_0x1ec06f[_0xe794('0x36')]=_0x1ec06f[_0xe794('0x36')][_0xe794('0x38')]?_0x1ec06f[_0xe794('0x36')]:_0x2b9e95[_0xe794('0x31')];if(_0x492307[_0xe794('0x33')][_0xe794('0x40')]){_0x1ec06f[_0xe794('0x41')]=[{'all':!![]}];}_0x1ec06f=_[_0xe794('0x3d')]({},_0x1ec06f,_0x492307[_0xe794('0x3f')]);return db[_0xe794('0x2d')][_0xe794('0x47')](_0x1ec06f)[_0xe794('0x26')](handleEntityNotFound(_0x65abb,null))[_0xe794('0x26')](respondWithResult(_0x65abb,null))[_0xe794('0x44')](handleError(_0x65abb,null));};exports[_0xe794('0x48')]=function(_0x520550,_0x3e17d4){return db[_0xe794('0x2d')][_0xe794('0x48')](_0x520550[_0xe794('0x49')],{})[_0xe794('0x26')](respondWithResult(_0x3e17d4,0xc9))[_0xe794('0x44')](handleError(_0x3e17d4,null));};exports[_0xe794('0x25')]=function(_0x300ece,_0x438b13){if(_0x300ece['body']['id']){delete _0x300ece[_0xe794('0x49')]['id'];}return db['JscriptySessionReport'][_0xe794('0x47')]({'where':{'id':_0x300ece['params']['id']}})[_0xe794('0x26')](handleEntityNotFound(_0x438b13,null))[_0xe794('0x26')](saveUpdates(_0x300ece['body'],null))['then'](respondWithResult(_0x438b13,null))['catch'](handleError(_0x438b13,null));};exports[_0xe794('0x27')]=function(_0x37bfd1,_0x38164f){return db[_0xe794('0x2d')][_0xe794('0x47')]({'where':{'id':_0x37bfd1[_0xe794('0x4a')]['id']}})[_0xe794('0x26')](handleEntityNotFound(_0x38164f,null))[_0xe794('0x26')](removeEntity(_0x38164f,null))[_0xe794('0x44')](handleError(_0x38164f,null));};exports[_0xe794('0x4b')]=function(_0x56234f,_0xec95fe){return db[_0xe794('0x2d')]['describe']()[_0xe794('0x26')](respondWithResult(_0xec95fe,null))[_0xe794('0x44')](handleError(_0xec95fe,null));};exports['getQuestions']=function(_0x3199df,_0x5afcd6,_0x28b377){var _0x3cb772={'raw':!![],'where':{}};var _0x510c83={};var _0x23dba3={'count':0x0,'rows':[]};return db[_0xe794('0x2d')][_0xe794('0x4c')]({'where':{'id':_0x3199df[_0xe794('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5afcd6,null))[_0xe794('0x26')](function(_0x3dd42e){if(_0x3dd42e){_0x510c83[_0xe794('0x31')]=_[_0xe794('0x32')](db[_0xe794('0x4d')]['rawAttributes']);_0x510c83[_0xe794('0x33')]=_['keys'](_0x3199df[_0xe794('0x33')]);_0x510c83[_0xe794('0x34')]=_['intersection'](_0x510c83[_0xe794('0x31')],_0x510c83['query']);_0x3cb772[_0xe794('0x36')]=_[_0xe794('0x35')](_0x510c83[_0xe794('0x31')],qs['fields'](_0x3199df['query']['fields']));_0x3cb772[_0xe794('0x36')]=_0x3cb772[_0xe794('0x36')][_0xe794('0x38')]?_0x3cb772[_0xe794('0x36')]:_0x510c83[_0xe794('0x31')];if(!_0x3199df['query'][_0xe794('0x39')]('nolimit')){_0x3cb772['limit']=qs[_0xe794('0x1e')](_0x3199df[_0xe794('0x33')][_0xe794('0x1e')]);_0x3cb772[_0xe794('0x20')]=qs['offset'](_0x3199df[_0xe794('0x33')]['offset']);}_0x3cb772[_0xe794('0x4e')]=qs[_0xe794('0x3b')](_0x3199df[_0xe794('0x33')][_0xe794('0x3b')]);_0x3cb772['where']=qs['filters'](_[_0xe794('0x4f')](_0x3199df[_0xe794('0x33')],_0x510c83[_0xe794('0x34')]));_0x3cb772['where'][_0xe794('0x50')]=_0x3dd42e['id'];if(_0x3199df[_0xe794('0x33')][_0xe794('0x3c')]){_0x3cb772[_0xe794('0x3e')]=_['merge'](_0x3cb772[_0xe794('0x3e')],{'$or':_['map'](_0x3cb772['attributes'],function(_0x54b4f3){var _0x50c854={};_0x50c854[_0x54b4f3]={'$like':'%'+_0x3199df[_0xe794('0x33')][_0xe794('0x3c')]+'%'};return _0x50c854;})});}_0x3cb772=_['merge']({},_0x3cb772,_0x3199df['options']);return db[_0xe794('0x4d')][_0xe794('0x1f')]({'where':_0x3cb772[_0xe794('0x3e')]})[_0xe794('0x26')](function(_0x2aec64){_0x23dba3[_0xe794('0x1f')]=_0x2aec64;if(_0x3199df['query'][_0xe794('0x40')]){_0x3cb772['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3cb772);})[_0xe794('0x26')](function(_0x35024c){_0x23dba3[_0xe794('0x43')]=_0x35024c;return _0x23dba3;});}})[_0xe794('0x26')](respondWithFilteredResult(_0x5afcd6,_0x3cb772))[_0xe794('0x44')](handleError(_0x5afcd6,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 606bc4d..0f1e8fd 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 _0x326f=['report_jscripty_sessions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x4ae2cf,_0x258e4b){var _0x59a0b3=function(_0x50cc83){while(--_0x50cc83){_0x4ae2cf['push'](_0x4ae2cf['shift']());}};_0x59a0b3(++_0x258e4b);}(_0x326f,0xd1));var _0xf326=function(_0x3651c0,_0x19f8a6){_0x3651c0=_0x3651c0-0x0;var _0x5058c9=_0x326f[_0x3651c0];return _0x5058c9;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c5a=['define','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x365986,_0x4ccc6b){var _0x585a5b=function(_0xf5c24){while(--_0xf5c24){_0x365986['push'](_0x365986['shift']());}};_0x585a5b(++_0x4ccc6b);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1cc3a8,_0x289fcc){_0x1cc3a8=_0x1cc3a8-0x0;var _0x11f609=_0x9c5a[_0x1cc3a8];return _0x11f609;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var logger=require('../../config/logger')(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var BPromise=require(_0xa9c5('0x4'));var rp=require(_0xa9c5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var attributes=require('./jscriptySessionReport.attributes');module[_0xa9c5('0x8')]=function(_0x4d9c7a,_0x394d84){return _0x4d9c7a[_0xa9c5('0x9')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 51fe3d0..22f72b5 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 _0x25e7=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info'];(function(_0x39355e,_0x450619){var _0x4a495f=function(_0x287725){while(--_0x287725){_0x39355e['push'](_0x39355e['shift']());}};_0x4a495f(++_0x450619);}(_0x25e7,0x1d6));var _0x725e=function(_0x230bb8,_0xa1718){_0x230bb8=_0x230bb8-0x0;var _0x16cb9a=_0x25e7[_0x230bb8];return _0x16cb9a;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});} \ No newline at end of file +var _0x2da6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x2da6,0x1dd));var _0x62da=function(_0x2b40ed,_0x5bcee4){_0x2b40ed=_0x2b40ed-0x0;var _0x4f946b=_0x2da6[_0x2b40ed];return _0x4f946b;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 97c4032..626f350 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 _0xb469=['../../components/auth/service','../../components/interaction/service','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x4ddc46,_0x1bd808){var _0x3e903f=function(_0x2bf859){while(--_0x2bf859){_0x4ddc46['push'](_0x4ddc46['shift']());}};_0x3e903f(++_0x1bd808);}(_0xb469,0xab));var _0x9b46=function(_0x2e558d,_0x38762c){_0x2e558d=_0x2e558d-0x0;var _0x37ab86=_0xb469[_0x2e558d];return _0x37ab86;};'use strict';var multer=require(_0x9b46('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9b46('0x1'));var express=require(_0x9b46('0x2'));var router=express[_0x9b46('0x3')]();var fs_extra=require(_0x9b46('0x4'));var auth=require(_0x9b46('0x5'));var interaction=require(_0x9b46('0x6'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0x9b46('0x7')]('/',controller[_0x9b46('0x8')]);router[_0x9b46('0x9')](_0x9b46('0xa'),auth[_0x9b46('0xb')](),controller[_0x9b46('0xc')]);router[_0x9b46('0x7')](_0x9b46('0xd'),auth[_0x9b46('0xb')](),controller[_0x9b46('0xe')]);module[_0x9b46('0xf')]=router; \ No newline at end of file +var _0x38e9=['index','put','/:id','update','/download_log_file','isAuthenticated','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x38e9,0x1b7));var _0x938e=function(_0x489c95,_0x53159c){_0x489c95=_0x489c95-0x0;var _0x10e7a7=_0x38e9[_0x489c95];return _0x10e7a7;};'use strict';var multer=require(_0x938e('0x0'));var util=require(_0x938e('0x1'));var path=require(_0x938e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x938e('0x3')]();var fs_extra=require(_0x938e('0x4'));var auth=require(_0x938e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x938e('0x6'));var controller=require(_0x938e('0x7'));router[_0x938e('0x8')]('/',controller[_0x938e('0x9')]);router[_0x938e('0xa')](_0x938e('0xb'),auth['isAuthenticated'](),controller[_0x938e('0xc')]);router[_0x938e('0x8')](_0x938e('0xd'),auth[_0x938e('0xe')](),controller['downloadLogFile']);module[_0x938e('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 2e8c11b..48c3740 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 _0x973e=['TEXT','STRING','INTEGER','exports'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x973e,0x9b));var _0xe973=function(_0x2580f4,_0x2016b5){_0x2580f4=_0x2580f4-0x0;var _0x5a8838=_0x973e[_0x2580f4];return _0x5a8838;};'use strict';var Sequelize=require('sequelize');module[_0xe973('0x0')]={'license':{'type':Sequelize[_0xe973('0x1')]},'data1':{'type':Sequelize[_0xe973('0x2')]},'data2':{'type':Sequelize[_0xe973('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe973('0x3')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 0fc62dd..0f8b02f 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 _0x9409=['intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','demo','downloadLogFile','license-info.log','/var','log','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','stack','name','model','keys','rawAttributes','query'];(function(_0x2f4e50,_0x3cbad7){var _0xfefb3f=function(_0xa8c8b){while(--_0xa8c8b){_0x2f4e50['push'](_0x2f4e50['shift']());}};_0xfefb3f(++_0x3cbad7);}(_0x9409,0x1af));var _0x9940=function(_0x6cfb8a,_0x53be6f){_0x6cfb8a=_0x6cfb8a-0x0;var _0x29ba1d=_0x9409[_0x6cfb8a];return _0x29ba1d;};'use strict';var emlformat=require(_0x9940('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9940('0x1'));var jsonpatch=require(_0x9940('0x2'));var rp=require('request-promise');var moment=require(_0x9940('0x3'));var BPromise=require(_0x9940('0x4'));var Mustache=require(_0x9940('0x5'));var util=require('util');var path=require(_0x9940('0x6'));var sox=require(_0x9940('0x7'));var csv=require(_0x9940('0x8'));var ejs=require(_0x9940('0x9'));var fs=require('fs');var fs_extra=require(_0x9940('0xa'));var _=require(_0x9940('0xb'));var squel=require(_0x9940('0xc'));var crypto=require(_0x9940('0xd'));var jsforce=require(_0x9940('0xe'));var deskjs=require(_0x9940('0xf'));var toCsv=require(_0x9940('0x8'));var querystring=require(_0x9940('0x10'));var Papa=require(_0x9940('0x11'));var Redis=require('ioredis');var authService=require(_0x9940('0x12'));var qs=require(_0x9940('0x13'));var as=require(_0x9940('0x14'));var hardwareService=require(_0x9940('0x15'));var logger=require(_0x9940('0x16'))('api');var utils=require(_0x9940('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9940('0x18'));var db=require(_0x9940('0x19'))['db'];function respondWithStatusCode(_0x2d1d52,_0x572990){_0x572990=_0x572990||0xcc;return function(_0x34ee9c){if(_0x34ee9c){return _0x2d1d52[_0x9940('0x1a')](_0x572990);}return _0x2d1d52[_0x9940('0x1b')](_0x572990)[_0x9940('0x1c')]();};}function respondWithResult(_0x5b8464,_0x208be1){_0x208be1=_0x208be1||0xc8;return function(_0x51de2d){if(_0x51de2d){return _0x5b8464[_0x9940('0x1b')](_0x208be1)[_0x9940('0x1d')](_0x51de2d);}};}function respondWithFilteredResult(_0x2b7401,_0x37db7d){return function(_0x4e4684){if(_0x4e4684){var _0x1067db=typeof _0x37db7d[_0x9940('0x1e')]===_0x9940('0x1f')&&typeof _0x37db7d['limit']===_0x9940('0x1f');var _0x313fbd=_0x4e4684[_0x9940('0x20')];var _0x18ce12=_0x1067db?0x0:_0x37db7d[_0x9940('0x1e')];var _0x123f9a=_0x1067db?_0x4e4684['count']:_0x37db7d['offset']+_0x37db7d['limit'];var _0x115c37;if(_0x123f9a>=_0x313fbd){_0x123f9a=_0x313fbd;_0x115c37=0xc8;}else{_0x115c37=0xce;}_0x2b7401[_0x9940('0x1b')](_0x115c37);return _0x2b7401['set']('Content-Range',_0x18ce12+'-'+_0x123f9a+'/'+_0x313fbd)[_0x9940('0x1d')](_0x4e4684);}return null;};}function patchUpdates(_0x1ccec2){return function(_0x20b25a){try{jsonpatch[_0x9940('0x21')](_0x20b25a,_0x1ccec2,!![]);}catch(_0xbf7768){return BPromise[_0x9940('0x22')](_0xbf7768);}return _0x20b25a[_0x9940('0x23')]();};}function saveUpdates(_0x3b0fcd,_0x14123a){return function(_0x1f4adc){if(_0x1f4adc){return _0x1f4adc[_0x9940('0x24')](_0x3b0fcd)[_0x9940('0x25')](function(_0x3c33e1){return _0x3c33e1;});}return null;};}function removeEntity(_0x5f2049,_0x10cec3){return function(_0x25e893){if(_0x25e893){return _0x25e893[_0x9940('0x26')]()['then'](function(){_0x5f2049[_0x9940('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c533c,_0x81ec53){return function(_0x40cc34){if(!_0x40cc34){_0x4c533c[_0x9940('0x1a')](0x194);}return _0x40cc34;};}function handleError(_0x184144,_0x475aae){_0x475aae=_0x475aae||0x1f4;return function(_0x1aed68){logger['error'](_0x1aed68[_0x9940('0x27')]);if(_0x1aed68[_0x9940('0x28')]){delete _0x1aed68['name'];}_0x184144[_0x9940('0x1b')](_0x475aae)['send'](_0x1aed68);};}var utilLicense=require(_0x9940('0x18'));exports['index']=function(_0x39ad5d,_0x51935e){var _0xcb2d40={'raw':!![],'where':{'id':0x1}},_0x3c1921={};_0x3c1921[_0x9940('0x29')]=_[_0x9940('0x2a')](db['License'][_0x9940('0x2b')]);_0x3c1921[_0x9940('0x2c')]=_['keys'](_0x39ad5d[_0x9940('0x2c')]);_0x3c1921['filters']=_[_0x9940('0x2d')](_0x3c1921[_0x9940('0x29')],_0x3c1921[_0x9940('0x2c')]);_0xcb2d40[_0x9940('0x2e')]=_['intersection'](_0x3c1921[_0x9940('0x29')],qs[_0x9940('0x2f')](_0x39ad5d[_0x9940('0x2c')][_0x9940('0x2f')]));_0xcb2d40[_0x9940('0x2e')]=_0xcb2d40[_0x9940('0x2e')][_0x9940('0x30')]?_0xcb2d40[_0x9940('0x2e')]:_0x3c1921[_0x9940('0x29')];_0xcb2d40=_[_0x9940('0x31')]({},_0xcb2d40,_0x39ad5d[_0x9940('0x32')]);return utilLicense[_0x9940('0x33')](_0xcb2d40)[_0x9940('0x25')](respondWithResult(_0x51935e,null))[_0x9940('0x34')](handleError(_0x51935e,null));};exports['update']=function(_0x95941,_0x4a1dff){if(_0x95941['body']['id']){delete _0x95941[_0x9940('0x35')]['id'];}return db['License'][_0x9940('0x36')]({'where':{'id':_0x95941[_0x9940('0x37')]['id']}})[_0x9940('0x25')](handleEntityNotFound(_0x4a1dff,null))[_0x9940('0x25')](function(_0x3defee){var _0x14d73a=_0x3defee[_0x9940('0x38')]({'plain':!![]});return utilLicense[_0x9940('0x39')](_0x14d73a,_0x95941[_0x9940('0x35')]['key']);})[_0x9940('0x25')](function(_0x34ba98){if(!_0x34ba98[_0x9940('0x3a')]){return saveUpdates(_0x95941[_0x9940('0x35')],null);}return _0x34ba98;})[_0x9940('0x25')](respondWithResult(_0x4a1dff,null))[_0x9940('0x34')](handleError(_0x4a1dff,null));};exports[_0x9940('0x3b')]=function(_0x38e4a1,_0x6b3549){var _0x597b69=_0x9940('0x3c');var _0x40006a=path['join'](_0x9940('0x3d'),_0x9940('0x3e'),'xcally',_0x597b69);_0x6b3549['setHeader'](_0x9940('0x3f'),_0x9940('0x40')+_0x597b69);_0x6b3549['set'](_0x9940('0x41'),_0x9940('0x42'));_0x6b3549[_0x9940('0x43')](_0x40006a);}; \ No newline at end of file +var _0xd52f=['Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','send','../../config/license/util','License','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','merge','getLicense','catch','body','find','params','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','setHeader'];(function(_0x3c95fa,_0x2d4d31){var _0x2f3ff4=function(_0x4b88a0){while(--_0x4b88a0){_0x3c95fa['push'](_0x3c95fa['shift']());}};_0x2f3ff4(++_0x2d4d31);}(_0xd52f,0xda));var _0xfd52=function(_0x8091ad,_0x4eabf5){_0x8091ad=_0x8091ad-0x0;var _0x4bf25d=_0xd52f[_0x8091ad];return _0x4bf25d;};'use strict';var emlformat=require(_0xfd52('0x0'));var rimraf=require(_0xfd52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfd52('0x2'));var moment=require(_0xfd52('0x3'));var BPromise=require(_0xfd52('0x4'));var Mustache=require(_0xfd52('0x5'));var util=require(_0xfd52('0x6'));var path=require(_0xfd52('0x7'));var sox=require(_0xfd52('0x8'));var csv=require(_0xfd52('0x9'));var ejs=require(_0xfd52('0xa'));var fs=require('fs');var fs_extra=require(_0xfd52('0xb'));var _=require(_0xfd52('0xc'));var squel=require(_0xfd52('0xd'));var crypto=require(_0xfd52('0xe'));var jsforce=require(_0xfd52('0xf'));var deskjs=require(_0xfd52('0x10'));var toCsv=require(_0xfd52('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfd52('0x11'));var authService=require(_0xfd52('0x12'));var qs=require(_0xfd52('0x13'));var as=require(_0xfd52('0x14'));var hardwareService=require(_0xfd52('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xfd52('0x16'));var config=require(_0xfd52('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd52('0x18'))['db'];function respondWithStatusCode(_0x351ab6,_0x54b534){_0x54b534=_0x54b534||0xcc;return function(_0x4b82d0){if(_0x4b82d0){return _0x351ab6[_0xfd52('0x19')](_0x54b534);}return _0x351ab6[_0xfd52('0x1a')](_0x54b534)[_0xfd52('0x1b')]();};}function respondWithResult(_0x582710,_0x927126){_0x927126=_0x927126||0xc8;return function(_0xb8df88){if(_0xb8df88){return _0x582710[_0xfd52('0x1a')](_0x927126)[_0xfd52('0x1c')](_0xb8df88);}};}function respondWithFilteredResult(_0x1c5083,_0x1acd6d){return function(_0xcc9765){if(_0xcc9765){var _0x25a654=typeof _0x1acd6d[_0xfd52('0x1d')]===_0xfd52('0x1e')&&typeof _0x1acd6d[_0xfd52('0x1f')]==='undefined';var _0x405f7f=_0xcc9765['count'];var _0x3ec258=_0x25a654?0x0:_0x1acd6d['offset'];var _0x30b2e9=_0x25a654?_0xcc9765[_0xfd52('0x20')]:_0x1acd6d['offset']+_0x1acd6d[_0xfd52('0x1f')];var _0x112d47;if(_0x30b2e9>=_0x405f7f){_0x30b2e9=_0x405f7f;_0x112d47=0xc8;}else{_0x112d47=0xce;}_0x1c5083[_0xfd52('0x1a')](_0x112d47);return _0x1c5083['set']('Content-Range',_0x3ec258+'-'+_0x30b2e9+'/'+_0x405f7f)[_0xfd52('0x1c')](_0xcc9765);}return null;};}function patchUpdates(_0x308fe5){return function(_0x2e5020){try{jsonpatch[_0xfd52('0x21')](_0x2e5020,_0x308fe5,!![]);}catch(_0x33e161){return BPromise['reject'](_0x33e161);}return _0x2e5020[_0xfd52('0x22')]();};}function saveUpdates(_0x382594,_0x1e55ad){return function(_0x4896d3){if(_0x4896d3){return _0x4896d3[_0xfd52('0x23')](_0x382594)[_0xfd52('0x24')](function(_0x16af11){return _0x16af11;});}return null;};}function removeEntity(_0x73405b,_0x354980){return function(_0x559a8f){if(_0x559a8f){return _0x559a8f[_0xfd52('0x25')]()[_0xfd52('0x24')](function(){_0x73405b[_0xfd52('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ee2f,_0x124e21){return function(_0x31f0c1){if(!_0x31f0c1){_0x13ee2f['sendStatus'](0x194);}return _0x31f0c1;};}function handleError(_0x2c241e,_0x4cee31){_0x4cee31=_0x4cee31||0x1f4;return function(_0x54dd3a){logger[_0xfd52('0x26')](_0x54dd3a['stack']);if(_0x54dd3a['name']){delete _0x54dd3a['name'];}_0x2c241e[_0xfd52('0x1a')](_0x4cee31)[_0xfd52('0x27')](_0x54dd3a);};}var utilLicense=require(_0xfd52('0x28'));exports['index']=function(_0x4c93c0,_0x4c772c){var _0x53b1d8={'raw':!![],'where':{'id':0x1}},_0x458be6={};_0x458be6['model']=_['keys'](db[_0xfd52('0x29')][_0xfd52('0x2a')]);_0x458be6[_0xfd52('0x2b')]=_[_0xfd52('0x2c')](_0x4c93c0['query']);_0x458be6[_0xfd52('0x2d')]=_[_0xfd52('0x2e')](_0x458be6[_0xfd52('0x2f')],_0x458be6[_0xfd52('0x2b')]);_0x53b1d8[_0xfd52('0x30')]=_[_0xfd52('0x2e')](_0x458be6[_0xfd52('0x2f')],qs[_0xfd52('0x31')](_0x4c93c0[_0xfd52('0x2b')][_0xfd52('0x31')]));_0x53b1d8[_0xfd52('0x30')]=_0x53b1d8['attributes'][_0xfd52('0x32')]?_0x53b1d8[_0xfd52('0x30')]:_0x458be6[_0xfd52('0x2f')];_0x53b1d8=_[_0xfd52('0x33')]({},_0x53b1d8,_0x4c93c0['options']);return utilLicense[_0xfd52('0x34')](_0x53b1d8)[_0xfd52('0x24')](respondWithResult(_0x4c772c,null))[_0xfd52('0x35')](handleError(_0x4c772c,null));};exports[_0xfd52('0x23')]=function(_0x20dbc2,_0x52ffba){if(_0x20dbc2['body']['id']){delete _0x20dbc2[_0xfd52('0x36')]['id'];}return db['License'][_0xfd52('0x37')]({'where':{'id':_0x20dbc2[_0xfd52('0x38')]['id']}})[_0xfd52('0x24')](handleEntityNotFound(_0x52ffba,null))[_0xfd52('0x24')](function(_0x36151c){var _0x1a1105=_0x36151c[_0xfd52('0x39')]({'plain':!![]});return utilLicense[_0xfd52('0x3a')](_0x1a1105,_0x20dbc2[_0xfd52('0x36')][_0xfd52('0x3b')]);})[_0xfd52('0x24')](function(_0xd21bc6){if(!_0xd21bc6['demo']){return saveUpdates(_0x20dbc2[_0xfd52('0x36')],null);}return _0xd21bc6;})[_0xfd52('0x24')](respondWithResult(_0x52ffba,null))[_0xfd52('0x35')](handleError(_0x52ffba,null));};exports[_0xfd52('0x3c')]=function(_0x287c3e,_0x2facf1){var _0x467d1b=_0xfd52('0x3d');var _0x1a7fb4=path[_0xfd52('0x3e')](_0xfd52('0x3f'),_0xfd52('0x40'),'xcally',_0x467d1b);_0x2facf1[_0xfd52('0x41')](_0xfd52('0x42'),_0xfd52('0x43')+_0x467d1b);_0x2facf1['set'](_0xfd52('0x44'),_0xfd52('0x45'));_0x2facf1[_0xfd52('0x46')](_0x1a7fb4);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 0c03d2e..ee828a4 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 _0xe789=['License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','define'];(function(_0x2631d5,_0x204bf4){var _0x36521f=function(_0x188f8f){while(--_0x188f8f){_0x2631d5['push'](_0x2631d5['shift']());}};_0x36521f(++_0x204bf4);}(_0xe789,0x1af));var _0x9e78=function(_0x3fc0d7,_0x10fc1d){_0x3fc0d7=_0x3fc0d7-0x0;var _0x1b2dcb=_0xe789[_0x3fc0d7];return _0x1b2dcb;};'use strict';var _=require(_0x9e78('0x0'));var util=require(_0x9e78('0x1'));var logger=require(_0x9e78('0x2'))(_0x9e78('0x3'));var moment=require(_0x9e78('0x4'));var BPromise=require(_0x9e78('0x5'));var rp=require(_0x9e78('0x6'));var fs=require('fs');var path=require(_0x9e78('0x7'));var rimraf=require('rimraf');var config=require(_0x9e78('0x8'));var attributes=require(_0x9e78('0x9'));module['exports']=function(_0x53af67,_0x38a8a7){return _0x53af67[_0x9e78('0xa')](_0x9e78('0xb'),attributes,{'tableName':_0x9e78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8106=['../../config/environment','./license.attributes','exports','define','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x2c92a7,_0x1618e1){var _0xd33018=function(_0x152fdd){while(--_0x152fdd){_0x2c92a7['push'](_0x2c92a7['shift']());}};_0xd33018(++_0x1618e1);}(_0x8106,0x1c7));var _0x6810=function(_0x5cd3f0,_0xfb86ad){_0x5cd3f0=_0x5cd3f0-0x0;var _0x6a1a31=_0x8106[_0x5cd3f0];return _0x6a1a31;};'use strict';var _=require(_0x6810('0x0'));var util=require(_0x6810('0x1'));var logger=require('../../config/logger')(_0x6810('0x2'));var moment=require(_0x6810('0x3'));var BPromise=require('bluebird');var rp=require(_0x6810('0x4'));var fs=require('fs');var path=require(_0x6810('0x5'));var rimraf=require(_0x6810('0x6'));var config=require(_0x6810('0x7'));var attributes=require(_0x6810('0x8'));module[_0x6810('0x9')]=function(_0x4d94be,_0x118275){return _0x4d94be[_0x6810('0xa')]('License',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 5ea46fc..7683fc8 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 _0x673b=['client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x5d2817,_0x18d475){var _0x30103b=function(_0x4f9d7f){while(--_0x4f9d7f){_0x5d2817['push'](_0x5d2817['shift']());}};_0x30103b(++_0x18d475);}(_0x673b,0x85));var _0xb673=function(_0x9f8c46,_0x40fed7){_0x9f8c46=_0x9f8c46-0x0;var _0x233e97=_0x673b[_0x9f8c46];return _0x233e97;};'use strict';var _=require('lodash');var util=require(_0xb673('0x0'));var moment=require(_0xb673('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb673('0x2'));var db=require(_0xb673('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb673('0x4'));var config=require(_0xb673('0x5'));var jayson=require(_0xb673('0x6'));var client=jayson[_0xb673('0x7')][_0xb673('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4adc24,_0x4e62a3,_0x3e5cd1){return new BPromise(function(_0x11ac90,_0x1c1171){return client[_0xb673('0x9')](_0x4adc24,_0x3e5cd1)[_0xb673('0xa')](function(_0x22a955){logger[_0xb673('0xb')](_0xb673('0xc'),_0x4e62a3,_0xb673('0xd'));logger[_0xb673('0xe')](_0xb673('0xf'),_0x4e62a3,'request\x20sent',JSON['stringify'](_0x22a955));if(_0x22a955[_0xb673('0x10')]){if(_0x22a955['error'][_0xb673('0x11')]===0x1f4){logger[_0xb673('0x10')]('License,\x20%s,\x20%s',_0x4e62a3,_0x22a955[_0xb673('0x10')][_0xb673('0x12')]);return _0x1c1171(_0x22a955[_0xb673('0x10')][_0xb673('0x12')]);}logger[_0xb673('0x10')](_0xb673('0xc'),_0x4e62a3,_0x22a955['error'][_0xb673('0x12')]);return _0x11ac90(_0x22a955['error'][_0xb673('0x12')]);}else{logger[_0xb673('0xb')](_0xb673('0xc'),_0x4e62a3,_0xb673('0xd'));_0x11ac90(_0x22a955['result'][_0xb673('0x12')]);}})[_0xb673('0x13')](function(_0x374c60){logger[_0xb673('0x10')](_0xb673('0xc'),_0x4e62a3,_0x374c60);_0x1c1171(_0x374c60);});});} \ No newline at end of file +var _0x0021=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','License,\x20%s,\x20%s'];(function(_0x22eb5d,_0x2e519d){var _0x4a39ad=function(_0x4a1206){while(--_0x4a1206){_0x22eb5d['push'](_0x22eb5d['shift']());}};_0x4a39ad(++_0x2e519d);}(_0x0021,0x1b8));var _0x1002=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x0021[_0x510c60];return _0x49c4aa;};'use strict';var _=require(_0x1002('0x0'));var util=require(_0x1002('0x1'));var moment=require(_0x1002('0x2'));var BPromise=require(_0x1002('0x3'));var rs=require(_0x1002('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1002('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1002('0x6'))(_0x1002('0x7'));var config=require(_0x1002('0x8'));var jayson=require(_0x1002('0x9'));var client=jayson[_0x1002('0xa')][_0x1002('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51f6ee,_0x2fc4a0,_0x2cd8ef){return new BPromise(function(_0x3c5491,_0x3951cf){return client[_0x1002('0xc')](_0x51f6ee,_0x2cd8ef)[_0x1002('0xd')](function(_0x4c9141){logger['info']('License,\x20%s,\x20%s',_0x2fc4a0,_0x1002('0xe'));logger[_0x1002('0xf')](_0x1002('0x10'),_0x2fc4a0,_0x1002('0xe'),JSON[_0x1002('0x11')](_0x4c9141));if(_0x4c9141[_0x1002('0x12')]){if(_0x4c9141[_0x1002('0x12')]['code']===0x1f4){logger[_0x1002('0x12')](_0x1002('0x13'),_0x2fc4a0,_0x4c9141[_0x1002('0x12')][_0x1002('0x14')]);return _0x3951cf(_0x4c9141['error'][_0x1002('0x14')]);}logger[_0x1002('0x12')]('License,\x20%s,\x20%s',_0x2fc4a0,_0x4c9141[_0x1002('0x12')][_0x1002('0x14')]);return _0x3c5491(_0x4c9141[_0x1002('0x12')]['message']);}else{logger['info'](_0x1002('0x13'),_0x2fc4a0,_0x1002('0xe'));_0x3c5491(_0x4c9141[_0x1002('0x15')][_0x1002('0x14')]);}})[_0x1002('0x16')](function(_0x1dbb3f){logger['error']('License,\x20%s,\x20%s',_0x2fc4a0,_0x1dbb3f);_0x3951cf(_0x1dbb3f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a0360d1..fea56f8 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 _0x4784=['addAnswer','create','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeImap','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','verifySmtp','post'];(function(_0x2894,_0x43bd89){var _0x2f7731=function(_0x36208d){while(--_0x36208d){_0x2894['push'](_0x2894['shift']());}};_0x2f7731(++_0x43bd89);}(_0x4784,0xbb));var _0x4478=function(_0x4c0bf0,_0x31253e){_0x4c0bf0=_0x4c0bf0-0x0;var _0xb092c0=_0x4784[_0x4c0bf0];return _0xb092c0;};'use strict';var multer=require(_0x4478('0x0'));var util=require('util');var path=require(_0x4478('0x1'));var timeout=require(_0x4478('0x2'));var express=require(_0x4478('0x3'));var router=express[_0x4478('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4478('0x5'));var interaction=require(_0x4478('0x6'));var config=require(_0x4478('0x7'));var controller=require(_0x4478('0x8'));router[_0x4478('0x9')]('/',auth[_0x4478('0xa')](),controller['index']);router[_0x4478('0x9')](_0x4478('0xb'),auth[_0x4478('0xa')](),controller['describe']);router['get'](_0x4478('0xc'),auth[_0x4478('0xa')](),controller[_0x4478('0xd')]);router['get'](_0x4478('0xe'),auth[_0x4478('0xa')](),controller['getDispositions']);router[_0x4478('0x9')](_0x4478('0xf'),auth[_0x4478('0xa')](),controller[_0x4478('0x10')]);router['get'](_0x4478('0x11'),auth['isAuthenticated'](),controller[_0x4478('0x12')]);router['get'](_0x4478('0x13'),auth[_0x4478('0xa')](),controller[_0x4478('0x14')]);router[_0x4478('0x9')](_0x4478('0x15'),auth['isAuthenticated'](),controller[_0x4478('0x16')]);router[_0x4478('0x9')](_0x4478('0x17'),auth['isAuthenticated'](),controller[_0x4478('0x18')]);router[_0x4478('0x9')]('/:id/messages',auth[_0x4478('0xa')](),controller[_0x4478('0x19')]);router[_0x4478('0x9')]('/:id/verify',auth[_0x4478('0xa')](),controller[_0x4478('0x1a')]);router[_0x4478('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x4478('0x1b')](_0x4478('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x4478('0x1b')](_0x4478('0xf'),auth['isAuthenticated'](),controller[_0x4478('0x1c')]);router['post']('/',auth[_0x4478('0xa')](),controller[_0x4478('0x1d')]);router['post']('/:id/in_servers',auth[_0x4478('0xa')](),controller['addImap']);router[_0x4478('0x1b')](_0x4478('0x13'),auth[_0x4478('0xa')](),controller['addSmtp']);router['post'](_0x4478('0x15'),auth[_0x4478('0xa')](),controller[_0x4478('0x1e')]);router['post'](_0x4478('0x17'),auth[_0x4478('0xa')](),controller[_0x4478('0x1f')]);router[_0x4478('0x1b')](_0x4478('0x20'),auth[_0x4478('0xa')](),controller[_0x4478('0x21')]);router[_0x4478('0x1b')](_0x4478('0x22'),auth[_0x4478('0xa')](),controller[_0x4478('0x23')]);router[_0x4478('0x24')](_0x4478('0xc'),auth[_0x4478('0xa')](),controller[_0x4478('0x25')]);router[_0x4478('0x26')](_0x4478('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x4478('0x26')](_0x4478('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x4478('0x26')]('/:id/in_servers',auth[_0x4478('0xa')](),controller[_0x4478('0x27')]);router[_0x4478('0x26')](_0x4478('0x13'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x4478('0x26')](_0x4478('0xc'),auth[_0x4478('0xa')](),controller[_0x4478('0x28')]);router[_0x4478('0x26')]('/:id/users',auth[_0x4478('0xa')](),controller[_0x4478('0x29')]);module[_0x4478('0x2a')]=router; \ No newline at end of file +var _0x3f17=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getImap','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','create','/:id/in_servers','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','connect-timeout','express'];(function(_0x41d736,_0x835d40){var _0x263714=function(_0x37d81c){while(--_0x37d81c){_0x41d736['push'](_0x41d736['shift']());}};_0x263714(++_0x835d40);}(_0x3f17,0x92));var _0x73f1=function(_0x48a737,_0x167881){_0x48a737=_0x48a737-0x0;var _0x1add4e=_0x3f17[_0x48a737];return _0x1add4e;};'use strict';var multer=require('multer');var util=require(_0x73f1('0x0'));var path=require(_0x73f1('0x1'));var timeout=require(_0x73f1('0x2'));var express=require(_0x73f1('0x3'));var router=express['Router']();var fs_extra=require(_0x73f1('0x4'));var auth=require(_0x73f1('0x5'));var interaction=require(_0x73f1('0x6'));var config=require(_0x73f1('0x7'));var controller=require(_0x73f1('0x8'));router[_0x73f1('0x9')]('/',auth[_0x73f1('0xa')](),controller[_0x73f1('0xb')]);router['get'](_0x73f1('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x73f1('0x9')](_0x73f1('0xd'),auth['isAuthenticated'](),controller[_0x73f1('0xe')]);router[_0x73f1('0x9')](_0x73f1('0xf'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x10')]);router[_0x73f1('0x9')]('/:id/canned_answers',auth[_0x73f1('0xa')](),controller[_0x73f1('0x11')]);router[_0x73f1('0x9')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x73f1('0x12')]);router[_0x73f1('0x9')]('/:id/out_servers',auth[_0x73f1('0xa')](),controller[_0x73f1('0x13')]);router['get'](_0x73f1('0x14'),auth[_0x73f1('0xa')](),controller['getInteractions']);router['get'](_0x73f1('0x15'),auth['isAuthenticated'](),controller[_0x73f1('0x16')]);router[_0x73f1('0x9')](_0x73f1('0x17'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x18')]);router[_0x73f1('0x9')](_0x73f1('0x19'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x1a')]);router[_0x73f1('0x9')](_0x73f1('0x1b'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x1c')]);router[_0x73f1('0x1d')](_0x73f1('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x73f1('0x1d')](_0x73f1('0x1e'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x1f')]);router['post']('/',auth[_0x73f1('0xa')](),controller[_0x73f1('0x20')]);router[_0x73f1('0x1d')](_0x73f1('0x21'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x22')]);router['post'](_0x73f1('0x23'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x24')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x73f1('0x25')]);router[_0x73f1('0x1d')](_0x73f1('0x15'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x26')]);router[_0x73f1('0x1d')](_0x73f1('0x27'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x28')]);router[_0x73f1('0x1d')](_0x73f1('0x1b'),auth['isAuthenticated'](),controller[_0x73f1('0x29')]);router['put'](_0x73f1('0xd'),auth['isAuthenticated'](),controller[_0x73f1('0x2a')]);router[_0x73f1('0x2b')](_0x73f1('0xf'),auth['isAuthenticated'](),controller[_0x73f1('0x2c')]);router[_0x73f1('0x2b')]('/:id/canned_answers',auth[_0x73f1('0xa')](),controller['removeAnswers']);router['delete'](_0x73f1('0x21'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x2d')]);router[_0x73f1('0x2b')]('/:id/out_servers',auth[_0x73f1('0xa')](),controller[_0x73f1('0x2e')]);router[_0x73f1('0x2b')](_0x73f1('0xd'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x2f')]);router[_0x73f1('0x2b')](_0x73f1('0x1b'),auth[_0x73f1('0xa')](),controller[_0x73f1('0x30')]);module[_0x73f1('0x31')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 1ea8ea4..9ebc521 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 _0x3776=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','outlook365','getDataValue','provider','sequelize','exports','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x51e8e8,_0xed25d0){var _0x436a82=function(_0x2b775d){while(--_0x2b775d){_0x51e8e8['push'](_0x51e8e8['shift']());}};_0x436a82(++_0xed25d0);}(_0x3776,0x111));var _0x6377=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x3776[_0x5c72ee];return _0x231876;};'use strict';var Sequelize=require(_0x6377('0x0'));module[_0x6377('0x1')]={'description':{'type':Sequelize[_0x6377('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x6377('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x6377('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x6377('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6377('0x2')],'allowNull':![],'defaultValue':_0x6377('0x4')},'fontSize':{'type':Sequelize[_0x6377('0x5')](0x2)[_0x6377('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6377('0x7');}},'notificationSound':{'type':Sequelize[_0x6377('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6377('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6377('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6377('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6377('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6377('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6377('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6377('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6377('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x6377('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x6377('0x8')],'defaultValue':![],'comment':_0x6377('0xa'),'set':function(_0x3ea833){if(!_0x3ea833)this['setDataValue'](_0x6377('0xb'),null);this[_0x6377('0xc')](_0x6377('0xd'),_0x3ea833);}},'provider':{'type':Sequelize[_0x6377('0xe')](_0x6377('0xf'),_0x6377('0x10'),'yahoo',_0x6377('0x11')),'defaultValue':null,'get':function(){var _0x383aae=this[_0x6377('0x12')](_0x6377('0x13'));return _0x383aae||'custom';},'set':function(_0x315a1e){if(_0x315a1e==='custom'){_0x315a1e=null;}return this[_0x6377('0xc')](_0x6377('0x13'),_0x315a1e);}}}; \ No newline at end of file +var _0x96aa=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x18c5cd,_0x8b8a53){var _0x6ede66=function(_0x45c5fc){while(--_0x45c5fc){_0x18c5cd['push'](_0x18c5cd['shift']());}};_0x6ede66(++_0x8b8a53);}(_0x96aa,0x6e));var _0xa96a=function(_0x441c2a,_0x3d7e3a){_0x441c2a=_0x441c2a-0x0;var _0x5eaec4=_0x96aa[_0x441c2a];return _0x5eaec4;};'use strict';var Sequelize=require(_0xa96a('0x0'));module[_0xa96a('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xa96a('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa96a('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xa96a('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xa96a('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xa96a('0x4')]},'markAsUnread':{'type':Sequelize[_0xa96a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa96a('0x2')],'allowNull':![],'defaultValue':_0xa96a('0x5')},'fontSize':{'type':Sequelize[_0xa96a('0x6')](0x2)[_0xa96a('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa96a('0x4')],'defaultValue':function(){return _0xa96a('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa96a('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa96a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa96a('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa96a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa96a('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa96a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa96a('0x3')],'defaultValue':![],'comment':_0xa96a('0xa'),'set':function(_0x464f86){if(!_0x464f86)this[_0xa96a('0xb')]('mandatoryDispositionPauseId',null);this[_0xa96a('0xb')](_0xa96a('0xc'),_0x464f86);}},'provider':{'type':Sequelize[_0xa96a('0xd')](_0xa96a('0xe'),_0xa96a('0xf'),_0xa96a('0x10'),_0xa96a('0x11')),'defaultValue':null,'get':function(){var _0x34c8fd=this['getDataValue'](_0xa96a('0x12'));return _0x34c8fd||_0xa96a('0x13');},'set':function(_0x4b1117){if(_0x4b1117===_0xa96a('0x13')){_0x4b1117=null;}return this[_0xa96a('0xb')](_0xa96a('0x12'),_0x4b1117);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0b3a02b..aa10579 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 _0x544e=['merge','VIRTUAL','includeAll','findAll','show','MailServerIn','MailServerOut','options','find','update','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','params','MailAccountId','findOne','Disposition','pick','include','rows','removeDispositions','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','ids','custom','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','fullname','internal','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','sendMail','List','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','addAgents','omit','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','MailAccounts','UserProfileResource','destroy','end','stack','name','send','gmail','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','authentication','Smtp','index','Imap','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x45c02a,_0x486a46){var _0x5edbd7=function(_0x2fdb3b){while(--_0x2fdb3b){_0x45c02a['push'](_0x45c02a['shift']());}};_0x5edbd7(++_0x486a46);}(_0x544e,0x130));var _0xe544=function(_0x582e91,_0x3e7018){_0x582e91=_0x582e91-0x0;var _0x24752e=_0x544e[_0x582e91];return _0x24752e;};'use strict';var moment=require(_0xe544('0x0'));var BPromise=require(_0xe544('0x1'));var util=require(_0xe544('0x2'));var path=require(_0xe544('0x3'));var _=require(_0xe544('0x4'));var juice=require(_0xe544('0x5'));var Redis=require(_0xe544('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xe544('0x7'))(_0xe544('0x8'));var config=require(_0xe544('0x9'));var db=require(_0xe544('0xa'))['db'];config[_0xe544('0xb')]=_[_0xe544('0xc')](config[_0xe544('0xb')],{'host':_0xe544('0xd'),'port':0x18eb});var socket=require(_0xe544('0xe'))(new Redis(config[_0xe544('0xb')]));require(_0xe544('0xf'))[_0xe544('0x10')](socket);var jayson=require(_0xe544('0x11'));var client=jayson[_0xe544('0x12')][_0xe544('0x13')]({'port':0x232b});function respondWithRpcPromise(_0x994747,_0x2cdaea,_0x2fd757,_0x1a6173){return new BPromise(function(_0x4ec65d,_0x4fa865){var _0x57be9d=_0x1a6173||client;return _0x57be9d[_0xe544('0x14')](_0x994747,_0x2fd757)['then'](function(_0x3ae2f6){logger[_0xe544('0x15')](_0xe544('0x16'),_0x2cdaea,_0xe544('0x17'));logger['debug'](_0xe544('0x18'),_0x2cdaea,_0xe544('0x17'),JSON[_0xe544('0x19')](_0x3ae2f6));if(_0x3ae2f6[_0xe544('0x1a')]){if(_0x3ae2f6[_0xe544('0x1a')][_0xe544('0x1b')]===0x1f4){logger['error'](_0xe544('0x16'),_0x2cdaea,_0x3ae2f6[_0xe544('0x1a')][_0xe544('0x1c')]);return _0x4fa865(_0x3ae2f6['error'][_0xe544('0x1c')]);}logger[_0xe544('0x1a')](_0xe544('0x16'),_0x2cdaea,_0x3ae2f6['error']['message']);return _0x4ec65d(_0x3ae2f6['error'][_0xe544('0x1c')]);}else{logger[_0xe544('0x15')](_0xe544('0x16'),_0x2cdaea,_0xe544('0x17'));_0x4ec65d(_0x3ae2f6[_0xe544('0x1d')]['message']);}})[_0xe544('0x1e')](function(_0x5d0d62){logger[_0xe544('0x1a')](_0xe544('0x16'),_0x2cdaea,_0x5d0d62);_0x4fa865(_0x5d0d62);});});}function respondWithStatusCode(_0x439c72,_0x8ed011){_0x8ed011=_0x8ed011||0xcc;return function(_0x9a3f46){if(_0x9a3f46){return _0x439c72[_0xe544('0x1f')](_0x8ed011);}return _0x439c72[_0xe544('0x20')](_0x8ed011)['end']();};}function respondWithResult(_0x112c89,_0x55c001){_0x55c001=_0x55c001||0xc8;return function(_0x29859f){if(_0x29859f){return _0x112c89[_0xe544('0x20')](_0x55c001)[_0xe544('0x21')](_0x29859f);}};}function respondWithFilteredResult(_0xf0875f,_0x24f955){return function(_0x1e3218){if(_0x1e3218){var _0x27cac3=typeof _0x24f955[_0xe544('0x22')]===_0xe544('0x23')&&typeof _0x24f955[_0xe544('0x24')]===_0xe544('0x23');var _0x9cf5ee=_0x1e3218[_0xe544('0x25')];var _0x2d6d92=_0x27cac3?0x0:_0x24f955[_0xe544('0x22')];var _0xfa43a0=_0x27cac3?_0x1e3218[_0xe544('0x25')]:_0x24f955[_0xe544('0x22')]+_0x24f955['limit'];var _0x29de86;if(_0xfa43a0>=_0x9cf5ee){_0xfa43a0=_0x9cf5ee;_0x29de86=0xc8;}else{_0x29de86=0xce;}_0xf0875f[_0xe544('0x20')](_0x29de86);return _0xf0875f[_0xe544('0x26')](_0xe544('0x27'),_0x2d6d92+'-'+_0xfa43a0+'/'+_0x9cf5ee)[_0xe544('0x21')](_0x1e3218);}return null;};}function saveUpdates(_0x2defe3){return function(_0x181e58){if(_0x181e58){return _0x181e58['update'](_0x2defe3)['then'](function(_0x2e75f5){return _0x2e75f5;});}return null;};}function removeEntity(_0x7a4818){return function(_0x573b25){if(_0x573b25){return _0x573b25['destroy']()[_0xe544('0x28')](function(){var _0x3aea41=_0x573b25['get']({'plain':!![]});var _0x5437d9=_0xe544('0x29');return db[_0xe544('0x2a')][_0xe544('0x2b')]({'where':{'type':_0x5437d9,'resourceId':_0x3aea41['id']}})[_0xe544('0x28')](function(){return _0x573b25;});})[_0xe544('0x28')](function(){_0x7a4818[_0xe544('0x20')](0xcc)[_0xe544('0x2c')]();});}};}function handleEntityNotFound(_0x5e763a){return function(_0x25db00){if(!_0x25db00){_0x5e763a[_0xe544('0x1f')](0x194);}return _0x25db00;};}function handleError(_0x5e2a9f,_0x25712f){_0x25712f=_0x25712f||0x1f4;return function(_0x4f531e){logger[_0xe544('0x1a')](_0x4f531e[_0xe544('0x2d')]);if(_0x4f531e['name']){delete _0x4f531e[_0xe544('0x2e')];}_0x5e2a9f[_0xe544('0x20')](_0x25712f)[_0xe544('0x2f')](_0x4f531e);};}function getImapHost(_0x52cdf4){switch(_0x52cdf4){case _0xe544('0x30'):return'imap.gmail.com';case _0xe544('0x31'):return'imap.mail.yahoo.com';case'hotmail':return _0xe544('0x32');case _0xe544('0x33'):return _0xe544('0x34');}throw new Error(_0xe544('0x35'),_0x52cdf4);}function getSmtpHost(_0x910b61){switch(_0x910b61){case _0xe544('0x30'):return _0xe544('0x36');case _0xe544('0x31'):return'smtp.mail.yahoo.com';case _0xe544('0x37'):return _0xe544('0x38');case _0xe544('0x33'):return _0xe544('0x39');}throw new Error(_0xe544('0x35'),_0x910b61);}function getAuthenticationOptions(_0x2b659b,_0x579ffe){var _0x379069={};var _0x3f6a40={};if(_0x2b659b){_0x379069[_0xe544('0x3a')]=_0x3f6a40[_0xe544('0x3a')]=_0x579ffe[_0xe544('0x3b')];_0x379069[_0xe544('0x3c')]=_0x3f6a40['pass']=_0x579ffe[_0xe544('0x3c')];if(_0x579ffe[_0xe544('0x3d')]){_0x379069['modernAuthentication']=_0x3f6a40[_0xe544('0x3d')]=!![];_0x379069[_0xe544('0x3e')]=_0x3f6a40[_0xe544('0x3e')]=_0x579ffe[_0xe544('0x3e')];_0x379069[_0xe544('0x3c')]=_0x3f6a40[_0xe544('0x3f')]=null;}else{_0x379069[_0xe544('0x3e')]=_0x3f6a40[_0xe544('0x3e')]=null;}_0x379069['host']=getImapHost(_0x2b659b);_0x379069[_0xe544('0x40')]=0x3e1;_0x3f6a40[_0xe544('0x41')]=getSmtpHost(_0x2b659b);_0x3f6a40[_0xe544('0x40')]=0x24b;_0x3f6a40[_0xe544('0x42')]=![];_0x379069[_0xe544('0x43')]=_0x3f6a40[_0xe544('0x43')]=null;}else{if(_0x579ffe[_0xe544('0x44')]){_0x379069[_0xe544('0x3a')]=_0x3f6a40[_0xe544('0x3a')]=_0x579ffe[_0xe544('0x3b')];_0x379069[_0xe544('0x3c')]=_0x3f6a40['pass']=_0x579ffe['password'];}else{_0x379069[_0xe544('0x44')]=_0x3f6a40['authentication']=![];_0x379069[_0xe544('0x3a')]=_0x3f6a40[_0xe544('0x3a')]=null;_0x379069[_0xe544('0x3c')]=_0x3f6a40[_0xe544('0x3f')]=null;}_0x379069[_0xe544('0x41')]=_0x579ffe['Imap']['host'];_0x379069['port']=_0x579ffe['Imap'][_0xe544('0x40')];_0x3f6a40['host']=_0x579ffe['Smtp']['host'];_0x3f6a40[_0xe544('0x40')]=_0x579ffe[_0xe544('0x45')][_0xe544('0x40')];}return{'Imap':_0x379069,'Smtp':_0x3f6a40};}exports[_0xe544('0x46')]=function(_0x10a8d6,_0x1c56a3){var _0xb7cc4b={'include':[{'model':db['MailServerIn'],'as':_0xe544('0x47')},{'model':db['MailServerOut'],'as':_0xe544('0x45')},{'model':db[_0xe544('0x48')],'as':_0xe544('0x49')}]},_0x1fd18b={},_0x5825e2={'count':0x0,'rows':[]};var _0x26acc9=_['map'](db[_0xe544('0x4a')][_0xe544('0x4b')],function(_0x575ba6){return{'name':_0x575ba6[_0xe544('0x4c')],'type':_0x575ba6[_0xe544('0x4d')][_0xe544('0x4e')]};});_0x1fd18b['model']=_[_0xe544('0x4f')](_0x26acc9,_0xe544('0x2e'));_0x1fd18b[_0xe544('0x50')]=_[_0xe544('0x51')](_0x10a8d6[_0xe544('0x50')]);_0x1fd18b[_0xe544('0x52')]=_[_0xe544('0x53')](_0x1fd18b[_0xe544('0x54')],_0x1fd18b[_0xe544('0x50')]);_0xb7cc4b[_0xe544('0x55')]=_[_0xe544('0x53')](_0x1fd18b[_0xe544('0x54')],qs[_0xe544('0x56')](_0x10a8d6[_0xe544('0x50')][_0xe544('0x56')]));_0xb7cc4b[_0xe544('0x55')]=_0xb7cc4b[_0xe544('0x55')][_0xe544('0x57')]?_0xb7cc4b[_0xe544('0x55')]:_0x1fd18b[_0xe544('0x54')];if(!_0x10a8d6['query'][_0xe544('0x58')](_0xe544('0x59'))){_0xb7cc4b[_0xe544('0x24')]=qs[_0xe544('0x24')](_0x10a8d6[_0xe544('0x50')][_0xe544('0x24')]);_0xb7cc4b['offset']=qs['offset'](_0x10a8d6[_0xe544('0x50')]['offset']);}_0xb7cc4b[_0xe544('0x5a')]=qs[_0xe544('0x5b')](_0x10a8d6[_0xe544('0x50')][_0xe544('0x5b')]);_0xb7cc4b[_0xe544('0x5c')]=qs['filters'](_['pick'](_0x10a8d6[_0xe544('0x50')],_0x1fd18b['filters']),_0x26acc9);if(_0x10a8d6[_0xe544('0x50')][_0xe544('0x5d')]){_0xb7cc4b[_0xe544('0x5c')]=_[_0xe544('0x5e')](_0xb7cc4b[_0xe544('0x5c')],{'$or':_['map'](_0x26acc9,function(_0xe7bd08){if(_0xe7bd08['type']!==_0xe544('0x5f')){var _0x4fbba3={};_0x4fbba3[_0xe7bd08[_0xe544('0x2e')]]={'$like':'%'+_0x10a8d6['query'][_0xe544('0x5d')]+'%'};return _0x4fbba3;}})});}_0xb7cc4b=_[_0xe544('0x5e')]({},_0xb7cc4b,_0x10a8d6['options']);var _0xb11bbe={'where':_0xb7cc4b[_0xe544('0x5c')]};return db['MailAccount'][_0xe544('0x25')](_0xb11bbe)[_0xe544('0x28')](function(_0x1b7c39){_0x5825e2[_0xe544('0x25')]=_0x1b7c39;if(_0x10a8d6['query'][_0xe544('0x60')]){_0xb7cc4b['include']=[{'all':!![]}];}return db['MailAccount'][_0xe544('0x61')](_0xb7cc4b);})[_0xe544('0x28')](function(_0x561a29){_0x5825e2['rows']=_0x561a29;return _0x5825e2;})[_0xe544('0x28')](respondWithFilteredResult(_0x1c56a3,_0xb7cc4b))['catch'](handleError(_0x1c56a3,null));};exports[_0xe544('0x62')]=function(_0x50bb0c,_0x4848a0){var _0x3860ee={'raw':![],'where':{'id':_0x50bb0c['params']['id']},'include':[{'model':db[_0xe544('0x63')],'as':_0xe544('0x47')},{'model':db[_0xe544('0x64')],'as':_0xe544('0x45')},{'model':db[_0xe544('0x48')],'as':'mandatoryDispositionPause'}]},_0x43b51a={};_0x43b51a[_0xe544('0x54')]=_[_0xe544('0x51')](db[_0xe544('0x4a')][_0xe544('0x4b')]);_0x43b51a[_0xe544('0x50')]=_[_0xe544('0x51')](_0x50bb0c[_0xe544('0x50')]);_0x43b51a[_0xe544('0x52')]=_[_0xe544('0x53')](_0x43b51a[_0xe544('0x54')],_0x43b51a[_0xe544('0x50')]);_0x3860ee[_0xe544('0x55')]=_['intersection'](_0x43b51a[_0xe544('0x54')],qs[_0xe544('0x56')](_0x50bb0c['query'][_0xe544('0x56')]));_0x3860ee[_0xe544('0x55')]=_0x3860ee[_0xe544('0x55')][_0xe544('0x57')]?_0x3860ee[_0xe544('0x55')]:_0x43b51a[_0xe544('0x54')];if(_0x50bb0c[_0xe544('0x50')][_0xe544('0x60')]){_0x3860ee['include']=[{'all':!![]}];}_0x3860ee=_['merge']({},_0x3860ee,_0x50bb0c[_0xe544('0x65')]);return db[_0xe544('0x4a')][_0xe544('0x66')](_0x3860ee)[_0xe544('0x28')](handleEntityNotFound(_0x4848a0,null))[_0xe544('0x28')](respondWithResult(_0x4848a0,null))[_0xe544('0x1e')](handleError(_0x4848a0,null));};exports[_0xe544('0x67')]=function(_0x2a29ff,_0x4a361c){if(_0x2a29ff['body']['id']){delete _0x2a29ff[_0xe544('0x68')]['id'];}var _0x17daf4=_0x2a29ff['body'][_0xe544('0x69')]==='custom'?null:_0x2a29ff[_0xe544('0x68')]['provider'];var _0x3b8f9b=_0x2a29ff[_0xe544('0x68')]['Imap']||{};var _0x665275=_0x2a29ff['body'][_0xe544('0x45')]||{};if(_0x17daf4){_0x3b8f9b[_0xe544('0x41')]=getImapHost(_0x17daf4);_0x3b8f9b['port']=0x3e1;_0x665275['host']=getSmtpHost(_0x17daf4);_0x665275[_0xe544('0x40')]=0x24b;_0x665275[_0xe544('0x42')]=![];}if(_0x665275[_0xe544('0x3d')]){_0x665275[_0xe544('0x42')]=![];}else{_0x665275[_0xe544('0x3e')]=null;}if(!_0x3b8f9b[_0xe544('0x3d')])_0x3b8f9b[_0xe544('0x3e')]=null;_0x2a29ff[_0xe544('0x68')][_0xe544('0x47')]=_0x3b8f9b;_0x2a29ff[_0xe544('0x68')][_0xe544('0x45')]=_0x665275;return db[_0xe544('0x4a')]['find']({'where':{'id':_0x2a29ff['params']['id']},'include':[{'model':db[_0xe544('0x63')],'as':_0xe544('0x47')},{'model':db[_0xe544('0x64')],'as':_0xe544('0x45')},{'model':db[_0xe544('0x48')],'as':_0xe544('0x49')}]})[_0xe544('0x28')](handleEntityNotFound(_0x4a361c,null))[_0xe544('0x28')](function(_0x44d2ee){if(!_0x44d2ee)throw new Error(_0xe544('0x6a'));if(_0x44d2ee['service'])delete _0x2a29ff[_0xe544('0x68')][_0xe544('0x47')];return _0x44d2ee;})['then'](saveUpdates(_0x2a29ff[_0xe544('0x68')],null))['then'](function(_0x29a3be){if(!_0x2a29ff[_0xe544('0x68')][_0xe544('0x47')])return _0x29a3be;return db[_0xe544('0x63')][_0xe544('0x67')](_0x2a29ff[_0xe544('0x68')][_0xe544('0x47')],{'where':{'MailAccountId':_0x29a3be['id']}})['then'](function(){return _0x29a3be;});})[_0xe544('0x28')](function(_0x28e3ae){if(!_0x2a29ff[_0xe544('0x68')][_0xe544('0x45')])return _0x28e3ae;return db[_0xe544('0x64')]['update'](_0x2a29ff[_0xe544('0x68')]['Smtp'],{'where':{'MailAccountId':_0x28e3ae['id']}})[_0xe544('0x28')](function(){return _0x28e3ae;});})[_0xe544('0x28')](respondWithResult(_0x4a361c,null))[_0xe544('0x1e')](handleError(_0x4a361c,null));};exports['describe']=function(_0xed330e,_0x5c1d8b){return db[_0xe544('0x4a')][_0xe544('0x6b')]()[_0xe544('0x28')](respondWithResult(_0x5c1d8b,null))[_0xe544('0x1e')](handleError(_0x5c1d8b,null));};exports[_0xe544('0x6c')]=function(_0x2e7957,_0xdd9cf3){if(_0x2e7957[_0xe544('0x68')]['id']){delete _0x2e7957[_0xe544('0x68')]['id'];}return db['MailAccount'][_0xe544('0x66')]({'where':{'id':_0x2e7957[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0xdd9cf3,null))['then'](function(_0x3c5d07){if(_0x3c5d07){_0x2e7957[_0xe544('0x68')][_0xe544('0x6e')]=_0x3c5d07['id'];return db['Disposition']['create'](_0x2e7957[_0xe544('0x68')]);}})['then'](respondWithResult(_0xdd9cf3,null))[_0xe544('0x1e')](handleError(_0xdd9cf3,null));};exports['getDispositions']=function(_0x51ed88,_0x3cbab3){var _0x54569b={'raw':![],'where':{}};var _0x2e5553={};var _0x7b87c1={'count':0x0,'rows':[]};return db['MailAccount'][_0xe544('0x6f')]({'where':{'id':_0x51ed88[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x3cbab3,null))['then'](function(_0x4c5b3f){if(_0x4c5b3f){_0x2e5553[_0xe544('0x54')]=_['keys'](db[_0xe544('0x70')][_0xe544('0x4b')]);_0x2e5553[_0xe544('0x50')]=_[_0xe544('0x51')](_0x51ed88['query']);_0x2e5553[_0xe544('0x52')]=_[_0xe544('0x53')](_0x2e5553[_0xe544('0x54')],_0x2e5553['query']);_0x54569b[_0xe544('0x55')]=_['intersection'](_0x2e5553[_0xe544('0x54')],qs[_0xe544('0x56')](_0x51ed88[_0xe544('0x50')][_0xe544('0x56')]));_0x54569b['attributes']=_0x54569b['attributes']['length']?_0x54569b['attributes']:_0x2e5553['model'];if(!_0x51ed88['query'][_0xe544('0x58')](_0xe544('0x59'))){_0x54569b[_0xe544('0x24')]=qs[_0xe544('0x24')](_0x51ed88[_0xe544('0x50')][_0xe544('0x24')]);_0x54569b['offset']=qs['offset'](_0x51ed88[_0xe544('0x50')][_0xe544('0x22')]);}_0x54569b[_0xe544('0x5a')]=qs[_0xe544('0x5b')](_0x51ed88['query']['sort']);_0x54569b[_0xe544('0x5c')]=qs[_0xe544('0x52')](_[_0xe544('0x71')](_0x51ed88[_0xe544('0x50')],_0x2e5553['filters']));_0x54569b[_0xe544('0x5c')][_0xe544('0x6e')]=_0x4c5b3f['id'];if(_0x51ed88[_0xe544('0x50')]['filter']){_0x54569b[_0xe544('0x5c')]=_[_0xe544('0x5e')](_0x54569b['where'],{'$or':_[_0xe544('0x4f')](_0x54569b['attributes'],function(_0x43294c){var _0x1a78e4={};_0x1a78e4[_0x43294c]={'$like':'%'+_0x51ed88['query'][_0xe544('0x5d')]+'%'};return _0x1a78e4;})});}_0x54569b=_['merge']({},_0x54569b,_0x51ed88[_0xe544('0x65')]);return db[_0xe544('0x70')][_0xe544('0x25')]({'where':_0x54569b[_0xe544('0x5c')]})[_0xe544('0x28')](function(_0xb29991){_0x7b87c1[_0xe544('0x25')]=_0xb29991;if(_0x51ed88['query'][_0xe544('0x60')]){_0x54569b[_0xe544('0x72')]=[{'all':!![]}];}return db['Disposition'][_0xe544('0x61')](_0x54569b);})[_0xe544('0x28')](function(_0x38ceb8){_0x7b87c1[_0xe544('0x73')]=_0x38ceb8;return _0x7b87c1;});}})[_0xe544('0x28')](respondWithFilteredResult(_0x3cbab3,_0x54569b))[_0xe544('0x1e')](handleError(_0x3cbab3,null));};exports['removeDispositions']=function(_0x4dc68a,_0x141de9){return db['MailAccount'][_0xe544('0x66')]({'where':{'id':_0x4dc68a['params']['id']}})['then'](handleEntityNotFound(_0x141de9,null))[_0xe544('0x28')](function(_0x26562b){if(_0x26562b){return _0x26562b[_0xe544('0x74')](_0x4dc68a[_0xe544('0x50')]['ids']);}})[_0xe544('0x28')](respondWithStatusCode(_0x141de9,null))[_0xe544('0x1e')](handleError(_0x141de9,null));};exports[_0xe544('0x75')]=function(_0x173222,_0x1c11af){if(_0x173222['body']['id']){delete _0x173222['body']['id'];}return db[_0xe544('0x4a')][_0xe544('0x66')]({'where':{'id':_0x173222[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x1c11af,null))[_0xe544('0x28')](function(_0xf930cc){if(_0xf930cc){_0x173222[_0xe544('0x68')]['MailAccountId']=_0xf930cc['id'];return db[_0xe544('0x76')][_0xe544('0x77')](_0x173222['body']);}})[_0xe544('0x28')](respondWithResult(_0x1c11af,null))[_0xe544('0x1e')](handleError(_0x1c11af,null));};exports[_0xe544('0x78')]=function(_0x2c556a,_0x23a203){var _0x45abf8={'raw':![],'where':{}};var _0x5e9a56={};var _0x43910a={'count':0x0,'rows':[]};return db[_0xe544('0x4a')]['findOne']({'where':{'id':_0x2c556a[_0xe544('0x6d')]['id']}})['then'](handleEntityNotFound(_0x23a203,null))[_0xe544('0x28')](function(_0x2df5ca){if(_0x2df5ca){_0x5e9a56[_0xe544('0x54')]=_['keys'](db[_0xe544('0x76')][_0xe544('0x4b')]);_0x5e9a56[_0xe544('0x50')]=_[_0xe544('0x51')](_0x2c556a['query']);_0x5e9a56[_0xe544('0x52')]=_[_0xe544('0x53')](_0x5e9a56[_0xe544('0x54')],_0x5e9a56['query']);_0x45abf8['attributes']=_['intersection'](_0x5e9a56['model'],qs[_0xe544('0x56')](_0x2c556a[_0xe544('0x50')]['fields']));_0x45abf8[_0xe544('0x55')]=_0x45abf8[_0xe544('0x55')][_0xe544('0x57')]?_0x45abf8[_0xe544('0x55')]:_0x5e9a56[_0xe544('0x54')];if(!_0x2c556a['query'][_0xe544('0x58')](_0xe544('0x59'))){_0x45abf8[_0xe544('0x24')]=qs[_0xe544('0x24')](_0x2c556a['query'][_0xe544('0x24')]);_0x45abf8[_0xe544('0x22')]=qs[_0xe544('0x22')](_0x2c556a[_0xe544('0x50')][_0xe544('0x22')]);}_0x45abf8[_0xe544('0x5a')]=qs[_0xe544('0x5b')](_0x2c556a[_0xe544('0x50')][_0xe544('0x5b')]);_0x45abf8['where']=qs[_0xe544('0x52')](_[_0xe544('0x71')](_0x2c556a['query'],_0x5e9a56[_0xe544('0x52')]));_0x45abf8['where']['MailAccountId']=_0x2df5ca['id'];if(_0x2c556a[_0xe544('0x50')][_0xe544('0x5d')]){_0x45abf8['where']=_[_0xe544('0x5e')](_0x45abf8[_0xe544('0x5c')],{'$or':_[_0xe544('0x4f')](_0x45abf8[_0xe544('0x55')],function(_0x1e3ee7){var _0x2bff0b={};_0x2bff0b[_0x1e3ee7]={'$like':'%'+_0x2c556a[_0xe544('0x50')][_0xe544('0x5d')]+'%'};return _0x2bff0b;})});}_0x45abf8=_[_0xe544('0x5e')]({},_0x45abf8,_0x2c556a[_0xe544('0x65')]);return db['CannedAnswer'][_0xe544('0x25')]({'where':_0x45abf8[_0xe544('0x5c')]})[_0xe544('0x28')](function(_0xb6f543){_0x43910a[_0xe544('0x25')]=_0xb6f543;if(_0x2c556a[_0xe544('0x50')][_0xe544('0x60')]){_0x45abf8['include']=[{'all':!![]}];}return db[_0xe544('0x76')][_0xe544('0x61')](_0x45abf8);})[_0xe544('0x28')](function(_0x25584c){_0x43910a['rows']=_0x25584c;return _0x43910a;});}})['then'](respondWithFilteredResult(_0x23a203,_0x45abf8))['catch'](handleError(_0x23a203,null));};exports['removeAnswers']=function(_0x23cdcd,_0x4504c1){return db[_0xe544('0x4a')][_0xe544('0x66')]({'where':{'id':_0x23cdcd[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x4504c1,null))[_0xe544('0x28')](function(_0x57e151){if(_0x57e151){return _0x57e151[_0xe544('0x79')](_0x23cdcd[_0xe544('0x50')][_0xe544('0x7a')]);}})[_0xe544('0x28')](respondWithStatusCode(_0x4504c1,null))[_0xe544('0x1e')](handleError(_0x4504c1,null));};exports[_0xe544('0x77')]=function(_0x51c909,_0x189d14){var _0x5721e9={'name':_0x51c909[_0xe544('0x68')]['name'],'key':_0x51c909[_0xe544('0x68')][_0xe544('0x4e')],'provider':_0x51c909['body'][_0xe544('0x69')]===_0xe544('0x7b')?null:_0x51c909['body'][_0xe544('0x69')],'email':_0x51c909[_0xe544('0x68')][_0xe544('0x7c')],'ListId':_0x51c909[_0xe544('0x68')][_0xe544('0x7d')],'active':!_[_0xe544('0x7e')](_0x51c909['body'][_0xe544('0x7f')])?_0x51c909[_0xe544('0x68')][_0xe544('0x7f')]:!![],'description':_0x51c909['body'][_0xe544('0x80')]||null};var _0xc205d=getAuthenticationOptions(_0x5721e9[_0xe544('0x69')],_0x51c909[_0xe544('0x68')]);_0x5721e9[_0xe544('0x47')]=_0xc205d['Imap'];_0x5721e9[_0xe544('0x45')]=_0xc205d['Smtp'];return db[_0xe544('0x4a')]['create'](_0x5721e9,{'include':[{'model':db[_0xe544('0x64')],'as':_0xe544('0x45')},{'model':db[_0xe544('0x63')],'as':_0xe544('0x47')}]})['then'](function(_0x178ae7){var _0xa205ae=_0x51c909[_0xe544('0x3a')][_0xe544('0x81')]({'plain':!![]});if(!_0xa205ae)throw new Error(_0xe544('0x82'));if(_0xa205ae[_0xe544('0x83')]==='user'){var _0x2a486e=_0x178ae7[_0xe544('0x81')]({'plain':!![]});return db[_0xe544('0x84')][_0xe544('0x66')]({'where':{'name':'MailAccounts','userProfileId':_0xa205ae[_0xe544('0x85')]},'raw':!![]})[_0xe544('0x28')](function(_0x4c4b6b){if(_0x4c4b6b&&_0x4c4b6b[_0xe544('0x86')]===0x0){return db[_0xe544('0x2a')]['create']({'name':_0x2a486e['name'],'resourceId':_0x2a486e['id'],'type':_0x4c4b6b[_0xe544('0x2e')],'sectionId':_0x4c4b6b['id']},{})[_0xe544('0x28')](function(){return _0x178ae7;});}else{return _0x178ae7;}})['catch'](function(_0x56d030){logger[_0xe544('0x1a')](_0xe544('0x87'),_0x56d030);throw _0x56d030;});}return _0x178ae7;})[_0xe544('0x28')](respondWithResult(_0x189d14,0xc9))[_0xe544('0x1e')](handleError(_0x189d14,null));};exports['getImap']=function(_0x32af4f,_0x117ee9){return db[_0xe544('0x4a')][_0xe544('0x6f')]({'where':{'id':_0x32af4f[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x117ee9,null))['then'](function(_0x5ac70d){if(_0x5ac70d){return _0x5ac70d[_0xe544('0x88')]();}return null;})[_0xe544('0x28')](respondWithResult(_0x117ee9,null))[_0xe544('0x1e')](handleError(_0x117ee9,null));};exports[_0xe544('0x89')]=function(_0x147320,_0x162462){if(_0x147320[_0xe544('0x68')]['id']){delete _0x147320['body']['id'];}return db[_0xe544('0x4a')][_0xe544('0x66')]({'where':{'id':_0x147320[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x162462,null))['then'](function(_0xae999){if(_0xae999){_0x147320[_0xe544('0x68')][_0xe544('0x6e')]=_0xae999['id'];return db[_0xe544('0x63')][_0xe544('0x77')](_0x147320[_0xe544('0x68')]);}})[_0xe544('0x28')](respondWithResult(_0x162462,null))[_0xe544('0x1e')](handleError(_0x162462,null));};exports[_0xe544('0x8a')]=function(_0x1c7cb8,_0x22c8d){return db[_0xe544('0x4a')][_0xe544('0x6f')]({'where':{'id':_0x1c7cb8[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x22c8d,null))[_0xe544('0x28')](function(_0xb6576d){if(_0xb6576d){return _0xb6576d[_0xe544('0x8b')](null);}return null;})[_0xe544('0x28')](respondWithStatusCode(_0x22c8d,null))[_0xe544('0x1e')](handleError(_0x22c8d,null));};exports['getSmtp']=function(_0xc2d4fc,_0x177383){return db['MailAccount'][_0xe544('0x6f')]({'where':{'id':_0xc2d4fc[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x177383,null))[_0xe544('0x28')](function(_0x54034f){if(_0x54034f){return _0x54034f[_0xe544('0x8c')]();}return null;})[_0xe544('0x28')](respondWithResult(_0x177383,null))['catch'](handleError(_0x177383,null));};exports[_0xe544('0x8d')]=function(_0x15d65f,_0x4f0b37){if(_0x15d65f[_0xe544('0x68')]['id']){delete _0x15d65f[_0xe544('0x68')]['id'];}return db[_0xe544('0x4a')]['find']({'where':{'id':_0x15d65f[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x4f0b37,null))[_0xe544('0x28')](function(_0x232484){if(_0x232484){_0x15d65f[_0xe544('0x68')][_0xe544('0x6e')]=_0x232484['id'];return db[_0xe544('0x64')][_0xe544('0x77')](_0x15d65f[_0xe544('0x68')]);}})[_0xe544('0x28')](respondWithResult(_0x4f0b37,null))['catch'](handleError(_0x4f0b37,null));};exports[_0xe544('0x8e')]=function(_0x559aa9,_0x2015a4){return db['MailAccount']['findOne']({'where':{'id':_0x559aa9[_0xe544('0x6d')]['id']}})['then'](handleEntityNotFound(_0x2015a4,null))[_0xe544('0x28')](function(_0x1d4dde){if(_0x1d4dde){return _0x1d4dde['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x2015a4,null))[_0xe544('0x1e')](handleError(_0x2015a4,null));};exports[_0xe544('0x8f')]=function(_0x3d8a17,_0x195825){return db[_0xe544('0x90')][_0xe544('0x66')]({'where':{'id':_0x3d8a17[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x195825,null))[_0xe544('0x28')](function(_0x4913da){if(_0x4913da){return _0x4913da[_0xe544('0x8f')](_0x3d8a17[_0xe544('0x68')][_0xe544('0x7a')],_['omit'](_0x3d8a17[_0xe544('0x68')],[_0xe544('0x7a'),'id'])||{});}})[_0xe544('0x28')](respondWithResult(_0x195825,null))[_0xe544('0x1e')](handleError(_0x195825,null));};exports[_0xe544('0x91')]=function(_0xd5b03c,_0x2f22a5){var _0x19542b={'raw':![],'where':{}};var _0x5c9838={};var _0x393eb7={'count':0x0,'rows':[]};return db['MailAccount'][_0xe544('0x6f')]({'where':{'id':_0xd5b03c[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x2f22a5,null))[_0xe544('0x28')](function(_0x36c71a){if(_0x36c71a){_0x5c9838[_0xe544('0x54')]=_[_0xe544('0x51')](db['MailInteraction']['rawAttributes']);_0x5c9838[_0xe544('0x50')]=_['keys'](_0xd5b03c['query']);_0x5c9838[_0xe544('0x52')]=_[_0xe544('0x53')](_0x5c9838[_0xe544('0x54')],_0x5c9838[_0xe544('0x50')]);_0x19542b[_0xe544('0x55')]=_[_0xe544('0x53')](_0x5c9838['model'],qs[_0xe544('0x56')](_0xd5b03c[_0xe544('0x50')][_0xe544('0x56')]));_0x19542b[_0xe544('0x55')]=_0x19542b[_0xe544('0x55')][_0xe544('0x57')]?_0x19542b['attributes']:_0x5c9838['model'];if(!_0xd5b03c[_0xe544('0x50')][_0xe544('0x58')]('nolimit')){_0x19542b[_0xe544('0x24')]=qs[_0xe544('0x24')](_0xd5b03c['query'][_0xe544('0x24')]);_0x19542b[_0xe544('0x22')]=qs[_0xe544('0x22')](_0xd5b03c[_0xe544('0x50')][_0xe544('0x22')]);}_0x19542b[_0xe544('0x5a')]=qs[_0xe544('0x5b')](_0xd5b03c['query'][_0xe544('0x5b')]);_0x19542b['where']=qs[_0xe544('0x52')](_[_0xe544('0x71')](_0xd5b03c[_0xe544('0x50')],_0x5c9838['filters']));_0x19542b['where']['MailAccountId']=_0x36c71a['id'];if(_0xd5b03c['query'][_0xe544('0x5d')]){_0x19542b[_0xe544('0x5c')]=_[_0xe544('0x5e')](_0x19542b['where'],{'$or':_[_0xe544('0x4f')](_0x19542b['attributes'],function(_0x7b9567){var _0x5dcb57={};_0x5dcb57[_0x7b9567]={'$like':'%'+_0xd5b03c['query']['filter']+'%'};return _0x5dcb57;})});}_0x19542b=_[_0xe544('0x5e')]({},_0x19542b,_0xd5b03c[_0xe544('0x65')]);return db[_0xe544('0x90')][_0xe544('0x25')]({'where':_0x19542b['where']})[_0xe544('0x28')](function(_0x10d932){_0x393eb7[_0xe544('0x25')]=_0x10d932;if(_0xd5b03c[_0xe544('0x50')]['includeAll']){_0x19542b[_0xe544('0x72')]=[{'model':db[_0xe544('0x92')],'as':'Contact','required':![]},{'model':db[_0xe544('0x93')],'as':'Owner','attributes':[_0xe544('0x2e'),_0xe544('0x94'),_0xe544('0x95')],'required':![]},{'model':db['Tag'],'as':_0xe544('0x96'),'attributes':['id','name','color'],'where':_0xd5b03c[_0xe544('0x50')][_0xe544('0x97')]?{'id':_0xd5b03c[_0xe544('0x50')]['tag']}:undefined,'required':_0xd5b03c[_0xe544('0x50')][_0xe544('0x97')]?!![]:![]}];}return db[_0xe544('0x90')]['findAll'](_0x19542b);})[_0xe544('0x28')](function(_0x1dbfcf){_0x393eb7[_0xe544('0x73')]=_0x1dbfcf;return _0x393eb7;});}})[_0xe544('0x28')](respondWithFilteredResult(_0x2f22a5,_0x19542b))['catch'](handleError(_0x2f22a5,null));};exports['addApplications']=function addApplications(_0xb82e5b,_0x1ed5ba){var _0x2a2979=_0xb82e5b['params']['id'];var _0x58637d=_0xb82e5b[_0xe544('0x68')];var _0x5812c1=0xc8;var _0x5a8491=null;return db[_0xe544('0x98')][_0xe544('0x99')]({'isolationLevel':db[_0xe544('0x98')][_0xe544('0x9a')][_0xe544('0x9b')]['READ_COMMITTED']},function(_0x224507){return db[_0xe544('0x4a')]['findOne']({'where':{'id':_0x2a2979},'transaction':_0x224507})['then'](function(_0x268264){if(_0x268264){return db[_0xe544('0x9c')][_0xe544('0x2b')]({'where':{'MailAccountId':_0x2a2979},'transaction':_0x224507})[_0xe544('0x28')](function(){var _0x3c01c7=_[_0xe544('0x4f')](_0x58637d,function(_0x443f5f){_0x443f5f[_0xe544('0x6e')]=_0x2a2979;return _0x443f5f;});return db[_0xe544('0x9c')][_0xe544('0x9d')](_0x3c01c7,{'transaction':_0x224507});});}else{_0x5812c1=0x194;_0x5a8491=[];}});})[_0xe544('0x28')](function(){if(_0x5812c1!==0x194){return db[_0xe544('0x9c')]['findAndCountAll']({'where':{'MailAccountId':_0x2a2979},'order':_0xe544('0x9e')})[_0xe544('0x28')](function(_0x124d9c){_0x5a8491=_0x124d9c;});}})[_0xe544('0x1e')](function(_0x3bef3d){_0x5812c1=0x1f4;logger[_0xe544('0x1a')](_0x3bef3d[_0xe544('0x2d')]);if(_0x3bef3d[_0xe544('0x2e')]){delete _0x3bef3d[_0xe544('0x2e')];}_0x5a8491=_0x3bef3d;})[_0xe544('0x9f')](function(){if(_0x5a8491===null){_0x1ed5ba['sendStatus'](_0x5812c1);}else{if(_0x5812c1===0x1f4){_0x1ed5ba[_0xe544('0x20')](_0x5812c1)[_0xe544('0x2f')](_0x5a8491);}else{_0x1ed5ba[_0xe544('0x20')](_0x5812c1)[_0xe544('0x21')](_0x5a8491);}}});};exports[_0xe544('0xa0')]=function(_0x178fb7,_0x53ef7a){var _0x476134={};var _0x4d1c55={};var _0xa8931a;var _0x2791fa;return db[_0xe544('0x4a')][_0xe544('0x6f')]({'where':{'id':_0x178fb7['params']['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x53ef7a,null))[_0xe544('0x28')](function(_0x1e98df){if(_0x1e98df){_0xa8931a=_0x1e98df;_0x4d1c55['model']=_[_0xe544('0x51')](db['MailApplication'][_0xe544('0x4b')]);_0x4d1c55[_0xe544('0x50')]=_['keys'](_0x178fb7[_0xe544('0x50')]);_0x4d1c55['filters']=_[_0xe544('0x53')](_0x4d1c55[_0xe544('0x54')],_0x4d1c55[_0xe544('0x50')]);_0x476134[_0xe544('0x55')]=_['intersection'](_0x4d1c55['model'],qs['fields'](_0x178fb7[_0xe544('0x50')][_0xe544('0x56')]));_0x476134['attributes']=_0x476134['attributes'][_0xe544('0x57')]?_0x476134[_0xe544('0x55')]:_0x4d1c55['model'];_0x476134[_0xe544('0x5a')]=qs[_0xe544('0x5b')](_0x178fb7[_0xe544('0x50')][_0xe544('0x5b')]);_0x476134[_0xe544('0x5c')]=qs[_0xe544('0x52')](_[_0xe544('0x71')](_0x178fb7[_0xe544('0x50')],_0x4d1c55[_0xe544('0x52')]));if(_0x178fb7[_0xe544('0x50')][_0xe544('0x5d')]){_0x476134['where']=_[_0xe544('0x5e')](_0x476134['where'],{'$or':_[_0xe544('0x4f')](_0x476134[_0xe544('0x55')],function(_0x40cdee){var _0xa15b58={};_0xa15b58[_0x40cdee]={'$like':'%'+_0x178fb7['query'][_0xe544('0x5d')]+'%'};return _0xa15b58;})});}_0x476134=_[_0xe544('0x5e')]({},_0x476134,_0x178fb7[_0xe544('0x65')]);return _0xa8931a['getApplications'](_0x476134);}})[_0xe544('0x28')](function(_0x553725){if(_0x553725){_0x2791fa=_0x553725[_0xe544('0x57')];if(!_0x178fb7[_0xe544('0x50')][_0xe544('0x58')](_0xe544('0x59'))){_0x476134['limit']=qs['limit'](_0x178fb7[_0xe544('0x50')][_0xe544('0x24')]);_0x476134['offset']=qs[_0xe544('0x22')](_0x178fb7['query'][_0xe544('0x22')]);}return _0xa8931a[_0xe544('0xa0')](_0x476134);}})[_0xe544('0x28')](function(_0x47da86){if(_0x47da86){return _0x47da86?{'count':_0x2791fa,'rows':_0x47da86}:null;}})[_0xe544('0x28')](respondWithResult(_0x53ef7a,null))[_0xe544('0x1e')](handleError(_0x53ef7a,null));};exports[_0xe544('0xa1')]=function(_0xc337cc,_0xd4c3ff){var _0x49f616={'raw':!![],'where':{}};var _0xa08c88={};var _0x2b13e3={'count':0x0,'rows':[]};return db[_0xe544('0x4a')]['findOne']({'where':{'id':_0xc337cc[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0xd4c3ff,null))['then'](function(_0x2e3080){if(_0x2e3080){_0xa08c88[_0xe544('0x54')]=_[_0xe544('0x51')](db[_0xe544('0xa2')][_0xe544('0x4b')]);_0xa08c88[_0xe544('0x50')]=_[_0xe544('0x51')](_0xc337cc[_0xe544('0x50')]);_0xa08c88[_0xe544('0x52')]=_['intersection'](_0xa08c88[_0xe544('0x54')],_0xa08c88[_0xe544('0x50')]);_0x49f616[_0xe544('0x55')]=_[_0xe544('0x53')](_0xa08c88[_0xe544('0x54')],qs[_0xe544('0x56')](_0xc337cc[_0xe544('0x50')][_0xe544('0x56')]));_0x49f616[_0xe544('0x55')]=_0x49f616[_0xe544('0x55')][_0xe544('0x57')]?_0x49f616[_0xe544('0x55')]:_0xa08c88['model'];if(!_0xc337cc[_0xe544('0x50')]['hasOwnProperty'](_0xe544('0x59'))){_0x49f616[_0xe544('0x24')]=qs[_0xe544('0x24')](_0xc337cc['query'][_0xe544('0x24')]);_0x49f616['offset']=qs[_0xe544('0x22')](_0xc337cc[_0xe544('0x50')][_0xe544('0x22')]);}_0x49f616[_0xe544('0x5a')]=qs[_0xe544('0x5b')](_0xc337cc[_0xe544('0x50')][_0xe544('0x5b')]);_0x49f616[_0xe544('0x5c')]=qs['filters'](_['pick'](_0xc337cc['query'],_0xa08c88[_0xe544('0x52')]));_0x49f616[_0xe544('0x5c')][_0xe544('0x6e')]=_0x2e3080['id'];if(_0xc337cc[_0xe544('0x50')][_0xe544('0x5d')]){_0x49f616[_0xe544('0x5c')]=_[_0xe544('0x5e')](_0x49f616[_0xe544('0x5c')],{'$or':_['map'](_0x49f616[_0xe544('0x55')],function(_0x32cbb8){var _0xd6e052={};_0xd6e052[_0x32cbb8]={'$like':'%'+_0xc337cc['query'][_0xe544('0x5d')]+'%'};return _0xd6e052;})});}if(_0xc337cc[_0xe544('0x50')][_0xe544('0xa3')]){var _0x1e149e=_0xc337cc['query'][_0xe544('0xa3')][_0xe544('0xa4')](',');var _0x131d1a={};_0x131d1a[_0x1e149e[0x0]]={'$gte':moment(_0x1e149e[0x1])[_0xe544('0xa5')](_0xe544('0xa6'))};_0x49f616[_0xe544('0x5c')]=_[_0xe544('0x5e')](_0x49f616[_0xe544('0x5c')],_0x131d1a);}_0x49f616=_['merge']({},_0x49f616,_0xc337cc[_0xe544('0x65')]);return db[_0xe544('0xa2')][_0xe544('0x25')]({'where':_0x49f616['where']})['then'](function(_0x333783){_0x2b13e3[_0xe544('0x25')]=_0x333783;if(_0xc337cc['query']['includeAll']){_0x49f616['include']=[{'all':!![]}];}return db[_0xe544('0xa2')][_0xe544('0x61')](_0x49f616);})['then'](function(_0xb3afd0){if(_0xc337cc[_0xe544('0x50')]['inlineCss']===_0xe544('0xa7')){for(var _0x5f20b5=0x0;_0x5f20b5<_0xb3afd0['length'];_0x5f20b5++){_0xb3afd0[_0x5f20b5][_0xe544('0x68')]=juice(_0xb3afd0[_0x5f20b5][_0xe544('0x68')]);}}_0x2b13e3[_0xe544('0x73')]=_0xb3afd0;return _0x2b13e3;});}})[_0xe544('0x28')](respondWithFilteredResult(_0xd4c3ff,_0x49f616))[_0xe544('0x1e')](handleError(_0xd4c3ff,null));};exports[_0xe544('0x2f')]=function(_0x290ae3,_0x52fd7f){var _0x39de39,_0x7b9ede={},_0x5683c6;if(_0x290ae3[_0xe544('0x68')]['to']){_0x5683c6=_0x290ae3[_0xe544('0x68')]['to'][_0xe544('0xa4')](',')[0x0];}return db[_0xe544('0x4a')][_0xe544('0x66')]({'where':{'id':_0x290ae3[_0xe544('0x6d')]['id']},'include':[{'model':db[_0xe544('0xa8')],'as':'List','include':[{'model':db[_0xe544('0x92')],'as':_0xe544('0xa9'),'where':{'email':_0x5683c6},'limit':0x1,'order':[['updatedAt',_0xe544('0xaa')]]}]},{'model':db[_0xe544('0x64')],'as':_0xe544('0x45'),'raw':!![],'include':[{'model':db[_0xe544('0xab')],'as':_0xe544('0xab'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x52fd7f,null))['then'](function(_0x478def){if(!_0x478def)return;_0x39de39=_0x478def;if(!_0x478def[_0xe544('0x45')])throw new Error(_0xe544('0xac'));if(_[_0xe544('0x7e')](_0x290ae3['body']['from'])){_0x290ae3[_0xe544('0x68')]['from']=util[_0xe544('0xa5')](_0xe544('0xad'),_0x478def['name'],_0x478def['email']||_0x478def[_0xe544('0x45')][_0xe544('0x3a')]);}if(_0x290ae3[_0xe544('0x68')][_0xe544('0xae')]&&_0x290ae3['body'][_0xe544('0xae')][_0xe544('0x57')]){for(var _0x57d97c=0x0;_0x57d97c<_0x290ae3[_0xe544('0x68')]['attachments'][_0xe544('0x57')];_0x57d97c+=0x1){_0x290ae3[_0xe544('0x68')][_0xe544('0xae')][_0x57d97c]={'filename':_0x290ae3[_0xe544('0x68')]['attachments'][_0x57d97c][_0xe544('0x2e')],'path':path[_0xe544('0xaf')](config[_0xe544('0xb0')],'server/files/attachments',_0x290ae3[_0xe544('0x68')]['attachments'][_0x57d97c][_0xe544('0xb1')])};}}var _0x32dfdd=_0x478def[_0xe544('0xb2')]();return respondWithRpcPromise('SendMail',_0xe544('0xb3'),{'account':_0x32dfdd,'message':_0x290ae3[_0xe544('0x68')]});})['then'](function(_0x4b6253){if(!_0x4b6253)return;_0x7b9ede=_0x4b6253;if(!_0x39de39['List'])throw new Error('List\x20not\x20found');if(_0x39de39[_0xe544('0xb4')][_0xe544('0xa9')][_0xe544('0x57')])return _0x39de39['List'][_0xe544('0xa9')][0x0];return db[_0xe544('0x92')]['create'](_[_0xe544('0xc')](_0x290ae3[_0xe544('0x68')],{'firstName':_0x290ae3[_0xe544('0x68')]['to'],'email':_0x290ae3[_0xe544('0x68')]['to'],'phone':_0x290ae3[_0xe544('0x68')]['to'],'ListId':_0x39de39[_0xe544('0x7d')]}));})[_0xe544('0x28')](function(_0x56581a){if(!_0x56581a)return;var _0x4c1343={'UserId':_0x290ae3[_0xe544('0x3a')]['id'],'ContactId':_0x56581a['id'],'MailAccountId':_0x39de39['id'],'inReplyTo':_0x7b9ede[_0xe544('0xb5')],'to':_0x290ae3[_0xe544('0x68')]['from'],'cc':_0x290ae3['body']['cc'],'subject':_0x290ae3[_0xe544('0x68')][_0xe544('0xb6')],'attach':_0x290ae3[_0xe544('0x68')][_0xe544('0xb7')],'firstMsgDirection':_0xe544('0xb8'),'lastMsgAt':moment()['format'](_0xe544('0xa6')),'lastMsgDirection':_0xe544('0xb8'),'Messages':[_[_0xe544('0x5e')](_0x290ae3[_0xe544('0x68')],{'messageId':_0x7b9ede['messageId'],'sentAt':moment()[_0xe544('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x39de39['id'],'UserId':_0x290ae3['user']['id'],'ContactId':_0x56581a['id']})]};if(_0x290ae3[_0xe544('0x68')][_0xe544('0xb9')]){_0x4c1343=_[_0xe544('0x5e')](_0x4c1343,_0x290ae3[_0xe544('0x68')][_0xe544('0xb9')]);}return db[_0xe544('0x90')][_0xe544('0x77')](_0x4c1343,{'include':[{'model':db[_0xe544('0xa2')],'as':_0xe544('0xba')}]});})[_0xe544('0x28')](respondWithResult(_0x52fd7f,null))[_0xe544('0x1e')](handleError(_0x52fd7f,null));};exports['verifySmtp']=function(_0x2402ad,_0x12ad40){return db['MailAccount'][_0xe544('0x66')]({'where':{'id':_0x2402ad[_0xe544('0x6d')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xe544('0x45'),'raw':!![],'include':[{'model':db[_0xe544('0xab')],'as':_0xe544('0xab'),'raw':!![]}]}]})[_0xe544('0x28')](handleEntityNotFound(_0x12ad40,null))[_0xe544('0x28')](function(_0x3e5eb3){if(!_0x3e5eb3[_0xe544('0x45')])return;var _0x3b24fa=_0x3e5eb3[_0xe544('0xb2')]();return respondWithRpcPromise(_0xe544('0xbb'),_0xe544('0xbc'),{'account':_0x3b24fa});})['then'](respondWithResult(_0x12ad40,null))[_0xe544('0x1e')](handleError(_0x12ad40,null));};exports[_0xe544('0x2b')]=function(_0xf7a111,_0x281cc2){return db[_0xe544('0x4a')][_0xe544('0x66')]({'where':{'id':_0xf7a111[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x281cc2,null))[_0xe544('0x28')](function(_0x14b19b){if(_0x14b19b&&_0x14b19b[_0xe544('0x43')]){throw new db[(_0xe544('0xbd'))][(_0xe544('0xbe'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x14b19b;})[_0xe544('0x28')](removeEntity(_0x281cc2,null))[_0xe544('0x1e')](handleError(_0x281cc2,null));};exports['addAgents']=function(_0x4f387f,_0x4200ed){return db[_0xe544('0x4a')][_0xe544('0x66')]({'where':{'id':_0x4f387f[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x4200ed,null))[_0xe544('0x28')](function(_0x152a4b){if(_0x152a4b){return _0x152a4b[_0xe544('0xbf')](_0x4f387f[_0xe544('0x68')][_0xe544('0x7a')],_[_0xe544('0xc0')](_0x4f387f[_0xe544('0x68')],[_0xe544('0x7a'),'id'])||{})['spread'](function(_0x399d65){for(var _0x1f3bcd=0x0;_0x1f3bcd<_0x4f387f[_0xe544('0x68')][_0xe544('0x7a')][_0xe544('0x57')];_0x1f3bcd+=0x1){socket[_0xe544('0xc1')](_0xe544('0xc2'),{'UserId':Number(_0x4f387f[_0xe544('0x68')][_0xe544('0x7a')][_0x1f3bcd]),'MailAccountId':Number(_0x4f387f[_0xe544('0x6d')]['id'])});}return _0x399d65;});}})[_0xe544('0x28')](respondWithResult(_0x4200ed,null))[_0xe544('0x1e')](handleError(_0x4200ed,null));};exports[_0xe544('0xc3')]=function(_0x2180f3,_0x37cdba){return db[_0xe544('0x4a')][_0xe544('0x66')]({'where':{'id':_0x2180f3['params']['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x37cdba,null))['then'](function(_0x5a226e){if(_0x5a226e){return _0x5a226e[_0xe544('0xc3')](_0x2180f3[_0xe544('0x50')][_0xe544('0x7a')])[_0xe544('0x28')](function(){if(_[_0xe544('0xc4')](_0x2180f3[_0xe544('0x50')][_0xe544('0x7a')])){for(var _0x310a54=0x0;_0x310a54<_0x2180f3[_0xe544('0x50')][_0xe544('0x7a')][_0xe544('0x57')];_0x310a54+=0x1){socket[_0xe544('0xc1')](_0xe544('0xc5'),{'UserId':Number(_0x2180f3[_0xe544('0x50')]['ids'][_0x310a54]),'MailAccountId':Number(_0x2180f3[_0xe544('0x6d')]['id'])});}}else{socket[_0xe544('0xc1')](_0xe544('0xc5'),{'UserId':Number(_0x2180f3['query'][_0xe544('0x7a')]),'MailAccountId':Number(_0x2180f3[_0xe544('0x6d')]['id'])});}});}})[_0xe544('0x28')](respondWithStatusCode(_0x37cdba,null))[_0xe544('0x1e')](handleError(_0x37cdba,null));};exports['getAgents']=function(_0x5048ea,_0x12f938){var _0x4a83c5={};var _0x1142ed={};var _0x3bed04;var _0x474e85;return db[_0xe544('0x4a')]['findOne']({'where':{'id':_0x5048ea[_0xe544('0x6d')]['id']}})[_0xe544('0x28')](handleEntityNotFound(_0x12f938,null))[_0xe544('0x28')](function(_0x2f01ee){if(_0x2f01ee){_0x3bed04=_0x2f01ee;_0x1142ed[_0xe544('0x54')]=_[_0xe544('0x51')](db[_0xe544('0x93')][_0xe544('0x4b')]);_0x1142ed['query']=_[_0xe544('0x51')](_0x5048ea[_0xe544('0x50')]);_0x1142ed[_0xe544('0x52')]=_[_0xe544('0x53')](_0x1142ed[_0xe544('0x54')],_0x1142ed['query']);_0x4a83c5[_0xe544('0x55')]=_[_0xe544('0x53')](_0x1142ed[_0xe544('0x54')],qs['fields'](_0x5048ea[_0xe544('0x50')][_0xe544('0x56')]));_0x4a83c5[_0xe544('0x55')]=_0x4a83c5[_0xe544('0x55')][_0xe544('0x57')]?_0x4a83c5[_0xe544('0x55')]:_0x1142ed[_0xe544('0x54')];_0x4a83c5[_0xe544('0x5a')]=qs['sort'](_0x5048ea['query'][_0xe544('0x5b')]);_0x4a83c5[_0xe544('0x5c')]=qs[_0xe544('0x52')](_[_0xe544('0x71')](_0x5048ea['query'],_0x1142ed[_0xe544('0x52')]));if(_0x5048ea[_0xe544('0x50')][_0xe544('0x5d')]){_0x4a83c5['where']=_[_0xe544('0x5e')](_0x4a83c5[_0xe544('0x5c')],{'$or':_[_0xe544('0x4f')](_0x4a83c5[_0xe544('0x55')],function(_0x511043){var _0x210931={};_0x210931[_0x511043]={'$like':'%'+_0x5048ea[_0xe544('0x50')][_0xe544('0x5d')]+'%'};return _0x210931;})});}_0x4a83c5=_[_0xe544('0x5e')]({},_0x4a83c5,_0x5048ea[_0xe544('0x65')]);return _0x3bed04[_0xe544('0xc6')](_0x4a83c5);}})[_0xe544('0x28')](function(_0x3c153e){if(_0x3c153e){_0x474e85=_0x3c153e[_0xe544('0x57')];if(!_0x5048ea['query'][_0xe544('0x58')](_0xe544('0x59'))){_0x4a83c5[_0xe544('0x24')]=qs[_0xe544('0x24')](_0x5048ea[_0xe544('0x50')]['limit']);_0x4a83c5['offset']=qs[_0xe544('0x22')](_0x5048ea['query'][_0xe544('0x22')]);}return _0x3bed04[_0xe544('0xc6')](_0x4a83c5);}})[_0xe544('0x28')](function(_0x4140d2){if(_0x4140d2){return _0x4140d2?{'count':_0x474e85,'rows':_0x4140d2}:null;}})[_0xe544('0x28')](respondWithResult(_0x12f938,null))[_0xe544('0x1e')](handleError(_0x12f938,null));}; \ No newline at end of file +var _0xcee2=['authentication','username','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','MailAccount','includeAll','include','findAll','rows','show','params','MailServerOut','options','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','getDispositions','MailAccountId','Disposition','removeDispositions','ids','CannedAnswer','create','getAnswers','findOne','pick','removeAnswers','custom','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','CmContact','User','Owner','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','ioredis','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','get','MailAccounts','UserProfileResource','destroy','stack','name','gmail','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','outlook365','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service'];(function(_0x5bcadb,_0x35270a){var _0x501049=function(_0xa2c00b){while(--_0xa2c00b){_0x5bcadb['push'](_0x5bcadb['shift']());}};_0x501049(++_0x35270a);}(_0xcee2,0x7e));var _0x2cee=function(_0x2b08ac,_0x4deac2){_0x2b08ac=_0x2b08ac-0x0;var _0x5aa29e=_0xcee2[_0x2b08ac];return _0x5aa29e;};'use strict';var moment=require(_0x2cee('0x0'));var BPromise=require(_0x2cee('0x1'));var util=require(_0x2cee('0x2'));var path=require(_0x2cee('0x3'));var _=require(_0x2cee('0x4'));var juice=require('juice');var Redis=require(_0x2cee('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x2cee('0x6'));var db=require(_0x2cee('0x7'))['db'];config['redis']=_[_0x2cee('0x8')](config[_0x2cee('0x9')],{'host':_0x2cee('0xa'),'port':0x18eb});var socket=require(_0x2cee('0xb'))(new Redis(config[_0x2cee('0x9')]));require(_0x2cee('0xc'))['register'](socket);var jayson=require(_0x2cee('0xd'));var client=jayson[_0x2cee('0xe')]['http']({'port':0x232b});function respondWithRpcPromise(_0x276bb3,_0x5de87a,_0x5d8037,_0x1e12b6){return new BPromise(function(_0x45683b,_0x461344){var _0x41771a=_0x1e12b6||client;return _0x41771a[_0x2cee('0xf')](_0x276bb3,_0x5d8037)[_0x2cee('0x10')](function(_0x985182){logger['info'](_0x2cee('0x11'),_0x5de87a,_0x2cee('0x12'));logger[_0x2cee('0x13')](_0x2cee('0x14'),_0x5de87a,'request\x20sent',JSON[_0x2cee('0x15')](_0x985182));if(_0x985182[_0x2cee('0x16')]){if(_0x985182[_0x2cee('0x16')]['code']===0x1f4){logger['error'](_0x2cee('0x11'),_0x5de87a,_0x985182[_0x2cee('0x16')][_0x2cee('0x17')]);return _0x461344(_0x985182['error']['message']);}logger['error'](_0x2cee('0x11'),_0x5de87a,_0x985182['error'][_0x2cee('0x17')]);return _0x45683b(_0x985182['error'][_0x2cee('0x17')]);}else{logger['info'](_0x2cee('0x11'),_0x5de87a,'request\x20sent');_0x45683b(_0x985182['result'][_0x2cee('0x17')]);}})[_0x2cee('0x18')](function(_0x34154b){logger[_0x2cee('0x16')](_0x2cee('0x11'),_0x5de87a,_0x34154b);_0x461344(_0x34154b);});});}function respondWithStatusCode(_0x21873a,_0x16bdd2){_0x16bdd2=_0x16bdd2||0xcc;return function(_0x37637d){if(_0x37637d){return _0x21873a[_0x2cee('0x19')](_0x16bdd2);}return _0x21873a['status'](_0x16bdd2)[_0x2cee('0x1a')]();};}function respondWithResult(_0x2916b8,_0x260377){_0x260377=_0x260377||0xc8;return function(_0x48911b){if(_0x48911b){return _0x2916b8['status'](_0x260377)[_0x2cee('0x1b')](_0x48911b);}};}function respondWithFilteredResult(_0x4515ee,_0x37576c){return function(_0x36437a){if(_0x36437a){var _0x1ae4b4=typeof _0x37576c[_0x2cee('0x1c')]===_0x2cee('0x1d')&&typeof _0x37576c[_0x2cee('0x1e')]===_0x2cee('0x1d');var _0x4ab128=_0x36437a[_0x2cee('0x1f')];var _0x102012=_0x1ae4b4?0x0:_0x37576c[_0x2cee('0x1c')];var _0x2e96cc=_0x1ae4b4?_0x36437a[_0x2cee('0x1f')]:_0x37576c[_0x2cee('0x1c')]+_0x37576c[_0x2cee('0x1e')];var _0x119a30;if(_0x2e96cc>=_0x4ab128){_0x2e96cc=_0x4ab128;_0x119a30=0xc8;}else{_0x119a30=0xce;}_0x4515ee[_0x2cee('0x20')](_0x119a30);return _0x4515ee[_0x2cee('0x21')](_0x2cee('0x22'),_0x102012+'-'+_0x2e96cc+'/'+_0x4ab128)['json'](_0x36437a);}return null;};}function saveUpdates(_0x1e6442){return function(_0xdfde5d){if(_0xdfde5d){return _0xdfde5d[_0x2cee('0x23')](_0x1e6442)['then'](function(_0x21d0fc){return _0x21d0fc;});}return null;};}function removeEntity(_0xa88133){return function(_0x422e9c){if(_0x422e9c){return _0x422e9c['destroy']()['then'](function(){var _0x4ea152=_0x422e9c[_0x2cee('0x24')]({'plain':!![]});var _0xe62c78=_0x2cee('0x25');return db[_0x2cee('0x26')][_0x2cee('0x27')]({'where':{'type':_0xe62c78,'resourceId':_0x4ea152['id']}})['then'](function(){return _0x422e9c;});})[_0x2cee('0x10')](function(){_0xa88133['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10800f){return function(_0x292a67){if(!_0x292a67){_0x10800f[_0x2cee('0x19')](0x194);}return _0x292a67;};}function handleError(_0x412e42,_0x3b0887){_0x3b0887=_0x3b0887||0x1f4;return function(_0x90d2c9){logger[_0x2cee('0x16')](_0x90d2c9[_0x2cee('0x28')]);if(_0x90d2c9['name']){delete _0x90d2c9[_0x2cee('0x29')];}_0x412e42[_0x2cee('0x20')](_0x3b0887)['send'](_0x90d2c9);};}function getImapHost(_0x2e66ad){switch(_0x2e66ad){case _0x2cee('0x2a'):return'imap.gmail.com';case'yahoo':return _0x2cee('0x2b');case _0x2cee('0x2c'):return _0x2cee('0x2d');case'outlook365':return _0x2cee('0x2e');}throw new Error(_0x2cee('0x2f'),_0x2e66ad);}function getSmtpHost(_0x446f92){switch(_0x446f92){case _0x2cee('0x2a'):return _0x2cee('0x30');case _0x2cee('0x31'):return _0x2cee('0x32');case _0x2cee('0x2c'):return'smtp-mail.outlook.com';case _0x2cee('0x33'):return'smtp.office365.com';}throw new Error(_0x2cee('0x2f'),_0x446f92);}function getAuthenticationOptions(_0x2d5cec,_0x326b13){var _0x7323b6={};var _0x3036bd={};if(_0x2d5cec){_0x7323b6['user']=_0x3036bd[_0x2cee('0x34')]=_0x326b13['username'];_0x7323b6[_0x2cee('0x35')]=_0x3036bd[_0x2cee('0x36')]=_0x326b13[_0x2cee('0x35')];if(_0x326b13[_0x2cee('0x37')]){_0x7323b6[_0x2cee('0x37')]=_0x3036bd[_0x2cee('0x37')]=!![];_0x7323b6[_0x2cee('0x38')]=_0x3036bd[_0x2cee('0x38')]=_0x326b13[_0x2cee('0x38')];_0x7323b6[_0x2cee('0x35')]=_0x3036bd[_0x2cee('0x36')]=null;}else{_0x7323b6[_0x2cee('0x38')]=_0x3036bd['CloudProviderId']=null;}_0x7323b6[_0x2cee('0x39')]=getImapHost(_0x2d5cec);_0x7323b6[_0x2cee('0x3a')]=0x3e1;_0x3036bd[_0x2cee('0x39')]=getSmtpHost(_0x2d5cec);_0x3036bd[_0x2cee('0x3a')]=0x24b;_0x3036bd[_0x2cee('0x3b')]=![];_0x7323b6[_0x2cee('0x3c')]=_0x3036bd[_0x2cee('0x3c')]=null;}else{if(_0x326b13[_0x2cee('0x3d')]){_0x7323b6[_0x2cee('0x34')]=_0x3036bd[_0x2cee('0x34')]=_0x326b13[_0x2cee('0x3e')];_0x7323b6[_0x2cee('0x35')]=_0x3036bd[_0x2cee('0x36')]=_0x326b13[_0x2cee('0x35')];}else{_0x7323b6[_0x2cee('0x3d')]=_0x3036bd['authentication']=![];_0x7323b6[_0x2cee('0x34')]=_0x3036bd[_0x2cee('0x34')]=null;_0x7323b6['password']=_0x3036bd[_0x2cee('0x36')]=null;}_0x7323b6['host']=_0x326b13[_0x2cee('0x3f')][_0x2cee('0x39')];_0x7323b6[_0x2cee('0x3a')]=_0x326b13[_0x2cee('0x3f')]['port'];_0x3036bd['host']=_0x326b13['Smtp'][_0x2cee('0x39')];_0x3036bd[_0x2cee('0x3a')]=_0x326b13[_0x2cee('0x40')][_0x2cee('0x3a')];}return{'Imap':_0x7323b6,'Smtp':_0x3036bd};}exports[_0x2cee('0x41')]=function(_0x9416fc,_0x33ad27){var _0x2d0d52={'include':[{'model':db[_0x2cee('0x42')],'as':_0x2cee('0x3f')},{'model':db['MailServerOut'],'as':_0x2cee('0x40')},{'model':db[_0x2cee('0x43')],'as':_0x2cee('0x44')}]},_0x265277={},_0x1c199e={'count':0x0,'rows':[]};var _0x2c299f=_[_0x2cee('0x45')](db['MailAccount'][_0x2cee('0x46')],function(_0x258624){return{'name':_0x258624[_0x2cee('0x47')],'type':_0x258624[_0x2cee('0x48')][_0x2cee('0x49')]};});_0x265277[_0x2cee('0x4a')]=_[_0x2cee('0x45')](_0x2c299f,_0x2cee('0x29'));_0x265277[_0x2cee('0x4b')]=_[_0x2cee('0x4c')](_0x9416fc[_0x2cee('0x4b')]);_0x265277['filters']=_['intersection'](_0x265277[_0x2cee('0x4a')],_0x265277[_0x2cee('0x4b')]);_0x2d0d52['attributes']=_[_0x2cee('0x4d')](_0x265277[_0x2cee('0x4a')],qs[_0x2cee('0x4e')](_0x9416fc[_0x2cee('0x4b')]['fields']));_0x2d0d52[_0x2cee('0x4f')]=_0x2d0d52[_0x2cee('0x4f')][_0x2cee('0x50')]?_0x2d0d52[_0x2cee('0x4f')]:_0x265277[_0x2cee('0x4a')];if(!_0x9416fc[_0x2cee('0x4b')][_0x2cee('0x51')](_0x2cee('0x52'))){_0x2d0d52[_0x2cee('0x1e')]=qs[_0x2cee('0x1e')](_0x9416fc['query'][_0x2cee('0x1e')]);_0x2d0d52[_0x2cee('0x1c')]=qs['offset'](_0x9416fc[_0x2cee('0x4b')][_0x2cee('0x1c')]);}_0x2d0d52[_0x2cee('0x53')]=qs[_0x2cee('0x54')](_0x9416fc[_0x2cee('0x4b')][_0x2cee('0x54')]);_0x2d0d52[_0x2cee('0x55')]=qs[_0x2cee('0x56')](_['pick'](_0x9416fc[_0x2cee('0x4b')],_0x265277[_0x2cee('0x56')]),_0x2c299f);if(_0x9416fc[_0x2cee('0x4b')][_0x2cee('0x57')]){_0x2d0d52[_0x2cee('0x55')]=_[_0x2cee('0x58')](_0x2d0d52['where'],{'$or':_[_0x2cee('0x45')](_0x2c299f,function(_0xeb547a){if(_0xeb547a[_0x2cee('0x48')]!=='VIRTUAL'){var _0x185c45={};_0x185c45[_0xeb547a[_0x2cee('0x29')]]={'$like':'%'+_0x9416fc[_0x2cee('0x4b')][_0x2cee('0x57')]+'%'};return _0x185c45;}})});}_0x2d0d52=_['merge']({},_0x2d0d52,_0x9416fc['options']);var _0x41c1e2={'where':_0x2d0d52['where']};return db[_0x2cee('0x59')][_0x2cee('0x1f')](_0x41c1e2)['then'](function(_0x23b5e6){_0x1c199e[_0x2cee('0x1f')]=_0x23b5e6;if(_0x9416fc['query'][_0x2cee('0x5a')]){_0x2d0d52[_0x2cee('0x5b')]=[{'all':!![]}];}return db['MailAccount'][_0x2cee('0x5c')](_0x2d0d52);})[_0x2cee('0x10')](function(_0x3b976a){_0x1c199e[_0x2cee('0x5d')]=_0x3b976a;return _0x1c199e;})[_0x2cee('0x10')](respondWithFilteredResult(_0x33ad27,_0x2d0d52))[_0x2cee('0x18')](handleError(_0x33ad27,null));};exports[_0x2cee('0x5e')]=function(_0x15c51a,_0x3d504a){var _0x14e8ae={'raw':![],'where':{'id':_0x15c51a[_0x2cee('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x2cee('0x60')],'as':_0x2cee('0x40')},{'model':db['Pause'],'as':_0x2cee('0x44')}]},_0x40826={};_0x40826['model']=_[_0x2cee('0x4c')](db[_0x2cee('0x59')][_0x2cee('0x46')]);_0x40826[_0x2cee('0x4b')]=_[_0x2cee('0x4c')](_0x15c51a[_0x2cee('0x4b')]);_0x40826[_0x2cee('0x56')]=_[_0x2cee('0x4d')](_0x40826[_0x2cee('0x4a')],_0x40826[_0x2cee('0x4b')]);_0x14e8ae['attributes']=_[_0x2cee('0x4d')](_0x40826[_0x2cee('0x4a')],qs[_0x2cee('0x4e')](_0x15c51a[_0x2cee('0x4b')]['fields']));_0x14e8ae[_0x2cee('0x4f')]=_0x14e8ae[_0x2cee('0x4f')]['length']?_0x14e8ae[_0x2cee('0x4f')]:_0x40826[_0x2cee('0x4a')];if(_0x15c51a[_0x2cee('0x4b')][_0x2cee('0x5a')]){_0x14e8ae[_0x2cee('0x5b')]=[{'all':!![]}];}_0x14e8ae=_[_0x2cee('0x58')]({},_0x14e8ae,_0x15c51a[_0x2cee('0x61')]);return db[_0x2cee('0x59')][_0x2cee('0x62')](_0x14e8ae)[_0x2cee('0x10')](handleEntityNotFound(_0x3d504a,null))[_0x2cee('0x10')](respondWithResult(_0x3d504a,null))[_0x2cee('0x18')](handleError(_0x3d504a,null));};exports[_0x2cee('0x23')]=function(_0x31d5d3,_0x3a5a17){if(_0x31d5d3[_0x2cee('0x63')]['id']){delete _0x31d5d3['body']['id'];}var _0x427d0c=_0x31d5d3['body'][_0x2cee('0x64')]==='custom'?null:_0x31d5d3['body']['provider'];var _0x328a57=_0x31d5d3[_0x2cee('0x63')][_0x2cee('0x3f')]||{};var _0x8eae96=_0x31d5d3[_0x2cee('0x63')]['Smtp']||{};if(_0x427d0c){_0x328a57[_0x2cee('0x39')]=getImapHost(_0x427d0c);_0x328a57[_0x2cee('0x3a')]=0x3e1;_0x8eae96['host']=getSmtpHost(_0x427d0c);_0x8eae96['port']=0x24b;_0x8eae96[_0x2cee('0x3b')]=![];}if(_0x8eae96[_0x2cee('0x37')]){_0x8eae96[_0x2cee('0x3b')]=![];}else{_0x8eae96[_0x2cee('0x38')]=null;}if(!_0x328a57['modernAuthentication'])_0x328a57['CloudProviderId']=null;_0x31d5d3['body'][_0x2cee('0x3f')]=_0x328a57;_0x31d5d3['body']['Smtp']=_0x8eae96;return db[_0x2cee('0x59')][_0x2cee('0x62')]({'where':{'id':_0x31d5d3['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x2cee('0x3f')},{'model':db[_0x2cee('0x60')],'as':_0x2cee('0x40')},{'model':db[_0x2cee('0x43')],'as':_0x2cee('0x44')}]})[_0x2cee('0x10')](handleEntityNotFound(_0x3a5a17,null))[_0x2cee('0x10')](function(_0x1cf337){if(!_0x1cf337)throw new Error(_0x2cee('0x65'));if(_0x1cf337[_0x2cee('0x3c')])delete _0x31d5d3['body'][_0x2cee('0x3f')];return _0x1cf337;})[_0x2cee('0x10')](saveUpdates(_0x31d5d3[_0x2cee('0x63')],null))[_0x2cee('0x10')](function(_0x1ca59c){if(!_0x31d5d3[_0x2cee('0x63')][_0x2cee('0x3f')])return _0x1ca59c;return db[_0x2cee('0x42')]['update'](_0x31d5d3['body']['Imap'],{'where':{'MailAccountId':_0x1ca59c['id']}})[_0x2cee('0x10')](function(){return _0x1ca59c;});})['then'](function(_0x1fc560){if(!_0x31d5d3[_0x2cee('0x63')][_0x2cee('0x40')])return _0x1fc560;return db[_0x2cee('0x60')][_0x2cee('0x23')](_0x31d5d3['body'][_0x2cee('0x40')],{'where':{'MailAccountId':_0x1fc560['id']}})[_0x2cee('0x10')](function(){return _0x1fc560;});})[_0x2cee('0x10')](respondWithResult(_0x3a5a17,null))[_0x2cee('0x18')](handleError(_0x3a5a17,null));};exports[_0x2cee('0x66')]=function(_0x58d83f,_0x1c0b61){return db['MailAccount'][_0x2cee('0x66')]()[_0x2cee('0x10')](respondWithResult(_0x1c0b61,null))[_0x2cee('0x18')](handleError(_0x1c0b61,null));};exports[_0x2cee('0x67')]=function(_0x449187,_0x266149){if(_0x449187[_0x2cee('0x63')]['id']){delete _0x449187[_0x2cee('0x63')]['id'];}return db[_0x2cee('0x59')][_0x2cee('0x62')]({'where':{'id':_0x449187[_0x2cee('0x5f')]['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x266149,null))[_0x2cee('0x10')](function(_0x18f2d1){if(_0x18f2d1){_0x449187[_0x2cee('0x63')]['MailAccountId']=_0x18f2d1['id'];return db['Disposition']['create'](_0x449187[_0x2cee('0x63')]);}})[_0x2cee('0x10')](respondWithResult(_0x266149,null))[_0x2cee('0x18')](handleError(_0x266149,null));};exports[_0x2cee('0x68')]=function(_0x4f6484,_0x2407fa){var _0x9fd314={'raw':![],'where':{}};var _0x261f82={};var _0x1c144b={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4f6484['params']['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x2407fa,null))[_0x2cee('0x10')](function(_0x4bfe8a){if(_0x4bfe8a){_0x261f82['model']=_['keys'](db['Disposition'][_0x2cee('0x46')]);_0x261f82['query']=_['keys'](_0x4f6484['query']);_0x261f82[_0x2cee('0x56')]=_[_0x2cee('0x4d')](_0x261f82['model'],_0x261f82[_0x2cee('0x4b')]);_0x9fd314[_0x2cee('0x4f')]=_[_0x2cee('0x4d')](_0x261f82[_0x2cee('0x4a')],qs[_0x2cee('0x4e')](_0x4f6484[_0x2cee('0x4b')]['fields']));_0x9fd314[_0x2cee('0x4f')]=_0x9fd314['attributes']['length']?_0x9fd314['attributes']:_0x261f82['model'];if(!_0x4f6484[_0x2cee('0x4b')][_0x2cee('0x51')](_0x2cee('0x52'))){_0x9fd314[_0x2cee('0x1e')]=qs[_0x2cee('0x1e')](_0x4f6484[_0x2cee('0x4b')][_0x2cee('0x1e')]);_0x9fd314['offset']=qs[_0x2cee('0x1c')](_0x4f6484[_0x2cee('0x4b')][_0x2cee('0x1c')]);}_0x9fd314[_0x2cee('0x53')]=qs[_0x2cee('0x54')](_0x4f6484['query'][_0x2cee('0x54')]);_0x9fd314[_0x2cee('0x55')]=qs[_0x2cee('0x56')](_['pick'](_0x4f6484[_0x2cee('0x4b')],_0x261f82['filters']));_0x9fd314['where'][_0x2cee('0x69')]=_0x4bfe8a['id'];if(_0x4f6484[_0x2cee('0x4b')][_0x2cee('0x57')]){_0x9fd314[_0x2cee('0x55')]=_[_0x2cee('0x58')](_0x9fd314[_0x2cee('0x55')],{'$or':_['map'](_0x9fd314['attributes'],function(_0x46f2ec){var _0x2165bf={};_0x2165bf[_0x46f2ec]={'$like':'%'+_0x4f6484['query']['filter']+'%'};return _0x2165bf;})});}_0x9fd314=_[_0x2cee('0x58')]({},_0x9fd314,_0x4f6484[_0x2cee('0x61')]);return db['Disposition'][_0x2cee('0x1f')]({'where':_0x9fd314[_0x2cee('0x55')]})[_0x2cee('0x10')](function(_0xdd7579){_0x1c144b[_0x2cee('0x1f')]=_0xdd7579;if(_0x4f6484[_0x2cee('0x4b')][_0x2cee('0x5a')]){_0x9fd314[_0x2cee('0x5b')]=[{'all':!![]}];}return db[_0x2cee('0x6a')][_0x2cee('0x5c')](_0x9fd314);})[_0x2cee('0x10')](function(_0x16a552){_0x1c144b[_0x2cee('0x5d')]=_0x16a552;return _0x1c144b;});}})[_0x2cee('0x10')](respondWithFilteredResult(_0x2407fa,_0x9fd314))[_0x2cee('0x18')](handleError(_0x2407fa,null));};exports[_0x2cee('0x6b')]=function(_0x2aad38,_0x2cc22d){return db['MailAccount'][_0x2cee('0x62')]({'where':{'id':_0x2aad38['params']['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x2cc22d,null))[_0x2cee('0x10')](function(_0x117a42){if(_0x117a42){return _0x117a42[_0x2cee('0x6b')](_0x2aad38[_0x2cee('0x4b')][_0x2cee('0x6c')]);}})[_0x2cee('0x10')](respondWithStatusCode(_0x2cc22d,null))[_0x2cee('0x18')](handleError(_0x2cc22d,null));};exports['addAnswer']=function(_0x5dd0e7,_0x507fa7){if(_0x5dd0e7[_0x2cee('0x63')]['id']){delete _0x5dd0e7[_0x2cee('0x63')]['id'];}return db[_0x2cee('0x59')][_0x2cee('0x62')]({'where':{'id':_0x5dd0e7[_0x2cee('0x5f')]['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x507fa7,null))['then'](function(_0x858b5c){if(_0x858b5c){_0x5dd0e7[_0x2cee('0x63')]['MailAccountId']=_0x858b5c['id'];return db[_0x2cee('0x6d')][_0x2cee('0x6e')](_0x5dd0e7['body']);}})['then'](respondWithResult(_0x507fa7,null))[_0x2cee('0x18')](handleError(_0x507fa7,null));};exports[_0x2cee('0x6f')]=function(_0x535c8b,_0x1c7b24){var _0x9c2462={'raw':![],'where':{}};var _0x1287e4={};var _0x157627={'count':0x0,'rows':[]};return db[_0x2cee('0x59')][_0x2cee('0x70')]({'where':{'id':_0x535c8b[_0x2cee('0x5f')]['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x1c7b24,null))['then'](function(_0x8cbeda){if(_0x8cbeda){_0x1287e4['model']=_[_0x2cee('0x4c')](db[_0x2cee('0x6d')][_0x2cee('0x46')]);_0x1287e4['query']=_[_0x2cee('0x4c')](_0x535c8b['query']);_0x1287e4[_0x2cee('0x56')]=_[_0x2cee('0x4d')](_0x1287e4['model'],_0x1287e4[_0x2cee('0x4b')]);_0x9c2462[_0x2cee('0x4f')]=_[_0x2cee('0x4d')](_0x1287e4['model'],qs['fields'](_0x535c8b[_0x2cee('0x4b')]['fields']));_0x9c2462[_0x2cee('0x4f')]=_0x9c2462[_0x2cee('0x4f')][_0x2cee('0x50')]?_0x9c2462['attributes']:_0x1287e4[_0x2cee('0x4a')];if(!_0x535c8b[_0x2cee('0x4b')][_0x2cee('0x51')](_0x2cee('0x52'))){_0x9c2462[_0x2cee('0x1e')]=qs['limit'](_0x535c8b[_0x2cee('0x4b')][_0x2cee('0x1e')]);_0x9c2462['offset']=qs[_0x2cee('0x1c')](_0x535c8b['query'][_0x2cee('0x1c')]);}_0x9c2462[_0x2cee('0x53')]=qs[_0x2cee('0x54')](_0x535c8b['query'][_0x2cee('0x54')]);_0x9c2462['where']=qs[_0x2cee('0x56')](_[_0x2cee('0x71')](_0x535c8b[_0x2cee('0x4b')],_0x1287e4[_0x2cee('0x56')]));_0x9c2462[_0x2cee('0x55')][_0x2cee('0x69')]=_0x8cbeda['id'];if(_0x535c8b[_0x2cee('0x4b')]['filter']){_0x9c2462[_0x2cee('0x55')]=_[_0x2cee('0x58')](_0x9c2462[_0x2cee('0x55')],{'$or':_[_0x2cee('0x45')](_0x9c2462['attributes'],function(_0x46ed2b){var _0x5edfd6={};_0x5edfd6[_0x46ed2b]={'$like':'%'+_0x535c8b[_0x2cee('0x4b')][_0x2cee('0x57')]+'%'};return _0x5edfd6;})});}_0x9c2462=_[_0x2cee('0x58')]({},_0x9c2462,_0x535c8b[_0x2cee('0x61')]);return db['CannedAnswer']['count']({'where':_0x9c2462[_0x2cee('0x55')]})['then'](function(_0xa3e818){_0x157627[_0x2cee('0x1f')]=_0xa3e818;if(_0x535c8b[_0x2cee('0x4b')][_0x2cee('0x5a')]){_0x9c2462[_0x2cee('0x5b')]=[{'all':!![]}];}return db[_0x2cee('0x6d')][_0x2cee('0x5c')](_0x9c2462);})[_0x2cee('0x10')](function(_0x2843b3){_0x157627[_0x2cee('0x5d')]=_0x2843b3;return _0x157627;});}})[_0x2cee('0x10')](respondWithFilteredResult(_0x1c7b24,_0x9c2462))['catch'](handleError(_0x1c7b24,null));};exports[_0x2cee('0x72')]=function(_0x22d791,_0x186f2b){return db[_0x2cee('0x59')]['find']({'where':{'id':_0x22d791['params']['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x186f2b,null))[_0x2cee('0x10')](function(_0x2dd001){if(_0x2dd001){return _0x2dd001[_0x2cee('0x72')](_0x22d791[_0x2cee('0x4b')]['ids']);}})[_0x2cee('0x10')](respondWithStatusCode(_0x186f2b,null))[_0x2cee('0x18')](handleError(_0x186f2b,null));};exports[_0x2cee('0x6e')]=function(_0x379b00,_0x15c495){var _0x24f4ae={'name':_0x379b00['body'][_0x2cee('0x29')],'key':_0x379b00[_0x2cee('0x63')][_0x2cee('0x49')],'provider':_0x379b00[_0x2cee('0x63')][_0x2cee('0x64')]===_0x2cee('0x73')?null:_0x379b00[_0x2cee('0x63')][_0x2cee('0x64')],'email':_0x379b00[_0x2cee('0x63')]['email'],'ListId':_0x379b00['body']['ListId'],'active':!_[_0x2cee('0x74')](_0x379b00[_0x2cee('0x63')][_0x2cee('0x75')])?_0x379b00[_0x2cee('0x63')][_0x2cee('0x75')]:!![],'description':_0x379b00[_0x2cee('0x63')][_0x2cee('0x76')]||null};var _0x3353f0=getAuthenticationOptions(_0x24f4ae[_0x2cee('0x64')],_0x379b00[_0x2cee('0x63')]);_0x24f4ae[_0x2cee('0x3f')]=_0x3353f0['Imap'];_0x24f4ae['Smtp']=_0x3353f0[_0x2cee('0x40')];return db[_0x2cee('0x59')][_0x2cee('0x6e')](_0x24f4ae,{'include':[{'model':db[_0x2cee('0x60')],'as':_0x2cee('0x40')},{'model':db[_0x2cee('0x42')],'as':_0x2cee('0x3f')}]})[_0x2cee('0x10')](function(_0x3e4b82){var _0x38ca30=_0x379b00[_0x2cee('0x34')][_0x2cee('0x24')]({'plain':!![]});if(!_0x38ca30)throw new Error(_0x2cee('0x77'));if(_0x38ca30[_0x2cee('0x78')]===_0x2cee('0x34')){var _0x87210b=_0x3e4b82[_0x2cee('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x2cee('0x62')]({'where':{'name':_0x2cee('0x25'),'userProfileId':_0x38ca30[_0x2cee('0x79')]},'raw':!![]})[_0x2cee('0x10')](function(_0x394712){if(_0x394712&&_0x394712[_0x2cee('0x7a')]===0x0){return db['UserProfileResource'][_0x2cee('0x6e')]({'name':_0x87210b[_0x2cee('0x29')],'resourceId':_0x87210b['id'],'type':_0x394712[_0x2cee('0x29')],'sectionId':_0x394712['id']},{})[_0x2cee('0x10')](function(){return _0x3e4b82;});}else{return _0x3e4b82;}})['catch'](function(_0x27f108){logger['error'](_0x2cee('0x7b'),_0x27f108);throw _0x27f108;});}return _0x3e4b82;})['then'](respondWithResult(_0x15c495,0xc9))[_0x2cee('0x18')](handleError(_0x15c495,null));};exports[_0x2cee('0x7c')]=function(_0x22183,_0x42abc3){return db[_0x2cee('0x59')][_0x2cee('0x70')]({'where':{'id':_0x22183['params']['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x42abc3,null))[_0x2cee('0x10')](function(_0x4481dc){if(_0x4481dc){return _0x4481dc[_0x2cee('0x7c')]();}return null;})[_0x2cee('0x10')](respondWithResult(_0x42abc3,null))['catch'](handleError(_0x42abc3,null));};exports['addImap']=function(_0x2d182c,_0x21aa63){if(_0x2d182c[_0x2cee('0x63')]['id']){delete _0x2d182c[_0x2cee('0x63')]['id'];}return db[_0x2cee('0x59')][_0x2cee('0x62')]({'where':{'id':_0x2d182c[_0x2cee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x21aa63,null))['then'](function(_0x46d17c){if(_0x46d17c){_0x2d182c[_0x2cee('0x63')]['MailAccountId']=_0x46d17c['id'];return db[_0x2cee('0x42')][_0x2cee('0x6e')](_0x2d182c[_0x2cee('0x63')]);}})[_0x2cee('0x10')](respondWithResult(_0x21aa63,null))[_0x2cee('0x18')](handleError(_0x21aa63,null));};exports[_0x2cee('0x7d')]=function(_0x3c82c2,_0x1cbfcf){return db[_0x2cee('0x59')][_0x2cee('0x70')]({'where':{'id':_0x3c82c2[_0x2cee('0x5f')]['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x1cbfcf,null))[_0x2cee('0x10')](function(_0x1efe03){if(_0x1efe03){return _0x1efe03['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x1cbfcf,null))['catch'](handleError(_0x1cbfcf,null));};exports[_0x2cee('0x7e')]=function(_0x4861b8,_0x1b3baa){return db[_0x2cee('0x59')]['findOne']({'where':{'id':_0x4861b8[_0x2cee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1b3baa,null))[_0x2cee('0x10')](function(_0x1a196d){if(_0x1a196d){return _0x1a196d[_0x2cee('0x7e')]();}return null;})[_0x2cee('0x10')](respondWithResult(_0x1b3baa,null))[_0x2cee('0x18')](handleError(_0x1b3baa,null));};exports[_0x2cee('0x7f')]=function(_0x51a4bc,_0xf312f9){if(_0x51a4bc[_0x2cee('0x63')]['id']){delete _0x51a4bc[_0x2cee('0x63')]['id'];}return db[_0x2cee('0x59')][_0x2cee('0x62')]({'where':{'id':_0x51a4bc[_0x2cee('0x5f')]['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0xf312f9,null))[_0x2cee('0x10')](function(_0x115672){if(_0x115672){_0x51a4bc[_0x2cee('0x63')][_0x2cee('0x69')]=_0x115672['id'];return db[_0x2cee('0x60')][_0x2cee('0x6e')](_0x51a4bc[_0x2cee('0x63')]);}})['then'](respondWithResult(_0xf312f9,null))[_0x2cee('0x18')](handleError(_0xf312f9,null));};exports[_0x2cee('0x80')]=function(_0x226ec1,_0x1b7f4a){return db[_0x2cee('0x59')][_0x2cee('0x70')]({'where':{'id':_0x226ec1[_0x2cee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1b7f4a,null))[_0x2cee('0x10')](function(_0x39d22e){if(_0x39d22e){return _0x39d22e[_0x2cee('0x81')](null);}return null;})[_0x2cee('0x10')](respondWithStatusCode(_0x1b7f4a,null))[_0x2cee('0x18')](handleError(_0x1b7f4a,null));};exports['addInteraction']=function(_0x4a1eda,_0x2247c0){return db[_0x2cee('0x82')]['find']({'where':{'id':_0x4a1eda['params']['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x2247c0,null))[_0x2cee('0x10')](function(_0x465fe4){if(_0x465fe4){return _0x465fe4['addInteraction'](_0x4a1eda[_0x2cee('0x63')]['ids'],_[_0x2cee('0x83')](_0x4a1eda[_0x2cee('0x63')],[_0x2cee('0x6c'),'id'])||{});}})[_0x2cee('0x10')](respondWithResult(_0x2247c0,null))[_0x2cee('0x18')](handleError(_0x2247c0,null));};exports['getInteractions']=function(_0x588c5f,_0x2ab72b){var _0x5da4c9={'raw':![],'where':{}};var _0x3c8c91={};var _0x17381b={'count':0x0,'rows':[]};return db['MailAccount'][_0x2cee('0x70')]({'where':{'id':_0x588c5f[_0x2cee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2ab72b,null))['then'](function(_0x4dd174){if(_0x4dd174){_0x3c8c91[_0x2cee('0x4a')]=_['keys'](db[_0x2cee('0x82')][_0x2cee('0x46')]);_0x3c8c91[_0x2cee('0x4b')]=_['keys'](_0x588c5f[_0x2cee('0x4b')]);_0x3c8c91['filters']=_[_0x2cee('0x4d')](_0x3c8c91[_0x2cee('0x4a')],_0x3c8c91[_0x2cee('0x4b')]);_0x5da4c9[_0x2cee('0x4f')]=_['intersection'](_0x3c8c91[_0x2cee('0x4a')],qs['fields'](_0x588c5f[_0x2cee('0x4b')][_0x2cee('0x4e')]));_0x5da4c9['attributes']=_0x5da4c9[_0x2cee('0x4f')][_0x2cee('0x50')]?_0x5da4c9['attributes']:_0x3c8c91['model'];if(!_0x588c5f[_0x2cee('0x4b')]['hasOwnProperty']('nolimit')){_0x5da4c9['limit']=qs[_0x2cee('0x1e')](_0x588c5f[_0x2cee('0x4b')][_0x2cee('0x1e')]);_0x5da4c9[_0x2cee('0x1c')]=qs[_0x2cee('0x1c')](_0x588c5f[_0x2cee('0x4b')][_0x2cee('0x1c')]);}_0x5da4c9[_0x2cee('0x53')]=qs[_0x2cee('0x54')](_0x588c5f[_0x2cee('0x4b')][_0x2cee('0x54')]);_0x5da4c9[_0x2cee('0x55')]=qs[_0x2cee('0x56')](_[_0x2cee('0x71')](_0x588c5f[_0x2cee('0x4b')],_0x3c8c91['filters']));_0x5da4c9[_0x2cee('0x55')][_0x2cee('0x69')]=_0x4dd174['id'];if(_0x588c5f[_0x2cee('0x4b')][_0x2cee('0x57')]){_0x5da4c9['where']=_['merge'](_0x5da4c9[_0x2cee('0x55')],{'$or':_[_0x2cee('0x45')](_0x5da4c9[_0x2cee('0x4f')],function(_0x34d3be){var _0x5ccdbb={};_0x5ccdbb[_0x34d3be]={'$like':'%'+_0x588c5f['query']['filter']+'%'};return _0x5ccdbb;})});}_0x5da4c9=_['merge']({},_0x5da4c9,_0x588c5f[_0x2cee('0x61')]);return db[_0x2cee('0x82')][_0x2cee('0x1f')]({'where':_0x5da4c9['where']})[_0x2cee('0x10')](function(_0x10aa7e){_0x17381b[_0x2cee('0x1f')]=_0x10aa7e;if(_0x588c5f[_0x2cee('0x4b')][_0x2cee('0x5a')]){_0x5da4c9[_0x2cee('0x5b')]=[{'model':db[_0x2cee('0x84')],'as':'Contact','required':![]},{'model':db[_0x2cee('0x85')],'as':_0x2cee('0x86'),'attributes':[_0x2cee('0x29'),'fullname','internal'],'required':![]},{'model':db[_0x2cee('0x87')],'as':_0x2cee('0x88'),'attributes':['id',_0x2cee('0x29'),_0x2cee('0x89')],'where':_0x588c5f[_0x2cee('0x4b')][_0x2cee('0x8a')]?{'id':_0x588c5f[_0x2cee('0x4b')]['tag']}:undefined,'required':_0x588c5f['query'][_0x2cee('0x8a')]?!![]:![]}];}return db[_0x2cee('0x82')][_0x2cee('0x5c')](_0x5da4c9);})[_0x2cee('0x10')](function(_0x504f7e){_0x17381b[_0x2cee('0x5d')]=_0x504f7e;return _0x17381b;});}})[_0x2cee('0x10')](respondWithFilteredResult(_0x2ab72b,_0x5da4c9))[_0x2cee('0x18')](handleError(_0x2ab72b,null));};exports['addApplications']=function addApplications(_0x1ca928,_0x1514bf){var _0x45c3ac=_0x1ca928[_0x2cee('0x5f')]['id'];var _0x470e4f=_0x1ca928[_0x2cee('0x63')];var _0xff4662=0xc8;var _0x7d20b5=null;return db[_0x2cee('0x8b')]['transaction']({'isolationLevel':db[_0x2cee('0x8b')][_0x2cee('0x8c')][_0x2cee('0x8d')][_0x2cee('0x8e')]},function(_0x44433f){return db[_0x2cee('0x59')][_0x2cee('0x70')]({'where':{'id':_0x45c3ac},'transaction':_0x44433f})['then'](function(_0x5705e3){if(_0x5705e3){return db['MailApplication'][_0x2cee('0x27')]({'where':{'MailAccountId':_0x45c3ac},'transaction':_0x44433f})[_0x2cee('0x10')](function(){var _0x2b1e6d=_[_0x2cee('0x45')](_0x470e4f,function(_0x187a4b){_0x187a4b['MailAccountId']=_0x45c3ac;return _0x187a4b;});return db[_0x2cee('0x8f')][_0x2cee('0x90')](_0x2b1e6d,{'transaction':_0x44433f});});}else{_0xff4662=0x194;_0x7d20b5=[];}});})['then'](function(){if(_0xff4662!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x45c3ac},'order':_0x2cee('0x91')})[_0x2cee('0x10')](function(_0x2713af){_0x7d20b5=_0x2713af;});}})[_0x2cee('0x18')](function(_0x1cafd7){_0xff4662=0x1f4;logger[_0x2cee('0x16')](_0x1cafd7[_0x2cee('0x28')]);if(_0x1cafd7['name']){delete _0x1cafd7['name'];}_0x7d20b5=_0x1cafd7;})[_0x2cee('0x92')](function(){if(_0x7d20b5===null){_0x1514bf[_0x2cee('0x19')](_0xff4662);}else{if(_0xff4662===0x1f4){_0x1514bf[_0x2cee('0x20')](_0xff4662)['send'](_0x7d20b5);}else{_0x1514bf[_0x2cee('0x20')](_0xff4662)['json'](_0x7d20b5);}}});};exports['getApplications']=function(_0x316ffe,_0x4fc5dd){var _0x333317={};var _0x3b4a54={};var _0x5733de;var _0x177cff;return db['MailAccount'][_0x2cee('0x70')]({'where':{'id':_0x316ffe[_0x2cee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4fc5dd,null))[_0x2cee('0x10')](function(_0x5bebad){if(_0x5bebad){_0x5733de=_0x5bebad;_0x3b4a54[_0x2cee('0x4a')]=_[_0x2cee('0x4c')](db['MailApplication'][_0x2cee('0x46')]);_0x3b4a54[_0x2cee('0x4b')]=_[_0x2cee('0x4c')](_0x316ffe[_0x2cee('0x4b')]);_0x3b4a54[_0x2cee('0x56')]=_[_0x2cee('0x4d')](_0x3b4a54[_0x2cee('0x4a')],_0x3b4a54[_0x2cee('0x4b')]);_0x333317['attributes']=_[_0x2cee('0x4d')](_0x3b4a54['model'],qs[_0x2cee('0x4e')](_0x316ffe[_0x2cee('0x4b')][_0x2cee('0x4e')]));_0x333317['attributes']=_0x333317[_0x2cee('0x4f')]['length']?_0x333317[_0x2cee('0x4f')]:_0x3b4a54[_0x2cee('0x4a')];_0x333317[_0x2cee('0x53')]=qs[_0x2cee('0x54')](_0x316ffe['query'][_0x2cee('0x54')]);_0x333317[_0x2cee('0x55')]=qs[_0x2cee('0x56')](_[_0x2cee('0x71')](_0x316ffe[_0x2cee('0x4b')],_0x3b4a54[_0x2cee('0x56')]));if(_0x316ffe[_0x2cee('0x4b')]['filter']){_0x333317[_0x2cee('0x55')]=_[_0x2cee('0x58')](_0x333317['where'],{'$or':_[_0x2cee('0x45')](_0x333317[_0x2cee('0x4f')],function(_0x56c710){var _0x5a7cc2={};_0x5a7cc2[_0x56c710]={'$like':'%'+_0x316ffe[_0x2cee('0x4b')][_0x2cee('0x57')]+'%'};return _0x5a7cc2;})});}_0x333317=_['merge']({},_0x333317,_0x316ffe[_0x2cee('0x61')]);return _0x5733de[_0x2cee('0x93')](_0x333317);}})[_0x2cee('0x10')](function(_0x2339b9){if(_0x2339b9){_0x177cff=_0x2339b9[_0x2cee('0x50')];if(!_0x316ffe[_0x2cee('0x4b')][_0x2cee('0x51')](_0x2cee('0x52'))){_0x333317['limit']=qs[_0x2cee('0x1e')](_0x316ffe[_0x2cee('0x4b')][_0x2cee('0x1e')]);_0x333317[_0x2cee('0x1c')]=qs[_0x2cee('0x1c')](_0x316ffe[_0x2cee('0x4b')]['offset']);}return _0x5733de[_0x2cee('0x93')](_0x333317);}})[_0x2cee('0x10')](function(_0x2a0a6e){if(_0x2a0a6e){return _0x2a0a6e?{'count':_0x177cff,'rows':_0x2a0a6e}:null;}})[_0x2cee('0x10')](respondWithResult(_0x4fc5dd,null))[_0x2cee('0x18')](handleError(_0x4fc5dd,null));};exports[_0x2cee('0x94')]=function(_0x231bd6,_0x373244){var _0x2898bf={'raw':!![],'where':{}};var _0x50e712={};var _0x37f551={'count':0x0,'rows':[]};return db[_0x2cee('0x59')][_0x2cee('0x70')]({'where':{'id':_0x231bd6['params']['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x373244,null))[_0x2cee('0x10')](function(_0x3aae5a){if(_0x3aae5a){_0x50e712[_0x2cee('0x4a')]=_[_0x2cee('0x4c')](db[_0x2cee('0x95')][_0x2cee('0x46')]);_0x50e712[_0x2cee('0x4b')]=_[_0x2cee('0x4c')](_0x231bd6[_0x2cee('0x4b')]);_0x50e712['filters']=_[_0x2cee('0x4d')](_0x50e712[_0x2cee('0x4a')],_0x50e712['query']);_0x2898bf['attributes']=_['intersection'](_0x50e712[_0x2cee('0x4a')],qs['fields'](_0x231bd6['query'][_0x2cee('0x4e')]));_0x2898bf['attributes']=_0x2898bf[_0x2cee('0x4f')]['length']?_0x2898bf[_0x2cee('0x4f')]:_0x50e712[_0x2cee('0x4a')];if(!_0x231bd6[_0x2cee('0x4b')]['hasOwnProperty'](_0x2cee('0x52'))){_0x2898bf[_0x2cee('0x1e')]=qs[_0x2cee('0x1e')](_0x231bd6[_0x2cee('0x4b')][_0x2cee('0x1e')]);_0x2898bf['offset']=qs[_0x2cee('0x1c')](_0x231bd6['query']['offset']);}_0x2898bf['order']=qs[_0x2cee('0x54')](_0x231bd6[_0x2cee('0x4b')][_0x2cee('0x54')]);_0x2898bf[_0x2cee('0x55')]=qs[_0x2cee('0x56')](_[_0x2cee('0x71')](_0x231bd6[_0x2cee('0x4b')],_0x50e712['filters']));_0x2898bf[_0x2cee('0x55')][_0x2cee('0x69')]=_0x3aae5a['id'];if(_0x231bd6[_0x2cee('0x4b')]['filter']){_0x2898bf[_0x2cee('0x55')]=_[_0x2cee('0x58')](_0x2898bf[_0x2cee('0x55')],{'$or':_[_0x2cee('0x45')](_0x2898bf['attributes'],function(_0x25023c){var _0x271604={};_0x271604[_0x25023c]={'$like':'%'+_0x231bd6[_0x2cee('0x4b')]['filter']+'%'};return _0x271604;})});}if(_0x231bd6[_0x2cee('0x4b')][_0x2cee('0x96')]){var _0x55b640=_0x231bd6[_0x2cee('0x4b')][_0x2cee('0x96')]['split'](',');var _0x5d059f={};_0x5d059f[_0x55b640[0x0]]={'$gte':moment(_0x55b640[0x1])[_0x2cee('0x97')](_0x2cee('0x98'))};_0x2898bf[_0x2cee('0x55')]=_['merge'](_0x2898bf[_0x2cee('0x55')],_0x5d059f);}_0x2898bf=_[_0x2cee('0x58')]({},_0x2898bf,_0x231bd6[_0x2cee('0x61')]);return db[_0x2cee('0x95')][_0x2cee('0x1f')]({'where':_0x2898bf['where']})[_0x2cee('0x10')](function(_0x32f744){_0x37f551[_0x2cee('0x1f')]=_0x32f744;if(_0x231bd6[_0x2cee('0x4b')][_0x2cee('0x5a')]){_0x2898bf[_0x2cee('0x5b')]=[{'all':!![]}];}return db[_0x2cee('0x95')][_0x2cee('0x5c')](_0x2898bf);})['then'](function(_0x1a8ea1){if(_0x231bd6['query'][_0x2cee('0x99')]===_0x2cee('0x9a')){for(var _0x57271b=0x0;_0x57271b<_0x1a8ea1['length'];_0x57271b++){_0x1a8ea1[_0x57271b][_0x2cee('0x63')]=juice(_0x1a8ea1[_0x57271b][_0x2cee('0x63')]);}}_0x37f551[_0x2cee('0x5d')]=_0x1a8ea1;return _0x37f551;});}})[_0x2cee('0x10')](respondWithFilteredResult(_0x373244,_0x2898bf))['catch'](handleError(_0x373244,null));};exports['send']=function(_0x494849,_0x2c1274){var _0x4d63c5,_0x491d2a={},_0x345177;if(_0x494849[_0x2cee('0x63')]['to']){_0x345177=_0x494849[_0x2cee('0x63')]['to'][_0x2cee('0x9b')](',')[0x0];}return db[_0x2cee('0x59')]['find']({'where':{'id':_0x494849[_0x2cee('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x2cee('0x9c'),'include':[{'model':db[_0x2cee('0x84')],'as':_0x2cee('0x9d'),'where':{'email':_0x345177},'limit':0x1,'order':[[_0x2cee('0x9e'),_0x2cee('0x9f')]]}]},{'model':db[_0x2cee('0x60')],'as':_0x2cee('0x40'),'raw':!![],'include':[{'model':db[_0x2cee('0xa0')],'as':_0x2cee('0xa0'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2c1274,null))[_0x2cee('0x10')](function(_0x2a3603){if(!_0x2a3603)return;_0x4d63c5=_0x2a3603;if(!_0x2a3603[_0x2cee('0x40')])throw new Error(_0x2cee('0xa1'));if(_[_0x2cee('0x74')](_0x494849[_0x2cee('0x63')][_0x2cee('0xa2')])){_0x494849[_0x2cee('0x63')][_0x2cee('0xa2')]=util[_0x2cee('0x97')](_0x2cee('0xa3'),_0x2a3603[_0x2cee('0x29')],_0x2a3603['email']||_0x2a3603[_0x2cee('0x40')][_0x2cee('0x34')]);}if(_0x494849[_0x2cee('0x63')][_0x2cee('0xa4')]&&_0x494849[_0x2cee('0x63')][_0x2cee('0xa4')]['length']){for(var _0x58ec62=0x0;_0x58ec62<_0x494849['body'][_0x2cee('0xa4')][_0x2cee('0x50')];_0x58ec62+=0x1){_0x494849[_0x2cee('0x63')][_0x2cee('0xa4')][_0x58ec62]={'filename':_0x494849[_0x2cee('0x63')][_0x2cee('0xa4')][_0x58ec62][_0x2cee('0x29')],'path':path[_0x2cee('0xa5')](config[_0x2cee('0xa6')],'server/files/attachments',_0x494849[_0x2cee('0x63')][_0x2cee('0xa4')][_0x58ec62][_0x2cee('0xa7')])};}}var _0x22bdda=_0x2a3603[_0x2cee('0xa8')]();return respondWithRpcPromise(_0x2cee('0xa9'),_0x2cee('0xaa'),{'account':_0x22bdda,'message':_0x494849[_0x2cee('0x63')]});})[_0x2cee('0x10')](function(_0x37e59c){if(!_0x37e59c)return;_0x491d2a=_0x37e59c;if(!_0x4d63c5[_0x2cee('0x9c')])throw new Error(_0x2cee('0xab'));if(_0x4d63c5[_0x2cee('0x9c')]['Contacts'][_0x2cee('0x50')])return _0x4d63c5['List']['Contacts'][0x0];return db[_0x2cee('0x84')][_0x2cee('0x6e')](_[_0x2cee('0x8')](_0x494849[_0x2cee('0x63')],{'firstName':_0x494849[_0x2cee('0x63')]['to'],'email':_0x494849[_0x2cee('0x63')]['to'],'phone':_0x494849[_0x2cee('0x63')]['to'],'ListId':_0x4d63c5['ListId']}));})[_0x2cee('0x10')](function(_0x2457ac){if(!_0x2457ac)return;var _0x2ff435={'UserId':_0x494849[_0x2cee('0x34')]['id'],'ContactId':_0x2457ac['id'],'MailAccountId':_0x4d63c5['id'],'inReplyTo':_0x491d2a[_0x2cee('0xac')],'to':_0x494849[_0x2cee('0x63')][_0x2cee('0xa2')],'cc':_0x494849[_0x2cee('0x63')]['cc'],'subject':_0x494849[_0x2cee('0x63')]['subject'],'attach':_0x494849['body'][_0x2cee('0xad')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x2cee('0x97')](_0x2cee('0x98')),'lastMsgDirection':_0x2cee('0xae'),'Messages':[_['merge'](_0x494849[_0x2cee('0x63')],{'messageId':_0x491d2a[_0x2cee('0xac')],'sentAt':moment()['format'](_0x2cee('0x98')),'read':!![],'MailAccountId':_0x4d63c5['id'],'UserId':_0x494849[_0x2cee('0x34')]['id'],'ContactId':_0x2457ac['id']})]};if(_0x494849[_0x2cee('0x63')][_0x2cee('0xaf')]){_0x2ff435=_[_0x2cee('0x58')](_0x2ff435,_0x494849[_0x2cee('0x63')]['Interaction']);}return db[_0x2cee('0x82')][_0x2cee('0x6e')](_0x2ff435,{'include':[{'model':db[_0x2cee('0x95')],'as':_0x2cee('0xb0')}]});})['then'](respondWithResult(_0x2c1274,null))[_0x2cee('0x18')](handleError(_0x2c1274,null));};exports[_0x2cee('0xb1')]=function(_0x32cf8f,_0x38eb30){return db[_0x2cee('0x59')][_0x2cee('0x62')]({'where':{'id':_0x32cf8f['params']['id']},'include':[{'model':db[_0x2cee('0x60')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2cee('0xa0')],'as':_0x2cee('0xa0'),'raw':!![]}]}]})[_0x2cee('0x10')](handleEntityNotFound(_0x38eb30,null))[_0x2cee('0x10')](function(_0x175628){if(!_0x175628[_0x2cee('0x40')])return;var _0x50890a=_0x175628[_0x2cee('0xa8')]();return respondWithRpcPromise(_0x2cee('0xb2'),_0x2cee('0xb1'),{'account':_0x50890a});})['then'](respondWithResult(_0x38eb30,null))[_0x2cee('0x18')](handleError(_0x38eb30,null));};exports[_0x2cee('0x27')]=function(_0x58966b,_0x2a4fb3){return db[_0x2cee('0x59')][_0x2cee('0x62')]({'where':{'id':_0x58966b[_0x2cee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2a4fb3,null))[_0x2cee('0x10')](function(_0x472912){if(_0x472912&&_0x472912[_0x2cee('0x3c')]){throw new db[(_0x2cee('0xb3'))]['ValidationError'](_0x2cee('0xb4'));}return _0x472912;})[_0x2cee('0x10')](removeEntity(_0x2a4fb3,null))[_0x2cee('0x18')](handleError(_0x2a4fb3,null));};exports['addAgents']=function(_0x1b31eb,_0x4bfd8f){return db[_0x2cee('0x59')][_0x2cee('0x62')]({'where':{'id':_0x1b31eb['params']['id']}})['then'](handleEntityNotFound(_0x4bfd8f,null))['then'](function(_0x4dc9ba){if(_0x4dc9ba){return _0x4dc9ba['addAgents'](_0x1b31eb[_0x2cee('0x63')][_0x2cee('0x6c')],_['omit'](_0x1b31eb[_0x2cee('0x63')],[_0x2cee('0x6c'),'id'])||{})[_0x2cee('0xb5')](function(_0xfbbe4){for(var _0x2d5221=0x0;_0x2d5221<_0x1b31eb[_0x2cee('0x63')][_0x2cee('0x6c')][_0x2cee('0x50')];_0x2d5221+=0x1){socket[_0x2cee('0xb6')](_0x2cee('0xb7'),{'UserId':Number(_0x1b31eb[_0x2cee('0x63')]['ids'][_0x2d5221]),'MailAccountId':Number(_0x1b31eb[_0x2cee('0x5f')]['id'])});}return _0xfbbe4;});}})[_0x2cee('0x10')](respondWithResult(_0x4bfd8f,null))['catch'](handleError(_0x4bfd8f,null));};exports[_0x2cee('0xb8')]=function(_0x771ad1,_0x5cc356){return db[_0x2cee('0x59')][_0x2cee('0x62')]({'where':{'id':_0x771ad1[_0x2cee('0x5f')]['id']}})[_0x2cee('0x10')](handleEntityNotFound(_0x5cc356,null))[_0x2cee('0x10')](function(_0x280ed7){if(_0x280ed7){return _0x280ed7[_0x2cee('0xb8')](_0x771ad1[_0x2cee('0x4b')][_0x2cee('0x6c')])['then'](function(){if(_['isArray'](_0x771ad1[_0x2cee('0x4b')][_0x2cee('0x6c')])){for(var _0x58f23d=0x0;_0x58f23d<_0x771ad1[_0x2cee('0x4b')][_0x2cee('0x6c')][_0x2cee('0x50')];_0x58f23d+=0x1){socket['emit'](_0x2cee('0xb9'),{'UserId':Number(_0x771ad1[_0x2cee('0x4b')][_0x2cee('0x6c')][_0x58f23d]),'MailAccountId':Number(_0x771ad1[_0x2cee('0x5f')]['id'])});}}else{socket['emit'](_0x2cee('0xb9'),{'UserId':Number(_0x771ad1['query'][_0x2cee('0x6c')]),'MailAccountId':Number(_0x771ad1[_0x2cee('0x5f')]['id'])});}});}})[_0x2cee('0x10')](respondWithStatusCode(_0x5cc356,null))[_0x2cee('0x18')](handleError(_0x5cc356,null));};exports[_0x2cee('0xba')]=function(_0xfa3fa8,_0x4fb376){var _0x293167={};var _0x2afcfe={};var _0x4960ac;var _0x3eec11;return db[_0x2cee('0x59')]['findOne']({'where':{'id':_0xfa3fa8['params']['id']}})['then'](handleEntityNotFound(_0x4fb376,null))[_0x2cee('0x10')](function(_0x13c7b7){if(_0x13c7b7){_0x4960ac=_0x13c7b7;_0x2afcfe[_0x2cee('0x4a')]=_[_0x2cee('0x4c')](db['User']['rawAttributes']);_0x2afcfe[_0x2cee('0x4b')]=_[_0x2cee('0x4c')](_0xfa3fa8[_0x2cee('0x4b')]);_0x2afcfe['filters']=_[_0x2cee('0x4d')](_0x2afcfe[_0x2cee('0x4a')],_0x2afcfe[_0x2cee('0x4b')]);_0x293167['attributes']=_['intersection'](_0x2afcfe[_0x2cee('0x4a')],qs['fields'](_0xfa3fa8[_0x2cee('0x4b')][_0x2cee('0x4e')]));_0x293167['attributes']=_0x293167['attributes'][_0x2cee('0x50')]?_0x293167[_0x2cee('0x4f')]:_0x2afcfe[_0x2cee('0x4a')];_0x293167[_0x2cee('0x53')]=qs[_0x2cee('0x54')](_0xfa3fa8[_0x2cee('0x4b')]['sort']);_0x293167[_0x2cee('0x55')]=qs['filters'](_[_0x2cee('0x71')](_0xfa3fa8['query'],_0x2afcfe[_0x2cee('0x56')]));if(_0xfa3fa8[_0x2cee('0x4b')]['filter']){_0x293167[_0x2cee('0x55')]=_[_0x2cee('0x58')](_0x293167['where'],{'$or':_['map'](_0x293167[_0x2cee('0x4f')],function(_0x595195){var _0x2ed18d={};_0x2ed18d[_0x595195]={'$like':'%'+_0xfa3fa8[_0x2cee('0x4b')][_0x2cee('0x57')]+'%'};return _0x2ed18d;})});}_0x293167=_[_0x2cee('0x58')]({},_0x293167,_0xfa3fa8[_0x2cee('0x61')]);return _0x4960ac['getAgents'](_0x293167);}})[_0x2cee('0x10')](function(_0x5a490c){if(_0x5a490c){_0x3eec11=_0x5a490c['length'];if(!_0xfa3fa8[_0x2cee('0x4b')][_0x2cee('0x51')](_0x2cee('0x52'))){_0x293167[_0x2cee('0x1e')]=qs[_0x2cee('0x1e')](_0xfa3fa8[_0x2cee('0x4b')][_0x2cee('0x1e')]);_0x293167[_0x2cee('0x1c')]=qs[_0x2cee('0x1c')](_0xfa3fa8['query'][_0x2cee('0x1c')]);}return _0x4960ac[_0x2cee('0xba')](_0x293167);}})[_0x2cee('0x10')](function(_0x1d12dd){if(_0x1d12dd){return _0x1d12dd?{'count':_0x3eec11,'rows':_0x1d12dd}:null;}})[_0x2cee('0x10')](respondWithResult(_0x4fb376,null))['catch'](handleError(_0x4fb376,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 71b4c7d..5f5acdb 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 _0xdfd2=['setMaxListeners','update','remove','emit','hook','exports','events','MailAccount'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0xdfd2,0xf6));var _0x2dfd=function(_0x2b865e,_0x262682){_0x2b865e=_0x2b865e-0x0;var _0x261051=_0xdfd2[_0x2b865e];return _0x261051;};'use strict';var EventEmitter=require(_0x2dfd('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x2dfd('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2dfd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2dfd('0x3'),'afterDestroy':_0x2dfd('0x4')};function emitEvent(_0x57e414){return function(_0x4b7cca,_0x37c673,_0x4298a5){MailAccountEvents[_0x2dfd('0x5')](_0x57e414+':'+_0x4b7cca['id'],_0x4b7cca);MailAccountEvents['emit'](_0x57e414,_0x4b7cca);_0x4298a5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x2dfd('0x6')](e,emitEvent(event));}}module[_0x2dfd('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x36c3=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x565238,_0x492743){var _0x5ebac2=function(_0xb43b51){while(--_0xb43b51){_0x565238['push'](_0x565238['shift']());}};_0x5ebac2(++_0x492743);}(_0x36c3,0x1a6));var _0x336c=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0x36c3[_0x1406ae];return _0x23a076;};'use strict';var EventEmitter=require(_0x336c('0x0'));var MailAccount=require(_0x336c('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x336c('0x2')](0x0);var events={'afterCreate':_0x336c('0x3'),'afterUpdate':_0x336c('0x4'),'afterDestroy':_0x336c('0x5')};function emitEvent(_0x32aed2){return function(_0x2b1194,_0x39ed12,_0x4e4c07){MailAccountEvents[_0x336c('0x6')](_0x32aed2+':'+_0x2b1194['id'],_0x2b1194);MailAccountEvents[_0x336c('0x6')](_0x32aed2,_0x2b1194);_0x4e4c07(null);};}for(var e in events){if(events[_0x336c('0x7')](e)){var event=events[e];MailAccount[_0x336c('0x8')](e,emitEvent(event));}}module[_0x336c('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 39284f5..6708255 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 _0xdf8f=['data5','exports','define','MailAccount','mail_accounts','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user'];(function(_0x192d32,_0x11324c){var _0x4cfd5e=function(_0x5b7aa3){while(--_0x5b7aa3){_0x192d32['push'](_0x192d32['shift']());}};_0x4cfd5e(++_0x11324c);}(_0xdf8f,0x7f));var _0xfdf8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdf8f[_0x19950b];return _0x3c6b41;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xfdf8('0x0')]=function(_0x421821){return _0x421821[_0xfdf8('0x1')](_0xfdf8('0x2'),attributes,{'tableName':_0xfdf8('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x7baade=this;var _0x4d155a={'id':_0x7baade['id'],'tls':{'rejectUnauthorized':![]}};if(_0x7baade['provider']!==_0xfdf8('0x4')){_0x4d155a[_0xfdf8('0x5')]=_0x7baade['provider'];}else{_0x4d155a[_0xfdf8('0x6')]=_0x7baade[_0xfdf8('0x7')]['host'];_0x4d155a[_0xfdf8('0x8')]=_0x7baade[_0xfdf8('0x7')][_0xfdf8('0x8')];_0x4d155a['secure']=_0x7baade[_0xfdf8('0x7')][_0xfdf8('0x9')];}if(_0x7baade[_0xfdf8('0x7')][_0xfdf8('0xa')]){if(_0x7baade[_0xfdf8('0x7')][_0xfdf8('0xb')]){if(!_0x7baade[_0xfdf8('0x7')][_0xfdf8('0xc')])throw new Error(_0xfdf8('0xd'));_0x4d155a[_0xfdf8('0xe')]={'type':_0xfdf8('0xf'),'user':_0x7baade['Smtp'][_0xfdf8('0x10')],'accessToken':_0x7baade['Smtp'][_0xfdf8('0xc')][_0xfdf8('0x11')]};}else{_0x4d155a[_0xfdf8('0xe')]={'user':_0x7baade['Smtp'][_0xfdf8('0x10')],'pass':_0x7baade['Smtp']['pass']};}}return _0x4d155a;}}});}; \ No newline at end of file +var _0xd26a=['Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','service','provider','host','Smtp','port','secure','authentication','CloudProvider'];(function(_0xce06d0,_0xe944b9){var _0x360347=function(_0x565311){while(--_0x565311){_0xce06d0['push'](_0xce06d0['shift']());}};_0x360347(++_0xe944b9);}(_0xd26a,0x1a4));var _0xad26=function(_0x2762d5,_0x2fb941){_0x2762d5=_0x2762d5-0x0;var _0x2306e2=_0xd26a[_0x2762d5];return _0x2306e2;};'use strict';var attributes=require(_0xad26('0x0'));module['exports']=function(_0x315fcc){return _0x315fcc[_0xad26('0x1')](_0xad26('0x2'),attributes,{'tableName':_0xad26('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4d7470=this;var _0x48b29d={'id':_0x4d7470['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4d7470['provider']!=='custom'){_0x48b29d[_0xad26('0x4')]=_0x4d7470[_0xad26('0x5')];}else{_0x48b29d[_0xad26('0x6')]=_0x4d7470[_0xad26('0x7')][_0xad26('0x6')];_0x48b29d[_0xad26('0x8')]=_0x4d7470['Smtp'][_0xad26('0x8')];_0x48b29d['secure']=_0x4d7470[_0xad26('0x7')][_0xad26('0x9')];}if(_0x4d7470[_0xad26('0x7')][_0xad26('0xa')]){if(_0x4d7470[_0xad26('0x7')]['modernAuthentication']){if(!_0x4d7470[_0xad26('0x7')][_0xad26('0xb')])throw new Error(_0xad26('0xc'));_0x48b29d['auth']={'type':'OAuth2','user':_0x4d7470[_0xad26('0x7')]['user'],'accessToken':_0x4d7470[_0xad26('0x7')][_0xad26('0xb')]['data5']};}else{_0x48b29d[_0xad26('0xd')]={'user':_0x4d7470[_0xad26('0x7')][_0xad26('0xe')],'pass':_0x4d7470[_0xad26('0x7')][_0xad26('0xf')]};}}return _0x48b29d;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 785d90f..48f2daa 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 _0xec39=['catch','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','NotifyMailAccount','mail','difference','keys','CmContact','updatedAt','ListId','body','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','getSmtpOptions','applications','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','create','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','spread','update','interaction','subject','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x255f0d,_0x25f6e5){var _0x36b9d3=function(_0x450672){while(--_0x450672){_0x255f0d['push'](_0x255f0d['shift']());}};_0x36b9d3(++_0x25f6e5);}(_0xec39,0x19f));var _0x9ec3=function(_0x387f9a,_0x56659a){_0x387f9a=_0x387f9a-0x0;var _0x49f2ec=_0xec39[_0x387f9a];return _0x49f2ec;};'use strict';var _=require(_0x9ec3('0x0'));var moment=require(_0x9ec3('0x1'));var BPromise=require(_0x9ec3('0x2'));var rs=require(_0x9ec3('0x3'));var Redis=require(_0x9ec3('0x4'));var db=require(_0x9ec3('0x5'))['db'];var logger=require(_0x9ec3('0x6'))('rpc');var config=require(_0x9ec3('0x7'));var jayson=require(_0x9ec3('0x8'));var client=jayson[_0x9ec3('0x9')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0x9ec3('0xa')],{'host':_0x9ec3('0xb'),'port':0x18eb});var socket=require(_0x9ec3('0xc'))(new Redis(config['redis']));require(_0x9ec3('0xd'))[_0x9ec3('0xe')](socket);function respondWithRpcPromise(_0x2e49f3,_0x2d0c30,_0x11c3e9){return new BPromise(function(_0x3347b6,_0x1c492e){return client['request'](_0x2e49f3,_0x11c3e9)[_0x9ec3('0xf')](function(_0xaa1307){logger[_0x9ec3('0x10')](_0x9ec3('0x11'),_0x2d0c30,_0x9ec3('0x12'));logger[_0x9ec3('0x13')](_0x9ec3('0x14'),_0x2d0c30,'request\x20sent',JSON[_0x9ec3('0x15')](_0xaa1307));if(_0xaa1307[_0x9ec3('0x16')]){if(_0xaa1307[_0x9ec3('0x16')]['code']===0x1f4){logger[_0x9ec3('0x16')]('MailAccount,\x20%s,\x20%s',_0x2d0c30,_0xaa1307[_0x9ec3('0x16')][_0x9ec3('0x17')]);return _0x1c492e(_0xaa1307[_0x9ec3('0x16')][_0x9ec3('0x17')]);}logger[_0x9ec3('0x16')](_0x9ec3('0x11'),_0x2d0c30,_0xaa1307[_0x9ec3('0x16')][_0x9ec3('0x17')]);return _0x3347b6(_0xaa1307[_0x9ec3('0x16')]['message']);}else{logger[_0x9ec3('0x10')]('MailAccount,\x20%s,\x20%s',_0x2d0c30,'request\x20sent');_0x3347b6(_0xaa1307[_0x9ec3('0x18')][_0x9ec3('0x17')]);}})[_0x9ec3('0x19')](function(_0xa3bade){logger[_0x9ec3('0x16')]('MailAccount,\x20%s,\x20%s',_0x2d0c30,_0xa3bade);_0x1c492e(_0xa3bade);});});}exports[_0x9ec3('0x1a')]=function(_0x4a413c){var _0x38343b=this;return new Promise(function(_0x58a7d8,_0x477a59){return db[_0x9ec3('0x1b')][_0x9ec3('0x1c')]({'raw':_0x4a413c['options']?_0x4a413c[_0x9ec3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4a413c[_0x9ec3('0x1d')]?_0x4a413c['options'][_0x9ec3('0x1e')]||null:null,'attributes':_0x4a413c[_0x9ec3('0x1d')]?_0x4a413c[_0x9ec3('0x1d')][_0x9ec3('0x1f')]||null:null,'limit':_0x4a413c[_0x9ec3('0x1d')]?_0x4a413c[_0x9ec3('0x1d')][_0x9ec3('0x20')]||null:null,'include':_0x4a413c['options']?_0x4a413c[_0x9ec3('0x1d')][_0x9ec3('0x21')]?_[_0x9ec3('0x22')](_0x4a413c[_0x9ec3('0x1d')][_0x9ec3('0x21')],function(_0x366392){return{'model':db[_0x366392[_0x9ec3('0x23')]],'as':_0x366392['as'],'attributes':_0x366392[_0x9ec3('0x1f')],'include':_0x366392[_0x9ec3('0x21')]?_[_0x9ec3('0x22')](_0x366392[_0x9ec3('0x21')],function(_0x58d6fe){return{'model':db[_0x58d6fe[_0x9ec3('0x23')]],'as':_0x58d6fe['as'],'attributes':_0x58d6fe[_0x9ec3('0x1f')],'include':_0x58d6fe[_0x9ec3('0x21')]?_[_0x9ec3('0x22')](_0x58d6fe['include'],function(_0x1f7089){return{'model':db[_0x1f7089[_0x9ec3('0x23')]],'as':_0x1f7089['as'],'attributes':_0x1f7089[_0x9ec3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9ec3('0xf')](function(_0x257269){logger[_0x9ec3('0x10')](_0x9ec3('0x1a'),_0x4a413c);logger[_0x9ec3('0x13')](_0x9ec3('0x1a'),_0x4a413c,JSON[_0x9ec3('0x15')](_0x257269));_0x58a7d8(_0x257269);})[_0x9ec3('0x19')](function(_0x1a702d){logger[_0x9ec3('0x16')](_0x9ec3('0x1a'),_0x1a702d[_0x9ec3('0x17')],_0x4a413c);_0x477a59(_0x38343b[_0x9ec3('0x16')](0x1f4,_0x1a702d[_0x9ec3('0x17')]));});});};exports['ShowMailAccount']=function(_0x5caa5a){var _0x4c50fd=this;return new Promise(function(_0x1e86a7,_0x3c18a7){return db[_0x9ec3('0x1b')][_0x9ec3('0x24')]({'raw':_0x5caa5a[_0x9ec3('0x1d')]?_0x5caa5a[_0x9ec3('0x1d')][_0x9ec3('0x25')]===undefined?!![]:![]:!![],'where':_0x5caa5a['options']?_0x5caa5a[_0x9ec3('0x1d')][_0x9ec3('0x1e')]||null:null,'attributes':_0x5caa5a[_0x9ec3('0x1d')]?_0x5caa5a['options'][_0x9ec3('0x1f')]||null:null,'include':_0x5caa5a[_0x9ec3('0x1d')]?_0x5caa5a['options'][_0x9ec3('0x21')]?_[_0x9ec3('0x22')](_0x5caa5a[_0x9ec3('0x1d')][_0x9ec3('0x21')],function(_0x81ac36){return{'model':db[_0x81ac36[_0x9ec3('0x23')]],'as':_0x81ac36['as'],'attributes':_0x81ac36[_0x9ec3('0x1f')],'include':_0x81ac36['include']?_[_0x9ec3('0x22')](_0x81ac36[_0x9ec3('0x21')],function(_0x515055){return{'model':db[_0x515055['model']],'as':_0x515055['as'],'attributes':_0x515055[_0x9ec3('0x1f')],'include':_0x515055['include']?_[_0x9ec3('0x22')](_0x515055[_0x9ec3('0x21')],function(_0x1b9704){return{'model':db[_0x1b9704[_0x9ec3('0x23')]],'as':_0x1b9704['as'],'attributes':_0x1b9704['attributes']};}):[]};}):[]};}):[]:[]})[_0x9ec3('0xf')](function(_0x9b06ff){if(_0x5caa5a[_0x9ec3('0x1d')][_0x9ec3('0x26')]===!![])_0x9b06ff[_0x9ec3('0x27')](_0x9ec3('0x28'),_0x9b06ff['getSmtpOptions']());logger['info']('ShowMailAccount',_0x5caa5a);logger[_0x9ec3('0x13')](_0x9ec3('0x29'),_0x5caa5a,JSON[_0x9ec3('0x15')](_0x9b06ff));_0x1e86a7(_0x9b06ff);})[_0x9ec3('0x19')](function(_0x2e0b54){logger[_0x9ec3('0x16')]('ShowMailAccount',_0x2e0b54[_0x9ec3('0x17')],_0x5caa5a);_0x3c18a7(_0x4c50fd[_0x9ec3('0x16')](0x1f4,_0x2e0b54['message']));});});};exports[_0x9ec3('0x2a')]=function(_0x1bc5b7){var _0x28b32c=this;return new Promise(function(_0x2bafea,_0x4cc99b){var _0xc41a94={'body':_0x1bc5b7['body'],'channel':_0x9ec3('0x2b')};var _0x3f6cbe=_[_0x9ec3('0x2c')](_[_0x9ec3('0x2d')](db[_0x9ec3('0x2e')]['rawAttributes']),['createdAt',_0x9ec3('0x2f'),'CompanyId',_0x9ec3('0x30')]);var _0x4c4144=![];if(_0x1bc5b7[_0x9ec3('0x31')]['id']){delete _0x1bc5b7['body']['id'];}if(_[_0x9ec3('0x32')](_0x1bc5b7[_0x9ec3('0x31')]['from'])){return _0x4cc99b(_0x28b32c[_0x9ec3('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x9ec3('0x32')](_0x1bc5b7[_0x9ec3('0x31')]['body'])||_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x31')]===''){return _0x4cc99b(_0x28b32c[_0x9ec3('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x9ec3('0x32')](_0x1bc5b7[_0x9ec3('0x31')]['mapKey'])){return _0x4cc99b(_0x28b32c[_0x9ec3('0x16')](0x1f4,_0x9ec3('0x33')+_0x3f6cbe));}if(!_[_0x9ec3('0x34')](_0x3f6cbe,_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x35')])){return _0x4cc99b(_0x28b32c[_0x9ec3('0x16')](0x1f4,_0x9ec3('0x36')+_0x3f6cbe));}var _0x340d52={};_0x340d52[_0x1bc5b7['body']['mapKey']]=_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x37')];return db['MailAccount'][_0x9ec3('0x24')]({'where':{'id':_0x1bc5b7[_0x9ec3('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x9ec3('0x39'),'include':[{'model':db[_0x9ec3('0x2e')],'as':_0x9ec3('0x3a'),'where':_0x340d52,'limit':0x1,'order':[[_0x9ec3('0x2f'),_0x9ec3('0x3b')]]}]},{'model':db[_0x9ec3('0x3c')],'as':_0x9ec3('0x3d')},{'model':db[_0x9ec3('0x3e')],'as':_0x9ec3('0x3f'),'include':[{'model':db[_0x9ec3('0x40')],'as':_0x9ec3('0x40')}]}]})[_0x9ec3('0xf')](function(_0x284088){if(_0x284088&&_0x284088['List']){var _0x60ac46=_0x284088['get']({'plain':!![]});_0xc41a94[_0x9ec3('0x38')]=_[_0x9ec3('0x41')](_0x60ac46,[_0x9ec3('0x3d'),'List']);_0xc41a94['account']['smtpOptions']=_0x284088[_0x9ec3('0x42')]();_0xc41a94[_0x9ec3('0x43')]=_0x60ac46[_0x9ec3('0x3d')];_0xc41a94['list']=_0x60ac46['List'];_0xc41a94['applications']=_[_0x9ec3('0x44')](_0xc41a94[_0x9ec3('0x43')],[_0x9ec3('0x45')],[_0x9ec3('0x46')]);if(_0xc41a94[_0x9ec3('0x38')]&&_0xc41a94[_0x9ec3('0x38')]['autoclose']){_0xc41a94[_0x9ec3('0x43')][_0x9ec3('0x47')]({'id':0x0,'priority':_0xc41a94[_0x9ec3('0x43')][_0x9ec3('0x48')]+0x1,'app':_0x9ec3('0x49'),'appdata':_0x9ec3('0x4a'),'interval':_0x9ec3('0x4b')});}if(_0xc41a94[_0x9ec3('0x38')][_0x9ec3('0x3d')]){delete _0xc41a94[_0x9ec3('0x38')][_0x9ec3('0x3d')];}if(_0xc41a94['account']['List']){delete _0xc41a94[_0x9ec3('0x38')][_0x9ec3('0x39')];}if(_0x60ac46['List'][_0x9ec3('0x3a')]['length']){return _0x60ac46['List'][_0x9ec3('0x3a')][0x0];}var _0x59538a=_['defaults'](_0x1bc5b7[_0x9ec3('0x31')],{'firstName':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x37')],'ListId':_0x60ac46[_0x9ec3('0x30')]});_0x59538a[_0x1bc5b7[_0x9ec3('0x31')]['mapKey']]=_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x37')];return db['CmContact'][_0x9ec3('0x4c')](_0x59538a);}else{throw new Error('List\x20not\x20found');}})[_0x9ec3('0xf')](function(_0x1d7b7d){_0xc41a94[_0x9ec3('0x4d')]=_0x1d7b7d;if(_0x1d7b7d){if(!_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x4e')]){_0x1bc5b7[_0x9ec3('0x31')]['message']['messageId']=rs['generate']()+'\x20'+_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x37')];}var _0x3f3856={'ContactId':_0x1d7b7d['id'],'MailAccountId':_0x1bc5b7[_0x9ec3('0x38')]['id'],'inReplyTo':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x4e')],'to':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x37')],'cc':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')]['cc'],'subject':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')]['subject'],'attach':_0x1bc5b7['body'][_0x9ec3('0x17')][_0x9ec3('0x4f')],'lastMsgAt':moment()[_0x9ec3('0x50')](_0x9ec3('0x51')),'lastMsgDirection':'in'};return db[_0x9ec3('0x52')][_0x9ec3('0x24')]({'where':{'closed':![],'MailAccountId':_0x1bc5b7['account']['id']},'include':[{'model':db[_0x9ec3('0x53')],'as':'Messages','attributes':[_0x9ec3('0x4e')],'where':{'messageId':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x54')]}}]})['then'](function(_0x49b882){if(_0x49b882){return[_0x49b882,![]];}return db[_0x9ec3('0x52')]['create'](_0x3f3856)[_0x9ec3('0xf')](function(_0x1aac06){return[_0x1aac06,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9ec3('0x55')](function(_0x4b4045,_0xbbfd0f){if(_0x4b4045){_0x4c4144=_0xbbfd0f;if(!_0xbbfd0f){return _0x4b4045[_0x9ec3('0x56')]({'inReplyTo':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x4e')],'to':_0x1bc5b7['body']['message'][_0x9ec3('0x37')],'cc':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')]['cc'],'subject':_0x1bc5b7[_0x9ec3('0x31')]['message']['subject'],'attach':_0x4b4045[_0x9ec3('0x4f')]?_0x4b4045[_0x9ec3('0x4f')]:_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x4f')],'substatus':null,'substatusAt':moment()[_0x9ec3('0x50')](_0x9ec3('0x51')),'lastMsgAt':moment()['format'](_0x9ec3('0x51')),'lastMsgDirection':'in'});}else{return _0x4b4045;}}})[_0x9ec3('0xf')](function(_0x4ad9e0){_0xc41a94[_0x9ec3('0x57')]=_0x4ad9e0['get']({'plain':!![]});_0xc41a94[_0x9ec3('0x57')]['created']=_0x4c4144;return db[_0x9ec3('0x53')][_0x9ec3('0x4c')]({'body':_0x1bc5b7[_0x9ec3('0x31')]['body'],'MailAccountId':_0x1bc5b7['account']['id'],'MailInteractionId':_0x4ad9e0['id'],'direction':'in','ContactId':_0xc41a94[_0x9ec3('0x4d')]['id'],'messageId':_0x1bc5b7[_0x9ec3('0x31')]['message'][_0x9ec3('0x4e')],'from':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x37')],'to':_0x1bc5b7[_0x9ec3('0x31')]['message']['to'],'cc':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')]['cc'],'subject':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x58')],'attach':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x4f')],'Attachments':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x59')],'originTo':_0x1bc5b7[_0x9ec3('0x31')]['message'][_0x9ec3('0x5a')],'originCc':_0x1bc5b7[_0x9ec3('0x31')]['message'][_0x9ec3('0x5b')],'bcc':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x5c')],'ChatWebsiteId':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x5d')]||null,'originChannel':_0x1bc5b7[_0x9ec3('0x31')][_0x9ec3('0x17')][_0x9ec3('0x5e')]||_0x9ec3('0x5f'),'ChatOfflineMessageId':_0x1bc5b7['body']['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x9ec3('0x60')],'as':_0x9ec3('0x61')}]});})['then'](function(_0x9c149e){_0xc41a94[_0x9ec3('0x17')]=_0x9c149e;if(!_0xc41a94[_0x9ec3('0x57')][_0x9ec3('0x62')]){return;}return db[_0x9ec3('0x63')][_0x9ec3('0x24')]({'attributes':['id',_0x9ec3('0x64')],'where':{'id':_0xc41a94['interaction'][_0x9ec3('0x62')]}});})[_0x9ec3('0xf')](function(_0x1ac7fd){if(_0x1ac7fd){_0xc41a94['applications'][_0x9ec3('0x65')]({'id':0x0,'priority':0x0,'app':_0x9ec3('0x66'),'appdata':_0x1ac7fd[_0x9ec3('0x64')]+','+(_0xc41a94[_0x9ec3('0x38')][_0x9ec3('0x67')]||0xa),'interval':_0x9ec3('0x4b')});}if(!_0xc41a94[_0x9ec3('0x57')][_0x9ec3('0x68')]){return;}return db[_0x9ec3('0x69')][_0x9ec3('0x24')]({'attributes':['id',_0x9ec3('0x64')],'where':{'id':_0xc41a94[_0x9ec3('0x57')][_0x9ec3('0x68')]}});})[_0x9ec3('0xf')](function(_0xd43828){if(_0xd43828){_0xc41a94[_0x9ec3('0x43')]['unshift']({'id':0x0,'priority':0x1,'app':_0x9ec3('0x6a'),'appdata':_0xd43828[_0x9ec3('0x64')]+','+(_0xc41a94[_0x9ec3('0x38')][_0x9ec3('0x6b')]||0x12c),'interval':_0x9ec3('0x4b')});}return respondWithRpcPromise(_0x9ec3('0x6c'),_0x9ec3('0x6d'),_0xc41a94);})[_0x9ec3('0xf')](function(_0xe15edf){_0x2bafea(_0xe15edf);})['catch'](function(_0x4d890b){_0x4cc99b(_0x28b32c[_0x9ec3('0x16')](0x1f4,_0x4d890b[_0x9ec3('0x17')]));});});}; \ No newline at end of file +var _0xae30=['asc','autoclose','push','length','*,*,*,*','from','create','List\x20not\x20found','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetMailAccount','options','raw','where','limit','include','model','attributes','map','then','debug','ShowMailAccount','MailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','applications','list','orderBy','priority'];(function(_0x414c81,_0x5a7823){var _0x3e73b9=function(_0x561216){while(--_0x561216){_0x414c81['push'](_0x414c81['shift']());}};_0x3e73b9(++_0x5a7823);}(_0xae30,0x10a));var _0x0ae3=function(_0x498e3c,_0x2455c4){_0x498e3c=_0x498e3c-0x0;var _0x1e5f5f=_0xae30[_0x498e3c];return _0x1e5f5f;};'use strict';var _=require(_0x0ae3('0x0'));var moment=require(_0x0ae3('0x1'));var BPromise=require(_0x0ae3('0x2'));var rs=require('randomstring');var Redis=require(_0x0ae3('0x3'));var db=require(_0x0ae3('0x4'))['db'];var logger=require(_0x0ae3('0x5'))(_0x0ae3('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ae3('0x7'));var client=jayson[_0x0ae3('0x8')][_0x0ae3('0x9')]({'port':0x232c});config[_0x0ae3('0xa')]=_[_0x0ae3('0xb')](config[_0x0ae3('0xa')],{'host':_0x0ae3('0xc'),'port':0x18eb});var socket=require(_0x0ae3('0xd'))(new Redis(config[_0x0ae3('0xa')]));require(_0x0ae3('0xe'))[_0x0ae3('0xf')](socket);function respondWithRpcPromise(_0x22566f,_0x32ca2c,_0x49e0a5){return new BPromise(function(_0x98ab46,_0xee8a4c){return client['request'](_0x22566f,_0x49e0a5)['then'](function(_0x59cf73){logger[_0x0ae3('0x10')](_0x0ae3('0x11'),_0x32ca2c,_0x0ae3('0x12'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x32ca2c,_0x0ae3('0x12'),JSON[_0x0ae3('0x13')](_0x59cf73));if(_0x59cf73['error']){if(_0x59cf73['error'][_0x0ae3('0x14')]===0x1f4){logger['error'](_0x0ae3('0x11'),_0x32ca2c,_0x59cf73[_0x0ae3('0x15')][_0x0ae3('0x16')]);return _0xee8a4c(_0x59cf73[_0x0ae3('0x15')][_0x0ae3('0x16')]);}logger[_0x0ae3('0x15')](_0x0ae3('0x11'),_0x32ca2c,_0x59cf73['error'][_0x0ae3('0x16')]);return _0x98ab46(_0x59cf73['error'][_0x0ae3('0x16')]);}else{logger[_0x0ae3('0x10')](_0x0ae3('0x11'),_0x32ca2c,_0x0ae3('0x12'));_0x98ab46(_0x59cf73[_0x0ae3('0x17')][_0x0ae3('0x16')]);}})[_0x0ae3('0x18')](function(_0x1bf406){logger[_0x0ae3('0x15')]('MailAccount,\x20%s,\x20%s',_0x32ca2c,_0x1bf406);_0xee8a4c(_0x1bf406);});});}exports[_0x0ae3('0x19')]=function(_0x4b8949){var _0x49d4b7=this;return new Promise(function(_0x571135,_0x4ac074){return db['MailAccount']['findAll']({'raw':_0x4b8949['options']?_0x4b8949[_0x0ae3('0x1a')][_0x0ae3('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b8949[_0x0ae3('0x1a')]?_0x4b8949['options'][_0x0ae3('0x1c')]||null:null,'attributes':_0x4b8949['options']?_0x4b8949[_0x0ae3('0x1a')]['attributes']||null:null,'limit':_0x4b8949['options']?_0x4b8949['options'][_0x0ae3('0x1d')]||null:null,'include':_0x4b8949[_0x0ae3('0x1a')]?_0x4b8949[_0x0ae3('0x1a')]['include']?_['map'](_0x4b8949[_0x0ae3('0x1a')][_0x0ae3('0x1e')],function(_0x5a76e5){return{'model':db[_0x5a76e5[_0x0ae3('0x1f')]],'as':_0x5a76e5['as'],'attributes':_0x5a76e5[_0x0ae3('0x20')],'include':_0x5a76e5[_0x0ae3('0x1e')]?_['map'](_0x5a76e5[_0x0ae3('0x1e')],function(_0x1f9cde){return{'model':db[_0x1f9cde[_0x0ae3('0x1f')]],'as':_0x1f9cde['as'],'attributes':_0x1f9cde['attributes'],'include':_0x1f9cde[_0x0ae3('0x1e')]?_[_0x0ae3('0x21')](_0x1f9cde[_0x0ae3('0x1e')],function(_0x59a265){return{'model':db[_0x59a265[_0x0ae3('0x1f')]],'as':_0x59a265['as'],'attributes':_0x59a265[_0x0ae3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0ae3('0x22')](function(_0x152876){logger[_0x0ae3('0x10')](_0x0ae3('0x19'),_0x4b8949);logger[_0x0ae3('0x23')](_0x0ae3('0x19'),_0x4b8949,JSON[_0x0ae3('0x13')](_0x152876));_0x571135(_0x152876);})[_0x0ae3('0x18')](function(_0x4032f4){logger[_0x0ae3('0x15')](_0x0ae3('0x19'),_0x4032f4[_0x0ae3('0x16')],_0x4b8949);_0x4ac074(_0x49d4b7[_0x0ae3('0x15')](0x1f4,_0x4032f4['message']));});});};exports[_0x0ae3('0x24')]=function(_0x25ec0d){var _0x34480d=this;return new Promise(function(_0x39886e,_0x5243da){return db[_0x0ae3('0x25')][_0x0ae3('0x26')]({'raw':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d[_0x0ae3('0x1a')][_0x0ae3('0x1b')]===undefined?!![]:![]:!![],'where':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d['options'][_0x0ae3('0x1c')]||null:null,'attributes':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d[_0x0ae3('0x1a')][_0x0ae3('0x20')]||null:null,'include':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d[_0x0ae3('0x1a')][_0x0ae3('0x1e')]?_['map'](_0x25ec0d['options'][_0x0ae3('0x1e')],function(_0x45ac7d){return{'model':db[_0x45ac7d[_0x0ae3('0x1f')]],'as':_0x45ac7d['as'],'attributes':_0x45ac7d['attributes'],'include':_0x45ac7d['include']?_[_0x0ae3('0x21')](_0x45ac7d[_0x0ae3('0x1e')],function(_0x1ef996){return{'model':db[_0x1ef996[_0x0ae3('0x1f')]],'as':_0x1ef996['as'],'attributes':_0x1ef996[_0x0ae3('0x20')],'include':_0x1ef996[_0x0ae3('0x1e')]?_[_0x0ae3('0x21')](_0x1ef996['include'],function(_0x1453aa){return{'model':db[_0x1453aa[_0x0ae3('0x1f')]],'as':_0x1453aa['as'],'attributes':_0x1453aa[_0x0ae3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c7adf){if(_0x25ec0d['options'][_0x0ae3('0x27')]===!![])_0x4c7adf[_0x0ae3('0x28')]('smtpOptions',_0x4c7adf[_0x0ae3('0x29')]());logger[_0x0ae3('0x10')](_0x0ae3('0x24'),_0x25ec0d);logger['debug'](_0x0ae3('0x24'),_0x25ec0d,JSON['stringify'](_0x4c7adf));_0x39886e(_0x4c7adf);})[_0x0ae3('0x18')](function(_0x1626e1){logger['error'](_0x0ae3('0x24'),_0x1626e1[_0x0ae3('0x16')],_0x25ec0d);_0x5243da(_0x34480d[_0x0ae3('0x15')](0x1f4,_0x1626e1[_0x0ae3('0x16')]));});});};exports[_0x0ae3('0x2a')]=function(_0x53eda3){var _0x5298aa=this;return new Promise(function(_0x2e95e5,_0x334163){var _0x5c6874={'body':_0x53eda3['body'],'channel':'mail'};var _0x5b006c=_[_0x0ae3('0x2b')](_[_0x0ae3('0x2c')](db[_0x0ae3('0x2d')][_0x0ae3('0x2e')]),[_0x0ae3('0x2f'),_0x0ae3('0x30'),_0x0ae3('0x31'),_0x0ae3('0x32')]);var _0x2cfc16=![];if(_0x53eda3[_0x0ae3('0x33')]['id']){delete _0x53eda3['body']['id'];}if(_[_0x0ae3('0x34')](_0x53eda3[_0x0ae3('0x33')]['from'])){return _0x334163(_0x5298aa[_0x0ae3('0x15')](0x1f4,_0x0ae3('0x35')));}if(_[_0x0ae3('0x34')](_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x33')])||_0x53eda3['body'][_0x0ae3('0x33')]===''){return _0x334163(_0x5298aa[_0x0ae3('0x15')](0x1f4,_0x0ae3('0x36')));}if(_[_0x0ae3('0x34')](_0x53eda3['body'][_0x0ae3('0x37')])){return _0x334163(_0x5298aa[_0x0ae3('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b006c));}if(!_[_0x0ae3('0x38')](_0x5b006c,_0x53eda3[_0x0ae3('0x33')]['mapKey'])){return _0x334163(_0x5298aa['error'](0x1f4,_0x0ae3('0x39')+_0x5b006c));}var _0x21b49f={};_0x21b49f[_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x37')]]=_0x53eda3[_0x0ae3('0x33')]['from'];return db['MailAccount'][_0x0ae3('0x26')]({'where':{'id':_0x53eda3['account']['id']},'include':[{'model':db[_0x0ae3('0x3a')],'as':_0x0ae3('0x3b'),'include':[{'model':db['CmContact'],'as':_0x0ae3('0x3c'),'where':_0x21b49f,'limit':0x1,'order':[[_0x0ae3('0x30'),'DESC']]}]},{'model':db[_0x0ae3('0x3d')],'as':_0x0ae3('0x3e')},{'model':db[_0x0ae3('0x3f')],'as':_0x0ae3('0x40'),'include':[{'model':db[_0x0ae3('0x41')],'as':'CloudProvider'}]}]})[_0x0ae3('0x22')](function(_0x53393b){if(_0x53393b&&_0x53393b[_0x0ae3('0x3b')]){var _0x25310c=_0x53393b[_0x0ae3('0x42')]({'plain':!![]});_0x5c6874[_0x0ae3('0x43')]=_[_0x0ae3('0x44')](_0x25310c,[_0x0ae3('0x3e'),_0x0ae3('0x3b')]);_0x5c6874[_0x0ae3('0x43')]['smtpOptions']=_0x53393b[_0x0ae3('0x29')]();_0x5c6874[_0x0ae3('0x45')]=_0x25310c[_0x0ae3('0x3e')];_0x5c6874[_0x0ae3('0x46')]=_0x25310c[_0x0ae3('0x3b')];_0x5c6874[_0x0ae3('0x45')]=_[_0x0ae3('0x47')](_0x5c6874[_0x0ae3('0x45')],[_0x0ae3('0x48')],[_0x0ae3('0x49')]);if(_0x5c6874[_0x0ae3('0x43')]&&_0x5c6874['account'][_0x0ae3('0x4a')]){_0x5c6874['applications'][_0x0ae3('0x4b')]({'id':0x0,'priority':_0x5c6874[_0x0ae3('0x45')][_0x0ae3('0x4c')]+0x1,'app':'close','appdata':'autoclose','interval':_0x0ae3('0x4d')});}if(_0x5c6874['account'][_0x0ae3('0x3e')]){delete _0x5c6874['account'][_0x0ae3('0x3e')];}if(_0x5c6874[_0x0ae3('0x43')]['List']){delete _0x5c6874[_0x0ae3('0x43')][_0x0ae3('0x3b')];}if(_0x25310c[_0x0ae3('0x3b')][_0x0ae3('0x3c')][_0x0ae3('0x4c')]){return _0x25310c['List'][_0x0ae3('0x3c')][0x0];}var _0x4596b5=_['defaults'](_0x53eda3[_0x0ae3('0x33')],{'firstName':_0x53eda3[_0x0ae3('0x33')]['from'],'ListId':_0x25310c[_0x0ae3('0x32')]});_0x4596b5[_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x37')]]=_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x4e')];return db['CmContact'][_0x0ae3('0x4f')](_0x4596b5);}else{throw new Error(_0x0ae3('0x50'));}})[_0x0ae3('0x22')](function(_0x3d554c){_0x5c6874[_0x0ae3('0x51')]=_0x3d554c;if(_0x3d554c){if(!_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['messageId']){_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x52')]=rs['generate']()+'\x20'+_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x4e')];}var _0x3794df={'ContactId':_0x3d554c['id'],'MailAccountId':_0x53eda3[_0x0ae3('0x43')]['id'],'inReplyTo':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['messageId'],'to':_0x53eda3[_0x0ae3('0x33')]['message']['from'],'cc':_0x53eda3['body'][_0x0ae3('0x16')]['cc'],'subject':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x53')],'attach':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['attach'],'lastMsgAt':moment()[_0x0ae3('0x54')](_0x0ae3('0x55')),'lastMsgDirection':'in'};return db[_0x0ae3('0x56')][_0x0ae3('0x26')]({'where':{'closed':![],'MailAccountId':_0x53eda3[_0x0ae3('0x43')]['id']},'include':[{'model':db['MailMessage'],'as':_0x0ae3('0x57'),'attributes':[_0x0ae3('0x52')],'where':{'messageId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x58')]}}]})[_0x0ae3('0x22')](function(_0x4f5e27){if(_0x4f5e27){return[_0x4f5e27,![]];}return db['MailInteraction']['create'](_0x3794df)[_0x0ae3('0x22')](function(_0xd07bf7){return[_0xd07bf7,!![]];});});}else{throw new Error(_0x0ae3('0x59'));}})[_0x0ae3('0x5a')](function(_0x4c3808,_0x2f80f2){if(_0x4c3808){_0x2cfc16=_0x2f80f2;if(!_0x2f80f2){return _0x4c3808[_0x0ae3('0x5b')]({'inReplyTo':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x52')],'to':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x4e')],'cc':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['cc'],'subject':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x53')],'attach':_0x4c3808['attach']?_0x4c3808[_0x0ae3('0x5c')]:_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x5c')],'substatus':null,'substatusAt':moment()[_0x0ae3('0x54')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0ae3('0x54')](_0x0ae3('0x55')),'lastMsgDirection':'in'});}else{return _0x4c3808;}}})[_0x0ae3('0x22')](function(_0x5bc332){_0x5c6874[_0x0ae3('0x5d')]=_0x5bc332[_0x0ae3('0x42')]({'plain':!![]});_0x5c6874[_0x0ae3('0x5d')]['created']=_0x2cfc16;return db['MailMessage'][_0x0ae3('0x4f')]({'body':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x33')],'MailAccountId':_0x53eda3['account']['id'],'MailInteractionId':_0x5bc332['id'],'direction':'in','ContactId':_0x5c6874['contact']['id'],'messageId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x52')],'from':_0x53eda3['body'][_0x0ae3('0x16')]['from'],'to':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['to'],'cc':_0x53eda3['body'][_0x0ae3('0x16')]['cc'],'subject':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x53')],'attach':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x5c')],'Attachments':_0x53eda3[_0x0ae3('0x33')]['message'][_0x0ae3('0x5e')],'originTo':_0x53eda3[_0x0ae3('0x33')]['message'][_0x0ae3('0x5f')],'originCc':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x60')],'bcc':_0x53eda3[_0x0ae3('0x33')]['message'][_0x0ae3('0x61')],'ChatWebsiteId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x62')]||null,'originChannel':_0x53eda3['body'][_0x0ae3('0x16')][_0x0ae3('0x63')]||_0x0ae3('0x64'),'ChatOfflineMessageId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x0ae3('0x65')],'as':'Attachments'}]});})['then'](function(_0x284dbe){_0x5c6874[_0x0ae3('0x16')]=_0x284dbe;if(!_0x5c6874[_0x0ae3('0x5d')][_0x0ae3('0x66')]){return;}return db[_0x0ae3('0x67')]['find']({'attributes':['id',_0x0ae3('0x68')],'where':{'id':_0x5c6874[_0x0ae3('0x5d')][_0x0ae3('0x66')]}});})[_0x0ae3('0x22')](function(_0x1b94d6){if(_0x1b94d6){_0x5c6874[_0x0ae3('0x45')][_0x0ae3('0x69')]({'id':0x0,'priority':0x0,'app':_0x0ae3('0x6a'),'appdata':_0x1b94d6[_0x0ae3('0x68')]+','+(_0x5c6874[_0x0ae3('0x43')][_0x0ae3('0x6b')]||0xa),'interval':_0x0ae3('0x4d')});}if(!_0x5c6874[_0x0ae3('0x5d')]['queueId']){return;}return db[_0x0ae3('0x6c')][_0x0ae3('0x26')]({'attributes':['id',_0x0ae3('0x68')],'where':{'id':_0x5c6874['interaction'][_0x0ae3('0x6d')]}});})[_0x0ae3('0x22')](function(_0x535ebd){if(_0x535ebd){_0x5c6874[_0x0ae3('0x45')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x535ebd[_0x0ae3('0x68')]+','+(_0x5c6874[_0x0ae3('0x43')][_0x0ae3('0x6e')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0ae3('0x6f'),_0x0ae3('0x70'),_0x5c6874);})[_0x0ae3('0x22')](function(_0x5d4f97){_0x2e95e5(_0x5d4f97);})['catch'](function(_0x21d3d1){_0x334163(_0x5298aa['error'](0x1f4,_0x21d3d1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 1aafbd8..419ad34 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 _0x3a22=['mailAccount:','./mailAccount.events','remove','update','removeListener','length'];(function(_0x4b60a7,_0x522143){var _0xfe1b8f=function(_0x1f1141){while(--_0x1f1141){_0x4b60a7['push'](_0x4b60a7['shift']());}};_0xfe1b8f(++_0x522143);}(_0x3a22,0xa9));var _0x23a2=function(_0x1edf87,_0x563a1e){_0x1edf87=_0x1edf87-0x0;var _0x2bc33b=_0x3a22[_0x1edf87];return _0x2bc33b;};'use strict';var MailAccountEvents=require(_0x23a2('0x0'));var events=['save',_0x23a2('0x1'),_0x23a2('0x2')];function createListener(_0x2a9de1,_0x30c251){return function(_0x35d0e4){_0x30c251['emit'](_0x2a9de1,_0x35d0e4);};}function removeListener(_0x196afc,_0x24affa){return function(){MailAccountEvents[_0x23a2('0x3')](_0x196afc,_0x24affa);};}exports['register']=function(_0x4c6398){for(var _0x488223=0x0,_0x8ac91d=events[_0x23a2('0x4')];_0x488223<_0x8ac91d;_0x488223++){var _0x29077b=events[_0x488223];var _0x46f002=createListener(_0x23a2('0x5')+_0x29077b,_0x4c6398);MailAccountEvents['on'](_0x29077b,_0x46f002);}}; \ No newline at end of file +var _0xe5ff=['length','./mailAccount.events','save','remove','update','emit','register'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe5ff,0x197));var _0xfe5f=function(_0x2fb8a3,_0xd62303){_0x2fb8a3=_0x2fb8a3-0x0;var _0x132404=_0xe5ff[_0x2fb8a3];return _0x132404;};'use strict';var MailAccountEvents=require(_0xfe5f('0x0'));var events=[_0xfe5f('0x1'),_0xfe5f('0x2'),_0xfe5f('0x3')];function createListener(_0x19cbd0,_0x18967f){return function(_0x40959b){_0x18967f[_0xfe5f('0x4')](_0x19cbd0,_0x40959b);};}function removeListener(_0xb58880,_0x24b61c){return function(){MailAccountEvents['removeListener'](_0xb58880,_0x24b61c);};}exports[_0xfe5f('0x5')]=function(_0x36a58e){for(var _0x439ab5=0x0,_0x5db4ea=events[_0xfe5f('0x6')];_0x439ab5<_0x5db4ea;_0x439ab5++){var _0x5bef39=events[_0x439ab5];var _0x196127=createListener('mailAccount:'+_0x5bef39,_0x36a58e);MailAccountEvents['on'](_0x5bef39,_0x196127);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 1b59c1b..889dbe8 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 _0x515f=['../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2bb973,_0x17a18d){var _0x193933=function(_0x61145c){while(--_0x61145c){_0x2bb973['push'](_0x2bb973['shift']());}};_0x193933(++_0x17a18d);}(_0x515f,0x171));var _0xf515=function(_0x3c43f7,_0x1d6dd5){_0x3c43f7=_0x3c43f7-0x0;var _0xe770d2=_0x515f[_0x3c43f7];return _0xe770d2;};'use strict';var multer=require(_0xf515('0x0'));var util=require(_0xf515('0x1'));var path=require(_0xf515('0x2'));var timeout=require('connect-timeout');var express=require(_0xf515('0x3'));var router=express[_0xf515('0x4')]();var fs_extra=require(_0xf515('0x5'));var auth=require(_0xf515('0x6'));var interaction=require(_0xf515('0x7'));var config=require(_0xf515('0x8'));var controller=require('./mailApplication.controller');router['get'](_0xf515('0x9'),auth[_0xf515('0xa')](),controller[_0xf515('0xb')]);router['put'](_0xf515('0x9'),auth[_0xf515('0xa')](),controller[_0xf515('0xc')]);router[_0xf515('0xd')](_0xf515('0x9'),auth[_0xf515('0xa')](),controller['destroy']);module[_0xf515('0xe')]=router; \ No newline at end of file +var _0x15a4=['express','fs-extra','../../components/auth/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path'];(function(_0x555e89,_0x116bce){var _0xdee237=function(_0x41a889){while(--_0x41a889){_0x555e89['push'](_0x555e89['shift']());}};_0xdee237(++_0x116bce);}(_0x15a4,0x1bd));var _0x415a=function(_0x4a79dd,_0x1e4a7e){_0x4a79dd=_0x4a79dd-0x0;var _0x49a8a8=_0x15a4[_0x4a79dd];return _0x49a8a8;};'use strict';var multer=require(_0x415a('0x0'));var util=require(_0x415a('0x1'));var path=require(_0x415a('0x2'));var timeout=require('connect-timeout');var express=require(_0x415a('0x3'));var router=express['Router']();var fs_extra=require(_0x415a('0x4'));var auth=require(_0x415a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x415a('0x6'));router[_0x415a('0x7')](_0x415a('0x8'),auth[_0x415a('0x9')](),controller[_0x415a('0xa')]);router[_0x415a('0xb')](_0x415a('0x8'),auth['isAuthenticated'](),controller[_0x415a('0xc')]);router[_0x415a('0xd')](_0x415a('0x8'),auth['isAuthenticated'](),controller[_0x415a('0xe')]);module[_0x415a('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 436bab7..2bc171c 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 _0xe9e8=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe9e8,0x13c));var _0x8e9e=function(_0x3006fe,_0x3d6d0b){_0x3006fe=_0x3006fe-0x0;var _0x520dc4=_0xe9e8[_0x3006fe];return _0x520dc4;};'use strict';var Sequelize=require(_0x8e9e('0x0'));module[_0x8e9e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8e9e('0x2')],'allowNull':![],'defaultValue':_0x8e9e('0x3')},'appdata':{'type':Sequelize[_0x8e9e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8e9e('0x5')}}; \ No newline at end of file +var _0x5575=['exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x552a8e,_0xff37d3){var _0x1b724f=function(_0x8adf83){while(--_0x8adf83){_0x552a8e['push'](_0x552a8e['shift']());}};_0x1b724f(++_0xff37d3);}(_0x5575,0xe1));var _0x5557=function(_0x3d25b7,_0x471514){_0x3d25b7=_0x3d25b7-0x0;var _0xd90778=_0x5575[_0x3d25b7];return _0xd90778;};'use strict';var Sequelize=require('sequelize');module[_0x5557('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5557('0x1')},'appdata':{'type':Sequelize[_0x5557('0x2')]()},'description':{'type':Sequelize[_0x5557('0x3')]},'interval':{'type':Sequelize[_0x5557('0x3')],'defaultValue':_0x5557('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index cbd8992..a9cde6b 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 _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x563f7d,_0x7bfbcb){var _0x5984dc=function(_0x41b6c1){while(--_0x41b6c1){_0x563f7d['push'](_0x563f7d['shift']());}};_0x5984dc(++_0x7bfbcb);}(_0xda3f,0xec));var _0xfda3=function(_0x27d2b5,_0x2a1c05){_0x27d2b5=_0x27d2b5-0x0;var _0x3f8463=_0xda3f[_0x27d2b5];return _0x3f8463;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file +var _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x421bd1,_0x49d684){var _0x32dade=function(_0x5e9488){while(--_0x5e9488){_0x421bd1['push'](_0x421bd1['shift']());}};_0x32dade(++_0x49d684);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5e7e4d3..aa581d8 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 _0x605d=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xfab612,_0x4723da){var _0x1671b4=function(_0x32a24b){while(--_0x32a24b){_0xfab612['push'](_0xfab612['shift']());}};_0x1671b4(++_0x4723da);}(_0x605d,0xde));var _0xd605=function(_0x46884f,_0x2b5c5a){_0x46884f=_0x46884f-0x0;var _0x78c6c0=_0x605d[_0x46884f];return _0x78c6c0;};'use strict';var _=require(_0xd605('0x0'));var util=require(_0xd605('0x1'));var logger=require(_0xd605('0x2'))(_0xd605('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd605('0x4'));var fs=require('fs');var path=require(_0xd605('0x5'));var rimraf=require(_0xd605('0x6'));var config=require(_0xd605('0x7'));var attributes=require(_0xd605('0x8'));module[_0xd605('0x9')]=function(_0x8b67af,_0x638497){return _0x8b67af['define'](_0xd605('0xa'),attributes,{'tableName':_0xd605('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd605('0xc'),'collate':_0xd605('0xd')});}; \ No newline at end of file +var _0x3a91=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','mail_applications'];(function(_0x3be20c,_0x1d646d){var _0x3f04ea=function(_0x3579ca){while(--_0x3579ca){_0x3be20c['push'](_0x3be20c['shift']());}};_0x3f04ea(++_0x1d646d);}(_0x3a91,0x1a4));var _0x13a9=function(_0xd8eaa9,_0x1c3121){_0xd8eaa9=_0xd8eaa9-0x0;var _0x4ab53f=_0x3a91[_0xd8eaa9];return _0x4ab53f;};'use strict';var _=require('lodash');var util=require(_0x13a9('0x0'));var logger=require(_0x13a9('0x1'))('api');var moment=require(_0x13a9('0x2'));var BPromise=require(_0x13a9('0x3'));var rp=require(_0x13a9('0x4'));var fs=require('fs');var path=require(_0x13a9('0x5'));var rimraf=require('rimraf');var config=require(_0x13a9('0x6'));var attributes=require('./mailApplication.attributes');module[_0x13a9('0x7')]=function(_0xe1dbc8,_0x42c9a1){return _0xe1dbc8['define']('MailApplication',attributes,{'tableName':_0x13a9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x13a9('0x9'),'collate':_0x13a9('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 85d8bb5..ae5d969 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 _0x0638=['moment','../../mysqldb','rpc','../../config/environment','client','http','request','then','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','debug','lodash'];(function(_0x1d664a,_0x149a34){var _0x335345=function(_0x461fac){while(--_0x461fac){_0x1d664a['push'](_0x1d664a['shift']());}};_0x335345(++_0x149a34);}(_0x0638,0x1b9));var _0x8063=function(_0x1e93fa,_0x210f48){_0x1e93fa=_0x1e93fa-0x0;var _0xd4e1e6=_0x0638[_0x1e93fa];return _0xd4e1e6;};'use strict';var _=require(_0x8063('0x0'));var util=require('util');var moment=require(_0x8063('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8063('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8063('0x3'));var config=require(_0x8063('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8063('0x5')][_0x8063('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2775cd,_0x48a987,_0x198e08){return new BPromise(function(_0x39bea2,_0x22f069){return client[_0x8063('0x7')](_0x2775cd,_0x198e08)[_0x8063('0x8')](function(_0x245a0d){logger['info'](_0x8063('0x9'),_0x48a987,'request\x20sent');logger['debug'](_0x8063('0xa'),_0x48a987,'request\x20sent',JSON['stringify'](_0x245a0d));if(_0x245a0d[_0x8063('0xb')]){if(_0x245a0d[_0x8063('0xb')][_0x8063('0xc')]===0x1f4){logger[_0x8063('0xb')](_0x8063('0x9'),_0x48a987,_0x245a0d[_0x8063('0xb')][_0x8063('0xd')]);return _0x22f069(_0x245a0d[_0x8063('0xb')][_0x8063('0xd')]);}logger['error'](_0x8063('0x9'),_0x48a987,_0x245a0d[_0x8063('0xb')][_0x8063('0xd')]);return _0x39bea2(_0x245a0d[_0x8063('0xb')]['message']);}else{logger[_0x8063('0xe')](_0x8063('0x9'),_0x48a987,_0x8063('0xf'));_0x39bea2(_0x245a0d['result'][_0x8063('0xd')]);}})['catch'](function(_0x491cf7){logger['error'](_0x8063('0x9'),_0x48a987,_0x491cf7);_0x22f069(_0x491cf7);});});}exports[_0x8063('0x10')]=function(_0x102393){var _0x3de6e4=this;return new Promise(function(_0x554175,_0x50e58f){return db[_0x8063('0x11')][_0x8063('0x12')](_0x102393[_0x8063('0x13')],{'raw':_0x102393[_0x8063('0x14')]?_0x102393['options'][_0x8063('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x102393['options']?_0x102393[_0x8063('0x14')][_0x8063('0x16')]||null:null,'attributes':_0x102393[_0x8063('0x14')]?_0x102393[_0x8063('0x14')][_0x8063('0x17')]||null:null,'limit':_0x102393[_0x8063('0x14')]?_0x102393[_0x8063('0x14')][_0x8063('0x18')]||null:null})[_0x8063('0x8')](function(_0x5d1832){logger[_0x8063('0xe')]('UpdateMailApplication',_0x102393);logger[_0x8063('0x19')](_0x8063('0x10'),_0x102393,JSON['stringify'](_0x5d1832));_0x554175(_0x5d1832);})['catch'](function(_0x1c2d05){logger[_0x8063('0xb')](_0x8063('0x10'),_0x1c2d05['message'],_0x102393);_0x50e58f(_0x3de6e4[_0x8063('0xb')](0x1f4,_0x1c2d05[_0x8063('0xd')]));});});}; \ No newline at end of file +var _0xe808=['limit','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xe808,0xe9));var _0x8e80=function(_0xcc8e64,_0x22157f){_0xcc8e64=_0xcc8e64-0x0;var _0x1b2f14=_0xe808[_0xcc8e64];return _0x1b2f14;};'use strict';var _=require('lodash');var util=require(_0x8e80('0x0'));var moment=require('moment');var BPromise=require(_0x8e80('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e80('0x2'));var db=require(_0x8e80('0x3'))['db'];var utils=require(_0x8e80('0x4'));var logger=require(_0x8e80('0x5'))(_0x8e80('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e80('0x7')][_0x8e80('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57ab4f,_0x29560e,_0x43f842){return new BPromise(function(_0x35e101,_0x294d16){return client['request'](_0x57ab4f,_0x43f842)[_0x8e80('0x9')](function(_0x1771f2){logger[_0x8e80('0xa')]('MailApplication,\x20%s,\x20%s',_0x29560e,_0x8e80('0xb'));logger[_0x8e80('0xc')](_0x8e80('0xd'),_0x29560e,_0x8e80('0xb'),JSON[_0x8e80('0xe')](_0x1771f2));if(_0x1771f2['error']){if(_0x1771f2[_0x8e80('0xf')][_0x8e80('0x10')]===0x1f4){logger[_0x8e80('0xf')](_0x8e80('0x11'),_0x29560e,_0x1771f2[_0x8e80('0xf')][_0x8e80('0x12')]);return _0x294d16(_0x1771f2[_0x8e80('0xf')][_0x8e80('0x12')]);}logger[_0x8e80('0xf')]('MailApplication,\x20%s,\x20%s',_0x29560e,_0x1771f2['error']['message']);return _0x35e101(_0x1771f2[_0x8e80('0xf')][_0x8e80('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x29560e,_0x8e80('0xb'));_0x35e101(_0x1771f2['result'][_0x8e80('0x12')]);}})[_0x8e80('0x13')](function(_0x120e18){logger[_0x8e80('0xf')]('MailApplication,\x20%s,\x20%s',_0x29560e,_0x120e18);_0x294d16(_0x120e18);});});}exports[_0x8e80('0x14')]=function(_0x241196){var _0x5b7ce4=this;return new Promise(function(_0x335f77,_0x5f354f){return db[_0x8e80('0x15')][_0x8e80('0x16')](_0x241196[_0x8e80('0x17')],{'raw':_0x241196[_0x8e80('0x18')]?_0x241196[_0x8e80('0x18')][_0x8e80('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x241196[_0x8e80('0x18')]?_0x241196[_0x8e80('0x18')][_0x8e80('0x1a')]||null:null,'attributes':_0x241196['options']?_0x241196[_0x8e80('0x18')][_0x8e80('0x1b')]||null:null,'limit':_0x241196[_0x8e80('0x18')]?_0x241196['options'][_0x8e80('0x1c')]||null:null})[_0x8e80('0x9')](function(_0x18f0cb){logger[_0x8e80('0xa')](_0x8e80('0x14'),_0x241196);logger[_0x8e80('0xc')](_0x8e80('0x14'),_0x241196,JSON[_0x8e80('0xe')](_0x18f0cb));_0x335f77(_0x18f0cb);})['catch'](function(_0x3ce201){logger[_0x8e80('0xf')]('UpdateMailApplication',_0x3ce201['message'],_0x241196);_0x5f354f(_0x5b7ce4[_0x8e80('0xf')](0x1f4,_0x3ce201[_0x8e80('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 92bf821..c2d377d 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 _0x27ac=['exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','getMessages','/:id/download','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','removeTags'];(function(_0x4a2e12,_0x8b172b){var _0x2b8506=function(_0x5b9d30){while(--_0x5b9d30){_0x4a2e12['push'](_0x4a2e12['shift']());}};_0x2b8506(++_0x8b172b);}(_0x27ac,0xd1));var _0xc27a=function(_0x17f928,_0x5b3e05){_0x17f928=_0x17f928-0x0;var _0x35f22b=_0x27ac[_0x17f928];return _0x35f22b;};'use strict';var express=require(_0xc27a('0x0'));var router=express[_0xc27a('0x1')]();var auth=require(_0xc27a('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0xc27a('0x3'));router[_0xc27a('0x4')]('/',auth[_0xc27a('0x5')](),controller[_0xc27a('0x6')]);router['get'](_0xc27a('0x7'),auth['isAuthenticated'](),controller[_0xc27a('0x8')]);router['get']('/:id',auth[_0xc27a('0x5')](),controller[_0xc27a('0x9')]);router[_0xc27a('0x4')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc27a('0xa')]);router[_0xc27a('0x4')](_0xc27a('0xb'),auth[_0xc27a('0x5')](),controller[_0xc27a('0xc')]);router[_0xc27a('0xd')]('/',auth[_0xc27a('0x5')](),controller[_0xc27a('0xe')]);router[_0xc27a('0xd')]('/:id/messages',auth[_0xc27a('0x5')](),controller['addMessage']);router[_0xc27a('0xd')](_0xc27a('0xf'),auth[_0xc27a('0x5')](),interaction[_0xc27a('0x10')](_0xc27a('0x11'),_0xc27a('0x12')),controller[_0xc27a('0x13')]);router[_0xc27a('0x14')]('/:id',auth['isAuthenticated'](),interaction[_0xc27a('0x10')](_0xc27a('0x11'),_0xc27a('0x15')),controller['update']);router[_0xc27a('0x16')]('/:id',auth[_0xc27a('0x5')](),interaction[_0xc27a('0x10')]('mail',_0xc27a('0x17')),controller['destroy']);router[_0xc27a('0x16')]('/:id/tags',auth[_0xc27a('0x5')](),controller[_0xc27a('0x18')]);module[_0xc27a('0x19')]=router; \ No newline at end of file +var _0x0e83=['removeTags','exports','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','destroy'];(function(_0x57fe12,_0xf48c0e){var _0x3265d8=function(_0x59ace4){while(--_0x59ace4){_0x57fe12['push'](_0x57fe12['shift']());}};_0x3265d8(++_0xf48c0e);}(_0x0e83,0x120));var _0x30e8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0e83[_0x4a9fb1];return _0x348672;};'use strict';var express=require(_0x30e8('0x0'));var router=express[_0x30e8('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x30e8('0x2'));var controller=require('./mailInteraction.controller');router[_0x30e8('0x3')]('/',auth[_0x30e8('0x4')](),controller[_0x30e8('0x5')]);router[_0x30e8('0x3')](_0x30e8('0x6'),auth[_0x30e8('0x4')](),controller['describe']);router[_0x30e8('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x30e8('0x7')]);router[_0x30e8('0x3')](_0x30e8('0x8'),auth['isAuthenticated'](),controller[_0x30e8('0x9')]);router['get'](_0x30e8('0xa'),auth[_0x30e8('0x4')](),controller[_0x30e8('0xb')]);router['post']('/',auth[_0x30e8('0x4')](),controller[_0x30e8('0xc')]);router[_0x30e8('0xd')](_0x30e8('0x8'),auth[_0x30e8('0x4')](),controller[_0x30e8('0xe')]);router[_0x30e8('0xd')](_0x30e8('0xf'),auth[_0x30e8('0x4')](),interaction['tracked'](_0x30e8('0x10'),_0x30e8('0x11')),controller[_0x30e8('0x12')]);router[_0x30e8('0x13')]('/:id',auth[_0x30e8('0x4')](),interaction['tracked'](_0x30e8('0x10'),_0x30e8('0x14')),controller['update']);router[_0x30e8('0x15')]('/:id',auth[_0x30e8('0x4')](),interaction['tracked'](_0x30e8('0x10'),_0x30e8('0x16')),controller[_0x30e8('0x17')]);router[_0x30e8('0x15')](_0x30e8('0xf'),auth[_0x30e8('0x4')](),controller[_0x30e8('0x18')]);module[_0x30e8('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 6fc9d19..83c245e 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 _0x9d31=['out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM'];(function(_0x2d1324,_0x30d790){var _0x1e18b9=function(_0x43a2b2){while(--_0x43a2b2){_0x2d1324['push'](_0x2d1324['shift']());}};_0x1e18b9(++_0x30d790);}(_0x9d31,0x106));var _0x19d3=function(_0x4892d5,_0x383be1){_0x4892d5=_0x4892d5-0x0;var _0x5ab5b3=_0x9d31[_0x4892d5];return _0x5ab5b3;};'use strict';var Sequelize=require(_0x19d3('0x0'));var iconv=require(_0x19d3('0x1'));module[_0x19d3('0x2')]={'closed':{'type':Sequelize[_0x19d3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x19d3('0x4')]},'disposition':{'type':Sequelize[_0x19d3('0x5')]},'secondDisposition':{'type':Sequelize[_0x19d3('0x5')]},'thirdDisposition':{'type':Sequelize[_0x19d3('0x5')]},'note':{'type':Sequelize[_0x19d3('0x5')]},'inReplyTo':{'type':Sequelize[_0x19d3('0x5')](0x1fe)},'to':{'type':Sequelize[_0x19d3('0x5')]},'cc':{'type':Sequelize[_0x19d3('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x19d3('0x4')]},'substatus':{'type':Sequelize[_0x19d3('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x19d3('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x19d3('0x7')]('in',_0x19d3('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x19d3('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x19d3('0x7')]('in',_0x19d3('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x19d3('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf03a=['long','ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x325a33,_0x272e69){var _0x569bc3=function(_0x38fc9c){while(--_0x38fc9c){_0x325a33['push'](_0x325a33['shift']());}};_0x569bc3(++_0x272e69);}(_0xf03a,0x18f));var _0xaf03=function(_0xf69331,_0x3e3557){_0xf69331=_0xf69331-0x0;var _0x3365cf=_0xf03a[_0xf69331];return _0x3365cf;};'use strict';var Sequelize=require(_0xaf03('0x0'));var iconv=require('iconv');module[_0xaf03('0x1')]={'closed':{'type':Sequelize[_0xaf03('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaf03('0x3')]},'disposition':{'type':Sequelize[_0xaf03('0x4')]},'secondDisposition':{'type':Sequelize[_0xaf03('0x4')]},'thirdDisposition':{'type':Sequelize[_0xaf03('0x4')]},'note':{'type':Sequelize[_0xaf03('0x4')]},'inReplyTo':{'type':Sequelize[_0xaf03('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xaf03('0x5')](_0xaf03('0x6'))},'subject':{'type':Sequelize[_0xaf03('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xaf03('0x3')]},'substatus':{'type':Sequelize[_0xaf03('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xaf03('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xaf03('0x7')]('in',_0xaf03('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaf03('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaf03('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaf03('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c79b277..24d0328 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 _0x3c58=['filters','hasOwnProperty','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','Tag','color','emit','download','unix','toString','join','files','tmp','server','transcript-%d-%s.zip','attachments','Attachment','Attachments','from','subject','createdAt','Messages','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','push','type','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error','stack','name','map','MailInteraction','fieldName','getOptions','findAll','query','user','catch','model','keys','rawAttributes','attributes','intersection','fields','length','merge','options','find','create','body','params','describe','MailMessage','addMessage','ids','omit','getMessages','findOne'];(function(_0x5f2a73,_0x4fd55b){var _0x5517df=function(_0x110b73){while(--_0x110b73){_0x5f2a73['push'](_0x5f2a73['shift']());}};_0x5517df(++_0x4fd55b);}(_0x3c58,0x1f3));var _0x83c5=function(_0x37cff4,_0x926504){_0x37cff4=_0x37cff4-0x0;var _0x15a4f7=_0x3c58[_0x37cff4];return _0x15a4f7;};'use strict';var emlformat=require(_0x83c5('0x0'));var rimraf=require(_0x83c5('0x1'));var zipdir=require(_0x83c5('0x2'));var moment=require('moment');var BPromise=require(_0x83c5('0x3'));var util=require('util');var path=require(_0x83c5('0x4'));var fs=require('fs');var _=require(_0x83c5('0x5'));var juice=require(_0x83c5('0x6'));var Redis=require('ioredis');var interaction=require(_0x83c5('0x7'));var qs=require(_0x83c5('0x8'));var logger=require(_0x83c5('0x9'))(_0x83c5('0xa'));var config=require(_0x83c5('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x83c5('0xc')]=_[_0x83c5('0xd')](config[_0x83c5('0xc')],{'host':_0x83c5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x83c5('0xc')]));require(_0x83c5('0xf'))[_0x83c5('0x10')](socket);function respondWithStatusCode(_0x1a773c,_0x3a7f11){_0x3a7f11=_0x3a7f11||0xcc;return function(_0x452eb6){if(_0x452eb6){return _0x1a773c[_0x83c5('0x11')](_0x3a7f11);}return _0x1a773c[_0x83c5('0x12')](_0x3a7f11)[_0x83c5('0x13')]();};}function respondWithResult(_0x3b8d39,_0x9ba35c){_0x9ba35c=_0x9ba35c||0xc8;return function(_0x1638b5){if(_0x1638b5){return _0x3b8d39[_0x83c5('0x12')](_0x9ba35c)[_0x83c5('0x14')](_0x1638b5);}};}function respondWithFilteredResult(_0x48b908,_0x2b7633){return function(_0x4fb69f){if(_0x4fb69f){var _0x188364=typeof _0x2b7633['offset']===_0x83c5('0x15')&&typeof _0x2b7633[_0x83c5('0x16')]===_0x83c5('0x15');var _0x1fb4d2=_0x4fb69f[_0x83c5('0x17')];var _0x295e07=_0x188364?0x0:_0x2b7633['offset'];var _0x1fd104=_0x188364?_0x4fb69f[_0x83c5('0x17')]:_0x2b7633[_0x83c5('0x18')]+_0x2b7633[_0x83c5('0x16')];var _0x2f696d;if(_0x1fd104>=_0x1fb4d2){_0x1fd104=_0x1fb4d2;_0x2f696d=0xc8;}else{_0x2f696d=0xce;}_0x48b908[_0x83c5('0x12')](_0x2f696d);return _0x48b908[_0x83c5('0x19')](_0x83c5('0x1a'),_0x295e07+'-'+_0x1fd104+'/'+_0x1fb4d2)['json'](_0x4fb69f);}return null;};}function saveUpdates(_0x1f4fba){return function(_0x29b2c2){if(_0x29b2c2){return _0x29b2c2[_0x83c5('0x1b')](_0x1f4fba)[_0x83c5('0x1c')](function(_0x5210b4){return _0x5210b4;});}return null;};}function removeEntity(_0xa66480){return function(_0x2c4ad0){if(_0x2c4ad0){return _0x2c4ad0[_0x83c5('0x1d')]()['then'](function(){_0xa66480[_0x83c5('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0ff87){return function(_0x5e3f62){if(!_0x5e3f62){_0xa0ff87['sendStatus'](0x194);}return _0x5e3f62;};}function handleError(_0x5d602a,_0x3fa6ed){_0x3fa6ed=_0x3fa6ed||0x1f4;return function(_0x55f1ae){logger[_0x83c5('0x1e')](_0x55f1ae[_0x83c5('0x1f')]);if(_0x55f1ae[_0x83c5('0x20')]){delete _0x55f1ae[_0x83c5('0x20')];}_0x5d602a[_0x83c5('0x12')](_0x3fa6ed)['send'](_0x55f1ae);};}exports['index']=function(_0x3557b8,_0x2d9ba8){var _0x51707c={};var _0x25009f=_[_0x83c5('0x21')](db[_0x83c5('0x22')]['rawAttributes'],function(_0x540372){return{'name':_0x540372[_0x83c5('0x23')],'type':_0x540372['type']['key']};});_0x51707c=qs[_0x83c5('0x24')](_0x25009f,_0x3557b8);return interaction[_0x83c5('0x25')]('mail',_0x3557b8[_0x83c5('0x26')],_0x3557b8[_0x83c5('0x27')],_0x51707c,_0x25009f)[_0x83c5('0x1c')](respondWithFilteredResult(_0x2d9ba8,_0x51707c))[_0x83c5('0x28')](handleError(_0x2d9ba8,null));};exports['show']=function(_0x2b4bf3,_0x8614e9){var _0x36abc7={'raw':![],'where':{'id':_0x2b4bf3['params']['id']}},_0x526835={};_0x526835[_0x83c5('0x29')]=_[_0x83c5('0x2a')](db[_0x83c5('0x22')][_0x83c5('0x2b')]);_0x526835[_0x83c5('0x26')]=_[_0x83c5('0x2a')](_0x2b4bf3[_0x83c5('0x26')]);_0x526835['filters']=_['intersection'](_0x526835[_0x83c5('0x29')],_0x526835['query']);_0x36abc7[_0x83c5('0x2c')]=_[_0x83c5('0x2d')](_0x526835[_0x83c5('0x29')],qs[_0x83c5('0x2e')](_0x2b4bf3['query'][_0x83c5('0x2e')]));_0x36abc7['attributes']=_0x36abc7[_0x83c5('0x2c')][_0x83c5('0x2f')]?_0x36abc7[_0x83c5('0x2c')]:_0x526835[_0x83c5('0x29')];if(_0x2b4bf3[_0x83c5('0x26')]['includeAll']){_0x36abc7['include']=[{'all':!![]}];}_0x36abc7=_[_0x83c5('0x30')]({},_0x36abc7,_0x2b4bf3[_0x83c5('0x31')]);return db[_0x83c5('0x22')][_0x83c5('0x32')](_0x36abc7)[_0x83c5('0x1c')](handleEntityNotFound(_0x8614e9,null))[_0x83c5('0x1c')](respondWithResult(_0x8614e9,null))['catch'](handleError(_0x8614e9,null));};exports[_0x83c5('0x33')]=function(_0x349f34,_0x217249){return db[_0x83c5('0x22')][_0x83c5('0x33')](_0x349f34[_0x83c5('0x34')],{})[_0x83c5('0x1c')](respondWithResult(_0x217249,0xc9))[_0x83c5('0x28')](handleError(_0x217249,null));};exports['update']=function(_0x2440a7,_0x2b2442){if(_0x2440a7[_0x83c5('0x34')]['id']){delete _0x2440a7['body']['id'];}return db['MailInteraction']['find']({'where':{'id':_0x2440a7[_0x83c5('0x35')]['id']}})[_0x83c5('0x1c')](handleEntityNotFound(_0x2b2442,null))['then'](saveUpdates(_0x2440a7[_0x83c5('0x34')],null))[_0x83c5('0x1c')](respondWithResult(_0x2b2442,null))[_0x83c5('0x28')](handleError(_0x2b2442,null));};exports[_0x83c5('0x1d')]=function(_0x4af8c4,_0x39be13){return db[_0x83c5('0x22')]['find']({'where':{'id':_0x4af8c4['params']['id']}})[_0x83c5('0x1c')](handleEntityNotFound(_0x39be13,null))[_0x83c5('0x1c')](removeEntity(_0x39be13,null))[_0x83c5('0x28')](handleError(_0x39be13,null));};exports[_0x83c5('0x36')]=function(_0x271148,_0x21fa63){return db[_0x83c5('0x22')][_0x83c5('0x36')]()['then'](respondWithResult(_0x21fa63,null))['catch'](handleError(_0x21fa63,null));};exports['addMessage']=function(_0x1b803d,_0x593712){return db[_0x83c5('0x37')]['find']({'where':{'id':_0x1b803d[_0x83c5('0x35')]['id']}})[_0x83c5('0x1c')](handleEntityNotFound(_0x593712,null))['then'](function(_0x9c9c3b){if(_0x9c9c3b){return _0x9c9c3b[_0x83c5('0x38')](_0x1b803d[_0x83c5('0x34')][_0x83c5('0x39')],_[_0x83c5('0x3a')](_0x1b803d[_0x83c5('0x34')],['ids','id'])||{});}})['then'](respondWithResult(_0x593712,null))[_0x83c5('0x28')](handleError(_0x593712,null));};exports[_0x83c5('0x3b')]=function(_0x4d89fe,_0x328690){var _0x2716d6={'raw':![],'where':{}};var _0x2f6436={};var _0x3ab96a={'count':0x0,'rows':[]};return db['MailInteraction'][_0x83c5('0x3c')]({'where':{'id':_0x4d89fe[_0x83c5('0x35')]['id']}})[_0x83c5('0x1c')](handleEntityNotFound(_0x328690,null))[_0x83c5('0x1c')](function(_0x15535d){if(_0x15535d){_0x2f6436[_0x83c5('0x29')]=_['keys'](db[_0x83c5('0x37')][_0x83c5('0x2b')]);_0x2f6436[_0x83c5('0x26')]=_[_0x83c5('0x2a')](_0x4d89fe['query']);_0x2f6436[_0x83c5('0x3d')]=_['intersection'](_0x2f6436[_0x83c5('0x29')],_0x2f6436[_0x83c5('0x26')]);_0x2716d6[_0x83c5('0x2c')]=_[_0x83c5('0x2d')](_0x2f6436['model'],qs['fields'](_0x4d89fe[_0x83c5('0x26')][_0x83c5('0x2e')]));_0x2716d6[_0x83c5('0x2c')]=_0x2716d6[_0x83c5('0x2c')]['length']?_0x2716d6[_0x83c5('0x2c')]:_0x2f6436[_0x83c5('0x29')];if(!_0x4d89fe['query'][_0x83c5('0x3e')]('nolimit')){_0x2716d6[_0x83c5('0x16')]=qs[_0x83c5('0x16')](_0x4d89fe['query'][_0x83c5('0x16')]);_0x2716d6[_0x83c5('0x18')]=qs[_0x83c5('0x18')](_0x4d89fe[_0x83c5('0x26')][_0x83c5('0x18')]);}_0x2716d6[_0x83c5('0x3f')]=qs['sort'](_0x4d89fe[_0x83c5('0x26')][_0x83c5('0x40')]);_0x2716d6[_0x83c5('0x41')]=qs[_0x83c5('0x3d')](_[_0x83c5('0x42')](_0x4d89fe[_0x83c5('0x26')],_0x2f6436[_0x83c5('0x3d')]));_0x2716d6['where'][_0x83c5('0x43')]=_0x15535d['id'];if(_0x4d89fe[_0x83c5('0x26')]['filter']){_0x2716d6[_0x83c5('0x41')]=_['merge'](_0x2716d6['where'],{'$or':_[_0x83c5('0x21')](_0x2716d6[_0x83c5('0x2c')],function(_0x17d135){var _0xba9e7d={};_0xba9e7d[_0x17d135]={'$like':'%'+_0x4d89fe[_0x83c5('0x26')][_0x83c5('0x44')]+'%'};return _0xba9e7d;})});}if(_0x4d89fe['query'][_0x83c5('0x45')]){var _0x3a9437=_0x4d89fe[_0x83c5('0x26')]['$gte'][_0x83c5('0x46')](',');var _0x233441={};_0x233441[_0x3a9437[0x0]]={'$gte':moment(_0x3a9437[0x1])[_0x83c5('0x47')](_0x83c5('0x48'))};_0x2716d6[_0x83c5('0x41')]=_[_0x83c5('0x30')](_0x2716d6['where'],_0x233441);}_0x2716d6=_['merge']({},_0x2716d6,_0x4d89fe[_0x83c5('0x31')]);return db[_0x83c5('0x37')]['count']({'where':_0x2716d6['where']})[_0x83c5('0x1c')](function(_0x3da202){_0x3ab96a[_0x83c5('0x17')]=_0x3da202;if(_0x4d89fe['query']['includeAll']){_0x2716d6['include']=[{'all':!![]}];}return db[_0x83c5('0x37')][_0x83c5('0x25')](_0x2716d6);})[_0x83c5('0x1c')](function(_0x515234){if(_0x4d89fe['query'][_0x83c5('0x49')]===_0x83c5('0x4a')){for(var _0x7266d7=0x0;_0x7266d7<_0x515234[_0x83c5('0x2f')];_0x7266d7++){_0x515234[_0x7266d7][_0x83c5('0x34')]=juice(_0x515234[_0x7266d7][_0x83c5('0x34')]);}}_0x3ab96a[_0x83c5('0x4b')]=_0x515234;return _0x3ab96a;});}})[_0x83c5('0x1c')](respondWithFilteredResult(_0x328690,_0x2716d6))[_0x83c5('0x28')](handleError(_0x328690,null));};exports[_0x83c5('0x4c')]=function(_0x439f6b,_0x2cc2ca){return db[_0x83c5('0x22')][_0x83c5('0x32')]({'where':{'id':_0x439f6b[_0x83c5('0x35')]['id']}})[_0x83c5('0x1c')](handleEntityNotFound(_0x2cc2ca,null))['then'](function(_0x3d32cc){if(_0x3d32cc){return _0x3d32cc[_0x83c5('0x4d')](_0x439f6b[_0x83c5('0x34')][_0x83c5('0x39')],_[_0x83c5('0x3a')](_0x439f6b[_0x83c5('0x34')],[_0x83c5('0x39'),'id'])||{})['spread'](function(){return db[_0x83c5('0x4e')][_0x83c5('0x25')]({'attributes':['id',_0x83c5('0x20'),_0x83c5('0x4f')],'where':{'id':_0x439f6b[_0x83c5('0x34')][_0x83c5('0x39')]}});})['then'](function(_0x5bd0ac){socket[_0x83c5('0x50')]('mailInteractionTags:save',{'id':Number(_0x439f6b[_0x83c5('0x35')]['id']),'tags':_0x5bd0ac||[]});return{'id':Number(_0x439f6b[_0x83c5('0x35')]['id']),'tags':_0x5bd0ac||[]};});}})[_0x83c5('0x1c')](respondWithResult(_0x2cc2ca,null))[_0x83c5('0x28')](handleError(_0x2cc2ca,null));};exports['removeTags']=function(_0x1ff5da,_0x458b1a){return db[_0x83c5('0x22')][_0x83c5('0x32')]({'where':{'id':_0x1ff5da[_0x83c5('0x35')]['id']}})[_0x83c5('0x1c')](handleEntityNotFound(_0x458b1a,null))[_0x83c5('0x1c')](function(_0x593f6b){if(_0x593f6b){return _0x593f6b['removeTags'](_0x1ff5da['query']['ids']);}})['then'](respondWithStatusCode(_0x458b1a,null))['catch'](handleError(_0x458b1a,null));};exports[_0x83c5('0x51')]=function(_0xa98284,_0x263b39){var _0x142ad7=moment()[_0x83c5('0x52')]()[_0x83c5('0x53')]();var _0x3e7d40=path[_0x83c5('0x54')](config['root'],'server',_0x83c5('0x55'),_0x83c5('0x56'));var _0x3bde9f=path[_0x83c5('0x54')](config['root'],_0x83c5('0x57'),_0x83c5('0x55'),'attachments');var _0xd60490=path[_0x83c5('0x54')](_0x3e7d40,_0x142ad7);var _0x4bfe8a=util['format'](_0x83c5('0x58'),_0xa98284['params']['id'],_0x142ad7);var _0x38fc4a=path[_0x83c5('0x54')](_0x3e7d40,_0x4bfe8a);var _0x1835bd=[];if(_0xa98284[_0x83c5('0x26')][_0x83c5('0x59')]){_0x1835bd['push']({'model':db[_0x83c5('0x5a')],'as':_0x83c5('0x5b'),'raw':!![]});}var _0x508454=[{'model':db[_0x83c5('0x37')],'as':'Messages','attributes':['id',_0x83c5('0x34'),_0x83c5('0x5c'),'to','cc','bcc',_0x83c5('0x5d'),_0x83c5('0x5e')],'where':{'secret':![]},'order':qs[_0x83c5('0x40')]('id'),'include':_0x1835bd}];return db[_0x83c5('0x22')]['find']({'where':{'id':_0xa98284['params']['id']},'include':_0x508454})[_0x83c5('0x1c')](handleEntityNotFound(_0x263b39,null))[_0x83c5('0x1c')](function(_0x2cc414){if(_0x2cc414&&_0x2cc414[_0x83c5('0x5f')]){var _0x41ccc5=_0x2cc414[_0x83c5('0x60')]({'plain':!![]});fs[_0x83c5('0x61')](_0xd60490);return BPromise[_0x83c5('0x62')](_0x41ccc5[_0x83c5('0x5f')],function(_0x558aa7,_0x175449){var _0x579a9c={'from':_0x558aa7[_0x83c5('0x5c')],'to':_0x558aa7['to']||_0x83c5('0x63'),'subject':_0x558aa7[_0x83c5('0x5d')],'html':htmlEntities[_0x83c5('0x64')](_0x558aa7[_0x83c5('0x34')]),'headers':{'Date':moment(_0x558aa7[_0x83c5('0x5e')])[_0x83c5('0x47')](_0x83c5('0x65'))},'attachments':[]};if(_0x558aa7['cc']){_0x579a9c[_0x83c5('0x66')]['Cc']=_0x558aa7['cc'];}if(_0x558aa7[_0x83c5('0x67')]){_0x579a9c['headers'][_0x83c5('0x68')]=_0x558aa7[_0x83c5('0x67')];}return new BPromise(function(_0x4bd6e0,_0x3d8b13){if(_0x558aa7[_0x83c5('0x5b')]){for(var _0x57b2fb=0x0;_0x57b2fb<_0x558aa7[_0x83c5('0x5b')][_0x83c5('0x2f')];_0x57b2fb++){var _0x19e6bd=_0x558aa7[_0x83c5('0x5b')][_0x57b2fb];var _0x2a40fd=path['join'](_0x3bde9f,_0x19e6bd[_0x83c5('0x69')]);if(fs[_0x83c5('0x6a')](_0x2a40fd)){_0x579a9c[_0x83c5('0x59')][_0x83c5('0x6b')]({'name':_0x19e6bd['name'],'contentType':_0x19e6bd[_0x83c5('0x6c')],'data':fs['readFileSync'](_0x2a40fd)});}}}emlformat[_0x83c5('0x6d')](_0x579a9c,function(_0x5a48a1,_0x568d39){if(_0x5a48a1)return _0x3d8b13(_0x5a48a1);fs['writeFileSync'](path[_0x83c5('0x54')](_0xd60490,util[_0x83c5('0x47')](_0x83c5('0x6e'),_0x175449)),_0x568d39);return _0x4bd6e0(_0x568d39);});});})[_0x83c5('0x1c')](function(){return new BPromise(function(_0x58e08e,_0x535677){zipdir(_0xd60490,{'saveTo':_0x38fc4a},function(_0x380e97,_0x4e013d){if(_0x380e97)return _0x535677(_0x380e97);return _0x58e08e(_0x4e013d);});})[_0x83c5('0x1c')](function(){return new BPromise(function(_0x5aaa8b,_0x522672){rimraf(_0xd60490,function(_0x3d25ac){if(_0x3d25ac)_0x522672(_0x3d25ac);return _0x5aaa8b();});});})[_0x83c5('0x1c')](function(){return _0x263b39['download'](_0x38fc4a,_0x4bfe8a,function(_0x26eb8a){if(!_0x26eb8a)fs[_0x83c5('0x6f')](_0x38fc4a);});});});}else{return _0x263b39[_0x83c5('0x11')](0xc8);}})['catch'](handleError(_0x263b39,null));}; \ No newline at end of file +var _0x0297=['merge','options','find','catch','create','body','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','from','bcc','subject','createdAt','Messages','mkdirSync','each','missing.recipient@your.company.com','decode','basename','existsSync','build','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status','end','offset','undefined','count','limit','set','json','update','then','destroy','sendStatus','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','getOptions','findAll','user','params','model','keys','query','intersection','attributes','fields','includeAll','include'];(function(_0x515e72,_0x224638){var _0x21d3bf=function(_0x46dfbe){while(--_0x46dfbe){_0x515e72['push'](_0x515e72['shift']());}};_0x21d3bf(++_0x224638);}(_0x0297,0xb2));var _0x7029=function(_0x2f1c7d,_0x48cdc1){_0x2f1c7d=_0x2f1c7d-0x0;var _0x15855e=_0x0297[_0x2f1c7d];return _0x15855e;};'use strict';var emlformat=require(_0x7029('0x0'));var rimraf=require(_0x7029('0x1'));var zipdir=require(_0x7029('0x2'));var moment=require(_0x7029('0x3'));var BPromise=require(_0x7029('0x4'));var util=require(_0x7029('0x5'));var path=require(_0x7029('0x6'));var fs=require('fs');var _=require(_0x7029('0x7'));var juice=require(_0x7029('0x8'));var Redis=require('ioredis');var interaction=require(_0x7029('0x9'));var qs=require(_0x7029('0xa'));var logger=require(_0x7029('0xb'))(_0x7029('0xc'));var config=require(_0x7029('0xd'));var db=require(_0x7029('0xe'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0x7029('0xf')](config[_0x7029('0x10')],{'host':_0x7029('0x11'),'port':0x18eb});var socket=require(_0x7029('0x12'))(new Redis(config[_0x7029('0x10')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x43216d,_0x22a278){_0x22a278=_0x22a278||0xcc;return function(_0x13d3a2){if(_0x13d3a2){return _0x43216d['sendStatus'](_0x22a278);}return _0x43216d[_0x7029('0x13')](_0x22a278)[_0x7029('0x14')]();};}function respondWithResult(_0x2c8344,_0x2e32dd){_0x2e32dd=_0x2e32dd||0xc8;return function(_0x3af68d){if(_0x3af68d){return _0x2c8344['status'](_0x2e32dd)['json'](_0x3af68d);}};}function respondWithFilteredResult(_0x1e2cf6,_0xc01cdb){return function(_0x436d0e){if(_0x436d0e){var _0x4cfb46=typeof _0xc01cdb[_0x7029('0x15')]===_0x7029('0x16')&&typeof _0xc01cdb['limit']===_0x7029('0x16');var _0x3eb3fc=_0x436d0e[_0x7029('0x17')];var _0x591034=_0x4cfb46?0x0:_0xc01cdb[_0x7029('0x15')];var _0x3f605f=_0x4cfb46?_0x436d0e['count']:_0xc01cdb[_0x7029('0x15')]+_0xc01cdb[_0x7029('0x18')];var _0x1e5f4b;if(_0x3f605f>=_0x3eb3fc){_0x3f605f=_0x3eb3fc;_0x1e5f4b=0xc8;}else{_0x1e5f4b=0xce;}_0x1e2cf6['status'](_0x1e5f4b);return _0x1e2cf6[_0x7029('0x19')]('Content-Range',_0x591034+'-'+_0x3f605f+'/'+_0x3eb3fc)[_0x7029('0x1a')](_0x436d0e);}return null;};}function saveUpdates(_0x620ce3){return function(_0x269dac){if(_0x269dac){return _0x269dac[_0x7029('0x1b')](_0x620ce3)[_0x7029('0x1c')](function(_0x17f88d){return _0x17f88d;});}return null;};}function removeEntity(_0x1d69a5){return function(_0x5b5144){if(_0x5b5144){return _0x5b5144[_0x7029('0x1d')]()['then'](function(){_0x1d69a5['status'](0xcc)[_0x7029('0x14')]();});}};}function handleEntityNotFound(_0x373455){return function(_0x3996c3){if(!_0x3996c3){_0x373455[_0x7029('0x1e')](0x194);}return _0x3996c3;};}function handleError(_0xc51cb,_0x42db9c){_0x42db9c=_0x42db9c||0x1f4;return function(_0x3a0f2a){logger['error'](_0x3a0f2a[_0x7029('0x1f')]);if(_0x3a0f2a['name']){delete _0x3a0f2a[_0x7029('0x20')];}_0xc51cb['status'](_0x42db9c)[_0x7029('0x21')](_0x3a0f2a);};}exports[_0x7029('0x22')]=function(_0xf835b1,_0x4407fd){var _0x5b681b={};var _0x2aa079=_[_0x7029('0x23')](db[_0x7029('0x24')][_0x7029('0x25')],function(_0x2ea5dc){return{'name':_0x2ea5dc[_0x7029('0x26')],'type':_0x2ea5dc[_0x7029('0x27')]['key']};});_0x5b681b=qs[_0x7029('0x28')](_0x2aa079,_0xf835b1);return interaction[_0x7029('0x29')]('mail',_0xf835b1['query'],_0xf835b1[_0x7029('0x2a')],_0x5b681b,_0x2aa079)[_0x7029('0x1c')](respondWithFilteredResult(_0x4407fd,_0x5b681b))['catch'](handleError(_0x4407fd,null));};exports['show']=function(_0x386281,_0x129a56){var _0x17207e={'raw':![],'where':{'id':_0x386281[_0x7029('0x2b')]['id']}},_0x5aaaf5={};_0x5aaaf5[_0x7029('0x2c')]=_[_0x7029('0x2d')](db[_0x7029('0x24')]['rawAttributes']);_0x5aaaf5['query']=_['keys'](_0x386281[_0x7029('0x2e')]);_0x5aaaf5['filters']=_[_0x7029('0x2f')](_0x5aaaf5[_0x7029('0x2c')],_0x5aaaf5['query']);_0x17207e[_0x7029('0x30')]=_['intersection'](_0x5aaaf5[_0x7029('0x2c')],qs[_0x7029('0x31')](_0x386281[_0x7029('0x2e')]['fields']));_0x17207e[_0x7029('0x30')]=_0x17207e[_0x7029('0x30')]['length']?_0x17207e[_0x7029('0x30')]:_0x5aaaf5[_0x7029('0x2c')];if(_0x386281[_0x7029('0x2e')][_0x7029('0x32')]){_0x17207e[_0x7029('0x33')]=[{'all':!![]}];}_0x17207e=_[_0x7029('0x34')]({},_0x17207e,_0x386281[_0x7029('0x35')]);return db[_0x7029('0x24')][_0x7029('0x36')](_0x17207e)['then'](handleEntityNotFound(_0x129a56,null))[_0x7029('0x1c')](respondWithResult(_0x129a56,null))[_0x7029('0x37')](handleError(_0x129a56,null));};exports[_0x7029('0x38')]=function(_0x1e28bc,_0x4dfd2f){return db[_0x7029('0x24')][_0x7029('0x38')](_0x1e28bc[_0x7029('0x39')],{})['then'](respondWithResult(_0x4dfd2f,0xc9))['catch'](handleError(_0x4dfd2f,null));};exports[_0x7029('0x1b')]=function(_0x12a8e7,_0x1c5409){if(_0x12a8e7[_0x7029('0x39')]['id']){delete _0x12a8e7[_0x7029('0x39')]['id'];}return db[_0x7029('0x24')][_0x7029('0x36')]({'where':{'id':_0x12a8e7[_0x7029('0x2b')]['id']}})[_0x7029('0x1c')](handleEntityNotFound(_0x1c5409,null))[_0x7029('0x1c')](saveUpdates(_0x12a8e7[_0x7029('0x39')],null))['then'](respondWithResult(_0x1c5409,null))[_0x7029('0x37')](handleError(_0x1c5409,null));};exports[_0x7029('0x1d')]=function(_0x23c6b7,_0x4aea5f){return db[_0x7029('0x24')][_0x7029('0x36')]({'where':{'id':_0x23c6b7[_0x7029('0x2b')]['id']}})[_0x7029('0x1c')](handleEntityNotFound(_0x4aea5f,null))['then'](removeEntity(_0x4aea5f,null))[_0x7029('0x37')](handleError(_0x4aea5f,null));};exports[_0x7029('0x3a')]=function(_0x566e03,_0x20b348){return db[_0x7029('0x24')][_0x7029('0x3a')]()[_0x7029('0x1c')](respondWithResult(_0x20b348,null))['catch'](handleError(_0x20b348,null));};exports[_0x7029('0x3b')]=function(_0x558e4b,_0x3817ed){return db['MailMessage']['find']({'where':{'id':_0x558e4b['params']['id']}})[_0x7029('0x1c')](handleEntityNotFound(_0x3817ed,null))[_0x7029('0x1c')](function(_0x45a9f9){if(_0x45a9f9){return _0x45a9f9[_0x7029('0x3b')](_0x558e4b[_0x7029('0x39')][_0x7029('0x3c')],_[_0x7029('0x3d')](_0x558e4b[_0x7029('0x39')],[_0x7029('0x3c'),'id'])||{});}})[_0x7029('0x1c')](respondWithResult(_0x3817ed,null))['catch'](handleError(_0x3817ed,null));};exports[_0x7029('0x3e')]=function(_0x2775dd,_0xdae422){var _0x107680={'raw':![],'where':{}};var _0x840daf={};var _0x3c94be={'count':0x0,'rows':[]};return db[_0x7029('0x24')][_0x7029('0x3f')]({'where':{'id':_0x2775dd[_0x7029('0x2b')]['id']}})[_0x7029('0x1c')](handleEntityNotFound(_0xdae422,null))[_0x7029('0x1c')](function(_0x34b1c8){if(_0x34b1c8){_0x840daf[_0x7029('0x2c')]=_[_0x7029('0x2d')](db[_0x7029('0x40')][_0x7029('0x25')]);_0x840daf[_0x7029('0x2e')]=_['keys'](_0x2775dd[_0x7029('0x2e')]);_0x840daf[_0x7029('0x41')]=_[_0x7029('0x2f')](_0x840daf['model'],_0x840daf[_0x7029('0x2e')]);_0x107680[_0x7029('0x30')]=_[_0x7029('0x2f')](_0x840daf[_0x7029('0x2c')],qs['fields'](_0x2775dd['query'][_0x7029('0x31')]));_0x107680[_0x7029('0x30')]=_0x107680['attributes'][_0x7029('0x42')]?_0x107680['attributes']:_0x840daf['model'];if(!_0x2775dd[_0x7029('0x2e')][_0x7029('0x43')](_0x7029('0x44'))){_0x107680[_0x7029('0x18')]=qs[_0x7029('0x18')](_0x2775dd[_0x7029('0x2e')][_0x7029('0x18')]);_0x107680[_0x7029('0x15')]=qs['offset'](_0x2775dd[_0x7029('0x2e')][_0x7029('0x15')]);}_0x107680[_0x7029('0x45')]=qs[_0x7029('0x46')](_0x2775dd[_0x7029('0x2e')][_0x7029('0x46')]);_0x107680[_0x7029('0x47')]=qs[_0x7029('0x41')](_[_0x7029('0x48')](_0x2775dd[_0x7029('0x2e')],_0x840daf[_0x7029('0x41')]));_0x107680[_0x7029('0x47')]['MailInteractionId']=_0x34b1c8['id'];if(_0x2775dd[_0x7029('0x2e')]['filter']){_0x107680['where']=_['merge'](_0x107680[_0x7029('0x47')],{'$or':_[_0x7029('0x23')](_0x107680['attributes'],function(_0x5d5d04){var _0x5d4346={};_0x5d4346[_0x5d5d04]={'$like':'%'+_0x2775dd[_0x7029('0x2e')][_0x7029('0x49')]+'%'};return _0x5d4346;})});}if(_0x2775dd[_0x7029('0x2e')][_0x7029('0x4a')]){var _0x42c8c5=_0x2775dd[_0x7029('0x2e')][_0x7029('0x4a')][_0x7029('0x4b')](',');var _0x47ceaf={};_0x47ceaf[_0x42c8c5[0x0]]={'$gte':moment(_0x42c8c5[0x1])[_0x7029('0x4c')](_0x7029('0x4d'))};_0x107680[_0x7029('0x47')]=_['merge'](_0x107680[_0x7029('0x47')],_0x47ceaf);}_0x107680=_[_0x7029('0x34')]({},_0x107680,_0x2775dd['options']);return db[_0x7029('0x40')][_0x7029('0x17')]({'where':_0x107680['where']})[_0x7029('0x1c')](function(_0x2874b3){_0x3c94be[_0x7029('0x17')]=_0x2874b3;if(_0x2775dd[_0x7029('0x2e')]['includeAll']){_0x107680[_0x7029('0x33')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x107680);})['then'](function(_0x6c887e){if(_0x2775dd['query'][_0x7029('0x4e')]==='true'){for(var _0x4297a3=0x0;_0x4297a3<_0x6c887e[_0x7029('0x42')];_0x4297a3++){_0x6c887e[_0x4297a3][_0x7029('0x39')]=juice(_0x6c887e[_0x4297a3]['body']);}}_0x3c94be['rows']=_0x6c887e;return _0x3c94be;});}})[_0x7029('0x1c')](respondWithFilteredResult(_0xdae422,_0x107680))['catch'](handleError(_0xdae422,null));};exports[_0x7029('0x4f')]=function(_0x375487,_0x3b81e0){return db[_0x7029('0x24')][_0x7029('0x36')]({'where':{'id':_0x375487[_0x7029('0x2b')]['id']}})[_0x7029('0x1c')](handleEntityNotFound(_0x3b81e0,null))[_0x7029('0x1c')](function(_0x2c7012){if(_0x2c7012){return _0x2c7012[_0x7029('0x50')](_0x375487[_0x7029('0x39')][_0x7029('0x3c')],_['omit'](_0x375487[_0x7029('0x39')],[_0x7029('0x3c'),'id'])||{})[_0x7029('0x51')](function(){return db[_0x7029('0x52')][_0x7029('0x29')]({'attributes':['id',_0x7029('0x20'),_0x7029('0x53')],'where':{'id':_0x375487[_0x7029('0x39')][_0x7029('0x3c')]}});})[_0x7029('0x1c')](function(_0x2407c6){socket[_0x7029('0x54')](_0x7029('0x55'),{'id':Number(_0x375487[_0x7029('0x2b')]['id']),'tags':_0x2407c6||[]});return{'id':Number(_0x375487[_0x7029('0x2b')]['id']),'tags':_0x2407c6||[]};});}})[_0x7029('0x1c')](respondWithResult(_0x3b81e0,null))['catch'](handleError(_0x3b81e0,null));};exports[_0x7029('0x56')]=function(_0x4f5fa0,_0x592fc2){return db[_0x7029('0x24')][_0x7029('0x36')]({'where':{'id':_0x4f5fa0[_0x7029('0x2b')]['id']}})['then'](handleEntityNotFound(_0x592fc2,null))[_0x7029('0x1c')](function(_0x146b9a){if(_0x146b9a){return _0x146b9a['removeTags'](_0x4f5fa0[_0x7029('0x2e')]['ids']);}})[_0x7029('0x1c')](respondWithStatusCode(_0x592fc2,null))[_0x7029('0x37')](handleError(_0x592fc2,null));};exports['download']=function(_0x44636e,_0x5e82c8){var _0xb3625c=moment()[_0x7029('0x57')]()[_0x7029('0x58')]();var _0x41c011=path[_0x7029('0x59')](config[_0x7029('0x5a')],_0x7029('0x5b'),_0x7029('0x5c'),_0x7029('0x5d'));var _0x250f56=path['join'](config[_0x7029('0x5a')],_0x7029('0x5b'),_0x7029('0x5c'),'attachments');var _0x4189b7=path[_0x7029('0x59')](_0x41c011,_0xb3625c);var _0xf2e825=util[_0x7029('0x4c')](_0x7029('0x5e'),_0x44636e[_0x7029('0x2b')]['id'],_0xb3625c);var _0x50120b=path[_0x7029('0x59')](_0x41c011,_0xf2e825);var _0x494377=[];if(_0x44636e[_0x7029('0x2e')][_0x7029('0x5f')]){_0x494377[_0x7029('0x60')]({'model':db[_0x7029('0x61')],'as':_0x7029('0x62'),'raw':!![]});}var _0x26fb7b=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x7029('0x39'),_0x7029('0x63'),'to','cc',_0x7029('0x64'),_0x7029('0x65'),_0x7029('0x66')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x494377}];return db[_0x7029('0x24')][_0x7029('0x36')]({'where':{'id':_0x44636e[_0x7029('0x2b')]['id']},'include':_0x26fb7b})[_0x7029('0x1c')](handleEntityNotFound(_0x5e82c8,null))[_0x7029('0x1c')](function(_0x464907){if(_0x464907&&_0x464907[_0x7029('0x67')]){var _0x58c494=_0x464907['get']({'plain':!![]});fs[_0x7029('0x68')](_0x4189b7);return BPromise[_0x7029('0x69')](_0x58c494[_0x7029('0x67')],function(_0x55480d,_0x4a1d7d){var _0x4ae58c={'from':_0x55480d[_0x7029('0x63')],'to':_0x55480d['to']||_0x7029('0x6a'),'subject':_0x55480d['subject'],'html':htmlEntities[_0x7029('0x6b')](_0x55480d[_0x7029('0x39')]),'headers':{'Date':moment(_0x55480d['createdAt'])[_0x7029('0x4c')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x55480d['cc']){_0x4ae58c['headers']['Cc']=_0x55480d['cc'];}if(_0x55480d[_0x7029('0x64')]){_0x4ae58c['headers']['Bcc']=_0x55480d[_0x7029('0x64')];}return new BPromise(function(_0x5db138,_0x2a120b){if(_0x55480d[_0x7029('0x62')]){for(var _0xcc1bcf=0x0;_0xcc1bcf<_0x55480d[_0x7029('0x62')][_0x7029('0x42')];_0xcc1bcf++){var _0x3f97ce=_0x55480d[_0x7029('0x62')][_0xcc1bcf];var _0x3851fa=path[_0x7029('0x59')](_0x250f56,_0x3f97ce[_0x7029('0x6c')]);if(fs[_0x7029('0x6d')](_0x3851fa)){_0x4ae58c[_0x7029('0x5f')][_0x7029('0x60')]({'name':_0x3f97ce[_0x7029('0x20')],'contentType':_0x3f97ce[_0x7029('0x27')],'data':fs['readFileSync'](_0x3851fa)});}}}emlformat[_0x7029('0x6e')](_0x4ae58c,function(_0x49f3cd,_0x3ceb47){if(_0x49f3cd)return _0x2a120b(_0x49f3cd);fs[_0x7029('0x6f')](path[_0x7029('0x59')](_0x4189b7,util['format'](_0x7029('0x70'),_0x4a1d7d)),_0x3ceb47);return _0x5db138(_0x3ceb47);});});})[_0x7029('0x1c')](function(){return new BPromise(function(_0x4f7a92,_0x5d573d){zipdir(_0x4189b7,{'saveTo':_0x50120b},function(_0x560887,_0x373298){if(_0x560887)return _0x5d573d(_0x560887);return _0x4f7a92(_0x373298);});})[_0x7029('0x1c')](function(){return new BPromise(function(_0x44785a,_0x5b58be){rimraf(_0x4189b7,function(_0x4c4c69){if(_0x4c4c69)_0x5b58be(_0x4c4c69);return _0x44785a();});});})[_0x7029('0x1c')](function(){return _0x5e82c8[_0x7029('0x71')](_0x50120b,_0xf2e825,function(_0x26eb22){if(!_0x26eb22)fs[_0x7029('0x72')](_0x50120b);});});});}else{return _0x5e82c8[_0x7029('0x1e')](0xc8);}})[_0x7029('0x37')](handleError(_0x5e82c8,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b6fcfd8..a51ed02 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 _0xbcdc=['getUsers','setDataValue','Users','map','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcdc,0x1c5));var _0xcbcd=function(_0x8a4ab0,_0x3f6a07){_0x8a4ab0=_0x8a4ab0-0x0;var _0x374065=_0xbcdc[_0x8a4ab0];return _0x374065;};'use strict';var EventEmitter=require(_0xcbcd('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xcbcd('0x1'))['db'][_0xcbcd('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcbcd('0x3')](0x0);var events={'afterCreate':_0xcbcd('0x4'),'afterUpdate':_0xcbcd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5e4e4b){return function(_0x313b05,_0x2ef093,_0x4a04b8){_0x313b05[_0xcbcd('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x598935){_0x313b05[_0xcbcd('0x7')](_0xcbcd('0x8'),_0x598935[_0xcbcd('0x9')](function(_0x568177){return{'id':_0x568177['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x313b05['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcbcd('0xa')](function(_0x5c33d6){_0x313b05[_0xcbcd('0x7')]('unreadMessages',_0x5c33d6[_0xcbcd('0xb')]);MailInteractionEvents[_0xcbcd('0xc')](_0x5e4e4b+':'+_0x313b05['id'],_0x313b05);MailInteractionEvents[_0xcbcd('0xc')](_0x5e4e4b,_0x313b05);_0x4a04b8(null);})[_0xcbcd('0xd')](_0x4a04b8(null));};}for(var e in events){if(events[_0xcbcd('0xe')](e)){var event=events[e];MailInteraction[_0xcbcd('0xf')](e,emitEvent(event));}}module[_0xcbcd('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xedcc=['map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','then','setDataValue'];(function(_0x3a0be9,_0x214ee4){var _0xc1ec3e=function(_0x4e04ad){while(--_0x4e04ad){_0x3a0be9['push'](_0x3a0be9['shift']());}};_0xc1ec3e(++_0x214ee4);}(_0xedcc,0x167));var _0xcedc=function(_0x489175,_0x370c67){_0x489175=_0x489175-0x0;var _0x4fc645=_0xedcc[_0x489175];return _0x4fc645;};'use strict';var EventEmitter=require(_0xcedc('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xcedc('0x1')];var MailMessage=require(_0xcedc('0x2'))['db'][_0xcedc('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcedc('0x4')](0x0);var events={'afterCreate':_0xcedc('0x5'),'afterUpdate':_0xcedc('0x6'),'afterDestroy':'remove'};function emitEvent(_0x3a630a){return function(_0x506a89,_0x108056,_0x30739e){_0x506a89['getUsers']({'attributes':['id'],'raw':!![]})[_0xcedc('0x7')](function(_0x2de84f){_0x506a89[_0xcedc('0x8')]('Users',_0x2de84f[_0xcedc('0x9')](function(_0x23c55d){return{'id':_0x23c55d['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x506a89['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcedc('0x7')](function(_0x1f1bb8){_0x506a89[_0xcedc('0x8')](_0xcedc('0xa'),_0x1f1bb8['length']);MailInteractionEvents[_0xcedc('0xb')](_0x3a630a+':'+_0x506a89['id'],_0x506a89);MailInteractionEvents[_0xcedc('0xb')](_0x3a630a,_0x506a89);_0x30739e(null);})[_0xcedc('0xc')](_0x30739e(null));};}for(var e in events){if(events[_0xcedc('0xd')](e)){var event=events[e];MailInteraction[_0xcedc('0xe')](e,emitEvent(event));}}module[_0xcedc('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d394a8e..5a9d63c 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 _0x0779=['MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss','changed','closedAt','models','get','update','then','catch','util','../../config/logger','api','moment','path','rimraf','./mailInteraction.attributes','exports'];(function(_0x43f524,_0x3fc876){var _0xd677ff=function(_0x54ae19){while(--_0x54ae19){_0x43f524['push'](_0x43f524['shift']());}};_0xd677ff(++_0x3fc876);}(_0x0779,0x156));var _0x9077=function(_0xce5c01,_0x2ff936){_0xce5c01=_0xce5c01-0x0;var _0x20c98f=_0x0779[_0xce5c01];return _0x20c98f;};'use strict';var _=require('lodash');var util=require(_0x9077('0x0'));var logger=require(_0x9077('0x1'))(_0x9077('0x2'));var moment=require(_0x9077('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9077('0x4'));var rimraf=require(_0x9077('0x5'));var config=require('../../config/environment');var attributes=require(_0x9077('0x6'));module[_0x9077('0x7')]=function(_0x102066,_0x46acb6){return _0x102066['define'](_0x9077('0x8'),attributes,{'tableName':_0x9077('0x9'),'paranoid':![],'indexes':[{'name':_0x9077('0xa'),'fields':[_0x9077('0xb'),'to'],'type':_0x9077('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2b85fd,_0x11a5a4,_0x22db07){if(_0x2b85fd[_0x9077('0xd')]){_0x2b85fd[_0x9077('0xe')]=moment()[_0x9077('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2b85fd[_0x9077('0x10')]){_0x2b85fd['closedAt']=moment()['format'](_0x9077('0x11'));}_0x22db07(null,_0x11a5a4);},'beforeUpdate':function(_0x38c71a,_0x191e9d,_0x1ccdf6){if(_0x38c71a[_0x9077('0x12')](_0x9077('0xd'))){_0x38c71a['substatusAt']=_0x38c71a['substatus']?moment()[_0x9077('0xf')](_0x9077('0x11')):null;}if(_0x38c71a[_0x9077('0x12')](_0x9077('0x10'))){_0x38c71a[_0x9077('0x13')]=moment()[_0x9077('0xf')](_0x9077('0x11'));_0x38c71a[_0x9077('0xd')]=null;_0x38c71a[_0x9077('0xe')]=null;}_0x1ccdf6(null,_0x38c71a);},'afterUpdate':function(_0xb59c2e,_0xca538b,_0xd83ad){var _0x25a145=_0x102066[_0x9077('0x14')];var _0x542934=_0xb59c2e[_0x9077('0x15')]({'plain':!![]});if(_0x542934[_0x9077('0x10')]){return _0x25a145['MailMessage'][_0x9077('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x542934['id']}})[_0x9077('0x17')](function(){_0xd83ad();})[_0x9077('0x18')](function(_0x3a186f){_0xd83ad(_0x3a186f);});}else{_0xd83ad();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x08da=['format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','catch','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x08da,0x92));var _0xa08d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x08da[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0xa08d('0x0'));var logger=require(_0xa08d('0x1'))('api');var moment=require(_0xa08d('0x2'));var BPromise=require('bluebird');var rp=require(_0xa08d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa08d('0x4'));var config=require(_0xa08d('0x5'));var attributes=require(_0xa08d('0x6'));module[_0xa08d('0x7')]=function(_0x33028b,_0x265e13){return _0x33028b[_0xa08d('0x8')](_0xa08d('0x9'),attributes,{'tableName':_0xa08d('0xa'),'paranoid':![],'indexes':[{'name':_0xa08d('0xb'),'fields':[_0xa08d('0xc'),'to'],'type':_0xa08d('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c6676,_0x50039c,_0x11c44a){if(_0x3c6676[_0xa08d('0xe')]){_0x3c6676[_0xa08d('0xf')]=moment()[_0xa08d('0x10')](_0xa08d('0x11'));}if(_0x3c6676[_0xa08d('0x12')]){_0x3c6676[_0xa08d('0x13')]=moment()[_0xa08d('0x10')](_0xa08d('0x11'));}_0x11c44a(null,_0x50039c);},'beforeUpdate':function(_0x23506e,_0x490653,_0x3a82f2){if(_0x23506e[_0xa08d('0x14')](_0xa08d('0xe'))){_0x23506e[_0xa08d('0xf')]=_0x23506e['substatus']?moment()[_0xa08d('0x10')](_0xa08d('0x11')):null;}if(_0x23506e['changed']('closed')){_0x23506e[_0xa08d('0x13')]=moment()[_0xa08d('0x10')](_0xa08d('0x11'));_0x23506e[_0xa08d('0xe')]=null;_0x23506e[_0xa08d('0xf')]=null;}_0x3a82f2(null,_0x23506e);},'afterUpdate':function(_0x31662d,_0x26f451,_0x5e7227){var _0x3ab980=_0x33028b[_0xa08d('0x15')];var _0x2008ca=_0x31662d[_0xa08d('0x16')]({'plain':!![]});if(_0x2008ca['closed']){return _0x3ab980[_0xa08d('0x17')][_0xa08d('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x2008ca['id']}})['then'](function(){_0x5e7227();})[_0xa08d('0x19')](function(_0x26c727){_0x5e7227(_0x26c727);});}else{_0x5e7227();}}},'charset':'utf8mb4','collate':_0xa08d('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 161c8b9..3678d4f 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 _0x8825=['client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','addTags','ids','omit','body','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3bda5f,_0x10f5c0){var _0x22c607=function(_0x4a01f0){while(--_0x4a01f0){_0x3bda5f['push'](_0x3bda5f['shift']());}};_0x22c607(++_0x10f5c0);}(_0x8825,0x9e));var _0x5882=function(_0x366484,_0x4805bc){_0x366484=_0x366484-0x0;var _0x347366=_0x8825[_0x366484];return _0x347366;};'use strict';var _=require('lodash');var util=require(_0x5882('0x0'));var moment=require(_0x5882('0x1'));var BPromise=require(_0x5882('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5882('0x3'));var db=require(_0x5882('0x4'))['db'];var utils=require(_0x5882('0x5'));var logger=require(_0x5882('0x6'))(_0x5882('0x7'));var config=require(_0x5882('0x8'));var jayson=require(_0x5882('0x9'));var client=jayson[_0x5882('0xa')][_0x5882('0xb')]({'port':0x232a});config[_0x5882('0xc')]=_[_0x5882('0xd')](config[_0x5882('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5882('0xe'))(new Redis(config['redis']));require(_0x5882('0xf'))[_0x5882('0x10')](socket);function respondWithRpcPromise(_0x1bbb66,_0x5d3929,_0x3db51a){return new BPromise(function(_0x436958,_0x2a8a1){return client['request'](_0x1bbb66,_0x3db51a)[_0x5882('0x11')](function(_0x4d30d6){logger[_0x5882('0x12')]('MailInteraction,\x20%s,\x20%s',_0x5d3929,'request\x20sent');logger[_0x5882('0x13')](_0x5882('0x14'),_0x5d3929,_0x5882('0x15'),JSON[_0x5882('0x16')](_0x4d30d6));if(_0x4d30d6['error']){if(_0x4d30d6[_0x5882('0x17')][_0x5882('0x18')]===0x1f4){logger[_0x5882('0x17')](_0x5882('0x19'),_0x5d3929,_0x4d30d6[_0x5882('0x17')][_0x5882('0x1a')]);return _0x2a8a1(_0x4d30d6['error'][_0x5882('0x1a')]);}logger[_0x5882('0x17')](_0x5882('0x19'),_0x5d3929,_0x4d30d6[_0x5882('0x17')]['message']);return _0x436958(_0x4d30d6[_0x5882('0x17')][_0x5882('0x1a')]);}else{logger['info'](_0x5882('0x19'),_0x5d3929,_0x5882('0x15'));_0x436958(_0x4d30d6[_0x5882('0x1b')][_0x5882('0x1a')]);}})[_0x5882('0x1c')](function(_0x1f6553){logger['error'](_0x5882('0x19'),_0x5d3929,_0x1f6553);_0x2a8a1(_0x1f6553);});});}exports[_0x5882('0x1d')]=function(_0x7d40eb){var _0xaa6563=this;return new Promise(function(_0xd3cd7b,_0x282809){return db[_0x5882('0x1e')][_0x5882('0x1f')](_0x7d40eb['body'],{'raw':_0x7d40eb[_0x5882('0x20')]?_0x7d40eb[_0x5882('0x20')][_0x5882('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7d40eb[_0x5882('0x20')]?_0x7d40eb['options'][_0x5882('0x22')]||null:null,'attributes':_0x7d40eb[_0x5882('0x20')]?_0x7d40eb['options'][_0x5882('0x23')]||null:null,'limit':_0x7d40eb[_0x5882('0x20')]?_0x7d40eb[_0x5882('0x20')][_0x5882('0x24')]||null:null})[_0x5882('0x11')](function(_0x261569){logger[_0x5882('0x12')](_0x5882('0x1d'),_0x7d40eb);logger['debug'](_0x5882('0x1d'),_0x7d40eb,JSON[_0x5882('0x16')](_0x261569));_0xd3cd7b(_0x261569);})[_0x5882('0x1c')](function(_0x4ae25b){logger[_0x5882('0x17')](_0x5882('0x1d'),_0x4ae25b[_0x5882('0x1a')],_0x7d40eb);_0x282809(_0xaa6563['error'](0x1f4,_0x4ae25b[_0x5882('0x1a')]));});});};exports['AddTagsToMailInteraction']=function(_0x2c9eee){return new Promise(function(_0x3c21f2,_0x677e59){return db[_0x5882('0x1e')]['find']({'where':_0x2c9eee[_0x5882('0x20')]?_0x2c9eee[_0x5882('0x20')][_0x5882('0x22')]||null:null})[_0x5882('0x11')](function(_0x3db3b8){if(_0x3db3b8){return _0x3db3b8[_0x5882('0x25')](_0x2c9eee['body'][_0x5882('0x26')],_[_0x5882('0x27')](_0x2c9eee[_0x5882('0x28')],[_0x5882('0x26'),'id'])||{});}})['spread'](function(_0x2c4671){logger[_0x5882('0x12')]('AddTags',_0x2c9eee);logger[_0x5882('0x13')](_0x5882('0x29'),_0x2c9eee,JSON[_0x5882('0x16')](_0x2c4671));_0x3c21f2(_0x2c4671);})[_0x5882('0x1c')](function(_0x4ec2ea){logger[_0x5882('0x17')](_0x5882('0x29'),_0x4ec2ea[_0x5882('0x1a')],_0x2c9eee);_0x677e59(_this['error'](0x1f4,_0x4ec2ea[_0x5882('0x1a')]));});});}; \ No newline at end of file +var _0x1967=['attributes','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailInteraction','update','options','raw','where'];(function(_0x2635ec,_0x217591){var _0x35fdce=function(_0x5d2c14){while(--_0x5d2c14){_0x2635ec['push'](_0x2635ec['shift']());}};_0x35fdce(++_0x217591);}(_0x1967,0x173));var _0x7196=function(_0x4cd59b,_0x3b3369){_0x4cd59b=_0x4cd59b-0x0;var _0x23e616=_0x1967[_0x4cd59b];return _0x23e616;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});config[_0x7196('0xc')]=_[_0x7196('0xd')](config[_0x7196('0xc')],{'host':_0x7196('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7196('0xc')]));require(_0x7196('0xf'))[_0x7196('0x10')](socket);function respondWithRpcPromise(_0x259b18,_0x1e862d,_0x503070){return new BPromise(function(_0x49e5fb,_0x2028dd){return client[_0x7196('0x11')](_0x259b18,_0x503070)[_0x7196('0x12')](function(_0x107759){logger[_0x7196('0x13')](_0x7196('0x14'),_0x1e862d,_0x7196('0x15'));logger[_0x7196('0x16')](_0x7196('0x17'),_0x1e862d,_0x7196('0x15'),JSON[_0x7196('0x18')](_0x107759));if(_0x107759['error']){if(_0x107759[_0x7196('0x19')][_0x7196('0x1a')]===0x1f4){logger[_0x7196('0x19')](_0x7196('0x14'),_0x1e862d,_0x107759['error'][_0x7196('0x1b')]);return _0x2028dd(_0x107759['error'][_0x7196('0x1b')]);}logger[_0x7196('0x19')](_0x7196('0x14'),_0x1e862d,_0x107759[_0x7196('0x19')][_0x7196('0x1b')]);return _0x49e5fb(_0x107759[_0x7196('0x19')][_0x7196('0x1b')]);}else{logger[_0x7196('0x13')](_0x7196('0x14'),_0x1e862d,_0x7196('0x15'));_0x49e5fb(_0x107759[_0x7196('0x1c')]['message']);}})['catch'](function(_0x448f13){logger[_0x7196('0x19')](_0x7196('0x14'),_0x1e862d,_0x448f13);_0x2028dd(_0x448f13);});});}exports['UpdateMailInteraction']=function(_0x39b944){var _0x539d8b=this;return new Promise(function(_0x5b25f0,_0x296e07){return db[_0x7196('0x1d')][_0x7196('0x1e')](_0x39b944['body'],{'raw':_0x39b944['options']?_0x39b944[_0x7196('0x1f')][_0x7196('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39b944['options']?_0x39b944[_0x7196('0x1f')][_0x7196('0x21')]||null:null,'attributes':_0x39b944[_0x7196('0x1f')]?_0x39b944[_0x7196('0x1f')][_0x7196('0x22')]||null:null,'limit':_0x39b944['options']?_0x39b944[_0x7196('0x1f')]['limit']||null:null})[_0x7196('0x12')](function(_0x1b1f4b){logger[_0x7196('0x13')](_0x7196('0x23'),_0x39b944);logger[_0x7196('0x16')](_0x7196('0x23'),_0x39b944,JSON['stringify'](_0x1b1f4b));_0x5b25f0(_0x1b1f4b);})['catch'](function(_0x1482e5){logger[_0x7196('0x19')](_0x7196('0x23'),_0x1482e5['message'],_0x39b944);_0x296e07(_0x539d8b['error'](0x1f4,_0x1482e5[_0x7196('0x1b')]));});});};exports[_0x7196('0x24')]=function(_0x675e64){return new Promise(function(_0x4c6006,_0x35eef9){return db['MailInteraction'][_0x7196('0x25')]({'where':_0x675e64['options']?_0x675e64[_0x7196('0x1f')][_0x7196('0x21')]||null:null})[_0x7196('0x12')](function(_0x4f02b1){if(_0x4f02b1){return _0x4f02b1[_0x7196('0x26')](_0x675e64[_0x7196('0x27')][_0x7196('0x28')],_[_0x7196('0x29')](_0x675e64['body'],[_0x7196('0x28'),'id'])||{});}})[_0x7196('0x2a')](function(_0xd07f22){logger[_0x7196('0x13')](_0x7196('0x2b'),_0x675e64);logger[_0x7196('0x16')](_0x7196('0x2b'),_0x675e64,JSON[_0x7196('0x18')](_0xd07f22));_0x4c6006(_0xd07f22);})[_0x7196('0x2c')](function(_0xf33b59){logger[_0x7196('0x19')]('AddTags',_0xf33b59[_0x7196('0x1b')],_0x675e64);_0x35eef9(_this['error'](0x1f4,_0xf33b59[_0x7196('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 091a3cd..2961371 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 _0x9256=['update','removeListener','length','mailInteraction:','./mailInteraction.events','remove'];(function(_0x3d37c5,_0x1d848e){var _0x4ec30a=function(_0x3c459b){while(--_0x3c459b){_0x3d37c5['push'](_0x3d37c5['shift']());}};_0x4ec30a(++_0x1d848e);}(_0x9256,0xa6));var _0x6925=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9256[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0x6925('0x0'));var events=['save',_0x6925('0x1'),_0x6925('0x2')];function createListener(_0x48f842,_0x4e39fa){return function(_0x214790){_0x4e39fa['emit'](_0x48f842,_0x214790);};}function removeListener(_0x369097,_0x36d3ab){return function(){MailInteractionEvents[_0x6925('0x3')](_0x369097,_0x36d3ab);};}exports['register']=function(_0x23a9f3){for(var _0x444bb4=0x0,_0x3afba0=events[_0x6925('0x4')];_0x444bb4<_0x3afba0;_0x444bb4++){var _0x32c003=events[_0x444bb4];var _0x1374fb=createListener(_0x6925('0x5')+_0x32c003,_0x23a9f3);MailInteractionEvents['on'](_0x32c003,_0x1374fb);}}; \ No newline at end of file +var _0x9b65=['removeListener','register','mailInteraction:','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b65,0x99));var _0x59b6=function(_0x343119,_0x3cb8c6){_0x343119=_0x343119-0x0;var _0x1b58dc=_0x9b65[_0x343119];return _0x1b58dc;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x59b6('0x0'),_0x59b6('0x1'),'update'];function createListener(_0x4f4b2c,_0x2587fd){return function(_0x322dae){_0x2587fd[_0x59b6('0x2')](_0x4f4b2c,_0x322dae);};}function removeListener(_0x48d0a5,_0x52482f){return function(){MailInteractionEvents[_0x59b6('0x3')](_0x48d0a5,_0x52482f);};}exports[_0x59b6('0x4')]=function(_0x594ab1){for(var _0x9669d6=0x0,_0x1b2158=events['length'];_0x9669d6<_0x1b2158;_0x9669d6++){var _0x34f052=events[_0x9669d6];var _0x53e75f=createListener(_0x59b6('0x5')+_0x34f052,_0x594ab1);MailInteractionEvents['on'](_0x34f052,_0x53e75f);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index e3ea2df..fd88f18 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 _0xc0e1=['Router','../../components/auth/service','get','/describe','isAuthenticated','describe','exports','express'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc0e1,0x147));var _0x1c0e=function(_0x1c5950,_0x49e128){_0x1c5950=_0x1c5950-0x0;var _0x2b720a=_0xc0e1[_0x1c5950];return _0x2b720a;};'use strict';var express=require(_0x1c0e('0x0'));var router=express[_0x1c0e('0x1')]();var auth=require(_0x1c0e('0x2'));var controller=require('./mailInteractionHasTag.controller');router[_0x1c0e('0x3')](_0x1c0e('0x4'),auth[_0x1c0e('0x5')](),controller[_0x1c0e('0x6')]);module[_0x1c0e('0x7')]=router; \ No newline at end of file +var _0xe604=['describe','exports','express','/describe','isAuthenticated'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xe604,0x101));var _0x4e60=function(_0x449775,_0x3b1746){_0x449775=_0x449775-0x0;var _0x560f55=_0xe604[_0x449775];return _0x560f55;};'use strict';var express=require(_0x4e60('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router['get'](_0x4e60('0x1'),auth[_0x4e60('0x2')](),controller[_0x4e60('0x3')]);module[_0x4e60('0x4')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 9fd3bfe..2df3b52 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(_0x3b395a,_0xf8e390){var _0x33570f=function(_0x4e8e66){while(--_0x4e8e66){_0x3b395a['push'](_0x3b395a['shift']());}};_0x33570f(++_0xf8e390);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x5e893a,_0x1ef4a5){var _0x3c949e=function(_0x462bfb){while(--_0x462bfb){_0x5e893a['push'](_0x5e893a['shift']());}};_0x3c949e(++_0x1ef4a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 cce3d14..6724a19 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 _0x140a=['sequelize','exports'];(function(_0x3f2a52,_0x1aef1d){var _0x142c89=function(_0x241d2b){while(--_0x241d2b){_0x3f2a52['push'](_0x3f2a52['shift']());}};_0x142c89(++_0x1aef1d);}(_0x140a,0xfc));var _0xa140=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x140a[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require(_0xa140('0x0'));module[_0xa140('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x163c=['INTEGER','sequelize'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x163c,0x119));var _0xc163=function(_0x1d987e,_0x15da84){_0x1d987e=_0x1d987e-0x0;var _0x3db3b3=_0x163c[_0x1d987e];return _0x3db3b3;};'use strict';var Sequelize=require(_0xc163('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0xc163('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xc163('0x1')],'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 7e040d8..0a48593 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 _0x020b=['MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag','exports','define'];(function(_0x1b819b,_0x1ff86b){var _0x178051=function(_0x154021){while(--_0x154021){_0x1b819b['push'](_0x1b819b['shift']());}};_0x178051(++_0x1ff86b);}(_0x020b,0x197));var _0xb020=function(_0x571455,_0x2456f6){_0x571455=_0x571455-0x0;var _0x3849c9=_0x020b[_0x571455];return _0x3849c9;};'use strict';var attributes=require(_0xb020('0x0'));module[_0xb020('0x1')]=function(_0x207df2){return _0x207df2[_0xb020('0x2')](_0xb020('0x3'),attributes,{'tableName':_0xb020('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90fa=['exports','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x25f805,_0x59caf3){var _0xf6628f=function(_0x3cb938){while(--_0x3cb938){_0x25f805['push'](_0x25f805['shift']());}};_0xf6628f(++_0x59caf3);}(_0x90fa,0x14f));var _0xa90f=function(_0x108b34,_0x8c0ee4){_0x108b34=_0x108b34-0x0;var _0x481cfe=_0x90fa[_0x108b34];return _0x481cfe;};'use strict';var attributes=require(_0xa90f('0x0'));module[_0xa90f('0x1')]=function(_0x295f72){return _0x295f72['define']('MailInteractionHasTag',attributes,{'tableName':_0xa90f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5115b64..1321cd3 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 _0x01bb=['index','/describe','describe','show','/:id/download','post','tracked','mail','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x13dfef,_0xd52392){var _0x6ed896=function(_0x118184){while(--_0x118184){_0x13dfef['push'](_0x13dfef['shift']());}};_0x6ed896(++_0xd52392);}(_0x01bb,0x171));var _0xb01b=function(_0x523b7b,_0x425d30){_0x523b7b=_0x523b7b-0x0;var _0x108a85=_0x01bb[_0x523b7b];return _0x108a85;};'use strict';var multer=require(_0xb01b('0x0'));var util=require(_0xb01b('0x1'));var path=require(_0xb01b('0x2'));var timeout=require(_0xb01b('0x3'));var express=require(_0xb01b('0x4'));var router=express['Router']();var fs_extra=require(_0xb01b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb01b('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xb01b('0x7')]('/',auth[_0xb01b('0x8')](),controller[_0xb01b('0x9')]);router[_0xb01b('0x7')](_0xb01b('0xa'),auth[_0xb01b('0x8')](),controller[_0xb01b('0xb')]);router[_0xb01b('0x7')]('/:id',auth[_0xb01b('0x8')](),controller[_0xb01b('0xc')]);router[_0xb01b('0x7')](_0xb01b('0xd'),auth[_0xb01b('0x8')](),controller['download']);router[_0xb01b('0xe')]('/',auth[_0xb01b('0x8')](),interaction[_0xb01b('0xf')](_0xb01b('0x10'),'mailmessage:create'),controller[_0xb01b('0x11')]);router[_0xb01b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb01b('0x13')]);router[_0xb01b('0x12')](_0xb01b('0x14'),auth[_0xb01b('0x8')](),controller[_0xb01b('0x15')]);router[_0xb01b('0x12')](_0xb01b('0x16'),auth[_0xb01b('0x8')](),controller[_0xb01b('0x17')]);router[_0xb01b('0x18')]('/:id',auth[_0xb01b('0x8')](),controller[_0xb01b('0x19')]);module[_0xb01b('0x1a')]=router; \ No newline at end of file +var _0xe87e=['reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','mail','mailmessage:create','create','put','update','accept'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe87e,0x17d));var _0xee87=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0xe87e[_0x19dd7a];return _0x3feb6a;};'use strict';var multer=require(_0xee87('0x0'));var util=require(_0xee87('0x1'));var path=require(_0xee87('0x2'));var timeout=require(_0xee87('0x3'));var express=require(_0xee87('0x4'));var router=express['Router']();var fs_extra=require(_0xee87('0x5'));var auth=require(_0xee87('0x6'));var interaction=require(_0xee87('0x7'));var config=require(_0xee87('0x8'));var controller=require(_0xee87('0x9'));router[_0xee87('0xa')]('/',auth[_0xee87('0xb')](),controller['index']);router['get'](_0xee87('0xc'),auth[_0xee87('0xb')](),controller[_0xee87('0xd')]);router[_0xee87('0xa')](_0xee87('0xe'),auth['isAuthenticated'](),controller[_0xee87('0xf')]);router[_0xee87('0xa')](_0xee87('0x10'),auth[_0xee87('0xb')](),controller['download']);router[_0xee87('0x11')]('/',auth[_0xee87('0xb')](),interaction['tracked'](_0xee87('0x12'),_0xee87('0x13')),controller[_0xee87('0x14')]);router[_0xee87('0x15')](_0xee87('0xe'),auth[_0xee87('0xb')](),controller[_0xee87('0x16')]);router[_0xee87('0x15')]('/:id/accept',auth[_0xee87('0xb')](),controller[_0xee87('0x17')]);router['put']('/:id/reject',auth[_0xee87('0xb')](),controller[_0xee87('0x18')]);router['delete'](_0xee87('0xe'),auth[_0xee87('0xb')](),controller[_0xee87('0x19')]);module[_0xee87('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9fefdfa..5f4edb4 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 _0xdc9c=['STRING','long','DATE','INTEGER','Chat','Email','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x59e0ef,_0x1b80e2){var _0x27c014=function(_0xdb0adc){while(--_0xdb0adc){_0x59e0ef['push'](_0x59e0ef['shift']());}};_0x27c014(++_0x1b80e2);}(_0xdc9c,0xe2));var _0xcdc9=function(_0x42f345,_0x2a2576){_0x42f345=_0x42f345-0x0;var _0xdd14bd=_0xdc9c[_0x42f345];return _0xdd14bd;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xcdc9('0x0')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xcdc9('0x0')](_0xcdc9('0x1'))},'read':{'type':Sequelize[_0xcdc9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcdc9('0x3')]('in','out'),'defaultValue':_0xcdc9('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xcdc9('0x5')]},'to':{'type':Sequelize[_0xcdc9('0x0')](_0xcdc9('0x6'))},'cc':{'type':Sequelize[_0xcdc9('0x0')]('long')},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xcdc9('0x7')]},'attach':{'type':Sequelize[_0xcdc9('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xcdc9('0x2')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xcdc9('0x7')]},'originTo':{'type':Sequelize[_0xcdc9('0x0')](_0xcdc9('0x6'))},'originCc':{'type':Sequelize[_0xcdc9('0x0')](_0xcdc9('0x6'))},'originChannel':{'type':Sequelize[_0xcdc9('0x3')]('Email',_0xcdc9('0x9')),'defaultValue':_0xcdc9('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x8d7c=['exports','long','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','Email','Chat','sequelize','lodash'];(function(_0x2638d0,_0x52f653){var _0x411a60=function(_0x1e3523){while(--_0x1e3523){_0x2638d0['push'](_0x2638d0['shift']());}};_0x411a60(++_0x52f653);}(_0x8d7c,0x73));var _0xc8d7=function(_0x1fc64b,_0x14c014){_0x1fc64b=_0x1fc64b-0x0;var _0x5e31a0=_0x8d7c[_0x1fc64b];return _0x5e31a0;};'use strict';var Sequelize=require(_0xc8d7('0x0'));var _=require(_0xc8d7('0x1'));module[_0xc8d7('0x2')]={'body':{'type':Sequelize['TEXT'](_0xc8d7('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc8d7('0x4')](_0xc8d7('0x5'))},'read':{'type':Sequelize[_0xc8d7('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc8d7('0x7')]('in',_0xc8d7('0x8')),'defaultValue':_0xc8d7('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc8d7('0x9')](0x1fe)},'from':{'type':Sequelize[_0xc8d7('0x9')]},'to':{'type':Sequelize[_0xc8d7('0x4')]('long')},'cc':{'type':Sequelize[_0xc8d7('0x4')](_0xc8d7('0x3'))},'bcc':{'type':Sequelize[_0xc8d7('0x4')](_0xc8d7('0x3'))},'subject':{'type':Sequelize[_0xc8d7('0x4')]},'sentAt':{'type':Sequelize[_0xc8d7('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc8d7('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc8d7('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0xc8d7('0x3'))},'originCc':{'type':Sequelize[_0xc8d7('0x4')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0xc8d7('0xb'),_0xc8d7('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0471e09..2291ff9 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 _0xc8e6=['status','set','json','update','destroy','end','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','map','merge','options','MailMessage','show','params','includeAll','include','find','body','describe','create','direction','out','MailAccount','findOne','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','fullname','rejectmessage','download','unix','tmp','server','files','message-%s.eml','from','createdAt','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','defaults','socket.io-emitter','redis','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','offset','undefined','limit','count'];(function(_0x409171,_0x279383){var _0x499c2f=function(_0x173d40){while(--_0x173d40){_0x409171['push'](_0x409171['shift']());}};_0x499c2f(++_0x279383);}(_0xc8e6,0x78));var _0x6c8e=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0xc8e6[_0x200aa5];return _0x458200;};'use strict';var emlformat=require(_0x6c8e('0x0'));var moment=require(_0x6c8e('0x1'));var BPromise=require(_0x6c8e('0x2'));var util=require(_0x6c8e('0x3'));var path=require(_0x6c8e('0x4'));var fs=require('fs');var _=require(_0x6c8e('0x5'));var Redis=require(_0x6c8e('0x6'));var htmlToText=require(_0x6c8e('0x7'));var qs=require(_0x6c8e('0x8'));var logger=require(_0x6c8e('0x9'))(_0x6c8e('0xa'));var interaction_log=require(_0x6c8e('0x9'))(_0x6c8e('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x6c8e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6c8e('0xd'))(new Redis(config[_0x6c8e('0xe')]));var htmlEntities=require(_0x6c8e('0xf'));require(_0x6c8e('0x10'))['register'](socket);var jayson=require(_0x6c8e('0x11'));var client=jayson[_0x6c8e('0x12')][_0x6c8e('0x13')]({'port':0x232c});var client9003=jayson[_0x6c8e('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x6c8e('0x12')][_0x6c8e('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1eba98,_0x3e7f76,_0x33ee86,_0x5116c2){return new BPromise(function(_0x5efa67,_0x1bbcc6){var _0x2fcf65=_0x5116c2||client;return _0x2fcf65[_0x6c8e('0x14')](_0x1eba98,_0x33ee86)[_0x6c8e('0x15')](function(_0x3e9230){logger['info'](_0x6c8e('0x16'),_0x3e7f76,_0x6c8e('0x17'));logger[_0x6c8e('0x18')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x3e7f76,_0x6c8e('0x17'),JSON['stringify'](_0x3e9230));if(_0x3e9230[_0x6c8e('0x19')]){if(_0x3e9230[_0x6c8e('0x19')][_0x6c8e('0x1a')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x3e7f76,_0x3e9230['error']['message']);return _0x1bbcc6(_0x3e9230['error'][_0x6c8e('0x1b')]);}logger['error'](_0x6c8e('0x16'),_0x3e7f76,_0x3e9230[_0x6c8e('0x19')][_0x6c8e('0x1b')]);return _0x5efa67(_0x3e9230[_0x6c8e('0x19')][_0x6c8e('0x1b')]);}else{logger[_0x6c8e('0x1c')](_0x6c8e('0x16'),_0x3e7f76,_0x6c8e('0x17'));_0x5efa67(_0x3e9230[_0x6c8e('0x1d')][_0x6c8e('0x1b')]);}})[_0x6c8e('0x1e')](function(_0x554e17){logger[_0x6c8e('0x19')]('MailMessage,\x20%s,\x20%s',_0x3e7f76,_0x554e17);_0x1bbcc6(_0x554e17);});});}function respondWithResult(_0x52c2a4,_0x43695f){_0x43695f=_0x43695f||0xc8;return function(_0xf26daa){if(_0xf26daa){return _0x52c2a4['status'](_0x43695f)['json'](_0xf26daa);}};}function respondWithFilteredResult(_0x1601fc,_0x267bf7){return function(_0x36e5a9){if(_0x36e5a9){var _0x175fad=typeof _0x267bf7[_0x6c8e('0x1f')]===_0x6c8e('0x20')&&typeof _0x267bf7[_0x6c8e('0x21')]===_0x6c8e('0x20');var _0x7db58b=_0x36e5a9[_0x6c8e('0x22')];var _0x20a270=_0x175fad?0x0:_0x267bf7['offset'];var _0x1ca7a6=_0x175fad?_0x36e5a9[_0x6c8e('0x22')]:_0x267bf7[_0x6c8e('0x1f')]+_0x267bf7['limit'];var _0x29c572;if(_0x1ca7a6>=_0x7db58b){_0x1ca7a6=_0x7db58b;_0x29c572=0xc8;}else{_0x29c572=0xce;}_0x1601fc[_0x6c8e('0x23')](_0x29c572);return _0x1601fc[_0x6c8e('0x24')]('Content-Range',_0x20a270+'-'+_0x1ca7a6+'/'+_0x7db58b)[_0x6c8e('0x25')](_0x36e5a9);}return null;};}function saveUpdates(_0x4afd91){return function(_0x1e2b5b){if(_0x1e2b5b){return _0x1e2b5b[_0x6c8e('0x26')](_0x4afd91)[_0x6c8e('0x15')](function(_0x433045){return _0x433045;});}return null;};}function removeEntity(_0x272a2b){return function(_0x330a15){if(_0x330a15){return _0x330a15[_0x6c8e('0x27')]()[_0x6c8e('0x15')](function(){_0x272a2b[_0x6c8e('0x23')](0xcc)[_0x6c8e('0x28')]();});}};}function handleEntityNotFound(_0x29c57f){return function(_0x1b75dc){if(!_0x1b75dc){_0x29c57f['sendStatus'](0x194);}return _0x1b75dc;};}function handleError(_0x33bb4c,_0x48770c){_0x48770c=_0x48770c||0x1f4;return function(_0x505837){logger[_0x6c8e('0x19')](_0x505837[_0x6c8e('0x29')]);if(_0x505837[_0x6c8e('0x2a')]){delete _0x505837[_0x6c8e('0x2a')];}_0x33bb4c[_0x6c8e('0x23')](_0x48770c)['send'](_0x505837);};}exports[_0x6c8e('0x2b')]=function(_0x4e6a7e,_0x166b3a){var _0x4116dc={},_0x405288={},_0x2cb604={'count':0x0,'rows':[]};var _0x31f47c=_['map'](db['MailMessage'][_0x6c8e('0x2c')],function(_0x1c0749){return{'name':_0x1c0749[_0x6c8e('0x2d')],'type':_0x1c0749[_0x6c8e('0x2e')][_0x6c8e('0x2f')]};});_0x405288[_0x6c8e('0x30')]=_['map'](_0x31f47c,'name');_0x405288[_0x6c8e('0x31')]=_[_0x6c8e('0x32')](_0x4e6a7e[_0x6c8e('0x31')]);_0x405288[_0x6c8e('0x33')]=_[_0x6c8e('0x34')](_0x405288[_0x6c8e('0x30')],_0x405288['query']);_0x4116dc[_0x6c8e('0x35')]=_[_0x6c8e('0x34')](_0x405288[_0x6c8e('0x30')],qs[_0x6c8e('0x36')](_0x4e6a7e[_0x6c8e('0x31')][_0x6c8e('0x36')]));_0x4116dc['attributes']=_0x4116dc[_0x6c8e('0x35')][_0x6c8e('0x37')]?_0x4116dc[_0x6c8e('0x35')]:_0x405288[_0x6c8e('0x30')];if(!_0x4e6a7e['query'][_0x6c8e('0x38')]('nolimit')){_0x4116dc[_0x6c8e('0x21')]=qs[_0x6c8e('0x21')](_0x4e6a7e[_0x6c8e('0x31')]['limit']);_0x4116dc[_0x6c8e('0x1f')]=qs[_0x6c8e('0x1f')](_0x4e6a7e['query']['offset']);}_0x4116dc[_0x6c8e('0x39')]=qs[_0x6c8e('0x3a')](_0x4e6a7e[_0x6c8e('0x31')]['sort']);_0x4116dc[_0x6c8e('0x3b')]=qs[_0x6c8e('0x33')](_['pick'](_0x4e6a7e[_0x6c8e('0x31')],_0x405288[_0x6c8e('0x33')]),_0x31f47c);if(_0x4e6a7e[_0x6c8e('0x31')][_0x6c8e('0x3c')]){_0x4116dc[_0x6c8e('0x3b')]=_['merge'](_0x4116dc[_0x6c8e('0x3b')],{'$or':_[_0x6c8e('0x3d')](_0x31f47c,function(_0x2512ff){if(_0x2512ff[_0x6c8e('0x2e')]!=='VIRTUAL'){var _0x563c1f={};_0x563c1f[_0x2512ff[_0x6c8e('0x2a')]]={'$like':'%'+_0x4e6a7e[_0x6c8e('0x31')][_0x6c8e('0x3c')]+'%'};return _0x563c1f;}})});}_0x4116dc=_[_0x6c8e('0x3e')]({},_0x4116dc,_0x4e6a7e[_0x6c8e('0x3f')]);var _0x4d6b0d={'where':_0x4116dc[_0x6c8e('0x3b')]};return db[_0x6c8e('0x40')][_0x6c8e('0x22')](_0x4d6b0d)['then'](function(_0x1d8e55){_0x2cb604[_0x6c8e('0x22')]=_0x1d8e55;if(_0x4e6a7e['query']['includeAll']){_0x4116dc['include']=[{'all':!![]}];}return db[_0x6c8e('0x40')]['findAll'](_0x4116dc);})[_0x6c8e('0x15')](function(_0x5a69c5){_0x2cb604['rows']=_0x5a69c5;return _0x2cb604;})[_0x6c8e('0x15')](respondWithFilteredResult(_0x166b3a,_0x4116dc))['catch'](handleError(_0x166b3a,null));};exports[_0x6c8e('0x41')]=function(_0x429543,_0x10d496){var _0x25d5ea={'raw':!![],'where':{'id':_0x429543[_0x6c8e('0x42')]['id']}},_0x216a56={};_0x216a56[_0x6c8e('0x30')]=_[_0x6c8e('0x32')](db[_0x6c8e('0x40')][_0x6c8e('0x2c')]);_0x216a56[_0x6c8e('0x31')]=_[_0x6c8e('0x32')](_0x429543[_0x6c8e('0x31')]);_0x216a56[_0x6c8e('0x33')]=_[_0x6c8e('0x34')](_0x216a56[_0x6c8e('0x30')],_0x216a56[_0x6c8e('0x31')]);_0x25d5ea[_0x6c8e('0x35')]=_[_0x6c8e('0x34')](_0x216a56[_0x6c8e('0x30')],qs[_0x6c8e('0x36')](_0x429543[_0x6c8e('0x31')][_0x6c8e('0x36')]));_0x25d5ea[_0x6c8e('0x35')]=_0x25d5ea[_0x6c8e('0x35')][_0x6c8e('0x37')]?_0x25d5ea['attributes']:_0x216a56[_0x6c8e('0x30')];if(_0x429543[_0x6c8e('0x31')][_0x6c8e('0x43')]){_0x25d5ea[_0x6c8e('0x44')]=[{'all':!![]}];}_0x25d5ea=_[_0x6c8e('0x3e')]({},_0x25d5ea,_0x429543['options']);return db[_0x6c8e('0x40')][_0x6c8e('0x45')](_0x25d5ea)['then'](handleEntityNotFound(_0x10d496,null))[_0x6c8e('0x15')](respondWithResult(_0x10d496,null))[_0x6c8e('0x1e')](handleError(_0x10d496,null));};exports[_0x6c8e('0x26')]=function(_0x1c08e9,_0x40b205){if(_0x1c08e9[_0x6c8e('0x46')]['id']){delete _0x1c08e9[_0x6c8e('0x46')]['id'];}return db[_0x6c8e('0x40')][_0x6c8e('0x45')]({'where':{'id':_0x1c08e9[_0x6c8e('0x42')]['id']}})[_0x6c8e('0x15')](handleEntityNotFound(_0x40b205,null))[_0x6c8e('0x15')](saveUpdates(_0x1c08e9[_0x6c8e('0x46')],null))['then'](respondWithResult(_0x40b205,null))['catch'](handleError(_0x40b205,null));};exports['destroy']=function(_0x55c53b,_0x78ee4b){return db[_0x6c8e('0x40')][_0x6c8e('0x45')]({'where':{'id':_0x55c53b[_0x6c8e('0x42')]['id']}})['then'](handleEntityNotFound(_0x78ee4b,null))[_0x6c8e('0x15')](removeEntity(_0x78ee4b,null))['catch'](handleError(_0x78ee4b,null));};exports[_0x6c8e('0x47')]=function(_0x336d39,_0x5b0ccf){return db[_0x6c8e('0x40')]['describe']()['then'](respondWithResult(_0x5b0ccf,null))[_0x6c8e('0x1e')](handleError(_0x5b0ccf,null));};exports[_0x6c8e('0x48')]=function(_0x188946,_0x31ca79){return db[_0x6c8e('0x40')][_0x6c8e('0x48')](_0x188946[_0x6c8e('0x46')])[_0x6c8e('0x15')](function(_0x20f016){if(_0x20f016){if(_0x20f016[_0x6c8e('0x49')]===_0x6c8e('0x4a')&&!_0x20f016['secret']){var _0x2460f3,_0x230da9,_0x3a2558;if(_0x188946[_0x6c8e('0x46')]['to']){_0x230da9=_0x188946[_0x6c8e('0x46')]['to']['split'](',')[0x0];}return db[_0x6c8e('0x4b')][_0x6c8e('0x4c')]({'where':{'id':_0x20f016['MailAccountId']},'include':[{'model':db[_0x6c8e('0x4d')],'as':'List','include':[{'model':db[_0x6c8e('0x4e')],'as':_0x6c8e('0x4f'),'where':{'email':_0x230da9},'limit':0x1,'order':[[_0x6c8e('0x50'),_0x6c8e('0x51')]]}]},{'model':db[_0x6c8e('0x52')],'as':_0x6c8e('0x53'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6c8e('0x54'),'raw':!![]}]}]})['then'](function(_0x55a630){_0x2460f3=_0x55a630;if(!_0x2460f3||!_0x2460f3[_0x6c8e('0x53')])return;var _0xc75c1a=_0x2460f3[_0x6c8e('0x55')]();if(_0x188946['body'][_0x6c8e('0x56')]&&_0x188946['body'][_0x6c8e('0x56')][_0x6c8e('0x37')]){for(var _0x5b4d80=0x0;_0x5b4d80<_0x188946[_0x6c8e('0x46')][_0x6c8e('0x56')][_0x6c8e('0x37')];_0x5b4d80+=0x1){_0x188946[_0x6c8e('0x46')][_0x6c8e('0x56')][_0x5b4d80]={'filename':_0x188946[_0x6c8e('0x46')]['attachments'][_0x5b4d80][_0x6c8e('0x2a')],'path':path[_0x6c8e('0x57')](config[_0x6c8e('0x58')],_0x6c8e('0x59'),_0x188946[_0x6c8e('0x46')]['attachments'][_0x5b4d80][_0x6c8e('0x5a')])};}}_0x3a2558={'account':_0xc75c1a,'message':_0x188946[_0x6c8e('0x46')]};return;})[_0x6c8e('0x15')](function(){if(_0x2460f3[_0x6c8e('0x5b')]){if(_0x2460f3[_0x6c8e('0x5b')][_0x6c8e('0x4f')]['length']){return _0x2460f3[_0x6c8e('0x5b')]['Contacts'][0x0];}else{return db['CmContact'][_0x6c8e('0x48')](_[_0x6c8e('0xc')](_0x188946[_0x6c8e('0x46')],{'firstName':_0x188946['body']['to'],'email':_0x188946[_0x6c8e('0x46')]['to'],'phone':_0x188946[_0x6c8e('0x46')]['to'],'ListId':_0x2460f3[_0x6c8e('0x5c')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x6c8e('0x15')](function(){if(_0x3a2558){return respondWithRpcPromise(_0x6c8e('0x5d'),_0x6c8e('0x5e'),_0x3a2558,client9003)[_0x6c8e('0x15')](function(_0x3d37e0){return _0x20f016[_0x6c8e('0x26')]({'read':!![],'messageId':_0x3d37e0[_0x6c8e('0x5f')],'sentAt':moment()['format'](_0x6c8e('0x60'))});})[_0x6c8e('0x1e')](function(_0x5f3256){logger[_0x6c8e('0x19')]('%s',JSON[_0x6c8e('0x61')](_0x5f3256));return _0x20f016;});}return _0x20f016;});}return _0x20f016;}})[_0x6c8e('0x15')](respondWithResult(_0x31ca79,0xc9))[_0x6c8e('0x1e')](handleError(_0x31ca79,null));};exports[_0x6c8e('0x62')]=function(_0x346984,_0x43947e){var _0x2c3dcf={'agent':{},'channel':'mail'};if(_0x346984[_0x6c8e('0x46')]['id']){delete _0x346984[_0x6c8e('0x46')]['id'];}_0x346984['body']['read']=!![];_0x346984[_0x6c8e('0x46')][_0x6c8e('0x63')]=moment()[_0x6c8e('0x64')](_0x6c8e('0x60'));_0x346984['body'][_0x6c8e('0x65')]=_0x346984['body'][_0x6c8e('0x65')]||_0x346984[_0x6c8e('0x66')]['id'];_0x2c3dcf[_0x6c8e('0x67')]['id']=_0x346984[_0x6c8e('0x46')][_0x6c8e('0x65')];return db[_0x6c8e('0x40')][_0x6c8e('0x45')]({'where':{'id':_0x346984[_0x6c8e('0x42')]['id'],'UserId':null}})[_0x6c8e('0x15')](handleEntityNotFound(_0x43947e,null))[_0x6c8e('0x15')](saveUpdates(_0x346984[_0x6c8e('0x46')],null))[_0x6c8e('0x15')](function(_0x2fcef1){if(_0x2fcef1){_0x2c3dcf[_0x6c8e('0x1b')]=_0x2fcef1[_0x6c8e('0x68')]({'plain':!![]});return db[_0x6c8e('0x69')][_0x6c8e('0x45')]({'where':{'id':_0x2fcef1[_0x6c8e('0x6a')]}});}return null;})[_0x6c8e('0x15')](handleEntityNotFound(_0x43947e,null))[_0x6c8e('0x15')](function(_0x42ee04){if(_0x42ee04){return _0x42ee04[_0x6c8e('0x26')]({'UserId':_0x346984[_0x6c8e('0x46')][_0x6c8e('0x65')],'read1stAt':_[_0x6c8e('0x6b')](_0x42ee04[_0x6c8e('0x6c')])?moment()[_0x6c8e('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6c8e('0x15')](function(_0x3248c6){if(_0x3248c6){_0x2c3dcf[_0x6c8e('0x6d')]=_0x3248c6['get']({'plain':!![]});interaction_log[_0x6c8e('0x1c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x346984['user']['id'],_0x346984[_0x6c8e('0x66')][_0x6c8e('0x2a')],_0x346984['user'][_0x6c8e('0x6e')],_0x2c3dcf[_0x6c8e('0x6d')]['id'],_0x346984[_0x6c8e('0x46')]?JSON['stringify'](_0x346984[_0x6c8e('0x46')]):_0x6c8e('0x6f'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2c3dcf);}return null;})[_0x6c8e('0x15')](function(_0x37f9bd){var _0xe34ec8=_0x6c8e('0x70')+_0x37f9bd['message'][_0x6c8e('0x71')];return db[_0x6c8e('0x72')][_0x6c8e('0x31')](_0xe34ec8,{'type':db[_0x6c8e('0x73')]['QueryTypes'][_0x6c8e('0x74')],'raw':!![]})[_0x6c8e('0x15')](function(_0x185ed7){return _0x185ed7;});})[_0x6c8e('0x15')](function(_0x1faed0){if(_0x1faed0){_0x2c3dcf[_0x6c8e('0x1b')][_0x6c8e('0x75')]=_0x1faed0[0x0];if(!_0x346984[_0x6c8e('0x46')][_0x6c8e('0x65')])return;return db[_0x6c8e('0x76')][_0x6c8e('0x45')]({'where':{'id':_0x346984[_0x6c8e('0x46')][_0x6c8e('0x65')],'role':_0x6c8e('0x67')},'attributes':['id',_0x6c8e('0x2a'),'fullname',_0x6c8e('0x77'),_0x6c8e('0x78')],'raw':!![]});}return null;})['then'](function(_0x1040c4){if(!_0x1040c4)return null;_0x2c3dcf[_0x6c8e('0x1b')][_0x6c8e('0x67')]=_0x1040c4;return _0x2c3dcf;})[_0x6c8e('0x15')](function(_0x42ac98){if(_0x42ac98){if(_0x346984[_0x6c8e('0x46')][_0x6c8e('0x79')]){_0x2c3dcf[_0x6c8e('0x1b')][_0x6c8e('0x7a')]=util[_0x6c8e('0x64')](_0x6c8e('0x7b'),_0x346984[_0x6c8e('0x66')]['name']);_0x2c3dcf[_0x6c8e('0x1b')][_0x6c8e('0x7c')]=_0x2c3dcf[_0x6c8e('0x7c')];_0x2c3dcf[_0x6c8e('0x1b')][_0x6c8e('0x7d')]=_0x2c3dcf[_0x6c8e('0x7c')];_0x2c3dcf['message'][_0x6c8e('0x7e')]='accept';_0x2c3dcf['message'][_0x6c8e('0x46')]=htmlToText[_0x6c8e('0x7f')](_0x2c3dcf['message'][_0x6c8e('0x46')]);return respondWithRpcPromise(_0x6c8e('0x80'),_0x6c8e('0x80'),{'event':_0x6c8e('0x81'),'message':_0x2c3dcf['message']},client9002)['then'](function(){return _0x2c3dcf;});}return _0x2c3dcf;}return null;})[_0x6c8e('0x15')](respondWithResult(_0x43947e,null))['catch'](handleError(_0x43947e,null));};exports[_0x6c8e('0x82')]=function(_0xebe5f5,_0xef8f6){var _0x3c40ee={'agent':{},'channel':'mail'};if(_0xebe5f5[_0x6c8e('0x46')]['id']){delete _0xebe5f5[_0x6c8e('0x46')]['id'];}_0xebe5f5[_0x6c8e('0x46')][_0x6c8e('0x65')]=_0xebe5f5[_0x6c8e('0x46')][_0x6c8e('0x65')]||_0xebe5f5[_0x6c8e('0x66')]['id'];_0x3c40ee[_0x6c8e('0x67')]['id']=_0xebe5f5['body'][_0x6c8e('0x65')];return db[_0x6c8e('0x40')][_0x6c8e('0x45')]({'where':{'id':_0xebe5f5[_0x6c8e('0x42')]['id'],'UserId':null}})[_0x6c8e('0x15')](handleEntityNotFound(_0xef8f6,null))[_0x6c8e('0x15')](function(_0x1e6f8e){if(_0x1e6f8e){_0x3c40ee['message']=_0x1e6f8e[_0x6c8e('0x68')]({'plain':!![]});return db[_0x6c8e('0x69')][_0x6c8e('0x45')]({'where':{'id':_0x1e6f8e[_0x6c8e('0x6a')]}});}return null;})[_0x6c8e('0x15')](handleEntityNotFound(_0xef8f6,null))[_0x6c8e('0x15')](function(_0x5a85da){if(_0x5a85da){_0x3c40ee[_0x6c8e('0x6d')]=_0x5a85da['get']({'plain':!![]});interaction_log['info'](_0x6c8e('0x83'),_0xebe5f5[_0x6c8e('0x66')]['id'],_0xebe5f5['user']['name'],_0xebe5f5[_0x6c8e('0x66')]['role'],_0x3c40ee[_0x6c8e('0x6d')]['id'],_0xebe5f5['body']?JSON[_0x6c8e('0x61')](_0xebe5f5[_0x6c8e('0x46')]):_0x6c8e('0x6f'));return respondWithRpcPromise(_0x6c8e('0x84'),'rejectMessage',_0x3c40ee);}return null;})['then'](function(_0x19c2a8){var _0x53a5c0=_0x6c8e('0x70')+_0x19c2a8[_0x6c8e('0x1b')][_0x6c8e('0x71')];return db[_0x6c8e('0x72')][_0x6c8e('0x31')](_0x53a5c0,{'type':db[_0x6c8e('0x73')]['QueryTypes']['SELECT'],'raw':!![]})[_0x6c8e('0x15')](function(_0x5a46cc){return _0x5a46cc;});})[_0x6c8e('0x15')](function(_0xb186b5){if(_0xb186b5){_0x3c40ee['message'][_0x6c8e('0x75')]=_0xb186b5[0x0];if(!_0xebe5f5['body'][_0x6c8e('0x65')])return;return db['User']['find']({'where':{'id':_0xebe5f5[_0x6c8e('0x46')]['UserId'],'role':_0x6c8e('0x67')},'attributes':['id','name',_0x6c8e('0x85'),_0x6c8e('0x77'),_0x6c8e('0x78')],'raw':!![]});}return null;})['then'](function(_0x394105){if(!_0x394105)return null;_0x3c40ee[_0x6c8e('0x1b')][_0x6c8e('0x67')]=_0x394105;return _0x3c40ee;})[_0x6c8e('0x15')](function(_0x3b3e28){if(_0x3b3e28){_0x3b3e28[_0x6c8e('0x1b')]['interface']=util[_0x6c8e('0x64')](_0x6c8e('0x7b'),_0xebe5f5[_0x6c8e('0x66')][_0x6c8e('0x2a')]);_0x3b3e28[_0x6c8e('0x1b')]['channel']=_0x3c40ee[_0x6c8e('0x7c')];_0x3b3e28[_0x6c8e('0x1b')][_0x6c8e('0x7d')]=_0x3c40ee[_0x6c8e('0x7c')];_0x3b3e28[_0x6c8e('0x1b')][_0x6c8e('0x7e')]='reject';_0x3b3e28[_0x6c8e('0x1b')][_0x6c8e('0x46')]=htmlToText[_0x6c8e('0x7f')](_0x3c40ee[_0x6c8e('0x1b')][_0x6c8e('0x46')]);respondWithRpcPromise(_0x6c8e('0x80'),_0x6c8e('0x80'),{'event':_0x6c8e('0x86'),'message':_0x3b3e28[_0x6c8e('0x1b')]},client9002);return _0x3c40ee;}return null;})[_0x6c8e('0x15')](respondWithResult(_0xef8f6,null))[_0x6c8e('0x1e')](handleError(_0xef8f6,null));};exports[_0x6c8e('0x87')]=function(_0x234e7f,_0x1c91b3){var _0x47fdb1=moment()[_0x6c8e('0x88')]()['toString']();var _0x4b367d=path[_0x6c8e('0x57')](config[_0x6c8e('0x58')],'server','files',_0x6c8e('0x89'));var _0x4ba8d0=path[_0x6c8e('0x57')](config[_0x6c8e('0x58')],_0x6c8e('0x8a'),_0x6c8e('0x8b'),'attachments');var _0x19e4d9=util['format'](_0x6c8e('0x8c'),_0x47fdb1);return db[_0x6c8e('0x40')][_0x6c8e('0x45')]({'where':{'id':_0x234e7f[_0x6c8e('0x42')]['id']},'attributes':['id',_0x6c8e('0x46'),_0x6c8e('0x8d'),'to','cc','bcc','subject',_0x6c8e('0x8e')],'include':_0x234e7f[_0x6c8e('0x31')][_0x6c8e('0x56')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x6c8e('0x15')](handleEntityNotFound(_0x1c91b3,null))[_0x6c8e('0x15')](function(_0x4dea52){if(_0x4dea52){var _0x505646=_0x4dea52;var _0xa3039d={'from':_0x505646[_0x6c8e('0x8d')],'to':_0x505646['to'],'subject':_0x505646[_0x6c8e('0x8f')],'html':htmlEntities['decode'](_0x505646[_0x6c8e('0x46')]),'headers':{'Date':moment(_0x505646[_0x6c8e('0x8e')])[_0x6c8e('0x64')](_0x6c8e('0x90'))},'attachments':[]};if(_0x4dea52['cc']){_0xa3039d[_0x6c8e('0x91')]['Cc']=_0x4dea52['cc'];}if(_0x4dea52[_0x6c8e('0x92')]){_0xa3039d[_0x6c8e('0x91')][_0x6c8e('0x93')]=_0x4dea52['bcc'];}return new BPromise(function(_0x40a596,_0x29d536){if(_0x4dea52[_0x6c8e('0x94')]){for(var _0x427c23=0x0;_0x427c23<_0x4dea52[_0x6c8e('0x94')]['length'];_0x427c23++){var _0x128782=_0x4dea52[_0x6c8e('0x94')][_0x427c23];var _0x2c94e5=path['join'](_0x4ba8d0,_0x128782['basename']);if(fs[_0x6c8e('0x95')](_0x2c94e5)){_0xa3039d[_0x6c8e('0x56')][_0x6c8e('0x96')]({'name':_0x128782[_0x6c8e('0x2a')],'contentType':_0x128782[_0x6c8e('0x2e')],'data':fs[_0x6c8e('0x97')](_0x2c94e5)});}}}emlformat[_0x6c8e('0x98')](_0xa3039d,function(_0x528d18,_0x28b9c7){if(_0x528d18)return _0x29d536(_0x528d18);fs[_0x6c8e('0x99')](path[_0x6c8e('0x57')](_0x4b367d,_0x19e4d9),_0x28b9c7);return _0x40a596(_0x28b9c7);});});}})[_0x6c8e('0x15')](function(_0x4b4494){if(_0x4b4494){return _0x1c91b3[_0x6c8e('0x87')](path[_0x6c8e('0x57')](_0x4b367d,_0x19e4d9),_0x19e4d9,function(_0x32d62e){if(!_0x32d62e)fs[_0x6c8e('0x9a')](path[_0x6c8e('0x57')](_0x4b367d,_0x19e4d9));});}})['catch'](handleError(_0x1c91b3,null));}; \ No newline at end of file +var _0x4a0b=['contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','internal','reject','rejectmessage','download','toString','tmp','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','existsSync','build','writeFileSync','unlinkSync','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','./mailMessage.socket','register','jayson/promise','http','client','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','sendStatus','name','send','index','map','rawAttributes','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','MailMessage','findAll','params','length','includeAll','update','body','find','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','List','ListId','SendMail','sendMail','messageId','format','stringify','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','MailInteraction','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize'];(function(_0x586a7f,_0x587252){var _0x41a84d=function(_0x1fc5d0){while(--_0x1fc5d0){_0x586a7f['push'](_0x586a7f['shift']());}};_0x41a84d(++_0x587252);}(_0x4a0b,0x16b));var _0xb4a0=function(_0x4dd8cd,_0x486a8c){_0x4dd8cd=_0x4dd8cd-0x0;var _0x2cd2e4=_0x4a0b[_0x4dd8cd];return _0x2cd2e4;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0xb4a0('0x0'));var util=require('util');var path=require(_0xb4a0('0x1'));var fs=require('fs');var _=require(_0xb4a0('0x2'));var Redis=require(_0xb4a0('0x3'));var htmlToText=require(_0xb4a0('0x4'));var qs=require(_0xb4a0('0x5'));var logger=require(_0xb4a0('0x6'))(_0xb4a0('0x7'));var interaction_log=require(_0xb4a0('0x6'))(_0xb4a0('0x8'));var config=require(_0xb4a0('0x9'));var db=require(_0xb4a0('0xa'))['db'];config['redis']=_[_0xb4a0('0xb')](config[_0xb4a0('0xc')],{'host':_0xb4a0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4a0('0xc')]));var htmlEntities=require('html-entities');require(_0xb4a0('0xe'))[_0xb4a0('0xf')](socket);var jayson=require(_0xb4a0('0x10'));var client=jayson['client'][_0xb4a0('0x11')]({'port':0x232c});var client9003=jayson[_0xb4a0('0x12')]['http']({'port':0x232b});var client9002=jayson[_0xb4a0('0x12')][_0xb4a0('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x2cd118,_0x40ad97,_0x10e6be,_0xea0f39){return new BPromise(function(_0x2d1ff9,_0x2c473e){var _0x4e6d84=_0xea0f39||client;return _0x4e6d84[_0xb4a0('0x13')](_0x2cd118,_0x10e6be)['then'](function(_0x1f3050){logger[_0xb4a0('0x14')](_0xb4a0('0x15'),_0x40ad97,_0xb4a0('0x16'));logger[_0xb4a0('0x17')](_0xb4a0('0x18'),_0x40ad97,_0xb4a0('0x16'),JSON['stringify'](_0x1f3050));if(_0x1f3050['error']){if(_0x1f3050[_0xb4a0('0x19')][_0xb4a0('0x1a')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x40ad97,_0x1f3050[_0xb4a0('0x19')][_0xb4a0('0x1b')]);return _0x2c473e(_0x1f3050[_0xb4a0('0x19')][_0xb4a0('0x1b')]);}logger['error'](_0xb4a0('0x15'),_0x40ad97,_0x1f3050[_0xb4a0('0x19')][_0xb4a0('0x1b')]);return _0x2d1ff9(_0x1f3050['error'][_0xb4a0('0x1b')]);}else{logger[_0xb4a0('0x14')]('MailMessage,\x20%s,\x20%s',_0x40ad97,_0xb4a0('0x16'));_0x2d1ff9(_0x1f3050[_0xb4a0('0x1c')][_0xb4a0('0x1b')]);}})[_0xb4a0('0x1d')](function(_0x3c2c64){logger['error'](_0xb4a0('0x15'),_0x40ad97,_0x3c2c64);_0x2c473e(_0x3c2c64);});});}function respondWithResult(_0x9906c,_0x54cd4e){_0x54cd4e=_0x54cd4e||0xc8;return function(_0x33e3b1){if(_0x33e3b1){return _0x9906c['status'](_0x54cd4e)[_0xb4a0('0x1e')](_0x33e3b1);}};}function respondWithFilteredResult(_0x2205fb,_0x677d49){return function(_0x5b2eb6){if(_0x5b2eb6){var _0x5012e6=typeof _0x677d49[_0xb4a0('0x1f')]===_0xb4a0('0x20')&&typeof _0x677d49[_0xb4a0('0x21')]==='undefined';var _0x4828bc=_0x5b2eb6[_0xb4a0('0x22')];var _0x24f81a=_0x5012e6?0x0:_0x677d49[_0xb4a0('0x1f')];var _0x13d7d9=_0x5012e6?_0x5b2eb6['count']:_0x677d49['offset']+_0x677d49[_0xb4a0('0x21')];var _0x13aa88;if(_0x13d7d9>=_0x4828bc){_0x13d7d9=_0x4828bc;_0x13aa88=0xc8;}else{_0x13aa88=0xce;}_0x2205fb[_0xb4a0('0x23')](_0x13aa88);return _0x2205fb[_0xb4a0('0x24')](_0xb4a0('0x25'),_0x24f81a+'-'+_0x13d7d9+'/'+_0x4828bc)[_0xb4a0('0x1e')](_0x5b2eb6);}return null;};}function saveUpdates(_0x2aa215){return function(_0x4f61fd){if(_0x4f61fd){return _0x4f61fd['update'](_0x2aa215)[_0xb4a0('0x26')](function(_0x2fc8ad){return _0x2fc8ad;});}return null;};}function removeEntity(_0x5b6c2f){return function(_0x5c133a){if(_0x5c133a){return _0x5c133a[_0xb4a0('0x27')]()[_0xb4a0('0x26')](function(){_0x5b6c2f[_0xb4a0('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3070f4){return function(_0x394cfc){if(!_0x394cfc){_0x3070f4[_0xb4a0('0x28')](0x194);}return _0x394cfc;};}function handleError(_0x2aeb46,_0x4ad9ce){_0x4ad9ce=_0x4ad9ce||0x1f4;return function(_0x5539d3){logger[_0xb4a0('0x19')](_0x5539d3['stack']);if(_0x5539d3[_0xb4a0('0x29')]){delete _0x5539d3[_0xb4a0('0x29')];}_0x2aeb46[_0xb4a0('0x23')](_0x4ad9ce)[_0xb4a0('0x2a')](_0x5539d3);};}exports[_0xb4a0('0x2b')]=function(_0x503199,_0x3ca354){var _0x1983f2={},_0x198ed6={},_0x247092={'count':0x0,'rows':[]};var _0x526290=_[_0xb4a0('0x2c')](db['MailMessage'][_0xb4a0('0x2d')],function(_0x46d266){return{'name':_0x46d266['fieldName'],'type':_0x46d266[_0xb4a0('0x2e')][_0xb4a0('0x2f')]};});_0x198ed6['model']=_[_0xb4a0('0x2c')](_0x526290,_0xb4a0('0x29'));_0x198ed6[_0xb4a0('0x30')]=_[_0xb4a0('0x31')](_0x503199[_0xb4a0('0x30')]);_0x198ed6[_0xb4a0('0x32')]=_['intersection'](_0x198ed6[_0xb4a0('0x33')],_0x198ed6[_0xb4a0('0x30')]);_0x1983f2['attributes']=_[_0xb4a0('0x34')](_0x198ed6[_0xb4a0('0x33')],qs['fields'](_0x503199[_0xb4a0('0x30')][_0xb4a0('0x35')]));_0x1983f2[_0xb4a0('0x36')]=_0x1983f2[_0xb4a0('0x36')]['length']?_0x1983f2[_0xb4a0('0x36')]:_0x198ed6[_0xb4a0('0x33')];if(!_0x503199['query'][_0xb4a0('0x37')](_0xb4a0('0x38'))){_0x1983f2[_0xb4a0('0x21')]=qs[_0xb4a0('0x21')](_0x503199[_0xb4a0('0x30')]['limit']);_0x1983f2[_0xb4a0('0x1f')]=qs[_0xb4a0('0x1f')](_0x503199[_0xb4a0('0x30')][_0xb4a0('0x1f')]);}_0x1983f2[_0xb4a0('0x39')]=qs[_0xb4a0('0x3a')](_0x503199[_0xb4a0('0x30')]['sort']);_0x1983f2['where']=qs[_0xb4a0('0x32')](_[_0xb4a0('0x3b')](_0x503199[_0xb4a0('0x30')],_0x198ed6[_0xb4a0('0x32')]),_0x526290);if(_0x503199[_0xb4a0('0x30')][_0xb4a0('0x3c')]){_0x1983f2['where']=_[_0xb4a0('0x3d')](_0x1983f2['where'],{'$or':_[_0xb4a0('0x2c')](_0x526290,function(_0x3ecd8b){if(_0x3ecd8b[_0xb4a0('0x2e')]!==_0xb4a0('0x3e')){var _0x47e04a={};_0x47e04a[_0x3ecd8b[_0xb4a0('0x29')]]={'$like':'%'+_0x503199[_0xb4a0('0x30')]['filter']+'%'};return _0x47e04a;}})});}_0x1983f2=_[_0xb4a0('0x3d')]({},_0x1983f2,_0x503199[_0xb4a0('0x3f')]);var _0x4e3c45={'where':_0x1983f2[_0xb4a0('0x40')]};return db[_0xb4a0('0x41')][_0xb4a0('0x22')](_0x4e3c45)['then'](function(_0x2e4538){_0x247092[_0xb4a0('0x22')]=_0x2e4538;if(_0x503199[_0xb4a0('0x30')]['includeAll']){_0x1983f2['include']=[{'all':!![]}];}return db[_0xb4a0('0x41')][_0xb4a0('0x42')](_0x1983f2);})[_0xb4a0('0x26')](function(_0x5846f3){_0x247092['rows']=_0x5846f3;return _0x247092;})[_0xb4a0('0x26')](respondWithFilteredResult(_0x3ca354,_0x1983f2))[_0xb4a0('0x1d')](handleError(_0x3ca354,null));};exports['show']=function(_0x2aafb7,_0x1f1a5c){var _0x293e87={'raw':!![],'where':{'id':_0x2aafb7[_0xb4a0('0x43')]['id']}},_0x3ed022={};_0x3ed022[_0xb4a0('0x33')]=_['keys'](db[_0xb4a0('0x41')][_0xb4a0('0x2d')]);_0x3ed022['query']=_[_0xb4a0('0x31')](_0x2aafb7[_0xb4a0('0x30')]);_0x3ed022['filters']=_[_0xb4a0('0x34')](_0x3ed022[_0xb4a0('0x33')],_0x3ed022[_0xb4a0('0x30')]);_0x293e87[_0xb4a0('0x36')]=_[_0xb4a0('0x34')](_0x3ed022[_0xb4a0('0x33')],qs['fields'](_0x2aafb7[_0xb4a0('0x30')]['fields']));_0x293e87[_0xb4a0('0x36')]=_0x293e87[_0xb4a0('0x36')][_0xb4a0('0x44')]?_0x293e87[_0xb4a0('0x36')]:_0x3ed022[_0xb4a0('0x33')];if(_0x2aafb7[_0xb4a0('0x30')][_0xb4a0('0x45')]){_0x293e87['include']=[{'all':!![]}];}_0x293e87=_[_0xb4a0('0x3d')]({},_0x293e87,_0x2aafb7[_0xb4a0('0x3f')]);return db[_0xb4a0('0x41')]['find'](_0x293e87)[_0xb4a0('0x26')](handleEntityNotFound(_0x1f1a5c,null))[_0xb4a0('0x26')](respondWithResult(_0x1f1a5c,null))[_0xb4a0('0x1d')](handleError(_0x1f1a5c,null));};exports[_0xb4a0('0x46')]=function(_0x5cb3ab,_0x2c19bb){if(_0x5cb3ab[_0xb4a0('0x47')]['id']){delete _0x5cb3ab[_0xb4a0('0x47')]['id'];}return db['MailMessage'][_0xb4a0('0x48')]({'where':{'id':_0x5cb3ab['params']['id']}})[_0xb4a0('0x26')](handleEntityNotFound(_0x2c19bb,null))[_0xb4a0('0x26')](saveUpdates(_0x5cb3ab[_0xb4a0('0x47')],null))['then'](respondWithResult(_0x2c19bb,null))[_0xb4a0('0x1d')](handleError(_0x2c19bb,null));};exports['destroy']=function(_0x28a3f9,_0xdd70b3){return db[_0xb4a0('0x41')]['find']({'where':{'id':_0x28a3f9[_0xb4a0('0x43')]['id']}})[_0xb4a0('0x26')](handleEntityNotFound(_0xdd70b3,null))[_0xb4a0('0x26')](removeEntity(_0xdd70b3,null))[_0xb4a0('0x1d')](handleError(_0xdd70b3,null));};exports[_0xb4a0('0x49')]=function(_0x113192,_0x17fa54){return db[_0xb4a0('0x41')][_0xb4a0('0x49')]()[_0xb4a0('0x26')](respondWithResult(_0x17fa54,null))[_0xb4a0('0x1d')](handleError(_0x17fa54,null));};exports[_0xb4a0('0x4a')]=function(_0x41234d,_0xd39f58){return db[_0xb4a0('0x41')][_0xb4a0('0x4a')](_0x41234d['body'])[_0xb4a0('0x26')](function(_0x26ecc5){if(_0x26ecc5){if(_0x26ecc5[_0xb4a0('0x4b')]===_0xb4a0('0x4c')&&!_0x26ecc5[_0xb4a0('0x4d')]){var _0x318ec9,_0x176871,_0x3afddd;if(_0x41234d[_0xb4a0('0x47')]['to']){_0x176871=_0x41234d[_0xb4a0('0x47')]['to']['split'](',')[0x0];}return db[_0xb4a0('0x4e')][_0xb4a0('0x4f')]({'where':{'id':_0x26ecc5[_0xb4a0('0x50')]},'include':[{'model':db[_0xb4a0('0x51')],'as':'List','include':[{'model':db[_0xb4a0('0x52')],'as':_0xb4a0('0x53'),'where':{'email':_0x176871},'limit':0x1,'order':[[_0xb4a0('0x54'),_0xb4a0('0x55')]]}]},{'model':db[_0xb4a0('0x56')],'as':_0xb4a0('0x57'),'raw':!![],'include':[{'model':db[_0xb4a0('0x58')],'as':_0xb4a0('0x58'),'raw':!![]}]}]})[_0xb4a0('0x26')](function(_0xd0bf8f){_0x318ec9=_0xd0bf8f;if(!_0x318ec9||!_0x318ec9[_0xb4a0('0x57')])return;var _0x202e55=_0x318ec9[_0xb4a0('0x59')]();if(_0x41234d[_0xb4a0('0x47')][_0xb4a0('0x5a')]&&_0x41234d[_0xb4a0('0x47')][_0xb4a0('0x5a')][_0xb4a0('0x44')]){for(var _0x57280f=0x0;_0x57280f<_0x41234d[_0xb4a0('0x47')]['attachments'][_0xb4a0('0x44')];_0x57280f+=0x1){_0x41234d['body']['attachments'][_0x57280f]={'filename':_0x41234d['body']['attachments'][_0x57280f][_0xb4a0('0x29')],'path':path[_0xb4a0('0x5b')](config[_0xb4a0('0x5c')],'server/files/attachments',_0x41234d[_0xb4a0('0x47')]['attachments'][_0x57280f][_0xb4a0('0x5d')])};}}_0x3afddd={'account':_0x202e55,'message':_0x41234d['body']};return;})[_0xb4a0('0x26')](function(){if(_0x318ec9['List']){if(_0x318ec9[_0xb4a0('0x5e')][_0xb4a0('0x53')][_0xb4a0('0x44')]){return _0x318ec9[_0xb4a0('0x5e')]['Contacts'][0x0];}else{return db['CmContact'][_0xb4a0('0x4a')](_[_0xb4a0('0xb')](_0x41234d[_0xb4a0('0x47')],{'firstName':_0x41234d['body']['to'],'email':_0x41234d[_0xb4a0('0x47')]['to'],'phone':_0x41234d[_0xb4a0('0x47')]['to'],'ListId':_0x318ec9[_0xb4a0('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x3afddd){return respondWithRpcPromise(_0xb4a0('0x60'),_0xb4a0('0x61'),_0x3afddd,client9003)[_0xb4a0('0x26')](function(_0x31bb40){return _0x26ecc5[_0xb4a0('0x46')]({'read':!![],'messageId':_0x31bb40[_0xb4a0('0x62')],'sentAt':moment()[_0xb4a0('0x63')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xb4a0('0x1d')](function(_0x46555b){logger['error']('%s',JSON[_0xb4a0('0x64')](_0x46555b));return _0x26ecc5;});}return _0x26ecc5;});}return _0x26ecc5;}})['then'](respondWithResult(_0xd39f58,0xc9))['catch'](handleError(_0xd39f58,null));};exports[_0xb4a0('0x65')]=function(_0x2cc116,_0x4ae46b){var _0x246fd6={'agent':{},'channel':_0xb4a0('0x66')};if(_0x2cc116[_0xb4a0('0x47')]['id']){delete _0x2cc116[_0xb4a0('0x47')]['id'];}_0x2cc116[_0xb4a0('0x47')][_0xb4a0('0x67')]=!![];_0x2cc116[_0xb4a0('0x47')][_0xb4a0('0x68')]=moment()['format'](_0xb4a0('0x69'));_0x2cc116[_0xb4a0('0x47')][_0xb4a0('0x6a')]=_0x2cc116[_0xb4a0('0x47')][_0xb4a0('0x6a')]||_0x2cc116[_0xb4a0('0x6b')]['id'];_0x246fd6['agent']['id']=_0x2cc116[_0xb4a0('0x47')][_0xb4a0('0x6a')];return db[_0xb4a0('0x41')]['find']({'where':{'id':_0x2cc116[_0xb4a0('0x43')]['id'],'UserId':null}})[_0xb4a0('0x26')](handleEntityNotFound(_0x4ae46b,null))['then'](saveUpdates(_0x2cc116[_0xb4a0('0x47')],null))[_0xb4a0('0x26')](function(_0x21be91){if(_0x21be91){_0x246fd6[_0xb4a0('0x1b')]=_0x21be91['get']({'plain':!![]});return db[_0xb4a0('0x6c')]['find']({'where':{'id':_0x21be91[_0xb4a0('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x4ae46b,null))[_0xb4a0('0x26')](function(_0x32acc8){if(_0x32acc8){return _0x32acc8[_0xb4a0('0x46')]({'UserId':_0x2cc116[_0xb4a0('0x47')]['UserId'],'read1stAt':_['isNil'](_0x32acc8[_0xb4a0('0x6e')])?moment()['format'](_0xb4a0('0x69')):undefined});}return null;})['then'](function(_0x43c514){if(_0x43c514){_0x246fd6[_0xb4a0('0x6f')]=_0x43c514[_0xb4a0('0x70')]({'plain':!![]});interaction_log[_0xb4a0('0x14')](_0xb4a0('0x71'),_0x2cc116[_0xb4a0('0x6b')]['id'],_0x2cc116[_0xb4a0('0x6b')][_0xb4a0('0x29')],_0x2cc116[_0xb4a0('0x6b')][_0xb4a0('0x72')],_0x246fd6[_0xb4a0('0x6f')]['id'],_0x2cc116[_0xb4a0('0x47')]?JSON[_0xb4a0('0x64')](_0x2cc116['body']):_0xb4a0('0x73'));return respondWithRpcPromise('AcceptMessage',_0xb4a0('0x74'),_0x246fd6);}return null;})[_0xb4a0('0x26')](function(_0x471071){var _0x2f96af='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x471071['message'][_0xb4a0('0x75')];return db[_0xb4a0('0x76')][_0xb4a0('0x30')](_0x2f96af,{'type':db[_0xb4a0('0x77')]['QueryTypes']['SELECT'],'raw':!![]})[_0xb4a0('0x26')](function(_0x2a0a96){return _0x2a0a96;});})[_0xb4a0('0x26')](function(_0x19786f){if(_0x19786f){_0x246fd6[_0xb4a0('0x1b')][_0xb4a0('0x78')]=_0x19786f[0x0];if(!_0x2cc116[_0xb4a0('0x47')]['UserId'])return;return db[_0xb4a0('0x79')][_0xb4a0('0x48')]({'where':{'id':_0x2cc116['body'][_0xb4a0('0x6a')],'role':_0xb4a0('0x7a')},'attributes':['id',_0xb4a0('0x29'),_0xb4a0('0x7b'),_0xb4a0('0x7c'),'internal'],'raw':!![]});}return null;})[_0xb4a0('0x26')](function(_0x8490e3){if(!_0x8490e3)return null;_0x246fd6[_0xb4a0('0x1b')][_0xb4a0('0x7a')]=_0x8490e3;return _0x246fd6;})[_0xb4a0('0x26')](function(_0x28534b){if(_0x28534b){if(_0x2cc116['body'][_0xb4a0('0x7d')]){_0x246fd6[_0xb4a0('0x1b')][_0xb4a0('0x7e')]=util[_0xb4a0('0x63')](_0xb4a0('0x7f'),_0x2cc116[_0xb4a0('0x6b')][_0xb4a0('0x29')]);_0x246fd6[_0xb4a0('0x1b')]['channel']=_0x246fd6[_0xb4a0('0x80')];_0x246fd6[_0xb4a0('0x1b')][_0xb4a0('0x81')]=_0x246fd6['channel'];_0x246fd6[_0xb4a0('0x1b')][_0xb4a0('0x82')]='accept';_0x246fd6[_0xb4a0('0x1b')][_0xb4a0('0x47')]=htmlToText[_0xb4a0('0x83')](_0x246fd6[_0xb4a0('0x1b')][_0xb4a0('0x47')]);return respondWithRpcPromise('EventManager',_0xb4a0('0x84'),{'event':_0xb4a0('0x85'),'message':_0x246fd6['message']},client9002)[_0xb4a0('0x26')](function(){return _0x246fd6;});}return _0x246fd6;}return null;})['then'](respondWithResult(_0x4ae46b,null))[_0xb4a0('0x1d')](handleError(_0x4ae46b,null));};exports['reject']=function(_0x272d54,_0xe2fd18){var _0x5bf69c={'agent':{},'channel':_0xb4a0('0x66')};if(_0x272d54[_0xb4a0('0x47')]['id']){delete _0x272d54['body']['id'];}_0x272d54['body']['UserId']=_0x272d54['body'][_0xb4a0('0x6a')]||_0x272d54[_0xb4a0('0x6b')]['id'];_0x5bf69c[_0xb4a0('0x7a')]['id']=_0x272d54[_0xb4a0('0x47')][_0xb4a0('0x6a')];return db[_0xb4a0('0x41')][_0xb4a0('0x48')]({'where':{'id':_0x272d54['params']['id'],'UserId':null}})[_0xb4a0('0x26')](handleEntityNotFound(_0xe2fd18,null))[_0xb4a0('0x26')](function(_0x3c810b){if(_0x3c810b){_0x5bf69c[_0xb4a0('0x1b')]=_0x3c810b['get']({'plain':!![]});return db[_0xb4a0('0x6c')][_0xb4a0('0x48')]({'where':{'id':_0x3c810b['MailInteractionId']}});}return null;})[_0xb4a0('0x26')](handleEntityNotFound(_0xe2fd18,null))[_0xb4a0('0x26')](function(_0xdeee20){if(_0xdeee20){_0x5bf69c[_0xb4a0('0x6f')]=_0xdeee20[_0xb4a0('0x70')]({'plain':!![]});interaction_log[_0xb4a0('0x14')](_0xb4a0('0x86'),_0x272d54['user']['id'],_0x272d54[_0xb4a0('0x6b')][_0xb4a0('0x29')],_0x272d54[_0xb4a0('0x6b')]['role'],_0x5bf69c[_0xb4a0('0x6f')]['id'],_0x272d54[_0xb4a0('0x47')]?JSON['stringify'](_0x272d54['body']):_0xb4a0('0x73'));return respondWithRpcPromise(_0xb4a0('0x87'),_0xb4a0('0x88'),_0x5bf69c);}return null;})[_0xb4a0('0x26')](function(_0x204c8d){var _0x5c29df=_0xb4a0('0x89')+_0x204c8d['message']['ContactId'];return db['sequelize'][_0xb4a0('0x30')](_0x5c29df,{'type':db[_0xb4a0('0x77')]['QueryTypes'][_0xb4a0('0x8a')],'raw':!![]})[_0xb4a0('0x26')](function(_0x1f2f61){return _0x1f2f61;});})['then'](function(_0x2b7df0){if(_0x2b7df0){_0x5bf69c[_0xb4a0('0x1b')][_0xb4a0('0x78')]=_0x2b7df0[0x0];if(!_0x272d54[_0xb4a0('0x47')][_0xb4a0('0x6a')])return;return db[_0xb4a0('0x79')][_0xb4a0('0x48')]({'where':{'id':_0x272d54['body'][_0xb4a0('0x6a')],'role':_0xb4a0('0x7a')},'attributes':['id',_0xb4a0('0x29'),_0xb4a0('0x7b'),_0xb4a0('0x7c'),_0xb4a0('0x8b')],'raw':!![]});}return null;})[_0xb4a0('0x26')](function(_0x43660b){if(!_0x43660b)return null;_0x5bf69c[_0xb4a0('0x1b')]['agent']=_0x43660b;return _0x5bf69c;})[_0xb4a0('0x26')](function(_0x3f3101){if(_0x3f3101){_0x3f3101[_0xb4a0('0x1b')]['interface']=util[_0xb4a0('0x63')]('SIP/%s',_0x272d54[_0xb4a0('0x6b')]['name']);_0x3f3101[_0xb4a0('0x1b')][_0xb4a0('0x80')]=_0x5bf69c[_0xb4a0('0x80')];_0x3f3101['message'][_0xb4a0('0x81')]=_0x5bf69c['channel'];_0x3f3101[_0xb4a0('0x1b')][_0xb4a0('0x82')]=_0xb4a0('0x8c');_0x3f3101['message'][_0xb4a0('0x47')]=htmlToText[_0xb4a0('0x83')](_0x5bf69c[_0xb4a0('0x1b')][_0xb4a0('0x47')]);respondWithRpcPromise('EventManager',_0xb4a0('0x84'),{'event':_0xb4a0('0x8d'),'message':_0x3f3101[_0xb4a0('0x1b')]},client9002);return _0x5bf69c;}return null;})[_0xb4a0('0x26')](respondWithResult(_0xe2fd18,null))['catch'](handleError(_0xe2fd18,null));};exports[_0xb4a0('0x8e')]=function(_0x4c0651,_0x406713){var _0x139710=moment()['unix']()[_0xb4a0('0x8f')]();var _0x30d315=path['join'](config[_0xb4a0('0x5c')],'server','files',_0xb4a0('0x90'));var _0x54a1e1=path[_0xb4a0('0x5b')](config[_0xb4a0('0x5c')],_0xb4a0('0x91'),_0xb4a0('0x92'),'attachments');var _0x50dc6b=util[_0xb4a0('0x63')](_0xb4a0('0x93'),_0x139710);return db[_0xb4a0('0x41')][_0xb4a0('0x48')]({'where':{'id':_0x4c0651['params']['id']},'attributes':['id',_0xb4a0('0x47'),_0xb4a0('0x94'),'to','cc',_0xb4a0('0x95'),_0xb4a0('0x96'),_0xb4a0('0x97')],'include':_0x4c0651[_0xb4a0('0x30')]['attachments']?[{'model':db[_0xb4a0('0x98')],'as':_0xb4a0('0x99')}]:undefined})['then'](handleEntityNotFound(_0x406713,null))[_0xb4a0('0x26')](function(_0x5e6040){if(_0x5e6040){var _0x38e1d0=_0x5e6040;var _0x33feb6={'from':_0x38e1d0[_0xb4a0('0x94')],'to':_0x38e1d0['to'],'subject':_0x38e1d0[_0xb4a0('0x96')],'html':htmlEntities[_0xb4a0('0x9a')](_0x38e1d0[_0xb4a0('0x47')]),'headers':{'Date':moment(_0x38e1d0[_0xb4a0('0x97')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5e6040['cc']){_0x33feb6[_0xb4a0('0x9b')]['Cc']=_0x5e6040['cc'];}if(_0x5e6040[_0xb4a0('0x95')]){_0x33feb6[_0xb4a0('0x9b')][_0xb4a0('0x9c')]=_0x5e6040['bcc'];}return new BPromise(function(_0x2911d0,_0x423ada){if(_0x5e6040[_0xb4a0('0x99')]){for(var _0x3ff6d0=0x0;_0x3ff6d0<_0x5e6040[_0xb4a0('0x99')][_0xb4a0('0x44')];_0x3ff6d0++){var _0x17e477=_0x5e6040[_0xb4a0('0x99')][_0x3ff6d0];var _0x5ebf13=path[_0xb4a0('0x5b')](_0x54a1e1,_0x17e477['basename']);if(fs[_0xb4a0('0x9d')](_0x5ebf13)){_0x33feb6[_0xb4a0('0x5a')]['push']({'name':_0x17e477[_0xb4a0('0x29')],'contentType':_0x17e477[_0xb4a0('0x2e')],'data':fs['readFileSync'](_0x5ebf13)});}}}emlformat[_0xb4a0('0x9e')](_0x33feb6,function(_0x92b9a8,_0x213b6c){if(_0x92b9a8)return _0x423ada(_0x92b9a8);fs[_0xb4a0('0x9f')](path[_0xb4a0('0x5b')](_0x30d315,_0x50dc6b),_0x213b6c);return _0x2911d0(_0x213b6c);});});}})[_0xb4a0('0x26')](function(_0x2cd090){if(_0x2cd090){return _0x406713['download'](path[_0xb4a0('0x5b')](_0x30d315,_0x50dc6b),_0x50dc6b,function(_0xee987a){if(!_0xee987a)fs[_0xb4a0('0xa0')](path[_0xb4a0('0x5b')](_0x30d315,_0x50dc6b));});}})[_0xb4a0('0x1d')](handleError(_0x406713,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3f2a77e..1860125 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 _0x1861=['update','remove','emit','hasOwnProperty','hook','events','MailMessage','setMaxListeners'];(function(_0x5be4a2,_0x13b83a){var _0x4ca6e7=function(_0x11ea8b){while(--_0x11ea8b){_0x5be4a2['push'](_0x5be4a2['shift']());}};_0x4ca6e7(++_0x13b83a);}(_0x1861,0x1ad));var _0x1186=function(_0x47e88f,_0x505f68){_0x47e88f=_0x47e88f-0x0;var _0x2fea1d=_0x1861[_0x47e88f];return _0x2fea1d;};'use strict';var EventEmitter=require(_0x1186('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x1186('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1186('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1186('0x3'),'afterDestroy':_0x1186('0x4')};function emitEvent(_0x48ad53){return function(_0x1a7c93,_0x540d2a,_0x450915){MailMessageEvents['emit'](_0x48ad53+':'+_0x1a7c93['id'],_0x1a7c93);MailMessageEvents[_0x1186('0x5')](_0x48ad53,_0x1a7c93);_0x450915(null);};}for(var e in events){if(events[_0x1186('0x6')](e)){var event=events[e];MailMessage[_0x1186('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x1c9e=['events','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x34b0c4,_0x15e6a0){var _0x399641=function(_0x25e84a){while(--_0x25e84a){_0x34b0c4['push'](_0x34b0c4['shift']());}};_0x399641(++_0x15e6a0);}(_0x1c9e,0x1ea));var _0xe1c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c9e[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xe1c9('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xe1c9('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe1c9('0x2')](0x0);var events={'afterCreate':_0xe1c9('0x3'),'afterUpdate':_0xe1c9('0x4'),'afterDestroy':_0xe1c9('0x5')};function emitEvent(_0x4e19a7){return function(_0x53f8fb,_0x2b75ae,_0x46b537){MailMessageEvents[_0xe1c9('0x6')](_0x4e19a7+':'+_0x53f8fb['id'],_0x53f8fb);MailMessageEvents[_0xe1c9('0x6')](_0x4e19a7,_0x53f8fb);_0x46b537(null);};}for(var e in events){if(events[_0xe1c9('0x7')](e)){var event=events[e];MailMessage[_0xe1c9('0x8')](e,emitEvent(event));}}module[_0xe1c9('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 83c61a2..1eb83c6 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 _0xc562=['api','bluebird','path','rimraf','../../config/environment','./mailMessage.attributes','exports','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','get','direction','toLowerCase','secret','UserId','MailInteraction','findOne','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x8d5672,_0x39c930){var _0x31e54f=function(_0x1a4d8d){while(--_0x1a4d8d){_0x8d5672['push'](_0x8d5672['shift']());}};_0x31e54f(++_0x39c930);}(_0xc562,0xdd));var _0x2c56=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc562[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x2c56('0x0'));var util=require(_0x2c56('0x1'));var logger=require(_0x2c56('0x2'))(_0x2c56('0x3'));var moment=require('moment');var BPromise=require(_0x2c56('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x2c56('0x5'));var rimraf=require(_0x2c56('0x6'));var config=require(_0x2c56('0x7'));var attributes=require(_0x2c56('0x8'));module[_0x2c56('0x9')]=function(_0x27101b,_0x37bf6c){return _0x27101b['define']('MailMessage',attributes,{'tableName':_0x2c56('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2c56('0xb')]},{'name':_0x2c56('0xc'),'fields':[_0x2c56('0xd'),'subject'],'type':_0x2c56('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x43946f,_0x24a314,_0x4b491c){if(_0x43946f[_0x2c56('0xf')]){_0x43946f[_0x2c56('0xd')]=htmlToText['fromString'](_0x43946f[_0x2c56('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4b491c(null,_0x24a314);},'afterCreate':function(_0x536e00,_0x30aabc,_0x250e57){var _0x441b01=_0x27101b['models'];var _0x2e4ef0=_0x536e00[_0x2c56('0x10')]({'plain':!![]});if(_0x2e4ef0[_0x2c56('0x11')]['toLowerCase']()==='in'||_0x2e4ef0['direction'][_0x2c56('0x12')]()==='out'&&!_0x2e4ef0[_0x2c56('0x13')]&&!_['isNil'](_0x2e4ef0[_0x2c56('0x14')])){_0x441b01[_0x2c56('0x15')][_0x2c56('0x16')]({'where':{'id':_0x2e4ef0['MailInteractionId']}})[_0x2c56('0x17')](function(_0x1c7031){if(_0x1c7031){_0x1c7031[_0x2c56('0x18')]({'lastMsgAt':_0x2e4ef0[_0x2c56('0x19')],'lastMsgDirection':_0x2e4ef0[_0x2c56('0x11')][_0x2c56('0x12')]()});}})[_0x2c56('0x1a')](function(_0x1742f4){console['error'](_0x1742f4);});}_0x250e57();}},'charset':'utf8mb4','collate':_0x2c56('0x1b')});}; \ No newline at end of file +var _0x9e1c=['define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','error','../../config/logger','api','moment','bluebird','html-to-text','path','../../config/environment','./mailMessage.attributes','exports'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x9e1c,0x177));var _0xc9e1=function(_0x44e66a,_0x19b577){_0x44e66a=_0x44e66a-0x0;var _0x4bc408=_0x9e1c[_0x44e66a];return _0x4bc408;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc9e1('0x0'))(_0xc9e1('0x1'));var moment=require(_0xc9e1('0x2'));var BPromise=require(_0xc9e1('0x3'));var rp=require('request-promise');var htmlToText=require(_0xc9e1('0x4'));var fs=require('fs');var path=require(_0xc9e1('0x5'));var rimraf=require('rimraf');var config=require(_0xc9e1('0x6'));var attributes=require(_0xc9e1('0x7'));module[_0xc9e1('0x8')]=function(_0x29ed81,_0x16dd25){return _0x29ed81[_0xc9e1('0x9')](_0xc9e1('0xa'),attributes,{'tableName':_0xc9e1('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xc9e1('0xc')]},{'name':_0xc9e1('0xd'),'fields':[_0xc9e1('0xe'),_0xc9e1('0xf')],'type':_0xc9e1('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x549f1f,_0xe759a4,_0x33d89d){if(_0x549f1f[_0xc9e1('0x11')]){_0x549f1f[_0xc9e1('0xe')]=htmlToText[_0xc9e1('0x12')](_0x549f1f[_0xc9e1('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x33d89d(null,_0xe759a4);},'afterCreate':function(_0x20d5c9,_0xc76720,_0xbee680){var _0x3cef58=_0x29ed81['models'];var _0x12de89=_0x20d5c9[_0xc9e1('0x13')]({'plain':!![]});if(_0x12de89[_0xc9e1('0x14')]['toLowerCase']()==='in'||_0x12de89[_0xc9e1('0x14')][_0xc9e1('0x15')]()===_0xc9e1('0x16')&&!_0x12de89[_0xc9e1('0x17')]&&!_[_0xc9e1('0x18')](_0x12de89[_0xc9e1('0x19')])){_0x3cef58[_0xc9e1('0x1a')][_0xc9e1('0x1b')]({'where':{'id':_0x12de89[_0xc9e1('0x1c')]}})[_0xc9e1('0x1d')](function(_0x3448c7){if(_0x3448c7){_0x3448c7[_0xc9e1('0x1e')]({'lastMsgAt':_0x12de89['createdAt'],'lastMsgDirection':_0x12de89[_0xc9e1('0x14')][_0xc9e1('0x15')]()});}})['catch'](function(_0x126b88){console[_0xc9e1('0x1f')](_0x126b88);});}_0xbee680();}},'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 e2470ad..68a1395 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 _0x2032=['register','request','MailMessage,\x20%s,\x20%s','request\x20sent','error','message','info','result','CreateMailMessage','create','options','then','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2032,0xd9));var _0x2203=function(_0xbeca1a,_0x10f7ce){_0xbeca1a=_0xbeca1a-0x0;var _0x1e00c0=_0x2032[_0xbeca1a];return _0x1e00c0;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});config[_0x2203('0xb')]=_[_0x2203('0xc')](config[_0x2203('0xb')],{'host':_0x2203('0xd'),'port':0x18eb});var socket=require(_0x2203('0xe'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x2203('0xf')](socket);function respondWithRpcPromise(_0x549908,_0x27081c,_0x2972f3){return new BPromise(function(_0x6339c4,_0x5b19df){return client[_0x2203('0x10')](_0x549908,_0x2972f3)['then'](function(_0x3f690a){logger['info'](_0x2203('0x11'),_0x27081c,_0x2203('0x12'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x27081c,'request\x20sent',JSON['stringify'](_0x3f690a));if(_0x3f690a['error']){if(_0x3f690a[_0x2203('0x13')]['code']===0x1f4){logger['error'](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x5b19df(_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);}logger[_0x2203('0x13')](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x6339c4(_0x3f690a[_0x2203('0x13')]['message']);}else{logger[_0x2203('0x15')](_0x2203('0x11'),_0x27081c,'request\x20sent');_0x6339c4(_0x3f690a[_0x2203('0x16')][_0x2203('0x14')]);}})['catch'](function(_0x30c6f7){logger['error'](_0x2203('0x11'),_0x27081c,_0x30c6f7);_0x5b19df(_0x30c6f7);});});}exports[_0x2203('0x17')]=function(_0x3c8c34){var _0x3b4034=this;return new Promise(function(_0x15cb1a,_0x449039){return db['MailMessage'][_0x2203('0x18')](_0x3c8c34['body'],{'raw':_0x3c8c34['options']?_0x3c8c34[_0x2203('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2203('0x1a')](function(_0x5bfe61){logger['info'](_0x2203('0x17'),_0x3c8c34);logger['debug']('CreateMailMessage',_0x3c8c34,JSON[_0x2203('0x1b')](_0x5bfe61));_0x15cb1a(_0x5bfe61);})[_0x2203('0x1c')](function(_0x21f930){logger[_0x2203('0x13')](_0x2203('0x17'),_0x21f930[_0x2203('0x14')],_0x3c8c34);_0x449039(_0x3b4034[_0x2203('0x13')](0x1f4,_0x21f930[_0x2203('0x14')]));});});}; \ No newline at end of file +var _0x583c=['request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','CreateMailMessage','MailMessage','create','body','options','raw','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x1b08d4,_0x8a710c){var _0x9aef3e=function(_0x4da607){while(--_0x4da607){_0x1b08d4['push'](_0x1b08d4['shift']());}};_0x9aef3e(++_0x8a710c);}(_0x583c,0x12b));var _0xc583=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0x583c[_0x2e819c];return _0x24e271;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});config[_0xc583('0xa')]=_[_0xc583('0xb')](config['redis'],{'host':_0xc583('0xc'),'port':0x18eb});var socket=require(_0xc583('0xd'))(new Redis(config['redis']));require(_0xc583('0xe'))[_0xc583('0xf')](socket);function respondWithRpcPromise(_0x25f8d3,_0xb23f07,_0x2d99ca){return new BPromise(function(_0x550b1e,_0x3437be){return client[_0xc583('0x10')](_0x25f8d3,_0x2d99ca)['then'](function(_0x23c51a){logger[_0xc583('0x11')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0xc583('0x12'));logger[_0xc583('0x13')](_0xc583('0x14'),_0xb23f07,_0xc583('0x12'),JSON[_0xc583('0x15')](_0x23c51a));if(_0x23c51a[_0xc583('0x16')]){if(_0x23c51a[_0xc583('0x16')][_0xc583('0x17')]===0x1f4){logger[_0xc583('0x16')]('MailMessage,\x20%s,\x20%s',_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x3437be(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}logger['error'](_0xc583('0x19'),_0xb23f07,_0x23c51a[_0xc583('0x16')]['message']);return _0x550b1e(_0x23c51a[_0xc583('0x16')][_0xc583('0x18')]);}else{logger['info'](_0xc583('0x19'),_0xb23f07,_0xc583('0x12'));_0x550b1e(_0x23c51a[_0xc583('0x1a')][_0xc583('0x18')]);}})['catch'](function(_0x3dd3cc){logger['error'](_0xc583('0x19'),_0xb23f07,_0x3dd3cc);_0x3437be(_0x3dd3cc);});});}exports[_0xc583('0x1b')]=function(_0xfd9a60){var _0x774f4c=this;return new Promise(function(_0x1052b5,_0x12b910){return db[_0xc583('0x1c')][_0xc583('0x1d')](_0xfd9a60[_0xc583('0x1e')],{'raw':_0xfd9a60[_0xc583('0x1f')]?_0xfd9a60[_0xc583('0x1f')][_0xc583('0x20')]===undefined?!![]:![]:!![]})[_0xc583('0x21')](function(_0x478ee1){logger['info'](_0xc583('0x1b'),_0xfd9a60);logger[_0xc583('0x13')](_0xc583('0x1b'),_0xfd9a60,JSON['stringify'](_0x478ee1));_0x1052b5(_0x478ee1);})[_0xc583('0x22')](function(_0x959500){logger[_0xc583('0x16')](_0xc583('0x1b'),_0x959500[_0xc583('0x18')],_0xfd9a60);_0x12b910(_0x774f4c['error'](0x1f4,_0x959500['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 9880ffe..2090fdd 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 _0x4aca=['mailMessage:','save','update','emit','removeListener','register','length'];(function(_0x379e79,_0x39a5a8){var _0x545fea=function(_0x129b12){while(--_0x129b12){_0x379e79['push'](_0x379e79['shift']());}};_0x545fea(++_0x39a5a8);}(_0x4aca,0x1dd));var _0xa4ac=function(_0x3d87a0,_0x7c8a7a){_0x3d87a0=_0x3d87a0-0x0;var _0x4ea445=_0x4aca[_0x3d87a0];return _0x4ea445;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xa4ac('0x0'),'remove',_0xa4ac('0x1')];function createListener(_0x208527,_0x492f5f){return function(_0x7c7490){_0x492f5f[_0xa4ac('0x2')](_0x208527,_0x7c7490);};}function removeListener(_0x3982f4,_0x5a36cd){return function(){MailMessageEvents[_0xa4ac('0x3')](_0x3982f4,_0x5a36cd);};}exports[_0xa4ac('0x4')]=function(_0x565525){for(var _0x552405=0x0,_0x26ca6f=events[_0xa4ac('0x5')];_0x552405<_0x26ca6f;_0x552405++){var _0x1b5380=events[_0x552405];var _0x3797b0=createListener(_0xa4ac('0x6')+_0x1b5380,_0x565525);MailMessageEvents['on'](_0x1b5380,_0x3797b0);}}; \ No newline at end of file +var _0x0c02=['save','remove','emit','removeListener','register','mailMessage:'];(function(_0x4d0bca,_0x4711aa){var _0x3a1dbd=function(_0x5a9c57){while(--_0x5a9c57){_0x4d0bca['push'](_0x4d0bca['shift']());}};_0x3a1dbd(++_0x4711aa);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x20c0('0x0'),_0x20c0('0x1'),'update'];function createListener(_0x1338cf,_0x5c8750){return function(_0x454922){_0x5c8750[_0x20c0('0x2')](_0x1338cf,_0x454922);};}function removeListener(_0x38022e,_0x2e9d65){return function(){MailMessageEvents[_0x20c0('0x3')](_0x38022e,_0x2e9d65);};}exports[_0x20c0('0x4')]=function(_0x13312d){for(var _0xd25ee8=0x0,_0x5d6408=events['length'];_0xd25ee8<_0x5d6408;_0xd25ee8++){var _0x5da127=events[_0xd25ee8];var _0x4db532=createListener(_0x20c0('0x5')+_0x5da127,_0x13312d);MailMessageEvents['on'](_0x5da127,_0x4db532);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 570b0ca..b412db4 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 _0x381c=['isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x24df34,_0x50aa1a){var _0x3980e8=function(_0x24c43f){while(--_0x24c43f){_0x24df34['push'](_0x24df34['shift']());}};_0x3980e8(++_0x50aa1a);}(_0x381c,0x6b));var _0xc381=function(_0x33189c,_0x1035ef){_0x33189c=_0x33189c-0x0;var _0x2885fb=_0x381c[_0x33189c];return _0x2885fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc381('0x0'));var timeout=require('connect-timeout');var express=require(_0xc381('0x1'));var router=express[_0xc381('0x2')]();var fs_extra=require(_0xc381('0x3'));var auth=require(_0xc381('0x4'));var interaction=require(_0xc381('0x5'));var config=require(_0xc381('0x6'));var controller=require('./mailQueue.controller');router[_0xc381('0x7')]('/',auth['isAuthenticated'](),controller[_0xc381('0x8')]);router[_0xc381('0x7')]('/describe',auth[_0xc381('0x9')](),controller[_0xc381('0xa')]);router[_0xc381('0x7')](_0xc381('0xb'),auth[_0xc381('0x9')](),controller[_0xc381('0xc')]);router[_0xc381('0x7')](_0xc381('0xd'),auth[_0xc381('0x9')](),controller[_0xc381('0xe')]);router[_0xc381('0x7')](_0xc381('0xf'),auth[_0xc381('0x9')](),controller[_0xc381('0x10')]);router[_0xc381('0x7')](_0xc381('0x11'),auth[_0xc381('0x9')](),controller[_0xc381('0x12')]);router[_0xc381('0x13')]('/',auth['isAuthenticated'](),controller[_0xc381('0x14')]);router[_0xc381('0x13')]('/:id/teams',auth[_0xc381('0x9')](),controller[_0xc381('0x15')]);router[_0xc381('0x13')]('/:id/users',auth[_0xc381('0x9')](),controller[_0xc381('0x16')]);router[_0xc381('0x17')](_0xc381('0xb'),auth[_0xc381('0x9')](),controller['update']);router[_0xc381('0x18')](_0xc381('0xb'),auth[_0xc381('0x9')](),controller[_0xc381('0x19')]);router[_0xc381('0x18')]('/:id/teams',auth[_0xc381('0x9')](),controller[_0xc381('0x1a')]);router['delete'](_0xc381('0x11'),auth[_0xc381('0x9')](),controller[_0xc381('0x1b')]);module[_0xc381('0x1c')]=router; \ No newline at end of file +var _0x7b05=['post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7b05,0x69));var _0x57b0=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x7b05[_0x8c8176];return _0x4dc47b;};'use strict';var multer=require(_0x57b0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x57b0('0x1'));var express=require(_0x57b0('0x2'));var router=express['Router']();var fs_extra=require(_0x57b0('0x3'));var auth=require(_0x57b0('0x4'));var interaction=require(_0x57b0('0x5'));var config=require(_0x57b0('0x6'));var controller=require(_0x57b0('0x7'));router[_0x57b0('0x8')]('/',auth[_0x57b0('0x9')](),controller[_0x57b0('0xa')]);router[_0x57b0('0x8')](_0x57b0('0xb'),auth[_0x57b0('0x9')](),controller[_0x57b0('0xc')]);router[_0x57b0('0x8')](_0x57b0('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x57b0('0x8')](_0x57b0('0xe'),auth[_0x57b0('0x9')](),controller[_0x57b0('0xf')]);router['get'](_0x57b0('0x10'),auth[_0x57b0('0x9')](),controller[_0x57b0('0x11')]);router[_0x57b0('0x8')]('/:id/users',auth[_0x57b0('0x9')](),controller[_0x57b0('0x12')]);router[_0x57b0('0x13')]('/',auth[_0x57b0('0x9')](),controller[_0x57b0('0x14')]);router[_0x57b0('0x13')](_0x57b0('0x10'),auth[_0x57b0('0x9')](),controller[_0x57b0('0x15')]);router['post']('/:id/users',auth[_0x57b0('0x9')](),controller[_0x57b0('0x16')]);router[_0x57b0('0x17')](_0x57b0('0xd'),auth[_0x57b0('0x9')](),controller[_0x57b0('0x18')]);router[_0x57b0('0x19')](_0x57b0('0xd'),auth[_0x57b0('0x9')](),controller[_0x57b0('0x1a')]);router['delete'](_0x57b0('0x10'),auth[_0x57b0('0x9')](),controller[_0x57b0('0x1b')]);router[_0x57b0('0x19')](_0x57b0('0x1c'),auth['isAuthenticated'](),controller[_0x57b0('0x1d')]);module[_0x57b0('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 7ad803e..4170d59 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 _0x38dd=['INTEGER','ENUM','rrmemory','sequelize','exports','STRING','name'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x38dd,0x168));var _0xd38d=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x38dd[_0x470bfb];return _0x2f5d97;};'use strict';var Sequelize=require(_0xd38d('0x0'));module[_0xd38d('0x1')]={'name':{'type':Sequelize[_0xd38d('0x2')],'unique':_0xd38d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd38d('0x2')]},'timeout':{'type':Sequelize[_0xd38d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd38d('0x5')](_0xd38d('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x13ed=['beepall','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x13ed,0x78));var _0xd13e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x13ed[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require('sequelize');module[_0xd13e('0x0')]={'name':{'type':Sequelize[_0xd13e('0x1')],'unique':_0xd13e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd13e('0x1')]},'timeout':{'type':Sequelize[_0xd13e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd13e('0x4')](_0xd13e('0x5'),_0xd13e('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 6d89144..cb5f688 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 _0x144e=['getOptions','MailQueue','include','findAll','rows','catch','show','model','keys','query','intersection','attributes','fields','length','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','UserMailQueue','filters','hasOwnProperty','nolimit','order','sort','pick','where','filter','User','findAndCountAll','map','UserId','mailPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','then','get','MailQueues','UserProfileResource','destroy','name','send','index','rawAttributes','type','key'];(function(_0x14c69c,_0x4754f2){var _0x47fcb5=function(_0x379470){while(--_0x379470){_0x14c69c['push'](_0x14c69c['shift']());}};_0x47fcb5(++_0x4754f2);}(_0x144e,0x1c6));var _0xe144=function(_0x557c43,_0x385f43){_0x557c43=_0x557c43-0x0;var _0x3fecda=_0x144e[_0x557c43];return _0x3fecda;};'use strict';var BPromise=require(_0xe144('0x0'));var util=require(_0xe144('0x1'));var _=require('lodash');var squel=require(_0xe144('0x2'));var Redis=require(_0xe144('0x3'));var qs=require(_0xe144('0x4'));var logger=require(_0xe144('0x5'))(_0xe144('0x6'));var config=require(_0xe144('0x7'));var db=require(_0xe144('0x8'))['db'];config['redis']=_['defaults'](config[_0xe144('0x9')],{'host':_0xe144('0xa'),'port':0x18eb});var socket=require(_0xe144('0xb'))(new Redis(config[_0xe144('0x9')]));require(_0xe144('0xc'))[_0xe144('0xd')](socket);function respondWithStatusCode(_0x43fdf0,_0x310b07){_0x310b07=_0x310b07||0xcc;return function(_0x350622){if(_0x350622){return _0x43fdf0[_0xe144('0xe')](_0x310b07);}return _0x43fdf0[_0xe144('0xf')](_0x310b07)[_0xe144('0x10')]();};}function respondWithResult(_0x14f1d2,_0xea8de8){_0xea8de8=_0xea8de8||0xc8;return function(_0x3cca7f){if(_0x3cca7f){return _0x14f1d2[_0xe144('0xf')](_0xea8de8)[_0xe144('0x11')](_0x3cca7f);}};}function respondWithFilteredResult(_0x494128,_0x1b0119){return function(_0x4fd91d){if(_0x4fd91d){var _0x1b40f2=typeof _0x1b0119[_0xe144('0x12')]===_0xe144('0x13')&&typeof _0x1b0119['limit']===_0xe144('0x13');var _0x2f1b0d=_0x4fd91d[_0xe144('0x14')];var _0x3f7b19=_0x1b40f2?0x0:_0x1b0119[_0xe144('0x12')];var _0xf23ca2=_0x1b40f2?_0x4fd91d[_0xe144('0x14')]:_0x1b0119[_0xe144('0x12')]+_0x1b0119[_0xe144('0x15')];var _0x235f3a;if(_0xf23ca2>=_0x2f1b0d){_0xf23ca2=_0x2f1b0d;_0x235f3a=0xc8;}else{_0x235f3a=0xce;}_0x494128['status'](_0x235f3a);return _0x494128[_0xe144('0x16')]('Content-Range',_0x3f7b19+'-'+_0xf23ca2+'/'+_0x2f1b0d)[_0xe144('0x11')](_0x4fd91d);}return null;};}function saveUpdates(_0xa7f517){return function(_0x2448a0){if(_0x2448a0){return _0x2448a0['update'](_0xa7f517)[_0xe144('0x17')](function(_0x564cbb){return _0x564cbb;});}return null;};}function removeEntity(_0x5392ba){return function(_0x22a438){if(_0x22a438){return _0x22a438['destroy']()[_0xe144('0x17')](function(){var _0x485946=_0x22a438[_0xe144('0x18')]({'plain':!![]});var _0x5c2ef0=_0xe144('0x19');return db[_0xe144('0x1a')][_0xe144('0x1b')]({'where':{'type':_0x5c2ef0,'resourceId':_0x485946['id']}})['then'](function(){return _0x22a438;});})[_0xe144('0x17')](function(){_0x5392ba[_0xe144('0xf')](0xcc)[_0xe144('0x10')]();});}};}function handleEntityNotFound(_0x1eb8d4){return function(_0x1c2cf6){if(!_0x1c2cf6){_0x1eb8d4[_0xe144('0xe')](0x194);}return _0x1c2cf6;};}function handleError(_0x396b19,_0x42519b){_0x42519b=_0x42519b||0x1f4;return function(_0x557c4d){logger['error'](_0x557c4d['stack']);if(_0x557c4d[_0xe144('0x1c')]){delete _0x557c4d[_0xe144('0x1c')];}_0x396b19[_0xe144('0xf')](_0x42519b)[_0xe144('0x1d')](_0x557c4d);};}exports[_0xe144('0x1e')]=function(_0x3feabc,_0x5e4913){var _0x5d0e9c={};var _0x3ede4a={'count':0x0,'rows':[]};var _0x13ffd3=_['map'](db['MailQueue'][_0xe144('0x1f')],function(_0x2ea90f){return{'name':_0x2ea90f['fieldName'],'type':_0x2ea90f[_0xe144('0x20')][_0xe144('0x21')]};});_0x5d0e9c=qs[_0xe144('0x22')](_0x13ffd3,_0x3feabc);var _0x3fe1f9={'where':_0x5d0e9c['where']};return db[_0xe144('0x23')][_0xe144('0x14')](_0x3fe1f9)[_0xe144('0x17')](function(_0x584ebd){_0x3ede4a['count']=_0x584ebd;_0x5d0e9c[_0xe144('0x24')]=qs[_0xe144('0x24')](_0x3feabc['query']);return db['MailQueue'][_0xe144('0x25')](_0x5d0e9c);})['then'](function(_0x1d7b97){_0x3ede4a[_0xe144('0x26')]=_0x1d7b97;return _0x3ede4a;})[_0xe144('0x17')](respondWithFilteredResult(_0x5e4913,_0x5d0e9c))[_0xe144('0x27')](handleError(_0x5e4913,null));};exports[_0xe144('0x28')]=function(_0x355498,_0x28daf0){var _0x16236c={'raw':!![],'where':{'id':_0x355498['params']['id']}},_0x47ec0d={};_0x47ec0d[_0xe144('0x29')]=_[_0xe144('0x2a')](db['MailQueue'][_0xe144('0x1f')]);_0x47ec0d[_0xe144('0x2b')]=_[_0xe144('0x2a')](_0x355498[_0xe144('0x2b')]);_0x47ec0d['filters']=_[_0xe144('0x2c')](_0x47ec0d[_0xe144('0x29')],_0x47ec0d['query']);_0x16236c[_0xe144('0x2d')]=_['intersection'](_0x47ec0d['model'],qs['fields'](_0x355498[_0xe144('0x2b')][_0xe144('0x2e')]));_0x16236c[_0xe144('0x2d')]=_0x16236c[_0xe144('0x2d')][_0xe144('0x2f')]?_0x16236c['attributes']:_0x47ec0d[_0xe144('0x29')];if(_0x355498['query']['includeAll']){_0x16236c[_0xe144('0x24')]=[{'all':!![]}];}_0x16236c=_[_0xe144('0x30')]({},_0x16236c,_0x355498[_0xe144('0x31')]);return db['MailQueue'][_0xe144('0x32')](_0x16236c)[_0xe144('0x17')](handleEntityNotFound(_0x28daf0,null))[_0xe144('0x17')](respondWithResult(_0x28daf0,null))[_0xe144('0x27')](handleError(_0x28daf0,null));};exports[_0xe144('0x33')]=function(_0x506fda,_0x2d168a){return db[_0xe144('0x23')][_0xe144('0x33')](_0x506fda[_0xe144('0x34')],{})[_0xe144('0x17')](function(_0x385f8f){var _0x4790fc=_0x506fda['user'][_0xe144('0x18')]({'plain':!![]});if(!_0x4790fc)throw new Error(_0xe144('0x35'));if(_0x4790fc['role']===_0xe144('0x36')){var _0x55e6ac=_0x385f8f[_0xe144('0x18')]({'plain':!![]});var _0x41d9fd=_0xe144('0x19');return db[_0xe144('0x37')][_0xe144('0x32')]({'where':{'name':_0x41d9fd,'userProfileId':_0x4790fc[_0xe144('0x38')]},'raw':!![]})['then'](function(_0x5e3751){if(_0x5e3751&&_0x5e3751[_0xe144('0x39')]===0x0){return db[_0xe144('0x1a')][_0xe144('0x33')]({'name':_0x55e6ac[_0xe144('0x1c')],'resourceId':_0x55e6ac['id'],'type':_0x5e3751[_0xe144('0x1c')],'sectionId':_0x5e3751['id']},{})[_0xe144('0x17')](function(){return _0x385f8f;});}else{return _0x385f8f;}})['catch'](function(_0x258dd6){logger[_0xe144('0x3a')](_0xe144('0x3b'),_0x258dd6);throw _0x258dd6;});}return _0x385f8f;})[_0xe144('0x17')](respondWithResult(_0x2d168a,0xc9))[_0xe144('0x27')](handleError(_0x2d168a,null));};exports[_0xe144('0x3c')]=function(_0x9822e9,_0x48cb43){if(_0x9822e9[_0xe144('0x34')]['id']){delete _0x9822e9[_0xe144('0x34')]['id'];}return db[_0xe144('0x23')][_0xe144('0x32')]({'where':{'id':_0x9822e9[_0xe144('0x3d')]['id']}})[_0xe144('0x17')](handleEntityNotFound(_0x48cb43,null))[_0xe144('0x17')](saveUpdates(_0x9822e9[_0xe144('0x34')],null))[_0xe144('0x17')](respondWithResult(_0x48cb43,null))['catch'](handleError(_0x48cb43,null));};exports['destroy']=function(_0x1324ea,_0x2f1d3b){return db[_0xe144('0x23')][_0xe144('0x32')]({'where':{'id':_0x1324ea[_0xe144('0x3d')]['id']}})[_0xe144('0x17')](handleEntityNotFound(_0x2f1d3b,null))['then'](removeEntity(_0x2f1d3b,null))[_0xe144('0x27')](handleError(_0x2f1d3b,null));};exports['describe']=function(_0x4d33b3,_0x159c15){return db[_0xe144('0x23')][_0xe144('0x3e')]()[_0xe144('0x17')](respondWithResult(_0x159c15,null))[_0xe144('0x27')](handleError(_0x159c15,null));};exports['getMembers']=function(_0x2c3f9f,_0xda276d){var _0x46a100={'raw':!![],'where':{}},_0x567c00={},_0x38a8e8;return db[_0xe144('0x23')][_0xe144('0x3f')]({'where':{'id':_0x2c3f9f[_0xe144('0x3d')]['id']}})[_0xe144('0x17')](handleEntityNotFound(_0xda276d,null))[_0xe144('0x17')](function(_0x271610){if(_0x271610){_0x38a8e8=_0x271610[_0xe144('0x18')]({'plain':!![]});_0x567c00[_0xe144('0x29')]=_['keys'](db[_0xe144('0x40')][_0xe144('0x1f')]);_0x567c00['query']=_[_0xe144('0x2a')](_0x2c3f9f[_0xe144('0x2b')]);_0x567c00[_0xe144('0x41')]=_['intersection'](_0x567c00[_0xe144('0x29')],_0x567c00[_0xe144('0x2b')]);_0x46a100[_0xe144('0x2d')]=_[_0xe144('0x2c')](_0x567c00[_0xe144('0x29')],qs[_0xe144('0x2e')](_0x2c3f9f[_0xe144('0x2b')][_0xe144('0x2e')]));_0x46a100[_0xe144('0x2d')]=_0x46a100[_0xe144('0x2d')][_0xe144('0x2f')]?_0x46a100[_0xe144('0x2d')]:_0x567c00[_0xe144('0x29')];if(!_0x2c3f9f[_0xe144('0x2b')][_0xe144('0x42')](_0xe144('0x43'))){_0x46a100['limit']=qs[_0xe144('0x15')](_0x2c3f9f[_0xe144('0x2b')][_0xe144('0x15')]);_0x46a100['offset']=qs['offset'](_0x2c3f9f[_0xe144('0x2b')]['offset']);}_0x46a100[_0xe144('0x44')]=qs['sort'](_0x2c3f9f[_0xe144('0x2b')][_0xe144('0x45')]);_0x46a100['where']=qs[_0xe144('0x41')](_[_0xe144('0x46')](_0x2c3f9f[_0xe144('0x2b')],_0x567c00[_0xe144('0x41')]));_0x46a100[_0xe144('0x47')]['MailQueueId']=_0x271610['id'];if(_0x2c3f9f['query']['filter']){_0x46a100[_0xe144('0x47')]=_[_0xe144('0x30')](_0x46a100[_0xe144('0x47')],{'$or':_['map'](_0x46a100['attributes'],function(_0x329723){var _0x41b73d={};_0x41b73d[_0x329723]={'$like':'%'+_0x2c3f9f[_0xe144('0x2b')][_0xe144('0x48')]+'%'};return _0x41b73d;})});}_0x46a100=_['merge']({},_0x46a100,_0x2c3f9f['options']);return db[_0xe144('0x40')]['findAll'](_0x46a100);}})[_0xe144('0x17')](function(_0x62b859){if(_0x62b859){return db[_0xe144('0x49')][_0xe144('0x4a')]({'where':{'id':_[_0xe144('0x4b')](_0x62b859,_0xe144('0x4c')),'role':'agent'},'attributes':['id',_0xe144('0x1c'),_0xe144('0x4d'),_0xe144('0x4e'),_0xe144('0x4f')]});}})['then'](function(_0x4fcc92){if(_0x4fcc92){return{'count':_0x4fcc92['count'],'rows':_['map'](_0x4fcc92[_0xe144('0x26')],function(_0x13e4fc){return{'membername':_0x13e4fc['name'],'UserId':_0x13e4fc['id'],'queue_name':_0x38a8e8[_0xe144('0x1c')],'MailQueueId':_0x38a8e8['id'],'interface':util['format'](_0xe144('0x50'),_0xe144('0x51'),_0x13e4fc[_0xe144('0x1c')]),'penalty':0x0,'paused':_0x13e4fc['mailPause'],'createdAt':_0x13e4fc[_0xe144('0x4f')],'updatedAt':_0x13e4fc[_0xe144('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe144('0x17')](respondWithFilteredResult(_0xda276d,_0x46a100))[_0xe144('0x27')](handleError(_0xda276d,null));};exports['getTeams']=function(_0x708eed,_0x2be380){var _0x4c8553={};var _0x516cf0={};var _0x31ac2a;var _0x27e0f2;return db[_0xe144('0x23')][_0xe144('0x3f')]({'where':{'id':_0x708eed[_0xe144('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2be380,null))[_0xe144('0x17')](function(_0x3eb469){if(_0x3eb469){_0x31ac2a=_0x3eb469;_0x516cf0[_0xe144('0x29')]=_[_0xe144('0x2a')](db[_0xe144('0x52')][_0xe144('0x1f')]);_0x516cf0[_0xe144('0x2b')]=_[_0xe144('0x2a')](_0x708eed[_0xe144('0x2b')]);_0x516cf0[_0xe144('0x41')]=_[_0xe144('0x2c')](_0x516cf0[_0xe144('0x29')],_0x516cf0[_0xe144('0x2b')]);_0x4c8553[_0xe144('0x2d')]=_[_0xe144('0x2c')](_0x516cf0[_0xe144('0x29')],qs['fields'](_0x708eed[_0xe144('0x2b')][_0xe144('0x2e')]));_0x4c8553[_0xe144('0x2d')]=_0x4c8553['attributes'][_0xe144('0x2f')]?_0x4c8553[_0xe144('0x2d')]:_0x516cf0[_0xe144('0x29')];_0x4c8553['order']=qs['sort'](_0x708eed['query']['sort']);_0x4c8553[_0xe144('0x47')]=qs[_0xe144('0x41')](_[_0xe144('0x46')](_0x708eed[_0xe144('0x2b')],_0x516cf0[_0xe144('0x41')]));if(_0x708eed[_0xe144('0x2b')][_0xe144('0x48')]){_0x4c8553[_0xe144('0x47')]=_[_0xe144('0x30')](_0x4c8553[_0xe144('0x47')],{'$or':_[_0xe144('0x4b')](_0x4c8553[_0xe144('0x2d')],function(_0x2c1d54){var _0x4e25b0={};_0x4e25b0[_0x2c1d54]={'$like':'%'+_0x708eed[_0xe144('0x2b')]['filter']+'%'};return _0x4e25b0;})});}_0x4c8553=_[_0xe144('0x30')]({},_0x4c8553,_0x708eed[_0xe144('0x31')]);return _0x31ac2a['getTeams'](_0x4c8553);}})['then'](function(_0x4fad17){if(_0x4fad17){_0x27e0f2=_0x4fad17[_0xe144('0x2f')];if(!_0x708eed[_0xe144('0x2b')][_0xe144('0x42')](_0xe144('0x43'))){_0x4c8553[_0xe144('0x15')]=qs[_0xe144('0x15')](_0x708eed['query'][_0xe144('0x15')]);_0x4c8553[_0xe144('0x12')]=qs['offset'](_0x708eed[_0xe144('0x2b')]['offset']);}return _0x31ac2a[_0xe144('0x53')](_0x4c8553);}})[_0xe144('0x17')](function(_0x3bae19){if(_0x3bae19){return _0x3bae19?{'count':_0x27e0f2,'rows':_0x3bae19}:null;}})['then'](respondWithResult(_0x2be380,null))['catch'](handleError(_0x2be380,null));};exports['addTeams']=function(_0x3cb622,_0x5dcb58){var _0x11c1de=_0x3cb622[_0xe144('0x34')][_0xe144('0x54')];return db['Team'][_0xe144('0x25')]({'where':{'id':_0x11c1de},'attributes':['id'],'include':[{'model':db[_0xe144('0x49')],'as':_0xe144('0x55'),'attributes':['id',_0xe144('0x1c'),'online',_0xe144('0x56'),_0xe144('0x57')],'raw':!![]}]})[_0xe144('0x17')](function(_0x3c09c6){if(_0x3c09c6){var _0x41857a=_[_0xe144('0x58')](_0x3c09c6,function(_0x153442){var _0x2ea4ab=_0x153442[_0xe144('0x18')]({'plain':!![]});return _0x2ea4ab[_0xe144('0x55')];});return db['MailQueue'][_0xe144('0x32')]({'where':{'id':_0x3cb622[_0xe144('0x3d')]['id']}})[_0xe144('0x17')](function(_0x4fdd90){return db[_0xe144('0x59')][_0xe144('0x5a')](function(_0x1f44aa){return _0x4fdd90[_0xe144('0x5b')](_0x11c1de,{'transaction':_0x1f44aa})['then'](function(){return BPromise['each'](_0x41857a,function(_0x1dbb9b){return db[_0xe144('0x40')][_0xe144('0x5c')]({'where':{'UserId':_0x1dbb9b['id'],'MailQueueId':_0x3cb622[_0xe144('0x3d')]['id']},'transaction':_0x1f44aa});});})[_0xe144('0x17')](function(){_0x41857a[_0xe144('0x5d')](function(_0x360fcc){socket[_0xe144('0x5e')](_0xe144('0x5f'),{'UserId':_0x360fcc['id'],'MailQueueId':_0x4fdd90['id']});});});});});}})[_0xe144('0x17')](respondWithStatusCode(_0x5dcb58,null))[_0xe144('0x27')](handleError(_0x5dcb58,null));};exports['removeTeams']=function(_0x206308,_0x11216a){return db[_0xe144('0x52')]['findAll']({'where':{'id':_0x206308[_0xe144('0x2b')][_0xe144('0x54')]},'attributes':['id'],'include':[{'model':db[_0xe144('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe144('0x17')](handleEntityNotFound(_0x11216a,null))[_0xe144('0x17')](function(_0x2766ad){var _0x54919b=_[_0xe144('0x4b')](_0x2766ad,'id');var _0x1de994=[];var _0x5b5274=[];var _0x194527=squel[_0xe144('0x60')]();_0x194527[_0xe144('0x61')](_0xe144('0x62'))[_0xe144('0x63')](_0xe144('0x64'),'tq')[_0xe144('0x65')](_0xe144('0x66'),'ut',_0xe144('0x67'))[_0xe144('0x47')]('MailQueueId\x20=\x20?',_0x206308[_0xe144('0x3d')]['id']);for(var _0x1fb697=0x0;_0x1fb697<_0x2766ad[_0xe144('0x2f')];_0x1fb697+=0x1){let _0x17a364=_0x2766ad[_0x1fb697];for(var _0x5b5438=0x0;_0x5b5438<_0x17a364['Agents'][_0xe144('0x2f')];_0x5b5438+=0x1){let _0x507643=_0x17a364[_0xe144('0x55')][_0x5b5438];var _0x5dcbc5=_0x194527['clone']();_0x5dcbc5[_0xe144('0x47')]('ut.UserId\x20=\x20?',_0x507643['id']);_0x5b5274[_0xe144('0x68')](db[_0xe144('0x59')][_0xe144('0x2b')](_0x5dcbc5['toString'](),{'type':db[_0xe144('0x59')][_0xe144('0x69')][_0xe144('0x6a')]})[_0xe144('0x17')](function(_0x320014){if(_0x320014['length']===0x1){return _0x507643['id'];}else{var _0x49557d=_[_0xe144('0x6b')](_['map'](_0x320014,_0xe144('0x6c')),function(_0x1dce21){return _[_0xe144('0x6d')](_0x54919b,_0x1dce21);});if(_0x49557d){return _0x507643['id'];}}}));}}return BPromise[_0xe144('0x6e')](_0x5b5274)[_0xe144('0x17')](function(_0x1a45cf){_0x1de994=_(_0x1de994)['union'](_0x1a45cf)[_0xe144('0x6f')]()[_0xe144('0x70')]();return db[_0xe144('0x23')][_0xe144('0x32')]({'where':{'id':_0x206308[_0xe144('0x3d')]['id']}})[_0xe144('0x17')](function(_0x5955d5){return db[_0xe144('0x59')][_0xe144('0x5a')](function(_0x54e3f0){return _0x5955d5[_0xe144('0x71')](_0x206308['query']['ids'],{'transaction':_0x54e3f0})[_0xe144('0x17')](function(){if(!_[_0xe144('0x72')](_0x1de994)){return _0x5955d5[_0xe144('0x73')](_0x1de994,{'transaction':_0x54e3f0});}})['then'](function(){_0x1de994['forEach'](function(_0x509946){socket[_0xe144('0x5e')](_0xe144('0x74'),{'UserId':_0x509946,'MailQueueId':_0x5955d5['id']});});});});});});})[_0xe144('0x17')](respondWithStatusCode(_0x11216a,null))['catch'](handleError(_0x11216a,null));};exports[_0xe144('0x75')]=function(_0x2dc3a9,_0x4e172e){return db[_0xe144('0x23')]['find']({'where':{'id':_0x2dc3a9[_0xe144('0x3d')]['id']}})[_0xe144('0x17')](handleEntityNotFound(_0x4e172e,null))['then'](function(_0x5d6207){if(_0x5d6207){return _0x5d6207[_0xe144('0x75')](_0x2dc3a9[_0xe144('0x34')]['ids'],_[_0xe144('0x76')](_0x2dc3a9['body'],[_0xe144('0x54'),'id'])||{})[_0xe144('0x77')](function(_0xafe113){for(var _0x3202df=0x0;_0x3202df<_0x2dc3a9['body'][_0xe144('0x54')]['length'];_0x3202df+=0x1){socket[_0xe144('0x5e')](_0xe144('0x5f'),{'UserId':Number(_0x2dc3a9[_0xe144('0x34')][_0xe144('0x54')][_0x3202df]),'MailQueueId':Number(_0x2dc3a9[_0xe144('0x3d')]['id'])});}return _0xafe113;});}})['then'](respondWithResult(_0x4e172e,null))[_0xe144('0x27')](handleError(_0x4e172e,null));};exports['removeAgents']=function(_0x12914d,_0x18b7c1){return db[_0xe144('0x23')]['find']({'where':{'id':_0x12914d['params']['id']}})[_0xe144('0x17')](handleEntityNotFound(_0x18b7c1,null))[_0xe144('0x17')](function(_0x1b1789){if(_0x1b1789){return _0x1b1789[_0xe144('0x73')](_0x12914d[_0xe144('0x2b')][_0xe144('0x54')])['then'](function(){if(_[_0xe144('0x78')](_0x12914d[_0xe144('0x2b')][_0xe144('0x54')])){for(var _0x2f3adb=0x0;_0x2f3adb<_0x12914d['query'][_0xe144('0x54')][_0xe144('0x2f')];_0x2f3adb+=0x1){socket[_0xe144('0x5e')](_0xe144('0x74'),{'UserId':Number(_0x12914d[_0xe144('0x2b')][_0xe144('0x54')][_0x2f3adb]),'MailQueueId':Number(_0x12914d[_0xe144('0x3d')]['id'])});}}else{socket[_0xe144('0x5e')](_0xe144('0x74'),{'UserId':Number(_0x12914d[_0xe144('0x2b')]['ids']),'MailQueueId':Number(_0x12914d[_0xe144('0x3d')]['id'])});}});}})['then'](respondWithStatusCode(_0x18b7c1,null))[_0xe144('0x27')](handleError(_0x18b7c1,null));};exports[_0xe144('0x79')]=function(_0x40f4ff,_0x2f2978){var _0x454da2={};var _0x58be8f={};var _0x525ae6;var _0x260445;return db[_0xe144('0x23')][_0xe144('0x3f')]({'where':{'id':_0x40f4ff[_0xe144('0x3d')]['id']}})[_0xe144('0x17')](handleEntityNotFound(_0x2f2978,null))[_0xe144('0x17')](function(_0x5e05ba){if(_0x5e05ba){_0x525ae6=_0x5e05ba;_0x58be8f[_0xe144('0x29')]=_[_0xe144('0x2a')](db[_0xe144('0x49')]['rawAttributes']);_0x58be8f[_0xe144('0x2b')]=_[_0xe144('0x2a')](_0x40f4ff[_0xe144('0x2b')]);_0x58be8f[_0xe144('0x41')]=_[_0xe144('0x2c')](_0x58be8f[_0xe144('0x29')],_0x58be8f[_0xe144('0x2b')]);_0x454da2[_0xe144('0x2d')]=_['intersection'](_0x58be8f['model'],qs[_0xe144('0x2e')](_0x40f4ff[_0xe144('0x2b')][_0xe144('0x2e')]));_0x454da2[_0xe144('0x2d')]=_0x454da2[_0xe144('0x2d')][_0xe144('0x2f')]?_0x454da2[_0xe144('0x2d')]:_0x58be8f[_0xe144('0x29')];_0x454da2[_0xe144('0x44')]=qs[_0xe144('0x45')](_0x40f4ff[_0xe144('0x2b')]['sort']);_0x454da2[_0xe144('0x47')]=qs[_0xe144('0x41')](_[_0xe144('0x46')](_0x40f4ff[_0xe144('0x2b')],_0x58be8f[_0xe144('0x41')]));if(_0x40f4ff[_0xe144('0x2b')][_0xe144('0x48')]){_0x454da2[_0xe144('0x47')]=_[_0xe144('0x30')](_0x454da2[_0xe144('0x47')],{'$or':_['map'](_0x454da2['attributes'],function(_0x564157){var _0x3172bd={};_0x3172bd[_0x564157]={'$like':'%'+_0x40f4ff[_0xe144('0x2b')][_0xe144('0x48')]+'%'};return _0x3172bd;})});}_0x454da2=_[_0xe144('0x30')]({},_0x454da2,_0x40f4ff[_0xe144('0x31')]);return _0x525ae6['getAgents'](_0x454da2);}})['then'](function(_0x5f3121){if(_0x5f3121){_0x260445=_0x5f3121[_0xe144('0x2f')];if(!_0x40f4ff[_0xe144('0x2b')][_0xe144('0x42')](_0xe144('0x43'))){_0x454da2[_0xe144('0x15')]=qs[_0xe144('0x15')](_0x40f4ff[_0xe144('0x2b')]['limit']);_0x454da2[_0xe144('0x12')]=qs['offset'](_0x40f4ff[_0xe144('0x2b')][_0xe144('0x12')]);}return _0x525ae6[_0xe144('0x79')](_0x454da2);}})[_0xe144('0x17')](function(_0x146dbb){if(_0x146dbb){return _0x146dbb?{'count':_0x260445,'rows':_0x146dbb}:null;}})[_0xe144('0x17')](respondWithResult(_0x2f2978,null))[_0xe144('0x27')](handleError(_0x2f2978,null));}; \ No newline at end of file +var _0xe5ee=['forEach','emit','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','addAgents','spread','userMailQueue:save','isArray','userMailQueue:remove','getAgents','pick','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','update','destroy','then','MailQueues','UserProfileResource','end','error','stack','name','send','index','map','MailQueue','rawAttributes','type','key','where','include','query','findAll','show','params','model','keys','filters','intersection','attributes','fields','length','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','MailQueueId','filter','merge','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction'];(function(_0x3f85d2,_0x59019f){var _0x2cbede=function(_0x53bc6d){while(--_0x53bc6d){_0x3f85d2['push'](_0x3f85d2['shift']());}};_0x2cbede(++_0x59019f);}(_0xe5ee,0x187));var _0xee5e=function(_0x118824,_0xec8333){_0x118824=_0x118824-0x0;var _0x1111ae=_0xe5ee[_0x118824];return _0x1111ae;};'use strict';var BPromise=require('bluebird');var util=require(_0xee5e('0x0'));var _=require(_0xee5e('0x1'));var squel=require(_0xee5e('0x2'));var Redis=require(_0xee5e('0x3'));var qs=require(_0xee5e('0x4'));var logger=require(_0xee5e('0x5'))(_0xee5e('0x6'));var config=require('../../config/environment');var db=require(_0xee5e('0x7'))['db'];config[_0xee5e('0x8')]=_[_0xee5e('0x9')](config['redis'],{'host':_0xee5e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee5e('0x8')]));require('./mailQueue.socket')[_0xee5e('0xb')](socket);function respondWithStatusCode(_0x353ff1,_0x6e15ce){_0x6e15ce=_0x6e15ce||0xcc;return function(_0x2be504){if(_0x2be504){return _0x353ff1[_0xee5e('0xc')](_0x6e15ce);}return _0x353ff1[_0xee5e('0xd')](_0x6e15ce)['end']();};}function respondWithResult(_0x4a64dd,_0xf97195){_0xf97195=_0xf97195||0xc8;return function(_0x23bce9){if(_0x23bce9){return _0x4a64dd['status'](_0xf97195)[_0xee5e('0xe')](_0x23bce9);}};}function respondWithFilteredResult(_0x1ae4f0,_0x1058dc){return function(_0x4a9daa){if(_0x4a9daa){var _0xa32bd9=typeof _0x1058dc['offset']==='undefined'&&typeof _0x1058dc['limit']===_0xee5e('0xf');var _0x59c5d3=_0x4a9daa['count'];var _0x5a58ef=_0xa32bd9?0x0:_0x1058dc[_0xee5e('0x10')];var _0x1f1af1=_0xa32bd9?_0x4a9daa[_0xee5e('0x11')]:_0x1058dc[_0xee5e('0x10')]+_0x1058dc[_0xee5e('0x12')];var _0x38fd88;if(_0x1f1af1>=_0x59c5d3){_0x1f1af1=_0x59c5d3;_0x38fd88=0xc8;}else{_0x38fd88=0xce;}_0x1ae4f0[_0xee5e('0xd')](_0x38fd88);return _0x1ae4f0[_0xee5e('0x13')](_0xee5e('0x14'),_0x5a58ef+'-'+_0x1f1af1+'/'+_0x59c5d3)['json'](_0x4a9daa);}return null;};}function saveUpdates(_0x3ea23c){return function(_0x3397df){if(_0x3397df){return _0x3397df[_0xee5e('0x15')](_0x3ea23c)['then'](function(_0x5a7951){return _0x5a7951;});}return null;};}function removeEntity(_0x4e820d){return function(_0x50f5d8){if(_0x50f5d8){return _0x50f5d8[_0xee5e('0x16')]()[_0xee5e('0x17')](function(){var _0x405078=_0x50f5d8['get']({'plain':!![]});var _0x5aaee5=_0xee5e('0x18');return db[_0xee5e('0x19')][_0xee5e('0x16')]({'where':{'type':_0x5aaee5,'resourceId':_0x405078['id']}})[_0xee5e('0x17')](function(){return _0x50f5d8;});})[_0xee5e('0x17')](function(){_0x4e820d[_0xee5e('0xd')](0xcc)[_0xee5e('0x1a')]();});}};}function handleEntityNotFound(_0x213fa6){return function(_0x2cb1b1){if(!_0x2cb1b1){_0x213fa6[_0xee5e('0xc')](0x194);}return _0x2cb1b1;};}function handleError(_0x1f18b4,_0x10bfbd){_0x10bfbd=_0x10bfbd||0x1f4;return function(_0x460673){logger[_0xee5e('0x1b')](_0x460673[_0xee5e('0x1c')]);if(_0x460673[_0xee5e('0x1d')]){delete _0x460673['name'];}_0x1f18b4['status'](_0x10bfbd)[_0xee5e('0x1e')](_0x460673);};}exports[_0xee5e('0x1f')]=function(_0x5d5062,_0x19b422){var _0x508eb0={};var _0x237987={'count':0x0,'rows':[]};var _0x35bf0b=_[_0xee5e('0x20')](db[_0xee5e('0x21')][_0xee5e('0x22')],function(_0x48b7bd){return{'name':_0x48b7bd['fieldName'],'type':_0x48b7bd[_0xee5e('0x23')][_0xee5e('0x24')]};});_0x508eb0=qs['getOptions'](_0x35bf0b,_0x5d5062);var _0x1e0f68={'where':_0x508eb0[_0xee5e('0x25')]};return db['MailQueue'][_0xee5e('0x11')](_0x1e0f68)['then'](function(_0x124722){_0x237987[_0xee5e('0x11')]=_0x124722;_0x508eb0[_0xee5e('0x26')]=qs['include'](_0x5d5062[_0xee5e('0x27')]);return db[_0xee5e('0x21')][_0xee5e('0x28')](_0x508eb0);})['then'](function(_0x4b43f7){_0x237987['rows']=_0x4b43f7;return _0x237987;})['then'](respondWithFilteredResult(_0x19b422,_0x508eb0))['catch'](handleError(_0x19b422,null));};exports[_0xee5e('0x29')]=function(_0x1f7f90,_0x4ae872){var _0x2eb742={'raw':!![],'where':{'id':_0x1f7f90[_0xee5e('0x2a')]['id']}},_0x5872c3={};_0x5872c3[_0xee5e('0x2b')]=_[_0xee5e('0x2c')](db['MailQueue'][_0xee5e('0x22')]);_0x5872c3[_0xee5e('0x27')]=_[_0xee5e('0x2c')](_0x1f7f90[_0xee5e('0x27')]);_0x5872c3[_0xee5e('0x2d')]=_[_0xee5e('0x2e')](_0x5872c3['model'],_0x5872c3[_0xee5e('0x27')]);_0x2eb742[_0xee5e('0x2f')]=_[_0xee5e('0x2e')](_0x5872c3[_0xee5e('0x2b')],qs[_0xee5e('0x30')](_0x1f7f90[_0xee5e('0x27')][_0xee5e('0x30')]));_0x2eb742[_0xee5e('0x2f')]=_0x2eb742['attributes'][_0xee5e('0x31')]?_0x2eb742['attributes']:_0x5872c3[_0xee5e('0x2b')];if(_0x1f7f90['query']['includeAll']){_0x2eb742[_0xee5e('0x26')]=[{'all':!![]}];}_0x2eb742=_['merge']({},_0x2eb742,_0x1f7f90[_0xee5e('0x32')]);return db[_0xee5e('0x21')][_0xee5e('0x33')](_0x2eb742)[_0xee5e('0x17')](handleEntityNotFound(_0x4ae872,null))[_0xee5e('0x17')](respondWithResult(_0x4ae872,null))[_0xee5e('0x34')](handleError(_0x4ae872,null));};exports['create']=function(_0x829fd6,_0x2b0045){return db[_0xee5e('0x21')][_0xee5e('0x35')](_0x829fd6[_0xee5e('0x36')],{})['then'](function(_0x369f39){var _0x53efc8=_0x829fd6[_0xee5e('0x37')][_0xee5e('0x38')]({'plain':!![]});if(!_0x53efc8)throw new Error(_0xee5e('0x39'));if(_0x53efc8['role']==='user'){var _0x2eba84=_0x369f39['get']({'plain':!![]});var _0x17324e=_0xee5e('0x18');return db[_0xee5e('0x3a')][_0xee5e('0x33')]({'where':{'name':_0x17324e,'userProfileId':_0x53efc8[_0xee5e('0x3b')]},'raw':!![]})[_0xee5e('0x17')](function(_0x3ba186){if(_0x3ba186&&_0x3ba186[_0xee5e('0x3c')]===0x0){return db[_0xee5e('0x19')]['create']({'name':_0x2eba84[_0xee5e('0x1d')],'resourceId':_0x2eba84['id'],'type':_0x3ba186[_0xee5e('0x1d')],'sectionId':_0x3ba186['id']},{})['then'](function(){return _0x369f39;});}else{return _0x369f39;}})['catch'](function(_0x45e910){logger[_0xee5e('0x1b')](_0xee5e('0x3d'),_0x45e910);throw _0x45e910;});}return _0x369f39;})['then'](respondWithResult(_0x2b0045,0xc9))[_0xee5e('0x34')](handleError(_0x2b0045,null));};exports[_0xee5e('0x15')]=function(_0x542662,_0x7605db){if(_0x542662[_0xee5e('0x36')]['id']){delete _0x542662[_0xee5e('0x36')]['id'];}return db[_0xee5e('0x21')][_0xee5e('0x33')]({'where':{'id':_0x542662[_0xee5e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x7605db,null))[_0xee5e('0x17')](saveUpdates(_0x542662[_0xee5e('0x36')],null))[_0xee5e('0x17')](respondWithResult(_0x7605db,null))[_0xee5e('0x34')](handleError(_0x7605db,null));};exports[_0xee5e('0x16')]=function(_0x3fe3b1,_0x1d7bd7){return db[_0xee5e('0x21')][_0xee5e('0x33')]({'where':{'id':_0x3fe3b1[_0xee5e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1d7bd7,null))['then'](removeEntity(_0x1d7bd7,null))['catch'](handleError(_0x1d7bd7,null));};exports[_0xee5e('0x3e')]=function(_0x15a682,_0x123e77){return db[_0xee5e('0x21')][_0xee5e('0x3e')]()[_0xee5e('0x17')](respondWithResult(_0x123e77,null))[_0xee5e('0x34')](handleError(_0x123e77,null));};exports['getMembers']=function(_0x25ab2a,_0x10e3c6){var _0x39fd02={'raw':!![],'where':{}},_0x2330ae={},_0x4bfb49;return db[_0xee5e('0x21')][_0xee5e('0x3f')]({'where':{'id':_0x25ab2a[_0xee5e('0x2a')]['id']}})[_0xee5e('0x17')](handleEntityNotFound(_0x10e3c6,null))['then'](function(_0x4a93e5){if(_0x4a93e5){_0x4bfb49=_0x4a93e5[_0xee5e('0x38')]({'plain':!![]});_0x2330ae['model']=_['keys'](db[_0xee5e('0x40')][_0xee5e('0x22')]);_0x2330ae[_0xee5e('0x27')]=_[_0xee5e('0x2c')](_0x25ab2a[_0xee5e('0x27')]);_0x2330ae[_0xee5e('0x2d')]=_[_0xee5e('0x2e')](_0x2330ae[_0xee5e('0x2b')],_0x2330ae[_0xee5e('0x27')]);_0x39fd02[_0xee5e('0x2f')]=_['intersection'](_0x2330ae[_0xee5e('0x2b')],qs[_0xee5e('0x30')](_0x25ab2a['query'][_0xee5e('0x30')]));_0x39fd02[_0xee5e('0x2f')]=_0x39fd02['attributes'][_0xee5e('0x31')]?_0x39fd02[_0xee5e('0x2f')]:_0x2330ae[_0xee5e('0x2b')];if(!_0x25ab2a[_0xee5e('0x27')][_0xee5e('0x41')](_0xee5e('0x42'))){_0x39fd02[_0xee5e('0x12')]=qs[_0xee5e('0x12')](_0x25ab2a[_0xee5e('0x27')][_0xee5e('0x12')]);_0x39fd02[_0xee5e('0x10')]=qs[_0xee5e('0x10')](_0x25ab2a[_0xee5e('0x27')][_0xee5e('0x10')]);}_0x39fd02[_0xee5e('0x43')]=qs[_0xee5e('0x44')](_0x25ab2a[_0xee5e('0x27')]['sort']);_0x39fd02[_0xee5e('0x25')]=qs[_0xee5e('0x2d')](_['pick'](_0x25ab2a[_0xee5e('0x27')],_0x2330ae[_0xee5e('0x2d')]));_0x39fd02[_0xee5e('0x25')][_0xee5e('0x45')]=_0x4a93e5['id'];if(_0x25ab2a[_0xee5e('0x27')][_0xee5e('0x46')]){_0x39fd02[_0xee5e('0x25')]=_[_0xee5e('0x47')](_0x39fd02[_0xee5e('0x25')],{'$or':_[_0xee5e('0x20')](_0x39fd02[_0xee5e('0x2f')],function(_0x1c9c16){var _0x141034={};_0x141034[_0x1c9c16]={'$like':'%'+_0x25ab2a[_0xee5e('0x27')][_0xee5e('0x46')]+'%'};return _0x141034;})});}_0x39fd02=_[_0xee5e('0x47')]({},_0x39fd02,_0x25ab2a[_0xee5e('0x32')]);return db[_0xee5e('0x40')]['findAll'](_0x39fd02);}})[_0xee5e('0x17')](function(_0x343069){if(_0x343069){return db[_0xee5e('0x48')][_0xee5e('0x49')]({'where':{'id':_[_0xee5e('0x20')](_0x343069,_0xee5e('0x4a')),'role':_0xee5e('0x4b')},'attributes':['id','name',_0xee5e('0x4c'),_0xee5e('0x4d'),_0xee5e('0x4e')]});}})[_0xee5e('0x17')](function(_0x3a2b3e){if(_0x3a2b3e){return{'count':_0x3a2b3e[_0xee5e('0x11')],'rows':_[_0xee5e('0x20')](_0x3a2b3e[_0xee5e('0x4f')],function(_0x24e4e9){return{'membername':_0x24e4e9[_0xee5e('0x1d')],'UserId':_0x24e4e9['id'],'queue_name':_0x4bfb49['name'],'MailQueueId':_0x4bfb49['id'],'interface':util[_0xee5e('0x50')](_0xee5e('0x51'),_0xee5e('0x52'),_0x24e4e9[_0xee5e('0x1d')]),'penalty':0x0,'paused':_0x24e4e9[_0xee5e('0x4c')],'createdAt':_0x24e4e9[_0xee5e('0x4e')],'updatedAt':_0x24e4e9[_0xee5e('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xee5e('0x17')](respondWithFilteredResult(_0x10e3c6,_0x39fd02))[_0xee5e('0x34')](handleError(_0x10e3c6,null));};exports[_0xee5e('0x53')]=function(_0x340868,_0x1d6a88){var _0x10cd5c={};var _0x6981c={};var _0x1f0666;var _0x20d2d3;return db[_0xee5e('0x21')][_0xee5e('0x3f')]({'where':{'id':_0x340868['params']['id']}})['then'](handleEntityNotFound(_0x1d6a88,null))[_0xee5e('0x17')](function(_0x492ff6){if(_0x492ff6){_0x1f0666=_0x492ff6;_0x6981c[_0xee5e('0x2b')]=_['keys'](db[_0xee5e('0x54')][_0xee5e('0x22')]);_0x6981c[_0xee5e('0x27')]=_[_0xee5e('0x2c')](_0x340868[_0xee5e('0x27')]);_0x6981c[_0xee5e('0x2d')]=_[_0xee5e('0x2e')](_0x6981c[_0xee5e('0x2b')],_0x6981c['query']);_0x10cd5c[_0xee5e('0x2f')]=_[_0xee5e('0x2e')](_0x6981c[_0xee5e('0x2b')],qs[_0xee5e('0x30')](_0x340868[_0xee5e('0x27')][_0xee5e('0x30')]));_0x10cd5c[_0xee5e('0x2f')]=_0x10cd5c['attributes'][_0xee5e('0x31')]?_0x10cd5c['attributes']:_0x6981c[_0xee5e('0x2b')];_0x10cd5c[_0xee5e('0x43')]=qs[_0xee5e('0x44')](_0x340868[_0xee5e('0x27')]['sort']);_0x10cd5c[_0xee5e('0x25')]=qs[_0xee5e('0x2d')](_['pick'](_0x340868[_0xee5e('0x27')],_0x6981c[_0xee5e('0x2d')]));if(_0x340868[_0xee5e('0x27')]['filter']){_0x10cd5c[_0xee5e('0x25')]=_[_0xee5e('0x47')](_0x10cd5c[_0xee5e('0x25')],{'$or':_[_0xee5e('0x20')](_0x10cd5c[_0xee5e('0x2f')],function(_0x104c75){var _0x58642a={};_0x58642a[_0x104c75]={'$like':'%'+_0x340868[_0xee5e('0x27')][_0xee5e('0x46')]+'%'};return _0x58642a;})});}_0x10cd5c=_[_0xee5e('0x47')]({},_0x10cd5c,_0x340868['options']);return _0x1f0666['getTeams'](_0x10cd5c);}})[_0xee5e('0x17')](function(_0x2fdd0a){if(_0x2fdd0a){_0x20d2d3=_0x2fdd0a[_0xee5e('0x31')];if(!_0x340868[_0xee5e('0x27')][_0xee5e('0x41')](_0xee5e('0x42'))){_0x10cd5c[_0xee5e('0x12')]=qs[_0xee5e('0x12')](_0x340868[_0xee5e('0x27')][_0xee5e('0x12')]);_0x10cd5c[_0xee5e('0x10')]=qs[_0xee5e('0x10')](_0x340868[_0xee5e('0x27')][_0xee5e('0x10')]);}return _0x1f0666[_0xee5e('0x53')](_0x10cd5c);}})[_0xee5e('0x17')](function(_0x453bf2){if(_0x453bf2){return _0x453bf2?{'count':_0x20d2d3,'rows':_0x453bf2}:null;}})['then'](respondWithResult(_0x1d6a88,null))[_0xee5e('0x34')](handleError(_0x1d6a88,null));};exports[_0xee5e('0x55')]=function(_0x46fe45,_0x51959a){var _0x32a11b=_0x46fe45['body'][_0xee5e('0x56')];return db['Team'][_0xee5e('0x28')]({'where':{'id':_0x32a11b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xee5e('0x1d'),_0xee5e('0x57'),'voicePause',_0xee5e('0x58')],'raw':!![]}]})[_0xee5e('0x17')](function(_0x48e9b0){if(_0x48e9b0){var _0x52114a=_[_0xee5e('0x59')](_0x48e9b0,function(_0x19d31c){var _0x5d17fe=_0x19d31c['get']({'plain':!![]});return _0x5d17fe[_0xee5e('0x5a')];});return db[_0xee5e('0x21')][_0xee5e('0x33')]({'where':{'id':_0x46fe45['params']['id']}})['then'](function(_0x30d8fc){return db[_0xee5e('0x5b')][_0xee5e('0x5c')](function(_0x3eee7b){return _0x30d8fc['addTeams'](_0x32a11b,{'transaction':_0x3eee7b})[_0xee5e('0x17')](function(){return BPromise['each'](_0x52114a,function(_0x4e59c0){return db[_0xee5e('0x40')]['findOrCreate']({'where':{'UserId':_0x4e59c0['id'],'MailQueueId':_0x46fe45[_0xee5e('0x2a')]['id']},'transaction':_0x3eee7b});});})[_0xee5e('0x17')](function(){_0x52114a[_0xee5e('0x5d')](function(_0x113ed8){socket[_0xee5e('0x5e')]('userMailQueue:save',{'UserId':_0x113ed8['id'],'MailQueueId':_0x30d8fc['id']});});});});});}})['then'](respondWithStatusCode(_0x51959a,null))[_0xee5e('0x34')](handleError(_0x51959a,null));};exports['removeTeams']=function(_0x52bf4a,_0x450070){return db[_0xee5e('0x54')][_0xee5e('0x28')]({'where':{'id':_0x52bf4a[_0xee5e('0x27')][_0xee5e('0x56')]},'attributes':['id'],'include':[{'model':db[_0xee5e('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x450070,null))['then'](function(_0x197bd4){var _0x3c9d14=_[_0xee5e('0x20')](_0x197bd4,'id');var _0x1e50b2=[];var _0x2eca8c=[];var _0x2b0675=squel['select']();_0x2b0675[_0xee5e('0x5f')](_0xee5e('0x60'))['from'](_0xee5e('0x61'),'tq')[_0xee5e('0x62')](_0xee5e('0x63'),'ut',_0xee5e('0x64'))[_0xee5e('0x25')](_0xee5e('0x65'),_0x52bf4a[_0xee5e('0x2a')]['id']);for(var _0x1d2c01=0x0;_0x1d2c01<_0x197bd4[_0xee5e('0x31')];_0x1d2c01+=0x1){let _0x440d4c=_0x197bd4[_0x1d2c01];for(var _0x5e8ea6=0x0;_0x5e8ea6<_0x440d4c[_0xee5e('0x5a')][_0xee5e('0x31')];_0x5e8ea6+=0x1){let _0x598d53=_0x440d4c[_0xee5e('0x5a')][_0x5e8ea6];var _0x53da9c=_0x2b0675['clone']();_0x53da9c[_0xee5e('0x25')]('ut.UserId\x20=\x20?',_0x598d53['id']);_0x2eca8c[_0xee5e('0x66')](db[_0xee5e('0x5b')][_0xee5e('0x27')](_0x53da9c[_0xee5e('0x67')](),{'type':db[_0xee5e('0x5b')][_0xee5e('0x68')][_0xee5e('0x69')]})[_0xee5e('0x17')](function(_0x586ce8){if(_0x586ce8[_0xee5e('0x31')]===0x1){return _0x598d53['id'];}else{var _0x5e4c36=_[_0xee5e('0x6a')](_[_0xee5e('0x20')](_0x586ce8,_0xee5e('0x6b')),function(_0x4d7faf){return _[_0xee5e('0x6c')](_0x3c9d14,_0x4d7faf);});if(_0x5e4c36){return _0x598d53['id'];}}}));}}return BPromise[_0xee5e('0x6d')](_0x2eca8c)[_0xee5e('0x17')](function(_0x2150b2){_0x1e50b2=_(_0x1e50b2)[_0xee5e('0x6e')](_0x2150b2)[_0xee5e('0x6f')]()['value']();return db[_0xee5e('0x21')][_0xee5e('0x33')]({'where':{'id':_0x52bf4a[_0xee5e('0x2a')]['id']}})['then'](function(_0x1b8ff0){return db[_0xee5e('0x5b')][_0xee5e('0x5c')](function(_0x35a37b){return _0x1b8ff0['removeTeams'](_0x52bf4a['query'][_0xee5e('0x56')],{'transaction':_0x35a37b})[_0xee5e('0x17')](function(){if(!_[_0xee5e('0x70')](_0x1e50b2)){return _0x1b8ff0[_0xee5e('0x71')](_0x1e50b2,{'transaction':_0x35a37b});}})['then'](function(){_0x1e50b2['forEach'](function(_0x44b07a){socket[_0xee5e('0x5e')]('userMailQueue:remove',{'UserId':_0x44b07a,'MailQueueId':_0x1b8ff0['id']});});});});});});})[_0xee5e('0x17')](respondWithStatusCode(_0x450070,null))[_0xee5e('0x34')](handleError(_0x450070,null));};exports[_0xee5e('0x72')]=function(_0x1c5e9f,_0x2e35df){return db[_0xee5e('0x21')][_0xee5e('0x33')]({'where':{'id':_0x1c5e9f[_0xee5e('0x2a')]['id']}})[_0xee5e('0x17')](handleEntityNotFound(_0x2e35df,null))[_0xee5e('0x17')](function(_0x50d343){if(_0x50d343){return _0x50d343[_0xee5e('0x72')](_0x1c5e9f[_0xee5e('0x36')][_0xee5e('0x56')],_['omit'](_0x1c5e9f[_0xee5e('0x36')],[_0xee5e('0x56'),'id'])||{})[_0xee5e('0x73')](function(_0x2f5825){for(var _0x10f9e0=0x0;_0x10f9e0<_0x1c5e9f[_0xee5e('0x36')]['ids'][_0xee5e('0x31')];_0x10f9e0+=0x1){socket[_0xee5e('0x5e')](_0xee5e('0x74'),{'UserId':Number(_0x1c5e9f[_0xee5e('0x36')]['ids'][_0x10f9e0]),'MailQueueId':Number(_0x1c5e9f[_0xee5e('0x2a')]['id'])});}return _0x2f5825;});}})[_0xee5e('0x17')](respondWithResult(_0x2e35df,null))[_0xee5e('0x34')](handleError(_0x2e35df,null));};exports[_0xee5e('0x71')]=function(_0x3cdc38,_0x39dfd1){return db[_0xee5e('0x21')]['find']({'where':{'id':_0x3cdc38[_0xee5e('0x2a')]['id']}})[_0xee5e('0x17')](handleEntityNotFound(_0x39dfd1,null))[_0xee5e('0x17')](function(_0x454c2e){if(_0x454c2e){return _0x454c2e['removeAgents'](_0x3cdc38[_0xee5e('0x27')][_0xee5e('0x56')])[_0xee5e('0x17')](function(){if(_[_0xee5e('0x75')](_0x3cdc38[_0xee5e('0x27')][_0xee5e('0x56')])){for(var _0x1d8ea2=0x0;_0x1d8ea2<_0x3cdc38[_0xee5e('0x27')][_0xee5e('0x56')][_0xee5e('0x31')];_0x1d8ea2+=0x1){socket[_0xee5e('0x5e')](_0xee5e('0x76'),{'UserId':Number(_0x3cdc38['query'][_0xee5e('0x56')][_0x1d8ea2]),'MailQueueId':Number(_0x3cdc38[_0xee5e('0x2a')]['id'])});}}else{socket[_0xee5e('0x5e')](_0xee5e('0x76'),{'UserId':Number(_0x3cdc38[_0xee5e('0x27')]['ids']),'MailQueueId':Number(_0x3cdc38[_0xee5e('0x2a')]['id'])});}});}})[_0xee5e('0x17')](respondWithStatusCode(_0x39dfd1,null))[_0xee5e('0x34')](handleError(_0x39dfd1,null));};exports[_0xee5e('0x77')]=function(_0x6ec563,_0x4d019a){var _0x3824b3={};var _0x4ed8cc={};var _0x38abd8;var _0x40718d;return db[_0xee5e('0x21')][_0xee5e('0x3f')]({'where':{'id':_0x6ec563[_0xee5e('0x2a')]['id']}})[_0xee5e('0x17')](handleEntityNotFound(_0x4d019a,null))[_0xee5e('0x17')](function(_0x2a22f6){if(_0x2a22f6){_0x38abd8=_0x2a22f6;_0x4ed8cc[_0xee5e('0x2b')]=_['keys'](db[_0xee5e('0x48')]['rawAttributes']);_0x4ed8cc[_0xee5e('0x27')]=_['keys'](_0x6ec563[_0xee5e('0x27')]);_0x4ed8cc[_0xee5e('0x2d')]=_[_0xee5e('0x2e')](_0x4ed8cc['model'],_0x4ed8cc[_0xee5e('0x27')]);_0x3824b3[_0xee5e('0x2f')]=_[_0xee5e('0x2e')](_0x4ed8cc[_0xee5e('0x2b')],qs[_0xee5e('0x30')](_0x6ec563[_0xee5e('0x27')][_0xee5e('0x30')]));_0x3824b3[_0xee5e('0x2f')]=_0x3824b3[_0xee5e('0x2f')][_0xee5e('0x31')]?_0x3824b3[_0xee5e('0x2f')]:_0x4ed8cc[_0xee5e('0x2b')];_0x3824b3['order']=qs[_0xee5e('0x44')](_0x6ec563[_0xee5e('0x27')][_0xee5e('0x44')]);_0x3824b3[_0xee5e('0x25')]=qs[_0xee5e('0x2d')](_[_0xee5e('0x78')](_0x6ec563[_0xee5e('0x27')],_0x4ed8cc[_0xee5e('0x2d')]));if(_0x6ec563['query']['filter']){_0x3824b3[_0xee5e('0x25')]=_['merge'](_0x3824b3[_0xee5e('0x25')],{'$or':_['map'](_0x3824b3[_0xee5e('0x2f')],function(_0x1afb55){var _0x34de14={};_0x34de14[_0x1afb55]={'$like':'%'+_0x6ec563['query'][_0xee5e('0x46')]+'%'};return _0x34de14;})});}_0x3824b3=_[_0xee5e('0x47')]({},_0x3824b3,_0x6ec563['options']);return _0x38abd8[_0xee5e('0x77')](_0x3824b3);}})['then'](function(_0xed0ad8){if(_0xed0ad8){_0x40718d=_0xed0ad8[_0xee5e('0x31')];if(!_0x6ec563[_0xee5e('0x27')][_0xee5e('0x41')](_0xee5e('0x42'))){_0x3824b3[_0xee5e('0x12')]=qs[_0xee5e('0x12')](_0x6ec563[_0xee5e('0x27')][_0xee5e('0x12')]);_0x3824b3[_0xee5e('0x10')]=qs[_0xee5e('0x10')](_0x6ec563['query'][_0xee5e('0x10')]);}return _0x38abd8['getAgents'](_0x3824b3);}})['then'](function(_0x441a37){if(_0x441a37){return _0x441a37?{'count':_0x40718d,'rows':_0x441a37}:null;}})[_0xee5e('0x17')](respondWithResult(_0x4d019a,null))[_0xee5e('0x34')](handleError(_0x4d019a,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index e085aff..e9c3b0f 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 _0x58c5=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x5183eb,_0x39f364){var _0x2aed19=function(_0x139d84){while(--_0x139d84){_0x5183eb['push'](_0x5183eb['shift']());}};_0x2aed19(++_0x39f364);}(_0x58c5,0x101));var _0x558c=function(_0x5d84fe,_0x3d268f){_0x5d84fe=_0x5d84fe-0x0;var _0x36053b=_0x58c5[_0x5d84fe];return _0x36053b;};'use strict';var EventEmitter=require(_0x558c('0x0'));var MailQueue=require(_0x558c('0x1'))['db'][_0x558c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x558c('0x3')](0x0);var events={'afterCreate':_0x558c('0x4'),'afterUpdate':'update','afterDestroy':_0x558c('0x5')};function emitEvent(_0x4e9e2b){return function(_0x541d22,_0x3e4a65,_0x2896cb){MailQueueEvents['emit'](_0x4e9e2b+':'+_0x541d22['id'],_0x541d22);MailQueueEvents[_0x558c('0x6')](_0x4e9e2b,_0x541d22);_0x2896cb(null);};}for(var e in events){if(events[_0x558c('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x558c('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x0b08=['emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b08,0xc9));var _0x80b0=function(_0x48b00c,_0x16690b){_0x48b00c=_0x48b00c-0x0;var _0x55d181=_0x0b08[_0x48b00c];return _0x55d181;};'use strict';var EventEmitter=require(_0x80b0('0x0'));var MailQueue=require(_0x80b0('0x1'))['db'][_0x80b0('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x80b0('0x3')](0x0);var events={'afterCreate':_0x80b0('0x4'),'afterUpdate':_0x80b0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x377f2a){return function(_0x24b09a,_0x13777f,_0x5e9bd1){MailQueueEvents['emit'](_0x377f2a+':'+_0x24b09a['id'],_0x24b09a);MailQueueEvents[_0x80b0('0x6')](_0x377f2a,_0x24b09a);_0x5e9bd1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x80b0('0x7')](e,emitEvent(event));}}module[_0x80b0('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 4ae8a3b..abca9b2 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 _0x3b12=['rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird','path'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x3b12,0xa2));var _0x23b1=function(_0x511028,_0x3ec7ef){_0x511028=_0x511028-0x0;var _0x25c6b6=_0x3b12[_0x511028];return _0x25c6b6;};'use strict';var _=require(_0x23b1('0x0'));var util=require(_0x23b1('0x1'));var logger=require(_0x23b1('0x2'))(_0x23b1('0x3'));var moment=require('moment');var BPromise=require(_0x23b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23b1('0x5'));var rimraf=require(_0x23b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x23b1('0x7'));module[_0x23b1('0x8')]=function(_0x5dfc38,_0xae591e){return _0x5dfc38[_0x23b1('0x9')](_0x23b1('0xa'),attributes,{'tableName':_0x23b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8f2=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','define','mail_queues','../../config/logger','api'];(function(_0xa7fdbb,_0x2ef4d1){var _0x10b422=function(_0x18afee){while(--_0x18afee){_0xa7fdbb['push'](_0xa7fdbb['shift']());}};_0x10b422(++_0x2ef4d1);}(_0xe8f2,0x116));var _0x2e8f=function(_0x280e8e,_0x39f681){_0x280e8e=_0x280e8e-0x0;var _0x2d5c1f=_0xe8f2[_0x280e8e];return _0x2d5c1f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2e8f('0x0'))(_0x2e8f('0x1'));var moment=require(_0x2e8f('0x2'));var BPromise=require(_0x2e8f('0x3'));var rp=require(_0x2e8f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e8f('0x5'));var config=require(_0x2e8f('0x6'));var attributes=require(_0x2e8f('0x7'));module['exports']=function(_0x9362f0,_0x5bcdc5){return _0x9362f0[_0x2e8f('0x8')]('MailQueue',attributes,{'tableName':_0x2e8f('0x9'),'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 dce0a7b..4b49164 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 _0x78d2=['MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','MailQueue','findAll','options','where','limit','include','model','attributes','map','catch','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info'];(function(_0x568ed6,_0x25787e){var _0x21da92=function(_0x520eec){while(--_0x520eec){_0x568ed6['push'](_0x568ed6['shift']());}};_0x21da92(++_0x25787e);}(_0x78d2,0x1c4));var _0x278d=function(_0x5ca9b4,_0x2bfd14){_0x5ca9b4=_0x5ca9b4-0x0;var _0x42731a=_0x78d2[_0x5ca9b4];return _0x42731a;};'use strict';var _=require(_0x278d('0x0'));var util=require(_0x278d('0x1'));var moment=require(_0x278d('0x2'));var BPromise=require(_0x278d('0x3'));var rs=require(_0x278d('0x4'));var fs=require('fs');var Redis=require(_0x278d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x278d('0x6'))(_0x278d('0x7'));var config=require(_0x278d('0x8'));var jayson=require(_0x278d('0x9'));var client=jayson[_0x278d('0xa')][_0x278d('0xb')]({'port':0x232a});config[_0x278d('0xc')]=_[_0x278d('0xd')](config[_0x278d('0xc')],{'host':_0x278d('0xe'),'port':0x18eb});var socket=require(_0x278d('0xf'))(new Redis(config['redis']));require(_0x278d('0x10'))[_0x278d('0x11')](socket);function respondWithRpcPromise(_0x54de68,_0x2beb6e,_0x2ea522){return new BPromise(function(_0x38e299,_0x340db5){return client[_0x278d('0x12')](_0x54de68,_0x2ea522)[_0x278d('0x13')](function(_0x473a5e){logger[_0x278d('0x14')](_0x278d('0x15'),_0x2beb6e,_0x278d('0x16'));logger[_0x278d('0x17')](_0x278d('0x18'),_0x2beb6e,_0x278d('0x16'),JSON[_0x278d('0x19')](_0x473a5e));if(_0x473a5e[_0x278d('0x1a')]){if(_0x473a5e[_0x278d('0x1a')][_0x278d('0x1b')]===0x1f4){logger[_0x278d('0x1a')](_0x278d('0x15'),_0x2beb6e,_0x473a5e[_0x278d('0x1a')][_0x278d('0x1c')]);return _0x340db5(_0x473a5e[_0x278d('0x1a')][_0x278d('0x1c')]);}logger[_0x278d('0x1a')](_0x278d('0x15'),_0x2beb6e,_0x473a5e[_0x278d('0x1a')][_0x278d('0x1c')]);return _0x38e299(_0x473a5e[_0x278d('0x1a')][_0x278d('0x1c')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x2beb6e,_0x278d('0x16'));_0x38e299(_0x473a5e[_0x278d('0x1d')][_0x278d('0x1c')]);}})['catch'](function(_0x1bffa7){logger['error'](_0x278d('0x15'),_0x2beb6e,_0x1bffa7);_0x340db5(_0x1bffa7);});});}exports[_0x278d('0x1e')]=function(_0x3789e1){var _0x28bd2f=this;return new Promise(function(_0x1f9d3c,_0x323edc){return db[_0x278d('0x1f')][_0x278d('0x20')]({'raw':_0x3789e1[_0x278d('0x21')]?_0x3789e1[_0x278d('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x3789e1[_0x278d('0x21')]?_0x3789e1[_0x278d('0x21')][_0x278d('0x22')]||null:null,'attributes':_0x3789e1[_0x278d('0x21')]?_0x3789e1[_0x278d('0x21')]['attributes']||null:null,'limit':_0x3789e1['options']?_0x3789e1[_0x278d('0x21')][_0x278d('0x23')]||null:null,'include':_0x3789e1[_0x278d('0x21')]?_0x3789e1[_0x278d('0x21')][_0x278d('0x24')]?_['map'](_0x3789e1[_0x278d('0x21')][_0x278d('0x24')],function(_0x4674ef){return{'model':db[_0x4674ef[_0x278d('0x25')]],'as':_0x4674ef['as'],'attributes':_0x4674ef[_0x278d('0x26')],'include':_0x4674ef[_0x278d('0x24')]?_[_0x278d('0x27')](_0x4674ef[_0x278d('0x24')],function(_0x5b8b71){return{'model':db[_0x5b8b71[_0x278d('0x25')]],'as':_0x5b8b71['as'],'attributes':_0x5b8b71['attributes'],'include':_0x5b8b71[_0x278d('0x24')]?_[_0x278d('0x27')](_0x5b8b71[_0x278d('0x24')],function(_0x13f2f4){return{'model':db[_0x13f2f4['model']],'as':_0x13f2f4['as'],'attributes':_0x13f2f4['attributes']};}):[]};}):[]};}):[]:[]})[_0x278d('0x13')](function(_0x26d106){logger[_0x278d('0x14')](_0x278d('0x1e'),_0x3789e1);logger[_0x278d('0x17')]('GetMailQueue',_0x3789e1,JSON[_0x278d('0x19')](_0x26d106));_0x1f9d3c(_0x26d106);})[_0x278d('0x28')](function(_0x3dc590){logger['error']('GetMailQueue',_0x3dc590[_0x278d('0x1c')],_0x3789e1);_0x323edc(_0x28bd2f['error'](0x1f4,_0x3dc590[_0x278d('0x1c')]));});});};exports[_0x278d('0x29')]=function(_0xadc0d4){var _0x21dbe9=this;return new Promise(function(_0x476905,_0x5468b4){return db[_0x278d('0x1f')][_0x278d('0x2a')]({'raw':_0xadc0d4['options']?_0xadc0d4[_0x278d('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0xadc0d4['options']?_0xadc0d4['options'][_0x278d('0x22')]||null:null,'attributes':_0xadc0d4[_0x278d('0x21')]?_0xadc0d4['options'][_0x278d('0x26')]||null:null,'include':_0xadc0d4[_0x278d('0x21')]?_0xadc0d4[_0x278d('0x21')][_0x278d('0x24')]?_[_0x278d('0x27')](_0xadc0d4[_0x278d('0x21')][_0x278d('0x24')],function(_0x37aaf1){return{'model':db[_0x37aaf1[_0x278d('0x25')]],'as':_0x37aaf1['as'],'attributes':_0x37aaf1[_0x278d('0x26')],'include':_0x37aaf1[_0x278d('0x24')]?_['map'](_0x37aaf1[_0x278d('0x24')],function(_0x37dcb8){return{'model':db[_0x37dcb8['model']],'as':_0x37dcb8['as'],'attributes':_0x37dcb8['attributes'],'include':_0x37dcb8['include']?_[_0x278d('0x27')](_0x37dcb8[_0x278d('0x24')],function(_0x373e3a){return{'model':db[_0x373e3a['model']],'as':_0x373e3a['as'],'attributes':_0x373e3a[_0x278d('0x26')]};}):[]};}):[]};}):[]:[]})[_0x278d('0x13')](function(_0x463daf){logger[_0x278d('0x14')](_0x278d('0x29'),_0xadc0d4);logger[_0x278d('0x17')](_0x278d('0x29'),_0xadc0d4,JSON[_0x278d('0x19')](_0x463daf));_0x476905(_0x463daf);})[_0x278d('0x28')](function(_0x15c953){logger[_0x278d('0x1a')]('ShowMailQueue',_0x15c953[_0x278d('0x1c')],_0xadc0d4);_0x5468b4(_0x21dbe9['error'](0x1f4,_0x15c953[_0x278d('0x1c')]));});});}; \ No newline at end of file +var _0xb54c=['message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowMailQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1c3c47,_0x59fd36){var _0x1582b9=function(_0x436c3c){while(--_0x436c3c){_0x1c3c47['push'](_0x1c3c47['shift']());}};_0x1582b9(++_0x59fd36);}(_0xb54c,0x127));var _0xcb54=function(_0x4c6bde,_0x2865e7){_0x4c6bde=_0x4c6bde-0x0;var _0x8db42a=_0xb54c[_0x4c6bde];return _0x8db42a;};'use strict';var _=require(_0xcb54('0x0'));var util=require('util');var moment=require(_0xcb54('0x1'));var BPromise=require(_0xcb54('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb54('0x3'));var db=require(_0xcb54('0x4'))['db'];var utils=require(_0xcb54('0x5'));var logger=require(_0xcb54('0x6'))(_0xcb54('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcb54('0x8')][_0xcb54('0x9')]({'port':0x232a});config[_0xcb54('0xa')]=_[_0xcb54('0xb')](config[_0xcb54('0xa')],{'host':_0xcb54('0xc'),'port':0x18eb});var socket=require(_0xcb54('0xd'))(new Redis(config[_0xcb54('0xa')]));require(_0xcb54('0xe'))[_0xcb54('0xf')](socket);function respondWithRpcPromise(_0x14cc0b,_0xdac9ca,_0x7181c3){return new BPromise(function(_0x2def34,_0x123c09){return client['request'](_0x14cc0b,_0x7181c3)[_0xcb54('0x10')](function(_0x160fa7){logger[_0xcb54('0x11')](_0xcb54('0x12'),_0xdac9ca,_0xcb54('0x13'));logger[_0xcb54('0x14')](_0xcb54('0x15'),_0xdac9ca,_0xcb54('0x13'),JSON[_0xcb54('0x16')](_0x160fa7));if(_0x160fa7['error']){if(_0x160fa7[_0xcb54('0x17')][_0xcb54('0x18')]===0x1f4){logger[_0xcb54('0x17')]('MailQueue,\x20%s,\x20%s',_0xdac9ca,_0x160fa7['error']['message']);return _0x123c09(_0x160fa7[_0xcb54('0x17')][_0xcb54('0x19')]);}logger[_0xcb54('0x17')]('MailQueue,\x20%s,\x20%s',_0xdac9ca,_0x160fa7[_0xcb54('0x17')][_0xcb54('0x19')]);return _0x2def34(_0x160fa7[_0xcb54('0x17')][_0xcb54('0x19')]);}else{logger[_0xcb54('0x11')]('MailQueue,\x20%s,\x20%s',_0xdac9ca,'request\x20sent');_0x2def34(_0x160fa7['result'][_0xcb54('0x19')]);}})[_0xcb54('0x1a')](function(_0x41d5c3){logger['error'](_0xcb54('0x12'),_0xdac9ca,_0x41d5c3);_0x123c09(_0x41d5c3);});});}exports[_0xcb54('0x1b')]=function(_0x5c4fea){var _0x7408d=this;return new Promise(function(_0x127ca9,_0x4d71d5){return db[_0xcb54('0x1c')][_0xcb54('0x1d')]({'raw':_0x5c4fea[_0xcb54('0x1e')]?_0x5c4fea[_0xcb54('0x1e')][_0xcb54('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c4fea[_0xcb54('0x1e')]?_0x5c4fea[_0xcb54('0x1e')][_0xcb54('0x20')]||null:null,'attributes':_0x5c4fea[_0xcb54('0x1e')]?_0x5c4fea[_0xcb54('0x1e')]['attributes']||null:null,'limit':_0x5c4fea[_0xcb54('0x1e')]?_0x5c4fea[_0xcb54('0x1e')][_0xcb54('0x21')]||null:null,'include':_0x5c4fea[_0xcb54('0x1e')]?_0x5c4fea[_0xcb54('0x1e')][_0xcb54('0x22')]?_[_0xcb54('0x23')](_0x5c4fea[_0xcb54('0x1e')][_0xcb54('0x22')],function(_0x3f0f7b){return{'model':db[_0x3f0f7b[_0xcb54('0x24')]],'as':_0x3f0f7b['as'],'attributes':_0x3f0f7b[_0xcb54('0x25')],'include':_0x3f0f7b[_0xcb54('0x22')]?_[_0xcb54('0x23')](_0x3f0f7b[_0xcb54('0x22')],function(_0xa29d11){return{'model':db[_0xa29d11[_0xcb54('0x24')]],'as':_0xa29d11['as'],'attributes':_0xa29d11['attributes'],'include':_0xa29d11[_0xcb54('0x22')]?_[_0xcb54('0x23')](_0xa29d11[_0xcb54('0x22')],function(_0x2485df){return{'model':db[_0x2485df[_0xcb54('0x24')]],'as':_0x2485df['as'],'attributes':_0x2485df[_0xcb54('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4613e4){logger[_0xcb54('0x11')](_0xcb54('0x1b'),_0x5c4fea);logger[_0xcb54('0x14')](_0xcb54('0x1b'),_0x5c4fea,JSON[_0xcb54('0x16')](_0x4613e4));_0x127ca9(_0x4613e4);})[_0xcb54('0x1a')](function(_0x4205cb){logger[_0xcb54('0x17')]('GetMailQueue',_0x4205cb[_0xcb54('0x19')],_0x5c4fea);_0x4d71d5(_0x7408d[_0xcb54('0x17')](0x1f4,_0x4205cb[_0xcb54('0x19')]));});});};exports[_0xcb54('0x26')]=function(_0x3b4228){var _0x48553c=this;return new Promise(function(_0x17233f,_0x3a41c8){return db[_0xcb54('0x1c')][_0xcb54('0x27')]({'raw':_0x3b4228[_0xcb54('0x1e')]?_0x3b4228[_0xcb54('0x1e')][_0xcb54('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b4228[_0xcb54('0x1e')]?_0x3b4228[_0xcb54('0x1e')][_0xcb54('0x20')]||null:null,'attributes':_0x3b4228[_0xcb54('0x1e')]?_0x3b4228[_0xcb54('0x1e')]['attributes']||null:null,'include':_0x3b4228[_0xcb54('0x1e')]?_0x3b4228[_0xcb54('0x1e')][_0xcb54('0x22')]?_['map'](_0x3b4228[_0xcb54('0x1e')][_0xcb54('0x22')],function(_0x181a3e){return{'model':db[_0x181a3e[_0xcb54('0x24')]],'as':_0x181a3e['as'],'attributes':_0x181a3e[_0xcb54('0x25')],'include':_0x181a3e[_0xcb54('0x22')]?_[_0xcb54('0x23')](_0x181a3e[_0xcb54('0x22')],function(_0x2ecb9a){return{'model':db[_0x2ecb9a['model']],'as':_0x2ecb9a['as'],'attributes':_0x2ecb9a[_0xcb54('0x25')],'include':_0x2ecb9a[_0xcb54('0x22')]?_[_0xcb54('0x23')](_0x2ecb9a[_0xcb54('0x22')],function(_0x19df0f){return{'model':db[_0x19df0f[_0xcb54('0x24')]],'as':_0x19df0f['as'],'attributes':_0x19df0f['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb54('0x10')](function(_0x30dc30){logger['info']('ShowMailQueue',_0x3b4228);logger[_0xcb54('0x14')](_0xcb54('0x26'),_0x3b4228,JSON[_0xcb54('0x16')](_0x30dc30));_0x17233f(_0x30dc30);})[_0xcb54('0x1a')](function(_0x1da37b){logger['error'](_0xcb54('0x26'),_0x1da37b[_0xcb54('0x19')],_0x3b4228);_0x3a41c8(_0x48553c[_0xcb54('0x17')](0x1f4,_0x1da37b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b3482f2..215a835 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 _0x3dde=['mailQueue:','save','remove','update','removeListener','length'];(function(_0x10b94c,_0x2d4010){var _0x3d845d=function(_0x59c9d9){while(--_0x59c9d9){_0x10b94c['push'](_0x10b94c['shift']());}};_0x3d845d(++_0x2d4010);}(_0x3dde,0x14b));var _0xe3dd=function(_0x59ecd1,_0x4dc7dd){_0x59ecd1=_0x59ecd1-0x0;var _0x266580=_0x3dde[_0x59ecd1];return _0x266580;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xe3dd('0x0'),_0xe3dd('0x1'),_0xe3dd('0x2')];function createListener(_0x105845,_0x20c008){return function(_0x4c67a5){_0x20c008['emit'](_0x105845,_0x4c67a5);};}function removeListener(_0x424e52,_0x18678e){return function(){MailQueueEvents[_0xe3dd('0x3')](_0x424e52,_0x18678e);};}exports['register']=function(_0x1e3b98){for(var _0x46b52e=0x0,_0x118b65=events[_0xe3dd('0x4')];_0x46b52e<_0x118b65;_0x46b52e++){var _0x47993f=events[_0x46b52e];var _0x4b90fb=createListener(_0xe3dd('0x5')+_0x47993f,_0x1e3b98);MailQueueEvents['on'](_0x47993f,_0x4b90fb);}}; \ No newline at end of file +var _0x0f6d=['./mailQueue.events','save','remove','update','register','length'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0f6d,0x180));var _0xd0f6=function(_0x1f83a5,_0x59843f){_0x1f83a5=_0x1f83a5-0x0;var _0x45edf0=_0x0f6d[_0x1f83a5];return _0x45edf0;};'use strict';var MailQueueEvents=require(_0xd0f6('0x0'));var events=[_0xd0f6('0x1'),_0xd0f6('0x2'),_0xd0f6('0x3')];function createListener(_0x37eada,_0x3676d0){return function(_0x4b4bae){_0x3676d0['emit'](_0x37eada,_0x4b4bae);};}function removeListener(_0x50586a,_0x1195af){return function(){MailQueueEvents['removeListener'](_0x50586a,_0x1195af);};}exports[_0xd0f6('0x4')]=function(_0x4d20c3){for(var _0x39199c=0x0,_0xceedc7=events[_0xd0f6('0x5')];_0x39199c<_0xceedc7;_0x39199c++){var _0x1ae1d5=events[_0x39199c];var _0x4070c7=createListener('mailQueue:'+_0x1ae1d5,_0x4d20c3);MailQueueEvents['on'](_0x1ae1d5,_0x4070c7);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 30f77ce..efb9822 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 _0x1363=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x2bf999,_0x4645b1){var _0x4cf8f8=function(_0x5a4cf8){while(--_0x5a4cf8){_0x2bf999['push'](_0x2bf999['shift']());}};_0x4cf8f8(++_0x4645b1);}(_0x1363,0x73));var _0x3136=function(_0x363c59,_0x4a8ce6){_0x363c59=_0x363c59-0x0;var _0x3efb44=_0x1363[_0x363c59];return _0x3efb44;};'use strict';var multer=require(_0x3136('0x0'));var util=require(_0x3136('0x1'));var path=require(_0x3136('0x2'));var timeout=require('connect-timeout');var express=require(_0x3136('0x3'));var router=express[_0x3136('0x4')]();var fs_extra=require(_0x3136('0x5'));var auth=require(_0x3136('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3136('0x7'));var controller=require(_0x3136('0x8'));router[_0x3136('0x9')]('/',auth[_0x3136('0xa')](),controller[_0x3136('0xb')]);router[_0x3136('0x9')](_0x3136('0xc'),auth[_0x3136('0xa')](),controller[_0x3136('0xd')]);router[_0x3136('0x9')](_0x3136('0xe'),auth[_0x3136('0xa')](),controller[_0x3136('0xf')]);router[_0x3136('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3136('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3136('0x12')]);router[_0x3136('0x13')]('/:id',auth[_0x3136('0xa')](),controller[_0x3136('0x14')]);module[_0x3136('0x15')]=router; \ No newline at end of file +var _0x7eca=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','util','path'];(function(_0x559cfd,_0x48c74f){var _0x43a5b1=function(_0x12218c){while(--_0x12218c){_0x559cfd['push'](_0x559cfd['shift']());}};_0x43a5b1(++_0x48c74f);}(_0x7eca,0x1ca));var _0xa7ec=function(_0x46afe7,_0x39bbcc){_0x46afe7=_0x46afe7-0x0;var _0x4b4ee4=_0x7eca[_0x46afe7];return _0x4b4ee4;};'use strict';var multer=require('multer');var util=require(_0xa7ec('0x0'));var path=require(_0xa7ec('0x1'));var timeout=require(_0xa7ec('0x2'));var express=require(_0xa7ec('0x3'));var router=express[_0xa7ec('0x4')]();var fs_extra=require(_0xa7ec('0x5'));var auth=require(_0xa7ec('0x6'));var interaction=require(_0xa7ec('0x7'));var config=require(_0xa7ec('0x8'));var controller=require('./mailQueueReport.controller');router[_0xa7ec('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa7ec('0x9')](_0xa7ec('0xa'),auth[_0xa7ec('0xb')](),controller[_0xa7ec('0xc')]);router['get'](_0xa7ec('0xd'),auth[_0xa7ec('0xb')](),controller[_0xa7ec('0xe')]);router['post']('/',auth[_0xa7ec('0xb')](),controller[_0xa7ec('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa7ec('0x10')]);router[_0xa7ec('0x11')](_0xa7ec('0xd'),auth[_0xa7ec('0xb')](),controller[_0xa7ec('0x12')]);module[_0xa7ec('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 7b46b88..6229ce5 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 _0x56a6=['sequelize','exports','STRING','DATE','moment'];(function(_0x5839db,_0x501c84){var _0x4a0a4f=function(_0x485366){while(--_0x485366){_0x5839db['push'](_0x5839db['shift']());}};_0x4a0a4f(++_0x501c84);}(_0x56a6,0x17b));var _0x656a=function(_0x111aa4,_0xf6c801){_0x111aa4=_0x111aa4-0x0;var _0x431e18=_0x56a6[_0x111aa4];return _0x431e18;};'use strict';var moment=require(_0x656a('0x0'));var Sequelize=require(_0x656a('0x1'));module[_0x656a('0x2')]={'uniqueid':{'type':Sequelize[_0x656a('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x656a('0x4')]},'acceptAt':{'type':Sequelize[_0x656a('0x4')]},'exitAt':{'type':Sequelize[_0x656a('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf01c=['exports','STRING','DATE','sequelize'];(function(_0x4d7b43,_0x47e11c){var _0x476d6e=function(_0x189c1e){while(--_0x189c1e){_0x4d7b43['push'](_0x4d7b43['shift']());}};_0x476d6e(++_0x47e11c);}(_0xf01c,0x157));var _0xcf01=function(_0x5c1b63,_0x4d54c4){_0x5c1b63=_0x5c1b63-0x0;var _0x42dd52=_0xf01c[_0x5c1b63];return _0x42dd52;};'use strict';var moment=require('moment');var Sequelize=require(_0xcf01('0x0'));module[_0xcf01('0x1')]={'uniqueid':{'type':Sequelize[_0xcf01('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcf01('0x3')]},'leaveAt':{'type':Sequelize[_0xcf01('0x3')]},'acceptAt':{'type':Sequelize[_0xcf01('0x3')]},'exitAt':{'type':Sequelize[_0xcf01('0x3')]},'reason':{'type':Sequelize[_0xcf01('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index cd582f5..79d1704 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 _0x7b84=['sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where','pick','merge','VIRTUAL','filter','MailQueueReport','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x39153c,_0x293109){var _0x246bac=function(_0xe01010){while(--_0xe01010){_0x39153c['push'](_0x39153c['shift']());}};_0x246bac(++_0x293109);}(_0x7b84,0x17c));var _0x47b8=function(_0x23dd2a,_0x4dcc42){_0x23dd2a=_0x23dd2a-0x0;var _0x5752c1=_0x7b84[_0x23dd2a];return _0x5752c1;};'use strict';var emlformat=require(_0x47b8('0x0'));var rimraf=require(_0x47b8('0x1'));var zipdir=require(_0x47b8('0x2'));var jsonpatch=require(_0x47b8('0x3'));var rp=require(_0x47b8('0x4'));var moment=require(_0x47b8('0x5'));var BPromise=require(_0x47b8('0x6'));var Mustache=require('mustache');var util=require(_0x47b8('0x7'));var path=require(_0x47b8('0x8'));var sox=require(_0x47b8('0x9'));var csv=require(_0x47b8('0xa'));var ejs=require(_0x47b8('0xb'));var fs=require('fs');var fs_extra=require(_0x47b8('0xc'));var _=require('lodash');var squel=require(_0x47b8('0xd'));var crypto=require(_0x47b8('0xe'));var jsforce=require(_0x47b8('0xf'));var deskjs=require(_0x47b8('0x10'));var toCsv=require(_0x47b8('0xa'));var querystring=require(_0x47b8('0x11'));var Papa=require(_0x47b8('0x12'));var Redis=require(_0x47b8('0x13'));var authService=require(_0x47b8('0x14'));var qs=require(_0x47b8('0x15'));var as=require(_0x47b8('0x16'));var hardwareService=require(_0x47b8('0x17'));var logger=require(_0x47b8('0x18'))(_0x47b8('0x19'));var utils=require(_0x47b8('0x1a'));var config=require(_0x47b8('0x1b'));var licenseUtil=require(_0x47b8('0x1c'));var db=require(_0x47b8('0x1d'))['db'];function respondWithStatusCode(_0x25a224,_0x289ac7){_0x289ac7=_0x289ac7||0xcc;return function(_0x1edb4b){if(_0x1edb4b){return _0x25a224[_0x47b8('0x1e')](_0x289ac7);}return _0x25a224[_0x47b8('0x1f')](_0x289ac7)[_0x47b8('0x20')]();};}function respondWithResult(_0x173015,_0x223121){_0x223121=_0x223121||0xc8;return function(_0xf66dd6){if(_0xf66dd6){return _0x173015['status'](_0x223121)[_0x47b8('0x21')](_0xf66dd6);}};}function respondWithFilteredResult(_0x340da0,_0x3e760a){return function(_0x1217a4){if(_0x1217a4){var _0x34d5a5=typeof _0x3e760a[_0x47b8('0x22')]===_0x47b8('0x23')&&typeof _0x3e760a['limit']===_0x47b8('0x23');var _0x5c2b2c=_0x1217a4['count'];var _0x4f7317=_0x34d5a5?0x0:_0x3e760a[_0x47b8('0x22')];var _0x36faf1=_0x34d5a5?_0x1217a4[_0x47b8('0x24')]:_0x3e760a['offset']+_0x3e760a['limit'];var _0x4f6716;if(_0x36faf1>=_0x5c2b2c){_0x36faf1=_0x5c2b2c;_0x4f6716=0xc8;}else{_0x4f6716=0xce;}_0x340da0[_0x47b8('0x1f')](_0x4f6716);return _0x340da0['set'](_0x47b8('0x25'),_0x4f7317+'-'+_0x36faf1+'/'+_0x5c2b2c)[_0x47b8('0x21')](_0x1217a4);}return null;};}function patchUpdates(_0x303f19){return function(_0xfccf56){try{jsonpatch['apply'](_0xfccf56,_0x303f19,!![]);}catch(_0xc20df1){return BPromise[_0x47b8('0x26')](_0xc20df1);}return _0xfccf56[_0x47b8('0x27')]();};}function saveUpdates(_0x2f75d2,_0x168cde){return function(_0x232708){if(_0x232708){return _0x232708['update'](_0x2f75d2)[_0x47b8('0x28')](function(_0x2a22e3){return _0x2a22e3;});}return null;};}function removeEntity(_0x5301f8,_0x22e7dd){return function(_0x247429){if(_0x247429){return _0x247429[_0x47b8('0x29')]()[_0x47b8('0x28')](function(){_0x5301f8['status'](0xcc)[_0x47b8('0x20')]();});}};}function handleEntityNotFound(_0x332c23,_0x319d17){return function(_0x3e3de0){if(!_0x3e3de0){_0x332c23[_0x47b8('0x1e')](0x194);}return _0x3e3de0;};}function handleError(_0xbf5ce9,_0x40918f){_0x40918f=_0x40918f||0x1f4;return function(_0x568c1e){logger[_0x47b8('0x2a')](_0x568c1e[_0x47b8('0x2b')]);if(_0x568c1e['name']){delete _0x568c1e[_0x47b8('0x2c')];}_0xbf5ce9[_0x47b8('0x1f')](_0x40918f)[_0x47b8('0x2d')](_0x568c1e);};}exports[_0x47b8('0x2e')]=function(_0x4da0e0,_0x162d96){var _0x5c347f={},_0x2c89fc={},_0x2255ab={'count':0x0,'rows':[]};var _0x33e653=_[_0x47b8('0x2f')](db['MailQueueReport'][_0x47b8('0x30')],function(_0x264dd9){return{'name':_0x264dd9[_0x47b8('0x31')],'type':_0x264dd9[_0x47b8('0x32')][_0x47b8('0x33')]};});_0x2c89fc[_0x47b8('0x34')]=_['map'](_0x33e653,'name');_0x2c89fc['query']=_[_0x47b8('0x35')](_0x4da0e0[_0x47b8('0x36')]);_0x2c89fc[_0x47b8('0x37')]=_['intersection'](_0x2c89fc['model'],_0x2c89fc['query']);_0x5c347f['attributes']=_[_0x47b8('0x38')](_0x2c89fc[_0x47b8('0x34')],qs[_0x47b8('0x39')](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x39')]));_0x5c347f[_0x47b8('0x3a')]=_0x5c347f[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x5c347f[_0x47b8('0x3a')]:_0x2c89fc['model'];if(!_0x4da0e0['query'][_0x47b8('0x3c')](_0x47b8('0x3d'))){_0x5c347f['limit']=qs['limit'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x3e')]);_0x5c347f[_0x47b8('0x22')]=qs['offset'](_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x22')]);}_0x5c347f['order']=qs['sort'](_0x4da0e0['query']['sort']);_0x5c347f[_0x47b8('0x3f')]=qs[_0x47b8('0x37')](_[_0x47b8('0x40')](_0x4da0e0[_0x47b8('0x36')],_0x2c89fc[_0x47b8('0x37')]),_0x33e653);if(_0x4da0e0[_0x47b8('0x36')]['filter']){_0x5c347f['where']=_[_0x47b8('0x41')](_0x5c347f[_0x47b8('0x3f')],{'$or':_[_0x47b8('0x2f')](_0x33e653,function(_0x4a9ed6){if(_0x4a9ed6['type']!==_0x47b8('0x42')){var _0x2c89bc={};_0x2c89bc[_0x4a9ed6['name']]={'$like':'%'+_0x4da0e0[_0x47b8('0x36')][_0x47b8('0x43')]+'%'};return _0x2c89bc;}})});}_0x5c347f=_['merge']({},_0x5c347f,_0x4da0e0['options']);var _0x493b69={'where':_0x5c347f['where']};return db[_0x47b8('0x44')][_0x47b8('0x24')](_0x493b69)[_0x47b8('0x28')](function(_0x28cf2c){_0x2255ab[_0x47b8('0x24')]=_0x28cf2c;if(_0x4da0e0['query'][_0x47b8('0x45')]){_0x5c347f['include']=[{'all':!![]}];}return db[_0x47b8('0x44')][_0x47b8('0x46')](_0x5c347f);})[_0x47b8('0x28')](function(_0x5bede8){_0x2255ab[_0x47b8('0x47')]=_0x5bede8;return _0x2255ab;})[_0x47b8('0x28')](respondWithFilteredResult(_0x162d96,_0x5c347f))[_0x47b8('0x48')](handleError(_0x162d96,null));};exports[_0x47b8('0x49')]=function(_0x3eaf01,_0x15b9a1){var _0x2d2971={'raw':!![],'where':{'id':_0x3eaf01[_0x47b8('0x4a')]['id']}},_0x569d29={};_0x569d29['model']=_[_0x47b8('0x35')](db[_0x47b8('0x44')][_0x47b8('0x30')]);_0x569d29[_0x47b8('0x36')]=_[_0x47b8('0x35')](_0x3eaf01[_0x47b8('0x36')]);_0x569d29['filters']=_['intersection'](_0x569d29[_0x47b8('0x34')],_0x569d29[_0x47b8('0x36')]);_0x2d2971[_0x47b8('0x3a')]=_['intersection'](_0x569d29[_0x47b8('0x34')],qs['fields'](_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x39')]));_0x2d2971[_0x47b8('0x3a')]=_0x2d2971[_0x47b8('0x3a')][_0x47b8('0x3b')]?_0x2d2971['attributes']:_0x569d29[_0x47b8('0x34')];if(_0x3eaf01[_0x47b8('0x36')][_0x47b8('0x45')]){_0x2d2971[_0x47b8('0x4b')]=[{'all':!![]}];}_0x2d2971=_[_0x47b8('0x41')]({},_0x2d2971,_0x3eaf01[_0x47b8('0x4c')]);return db[_0x47b8('0x44')]['find'](_0x2d2971)[_0x47b8('0x28')](handleEntityNotFound(_0x15b9a1,null))['then'](respondWithResult(_0x15b9a1,null))[_0x47b8('0x48')](handleError(_0x15b9a1,null));};exports[_0x47b8('0x4d')]=function(_0x4a46eb,_0x132e9a){return db[_0x47b8('0x44')][_0x47b8('0x4d')](_0x4a46eb[_0x47b8('0x4e')],{})[_0x47b8('0x28')](respondWithResult(_0x132e9a,0xc9))[_0x47b8('0x48')](handleError(_0x132e9a,null));};exports[_0x47b8('0x4f')]=function(_0x381d3a,_0x4ad8a8){if(_0x381d3a[_0x47b8('0x4e')]['id']){delete _0x381d3a[_0x47b8('0x4e')]['id'];}return db[_0x47b8('0x44')]['find']({'where':{'id':_0x381d3a[_0x47b8('0x4a')]['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x4ad8a8,null))[_0x47b8('0x28')](saveUpdates(_0x381d3a[_0x47b8('0x4e')],null))['then'](respondWithResult(_0x4ad8a8,null))[_0x47b8('0x48')](handleError(_0x4ad8a8,null));};exports[_0x47b8('0x29')]=function(_0x51ac62,_0x270054){return db[_0x47b8('0x44')][_0x47b8('0x50')]({'where':{'id':_0x51ac62['params']['id']}})[_0x47b8('0x28')](handleEntityNotFound(_0x270054,null))['then'](removeEntity(_0x270054,null))[_0x47b8('0x48')](handleError(_0x270054,null));};exports['describe']=function(_0x2a03c2,_0x498512){return db[_0x47b8('0x44')][_0x47b8('0x51')]()[_0x47b8('0x28')](respondWithResult(_0x498512,null))[_0x47b8('0x48')](handleError(_0x498512,null));}; \ No newline at end of file +var _0xd4a2=['describe','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','MailQueueReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body'];(function(_0x323f1e,_0xad33a5){var _0x516b77=function(_0x4dbc4f){while(--_0x4dbc4f){_0x323f1e['push'](_0x323f1e['shift']());}};_0x516b77(++_0xad33a5);}(_0xd4a2,0x173));var _0x2d4a=function(_0x370dcc,_0xa2a1bd){_0x370dcc=_0x370dcc-0x0;var _0x58a36e=_0xd4a2[_0x370dcc];return _0x58a36e;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];function respondWithStatusCode(_0x45b9fb,_0x5ac803){_0x5ac803=_0x5ac803||0xcc;return function(_0x2f785f){if(_0x2f785f){return _0x45b9fb[_0x2d4a('0x17')](_0x5ac803);}return _0x45b9fb[_0x2d4a('0x18')](_0x5ac803)[_0x2d4a('0x19')]();};}function respondWithResult(_0x544622,_0x4be8b4){_0x4be8b4=_0x4be8b4||0xc8;return function(_0x2a1d0f){if(_0x2a1d0f){return _0x544622['status'](_0x4be8b4)[_0x2d4a('0x1a')](_0x2a1d0f);}};}function respondWithFilteredResult(_0x175bda,_0x11896d){return function(_0x3a3156){if(_0x3a3156){var _0x4c5287=typeof _0x11896d[_0x2d4a('0x1b')]==='undefined'&&typeof _0x11896d[_0x2d4a('0x1c')]==='undefined';var _0x435687=_0x3a3156[_0x2d4a('0x1d')];var _0x2188b2=_0x4c5287?0x0:_0x11896d[_0x2d4a('0x1b')];var _0x498956=_0x4c5287?_0x3a3156['count']:_0x11896d['offset']+_0x11896d[_0x2d4a('0x1c')];var _0x1966d1;if(_0x498956>=_0x435687){_0x498956=_0x435687;_0x1966d1=0xc8;}else{_0x1966d1=0xce;}_0x175bda[_0x2d4a('0x18')](_0x1966d1);return _0x175bda[_0x2d4a('0x1e')](_0x2d4a('0x1f'),_0x2188b2+'-'+_0x498956+'/'+_0x435687)[_0x2d4a('0x1a')](_0x3a3156);}return null;};}function patchUpdates(_0x56445a){return function(_0x49f378){try{jsonpatch[_0x2d4a('0x20')](_0x49f378,_0x56445a,!![]);}catch(_0x1f3e17){return BPromise[_0x2d4a('0x21')](_0x1f3e17);}return _0x49f378[_0x2d4a('0x22')]();};}function saveUpdates(_0x1a2d20,_0x2e7736){return function(_0x22dd0b){if(_0x22dd0b){return _0x22dd0b[_0x2d4a('0x23')](_0x1a2d20)['then'](function(_0x26e7b8){return _0x26e7b8;});}return null;};}function removeEntity(_0x3240a2,_0x2c3799){return function(_0x42d813){if(_0x42d813){return _0x42d813[_0x2d4a('0x24')]()[_0x2d4a('0x25')](function(){_0x3240a2[_0x2d4a('0x18')](0xcc)[_0x2d4a('0x19')]();});}};}function handleEntityNotFound(_0x54c910,_0x544b9b){return function(_0x5cc7d8){if(!_0x5cc7d8){_0x54c910[_0x2d4a('0x17')](0x194);}return _0x5cc7d8;};}function handleError(_0x5029f3,_0x410f7d){_0x410f7d=_0x410f7d||0x1f4;return function(_0x3a2fd3){logger[_0x2d4a('0x26')](_0x3a2fd3[_0x2d4a('0x27')]);if(_0x3a2fd3[_0x2d4a('0x28')]){delete _0x3a2fd3[_0x2d4a('0x28')];}_0x5029f3[_0x2d4a('0x18')](_0x410f7d)[_0x2d4a('0x29')](_0x3a2fd3);};}exports['index']=function(_0x436f53,_0x5ce262){var _0x221602={},_0x9bac28={},_0xc497ce={'count':0x0,'rows':[]};var _0x20b87d=_[_0x2d4a('0x2a')](db[_0x2d4a('0x2b')][_0x2d4a('0x2c')],function(_0x2e8063){return{'name':_0x2e8063['fieldName'],'type':_0x2e8063[_0x2d4a('0x2d')][_0x2d4a('0x2e')]};});_0x9bac28[_0x2d4a('0x2f')]=_[_0x2d4a('0x2a')](_0x20b87d,_0x2d4a('0x28'));_0x9bac28['query']=_[_0x2d4a('0x30')](_0x436f53[_0x2d4a('0x31')]);_0x9bac28[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],_0x9bac28['query']);_0x221602[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],qs[_0x2d4a('0x35')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x35')]));_0x221602['attributes']=_0x221602[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x221602[_0x2d4a('0x34')]:_0x9bac28[_0x2d4a('0x2f')];if(!_0x436f53[_0x2d4a('0x31')]['hasOwnProperty'](_0x2d4a('0x37'))){_0x221602[_0x2d4a('0x1c')]=qs['limit'](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1c')]);_0x221602[_0x2d4a('0x1b')]=qs[_0x2d4a('0x1b')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1b')]);}_0x221602['order']=qs[_0x2d4a('0x38')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x38')]);_0x221602[_0x2d4a('0x39')]=qs[_0x2d4a('0x32')](_[_0x2d4a('0x3a')](_0x436f53['query'],_0x9bac28['filters']),_0x20b87d);if(_0x436f53[_0x2d4a('0x31')]['filter']){_0x221602[_0x2d4a('0x39')]=_[_0x2d4a('0x3b')](_0x221602['where'],{'$or':_[_0x2d4a('0x2a')](_0x20b87d,function(_0x275598){if(_0x275598[_0x2d4a('0x2d')]!==_0x2d4a('0x3c')){var _0x67bce3={};_0x67bce3[_0x275598[_0x2d4a('0x28')]]={'$like':'%'+_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x3d')]+'%'};return _0x67bce3;}})});}_0x221602=_[_0x2d4a('0x3b')]({},_0x221602,_0x436f53[_0x2d4a('0x3e')]);var _0x3bb0cc={'where':_0x221602['where']};return db[_0x2d4a('0x2b')][_0x2d4a('0x1d')](_0x3bb0cc)[_0x2d4a('0x25')](function(_0x2f1635){_0xc497ce[_0x2d4a('0x1d')]=_0x2f1635;if(_0x436f53['query']['includeAll']){_0x221602['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x2d4a('0x3f')](_0x221602);})[_0x2d4a('0x25')](function(_0xf39020){_0xc497ce[_0x2d4a('0x40')]=_0xf39020;return _0xc497ce;})['then'](respondWithFilteredResult(_0x5ce262,_0x221602))[_0x2d4a('0x41')](handleError(_0x5ce262,null));};exports[_0x2d4a('0x42')]=function(_0x5e9704,_0x189d2a){var _0x13b0f0={'raw':!![],'where':{'id':_0x5e9704[_0x2d4a('0x43')]['id']}},_0x8a9375={};_0x8a9375[_0x2d4a('0x2f')]=_[_0x2d4a('0x30')](db['MailQueueReport'][_0x2d4a('0x2c')]);_0x8a9375[_0x2d4a('0x31')]=_[_0x2d4a('0x30')](_0x5e9704[_0x2d4a('0x31')]);_0x8a9375[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x8a9375['model'],_0x8a9375[_0x2d4a('0x31')]);_0x13b0f0[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x8a9375['model'],qs[_0x2d4a('0x35')](_0x5e9704['query'][_0x2d4a('0x35')]));_0x13b0f0[_0x2d4a('0x34')]=_0x13b0f0[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x13b0f0[_0x2d4a('0x34')]:_0x8a9375['model'];if(_0x5e9704['query'][_0x2d4a('0x44')]){_0x13b0f0[_0x2d4a('0x45')]=[{'all':!![]}];}_0x13b0f0=_['merge']({},_0x13b0f0,_0x5e9704[_0x2d4a('0x3e')]);return db['MailQueueReport'][_0x2d4a('0x46')](_0x13b0f0)[_0x2d4a('0x25')](handleEntityNotFound(_0x189d2a,null))[_0x2d4a('0x25')](respondWithResult(_0x189d2a,null))['catch'](handleError(_0x189d2a,null));};exports[_0x2d4a('0x47')]=function(_0x541b93,_0x3806b8){return db[_0x2d4a('0x2b')][_0x2d4a('0x47')](_0x541b93[_0x2d4a('0x48')],{})[_0x2d4a('0x25')](respondWithResult(_0x3806b8,0xc9))[_0x2d4a('0x41')](handleError(_0x3806b8,null));};exports[_0x2d4a('0x23')]=function(_0x2b2f4b,_0x1ffb96){if(_0x2b2f4b[_0x2d4a('0x48')]['id']){delete _0x2b2f4b[_0x2d4a('0x48')]['id'];}return db['MailQueueReport'][_0x2d4a('0x46')]({'where':{'id':_0x2b2f4b[_0x2d4a('0x43')]['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x1ffb96,null))[_0x2d4a('0x25')](saveUpdates(_0x2b2f4b[_0x2d4a('0x48')],null))['then'](respondWithResult(_0x1ffb96,null))[_0x2d4a('0x41')](handleError(_0x1ffb96,null));};exports[_0x2d4a('0x24')]=function(_0x2123e8,_0x440625){return db[_0x2d4a('0x2b')]['find']({'where':{'id':_0x2123e8['params']['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x440625,null))[_0x2d4a('0x25')](removeEntity(_0x440625,null))['catch'](handleError(_0x440625,null));};exports[_0x2d4a('0x49')]=function(_0x33f413,_0x7f0807){return db[_0x2d4a('0x2b')]['describe']()[_0x2d4a('0x25')](respondWithResult(_0x7f0807,null))['catch'](handleError(_0x7f0807,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 2a96dfd..7e474fb 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 _0x404f=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','define','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0xec92ff,_0x6ff1f4){var _0x17fea7=function(_0x75e36d){while(--_0x75e36d){_0xec92ff['push'](_0xec92ff['shift']());}};_0x17fea7(++_0x6ff1f4);}(_0x404f,0x83));var _0xf404=function(_0x27439a,_0x197db5){_0x27439a=_0x27439a-0x0;var _0x5c6b9a=_0x404f[_0x27439a];return _0x5c6b9a;};'use strict';var _=require(_0xf404('0x0'));var util=require(_0xf404('0x1'));var logger=require(_0xf404('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf404('0x3'));var rp=require(_0xf404('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf404('0x5'));var config=require(_0xf404('0x6'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x2ae313,_0x484b58){return _0x2ae313[_0xf404('0x7')](_0xf404('0x8'),attributes,{'tableName':_0xf404('0x9'),'paranoid':![],'indexes':[{'name':_0xf404('0xa'),'fields':[_0xf404('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd202=['rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0xd202,0x15a));var _0x2d20=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd202[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x2d20('0x0'));var util=require(_0x2d20('0x1'));var logger=require(_0x2d20('0x2'))(_0x2d20('0x3'));var moment=require(_0x2d20('0x4'));var BPromise=require(_0x2d20('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2d20('0x6'));var config=require(_0x2d20('0x7'));var attributes=require(_0x2d20('0x8'));module['exports']=function(_0x469e42,_0x4d00fb){return _0x469e42[_0x2d20('0x9')](_0x2d20('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6cb0f14..a30508d 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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x260e07,_0x2dd0e4){var _0x28ba4e=function(_0x237146){while(--_0x237146){_0x260e07['push'](_0x260e07['shift']());}};_0x28ba4e(++_0x2dd0e4);}(_0xdb28,0x106));var _0x8db2=function(_0xc3cff6,_0x22ec28){_0xc3cff6=_0xc3cff6-0x0;var _0xfec03f=_0xdb28[_0xc3cff6];return _0xfec03f;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +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(_0x41b8f9,_0x2e5a01){var _0x5145d1=function(_0x1aafe9){while(--_0x1aafe9){_0x41b8f9['push'](_0x41b8f9['shift']());}};_0x5145d1(++_0x2e5a01);}(_0x2ef3,0xba));var _0x32ef=function(_0x4efeb9,_0x1a6d8c){_0x4efeb9=_0x4efeb9-0x0;var _0x39fbc7=_0x2ef3[_0x4efeb9];return _0x39fbc7;};'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 e08523d..98f62fb 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x344b89,_0x2b3fbd){var _0xbfff34=function(_0x42cb7c){while(--_0x42cb7c){_0x344b89['push'](_0x344b89['shift']());}};_0xbfff34(++_0x2b3fbd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2caaef,_0x3c19ed){_0x2caaef=_0x2caaef-0x0;var _0xd011f8=_0xcb91[_0x2caaef];return _0xd011f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x51e71c,_0x6a01c8){var _0x20d488=function(_0xfc1583){while(--_0xfc1583){_0x51e71c['push'](_0x51e71c['shift']());}};_0x20d488(++_0x6a01c8);}(_0x70e0,0x17b));var _0x070e=function(_0x3f3bb8,_0x11b6c4){_0x3f3bb8=_0x3f3bb8-0x0;var _0x154c13=_0x70e0[_0x3f3bb8];return _0x154c13;};'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 9f198ba..1e8cfb7 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 _0xb8b2=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x690a67,_0x28cc0d){var _0x509bb6=function(_0x59eadd){while(--_0x59eadd){_0x690a67['push'](_0x690a67['shift']());}};_0x509bb6(++_0x28cc0d);}(_0xb8b2,0x162));var _0x2b8b=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xb8b2[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x2b8b('0x0'));module[_0x2b8b('0x1')]={'description':{'type':Sequelize[_0x2b8b('0x2')]},'host':{'type':Sequelize[_0x2b8b('0x2')]},'authentication':{'type':Sequelize[_0x2b8b('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2b8b('0x2')]},'port':{'type':Sequelize[_0x2b8b('0x4')]},'tls':{'type':Sequelize[_0x2b8b('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2b8b('0x2')],'defaultValue':_0x2b8b('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2b8b('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x2b8b('0x2')]},'modernAuthentication':{'type':Sequelize[_0x2b8b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf0d3=['STRING','INTEGER','INBOX','BOOLEAN','sequelize','exports'];(function(_0x567966,_0x3d0242){var _0x279b9e=function(_0x367df9){while(--_0x367df9){_0x567966['push'](_0x567966['shift']());}};_0x279b9e(++_0x3d0242);}(_0xf0d3,0x100));var _0x3f0d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0d3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3f0d('0x0'));module[_0x3f0d('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x3f0d('0x2')]},'password':{'type':Sequelize[_0x3f0d('0x2')]},'port':{'type':Sequelize[_0x3f0d('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3f0d('0x2')],'defaultValue':_0x3f0d('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3f0d('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x3f0d('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3f0d('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index cf6586c..a01cc98 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 _0xca65=['bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','lodash','util','../../config/logger','api','moment'];(function(_0x18bbe0,_0x233092){var _0x33a85e=function(_0x451ece){while(--_0x451ece){_0x18bbe0['push'](_0x18bbe0['shift']());}};_0x33a85e(++_0x233092);}(_0xca65,0xcd));var _0x5ca6=function(_0x4bd40b,_0x259d78){_0x4bd40b=_0x4bd40b-0x0;var _0x4a2093=_0xca65[_0x4bd40b];return _0x4a2093;};'use strict';var _=require(_0x5ca6('0x0'));var util=require(_0x5ca6('0x1'));var logger=require(_0x5ca6('0x2'))(_0x5ca6('0x3'));var moment=require(_0x5ca6('0x4'));var BPromise=require(_0x5ca6('0x5'));var rp=require(_0x5ca6('0x6'));var fs=require('fs');var path=require(_0x5ca6('0x7'));var rimraf=require(_0x5ca6('0x8'));var config=require(_0x5ca6('0x9'));var attributes=require(_0x5ca6('0xa'));module[_0x5ca6('0xb')]=function(_0x41cf59,_0x50f7e0){return _0x41cf59[_0x5ca6('0xc')](_0x5ca6('0xd'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a0e=['./mailServerIn.attributes','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x31e995,_0x3e9193){var _0x3cba66=function(_0x5eac5a){while(--_0x5eac5a){_0x31e995['push'](_0x31e995['shift']());}};_0x3cba66(++_0x3e9193);}(_0x1a0e,0x110));var _0xe1a0=function(_0x392dc2,_0x47c3f3){_0x392dc2=_0x392dc2-0x0;var _0x14150f=_0x1a0e[_0x392dc2];return _0x14150f;};'use strict';var _=require(_0xe1a0('0x0'));var util=require(_0xe1a0('0x1'));var logger=require(_0xe1a0('0x2'))(_0xe1a0('0x3'));var moment=require('moment');var BPromise=require(_0xe1a0('0x4'));var rp=require(_0xe1a0('0x5'));var fs=require('fs');var path=require(_0xe1a0('0x6'));var rimraf=require(_0xe1a0('0x7'));var config=require('../../config/environment');var attributes=require(_0xe1a0('0x8'));module['exports']=function(_0x3d062b,_0x3ec5ea){return _0x3d062b['define']('MailServerIn',attributes,{'tableName':_0xe1a0('0x9'),'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 d396664..5114e1a 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 _0x7aa0=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x7aa0,0x1b9));var _0x07aa=function(_0x57381e,_0x13d465){_0x57381e=_0x57381e-0x0;var _0x416c19=_0x7aa0[_0x57381e];return _0x416c19;};'use strict';var _=require(_0x07aa('0x0'));var util=require(_0x07aa('0x1'));var moment=require(_0x07aa('0x2'));var BPromise=require(_0x07aa('0x3'));var rs=require(_0x07aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07aa('0x5'))['db'];var utils=require(_0x07aa('0x6'));var logger=require(_0x07aa('0x7'))(_0x07aa('0x8'));var config=require(_0x07aa('0x9'));var jayson=require(_0x07aa('0xa'));var client=jayson['client'][_0x07aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x113b21,_0x159618,_0x14f952){return new BPromise(function(_0x3ee606,_0xb4481b){return client[_0x07aa('0xc')](_0x113b21,_0x14f952)[_0x07aa('0xd')](function(_0x5e2813){logger[_0x07aa('0xe')](_0x07aa('0xf'),_0x159618,_0x07aa('0x10'));logger['debug'](_0x07aa('0x11'),_0x159618,_0x07aa('0x10'),JSON['stringify'](_0x5e2813));if(_0x5e2813['error']){if(_0x5e2813[_0x07aa('0x12')]['code']===0x1f4){logger[_0x07aa('0x12')](_0x07aa('0xf'),_0x159618,_0x5e2813['error'][_0x07aa('0x13')]);return _0xb4481b(_0x5e2813['error'][_0x07aa('0x13')]);}logger[_0x07aa('0x12')]('MailServerIn,\x20%s,\x20%s',_0x159618,_0x5e2813[_0x07aa('0x12')]['message']);return _0x3ee606(_0x5e2813['error'][_0x07aa('0x13')]);}else{logger[_0x07aa('0xe')](_0x07aa('0xf'),_0x159618,_0x07aa('0x10'));_0x3ee606(_0x5e2813[_0x07aa('0x14')]['message']);}})[_0x07aa('0x15')](function(_0x3d6704){logger[_0x07aa('0x12')](_0x07aa('0xf'),_0x159618,_0x3d6704);_0xb4481b(_0x3d6704);});});}exports[_0x07aa('0x16')]=function(_0x34a89f){var _0x51d51a=this;return new Promise(function(_0x228c1f,_0xdbbd95){return db[_0x07aa('0x17')][_0x07aa('0x18')]({'raw':_0x34a89f[_0x07aa('0x19')]?_0x34a89f[_0x07aa('0x19')][_0x07aa('0x1a')]===undefined?!![]:![]:!![],'where':_0x34a89f[_0x07aa('0x19')]?_0x34a89f[_0x07aa('0x19')][_0x07aa('0x1b')]||null:null,'attributes':_0x34a89f[_0x07aa('0x19')]?_0x34a89f[_0x07aa('0x19')][_0x07aa('0x1c')]||null:null,'limit':_0x34a89f['options']?_0x34a89f['options'][_0x07aa('0x1d')]||null:null,'include':_0x34a89f[_0x07aa('0x19')]?_0x34a89f[_0x07aa('0x19')][_0x07aa('0x1e')]?_[_0x07aa('0x1f')](_0x34a89f[_0x07aa('0x19')][_0x07aa('0x1e')],function(_0x5ed7fd){return{'model':db[_0x5ed7fd[_0x07aa('0x20')]],'as':_0x5ed7fd['as'],'attributes':_0x5ed7fd[_0x07aa('0x1c')],'include':_0x5ed7fd[_0x07aa('0x1e')]?_[_0x07aa('0x1f')](_0x5ed7fd['include'],function(_0x5175c8){return{'model':db[_0x5175c8['model']],'as':_0x5175c8['as'],'attributes':_0x5175c8['attributes'],'include':_0x5175c8[_0x07aa('0x1e')]?_[_0x07aa('0x1f')](_0x5175c8[_0x07aa('0x1e')],function(_0x412674){return{'model':db[_0x412674[_0x07aa('0x20')]],'as':_0x412674['as'],'attributes':_0x412674['attributes']};}):[]};}):[]};}):[]:[]})[_0x07aa('0xd')](function(_0x1f1db2){logger[_0x07aa('0xe')](_0x07aa('0x16'),_0x34a89f);logger['debug']('GetMailServerIn',_0x34a89f,JSON[_0x07aa('0x21')](_0x1f1db2));_0x228c1f(_0x1f1db2);})[_0x07aa('0x15')](function(_0x5712ed){logger['error'](_0x07aa('0x16'),_0x5712ed[_0x07aa('0x13')],_0x34a89f);_0xdbbd95(_0x51d51a[_0x07aa('0x12')](0x1f4,_0x5712ed[_0x07aa('0x13')]));});});}; \ No newline at end of file +var _0xee5b=['MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','include','map','model','attributes','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info'];(function(_0x29a249,_0x1ba2e5){var _0x365929=function(_0x4f6c3f){while(--_0x4f6c3f){_0x29a249['push'](_0x29a249['shift']());}};_0x365929(++_0x1ba2e5);}(_0xee5b,0x1f4));var _0xbee5=function(_0x43bc92,_0x1c961f){_0x43bc92=_0x43bc92-0x0;var _0x32edc5=_0xee5b[_0x43bc92];return _0x32edc5;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('MailServerIn,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});}exports[_0xbee5('0x15')]=function(_0x538460){var _0x11b4a3=this;return new Promise(function(_0x3c3f4e,_0x35eb5c){return db[_0xbee5('0x16')][_0xbee5('0x17')]({'raw':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')]['attributes']||null:null,'limit':_0x538460['options']?_0x538460[_0xbee5('0x18')]['limit']||null:null,'include':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')],function(_0x359ccf){return{'model':db[_0x359ccf[_0xbee5('0x1d')]],'as':_0x359ccf['as'],'attributes':_0x359ccf[_0xbee5('0x1e')],'include':_0x359ccf['include']?_['map'](_0x359ccf['include'],function(_0x519473){return{'model':db[_0x519473['model']],'as':_0x519473['as'],'attributes':_0x519473[_0xbee5('0x1e')],'include':_0x519473[_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x519473[_0xbee5('0x1b')],function(_0x169042){return{'model':db[_0x169042[_0xbee5('0x1d')]],'as':_0x169042['as'],'attributes':_0x169042[_0xbee5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b50f){logger[_0xbee5('0xb')](_0xbee5('0x15'),_0x538460);logger[_0xbee5('0xd')](_0xbee5('0x15'),_0x538460,JSON['stringify'](_0x36b50f));_0x3c3f4e(_0x36b50f);})[_0xbee5('0x1f')](function(_0x15ffb1){logger[_0xbee5('0x11')](_0xbee5('0x15'),_0x15ffb1[_0xbee5('0x13')],_0x538460);_0x35eb5c(_0x11b4a3[_0xbee5('0x11')](0x1f4,_0x15ffb1[_0xbee5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f2324b6..cdd4b51 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x7a54,0x106));var _0x47a5=function(_0x99b4ef,_0xeb8ce9){_0x99b4ef=_0x99b4ef-0x0;var _0x3eb27c=_0x7a54[_0x99b4ef];return _0x3eb27c;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7a54,0x106));var _0x47a5=function(_0x23ea36,_0x1acfa4){_0x23ea36=_0x23ea36-0x0;var _0x1644d6=_0x7a54[_0x23ea36];return _0x1644d6;};'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 afbe4c4..5749929 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 _0xa902=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0xe7ccb5,_0x4908a9){var _0x5a2ca8=function(_0x54875f){while(--_0x54875f){_0xe7ccb5['push'](_0xe7ccb5['shift']());}};_0x5a2ca8(++_0x4908a9);}(_0xa902,0x8d));var _0x2a90=function(_0xe1b9c0,_0x37f2d3){_0xe1b9c0=_0xe1b9c0-0x0;var _0x27d7eb=_0xa902[_0xe1b9c0];return _0x27d7eb;};'use strict';var Sequelize=require(_0x2a90('0x0'));module[_0x2a90('0x1')]={'description':{'type':Sequelize[_0x2a90('0x2')]},'host':{'type':Sequelize[_0x2a90('0x2')]},'user':{'type':Sequelize[_0x2a90('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2a90('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x2a90('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2a90('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x13f6=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x8d5813,_0x3a8fdb){var _0x3817fb=function(_0xff13d6){while(--_0xff13d6){_0x8d5813['push'](_0x8d5813['shift']());}};_0x3817fb(++_0x3a8fdb);}(_0x13f6,0x124));var _0x613f=function(_0x36f194,_0x460f00){_0x36f194=_0x36f194-0x0;var _0x526d83=_0x13f6[_0x36f194];return _0x526d83;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x613f('0x2')]},'pass':{'type':Sequelize[_0x613f('0x2')]},'port':{'type':Sequelize[_0x613f('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x613f('0x2')]},'authentication':{'type':Sequelize[_0x613f('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x613f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index a828703..92137af 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 _0xfff6=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','merge','filter','options','includeAll','include','MailServerOut','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','map'];(function(_0x4a305a,_0x2a9a1a){var _0x1f2457=function(_0x5045b8){while(--_0x5045b8){_0x4a305a['push'](_0x4a305a['shift']());}};_0x1f2457(++_0x2a9a1a);}(_0xfff6,0x13d));var _0x6fff=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfff6[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x6fff('0x0'));var rimraf=require(_0x6fff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fff('0x2'));var rp=require('request-promise');var moment=require(_0x6fff('0x3'));var BPromise=require(_0x6fff('0x4'));var Mustache=require(_0x6fff('0x5'));var util=require(_0x6fff('0x6'));var path=require(_0x6fff('0x7'));var sox=require(_0x6fff('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fff('0x9'));var _=require(_0x6fff('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6fff('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6fff('0xc'));var Papa=require(_0x6fff('0xd'));var Redis=require(_0x6fff('0xe'));var authService=require(_0x6fff('0xf'));var qs=require(_0x6fff('0x10'));var as=require(_0x6fff('0x11'));var hardwareService=require(_0x6fff('0x12'));var logger=require(_0x6fff('0x13'))(_0x6fff('0x14'));var utils=require(_0x6fff('0x15'));var config=require(_0x6fff('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6fff('0x17'))['db'];function respondWithStatusCode(_0x2ea4ea,_0x9d47a8){_0x9d47a8=_0x9d47a8||0xcc;return function(_0x575962){if(_0x575962){return _0x2ea4ea[_0x6fff('0x18')](_0x9d47a8);}return _0x2ea4ea['status'](_0x9d47a8)[_0x6fff('0x19')]();};}function respondWithResult(_0x3493ef,_0x4d28f9){_0x4d28f9=_0x4d28f9||0xc8;return function(_0x19aa84){if(_0x19aa84){return _0x3493ef[_0x6fff('0x1a')](_0x4d28f9)[_0x6fff('0x1b')](_0x19aa84);}};}function respondWithFilteredResult(_0x3df2fa,_0x129dc3){return function(_0x31d256){if(_0x31d256){var _0x57f359=typeof _0x129dc3[_0x6fff('0x1c')]===_0x6fff('0x1d')&&typeof _0x129dc3[_0x6fff('0x1e')]==='undefined';var _0x3bd0d4=_0x31d256[_0x6fff('0x1f')];var _0x506c58=_0x57f359?0x0:_0x129dc3['offset'];var _0x76e140=_0x57f359?_0x31d256[_0x6fff('0x1f')]:_0x129dc3[_0x6fff('0x1c')]+_0x129dc3[_0x6fff('0x1e')];var _0x28e43f;if(_0x76e140>=_0x3bd0d4){_0x76e140=_0x3bd0d4;_0x28e43f=0xc8;}else{_0x28e43f=0xce;}_0x3df2fa['status'](_0x28e43f);return _0x3df2fa[_0x6fff('0x20')](_0x6fff('0x21'),_0x506c58+'-'+_0x76e140+'/'+_0x3bd0d4)[_0x6fff('0x1b')](_0x31d256);}return null;};}function patchUpdates(_0xef9338){return function(_0x2cd083){try{jsonpatch[_0x6fff('0x22')](_0x2cd083,_0xef9338,!![]);}catch(_0x7c0deb){return BPromise['reject'](_0x7c0deb);}return _0x2cd083[_0x6fff('0x23')]();};}function saveUpdates(_0x5be152,_0x41e468){return function(_0x4ea5e6){if(_0x4ea5e6){return _0x4ea5e6[_0x6fff('0x24')](_0x5be152)[_0x6fff('0x25')](function(_0x97ca26){return _0x97ca26;});}return null;};}function removeEntity(_0x551111,_0x4b9ace){return function(_0x4ef787){if(_0x4ef787){return _0x4ef787[_0x6fff('0x26')]()[_0x6fff('0x25')](function(){_0x551111[_0x6fff('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x199786,_0x205053){return function(_0x3cfdaa){if(!_0x3cfdaa){_0x199786[_0x6fff('0x18')](0x194);}return _0x3cfdaa;};}function handleError(_0x7f023e,_0x463921){_0x463921=_0x463921||0x1f4;return function(_0x40eb27){logger[_0x6fff('0x27')](_0x40eb27['stack']);if(_0x40eb27['name']){delete _0x40eb27[_0x6fff('0x28')];}_0x7f023e[_0x6fff('0x1a')](_0x463921)['send'](_0x40eb27);};}exports[_0x6fff('0x29')]=function(_0x3aa494,_0x2a762e){var _0x23d528={},_0x5a6fad={},_0x1fb5fc={'count':0x0,'rows':[]};var _0x489b20=_[_0x6fff('0x2a')](db['MailServerOut'][_0x6fff('0x2b')],function(_0x2d2adf){return{'name':_0x2d2adf[_0x6fff('0x2c')],'type':_0x2d2adf[_0x6fff('0x2d')][_0x6fff('0x2e')]};});_0x5a6fad[_0x6fff('0x2f')]=_['map'](_0x489b20,'name');_0x5a6fad[_0x6fff('0x30')]=_[_0x6fff('0x31')](_0x3aa494['query']);_0x5a6fad[_0x6fff('0x32')]=_[_0x6fff('0x33')](_0x5a6fad[_0x6fff('0x2f')],_0x5a6fad['query']);_0x23d528[_0x6fff('0x34')]=_['intersection'](_0x5a6fad[_0x6fff('0x2f')],qs[_0x6fff('0x35')](_0x3aa494[_0x6fff('0x30')][_0x6fff('0x35')]));_0x23d528[_0x6fff('0x34')]=_0x23d528[_0x6fff('0x34')]['length']?_0x23d528['attributes']:_0x5a6fad['model'];if(!_0x3aa494[_0x6fff('0x30')][_0x6fff('0x36')]('nolimit')){_0x23d528['limit']=qs[_0x6fff('0x1e')](_0x3aa494[_0x6fff('0x30')][_0x6fff('0x1e')]);_0x23d528['offset']=qs[_0x6fff('0x1c')](_0x3aa494[_0x6fff('0x30')][_0x6fff('0x1c')]);}_0x23d528[_0x6fff('0x37')]=qs['sort'](_0x3aa494[_0x6fff('0x30')]['sort']);_0x23d528[_0x6fff('0x38')]=qs[_0x6fff('0x32')](_['pick'](_0x3aa494[_0x6fff('0x30')],_0x5a6fad[_0x6fff('0x32')]),_0x489b20);if(_0x3aa494[_0x6fff('0x30')]['filter']){_0x23d528[_0x6fff('0x38')]=_[_0x6fff('0x39')](_0x23d528[_0x6fff('0x38')],{'$or':_[_0x6fff('0x2a')](_0x489b20,function(_0xec8049){if(_0xec8049[_0x6fff('0x2d')]!=='VIRTUAL'){var _0x2e1c11={};_0x2e1c11[_0xec8049[_0x6fff('0x28')]]={'$like':'%'+_0x3aa494['query'][_0x6fff('0x3a')]+'%'};return _0x2e1c11;}})});}_0x23d528=_[_0x6fff('0x39')]({},_0x23d528,_0x3aa494[_0x6fff('0x3b')]);var _0x2d566b={'where':_0x23d528[_0x6fff('0x38')]};return db['MailServerOut'][_0x6fff('0x1f')](_0x2d566b)[_0x6fff('0x25')](function(_0x152aa0){_0x1fb5fc['count']=_0x152aa0;if(_0x3aa494['query'][_0x6fff('0x3c')]){_0x23d528[_0x6fff('0x3d')]=[{'all':!![]}];}return db[_0x6fff('0x3e')][_0x6fff('0x3f')](_0x23d528);})[_0x6fff('0x25')](function(_0x44f502){_0x1fb5fc[_0x6fff('0x40')]=_0x44f502;return _0x1fb5fc;})[_0x6fff('0x25')](respondWithFilteredResult(_0x2a762e,_0x23d528))[_0x6fff('0x41')](handleError(_0x2a762e,null));};exports[_0x6fff('0x42')]=function(_0x4d381d,_0x3a394e){var _0x1dfcbe={'raw':!![],'where':{'id':_0x4d381d[_0x6fff('0x43')]['id']}},_0x395df2={};_0x395df2[_0x6fff('0x2f')]=_[_0x6fff('0x31')](db[_0x6fff('0x3e')]['rawAttributes']);_0x395df2[_0x6fff('0x30')]=_[_0x6fff('0x31')](_0x4d381d[_0x6fff('0x30')]);_0x395df2[_0x6fff('0x32')]=_[_0x6fff('0x33')](_0x395df2[_0x6fff('0x2f')],_0x395df2[_0x6fff('0x30')]);_0x1dfcbe[_0x6fff('0x34')]=_['intersection'](_0x395df2[_0x6fff('0x2f')],qs[_0x6fff('0x35')](_0x4d381d[_0x6fff('0x30')][_0x6fff('0x35')]));_0x1dfcbe[_0x6fff('0x34')]=_0x1dfcbe[_0x6fff('0x34')][_0x6fff('0x44')]?_0x1dfcbe[_0x6fff('0x34')]:_0x395df2[_0x6fff('0x2f')];if(_0x4d381d[_0x6fff('0x30')][_0x6fff('0x3c')]){_0x1dfcbe[_0x6fff('0x3d')]=[{'all':!![]}];}_0x1dfcbe=_[_0x6fff('0x39')]({},_0x1dfcbe,_0x4d381d[_0x6fff('0x3b')]);return db[_0x6fff('0x3e')]['find'](_0x1dfcbe)[_0x6fff('0x25')](handleEntityNotFound(_0x3a394e,null))[_0x6fff('0x25')](respondWithResult(_0x3a394e,null))[_0x6fff('0x41')](handleError(_0x3a394e,null));};exports[_0x6fff('0x45')]=function(_0x2b69aa,_0x136c5f){return db[_0x6fff('0x3e')][_0x6fff('0x45')](_0x2b69aa['body'],{})[_0x6fff('0x25')](respondWithResult(_0x136c5f,0xc9))[_0x6fff('0x41')](handleError(_0x136c5f,null));};exports['update']=function(_0x4032ef,_0x241e7d){if(_0x4032ef[_0x6fff('0x46')]['id']){delete _0x4032ef[_0x6fff('0x46')]['id'];}return db['MailServerOut'][_0x6fff('0x47')]({'where':{'id':_0x4032ef[_0x6fff('0x43')]['id']}})['then'](handleEntityNotFound(_0x241e7d,null))['then'](saveUpdates(_0x4032ef[_0x6fff('0x46')],null))['then'](respondWithResult(_0x241e7d,null))[_0x6fff('0x41')](handleError(_0x241e7d,null));};exports['destroy']=function(_0x20f1cc,_0x5e90db){return db[_0x6fff('0x3e')]['find']({'where':{'id':_0x20f1cc['params']['id']}})[_0x6fff('0x25')](handleEntityNotFound(_0x5e90db,null))['then'](removeEntity(_0x5e90db,null))[_0x6fff('0x41')](handleError(_0x5e90db,null));}; \ No newline at end of file +var _0x3657=['mustache','path','sox','ejs','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','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','map','MailServerOut','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x4aee83,_0x547029){var _0x554373=function(_0x257116){while(--_0x257116){_0x4aee83['push'](_0x4aee83['shift']());}};_0x554373(++_0x547029);}(_0x3657,0x1bd));var _0x7365=function(_0x4ae506,_0x5a97ed){_0x4ae506=_0x4ae506-0x0;var _0x18e3a1=_0x3657[_0x4ae506];return _0x18e3a1;};'use strict';var emlformat=require(_0x7365('0x0'));var rimraf=require(_0x7365('0x1'));var zipdir=require(_0x7365('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7365('0x3'));var moment=require('moment');var BPromise=require(_0x7365('0x4'));var Mustache=require(_0x7365('0x5'));var util=require('util');var path=require(_0x7365('0x6'));var sox=require(_0x7365('0x7'));var csv=require('to-csv');var ejs=require(_0x7365('0x8'));var fs=require('fs');var fs_extra=require(_0x7365('0x9'));var _=require(_0x7365('0xa'));var squel=require(_0x7365('0xb'));var crypto=require(_0x7365('0xc'));var jsforce=require(_0x7365('0xd'));var deskjs=require(_0x7365('0xe'));var toCsv=require(_0x7365('0xf'));var querystring=require(_0x7365('0x10'));var Papa=require(_0x7365('0x11'));var Redis=require(_0x7365('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7365('0x13'));var as=require(_0x7365('0x14'));var hardwareService=require(_0x7365('0x15'));var logger=require(_0x7365('0x16'))(_0x7365('0x17'));var utils=require(_0x7365('0x18'));var config=require(_0x7365('0x19'));var licenseUtil=require(_0x7365('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41c6f5,_0x4fe2be){_0x4fe2be=_0x4fe2be||0xcc;return function(_0x2e0888){if(_0x2e0888){return _0x41c6f5[_0x7365('0x1b')](_0x4fe2be);}return _0x41c6f5[_0x7365('0x1c')](_0x4fe2be)[_0x7365('0x1d')]();};}function respondWithResult(_0x39ed19,_0x23b1a2){_0x23b1a2=_0x23b1a2||0xc8;return function(_0x54c8b6){if(_0x54c8b6){return _0x39ed19[_0x7365('0x1c')](_0x23b1a2)[_0x7365('0x1e')](_0x54c8b6);}};}function respondWithFilteredResult(_0x3297dd,_0x30f925){return function(_0x95bcf7){if(_0x95bcf7){var _0x251d79=typeof _0x30f925['offset']==='undefined'&&typeof _0x30f925['limit']===_0x7365('0x1f');var _0x43a070=_0x95bcf7[_0x7365('0x20')];var _0x4a88d4=_0x251d79?0x0:_0x30f925['offset'];var _0x49a847=_0x251d79?_0x95bcf7[_0x7365('0x20')]:_0x30f925[_0x7365('0x21')]+_0x30f925[_0x7365('0x22')];var _0x3b87b1;if(_0x49a847>=_0x43a070){_0x49a847=_0x43a070;_0x3b87b1=0xc8;}else{_0x3b87b1=0xce;}_0x3297dd[_0x7365('0x1c')](_0x3b87b1);return _0x3297dd[_0x7365('0x23')](_0x7365('0x24'),_0x4a88d4+'-'+_0x49a847+'/'+_0x43a070)[_0x7365('0x1e')](_0x95bcf7);}return null;};}function patchUpdates(_0x5879d1){return function(_0x1b34c7){try{jsonpatch[_0x7365('0x25')](_0x1b34c7,_0x5879d1,!![]);}catch(_0x2e9477){return BPromise[_0x7365('0x26')](_0x2e9477);}return _0x1b34c7[_0x7365('0x27')]();};}function saveUpdates(_0x335f97,_0x34b097){return function(_0x409710){if(_0x409710){return _0x409710[_0x7365('0x28')](_0x335f97)[_0x7365('0x29')](function(_0x4f73c4){return _0x4f73c4;});}return null;};}function removeEntity(_0x3e9833,_0x989474){return function(_0x1566e8){if(_0x1566e8){return _0x1566e8['destroy']()['then'](function(){_0x3e9833[_0x7365('0x1c')](0xcc)[_0x7365('0x1d')]();});}};}function handleEntityNotFound(_0x31dfda,_0x1c4792){return function(_0x59af44){if(!_0x59af44){_0x31dfda[_0x7365('0x1b')](0x194);}return _0x59af44;};}function handleError(_0x15092e,_0x4514aa){_0x4514aa=_0x4514aa||0x1f4;return function(_0x379bee){logger['error'](_0x379bee['stack']);if(_0x379bee[_0x7365('0x2a')]){delete _0x379bee[_0x7365('0x2a')];}_0x15092e[_0x7365('0x1c')](_0x4514aa)[_0x7365('0x2b')](_0x379bee);};}exports[_0x7365('0x2c')]=function(_0x540feb,_0x223b8e){var _0x715b8a={},_0xc9b14e={},_0x35ef07={'count':0x0,'rows':[]};var _0x28bd28=_[_0x7365('0x2d')](db[_0x7365('0x2e')][_0x7365('0x2f')],function(_0x4a0d5a){return{'name':_0x4a0d5a['fieldName'],'type':_0x4a0d5a[_0x7365('0x30')]['key']};});_0xc9b14e[_0x7365('0x31')]=_[_0x7365('0x2d')](_0x28bd28,'name');_0xc9b14e['query']=_[_0x7365('0x32')](_0x540feb[_0x7365('0x33')]);_0xc9b14e[_0x7365('0x34')]=_[_0x7365('0x35')](_0xc9b14e[_0x7365('0x31')],_0xc9b14e[_0x7365('0x33')]);_0x715b8a[_0x7365('0x36')]=_[_0x7365('0x35')](_0xc9b14e['model'],qs['fields'](_0x540feb[_0x7365('0x33')][_0x7365('0x37')]));_0x715b8a[_0x7365('0x36')]=_0x715b8a[_0x7365('0x36')][_0x7365('0x38')]?_0x715b8a[_0x7365('0x36')]:_0xc9b14e['model'];if(!_0x540feb[_0x7365('0x33')][_0x7365('0x39')](_0x7365('0x3a'))){_0x715b8a['limit']=qs[_0x7365('0x22')](_0x540feb[_0x7365('0x33')]['limit']);_0x715b8a[_0x7365('0x21')]=qs[_0x7365('0x21')](_0x540feb[_0x7365('0x33')]['offset']);}_0x715b8a[_0x7365('0x3b')]=qs['sort'](_0x540feb['query'][_0x7365('0x3c')]);_0x715b8a[_0x7365('0x3d')]=qs['filters'](_[_0x7365('0x3e')](_0x540feb[_0x7365('0x33')],_0xc9b14e[_0x7365('0x34')]),_0x28bd28);if(_0x540feb[_0x7365('0x33')][_0x7365('0x3f')]){_0x715b8a[_0x7365('0x3d')]=_[_0x7365('0x40')](_0x715b8a[_0x7365('0x3d')],{'$or':_[_0x7365('0x2d')](_0x28bd28,function(_0x5c3594){if(_0x5c3594[_0x7365('0x30')]!==_0x7365('0x41')){var _0x556b27={};_0x556b27[_0x5c3594[_0x7365('0x2a')]]={'$like':'%'+_0x540feb['query'][_0x7365('0x3f')]+'%'};return _0x556b27;}})});}_0x715b8a=_[_0x7365('0x40')]({},_0x715b8a,_0x540feb[_0x7365('0x42')]);var _0x36ae1e={'where':_0x715b8a[_0x7365('0x3d')]};return db[_0x7365('0x2e')][_0x7365('0x20')](_0x36ae1e)[_0x7365('0x29')](function(_0x76979e){_0x35ef07[_0x7365('0x20')]=_0x76979e;if(_0x540feb[_0x7365('0x33')][_0x7365('0x43')]){_0x715b8a['include']=[{'all':!![]}];}return db[_0x7365('0x2e')]['findAll'](_0x715b8a);})[_0x7365('0x29')](function(_0x2dc82c){_0x35ef07['rows']=_0x2dc82c;return _0x35ef07;})[_0x7365('0x29')](respondWithFilteredResult(_0x223b8e,_0x715b8a))[_0x7365('0x44')](handleError(_0x223b8e,null));};exports[_0x7365('0x45')]=function(_0x30ab44,_0x34dcf5){var _0xc8a726={'raw':!![],'where':{'id':_0x30ab44[_0x7365('0x46')]['id']}},_0x59b627={};_0x59b627[_0x7365('0x31')]=_['keys'](db[_0x7365('0x2e')][_0x7365('0x2f')]);_0x59b627['query']=_[_0x7365('0x32')](_0x30ab44[_0x7365('0x33')]);_0x59b627[_0x7365('0x34')]=_['intersection'](_0x59b627['model'],_0x59b627[_0x7365('0x33')]);_0xc8a726[_0x7365('0x36')]=_[_0x7365('0x35')](_0x59b627['model'],qs[_0x7365('0x37')](_0x30ab44[_0x7365('0x33')][_0x7365('0x37')]));_0xc8a726['attributes']=_0xc8a726[_0x7365('0x36')]['length']?_0xc8a726['attributes']:_0x59b627[_0x7365('0x31')];if(_0x30ab44[_0x7365('0x33')][_0x7365('0x43')]){_0xc8a726[_0x7365('0x47')]=[{'all':!![]}];}_0xc8a726=_['merge']({},_0xc8a726,_0x30ab44[_0x7365('0x42')]);return db[_0x7365('0x2e')]['find'](_0xc8a726)[_0x7365('0x29')](handleEntityNotFound(_0x34dcf5,null))[_0x7365('0x29')](respondWithResult(_0x34dcf5,null))['catch'](handleError(_0x34dcf5,null));};exports[_0x7365('0x48')]=function(_0x3930bf,_0x15edd9){return db[_0x7365('0x2e')][_0x7365('0x48')](_0x3930bf['body'],{})[_0x7365('0x29')](respondWithResult(_0x15edd9,0xc9))[_0x7365('0x44')](handleError(_0x15edd9,null));};exports[_0x7365('0x28')]=function(_0xa9df13,_0x19f54a){if(_0xa9df13['body']['id']){delete _0xa9df13[_0x7365('0x49')]['id'];}return db[_0x7365('0x2e')][_0x7365('0x4a')]({'where':{'id':_0xa9df13[_0x7365('0x46')]['id']}})[_0x7365('0x29')](handleEntityNotFound(_0x19f54a,null))['then'](saveUpdates(_0xa9df13['body'],null))[_0x7365('0x29')](respondWithResult(_0x19f54a,null))['catch'](handleError(_0x19f54a,null));};exports['destroy']=function(_0xe6fa93,_0x562951){return db[_0x7365('0x2e')][_0x7365('0x4a')]({'where':{'id':_0xe6fa93[_0x7365('0x46')]['id']}})[_0x7365('0x29')](handleEntityNotFound(_0x562951,null))[_0x7365('0x29')](removeEntity(_0x562951,null))[_0x7365('0x44')](handleError(_0x562951,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index d505806..a06a197 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 _0x1909=['moment','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','util','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1909,0x6c));var _0x9190=function(_0x18c417,_0x586063){_0x18c417=_0x18c417-0x0;var _0x471d4d=_0x1909[_0x18c417];return _0x471d4d;};'use strict';var _=require('lodash');var util=require(_0x9190('0x0'));var logger=require(_0x9190('0x1'))('api');var moment=require(_0x9190('0x2'));var BPromise=require(_0x9190('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9190('0x4'));var rimraf=require(_0x9190('0x5'));var config=require(_0x9190('0x6'));var attributes=require(_0x9190('0x7'));module[_0x9190('0x8')]=function(_0x3761d7,_0x1ead98){return _0x3761d7[_0x9190('0x9')](_0x9190('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80b8=['rimraf','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4f1a47,_0x4d6f1d){var _0x1e67c8=function(_0x14b9d1){while(--_0x14b9d1){_0x4f1a47['push'](_0x4f1a47['shift']());}};_0x1e67c8(++_0x4d6f1d);}(_0x80b8,0x1f4));var _0x880b=function(_0x3bddf9,_0x40d3aa){_0x3bddf9=_0x3bddf9-0x0;var _0x5aed80=_0x80b8[_0x3bddf9];return _0x5aed80;};'use strict';var _=require(_0x880b('0x0'));var util=require(_0x880b('0x1'));var logger=require(_0x880b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x880b('0x3'));var rp=require(_0x880b('0x4'));var fs=require('fs');var path=require(_0x880b('0x5'));var rimraf=require(_0x880b('0x6'));var config=require('../../config/environment');var attributes=require(_0x880b('0x7'));module['exports']=function(_0x35c452,_0x4cb2f0){return _0x35c452[_0x880b('0x8')](_0x880b('0x9'),attributes,{'tableName':_0x880b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 6e75b16..b50183c 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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x35a022,_0x4a952d){_0x35a022=_0x35a022-0x0;var _0x4ce723=_0x7a54[_0x35a022];return _0x4ce723;};'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')]('MailServerOut,\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','MailServerOut,\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(_0x1994a9,_0x5c9efc){_0x1994a9=_0x1994a9-0x0;var _0x2f81bf=_0x7a54[_0x1994a9];return _0x2f81bf;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 9ce7e50..fec8388 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 _0xe1d8=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xe1d8,0x168));var _0x8e1d=function(_0x2ca65a,_0x99bfdb){_0x2ca65a=_0x2ca65a-0x0;var _0x577c5e=_0xe1d8[_0x2ca65a];return _0x577c5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8e1d('0x0'));var timeout=require(_0x8e1d('0x1'));var express=require(_0x8e1d('0x2'));var router=express[_0x8e1d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8e1d('0x4'));var interaction=require(_0x8e1d('0x5'));var config=require(_0x8e1d('0x6'));var controller=require(_0x8e1d('0x7'));router[_0x8e1d('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e1d('0x9')]);router['get']('/describe',auth[_0x8e1d('0xa')](),controller[_0x8e1d('0xb')]);router[_0x8e1d('0x8')](_0x8e1d('0xc'),auth[_0x8e1d('0xa')](),controller[_0x8e1d('0xd')]);router[_0x8e1d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8e1d('0xf')](_0x8e1d('0xc'),auth[_0x8e1d('0xa')](),controller[_0x8e1d('0x10')]);router[_0x8e1d('0x11')](_0x8e1d('0xc'),auth[_0x8e1d('0xa')](),controller[_0x8e1d('0x12')]);module[_0x8e1d('0x13')]=router; \ No newline at end of file +var _0x6551=['put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','create'];(function(_0x30fe01,_0x1bbbf2){var _0xbcad2b=function(_0x3cc118){while(--_0x3cc118){_0x30fe01['push'](_0x30fe01['shift']());}};_0xbcad2b(++_0x1bbbf2);}(_0x6551,0x77));var _0x1655=function(_0x70fd9e,_0x19f7bd){_0x70fd9e=_0x70fd9e-0x0;var _0x3aca51=_0x6551[_0x70fd9e];return _0x3aca51;};'use strict';var multer=require(_0x1655('0x0'));var util=require(_0x1655('0x1'));var path=require('path');var timeout=require(_0x1655('0x2'));var express=require('express');var router=express[_0x1655('0x3')]();var fs_extra=require(_0x1655('0x4'));var auth=require(_0x1655('0x5'));var interaction=require(_0x1655('0x6'));var config=require(_0x1655('0x7'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x1655('0x8')](),controller['index']);router[_0x1655('0x9')](_0x1655('0xa'),auth[_0x1655('0x8')](),controller[_0x1655('0xb')]);router[_0x1655('0x9')](_0x1655('0xc'),auth[_0x1655('0x8')](),controller['show']);router['post']('/',auth[_0x1655('0x8')](),controller[_0x1655('0xd')]);router[_0x1655('0xe')](_0x1655('0xc'),auth[_0x1655('0x8')](),controller[_0x1655('0xf')]);router[_0x1655('0x10')]('/:id',auth[_0x1655('0x8')](),controller[_0x1655('0x11')]);module[_0x1655('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index c8df3d4..bff0f05 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 _0x7d9f=['sequelize','exports','STRING','name'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0x7d9f[_0x4884a7];return _0x56b60e;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'name':{'type':Sequelize[_0xf7d9('0x2')],'unique':_0xf7d9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf7d9('0x2')]}}; \ No newline at end of file +var _0xc21e=['STRING','name','exports'];(function(_0x1dc697,_0x443268){var _0xc24af4=function(_0x494ee3){while(--_0x494ee3){_0x1dc697['push'](_0x1dc697['shift']());}};_0xc24af4(++_0x443268);}(_0xc21e,0x1ca));var _0xec21=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc21e[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xec21('0x0')]={'name':{'type':Sequelize[_0xec21('0x1')],'unique':_0xec21('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xec21('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index dd26773..7a1e8a8 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 _0x2321=['findAll','rows','show','params','keys','includeAll','options','find','catch','create','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','include'];(function(_0x3698eb,_0x597db2){var _0x18d64e=function(_0x4d6798){while(--_0x4d6798){_0x3698eb['push'](_0x3698eb['shift']());}};_0x18d64e(++_0x597db2);}(_0x2321,0xe4));var _0x1232=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x2321[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require(_0x1232('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1232('0x1'));var rp=require(_0x1232('0x2'));var moment=require(_0x1232('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1232('0x4'));var util=require(_0x1232('0x5'));var path=require(_0x1232('0x6'));var sox=require('sox');var csv=require(_0x1232('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1232('0x8'));var _=require(_0x1232('0x9'));var squel=require(_0x1232('0xa'));var crypto=require(_0x1232('0xb'));var jsforce=require(_0x1232('0xc'));var deskjs=require(_0x1232('0xd'));var toCsv=require(_0x1232('0x7'));var querystring=require(_0x1232('0xe'));var Papa=require('papaparse');var Redis=require(_0x1232('0xf'));var authService=require(_0x1232('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1232('0x11'));var hardwareService=require(_0x1232('0x12'));var logger=require(_0x1232('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1232('0x14'))['db'];function respondWithStatusCode(_0x4f762c,_0x222ab0){_0x222ab0=_0x222ab0||0xcc;return function(_0x436eba){if(_0x436eba){return _0x4f762c[_0x1232('0x15')](_0x222ab0);}return _0x4f762c[_0x1232('0x16')](_0x222ab0)[_0x1232('0x17')]();};}function respondWithResult(_0x74c414,_0x40ce1d){_0x40ce1d=_0x40ce1d||0xc8;return function(_0x340e2a){if(_0x340e2a){return _0x74c414[_0x1232('0x16')](_0x40ce1d)['json'](_0x340e2a);}};}function respondWithFilteredResult(_0x32e8e7,_0x34464f){return function(_0x586a7d){if(_0x586a7d){var _0x568980=typeof _0x34464f['offset']===_0x1232('0x18')&&typeof _0x34464f[_0x1232('0x19')]===_0x1232('0x18');var _0x1aefaa=_0x586a7d[_0x1232('0x1a')];var _0x2512b6=_0x568980?0x0:_0x34464f[_0x1232('0x1b')];var _0x53d505=_0x568980?_0x586a7d[_0x1232('0x1a')]:_0x34464f[_0x1232('0x1b')]+_0x34464f[_0x1232('0x19')];var _0x2e8860;if(_0x53d505>=_0x1aefaa){_0x53d505=_0x1aefaa;_0x2e8860=0xc8;}else{_0x2e8860=0xce;}_0x32e8e7[_0x1232('0x16')](_0x2e8860);return _0x32e8e7[_0x1232('0x1c')]('Content-Range',_0x2512b6+'-'+_0x53d505+'/'+_0x1aefaa)[_0x1232('0x1d')](_0x586a7d);}return null;};}function patchUpdates(_0x464803){return function(_0x45408a){try{jsonpatch[_0x1232('0x1e')](_0x45408a,_0x464803,!![]);}catch(_0x9b6755){return BPromise['reject'](_0x9b6755);}return _0x45408a[_0x1232('0x1f')]();};}function saveUpdates(_0x35f09a,_0x75fa1c){return function(_0x397d76){if(_0x397d76){return _0x397d76[_0x1232('0x20')](_0x35f09a)[_0x1232('0x21')](function(_0xf78725){return _0xf78725;});}return null;};}function removeEntity(_0x1e1c4d,_0x284978){return function(_0x69a1ed){if(_0x69a1ed){return _0x69a1ed[_0x1232('0x22')]()[_0x1232('0x21')](function(){_0x1e1c4d[_0x1232('0x16')](0xcc)[_0x1232('0x17')]();});}};}function handleEntityNotFound(_0x15248f,_0x2beef7){return function(_0x22696f){if(!_0x22696f){_0x15248f[_0x1232('0x15')](0x194);}return _0x22696f;};}function handleError(_0x54cbb7,_0x53ab91){_0x53ab91=_0x53ab91||0x1f4;return function(_0x3ba142){logger[_0x1232('0x23')](_0x3ba142[_0x1232('0x24')]);if(_0x3ba142[_0x1232('0x25')]){delete _0x3ba142[_0x1232('0x25')];}_0x54cbb7[_0x1232('0x16')](_0x53ab91)[_0x1232('0x26')](_0x3ba142);};}exports[_0x1232('0x27')]=function(_0x575def,_0x15a114){var _0x991a13={},_0x2d101f={},_0x5d7652={'count':0x0,'rows':[]};var _0x27ae2f=_[_0x1232('0x28')](db[_0x1232('0x29')]['rawAttributes'],function(_0x12b35e){return{'name':_0x12b35e[_0x1232('0x2a')],'type':_0x12b35e[_0x1232('0x2b')][_0x1232('0x2c')]};});_0x2d101f['model']=_[_0x1232('0x28')](_0x27ae2f,_0x1232('0x25'));_0x2d101f['query']=_['keys'](_0x575def['query']);_0x2d101f['filters']=_[_0x1232('0x2d')](_0x2d101f[_0x1232('0x2e')],_0x2d101f[_0x1232('0x2f')]);_0x991a13['attributes']=_[_0x1232('0x2d')](_0x2d101f[_0x1232('0x2e')],qs[_0x1232('0x30')](_0x575def[_0x1232('0x2f')][_0x1232('0x30')]));_0x991a13[_0x1232('0x31')]=_0x991a13[_0x1232('0x31')]['length']?_0x991a13[_0x1232('0x31')]:_0x2d101f[_0x1232('0x2e')];if(!_0x575def['query'][_0x1232('0x32')](_0x1232('0x33'))){_0x991a13[_0x1232('0x19')]=qs[_0x1232('0x19')](_0x575def[_0x1232('0x2f')][_0x1232('0x19')]);_0x991a13[_0x1232('0x1b')]=qs[_0x1232('0x1b')](_0x575def[_0x1232('0x2f')][_0x1232('0x1b')]);}_0x991a13['order']=qs[_0x1232('0x34')](_0x575def[_0x1232('0x2f')][_0x1232('0x34')]);_0x991a13[_0x1232('0x35')]=qs[_0x1232('0x36')](_[_0x1232('0x37')](_0x575def[_0x1232('0x2f')],_0x2d101f['filters']),_0x27ae2f);if(_0x575def['query'][_0x1232('0x38')]){_0x991a13[_0x1232('0x35')]=_[_0x1232('0x39')](_0x991a13[_0x1232('0x35')],{'$or':_['map'](_0x27ae2f,function(_0x34f503){if(_0x34f503['type']!==_0x1232('0x3a')){var _0x42c973={};_0x42c973[_0x34f503['name']]={'$like':'%'+_0x575def[_0x1232('0x2f')][_0x1232('0x38')]+'%'};return _0x42c973;}})});}_0x991a13=_[_0x1232('0x39')]({},_0x991a13,_0x575def['options']);var _0x26f60e={'where':_0x991a13[_0x1232('0x35')]};return db[_0x1232('0x29')]['count'](_0x26f60e)[_0x1232('0x21')](function(_0x51ebe6){_0x5d7652[_0x1232('0x1a')]=_0x51ebe6;if(_0x575def[_0x1232('0x2f')]['includeAll']){_0x991a13[_0x1232('0x3b')]=[{'all':!![]}];}return db[_0x1232('0x29')][_0x1232('0x3c')](_0x991a13);})[_0x1232('0x21')](function(_0x507064){_0x5d7652[_0x1232('0x3d')]=_0x507064;return _0x5d7652;})[_0x1232('0x21')](respondWithFilteredResult(_0x15a114,_0x991a13))['catch'](handleError(_0x15a114,null));};exports[_0x1232('0x3e')]=function(_0xe80ac5,_0x20fadc){var _0x26f451={'raw':!![],'where':{'id':_0xe80ac5[_0x1232('0x3f')]['id']}},_0x43c8b8={};_0x43c8b8['model']=_[_0x1232('0x40')](db[_0x1232('0x29')]['rawAttributes']);_0x43c8b8[_0x1232('0x2f')]=_[_0x1232('0x40')](_0xe80ac5[_0x1232('0x2f')]);_0x43c8b8[_0x1232('0x36')]=_[_0x1232('0x2d')](_0x43c8b8['model'],_0x43c8b8[_0x1232('0x2f')]);_0x26f451[_0x1232('0x31')]=_[_0x1232('0x2d')](_0x43c8b8[_0x1232('0x2e')],qs[_0x1232('0x30')](_0xe80ac5[_0x1232('0x2f')][_0x1232('0x30')]));_0x26f451[_0x1232('0x31')]=_0x26f451['attributes']['length']?_0x26f451[_0x1232('0x31')]:_0x43c8b8[_0x1232('0x2e')];if(_0xe80ac5[_0x1232('0x2f')][_0x1232('0x41')]){_0x26f451[_0x1232('0x3b')]=[{'all':!![]}];}_0x26f451=_['merge']({},_0x26f451,_0xe80ac5[_0x1232('0x42')]);return db[_0x1232('0x29')][_0x1232('0x43')](_0x26f451)[_0x1232('0x21')](handleEntityNotFound(_0x20fadc,null))['then'](respondWithResult(_0x20fadc,null))[_0x1232('0x44')](handleError(_0x20fadc,null));};exports[_0x1232('0x45')]=function(_0x59cccd,_0x3036ed){return db[_0x1232('0x29')][_0x1232('0x45')](_0x59cccd[_0x1232('0x46')],{})[_0x1232('0x21')](respondWithResult(_0x3036ed,0xc9))['catch'](handleError(_0x3036ed,null));};exports['update']=function(_0x12fbad,_0x17ab2a){if(_0x12fbad['body']['id']){delete _0x12fbad[_0x1232('0x46')]['id'];}return db[_0x1232('0x29')][_0x1232('0x43')]({'where':{'id':_0x12fbad[_0x1232('0x3f')]['id']}})['then'](handleEntityNotFound(_0x17ab2a,null))['then'](saveUpdates(_0x12fbad[_0x1232('0x46')],null))['then'](respondWithResult(_0x17ab2a,null))[_0x1232('0x44')](handleError(_0x17ab2a,null));};exports[_0x1232('0x22')]=function(_0x335324,_0x16e057){return db[_0x1232('0x29')][_0x1232('0x43')]({'where':{'id':_0x335324['params']['id']}})[_0x1232('0x21')](handleEntityNotFound(_0x16e057,null))[_0x1232('0x21')](removeEntity(_0x16e057,null))['catch'](handleError(_0x16e057,null));};exports[_0x1232('0x47')]=function(_0x48f466,_0x15cb90){return db[_0x1232('0x29')][_0x1232('0x47')]()['then'](respondWithResult(_0x15cb90,null))['catch'](handleError(_0x15cb90,null));}; \ No newline at end of file +var _0xbe79=['../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','index','map','MailSubstatus','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2f7214,_0x40c79b){var _0x5168a0=function(_0x5a6aee){while(--_0x5a6aee){_0x2f7214['push'](_0x2f7214['shift']());}};_0x5168a0(++_0x40c79b);}(_0xbe79,0x169));var _0x9be7=function(_0x80b349,_0x412355){_0x80b349=_0x80b349-0x0;var _0x38971e=_0xbe79[_0x80b349];return _0x38971e;};'use strict';var emlformat=require(_0x9be7('0x0'));var rimraf=require(_0x9be7('0x1'));var zipdir=require(_0x9be7('0x2'));var jsonpatch=require(_0x9be7('0x3'));var rp=require(_0x9be7('0x4'));var moment=require('moment');var BPromise=require(_0x9be7('0x5'));var Mustache=require(_0x9be7('0x6'));var util=require(_0x9be7('0x7'));var path=require(_0x9be7('0x8'));var sox=require(_0x9be7('0x9'));var csv=require(_0x9be7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9be7('0xb'));var _=require(_0x9be7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9be7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9be7('0xa'));var querystring=require(_0x9be7('0xe'));var Papa=require(_0x9be7('0xf'));var Redis=require(_0x9be7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9be7('0x11'));var as=require(_0x9be7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9be7('0x13'))(_0x9be7('0x14'));var utils=require(_0x9be7('0x15'));var config=require(_0x9be7('0x16'));var licenseUtil=require(_0x9be7('0x17'));var db=require(_0x9be7('0x18'))['db'];function respondWithStatusCode(_0x26991e,_0x2fd53a){_0x2fd53a=_0x2fd53a||0xcc;return function(_0x2d99d1){if(_0x2d99d1){return _0x26991e[_0x9be7('0x19')](_0x2fd53a);}return _0x26991e[_0x9be7('0x1a')](_0x2fd53a)[_0x9be7('0x1b')]();};}function respondWithResult(_0x462931,_0x3c8e8b){_0x3c8e8b=_0x3c8e8b||0xc8;return function(_0x2b465a){if(_0x2b465a){return _0x462931[_0x9be7('0x1a')](_0x3c8e8b)['json'](_0x2b465a);}};}function respondWithFilteredResult(_0x2d3fc6,_0x314496){return function(_0x107307){if(_0x107307){var _0x33664d=typeof _0x314496[_0x9be7('0x1c')]===_0x9be7('0x1d')&&typeof _0x314496[_0x9be7('0x1e')]===_0x9be7('0x1d');var _0x46759b=_0x107307[_0x9be7('0x1f')];var _0xf35022=_0x33664d?0x0:_0x314496[_0x9be7('0x1c')];var _0x5b4cf5=_0x33664d?_0x107307[_0x9be7('0x1f')]:_0x314496[_0x9be7('0x1c')]+_0x314496['limit'];var _0x25e3ae;if(_0x5b4cf5>=_0x46759b){_0x5b4cf5=_0x46759b;_0x25e3ae=0xc8;}else{_0x25e3ae=0xce;}_0x2d3fc6['status'](_0x25e3ae);return _0x2d3fc6[_0x9be7('0x20')](_0x9be7('0x21'),_0xf35022+'-'+_0x5b4cf5+'/'+_0x46759b)[_0x9be7('0x22')](_0x107307);}return null;};}function patchUpdates(_0x28418a){return function(_0x43b63f){try{jsonpatch[_0x9be7('0x23')](_0x43b63f,_0x28418a,!![]);}catch(_0x192b1c){return BPromise[_0x9be7('0x24')](_0x192b1c);}return _0x43b63f[_0x9be7('0x25')]();};}function saveUpdates(_0x2c300c,_0x33a0ff){return function(_0x145269){if(_0x145269){return _0x145269[_0x9be7('0x26')](_0x2c300c)['then'](function(_0x123492){return _0x123492;});}return null;};}function removeEntity(_0x2f333d,_0x323c11){return function(_0x4bae10){if(_0x4bae10){return _0x4bae10[_0x9be7('0x27')]()[_0x9be7('0x28')](function(){_0x2f333d['status'](0xcc)[_0x9be7('0x1b')]();});}};}function handleEntityNotFound(_0x2d2f6e,_0x5494e6){return function(_0x2de5a6){if(!_0x2de5a6){_0x2d2f6e[_0x9be7('0x19')](0x194);}return _0x2de5a6;};}function handleError(_0x354c58,_0x59a5f5){_0x59a5f5=_0x59a5f5||0x1f4;return function(_0x23b481){logger[_0x9be7('0x29')](_0x23b481['stack']);if(_0x23b481[_0x9be7('0x2a')]){delete _0x23b481[_0x9be7('0x2a')];}_0x354c58['status'](_0x59a5f5)[_0x9be7('0x2b')](_0x23b481);};}exports[_0x9be7('0x2c')]=function(_0x5c9d65,_0x3075f4){var _0x249ee1={},_0x5943d1={},_0x32787b={'count':0x0,'rows':[]};var _0x4e3ba3=_[_0x9be7('0x2d')](db[_0x9be7('0x2e')][_0x9be7('0x2f')],function(_0x218654){return{'name':_0x218654['fieldName'],'type':_0x218654[_0x9be7('0x30')][_0x9be7('0x31')]};});_0x5943d1[_0x9be7('0x32')]=_[_0x9be7('0x2d')](_0x4e3ba3,'name');_0x5943d1['query']=_[_0x9be7('0x33')](_0x5c9d65[_0x9be7('0x34')]);_0x5943d1[_0x9be7('0x35')]=_[_0x9be7('0x36')](_0x5943d1[_0x9be7('0x32')],_0x5943d1['query']);_0x249ee1['attributes']=_[_0x9be7('0x36')](_0x5943d1['model'],qs[_0x9be7('0x37')](_0x5c9d65[_0x9be7('0x34')][_0x9be7('0x37')]));_0x249ee1[_0x9be7('0x38')]=_0x249ee1[_0x9be7('0x38')][_0x9be7('0x39')]?_0x249ee1[_0x9be7('0x38')]:_0x5943d1[_0x9be7('0x32')];if(!_0x5c9d65['query'][_0x9be7('0x3a')](_0x9be7('0x3b'))){_0x249ee1[_0x9be7('0x1e')]=qs['limit'](_0x5c9d65[_0x9be7('0x34')][_0x9be7('0x1e')]);_0x249ee1['offset']=qs['offset'](_0x5c9d65[_0x9be7('0x34')][_0x9be7('0x1c')]);}_0x249ee1[_0x9be7('0x3c')]=qs[_0x9be7('0x3d')](_0x5c9d65[_0x9be7('0x34')]['sort']);_0x249ee1[_0x9be7('0x3e')]=qs[_0x9be7('0x35')](_[_0x9be7('0x3f')](_0x5c9d65['query'],_0x5943d1[_0x9be7('0x35')]),_0x4e3ba3);if(_0x5c9d65[_0x9be7('0x34')][_0x9be7('0x40')]){_0x249ee1['where']=_[_0x9be7('0x41')](_0x249ee1[_0x9be7('0x3e')],{'$or':_[_0x9be7('0x2d')](_0x4e3ba3,function(_0x376809){if(_0x376809[_0x9be7('0x30')]!==_0x9be7('0x42')){var _0x883337={};_0x883337[_0x376809[_0x9be7('0x2a')]]={'$like':'%'+_0x5c9d65[_0x9be7('0x34')][_0x9be7('0x40')]+'%'};return _0x883337;}})});}_0x249ee1=_[_0x9be7('0x41')]({},_0x249ee1,_0x5c9d65[_0x9be7('0x43')]);var _0x5aeda0={'where':_0x249ee1['where']};return db[_0x9be7('0x2e')][_0x9be7('0x1f')](_0x5aeda0)[_0x9be7('0x28')](function(_0x5c0559){_0x32787b[_0x9be7('0x1f')]=_0x5c0559;if(_0x5c9d65[_0x9be7('0x34')][_0x9be7('0x44')]){_0x249ee1[_0x9be7('0x45')]=[{'all':!![]}];}return db[_0x9be7('0x2e')]['findAll'](_0x249ee1);})[_0x9be7('0x28')](function(_0x19701e){_0x32787b[_0x9be7('0x46')]=_0x19701e;return _0x32787b;})[_0x9be7('0x28')](respondWithFilteredResult(_0x3075f4,_0x249ee1))['catch'](handleError(_0x3075f4,null));};exports[_0x9be7('0x47')]=function(_0x444ba2,_0x4a89c0){var _0x34ffa0={'raw':!![],'where':{'id':_0x444ba2['params']['id']}},_0x1a2cc4={};_0x1a2cc4[_0x9be7('0x32')]=_[_0x9be7('0x33')](db[_0x9be7('0x2e')][_0x9be7('0x2f')]);_0x1a2cc4['query']=_['keys'](_0x444ba2[_0x9be7('0x34')]);_0x1a2cc4[_0x9be7('0x35')]=_['intersection'](_0x1a2cc4[_0x9be7('0x32')],_0x1a2cc4[_0x9be7('0x34')]);_0x34ffa0['attributes']=_[_0x9be7('0x36')](_0x1a2cc4[_0x9be7('0x32')],qs[_0x9be7('0x37')](_0x444ba2[_0x9be7('0x34')][_0x9be7('0x37')]));_0x34ffa0[_0x9be7('0x38')]=_0x34ffa0[_0x9be7('0x38')][_0x9be7('0x39')]?_0x34ffa0[_0x9be7('0x38')]:_0x1a2cc4[_0x9be7('0x32')];if(_0x444ba2[_0x9be7('0x34')][_0x9be7('0x44')]){_0x34ffa0[_0x9be7('0x45')]=[{'all':!![]}];}_0x34ffa0=_['merge']({},_0x34ffa0,_0x444ba2[_0x9be7('0x43')]);return db[_0x9be7('0x2e')][_0x9be7('0x48')](_0x34ffa0)[_0x9be7('0x28')](handleEntityNotFound(_0x4a89c0,null))[_0x9be7('0x28')](respondWithResult(_0x4a89c0,null))[_0x9be7('0x49')](handleError(_0x4a89c0,null));};exports['create']=function(_0x2108bf,_0x26dc23){return db[_0x9be7('0x2e')]['create'](_0x2108bf['body'],{})[_0x9be7('0x28')](respondWithResult(_0x26dc23,0xc9))['catch'](handleError(_0x26dc23,null));};exports['update']=function(_0x337fff,_0x84d731){if(_0x337fff['body']['id']){delete _0x337fff[_0x9be7('0x4a')]['id'];}return db['MailSubstatus'][_0x9be7('0x48')]({'where':{'id':_0x337fff[_0x9be7('0x4b')]['id']}})[_0x9be7('0x28')](handleEntityNotFound(_0x84d731,null))[_0x9be7('0x28')](saveUpdates(_0x337fff['body'],null))[_0x9be7('0x28')](respondWithResult(_0x84d731,null))[_0x9be7('0x49')](handleError(_0x84d731,null));};exports[_0x9be7('0x27')]=function(_0xf3984c,_0xa3026){return db['MailSubstatus'][_0x9be7('0x48')]({'where':{'id':_0xf3984c[_0x9be7('0x4b')]['id']}})[_0x9be7('0x28')](handleEntityNotFound(_0xa3026,null))[_0x9be7('0x28')](removeEntity(_0xa3026,null))[_0x9be7('0x49')](handleError(_0xa3026,null));};exports[_0x9be7('0x4c')]=function(_0x323110,_0x245842){return db['MailSubstatus'][_0x9be7('0x4c')]()[_0x9be7('0x28')](respondWithResult(_0x245842,null))[_0x9be7('0x49')](handleError(_0x245842,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 7062fd3..e16e6c8 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 _0x3493=['emit','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3493,0x1e3));var _0x3349=function(_0x34cbbb,_0x144152){_0x34cbbb=_0x34cbbb-0x0;var _0x21f083=_0x3493[_0x34cbbb];return _0x21f083;};'use strict';var EventEmitter=require(_0x3349('0x0'));var MailSubstatus=require(_0x3349('0x1'))['db'][_0x3349('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3349('0x3')](0x0);var events={'afterUpdate':_0x3349('0x4')};function emitEvent(_0x28c291){return function(_0x550a94,_0x152775,_0x179306){MailSubstatusEvents[_0x3349('0x5')](_0x28c291+':'+_0x550a94['id'],_0x550a94);MailSubstatusEvents['emit'](_0x28c291,_0x550a94);_0x179306(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x3349('0x6')](e,emitEvent(event));}}module[_0x3349('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x09f8=['events','MailSubstatus','setMaxListeners','update','emit','hook','exports'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x09f8,0x12d));var _0x809f=function(_0x107daa,_0xc653dc){_0x107daa=_0x107daa-0x0;var _0x5916e0=_0x09f8[_0x107daa];return _0x5916e0;};'use strict';var EventEmitter=require(_0x809f('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x809f('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x809f('0x2')](0x0);var events={'afterUpdate':_0x809f('0x3')};function emitEvent(_0x4a29a3){return function(_0x309c20,_0x5612ca,_0x31b032){MailSubstatusEvents[_0x809f('0x4')](_0x4a29a3+':'+_0x309c20['id'],_0x309c20);MailSubstatusEvents[_0x809f('0x4')](_0x4a29a3,_0x309c20);_0x31b032(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x809f('0x5')](e,emitEvent(event));}}module[_0x809f('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index da54e64..36c1bba 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 _0x976c=['define','MailSubstatus','mail_substatuses','Condition','update','name','then','catch','./mailSubstatus.attributes','exports','models'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x976c,0xb8));var _0xc976=function(_0x30c8fd,_0x414be){_0x30c8fd=_0x30c8fd-0x0;var _0xe75ae2=_0x976c[_0x30c8fd];return _0xe75ae2;};'use strict';var attributes=require(_0xc976('0x0'));module[_0xc976('0x1')]=function(_0x498470){var _0x3c3598=_0x498470[_0xc976('0x2')];return _0x498470[_0xc976('0x3')](_0xc976('0x4'),attributes,{'tableName':_0xc976('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x204ad0,_0x523cfb,_0x2a6b4f){return _0x3c3598[_0xc976('0x6')][_0xc976('0x7')]({'value':_0x204ad0[_0xc976('0x8')]},{'where':{'field':'mailSubstatus','value':_0x204ad0['_previousDataValues'][_0xc976('0x8')]}})[_0xc976('0x9')](function(){_0x2a6b4f();})[_0xc976('0xa')](function(_0x74f875){_0x2a6b4f(_0x74f875);});}}});}; \ No newline at end of file +var _0x6c1e=['MailSubstatus','mail_substatuses','update','name','mailSubstatus','_previousDataValues','./mailSubstatus.attributes','exports','define'];(function(_0x49df19,_0x22eb80){var _0x154d18=function(_0x5573e4){while(--_0x5573e4){_0x49df19['push'](_0x49df19['shift']());}};_0x154d18(++_0x22eb80);}(_0x6c1e,0x1bf));var _0xe6c1=function(_0x3ef8a9,_0x59a7c2){_0x3ef8a9=_0x3ef8a9-0x0;var _0x424f63=_0x6c1e[_0x3ef8a9];return _0x424f63;};'use strict';var attributes=require(_0xe6c1('0x0'));module[_0xe6c1('0x1')]=function(_0x5056e4){var _0x3ae8d9=_0x5056e4['models'];return _0x5056e4[_0xe6c1('0x2')](_0xe6c1('0x3'),attributes,{'tableName':_0xe6c1('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5a6b43,_0x2fc28d,_0x4d2a4b){return _0x3ae8d9['Condition'][_0xe6c1('0x5')]({'value':_0x5a6b43[_0xe6c1('0x6')]},{'where':{'field':_0xe6c1('0x7'),'value':_0x5a6b43[_0xe6c1('0x8')]['name']}})['then'](function(){_0x4d2a4b();})['catch'](function(_0x9441fb){_0x4d2a4b(_0x9441fb);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 49bee5b..ad348c1 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 _0x9dae=['result','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9dae,0xac));var _0xe9da=function(_0xdd2e4f,_0x4388b6){_0xdd2e4f=_0xdd2e4f-0x0;var _0x55a445=_0x9dae[_0xdd2e4f];return _0x55a445;};'use strict';var _=require('lodash');var util=require(_0xe9da('0x0'));var moment=require('moment');var BPromise=require(_0xe9da('0x1'));var rs=require(_0xe9da('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9da('0x3'));var logger=require(_0xe9da('0x4'))(_0xe9da('0x5'));var config=require(_0xe9da('0x6'));var jayson=require(_0xe9da('0x7'));var client=jayson[_0xe9da('0x8')][_0xe9da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ec6df,_0x56cffb,_0x4a8c3b){return new BPromise(function(_0xda137f,_0x4c8119){return client['request'](_0x3ec6df,_0x4a8c3b)['then'](function(_0x296283){logger[_0xe9da('0xa')](_0xe9da('0xb'),_0x56cffb,_0xe9da('0xc'));logger['debug'](_0xe9da('0xd'),_0x56cffb,_0xe9da('0xc'),JSON[_0xe9da('0xe')](_0x296283));if(_0x296283['error']){if(_0x296283[_0xe9da('0xf')][_0xe9da('0x10')]===0x1f4){logger['error'](_0xe9da('0xb'),_0x56cffb,_0x296283[_0xe9da('0xf')][_0xe9da('0x11')]);return _0x4c8119(_0x296283[_0xe9da('0xf')][_0xe9da('0x11')]);}logger[_0xe9da('0xf')](_0xe9da('0xb'),_0x56cffb,_0x296283['error'][_0xe9da('0x11')]);return _0xda137f(_0x296283[_0xe9da('0xf')][_0xe9da('0x11')]);}else{logger['info'](_0xe9da('0xb'),_0x56cffb,_0xe9da('0xc'));_0xda137f(_0x296283[_0xe9da('0x12')][_0xe9da('0x11')]);}})['catch'](function(_0x1019ec){logger[_0xe9da('0xf')](_0xe9da('0xb'),_0x56cffb,_0x1019ec);_0x4c8119(_0x1019ec);});});} \ No newline at end of file +var _0xe668=['info','MailSubstatus,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x55cbf9,_0x38f1ec){var _0x582a5b=function(_0xd968f2){while(--_0xd968f2){_0x55cbf9['push'](_0x55cbf9['shift']());}};_0x582a5b(++_0x38f1ec);}(_0xe668,0xaa));var _0x8e66=function(_0x244862,_0x3da79e){_0x244862=_0x244862-0x0;var _0x2bce23=_0xe668[_0x244862];return _0x2bce23;};'use strict';var _=require('lodash');var util=require(_0x8e66('0x0'));var moment=require(_0x8e66('0x1'));var BPromise=require(_0x8e66('0x2'));var rs=require(_0x8e66('0x3'));var fs=require('fs');var Redis=require(_0x8e66('0x4'));var db=require(_0x8e66('0x5'))['db'];var utils=require(_0x8e66('0x6'));var logger=require('../../config/logger')(_0x8e66('0x7'));var config=require(_0x8e66('0x8'));var jayson=require(_0x8e66('0x9'));var client=jayson[_0x8e66('0xa')][_0x8e66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc2677f,_0x42d264,_0x76210e){return new BPromise(function(_0x7d01a9,_0x448abb){return client[_0x8e66('0xc')](_0xc2677f,_0x76210e)[_0x8e66('0xd')](function(_0x394fe1){logger[_0x8e66('0xe')](_0x8e66('0xf'),_0x42d264,_0x8e66('0x10'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x42d264,_0x8e66('0x10'),JSON[_0x8e66('0x11')](_0x394fe1));if(_0x394fe1[_0x8e66('0x12')]){if(_0x394fe1[_0x8e66('0x12')][_0x8e66('0x13')]===0x1f4){logger[_0x8e66('0x12')](_0x8e66('0xf'),_0x42d264,_0x394fe1[_0x8e66('0x12')][_0x8e66('0x14')]);return _0x448abb(_0x394fe1['error'][_0x8e66('0x14')]);}logger['error'](_0x8e66('0xf'),_0x42d264,_0x394fe1[_0x8e66('0x12')]['message']);return _0x7d01a9(_0x394fe1[_0x8e66('0x12')][_0x8e66('0x14')]);}else{logger[_0x8e66('0xe')](_0x8e66('0xf'),_0x42d264,_0x8e66('0x10'));_0x7d01a9(_0x394fe1[_0x8e66('0x15')][_0x8e66('0x14')]);}})[_0x8e66('0x16')](function(_0x2712be){logger[_0x8e66('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x42d264,_0x2712be);_0x448abb(_0x2712be);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 1f31e95..53712eb 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 _0x892f=['delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','create','update'];(function(_0x36a4f9,_0x3f5506){var _0x479588=function(_0x19eac0){while(--_0x19eac0){_0x36a4f9['push'](_0x36a4f9['shift']());}};_0x479588(++_0x3f5506);}(_0x892f,0x10c));var _0xf892=function(_0x2469b3,_0x2055c2){_0x2469b3=_0x2469b3-0x0;var _0x588b86=_0x892f[_0x2469b3];return _0x588b86;};'use strict';var multer=require(_0xf892('0x0'));var util=require(_0xf892('0x1'));var path=require('path');var timeout=require(_0xf892('0x2'));var express=require(_0xf892('0x3'));var router=express[_0xf892('0x4')]();var fs_extra=require(_0xf892('0x5'));var auth=require(_0xf892('0x6'));var interaction=require(_0xf892('0x7'));var config=require(_0xf892('0x8'));var controller=require('./mailTransferReport.controller');router[_0xf892('0x9')]('/',auth['isAuthenticated'](),controller[_0xf892('0xa')]);router[_0xf892('0x9')](_0xf892('0xb'),auth['isAuthenticated'](),controller[_0xf892('0xc')]);router['get'](_0xf892('0xd'),auth[_0xf892('0xe')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf892('0xf')]);router['put'](_0xf892('0xd'),auth['isAuthenticated'](),controller[_0xf892('0x10')]);router[_0xf892('0x11')]('/:id',auth[_0xf892('0xe')](),controller['destroy']);module[_0xf892('0x12')]=router; \ No newline at end of file +var _0x7be6=['/:id','show','post','update','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','./mailTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0x5954d2,_0x15db93){var _0x316928=function(_0x278bd3){while(--_0x278bd3){_0x5954d2['push'](_0x5954d2['shift']());}};_0x316928(++_0x15db93);}(_0x7be6,0xc6));var _0x67be=function(_0x5974dc,_0x5b789a){_0x5974dc=_0x5974dc-0x0;var _0xfbcbd4=_0x7be6[_0x5974dc];return _0xfbcbd4;};'use strict';var multer=require('multer');var util=require(_0x67be('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x67be('0x1'));var router=express[_0x67be('0x2')]();var fs_extra=require(_0x67be('0x3'));var auth=require(_0x67be('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x67be('0x5'));router[_0x67be('0x6')]('/',auth[_0x67be('0x7')](),controller[_0x67be('0x8')]);router[_0x67be('0x6')]('/describe',auth[_0x67be('0x7')](),controller[_0x67be('0x9')]);router[_0x67be('0x6')](_0x67be('0xa'),auth[_0x67be('0x7')](),controller[_0x67be('0xb')]);router[_0x67be('0xc')]('/',auth[_0x67be('0x7')](),controller['create']);router['put'](_0x67be('0xa'),auth[_0x67be('0x7')](),controller[_0x67be('0xd')]);router['delete'](_0x67be('0xa'),auth[_0x67be('0x7')](),controller[_0x67be('0xe')]);module[_0x67be('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index e5c89c6..71efcdf 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2c69a1,_0x201903){var _0x24bb91=function(_0x3131ac){while(--_0x3131ac){_0x2c69a1['push'](_0x2c69a1['shift']());}};_0x24bb91(++_0x201903);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4674ae,_0x55ff05){_0x4674ae=_0x4674ae-0x0;var _0x2b052a=_0xb43b[_0x4674ae];return _0x2b052a;};'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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0xb43b,0x1b2));var _0xbb43=function(_0x444450,_0x3061fe){_0x444450=_0x444450-0x0;var _0x113964=_0xb43b[_0x444450];return _0x113964;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 120c242..5ea51ad 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 _0xb209=['set','reject','save','update','then','destroy','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','show','keys','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x39ff78,_0x4c2640){var _0x323ee3=function(_0x34417d){while(--_0x34417d){_0x39ff78['push'](_0x39ff78['shift']());}};_0x323ee3(++_0x4c2640);}(_0xb209,0x105));var _0x9b20=function(_0xb32c3f,_0x3fff3b){_0xb32c3f=_0xb32c3f-0x0;var _0x55eb6e=_0xb209[_0xb32c3f];return _0x55eb6e;};'use strict';var emlformat=require(_0x9b20('0x0'));var rimraf=require(_0x9b20('0x1'));var zipdir=require(_0x9b20('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9b20('0x3'));var BPromise=require(_0x9b20('0x4'));var Mustache=require('mustache');var util=require(_0x9b20('0x5'));var path=require('path');var sox=require(_0x9b20('0x6'));var csv=require('to-csv');var ejs=require(_0x9b20('0x7'));var fs=require('fs');var fs_extra=require(_0x9b20('0x8'));var _=require(_0x9b20('0x9'));var squel=require('squel');var crypto=require(_0x9b20('0xa'));var jsforce=require(_0x9b20('0xb'));var deskjs=require(_0x9b20('0xc'));var toCsv=require(_0x9b20('0xd'));var querystring=require('querystring');var Papa=require(_0x9b20('0xe'));var Redis=require(_0x9b20('0xf'));var authService=require(_0x9b20('0x10'));var qs=require(_0x9b20('0x11'));var as=require(_0x9b20('0x12'));var hardwareService=require(_0x9b20('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9b20('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9b20('0x15'));var db=require(_0x9b20('0x16'))['db'];function respondWithStatusCode(_0x195904,_0x3a9b49){_0x3a9b49=_0x3a9b49||0xcc;return function(_0x23eefc){if(_0x23eefc){return _0x195904[_0x9b20('0x17')](_0x3a9b49);}return _0x195904[_0x9b20('0x18')](_0x3a9b49)[_0x9b20('0x19')]();};}function respondWithResult(_0x54f500,_0x396d68){_0x396d68=_0x396d68||0xc8;return function(_0xc028c9){if(_0xc028c9){return _0x54f500[_0x9b20('0x18')](_0x396d68)[_0x9b20('0x1a')](_0xc028c9);}};}function respondWithFilteredResult(_0x561b9f,_0x3d5fa2){return function(_0x45482c){if(_0x45482c){var _0x59bc32=typeof _0x3d5fa2[_0x9b20('0x1b')]===_0x9b20('0x1c')&&typeof _0x3d5fa2['limit']===_0x9b20('0x1c');var _0x29f84e=_0x45482c[_0x9b20('0x1d')];var _0x3f0bb6=_0x59bc32?0x0:_0x3d5fa2['offset'];var _0x3f9821=_0x59bc32?_0x45482c['count']:_0x3d5fa2[_0x9b20('0x1b')]+_0x3d5fa2[_0x9b20('0x1e')];var _0xc1f723;if(_0x3f9821>=_0x29f84e){_0x3f9821=_0x29f84e;_0xc1f723=0xc8;}else{_0xc1f723=0xce;}_0x561b9f[_0x9b20('0x18')](_0xc1f723);return _0x561b9f[_0x9b20('0x1f')]('Content-Range',_0x3f0bb6+'-'+_0x3f9821+'/'+_0x29f84e)[_0x9b20('0x1a')](_0x45482c);}return null;};}function patchUpdates(_0x35b746){return function(_0x4afac8){try{jsonpatch['apply'](_0x4afac8,_0x35b746,!![]);}catch(_0x49a474){return BPromise[_0x9b20('0x20')](_0x49a474);}return _0x4afac8[_0x9b20('0x21')]();};}function saveUpdates(_0x4a7bb8,_0x5ac6e4){return function(_0x16b562){if(_0x16b562){return _0x16b562[_0x9b20('0x22')](_0x4a7bb8)[_0x9b20('0x23')](function(_0x43aa8f){return _0x43aa8f;});}return null;};}function removeEntity(_0x5ae0ab,_0x46266e){return function(_0x13fd88){if(_0x13fd88){return _0x13fd88[_0x9b20('0x24')]()[_0x9b20('0x23')](function(){_0x5ae0ab[_0x9b20('0x18')](0xcc)[_0x9b20('0x19')]();});}};}function handleEntityNotFound(_0x4fe55c,_0x251865){return function(_0x2f44b0){if(!_0x2f44b0){_0x4fe55c['sendStatus'](0x194);}return _0x2f44b0;};}function handleError(_0x462e4e,_0x546448){_0x546448=_0x546448||0x1f4;return function(_0x2604b1){logger[_0x9b20('0x25')](_0x2604b1[_0x9b20('0x26')]);if(_0x2604b1[_0x9b20('0x27')]){delete _0x2604b1[_0x9b20('0x27')];}_0x462e4e[_0x9b20('0x18')](_0x546448)[_0x9b20('0x28')](_0x2604b1);};}exports['index']=function(_0x1d49d0,_0x450960){var _0x1cad4c={},_0xcfe102={},_0x5623d9={'count':0x0,'rows':[]};var _0x19d675=_[_0x9b20('0x29')](db[_0x9b20('0x2a')][_0x9b20('0x2b')],function(_0x171dd9){return{'name':_0x171dd9[_0x9b20('0x2c')],'type':_0x171dd9[_0x9b20('0x2d')][_0x9b20('0x2e')]};});_0xcfe102[_0x9b20('0x2f')]=_[_0x9b20('0x29')](_0x19d675,_0x9b20('0x27'));_0xcfe102['query']=_['keys'](_0x1d49d0[_0x9b20('0x30')]);_0xcfe102[_0x9b20('0x31')]=_[_0x9b20('0x32')](_0xcfe102[_0x9b20('0x2f')],_0xcfe102['query']);_0x1cad4c['attributes']=_[_0x9b20('0x32')](_0xcfe102['model'],qs['fields'](_0x1d49d0['query'][_0x9b20('0x33')]));_0x1cad4c[_0x9b20('0x34')]=_0x1cad4c[_0x9b20('0x34')][_0x9b20('0x35')]?_0x1cad4c['attributes']:_0xcfe102[_0x9b20('0x2f')];if(!_0x1d49d0[_0x9b20('0x30')][_0x9b20('0x36')](_0x9b20('0x37'))){_0x1cad4c[_0x9b20('0x1e')]=qs[_0x9b20('0x1e')](_0x1d49d0[_0x9b20('0x30')][_0x9b20('0x1e')]);_0x1cad4c[_0x9b20('0x1b')]=qs[_0x9b20('0x1b')](_0x1d49d0[_0x9b20('0x30')][_0x9b20('0x1b')]);}_0x1cad4c[_0x9b20('0x38')]=qs['sort'](_0x1d49d0[_0x9b20('0x30')][_0x9b20('0x39')]);_0x1cad4c[_0x9b20('0x3a')]=qs[_0x9b20('0x31')](_['pick'](_0x1d49d0['query'],_0xcfe102[_0x9b20('0x31')]),_0x19d675);if(_0x1d49d0[_0x9b20('0x30')][_0x9b20('0x3b')]){_0x1cad4c[_0x9b20('0x3a')]=_[_0x9b20('0x3c')](_0x1cad4c[_0x9b20('0x3a')],{'$or':_[_0x9b20('0x29')](_0x19d675,function(_0x341157){if(_0x341157[_0x9b20('0x2d')]!=='VIRTUAL'){var _0x313db9={};_0x313db9[_0x341157[_0x9b20('0x27')]]={'$like':'%'+_0x1d49d0[_0x9b20('0x30')]['filter']+'%'};return _0x313db9;}})});}_0x1cad4c=_[_0x9b20('0x3c')]({},_0x1cad4c,_0x1d49d0[_0x9b20('0x3d')]);var _0x2eb158={'where':_0x1cad4c[_0x9b20('0x3a')]};return db[_0x9b20('0x2a')][_0x9b20('0x1d')](_0x2eb158)['then'](function(_0x2d1827){_0x5623d9[_0x9b20('0x1d')]=_0x2d1827;if(_0x1d49d0['query'][_0x9b20('0x3e')]){_0x1cad4c[_0x9b20('0x3f')]=[{'all':!![]}];}return db[_0x9b20('0x2a')][_0x9b20('0x40')](_0x1cad4c);})['then'](function(_0x11612d){_0x5623d9['rows']=_0x11612d;return _0x5623d9;})[_0x9b20('0x23')](respondWithFilteredResult(_0x450960,_0x1cad4c))['catch'](handleError(_0x450960,null));};exports[_0x9b20('0x41')]=function(_0x5f4f5b,_0x5b6856){var _0x34c585={'raw':!![],'where':{'id':_0x5f4f5b['params']['id']}},_0x4e1ef5={};_0x4e1ef5[_0x9b20('0x2f')]=_[_0x9b20('0x42')](db[_0x9b20('0x2a')]['rawAttributes']);_0x4e1ef5[_0x9b20('0x30')]=_[_0x9b20('0x42')](_0x5f4f5b[_0x9b20('0x30')]);_0x4e1ef5[_0x9b20('0x31')]=_['intersection'](_0x4e1ef5[_0x9b20('0x2f')],_0x4e1ef5[_0x9b20('0x30')]);_0x34c585[_0x9b20('0x34')]=_[_0x9b20('0x32')](_0x4e1ef5[_0x9b20('0x2f')],qs[_0x9b20('0x33')](_0x5f4f5b['query'][_0x9b20('0x33')]));_0x34c585[_0x9b20('0x34')]=_0x34c585['attributes'][_0x9b20('0x35')]?_0x34c585[_0x9b20('0x34')]:_0x4e1ef5[_0x9b20('0x2f')];if(_0x5f4f5b[_0x9b20('0x30')][_0x9b20('0x3e')]){_0x34c585[_0x9b20('0x3f')]=[{'all':!![]}];}_0x34c585=_[_0x9b20('0x3c')]({},_0x34c585,_0x5f4f5b['options']);return db[_0x9b20('0x2a')][_0x9b20('0x43')](_0x34c585)[_0x9b20('0x23')](handleEntityNotFound(_0x5b6856,null))[_0x9b20('0x23')](respondWithResult(_0x5b6856,null))[_0x9b20('0x44')](handleError(_0x5b6856,null));};exports[_0x9b20('0x45')]=function(_0x316f49,_0x5a9e3a){return db[_0x9b20('0x2a')][_0x9b20('0x45')](_0x316f49[_0x9b20('0x46')],{})[_0x9b20('0x23')](respondWithResult(_0x5a9e3a,0xc9))[_0x9b20('0x44')](handleError(_0x5a9e3a,null));};exports[_0x9b20('0x22')]=function(_0x2d9393,_0x42089a){if(_0x2d9393[_0x9b20('0x46')]['id']){delete _0x2d9393['body']['id'];}return db['MailTransferReport'][_0x9b20('0x43')]({'where':{'id':_0x2d9393[_0x9b20('0x47')]['id']}})[_0x9b20('0x23')](handleEntityNotFound(_0x42089a,null))[_0x9b20('0x23')](saveUpdates(_0x2d9393[_0x9b20('0x46')],null))['then'](respondWithResult(_0x42089a,null))[_0x9b20('0x44')](handleError(_0x42089a,null));};exports['destroy']=function(_0x16842a,_0x289132){return db[_0x9b20('0x2a')][_0x9b20('0x43')]({'where':{'id':_0x16842a[_0x9b20('0x47')]['id']}})[_0x9b20('0x23')](handleEntityNotFound(_0x289132,null))['then'](removeEntity(_0x289132,null))[_0x9b20('0x44')](handleError(_0x289132,null));};exports[_0x9b20('0x48')]=function(_0x25a386,_0x308300){return db[_0x9b20('0x2a')][_0x9b20('0x48')]()[_0x9b20('0x23')](respondWithResult(_0x308300,null))[_0x9b20('0x44')](handleError(_0x308300,null));}; \ No newline at end of file +var _0xa75d=['includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL'];(function(_0x37653e,_0x372780){var _0x7257d4=function(_0x280822){while(--_0x280822){_0x37653e['push'](_0x37653e['shift']());}};_0x7257d4(++_0x372780);}(_0xa75d,0x138));var _0xda75=function(_0x3d3c4e,_0x22dd39){_0x3d3c4e=_0x3d3c4e-0x0;var _0x58acc8=_0xa75d[_0x3d3c4e];return _0x58acc8;};'use strict';var emlformat=require(_0xda75('0x0'));var rimraf=require(_0xda75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda75('0x2'));var rp=require(_0xda75('0x3'));var moment=require(_0xda75('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda75('0x5'));var path=require(_0xda75('0x6'));var sox=require(_0xda75('0x7'));var csv=require(_0xda75('0x8'));var ejs=require(_0xda75('0x9'));var fs=require('fs');var fs_extra=require(_0xda75('0xa'));var _=require('lodash');var squel=require(_0xda75('0xb'));var crypto=require(_0xda75('0xc'));var jsforce=require(_0xda75('0xd'));var deskjs=require(_0xda75('0xe'));var toCsv=require(_0xda75('0x8'));var querystring=require(_0xda75('0xf'));var Papa=require(_0xda75('0x10'));var Redis=require(_0xda75('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xda75('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xda75('0x13'))('api');var utils=require(_0xda75('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xda75('0x15'));var db=require(_0xda75('0x16'))['db'];function respondWithStatusCode(_0x3fb5b3,_0x20b1fb){_0x20b1fb=_0x20b1fb||0xcc;return function(_0x17b93b){if(_0x17b93b){return _0x3fb5b3[_0xda75('0x17')](_0x20b1fb);}return _0x3fb5b3['status'](_0x20b1fb)[_0xda75('0x18')]();};}function respondWithResult(_0x5702b6,_0x5c844f){_0x5c844f=_0x5c844f||0xc8;return function(_0x3a780c){if(_0x3a780c){return _0x5702b6[_0xda75('0x19')](_0x5c844f)[_0xda75('0x1a')](_0x3a780c);}};}function respondWithFilteredResult(_0x20c521,_0xfc4657){return function(_0x39550e){if(_0x39550e){var _0x983765=typeof _0xfc4657[_0xda75('0x1b')]===_0xda75('0x1c')&&typeof _0xfc4657[_0xda75('0x1d')]===_0xda75('0x1c');var _0x237172=_0x39550e[_0xda75('0x1e')];var _0x27d755=_0x983765?0x0:_0xfc4657['offset'];var _0x2a870d=_0x983765?_0x39550e[_0xda75('0x1e')]:_0xfc4657[_0xda75('0x1b')]+_0xfc4657[_0xda75('0x1d')];var _0xea9650;if(_0x2a870d>=_0x237172){_0x2a870d=_0x237172;_0xea9650=0xc8;}else{_0xea9650=0xce;}_0x20c521[_0xda75('0x19')](_0xea9650);return _0x20c521[_0xda75('0x1f')]('Content-Range',_0x27d755+'-'+_0x2a870d+'/'+_0x237172)[_0xda75('0x1a')](_0x39550e);}return null;};}function patchUpdates(_0x1aec03){return function(_0x5a3b55){try{jsonpatch[_0xda75('0x20')](_0x5a3b55,_0x1aec03,!![]);}catch(_0x350c6b){return BPromise[_0xda75('0x21')](_0x350c6b);}return _0x5a3b55[_0xda75('0x22')]();};}function saveUpdates(_0xf8e836,_0x34582f){return function(_0x4e1e07){if(_0x4e1e07){return _0x4e1e07[_0xda75('0x23')](_0xf8e836)['then'](function(_0x8dd1b4){return _0x8dd1b4;});}return null;};}function removeEntity(_0x1f05cd,_0x5a92d1){return function(_0x3196a6){if(_0x3196a6){return _0x3196a6[_0xda75('0x24')]()[_0xda75('0x25')](function(){_0x1f05cd['status'](0xcc)[_0xda75('0x18')]();});}};}function handleEntityNotFound(_0x21741e,_0x45eb5a){return function(_0xd519dc){if(!_0xd519dc){_0x21741e[_0xda75('0x17')](0x194);}return _0xd519dc;};}function handleError(_0xf8c656,_0x3c3843){_0x3c3843=_0x3c3843||0x1f4;return function(_0x250aa9){logger[_0xda75('0x26')](_0x250aa9[_0xda75('0x27')]);if(_0x250aa9[_0xda75('0x28')]){delete _0x250aa9[_0xda75('0x28')];}_0xf8c656[_0xda75('0x19')](_0x3c3843)[_0xda75('0x29')](_0x250aa9);};}exports[_0xda75('0x2a')]=function(_0x5653ae,_0x598603){var _0x177b32={},_0x308c9a={},_0x3e4133={'count':0x0,'rows':[]};var _0x186d0a=_['map'](db[_0xda75('0x2b')][_0xda75('0x2c')],function(_0x21b099){return{'name':_0x21b099[_0xda75('0x2d')],'type':_0x21b099[_0xda75('0x2e')]['key']};});_0x308c9a[_0xda75('0x2f')]=_['map'](_0x186d0a,_0xda75('0x28'));_0x308c9a[_0xda75('0x30')]=_['keys'](_0x5653ae[_0xda75('0x30')]);_0x308c9a[_0xda75('0x31')]=_[_0xda75('0x32')](_0x308c9a[_0xda75('0x2f')],_0x308c9a['query']);_0x177b32['attributes']=_[_0xda75('0x32')](_0x308c9a['model'],qs[_0xda75('0x33')](_0x5653ae[_0xda75('0x30')][_0xda75('0x33')]));_0x177b32[_0xda75('0x34')]=_0x177b32[_0xda75('0x34')][_0xda75('0x35')]?_0x177b32[_0xda75('0x34')]:_0x308c9a[_0xda75('0x2f')];if(!_0x5653ae['query'][_0xda75('0x36')](_0xda75('0x37'))){_0x177b32[_0xda75('0x1d')]=qs[_0xda75('0x1d')](_0x5653ae[_0xda75('0x30')]['limit']);_0x177b32[_0xda75('0x1b')]=qs['offset'](_0x5653ae[_0xda75('0x30')][_0xda75('0x1b')]);}_0x177b32[_0xda75('0x38')]=qs['sort'](_0x5653ae[_0xda75('0x30')][_0xda75('0x39')]);_0x177b32[_0xda75('0x3a')]=qs[_0xda75('0x31')](_['pick'](_0x5653ae[_0xda75('0x30')],_0x308c9a[_0xda75('0x31')]),_0x186d0a);if(_0x5653ae[_0xda75('0x30')][_0xda75('0x3b')]){_0x177b32[_0xda75('0x3a')]=_[_0xda75('0x3c')](_0x177b32[_0xda75('0x3a')],{'$or':_[_0xda75('0x3d')](_0x186d0a,function(_0x5e3541){if(_0x5e3541[_0xda75('0x2e')]!==_0xda75('0x3e')){var _0x4e6901={};_0x4e6901[_0x5e3541['name']]={'$like':'%'+_0x5653ae[_0xda75('0x30')][_0xda75('0x3b')]+'%'};return _0x4e6901;}})});}_0x177b32=_[_0xda75('0x3c')]({},_0x177b32,_0x5653ae['options']);var _0x36b52b={'where':_0x177b32[_0xda75('0x3a')]};return db['MailTransferReport']['count'](_0x36b52b)[_0xda75('0x25')](function(_0x1eb078){_0x3e4133[_0xda75('0x1e')]=_0x1eb078;if(_0x5653ae[_0xda75('0x30')][_0xda75('0x3f')]){_0x177b32[_0xda75('0x40')]=[{'all':!![]}];}return db[_0xda75('0x2b')][_0xda75('0x41')](_0x177b32);})[_0xda75('0x25')](function(_0x22d154){_0x3e4133[_0xda75('0x42')]=_0x22d154;return _0x3e4133;})['then'](respondWithFilteredResult(_0x598603,_0x177b32))[_0xda75('0x43')](handleError(_0x598603,null));};exports[_0xda75('0x44')]=function(_0x3dea2d,_0x26d5b0){var _0x38db7a={'raw':!![],'where':{'id':_0x3dea2d[_0xda75('0x45')]['id']}},_0xcff108={};_0xcff108[_0xda75('0x2f')]=_[_0xda75('0x46')](db[_0xda75('0x2b')]['rawAttributes']);_0xcff108[_0xda75('0x30')]=_[_0xda75('0x46')](_0x3dea2d[_0xda75('0x30')]);_0xcff108['filters']=_['intersection'](_0xcff108[_0xda75('0x2f')],_0xcff108['query']);_0x38db7a['attributes']=_[_0xda75('0x32')](_0xcff108[_0xda75('0x2f')],qs[_0xda75('0x33')](_0x3dea2d['query'][_0xda75('0x33')]));_0x38db7a[_0xda75('0x34')]=_0x38db7a[_0xda75('0x34')][_0xda75('0x35')]?_0x38db7a[_0xda75('0x34')]:_0xcff108[_0xda75('0x2f')];if(_0x3dea2d['query'][_0xda75('0x3f')]){_0x38db7a[_0xda75('0x40')]=[{'all':!![]}];}_0x38db7a=_[_0xda75('0x3c')]({},_0x38db7a,_0x3dea2d[_0xda75('0x47')]);return db['MailTransferReport'][_0xda75('0x48')](_0x38db7a)[_0xda75('0x25')](handleEntityNotFound(_0x26d5b0,null))[_0xda75('0x25')](respondWithResult(_0x26d5b0,null))['catch'](handleError(_0x26d5b0,null));};exports['create']=function(_0x291f5e,_0x5ad98c){return db[_0xda75('0x2b')]['create'](_0x291f5e[_0xda75('0x49')],{})[_0xda75('0x25')](respondWithResult(_0x5ad98c,0xc9))[_0xda75('0x43')](handleError(_0x5ad98c,null));};exports[_0xda75('0x23')]=function(_0x3b212f,_0x51796d){if(_0x3b212f[_0xda75('0x49')]['id']){delete _0x3b212f['body']['id'];}return db[_0xda75('0x2b')][_0xda75('0x48')]({'where':{'id':_0x3b212f[_0xda75('0x45')]['id']}})[_0xda75('0x25')](handleEntityNotFound(_0x51796d,null))['then'](saveUpdates(_0x3b212f['body'],null))[_0xda75('0x25')](respondWithResult(_0x51796d,null))[_0xda75('0x43')](handleError(_0x51796d,null));};exports[_0xda75('0x24')]=function(_0x15cfc3,_0x58227a){return db['MailTransferReport'][_0xda75('0x48')]({'where':{'id':_0x15cfc3[_0xda75('0x45')]['id']}})[_0xda75('0x25')](handleEntityNotFound(_0x58227a,null))[_0xda75('0x25')](removeEntity(_0x58227a,null))['catch'](handleError(_0x58227a,null));};exports[_0xda75('0x4a')]=function(_0xab2574,_0x5e36e9){return db[_0xda75('0x2b')]['describe']()['then'](respondWithResult(_0x5e36e9,null))['catch'](handleError(_0x5e36e9,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9eff841..4bcc654 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 _0x45aa=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util'];(function(_0x323749,_0x1f9fe7){var _0xa1ba97=function(_0x5436df){while(--_0x5436df){_0x323749['push'](_0x323749['shift']());}};_0xa1ba97(++_0x1f9fe7);}(_0x45aa,0xdf));var _0xa45a=function(_0x467e63,_0x1c85e8){_0x467e63=_0x467e63-0x0;var _0x54cbce=_0x45aa[_0x467e63];return _0x54cbce;};'use strict';var _=require('lodash');var util=require(_0xa45a('0x0'));var logger=require(_0xa45a('0x1'))(_0xa45a('0x2'));var moment=require(_0xa45a('0x3'));var BPromise=require('bluebird');var rp=require(_0xa45a('0x4'));var fs=require('fs');var path=require(_0xa45a('0x5'));var rimraf=require(_0xa45a('0x6'));var config=require(_0xa45a('0x7'));var attributes=require(_0xa45a('0x8'));module[_0xa45a('0x9')]=function(_0x38cd0c,_0x527758){return _0x38cd0c[_0xa45a('0xa')](_0xa45a('0xb'),attributes,{'tableName':_0xa45a('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa45a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2428=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x2428,0xd3));var _0x8242=function(_0x3cc05a,_0x1a0c6c){_0x3cc05a=_0x3cc05a-0x0;var _0x301bae=_0x2428[_0x3cc05a];return _0x301bae;};'use strict';var _=require('lodash');var util=require(_0x8242('0x0'));var logger=require(_0x8242('0x1'))(_0x8242('0x2'));var moment=require(_0x8242('0x3'));var BPromise=require(_0x8242('0x4'));var rp=require(_0x8242('0x5'));var fs=require('fs');var path=require(_0x8242('0x6'));var rimraf=require(_0x8242('0x7'));var config=require(_0x8242('0x8'));var attributes=require(_0x8242('0x9'));module[_0x8242('0xa')]=function(_0x484baa,_0x38153d){return _0x484baa[_0x8242('0xb')](_0x8242('0xc'),attributes,{'tableName':_0x8242('0xd'),'paranoid':![],'indexes':[{'name':_0x8242('0xe'),'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 0879b02..c735693 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 _0x35fd=['code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x35fd,0x65));var _0xd35f=function(_0x289e1a,_0x50acdd){_0x289e1a=_0x289e1a-0x0;var _0x391c45=_0x35fd[_0x289e1a];return _0x391c45;};'use strict';var _=require(_0xd35f('0x0'));var util=require('util');var moment=require(_0xd35f('0x1'));var BPromise=require('bluebird');var rs=require(_0xd35f('0x2'));var fs=require('fs');var Redis=require(_0xd35f('0x3'));var db=require(_0xd35f('0x4'))['db'];var utils=require(_0xd35f('0x5'));var logger=require(_0xd35f('0x6'))(_0xd35f('0x7'));var config=require(_0xd35f('0x8'));var jayson=require(_0xd35f('0x9'));var client=jayson['client'][_0xd35f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e3476,_0x25a950,_0x2e7ccd){return new BPromise(function(_0x201abc,_0x28a8e6){return client[_0xd35f('0xb')](_0x2e3476,_0x2e7ccd)[_0xd35f('0xc')](function(_0x35e23c){logger[_0xd35f('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x25a950,_0xd35f('0xe'));logger[_0xd35f('0xf')](_0xd35f('0x10'),_0x25a950,'request\x20sent',JSON[_0xd35f('0x11')](_0x35e23c));if(_0x35e23c[_0xd35f('0x12')]){if(_0x35e23c[_0xd35f('0x12')][_0xd35f('0x13')]===0x1f4){logger[_0xd35f('0x12')](_0xd35f('0x14'),_0x25a950,_0x35e23c['error']['message']);return _0x28a8e6(_0x35e23c[_0xd35f('0x12')][_0xd35f('0x15')]);}logger['error'](_0xd35f('0x14'),_0x25a950,_0x35e23c[_0xd35f('0x12')][_0xd35f('0x15')]);return _0x201abc(_0x35e23c[_0xd35f('0x12')][_0xd35f('0x15')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x25a950,'request\x20sent');_0x201abc(_0x35e23c[_0xd35f('0x16')][_0xd35f('0x15')]);}})[_0xd35f('0x17')](function(_0x5b1fc2){logger[_0xd35f('0x12')](_0xd35f('0x14'),_0x25a950,_0x5b1fc2);_0x28a8e6(_0x5b1fc2);});});} \ No newline at end of file +var _0xcaaf=['jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4d26dc,_0x1334a2){var _0x1e5161=function(_0x2a1fad){while(--_0x2a1fad){_0x4d26dc['push'](_0x4d26dc['shift']());}};_0x1e5161(++_0x1334a2);}(_0xcaaf,0x1ed));var _0xfcaa=function(_0x3c8e6c,_0x1ab110){_0x3c8e6c=_0x3c8e6c-0x0;var _0x52aa1a=_0xcaaf[_0x3c8e6c];return _0x52aa1a;};'use strict';var _=require(_0xfcaa('0x0'));var util=require(_0xfcaa('0x1'));var moment=require('moment');var BPromise=require(_0xfcaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcaa('0x3'));var db=require(_0xfcaa('0x4'))['db'];var utils=require(_0xfcaa('0x5'));var logger=require('../../config/logger')(_0xfcaa('0x6'));var config=require('../../config/environment');var jayson=require(_0xfcaa('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x499ba6,_0x2a33f1,_0x1c25f9){return new BPromise(function(_0x2a5d2e,_0x573253){return client[_0xfcaa('0x8')](_0x499ba6,_0x1c25f9)[_0xfcaa('0x9')](function(_0x130e93){logger[_0xfcaa('0xa')](_0xfcaa('0xb'),_0x2a33f1,_0xfcaa('0xc'));logger[_0xfcaa('0xd')](_0xfcaa('0xe'),_0x2a33f1,_0xfcaa('0xc'),JSON['stringify'](_0x130e93));if(_0x130e93[_0xfcaa('0xf')]){if(_0x130e93['error'][_0xfcaa('0x10')]===0x1f4){logger['error'](_0xfcaa('0xb'),_0x2a33f1,_0x130e93['error'][_0xfcaa('0x11')]);return _0x573253(_0x130e93[_0xfcaa('0xf')][_0xfcaa('0x11')]);}logger[_0xfcaa('0xf')](_0xfcaa('0xb'),_0x2a33f1,_0x130e93['error'][_0xfcaa('0x11')]);return _0x2a5d2e(_0x130e93[_0xfcaa('0xf')][_0xfcaa('0x11')]);}else{logger[_0xfcaa('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x2a33f1,_0xfcaa('0xc'));_0x2a5d2e(_0x130e93[_0xfcaa('0x12')][_0xfcaa('0x11')]);}})[_0xfcaa('0x13')](function(_0xb299b3){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2a33f1,_0xb299b3);_0x573253(_0xb299b3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index cefea35..8190bdb 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 _0x964c=['show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x5cf2eb,_0x47306a){var _0x5f3804=function(_0x4546f1){while(--_0x4546f1){_0x5cf2eb['push'](_0x5cf2eb['shift']());}};_0x5f3804(++_0x47306a);}(_0x964c,0x15f));var _0xc964=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x964c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc964('0x0'));var util=require(_0xc964('0x1'));var path=require(_0xc964('0x2'));var timeout=require(_0xc964('0x3'));var express=require(_0xc964('0x4'));var router=express[_0xc964('0x5')]();var fs_extra=require(_0xc964('0x6'));var auth=require(_0xc964('0x7'));var interaction=require(_0xc964('0x8'));var config=require(_0xc964('0x9'));var controller=require(_0xc964('0xa'));router['get']('/',auth[_0xc964('0xb')](),controller[_0xc964('0xc')]);router[_0xc964('0xd')](_0xc964('0xe'),auth[_0xc964('0xb')](),controller[_0xc964('0xf')]);router[_0xc964('0xd')](_0xc964('0x10'),auth['isAuthenticated'](),controller[_0xc964('0x11')]);router[_0xc964('0x12')]('/',auth['isAuthenticated'](),controller[_0xc964('0x13')]);router['put'](_0xc964('0x10'),auth[_0xc964('0xb')](),controller[_0xc964('0x14')]);router['delete'](_0xc964('0x10'),auth[_0xc964('0xb')](),controller[_0xc964('0x15')]);module[_0xc964('0x16')]=router; \ No newline at end of file +var _0xf548=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf548,0x190));var _0x8f54=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0xf548[_0x30c649];return _0x3edfb9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8f54('0x0'));var express=require('express');var router=express[_0x8f54('0x1')]();var fs_extra=require(_0x8f54('0x2'));var auth=require(_0x8f54('0x3'));var interaction=require(_0x8f54('0x4'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x8f54('0x5')]('/',auth[_0x8f54('0x6')](),controller[_0x8f54('0x7')]);router[_0x8f54('0x5')](_0x8f54('0x8'),auth[_0x8f54('0x6')](),controller[_0x8f54('0x9')]);router[_0x8f54('0x5')](_0x8f54('0xa'),auth[_0x8f54('0x6')](),controller[_0x8f54('0xb')]);router['post']('/',auth[_0x8f54('0x6')](),controller[_0x8f54('0xc')]);router[_0x8f54('0xd')](_0x8f54('0xa'),auth[_0x8f54('0x6')](),controller[_0x8f54('0xe')]);router[_0x8f54('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index d04f422..bccfec5 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 _0xb815=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment','exports','STRING'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb815,0x1ed));var _0x5b81=function(_0x5b04ac,_0x14b9b5){_0x5b04ac=_0x5b04ac-0x0;var _0x106281=_0xb815[_0x5b04ac];return _0x106281;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5b81('0x0'));module[_0x5b81('0x1')]={'channel':{'type':Sequelize[_0x5b81('0x2')]},'membername':{'type':Sequelize[_0x5b81('0x2')]},'interface':{'type':Sequelize[_0x5b81('0x2')]},'type':{'type':Sequelize[_0x5b81('0x2')],'defaultValue':_0x5b81('0x3'),'comment':_0x5b81('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5b81('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x2cbe8c){var _0x3b70da=moment(_0x2cbe8c);var _0x3fa5e7=moment(this['getDataValue'](_0x5b81('0x6')));var _0x356065=_0x3b70da['diff'](_0x3fa5e7,_0x5b81('0x7'));this[_0x5b81('0x8')](_0x5b81('0x9'),_0x2cbe8c);this['setDataValue']('duration',_0x356065>=0x0?_0x356065:null);}},'data1':{'type':Sequelize[_0x5b81('0x2')],'comment':_0x5b81('0xa')},'data2':{'type':Sequelize['STRING'],'comment':_0x5b81('0xb')},'data3':{'type':Sequelize[_0x5b81('0x2')],'comment':_0x5b81('0xc')},'data4':{'type':Sequelize[_0x5b81('0x2')],'comment':_0x5b81('0xd')},'data5':{'type':Sequelize[_0x5b81('0x2')],'comment':_0x5b81('0xe')},'role':{'type':Sequelize[_0x5b81('0x2')]},'internal':{'type':Sequelize[_0x5b81('0xf')]},'uniqueid':{'type':Sequelize[_0x5b81('0x2')]}}; \ No newline at end of file +var _0xbe04=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x2cc8d8,_0x29b42f){var _0x46de9c=function(_0x3f6891){while(--_0x3f6891){_0x2cc8d8['push'](_0x2cc8d8['shift']());}};_0x46de9c(++_0x29b42f);}(_0xbe04,0x1bf));var _0x4be0=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xbe04[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x4be0('0x0'));var moment=require(_0x4be0('0x1'));module[_0x4be0('0x2')]={'channel':{'type':Sequelize[_0x4be0('0x3')]},'membername':{'type':Sequelize[_0x4be0('0x3')]},'interface':{'type':Sequelize[_0x4be0('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x4be0('0x4'),'comment':_0x4be0('0x5')},'duration':{'type':Sequelize[_0x4be0('0x6')]},'enterAt':{'type':Sequelize[_0x4be0('0x7')]},'exitAt':{'type':Sequelize[_0x4be0('0x7')],'set':function(_0x8f2db6){var _0x301263=moment(_0x8f2db6);var _0x58cd0f=moment(this[_0x4be0('0x8')](_0x4be0('0x9')));var _0x1a1813=_0x301263['diff'](_0x58cd0f,_0x4be0('0xa'));this[_0x4be0('0xb')](_0x4be0('0xc'),_0x8f2db6);this['setDataValue']('duration',_0x1a1813>=0x0?_0x1a1813:null);}},'data1':{'type':Sequelize[_0x4be0('0x3')],'comment':_0x4be0('0xd')},'data2':{'type':Sequelize[_0x4be0('0x3')],'comment':_0x4be0('0xe')},'data3':{'type':Sequelize[_0x4be0('0x3')],'comment':_0x4be0('0xf')},'data4':{'type':Sequelize[_0x4be0('0x3')],'comment':_0x4be0('0x10')},'data5':{'type':Sequelize[_0x4be0('0x3')],'comment':_0x4be0('0x11')},'role':{'type':Sequelize[_0x4be0('0x3')]},'internal':{'type':Sequelize[_0x4be0('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index cab7cf2..1f82405 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 _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x2bdcab,_0x43bf){var _0x4802e9=function(_0x169efb){while(--_0x169efb){_0x2bdcab['push'](_0x2bdcab['shift']());}};_0x4802e9(++_0x43bf);}(_0x7217,0x19e));var _0x7721=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x7217[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x198fc6,_0x5eaee9){var _0x4376bb=function(_0x4b3241){while(--_0x4b3241){_0x198fc6['push'](_0x198fc6['shift']());}};_0x4376bb(++_0x5eaee9);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index b83d74e..47f277d 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 _0x5f6b=['path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','../../config/logger','api','moment'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x5f6b,0x81));var _0xb5f6=function(_0x27583f,_0x466f35){_0x27583f=_0x27583f-0x0;var _0x50d98f=_0x5f6b[_0x27583f];return _0x50d98f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb5f6('0x0'))(_0xb5f6('0x1'));var moment=require(_0xb5f6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5f6('0x3'));var rimraf=require(_0xb5f6('0x4'));var config=require('../../config/environment');var attributes=require(_0xb5f6('0x5'));module[_0xb5f6('0x6')]=function(_0x56f55b,_0x587b9a){return _0x56f55b[_0xb5f6('0x7')](_0xb5f6('0x8'),attributes,{'tableName':_0xb5f6('0x9'),'paranoid':![],'indexes':[{'name':_0xb5f6('0xa'),'fields':[_0xb5f6('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b0c=['interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername'];(function(_0x34147a,_0x197be3){var _0x86635c=function(_0x582bce){while(--_0x582bce){_0x34147a['push'](_0x34147a['shift']());}};_0x86635c(++_0x197be3);}(_0x5b0c,0xd3));var _0xc5b0=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x5b0c[_0x33554b];return _0x256954;};'use strict';var _=require(_0xc5b0('0x0'));var util=require('util');var logger=require(_0xc5b0('0x1'))(_0xc5b0('0x2'));var moment=require(_0xc5b0('0x3'));var BPromise=require(_0xc5b0('0x4'));var rp=require(_0xc5b0('0x5'));var fs=require('fs');var path=require(_0xc5b0('0x6'));var rimraf=require(_0xc5b0('0x7'));var config=require('../../config/environment');var attributes=require(_0xc5b0('0x8'));module[_0xc5b0('0x9')]=function(_0x5ae3fb,_0x2f745b){return _0x5ae3fb[_0xc5b0('0xa')](_0xc5b0('0xb'),attributes,{'tableName':_0xc5b0('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xc5b0('0xd'),_0xc5b0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8072db1..00dd8b6 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 _0x3cb7=['catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','map','model','include','CreateMemberReport','create','body','update','limit','UpdateMemberReport','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x53a8dd,_0x1d9173){var _0x4e7e1c=function(_0x4ee0c0){while(--_0x4ee0c0){_0x53a8dd['push'](_0x53a8dd['shift']());}};_0x4e7e1c(++_0x1d9173);}(_0x3cb7,0xcf));var _0x73cb=function(_0x26659f,_0x32f426){_0x26659f=_0x26659f-0x0;var _0x42667f=_0x3cb7[_0x26659f];return _0x42667f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73cb('0x0'));var BPromise=require('bluebird');var rs=require(_0x73cb('0x1'));var fs=require('fs');var Redis=require(_0x73cb('0x2'));var db=require(_0x73cb('0x3'))['db'];var utils=require(_0x73cb('0x4'));var logger=require(_0x73cb('0x5'))(_0x73cb('0x6'));var config=require(_0x73cb('0x7'));var jayson=require(_0x73cb('0x8'));var client=jayson['client'][_0x73cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28c95e,_0x1a3637,_0x2319d0){return new BPromise(function(_0x40d9d2,_0x4aab5e){return client[_0x73cb('0xa')](_0x28c95e,_0x2319d0)[_0x73cb('0xb')](function(_0x680a54){logger[_0x73cb('0xc')](_0x73cb('0xd'),_0x1a3637,_0x73cb('0xe'));logger[_0x73cb('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x1a3637,_0x73cb('0xe'),JSON[_0x73cb('0x10')](_0x680a54));if(_0x680a54[_0x73cb('0x11')]){if(_0x680a54[_0x73cb('0x11')][_0x73cb('0x12')]===0x1f4){logger[_0x73cb('0x11')]('MemberReport,\x20%s,\x20%s',_0x1a3637,_0x680a54[_0x73cb('0x11')][_0x73cb('0x13')]);return _0x4aab5e(_0x680a54[_0x73cb('0x11')][_0x73cb('0x13')]);}logger[_0x73cb('0x11')](_0x73cb('0xd'),_0x1a3637,_0x680a54[_0x73cb('0x11')][_0x73cb('0x13')]);return _0x40d9d2(_0x680a54[_0x73cb('0x11')][_0x73cb('0x13')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x1a3637,'request\x20sent');_0x40d9d2(_0x680a54[_0x73cb('0x14')][_0x73cb('0x13')]);}})[_0x73cb('0x15')](function(_0x199988){logger[_0x73cb('0x11')]('MemberReport,\x20%s,\x20%s',_0x1a3637,_0x199988);_0x4aab5e(_0x199988);});});}exports[_0x73cb('0x16')]=function(_0x3df436){var _0x2dfb8e=this;return new Promise(function(_0x25c26b,_0x3a27ac){return db[_0x73cb('0x17')][_0x73cb('0x18')]({'raw':_0x3df436[_0x73cb('0x19')]?_0x3df436[_0x73cb('0x19')][_0x73cb('0x1a')]===undefined?!![]:![]:!![],'where':_0x3df436['options']?_0x3df436[_0x73cb('0x19')][_0x73cb('0x1b')]||null:null,'attributes':_0x3df436['options']?_0x3df436['options'][_0x73cb('0x1c')]||null:null,'limit':_0x3df436[_0x73cb('0x19')]?_0x3df436[_0x73cb('0x19')]['limit']||null:null,'include':_0x3df436[_0x73cb('0x19')]?_0x3df436['options']['include']?_[_0x73cb('0x1d')](_0x3df436[_0x73cb('0x19')]['include'],function(_0x57da9f){return{'model':db[_0x57da9f[_0x73cb('0x1e')]],'as':_0x57da9f['as'],'attributes':_0x57da9f[_0x73cb('0x1c')],'include':_0x57da9f['include']?_[_0x73cb('0x1d')](_0x57da9f[_0x73cb('0x1f')],function(_0x191990){return{'model':db[_0x191990[_0x73cb('0x1e')]],'as':_0x191990['as'],'attributes':_0x191990[_0x73cb('0x1c')],'include':_0x191990[_0x73cb('0x1f')]?_[_0x73cb('0x1d')](_0x191990[_0x73cb('0x1f')],function(_0x12a837){return{'model':db[_0x12a837['model']],'as':_0x12a837['as'],'attributes':_0x12a837[_0x73cb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e5c7b){logger[_0x73cb('0xc')](_0x73cb('0x16'),_0x3df436);logger[_0x73cb('0xf')](_0x73cb('0x16'),_0x3df436,JSON[_0x73cb('0x10')](_0x1e5c7b));_0x25c26b(_0x1e5c7b);})['catch'](function(_0x3ab710){logger['error'](_0x73cb('0x16'),_0x3ab710['message'],_0x3df436);_0x3a27ac(_0x2dfb8e[_0x73cb('0x11')](0x1f4,_0x3ab710[_0x73cb('0x13')]));});});};exports[_0x73cb('0x20')]=function(_0x2291fc){var _0x5b5557=this;return new Promise(function(_0x5c7117,_0x211d29){return db[_0x73cb('0x17')][_0x73cb('0x21')](_0x2291fc[_0x73cb('0x22')],{'raw':_0x2291fc['options']?_0x2291fc[_0x73cb('0x19')][_0x73cb('0x1a')]===undefined?!![]:![]:!![]})[_0x73cb('0xb')](function(_0x20f9d8){logger[_0x73cb('0xc')](_0x73cb('0x20'),_0x2291fc);logger[_0x73cb('0xf')](_0x73cb('0x20'),_0x2291fc,JSON[_0x73cb('0x10')](_0x20f9d8));_0x5c7117(_0x20f9d8);})[_0x73cb('0x15')](function(_0x5b39ad){logger['error']('CreateMemberReport',_0x5b39ad[_0x73cb('0x13')],_0x2291fc);_0x211d29(_0x5b5557[_0x73cb('0x11')](0x1f4,_0x5b39ad[_0x73cb('0x13')]));});});};exports['UpdateMemberReport']=function(_0x28637f){var _0x40496a=this;return new Promise(function(_0x47cbb1,_0x413a03){return db['MemberReport'][_0x73cb('0x23')](_0x28637f[_0x73cb('0x22')],{'raw':_0x28637f[_0x73cb('0x19')]?_0x28637f[_0x73cb('0x19')][_0x73cb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28637f[_0x73cb('0x19')]?_0x28637f[_0x73cb('0x19')][_0x73cb('0x1b')]||null:null,'attributes':_0x28637f['options']?_0x28637f['options'][_0x73cb('0x1c')]||null:null,'limit':_0x28637f['options']?_0x28637f[_0x73cb('0x19')][_0x73cb('0x24')]||null:null})[_0x73cb('0xb')](function(_0x6b7cd8){logger[_0x73cb('0xc')]('UpdateMemberReport',_0x28637f);logger[_0x73cb('0xf')](_0x73cb('0x25'),_0x28637f,JSON[_0x73cb('0x10')](_0x6b7cd8));_0x47cbb1(_0x6b7cd8);})[_0x73cb('0x15')](function(_0x4f7ac4){logger['error'](_0x73cb('0x25'),_0x4f7ac4['message'],_0x28637f);_0x413a03(_0x40496a[_0x73cb('0x11')](0x1f4,_0x4f7ac4[_0x73cb('0x13')]));});});}; \ No newline at end of file +var _0x6003=['info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','MemberReport','create','CreateMemberReport','UpdateMemberReport','body','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x31f0f9,_0x100cbe){var _0x319e51=function(_0x5ceafc){while(--_0x5ceafc){_0x31f0f9['push'](_0x31f0f9['shift']());}};_0x319e51(++_0x100cbe);}(_0x6003,0xae));var _0x3600=function(_0x298e16,_0x2c4521){_0x298e16=_0x298e16-0x0;var _0x11262e=_0x6003[_0x298e16];return _0x11262e;};'use strict';var _=require(_0x3600('0x0'));var util=require(_0x3600('0x1'));var moment=require(_0x3600('0x2'));var BPromise=require(_0x3600('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3600('0x4'))['db'];var utils=require(_0x3600('0x5'));var logger=require(_0x3600('0x6'))('rpc');var config=require(_0x3600('0x7'));var jayson=require(_0x3600('0x8'));var client=jayson['client'][_0x3600('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f4130,_0x4880c7,_0x177f11){return new BPromise(function(_0x4a5962,_0x145243){return client['request'](_0x4f4130,_0x177f11)[_0x3600('0xa')](function(_0x22f1b3){logger[_0x3600('0xb')](_0x3600('0xc'),_0x4880c7,'request\x20sent');logger[_0x3600('0xd')](_0x3600('0xe'),_0x4880c7,_0x3600('0xf'),JSON[_0x3600('0x10')](_0x22f1b3));if(_0x22f1b3[_0x3600('0x11')]){if(_0x22f1b3[_0x3600('0x11')][_0x3600('0x12')]===0x1f4){logger[_0x3600('0x11')](_0x3600('0xc'),_0x4880c7,_0x22f1b3[_0x3600('0x11')][_0x3600('0x13')]);return _0x145243(_0x22f1b3[_0x3600('0x11')]['message']);}logger[_0x3600('0x11')]('MemberReport,\x20%s,\x20%s',_0x4880c7,_0x22f1b3['error'][_0x3600('0x13')]);return _0x4a5962(_0x22f1b3[_0x3600('0x11')][_0x3600('0x13')]);}else{logger['info'](_0x3600('0xc'),_0x4880c7,'request\x20sent');_0x4a5962(_0x22f1b3[_0x3600('0x14')]['message']);}})[_0x3600('0x15')](function(_0xb11c9d){logger[_0x3600('0x11')]('MemberReport,\x20%s,\x20%s',_0x4880c7,_0xb11c9d);_0x145243(_0xb11c9d);});});}exports['GetMemberReport']=function(_0x680b80){var _0x274012=this;return new Promise(function(_0xcb98b5,_0x2d8f10){return db['MemberReport'][_0x3600('0x16')]({'raw':_0x680b80['options']?_0x680b80[_0x3600('0x17')][_0x3600('0x18')]===undefined?!![]:![]:!![],'where':_0x680b80[_0x3600('0x17')]?_0x680b80['options'][_0x3600('0x19')]||null:null,'attributes':_0x680b80['options']?_0x680b80[_0x3600('0x17')][_0x3600('0x1a')]||null:null,'limit':_0x680b80[_0x3600('0x17')]?_0x680b80[_0x3600('0x17')][_0x3600('0x1b')]||null:null,'include':_0x680b80['options']?_0x680b80[_0x3600('0x17')][_0x3600('0x1c')]?_[_0x3600('0x1d')](_0x680b80[_0x3600('0x17')][_0x3600('0x1c')],function(_0x148155){return{'model':db[_0x148155[_0x3600('0x1e')]],'as':_0x148155['as'],'attributes':_0x148155[_0x3600('0x1a')],'include':_0x148155[_0x3600('0x1c')]?_[_0x3600('0x1d')](_0x148155[_0x3600('0x1c')],function(_0x51bdb8){return{'model':db[_0x51bdb8[_0x3600('0x1e')]],'as':_0x51bdb8['as'],'attributes':_0x51bdb8['attributes'],'include':_0x51bdb8[_0x3600('0x1c')]?_['map'](_0x51bdb8[_0x3600('0x1c')],function(_0x1c6b74){return{'model':db[_0x1c6b74[_0x3600('0x1e')]],'as':_0x1c6b74['as'],'attributes':_0x1c6b74[_0x3600('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3600('0xa')](function(_0x20c68d){logger['info'](_0x3600('0x1f'),_0x680b80);logger[_0x3600('0xd')]('GetMemberReport',_0x680b80,JSON[_0x3600('0x10')](_0x20c68d));_0xcb98b5(_0x20c68d);})[_0x3600('0x15')](function(_0x2854cd){logger[_0x3600('0x11')](_0x3600('0x1f'),_0x2854cd[_0x3600('0x13')],_0x680b80);_0x2d8f10(_0x274012[_0x3600('0x11')](0x1f4,_0x2854cd[_0x3600('0x13')]));});});};exports['CreateMemberReport']=function(_0x5cc2d9){var _0x386e47=this;return new Promise(function(_0x531845,_0x12b841){return db[_0x3600('0x20')][_0x3600('0x21')](_0x5cc2d9['body'],{'raw':_0x5cc2d9['options']?_0x5cc2d9[_0x3600('0x17')][_0x3600('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4511b4){logger[_0x3600('0xb')](_0x3600('0x22'),_0x5cc2d9);logger['debug'](_0x3600('0x22'),_0x5cc2d9,JSON[_0x3600('0x10')](_0x4511b4));_0x531845(_0x4511b4);})[_0x3600('0x15')](function(_0x16325c){logger[_0x3600('0x11')](_0x3600('0x22'),_0x16325c[_0x3600('0x13')],_0x5cc2d9);_0x12b841(_0x386e47[_0x3600('0x11')](0x1f4,_0x16325c[_0x3600('0x13')]));});});};exports[_0x3600('0x23')]=function(_0x13615){var _0x174b0b=this;return new Promise(function(_0x45380a,_0x5237ee){return db[_0x3600('0x20')]['update'](_0x13615[_0x3600('0x24')],{'raw':_0x13615['options']?_0x13615[_0x3600('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13615[_0x3600('0x17')]?_0x13615[_0x3600('0x17')][_0x3600('0x19')]||null:null,'attributes':_0x13615[_0x3600('0x17')]?_0x13615[_0x3600('0x17')][_0x3600('0x1a')]||null:null,'limit':_0x13615[_0x3600('0x17')]?_0x13615[_0x3600('0x17')]['limit']||null:null})['then'](function(_0x4189e0){logger[_0x3600('0xb')](_0x3600('0x23'),_0x13615);logger['debug'](_0x3600('0x23'),_0x13615,JSON['stringify'](_0x4189e0));_0x45380a(_0x4189e0);})[_0x3600('0x15')](function(_0x4232b0){logger['error'](_0x3600('0x23'),_0x4232b0[_0x3600('0x13')],_0x13615);_0x5237ee(_0x174b0b[_0x3600('0x11')](0x1f4,_0x4232b0[_0x3600('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7b6d534..abe85ed 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 _0x671a=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x22c01a,_0x6c304f){var _0xa9eb8c=function(_0x1bc4d8){while(--_0x1bc4d8){_0x22c01a['push'](_0x22c01a['shift']());}};_0xa9eb8c(++_0x6c304f);}(_0x671a,0x7a));var _0xa671=function(_0x3130b5,_0x23faf7){_0x3130b5=_0x3130b5-0x0;var _0xa6d8a3=_0x671a[_0x3130b5];return _0xa6d8a3;};'use strict';var multer=require(_0xa671('0x0'));var util=require(_0xa671('0x1'));var path=require(_0xa671('0x2'));var timeout=require(_0xa671('0x3'));var express=require(_0xa671('0x4'));var router=express[_0xa671('0x5')]();var fs_extra=require(_0xa671('0x6'));var auth=require(_0xa671('0x7'));var interaction=require(_0xa671('0x8'));var config=require(_0xa671('0x9'));var controller=require(_0xa671('0xa'));router[_0xa671('0xb')]('/',controller[_0xa671('0xc')]);module['exports']=router; \ No newline at end of file +var _0x8a62=['./migration.controller','get','index','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31d1d2,_0x3eb34d){var _0x18e7f5=function(_0xd361f9){while(--_0xd361f9){_0x31d1d2['push'](_0x31d1d2['shift']());}};_0x18e7f5(++_0x3eb34d);}(_0x8a62,0x130));var _0x28a6=function(_0x56b159,_0x4ff1ed){_0x56b159=_0x56b159-0x0;var _0x198b73=_0x8a62[_0x56b159];return _0x198b73;};'use strict';var multer=require(_0x28a6('0x0'));var util=require(_0x28a6('0x1'));var path=require('path');var timeout=require(_0x28a6('0x2'));var express=require(_0x28a6('0x3'));var router=express[_0x28a6('0x4')]();var fs_extra=require(_0x28a6('0x5'));var auth=require(_0x28a6('0x6'));var interaction=require(_0x28a6('0x7'));var config=require('../../config/environment');var controller=require(_0x28a6('0x8'));router[_0x28a6('0x9')]('/',controller[_0x28a6('0xa')]);module[_0x28a6('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 592e6eb..cdb868f 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 _0xe96e=['exports','version','sequelize'];(function(_0x38f060,_0x3243f8){var _0x45950c=function(_0xca5a0){while(--_0xca5a0){_0x38f060['push'](_0x38f060['shift']());}};_0x45950c(++_0x3243f8);}(_0xe96e,0xe0));var _0xee96=function(_0x3fa90b,_0x52bf1d){_0x3fa90b=_0x3fa90b-0x0;var _0x33ebff=_0xe96e[_0x3fa90b];return _0x33ebff;};'use strict';var Sequelize=require(_0xee96('0x0'));module[_0xee96('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xee96('0x2')}}; \ No newline at end of file +var _0xbd9d=['exports','STRING'];(function(_0x2577a3,_0x179eda){var _0x285494=function(_0x36e970){while(--_0x36e970){_0x2577a3['push'](_0x2577a3['shift']());}};_0x285494(++_0x179eda);}(_0xbd9d,0x158));var _0xdbd9=function(_0xd4a30a,_0x51ca6a){_0xd4a30a=_0xd4a30a-0x0;var _0x2b5723=_0xbd9d[_0xd4a30a];return _0x2b5723;};'use strict';var Sequelize=require('sequelize');module[_0xdbd9('0x0')]={'version':{'type':Sequelize[_0xdbd9('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d626287..4bf6474 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 _0xf74e=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','eml-format','rimraf','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','end','stack','name','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection'];(function(_0xc4b59f,_0x598746){var _0x3b7029=function(_0xbeda0f){while(--_0xbeda0f){_0xc4b59f['push'](_0xc4b59f['shift']());}};_0x3b7029(++_0x598746);}(_0xf74e,0x98));var _0xef74=function(_0x38321d,_0x3cfdf0){_0x38321d=_0x38321d-0x0;var _0x553c0f=_0xf74e[_0x38321d];return _0x553c0f;};'use strict';var emlformat=require(_0xef74('0x0'));var rimraf=require(_0xef74('0x1'));var zipdir=require(_0xef74('0x2'));var jsonpatch=require(_0xef74('0x3'));var rp=require(_0xef74('0x4'));var moment=require(_0xef74('0x5'));var BPromise=require(_0xef74('0x6'));var Mustache=require('mustache');var util=require(_0xef74('0x7'));var path=require(_0xef74('0x8'));var sox=require(_0xef74('0x9'));var csv=require(_0xef74('0xa'));var ejs=require(_0xef74('0xb'));var fs=require('fs');var fs_extra=require(_0xef74('0xc'));var _=require(_0xef74('0xd'));var squel=require(_0xef74('0xe'));var crypto=require(_0xef74('0xf'));var jsforce=require(_0xef74('0x10'));var deskjs=require(_0xef74('0x11'));var toCsv=require('to-csv');var querystring=require(_0xef74('0x12'));var Papa=require('papaparse');var Redis=require(_0xef74('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef74('0x14'));var as=require(_0xef74('0x15'));var hardwareService=require(_0xef74('0x16'));var logger=require(_0xef74('0x17'))('api');var utils=require(_0xef74('0x18'));var config=require(_0xef74('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2571d8,_0xf44f10){_0xf44f10=_0xf44f10||0xcc;return function(_0x1e7597){if(_0x1e7597){return _0x2571d8[_0xef74('0x1a')](_0xf44f10);}return _0x2571d8[_0xef74('0x1b')](_0xf44f10)['end']();};}function respondWithResult(_0x1782e7,_0xd57ca9){_0xd57ca9=_0xd57ca9||0xc8;return function(_0x4b0545){if(_0x4b0545){return _0x1782e7['status'](_0xd57ca9)[_0xef74('0x1c')](_0x4b0545);}};}function respondWithFilteredResult(_0x1b7dcd,_0x2347ba){return function(_0x501d53){if(_0x501d53){var _0x1e8798=typeof _0x2347ba[_0xef74('0x1d')]===_0xef74('0x1e')&&typeof _0x2347ba[_0xef74('0x1f')]===_0xef74('0x1e');var _0x1516df=_0x501d53[_0xef74('0x20')];var _0x525a63=_0x1e8798?0x0:_0x2347ba['offset'];var _0x3cf2c8=_0x1e8798?_0x501d53[_0xef74('0x20')]:_0x2347ba[_0xef74('0x1d')]+_0x2347ba[_0xef74('0x1f')];var _0xdbc21f;if(_0x3cf2c8>=_0x1516df){_0x3cf2c8=_0x1516df;_0xdbc21f=0xc8;}else{_0xdbc21f=0xce;}_0x1b7dcd['status'](_0xdbc21f);return _0x1b7dcd[_0xef74('0x21')](_0xef74('0x22'),_0x525a63+'-'+_0x3cf2c8+'/'+_0x1516df)['json'](_0x501d53);}return null;};}function patchUpdates(_0x2d11f7){return function(_0x20e8f5){try{jsonpatch['apply'](_0x20e8f5,_0x2d11f7,!![]);}catch(_0x265da7){return BPromise[_0xef74('0x23')](_0x265da7);}return _0x20e8f5[_0xef74('0x24')]();};}function saveUpdates(_0x37959d,_0x5e4f1e){return function(_0x15af15){if(_0x15af15){return _0x15af15[_0xef74('0x25')](_0x37959d)['then'](function(_0x1fde0b){return _0x1fde0b;});}return null;};}function removeEntity(_0x470fdb,_0x54e213){return function(_0x5e9a7c){if(_0x5e9a7c){return _0x5e9a7c[_0xef74('0x26')]()[_0xef74('0x27')](function(){_0x470fdb[_0xef74('0x1b')](0xcc)[_0xef74('0x28')]();});}};}function handleEntityNotFound(_0x414300,_0x1c7528){return function(_0x5b4be5){if(!_0x5b4be5){_0x414300[_0xef74('0x1a')](0x194);}return _0x5b4be5;};}function handleError(_0x40cfc5,_0xb02f30){_0xb02f30=_0xb02f30||0x1f4;return function(_0x28a803){logger['error'](_0x28a803[_0xef74('0x29')]);if(_0x28a803[_0xef74('0x2a')]){delete _0x28a803['name'];}_0x40cfc5[_0xef74('0x1b')](_0xb02f30)['send'](_0x28a803);};}exports[_0xef74('0x2b')]=function(_0x1b2603,_0x36bab2){var _0x3fc603={},_0x591bea={},_0x5415d5={'count':0x0,'rows':[]};var _0x3240b7=_[_0xef74('0x2c')](db[_0xef74('0x2d')][_0xef74('0x2e')],function(_0x28ac6c){return{'name':_0x28ac6c[_0xef74('0x2f')],'type':_0x28ac6c['type'][_0xef74('0x30')]};});_0x591bea[_0xef74('0x31')]=_[_0xef74('0x2c')](_0x3240b7,_0xef74('0x2a'));_0x591bea[_0xef74('0x32')]=_[_0xef74('0x33')](_0x1b2603[_0xef74('0x32')]);_0x591bea[_0xef74('0x34')]=_['intersection'](_0x591bea[_0xef74('0x31')],_0x591bea['query']);_0x3fc603[_0xef74('0x35')]=_[_0xef74('0x36')](_0x591bea[_0xef74('0x31')],qs[_0xef74('0x37')](_0x1b2603[_0xef74('0x32')]['fields']));_0x3fc603[_0xef74('0x35')]=_0x3fc603[_0xef74('0x35')][_0xef74('0x38')]?_0x3fc603['attributes']:_0x591bea[_0xef74('0x31')];if(!_0x1b2603[_0xef74('0x32')][_0xef74('0x39')](_0xef74('0x3a'))){_0x3fc603['limit']=qs[_0xef74('0x1f')](_0x1b2603[_0xef74('0x32')][_0xef74('0x1f')]);_0x3fc603['offset']=qs[_0xef74('0x1d')](_0x1b2603[_0xef74('0x32')][_0xef74('0x1d')]);}_0x3fc603['order']=qs[_0xef74('0x3b')](_0x1b2603[_0xef74('0x32')][_0xef74('0x3b')]);_0x3fc603[_0xef74('0x3c')]=qs['filters'](_[_0xef74('0x3d')](_0x1b2603[_0xef74('0x32')],_0x591bea[_0xef74('0x34')]),_0x3240b7);if(_0x1b2603[_0xef74('0x32')][_0xef74('0x3e')]){_0x3fc603['where']=_[_0xef74('0x3f')](_0x3fc603[_0xef74('0x3c')],{'$or':_[_0xef74('0x2c')](_0x3240b7,function(_0x4c12f3){if(_0x4c12f3[_0xef74('0x40')]!==_0xef74('0x41')){var _0x26a1c3={};_0x26a1c3[_0x4c12f3[_0xef74('0x2a')]]={'$like':'%'+_0x1b2603[_0xef74('0x32')][_0xef74('0x3e')]+'%'};return _0x26a1c3;}})});}_0x3fc603=_[_0xef74('0x3f')]({},_0x3fc603,_0x1b2603['options']);var _0x5e569c={'where':_0x3fc603['where']};return db[_0xef74('0x2d')][_0xef74('0x20')](_0x5e569c)['then'](function(_0x1f60bf){_0x5415d5['count']=_0x1f60bf;if(_0x1b2603[_0xef74('0x32')][_0xef74('0x42')]){_0x3fc603[_0xef74('0x43')]=[{'all':!![]}];}return db[_0xef74('0x2d')]['findAll'](_0x3fc603);})['then'](function(_0x16c07a){_0x5415d5['rows']=_0x16c07a;return _0x5415d5;})[_0xef74('0x27')](respondWithFilteredResult(_0x36bab2,_0x3fc603))[_0xef74('0x44')](handleError(_0x36bab2,null));}; \ No newline at end of file +var _0x00b3=['findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send','index','map','Migration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','includeAll','include'];(function(_0x4a3fc0,_0x1b0cf3){var _0x273b8d=function(_0x462a3b){while(--_0x462a3b){_0x4a3fc0['push'](_0x4a3fc0['shift']());}};_0x273b8d(++_0x1b0cf3);}(_0x00b3,0x157));var _0x300b=function(_0x2959df,_0x410deb){_0x2959df=_0x2959df-0x0;var _0x3c441b=_0x00b3[_0x2959df];return _0x3c441b;};'use strict';var emlformat=require(_0x300b('0x0'));var rimraf=require(_0x300b('0x1'));var zipdir=require(_0x300b('0x2'));var jsonpatch=require(_0x300b('0x3'));var rp=require(_0x300b('0x4'));var moment=require(_0x300b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x300b('0x6'));var util=require(_0x300b('0x7'));var path=require('path');var sox=require(_0x300b('0x8'));var csv=require('to-csv');var ejs=require(_0x300b('0x9'));var fs=require('fs');var fs_extra=require(_0x300b('0xa'));var _=require(_0x300b('0xb'));var squel=require(_0x300b('0xc'));var crypto=require(_0x300b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x300b('0xe'));var toCsv=require(_0x300b('0xf'));var querystring=require(_0x300b('0x10'));var Papa=require(_0x300b('0x11'));var Redis=require(_0x300b('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x300b('0x13'));var hardwareService=require(_0x300b('0x14'));var logger=require('../../config/logger')(_0x300b('0x15'));var utils=require(_0x300b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x300b('0x17'));var db=require(_0x300b('0x18'))['db'];function respondWithStatusCode(_0x68bfc0,_0x2e176a){_0x2e176a=_0x2e176a||0xcc;return function(_0x1f051c){if(_0x1f051c){return _0x68bfc0[_0x300b('0x19')](_0x2e176a);}return _0x68bfc0[_0x300b('0x1a')](_0x2e176a)[_0x300b('0x1b')]();};}function respondWithResult(_0x5790ac,_0x5be1d8){_0x5be1d8=_0x5be1d8||0xc8;return function(_0x4a2cd6){if(_0x4a2cd6){return _0x5790ac[_0x300b('0x1a')](_0x5be1d8)[_0x300b('0x1c')](_0x4a2cd6);}};}function respondWithFilteredResult(_0x5394c9,_0x4c0cac){return function(_0x2958ac){if(_0x2958ac){var _0x38685b=typeof _0x4c0cac[_0x300b('0x1d')]===_0x300b('0x1e')&&typeof _0x4c0cac[_0x300b('0x1f')]===_0x300b('0x1e');var _0x1b1b7a=_0x2958ac[_0x300b('0x20')];var _0x5be041=_0x38685b?0x0:_0x4c0cac[_0x300b('0x1d')];var _0x3860ab=_0x38685b?_0x2958ac[_0x300b('0x20')]:_0x4c0cac[_0x300b('0x1d')]+_0x4c0cac[_0x300b('0x1f')];var _0x333916;if(_0x3860ab>=_0x1b1b7a){_0x3860ab=_0x1b1b7a;_0x333916=0xc8;}else{_0x333916=0xce;}_0x5394c9['status'](_0x333916);return _0x5394c9[_0x300b('0x21')]('Content-Range',_0x5be041+'-'+_0x3860ab+'/'+_0x1b1b7a)[_0x300b('0x1c')](_0x2958ac);}return null;};}function patchUpdates(_0x4491da){return function(_0x4b9129){try{jsonpatch[_0x300b('0x22')](_0x4b9129,_0x4491da,!![]);}catch(_0x5e1895){return BPromise[_0x300b('0x23')](_0x5e1895);}return _0x4b9129['save']();};}function saveUpdates(_0x46bb84,_0x1f54ee){return function(_0x59f7fc){if(_0x59f7fc){return _0x59f7fc[_0x300b('0x24')](_0x46bb84)[_0x300b('0x25')](function(_0x532980){return _0x532980;});}return null;};}function removeEntity(_0x6c122c,_0x516c25){return function(_0x429094){if(_0x429094){return _0x429094[_0x300b('0x26')]()[_0x300b('0x25')](function(){_0x6c122c[_0x300b('0x1a')](0xcc)[_0x300b('0x1b')]();});}};}function handleEntityNotFound(_0x29ba9e,_0x1c0a8d){return function(_0x55c2ca){if(!_0x55c2ca){_0x29ba9e[_0x300b('0x19')](0x194);}return _0x55c2ca;};}function handleError(_0x210687,_0x52b31c){_0x52b31c=_0x52b31c||0x1f4;return function(_0x42913a){logger['error'](_0x42913a[_0x300b('0x27')]);if(_0x42913a[_0x300b('0x28')]){delete _0x42913a[_0x300b('0x28')];}_0x210687[_0x300b('0x1a')](_0x52b31c)[_0x300b('0x29')](_0x42913a);};}exports[_0x300b('0x2a')]=function(_0x2ef468,_0x4b074c){var _0xc7858f={},_0x395066={},_0x12b2b8={'count':0x0,'rows':[]};var _0x19d303=_[_0x300b('0x2b')](db[_0x300b('0x2c')]['rawAttributes'],function(_0x2297bd){return{'name':_0x2297bd[_0x300b('0x2d')],'type':_0x2297bd[_0x300b('0x2e')][_0x300b('0x2f')]};});_0x395066[_0x300b('0x30')]=_['map'](_0x19d303,_0x300b('0x28'));_0x395066[_0x300b('0x31')]=_[_0x300b('0x32')](_0x2ef468[_0x300b('0x31')]);_0x395066[_0x300b('0x33')]=_['intersection'](_0x395066[_0x300b('0x30')],_0x395066[_0x300b('0x31')]);_0xc7858f[_0x300b('0x34')]=_[_0x300b('0x35')](_0x395066[_0x300b('0x30')],qs[_0x300b('0x36')](_0x2ef468[_0x300b('0x31')]['fields']));_0xc7858f['attributes']=_0xc7858f[_0x300b('0x34')]['length']?_0xc7858f[_0x300b('0x34')]:_0x395066['model'];if(!_0x2ef468['query'][_0x300b('0x37')](_0x300b('0x38'))){_0xc7858f['limit']=qs[_0x300b('0x1f')](_0x2ef468['query'][_0x300b('0x1f')]);_0xc7858f[_0x300b('0x1d')]=qs['offset'](_0x2ef468[_0x300b('0x31')]['offset']);}_0xc7858f['order']=qs[_0x300b('0x39')](_0x2ef468['query'][_0x300b('0x39')]);_0xc7858f[_0x300b('0x3a')]=qs[_0x300b('0x33')](_[_0x300b('0x3b')](_0x2ef468[_0x300b('0x31')],_0x395066['filters']),_0x19d303);if(_0x2ef468[_0x300b('0x31')]['filter']){_0xc7858f[_0x300b('0x3a')]=_['merge'](_0xc7858f[_0x300b('0x3a')],{'$or':_[_0x300b('0x2b')](_0x19d303,function(_0x4daafc){if(_0x4daafc[_0x300b('0x2e')]!==_0x300b('0x3c')){var _0x484333={};_0x484333[_0x4daafc['name']]={'$like':'%'+_0x2ef468[_0x300b('0x31')][_0x300b('0x3d')]+'%'};return _0x484333;}})});}_0xc7858f=_[_0x300b('0x3e')]({},_0xc7858f,_0x2ef468['options']);var _0x148dac={'where':_0xc7858f[_0x300b('0x3a')]};return db[_0x300b('0x2c')][_0x300b('0x20')](_0x148dac)['then'](function(_0x3b03c0){_0x12b2b8['count']=_0x3b03c0;if(_0x2ef468[_0x300b('0x31')][_0x300b('0x3f')]){_0xc7858f[_0x300b('0x40')]=[{'all':!![]}];}return db[_0x300b('0x2c')][_0x300b('0x41')](_0xc7858f);})[_0x300b('0x25')](function(_0x506725){_0x12b2b8[_0x300b('0x42')]=_0x506725;return _0x12b2b8;})[_0x300b('0x25')](respondWithFilteredResult(_0x4b074c,_0xc7858f))[_0x300b('0x43')](handleError(_0x4b074c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 07cad21..3690a52 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 _0x5bc6=['define','Migration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x465437,_0xeaa60f){var _0x409378=function(_0x15a267){while(--_0x15a267){_0x465437['push'](_0x465437['shift']());}};_0x409378(++_0xeaa60f);}(_0x5bc6,0x18e));var _0x65bc=function(_0x8f10f2,_0x33a7e4){_0x8f10f2=_0x8f10f2-0x0;var _0x1690c8=_0x5bc6[_0x8f10f2];return _0x1690c8;};'use strict';var _=require(_0x65bc('0x0'));var util=require(_0x65bc('0x1'));var logger=require('../../config/logger')(_0x65bc('0x2'));var moment=require(_0x65bc('0x3'));var BPromise=require(_0x65bc('0x4'));var rp=require(_0x65bc('0x5'));var fs=require('fs');var path=require(_0x65bc('0x6'));var rimraf=require(_0x65bc('0x7'));var config=require(_0x65bc('0x8'));var attributes=require(_0x65bc('0x9'));module['exports']=function(_0x4c0743,_0x2ba8cc){return _0x4c0743[_0x65bc('0xa')](_0x65bc('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63e6=['../../config/environment','./migration.attributes','exports','Migration','migrations','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1f8b33,_0xe9837){var _0x25f78e=function(_0x54ca55){while(--_0x54ca55){_0x1f8b33['push'](_0x1f8b33['shift']());}};_0x25f78e(++_0xe9837);}(_0x63e6,0xd7));var _0x663e=function(_0x33fa69,_0x284b92){_0x33fa69=_0x33fa69-0x0;var _0x2a8585=_0x63e6[_0x33fa69];return _0x2a8585;};'use strict';var _=require('lodash');var util=require(_0x663e('0x0'));var logger=require(_0x663e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x663e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x663e('0x3'));var rimraf=require(_0x663e('0x4'));var config=require(_0x663e('0x5'));var attributes=require(_0x663e('0x6'));module[_0x663e('0x7')]=function(_0x597041,_0x1fd73f){return _0x597041['define'](_0x663e('0x8'),attributes,{'tableName':_0x663e('0x9'),'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 342b852..b021568 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 _0x65b3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x4e6e8f,_0x5aa5b0){var _0x1dfe8a=function(_0x5bf755){while(--_0x5bf755){_0x4e6e8f['push'](_0x4e6e8f['shift']());}};_0x1dfe8a(++_0x5aa5b0);}(_0x65b3,0xc6));var _0x365b=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0x65b3[_0x4eaa4c];return _0x15aec6;};'use strict';var _=require(_0x365b('0x0'));var util=require(_0x365b('0x1'));var moment=require(_0x365b('0x2'));var BPromise=require(_0x365b('0x3'));var rs=require(_0x365b('0x4'));var fs=require('fs');var Redis=require(_0x365b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x365b('0x6'));var logger=require(_0x365b('0x7'))(_0x365b('0x8'));var config=require('../../config/environment');var jayson=require(_0x365b('0x9'));var client=jayson[_0x365b('0xa')][_0x365b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b7869,_0x160565,_0xe6670a){return new BPromise(function(_0x2ed50a,_0x3f95c1){return client[_0x365b('0xc')](_0x5b7869,_0xe6670a)['then'](function(_0x36afc2){logger[_0x365b('0xd')](_0x365b('0xe'),_0x160565,_0x365b('0xf'));logger[_0x365b('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x160565,_0x365b('0xf'),JSON[_0x365b('0x11')](_0x36afc2));if(_0x36afc2[_0x365b('0x12')]){if(_0x36afc2[_0x365b('0x12')]['code']===0x1f4){logger['error'](_0x365b('0xe'),_0x160565,_0x36afc2[_0x365b('0x12')][_0x365b('0x13')]);return _0x3f95c1(_0x36afc2['error'][_0x365b('0x13')]);}logger['error'](_0x365b('0xe'),_0x160565,_0x36afc2[_0x365b('0x12')][_0x365b('0x13')]);return _0x2ed50a(_0x36afc2[_0x365b('0x12')][_0x365b('0x13')]);}else{logger[_0x365b('0xd')](_0x365b('0xe'),_0x160565,_0x365b('0xf'));_0x2ed50a(_0x36afc2[_0x365b('0x14')][_0x365b('0x13')]);}})[_0x365b('0x15')](function(_0x13403b){logger[_0x365b('0x12')](_0x365b('0xe'),_0x160565,_0x13403b);_0x3f95c1(_0x13403b);});});} \ No newline at end of file +var _0x3a25=['then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2c0d2d,_0x251755){var _0x19fdbd=function(_0x262994){while(--_0x262994){_0x2c0d2d['push'](_0x2c0d2d['shift']());}};_0x19fdbd(++_0x251755);}(_0x3a25,0x15d));var _0x53a2=function(_0x2c3744,_0x5be606){_0x2c3744=_0x2c3744-0x0;var _0x9aab7d=_0x3a25[_0x2c3744];return _0x9aab7d;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var rs=require(_0x53a2('0x4'));var fs=require('fs');var Redis=require(_0x53a2('0x5'));var db=require(_0x53a2('0x6'))['db'];var utils=require(_0x53a2('0x7'));var logger=require(_0x53a2('0x8'))(_0x53a2('0x9'));var config=require(_0x53a2('0xa'));var jayson=require(_0x53a2('0xb'));var client=jayson[_0x53a2('0xc')][_0x53a2('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409fff,_0x4d53b8,_0x3ee956){return new BPromise(function(_0x5dc70e,_0x17aa09){return client[_0x53a2('0xe')](_0x409fff,_0x3ee956)[_0x53a2('0xf')](function(_0x42bf42){logger[_0x53a2('0x10')](_0x53a2('0x11'),_0x4d53b8,_0x53a2('0x12'));logger[_0x53a2('0x13')](_0x53a2('0x14'),_0x4d53b8,_0x53a2('0x12'),JSON['stringify'](_0x42bf42));if(_0x42bf42['error']){if(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x16')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x17aa09(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}logger['error']('Migration,\x20%s,\x20%s',_0x4d53b8,_0x42bf42['error'][_0x53a2('0x17')]);return _0x5dc70e(_0x42bf42[_0x53a2('0x15')][_0x53a2('0x17')]);}else{logger[_0x53a2('0x10')]('Migration,\x20%s,\x20%s',_0x4d53b8,_0x53a2('0x12'));_0x5dc70e(_0x42bf42[_0x53a2('0x18')][_0x53a2('0x17')]);}})[_0x53a2('0x19')](function(_0x34c7de){logger['error']('Migration,\x20%s,\x20%s',_0x4d53b8,_0x34c7de);_0x17aa09(_0x34c7de);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 44b4536..ad41d3d 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 _0x8969=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','index','get','/:id','show','post','isAuthenticated','put'];(function(_0x1e8f9e,_0x148061){var _0x2cec83=function(_0x55d9ee){while(--_0x55d9ee){_0x1e8f9e['push'](_0x1e8f9e['shift']());}};_0x2cec83(++_0x148061);}(_0x8969,0x130));var _0x9896=function(_0x493d55,_0x2c9ebc){_0x493d55=_0x493d55-0x0;var _0x4cf64f=_0x8969[_0x493d55];return _0x4cf64f;};'use strict';var multer=require(_0x9896('0x0'));var util=require('util');var path=require(_0x9896('0x1'));var timeout=require(_0x9896('0x2'));var express=require(_0x9896('0x3'));var router=express[_0x9896('0x4')]();var fs_extra=require(_0x9896('0x5'));var auth=require(_0x9896('0x6'));var interaction=require(_0x9896('0x7'));var config=require('../../config/environment');var controller=require(_0x9896('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9896('0x9')]);router[_0x9896('0xa')](_0x9896('0xb'),auth['isAuthenticated'](),controller[_0x9896('0xc')]);router[_0x9896('0xd')]('/',auth[_0x9896('0xe')](),controller['create']);router[_0x9896('0xf')](_0x9896('0xb'),auth['isAuthenticated'](),controller[_0x9896('0x10')]);router[_0x9896('0x11')]('/:id',auth[_0x9896('0xe')](),controller[_0x9896('0x12')]);module[_0x9896('0x13')]=router; \ No newline at end of file +var _0xbe54=['update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','./network.controller','isAuthenticated','index','get','show','post','create','put'];(function(_0x5be3cc,_0x3b5c7d){var _0x1162a2=function(_0x1db04c){while(--_0x1db04c){_0x5be3cc['push'](_0x5be3cc['shift']());}};_0x1162a2(++_0x3b5c7d);}(_0xbe54,0x9e));var _0x4be5=function(_0x16efb1,_0x2ff68b){_0x16efb1=_0x16efb1-0x0;var _0x10c0cc=_0xbe54[_0x16efb1];return _0x10c0cc;};'use strict';var multer=require(_0x4be5('0x0'));var util=require(_0x4be5('0x1'));var path=require('path');var timeout=require(_0x4be5('0x2'));var express=require('express');var router=express[_0x4be5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4be5('0x4'));router['get']('/',auth[_0x4be5('0x5')](),controller[_0x4be5('0x6')]);router[_0x4be5('0x7')]('/:id',auth[_0x4be5('0x5')](),controller[_0x4be5('0x8')]);router[_0x4be5('0x9')]('/',auth[_0x4be5('0x5')](),controller[_0x4be5('0xa')]);router[_0x4be5('0xb')]('/:id',auth[_0x4be5('0x5')](),controller[_0x4be5('0xc')]);router[_0x4be5('0xd')](_0x4be5('0xe'),auth[_0x4be5('0x5')](),controller[_0x4be5('0xf')]);module[_0x4be5('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 458fdf9..a8d4652 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 _0xce38=['ENUM','localnet','externip','stun','STRING','sequelize','exports'];(function(_0x3a2d9f,_0x4f25c8){var _0x378d5d=function(_0x401c37){while(--_0x401c37){_0x3a2d9f['push'](_0x3a2d9f['shift']());}};_0x378d5d(++_0x4f25c8);}(_0xce38,0x7c));var _0x8ce3=function(_0x1829c6,_0x4d98fd){_0x1829c6=_0x1829c6-0x0;var _0x19a7a0=_0xce38[_0x1829c6];return _0x19a7a0;};'use strict';var Sequelize=require(_0x8ce3('0x0'));module[_0x8ce3('0x1')]={'type':{'type':Sequelize[_0x8ce3('0x2')](_0x8ce3('0x3'),_0x8ce3('0x4'),_0x8ce3('0x5'),'turn')},'value':{'type':Sequelize[_0x8ce3('0x6')]},'username':{'type':Sequelize[_0x8ce3('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdafe=['sequelize','exports','ENUM','localnet','turn','STRING'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0xdafe,0x7e));var _0xedaf=function(_0x47c42e,_0x4bc238){_0x47c42e=_0x47c42e-0x0;var _0x57e9d2=_0xdafe[_0x47c42e];return _0x57e9d2;};'use strict';var Sequelize=require(_0xedaf('0x0'));module[_0xedaf('0x1')]={'type':{'type':Sequelize[_0xedaf('0x2')](_0xedaf('0x3'),'externip','stun',_0xedaf('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xedaf('0x5')]},'password':{'type':Sequelize[_0xedaf('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index a40ca08..c6a32a4 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 _0x37f2=['util','../../components/parsers/qs','../../config/logger','api','jayson/promise','request','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','status','json','undefined','count','offset','limit','set','update','destroy','end','stack','name','send','index','Network','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','VIRTUAL','options','rows','show','includeAll','include','create','body','findAll','toUpperCase','STUN','readFileSync','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','params','server/files/templates/stun_multiple.ejs'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x37f2,0x1ec));var _0x237f=function(_0xb48347,_0x2a3fd9){_0xb48347=_0xb48347-0x0;var _0x1c1a99=_0x37f2[_0xb48347];return _0x1c1a99;};'use strict';var util=require(_0x237f('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0x237f('0x1'));var logger=require(_0x237f('0x2'))(_0x237f('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x237f('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9011,_0x322879,_0x119069,_0x12f9e9){return new Promise(function(_0x42e0c2,_0x270f75){var _0x2614be=_0x12f9e9||client;return _0x2614be[_0x237f('0x5')](_0x1b9011,_0x119069)[_0x237f('0x6')](function(_0x2a6482){logger[_0x237f('0x7')](_0x237f('0x8'),_0x322879,'request\x20sent');logger['debug'](_0x237f('0x9'),_0x322879,'request\x20sent',JSON['stringify'](_0x2a6482));if(_0x2a6482['error']){if(_0x2a6482[_0x237f('0xa')][_0x237f('0xb')]===0x1f4){logger[_0x237f('0xa')]('Network,\x20%s,\x20%s',_0x322879,_0x2a6482[_0x237f('0xa')][_0x237f('0xc')]);return _0x270f75(_0x2a6482['error']['message']);}logger['error'](_0x237f('0x8'),_0x322879,_0x2a6482[_0x237f('0xa')][_0x237f('0xc')]);return _0x42e0c2(_0x2a6482[_0x237f('0xa')][_0x237f('0xc')]);}else{logger[_0x237f('0x7')](_0x237f('0x8'),_0x322879,_0x237f('0xd'));_0x42e0c2(_0x2a6482[_0x237f('0xe')][_0x237f('0xc')]);}})[_0x237f('0xf')](function(_0x49f920){logger[_0x237f('0xa')](_0x237f('0x8'),_0x322879,_0x49f920);_0x270f75(_0x49f920);});});}function respondWithResult(_0x2a11e0,_0x7af897){_0x7af897=_0x7af897||0xc8;return function(_0x4f59bd){if(_0x4f59bd){return _0x2a11e0[_0x237f('0x10')](_0x7af897)[_0x237f('0x11')](_0x4f59bd);}};}function respondWithFilteredResult(_0x5db588,_0x20c62c){return function(_0x232b17){if(_0x232b17){var _0x400c56=typeof _0x20c62c['offset']===_0x237f('0x12')&&typeof _0x20c62c['limit']===_0x237f('0x12');var _0x19b70c=_0x232b17[_0x237f('0x13')];var _0x4110b0=_0x400c56?0x0:_0x20c62c[_0x237f('0x14')];var _0x3b7903=_0x400c56?_0x232b17[_0x237f('0x13')]:_0x20c62c['offset']+_0x20c62c[_0x237f('0x15')];var _0x3660b8;if(_0x3b7903>=_0x19b70c){_0x3b7903=_0x19b70c;_0x3660b8=0xc8;}else{_0x3660b8=0xce;}_0x5db588[_0x237f('0x10')](_0x3660b8);return _0x5db588[_0x237f('0x16')]('Content-Range',_0x4110b0+'-'+_0x3b7903+'/'+_0x19b70c)[_0x237f('0x11')](_0x232b17);}return null;};}function saveUpdates(_0x388556){return function(_0x5f4d4e){if(_0x5f4d4e){return _0x5f4d4e[_0x237f('0x17')](_0x388556)[_0x237f('0x6')](function(_0x2727ba){return _0x2727ba;});}return null;};}function removeEntity(_0x224bf9){return function(_0x1ff058){if(_0x1ff058){return _0x1ff058[_0x237f('0x18')]()[_0x237f('0x6')](function(){_0x224bf9[_0x237f('0x10')](0xcc)[_0x237f('0x19')]();});}};}function handleEntityNotFound(_0x5bc3c8){return function(_0x2decae){if(!_0x2decae){_0x5bc3c8['sendStatus'](0x194);}return _0x2decae;};}function handleError(_0x71f4c1,_0x46e9d2){_0x46e9d2=_0x46e9d2||0x1f4;return function(_0xcb963a){logger[_0x237f('0xa')](_0xcb963a[_0x237f('0x1a')]);if(_0xcb963a[_0x237f('0x1b')]){delete _0xcb963a[_0x237f('0x1b')];}_0x71f4c1['status'](_0x46e9d2)[_0x237f('0x1c')](_0xcb963a);};}exports[_0x237f('0x1d')]=function(_0xf7f8b2,_0x1366aa){var _0x4fe715={},_0x5360cd={},_0x23834b={'count':0x0,'rows':[]};var _0x3eb4e4=_['map'](db[_0x237f('0x1e')][_0x237f('0x1f')],function(_0x2c5860){return{'name':_0x2c5860[_0x237f('0x20')],'type':_0x2c5860[_0x237f('0x21')][_0x237f('0x22')]};});_0x5360cd[_0x237f('0x23')]=_['map'](_0x3eb4e4,_0x237f('0x1b'));_0x5360cd[_0x237f('0x24')]=_[_0x237f('0x25')](_0xf7f8b2[_0x237f('0x24')]);_0x5360cd[_0x237f('0x26')]=_[_0x237f('0x27')](_0x5360cd[_0x237f('0x23')],_0x5360cd[_0x237f('0x24')]);_0x4fe715['attributes']=_[_0x237f('0x27')](_0x5360cd[_0x237f('0x23')],qs[_0x237f('0x28')](_0xf7f8b2[_0x237f('0x24')][_0x237f('0x28')]));_0x4fe715[_0x237f('0x29')]=_0x4fe715[_0x237f('0x29')][_0x237f('0x2a')]?_0x4fe715['attributes']:_0x5360cd[_0x237f('0x23')];if(!_0xf7f8b2['query'][_0x237f('0x2b')](_0x237f('0x2c'))){_0x4fe715['limit']=qs[_0x237f('0x15')](_0xf7f8b2[_0x237f('0x24')]['limit']);_0x4fe715[_0x237f('0x14')]=qs[_0x237f('0x14')](_0xf7f8b2[_0x237f('0x24')]['offset']);}_0x4fe715[_0x237f('0x2d')]=qs[_0x237f('0x2e')](_0xf7f8b2['query'][_0x237f('0x2e')]);_0x4fe715['where']=qs[_0x237f('0x26')](_['pick'](_0xf7f8b2[_0x237f('0x24')],_0x5360cd[_0x237f('0x26')]),_0x3eb4e4);if(_0xf7f8b2[_0x237f('0x24')][_0x237f('0x2f')]){_0x4fe715[_0x237f('0x30')]=_[_0x237f('0x31')](_0x4fe715['where'],{'$or':_[_0x237f('0x32')](_0x3eb4e4,function(_0x4eb11e){if(_0x4eb11e[_0x237f('0x21')]!==_0x237f('0x33')){var _0x551ae5={};_0x551ae5[_0x4eb11e[_0x237f('0x1b')]]={'$like':'%'+_0xf7f8b2[_0x237f('0x24')][_0x237f('0x2f')]+'%'};return _0x551ae5;}})});}_0x4fe715=_[_0x237f('0x31')]({},_0x4fe715,_0xf7f8b2[_0x237f('0x34')]);var _0x369ad9={'where':_0x4fe715[_0x237f('0x30')]};return db['Network'][_0x237f('0x13')](_0x369ad9)[_0x237f('0x6')](function(_0x33eba4){_0x23834b[_0x237f('0x13')]=_0x33eba4;if(_0xf7f8b2[_0x237f('0x24')]['includeAll']){_0x4fe715['include']=[{'all':!![]}];}return db['Network']['findAll'](_0x4fe715);})[_0x237f('0x6')](function(_0x162625){_0x23834b[_0x237f('0x35')]=_0x162625;return _0x23834b;})[_0x237f('0x6')](respondWithFilteredResult(_0x1366aa,_0x4fe715))[_0x237f('0xf')](handleError(_0x1366aa,null));};exports[_0x237f('0x36')]=function(_0x436509,_0x6a6c7a){var _0x5b6134={'raw':!![],'where':{'id':_0x436509['params']['id']}},_0x47ade3={};_0x47ade3['model']=_[_0x237f('0x25')](db[_0x237f('0x1e')][_0x237f('0x1f')]);_0x47ade3[_0x237f('0x24')]=_[_0x237f('0x25')](_0x436509[_0x237f('0x24')]);_0x47ade3[_0x237f('0x26')]=_[_0x237f('0x27')](_0x47ade3[_0x237f('0x23')],_0x47ade3[_0x237f('0x24')]);_0x5b6134[_0x237f('0x29')]=_[_0x237f('0x27')](_0x47ade3['model'],qs['fields'](_0x436509[_0x237f('0x24')][_0x237f('0x28')]));_0x5b6134[_0x237f('0x29')]=_0x5b6134['attributes'][_0x237f('0x2a')]?_0x5b6134['attributes']:_0x47ade3[_0x237f('0x23')];if(_0x436509[_0x237f('0x24')][_0x237f('0x37')]){_0x5b6134[_0x237f('0x38')]=[{'all':!![]}];}_0x5b6134=_[_0x237f('0x31')]({},_0x5b6134,_0x436509[_0x237f('0x34')]);return db[_0x237f('0x1e')]['find'](_0x5b6134)['then'](handleEntityNotFound(_0x6a6c7a,null))['then'](respondWithResult(_0x6a6c7a,null))[_0x237f('0xf')](handleError(_0x6a6c7a,null));};exports['create']=function(_0x3bc3de,_0x30cc12){var _0x30469c;return db[_0x237f('0x1e')][_0x237f('0x39')](_0x3bc3de[_0x237f('0x3a')],{'raw':!![]})[_0x237f('0x6')](function(_0x1919a2){_0x30469c=_0x1919a2;return db['Network'][_0x237f('0x3b')]({'where':{'type':_0x3bc3de[_0x237f('0x3a')]['type']},'raw':!![]});})[_0x237f('0x6')](function(_0x513448){if(_0x30469c[_0x237f('0x21')][_0x237f('0x3c')]()==_0x237f('0x3d')){var _0x5f07f7=fs[_0x237f('0x3e')](path['join'](config[_0x237f('0x3f')],'server/files/templates/stun_multiple.ejs'),_0x237f('0x40'));var _0x49afd6=ejs['render'](_0x5f07f7,{'networks':_0x513448||[]});fs[_0x237f('0x41')](_0x237f('0x42'),_0x49afd6);return respondWithRpcPromise(_0x237f('0x43'),_0x237f('0x39'),{'module':_0x237f('0x44')});}else if(_0x30469c['type'][_0x237f('0x3c')]()==_0x237f('0x45')){var _0x36f328=fs[_0x237f('0x3e')](path['join'](config[_0x237f('0x3f')],_0x237f('0x46')),_0x237f('0x40'));var _0x2015d2=ejs[_0x237f('0x47')](_0x36f328,{'networks':_0x513448||[]});fs['writeFileSync'](_0x237f('0x48'),_0x2015d2);return respondWithRpcPromise(_0x237f('0x43'),_0x237f('0x39'),{'module':_0x237f('0x44')});}else{var _0xbc7ce9=fs[_0x237f('0x3e')](path[_0x237f('0x49')](config[_0x237f('0x3f')],_0x237f('0x4a')),_0x237f('0x40'));var _0x55944b=ejs[_0x237f('0x47')](_0xbc7ce9,{'networks':_0x513448||[]});fs[_0x237f('0x41')](util[_0x237f('0x4b')](_0x237f('0x4c'),_0x3bc3de[_0x237f('0x3a')][_0x237f('0x21')][_0x237f('0x4d')]()),_0x55944b);return respondWithRpcPromise('Reload',_0x237f('0x39'),{'module':_0x237f('0x4e')});}})['then'](function(){return _0x30469c;})[_0x237f('0x6')](respondWithResult(_0x30cc12,0xc9))[_0x237f('0xf')](handleError(_0x30cc12,null));};exports[_0x237f('0x17')]=function(_0x59b454,_0x2ce5ce){var _0x13f063;return db[_0x237f('0x1e')][_0x237f('0x4f')]({'where':{'id':_0x59b454[_0x237f('0x50')]['id']}})[_0x237f('0x6')](handleEntityNotFound(_0x2ce5ce,null))[_0x237f('0x6')](saveUpdates(_0x59b454['body'],null))[_0x237f('0x6')](function(_0x10ce11){if(_0x10ce11){_0x13f063=_0x10ce11;return db['Network'][_0x237f('0x3b')]({'where':{'type':_0x13f063[_0x237f('0x21')]},'raw':!![]});}return null;})[_0x237f('0x6')](function(_0x45ea6f){if(_0x13f063[_0x237f('0x21')][_0x237f('0x3c')]()==_0x237f('0x3d')){var _0x3e22d2=fs[_0x237f('0x3e')](path[_0x237f('0x49')](config[_0x237f('0x3f')],_0x237f('0x51')),'utf8');var _0x1a0ccf=ejs['render'](_0x3e22d2,{'networks':_0x45ea6f||[]});fs['writeFileSync'](_0x237f('0x42'),_0x1a0ccf);return respondWithRpcPromise(_0x237f('0x43'),_0x237f('0x17'),{'module':_0x237f('0x44')});}else if(_0x13f063['type'][_0x237f('0x3c')]()==_0x237f('0x45')){var _0x3f2fdf=fs['readFileSync'](path['join'](config[_0x237f('0x3f')],_0x237f('0x46')),_0x237f('0x40'));var _0x2a3304=ejs['render'](_0x3f2fdf,{'networks':_0x45ea6f||[]});fs[_0x237f('0x41')](_0x237f('0x48'),_0x2a3304);return respondWithRpcPromise(_0x237f('0x43'),_0x237f('0x17'),{'module':'res_stun_monitor.so'});}else{var _0x223e05=fs[_0x237f('0x3e')](path['join'](config['root'],_0x237f('0x4a')),_0x237f('0x40'));var _0x31bc73=ejs[_0x237f('0x47')](_0x223e05,{'networks':_0x45ea6f||[]});fs[_0x237f('0x41')](util[_0x237f('0x4b')](_0x237f('0x4c'),_0x59b454[_0x237f('0x3a')][_0x237f('0x21')][_0x237f('0x4d')]()),_0x31bc73);return respondWithRpcPromise('Reload',_0x237f('0x17'),{'module':_0x237f('0x4e')});}})[_0x237f('0x6')](function(_0x37989a){if(_0x37989a){return _0x13f063;}return null;})['then'](respondWithResult(_0x2ce5ce,null))[_0x237f('0xf')](handleError(_0x2ce5ce,null));};exports[_0x237f('0x18')]=function(_0x2817f4,_0x125214){var _0x2a3196;return db[_0x237f('0x1e')][_0x237f('0x4f')]({'where':{'id':_0x2817f4['params']['id']}})[_0x237f('0x6')](function(_0x115d0c){_0x2a3196=_0x115d0c;return _0x115d0c;})[_0x237f('0x6')](handleEntityNotFound(_0x125214,null))[_0x237f('0x6')](removeEntity(_0x125214,null))[_0x237f('0x6')](function(){if(_0x2a3196){return db[_0x237f('0x1e')][_0x237f('0x3b')]({'where':{'type':_0x2a3196[_0x237f('0x21')]},'raw':!![]});}})[_0x237f('0x6')](function(_0x24a540){if(_0x2a3196[_0x237f('0x21')]['toUpperCase']()=='STUN'){var _0x1efadd=fs[_0x237f('0x3e')](path[_0x237f('0x49')](config[_0x237f('0x3f')],'server/files/templates/stun_multiple.ejs'),_0x237f('0x40'));var _0x1475e6=ejs[_0x237f('0x47')](_0x1efadd,{'networks':_0x24a540||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1475e6);return respondWithRpcPromise('Reload',_0x237f('0x18'),{'module':'res_stun_monitor.so'});}else if(_0x2a3196[_0x237f('0x21')][_0x237f('0x3c')]()==_0x237f('0x45')){var _0x5affba=fs[_0x237f('0x3e')](path[_0x237f('0x49')](config['root'],_0x237f('0x46')),_0x237f('0x40'));var _0x99a48c=ejs['render'](_0x5affba,{'networks':_0x24a540||[]});fs[_0x237f('0x41')](_0x237f('0x48'),_0x99a48c);return respondWithRpcPromise(_0x237f('0x43'),_0x237f('0x18'),{'module':'res_stun_monitor.so'});}else{var _0x151bdd=fs[_0x237f('0x3e')](path[_0x237f('0x49')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x1ef6c6=ejs[_0x237f('0x47')](_0x151bdd,{'networks':_0x24a540||[]});fs[_0x237f('0x41')](util['format'](_0x237f('0x4c'),_0x2a3196['type'][_0x237f('0x4d')]()),_0x1ef6c6);return respondWithRpcPromise(_0x237f('0x43'),_0x237f('0x18'),{'module':_0x237f('0x4e')});}})[_0x237f('0xf')](handleError(_0x125214,null));}; \ No newline at end of file +var _0x29f6=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','include','rows','includeAll','find','create','body','findAll','toUpperCase','STUN','readFileSync','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','join','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','root','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','params','TURN','toLowerCase','chan_sip.so','format','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','Network','rawAttributes'];(function(_0x3dbae0,_0x5d0113){var _0x230df0=function(_0x3d7dec){while(--_0x3d7dec){_0x3dbae0['push'](_0x3dbae0['shift']());}};_0x230df0(++_0x5d0113);}(_0x29f6,0xd7));var _0x629f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x29f6[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x629f('0x0'));var path=require(_0x629f('0x1'));var ejs=require(_0x629f('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x629f('0x3'));var logger=require(_0x629f('0x4'))(_0x629f('0x5'));var config=require(_0x629f('0x6'));var db=require(_0x629f('0x7'))['db'];var jayson=require(_0x629f('0x8'));var client=jayson[_0x629f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b93e1,_0x251740,_0x5855f8,_0x281c80){return new Promise(function(_0x39a03f,_0x3b558b){var _0x4a512d=_0x281c80||client;return _0x4a512d['request'](_0x2b93e1,_0x5855f8)[_0x629f('0xa')](function(_0x5b2ed2){logger[_0x629f('0xb')](_0x629f('0xc'),_0x251740,_0x629f('0xd'));logger[_0x629f('0xe')](_0x629f('0xf'),_0x251740,_0x629f('0xd'),JSON[_0x629f('0x10')](_0x5b2ed2));if(_0x5b2ed2[_0x629f('0x11')]){if(_0x5b2ed2[_0x629f('0x11')][_0x629f('0x12')]===0x1f4){logger[_0x629f('0x11')]('Network,\x20%s,\x20%s',_0x251740,_0x5b2ed2[_0x629f('0x11')][_0x629f('0x13')]);return _0x3b558b(_0x5b2ed2[_0x629f('0x11')][_0x629f('0x13')]);}logger[_0x629f('0x11')]('Network,\x20%s,\x20%s',_0x251740,_0x5b2ed2['error'][_0x629f('0x13')]);return _0x39a03f(_0x5b2ed2[_0x629f('0x11')][_0x629f('0x13')]);}else{logger[_0x629f('0xb')](_0x629f('0xc'),_0x251740,_0x629f('0xd'));_0x39a03f(_0x5b2ed2[_0x629f('0x14')][_0x629f('0x13')]);}})[_0x629f('0x15')](function(_0x1717a6){logger[_0x629f('0x11')](_0x629f('0xc'),_0x251740,_0x1717a6);_0x3b558b(_0x1717a6);});});}function respondWithResult(_0x58a99a,_0x475160){_0x475160=_0x475160||0xc8;return function(_0x3a85fb){if(_0x3a85fb){return _0x58a99a[_0x629f('0x16')](_0x475160)[_0x629f('0x17')](_0x3a85fb);}};}function respondWithFilteredResult(_0x1b6da1,_0x357956){return function(_0x150a00){if(_0x150a00){var _0x2ddfb2=typeof _0x357956[_0x629f('0x18')]==='undefined'&&typeof _0x357956[_0x629f('0x19')]===_0x629f('0x1a');var _0x355060=_0x150a00[_0x629f('0x1b')];var _0x908aa8=_0x2ddfb2?0x0:_0x357956[_0x629f('0x18')];var _0x5ee9b3=_0x2ddfb2?_0x150a00[_0x629f('0x1b')]:_0x357956['offset']+_0x357956[_0x629f('0x19')];var _0x3ad281;if(_0x5ee9b3>=_0x355060){_0x5ee9b3=_0x355060;_0x3ad281=0xc8;}else{_0x3ad281=0xce;}_0x1b6da1['status'](_0x3ad281);return _0x1b6da1[_0x629f('0x1c')](_0x629f('0x1d'),_0x908aa8+'-'+_0x5ee9b3+'/'+_0x355060)['json'](_0x150a00);}return null;};}function saveUpdates(_0x607c8a){return function(_0x236d62){if(_0x236d62){return _0x236d62[_0x629f('0x1e')](_0x607c8a)['then'](function(_0x3376a7){return _0x3376a7;});}return null;};}function removeEntity(_0x8b5ad4){return function(_0x567473){if(_0x567473){return _0x567473[_0x629f('0x1f')]()[_0x629f('0xa')](function(){_0x8b5ad4[_0x629f('0x16')](0xcc)[_0x629f('0x20')]();});}};}function handleEntityNotFound(_0x105f08){return function(_0x3b8c36){if(!_0x3b8c36){_0x105f08[_0x629f('0x21')](0x194);}return _0x3b8c36;};}function handleError(_0x24b152,_0x477a37){_0x477a37=_0x477a37||0x1f4;return function(_0x157bec){logger[_0x629f('0x11')](_0x157bec[_0x629f('0x22')]);if(_0x157bec[_0x629f('0x23')]){delete _0x157bec['name'];}_0x24b152['status'](_0x477a37)[_0x629f('0x24')](_0x157bec);};}exports['index']=function(_0x19177e,_0x15edf2){var _0xf352c6={},_0x414fbc={},_0xc22967={'count':0x0,'rows':[]};var _0x39137a=_[_0x629f('0x25')](db[_0x629f('0x26')][_0x629f('0x27')],function(_0x43ad4d){return{'name':_0x43ad4d['fieldName'],'type':_0x43ad4d['type'][_0x629f('0x28')]};});_0x414fbc[_0x629f('0x29')]=_[_0x629f('0x25')](_0x39137a,_0x629f('0x23'));_0x414fbc[_0x629f('0x2a')]=_[_0x629f('0x2b')](_0x19177e[_0x629f('0x2a')]);_0x414fbc[_0x629f('0x2c')]=_[_0x629f('0x2d')](_0x414fbc[_0x629f('0x29')],_0x414fbc[_0x629f('0x2a')]);_0xf352c6['attributes']=_[_0x629f('0x2d')](_0x414fbc[_0x629f('0x29')],qs[_0x629f('0x2e')](_0x19177e[_0x629f('0x2a')]['fields']));_0xf352c6[_0x629f('0x2f')]=_0xf352c6['attributes']['length']?_0xf352c6['attributes']:_0x414fbc['model'];if(!_0x19177e['query'][_0x629f('0x30')]('nolimit')){_0xf352c6[_0x629f('0x19')]=qs['limit'](_0x19177e['query'][_0x629f('0x19')]);_0xf352c6['offset']=qs[_0x629f('0x18')](_0x19177e[_0x629f('0x2a')][_0x629f('0x18')]);}_0xf352c6[_0x629f('0x31')]=qs[_0x629f('0x32')](_0x19177e['query'][_0x629f('0x32')]);_0xf352c6[_0x629f('0x33')]=qs['filters'](_[_0x629f('0x34')](_0x19177e[_0x629f('0x2a')],_0x414fbc[_0x629f('0x2c')]),_0x39137a);if(_0x19177e[_0x629f('0x2a')]['filter']){_0xf352c6[_0x629f('0x33')]=_[_0x629f('0x35')](_0xf352c6['where'],{'$or':_[_0x629f('0x25')](_0x39137a,function(_0x2d708c){if(_0x2d708c[_0x629f('0x36')]!=='VIRTUAL'){var _0xf1166={};_0xf1166[_0x2d708c[_0x629f('0x23')]]={'$like':'%'+_0x19177e[_0x629f('0x2a')][_0x629f('0x37')]+'%'};return _0xf1166;}})});}_0xf352c6=_[_0x629f('0x35')]({},_0xf352c6,_0x19177e[_0x629f('0x38')]);var _0xa417a={'where':_0xf352c6[_0x629f('0x33')]};return db[_0x629f('0x26')][_0x629f('0x1b')](_0xa417a)['then'](function(_0x4de9fc){_0xc22967[_0x629f('0x1b')]=_0x4de9fc;if(_0x19177e[_0x629f('0x2a')]['includeAll']){_0xf352c6[_0x629f('0x39')]=[{'all':!![]}];}return db[_0x629f('0x26')]['findAll'](_0xf352c6);})[_0x629f('0xa')](function(_0x46a1c8){_0xc22967[_0x629f('0x3a')]=_0x46a1c8;return _0xc22967;})[_0x629f('0xa')](respondWithFilteredResult(_0x15edf2,_0xf352c6))[_0x629f('0x15')](handleError(_0x15edf2,null));};exports['show']=function(_0x1fcdfa,_0x4456e9){var _0x1d5f1c={'raw':!![],'where':{'id':_0x1fcdfa['params']['id']}},_0x418cd3={};_0x418cd3[_0x629f('0x29')]=_[_0x629f('0x2b')](db[_0x629f('0x26')][_0x629f('0x27')]);_0x418cd3[_0x629f('0x2a')]=_[_0x629f('0x2b')](_0x1fcdfa['query']);_0x418cd3[_0x629f('0x2c')]=_[_0x629f('0x2d')](_0x418cd3[_0x629f('0x29')],_0x418cd3[_0x629f('0x2a')]);_0x1d5f1c[_0x629f('0x2f')]=_[_0x629f('0x2d')](_0x418cd3['model'],qs[_0x629f('0x2e')](_0x1fcdfa['query'][_0x629f('0x2e')]));_0x1d5f1c[_0x629f('0x2f')]=_0x1d5f1c['attributes']['length']?_0x1d5f1c[_0x629f('0x2f')]:_0x418cd3[_0x629f('0x29')];if(_0x1fcdfa[_0x629f('0x2a')][_0x629f('0x3b')]){_0x1d5f1c[_0x629f('0x39')]=[{'all':!![]}];}_0x1d5f1c=_['merge']({},_0x1d5f1c,_0x1fcdfa[_0x629f('0x38')]);return db[_0x629f('0x26')][_0x629f('0x3c')](_0x1d5f1c)[_0x629f('0xa')](handleEntityNotFound(_0x4456e9,null))['then'](respondWithResult(_0x4456e9,null))['catch'](handleError(_0x4456e9,null));};exports['create']=function(_0xb0578b,_0x36b3ac){var _0x47ac00;return db[_0x629f('0x26')][_0x629f('0x3d')](_0xb0578b[_0x629f('0x3e')],{'raw':!![]})['then'](function(_0x454f8c){_0x47ac00=_0x454f8c;return db['Network'][_0x629f('0x3f')]({'where':{'type':_0xb0578b[_0x629f('0x3e')][_0x629f('0x36')]},'raw':!![]});})[_0x629f('0xa')](function(_0x4d05de){if(_0x47ac00[_0x629f('0x36')][_0x629f('0x40')]()==_0x629f('0x41')){var _0x87cba9=fs[_0x629f('0x42')](path['join'](config['root'],_0x629f('0x43')),'utf8');var _0x36110d=ejs[_0x629f('0x44')](_0x87cba9,{'networks':_0x4d05de||[]});fs[_0x629f('0x45')](_0x629f('0x46'),_0x36110d);return respondWithRpcPromise(_0x629f('0x47'),'create',{'module':'res_stun_monitor.so'});}else if(_0x47ac00[_0x629f('0x36')][_0x629f('0x40')]()=='TURN'){var _0x2e3414=fs[_0x629f('0x42')](path[_0x629f('0x48')](config['root'],_0x629f('0x49')),_0x629f('0x4a'));var _0x64738a=ejs['render'](_0x2e3414,{'networks':_0x4d05de||[]});fs[_0x629f('0x45')](_0x629f('0x4b'),_0x64738a);return respondWithRpcPromise(_0x629f('0x47'),_0x629f('0x3d'),{'module':_0x629f('0x4c')});}else{var _0x33fea1=fs['readFileSync'](path['join'](config[_0x629f('0x4d')],_0x629f('0x4e')),_0x629f('0x4a'));var _0x166860=ejs[_0x629f('0x44')](_0x33fea1,{'networks':_0x4d05de||[]});fs[_0x629f('0x45')](util['format'](_0x629f('0x4f'),_0xb0578b[_0x629f('0x3e')][_0x629f('0x36')]['toLowerCase']()),_0x166860);return respondWithRpcPromise(_0x629f('0x47'),'create',{'module':'chan_sip.so'});}})[_0x629f('0xa')](function(){return _0x47ac00;})[_0x629f('0xa')](respondWithResult(_0x36b3ac,0xc9))['catch'](handleError(_0x36b3ac,null));};exports[_0x629f('0x1e')]=function(_0x126ddd,_0x29aa78){var _0x91065b;return db[_0x629f('0x26')][_0x629f('0x3c')]({'where':{'id':_0x126ddd[_0x629f('0x50')]['id']}})[_0x629f('0xa')](handleEntityNotFound(_0x29aa78,null))[_0x629f('0xa')](saveUpdates(_0x126ddd[_0x629f('0x3e')],null))[_0x629f('0xa')](function(_0x3eac9b){if(_0x3eac9b){_0x91065b=_0x3eac9b;return db[_0x629f('0x26')][_0x629f('0x3f')]({'where':{'type':_0x91065b[_0x629f('0x36')]},'raw':!![]});}return null;})[_0x629f('0xa')](function(_0x7dfe21){if(_0x91065b['type'][_0x629f('0x40')]()==_0x629f('0x41')){var _0x28108d=fs[_0x629f('0x42')](path['join'](config[_0x629f('0x4d')],_0x629f('0x43')),_0x629f('0x4a'));var _0x35f36e=ejs['render'](_0x28108d,{'networks':_0x7dfe21||[]});fs[_0x629f('0x45')](_0x629f('0x46'),_0x35f36e);return respondWithRpcPromise(_0x629f('0x47'),'update',{'module':_0x629f('0x4c')});}else if(_0x91065b[_0x629f('0x36')]['toUpperCase']()==_0x629f('0x51')){var _0x4a6150=fs[_0x629f('0x42')](path[_0x629f('0x48')](config[_0x629f('0x4d')],_0x629f('0x49')),'utf8');var _0x741634=ejs[_0x629f('0x44')](_0x4a6150,{'networks':_0x7dfe21||[]});fs[_0x629f('0x45')](_0x629f('0x4b'),_0x741634);return respondWithRpcPromise('Reload',_0x629f('0x1e'),{'module':_0x629f('0x4c')});}else{var _0x1a3db1=fs[_0x629f('0x42')](path[_0x629f('0x48')](config[_0x629f('0x4d')],_0x629f('0x4e')),_0x629f('0x4a'));var _0x3808ba=ejs[_0x629f('0x44')](_0x1a3db1,{'networks':_0x7dfe21||[]});fs['writeFileSync'](util['format'](_0x629f('0x4f'),_0x126ddd[_0x629f('0x3e')][_0x629f('0x36')][_0x629f('0x52')]()),_0x3808ba);return respondWithRpcPromise('Reload',_0x629f('0x1e'),{'module':_0x629f('0x53')});}})[_0x629f('0xa')](function(_0x5bbd7a){if(_0x5bbd7a){return _0x91065b;}return null;})['then'](respondWithResult(_0x29aa78,null))['catch'](handleError(_0x29aa78,null));};exports[_0x629f('0x1f')]=function(_0x3e49d6,_0x1d981d){var _0x197ee2;return db['Network'][_0x629f('0x3c')]({'where':{'id':_0x3e49d6[_0x629f('0x50')]['id']}})['then'](function(_0x44b963){_0x197ee2=_0x44b963;return _0x44b963;})[_0x629f('0xa')](handleEntityNotFound(_0x1d981d,null))[_0x629f('0xa')](removeEntity(_0x1d981d,null))[_0x629f('0xa')](function(){if(_0x197ee2){return db['Network']['findAll']({'where':{'type':_0x197ee2[_0x629f('0x36')]},'raw':!![]});}})[_0x629f('0xa')](function(_0x3c178a){if(_0x197ee2['type'][_0x629f('0x40')]()==_0x629f('0x41')){var _0x40b10c=fs[_0x629f('0x42')](path[_0x629f('0x48')](config[_0x629f('0x4d')],_0x629f('0x43')),_0x629f('0x4a'));var _0x1fdfcb=ejs[_0x629f('0x44')](_0x40b10c,{'networks':_0x3c178a||[]});fs[_0x629f('0x45')]('/etc/asterisk/stun_xcally.conf',_0x1fdfcb);return respondWithRpcPromise('Reload',_0x629f('0x1f'),{'module':_0x629f('0x4c')});}else if(_0x197ee2[_0x629f('0x36')][_0x629f('0x40')]()==_0x629f('0x51')){var _0x44173b=fs[_0x629f('0x42')](path[_0x629f('0x48')](config[_0x629f('0x4d')],_0x629f('0x49')),_0x629f('0x4a'));var _0x4199cd=ejs['render'](_0x44173b,{'networks':_0x3c178a||[]});fs[_0x629f('0x45')](_0x629f('0x4b'),_0x4199cd);return respondWithRpcPromise(_0x629f('0x47'),_0x629f('0x1f'),{'module':_0x629f('0x4c')});}else{var _0x2f8e5a=fs[_0x629f('0x42')](path[_0x629f('0x48')](config[_0x629f('0x4d')],_0x629f('0x4e')),'utf8');var _0x7dc8b0=ejs[_0x629f('0x44')](_0x2f8e5a,{'networks':_0x3c178a||[]});fs[_0x629f('0x45')](util[_0x629f('0x54')]('/etc/asterisk/sip_xcally_%s.conf',_0x197ee2[_0x629f('0x36')][_0x629f('0x52')]()),_0x7dc8b0);return respondWithRpcPromise('Reload',_0x629f('0x1f'),{'module':_0x629f('0x53')});}})[_0x629f('0x15')](handleError(_0x1d981d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index acf064f..b5fef97 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 _0x91a7=['bluebird','path','./network.attributes','exports','Network','network','util','../../config/logger','api'];(function(_0x1c79a7,_0x38220e){var _0x4de69f=function(_0x569582){while(--_0x569582){_0x1c79a7['push'](_0x1c79a7['shift']());}};_0x4de69f(++_0x38220e);}(_0x91a7,0xe7));var _0x791a=function(_0x5b1d0b,_0x5cf1e2){_0x5b1d0b=_0x5b1d0b-0x0;var _0x340ae1=_0x91a7[_0x5b1d0b];return _0x340ae1;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3d1=['../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x5e1fb6,_0xf3495b){var _0x2cf20e=function(_0x4e51b4){while(--_0x4e51b4){_0x5e1fb6['push'](_0x5e1fb6['shift']());}};_0x2cf20e(++_0xf3495b);}(_0xd3d1,0x172));var _0x1d3d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd3d1[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d3d('0x2'));var BPromise=require(_0x1d3d('0x3'));var rp=require(_0x1d3d('0x4'));var fs=require('fs');var path=require(_0x1d3d('0x5'));var rimraf=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var attributes=require(_0x1d3d('0x8'));module[_0x1d3d('0x9')]=function(_0x1cbe06,_0x449475){return _0x1cbe06[_0x1d3d('0xa')](_0x1d3d('0xb'),attributes,{'tableName':_0x1d3d('0xc'),'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 62333aa..e99a090 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x1d24f7,_0x10340a){_0x1d24f7=_0x1d24f7-0x0;var _0x590469=_0x7a54[_0x1d24f7];return _0x590469;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0xc301c9,_0x2e973c){_0xc301c9=_0xc301c9-0x0;var _0x5b1fe8=_0x7a54[_0xc301c9];return _0x5b1fe8;};'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 75f3fa0..118d6a7 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 _0x14a0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','/:id/dispositions','post','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAnswers','exports','util','path'];(function(_0x72129f,_0x3d52e2){var _0xc0c836=function(_0xd26a50){while(--_0xd26a50){_0x72129f['push'](_0x72129f['shift']());}};_0xc0c836(++_0x3d52e2);}(_0x14a0,0x8e));var _0x014a=function(_0x2443d9,_0x32d420){_0x2443d9=_0x2443d9-0x0;var _0x12f606=_0x14a0[_0x2443d9];return _0x12f606;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['get']('/:id',auth[_0x014a('0x9')](),controller['show']);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['get'](_0x014a('0xd'),auth[_0x014a('0x9')](),controller['getAnswers']);router[_0x014a('0x8')](_0x014a('0xe'),auth[_0x014a('0x9')](),controller[_0x014a('0xf')]);router[_0x014a('0x8')](_0x014a('0x10'),auth[_0x014a('0x9')](),controller[_0x014a('0x11')]);router[_0x014a('0x8')](_0x014a('0x12'),auth[_0x014a('0x9')](),controller[_0x014a('0x13')]);router['post']('/',auth[_0x014a('0x9')](),controller[_0x014a('0x14')]);router['post'](_0x014a('0x15'),auth[_0x014a('0x9')](),controller['addDisposition']);router[_0x014a('0x16')](_0x014a('0xd'),auth[_0x014a('0x9')](),controller[_0x014a('0x17')]);router[_0x014a('0x16')](_0x014a('0x18'),controller[_0x014a('0x19')]);router[_0x014a('0x16')](_0x014a('0xe'),auth[_0x014a('0x9')](),controller[_0x014a('0x1a')]);router[_0x014a('0x16')](_0x014a('0x12'),auth[_0x014a('0x9')](),controller['addAgents']);router[_0x014a('0x16')](_0x014a('0x1b'),auth[_0x014a('0x9')](),controller[_0x014a('0x1c')]);router[_0x014a('0x1d')](_0x014a('0x1e'),auth[_0x014a('0x9')](),controller[_0x014a('0x1f')]);router[_0x014a('0x20')]('/:id',auth[_0x014a('0x9')](),controller['destroy']);router[_0x014a('0x20')](_0x014a('0x15'),auth[_0x014a('0x9')](),controller[_0x014a('0x21')]);router[_0x014a('0x20')](_0x014a('0xd'),auth[_0x014a('0x9')](),controller[_0x014a('0x22')]);router[_0x014a('0x20')]('/:id/users',auth[_0x014a('0x9')](),controller['removeAgents']);module[_0x014a('0x23')]=router; \ No newline at end of file +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(_0x13d30e,_0x77ad0b){var _0x45ae1b=function(_0x12925c){while(--_0x12925c){_0x13d30e['push'](_0x13d30e['shift']());}};_0x45ae1b(++_0x77ad0b);}(_0x7b84,0x17c));var _0x47b8=function(_0x58210e,_0x5c563d){_0x58210e=_0x58210e-0x0;var _0x5bdad3=_0x7b84[_0x58210e];return _0x5bdad3;};'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 diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d65af07..f7c9953 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 _0xb749=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','TEXT','BOOLEAN'];(function(_0xd34131,_0x154367){var _0x11bcf0=function(_0x3631e6){while(--_0x3631e6){_0xd34131['push'](_0xd34131['shift']());}};_0x11bcf0(++_0x154367);}(_0xb749,0xf7));var _0x9b74=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xb749[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x9b74('0x0'));var rs=require(_0x9b74('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9b74('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9b74('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9b74('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9b74('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9b74('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x9b74('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9b74('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9b74('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9b74('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9b74('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9b74('0x4')],'defaultValue':![],'comment':_0x9b74('0x6'),'set':function(_0x10e9f3){if(!_0x10e9f3)this['setDataValue'](_0x9b74('0x7'),null);this['setDataValue'](_0x9b74('0x8'),_0x10e9f3);}}}; \ No newline at end of file +var _0x7644=['sequelize','randomstring','exports','STRING','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x3acce1,_0xc27e6e){var _0x2eb4af=function(_0x4a0926){while(--_0x4a0926){_0x3acce1['push'](_0x3acce1['shift']());}};_0x2eb4af(++_0xc27e6e);}(_0x7644,0x150));var _0x4764=function(_0x29cdb7,_0x4ddca5){_0x29cdb7=_0x29cdb7-0x0;var _0x442795=_0x7644[_0x29cdb7];return _0x442795;};'use strict';var Sequelize=require(_0x4764('0x0'));var rs=require(_0x4764('0x1'));module[_0x4764('0x2')]={'name':{'type':Sequelize[_0x4764('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x4764('0x3')]},'token':{'type':Sequelize[_0x4764('0x3')],'defaultValue':function(){return rs[_0x4764('0x4')]();}},'replyUri':{'type':Sequelize[_0x4764('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4764('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4764('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4764('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4764('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4764('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x4764('0x3')]},'queueTransfer':{'type':Sequelize[_0x4764('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4764('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x4764('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x4764('0x6')],'defaultValue':![],'comment':_0x4764('0x9'),'set':function(_0x5d3f9c){if(!_0x5d3f9c)this[_0x4764('0xa')](_0x4764('0xb'),null);this[_0x4764('0xa')]('mandatoryDisposition',_0x5d3f9c);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 3058fa1..a7768a7 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 _0x727a=['json','undefined','limit','count','offset','set','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','nolimit','order','removeDispositions','ids','CannedAnswer','getAnswers','findAll','removeAnswers','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','from','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','updatedAt','OpenchannelApplication','Applications','applications','orderBy','account','Contacts','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','OpenchannelMessage','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','startRouting','notify','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','eml-format','rimraf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0x727a,0x95));var _0xa727=function(_0x477ffc,_0x58d9db){_0x477ffc=_0x477ffc-0x0;var _0x1fe1c3=_0x727a[_0x477ffc];return _0x1fe1c3;};'use strict';var emlformat=require(_0xa727('0x0'));var rimraf=require(_0xa727('0x1'));var zipdir=require(_0xa727('0x2'));var jsonpatch=require(_0xa727('0x3'));var rp=require(_0xa727('0x4'));var moment=require(_0xa727('0x5'));var BPromise=require(_0xa727('0x6'));var Mustache=require('mustache');var util=require(_0xa727('0x7'));var path=require(_0xa727('0x8'));var sox=require(_0xa727('0x9'));var csv=require(_0xa727('0xa'));var ejs=require(_0xa727('0xb'));var fs=require('fs');var fs_extra=require(_0xa727('0xc'));var _=require(_0xa727('0xd'));var squel=require(_0xa727('0xe'));var crypto=require(_0xa727('0xf'));var jsforce=require(_0xa727('0x10'));var deskjs=require(_0xa727('0x11'));var toCsv=require(_0xa727('0xa'));var querystring=require(_0xa727('0x12'));var Papa=require(_0xa727('0x13'));var Redis=require(_0xa727('0x14'));var authService=require(_0xa727('0x15'));var qs=require(_0xa727('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa727('0x17'));var logger=require(_0xa727('0x18'))(_0xa727('0x19'));var utils=require(_0xa727('0x1a'));var config=require(_0xa727('0x1b'));var licenseUtil=require(_0xa727('0x1c'));var db=require(_0xa727('0x1d'))['db'];config[_0xa727('0x1e')]=_[_0xa727('0x1f')](config[_0xa727('0x1e')],{'host':_0xa727('0x20'),'port':0x18eb});var socket=require(_0xa727('0x21'))(new Redis(config[_0xa727('0x1e')]));require(_0xa727('0x22'))[_0xa727('0x23')](socket);var jayson=require(_0xa727('0x24'));var client=jayson[_0xa727('0x25')][_0xa727('0x26')]({'port':0x232c});var client9002=jayson[_0xa727('0x25')][_0xa727('0x26')]({'port':0x232a});function respondWithRpcPromise(_0x21d054,_0x3b5d48,_0x12a3a1,_0x2bc42e){return new BPromise(function(_0x690abb,_0x1dc547){var _0x4a242a=_0x2bc42e||client;return _0x4a242a[_0xa727('0x27')](_0x21d054,_0x12a3a1)[_0xa727('0x28')](function(_0x430b15){logger[_0xa727('0x29')](_0xa727('0x2a'),_0x3b5d48,_0xa727('0x2b'));logger[_0xa727('0x2c')](_0xa727('0x2d'),_0x3b5d48,'request\x20sent',JSON['stringify'](_0x430b15));if(_0x430b15[_0xa727('0x2e')]){if(_0x430b15['error']['code']===0x1f4){logger['error'](_0xa727('0x2a'),_0x3b5d48,_0x430b15['error'][_0xa727('0x2f')]);return _0x1dc547(_0x430b15['error']['message']);}logger[_0xa727('0x2e')](_0xa727('0x2a'),_0x3b5d48,_0x430b15[_0xa727('0x2e')]['message']);return _0x690abb(_0x430b15[_0xa727('0x2e')][_0xa727('0x2f')]);}else{logger['info'](_0xa727('0x2a'),_0x3b5d48,_0xa727('0x2b'));_0x690abb(_0x430b15[_0xa727('0x30')][_0xa727('0x2f')]);}})[_0xa727('0x31')](function(_0x2d2c27){logger[_0xa727('0x2e')](_0xa727('0x2a'),_0x3b5d48,_0x2d2c27);_0x1dc547(_0x2d2c27);});});}function respondWithStatusCode(_0xd210d9,_0x5a9af5){_0x5a9af5=_0x5a9af5||0xcc;return function(_0x120c4c){if(_0x120c4c){return _0xd210d9[_0xa727('0x32')](_0x5a9af5);}return _0xd210d9['status'](_0x5a9af5)['end']();};}function respondWithResult(_0x76e540,_0x15a898){_0x15a898=_0x15a898||0xc8;return function(_0x5044ab){if(_0x5044ab){return _0x76e540[_0xa727('0x33')](_0x15a898)[_0xa727('0x34')](_0x5044ab);}};}function respondWithFilteredResult(_0x25dce3,_0x1a245b){return function(_0x17a0e6){if(_0x17a0e6){var _0x39d0b1=typeof _0x1a245b['offset']===_0xa727('0x35')&&typeof _0x1a245b[_0xa727('0x36')]===_0xa727('0x35');var _0x466506=_0x17a0e6[_0xa727('0x37')];var _0x29b0cd=_0x39d0b1?0x0:_0x1a245b[_0xa727('0x38')];var _0x44a8a0=_0x39d0b1?_0x17a0e6[_0xa727('0x37')]:_0x1a245b['offset']+_0x1a245b[_0xa727('0x36')];var _0x268df9;if(_0x44a8a0>=_0x466506){_0x44a8a0=_0x466506;_0x268df9=0xc8;}else{_0x268df9=0xce;}_0x25dce3[_0xa727('0x33')](_0x268df9);return _0x25dce3[_0xa727('0x39')]('Content-Range',_0x29b0cd+'-'+_0x44a8a0+'/'+_0x466506)[_0xa727('0x34')](_0x17a0e6);}return null;};}function patchUpdates(_0x2a2e4d){return function(_0x4d0f59){try{jsonpatch[_0xa727('0x3a')](_0x4d0f59,_0x2a2e4d,!![]);}catch(_0x474f12){return BPromise['reject'](_0x474f12);}return _0x4d0f59[_0xa727('0x3b')]();};}function saveUpdates(_0x4d5934,_0x54640d){return function(_0xeb6036){if(_0xeb6036){return _0xeb6036[_0xa727('0x3c')](_0x4d5934)[_0xa727('0x28')](function(_0x58d816){return _0x58d816;});}return null;};}function removeEntity(_0x1f92f3,_0x1c04aa){return function(_0x1b3aa2){if(_0x1b3aa2){return _0x1b3aa2[_0xa727('0x3d')]()['then'](function(){var _0x194a9f=_0x1b3aa2[_0xa727('0x3e')]({'plain':!![]});var _0x24a8f6='OpenchannelAccounts';return db[_0xa727('0x3f')]['destroy']({'where':{'type':_0x24a8f6,'resourceId':_0x194a9f['id']}})[_0xa727('0x28')](function(){return _0x1b3aa2;});})[_0xa727('0x28')](function(){_0x1f92f3[_0xa727('0x33')](0xcc)[_0xa727('0x40')]();});}};}function handleEntityNotFound(_0x779251,_0x587865){return function(_0x5205c5){if(!_0x5205c5){_0x779251[_0xa727('0x32')](0x194);}return _0x5205c5;};}function handleError(_0x1d7a4b,_0x4b4457){_0x4b4457=_0x4b4457||0x1f4;return function(_0xc5be3){logger['error'](_0xc5be3[_0xa727('0x41')]);if(_0xc5be3[_0xa727('0x42')]){delete _0xc5be3[_0xa727('0x42')];}_0x1d7a4b[_0xa727('0x33')](_0x4b4457)[_0xa727('0x43')](_0xc5be3);};}exports[_0xa727('0x44')]=function(_0x5e6c18,_0x1da0ba){var _0xde3a0={'include':[{'model':db[_0xa727('0x45')],'as':_0xa727('0x46')}]},_0x1a1bc1={},_0x279ef9={'count':0x0,'rows':[]};var _0x4f9f57=_[_0xa727('0x47')](db[_0xa727('0x48')][_0xa727('0x49')],function(_0x7d7e37){return{'name':_0x7d7e37['fieldName'],'type':_0x7d7e37[_0xa727('0x4a')][_0xa727('0x4b')]};});_0x1a1bc1['model']=_['map'](_0x4f9f57,_0xa727('0x42'));_0x1a1bc1[_0xa727('0x4c')]=_['keys'](_0x5e6c18[_0xa727('0x4c')]);_0x1a1bc1[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x1a1bc1[_0xa727('0x4f')],_0x1a1bc1[_0xa727('0x4c')]);_0xde3a0['attributes']=_[_0xa727('0x4e')](_0x1a1bc1[_0xa727('0x4f')],qs[_0xa727('0x50')](_0x5e6c18['query'][_0xa727('0x50')]));_0xde3a0[_0xa727('0x51')]=_0xde3a0[_0xa727('0x51')][_0xa727('0x52')]?_0xde3a0['attributes']:_0x1a1bc1[_0xa727('0x4f')];if(!_0x5e6c18[_0xa727('0x4c')][_0xa727('0x53')]('nolimit')){_0xde3a0['limit']=qs['limit'](_0x5e6c18['query'][_0xa727('0x36')]);_0xde3a0[_0xa727('0x38')]=qs[_0xa727('0x38')](_0x5e6c18[_0xa727('0x4c')][_0xa727('0x38')]);}_0xde3a0['order']=qs[_0xa727('0x54')](_0x5e6c18[_0xa727('0x4c')][_0xa727('0x54')]);_0xde3a0[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0x5e6c18['query'],_0x1a1bc1[_0xa727('0x4d')]),_0x4f9f57);if(_0x5e6c18[_0xa727('0x4c')][_0xa727('0x57')]){_0xde3a0[_0xa727('0x55')]=_['merge'](_0xde3a0['where'],{'$or':_[_0xa727('0x47')](_0x4f9f57,function(_0x1d03d2){if(_0x1d03d2[_0xa727('0x4a')]!==_0xa727('0x58')){var _0x23bc14={};_0x23bc14[_0x1d03d2[_0xa727('0x42')]]={'$like':'%'+_0x5e6c18[_0xa727('0x4c')]['filter']+'%'};return _0x23bc14;}})});}_0xde3a0=_[_0xa727('0x59')]({},_0xde3a0,_0x5e6c18[_0xa727('0x5a')]);var _0x24ad4f={'where':_0xde3a0[_0xa727('0x55')]};return db['OpenchannelAccount'][_0xa727('0x37')](_0x24ad4f)[_0xa727('0x28')](function(_0x2545f0){_0x279ef9[_0xa727('0x37')]=_0x2545f0;if(_0x5e6c18[_0xa727('0x4c')][_0xa727('0x5b')]){_0xde3a0[_0xa727('0x5c')]=[{'all':!![]}];}return db[_0xa727('0x48')]['findAll'](_0xde3a0);})['then'](function(_0x1f3f50){_0x279ef9[_0xa727('0x5d')]=_0x1f3f50;return _0x279ef9;})[_0xa727('0x28')](respondWithFilteredResult(_0x1da0ba,_0xde3a0))[_0xa727('0x31')](handleError(_0x1da0ba,null));};exports[_0xa727('0x5e')]=function(_0x2181d3,_0x3c795a){var _0x2d2fba={'raw':![],'where':{'id':_0x2181d3[_0xa727('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0xa727('0x46')}]},_0x37f010={};_0x37f010['model']=_[_0xa727('0x60')](db[_0xa727('0x48')]['rawAttributes']);_0x37f010[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x2181d3[_0xa727('0x4c')]);_0x37f010['filters']=_[_0xa727('0x4e')](_0x37f010['model'],_0x37f010['query']);_0x2d2fba['attributes']=_[_0xa727('0x4e')](_0x37f010[_0xa727('0x4f')],qs['fields'](_0x2181d3[_0xa727('0x4c')][_0xa727('0x50')]));_0x2d2fba[_0xa727('0x51')]=_0x2d2fba[_0xa727('0x51')]['length']?_0x2d2fba[_0xa727('0x51')]:_0x37f010['model'];if(_0x2181d3[_0xa727('0x4c')]['includeAll']){_0x2d2fba['include']=[{'all':!![]}];}_0x2d2fba=_['merge']({},_0x2d2fba,_0x2181d3[_0xa727('0x5a')]);return db[_0xa727('0x48')][_0xa727('0x61')](_0x2d2fba)[_0xa727('0x28')](handleEntityNotFound(_0x3c795a,null))['then'](respondWithResult(_0x3c795a,null))[_0xa727('0x31')](handleError(_0x3c795a,null));};exports[_0xa727('0x62')]=function(_0x1c6491,_0x1a8d5c){return db[_0xa727('0x48')][_0xa727('0x62')](_0x1c6491[_0xa727('0x63')],{})[_0xa727('0x28')](function(_0x1daa92){var _0x572822=_0x1c6491[_0xa727('0x64')]['get']({'plain':!![]});if(!_0x572822)throw new Error(_0xa727('0x65'));if(_0x572822[_0xa727('0x66')]==='user'){var _0x374d03=_0x1daa92['get']({'plain':!![]});var _0x120106=_0xa727('0x67');return db[_0xa727('0x68')][_0xa727('0x61')]({'where':{'name':_0x120106,'userProfileId':_0x572822['userProfileId']},'raw':!![]})[_0xa727('0x28')](function(_0x42f58b){if(_0x42f58b&&_0x42f58b[_0xa727('0x69')]===0x0){return db['UserProfileResource'][_0xa727('0x62')]({'name':_0x374d03[_0xa727('0x42')],'resourceId':_0x374d03['id'],'type':_0x42f58b['name'],'sectionId':_0x42f58b['id']},{})['then'](function(){return _0x1daa92;});}else{return _0x1daa92;}})[_0xa727('0x31')](function(_0x341a27){logger[_0xa727('0x2e')](_0xa727('0x6a'),_0x341a27);throw _0x341a27;});}return _0x1daa92;})['then'](respondWithResult(_0x1a8d5c,0xc9))[_0xa727('0x31')](handleError(_0x1a8d5c,null));};exports[_0xa727('0x3c')]=function(_0x5697bb,_0x216706){if(_0x5697bb['body']['id']){delete _0x5697bb[_0xa727('0x63')]['id'];}return db['OpenchannelAccount'][_0xa727('0x61')]({'where':{'id':_0x5697bb[_0xa727('0x5f')]['id']},'include':[{'model':db[_0xa727('0x45')],'as':_0xa727('0x46')}]})[_0xa727('0x28')](handleEntityNotFound(_0x216706,null))[_0xa727('0x28')](saveUpdates(_0x5697bb[_0xa727('0x63')],null))[_0xa727('0x28')](respondWithResult(_0x216706,null))[_0xa727('0x31')](handleError(_0x216706,null));};exports[_0xa727('0x3d')]=function(_0x4cac10,_0x474fa0){return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x4cac10[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x474fa0,null))[_0xa727('0x28')](removeEntity(_0x474fa0,null))[_0xa727('0x31')](handleError(_0x474fa0,null));};exports[_0xa727('0x6b')]=function(_0x359c1e,_0x360c21){return db[_0xa727('0x48')]['describe']()[_0xa727('0x28')](respondWithResult(_0x360c21,null))[_0xa727('0x31')](handleError(_0x360c21,null));};exports[_0xa727('0x6c')]=function(_0x4ee7cb,_0x45383a,_0x31d40b){if(_0x4ee7cb[_0xa727('0x63')]['id']){delete _0x4ee7cb[_0xa727('0x63')]['id'];}return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x4ee7cb['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x45383a,null))[_0xa727('0x28')](function(_0x16446c){if(_0x16446c){_0x4ee7cb[_0xa727('0x63')][_0xa727('0x6d')]=_0x16446c['id'];return db[_0xa727('0x6e')]['create'](_0x4ee7cb['body']);}})[_0xa727('0x28')](respondWithResult(_0x45383a,null))[_0xa727('0x31')](handleError(_0x45383a,null));};exports['getDispositions']=function(_0x1fba5d,_0x1f1976,_0x58b4f8){var _0x5c851b={'raw':![],'where':{}};var _0x543bd6={};var _0x34e854={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa727('0x6f')]({'where':{'id':_0x1fba5d['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x1f1976,null))[_0xa727('0x28')](function(_0x401221){if(_0x401221){_0x543bd6[_0xa727('0x4f')]=_[_0xa727('0x60')](db[_0xa727('0x6e')][_0xa727('0x49')]);_0x543bd6[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x1fba5d['query']);_0x543bd6[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x543bd6[_0xa727('0x4f')],_0x543bd6['query']);_0x5c851b[_0xa727('0x51')]=_[_0xa727('0x4e')](_0x543bd6['model'],qs[_0xa727('0x50')](_0x1fba5d[_0xa727('0x4c')][_0xa727('0x50')]));_0x5c851b[_0xa727('0x51')]=_0x5c851b[_0xa727('0x51')][_0xa727('0x52')]?_0x5c851b[_0xa727('0x51')]:_0x543bd6[_0xa727('0x4f')];if(!_0x1fba5d[_0xa727('0x4c')][_0xa727('0x53')](_0xa727('0x70'))){_0x5c851b['limit']=qs['limit'](_0x1fba5d[_0xa727('0x4c')][_0xa727('0x36')]);_0x5c851b[_0xa727('0x38')]=qs['offset'](_0x1fba5d[_0xa727('0x4c')][_0xa727('0x38')]);}_0x5c851b[_0xa727('0x71')]=qs[_0xa727('0x54')](_0x1fba5d[_0xa727('0x4c')][_0xa727('0x54')]);_0x5c851b[_0xa727('0x55')]=qs[_0xa727('0x4d')](_['pick'](_0x1fba5d[_0xa727('0x4c')],_0x543bd6[_0xa727('0x4d')]));_0x5c851b[_0xa727('0x55')][_0xa727('0x6d')]=_0x401221['id'];if(_0x1fba5d[_0xa727('0x4c')][_0xa727('0x57')]){_0x5c851b[_0xa727('0x55')]=_[_0xa727('0x59')](_0x5c851b[_0xa727('0x55')],{'$or':_[_0xa727('0x47')](_0x5c851b['attributes'],function(_0x54a922){var _0x19b61a={};_0x19b61a[_0x54a922]={'$like':'%'+_0x1fba5d[_0xa727('0x4c')][_0xa727('0x57')]+'%'};return _0x19b61a;})});}_0x5c851b=_[_0xa727('0x59')]({},_0x5c851b,_0x1fba5d[_0xa727('0x5a')]);return db[_0xa727('0x6e')][_0xa727('0x37')]({'where':_0x5c851b[_0xa727('0x55')]})[_0xa727('0x28')](function(_0x153253){_0x34e854[_0xa727('0x37')]=_0x153253;if(_0x1fba5d[_0xa727('0x4c')]['includeAll']){_0x5c851b['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5c851b);})[_0xa727('0x28')](function(_0x2667d2){_0x34e854['rows']=_0x2667d2;return _0x34e854;});}})[_0xa727('0x28')](respondWithFilteredResult(_0x1f1976,_0x5c851b))[_0xa727('0x31')](handleError(_0x1f1976,null));};exports['removeDispositions']=function(_0x278c7e,_0x353f1c,_0x151846){return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x278c7e[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x353f1c,null))[_0xa727('0x28')](function(_0x81b9eb){if(_0x81b9eb){return _0x81b9eb[_0xa727('0x72')](_0x278c7e[_0xa727('0x4c')][_0xa727('0x73')]);}})[_0xa727('0x28')](respondWithStatusCode(_0x353f1c,null))[_0xa727('0x31')](handleError(_0x353f1c,null));};exports['addAnswer']=function(_0x45224e,_0x37398e,_0x18748b){if(_0x45224e[_0xa727('0x63')]['id']){delete _0x45224e['body']['id'];}return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x45224e[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x37398e,null))[_0xa727('0x28')](function(_0x35a8f7){if(_0x35a8f7){_0x45224e[_0xa727('0x63')][_0xa727('0x6d')]=_0x35a8f7['id'];return db[_0xa727('0x74')][_0xa727('0x62')](_0x45224e[_0xa727('0x63')]);}})[_0xa727('0x28')](respondWithResult(_0x37398e,null))['catch'](handleError(_0x37398e,null));};exports[_0xa727('0x75')]=function(_0xdde33a,_0x74d4f4,_0x1f99c4){var _0x583b17={'raw':![],'where':{}};var _0x5da245={};var _0x427e0d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa727('0x6f')]({'where':{'id':_0xdde33a['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x74d4f4,null))[_0xa727('0x28')](function(_0x579a72){if(_0x579a72){_0x5da245[_0xa727('0x4f')]=_['keys'](db[_0xa727('0x74')]['rawAttributes']);_0x5da245['query']=_[_0xa727('0x60')](_0xdde33a[_0xa727('0x4c')]);_0x5da245['filters']=_[_0xa727('0x4e')](_0x5da245[_0xa727('0x4f')],_0x5da245['query']);_0x583b17[_0xa727('0x51')]=_[_0xa727('0x4e')](_0x5da245['model'],qs[_0xa727('0x50')](_0xdde33a[_0xa727('0x4c')]['fields']));_0x583b17[_0xa727('0x51')]=_0x583b17[_0xa727('0x51')][_0xa727('0x52')]?_0x583b17[_0xa727('0x51')]:_0x5da245['model'];if(!_0xdde33a[_0xa727('0x4c')][_0xa727('0x53')](_0xa727('0x70'))){_0x583b17['limit']=qs[_0xa727('0x36')](_0xdde33a['query'][_0xa727('0x36')]);_0x583b17[_0xa727('0x38')]=qs[_0xa727('0x38')](_0xdde33a[_0xa727('0x4c')]['offset']);}_0x583b17['order']=qs[_0xa727('0x54')](_0xdde33a[_0xa727('0x4c')][_0xa727('0x54')]);_0x583b17[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0xdde33a['query'],_0x5da245[_0xa727('0x4d')]));_0x583b17[_0xa727('0x55')][_0xa727('0x6d')]=_0x579a72['id'];if(_0xdde33a[_0xa727('0x4c')][_0xa727('0x57')]){_0x583b17['where']=_[_0xa727('0x59')](_0x583b17[_0xa727('0x55')],{'$or':_[_0xa727('0x47')](_0x583b17[_0xa727('0x51')],function(_0x38320b){var _0x8b6d97={};_0x8b6d97[_0x38320b]={'$like':'%'+_0xdde33a[_0xa727('0x4c')][_0xa727('0x57')]+'%'};return _0x8b6d97;})});}_0x583b17=_[_0xa727('0x59')]({},_0x583b17,_0xdde33a[_0xa727('0x5a')]);return db[_0xa727('0x74')]['count']({'where':_0x583b17[_0xa727('0x55')]})[_0xa727('0x28')](function(_0x1b6b75){_0x427e0d[_0xa727('0x37')]=_0x1b6b75;if(_0xdde33a[_0xa727('0x4c')][_0xa727('0x5b')]){_0x583b17[_0xa727('0x5c')]=[{'all':!![]}];}return db[_0xa727('0x74')][_0xa727('0x76')](_0x583b17);})[_0xa727('0x28')](function(_0x47d482){_0x427e0d['rows']=_0x47d482;return _0x427e0d;});}})[_0xa727('0x28')](respondWithFilteredResult(_0x74d4f4,_0x583b17))[_0xa727('0x31')](handleError(_0x74d4f4,null));};exports[_0xa727('0x77')]=function(_0x50150f,_0x5146c8,_0x13b5a5){return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x50150f['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x5146c8,null))[_0xa727('0x28')](function(_0x59abc7){if(_0x59abc7){return _0x59abc7[_0xa727('0x77')](_0x50150f['query']['ids']);}})[_0xa727('0x28')](respondWithStatusCode(_0x5146c8,null))[_0xa727('0x31')](handleError(_0x5146c8,null));};exports['notify']=function(_0x463753,_0x3ff83a,_0x38571c){var _0x56384a={'body':_0x463753[_0xa727('0x63')],'channel':_0xa727('0x78')};var _0x2651db=[];var _0x27b430=[];var _0x36ed09={};var _0x2b7c35=![];return db[_0xa727('0x79')][_0xa727('0x6b')]()[_0xa727('0x28')](function(_0x372ed6){if(!_0x372ed6){throw new db[(_0xa727('0x7a'))]['ValidationError'](_0xa727('0x7b'));}_0x2651db=_[_0xa727('0x7c')](_['keys'](_0x372ed6),[_0xa727('0x7d'),'updatedAt']);_0x27b430=_[_0xa727('0x7c')](_[_0xa727('0x60')](_0x372ed6),['createdAt','updatedAt',_0xa727('0x7e'),'ListId']);if(_0x463753[_0xa727('0x63')]['id']){delete _0x463753[_0xa727('0x63')]['id'];}if(_['isNil'](_0x463753[_0xa727('0x63')][_0xa727('0x7f')])){throw new db[(_0xa727('0x7a'))][(_0xa727('0x80'))]('from\x20is\x20mandatory');}if(_[_0xa727('0x81')](_0x463753[_0xa727('0x63')][_0xa727('0x63')])||_0x463753[_0xa727('0x63')]['body']===''){throw new db[(_0xa727('0x7a'))]['ValidationError'](_0xa727('0x82'));}if(_[_0xa727('0x81')](_0x463753[_0xa727('0x63')][_0xa727('0x83')])){throw new db[(_0xa727('0x7a'))][(_0xa727('0x80'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x27b430);}if(!_[_0xa727('0x84')](_0x27b430,_0x463753[_0xa727('0x63')]['mapKey'])){throw new db[(_0xa727('0x7a'))][(_0xa727('0x80'))](_0xa727('0x85')+_0x27b430);}_0x36ed09[_0x463753['body'][_0xa727('0x83')]]=_0x463753[_0xa727('0x63')][_0xa727('0x7f')];})[_0xa727('0x28')](function(){return db[_0xa727('0x48')]['find']({'where':{'id':_0x463753['params']['id']},'include':[{'model':db[_0xa727('0x86')],'as':_0xa727('0x87'),'include':[{'model':db[_0xa727('0x79')],'as':'Contacts','where':_0x36ed09,'limit':0x1,'order':[[_0xa727('0x88'),'DESC']]}]},{'model':db[_0xa727('0x89')],'as':_0xa727('0x8a')}]});})['then'](handleEntityNotFound(_0x3ff83a,null))['then'](function(_0x66e5f1){if(_0x66e5f1&&_0x66e5f1[_0xa727('0x87')]){_0x56384a['account']=_0x66e5f1;_0x56384a[_0xa727('0x8b')]=_0x66e5f1['Applications'];_0x56384a['list']=_0x66e5f1[_0xa727('0x87')];_0x56384a[_0xa727('0x8b')]=_[_0xa727('0x8c')](_0x56384a[_0xa727('0x8b')],['priority'],['asc']);if(_0x56384a['account']['Applications']){delete _0x56384a[_0xa727('0x8d')]['Applications'];}if(_0x56384a[_0xa727('0x8d')]['List']&&_0x56384a[_0xa727('0x8d')]['List'][_0xa727('0x8e')][_0xa727('0x52')]){return _0x56384a[_0xa727('0x8d')][_0xa727('0x87')]['Contacts'][0x0];}var _0x3a3bad=_['defaults'](_0x463753[_0xa727('0x63')],{'firstName':_0x463753[_0xa727('0x63')][_0xa727('0x7f')],'ListId':_0x66e5f1[_0xa727('0x8f')]});_0x3a3bad[_0x463753['body'][_0xa727('0x83')]]=_0x463753['body'][_0xa727('0x7f')];return db[_0xa727('0x79')]['create'](_0x3a3bad,{'fields':_0x2651db,'raw':!![]});}})[_0xa727('0x28')](handleEntityNotFound(_0x3ff83a,null))[_0xa727('0x28')](function(_0xad2448){_0x56384a[_0xa727('0x90')]=_0xad2448;if(_0xad2448){var _0x115d4d={'ContactId':_0xad2448['id'],'OpenchannelAccountId':_0x463753[_0xa727('0x5f')]['id'],'from':(_0xad2448[_0xa727('0x91')]||'')+'\x20'+(_0xad2448[_0xa727('0x92')]||'')};var _0x5a367d={'OpenchannelAccountId':_0x463753[_0xa727('0x5f')]['id'],'closed':![]};if(_0x463753[_0xa727('0x63')][_0xa727('0x93')]){_0x5a367d['threadId']=_0x463753[_0xa727('0x63')][_0xa727('0x93')];return db[_0xa727('0x94')][_0xa727('0x61')]({'where':_0x5a367d})[_0xa727('0x28')](function(_0x12c88c){if(_0x12c88c){return[_0x12c88c,![]];}_0x115d4d[_0xa727('0x93')]=_0x463753['body'][_0xa727('0x93')];_0x115d4d[_0xa727('0x95')]=_0x463753['body'][_0xa727('0x95')];return db[_0xa727('0x94')][_0xa727('0x62')](_0x115d4d)[_0xa727('0x28')](function(_0x2e17d8){return[_0x2e17d8,!![]];});});}else{_0x5a367d[_0xa727('0x93')]=null;}_0x5a367d[_0xa727('0x96')]=_0xad2448['id'];return db[_0xa727('0x94')][_0xa727('0x61')]({'where':_0x5a367d})['then'](function(_0x46639d){if(_0x46639d){return[_0x46639d,![]];}return db[_0xa727('0x94')][_0xa727('0x62')](_0x115d4d)['then'](function(_0x53bf68){return[_0x53bf68,!![]];});});}})[_0xa727('0x97')](function(_0x30b98d,_0x1037ba){if(_0x30b98d){_0x2b7c35=_0x1037ba;if(!_0x1037ba){var _0x187820={'from':(_0x56384a[_0xa727('0x90')]['firstName']||'')+'\x20'+(_0x56384a[_0xa727('0x90')][_0xa727('0x92')]||'')};if(_0x463753['body'][_0xa727('0x93')]&&_0x463753[_0xa727('0x63')][_0xa727('0x98')]&&_0x463753[_0xa727('0x63')][_0xa727('0x93')]!=_0x463753[_0xa727('0x63')][_0xa727('0x98')]){_0x187820['threadId']=_0x463753[_0xa727('0x63')][_0xa727('0x98')];}return _0x30b98d[_0xa727('0x3c')](_0x187820);}else{return _0x30b98d;}}})[_0xa727('0x28')](function(_0x48e009){_0x56384a[_0xa727('0x99')]=_0x48e009[_0xa727('0x3e')]({'plain':!![]});_0x56384a[_0xa727('0x99')][_0xa727('0x9a')]=_0x2b7c35;if(_0x56384a[_0xa727('0x99')]['created']){if(_0x56384a[_0xa727('0x8d')][_0xa727('0x9b')]){_0x56384a['applications'][_0xa727('0x9c')]({'id':0x0,'priority':_0x56384a['applications'][_0xa727('0x52')]+0x1,'app':_0xa727('0x9d'),'appdata':_0xa727('0x9e'),'interval':'*,*,*,*'});}}return db[_0xa727('0x9f')][_0xa727('0x62')]({'body':_0x463753[_0xa727('0x63')]['body'],'OpenchannelAccountId':_0x463753[_0xa727('0x5f')]['id'],'OpenchannelInteractionId':_0x48e009['id'],'direction':'in','ContactId':_0x56384a[_0xa727('0x90')]['id'],'AttachmentId':_0x463753['body']['AttachmentId']});})[_0xa727('0x28')](function(_0x151175){_0x56384a[_0xa727('0x2f')]=_0x151175;if(!_0x56384a[_0xa727('0x99')]['UserId'])return;return db[_0xa727('0xa0')][_0xa727('0x61')]({'attributes':['id',_0xa727('0x42')],'where':{'id':_0x56384a['interaction'][_0xa727('0xa1')]}});})[_0xa727('0x28')](function(_0x124529){if(_0x124529){_0x56384a[_0xa727('0x8b')][_0xa727('0xa2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x124529[_0xa727('0x42')]+','+(_0x56384a[_0xa727('0x8d')][_0xa727('0xa3')]||0xa),'interval':_0xa727('0xa4')});}if(!_0x56384a['interaction'][_0xa727('0xa5')])return;return db[_0xa727('0xa6')]['find']({'attributes':['id','name'],'where':{'id':_0x56384a[_0xa727('0x99')][_0xa727('0xa5')]}});})[_0xa727('0x28')](function(_0x2dc64e){if(_0x2dc64e){_0x56384a[_0xa727('0x8b')][_0xa727('0xa2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2dc64e[_0xa727('0x42')]+','+(_0x56384a[_0xa727('0x8d')][_0xa727('0xa7')]||0x12c),'interval':_0xa727('0xa4')});}return respondWithRpcPromise(_0xa727('0xa8'),_0xa727('0xa9'),_0x56384a);})[_0xa727('0x28')](function(_0x187365){respondWithRpcPromise('EventManager','EventManager',{'event':_0xa727('0xaa'),'message':_0x187365},client9002);return _0x187365;})[_0xa727('0x28')](respondWithResult(_0x3ff83a,null))[_0xa727('0x31')](handleError(_0x3ff83a,null));};exports[_0xa727('0xab')]=function(_0x5df989,_0x4fc4dd){var _0x1cee51=_0x5df989[_0xa727('0x5f')]['id'];var _0x51eb9d=_0x5df989['body'];var _0x1c39c9=0xc8;var _0x294035=null;return db['sequelize'][_0xa727('0xac')]({'isolationLevel':db[_0xa727('0xad')][_0xa727('0xae')]['ISOLATION_LEVELS'][_0xa727('0xaf')]},function(_0x354eec){return db[_0xa727('0x48')][_0xa727('0x6f')]({'where':{'id':_0x1cee51},'transaction':_0x354eec})[_0xa727('0x28')](function(_0x48616c){if(_0x48616c){return db[_0xa727('0x89')][_0xa727('0x3d')]({'where':{'OpenchannelAccountId':_0x1cee51},'transaction':_0x354eec})[_0xa727('0x28')](function(){var _0x405d13=_['map'](_0x51eb9d,function(_0x40c829){_0x40c829[_0xa727('0x6d')]=_0x1cee51;return _0x40c829;});return db[_0xa727('0x89')][_0xa727('0xb0')](_0x405d13,{'transaction':_0x354eec});});}else{_0x1c39c9=0x194;_0x294035=[];}});})[_0xa727('0x28')](function(){if(_0x1c39c9!==0x194){return db['OpenchannelApplication'][_0xa727('0xb1')]({'where':{'OpenchannelAccountId':_0x1cee51},'order':_0xa727('0xb2')})[_0xa727('0x28')](function(_0x40d2f1){_0x294035=_0x40d2f1;});}})[_0xa727('0x31')](function(_0x56641c){_0x1c39c9=0x1f4;logger[_0xa727('0x2e')](_0x56641c['stack']);if(_0x56641c[_0xa727('0x42')]){delete _0x56641c['name'];}_0x294035=_0x56641c;})[_0xa727('0xb3')](function(){if(_0x294035===null){_0x4fc4dd[_0xa727('0x32')](_0x1c39c9);}else{if(_0x1c39c9===0x1f4){_0x4fc4dd[_0xa727('0x33')](_0x1c39c9)[_0xa727('0x43')](_0x294035);}else{_0x4fc4dd[_0xa727('0x33')](_0x1c39c9)[_0xa727('0x34')](_0x294035);}}});};exports['getApplications']=function(_0x1e33a8,_0x10f9bf,_0x32434d){var _0x4fa4db={};var _0x295af8={};var _0x3595c3;var _0x470540;return db[_0xa727('0x48')][_0xa727('0x6f')]({'where':{'id':_0x1e33a8[_0xa727('0x5f')]['id']}})['then'](handleEntityNotFound(_0x10f9bf,null))['then'](function(_0x1aeb26){if(_0x1aeb26){_0x3595c3=_0x1aeb26;_0x295af8['model']=_[_0xa727('0x60')](db[_0xa727('0x89')][_0xa727('0x49')]);_0x295af8[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x1e33a8[_0xa727('0x4c')]);_0x295af8[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x295af8[_0xa727('0x4f')],_0x295af8[_0xa727('0x4c')]);_0x4fa4db['attributes']=_[_0xa727('0x4e')](_0x295af8[_0xa727('0x4f')],qs[_0xa727('0x50')](_0x1e33a8[_0xa727('0x4c')][_0xa727('0x50')]));_0x4fa4db[_0xa727('0x51')]=_0x4fa4db['attributes']['length']?_0x4fa4db[_0xa727('0x51')]:_0x295af8[_0xa727('0x4f')];_0x4fa4db['order']=qs[_0xa727('0x54')](_0x1e33a8[_0xa727('0x4c')][_0xa727('0x54')]);_0x4fa4db[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0x1e33a8[_0xa727('0x4c')],_0x295af8[_0xa727('0x4d')]));if(_0x1e33a8[_0xa727('0x4c')]['filter']){_0x4fa4db[_0xa727('0x55')]=_['merge'](_0x4fa4db[_0xa727('0x55')],{'$or':_[_0xa727('0x47')](_0x4fa4db[_0xa727('0x51')],function(_0x3fa9dd){var _0x29d323={};_0x29d323[_0x3fa9dd]={'$like':'%'+_0x1e33a8['query'][_0xa727('0x57')]+'%'};return _0x29d323;})});}_0x4fa4db=_[_0xa727('0x59')]({},_0x4fa4db,_0x1e33a8[_0xa727('0x5a')]);return _0x3595c3[_0xa727('0xb4')](_0x4fa4db);}})[_0xa727('0x28')](function(_0x64c55a){if(_0x64c55a){_0x470540=_0x64c55a[_0xa727('0x52')];if(!_0x1e33a8[_0xa727('0x4c')][_0xa727('0x53')]('nolimit')){_0x4fa4db['limit']=qs[_0xa727('0x36')](_0x1e33a8[_0xa727('0x4c')]['limit']);_0x4fa4db[_0xa727('0x38')]=qs[_0xa727('0x38')](_0x1e33a8['query'][_0xa727('0x38')]);}return _0x3595c3['getApplications'](_0x4fa4db);}})[_0xa727('0x28')](function(_0x27b9d2){if(_0x27b9d2){return _0x27b9d2?{'count':_0x470540,'rows':_0x27b9d2}:null;}})[_0xa727('0x28')](respondWithResult(_0x10f9bf,null))[_0xa727('0x31')](handleError(_0x10f9bf,null));};exports[_0xa727('0xb5')]=function(_0x45e866,_0x457352,_0x1c3c61){var _0x1d15e4={'raw':![],'where':{}};var _0x4f7f3a={};var _0x349961={'count':0x0,'rows':[]};return db[_0xa727('0x48')][_0xa727('0x6f')]({'where':{'id':_0x45e866[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x457352,null))['then'](function(_0x36006c){if(_0x36006c){_0x4f7f3a[_0xa727('0x4f')]=_[_0xa727('0x60')](db['OpenchannelInteraction']['rawAttributes']);_0x4f7f3a[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x45e866['query']);_0x4f7f3a[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x4f7f3a['model'],_0x4f7f3a['query']);_0x1d15e4['attributes']=_[_0xa727('0x4e')](_0x4f7f3a[_0xa727('0x4f')],qs[_0xa727('0x50')](_0x45e866[_0xa727('0x4c')][_0xa727('0x50')]));_0x1d15e4[_0xa727('0x51')]=_0x1d15e4[_0xa727('0x51')][_0xa727('0x52')]?_0x1d15e4[_0xa727('0x51')]:_0x4f7f3a[_0xa727('0x4f')];if(!_0x45e866['query'][_0xa727('0x53')](_0xa727('0x70'))){_0x1d15e4[_0xa727('0x36')]=qs[_0xa727('0x36')](_0x45e866[_0xa727('0x4c')][_0xa727('0x36')]);_0x1d15e4['offset']=qs['offset'](_0x45e866[_0xa727('0x4c')]['offset']);}_0x1d15e4[_0xa727('0x71')]=qs[_0xa727('0x54')](_0x45e866[_0xa727('0x4c')]['sort']);_0x1d15e4[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0x45e866[_0xa727('0x4c')],_0x4f7f3a[_0xa727('0x4d')]));_0x1d15e4['where'][_0xa727('0x6d')]=_0x36006c['id'];if(_0x45e866[_0xa727('0x4c')]['filter']){_0x1d15e4[_0xa727('0x55')]=_['merge'](_0x1d15e4['where'],{'$or':_[_0xa727('0x47')](_0x1d15e4['attributes'],function(_0x4cbbd4){var _0x4e27c2={};_0x4e27c2[_0x4cbbd4]={'$like':'%'+_0x45e866[_0xa727('0x4c')][_0xa727('0x57')]+'%'};return _0x4e27c2;})});}_0x1d15e4=_[_0xa727('0x59')]({},_0x1d15e4,_0x45e866[_0xa727('0x5a')]);return db[_0xa727('0x94')][_0xa727('0x37')]({'where':_0x1d15e4[_0xa727('0x55')]})[_0xa727('0x28')](function(_0xf05493){_0x349961['count']=_0xf05493;if(_0x45e866['query'][_0xa727('0x5b')]){_0x1d15e4['include']=[{'model':db[_0xa727('0x79')],'as':_0xa727('0xb6'),'required':![]},{'model':db[_0xa727('0xa0')],'as':_0xa727('0xb7'),'attributes':[_0xa727('0x42'),_0xa727('0xb8'),_0xa727('0xb9')],'required':![]},{'model':db[_0xa727('0xba')],'as':'Tags','attributes':['id',_0xa727('0x42'),_0xa727('0xbb')],'where':_0x45e866['query'][_0xa727('0xbc')]?{'id':_0x45e866[_0xa727('0x4c')][_0xa727('0xbc')]}:undefined,'required':_0x45e866[_0xa727('0x4c')][_0xa727('0xbc')]?!![]:![]}];}return db[_0xa727('0x94')][_0xa727('0x76')](_0x1d15e4);})[_0xa727('0x28')](function(_0x4e8e94){_0x349961[_0xa727('0x5d')]=_0x4e8e94;return _0x349961;});}})[_0xa727('0x28')](respondWithFilteredResult(_0x457352,_0x1d15e4))[_0xa727('0x31')](handleError(_0x457352,null));};exports['addAgents']=function(_0x2c1e35,_0xced1d,_0x104b89){return db[_0xa727('0x48')][_0xa727('0x61')]({'where':{'id':_0x2c1e35[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0xced1d,null))[_0xa727('0x28')](function(_0x5747eb){if(_0x5747eb){return _0x5747eb[_0xa727('0xbd')](_0x2c1e35[_0xa727('0x63')][_0xa727('0x73')],_[_0xa727('0xbe')](_0x2c1e35[_0xa727('0x63')],[_0xa727('0x73'),'id'])||{})['spread'](function(_0x49ee2e){for(var _0x519641=0x0;_0x519641<_0x2c1e35['body']['ids'][_0xa727('0x52')];_0x519641+=0x1){socket[_0xa727('0xbf')](_0xa727('0xc0'),{'UserId':Number(_0x2c1e35[_0xa727('0x63')][_0xa727('0x73')][_0x519641]),'OpenchannelAccountId':Number(_0x2c1e35[_0xa727('0x5f')]['id'])});}return _0x49ee2e;});}})[_0xa727('0x28')](respondWithResult(_0xced1d,null))['catch'](handleError(_0xced1d,null));};exports[_0xa727('0xc1')]=function(_0x53b9d0,_0x49f9b5,_0x41047f){return db['OpenchannelAccount'][_0xa727('0x61')]({'where':{'id':_0x53b9d0[_0xa727('0x5f')]['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x49f9b5,null))[_0xa727('0x28')](function(_0x1f45fb){if(_0x1f45fb){return _0x1f45fb['removeAgents'](_0x53b9d0[_0xa727('0x4c')][_0xa727('0x73')])[_0xa727('0x28')](function(){if(_[_0xa727('0xc2')](_0x53b9d0['query'][_0xa727('0x73')])){for(var _0x47b58f=0x0;_0x47b58f<_0x53b9d0[_0xa727('0x4c')][_0xa727('0x73')]['length'];_0x47b58f+=0x1){socket[_0xa727('0xbf')](_0xa727('0xc3'),{'UserId':Number(_0x53b9d0[_0xa727('0x4c')][_0xa727('0x73')][_0x47b58f]),'OpenchannelAccountId':Number(_0x53b9d0[_0xa727('0x5f')]['id'])});}}else{socket[_0xa727('0xbf')](_0xa727('0xc3'),{'UserId':Number(_0x53b9d0[_0xa727('0x4c')][_0xa727('0x73')]),'OpenchannelAccountId':Number(_0x53b9d0[_0xa727('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x49f9b5,null))[_0xa727('0x31')](handleError(_0x49f9b5,null));};exports[_0xa727('0xc4')]=function(_0x2c1cdc,_0x207ec7,_0x18e1aa){var _0x6f3c07={};var _0x2c96c3={};var _0x5148de;var _0x5c2c3d;return db[_0xa727('0x48')]['findOne']({'where':{'id':_0x2c1cdc[_0xa727('0x5f')]['id']}})['then'](handleEntityNotFound(_0x207ec7,null))[_0xa727('0x28')](function(_0x46298e){if(_0x46298e){_0x5148de=_0x46298e;_0x2c96c3[_0xa727('0x4f')]=_[_0xa727('0x60')](db[_0xa727('0xa0')][_0xa727('0x49')]);_0x2c96c3[_0xa727('0x4c')]=_[_0xa727('0x60')](_0x2c1cdc[_0xa727('0x4c')]);_0x2c96c3[_0xa727('0x4d')]=_[_0xa727('0x4e')](_0x2c96c3['model'],_0x2c96c3[_0xa727('0x4c')]);_0x6f3c07[_0xa727('0x51')]=_[_0xa727('0x4e')](_0x2c96c3[_0xa727('0x4f')],qs[_0xa727('0x50')](_0x2c1cdc['query'][_0xa727('0x50')]));_0x6f3c07[_0xa727('0x51')]=_0x6f3c07[_0xa727('0x51')][_0xa727('0x52')]?_0x6f3c07['attributes']:_0x2c96c3[_0xa727('0x4f')];_0x6f3c07[_0xa727('0x71')]=qs[_0xa727('0x54')](_0x2c1cdc[_0xa727('0x4c')]['sort']);_0x6f3c07[_0xa727('0x55')]=qs[_0xa727('0x4d')](_[_0xa727('0x56')](_0x2c1cdc['query'],_0x2c96c3[_0xa727('0x4d')]));if(_0x2c1cdc['query']['filter']){_0x6f3c07[_0xa727('0x55')]=_[_0xa727('0x59')](_0x6f3c07[_0xa727('0x55')],{'$or':_[_0xa727('0x47')](_0x6f3c07['attributes'],function(_0x5bb43c){var _0x5b5f06={};_0x5b5f06[_0x5bb43c]={'$like':'%'+_0x2c1cdc[_0xa727('0x4c')][_0xa727('0x57')]+'%'};return _0x5b5f06;})});}_0x6f3c07=_['merge']({},_0x6f3c07,_0x2c1cdc[_0xa727('0x5a')]);return _0x5148de[_0xa727('0xc4')](_0x6f3c07);}})['then'](function(_0x3c149a){if(_0x3c149a){_0x5c2c3d=_0x3c149a[_0xa727('0x52')];if(!_0x2c1cdc[_0xa727('0x4c')][_0xa727('0x53')](_0xa727('0x70'))){_0x6f3c07[_0xa727('0x36')]=qs[_0xa727('0x36')](_0x2c1cdc[_0xa727('0x4c')][_0xa727('0x36')]);_0x6f3c07[_0xa727('0x38')]=qs['offset'](_0x2c1cdc['query'][_0xa727('0x38')]);}return _0x5148de[_0xa727('0xc4')](_0x6f3c07);}})[_0xa727('0x28')](function(_0x202ff4){if(_0x202ff4){return _0x202ff4?{'count':_0x5c2c3d,'rows':_0x202ff4}:null;}})['then'](respondWithResult(_0x207ec7,null))[_0xa727('0x31')](handleError(_0x207ec7,null));};exports[_0xa727('0x43')]=function(_0x380913,_0x7b723,_0x550e93){var _0x48c222,_0x5b3965,_0x5ccb55;if(_[_0xa727('0x81')](_0x380913['body']['body'])||_0x380913[_0xa727('0x63')]['body']===''){throw new db['Sequelize'][(_0xa727('0x80'))](_0xa727('0x82'));}if(_[_0xa727('0x81')](_0x380913['body']['to'])){}_0x48c222=_0x380913[_0xa727('0x63')]['to'];return db[_0xa727('0x48')][_0xa727('0x6f')]({'where':{'id':_0x380913['params']['id']}})[_0xa727('0x28')](handleEntityNotFound(_0x7b723,null))[_0xa727('0x28')](function(_0x227de4){if(_0x227de4){return db[_0xa727('0x48')]['find']({'where':{'id':_0x227de4['id']},'include':[{'model':db[_0xa727('0x86')],'as':_0xa727('0x87'),'include':[{'model':db[_0xa727('0x79')],'as':_0xa727('0x8e'),'where':{[_0x227de4[_0xa727('0x83')]]:_0x48c222},'limit':0x1,'order':[[_0xa727('0x88'),_0xa727('0xc5')]]}]}]})[_0xa727('0x28')](handleEntityNotFound(_0x7b723,null))[_0xa727('0x28')](function(_0x3d1984){if(_0x3d1984&&_0x3d1984[_0xa727('0x87')]){_0x5b3965=_0x3d1984[_0xa727('0x3e')]({'plain':!![]});if(_0x5b3965['List']&&_0x5b3965[_0xa727('0x87')][_0xa727('0x8e')][_0xa727('0x52')]){return _0x5b3965[_0xa727('0x87')][_0xa727('0x8e')][0x0];}return db[_0xa727('0x79')][_0xa727('0x62')](_['defaults'](_0x380913[_0xa727('0x63')],{'firstName':_0x48c222,[_0x3d1984[_0xa727('0x83')]]:_0x48c222,'phone':_0x48c222,'ListId':_0x5b3965[_0xa727('0x8f')]}));}})[_0xa727('0x28')](handleEntityNotFound(_0x7b723,null))['then'](function(_0x1d172a){if(_0x1d172a){_0x5ccb55=_0x1d172a;return db[_0xa727('0x94')][_0xa727('0x61')]({'where':{'ContactId':_0x5ccb55['id'],'closed':![],'OpenchannelAccountId':_0x5b3965['id']}})[_0xa727('0x28')](function(_0x7c0056){if(_0x7c0056){return[_0x7c0056,![]];}return db[_0xa727('0x94')][_0xa727('0x62')]({'UserId':_0x380913[_0xa727('0x64')]['id'],'ContactId':_0x5ccb55['id'],'OpenchannelAccountId':_0x5b3965['id'],'lastMsgDirection':'out','firstMsgDirection':_0xa727('0xc6'),'Messages':[_[_0xa727('0x59')](_0x380913[_0xa727('0x63')],{'read':![],'body':_0x380913[_0xa727('0x63')][_0xa727('0x63')],'OpenchannelAccountId':_0x5b3965['id'],'UserId':_0x380913[_0xa727('0x64')]['id'],'ContactId':_0x5ccb55['id']})]},{'include':[{'model':db[_0xa727('0x9f')],'as':_0xa727('0xc7')}]})[_0xa727('0x28')](function(_0x415bab){return[_0x415bab,!![]];});});}})['spread'](function(_0x5ee8a6,_0x446c06){if(_0x446c06){return _0x5ee8a6;}return db['OpenchannelMessage'][_0xa727('0x62')](_['merge'](_0x380913[_0xa727('0x63')],{'read':![],'body':_0x380913[_0xa727('0x63')][_0xa727('0x63')],'OpenchannelAccountId':_0x5b3965['id'],'OpenchannelInteractionId':_0x5ee8a6['id'],'UserId':_0x380913[_0xa727('0x64')]['id'],'ContactId':_0x5ccb55['id']}))['then'](function(_0x3c2852){_0x5ee8a6[_0xa727('0xc8')][_0xa727('0xc7')]=[];_0x5ee8a6[_0xa727('0xc8')]['Messages']['push'](_0x3c2852[_0xa727('0xc8')]);return _0x5ee8a6;});});}})['then'](respondWithResult(_0x7b723,null))[_0xa727('0x31')](handleError(_0x7b723,null));}; \ No newline at end of file +var _0x4ca4=['CompanyId','isNil','from','from\x20is\x20mandatory','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','asc','defaults','ListId','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','Start','startRouting','EventManager','addApplications','transaction','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','priority','finally','getApplications','User','fullname','Tag','Tags','color','tag','addAgents','omit','spread','emit','removeAgents','isArray','getAgents','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','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','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','update','destroy','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','Pause','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','OpenchannelAccounts','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','rawAttributes','OpenchannelAccountId','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','difference','createdAt','updatedAt'];(function(_0x36005e,_0x100293){var _0x5dfb56=function(_0x5c94fd){while(--_0x5c94fd){_0x36005e['push'](_0x36005e['shift']());}};_0x5dfb56(++_0x100293);}(_0x4ca4,0x100));var _0x44ca=function(_0x402845,_0x2358fb){_0x402845=_0x402845-0x0;var _0x4c8654=_0x4ca4[_0x402845];return _0x4c8654;};'use strict';var emlformat=require(_0x44ca('0x0'));var rimraf=require(_0x44ca('0x1'));var zipdir=require(_0x44ca('0x2'));var jsonpatch=require(_0x44ca('0x3'));var rp=require(_0x44ca('0x4'));var moment=require(_0x44ca('0x5'));var BPromise=require(_0x44ca('0x6'));var Mustache=require(_0x44ca('0x7'));var util=require('util');var path=require(_0x44ca('0x8'));var sox=require(_0x44ca('0x9'));var csv=require(_0x44ca('0xa'));var ejs=require(_0x44ca('0xb'));var fs=require('fs');var fs_extra=require(_0x44ca('0xc'));var _=require(_0x44ca('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x44ca('0xe'));var toCsv=require(_0x44ca('0xa'));var querystring=require('querystring');var Papa=require(_0x44ca('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x44ca('0x10'));var as=require(_0x44ca('0x11'));var hardwareService=require(_0x44ca('0x12'));var logger=require(_0x44ca('0x13'))(_0x44ca('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x44ca('0x15'));var db=require(_0x44ca('0x16'))['db'];config['redis']=_['defaults'](config[_0x44ca('0x17')],{'host':_0x44ca('0x18'),'port':0x18eb});var socket=require(_0x44ca('0x19'))(new Redis(config[_0x44ca('0x17')]));require(_0x44ca('0x1a'))[_0x44ca('0x1b')](socket);var jayson=require(_0x44ca('0x1c'));var client=jayson[_0x44ca('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x44ca('0x1d')][_0x44ca('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x50fb0d,_0x334e34,_0x2c7da3,_0x598619){return new BPromise(function(_0x1248a4,_0xde3fa0){var _0x1dc8ce=_0x598619||client;return _0x1dc8ce[_0x44ca('0x1f')](_0x50fb0d,_0x2c7da3)[_0x44ca('0x20')](function(_0x3b4626){logger[_0x44ca('0x21')](_0x44ca('0x22'),_0x334e34,_0x44ca('0x23'));logger['debug'](_0x44ca('0x24'),_0x334e34,_0x44ca('0x23'),JSON[_0x44ca('0x25')](_0x3b4626));if(_0x3b4626[_0x44ca('0x26')]){if(_0x3b4626['error'][_0x44ca('0x27')]===0x1f4){logger['error'](_0x44ca('0x22'),_0x334e34,_0x3b4626[_0x44ca('0x26')]['message']);return _0xde3fa0(_0x3b4626[_0x44ca('0x26')][_0x44ca('0x28')]);}logger[_0x44ca('0x26')](_0x44ca('0x22'),_0x334e34,_0x3b4626['error'][_0x44ca('0x28')]);return _0x1248a4(_0x3b4626['error'][_0x44ca('0x28')]);}else{logger[_0x44ca('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x334e34,'request\x20sent');_0x1248a4(_0x3b4626['result']['message']);}})[_0x44ca('0x29')](function(_0x15c454){logger['error'](_0x44ca('0x22'),_0x334e34,_0x15c454);_0xde3fa0(_0x15c454);});});}function respondWithStatusCode(_0xe25e10,_0xb75196){_0xb75196=_0xb75196||0xcc;return function(_0x1affc6){if(_0x1affc6){return _0xe25e10[_0x44ca('0x2a')](_0xb75196);}return _0xe25e10[_0x44ca('0x2b')](_0xb75196)[_0x44ca('0x2c')]();};}function respondWithResult(_0x97c546,_0x70635b){_0x70635b=_0x70635b||0xc8;return function(_0x1c7bd2){if(_0x1c7bd2){return _0x97c546[_0x44ca('0x2b')](_0x70635b)[_0x44ca('0x2d')](_0x1c7bd2);}};}function respondWithFilteredResult(_0x529705,_0x8fe148){return function(_0x58da42){if(_0x58da42){var _0x38187b=typeof _0x8fe148['offset']===_0x44ca('0x2e')&&typeof _0x8fe148[_0x44ca('0x2f')]==='undefined';var _0x1184a0=_0x58da42['count'];var _0x4e0a2b=_0x38187b?0x0:_0x8fe148[_0x44ca('0x30')];var _0x4e0669=_0x38187b?_0x58da42[_0x44ca('0x31')]:_0x8fe148[_0x44ca('0x30')]+_0x8fe148[_0x44ca('0x2f')];var _0x531ec9;if(_0x4e0669>=_0x1184a0){_0x4e0669=_0x1184a0;_0x531ec9=0xc8;}else{_0x531ec9=0xce;}_0x529705['status'](_0x531ec9);return _0x529705['set'](_0x44ca('0x32'),_0x4e0a2b+'-'+_0x4e0669+'/'+_0x1184a0)[_0x44ca('0x2d')](_0x58da42);}return null;};}function patchUpdates(_0x5015be){return function(_0x42e11f){try{jsonpatch['apply'](_0x42e11f,_0x5015be,!![]);}catch(_0xd74e40){return BPromise[_0x44ca('0x33')](_0xd74e40);}return _0x42e11f[_0x44ca('0x34')]();};}function saveUpdates(_0x4700e4,_0x290dd3){return function(_0x3ab1dc){if(_0x3ab1dc){return _0x3ab1dc[_0x44ca('0x35')](_0x4700e4)[_0x44ca('0x20')](function(_0x320d10){return _0x320d10;});}return null;};}function removeEntity(_0x1d158c,_0x1f981d){return function(_0x31fad8){if(_0x31fad8){return _0x31fad8[_0x44ca('0x36')]()[_0x44ca('0x20')](function(){var _0x5648df=_0x31fad8['get']({'plain':!![]});var _0x101521='OpenchannelAccounts';return db[_0x44ca('0x37')]['destroy']({'where':{'type':_0x101521,'resourceId':_0x5648df['id']}})[_0x44ca('0x20')](function(){return _0x31fad8;});})[_0x44ca('0x20')](function(){_0x1d158c[_0x44ca('0x2b')](0xcc)[_0x44ca('0x2c')]();});}};}function handleEntityNotFound(_0x34de91,_0x1adb67){return function(_0x39cf26){if(!_0x39cf26){_0x34de91[_0x44ca('0x2a')](0x194);}return _0x39cf26;};}function handleError(_0x410e1c,_0x201aa2){_0x201aa2=_0x201aa2||0x1f4;return function(_0x142154){logger[_0x44ca('0x26')](_0x142154[_0x44ca('0x38')]);if(_0x142154[_0x44ca('0x39')]){delete _0x142154[_0x44ca('0x39')];}_0x410e1c[_0x44ca('0x2b')](_0x201aa2)[_0x44ca('0x3a')](_0x142154);};}exports[_0x44ca('0x3b')]=function(_0x5ea125,_0x3c99b8){var _0x5a8868={'include':[{'model':db['Pause'],'as':_0x44ca('0x3c')}]},_0x105753={},_0x3e51b2={'count':0x0,'rows':[]};var _0x1dca02=_[_0x44ca('0x3d')](db[_0x44ca('0x3e')]['rawAttributes'],function(_0x356a03){return{'name':_0x356a03[_0x44ca('0x3f')],'type':_0x356a03[_0x44ca('0x40')]['key']};});_0x105753['model']=_[_0x44ca('0x3d')](_0x1dca02,_0x44ca('0x39'));_0x105753[_0x44ca('0x41')]=_[_0x44ca('0x42')](_0x5ea125[_0x44ca('0x41')]);_0x105753[_0x44ca('0x43')]=_[_0x44ca('0x44')](_0x105753[_0x44ca('0x45')],_0x105753[_0x44ca('0x41')]);_0x5a8868[_0x44ca('0x46')]=_[_0x44ca('0x44')](_0x105753[_0x44ca('0x45')],qs[_0x44ca('0x47')](_0x5ea125[_0x44ca('0x41')][_0x44ca('0x47')]));_0x5a8868['attributes']=_0x5a8868[_0x44ca('0x46')][_0x44ca('0x48')]?_0x5a8868[_0x44ca('0x46')]:_0x105753[_0x44ca('0x45')];if(!_0x5ea125[_0x44ca('0x41')][_0x44ca('0x49')](_0x44ca('0x4a'))){_0x5a8868[_0x44ca('0x2f')]=qs[_0x44ca('0x2f')](_0x5ea125[_0x44ca('0x41')][_0x44ca('0x2f')]);_0x5a8868[_0x44ca('0x30')]=qs[_0x44ca('0x30')](_0x5ea125[_0x44ca('0x41')][_0x44ca('0x30')]);}_0x5a8868[_0x44ca('0x4b')]=qs[_0x44ca('0x4c')](_0x5ea125[_0x44ca('0x41')][_0x44ca('0x4c')]);_0x5a8868[_0x44ca('0x4d')]=qs['filters'](_[_0x44ca('0x4e')](_0x5ea125[_0x44ca('0x41')],_0x105753[_0x44ca('0x43')]),_0x1dca02);if(_0x5ea125[_0x44ca('0x41')][_0x44ca('0x4f')]){_0x5a8868['where']=_[_0x44ca('0x50')](_0x5a8868[_0x44ca('0x4d')],{'$or':_[_0x44ca('0x3d')](_0x1dca02,function(_0x186820){if(_0x186820[_0x44ca('0x40')]!==_0x44ca('0x51')){var _0x56042e={};_0x56042e[_0x186820['name']]={'$like':'%'+_0x5ea125[_0x44ca('0x41')][_0x44ca('0x4f')]+'%'};return _0x56042e;}})});}_0x5a8868=_[_0x44ca('0x50')]({},_0x5a8868,_0x5ea125[_0x44ca('0x52')]);var _0x181914={'where':_0x5a8868[_0x44ca('0x4d')]};return db[_0x44ca('0x3e')][_0x44ca('0x31')](_0x181914)[_0x44ca('0x20')](function(_0x2525b7){_0x3e51b2[_0x44ca('0x31')]=_0x2525b7;if(_0x5ea125[_0x44ca('0x41')]['includeAll']){_0x5a8868['include']=[{'all':!![]}];}return db[_0x44ca('0x3e')][_0x44ca('0x53')](_0x5a8868);})[_0x44ca('0x20')](function(_0x4c8b07){_0x3e51b2[_0x44ca('0x54')]=_0x4c8b07;return _0x3e51b2;})['then'](respondWithFilteredResult(_0x3c99b8,_0x5a8868))['catch'](handleError(_0x3c99b8,null));};exports[_0x44ca('0x55')]=function(_0x4e022f,_0x4051dd){var _0x1dfd69={'raw':![],'where':{'id':_0x4e022f[_0x44ca('0x56')]['id']},'include':[{'model':db[_0x44ca('0x57')],'as':_0x44ca('0x3c')}]},_0x3584a8={};_0x3584a8[_0x44ca('0x45')]=_[_0x44ca('0x42')](db[_0x44ca('0x3e')]['rawAttributes']);_0x3584a8['query']=_[_0x44ca('0x42')](_0x4e022f[_0x44ca('0x41')]);_0x3584a8['filters']=_[_0x44ca('0x44')](_0x3584a8[_0x44ca('0x45')],_0x3584a8['query']);_0x1dfd69[_0x44ca('0x46')]=_['intersection'](_0x3584a8['model'],qs[_0x44ca('0x47')](_0x4e022f[_0x44ca('0x41')][_0x44ca('0x47')]));_0x1dfd69[_0x44ca('0x46')]=_0x1dfd69[_0x44ca('0x46')][_0x44ca('0x48')]?_0x1dfd69['attributes']:_0x3584a8[_0x44ca('0x45')];if(_0x4e022f[_0x44ca('0x41')][_0x44ca('0x58')]){_0x1dfd69[_0x44ca('0x59')]=[{'all':!![]}];}_0x1dfd69=_['merge']({},_0x1dfd69,_0x4e022f[_0x44ca('0x52')]);return db['OpenchannelAccount'][_0x44ca('0x5a')](_0x1dfd69)[_0x44ca('0x20')](handleEntityNotFound(_0x4051dd,null))[_0x44ca('0x20')](respondWithResult(_0x4051dd,null))[_0x44ca('0x29')](handleError(_0x4051dd,null));};exports[_0x44ca('0x5b')]=function(_0x17cd91,_0x4c4730){return db[_0x44ca('0x3e')]['create'](_0x17cd91['body'],{})[_0x44ca('0x20')](function(_0x420c24){var _0x2b3cd1=_0x17cd91[_0x44ca('0x5c')]['get']({'plain':!![]});if(!_0x2b3cd1)throw new Error(_0x44ca('0x5d'));if(_0x2b3cd1['role']===_0x44ca('0x5c')){var _0x274102=_0x420c24[_0x44ca('0x5e')]({'plain':!![]});var _0xadc02d=_0x44ca('0x5f');return db[_0x44ca('0x60')]['find']({'where':{'name':_0xadc02d,'userProfileId':_0x2b3cd1['userProfileId']},'raw':!![]})[_0x44ca('0x20')](function(_0x1c5c02){if(_0x1c5c02&&_0x1c5c02['autoAssociation']===0x0){return db[_0x44ca('0x37')]['create']({'name':_0x274102[_0x44ca('0x39')],'resourceId':_0x274102['id'],'type':_0x1c5c02['name'],'sectionId':_0x1c5c02['id']},{})[_0x44ca('0x20')](function(){return _0x420c24;});}else{return _0x420c24;}})[_0x44ca('0x29')](function(_0x4e5396){logger[_0x44ca('0x26')](_0x44ca('0x61'),_0x4e5396);throw _0x4e5396;});}return _0x420c24;})[_0x44ca('0x20')](respondWithResult(_0x4c4730,0xc9))[_0x44ca('0x29')](handleError(_0x4c4730,null));};exports[_0x44ca('0x35')]=function(_0x29193a,_0x142eca){if(_0x29193a[_0x44ca('0x62')]['id']){delete _0x29193a['body']['id'];}return db[_0x44ca('0x3e')][_0x44ca('0x5a')]({'where':{'id':_0x29193a[_0x44ca('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x44ca('0x3c')}]})[_0x44ca('0x20')](handleEntityNotFound(_0x142eca,null))[_0x44ca('0x20')](saveUpdates(_0x29193a[_0x44ca('0x62')],null))[_0x44ca('0x20')](respondWithResult(_0x142eca,null))['catch'](handleError(_0x142eca,null));};exports[_0x44ca('0x36')]=function(_0x229f34,_0x3a7168){return db['OpenchannelAccount'][_0x44ca('0x5a')]({'where':{'id':_0x229f34[_0x44ca('0x56')]['id']}})[_0x44ca('0x20')](handleEntityNotFound(_0x3a7168,null))['then'](removeEntity(_0x3a7168,null))['catch'](handleError(_0x3a7168,null));};exports['describe']=function(_0x2762e2,_0x20e6f9){return db[_0x44ca('0x3e')][_0x44ca('0x63')]()[_0x44ca('0x20')](respondWithResult(_0x20e6f9,null))[_0x44ca('0x29')](handleError(_0x20e6f9,null));};exports[_0x44ca('0x64')]=function(_0x5902b1,_0x2b0aca,_0x58bc47){if(_0x5902b1[_0x44ca('0x62')]['id']){delete _0x5902b1[_0x44ca('0x62')]['id'];}return db['OpenchannelAccount'][_0x44ca('0x5a')]({'where':{'id':_0x5902b1[_0x44ca('0x56')]['id']}})['then'](handleEntityNotFound(_0x2b0aca,null))[_0x44ca('0x20')](function(_0x43e6b6){if(_0x43e6b6){_0x5902b1['body']['OpenchannelAccountId']=_0x43e6b6['id'];return db[_0x44ca('0x65')][_0x44ca('0x5b')](_0x5902b1['body']);}})[_0x44ca('0x20')](respondWithResult(_0x2b0aca,null))[_0x44ca('0x29')](handleError(_0x2b0aca,null));};exports['getDispositions']=function(_0x2d8935,_0x44b850,_0x9b9125){var _0xc88b7f={'raw':![],'where':{}};var _0x200286={};var _0x1ed028={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2d8935[_0x44ca('0x56')]['id']}})[_0x44ca('0x20')](handleEntityNotFound(_0x44b850,null))['then'](function(_0x31daca){if(_0x31daca){_0x200286[_0x44ca('0x45')]=_[_0x44ca('0x42')](db[_0x44ca('0x65')][_0x44ca('0x66')]);_0x200286[_0x44ca('0x41')]=_[_0x44ca('0x42')](_0x2d8935[_0x44ca('0x41')]);_0x200286['filters']=_[_0x44ca('0x44')](_0x200286[_0x44ca('0x45')],_0x200286[_0x44ca('0x41')]);_0xc88b7f[_0x44ca('0x46')]=_[_0x44ca('0x44')](_0x200286['model'],qs[_0x44ca('0x47')](_0x2d8935['query'][_0x44ca('0x47')]));_0xc88b7f[_0x44ca('0x46')]=_0xc88b7f[_0x44ca('0x46')][_0x44ca('0x48')]?_0xc88b7f[_0x44ca('0x46')]:_0x200286[_0x44ca('0x45')];if(!_0x2d8935[_0x44ca('0x41')][_0x44ca('0x49')]('nolimit')){_0xc88b7f[_0x44ca('0x2f')]=qs['limit'](_0x2d8935[_0x44ca('0x41')][_0x44ca('0x2f')]);_0xc88b7f['offset']=qs[_0x44ca('0x30')](_0x2d8935[_0x44ca('0x41')][_0x44ca('0x30')]);}_0xc88b7f['order']=qs[_0x44ca('0x4c')](_0x2d8935[_0x44ca('0x41')][_0x44ca('0x4c')]);_0xc88b7f['where']=qs[_0x44ca('0x43')](_[_0x44ca('0x4e')](_0x2d8935[_0x44ca('0x41')],_0x200286[_0x44ca('0x43')]));_0xc88b7f[_0x44ca('0x4d')][_0x44ca('0x67')]=_0x31daca['id'];if(_0x2d8935[_0x44ca('0x41')]['filter']){_0xc88b7f['where']=_[_0x44ca('0x50')](_0xc88b7f['where'],{'$or':_[_0x44ca('0x3d')](_0xc88b7f[_0x44ca('0x46')],function(_0x169036){var _0x3366d8={};_0x3366d8[_0x169036]={'$like':'%'+_0x2d8935[_0x44ca('0x41')]['filter']+'%'};return _0x3366d8;})});}_0xc88b7f=_[_0x44ca('0x50')]({},_0xc88b7f,_0x2d8935[_0x44ca('0x52')]);return db['Disposition'][_0x44ca('0x31')]({'where':_0xc88b7f['where']})[_0x44ca('0x20')](function(_0x40ae55){_0x1ed028[_0x44ca('0x31')]=_0x40ae55;if(_0x2d8935[_0x44ca('0x41')][_0x44ca('0x58')]){_0xc88b7f[_0x44ca('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xc88b7f);})['then'](function(_0x208d13){_0x1ed028['rows']=_0x208d13;return _0x1ed028;});}})[_0x44ca('0x20')](respondWithFilteredResult(_0x44b850,_0xc88b7f))[_0x44ca('0x29')](handleError(_0x44b850,null));};exports['removeDispositions']=function(_0x2301ca,_0x528c2b,_0x30bcd7){return db[_0x44ca('0x3e')]['find']({'where':{'id':_0x2301ca[_0x44ca('0x56')]['id']}})[_0x44ca('0x20')](handleEntityNotFound(_0x528c2b,null))[_0x44ca('0x20')](function(_0x5886f7){if(_0x5886f7){return _0x5886f7[_0x44ca('0x68')](_0x2301ca[_0x44ca('0x41')][_0x44ca('0x69')]);}})['then'](respondWithStatusCode(_0x528c2b,null))[_0x44ca('0x29')](handleError(_0x528c2b,null));};exports[_0x44ca('0x6a')]=function(_0x31b706,_0x3f1d2c,_0xcae3b9){if(_0x31b706[_0x44ca('0x62')]['id']){delete _0x31b706[_0x44ca('0x62')]['id'];}return db[_0x44ca('0x3e')][_0x44ca('0x5a')]({'where':{'id':_0x31b706[_0x44ca('0x56')]['id']}})[_0x44ca('0x20')](handleEntityNotFound(_0x3f1d2c,null))[_0x44ca('0x20')](function(_0x55f741){if(_0x55f741){_0x31b706[_0x44ca('0x62')][_0x44ca('0x67')]=_0x55f741['id'];return db['CannedAnswer'][_0x44ca('0x5b')](_0x31b706[_0x44ca('0x62')]);}})[_0x44ca('0x20')](respondWithResult(_0x3f1d2c,null))[_0x44ca('0x29')](handleError(_0x3f1d2c,null));};exports[_0x44ca('0x6b')]=function(_0x46b49f,_0xd38ca0,_0x287d83){var _0x3688a5={'raw':![],'where':{}};var _0x3f1853={};var _0x3bb8b8={'count':0x0,'rows':[]};return db[_0x44ca('0x3e')][_0x44ca('0x6c')]({'where':{'id':_0x46b49f[_0x44ca('0x56')]['id']}})['then'](handleEntityNotFound(_0xd38ca0,null))[_0x44ca('0x20')](function(_0x36b9c2){if(_0x36b9c2){_0x3f1853['model']=_[_0x44ca('0x42')](db[_0x44ca('0x6d')]['rawAttributes']);_0x3f1853[_0x44ca('0x41')]=_[_0x44ca('0x42')](_0x46b49f[_0x44ca('0x41')]);_0x3f1853['filters']=_['intersection'](_0x3f1853['model'],_0x3f1853['query']);_0x3688a5[_0x44ca('0x46')]=_[_0x44ca('0x44')](_0x3f1853[_0x44ca('0x45')],qs[_0x44ca('0x47')](_0x46b49f[_0x44ca('0x41')][_0x44ca('0x47')]));_0x3688a5['attributes']=_0x3688a5[_0x44ca('0x46')][_0x44ca('0x48')]?_0x3688a5['attributes']:_0x3f1853[_0x44ca('0x45')];if(!_0x46b49f[_0x44ca('0x41')][_0x44ca('0x49')](_0x44ca('0x4a'))){_0x3688a5[_0x44ca('0x2f')]=qs[_0x44ca('0x2f')](_0x46b49f[_0x44ca('0x41')][_0x44ca('0x2f')]);_0x3688a5[_0x44ca('0x30')]=qs['offset'](_0x46b49f[_0x44ca('0x41')]['offset']);}_0x3688a5[_0x44ca('0x4b')]=qs[_0x44ca('0x4c')](_0x46b49f['query'][_0x44ca('0x4c')]);_0x3688a5[_0x44ca('0x4d')]=qs['filters'](_[_0x44ca('0x4e')](_0x46b49f[_0x44ca('0x41')],_0x3f1853[_0x44ca('0x43')]));_0x3688a5[_0x44ca('0x4d')][_0x44ca('0x67')]=_0x36b9c2['id'];if(_0x46b49f[_0x44ca('0x41')][_0x44ca('0x4f')]){_0x3688a5[_0x44ca('0x4d')]=_['merge'](_0x3688a5[_0x44ca('0x4d')],{'$or':_[_0x44ca('0x3d')](_0x3688a5['attributes'],function(_0x512ac5){var _0x41d77d={};_0x41d77d[_0x512ac5]={'$like':'%'+_0x46b49f[_0x44ca('0x41')][_0x44ca('0x4f')]+'%'};return _0x41d77d;})});}_0x3688a5=_['merge']({},_0x3688a5,_0x46b49f[_0x44ca('0x52')]);return db['CannedAnswer'][_0x44ca('0x31')]({'where':_0x3688a5[_0x44ca('0x4d')]})[_0x44ca('0x20')](function(_0x4696cc){_0x3bb8b8[_0x44ca('0x31')]=_0x4696cc;if(_0x46b49f[_0x44ca('0x41')][_0x44ca('0x58')]){_0x3688a5[_0x44ca('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x44ca('0x53')](_0x3688a5);})[_0x44ca('0x20')](function(_0x38d39d){_0x3bb8b8[_0x44ca('0x54')]=_0x38d39d;return _0x3bb8b8;});}})[_0x44ca('0x20')](respondWithFilteredResult(_0xd38ca0,_0x3688a5))[_0x44ca('0x29')](handleError(_0xd38ca0,null));};exports[_0x44ca('0x6e')]=function(_0x49f9e7,_0x532fba,_0x3d70a2){return db[_0x44ca('0x3e')][_0x44ca('0x5a')]({'where':{'id':_0x49f9e7[_0x44ca('0x56')]['id']}})[_0x44ca('0x20')](handleEntityNotFound(_0x532fba,null))[_0x44ca('0x20')](function(_0x50df8a){if(_0x50df8a){return _0x50df8a[_0x44ca('0x6e')](_0x49f9e7[_0x44ca('0x41')]['ids']);}})[_0x44ca('0x20')](respondWithStatusCode(_0x532fba,null))[_0x44ca('0x29')](handleError(_0x532fba,null));};exports[_0x44ca('0x6f')]=function(_0x107e48,_0x14e1ec,_0x522665){var _0x5e6a01={'body':_0x107e48[_0x44ca('0x62')],'channel':_0x44ca('0x70')};var _0x33a0ae=[];var _0xe46607=[];var _0x291433={};var _0x59fb0f=![];return db[_0x44ca('0x71')][_0x44ca('0x63')]()[_0x44ca('0x20')](function(_0x473f6d){if(!_0x473f6d){throw new db[(_0x44ca('0x72'))]['ValidationError']('no\x20available\x20attributes');}_0x33a0ae=_[_0x44ca('0x73')](_[_0x44ca('0x42')](_0x473f6d),[_0x44ca('0x74'),'updatedAt']);_0xe46607=_[_0x44ca('0x73')](_[_0x44ca('0x42')](_0x473f6d),[_0x44ca('0x74'),_0x44ca('0x75'),_0x44ca('0x76'),'ListId']);if(_0x107e48[_0x44ca('0x62')]['id']){delete _0x107e48['body']['id'];}if(_[_0x44ca('0x77')](_0x107e48[_0x44ca('0x62')][_0x44ca('0x78')])){throw new db[(_0x44ca('0x72'))]['ValidationError'](_0x44ca('0x79'));}if(_[_0x44ca('0x77')](_0x107e48[_0x44ca('0x62')]['body'])||_0x107e48[_0x44ca('0x62')][_0x44ca('0x62')]===''){throw new db[(_0x44ca('0x72'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x107e48[_0x44ca('0x62')]['mapKey'])){throw new db[(_0x44ca('0x72'))][(_0x44ca('0x7a'))](_0x44ca('0x7b')+_0xe46607);}if(!_[_0x44ca('0x7c')](_0xe46607,_0x107e48[_0x44ca('0x62')][_0x44ca('0x7d')])){throw new db['Sequelize'][(_0x44ca('0x7a'))](_0x44ca('0x7e')+_0xe46607);}_0x291433[_0x107e48[_0x44ca('0x62')][_0x44ca('0x7d')]]=_0x107e48[_0x44ca('0x62')][_0x44ca('0x78')];})[_0x44ca('0x20')](function(){return db[_0x44ca('0x3e')][_0x44ca('0x5a')]({'where':{'id':_0x107e48[_0x44ca('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0x44ca('0x7f'),'include':[{'model':db[_0x44ca('0x71')],'as':_0x44ca('0x80'),'where':_0x291433,'limit':0x1,'order':[[_0x44ca('0x75'),_0x44ca('0x81')]]}]},{'model':db[_0x44ca('0x82')],'as':'Applications'}]});})[_0x44ca('0x20')](handleEntityNotFound(_0x14e1ec,null))[_0x44ca('0x20')](function(_0x4a4f3d){if(_0x4a4f3d&&_0x4a4f3d[_0x44ca('0x7f')]){_0x5e6a01[_0x44ca('0x83')]=_0x4a4f3d;_0x5e6a01[_0x44ca('0x84')]=_0x4a4f3d[_0x44ca('0x85')];_0x5e6a01[_0x44ca('0x86')]=_0x4a4f3d[_0x44ca('0x7f')];_0x5e6a01['applications']=_['orderBy'](_0x5e6a01[_0x44ca('0x84')],['priority'],[_0x44ca('0x87')]);if(_0x5e6a01[_0x44ca('0x83')]['Applications']){delete _0x5e6a01[_0x44ca('0x83')]['Applications'];}if(_0x5e6a01['account']['List']&&_0x5e6a01[_0x44ca('0x83')][_0x44ca('0x7f')][_0x44ca('0x80')][_0x44ca('0x48')]){return _0x5e6a01['account'][_0x44ca('0x7f')][_0x44ca('0x80')][0x0];}var _0x3ec2a1=_[_0x44ca('0x88')](_0x107e48[_0x44ca('0x62')],{'firstName':_0x107e48['body']['from'],'ListId':_0x4a4f3d[_0x44ca('0x89')]});_0x3ec2a1[_0x107e48[_0x44ca('0x62')][_0x44ca('0x7d')]]=_0x107e48[_0x44ca('0x62')][_0x44ca('0x78')];return db[_0x44ca('0x71')][_0x44ca('0x5b')](_0x3ec2a1,{'fields':_0x33a0ae,'raw':!![]});}})['then'](handleEntityNotFound(_0x14e1ec,null))[_0x44ca('0x20')](function(_0xae7190){_0x5e6a01['contact']=_0xae7190;if(_0xae7190){var _0x2afde9={'ContactId':_0xae7190['id'],'OpenchannelAccountId':_0x107e48[_0x44ca('0x56')]['id'],'from':(_0xae7190[_0x44ca('0x8a')]||'')+'\x20'+(_0xae7190[_0x44ca('0x8b')]||'')};var _0x36967d={'OpenchannelAccountId':_0x107e48[_0x44ca('0x56')]['id'],'closed':![]};if(_0x107e48[_0x44ca('0x62')][_0x44ca('0x8c')]){_0x36967d['threadId']=_0x107e48['body'][_0x44ca('0x8c')];return db[_0x44ca('0x8d')]['find']({'where':_0x36967d})[_0x44ca('0x20')](function(_0x2f28d1){if(_0x2f28d1){return[_0x2f28d1,![]];}_0x2afde9[_0x44ca('0x8c')]=_0x107e48[_0x44ca('0x62')]['threadId'];_0x2afde9[_0x44ca('0x8e')]=_0x107e48[_0x44ca('0x62')][_0x44ca('0x8e')];return db[_0x44ca('0x8d')][_0x44ca('0x5b')](_0x2afde9)[_0x44ca('0x20')](function(_0x3b37ba){return[_0x3b37ba,!![]];});});}else{_0x36967d[_0x44ca('0x8c')]=null;}_0x36967d[_0x44ca('0x8f')]=_0xae7190['id'];return db[_0x44ca('0x8d')][_0x44ca('0x5a')]({'where':_0x36967d})['then'](function(_0x220aee){if(_0x220aee){return[_0x220aee,![]];}return db['OpenchannelInteraction'][_0x44ca('0x5b')](_0x2afde9)[_0x44ca('0x20')](function(_0x1434b6){return[_0x1434b6,!![]];});});}})['spread'](function(_0x3313cf,_0x3175a4){if(_0x3313cf){_0x59fb0f=_0x3175a4;if(!_0x3175a4){var _0x34239c={'from':(_0x5e6a01[_0x44ca('0x90')][_0x44ca('0x8a')]||'')+'\x20'+(_0x5e6a01['contact'][_0x44ca('0x8b')]||'')};if(_0x107e48['body'][_0x44ca('0x8c')]&&_0x107e48[_0x44ca('0x62')][_0x44ca('0x91')]&&_0x107e48[_0x44ca('0x62')][_0x44ca('0x8c')]!=_0x107e48[_0x44ca('0x62')][_0x44ca('0x91')]){_0x34239c['threadId']=_0x107e48[_0x44ca('0x62')][_0x44ca('0x91')];}return _0x3313cf['update'](_0x34239c);}else{return _0x3313cf;}}})[_0x44ca('0x20')](function(_0x362c98){_0x5e6a01[_0x44ca('0x92')]=_0x362c98[_0x44ca('0x5e')]({'plain':!![]});_0x5e6a01[_0x44ca('0x92')][_0x44ca('0x93')]=_0x59fb0f;if(_0x5e6a01[_0x44ca('0x92')][_0x44ca('0x93')]){if(_0x5e6a01[_0x44ca('0x83')][_0x44ca('0x94')]){_0x5e6a01[_0x44ca('0x84')][_0x44ca('0x95')]({'id':0x0,'priority':_0x5e6a01['applications'][_0x44ca('0x48')]+0x1,'app':_0x44ca('0x96'),'appdata':_0x44ca('0x97'),'interval':_0x44ca('0x98')});}}return db[_0x44ca('0x99')][_0x44ca('0x5b')]({'body':_0x107e48[_0x44ca('0x62')]['body'],'OpenchannelAccountId':_0x107e48[_0x44ca('0x56')]['id'],'OpenchannelInteractionId':_0x362c98['id'],'direction':'in','ContactId':_0x5e6a01[_0x44ca('0x90')]['id'],'AttachmentId':_0x107e48[_0x44ca('0x62')]['AttachmentId']});})['then'](function(_0x1ddb2e){_0x5e6a01['message']=_0x1ddb2e;if(!_0x5e6a01[_0x44ca('0x92')]['UserId'])return;return db['User'][_0x44ca('0x5a')]({'attributes':['id',_0x44ca('0x39')],'where':{'id':_0x5e6a01[_0x44ca('0x92')]['UserId']}});})[_0x44ca('0x20')](function(_0x19aeae){if(_0x19aeae){_0x5e6a01['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x44ca('0x9a'),'appdata':_0x19aeae['name']+','+(_0x5e6a01[_0x44ca('0x83')][_0x44ca('0x9b')]||0xa),'interval':'*,*,*,*'});}if(!_0x5e6a01[_0x44ca('0x92')][_0x44ca('0x9c')])return;return db[_0x44ca('0x9d')][_0x44ca('0x5a')]({'attributes':['id','name'],'where':{'id':_0x5e6a01[_0x44ca('0x92')]['queueId']}});})[_0x44ca('0x20')](function(_0x5e213c){if(_0x5e213c){_0x5e6a01[_0x44ca('0x84')]['unshift']({'id':0x0,'priority':0x1,'app':_0x44ca('0x9e'),'appdata':_0x5e213c['name']+','+(_0x5e6a01[_0x44ca('0x83')]['waitForTheAssignedQueue']||0x12c),'interval':_0x44ca('0x98')});}return respondWithRpcPromise(_0x44ca('0x9f'),_0x44ca('0xa0'),_0x5e6a01);})['then'](function(_0x3e95a4){respondWithRpcPromise(_0x44ca('0xa1'),'EventManager',{'event':'notify','message':_0x3e95a4},client9002);return _0x3e95a4;})[_0x44ca('0x20')](respondWithResult(_0x14e1ec,null))[_0x44ca('0x29')](handleError(_0x14e1ec,null));};exports[_0x44ca('0xa2')]=function(_0x4802b7,_0xb1c213){var _0x57f642=_0x4802b7[_0x44ca('0x56')]['id'];var _0x10b507=_0x4802b7['body'];var _0x431c9d=0xc8;var _0x8b86f4=null;return db['sequelize'][_0x44ca('0xa3')]({'isolationLevel':db['sequelize'][_0x44ca('0xa4')]['ISOLATION_LEVELS'][_0x44ca('0xa5')]},function(_0xe4342){return db[_0x44ca('0x3e')][_0x44ca('0x6c')]({'where':{'id':_0x57f642},'transaction':_0xe4342})[_0x44ca('0x20')](function(_0x383575){if(_0x383575){return db[_0x44ca('0x82')][_0x44ca('0x36')]({'where':{'OpenchannelAccountId':_0x57f642},'transaction':_0xe4342})[_0x44ca('0x20')](function(){var _0x31e4be=_['map'](_0x10b507,function(_0x4b1387){_0x4b1387[_0x44ca('0x67')]=_0x57f642;return _0x4b1387;});return db[_0x44ca('0x82')][_0x44ca('0xa6')](_0x31e4be,{'transaction':_0xe4342});});}else{_0x431c9d=0x194;_0x8b86f4=[];}});})[_0x44ca('0x20')](function(){if(_0x431c9d!==0x194){return db[_0x44ca('0x82')][_0x44ca('0xa7')]({'where':{'OpenchannelAccountId':_0x57f642},'order':_0x44ca('0xa8')})[_0x44ca('0x20')](function(_0x6ef25a){_0x8b86f4=_0x6ef25a;});}})[_0x44ca('0x29')](function(_0x3463b9){_0x431c9d=0x1f4;logger['error'](_0x3463b9[_0x44ca('0x38')]);if(_0x3463b9[_0x44ca('0x39')]){delete _0x3463b9['name'];}_0x8b86f4=_0x3463b9;})[_0x44ca('0xa9')](function(){if(_0x8b86f4===null){_0xb1c213[_0x44ca('0x2a')](_0x431c9d);}else{if(_0x431c9d===0x1f4){_0xb1c213[_0x44ca('0x2b')](_0x431c9d)[_0x44ca('0x3a')](_0x8b86f4);}else{_0xb1c213['status'](_0x431c9d)['json'](_0x8b86f4);}}});};exports['getApplications']=function(_0x46e757,_0x1b467f,_0x5b4619){var _0x3be74d={};var _0x4990cf={};var _0x1adc80;var _0x31a53c;return db[_0x44ca('0x3e')][_0x44ca('0x6c')]({'where':{'id':_0x46e757[_0x44ca('0x56')]['id']}})[_0x44ca('0x20')](handleEntityNotFound(_0x1b467f,null))[_0x44ca('0x20')](function(_0x52068f){if(_0x52068f){_0x1adc80=_0x52068f;_0x4990cf[_0x44ca('0x45')]=_[_0x44ca('0x42')](db[_0x44ca('0x82')][_0x44ca('0x66')]);_0x4990cf['query']=_['keys'](_0x46e757[_0x44ca('0x41')]);_0x4990cf[_0x44ca('0x43')]=_[_0x44ca('0x44')](_0x4990cf[_0x44ca('0x45')],_0x4990cf['query']);_0x3be74d[_0x44ca('0x46')]=_[_0x44ca('0x44')](_0x4990cf[_0x44ca('0x45')],qs[_0x44ca('0x47')](_0x46e757[_0x44ca('0x41')]['fields']));_0x3be74d[_0x44ca('0x46')]=_0x3be74d[_0x44ca('0x46')][_0x44ca('0x48')]?_0x3be74d[_0x44ca('0x46')]:_0x4990cf[_0x44ca('0x45')];_0x3be74d[_0x44ca('0x4b')]=qs['sort'](_0x46e757[_0x44ca('0x41')][_0x44ca('0x4c')]);_0x3be74d[_0x44ca('0x4d')]=qs['filters'](_[_0x44ca('0x4e')](_0x46e757['query'],_0x4990cf[_0x44ca('0x43')]));if(_0x46e757[_0x44ca('0x41')]['filter']){_0x3be74d[_0x44ca('0x4d')]=_[_0x44ca('0x50')](_0x3be74d[_0x44ca('0x4d')],{'$or':_[_0x44ca('0x3d')](_0x3be74d['attributes'],function(_0x55e59c){var _0x23141f={};_0x23141f[_0x55e59c]={'$like':'%'+_0x46e757[_0x44ca('0x41')][_0x44ca('0x4f')]+'%'};return _0x23141f;})});}_0x3be74d=_[_0x44ca('0x50')]({},_0x3be74d,_0x46e757[_0x44ca('0x52')]);return _0x1adc80[_0x44ca('0xaa')](_0x3be74d);}})[_0x44ca('0x20')](function(_0x578f1f){if(_0x578f1f){_0x31a53c=_0x578f1f['length'];if(!_0x46e757[_0x44ca('0x41')][_0x44ca('0x49')](_0x44ca('0x4a'))){_0x3be74d['limit']=qs[_0x44ca('0x2f')](_0x46e757[_0x44ca('0x41')]['limit']);_0x3be74d['offset']=qs[_0x44ca('0x30')](_0x46e757[_0x44ca('0x41')][_0x44ca('0x30')]);}return _0x1adc80['getApplications'](_0x3be74d);}})[_0x44ca('0x20')](function(_0x323f59){if(_0x323f59){return _0x323f59?{'count':_0x31a53c,'rows':_0x323f59}:null;}})[_0x44ca('0x20')](respondWithResult(_0x1b467f,null))[_0x44ca('0x29')](handleError(_0x1b467f,null));};exports['getInteractions']=function(_0x38b987,_0x3fb5c5,_0x255d34){var _0x588b9={'raw':![],'where':{}};var _0x4ac75e={};var _0x4dec49={'count':0x0,'rows':[]};return db[_0x44ca('0x3e')][_0x44ca('0x6c')]({'where':{'id':_0x38b987[_0x44ca('0x56')]['id']}})[_0x44ca('0x20')](handleEntityNotFound(_0x3fb5c5,null))[_0x44ca('0x20')](function(_0x2a3260){if(_0x2a3260){_0x4ac75e[_0x44ca('0x45')]=_[_0x44ca('0x42')](db[_0x44ca('0x8d')][_0x44ca('0x66')]);_0x4ac75e[_0x44ca('0x41')]=_[_0x44ca('0x42')](_0x38b987[_0x44ca('0x41')]);_0x4ac75e['filters']=_['intersection'](_0x4ac75e[_0x44ca('0x45')],_0x4ac75e[_0x44ca('0x41')]);_0x588b9[_0x44ca('0x46')]=_[_0x44ca('0x44')](_0x4ac75e['model'],qs[_0x44ca('0x47')](_0x38b987[_0x44ca('0x41')][_0x44ca('0x47')]));_0x588b9[_0x44ca('0x46')]=_0x588b9[_0x44ca('0x46')][_0x44ca('0x48')]?_0x588b9[_0x44ca('0x46')]:_0x4ac75e['model'];if(!_0x38b987[_0x44ca('0x41')]['hasOwnProperty']('nolimit')){_0x588b9[_0x44ca('0x2f')]=qs[_0x44ca('0x2f')](_0x38b987[_0x44ca('0x41')][_0x44ca('0x2f')]);_0x588b9[_0x44ca('0x30')]=qs[_0x44ca('0x30')](_0x38b987['query'][_0x44ca('0x30')]);}_0x588b9['order']=qs[_0x44ca('0x4c')](_0x38b987[_0x44ca('0x41')][_0x44ca('0x4c')]);_0x588b9[_0x44ca('0x4d')]=qs[_0x44ca('0x43')](_[_0x44ca('0x4e')](_0x38b987[_0x44ca('0x41')],_0x4ac75e[_0x44ca('0x43')]));_0x588b9[_0x44ca('0x4d')]['OpenchannelAccountId']=_0x2a3260['id'];if(_0x38b987['query'][_0x44ca('0x4f')]){_0x588b9[_0x44ca('0x4d')]=_[_0x44ca('0x50')](_0x588b9['where'],{'$or':_[_0x44ca('0x3d')](_0x588b9['attributes'],function(_0x57d756){var _0x5917a6={};_0x5917a6[_0x57d756]={'$like':'%'+_0x38b987[_0x44ca('0x41')][_0x44ca('0x4f')]+'%'};return _0x5917a6;})});}_0x588b9=_[_0x44ca('0x50')]({},_0x588b9,_0x38b987[_0x44ca('0x52')]);return db[_0x44ca('0x8d')]['count']({'where':_0x588b9[_0x44ca('0x4d')]})['then'](function(_0x570093){_0x4dec49[_0x44ca('0x31')]=_0x570093;if(_0x38b987['query'][_0x44ca('0x58')]){_0x588b9['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x44ca('0xab')],'as':'Owner','attributes':[_0x44ca('0x39'),_0x44ca('0xac'),'internal'],'required':![]},{'model':db[_0x44ca('0xad')],'as':_0x44ca('0xae'),'attributes':['id',_0x44ca('0x39'),_0x44ca('0xaf')],'where':_0x38b987[_0x44ca('0x41')]['tag']?{'id':_0x38b987[_0x44ca('0x41')][_0x44ca('0xb0')]}:undefined,'required':_0x38b987['query'][_0x44ca('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x44ca('0x53')](_0x588b9);})['then'](function(_0x5b18cd){_0x4dec49[_0x44ca('0x54')]=_0x5b18cd;return _0x4dec49;});}})[_0x44ca('0x20')](respondWithFilteredResult(_0x3fb5c5,_0x588b9))['catch'](handleError(_0x3fb5c5,null));};exports[_0x44ca('0xb1')]=function(_0x44c8a1,_0x35323e,_0x34a1c8){return db[_0x44ca('0x3e')][_0x44ca('0x5a')]({'where':{'id':_0x44c8a1[_0x44ca('0x56')]['id']}})['then'](handleEntityNotFound(_0x35323e,null))[_0x44ca('0x20')](function(_0x2be318){if(_0x2be318){return _0x2be318[_0x44ca('0xb1')](_0x44c8a1[_0x44ca('0x62')][_0x44ca('0x69')],_[_0x44ca('0xb2')](_0x44c8a1['body'],[_0x44ca('0x69'),'id'])||{})[_0x44ca('0xb3')](function(_0x58e3eb){for(var _0x19ca1e=0x0;_0x19ca1e<_0x44c8a1[_0x44ca('0x62')][_0x44ca('0x69')][_0x44ca('0x48')];_0x19ca1e+=0x1){socket[_0x44ca('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x44c8a1[_0x44ca('0x62')]['ids'][_0x19ca1e]),'OpenchannelAccountId':Number(_0x44c8a1[_0x44ca('0x56')]['id'])});}return _0x58e3eb;});}})[_0x44ca('0x20')](respondWithResult(_0x35323e,null))[_0x44ca('0x29')](handleError(_0x35323e,null));};exports['removeAgents']=function(_0x284b63,_0x59902b,_0x31d2e1){return db['OpenchannelAccount']['find']({'where':{'id':_0x284b63[_0x44ca('0x56')]['id']}})[_0x44ca('0x20')](handleEntityNotFound(_0x59902b,null))[_0x44ca('0x20')](function(_0x52e789){if(_0x52e789){return _0x52e789[_0x44ca('0xb5')](_0x284b63[_0x44ca('0x41')][_0x44ca('0x69')])[_0x44ca('0x20')](function(){if(_[_0x44ca('0xb6')](_0x284b63['query']['ids'])){for(var _0x474fb2=0x0;_0x474fb2<_0x284b63[_0x44ca('0x41')][_0x44ca('0x69')][_0x44ca('0x48')];_0x474fb2+=0x1){socket[_0x44ca('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x284b63[_0x44ca('0x41')]['ids'][_0x474fb2]),'OpenchannelAccountId':Number(_0x284b63[_0x44ca('0x56')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x284b63['query'][_0x44ca('0x69')]),'OpenchannelAccountId':Number(_0x284b63[_0x44ca('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x59902b,null))['catch'](handleError(_0x59902b,null));};exports['getAgents']=function(_0x51371b,_0x1e90cc,_0x29bfa5){var _0x2fd804={};var _0x52258b={};var _0x2411f0;var _0xf1008a;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x51371b[_0x44ca('0x56')]['id']}})[_0x44ca('0x20')](handleEntityNotFound(_0x1e90cc,null))[_0x44ca('0x20')](function(_0x12f40a){if(_0x12f40a){_0x2411f0=_0x12f40a;_0x52258b[_0x44ca('0x45')]=_['keys'](db['User'][_0x44ca('0x66')]);_0x52258b[_0x44ca('0x41')]=_[_0x44ca('0x42')](_0x51371b['query']);_0x52258b[_0x44ca('0x43')]=_[_0x44ca('0x44')](_0x52258b['model'],_0x52258b[_0x44ca('0x41')]);_0x2fd804['attributes']=_[_0x44ca('0x44')](_0x52258b[_0x44ca('0x45')],qs['fields'](_0x51371b[_0x44ca('0x41')][_0x44ca('0x47')]));_0x2fd804[_0x44ca('0x46')]=_0x2fd804[_0x44ca('0x46')][_0x44ca('0x48')]?_0x2fd804['attributes']:_0x52258b[_0x44ca('0x45')];_0x2fd804['order']=qs[_0x44ca('0x4c')](_0x51371b[_0x44ca('0x41')][_0x44ca('0x4c')]);_0x2fd804['where']=qs[_0x44ca('0x43')](_['pick'](_0x51371b[_0x44ca('0x41')],_0x52258b[_0x44ca('0x43')]));if(_0x51371b[_0x44ca('0x41')]['filter']){_0x2fd804[_0x44ca('0x4d')]=_['merge'](_0x2fd804['where'],{'$or':_[_0x44ca('0x3d')](_0x2fd804['attributes'],function(_0x27c904){var _0xbb51a3={};_0xbb51a3[_0x27c904]={'$like':'%'+_0x51371b[_0x44ca('0x41')][_0x44ca('0x4f')]+'%'};return _0xbb51a3;})});}_0x2fd804=_[_0x44ca('0x50')]({},_0x2fd804,_0x51371b[_0x44ca('0x52')]);return _0x2411f0['getAgents'](_0x2fd804);}})[_0x44ca('0x20')](function(_0x53854a){if(_0x53854a){_0xf1008a=_0x53854a[_0x44ca('0x48')];if(!_0x51371b[_0x44ca('0x41')][_0x44ca('0x49')]('nolimit')){_0x2fd804[_0x44ca('0x2f')]=qs[_0x44ca('0x2f')](_0x51371b['query']['limit']);_0x2fd804[_0x44ca('0x30')]=qs['offset'](_0x51371b[_0x44ca('0x41')][_0x44ca('0x30')]);}return _0x2411f0[_0x44ca('0xb7')](_0x2fd804);}})[_0x44ca('0x20')](function(_0x17de5b){if(_0x17de5b){return _0x17de5b?{'count':_0xf1008a,'rows':_0x17de5b}:null;}})[_0x44ca('0x20')](respondWithResult(_0x1e90cc,null))['catch'](handleError(_0x1e90cc,null));};exports['send']=function(_0x36702c,_0x4bd5f1,_0x55bb99){var _0x5139f1,_0x211000,_0x2da727;if(_[_0x44ca('0x77')](_0x36702c[_0x44ca('0x62')]['body'])||_0x36702c[_0x44ca('0x62')][_0x44ca('0x62')]===''){throw new db[(_0x44ca('0x72'))][(_0x44ca('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x36702c[_0x44ca('0x62')]['to'])){}_0x5139f1=_0x36702c[_0x44ca('0x62')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x36702c[_0x44ca('0x56')]['id']}})['then'](handleEntityNotFound(_0x4bd5f1,null))[_0x44ca('0x20')](function(_0x3959c4){if(_0x3959c4){return db[_0x44ca('0x3e')][_0x44ca('0x5a')]({'where':{'id':_0x3959c4['id']},'include':[{'model':db['CmList'],'as':_0x44ca('0x7f'),'include':[{'model':db['CmContact'],'as':_0x44ca('0x80'),'where':{[_0x3959c4['mapKey']]:_0x5139f1},'limit':0x1,'order':[[_0x44ca('0x75'),_0x44ca('0x81')]]}]}]})[_0x44ca('0x20')](handleEntityNotFound(_0x4bd5f1,null))[_0x44ca('0x20')](function(_0x35474e){if(_0x35474e&&_0x35474e[_0x44ca('0x7f')]){_0x211000=_0x35474e['get']({'plain':!![]});if(_0x211000[_0x44ca('0x7f')]&&_0x211000[_0x44ca('0x7f')][_0x44ca('0x80')][_0x44ca('0x48')]){return _0x211000[_0x44ca('0x7f')][_0x44ca('0x80')][0x0];}return db[_0x44ca('0x71')]['create'](_['defaults'](_0x36702c[_0x44ca('0x62')],{'firstName':_0x5139f1,[_0x35474e[_0x44ca('0x7d')]]:_0x5139f1,'phone':_0x5139f1,'ListId':_0x211000['ListId']}));}})['then'](handleEntityNotFound(_0x4bd5f1,null))[_0x44ca('0x20')](function(_0x338389){if(_0x338389){_0x2da727=_0x338389;return db[_0x44ca('0x8d')][_0x44ca('0x5a')]({'where':{'ContactId':_0x2da727['id'],'closed':![],'OpenchannelAccountId':_0x211000['id']}})[_0x44ca('0x20')](function(_0x437c72){if(_0x437c72){return[_0x437c72,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x36702c[_0x44ca('0x5c')]['id'],'ContactId':_0x2da727['id'],'OpenchannelAccountId':_0x211000['id'],'lastMsgDirection':_0x44ca('0xb8'),'firstMsgDirection':'out','Messages':[_[_0x44ca('0x50')](_0x36702c[_0x44ca('0x62')],{'read':![],'body':_0x36702c[_0x44ca('0x62')]['body'],'OpenchannelAccountId':_0x211000['id'],'UserId':_0x36702c[_0x44ca('0x5c')]['id'],'ContactId':_0x2da727['id']})]},{'include':[{'model':db[_0x44ca('0x99')],'as':'Messages'}]})['then'](function(_0xe2ab78){return[_0xe2ab78,!![]];});});}})[_0x44ca('0xb3')](function(_0x59b0ff,_0x1fa3f1){if(_0x1fa3f1){return _0x59b0ff;}return db[_0x44ca('0x99')][_0x44ca('0x5b')](_['merge'](_0x36702c[_0x44ca('0x62')],{'read':![],'body':_0x36702c[_0x44ca('0x62')]['body'],'OpenchannelAccountId':_0x211000['id'],'OpenchannelInteractionId':_0x59b0ff['id'],'UserId':_0x36702c[_0x44ca('0x5c')]['id'],'ContactId':_0x2da727['id']}))['then'](function(_0x16bba6){_0x59b0ff[_0x44ca('0xb9')][_0x44ca('0xba')]=[];_0x59b0ff['dataValues'][_0x44ca('0xba')][_0x44ca('0x95')](_0x16bba6[_0x44ca('0xb9')]);return _0x59b0ff;});});}})['then'](respondWithResult(_0x4bd5f1,null))[_0x44ca('0x29')](handleError(_0x4bd5f1,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b1a2303..a52ec4c 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 _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x168120,_0x4e19de){var _0x5c827e=function(_0x47b472){while(--_0x47b472){_0x168120['push'](_0x168120['shift']());}};_0x5c827e(++_0x4e19de);}(_0x750a,0x140));var _0xa750=function(_0x4dc153,_0x4061cd){_0x4dc153=_0x4dc153-0x0;var _0x315858=_0x750a[_0x4dc153];return _0x315858;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x668b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x668b,0x140));var _0xb668=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x668b[_0xe4bb3d];return _0xd9e51;};'use strict';var EventEmitter=require(_0xb668('0x0'));var OpenchannelAccount=require(_0xb668('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x5e2e83){return function(_0x2fab11,_0x4092a6,_0x2960f5){OpenchannelAccountEvents['emit'](_0x5e2e83+':'+_0x2fab11['id'],_0x2fab11);OpenchannelAccountEvents[_0xb668('0x5')](_0x5e2e83,_0x2fab11);_0x2960f5(null);};}for(var e in events){if(events[_0xb668('0x6')](e)){var event=events[e];OpenchannelAccount[_0xb668('0x7')](e,emitEvent(event));}}module[_0xb668('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 977cadc..e6b6bbc 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(_0x34977b,_0x53ba6a){var _0x5cf0c4=function(_0x3a2f14){while(--_0x3a2f14){_0x34977b['push'](_0x34977b['shift']());}};_0x5cf0c4(++_0x53ba6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x35d25e,_0x2ad792){var _0x5bf09d=function(_0x2ae30a){while(--_0x2ae30a){_0x35d25e['push'](_0x35d25e['shift']());}};_0x5bf09d(++_0x2ad792);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 34c22a9..b1319e1 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 _0x4af8=['request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','./openchannelAccount.socket'];(function(_0x1521ba,_0x391f4d){var _0x182299=function(_0xa8a1de){while(--_0xa8a1de){_0x1521ba['push'](_0x1521ba['shift']());}};_0x182299(++_0x391f4d);}(_0x4af8,0x1ad));var _0x84af=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x4af8[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84af('0x0'));var fs=require('fs');var Redis=require(_0x84af('0x1'));var db=require(_0x84af('0x2'))['db'];var utils=require(_0x84af('0x3'));var logger=require('../../config/logger')(_0x84af('0x4'));var config=require(_0x84af('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x84af('0x6')][_0x84af('0x7')]({'port':0x232a});config['redis']=_[_0x84af('0x8')](config[_0x84af('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84af('0x9')]));require(_0x84af('0xa'))['register'](socket);function respondWithRpcPromise(_0xc9f91b,_0x535556,_0x1623f6){return new BPromise(function(_0x21e634,_0x34aa9e){return client[_0x84af('0xb')](_0xc9f91b,_0x1623f6)['then'](function(_0x31f283){logger['info'](_0x84af('0xc'),_0x535556,_0x84af('0xd'));logger['debug'](_0x84af('0xe'),_0x535556,_0x84af('0xd'),JSON[_0x84af('0xf')](_0x31f283));if(_0x31f283[_0x84af('0x10')]){if(_0x31f283['error'][_0x84af('0x11')]===0x1f4){logger['error'](_0x84af('0xc'),_0x535556,_0x31f283[_0x84af('0x10')]['message']);return _0x34aa9e(_0x31f283[_0x84af('0x10')][_0x84af('0x12')]);}logger['error'](_0x84af('0xc'),_0x535556,_0x31f283['error'][_0x84af('0x12')]);return _0x21e634(_0x31f283[_0x84af('0x10')]['message']);}else{logger['info'](_0x84af('0xc'),_0x535556,_0x84af('0xd'));_0x21e634(_0x31f283[_0x84af('0x13')]['message']);}})['catch'](function(_0x187195){logger[_0x84af('0x10')](_0x84af('0xc'),_0x535556,_0x187195);_0x34aa9e(_0x187195);});});} \ No newline at end of file +var _0xd523=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message'];(function(_0x5abd84,_0x1951e3){var _0x352cc6=function(_0x1b22dc){while(--_0x1b22dc){_0x5abd84['push'](_0x5abd84['shift']());}};_0x352cc6(++_0x1951e3);}(_0xd523,0x153));var _0x3d52=function(_0x4931ef,_0x2bf51c){_0x4931ef=_0x4931ef-0x0;var _0x2b2508=_0xd523[_0x4931ef];return _0x2b2508;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var moment=require(_0x3d52('0x2'));var BPromise=require(_0x3d52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x4'));var db=require(_0x3d52('0x5'))['db'];var utils=require(_0x3d52('0x6'));var logger=require('../../config/logger')(_0x3d52('0x7'));var config=require(_0x3d52('0x8'));var jayson=require(_0x3d52('0x9'));var client=jayson[_0x3d52('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3d52('0xb')](config[_0x3d52('0xc')],{'host':_0x3d52('0xd'),'port':0x18eb});var socket=require(_0x3d52('0xe'))(new Redis(config[_0x3d52('0xc')]));require(_0x3d52('0xf'))[_0x3d52('0x10')](socket);function respondWithRpcPromise(_0x2d966e,_0x30ee09,_0x4a5a9a){return new BPromise(function(_0x46c2e6,_0x873de6){return client[_0x3d52('0x11')](_0x2d966e,_0x4a5a9a)[_0x3d52('0x12')](function(_0x2675d2){logger['info'](_0x3d52('0x13'),_0x30ee09,'request\x20sent');logger['debug'](_0x3d52('0x14'),_0x30ee09,_0x3d52('0x15'),JSON['stringify'](_0x2675d2));if(_0x2675d2['error']){if(_0x2675d2['error'][_0x3d52('0x16')]===0x1f4){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x873de6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);return _0x46c2e6(_0x2675d2[_0x3d52('0x17')][_0x3d52('0x18')]);}else{logger[_0x3d52('0x19')](_0x3d52('0x13'),_0x30ee09,'request\x20sent');_0x46c2e6(_0x2675d2[_0x3d52('0x1a')][_0x3d52('0x18')]);}})[_0x3d52('0x1b')](function(_0x54a514){logger[_0x3d52('0x17')](_0x3d52('0x13'),_0x30ee09,_0x54a514);_0x873de6(_0x54a514);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 1ff0f81..76730ad 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 _0xd0d5=['register','length','openchannelAccount:','emit','removeListener'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x12a610,_0x3f2453){_0x12a610=_0x12a610-0x0;var _0x4e69ae=_0xd0d5[_0x12a610];return _0x4e69ae;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save','remove','update'];function createListener(_0x58f3ab,_0x2c7013){return function(_0x3d99f8){_0x2c7013[_0x5d0d('0x0')](_0x58f3ab,_0x3d99f8);};}function removeListener(_0x514434,_0x555b49){return function(){OpenchannelAccountEvents[_0x5d0d('0x1')](_0x514434,_0x555b49);};}exports[_0x5d0d('0x2')]=function(_0xd79a02){for(var _0x4259ce=0x0,_0x5ace89=events[_0x5d0d('0x3')];_0x4259ce<_0x5ace89;_0x4259ce++){var _0xcfec38=events[_0x4259ce];var _0x11c549=createListener(_0x5d0d('0x4')+_0xcfec38,_0xd79a02);OpenchannelAccountEvents['on'](_0xcfec38,_0x11c549);}}; \ No newline at end of file +var _0x402f=['register','length','openchannelAccount:','./openchannelAccount.events','remove','emit'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x402f,0x6f));var _0xf402=function(_0x81f0fc,_0x2c5785){_0x81f0fc=_0x81f0fc-0x0;var _0xd4667d=_0x402f[_0x81f0fc];return _0xd4667d;};'use strict';var OpenchannelAccountEvents=require(_0xf402('0x0'));var events=['save',_0xf402('0x1'),'update'];function createListener(_0x588b83,_0x3ccbce){return function(_0xe1847c){_0x3ccbce[_0xf402('0x2')](_0x588b83,_0xe1847c);};}function removeListener(_0x4a52b8,_0x246c5f){return function(){OpenchannelAccountEvents['removeListener'](_0x4a52b8,_0x246c5f);};}exports[_0xf402('0x3')]=function(_0x270766){for(var _0x3a1d11=0x0,_0x2a8774=events[_0xf402('0x4')];_0x3a1d11<_0x2a8774;_0x3a1d11++){var _0x55c515=events[_0x3a1d11];var _0x4d1771=createListener(_0xf402('0x5')+_0x55c515,_0x270766);OpenchannelAccountEvents['on'](_0x55c515,_0x4d1771);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 23253fe..cba7cf2 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 _0xdf36=['put','update','/:id','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','get','show','post','create'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xdf36,0x180));var _0x6df3=function(_0x557383,_0x4007e6){_0x557383=_0x557383-0x0;var _0x2fd68d=_0xdf36[_0x557383];return _0x2fd68d;};'use strict';var multer=require(_0x6df3('0x0'));var util=require(_0x6df3('0x1'));var path=require(_0x6df3('0x2'));var timeout=require(_0x6df3('0x3'));var express=require('express');var router=express[_0x6df3('0x4')]();var fs_extra=require(_0x6df3('0x5'));var auth=require(_0x6df3('0x6'));var interaction=require(_0x6df3('0x7'));var config=require(_0x6df3('0x8'));var controller=require(_0x6df3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6df3('0xa')]);router[_0x6df3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6df3('0xc')]);router[_0x6df3('0xd')]('/',auth['isAuthenticated'](),controller[_0x6df3('0xe')]);router[_0x6df3('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6df3('0x10')]);router['delete'](_0x6df3('0x11'),auth[_0x6df3('0x12')](),controller[_0x6df3('0x13')]);module[_0x6df3('0x14')]=router; \ No newline at end of file +var _0x3512=['/:id','show','post','create','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3fe393,_0x234a3a){var _0x534d14=function(_0x277fab){while(--_0x277fab){_0x3fe393['push'](_0x3fe393['shift']());}};_0x534d14(++_0x234a3a);}(_0x3512,0xe5));var _0x2351=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3512[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x2351('0x0'));var path=require(_0x2351('0x1'));var timeout=require('connect-timeout');var express=require(_0x2351('0x2'));var router=express['Router']();var fs_extra=require(_0x2351('0x3'));var auth=require(_0x2351('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2351('0x5'));var controller=require('./openchannelApplication.controller');router[_0x2351('0x6')]('/',auth[_0x2351('0x7')](),controller[_0x2351('0x8')]);router[_0x2351('0x6')](_0x2351('0x9'),auth[_0x2351('0x7')](),controller[_0x2351('0xa')]);router[_0x2351('0xb')]('/',auth['isAuthenticated'](),controller[_0x2351('0xc')]);router['put'](_0x2351('0x9'),auth[_0x2351('0x7')](),controller[_0x2351('0xd')]);router[_0x2351('0xe')]('/:id',auth[_0x2351('0x7')](),controller[_0x2351('0xf')]);module[_0x2351('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 0832ea8..8088285 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 _0x1a9c=['sequelize','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x1a9c,0x11a));var _0xc1a9=function(_0x8df9a1,_0xcd0067){_0x8df9a1=_0x8df9a1-0x0;var _0x12c60e=_0x1a9c[_0x8df9a1];return _0x12c60e;};'use strict';var Sequelize=require(_0xc1a9('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc1a9('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc1a9('0x2')},'appdata':{'type':Sequelize[_0xc1a9('0x3')]()},'description':{'type':Sequelize[_0xc1a9('0x4')]},'interval':{'type':Sequelize[_0xc1a9('0x4')],'defaultValue':_0xc1a9('0x5')}}; \ No newline at end of file +var _0xde36=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x70f515,_0x31a8a9){var _0x412225=function(_0x40bef8){while(--_0x40bef8){_0x70f515['push'](_0x70f515['shift']());}};_0x412225(++_0x31a8a9);}(_0xde36,0x101));var _0x6de3=function(_0x34cdd2,_0x576413){_0x34cdd2=_0x34cdd2-0x0;var _0x3cc99c=_0xde36[_0x34cdd2];return _0x3cc99c;};'use strict';var Sequelize=require(_0x6de3('0x0'));module[_0x6de3('0x1')]={'priority':{'type':Sequelize[_0x6de3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6de3('0x3')],'allowNull':![],'defaultValue':_0x6de3('0x4')},'appdata':{'type':Sequelize[_0x6de3('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x6de3('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 55965dc..8a884fa 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 _0x65ef=['type','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge'];(function(_0x39c393,_0x46800d){var _0x4f7d6e=function(_0x2cdfa2){while(--_0x2cdfa2){_0x39c393['push'](_0x39c393['shift']());}};_0x4f7d6e(++_0x46800d);}(_0x65ef,0xeb));var _0xf65e=function(_0x5a75df,_0x40eaa2){_0x5a75df=_0x5a75df-0x0;var _0x1f0d2a=_0x65ef[_0x5a75df];return _0x1f0d2a;};'use strict';var emlformat=require(_0xf65e('0x0'));var rimraf=require(_0xf65e('0x1'));var zipdir=require(_0xf65e('0x2'));var jsonpatch=require(_0xf65e('0x3'));var rp=require(_0xf65e('0x4'));var moment=require(_0xf65e('0x5'));var BPromise=require(_0xf65e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf65e('0x7'));var sox=require(_0xf65e('0x8'));var csv=require(_0xf65e('0x9'));var ejs=require(_0xf65e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf65e('0xb'));var jsforce=require(_0xf65e('0xc'));var deskjs=require(_0xf65e('0xd'));var toCsv=require(_0xf65e('0x9'));var querystring=require(_0xf65e('0xe'));var Papa=require(_0xf65e('0xf'));var Redis=require(_0xf65e('0x10'));var authService=require(_0xf65e('0x11'));var qs=require(_0xf65e('0x12'));var as=require(_0xf65e('0x13'));var hardwareService=require(_0xf65e('0x14'));var logger=require(_0xf65e('0x15'))(_0xf65e('0x16'));var utils=require('../../config/utils');var config=require(_0xf65e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x64fc8f,_0x43fbde){_0x43fbde=_0x43fbde||0xcc;return function(_0x1d8513){if(_0x1d8513){return _0x64fc8f[_0xf65e('0x18')](_0x43fbde);}return _0x64fc8f['status'](_0x43fbde)[_0xf65e('0x19')]();};}function respondWithResult(_0x465e85,_0x4d2060){_0x4d2060=_0x4d2060||0xc8;return function(_0x3ffc6b){if(_0x3ffc6b){return _0x465e85['status'](_0x4d2060)[_0xf65e('0x1a')](_0x3ffc6b);}};}function respondWithFilteredResult(_0x43a055,_0x41ee32){return function(_0x2661d2){if(_0x2661d2){var _0x55d668=typeof _0x41ee32[_0xf65e('0x1b')]===_0xf65e('0x1c')&&typeof _0x41ee32[_0xf65e('0x1d')]===_0xf65e('0x1c');var _0x3700ae=_0x2661d2[_0xf65e('0x1e')];var _0x4cc2ec=_0x55d668?0x0:_0x41ee32['offset'];var _0x3d9da0=_0x55d668?_0x2661d2[_0xf65e('0x1e')]:_0x41ee32['offset']+_0x41ee32[_0xf65e('0x1d')];var _0x5b079d;if(_0x3d9da0>=_0x3700ae){_0x3d9da0=_0x3700ae;_0x5b079d=0xc8;}else{_0x5b079d=0xce;}_0x43a055[_0xf65e('0x1f')](_0x5b079d);return _0x43a055[_0xf65e('0x20')](_0xf65e('0x21'),_0x4cc2ec+'-'+_0x3d9da0+'/'+_0x3700ae)[_0xf65e('0x1a')](_0x2661d2);}return null;};}function patchUpdates(_0x245779){return function(_0x2512ac){try{jsonpatch['apply'](_0x2512ac,_0x245779,!![]);}catch(_0x1c9e5b){return BPromise[_0xf65e('0x22')](_0x1c9e5b);}return _0x2512ac[_0xf65e('0x23')]();};}function saveUpdates(_0x1cbc7e,_0x2b8805){return function(_0x51a662){if(_0x51a662){return _0x51a662[_0xf65e('0x24')](_0x1cbc7e)['then'](function(_0x3f0042){return _0x3f0042;});}return null;};}function removeEntity(_0x27b52b,_0x1759fd){return function(_0x53fac3){if(_0x53fac3){return _0x53fac3['destroy']()[_0xf65e('0x25')](function(){_0x27b52b[_0xf65e('0x1f')](0xcc)[_0xf65e('0x19')]();});}};}function handleEntityNotFound(_0x7746ce,_0x56c405){return function(_0x3c5788){if(!_0x3c5788){_0x7746ce['sendStatus'](0x194);}return _0x3c5788;};}function handleError(_0x8fad27,_0x270dd7){_0x270dd7=_0x270dd7||0x1f4;return function(_0x2d728){logger[_0xf65e('0x26')](_0x2d728[_0xf65e('0x27')]);if(_0x2d728[_0xf65e('0x28')]){delete _0x2d728[_0xf65e('0x28')];}_0x8fad27['status'](_0x270dd7)[_0xf65e('0x29')](_0x2d728);};}exports[_0xf65e('0x2a')]=function(_0x131bf1,_0x5e1fc2){var _0x2870cd={},_0x4523d9={},_0x31acc5={'count':0x0,'rows':[]};var _0x3fe975=_[_0xf65e('0x2b')](db[_0xf65e('0x2c')][_0xf65e('0x2d')],function(_0x331f5f){return{'name':_0x331f5f[_0xf65e('0x2e')],'type':_0x331f5f['type']['key']};});_0x4523d9[_0xf65e('0x2f')]=_[_0xf65e('0x2b')](_0x3fe975,'name');_0x4523d9[_0xf65e('0x30')]=_[_0xf65e('0x31')](_0x131bf1[_0xf65e('0x30')]);_0x4523d9[_0xf65e('0x32')]=_[_0xf65e('0x33')](_0x4523d9[_0xf65e('0x2f')],_0x4523d9[_0xf65e('0x30')]);_0x2870cd[_0xf65e('0x34')]=_[_0xf65e('0x33')](_0x4523d9[_0xf65e('0x2f')],qs[_0xf65e('0x35')](_0x131bf1[_0xf65e('0x30')][_0xf65e('0x35')]));_0x2870cd[_0xf65e('0x34')]=_0x2870cd[_0xf65e('0x34')][_0xf65e('0x36')]?_0x2870cd[_0xf65e('0x34')]:_0x4523d9[_0xf65e('0x2f')];if(!_0x131bf1[_0xf65e('0x30')]['hasOwnProperty']('nolimit')){_0x2870cd['limit']=qs[_0xf65e('0x1d')](_0x131bf1[_0xf65e('0x30')][_0xf65e('0x1d')]);_0x2870cd[_0xf65e('0x1b')]=qs[_0xf65e('0x1b')](_0x131bf1[_0xf65e('0x30')][_0xf65e('0x1b')]);}_0x2870cd[_0xf65e('0x37')]=qs['sort'](_0x131bf1[_0xf65e('0x30')][_0xf65e('0x38')]);_0x2870cd[_0xf65e('0x39')]=qs[_0xf65e('0x32')](_[_0xf65e('0x3a')](_0x131bf1[_0xf65e('0x30')],_0x4523d9[_0xf65e('0x32')]),_0x3fe975);if(_0x131bf1['query'][_0xf65e('0x3b')]){_0x2870cd['where']=_[_0xf65e('0x3c')](_0x2870cd[_0xf65e('0x39')],{'$or':_[_0xf65e('0x2b')](_0x3fe975,function(_0x3dbdac){if(_0x3dbdac[_0xf65e('0x3d')]!==_0xf65e('0x3e')){var _0x4e1edc={};_0x4e1edc[_0x3dbdac[_0xf65e('0x28')]]={'$like':'%'+_0x131bf1[_0xf65e('0x30')]['filter']+'%'};return _0x4e1edc;}})});}_0x2870cd=_[_0xf65e('0x3c')]({},_0x2870cd,_0x131bf1['options']);var _0x180297={'where':_0x2870cd['where']};return db[_0xf65e('0x2c')][_0xf65e('0x1e')](_0x180297)[_0xf65e('0x25')](function(_0x50a7b6){_0x31acc5[_0xf65e('0x1e')]=_0x50a7b6;if(_0x131bf1['query'][_0xf65e('0x3f')]){_0x2870cd[_0xf65e('0x40')]=[{'all':!![]}];}return db[_0xf65e('0x2c')][_0xf65e('0x41')](_0x2870cd);})[_0xf65e('0x25')](function(_0x27340f){_0x31acc5[_0xf65e('0x42')]=_0x27340f;return _0x31acc5;})[_0xf65e('0x25')](respondWithFilteredResult(_0x5e1fc2,_0x2870cd))['catch'](handleError(_0x5e1fc2,null));};exports['show']=function(_0x5d266b,_0x8b735f){var _0x9143c5={'raw':!![],'where':{'id':_0x5d266b[_0xf65e('0x43')]['id']}},_0x36ec1c={};_0x36ec1c['model']=_['keys'](db[_0xf65e('0x2c')][_0xf65e('0x2d')]);_0x36ec1c[_0xf65e('0x30')]=_[_0xf65e('0x31')](_0x5d266b[_0xf65e('0x30')]);_0x36ec1c[_0xf65e('0x32')]=_[_0xf65e('0x33')](_0x36ec1c[_0xf65e('0x2f')],_0x36ec1c[_0xf65e('0x30')]);_0x9143c5[_0xf65e('0x34')]=_['intersection'](_0x36ec1c[_0xf65e('0x2f')],qs['fields'](_0x5d266b[_0xf65e('0x30')][_0xf65e('0x35')]));_0x9143c5[_0xf65e('0x34')]=_0x9143c5['attributes']['length']?_0x9143c5[_0xf65e('0x34')]:_0x36ec1c[_0xf65e('0x2f')];if(_0x5d266b['query'][_0xf65e('0x3f')]){_0x9143c5['include']=[{'all':!![]}];}_0x9143c5=_['merge']({},_0x9143c5,_0x5d266b[_0xf65e('0x44')]);return db['OpenchannelApplication'][_0xf65e('0x45')](_0x9143c5)[_0xf65e('0x25')](handleEntityNotFound(_0x8b735f,null))[_0xf65e('0x25')](respondWithResult(_0x8b735f,null))[_0xf65e('0x46')](handleError(_0x8b735f,null));};exports[_0xf65e('0x47')]=function(_0x2edc3d,_0x3c1c75){return db[_0xf65e('0x2c')][_0xf65e('0x47')](_0x2edc3d[_0xf65e('0x48')],{})[_0xf65e('0x25')](respondWithResult(_0x3c1c75,0xc9))[_0xf65e('0x46')](handleError(_0x3c1c75,null));};exports[_0xf65e('0x24')]=function(_0x33965f,_0x1d1fdc){if(_0x33965f[_0xf65e('0x48')]['id']){delete _0x33965f[_0xf65e('0x48')]['id'];}return db[_0xf65e('0x2c')][_0xf65e('0x45')]({'where':{'id':_0x33965f['params']['id']}})[_0xf65e('0x25')](handleEntityNotFound(_0x1d1fdc,null))[_0xf65e('0x25')](saveUpdates(_0x33965f['body'],null))[_0xf65e('0x25')](respondWithResult(_0x1d1fdc,null))[_0xf65e('0x46')](handleError(_0x1d1fdc,null));};exports[_0xf65e('0x49')]=function(_0xdb91d8,_0x55e7b6){return db['OpenchannelApplication']['find']({'where':{'id':_0xdb91d8[_0xf65e('0x43')]['id']}})[_0xf65e('0x25')](handleEntityNotFound(_0x55e7b6,null))[_0xf65e('0x25')](removeEntity(_0x55e7b6,null))['catch'](handleError(_0x55e7b6,null));}; \ No newline at end of file +var _0xd663=['error','name','OpenchannelApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','update','then','destroy'];(function(_0x4f85c6,_0x4d9f09){var _0x17bb4f=function(_0x4868bd){while(--_0x4868bd){_0x4f85c6['push'](_0x4f85c6['shift']());}};_0x17bb4f(++_0x4d9f09);}(_0xd663,0xad));var _0x3d66=function(_0xf037a6,_0x435a2d){_0xf037a6=_0xf037a6-0x0;var _0x4cfc8a=_0xd663[_0xf037a6];return _0x4cfc8a;};'use strict';var emlformat=require(_0x3d66('0x0'));var rimraf=require(_0x3d66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d66('0x2'));var rp=require(_0x3d66('0x3'));var moment=require(_0x3d66('0x4'));var BPromise=require(_0x3d66('0x5'));var Mustache=require(_0x3d66('0x6'));var util=require(_0x3d66('0x7'));var path=require(_0x3d66('0x8'));var sox=require(_0x3d66('0x9'));var csv=require(_0x3d66('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d66('0xb'));var _=require(_0x3d66('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d66('0xd'));var deskjs=require(_0x3d66('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3d66('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x10'));var hardwareService=require(_0x3d66('0x11'));var logger=require(_0x3d66('0x12'))(_0x3d66('0x13'));var utils=require(_0x3d66('0x14'));var config=require(_0x3d66('0x15'));var licenseUtil=require(_0x3d66('0x16'));var db=require(_0x3d66('0x17'))['db'];function respondWithStatusCode(_0x4688d0,_0x350c9a){_0x350c9a=_0x350c9a||0xcc;return function(_0x3c06cd){if(_0x3c06cd){return _0x4688d0['sendStatus'](_0x350c9a);}return _0x4688d0[_0x3d66('0x18')](_0x350c9a)[_0x3d66('0x19')]();};}function respondWithResult(_0xbbe014,_0x25aeca){_0x25aeca=_0x25aeca||0xc8;return function(_0x595147){if(_0x595147){return _0xbbe014[_0x3d66('0x18')](_0x25aeca)['json'](_0x595147);}};}function respondWithFilteredResult(_0x2a8eea,_0x3e55d2){return function(_0xb90053){if(_0xb90053){var _0x5cf1fb=typeof _0x3e55d2[_0x3d66('0x1a')]===_0x3d66('0x1b')&&typeof _0x3e55d2['limit']===_0x3d66('0x1b');var _0x261358=_0xb90053['count'];var _0x54be7c=_0x5cf1fb?0x0:_0x3e55d2[_0x3d66('0x1a')];var _0x476bc7=_0x5cf1fb?_0xb90053[_0x3d66('0x1c')]:_0x3e55d2['offset']+_0x3e55d2[_0x3d66('0x1d')];var _0x392fc9;if(_0x476bc7>=_0x261358){_0x476bc7=_0x261358;_0x392fc9=0xc8;}else{_0x392fc9=0xce;}_0x2a8eea[_0x3d66('0x18')](_0x392fc9);return _0x2a8eea['set'](_0x3d66('0x1e'),_0x54be7c+'-'+_0x476bc7+'/'+_0x261358)[_0x3d66('0x1f')](_0xb90053);}return null;};}function patchUpdates(_0x1b9d42){return function(_0x311074){try{jsonpatch[_0x3d66('0x20')](_0x311074,_0x1b9d42,!![]);}catch(_0x5c0d48){return BPromise[_0x3d66('0x21')](_0x5c0d48);}return _0x311074['save']();};}function saveUpdates(_0x26549d,_0x411dc8){return function(_0x11df2d){if(_0x11df2d){return _0x11df2d[_0x3d66('0x22')](_0x26549d)[_0x3d66('0x23')](function(_0x3b99ba){return _0x3b99ba;});}return null;};}function removeEntity(_0x772d83,_0x2255ea){return function(_0x2f0de1){if(_0x2f0de1){return _0x2f0de1[_0x3d66('0x24')]()[_0x3d66('0x23')](function(){_0x772d83[_0x3d66('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5245b0,_0x5b1778){return function(_0x3876e5){if(!_0x3876e5){_0x5245b0['sendStatus'](0x194);}return _0x3876e5;};}function handleError(_0x3401d4,_0x2763a3){_0x2763a3=_0x2763a3||0x1f4;return function(_0x481e55){logger[_0x3d66('0x25')](_0x481e55['stack']);if(_0x481e55[_0x3d66('0x26')]){delete _0x481e55[_0x3d66('0x26')];}_0x3401d4['status'](_0x2763a3)['send'](_0x481e55);};}exports['index']=function(_0x277ce6,_0x3717bc){var _0x5dcdce={},_0x3e99e2={},_0x30b89b={'count':0x0,'rows':[]};var _0x4cf00c=_['map'](db[_0x3d66('0x27')][_0x3d66('0x28')],function(_0x43c13d){return{'name':_0x43c13d[_0x3d66('0x29')],'type':_0x43c13d[_0x3d66('0x2a')]['key']};});_0x3e99e2[_0x3d66('0x2b')]=_['map'](_0x4cf00c,_0x3d66('0x26'));_0x3e99e2[_0x3d66('0x2c')]=_['keys'](_0x277ce6[_0x3d66('0x2c')]);_0x3e99e2[_0x3d66('0x2d')]=_[_0x3d66('0x2e')](_0x3e99e2[_0x3d66('0x2b')],_0x3e99e2[_0x3d66('0x2c')]);_0x5dcdce[_0x3d66('0x2f')]=_[_0x3d66('0x2e')](_0x3e99e2[_0x3d66('0x2b')],qs[_0x3d66('0x30')](_0x277ce6['query'][_0x3d66('0x30')]));_0x5dcdce[_0x3d66('0x2f')]=_0x5dcdce[_0x3d66('0x2f')][_0x3d66('0x31')]?_0x5dcdce[_0x3d66('0x2f')]:_0x3e99e2[_0x3d66('0x2b')];if(!_0x277ce6['query'][_0x3d66('0x32')]('nolimit')){_0x5dcdce[_0x3d66('0x1d')]=qs[_0x3d66('0x1d')](_0x277ce6[_0x3d66('0x2c')][_0x3d66('0x1d')]);_0x5dcdce[_0x3d66('0x1a')]=qs[_0x3d66('0x1a')](_0x277ce6[_0x3d66('0x2c')][_0x3d66('0x1a')]);}_0x5dcdce[_0x3d66('0x33')]=qs['sort'](_0x277ce6[_0x3d66('0x2c')][_0x3d66('0x34')]);_0x5dcdce[_0x3d66('0x35')]=qs[_0x3d66('0x2d')](_[_0x3d66('0x36')](_0x277ce6[_0x3d66('0x2c')],_0x3e99e2[_0x3d66('0x2d')]),_0x4cf00c);if(_0x277ce6[_0x3d66('0x2c')][_0x3d66('0x37')]){_0x5dcdce['where']=_['merge'](_0x5dcdce[_0x3d66('0x35')],{'$or':_[_0x3d66('0x38')](_0x4cf00c,function(_0x94f9b1){if(_0x94f9b1[_0x3d66('0x2a')]!==_0x3d66('0x39')){var _0x211f88={};_0x211f88[_0x94f9b1['name']]={'$like':'%'+_0x277ce6[_0x3d66('0x2c')][_0x3d66('0x37')]+'%'};return _0x211f88;}})});}_0x5dcdce=_[_0x3d66('0x3a')]({},_0x5dcdce,_0x277ce6['options']);var _0x1a104b={'where':_0x5dcdce[_0x3d66('0x35')]};return db['OpenchannelApplication']['count'](_0x1a104b)[_0x3d66('0x23')](function(_0x4f2c27){_0x30b89b[_0x3d66('0x1c')]=_0x4f2c27;if(_0x277ce6[_0x3d66('0x2c')][_0x3d66('0x3b')]){_0x5dcdce[_0x3d66('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x3d66('0x3d')](_0x5dcdce);})[_0x3d66('0x23')](function(_0xa47a32){_0x30b89b[_0x3d66('0x3e')]=_0xa47a32;return _0x30b89b;})['then'](respondWithFilteredResult(_0x3717bc,_0x5dcdce))[_0x3d66('0x3f')](handleError(_0x3717bc,null));};exports[_0x3d66('0x40')]=function(_0x4642d7,_0x222121){var _0x43cfdd={'raw':!![],'where':{'id':_0x4642d7[_0x3d66('0x41')]['id']}},_0xe144d0={};_0xe144d0[_0x3d66('0x2b')]=_[_0x3d66('0x42')](db[_0x3d66('0x27')]['rawAttributes']);_0xe144d0[_0x3d66('0x2c')]=_[_0x3d66('0x42')](_0x4642d7['query']);_0xe144d0[_0x3d66('0x2d')]=_[_0x3d66('0x2e')](_0xe144d0[_0x3d66('0x2b')],_0xe144d0[_0x3d66('0x2c')]);_0x43cfdd[_0x3d66('0x2f')]=_['intersection'](_0xe144d0[_0x3d66('0x2b')],qs[_0x3d66('0x30')](_0x4642d7[_0x3d66('0x2c')][_0x3d66('0x30')]));_0x43cfdd[_0x3d66('0x2f')]=_0x43cfdd[_0x3d66('0x2f')][_0x3d66('0x31')]?_0x43cfdd[_0x3d66('0x2f')]:_0xe144d0[_0x3d66('0x2b')];if(_0x4642d7[_0x3d66('0x2c')][_0x3d66('0x3b')]){_0x43cfdd[_0x3d66('0x3c')]=[{'all':!![]}];}_0x43cfdd=_['merge']({},_0x43cfdd,_0x4642d7['options']);return db[_0x3d66('0x27')][_0x3d66('0x43')](_0x43cfdd)[_0x3d66('0x23')](handleEntityNotFound(_0x222121,null))['then'](respondWithResult(_0x222121,null))[_0x3d66('0x3f')](handleError(_0x222121,null));};exports[_0x3d66('0x44')]=function(_0x34d5f6,_0x2b0bbc){return db[_0x3d66('0x27')][_0x3d66('0x44')](_0x34d5f6[_0x3d66('0x45')],{})[_0x3d66('0x23')](respondWithResult(_0x2b0bbc,0xc9))[_0x3d66('0x3f')](handleError(_0x2b0bbc,null));};exports[_0x3d66('0x22')]=function(_0xa812e7,_0x51a879){if(_0xa812e7[_0x3d66('0x45')]['id']){delete _0xa812e7['body']['id'];}return db['OpenchannelApplication'][_0x3d66('0x43')]({'where':{'id':_0xa812e7[_0x3d66('0x41')]['id']}})[_0x3d66('0x23')](handleEntityNotFound(_0x51a879,null))[_0x3d66('0x23')](saveUpdates(_0xa812e7['body'],null))[_0x3d66('0x23')](respondWithResult(_0x51a879,null))[_0x3d66('0x3f')](handleError(_0x51a879,null));};exports[_0x3d66('0x24')]=function(_0x3a48a6,_0x471583){return db[_0x3d66('0x27')][_0x3d66('0x43')]({'where':{'id':_0x3a48a6[_0x3d66('0x41')]['id']}})[_0x3d66('0x23')](handleEntityNotFound(_0x471583,null))[_0x3d66('0x23')](removeEntity(_0x471583,null))[_0x3d66('0x3f')](handleError(_0x471583,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 6d5a3c2..90e02f3 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 _0x6d7f=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','api','moment','bluebird','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6d7f,0xb0));var _0xf6d7=function(_0x1cfff1,_0x564189){_0x1cfff1=_0x1cfff1-0x0;var _0x2ad67e=_0x6d7f[_0x1cfff1];return _0x2ad67e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf6d7('0x0'));var moment=require(_0xf6d7('0x1'));var BPromise=require(_0xf6d7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf6d7('0x3'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xf6d7('0x4')]=function(_0x39c481,_0x2c0b0c){return _0x39c481[_0xf6d7('0x5')](_0xf6d7('0x6'),attributes,{'tableName':_0xf6d7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf6d7('0x8')});}; \ No newline at end of file +var _0x0b62=['exports','openchannel_applications','util','../../config/logger','api','moment','path','../../config/environment','./openchannelApplication.attributes'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x0b62,0x77));var _0x20b6=function(_0x163d57,_0x12852d){_0x163d57=_0x163d57-0x0;var _0x228d41=_0x0b62[_0x163d57];return _0x228d41;};'use strict';var _=require('lodash');var util=require(_0x20b6('0x0'));var logger=require(_0x20b6('0x1'))(_0x20b6('0x2'));var moment=require(_0x20b6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x20b6('0x4'));var rimraf=require('rimraf');var config=require(_0x20b6('0x5'));var attributes=require(_0x20b6('0x6'));module[_0x20b6('0x7')]=function(_0x2b0d7e,_0x2f1562){return _0x2b0d7e['define']('OpenchannelApplication',attributes,{'tableName':_0x20b6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 29415fc..e62d54d 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 _0xd7a3=['options','raw','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update'];(function(_0x2eb67c,_0x35d41e){var _0x376228=function(_0xc2b8a0){while(--_0xc2b8a0){_0x2eb67c['push'](_0x2eb67c['shift']());}};_0x376228(++_0x35d41e);}(_0xd7a3,0xac));var _0x3d7a=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xd7a3[_0x32d457];return _0x338386;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3d7a('0x0'));var BPromise=require(_0x3d7a('0x1'));var rs=require(_0x3d7a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d7a('0x3'))['db'];var utils=require(_0x3d7a('0x4'));var logger=require(_0x3d7a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3d7a('0x6'));var client=jayson[_0x3d7a('0x7')][_0x3d7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22a2d2,_0x4a1d8e,_0x12490b){return new BPromise(function(_0x76d701,_0x1219c4){return client[_0x3d7a('0x9')](_0x22a2d2,_0x12490b)[_0x3d7a('0xa')](function(_0x21168b){logger[_0x3d7a('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x4a1d8e,_0x3d7a('0xc'));logger[_0x3d7a('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x4a1d8e,_0x3d7a('0xc'),JSON[_0x3d7a('0xe')](_0x21168b));if(_0x21168b[_0x3d7a('0xf')]){if(_0x21168b[_0x3d7a('0xf')][_0x3d7a('0x10')]===0x1f4){logger['error'](_0x3d7a('0x11'),_0x4a1d8e,_0x21168b[_0x3d7a('0xf')]['message']);return _0x1219c4(_0x21168b[_0x3d7a('0xf')][_0x3d7a('0x12')]);}logger[_0x3d7a('0xf')](_0x3d7a('0x11'),_0x4a1d8e,_0x21168b[_0x3d7a('0xf')]['message']);return _0x76d701(_0x21168b[_0x3d7a('0xf')][_0x3d7a('0x12')]);}else{logger[_0x3d7a('0xb')](_0x3d7a('0x11'),_0x4a1d8e,_0x3d7a('0xc'));_0x76d701(_0x21168b[_0x3d7a('0x13')][_0x3d7a('0x12')]);}})[_0x3d7a('0x14')](function(_0x4542f2){logger['error'](_0x3d7a('0x11'),_0x4a1d8e,_0x4542f2);_0x1219c4(_0x4542f2);});});}exports[_0x3d7a('0x15')]=function(_0xc1384e){var _0x37fbb1=this;return new Promise(function(_0x4c21cc,_0x330abc){return db[_0x3d7a('0x16')][_0x3d7a('0x17')](_0xc1384e['body'],{'raw':_0xc1384e['options']?_0xc1384e[_0x3d7a('0x18')][_0x3d7a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc1384e[_0x3d7a('0x18')]?_0xc1384e[_0x3d7a('0x18')]['where']||null:null,'attributes':_0xc1384e[_0x3d7a('0x18')]?_0xc1384e[_0x3d7a('0x18')][_0x3d7a('0x1a')]||null:null,'limit':_0xc1384e[_0x3d7a('0x18')]?_0xc1384e[_0x3d7a('0x18')][_0x3d7a('0x1b')]||null:null})[_0x3d7a('0xa')](function(_0x41f6d7){logger[_0x3d7a('0xb')](_0x3d7a('0x15'),_0xc1384e);logger['debug'](_0x3d7a('0x15'),_0xc1384e,JSON[_0x3d7a('0xe')](_0x41f6d7));_0x4c21cc(_0x41f6d7);})[_0x3d7a('0x14')](function(_0xaf11f5){logger['error']('UpdateOpenchannelApplication',_0xaf11f5[_0x3d7a('0x12')],_0xc1384e);_0x330abc(_0x37fbb1['error'](0x1f4,_0xaf11f5[_0x3d7a('0x12')]));});});}; \ No newline at end of file +var _0xb1c3=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','update','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication'];(function(_0x51f2c0,_0xb7c46e){var _0x34ffd5=function(_0x2238c0){while(--_0x2238c0){_0x51f2c0['push'](_0x51f2c0['shift']());}};_0x34ffd5(++_0xb7c46e);}(_0xb1c3,0x80));var _0x3b1c=function(_0x3c157d,_0x18ee7f){_0x3c157d=_0x3c157d-0x0;var _0x545edb=_0xb1c3[_0x3c157d];return _0x545edb;};'use strict';var _=require(_0x3b1c('0x0'));var util=require(_0x3b1c('0x1'));var moment=require('moment');var BPromise=require(_0x3b1c('0x2'));var rs=require(_0x3b1c('0x3'));var fs=require('fs');var Redis=require(_0x3b1c('0x4'));var db=require(_0x3b1c('0x5'))['db'];var utils=require(_0x3b1c('0x6'));var logger=require(_0x3b1c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3b1c('0x8'));var client=jayson[_0x3b1c('0x9')][_0x3b1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2431c9,_0x14f3f5,_0xb22ab1){return new BPromise(function(_0x2c8f1b,_0x2d718f){return client[_0x3b1c('0xb')](_0x2431c9,_0xb22ab1)[_0x3b1c('0xc')](function(_0x57eced){logger[_0x3b1c('0xd')](_0x3b1c('0xe'),_0x14f3f5,'request\x20sent');logger[_0x3b1c('0xf')](_0x3b1c('0x10'),_0x14f3f5,_0x3b1c('0x11'),JSON[_0x3b1c('0x12')](_0x57eced));if(_0x57eced[_0x3b1c('0x13')]){if(_0x57eced[_0x3b1c('0x13')][_0x3b1c('0x14')]===0x1f4){logger[_0x3b1c('0x13')](_0x3b1c('0xe'),_0x14f3f5,_0x57eced[_0x3b1c('0x13')][_0x3b1c('0x15')]);return _0x2d718f(_0x57eced[_0x3b1c('0x13')][_0x3b1c('0x15')]);}logger[_0x3b1c('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x14f3f5,_0x57eced[_0x3b1c('0x13')][_0x3b1c('0x15')]);return _0x2c8f1b(_0x57eced[_0x3b1c('0x13')]['message']);}else{logger[_0x3b1c('0xd')](_0x3b1c('0xe'),_0x14f3f5,'request\x20sent');_0x2c8f1b(_0x57eced[_0x3b1c('0x16')][_0x3b1c('0x15')]);}})[_0x3b1c('0x17')](function(_0x240f31){logger[_0x3b1c('0x13')](_0x3b1c('0xe'),_0x14f3f5,_0x240f31);_0x2d718f(_0x240f31);});});}exports['UpdateOpenchannelApplication']=function(_0x38583){var _0xbf0ac0=this;return new Promise(function(_0x557b83,_0x2a8f92){return db['OpenchannelApplication'][_0x3b1c('0x18')](_0x38583[_0x3b1c('0x19')],{'raw':_0x38583['options']?_0x38583[_0x3b1c('0x1a')][_0x3b1c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38583[_0x3b1c('0x1a')]?_0x38583[_0x3b1c('0x1a')][_0x3b1c('0x1c')]||null:null,'attributes':_0x38583[_0x3b1c('0x1a')]?_0x38583[_0x3b1c('0x1a')][_0x3b1c('0x1d')]||null:null,'limit':_0x38583[_0x3b1c('0x1a')]?_0x38583[_0x3b1c('0x1a')][_0x3b1c('0x1e')]||null:null})[_0x3b1c('0xc')](function(_0x5b3877){logger[_0x3b1c('0xd')](_0x3b1c('0x1f'),_0x38583);logger[_0x3b1c('0xf')](_0x3b1c('0x1f'),_0x38583,JSON[_0x3b1c('0x12')](_0x5b3877));_0x557b83(_0x5b3877);})[_0x3b1c('0x17')](function(_0x5920a2){logger[_0x3b1c('0x13')](_0x3b1c('0x1f'),_0x5920a2[_0x3b1c('0x15')],_0x38583);_0x2a8f92(_0xbf0ac0[_0x3b1c('0x13')](0x1f4,_0x5920a2[_0x3b1c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 73cfe10..8c12db5 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 _0x0dd9=['describe','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','addTags','put','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe'];(function(_0x2076d0,_0x25c783){var _0x1266c8=function(_0xf54337){while(--_0xf54337){_0x2076d0['push'](_0x2076d0['shift']());}};_0x1266c8(++_0x25c783);}(_0x0dd9,0xb9));var _0x90dd=function(_0x46c737,_0x19685e){_0x46c737=_0x46c737-0x0;var _0x27b5e8=_0x0dd9[_0x46c737];return _0x27b5e8;};'use strict';var multer=require(_0x90dd('0x0'));var util=require(_0x90dd('0x1'));var path=require(_0x90dd('0x2'));var timeout=require(_0x90dd('0x3'));var express=require(_0x90dd('0x4'));var router=express[_0x90dd('0x5')]();var fs_extra=require(_0x90dd('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x90dd('0x7'));var controller=require(_0x90dd('0x8'));router['get']('/',auth[_0x90dd('0x9')](),controller[_0x90dd('0xa')]);router[_0x90dd('0xb')](_0x90dd('0xc'),auth[_0x90dd('0x9')](),controller[_0x90dd('0xd')]);router[_0x90dd('0xb')]('/:id',auth[_0x90dd('0x9')](),controller[_0x90dd('0xe')]);router['get'](_0x90dd('0xf'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x10')]);router['get'](_0x90dd('0x11'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x12')]);router[_0x90dd('0x13')]('/',auth['isAuthenticated'](),controller[_0x90dd('0x14')]);router[_0x90dd('0x13')]('/:id/messages',auth[_0x90dd('0x9')](),controller['addMessage']);router[_0x90dd('0x13')](_0x90dd('0x15'),auth[_0x90dd('0x9')](),interaction[_0x90dd('0x16')](_0x90dd('0x17'),'openchannelinteraction:addtags'),controller[_0x90dd('0x18')]);router[_0x90dd('0x19')](_0x90dd('0x1a'),auth[_0x90dd('0x9')](),interaction[_0x90dd('0x16')]('openchannel',_0x90dd('0x1b')),controller[_0x90dd('0x1c')]);router[_0x90dd('0x1d')](_0x90dd('0x1a'),auth[_0x90dd('0x9')](),interaction[_0x90dd('0x16')](_0x90dd('0x17'),_0x90dd('0x1e')),controller[_0x90dd('0x1f')]);router['delete'](_0x90dd('0x15'),auth[_0x90dd('0x9')](),controller[_0x90dd('0x20')]);module['exports']=router; \ No newline at end of file +var _0x7a59=['openchannelinteraction:addtags','addTags','put','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id/download','post','create','/:id/messages','/:id/tags','tracked','openchannel'];(function(_0x5a7432,_0x54e84e){var _0x22cdec=function(_0x26cd8f){while(--_0x26cd8f){_0x5a7432['push'](_0x5a7432['shift']());}};_0x22cdec(++_0x54e84e);}(_0x7a59,0x19e));var _0x97a5=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x7a59[_0x3203a1];return _0x24215e;};'use strict';var multer=require('multer');var util=require(_0x97a5('0x0'));var path=require('path');var timeout=require(_0x97a5('0x1'));var express=require(_0x97a5('0x2'));var router=express[_0x97a5('0x3')]();var fs_extra=require(_0x97a5('0x4'));var auth=require(_0x97a5('0x5'));var interaction=require(_0x97a5('0x6'));var config=require(_0x97a5('0x7'));var controller=require(_0x97a5('0x8'));router[_0x97a5('0x9')]('/',auth[_0x97a5('0xa')](),controller['index']);router[_0x97a5('0x9')](_0x97a5('0xb'),auth[_0x97a5('0xa')](),controller[_0x97a5('0xc')]);router[_0x97a5('0x9')]('/:id',auth[_0x97a5('0xa')](),controller['show']);router[_0x97a5('0x9')]('/:id/messages',auth[_0x97a5('0xa')](),controller['getMessages']);router[_0x97a5('0x9')](_0x97a5('0xd'),auth[_0x97a5('0xa')](),controller['download']);router[_0x97a5('0xe')]('/',auth[_0x97a5('0xa')](),controller[_0x97a5('0xf')]);router['post'](_0x97a5('0x10'),auth[_0x97a5('0xa')](),controller['addMessage']);router['post'](_0x97a5('0x11'),auth[_0x97a5('0xa')](),interaction[_0x97a5('0x12')](_0x97a5('0x13'),_0x97a5('0x14')),controller[_0x97a5('0x15')]);router[_0x97a5('0x16')](_0x97a5('0x17'),auth[_0x97a5('0xa')](),interaction[_0x97a5('0x12')](_0x97a5('0x13'),_0x97a5('0x18')),controller[_0x97a5('0x19')]);router[_0x97a5('0x1a')](_0x97a5('0x17'),auth[_0x97a5('0xa')](),interaction[_0x97a5('0x12')]('openchannel',_0x97a5('0x1b')),controller[_0x97a5('0x1c')]);router[_0x97a5('0x1a')](_0x97a5('0x11'),auth[_0x97a5('0xa')](),controller[_0x97a5('0x1d')]);module[_0x97a5('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5d2300c..51ff137 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 _0xa724=['out','BOOLEAN','INTEGER','sequelize','DATE','STRING','ENUM'];(function(_0x326e79,_0x33dc91){var _0x37eb89=function(_0xbaef25){while(--_0xbaef25){_0x326e79['push'](_0x326e79['shift']());}};_0x37eb89(++_0x33dc91);}(_0xa724,0xf1));var _0x4a72=function(_0x3ffe74,_0x455a54){_0x3ffe74=_0x3ffe74-0x0;var _0x3f8816=_0xa724[_0x3ffe74];return _0x3f8816;};'use strict';var Sequelize=require(_0x4a72('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4a72('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4a72('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4a72('0x2')]},'read1stAt':{'type':Sequelize[_0x4a72('0x1')]},'threadId':{'type':Sequelize[_0x4a72('0x2')]},'externalUrl':{'type':Sequelize[_0x4a72('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4a72('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x4a72('0x3')]('in',_0x4a72('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x4a72('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x4a72('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4a72('0x6')]}}; \ No newline at end of file +var _0x936d=['out','ENUM','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x30ae7b,_0x3a718f){var _0xa9d0cf=function(_0x8102a1){while(--_0x8102a1){_0x30ae7b['push'](_0x30ae7b['shift']());}};_0xa9d0cf(++_0x3a718f);}(_0x936d,0x183));var _0xd936=function(_0x542913,_0x4f213a){_0x542913=_0x542913-0x0;var _0x4f812c=_0x936d[_0x542913];return _0x4f812c;};'use strict';var Sequelize=require(_0xd936('0x0'));module[_0xd936('0x1')]={'closed':{'type':Sequelize[_0xd936('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd936('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd936('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd936('0x4')]},'note':{'type':Sequelize[_0xd936('0x4')]},'read1stAt':{'type':Sequelize[_0xd936('0x3')]},'threadId':{'type':Sequelize[_0xd936('0x4')]},'externalUrl':{'type':Sequelize[_0xd936('0x4')]},'lastMsgAt':{'type':Sequelize[_0xd936('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd936('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd936('0x6')]('in',_0xd936('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd936('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd936('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 80c1361..97dc400 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 _0x6a1e=['getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','map','$gte','split','format','rows','addTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','fullname','get','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','basename','createReadStream','pipe','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.ejs','transcript-','Unable\x20to\x20delete\x20zip\x20file','zip-dir','moment','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','undefined','limit','count','update','then','end','sendStatus','error','name','send','index','rawAttributes','key','getOptions','findAll','query','user','catch','show','type','from','params','model','OpenchannelInteraction','keys','filters','attributes','fields','length','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','OpenchannelMessage','ids','omit'];(function(_0x2a8860,_0x2da926){var _0x2f47a4=function(_0x3b7f54){while(--_0x3b7f54){_0x2a8860['push'](_0x2a8860['shift']());}};_0x2f47a4(++_0x2da926);}(_0x6a1e,0x1b6));var _0xe6a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a1e[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe6a1('0x0'));var moment=require(_0xe6a1('0x1'));var util=require(_0xe6a1('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe6a1('0x3'));var Redis=require(_0xe6a1('0x4'));var interaction=require(_0xe6a1('0x5'));var qs=require(_0xe6a1('0x6'));var pdf=require(_0xe6a1('0x7'));var logger=require(_0xe6a1('0x8'))('api');var config=require(_0xe6a1('0x9'));var db=require(_0xe6a1('0xa'))['db'];config['redis']=_[_0xe6a1('0xb')](config[_0xe6a1('0xc')],{'host':_0xe6a1('0xd'),'port':0x18eb});var socket=require(_0xe6a1('0xe'))(new Redis(config['redis']));require(_0xe6a1('0xf'))[_0xe6a1('0x10')](socket);function respondWithStatusCode(_0x128ae1,_0x2dc620){_0x2dc620=_0x2dc620||0xcc;return function(_0x19988a){if(_0x19988a){return _0x128ae1['sendStatus'](_0x2dc620);}return _0x128ae1[_0xe6a1('0x11')](_0x2dc620)['end']();};}function respondWithResult(_0x28c6a4,_0x3932e6){_0x3932e6=_0x3932e6||0xc8;return function(_0x2cd31b){if(_0x2cd31b){return _0x28c6a4['status'](_0x3932e6)[_0xe6a1('0x12')](_0x2cd31b);}};}function respondWithFilteredResult(_0x3fee8c,_0x33ccd3){return function(_0x514600){if(_0x514600){var _0x2f9a6=typeof _0x33ccd3[_0xe6a1('0x13')]===_0xe6a1('0x14')&&typeof _0x33ccd3[_0xe6a1('0x15')]===_0xe6a1('0x14');var _0x319e26=_0x514600[_0xe6a1('0x16')];var _0x145d89=_0x2f9a6?0x0:_0x33ccd3[_0xe6a1('0x13')];var _0x148a37=_0x2f9a6?_0x514600[_0xe6a1('0x16')]:_0x33ccd3[_0xe6a1('0x13')]+_0x33ccd3[_0xe6a1('0x15')];var _0xfd59a4;if(_0x148a37>=_0x319e26){_0x148a37=_0x319e26;_0xfd59a4=0xc8;}else{_0xfd59a4=0xce;}_0x3fee8c['status'](_0xfd59a4);return _0x3fee8c['set']('Content-Range',_0x145d89+'-'+_0x148a37+'/'+_0x319e26)[_0xe6a1('0x12')](_0x514600);}return null;};}function saveUpdates(_0x39bbba){return function(_0x989162){if(_0x989162){return _0x989162[_0xe6a1('0x17')](_0x39bbba)['then'](function(_0x28842e){return _0x28842e;});}return null;};}function removeEntity(_0x57af75){return function(_0x1b7197){if(_0x1b7197){return _0x1b7197['destroy']()[_0xe6a1('0x18')](function(){_0x57af75[_0xe6a1('0x11')](0xcc)[_0xe6a1('0x19')]();});}};}function handleEntityNotFound(_0x5d5854){return function(_0x5e89d6){if(!_0x5e89d6){_0x5d5854[_0xe6a1('0x1a')](0x194);}return _0x5e89d6;};}function handleError(_0x45f449,_0x4bc8d8){_0x4bc8d8=_0x4bc8d8||0x1f4;return function(_0x391551){logger[_0xe6a1('0x1b')](_0x391551['stack']);if(_0x391551[_0xe6a1('0x1c')]){delete _0x391551[_0xe6a1('0x1c')];}_0x45f449[_0xe6a1('0x11')](_0x4bc8d8)[_0xe6a1('0x1d')](_0x391551);};}exports[_0xe6a1('0x1e')]=function(_0x4172ea,_0x3df8be){var _0x12373b={};var _0x2c2961=_['map'](db['OpenchannelInteraction'][_0xe6a1('0x1f')],function(_0x43c4f4){return{'name':_0x43c4f4['fieldName'],'type':_0x43c4f4['type'][_0xe6a1('0x20')]};});_0x12373b=qs[_0xe6a1('0x21')](_0x2c2961,_0x4172ea);return interaction[_0xe6a1('0x22')]('openchannel',_0x4172ea[_0xe6a1('0x23')],_0x4172ea[_0xe6a1('0x24')],_0x12373b,_0x2c2961)['then'](respondWithFilteredResult(_0x3df8be,_0x12373b))[_0xe6a1('0x25')](handleError(_0x3df8be,null));};exports[_0xe6a1('0x26')]=function(_0xb4e53a,_0x1e927c){var _0x12eaed={};if(_0xb4e53a[_0xe6a1('0x23')]['type']&&_0xb4e53a[_0xe6a1('0x23')][_0xe6a1('0x27')]===_0xe6a1('0x28')){_0x12eaed['from']=_0xb4e53a[_0xe6a1('0x29')]['id'];}else{_0x12eaed['id']=_0xb4e53a[_0xe6a1('0x29')]['id'];}var _0x1d6498={'raw':![],'where':_0x12eaed},_0x1688fe={};_0x1688fe[_0xe6a1('0x2a')]=_['keys'](db[_0xe6a1('0x2b')]['rawAttributes']);_0x1688fe['query']=_[_0xe6a1('0x2c')](_0xb4e53a[_0xe6a1('0x23')]);_0x1688fe[_0xe6a1('0x2d')]=_['intersection'](_0x1688fe[_0xe6a1('0x2a')],_0x1688fe[_0xe6a1('0x23')]);_0x1d6498[_0xe6a1('0x2e')]=_['intersection'](_0x1688fe['model'],qs['fields'](_0xb4e53a['query'][_0xe6a1('0x2f')]));_0x1d6498[_0xe6a1('0x2e')]=_0x1d6498[_0xe6a1('0x2e')][_0xe6a1('0x30')]?_0x1d6498[_0xe6a1('0x2e')]:_0x1688fe[_0xe6a1('0x2a')];if(_0xb4e53a['query'][_0xe6a1('0x31')]){_0x1d6498[_0xe6a1('0x32')]=[{'all':!![]}];}_0x1d6498=_[_0xe6a1('0x33')]({},_0x1d6498,_0xb4e53a[_0xe6a1('0x34')]);return db[_0xe6a1('0x2b')][_0xe6a1('0x35')](_0x1d6498)['then'](handleEntityNotFound(_0x1e927c,null))[_0xe6a1('0x18')](respondWithResult(_0x1e927c,null))['catch'](handleError(_0x1e927c,null));};exports[_0xe6a1('0x36')]=function(_0x134bff,_0x2bb820){return db['OpenchannelInteraction'][_0xe6a1('0x36')](_0x134bff[_0xe6a1('0x37')],{})['then'](respondWithResult(_0x2bb820,0xc9))[_0xe6a1('0x25')](handleError(_0x2bb820,null));};exports[_0xe6a1('0x17')]=function(_0x50c4f7,_0x5e7473){if(_0x50c4f7[_0xe6a1('0x37')]['id']){delete _0x50c4f7['body']['id'];}return db['OpenchannelInteraction'][_0xe6a1('0x35')]({'where':{'id':_0x50c4f7['params']['id']}})[_0xe6a1('0x18')](handleEntityNotFound(_0x5e7473,null))[_0xe6a1('0x18')](saveUpdates(_0x50c4f7[_0xe6a1('0x37')],null))[_0xe6a1('0x18')](respondWithResult(_0x5e7473,null))[_0xe6a1('0x25')](handleError(_0x5e7473,null));};exports[_0xe6a1('0x38')]=function(_0x378895,_0x448d5f){return db[_0xe6a1('0x2b')]['find']({'where':{'id':_0x378895[_0xe6a1('0x29')]['id']}})[_0xe6a1('0x18')](handleEntityNotFound(_0x448d5f,null))[_0xe6a1('0x18')](removeEntity(_0x448d5f,null))[_0xe6a1('0x25')](handleError(_0x448d5f,null));};exports[_0xe6a1('0x39')]=function(_0xac3da3,_0x1584fe){return db[_0xe6a1('0x2b')][_0xe6a1('0x39')]()[_0xe6a1('0x18')](respondWithResult(_0x1584fe,null))['catch'](handleError(_0x1584fe,null));};exports[_0xe6a1('0x3a')]=function(_0x39cf76,_0xf19153){return db[_0xe6a1('0x3b')][_0xe6a1('0x35')]({'where':{'id':_0x39cf76[_0xe6a1('0x29')]['id']}})[_0xe6a1('0x18')](handleEntityNotFound(_0xf19153,null))[_0xe6a1('0x18')](function(_0x2c37c4){if(_0x2c37c4){return _0x2c37c4[_0xe6a1('0x3a')](_0x39cf76[_0xe6a1('0x37')][_0xe6a1('0x3c')],_[_0xe6a1('0x3d')](_0x39cf76[_0xe6a1('0x37')],[_0xe6a1('0x3c'),'id'])||{});}})['then'](respondWithResult(_0xf19153,null))[_0xe6a1('0x25')](handleError(_0xf19153,null));};exports[_0xe6a1('0x3e')]=function(_0x3f831c,_0x1a7bbb){var _0x20c84f={'raw':![],'where':{}};var _0x2ef06d={};var _0x23a7da={'count':0x0,'rows':[]};return db[_0xe6a1('0x2b')][_0xe6a1('0x3f')]({'where':{'id':_0x3f831c[_0xe6a1('0x29')]['id']}})[_0xe6a1('0x18')](handleEntityNotFound(_0x1a7bbb,null))['then'](function(_0x342f35){if(_0x342f35){_0x2ef06d[_0xe6a1('0x2a')]=_[_0xe6a1('0x2c')](db['OpenchannelMessage'][_0xe6a1('0x1f')]);_0x2ef06d['query']=_[_0xe6a1('0x2c')](_0x3f831c['query']);_0x2ef06d['filters']=_[_0xe6a1('0x40')](_0x2ef06d[_0xe6a1('0x2a')],_0x2ef06d[_0xe6a1('0x23')]);_0x20c84f[_0xe6a1('0x2e')]=_[_0xe6a1('0x40')](_0x2ef06d[_0xe6a1('0x2a')],qs[_0xe6a1('0x2f')](_0x3f831c[_0xe6a1('0x23')][_0xe6a1('0x2f')]));_0x20c84f[_0xe6a1('0x2e')]=_0x20c84f[_0xe6a1('0x2e')][_0xe6a1('0x30')]?_0x20c84f['attributes']:_0x2ef06d[_0xe6a1('0x2a')];if(!_0x3f831c[_0xe6a1('0x23')][_0xe6a1('0x41')](_0xe6a1('0x42'))){_0x20c84f[_0xe6a1('0x15')]=qs[_0xe6a1('0x15')](_0x3f831c[_0xe6a1('0x23')]['limit']);_0x20c84f['offset']=qs[_0xe6a1('0x13')](_0x3f831c[_0xe6a1('0x23')][_0xe6a1('0x13')]);}_0x20c84f[_0xe6a1('0x43')]=qs[_0xe6a1('0x44')](_0x3f831c[_0xe6a1('0x23')]['sort']);_0x20c84f[_0xe6a1('0x45')]=qs[_0xe6a1('0x2d')](_[_0xe6a1('0x46')](_0x3f831c[_0xe6a1('0x23')],_0x2ef06d['filters']));_0x20c84f[_0xe6a1('0x45')][_0xe6a1('0x47')]=_0x342f35['id'];if(_0x3f831c[_0xe6a1('0x23')][_0xe6a1('0x48')]){_0x20c84f[_0xe6a1('0x45')]=_[_0xe6a1('0x33')](_0x20c84f[_0xe6a1('0x45')],{'$or':_[_0xe6a1('0x49')](_0x20c84f['attributes'],function(_0x5952ec){var _0x509a1e={};_0x509a1e[_0x5952ec]={'$like':'%'+_0x3f831c['query'][_0xe6a1('0x48')]+'%'};return _0x509a1e;})});}if(_0x3f831c[_0xe6a1('0x23')][_0xe6a1('0x4a')]){var _0x38ed12=_0x3f831c[_0xe6a1('0x23')][_0xe6a1('0x4a')][_0xe6a1('0x4b')](',');var _0x10deb3={};_0x10deb3[_0x38ed12[0x0]]={'$gte':moment(_0x38ed12[0x1])[_0xe6a1('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x20c84f[_0xe6a1('0x45')]=_[_0xe6a1('0x33')](_0x20c84f[_0xe6a1('0x45')],_0x10deb3);}_0x20c84f=_['merge']({},_0x20c84f,_0x3f831c[_0xe6a1('0x34')]);return db[_0xe6a1('0x3b')][_0xe6a1('0x16')]({'where':_0x20c84f['where']})['then'](function(_0x3f79f3){_0x23a7da[_0xe6a1('0x16')]=_0x3f79f3;if(_0x3f831c[_0xe6a1('0x23')][_0xe6a1('0x31')]){_0x20c84f[_0xe6a1('0x32')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xe6a1('0x22')](_0x20c84f);})[_0xe6a1('0x18')](function(_0x508787){_0x23a7da[_0xe6a1('0x4d')]=_0x508787;return _0x23a7da;});}})[_0xe6a1('0x18')](respondWithFilteredResult(_0x1a7bbb,_0x20c84f))[_0xe6a1('0x25')](handleError(_0x1a7bbb,null));};exports[_0xe6a1('0x4e')]=function(_0x24952d,_0xb98d12){return db[_0xe6a1('0x2b')][_0xe6a1('0x35')]({'where':{'id':_0x24952d['params']['id']}})[_0xe6a1('0x18')](handleEntityNotFound(_0xb98d12,null))['then'](function(_0x4eec43){if(_0x4eec43){return _0x4eec43['setTags'](_0x24952d[_0xe6a1('0x37')][_0xe6a1('0x3c')],_[_0xe6a1('0x3d')](_0x24952d['body'],[_0xe6a1('0x3c'),'id'])||{})[_0xe6a1('0x4f')](function(){return db['Tag']['findAll']({'attributes':['id',_0xe6a1('0x1c'),_0xe6a1('0x50')],'where':{'id':_0x24952d['body'][_0xe6a1('0x3c')]}});})[_0xe6a1('0x18')](function(_0x4a8267){socket[_0xe6a1('0x51')](_0xe6a1('0x52'),{'id':Number(_0x24952d[_0xe6a1('0x29')]['id']),'tags':_0x4a8267||[]});return{'id':Number(_0x24952d[_0xe6a1('0x29')]['id']),'tags':_0x4a8267||[]};});}})[_0xe6a1('0x18')](respondWithResult(_0xb98d12,null))[_0xe6a1('0x25')](handleError(_0xb98d12,null));};exports[_0xe6a1('0x53')]=function(_0xd8ceb1,_0x1a2cdf){return db[_0xe6a1('0x2b')]['find']({'where':{'id':_0xd8ceb1[_0xe6a1('0x29')]['id']}})[_0xe6a1('0x18')](handleEntityNotFound(_0x1a2cdf,null))[_0xe6a1('0x18')](function(_0xeebe51){if(_0xeebe51){return _0xeebe51[_0xe6a1('0x53')](_0xd8ceb1[_0xe6a1('0x23')]['ids']);}})[_0xe6a1('0x18')](respondWithStatusCode(_0x1a2cdf,null))[_0xe6a1('0x25')](handleError(_0x1a2cdf,null));};exports[_0xe6a1('0x54')]=function(_0x1a2366,_0x5d1f4a){var _0x24cab5=moment()['unix']()[_0xe6a1('0x55')]();var _0x4e60e0=path[_0xe6a1('0x56')](config[_0xe6a1('0x57')],_0xe6a1('0x58'),_0xe6a1('0x59'),'tmp');var _0x1aaf81=path['join'](config[_0xe6a1('0x57')],_0xe6a1('0x58'),_0xe6a1('0x59'),_0xe6a1('0x5a'));var _0x31af49=path[_0xe6a1('0x56')](_0x4e60e0,_0x24cab5);var _0x1c55b8=util[_0xe6a1('0x4c')](_0xe6a1('0x5b'),_0x1a2366[_0xe6a1('0x29')]['id'],_0x24cab5);var _0x23b18a=path[_0xe6a1('0x56')](_0x4e60e0,_0x1c55b8);var _0x1ed782=[];_0x1ed782[_0xe6a1('0x5c')]({'model':db[_0xe6a1('0x5d')],'as':_0xe6a1('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x1ed782[_0xe6a1('0x5c')]({'model':db[_0xe6a1('0x5e')],'as':_0xe6a1('0x5f'),'attributes':['id',_0xe6a1('0x60'),_0xe6a1('0x61')],'raw':!![]});if(_0x1a2366[_0xe6a1('0x23')][_0xe6a1('0x5a')]){_0x1ed782[_0xe6a1('0x5c')]({'model':db[_0xe6a1('0x62')],'as':'Attachment','raw':!![]});}var _0x19c64d=[{'model':db[_0xe6a1('0x3b')],'as':_0xe6a1('0x63'),'attributes':['id',_0xe6a1('0x37'),_0xe6a1('0x64'),'direction',_0xe6a1('0x65'),_0xe6a1('0x66')],'include':_0x1ed782}];_0x19c64d['push']({'model':db[_0xe6a1('0x67')],'as':_0xe6a1('0x68'),'attributes':['id','name']});_0x19c64d[_0xe6a1('0x5c')]({'model':db[_0xe6a1('0x5d')],'as':'Owner','attributes':['id',_0xe6a1('0x69')]});return db[_0xe6a1('0x2b')][_0xe6a1('0x35')]({'where':{'id':_0x1a2366[_0xe6a1('0x29')]['id']},'include':_0x19c64d})[_0xe6a1('0x18')](handleEntityNotFound(_0x5d1f4a,null))[_0xe6a1('0x18')](function(_0x2eb25f){if(_0x2eb25f){var _0x761fe=_0x2eb25f[_0xe6a1('0x6a')]({'plain':!![]});fs['mkdirSync'](_0x31af49);var _0x2b6476={'channel':'Openchannel','account':_0x761fe[_0xe6a1('0x68')]['name'],'agent':_0x761fe['Owner']?_0x761fe['Owner'][_0xe6a1('0x69')]:_0xe6a1('0x6b'),'createdAt':moment(_0x761fe['createdAt'])[_0xe6a1('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe6a1('0x55')](),'closedAt':_0x761fe[_0xe6a1('0x6c')]?moment(_0x761fe['closedAt'])[_0xe6a1('0x4c')](_0xe6a1('0x6d'))['toString']():'','disposition':_0x761fe[_0xe6a1('0x6e')],'visibility':_0x761fe[_0xe6a1('0x6f')]?_0xe6a1('0x70'):'Private','messages':_(_0x761fe[_0xe6a1('0x63')])[_0xe6a1('0x48')]({'secret':![]})[_0xe6a1('0x49')](function(_0x4d9ea6){if(_0x4d9ea6[_0xe6a1('0x62')]){var _0x50c65b=path['join'](_0x1aaf81,_0x4d9ea6[_0xe6a1('0x62')][_0xe6a1('0x71')]);if(fs['existsSync'](_0x50c65b)){fs[_0xe6a1('0x72')](_0x50c65b)[_0xe6a1('0x73')](fs[_0xe6a1('0x74')](path['join'](_0x31af49,_0x4d9ea6[_0xe6a1('0x62')][_0xe6a1('0x71')])));}}return{'date':moment(_0x4d9ea6['createdAt'])[_0xe6a1('0x4c')](_0xe6a1('0x6d'))['toString'](),'sender':_0x4d9ea6[_0xe6a1('0x75')]===_0xe6a1('0x76')?_0x4d9ea6[_0xe6a1('0x5d')]?_0x4d9ea6[_0xe6a1('0x5d')][_0xe6a1('0x69')]:_0xe6a1('0x77'):_0x4d9ea6['Contact'][_0xe6a1('0x60')]+(_0x4d9ea6[_0xe6a1('0x5f')]['lastName']?'\x20'+_0x4d9ea6[_0xe6a1('0x5f')][_0xe6a1('0x61')]:''),'body':_0x4d9ea6[_0xe6a1('0x62')]?_0x4d9ea6[_0xe6a1('0x62')]['basename']:_0x4d9ea6[_0xe6a1('0x37')],'direction':_0x4d9ea6[_0xe6a1('0x75')]===_0xe6a1('0x76')?'A':'C','secret':_0x4d9ea6[_0xe6a1('0x65')],'read':_0x4d9ea6['read'],'attachment':_0x4d9ea6[_0xe6a1('0x62')]};})['value']()};return ejs[_0xe6a1('0x78')](path[_0xe6a1('0x56')](config['root'],'server',_0xe6a1('0x79'),_0xe6a1('0x7a')),{'interaction':_0x2b6476})[_0xe6a1('0x18')](function(_0x377e60){var _0x195978=path[_0xe6a1('0x56')](_0x31af49,_0xe6a1('0x7b')+_0x761fe['id']+'-'+_0x24cab5+'.pdf');var _0xb06dd={'path':_0x195978,'channel':'Openchannel','interactionId':_0x761fe['id']};return pdf['createPdfFromHTML'](_0x377e60,_0xb06dd);})[_0xe6a1('0x18')](function(){return new Promise(function(_0x573949,_0x3c8240){zipdir(_0x31af49,{'saveTo':_0x23b18a},function(_0x39e748,_0x4eea6b){if(_0x39e748)return _0x3c8240(_0x39e748);return _0x573949(_0x4eea6b);});})['then'](function(){return new Promise(function(_0x3cdc56,_0x3978eb){rimraf(_0x31af49,function(_0x5d61e5){if(_0x5d61e5)_0x3978eb(_0x5d61e5);return _0x3cdc56();});});})[_0xe6a1('0x18')](function(){return _0x5d1f4a[_0xe6a1('0x54')](_0x23b18a,_0x1c55b8,function(_0x441b19){if(_0x441b19){logger[_0xe6a1('0x1b')](_0xe6a1('0x7c'),_0x441b19);}else{fs['unlinkSync'](_0x23b18a);}});});});}else{return _0x5d1f4a['sendStatus'](0xc8);}})[_0xe6a1('0x25')](handleError(_0x5d1f4a,null));}; \ No newline at end of file +var _0x9cc9=['fieldName','type','key','getOptions','findAll','openchannel','user','catch','show','query','from','params','model','keys','filters','attributes','fields','length','include','options','find','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','intersection','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','merge','map','filter','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','server','attachments','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','get','mkdirSync','N.A.','closed','closedAt','toString','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','System','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','util','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','count','Content-Range','update','then','error','stack','name','index','OpenchannelInteraction'];(function(_0x350a47,_0x1522f1){var _0x5517a0=function(_0x6cb8b7){while(--_0x6cb8b7){_0x350a47['push'](_0x350a47['shift']());}};_0x5517a0(++_0x1522f1);}(_0x9cc9,0x15a));var _0x99cc=function(_0xe4c541,_0xdf3275){_0xe4c541=_0xe4c541-0x0;var _0x5c4cd7=_0x9cc9[_0xe4c541];return _0x5c4cd7;};'use strict';var rimraf=require(_0x99cc('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var util=require(_0x99cc('0x1'));var path=require('path');var ejs=require(_0x99cc('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x99cc('0x3'));var interaction=require(_0x99cc('0x4'));var qs=require('../../components/parsers/qs');var pdf=require(_0x99cc('0x5'));var logger=require(_0x99cc('0x6'))(_0x99cc('0x7'));var config=require(_0x99cc('0x8'));var db=require(_0x99cc('0x9'))['db'];config[_0x99cc('0xa')]=_[_0x99cc('0xb')](config['redis'],{'host':_0x99cc('0xc'),'port':0x18eb});var socket=require(_0x99cc('0xd'))(new Redis(config[_0x99cc('0xa')]));require('./openchannelInteraction.socket')[_0x99cc('0xe')](socket);function respondWithStatusCode(_0x2d93d4,_0x62757){_0x62757=_0x62757||0xcc;return function(_0x1d5d52){if(_0x1d5d52){return _0x2d93d4['sendStatus'](_0x62757);}return _0x2d93d4[_0x99cc('0xf')](_0x62757)[_0x99cc('0x10')]();};}function respondWithResult(_0x522814,_0x498644){_0x498644=_0x498644||0xc8;return function(_0x3c1815){if(_0x3c1815){return _0x522814[_0x99cc('0xf')](_0x498644)[_0x99cc('0x11')](_0x3c1815);}};}function respondWithFilteredResult(_0x569149,_0x1df5e9){return function(_0x24026b){if(_0x24026b){var _0x5f266d=typeof _0x1df5e9[_0x99cc('0x12')]==='undefined'&&typeof _0x1df5e9[_0x99cc('0x13')]==='undefined';var _0x386842=_0x24026b[_0x99cc('0x14')];var _0x9e34aa=_0x5f266d?0x0:_0x1df5e9[_0x99cc('0x12')];var _0x34c5fa=_0x5f266d?_0x24026b[_0x99cc('0x14')]:_0x1df5e9[_0x99cc('0x12')]+_0x1df5e9['limit'];var _0x53c6dc;if(_0x34c5fa>=_0x386842){_0x34c5fa=_0x386842;_0x53c6dc=0xc8;}else{_0x53c6dc=0xce;}_0x569149[_0x99cc('0xf')](_0x53c6dc);return _0x569149['set'](_0x99cc('0x15'),_0x9e34aa+'-'+_0x34c5fa+'/'+_0x386842)[_0x99cc('0x11')](_0x24026b);}return null;};}function saveUpdates(_0x2fe07e){return function(_0x243702){if(_0x243702){return _0x243702[_0x99cc('0x16')](_0x2fe07e)[_0x99cc('0x17')](function(_0xcc3df1){return _0xcc3df1;});}return null;};}function removeEntity(_0x33b997){return function(_0x19d7b7){if(_0x19d7b7){return _0x19d7b7['destroy']()['then'](function(){_0x33b997[_0x99cc('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33a0d4){return function(_0x2636c2){if(!_0x2636c2){_0x33a0d4['sendStatus'](0x194);}return _0x2636c2;};}function handleError(_0x22a84d,_0x50a5ef){_0x50a5ef=_0x50a5ef||0x1f4;return function(_0xf8bf2d){logger[_0x99cc('0x18')](_0xf8bf2d[_0x99cc('0x19')]);if(_0xf8bf2d[_0x99cc('0x1a')]){delete _0xf8bf2d[_0x99cc('0x1a')];}_0x22a84d[_0x99cc('0xf')](_0x50a5ef)['send'](_0xf8bf2d);};}exports[_0x99cc('0x1b')]=function(_0x27b590,_0x41c5c0){var _0x19efe7={};var _0x5c5ff3=_['map'](db[_0x99cc('0x1c')]['rawAttributes'],function(_0x2f5751){return{'name':_0x2f5751[_0x99cc('0x1d')],'type':_0x2f5751[_0x99cc('0x1e')][_0x99cc('0x1f')]};});_0x19efe7=qs[_0x99cc('0x20')](_0x5c5ff3,_0x27b590);return interaction[_0x99cc('0x21')](_0x99cc('0x22'),_0x27b590['query'],_0x27b590[_0x99cc('0x23')],_0x19efe7,_0x5c5ff3)[_0x99cc('0x17')](respondWithFilteredResult(_0x41c5c0,_0x19efe7))[_0x99cc('0x24')](handleError(_0x41c5c0,null));};exports[_0x99cc('0x25')]=function(_0x199fe2,_0x58c4ec){var _0x4bf146={};if(_0x199fe2[_0x99cc('0x26')][_0x99cc('0x1e')]&&_0x199fe2[_0x99cc('0x26')][_0x99cc('0x1e')]===_0x99cc('0x27')){_0x4bf146['from']=_0x199fe2[_0x99cc('0x28')]['id'];}else{_0x4bf146['id']=_0x199fe2[_0x99cc('0x28')]['id'];}var _0x7c0fb6={'raw':![],'where':_0x4bf146},_0x1a7270={};_0x1a7270[_0x99cc('0x29')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x1a7270[_0x99cc('0x26')]=_[_0x99cc('0x2a')](_0x199fe2[_0x99cc('0x26')]);_0x1a7270[_0x99cc('0x2b')]=_['intersection'](_0x1a7270[_0x99cc('0x29')],_0x1a7270['query']);_0x7c0fb6[_0x99cc('0x2c')]=_['intersection'](_0x1a7270[_0x99cc('0x29')],qs[_0x99cc('0x2d')](_0x199fe2[_0x99cc('0x26')][_0x99cc('0x2d')]));_0x7c0fb6['attributes']=_0x7c0fb6[_0x99cc('0x2c')][_0x99cc('0x2e')]?_0x7c0fb6['attributes']:_0x1a7270[_0x99cc('0x29')];if(_0x199fe2['query']['includeAll']){_0x7c0fb6[_0x99cc('0x2f')]=[{'all':!![]}];}_0x7c0fb6=_['merge']({},_0x7c0fb6,_0x199fe2[_0x99cc('0x30')]);return db['OpenchannelInteraction'][_0x99cc('0x31')](_0x7c0fb6)[_0x99cc('0x17')](handleEntityNotFound(_0x58c4ec,null))[_0x99cc('0x17')](respondWithResult(_0x58c4ec,null))[_0x99cc('0x24')](handleError(_0x58c4ec,null));};exports['create']=function(_0x327a3c,_0xfdbd6){return db[_0x99cc('0x1c')]['create'](_0x327a3c['body'],{})[_0x99cc('0x17')](respondWithResult(_0xfdbd6,0xc9))[_0x99cc('0x24')](handleError(_0xfdbd6,null));};exports[_0x99cc('0x16')]=function(_0x32ad4d,_0x184450){if(_0x32ad4d[_0x99cc('0x32')]['id']){delete _0x32ad4d[_0x99cc('0x32')]['id'];}return db[_0x99cc('0x1c')][_0x99cc('0x31')]({'where':{'id':_0x32ad4d[_0x99cc('0x28')]['id']}})['then'](handleEntityNotFound(_0x184450,null))[_0x99cc('0x17')](saveUpdates(_0x32ad4d[_0x99cc('0x32')],null))[_0x99cc('0x17')](respondWithResult(_0x184450,null))[_0x99cc('0x24')](handleError(_0x184450,null));};exports['destroy']=function(_0x32cf12,_0x48852e){return db[_0x99cc('0x1c')][_0x99cc('0x31')]({'where':{'id':_0x32cf12[_0x99cc('0x28')]['id']}})['then'](handleEntityNotFound(_0x48852e,null))[_0x99cc('0x17')](removeEntity(_0x48852e,null))[_0x99cc('0x24')](handleError(_0x48852e,null));};exports['describe']=function(_0x5770bf,_0x5a766e){return db[_0x99cc('0x1c')][_0x99cc('0x33')]()[_0x99cc('0x17')](respondWithResult(_0x5a766e,null))[_0x99cc('0x24')](handleError(_0x5a766e,null));};exports[_0x99cc('0x34')]=function(_0x531fef,_0x536724){return db[_0x99cc('0x35')][_0x99cc('0x31')]({'where':{'id':_0x531fef[_0x99cc('0x28')]['id']}})[_0x99cc('0x17')](handleEntityNotFound(_0x536724,null))[_0x99cc('0x17')](function(_0x1c5aa4){if(_0x1c5aa4){return _0x1c5aa4[_0x99cc('0x34')](_0x531fef['body']['ids'],_[_0x99cc('0x36')](_0x531fef[_0x99cc('0x32')],[_0x99cc('0x37'),'id'])||{});}})[_0x99cc('0x17')](respondWithResult(_0x536724,null))[_0x99cc('0x24')](handleError(_0x536724,null));};exports[_0x99cc('0x38')]=function(_0x280ede,_0x5b371f){var _0x536a81={'raw':![],'where':{}};var _0x899642={};var _0x301846={'count':0x0,'rows':[]};return db[_0x99cc('0x1c')]['findOne']({'where':{'id':_0x280ede['params']['id']}})[_0x99cc('0x17')](handleEntityNotFound(_0x5b371f,null))[_0x99cc('0x17')](function(_0x535a9a){if(_0x535a9a){_0x899642[_0x99cc('0x29')]=_['keys'](db[_0x99cc('0x35')]['rawAttributes']);_0x899642[_0x99cc('0x26')]=_['keys'](_0x280ede[_0x99cc('0x26')]);_0x899642[_0x99cc('0x2b')]=_['intersection'](_0x899642[_0x99cc('0x29')],_0x899642[_0x99cc('0x26')]);_0x536a81[_0x99cc('0x2c')]=_[_0x99cc('0x39')](_0x899642[_0x99cc('0x29')],qs[_0x99cc('0x2d')](_0x280ede[_0x99cc('0x26')][_0x99cc('0x2d')]));_0x536a81['attributes']=_0x536a81[_0x99cc('0x2c')][_0x99cc('0x2e')]?_0x536a81[_0x99cc('0x2c')]:_0x899642[_0x99cc('0x29')];if(!_0x280ede[_0x99cc('0x26')][_0x99cc('0x3a')](_0x99cc('0x3b'))){_0x536a81[_0x99cc('0x13')]=qs[_0x99cc('0x13')](_0x280ede[_0x99cc('0x26')]['limit']);_0x536a81[_0x99cc('0x12')]=qs[_0x99cc('0x12')](_0x280ede[_0x99cc('0x26')][_0x99cc('0x12')]);}_0x536a81[_0x99cc('0x3c')]=qs[_0x99cc('0x3d')](_0x280ede[_0x99cc('0x26')][_0x99cc('0x3d')]);_0x536a81[_0x99cc('0x3e')]=qs['filters'](_[_0x99cc('0x3f')](_0x280ede[_0x99cc('0x26')],_0x899642[_0x99cc('0x2b')]));_0x536a81[_0x99cc('0x3e')][_0x99cc('0x40')]=_0x535a9a['id'];if(_0x280ede[_0x99cc('0x26')]['filter']){_0x536a81[_0x99cc('0x3e')]=_[_0x99cc('0x41')](_0x536a81[_0x99cc('0x3e')],{'$or':_[_0x99cc('0x42')](_0x536a81[_0x99cc('0x2c')],function(_0x115f4c){var _0x4e9c66={};_0x4e9c66[_0x115f4c]={'$like':'%'+_0x280ede['query'][_0x99cc('0x43')]+'%'};return _0x4e9c66;})});}if(_0x280ede[_0x99cc('0x26')]['$gte']){var _0x4c5371=_0x280ede[_0x99cc('0x26')]['$gte'][_0x99cc('0x44')](',');var _0x1d1c15={};_0x1d1c15[_0x4c5371[0x0]]={'$gte':moment(_0x4c5371[0x1])['format'](_0x99cc('0x45'))};_0x536a81['where']=_['merge'](_0x536a81['where'],_0x1d1c15);}_0x536a81=_[_0x99cc('0x41')]({},_0x536a81,_0x280ede['options']);return db['OpenchannelMessage'][_0x99cc('0x14')]({'where':_0x536a81[_0x99cc('0x3e')]})[_0x99cc('0x17')](function(_0x37cdb7){_0x301846[_0x99cc('0x14')]=_0x37cdb7;if(_0x280ede[_0x99cc('0x26')]['includeAll']){_0x536a81[_0x99cc('0x2f')]=[{'all':!![]}];}return db[_0x99cc('0x35')][_0x99cc('0x21')](_0x536a81);})[_0x99cc('0x17')](function(_0x2bd230){_0x301846[_0x99cc('0x46')]=_0x2bd230;return _0x301846;});}})[_0x99cc('0x17')](respondWithFilteredResult(_0x5b371f,_0x536a81))['catch'](handleError(_0x5b371f,null));};exports[_0x99cc('0x47')]=function(_0xb73547,_0x2be54f){return db[_0x99cc('0x1c')][_0x99cc('0x31')]({'where':{'id':_0xb73547[_0x99cc('0x28')]['id']}})[_0x99cc('0x17')](handleEntityNotFound(_0x2be54f,null))['then'](function(_0x578e15){if(_0x578e15){return _0x578e15[_0x99cc('0x48')](_0xb73547[_0x99cc('0x32')][_0x99cc('0x37')],_[_0x99cc('0x36')](_0xb73547[_0x99cc('0x32')],[_0x99cc('0x37'),'id'])||{})[_0x99cc('0x49')](function(){return db['Tag'][_0x99cc('0x21')]({'attributes':['id',_0x99cc('0x1a'),_0x99cc('0x4a')],'where':{'id':_0xb73547[_0x99cc('0x32')][_0x99cc('0x37')]}});})[_0x99cc('0x17')](function(_0xedf4da){socket[_0x99cc('0x4b')](_0x99cc('0x4c'),{'id':Number(_0xb73547[_0x99cc('0x28')]['id']),'tags':_0xedf4da||[]});return{'id':Number(_0xb73547[_0x99cc('0x28')]['id']),'tags':_0xedf4da||[]};});}})[_0x99cc('0x17')](respondWithResult(_0x2be54f,null))[_0x99cc('0x24')](handleError(_0x2be54f,null));};exports[_0x99cc('0x4d')]=function(_0x2c29de,_0x121015){return db[_0x99cc('0x1c')][_0x99cc('0x31')]({'where':{'id':_0x2c29de[_0x99cc('0x28')]['id']}})[_0x99cc('0x17')](handleEntityNotFound(_0x121015,null))[_0x99cc('0x17')](function(_0x1e3ded){if(_0x1e3ded){return _0x1e3ded[_0x99cc('0x4d')](_0x2c29de[_0x99cc('0x26')][_0x99cc('0x37')]);}})['then'](respondWithStatusCode(_0x121015,null))[_0x99cc('0x24')](handleError(_0x121015,null));};exports[_0x99cc('0x4e')]=function(_0x48f4ce,_0x3025c0){var _0x38a5b2=moment()[_0x99cc('0x4f')]()['toString']();var _0x3585df=path[_0x99cc('0x50')](config[_0x99cc('0x51')],'server',_0x99cc('0x52'),'tmp');var _0x15ea1e=path[_0x99cc('0x50')](config[_0x99cc('0x51')],_0x99cc('0x53'),_0x99cc('0x52'),_0x99cc('0x54'));var _0x27bc40=path[_0x99cc('0x50')](_0x3585df,_0x38a5b2);var _0xdf7b4e=util[_0x99cc('0x55')](_0x99cc('0x56'),_0x48f4ce[_0x99cc('0x28')]['id'],_0x38a5b2);var _0x7830d=path[_0x99cc('0x50')](_0x3585df,_0xdf7b4e);var _0x30cf2f=[];_0x30cf2f[_0x99cc('0x57')]({'model':db[_0x99cc('0x58')],'as':'User','attributes':['id',_0x99cc('0x59')],'raw':!![]});_0x30cf2f[_0x99cc('0x57')]({'model':db['CmContact'],'as':_0x99cc('0x5a'),'attributes':['id',_0x99cc('0x5b'),_0x99cc('0x5c')],'raw':!![]});if(_0x48f4ce['query']['attachments']){_0x30cf2f['push']({'model':db['Attachment'],'as':_0x99cc('0x5d'),'raw':!![]});}var _0x17992f=[{'model':db[_0x99cc('0x35')],'as':_0x99cc('0x5e'),'attributes':['id',_0x99cc('0x32'),_0x99cc('0x5f'),_0x99cc('0x60'),_0x99cc('0x61'),_0x99cc('0x62')],'include':_0x30cf2f}];_0x17992f[_0x99cc('0x57')]({'model':db[_0x99cc('0x63')],'as':'Account','attributes':['id',_0x99cc('0x1a')]});_0x17992f['push']({'model':db[_0x99cc('0x58')],'as':_0x99cc('0x64'),'attributes':['id','fullname']});return db[_0x99cc('0x1c')][_0x99cc('0x31')]({'where':{'id':_0x48f4ce[_0x99cc('0x28')]['id']},'include':_0x17992f})[_0x99cc('0x17')](handleEntityNotFound(_0x3025c0,null))[_0x99cc('0x17')](function(_0x9a67){if(_0x9a67){var _0x4a5891=_0x9a67[_0x99cc('0x65')]({'plain':!![]});fs[_0x99cc('0x66')](_0x27bc40);var _0xf26460={'channel':'Openchannel','account':_0x4a5891['Account'][_0x99cc('0x1a')],'agent':_0x4a5891[_0x99cc('0x64')]?_0x4a5891[_0x99cc('0x64')]['fullname']:_0x99cc('0x67'),'createdAt':moment(_0x4a5891['createdAt'])['format'](_0x99cc('0x45'))['toString'](),'closedAt':_0x4a5891[_0x99cc('0x68')]?moment(_0x4a5891[_0x99cc('0x69')])[_0x99cc('0x55')]('YYYY-MM-DD\x20HH:mm:ss')[_0x99cc('0x6a')]():'','disposition':_0x4a5891[_0x99cc('0x6b')],'visibility':_0x4a5891[_0x99cc('0x6c')]?_0x99cc('0x6d'):_0x99cc('0x6e'),'messages':_(_0x4a5891[_0x99cc('0x5e')])[_0x99cc('0x43')]({'secret':![]})[_0x99cc('0x42')](function(_0x36f8e){if(_0x36f8e['Attachment']){var _0x35c5ed=path[_0x99cc('0x50')](_0x15ea1e,_0x36f8e[_0x99cc('0x5d')][_0x99cc('0x6f')]);if(fs[_0x99cc('0x70')](_0x35c5ed)){fs[_0x99cc('0x71')](_0x35c5ed)[_0x99cc('0x72')](fs['createWriteStream'](path[_0x99cc('0x50')](_0x27bc40,_0x36f8e[_0x99cc('0x5d')][_0x99cc('0x6f')])));}}return{'date':moment(_0x36f8e[_0x99cc('0x5f')])[_0x99cc('0x55')]('YYYY-MM-DD\x20HH:mm:ss')[_0x99cc('0x6a')](),'sender':_0x36f8e[_0x99cc('0x60')]===_0x99cc('0x73')?_0x36f8e[_0x99cc('0x58')]?_0x36f8e['User'][_0x99cc('0x59')]:_0x99cc('0x74'):_0x36f8e['Contact'][_0x99cc('0x5b')]+(_0x36f8e[_0x99cc('0x5a')][_0x99cc('0x5c')]?'\x20'+_0x36f8e[_0x99cc('0x5a')]['lastName']:''),'body':_0x36f8e[_0x99cc('0x5d')]?_0x36f8e[_0x99cc('0x5d')]['basename']:_0x36f8e[_0x99cc('0x32')],'direction':_0x36f8e[_0x99cc('0x60')]===_0x99cc('0x73')?'A':'C','secret':_0x36f8e[_0x99cc('0x61')],'read':_0x36f8e[_0x99cc('0x62')],'attachment':_0x36f8e[_0x99cc('0x5d')]};})[_0x99cc('0x75')]()};return ejs['renderFile'](path[_0x99cc('0x50')](config['root'],'server',_0x99cc('0x76'),_0x99cc('0x77')),{'interaction':_0xf26460})[_0x99cc('0x17')](function(_0x4247db){var _0x49ad97=path['join'](_0x27bc40,_0x99cc('0x78')+_0x4a5891['id']+'-'+_0x38a5b2+_0x99cc('0x79'));var _0x5e5945={'path':_0x49ad97,'channel':'Openchannel','interactionId':_0x4a5891['id']};return pdf[_0x99cc('0x7a')](_0x4247db,_0x5e5945);})[_0x99cc('0x17')](function(){return new Promise(function(_0x29a94d,_0x86f653){zipdir(_0x27bc40,{'saveTo':_0x7830d},function(_0x36df9a,_0x5291db){if(_0x36df9a)return _0x86f653(_0x36df9a);return _0x29a94d(_0x5291db);});})[_0x99cc('0x17')](function(){return new Promise(function(_0x2e45f7,_0x3206cf){rimraf(_0x27bc40,function(_0x12816f){if(_0x12816f)_0x3206cf(_0x12816f);return _0x2e45f7();});});})[_0x99cc('0x17')](function(){return _0x3025c0[_0x99cc('0x4e')](_0x7830d,_0xdf7b4e,function(_0x318662){if(_0x318662){logger['error'](_0x99cc('0x7b'),_0x318662);}else{fs[_0x99cc('0x7c')](_0x7830d);}});});});}else{return _0x3025c0['sendStatus'](0xc8);}})[_0x99cc('0x24')](handleError(_0x3025c0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index fcddb93..1317daf 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 _0x3098=['OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction'];(function(_0x1ed4bc,_0x3fabc5){var _0x115458=function(_0x2cb6e7){while(--_0x2cb6e7){_0x1ed4bc['push'](_0x1ed4bc['shift']());}};_0x115458(++_0x3fabc5);}(_0x3098,0xb1));var _0x8309=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x3098[_0x4629ee];return _0x47fb5b;};'use strict';var EventEmitter=require(_0x8309('0x0'));var OpenchannelInteraction=require(_0x8309('0x1'))['db'][_0x8309('0x2')];var OpenchannelMessage=require(_0x8309('0x1'))['db'][_0x8309('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8309('0x4')](0x0);var events={'afterCreate':_0x8309('0x5'),'afterUpdate':_0x8309('0x6'),'afterDestroy':_0x8309('0x7')};function emitEvent(_0x17b6bc){return function(_0x42c37e,_0xe75282,_0xce00a8){_0x42c37e[_0x8309('0x8')]({'attributes':['id'],'raw':!![]})[_0x8309('0x9')](function(_0x376dfd){_0x42c37e[_0x8309('0xa')](_0x8309('0xb'),_0x376dfd[_0x8309('0xc')](function(_0x3eeb91){return{'id':_0x3eeb91['id']};}));return OpenchannelMessage[_0x8309('0xd')]({'where':{'OpenchannelInteractionId':_0x42c37e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8309('0x9')](function(_0x4c296d){_0x42c37e[_0x8309('0xa')](_0x8309('0xe'),_0x4c296d['length']);OpenchannelInteractionEvents[_0x8309('0xf')](_0x17b6bc+':'+_0x42c37e['id'],_0x42c37e);OpenchannelInteractionEvents[_0x8309('0xf')](_0x17b6bc,_0x42c37e);_0xce00a8(null);})[_0x8309('0x10')](_0xce00a8(null));};}for(var e in events){if(events[_0x8309('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x8309('0x12')](e,emitEvent(event));}}module[_0x8309('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xe2ae=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0xe75e5f,_0x51f1fa){var _0x330e15=function(_0x30a9d4){while(--_0x30a9d4){_0xe75e5f['push'](_0xe75e5f['shift']());}};_0x330e15(++_0x51f1fa);}(_0xe2ae,0x1c3));var _0xee2a=function(_0xf84857,_0x5142f2){_0xf84857=_0xf84857-0x0;var _0x3dd517=_0xe2ae[_0xf84857];return _0x3dd517;};'use strict';var EventEmitter=require(_0xee2a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xee2a('0x1')];var OpenchannelMessage=require(_0xee2a('0x2'))['db'][_0xee2a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xee2a('0x4')](0x0);var events={'afterCreate':_0xee2a('0x5'),'afterUpdate':_0xee2a('0x6'),'afterDestroy':_0xee2a('0x7')};function emitEvent(_0x21147a){return function(_0x42debd,_0x439e35,_0x33ac16){_0x42debd[_0xee2a('0x8')]({'attributes':['id'],'raw':!![]})[_0xee2a('0x9')](function(_0x5b6013){_0x42debd[_0xee2a('0xa')](_0xee2a('0xb'),_0x5b6013[_0xee2a('0xc')](function(_0x127ec1){return{'id':_0x127ec1['id']};}));return OpenchannelMessage[_0xee2a('0xd')]({'where':{'OpenchannelInteractionId':_0x42debd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xee2a('0x9')](function(_0xb0994f){_0x42debd[_0xee2a('0xa')]('unreadMessages',_0xb0994f[_0xee2a('0xe')]);OpenchannelInteractionEvents[_0xee2a('0xf')](_0x21147a+':'+_0x42debd['id'],_0x42debd);OpenchannelInteractionEvents[_0xee2a('0xf')](_0x21147a,_0x42debd);_0x33ac16(null);})[_0xee2a('0x10')](_0x33ac16(null));};}for(var e in events){if(events[_0xee2a('0x11')](e)){var event=events[e];OpenchannelInteraction[_0xee2a('0x12')](e,emitEvent(event));}}module[_0xee2a('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 4a29047..9ff1ce1 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 _0x8532=['utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','path','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x783e5c,_0x217c15){var _0x6d9ba1=function(_0x456ddf){while(--_0x456ddf){_0x783e5c['push'](_0x783e5c['shift']());}};_0x6d9ba1(++_0x217c15);}(_0x8532,0xf6));var _0x2853=function(_0x19a63d,_0x30c41e){_0x19a63d=_0x19a63d-0x0;var _0x3c6a25=_0x8532[_0x19a63d];return _0x3c6a25;};'use strict';var _=require(_0x2853('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2853('0x1'));var moment=require(_0x2853('0x2'));var BPromise=require(_0x2853('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2853('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2853('0x5'));module[_0x2853('0x6')]=function(_0x162f3,_0x3a154b){return _0x162f3[_0x2853('0x7')](_0x2853('0x8'),attributes,{'tableName':_0x2853('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2853('0xa'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x24ed31,_0xb43942,_0x4081f4){if(_0x24ed31[_0x2853('0xb')](_0x2853('0xc'))){_0x24ed31[_0x2853('0xd')]=moment()[_0x2853('0xe')](_0x2853('0xf'));}_0x4081f4(null,_0x24ed31);}}});}; \ No newline at end of file +var _0xad71=['utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x470b1e,_0x469d95){var _0x58d7ff=function(_0x4388e2){while(--_0x4388e2){_0x470b1e['push'](_0x470b1e['shift']());}};_0x58d7ff(++_0x469d95);}(_0xad71,0x126));var _0x1ad7=function(_0x135206,_0x1984de){_0x135206=_0x135206-0x0;var _0x49d41d=_0xad71[_0x135206];return _0x49d41d;};'use strict';var _=require(_0x1ad7('0x0'));var util=require('util');var logger=require(_0x1ad7('0x1'))(_0x1ad7('0x2'));var moment=require(_0x1ad7('0x3'));var BPromise=require(_0x1ad7('0x4'));var rp=require(_0x1ad7('0x5'));var fs=require('fs');var path=require(_0x1ad7('0x6'));var rimraf=require('rimraf');var config=require(_0x1ad7('0x7'));var attributes=require(_0x1ad7('0x8'));module[_0x1ad7('0x9')]=function(_0x31b3ce,_0x21a5c4){return _0x31b3ce[_0x1ad7('0xa')](_0x1ad7('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1ad7('0xc'),'collate':_0x1ad7('0xd'),'hooks':{'beforeUpdate':function(_0x4dd32a,_0x189868,_0x527d24){if(_0x4dd32a['changed'](_0x1ad7('0xe'))){_0x4dd32a[_0x1ad7('0xf')]=moment()[_0x1ad7('0x10')](_0x1ad7('0x11'));}_0x527d24(null,_0x4dd32a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1ae7afe..925f187 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 _0xa0d6=['randomstring','ioredis','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird'];(function(_0x5e3b7f,_0x42382f){var _0xe42764=function(_0x534695){while(--_0x534695){_0x5e3b7f['push'](_0x5e3b7f['shift']());}};_0xe42764(++_0x42382f);}(_0xa0d6,0x1d1));var _0x6a0d=function(_0x4afc5f,_0x79a19f){_0x4afc5f=_0x4afc5f-0x0;var _0x539eeb=_0xa0d6[_0x4afc5f];return _0x539eeb;};'use strict';var _=require('lodash');var util=require(_0x6a0d('0x0'));var moment=require(_0x6a0d('0x1'));var BPromise=require(_0x6a0d('0x2'));var rs=require(_0x6a0d('0x3'));var fs=require('fs');var Redis=require(_0x6a0d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6a0d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6a0d('0x6')]({'port':0x232a});config[_0x6a0d('0x7')]=_[_0x6a0d('0x8')](config['redis'],{'host':_0x6a0d('0x9'),'port':0x18eb});var socket=require(_0x6a0d('0xa'))(new Redis(config['redis']));require(_0x6a0d('0xb'))[_0x6a0d('0xc')](socket);function respondWithRpcPromise(_0x9268c9,_0x121599,_0x291de1){return new BPromise(function(_0x432c54,_0x377214){return client[_0x6a0d('0xd')](_0x9268c9,_0x291de1)[_0x6a0d('0xe')](function(_0x5321fd){logger[_0x6a0d('0xf')](_0x6a0d('0x10'),_0x121599,_0x6a0d('0x11'));logger[_0x6a0d('0x12')](_0x6a0d('0x13'),_0x121599,_0x6a0d('0x11'),JSON[_0x6a0d('0x14')](_0x5321fd));if(_0x5321fd[_0x6a0d('0x15')]){if(_0x5321fd[_0x6a0d('0x15')]['code']===0x1f4){logger[_0x6a0d('0x15')](_0x6a0d('0x10'),_0x121599,_0x5321fd[_0x6a0d('0x15')][_0x6a0d('0x16')]);return _0x377214(_0x5321fd[_0x6a0d('0x15')][_0x6a0d('0x16')]);}logger['error'](_0x6a0d('0x10'),_0x121599,_0x5321fd[_0x6a0d('0x15')]['message']);return _0x432c54(_0x5321fd[_0x6a0d('0x15')][_0x6a0d('0x16')]);}else{logger[_0x6a0d('0xf')](_0x6a0d('0x10'),_0x121599,'request\x20sent');_0x432c54(_0x5321fd['result'][_0x6a0d('0x16')]);}})[_0x6a0d('0x17')](function(_0x19a863){logger[_0x6a0d('0x15')](_0x6a0d('0x10'),_0x121599,_0x19a863);_0x377214(_0x19a863);});});}exports[_0x6a0d('0x18')]=function(_0xddd562){var _0x4a7f49=this;return new Promise(function(_0x1d4fae,_0x1e8281){return db[_0x6a0d('0x19')][_0x6a0d('0x1a')](_0xddd562['body'],{'raw':_0xddd562[_0x6a0d('0x1b')]?_0xddd562[_0x6a0d('0x1b')][_0x6a0d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xddd562[_0x6a0d('0x1b')]?_0xddd562[_0x6a0d('0x1b')][_0x6a0d('0x1d')]||null:null,'attributes':_0xddd562[_0x6a0d('0x1b')]?_0xddd562[_0x6a0d('0x1b')][_0x6a0d('0x1e')]||null:null,'limit':_0xddd562[_0x6a0d('0x1b')]?_0xddd562[_0x6a0d('0x1b')][_0x6a0d('0x1f')]||null:null})[_0x6a0d('0xe')](function(_0x17d77a){logger['info'](_0x6a0d('0x18'),_0xddd562);logger[_0x6a0d('0x12')]('UpdateOpenchannelInteraction',_0xddd562,JSON[_0x6a0d('0x14')](_0x17d77a));_0x1d4fae(_0x17d77a);})[_0x6a0d('0x17')](function(_0x15959a){logger['error']('UpdateOpenchannelInteraction',_0x15959a[_0x6a0d('0x16')],_0xddd562);_0x1e8281(_0x4a7f49[_0x6a0d('0x15')](0x1f4,_0x15959a[_0x6a0d('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1991f0){return new Promise(function(_0x5e7d23,_0x2d61e0){return db[_0x6a0d('0x19')][_0x6a0d('0x20')]({'where':_0x1991f0['options']?_0x1991f0[_0x6a0d('0x1b')][_0x6a0d('0x1d')]||null:null})[_0x6a0d('0xe')](function(_0x160dd8){if(_0x160dd8){return _0x160dd8[_0x6a0d('0x21')](_0x1991f0[_0x6a0d('0x22')][_0x6a0d('0x23')],_[_0x6a0d('0x24')](_0x1991f0[_0x6a0d('0x22')],[_0x6a0d('0x23'),'id'])||{});}})[_0x6a0d('0x25')](function(_0x14907c){logger[_0x6a0d('0xf')](_0x6a0d('0x26'),_0x1991f0);logger[_0x6a0d('0x12')](_0x6a0d('0x26'),_0x1991f0,JSON['stringify'](_0x14907c));_0x5e7d23(_0x14907c);})['catch'](function(_0x50af3e){logger[_0x6a0d('0x15')](_0x6a0d('0x26'),_0x50af3e[_0x6a0d('0x16')],_0x1991f0);_0x2d61e0(_this['error'](0x1f4,_0x50af3e[_0x6a0d('0x16')]));});});}; \ No newline at end of file +var _0xb5fc=['redis','defaults','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','AddTagsToOpenchannelInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xccf0fc,_0x9296e1){var _0x130d3a=function(_0x58a211){while(--_0x58a211){_0xccf0fc['push'](_0xccf0fc['shift']());}};_0x130d3a(++_0x9296e1);}(_0xb5fc,0xca));var _0xcb5f=function(_0xbfabce,_0x1c6267){_0xbfabce=_0xbfabce-0x0;var _0x5e4fe3=_0xb5fc[_0xbfabce];return _0x5e4fe3;};'use strict';var _=require(_0xcb5f('0x0'));var util=require(_0xcb5f('0x1'));var moment=require(_0xcb5f('0x2'));var BPromise=require(_0xcb5f('0x3'));var rs=require(_0xcb5f('0x4'));var fs=require('fs');var Redis=require(_0xcb5f('0x5'));var db=require(_0xcb5f('0x6'))['db'];var utils=require(_0xcb5f('0x7'));var logger=require('../../config/logger')(_0xcb5f('0x8'));var config=require(_0xcb5f('0x9'));var jayson=require(_0xcb5f('0xa'));var client=jayson[_0xcb5f('0xb')][_0xcb5f('0xc')]({'port':0x232a});config[_0xcb5f('0xd')]=_[_0xcb5f('0xe')](config[_0xcb5f('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb5f('0xd')]));require(_0xcb5f('0xf'))[_0xcb5f('0x10')](socket);function respondWithRpcPromise(_0x3dc29f,_0x1f2a62,_0x2cfa4c){return new BPromise(function(_0xb64c9,_0x3ad23c){return client[_0xcb5f('0x11')](_0x3dc29f,_0x2cfa4c)[_0xcb5f('0x12')](function(_0x355176){logger[_0xcb5f('0x13')](_0xcb5f('0x14'),_0x1f2a62,_0xcb5f('0x15'));logger[_0xcb5f('0x16')](_0xcb5f('0x17'),_0x1f2a62,_0xcb5f('0x15'),JSON[_0xcb5f('0x18')](_0x355176));if(_0x355176['error']){if(_0x355176[_0xcb5f('0x19')][_0xcb5f('0x1a')]===0x1f4){logger[_0xcb5f('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1f2a62,_0x355176[_0xcb5f('0x19')][_0xcb5f('0x1b')]);return _0x3ad23c(_0x355176[_0xcb5f('0x19')]['message']);}logger[_0xcb5f('0x19')](_0xcb5f('0x14'),_0x1f2a62,_0x355176[_0xcb5f('0x19')][_0xcb5f('0x1b')]);return _0xb64c9(_0x355176[_0xcb5f('0x19')][_0xcb5f('0x1b')]);}else{logger[_0xcb5f('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1f2a62,_0xcb5f('0x15'));_0xb64c9(_0x355176[_0xcb5f('0x1c')][_0xcb5f('0x1b')]);}})[_0xcb5f('0x1d')](function(_0x30023b){logger['error'](_0xcb5f('0x14'),_0x1f2a62,_0x30023b);_0x3ad23c(_0x30023b);});});}exports[_0xcb5f('0x1e')]=function(_0x406c7b){var _0x15a193=this;return new Promise(function(_0x37a289,_0x41a23c){return db[_0xcb5f('0x1f')][_0xcb5f('0x20')](_0x406c7b[_0xcb5f('0x21')],{'raw':_0x406c7b[_0xcb5f('0x22')]?_0x406c7b[_0xcb5f('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x406c7b[_0xcb5f('0x22')]?_0x406c7b[_0xcb5f('0x22')][_0xcb5f('0x23')]||null:null,'attributes':_0x406c7b[_0xcb5f('0x22')]?_0x406c7b[_0xcb5f('0x22')][_0xcb5f('0x24')]||null:null,'limit':_0x406c7b['options']?_0x406c7b[_0xcb5f('0x22')][_0xcb5f('0x25')]||null:null})[_0xcb5f('0x12')](function(_0x9c26b4){logger[_0xcb5f('0x13')](_0xcb5f('0x1e'),_0x406c7b);logger[_0xcb5f('0x16')](_0xcb5f('0x1e'),_0x406c7b,JSON[_0xcb5f('0x18')](_0x9c26b4));_0x37a289(_0x9c26b4);})[_0xcb5f('0x1d')](function(_0x4c7cd1){logger['error'](_0xcb5f('0x1e'),_0x4c7cd1[_0xcb5f('0x1b')],_0x406c7b);_0x41a23c(_0x15a193[_0xcb5f('0x19')](0x1f4,_0x4c7cd1[_0xcb5f('0x1b')]));});});};exports[_0xcb5f('0x26')]=function(_0x183991){return new Promise(function(_0x3f44ed,_0x1f302d){return db[_0xcb5f('0x1f')]['find']({'where':_0x183991[_0xcb5f('0x22')]?_0x183991['options'][_0xcb5f('0x23')]||null:null})[_0xcb5f('0x12')](function(_0x8c75ee){if(_0x8c75ee){return _0x8c75ee[_0xcb5f('0x27')](_0x183991[_0xcb5f('0x21')][_0xcb5f('0x28')],_['omit'](_0x183991['body'],[_0xcb5f('0x28'),'id'])||{});}})[_0xcb5f('0x29')](function(_0x10813c){logger[_0xcb5f('0x13')]('AddTags',_0x183991);logger['debug'](_0xcb5f('0x2a'),_0x183991,JSON[_0xcb5f('0x18')](_0x10813c));_0x3f44ed(_0x10813c);})[_0xcb5f('0x1d')](function(_0x34e62c){logger[_0xcb5f('0x19')]('AddTags',_0x34e62c[_0xcb5f('0x1b')],_0x183991);_0x1f302d(_this['error'](0x1f4,_0x34e62c[_0xcb5f('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 8a909b1..859a270 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 _0x6446=['length','remove','update','emit'];(function(_0x4c9fb9,_0xd7a385){var _0x36b14c=function(_0x35d0d5){while(--_0x35d0d5){_0x4c9fb9['push'](_0x4c9fb9['shift']());}};_0x36b14c(++_0xd7a385);}(_0x6446,0x149));var _0x6644=function(_0x392e1d,_0x125aed){_0x392e1d=_0x392e1d-0x0;var _0x486d9b=_0x6446[_0x392e1d];return _0x486d9b;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x6644('0x0'),_0x6644('0x1')];function createListener(_0x32400c,_0x3dca3d){return function(_0x1a0c0d){_0x3dca3d[_0x6644('0x2')](_0x32400c,_0x1a0c0d);};}function removeListener(_0x425516,_0x33a15c){return function(){OpenchannelInteractionEvents['removeListener'](_0x425516,_0x33a15c);};}exports['register']=function(_0x4f831a){for(var _0x3fe9c0=0x0,_0x2c16d3=events[_0x6644('0x3')];_0x3fe9c0<_0x2c16d3;_0x3fe9c0++){var _0x4f594e=events[_0x3fe9c0];var _0x4ca14b=createListener('openchannelInteraction:'+_0x4f594e,_0x4f831a);OpenchannelInteractionEvents['on'](_0x4f594e,_0x4ca14b);}}; \ No newline at end of file +var _0xef2f=['emit','removeListener','register','length','./openchannelInteraction.events','save','remove'];(function(_0x41f0fb,_0x155b08){var _0x494a7f=function(_0x491c0d){while(--_0x491c0d){_0x41f0fb['push'](_0x41f0fb['shift']());}};_0x494a7f(++_0x155b08);}(_0xef2f,0x89));var _0xfef2=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xef2f[_0x4d07cc];return _0x42de3b;};'use strict';var OpenchannelInteractionEvents=require(_0xfef2('0x0'));var events=[_0xfef2('0x1'),_0xfef2('0x2'),'update'];function createListener(_0x5768bc,_0x3a76c7){return function(_0x18d025){_0x3a76c7[_0xfef2('0x3')](_0x5768bc,_0x18d025);};}function removeListener(_0x477749,_0x50e904){return function(){OpenchannelInteractionEvents[_0xfef2('0x4')](_0x477749,_0x50e904);};}exports[_0xfef2('0x5')]=function(_0x5e6c0c){for(var _0x5a32d5=0x0,_0x38be0b=events[_0xfef2('0x6')];_0x5a32d5<_0x38be0b;_0x5a32d5++){var _0x34312d=events[_0x5a32d5];var _0x46c964=createListener('openchannelInteraction:'+_0x34312d,_0x5e6c0c);OpenchannelInteractionEvents['on'](_0x34312d,_0x46c964);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9b970a4..b60c4e3 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x3e1266,_0xc50d38){var _0x29e7a8=function(_0x562da2){while(--_0x562da2){_0x3e1266['push'](_0x3e1266['shift']());}};_0x29e7a8(++_0xc50d38);}(_0xe706,0xa3));var _0x6e70=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0xe706[_0x5da0d9];return _0x4b6d2f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _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(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x1aaff9,_0x3003a0){_0x1aaff9=_0x1aaff9-0x0;var _0x5e6f02=_0x70e0[_0x1aaff9];return _0x5e6f02;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index e746836..586e9b1 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 _0x7df3=['out','DATE','STRING','TEXT','sequelize','exports','medium','BOOLEAN'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x7df3,0x1cc));var _0x37df=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7df3[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'body':{'type':Sequelize['TEXT'](_0x37df('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x37df('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x37df('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x37df('0x5')]},'providerName':{'type':Sequelize[_0x37df('0x6')]},'providerResponse':{'type':Sequelize[_0x37df('0x7')]}}; \ No newline at end of file +var _0x02a7=['medium','BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x02a7,0x1a6));var _0x702a=function(_0x3b1697,_0x38dc6d){_0x3b1697=_0x3b1697-0x0;var _0x25ebd5=_0x02a7[_0x3b1697];return _0x25ebd5;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'body':{'type':Sequelize[_0x702a('0x1')](_0x702a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x702a('0x4')]('in',_0x702a('0x5')),'defaultValue':_0x702a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x702a('0x6')]},'providerName':{'type':Sequelize[_0x702a('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c264173..ae39a81 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 _0x4dbc=['result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','create','body','params','describe','../../config/logger','openchannel-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','motionChannel','event','EventManager','acceptmessage','RejectMessage','ContactId','SIP/%s','channel','rejectmessage','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x53bcfa,_0x20eb6e){var _0x25e64e=function(_0x1d9515){while(--_0x1d9515){_0x53bcfa['push'](_0x53bcfa['shift']());}};_0x25e64e(++_0x20eb6e);}(_0x4dbc,0x1df));var _0xc4db=function(_0x12f422,_0x41b8bc){_0x12f422=_0x12f422-0x0;var _0x5f5de3=_0x4dbc[_0x12f422];return _0x5f5de3;};'use strict';var emlformat=require(_0xc4db('0x0'));var rimraf=require(_0xc4db('0x1'));var zipdir=require(_0xc4db('0x2'));var jsonpatch=require(_0xc4db('0x3'));var rp=require(_0xc4db('0x4'));var moment=require(_0xc4db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4db('0x6'));var util=require(_0xc4db('0x7'));var path=require('path');var sox=require(_0xc4db('0x8'));var csv=require(_0xc4db('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4db('0xa'));var squel=require(_0xc4db('0xb'));var crypto=require(_0xc4db('0xc'));var jsforce=require(_0xc4db('0xd'));var deskjs=require(_0xc4db('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc4db('0xf'));var Papa=require(_0xc4db('0x10'));var Redis=require(_0xc4db('0x11'));var authService=require(_0xc4db('0x12'));var qs=require(_0xc4db('0x13'));var as=require(_0xc4db('0x14'));var hardwareService=require(_0xc4db('0x15'));var logger=require('../../config/logger')(_0xc4db('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc4db('0x17'))['db'];config[_0xc4db('0x18')]=_[_0xc4db('0x19')](config[_0xc4db('0x18')],{'host':_0xc4db('0x1a'),'port':0x18eb});var socket=require(_0xc4db('0x1b'))(new Redis(config['redis']));require(_0xc4db('0x1c'))[_0xc4db('0x1d')](socket);var jayson=require(_0xc4db('0x1e'));var client=jayson[_0xc4db('0x1f')][_0xc4db('0x20')]({'port':0x232c});var client9002=jayson[_0xc4db('0x1f')][_0xc4db('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x402b8f,_0x2c2b00,_0x100b83,_0x30c603){return new BPromise(function(_0x2d318c,_0x16b34e){var _0x6f2c4e=_0x30c603||client;return _0x6f2c4e[_0xc4db('0x21')](_0x402b8f,_0x100b83)[_0xc4db('0x22')](function(_0x13a73b){logger[_0xc4db('0x23')](_0xc4db('0x24'),_0x2c2b00,_0xc4db('0x25'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2c2b00,_0xc4db('0x25'),JSON['stringify'](_0x13a73b));if(_0x13a73b['error']){if(_0x13a73b[_0xc4db('0x26')][_0xc4db('0x27')]===0x1f4){logger[_0xc4db('0x26')](_0xc4db('0x24'),_0x2c2b00,_0x13a73b[_0xc4db('0x26')][_0xc4db('0x28')]);return _0x16b34e(_0x13a73b['error'][_0xc4db('0x28')]);}logger[_0xc4db('0x26')](_0xc4db('0x24'),_0x2c2b00,_0x13a73b['error'][_0xc4db('0x28')]);return _0x2d318c(_0x13a73b[_0xc4db('0x26')][_0xc4db('0x28')]);}else{logger[_0xc4db('0x23')](_0xc4db('0x24'),_0x2c2b00,_0xc4db('0x25'));_0x2d318c(_0x13a73b[_0xc4db('0x29')]['message']);}})[_0xc4db('0x2a')](function(_0x1aab94){logger[_0xc4db('0x26')](_0xc4db('0x24'),_0x2c2b00,_0x1aab94);_0x16b34e(_0x1aab94);});});}function respondWithStatusCode(_0x287453,_0x14f235){_0x14f235=_0x14f235||0xcc;return function(_0xc34471){if(_0xc34471){return _0x287453[_0xc4db('0x2b')](_0x14f235);}return _0x287453[_0xc4db('0x2c')](_0x14f235)[_0xc4db('0x2d')]();};}function respondWithResult(_0x4e334e,_0x5686bd){_0x5686bd=_0x5686bd||0xc8;return function(_0x56ab40){if(_0x56ab40){return _0x4e334e[_0xc4db('0x2c')](_0x5686bd)[_0xc4db('0x2e')](_0x56ab40);}};}function respondWithFilteredResult(_0x2adcb1,_0x3129c8){return function(_0x571c7c){if(_0x571c7c){var _0x5a7bd0=typeof _0x3129c8[_0xc4db('0x2f')]===_0xc4db('0x30')&&typeof _0x3129c8[_0xc4db('0x31')]===_0xc4db('0x30');var _0x36d18a=_0x571c7c[_0xc4db('0x32')];var _0x59c9d7=_0x5a7bd0?0x0:_0x3129c8[_0xc4db('0x2f')];var _0x5c0501=_0x5a7bd0?_0x571c7c[_0xc4db('0x32')]:_0x3129c8[_0xc4db('0x2f')]+_0x3129c8['limit'];var _0x5d415c;if(_0x5c0501>=_0x36d18a){_0x5c0501=_0x36d18a;_0x5d415c=0xc8;}else{_0x5d415c=0xce;}_0x2adcb1['status'](_0x5d415c);return _0x2adcb1[_0xc4db('0x33')]('Content-Range',_0x59c9d7+'-'+_0x5c0501+'/'+_0x36d18a)[_0xc4db('0x2e')](_0x571c7c);}return null;};}function patchUpdates(_0x4e05fb){return function(_0x20ffd1){try{jsonpatch[_0xc4db('0x34')](_0x20ffd1,_0x4e05fb,!![]);}catch(_0x291da6){return BPromise[_0xc4db('0x35')](_0x291da6);}return _0x20ffd1[_0xc4db('0x36')]();};}function saveUpdates(_0x5852a4,_0x2bc6b6){return function(_0x567817){if(_0x567817){return _0x567817[_0xc4db('0x37')](_0x5852a4)[_0xc4db('0x22')](function(_0x526141){return _0x526141;});}return null;};}function removeEntity(_0x11e682,_0x179056){return function(_0x5e333e){if(_0x5e333e){return _0x5e333e[_0xc4db('0x38')]()[_0xc4db('0x22')](function(){_0x11e682[_0xc4db('0x2c')](0xcc)[_0xc4db('0x2d')]();});}};}function handleEntityNotFound(_0x460e0e,_0x26dfbd){return function(_0xe7f98e){if(!_0xe7f98e){_0x460e0e[_0xc4db('0x2b')](0x194);}return _0xe7f98e;};}function handleError(_0x404b09,_0x10abc6){_0x10abc6=_0x10abc6||0x1f4;return function(_0x3cf3bb){logger[_0xc4db('0x26')](_0x3cf3bb[_0xc4db('0x39')]);if(_0x3cf3bb[_0xc4db('0x3a')]){delete _0x3cf3bb[_0xc4db('0x3a')];}_0x404b09[_0xc4db('0x2c')](_0x10abc6)[_0xc4db('0x3b')](_0x3cf3bb);};}exports[_0xc4db('0x3c')]=function(_0x3580ab,_0x45a04b){var _0x35f822={},_0x15e3cd={},_0x599702={'count':0x0,'rows':[]};var _0x1d6a53=_[_0xc4db('0x3d')](db[_0xc4db('0x3e')][_0xc4db('0x3f')],function(_0x4a587b){return{'name':_0x4a587b[_0xc4db('0x40')],'type':_0x4a587b[_0xc4db('0x41')]['key']};});_0x15e3cd['model']=_['map'](_0x1d6a53,'name');_0x15e3cd[_0xc4db('0x42')]=_[_0xc4db('0x43')](_0x3580ab[_0xc4db('0x42')]);_0x15e3cd['filters']=_[_0xc4db('0x44')](_0x15e3cd[_0xc4db('0x45')],_0x15e3cd[_0xc4db('0x42')]);_0x35f822['attributes']=_[_0xc4db('0x44')](_0x15e3cd[_0xc4db('0x45')],qs[_0xc4db('0x46')](_0x3580ab['query']['fields']));_0x35f822[_0xc4db('0x47')]=_0x35f822[_0xc4db('0x47')]['length']?_0x35f822[_0xc4db('0x47')]:_0x15e3cd[_0xc4db('0x45')];if(!_0x3580ab[_0xc4db('0x42')][_0xc4db('0x48')]('nolimit')){_0x35f822[_0xc4db('0x31')]=qs[_0xc4db('0x31')](_0x3580ab[_0xc4db('0x42')][_0xc4db('0x31')]);_0x35f822[_0xc4db('0x2f')]=qs[_0xc4db('0x2f')](_0x3580ab[_0xc4db('0x42')][_0xc4db('0x2f')]);}_0x35f822['order']=qs['sort'](_0x3580ab['query']['sort']);_0x35f822[_0xc4db('0x49')]=qs[_0xc4db('0x4a')](_[_0xc4db('0x4b')](_0x3580ab['query'],_0x15e3cd[_0xc4db('0x4a')]),_0x1d6a53);if(_0x3580ab[_0xc4db('0x42')][_0xc4db('0x4c')]){_0x35f822[_0xc4db('0x49')]=_['merge'](_0x35f822[_0xc4db('0x49')],{'$or':_[_0xc4db('0x3d')](_0x1d6a53,function(_0x4bc620){if(_0x4bc620[_0xc4db('0x41')]!==_0xc4db('0x4d')){var _0x7ef9b3={};_0x7ef9b3[_0x4bc620[_0xc4db('0x3a')]]={'$like':'%'+_0x3580ab[_0xc4db('0x42')][_0xc4db('0x4c')]+'%'};return _0x7ef9b3;}})});}_0x35f822=_[_0xc4db('0x4e')]({},_0x35f822,_0x3580ab[_0xc4db('0x4f')]);var _0x38ed7f={'where':_0x35f822[_0xc4db('0x49')]};return db[_0xc4db('0x3e')][_0xc4db('0x32')](_0x38ed7f)[_0xc4db('0x22')](function(_0x78365d){_0x599702[_0xc4db('0x32')]=_0x78365d;if(_0x3580ab[_0xc4db('0x42')][_0xc4db('0x50')]){_0x35f822[_0xc4db('0x51')]=[{'all':!![]}];}return db[_0xc4db('0x3e')][_0xc4db('0x52')](_0x35f822);})[_0xc4db('0x22')](function(_0x37e270){_0x599702[_0xc4db('0x53')]=_0x37e270;return _0x599702;})[_0xc4db('0x22')](respondWithFilteredResult(_0x45a04b,_0x35f822))['catch'](handleError(_0x45a04b,null));};exports['show']=function(_0x5c2148,_0x34cd3d){var _0x251590={'raw':!![],'where':{'id':_0x5c2148['params']['id']}},_0x31467d={};_0x31467d[_0xc4db('0x45')]=_[_0xc4db('0x43')](db['OpenchannelMessage'][_0xc4db('0x3f')]);_0x31467d[_0xc4db('0x42')]=_[_0xc4db('0x43')](_0x5c2148[_0xc4db('0x42')]);_0x31467d[_0xc4db('0x4a')]=_[_0xc4db('0x44')](_0x31467d[_0xc4db('0x45')],_0x31467d['query']);_0x251590[_0xc4db('0x47')]=_['intersection'](_0x31467d['model'],qs['fields'](_0x5c2148[_0xc4db('0x42')][_0xc4db('0x46')]));_0x251590['attributes']=_0x251590[_0xc4db('0x47')]['length']?_0x251590[_0xc4db('0x47')]:_0x31467d[_0xc4db('0x45')];if(_0x5c2148[_0xc4db('0x42')][_0xc4db('0x50')]){_0x251590[_0xc4db('0x51')]=[{'all':!![]}];}_0x251590=_['merge']({},_0x251590,_0x5c2148['options']);return db[_0xc4db('0x3e')][_0xc4db('0x54')](_0x251590)[_0xc4db('0x22')](handleEntityNotFound(_0x34cd3d,null))[_0xc4db('0x22')](respondWithResult(_0x34cd3d,null))[_0xc4db('0x2a')](handleError(_0x34cd3d,null));};exports['create']=function(_0xa4b543,_0x4b492b){return db[_0xc4db('0x3e')][_0xc4db('0x55')](_0xa4b543[_0xc4db('0x56')],{})[_0xc4db('0x22')](respondWithResult(_0x4b492b,0xc9))['catch'](handleError(_0x4b492b,null));};exports[_0xc4db('0x37')]=function(_0x1f342f,_0x5d665b){if(_0x1f342f[_0xc4db('0x56')]['id']){delete _0x1f342f[_0xc4db('0x56')]['id'];}return db[_0xc4db('0x3e')][_0xc4db('0x54')]({'where':{'id':_0x1f342f[_0xc4db('0x57')]['id']}})[_0xc4db('0x22')](handleEntityNotFound(_0x5d665b,null))[_0xc4db('0x22')](saveUpdates(_0x1f342f['body'],null))[_0xc4db('0x22')](respondWithResult(_0x5d665b,null))[_0xc4db('0x2a')](handleError(_0x5d665b,null));};exports[_0xc4db('0x38')]=function(_0x7e369b,_0xcb392){return db[_0xc4db('0x3e')][_0xc4db('0x54')]({'where':{'id':_0x7e369b[_0xc4db('0x57')]['id']}})[_0xc4db('0x22')](handleEntityNotFound(_0xcb392,null))['then'](removeEntity(_0xcb392,null))[_0xc4db('0x2a')](handleError(_0xcb392,null));};exports[_0xc4db('0x58')]=function(_0x54c2cd,_0x353753){return db[_0xc4db('0x3e')][_0xc4db('0x58')]()[_0xc4db('0x22')](respondWithResult(_0x353753,null))[_0xc4db('0x2a')](handleError(_0x353753,null));};var interaction_log=require(_0xc4db('0x59'))(_0xc4db('0x5a'));exports['accept']=function(_0x402ce2,_0x16852d,_0x4ffbf8){var _0x1c72e6={'agent':{},'channel':'openchannel'};if(_0x402ce2[_0xc4db('0x56')]['id']){delete _0x402ce2[_0xc4db('0x56')]['id'];}_0x402ce2['body'][_0xc4db('0x5b')]=!![];_0x402ce2[_0xc4db('0x56')][_0xc4db('0x5c')]=moment()[_0xc4db('0x5d')](_0xc4db('0x5e'));_0x402ce2['body'][_0xc4db('0x5f')]=_0x402ce2[_0xc4db('0x56')][_0xc4db('0x5f')]||_0x402ce2[_0xc4db('0x60')]['id'];_0x1c72e6[_0xc4db('0x61')]['id']=_0x402ce2['body'][_0xc4db('0x5f')];return db[_0xc4db('0x3e')]['find']({'where':{'id':_0x402ce2['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x16852d,null))['then'](saveUpdates(_0x402ce2[_0xc4db('0x56')],null))[_0xc4db('0x22')](function(_0xdbf476){if(_0xdbf476){_0x1c72e6[_0xc4db('0x28')]=_0xdbf476[_0xc4db('0x62')]({'plain':!![]});return db[_0xc4db('0x63')][_0xc4db('0x54')]({'where':{'id':_0xdbf476[_0xc4db('0x64')]}});}return null;})[_0xc4db('0x22')](handleEntityNotFound(_0x16852d,null))[_0xc4db('0x22')](function(_0x37f3e9){if(_0x37f3e9){return _0x37f3e9['update']({'UserId':_0x402ce2[_0xc4db('0x56')]['UserId'],'read1stAt':_[_0xc4db('0x65')](_0x37f3e9[_0xc4db('0x66')])?moment()[_0xc4db('0x5d')](_0xc4db('0x5e')):undefined});}return null;})[_0xc4db('0x22')](function(_0x54eb30){if(_0x54eb30){_0x1c72e6[_0xc4db('0x67')]=_0x54eb30['get']({'plain':!![]});interaction_log['info'](_0xc4db('0x68'),_0x402ce2[_0xc4db('0x60')]['id'],_0x402ce2['user'][_0xc4db('0x3a')],_0x402ce2[_0xc4db('0x60')]['role'],_0x1c72e6['interaction']['id'],_0x402ce2[_0xc4db('0x56')]?JSON[_0xc4db('0x69')](_0x402ce2[_0xc4db('0x56')]):_0xc4db('0x6a'));return respondWithRpcPromise(_0xc4db('0x6b'),_0xc4db('0x6c'),_0x1c72e6);}return null;})[_0xc4db('0x22')](function(_0x3fdb0d){var _0x5e2b9c=_0xc4db('0x6d')+_0x3fdb0d[_0xc4db('0x28')]['ContactId'];return db[_0xc4db('0x6e')][_0xc4db('0x42')](_0x5e2b9c,{'type':db[_0xc4db('0x6f')][_0xc4db('0x70')][_0xc4db('0x71')],'raw':!![]})['then'](function(_0xd3ef48){return _0xd3ef48;});})[_0xc4db('0x22')](function(_0x2201fd){if(_0x2201fd){_0x1c72e6[_0xc4db('0x28')][_0xc4db('0x72')]=_0x2201fd[0x0];if(!_0x402ce2['body'][_0xc4db('0x5f')])return;return db[_0xc4db('0x73')][_0xc4db('0x54')]({'where':{'id':_0x402ce2[_0xc4db('0x56')][_0xc4db('0x5f')],'role':'agent'},'attributes':['id',_0xc4db('0x3a'),_0xc4db('0x74'),_0xc4db('0x75'),_0xc4db('0x76')],'raw':!![]});}return null;})[_0xc4db('0x22')](function(_0x18af2f){if(!_0x18af2f)return null;_0x1c72e6[_0xc4db('0x28')][_0xc4db('0x61')]=_0x18af2f;return _0x1c72e6;})[_0xc4db('0x22')](function(_0x123fc5){if(_0x123fc5){if(_0x402ce2[_0xc4db('0x56')][_0xc4db('0x77')]){_0x1c72e6['message'][_0xc4db('0x78')]=util[_0xc4db('0x5d')]('SIP/%s',_0x402ce2[_0xc4db('0x60')]['name']);_0x1c72e6[_0xc4db('0x28')]['channel']=_0x1c72e6['channel'];_0x1c72e6[_0xc4db('0x28')][_0xc4db('0x79')]=_0x1c72e6['channel'];_0x1c72e6['message'][_0xc4db('0x7a')]='accept';return respondWithRpcPromise(_0xc4db('0x7b'),_0xc4db('0x7b'),{'event':_0xc4db('0x7c'),'message':_0x1c72e6[_0xc4db('0x28')]},client9002)[_0xc4db('0x22')](function(){return _0x1c72e6;});}return _0x1c72e6;}return null;})[_0xc4db('0x22')](respondWithResult(_0x16852d,null))[_0xc4db('0x2a')](handleError(_0x16852d,null));};var interaction_log=require(_0xc4db('0x59'))(_0xc4db('0x5a'));exports[_0xc4db('0x35')]=function(_0x495ac2,_0x32bf33,_0x48ac6c){var _0x5b1d55={'agent':{},'channel':'openchannel'};if(_0x495ac2[_0xc4db('0x56')]['id']){delete _0x495ac2['body']['id'];}_0x495ac2[_0xc4db('0x56')]['UserId']=_0x495ac2['body'][_0xc4db('0x5f')]||_0x495ac2[_0xc4db('0x60')]['id'];_0x5b1d55[_0xc4db('0x61')]['id']=_0x495ac2['body'][_0xc4db('0x5f')];return db[_0xc4db('0x3e')][_0xc4db('0x54')]({'where':{'id':_0x495ac2['params']['id'],'UserId':null}})[_0xc4db('0x22')](handleEntityNotFound(_0x32bf33,null))['then'](function(_0x52028f){if(_0x52028f){_0x5b1d55[_0xc4db('0x28')]=_0x52028f[_0xc4db('0x62')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x52028f[_0xc4db('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x32bf33,null))[_0xc4db('0x22')](function(_0x27214d){if(_0x27214d){_0x5b1d55['interaction']=_0x27214d[_0xc4db('0x62')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x495ac2[_0xc4db('0x60')]['id'],_0x495ac2[_0xc4db('0x60')][_0xc4db('0x3a')],_0x495ac2[_0xc4db('0x60')]['role'],_0x5b1d55[_0xc4db('0x67')]['id'],_0x495ac2[_0xc4db('0x56')]?JSON[_0xc4db('0x69')](_0x495ac2[_0xc4db('0x56')]):'null');return respondWithRpcPromise(_0xc4db('0x7d'),'rejectMessage',_0x5b1d55);}return null;})['then'](function(_0x3d26a5){var _0x174547='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3d26a5['message'][_0xc4db('0x7e')];return db[_0xc4db('0x6e')][_0xc4db('0x42')](_0x174547,{'type':db[_0xc4db('0x6f')][_0xc4db('0x70')][_0xc4db('0x71')],'raw':!![]})[_0xc4db('0x22')](function(_0xed4120){return _0xed4120;});})[_0xc4db('0x22')](function(_0x175db0){if(_0x175db0){_0x5b1d55[_0xc4db('0x28')][_0xc4db('0x72')]=_0x175db0[0x0];if(!_0x495ac2[_0xc4db('0x56')][_0xc4db('0x5f')])return;return db['User'][_0xc4db('0x54')]({'where':{'id':_0x495ac2[_0xc4db('0x56')][_0xc4db('0x5f')],'role':_0xc4db('0x61')},'attributes':['id','name',_0xc4db('0x74'),_0xc4db('0x75'),_0xc4db('0x76')],'raw':!![]});}return null;})[_0xc4db('0x22')](function(_0x10ac7a){if(!_0x10ac7a)return null;_0x5b1d55['message']['agent']=_0x10ac7a;return _0x5b1d55;})[_0xc4db('0x22')](function(_0x40cacf){if(_0x40cacf){_0x40cacf[_0xc4db('0x28')][_0xc4db('0x78')]=util[_0xc4db('0x5d')](_0xc4db('0x7f'),_0x495ac2[_0xc4db('0x60')][_0xc4db('0x3a')]);_0x40cacf[_0xc4db('0x28')][_0xc4db('0x80')]=_0x5b1d55['channel'];_0x40cacf['message'][_0xc4db('0x79')]=_0x5b1d55['channel'];_0x40cacf[_0xc4db('0x28')][_0xc4db('0x7a')]=_0xc4db('0x35');respondWithRpcPromise(_0xc4db('0x7b'),_0xc4db('0x7b'),{'event':_0xc4db('0x81'),'message':_0x40cacf[_0xc4db('0x28')]},client9002);return _0x5b1d55;}return null;})['then'](respondWithResult(_0x32bf33,null))[_0xc4db('0x2a')](handleError(_0x32bf33,null));}; \ No newline at end of file +var _0xb69e=['count','includeAll','include','rows','params','keys','options','find','create','update','body','destroy','describe','../../config/logger','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','OpenchannelInteractionId','isNil','read1stAt','interaction','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','fullname','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','reject','OpenchannelInteraction','RejectMessage','rejectMessage','contact','User','email','motionChannel','rejectmessage','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','undefined','limit','offset','set','json','apply','save','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','OpenchannelMessage'];(function(_0x2c1b1c,_0x5e9c8e){var _0x1520fb=function(_0x313269){while(--_0x313269){_0x2c1b1c['push'](_0x2c1b1c['shift']());}};_0x1520fb(++_0x5e9c8e);}(_0xb69e,0xb3));var _0xeb69=function(_0x442f17,_0xfc1692){_0x442f17=_0x442f17-0x0;var _0x3d0a3b=_0xb69e[_0x442f17];return _0x3d0a3b;};'use strict';var emlformat=require(_0xeb69('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeb69('0x1'));var rp=require('request-promise');var moment=require(_0xeb69('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xeb69('0x3'));var util=require(_0xeb69('0x4'));var path=require(_0xeb69('0x5'));var sox=require(_0xeb69('0x6'));var csv=require(_0xeb69('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb69('0x8'));var squel=require(_0xeb69('0x9'));var crypto=require(_0xeb69('0xa'));var jsforce=require(_0xeb69('0xb'));var deskjs=require(_0xeb69('0xc'));var toCsv=require(_0xeb69('0x7'));var querystring=require(_0xeb69('0xd'));var Papa=require(_0xeb69('0xe'));var Redis=require(_0xeb69('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xeb69('0x10'));var as=require(_0xeb69('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xeb69('0x12'));var config=require(_0xeb69('0x13'));var licenseUtil=require(_0xeb69('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xeb69('0x15')],{'host':_0xeb69('0x16'),'port':0x18eb});var socket=require(_0xeb69('0x17'))(new Redis(config[_0xeb69('0x15')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0xeb69('0x18'));var client=jayson['client'][_0xeb69('0x19')]({'port':0x232c});var client9002=jayson[_0xeb69('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x97a48a,_0x13c883,_0x413726,_0x139ac6){return new BPromise(function(_0x39be28,_0x2a0de9){var _0x123db5=_0x139ac6||client;return _0x123db5[_0xeb69('0x1b')](_0x97a48a,_0x413726)[_0xeb69('0x1c')](function(_0x1f2f91){logger[_0xeb69('0x1d')](_0xeb69('0x1e'),_0x13c883,_0xeb69('0x1f'));logger[_0xeb69('0x20')](_0xeb69('0x21'),_0x13c883,'request\x20sent',JSON[_0xeb69('0x22')](_0x1f2f91));if(_0x1f2f91['error']){if(_0x1f2f91[_0xeb69('0x23')][_0xeb69('0x24')]===0x1f4){logger[_0xeb69('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x13c883,_0x1f2f91[_0xeb69('0x23')]['message']);return _0x2a0de9(_0x1f2f91[_0xeb69('0x23')][_0xeb69('0x25')]);}logger[_0xeb69('0x23')](_0xeb69('0x1e'),_0x13c883,_0x1f2f91[_0xeb69('0x23')][_0xeb69('0x25')]);return _0x39be28(_0x1f2f91[_0xeb69('0x23')][_0xeb69('0x25')]);}else{logger[_0xeb69('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x13c883,_0xeb69('0x1f'));_0x39be28(_0x1f2f91['result'][_0xeb69('0x25')]);}})[_0xeb69('0x26')](function(_0x1a9095){logger[_0xeb69('0x23')](_0xeb69('0x1e'),_0x13c883,_0x1a9095);_0x2a0de9(_0x1a9095);});});}function respondWithStatusCode(_0x249655,_0x59040c){_0x59040c=_0x59040c||0xcc;return function(_0x46f9e2){if(_0x46f9e2){return _0x249655[_0xeb69('0x27')](_0x59040c);}return _0x249655[_0xeb69('0x28')](_0x59040c)[_0xeb69('0x29')]();};}function respondWithResult(_0x4096e6,_0x2042d8){_0x2042d8=_0x2042d8||0xc8;return function(_0x13adf4){if(_0x13adf4){return _0x4096e6[_0xeb69('0x28')](_0x2042d8)['json'](_0x13adf4);}};}function respondWithFilteredResult(_0x2fc8b8,_0x4d4bb8){return function(_0x27ba6b){if(_0x27ba6b){var _0x39710f=typeof _0x4d4bb8['offset']===_0xeb69('0x2a')&&typeof _0x4d4bb8[_0xeb69('0x2b')]===_0xeb69('0x2a');var _0x3fc0f6=_0x27ba6b['count'];var _0x5bdcee=_0x39710f?0x0:_0x4d4bb8['offset'];var _0x46045b=_0x39710f?_0x27ba6b['count']:_0x4d4bb8[_0xeb69('0x2c')]+_0x4d4bb8[_0xeb69('0x2b')];var _0x5adb88;if(_0x46045b>=_0x3fc0f6){_0x46045b=_0x3fc0f6;_0x5adb88=0xc8;}else{_0x5adb88=0xce;}_0x2fc8b8['status'](_0x5adb88);return _0x2fc8b8[_0xeb69('0x2d')]('Content-Range',_0x5bdcee+'-'+_0x46045b+'/'+_0x3fc0f6)[_0xeb69('0x2e')](_0x27ba6b);}return null;};}function patchUpdates(_0x30e19b){return function(_0x105893){try{jsonpatch[_0xeb69('0x2f')](_0x105893,_0x30e19b,!![]);}catch(_0x4dd7aa){return BPromise['reject'](_0x4dd7aa);}return _0x105893[_0xeb69('0x30')]();};}function saveUpdates(_0x16c713,_0x1c83d4){return function(_0x4817a8){if(_0x4817a8){return _0x4817a8['update'](_0x16c713)[_0xeb69('0x1c')](function(_0x5e6187){return _0x5e6187;});}return null;};}function removeEntity(_0x2969d1,_0x5be4a4){return function(_0x39bac7){if(_0x39bac7){return _0x39bac7['destroy']()[_0xeb69('0x1c')](function(){_0x2969d1[_0xeb69('0x28')](0xcc)[_0xeb69('0x29')]();});}};}function handleEntityNotFound(_0x2ee662,_0x40b88b){return function(_0x1f3164){if(!_0x1f3164){_0x2ee662[_0xeb69('0x27')](0x194);}return _0x1f3164;};}function handleError(_0xc7d503,_0x52ce02){_0x52ce02=_0x52ce02||0x1f4;return function(_0x3577bf){logger[_0xeb69('0x23')](_0x3577bf['stack']);if(_0x3577bf[_0xeb69('0x31')]){delete _0x3577bf[_0xeb69('0x31')];}_0xc7d503[_0xeb69('0x28')](_0x52ce02)[_0xeb69('0x32')](_0x3577bf);};}exports[_0xeb69('0x33')]=function(_0x2f78fc,_0x58fb02){var _0x3e2310={},_0x374420={},_0xeedfb8={'count':0x0,'rows':[]};var _0x4c7480=_[_0xeb69('0x34')](db['OpenchannelMessage'][_0xeb69('0x35')],function(_0x44de58){return{'name':_0x44de58[_0xeb69('0x36')],'type':_0x44de58[_0xeb69('0x37')][_0xeb69('0x38')]};});_0x374420[_0xeb69('0x39')]=_[_0xeb69('0x34')](_0x4c7480,'name');_0x374420[_0xeb69('0x3a')]=_['keys'](_0x2f78fc[_0xeb69('0x3a')]);_0x374420[_0xeb69('0x3b')]=_[_0xeb69('0x3c')](_0x374420['model'],_0x374420[_0xeb69('0x3a')]);_0x3e2310[_0xeb69('0x3d')]=_[_0xeb69('0x3c')](_0x374420[_0xeb69('0x39')],qs[_0xeb69('0x3e')](_0x2f78fc['query'][_0xeb69('0x3e')]));_0x3e2310[_0xeb69('0x3d')]=_0x3e2310[_0xeb69('0x3d')][_0xeb69('0x3f')]?_0x3e2310[_0xeb69('0x3d')]:_0x374420[_0xeb69('0x39')];if(!_0x2f78fc[_0xeb69('0x3a')][_0xeb69('0x40')](_0xeb69('0x41'))){_0x3e2310['limit']=qs[_0xeb69('0x2b')](_0x2f78fc[_0xeb69('0x3a')][_0xeb69('0x2b')]);_0x3e2310['offset']=qs[_0xeb69('0x2c')](_0x2f78fc[_0xeb69('0x3a')][_0xeb69('0x2c')]);}_0x3e2310[_0xeb69('0x42')]=qs[_0xeb69('0x43')](_0x2f78fc[_0xeb69('0x3a')][_0xeb69('0x43')]);_0x3e2310[_0xeb69('0x44')]=qs[_0xeb69('0x3b')](_['pick'](_0x2f78fc[_0xeb69('0x3a')],_0x374420[_0xeb69('0x3b')]),_0x4c7480);if(_0x2f78fc[_0xeb69('0x3a')][_0xeb69('0x45')]){_0x3e2310[_0xeb69('0x44')]=_[_0xeb69('0x46')](_0x3e2310[_0xeb69('0x44')],{'$or':_[_0xeb69('0x34')](_0x4c7480,function(_0x36da9e){if(_0x36da9e['type']!==_0xeb69('0x47')){var _0x4accce={};_0x4accce[_0x36da9e[_0xeb69('0x31')]]={'$like':'%'+_0x2f78fc[_0xeb69('0x3a')][_0xeb69('0x45')]+'%'};return _0x4accce;}})});}_0x3e2310=_[_0xeb69('0x46')]({},_0x3e2310,_0x2f78fc['options']);var _0x42a6d8={'where':_0x3e2310[_0xeb69('0x44')]};return db[_0xeb69('0x48')][_0xeb69('0x49')](_0x42a6d8)[_0xeb69('0x1c')](function(_0x1630a8){_0xeedfb8[_0xeb69('0x49')]=_0x1630a8;if(_0x2f78fc['query'][_0xeb69('0x4a')]){_0x3e2310[_0xeb69('0x4b')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x3e2310);})[_0xeb69('0x1c')](function(_0x36d41f){_0xeedfb8[_0xeb69('0x4c')]=_0x36d41f;return _0xeedfb8;})[_0xeb69('0x1c')](respondWithFilteredResult(_0x58fb02,_0x3e2310))[_0xeb69('0x26')](handleError(_0x58fb02,null));};exports['show']=function(_0x571883,_0x284b07){var _0x177001={'raw':!![],'where':{'id':_0x571883[_0xeb69('0x4d')]['id']}},_0x271357={};_0x271357[_0xeb69('0x39')]=_['keys'](db[_0xeb69('0x48')]['rawAttributes']);_0x271357['query']=_[_0xeb69('0x4e')](_0x571883[_0xeb69('0x3a')]);_0x271357['filters']=_[_0xeb69('0x3c')](_0x271357[_0xeb69('0x39')],_0x271357[_0xeb69('0x3a')]);_0x177001[_0xeb69('0x3d')]=_['intersection'](_0x271357['model'],qs[_0xeb69('0x3e')](_0x571883[_0xeb69('0x3a')][_0xeb69('0x3e')]));_0x177001[_0xeb69('0x3d')]=_0x177001[_0xeb69('0x3d')][_0xeb69('0x3f')]?_0x177001[_0xeb69('0x3d')]:_0x271357[_0xeb69('0x39')];if(_0x571883['query']['includeAll']){_0x177001[_0xeb69('0x4b')]=[{'all':!![]}];}_0x177001=_[_0xeb69('0x46')]({},_0x177001,_0x571883[_0xeb69('0x4f')]);return db[_0xeb69('0x48')][_0xeb69('0x50')](_0x177001)['then'](handleEntityNotFound(_0x284b07,null))['then'](respondWithResult(_0x284b07,null))['catch'](handleError(_0x284b07,null));};exports[_0xeb69('0x51')]=function(_0x49ed4b,_0x11a6eb){return db[_0xeb69('0x48')]['create'](_0x49ed4b['body'],{})[_0xeb69('0x1c')](respondWithResult(_0x11a6eb,0xc9))[_0xeb69('0x26')](handleError(_0x11a6eb,null));};exports[_0xeb69('0x52')]=function(_0x3905ee,_0x5061d4){if(_0x3905ee[_0xeb69('0x53')]['id']){delete _0x3905ee[_0xeb69('0x53')]['id'];}return db[_0xeb69('0x48')][_0xeb69('0x50')]({'where':{'id':_0x3905ee['params']['id']}})[_0xeb69('0x1c')](handleEntityNotFound(_0x5061d4,null))[_0xeb69('0x1c')](saveUpdates(_0x3905ee[_0xeb69('0x53')],null))[_0xeb69('0x1c')](respondWithResult(_0x5061d4,null))[_0xeb69('0x26')](handleError(_0x5061d4,null));};exports[_0xeb69('0x54')]=function(_0x230779,_0x375810){return db['OpenchannelMessage'][_0xeb69('0x50')]({'where':{'id':_0x230779['params']['id']}})[_0xeb69('0x1c')](handleEntityNotFound(_0x375810,null))[_0xeb69('0x1c')](removeEntity(_0x375810,null))[_0xeb69('0x26')](handleError(_0x375810,null));};exports[_0xeb69('0x55')]=function(_0x509e25,_0x36b41a){return db[_0xeb69('0x48')][_0xeb69('0x55')]()[_0xeb69('0x1c')](respondWithResult(_0x36b41a,null))[_0xeb69('0x26')](handleError(_0x36b41a,null));};var interaction_log=require(_0xeb69('0x56'))('openchannel-interactions');exports[_0xeb69('0x57')]=function(_0x400a00,_0x2a2f70,_0x1a2222){var _0x544362={'agent':{},'channel':_0xeb69('0x58')};if(_0x400a00[_0xeb69('0x53')]['id']){delete _0x400a00['body']['id'];}_0x400a00[_0xeb69('0x53')][_0xeb69('0x59')]=!![];_0x400a00[_0xeb69('0x53')][_0xeb69('0x5a')]=moment()[_0xeb69('0x5b')](_0xeb69('0x5c'));_0x400a00[_0xeb69('0x53')]['UserId']=_0x400a00[_0xeb69('0x53')]['UserId']||_0x400a00['user']['id'];_0x544362[_0xeb69('0x5d')]['id']=_0x400a00[_0xeb69('0x53')][_0xeb69('0x5e')];return db[_0xeb69('0x48')][_0xeb69('0x50')]({'where':{'id':_0x400a00['params']['id'],'UserId':null}})[_0xeb69('0x1c')](handleEntityNotFound(_0x2a2f70,null))[_0xeb69('0x1c')](saveUpdates(_0x400a00[_0xeb69('0x53')],null))[_0xeb69('0x1c')](function(_0x1565bd){if(_0x1565bd){_0x544362[_0xeb69('0x25')]=_0x1565bd[_0xeb69('0x5f')]({'plain':!![]});return db['OpenchannelInteraction'][_0xeb69('0x50')]({'where':{'id':_0x1565bd[_0xeb69('0x60')]}});}return null;})[_0xeb69('0x1c')](handleEntityNotFound(_0x2a2f70,null))[_0xeb69('0x1c')](function(_0x15fe6b){if(_0x15fe6b){return _0x15fe6b[_0xeb69('0x52')]({'UserId':_0x400a00[_0xeb69('0x53')][_0xeb69('0x5e')],'read1stAt':_[_0xeb69('0x61')](_0x15fe6b[_0xeb69('0x62')])?moment()[_0xeb69('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x510e57){if(_0x510e57){_0x544362[_0xeb69('0x63')]=_0x510e57['get']({'plain':!![]});interaction_log[_0xeb69('0x1d')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x400a00[_0xeb69('0x64')]['id'],_0x400a00['user'][_0xeb69('0x31')],_0x400a00[_0xeb69('0x64')][_0xeb69('0x65')],_0x544362[_0xeb69('0x63')]['id'],_0x400a00[_0xeb69('0x53')]?JSON[_0xeb69('0x22')](_0x400a00[_0xeb69('0x53')]):'null');return respondWithRpcPromise(_0xeb69('0x66'),'acceptMessage',_0x544362);}return null;})[_0xeb69('0x1c')](function(_0x201aea){var _0x4a581b=_0xeb69('0x67')+_0x201aea[_0xeb69('0x25')][_0xeb69('0x68')];return db[_0xeb69('0x69')][_0xeb69('0x3a')](_0x4a581b,{'type':db[_0xeb69('0x6a')]['QueryTypes'][_0xeb69('0x6b')],'raw':!![]})[_0xeb69('0x1c')](function(_0x4e574e){return _0x4e574e;});})[_0xeb69('0x1c')](function(_0x196fba){if(_0x196fba){_0x544362[_0xeb69('0x25')]['contact']=_0x196fba[0x0];if(!_0x400a00[_0xeb69('0x53')][_0xeb69('0x5e')])return;return db['User']['find']({'where':{'id':_0x400a00[_0xeb69('0x53')][_0xeb69('0x5e')],'role':_0xeb69('0x5d')},'attributes':['id',_0xeb69('0x31'),_0xeb69('0x6c'),'email',_0xeb69('0x6d')],'raw':!![]});}return null;})[_0xeb69('0x1c')](function(_0x37d49e){if(!_0x37d49e)return null;_0x544362[_0xeb69('0x25')][_0xeb69('0x5d')]=_0x37d49e;return _0x544362;})[_0xeb69('0x1c')](function(_0x3f58f8){if(_0x3f58f8){if(_0x400a00[_0xeb69('0x53')]['manual']){_0x544362[_0xeb69('0x25')][_0xeb69('0x6e')]=util['format'](_0xeb69('0x6f'),_0x400a00[_0xeb69('0x64')][_0xeb69('0x31')]);_0x544362['message'][_0xeb69('0x70')]=_0x544362[_0xeb69('0x70')];_0x544362[_0xeb69('0x25')]['motionChannel']=_0x544362['channel'];_0x544362[_0xeb69('0x25')][_0xeb69('0x71')]=_0xeb69('0x57');return respondWithRpcPromise(_0xeb69('0x72'),_0xeb69('0x72'),{'event':_0xeb69('0x73'),'message':_0x544362['message']},client9002)[_0xeb69('0x1c')](function(){return _0x544362;});}return _0x544362;}return null;})[_0xeb69('0x1c')](respondWithResult(_0x2a2f70,null))[_0xeb69('0x26')](handleError(_0x2a2f70,null));};var interaction_log=require(_0xeb69('0x56'))(_0xeb69('0x74'));exports[_0xeb69('0x75')]=function(_0x28134e,_0x468934,_0x17b5f6){var _0x3a7812={'agent':{},'channel':'openchannel'};if(_0x28134e[_0xeb69('0x53')]['id']){delete _0x28134e['body']['id'];}_0x28134e[_0xeb69('0x53')][_0xeb69('0x5e')]=_0x28134e[_0xeb69('0x53')][_0xeb69('0x5e')]||_0x28134e[_0xeb69('0x64')]['id'];_0x3a7812[_0xeb69('0x5d')]['id']=_0x28134e[_0xeb69('0x53')][_0xeb69('0x5e')];return db[_0xeb69('0x48')][_0xeb69('0x50')]({'where':{'id':_0x28134e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x468934,null))[_0xeb69('0x1c')](function(_0x2edfd4){if(_0x2edfd4){_0x3a7812[_0xeb69('0x25')]=_0x2edfd4['get']({'plain':!![]});return db[_0xeb69('0x76')]['find']({'where':{'id':_0x2edfd4['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x468934,null))[_0xeb69('0x1c')](function(_0x2b6822){if(_0x2b6822){_0x3a7812['interaction']=_0x2b6822[_0xeb69('0x5f')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x28134e[_0xeb69('0x64')]['id'],_0x28134e[_0xeb69('0x64')][_0xeb69('0x31')],_0x28134e[_0xeb69('0x64')][_0xeb69('0x65')],_0x3a7812['interaction']['id'],_0x28134e[_0xeb69('0x53')]?JSON['stringify'](_0x28134e[_0xeb69('0x53')]):'null');return respondWithRpcPromise(_0xeb69('0x77'),_0xeb69('0x78'),_0x3a7812);}return null;})[_0xeb69('0x1c')](function(_0x8fbdf1){var _0x37ab92='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x8fbdf1[_0xeb69('0x25')][_0xeb69('0x68')];return db[_0xeb69('0x69')]['query'](_0x37ab92,{'type':db[_0xeb69('0x6a')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x788846){return _0x788846;});})[_0xeb69('0x1c')](function(_0x5e891e){if(_0x5e891e){_0x3a7812['message'][_0xeb69('0x79')]=_0x5e891e[0x0];if(!_0x28134e[_0xeb69('0x53')][_0xeb69('0x5e')])return;return db[_0xeb69('0x7a')]['find']({'where':{'id':_0x28134e['body'][_0xeb69('0x5e')],'role':_0xeb69('0x5d')},'attributes':['id','name',_0xeb69('0x6c'),_0xeb69('0x7b'),_0xeb69('0x6d')],'raw':!![]});}return null;})[_0xeb69('0x1c')](function(_0x30fdc1){if(!_0x30fdc1)return null;_0x3a7812['message'][_0xeb69('0x5d')]=_0x30fdc1;return _0x3a7812;})[_0xeb69('0x1c')](function(_0x6378ac){if(_0x6378ac){_0x6378ac[_0xeb69('0x25')][_0xeb69('0x6e')]=util[_0xeb69('0x5b')](_0xeb69('0x6f'),_0x28134e[_0xeb69('0x64')]['name']);_0x6378ac[_0xeb69('0x25')]['channel']=_0x3a7812['channel'];_0x6378ac[_0xeb69('0x25')][_0xeb69('0x7c')]=_0x3a7812[_0xeb69('0x70')];_0x6378ac[_0xeb69('0x25')][_0xeb69('0x71')]=_0xeb69('0x75');respondWithRpcPromise(_0xeb69('0x72'),'EventManager',{'event':_0xeb69('0x7d'),'message':_0x6378ac[_0xeb69('0x25')]},client9002);return _0x3a7812;}return null;})[_0xeb69('0x1c')](respondWithResult(_0x468934,null))[_0xeb69('0x26')](handleError(_0x468934,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1dfcbaa..81dd4c2 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 _0x6337=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0xa5e1e0,_0x2764d2){var _0x5d442b=function(_0x4ffd51){while(--_0x4ffd51){_0xa5e1e0['push'](_0xa5e1e0['shift']());}};_0x5d442b(++_0x2764d2);}(_0x6337,0x1ab));var _0x7633=function(_0x226648,_0x295cd2){_0x226648=_0x226648-0x0;var _0x26a98d=_0x6337[_0x226648];return _0x26a98d;};'use strict';var EventEmitter=require(_0x7633('0x0'));var OpenchannelMessage=require(_0x7633('0x1'))['db'][_0x7633('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7633('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7633('0x4'),'afterDestroy':_0x7633('0x5')};function emitEvent(_0x33c4aa){return function(_0x2b6856,_0x2f756d,_0x764af3){OpenchannelMessageEvents[_0x7633('0x6')](_0x33c4aa+':'+_0x2b6856['id'],_0x2b6856);OpenchannelMessageEvents[_0x7633('0x6')](_0x33c4aa,_0x2b6856);_0x764af3(null);};}for(var e in events){if(events[_0x7633('0x7')](e)){var event=events[e];OpenchannelMessage[_0x7633('0x8')](e,emitEvent(event));}}module[_0x7633('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xfae7=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x33291f,_0x42366b){var _0x429a6e=function(_0x443a53){while(--_0x443a53){_0x33291f['push'](_0x33291f['shift']());}};_0x429a6e(++_0x42366b);}(_0xfae7,0x91));var _0x7fae=function(_0x32d8d2,_0x51a238){_0x32d8d2=_0x32d8d2-0x0;var _0x4e205c=_0xfae7[_0x32d8d2];return _0x4e205c;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x7fae('0x0'))['db'][_0x7fae('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7fae('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7fae('0x3'),'afterDestroy':_0x7fae('0x4')};function emitEvent(_0x4b26a9){return function(_0x30f32b,_0x4adc12,_0x183a9f){OpenchannelMessageEvents['emit'](_0x4b26a9+':'+_0x30f32b['id'],_0x30f32b);OpenchannelMessageEvents[_0x7fae('0x5')](_0x4b26a9,_0x30f32b);_0x183a9f(null);};}for(var e in events){if(events[_0x7fae('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x7fae('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index b21fc81..a3a359f 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 _0x3d74=['Interactions','OpenchannelInteractionId','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','length','Interaction','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','body','models','get','direction','out','secret','isNil','UserId','OpenchannelInteraction','then','update','createdAt','toLowerCase','describe','OpenchannelAccount','find','OpenchannelAccountId'];(function(_0x33c2af,_0x163198){var _0x13c04a=function(_0x4de68e){while(--_0x4de68e){_0x33c2af['push'](_0x33c2af['shift']());}};_0x13c04a(++_0x163198);}(_0x3d74,0xa0));var _0x43d7=function(_0x4667f4,_0x3d6455){_0x4667f4=_0x4667f4-0x0;var _0x2ceacf=_0x3d74[_0x4667f4];return _0x2ceacf;};'use strict';var _=require('lodash');var util=require(_0x43d7('0x0'));var logger=require(_0x43d7('0x1'))(_0x43d7('0x2'));var moment=require(_0x43d7('0x3'));var BPromise=require(_0x43d7('0x4'));var rp=require(_0x43d7('0x5'));var fs=require('fs');var path=require(_0x43d7('0x6'));var rimraf=require(_0x43d7('0x7'));var config=require('../../config/environment');var attributes=require(_0x43d7('0x8'));module['exports']=function(_0x1062a6,_0x82caa5){return _0x1062a6['define'](_0x43d7('0x9'),attributes,{'tableName':_0x43d7('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x43d7('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x441d75,_0x458ff4,_0x4d372f){var _0x2561e8=_0x1062a6[_0x43d7('0xc')];var _0xba365=_0x441d75[_0x43d7('0xd')]({'plain':!![]});if(_0xba365[_0x43d7('0xe')]['toLowerCase']()==='in'||_0xba365[_0x43d7('0xe')]['toLowerCase']()===_0x43d7('0xf')&&!_0xba365[_0x43d7('0x10')]&&!_[_0x43d7('0x11')](_0xba365[_0x43d7('0x12')])){_0x2561e8[_0x43d7('0x13')]['findOne']({'where':{'id':_0xba365['OpenchannelInteractionId']}})[_0x43d7('0x14')](function(_0x449d2f){if(_0x449d2f){_0x449d2f[_0x43d7('0x15')]({'lastMsgAt':_0xba365[_0x43d7('0x16')],'lastMsgDirection':_0xba365['direction'][_0x43d7('0x17')]()});}})['catch'](function(_0x19e9ad){console['error'](_0x19e9ad);});}if(_0xba365['direction']===_0x43d7('0xf')&&!_0xba365[_0x43d7('0x10')]){var _0x4be067;_0x2561e8['CmContact'][_0x43d7('0x18')]()[_0x43d7('0x14')](function(_0x379be3){return _0x2561e8[_0x43d7('0x19')][_0x43d7('0x1a')]({'where':{'id':_0xba365[_0x43d7('0x1b')]},'include':[{'model':_0x2561e8[_0x43d7('0x13')],'as':_0x43d7('0x1c'),'where':{'id':_0xba365[_0x43d7('0x1d')]},'limit':0x1,'include':[{'model':_0x2561e8[_0x43d7('0x1e')],'as':_0x43d7('0x1f'),'attributes':_[_0x43d7('0x20')](_0x379be3)}]}]});})[_0x43d7('0x14')](function(_0x34138b){_0x4be067=_0x34138b['get']({'plain':!![]});if(_0x4be067&&_0x4be067[_0x43d7('0x21')]){logger['info'](_0x43d7('0x22'),_0x43d7('0x23'),util['format']('Forwarding\x20message\x20%d\x20to\x20%s',_0xba365['id'],_0x4be067[_0x43d7('0x21')]));if(_0x4be067[_0x43d7('0x1c')]&&_0x4be067[_0x43d7('0x1c')][_0x43d7('0x24')]){_0xba365[_0x43d7('0x25')]=_['omit'](_0x4be067[_0x43d7('0x1c')][0x0],_0x43d7('0x1f'));_0xba365[_0x43d7('0x1f')]=_0x4be067[_0x43d7('0x1c')][0x0]['Contact'];}var _0x458ff4={'method':_0x43d7('0x26'),'uri':encodeURI(_0x4be067['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x458ff4[_0x43d7('0x27')]){case _0x43d7('0x28'):_0x458ff4['qs']=_0xba365;break;case _0x43d7('0x26'):_0x458ff4[_0x43d7('0xb')]=_0xba365;break;}return rp(_0x458ff4)[_0x43d7('0x14')](function(_0x1f5a50){logger[_0x43d7('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x43d7('0x23'),util['format'](_0x43d7('0x2a'),_0xba365['id'],_0x4be067[_0x43d7('0x21')]));if(_0x1f5a50[_0x43d7('0xb')][_0x43d7('0x2b')]&&_0x1f5a50['body']['threadId']!=_0xba365[_0x43d7('0x25')][_0x43d7('0x2b')]){return _0x2561e8[_0x43d7('0x13')][_0x43d7('0x15')]({'threadId':_0x1f5a50['body'][_0x43d7('0x2b')]},{'where':{'id':_0xba365[_0x43d7('0x25')]['id']}});}else{return;}})[_0x43d7('0x14')](function(){return _0x441d75[_0x43d7('0x15')]({'read':!![]});})['catch'](function(_0x5998f8){logger[_0x43d7('0x2c')](_0x43d7('0x22'),_0x43d7('0x23'),util[_0x43d7('0x2d')](_0x5998f8,{'showHidden':![],'depth':null}));_0x4d372f();});}else{_0x4d372f();}})['finally'](function(){_0x4d372f();});}else{_0x4d372f();}}},'charset':'utf8mb4','collate':_0x43d7('0x2e')});}; \ No newline at end of file +var _0xc152=['util','api','moment','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1dbaf7,_0x3d05b3){var _0x593f05=function(_0x381936){while(--_0x381936){_0x1dbaf7['push'](_0x1dbaf7['shift']());}};_0x593f05(++_0x3d05b3);}(_0xc152,0xc8));var _0x2c15=function(_0x3c864a,_0xc886c4){_0x3c864a=_0x3c864a-0x0;var _0x3ff9ed=_0xc152[_0x3c864a];return _0x3ff9ed;};'use strict';var _=require('lodash');var util=require(_0x2c15('0x0'));var logger=require('../../config/logger')(_0x2c15('0x1'));var moment=require(_0x2c15('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2c15('0x3'));var config=require(_0x2c15('0x4'));var attributes=require(_0x2c15('0x5'));module[_0x2c15('0x6')]=function(_0x57589e,_0x458f16){return _0x57589e[_0x2c15('0x7')](_0x2c15('0x8'),attributes,{'tableName':_0x2c15('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x2c15('0xa')],'type':_0x2c15('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e4901,_0x2703e6,_0x311b6a){var _0xd7fd28=_0x57589e[_0x2c15('0xc')];var _0x55b191=_0x2e4901[_0x2c15('0xd')]({'plain':!![]});if(_0x55b191['direction'][_0x2c15('0xe')]()==='in'||_0x55b191[_0x2c15('0xf')][_0x2c15('0xe')]()===_0x2c15('0x10')&&!_0x55b191[_0x2c15('0x11')]&&!_[_0x2c15('0x12')](_0x55b191[_0x2c15('0x13')])){_0xd7fd28[_0x2c15('0x14')][_0x2c15('0x15')]({'where':{'id':_0x55b191['OpenchannelInteractionId']}})[_0x2c15('0x16')](function(_0x22632e){if(_0x22632e){_0x22632e[_0x2c15('0x17')]({'lastMsgAt':_0x55b191[_0x2c15('0x18')],'lastMsgDirection':_0x55b191[_0x2c15('0xf')][_0x2c15('0xe')]()});}})[_0x2c15('0x19')](function(_0x30c70a){console[_0x2c15('0x1a')](_0x30c70a);});}if(_0x55b191[_0x2c15('0xf')]===_0x2c15('0x10')&&!_0x55b191[_0x2c15('0x11')]){var _0x591204;_0xd7fd28[_0x2c15('0x1b')]['describe']()[_0x2c15('0x16')](function(_0x19ebe5){return _0xd7fd28['OpenchannelAccount'][_0x2c15('0x1c')]({'where':{'id':_0x55b191[_0x2c15('0x1d')]},'include':[{'model':_0xd7fd28['OpenchannelInteraction'],'as':_0x2c15('0x1e'),'where':{'id':_0x55b191['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xd7fd28[_0x2c15('0x1b')],'as':_0x2c15('0x1f'),'attributes':_[_0x2c15('0x20')](_0x19ebe5)}]}]});})[_0x2c15('0x16')](function(_0x860875){_0x591204=_0x860875['get']({'plain':!![]});if(_0x591204&&_0x591204[_0x2c15('0x21')]){logger[_0x2c15('0x22')](_0x2c15('0x23'),_0x2c15('0x24'),util[_0x2c15('0x25')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x55b191['id'],_0x591204[_0x2c15('0x21')]));if(_0x591204[_0x2c15('0x1e')]&&_0x591204['Interactions'][_0x2c15('0x26')]){_0x55b191[_0x2c15('0x27')]=_[_0x2c15('0x28')](_0x591204[_0x2c15('0x1e')][0x0],_0x2c15('0x1f'));_0x55b191[_0x2c15('0x1f')]=_0x591204['Interactions'][0x0]['Contact'];}var _0x2703e6={'method':_0x2c15('0x29'),'uri':encodeURI(_0x591204['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2703e6[_0x2c15('0x2a')]){case _0x2c15('0x2b'):_0x2703e6['qs']=_0x55b191;break;case _0x2c15('0x29'):_0x2703e6[_0x2c15('0xa')]=_0x55b191;break;}return rp(_0x2703e6)['then'](function(_0x5a1240){logger[_0x2c15('0x22')](_0x2c15('0x23'),'afterCreate',util[_0x2c15('0x25')](_0x2c15('0x2c'),_0x55b191['id'],_0x591204['replyUri']));if(_0x5a1240['body']['threadId']&&_0x5a1240[_0x2c15('0xa')][_0x2c15('0x2d')]!=_0x55b191[_0x2c15('0x27')][_0x2c15('0x2d')]){return _0xd7fd28[_0x2c15('0x14')][_0x2c15('0x17')]({'threadId':_0x5a1240[_0x2c15('0xa')]['threadId']},{'where':{'id':_0x55b191['Interaction']['id']}});}else{return;}})[_0x2c15('0x16')](function(){return _0x2e4901[_0x2c15('0x17')]({'read':!![]});})[_0x2c15('0x19')](function(_0x718572){logger[_0x2c15('0x1a')](_0x2c15('0x23'),'afterCreate',util[_0x2c15('0x2e')](_0x718572,{'showHidden':![],'depth':null}));_0x311b6a();});}else{_0x311b6a();}})[_0x2c15('0x2f')](function(){_0x311b6a();});}else{_0x311b6a();}}},'charset':_0x2c15('0x30'),'collate':_0x2c15('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index e86c321..745a0bd 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x590b5a,_0x51acd6){var _0x2e7a9a=function(_0x296067){while(--_0x296067){_0x590b5a['push'](_0x590b5a['shift']());}};_0x2e7a9a(++_0x51acd6);}(_0x7a54,0x106));var _0x47a5=function(_0x3a3a88,_0x2fe978){_0x3a3a88=_0x3a3a88-0x0;var _0x343e84=_0x7a54[_0x3a3a88];return _0x343e84;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5deedd,_0x52fa9c){var _0x58e9a9=function(_0x1d3c4e){while(--_0x1d3c4e){_0x5deedd['push'](_0x5deedd['shift']());}};_0x58e9a9(++_0x52fa9c);}(_0x7a54,0x106));var _0x47a5=function(_0x4c1e86,_0x2cae19){_0x4c1e86=_0x4c1e86-0x0;var _0x3e0c34=_0x7a54[_0x4c1e86];return _0x3e0c34;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 44abb02..f34377f 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 _0xb242=['register','length','save','remove','update','emit','removeListener'];(function(_0x31401f,_0x55ce53){var _0x435c59=function(_0x2ed1be){while(--_0x2ed1be){_0x31401f['push'](_0x31401f['shift']());}};_0x435c59(++_0x55ce53);}(_0xb242,0x1f3));var _0x2b24=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0xb242[_0x237da8];return _0x558825;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x2b24('0x0'),_0x2b24('0x1'),_0x2b24('0x2')];function createListener(_0x23d2ef,_0x2ae747){return function(_0x24b99d){_0x2ae747[_0x2b24('0x3')](_0x23d2ef,_0x24b99d);};}function removeListener(_0x481806,_0x494b43){return function(){OpenchannelMessageEvents[_0x2b24('0x4')](_0x481806,_0x494b43);};}exports[_0x2b24('0x5')]=function(_0x5c1f57){for(var _0x341c66=0x0,_0x477e45=events[_0x2b24('0x6')];_0x341c66<_0x477e45;_0x341c66++){var _0x53345b=events[_0x341c66];var _0x475271=createListener('openchannelMessage:'+_0x53345b,_0x5c1f57);OpenchannelMessageEvents['on'](_0x53345b,_0x475271);}}; \ No newline at end of file +var _0x8ad5=['remove','update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8ad5,0xf1));var _0x58ad=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8ad5[_0xbca1b1];return _0x4e1686;};'use strict';var OpenchannelMessageEvents=require(_0x58ad('0x0'));var events=[_0x58ad('0x1'),_0x58ad('0x2'),_0x58ad('0x3')];function createListener(_0x4cfe26,_0x5dca8a){return function(_0x1e5eb9){_0x5dca8a[_0x58ad('0x4')](_0x4cfe26,_0x1e5eb9);};}function removeListener(_0x223e54,_0x22aba9){return function(){OpenchannelMessageEvents[_0x58ad('0x5')](_0x223e54,_0x22aba9);};}exports[_0x58ad('0x6')]=function(_0x51d560){for(var _0x5888f7=0x0,_0x394972=events[_0x58ad('0x7')];_0x5888f7<_0x394972;_0x5888f7++){var _0x220c5f=events[_0x5888f7];var _0x2033a3=createListener(_0x58ad('0x8')+_0x220c5f,_0x51d560);OpenchannelMessageEvents['on'](_0x220c5f,_0x2033a3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 182c197..c760135 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 _0xab4d=['getTeams','/:id/users','create','post','addTeams','addAgents','put','delete','destroy','removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','getMembers','/:id/teams'];(function(_0x456b45,_0x273834){var _0xe3627d=function(_0x3a6f59){while(--_0x3a6f59){_0x456b45['push'](_0x456b45['shift']());}};_0xe3627d(++_0x273834);}(_0xab4d,0x1f0));var _0xdab4=function(_0x5bf2b3,_0xfcd364){_0x5bf2b3=_0x5bf2b3-0x0;var _0x5e8a9b=_0xab4d[_0x5bf2b3];return _0x5e8a9b;};'use strict';var multer=require(_0xdab4('0x0'));var util=require(_0xdab4('0x1'));var path=require('path');var timeout=require(_0xdab4('0x2'));var express=require(_0xdab4('0x3'));var router=express[_0xdab4('0x4')]();var fs_extra=require(_0xdab4('0x5'));var auth=require(_0xdab4('0x6'));var interaction=require(_0xdab4('0x7'));var config=require(_0xdab4('0x8'));var controller=require(_0xdab4('0x9'));router[_0xdab4('0xa')]('/',auth[_0xdab4('0xb')](),controller[_0xdab4('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdab4('0xd')]);router['get'](_0xdab4('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdab4('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0xdab4('0xf')]);router[_0xdab4('0xa')](_0xdab4('0x10'),auth[_0xdab4('0xb')](),controller[_0xdab4('0x11')]);router[_0xdab4('0xa')](_0xdab4('0x12'),auth[_0xdab4('0xb')](),controller['getAgents']);router['post']('/',auth[_0xdab4('0xb')](),controller[_0xdab4('0x13')]);router[_0xdab4('0x14')]('/:id/teams',auth[_0xdab4('0xb')](),controller[_0xdab4('0x15')]);router[_0xdab4('0x14')](_0xdab4('0x12'),auth[_0xdab4('0xb')](),controller[_0xdab4('0x16')]);router[_0xdab4('0x17')](_0xdab4('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xdab4('0x18')](_0xdab4('0xe'),auth[_0xdab4('0xb')](),controller[_0xdab4('0x19')]);router[_0xdab4('0x18')]('/:id/teams',auth[_0xdab4('0xb')](),controller[_0xdab4('0x1a')]);router['delete'](_0xdab4('0x12'),auth[_0xdab4('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xd65e=['/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id','destroy','removeAgents','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x35655f,_0x23dfc3){var _0x1f2ae8=function(_0x120ff7){while(--_0x120ff7){_0x35655f['push'](_0x35655f['shift']());}};_0x1f2ae8(++_0x23dfc3);}(_0xd65e,0x1b0));var _0xed65=function(_0x42f682,_0x5e84f8){_0x42f682=_0x42f682-0x0;var _0x1e8acf=_0xd65e[_0x42f682];return _0x1e8acf;};'use strict';var multer=require(_0xed65('0x0'));var util=require(_0xed65('0x1'));var path=require(_0xed65('0x2'));var timeout=require(_0xed65('0x3'));var express=require(_0xed65('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xed65('0x5'));var config=require(_0xed65('0x6'));var controller=require(_0xed65('0x7'));router[_0xed65('0x8')]('/',auth[_0xed65('0x9')](),controller[_0xed65('0xa')]);router['get'](_0xed65('0xb'),auth[_0xed65('0x9')](),controller[_0xed65('0xc')]);router[_0xed65('0x8')]('/:id',auth[_0xed65('0x9')](),controller[_0xed65('0xd')]);router[_0xed65('0x8')](_0xed65('0xe'),auth['isAuthenticated'](),controller[_0xed65('0xf')]);router[_0xed65('0x8')](_0xed65('0x10'),auth['isAuthenticated'](),controller[_0xed65('0x11')]);router[_0xed65('0x8')](_0xed65('0x12'),auth[_0xed65('0x9')](),controller[_0xed65('0x13')]);router[_0xed65('0x14')]('/',auth[_0xed65('0x9')](),controller[_0xed65('0x15')]);router[_0xed65('0x14')](_0xed65('0x10'),auth[_0xed65('0x9')](),controller[_0xed65('0x16')]);router[_0xed65('0x14')](_0xed65('0x12'),auth[_0xed65('0x9')](),controller[_0xed65('0x17')]);router[_0xed65('0x18')]('/:id',auth[_0xed65('0x9')](),controller[_0xed65('0x19')]);router[_0xed65('0x1a')](_0xed65('0x1b'),auth[_0xed65('0x9')](),controller[_0xed65('0x1c')]);router[_0xed65('0x1a')](_0xed65('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xed65('0x1a')](_0xed65('0x12'),auth[_0xed65('0x9')](),controller[_0xed65('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index a5c46c0..9bb15d7 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 _0xa21d=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5d8fae,_0x5bdc36){var _0x44118a=function(_0x40cff9){while(--_0x40cff9){_0x5d8fae['push'](_0x5d8fae['shift']());}};_0x44118a(++_0x5bdc36);}(_0xa21d,0x1c1));var _0xda21=function(_0x3181d4,_0x5bcfbd){_0x3181d4=_0x3181d4-0x0;var _0x1306db=_0xa21d[_0x3181d4];return _0x1306db;};'use strict';var Sequelize=require(_0xda21('0x0'));module[_0xda21('0x1')]={'name':{'type':Sequelize[_0xda21('0x2')],'unique':_0xda21('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xda21('0x2')]},'timeout':{'type':Sequelize[_0xda21('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xda21('0x5')](_0xda21('0x6'),_0xda21('0x7'),_0xda21('0x8'))}}; \ No newline at end of file +var _0x3fd7=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x48edd2,_0x32bb68){var _0x3a4270=function(_0x264eda){while(--_0x264eda){_0x48edd2['push'](_0x48edd2['shift']());}};_0x3a4270(++_0x32bb68);}(_0x3fd7,0x122));var _0x73fd=function(_0x201a72,_0x27bf52){_0x201a72=_0x201a72-0x0;var _0x39d16f=_0x3fd7[_0x201a72];return _0x39d16f;};'use strict';var Sequelize=require('sequelize');module[_0x73fd('0x0')]={'name':{'type':Sequelize[_0x73fd('0x1')],'unique':_0x73fd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x73fd('0x1')]},'timeout':{'type':Sequelize[_0x73fd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x73fd('0x4')](_0x73fd('0x5'),_0x73fd('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 24b3dff..31a77bd 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 _0xf2c0=['register','end','status','json','offset','limit','count','set','update','then','destroy','get','OpenchannelQueues','sendStatus','error','name','send','index','rawAttributes','fieldName','type','getOptions','OpenchannelQueue','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserOpenchannelQueue','filters','hasOwnProperty','nolimit','order','sort','where','OpenchannelQueueId','filter','map','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','pick','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','compact','value','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','localhost','socket.io-emitter','redis'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0xf2c0,0x6b));var _0x0f2c=function(_0x3fceb6,_0x387928){_0x3fceb6=_0x3fceb6-0x0;var _0x1be7d1=_0xf2c0[_0x3fceb6];return _0x1be7d1;};'use strict';var BPromise=require(_0x0f2c('0x0'));var util=require(_0x0f2c('0x1'));var _=require(_0x0f2c('0x2'));var squel=require('squel');var Redis=require(_0x0f2c('0x3'));var qs=require(_0x0f2c('0x4'));var logger=require(_0x0f2c('0x5'))('api');var config=require(_0x0f2c('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x0f2c('0x7'),'port':0x18eb});var socket=require(_0x0f2c('0x8'))(new Redis(config[_0x0f2c('0x9')]));require('./openchannelQueue.socket')[_0x0f2c('0xa')](socket);function respondWithStatusCode(_0x3736bc,_0xa5d287){_0xa5d287=_0xa5d287||0xcc;return function(_0x1b196a){if(_0x1b196a){return _0x3736bc['sendStatus'](_0xa5d287);}return _0x3736bc['status'](_0xa5d287)[_0x0f2c('0xb')]();};}function respondWithResult(_0x454b7f,_0x5c6ddd){_0x5c6ddd=_0x5c6ddd||0xc8;return function(_0x4b1fd6){if(_0x4b1fd6){return _0x454b7f[_0x0f2c('0xc')](_0x5c6ddd)[_0x0f2c('0xd')](_0x4b1fd6);}};}function respondWithFilteredResult(_0x9e9ba6,_0x5274bd){return function(_0x26c8ae){if(_0x26c8ae){var _0x436215=typeof _0x5274bd[_0x0f2c('0xe')]==='undefined'&&typeof _0x5274bd[_0x0f2c('0xf')]==='undefined';var _0x2005cf=_0x26c8ae[_0x0f2c('0x10')];var _0x2ede30=_0x436215?0x0:_0x5274bd[_0x0f2c('0xe')];var _0x420d2c=_0x436215?_0x26c8ae[_0x0f2c('0x10')]:_0x5274bd[_0x0f2c('0xe')]+_0x5274bd[_0x0f2c('0xf')];var _0xaef1ef;if(_0x420d2c>=_0x2005cf){_0x420d2c=_0x2005cf;_0xaef1ef=0xc8;}else{_0xaef1ef=0xce;}_0x9e9ba6[_0x0f2c('0xc')](_0xaef1ef);return _0x9e9ba6[_0x0f2c('0x11')]('Content-Range',_0x2ede30+'-'+_0x420d2c+'/'+_0x2005cf)['json'](_0x26c8ae);}return null;};}function saveUpdates(_0x59f586){return function(_0x1d4b71){if(_0x1d4b71){return _0x1d4b71[_0x0f2c('0x12')](_0x59f586)[_0x0f2c('0x13')](function(_0x16dc01){return _0x16dc01;});}return null;};}function removeEntity(_0x93ae49){return function(_0x50133a){if(_0x50133a){return _0x50133a[_0x0f2c('0x14')]()[_0x0f2c('0x13')](function(){var _0x4fc4b2=_0x50133a[_0x0f2c('0x15')]({'plain':!![]});var _0x3626ce=_0x0f2c('0x16');return db['UserProfileResource']['destroy']({'where':{'type':_0x3626ce,'resourceId':_0x4fc4b2['id']}})[_0x0f2c('0x13')](function(){return _0x50133a;});})[_0x0f2c('0x13')](function(){_0x93ae49[_0x0f2c('0xc')](0xcc)[_0x0f2c('0xb')]();});}};}function handleEntityNotFound(_0x4c1f01){return function(_0x2eaae3){if(!_0x2eaae3){_0x4c1f01[_0x0f2c('0x17')](0x194);}return _0x2eaae3;};}function handleError(_0xabb45d,_0x207928){_0x207928=_0x207928||0x1f4;return function(_0x383044){logger[_0x0f2c('0x18')](_0x383044['stack']);if(_0x383044[_0x0f2c('0x19')]){delete _0x383044[_0x0f2c('0x19')];}_0xabb45d['status'](_0x207928)[_0x0f2c('0x1a')](_0x383044);};}exports[_0x0f2c('0x1b')]=function(_0x21fbae,_0x2fee5b){var _0x2f52f2={};var _0x5aeeda={'count':0x0,'rows':[]};var _0x4b47f6=_['map'](db['OpenchannelQueue'][_0x0f2c('0x1c')],function(_0x331b40){return{'name':_0x331b40[_0x0f2c('0x1d')],'type':_0x331b40[_0x0f2c('0x1e')]['key']};});_0x2f52f2=qs[_0x0f2c('0x1f')](_0x4b47f6,_0x21fbae);var _0x3e02bd={'where':_0x2f52f2['where']};return db[_0x0f2c('0x20')][_0x0f2c('0x10')](_0x3e02bd)['then'](function(_0x36605a){_0x5aeeda[_0x0f2c('0x10')]=_0x36605a;_0x2f52f2['include']=qs[_0x0f2c('0x21')](_0x21fbae[_0x0f2c('0x22')]);return db[_0x0f2c('0x20')][_0x0f2c('0x23')](_0x2f52f2);})[_0x0f2c('0x13')](function(_0x19ad7c){_0x5aeeda[_0x0f2c('0x24')]=_0x19ad7c;return _0x5aeeda;})[_0x0f2c('0x13')](respondWithFilteredResult(_0x2fee5b,_0x2f52f2))[_0x0f2c('0x25')](handleError(_0x2fee5b,null));};exports[_0x0f2c('0x26')]=function(_0x1ec083,_0x3410b0){var _0x42b0fd={'raw':!![],'where':{'id':_0x1ec083[_0x0f2c('0x27')]['id']}},_0x313525={};_0x313525[_0x0f2c('0x28')]=_[_0x0f2c('0x29')](db[_0x0f2c('0x20')]['rawAttributes']);_0x313525[_0x0f2c('0x22')]=_[_0x0f2c('0x29')](_0x1ec083['query']);_0x313525['filters']=_[_0x0f2c('0x2a')](_0x313525[_0x0f2c('0x28')],_0x313525[_0x0f2c('0x22')]);_0x42b0fd[_0x0f2c('0x2b')]=_['intersection'](_0x313525[_0x0f2c('0x28')],qs[_0x0f2c('0x2c')](_0x1ec083[_0x0f2c('0x22')][_0x0f2c('0x2c')]));_0x42b0fd[_0x0f2c('0x2b')]=_0x42b0fd['attributes'][_0x0f2c('0x2d')]?_0x42b0fd[_0x0f2c('0x2b')]:_0x313525['model'];if(_0x1ec083[_0x0f2c('0x22')][_0x0f2c('0x2e')]){_0x42b0fd[_0x0f2c('0x21')]=[{'all':!![]}];}_0x42b0fd=_[_0x0f2c('0x2f')]({},_0x42b0fd,_0x1ec083[_0x0f2c('0x30')]);return db['OpenchannelQueue'][_0x0f2c('0x31')](_0x42b0fd)[_0x0f2c('0x13')](handleEntityNotFound(_0x3410b0,null))[_0x0f2c('0x13')](respondWithResult(_0x3410b0,null))['catch'](handleError(_0x3410b0,null));};exports['create']=function(_0x185a28,_0x57a9a0){return db['OpenchannelQueue'][_0x0f2c('0x32')](_0x185a28['body'],{})[_0x0f2c('0x13')](function(_0x202877){var _0x59a51c=_0x185a28[_0x0f2c('0x33')]['get']({'plain':!![]});if(!_0x59a51c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59a51c[_0x0f2c('0x34')]===_0x0f2c('0x33')){var _0x1bd501=_0x202877['get']({'plain':!![]});var _0x30db98=_0x0f2c('0x16');return db['UserProfileSection'][_0x0f2c('0x31')]({'where':{'name':_0x30db98,'userProfileId':_0x59a51c[_0x0f2c('0x35')]},'raw':!![]})[_0x0f2c('0x13')](function(_0x21ddfb){if(_0x21ddfb&&_0x21ddfb['autoAssociation']===0x0){return db[_0x0f2c('0x36')][_0x0f2c('0x32')]({'name':_0x1bd501[_0x0f2c('0x19')],'resourceId':_0x1bd501['id'],'type':_0x21ddfb['name'],'sectionId':_0x21ddfb['id']},{})[_0x0f2c('0x13')](function(){return _0x202877;});}else{return _0x202877;}})[_0x0f2c('0x25')](function(_0x25ba16){logger[_0x0f2c('0x18')](_0x0f2c('0x37'),_0x25ba16);throw _0x25ba16;});}return _0x202877;})['then'](respondWithResult(_0x57a9a0,0xc9))['catch'](handleError(_0x57a9a0,null));};exports[_0x0f2c('0x12')]=function(_0x4c384f,_0x317049){if(_0x4c384f[_0x0f2c('0x38')]['id']){delete _0x4c384f[_0x0f2c('0x38')]['id'];}return db[_0x0f2c('0x20')][_0x0f2c('0x31')]({'where':{'id':_0x4c384f[_0x0f2c('0x27')]['id']}})['then'](handleEntityNotFound(_0x317049,null))[_0x0f2c('0x13')](saveUpdates(_0x4c384f[_0x0f2c('0x38')],null))[_0x0f2c('0x13')](respondWithResult(_0x317049,null))[_0x0f2c('0x25')](handleError(_0x317049,null));};exports['destroy']=function(_0x25278a,_0x2a7a5c){return db[_0x0f2c('0x20')][_0x0f2c('0x31')]({'where':{'id':_0x25278a[_0x0f2c('0x27')]['id']}})[_0x0f2c('0x13')](handleEntityNotFound(_0x2a7a5c,null))['then'](removeEntity(_0x2a7a5c,null))[_0x0f2c('0x25')](handleError(_0x2a7a5c,null));};exports[_0x0f2c('0x39')]=function(_0x211349,_0x1aa371){return db['OpenchannelQueue']['describe']()[_0x0f2c('0x13')](respondWithResult(_0x1aa371,null))['catch'](handleError(_0x1aa371,null));};exports[_0x0f2c('0x3a')]=function(_0x1e6b71,_0x3f1431){var _0xbf7223={'raw':!![],'where':{}},_0x23655d={},_0x2cb42a;return db[_0x0f2c('0x20')]['findOne']({'where':{'id':_0x1e6b71['params']['id']}})['then'](handleEntityNotFound(_0x3f1431,null))['then'](function(_0x192a8f){if(_0x192a8f){_0x2cb42a=_0x192a8f[_0x0f2c('0x15')]({'plain':!![]});_0x23655d[_0x0f2c('0x28')]=_[_0x0f2c('0x29')](db[_0x0f2c('0x3b')][_0x0f2c('0x1c')]);_0x23655d[_0x0f2c('0x22')]=_['keys'](_0x1e6b71['query']);_0x23655d[_0x0f2c('0x3c')]=_[_0x0f2c('0x2a')](_0x23655d[_0x0f2c('0x28')],_0x23655d[_0x0f2c('0x22')]);_0xbf7223['attributes']=_[_0x0f2c('0x2a')](_0x23655d['model'],qs[_0x0f2c('0x2c')](_0x1e6b71['query'][_0x0f2c('0x2c')]));_0xbf7223['attributes']=_0xbf7223[_0x0f2c('0x2b')][_0x0f2c('0x2d')]?_0xbf7223['attributes']:_0x23655d[_0x0f2c('0x28')];if(!_0x1e6b71['query'][_0x0f2c('0x3d')](_0x0f2c('0x3e'))){_0xbf7223[_0x0f2c('0xf')]=qs[_0x0f2c('0xf')](_0x1e6b71[_0x0f2c('0x22')][_0x0f2c('0xf')]);_0xbf7223['offset']=qs['offset'](_0x1e6b71['query']['offset']);}_0xbf7223[_0x0f2c('0x3f')]=qs['sort'](_0x1e6b71[_0x0f2c('0x22')][_0x0f2c('0x40')]);_0xbf7223['where']=qs[_0x0f2c('0x3c')](_['pick'](_0x1e6b71[_0x0f2c('0x22')],_0x23655d['filters']));_0xbf7223[_0x0f2c('0x41')][_0x0f2c('0x42')]=_0x192a8f['id'];if(_0x1e6b71['query'][_0x0f2c('0x43')]){_0xbf7223['where']=_[_0x0f2c('0x2f')](_0xbf7223[_0x0f2c('0x41')],{'$or':_[_0x0f2c('0x44')](_0xbf7223[_0x0f2c('0x2b')],function(_0xba205f){var _0x36080f={};_0x36080f[_0xba205f]={'$like':'%'+_0x1e6b71[_0x0f2c('0x22')][_0x0f2c('0x43')]+'%'};return _0x36080f;})});}_0xbf7223=_['merge']({},_0xbf7223,_0x1e6b71[_0x0f2c('0x30')]);return db['UserOpenchannelQueue'][_0x0f2c('0x23')](_0xbf7223);}})[_0x0f2c('0x13')](function(_0xb1858d){if(_0xb1858d){return db[_0x0f2c('0x45')][_0x0f2c('0x46')]({'where':{'id':_[_0x0f2c('0x44')](_0xb1858d,_0x0f2c('0x47')),'role':'agent'},'attributes':['id',_0x0f2c('0x19'),_0x0f2c('0x48'),_0x0f2c('0x49'),_0x0f2c('0x4a')]});}})[_0x0f2c('0x13')](function(_0x4e16e1){if(_0x4e16e1){return{'count':_0x4e16e1[_0x0f2c('0x10')],'rows':_[_0x0f2c('0x44')](_0x4e16e1['rows'],function(_0x577cb1){return{'membername':_0x577cb1[_0x0f2c('0x19')],'UserId':_0x577cb1['id'],'queue_name':_0x2cb42a[_0x0f2c('0x19')],'OpenchannelQueueId':_0x2cb42a['id'],'interface':util[_0x0f2c('0x4b')]('%s/%s',_0x0f2c('0x4c'),_0x577cb1[_0x0f2c('0x19')]),'penalty':0x0,'paused':_0x577cb1[_0x0f2c('0x48')],'createdAt':_0x577cb1[_0x0f2c('0x4a')],'updatedAt':_0x577cb1[_0x0f2c('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0f2c('0x13')](respondWithFilteredResult(_0x3f1431,_0xbf7223))[_0x0f2c('0x25')](handleError(_0x3f1431,null));};exports[_0x0f2c('0x4d')]=function(_0x5175ab,_0x2910d7){var _0x4d286a={};var _0x52408c={};var _0x4d1d96;var _0x500c25;return db['OpenchannelQueue'][_0x0f2c('0x4e')]({'where':{'id':_0x5175ab['params']['id']}})['then'](handleEntityNotFound(_0x2910d7,null))[_0x0f2c('0x13')](function(_0xb8ad0a){if(_0xb8ad0a){_0x4d1d96=_0xb8ad0a;_0x52408c['model']=_[_0x0f2c('0x29')](db[_0x0f2c('0x4f')][_0x0f2c('0x1c')]);_0x52408c['query']=_[_0x0f2c('0x29')](_0x5175ab[_0x0f2c('0x22')]);_0x52408c[_0x0f2c('0x3c')]=_[_0x0f2c('0x2a')](_0x52408c[_0x0f2c('0x28')],_0x52408c['query']);_0x4d286a['attributes']=_[_0x0f2c('0x2a')](_0x52408c[_0x0f2c('0x28')],qs['fields'](_0x5175ab['query']['fields']));_0x4d286a[_0x0f2c('0x2b')]=_0x4d286a[_0x0f2c('0x2b')]['length']?_0x4d286a[_0x0f2c('0x2b')]:_0x52408c[_0x0f2c('0x28')];_0x4d286a[_0x0f2c('0x3f')]=qs['sort'](_0x5175ab[_0x0f2c('0x22')][_0x0f2c('0x40')]);_0x4d286a[_0x0f2c('0x41')]=qs[_0x0f2c('0x3c')](_[_0x0f2c('0x50')](_0x5175ab[_0x0f2c('0x22')],_0x52408c[_0x0f2c('0x3c')]));if(_0x5175ab[_0x0f2c('0x22')][_0x0f2c('0x43')]){_0x4d286a[_0x0f2c('0x41')]=_[_0x0f2c('0x2f')](_0x4d286a['where'],{'$or':_[_0x0f2c('0x44')](_0x4d286a[_0x0f2c('0x2b')],function(_0x8b6e2){var _0x418ae8={};_0x418ae8[_0x8b6e2]={'$like':'%'+_0x5175ab[_0x0f2c('0x22')][_0x0f2c('0x43')]+'%'};return _0x418ae8;})});}_0x4d286a=_['merge']({},_0x4d286a,_0x5175ab[_0x0f2c('0x30')]);return _0x4d1d96[_0x0f2c('0x4d')](_0x4d286a);}})['then'](function(_0xc20a3c){if(_0xc20a3c){_0x500c25=_0xc20a3c['length'];if(!_0x5175ab[_0x0f2c('0x22')]['hasOwnProperty'](_0x0f2c('0x3e'))){_0x4d286a[_0x0f2c('0xf')]=qs['limit'](_0x5175ab[_0x0f2c('0x22')]['limit']);_0x4d286a[_0x0f2c('0xe')]=qs[_0x0f2c('0xe')](_0x5175ab[_0x0f2c('0x22')][_0x0f2c('0xe')]);}return _0x4d1d96[_0x0f2c('0x4d')](_0x4d286a);}})['then'](function(_0x35e07a){if(_0x35e07a){return _0x35e07a?{'count':_0x500c25,'rows':_0x35e07a}:null;}})[_0x0f2c('0x13')](respondWithResult(_0x2910d7,null))[_0x0f2c('0x25')](handleError(_0x2910d7,null));};exports[_0x0f2c('0x51')]=function(_0x593026,_0x4cdd12){var _0x5a5e3f=_0x593026[_0x0f2c('0x38')][_0x0f2c('0x52')];return db['Team'][_0x0f2c('0x23')]({'where':{'id':_0x5a5e3f},'attributes':['id'],'include':[{'model':db[_0x0f2c('0x45')],'as':'Agents','attributes':['id',_0x0f2c('0x19'),_0x0f2c('0x53'),_0x0f2c('0x54'),_0x0f2c('0x55')],'raw':!![]}]})[_0x0f2c('0x13')](function(_0x48a9ed){if(_0x48a9ed){var _0x48d640=_[_0x0f2c('0x56')](_0x48a9ed,function(_0x2a6868){var _0x1688c7=_0x2a6868[_0x0f2c('0x15')]({'plain':!![]});return _0x1688c7[_0x0f2c('0x57')];});return db[_0x0f2c('0x20')]['find']({'where':{'id':_0x593026['params']['id']}})['then'](function(_0x38cf96){return db[_0x0f2c('0x58')]['transaction'](function(_0x2f8ff5){return _0x38cf96[_0x0f2c('0x51')](_0x5a5e3f,{'transaction':_0x2f8ff5})[_0x0f2c('0x13')](function(){return BPromise[_0x0f2c('0x59')](_0x48d640,function(_0x49d9ff){return db['UserOpenchannelQueue'][_0x0f2c('0x5a')]({'where':{'UserId':_0x49d9ff['id'],'OpenchannelQueueId':_0x593026[_0x0f2c('0x27')]['id']},'transaction':_0x2f8ff5});});})[_0x0f2c('0x13')](function(){_0x48d640['forEach'](function(_0x1cabad){socket[_0x0f2c('0x5b')](_0x0f2c('0x5c'),{'UserId':_0x1cabad['id'],'OpenchannelQueueId':_0x38cf96['id']});});});});});}})[_0x0f2c('0x13')](respondWithStatusCode(_0x4cdd12,null))['catch'](handleError(_0x4cdd12,null));};exports[_0x0f2c('0x5d')]=function(_0x50faa2,_0xefc13a){return db['Team'][_0x0f2c('0x23')]({'where':{'id':_0x50faa2['query'][_0x0f2c('0x52')]},'attributes':['id'],'include':[{'model':db[_0x0f2c('0x45')],'as':_0x0f2c('0x57'),'attributes':['id'],'raw':!![]}]})[_0x0f2c('0x13')](handleEntityNotFound(_0xefc13a,null))['then'](function(_0x32c36c){var _0x348238=_[_0x0f2c('0x44')](_0x32c36c,'id');var _0x5bcab3=[];var _0x335144=[];var _0x25111f=squel[_0x0f2c('0x5e')]();_0x25111f['field'](_0x0f2c('0x5f'))[_0x0f2c('0x60')]('team_has_openchannel_queues','tq')[_0x0f2c('0x61')](_0x0f2c('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0f2c('0x41')](_0x0f2c('0x63'),_0x50faa2[_0x0f2c('0x27')]['id']);for(var _0x3869a2=0x0;_0x3869a2<_0x32c36c[_0x0f2c('0x2d')];_0x3869a2+=0x1){let _0x2190cd=_0x32c36c[_0x3869a2];for(var _0x522483=0x0;_0x522483<_0x2190cd[_0x0f2c('0x57')]['length'];_0x522483+=0x1){let _0x5709d4=_0x2190cd['Agents'][_0x522483];var _0x1c3f4b=_0x25111f['clone']();_0x1c3f4b['where'](_0x0f2c('0x64'),_0x5709d4['id']);_0x335144['push'](db[_0x0f2c('0x58')][_0x0f2c('0x22')](_0x1c3f4b[_0x0f2c('0x65')](),{'type':db[_0x0f2c('0x58')]['QueryTypes'][_0x0f2c('0x66')]})[_0x0f2c('0x13')](function(_0x1377c9){if(_0x1377c9[_0x0f2c('0x2d')]===0x1){return _0x5709d4['id'];}else{var _0x48b117=_[_0x0f2c('0x67')](_[_0x0f2c('0x44')](_0x1377c9,_0x0f2c('0x68')),function(_0x5eaca5){return _[_0x0f2c('0x69')](_0x348238,_0x5eaca5);});if(_0x48b117){return _0x5709d4['id'];}}}));}}return BPromise[_0x0f2c('0x6a')](_0x335144)[_0x0f2c('0x13')](function(_0x34ba92){_0x5bcab3=_(_0x5bcab3)['union'](_0x34ba92)[_0x0f2c('0x6b')]()[_0x0f2c('0x6c')]();return db[_0x0f2c('0x20')][_0x0f2c('0x31')]({'where':{'id':_0x50faa2[_0x0f2c('0x27')]['id']}})[_0x0f2c('0x13')](function(_0x338145){return db[_0x0f2c('0x58')]['transaction'](function(_0x845a52){return _0x338145[_0x0f2c('0x5d')](_0x50faa2[_0x0f2c('0x22')]['ids'],{'transaction':_0x845a52})['then'](function(){if(!_['isEmpty'](_0x5bcab3)){return _0x338145[_0x0f2c('0x6d')](_0x5bcab3,{'transaction':_0x845a52});}})[_0x0f2c('0x13')](function(){_0x5bcab3[_0x0f2c('0x6e')](function(_0x5d248a){socket[_0x0f2c('0x5b')](_0x0f2c('0x6f'),{'UserId':_0x5d248a,'OpenchannelQueueId':_0x338145['id']});});});});});});})[_0x0f2c('0x13')](respondWithStatusCode(_0xefc13a,null))[_0x0f2c('0x25')](handleError(_0xefc13a,null));};exports[_0x0f2c('0x70')]=function(_0x550f7c,_0x227892){return db[_0x0f2c('0x20')][_0x0f2c('0x31')]({'where':{'id':_0x550f7c[_0x0f2c('0x27')]['id']}})[_0x0f2c('0x13')](handleEntityNotFound(_0x227892,null))[_0x0f2c('0x13')](function(_0x204998){if(_0x204998){return _0x204998[_0x0f2c('0x70')](_0x550f7c[_0x0f2c('0x38')][_0x0f2c('0x52')],_[_0x0f2c('0x71')](_0x550f7c[_0x0f2c('0x38')],[_0x0f2c('0x52'),'id'])||{})[_0x0f2c('0x72')](function(_0xfb4db1){for(var _0xfe0f5e=0x0;_0xfe0f5e<_0x550f7c[_0x0f2c('0x38')][_0x0f2c('0x52')][_0x0f2c('0x2d')];_0xfe0f5e+=0x1){socket[_0x0f2c('0x5b')]('userOpenchannelQueue:save',{'UserId':Number(_0x550f7c[_0x0f2c('0x38')][_0x0f2c('0x52')][_0xfe0f5e]),'OpenchannelQueueId':Number(_0x550f7c['params']['id'])});}return _0xfb4db1;});}})[_0x0f2c('0x13')](respondWithResult(_0x227892,null))[_0x0f2c('0x25')](handleError(_0x227892,null));};exports['removeAgents']=function(_0x595c06,_0x1f211d){return db[_0x0f2c('0x20')]['find']({'where':{'id':_0x595c06['params']['id']}})['then'](handleEntityNotFound(_0x1f211d,null))[_0x0f2c('0x13')](function(_0x56134f){if(_0x56134f){return _0x56134f['removeAgents'](_0x595c06['query'][_0x0f2c('0x52')])[_0x0f2c('0x13')](function(){if(_[_0x0f2c('0x73')](_0x595c06['query'][_0x0f2c('0x52')])){for(var _0x5cc0f3=0x0;_0x5cc0f3<_0x595c06[_0x0f2c('0x22')]['ids'][_0x0f2c('0x2d')];_0x5cc0f3+=0x1){socket[_0x0f2c('0x5b')](_0x0f2c('0x6f'),{'UserId':Number(_0x595c06[_0x0f2c('0x22')]['ids'][_0x5cc0f3]),'OpenchannelQueueId':Number(_0x595c06[_0x0f2c('0x27')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x595c06[_0x0f2c('0x22')][_0x0f2c('0x52')]),'OpenchannelQueueId':Number(_0x595c06[_0x0f2c('0x27')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f211d,null))[_0x0f2c('0x25')](handleError(_0x1f211d,null));};exports[_0x0f2c('0x74')]=function(_0xcd993b,_0x2d20f7){var _0x2b5b63={};var _0x24d794={};var _0x4d4812;var _0x33aee7;return db[_0x0f2c('0x20')][_0x0f2c('0x4e')]({'where':{'id':_0xcd993b[_0x0f2c('0x27')]['id']}})['then'](handleEntityNotFound(_0x2d20f7,null))[_0x0f2c('0x13')](function(_0x360850){if(_0x360850){_0x4d4812=_0x360850;_0x24d794[_0x0f2c('0x28')]=_['keys'](db[_0x0f2c('0x45')][_0x0f2c('0x1c')]);_0x24d794[_0x0f2c('0x22')]=_[_0x0f2c('0x29')](_0xcd993b[_0x0f2c('0x22')]);_0x24d794['filters']=_['intersection'](_0x24d794[_0x0f2c('0x28')],_0x24d794['query']);_0x2b5b63[_0x0f2c('0x2b')]=_[_0x0f2c('0x2a')](_0x24d794[_0x0f2c('0x28')],qs[_0x0f2c('0x2c')](_0xcd993b[_0x0f2c('0x22')]['fields']));_0x2b5b63[_0x0f2c('0x2b')]=_0x2b5b63[_0x0f2c('0x2b')][_0x0f2c('0x2d')]?_0x2b5b63['attributes']:_0x24d794[_0x0f2c('0x28')];_0x2b5b63['order']=qs[_0x0f2c('0x40')](_0xcd993b[_0x0f2c('0x22')][_0x0f2c('0x40')]);_0x2b5b63[_0x0f2c('0x41')]=qs['filters'](_[_0x0f2c('0x50')](_0xcd993b[_0x0f2c('0x22')],_0x24d794['filters']));if(_0xcd993b['query'][_0x0f2c('0x43')]){_0x2b5b63[_0x0f2c('0x41')]=_[_0x0f2c('0x2f')](_0x2b5b63[_0x0f2c('0x41')],{'$or':_['map'](_0x2b5b63[_0x0f2c('0x2b')],function(_0x2c2da9){var _0x21abf4={};_0x21abf4[_0x2c2da9]={'$like':'%'+_0xcd993b[_0x0f2c('0x22')][_0x0f2c('0x43')]+'%'};return _0x21abf4;})});}_0x2b5b63=_[_0x0f2c('0x2f')]({},_0x2b5b63,_0xcd993b[_0x0f2c('0x30')]);return _0x4d4812['getAgents'](_0x2b5b63);}})['then'](function(_0x4cffbe){if(_0x4cffbe){_0x33aee7=_0x4cffbe[_0x0f2c('0x2d')];if(!_0xcd993b[_0x0f2c('0x22')][_0x0f2c('0x3d')]('nolimit')){_0x2b5b63[_0x0f2c('0xf')]=qs[_0x0f2c('0xf')](_0xcd993b['query'][_0x0f2c('0xf')]);_0x2b5b63[_0x0f2c('0xe')]=qs[_0x0f2c('0xe')](_0xcd993b['query'][_0x0f2c('0xe')]);}return _0x4d4812[_0x0f2c('0x74')](_0x2b5b63);}})[_0x0f2c('0x13')](function(_0x56c583){if(_0x56c583){return _0x56c583?{'count':_0x33aee7,'rows':_0x56c583}:null;}})[_0x0f2c('0x13')](respondWithResult(_0x2d20f7,null))[_0x0f2c('0x25')](handleError(_0x2d20f7,null));}; \ No newline at end of file +var _0x283c=['type','key','getOptions','where','findAll','rows','catch','show','params','keys','query','filters','intersection','model','attributes','fields','length','includeAll','include','options','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','limit','order','sort','pick','OpenchannelQueueId','merge','filter','findAndCountAll','map','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','User','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','emit','addAgents','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','hasOwnProperty','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','offset','undefined','count','status','set','Content-Range','json','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','stack','name','send','OpenchannelQueue','rawAttributes','fieldName'];(function(_0x4b78f6,_0x784ac2){var _0x365384=function(_0x3074b9){while(--_0x3074b9){_0x4b78f6['push'](_0x4b78f6['shift']());}};_0x365384(++_0x784ac2);}(_0x283c,0x161));var _0xc283=function(_0x2519ee,_0x45670c){_0x2519ee=_0x2519ee-0x0;var _0xb62350=_0x283c[_0x2519ee];return _0xb62350;};'use strict';var BPromise=require(_0xc283('0x0'));var util=require(_0xc283('0x1'));var _=require(_0xc283('0x2'));var squel=require('squel');var Redis=require(_0xc283('0x3'));var qs=require(_0xc283('0x4'));var logger=require('../../config/logger')('api');var config=require(_0xc283('0x5'));var db=require(_0xc283('0x6'))['db'];config[_0xc283('0x7')]=_[_0xc283('0x8')](config[_0xc283('0x7')],{'host':_0xc283('0x9'),'port':0x18eb});var socket=require(_0xc283('0xa'))(new Redis(config[_0xc283('0x7')]));require(_0xc283('0xb'))['register'](socket);function respondWithStatusCode(_0x503c85,_0x315a60){_0x315a60=_0x315a60||0xcc;return function(_0x4fb656){if(_0x4fb656){return _0x503c85[_0xc283('0xc')](_0x315a60);}return _0x503c85['status'](_0x315a60)['end']();};}function respondWithResult(_0x2698f7,_0x484cc8){_0x484cc8=_0x484cc8||0xc8;return function(_0x2470a9){if(_0x2470a9){return _0x2698f7['status'](_0x484cc8)['json'](_0x2470a9);}};}function respondWithFilteredResult(_0x5780bd,_0x1f5dbb){return function(_0x50db57){if(_0x50db57){var _0x50946a=typeof _0x1f5dbb[_0xc283('0xd')]==='undefined'&&typeof _0x1f5dbb['limit']===_0xc283('0xe');var _0x118b98=_0x50db57[_0xc283('0xf')];var _0x54e551=_0x50946a?0x0:_0x1f5dbb[_0xc283('0xd')];var _0x58520e=_0x50946a?_0x50db57[_0xc283('0xf')]:_0x1f5dbb[_0xc283('0xd')]+_0x1f5dbb['limit'];var _0x251dac;if(_0x58520e>=_0x118b98){_0x58520e=_0x118b98;_0x251dac=0xc8;}else{_0x251dac=0xce;}_0x5780bd[_0xc283('0x10')](_0x251dac);return _0x5780bd[_0xc283('0x11')](_0xc283('0x12'),_0x54e551+'-'+_0x58520e+'/'+_0x118b98)[_0xc283('0x13')](_0x50db57);}return null;};}function saveUpdates(_0x3e5722){return function(_0x262b2a){if(_0x262b2a){return _0x262b2a[_0xc283('0x14')](_0x3e5722)[_0xc283('0x15')](function(_0x2a5b59){return _0x2a5b59;});}return null;};}function removeEntity(_0x46ffe9){return function(_0x3c54b5){if(_0x3c54b5){return _0x3c54b5[_0xc283('0x16')]()[_0xc283('0x15')](function(){var _0x1f5c57=_0x3c54b5[_0xc283('0x17')]({'plain':!![]});var _0x10bf68=_0xc283('0x18');return db[_0xc283('0x19')][_0xc283('0x16')]({'where':{'type':_0x10bf68,'resourceId':_0x1f5c57['id']}})['then'](function(){return _0x3c54b5;});})['then'](function(){_0x46ffe9['status'](0xcc)[_0xc283('0x1a')]();});}};}function handleEntityNotFound(_0xcf925d){return function(_0x5cee90){if(!_0x5cee90){_0xcf925d[_0xc283('0xc')](0x194);}return _0x5cee90;};}function handleError(_0x2356ec,_0xfff70f){_0xfff70f=_0xfff70f||0x1f4;return function(_0x35e074){logger[_0xc283('0x1b')](_0x35e074[_0xc283('0x1c')]);if(_0x35e074[_0xc283('0x1d')]){delete _0x35e074['name'];}_0x2356ec[_0xc283('0x10')](_0xfff70f)[_0xc283('0x1e')](_0x35e074);};}exports['index']=function(_0x4d7047,_0x2ce8b7){var _0x3e82cd={};var _0x4fe1bb={'count':0x0,'rows':[]};var _0x1a4b9c=_['map'](db[_0xc283('0x1f')][_0xc283('0x20')],function(_0x50070f){return{'name':_0x50070f[_0xc283('0x21')],'type':_0x50070f[_0xc283('0x22')][_0xc283('0x23')]};});_0x3e82cd=qs[_0xc283('0x24')](_0x1a4b9c,_0x4d7047);var _0x59cb5c={'where':_0x3e82cd[_0xc283('0x25')]};return db['OpenchannelQueue'][_0xc283('0xf')](_0x59cb5c)['then'](function(_0x479aa6){_0x4fe1bb[_0xc283('0xf')]=_0x479aa6;_0x3e82cd['include']=qs['include'](_0x4d7047['query']);return db[_0xc283('0x1f')][_0xc283('0x26')](_0x3e82cd);})[_0xc283('0x15')](function(_0x247267){_0x4fe1bb[_0xc283('0x27')]=_0x247267;return _0x4fe1bb;})[_0xc283('0x15')](respondWithFilteredResult(_0x2ce8b7,_0x3e82cd))[_0xc283('0x28')](handleError(_0x2ce8b7,null));};exports[_0xc283('0x29')]=function(_0x5a8df1,_0xfc86e5){var _0x2c2fca={'raw':!![],'where':{'id':_0x5a8df1[_0xc283('0x2a')]['id']}},_0xd2bdd9={};_0xd2bdd9['model']=_[_0xc283('0x2b')](db['OpenchannelQueue'][_0xc283('0x20')]);_0xd2bdd9['query']=_[_0xc283('0x2b')](_0x5a8df1[_0xc283('0x2c')]);_0xd2bdd9[_0xc283('0x2d')]=_[_0xc283('0x2e')](_0xd2bdd9[_0xc283('0x2f')],_0xd2bdd9[_0xc283('0x2c')]);_0x2c2fca[_0xc283('0x30')]=_[_0xc283('0x2e')](_0xd2bdd9[_0xc283('0x2f')],qs[_0xc283('0x31')](_0x5a8df1[_0xc283('0x2c')]['fields']));_0x2c2fca[_0xc283('0x30')]=_0x2c2fca[_0xc283('0x30')][_0xc283('0x32')]?_0x2c2fca[_0xc283('0x30')]:_0xd2bdd9[_0xc283('0x2f')];if(_0x5a8df1[_0xc283('0x2c')][_0xc283('0x33')]){_0x2c2fca[_0xc283('0x34')]=[{'all':!![]}];}_0x2c2fca=_['merge']({},_0x2c2fca,_0x5a8df1[_0xc283('0x35')]);return db[_0xc283('0x1f')]['find'](_0x2c2fca)[_0xc283('0x15')](handleEntityNotFound(_0xfc86e5,null))['then'](respondWithResult(_0xfc86e5,null))['catch'](handleError(_0xfc86e5,null));};exports[_0xc283('0x36')]=function(_0x27c255,_0x1fdaab){return db[_0xc283('0x1f')]['create'](_0x27c255[_0xc283('0x37')],{})['then'](function(_0xff3aaf){var _0x352a21=_0x27c255[_0xc283('0x38')][_0xc283('0x17')]({'plain':!![]});if(!_0x352a21)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x352a21[_0xc283('0x39')]===_0xc283('0x38')){var _0x55c7b8=_0xff3aaf[_0xc283('0x17')]({'plain':!![]});var _0x545a7c=_0xc283('0x18');return db['UserProfileSection'][_0xc283('0x3a')]({'where':{'name':_0x545a7c,'userProfileId':_0x352a21[_0xc283('0x3b')]},'raw':!![]})[_0xc283('0x15')](function(_0x3caafb){if(_0x3caafb&&_0x3caafb[_0xc283('0x3c')]===0x0){return db[_0xc283('0x19')][_0xc283('0x36')]({'name':_0x55c7b8['name'],'resourceId':_0x55c7b8['id'],'type':_0x3caafb[_0xc283('0x1d')],'sectionId':_0x3caafb['id']},{})[_0xc283('0x15')](function(){return _0xff3aaf;});}else{return _0xff3aaf;}})[_0xc283('0x28')](function(_0xa05c74){logger[_0xc283('0x1b')](_0xc283('0x3d'),_0xa05c74);throw _0xa05c74;});}return _0xff3aaf;})[_0xc283('0x15')](respondWithResult(_0x1fdaab,0xc9))['catch'](handleError(_0x1fdaab,null));};exports[_0xc283('0x14')]=function(_0xfcc29,_0x2eeeba){if(_0xfcc29['body']['id']){delete _0xfcc29[_0xc283('0x37')]['id'];}return db[_0xc283('0x1f')][_0xc283('0x3a')]({'where':{'id':_0xfcc29[_0xc283('0x2a')]['id']}})[_0xc283('0x15')](handleEntityNotFound(_0x2eeeba,null))[_0xc283('0x15')](saveUpdates(_0xfcc29[_0xc283('0x37')],null))['then'](respondWithResult(_0x2eeeba,null))[_0xc283('0x28')](handleError(_0x2eeeba,null));};exports['destroy']=function(_0x3a3a44,_0x3f6d12){return db[_0xc283('0x1f')][_0xc283('0x3a')]({'where':{'id':_0x3a3a44[_0xc283('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3f6d12,null))[_0xc283('0x15')](removeEntity(_0x3f6d12,null))['catch'](handleError(_0x3f6d12,null));};exports[_0xc283('0x3e')]=function(_0x4eb74f,_0x1ab398){return db[_0xc283('0x1f')]['describe']()[_0xc283('0x15')](respondWithResult(_0x1ab398,null))[_0xc283('0x28')](handleError(_0x1ab398,null));};exports[_0xc283('0x3f')]=function(_0x53f589,_0x3ad377){var _0x2c9028={'raw':!![],'where':{}},_0x3b1c3a={},_0x5d7e8a;return db[_0xc283('0x1f')][_0xc283('0x40')]({'where':{'id':_0x53f589[_0xc283('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3ad377,null))[_0xc283('0x15')](function(_0x92264f){if(_0x92264f){_0x5d7e8a=_0x92264f[_0xc283('0x17')]({'plain':!![]});_0x3b1c3a[_0xc283('0x2f')]=_['keys'](db[_0xc283('0x41')][_0xc283('0x20')]);_0x3b1c3a['query']=_[_0xc283('0x2b')](_0x53f589[_0xc283('0x2c')]);_0x3b1c3a[_0xc283('0x2d')]=_['intersection'](_0x3b1c3a['model'],_0x3b1c3a[_0xc283('0x2c')]);_0x2c9028['attributes']=_['intersection'](_0x3b1c3a[_0xc283('0x2f')],qs[_0xc283('0x31')](_0x53f589[_0xc283('0x2c')][_0xc283('0x31')]));_0x2c9028['attributes']=_0x2c9028[_0xc283('0x30')][_0xc283('0x32')]?_0x2c9028[_0xc283('0x30')]:_0x3b1c3a[_0xc283('0x2f')];if(!_0x53f589[_0xc283('0x2c')]['hasOwnProperty'](_0xc283('0x42'))){_0x2c9028[_0xc283('0x43')]=qs[_0xc283('0x43')](_0x53f589[_0xc283('0x2c')]['limit']);_0x2c9028['offset']=qs[_0xc283('0xd')](_0x53f589[_0xc283('0x2c')][_0xc283('0xd')]);}_0x2c9028[_0xc283('0x44')]=qs[_0xc283('0x45')](_0x53f589[_0xc283('0x2c')][_0xc283('0x45')]);_0x2c9028[_0xc283('0x25')]=qs[_0xc283('0x2d')](_[_0xc283('0x46')](_0x53f589[_0xc283('0x2c')],_0x3b1c3a[_0xc283('0x2d')]));_0x2c9028['where'][_0xc283('0x47')]=_0x92264f['id'];if(_0x53f589['query']['filter']){_0x2c9028[_0xc283('0x25')]=_[_0xc283('0x48')](_0x2c9028[_0xc283('0x25')],{'$or':_['map'](_0x2c9028[_0xc283('0x30')],function(_0x5e1de7){var _0x5ecc38={};_0x5ecc38[_0x5e1de7]={'$like':'%'+_0x53f589[_0xc283('0x2c')][_0xc283('0x49')]+'%'};return _0x5ecc38;})});}_0x2c9028=_[_0xc283('0x48')]({},_0x2c9028,_0x53f589[_0xc283('0x35')]);return db[_0xc283('0x41')][_0xc283('0x26')](_0x2c9028);}})['then'](function(_0x11274a){if(_0x11274a){return db['User'][_0xc283('0x4a')]({'where':{'id':_[_0xc283('0x4b')](_0x11274a,_0xc283('0x4c')),'role':_0xc283('0x4d')},'attributes':['id',_0xc283('0x1d'),_0xc283('0x4e'),'updatedAt',_0xc283('0x4f')]});}})[_0xc283('0x15')](function(_0xaeb36b){if(_0xaeb36b){return{'count':_0xaeb36b[_0xc283('0xf')],'rows':_[_0xc283('0x4b')](_0xaeb36b[_0xc283('0x27')],function(_0x1570a0){return{'membername':_0x1570a0['name'],'UserId':_0x1570a0['id'],'queue_name':_0x5d7e8a[_0xc283('0x1d')],'OpenchannelQueueId':_0x5d7e8a['id'],'interface':util[_0xc283('0x50')](_0xc283('0x51'),_0xc283('0x52'),_0x1570a0[_0xc283('0x1d')]),'penalty':0x0,'paused':_0x1570a0['openchannelPause'],'createdAt':_0x1570a0['createdAt'],'updatedAt':_0x1570a0[_0xc283('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3ad377,_0x2c9028))[_0xc283('0x28')](handleError(_0x3ad377,null));};exports[_0xc283('0x54')]=function(_0x56755e,_0x498d85){var _0x3b4135={};var _0x23f5ce={};var _0x49f446;var _0x577448;return db[_0xc283('0x1f')][_0xc283('0x40')]({'where':{'id':_0x56755e[_0xc283('0x2a')]['id']}})['then'](handleEntityNotFound(_0x498d85,null))[_0xc283('0x15')](function(_0x59ef81){if(_0x59ef81){_0x49f446=_0x59ef81;_0x23f5ce[_0xc283('0x2f')]=_[_0xc283('0x2b')](db[_0xc283('0x55')][_0xc283('0x20')]);_0x23f5ce[_0xc283('0x2c')]=_['keys'](_0x56755e[_0xc283('0x2c')]);_0x23f5ce[_0xc283('0x2d')]=_['intersection'](_0x23f5ce[_0xc283('0x2f')],_0x23f5ce[_0xc283('0x2c')]);_0x3b4135[_0xc283('0x30')]=_[_0xc283('0x2e')](_0x23f5ce[_0xc283('0x2f')],qs[_0xc283('0x31')](_0x56755e[_0xc283('0x2c')][_0xc283('0x31')]));_0x3b4135['attributes']=_0x3b4135[_0xc283('0x30')]['length']?_0x3b4135[_0xc283('0x30')]:_0x23f5ce['model'];_0x3b4135[_0xc283('0x44')]=qs['sort'](_0x56755e['query'][_0xc283('0x45')]);_0x3b4135[_0xc283('0x25')]=qs[_0xc283('0x2d')](_[_0xc283('0x46')](_0x56755e['query'],_0x23f5ce['filters']));if(_0x56755e['query']['filter']){_0x3b4135[_0xc283('0x25')]=_[_0xc283('0x48')](_0x3b4135[_0xc283('0x25')],{'$or':_['map'](_0x3b4135[_0xc283('0x30')],function(_0x363034){var _0x534892={};_0x534892[_0x363034]={'$like':'%'+_0x56755e[_0xc283('0x2c')]['filter']+'%'};return _0x534892;})});}_0x3b4135=_['merge']({},_0x3b4135,_0x56755e['options']);return _0x49f446[_0xc283('0x54')](_0x3b4135);}})['then'](function(_0x1b9d08){if(_0x1b9d08){_0x577448=_0x1b9d08[_0xc283('0x32')];if(!_0x56755e[_0xc283('0x2c')]['hasOwnProperty'](_0xc283('0x42'))){_0x3b4135[_0xc283('0x43')]=qs[_0xc283('0x43')](_0x56755e[_0xc283('0x2c')][_0xc283('0x43')]);_0x3b4135[_0xc283('0xd')]=qs['offset'](_0x56755e[_0xc283('0x2c')][_0xc283('0xd')]);}return _0x49f446['getTeams'](_0x3b4135);}})[_0xc283('0x15')](function(_0xd463af){if(_0xd463af){return _0xd463af?{'count':_0x577448,'rows':_0xd463af}:null;}})[_0xc283('0x15')](respondWithResult(_0x498d85,null))[_0xc283('0x28')](handleError(_0x498d85,null));};exports[_0xc283('0x56')]=function(_0x5b75ff,_0x48c282){var _0x3b30d4=_0x5b75ff[_0xc283('0x37')][_0xc283('0x57')];return db[_0xc283('0x55')][_0xc283('0x26')]({'where':{'id':_0x3b30d4},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc283('0x58'),'attributes':['id',_0xc283('0x1d'),_0xc283('0x59'),_0xc283('0x5a'),_0xc283('0x5b')],'raw':!![]}]})['then'](function(_0x4f7b50){if(_0x4f7b50){var _0x5cef4f=_[_0xc283('0x5c')](_0x4f7b50,function(_0x421a36){var _0x5e166a=_0x421a36[_0xc283('0x17')]({'plain':!![]});return _0x5e166a[_0xc283('0x58')];});return db[_0xc283('0x1f')]['find']({'where':{'id':_0x5b75ff[_0xc283('0x2a')]['id']}})[_0xc283('0x15')](function(_0x245095){return db[_0xc283('0x5d')][_0xc283('0x5e')](function(_0xef6147){return _0x245095[_0xc283('0x56')](_0x3b30d4,{'transaction':_0xef6147})['then'](function(){return BPromise[_0xc283('0x5f')](_0x5cef4f,function(_0x5cba16){return db['UserOpenchannelQueue'][_0xc283('0x60')]({'where':{'UserId':_0x5cba16['id'],'OpenchannelQueueId':_0x5b75ff['params']['id']},'transaction':_0xef6147});});})['then'](function(){_0x5cef4f[_0xc283('0x61')](function(_0x535b7a){socket['emit'](_0xc283('0x62'),{'UserId':_0x535b7a['id'],'OpenchannelQueueId':_0x245095['id']});});});});});}})[_0xc283('0x15')](respondWithStatusCode(_0x48c282,null))[_0xc283('0x28')](handleError(_0x48c282,null));};exports['removeTeams']=function(_0x25e588,_0x499153){return db[_0xc283('0x55')][_0xc283('0x26')]({'where':{'id':_0x25e588[_0xc283('0x2c')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc283('0x63')],'as':_0xc283('0x58'),'attributes':['id'],'raw':!![]}]})[_0xc283('0x15')](handleEntityNotFound(_0x499153,null))[_0xc283('0x15')](function(_0x1925b0){var _0x3e3d64=_[_0xc283('0x4b')](_0x1925b0,'id');var _0x575b26=[];var _0x25104c=[];var _0x2d5c03=squel['select']();_0x2d5c03[_0xc283('0x64')](_0xc283('0x65'))[_0xc283('0x66')](_0xc283('0x67'),'tq')[_0xc283('0x68')](_0xc283('0x69'),'ut',_0xc283('0x6a'))[_0xc283('0x25')](_0xc283('0x6b'),_0x25e588[_0xc283('0x2a')]['id']);for(var _0x7c135e=0x0;_0x7c135e<_0x1925b0[_0xc283('0x32')];_0x7c135e+=0x1){let _0x4c0f15=_0x1925b0[_0x7c135e];for(var _0x1fac0e=0x0;_0x1fac0e<_0x4c0f15[_0xc283('0x58')][_0xc283('0x32')];_0x1fac0e+=0x1){let _0x492be7=_0x4c0f15[_0xc283('0x58')][_0x1fac0e];var _0x8a3da0=_0x2d5c03[_0xc283('0x6c')]();_0x8a3da0[_0xc283('0x25')](_0xc283('0x6d'),_0x492be7['id']);_0x25104c[_0xc283('0x6e')](db[_0xc283('0x5d')][_0xc283('0x2c')](_0x8a3da0[_0xc283('0x6f')](),{'type':db[_0xc283('0x5d')][_0xc283('0x70')][_0xc283('0x71')]})[_0xc283('0x15')](function(_0x13dcee){if(_0x13dcee[_0xc283('0x32')]===0x1){return _0x492be7['id'];}else{var _0x57a45b=_[_0xc283('0x72')](_[_0xc283('0x4b')](_0x13dcee,_0xc283('0x73')),function(_0x3772b2){return _[_0xc283('0x74')](_0x3e3d64,_0x3772b2);});if(_0x57a45b){return _0x492be7['id'];}}}));}}return BPromise[_0xc283('0x75')](_0x25104c)['then'](function(_0x2517fe){_0x575b26=_(_0x575b26)[_0xc283('0x76')](_0x2517fe)[_0xc283('0x77')]()[_0xc283('0x78')]();return db[_0xc283('0x1f')][_0xc283('0x3a')]({'where':{'id':_0x25e588['params']['id']}})[_0xc283('0x15')](function(_0x38c785){return db[_0xc283('0x5d')][_0xc283('0x5e')](function(_0x3c1a66){return _0x38c785['removeTeams'](_0x25e588[_0xc283('0x2c')][_0xc283('0x57')],{'transaction':_0x3c1a66})[_0xc283('0x15')](function(){if(!_['isEmpty'](_0x575b26)){return _0x38c785['removeAgents'](_0x575b26,{'transaction':_0x3c1a66});}})['then'](function(){_0x575b26[_0xc283('0x61')](function(_0x3e1bab){socket[_0xc283('0x79')]('userOpenchannelQueue:remove',{'UserId':_0x3e1bab,'OpenchannelQueueId':_0x38c785['id']});});});});});});})[_0xc283('0x15')](respondWithStatusCode(_0x499153,null))['catch'](handleError(_0x499153,null));};exports[_0xc283('0x7a')]=function(_0x1b0cca,_0x37fed4){return db[_0xc283('0x1f')]['find']({'where':{'id':_0x1b0cca[_0xc283('0x2a')]['id']}})[_0xc283('0x15')](handleEntityNotFound(_0x37fed4,null))[_0xc283('0x15')](function(_0x599c4d){if(_0x599c4d){return _0x599c4d[_0xc283('0x7a')](_0x1b0cca[_0xc283('0x37')][_0xc283('0x57')],_['omit'](_0x1b0cca[_0xc283('0x37')],[_0xc283('0x57'),'id'])||{})[_0xc283('0x7b')](function(_0x11dbe9){for(var _0x363ce7=0x0;_0x363ce7<_0x1b0cca[_0xc283('0x37')][_0xc283('0x57')][_0xc283('0x32')];_0x363ce7+=0x1){socket[_0xc283('0x79')](_0xc283('0x62'),{'UserId':Number(_0x1b0cca[_0xc283('0x37')][_0xc283('0x57')][_0x363ce7]),'OpenchannelQueueId':Number(_0x1b0cca[_0xc283('0x2a')]['id'])});}return _0x11dbe9;});}})[_0xc283('0x15')](respondWithResult(_0x37fed4,null))[_0xc283('0x28')](handleError(_0x37fed4,null));};exports[_0xc283('0x7c')]=function(_0x435ad5,_0x4056e4){return db[_0xc283('0x1f')]['find']({'where':{'id':_0x435ad5[_0xc283('0x2a')]['id']}})[_0xc283('0x15')](handleEntityNotFound(_0x4056e4,null))['then'](function(_0x160191){if(_0x160191){return _0x160191[_0xc283('0x7c')](_0x435ad5['query'][_0xc283('0x57')])[_0xc283('0x15')](function(){if(_[_0xc283('0x7d')](_0x435ad5[_0xc283('0x2c')]['ids'])){for(var _0x4f9af8=0x0;_0x4f9af8<_0x435ad5['query']['ids'][_0xc283('0x32')];_0x4f9af8+=0x1){socket['emit'](_0xc283('0x7e'),{'UserId':Number(_0x435ad5['query'][_0xc283('0x57')][_0x4f9af8]),'OpenchannelQueueId':Number(_0x435ad5[_0xc283('0x2a')]['id'])});}}else{socket[_0xc283('0x79')](_0xc283('0x7e'),{'UserId':Number(_0x435ad5[_0xc283('0x2c')][_0xc283('0x57')]),'OpenchannelQueueId':Number(_0x435ad5[_0xc283('0x2a')]['id'])});}});}})[_0xc283('0x15')](respondWithStatusCode(_0x4056e4,null))[_0xc283('0x28')](handleError(_0x4056e4,null));};exports[_0xc283('0x7f')]=function(_0x216ff5,_0x2cff67){var _0x26bd68={};var _0x409379={};var _0xd816ec;var _0x3014a7;return db[_0xc283('0x1f')][_0xc283('0x40')]({'where':{'id':_0x216ff5[_0xc283('0x2a')]['id']}})[_0xc283('0x15')](handleEntityNotFound(_0x2cff67,null))['then'](function(_0x35ff1a){if(_0x35ff1a){_0xd816ec=_0x35ff1a;_0x409379['model']=_[_0xc283('0x2b')](db[_0xc283('0x63')][_0xc283('0x20')]);_0x409379[_0xc283('0x2c')]=_[_0xc283('0x2b')](_0x216ff5['query']);_0x409379[_0xc283('0x2d')]=_['intersection'](_0x409379['model'],_0x409379[_0xc283('0x2c')]);_0x26bd68[_0xc283('0x30')]=_['intersection'](_0x409379[_0xc283('0x2f')],qs[_0xc283('0x31')](_0x216ff5[_0xc283('0x2c')][_0xc283('0x31')]));_0x26bd68['attributes']=_0x26bd68[_0xc283('0x30')]['length']?_0x26bd68['attributes']:_0x409379[_0xc283('0x2f')];_0x26bd68[_0xc283('0x44')]=qs[_0xc283('0x45')](_0x216ff5['query']['sort']);_0x26bd68[_0xc283('0x25')]=qs[_0xc283('0x2d')](_[_0xc283('0x46')](_0x216ff5[_0xc283('0x2c')],_0x409379[_0xc283('0x2d')]));if(_0x216ff5[_0xc283('0x2c')][_0xc283('0x49')]){_0x26bd68[_0xc283('0x25')]=_[_0xc283('0x48')](_0x26bd68[_0xc283('0x25')],{'$or':_[_0xc283('0x4b')](_0x26bd68[_0xc283('0x30')],function(_0x4b6480){var _0x7bd1b0={};_0x7bd1b0[_0x4b6480]={'$like':'%'+_0x216ff5[_0xc283('0x2c')]['filter']+'%'};return _0x7bd1b0;})});}_0x26bd68=_['merge']({},_0x26bd68,_0x216ff5['options']);return _0xd816ec[_0xc283('0x7f')](_0x26bd68);}})[_0xc283('0x15')](function(_0xf22343){if(_0xf22343){_0x3014a7=_0xf22343[_0xc283('0x32')];if(!_0x216ff5['query'][_0xc283('0x80')](_0xc283('0x42'))){_0x26bd68[_0xc283('0x43')]=qs['limit'](_0x216ff5['query'][_0xc283('0x43')]);_0x26bd68[_0xc283('0xd')]=qs[_0xc283('0xd')](_0x216ff5['query'][_0xc283('0xd')]);}return _0xd816ec[_0xc283('0x7f')](_0x26bd68);}})[_0xc283('0x15')](function(_0x53bc07){if(_0x53bc07){return _0x53bc07?{'count':_0x3014a7,'rows':_0x53bc07}:null;}})[_0xc283('0x15')](respondWithResult(_0x2cff67,null))[_0xc283('0x28')](handleError(_0x2cff67,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8ed38c0..64023a3 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 _0x2d12=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x3959bc,_0x368811){var _0x6027e1=function(_0xdc9062){while(--_0xdc9062){_0x3959bc['push'](_0x3959bc['shift']());}};_0x6027e1(++_0x368811);}(_0x2d12,0x156));var _0x22d1=function(_0x5310d6,_0x3d8813){_0x5310d6=_0x5310d6-0x0;var _0x41cf06=_0x2d12[_0x5310d6];return _0x41cf06;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x22d1('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x22d1('0x1')](0x0);var events={'afterCreate':_0x22d1('0x2'),'afterUpdate':'update','afterDestroy':_0x22d1('0x3')};function emitEvent(_0x21c783){return function(_0x55a09b,_0x181cec,_0x52838f){OpenchannelQueueEvents[_0x22d1('0x4')](_0x21c783+':'+_0x55a09b['id'],_0x55a09b);OpenchannelQueueEvents[_0x22d1('0x4')](_0x21c783,_0x55a09b);_0x52838f(null);};}for(var e in events){if(events[_0x22d1('0x5')](e)){var event=events[e];OpenchannelQueue[_0x22d1('0x6')](e,emitEvent(event));}}module[_0x22d1('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x669e=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x28f689,_0xc1004c){var _0x1a4500=function(_0x1d37f7){while(--_0x1d37f7){_0x28f689['push'](_0x28f689['shift']());}};_0x1a4500(++_0xc1004c);}(_0x669e,0x1cc));var _0xe669=function(_0x20f84d,_0x3ed845){_0x20f84d=_0x20f84d-0x0;var _0x15822a=_0x669e[_0x20f84d];return _0x15822a;};'use strict';var EventEmitter=require(_0xe669('0x0'));var OpenchannelQueue=require(_0xe669('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe669('0x2')](0x0);var events={'afterCreate':_0xe669('0x3'),'afterUpdate':_0xe669('0x4'),'afterDestroy':_0xe669('0x5')};function emitEvent(_0x452d48){return function(_0x42482d,_0x2e0f76,_0x58e6ed){OpenchannelQueueEvents['emit'](_0x452d48+':'+_0x42482d['id'],_0x42482d);OpenchannelQueueEvents[_0xe669('0x6')](_0x452d48,_0x42482d);_0x58e6ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xe669('0x7')](e,emitEvent(event));}}module[_0xe669('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f75d47d..b50a1ca 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 _0xb8bb=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','moment'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0xb8bb,0x1ad));var _0xbb8b=function(_0x200341,_0x3b5b5b){_0x200341=_0x200341-0x0;var _0x453bd4=_0xb8bb[_0x200341];return _0x453bd4;};'use strict';var _=require(_0xbb8b('0x0'));var util=require(_0xbb8b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbb8b('0x2'));var BPromise=require(_0xbb8b('0x3'));var rp=require(_0xbb8b('0x4'));var fs=require('fs');var path=require(_0xbb8b('0x5'));var rimraf=require(_0xbb8b('0x6'));var config=require(_0xbb8b('0x7'));var attributes=require(_0xbb8b('0x8'));module[_0xbb8b('0x9')]=function(_0x279cca,_0x369bb4){return _0x279cca[_0xbb8b('0xa')](_0xbb8b('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60b6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','lodash'];(function(_0x19e810,_0x1241b5){var _0x26798e=function(_0x3965e7){while(--_0x3965e7){_0x19e810['push'](_0x19e810['shift']());}};_0x26798e(++_0x1241b5);}(_0x60b6,0x175));var _0x660b=function(_0x527031,_0x1fe194){_0x527031=_0x527031-0x0;var _0x59f307=_0x60b6[_0x527031];return _0x59f307;};'use strict';var _=require(_0x660b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x660b('0x1'));var moment=require(_0x660b('0x2'));var BPromise=require(_0x660b('0x3'));var rp=require(_0x660b('0x4'));var fs=require('fs');var path=require(_0x660b('0x5'));var rimraf=require(_0x660b('0x6'));var config=require(_0x660b('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x660b('0x8')]=function(_0x3cb9fd,_0x341aa3){return _0x3cb9fd[_0x660b('0x9')](_0x660b('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index b19ec8f..7b4ddbd 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 _0x3922=['info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','include','map','model','attributes','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then'];(function(_0x566dd5,_0x491250){var _0x184612=function(_0xe8a501){while(--_0xe8a501){_0x566dd5['push'](_0x566dd5['shift']());}};_0x184612(++_0x491250);}(_0x3922,0x15e));var _0x2392=function(_0xdea652,_0x3d74b4){_0xdea652=_0xdea652-0x0;var _0x1335ae=_0x3922[_0xdea652];return _0x1335ae;};'use strict';var _=require(_0x2392('0x0'));var util=require(_0x2392('0x1'));var moment=require(_0x2392('0x2'));var BPromise=require(_0x2392('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2392('0x4'))['db'];var utils=require(_0x2392('0x5'));var logger=require(_0x2392('0x6'))(_0x2392('0x7'));var config=require(_0x2392('0x8'));var jayson=require(_0x2392('0x9'));var client=jayson[_0x2392('0xa')][_0x2392('0xb')]({'port':0x232a});config[_0x2392('0xc')]=_['defaults'](config[_0x2392('0xc')],{'host':_0x2392('0xd'),'port':0x18eb});var socket=require(_0x2392('0xe'))(new Redis(config[_0x2392('0xc')]));require(_0x2392('0xf'))[_0x2392('0x10')](socket);function respondWithRpcPromise(_0xb2364,_0x4fafff,_0x20ac91){return new BPromise(function(_0x303ac4,_0x23dd2c){return client[_0x2392('0x11')](_0xb2364,_0x20ac91)[_0x2392('0x12')](function(_0x19e301){logger[_0x2392('0x13')](_0x2392('0x14'),_0x4fafff,'request\x20sent');logger[_0x2392('0x15')](_0x2392('0x16'),_0x4fafff,_0x2392('0x17'),JSON[_0x2392('0x18')](_0x19e301));if(_0x19e301[_0x2392('0x19')]){if(_0x19e301[_0x2392('0x19')]['code']===0x1f4){logger[_0x2392('0x19')](_0x2392('0x14'),_0x4fafff,_0x19e301[_0x2392('0x19')]['message']);return _0x23dd2c(_0x19e301[_0x2392('0x19')][_0x2392('0x1a')]);}logger['error'](_0x2392('0x14'),_0x4fafff,_0x19e301['error'][_0x2392('0x1a')]);return _0x303ac4(_0x19e301[_0x2392('0x19')][_0x2392('0x1a')]);}else{logger[_0x2392('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x4fafff,_0x2392('0x17'));_0x303ac4(_0x19e301[_0x2392('0x1b')][_0x2392('0x1a')]);}})[_0x2392('0x1c')](function(_0x517464){logger[_0x2392('0x19')](_0x2392('0x14'),_0x4fafff,_0x517464);_0x23dd2c(_0x517464);});});}exports[_0x2392('0x1d')]=function(_0x44cd13){var _0x9366e2=this;return new Promise(function(_0x133500,_0x102243){return db[_0x2392('0x1e')][_0x2392('0x1f')]({'raw':_0x44cd13[_0x2392('0x20')]?_0x44cd13['options'][_0x2392('0x21')]===undefined?!![]:![]:!![],'where':_0x44cd13['options']?_0x44cd13[_0x2392('0x20')][_0x2392('0x22')]||null:null,'attributes':_0x44cd13[_0x2392('0x20')]?_0x44cd13[_0x2392('0x20')]['attributes']||null:null,'limit':_0x44cd13[_0x2392('0x20')]?_0x44cd13['options']['limit']||null:null,'include':_0x44cd13[_0x2392('0x20')]?_0x44cd13[_0x2392('0x20')][_0x2392('0x23')]?_[_0x2392('0x24')](_0x44cd13['options'][_0x2392('0x23')],function(_0x4cacd0){return{'model':db[_0x4cacd0[_0x2392('0x25')]],'as':_0x4cacd0['as'],'attributes':_0x4cacd0['attributes'],'include':_0x4cacd0[_0x2392('0x23')]?_[_0x2392('0x24')](_0x4cacd0['include'],function(_0x549825){return{'model':db[_0x549825['model']],'as':_0x549825['as'],'attributes':_0x549825[_0x2392('0x26')],'include':_0x549825[_0x2392('0x23')]?_[_0x2392('0x24')](_0x549825[_0x2392('0x23')],function(_0x197080){return{'model':db[_0x197080['model']],'as':_0x197080['as'],'attributes':_0x197080[_0x2392('0x26')]};}):[]};}):[]};}):[]:[]})[_0x2392('0x12')](function(_0x2bbece){logger[_0x2392('0x13')](_0x2392('0x1d'),_0x44cd13);logger[_0x2392('0x15')](_0x2392('0x1d'),_0x44cd13,JSON[_0x2392('0x18')](_0x2bbece));_0x133500(_0x2bbece);})[_0x2392('0x1c')](function(_0xd9fbd0){logger[_0x2392('0x19')]('GetOpenchannelQueue',_0xd9fbd0[_0x2392('0x1a')],_0x44cd13);_0x102243(_0x9366e2[_0x2392('0x19')](0x1f4,_0xd9fbd0[_0x2392('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x59c012){var _0x3caecc=this;return new Promise(function(_0x3f240a,_0x56011e){return db[_0x2392('0x1e')][_0x2392('0x27')]({'raw':_0x59c012[_0x2392('0x20')]?_0x59c012['options'][_0x2392('0x21')]===undefined?!![]:![]:!![],'where':_0x59c012[_0x2392('0x20')]?_0x59c012[_0x2392('0x20')][_0x2392('0x22')]||null:null,'attributes':_0x59c012[_0x2392('0x20')]?_0x59c012['options'][_0x2392('0x26')]||null:null,'include':_0x59c012[_0x2392('0x20')]?_0x59c012[_0x2392('0x20')][_0x2392('0x23')]?_[_0x2392('0x24')](_0x59c012[_0x2392('0x20')][_0x2392('0x23')],function(_0x29879a){return{'model':db[_0x29879a[_0x2392('0x25')]],'as':_0x29879a['as'],'attributes':_0x29879a[_0x2392('0x26')],'include':_0x29879a['include']?_[_0x2392('0x24')](_0x29879a['include'],function(_0x1fc841){return{'model':db[_0x1fc841['model']],'as':_0x1fc841['as'],'attributes':_0x1fc841[_0x2392('0x26')],'include':_0x1fc841[_0x2392('0x23')]?_[_0x2392('0x24')](_0x1fc841[_0x2392('0x23')],function(_0x416884){return{'model':db[_0x416884[_0x2392('0x25')]],'as':_0x416884['as'],'attributes':_0x416884['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x518017){logger['info']('ShowOpenchannelQueue',_0x59c012);logger[_0x2392('0x15')](_0x2392('0x28'),_0x59c012,JSON['stringify'](_0x518017));_0x3f240a(_0x518017);})[_0x2392('0x1c')](function(_0x3ecab1){logger['error']('ShowOpenchannelQueue',_0x3ecab1[_0x2392('0x1a')],_0x59c012);_0x56011e(_0x3caecc['error'](0x1f4,_0x3ecab1[_0x2392('0x1a')]));});});}; \ No newline at end of file +var _0x6293=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','stringify','ShowOpenchannelQueue','where','debug','lodash','util','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6293,0x19e));var _0x3629=function(_0x5cf063,_0x1b9a96){_0x5cf063=_0x5cf063-0x0;var _0xfa3092=_0x6293[_0x5cf063];return _0xfa3092;};'use strict';var _=require(_0x3629('0x0'));var util=require(_0x3629('0x1'));var moment=require(_0x3629('0x2'));var BPromise=require(_0x3629('0x3'));var rs=require(_0x3629('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3629('0x5'))['db'];var utils=require(_0x3629('0x6'));var logger=require(_0x3629('0x7'))(_0x3629('0x8'));var config=require('../../config/environment');var jayson=require(_0x3629('0x9'));var client=jayson['client'][_0x3629('0xa')]({'port':0x232a});config[_0x3629('0xb')]=_[_0x3629('0xc')](config[_0x3629('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3629('0xd'))(new Redis(config[_0x3629('0xb')]));require(_0x3629('0xe'))[_0x3629('0xf')](socket);function respondWithRpcPromise(_0x56bf60,_0x5ba296,_0x49b4f1){return new BPromise(function(_0x629d56,_0x405052){return client[_0x3629('0x10')](_0x56bf60,_0x49b4f1)[_0x3629('0x11')](function(_0x48b017){logger[_0x3629('0x12')](_0x3629('0x13'),_0x5ba296,_0x3629('0x14'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5ba296,'request\x20sent',JSON['stringify'](_0x48b017));if(_0x48b017[_0x3629('0x15')]){if(_0x48b017[_0x3629('0x15')][_0x3629('0x16')]===0x1f4){logger[_0x3629('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ba296,_0x48b017['error'][_0x3629('0x17')]);return _0x405052(_0x48b017[_0x3629('0x15')][_0x3629('0x17')]);}logger[_0x3629('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5ba296,_0x48b017[_0x3629('0x15')][_0x3629('0x17')]);return _0x629d56(_0x48b017['error'][_0x3629('0x17')]);}else{logger[_0x3629('0x12')](_0x3629('0x13'),_0x5ba296,_0x3629('0x14'));_0x629d56(_0x48b017['result'][_0x3629('0x17')]);}})[_0x3629('0x18')](function(_0xcbae6a){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x5ba296,_0xcbae6a);_0x405052(_0xcbae6a);});});}exports[_0x3629('0x19')]=function(_0x75f074){var _0x518750=this;return new Promise(function(_0x11588d,_0x56b4fc){return db[_0x3629('0x1a')][_0x3629('0x1b')]({'raw':_0x75f074[_0x3629('0x1c')]?_0x75f074['options'][_0x3629('0x1d')]===undefined?!![]:![]:!![],'where':_0x75f074[_0x3629('0x1c')]?_0x75f074[_0x3629('0x1c')]['where']||null:null,'attributes':_0x75f074['options']?_0x75f074[_0x3629('0x1c')][_0x3629('0x1e')]||null:null,'limit':_0x75f074['options']?_0x75f074[_0x3629('0x1c')]['limit']||null:null,'include':_0x75f074[_0x3629('0x1c')]?_0x75f074[_0x3629('0x1c')][_0x3629('0x1f')]?_[_0x3629('0x20')](_0x75f074[_0x3629('0x1c')]['include'],function(_0x515ec5){return{'model':db[_0x515ec5[_0x3629('0x21')]],'as':_0x515ec5['as'],'attributes':_0x515ec5[_0x3629('0x1e')],'include':_0x515ec5['include']?_[_0x3629('0x20')](_0x515ec5[_0x3629('0x1f')],function(_0x479023){return{'model':db[_0x479023[_0x3629('0x21')]],'as':_0x479023['as'],'attributes':_0x479023[_0x3629('0x1e')],'include':_0x479023[_0x3629('0x1f')]?_[_0x3629('0x20')](_0x479023[_0x3629('0x1f')],function(_0x19a631){return{'model':db[_0x19a631[_0x3629('0x21')]],'as':_0x19a631['as'],'attributes':_0x19a631[_0x3629('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3629('0x11')](function(_0x290646){logger[_0x3629('0x12')](_0x3629('0x19'),_0x75f074);logger['debug']('GetOpenchannelQueue',_0x75f074,JSON[_0x3629('0x22')](_0x290646));_0x11588d(_0x290646);})['catch'](function(_0x24754f){logger[_0x3629('0x15')](_0x3629('0x19'),_0x24754f[_0x3629('0x17')],_0x75f074);_0x56b4fc(_0x518750[_0x3629('0x15')](0x1f4,_0x24754f[_0x3629('0x17')]));});});};exports[_0x3629('0x23')]=function(_0x5c5104){var _0x104030=this;return new Promise(function(_0x368c89,_0x3bbfe5){return db[_0x3629('0x1a')]['find']({'raw':_0x5c5104[_0x3629('0x1c')]?_0x5c5104[_0x3629('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5c5104['options']?_0x5c5104[_0x3629('0x1c')][_0x3629('0x24')]||null:null,'attributes':_0x5c5104[_0x3629('0x1c')]?_0x5c5104[_0x3629('0x1c')][_0x3629('0x1e')]||null:null,'include':_0x5c5104['options']?_0x5c5104[_0x3629('0x1c')][_0x3629('0x1f')]?_[_0x3629('0x20')](_0x5c5104[_0x3629('0x1c')][_0x3629('0x1f')],function(_0x2a63f7){return{'model':db[_0x2a63f7[_0x3629('0x21')]],'as':_0x2a63f7['as'],'attributes':_0x2a63f7[_0x3629('0x1e')],'include':_0x2a63f7[_0x3629('0x1f')]?_[_0x3629('0x20')](_0x2a63f7[_0x3629('0x1f')],function(_0x188f00){return{'model':db[_0x188f00[_0x3629('0x21')]],'as':_0x188f00['as'],'attributes':_0x188f00[_0x3629('0x1e')],'include':_0x188f00['include']?_['map'](_0x188f00[_0x3629('0x1f')],function(_0x19fcac){return{'model':db[_0x19fcac[_0x3629('0x21')]],'as':_0x19fcac['as'],'attributes':_0x19fcac[_0x3629('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3629('0x11')](function(_0x486f3c){logger[_0x3629('0x12')](_0x3629('0x23'),_0x5c5104);logger[_0x3629('0x25')](_0x3629('0x23'),_0x5c5104,JSON[_0x3629('0x22')](_0x486f3c));_0x368c89(_0x486f3c);})[_0x3629('0x18')](function(_0x5a153d){logger[_0x3629('0x15')]('ShowOpenchannelQueue',_0x5a153d['message'],_0x5c5104);_0x3bbfe5(_0x104030[_0x3629('0x15')](0x1f4,_0x5a153d[_0x3629('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index cd29971..bbc39cc 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 _0xb227=['register','length','openchannelQueue:','./openchannelQueue.events','save','update','removeListener'];(function(_0x496574,_0x58240b){var _0x19a728=function(_0x39d4c0){while(--_0x39d4c0){_0x496574['push'](_0x496574['shift']());}};_0x19a728(++_0x58240b);}(_0xb227,0x130));var _0x7b22=function(_0x21141d,_0x1b7429){_0x21141d=_0x21141d-0x0;var _0x22896c=_0xb227[_0x21141d];return _0x22896c;};'use strict';var OpenchannelQueueEvents=require(_0x7b22('0x0'));var events=[_0x7b22('0x1'),'remove',_0x7b22('0x2')];function createListener(_0x1f6a49,_0x5a6d86){return function(_0x4c76be){_0x5a6d86['emit'](_0x1f6a49,_0x4c76be);};}function removeListener(_0x6a979a,_0x3bb56d){return function(){OpenchannelQueueEvents[_0x7b22('0x3')](_0x6a979a,_0x3bb56d);};}exports[_0x7b22('0x4')]=function(_0x509249){for(var _0x548a26=0x0,_0x2a5e48=events[_0x7b22('0x5')];_0x548a26<_0x2a5e48;_0x548a26++){var _0x15eb7a=events[_0x548a26];var _0xc35456=createListener(_0x7b22('0x6')+_0x15eb7a,_0x509249);OpenchannelQueueEvents['on'](_0x15eb7a,_0xc35456);}}; \ No newline at end of file +var _0x03cf=['update','emit','removeListener','register','openchannelQueue:','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03cf,0x11d));var _0xf03c=function(_0x135a2c,_0x166d13){_0x135a2c=_0x135a2c-0x0;var _0x506a49=_0x03cf[_0x135a2c];return _0x506a49;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xf03c('0x0'),_0xf03c('0x1'),_0xf03c('0x2')];function createListener(_0x33365f,_0x354fe5){return function(_0x448855){_0x354fe5[_0xf03c('0x3')](_0x33365f,_0x448855);};}function removeListener(_0x3d1df1,_0x2613fd){return function(){OpenchannelQueueEvents[_0xf03c('0x4')](_0x3d1df1,_0x2613fd);};}exports[_0xf03c('0x5')]=function(_0x5ece05){for(var _0x53ac0b=0x0,_0x1c48eb=events['length'];_0x53ac0b<_0x1c48eb;_0x53ac0b++){var _0x557076=events[_0x53ac0b];var _0x2540b3=createListener(_0xf03c('0x6')+_0x557076,_0x5ece05);OpenchannelQueueEvents['on'](_0x557076,_0x2540b3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ebbf456..da95e2e 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 _0x13b7=['show','post','create','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','index','get','isAuthenticated','describe'];(function(_0x1fbbd4,_0x4cf942){var _0x41b784=function(_0xcc77ca){while(--_0xcc77ca){_0x1fbbd4['push'](_0x1fbbd4['shift']());}};_0x41b784(++_0x4cf942);}(_0x13b7,0x138));var _0x713b=function(_0x49fac0,_0x39a9c3){_0x49fac0=_0x49fac0-0x0;var _0x387b0b=_0x13b7[_0x49fac0];return _0x387b0b;};'use strict';var multer=require(_0x713b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x713b('0x1'));var express=require(_0x713b('0x2'));var router=express['Router']();var fs_extra=require(_0x713b('0x3'));var auth=require(_0x713b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x713b('0x5'));var controller=require(_0x713b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x713b('0x7')]);router[_0x713b('0x8')]('/describe',auth[_0x713b('0x9')](),controller[_0x713b('0xa')]);router['get']('/:id',auth[_0x713b('0x9')](),controller[_0x713b('0xb')]);router[_0x713b('0xc')]('/',auth['isAuthenticated'](),controller[_0x713b('0xd')]);router['put']('/:id',auth[_0x713b('0x9')](),controller['update']);router[_0x713b('0xe')]('/:id',auth[_0x713b('0x9')](),controller[_0x713b('0xf')]);module[_0x713b('0x10')]=router; \ No newline at end of file +var _0xc617=['fs-extra','../../components/interaction/service','./openchannelQueueReport.controller','get','index','/describe','describe','isAuthenticated','create','/:id','update','delete','exports','multer','util','express','Router'];(function(_0x45a96b,_0x42b412){var _0x4e5603=function(_0x310426){while(--_0x310426){_0x45a96b['push'](_0x45a96b['shift']());}};_0x4e5603(++_0x42b412);}(_0xc617,0xa6));var _0x7c61=function(_0x499792,_0x20bf22){_0x499792=_0x499792-0x0;var _0x1ba806=_0xc617[_0x499792];return _0x1ba806;};'use strict';var multer=require(_0x7c61('0x0'));var util=require(_0x7c61('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7c61('0x2'));var router=express[_0x7c61('0x3')]();var fs_extra=require(_0x7c61('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7c61('0x5'));var config=require('../../config/environment');var controller=require(_0x7c61('0x6'));router[_0x7c61('0x7')]('/',auth['isAuthenticated'](),controller[_0x7c61('0x8')]);router[_0x7c61('0x7')](_0x7c61('0x9'),auth['isAuthenticated'](),controller[_0x7c61('0xa')]);router[_0x7c61('0x7')]('/:id',auth[_0x7c61('0xb')](),controller['show']);router['post']('/',auth[_0x7c61('0xb')](),controller[_0x7c61('0xc')]);router['put'](_0x7c61('0xd'),auth[_0x7c61('0xb')](),controller[_0x7c61('0xe')]);router[_0x7c61('0xf')](_0x7c61('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x7c61('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 0879840..06fb72d 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 _0x3810=['DATE','moment','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3810,0x12d));var _0x0381=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x3810[_0x143a91];return _0x1906f5;};'use strict';var moment=require(_0x0381('0x0'));var Sequelize=require(_0x0381('0x1'));module[_0x0381('0x2')]={'uniqueid':{'type':Sequelize[_0x0381('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0381('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0381('0x4')]},'exitAt':{'type':Sequelize[_0x0381('0x4')]},'reason':{'type':Sequelize[_0x0381('0x3')]}}; \ No newline at end of file +var _0x495c=['DATE','sequelize','exports'];(function(_0x494e13,_0x27c198){var _0x14865b=function(_0x119a2e){while(--_0x119a2e){_0x494e13['push'](_0x494e13['shift']());}};_0x14865b(++_0x27c198);}(_0x495c,0x1d2));var _0xc495=function(_0x2d8579,_0x1b7e62){_0x2d8579=_0x2d8579-0x0;var _0x192b6b=_0x495c[_0x2d8579];return _0x192b6b;};'use strict';var moment=require('moment');var Sequelize=require(_0xc495('0x0'));module[_0xc495('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc495('0x2')]},'leaveAt':{'type':Sequelize[_0xc495('0x2')]},'acceptAt':{'type':Sequelize[_0xc495('0x2')]},'exitAt':{'type':Sequelize[_0xc495('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 62793f2..093e6ad 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 _0x81fc=['order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','send','index','OpenchannelQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x81fc,0x193));var _0xc81f=function(_0x4af3ac,_0x240022){_0x4af3ac=_0x4af3ac-0x0;var _0x3234a6=_0x81fc[_0x4af3ac];return _0x3234a6;};'use strict';var emlformat=require(_0xc81f('0x0'));var rimraf=require(_0xc81f('0x1'));var zipdir=require(_0xc81f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc81f('0x3'));var BPromise=require(_0xc81f('0x4'));var Mustache=require(_0xc81f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc81f('0x6'));var csv=require(_0xc81f('0x7'));var ejs=require(_0xc81f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc81f('0x9'));var squel=require(_0xc81f('0xa'));var crypto=require(_0xc81f('0xb'));var jsforce=require(_0xc81f('0xc'));var deskjs=require(_0xc81f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc81f('0xe'));var Papa=require(_0xc81f('0xf'));var Redis=require(_0xc81f('0x10'));var authService=require(_0xc81f('0x11'));var qs=require(_0xc81f('0x12'));var as=require(_0xc81f('0x13'));var hardwareService=require(_0xc81f('0x14'));var logger=require('../../config/logger')(_0xc81f('0x15'));var utils=require(_0xc81f('0x16'));var config=require(_0xc81f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc81f('0x18'))['db'];function respondWithStatusCode(_0xbdbe23,_0x5359ed){_0x5359ed=_0x5359ed||0xcc;return function(_0x3ea4f3){if(_0x3ea4f3){return _0xbdbe23[_0xc81f('0x19')](_0x5359ed);}return _0xbdbe23[_0xc81f('0x1a')](_0x5359ed)[_0xc81f('0x1b')]();};}function respondWithResult(_0x4a8e0a,_0x480bca){_0x480bca=_0x480bca||0xc8;return function(_0x320334){if(_0x320334){return _0x4a8e0a['status'](_0x480bca)[_0xc81f('0x1c')](_0x320334);}};}function respondWithFilteredResult(_0x435d9f,_0x54168a){return function(_0x4b92ef){if(_0x4b92ef){var _0xf7e815=typeof _0x54168a['offset']===_0xc81f('0x1d')&&typeof _0x54168a[_0xc81f('0x1e')]===_0xc81f('0x1d');var _0x55164c=_0x4b92ef[_0xc81f('0x1f')];var _0x3952d4=_0xf7e815?0x0:_0x54168a[_0xc81f('0x20')];var _0x562f02=_0xf7e815?_0x4b92ef[_0xc81f('0x1f')]:_0x54168a[_0xc81f('0x20')]+_0x54168a[_0xc81f('0x1e')];var _0x2153a4;if(_0x562f02>=_0x55164c){_0x562f02=_0x55164c;_0x2153a4=0xc8;}else{_0x2153a4=0xce;}_0x435d9f[_0xc81f('0x1a')](_0x2153a4);return _0x435d9f[_0xc81f('0x21')]('Content-Range',_0x3952d4+'-'+_0x562f02+'/'+_0x55164c)[_0xc81f('0x1c')](_0x4b92ef);}return null;};}function patchUpdates(_0x54ff9c){return function(_0x62b042){try{jsonpatch[_0xc81f('0x22')](_0x62b042,_0x54ff9c,!![]);}catch(_0x4bf11e){return BPromise[_0xc81f('0x23')](_0x4bf11e);}return _0x62b042[_0xc81f('0x24')]();};}function saveUpdates(_0x4d4ecd,_0x29f235){return function(_0x5cd1aa){if(_0x5cd1aa){return _0x5cd1aa[_0xc81f('0x25')](_0x4d4ecd)[_0xc81f('0x26')](function(_0x11c1ab){return _0x11c1ab;});}return null;};}function removeEntity(_0x184626,_0x28eb18){return function(_0x326809){if(_0x326809){return _0x326809[_0xc81f('0x27')]()[_0xc81f('0x26')](function(){_0x184626[_0xc81f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc19e,_0x2fc82a){return function(_0x4f2443){if(!_0x4f2443){_0x5bc19e[_0xc81f('0x19')](0x194);}return _0x4f2443;};}function handleError(_0x3dcb27,_0xf4069a){_0xf4069a=_0xf4069a||0x1f4;return function(_0x3b9f17){logger[_0xc81f('0x28')](_0x3b9f17[_0xc81f('0x29')]);if(_0x3b9f17['name']){delete _0x3b9f17['name'];}_0x3dcb27['status'](_0xf4069a)[_0xc81f('0x2a')](_0x3b9f17);};}exports[_0xc81f('0x2b')]=function(_0x29b877,_0x4e2ba7){var _0x298425={},_0xeb57ad={},_0x4d9e94={'count':0x0,'rows':[]};var _0x3562bf=_['map'](db[_0xc81f('0x2c')][_0xc81f('0x2d')],function(_0xf9ecb1){return{'name':_0xf9ecb1['fieldName'],'type':_0xf9ecb1[_0xc81f('0x2e')][_0xc81f('0x2f')]};});_0xeb57ad[_0xc81f('0x30')]=_[_0xc81f('0x31')](_0x3562bf,'name');_0xeb57ad[_0xc81f('0x32')]=_[_0xc81f('0x33')](_0x29b877[_0xc81f('0x32')]);_0xeb57ad[_0xc81f('0x34')]=_[_0xc81f('0x35')](_0xeb57ad[_0xc81f('0x30')],_0xeb57ad[_0xc81f('0x32')]);_0x298425[_0xc81f('0x36')]=_[_0xc81f('0x35')](_0xeb57ad[_0xc81f('0x30')],qs[_0xc81f('0x37')](_0x29b877['query'][_0xc81f('0x37')]));_0x298425[_0xc81f('0x36')]=_0x298425[_0xc81f('0x36')][_0xc81f('0x38')]?_0x298425['attributes']:_0xeb57ad[_0xc81f('0x30')];if(!_0x29b877[_0xc81f('0x32')][_0xc81f('0x39')](_0xc81f('0x3a'))){_0x298425[_0xc81f('0x1e')]=qs[_0xc81f('0x1e')](_0x29b877['query']['limit']);_0x298425['offset']=qs['offset'](_0x29b877['query']['offset']);}_0x298425[_0xc81f('0x3b')]=qs[_0xc81f('0x3c')](_0x29b877['query']['sort']);_0x298425[_0xc81f('0x3d')]=qs[_0xc81f('0x34')](_[_0xc81f('0x3e')](_0x29b877['query'],_0xeb57ad['filters']),_0x3562bf);if(_0x29b877[_0xc81f('0x32')][_0xc81f('0x3f')]){_0x298425['where']=_[_0xc81f('0x40')](_0x298425[_0xc81f('0x3d')],{'$or':_['map'](_0x3562bf,function(_0x475584){if(_0x475584[_0xc81f('0x2e')]!==_0xc81f('0x41')){var _0x57a01b={};_0x57a01b[_0x475584[_0xc81f('0x42')]]={'$like':'%'+_0x29b877[_0xc81f('0x32')][_0xc81f('0x3f')]+'%'};return _0x57a01b;}})});}_0x298425=_['merge']({},_0x298425,_0x29b877[_0xc81f('0x43')]);var _0x4aecbb={'where':_0x298425[_0xc81f('0x3d')]};return db['OpenchannelQueueReport'][_0xc81f('0x1f')](_0x4aecbb)[_0xc81f('0x26')](function(_0x4862fa){_0x4d9e94[_0xc81f('0x1f')]=_0x4862fa;if(_0x29b877[_0xc81f('0x32')][_0xc81f('0x44')]){_0x298425[_0xc81f('0x45')]=[{'all':!![]}];}return db[_0xc81f('0x2c')][_0xc81f('0x46')](_0x298425);})[_0xc81f('0x26')](function(_0x334e7b){_0x4d9e94['rows']=_0x334e7b;return _0x4d9e94;})[_0xc81f('0x26')](respondWithFilteredResult(_0x4e2ba7,_0x298425))[_0xc81f('0x47')](handleError(_0x4e2ba7,null));};exports['show']=function(_0x474226,_0x13368f){var _0x392eb1={'raw':!![],'where':{'id':_0x474226[_0xc81f('0x48')]['id']}},_0x5662b6={};_0x5662b6['model']=_[_0xc81f('0x33')](db['OpenchannelQueueReport']['rawAttributes']);_0x5662b6['query']=_['keys'](_0x474226['query']);_0x5662b6['filters']=_[_0xc81f('0x35')](_0x5662b6[_0xc81f('0x30')],_0x5662b6[_0xc81f('0x32')]);_0x392eb1[_0xc81f('0x36')]=_[_0xc81f('0x35')](_0x5662b6[_0xc81f('0x30')],qs[_0xc81f('0x37')](_0x474226[_0xc81f('0x32')]['fields']));_0x392eb1[_0xc81f('0x36')]=_0x392eb1['attributes'][_0xc81f('0x38')]?_0x392eb1[_0xc81f('0x36')]:_0x5662b6['model'];if(_0x474226[_0xc81f('0x32')][_0xc81f('0x44')]){_0x392eb1[_0xc81f('0x45')]=[{'all':!![]}];}_0x392eb1=_[_0xc81f('0x40')]({},_0x392eb1,_0x474226[_0xc81f('0x43')]);return db['OpenchannelQueueReport'][_0xc81f('0x49')](_0x392eb1)[_0xc81f('0x26')](handleEntityNotFound(_0x13368f,null))[_0xc81f('0x26')](respondWithResult(_0x13368f,null))[_0xc81f('0x47')](handleError(_0x13368f,null));};exports[_0xc81f('0x4a')]=function(_0x23d385,_0x533d52){return db['OpenchannelQueueReport'][_0xc81f('0x4a')](_0x23d385[_0xc81f('0x4b')],{})[_0xc81f('0x26')](respondWithResult(_0x533d52,0xc9))[_0xc81f('0x47')](handleError(_0x533d52,null));};exports['update']=function(_0x4b1c19,_0x1506b8){if(_0x4b1c19[_0xc81f('0x4b')]['id']){delete _0x4b1c19[_0xc81f('0x4b')]['id'];}return db[_0xc81f('0x2c')][_0xc81f('0x49')]({'where':{'id':_0x4b1c19[_0xc81f('0x48')]['id']}})[_0xc81f('0x26')](handleEntityNotFound(_0x1506b8,null))[_0xc81f('0x26')](saveUpdates(_0x4b1c19[_0xc81f('0x4b')],null))[_0xc81f('0x26')](respondWithResult(_0x1506b8,null))[_0xc81f('0x47')](handleError(_0x1506b8,null));};exports[_0xc81f('0x27')]=function(_0x2df82d,_0x205924){return db[_0xc81f('0x2c')][_0xc81f('0x49')]({'where':{'id':_0x2df82d[_0xc81f('0x48')]['id']}})['then'](handleEntityNotFound(_0x205924,null))[_0xc81f('0x26')](removeEntity(_0x205924,null))[_0xc81f('0x47')](handleError(_0x205924,null));};exports[_0xc81f('0x4c')]=function(_0x5a30cc,_0x493645){return db['OpenchannelQueueReport'][_0xc81f('0x4c')]()['then'](respondWithResult(_0x493645,null))[_0xc81f('0x47')](handleError(_0x493645,null));}; \ No newline at end of file +var _0xf080=['offset','undefined','count','set','Content-Range','save','then','destroy','error','stack','name','send','OpenchannelQueueReport','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','include','find','create','body','update','params','describe','eml-format','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x392dbc,_0x4d31cf){var _0x119302=function(_0x250580){while(--_0x250580){_0x392dbc['push'](_0x392dbc['shift']());}};_0x119302(++_0x4d31cf);}(_0xf080,0x102));var _0x0f08=function(_0x120d74,_0x5ee1c4){_0x120d74=_0x120d74-0x0;var _0x589168=_0xf080[_0x120d74];return _0x589168;};'use strict';var emlformat=require(_0x0f08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f08('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f08('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0f08('0x3'));var util=require(_0x0f08('0x4'));var path=require('path');var sox=require(_0x0f08('0x5'));var csv=require(_0x0f08('0x6'));var ejs=require(_0x0f08('0x7'));var fs=require('fs');var fs_extra=require(_0x0f08('0x8'));var _=require(_0x0f08('0x9'));var squel=require(_0x0f08('0xa'));var crypto=require(_0x0f08('0xb'));var jsforce=require(_0x0f08('0xc'));var deskjs=require(_0x0f08('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0f08('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f08('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0f08('0x10'));var as=require(_0x0f08('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f08('0x12'))('api');var utils=require(_0x0f08('0x13'));var config=require(_0x0f08('0x14'));var licenseUtil=require(_0x0f08('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a5ef3,_0x226a00){_0x226a00=_0x226a00||0xcc;return function(_0x369a72){if(_0x369a72){return _0x2a5ef3[_0x0f08('0x16')](_0x226a00);}return _0x2a5ef3[_0x0f08('0x17')](_0x226a00)[_0x0f08('0x18')]();};}function respondWithResult(_0x39a799,_0x31ce41){_0x31ce41=_0x31ce41||0xc8;return function(_0x439e1c){if(_0x439e1c){return _0x39a799[_0x0f08('0x17')](_0x31ce41)[_0x0f08('0x19')](_0x439e1c);}};}function respondWithFilteredResult(_0x2e62a0,_0x53bc4e){return function(_0x47bce5){if(_0x47bce5){var _0x33b8ec=typeof _0x53bc4e[_0x0f08('0x1a')]==='undefined'&&typeof _0x53bc4e['limit']===_0x0f08('0x1b');var _0xd700ae=_0x47bce5[_0x0f08('0x1c')];var _0x2f7b3c=_0x33b8ec?0x0:_0x53bc4e[_0x0f08('0x1a')];var _0x141947=_0x33b8ec?_0x47bce5[_0x0f08('0x1c')]:_0x53bc4e[_0x0f08('0x1a')]+_0x53bc4e['limit'];var _0x4aea86;if(_0x141947>=_0xd700ae){_0x141947=_0xd700ae;_0x4aea86=0xc8;}else{_0x4aea86=0xce;}_0x2e62a0[_0x0f08('0x17')](_0x4aea86);return _0x2e62a0[_0x0f08('0x1d')](_0x0f08('0x1e'),_0x2f7b3c+'-'+_0x141947+'/'+_0xd700ae)['json'](_0x47bce5);}return null;};}function patchUpdates(_0x50ef9a){return function(_0x260229){try{jsonpatch['apply'](_0x260229,_0x50ef9a,!![]);}catch(_0x31876a){return BPromise['reject'](_0x31876a);}return _0x260229[_0x0f08('0x1f')]();};}function saveUpdates(_0x17a850,_0x41d0e2){return function(_0x1685f4){if(_0x1685f4){return _0x1685f4['update'](_0x17a850)[_0x0f08('0x20')](function(_0x1372a2){return _0x1372a2;});}return null;};}function removeEntity(_0x44f998,_0x84f6c2){return function(_0x4f57eb){if(_0x4f57eb){return _0x4f57eb[_0x0f08('0x21')]()[_0x0f08('0x20')](function(){_0x44f998['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ba545,_0x420275){return function(_0x5e0bc0){if(!_0x5e0bc0){_0x4ba545[_0x0f08('0x16')](0x194);}return _0x5e0bc0;};}function handleError(_0x34c2fb,_0x5629c5){_0x5629c5=_0x5629c5||0x1f4;return function(_0x49c46d){logger[_0x0f08('0x22')](_0x49c46d[_0x0f08('0x23')]);if(_0x49c46d[_0x0f08('0x24')]){delete _0x49c46d[_0x0f08('0x24')];}_0x34c2fb[_0x0f08('0x17')](_0x5629c5)[_0x0f08('0x25')](_0x49c46d);};}exports['index']=function(_0x4d6fa7,_0x30206b){var _0x361065={},_0xfce05e={},_0x483da2={'count':0x0,'rows':[]};var _0x494cfe=_['map'](db[_0x0f08('0x26')][_0x0f08('0x27')],function(_0x3e8d01){return{'name':_0x3e8d01['fieldName'],'type':_0x3e8d01[_0x0f08('0x28')][_0x0f08('0x29')]};});_0xfce05e['model']=_[_0x0f08('0x2a')](_0x494cfe,'name');_0xfce05e[_0x0f08('0x2b')]=_[_0x0f08('0x2c')](_0x4d6fa7[_0x0f08('0x2b')]);_0xfce05e[_0x0f08('0x2d')]=_[_0x0f08('0x2e')](_0xfce05e[_0x0f08('0x2f')],_0xfce05e[_0x0f08('0x2b')]);_0x361065['attributes']=_[_0x0f08('0x2e')](_0xfce05e[_0x0f08('0x2f')],qs['fields'](_0x4d6fa7[_0x0f08('0x2b')][_0x0f08('0x30')]));_0x361065[_0x0f08('0x31')]=_0x361065[_0x0f08('0x31')]['length']?_0x361065[_0x0f08('0x31')]:_0xfce05e[_0x0f08('0x2f')];if(!_0x4d6fa7[_0x0f08('0x2b')]['hasOwnProperty'](_0x0f08('0x32'))){_0x361065[_0x0f08('0x33')]=qs[_0x0f08('0x33')](_0x4d6fa7[_0x0f08('0x2b')]['limit']);_0x361065[_0x0f08('0x1a')]=qs[_0x0f08('0x1a')](_0x4d6fa7[_0x0f08('0x2b')][_0x0f08('0x1a')]);}_0x361065[_0x0f08('0x34')]=qs['sort'](_0x4d6fa7['query'][_0x0f08('0x35')]);_0x361065[_0x0f08('0x36')]=qs[_0x0f08('0x2d')](_[_0x0f08('0x37')](_0x4d6fa7[_0x0f08('0x2b')],_0xfce05e[_0x0f08('0x2d')]),_0x494cfe);if(_0x4d6fa7['query']['filter']){_0x361065[_0x0f08('0x36')]=_[_0x0f08('0x38')](_0x361065['where'],{'$or':_[_0x0f08('0x2a')](_0x494cfe,function(_0x15450c){if(_0x15450c[_0x0f08('0x28')]!==_0x0f08('0x39')){var _0x580fa0={};_0x580fa0[_0x15450c[_0x0f08('0x24')]]={'$like':'%'+_0x4d6fa7[_0x0f08('0x2b')][_0x0f08('0x3a')]+'%'};return _0x580fa0;}})});}_0x361065=_[_0x0f08('0x38')]({},_0x361065,_0x4d6fa7[_0x0f08('0x3b')]);var _0x34e70b={'where':_0x361065[_0x0f08('0x36')]};return db[_0x0f08('0x26')][_0x0f08('0x1c')](_0x34e70b)[_0x0f08('0x20')](function(_0x3a78fc){_0x483da2[_0x0f08('0x1c')]=_0x3a78fc;if(_0x4d6fa7[_0x0f08('0x2b')][_0x0f08('0x3c')]){_0x361065['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x0f08('0x3d')](_0x361065);})[_0x0f08('0x20')](function(_0x11cfd){_0x483da2[_0x0f08('0x3e')]=_0x11cfd;return _0x483da2;})[_0x0f08('0x20')](respondWithFilteredResult(_0x30206b,_0x361065))[_0x0f08('0x3f')](handleError(_0x30206b,null));};exports['show']=function(_0x382948,_0x5bf56a){var _0x3d3a45={'raw':!![],'where':{'id':_0x382948['params']['id']}},_0x10a889={};_0x10a889[_0x0f08('0x2f')]=_[_0x0f08('0x2c')](db['OpenchannelQueueReport'][_0x0f08('0x27')]);_0x10a889[_0x0f08('0x2b')]=_[_0x0f08('0x2c')](_0x382948[_0x0f08('0x2b')]);_0x10a889[_0x0f08('0x2d')]=_[_0x0f08('0x2e')](_0x10a889[_0x0f08('0x2f')],_0x10a889[_0x0f08('0x2b')]);_0x3d3a45['attributes']=_[_0x0f08('0x2e')](_0x10a889[_0x0f08('0x2f')],qs[_0x0f08('0x30')](_0x382948[_0x0f08('0x2b')][_0x0f08('0x30')]));_0x3d3a45['attributes']=_0x3d3a45[_0x0f08('0x31')]['length']?_0x3d3a45[_0x0f08('0x31')]:_0x10a889[_0x0f08('0x2f')];if(_0x382948['query'][_0x0f08('0x3c')]){_0x3d3a45[_0x0f08('0x40')]=[{'all':!![]}];}_0x3d3a45=_[_0x0f08('0x38')]({},_0x3d3a45,_0x382948['options']);return db[_0x0f08('0x26')][_0x0f08('0x41')](_0x3d3a45)[_0x0f08('0x20')](handleEntityNotFound(_0x5bf56a,null))[_0x0f08('0x20')](respondWithResult(_0x5bf56a,null))[_0x0f08('0x3f')](handleError(_0x5bf56a,null));};exports[_0x0f08('0x42')]=function(_0x5a9ea4,_0x3fd47e){return db[_0x0f08('0x26')][_0x0f08('0x42')](_0x5a9ea4[_0x0f08('0x43')],{})[_0x0f08('0x20')](respondWithResult(_0x3fd47e,0xc9))[_0x0f08('0x3f')](handleError(_0x3fd47e,null));};exports[_0x0f08('0x44')]=function(_0x35b854,_0x59fd79){if(_0x35b854[_0x0f08('0x43')]['id']){delete _0x35b854[_0x0f08('0x43')]['id'];}return db[_0x0f08('0x26')][_0x0f08('0x41')]({'where':{'id':_0x35b854[_0x0f08('0x45')]['id']}})[_0x0f08('0x20')](handleEntityNotFound(_0x59fd79,null))[_0x0f08('0x20')](saveUpdates(_0x35b854[_0x0f08('0x43')],null))[_0x0f08('0x20')](respondWithResult(_0x59fd79,null))['catch'](handleError(_0x59fd79,null));};exports[_0x0f08('0x21')]=function(_0x448707,_0x5dbbdb){return db[_0x0f08('0x26')][_0x0f08('0x41')]({'where':{'id':_0x448707['params']['id']}})['then'](handleEntityNotFound(_0x5dbbdb,null))[_0x0f08('0x20')](removeEntity(_0x5dbbdb,null))[_0x0f08('0x3f')](handleError(_0x5dbbdb,null));};exports[_0x0f08('0x46')]=function(_0x26e83b,_0xdfaec2){return db[_0x0f08('0x26')][_0x0f08('0x46')]()['then'](respondWithResult(_0xdfaec2,null))[_0x0f08('0x3f')](handleError(_0xdfaec2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 733c1d1..aaec29c 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2a2982,_0x45247b){var _0x4120a1=function(_0x1665a5){while(--_0x1665a5){_0x2a2982['push'](_0x2a2982['shift']());}};_0x4120a1(++_0x45247b);}(_0x7a54,0x106));var _0x47a5=function(_0x104e4a,_0x5548cb){_0x104e4a=_0x104e4a-0x0;var _0x151975=_0x7a54[_0x104e4a];return _0x151975;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'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(_0x193f21,_0xa67eb1){var _0x37d84e=function(_0x1bee15){while(--_0x1bee15){_0x193f21['push'](_0x193f21['shift']());}};_0x37d84e(++_0xa67eb1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'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 79a0aab..b05082f 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 _0x9ccd=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateOpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','limit','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x1d7098,_0x44e493){var _0xc40223=function(_0x2d7f0f){while(--_0x2d7f0f){_0x1d7098['push'](_0x1d7098['shift']());}};_0xc40223(++_0x44e493);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var moment=require(_0xd9cc('0x1'));var BPromise=require(_0xd9cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9cc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9cc('0x4'))(_0xd9cc('0x5'));var config=require(_0xd9cc('0x6'));var jayson=require(_0xd9cc('0x7'));var client=jayson[_0xd9cc('0x8')][_0xd9cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f7b2b,_0x23b70a,_0x9e1e10){return new BPromise(function(_0x1a1bd1,_0x20282c){return client[_0xd9cc('0xa')](_0x1f7b2b,_0x9e1e10)[_0xd9cc('0xb')](function(_0x1737e5){logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,'request\x20sent');logger[_0xd9cc('0xe')](_0xd9cc('0xf'),_0x23b70a,_0xd9cc('0x10'),JSON[_0xd9cc('0x11')](_0x1737e5));if(_0x1737e5[_0xd9cc('0x12')]){if(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x13')]===0x1f4){logger[_0xd9cc('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')]['message']);return _0x20282c(_0x1737e5['error']['message']);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x23b70a,_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);return _0x1a1bd1(_0x1737e5[_0xd9cc('0x12')][_0xd9cc('0x14')]);}else{logger[_0xd9cc('0xc')](_0xd9cc('0xd'),_0x23b70a,_0xd9cc('0x10'));_0x1a1bd1(_0x1737e5['result'][_0xd9cc('0x14')]);}})[_0xd9cc('0x15')](function(_0x513635){logger[_0xd9cc('0x12')](_0xd9cc('0xd'),_0x23b70a,_0x513635);_0x20282c(_0x513635);});});}exports[_0xd9cc('0x16')]=function(_0x2e2baa){var _0x5a4b50=this;return new Promise(function(_0x37b745,_0x32df89){return db['OpenchannelQueueReport'][_0xd9cc('0x17')](_0x2e2baa[_0xd9cc('0x18')],{'raw':_0x2e2baa[_0xd9cc('0x19')]?_0x2e2baa[_0xd9cc('0x19')][_0xd9cc('0x1a')]===undefined?!![]:![]:!![]})[_0xd9cc('0xb')](function(_0x59f00d){logger['info'](_0xd9cc('0x16'),_0x2e2baa);logger[_0xd9cc('0xe')](_0xd9cc('0x16'),_0x2e2baa,JSON[_0xd9cc('0x11')](_0x59f00d));_0x37b745(_0x59f00d);})[_0xd9cc('0x15')](function(_0x426a5c){logger[_0xd9cc('0x12')](_0xd9cc('0x16'),_0x426a5c[_0xd9cc('0x14')],_0x2e2baa);_0x32df89(_0x5a4b50[_0xd9cc('0x12')](0x1f4,_0x426a5c[_0xd9cc('0x14')]));});});};exports[_0xd9cc('0x1b')]=function(_0x45b05a){var _0x35fb49=this;return new Promise(function(_0x503451,_0xc74622){return db[_0xd9cc('0x1c')]['update'](_0x45b05a[_0xd9cc('0x18')],{'raw':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1d')]||null:null,'attributes':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')]['attributes']||null:null,'limit':_0x45b05a[_0xd9cc('0x19')]?_0x45b05a[_0xd9cc('0x19')][_0xd9cc('0x1e')]||null:null})[_0xd9cc('0xb')](function(_0xfcd78c){logger[_0xd9cc('0xc')](_0xd9cc('0x1b'),_0x45b05a);logger[_0xd9cc('0xe')]('UpdateOpenchannelQueueReport',_0x45b05a,JSON[_0xd9cc('0x11')](_0xfcd78c));_0x503451(_0xfcd78c);})[_0xd9cc('0x15')](function(_0x42d185){logger[_0xd9cc('0x12')](_0xd9cc('0x1b'),_0x42d185[_0xd9cc('0x14')],_0x45b05a);_0xc74622(_0x35fb49['error'](0x1f4,_0x42d185[_0xd9cc('0x14')]));});});}; \ No newline at end of file +var _0x8952=['raw','debug','UpdateOpenchannelQueueReport','body','options','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x8952,0x17e));var _0x2895=function(_0x83f6d2,_0x506325){_0x83f6d2=_0x83f6d2-0x0;var _0x164519=_0x8952[_0x83f6d2];return _0x164519;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});}exports[_0x2895('0x15')]=function(_0xbf8b63){var _0x2cb505=this;return new Promise(function(_0x155124,_0x184d11){return db[_0x2895('0x16')][_0x2895('0x17')](_0xbf8b63['body'],{'raw':_0xbf8b63['options']?_0xbf8b63['options'][_0x2895('0x18')]===undefined?!![]:![]:!![]})[_0x2895('0xc')](function(_0x3ec4da){logger['info'](_0x2895('0x15'),_0xbf8b63);logger[_0x2895('0x19')](_0x2895('0x15'),_0xbf8b63,JSON[_0x2895('0xf')](_0x3ec4da));_0x155124(_0x3ec4da);})[_0x2895('0x14')](function(_0x5dbbfe){logger[_0x2895('0x10')](_0x2895('0x15'),_0x5dbbfe['message'],_0xbf8b63);_0x184d11(_0x2cb505[_0x2895('0x10')](0x1f4,_0x5dbbfe[_0x2895('0x12')]));});});};exports[_0x2895('0x1a')]=function(_0x511286){var _0x4e884f=this;return new Promise(function(_0x3a72fa,_0x4569b5){return db[_0x2895('0x16')]['update'](_0x511286[_0x2895('0x1b')],{'raw':_0x511286[_0x2895('0x1c')]?_0x511286['options'][_0x2895('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x511286[_0x2895('0x1c')]?_0x511286[_0x2895('0x1c')]['where']||null:null,'attributes':_0x511286[_0x2895('0x1c')]?_0x511286[_0x2895('0x1c')]['attributes']||null:null,'limit':_0x511286[_0x2895('0x1c')]?_0x511286['options']['limit']||null:null})[_0x2895('0xc')](function(_0x4ee2cc){logger[_0x2895('0xd')](_0x2895('0x1a'),_0x511286);logger['debug']('UpdateOpenchannelQueueReport',_0x511286,JSON[_0x2895('0xf')](_0x4ee2cc));_0x3a72fa(_0x4ee2cc);})[_0x2895('0x14')](function(_0x190e07){logger[_0x2895('0x10')](_0x2895('0x1a'),_0x190e07[_0x2895('0x12')],_0x511286);_0x4569b5(_0x4e884f[_0x2895('0x10')](0x1f4,_0x190e07['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 22a9d96..522d5df 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 _0x7b7a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x5e9bd0,_0x228267){var _0x1795b9=function(_0x433e93){while(--_0x433e93){_0x5e9bd0['push'](_0x5e9bd0['shift']());}};_0x1795b9(++_0x228267);}(_0x7b7a,0x74));var _0xa7b7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x7b7a[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xa7b7('0x0'));var util=require(_0xa7b7('0x1'));var path=require(_0xa7b7('0x2'));var timeout=require(_0xa7b7('0x3'));var express=require('express');var router=express[_0xa7b7('0x4')]();var fs_extra=require(_0xa7b7('0x5'));var auth=require(_0xa7b7('0x6'));var interaction=require(_0xa7b7('0x7'));var config=require(_0xa7b7('0x8'));var controller=require(_0xa7b7('0x9'));router[_0xa7b7('0xa')]('/',auth[_0xa7b7('0xb')](),controller[_0xa7b7('0xc')]);router[_0xa7b7('0xa')]('/describe',auth[_0xa7b7('0xb')](),controller[_0xa7b7('0xd')]);router[_0xa7b7('0xa')](_0xa7b7('0xe'),auth[_0xa7b7('0xb')](),controller['show']);router[_0xa7b7('0xf')]('/',auth['isAuthenticated'](),controller[_0xa7b7('0x10')]);router[_0xa7b7('0x11')](_0xa7b7('0xe'),auth['isAuthenticated'](),controller[_0xa7b7('0x12')]);router[_0xa7b7('0x13')](_0xa7b7('0xe'),auth[_0xa7b7('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x61ab=['../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3e4d9a,_0x449a9f){var _0x4124d3=function(_0x3dd192){while(--_0x3dd192){_0x3e4d9a['push'](_0x3e4d9a['shift']());}};_0x4124d3(++_0x449a9f);}(_0x61ab,0x162));var _0xb61a=function(_0x42d2af,_0x3961b5){_0x42d2af=_0x42d2af-0x0;var _0x1d6d63=_0x61ab[_0x42d2af];return _0x1d6d63;};'use strict';var multer=require(_0xb61a('0x0'));var util=require(_0xb61a('0x1'));var path=require(_0xb61a('0x2'));var timeout=require(_0xb61a('0x3'));var express=require(_0xb61a('0x4'));var router=express[_0xb61a('0x5')]();var fs_extra=require(_0xb61a('0x6'));var auth=require(_0xb61a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb61a('0x8'));var controller=require(_0xb61a('0x9'));router[_0xb61a('0xa')]('/',auth[_0xb61a('0xb')](),controller['index']);router['get']('/describe',auth[_0xb61a('0xb')](),controller[_0xb61a('0xc')]);router[_0xb61a('0xa')](_0xb61a('0xd'),auth[_0xb61a('0xb')](),controller['show']);router[_0xb61a('0xe')]('/',auth[_0xb61a('0xb')](),controller[_0xb61a('0xf')]);router['put']('/:id',auth[_0xb61a('0xb')](),controller[_0xb61a('0x10')]);router['delete'](_0xb61a('0xd'),auth[_0xb61a('0xb')](),controller[_0xb61a('0x11')]);module[_0xb61a('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 d86245c..ac3d040 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x4f0f25,_0x289cca){var _0x8ecd2a=function(_0x15047f){while(--_0x15047f){_0x4f0f25['push'](_0x4f0f25['shift']());}};_0x8ecd2a(++_0x289cca);}(_0xedd9,0xfc));var _0x9edd=function(_0x461521,_0x3950c8){_0x461521=_0x461521-0x0;var _0x14bb04=_0xedd9[_0x461521];return _0x14bb04;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0xf2f332,_0x299fbf){var _0x56cce3=function(_0x5f37e0){while(--_0x5f37e0){_0xf2f332['push'](_0xf2f332['shift']());}};_0x56cce3(++_0x299fbf);}(_0xb43b,0x1b2));var _0xbb43=function(_0x39cefb,_0x122771){_0x39cefb=_0x39cefb-0x0;var _0x22d2c2=_0xb43b[_0x39cefb];return _0x22d2c2;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4cb7267..792a782 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 _0x1c69=['catch','params','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','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','save','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','rows'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c69,0x1c2));var _0x91c6=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x1c69[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0x91c6('0x0'));var rimraf=require(_0x91c6('0x1'));var zipdir=require(_0x91c6('0x2'));var jsonpatch=require(_0x91c6('0x3'));var rp=require('request-promise');var moment=require(_0x91c6('0x4'));var BPromise=require(_0x91c6('0x5'));var Mustache=require('mustache');var util=require(_0x91c6('0x6'));var path=require(_0x91c6('0x7'));var sox=require(_0x91c6('0x8'));var csv=require(_0x91c6('0x9'));var ejs=require(_0x91c6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91c6('0xb'));var squel=require(_0x91c6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x91c6('0xd'));var toCsv=require(_0x91c6('0x9'));var querystring=require(_0x91c6('0xe'));var Papa=require('papaparse');var Redis=require(_0x91c6('0xf'));var authService=require(_0x91c6('0x10'));var qs=require(_0x91c6('0x11'));var as=require(_0x91c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91c6('0x13'))(_0x91c6('0x14'));var utils=require(_0x91c6('0x15'));var config=require(_0x91c6('0x16'));var licenseUtil=require(_0x91c6('0x17'));var db=require(_0x91c6('0x18'))['db'];function respondWithStatusCode(_0x4831e2,_0x931560){_0x931560=_0x931560||0xcc;return function(_0x46ffe8){if(_0x46ffe8){return _0x4831e2[_0x91c6('0x19')](_0x931560);}return _0x4831e2[_0x91c6('0x1a')](_0x931560)['end']();};}function respondWithResult(_0x4a564f,_0x36d8a2){_0x36d8a2=_0x36d8a2||0xc8;return function(_0x465ae9){if(_0x465ae9){return _0x4a564f[_0x91c6('0x1a')](_0x36d8a2)[_0x91c6('0x1b')](_0x465ae9);}};}function respondWithFilteredResult(_0x2ddfff,_0x3a9fcb){return function(_0x51974b){if(_0x51974b){var _0x1ca7ff=typeof _0x3a9fcb[_0x91c6('0x1c')]===_0x91c6('0x1d')&&typeof _0x3a9fcb[_0x91c6('0x1e')]===_0x91c6('0x1d');var _0x47a4e3=_0x51974b[_0x91c6('0x1f')];var _0x408321=_0x1ca7ff?0x0:_0x3a9fcb[_0x91c6('0x1c')];var _0x265494=_0x1ca7ff?_0x51974b[_0x91c6('0x1f')]:_0x3a9fcb['offset']+_0x3a9fcb[_0x91c6('0x1e')];var _0x4e169a;if(_0x265494>=_0x47a4e3){_0x265494=_0x47a4e3;_0x4e169a=0xc8;}else{_0x4e169a=0xce;}_0x2ddfff[_0x91c6('0x1a')](_0x4e169a);return _0x2ddfff['set']('Content-Range',_0x408321+'-'+_0x265494+'/'+_0x47a4e3)[_0x91c6('0x1b')](_0x51974b);}return null;};}function patchUpdates(_0x485e1e){return function(_0x2d120d){try{jsonpatch[_0x91c6('0x20')](_0x2d120d,_0x485e1e,!![]);}catch(_0x7a7bbe){return BPromise['reject'](_0x7a7bbe);}return _0x2d120d[_0x91c6('0x21')]();};}function saveUpdates(_0x2b490a,_0x460dfe){return function(_0x7e5d45){if(_0x7e5d45){return _0x7e5d45['update'](_0x2b490a)[_0x91c6('0x22')](function(_0x11c3f6){return _0x11c3f6;});}return null;};}function removeEntity(_0xded2db,_0x3e7c96){return function(_0x50fec9){if(_0x50fec9){return _0x50fec9[_0x91c6('0x23')]()[_0x91c6('0x22')](function(){_0xded2db[_0x91c6('0x1a')](0xcc)[_0x91c6('0x24')]();});}};}function handleEntityNotFound(_0x4e98c4,_0x2a74cc){return function(_0x478ce3){if(!_0x478ce3){_0x4e98c4[_0x91c6('0x19')](0x194);}return _0x478ce3;};}function handleError(_0x2c4ac3,_0x2e2a13){_0x2e2a13=_0x2e2a13||0x1f4;return function(_0x8dc26a){logger[_0x91c6('0x25')](_0x8dc26a[_0x91c6('0x26')]);if(_0x8dc26a[_0x91c6('0x27')]){delete _0x8dc26a[_0x91c6('0x27')];}_0x2c4ac3[_0x91c6('0x1a')](_0x2e2a13)[_0x91c6('0x28')](_0x8dc26a);};}exports[_0x91c6('0x29')]=function(_0x4c9727,_0x297ecd){var _0x476afc={},_0x26841c={},_0xa5533a={'count':0x0,'rows':[]};var _0x2d92be=_[_0x91c6('0x2a')](db[_0x91c6('0x2b')][_0x91c6('0x2c')],function(_0x398481){return{'name':_0x398481[_0x91c6('0x2d')],'type':_0x398481[_0x91c6('0x2e')][_0x91c6('0x2f')]};});_0x26841c['model']=_['map'](_0x2d92be,'name');_0x26841c['query']=_[_0x91c6('0x30')](_0x4c9727[_0x91c6('0x31')]);_0x26841c[_0x91c6('0x32')]=_[_0x91c6('0x33')](_0x26841c[_0x91c6('0x34')],_0x26841c[_0x91c6('0x31')]);_0x476afc[_0x91c6('0x35')]=_[_0x91c6('0x33')](_0x26841c[_0x91c6('0x34')],qs[_0x91c6('0x36')](_0x4c9727[_0x91c6('0x31')][_0x91c6('0x36')]));_0x476afc[_0x91c6('0x35')]=_0x476afc[_0x91c6('0x35')][_0x91c6('0x37')]?_0x476afc[_0x91c6('0x35')]:_0x26841c[_0x91c6('0x34')];if(!_0x4c9727[_0x91c6('0x31')][_0x91c6('0x38')](_0x91c6('0x39'))){_0x476afc['limit']=qs['limit'](_0x4c9727[_0x91c6('0x31')]['limit']);_0x476afc[_0x91c6('0x1c')]=qs[_0x91c6('0x1c')](_0x4c9727[_0x91c6('0x31')]['offset']);}_0x476afc[_0x91c6('0x3a')]=qs[_0x91c6('0x3b')](_0x4c9727[_0x91c6('0x31')][_0x91c6('0x3b')]);_0x476afc['where']=qs[_0x91c6('0x32')](_[_0x91c6('0x3c')](_0x4c9727[_0x91c6('0x31')],_0x26841c['filters']),_0x2d92be);if(_0x4c9727['query']['filter']){_0x476afc[_0x91c6('0x3d')]=_['merge'](_0x476afc['where'],{'$or':_[_0x91c6('0x2a')](_0x2d92be,function(_0x8aac5a){if(_0x8aac5a['type']!==_0x91c6('0x3e')){var _0x75ab9e={};_0x75ab9e[_0x8aac5a[_0x91c6('0x27')]]={'$like':'%'+_0x4c9727[_0x91c6('0x31')][_0x91c6('0x3f')]+'%'};return _0x75ab9e;}})});}_0x476afc=_['merge']({},_0x476afc,_0x4c9727[_0x91c6('0x40')]);var _0x3d29ab={'where':_0x476afc[_0x91c6('0x3d')]};return db[_0x91c6('0x2b')][_0x91c6('0x1f')](_0x3d29ab)[_0x91c6('0x22')](function(_0x2c332c){_0xa5533a['count']=_0x2c332c;if(_0x4c9727[_0x91c6('0x31')][_0x91c6('0x41')]){_0x476afc[_0x91c6('0x42')]=[{'all':!![]}];}return db[_0x91c6('0x2b')]['findAll'](_0x476afc);})['then'](function(_0x5edaf2){_0xa5533a[_0x91c6('0x43')]=_0x5edaf2;return _0xa5533a;})[_0x91c6('0x22')](respondWithFilteredResult(_0x297ecd,_0x476afc))[_0x91c6('0x44')](handleError(_0x297ecd,null));};exports['show']=function(_0x5c3aaf,_0x40c6bb){var _0x32f640={'raw':!![],'where':{'id':_0x5c3aaf[_0x91c6('0x45')]['id']}},_0x5cc8bc={};_0x5cc8bc[_0x91c6('0x34')]=_[_0x91c6('0x30')](db[_0x91c6('0x2b')][_0x91c6('0x2c')]);_0x5cc8bc['query']=_[_0x91c6('0x30')](_0x5c3aaf[_0x91c6('0x31')]);_0x5cc8bc['filters']=_[_0x91c6('0x33')](_0x5cc8bc[_0x91c6('0x34')],_0x5cc8bc['query']);_0x32f640['attributes']=_[_0x91c6('0x33')](_0x5cc8bc[_0x91c6('0x34')],qs['fields'](_0x5c3aaf['query'][_0x91c6('0x36')]));_0x32f640[_0x91c6('0x35')]=_0x32f640[_0x91c6('0x35')][_0x91c6('0x37')]?_0x32f640['attributes']:_0x5cc8bc['model'];if(_0x5c3aaf[_0x91c6('0x31')]['includeAll']){_0x32f640[_0x91c6('0x42')]=[{'all':!![]}];}_0x32f640=_['merge']({},_0x32f640,_0x5c3aaf[_0x91c6('0x40')]);return db[_0x91c6('0x2b')][_0x91c6('0x46')](_0x32f640)['then'](handleEntityNotFound(_0x40c6bb,null))[_0x91c6('0x22')](respondWithResult(_0x40c6bb,null))[_0x91c6('0x44')](handleError(_0x40c6bb,null));};exports[_0x91c6('0x47')]=function(_0x465cbb,_0x10f5f8){return db[_0x91c6('0x2b')][_0x91c6('0x47')](_0x465cbb['body'],{})[_0x91c6('0x22')](respondWithResult(_0x10f5f8,0xc9))[_0x91c6('0x44')](handleError(_0x10f5f8,null));};exports[_0x91c6('0x48')]=function(_0x3928d5,_0x1af0b5){if(_0x3928d5[_0x91c6('0x49')]['id']){delete _0x3928d5[_0x91c6('0x49')]['id'];}return db['OpenchannelTransferReport'][_0x91c6('0x46')]({'where':{'id':_0x3928d5[_0x91c6('0x45')]['id']}})['then'](handleEntityNotFound(_0x1af0b5,null))[_0x91c6('0x22')](saveUpdates(_0x3928d5[_0x91c6('0x49')],null))[_0x91c6('0x22')](respondWithResult(_0x1af0b5,null))[_0x91c6('0x44')](handleError(_0x1af0b5,null));};exports[_0x91c6('0x23')]=function(_0x4a604c,_0xd6dfb8){return db['OpenchannelTransferReport'][_0x91c6('0x46')]({'where':{'id':_0x4a604c[_0x91c6('0x45')]['id']}})['then'](handleEntityNotFound(_0xd6dfb8,null))[_0x91c6('0x22')](removeEntity(_0xd6dfb8,null))[_0x91c6('0x44')](handleError(_0xd6dfb8,null));};exports['describe']=function(_0x4eb476,_0x5571af){return db['OpenchannelTransferReport']['describe']()[_0x91c6('0x22')](respondWithResult(_0x5571af,null))[_0x91c6('0x44')](handleError(_0x5571af,null));}; \ No newline at end of file +var _0xbb26=['destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','OpenchannelTransferReport','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then'];(function(_0x5e61fd,_0x74dc08){var _0x2747b3=function(_0x3fa208){while(--_0x3fa208){_0x5e61fd['push'](_0x5e61fd['shift']());}};_0x2747b3(++_0x74dc08);}(_0xbb26,0x14e));var _0x6bb2=function(_0x2b7d8a,_0x39462d){_0x2b7d8a=_0x2b7d8a-0x0;var _0x30268f=_0xbb26[_0x2b7d8a];return _0x30268f;};'use strict';var emlformat=require(_0x6bb2('0x0'));var rimraf=require(_0x6bb2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bb2('0x2'));var moment=require(_0x6bb2('0x3'));var BPromise=require(_0x6bb2('0x4'));var Mustache=require(_0x6bb2('0x5'));var util=require(_0x6bb2('0x6'));var path=require(_0x6bb2('0x7'));var sox=require('sox');var csv=require(_0x6bb2('0x8'));var ejs=require(_0x6bb2('0x9'));var fs=require('fs');var fs_extra=require(_0x6bb2('0xa'));var _=require(_0x6bb2('0xb'));var squel=require(_0x6bb2('0xc'));var crypto=require('crypto');var jsforce=require(_0x6bb2('0xd'));var deskjs=require(_0x6bb2('0xe'));var toCsv=require(_0x6bb2('0x8'));var querystring=require(_0x6bb2('0xf'));var Papa=require(_0x6bb2('0x10'));var Redis=require(_0x6bb2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6bb2('0x12'));var as=require(_0x6bb2('0x13'));var hardwareService=require(_0x6bb2('0x14'));var logger=require(_0x6bb2('0x15'))(_0x6bb2('0x16'));var utils=require(_0x6bb2('0x17'));var config=require(_0x6bb2('0x18'));var licenseUtil=require(_0x6bb2('0x19'));var db=require(_0x6bb2('0x1a'))['db'];function respondWithStatusCode(_0x2d68ff,_0x11ee64){_0x11ee64=_0x11ee64||0xcc;return function(_0x7f442a){if(_0x7f442a){return _0x2d68ff[_0x6bb2('0x1b')](_0x11ee64);}return _0x2d68ff[_0x6bb2('0x1c')](_0x11ee64)[_0x6bb2('0x1d')]();};}function respondWithResult(_0x96e233,_0x288bbe){_0x288bbe=_0x288bbe||0xc8;return function(_0x2a5db7){if(_0x2a5db7){return _0x96e233[_0x6bb2('0x1c')](_0x288bbe)['json'](_0x2a5db7);}};}function respondWithFilteredResult(_0x2ecc7c,_0x6b65dc){return function(_0x6213df){if(_0x6213df){var _0x34a8ff=typeof _0x6b65dc[_0x6bb2('0x1e')]===_0x6bb2('0x1f')&&typeof _0x6b65dc[_0x6bb2('0x20')]===_0x6bb2('0x1f');var _0x28ea43=_0x6213df[_0x6bb2('0x21')];var _0x5745bc=_0x34a8ff?0x0:_0x6b65dc['offset'];var _0x2e71b0=_0x34a8ff?_0x6213df[_0x6bb2('0x21')]:_0x6b65dc['offset']+_0x6b65dc[_0x6bb2('0x20')];var _0x5857e6;if(_0x2e71b0>=_0x28ea43){_0x2e71b0=_0x28ea43;_0x5857e6=0xc8;}else{_0x5857e6=0xce;}_0x2ecc7c[_0x6bb2('0x1c')](_0x5857e6);return _0x2ecc7c[_0x6bb2('0x22')](_0x6bb2('0x23'),_0x5745bc+'-'+_0x2e71b0+'/'+_0x28ea43)[_0x6bb2('0x24')](_0x6213df);}return null;};}function patchUpdates(_0x1d2923){return function(_0xf9557c){try{jsonpatch[_0x6bb2('0x25')](_0xf9557c,_0x1d2923,!![]);}catch(_0x35e639){return BPromise[_0x6bb2('0x26')](_0x35e639);}return _0xf9557c['save']();};}function saveUpdates(_0x3f4416,_0x3c67cf){return function(_0xb7c22a){if(_0xb7c22a){return _0xb7c22a[_0x6bb2('0x27')](_0x3f4416)[_0x6bb2('0x28')](function(_0x45405b){return _0x45405b;});}return null;};}function removeEntity(_0x169e1f,_0xdad332){return function(_0x151e4f){if(_0x151e4f){return _0x151e4f[_0x6bb2('0x29')]()['then'](function(){_0x169e1f[_0x6bb2('0x1c')](0xcc)[_0x6bb2('0x1d')]();});}};}function handleEntityNotFound(_0x181180,_0x1cac9a){return function(_0x4ea126){if(!_0x4ea126){_0x181180[_0x6bb2('0x1b')](0x194);}return _0x4ea126;};}function handleError(_0x45193e,_0x3f2b38){_0x3f2b38=_0x3f2b38||0x1f4;return function(_0x1fc5e7){logger['error'](_0x1fc5e7['stack']);if(_0x1fc5e7['name']){delete _0x1fc5e7[_0x6bb2('0x2a')];}_0x45193e[_0x6bb2('0x1c')](_0x3f2b38)[_0x6bb2('0x2b')](_0x1fc5e7);};}exports[_0x6bb2('0x2c')]=function(_0x7e9370,_0x64da){var _0x5798bc={},_0xa8cec3={},_0x329d05={'count':0x0,'rows':[]};var _0x1e48db=_[_0x6bb2('0x2d')](db['OpenchannelTransferReport'][_0x6bb2('0x2e')],function(_0x53d911){return{'name':_0x53d911[_0x6bb2('0x2f')],'type':_0x53d911[_0x6bb2('0x30')]['key']};});_0xa8cec3[_0x6bb2('0x31')]=_[_0x6bb2('0x2d')](_0x1e48db,_0x6bb2('0x2a'));_0xa8cec3[_0x6bb2('0x32')]=_[_0x6bb2('0x33')](_0x7e9370[_0x6bb2('0x32')]);_0xa8cec3[_0x6bb2('0x34')]=_['intersection'](_0xa8cec3[_0x6bb2('0x31')],_0xa8cec3[_0x6bb2('0x32')]);_0x5798bc['attributes']=_[_0x6bb2('0x35')](_0xa8cec3[_0x6bb2('0x31')],qs[_0x6bb2('0x36')](_0x7e9370[_0x6bb2('0x32')][_0x6bb2('0x36')]));_0x5798bc['attributes']=_0x5798bc[_0x6bb2('0x37')][_0x6bb2('0x38')]?_0x5798bc[_0x6bb2('0x37')]:_0xa8cec3[_0x6bb2('0x31')];if(!_0x7e9370['query'][_0x6bb2('0x39')](_0x6bb2('0x3a'))){_0x5798bc[_0x6bb2('0x20')]=qs[_0x6bb2('0x20')](_0x7e9370[_0x6bb2('0x32')]['limit']);_0x5798bc[_0x6bb2('0x1e')]=qs[_0x6bb2('0x1e')](_0x7e9370[_0x6bb2('0x32')][_0x6bb2('0x1e')]);}_0x5798bc[_0x6bb2('0x3b')]=qs[_0x6bb2('0x3c')](_0x7e9370[_0x6bb2('0x32')]['sort']);_0x5798bc[_0x6bb2('0x3d')]=qs['filters'](_[_0x6bb2('0x3e')](_0x7e9370[_0x6bb2('0x32')],_0xa8cec3['filters']),_0x1e48db);if(_0x7e9370[_0x6bb2('0x32')][_0x6bb2('0x3f')]){_0x5798bc[_0x6bb2('0x3d')]=_[_0x6bb2('0x40')](_0x5798bc[_0x6bb2('0x3d')],{'$or':_[_0x6bb2('0x2d')](_0x1e48db,function(_0x3e26f0){if(_0x3e26f0[_0x6bb2('0x30')]!=='VIRTUAL'){var _0x533621={};_0x533621[_0x3e26f0[_0x6bb2('0x2a')]]={'$like':'%'+_0x7e9370['query'][_0x6bb2('0x3f')]+'%'};return _0x533621;}})});}_0x5798bc=_[_0x6bb2('0x40')]({},_0x5798bc,_0x7e9370[_0x6bb2('0x41')]);var _0x7ce748={'where':_0x5798bc[_0x6bb2('0x3d')]};return db['OpenchannelTransferReport']['count'](_0x7ce748)[_0x6bb2('0x28')](function(_0x363fb4){_0x329d05[_0x6bb2('0x21')]=_0x363fb4;if(_0x7e9370[_0x6bb2('0x32')][_0x6bb2('0x42')]){_0x5798bc[_0x6bb2('0x43')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x6bb2('0x44')](_0x5798bc);})[_0x6bb2('0x28')](function(_0x27e400){_0x329d05['rows']=_0x27e400;return _0x329d05;})[_0x6bb2('0x28')](respondWithFilteredResult(_0x64da,_0x5798bc))[_0x6bb2('0x45')](handleError(_0x64da,null));};exports['show']=function(_0x4e3120,_0x498674){var _0x25c6e6={'raw':!![],'where':{'id':_0x4e3120[_0x6bb2('0x46')]['id']}},_0x3e6c63={};_0x3e6c63[_0x6bb2('0x31')]=_[_0x6bb2('0x33')](db[_0x6bb2('0x47')][_0x6bb2('0x2e')]);_0x3e6c63['query']=_['keys'](_0x4e3120[_0x6bb2('0x32')]);_0x3e6c63[_0x6bb2('0x34')]=_[_0x6bb2('0x35')](_0x3e6c63['model'],_0x3e6c63[_0x6bb2('0x32')]);_0x25c6e6[_0x6bb2('0x37')]=_[_0x6bb2('0x35')](_0x3e6c63['model'],qs['fields'](_0x4e3120[_0x6bb2('0x32')][_0x6bb2('0x36')]));_0x25c6e6[_0x6bb2('0x37')]=_0x25c6e6['attributes']['length']?_0x25c6e6[_0x6bb2('0x37')]:_0x3e6c63[_0x6bb2('0x31')];if(_0x4e3120[_0x6bb2('0x32')][_0x6bb2('0x42')]){_0x25c6e6['include']=[{'all':!![]}];}_0x25c6e6=_['merge']({},_0x25c6e6,_0x4e3120['options']);return db[_0x6bb2('0x47')][_0x6bb2('0x48')](_0x25c6e6)[_0x6bb2('0x28')](handleEntityNotFound(_0x498674,null))['then'](respondWithResult(_0x498674,null))[_0x6bb2('0x45')](handleError(_0x498674,null));};exports[_0x6bb2('0x49')]=function(_0x28aea4,_0x17bba9){return db[_0x6bb2('0x47')]['create'](_0x28aea4[_0x6bb2('0x4a')],{})[_0x6bb2('0x28')](respondWithResult(_0x17bba9,0xc9))[_0x6bb2('0x45')](handleError(_0x17bba9,null));};exports[_0x6bb2('0x27')]=function(_0x381b50,_0x5e56cc){if(_0x381b50[_0x6bb2('0x4a')]['id']){delete _0x381b50[_0x6bb2('0x4a')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x381b50[_0x6bb2('0x46')]['id']}})[_0x6bb2('0x28')](handleEntityNotFound(_0x5e56cc,null))[_0x6bb2('0x28')](saveUpdates(_0x381b50[_0x6bb2('0x4a')],null))[_0x6bb2('0x28')](respondWithResult(_0x5e56cc,null))['catch'](handleError(_0x5e56cc,null));};exports[_0x6bb2('0x29')]=function(_0x382489,_0x382f1d){return db[_0x6bb2('0x47')][_0x6bb2('0x48')]({'where':{'id':_0x382489[_0x6bb2('0x46')]['id']}})[_0x6bb2('0x28')](handleEntityNotFound(_0x382f1d,null))[_0x6bb2('0x28')](removeEntity(_0x382f1d,null))[_0x6bb2('0x45')](handleError(_0x382f1d,null));};exports['describe']=function(_0x15b68a,_0x4e19ed){return db[_0x6bb2('0x47')]['describe']()['then'](respondWithResult(_0x4e19ed,null))[_0x6bb2('0x45')](handleError(_0x4e19ed,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0ca47bc..8bf37e4 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 _0xd8e8=['./openchannelTransferReport.attributes','exports','define','uniqueid','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b0fda,_0x4cfaec){var _0x3acf71=function(_0x2448c2){while(--_0x2448c2){_0x2b0fda['push'](_0x2b0fda['shift']());}};_0x3acf71(++_0x4cfaec);}(_0xd8e8,0x16c));var _0x8d8e=function(_0x659dc1,_0x1b9820){_0x659dc1=_0x659dc1-0x0;var _0x11e921=_0xd8e8[_0x659dc1];return _0x11e921;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8d8e('0x0'))('api');var moment=require(_0x8d8e('0x1'));var BPromise=require(_0x8d8e('0x2'));var rp=require(_0x8d8e('0x3'));var fs=require('fs');var path=require(_0x8d8e('0x4'));var rimraf=require(_0x8d8e('0x5'));var config=require('../../config/environment');var attributes=require(_0x8d8e('0x6'));module[_0x8d8e('0x7')]=function(_0x58d988,_0x29186a){return _0x58d988[_0x8d8e('0x8')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8d8e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf95a=['../../config/logger','api','moment','bluebird','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid'];(function(_0x1e6696,_0x809ef){var _0x4fb996=function(_0x4ba2ae){while(--_0x4ba2ae){_0x1e6696['push'](_0x1e6696['shift']());}};_0x4fb996(++_0x809ef);}(_0xf95a,0x1d9));var _0xaf95=function(_0x2166bc,_0x31b27c){_0x2166bc=_0x2166bc-0x0;var _0x10d6b4=_0xf95a[_0x2166bc];return _0x10d6b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaf95('0x0'))(_0xaf95('0x1'));var moment=require(_0xaf95('0x2'));var BPromise=require(_0xaf95('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf95('0x4'));var rimraf=require(_0xaf95('0x5'));var config=require('../../config/environment');var attributes=require(_0xaf95('0x6'));module[_0xaf95('0x7')]=function(_0x3aaa7f,_0x51e046){return _0x3aaa7f[_0xaf95('0x8')](_0xaf95('0x9'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xaf95('0xa'),'fields':[_0xaf95('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 2b6de7a..16becf9 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 _0x3fa4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','OpenchannelTransferReport,\x20%s,\x20%s','result','catch','lodash','randomstring'];(function(_0x1c443f,_0x51319d){var _0x4a4a71=function(_0x355b73){while(--_0x355b73){_0x1c443f['push'](_0x1c443f['shift']());}};_0x4a4a71(++_0x51319d);}(_0x3fa4,0xf0));var _0x43fa=function(_0x459d45,_0x26908d){_0x459d45=_0x459d45-0x0;var _0x322980=_0x3fa4[_0x459d45];return _0x322980;};'use strict';var _=require(_0x43fa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x43fa('0x1'));var fs=require('fs');var Redis=require(_0x43fa('0x2'));var db=require(_0x43fa('0x3'))['db'];var utils=require(_0x43fa('0x4'));var logger=require(_0x43fa('0x5'))(_0x43fa('0x6'));var config=require(_0x43fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x43fa('0x8')][_0x43fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6df71c,_0x584209,_0x3dc891){return new BPromise(function(_0x46adc7,_0x1dc401){return client['request'](_0x6df71c,_0x3dc891)[_0x43fa('0xa')](function(_0x36d40d){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x584209,_0x43fa('0xb'));logger[_0x43fa('0xc')](_0x43fa('0xd'),_0x584209,_0x43fa('0xb'),JSON[_0x43fa('0xe')](_0x36d40d));if(_0x36d40d['error']){if(_0x36d40d[_0x43fa('0xf')][_0x43fa('0x10')]===0x1f4){logger[_0x43fa('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x584209,_0x36d40d[_0x43fa('0xf')][_0x43fa('0x11')]);return _0x1dc401(_0x36d40d[_0x43fa('0xf')]['message']);}logger[_0x43fa('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x584209,_0x36d40d['error']['message']);return _0x46adc7(_0x36d40d[_0x43fa('0xf')]['message']);}else{logger[_0x43fa('0x12')](_0x43fa('0x13'),_0x584209,'request\x20sent');_0x46adc7(_0x36d40d[_0x43fa('0x14')][_0x43fa('0x11')]);}})[_0x43fa('0x15')](function(_0x2439d4){logger[_0x43fa('0xf')](_0x43fa('0x13'),_0x584209,_0x2439d4);_0x1dc401(_0x2439d4);});});} \ No newline at end of file +var _0x5183=['../../config/utils','../../config/logger','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0x5183,0x13e));var _0x3518=function(_0x4f594c,_0x2c4d65){_0x4f594c=_0x4f594c-0x0;var _0x4472af=_0x5183[_0x4f594c];return _0x4472af;};'use strict';var _=require(_0x3518('0x0'));var util=require(_0x3518('0x1'));var moment=require(_0x3518('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3518('0x3'));var db=require(_0x3518('0x4'))['db'];var utils=require(_0x3518('0x5'));var logger=require(_0x3518('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3518('0x7'));var client=jayson[_0x3518('0x8')][_0x3518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482b2d,_0x5cd139,_0x488c52){return new BPromise(function(_0x147b59,_0x33e66c){return client[_0x3518('0xa')](_0x482b2d,_0x488c52)['then'](function(_0x12530b){logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));logger[_0x3518('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x5cd139,_0x3518('0xc'),JSON[_0x3518('0xe')](_0x12530b));if(_0x12530b['error']){if(_0x12530b[_0x3518('0xf')][_0x3518('0x10')]===0x1f4){logger[_0x3518('0xf')](_0x3518('0xb'),_0x5cd139,_0x12530b['error']['message']);return _0x33e66c(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}logger[_0x3518('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x5cd139,_0x12530b['error'][_0x3518('0x11')]);return _0x147b59(_0x12530b[_0x3518('0xf')][_0x3518('0x11')]);}else{logger['info'](_0x3518('0xb'),_0x5cd139,_0x3518('0xc'));_0x147b59(_0x12530b[_0x3518('0x12')][_0x3518('0x11')]);}})['catch'](function(_0xc7f658){logger['error'](_0x3518('0xb'),_0x5cd139,_0xc7f658);_0x33e66c(_0xc7f658);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 5784292..39e8ce3 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 _0xa4c7=['/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index'];(function(_0x22d4b8,_0x12a78c){var _0x2d4848=function(_0x2fb969){while(--_0x2fb969){_0x22d4b8['push'](_0x22d4b8['shift']());}};_0x2d4848(++_0x12a78c);}(_0xa4c7,0x182));var _0x7a4c=function(_0x22dd5a,_0xa5da5d){_0x22dd5a=_0x22dd5a-0x0;var _0x21a1f3=_0xa4c7[_0x22dd5a];return _0x21a1f3;};'use strict';var multer=require(_0x7a4c('0x0'));var util=require(_0x7a4c('0x1'));var path=require(_0x7a4c('0x2'));var timeout=require(_0x7a4c('0x3'));var express=require(_0x7a4c('0x4'));var router=express[_0x7a4c('0x5')]();var fs_extra=require(_0x7a4c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7a4c('0x7'));var config=require(_0x7a4c('0x8'));var controller=require(_0x7a4c('0x9'));router[_0x7a4c('0xa')]('/',auth[_0x7a4c('0xb')](),controller[_0x7a4c('0xc')]);router[_0x7a4c('0xa')](_0x7a4c('0xd'),auth[_0x7a4c('0xb')](),controller[_0x7a4c('0xe')]);router[_0x7a4c('0xf')]('/',auth[_0x7a4c('0xb')](),controller[_0x7a4c('0x10')]);router['put'](_0x7a4c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x7a4c('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7a4c('0x12')]=router; \ No newline at end of file +var _0xe187=['create','put','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','/:id','show','post'];(function(_0x56f2df,_0x75be04){var _0x12f845=function(_0x26b0c6){while(--_0x26b0c6){_0x56f2df['push'](_0x56f2df['shift']());}};_0x12f845(++_0x75be04);}(_0xe187,0x126));var _0x7e18=function(_0xda7c25,_0x256fc4){_0xda7c25=_0xda7c25-0x0;var _0x1ef7db=_0xe187[_0xda7c25];return _0x1ef7db;};'use strict';var multer=require(_0x7e18('0x0'));var util=require(_0x7e18('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7e18('0x2')]();var fs_extra=require(_0x7e18('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7e18('0x4'));var config=require(_0x7e18('0x5'));var controller=require(_0x7e18('0x6'));router['get']('/',auth[_0x7e18('0x7')](),controller[_0x7e18('0x8')]);router['get'](_0x7e18('0x9'),auth[_0x7e18('0x7')](),controller[_0x7e18('0xa')]);router[_0x7e18('0xb')]('/',auth[_0x7e18('0x7')](),controller[_0x7e18('0xc')]);router[_0x7e18('0xd')](_0x7e18('0x9'),auth['isAuthenticated'](),controller[_0x7e18('0xe')]);router['delete'](_0x7e18('0x9'),auth[_0x7e18('0x7')](),controller[_0x7e18('0xf')]);module[_0x7e18('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4624ce5..940b20d 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 _0x629a=['STRING','name','sequelize'];(function(_0xdbd3af,_0x13ba95){var _0x43ae68=function(_0x2d7bf7){while(--_0x2d7bf7){_0xdbd3af['push'](_0xdbd3af['shift']());}};_0x43ae68(++_0x13ba95);}(_0x629a,0x185));var _0xa629=function(_0x5a90b3,_0x59fcba){_0x5a90b3=_0x5a90b3-0x0;var _0x533973=_0x629a[_0x5a90b3];return _0x533973;};'use strict';var Sequelize=require(_0xa629('0x0'));module['exports']={'name':{'type':Sequelize[_0xa629('0x1')],'unique':_0xa629('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xa629('0x1')]}}; \ No newline at end of file +var _0xd0c7=['sequelize','exports','STRING','name'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xd0c7,0x124));var _0x7d0c=function(_0x1d6e4c,_0x211af6){_0x1d6e4c=_0x1d6e4c-0x0;var _0x591cdf=_0xd0c7[_0x1d6e4c];return _0x591cdf;};'use strict';var Sequelize=require(_0x7d0c('0x0'));module[_0x7d0c('0x1')]={'name':{'type':Sequelize[_0x7d0c('0x2')],'unique':_0x7d0c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7d0c('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7b53bfa..342144b 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 _0x81ca=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Pauses','error','stack','name','Pause','fieldName','type','model','map','keys','intersection','query','fields','attributes','length','order','where','filters','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','params','eml-format','rimraf'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x81ca,0x17a));var _0xa81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81ca[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa81c('0x0'));var rimraf=require(_0xa81c('0x1'));var zipdir=require(_0xa81c('0x2'));var jsonpatch=require(_0xa81c('0x3'));var rp=require(_0xa81c('0x4'));var moment=require('moment');var BPromise=require(_0xa81c('0x5'));var Mustache=require(_0xa81c('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa81c('0x7'));var ejs=require(_0xa81c('0x8'));var fs=require('fs');var fs_extra=require(_0xa81c('0x9'));var _=require(_0xa81c('0xa'));var squel=require(_0xa81c('0xb'));var crypto=require(_0xa81c('0xc'));var jsforce=require(_0xa81c('0xd'));var deskjs=require(_0xa81c('0xe'));var toCsv=require(_0xa81c('0x7'));var querystring=require('querystring');var Papa=require(_0xa81c('0xf'));var Redis=require(_0xa81c('0x10'));var authService=require(_0xa81c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa81c('0x12'));var hardwareService=require(_0xa81c('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa81c('0x14'));var licenseUtil=require(_0xa81c('0x15'));var db=require(_0xa81c('0x16'))['db'];function respondWithStatusCode(_0x27bd5a,_0x266218){_0x266218=_0x266218||0xcc;return function(_0x2fd4cb){if(_0x2fd4cb){return _0x27bd5a[_0xa81c('0x17')](_0x266218);}return _0x27bd5a[_0xa81c('0x18')](_0x266218)[_0xa81c('0x19')]();};}function respondWithResult(_0x63536a,_0xc4b43d){_0xc4b43d=_0xc4b43d||0xc8;return function(_0x5b364d){if(_0x5b364d){return _0x63536a[_0xa81c('0x18')](_0xc4b43d)[_0xa81c('0x1a')](_0x5b364d);}};}function respondWithFilteredResult(_0x2c2c4c,_0x3ecded){return function(_0x5a864f){if(_0x5a864f){var _0x12fd3e=typeof _0x3ecded[_0xa81c('0x1b')]===_0xa81c('0x1c')&&typeof _0x3ecded[_0xa81c('0x1d')]===_0xa81c('0x1c');var _0x6694ea=_0x5a864f[_0xa81c('0x1e')];var _0x208003=_0x12fd3e?0x0:_0x3ecded['offset'];var _0x39ed42=_0x12fd3e?_0x5a864f[_0xa81c('0x1e')]:_0x3ecded[_0xa81c('0x1b')]+_0x3ecded[_0xa81c('0x1d')];var _0x269b7f;if(_0x39ed42>=_0x6694ea){_0x39ed42=_0x6694ea;_0x269b7f=0xc8;}else{_0x269b7f=0xce;}_0x2c2c4c[_0xa81c('0x18')](_0x269b7f);return _0x2c2c4c[_0xa81c('0x1f')](_0xa81c('0x20'),_0x208003+'-'+_0x39ed42+'/'+_0x6694ea)['json'](_0x5a864f);}return null;};}function patchUpdates(_0x214942){return function(_0x3125b1){try{jsonpatch[_0xa81c('0x21')](_0x3125b1,_0x214942,!![]);}catch(_0x2b819c){return BPromise['reject'](_0x2b819c);}return _0x3125b1['save']();};}function saveUpdates(_0x15ef8b,_0x3c5093){return function(_0x52a4d1){if(_0x52a4d1){return _0x52a4d1[_0xa81c('0x22')](_0x15ef8b)[_0xa81c('0x23')](function(_0x33a13e){return _0x33a13e;});}return null;};}function removeEntity(_0x5a8e8f,_0x51da70){return function(_0xf47888){if(_0xf47888){return _0xf47888[_0xa81c('0x24')]()['then'](function(){var _0xcfe847=_0xf47888[_0xa81c('0x25')]({'plain':!![]});var _0x125025=_0xa81c('0x26');return db['UserProfileResource'][_0xa81c('0x24')]({'where':{'type':_0x125025,'resourceId':_0xcfe847['id']}})[_0xa81c('0x23')](function(){return _0xf47888;});})[_0xa81c('0x23')](function(){_0x5a8e8f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37f8b9,_0x594b69){return function(_0xa897e){if(!_0xa897e){_0x37f8b9[_0xa81c('0x17')](0x194);}return _0xa897e;};}function handleError(_0x31dd21,_0x528c02){_0x528c02=_0x528c02||0x1f4;return function(_0x125d6e){logger[_0xa81c('0x27')](_0x125d6e[_0xa81c('0x28')]);if(_0x125d6e[_0xa81c('0x29')]){delete _0x125d6e[_0xa81c('0x29')];}_0x31dd21['status'](_0x528c02)['send'](_0x125d6e);};}exports['index']=function(_0x590cc9,_0x4adedf){var _0x25e6b9={},_0x1c0ad2={},_0x1450ea={'count':0x0,'rows':[]};var _0x1d8aa0=_['map'](db[_0xa81c('0x2a')]['rawAttributes'],function(_0x37d1bf){return{'name':_0x37d1bf[_0xa81c('0x2b')],'type':_0x37d1bf[_0xa81c('0x2c')]['key']};});_0x1c0ad2[_0xa81c('0x2d')]=_[_0xa81c('0x2e')](_0x1d8aa0,'name');_0x1c0ad2['query']=_[_0xa81c('0x2f')](_0x590cc9['query']);_0x1c0ad2['filters']=_[_0xa81c('0x30')](_0x1c0ad2['model'],_0x1c0ad2[_0xa81c('0x31')]);_0x25e6b9['attributes']=_[_0xa81c('0x30')](_0x1c0ad2['model'],qs[_0xa81c('0x32')](_0x590cc9['query']['fields']));_0x25e6b9[_0xa81c('0x33')]=_0x25e6b9[_0xa81c('0x33')][_0xa81c('0x34')]?_0x25e6b9[_0xa81c('0x33')]:_0x1c0ad2[_0xa81c('0x2d')];if(!_0x590cc9['query']['hasOwnProperty']('nolimit')){_0x25e6b9['limit']=qs[_0xa81c('0x1d')](_0x590cc9['query'][_0xa81c('0x1d')]);_0x25e6b9[_0xa81c('0x1b')]=qs[_0xa81c('0x1b')](_0x590cc9[_0xa81c('0x31')][_0xa81c('0x1b')]);}_0x25e6b9[_0xa81c('0x35')]=qs['sort'](_0x590cc9[_0xa81c('0x31')]['sort']);_0x25e6b9[_0xa81c('0x36')]=qs['filters'](_['pick'](_0x590cc9[_0xa81c('0x31')],_0x1c0ad2[_0xa81c('0x37')]),_0x1d8aa0);if(_0x590cc9[_0xa81c('0x31')][_0xa81c('0x38')]){_0x25e6b9[_0xa81c('0x36')]=_[_0xa81c('0x39')](_0x25e6b9[_0xa81c('0x36')],{'$or':_['map'](_0x1d8aa0,function(_0x59ed50){if(_0x59ed50[_0xa81c('0x2c')]!=='VIRTUAL'){var _0x347511={};_0x347511[_0x59ed50['name']]={'$like':'%'+_0x590cc9[_0xa81c('0x31')][_0xa81c('0x38')]+'%'};return _0x347511;}})});}_0x25e6b9=_[_0xa81c('0x39')]({},_0x25e6b9,_0x590cc9['options']);var _0x23f82b={'where':_0x25e6b9['where']};return db['Pause']['count'](_0x23f82b)['then'](function(_0x498c88){_0x1450ea['count']=_0x498c88;if(_0x590cc9['query'][_0xa81c('0x3a')]){_0x25e6b9[_0xa81c('0x3b')]=[{'all':!![]}];}return db[_0xa81c('0x2a')][_0xa81c('0x3c')](_0x25e6b9);})['then'](function(_0x2af23d){_0x1450ea[_0xa81c('0x3d')]=_0x2af23d;return _0x1450ea;})['then'](respondWithFilteredResult(_0x4adedf,_0x25e6b9))[_0xa81c('0x3e')](handleError(_0x4adedf,null));};exports[_0xa81c('0x3f')]=function(_0x52bdea,_0xb81785){var _0x21453b={'raw':!![],'where':{'id':_0x52bdea['params']['id']}},_0x37f87e={};_0x37f87e[_0xa81c('0x2d')]=_[_0xa81c('0x2f')](db['Pause']['rawAttributes']);_0x37f87e[_0xa81c('0x31')]=_['keys'](_0x52bdea[_0xa81c('0x31')]);_0x37f87e['filters']=_['intersection'](_0x37f87e[_0xa81c('0x2d')],_0x37f87e[_0xa81c('0x31')]);_0x21453b['attributes']=_[_0xa81c('0x30')](_0x37f87e['model'],qs[_0xa81c('0x32')](_0x52bdea['query'][_0xa81c('0x32')]));_0x21453b['attributes']=_0x21453b['attributes'][_0xa81c('0x34')]?_0x21453b['attributes']:_0x37f87e[_0xa81c('0x2d')];if(_0x52bdea[_0xa81c('0x31')]['includeAll']){_0x21453b[_0xa81c('0x3b')]=[{'all':!![]}];}_0x21453b=_[_0xa81c('0x39')]({},_0x21453b,_0x52bdea[_0xa81c('0x40')]);return db[_0xa81c('0x2a')]['find'](_0x21453b)[_0xa81c('0x23')](handleEntityNotFound(_0xb81785,null))[_0xa81c('0x23')](respondWithResult(_0xb81785,null))[_0xa81c('0x3e')](handleError(_0xb81785,null));};exports['create']=function(_0x376cd5,_0x55d8c5){return db['Pause'][_0xa81c('0x41')](_0x376cd5[_0xa81c('0x42')],{})[_0xa81c('0x23')](function(_0x2b5965){var _0x4922c4=_0x376cd5['user'][_0xa81c('0x25')]({'plain':!![]});if(!_0x4922c4)throw new Error(_0xa81c('0x43'));if(_0x4922c4[_0xa81c('0x44')]===_0xa81c('0x45')){var _0x5291da=_0x2b5965[_0xa81c('0x25')]({'plain':!![]});var _0x51a287=_0xa81c('0x26');return db[_0xa81c('0x46')][_0xa81c('0x47')]({'where':{'name':_0x51a287,'userProfileId':_0x4922c4[_0xa81c('0x48')]},'raw':!![]})[_0xa81c('0x23')](function(_0x85249){if(_0x85249&&_0x85249[_0xa81c('0x49')]===0x0){return db[_0xa81c('0x4a')][_0xa81c('0x41')]({'name':_0x5291da['name'],'resourceId':_0x5291da['id'],'type':_0x85249[_0xa81c('0x29')],'sectionId':_0x85249['id']},{})['then'](function(){return _0x2b5965;});}else{return _0x2b5965;}})[_0xa81c('0x3e')](function(_0x1b4313){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b4313);throw _0x1b4313;});}return _0x2b5965;})[_0xa81c('0x23')](respondWithResult(_0x55d8c5,0xc9))[_0xa81c('0x3e')](handleError(_0x55d8c5,null));};exports[_0xa81c('0x22')]=function(_0x57b189,_0x7295fe){if(_0x57b189[_0xa81c('0x42')]['id']){delete _0x57b189[_0xa81c('0x42')]['id'];}return db[_0xa81c('0x2a')][_0xa81c('0x47')]({'where':{'id':_0x57b189[_0xa81c('0x4b')]['id']}})[_0xa81c('0x23')](handleEntityNotFound(_0x7295fe,null))[_0xa81c('0x23')](saveUpdates(_0x57b189[_0xa81c('0x42')],null))[_0xa81c('0x23')](respondWithResult(_0x7295fe,null))[_0xa81c('0x3e')](handleError(_0x7295fe,null));};exports[_0xa81c('0x24')]=function(_0x3128b9,_0x310b46){return db[_0xa81c('0x2a')][_0xa81c('0x47')]({'where':{'id':_0x3128b9[_0xa81c('0x4b')]['id']}})[_0xa81c('0x23')](handleEntityNotFound(_0x310b46,null))['then'](removeEntity(_0x310b46,null))['catch'](handleError(_0x310b46,null));}; \ No newline at end of file +var _0x13d9=['get','UserProfileResource','end','error','stack','name','index','map','Pause','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','update','then','destroy'];(function(_0x3a7042,_0x47eaba){var _0x2e3e5b=function(_0x3d062c){while(--_0x3d062c){_0x3a7042['push'](_0x3a7042['shift']());}};_0x2e3e5b(++_0x47eaba);}(_0x13d9,0x7d));var _0x913d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13d9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x913d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x913d('0x1'));var jsonpatch=require(_0x913d('0x2'));var rp=require(_0x913d('0x3'));var moment=require('moment');var BPromise=require(_0x913d('0x4'));var Mustache=require('mustache');var util=require(_0x913d('0x5'));var path=require(_0x913d('0x6'));var sox=require(_0x913d('0x7'));var csv=require('to-csv');var ejs=require(_0x913d('0x8'));var fs=require('fs');var fs_extra=require(_0x913d('0x9'));var _=require(_0x913d('0xa'));var squel=require(_0x913d('0xb'));var crypto=require(_0x913d('0xc'));var jsforce=require(_0x913d('0xd'));var deskjs=require(_0x913d('0xe'));var toCsv=require(_0x913d('0xf'));var querystring=require(_0x913d('0x10'));var Papa=require(_0x913d('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x913d('0x12'));var as=require(_0x913d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x913d('0x14'));var utils=require(_0x913d('0x15'));var config=require(_0x913d('0x16'));var licenseUtil=require(_0x913d('0x17'));var db=require(_0x913d('0x18'))['db'];function respondWithStatusCode(_0x28a6b2,_0x27a2ed){_0x27a2ed=_0x27a2ed||0xcc;return function(_0x4d6003){if(_0x4d6003){return _0x28a6b2[_0x913d('0x19')](_0x27a2ed);}return _0x28a6b2['status'](_0x27a2ed)['end']();};}function respondWithResult(_0xc5701b,_0x4106f3){_0x4106f3=_0x4106f3||0xc8;return function(_0x3bdb23){if(_0x3bdb23){return _0xc5701b[_0x913d('0x1a')](_0x4106f3)['json'](_0x3bdb23);}};}function respondWithFilteredResult(_0x2c51fc,_0x46fcca){return function(_0x5af380){if(_0x5af380){var _0x275090=typeof _0x46fcca[_0x913d('0x1b')]===_0x913d('0x1c')&&typeof _0x46fcca[_0x913d('0x1d')]==='undefined';var _0x188f10=_0x5af380[_0x913d('0x1e')];var _0x365e5a=_0x275090?0x0:_0x46fcca['offset'];var _0x31e450=_0x275090?_0x5af380[_0x913d('0x1e')]:_0x46fcca[_0x913d('0x1b')]+_0x46fcca[_0x913d('0x1d')];var _0x52d7c1;if(_0x31e450>=_0x188f10){_0x31e450=_0x188f10;_0x52d7c1=0xc8;}else{_0x52d7c1=0xce;}_0x2c51fc[_0x913d('0x1a')](_0x52d7c1);return _0x2c51fc[_0x913d('0x1f')]('Content-Range',_0x365e5a+'-'+_0x31e450+'/'+_0x188f10)[_0x913d('0x20')](_0x5af380);}return null;};}function patchUpdates(_0x3ac218){return function(_0x525b1a){try{jsonpatch['apply'](_0x525b1a,_0x3ac218,!![]);}catch(_0x3f4fcf){return BPromise[_0x913d('0x21')](_0x3f4fcf);}return _0x525b1a['save']();};}function saveUpdates(_0x198597,_0xd92ad9){return function(_0x51323b){if(_0x51323b){return _0x51323b[_0x913d('0x22')](_0x198597)[_0x913d('0x23')](function(_0x54ad1a){return _0x54ad1a;});}return null;};}function removeEntity(_0x22e1c9,_0x539302){return function(_0x28778c){if(_0x28778c){return _0x28778c[_0x913d('0x24')]()['then'](function(){var _0x186629=_0x28778c[_0x913d('0x25')]({'plain':!![]});var _0x1d4c59='Pauses';return db[_0x913d('0x26')][_0x913d('0x24')]({'where':{'type':_0x1d4c59,'resourceId':_0x186629['id']}})['then'](function(){return _0x28778c;});})[_0x913d('0x23')](function(){_0x22e1c9[_0x913d('0x1a')](0xcc)[_0x913d('0x27')]();});}};}function handleEntityNotFound(_0x42a2ed,_0x4541a1){return function(_0x3c47ae){if(!_0x3c47ae){_0x42a2ed[_0x913d('0x19')](0x194);}return _0x3c47ae;};}function handleError(_0x55f678,_0x355035){_0x355035=_0x355035||0x1f4;return function(_0x603165){logger[_0x913d('0x28')](_0x603165[_0x913d('0x29')]);if(_0x603165[_0x913d('0x2a')]){delete _0x603165[_0x913d('0x2a')];}_0x55f678[_0x913d('0x1a')](_0x355035)['send'](_0x603165);};}exports[_0x913d('0x2b')]=function(_0x5486fb,_0x2bfd42){var _0x1630d1={},_0x1ac22c={},_0x2ca5ee={'count':0x0,'rows':[]};var _0x1e402d=_[_0x913d('0x2c')](db[_0x913d('0x2d')][_0x913d('0x2e')],function(_0x3e5551){return{'name':_0x3e5551[_0x913d('0x2f')],'type':_0x3e5551[_0x913d('0x30')][_0x913d('0x31')]};});_0x1ac22c[_0x913d('0x32')]=_[_0x913d('0x2c')](_0x1e402d,_0x913d('0x2a'));_0x1ac22c[_0x913d('0x33')]=_['keys'](_0x5486fb[_0x913d('0x33')]);_0x1ac22c['filters']=_['intersection'](_0x1ac22c['model'],_0x1ac22c['query']);_0x1630d1[_0x913d('0x34')]=_[_0x913d('0x35')](_0x1ac22c[_0x913d('0x32')],qs[_0x913d('0x36')](_0x5486fb['query'][_0x913d('0x36')]));_0x1630d1['attributes']=_0x1630d1[_0x913d('0x34')][_0x913d('0x37')]?_0x1630d1[_0x913d('0x34')]:_0x1ac22c['model'];if(!_0x5486fb[_0x913d('0x33')]['hasOwnProperty'](_0x913d('0x38'))){_0x1630d1[_0x913d('0x1d')]=qs[_0x913d('0x1d')](_0x5486fb[_0x913d('0x33')][_0x913d('0x1d')]);_0x1630d1[_0x913d('0x1b')]=qs[_0x913d('0x1b')](_0x5486fb[_0x913d('0x33')][_0x913d('0x1b')]);}_0x1630d1['order']=qs[_0x913d('0x39')](_0x5486fb[_0x913d('0x33')][_0x913d('0x39')]);_0x1630d1[_0x913d('0x3a')]=qs['filters'](_[_0x913d('0x3b')](_0x5486fb[_0x913d('0x33')],_0x1ac22c['filters']),_0x1e402d);if(_0x5486fb[_0x913d('0x33')][_0x913d('0x3c')]){_0x1630d1[_0x913d('0x3a')]=_[_0x913d('0x3d')](_0x1630d1[_0x913d('0x3a')],{'$or':_[_0x913d('0x2c')](_0x1e402d,function(_0x577ec7){if(_0x577ec7['type']!==_0x913d('0x3e')){var _0x2113ed={};_0x2113ed[_0x577ec7['name']]={'$like':'%'+_0x5486fb[_0x913d('0x33')][_0x913d('0x3c')]+'%'};return _0x2113ed;}})});}_0x1630d1=_[_0x913d('0x3d')]({},_0x1630d1,_0x5486fb[_0x913d('0x3f')]);var _0x4edd58={'where':_0x1630d1[_0x913d('0x3a')]};return db['Pause'][_0x913d('0x1e')](_0x4edd58)[_0x913d('0x23')](function(_0x5520a8){_0x2ca5ee[_0x913d('0x1e')]=_0x5520a8;if(_0x5486fb[_0x913d('0x33')][_0x913d('0x40')]){_0x1630d1[_0x913d('0x41')]=[{'all':!![]}];}return db[_0x913d('0x2d')][_0x913d('0x42')](_0x1630d1);})[_0x913d('0x23')](function(_0x58fca7){_0x2ca5ee[_0x913d('0x43')]=_0x58fca7;return _0x2ca5ee;})[_0x913d('0x23')](respondWithFilteredResult(_0x2bfd42,_0x1630d1))[_0x913d('0x44')](handleError(_0x2bfd42,null));};exports[_0x913d('0x45')]=function(_0x5057f0,_0x28cf28){var _0x4aa205={'raw':!![],'where':{'id':_0x5057f0['params']['id']}},_0x1ad860={};_0x1ad860[_0x913d('0x32')]=_[_0x913d('0x46')](db[_0x913d('0x2d')]['rawAttributes']);_0x1ad860[_0x913d('0x33')]=_['keys'](_0x5057f0[_0x913d('0x33')]);_0x1ad860['filters']=_[_0x913d('0x35')](_0x1ad860[_0x913d('0x32')],_0x1ad860[_0x913d('0x33')]);_0x4aa205[_0x913d('0x34')]=_[_0x913d('0x35')](_0x1ad860[_0x913d('0x32')],qs[_0x913d('0x36')](_0x5057f0[_0x913d('0x33')][_0x913d('0x36')]));_0x4aa205['attributes']=_0x4aa205[_0x913d('0x34')][_0x913d('0x37')]?_0x4aa205[_0x913d('0x34')]:_0x1ad860['model'];if(_0x5057f0[_0x913d('0x33')][_0x913d('0x40')]){_0x4aa205['include']=[{'all':!![]}];}_0x4aa205=_['merge']({},_0x4aa205,_0x5057f0[_0x913d('0x3f')]);return db[_0x913d('0x2d')][_0x913d('0x47')](_0x4aa205)[_0x913d('0x23')](handleEntityNotFound(_0x28cf28,null))[_0x913d('0x23')](respondWithResult(_0x28cf28,null))[_0x913d('0x44')](handleError(_0x28cf28,null));};exports[_0x913d('0x48')]=function(_0x1241af,_0x5a57db){return db['Pause']['create'](_0x1241af[_0x913d('0x49')],{})['then'](function(_0x872854){var _0x994eaa=_0x1241af[_0x913d('0x4a')][_0x913d('0x25')]({'plain':!![]});if(!_0x994eaa)throw new Error(_0x913d('0x4b'));if(_0x994eaa[_0x913d('0x4c')]==='user'){var _0x310a9f=_0x872854[_0x913d('0x25')]({'plain':!![]});var _0x8ede05='Pauses';return db[_0x913d('0x4d')][_0x913d('0x47')]({'where':{'name':_0x8ede05,'userProfileId':_0x994eaa[_0x913d('0x4e')]},'raw':!![]})[_0x913d('0x23')](function(_0x3b73db){if(_0x3b73db&&_0x3b73db[_0x913d('0x4f')]===0x0){return db[_0x913d('0x26')]['create']({'name':_0x310a9f[_0x913d('0x2a')],'resourceId':_0x310a9f['id'],'type':_0x3b73db['name'],'sectionId':_0x3b73db['id']},{})[_0x913d('0x23')](function(){return _0x872854;});}else{return _0x872854;}})[_0x913d('0x44')](function(_0x23650a){logger[_0x913d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23650a);throw _0x23650a;});}return _0x872854;})['then'](respondWithResult(_0x5a57db,0xc9))[_0x913d('0x44')](handleError(_0x5a57db,null));};exports[_0x913d('0x22')]=function(_0x511b30,_0x26f3e6){if(_0x511b30['body']['id']){delete _0x511b30[_0x913d('0x49')]['id'];}return db[_0x913d('0x2d')]['find']({'where':{'id':_0x511b30[_0x913d('0x50')]['id']}})['then'](handleEntityNotFound(_0x26f3e6,null))[_0x913d('0x23')](saveUpdates(_0x511b30[_0x913d('0x49')],null))[_0x913d('0x23')](respondWithResult(_0x26f3e6,null))[_0x913d('0x44')](handleError(_0x26f3e6,null));};exports[_0x913d('0x24')]=function(_0x2289e8,_0x402d7b){return db['Pause'][_0x913d('0x47')]({'where':{'id':_0x2289e8[_0x913d('0x50')]['id']}})['then'](handleEntityNotFound(_0x402d7b,null))[_0x913d('0x23')](removeEntity(_0x402d7b,null))[_0x913d('0x44')](handleError(_0x402d7b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c36cf08..92ed402 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1cffe2,_0x5383e8){_0x1cffe2=_0x1cffe2-0x0;var _0x57030e=_0x7fbe[_0x1cffe2];return _0x57030e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 474235b..8fe5ed4 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(_0x3a4ff0,_0x4aefbf){var _0x1486c5=function(_0x385f32){while(--_0x385f32){_0x3a4ff0['push'](_0x3a4ff0['shift']());}};_0x1486c5(++_0x4aefbf);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c1777,_0x4f345b){_0x1c1777=_0x1c1777-0x0;var _0x1e634c=_0xb10b[_0x1c1777];return _0x1e634c;};'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(_0xd5740c,_0x5711c6){var _0x1a29db=function(_0x6351b9){while(--_0x6351b9){_0xd5740c['push'](_0xd5740c['shift']());}};_0x1a29db(++_0x5711c6);}(_0xb10b,0x12a));var _0xbb10=function(_0x18e5c7,_0x392a80){_0x18e5c7=_0x18e5c7-0x0;var _0x55f2f0=_0xb10b[_0x18e5c7];return _0x55f2f0;};'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 b1de9c8..1c89079 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 _0xac31=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','single','file','upload','put','update','delete','exports','multer','util'];(function(_0x5958d2,_0x550300){var _0x2a4809=function(_0x48048b){while(--_0x48048b){_0x5958d2['push'](_0x5958d2['shift']());}};_0x2a4809(++_0x550300);}(_0xac31,0xca));var _0x1ac3=function(_0x48fdbc,_0xc84b44){_0x48fdbc=_0x48fdbc-0x0;var _0x2b8b15=_0xac31[_0x48fdbc];return _0x2b8b15;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./plugin.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),controller[_0x1ac3('0xd')]);router['get'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0xb')](_0x1ac3('0x10'),auth['isAuthenticated'](),controller[_0x1ac3('0x11')]);var upload=multer({'storage':multer[_0x1ac3('0x12')]({'destination':function(_0x3e835b,_0x24f0d2,_0x2a8dc7){_0x2a8dc7(null,path[_0x1ac3('0x13')](config['root'],_0x1ac3('0x14')));},'filename':function(_0x376814,_0x2eeabf,_0x2338b9){_0x2eeabf['originalname']=_0x2eeabf[_0x1ac3('0x15')][_0x1ac3('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2338b9(null,util[_0x1ac3('0x17')](_0x1ac3('0x18'),path['basename'](_0x2eeabf[_0x1ac3('0x15')],path[_0x1ac3('0x19')](_0x2eeabf['originalname'])),Date[_0x1ac3('0x1a')](),path[_0x1ac3('0x19')](_0x2eeabf[_0x1ac3('0x15')])));}})});router['post']('/',upload[_0x1ac3('0x1b')](_0x1ac3('0x1c')),controller[_0x1ac3('0x1d')]);router['post'](_0x1ac3('0xc'),controller['webhookPost']);router[_0x1ac3('0x1e')](_0x1ac3('0xe'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x1f')]);router[_0x1ac3('0x20')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x20')]);module[_0x1ac3('0x21')]=router; \ No newline at end of file +var _0x4fdb=['server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','/webhook','webhookGet','get','show','/:id/download','download','diskStorage','root'];(function(_0x4855fa,_0x490cf3){var _0x4b7a91=function(_0x456ec7){while(--_0x456ec7){_0x4855fa['push'](_0x4855fa['shift']());}};_0x4b7a91(++_0x490cf3);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x315d96,_0x475420){_0x315d96=_0x315d96-0x0;var _0x1aa93a=_0x4fdb[_0x315d96];return _0x1aa93a;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var path=require(_0xb4fd('0x2'));var timeout=require(_0xb4fd('0x3'));var express=require(_0xb4fd('0x4'));var router=express[_0xb4fd('0x5')]();var fs_extra=require(_0xb4fd('0x6'));var auth=require(_0xb4fd('0x7'));var interaction=require(_0xb4fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb4fd('0x9'));router['get']('/',auth[_0xb4fd('0xa')](),controller['index']);router['get'](_0xb4fd('0xb'),controller[_0xb4fd('0xc')]);router[_0xb4fd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb4fd('0xe')]);router[_0xb4fd('0xd')](_0xb4fd('0xf'),auth['isAuthenticated'](),controller[_0xb4fd('0x10')]);var upload=multer({'storage':multer[_0xb4fd('0x11')]({'destination':function(_0x2148db,_0x23b08f,_0x306bd4){_0x306bd4(null,path['join'](config[_0xb4fd('0x12')],_0xb4fd('0x13')));},'filename':function(_0x2e8ee1,_0x120c2e,_0x5ba7e1){_0x120c2e[_0xb4fd('0x14')]=_0x120c2e[_0xb4fd('0x14')][_0xb4fd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ba7e1(null,util['format'](_0xb4fd('0x16'),path[_0xb4fd('0x17')](_0x120c2e[_0xb4fd('0x14')],path[_0xb4fd('0x18')](_0x120c2e[_0xb4fd('0x14')])),Date[_0xb4fd('0x19')](),path[_0xb4fd('0x18')](_0x120c2e['originalname'])));}})});router[_0xb4fd('0x1a')]('/',upload[_0xb4fd('0x1b')](_0xb4fd('0x1c')),controller[_0xb4fd('0x1d')]);router[_0xb4fd('0x1a')](_0xb4fd('0xb'),controller[_0xb4fd('0x1e')]);router[_0xb4fd('0x1f')](_0xb4fd('0x20'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x21')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module[_0xb4fd('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 465993e..3f3eda2 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 _0x604c=['ENUM','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','html','TEXT','STRING','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x604c,0x65));var _0xc604=function(_0x3f54f4,_0xf6ba5){_0x3f54f4=_0x3f54f4-0x0;var _0x412fc9=_0x604c[_0x3f54f4];return _0x412fc9;};'use strict';var Sequelize=require(_0xc604('0x0'));module[_0xc604('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xc604('0x2'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xc604('0x3')]},'path':{'type':Sequelize[_0xc604('0x4')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xc604('0x5')],'defaultValue':0x0,'comment':_0xc604('0x6')},'sidebar':{'type':Sequelize[_0xc604('0x7')]('adminOnly',_0xc604('0x8'),'always',_0xc604('0x9')),'defaultValue':_0xc604('0xa'),'comment':_0xc604('0xb')},'icon':{'type':Sequelize[_0xc604('0x4')]},'adminUrl':{'type':Sequelize[_0xc604('0x4')]},'agentUrl':{'type':Sequelize[_0xc604('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xc604('0x4')]}}; \ No newline at end of file +var _0x03f5=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x4be855,_0xc0d712){var _0x2ee225=function(_0x30b157){while(--_0x30b157){_0x4be855['push'](_0x4be855['shift']());}};_0x2ee225(++_0xc0d712);}(_0x03f5,0x118));var _0x503f=function(_0x3e6062,_0x36aa48){_0x3e6062=_0x3e6062-0x0;var _0x322bf1=_0x03f5[_0x3e6062];return _0x322bf1;};'use strict';var Sequelize=require('sequelize');module[_0x503f('0x0')]={'name':{'type':Sequelize[_0x503f('0x1')]},'type':{'type':Sequelize[_0x503f('0x2')](_0x503f('0x3'),'script')},'description':{'type':Sequelize[_0x503f('0x4')]},'version':{'type':Sequelize[_0x503f('0x4')]},'path':{'type':Sequelize[_0x503f('0x1')],'comment':_0x503f('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x503f('0x6')},'sidebar':{'type':Sequelize[_0x503f('0x2')]('adminOnly',_0x503f('0x7'),'always',_0x503f('0x8')),'defaultValue':_0x503f('0x9'),'comment':_0x503f('0xa')},'icon':{'type':Sequelize[_0x503f('0x1')]},'adminUrl':{'type':Sequelize[_0x503f('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 76408dd..2329698 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 _0x600b=['Error','Sequelize','**/*','node_modules/**/*','attachments/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','download','join','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT'];(function(_0x1871bb,_0xb8d5fb){var _0x53be8f=function(_0x388c9e){while(--_0x388c9e){_0x1871bb['push'](_0x1871bb['shift']());}};_0x53be8f(++_0xb8d5fb);}(_0x600b,0x1a5));var _0xb600=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0x600b[_0x5817e6];return _0x51916a;};'use strict';var emlformat=require(_0xb600('0x0'));var rimraf=require(_0xb600('0x1'));var zipdir=require(_0xb600('0x2'));var jsonpatch=require(_0xb600('0x3'));var rp=require(_0xb600('0x4'));var moment=require(_0xb600('0x5'));var BPromise=require(_0xb600('0x6'));var Mustache=require(_0xb600('0x7'));var util=require(_0xb600('0x8'));var path=require(_0xb600('0x9'));var sox=require(_0xb600('0xa'));var csv=require(_0xb600('0xb'));var ejs=require(_0xb600('0xc'));var fs=require('fs');var fs_extra=require(_0xb600('0xd'));var _=require('lodash');var squel=require(_0xb600('0xe'));var crypto=require('crypto');var jsforce=require(_0xb600('0xf'));var deskjs=require(_0xb600('0x10'));var toCsv=require(_0xb600('0xb'));var querystring=require(_0xb600('0x11'));var Papa=require(_0xb600('0x12'));var extract=require(_0xb600('0x13'));var rimraf=require('rimraf');var archiver=require(_0xb600('0x14'));var Redis=require('ioredis');var authService=require(_0xb600('0x15'));var qs=require(_0xb600('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb600('0x17'));var logger=require(_0xb600('0x18'))(_0xb600('0x19'));var utils=require(_0xb600('0x1a'));var config=require(_0xb600('0x1b'));var licenseUtil=require(_0xb600('0x1c'));var db=require(_0xb600('0x1d'))['db'];config[_0xb600('0x1e')]=_[_0xb600('0x1f')](config['redis'],{'host':_0xb600('0x20'),'port':0x18eb});var socket=require(_0xb600('0x21'))(new Redis(config[_0xb600('0x1e')]));require(_0xb600('0x22'))[_0xb600('0x23')](socket);function respondWithStatusCode(_0x2ec44d,_0x4cc0e0){_0x4cc0e0=_0x4cc0e0||0xcc;return function(_0x27667b){if(_0x27667b){return _0x2ec44d[_0xb600('0x24')](_0x4cc0e0);}return _0x2ec44d['status'](_0x4cc0e0)[_0xb600('0x25')]();};}function respondWithResult(_0x29675a,_0x21252f){_0x21252f=_0x21252f||0xc8;return function(_0x5592c9){if(_0x5592c9){return _0x29675a[_0xb600('0x26')](_0x21252f)[_0xb600('0x27')](_0x5592c9);}};}function respondWithFilteredResult(_0x298079,_0x2b8a4d){return function(_0x41ec69){if(_0x41ec69){var _0x149502=typeof _0x2b8a4d['offset']===_0xb600('0x28')&&typeof _0x2b8a4d[_0xb600('0x29')]===_0xb600('0x28');var _0x55fe7c=_0x41ec69[_0xb600('0x2a')];var _0x884751=_0x149502?0x0:_0x2b8a4d[_0xb600('0x2b')];var _0x169cfe=_0x149502?_0x41ec69[_0xb600('0x2a')]:_0x2b8a4d[_0xb600('0x2b')]+_0x2b8a4d['limit'];var _0x2cbe1a;if(_0x169cfe>=_0x55fe7c){_0x169cfe=_0x55fe7c;_0x2cbe1a=0xc8;}else{_0x2cbe1a=0xce;}_0x298079['status'](_0x2cbe1a);return _0x298079[_0xb600('0x2c')](_0xb600('0x2d'),_0x884751+'-'+_0x169cfe+'/'+_0x55fe7c)[_0xb600('0x27')](_0x41ec69);}return null;};}function patchUpdates(_0x596892){return function(_0x4e68b8){try{jsonpatch[_0xb600('0x2e')](_0x4e68b8,_0x596892,!![]);}catch(_0x414ce8){return BPromise[_0xb600('0x2f')](_0x414ce8);}return _0x4e68b8[_0xb600('0x30')]();};}function saveUpdates(_0x100d65,_0x2a7a66){return function(_0x2e12aa){if(_0x2e12aa){return _0x2e12aa['update'](_0x100d65)[_0xb600('0x31')](function(_0x1fb097){return _0x1fb097;});}return null;};}function removeEntity(_0x392bde,_0x554687){return function(_0x1f7e22){if(_0x1f7e22){return _0x1f7e22[_0xb600('0x32')]()['then'](function(){var _0x26e5fa=_0x1f7e22[_0xb600('0x33')]({'plain':!![]});var _0x47d7de=_0xb600('0x34');return db[_0xb600('0x35')][_0xb600('0x32')]({'where':{'type':_0x47d7de,'resourceId':_0x26e5fa['id']}})['then'](function(){return _0x1f7e22;});})[_0xb600('0x31')](function(){_0x392bde[_0xb600('0x26')](0xcc)[_0xb600('0x25')]();});}};}function handleEntityNotFound(_0x219963,_0x614371){return function(_0x5f57f6){if(!_0x5f57f6){_0x219963[_0xb600('0x24')](0x194);}return _0x5f57f6;};}function handleError(_0x2d5fa7,_0x414587){_0x414587=_0x414587||0x1f4;return function(_0x59f153){logger[_0xb600('0x36')](_0x59f153[_0xb600('0x37')]);if(_0x59f153[_0xb600('0x38')]){delete _0x59f153[_0xb600('0x38')];}_0x2d5fa7['status'](_0x414587)[_0xb600('0x39')](_0x59f153);};}exports[_0xb600('0x3a')]=function(_0x777030,_0x5a091f){var _0x39650a={},_0x5c1682={},_0x537815={'count':0x0,'rows':[]};var _0x230d26=_[_0xb600('0x3b')](db[_0xb600('0x3c')][_0xb600('0x3d')],function(_0x4d26b6){return{'name':_0x4d26b6['fieldName'],'type':_0x4d26b6[_0xb600('0x3e')][_0xb600('0x3f')]};});_0x5c1682['model']=_[_0xb600('0x3b')](_0x230d26,_0xb600('0x38'));_0x5c1682['query']=_[_0xb600('0x40')](_0x777030[_0xb600('0x41')]);_0x5c1682[_0xb600('0x42')]=_[_0xb600('0x43')](_0x5c1682[_0xb600('0x44')],_0x5c1682[_0xb600('0x41')]);_0x39650a[_0xb600('0x45')]=_[_0xb600('0x43')](_0x5c1682['model'],qs[_0xb600('0x46')](_0x777030[_0xb600('0x41')][_0xb600('0x46')]));_0x39650a['attributes']=_0x39650a['attributes'][_0xb600('0x47')]?_0x39650a['attributes']:_0x5c1682[_0xb600('0x44')];if(!_0x777030[_0xb600('0x41')][_0xb600('0x48')]('nolimit')){_0x39650a[_0xb600('0x29')]=qs['limit'](_0x777030[_0xb600('0x41')][_0xb600('0x29')]);_0x39650a[_0xb600('0x2b')]=qs[_0xb600('0x2b')](_0x777030[_0xb600('0x41')][_0xb600('0x2b')]);}_0x39650a[_0xb600('0x49')]=qs['sort'](_0x777030[_0xb600('0x41')]['sort']);_0x39650a[_0xb600('0x4a')]=qs[_0xb600('0x42')](_['pick'](_0x777030[_0xb600('0x41')],_0x5c1682[_0xb600('0x42')]),_0x230d26);if(_0x777030[_0xb600('0x41')]['filter']){_0x39650a[_0xb600('0x4a')]=_['merge'](_0x39650a[_0xb600('0x4a')],{'$or':_[_0xb600('0x3b')](_0x230d26,function(_0x36bb8f){if(_0x36bb8f['type']!==_0xb600('0x4b')){var _0x5cf306={};_0x5cf306[_0x36bb8f[_0xb600('0x38')]]={'$like':'%'+_0x777030['query'][_0xb600('0x4c')]+'%'};return _0x5cf306;}})});}_0x39650a=_['merge']({},_0x39650a,_0x777030[_0xb600('0x4d')]);var _0x38fa10={'where':_0x39650a[_0xb600('0x4a')]};return db['Plugin']['count'](_0x38fa10)['then'](function(_0x23f198){_0x537815[_0xb600('0x2a')]=_0x23f198;if(_0x777030[_0xb600('0x41')][_0xb600('0x4e')]){_0x39650a[_0xb600('0x4f')]=[{'all':!![]}];}return db[_0xb600('0x3c')]['findAll'](_0x39650a);})[_0xb600('0x31')](function(_0x3ba7e6){_0x537815[_0xb600('0x50')]=_0x3ba7e6;return _0x537815;})[_0xb600('0x31')](respondWithFilteredResult(_0x5a091f,_0x39650a))[_0xb600('0x51')](handleError(_0x5a091f,null));};exports[_0xb600('0x52')]=function(_0x5566a9,_0x5cc3c4){var _0x5d22e9={'raw':!![],'where':{'id':_0x5566a9[_0xb600('0x53')]['id']}},_0x42415d={};_0x42415d[_0xb600('0x44')]=_[_0xb600('0x40')](db[_0xb600('0x3c')][_0xb600('0x3d')]);_0x42415d['query']=_['keys'](_0x5566a9[_0xb600('0x41')]);_0x42415d[_0xb600('0x42')]=_[_0xb600('0x43')](_0x42415d[_0xb600('0x44')],_0x42415d[_0xb600('0x41')]);_0x5d22e9[_0xb600('0x45')]=_[_0xb600('0x43')](_0x42415d[_0xb600('0x44')],qs[_0xb600('0x46')](_0x5566a9['query'][_0xb600('0x46')]));_0x5d22e9[_0xb600('0x45')]=_0x5d22e9[_0xb600('0x45')][_0xb600('0x47')]?_0x5d22e9['attributes']:_0x42415d[_0xb600('0x44')];if(_0x5566a9['query'][_0xb600('0x4e')]){_0x5d22e9[_0xb600('0x4f')]=[{'all':!![]}];}_0x5d22e9=_['merge']({},_0x5d22e9,_0x5566a9[_0xb600('0x4d')]);return db[_0xb600('0x3c')]['find'](_0x5d22e9)['then'](handleEntityNotFound(_0x5cc3c4,null))['then'](respondWithResult(_0x5cc3c4,null))[_0xb600('0x51')](handleError(_0x5cc3c4,null));};exports[_0xb600('0x54')]=function(_0x3c8c24,_0x31549a,_0x1f93a0){return db['Plugin']['find']({'where':{'id':_0x3c8c24['params']['id']},'attributes':['name','path'],'raw':!![]})[_0xb600('0x31')](handleEntityNotFound(_0x31549a,null))[_0xb600('0x31')](function(_0x584137){if(_0x584137){var _0x1b8acd=path[_0xb600('0x55')](config[_0xb600('0x56')],_0xb600('0x57'),util[_0xb600('0x58')](_0xb600('0x59'),path[_0xb600('0x5a')](_0x584137[_0xb600('0x9')])));var _0xacadc9=fs['createWriteStream'](_0x1b8acd);var _0x57d631=archiver(_0xb600('0x5b'),{'zlib':{'level':0x9}});_0x57d631['on'](_0xb600('0x5c'),function(_0x5b9501){if(_0x5b9501[_0xb600('0x5d')]===_0xb600('0x5e')){logger['error'](_0x5b9501);}else{throw new db['Sequelize'][(_0xb600('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x57d631['on'](_0xb600('0x36'),function(_0x20ba72){throw new db[(_0xb600('0x60'))][(_0xb600('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x57d631['pipe'](_0xacadc9);_0x57d631['glob'](_0xb600('0x61'),{'cwd':path[_0xb600('0x55')](config[_0xb600('0x56')],_0xb600('0x57'),path['dirname'](_0x584137[_0xb600('0x9')])),'ignore':[path['join'](path[_0xb600('0x5a')](_0x584137[_0xb600('0x9')]),_0xb600('0x62')),path[_0xb600('0x55')](path[_0xb600('0x5a')](_0x584137[_0xb600('0x9')]),_0xb600('0x63'))],'nodir':!![]})['finalize']();_0xacadc9['on'](_0xb600('0x64'),function(){if(!fs[_0xb600('0x65')](_0x1b8acd)){throw new db[(_0xb600('0x60'))]['Error']('Plugin\x20not\x20found');}return _0x31549a[_0xb600('0x54')](_0x1b8acd,util[_0xb600('0x58')](_0xb600('0x59'),path[_0xb600('0x5a')](_0x584137[_0xb600('0x9')])),function(_0x12a0ae){if(_0x12a0ae){throw new db[(_0xb600('0x60'))][(_0xb600('0x5f'))](_0xb600('0x66'));}fs['unlinkSync'](_0x1b8acd);logger[_0xb600('0x67')](_0xb600('0x68'));logger[_0xb600('0x67')](_0xb600('0x69'));});});}return null;})['catch'](handleError(_0x31549a,null));};exports[_0xb600('0x6a')]=function(_0x160a67,_0x375ec1,_0x2210f3){var _0x252d90=path[_0xb600('0x5a')](_0x160a67['file'][_0xb600('0x6b')],path[_0xb600('0x6c')](_0x160a67[_0xb600('0x6d')][_0xb600('0x6b')]));var _0x3c734a=path[_0xb600('0x55')](config[_0xb600('0x56')],_0xb600('0x57'),_0x160a67['file']['filename']);var _0x24ec81=path[_0xb600('0x55')](config[_0xb600('0x56')],'server/files/plugins',_0x252d90);logger[_0xb600('0x67')](_0xb600('0x6e'),_0x3c734a);logger['info'](_0xb600('0x6f'),_0x24ec81);try{fs['chmodSync'](_0x3c734a,parseInt('0777',0x8));extract(_0x3c734a,{'dir':_0x24ec81},function(_0x2582fc){if(_0x2582fc){logger[_0xb600('0x36')](_0x2582fc);handleError(_0x2582fc,!![]);};var _0xb8227d=fs[_0xb600('0x70')](_0x24ec81);if(_0xb8227d[_0xb600('0x47')]>0x1){removeReferences(_0x3c734a,_0x24ec81);logger[_0xb600('0x36')]('Invalid\x20plugin\x20structure');return _0x2210f3(new Error(_0xb600('0x71')));}var _0x2b15f0=fs[_0xb600('0x72')](path[_0xb600('0x55')](_0x24ec81,_0xb8227d[0x0]));if(_0x2b15f0['isFile']()){removeReferences(_0x3c734a,_0x24ec81);logger[_0xb600('0x36')](_0xb600('0x71'));return _0x2210f3(new Error(_0xb600('0x71')));}if(_0x2b15f0[_0xb600('0x73')]()){var _0x35a3fc=fs[_0xb600('0x70')](path[_0xb600('0x55')](_0x24ec81,_0xb8227d[0x0]));if(_0x35a3fc[_0xb600('0x47')]===0x0){removeReferences(_0x3c734a,_0x24ec81);logger[_0xb600('0x36')](_0xb600('0x71'));return _0x2210f3(new Error(_0xb600('0x71')));}var _0x2ce175=_0x35a3fc['some'](function(_0x31d09e){return _0x31d09e==='manifest.json';});if(!_0x2ce175){return _0x2210f3(new Error(_0xb600('0x74')));}var _0x2fe8f2=fs[_0xb600('0x75')](path[_0xb600('0x55')](_0x24ec81,_0xb8227d[0x0],_0xb600('0x76')));var _0x4ad84b=JSON[_0xb600('0x77')](_0x2fe8f2);if(_0xb600('0x28')==typeof _0x4ad84b[_0xb600('0x38')]){return _0x2210f3(new Error(_0xb600('0x78')));}if(_0xb600('0x28')==typeof _0x4ad84b['type']){return _0x2210f3(new Error(_0xb600('0x79')));}if(_0xb600('0x28')==typeof _0x4ad84b[_0xb600('0x7a')]){return _0x2210f3(new Error(_0xb600('0x7b')));}if(_0xb600('0x28')==typeof _0x4ad84b[_0xb600('0x7c')]){return _0x2210f3(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4ad84b[_0xb600('0x3e')]===_0xb600('0x7d')){if(_0xb600('0x28')==typeof _0x4ad84b[_0xb600('0x7c')][_0xb600('0x7e')]){return _0x2210f3(new Error(_0xb600('0x7f')));}if(_0xb600('0x28')==typeof _0x4ad84b[_0xb600('0x7c')]['views'][_0xb600('0x80')]&&_0xb600('0x28')==typeof _0x4ad84b[_0xb600('0x7c')]['views']['agent']){return _0x2210f3(new Error(_0xb600('0x81')));}}else if(_0x4ad84b[_0xb600('0x3e')]==='script'){if(_0xb600('0x28')==typeof _0x4ad84b[_0xb600('0x7c')][_0xb600('0x82')]){return _0x2210f3(new Error(_0xb600('0x83')));}if(_0xb600('0x28')==typeof _0x4ad84b['parameters'][_0xb600('0x84')]){return _0x2210f3(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x2210f3(new Error(_0xb600('0x85')));}var _0x38cbbf=_0x4ad84b[_0xb600('0x38')];var _0x13736a=_0x4ad84b[_0xb600('0x86')];var _0x31a732=_0x4ad84b[_0xb600('0x3e')];var _0x2a7e9e=_0x4ad84b[_0xb600('0x87')]?_0x4ad84b[_0xb600('0x87')]:'always';var _0x48fc41=_0x4ad84b[_0xb600('0x88')]?_0x4ad84b[_0xb600('0x88')]:'icon-apps';var _0x2b6ff0='';var _0x3082d9='';var _0x129040='';var _0x278c6d='';var _0x522929=_0x4ad84b[_0xb600('0x7a')];if(_0x31a732===_0xb600('0x7d')){if('undefined'!=typeof _0x4ad84b[_0xb600('0x7c')]['views'][_0xb600('0x80')]){var _0x171b46=_0x4ad84b[_0xb600('0x7c')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xb600('0x89')](_0x171b46)){_0x2b6ff0=path[_0xb600('0x55')](_0xb600('0x8a'),_0x252d90,_0xb8227d[0x0],_0x171b46);}else{_0x2b6ff0=_0x171b46;}}else{logger['info'](_0xb600('0x8b'));}if(_0xb600('0x28')!=typeof _0x4ad84b[_0xb600('0x7c')]['views']['agent']){var _0x42b470=_0x4ad84b['parameters'][_0xb600('0x7e')][_0xb600('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xb600('0x89')](_0x42b470)){_0x3082d9=path[_0xb600('0x55')](_0xb600('0x8a'),_0x252d90,_0xb8227d[0x0],_0x42b470);}else{_0x3082d9=_0x42b470;}}else{logger['info'](_0xb600('0x8d'));}}else if(_0x31a732===_0xb600('0x8e')){_0x129040=_0x4ad84b['parameters'][_0xb600('0x82')];_0x278c6d=_0x4ad84b[_0xb600('0x7c')][_0xb600('0x84')];if(_0xb600('0x28')!=typeof _0x4ad84b[_0xb600('0x7c')]['views']){if(_0xb600('0x28')!=typeof _0x4ad84b[_0xb600('0x7c')]['views'][_0xb600('0x80')]){var _0x171b46=_0x4ad84b[_0xb600('0x7c')]['views'][_0xb600('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xb600('0x89')](_0x171b46)){_0x2b6ff0=path[_0xb600('0x55')](_0xb600('0x8a'),_0x252d90,_0xb8227d[0x0],_0x171b46);}else{_0x2b6ff0=_0x171b46;}}if(_0xb600('0x28')!=typeof _0x4ad84b[_0xb600('0x7c')][_0xb600('0x7e')]['agent']){var _0x42b470=_0x4ad84b[_0xb600('0x7c')]['views'][_0xb600('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xb600('0x89')](_0x42b470)){_0x3082d9=path[_0xb600('0x55')](_0xb600('0x8a'),_0x252d90,_0xb8227d[0x0],_0x42b470);}else{_0x3082d9=_0x42b470;}}}}var _0x368d3a={'name':_0x38cbbf,'description':_0x13736a,'path':path[_0xb600('0x55')](_0x252d90,_0xb8227d[0x0]),'type':_0x31a732,'sidebar':_0x2a7e9e,'icon':_0x48fc41,'adminUrl':_0x2b6ff0,'agentUrl':_0x3082d9,'scriptName':_0x129040,'scriptPath':_0x278c6d,'version':_0x522929};removeReferences(_0x3c734a,null);return db[_0xb600('0x3c')]['create'](_0x368d3a)['then'](function(_0x53915f){var _0x512ccb={'role':_0x160a67['body'][_0xb600('0x8f')],'userProfileId':_0x160a67[_0xb600('0x90')][_0xb600('0x91')]};if(!_0x512ccb)throw new Error(_0xb600('0x92'));if(_0x512ccb['role']===_0xb600('0x93')){var _0x5dbfcd=_0x53915f['get']({'plain':!![]});return db[_0xb600('0x94')][_0xb600('0x95')]({'where':{'name':_0xb600('0x34'),'userProfileId':_0x512ccb[_0xb600('0x91')]},'raw':!![]})[_0xb600('0x31')](function(_0xa40c45){if(_0xa40c45&&_0xa40c45[_0xb600('0x96')]===0x0){return db[_0xb600('0x35')][_0xb600('0x97')]({'name':_0x5dbfcd[_0xb600('0x38')],'resourceId':_0x5dbfcd['id'],'type':_0xa40c45[_0xb600('0x38')],'sectionId':_0xa40c45['id']},{})['then'](function(){return _0x53915f;});}else{return _0x53915f;}})[_0xb600('0x51')](function(_0x391fa6){logger[_0xb600('0x36')](_0xb600('0x98'),_0x391fa6);throw _0x391fa6;});}return _0x53915f;})['then'](respondWithResult(_0x375ec1,null))[_0xb600('0x51')](handleError(_0x375ec1,null));}});}catch(_0x186faa){_0x375ec1['status'](0x1f4)[_0xb600('0x39')](_0x186faa);}};function removeReferences(_0x3545ef,_0x4b33ea){try{if(_0x3545ef){fs[_0xb600('0x99')](_0x3545ef);logger['info'](_0xb600('0x9a'));}if(_0x4b33ea){rimraf(_0x4b33ea,function(){});logger[_0xb600('0x67')](_0xb600('0x9b'));}}catch(_0x554d03){logger[_0xb600('0x36')](_0x554d03);}}exports['update']=function(_0x2ffe5c,_0x1e2296,_0x6ec2f3){return db[_0xb600('0x3c')][_0xb600('0x95')]({'where':{'id':_0x2ffe5c[_0xb600('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e2296,null))[_0xb600('0x31')](saveUpdates(_0x2ffe5c[_0xb600('0x90')],null))['then'](respondWithResult(_0x1e2296,null))[_0xb600('0x51')](handleError(_0x1e2296,null));};exports['delete']=function(_0x4e7b82,_0x1024ff,_0x3513f9){return db[_0xb600('0x3c')][_0xb600('0x95')]({'where':{'id':_0x4e7b82[_0xb600('0x53')]['id']}})[_0xb600('0x31')](function(_0x3ad34d){if(_0x3ad34d){return _0x3ad34d['destroy']();}})['then'](function(_0x29027e){rimraf(path['join'](config['root'],_0xb600('0x57'),path[_0xb600('0x9c')](_0x29027e[_0xb600('0x9')])),function(){});return _0x29027e;})['then'](handleEntityNotFound(_0x1024ff,null))[_0xb600('0x31')](respondWithStatusCode(_0x1024ff,null))[_0xb600('0x51')](handleError(_0x1024ff,null));};exports[_0xb600('0x9d')]=function(_0xd3ced7,_0x829a70,_0x273709){return BPromise[_0xb600('0x9e')]()[_0xb600('0x31')](function(){if(!_0xd3ced7[_0xb600('0x41')][_0xb600('0x9')]){throw new Error(_0xb600('0x9f'));}if(!_0xd3ced7[_0xb600('0x41')][_0xb600('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3d1d77=_0xd3ced7[_0xb600('0x41')][_0xb600('0xa1')]?_0xd3ced7[_0xb600('0x41')][_0xb600('0xa1')]+':'+_0xd3ced7['query'][_0xb600('0xa0')]:_0xb600('0xa2')+_0xd3ced7['query'][_0xb600('0xa0')];var _0x4f23ac=_0xd3ced7['query'][_0xb600('0x27')]?_0xd3ced7[_0xb600('0x41')][_0xb600('0x27')]:!![];var _0x3b258d=_0xd3ced7[_0xb600('0x41')][_0xb600('0xa3')]?_0xd3ced7[_0xb600('0x41')][_0xb600('0xa3')]:null;var _0x527c99={'method':_0xd3ced7[_0xb600('0xa4')],'uri':util[_0xb600('0x58')](_0xb600('0xa5'),_0x3d1d77,_0xd3ced7['query'][_0xb600('0x9')]),'json':_0x4f23ac,'resolveWithFullResponse':!![],'encoding':_0x3b258d,'qs':_0xd3ced7[_0xb600('0x41')]};if(_0xd3ced7[_0xb600('0xa6')]){_0x527c99[_0xb600('0xa6')]=_0xd3ced7[_0xb600('0xa6')];if(_0x527c99[_0xb600('0xa6')]['content-length']){delete _0x527c99[_0xb600('0xa6')][_0xb600('0xa7')];}}if(_0x527c99[_0xb600('0xa6')][_0xb600('0xa8')]){delete _0x527c99[_0xb600('0xa6')]['content-type'];}return rp(_0x527c99);})[_0xb600('0x31')](function(_0x1ff1a9){if(_0x1ff1a9){_0x829a70[_0xb600('0x2c')](_0x1ff1a9[_0xb600('0xa6')]);logger[_0xb600('0x67')](_0x1ff1a9[_0xb600('0x90')]);if(_['endsWith'](_0xd3ced7['query'][_0xb600('0x9')],_0xb600('0x54'))&&_0x1ff1a9[_0xb600('0xa9')]==0x1f4){return _0x829a70[_0xb600('0x24')](_0x1ff1a9['statusCode']);}else{return _0x829a70['status'](_0x1ff1a9['statusCode'])['send'](_0x1ff1a9[_0xb600('0x90')]);}}else{return _0x829a70[_0xb600('0x24')](0xc8);}})['catch'](handleError(_0x829a70,null));};exports[_0xb600('0xaa')]=function(_0x5bd35c,_0x188dc1,_0x5d7c97){return BPromise[_0xb600('0x9e')]()[_0xb600('0x31')](function(){if(!_0x5bd35c[_0xb600('0x41')][_0xb600('0x9')]){throw new Error(_0xb600('0x9f'));}if(!_0x5bd35c[_0xb600('0x41')][_0xb600('0xa0')]){throw new Error(_0xb600('0xab'));}var _0xb3c09e=_0x5bd35c[_0xb600('0x41')]['hostname']?_0x5bd35c[_0xb600('0x41')][_0xb600('0xa1')]+':'+_0x5bd35c[_0xb600('0x41')][_0xb600('0xa0')]:_0xb600('0xa2')+_0x5bd35c['query'][_0xb600('0xa0')];var _0x5e5bd8=_0x5bd35c[_0xb600('0x41')]['json']?_0x5bd35c[_0xb600('0x41')][_0xb600('0x27')]:!![];var _0x41fda3=_0x5bd35c[_0xb600('0x41')][_0xb600('0xa3')]?_0x5bd35c[_0xb600('0x41')][_0xb600('0xa3')]:null;var _0x5009ca={'method':_0x5bd35c[_0xb600('0xa4')],'uri':util[_0xb600('0x58')](_0xb600('0xa5'),_0xb3c09e,_0x5bd35c[_0xb600('0x41')]['path']),'json':_0x5e5bd8,'resolveWithFullResponse':!![],'encoding':_0x41fda3,'body':_0x5bd35c[_0xb600('0x90')]};if(_0x5bd35c[_0xb600('0xa6')]){_0x5009ca[_0xb600('0xa6')]=_0x5bd35c['headers'];if(_0x5009ca['headers']['content-length']){delete _0x5009ca[_0xb600('0xa6')][_0xb600('0xa7')];}}if(_0x5009ca['headers'][_0xb600('0xa8')]){delete _0x5009ca[_0xb600('0xa6')][_0xb600('0xa8')];}return rp(_0x5009ca);})[_0xb600('0x31')](function(_0x2d386e){if(_0x2d386e){_0x188dc1['set'](_0x2d386e[_0xb600('0xa6')]);logger[_0xb600('0x67')](_0x2d386e[_0xb600('0x90')]);return _0x188dc1['status'](_0x2d386e['statusCode'])['send'](_0x2d386e[_0xb600('0x90')]);}else{return _0x188dc1['sendStatus'](0xc8);}})[_0xb600('0x51')](handleError(_0x188dc1,null));}; \ No newline at end of file +var _0xd3e0=['jsforce','desk.js','querystring','papaparse','extract-zip','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Plugins','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Plugin','rows','catch','show','params','length','includeAll','include','find','download','path','join','root','server/files/plugins','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','%s.zip','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','version','agent','test','plugins','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','send','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','method','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0xd3e0,0x143));var _0x0d3e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3e0[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x0d3e('0x0'));var rimraf=require(_0x0d3e('0x1'));var zipdir=require(_0x0d3e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d3e('0x3'));var moment=require('moment');var BPromise=require(_0x0d3e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0d3e('0x5'));var csv=require(_0x0d3e('0x6'));var ejs=require(_0x0d3e('0x7'));var fs=require('fs');var fs_extra=require(_0x0d3e('0x8'));var _=require(_0x0d3e('0x9'));var squel=require(_0x0d3e('0xa'));var crypto=require('crypto');var jsforce=require(_0x0d3e('0xb'));var deskjs=require(_0x0d3e('0xc'));var toCsv=require(_0x0d3e('0x6'));var querystring=require(_0x0d3e('0xd'));var Papa=require(_0x0d3e('0xe'));var extract=require(_0x0d3e('0xf'));var rimraf=require(_0x0d3e('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0d3e('0x10'));var as=require(_0x0d3e('0x11'));var hardwareService=require(_0x0d3e('0x12'));var logger=require(_0x0d3e('0x13'))(_0x0d3e('0x14'));var utils=require(_0x0d3e('0x15'));var config=require(_0x0d3e('0x16'));var licenseUtil=require(_0x0d3e('0x17'));var db=require('../../mysqldb')['db'];config[_0x0d3e('0x18')]=_['defaults'](config[_0x0d3e('0x18')],{'host':_0x0d3e('0x19'),'port':0x18eb});var socket=require(_0x0d3e('0x1a'))(new Redis(config[_0x0d3e('0x18')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x393833,_0x3a9beb){_0x3a9beb=_0x3a9beb||0xcc;return function(_0x41dbe3){if(_0x41dbe3){return _0x393833[_0x0d3e('0x1b')](_0x3a9beb);}return _0x393833[_0x0d3e('0x1c')](_0x3a9beb)['end']();};}function respondWithResult(_0x3b8589,_0x4c0fe5){_0x4c0fe5=_0x4c0fe5||0xc8;return function(_0x97a429){if(_0x97a429){return _0x3b8589['status'](_0x4c0fe5)[_0x0d3e('0x1d')](_0x97a429);}};}function respondWithFilteredResult(_0x50c5fb,_0x569c90){return function(_0x2bf57a){if(_0x2bf57a){var _0x4ba6b7=typeof _0x569c90[_0x0d3e('0x1e')]==='undefined'&&typeof _0x569c90['limit']==='undefined';var _0x3f887a=_0x2bf57a[_0x0d3e('0x1f')];var _0x53ac1c=_0x4ba6b7?0x0:_0x569c90[_0x0d3e('0x1e')];var _0x4ed960=_0x4ba6b7?_0x2bf57a['count']:_0x569c90[_0x0d3e('0x1e')]+_0x569c90[_0x0d3e('0x20')];var _0x5531e7;if(_0x4ed960>=_0x3f887a){_0x4ed960=_0x3f887a;_0x5531e7=0xc8;}else{_0x5531e7=0xce;}_0x50c5fb[_0x0d3e('0x1c')](_0x5531e7);return _0x50c5fb[_0x0d3e('0x21')](_0x0d3e('0x22'),_0x53ac1c+'-'+_0x4ed960+'/'+_0x3f887a)[_0x0d3e('0x1d')](_0x2bf57a);}return null;};}function patchUpdates(_0x1fd65a){return function(_0x1095a3){try{jsonpatch[_0x0d3e('0x23')](_0x1095a3,_0x1fd65a,!![]);}catch(_0x1851cd){return BPromise[_0x0d3e('0x24')](_0x1851cd);}return _0x1095a3[_0x0d3e('0x25')]();};}function saveUpdates(_0x25a4a2,_0x1eb654){return function(_0x29acc4){if(_0x29acc4){return _0x29acc4[_0x0d3e('0x26')](_0x25a4a2)[_0x0d3e('0x27')](function(_0x329340){return _0x329340;});}return null;};}function removeEntity(_0xd5f005,_0x1baa6f){return function(_0x33db43){if(_0x33db43){return _0x33db43[_0x0d3e('0x28')]()[_0x0d3e('0x27')](function(){var _0xbe7763=_0x33db43['get']({'plain':!![]});var _0x475b3e=_0x0d3e('0x29');return db['UserProfileResource'][_0x0d3e('0x28')]({'where':{'type':_0x475b3e,'resourceId':_0xbe7763['id']}})[_0x0d3e('0x27')](function(){return _0x33db43;});})['then'](function(){_0xd5f005[_0x0d3e('0x1c')](0xcc)[_0x0d3e('0x2a')]();});}};}function handleEntityNotFound(_0xe81eb7,_0x4f5b15){return function(_0x93894f){if(!_0x93894f){_0xe81eb7[_0x0d3e('0x1b')](0x194);}return _0x93894f;};}function handleError(_0x58ba1c,_0x5b5228){_0x5b5228=_0x5b5228||0x1f4;return function(_0x27302d){logger[_0x0d3e('0x2b')](_0x27302d[_0x0d3e('0x2c')]);if(_0x27302d[_0x0d3e('0x2d')]){delete _0x27302d['name'];}_0x58ba1c['status'](_0x5b5228)['send'](_0x27302d);};}exports['index']=function(_0x42f632,_0x2844e4){var _0x4092c7={},_0x2ac3c7={},_0x40fc71={'count':0x0,'rows':[]};var _0x531ac2=_[_0x0d3e('0x2e')](db['Plugin'][_0x0d3e('0x2f')],function(_0x369684){return{'name':_0x369684[_0x0d3e('0x30')],'type':_0x369684[_0x0d3e('0x31')][_0x0d3e('0x32')]};});_0x2ac3c7[_0x0d3e('0x33')]=_[_0x0d3e('0x2e')](_0x531ac2,'name');_0x2ac3c7[_0x0d3e('0x34')]=_[_0x0d3e('0x35')](_0x42f632[_0x0d3e('0x34')]);_0x2ac3c7[_0x0d3e('0x36')]=_[_0x0d3e('0x37')](_0x2ac3c7[_0x0d3e('0x33')],_0x2ac3c7[_0x0d3e('0x34')]);_0x4092c7['attributes']=_['intersection'](_0x2ac3c7[_0x0d3e('0x33')],qs[_0x0d3e('0x38')](_0x42f632[_0x0d3e('0x34')]['fields']));_0x4092c7[_0x0d3e('0x39')]=_0x4092c7[_0x0d3e('0x39')]['length']?_0x4092c7[_0x0d3e('0x39')]:_0x2ac3c7['model'];if(!_0x42f632[_0x0d3e('0x34')][_0x0d3e('0x3a')](_0x0d3e('0x3b'))){_0x4092c7[_0x0d3e('0x20')]=qs['limit'](_0x42f632[_0x0d3e('0x34')][_0x0d3e('0x20')]);_0x4092c7[_0x0d3e('0x1e')]=qs['offset'](_0x42f632[_0x0d3e('0x34')][_0x0d3e('0x1e')]);}_0x4092c7[_0x0d3e('0x3c')]=qs[_0x0d3e('0x3d')](_0x42f632[_0x0d3e('0x34')]['sort']);_0x4092c7[_0x0d3e('0x3e')]=qs['filters'](_[_0x0d3e('0x3f')](_0x42f632[_0x0d3e('0x34')],_0x2ac3c7[_0x0d3e('0x36')]),_0x531ac2);if(_0x42f632[_0x0d3e('0x34')][_0x0d3e('0x40')]){_0x4092c7[_0x0d3e('0x3e')]=_[_0x0d3e('0x41')](_0x4092c7['where'],{'$or':_[_0x0d3e('0x2e')](_0x531ac2,function(_0x2b5694){if(_0x2b5694[_0x0d3e('0x31')]!=='VIRTUAL'){var _0x19dd70={};_0x19dd70[_0x2b5694['name']]={'$like':'%'+_0x42f632[_0x0d3e('0x34')][_0x0d3e('0x40')]+'%'};return _0x19dd70;}})});}_0x4092c7=_[_0x0d3e('0x41')]({},_0x4092c7,_0x42f632[_0x0d3e('0x42')]);var _0x2bf639={'where':_0x4092c7['where']};return db[_0x0d3e('0x43')][_0x0d3e('0x1f')](_0x2bf639)[_0x0d3e('0x27')](function(_0xe0d2f9){_0x40fc71[_0x0d3e('0x1f')]=_0xe0d2f9;if(_0x42f632['query']['includeAll']){_0x4092c7['include']=[{'all':!![]}];}return db[_0x0d3e('0x43')]['findAll'](_0x4092c7);})[_0x0d3e('0x27')](function(_0x4b7fcc){_0x40fc71[_0x0d3e('0x44')]=_0x4b7fcc;return _0x40fc71;})[_0x0d3e('0x27')](respondWithFilteredResult(_0x2844e4,_0x4092c7))[_0x0d3e('0x45')](handleError(_0x2844e4,null));};exports[_0x0d3e('0x46')]=function(_0x182ce3,_0x1c41e7){var _0x33b20e={'raw':!![],'where':{'id':_0x182ce3[_0x0d3e('0x47')]['id']}},_0x75dd3a={};_0x75dd3a[_0x0d3e('0x33')]=_[_0x0d3e('0x35')](db[_0x0d3e('0x43')][_0x0d3e('0x2f')]);_0x75dd3a[_0x0d3e('0x34')]=_['keys'](_0x182ce3['query']);_0x75dd3a[_0x0d3e('0x36')]=_[_0x0d3e('0x37')](_0x75dd3a[_0x0d3e('0x33')],_0x75dd3a[_0x0d3e('0x34')]);_0x33b20e[_0x0d3e('0x39')]=_[_0x0d3e('0x37')](_0x75dd3a['model'],qs[_0x0d3e('0x38')](_0x182ce3['query'][_0x0d3e('0x38')]));_0x33b20e['attributes']=_0x33b20e['attributes'][_0x0d3e('0x48')]?_0x33b20e[_0x0d3e('0x39')]:_0x75dd3a[_0x0d3e('0x33')];if(_0x182ce3['query'][_0x0d3e('0x49')]){_0x33b20e[_0x0d3e('0x4a')]=[{'all':!![]}];}_0x33b20e=_[_0x0d3e('0x41')]({},_0x33b20e,_0x182ce3['options']);return db[_0x0d3e('0x43')][_0x0d3e('0x4b')](_0x33b20e)['then'](handleEntityNotFound(_0x1c41e7,null))[_0x0d3e('0x27')](respondWithResult(_0x1c41e7,null))['catch'](handleError(_0x1c41e7,null));};exports[_0x0d3e('0x4c')]=function(_0x533cd3,_0x37ad11,_0x41ff4d){return db[_0x0d3e('0x43')]['find']({'where':{'id':_0x533cd3['params']['id']},'attributes':[_0x0d3e('0x2d'),_0x0d3e('0x4d')],'raw':!![]})[_0x0d3e('0x27')](handleEntityNotFound(_0x37ad11,null))[_0x0d3e('0x27')](function(_0x5f011d){if(_0x5f011d){var _0x3d44b0=path[_0x0d3e('0x4e')](config[_0x0d3e('0x4f')],_0x0d3e('0x50'),util['format']('%s.zip',path['basename'](_0x5f011d[_0x0d3e('0x4d')])));var _0x35a7b5=fs[_0x0d3e('0x51')](_0x3d44b0);var _0x5605b2=archiver(_0x0d3e('0x52'),{'zlib':{'level':0x9}});_0x5605b2['on'](_0x0d3e('0x53'),function(_0x3f544a){if(_0x3f544a[_0x0d3e('0x54')]===_0x0d3e('0x55')){logger['error'](_0x3f544a);}else{throw new db[(_0x0d3e('0x56'))][(_0x0d3e('0x57'))](_0x0d3e('0x58'));}});_0x5605b2['on'](_0x0d3e('0x2b'),function(_0x3fadf1){throw new db[(_0x0d3e('0x56'))][(_0x0d3e('0x57'))](_0x0d3e('0x58'));});_0x5605b2[_0x0d3e('0x59')](_0x35a7b5);_0x5605b2['glob'](_0x0d3e('0x5a'),{'cwd':path[_0x0d3e('0x4e')](config[_0x0d3e('0x4f')],_0x0d3e('0x50'),path[_0x0d3e('0x5b')](_0x5f011d['path'])),'ignore':[path['join'](path[_0x0d3e('0x5c')](_0x5f011d[_0x0d3e('0x4d')]),'node_modules/**/*'),path['join'](path[_0x0d3e('0x5c')](_0x5f011d[_0x0d3e('0x4d')]),_0x0d3e('0x5d'))],'nodir':!![]})[_0x0d3e('0x5e')]();_0x35a7b5['on'](_0x0d3e('0x5f'),function(){if(!fs[_0x0d3e('0x60')](_0x3d44b0)){throw new db['Sequelize']['Error'](_0x0d3e('0x61'));}return _0x37ad11[_0x0d3e('0x4c')](_0x3d44b0,util[_0x0d3e('0x62')](_0x0d3e('0x63'),path[_0x0d3e('0x5c')](_0x5f011d[_0x0d3e('0x4d')])),function(_0x36a29b){if(_0x36a29b){throw new db[(_0x0d3e('0x56'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x0d3e('0x64')](_0x3d44b0);logger['info'](_0x0d3e('0x65'));logger[_0x0d3e('0x66')](_0x0d3e('0x67'));});});}return null;})[_0x0d3e('0x45')](handleError(_0x37ad11,null));};exports[_0x0d3e('0x68')]=function(_0x3f645e,_0x510e2a,_0x370f3b){var _0x564316=path['basename'](_0x3f645e[_0x0d3e('0x69')][_0x0d3e('0x6a')],path['extname'](_0x3f645e[_0x0d3e('0x69')][_0x0d3e('0x6a')]));var _0x5b0beb=path['join'](config['root'],'server/files/plugins',_0x3f645e[_0x0d3e('0x69')][_0x0d3e('0x6a')]);var _0x46b458=path[_0x0d3e('0x4e')](config[_0x0d3e('0x4f')],_0x0d3e('0x50'),_0x564316);logger[_0x0d3e('0x66')]('Plugin\x20upload\x20filepath:\x20%s',_0x5b0beb);logger['info'](_0x0d3e('0x6b'),_0x46b458);try{fs['chmodSync'](_0x5b0beb,parseInt(_0x0d3e('0x6c'),0x8));extract(_0x5b0beb,{'dir':_0x46b458},function(_0x4bf2a9){if(_0x4bf2a9){logger['error'](_0x4bf2a9);handleError(_0x4bf2a9,!![]);};var _0x2c6848=fs[_0x0d3e('0x6d')](_0x46b458);if(_0x2c6848[_0x0d3e('0x48')]>0x1){removeReferences(_0x5b0beb,_0x46b458);logger[_0x0d3e('0x2b')](_0x0d3e('0x6e'));return _0x370f3b(new Error(_0x0d3e('0x6e')));}var _0x1b11de=fs[_0x0d3e('0x6f')](path['join'](_0x46b458,_0x2c6848[0x0]));if(_0x1b11de[_0x0d3e('0x70')]()){removeReferences(_0x5b0beb,_0x46b458);logger['error'](_0x0d3e('0x6e'));return _0x370f3b(new Error('Invalid\x20plugin\x20structure'));}if(_0x1b11de[_0x0d3e('0x71')]()){var _0x251ada=fs[_0x0d3e('0x6d')](path[_0x0d3e('0x4e')](_0x46b458,_0x2c6848[0x0]));if(_0x251ada[_0x0d3e('0x48')]===0x0){removeReferences(_0x5b0beb,_0x46b458);logger[_0x0d3e('0x2b')](_0x0d3e('0x6e'));return _0x370f3b(new Error(_0x0d3e('0x6e')));}var _0x34d9bd=_0x251ada['some'](function(_0x27b42e){return _0x27b42e===_0x0d3e('0x72');});if(!_0x34d9bd){return _0x370f3b(new Error(_0x0d3e('0x73')));}var _0xd74ffb=fs['readFileSync'](path[_0x0d3e('0x4e')](_0x46b458,_0x2c6848[0x0],_0x0d3e('0x72')));var _0x3407ff=JSON['parse'](_0xd74ffb);if(_0x0d3e('0x74')==typeof _0x3407ff[_0x0d3e('0x2d')]){return _0x370f3b(new Error(_0x0d3e('0x75')));}if(_0x0d3e('0x74')==typeof _0x3407ff[_0x0d3e('0x31')]){return _0x370f3b(new Error(_0x0d3e('0x76')));}if(_0x0d3e('0x74')==typeof _0x3407ff['version']){return _0x370f3b(new Error(_0x0d3e('0x77')));}if('undefined'==typeof _0x3407ff[_0x0d3e('0x78')]){return _0x370f3b(new Error(_0x0d3e('0x79')));}if(_0x3407ff[_0x0d3e('0x31')]===_0x0d3e('0x7a')){if(_0x0d3e('0x74')==typeof _0x3407ff['parameters']['views']){return _0x370f3b(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x0d3e('0x74')==typeof _0x3407ff[_0x0d3e('0x78')][_0x0d3e('0x7b')][_0x0d3e('0x7c')]&&'undefined'==typeof _0x3407ff[_0x0d3e('0x78')][_0x0d3e('0x7b')]['agent']){return _0x370f3b(new Error(_0x0d3e('0x7d')));}}else if(_0x3407ff['type']===_0x0d3e('0x7e')){if(_0x0d3e('0x74')==typeof _0x3407ff['parameters'][_0x0d3e('0x7f')]){return _0x370f3b(new Error(_0x0d3e('0x80')));}if('undefined'==typeof _0x3407ff[_0x0d3e('0x78')][_0x0d3e('0x81')]){return _0x370f3b(new Error(_0x0d3e('0x82')));}}else{return _0x370f3b(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x51e114=_0x3407ff[_0x0d3e('0x2d')];var _0x5d224d=_0x3407ff[_0x0d3e('0x83')];var _0x5c5168=_0x3407ff[_0x0d3e('0x31')];var _0x3bb426=_0x3407ff[_0x0d3e('0x84')]?_0x3407ff[_0x0d3e('0x84')]:_0x0d3e('0x85');var _0x43ad65=_0x3407ff[_0x0d3e('0x86')]?_0x3407ff[_0x0d3e('0x86')]:_0x0d3e('0x87');var _0x4946c7='';var _0x3a91d5='';var _0x5db097='';var _0x26c3d9='';var _0x3e962b=_0x3407ff[_0x0d3e('0x88')];if(_0x5c5168==='html'){if('undefined'!=typeof _0x3407ff[_0x0d3e('0x78')]['views'][_0x0d3e('0x7c')]){var _0x4414c2=_0x3407ff[_0x0d3e('0x78')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4414c2)){_0x4946c7=path[_0x0d3e('0x4e')]('plugins',_0x564316,_0x2c6848[0x0],_0x4414c2);}else{_0x4946c7=_0x4414c2;}}else{logger[_0x0d3e('0x66')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x3407ff[_0x0d3e('0x78')][_0x0d3e('0x7b')][_0x0d3e('0x89')]){var _0x8d89a5=_0x3407ff[_0x0d3e('0x78')]['views'][_0x0d3e('0x89')];if(!/^(f|ht)tps?:\/\//i[_0x0d3e('0x8a')](_0x8d89a5)){_0x3a91d5=path[_0x0d3e('0x4e')](_0x0d3e('0x8b'),_0x564316,_0x2c6848[0x0],_0x8d89a5);}else{_0x3a91d5=_0x8d89a5;}}else{logger[_0x0d3e('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5c5168==='script'){_0x5db097=_0x3407ff[_0x0d3e('0x78')]['scriptName'];_0x26c3d9=_0x3407ff[_0x0d3e('0x78')][_0x0d3e('0x81')];if(_0x0d3e('0x74')!=typeof _0x3407ff[_0x0d3e('0x78')][_0x0d3e('0x7b')]){if(_0x0d3e('0x74')!=typeof _0x3407ff[_0x0d3e('0x78')][_0x0d3e('0x7b')]['admin']){var _0x4414c2=_0x3407ff['parameters'][_0x0d3e('0x7b')][_0x0d3e('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x0d3e('0x8a')](_0x4414c2)){_0x4946c7=path['join'](_0x0d3e('0x8b'),_0x564316,_0x2c6848[0x0],_0x4414c2);}else{_0x4946c7=_0x4414c2;}}if(_0x0d3e('0x74')!=typeof _0x3407ff['parameters']['views'][_0x0d3e('0x89')]){var _0x8d89a5=_0x3407ff[_0x0d3e('0x78')][_0x0d3e('0x7b')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x0d3e('0x8a')](_0x8d89a5)){_0x3a91d5=path['join'](_0x0d3e('0x8b'),_0x564316,_0x2c6848[0x0],_0x8d89a5);}else{_0x3a91d5=_0x8d89a5;}}}}var _0x32a8b0={'name':_0x51e114,'description':_0x5d224d,'path':path[_0x0d3e('0x4e')](_0x564316,_0x2c6848[0x0]),'type':_0x5c5168,'sidebar':_0x3bb426,'icon':_0x43ad65,'adminUrl':_0x4946c7,'agentUrl':_0x3a91d5,'scriptName':_0x5db097,'scriptPath':_0x26c3d9,'version':_0x3e962b};removeReferences(_0x5b0beb,null);return db[_0x0d3e('0x43')][_0x0d3e('0x8c')](_0x32a8b0)[_0x0d3e('0x27')](function(_0x10d8f8){var _0x2bb40c={'role':_0x3f645e[_0x0d3e('0x8d')][_0x0d3e('0x8e')],'userProfileId':_0x3f645e[_0x0d3e('0x8d')]['userProfileId']};if(!_0x2bb40c)throw new Error(_0x0d3e('0x8f'));if(_0x2bb40c[_0x0d3e('0x8e')]===_0x0d3e('0x90')){var _0x2a7ad5=_0x10d8f8[_0x0d3e('0x91')]({'plain':!![]});return db[_0x0d3e('0x92')][_0x0d3e('0x4b')]({'where':{'name':_0x0d3e('0x29'),'userProfileId':_0x2bb40c[_0x0d3e('0x93')]},'raw':!![]})[_0x0d3e('0x27')](function(_0x56b38b){if(_0x56b38b&&_0x56b38b[_0x0d3e('0x94')]===0x0){return db['UserProfileResource'][_0x0d3e('0x8c')]({'name':_0x2a7ad5[_0x0d3e('0x2d')],'resourceId':_0x2a7ad5['id'],'type':_0x56b38b['name'],'sectionId':_0x56b38b['id']},{})[_0x0d3e('0x27')](function(){return _0x10d8f8;});}else{return _0x10d8f8;}})[_0x0d3e('0x45')](function(_0x2c3af1){logger[_0x0d3e('0x2b')](_0x0d3e('0x95'),_0x2c3af1);throw _0x2c3af1;});}return _0x10d8f8;})[_0x0d3e('0x27')](respondWithResult(_0x510e2a,null))[_0x0d3e('0x45')](handleError(_0x510e2a,null));}});}catch(_0x322b5d){_0x510e2a[_0x0d3e('0x1c')](0x1f4)['send'](_0x322b5d);}};function removeReferences(_0x3eea8a,_0x10bdb6){try{if(_0x3eea8a){fs[_0x0d3e('0x64')](_0x3eea8a);logger[_0x0d3e('0x66')]('Zip\x20archive\x20removed');}if(_0x10bdb6){rimraf(_0x10bdb6,function(){});logger[_0x0d3e('0x66')](_0x0d3e('0x96'));}}catch(_0x59b5db){logger['error'](_0x59b5db);}}exports[_0x0d3e('0x26')]=function(_0x3145b5,_0x281f94,_0x60848d){return db[_0x0d3e('0x43')][_0x0d3e('0x4b')]({'where':{'id':_0x3145b5[_0x0d3e('0x47')]['id']}})[_0x0d3e('0x27')](handleEntityNotFound(_0x281f94,null))['then'](saveUpdates(_0x3145b5[_0x0d3e('0x8d')],null))[_0x0d3e('0x27')](respondWithResult(_0x281f94,null))[_0x0d3e('0x45')](handleError(_0x281f94,null));};exports[_0x0d3e('0x97')]=function(_0x54df4c,_0x3d7951,_0xd030ed){return db[_0x0d3e('0x43')][_0x0d3e('0x4b')]({'where':{'id':_0x54df4c['params']['id']}})[_0x0d3e('0x27')](function(_0xb513a0){if(_0xb513a0){return _0xb513a0['destroy']();}})[_0x0d3e('0x27')](function(_0x5e85ce){rimraf(path[_0x0d3e('0x4e')](config['root'],_0x0d3e('0x50'),path['dirname'](_0x5e85ce[_0x0d3e('0x4d')])),function(){});return _0x5e85ce;})['then'](handleEntityNotFound(_0x3d7951,null))['then'](respondWithStatusCode(_0x3d7951,null))[_0x0d3e('0x45')](handleError(_0x3d7951,null));};exports['webhookGet']=function(_0x556600,_0x278dfe,_0x75eb5c){return BPromise[_0x0d3e('0x98')]()['then'](function(){if(!_0x556600['query'][_0x0d3e('0x4d')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x556600['query'][_0x0d3e('0x99')]){throw new Error(_0x0d3e('0x9a'));}var _0x381d4a=_0x556600[_0x0d3e('0x34')]['hostname']?_0x556600[_0x0d3e('0x34')][_0x0d3e('0x9b')]+':'+_0x556600[_0x0d3e('0x34')][_0x0d3e('0x99')]:'http://localhost:'+_0x556600[_0x0d3e('0x34')][_0x0d3e('0x99')];var _0x1e6b10=_0x556600[_0x0d3e('0x34')][_0x0d3e('0x1d')]?_0x556600[_0x0d3e('0x34')][_0x0d3e('0x1d')]:!![];var _0x4cff5a=_0x556600[_0x0d3e('0x34')]['encoding']?_0x556600[_0x0d3e('0x34')][_0x0d3e('0x9c')]:null;var _0x223660={'method':_0x556600['method'],'uri':util[_0x0d3e('0x62')](_0x0d3e('0x9d'),_0x381d4a,_0x556600[_0x0d3e('0x34')][_0x0d3e('0x4d')]),'json':_0x1e6b10,'resolveWithFullResponse':!![],'encoding':_0x4cff5a,'qs':_0x556600['query']};if(_0x556600[_0x0d3e('0x9e')]){_0x223660['headers']=_0x556600[_0x0d3e('0x9e')];if(_0x223660[_0x0d3e('0x9e')][_0x0d3e('0x9f')]){delete _0x223660[_0x0d3e('0x9e')][_0x0d3e('0x9f')];}}if(_0x223660['headers']['content-type']){delete _0x223660[_0x0d3e('0x9e')][_0x0d3e('0xa0')];}return rp(_0x223660);})[_0x0d3e('0x27')](function(_0x44b38b){if(_0x44b38b){_0x278dfe[_0x0d3e('0x21')](_0x44b38b[_0x0d3e('0x9e')]);logger[_0x0d3e('0x66')](_0x44b38b[_0x0d3e('0x8d')]);if(_[_0x0d3e('0xa1')](_0x556600[_0x0d3e('0x34')][_0x0d3e('0x4d')],_0x0d3e('0x4c'))&&_0x44b38b[_0x0d3e('0xa2')]==0x1f4){return _0x278dfe['sendStatus'](_0x44b38b[_0x0d3e('0xa2')]);}else{return _0x278dfe[_0x0d3e('0x1c')](_0x44b38b[_0x0d3e('0xa2')])[_0x0d3e('0xa3')](_0x44b38b[_0x0d3e('0x8d')]);}}else{return _0x278dfe[_0x0d3e('0x1b')](0xc8);}})[_0x0d3e('0x45')](handleError(_0x278dfe,null));};exports[_0x0d3e('0xa4')]=function(_0x5f1242,_0x1d0f01,_0x2521b2){return BPromise[_0x0d3e('0x98')]()[_0x0d3e('0x27')](function(){if(!_0x5f1242['query'][_0x0d3e('0x4d')]){throw new Error(_0x0d3e('0xa5'));}if(!_0x5f1242[_0x0d3e('0x34')][_0x0d3e('0x99')]){throw new Error(_0x0d3e('0x9a'));}var _0x486186=_0x5f1242[_0x0d3e('0x34')][_0x0d3e('0x9b')]?_0x5f1242['query'][_0x0d3e('0x9b')]+':'+_0x5f1242[_0x0d3e('0x34')]['port']:'http://localhost:'+_0x5f1242['query'][_0x0d3e('0x99')];var _0xcc8b87=_0x5f1242['query'][_0x0d3e('0x1d')]?_0x5f1242[_0x0d3e('0x34')]['json']:!![];var _0x58aff2=_0x5f1242[_0x0d3e('0x34')]['encoding']?_0x5f1242[_0x0d3e('0x34')][_0x0d3e('0x9c')]:null;var _0x116391={'method':_0x5f1242[_0x0d3e('0xa6')],'uri':util[_0x0d3e('0x62')](_0x0d3e('0x9d'),_0x486186,_0x5f1242[_0x0d3e('0x34')][_0x0d3e('0x4d')]),'json':_0xcc8b87,'resolveWithFullResponse':!![],'encoding':_0x58aff2,'body':_0x5f1242['body']};if(_0x5f1242['headers']){_0x116391[_0x0d3e('0x9e')]=_0x5f1242[_0x0d3e('0x9e')];if(_0x116391[_0x0d3e('0x9e')]['content-length']){delete _0x116391[_0x0d3e('0x9e')][_0x0d3e('0x9f')];}}if(_0x116391[_0x0d3e('0x9e')]['content-type']){delete _0x116391['headers'][_0x0d3e('0xa0')];}return rp(_0x116391);})['then'](function(_0x5c1792){if(_0x5c1792){_0x1d0f01[_0x0d3e('0x21')](_0x5c1792[_0x0d3e('0x9e')]);logger[_0x0d3e('0x66')](_0x5c1792['body']);return _0x1d0f01[_0x0d3e('0x1c')](_0x5c1792['statusCode'])[_0x0d3e('0xa3')](_0x5c1792[_0x0d3e('0x8d')]);}else{return _0x1d0f01[_0x0d3e('0x1b')](0xc8);}})[_0x0d3e('0x45')](handleError(_0x1d0f01,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 2b67247..fa88297 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 _0x7a3e=['Plugin','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xf20838,_0x4f0be9){var _0x37ec00=function(_0x37239b){while(--_0x37239b){_0xf20838['push'](_0xf20838['shift']());}};_0x37ec00(++_0x4f0be9);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x36f9d0,_0x12f155){_0x36f9d0=_0x36f9d0-0x0;var _0xfcea6a=_0x7a3e[_0x36f9d0];return _0xfcea6a;};'use strict';var EventEmitter=require(_0xe7a3('0x0'));var Plugin=require(_0xe7a3('0x1'))['db'][_0xe7a3('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7a3('0x3'),'afterUpdate':_0xe7a3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x522203){return function(_0x9d97ac,_0x4053f3,_0x11d8bf){PluginEvents['emit'](_0x522203+':'+_0x9d97ac['id'],_0x9d97ac);PluginEvents[_0xe7a3('0x5')](_0x522203,_0x9d97ac);_0x11d8bf(null);};}for(var e in events){if(events[_0xe7a3('0x6')](e)){var event=events[e];Plugin[_0xe7a3('0x7')](e,emitEvent(event));}}module[_0xe7a3('0x8')]=PluginEvents; \ No newline at end of file +var _0xdd68=['setMaxListeners','save','update','emit','hasOwnProperty','exports','events','Plugin'];(function(_0x200b80,_0x1d5307){var _0x773a5a=function(_0x2bcafb){while(--_0x2bcafb){_0x200b80['push'](_0x200b80['shift']());}};_0x773a5a(++_0x1d5307);}(_0xdd68,0x196));var _0x8dd6=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0xdd68[_0x25df80];return _0x17b6d0;};'use strict';var EventEmitter=require(_0x8dd6('0x0'));var Plugin=require('../../mysqldb')['db'][_0x8dd6('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x8dd6('0x2')](0x0);var events={'afterCreate':_0x8dd6('0x3'),'afterUpdate':_0x8dd6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x37b71c){return function(_0x469e0c,_0x5c7c72,_0x310895){PluginEvents[_0x8dd6('0x5')](_0x37b71c+':'+_0x469e0c['id'],_0x469e0c);PluginEvents['emit'](_0x37b71c,_0x469e0c);_0x310895(null);};}for(var e in events){if(events[_0x8dd6('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8dd6('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 802b52e..bbb334a 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 _0x2308=['exports','define','plugins','lodash','util','moment','bluebird','rimraf','../../config/environment','./plugin.attributes'];(function(_0x54f336,_0x171826){var _0x3fea0c=function(_0x43fa58){while(--_0x43fa58){_0x54f336['push'](_0x54f336['shift']());}};_0x3fea0c(++_0x171826);}(_0x2308,0x193));var _0x8230=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2308[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x8230('0x0'));var util=require(_0x8230('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8230('0x2'));var BPromise=require(_0x8230('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8230('0x4'));var config=require(_0x8230('0x5'));var attributes=require(_0x8230('0x6'));module[_0x8230('0x7')]=function(_0x4d71bd,_0x236364){return _0x4d71bd[_0x8230('0x8')]('Plugin',attributes,{'tableName':_0x8230('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46f0=['plugins','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x30ca0b,_0x5cbe5b){var _0x320b45=function(_0x5aaa8e){while(--_0x5aaa8e){_0x30ca0b['push'](_0x30ca0b['shift']());}};_0x320b45(++_0x5cbe5b);}(_0x46f0,0x12a));var _0x046f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x46f0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x046f('0x0'));var util=require(_0x046f('0x1'));var logger=require('../../config/logger')(_0x046f('0x2'));var moment=require('moment');var BPromise=require(_0x046f('0x3'));var rp=require(_0x046f('0x4'));var fs=require('fs');var path=require(_0x046f('0x5'));var rimraf=require(_0x046f('0x6'));var config=require(_0x046f('0x7'));var attributes=require(_0x046f('0x8'));module[_0x046f('0x9')]=function(_0x3deb2b,_0x587c7c){return _0x3deb2b['define']('Plugin',attributes,{'tableName':_0x046f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 6efd2d5..ede8fd9 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 _0x1ae4=['redis','defaults','localhost','./plugin.socket','request','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','result','catch','create','options','raw','then','debug','CreatePlugin','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3dce98,_0x588617){var _0x3f3cb5=function(_0x161cfe){while(--_0x161cfe){_0x3dce98['push'](_0x3dce98['shift']());}};_0x3f3cb5(++_0x588617);}(_0x1ae4,0x114));var _0x41ae=function(_0xdec3b7,_0x5742b1){_0xdec3b7=_0xdec3b7-0x0;var _0x15a00f=_0x1ae4[_0xdec3b7];return _0x15a00f;};'use strict';var _=require(_0x41ae('0x0'));var util=require(_0x41ae('0x1'));var moment=require(_0x41ae('0x2'));var BPromise=require('bluebird');var rs=require(_0x41ae('0x3'));var fs=require('fs');var Redis=require(_0x41ae('0x4'));var db=require(_0x41ae('0x5'))['db'];var utils=require(_0x41ae('0x6'));var logger=require(_0x41ae('0x7'))(_0x41ae('0x8'));var config=require(_0x41ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41ae('0xa')][_0x41ae('0xb')]({'port':0x232a});config[_0x41ae('0xc')]=_[_0x41ae('0xd')](config['redis'],{'host':_0x41ae('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41ae('0xc')]));require(_0x41ae('0xf'))['register'](socket);function respondWithRpcPromise(_0x5c5cd8,_0x138347,_0x5bedd6){return new BPromise(function(_0x151268,_0x4b5a3c){return client[_0x41ae('0x10')](_0x5c5cd8,_0x5bedd6)['then'](function(_0x16c7b0){logger[_0x41ae('0x11')]('Plugin,\x20%s,\x20%s',_0x138347,_0x41ae('0x12'));logger['debug'](_0x41ae('0x13'),_0x138347,_0x41ae('0x12'),JSON[_0x41ae('0x14')](_0x16c7b0));if(_0x16c7b0[_0x41ae('0x15')]){if(_0x16c7b0[_0x41ae('0x15')]['code']===0x1f4){logger[_0x41ae('0x15')](_0x41ae('0x16'),_0x138347,_0x16c7b0[_0x41ae('0x15')]['message']);return _0x4b5a3c(_0x16c7b0['error']['message']);}logger['error']('Plugin,\x20%s,\x20%s',_0x138347,_0x16c7b0[_0x41ae('0x15')][_0x41ae('0x17')]);return _0x151268(_0x16c7b0[_0x41ae('0x15')][_0x41ae('0x17')]);}else{logger[_0x41ae('0x11')](_0x41ae('0x16'),_0x138347,_0x41ae('0x12'));_0x151268(_0x16c7b0[_0x41ae('0x18')][_0x41ae('0x17')]);}})[_0x41ae('0x19')](function(_0x24f11c){logger[_0x41ae('0x15')](_0x41ae('0x16'),_0x138347,_0x24f11c);_0x4b5a3c(_0x24f11c);});});}exports['CreatePlugin']=function(_0x4551be){var _0x5b981a=this;return new Promise(function(_0x2b07ec,_0x1c6cf2){return db['Plugin'][_0x41ae('0x1a')](_0x4551be['body'],{'raw':_0x4551be[_0x41ae('0x1b')]?_0x4551be['options'][_0x41ae('0x1c')]===undefined?!![]:![]:!![]})[_0x41ae('0x1d')](function(_0x4fb38a){logger[_0x41ae('0x11')]('CreatePlugin',_0x4551be);logger[_0x41ae('0x1e')](_0x41ae('0x1f'),_0x4551be,JSON[_0x41ae('0x14')](_0x4fb38a));_0x2b07ec(_0x4fb38a);})[_0x41ae('0x19')](function(_0x2f7ea5){logger[_0x41ae('0x15')](_0x41ae('0x1f'),_0x2f7ea5[_0x41ae('0x17')],_0x4551be);_0x1c6cf2(_0x5b981a[_0x41ae('0x15')](0x1f4,_0x2f7ea5['message']));});});}; \ No newline at end of file +var _0x0cae=['create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./plugin.socket','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','request\x20sent','result','catch','CreatePlugin','Plugin'];(function(_0x188c88,_0x210793){var _0x4e4c38=function(_0x3d9e41){while(--_0x3d9e41){_0x188c88['push'](_0x188c88['shift']());}};_0x4e4c38(++_0x210793);}(_0x0cae,0xa4));var _0xe0ca=function(_0x1e4875,_0x408017){_0x1e4875=_0x1e4875-0x0;var _0x1912a8=_0x0cae[_0x1e4875];return _0x1912a8;};'use strict';var _=require(_0xe0ca('0x0'));var util=require(_0xe0ca('0x1'));var moment=require('moment');var BPromise=require(_0xe0ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0ca('0x3'));var db=require(_0xe0ca('0x4'))['db'];var utils=require(_0xe0ca('0x5'));var logger=require(_0xe0ca('0x6'))(_0xe0ca('0x7'));var config=require(_0xe0ca('0x8'));var jayson=require(_0xe0ca('0x9'));var client=jayson[_0xe0ca('0xa')]['http']({'port':0x232a});config[_0xe0ca('0xb')]=_['defaults'](config[_0xe0ca('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0ca('0xc'))(new Redis(config[_0xe0ca('0xb')]));require(_0xe0ca('0xd'))['register'](socket);function respondWithRpcPromise(_0xd100f1,_0x3ae0b3,_0x22e78d){return new BPromise(function(_0x441501,_0x29e0f7){return client['request'](_0xd100f1,_0x22e78d)[_0xe0ca('0xe')](function(_0x5a3111){logger[_0xe0ca('0xf')]('Plugin,\x20%s,\x20%s',_0x3ae0b3,'request\x20sent');logger[_0xe0ca('0x10')](_0xe0ca('0x11'),_0x3ae0b3,'request\x20sent',JSON[_0xe0ca('0x12')](_0x5a3111));if(_0x5a3111[_0xe0ca('0x13')]){if(_0x5a3111['error'][_0xe0ca('0x14')]===0x1f4){logger['error'](_0xe0ca('0x15'),_0x3ae0b3,_0x5a3111[_0xe0ca('0x13')][_0xe0ca('0x16')]);return _0x29e0f7(_0x5a3111[_0xe0ca('0x13')][_0xe0ca('0x16')]);}logger['error'](_0xe0ca('0x15'),_0x3ae0b3,_0x5a3111[_0xe0ca('0x13')][_0xe0ca('0x16')]);return _0x441501(_0x5a3111[_0xe0ca('0x13')][_0xe0ca('0x16')]);}else{logger[_0xe0ca('0xf')]('Plugin,\x20%s,\x20%s',_0x3ae0b3,_0xe0ca('0x17'));_0x441501(_0x5a3111[_0xe0ca('0x18')][_0xe0ca('0x16')]);}})[_0xe0ca('0x19')](function(_0x1793c0){logger[_0xe0ca('0x13')](_0xe0ca('0x15'),_0x3ae0b3,_0x1793c0);_0x29e0f7(_0x1793c0);});});}exports[_0xe0ca('0x1a')]=function(_0x1f80df){var _0x2503b6=this;return new Promise(function(_0x10cde1,_0x270301){return db[_0xe0ca('0x1b')][_0xe0ca('0x1c')](_0x1f80df[_0xe0ca('0x1d')],{'raw':_0x1f80df['options']?_0x1f80df[_0xe0ca('0x1e')][_0xe0ca('0x1f')]===undefined?!![]:![]:!![]})[_0xe0ca('0xe')](function(_0x4afe31){logger[_0xe0ca('0xf')](_0xe0ca('0x1a'),_0x1f80df);logger[_0xe0ca('0x10')](_0xe0ca('0x1a'),_0x1f80df,JSON[_0xe0ca('0x12')](_0x4afe31));_0x10cde1(_0x4afe31);})[_0xe0ca('0x19')](function(_0x5bc513){logger[_0xe0ca('0x13')]('CreatePlugin',_0x5bc513[_0xe0ca('0x16')],_0x1f80df);_0x270301(_0x2503b6['error'](0x1f4,_0x5bc513[_0xe0ca('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0ba9626..6f04441 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 _0x053f=['length','plugin:','save','remove','update','removeListener','register'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x053f,0x198));var _0xf053=function(_0x187335,_0x36baf1){_0x187335=_0x187335-0x0;var _0x5e603b=_0x053f[_0x187335];return _0x5e603b;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xf053('0x0'),_0xf053('0x1'),_0xf053('0x2')];function createListener(_0x452f85,_0x2db903){return function(_0x9a2b01){_0x2db903['emit'](_0x452f85,_0x9a2b01);};}function removeListener(_0x1710e1,_0x6ae0f2){return function(){PluginEvents[_0xf053('0x3')](_0x1710e1,_0x6ae0f2);};}exports[_0xf053('0x4')]=function(_0x1f8ead){for(var _0x41c890=0x0,_0x18df1d=events[_0xf053('0x5')];_0x41c890<_0x18df1d;_0x41c890++){var _0xf58fbf=events[_0x41c890];var _0xad97ea=createListener(_0xf053('0x6')+_0xf58fbf,_0x1f8ead);PluginEvents['on'](_0xf58fbf,_0xad97ea);}}; \ No newline at end of file +var _0x8ec5=['plugin:','remove','update','emit','removeListener','register'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8ec5,0x8b));var _0x58ec=function(_0x21e69f,_0x51ec32){_0x21e69f=_0x21e69f-0x0;var _0x5d20d9=_0x8ec5[_0x21e69f];return _0x5d20d9;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x58ec('0x0'),_0x58ec('0x1')];function createListener(_0x5dd90f,_0xe6e854){return function(_0x31c694){_0xe6e854[_0x58ec('0x2')](_0x5dd90f,_0x31c694);};}function removeListener(_0x2d8bb3,_0x33ea00){return function(){PluginEvents[_0x58ec('0x3')](_0x2d8bb3,_0x33ea00);};}exports[_0x58ec('0x4')]=function(_0x588d8b){for(var _0x1feaa5=0x0,_0x5e30cc=events['length'];_0x1feaa5<_0x5e30cc;_0x1feaa5++){var _0x5703e7=events[_0x1feaa5];var _0x198d8b=createListener(_0x58ec('0x5')+_0x5703e7,_0x588d8b);PluginEvents['on'](_0x5703e7,_0x198d8b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index df7753e..7acc271 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(_0x11a7f3,_0x299f5a){var _0x3d2054=function(_0x57f4bf){while(--_0x57f4bf){_0x11a7f3['push'](_0x11a7f3['shift']());}};_0x3d2054(++_0x299f5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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(_0x382273,_0x273936){var _0x892391=function(_0x193468){while(--_0x193468){_0x382273['push'](_0x382273['shift']());}};_0x892391(++_0x273936);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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 0b45b69..e5f3857 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 _0xc788=['body','script','join','../../files/plugins','chdir','dirname','start','dump','send','update','stop','hasOwnProperty','Unknown\x20status','params','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','sendStatus','status','error','stack','name','info','index','list','then','reject','motion2','catch','show','describe'];(function(_0x2b8388,_0x246b8f){var _0x3ba12a=function(_0x848995){while(--_0x848995){_0x2b8388['push'](_0x2b8388['shift']());}};_0x3ba12a(++_0x246b8f);}(_0xc788,0xc4));var _0x8c78=function(_0x4b40de,_0x3efe59){_0x4b40de=_0x4b40de-0x0;var _0x5c9460=_0xc788[_0x4b40de];return _0x5c9460;};'use strict';var _=require(_0x8c78('0x0'));var pm2=require(_0x8c78('0x1'));var logger=require(_0x8c78('0x2'))('api');var path=require('path');var exec=require(_0x8c78('0x3'))[_0x8c78('0x4')];var BPromise=require(_0x8c78('0x5'));function handleEntityNotFound(_0x1d0670,_0x386f0a){return function(_0x5498f9){if(!_0x5498f9){_0x1d0670[_0x8c78('0x6')](0x194);;}return _0x5498f9;};}function respondWithResult(_0x4555da,_0x329152){_0x329152=_0x329152||0xc8;return function(_0x1ac27f){if(_0x1ac27f){return _0x4555da[_0x8c78('0x7')](_0x329152)['json'](_0x1ac27f);}return null;};}function handleError(_0x247188,_0x299d9d){_0x299d9d=_0x299d9d||0x1f4;return function(_0x9bc075){logger[_0x8c78('0x8')](_0x9bc075[_0x8c78('0x9')]);if(_0x9bc075[_0x8c78('0xa')]){delete _0x9bc075['name'];}_0x247188[_0x8c78('0x7')](_0x299d9d)['send'](_0x9bc075);};}function execChildProcess(){return new BPromise(function(_0x3d55f0,_0x45935a){exec('npm\x20install',function(_0x1a05a7,_0x95e78e,_0x5ee642){logger[_0x8c78('0xb')](_0x95e78e);logger['info'](_0x5ee642);if(_0x1a05a7){logger['error'](_0x1a05a7);return _0x45935a(_0x1a05a7);}return _0x3d55f0(_0x95e78e);});});}exports[_0x8c78('0xc')]=function(_0x1b1d0e,_0x26178c){return pm2[_0x8c78('0xd')]()[_0x8c78('0xe')](function(_0x3d1306){if(_0x3d1306){var _0xe5f8ae=_[_0x8c78('0xf')](_0x3d1306,function(_0x2f44af){return _0x2f44af[_0x8c78('0xa')]==='express'||_0x2f44af[_0x8c78('0xa')]===_0x8c78('0x10');});return{'rows':_0xe5f8ae,'count':_0xe5f8ae['length']};}return null;})[_0x8c78('0xe')](respondWithResult(_0x26178c,null))[_0x8c78('0x11')](handleError(_0x26178c,null));};exports[_0x8c78('0x12')]=function(_0x23824e,_0x2a982c){return pm2[_0x8c78('0x13')](_0x23824e['params']['id'])['then'](respondWithResult(_0x2a982c,null))[_0x8c78('0xe')](handleEntityNotFound(_0x2a982c,null))['catch'](handleError(_0x2a982c,null));};exports['create']=function(_0xece4f0,_0x56c191){if(_0xece4f0[_0x8c78('0x14')][_0x8c78('0xa')]&&_0xece4f0['body'][_0x8c78('0x15')]){var _0x5b111b=path[_0x8c78('0x16')](__dirname,_0x8c78('0x17'),_0xece4f0['body'][_0x8c78('0x15')]);var _0x188cc3=process['cwd']();process[_0x8c78('0x18')](path[_0x8c78('0x19')](_0x5b111b));return execChildProcess()[_0x8c78('0xe')](function(_0x9581c6){process[_0x8c78('0x18')](_0x188cc3);return pm2[_0x8c78('0x1a')]({'name':_0xece4f0[_0x8c78('0x14')][_0x8c78('0xa')],'script':_0x5b111b});})[_0x8c78('0xe')](function(_0x4a7d20){pm2[_0x8c78('0x1b')]();return _0x4a7d20[0x0];})[_0x8c78('0xe')](respondWithResult(_0x56c191,0xc9))[_0x8c78('0x11')](handleError(_0x56c191,null));}else{return _0x56c191['status'](0x1f4)[_0x8c78('0x1c')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8c78('0x1d')]=function(_0x24f9a7,_0x8d9ff9){if(_0x24f9a7['body']['id']){delete _0x24f9a7[_0x8c78('0x14')]['id'];}var _0x2568d5={'online':'restart','stopped':_0x8c78('0x1e')};if(_0x2568d5[_0x8c78('0x1f')](_0x24f9a7[_0x8c78('0x14')][_0x8c78('0x7')])){return pm2[_0x2568d5[_0x24f9a7[_0x8c78('0x14')][_0x8c78('0x7')]]](_0x24f9a7['params']['id'])[_0x8c78('0xe')](respondWithResult(_0x8d9ff9,0xc8))['catch'](handleError(_0x8d9ff9,null));}else{return _0x8d9ff9[_0x8c78('0x7')](0x1f4)[_0x8c78('0x1c')]({'message':_0x8c78('0x20')});}};exports['destroy']=function(_0x1f1a0c,_0x3816d2){if(_0x1f1a0c['body']['id']){delete _0x1f1a0c[_0x8c78('0x14')]['id'];}if(_0x1f1a0c[_0x8c78('0x21')]['id']){return pm2[_0x8c78('0x22')](_0x1f1a0c['params']['id'])[_0x8c78('0xe')](function(_0x63307e){pm2[_0x8c78('0x1b')]();return _0x63307e[0x0];})['then'](respondWithResult(_0x3816d2,null))[_0x8c78('0x11')](handleError(_0x3816d2,null));}else{return _0x3816d2[_0x8c78('0x7')](0x1f4)['send']({'message':_0x8c78('0x23')});}}; \ No newline at end of file +var _0x9c44=['exec','bluebird','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','motion2','length','catch','body','script','join','../../files/plugins','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','../../config/logger','api','path','child_process'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var path=require(_0x49c4('0x2'));var exec=require(_0x49c4('0x3'))[_0x49c4('0x4')];var BPromise=require(_0x49c4('0x5'));function handleEntityNotFound(_0x4e0313,_0x4941f1){return function(_0x41a183){if(!_0x41a183){_0x4e0313['sendStatus'](0x194);;}return _0x41a183;};}function respondWithResult(_0xc1278f,_0x6030ae){_0x6030ae=_0x6030ae||0xc8;return function(_0x69bc41){if(_0x69bc41){return _0xc1278f[_0x49c4('0x6')](_0x6030ae)[_0x49c4('0x7')](_0x69bc41);}return null;};}function handleError(_0x511d53,_0x11c586){_0x11c586=_0x11c586||0x1f4;return function(_0x42e4f8){logger[_0x49c4('0x8')](_0x42e4f8[_0x49c4('0x9')]);if(_0x42e4f8['name']){delete _0x42e4f8['name'];}_0x511d53[_0x49c4('0x6')](_0x11c586)[_0x49c4('0xa')](_0x42e4f8);};}function execChildProcess(){return new BPromise(function(_0x58cad7,_0xb611a1){exec(_0x49c4('0xb'),function(_0x4adb3c,_0x536d42,_0x1d19bf){logger[_0x49c4('0xc')](_0x536d42);logger['info'](_0x1d19bf);if(_0x4adb3c){logger[_0x49c4('0x8')](_0x4adb3c);return _0xb611a1(_0x4adb3c);}return _0x58cad7(_0x536d42);});});}exports[_0x49c4('0xd')]=function(_0x5f2fd9,_0x1909fe){return pm2[_0x49c4('0xe')]()[_0x49c4('0xf')](function(_0x2decee){if(_0x2decee){var _0x12777c=_[_0x49c4('0x10')](_0x2decee,function(_0x75ea8){return _0x75ea8[_0x49c4('0x11')]==='express'||_0x75ea8[_0x49c4('0x11')]===_0x49c4('0x12');});return{'rows':_0x12777c,'count':_0x12777c[_0x49c4('0x13')]};}return null;})[_0x49c4('0xf')](respondWithResult(_0x1909fe,null))[_0x49c4('0x14')](handleError(_0x1909fe,null));};exports['show']=function(_0x44e607,_0x2891f4){return pm2['describe'](_0x44e607['params']['id'])[_0x49c4('0xf')](respondWithResult(_0x2891f4,null))[_0x49c4('0xf')](handleEntityNotFound(_0x2891f4,null))[_0x49c4('0x14')](handleError(_0x2891f4,null));};exports['create']=function(_0x24856d,_0x50b151){if(_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')]&&_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]){var _0x382040=path[_0x49c4('0x17')](__dirname,_0x49c4('0x18'),_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]);var _0x578447=process['cwd']();process['chdir'](path[_0x49c4('0x19')](_0x382040));return execChildProcess()['then'](function(_0x592bb8){process[_0x49c4('0x1a')](_0x578447);return pm2[_0x49c4('0x1b')]({'name':_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')],'script':_0x382040});})['then'](function(_0x5850f2){pm2[_0x49c4('0x1c')]();return _0x5850f2[0x0];})[_0x49c4('0xf')](respondWithResult(_0x50b151,0xc9))['catch'](handleError(_0x50b151,null));}else{return _0x50b151[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x1d')});}};exports[_0x49c4('0x1e')]=function(_0x531d92,_0x543ea2){if(_0x531d92[_0x49c4('0x15')]['id']){delete _0x531d92['body']['id'];}var _0x3800b7={'online':_0x49c4('0x1f'),'stopped':_0x49c4('0x20')};if(_0x3800b7[_0x49c4('0x21')](_0x531d92['body'][_0x49c4('0x6')])){return pm2[_0x3800b7[_0x531d92[_0x49c4('0x15')][_0x49c4('0x6')]]](_0x531d92[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](respondWithResult(_0x543ea2,0xc8))[_0x49c4('0x14')](handleError(_0x543ea2,null));}else{return _0x543ea2[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x23')});}};exports[_0x49c4('0x24')]=function(_0x46f7ea,_0x4ea6ea){if(_0x46f7ea['body']['id']){delete _0x46f7ea['body']['id'];}if(_0x46f7ea[_0x49c4('0x22')]['id']){return pm2[_0x49c4('0x25')](_0x46f7ea[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](function(_0x28eb47){pm2['dump']();return _0x28eb47[0x0];})[_0x49c4('0xf')](respondWithResult(_0x4ea6ea,null))[_0x49c4('0x14')](handleError(_0x4ea6ea,null));}else{return _0x4ea6ea[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index aed2d33..0586727 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 _0x41e8=['/queues','getQueues','express','Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x41e8,0x119));var _0x841e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x41e8[_0x55f8b4];return _0x2475f9;};'use strict';var express=require(_0x841e('0x0'));var router=express[_0x841e('0x1')]();var auth=require(_0x841e('0x2'));var controller=require('./realtime.controller');router[_0x841e('0x3')](_0x841e('0x4'),auth[_0x841e('0x5')](),controller[_0x841e('0x6')]);router[_0x841e('0x3')](_0x841e('0x7'),auth[_0x841e('0x5')](),controller[_0x841e('0x8')]);module['exports']=router; \ No newline at end of file +var _0xf759=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents'];(function(_0x532807,_0x92d7fd){var _0x40b83f=function(_0x1c312c){while(--_0x1c312c){_0x532807['push'](_0x532807['shift']());}};_0x40b83f(++_0x92d7fd);}(_0xf759,0xb6));var _0x9f75=function(_0x387151,_0x4283d5){_0x387151=_0x387151-0x0;var _0x4eacc3=_0xf759[_0x387151];return _0x4eacc3;};'use strict';var express=require(_0x9f75('0x0'));var router=express[_0x9f75('0x1')]();var auth=require(_0x9f75('0x2'));var controller=require(_0x9f75('0x3'));router['get'](_0x9f75('0x4'),auth[_0x9f75('0x5')](),controller[_0x9f75('0x6')]);router['get']('/queues',auth[_0x9f75('0x5')](),controller[_0x9f75('0x7')]);module[_0x9f75('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 589a9aa..b53cde8 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 _0xdf78=['globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','getAgentIdsByQueues','then','rows','getSortedAgentsIdsByStatus','length','map','rawAttributes','fieldName','key','role','agent','raw','push','sequelize','order','forEach','Pause','where','merge','user','userProfileId','online','assign','omit','getResources','User','findAndCountAll','filterAgentAttributes','getAgentStatus','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','startCase','type','name','voice','outbound','dialMethod','getOptions','QueueCampaigns','Queues','filter','UserProfile','initializeQueues','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','count','limit','status','set','Content-Range','json','getAgents','getChannels','query'];(function(_0x5b1394,_0x17f08d){var _0x483150=function(_0x1d9539){while(--_0x1d9539){_0x5b1394['push'](_0x5b1394['shift']());}};_0x483150(++_0x17f08d);}(_0xdf78,0x17e));var _0x8df7=function(_0x2f2b64,_0x37427c){_0x2f2b64=_0x2f2b64-0x0;var _0x42242d=_0xdf78[_0x2f2b64];return _0x42242d;};'use strict';var _=require('lodash');var util=require(_0x8df7('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0x8df7('0x1'));var qs=require(_0x8df7('0x2'));var utils=require(_0x8df7('0x3'));var db=require(_0x8df7('0x4'))['db'];var APIBadRequestError=require(_0x8df7('0x5'))[_0x8df7('0x6')];var APIHandleError=require(_0x8df7('0x5'))['handleError'];function respondWithFilteredResult(_0x546c9e,_0x3b4f2c){return function(_0x501362){if(_0x501362){var _0x220da3=typeof _0x3b4f2c[_0x8df7('0x7')]===_0x8df7('0x8')&&typeof _0x3b4f2c['limit']===_0x8df7('0x8');var _0x44c080=_0x501362[_0x8df7('0x9')];var _0x1e8ea4=_0x220da3?0x0:_0x3b4f2c['offset'];var _0x477de1=_0x220da3?_0x501362[_0x8df7('0x9')]:_0x3b4f2c[_0x8df7('0x7')]+_0x3b4f2c[_0x8df7('0xa')];var _0x247299;if(_0x477de1>=_0x44c080){_0x477de1=_0x44c080;_0x247299=0xc8;}else{_0x247299=0xce;}_0x546c9e[_0x8df7('0xb')](_0x247299);return _0x546c9e[_0x8df7('0xc')](_0x8df7('0xd'),_0x1e8ea4+'-'+_0x477de1+'/'+_0x44c080)[_0x8df7('0xe')](_0x501362);}return null;};}exports[_0x8df7('0xf')]=function(_0x3bbefa,_0x17c7dc){var _0x78fe97={'count':0x0,'rows':[]};var _0x375bce={};var _0x49ed06;var _0x302f5b=utils[_0x8df7('0x10')]();var _0x5c6ffa;var _0x437427;var _0x2db041=_0x3bbefa[_0x8df7('0x11')]['globalQueueFilter'];var _0x62ed42=_0x3bbefa[_0x8df7('0x11')][_0x8df7('0x12')];var _0xc102ae=_0x3bbefa[_0x8df7('0x11')][_0x8df7('0x13')];var _0x5bd3f9=_0x62ed42===_0x8df7('0x14')||_0x62ed42===_0x8df7('0x15')?!![]:![];var _0x35ecea=[];var _0x55a391;var _0x4e42b1;Promise[_0x8df7('0x16')]()['then'](function(){if(_0x3bbefa[_0x8df7('0x11')][_0x8df7('0x17')]){if(!utils['isValidChannel'](_0x3bbefa[_0x8df7('0x11')][_0x8df7('0x17')])){throw new APIBadRequestError(util[_0x8df7('0x18')](_0x8df7('0x19'),_0x3bbefa[_0x8df7('0x11')]['channel']));}_0x49ed06=_0x3bbefa[_0x8df7('0x11')][_0x8df7('0x17')][_0x8df7('0x1a')]();}if(!_0x3bbefa['query'][_0x8df7('0x1b')]||!_0x3bbefa[_0x8df7('0x11')]['sort'][_0x8df7('0x1c')](_0x8df7('0x1d'))){_0x3bbefa['query'][_0x8df7('0x1b')]=rta[_0x8df7('0x1e')](_0x3bbefa[_0x8df7('0x11')]['sort']);return;}var _0x43f6b2=rta['getUpdatedSortOptions'](_0x3bbefa[_0x8df7('0x11')][_0x8df7('0x1b')]);_0x3bbefa[_0x8df7('0x11')]['sort']=_0x43f6b2[_0x8df7('0x1f')][_0x8df7('0x20')](',');_0x55a391=_0x43f6b2['order'];})['then'](function(){if(!_0x2db041){return[];}return rta[_0x8df7('0x21')](_0x2db041,_0x49ed06);})[_0x8df7('0x22')](function(_0x1b2261){_0x35ecea=_0x1b2261;return rta['getRealtimeAgents']();})[_0x8df7('0x22')](function(_0x1de26a){_0x437427=_0x1de26a[_0x8df7('0x23')];if((!_0x62ed42||_0x5bd3f9)&&!_0x55a391){return _0x35ecea;}if(_0x55a391&&!_0x62ed42){return rta[_0x8df7('0x24')](_0x437427,_0x35ecea,_0x55a391);}else{return rta['getAgentIdsByStatus'](_0x437427,_0x35ecea,_0x62ed42);}})[_0x8df7('0x22')](function(_0x11a65f){_0x35ecea=_0x11a65f;var _0x4431fe=![];if(_0x35ecea[_0x8df7('0x25')]===0x0){if(_0x2db041||_0x62ed42){_0x4431fe=!![];}if(_0x5bd3f9){_0x4431fe=![];}}if(_0x4431fe){return _0x78fe97;}var _0x25a822=_[_0x8df7('0x26')](db['User'][_0x8df7('0x27')],function(_0x2acc19){return{'name':_0x2acc19[_0x8df7('0x28')],'type':_0x2acc19['type'][_0x8df7('0x29')]};});_0x3bbefa['query'][_0x8df7('0x2a')]=_0x8df7('0x2b');_0x375bce=qs['getOptions'](_0x25a822,_0x3bbefa);_0x375bce[_0x8df7('0x2c')]=!![];var _0x2af7a0=[];if(_0x35ecea['length']>0x0){_0x2af7a0[_0x8df7('0x2d')]({'id':{'$in':_0x35ecea}});if(_0x55a391&&!_0x62ed42){_0x4e42b1=[db[_0x8df7('0x2e')]['literal']('FIELD(id,'+_0x35ecea+')')];_0x375bce[_0x8df7('0x2f')]=_0x4e42b1;}}if(_0x5bd3f9){_0x302f5b[_0x8df7('0x30')](function(_0x15dfbe){var _0x3a1fe2=!![];if(_0x62ed42==='*pause'&&_0x49ed06!==_0x15dfbe){_0x3a1fe2=![];}_0x2af7a0[_0x8df7('0x2d')]({[_0x15dfbe+_0x8df7('0x31')]:_0x3a1fe2});});if(_0xc102ae){_0x2af7a0[_0x8df7('0x2d')]({'pauseType':_0xc102ae});}}else if(_0x62ed42){_0x302f5b[_0x8df7('0x30')](function(_0x1fcef9){_0x2af7a0[_0x8df7('0x2d')]({[_0x1fcef9+_0x8df7('0x31')]:![]});});}_0x375bce[_0x8df7('0x32')]=_[_0x8df7('0x33')](_0x375bce['where'],{'$and':_0x2af7a0});if(_0x3bbefa['user'][_0x8df7('0x2a')]==='user'){var _0x147d10={'params':{'id':_0x3bbefa[_0x8df7('0x34')][_0x8df7('0x35')]},'query':{'section':'Agents','role':_0x8df7('0x2b'),'raw':!![],'ids':_0x35ecea,'customSorting':_0x4e42b1}};if(_0x3bbefa[_0x8df7('0x11')][_0x8df7('0x36')]){_0x147d10[_0x8df7('0x11')][_0x8df7('0x36')]=!![];}if(_0x5bd3f9){_0x147d10[_0x8df7('0x11')]['extraQueryConditions']=_0x2af7a0;}_0x147d10['query']=Object[_0x8df7('0x37')](_0x147d10['query'],_[_0x8df7('0x38')](_0x3bbefa['query'],'id'));return db['UserProfile'][_0x8df7('0x39')](_0x147d10);}return db[_0x8df7('0x3a')][_0x8df7('0x3b')](_0x375bce);})[_0x8df7('0x22')](function(_0x4c8e40){_0x78fe97[_0x8df7('0x9')]=_0x4c8e40[_0x8df7('0x9')];_0x5c6ffa=_0x4c8e40[_0x8df7('0x23')];return _0x5c6ffa[_0x8df7('0x26')](function(_0x49277c){var _0x266ce5=_['find'](_0x437427,['id',_0x49277c['id']]);if(_0x266ce5){var _0x2dc98a=rta[_0x8df7('0x3c')](_0x266ce5);_[_0x8df7('0x33')](_0x49277c,_0x2dc98a);}_0x49277c[_0x8df7('0x1d')]=rta[_0x8df7('0x3d')](_0x49277c);if(_0x49277c[_0x8df7('0x1d')][_0x8df7('0x1c')]('pause')){_0x302f5b['forEach'](function(_0x260784){if(_0x49277c[_0x260784+_0x8df7('0x31')]){if(_0x260784==='voice'){if(_0x49277c[_0x8df7('0x3e')]!==_0x8df7('0x3f')){_0x49277c[_0x8df7('0x3e')]=_0x8df7('0x14');}}else{_0x49277c[_0x260784+_0x8df7('0x40')]='pause';}}});}return _0x49277c;});})[_0x8df7('0x22')](function(_0x3de967){if(!_0x55a391||_0x4e42b1){return _0x3de967;}return rta[_0x8df7('0x41')](_0x3de967,_0x55a391);})[_0x8df7('0x22')](function(_0x3ea408){var _0x1ea21c=rta[_0x8df7('0x42')]();_0x78fe97[_0x8df7('0x23')]=_0x3ea408[_0x8df7('0x26')](function(_0x200138){return _[_0x8df7('0x43')](_0x200138,_0x1ea21c);});return _0x78fe97;})['then'](respondWithFilteredResult(_0x17c7dc,_0x375bce))['catch'](APIHandleError(_0x17c7dc));};exports['getQueues']=function(_0x21156a,_0x24e4b9){var _0x243040={'count':0x0,'rows':[]};var _0x1da8ba={};var _0x46be2d;var _0x33ca8c;var _0x2792e9;Promise[_0x8df7('0x16')]()[_0x8df7('0x22')](function(){if(_0x21156a[_0x8df7('0x11')][_0x8df7('0x17')]){if(!utils['isValidChannel'](_0x21156a[_0x8df7('0x11')][_0x8df7('0x17')])){throw new APIBadRequestError(util[_0x8df7('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x21156a[_0x8df7('0x11')][_0x8df7('0x17')]));}_0x46be2d=_0x21156a[_0x8df7('0x11')]['channel'][_0x8df7('0x1a')]();}var _0x5e31b9=_[_0x8df7('0x44')](_0x46be2d)+'Queue';var _0x3be5c6=_['map'](db[_0x5e31b9][_0x8df7('0x27')],function(_0x2606ac){return{'name':_0x2606ac[_0x8df7('0x28')],'type':_0x2606ac[_0x8df7('0x45')][_0x8df7('0x29')]};});if(!_0x21156a[_0x8df7('0x11')][_0x8df7('0x1f')]){var _0x39378d=['id',_0x8df7('0x46')];if(_0x46be2d===_0x8df7('0x47')){_0x39378d[_0x8df7('0x2d')](_0x8df7('0x45'));if(_0x21156a[_0x8df7('0x11')][_0x8df7('0x45')]===_0x8df7('0x48')){_0x39378d[_0x8df7('0x2d')](['dialActive',_0x8df7('0x49')]);}}_0x21156a[_0x8df7('0x11')][_0x8df7('0x1f')]=_0x39378d['join'](',');}_0x1da8ba=qs[_0x8df7('0x4a')](_0x3be5c6,_0x21156a);if(_0x21156a[_0x8df7('0x34')][_0x8df7('0x2a')]===_0x8df7('0x34')){var _0x3d7095={'params':{'id':_0x21156a[_0x8df7('0x34')][_0x8df7('0x35')]},'query':{'section':_0x46be2d===_0x8df7('0x47')&&_0x21156a[_0x8df7('0x11')][_0x8df7('0x45')]===_0x8df7('0x48')?_0x8df7('0x4b'):_[_0x8df7('0x44')](_0x46be2d)+_0x8df7('0x4c'),'type':_0x21156a['query'][_0x8df7('0x45')],'nolimit':!![],'sort':_0x8df7('0x46'),'filter':_0x21156a['query'][_0x8df7('0x4d')]}};_0x3d7095['query']=Object['assign'](_0x3d7095[_0x8df7('0x11')],_0x21156a[_0x8df7('0x11')]);delete _0x3d7095[_0x8df7('0x11')]['id'];return db[_0x8df7('0x4e')]['getResources'](_0x3d7095);}return db[_0x5e31b9][_0x8df7('0x3b')](_0x1da8ba);})['then'](function(_0x2c10e1){_0x243040['count']=_0x2c10e1[_0x8df7('0x9')];_0x33ca8c=_0x2c10e1['rows'];return rtq['getRealtimeQueues'](_0x21156a,_0x46be2d);})[_0x8df7('0x22')](function(_0x4c833a){_0x2792e9=_0x4c833a[_0x8df7('0x23')];return rtq[_0x8df7('0x4f')](_0x33ca8c,_0x2792e9,_0x46be2d,_0x21156a[_0x8df7('0x11')][_0x8df7('0x45')]);})[_0x8df7('0x22')](function(_0x2288a4){_0x243040['rows']=_0x2288a4;return _0x243040;})[_0x8df7('0x22')](respondWithFilteredResult(_0x24e4b9,_0x1da8ba))['catch'](APIHandleError(_0x24e4b9));}; \ No newline at end of file +var _0x7b4e=['validateSortParameter','getUpdatedSortOptions','join','getAgentIdsByQueues','then','rows','getSortedAgentsIdsByStatus','length','map','User','type','role','agent','raw','push','sequelize','literal','FIELD(id,','order','Pause','forEach','merge','where','user','Agents','online','extraQueryConditions','omit','UserProfile','getResources','findAndCountAll','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','rawAttributes','fieldName','key','fields','name','outbound','dialActive','getOptions','userProfileId','QueueCampaigns','Queues','filter','assign','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','status','Content-Range','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','*pause','resolve','channel','isValidChannel','format','toLowerCase','sort','includes','globalStatus'];(function(_0x186d11,_0x27b4ea){var _0x24705d=function(_0x5aecd7){while(--_0x5aecd7){_0x186d11['push'](_0x186d11['shift']());}};_0x24705d(++_0x27b4ea);}(_0x7b4e,0xe2));var _0xe7b4=function(_0x48119e,_0x1f3087){_0x48119e=_0x48119e-0x0;var _0x5d5909=_0x7b4e[_0x48119e];return _0x5d5909;};'use strict';var _=require(_0xe7b4('0x0'));var util=require(_0xe7b4('0x1'));var rta=require(_0xe7b4('0x2'));var rtq=require(_0xe7b4('0x3'));var qs=require(_0xe7b4('0x4'));var utils=require('../../config/utils');var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xe7b4('0x5'))[_0xe7b4('0x6')];var APIHandleError=require(_0xe7b4('0x5'))[_0xe7b4('0x7')];function respondWithFilteredResult(_0x4499dd,_0x4808a1){return function(_0x25f89b){if(_0x25f89b){var _0xa7f5f5=typeof _0x4808a1[_0xe7b4('0x8')]===_0xe7b4('0x9')&&typeof _0x4808a1['limit']==='undefined';var _0x1511b0=_0x25f89b[_0xe7b4('0xa')];var _0x3094a1=_0xa7f5f5?0x0:_0x4808a1[_0xe7b4('0x8')];var _0x13d0f7=_0xa7f5f5?_0x25f89b[_0xe7b4('0xa')]:_0x4808a1[_0xe7b4('0x8')]+_0x4808a1[_0xe7b4('0xb')];var _0x11f2bb;if(_0x13d0f7>=_0x1511b0){_0x13d0f7=_0x1511b0;_0x11f2bb=0xc8;}else{_0x11f2bb=0xce;}_0x4499dd[_0xe7b4('0xc')](_0x11f2bb);return _0x4499dd['set'](_0xe7b4('0xd'),_0x3094a1+'-'+_0x13d0f7+'/'+_0x1511b0)['json'](_0x25f89b);}return null;};}exports[_0xe7b4('0xe')]=function(_0x372e4e,_0x35142e){var _0x3707a8={'count':0x0,'rows':[]};var _0xcb0125={};var _0x5c2245;var _0x598245=utils[_0xe7b4('0xf')]();var _0x1cfd78;var _0x21f24d;var _0x411a91=_0x372e4e[_0xe7b4('0x10')][_0xe7b4('0x11')];var _0x402247=_0x372e4e['query']['globalStatusFilter'];var _0x7435dd=_0x372e4e['query'][_0xe7b4('0x12')];var _0xe146a2=_0x402247===_0xe7b4('0x13')||_0x402247===_0xe7b4('0x14')?!![]:![];var _0x2d3437=[];var _0x537da7;var _0x1b1bd8;Promise[_0xe7b4('0x15')]()['then'](function(){if(_0x372e4e['query'][_0xe7b4('0x16')]){if(!utils[_0xe7b4('0x17')](_0x372e4e[_0xe7b4('0x10')]['channel'])){throw new APIBadRequestError(util[_0xe7b4('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x372e4e['query'][_0xe7b4('0x16')]));}_0x5c2245=_0x372e4e[_0xe7b4('0x10')][_0xe7b4('0x16')][_0xe7b4('0x19')]();}if(!_0x372e4e[_0xe7b4('0x10')][_0xe7b4('0x1a')]||!_0x372e4e[_0xe7b4('0x10')][_0xe7b4('0x1a')][_0xe7b4('0x1b')](_0xe7b4('0x1c'))){_0x372e4e[_0xe7b4('0x10')][_0xe7b4('0x1a')]=rta[_0xe7b4('0x1d')](_0x372e4e[_0xe7b4('0x10')][_0xe7b4('0x1a')]);return;}var _0x34f4b6=rta[_0xe7b4('0x1e')](_0x372e4e[_0xe7b4('0x10')][_0xe7b4('0x1a')]);_0x372e4e[_0xe7b4('0x10')]['sort']=_0x34f4b6['fields'][_0xe7b4('0x1f')](',');_0x537da7=_0x34f4b6['order'];})['then'](function(){if(!_0x411a91){return[];}return rta[_0xe7b4('0x20')](_0x411a91,_0x5c2245);})['then'](function(_0x256096){_0x2d3437=_0x256096;return rta['getRealtimeAgents']();})[_0xe7b4('0x21')](function(_0xecc56b){_0x21f24d=_0xecc56b[_0xe7b4('0x22')];if((!_0x402247||_0xe146a2)&&!_0x537da7){return _0x2d3437;}if(_0x537da7&&!_0x402247){return rta[_0xe7b4('0x23')](_0x21f24d,_0x2d3437,_0x537da7);}else{return rta['getAgentIdsByStatus'](_0x21f24d,_0x2d3437,_0x402247);}})[_0xe7b4('0x21')](function(_0x34296b){_0x2d3437=_0x34296b;var _0x1c7271=![];if(_0x2d3437[_0xe7b4('0x24')]===0x0){if(_0x411a91||_0x402247){_0x1c7271=!![];}if(_0xe146a2){_0x1c7271=![];}}if(_0x1c7271){return _0x3707a8;}var _0xfb24d7=_[_0xe7b4('0x25')](db[_0xe7b4('0x26')]['rawAttributes'],function(_0x95506a){return{'name':_0x95506a['fieldName'],'type':_0x95506a[_0xe7b4('0x27')]['key']};});_0x372e4e[_0xe7b4('0x10')][_0xe7b4('0x28')]=_0xe7b4('0x29');_0xcb0125=qs['getOptions'](_0xfb24d7,_0x372e4e);_0xcb0125[_0xe7b4('0x2a')]=!![];var _0x3cd07b=[];if(_0x2d3437[_0xe7b4('0x24')]>0x0){_0x3cd07b[_0xe7b4('0x2b')]({'id':{'$in':_0x2d3437}});if(_0x537da7&&!_0x402247){_0x1b1bd8=[db[_0xe7b4('0x2c')][_0xe7b4('0x2d')](_0xe7b4('0x2e')+_0x2d3437+')')];_0xcb0125[_0xe7b4('0x2f')]=_0x1b1bd8;}}if(_0xe146a2){_0x598245['forEach'](function(_0x3e23cd){var _0x29a83f=!![];if(_0x402247==='*pause'&&_0x5c2245!==_0x3e23cd){_0x29a83f=![];}_0x3cd07b[_0xe7b4('0x2b')]({[_0x3e23cd+_0xe7b4('0x30')]:_0x29a83f});});if(_0x7435dd){_0x3cd07b['push']({'pauseType':_0x7435dd});}}else if(_0x402247){_0x598245[_0xe7b4('0x31')](function(_0x1fcf04){_0x3cd07b[_0xe7b4('0x2b')]({[_0x1fcf04+_0xe7b4('0x30')]:![]});});}_0xcb0125['where']=_[_0xe7b4('0x32')](_0xcb0125[_0xe7b4('0x33')],{'$and':_0x3cd07b});if(_0x372e4e['user'][_0xe7b4('0x28')]===_0xe7b4('0x34')){var _0x5104e8={'params':{'id':_0x372e4e[_0xe7b4('0x34')]['userProfileId']},'query':{'section':_0xe7b4('0x35'),'role':_0xe7b4('0x29'),'raw':!![],'ids':_0x2d3437,'customSorting':_0x1b1bd8}};if(_0x372e4e[_0xe7b4('0x10')]['online']){_0x5104e8[_0xe7b4('0x10')][_0xe7b4('0x36')]=!![];}if(_0xe146a2){_0x5104e8[_0xe7b4('0x10')][_0xe7b4('0x37')]=_0x3cd07b;}_0x5104e8[_0xe7b4('0x10')]=Object['assign'](_0x5104e8['query'],_[_0xe7b4('0x38')](_0x372e4e[_0xe7b4('0x10')],'id'));return db[_0xe7b4('0x39')][_0xe7b4('0x3a')](_0x5104e8);}return db[_0xe7b4('0x26')][_0xe7b4('0x3b')](_0xcb0125);})['then'](function(_0x54f16a){_0x3707a8['count']=_0x54f16a[_0xe7b4('0xa')];_0x1cfd78=_0x54f16a[_0xe7b4('0x22')];return _0x1cfd78['map'](function(_0xfd4e6b){var _0x500807=_['find'](_0x21f24d,['id',_0xfd4e6b['id']]);if(_0x500807){var _0x5ee3f8=rta['filterAgentAttributes'](_0x500807);_[_0xe7b4('0x32')](_0xfd4e6b,_0x5ee3f8);}_0xfd4e6b[_0xe7b4('0x1c')]=rta[_0xe7b4('0x3c')](_0xfd4e6b);if(_0xfd4e6b[_0xe7b4('0x1c')][_0xe7b4('0x1b')]('pause')){_0x598245[_0xe7b4('0x31')](function(_0x31e9b6){if(_0xfd4e6b[_0x31e9b6+'Pause']){if(_0x31e9b6===_0xe7b4('0x3d')){if(_0xfd4e6b[_0xe7b4('0x3e')]!==_0xe7b4('0x3f')){_0xfd4e6b[_0xe7b4('0x3e')]=_0xe7b4('0x13');}}else{_0xfd4e6b[_0x31e9b6+_0xe7b4('0x40')]=_0xe7b4('0x13');}}});}return _0xfd4e6b;});})[_0xe7b4('0x21')](function(_0x48faf6){if(!_0x537da7||_0x1b1bd8){return _0x48faf6;}return rta[_0xe7b4('0x41')](_0x48faf6,_0x537da7);})[_0xe7b4('0x21')](function(_0x500128){var _0x28ea96=rta['getRealtimeAgentsQueryFields']();_0x3707a8[_0xe7b4('0x22')]=_0x500128[_0xe7b4('0x25')](function(_0x3c4193){return _[_0xe7b4('0x42')](_0x3c4193,_0x28ea96);});return _0x3707a8;})[_0xe7b4('0x21')](respondWithFilteredResult(_0x35142e,_0xcb0125))[_0xe7b4('0x43')](APIHandleError(_0x35142e));};exports[_0xe7b4('0x44')]=function(_0x454303,_0x4359d0){var _0x5a3499={'count':0x0,'rows':[]};var _0xf0fe0e={};var _0xe0fe0c;var _0x1da3ef;var _0x1fb080;Promise['resolve']()[_0xe7b4('0x21')](function(){if(_0x454303[_0xe7b4('0x10')][_0xe7b4('0x16')]){if(!utils['isValidChannel'](_0x454303[_0xe7b4('0x10')][_0xe7b4('0x16')])){throw new APIBadRequestError(util[_0xe7b4('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x454303[_0xe7b4('0x10')][_0xe7b4('0x16')]));}_0xe0fe0c=_0x454303[_0xe7b4('0x10')][_0xe7b4('0x16')][_0xe7b4('0x19')]();}var _0x565d79=_[_0xe7b4('0x45')](_0xe0fe0c)+'Queue';var _0x2cc1a3=_['map'](db[_0x565d79][_0xe7b4('0x46')],function(_0x5e37fa){return{'name':_0x5e37fa[_0xe7b4('0x47')],'type':_0x5e37fa[_0xe7b4('0x27')][_0xe7b4('0x48')]};});if(!_0x454303[_0xe7b4('0x10')][_0xe7b4('0x49')]){var _0x2bfb49=['id',_0xe7b4('0x4a')];if(_0xe0fe0c===_0xe7b4('0x3d')){_0x2bfb49[_0xe7b4('0x2b')](_0xe7b4('0x27'));if(_0x454303[_0xe7b4('0x10')]['type']===_0xe7b4('0x4b')){_0x2bfb49['push']([_0xe7b4('0x4c'),'dialMethod']);}}_0x454303['query'][_0xe7b4('0x49')]=_0x2bfb49[_0xe7b4('0x1f')](',');}_0xf0fe0e=qs[_0xe7b4('0x4d')](_0x2cc1a3,_0x454303);if(_0x454303[_0xe7b4('0x34')][_0xe7b4('0x28')]===_0xe7b4('0x34')){var _0x196541={'params':{'id':_0x454303['user'][_0xe7b4('0x4e')]},'query':{'section':_0xe0fe0c===_0xe7b4('0x3d')&&_0x454303[_0xe7b4('0x10')][_0xe7b4('0x27')]===_0xe7b4('0x4b')?_0xe7b4('0x4f'):_['startCase'](_0xe0fe0c)+_0xe7b4('0x50'),'type':_0x454303[_0xe7b4('0x10')][_0xe7b4('0x27')],'nolimit':!![],'sort':_0xe7b4('0x4a'),'filter':_0x454303['query'][_0xe7b4('0x51')]}};_0x196541['query']=Object[_0xe7b4('0x52')](_0x196541[_0xe7b4('0x10')],_0x454303['query']);delete _0x196541[_0xe7b4('0x10')]['id'];return db['UserProfile'][_0xe7b4('0x3a')](_0x196541);}return db[_0x565d79]['findAndCountAll'](_0xf0fe0e);})[_0xe7b4('0x21')](function(_0x4738f9){_0x5a3499['count']=_0x4738f9[_0xe7b4('0xa')];_0x1da3ef=_0x4738f9[_0xe7b4('0x22')];return rtq[_0xe7b4('0x53')](_0x454303,_0xe0fe0c);})[_0xe7b4('0x21')](function(_0x5908ea){_0x1fb080=_0x5908ea['rows'];return rtq[_0xe7b4('0x54')](_0x1da3ef,_0x1fb080,_0xe0fe0c,_0x454303[_0xe7b4('0x10')][_0xe7b4('0x27')]);})['then'](function(_0x44dd97){_0x5a3499[_0xe7b4('0x22')]=_0x44dd97;return _0x5a3499;})['then'](respondWithFilteredResult(_0x4359d0,_0xf0fe0e))[_0xe7b4('0x43')](APIHandleError(_0x4359d0));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 623a555..23a6535 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5294c2,_0x3d0fe6){var _0x3d1eac=function(_0x407db6){while(--_0x407db6){_0x5294c2['push'](_0x5294c2['shift']());}};_0x3d1eac(++_0x3d0fe6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a82ec,_0x4045c6){var _0x201c62=function(_0x5e0ad2){while(--_0x5e0ad2){_0x5a82ec['push'](_0x5a82ec['shift']());}};_0x201c62(++_0x4045c6);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 444ea0d..2cb13be 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 _0x8ac9=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x4f0e68,_0x211f12){var _0x5d2d17=function(_0x60fda8){while(--_0x60fda8){_0x4f0e68['push'](_0x4f0e68['shift']());}};_0x5d2d17(++_0x211f12);}(_0x8ac9,0x199));var _0x98ac=function(_0x24697f,_0x19c823){_0x24697f=_0x24697f-0x0;var _0x1e4243=_0x8ac9[_0x24697f];return _0x1e4243;};'use strict';var Sequelize=require(_0x98ac('0x0'));module[_0x98ac('0x1')]={'state':{'type':Sequelize[_0x98ac('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x98ac('0x3')]},'starttime':{'type':Sequelize[_0x98ac('0x4')]},'responsetime':{'type':Sequelize[_0x98ac('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x98ac('0x3')]},'membername':{'type':Sequelize[_0x98ac('0x3')]}}; \ No newline at end of file +var _0xc627=['STRING','DATE','exports','INTEGER'];(function(_0x29f726,_0x533c65){var _0x4a3085=function(_0x383134){while(--_0x383134){_0x29f726['push'](_0x29f726['shift']());}};_0x4a3085(++_0x533c65);}(_0xc627,0x14a));var _0x7c62=function(_0x4a96c5,_0x3e63f1){_0x4a96c5=_0x4a96c5-0x0;var _0x369328=_0xc627[_0x4a96c5];return _0x369328;};'use strict';var Sequelize=require('sequelize');module[_0x7c62('0x0')]={'state':{'type':Sequelize[_0x7c62('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7c62('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x7c62('0x2')]},'starttime':{'type':Sequelize[_0x7c62('0x3')]},'responsetime':{'type':Sequelize[_0x7c62('0x3')]},'ringtime':{'type':Sequelize[_0x7c62('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7c62('0x2')]},'campaigntype':{'type':Sequelize[_0x7c62('0x2')]},'membername':{'type':Sequelize[_0x7c62('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 1574269..63dc048 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 _0xcf4d=['request-promise','path','rimraf','../../config/environment','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x57aa59,_0x45a587){var _0xaac506=function(_0x5b9ef4){while(--_0x5b9ef4){_0x57aa59['push'](_0x57aa59['shift']());}};_0xaac506(++_0x45a587);}(_0xcf4d,0xe4));var _0xdcf4=function(_0x4d631f,_0x1ef8d6){_0x4d631f=_0x4d631f-0x0;var _0x5cb5c8=_0xcf4d[_0x4d631f];return _0x5cb5c8;};'use strict';var _=require(_0xdcf4('0x0'));var util=require(_0xdcf4('0x1'));var logger=require(_0xdcf4('0x2'))(_0xdcf4('0x3'));var moment=require(_0xdcf4('0x4'));var BPromise=require(_0xdcf4('0x5'));var rp=require(_0xdcf4('0x6'));var fs=require('fs');var path=require(_0xdcf4('0x7'));var rimraf=require(_0xdcf4('0x8'));var config=require(_0xdcf4('0x9'));var attributes=require('./reportAgentPreview.attributes');module[_0xdcf4('0xa')]=function(_0x111705,_0x5a2384){return _0x111705['define'](_0xdcf4('0xb'),attributes,{'tableName':_0xdcf4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdc3=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x35cda2,_0x5b81ba){var _0x51eac3=function(_0x20c84d){while(--_0x20c84d){_0x35cda2['push'](_0x35cda2['shift']());}};_0x51eac3(++_0x5b81ba);}(_0xbdc3,0x129));var _0x3bdc=function(_0x52bfab,_0x3695d2){_0x52bfab=_0x52bfab-0x0;var _0x297234=_0xbdc3[_0x52bfab];return _0x297234;};'use strict';var _=require(_0x3bdc('0x0'));var util=require(_0x3bdc('0x1'));var logger=require(_0x3bdc('0x2'))(_0x3bdc('0x3'));var moment=require('moment');var BPromise=require(_0x3bdc('0x4'));var rp=require(_0x3bdc('0x5'));var fs=require('fs');var path=require(_0x3bdc('0x6'));var rimraf=require(_0x3bdc('0x7'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0x3bdc('0x8')]=function(_0x1a5a8c,_0x516e56){return _0x1a5a8c['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','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 b4a1d03..c832293 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 _0x0f20=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','create','body','options','raw'];(function(_0x5b47d9,_0x1327ce){var _0x4151f0=function(_0x24bda2){while(--_0x24bda2){_0x5b47d9['push'](_0x5b47d9['shift']());}};_0x4151f0(++_0x1327ce);}(_0x0f20,0x195));var _0x00f2=function(_0x3559bc,_0x4921b7){_0x3559bc=_0x3559bc-0x0;var _0x561294=_0x0f20[_0x3559bc];return _0x561294;};'use strict';var _=require('lodash');var util=require(_0x00f2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x00f2('0x1'));var fs=require('fs');var Redis=require(_0x00f2('0x2'));var db=require(_0x00f2('0x3'))['db'];var utils=require(_0x00f2('0x4'));var logger=require(_0x00f2('0x5'))('rpc');var config=require(_0x00f2('0x6'));var jayson=require(_0x00f2('0x7'));var client=jayson[_0x00f2('0x8')][_0x00f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4ae7,_0xfd593b,_0x118d62){return new BPromise(function(_0x103f31,_0x2ee8f4){return client[_0x00f2('0xa')](_0x2b4ae7,_0x118d62)[_0x00f2('0xb')](function(_0x1723bc){logger[_0x00f2('0xc')](_0x00f2('0xd'),_0xfd593b,'request\x20sent');logger[_0x00f2('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0xfd593b,_0x00f2('0xf'),JSON[_0x00f2('0x10')](_0x1723bc));if(_0x1723bc[_0x00f2('0x11')]){if(_0x1723bc[_0x00f2('0x11')][_0x00f2('0x12')]===0x1f4){logger[_0x00f2('0x11')](_0x00f2('0xd'),_0xfd593b,_0x1723bc['error']['message']);return _0x2ee8f4(_0x1723bc['error'][_0x00f2('0x13')]);}logger[_0x00f2('0x11')](_0x00f2('0xd'),_0xfd593b,_0x1723bc[_0x00f2('0x11')]['message']);return _0x103f31(_0x1723bc[_0x00f2('0x11')][_0x00f2('0x13')]);}else{logger['info'](_0x00f2('0xd'),_0xfd593b,_0x00f2('0xf'));_0x103f31(_0x1723bc[_0x00f2('0x14')]['message']);}})[_0x00f2('0x15')](function(_0x5ac4e8){logger[_0x00f2('0x11')](_0x00f2('0xd'),_0xfd593b,_0x5ac4e8);_0x2ee8f4(_0x5ac4e8);});});}exports[_0x00f2('0x16')]=function(_0x1e5c97){var _0x39c69f=this;return new Promise(function(_0x36ecbb,_0x4820ad){return db['ReportAgentPreview'][_0x00f2('0x17')](_0x1e5c97[_0x00f2('0x18')],{'raw':_0x1e5c97[_0x00f2('0x19')]?_0x1e5c97[_0x00f2('0x19')][_0x00f2('0x1a')]===undefined?!![]:![]:!![]})[_0x00f2('0xb')](function(_0x2bfa25){logger[_0x00f2('0xc')](_0x00f2('0x16'),_0x1e5c97);logger[_0x00f2('0xe')]('CreateReportAgentPreview',_0x1e5c97,JSON[_0x00f2('0x10')](_0x2bfa25));_0x36ecbb(_0x2bfa25);})[_0x00f2('0x15')](function(_0x3ab6d8){logger[_0x00f2('0x11')](_0x00f2('0x16'),_0x3ab6d8[_0x00f2('0x13')],_0x1e5c97);_0x4820ad(_0x39c69f[_0x00f2('0x11')](0x1f4,_0x3ab6d8[_0x00f2('0x13')]));});});}; \ No newline at end of file +var _0xc552=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateReportAgentPreview','body','options','raw','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20c6f7,_0x36aae5){var _0x376f95=function(_0x50a1e7){while(--_0x50a1e7){_0x20c6f7['push'](_0x20c6f7['shift']());}};_0x376f95(++_0x36aae5);}(_0xc552,0x163));var _0x2c55=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0xc552[_0x35d775];return _0x59384d;};'use strict';var _=require(_0x2c55('0x0'));var util=require(_0x2c55('0x1'));var moment=require('moment');var BPromise=require(_0x2c55('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c55('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c55('0x4'));var logger=require('../../config/logger')(_0x2c55('0x5'));var config=require('../../config/environment');var jayson=require(_0x2c55('0x6'));var client=jayson[_0x2c55('0x7')][_0x2c55('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcbc86d,_0x52f18b,_0x428246){return new BPromise(function(_0x1e8c9e,_0x892fe6){return client['request'](_0xcbc86d,_0x428246)['then'](function(_0x4cbcd2){logger[_0x2c55('0x9')](_0x2c55('0xa'),_0x52f18b,_0x2c55('0xb'));logger[_0x2c55('0xc')](_0x2c55('0xd'),_0x52f18b,_0x2c55('0xb'),JSON[_0x2c55('0xe')](_0x4cbcd2));if(_0x4cbcd2['error']){if(_0x4cbcd2['error']['code']===0x1f4){logger[_0x2c55('0xf')](_0x2c55('0xa'),_0x52f18b,_0x4cbcd2[_0x2c55('0xf')]['message']);return _0x892fe6(_0x4cbcd2[_0x2c55('0xf')][_0x2c55('0x10')]);}logger[_0x2c55('0xf')](_0x2c55('0xa'),_0x52f18b,_0x4cbcd2[_0x2c55('0xf')][_0x2c55('0x10')]);return _0x1e8c9e(_0x4cbcd2[_0x2c55('0xf')]['message']);}else{logger[_0x2c55('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x52f18b,_0x2c55('0xb'));_0x1e8c9e(_0x4cbcd2[_0x2c55('0x11')]['message']);}})['catch'](function(_0x773bdf){logger[_0x2c55('0xf')](_0x2c55('0xa'),_0x52f18b,_0x773bdf);_0x892fe6(_0x773bdf);});});}exports[_0x2c55('0x12')]=function(_0x5533e2){var _0x372e83=this;return new Promise(function(_0x32ba23,_0x4eb5eb){return db['ReportAgentPreview']['create'](_0x5533e2[_0x2c55('0x13')],{'raw':_0x5533e2[_0x2c55('0x14')]?_0x5533e2[_0x2c55('0x14')][_0x2c55('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x4e5090){logger[_0x2c55('0x9')](_0x2c55('0x12'),_0x5533e2);logger[_0x2c55('0xc')](_0x2c55('0x12'),_0x5533e2,JSON[_0x2c55('0xe')](_0x4e5090));_0x32ba23(_0x4e5090);})[_0x2c55('0x16')](function(_0x4afe08){logger[_0x2c55('0xf')](_0x2c55('0x12'),_0x4afe08[_0x2c55('0x10')],_0x5533e2);_0x4eb5eb(_0x372e83[_0x2c55('0xf')](0x1f4,_0x4afe08[_0x2c55('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a71cf07..aaa9845 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 _0xb31b=['/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/campaigns','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb31b,0x9f));var _0xbb31=function(_0x3c5379,_0x4eff18){_0x3c5379=_0x3c5379-0x0;var _0x1442a9=_0xb31b[_0x3c5379];return _0x1442a9;};'use strict';var multer=require(_0xbb31('0x0'));var util=require(_0xbb31('0x1'));var path=require(_0xbb31('0x2'));var express=require('express');var router=express[_0xbb31('0x3')]();var auth=require(_0xbb31('0x4'));var controller=require(_0xbb31('0x5'));router[_0xbb31('0x6')](_0xbb31('0x7'),auth['isAuthenticated'](),controller[_0xbb31('0x8')]);router[_0xbb31('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xbb31('0x9')](),controller['voiceChannelMixMonitor']);router['get'](_0xbb31('0xa'),auth[_0xbb31('0x9')](),controller[_0xbb31('0xb')]);router[_0xbb31('0x6')](_0xbb31('0xc'),auth[_0xbb31('0x9')](),controller[_0xbb31('0xd')]);router[_0xbb31('0x6')](_0xbb31('0xe'),auth[_0xbb31('0x9')](),controller[_0xbb31('0xf')]);router[_0xbb31('0x6')](_0xbb31('0x10'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xbb31('0x6')](_0xbb31('0x11'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x12')]);router['get'](_0xbb31('0x13'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x14')]);router[_0xbb31('0x6')](_0xbb31('0x15'),auth[_0xbb31('0x9')](),controller['smsQueues']);router[_0xbb31('0x6')]('/whatsapp/queues',auth[_0xbb31('0x9')](),controller['whatsappQueues']);router['get'](_0xbb31('0x16'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x17')]);router[_0xbb31('0x6')](_0xbb31('0x18'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x19')]);router[_0xbb31('0x6')](_0xbb31('0x1a'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x1b')]);router[_0xbb31('0x6')](_0xbb31('0x1c'),auth[_0xbb31('0x9')](),controller['voiceQueuesChannel']);router[_0xbb31('0x6')](_0xbb31('0x1d'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x1e')]);router[_0xbb31('0x6')](_0xbb31('0x1f'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x20')]);router[_0xbb31('0x6')](_0xbb31('0x21'),auth['isAuthenticated'](),controller[_0xbb31('0x22')]);router['put'](_0xbb31('0x21'),auth[_0xbb31('0x9')](),controller['updateVoiceQueue']);router[_0xbb31('0x6')]('/outbound',auth[_0xbb31('0x9')](),controller[_0xbb31('0x23')]);router['get'](_0xbb31('0x24'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x25')]);router[_0xbb31('0x6')](_0xbb31('0x26'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x27')]);router[_0xbb31('0x28')](_0xbb31('0x29'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x2a')]);router[_0xbb31('0x6')](_0xbb31('0x2b'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x2c')]);router[_0xbb31('0x6')]('/trunks',auth[_0xbb31('0x9')](),controller['trunks']);router[_0xbb31('0x6')](_0xbb31('0x2d'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x2e')]);router[_0xbb31('0x6')]('/fax/accounts',auth[_0xbb31('0x9')](),controller['faxAccounts']);router[_0xbb31('0x6')](_0xbb31('0x2f'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x30')]);router[_0xbb31('0x6')]('/mail/queues/waitinginteractions',auth[_0xbb31('0x9')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xbb31('0x31'),auth[_0xbb31('0x9')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xbb31('0x32'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0xbb31('0x33'),auth[_0xbb31('0x9')](),controller['smsQueuesWaitingInteractions']);router[_0xbb31('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xbb31('0x9')](),controller[_0xbb31('0x34')]);router[_0xbb31('0x6')](_0xbb31('0x35'),auth[_0xbb31('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0xbb31('0x36')](_0xbb31('0x37'),auth['isAuthenticated'](),controller[_0xbb31('0x38')](_0xbb31('0x39')));router[_0xbb31('0x6')]('/mail/queues/:id',auth[_0xbb31('0x9')](),controller[_0xbb31('0x3a')]);router['post']('/chat/queues/:id/notify',auth[_0xbb31('0x9')](),controller['queueNotify']('chat'));router[_0xbb31('0x6')](_0xbb31('0x3b'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x3c')]);router[_0xbb31('0x36')](_0xbb31('0x3d'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x38')](_0xbb31('0x3e')));router[_0xbb31('0x6')](_0xbb31('0x3f'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x40')]);router['post'](_0xbb31('0x41'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x38')](_0xbb31('0x42')));router[_0xbb31('0x6')](_0xbb31('0x43'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x44')]);router[_0xbb31('0x36')](_0xbb31('0x45'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x38')](_0xbb31('0x46')));router[_0xbb31('0x36')]('/whatsapp/queues/:id/notify',auth[_0xbb31('0x9')](),controller[_0xbb31('0x38')]('whatsapp'));router['get'](_0xbb31('0x47'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x48')]);router[_0xbb31('0x6')](_0xbb31('0x49'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x4a')]);router[_0xbb31('0x36')](_0xbb31('0x4b'),auth[_0xbb31('0x9')](),controller[_0xbb31('0x4c')]);module[_0xbb31('0x4d')]=router; \ No newline at end of file +var _0x28b0=['voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','post','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id','showFaxQueues','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels'];(function(_0x3d8130,_0x251d7c){var _0x30f7ba=function(_0x535a09){while(--_0x535a09){_0x3d8130['push'](_0x3d8130['shift']());}};_0x30f7ba(++_0x251d7c);}(_0x28b0,0x174));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x028b('0x0'));var path=require(_0x028b('0x1'));var express=require(_0x028b('0x2'));var router=express[_0x028b('0x3')]();var auth=require(_0x028b('0x4'));var controller=require(_0x028b('0x5'));router[_0x028b('0x6')](_0x028b('0x7'),auth[_0x028b('0x8')](),controller[_0x028b('0x9')]);router['get'](_0x028b('0xa'),auth['isAuthenticated'](),controller[_0x028b('0xb')]);router[_0x028b('0x6')](_0x028b('0xc'),auth[_0x028b('0x8')](),controller['voiceChannelStopMixMonitor']);router['get'](_0x028b('0xd'),auth[_0x028b('0x8')](),controller[_0x028b('0xe')]);router[_0x028b('0x6')](_0x028b('0xf'),auth[_0x028b('0x8')](),controller[_0x028b('0x10')]);router[_0x028b('0x6')](_0x028b('0x11'),auth[_0x028b('0x8')](),controller['mailQueues']);router[_0x028b('0x6')](_0x028b('0x12'),auth[_0x028b('0x8')](),controller[_0x028b('0x13')]);router['get'](_0x028b('0x14'),auth[_0x028b('0x8')](),controller[_0x028b('0x15')]);router[_0x028b('0x6')](_0x028b('0x16'),auth[_0x028b('0x8')](),controller[_0x028b('0x17')]);router['get'](_0x028b('0x18'),auth[_0x028b('0x8')](),controller['whatsappQueues']);router[_0x028b('0x6')]('/fax/queues',auth[_0x028b('0x8')](),controller['faxQueues']);router['get'](_0x028b('0x19'),auth[_0x028b('0x8')](),controller[_0x028b('0x1a')]);router[_0x028b('0x6')](_0x028b('0x1b'),auth[_0x028b('0x8')](),controller[_0x028b('0x1c')]);router[_0x028b('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x028b('0x8')](),controller[_0x028b('0x1d')]);router[_0x028b('0x6')](_0x028b('0x1e'),auth[_0x028b('0x8')](),controller[_0x028b('0x1f')]);router[_0x028b('0x6')](_0x028b('0x20'),auth['isAuthenticated'](),controller[_0x028b('0x21')]);router[_0x028b('0x6')]('/voice/queues/:id',auth[_0x028b('0x8')](),controller['showVoiceQueues']);router[_0x028b('0x22')](_0x028b('0x23'),auth['isAuthenticated'](),controller[_0x028b('0x24')]);router[_0x028b('0x6')](_0x028b('0x25'),auth[_0x028b('0x8')](),controller[_0x028b('0x26')]);router['get'](_0x028b('0x27'),auth[_0x028b('0x8')](),controller[_0x028b('0x28')]);router[_0x028b('0x6')](_0x028b('0x29'),auth[_0x028b('0x8')](),controller[_0x028b('0x2a')]);router[_0x028b('0x22')](_0x028b('0x2b'),auth[_0x028b('0x8')](),controller['agentCapacity']);router[_0x028b('0x6')](_0x028b('0x2c'),auth[_0x028b('0x8')](),controller[_0x028b('0x2d')]);router[_0x028b('0x6')](_0x028b('0x2e'),auth['isAuthenticated'](),controller['trunks']);router[_0x028b('0x6')]('/campaigns',auth['isAuthenticated'](),controller[_0x028b('0x2f')]);router['get'](_0x028b('0x30'),auth[_0x028b('0x8')](),controller[_0x028b('0x31')]);router['get'](_0x028b('0x32'),auth[_0x028b('0x8')](),controller[_0x028b('0x33')]);router[_0x028b('0x6')](_0x028b('0x34'),auth['isAuthenticated'](),controller[_0x028b('0x35')]);router[_0x028b('0x6')](_0x028b('0x36'),auth['isAuthenticated'](),controller[_0x028b('0x37')]);router['get'](_0x028b('0x38'),auth[_0x028b('0x8')](),controller[_0x028b('0x39')]);router[_0x028b('0x6')](_0x028b('0x3a'),auth[_0x028b('0x8')](),controller[_0x028b('0x3b')]);router[_0x028b('0x6')](_0x028b('0x3c'),auth[_0x028b('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x028b('0x6')]('/fax/queues/waitinginteractions',auth[_0x028b('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x028b('0x3d')]('/mail/queues/:id/notify',auth[_0x028b('0x8')](),controller[_0x028b('0x3e')]('mail'));router[_0x028b('0x6')](_0x028b('0x3f'),auth[_0x028b('0x8')](),controller[_0x028b('0x40')]);router['post'](_0x028b('0x41'),auth[_0x028b('0x8')](),controller['queueNotify'](_0x028b('0x42')));router['get']('/chat/queues/:id',auth[_0x028b('0x8')](),controller[_0x028b('0x43')]);router[_0x028b('0x3d')]('/fax/queues/:id/notify',auth[_0x028b('0x8')](),controller[_0x028b('0x3e')]('fax'));router[_0x028b('0x6')](_0x028b('0x44'),auth[_0x028b('0x8')](),controller[_0x028b('0x45')]);router['post']('/openchannel/queues/:id/notify',auth[_0x028b('0x8')](),controller[_0x028b('0x3e')](_0x028b('0x46')));router['get']('/openchannel/queues/:id',auth[_0x028b('0x8')](),controller[_0x028b('0x47')]);router[_0x028b('0x3d')](_0x028b('0x48'),auth[_0x028b('0x8')](),controller['queueNotify']('sms'));router[_0x028b('0x3d')](_0x028b('0x49'),auth['isAuthenticated'](),controller[_0x028b('0x3e')]('whatsapp'));router['get'](_0x028b('0x4a'),auth[_0x028b('0x8')](),controller[_0x028b('0x4b')]);router['get'](_0x028b('0x4c'),auth[_0x028b('0x8')](),controller['showWhatsappQueues']);router[_0x028b('0x3d')](_0x028b('0x4d'),auth[_0x028b('0x8')](),controller[_0x028b('0x4e')]);module[_0x028b('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 84088f0..eeb389c 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0xd31205,_0x101c58){var _0x20effe=function(_0x4a2604){while(--_0x4a2604){_0xd31205['push'](_0xd31205['shift']());}};_0x20effe(++_0x101c58);}(_0xe706,0xa3));var _0x6e70=function(_0x5ea82f,_0x41ef96){_0x5ea82f=_0x5ea82f-0x0;var _0x2f38b6=_0xe706[_0x5ea82f];return _0x2f38b6;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x4769f1,_0x21a46b){var _0x48fd97=function(_0x23d8d3){while(--_0x23d8d3){_0x4769f1['push'](_0x4769f1['shift']());}};_0x48fd97(++_0x21a46b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c906181..8ac9225 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 _0xda0d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','run','post','put','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x269bcd,_0x2ba47b){var _0x37ff11=function(_0x353daf){while(--_0x353daf){_0x269bcd['push'](_0x269bcd['shift']());}};_0x37ff11(++_0x2ba47b);}(_0xda0d,0x13b));var _0xdda0=function(_0x378312,_0x407da2){_0x378312=_0x378312-0x0;var _0x1214db=_0xda0d[_0x378312];return _0x1214db;};'use strict';var multer=require(_0xdda0('0x0'));var util=require(_0xdda0('0x1'));var path=require('path');var timeout=require(_0xdda0('0x2'));var express=require(_0xdda0('0x3'));var router=express[_0xdda0('0x4')]();var fs_extra=require(_0xdda0('0x5'));var auth=require(_0xdda0('0x6'));var interaction=require(_0xdda0('0x7'));var config=require(_0xdda0('0x8'));var controller=require(_0xdda0('0x9'));router[_0xdda0('0xa')]('/',auth[_0xdda0('0xb')](),controller[_0xdda0('0xc')]);router[_0xdda0('0xa')](_0xdda0('0xd'),auth['isAuthenticated'](),controller[_0xdda0('0xe')]);router[_0xdda0('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0xdda0('0xf')]);router[_0xdda0('0x10')]('/',auth[_0xdda0('0xb')](),controller['create']);router[_0xdda0('0x11')]('/:id',auth[_0xdda0('0xb')](),controller[_0xdda0('0x12')]);router['delete']('/:id',auth[_0xdda0('0xb')](),controller['destroy']);module[_0xdda0('0x13')]=router; \ No newline at end of file +var _0x457b=['isAuthenticated','index','get','/:id','/:id/run','post','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46a4c9,_0x578b99){var _0x512675=function(_0x443e13){while(--_0x443e13){_0x46a4c9['push'](_0x46a4c9['shift']());}};_0x512675(++_0x578b99);}(_0x457b,0x1a9));var _0xb457=function(_0x558472,_0x27ffcf){_0x558472=_0x558472-0x0;var _0x37e917=_0x457b[_0x558472];return _0x37e917;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb457('0x0'));var timeout=require(_0xb457('0x1'));var express=require('express');var router=express[_0xb457('0x2')]();var fs_extra=require(_0xb457('0x3'));var auth=require(_0xb457('0x4'));var interaction=require(_0xb457('0x5'));var config=require(_0xb457('0x6'));var controller=require('./schedule.controller');router['get']('/',auth[_0xb457('0x7')](),controller[_0xb457('0x8')]);router[_0xb457('0x9')](_0xb457('0xa'),auth[_0xb457('0x7')](),controller['show']);router['get'](_0xb457('0xb'),auth[_0xb457('0x7')](),controller['run']);router[_0xb457('0xc')]('/',auth[_0xb457('0x7')](),controller['create']);router['put'](_0xb457('0xa'),auth[_0xb457('0x7')](),controller[_0xb457('0xd')]);router[_0xb457('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb457('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 88c2685..f81ba94 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 _0x9ca6=['sequelize','exports','STRING','BOOLEAN','DATE','ENUM','years','quarters','months','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9ca6,0xc6));var _0x69ca=function(_0x1791b6,_0x5f077f){_0x1791b6=_0x1791b6-0x0;var _0x2dda84=_0x9ca6[_0x1791b6];return _0x2dda84;};'use strict';var Sequelize=require(_0x69ca('0x0'));module[_0x69ca('0x1')]={'name':{'type':Sequelize[_0x69ca('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x69ca('0x2')]},'active':{'type':Sequelize[_0x69ca('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x69ca('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x69ca('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x69ca('0x5')](_0x69ca('0x6'),_0x69ca('0x7'),_0x69ca('0x8'),'weeks',_0x69ca('0x9'),_0x69ca('0xa'),_0x69ca('0xb')),'allowNull':![],'defaultValue':_0x69ca('0x9')},'output':{'type':Sequelize[_0x69ca('0x5')](_0x69ca('0xc'),_0x69ca('0xd'),_0x69ca('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x69ca('0x5')](_0x69ca('0xf'),_0x69ca('0x10')),'allowNull':![],'defaultValue':_0x69ca('0xf')},'sendMail':{'type':Sequelize[_0x69ca('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x69ca('0x11')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x85c8=['years','quarters','months','weeks','days','hours','minutes','csv','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x85c8,0x174));var _0x885c=function(_0x5838fc,_0x2ec21c){_0x5838fc=_0x5838fc-0x0;var _0x468126=_0x85c8[_0x5838fc];return _0x468126;};'use strict';var Sequelize=require(_0x885c('0x0'));module[_0x885c('0x1')]={'name':{'type':Sequelize[_0x885c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x885c('0x2')]},'active':{'type':Sequelize[_0x885c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x885c('0x4')},'startAt':{'type':Sequelize[_0x885c('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x885c('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x885c('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x885c('0x7')](_0x885c('0x8'),_0x885c('0x9'),_0x885c('0xa'),_0x885c('0xb'),_0x885c('0xc'),_0x885c('0xd'),_0x885c('0xe')),'allowNull':![],'defaultValue':_0x885c('0xc')},'output':{'type':Sequelize[_0x885c('0x7')](_0x885c('0xf'),'pdf',_0x885c('0x10')),'allowNull':![],'defaultValue':_0x885c('0xf')},'type':{'type':Sequelize[_0x885c('0x7')](_0x885c('0x11'),_0x885c('0x12')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x885c('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x885c('0x13')]},'bcc':{'type':Sequelize[_0x885c('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x885c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index bf5fd38..e9ee665 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 _0xd93c=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','error','stack','send','Schedule','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','name','filter','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','run','../../config/schedule','rimraf'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xd93c,0x18a));var _0xcd93=function(_0x3a8e45,_0x4cc81e){_0x3a8e45=_0x3a8e45-0x0;var _0x58bf31=_0xd93c[_0x3a8e45];return _0x58bf31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd93('0x0'));var zipdir=require(_0xcd93('0x1'));var jsonpatch=require(_0xcd93('0x2'));var rp=require(_0xcd93('0x3'));var moment=require(_0xcd93('0x4'));var BPromise=require(_0xcd93('0x5'));var Mustache=require(_0xcd93('0x6'));var util=require(_0xcd93('0x7'));var path=require('path');var sox=require(_0xcd93('0x8'));var csv=require('to-csv');var ejs=require(_0xcd93('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd93('0xa'));var squel=require(_0xcd93('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcd93('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd93('0xd'));var authService=require(_0xcd93('0xe'));var qs=require(_0xcd93('0xf'));var as=require(_0xcd93('0x10'));var hardwareService=require(_0xcd93('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xcd93('0x12'));var config=require(_0xcd93('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd93('0x14'))['db'];function respondWithStatusCode(_0x43189f,_0x1eb845){_0x1eb845=_0x1eb845||0xcc;return function(_0x586bc6){if(_0x586bc6){return _0x43189f[_0xcd93('0x15')](_0x1eb845);}return _0x43189f[_0xcd93('0x16')](_0x1eb845)[_0xcd93('0x17')]();};}function respondWithResult(_0x119df4,_0x1428e0){_0x1428e0=_0x1428e0||0xc8;return function(_0x38c0a5){if(_0x38c0a5){return _0x119df4[_0xcd93('0x16')](_0x1428e0)[_0xcd93('0x18')](_0x38c0a5);}};}function respondWithFilteredResult(_0x3b3bd3,_0x18eea7){return function(_0x53d8fe){if(_0x53d8fe){var _0x1c9341=typeof _0x18eea7[_0xcd93('0x19')]===_0xcd93('0x1a')&&typeof _0x18eea7[_0xcd93('0x1b')]===_0xcd93('0x1a');var _0x46f0ff=_0x53d8fe[_0xcd93('0x1c')];var _0x580f87=_0x1c9341?0x0:_0x18eea7['offset'];var _0x176c88=_0x1c9341?_0x53d8fe['count']:_0x18eea7[_0xcd93('0x19')]+_0x18eea7[_0xcd93('0x1b')];var _0x588ba4;if(_0x176c88>=_0x46f0ff){_0x176c88=_0x46f0ff;_0x588ba4=0xc8;}else{_0x588ba4=0xce;}_0x3b3bd3['status'](_0x588ba4);return _0x3b3bd3[_0xcd93('0x1d')]('Content-Range',_0x580f87+'-'+_0x176c88+'/'+_0x46f0ff)[_0xcd93('0x18')](_0x53d8fe);}return null;};}function patchUpdates(_0x1e5e69){return function(_0x29cf36){try{jsonpatch[_0xcd93('0x1e')](_0x29cf36,_0x1e5e69,!![]);}catch(_0x4ff6b5){return BPromise[_0xcd93('0x1f')](_0x4ff6b5);}return _0x29cf36[_0xcd93('0x20')]();};}function saveUpdates(_0x7edb34,_0x1cb16d){return function(_0x138810){if(_0x138810){return _0x138810[_0xcd93('0x21')](_0x7edb34)[_0xcd93('0x22')](function(_0x4a103a){return _0x4a103a;});}return null;};}function removeEntity(_0x5ba6f2,_0x4bd1c1){return function(_0x5b4229){if(_0x5b4229){return _0x5b4229[_0xcd93('0x23')]()[_0xcd93('0x22')](function(){var _0x1d9e6c=_0x5b4229['get']({'plain':!![]});var _0x3269d8=_0xcd93('0x24');return db[_0xcd93('0x25')][_0xcd93('0x23')]({'where':{'type':_0x3269d8,'resourceId':_0x1d9e6c['id']}})[_0xcd93('0x22')](function(){return _0x5b4229;});})[_0xcd93('0x22')](function(){_0x5ba6f2[_0xcd93('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4adf97,_0x43aace){return function(_0x5cf2b8){if(!_0x5cf2b8){_0x4adf97['sendStatus'](0x194);}return _0x5cf2b8;};}function handleError(_0x2aa8d2,_0x5b56c0){_0x5b56c0=_0x5b56c0||0x1f4;return function(_0x4949d6){logger[_0xcd93('0x26')](_0x4949d6[_0xcd93('0x27')]);if(_0x4949d6['name']){delete _0x4949d6['name'];}_0x2aa8d2[_0xcd93('0x16')](_0x5b56c0)[_0xcd93('0x28')](_0x4949d6);};}exports['index']=function(_0x554c20,_0x5a21c3){var _0x52b7af={},_0x59a7ce={},_0x4a67c5={'count':0x0,'rows':[]};var _0x4a194e=_['map'](db[_0xcd93('0x29')]['rawAttributes'],function(_0x50eca2){return{'name':_0x50eca2['fieldName'],'type':_0x50eca2[_0xcd93('0x2a')][_0xcd93('0x2b')]};});_0x59a7ce['model']=_[_0xcd93('0x2c')](_0x4a194e,'name');_0x59a7ce[_0xcd93('0x2d')]=_[_0xcd93('0x2e')](_0x554c20['query']);_0x59a7ce[_0xcd93('0x2f')]=_[_0xcd93('0x30')](_0x59a7ce[_0xcd93('0x31')],_0x59a7ce[_0xcd93('0x2d')]);_0x52b7af[_0xcd93('0x32')]=_[_0xcd93('0x30')](_0x59a7ce[_0xcd93('0x31')],qs[_0xcd93('0x33')](_0x554c20['query'][_0xcd93('0x33')]));_0x52b7af['attributes']=_0x52b7af[_0xcd93('0x32')][_0xcd93('0x34')]?_0x52b7af[_0xcd93('0x32')]:_0x59a7ce[_0xcd93('0x31')];if(!_0x554c20[_0xcd93('0x2d')][_0xcd93('0x35')](_0xcd93('0x36'))){_0x52b7af['limit']=qs[_0xcd93('0x1b')](_0x554c20[_0xcd93('0x2d')][_0xcd93('0x1b')]);_0x52b7af[_0xcd93('0x19')]=qs[_0xcd93('0x19')](_0x554c20[_0xcd93('0x2d')]['offset']);}_0x52b7af['order']=qs['sort'](_0x554c20[_0xcd93('0x2d')][_0xcd93('0x37')]);_0x52b7af[_0xcd93('0x38')]=qs['filters'](_[_0xcd93('0x39')](_0x554c20[_0xcd93('0x2d')],_0x59a7ce[_0xcd93('0x2f')]),_0x4a194e);if(_0x554c20[_0xcd93('0x2d')]['filter']){_0x52b7af[_0xcd93('0x38')]=_[_0xcd93('0x3a')](_0x52b7af[_0xcd93('0x38')],{'$or':_[_0xcd93('0x2c')](_0x4a194e,function(_0x344734){if(_0x344734[_0xcd93('0x2a')]!==_0xcd93('0x3b')){var _0x14c4cf={};_0x14c4cf[_0x344734[_0xcd93('0x3c')]]={'$like':'%'+_0x554c20[_0xcd93('0x2d')][_0xcd93('0x3d')]+'%'};return _0x14c4cf;}})});}_0x52b7af=_[_0xcd93('0x3a')]({},_0x52b7af,_0x554c20['options']);var _0x1b8051={'where':_0x52b7af[_0xcd93('0x38')]};return db[_0xcd93('0x29')]['count'](_0x1b8051)[_0xcd93('0x22')](function(_0x34a3c7){_0x4a67c5[_0xcd93('0x1c')]=_0x34a3c7;if(_0x554c20[_0xcd93('0x2d')]['includeAll']){_0x52b7af[_0xcd93('0x3e')]=[{'all':!![]}];}return db['Schedule'][_0xcd93('0x3f')](_0x52b7af);})[_0xcd93('0x22')](function(_0x36b076){_0x4a67c5[_0xcd93('0x40')]=_0x36b076;return _0x4a67c5;})[_0xcd93('0x22')](respondWithFilteredResult(_0x5a21c3,_0x52b7af))[_0xcd93('0x41')](handleError(_0x5a21c3,null));};exports[_0xcd93('0x42')]=function(_0x194523,_0x2d57ad){var _0x6061c3={'raw':![],'where':{'id':_0x194523[_0xcd93('0x43')]['id']}},_0x2b44e8={};_0x2b44e8['model']=_[_0xcd93('0x2e')](db[_0xcd93('0x29')][_0xcd93('0x44')]);_0x2b44e8[_0xcd93('0x2d')]=_[_0xcd93('0x2e')](_0x194523[_0xcd93('0x2d')]);_0x2b44e8[_0xcd93('0x2f')]=_['intersection'](_0x2b44e8[_0xcd93('0x31')],_0x2b44e8[_0xcd93('0x2d')]);_0x6061c3[_0xcd93('0x32')]=_['intersection'](_0x2b44e8[_0xcd93('0x31')],qs[_0xcd93('0x33')](_0x194523[_0xcd93('0x2d')]['fields']));_0x6061c3[_0xcd93('0x32')]=_0x6061c3[_0xcd93('0x32')][_0xcd93('0x34')]?_0x6061c3['attributes']:_0x2b44e8['model'];if(_0x194523[_0xcd93('0x2d')]['includeAll']){_0x6061c3[_0xcd93('0x3e')]=[{'all':!![]}];}_0x6061c3=_['merge']({},_0x6061c3,_0x194523['options']);return db[_0xcd93('0x29')][_0xcd93('0x45')](_0x6061c3)[_0xcd93('0x22')](handleEntityNotFound(_0x2d57ad,null))[_0xcd93('0x22')](respondWithResult(_0x2d57ad,null))[_0xcd93('0x41')](handleError(_0x2d57ad,null));};exports[_0xcd93('0x46')]=function(_0x6ca3fc,_0x95dc46){return db[_0xcd93('0x29')]['create'](_0x6ca3fc[_0xcd93('0x47')],{})[_0xcd93('0x22')](function(_0x2ea69c){var _0x1786a5=_0x6ca3fc[_0xcd93('0x48')][_0xcd93('0x49')]({'plain':!![]});if(!_0x1786a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1786a5['role']==='user'){var _0x39b6d1=_0x2ea69c[_0xcd93('0x49')]({'plain':!![]});var _0x574e98=_0xcd93('0x24');return db[_0xcd93('0x4a')][_0xcd93('0x45')]({'where':{'name':_0x574e98,'userProfileId':_0x1786a5[_0xcd93('0x4b')]},'raw':!![]})[_0xcd93('0x22')](function(_0x389cd4){if(_0x389cd4&&_0x389cd4[_0xcd93('0x4c')]===0x0){return db[_0xcd93('0x25')][_0xcd93('0x46')]({'name':_0x39b6d1['name'],'resourceId':_0x39b6d1['id'],'type':_0x389cd4[_0xcd93('0x3c')],'sectionId':_0x389cd4['id']},{})['then'](function(){return _0x2ea69c;});}else{return _0x2ea69c;}})['catch'](function(_0xd6b7c9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd6b7c9);throw _0xd6b7c9;});}return _0x2ea69c;})['then'](respondWithResult(_0x95dc46,0xc9))['catch'](handleError(_0x95dc46,null));};exports[_0xcd93('0x21')]=function(_0x112043,_0x188449){if(_0x112043[_0xcd93('0x47')]['id']){delete _0x112043[_0xcd93('0x47')]['id'];}return db[_0xcd93('0x29')][_0xcd93('0x45')]({'where':{'id':_0x112043[_0xcd93('0x43')]['id']}})[_0xcd93('0x22')](handleEntityNotFound(_0x188449,null))[_0xcd93('0x22')](saveUpdates(_0x112043[_0xcd93('0x47')],null))[_0xcd93('0x22')](respondWithResult(_0x188449,null))[_0xcd93('0x41')](handleError(_0x188449,null));};exports[_0xcd93('0x23')]=function(_0x11348b,_0x3246b6){return db['Schedule'][_0xcd93('0x45')]({'where':{'id':_0x11348b[_0xcd93('0x43')]['id']}})[_0xcd93('0x22')](handleEntityNotFound(_0x3246b6,null))[_0xcd93('0x22')](removeEntity(_0x3246b6,null))['catch'](handleError(_0x3246b6,null));};exports[_0xcd93('0x4d')]=function(_0x1558a1,_0x18293a,_0x2a998a){var _0x458765=require(_0xcd93('0x4e'));return db[_0xcd93('0x29')][_0xcd93('0x45')]({'where':{'id':_0x1558a1[_0xcd93('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x18293a,null))[_0xcd93('0x22')](function(){_0x458765['run'](_0x1558a1[_0xcd93('0x43')]['id']);})[_0xcd93('0x22')](respondWithStatusCode(_0x18293a,null))[_0xcd93('0x41')](handleError(_0x18293a,null));}; \ No newline at end of file +var _0xa741=['error','stack','name','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','Scheduler','destroy','then'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa741,0xc6));var _0x1a74=function(_0x394862,_0x17c8cf){_0x394862=_0x394862-0x0;var _0x46ec78=_0xa741[_0x394862];return _0x46ec78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a74('0x0'));var zipdir=require(_0x1a74('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a74('0x2'));var moment=require(_0x1a74('0x3'));var BPromise=require(_0x1a74('0x4'));var Mustache=require('mustache');var util=require(_0x1a74('0x5'));var path=require(_0x1a74('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1a74('0x7'));var fs=require('fs');var fs_extra=require(_0x1a74('0x8'));var _=require(_0x1a74('0x9'));var squel=require(_0x1a74('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1a74('0xb'));var querystring=require(_0x1a74('0xc'));var Papa=require(_0x1a74('0xd'));var Redis=require(_0x1a74('0xe'));var authService=require(_0x1a74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1a74('0x10'));var hardwareService=require(_0x1a74('0x11'));var logger=require(_0x1a74('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x1a74('0x13'));var licenseUtil=require(_0x1a74('0x14'));var db=require(_0x1a74('0x15'))['db'];function respondWithStatusCode(_0xc9425e,_0x3577fb){_0x3577fb=_0x3577fb||0xcc;return function(_0x20fc7e){if(_0x20fc7e){return _0xc9425e[_0x1a74('0x16')](_0x3577fb);}return _0xc9425e[_0x1a74('0x17')](_0x3577fb)[_0x1a74('0x18')]();};}function respondWithResult(_0x14b7c2,_0x358219){_0x358219=_0x358219||0xc8;return function(_0x25054b){if(_0x25054b){return _0x14b7c2[_0x1a74('0x17')](_0x358219)[_0x1a74('0x19')](_0x25054b);}};}function respondWithFilteredResult(_0x21f1df,_0x51421d){return function(_0x476cf8){if(_0x476cf8){var _0x2e8acf=typeof _0x51421d[_0x1a74('0x1a')]===_0x1a74('0x1b')&&typeof _0x51421d[_0x1a74('0x1c')]===_0x1a74('0x1b');var _0x15e12d=_0x476cf8['count'];var _0x2fef43=_0x2e8acf?0x0:_0x51421d['offset'];var _0x36dd89=_0x2e8acf?_0x476cf8[_0x1a74('0x1d')]:_0x51421d[_0x1a74('0x1a')]+_0x51421d[_0x1a74('0x1c')];var _0x56759f;if(_0x36dd89>=_0x15e12d){_0x36dd89=_0x15e12d;_0x56759f=0xc8;}else{_0x56759f=0xce;}_0x21f1df[_0x1a74('0x17')](_0x56759f);return _0x21f1df['set'](_0x1a74('0x1e'),_0x2fef43+'-'+_0x36dd89+'/'+_0x15e12d)[_0x1a74('0x19')](_0x476cf8);}return null;};}function patchUpdates(_0x82a9c7){return function(_0x173984){try{jsonpatch[_0x1a74('0x1f')](_0x173984,_0x82a9c7,!![]);}catch(_0x6f3e63){return BPromise[_0x1a74('0x20')](_0x6f3e63);}return _0x173984[_0x1a74('0x21')]();};}function saveUpdates(_0x3988a4,_0x42099c){return function(_0x133e12){if(_0x133e12){return _0x133e12[_0x1a74('0x22')](_0x3988a4)['then'](function(_0x55697d){return _0x55697d;});}return null;};}function removeEntity(_0x31ee80,_0x56610a){return function(_0x3f6448){if(_0x3f6448){return _0x3f6448['destroy']()['then'](function(){var _0x40ae62=_0x3f6448[_0x1a74('0x23')]({'plain':!![]});var _0x10cc7e=_0x1a74('0x24');return db['UserProfileResource'][_0x1a74('0x25')]({'where':{'type':_0x10cc7e,'resourceId':_0x40ae62['id']}})['then'](function(){return _0x3f6448;});})[_0x1a74('0x26')](function(){_0x31ee80[_0x1a74('0x17')](0xcc)[_0x1a74('0x18')]();});}};}function handleEntityNotFound(_0x3fde22,_0x40b57f){return function(_0xa80a1c){if(!_0xa80a1c){_0x3fde22[_0x1a74('0x16')](0x194);}return _0xa80a1c;};}function handleError(_0x1a59fd,_0x561d5f){_0x561d5f=_0x561d5f||0x1f4;return function(_0x2fbcd7){logger[_0x1a74('0x27')](_0x2fbcd7[_0x1a74('0x28')]);if(_0x2fbcd7['name']){delete _0x2fbcd7[_0x1a74('0x29')];}_0x1a59fd[_0x1a74('0x17')](_0x561d5f)['send'](_0x2fbcd7);};}exports['index']=function(_0x4cdbc2,_0x1b2e24){var _0x5ed72d={},_0x4a334e={},_0x25719b={'count':0x0,'rows':[]};var _0x19204b=_[_0x1a74('0x2a')](db[_0x1a74('0x2b')][_0x1a74('0x2c')],function(_0x45fe87){return{'name':_0x45fe87[_0x1a74('0x2d')],'type':_0x45fe87[_0x1a74('0x2e')][_0x1a74('0x2f')]};});_0x4a334e[_0x1a74('0x30')]=_['map'](_0x19204b,_0x1a74('0x29'));_0x4a334e[_0x1a74('0x31')]=_[_0x1a74('0x32')](_0x4cdbc2['query']);_0x4a334e['filters']=_[_0x1a74('0x33')](_0x4a334e['model'],_0x4a334e[_0x1a74('0x31')]);_0x5ed72d[_0x1a74('0x34')]=_[_0x1a74('0x33')](_0x4a334e[_0x1a74('0x30')],qs['fields'](_0x4cdbc2['query'][_0x1a74('0x35')]));_0x5ed72d[_0x1a74('0x34')]=_0x5ed72d['attributes']['length']?_0x5ed72d['attributes']:_0x4a334e[_0x1a74('0x30')];if(!_0x4cdbc2[_0x1a74('0x31')]['hasOwnProperty'](_0x1a74('0x36'))){_0x5ed72d[_0x1a74('0x1c')]=qs['limit'](_0x4cdbc2['query'][_0x1a74('0x1c')]);_0x5ed72d[_0x1a74('0x1a')]=qs[_0x1a74('0x1a')](_0x4cdbc2['query'][_0x1a74('0x1a')]);}_0x5ed72d[_0x1a74('0x37')]=qs['sort'](_0x4cdbc2[_0x1a74('0x31')][_0x1a74('0x38')]);_0x5ed72d[_0x1a74('0x39')]=qs['filters'](_['pick'](_0x4cdbc2[_0x1a74('0x31')],_0x4a334e[_0x1a74('0x3a')]),_0x19204b);if(_0x4cdbc2['query'][_0x1a74('0x3b')]){_0x5ed72d[_0x1a74('0x39')]=_[_0x1a74('0x3c')](_0x5ed72d['where'],{'$or':_[_0x1a74('0x2a')](_0x19204b,function(_0x3145c5){if(_0x3145c5[_0x1a74('0x2e')]!==_0x1a74('0x3d')){var _0x3794f6={};_0x3794f6[_0x3145c5[_0x1a74('0x29')]]={'$like':'%'+_0x4cdbc2[_0x1a74('0x31')]['filter']+'%'};return _0x3794f6;}})});}_0x5ed72d=_[_0x1a74('0x3c')]({},_0x5ed72d,_0x4cdbc2['options']);var _0x363b43={'where':_0x5ed72d[_0x1a74('0x39')]};return db[_0x1a74('0x2b')]['count'](_0x363b43)['then'](function(_0x42f119){_0x25719b[_0x1a74('0x1d')]=_0x42f119;if(_0x4cdbc2[_0x1a74('0x31')][_0x1a74('0x3e')]){_0x5ed72d[_0x1a74('0x3f')]=[{'all':!![]}];}return db[_0x1a74('0x2b')][_0x1a74('0x40')](_0x5ed72d);})['then'](function(_0x3aba3f){_0x25719b[_0x1a74('0x41')]=_0x3aba3f;return _0x25719b;})[_0x1a74('0x26')](respondWithFilteredResult(_0x1b2e24,_0x5ed72d))[_0x1a74('0x42')](handleError(_0x1b2e24,null));};exports['show']=function(_0x7c9360,_0x123542){var _0x2d3842={'raw':![],'where':{'id':_0x7c9360[_0x1a74('0x43')]['id']}},_0x55df9a={};_0x55df9a[_0x1a74('0x30')]=_[_0x1a74('0x32')](db[_0x1a74('0x2b')]['rawAttributes']);_0x55df9a[_0x1a74('0x31')]=_[_0x1a74('0x32')](_0x7c9360[_0x1a74('0x31')]);_0x55df9a['filters']=_[_0x1a74('0x33')](_0x55df9a[_0x1a74('0x30')],_0x55df9a[_0x1a74('0x31')]);_0x2d3842[_0x1a74('0x34')]=_[_0x1a74('0x33')](_0x55df9a[_0x1a74('0x30')],qs[_0x1a74('0x35')](_0x7c9360[_0x1a74('0x31')][_0x1a74('0x35')]));_0x2d3842[_0x1a74('0x34')]=_0x2d3842[_0x1a74('0x34')]['length']?_0x2d3842['attributes']:_0x55df9a['model'];if(_0x7c9360[_0x1a74('0x31')]['includeAll']){_0x2d3842[_0x1a74('0x3f')]=[{'all':!![]}];}_0x2d3842=_['merge']({},_0x2d3842,_0x7c9360[_0x1a74('0x44')]);return db['Schedule']['find'](_0x2d3842)['then'](handleEntityNotFound(_0x123542,null))[_0x1a74('0x26')](respondWithResult(_0x123542,null))['catch'](handleError(_0x123542,null));};exports[_0x1a74('0x45')]=function(_0x40767d,_0x4e0049){return db['Schedule'][_0x1a74('0x45')](_0x40767d[_0x1a74('0x46')],{})['then'](function(_0x189858){var _0x17b99b=_0x40767d[_0x1a74('0x47')][_0x1a74('0x23')]({'plain':!![]});if(!_0x17b99b)throw new Error(_0x1a74('0x48'));if(_0x17b99b['role']===_0x1a74('0x47')){var _0x21a899=_0x189858[_0x1a74('0x23')]({'plain':!![]});var _0x2e0bdb='Scheduler';return db['UserProfileSection'][_0x1a74('0x49')]({'where':{'name':_0x2e0bdb,'userProfileId':_0x17b99b[_0x1a74('0x4a')]},'raw':!![]})[_0x1a74('0x26')](function(_0x2cd24a){if(_0x2cd24a&&_0x2cd24a[_0x1a74('0x4b')]===0x0){return db[_0x1a74('0x4c')]['create']({'name':_0x21a899[_0x1a74('0x29')],'resourceId':_0x21a899['id'],'type':_0x2cd24a[_0x1a74('0x29')],'sectionId':_0x2cd24a['id']},{})[_0x1a74('0x26')](function(){return _0x189858;});}else{return _0x189858;}})[_0x1a74('0x42')](function(_0x2d9856){logger[_0x1a74('0x27')](_0x1a74('0x4d'),_0x2d9856);throw _0x2d9856;});}return _0x189858;})['then'](respondWithResult(_0x4e0049,0xc9))['catch'](handleError(_0x4e0049,null));};exports[_0x1a74('0x22')]=function(_0xd2f4e4,_0x18c1c7){if(_0xd2f4e4[_0x1a74('0x46')]['id']){delete _0xd2f4e4[_0x1a74('0x46')]['id'];}return db[_0x1a74('0x2b')][_0x1a74('0x49')]({'where':{'id':_0xd2f4e4[_0x1a74('0x43')]['id']}})[_0x1a74('0x26')](handleEntityNotFound(_0x18c1c7,null))[_0x1a74('0x26')](saveUpdates(_0xd2f4e4['body'],null))[_0x1a74('0x26')](respondWithResult(_0x18c1c7,null))[_0x1a74('0x42')](handleError(_0x18c1c7,null));};exports[_0x1a74('0x25')]=function(_0x4cfe3f,_0x31cd65){return db[_0x1a74('0x2b')][_0x1a74('0x49')]({'where':{'id':_0x4cfe3f[_0x1a74('0x43')]['id']}})[_0x1a74('0x26')](handleEntityNotFound(_0x31cd65,null))[_0x1a74('0x26')](removeEntity(_0x31cd65,null))[_0x1a74('0x42')](handleError(_0x31cd65,null));};exports['run']=function(_0x2bf368,_0x447d6c,_0x39cb80){var _0x369607=require('../../config/schedule');return db[_0x1a74('0x2b')][_0x1a74('0x49')]({'where':{'id':_0x2bf368[_0x1a74('0x43')]['id']},'raw':!![]})[_0x1a74('0x26')](handleEntityNotFound(_0x447d6c,null))[_0x1a74('0x26')](function(){_0x369607[_0x1a74('0x4e')](_0x2bf368[_0x1a74('0x43')]['id']);})['then'](respondWithStatusCode(_0x447d6c,null))['catch'](handleError(_0x447d6c,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 8157563..5a7af39 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 _0xe21d=['bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe21d,0x1a0));var _0xde21=function(_0x55cdb2,_0x251fc2){_0x55cdb2=_0x55cdb2-0x0;var _0x1408b2=_0xe21d[_0x55cdb2];return _0x1408b2;};'use strict';var _=require(_0xde21('0x0'));var util=require('util');var logger=require(_0xde21('0x1'))(_0xde21('0x2'));var moment=require(_0xde21('0x3'));var BPromise=require(_0xde21('0x4'));var rp=require(_0xde21('0x5'));var fs=require('fs');var path=require(_0xde21('0x6'));var rimraf=require(_0xde21('0x7'));var config=require(_0xde21('0x8'));var attributes=require(_0xde21('0x9'));module[_0xde21('0xa')]=function(_0x4c0be2,_0x38d953){return _0x4c0be2[_0xde21('0xb')](_0xde21('0xc'),attributes,{'tableName':_0xde21('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f22=['request-promise','path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','moment'];(function(_0x27ab8c,_0x42376a){var _0x1e65dc=function(_0x1604ba){while(--_0x1604ba){_0x27ab8c['push'](_0x27ab8c['shift']());}};_0x1e65dc(++_0x42376a);}(_0x2f22,0xd4));var _0x22f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2f22[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x22f2('0x0'));var util=require(_0x22f2('0x1'));var logger=require(_0x22f2('0x2'))('api');var moment=require(_0x22f2('0x3'));var BPromise=require('bluebird');var rp=require(_0x22f2('0x4'));var fs=require('fs');var path=require(_0x22f2('0x5'));var rimraf=require(_0x22f2('0x6'));var config=require(_0x22f2('0x7'));var attributes=require('./schedule.attributes');module[_0x22f2('0x8')]=function(_0x2e7862,_0x101b32){return _0x2e7862[_0x22f2('0x9')](_0x22f2('0xa'),attributes,{'tableName':_0x22f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 51faff8..31d2212 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 _0xfcff=['then','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x57e35c,_0x427579){var _0x1b8e3f=function(_0x4bdfc4){while(--_0x4bdfc4){_0x57e35c['push'](_0x57e35c['shift']());}};_0x1b8e3f(++_0x427579);}(_0xfcff,0x18c));var _0xffcf=function(_0x170f4f,_0x504af6){_0x170f4f=_0x170f4f-0x0;var _0xe7748c=_0xfcff[_0x170f4f];return _0xe7748c;};'use strict';var _=require(_0xffcf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xffcf('0x1'));var rs=require(_0xffcf('0x2'));var fs=require('fs');var Redis=require(_0xffcf('0x3'));var db=require(_0xffcf('0x4'))['db'];var utils=require(_0xffcf('0x5'));var logger=require(_0xffcf('0x6'))(_0xffcf('0x7'));var config=require('../../config/environment');var jayson=require(_0xffcf('0x8'));var client=jayson[_0xffcf('0x9')][_0xffcf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26af16,_0x5ad5c0,_0x8771c){return new BPromise(function(_0xe095e1,_0x1f7ec9){return client[_0xffcf('0xb')](_0x26af16,_0x8771c)[_0xffcf('0xc')](function(_0x5cedc8){logger['info']('Schedule,\x20%s,\x20%s',_0x5ad5c0,_0xffcf('0xd'));logger[_0xffcf('0xe')](_0xffcf('0xf'),_0x5ad5c0,'request\x20sent',JSON[_0xffcf('0x10')](_0x5cedc8));if(_0x5cedc8[_0xffcf('0x11')]){if(_0x5cedc8['error'][_0xffcf('0x12')]===0x1f4){logger['error'](_0xffcf('0x13'),_0x5ad5c0,_0x5cedc8[_0xffcf('0x11')][_0xffcf('0x14')]);return _0x1f7ec9(_0x5cedc8[_0xffcf('0x11')][_0xffcf('0x14')]);}logger[_0xffcf('0x11')](_0xffcf('0x13'),_0x5ad5c0,_0x5cedc8[_0xffcf('0x11')][_0xffcf('0x14')]);return _0xe095e1(_0x5cedc8['error'][_0xffcf('0x14')]);}else{logger[_0xffcf('0x15')](_0xffcf('0x13'),_0x5ad5c0,'request\x20sent');_0xe095e1(_0x5cedc8[_0xffcf('0x16')][_0xffcf('0x14')]);}})[_0xffcf('0x17')](function(_0x4bd3e8){logger['error'](_0xffcf('0x13'),_0x5ad5c0,_0x4bd3e8);_0x1f7ec9(_0x4bd3e8);});});} \ No newline at end of file +var _0xf0b1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x375521,_0x413159){var _0x1fb976=function(_0x2eddfc){while(--_0x2eddfc){_0x375521['push'](_0x375521['shift']());}};_0x1fb976(++_0x413159);}(_0xf0b1,0x159));var _0x1f0b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf0b1[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x1f0b('0x0'));var util=require(_0x1f0b('0x1'));var moment=require(_0x1f0b('0x2'));var BPromise=require(_0x1f0b('0x3'));var rs=require(_0x1f0b('0x4'));var fs=require('fs');var Redis=require(_0x1f0b('0x5'));var db=require(_0x1f0b('0x6'))['db'];var utils=require(_0x1f0b('0x7'));var logger=require(_0x1f0b('0x8'))('rpc');var config=require(_0x1f0b('0x9'));var jayson=require(_0x1f0b('0xa'));var client=jayson[_0x1f0b('0xb')][_0x1f0b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36e3cd,_0x4b872d,_0x15c1ee){return new BPromise(function(_0x89b45a,_0x2b6b2f){return client[_0x1f0b('0xd')](_0x36e3cd,_0x15c1ee)[_0x1f0b('0xe')](function(_0x4ec240){logger['info']('Schedule,\x20%s,\x20%s',_0x4b872d,_0x1f0b('0xf'));logger['debug'](_0x1f0b('0x10'),_0x4b872d,_0x1f0b('0xf'),JSON[_0x1f0b('0x11')](_0x4ec240));if(_0x4ec240['error']){if(_0x4ec240[_0x1f0b('0x12')][_0x1f0b('0x13')]===0x1f4){logger[_0x1f0b('0x12')](_0x1f0b('0x14'),_0x4b872d,_0x4ec240[_0x1f0b('0x12')][_0x1f0b('0x15')]);return _0x2b6b2f(_0x4ec240[_0x1f0b('0x12')][_0x1f0b('0x15')]);}logger[_0x1f0b('0x12')]('Schedule,\x20%s,\x20%s',_0x4b872d,_0x4ec240[_0x1f0b('0x12')][_0x1f0b('0x15')]);return _0x89b45a(_0x4ec240[_0x1f0b('0x12')]['message']);}else{logger[_0x1f0b('0x16')](_0x1f0b('0x14'),_0x4b872d,'request\x20sent');_0x89b45a(_0x4ec240[_0x1f0b('0x17')][_0x1f0b('0x15')]);}})[_0x1f0b('0x18')](function(_0x52987e){logger[_0x1f0b('0x12')](_0x1f0b('0x14'),_0x4b872d,_0x52987e);_0x2b6b2f(_0x52987e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e6c280f..2585301 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 _0x5bae=['/:id/download','download','post','create','put','exports','multer','util','express','../../components/auth/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x5693dc,_0x21b148){var _0x1067aa=function(_0x2f513f){while(--_0x2f513f){_0x5693dc['push'](_0x5693dc['shift']());}};_0x1067aa(++_0x21b148);}(_0x5bae,0x195));var _0xe5ba=function(_0x2368ab,_0x35932d){_0x2368ab=_0x2368ab-0x0;var _0x5f1789=_0x5bae[_0x2368ab];return _0x5f1789;};'use strict';var multer=require(_0xe5ba('0x0'));var util=require(_0xe5ba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe5ba('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe5ba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe5ba('0x4'));var controller=require(_0xe5ba('0x5'));router[_0xe5ba('0x6')]('/',auth['isAuthenticated'](),controller[_0xe5ba('0x7')]);router[_0xe5ba('0x6')](_0xe5ba('0x8'),auth[_0xe5ba('0x9')](),controller[_0xe5ba('0xa')]);router['get'](_0xe5ba('0xb'),auth[_0xe5ba('0x9')](),controller[_0xe5ba('0xc')]);router[_0xe5ba('0x6')](_0xe5ba('0xd'),auth['isAuthenticated'](),controller[_0xe5ba('0xe')]);router[_0xe5ba('0xf')]('/',auth['isAuthenticated'](),controller[_0xe5ba('0x10')]);router[_0xe5ba('0x11')](_0xe5ba('0xb'),auth[_0xe5ba('0x9')](),controller['update']);router['delete'](_0xe5ba('0xb'),auth[_0xe5ba('0x9')](),controller['destroy']);module[_0xe5ba('0x12')]=router; \ No newline at end of file +var _0xb9e3=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','show','/:id/download','download','create','put','/:id','update','delete','destroy','exports'];(function(_0x4369ee,_0x17ae75){var _0x4c0a38=function(_0x39a6b3){while(--_0x39a6b3){_0x4369ee['push'](_0x4369ee['shift']());}};_0x4c0a38(++_0x17ae75);}(_0xb9e3,0xd8));var _0x3b9e=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0xb9e3[_0x51cc1d];return _0x2eb9f2;};'use strict';var multer=require(_0x3b9e('0x0'));var util=require(_0x3b9e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3b9e('0x2'));var router=express[_0x3b9e('0x3')]();var fs_extra=require(_0x3b9e('0x4'));var auth=require(_0x3b9e('0x5'));var interaction=require(_0x3b9e('0x6'));var config=require(_0x3b9e('0x7'));var controller=require(_0x3b9e('0x8'));router['get']('/',auth[_0x3b9e('0x9')](),controller[_0x3b9e('0xa')]);router[_0x3b9e('0xb')](_0x3b9e('0xc'),auth[_0x3b9e('0x9')](),controller[_0x3b9e('0xd')]);router[_0x3b9e('0xb')]('/:id',auth[_0x3b9e('0x9')](),controller[_0x3b9e('0xe')]);router[_0x3b9e('0xb')](_0x3b9e('0xf'),auth[_0x3b9e('0x9')](),controller[_0x3b9e('0x10')]);router['post']('/',auth[_0x3b9e('0x9')](),controller[_0x3b9e('0x11')]);router[_0x3b9e('0x12')](_0x3b9e('0x13'),auth['isAuthenticated'](),controller[_0x3b9e('0x14')]);router[_0x3b9e('0x15')](_0x3b9e('0x13'),auth[_0x3b9e('0x9')](),controller[_0x3b9e('0x16')]);module[_0x3b9e('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8e43be1..d4a5175 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 _0xc893=['format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','path','VIRTUAL','getDataValue','value','extname','STRING','replace','startedAt','subtract','closedAt','setDataValue','duration','DATE'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0xc893,0x194));var _0x3c89=function(_0x92b5e3,_0x5e880f){_0x92b5e3=_0x92b5e3-0x0;var _0x13d015=_0xc893[_0x92b5e3];return _0x13d015;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3c89('0x0'));var path=require(_0x3c89('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x3c89('0x2')],'get':function(){return this[_0x3c89('0x3')](_0x3c89('0x4'))?path[_0x3c89('0x5')](this[_0x3c89('0x3')](_0x3c89('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x3c89('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x3c89('0x6')],'set':function(_0x1a0ec4){var _0x189b7=_0x1a0ec4[_0x3c89('0x7')](/\\/g,'/');this['setDataValue'](_0x3c89('0x4'),_0x189b7);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x3cfe79){this['setDataValue'](_0x3c89('0x8'),moment()[_0x3c89('0x9')](_0x3cfe79,'ms'));this['setDataValue'](_0x3c89('0xa'),moment());this[_0x3c89('0xb')](_0x3c89('0xc'),_0x3cfe79);}},'startedAt':{'type':Sequelize[_0x3c89('0xd')],'get':function(){return moment(this[_0x3c89('0x3')](_0x3c89('0x8')))[_0x3c89('0xe')](_0x3c89('0xf'))[_0x3c89('0x10')]();}},'closedAt':{'type':Sequelize[_0x3c89('0xd')],'get':function(){return moment(this[_0x3c89('0x3')](_0x3c89('0xa')))[_0x3c89('0xe')](_0x3c89('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0x3c89('0xd')],'get':function(){return moment(this[_0x3c89('0x3')](_0x3c89('0x11')))[_0x3c89('0xe')](_0x3c89('0xf'))[_0x3c89('0x10')]();}},'updatedAt':{'type':Sequelize[_0x3c89('0xd')],'get':function(){return moment(this[_0x3c89('0x3')](_0x3c89('0x12')))[_0x3c89('0xe')](_0x3c89('0xf'))['toString']();}}}; \ No newline at end of file +var _0x6343=['path','../../config/environment','extname','getDataValue','STRING','value','INTEGER','setDataValue','startedAt','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt'];(function(_0x2d3e82,_0x22cb68){var _0xd4ac68=function(_0x44d4c8){while(--_0x44d4c8){_0x2d3e82['push'](_0x2d3e82['shift']());}};_0xd4ac68(++_0x22cb68);}(_0x6343,0x168));var _0x3634=function(_0x29d244,_0x1c6971){_0x29d244=_0x29d244-0x0;var _0x2b3e19=_0x6343[_0x29d244];return _0x2b3e19;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x3634('0x0'));var config=require(_0x3634('0x1'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path[_0x3634('0x2')](this[_0x3634('0x3')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x3634('0x4')]},'channel':{'type':Sequelize[_0x3634('0x4')]},'value':{'type':Sequelize['STRING'],'set':function(_0x302828){var _0xd40513=_0x302828['replace'](/\\/g,'/');this['setDataValue'](_0x3634('0x5'),_0xd40513);}},'rating':{'type':Sequelize[_0x3634('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x3634('0x6')],'set':function(_0x3c813b){this[_0x3634('0x7')](_0x3634('0x8'),moment()['subtract'](_0x3c813b,'ms'));this['setDataValue'](_0x3634('0x9'),moment());this[_0x3634('0x7')]('duration',_0x3c813b);}},'startedAt':{'type':Sequelize[_0x3634('0xa')],'get':function(){return moment(this[_0x3634('0x3')](_0x3634('0x8')))[_0x3634('0xb')](_0x3634('0xc'))[_0x3634('0xd')]();}},'closedAt':{'type':Sequelize[_0x3634('0xa')],'get':function(){return moment(this[_0x3634('0x3')](_0x3634('0x9')))[_0x3634('0xb')](_0x3634('0xc'))[_0x3634('0xd')]();}},'createdAt':{'type':Sequelize[_0x3634('0xa')],'get':function(){return moment(this[_0x3634('0x3')]('createdAt'))[_0x3634('0xb')]('MM-DD-YYYY\x20HH:mm')[_0x3634('0xd')]();}},'updatedAt':{'type':Sequelize[_0x3634('0xa')],'get':function(){return moment(this[_0x3634('0x3')](_0x3634('0xe')))[_0x3634('0xb')]('MM-DD-YYYY\x20HH:mm')[_0x3634('0xd')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index ed29dd5..e233539 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 _0x008c=['papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x008c,0x188));var _0xc008=function(_0x20961b,_0x121bba){_0x20961b=_0x20961b-0x0;var _0x48ad1c=_0x008c[_0x20961b];return _0x48ad1c;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file +var _0x55ca=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','util','path'];(function(_0x58ac9b,_0x3c6949){var _0x26661b=function(_0x2a9ac9){while(--_0x2a9ac9){_0x58ac9b['push'](_0x58ac9b['shift']());}};_0x26661b(++_0x3c6949);}(_0x55ca,0x126));var _0xa55c=function(_0x5b6375,_0x563718){_0x5b6375=_0x5b6375-0x0;var _0x4045b4=_0x55ca[_0x5b6375];return _0x4045b4;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_['map'](_0x201941,_0xa55c('0x25')),[_0xa55c('0x2e')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x906caa[_0xa55c('0x2f')]);_0x22f6b6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2f')]);_0x1377b0[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x22f6b6['model'],qs['fields'](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x1377b0['attributes']=_0x1377b0[_0xa55c('0x33')][_0xa55c('0x35')]?_0x1377b0[_0xa55c('0x33')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2f')][_0xa55c('0x36')](_0xa55c('0x37'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa['query']['limit']);_0x1377b0['offset']=qs[_0xa55c('0x1a')](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x1a')]);}_0x1377b0['order']=qs[_0xa55c('0x38')](_0x906caa['query'][_0xa55c('0x38')]);_0x1377b0['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x39')](_0x906caa[_0xa55c('0x2f')],_0x22f6b6['filters']),_0x201941);if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3a')]){_0x1377b0['where']=_[_0xa55c('0x3b')](_0x1377b0[_0xa55c('0x3c')],{'$or':_['map'](_0x201941,function(_0x529ff8){if(_0x529ff8[_0xa55c('0x2a')]!=='VIRTUAL'){var _0x1e75dc={};_0x1e75dc[_0x529ff8[_0xa55c('0x25')]]={'$like':'%'+_0x906caa['query']['filter']+'%'};return _0x1e75dc;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x3b3308={'where':_0x1377b0[_0xa55c('0x3c')]};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x3b3308)[_0xa55c('0x20')](function(_0x56d17c){_0x1b8388[_0xa55c('0x1d')]=_0x56d17c;if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3d')]){_0x1377b0[_0xa55c('0x3e')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0x1377b0);})['then'](function(_0x386e34){_0x1b8388['rows']=_0x386e34;return _0x1b8388;})['then'](respondWithFilteredResult(_0x5d940d,_0x1377b0))[_0xa55c('0x40')](handleError(_0x5d940d,null));};exports[_0xa55c('0x41')]=function(_0x496920,_0x2bd98b){var _0x508bd3={'raw':![],'where':{'id':_0x496920[_0xa55c('0x42')]['id']}},_0x5f25f7={};_0x5f25f7[_0xa55c('0x2c')]=_[_0xa55c('0x30')](db['ScreenRecording'][_0xa55c('0x43')]);_0x5f25f7[_0xa55c('0x2f')]=_['keys'](_0x496920[_0xa55c('0x2f')]);_0x5f25f7['filters']=_[_0xa55c('0x32')](_0x5f25f7[_0xa55c('0x2c')],_0x5f25f7['query']);_0x508bd3[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5f25f7['model'],qs[_0xa55c('0x34')](_0x496920[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x508bd3['attributes']=_0x508bd3[_0xa55c('0x33')]['length']?_0x508bd3[_0xa55c('0x33')]:_0x5f25f7[_0xa55c('0x2c')];if(_0x496920[_0xa55c('0x2f')]['includeAll']){_0x508bd3[_0xa55c('0x3e')]=[{'all':!![]}];}_0x508bd3=_[_0xa55c('0x3b')]({},_0x508bd3,_0x496920['options']);return db[_0xa55c('0x29')][_0xa55c('0x44')](_0x508bd3)['then'](handleEntityNotFound(_0x2bd98b,null))[_0xa55c('0x20')](respondWithResult(_0x2bd98b,null))[_0xa55c('0x40')](handleError(_0x2bd98b,null));};exports['create']=function(_0x46f839,_0x81cee8){return db[_0xa55c('0x29')][_0xa55c('0x45')](_0x46f839['body'],{})[_0xa55c('0x20')](respondWithResult(_0x81cee8,0xc9))['catch'](handleError(_0x81cee8,null));};exports[_0xa55c('0x1f')]=function(_0x213100,_0x194a79){if(_0x213100['body']['id']){delete _0x213100[_0xa55c('0x46')]['id'];}delete _0x213100[_0xa55c('0x46')]['duration'];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x47')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x48')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x49')];return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x213100[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x194a79,null))['then'](saveUpdates(_0x213100[_0xa55c('0x46')],null))[_0xa55c('0x20')](respondWithResult(_0x194a79,null))[_0xa55c('0x40')](handleError(_0x194a79,null));};exports['describe']=function(_0x4c3095,_0x35bf0a){return db['ScreenRecording'][_0xa55c('0x4a')]()['then'](respondWithResult(_0x35bf0a,null))[_0xa55c('0x40')](handleError(_0x35bf0a,null));};exports[_0xa55c('0x4b')]=function(_0x181802,_0x3f9313,_0x2ecf79){var _0x5b1cf3=require(_0xa55c('0x4c'));var _0x4607ca=![];var _0x4b85cc={};if(_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]&&_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]==='uniqueid'){_0x4b85cc['uniqueid']=_0x181802[_0xa55c('0x42')]['id'];}else{_0x4b85cc['id']=_0x181802[_0xa55c('0x42')]['id'];}return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':_0x4b85cc,'attributes':['id','value'],'raw':!![]})[_0xa55c('0x20')](handleEntityNotFound(_0x3f9313,null))['then'](function(_0x2742e4){if(_0x2742e4){var _0x437ced=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x2742e4['value']);var _0x1cb73b=util['format'](_0xa55c('0x50'),_0x437ced);if(fs[_0xa55c('0x51')](_0x1cb73b)){_0x4607ca=!![];return _0x5b1cf3[_0xa55c('0x52')](_0x1cb73b,_0x437ced,config[_0xa55c('0x53')][_0xa55c('0x54')])[_0xa55c('0x20')](function(){return _0x2742e4;});}return _0x2742e4;}})[_0xa55c('0x20')](function(_0x53e2be){if(_0x53e2be){var _0x450567=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x53e2be[_0xa55c('0x49')]);if(!fs['existsSync'](_0x450567)){throw new db[(_0xa55c('0x55'))][(_0xa55c('0x56'))](_0xa55c('0x57'));}if(_0x53e2be[_0xa55c('0x58')]){return _0x3f9313[_0xa55c('0x4b')](_0x450567,_0x53e2be['filename']+path[_0xa55c('0x59')](_0x450567),function(){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}else{return _0x3f9313[_0xa55c('0x4b')](_0x450567,function(_0x16d9b2){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}}})['catch'](function(_0x419fc3){if(_0x419fc3['message']===_0xa55c('0x57')){_0x3f9313['status'](0x194)[_0xa55c('0x26')]('Not\x20found');}else{return handleError(_0x3f9313,null);}});};exports[_0xa55c('0x5b')]=function(_0x1333da,_0x21d6b4){return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x1333da[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](function(_0x2f2226){if(_[_0xa55c('0x5c')](_0x2f2226)){throw new ReferenceError(_0xa55c('0x5d'));}return _0x2f2226;})['then'](function(_0x150a07){var _0x311bb9=path['join'](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x150a07[_0xa55c('0x49')]);logger[_0xa55c('0x5e')](_0xa55c('0x5f'),_0x311bb9);if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger['info'](_0xa55c('0x60')+_0x311bb9+_0xa55c('0x61'));fs[_0xa55c('0x62')](_0x311bb9);}_0x311bb9=_0x311bb9+_0xa55c('0x63');if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger[_0xa55c('0x5e')](_0xa55c('0x60')+_0x311bb9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa55c('0x62')](_0x311bb9);}return _0x150a07;})[_0xa55c('0x20')](function(_0x40c56a){if(!_0x40c56a)throw new InternalError();return _0x40c56a[_0xa55c('0x5b')]();})[_0xa55c('0x20')](function(){_0x21d6b4[_0xa55c('0x18')](0xcc)[_0xa55c('0x21')]();})[_0xa55c('0x40')](handleError(_0x21d6b4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 4e9f13d..90aca42 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 _0xf21d=['./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x168605,_0x3910b3){var _0x185662=function(_0x52c830){while(--_0x52c830){_0x168605['push'](_0x168605['shift']());}};_0x185662(++_0x3910b3);}(_0xf21d,0x76));var _0xdf21=function(_0x47af5a,_0x103ffa){_0x47af5a=_0x47af5a-0x0;var _0x22ea1c=_0xf21d[_0x47af5a];return _0x22ea1c;};'use strict';var _=require(_0xdf21('0x0'));var util=require(_0xdf21('0x1'));var logger=require('../../config/logger')(_0xdf21('0x2'));var moment=require(_0xdf21('0x3'));var BPromise=require(_0xdf21('0x4'));var rp=require(_0xdf21('0x5'));var fs=require('fs');var path=require(_0xdf21('0x6'));var rimraf=require(_0xdf21('0x7'));var config=require('../../config/environment');var attributes=require(_0xdf21('0x8'));module[_0xdf21('0x9')]=function(_0x2fbe90,_0x1c5a9e){return _0x2fbe90[_0xdf21('0xa')](_0xdf21('0xb'),attributes,{'tableName':_0xdf21('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xdf21('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x083b=['lodash','api','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','interactionid'];(function(_0x46ddb7,_0x58d88e){var _0x1d564b=function(_0x1391ec){while(--_0x1391ec){_0x46ddb7['push'](_0x46ddb7['shift']());}};_0x1d564b(++_0x58d88e);}(_0x083b,0xaa));var _0xb083=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x083b[_0x2786ea];return _0x5c38e5;};'use strict';var _=require(_0xb083('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb083('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb083('0x2'));var fs=require('fs');var path=require(_0xb083('0x3'));var rimraf=require(_0xb083('0x4'));var config=require(_0xb083('0x5'));var attributes=require('./screenRecording.attributes');module[_0xb083('0x6')]=function(_0x15cf9f,_0x42b1c1){return _0x15cf9f[_0xb083('0x7')](_0xb083('0x8'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xb083('0x9'),'fields':[_0xb083('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index bbdbcd9..6446f99 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 _0x027d=['then','info','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x46cf08,_0x489118){var _0x46df90=function(_0x3ca0da){while(--_0x3ca0da){_0x46cf08['push'](_0x46cf08['shift']());}};_0x46df90(++_0x489118);}(_0x027d,0x14e));var _0xd027=function(_0xae6ce6,_0x2bde46){_0xae6ce6=_0xae6ce6-0x0;var _0x159d04=_0x027d[_0xae6ce6];return _0x159d04;};'use strict';var _=require(_0xd027('0x0'));var util=require(_0xd027('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd027('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd027('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd027('0x4'))(_0xd027('0x5'));var config=require(_0xd027('0x6'));var jayson=require(_0xd027('0x7'));var client=jayson[_0xd027('0x8')][_0xd027('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x269df3,_0x11317d,_0x390255){return new BPromise(function(_0x4351b2,_0x31e7a1){return client[_0xd027('0xa')](_0x269df3,_0x390255)[_0xd027('0xb')](function(_0x3ac614){logger[_0xd027('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x11317d,'request\x20sent');logger[_0xd027('0xd')](_0xd027('0xe'),_0x11317d,_0xd027('0xf'),JSON[_0xd027('0x10')](_0x3ac614));if(_0x3ac614[_0xd027('0x11')]){if(_0x3ac614[_0xd027('0x11')][_0xd027('0x12')]===0x1f4){logger[_0xd027('0x11')](_0xd027('0x13'),_0x11317d,_0x3ac614[_0xd027('0x11')]['message']);return _0x31e7a1(_0x3ac614['error']['message']);}logger[_0xd027('0x11')](_0xd027('0x13'),_0x11317d,_0x3ac614[_0xd027('0x11')][_0xd027('0x14')]);return _0x4351b2(_0x3ac614[_0xd027('0x11')][_0xd027('0x14')]);}else{logger[_0xd027('0xc')](_0xd027('0x13'),_0x11317d,_0xd027('0xf'));_0x4351b2(_0x3ac614[_0xd027('0x15')][_0xd027('0x14')]);}})[_0xd027('0x16')](function(_0x585840){logger[_0xd027('0x11')](_0xd027('0x13'),_0x11317d,_0x585840);_0x31e7a1(_0x585840);});});} \ No newline at end of file +var _0xcd10=['request\x20sent','debug','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x11ffe0,_0x2d2a07){var _0x20581c=function(_0xa97dfe){while(--_0xa97dfe){_0x11ffe0['push'](_0x11ffe0['shift']());}};_0x20581c(++_0x2d2a07);}(_0xcd10,0x1ab));var _0x0cd1=function(_0x414660,_0x187c94){_0x414660=_0x414660-0x0;var _0x105e49=_0xcd10[_0x414660];return _0x105e49;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0cd1('0x0'));var BPromise=require(_0x0cd1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cd1('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cd1('0x3'))(_0x0cd1('0x4'));var config=require('../../config/environment');var jayson=require(_0x0cd1('0x5'));var client=jayson['client'][_0x0cd1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x58facd,_0x3c3ea2,_0x18307e){return new BPromise(function(_0x21e344,_0x156410){return client[_0x0cd1('0x7')](_0x58facd,_0x18307e)[_0x0cd1('0x8')](function(_0x1259dc){logger[_0x0cd1('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x3c3ea2,_0x0cd1('0xa'));logger[_0x0cd1('0xb')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x3c3ea2,'request\x20sent',JSON[_0x0cd1('0xc')](_0x1259dc));if(_0x1259dc[_0x0cd1('0xd')]){if(_0x1259dc[_0x0cd1('0xd')][_0x0cd1('0xe')]===0x1f4){logger[_0x0cd1('0xd')](_0x0cd1('0xf'),_0x3c3ea2,_0x1259dc['error'][_0x0cd1('0x10')]);return _0x156410(_0x1259dc[_0x0cd1('0xd')][_0x0cd1('0x10')]);}logger[_0x0cd1('0xd')](_0x0cd1('0xf'),_0x3c3ea2,_0x1259dc[_0x0cd1('0xd')][_0x0cd1('0x10')]);return _0x21e344(_0x1259dc['error'][_0x0cd1('0x10')]);}else{logger[_0x0cd1('0x9')](_0x0cd1('0xf'),_0x3c3ea2,_0x0cd1('0xa'));_0x21e344(_0x1259dc[_0x0cd1('0x11')][_0x0cd1('0x10')]);}})[_0x0cd1('0x12')](function(_0x50cbe1){logger['error'](_0x0cd1('0xf'),_0x3c3ea2,_0x50cbe1);_0x156410(_0x50cbe1);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 146f424..7dc59eb 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 _0x5a03=['post','addLogo','logologin','extname','originalname','single','file','addLogoLogin','server/files/images/logos/','addFavicon','put','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','format','%s%s','logo'];(function(_0x36365e,_0x29f9f5){var _0x5901b8=function(_0x2b4195){while(--_0x2b4195){_0x36365e['push'](_0x36365e['shift']());}};_0x5901b8(++_0x29f9f5);}(_0x5a03,0xda));var _0x35a0=function(_0x49a371,_0x5f5fe3){_0x49a371=_0x49a371-0x0;var _0x341b8a=_0x5a03[_0x49a371];return _0x341b8a;};'use strict';var multer=require(_0x35a0('0x0'));var util=require('util');var path=require(_0x35a0('0x1'));var timeout=require('connect-timeout');var express=require(_0x35a0('0x2'));var router=express[_0x35a0('0x3')]();var fs_extra=require(_0x35a0('0x4'));var auth=require(_0x35a0('0x5'));var interaction=require(_0x35a0('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x35a0('0x7')]('/',auth[_0x35a0('0x8')](),controller[_0x35a0('0x9')]);router[_0x35a0('0x7')](_0x35a0('0xa'),controller[_0x35a0('0xb')]);router['get'](_0x35a0('0xc'),controller[_0x35a0('0xd')]);router['get'](_0x35a0('0xe'),controller[_0x35a0('0xf')]);router[_0x35a0('0x7')](_0x35a0('0x10'),controller[_0x35a0('0x11')]);router[_0x35a0('0x7')](_0x35a0('0x12'),controller['gdpr']);router[_0x35a0('0x7')](_0x35a0('0x13'),controller[_0x35a0('0x14')]);router[_0x35a0('0x7')]('/:id/favicon',controller[_0x35a0('0x15')]);var upload=multer({'storage':multer[_0x35a0('0x16')]({'destination':function(_0x57f37c,_0x3857c2,_0x480181){_0x480181(null,path[_0x35a0('0x17')](config[_0x35a0('0x18')],'server/files/images/logos/'));},'filename':function(_0x584b58,_0x5f4179,_0x250466){_0x250466(null,util[_0x35a0('0x19')](_0x35a0('0x1a'),_0x35a0('0x1b'),path['extname'](_0x5f4179['originalname'])));}})});router[_0x35a0('0x1c')](_0x35a0('0xe'),upload['single']('file'),controller[_0x35a0('0x1d')]);var upload=multer({'storage':multer[_0x35a0('0x16')]({'destination':function(_0x43a497,_0x47cf76,_0x373a53){_0x373a53(null,path[_0x35a0('0x17')](config[_0x35a0('0x18')],'server/files/images/logos/'));},'filename':function(_0x302747,_0x1e4b22,_0x2e6ca0){_0x2e6ca0(null,util[_0x35a0('0x19')](_0x35a0('0x1a'),_0x35a0('0x1e'),path[_0x35a0('0x1f')](_0x1e4b22[_0x35a0('0x20')])));}})});router['post'](_0x35a0('0x10'),upload[_0x35a0('0x21')](_0x35a0('0x22')),controller[_0x35a0('0x23')]);var upload=multer({'storage':multer[_0x35a0('0x16')]({'destination':function(_0x496b4d,_0x572d43,_0x1e76f0){_0x1e76f0(null,path[_0x35a0('0x17')](config[_0x35a0('0x18')],'server/files/images/logos/'));},'filename':function(_0x31dac0,_0x1ff46b,_0x49d142){_0x49d142(null,util[_0x35a0('0x19')](_0x35a0('0x1a'),'preferred',path[_0x35a0('0x1f')](_0x1ff46b[_0x35a0('0x20')])));}})});router[_0x35a0('0x1c')](_0x35a0('0x13'),upload[_0x35a0('0x21')](_0x35a0('0x22')),controller['addPreferred']);var upload=multer({'storage':multer[_0x35a0('0x16')]({'destination':function(_0x4435ff,_0x2acc17,_0x12cfa0){_0x12cfa0(null,path['join'](config[_0x35a0('0x18')],_0x35a0('0x24')));},'filename':function(_0x567699,_0x588969,_0x1a743a){_0x1a743a(null,util[_0x35a0('0x19')](_0x35a0('0x1a'),'favicon',path[_0x35a0('0x1f')](_0x588969[_0x35a0('0x20')])));}})});router[_0x35a0('0x1c')]('/:id/favicon',upload[_0x35a0('0x21')](_0x35a0('0x22')),controller[_0x35a0('0x25')]);router[_0x35a0('0x26')]('/:id',auth['isAuthenticated'](),controller[_0x35a0('0x27')]);module[_0x35a0('0x28')]=router; \ No newline at end of file +var _0x2387=['logologin','originalname','/:id/logo_login','single','addLogoLogin','join','preferred','addPreferred','favicon','/:id/favicon','put','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','post','file','addLogo','root'];(function(_0x539c4b,_0x4a279c){var _0x5be8d6=function(_0x31703a){while(--_0x31703a){_0x539c4b['push'](_0x539c4b['shift']());}};_0x5be8d6(++_0x4a279c);}(_0x2387,0x10e));var _0x7238=function(_0x2f2561,_0x3db4b2){_0x2f2561=_0x2f2561-0x0;var _0xcb2747=_0x2387[_0x2f2561];return _0xcb2747;};'use strict';var multer=require('multer');var util=require(_0x7238('0x0'));var path=require(_0x7238('0x1'));var timeout=require(_0x7238('0x2'));var express=require(_0x7238('0x3'));var router=express['Router']();var fs_extra=require(_0x7238('0x4'));var auth=require(_0x7238('0x5'));var interaction=require(_0x7238('0x6'));var config=require('../../config/environment');var controller=require(_0x7238('0x7'));router[_0x7238('0x8')]('/',auth[_0x7238('0x9')](),controller[_0x7238('0xa')]);router[_0x7238('0x8')](_0x7238('0xb'),controller[_0x7238('0xc')]);router[_0x7238('0x8')](_0x7238('0xd'),controller['show']);router[_0x7238('0x8')](_0x7238('0xe'),controller[_0x7238('0xf')]);router[_0x7238('0x8')]('/:id/logo_login',controller[_0x7238('0x10')]);router[_0x7238('0x8')](_0x7238('0x11'),controller['gdpr']);router['get'](_0x7238('0x12'),controller[_0x7238('0x13')]);router[_0x7238('0x8')]('/:id/favicon',controller[_0x7238('0x14')]);var upload=multer({'storage':multer[_0x7238('0x15')]({'destination':function(_0x4a769c,_0x4e6b6c,_0x14f1d5){_0x14f1d5(null,path['join'](config['root'],_0x7238('0x16')));},'filename':function(_0x2fed13,_0x5a6a96,_0x54c8bd){_0x54c8bd(null,util[_0x7238('0x17')](_0x7238('0x18'),_0x7238('0x19'),path[_0x7238('0x1a')](_0x5a6a96['originalname'])));}})});router[_0x7238('0x1b')](_0x7238('0xe'),upload['single'](_0x7238('0x1c')),controller[_0x7238('0x1d')]);var upload=multer({'storage':multer[_0x7238('0x15')]({'destination':function(_0x1ed906,_0x182d96,_0x31f87b){_0x31f87b(null,path['join'](config[_0x7238('0x1e')],_0x7238('0x16')));},'filename':function(_0x5eddfb,_0x1bb634,_0x54285a){_0x54285a(null,util[_0x7238('0x17')]('%s%s',_0x7238('0x1f'),path['extname'](_0x1bb634[_0x7238('0x20')])));}})});router['post'](_0x7238('0x21'),upload[_0x7238('0x22')]('file'),controller[_0x7238('0x23')]);var upload=multer({'storage':multer[_0x7238('0x15')]({'destination':function(_0x449ba5,_0x59aadc,_0x6bc493){_0x6bc493(null,path[_0x7238('0x24')](config[_0x7238('0x1e')],_0x7238('0x16')));},'filename':function(_0x43ae81,_0x143f39,_0x5d9106){_0x5d9106(null,util[_0x7238('0x17')](_0x7238('0x18'),_0x7238('0x25'),path[_0x7238('0x1a')](_0x143f39[_0x7238('0x20')])));}})});router[_0x7238('0x1b')]('/:id/preferred',upload[_0x7238('0x22')](_0x7238('0x1c')),controller[_0x7238('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x282579,_0x46ef24,_0x4ef7e8){_0x4ef7e8(null,path[_0x7238('0x24')](config[_0x7238('0x1e')],'server/files/images/logos/'));},'filename':function(_0x996738,_0x3dd258,_0x59d87b){_0x59d87b(null,util[_0x7238('0x17')]('%s%s',_0x7238('0x27'),path[_0x7238('0x1a')](_0x3dd258[_0x7238('0x20')])));}})});router[_0x7238('0x1b')](_0x7238('0x28'),upload[_0x7238('0x22')](_0x7238('0x1c')),controller['addFavicon']);router[_0x7238('0x29')](_0x7238('0xd'),auth[_0x7238('0x9')](),controller['update']);module[_0x7238('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7825885..24234ee 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 _0xac29=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','INTEGER','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','min_internal','min_mailbox','STRING'];(function(_0x11bb5c,_0x3bc172){var _0x24f1b2=function(_0x5e4da9){while(--_0x5e4da9){_0x11bb5c['push'](_0x11bb5c['shift']());}};_0x24f1b2(++_0x3bc172);}(_0xac29,0x17c));var _0x9ac2=function(_0x367dff,_0xd200aa){_0x367dff=_0x367dff-0x0;var _0x3bb13e=_0xac29[_0x367dff];return _0x3bb13e;};'use strict';var Sequelize=require(_0x9ac2('0x0'));module[_0x9ac2('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x9ac2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x9ac2('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9ac2('0x4')],'defaultValue':_0x9ac2('0x5')},'logo':{'type':Sequelize[_0x9ac2('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9ac2('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9ac2('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9ac2('0x4')]},'turnaddr':{'type':Sequelize[_0x9ac2('0x4')]},'turnusername':{'type':Sequelize[_0x9ac2('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9ac2('0x7')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x9ac2('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x9ac2('0x9')},'chatTimeout':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9ac2('0x4')]},'defaultPreferred':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x9ac2('0x4')]},'defaultFavicon':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x9ac2('0x7')]},'transcribeRegion':{'type':Sequelize[_0x9ac2('0x4')]},'sentiment':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9ac2('0x4')]},'bucket':{'type':Sequelize[_0x9ac2('0x4')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9ac2('0x7')](0x2)[_0x9ac2('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x9ac2('0x7')](0x2)[_0x9ac2('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x9ac2('0x7')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x9ac2('0x7')](0x2)[_0x9ac2('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x9ac2('0x7')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x9ac2('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x0220=['min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0220,0x1be));var _0x0022=function(_0x2f32c4,_0x531dc6){_0x2f32c4=_0x2f32c4-0x0;var _0x3f3018=_0x0220[_0x2f32c4];return _0x3f3018;};'use strict';var Sequelize=require('sequelize');module[_0x0022('0x0')]={'min_internal':{'type':Sequelize[_0x0022('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x0022('0x1')](0xb),'unique':_0x0022('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0022('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x0022('0x3')]},'defaultLogo':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0022('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0022('0x3')]},'turnaddr':{'type':Sequelize[_0x0022('0x3')]},'turnusername':{'type':Sequelize[_0x0022('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0022('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0022('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0022('0x3')],'defaultValue':_0x0022('0x5')},'enableEmailPreview':{'type':Sequelize[_0x0022('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0022('0x3')],'defaultValue':_0x0022('0x6')},'chatTimeout':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0022('0x3')]},'defaultPreferred':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0022('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0022('0x3')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0022('0x4')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0022('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x0022('0x1')]},'transcribeRegion':{'type':Sequelize[_0x0022('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0022('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0022('0x1')]},'sentimentRegion':{'type':Sequelize[_0x0022('0x3')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x0022('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x0022('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0022('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0022('0x1')](0x2)[_0x0022('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0022('0x1')](0x2)[_0x0022('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0022('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0022('0x1')](0x2)[_0x0022('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0022('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0022('0x4')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0022('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x0022('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 0f94536..294eb90 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 _0x61ea=['addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','\x20not\x20found','download','default_loginLogo.svg','ValidationError','gdpr','securePassword','getPreferred','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','includeAll','find','body','addLogo','file','logo','filename'];(function(_0x26a3b2,_0x2aa487){var _0x226b5e=function(_0x4c4f27){while(--_0x4c4f27){_0x26a3b2['push'](_0x26a3b2['shift']());}};_0x226b5e(++_0x2aa487);}(_0x61ea,0x1a0));var _0xa61e=function(_0x2810a5,_0x348415){_0x2810a5=_0x2810a5-0x0;var _0x278816=_0x61ea[_0x2810a5];return _0x278816;};'use strict';var emlformat=require(_0xa61e('0x0'));var rimraf=require(_0xa61e('0x1'));var zipdir=require(_0xa61e('0x2'));var jsonpatch=require(_0xa61e('0x3'));var rp=require(_0xa61e('0x4'));var moment=require(_0xa61e('0x5'));var BPromise=require(_0xa61e('0x6'));var Mustache=require(_0xa61e('0x7'));var util=require(_0xa61e('0x8'));var path=require(_0xa61e('0x9'));var sox=require(_0xa61e('0xa'));var csv=require('to-csv');var ejs=require(_0xa61e('0xb'));var fs=require('fs');var fs_extra=require(_0xa61e('0xc'));var _=require(_0xa61e('0xd'));var squel=require(_0xa61e('0xe'));var crypto=require(_0xa61e('0xf'));var jsforce=require(_0xa61e('0x10'));var deskjs=require(_0xa61e('0x11'));var toCsv=require(_0xa61e('0x12'));var querystring=require(_0xa61e('0x13'));var Papa=require(_0xa61e('0x14'));var Redis=require('ioredis');var authService=require(_0xa61e('0x15'));var qs=require(_0xa61e('0x16'));var as=require(_0xa61e('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa61e('0x18'))(_0xa61e('0x19'));var utils=require(_0xa61e('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xa61e('0x1b'));var db=require(_0xa61e('0x1c'))['db'];var jayson=require(_0xa61e('0x1d'));var client=jayson[_0xa61e('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x89f6bd,_0x1b04af,_0x251e51,_0x2666bc){return new BPromise(function(_0x15d9dc,_0x7d8884){var _0x5751fb=_0x2666bc||client;return _0x5751fb[_0xa61e('0x1f')](_0x89f6bd,_0x251e51)['then'](function(_0x4d8e23){logger[_0xa61e('0x20')](_0xa61e('0x21'),_0x1b04af,'request\x20sent');logger[_0xa61e('0x22')](_0xa61e('0x23'),_0x1b04af,_0xa61e('0x24'),JSON[_0xa61e('0x25')](_0x4d8e23));if(_0x4d8e23[_0xa61e('0x26')]){if(_0x4d8e23[_0xa61e('0x26')][_0xa61e('0x27')]===0x1f4){logger[_0xa61e('0x26')](_0xa61e('0x21'),_0x1b04af,_0x4d8e23['error'][_0xa61e('0x28')]);return _0x7d8884(_0x4d8e23['error'][_0xa61e('0x28')]);}logger['error'](_0xa61e('0x21'),_0x1b04af,_0x4d8e23[_0xa61e('0x26')][_0xa61e('0x28')]);return _0x15d9dc(_0x4d8e23[_0xa61e('0x26')]['message']);}else{logger[_0xa61e('0x20')](_0xa61e('0x21'),_0x1b04af,_0xa61e('0x24'));_0x15d9dc(_0x4d8e23['result']['message']);}})[_0xa61e('0x29')](function(_0x4b8827){logger['error'](_0xa61e('0x21'),_0x1b04af,_0x4b8827);_0x7d8884(_0x4b8827);});});}function respondWithStatusCode(_0x3fa7dd,_0x47e2fd){_0x47e2fd=_0x47e2fd||0xcc;return function(_0x4d4fe6){if(_0x4d4fe6){return _0x3fa7dd[_0xa61e('0x2a')](_0x47e2fd);}return _0x3fa7dd[_0xa61e('0x2b')](_0x47e2fd)[_0xa61e('0x2c')]();};}function respondWithResult(_0x48eabe,_0x299cb5){_0x299cb5=_0x299cb5||0xc8;return function(_0x18f9c4){if(_0x18f9c4){return _0x48eabe[_0xa61e('0x2b')](_0x299cb5)[_0xa61e('0x2d')](_0x18f9c4);}};}function respondWithFilteredResult(_0x437f8f,_0x2fa2a1){return function(_0x6e9064){if(_0x6e9064){var _0xa7ff5b=typeof _0x2fa2a1[_0xa61e('0x2e')]===_0xa61e('0x2f')&&typeof _0x2fa2a1[_0xa61e('0x30')]==='undefined';var _0x2940b3=_0x6e9064[_0xa61e('0x31')];var _0x2f864e=_0xa7ff5b?0x0:_0x2fa2a1[_0xa61e('0x2e')];var _0x2f2305=_0xa7ff5b?_0x6e9064['count']:_0x2fa2a1['offset']+_0x2fa2a1['limit'];var _0x6ed1b5;if(_0x2f2305>=_0x2940b3){_0x2f2305=_0x2940b3;_0x6ed1b5=0xc8;}else{_0x6ed1b5=0xce;}_0x437f8f[_0xa61e('0x2b')](_0x6ed1b5);return _0x437f8f[_0xa61e('0x32')]('Content-Range',_0x2f864e+'-'+_0x2f2305+'/'+_0x2940b3)['json'](_0x6e9064);}return null;};}function patchUpdates(_0x4ea855){return function(_0x7e2e08){try{jsonpatch[_0xa61e('0x33')](_0x7e2e08,_0x4ea855,!![]);}catch(_0x3ff315){return BPromise[_0xa61e('0x34')](_0x3ff315);}return _0x7e2e08['save']();};}function saveUpdates(_0x1beadb,_0x37711a){return function(_0x2b37e4){if(_0x2b37e4){return _0x2b37e4[_0xa61e('0x35')](_0x1beadb)['then'](function(_0x4f5d28){return _0x4f5d28;});}return null;};}function removeEntity(_0x3cf146,_0x550686){return function(_0x4d353e){if(_0x4d353e){return _0x4d353e['destroy']()[_0xa61e('0x36')](function(){_0x3cf146[_0xa61e('0x2b')](0xcc)[_0xa61e('0x2c')]();});}};}function handleEntityNotFound(_0x1d5ee7,_0x2dd53c){return function(_0x123410){if(!_0x123410){_0x1d5ee7[_0xa61e('0x2a')](0x194);}return _0x123410;};}function handleError(_0x148240,_0x28480f){_0x28480f=_0x28480f||0x1f4;return function(_0x2a42fa){logger['error'](_0x2a42fa[_0xa61e('0x37')]);if(_0x2a42fa[_0xa61e('0x38')]){delete _0x2a42fa[_0xa61e('0x38')];}_0x148240[_0xa61e('0x2b')](_0x28480f)[_0xa61e('0x39')](_0x2a42fa);};}exports['index']=function(_0x533137,_0x5cb1ef){var _0x58250e={},_0x314d6e={},_0x50ce43={'count':0x0,'rows':[]};var _0x303d5e=_[_0xa61e('0x3a')](db[_0xa61e('0x3b')][_0xa61e('0x3c')],function(_0x4edd3e){return{'name':_0x4edd3e[_0xa61e('0x3d')],'type':_0x4edd3e[_0xa61e('0x3e')][_0xa61e('0x3f')]};});_0x314d6e['model']=_[_0xa61e('0x3a')](_0x303d5e,_0xa61e('0x38'));_0x314d6e[_0xa61e('0x40')]=_['keys'](_0x533137[_0xa61e('0x40')]);_0x314d6e[_0xa61e('0x41')]=_[_0xa61e('0x42')](_0x314d6e['model'],_0x314d6e['query']);_0x58250e['attributes']=_[_0xa61e('0x42')](_0x314d6e[_0xa61e('0x43')],qs['fields'](_0x533137[_0xa61e('0x40')]['fields']));_0x58250e[_0xa61e('0x44')]=_0x58250e[_0xa61e('0x44')]['length']?_0x58250e[_0xa61e('0x44')]:_0x314d6e[_0xa61e('0x43')];if(!_0x533137[_0xa61e('0x40')][_0xa61e('0x45')]('nolimit')){_0x58250e[_0xa61e('0x30')]=qs['limit'](_0x533137['query']['limit']);_0x58250e[_0xa61e('0x2e')]=qs[_0xa61e('0x2e')](_0x533137[_0xa61e('0x40')][_0xa61e('0x2e')]);}_0x58250e[_0xa61e('0x46')]=qs[_0xa61e('0x47')](_0x533137[_0xa61e('0x40')][_0xa61e('0x47')]);_0x58250e[_0xa61e('0x48')]=qs[_0xa61e('0x41')](_[_0xa61e('0x49')](_0x533137[_0xa61e('0x40')],_0x314d6e[_0xa61e('0x41')]),_0x303d5e);if(_0x533137['query'][_0xa61e('0x4a')]){_0x58250e[_0xa61e('0x48')]=_[_0xa61e('0x4b')](_0x58250e[_0xa61e('0x48')],{'$or':_[_0xa61e('0x3a')](_0x303d5e,function(_0x5936a9){if(_0x5936a9['type']!==_0xa61e('0x4c')){var _0x3e140e={};_0x3e140e[_0x5936a9['name']]={'$like':'%'+_0x533137['query'][_0xa61e('0x4a')]+'%'};return _0x3e140e;}})});}_0x58250e=_['merge']({},_0x58250e,_0x533137[_0xa61e('0x4d')]);var _0x55ad1a={'where':_0x58250e['where']};return db['Setting'][_0xa61e('0x31')](_0x55ad1a)[_0xa61e('0x36')](function(_0x544357){_0x50ce43[_0xa61e('0x31')]=_0x544357;if(_0x533137[_0xa61e('0x40')]['includeAll']){_0x58250e[_0xa61e('0x4e')]=[{'all':!![]}];}return db[_0xa61e('0x3b')][_0xa61e('0x4f')](_0x58250e);})[_0xa61e('0x36')](function(_0x5565f3){_0x50ce43[_0xa61e('0x50')]=_0x5565f3;return _0x50ce43;})[_0xa61e('0x36')](respondWithFilteredResult(_0x5cb1ef,_0x58250e))['catch'](handleError(_0x5cb1ef,null));};exports[_0xa61e('0x51')]=function(_0x2acf43,_0x116b00){var _0x13789f={'raw':![],'where':{'id':_0x2acf43[_0xa61e('0x52')]['id']}},_0x282e7b={};_0x282e7b['model']=_[_0xa61e('0x53')](db[_0xa61e('0x3b')][_0xa61e('0x3c')]);_0x282e7b['query']=_[_0xa61e('0x53')](_0x2acf43['query']);_0x282e7b[_0xa61e('0x41')]=_[_0xa61e('0x42')](_0x282e7b[_0xa61e('0x43')],_0x282e7b['query']);_0x13789f[_0xa61e('0x44')]=_[_0xa61e('0x42')](_0x282e7b[_0xa61e('0x43')],qs['fields'](_0x2acf43[_0xa61e('0x40')]['fields']));_0x13789f[_0xa61e('0x44')]=_0x13789f[_0xa61e('0x44')][_0xa61e('0x54')]?_0x13789f[_0xa61e('0x44')]:_0x282e7b[_0xa61e('0x43')];if(_0x2acf43[_0xa61e('0x40')][_0xa61e('0x55')]){_0x13789f['include']=[{'all':!![]}];}_0x13789f=_['merge']({},_0x13789f,_0x2acf43[_0xa61e('0x4d')]);return db[_0xa61e('0x3b')][_0xa61e('0x56')](_0x13789f)[_0xa61e('0x36')](handleEntityNotFound(_0x116b00,null))[_0xa61e('0x36')](respondWithResult(_0x116b00,null))[_0xa61e('0x29')](handleError(_0x116b00,null));};exports[_0xa61e('0x35')]=function(_0x1da8c1,_0x12e82b){if(_0x1da8c1[_0xa61e('0x57')]['id']){delete _0x1da8c1[_0xa61e('0x57')]['id'];}return db[_0xa61e('0x3b')][_0xa61e('0x56')]({'where':{'id':_0x1da8c1[_0xa61e('0x52')]['id']}})[_0xa61e('0x36')](handleEntityNotFound(_0x12e82b,null))[_0xa61e('0x36')](saveUpdates(_0x1da8c1[_0xa61e('0x57')],null))[_0xa61e('0x36')](respondWithResult(_0x12e82b,null))[_0xa61e('0x29')](handleError(_0x12e82b,null));};exports[_0xa61e('0x58')]=function(_0x1ce70a,_0x58f9b0,_0x1514a8){if(_0x1ce70a[_0xa61e('0x59')]&&_0x1ce70a[_0xa61e('0x59')]['filename']){_0x1ce70a[_0xa61e('0x57')][_0xa61e('0x5a')]=_0x1ce70a['file'][_0xa61e('0x5b')];}return db[_0xa61e('0x3b')][_0xa61e('0x56')]({'where':{'id':_0x1ce70a[_0xa61e('0x52')]['id']}})['then'](handleEntityNotFound(_0x58f9b0,null))[_0xa61e('0x36')](saveUpdates(_0x1ce70a[_0xa61e('0x57')],null))[_0xa61e('0x36')](respondWithResult(_0x58f9b0,null))['catch'](handleError(_0x58f9b0,null));};exports[_0xa61e('0x5c')]=function(_0x57f2ea,_0x35735b,_0x563e08){if(_0x57f2ea[_0xa61e('0x59')]&&_0x57f2ea[_0xa61e('0x59')][_0xa61e('0x5b')]){_0x57f2ea['body'][_0xa61e('0x5d')]=_0x57f2ea[_0xa61e('0x59')][_0xa61e('0x5b')];}return db[_0xa61e('0x3b')]['find']({'where':{'id':_0x57f2ea['params']['id']}})['then'](handleEntityNotFound(_0x35735b,null))['then'](saveUpdates(_0x57f2ea['body'],null))[_0xa61e('0x36')](respondWithResult(_0x35735b,null))[_0xa61e('0x29')](handleError(_0x35735b,null));};var utilLicense=require(_0xa61e('0x1b'));exports[_0xa61e('0x5e')]=function(_0x23878c,_0x5c583d,_0x4a7bca){var _0x3712fb=_0xa61e('0x5f');var _0x368096={'custom':![]};return utilLicense[_0xa61e('0x60')]()[_0xa61e('0x36')](function(_0x3de667){if(_0x3de667){_0x368096=_0x3de667;}return db[_0xa61e('0x3b')][_0xa61e('0x56')]({'where':{'id':_0x23878c[_0xa61e('0x52')]['id']},'attributes':[_0xa61e('0x5a'),_0xa61e('0x5d'),_0xa61e('0x61'),_0xa61e('0x62'),_0xa61e('0x63'),_0xa61e('0x64'),_0xa61e('0x65'),_0xa61e('0x66')],'raw':!![]});})[_0xa61e('0x36')](handleEntityNotFound(_0x5c583d,null))['then'](function(_0x4ee08a){if(_0x4ee08a){var _0x80c17c=_0x4ee08a[_0xa61e('0x5a')]&&fs[_0xa61e('0x67')](path[_0xa61e('0x68')](config[_0xa61e('0x69')],_0x3712fb,_[_0xa61e('0x6a')](_0x4ee08a[_0xa61e('0x5a')])))?path[_0xa61e('0x68')](config[_0xa61e('0x69')],_0x3712fb,_['toLower'](_0x4ee08a['logo'])):path[_0xa61e('0x68')](config['root'],_0x3712fb,_[_0xa61e('0x6a')](_0xa61e('0x6b')));var _0xa15ff=_0xa61e('0x6c')+_[_0xa61e('0x6d')](_0xa61e('0x5a'));if(_0x4ee08a[_0xa15ff]||!_0x368096['custom']){_0x80c17c=path[_0xa61e('0x68')](config[_0xa61e('0x69')],_0x3712fb,_[_0xa61e('0x6a')](_0xa61e('0x6b')));}if(!fs[_0xa61e('0x67')](_0x80c17c)){throw new db[(_0xa61e('0x6e'))]['ValidationError'](_[_0xa61e('0x6d')]('logo')+_0xa61e('0x6f'));}return _0x5c583d[_0xa61e('0x70')](_0x80c17c);}})[_0xa61e('0x29')](handleError(_0x5c583d,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x1cfee7,_0x5b6157,_0xd556d3){var _0x2b0f4e=_0xa61e('0x5f');var _0x57541d={'custom':![]};return utilLicense[_0xa61e('0x60')]()['then'](function(_0x492e83){if(_0x492e83){_0x57541d=_0x492e83;}return db[_0xa61e('0x3b')]['find']({'where':{'id':_0x1cfee7[_0xa61e('0x52')]['id']},'attributes':['logo',_0xa61e('0x5d'),'preferred','favicon',_0xa61e('0x63'),_0xa61e('0x64'),_0xa61e('0x65'),_0xa61e('0x66')],'raw':!![]});})['then'](handleEntityNotFound(_0x5b6157,null))[_0xa61e('0x36')](function(_0x27794e){if(_0x27794e){var _0x11e6cc=_0x27794e[_0xa61e('0x5d')]&&fs[_0xa61e('0x67')](path[_0xa61e('0x68')](config[_0xa61e('0x69')],_0x2b0f4e,_[_0xa61e('0x6a')](_0x27794e[_0xa61e('0x5d')])))?path[_0xa61e('0x68')](config[_0xa61e('0x69')],_0x2b0f4e,_[_0xa61e('0x6a')](_0x27794e[_0xa61e('0x5d')])):path['join'](config[_0xa61e('0x69')],_0x2b0f4e,_['toLower']('default_loginLogo.svg'));var _0x2392ef='default'+_['upperFirst'](_0xa61e('0x5d'));if(_0x27794e[_0x2392ef]||!_0x57541d['custom']){_0x11e6cc=path[_0xa61e('0x68')](config['root'],_0x2b0f4e,_['toLower'](_0xa61e('0x71')));}if(!fs[_0xa61e('0x67')](_0x11e6cc)){throw new db[(_0xa61e('0x6e'))][(_0xa61e('0x72'))](_[_0xa61e('0x6d')]('loginLogo')+'\x20not\x20found');}return _0x5b6157['download'](_0x11e6cc);}})['catch'](handleError(_0x5b6157,null));};exports[_0xa61e('0x73')]=function(_0x4d554a,_0x420c57){return db[_0xa61e('0x3b')][_0xa61e('0x56')]({'where':{'id':_0x4d554a['params']['id']},'attributes':[_0xa61e('0x74')]})[_0xa61e('0x36')](respondWithResult(_0x420c57,null))['catch'](handleError(_0x420c57,null));};exports['addPreferred']=function(_0x1465f3,_0x54ae89,_0x4178fd){if(_0x1465f3['file']&&_0x1465f3[_0xa61e('0x59')][_0xa61e('0x5b')]){_0x1465f3[_0xa61e('0x57')][_0xa61e('0x61')]=_0x1465f3[_0xa61e('0x59')][_0xa61e('0x5b')];}return db[_0xa61e('0x3b')]['find']({'where':{'id':_0x1465f3['params']['id']}})[_0xa61e('0x36')](handleEntityNotFound(_0x54ae89,null))[_0xa61e('0x36')](saveUpdates(_0x1465f3[_0xa61e('0x57')],null))[_0xa61e('0x36')](respondWithResult(_0x54ae89,null))[_0xa61e('0x29')](handleError(_0x54ae89,null));};var utilLicense=require('../../config/license/util');exports[_0xa61e('0x75')]=function(_0x5a8e52,_0x10ea71,_0x15f9fb){var _0x492e9a=_0xa61e('0x5f');var _0x5072cd={'custom':![]};return utilLicense[_0xa61e('0x60')]()[_0xa61e('0x36')](function(_0x697847){if(_0x697847){_0x5072cd=_0x697847;}return db[_0xa61e('0x3b')][_0xa61e('0x56')]({'where':{'id':_0x5a8e52[_0xa61e('0x52')]['id']},'attributes':['logo',_0xa61e('0x5d'),_0xa61e('0x61'),_0xa61e('0x62'),_0xa61e('0x63'),_0xa61e('0x64'),_0xa61e('0x65'),_0xa61e('0x66')],'raw':!![]});})[_0xa61e('0x36')](handleEntityNotFound(_0x10ea71,null))[_0xa61e('0x36')](function(_0x2744e7){if(_0x2744e7){var _0x11e01d=_0x2744e7[_0xa61e('0x61')]&&fs[_0xa61e('0x67')](path['join'](config[_0xa61e('0x69')],_0x492e9a,_['toLower'](_0x2744e7[_0xa61e('0x61')])))?path[_0xa61e('0x68')](config[_0xa61e('0x69')],_0x492e9a,_[_0xa61e('0x6a')](_0x2744e7[_0xa61e('0x61')])):path[_0xa61e('0x68')](config[_0xa61e('0x69')],_0x492e9a,_[_0xa61e('0x6a')]('default_preferred.png'));var _0x359542=_0xa61e('0x6c')+_[_0xa61e('0x6d')](_0xa61e('0x61'));if(_0x2744e7[_0x359542]||!_0x5072cd[_0xa61e('0x76')]||!_0x5072cd[_0xa61e('0x61')]){_0x11e01d=path['join'](config['root'],_0x492e9a,_[_0xa61e('0x6a')]('default_preferred.png'));}if(!fs[_0xa61e('0x67')](_0x11e01d)){throw new db[(_0xa61e('0x6e'))][(_0xa61e('0x72'))](_['upperFirst']('preferred')+_0xa61e('0x6f'));}return _0x10ea71[_0xa61e('0x70')](_0x11e01d);}})[_0xa61e('0x29')](handleError(_0x10ea71,null));};exports[_0xa61e('0x77')]=function(_0x189bd9,_0x222b71,_0x3e3b33){if(_0x189bd9[_0xa61e('0x59')]&&_0x189bd9['file']['filename']){_0x189bd9[_0xa61e('0x57')][_0xa61e('0x62')]=_0x189bd9[_0xa61e('0x59')][_0xa61e('0x5b')];}return db['Setting']['find']({'where':{'id':_0x189bd9[_0xa61e('0x52')]['id']}})[_0xa61e('0x36')](handleEntityNotFound(_0x222b71,null))[_0xa61e('0x36')](saveUpdates(_0x189bd9[_0xa61e('0x57')],null))[_0xa61e('0x36')](respondWithResult(_0x222b71,null))['catch'](handleError(_0x222b71,null));};var utilLicense=require(_0xa61e('0x1b'));exports[_0xa61e('0x78')]=function(_0x33348d,_0x2c22f8,_0x38ef7b){var _0x24fbfe=_0xa61e('0x5f');var _0x17fbcc={'custom':![]};return utilLicense[_0xa61e('0x60')]()['then'](function(_0x111430){if(_0x111430){_0x17fbcc=_0x111430;}return db[_0xa61e('0x3b')]['find']({'where':{'id':_0x33348d[_0xa61e('0x52')]['id']},'attributes':[_0xa61e('0x5a'),_0xa61e('0x5d'),_0xa61e('0x61'),_0xa61e('0x62'),_0xa61e('0x63'),'defaultLoginLogo',_0xa61e('0x65'),_0xa61e('0x66')],'raw':!![]});})[_0xa61e('0x36')](handleEntityNotFound(_0x2c22f8,null))[_0xa61e('0x36')](function(_0x1b5b37){if(_0x1b5b37){var _0x21d86f=_0x1b5b37[_0xa61e('0x62')]&&fs[_0xa61e('0x67')](path[_0xa61e('0x68')](config['root'],_0x24fbfe,_[_0xa61e('0x6a')](_0x1b5b37[_0xa61e('0x62')])))?path[_0xa61e('0x68')](config[_0xa61e('0x69')],_0x24fbfe,_[_0xa61e('0x6a')](_0x1b5b37[_0xa61e('0x62')])):path[_0xa61e('0x68')](config['root'],_0x24fbfe,_[_0xa61e('0x6a')](_0xa61e('0x79')));var _0xc703c5=_0xa61e('0x6c')+_[_0xa61e('0x6d')](_0xa61e('0x62'));if(_0x1b5b37[_0xc703c5]||!_0x17fbcc[_0xa61e('0x76')]){_0x21d86f=path[_0xa61e('0x68')](config[_0xa61e('0x69')],_0x24fbfe,_['toLower'](_0xa61e('0x79')));}if(!fs[_0xa61e('0x67')](_0x21d86f)){throw new db['Sequelize'][(_0xa61e('0x72'))](_[_0xa61e('0x6d')](_0xa61e('0x62'))+'\x20not\x20found');}return _0x2c22f8[_0xa61e('0x70')](_0x21d86f);}})[_0xa61e('0x29')](handleError(_0x2c22f8,null));};exports[_0xa61e('0x7a')]=function(_0x2606da,_0x14e19f){var _0x2b2188={'offset':moment()[_0xa61e('0x7b')]()};_0x2b2188[_0xa61e('0x7c')]=moment()[_0xa61e('0x7b')](_0x2b2188[_0xa61e('0x2e')])[_0xa61e('0x7d')](_0xa61e('0x7e'));return _0x14e19f['status'](0xc8)[_0xa61e('0x39')](_0x2b2188);}; \ No newline at end of file +var _0xe700=['request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','Setting','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','include','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','download','getLogoLogin','getLicense','defaultLogo','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','\x20not\x20found','gdpr','addPreferred','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0xa220d0,_0x1c8986){var _0xf7d5a9=function(_0x5261d9){while(--_0x5261d9){_0xa220d0['push'](_0xa220d0['shift']());}};_0xf7d5a9(++_0x1c8986);}(_0xe700,0x16a));var _0x0e70=function(_0x457f19,_0xb7c03b){_0x457f19=_0x457f19-0x0;var _0x598512=_0xe700[_0x457f19];return _0x598512;};'use strict';var emlformat=require(_0x0e70('0x0'));var rimraf=require(_0x0e70('0x1'));var zipdir=require(_0x0e70('0x2'));var jsonpatch=require(_0x0e70('0x3'));var rp=require(_0x0e70('0x4'));var moment=require('moment');var BPromise=require(_0x0e70('0x5'));var Mustache=require('mustache');var util=require(_0x0e70('0x6'));var path=require(_0x0e70('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e70('0x8'));var fs=require('fs');var fs_extra=require(_0x0e70('0x9'));var _=require(_0x0e70('0xa'));var squel=require(_0x0e70('0xb'));var crypto=require('crypto');var jsforce=require(_0x0e70('0xc'));var deskjs=require(_0x0e70('0xd'));var toCsv=require(_0x0e70('0xe'));var querystring=require(_0x0e70('0xf'));var Papa=require(_0x0e70('0x10'));var Redis=require(_0x0e70('0x11'));var authService=require(_0x0e70('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0e70('0x13'));var hardwareService=require(_0x0e70('0x14'));var logger=require(_0x0e70('0x15'))('api');var utils=require(_0x0e70('0x16'));var config=require(_0x0e70('0x17'));var licenseUtil=require(_0x0e70('0x18'));var db=require(_0x0e70('0x19'))['db'];var jayson=require(_0x0e70('0x1a'));var client=jayson[_0x0e70('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a0612,_0x264442,_0x45c909,_0x296f48){return new BPromise(function(_0x429429,_0x2bf5c3){var _0x4ddd95=_0x296f48||client;return _0x4ddd95['request'](_0x2a0612,_0x45c909)[_0x0e70('0x1c')](function(_0x17b763){logger[_0x0e70('0x1d')]('Setting,\x20%s,\x20%s',_0x264442,_0x0e70('0x1e'));logger[_0x0e70('0x1f')](_0x0e70('0x20'),_0x264442,_0x0e70('0x1e'),JSON[_0x0e70('0x21')](_0x17b763));if(_0x17b763[_0x0e70('0x22')]){if(_0x17b763['error']['code']===0x1f4){logger[_0x0e70('0x22')](_0x0e70('0x23'),_0x264442,_0x17b763[_0x0e70('0x22')][_0x0e70('0x24')]);return _0x2bf5c3(_0x17b763['error'][_0x0e70('0x24')]);}logger[_0x0e70('0x22')](_0x0e70('0x23'),_0x264442,_0x17b763[_0x0e70('0x22')][_0x0e70('0x24')]);return _0x429429(_0x17b763[_0x0e70('0x22')][_0x0e70('0x24')]);}else{logger['info'](_0x0e70('0x23'),_0x264442,_0x0e70('0x1e'));_0x429429(_0x17b763[_0x0e70('0x25')]['message']);}})[_0x0e70('0x26')](function(_0x5b7c21){logger[_0x0e70('0x22')](_0x0e70('0x23'),_0x264442,_0x5b7c21);_0x2bf5c3(_0x5b7c21);});});}function respondWithStatusCode(_0x24624f,_0x2a424e){_0x2a424e=_0x2a424e||0xcc;return function(_0x4ce24f){if(_0x4ce24f){return _0x24624f['sendStatus'](_0x2a424e);}return _0x24624f[_0x0e70('0x27')](_0x2a424e)[_0x0e70('0x28')]();};}function respondWithResult(_0x39e4be,_0x38366b){_0x38366b=_0x38366b||0xc8;return function(_0x47cedb){if(_0x47cedb){return _0x39e4be[_0x0e70('0x27')](_0x38366b)[_0x0e70('0x29')](_0x47cedb);}};}function respondWithFilteredResult(_0x4ba570,_0x2b2dba){return function(_0x33923a){if(_0x33923a){var _0x48d979=typeof _0x2b2dba['offset']===_0x0e70('0x2a')&&typeof _0x2b2dba[_0x0e70('0x2b')]===_0x0e70('0x2a');var _0xa1fc1b=_0x33923a[_0x0e70('0x2c')];var _0x150e45=_0x48d979?0x0:_0x2b2dba[_0x0e70('0x2d')];var _0x5088a2=_0x48d979?_0x33923a[_0x0e70('0x2c')]:_0x2b2dba['offset']+_0x2b2dba['limit'];var _0x2eb8b3;if(_0x5088a2>=_0xa1fc1b){_0x5088a2=_0xa1fc1b;_0x2eb8b3=0xc8;}else{_0x2eb8b3=0xce;}_0x4ba570[_0x0e70('0x27')](_0x2eb8b3);return _0x4ba570[_0x0e70('0x2e')](_0x0e70('0x2f'),_0x150e45+'-'+_0x5088a2+'/'+_0xa1fc1b)['json'](_0x33923a);}return null;};}function patchUpdates(_0x3c8537){return function(_0x4f30e2){try{jsonpatch[_0x0e70('0x30')](_0x4f30e2,_0x3c8537,!![]);}catch(_0x5c1bfe){return BPromise[_0x0e70('0x31')](_0x5c1bfe);}return _0x4f30e2['save']();};}function saveUpdates(_0x8b1164,_0x126553){return function(_0x36aa5e){if(_0x36aa5e){return _0x36aa5e[_0x0e70('0x32')](_0x8b1164)['then'](function(_0x5a0d4c){return _0x5a0d4c;});}return null;};}function removeEntity(_0x2cfae4,_0x260421){return function(_0x4d7794){if(_0x4d7794){return _0x4d7794[_0x0e70('0x33')]()[_0x0e70('0x1c')](function(){_0x2cfae4[_0x0e70('0x27')](0xcc)[_0x0e70('0x28')]();});}};}function handleEntityNotFound(_0x3e3e01,_0x47b22e){return function(_0x497905){if(!_0x497905){_0x3e3e01[_0x0e70('0x34')](0x194);}return _0x497905;};}function handleError(_0x272596,_0x4390ea){_0x4390ea=_0x4390ea||0x1f4;return function(_0x3f74eb){logger[_0x0e70('0x22')](_0x3f74eb[_0x0e70('0x35')]);if(_0x3f74eb['name']){delete _0x3f74eb[_0x0e70('0x36')];}_0x272596[_0x0e70('0x27')](_0x4390ea)[_0x0e70('0x37')](_0x3f74eb);};}exports['index']=function(_0x27c7d3,_0x3cdb61){var _0x3de01e={},_0x38d031={},_0x2749c4={'count':0x0,'rows':[]};var _0x5cdf1b=_['map'](db[_0x0e70('0x38')][_0x0e70('0x39')],function(_0x46e4e9){return{'name':_0x46e4e9['fieldName'],'type':_0x46e4e9[_0x0e70('0x3a')][_0x0e70('0x3b')]};});_0x38d031['model']=_[_0x0e70('0x3c')](_0x5cdf1b,'name');_0x38d031[_0x0e70('0x3d')]=_[_0x0e70('0x3e')](_0x27c7d3['query']);_0x38d031[_0x0e70('0x3f')]=_[_0x0e70('0x40')](_0x38d031['model'],_0x38d031[_0x0e70('0x3d')]);_0x3de01e[_0x0e70('0x41')]=_['intersection'](_0x38d031['model'],qs[_0x0e70('0x42')](_0x27c7d3['query']['fields']));_0x3de01e[_0x0e70('0x41')]=_0x3de01e[_0x0e70('0x41')][_0x0e70('0x43')]?_0x3de01e['attributes']:_0x38d031[_0x0e70('0x44')];if(!_0x27c7d3[_0x0e70('0x3d')][_0x0e70('0x45')](_0x0e70('0x46'))){_0x3de01e[_0x0e70('0x2b')]=qs[_0x0e70('0x2b')](_0x27c7d3[_0x0e70('0x3d')][_0x0e70('0x2b')]);_0x3de01e[_0x0e70('0x2d')]=qs['offset'](_0x27c7d3['query'][_0x0e70('0x2d')]);}_0x3de01e[_0x0e70('0x47')]=qs[_0x0e70('0x48')](_0x27c7d3['query']['sort']);_0x3de01e[_0x0e70('0x49')]=qs[_0x0e70('0x3f')](_[_0x0e70('0x4a')](_0x27c7d3['query'],_0x38d031[_0x0e70('0x3f')]),_0x5cdf1b);if(_0x27c7d3[_0x0e70('0x3d')][_0x0e70('0x4b')]){_0x3de01e[_0x0e70('0x49')]=_[_0x0e70('0x4c')](_0x3de01e[_0x0e70('0x49')],{'$or':_[_0x0e70('0x3c')](_0x5cdf1b,function(_0x4ed6ef){if(_0x4ed6ef['type']!=='VIRTUAL'){var _0x3ec43b={};_0x3ec43b[_0x4ed6ef[_0x0e70('0x36')]]={'$like':'%'+_0x27c7d3[_0x0e70('0x3d')][_0x0e70('0x4b')]+'%'};return _0x3ec43b;}})});}_0x3de01e=_[_0x0e70('0x4c')]({},_0x3de01e,_0x27c7d3[_0x0e70('0x4d')]);var _0x4e6426={'where':_0x3de01e[_0x0e70('0x49')]};return db[_0x0e70('0x38')][_0x0e70('0x2c')](_0x4e6426)['then'](function(_0xa140f){_0x2749c4[_0x0e70('0x2c')]=_0xa140f;if(_0x27c7d3['query'][_0x0e70('0x4e')]){_0x3de01e['include']=[{'all':!![]}];}return db[_0x0e70('0x38')][_0x0e70('0x4f')](_0x3de01e);})[_0x0e70('0x1c')](function(_0x2de857){_0x2749c4[_0x0e70('0x50')]=_0x2de857;return _0x2749c4;})[_0x0e70('0x1c')](respondWithFilteredResult(_0x3cdb61,_0x3de01e))[_0x0e70('0x26')](handleError(_0x3cdb61,null));};exports['show']=function(_0x442a69,_0x13fefd){var _0x516859={'raw':![],'where':{'id':_0x442a69[_0x0e70('0x51')]['id']}},_0x2232fe={};_0x2232fe['model']=_[_0x0e70('0x3e')](db[_0x0e70('0x38')]['rawAttributes']);_0x2232fe['query']=_['keys'](_0x442a69[_0x0e70('0x3d')]);_0x2232fe[_0x0e70('0x3f')]=_[_0x0e70('0x40')](_0x2232fe['model'],_0x2232fe[_0x0e70('0x3d')]);_0x516859[_0x0e70('0x41')]=_[_0x0e70('0x40')](_0x2232fe[_0x0e70('0x44')],qs[_0x0e70('0x42')](_0x442a69[_0x0e70('0x3d')][_0x0e70('0x42')]));_0x516859[_0x0e70('0x41')]=_0x516859['attributes'][_0x0e70('0x43')]?_0x516859['attributes']:_0x2232fe['model'];if(_0x442a69['query'][_0x0e70('0x4e')]){_0x516859[_0x0e70('0x52')]=[{'all':!![]}];}_0x516859=_[_0x0e70('0x4c')]({},_0x516859,_0x442a69['options']);return db[_0x0e70('0x38')][_0x0e70('0x53')](_0x516859)[_0x0e70('0x1c')](handleEntityNotFound(_0x13fefd,null))['then'](respondWithResult(_0x13fefd,null))[_0x0e70('0x26')](handleError(_0x13fefd,null));};exports['update']=function(_0x1dde5a,_0x19066b){if(_0x1dde5a[_0x0e70('0x54')]['id']){delete _0x1dde5a[_0x0e70('0x54')]['id'];}return db[_0x0e70('0x38')][_0x0e70('0x53')]({'where':{'id':_0x1dde5a[_0x0e70('0x51')]['id']}})[_0x0e70('0x1c')](handleEntityNotFound(_0x19066b,null))['then'](saveUpdates(_0x1dde5a[_0x0e70('0x54')],null))[_0x0e70('0x1c')](respondWithResult(_0x19066b,null))[_0x0e70('0x26')](handleError(_0x19066b,null));};exports[_0x0e70('0x55')]=function(_0x28267c,_0x11f64d,_0x30be7b){if(_0x28267c[_0x0e70('0x56')]&&_0x28267c[_0x0e70('0x56')][_0x0e70('0x57')]){_0x28267c[_0x0e70('0x54')][_0x0e70('0x58')]=_0x28267c['file'][_0x0e70('0x57')];}return db['Setting']['find']({'where':{'id':_0x28267c[_0x0e70('0x51')]['id']}})[_0x0e70('0x1c')](handleEntityNotFound(_0x11f64d,null))[_0x0e70('0x1c')](saveUpdates(_0x28267c[_0x0e70('0x54')],null))[_0x0e70('0x1c')](respondWithResult(_0x11f64d,null))[_0x0e70('0x26')](handleError(_0x11f64d,null));};exports[_0x0e70('0x59')]=function(_0x11a731,_0x50e177,_0x1887ad){if(_0x11a731[_0x0e70('0x56')]&&_0x11a731[_0x0e70('0x56')][_0x0e70('0x57')]){_0x11a731[_0x0e70('0x54')][_0x0e70('0x5a')]=_0x11a731[_0x0e70('0x56')][_0x0e70('0x57')];}return db[_0x0e70('0x38')][_0x0e70('0x53')]({'where':{'id':_0x11a731[_0x0e70('0x51')]['id']}})[_0x0e70('0x1c')](handleEntityNotFound(_0x50e177,null))[_0x0e70('0x1c')](saveUpdates(_0x11a731['body'],null))[_0x0e70('0x1c')](respondWithResult(_0x50e177,null))['catch'](handleError(_0x50e177,null));};var utilLicense=require(_0x0e70('0x18'));exports[_0x0e70('0x5b')]=function(_0xea036d,_0x450e5b,_0x20f3f1){var _0x38efb1=_0x0e70('0x5c');var _0x55f1ec={'custom':![]};return utilLicense['getLicense']()[_0x0e70('0x1c')](function(_0x4b9498){if(_0x4b9498){_0x55f1ec=_0x4b9498;}return db[_0x0e70('0x38')][_0x0e70('0x53')]({'where':{'id':_0xea036d[_0x0e70('0x51')]['id']},'attributes':[_0x0e70('0x58'),_0x0e70('0x5a'),_0x0e70('0x5d'),_0x0e70('0x5e'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x0e70('0x5f')],'raw':!![]});})[_0x0e70('0x1c')](handleEntityNotFound(_0x450e5b,null))[_0x0e70('0x1c')](function(_0xbdb2fa){if(_0xbdb2fa){var _0x47c7cc=_0xbdb2fa['logo']&&fs[_0x0e70('0x60')](path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x38efb1,_[_0x0e70('0x63')](_0xbdb2fa[_0x0e70('0x58')])))?path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x38efb1,_[_0x0e70('0x63')](_0xbdb2fa[_0x0e70('0x58')])):path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x38efb1,_[_0x0e70('0x63')](_0x0e70('0x64')));var _0x5dc13a=_0x0e70('0x65')+_['upperFirst'](_0x0e70('0x58'));if(_0xbdb2fa[_0x5dc13a]||!_0x55f1ec[_0x0e70('0x66')]){_0x47c7cc=path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x38efb1,_[_0x0e70('0x63')](_0x0e70('0x64')));}if(!fs[_0x0e70('0x60')](_0x47c7cc)){throw new db[(_0x0e70('0x67'))][(_0x0e70('0x68'))](_[_0x0e70('0x69')](_0x0e70('0x58'))+'\x20not\x20found');}return _0x450e5b[_0x0e70('0x6a')](_0x47c7cc);}})['catch'](handleError(_0x450e5b,null));};var utilLicense=require(_0x0e70('0x18'));exports[_0x0e70('0x6b')]=function(_0x81c329,_0x29a943,_0x568f2a){var _0x1589d8=_0x0e70('0x5c');var _0x439942={'custom':![]};return utilLicense[_0x0e70('0x6c')]()[_0x0e70('0x1c')](function(_0x451ac3){if(_0x451ac3){_0x439942=_0x451ac3;}return db['Setting'][_0x0e70('0x53')]({'where':{'id':_0x81c329['params']['id']},'attributes':[_0x0e70('0x58'),_0x0e70('0x5a'),_0x0e70('0x5d'),_0x0e70('0x5e'),_0x0e70('0x6d'),_0x0e70('0x6e'),_0x0e70('0x6f'),_0x0e70('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x29a943,null))[_0x0e70('0x1c')](function(_0x3f50c8){if(_0x3f50c8){var _0x391b8e=_0x3f50c8[_0x0e70('0x5a')]&&fs[_0x0e70('0x60')](path['join'](config['root'],_0x1589d8,_['toLower'](_0x3f50c8[_0x0e70('0x5a')])))?path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x1589d8,_[_0x0e70('0x63')](_0x3f50c8[_0x0e70('0x5a')])):path[_0x0e70('0x61')](config['root'],_0x1589d8,_[_0x0e70('0x63')]('default_loginLogo.svg'));var _0x553646=_0x0e70('0x65')+_[_0x0e70('0x69')](_0x0e70('0x5a'));if(_0x3f50c8[_0x553646]||!_0x439942['custom']){_0x391b8e=path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x1589d8,_[_0x0e70('0x63')](_0x0e70('0x70')));}if(!fs[_0x0e70('0x60')](_0x391b8e)){throw new db[(_0x0e70('0x67'))]['ValidationError'](_[_0x0e70('0x69')](_0x0e70('0x5a'))+_0x0e70('0x71'));}return _0x29a943[_0x0e70('0x6a')](_0x391b8e);}})[_0x0e70('0x26')](handleError(_0x29a943,null));};exports[_0x0e70('0x72')]=function(_0x1c8f65,_0x3f3edd){return db[_0x0e70('0x38')]['find']({'where':{'id':_0x1c8f65['params']['id']},'attributes':['securePassword']})[_0x0e70('0x1c')](respondWithResult(_0x3f3edd,null))[_0x0e70('0x26')](handleError(_0x3f3edd,null));};exports[_0x0e70('0x73')]=function(_0x3e1dac,_0x1bcd0a,_0xc7acb7){if(_0x3e1dac['file']&&_0x3e1dac[_0x0e70('0x56')][_0x0e70('0x57')]){_0x3e1dac[_0x0e70('0x54')][_0x0e70('0x5d')]=_0x3e1dac[_0x0e70('0x56')][_0x0e70('0x57')];}return db['Setting'][_0x0e70('0x53')]({'where':{'id':_0x3e1dac[_0x0e70('0x51')]['id']}})['then'](handleEntityNotFound(_0x1bcd0a,null))[_0x0e70('0x1c')](saveUpdates(_0x3e1dac[_0x0e70('0x54')],null))[_0x0e70('0x1c')](respondWithResult(_0x1bcd0a,null))['catch'](handleError(_0x1bcd0a,null));};var utilLicense=require(_0x0e70('0x18'));exports['getPreferred']=function(_0x518b67,_0xf27332,_0x515b18){var _0x424ac3='server/files/images/logos';var _0x4e56d1={'custom':![]};return utilLicense[_0x0e70('0x6c')]()[_0x0e70('0x1c')](function(_0x1e7236){if(_0x1e7236){_0x4e56d1=_0x1e7236;}return db[_0x0e70('0x38')]['find']({'where':{'id':_0x518b67['params']['id']},'attributes':[_0x0e70('0x58'),_0x0e70('0x5a'),_0x0e70('0x5d'),_0x0e70('0x5e'),_0x0e70('0x6d'),_0x0e70('0x6e'),'defaultPreferred',_0x0e70('0x5f')],'raw':!![]});})[_0x0e70('0x1c')](handleEntityNotFound(_0xf27332,null))[_0x0e70('0x1c')](function(_0x1a0a8a){if(_0x1a0a8a){var _0x27b80e=_0x1a0a8a[_0x0e70('0x5d')]&&fs[_0x0e70('0x60')](path['join'](config['root'],_0x424ac3,_['toLower'](_0x1a0a8a['preferred'])))?path['join'](config[_0x0e70('0x62')],_0x424ac3,_[_0x0e70('0x63')](_0x1a0a8a[_0x0e70('0x5d')])):path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x424ac3,_[_0x0e70('0x63')]('default_preferred.png'));var _0x3c2805=_0x0e70('0x65')+_[_0x0e70('0x69')](_0x0e70('0x5d'));if(_0x1a0a8a[_0x3c2805]||!_0x4e56d1[_0x0e70('0x66')]||!_0x4e56d1[_0x0e70('0x5d')]){_0x27b80e=path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x424ac3,_[_0x0e70('0x63')](_0x0e70('0x74')));}if(!fs['existsSync'](_0x27b80e)){throw new db['Sequelize'][(_0x0e70('0x68'))](_[_0x0e70('0x69')](_0x0e70('0x5d'))+_0x0e70('0x71'));}return _0xf27332['download'](_0x27b80e);}})[_0x0e70('0x26')](handleError(_0xf27332,null));};exports[_0x0e70('0x75')]=function(_0x3a1ee5,_0x399b42,_0x32515c){if(_0x3a1ee5['file']&&_0x3a1ee5['file'][_0x0e70('0x57')]){_0x3a1ee5['body'][_0x0e70('0x5e')]=_0x3a1ee5['file'][_0x0e70('0x57')];}return db[_0x0e70('0x38')][_0x0e70('0x53')]({'where':{'id':_0x3a1ee5[_0x0e70('0x51')]['id']}})[_0x0e70('0x1c')](handleEntityNotFound(_0x399b42,null))[_0x0e70('0x1c')](saveUpdates(_0x3a1ee5['body'],null))[_0x0e70('0x1c')](respondWithResult(_0x399b42,null))[_0x0e70('0x26')](handleError(_0x399b42,null));};var utilLicense=require(_0x0e70('0x18'));exports['getFavicon']=function(_0x3905ca,_0x2dff14,_0x5dec0f){var _0x167be1=_0x0e70('0x5c');var _0x4767a8={'custom':![]};return utilLicense[_0x0e70('0x6c')]()[_0x0e70('0x1c')](function(_0x17e6a4){if(_0x17e6a4){_0x4767a8=_0x17e6a4;}return db[_0x0e70('0x38')][_0x0e70('0x53')]({'where':{'id':_0x3905ca[_0x0e70('0x51')]['id']},'attributes':[_0x0e70('0x58'),_0x0e70('0x5a'),_0x0e70('0x5d'),_0x0e70('0x5e'),_0x0e70('0x6d'),_0x0e70('0x6e'),_0x0e70('0x6f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x2dff14,null))[_0x0e70('0x1c')](function(_0x53bc0e){if(_0x53bc0e){var _0x3ba267=_0x53bc0e[_0x0e70('0x5e')]&&fs['existsSync'](path['join'](config['root'],_0x167be1,_['toLower'](_0x53bc0e[_0x0e70('0x5e')])))?path[_0x0e70('0x61')](config['root'],_0x167be1,_[_0x0e70('0x63')](_0x53bc0e['favicon'])):path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x167be1,_[_0x0e70('0x63')](_0x0e70('0x76')));var _0xdabffa=_0x0e70('0x65')+_[_0x0e70('0x69')](_0x0e70('0x5e'));if(_0x53bc0e[_0xdabffa]||!_0x4767a8[_0x0e70('0x66')]){_0x3ba267=path[_0x0e70('0x61')](config[_0x0e70('0x62')],_0x167be1,_['toLower'](_0x0e70('0x76')));}if(!fs[_0x0e70('0x60')](_0x3ba267)){throw new db[(_0x0e70('0x67'))][(_0x0e70('0x68'))](_[_0x0e70('0x69')](_0x0e70('0x5e'))+'\x20not\x20found');}return _0x2dff14[_0x0e70('0x6a')](_0x3ba267);}})[_0x0e70('0x26')](handleError(_0x2dff14,null));};exports['getDate']=function(_0x1eeb7b,_0x5e9589){var _0x5a11ee={'offset':moment()[_0x0e70('0x77')]()};_0x5a11ee['now']=moment()[_0x0e70('0x77')](_0x5a11ee[_0x0e70('0x2d')])[_0x0e70('0x78')](_0x0e70('0x79'));return _0x5e9589[_0x0e70('0x27')](0xc8)[_0x0e70('0x37')](_0x5a11ee);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 1593d3f..3457abd 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x12ebb4,_0x5593e2){var _0x343951=function(_0x2f7732){while(--_0x2f7732){_0x12ebb4['push'](_0x12ebb4['shift']());}};_0x343951(++_0x5593e2);}(_0x34e8,0x12c));var _0x834e=function(_0x499914,_0x4864c7){_0x499914=_0x499914-0x0;var _0x37db53=_0x34e8[_0x499914];return _0x37db53;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index fc1e7d0..07347e9 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 _0xc25c=['map','model','attributes','ShowSetting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','find','options','raw','where','include'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xc25c,0xfc));var _0xcc25=function(_0x30c221,_0x31ec55){_0x30c221=_0x30c221-0x0;var _0x581b70=_0xc25c[_0x30c221];return _0x581b70;};'use strict';var _=require('lodash');var util=require(_0xcc25('0x0'));var moment=require(_0xcc25('0x1'));var BPromise=require(_0xcc25('0x2'));var rs=require(_0xcc25('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc25('0x4'))['db'];var utils=require(_0xcc25('0x5'));var logger=require(_0xcc25('0x6'))('rpc');var config=require(_0xcc25('0x7'));var jayson=require(_0xcc25('0x8'));var client=jayson[_0xcc25('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xba4996,_0x35faae,_0x51b0f9){return new BPromise(function(_0x2faf1f,_0x487bd4){return client[_0xcc25('0xa')](_0xba4996,_0x51b0f9)[_0xcc25('0xb')](function(_0x556833){logger['info'](_0xcc25('0xc'),_0x35faae,_0xcc25('0xd'));logger['debug'](_0xcc25('0xe'),_0x35faae,_0xcc25('0xd'),JSON[_0xcc25('0xf')](_0x556833));if(_0x556833['error']){if(_0x556833[_0xcc25('0x10')][_0xcc25('0x11')]===0x1f4){logger[_0xcc25('0x10')](_0xcc25('0xc'),_0x35faae,_0x556833[_0xcc25('0x10')]['message']);return _0x487bd4(_0x556833[_0xcc25('0x10')]['message']);}logger[_0xcc25('0x10')](_0xcc25('0xc'),_0x35faae,_0x556833[_0xcc25('0x10')][_0xcc25('0x12')]);return _0x2faf1f(_0x556833[_0xcc25('0x10')][_0xcc25('0x12')]);}else{logger[_0xcc25('0x13')](_0xcc25('0xc'),_0x35faae,_0xcc25('0xd'));_0x2faf1f(_0x556833[_0xcc25('0x14')][_0xcc25('0x12')]);}})[_0xcc25('0x15')](function(_0x44567a){logger[_0xcc25('0x10')]('Setting,\x20%s,\x20%s',_0x35faae,_0x44567a);_0x487bd4(_0x44567a);});});}exports['ShowSetting']=function(_0x455220){var _0x3350d7=this;return new Promise(function(_0x1f5315,_0x19be69){return db['Setting'][_0xcc25('0x16')]({'raw':_0x455220[_0xcc25('0x17')]?_0x455220[_0xcc25('0x17')][_0xcc25('0x18')]===undefined?!![]:![]:!![],'where':_0x455220[_0xcc25('0x17')]?_0x455220['options'][_0xcc25('0x19')]||null:null,'attributes':_0x455220['options']?_0x455220[_0xcc25('0x17')]['attributes']||null:null,'include':_0x455220[_0xcc25('0x17')]?_0x455220[_0xcc25('0x17')][_0xcc25('0x1a')]?_[_0xcc25('0x1b')](_0x455220['options']['include'],function(_0x2f1bfa){return{'model':db[_0x2f1bfa[_0xcc25('0x1c')]],'as':_0x2f1bfa['as'],'attributes':_0x2f1bfa[_0xcc25('0x1d')],'include':_0x2f1bfa[_0xcc25('0x1a')]?_[_0xcc25('0x1b')](_0x2f1bfa[_0xcc25('0x1a')],function(_0x3b9f31){return{'model':db[_0x3b9f31[_0xcc25('0x1c')]],'as':_0x3b9f31['as'],'attributes':_0x3b9f31[_0xcc25('0x1d')],'include':_0x3b9f31[_0xcc25('0x1a')]?_[_0xcc25('0x1b')](_0x3b9f31['include'],function(_0x133566){return{'model':db[_0x133566[_0xcc25('0x1c')]],'as':_0x133566['as'],'attributes':_0x133566[_0xcc25('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x76a75c){logger[_0xcc25('0x13')]('ShowSetting',_0x455220);logger['debug'](_0xcc25('0x1e'),_0x455220,JSON[_0xcc25('0xf')](_0x76a75c));_0x1f5315(_0x76a75c);})[_0xcc25('0x15')](function(_0xaa915d){logger[_0xcc25('0x10')](_0xcc25('0x1e'),_0xaa915d['message'],_0x455220);_0x19be69(_0x3350d7[_0xcc25('0x10')](0x1f4,_0xaa915d[_0xcc25('0x12')]));});});}; \ No newline at end of file +var _0x5ccb=['stringify','error','code','message','catch','ShowSetting','Setting','find','options','where','attributes','include','map','model','lodash','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x1d765b,_0x4c631f){var _0x41db51=function(_0x5a56c6){while(--_0x5a56c6){_0x1d765b['push'](_0x1d765b['shift']());}};_0x41db51(++_0x4c631f);}(_0x5ccb,0x65));var _0xb5cc=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x5ccb[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0xb5cc('0x0'));var util=require(_0xb5cc('0x1'));var moment=require(_0xb5cc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5cc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5cc('0x4'))(_0xb5cc('0x5'));var config=require('../../config/environment');var jayson=require(_0xb5cc('0x6'));var client=jayson['client'][_0xb5cc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x347573,_0xc8284d,_0x4c9ac9){return new BPromise(function(_0x3e0e22,_0x2151bf){return client[_0xb5cc('0x8')](_0x347573,_0x4c9ac9)[_0xb5cc('0x9')](function(_0x311095){logger[_0xb5cc('0xa')](_0xb5cc('0xb'),_0xc8284d,_0xb5cc('0xc'));logger[_0xb5cc('0xd')](_0xb5cc('0xe'),_0xc8284d,_0xb5cc('0xc'),JSON[_0xb5cc('0xf')](_0x311095));if(_0x311095['error']){if(_0x311095[_0xb5cc('0x10')][_0xb5cc('0x11')]===0x1f4){logger[_0xb5cc('0x10')]('Setting,\x20%s,\x20%s',_0xc8284d,_0x311095[_0xb5cc('0x10')][_0xb5cc('0x12')]);return _0x2151bf(_0x311095['error'][_0xb5cc('0x12')]);}logger[_0xb5cc('0x10')](_0xb5cc('0xb'),_0xc8284d,_0x311095['error'][_0xb5cc('0x12')]);return _0x3e0e22(_0x311095['error'][_0xb5cc('0x12')]);}else{logger['info'](_0xb5cc('0xb'),_0xc8284d,_0xb5cc('0xc'));_0x3e0e22(_0x311095['result'][_0xb5cc('0x12')]);}})[_0xb5cc('0x13')](function(_0x1dd398){logger[_0xb5cc('0x10')](_0xb5cc('0xb'),_0xc8284d,_0x1dd398);_0x2151bf(_0x1dd398);});});}exports[_0xb5cc('0x14')]=function(_0x46db74){var _0x27ac45=this;return new Promise(function(_0x263694,_0x4dcd2b){return db[_0xb5cc('0x15')][_0xb5cc('0x16')]({'raw':_0x46db74[_0xb5cc('0x17')]?_0x46db74[_0xb5cc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x46db74[_0xb5cc('0x17')]?_0x46db74['options'][_0xb5cc('0x18')]||null:null,'attributes':_0x46db74['options']?_0x46db74[_0xb5cc('0x17')][_0xb5cc('0x19')]||null:null,'include':_0x46db74['options']?_0x46db74[_0xb5cc('0x17')][_0xb5cc('0x1a')]?_[_0xb5cc('0x1b')](_0x46db74['options']['include'],function(_0x293baa){return{'model':db[_0x293baa[_0xb5cc('0x1c')]],'as':_0x293baa['as'],'attributes':_0x293baa[_0xb5cc('0x19')],'include':_0x293baa['include']?_[_0xb5cc('0x1b')](_0x293baa['include'],function(_0x28c5b5){return{'model':db[_0x28c5b5[_0xb5cc('0x1c')]],'as':_0x28c5b5['as'],'attributes':_0x28c5b5[_0xb5cc('0x19')],'include':_0x28c5b5[_0xb5cc('0x1a')]?_['map'](_0x28c5b5[_0xb5cc('0x1a')],function(_0xb741e5){return{'model':db[_0xb741e5['model']],'as':_0xb741e5['as'],'attributes':_0xb741e5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb5cc('0x9')](function(_0xaa001d){logger[_0xb5cc('0xa')](_0xb5cc('0x14'),_0x46db74);logger['debug'](_0xb5cc('0x14'),_0x46db74,JSON[_0xb5cc('0xf')](_0xaa001d));_0x263694(_0xaa001d);})[_0xb5cc('0x13')](function(_0x573ccf){logger[_0xb5cc('0x10')](_0xb5cc('0x14'),_0x573ccf[_0xb5cc('0x12')],_0x46db74);_0x4dcd2b(_0x27ac45[_0xb5cc('0x10')](0x1f4,_0x573ccf['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 07888ba..b13acbf 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x32e44f,_0x20542c){var _0x5d3ae8=function(_0x4311a4){while(--_0x4311a4){_0x32e44f['push'](_0x32e44f['shift']());}};_0x5d3ae8(++_0x20542c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x254d47,_0x50ae3b){var _0x377bd0=function(_0x3c31bb){while(--_0x3c31bb){_0x254d47['push'](_0x254d47['shift']());}};_0x377bd0(++_0x50ae3b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index dd2ffc3..77afc57 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 _0x2513=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue'];(function(_0x28ccdc,_0x40b0e6){var _0x3099ad=function(_0x38fe3b){while(--_0x38fe3b){_0x28ccdc['push'](_0x28ccdc['shift']());}};_0x3099ad(++_0x40b0e6);}(_0x2513,0xde));var _0x3251=function(_0x2c0aa0,_0x342ea4){_0x2c0aa0=_0x2c0aa0-0x0;var _0x192edb=_0x2513[_0x2c0aa0];return _0x192edb;};'use strict';var Sequelize=require(_0x3251('0x0'));var rs=require(_0x3251('0x1'));module[_0x3251('0x2')]={'name':{'type':Sequelize[_0x3251('0x3')],'unique':_0x3251('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x3251('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3251('0x3')],'defaultValue':function(){return rs[_0x3251('0x5')]();}},'phone':{'type':Sequelize[_0x3251('0x3')]},'type':{'type':Sequelize['ENUM'](_0x3251('0x6'),_0x3251('0x7'),_0x3251('0x8'),_0x3251('0x9'),_0x3251('0xa'),_0x3251('0xb'),_0x3251('0xc'),_0x3251('0xd'),_0x3251('0xe'),'intelepeer')},'accountSid':{'type':Sequelize[_0x3251('0x3')]},'authId':{'type':Sequelize[_0x3251('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x3251('0xf')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3251('0x3')]},'password':{'type':Sequelize[_0x3251('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x3251('0x3')]},'accountId':{'type':Sequelize[_0x3251('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3251('0x10');}},'notificationSound':{'type':Sequelize[_0x3251('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3251('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3251('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3251('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3251('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3251('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x3251('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3251('0x12')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3251('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x33a5d0){if(!_0x33a5d0)this[_0x3251('0x13')](_0x3251('0x14'),null);this['setDataValue'](_0x3251('0x15'),_0x33a5d0);}}}; \ No newline at end of file +var _0xd09c=['sequelize','randomstring','exports','STRING','name','generate','skebby','clicksend','plivo','bandwidth','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd09c,0x72));var _0xcd09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd09c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xcd09('0x0'));var rs=require(_0xcd09('0x1'));module[_0xcd09('0x2')]={'name':{'type':Sequelize[_0xcd09('0x3')],'unique':_0xcd09('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xcd09('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xcd09('0x3')],'defaultValue':function(){return rs[_0xcd09('0x5')]();}},'phone':{'type':Sequelize[_0xcd09('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0xcd09('0x6'),'connectel',_0xcd09('0x7'),_0xcd09('0x8'),'clickatell',_0xcd09('0x9'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0xcd09('0x3')]},'authId':{'type':Sequelize[_0xcd09('0x3')]},'authToken':{'type':Sequelize[_0xcd09('0x3')]},'smsMethod':{'type':Sequelize[_0xcd09('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0xcd09('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xcd09('0x3')]},'accountId':{'type':Sequelize[_0xcd09('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xcd09('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcd09('0xb')],'defaultValue':function(){return _0xcd09('0xc');}},'notificationSound':{'type':Sequelize[_0xcd09('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcd09('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcd09('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcd09('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd09('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcd09('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xcd09('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd09('0xe')],'comment':_0xcd09('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x500d82){if(!_0x500d82)this[_0xcd09('0x10')](_0xcd09('0x11'),null);this[_0xcd09('0x10')](_0xcd09('0x12'),_0x500d82);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 866a3b7..102ac0d 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 _0x3cfd=['updatedAt','CompanyId','ListId','mobile','twilio','from','From','skebby','sender','text','clicksend','messageId','message_id','plivo','Text','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','send','\x0a','addApplications','sequelize','READ_COMMITTED','findAndCountAll','finally','getInteractions','Owner','fullname','internal','Tag','Tags','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','status_code','groupName','DELIVERED','redif','inspect','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','state','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','client','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','findOne','SmsAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','orderBy','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt'];(function(_0x45a996,_0x5c6265){var _0x3c6073=function(_0x1d787d){while(--_0x1d787d){_0x45a996['push'](_0x45a996['shift']());}};_0x3c6073(++_0x5c6265);}(_0x3cfd,0x14c));var _0xd3cf=function(_0x62a295,_0x22e756){_0x62a295=_0x62a295-0x0;var _0xb1b3a6=_0x3cfd[_0x62a295];return _0xb1b3a6;};'use strict';var emlformat=require(_0xd3cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3cf('0x1'));var jsonpatch=require(_0xd3cf('0x2'));var rp=require(_0xd3cf('0x3'));var moment=require(_0xd3cf('0x4'));var BPromise=require(_0xd3cf('0x5'));var Mustache=require(_0xd3cf('0x6'));var util=require('util');var path=require(_0xd3cf('0x7'));var sox=require('sox');var csv=require(_0xd3cf('0x8'));var ejs=require(_0xd3cf('0x9'));var fs=require('fs');var fs_extra=require(_0xd3cf('0xa'));var _=require('lodash');var squel=require(_0xd3cf('0xb'));var crypto=require(_0xd3cf('0xc'));var jsforce=require(_0xd3cf('0xd'));var deskjs=require(_0xd3cf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd3cf('0xf'));var Papa=require(_0xd3cf('0x10'));var Redis=require(_0xd3cf('0x11'));var authService=require(_0xd3cf('0x12'));var qs=require(_0xd3cf('0x13'));var as=require(_0xd3cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3cf('0x15'))(_0xd3cf('0x16'));var utils=require(_0xd3cf('0x17'));var config=require(_0xd3cf('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd3cf('0x19'))['db'];config[_0xd3cf('0x1a')]=_[_0xd3cf('0x1b')](config[_0xd3cf('0x1a')],{'host':_0xd3cf('0x1c'),'port':0x18eb});var socket=require(_0xd3cf('0x1d'))(new Redis(config['redis']));require(_0xd3cf('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xd3cf('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x82b131,_0x1d5454,_0x2670c5,_0x1004ae){return new BPromise(function(_0x2fe191,_0x3504b4){var _0x319c16=_0x1004ae||client;return _0x319c16['request'](_0x82b131,_0x2670c5)['then'](function(_0x15a4d5){logger[_0xd3cf('0x20')](_0xd3cf('0x21'),_0x1d5454,_0xd3cf('0x22'));logger[_0xd3cf('0x23')](_0xd3cf('0x24'),_0x1d5454,_0xd3cf('0x22'),JSON[_0xd3cf('0x25')](_0x15a4d5));if(_0x15a4d5[_0xd3cf('0x26')]){if(_0x15a4d5[_0xd3cf('0x26')][_0xd3cf('0x27')]===0x1f4){logger[_0xd3cf('0x26')](_0xd3cf('0x21'),_0x1d5454,_0x15a4d5['error']['message']);return _0x3504b4(_0x15a4d5[_0xd3cf('0x26')][_0xd3cf('0x28')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x1d5454,_0x15a4d5[_0xd3cf('0x26')]['message']);return _0x2fe191(_0x15a4d5[_0xd3cf('0x26')][_0xd3cf('0x28')]);}else{logger[_0xd3cf('0x20')](_0xd3cf('0x21'),_0x1d5454,_0xd3cf('0x22'));_0x2fe191(_0x15a4d5[_0xd3cf('0x29')]['message']);}})['catch'](function(_0x2742af){logger['error'](_0xd3cf('0x21'),_0x1d5454,_0x2742af);_0x3504b4(_0x2742af);});});}function respondWithStatusCode(_0x23dabc,_0x5772a5){_0x5772a5=_0x5772a5||0xcc;return function(_0x5be34b){if(_0x5be34b){return _0x23dabc[_0xd3cf('0x2a')](_0x5772a5);}return _0x23dabc[_0xd3cf('0x2b')](_0x5772a5)[_0xd3cf('0x2c')]();};}function respondWithResult(_0x19d170,_0x489dc5){_0x489dc5=_0x489dc5||0xc8;return function(_0x4d4775){if(_0x4d4775){return _0x19d170[_0xd3cf('0x2b')](_0x489dc5)['json'](_0x4d4775);}};}function respondWithFilteredResult(_0x2ca12a,_0x397023){return function(_0x5703a4){if(_0x5703a4){var _0x559af3=typeof _0x397023['offset']===_0xd3cf('0x2d')&&typeof _0x397023[_0xd3cf('0x2e')]==='undefined';var _0x27f239=_0x5703a4['count'];var _0x291e3a=_0x559af3?0x0:_0x397023[_0xd3cf('0x2f')];var _0x20f646=_0x559af3?_0x5703a4[_0xd3cf('0x30')]:_0x397023[_0xd3cf('0x2f')]+_0x397023[_0xd3cf('0x2e')];var _0x41b200;if(_0x20f646>=_0x27f239){_0x20f646=_0x27f239;_0x41b200=0xc8;}else{_0x41b200=0xce;}_0x2ca12a['status'](_0x41b200);return _0x2ca12a[_0xd3cf('0x31')](_0xd3cf('0x32'),_0x291e3a+'-'+_0x20f646+'/'+_0x27f239)[_0xd3cf('0x33')](_0x5703a4);}return null;};}function patchUpdates(_0x1cacf2){return function(_0xb07d3e){try{jsonpatch[_0xd3cf('0x34')](_0xb07d3e,_0x1cacf2,!![]);}catch(_0x5e36bc){return BPromise[_0xd3cf('0x35')](_0x5e36bc);}return _0xb07d3e['save']();};}function saveUpdates(_0x58f305,_0x1ef7f7){return function(_0x458907){if(_0x458907){return _0x458907[_0xd3cf('0x36')](_0x58f305)[_0xd3cf('0x37')](function(_0x51347a){return _0x51347a;});}return null;};}function removeEntity(_0x318936,_0x4666c4){return function(_0x269c97){if(_0x269c97){return _0x269c97[_0xd3cf('0x38')]()['then'](function(){var _0x268ee3=_0x269c97[_0xd3cf('0x39')]({'plain':!![]});var _0x3062e3=_0xd3cf('0x3a');return db[_0xd3cf('0x3b')][_0xd3cf('0x38')]({'where':{'type':_0x3062e3,'resourceId':_0x268ee3['id']}})[_0xd3cf('0x37')](function(){return _0x269c97;});})[_0xd3cf('0x37')](function(){_0x318936[_0xd3cf('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c7950,_0x1bcbd8){return function(_0x218ebf){if(!_0x218ebf){_0x5c7950['sendStatus'](0x194);}return _0x218ebf;};}function handleError(_0x5205cf,_0x3bc8bd){_0x3bc8bd=_0x3bc8bd||0x1f4;return function(_0x12cde7){logger[_0xd3cf('0x26')](_0x12cde7[_0xd3cf('0x3c')]);if(_0x12cde7[_0xd3cf('0x3d')]){delete _0x12cde7['name'];}_0x5205cf[_0xd3cf('0x2b')](_0x3bc8bd)['send'](_0x12cde7);};}exports[_0xd3cf('0x3e')]=function(_0x37a20f,_0x3760cd){var _0x1a443f={'include':[{'model':db[_0xd3cf('0x3f')],'as':_0xd3cf('0x40')}]},_0x4e0f01={},_0x1eec1e={'count':0x0,'rows':[]};var _0x1d02ca=_['map'](db[_0xd3cf('0x41')][_0xd3cf('0x42')],function(_0x3d420c){return{'name':_0x3d420c[_0xd3cf('0x43')],'type':_0x3d420c[_0xd3cf('0x44')][_0xd3cf('0x45')]};});_0x4e0f01[_0xd3cf('0x46')]=_[_0xd3cf('0x47')](_0x1d02ca,_0xd3cf('0x3d'));_0x4e0f01[_0xd3cf('0x48')]=_[_0xd3cf('0x49')](_0x37a20f[_0xd3cf('0x48')]);_0x4e0f01[_0xd3cf('0x4a')]=_[_0xd3cf('0x4b')](_0x4e0f01[_0xd3cf('0x46')],_0x4e0f01[_0xd3cf('0x48')]);_0x1a443f[_0xd3cf('0x4c')]=_[_0xd3cf('0x4b')](_0x4e0f01['model'],qs[_0xd3cf('0x4d')](_0x37a20f[_0xd3cf('0x48')]['fields']));_0x1a443f[_0xd3cf('0x4c')]=_0x1a443f[_0xd3cf('0x4c')][_0xd3cf('0x4e')]?_0x1a443f[_0xd3cf('0x4c')]:_0x4e0f01[_0xd3cf('0x46')];if(!_0x37a20f['query'][_0xd3cf('0x4f')](_0xd3cf('0x50'))){_0x1a443f['limit']=qs[_0xd3cf('0x2e')](_0x37a20f[_0xd3cf('0x48')][_0xd3cf('0x2e')]);_0x1a443f['offset']=qs[_0xd3cf('0x2f')](_0x37a20f[_0xd3cf('0x48')][_0xd3cf('0x2f')]);}_0x1a443f[_0xd3cf('0x51')]=qs[_0xd3cf('0x52')](_0x37a20f[_0xd3cf('0x48')][_0xd3cf('0x52')]);_0x1a443f[_0xd3cf('0x53')]=qs[_0xd3cf('0x4a')](_[_0xd3cf('0x54')](_0x37a20f[_0xd3cf('0x48')],_0x4e0f01[_0xd3cf('0x4a')]),_0x1d02ca);if(_0x37a20f[_0xd3cf('0x48')]['filter']){_0x1a443f[_0xd3cf('0x53')]=_['merge'](_0x1a443f[_0xd3cf('0x53')],{'$or':_[_0xd3cf('0x47')](_0x1d02ca,function(_0x1e5fc1){if(_0x1e5fc1[_0xd3cf('0x44')]!==_0xd3cf('0x55')){var _0x1878fa={};_0x1878fa[_0x1e5fc1['name']]={'$like':'%'+_0x37a20f['query'][_0xd3cf('0x56')]+'%'};return _0x1878fa;}})});}_0x1a443f=_[_0xd3cf('0x57')]({},_0x1a443f,_0x37a20f[_0xd3cf('0x58')]);var _0x479e2b={'where':_0x1a443f['where']};return db[_0xd3cf('0x41')]['count'](_0x479e2b)[_0xd3cf('0x37')](function(_0x5eb5a3){_0x1eec1e['count']=_0x5eb5a3;if(_0x37a20f['query'][_0xd3cf('0x59')]){_0x1a443f[_0xd3cf('0x5a')]=[{'all':!![]}];}return db[_0xd3cf('0x41')][_0xd3cf('0x5b')](_0x1a443f);})[_0xd3cf('0x37')](function(_0x502c3d){_0x1eec1e['rows']=_0x502c3d;return _0x1eec1e;})[_0xd3cf('0x37')](respondWithFilteredResult(_0x3760cd,_0x1a443f))[_0xd3cf('0x5c')](handleError(_0x3760cd,null));};exports[_0xd3cf('0x5d')]=function(_0x26ce87,_0x5c2bba){var _0x5c6b8b={'raw':![],'where':{'id':_0x26ce87['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x27364c={};_0x27364c[_0xd3cf('0x46')]=_['keys'](db[_0xd3cf('0x41')][_0xd3cf('0x42')]);_0x27364c[_0xd3cf('0x48')]=_[_0xd3cf('0x49')](_0x26ce87[_0xd3cf('0x48')]);_0x27364c[_0xd3cf('0x4a')]=_[_0xd3cf('0x4b')](_0x27364c['model'],_0x27364c[_0xd3cf('0x48')]);_0x5c6b8b['attributes']=_[_0xd3cf('0x4b')](_0x27364c[_0xd3cf('0x46')],qs['fields'](_0x26ce87['query'][_0xd3cf('0x4d')]));_0x5c6b8b['attributes']=_0x5c6b8b[_0xd3cf('0x4c')][_0xd3cf('0x4e')]?_0x5c6b8b[_0xd3cf('0x4c')]:_0x27364c[_0xd3cf('0x46')];if(_0x26ce87[_0xd3cf('0x48')][_0xd3cf('0x59')]){_0x5c6b8b[_0xd3cf('0x5a')]=[{'all':!![]}];}_0x5c6b8b=_['merge']({},_0x5c6b8b,_0x26ce87[_0xd3cf('0x58')]);return db['SmsAccount'][_0xd3cf('0x5e')](_0x5c6b8b)['then'](handleEntityNotFound(_0x5c2bba,null))[_0xd3cf('0x37')](respondWithResult(_0x5c2bba,null))[_0xd3cf('0x5c')](handleError(_0x5c2bba,null));};exports[_0xd3cf('0x5f')]=function(_0x4dee48,_0x403dda){return db['SmsAccount'][_0xd3cf('0x5f')](_0x4dee48[_0xd3cf('0x60')],{})[_0xd3cf('0x37')](function(_0x3a45a5){var _0x262176=_0x4dee48[_0xd3cf('0x61')][_0xd3cf('0x39')]({'plain':!![]});if(!_0x262176)throw new Error(_0xd3cf('0x62'));if(_0x262176[_0xd3cf('0x63')]===_0xd3cf('0x61')){var _0x5c0de5=_0x3a45a5[_0xd3cf('0x39')]({'plain':!![]});var _0x5d64ac='SmsAccounts';return db['UserProfileSection'][_0xd3cf('0x5e')]({'where':{'name':_0x5d64ac,'userProfileId':_0x262176[_0xd3cf('0x64')]},'raw':!![]})[_0xd3cf('0x37')](function(_0x175187){if(_0x175187&&_0x175187[_0xd3cf('0x65')]===0x0){return db[_0xd3cf('0x3b')]['create']({'name':_0x5c0de5[_0xd3cf('0x3d')],'resourceId':_0x5c0de5['id'],'type':_0x175187[_0xd3cf('0x3d')],'sectionId':_0x175187['id']},{})[_0xd3cf('0x37')](function(){return _0x3a45a5;});}else{return _0x3a45a5;}})['catch'](function(_0x4c4dce){logger[_0xd3cf('0x26')](_0xd3cf('0x66'),_0x4c4dce);throw _0x4c4dce;});}return _0x3a45a5;})[_0xd3cf('0x37')](respondWithResult(_0x403dda,0xc9))['catch'](handleError(_0x403dda,null));};exports[_0xd3cf('0x36')]=function(_0x5323e6,_0x53ed99){if(_0x5323e6[_0xd3cf('0x60')]['id']){delete _0x5323e6[_0xd3cf('0x60')]['id'];}return db['SmsAccount'][_0xd3cf('0x5e')]({'where':{'id':_0x5323e6[_0xd3cf('0x67')]['id']},'include':[{'model':db[_0xd3cf('0x3f')],'as':'mandatoryDispositionPause'}]})[_0xd3cf('0x37')](handleEntityNotFound(_0x53ed99,null))['then'](saveUpdates(_0x5323e6[_0xd3cf('0x60')],null))[_0xd3cf('0x37')](respondWithResult(_0x53ed99,null))[_0xd3cf('0x5c')](handleError(_0x53ed99,null));};exports['destroy']=function(_0x3a97c6,_0x2e8faa){return db[_0xd3cf('0x41')][_0xd3cf('0x5e')]({'where':{'id':_0x3a97c6[_0xd3cf('0x67')]['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x2e8faa,null))['then'](removeEntity(_0x2e8faa,null))['catch'](handleError(_0x2e8faa,null));};exports[_0xd3cf('0x68')]=function(_0x346c76,_0xe4538){return db['SmsAccount'][_0xd3cf('0x68')]()[_0xd3cf('0x37')](respondWithResult(_0xe4538,null))[_0xd3cf('0x5c')](handleError(_0xe4538,null));};exports['addDisposition']=function(_0x2f20e4,_0x141c01,_0xea672a){if(_0x2f20e4[_0xd3cf('0x60')]['id']){delete _0x2f20e4[_0xd3cf('0x60')]['id'];}return db['SmsAccount'][_0xd3cf('0x5e')]({'where':{'id':_0x2f20e4['params']['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x141c01,null))['then'](function(_0x476c7f){if(_0x476c7f){_0x2f20e4[_0xd3cf('0x60')]['SmsAccountId']=_0x476c7f['id'];return db[_0xd3cf('0x69')][_0xd3cf('0x5f')](_0x2f20e4[_0xd3cf('0x60')]);}})['then'](respondWithResult(_0x141c01,null))[_0xd3cf('0x5c')](handleError(_0x141c01,null));};exports['getDispositions']=function(_0x8ff96b,_0x5ab7a0,_0x3d0839){var _0x3044ae={'raw':![],'where':{}};var _0x4ec232={};var _0x5e4b30={'count':0x0,'rows':[]};return db[_0xd3cf('0x41')][_0xd3cf('0x6a')]({'where':{'id':_0x8ff96b['params']['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x5ab7a0,null))[_0xd3cf('0x37')](function(_0x392b9d){if(_0x392b9d){_0x4ec232[_0xd3cf('0x46')]=_[_0xd3cf('0x49')](db['Disposition']['rawAttributes']);_0x4ec232[_0xd3cf('0x48')]=_['keys'](_0x8ff96b['query']);_0x4ec232[_0xd3cf('0x4a')]=_[_0xd3cf('0x4b')](_0x4ec232[_0xd3cf('0x46')],_0x4ec232[_0xd3cf('0x48')]);_0x3044ae[_0xd3cf('0x4c')]=_[_0xd3cf('0x4b')](_0x4ec232[_0xd3cf('0x46')],qs['fields'](_0x8ff96b['query'][_0xd3cf('0x4d')]));_0x3044ae[_0xd3cf('0x4c')]=_0x3044ae[_0xd3cf('0x4c')][_0xd3cf('0x4e')]?_0x3044ae[_0xd3cf('0x4c')]:_0x4ec232[_0xd3cf('0x46')];if(!_0x8ff96b[_0xd3cf('0x48')][_0xd3cf('0x4f')]('nolimit')){_0x3044ae['limit']=qs[_0xd3cf('0x2e')](_0x8ff96b[_0xd3cf('0x48')][_0xd3cf('0x2e')]);_0x3044ae[_0xd3cf('0x2f')]=qs[_0xd3cf('0x2f')](_0x8ff96b['query'][_0xd3cf('0x2f')]);}_0x3044ae[_0xd3cf('0x51')]=qs['sort'](_0x8ff96b['query']['sort']);_0x3044ae[_0xd3cf('0x53')]=qs['filters'](_[_0xd3cf('0x54')](_0x8ff96b[_0xd3cf('0x48')],_0x4ec232[_0xd3cf('0x4a')]));_0x3044ae['where'][_0xd3cf('0x6b')]=_0x392b9d['id'];if(_0x8ff96b[_0xd3cf('0x48')]['filter']){_0x3044ae['where']=_[_0xd3cf('0x57')](_0x3044ae[_0xd3cf('0x53')],{'$or':_[_0xd3cf('0x47')](_0x3044ae[_0xd3cf('0x4c')],function(_0x209940){var _0x3b0940={};_0x3b0940[_0x209940]={'$like':'%'+_0x8ff96b[_0xd3cf('0x48')][_0xd3cf('0x56')]+'%'};return _0x3b0940;})});}_0x3044ae=_[_0xd3cf('0x57')]({},_0x3044ae,_0x8ff96b['options']);return db[_0xd3cf('0x69')]['count']({'where':_0x3044ae['where']})['then'](function(_0x256e9a){_0x5e4b30[_0xd3cf('0x30')]=_0x256e9a;if(_0x8ff96b['query']['includeAll']){_0x3044ae[_0xd3cf('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0xd3cf('0x5b')](_0x3044ae);})[_0xd3cf('0x37')](function(_0x4602ec){_0x5e4b30[_0xd3cf('0x6c')]=_0x4602ec;return _0x5e4b30;});}})[_0xd3cf('0x37')](respondWithFilteredResult(_0x5ab7a0,_0x3044ae))['catch'](handleError(_0x5ab7a0,null));};exports[_0xd3cf('0x6d')]=function(_0x5b9bcd,_0x3befca,_0x59c22e){return db['SmsAccount'][_0xd3cf('0x5e')]({'where':{'id':_0x5b9bcd[_0xd3cf('0x67')]['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x3befca,null))[_0xd3cf('0x37')](function(_0x5967ec){if(_0x5967ec){return _0x5967ec['removeDispositions'](_0x5b9bcd[_0xd3cf('0x48')][_0xd3cf('0x6e')]);}})[_0xd3cf('0x37')](respondWithStatusCode(_0x3befca,null))[_0xd3cf('0x5c')](handleError(_0x3befca,null));};exports[_0xd3cf('0x6f')]=function(_0x3a0067,_0x227a15,_0x31998f){if(_0x3a0067[_0xd3cf('0x60')]['id']){delete _0x3a0067[_0xd3cf('0x60')]['id'];}return db[_0xd3cf('0x41')][_0xd3cf('0x5e')]({'where':{'id':_0x3a0067[_0xd3cf('0x67')]['id']}})['then'](handleEntityNotFound(_0x227a15,null))['then'](function(_0x265748){if(_0x265748){_0x3a0067['body']['SmsAccountId']=_0x265748['id'];return db[_0xd3cf('0x70')][_0xd3cf('0x5f')](_0x3a0067[_0xd3cf('0x60')]);}})[_0xd3cf('0x37')](respondWithResult(_0x227a15,null))[_0xd3cf('0x5c')](handleError(_0x227a15,null));};exports[_0xd3cf('0x71')]=function(_0x1dfedd,_0x44f6c4,_0x2b2721){var _0x1292c4={'raw':![],'where':{}};var _0x2d7a63={};var _0x131f61={'count':0x0,'rows':[]};return db[_0xd3cf('0x41')]['findOne']({'where':{'id':_0x1dfedd[_0xd3cf('0x67')]['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x44f6c4,null))[_0xd3cf('0x37')](function(_0x3eb679){if(_0x3eb679){_0x2d7a63[_0xd3cf('0x46')]=_[_0xd3cf('0x49')](db['CannedAnswer'][_0xd3cf('0x42')]);_0x2d7a63[_0xd3cf('0x48')]=_[_0xd3cf('0x49')](_0x1dfedd[_0xd3cf('0x48')]);_0x2d7a63['filters']=_[_0xd3cf('0x4b')](_0x2d7a63[_0xd3cf('0x46')],_0x2d7a63['query']);_0x1292c4[_0xd3cf('0x4c')]=_[_0xd3cf('0x4b')](_0x2d7a63['model'],qs[_0xd3cf('0x4d')](_0x1dfedd[_0xd3cf('0x48')]['fields']));_0x1292c4[_0xd3cf('0x4c')]=_0x1292c4[_0xd3cf('0x4c')]['length']?_0x1292c4['attributes']:_0x2d7a63[_0xd3cf('0x46')];if(!_0x1dfedd[_0xd3cf('0x48')][_0xd3cf('0x4f')](_0xd3cf('0x50'))){_0x1292c4['limit']=qs[_0xd3cf('0x2e')](_0x1dfedd[_0xd3cf('0x48')][_0xd3cf('0x2e')]);_0x1292c4[_0xd3cf('0x2f')]=qs[_0xd3cf('0x2f')](_0x1dfedd['query'][_0xd3cf('0x2f')]);}_0x1292c4[_0xd3cf('0x51')]=qs[_0xd3cf('0x52')](_0x1dfedd['query'][_0xd3cf('0x52')]);_0x1292c4[_0xd3cf('0x53')]=qs[_0xd3cf('0x4a')](_[_0xd3cf('0x54')](_0x1dfedd[_0xd3cf('0x48')],_0x2d7a63['filters']));_0x1292c4[_0xd3cf('0x53')]['SmsAccountId']=_0x3eb679['id'];if(_0x1dfedd['query'][_0xd3cf('0x56')]){_0x1292c4[_0xd3cf('0x53')]=_[_0xd3cf('0x57')](_0x1292c4[_0xd3cf('0x53')],{'$or':_[_0xd3cf('0x47')](_0x1292c4[_0xd3cf('0x4c')],function(_0x245a7d){var _0x590952={};_0x590952[_0x245a7d]={'$like':'%'+_0x1dfedd[_0xd3cf('0x48')]['filter']+'%'};return _0x590952;})});}_0x1292c4=_['merge']({},_0x1292c4,_0x1dfedd[_0xd3cf('0x58')]);return db[_0xd3cf('0x70')]['count']({'where':_0x1292c4['where']})[_0xd3cf('0x37')](function(_0x4fc34c){_0x131f61[_0xd3cf('0x30')]=_0x4fc34c;if(_0x1dfedd[_0xd3cf('0x48')]['includeAll']){_0x1292c4[_0xd3cf('0x5a')]=[{'all':!![]}];}return db[_0xd3cf('0x70')][_0xd3cf('0x5b')](_0x1292c4);})[_0xd3cf('0x37')](function(_0x558e5e){_0x131f61[_0xd3cf('0x6c')]=_0x558e5e;return _0x131f61;});}})[_0xd3cf('0x37')](respondWithFilteredResult(_0x44f6c4,_0x1292c4))[_0xd3cf('0x5c')](handleError(_0x44f6c4,null));};exports[_0xd3cf('0x72')]=function(_0x233a45,_0x189c1a,_0x13378f){return db[_0xd3cf('0x41')][_0xd3cf('0x5e')]({'where':{'id':_0x233a45[_0xd3cf('0x67')]['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x189c1a,null))['then'](function(_0x2258b8){if(_0x2258b8){return _0x2258b8[_0xd3cf('0x72')](_0x233a45['query'][_0xd3cf('0x6e')]);}})[_0xd3cf('0x37')](respondWithStatusCode(_0x189c1a,null))[_0xd3cf('0x5c')](handleError(_0x189c1a,null));};exports['notify']=function(_0x3c8b86,_0x3a723a,_0x1ff767){var _0xee0117={'channel':_0xd3cf('0x73')};var _0xcff9fe=[];var _0x475bfc=[];var _0x30ebc3={};return db['SmsAccount']['find']({'where':{'id':_0x3c8b86['params']['id']},'include':[{'model':db[_0xd3cf('0x74')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x3a723a,null))['then'](function(_0x5bc9a6){_0xee0117['account']=_0x5bc9a6;_0xee0117['applications']=_[_0xd3cf('0x75')](_0x5bc9a6[_0xd3cf('0x76')],[_0xd3cf('0x77')],[_0xd3cf('0x78')]);if(_0xee0117[_0xd3cf('0x79')][_0xd3cf('0x76')]){delete _0xee0117[_0xd3cf('0x79')]['Applications'];}return db[_0xd3cf('0x7a')][_0xd3cf('0x68')]();})[_0xd3cf('0x37')](function(_0x33eb11){if(!_0x33eb11){throw new db[(_0xd3cf('0x7b'))][(_0xd3cf('0x7c'))](_0xd3cf('0x7d'));}_0xcff9fe=_[_0xd3cf('0x7e')](_[_0xd3cf('0x49')](_0x33eb11),[_0xd3cf('0x7f'),_0xd3cf('0x80')]);_0x475bfc=_[_0xd3cf('0x7e')](_[_0xd3cf('0x49')](_0x33eb11),['createdAt',_0xd3cf('0x80'),_0xd3cf('0x81'),_0xd3cf('0x82')]);_0xee0117[_0xd3cf('0x60')]={'mapKey':_0xd3cf('0x83')};if(_0xee0117[_0xd3cf('0x79')][_0xd3cf('0x44')]){switch(_0xee0117[_0xd3cf('0x79')][_0xd3cf('0x44')]){case _0xd3cf('0x84'):_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')]=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x86')];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x60')]=_0x3c8b86[_0xd3cf('0x60')]['Body'];_0xee0117['body']['messageId']=_0x3c8b86[_0xd3cf('0x60')]['MessageSid'];break;case _0xd3cf('0x87'):_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')]='+'+_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x88')];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x60')]=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x89')];break;case'connectel':_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')]=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x85')];_0xee0117[_0xd3cf('0x60')]['body']=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x28')];break;case _0xd3cf('0x8a'):_0xee0117[_0xd3cf('0x60')]['from']=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x85')];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x60')]=_0x3c8b86['body']['body'];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x8b')]=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x8c')];break;case _0xd3cf('0x8d'):_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')]=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x86')];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x60')]=_0x3c8b86['body'][_0xd3cf('0x8e')];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x8b')]=_0x3c8b86[_0xd3cf('0x60')]['MessageUUID'];break;case _0xd3cf('0x8f'):_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')]='+'+_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x90')][0x0][_0xd3cf('0x85')];_0xee0117['body'][_0xd3cf('0x60')]=_0x3c8b86['body'][_0xd3cf('0x90')][0x0]['text'];_0xee0117[_0xd3cf('0x60')]['messageId']=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x90')][0x0][_0xd3cf('0x8b')];break;case'csc':_0xee0117[_0xd3cf('0x60')]['from']=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x91')];_0xee0117[_0xd3cf('0x60')]['body']=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x92')][_0xd3cf('0x28')];break;case _0xd3cf('0x93'):_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')]=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x94')];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x60')]=_0x3c8b86['body'][_0xd3cf('0x89')];_0xee0117[_0xd3cf('0x60')]['messageId']=_0x3c8b86['body'][_0xd3cf('0x95')];break;case _0xd3cf('0x96'):_0xee0117[_0xd3cf('0x60')]['messageId']=_0x3c8b86['body'][0x0]['message']['id'];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')]=_0x3c8b86[_0xd3cf('0x60')][0x0][_0xd3cf('0x28')]['from'];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x60')]=_0x3c8b86['body'][0x0][_0xd3cf('0x28')][_0xd3cf('0x89')];break;case _0xd3cf('0x97'):_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')]=_0x3c8b86[_0xd3cf('0x60')]['from'];_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x60')]=_0x3c8b86['body'][_0xd3cf('0x28')];_0xee0117['body']['messageId']=_0x3c8b86[_0xd3cf('0x60')][_0xd3cf('0x98')];break;}}if(_0xee0117[_0xd3cf('0x60')]['id']){delete _0xee0117[_0xd3cf('0x60')]['id'];}if(_[_0xd3cf('0x99')](_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0xd3cf('0x99')](_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x60')])||_0xee0117[_0xd3cf('0x60')]['body']===''){throw new db[(_0xd3cf('0x7b'))][(_0xd3cf('0x7c'))](_0xd3cf('0x9a'));}if(_[_0xd3cf('0x99')](_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x9b')])){throw new db[(_0xd3cf('0x7b'))][(_0xd3cf('0x7c'))](_0xd3cf('0x9c')+_0x475bfc);}if(!_[_0xd3cf('0x9d')](_0x475bfc,_0xee0117[_0xd3cf('0x60')]['mapKey'])){throw new db[(_0xd3cf('0x7b'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x475bfc);}_0x30ebc3[_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x9b')]]=_0xee0117['body'][_0xd3cf('0x85')];return db[_0xd3cf('0x9e')][_0xd3cf('0x5e')]({'where':{'id':_0xee0117['account'][_0xd3cf('0x82')]},'include':[{'model':db['CmContact'],'as':_0xd3cf('0x9f'),'where':_0x30ebc3,'limit':0x1,'order':[[_0xd3cf('0x80'),_0xd3cf('0xa0')]]}]});})[_0xd3cf('0x37')](handleEntityNotFound(_0x3a723a,null))[_0xd3cf('0x37')](function(_0x57ffcd){if(_0x57ffcd){_0xee0117['list']=_[_0xd3cf('0xa1')](_0x57ffcd,[_0xd3cf('0x9f')]);if(_0x57ffcd[_0xd3cf('0x9f')][_0xd3cf('0x4e')]){return _0x57ffcd[_0xd3cf('0x9f')][0x0];}var _0x199096=_['defaults'](_0xee0117[_0xd3cf('0x60')],{'firstName':_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x85')],'ListId':_0x57ffcd['id']});_0x199096[_0xee0117['body'][_0xd3cf('0x9b')]]=_0xee0117['body'][_0xd3cf('0x85')];return db[_0xd3cf('0x7a')][_0xd3cf('0x5f')](_0x199096,{'fields':_0xcff9fe,'raw':!![]});}})[_0xd3cf('0x37')](handleEntityNotFound(_0x3a723a,null))[_0xd3cf('0x37')](function(_0x9d509f){if(_0x9d509f){_0xee0117[_0xd3cf('0xa2')]=_0x9d509f;var _0xd3b0cf={'ContactId':_0x9d509f['id'],'phone':_0xee0117['body'][_0xd3cf('0x85')],'SmsAccountId':_0x3c8b86[_0xd3cf('0x67')]['id']};var _0x57f776={'ContactId':_0x9d509f['id'],'SmsAccountId':_0x3c8b86[_0xd3cf('0x67')]['id'],'closed':![]};return db[_0xd3cf('0xa3')]['find']({'where':_0x57f776})['then'](function(_0x3faf91){if(_0x3faf91){return[_0x3faf91,![]];}return db['SmsInteraction']['create'](_0xd3b0cf)['then'](function(_0x142848){return[_0x142848,!![]];});});}})[_0xd3cf('0xa4')](function(_0x9e3986,_0x2e36fb){_0xee0117[_0xd3cf('0xa5')]=_0x9e3986[_0xd3cf('0x39')]({'plain':!![]});_0xee0117['interaction'][_0xd3cf('0xa6')]=![];if(_0x2e36fb){if(_0xee0117[_0xd3cf('0x79')][_0xd3cf('0xa7')]){_0xee0117[_0xd3cf('0xa8')][_0xd3cf('0xa9')]({'id':0x0,'priority':_0xee0117[_0xd3cf('0xa8')][_0xd3cf('0x4e')]+0x1,'app':_0xd3cf('0xaa'),'appdata':_0xd3cf('0xab'),'interval':_0xd3cf('0xac')});}_0xee0117[_0xd3cf('0xa5')][_0xd3cf('0xa6')]=!![];}return db[_0xd3cf('0xad')][_0xd3cf('0x5f')]({'phone':_0xee0117[_0xd3cf('0x60')]['from'],'messageId':_0xee0117[_0xd3cf('0x60')][_0xd3cf('0x8b')],'body':_0xee0117['body']['body'],'SmsAccountId':_0x3c8b86['params']['id'],'SmsInteractionId':_0x9e3986['id'],'direction':'in','ContactId':_0x9e3986[_0xd3cf('0xae')],'AttachmentId':_0xee0117[_0xd3cf('0x60')][_0xd3cf('0xaf')]});})[_0xd3cf('0x37')](function(_0x2cc64e){_0xee0117[_0xd3cf('0x28')]=_0x2cc64e;if(!_0xee0117['interaction'][_0xd3cf('0xb0')])return;return db[_0xd3cf('0xb1')][_0xd3cf('0x5e')]({'attributes':['id',_0xd3cf('0x3d')],'where':{'id':_0xee0117[_0xd3cf('0xa5')][_0xd3cf('0xb0')]}});})['then'](function(_0x5eef62){if(_0x5eef62){_0xee0117[_0xd3cf('0xa8')][_0xd3cf('0xb2')]({'id':0x0,'priority':0x0,'app':_0xd3cf('0xb3'),'appdata':_0x5eef62[_0xd3cf('0x3d')]+','+(_0xee0117['account'][_0xd3cf('0xb4')]||0xa),'interval':_0xd3cf('0xac')});}if(!_0xee0117[_0xd3cf('0xa5')][_0xd3cf('0xb5')])return;return db[_0xd3cf('0xb6')][_0xd3cf('0x5e')]({'attributes':['id',_0xd3cf('0x3d')],'where':{'id':_0xee0117[_0xd3cf('0xa5')]['queueId']}});})[_0xd3cf('0x37')](function(_0x3961e6){if(_0x3961e6){_0xee0117[_0xd3cf('0xa8')][_0xd3cf('0xb2')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3961e6[_0xd3cf('0x3d')]+','+(_0xee0117['account'][_0xd3cf('0xb7')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd3cf('0xb8'),_0xd3cf('0xb9'),_0xee0117);})['then'](function(_0x1361ac){if(_0x1361ac){var _0xdca611=0xc8;var _0x40a4ab=_0xd3cf('0xba');logger[_0xd3cf('0x20')](_0xd3cf('0x24'),_0x40a4ab,_0xdca611,'entity\x20found');logger['debug'](_0xd3cf('0xbb'),_0x40a4ab,_0xdca611,'entity\x20found',JSON[_0xd3cf('0x25')](_0x1361ac));if(_0xee0117[_0xd3cf('0x79')]['type']===_0xd3cf('0x84')){return _0x3a723a['status'](_0xdca611)[_0xd3cf('0x31')]('Content-Type',_0xd3cf('0xbc'))[_0xd3cf('0xbd')](_0xd3cf('0xbe'));}else{return _0x3a723a['status'](_0xdca611)[_0xd3cf('0x33')](_0x1361ac);}}})[_0xd3cf('0x5c')](handleError(_0x3a723a,null));};exports[_0xd3cf('0xbf')]=function(_0x4af58a,_0x2e8fa2){var _0x33751a=_0x4af58a[_0xd3cf('0x67')]['id'];var _0x2e9f71=_0x4af58a['body'];var _0x50b560=0xc8;var _0x44879a=null;return db[_0xd3cf('0xc0')]['transaction']({'isolationLevel':db[_0xd3cf('0xc0')]['Transaction']['ISOLATION_LEVELS'][_0xd3cf('0xc1')]},function(_0x1a2a84){return db[_0xd3cf('0x41')][_0xd3cf('0x6a')]({'where':{'id':_0x33751a},'transaction':_0x1a2a84})[_0xd3cf('0x37')](function(_0x405d87){if(_0x405d87){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x33751a},'transaction':_0x1a2a84})['then'](function(){var _0x57fd6a=_['map'](_0x2e9f71,function(_0x4467fa){_0x4467fa['SmsAccountId']=_0x33751a;return _0x4467fa;});return db[_0xd3cf('0x74')]['bulkCreate'](_0x57fd6a,{'transaction':_0x1a2a84});});}else{_0x50b560=0x194;_0x44879a=[];}});})[_0xd3cf('0x37')](function(){if(_0x50b560!==0x194){return db['SmsApplication'][_0xd3cf('0xc2')]({'where':{'SmsAccountId':_0x33751a},'order':_0xd3cf('0x77')})[_0xd3cf('0x37')](function(_0x588ce6){_0x44879a=_0x588ce6;});}})[_0xd3cf('0x5c')](function(_0x1e8c66){_0x50b560=0x1f4;logger[_0xd3cf('0x26')](_0x1e8c66[_0xd3cf('0x3c')]);if(_0x1e8c66[_0xd3cf('0x3d')]){delete _0x1e8c66['name'];}_0x44879a=_0x1e8c66;})[_0xd3cf('0xc3')](function(){if(_0x44879a===null){_0x2e8fa2[_0xd3cf('0x2a')](_0x50b560);}else{if(_0x50b560===0x1f4){_0x2e8fa2[_0xd3cf('0x2b')](_0x50b560)[_0xd3cf('0xbd')](_0x44879a);}else{_0x2e8fa2[_0xd3cf('0x2b')](_0x50b560)[_0xd3cf('0x33')](_0x44879a);}}});};exports['getApplications']=function(_0x5217c7,_0x52a48b,_0x37761e){var _0xdf63b9={};var _0x31145a={};var _0x5ddbe5;var _0x54013b;return db[_0xd3cf('0x41')][_0xd3cf('0x6a')]({'where':{'id':_0x5217c7[_0xd3cf('0x67')]['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x52a48b,null))[_0xd3cf('0x37')](function(_0x3da099){if(_0x3da099){_0x5ddbe5=_0x3da099;_0x31145a['model']=_[_0xd3cf('0x49')](db[_0xd3cf('0x74')][_0xd3cf('0x42')]);_0x31145a[_0xd3cf('0x48')]=_[_0xd3cf('0x49')](_0x5217c7[_0xd3cf('0x48')]);_0x31145a[_0xd3cf('0x4a')]=_['intersection'](_0x31145a[_0xd3cf('0x46')],_0x31145a['query']);_0xdf63b9['attributes']=_[_0xd3cf('0x4b')](_0x31145a['model'],qs['fields'](_0x5217c7[_0xd3cf('0x48')][_0xd3cf('0x4d')]));_0xdf63b9['attributes']=_0xdf63b9[_0xd3cf('0x4c')][_0xd3cf('0x4e')]?_0xdf63b9[_0xd3cf('0x4c')]:_0x31145a[_0xd3cf('0x46')];_0xdf63b9[_0xd3cf('0x51')]=qs[_0xd3cf('0x52')](_0x5217c7['query'][_0xd3cf('0x52')]);_0xdf63b9[_0xd3cf('0x53')]=qs[_0xd3cf('0x4a')](_[_0xd3cf('0x54')](_0x5217c7[_0xd3cf('0x48')],_0x31145a[_0xd3cf('0x4a')]));if(_0x5217c7[_0xd3cf('0x48')]['filter']){_0xdf63b9[_0xd3cf('0x53')]=_[_0xd3cf('0x57')](_0xdf63b9[_0xd3cf('0x53')],{'$or':_['map'](_0xdf63b9[_0xd3cf('0x4c')],function(_0x394731){var _0x17dfc8={};_0x17dfc8[_0x394731]={'$like':'%'+_0x5217c7[_0xd3cf('0x48')][_0xd3cf('0x56')]+'%'};return _0x17dfc8;})});}_0xdf63b9=_[_0xd3cf('0x57')]({},_0xdf63b9,_0x5217c7[_0xd3cf('0x58')]);return _0x5ddbe5['getApplications'](_0xdf63b9);}})[_0xd3cf('0x37')](function(_0x3e2d29){if(_0x3e2d29){_0x54013b=_0x3e2d29[_0xd3cf('0x4e')];if(!_0x5217c7[_0xd3cf('0x48')][_0xd3cf('0x4f')](_0xd3cf('0x50'))){_0xdf63b9[_0xd3cf('0x2e')]=qs['limit'](_0x5217c7[_0xd3cf('0x48')]['limit']);_0xdf63b9[_0xd3cf('0x2f')]=qs[_0xd3cf('0x2f')](_0x5217c7[_0xd3cf('0x48')]['offset']);}return _0x5ddbe5['getApplications'](_0xdf63b9);}})[_0xd3cf('0x37')](function(_0x594e1c){if(_0x594e1c){return _0x594e1c?{'count':_0x54013b,'rows':_0x594e1c}:null;}})[_0xd3cf('0x37')](respondWithResult(_0x52a48b,null))[_0xd3cf('0x5c')](handleError(_0x52a48b,null));};exports[_0xd3cf('0xc4')]=function(_0x39823f,_0x3abd0c,_0x15f1d3){var _0x3204a7={'raw':![],'where':{}};var _0x21df3d={};var _0x868025={'count':0x0,'rows':[]};return db[_0xd3cf('0x41')][_0xd3cf('0x6a')]({'where':{'id':_0x39823f['params']['id']}})['then'](handleEntityNotFound(_0x3abd0c,null))[_0xd3cf('0x37')](function(_0xdfac5e){if(_0xdfac5e){_0x21df3d[_0xd3cf('0x46')]=_[_0xd3cf('0x49')](db[_0xd3cf('0xa3')][_0xd3cf('0x42')]);_0x21df3d[_0xd3cf('0x48')]=_[_0xd3cf('0x49')](_0x39823f['query']);_0x21df3d['filters']=_[_0xd3cf('0x4b')](_0x21df3d[_0xd3cf('0x46')],_0x21df3d[_0xd3cf('0x48')]);_0x3204a7[_0xd3cf('0x4c')]=_[_0xd3cf('0x4b')](_0x21df3d[_0xd3cf('0x46')],qs[_0xd3cf('0x4d')](_0x39823f['query'][_0xd3cf('0x4d')]));_0x3204a7[_0xd3cf('0x4c')]=_0x3204a7[_0xd3cf('0x4c')][_0xd3cf('0x4e')]?_0x3204a7[_0xd3cf('0x4c')]:_0x21df3d[_0xd3cf('0x46')];if(!_0x39823f[_0xd3cf('0x48')]['hasOwnProperty']('nolimit')){_0x3204a7[_0xd3cf('0x2e')]=qs[_0xd3cf('0x2e')](_0x39823f['query'][_0xd3cf('0x2e')]);_0x3204a7['offset']=qs[_0xd3cf('0x2f')](_0x39823f[_0xd3cf('0x48')][_0xd3cf('0x2f')]);}_0x3204a7[_0xd3cf('0x51')]=qs[_0xd3cf('0x52')](_0x39823f[_0xd3cf('0x48')][_0xd3cf('0x52')]);_0x3204a7[_0xd3cf('0x53')]=qs['filters'](_[_0xd3cf('0x54')](_0x39823f[_0xd3cf('0x48')],_0x21df3d[_0xd3cf('0x4a')]));_0x3204a7['where']['SmsAccountId']=_0xdfac5e['id'];if(_0x39823f['query']['filter']){_0x3204a7[_0xd3cf('0x53')]=_[_0xd3cf('0x57')](_0x3204a7[_0xd3cf('0x53')],{'$or':_[_0xd3cf('0x47')](_0x3204a7['attributes'],function(_0x26a791){var _0x311e9d={};_0x311e9d[_0x26a791]={'$like':'%'+_0x39823f['query'][_0xd3cf('0x56')]+'%'};return _0x311e9d;})});}_0x3204a7=_[_0xd3cf('0x57')]({},_0x3204a7,_0x39823f[_0xd3cf('0x58')]);return db['SmsInteraction'][_0xd3cf('0x30')]({'where':_0x3204a7[_0xd3cf('0x53')]})[_0xd3cf('0x37')](function(_0x46b17d){_0x868025[_0xd3cf('0x30')]=_0x46b17d;if(_0x39823f['query'][_0xd3cf('0x59')]){_0x3204a7[_0xd3cf('0x5a')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xd3cf('0xb1')],'as':_0xd3cf('0xc5'),'attributes':[_0xd3cf('0x3d'),_0xd3cf('0xc6'),_0xd3cf('0xc7')],'required':![]},{'model':db[_0xd3cf('0xc8')],'as':_0xd3cf('0xc9'),'attributes':['id',_0xd3cf('0x3d'),'color'],'where':_0x39823f['query'][_0xd3cf('0xca')]?{'id':_0x39823f['query'][_0xd3cf('0xca')]}:undefined,'required':_0x39823f[_0xd3cf('0x48')]['tag']?!![]:![]}];}return db[_0xd3cf('0xa3')][_0xd3cf('0x5b')](_0x3204a7);})[_0xd3cf('0x37')](function(_0x4df387){_0x868025[_0xd3cf('0x6c')]=_0x4df387;return _0x868025;});}})[_0xd3cf('0x37')](respondWithFilteredResult(_0x3abd0c,_0x3204a7))[_0xd3cf('0x5c')](handleError(_0x3abd0c,null));};exports[_0xd3cf('0xbd')]=function(_0x17f343,_0x29a280,_0x5ea439){var _0x4628c8,_0x388a0c,_0x4b6b34;if(_[_0xd3cf('0x99')](_0x17f343[_0xd3cf('0x60')][_0xd3cf('0x60')])||_0x17f343['body'][_0xd3cf('0x60')]===''){throw new db['Sequelize'][(_0xd3cf('0x7c'))](_0xd3cf('0x9a'));}if(_[_0xd3cf('0x99')](_0x17f343['body']['to'])){throw new db['Sequelize'][(_0xd3cf('0x7c'))]('to\x20is\x20mandatory');}_0x4628c8=_0x17f343['body']['to'];return db[_0xd3cf('0x41')]['find']({'where':{'id':_0x17f343[_0xd3cf('0x67')]['id']},'include':[{'model':db[_0xd3cf('0x9e')],'as':_0xd3cf('0xcb'),'include':[{'model':db[_0xd3cf('0x7a')],'as':_0xd3cf('0x9f'),'where':{'mobile':_0x4628c8},'limit':0x1,'order':[[_0xd3cf('0x80'),_0xd3cf('0xa0')]]}]}]})[_0xd3cf('0x37')](handleEntityNotFound(_0x29a280,null))['then'](function(_0x36379c){if(_0x36379c&&_0x36379c[_0xd3cf('0xcb')]){_0x388a0c=_0x36379c[_0xd3cf('0x39')]({'plain':!![]});if(_0x388a0c[_0xd3cf('0xcb')]&&_0x388a0c[_0xd3cf('0xcb')][_0xd3cf('0x9f')][_0xd3cf('0x4e')]){return _0x388a0c[_0xd3cf('0xcb')][_0xd3cf('0x9f')][0x0];}return db[_0xd3cf('0x7a')][_0xd3cf('0x5f')](_[_0xd3cf('0x1b')](_0x17f343[_0xd3cf('0x60')],{'firstName':_0x4628c8,'mobile':_0x4628c8,'phone':_0x4628c8,'ListId':_0x388a0c[_0xd3cf('0x82')]}));}})[_0xd3cf('0x37')](handleEntityNotFound(_0x29a280,null))[_0xd3cf('0x37')](function(_0x1c5f9e){if(_0x1c5f9e){_0x4b6b34=_0x1c5f9e;return db[_0xd3cf('0xa3')][_0xd3cf('0x5e')]({'where':{'ContactId':_0x4b6b34['id'],'closed':![],'SmsAccountId':_0x388a0c['id']}})[_0xd3cf('0x37')](function(_0x135baa){if(_0x135baa){return[_0x135baa,![]];}return db['SmsInteraction'][_0xd3cf('0x5f')]({'UserId':_0x17f343[_0xd3cf('0x61')]['id'],'ContactId':_0x4b6b34['id'],'SmsAccountId':_0x388a0c['id'],'phone':_0x4628c8,'firstMsgDirection':_0xd3cf('0xcc'),'Messages':[_[_0xd3cf('0x57')](_0x17f343[_0xd3cf('0x60')],{'read':![],'body':_0x17f343[_0xd3cf('0x60')][_0xd3cf('0x60')],'phone':_0x4628c8,'SmsAccountId':_0x388a0c['id'],'UserId':_0x17f343['user']['id'],'ContactId':_0x4b6b34['id']})]},{'include':[{'model':db[_0xd3cf('0xad')],'as':_0xd3cf('0xcd')}]})['then'](function(_0x405d20){return[_0x405d20,!![]];});});}})[_0xd3cf('0xa4')](function(_0x21d433,_0x51be06){if(_0x51be06){return _0x21d433;}return db[_0xd3cf('0xad')]['create'](_[_0xd3cf('0x57')](_0x17f343['body'],{'read':![],'body':_0x17f343[_0xd3cf('0x60')][_0xd3cf('0x60')],'phone':_0x4628c8,'SmsAccountId':_0x388a0c['id'],'SmsInteractionId':_0x21d433['id'],'UserId':_0x17f343[_0xd3cf('0x61')]['id'],'ContactId':_0x4b6b34['id']}))[_0xd3cf('0x37')](function(_0x28b594){_0x21d433[_0xd3cf('0xce')][_0xd3cf('0xcd')]=[];_0x21d433[_0xd3cf('0xce')][_0xd3cf('0xcd')][_0xd3cf('0xa9')](_0x28b594[_0xd3cf('0xce')]);return _0x21d433;});})[_0xd3cf('0x37')](respondWithResult(_0x29a280,null))['catch'](handleError(_0x29a280,null));};exports[_0xd3cf('0x2b')]=function(_0x527a1d,_0x1b8185,_0x2b8ebe){if(_0x527a1d[_0xd3cf('0x60')]['id']){delete _0x527a1d['body']['id'];}var _0x245c5e,_0x467fa7,_0x4ed827;return db['SmsAccount'][_0xd3cf('0x5e')]({'where':{'id':_0x527a1d[_0xd3cf('0x67')]['id']}})['then'](handleEntityNotFound(_0x1b8185,null))['then'](function(_0x1122bf){if(_0x1122bf){_0x4ed827=_0x1122bf;logger[_0xd3cf('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd3cf('0x2b'),_0xd3cf('0xcf'),_0x1122bf['type'],util['inspect'](_0x527a1d[_0xd3cf('0x60')],{'showHidden':![],'depth':null}));switch(_0x1122bf[_0xd3cf('0x44')]){case _0xd3cf('0x87'):if(_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0xd0')]&&_0x527a1d[_0xd3cf('0x60')]['status']){_0x467fa7=_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0x2b')];return db['SmsMessage'][_0xd3cf('0x5e')]({'where':{'messageId':_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0xd0')]}});}break;case _0xd3cf('0xd1'):if(_0x527a1d['body'][_0xd3cf('0xd2')]&&_0x527a1d[_0xd3cf('0x60')]['statusInt']){_0x467fa7=_0x527a1d['body']['statusInt'];return db[_0xd3cf('0xad')]['find']({'where':{'messageId':_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0xd2')]}});}break;case'clicksend':if(_0x527a1d[_0xd3cf('0x60')]['message_id']&&_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0xd3')]){_0x467fa7=_0x527a1d['body'][_0xd3cf('0xd3')];return db[_0xd3cf('0xad')][_0xd3cf('0x5e')]({'where':{'messageId':_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0x8c')]}});}break;case _0xd3cf('0x8f'):var _0x332d2c=_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0x90')][0x0];if(_0x332d2c['messageId']&&_0x332d2c['status'][_0xd3cf('0xd4')]===_0xd3cf('0xd5')){_0x467fa7=_0x332d2c[_0xd3cf('0x2b')]['groupName'];return db[_0xd3cf('0xad')][_0xd3cf('0x5e')]({'where':{'messageId':_0x332d2c['messageId']}});}break;case _0xd3cf('0x93'):if(_0x527a1d[_0xd3cf('0x60')]['messageId']&&_0x527a1d[_0xd3cf('0x60')]['status']){_0x467fa7=_0x527a1d['body'][_0xd3cf('0x2b')];return db[_0xd3cf('0xad')][_0xd3cf('0x5e')]({'where':{'messageId':_0x527a1d[_0xd3cf('0x60')]['messageId']}});}break;case'bandwidth':if(_0x527a1d[_0xd3cf('0x60')][0x0]['message']['id']){_0x467fa7=_0x527a1d[_0xd3cf('0x60')][0x0][_0xd3cf('0x44')];return db['SmsMessage'][_0xd3cf('0x5e')]({'where':{'messageId':_0x527a1d[_0xd3cf('0x60')][0x0][_0xd3cf('0x28')]['id']}});}break;case'intelepeer':if(_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0xd6')]&&_0x527a1d['body'][_0xd3cf('0x2b')]){_0x467fa7=_0x527a1d[_0xd3cf('0x60')]['status'];return db['SmsMessage'][_0xd3cf('0x5e')]({'where':{'messageId':_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x1b8185,null))['then'](function(_0x3c4b86){if(_0x3c4b86){_0x245c5e=_0x3c4b86;switch(_0x4ed827[_0xd3cf('0x44')]){case _0xd3cf('0x87'):if(_0x467fa7===_0xd3cf('0xd5')){return _0x245c5e[_0xd3cf('0x36')]({'read':!![]});}else{logger[_0xd3cf('0x26')](_0xd3cf('0x24'),_0xd3cf('0x2b'),_0xd3cf('0x87'),util[_0xd3cf('0xd7')](_0x527a1d[_0xd3cf('0x60')],{'showHidden':![],'depth':null}));}break;case _0xd3cf('0xd1'):if(_0x467fa7==='1'){return _0x245c5e[_0xd3cf('0x36')]({'read':!![]});}else{logger[_0xd3cf('0x26')](_0xd3cf('0x24'),'status',_0xd3cf('0x87'),util[_0xd3cf('0xd7')](_0x527a1d['body'],{'showHidden':![],'depth':null}));}break;case _0xd3cf('0x8a'):if(!_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0xd8')]&&_0x467fa7>=0xc8&&_0x467fa7<=0xce){return _0x245c5e[_0xd3cf('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd3cf('0x2b'),_0xd3cf('0x8a'),util['inspect'](_0x527a1d[_0xd3cf('0x60')],{'showHidden':![],'depth':null}));}break;case _0xd3cf('0x8f'):var _0x50fce1=_0x527a1d[_0xd3cf('0x60')][_0xd3cf('0x90')][0x0];if(_0x50fce1[_0xd3cf('0x2b')][_0xd3cf('0xd4')]===_0xd3cf('0xd5')){return _0x245c5e[_0xd3cf('0x36')]({'read':!![]});}else{logger[_0xd3cf('0x26')](_0xd3cf('0x24'),_0xd3cf('0x2b'),_0xd3cf('0x8f'),util[_0xd3cf('0xd7')](_0x527a1d['body'],{'showHidden':![],'depth':null}));}break;case _0xd3cf('0x93'):if(_0x467fa7=='DELIVERED_TO_GATEWAY'||_0x467fa7==_0xd3cf('0xd9')){return _0x245c5e[_0xd3cf('0x36')]({'read':!![]});}else{logger['error'](_0xd3cf('0x24'),'status',_0xd3cf('0x93'),util['inspect'](_0x527a1d['body'],{'showHidden':![],'depth':null}));}break;case _0xd3cf('0x96'):if(_0x467fa7==_0xd3cf('0xda')){return _0x245c5e[_0xd3cf('0x36')]({'read':!![]});}else{logger[_0xd3cf('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd3cf('0x2b'),_0xd3cf('0x96'),util[_0xd3cf('0xd7')](_0x527a1d[_0xd3cf('0x60')],{'showHidden':![],'depth':null}));}break;case _0xd3cf('0x97'):if(_0x467fa7===_0xd3cf('0xdb')||_0x467fa7===_0xd3cf('0xdc')){return _0x245c5e[_0xd3cf('0x36')]({'read':!![]});}else{logger[_0xd3cf('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd3cf('0x2b'),_0xd3cf('0x97'),util['inspect'](_0x527a1d[_0xd3cf('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x245c5e;}})[_0xd3cf('0x37')](respondWithResult(_0x1b8185,null))[_0xd3cf('0x5c')](handleError(_0x1b8185,null));};exports[_0xd3cf('0xdd')]=function(_0x5be0fa,_0x15d4e6,_0x34d3e5){var _0x1c9c85,_0x48a553,_0x404349;return db[_0xd3cf('0x41')][_0xd3cf('0x5e')]({'where':{'id':_0x5be0fa[_0xd3cf('0x67')]['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x15d4e6,null))['then'](function(_0x233424){if(_0x233424){_0x404349=_0x233424;logger['debug'](_0xd3cf('0x24'),_0xd3cf('0x2b'),'received\x20delivery\x20report\x20from',_0x233424['type'],util['inspect'](_0x5be0fa['query'],{'showHidden':![],'depth':null}));switch(_0x233424[_0xd3cf('0x44')]){case _0xd3cf('0xde'):if(_0x5be0fa[_0xd3cf('0x48')]['message-id']&&_0x5be0fa[_0xd3cf('0x48')][_0xd3cf('0xdf')]){_0x48a553=_0x5be0fa[_0xd3cf('0x48')]['state'];return db['SmsMessage'][_0xd3cf('0x5e')]({'where':{'messageId':_0x5be0fa[_0xd3cf('0x48')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x15d4e6,null))[_0xd3cf('0x37')](function(_0x5ef002){if(_0x5ef002){_0x1c9c85=_0x5ef002;switch(_0x404349['type']){case _0xd3cf('0xde'):if(_0x48a553==='2'||_0x48a553==='6'){return _0x1c9c85[_0xd3cf('0x36')]({'read':!![]});}else{logger['error'](_0xd3cf('0x24'),_0xd3cf('0x2b'),_0xd3cf('0xde'),util[_0xd3cf('0xd7')](_0x5be0fa[_0xd3cf('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x1c9c85;}})['then'](respondWithResult(_0x15d4e6,null))[_0xd3cf('0x5c')](handleError(_0x15d4e6,null));};exports['addAgents']=function(_0x3fbe45,_0x30eddb,_0xec9f7){return db[_0xd3cf('0x41')][_0xd3cf('0x5e')]({'where':{'id':_0x3fbe45[_0xd3cf('0x67')]['id']}})['then'](handleEntityNotFound(_0x30eddb,null))[_0xd3cf('0x37')](function(_0x1f6841){if(_0x1f6841){return _0x1f6841['addAgents'](_0x3fbe45[_0xd3cf('0x60')][_0xd3cf('0x6e')],_[_0xd3cf('0xa1')](_0x3fbe45[_0xd3cf('0x60')],[_0xd3cf('0x6e'),'id'])||{})[_0xd3cf('0xa4')](function(_0x42a441){for(var _0x4c7605=0x0;_0x4c7605<_0x3fbe45[_0xd3cf('0x60')][_0xd3cf('0x6e')][_0xd3cf('0x4e')];_0x4c7605+=0x1){socket[_0xd3cf('0xe0')](_0xd3cf('0xe1'),{'UserId':Number(_0x3fbe45['body']['ids'][_0x4c7605]),'SmsAccountId':Number(_0x3fbe45['params']['id'])});}return _0x42a441;});}})['then'](respondWithResult(_0x30eddb,null))[_0xd3cf('0x5c')](handleError(_0x30eddb,null));};exports[_0xd3cf('0xe2')]=function(_0xc64375,_0x553b14,_0x4ca58a){return db[_0xd3cf('0x41')][_0xd3cf('0x5e')]({'where':{'id':_0xc64375['params']['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x553b14,null))[_0xd3cf('0x37')](function(_0x4ac2c8){if(_0x4ac2c8){return _0x4ac2c8[_0xd3cf('0xe2')](_0xc64375[_0xd3cf('0x48')][_0xd3cf('0x6e')])['then'](function(){if(_[_0xd3cf('0xe3')](_0xc64375[_0xd3cf('0x48')][_0xd3cf('0x6e')])){for(var _0xf67adf=0x0;_0xf67adf<_0xc64375[_0xd3cf('0x48')]['ids'][_0xd3cf('0x4e')];_0xf67adf+=0x1){socket['emit'](_0xd3cf('0xe4'),{'UserId':Number(_0xc64375[_0xd3cf('0x48')]['ids'][_0xf67adf]),'SmsAccountId':Number(_0xc64375[_0xd3cf('0x67')]['id'])});}}else{socket[_0xd3cf('0xe0')](_0xd3cf('0xe4'),{'UserId':Number(_0xc64375['query'][_0xd3cf('0x6e')]),'SmsAccountId':Number(_0xc64375[_0xd3cf('0x67')]['id'])});}});}})[_0xd3cf('0x37')](respondWithStatusCode(_0x553b14,null))[_0xd3cf('0x5c')](handleError(_0x553b14,null));};exports[_0xd3cf('0xe5')]=function(_0x451f40,_0x3cb449,_0x4003a6){var _0x289b7b={};var _0x44d432={};var _0x3043ed;var _0x6a4c4d;return db[_0xd3cf('0x41')][_0xd3cf('0x6a')]({'where':{'id':_0x451f40[_0xd3cf('0x67')]['id']}})[_0xd3cf('0x37')](handleEntityNotFound(_0x3cb449,null))['then'](function(_0x515725){if(_0x515725){_0x3043ed=_0x515725;_0x44d432[_0xd3cf('0x46')]=_[_0xd3cf('0x49')](db[_0xd3cf('0xb1')][_0xd3cf('0x42')]);_0x44d432[_0xd3cf('0x48')]=_[_0xd3cf('0x49')](_0x451f40[_0xd3cf('0x48')]);_0x44d432[_0xd3cf('0x4a')]=_['intersection'](_0x44d432['model'],_0x44d432[_0xd3cf('0x48')]);_0x289b7b[_0xd3cf('0x4c')]=_[_0xd3cf('0x4b')](_0x44d432[_0xd3cf('0x46')],qs[_0xd3cf('0x4d')](_0x451f40['query']['fields']));_0x289b7b[_0xd3cf('0x4c')]=_0x289b7b[_0xd3cf('0x4c')][_0xd3cf('0x4e')]?_0x289b7b[_0xd3cf('0x4c')]:_0x44d432['model'];_0x289b7b['order']=qs[_0xd3cf('0x52')](_0x451f40['query'][_0xd3cf('0x52')]);_0x289b7b[_0xd3cf('0x53')]=qs[_0xd3cf('0x4a')](_[_0xd3cf('0x54')](_0x451f40[_0xd3cf('0x48')],_0x44d432[_0xd3cf('0x4a')]));if(_0x451f40[_0xd3cf('0x48')][_0xd3cf('0x56')]){_0x289b7b[_0xd3cf('0x53')]=_[_0xd3cf('0x57')](_0x289b7b[_0xd3cf('0x53')],{'$or':_[_0xd3cf('0x47')](_0x289b7b['attributes'],function(_0x9493e9){var _0x5726fb={};_0x5726fb[_0x9493e9]={'$like':'%'+_0x451f40['query'][_0xd3cf('0x56')]+'%'};return _0x5726fb;})});}_0x289b7b=_[_0xd3cf('0x57')]({},_0x289b7b,_0x451f40[_0xd3cf('0x58')]);return _0x3043ed[_0xd3cf('0xe5')](_0x289b7b);}})['then'](function(_0x224b77){if(_0x224b77){_0x6a4c4d=_0x224b77[_0xd3cf('0x4e')];if(!_0x451f40['query']['hasOwnProperty'](_0xd3cf('0x50'))){_0x289b7b[_0xd3cf('0x2e')]=qs[_0xd3cf('0x2e')](_0x451f40['query'][_0xd3cf('0x2e')]);_0x289b7b['offset']=qs[_0xd3cf('0x2f')](_0x451f40[_0xd3cf('0x48')][_0xd3cf('0x2f')]);}return _0x3043ed[_0xd3cf('0xe5')](_0x289b7b);}})['then'](function(_0x2a9273){if(_0x2a9273){return _0x2a9273?{'count':_0x6a4c4d,'rows':_0x2a9273}:null;}})[_0xd3cf('0x37')](respondWithResult(_0x3cb449,null))[_0xd3cf('0x5c')](handleError(_0x3cb449,null));}; \ No newline at end of file +var _0x5064=['CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','messageId','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','infobip','results','originatingAddress','segmentedMessage','fromNumber','bandwidth','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','DESC','list','omit','Contacts','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','rows','catch','show','params','Pause','mandatoryDispositionPause','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','SmsAccountId','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority'];(function(_0x58719f,_0x42ed40){var _0x2d2b3c=function(_0xf4590d){while(--_0xf4590d){_0x58719f['push'](_0x58719f['shift']());}};_0x2d2b3c(++_0x42ed40);}(_0x5064,0x71));var _0x4506=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5064[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x4506('0x0'));var rimraf=require(_0x4506('0x1'));var zipdir=require(_0x4506('0x2'));var jsonpatch=require(_0x4506('0x3'));var rp=require(_0x4506('0x4'));var moment=require(_0x4506('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4506('0x6'));var util=require(_0x4506('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4506('0x8'));var ejs=require(_0x4506('0x9'));var fs=require('fs');var fs_extra=require(_0x4506('0xa'));var _=require(_0x4506('0xb'));var squel=require(_0x4506('0xc'));var crypto=require(_0x4506('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4506('0xe'));var Papa=require(_0x4506('0xf'));var Redis=require(_0x4506('0x10'));var authService=require(_0x4506('0x11'));var qs=require(_0x4506('0x12'));var as=require(_0x4506('0x13'));var hardwareService=require(_0x4506('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4506('0x15'));var config=require(_0x4506('0x16'));var licenseUtil=require(_0x4506('0x17'));var db=require(_0x4506('0x18'))['db'];config[_0x4506('0x19')]=_[_0x4506('0x1a')](config[_0x4506('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4506('0x1b'))(new Redis(config[_0x4506('0x19')]));require(_0x4506('0x1c'))[_0x4506('0x1d')](socket);var jayson=require(_0x4506('0x1e'));var client=jayson[_0x4506('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x325a66,_0x5ea028,_0x3f2d77,_0xd8007a){return new BPromise(function(_0x1ece5d,_0x325ba7){var _0x584bd5=_0xd8007a||client;return _0x584bd5['request'](_0x325a66,_0x3f2d77)[_0x4506('0x20')](function(_0x30c864){logger[_0x4506('0x21')](_0x4506('0x22'),_0x5ea028,_0x4506('0x23'));logger['debug'](_0x4506('0x24'),_0x5ea028,_0x4506('0x23'),JSON['stringify'](_0x30c864));if(_0x30c864[_0x4506('0x25')]){if(_0x30c864[_0x4506('0x25')][_0x4506('0x26')]===0x1f4){logger[_0x4506('0x25')](_0x4506('0x22'),_0x5ea028,_0x30c864[_0x4506('0x25')][_0x4506('0x27')]);return _0x325ba7(_0x30c864['error'][_0x4506('0x27')]);}logger[_0x4506('0x25')](_0x4506('0x22'),_0x5ea028,_0x30c864[_0x4506('0x25')][_0x4506('0x27')]);return _0x1ece5d(_0x30c864[_0x4506('0x25')]['message']);}else{logger['info'](_0x4506('0x22'),_0x5ea028,_0x4506('0x23'));_0x1ece5d(_0x30c864[_0x4506('0x28')][_0x4506('0x27')]);}})['catch'](function(_0x13115d){logger[_0x4506('0x25')](_0x4506('0x22'),_0x5ea028,_0x13115d);_0x325ba7(_0x13115d);});});}function respondWithStatusCode(_0xe02bbb,_0x1e6dea){_0x1e6dea=_0x1e6dea||0xcc;return function(_0x1a8f04){if(_0x1a8f04){return _0xe02bbb[_0x4506('0x29')](_0x1e6dea);}return _0xe02bbb[_0x4506('0x2a')](_0x1e6dea)['end']();};}function respondWithResult(_0x5f3eb0,_0x4cdfe6){_0x4cdfe6=_0x4cdfe6||0xc8;return function(_0x322b86){if(_0x322b86){return _0x5f3eb0[_0x4506('0x2a')](_0x4cdfe6)[_0x4506('0x2b')](_0x322b86);}};}function respondWithFilteredResult(_0x1ffcc5,_0x5d2ad6){return function(_0x5cacfd){if(_0x5cacfd){var _0x3440d2=typeof _0x5d2ad6[_0x4506('0x2c')]===_0x4506('0x2d')&&typeof _0x5d2ad6[_0x4506('0x2e')]===_0x4506('0x2d');var _0x5bcf9e=_0x5cacfd[_0x4506('0x2f')];var _0x8793df=_0x3440d2?0x0:_0x5d2ad6['offset'];var _0x22ba51=_0x3440d2?_0x5cacfd['count']:_0x5d2ad6['offset']+_0x5d2ad6[_0x4506('0x2e')];var _0x3a6165;if(_0x22ba51>=_0x5bcf9e){_0x22ba51=_0x5bcf9e;_0x3a6165=0xc8;}else{_0x3a6165=0xce;}_0x1ffcc5[_0x4506('0x2a')](_0x3a6165);return _0x1ffcc5[_0x4506('0x30')]('Content-Range',_0x8793df+'-'+_0x22ba51+'/'+_0x5bcf9e)[_0x4506('0x2b')](_0x5cacfd);}return null;};}function patchUpdates(_0x360c73){return function(_0x14b209){try{jsonpatch[_0x4506('0x31')](_0x14b209,_0x360c73,!![]);}catch(_0x11779c){return BPromise[_0x4506('0x32')](_0x11779c);}return _0x14b209[_0x4506('0x33')]();};}function saveUpdates(_0x2086f9,_0x5742fd){return function(_0x35b524){if(_0x35b524){return _0x35b524['update'](_0x2086f9)[_0x4506('0x20')](function(_0x8fcab5){return _0x8fcab5;});}return null;};}function removeEntity(_0x2bde96,_0x2245d6){return function(_0x2785f8){if(_0x2785f8){return _0x2785f8[_0x4506('0x34')]()[_0x4506('0x20')](function(){var _0x4b03de=_0x2785f8[_0x4506('0x35')]({'plain':!![]});var _0x10982a=_0x4506('0x36');return db[_0x4506('0x37')][_0x4506('0x34')]({'where':{'type':_0x10982a,'resourceId':_0x4b03de['id']}})[_0x4506('0x20')](function(){return _0x2785f8;});})[_0x4506('0x20')](function(){_0x2bde96[_0x4506('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x74eabf,_0x5aa686){return function(_0x1763a8){if(!_0x1763a8){_0x74eabf[_0x4506('0x29')](0x194);}return _0x1763a8;};}function handleError(_0x137a5d,_0x1813a7){_0x1813a7=_0x1813a7||0x1f4;return function(_0x398984){logger[_0x4506('0x25')](_0x398984[_0x4506('0x38')]);if(_0x398984['name']){delete _0x398984[_0x4506('0x39')];}_0x137a5d['status'](_0x1813a7)[_0x4506('0x3a')](_0x398984);};}exports[_0x4506('0x3b')]=function(_0x2aa6cf,_0x459ee6){var _0x3d25f2={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5f01bf={},_0x34c22c={'count':0x0,'rows':[]};var _0xa61fee=_[_0x4506('0x3c')](db[_0x4506('0x3d')][_0x4506('0x3e')],function(_0x35d3de){return{'name':_0x35d3de[_0x4506('0x3f')],'type':_0x35d3de[_0x4506('0x40')]['key']};});_0x5f01bf[_0x4506('0x41')]=_[_0x4506('0x3c')](_0xa61fee,_0x4506('0x39'));_0x5f01bf[_0x4506('0x42')]=_[_0x4506('0x43')](_0x2aa6cf['query']);_0x5f01bf['filters']=_[_0x4506('0x44')](_0x5f01bf['model'],_0x5f01bf[_0x4506('0x42')]);_0x3d25f2[_0x4506('0x45')]=_[_0x4506('0x44')](_0x5f01bf['model'],qs[_0x4506('0x46')](_0x2aa6cf[_0x4506('0x42')][_0x4506('0x46')]));_0x3d25f2[_0x4506('0x45')]=_0x3d25f2[_0x4506('0x45')][_0x4506('0x47')]?_0x3d25f2['attributes']:_0x5f01bf[_0x4506('0x41')];if(!_0x2aa6cf['query'][_0x4506('0x48')](_0x4506('0x49'))){_0x3d25f2[_0x4506('0x2e')]=qs[_0x4506('0x2e')](_0x2aa6cf['query']['limit']);_0x3d25f2['offset']=qs[_0x4506('0x2c')](_0x2aa6cf[_0x4506('0x42')][_0x4506('0x2c')]);}_0x3d25f2['order']=qs['sort'](_0x2aa6cf[_0x4506('0x42')][_0x4506('0x4a')]);_0x3d25f2[_0x4506('0x4b')]=qs[_0x4506('0x4c')](_[_0x4506('0x4d')](_0x2aa6cf['query'],_0x5f01bf[_0x4506('0x4c')]),_0xa61fee);if(_0x2aa6cf[_0x4506('0x42')][_0x4506('0x4e')]){_0x3d25f2[_0x4506('0x4b')]=_[_0x4506('0x4f')](_0x3d25f2[_0x4506('0x4b')],{'$or':_['map'](_0xa61fee,function(_0x59978d){if(_0x59978d[_0x4506('0x40')]!=='VIRTUAL'){var _0x5269ef={};_0x5269ef[_0x59978d[_0x4506('0x39')]]={'$like':'%'+_0x2aa6cf[_0x4506('0x42')][_0x4506('0x4e')]+'%'};return _0x5269ef;}})});}_0x3d25f2=_[_0x4506('0x4f')]({},_0x3d25f2,_0x2aa6cf[_0x4506('0x50')]);var _0x454dad={'where':_0x3d25f2[_0x4506('0x4b')]};return db['SmsAccount'][_0x4506('0x2f')](_0x454dad)[_0x4506('0x20')](function(_0x348901){_0x34c22c['count']=_0x348901;if(_0x2aa6cf[_0x4506('0x42')]['includeAll']){_0x3d25f2[_0x4506('0x51')]=[{'all':!![]}];}return db[_0x4506('0x3d')]['findAll'](_0x3d25f2);})['then'](function(_0x1cbc14){_0x34c22c[_0x4506('0x52')]=_0x1cbc14;return _0x34c22c;})[_0x4506('0x20')](respondWithFilteredResult(_0x459ee6,_0x3d25f2))[_0x4506('0x53')](handleError(_0x459ee6,null));};exports[_0x4506('0x54')]=function(_0x23dc2c,_0x544839){var _0x470104={'raw':![],'where':{'id':_0x23dc2c[_0x4506('0x55')]['id']},'include':[{'model':db[_0x4506('0x56')],'as':_0x4506('0x57')}]},_0x3252a2={};_0x3252a2['model']=_['keys'](db[_0x4506('0x3d')][_0x4506('0x3e')]);_0x3252a2['query']=_[_0x4506('0x43')](_0x23dc2c[_0x4506('0x42')]);_0x3252a2['filters']=_[_0x4506('0x44')](_0x3252a2[_0x4506('0x41')],_0x3252a2[_0x4506('0x42')]);_0x470104[_0x4506('0x45')]=_[_0x4506('0x44')](_0x3252a2['model'],qs['fields'](_0x23dc2c[_0x4506('0x42')][_0x4506('0x46')]));_0x470104[_0x4506('0x45')]=_0x470104[_0x4506('0x45')][_0x4506('0x47')]?_0x470104[_0x4506('0x45')]:_0x3252a2[_0x4506('0x41')];if(_0x23dc2c['query'][_0x4506('0x58')]){_0x470104[_0x4506('0x51')]=[{'all':!![]}];}_0x470104=_[_0x4506('0x4f')]({},_0x470104,_0x23dc2c[_0x4506('0x50')]);return db[_0x4506('0x3d')][_0x4506('0x59')](_0x470104)[_0x4506('0x20')](handleEntityNotFound(_0x544839,null))[_0x4506('0x20')](respondWithResult(_0x544839,null))['catch'](handleError(_0x544839,null));};exports['create']=function(_0x36cf67,_0x203530){return db[_0x4506('0x3d')][_0x4506('0x5a')](_0x36cf67[_0x4506('0x5b')],{})[_0x4506('0x20')](function(_0x2aa28f){var _0x4c5d02=_0x36cf67[_0x4506('0x5c')][_0x4506('0x35')]({'plain':!![]});if(!_0x4c5d02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c5d02[_0x4506('0x5d')]==='user'){var _0x46da19=_0x2aa28f['get']({'plain':!![]});var _0x37b5a9=_0x4506('0x36');return db[_0x4506('0x5e')][_0x4506('0x59')]({'where':{'name':_0x37b5a9,'userProfileId':_0x4c5d02[_0x4506('0x5f')]},'raw':!![]})[_0x4506('0x20')](function(_0x3a3faf){if(_0x3a3faf&&_0x3a3faf[_0x4506('0x60')]===0x0){return db[_0x4506('0x37')]['create']({'name':_0x46da19['name'],'resourceId':_0x46da19['id'],'type':_0x3a3faf[_0x4506('0x39')],'sectionId':_0x3a3faf['id']},{})[_0x4506('0x20')](function(){return _0x2aa28f;});}else{return _0x2aa28f;}})[_0x4506('0x53')](function(_0x5c4067){logger[_0x4506('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c4067);throw _0x5c4067;});}return _0x2aa28f;})[_0x4506('0x20')](respondWithResult(_0x203530,0xc9))[_0x4506('0x53')](handleError(_0x203530,null));};exports[_0x4506('0x61')]=function(_0x2782fb,_0xcfd3bb){if(_0x2782fb['body']['id']){delete _0x2782fb[_0x4506('0x5b')]['id'];}return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x2782fb[_0x4506('0x55')]['id']},'include':[{'model':db[_0x4506('0x56')],'as':_0x4506('0x57')}]})[_0x4506('0x20')](handleEntityNotFound(_0xcfd3bb,null))['then'](saveUpdates(_0x2782fb[_0x4506('0x5b')],null))[_0x4506('0x20')](respondWithResult(_0xcfd3bb,null))['catch'](handleError(_0xcfd3bb,null));};exports['destroy']=function(_0x4b7caa,_0x54a3a2){return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x4b7caa[_0x4506('0x55')]['id']}})[_0x4506('0x20')](handleEntityNotFound(_0x54a3a2,null))[_0x4506('0x20')](removeEntity(_0x54a3a2,null))[_0x4506('0x53')](handleError(_0x54a3a2,null));};exports[_0x4506('0x62')]=function(_0x380343,_0xaadb6e){return db[_0x4506('0x3d')][_0x4506('0x62')]()['then'](respondWithResult(_0xaadb6e,null))['catch'](handleError(_0xaadb6e,null));};exports[_0x4506('0x63')]=function(_0x5fe217,_0x20f8c4,_0x30a4f6){if(_0x5fe217[_0x4506('0x5b')]['id']){delete _0x5fe217[_0x4506('0x5b')]['id'];}return db['SmsAccount'][_0x4506('0x59')]({'where':{'id':_0x5fe217[_0x4506('0x55')]['id']}})[_0x4506('0x20')](handleEntityNotFound(_0x20f8c4,null))[_0x4506('0x20')](function(_0x2d1c2f){if(_0x2d1c2f){_0x5fe217[_0x4506('0x5b')][_0x4506('0x64')]=_0x2d1c2f['id'];return db['Disposition']['create'](_0x5fe217['body']);}})[_0x4506('0x20')](respondWithResult(_0x20f8c4,null))[_0x4506('0x53')](handleError(_0x20f8c4,null));};exports[_0x4506('0x65')]=function(_0xd6dbde,_0x41e143,_0x4205fa){var _0x5748da={'raw':![],'where':{}};var _0x27c26f={};var _0x2407d4={'count':0x0,'rows':[]};return db[_0x4506('0x3d')][_0x4506('0x66')]({'where':{'id':_0xd6dbde[_0x4506('0x55')]['id']}})['then'](handleEntityNotFound(_0x41e143,null))['then'](function(_0x5bc063){if(_0x5bc063){_0x27c26f['model']=_[_0x4506('0x43')](db['Disposition']['rawAttributes']);_0x27c26f[_0x4506('0x42')]=_[_0x4506('0x43')](_0xd6dbde[_0x4506('0x42')]);_0x27c26f[_0x4506('0x4c')]=_[_0x4506('0x44')](_0x27c26f[_0x4506('0x41')],_0x27c26f[_0x4506('0x42')]);_0x5748da[_0x4506('0x45')]=_[_0x4506('0x44')](_0x27c26f[_0x4506('0x41')],qs[_0x4506('0x46')](_0xd6dbde['query']['fields']));_0x5748da[_0x4506('0x45')]=_0x5748da[_0x4506('0x45')][_0x4506('0x47')]?_0x5748da[_0x4506('0x45')]:_0x27c26f[_0x4506('0x41')];if(!_0xd6dbde[_0x4506('0x42')][_0x4506('0x48')](_0x4506('0x49'))){_0x5748da[_0x4506('0x2e')]=qs['limit'](_0xd6dbde[_0x4506('0x42')][_0x4506('0x2e')]);_0x5748da[_0x4506('0x2c')]=qs['offset'](_0xd6dbde[_0x4506('0x42')]['offset']);}_0x5748da[_0x4506('0x67')]=qs[_0x4506('0x4a')](_0xd6dbde[_0x4506('0x42')][_0x4506('0x4a')]);_0x5748da['where']=qs[_0x4506('0x4c')](_[_0x4506('0x4d')](_0xd6dbde[_0x4506('0x42')],_0x27c26f[_0x4506('0x4c')]));_0x5748da['where'][_0x4506('0x64')]=_0x5bc063['id'];if(_0xd6dbde[_0x4506('0x42')][_0x4506('0x4e')]){_0x5748da[_0x4506('0x4b')]=_[_0x4506('0x4f')](_0x5748da[_0x4506('0x4b')],{'$or':_['map'](_0x5748da['attributes'],function(_0x26a0f9){var _0x563768={};_0x563768[_0x26a0f9]={'$like':'%'+_0xd6dbde['query']['filter']+'%'};return _0x563768;})});}_0x5748da=_[_0x4506('0x4f')]({},_0x5748da,_0xd6dbde[_0x4506('0x50')]);return db['Disposition']['count']({'where':_0x5748da['where']})[_0x4506('0x20')](function(_0x56d1d){_0x2407d4[_0x4506('0x2f')]=_0x56d1d;if(_0xd6dbde[_0x4506('0x42')][_0x4506('0x58')]){_0x5748da[_0x4506('0x51')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5748da);})[_0x4506('0x20')](function(_0x2ac8f9){_0x2407d4[_0x4506('0x52')]=_0x2ac8f9;return _0x2407d4;});}})['then'](respondWithFilteredResult(_0x41e143,_0x5748da))['catch'](handleError(_0x41e143,null));};exports[_0x4506('0x68')]=function(_0x4c0352,_0x29f951,_0x4b6733){return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x4c0352['params']['id']}})[_0x4506('0x20')](handleEntityNotFound(_0x29f951,null))[_0x4506('0x20')](function(_0x307ee9){if(_0x307ee9){return _0x307ee9[_0x4506('0x68')](_0x4c0352[_0x4506('0x42')][_0x4506('0x69')]);}})['then'](respondWithStatusCode(_0x29f951,null))['catch'](handleError(_0x29f951,null));};exports[_0x4506('0x6a')]=function(_0x500208,_0x4d45f9,_0x459e57){if(_0x500208[_0x4506('0x5b')]['id']){delete _0x500208[_0x4506('0x5b')]['id'];}return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x500208[_0x4506('0x55')]['id']}})[_0x4506('0x20')](handleEntityNotFound(_0x4d45f9,null))[_0x4506('0x20')](function(_0x3ef94d){if(_0x3ef94d){_0x500208[_0x4506('0x5b')][_0x4506('0x64')]=_0x3ef94d['id'];return db[_0x4506('0x6b')][_0x4506('0x5a')](_0x500208['body']);}})[_0x4506('0x20')](respondWithResult(_0x4d45f9,null))[_0x4506('0x53')](handleError(_0x4d45f9,null));};exports[_0x4506('0x6c')]=function(_0x1e08c6,_0x3ca63b,_0x1886b4){var _0x3379ff={'raw':![],'where':{}};var _0x26abcc={};var _0x292c7e={'count':0x0,'rows':[]};return db[_0x4506('0x3d')]['findOne']({'where':{'id':_0x1e08c6[_0x4506('0x55')]['id']}})['then'](handleEntityNotFound(_0x3ca63b,null))['then'](function(_0x4a1b09){if(_0x4a1b09){_0x26abcc[_0x4506('0x41')]=_[_0x4506('0x43')](db['CannedAnswer']['rawAttributes']);_0x26abcc[_0x4506('0x42')]=_[_0x4506('0x43')](_0x1e08c6[_0x4506('0x42')]);_0x26abcc[_0x4506('0x4c')]=_['intersection'](_0x26abcc[_0x4506('0x41')],_0x26abcc[_0x4506('0x42')]);_0x3379ff[_0x4506('0x45')]=_[_0x4506('0x44')](_0x26abcc[_0x4506('0x41')],qs[_0x4506('0x46')](_0x1e08c6[_0x4506('0x42')][_0x4506('0x46')]));_0x3379ff[_0x4506('0x45')]=_0x3379ff[_0x4506('0x45')][_0x4506('0x47')]?_0x3379ff[_0x4506('0x45')]:_0x26abcc[_0x4506('0x41')];if(!_0x1e08c6['query'][_0x4506('0x48')](_0x4506('0x49'))){_0x3379ff[_0x4506('0x2e')]=qs[_0x4506('0x2e')](_0x1e08c6['query'][_0x4506('0x2e')]);_0x3379ff['offset']=qs['offset'](_0x1e08c6[_0x4506('0x42')]['offset']);}_0x3379ff[_0x4506('0x67')]=qs[_0x4506('0x4a')](_0x1e08c6['query'][_0x4506('0x4a')]);_0x3379ff[_0x4506('0x4b')]=qs[_0x4506('0x4c')](_[_0x4506('0x4d')](_0x1e08c6[_0x4506('0x42')],_0x26abcc['filters']));_0x3379ff[_0x4506('0x4b')][_0x4506('0x64')]=_0x4a1b09['id'];if(_0x1e08c6[_0x4506('0x42')][_0x4506('0x4e')]){_0x3379ff[_0x4506('0x4b')]=_[_0x4506('0x4f')](_0x3379ff[_0x4506('0x4b')],{'$or':_[_0x4506('0x3c')](_0x3379ff[_0x4506('0x45')],function(_0x36f171){var _0x337765={};_0x337765[_0x36f171]={'$like':'%'+_0x1e08c6[_0x4506('0x42')]['filter']+'%'};return _0x337765;})});}_0x3379ff=_[_0x4506('0x4f')]({},_0x3379ff,_0x1e08c6[_0x4506('0x50')]);return db[_0x4506('0x6b')][_0x4506('0x2f')]({'where':_0x3379ff[_0x4506('0x4b')]})[_0x4506('0x20')](function(_0x3b9082){_0x292c7e[_0x4506('0x2f')]=_0x3b9082;if(_0x1e08c6[_0x4506('0x42')][_0x4506('0x58')]){_0x3379ff['include']=[{'all':!![]}];}return db[_0x4506('0x6b')][_0x4506('0x6d')](_0x3379ff);})[_0x4506('0x20')](function(_0x42eaa0){_0x292c7e[_0x4506('0x52')]=_0x42eaa0;return _0x292c7e;});}})[_0x4506('0x20')](respondWithFilteredResult(_0x3ca63b,_0x3379ff))['catch'](handleError(_0x3ca63b,null));};exports['removeAnswers']=function(_0x2901b7,_0x4cf7d8,_0x21ae9a){return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x2901b7[_0x4506('0x55')]['id']}})[_0x4506('0x20')](handleEntityNotFound(_0x4cf7d8,null))['then'](function(_0x106c4a){if(_0x106c4a){return _0x106c4a[_0x4506('0x6e')](_0x2901b7['query'][_0x4506('0x69')]);}})[_0x4506('0x20')](respondWithStatusCode(_0x4cf7d8,null))[_0x4506('0x53')](handleError(_0x4cf7d8,null));};exports['notify']=function(_0x175e1b,_0x2e7197,_0x3c07c9){var _0x25a7ad={'channel':_0x4506('0x6f')};var _0x5e63ed=[];var _0x340fc7=[];var _0x2266e2={};return db[_0x4506('0x3d')]['find']({'where':{'id':_0x175e1b['params']['id']},'include':[{'model':db[_0x4506('0x70')],'as':_0x4506('0x71')}]})['then'](handleEntityNotFound(_0x2e7197,null))['then'](function(_0x310e04){_0x25a7ad[_0x4506('0x72')]=_0x310e04;_0x25a7ad[_0x4506('0x73')]=_[_0x4506('0x74')](_0x310e04[_0x4506('0x71')],[_0x4506('0x75')],['asc']);if(_0x25a7ad[_0x4506('0x72')]['Applications']){delete _0x25a7ad[_0x4506('0x72')]['Applications'];}return db[_0x4506('0x76')]['describe']();})[_0x4506('0x20')](function(_0x1142c6){if(!_0x1142c6){throw new db[(_0x4506('0x77'))][(_0x4506('0x78'))]('no\x20available\x20attributes');}_0x5e63ed=_[_0x4506('0x79')](_[_0x4506('0x43')](_0x1142c6),['createdAt','updatedAt']);_0x340fc7=_[_0x4506('0x79')](_[_0x4506('0x43')](_0x1142c6),[_0x4506('0x7a'),_0x4506('0x7b'),_0x4506('0x7c'),'ListId']);_0x25a7ad['body']={'mapKey':_0x4506('0x7d')};if(_0x25a7ad[_0x4506('0x72')][_0x4506('0x40')]){switch(_0x25a7ad[_0x4506('0x72')][_0x4506('0x40')]){case _0x4506('0x7e'):_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')]=_0x175e1b['body'][_0x4506('0x80')];_0x25a7ad[_0x4506('0x5b')]['body']=_0x175e1b[_0x4506('0x5b')]['Body'];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x81')]=_0x175e1b['body']['MessageSid'];break;case _0x4506('0x82'):_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')]='+'+_0x175e1b[_0x4506('0x5b')][_0x4506('0x83')];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')]=_0x175e1b['body'][_0x4506('0x84')];break;case _0x4506('0x85'):_0x25a7ad['body'][_0x4506('0x7f')]=_0x175e1b['body'][_0x4506('0x7f')];_0x25a7ad['body']['body']=_0x175e1b[_0x4506('0x5b')][_0x4506('0x27')];break;case _0x4506('0x86'):_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')]=_0x175e1b['body'][_0x4506('0x7f')];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')]=_0x175e1b[_0x4506('0x5b')]['body'];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x81')]=_0x175e1b[_0x4506('0x5b')][_0x4506('0x87')];break;case _0x4506('0x88'):_0x25a7ad['body'][_0x4506('0x7f')]=_0x175e1b['body'][_0x4506('0x80')];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')]=_0x175e1b[_0x4506('0x5b')][_0x4506('0x89')];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x81')]=_0x175e1b['body']['MessageUUID'];break;case _0x4506('0x8a'):_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')]='+'+_0x175e1b['body'][_0x4506('0x8b')][0x0][_0x4506('0x7f')];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')]=_0x175e1b['body'][_0x4506('0x8b')][0x0][_0x4506('0x84')];_0x25a7ad[_0x4506('0x5b')]['messageId']=_0x175e1b[_0x4506('0x5b')][_0x4506('0x8b')][0x0][_0x4506('0x81')];break;case'csc':_0x25a7ad[_0x4506('0x5b')]['from']=_0x175e1b[_0x4506('0x5b')][_0x4506('0x8c')];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')]=_0x175e1b[_0x4506('0x5b')][_0x4506('0x8d')][_0x4506('0x27')];break;case'clickatell':_0x25a7ad['body']['from']=_0x175e1b['body'][_0x4506('0x8e')];_0x25a7ad['body'][_0x4506('0x5b')]=_0x175e1b[_0x4506('0x5b')][_0x4506('0x84')];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x81')]=_0x175e1b[_0x4506('0x5b')]['replyMessageId'];break;case _0x4506('0x8f'):_0x25a7ad[_0x4506('0x5b')][_0x4506('0x81')]=_0x175e1b['body'][0x0][_0x4506('0x27')]['id'];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')]=_0x175e1b[_0x4506('0x5b')][0x0][_0x4506('0x27')]['from'];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')]=_0x175e1b[_0x4506('0x5b')][0x0][_0x4506('0x27')][_0x4506('0x84')];break;case _0x4506('0x90'):_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')]=_0x175e1b[_0x4506('0x5b')]['from'];_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')]=_0x175e1b['body'][_0x4506('0x27')];_0x25a7ad['body'][_0x4506('0x81')]=_0x175e1b[_0x4506('0x5b')][_0x4506('0x91')];break;}}if(_0x25a7ad[_0x4506('0x5b')]['id']){delete _0x25a7ad[_0x4506('0x5b')]['id'];}if(_['isNil'](_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')])){throw new db[(_0x4506('0x77'))][(_0x4506('0x78'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')])||_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4506('0x92')](_0x25a7ad[_0x4506('0x5b')][_0x4506('0x93')])){throw new db[(_0x4506('0x77'))]['ValidationError'](_0x4506('0x94')+_0x340fc7);}if(!_[_0x4506('0x95')](_0x340fc7,_0x25a7ad[_0x4506('0x5b')]['mapKey'])){throw new db[(_0x4506('0x77'))][(_0x4506('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x340fc7);}_0x2266e2[_0x25a7ad[_0x4506('0x5b')]['mapKey']]=_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')];return db[_0x4506('0x96')][_0x4506('0x59')]({'where':{'id':_0x25a7ad[_0x4506('0x72')][_0x4506('0x97')]},'include':[{'model':db[_0x4506('0x76')],'as':'Contacts','where':_0x2266e2,'limit':0x1,'order':[['updatedAt',_0x4506('0x98')]]}]});})[_0x4506('0x20')](handleEntityNotFound(_0x2e7197,null))[_0x4506('0x20')](function(_0x382853){if(_0x382853){_0x25a7ad[_0x4506('0x99')]=_[_0x4506('0x9a')](_0x382853,[_0x4506('0x9b')]);if(_0x382853[_0x4506('0x9b')]['length']){return _0x382853[_0x4506('0x9b')][0x0];}var _0x139364=_['defaults'](_0x25a7ad[_0x4506('0x5b')],{'firstName':_0x25a7ad['body'][_0x4506('0x7f')],'ListId':_0x382853['id']});_0x139364[_0x25a7ad[_0x4506('0x5b')][_0x4506('0x93')]]=_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')];return db[_0x4506('0x76')][_0x4506('0x5a')](_0x139364,{'fields':_0x5e63ed,'raw':!![]});}})[_0x4506('0x20')](handleEntityNotFound(_0x2e7197,null))[_0x4506('0x20')](function(_0x482d33){if(_0x482d33){_0x25a7ad[_0x4506('0x9c')]=_0x482d33;var _0x50b82f={'ContactId':_0x482d33['id'],'phone':_0x25a7ad['body'][_0x4506('0x7f')],'SmsAccountId':_0x175e1b[_0x4506('0x55')]['id']};var _0x10e2d0={'ContactId':_0x482d33['id'],'SmsAccountId':_0x175e1b[_0x4506('0x55')]['id'],'closed':![]};return db['SmsInteraction'][_0x4506('0x59')]({'where':_0x10e2d0})['then'](function(_0x3577e6){if(_0x3577e6){return[_0x3577e6,![]];}return db[_0x4506('0x9d')][_0x4506('0x5a')](_0x50b82f)[_0x4506('0x20')](function(_0x61ffca){return[_0x61ffca,!![]];});});}})['spread'](function(_0x4c9a13,_0x242e96){_0x25a7ad[_0x4506('0x9e')]=_0x4c9a13[_0x4506('0x35')]({'plain':!![]});_0x25a7ad['interaction'][_0x4506('0x9f')]=![];if(_0x242e96){if(_0x25a7ad[_0x4506('0x72')][_0x4506('0xa0')]){_0x25a7ad['applications'][_0x4506('0xa1')]({'id':0x0,'priority':_0x25a7ad[_0x4506('0x73')]['length']+0x1,'app':_0x4506('0xa2'),'appdata':_0x4506('0xa3'),'interval':_0x4506('0xa4')});}_0x25a7ad[_0x4506('0x9e')][_0x4506('0x9f')]=!![];}return db[_0x4506('0xa5')][_0x4506('0x5a')]({'phone':_0x25a7ad[_0x4506('0x5b')][_0x4506('0x7f')],'messageId':_0x25a7ad[_0x4506('0x5b')]['messageId'],'body':_0x25a7ad[_0x4506('0x5b')][_0x4506('0x5b')],'SmsAccountId':_0x175e1b[_0x4506('0x55')]['id'],'SmsInteractionId':_0x4c9a13['id'],'direction':'in','ContactId':_0x4c9a13['ContactId'],'AttachmentId':_0x25a7ad[_0x4506('0x5b')][_0x4506('0xa6')]});})[_0x4506('0x20')](function(_0x98461c){_0x25a7ad['message']=_0x98461c;if(!_0x25a7ad['interaction'][_0x4506('0xa7')])return;return db[_0x4506('0xa8')][_0x4506('0x59')]({'attributes':['id',_0x4506('0x39')],'where':{'id':_0x25a7ad['interaction']['UserId']}});})[_0x4506('0x20')](function(_0x15fd69){if(_0x15fd69){_0x25a7ad[_0x4506('0x73')][_0x4506('0xa9')]({'id':0x0,'priority':0x0,'app':_0x4506('0xaa'),'appdata':_0x15fd69[_0x4506('0x39')]+','+(_0x25a7ad[_0x4506('0x72')][_0x4506('0xab')]||0xa),'interval':_0x4506('0xa4')});}if(!_0x25a7ad[_0x4506('0x9e')][_0x4506('0xac')])return;return db[_0x4506('0xad')][_0x4506('0x59')]({'attributes':['id',_0x4506('0x39')],'where':{'id':_0x25a7ad[_0x4506('0x9e')]['queueId']}});})['then'](function(_0x22ba35){if(_0x22ba35){_0x25a7ad['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x4506('0xae'),'appdata':_0x22ba35[_0x4506('0x39')]+','+(_0x25a7ad[_0x4506('0x72')][_0x4506('0xaf')]||0x12c),'interval':_0x4506('0xa4')});}return respondWithRpcPromise(_0x4506('0xb0'),_0x4506('0xb1'),_0x25a7ad);})[_0x4506('0x20')](function(_0x4a8733){if(_0x4a8733){var _0x4ab162=0xc8;var _0x4b9fba='receiveMessage';logger[_0x4506('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b9fba,_0x4ab162,_0x4506('0xb2'));logger['debug'](_0x4506('0xb3'),_0x4b9fba,_0x4ab162,_0x4506('0xb2'),JSON[_0x4506('0xb4')](_0x4a8733));if(_0x25a7ad['account'][_0x4506('0x40')]===_0x4506('0x7e')){return _0x2e7197[_0x4506('0x2a')](_0x4ab162)['set'](_0x4506('0xb5'),_0x4506('0xb6'))['send'](_0x4506('0xb7'));}else{return _0x2e7197[_0x4506('0x2a')](_0x4ab162)[_0x4506('0x2b')](_0x4a8733);}}})[_0x4506('0x53')](handleError(_0x2e7197,null));};exports[_0x4506('0xb8')]=function(_0xd968ce,_0x297e81){var _0x4b3fc5=_0xd968ce[_0x4506('0x55')]['id'];var _0x346bcf=_0xd968ce[_0x4506('0x5b')];var _0x12aee2=0xc8;var _0x36cacd=null;return db[_0x4506('0xb9')][_0x4506('0xba')]({'isolationLevel':db['sequelize']['Transaction'][_0x4506('0xbb')]['READ_COMMITTED']},function(_0x347c97){return db[_0x4506('0x3d')][_0x4506('0x66')]({'where':{'id':_0x4b3fc5},'transaction':_0x347c97})[_0x4506('0x20')](function(_0x155530){if(_0x155530){return db[_0x4506('0x70')][_0x4506('0x34')]({'where':{'SmsAccountId':_0x4b3fc5},'transaction':_0x347c97})[_0x4506('0x20')](function(){var _0x140c18=_[_0x4506('0x3c')](_0x346bcf,function(_0x394b9d){_0x394b9d[_0x4506('0x64')]=_0x4b3fc5;return _0x394b9d;});return db[_0x4506('0x70')][_0x4506('0xbc')](_0x140c18,{'transaction':_0x347c97});});}else{_0x12aee2=0x194;_0x36cacd=[];}});})[_0x4506('0x20')](function(){if(_0x12aee2!==0x194){return db[_0x4506('0x70')]['findAndCountAll']({'where':{'SmsAccountId':_0x4b3fc5},'order':'priority'})['then'](function(_0xa5f247){_0x36cacd=_0xa5f247;});}})[_0x4506('0x53')](function(_0x54e3ec){_0x12aee2=0x1f4;logger['error'](_0x54e3ec[_0x4506('0x38')]);if(_0x54e3ec[_0x4506('0x39')]){delete _0x54e3ec[_0x4506('0x39')];}_0x36cacd=_0x54e3ec;})[_0x4506('0xbd')](function(){if(_0x36cacd===null){_0x297e81[_0x4506('0x29')](_0x12aee2);}else{if(_0x12aee2===0x1f4){_0x297e81[_0x4506('0x2a')](_0x12aee2)[_0x4506('0x3a')](_0x36cacd);}else{_0x297e81[_0x4506('0x2a')](_0x12aee2)[_0x4506('0x2b')](_0x36cacd);}}});};exports[_0x4506('0xbe')]=function(_0x443118,_0xca8de5,_0x4dbd68){var _0x4d33a4={};var _0x430b45={};var _0x59ce8e;var _0x85902b;return db[_0x4506('0x3d')][_0x4506('0x66')]({'where':{'id':_0x443118[_0x4506('0x55')]['id']}})[_0x4506('0x20')](handleEntityNotFound(_0xca8de5,null))[_0x4506('0x20')](function(_0x351c38){if(_0x351c38){_0x59ce8e=_0x351c38;_0x430b45['model']=_[_0x4506('0x43')](db[_0x4506('0x70')]['rawAttributes']);_0x430b45[_0x4506('0x42')]=_[_0x4506('0x43')](_0x443118[_0x4506('0x42')]);_0x430b45[_0x4506('0x4c')]=_['intersection'](_0x430b45[_0x4506('0x41')],_0x430b45[_0x4506('0x42')]);_0x4d33a4['attributes']=_[_0x4506('0x44')](_0x430b45[_0x4506('0x41')],qs['fields'](_0x443118[_0x4506('0x42')]['fields']));_0x4d33a4[_0x4506('0x45')]=_0x4d33a4['attributes'][_0x4506('0x47')]?_0x4d33a4[_0x4506('0x45')]:_0x430b45[_0x4506('0x41')];_0x4d33a4[_0x4506('0x67')]=qs[_0x4506('0x4a')](_0x443118[_0x4506('0x42')][_0x4506('0x4a')]);_0x4d33a4['where']=qs[_0x4506('0x4c')](_[_0x4506('0x4d')](_0x443118[_0x4506('0x42')],_0x430b45[_0x4506('0x4c')]));if(_0x443118[_0x4506('0x42')][_0x4506('0x4e')]){_0x4d33a4['where']=_[_0x4506('0x4f')](_0x4d33a4['where'],{'$or':_[_0x4506('0x3c')](_0x4d33a4[_0x4506('0x45')],function(_0x247e19){var _0x26bdc7={};_0x26bdc7[_0x247e19]={'$like':'%'+_0x443118[_0x4506('0x42')]['filter']+'%'};return _0x26bdc7;})});}_0x4d33a4=_[_0x4506('0x4f')]({},_0x4d33a4,_0x443118[_0x4506('0x50')]);return _0x59ce8e[_0x4506('0xbe')](_0x4d33a4);}})[_0x4506('0x20')](function(_0x5038b8){if(_0x5038b8){_0x85902b=_0x5038b8[_0x4506('0x47')];if(!_0x443118['query'][_0x4506('0x48')]('nolimit')){_0x4d33a4[_0x4506('0x2e')]=qs[_0x4506('0x2e')](_0x443118[_0x4506('0x42')][_0x4506('0x2e')]);_0x4d33a4[_0x4506('0x2c')]=qs[_0x4506('0x2c')](_0x443118[_0x4506('0x42')][_0x4506('0x2c')]);}return _0x59ce8e[_0x4506('0xbe')](_0x4d33a4);}})['then'](function(_0x1e1c5d){if(_0x1e1c5d){return _0x1e1c5d?{'count':_0x85902b,'rows':_0x1e1c5d}:null;}})[_0x4506('0x20')](respondWithResult(_0xca8de5,null))[_0x4506('0x53')](handleError(_0xca8de5,null));};exports[_0x4506('0xbf')]=function(_0x410c2e,_0x1a03f1,_0x4bf85d){var _0x45a324={'raw':![],'where':{}};var _0x327700={};var _0x1d89d3={'count':0x0,'rows':[]};return db[_0x4506('0x3d')]['findOne']({'where':{'id':_0x410c2e[_0x4506('0x55')]['id']}})[_0x4506('0x20')](handleEntityNotFound(_0x1a03f1,null))[_0x4506('0x20')](function(_0x4804fd){if(_0x4804fd){_0x327700[_0x4506('0x41')]=_[_0x4506('0x43')](db[_0x4506('0x9d')][_0x4506('0x3e')]);_0x327700[_0x4506('0x42')]=_[_0x4506('0x43')](_0x410c2e[_0x4506('0x42')]);_0x327700[_0x4506('0x4c')]=_[_0x4506('0x44')](_0x327700[_0x4506('0x41')],_0x327700[_0x4506('0x42')]);_0x45a324[_0x4506('0x45')]=_[_0x4506('0x44')](_0x327700[_0x4506('0x41')],qs['fields'](_0x410c2e['query'][_0x4506('0x46')]));_0x45a324[_0x4506('0x45')]=_0x45a324[_0x4506('0x45')]['length']?_0x45a324['attributes']:_0x327700[_0x4506('0x41')];if(!_0x410c2e[_0x4506('0x42')][_0x4506('0x48')](_0x4506('0x49'))){_0x45a324[_0x4506('0x2e')]=qs[_0x4506('0x2e')](_0x410c2e[_0x4506('0x42')]['limit']);_0x45a324[_0x4506('0x2c')]=qs[_0x4506('0x2c')](_0x410c2e[_0x4506('0x42')][_0x4506('0x2c')]);}_0x45a324['order']=qs['sort'](_0x410c2e[_0x4506('0x42')][_0x4506('0x4a')]);_0x45a324[_0x4506('0x4b')]=qs[_0x4506('0x4c')](_['pick'](_0x410c2e[_0x4506('0x42')],_0x327700[_0x4506('0x4c')]));_0x45a324[_0x4506('0x4b')][_0x4506('0x64')]=_0x4804fd['id'];if(_0x410c2e[_0x4506('0x42')][_0x4506('0x4e')]){_0x45a324['where']=_['merge'](_0x45a324['where'],{'$or':_[_0x4506('0x3c')](_0x45a324[_0x4506('0x45')],function(_0x38f405){var _0x278c2b={};_0x278c2b[_0x38f405]={'$like':'%'+_0x410c2e[_0x4506('0x42')][_0x4506('0x4e')]+'%'};return _0x278c2b;})});}_0x45a324=_[_0x4506('0x4f')]({},_0x45a324,_0x410c2e[_0x4506('0x50')]);return db[_0x4506('0x9d')][_0x4506('0x2f')]({'where':_0x45a324[_0x4506('0x4b')]})['then'](function(_0x28fce1){_0x1d89d3[_0x4506('0x2f')]=_0x28fce1;if(_0x410c2e['query'][_0x4506('0x58')]){_0x45a324[_0x4506('0x51')]=[{'model':db['CmContact'],'as':_0x4506('0xc0'),'required':![]},{'model':db[_0x4506('0xa8')],'as':_0x4506('0xc1'),'attributes':[_0x4506('0x39'),_0x4506('0xc2'),_0x4506('0xc3')],'required':![]},{'model':db[_0x4506('0xc4')],'as':_0x4506('0xc5'),'attributes':['id',_0x4506('0x39'),_0x4506('0xc6')],'where':_0x410c2e[_0x4506('0x42')]['tag']?{'id':_0x410c2e[_0x4506('0x42')][_0x4506('0xc7')]}:undefined,'required':_0x410c2e[_0x4506('0x42')]['tag']?!![]:![]}];}return db[_0x4506('0x9d')][_0x4506('0x6d')](_0x45a324);})['then'](function(_0x154343){_0x1d89d3['rows']=_0x154343;return _0x1d89d3;});}})[_0x4506('0x20')](respondWithFilteredResult(_0x1a03f1,_0x45a324))[_0x4506('0x53')](handleError(_0x1a03f1,null));};exports[_0x4506('0x3a')]=function(_0x27828f,_0x2127d9,_0xafa51e){var _0x265d38,_0x111cc8,_0x3dfeaa;if(_['isNil'](_0x27828f['body'][_0x4506('0x5b')])||_0x27828f['body'][_0x4506('0x5b')]===''){throw new db['Sequelize'][(_0x4506('0x78'))](_0x4506('0xc8'));}if(_['isNil'](_0x27828f[_0x4506('0x5b')]['to'])){throw new db[(_0x4506('0x77'))][(_0x4506('0x78'))](_0x4506('0xc9'));}_0x265d38=_0x27828f[_0x4506('0x5b')]['to'];return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x27828f[_0x4506('0x55')]['id']},'include':[{'model':db[_0x4506('0x96')],'as':_0x4506('0xca'),'include':[{'model':db['CmContact'],'as':_0x4506('0x9b'),'where':{'mobile':_0x265d38},'limit':0x1,'order':[[_0x4506('0x7b'),_0x4506('0x98')]]}]}]})['then'](handleEntityNotFound(_0x2127d9,null))[_0x4506('0x20')](function(_0x328379){if(_0x328379&&_0x328379[_0x4506('0xca')]){_0x111cc8=_0x328379[_0x4506('0x35')]({'plain':!![]});if(_0x111cc8[_0x4506('0xca')]&&_0x111cc8[_0x4506('0xca')][_0x4506('0x9b')]['length']){return _0x111cc8['List'][_0x4506('0x9b')][0x0];}return db['CmContact'][_0x4506('0x5a')](_[_0x4506('0x1a')](_0x27828f['body'],{'firstName':_0x265d38,'mobile':_0x265d38,'phone':_0x265d38,'ListId':_0x111cc8[_0x4506('0x97')]}));}})[_0x4506('0x20')](handleEntityNotFound(_0x2127d9,null))['then'](function(_0x287a3f){if(_0x287a3f){_0x3dfeaa=_0x287a3f;return db[_0x4506('0x9d')][_0x4506('0x59')]({'where':{'ContactId':_0x3dfeaa['id'],'closed':![],'SmsAccountId':_0x111cc8['id']}})['then'](function(_0x16f92d){if(_0x16f92d){return[_0x16f92d,![]];}return db['SmsInteraction'][_0x4506('0x5a')]({'UserId':_0x27828f[_0x4506('0x5c')]['id'],'ContactId':_0x3dfeaa['id'],'SmsAccountId':_0x111cc8['id'],'phone':_0x265d38,'firstMsgDirection':_0x4506('0xcb'),'Messages':[_[_0x4506('0x4f')](_0x27828f[_0x4506('0x5b')],{'read':![],'body':_0x27828f[_0x4506('0x5b')][_0x4506('0x5b')],'phone':_0x265d38,'SmsAccountId':_0x111cc8['id'],'UserId':_0x27828f[_0x4506('0x5c')]['id'],'ContactId':_0x3dfeaa['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x4506('0xcc')}]})['then'](function(_0x23f9e4){return[_0x23f9e4,!![]];});});}})[_0x4506('0xcd')](function(_0xcb020,_0x39391f){if(_0x39391f){return _0xcb020;}return db[_0x4506('0xa5')][_0x4506('0x5a')](_[_0x4506('0x4f')](_0x27828f[_0x4506('0x5b')],{'read':![],'body':_0x27828f[_0x4506('0x5b')][_0x4506('0x5b')],'phone':_0x265d38,'SmsAccountId':_0x111cc8['id'],'SmsInteractionId':_0xcb020['id'],'UserId':_0x27828f[_0x4506('0x5c')]['id'],'ContactId':_0x3dfeaa['id']}))['then'](function(_0x157300){_0xcb020[_0x4506('0xce')]['Messages']=[];_0xcb020[_0x4506('0xce')]['Messages'][_0x4506('0xa1')](_0x157300[_0x4506('0xce')]);return _0xcb020;});})[_0x4506('0x20')](respondWithResult(_0x2127d9,null))['catch'](handleError(_0x2127d9,null));};exports['status']=function(_0x472a10,_0x2822b7,_0x39e105){if(_0x472a10[_0x4506('0x5b')]['id']){delete _0x472a10['body']['id'];}var _0x75f9ee,_0x38670a,_0x2874c2;return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x472a10[_0x4506('0x55')]['id']}})['then'](handleEntityNotFound(_0x2822b7,null))[_0x4506('0x20')](function(_0x22bc82){if(_0x22bc82){_0x2874c2=_0x22bc82;logger[_0x4506('0xcf')](_0x4506('0x24'),_0x4506('0x2a'),_0x4506('0xd0'),_0x22bc82[_0x4506('0x40')],util[_0x4506('0xd1')](_0x472a10[_0x4506('0x5b')],{'showHidden':![],'depth':null}));switch(_0x22bc82[_0x4506('0x40')]){case'skebby':if(_0x472a10[_0x4506('0x5b')][_0x4506('0xd2')]&&_0x472a10[_0x4506('0x5b')][_0x4506('0x2a')]){_0x38670a=_0x472a10[_0x4506('0x5b')][_0x4506('0x2a')];return db[_0x4506('0xa5')][_0x4506('0x59')]({'where':{'messageId':_0x472a10[_0x4506('0x5b')][_0x4506('0xd2')]}});}break;case _0x4506('0x85'):if(_0x472a10['body'][_0x4506('0xd3')]&&_0x472a10[_0x4506('0x5b')][_0x4506('0xd4')]){_0x38670a=_0x472a10['body'][_0x4506('0xd4')];return db[_0x4506('0xa5')][_0x4506('0x59')]({'where':{'messageId':_0x472a10[_0x4506('0x5b')]['requestid']}});}break;case _0x4506('0x86'):if(_0x472a10['body'][_0x4506('0x87')]&&_0x472a10[_0x4506('0x5b')][_0x4506('0xd5')]){_0x38670a=_0x472a10[_0x4506('0x5b')][_0x4506('0xd5')];return db[_0x4506('0xa5')][_0x4506('0x59')]({'where':{'messageId':_0x472a10[_0x4506('0x5b')]['message_id']}});}break;case _0x4506('0x8a'):var _0x903614=_0x472a10[_0x4506('0x5b')][_0x4506('0x8b')][0x0];if(_0x903614['messageId']&&_0x903614[_0x4506('0x2a')][_0x4506('0xd6')]===_0x4506('0xd7')){_0x38670a=_0x903614[_0x4506('0x2a')]['groupName'];return db[_0x4506('0xa5')][_0x4506('0x59')]({'where':{'messageId':_0x903614['messageId']}});}break;case _0x4506('0xd8'):if(_0x472a10[_0x4506('0x5b')]['messageId']&&_0x472a10[_0x4506('0x5b')][_0x4506('0x2a')]){_0x38670a=_0x472a10['body'][_0x4506('0x2a')];return db[_0x4506('0xa5')]['find']({'where':{'messageId':_0x472a10[_0x4506('0x5b')][_0x4506('0x81')]}});}break;case _0x4506('0x8f'):if(_0x472a10[_0x4506('0x5b')][0x0][_0x4506('0x27')]['id']){_0x38670a=_0x472a10[_0x4506('0x5b')][0x0][_0x4506('0x40')];return db[_0x4506('0xa5')]['find']({'where':{'messageId':_0x472a10[_0x4506('0x5b')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x472a10['body']['redif']&&_0x472a10['body'][_0x4506('0x2a')]){_0x38670a=_0x472a10['body'][_0x4506('0x2a')];return db[_0x4506('0xa5')][_0x4506('0x59')]({'where':{'messageId':_0x472a10['body'][_0x4506('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x2822b7,null))[_0x4506('0x20')](function(_0x47f27b){if(_0x47f27b){_0x75f9ee=_0x47f27b;switch(_0x2874c2['type']){case _0x4506('0x82'):if(_0x38670a===_0x4506('0xd7')){return _0x75f9ee['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4506('0x82'),util[_0x4506('0xd1')](_0x472a10[_0x4506('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4506('0x85'):if(_0x38670a==='1'){return _0x75f9ee['update']({'read':!![]});}else{logger['error'](_0x4506('0x24'),_0x4506('0x2a'),'skebby',util[_0x4506('0xd1')](_0x472a10[_0x4506('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4506('0x86'):if(!_0x472a10[_0x4506('0x5b')]['error_code']&&_0x38670a>=0xc8&&_0x38670a<=0xce){return _0x75f9ee[_0x4506('0x61')]({'read':!![]});}else{logger[_0x4506('0x25')](_0x4506('0x24'),_0x4506('0x2a'),_0x4506('0x86'),util[_0x4506('0xd1')](_0x472a10[_0x4506('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4506('0x8a'):var _0x1ee2b4=_0x472a10[_0x4506('0x5b')]['results'][0x0];if(_0x1ee2b4[_0x4506('0x2a')][_0x4506('0xd6')]===_0x4506('0xd7')){return _0x75f9ee[_0x4506('0x61')]({'read':!![]});}else{logger[_0x4506('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4506('0x2a'),'infobip',util[_0x4506('0xd1')](_0x472a10['body'],{'showHidden':![],'depth':null}));}break;case _0x4506('0xd8'):if(_0x38670a=='DELIVERED_TO_GATEWAY'||_0x38670a==_0x4506('0xda')){return _0x75f9ee[_0x4506('0x61')]({'read':!![]});}else{logger[_0x4506('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4506('0xd8'),util[_0x4506('0xd1')](_0x472a10[_0x4506('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4506('0x8f'):if(_0x38670a==_0x4506('0xdb')){return _0x75f9ee['update']({'read':!![]});}else{logger[_0x4506('0x25')](_0x4506('0x24'),_0x4506('0x2a'),_0x4506('0x8f'),util[_0x4506('0xd1')](_0x472a10[_0x4506('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4506('0x90'):if(_0x38670a===_0x4506('0xdc')||_0x38670a===_0x4506('0xdd')){return _0x75f9ee[_0x4506('0x61')]({'read':!![]});}else{logger[_0x4506('0x25')](_0x4506('0x24'),'status',_0x4506('0x90'),util[_0x4506('0xd1')](_0x472a10[_0x4506('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x75f9ee;}})[_0x4506('0x20')](respondWithResult(_0x2822b7,null))[_0x4506('0x53')](handleError(_0x2822b7,null));};exports[_0x4506('0xde')]=function(_0x45a74e,_0x2783e2,_0x3c4880){var _0x3f30be,_0x29d697,_0x442ebb;return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x45a74e[_0x4506('0x55')]['id']}})[_0x4506('0x20')](handleEntityNotFound(_0x2783e2,null))[_0x4506('0x20')](function(_0x36da1c){if(_0x36da1c){_0x442ebb=_0x36da1c;logger[_0x4506('0xcf')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4506('0x2a'),'received\x20delivery\x20report\x20from',_0x36da1c['type'],util[_0x4506('0xd1')](_0x45a74e[_0x4506('0x42')],{'showHidden':![],'depth':null}));switch(_0x36da1c['type']){case _0x4506('0xdf'):if(_0x45a74e['query']['message-id']&&_0x45a74e[_0x4506('0x42')][_0x4506('0xe0')]){_0x29d697=_0x45a74e[_0x4506('0x42')][_0x4506('0xe0')];return db[_0x4506('0xa5')][_0x4506('0x59')]({'where':{'messageId':_0x45a74e[_0x4506('0x42')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x2783e2,null))[_0x4506('0x20')](function(_0x62d69c){if(_0x62d69c){_0x3f30be=_0x62d69c;switch(_0x442ebb[_0x4506('0x40')]){case'csc':if(_0x29d697==='2'||_0x29d697==='6'){return _0x3f30be[_0x4506('0x61')]({'read':!![]});}else{logger[_0x4506('0x25')](_0x4506('0x24'),'status',_0x4506('0xdf'),util[_0x4506('0xd1')](_0x45a74e['query'],{'showHidden':![],'depth':null}));};break;}return _0x3f30be;}})[_0x4506('0x20')](respondWithResult(_0x2783e2,null))[_0x4506('0x53')](handleError(_0x2783e2,null));};exports[_0x4506('0xe1')]=function(_0x13ca86,_0x333f98,_0x34f870){return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x13ca86['params']['id']}})[_0x4506('0x20')](handleEntityNotFound(_0x333f98,null))[_0x4506('0x20')](function(_0x2ae36d){if(_0x2ae36d){return _0x2ae36d[_0x4506('0xe1')](_0x13ca86[_0x4506('0x5b')][_0x4506('0x69')],_[_0x4506('0x9a')](_0x13ca86[_0x4506('0x5b')],[_0x4506('0x69'),'id'])||{})[_0x4506('0xcd')](function(_0xbaa224){for(var _0x105402=0x0;_0x105402<_0x13ca86['body']['ids']['length'];_0x105402+=0x1){socket['emit'](_0x4506('0xe2'),{'UserId':Number(_0x13ca86[_0x4506('0x5b')][_0x4506('0x69')][_0x105402]),'SmsAccountId':Number(_0x13ca86[_0x4506('0x55')]['id'])});}return _0xbaa224;});}})[_0x4506('0x20')](respondWithResult(_0x333f98,null))[_0x4506('0x53')](handleError(_0x333f98,null));};exports['removeAgents']=function(_0x5f242c,_0x5207c1,_0x4d8cf3){return db[_0x4506('0x3d')][_0x4506('0x59')]({'where':{'id':_0x5f242c[_0x4506('0x55')]['id']}})['then'](handleEntityNotFound(_0x5207c1,null))[_0x4506('0x20')](function(_0x1ce151){if(_0x1ce151){return _0x1ce151[_0x4506('0xe3')](_0x5f242c[_0x4506('0x42')][_0x4506('0x69')])['then'](function(){if(_[_0x4506('0xe4')](_0x5f242c['query'][_0x4506('0x69')])){for(var _0x403e37=0x0;_0x403e37<_0x5f242c['query'][_0x4506('0x69')][_0x4506('0x47')];_0x403e37+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x5f242c['query'][_0x4506('0x69')][_0x403e37]),'SmsAccountId':Number(_0x5f242c[_0x4506('0x55')]['id'])});}}else{socket[_0x4506('0xe5')]('userSmsAccount:remove',{'UserId':Number(_0x5f242c['query'][_0x4506('0x69')]),'SmsAccountId':Number(_0x5f242c[_0x4506('0x55')]['id'])});}});}})[_0x4506('0x20')](respondWithStatusCode(_0x5207c1,null))[_0x4506('0x53')](handleError(_0x5207c1,null));};exports[_0x4506('0xe6')]=function(_0x187d13,_0x5e011f,_0xa38759){var _0x23f16d={};var _0x2ee1a6={};var _0x5f1aee;var _0x37875b;return db[_0x4506('0x3d')]['findOne']({'where':{'id':_0x187d13[_0x4506('0x55')]['id']}})[_0x4506('0x20')](handleEntityNotFound(_0x5e011f,null))['then'](function(_0x581848){if(_0x581848){_0x5f1aee=_0x581848;_0x2ee1a6[_0x4506('0x41')]=_[_0x4506('0x43')](db[_0x4506('0xa8')][_0x4506('0x3e')]);_0x2ee1a6[_0x4506('0x42')]=_['keys'](_0x187d13[_0x4506('0x42')]);_0x2ee1a6['filters']=_['intersection'](_0x2ee1a6[_0x4506('0x41')],_0x2ee1a6['query']);_0x23f16d[_0x4506('0x45')]=_[_0x4506('0x44')](_0x2ee1a6[_0x4506('0x41')],qs['fields'](_0x187d13['query']['fields']));_0x23f16d['attributes']=_0x23f16d[_0x4506('0x45')][_0x4506('0x47')]?_0x23f16d[_0x4506('0x45')]:_0x2ee1a6[_0x4506('0x41')];_0x23f16d['order']=qs[_0x4506('0x4a')](_0x187d13['query'][_0x4506('0x4a')]);_0x23f16d[_0x4506('0x4b')]=qs['filters'](_[_0x4506('0x4d')](_0x187d13[_0x4506('0x42')],_0x2ee1a6[_0x4506('0x4c')]));if(_0x187d13[_0x4506('0x42')][_0x4506('0x4e')]){_0x23f16d[_0x4506('0x4b')]=_[_0x4506('0x4f')](_0x23f16d['where'],{'$or':_[_0x4506('0x3c')](_0x23f16d[_0x4506('0x45')],function(_0x5ef456){var _0x1c821e={};_0x1c821e[_0x5ef456]={'$like':'%'+_0x187d13[_0x4506('0x42')][_0x4506('0x4e')]+'%'};return _0x1c821e;})});}_0x23f16d=_[_0x4506('0x4f')]({},_0x23f16d,_0x187d13['options']);return _0x5f1aee[_0x4506('0xe6')](_0x23f16d);}})['then'](function(_0x3a887c){if(_0x3a887c){_0x37875b=_0x3a887c[_0x4506('0x47')];if(!_0x187d13[_0x4506('0x42')][_0x4506('0x48')]('nolimit')){_0x23f16d['limit']=qs['limit'](_0x187d13[_0x4506('0x42')][_0x4506('0x2e')]);_0x23f16d[_0x4506('0x2c')]=qs[_0x4506('0x2c')](_0x187d13[_0x4506('0x42')][_0x4506('0x2c')]);}return _0x5f1aee[_0x4506('0xe6')](_0x23f16d);}})['then'](function(_0x488647){if(_0x488647){return _0x488647?{'count':_0x37875b,'rows':_0x488647}:null;}})[_0x4506('0x20')](respondWithResult(_0x5e011f,null))[_0x4506('0x53')](handleError(_0x5e011f,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 6f3e37b..ca342ac 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 _0x589c=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','save'];(function(_0x13b088,_0x4d981b){var _0x1e9229=function(_0x41f446){while(--_0x41f446){_0x13b088['push'](_0x13b088['shift']());}};_0x1e9229(++_0x4d981b);}(_0x589c,0x149));var _0xc589=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x589c[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xc589('0x0'));var SmsAccount=require(_0xc589('0x1'))['db'][_0xc589('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc589('0x3'),'afterUpdate':_0xc589('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc3dda8){return function(_0x77fbd2,_0x5d44ca,_0x4af8c5){SmsAccountEvents[_0xc589('0x5')](_0xc3dda8+':'+_0x77fbd2['id'],_0x77fbd2);SmsAccountEvents[_0xc589('0x5')](_0xc3dda8,_0x77fbd2);_0x4af8c5(null);};}for(var e in events){if(events[_0xc589('0x6')](e)){var event=events[e];SmsAccount[_0xc589('0x7')](e,emitEvent(event));}}module[_0xc589('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xa707=['events','../../mysqldb','save','emit','hasOwnProperty','exports'];(function(_0x459774,_0x1968bc){var _0x3296f2=function(_0x147e7f){while(--_0x147e7f){_0x459774['push'](_0x459774['shift']());}};_0x3296f2(++_0x1968bc);}(_0xa707,0x102));var _0x7a70=function(_0x145241,_0x52345e){_0x145241=_0x145241-0x0;var _0x7689d3=_0xa707[_0x145241];return _0x7689d3;};'use strict';var EventEmitter=require(_0x7a70('0x0'));var SmsAccount=require(_0x7a70('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a70('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c328e){return function(_0x382fda,_0x678430,_0x477bb3){SmsAccountEvents[_0x7a70('0x3')](_0x1c328e+':'+_0x382fda['id'],_0x382fda);SmsAccountEvents['emit'](_0x1c328e,_0x382fda);_0x477bb3(null);};}for(var e in events){if(events[_0x7a70('0x4')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x7a70('0x5')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d585057..5d4080b 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 _0xbcdd=['moment','bluebird','path','../../config/environment','./smsAccount.attributes','exports','SmsAccount','../../config/logger','api'];(function(_0x2b722a,_0x296059){var _0x3259e1=function(_0x1f6ce2){while(--_0x1f6ce2){_0x2b722a['push'](_0x2b722a['shift']());}};_0x3259e1(++_0x296059);}(_0xbcdd,0x142));var _0xdbcd=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0xbcdd[_0x27c068];return _0xe5a67f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdbcd('0x0'))(_0xdbcd('0x1'));var moment=require(_0xdbcd('0x2'));var BPromise=require(_0xdbcd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbcd('0x4'));var rimraf=require('rimraf');var config=require(_0xdbcd('0x5'));var attributes=require(_0xdbcd('0x6'));module[_0xdbcd('0x7')]=function(_0x1e4715,_0x16db5c){return _0x1e4715['define'](_0xdbcd('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3988=['exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x23ac95,_0x1823aa){var _0x5e27b4=function(_0x4dcd47){while(--_0x4dcd47){_0x23ac95['push'](_0x23ac95['shift']());}};_0x5e27b4(++_0x1823aa);}(_0x3988,0x1e5));var _0x8398=function(_0x263f88,_0x57149e){_0x263f88=_0x263f88-0x0;var _0x5ef6e0=_0x3988[_0x263f88];return _0x5ef6e0;};'use strict';var _=require(_0x8398('0x0'));var util=require('util');var logger=require(_0x8398('0x1'))(_0x8398('0x2'));var moment=require(_0x8398('0x3'));var BPromise=require('bluebird');var rp=require(_0x8398('0x4'));var fs=require('fs');var path=require(_0x8398('0x5'));var rimraf=require(_0x8398('0x6'));var config=require(_0x8398('0x7'));var attributes=require(_0x8398('0x8'));module[_0x8398('0x9')]=function(_0x2abaa4,_0x3c9624){return _0x2abaa4[_0x8398('0xa')](_0x8398('0xb'),attributes,{'tableName':_0x8398('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index ad57438..00173a6 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 _0xb4f5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','SmsAccount','find','options','raw','attributes','include','model','map','catch','ShowSmsAccount','lodash'];(function(_0x19c1f8,_0x29140b){var _0x421a55=function(_0x39b3c5){while(--_0x39b3c5){_0x19c1f8['push'](_0x19c1f8['shift']());}};_0x421a55(++_0x29140b);}(_0xb4f5,0xb8));var _0x5b4f=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0xb4f5[_0x2cacef];return _0x289ba6;};'use strict';var _=require(_0x5b4f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5b4f('0x1'));var rs=require(_0x5b4f('0x2'));var fs=require('fs');var Redis=require(_0x5b4f('0x3'));var db=require(_0x5b4f('0x4'))['db'];var utils=require(_0x5b4f('0x5'));var logger=require(_0x5b4f('0x6'))(_0x5b4f('0x7'));var config=require(_0x5b4f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b4f('0x9')][_0x5b4f('0xa')]({'port':0x232a});config[_0x5b4f('0xb')]=_[_0x5b4f('0xc')](config[_0x5b4f('0xb')],{'host':_0x5b4f('0xd'),'port':0x18eb});var socket=require(_0x5b4f('0xe'))(new Redis(config[_0x5b4f('0xb')]));require('./smsAccount.socket')[_0x5b4f('0xf')](socket);function respondWithRpcPromise(_0x1ff894,_0x133f48,_0x5efefd){return new BPromise(function(_0x120ce8,_0x597330){return client[_0x5b4f('0x10')](_0x1ff894,_0x5efefd)[_0x5b4f('0x11')](function(_0x541a10){logger[_0x5b4f('0x12')](_0x5b4f('0x13'),_0x133f48,'request\x20sent');logger[_0x5b4f('0x14')](_0x5b4f('0x15'),_0x133f48,'request\x20sent',JSON[_0x5b4f('0x16')](_0x541a10));if(_0x541a10['error']){if(_0x541a10['error'][_0x5b4f('0x17')]===0x1f4){logger[_0x5b4f('0x18')](_0x5b4f('0x13'),_0x133f48,_0x541a10[_0x5b4f('0x18')][_0x5b4f('0x19')]);return _0x597330(_0x541a10[_0x5b4f('0x18')][_0x5b4f('0x19')]);}logger[_0x5b4f('0x18')](_0x5b4f('0x13'),_0x133f48,_0x541a10['error']['message']);return _0x120ce8(_0x541a10[_0x5b4f('0x18')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x133f48,'request\x20sent');_0x120ce8(_0x541a10[_0x5b4f('0x1a')]['message']);}})['catch'](function(_0x4ce879){logger['error']('SmsAccount,\x20%s,\x20%s',_0x133f48,_0x4ce879);_0x597330(_0x4ce879);});});}exports['ShowSmsAccount']=function(_0x42dbaf){var _0x1d20e3=this;return new Promise(function(_0x3b17c3,_0x34745d){return db[_0x5b4f('0x1b')][_0x5b4f('0x1c')]({'raw':_0x42dbaf[_0x5b4f('0x1d')]?_0x42dbaf[_0x5b4f('0x1d')][_0x5b4f('0x1e')]===undefined?!![]:![]:!![],'where':_0x42dbaf[_0x5b4f('0x1d')]?_0x42dbaf['options']['where']||null:null,'attributes':_0x42dbaf[_0x5b4f('0x1d')]?_0x42dbaf['options'][_0x5b4f('0x1f')]||null:null,'include':_0x42dbaf[_0x5b4f('0x1d')]?_0x42dbaf[_0x5b4f('0x1d')][_0x5b4f('0x20')]?_['map'](_0x42dbaf[_0x5b4f('0x1d')]['include'],function(_0x200792){return{'model':db[_0x200792[_0x5b4f('0x21')]],'as':_0x200792['as'],'attributes':_0x200792[_0x5b4f('0x1f')],'include':_0x200792[_0x5b4f('0x20')]?_[_0x5b4f('0x22')](_0x200792['include'],function(_0x25a79d){return{'model':db[_0x25a79d[_0x5b4f('0x21')]],'as':_0x25a79d['as'],'attributes':_0x25a79d['attributes'],'include':_0x25a79d[_0x5b4f('0x20')]?_[_0x5b4f('0x22')](_0x25a79d[_0x5b4f('0x20')],function(_0x5d3749){return{'model':db[_0x5d3749['model']],'as':_0x5d3749['as'],'attributes':_0x5d3749[_0x5b4f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5b4f('0x11')](function(_0x1fa149){logger['info']('ShowSmsAccount',_0x42dbaf);logger[_0x5b4f('0x14')]('ShowSmsAccount',_0x42dbaf,JSON['stringify'](_0x1fa149));_0x3b17c3(_0x1fa149);})[_0x5b4f('0x23')](function(_0x1b5e3a){logger[_0x5b4f('0x18')](_0x5b4f('0x24'),_0x1b5e3a[_0x5b4f('0x19')],_0x42dbaf);_0x34745d(_0x1d20e3[_0x5b4f('0x18')](0x1f4,_0x1b5e3a[_0x5b4f('0x19')]));});});}; \ No newline at end of file +var _0x6b39=['http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','raw','options','where','include','map','model','attributes','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0xad5879,_0x332433){var _0x16c7e1=function(_0x277488){while(--_0x277488){_0xad5879['push'](_0xad5879['shift']());}};_0x16c7e1(++_0x332433);}(_0x6b39,0x156));var _0x96b3=function(_0xca5e7d,_0xd2bf69){_0xca5e7d=_0xca5e7d-0x0;var _0x4fa0cf=_0x6b39[_0xca5e7d];return _0x4fa0cf;};'use strict';var _=require(_0x96b3('0x0'));var util=require(_0x96b3('0x1'));var moment=require(_0x96b3('0x2'));var BPromise=require(_0x96b3('0x3'));var rs=require(_0x96b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96b3('0x5'))['db'];var utils=require(_0x96b3('0x6'));var logger=require(_0x96b3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x96b3('0x8')][_0x96b3('0x9')]({'port':0x232a});config[_0x96b3('0xa')]=_[_0x96b3('0xb')](config[_0x96b3('0xa')],{'host':_0x96b3('0xc'),'port':0x18eb});var socket=require(_0x96b3('0xd'))(new Redis(config[_0x96b3('0xa')]));require(_0x96b3('0xe'))[_0x96b3('0xf')](socket);function respondWithRpcPromise(_0xec26b0,_0x10b3e7,_0x15d052){return new BPromise(function(_0x50af13,_0x2b8b34){return client[_0x96b3('0x10')](_0xec26b0,_0x15d052)[_0x96b3('0x11')](function(_0x1efd89){logger[_0x96b3('0x12')](_0x96b3('0x13'),_0x10b3e7,_0x96b3('0x14'));logger['debug'](_0x96b3('0x15'),_0x10b3e7,_0x96b3('0x14'),JSON[_0x96b3('0x16')](_0x1efd89));if(_0x1efd89[_0x96b3('0x17')]){if(_0x1efd89[_0x96b3('0x17')][_0x96b3('0x18')]===0x1f4){logger[_0x96b3('0x17')](_0x96b3('0x13'),_0x10b3e7,_0x1efd89[_0x96b3('0x17')][_0x96b3('0x19')]);return _0x2b8b34(_0x1efd89[_0x96b3('0x17')][_0x96b3('0x19')]);}logger['error'](_0x96b3('0x13'),_0x10b3e7,_0x1efd89[_0x96b3('0x17')][_0x96b3('0x19')]);return _0x50af13(_0x1efd89[_0x96b3('0x17')][_0x96b3('0x19')]);}else{logger[_0x96b3('0x12')]('SmsAccount,\x20%s,\x20%s',_0x10b3e7,_0x96b3('0x14'));_0x50af13(_0x1efd89[_0x96b3('0x1a')][_0x96b3('0x19')]);}})[_0x96b3('0x1b')](function(_0x1ab220){logger['error'](_0x96b3('0x13'),_0x10b3e7,_0x1ab220);_0x2b8b34(_0x1ab220);});});}exports[_0x96b3('0x1c')]=function(_0x14684f){var _0x2d9fb0=this;return new Promise(function(_0x3e521f,_0x406c90){return db[_0x96b3('0x1d')][_0x96b3('0x1e')]({'raw':_0x14684f['options']?_0x14684f['options'][_0x96b3('0x1f')]===undefined?!![]:![]:!![],'where':_0x14684f['options']?_0x14684f[_0x96b3('0x20')][_0x96b3('0x21')]||null:null,'attributes':_0x14684f[_0x96b3('0x20')]?_0x14684f[_0x96b3('0x20')]['attributes']||null:null,'include':_0x14684f[_0x96b3('0x20')]?_0x14684f[_0x96b3('0x20')][_0x96b3('0x22')]?_[_0x96b3('0x23')](_0x14684f['options']['include'],function(_0x18ffc7){return{'model':db[_0x18ffc7[_0x96b3('0x24')]],'as':_0x18ffc7['as'],'attributes':_0x18ffc7[_0x96b3('0x25')],'include':_0x18ffc7[_0x96b3('0x22')]?_[_0x96b3('0x23')](_0x18ffc7[_0x96b3('0x22')],function(_0x2db20a){return{'model':db[_0x2db20a['model']],'as':_0x2db20a['as'],'attributes':_0x2db20a['attributes'],'include':_0x2db20a['include']?_[_0x96b3('0x23')](_0x2db20a['include'],function(_0x7c8139){return{'model':db[_0x7c8139[_0x96b3('0x24')]],'as':_0x7c8139['as'],'attributes':_0x7c8139['attributes']};}):[]};}):[]};}):[]:[]})[_0x96b3('0x11')](function(_0x1a2b3d){logger[_0x96b3('0x12')](_0x96b3('0x1c'),_0x14684f);logger[_0x96b3('0x26')]('ShowSmsAccount',_0x14684f,JSON[_0x96b3('0x16')](_0x1a2b3d));_0x3e521f(_0x1a2b3d);})[_0x96b3('0x1b')](function(_0x4e3389){logger['error'](_0x96b3('0x1c'),_0x4e3389[_0x96b3('0x19')],_0x14684f);_0x406c90(_0x2d9fb0[_0x96b3('0x17')](0x1f4,_0x4e3389[_0x96b3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0fb83e9..cff2d3e 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 5b300de..97c5d12 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0xd53c58,_0x2df2d6){var _0xbde786=function(_0x2c0c40){while(--_0x2c0c40){_0xd53c58['push'](_0xd53c58['shift']());}};_0xbde786(++_0x2df2d6);}(_0x008c,0x188));var _0xc008=function(_0x3b1bba,_0x220536){_0x3b1bba=_0x3b1bba-0x0;var _0x4ca374=_0x008c[_0x3b1bba];return _0x4ca374;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _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(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x34e8,0x12c));var _0x834e=function(_0xd21a67,_0x5d447a){_0xd21a67=_0xd21a67-0x0;var _0xf9fcb0=_0x34e8[_0xd21a67];return _0xf9fcb0;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index b73b37f..bcd2e8d 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 _0x3208=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x168944,_0x519239){var _0x3a9fdd=function(_0x1f9bf2){while(--_0x1f9bf2){_0x168944['push'](_0x168944['shift']());}};_0x3a9fdd(++_0x519239);}(_0x3208,0x121));var _0x8320=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3208[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x8320('0x0'));module[_0x8320('0x1')]={'priority':{'type':Sequelize[_0x8320('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8320('0x3')],'allowNull':![],'defaultValue':_0x8320('0x4')},'appdata':{'type':Sequelize[_0x8320('0x5')]()},'description':{'type':Sequelize[_0x8320('0x3')]},'interval':{'type':Sequelize[_0x8320('0x3')],'defaultValue':_0x8320('0x6')}}; \ No newline at end of file +var _0x05f3=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x313420,_0x36785d){var _0x331b8a=function(_0x31a169){while(--_0x31a169){_0x313420['push'](_0x313420['shift']());}};_0x331b8a(++_0x36785d);}(_0x05f3,0x6d));var _0x305f=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x05f3[_0x18b5e8];return _0x25baed;};'use strict';var Sequelize=require(_0x305f('0x0'));module['exports']={'priority':{'type':Sequelize[_0x305f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x305f('0x2')],'allowNull':![],'defaultValue':_0x305f('0x3')},'appdata':{'type':Sequelize[_0x305f('0x4')]()},'description':{'type':Sequelize[_0x305f('0x2')]},'interval':{'type':Sequelize[_0x305f('0x2')],'defaultValue':_0x305f('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 9083212..5fa27fd 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 _0x7f28=['save','then','destroy','error','stack','name','index','SmsApplication','type','key','model','map','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','include','rows','params','keys','rawAttributes','includeAll','find','catch','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x1c5976,_0x409f3d){var _0x350ea1=function(_0x3f7658){while(--_0x3f7658){_0x1c5976['push'](_0x1c5976['shift']());}};_0x350ea1(++_0x409f3d);}(_0x7f28,0xae));var _0x87f2=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7f28[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x87f2('0x0'));var rimraf=require(_0x87f2('0x1'));var zipdir=require(_0x87f2('0x2'));var jsonpatch=require(_0x87f2('0x3'));var rp=require(_0x87f2('0x4'));var moment=require(_0x87f2('0x5'));var BPromise=require(_0x87f2('0x6'));var Mustache=require(_0x87f2('0x7'));var util=require('util');var path=require(_0x87f2('0x8'));var sox=require(_0x87f2('0x9'));var csv=require(_0x87f2('0xa'));var ejs=require(_0x87f2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x87f2('0xc'));var crypto=require('crypto');var jsforce=require(_0x87f2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x87f2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x87f2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x87f2('0xf'));var as=require(_0x87f2('0x10'));var hardwareService=require(_0x87f2('0x11'));var logger=require('../../config/logger')(_0x87f2('0x12'));var utils=require(_0x87f2('0x13'));var config=require(_0x87f2('0x14'));var licenseUtil=require(_0x87f2('0x15'));var db=require(_0x87f2('0x16'))['db'];function respondWithStatusCode(_0x316bdc,_0x2026c5){_0x2026c5=_0x2026c5||0xcc;return function(_0x4abe41){if(_0x4abe41){return _0x316bdc[_0x87f2('0x17')](_0x2026c5);}return _0x316bdc[_0x87f2('0x18')](_0x2026c5)[_0x87f2('0x19')]();};}function respondWithResult(_0x5c3eca,_0x1226be){_0x1226be=_0x1226be||0xc8;return function(_0x318267){if(_0x318267){return _0x5c3eca[_0x87f2('0x18')](_0x1226be)[_0x87f2('0x1a')](_0x318267);}};}function respondWithFilteredResult(_0x544910,_0x195550){return function(_0x356d47){if(_0x356d47){var _0x39ca18=typeof _0x195550['offset']===_0x87f2('0x1b')&&typeof _0x195550[_0x87f2('0x1c')]===_0x87f2('0x1b');var _0x323f9a=_0x356d47[_0x87f2('0x1d')];var _0x26018a=_0x39ca18?0x0:_0x195550[_0x87f2('0x1e')];var _0x6546dc=_0x39ca18?_0x356d47[_0x87f2('0x1d')]:_0x195550[_0x87f2('0x1e')]+_0x195550[_0x87f2('0x1c')];var _0x2dcc42;if(_0x6546dc>=_0x323f9a){_0x6546dc=_0x323f9a;_0x2dcc42=0xc8;}else{_0x2dcc42=0xce;}_0x544910['status'](_0x2dcc42);return _0x544910[_0x87f2('0x1f')](_0x87f2('0x20'),_0x26018a+'-'+_0x6546dc+'/'+_0x323f9a)[_0x87f2('0x1a')](_0x356d47);}return null;};}function patchUpdates(_0x69c628){return function(_0x178853){try{jsonpatch['apply'](_0x178853,_0x69c628,!![]);}catch(_0x1fe6cb){return BPromise['reject'](_0x1fe6cb);}return _0x178853[_0x87f2('0x21')]();};}function saveUpdates(_0x1a3885,_0x9d0d9e){return function(_0x555bb0){if(_0x555bb0){return _0x555bb0['update'](_0x1a3885)[_0x87f2('0x22')](function(_0x3c42e1){return _0x3c42e1;});}return null;};}function removeEntity(_0x4dd6e2,_0x51d34f){return function(_0x347e53){if(_0x347e53){return _0x347e53[_0x87f2('0x23')]()[_0x87f2('0x22')](function(){_0x4dd6e2['status'](0xcc)[_0x87f2('0x19')]();});}};}function handleEntityNotFound(_0x270c20,_0x414510){return function(_0xc6b064){if(!_0xc6b064){_0x270c20[_0x87f2('0x17')](0x194);}return _0xc6b064;};}function handleError(_0x3e92c4,_0x5bc402){_0x5bc402=_0x5bc402||0x1f4;return function(_0x1b16b7){logger[_0x87f2('0x24')](_0x1b16b7[_0x87f2('0x25')]);if(_0x1b16b7[_0x87f2('0x26')]){delete _0x1b16b7['name'];}_0x3e92c4['status'](_0x5bc402)['send'](_0x1b16b7);};}exports[_0x87f2('0x27')]=function(_0x3547c1,_0x2d9f87){var _0xed763={},_0x6b57eb={},_0x439bf1={'count':0x0,'rows':[]};var _0x351913=_['map'](db[_0x87f2('0x28')]['rawAttributes'],function(_0x252dc3){return{'name':_0x252dc3['fieldName'],'type':_0x252dc3[_0x87f2('0x29')][_0x87f2('0x2a')]};});_0x6b57eb[_0x87f2('0x2b')]=_[_0x87f2('0x2c')](_0x351913,'name');_0x6b57eb['query']=_['keys'](_0x3547c1['query']);_0x6b57eb['filters']=_[_0x87f2('0x2d')](_0x6b57eb[_0x87f2('0x2b')],_0x6b57eb[_0x87f2('0x2e')]);_0xed763[_0x87f2('0x2f')]=_[_0x87f2('0x2d')](_0x6b57eb[_0x87f2('0x2b')],qs[_0x87f2('0x30')](_0x3547c1['query'][_0x87f2('0x30')]));_0xed763[_0x87f2('0x2f')]=_0xed763['attributes'][_0x87f2('0x31')]?_0xed763[_0x87f2('0x2f')]:_0x6b57eb['model'];if(!_0x3547c1[_0x87f2('0x2e')][_0x87f2('0x32')](_0x87f2('0x33'))){_0xed763[_0x87f2('0x1c')]=qs[_0x87f2('0x1c')](_0x3547c1[_0x87f2('0x2e')][_0x87f2('0x1c')]);_0xed763[_0x87f2('0x1e')]=qs[_0x87f2('0x1e')](_0x3547c1[_0x87f2('0x2e')][_0x87f2('0x1e')]);}_0xed763[_0x87f2('0x34')]=qs[_0x87f2('0x35')](_0x3547c1[_0x87f2('0x2e')][_0x87f2('0x35')]);_0xed763[_0x87f2('0x36')]=qs[_0x87f2('0x37')](_[_0x87f2('0x38')](_0x3547c1[_0x87f2('0x2e')],_0x6b57eb['filters']),_0x351913);if(_0x3547c1[_0x87f2('0x2e')]['filter']){_0xed763[_0x87f2('0x36')]=_['merge'](_0xed763[_0x87f2('0x36')],{'$or':_['map'](_0x351913,function(_0x5e9f10){if(_0x5e9f10[_0x87f2('0x29')]!==_0x87f2('0x39')){var _0x142c95={};_0x142c95[_0x5e9f10[_0x87f2('0x26')]]={'$like':'%'+_0x3547c1[_0x87f2('0x2e')]['filter']+'%'};return _0x142c95;}})});}_0xed763=_[_0x87f2('0x3a')]({},_0xed763,_0x3547c1[_0x87f2('0x3b')]);var _0x46d9d9={'where':_0xed763[_0x87f2('0x36')]};return db[_0x87f2('0x28')][_0x87f2('0x1d')](_0x46d9d9)['then'](function(_0x436c6f){_0x439bf1[_0x87f2('0x1d')]=_0x436c6f;if(_0x3547c1['query']['includeAll']){_0xed763[_0x87f2('0x3c')]=[{'all':!![]}];}return db[_0x87f2('0x28')]['findAll'](_0xed763);})[_0x87f2('0x22')](function(_0x2ee325){_0x439bf1[_0x87f2('0x3d')]=_0x2ee325;return _0x439bf1;})['then'](respondWithFilteredResult(_0x2d9f87,_0xed763))['catch'](handleError(_0x2d9f87,null));};exports['show']=function(_0x318341,_0x3b45a0){var _0x292228={'raw':!![],'where':{'id':_0x318341[_0x87f2('0x3e')]['id']}},_0x2614d6={};_0x2614d6[_0x87f2('0x2b')]=_[_0x87f2('0x3f')](db[_0x87f2('0x28')][_0x87f2('0x40')]);_0x2614d6[_0x87f2('0x2e')]=_[_0x87f2('0x3f')](_0x318341[_0x87f2('0x2e')]);_0x2614d6[_0x87f2('0x37')]=_[_0x87f2('0x2d')](_0x2614d6[_0x87f2('0x2b')],_0x2614d6[_0x87f2('0x2e')]);_0x292228[_0x87f2('0x2f')]=_['intersection'](_0x2614d6[_0x87f2('0x2b')],qs[_0x87f2('0x30')](_0x318341[_0x87f2('0x2e')]['fields']));_0x292228[_0x87f2('0x2f')]=_0x292228[_0x87f2('0x2f')][_0x87f2('0x31')]?_0x292228[_0x87f2('0x2f')]:_0x2614d6[_0x87f2('0x2b')];if(_0x318341[_0x87f2('0x2e')][_0x87f2('0x41')]){_0x292228[_0x87f2('0x3c')]=[{'all':!![]}];}_0x292228=_[_0x87f2('0x3a')]({},_0x292228,_0x318341[_0x87f2('0x3b')]);return db['SmsApplication'][_0x87f2('0x42')](_0x292228)[_0x87f2('0x22')](handleEntityNotFound(_0x3b45a0,null))[_0x87f2('0x22')](respondWithResult(_0x3b45a0,null))[_0x87f2('0x43')](handleError(_0x3b45a0,null));};exports[_0x87f2('0x44')]=function(_0x59e90d,_0x1f1a6a){return db[_0x87f2('0x28')][_0x87f2('0x44')](_0x59e90d['body'],{})[_0x87f2('0x22')](respondWithResult(_0x1f1a6a,0xc9))[_0x87f2('0x43')](handleError(_0x1f1a6a,null));};exports['update']=function(_0x1906d3,_0x20b547){if(_0x1906d3['body']['id']){delete _0x1906d3['body']['id'];}return db[_0x87f2('0x28')][_0x87f2('0x42')]({'where':{'id':_0x1906d3[_0x87f2('0x3e')]['id']}})[_0x87f2('0x22')](handleEntityNotFound(_0x20b547,null))[_0x87f2('0x22')](saveUpdates(_0x1906d3['body'],null))['then'](respondWithResult(_0x20b547,null))[_0x87f2('0x43')](handleError(_0x20b547,null));};exports['destroy']=function(_0x37d435,_0x20667f){return db[_0x87f2('0x28')][_0x87f2('0x42')]({'where':{'id':_0x37d435['params']['id']}})['then'](handleEntityNotFound(_0x20667f,null))['then'](removeEntity(_0x20667f,null))['catch'](handleError(_0x20667f,null));}; \ No newline at end of file +var _0x7821=['name','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','map','includeAll','rows','show','params','include','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','error'];(function(_0x3316ef,_0x123233){var _0x1b1452=function(_0x45d141){while(--_0x45d141){_0x3316ef['push'](_0x3316ef['shift']());}};_0x1b1452(++_0x123233);}(_0x7821,0x1b4));var _0x1782=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x7821[_0x51b661];return _0x5d1971;};'use strict';var emlformat=require(_0x1782('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1782('0x1'));var jsonpatch=require(_0x1782('0x2'));var rp=require(_0x1782('0x3'));var moment=require(_0x1782('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1782('0x5'));var util=require(_0x1782('0x6'));var path=require(_0x1782('0x7'));var sox=require(_0x1782('0x8'));var csv=require(_0x1782('0x9'));var ejs=require(_0x1782('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1782('0xb'));var squel=require(_0x1782('0xc'));var crypto=require(_0x1782('0xd'));var jsforce=require(_0x1782('0xe'));var deskjs=require(_0x1782('0xf'));var toCsv=require(_0x1782('0x9'));var querystring=require(_0x1782('0x10'));var Papa=require('papaparse');var Redis=require(_0x1782('0x11'));var authService=require(_0x1782('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1782('0x13'));var logger=require(_0x1782('0x14'))(_0x1782('0x15'));var utils=require('../../config/utils');var config=require(_0x1782('0x16'));var licenseUtil=require(_0x1782('0x17'));var db=require(_0x1782('0x18'))['db'];function respondWithStatusCode(_0x276922,_0x276dd4){_0x276dd4=_0x276dd4||0xcc;return function(_0x1711e4){if(_0x1711e4){return _0x276922['sendStatus'](_0x276dd4);}return _0x276922[_0x1782('0x19')](_0x276dd4)[_0x1782('0x1a')]();};}function respondWithResult(_0x3968b1,_0x194a6b){_0x194a6b=_0x194a6b||0xc8;return function(_0x1a7c2e){if(_0x1a7c2e){return _0x3968b1['status'](_0x194a6b)[_0x1782('0x1b')](_0x1a7c2e);}};}function respondWithFilteredResult(_0x5d4c56,_0x10bdc6){return function(_0x1308a9){if(_0x1308a9){var _0x1b1735=typeof _0x10bdc6['offset']===_0x1782('0x1c')&&typeof _0x10bdc6[_0x1782('0x1d')]===_0x1782('0x1c');var _0x52376c=_0x1308a9[_0x1782('0x1e')];var _0x53d145=_0x1b1735?0x0:_0x10bdc6[_0x1782('0x1f')];var _0x2cafcb=_0x1b1735?_0x1308a9['count']:_0x10bdc6['offset']+_0x10bdc6['limit'];var _0x19452b;if(_0x2cafcb>=_0x52376c){_0x2cafcb=_0x52376c;_0x19452b=0xc8;}else{_0x19452b=0xce;}_0x5d4c56[_0x1782('0x19')](_0x19452b);return _0x5d4c56[_0x1782('0x20')](_0x1782('0x21'),_0x53d145+'-'+_0x2cafcb+'/'+_0x52376c)[_0x1782('0x1b')](_0x1308a9);}return null;};}function patchUpdates(_0x11eabf){return function(_0x2406b9){try{jsonpatch['apply'](_0x2406b9,_0x11eabf,!![]);}catch(_0x45312c){return BPromise[_0x1782('0x22')](_0x45312c);}return _0x2406b9[_0x1782('0x23')]();};}function saveUpdates(_0x268477,_0x43c781){return function(_0x4dd2b6){if(_0x4dd2b6){return _0x4dd2b6[_0x1782('0x24')](_0x268477)['then'](function(_0x3f5b2c){return _0x3f5b2c;});}return null;};}function removeEntity(_0x50c331,_0x149411){return function(_0x52d632){if(_0x52d632){return _0x52d632[_0x1782('0x25')]()[_0x1782('0x26')](function(){_0x50c331['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x173f1c,_0x480a72){return function(_0x320ef3){if(!_0x320ef3){_0x173f1c['sendStatus'](0x194);}return _0x320ef3;};}function handleError(_0x2d4759,_0x3281e0){_0x3281e0=_0x3281e0||0x1f4;return function(_0x405277){logger[_0x1782('0x27')](_0x405277['stack']);if(_0x405277[_0x1782('0x28')]){delete _0x405277[_0x1782('0x28')];}_0x2d4759[_0x1782('0x19')](_0x3281e0)['send'](_0x405277);};}exports['index']=function(_0x58217a,_0x45454c){var _0x3f5be3={},_0x50a428={},_0x61ab3f={'count':0x0,'rows':[]};var _0x44508a=_['map'](db[_0x1782('0x29')][_0x1782('0x2a')],function(_0x591664){return{'name':_0x591664[_0x1782('0x2b')],'type':_0x591664['type'][_0x1782('0x2c')]};});_0x50a428[_0x1782('0x2d')]=_['map'](_0x44508a,_0x1782('0x28'));_0x50a428[_0x1782('0x2e')]=_[_0x1782('0x2f')](_0x58217a[_0x1782('0x2e')]);_0x50a428[_0x1782('0x30')]=_[_0x1782('0x31')](_0x50a428[_0x1782('0x2d')],_0x50a428[_0x1782('0x2e')]);_0x3f5be3[_0x1782('0x32')]=_['intersection'](_0x50a428[_0x1782('0x2d')],qs[_0x1782('0x33')](_0x58217a[_0x1782('0x2e')][_0x1782('0x33')]));_0x3f5be3[_0x1782('0x32')]=_0x3f5be3[_0x1782('0x32')][_0x1782('0x34')]?_0x3f5be3[_0x1782('0x32')]:_0x50a428[_0x1782('0x2d')];if(!_0x58217a[_0x1782('0x2e')]['hasOwnProperty'](_0x1782('0x35'))){_0x3f5be3[_0x1782('0x1d')]=qs['limit'](_0x58217a[_0x1782('0x2e')][_0x1782('0x1d')]);_0x3f5be3[_0x1782('0x1f')]=qs['offset'](_0x58217a[_0x1782('0x2e')]['offset']);}_0x3f5be3['order']=qs[_0x1782('0x36')](_0x58217a['query'][_0x1782('0x36')]);_0x3f5be3[_0x1782('0x37')]=qs[_0x1782('0x30')](_[_0x1782('0x38')](_0x58217a[_0x1782('0x2e')],_0x50a428['filters']),_0x44508a);if(_0x58217a[_0x1782('0x2e')]['filter']){_0x3f5be3[_0x1782('0x37')]=_[_0x1782('0x39')](_0x3f5be3[_0x1782('0x37')],{'$or':_[_0x1782('0x3a')](_0x44508a,function(_0x281fad){if(_0x281fad['type']!=='VIRTUAL'){var _0x30eba2={};_0x30eba2[_0x281fad[_0x1782('0x28')]]={'$like':'%'+_0x58217a[_0x1782('0x2e')]['filter']+'%'};return _0x30eba2;}})});}_0x3f5be3=_['merge']({},_0x3f5be3,_0x58217a['options']);var _0x2e79d4={'where':_0x3f5be3['where']};return db[_0x1782('0x29')][_0x1782('0x1e')](_0x2e79d4)['then'](function(_0x5396bf){_0x61ab3f[_0x1782('0x1e')]=_0x5396bf;if(_0x58217a[_0x1782('0x2e')][_0x1782('0x3b')]){_0x3f5be3['include']=[{'all':!![]}];}return db[_0x1782('0x29')]['findAll'](_0x3f5be3);})['then'](function(_0x207eed){_0x61ab3f[_0x1782('0x3c')]=_0x207eed;return _0x61ab3f;})['then'](respondWithFilteredResult(_0x45454c,_0x3f5be3))['catch'](handleError(_0x45454c,null));};exports[_0x1782('0x3d')]=function(_0x5a4370,_0x57ca1e){var _0x3780f7={'raw':!![],'where':{'id':_0x5a4370[_0x1782('0x3e')]['id']}},_0x24d41d={};_0x24d41d[_0x1782('0x2d')]=_[_0x1782('0x2f')](db[_0x1782('0x29')]['rawAttributes']);_0x24d41d[_0x1782('0x2e')]=_[_0x1782('0x2f')](_0x5a4370[_0x1782('0x2e')]);_0x24d41d[_0x1782('0x30')]=_['intersection'](_0x24d41d['model'],_0x24d41d[_0x1782('0x2e')]);_0x3780f7[_0x1782('0x32')]=_[_0x1782('0x31')](_0x24d41d[_0x1782('0x2d')],qs[_0x1782('0x33')](_0x5a4370[_0x1782('0x2e')][_0x1782('0x33')]));_0x3780f7[_0x1782('0x32')]=_0x3780f7[_0x1782('0x32')][_0x1782('0x34')]?_0x3780f7[_0x1782('0x32')]:_0x24d41d[_0x1782('0x2d')];if(_0x5a4370[_0x1782('0x2e')][_0x1782('0x3b')]){_0x3780f7[_0x1782('0x3f')]=[{'all':!![]}];}_0x3780f7=_[_0x1782('0x39')]({},_0x3780f7,_0x5a4370['options']);return db[_0x1782('0x29')][_0x1782('0x40')](_0x3780f7)[_0x1782('0x26')](handleEntityNotFound(_0x57ca1e,null))[_0x1782('0x26')](respondWithResult(_0x57ca1e,null))['catch'](handleError(_0x57ca1e,null));};exports[_0x1782('0x41')]=function(_0x19eaf3,_0xa64bf1){return db[_0x1782('0x29')][_0x1782('0x41')](_0x19eaf3[_0x1782('0x42')],{})['then'](respondWithResult(_0xa64bf1,0xc9))[_0x1782('0x43')](handleError(_0xa64bf1,null));};exports['update']=function(_0x538542,_0x362c5f){if(_0x538542[_0x1782('0x42')]['id']){delete _0x538542['body']['id'];}return db['SmsApplication'][_0x1782('0x40')]({'where':{'id':_0x538542[_0x1782('0x3e')]['id']}})['then'](handleEntityNotFound(_0x362c5f,null))[_0x1782('0x26')](saveUpdates(_0x538542[_0x1782('0x42')],null))['then'](respondWithResult(_0x362c5f,null))[_0x1782('0x43')](handleError(_0x362c5f,null));};exports[_0x1782('0x25')]=function(_0x34379d,_0x30ec9e){return db[_0x1782('0x29')][_0x1782('0x40')]({'where':{'id':_0x34379d['params']['id']}})['then'](handleEntityNotFound(_0x30ec9e,null))[_0x1782('0x26')](removeEntity(_0x30ec9e,null))[_0x1782('0x43')](handleError(_0x30ec9e,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index dabb559..e9bb11f 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 _0x5034=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4'];(function(_0x57fc05,_0x31e7f4){var _0x5c78e8=function(_0x2c7bad){while(--_0x2c7bad){_0x57fc05['push'](_0x57fc05['shift']());}};_0x5c78e8(++_0x31e7f4);}(_0x5034,0x8d));var _0x4503=function(_0x20753,_0x31272a){_0x20753=_0x20753-0x0;var _0x5913c7=_0x5034[_0x20753];return _0x5913c7;};'use strict';var _=require(_0x4503('0x0'));var util=require(_0x4503('0x1'));var logger=require(_0x4503('0x2'))('api');var moment=require(_0x4503('0x3'));var BPromise=require(_0x4503('0x4'));var rp=require(_0x4503('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4503('0x6'));var config=require(_0x4503('0x7'));var attributes=require(_0x4503('0x8'));module[_0x4503('0x9')]=function(_0x217cd4,_0x516a40){return _0x217cd4['define'](_0x4503('0xa'),attributes,{'tableName':_0x4503('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4503('0xc'),'collate':_0x4503('0xd')});}; \ No newline at end of file +var _0x43f7=['sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','exports','SmsApplication'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x43f7,0x8e));var _0x743f=function(_0x1955c4,_0x22488a){_0x1955c4=_0x1955c4-0x0;var _0x128ca9=_0x43f7[_0x1955c4];return _0x128ca9;};'use strict';var _=require(_0x743f('0x0'));var util=require(_0x743f('0x1'));var logger=require(_0x743f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x743f('0x3'));var fs=require('fs');var path=require(_0x743f('0x4'));var rimraf=require(_0x743f('0x5'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0x743f('0x6')]=function(_0x2b9a1f,_0x448a03){return _0x2b9a1f['define'](_0x743f('0x7'),attributes,{'tableName':_0x743f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x743f('0x9')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 0f9ca34..8c01ec4 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 _0x1219=['http','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ae3ce,_0x160110){var _0x4fdf9f=function(_0x5177e5){while(--_0x5177e5){_0x4ae3ce['push'](_0x4ae3ce['shift']());}};_0x4fdf9f(++_0x160110);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var moment=require(_0x9121('0x2'));var BPromise=require(_0x9121('0x3'));var rs=require(_0x9121('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9121('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9121('0x6'))(_0x9121('0x7'));var config=require(_0x9121('0x8'));var jayson=require(_0x9121('0x9'));var client=jayson[_0x9121('0xa')][_0x9121('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437bac,_0x1387b7,_0x262520){return new BPromise(function(_0x409a74,_0x2c55eb){return client['request'](_0x437bac,_0x262520)[_0x9121('0xc')](function(_0x2bf1d6){logger[_0x9121('0xd')](_0x9121('0xe'),_0x1387b7,'request\x20sent');logger[_0x9121('0xf')](_0x9121('0x10'),_0x1387b7,_0x9121('0x11'),JSON[_0x9121('0x12')](_0x2bf1d6));if(_0x2bf1d6[_0x9121('0x13')]){if(_0x2bf1d6[_0x9121('0x13')][_0x9121('0x14')]===0x1f4){logger[_0x9121('0x13')](_0x9121('0xe'),_0x1387b7,_0x2bf1d6[_0x9121('0x13')][_0x9121('0x15')]);return _0x2c55eb(_0x2bf1d6[_0x9121('0x13')][_0x9121('0x15')]);}logger[_0x9121('0x13')](_0x9121('0xe'),_0x1387b7,_0x2bf1d6['error'][_0x9121('0x15')]);return _0x409a74(_0x2bf1d6[_0x9121('0x13')][_0x9121('0x15')]);}else{logger[_0x9121('0xd')](_0x9121('0xe'),_0x1387b7,_0x9121('0x11'));_0x409a74(_0x2bf1d6['result']['message']);}})[_0x9121('0x16')](function(_0x200a28){logger[_0x9121('0x13')](_0x9121('0xe'),_0x1387b7,_0x200a28);_0x2c55eb(_0x200a28);});});} \ No newline at end of file +var _0xf4f4=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x4840d,_0x5165b0){var _0x3c8d98=function(_0x398962){while(--_0x398962){_0x4840d['push'](_0x4840d['shift']());}};_0x3c8d98(++_0x5165b0);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1695ce,_0xfa80a6){_0x1695ce=_0x1695ce-0x0;var _0x41e575=_0xf4f4[_0x1695ce];return _0x41e575;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff75a,_0x3c4877,_0x249f8a){return new BPromise(function(_0x2faba9,_0x3768d7){return client['request'](_0x1ff75a,_0x249f8a)[_0x4f4f('0xb')](function(_0x38d110){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x3c4877,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x3c4877,_0x4f4f('0xe'),JSON['stringify'](_0x38d110));if(_0x38d110['error']){if(_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x3768d7(_0x38d110['error'][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x2faba9(_0x38d110[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')]('SmsApplication,\x20%s,\x20%s',_0x3c4877,'request\x20sent');_0x2faba9(_0x38d110['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x2d21ed){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x2d21ed);_0x3768d7(_0x2d21ed);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index a73db91..58e3b4b 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 _0x4fc2=['removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy'];(function(_0x4f774b,_0x53f31e){var _0x5148f0=function(_0x524202){while(--_0x524202){_0x4f774b['push'](_0x4f774b['shift']());}};_0x5148f0(++_0x53f31e);}(_0x4fc2,0x111));var _0x24fc=function(_0x4ff2bc,_0xedd1df){_0x4ff2bc=_0x4ff2bc-0x0;var _0x21751c=_0x4fc2[_0x4ff2bc];return _0x21751c;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['show']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['post']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['post'](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x18')),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/:id',auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x1b')),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1d')](_0x24fc('0xe'),auth['isAuthenticated'](),interaction[_0x24fc('0x1e')](_0x24fc('0x17'),_0x24fc('0x1f')),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x16'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x21')]);module['exports']=router; \ No newline at end of file +var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x7708,0x188));var _0x8770=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0x7708[_0x5ad07c];return _0x204bae;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f76e3a5..d729fe3 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 _0x1893=['INTEGER','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x349112,_0x3a6287){var _0x166d17=function(_0x46cc6b){while(--_0x46cc6b){_0x349112['push'](_0x349112['shift']());}};_0x166d17(++_0x3a6287);}(_0x1893,0xa2));var _0x3189=function(_0x10eb6b,_0x3fe155){_0x10eb6b=_0x10eb6b-0x0;var _0x3a3ab1=_0x1893[_0x10eb6b];return _0x3a3ab1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3189('0x0')]={'closed':{'type':Sequelize[_0x3189('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3189('0x2')]},'disposition':{'type':Sequelize[_0x3189('0x3')]},'secondDisposition':{'type':Sequelize[_0x3189('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3189('0x3')]},'note':{'type':Sequelize[_0x3189('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3189('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3189('0x4')]('in',_0x3189('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3189('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3189('0x4')]('in',_0x3189('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3189('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3189('0x6')]}}; \ No newline at end of file +var _0x9264=['INTEGER','sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x4926('0x0'));var moment=require(_0x4926('0x1'));module[_0x4926('0x2')]={'closed':{'type':Sequelize[_0x4926('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4926('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4926('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4926('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x4926('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4926('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4926('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index d828689..bfd9053 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 _0x234f=['describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','filters','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','rows','addTags','setTags','color','smsInteractionTags:save','removeTags','download','unix','join','root','server','tmp','transcript-%d-%s.zip','push','User','fullname','firstName','lastName','Messages','createdAt','direction','read','SmsAccount','Account','Owner','get','mkdirSync','N.A.','toString','closedAt','disposition','out','System','Contact','secret','value','views','downloadInteraction.ejs','transcript-','Sms','log','err','rimraf','zip-dir','moment','bluebird','util','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','SmsInteraction','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','rawAttributes','keys','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body'];(function(_0x40d719,_0x2c4909){var _0x5b905c=function(_0x5e94e6){while(--_0x5e94e6){_0x40d719['push'](_0x40d719['shift']());}};_0x5b905c(++_0x2c4909);}(_0x234f,0xb6));var _0xf234=function(_0x4fede8,_0x505013){_0x4fede8=_0x4fede8-0x0;var _0x12b99c=_0x234f[_0x4fede8];return _0x12b99c;};'use strict';var rimraf=require(_0xf234('0x0'));var zipdir=require(_0xf234('0x1'));var moment=require(_0xf234('0x2'));var BPromise=require(_0xf234('0x3'));var util=require(_0xf234('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xf234('0x5'));var qs=require(_0xf234('0x6'));var pdf=require(_0xf234('0x7'));var logger=require(_0xf234('0x8'))(_0xf234('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf234('0xa')](config[_0xf234('0xb')],{'host':_0xf234('0xc'),'port':0x18eb});var socket=require(_0xf234('0xd'))(new Redis(config[_0xf234('0xb')]));require(_0xf234('0xe'))[_0xf234('0xf')](socket);function respondWithStatusCode(_0x301d84,_0x175d13){_0x175d13=_0x175d13||0xcc;return function(_0x88d1e8){if(_0x88d1e8){return _0x301d84[_0xf234('0x10')](_0x175d13);}return _0x301d84[_0xf234('0x11')](_0x175d13)['end']();};}function respondWithResult(_0x30df4e,_0x2b930f){_0x2b930f=_0x2b930f||0xc8;return function(_0x2c5035){if(_0x2c5035){return _0x30df4e[_0xf234('0x11')](_0x2b930f)['json'](_0x2c5035);}};}function respondWithFilteredResult(_0x415176,_0x583f43){return function(_0xa12b0e){if(_0xa12b0e){var _0x55374a=typeof _0x583f43[_0xf234('0x12')]===_0xf234('0x13')&&typeof _0x583f43['limit']===_0xf234('0x13');var _0x4b43c0=_0xa12b0e['count'];var _0x4013b8=_0x55374a?0x0:_0x583f43[_0xf234('0x12')];var _0x5726e0=_0x55374a?_0xa12b0e['count']:_0x583f43[_0xf234('0x12')]+_0x583f43[_0xf234('0x14')];var _0x40ce05;if(_0x5726e0>=_0x4b43c0){_0x5726e0=_0x4b43c0;_0x40ce05=0xc8;}else{_0x40ce05=0xce;}_0x415176[_0xf234('0x11')](_0x40ce05);return _0x415176[_0xf234('0x15')](_0xf234('0x16'),_0x4013b8+'-'+_0x5726e0+'/'+_0x4b43c0)['json'](_0xa12b0e);}return null;};}function saveUpdates(_0x62f530){return function(_0x7130a2){if(_0x7130a2){return _0x7130a2[_0xf234('0x17')](_0x62f530)[_0xf234('0x18')](function(_0x4292ad){return _0x4292ad;});}return null;};}function removeEntity(_0x50146e){return function(_0x485f1b){if(_0x485f1b){return _0x485f1b[_0xf234('0x19')]()['then'](function(){_0x50146e[_0xf234('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac963){return function(_0x41b845){if(!_0x41b845){_0x2ac963[_0xf234('0x10')](0x194);}return _0x41b845;};}function handleError(_0x5a1bc4,_0x121614){_0x121614=_0x121614||0x1f4;return function(_0x588fb8){logger[_0xf234('0x1a')](_0x588fb8[_0xf234('0x1b')]);if(_0x588fb8[_0xf234('0x1c')]){delete _0x588fb8[_0xf234('0x1c')];}_0x5a1bc4[_0xf234('0x11')](_0x121614)[_0xf234('0x1d')](_0x588fb8);};}exports[_0xf234('0x1e')]=function(_0x196862,_0x52f35a){var _0x36f450={};var _0x3fc3ed=_[_0xf234('0x1f')](db[_0xf234('0x20')]['rawAttributes'],function(_0x54562d){return{'name':_0x54562d[_0xf234('0x21')],'type':_0x54562d[_0xf234('0x22')][_0xf234('0x23')]};});_0x36f450=qs[_0xf234('0x24')](_0x3fc3ed,_0x196862);return interaction[_0xf234('0x25')](_0xf234('0x26'),_0x196862[_0xf234('0x27')],_0x196862[_0xf234('0x28')],_0x36f450,_0x3fc3ed)[_0xf234('0x18')](respondWithFilteredResult(_0x52f35a,_0x36f450))[_0xf234('0x29')](handleError(_0x52f35a,null));};exports[_0xf234('0x2a')]=function(_0x12559e,_0x21c8f7){var _0x4b7f67={'raw':![],'where':{'id':_0x12559e[_0xf234('0x2b')]['id']}},_0x6372bc={};_0x6372bc[_0xf234('0x2c')]=_['keys'](db[_0xf234('0x20')][_0xf234('0x2d')]);_0x6372bc['query']=_[_0xf234('0x2e')](_0x12559e['query']);_0x6372bc['filters']=_['intersection'](_0x6372bc[_0xf234('0x2c')],_0x6372bc['query']);_0x4b7f67[_0xf234('0x2f')]=_[_0xf234('0x30')](_0x6372bc['model'],qs[_0xf234('0x31')](_0x12559e[_0xf234('0x27')][_0xf234('0x31')]));_0x4b7f67['attributes']=_0x4b7f67[_0xf234('0x2f')][_0xf234('0x32')]?_0x4b7f67[_0xf234('0x2f')]:_0x6372bc[_0xf234('0x2c')];if(_0x12559e[_0xf234('0x27')][_0xf234('0x33')]){_0x4b7f67[_0xf234('0x34')]=[{'all':!![]}];}_0x4b7f67=_[_0xf234('0x35')]({},_0x4b7f67,_0x12559e[_0xf234('0x36')]);return db[_0xf234('0x20')][_0xf234('0x37')](_0x4b7f67)[_0xf234('0x18')](handleEntityNotFound(_0x21c8f7,null))['then'](respondWithResult(_0x21c8f7,null))['catch'](handleError(_0x21c8f7,null));};exports['create']=function(_0x308ff3,_0x59e321){return db[_0xf234('0x20')][_0xf234('0x38')](_0x308ff3['body'],{})[_0xf234('0x18')](respondWithResult(_0x59e321,0xc9))[_0xf234('0x29')](handleError(_0x59e321,null));};exports[_0xf234('0x17')]=function(_0x12c609,_0x274b20){if(_0x12c609[_0xf234('0x39')]['id']){delete _0x12c609['body']['id'];}return db['SmsInteraction'][_0xf234('0x37')]({'where':{'id':_0x12c609[_0xf234('0x2b')]['id']}})[_0xf234('0x18')](handleEntityNotFound(_0x274b20,null))['then'](saveUpdates(_0x12c609[_0xf234('0x39')],null))['then'](respondWithResult(_0x274b20,null))[_0xf234('0x29')](handleError(_0x274b20,null));};exports[_0xf234('0x19')]=function(_0x266ada,_0x231fb2){return db[_0xf234('0x20')][_0xf234('0x37')]({'where':{'id':_0x266ada[_0xf234('0x2b')]['id']}})[_0xf234('0x18')](handleEntityNotFound(_0x231fb2,null))[_0xf234('0x18')](removeEntity(_0x231fb2,null))[_0xf234('0x29')](handleError(_0x231fb2,null));};exports[_0xf234('0x3a')]=function(_0x40b3a8,_0x3a7d56){return db[_0xf234('0x20')][_0xf234('0x3a')]()['then'](respondWithResult(_0x3a7d56,null))[_0xf234('0x29')](handleError(_0x3a7d56,null));};exports[_0xf234('0x3b')]=function(_0x55fbe4,_0x3124b8){return db[_0xf234('0x3c')]['find']({'where':{'id':_0x55fbe4['params']['id']}})[_0xf234('0x18')](handleEntityNotFound(_0x3124b8,null))[_0xf234('0x18')](function(_0x37e10b){if(_0x37e10b){return _0x37e10b[_0xf234('0x3b')](_0x55fbe4[_0xf234('0x39')][_0xf234('0x3d')],_[_0xf234('0x3e')](_0x55fbe4[_0xf234('0x39')],[_0xf234('0x3d'),'id'])||{});}})[_0xf234('0x18')](respondWithResult(_0x3124b8,null))[_0xf234('0x29')](handleError(_0x3124b8,null));};exports['getMessages']=function(_0x46409e,_0x2c4f7f){var _0x218c5f={'raw':![],'where':{}};var _0x5a12ea={};var _0x535b91={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xf234('0x3f')]({'where':{'id':_0x46409e[_0xf234('0x2b')]['id']}})[_0xf234('0x18')](handleEntityNotFound(_0x2c4f7f,null))[_0xf234('0x18')](function(_0x28ba92){if(_0x28ba92){_0x5a12ea[_0xf234('0x2c')]=_[_0xf234('0x2e')](db[_0xf234('0x3c')][_0xf234('0x2d')]);_0x5a12ea[_0xf234('0x27')]=_[_0xf234('0x2e')](_0x46409e[_0xf234('0x27')]);_0x5a12ea['filters']=_[_0xf234('0x30')](_0x5a12ea[_0xf234('0x2c')],_0x5a12ea['query']);_0x218c5f['attributes']=_[_0xf234('0x30')](_0x5a12ea[_0xf234('0x2c')],qs['fields'](_0x46409e[_0xf234('0x27')][_0xf234('0x31')]));_0x218c5f['attributes']=_0x218c5f[_0xf234('0x2f')][_0xf234('0x32')]?_0x218c5f[_0xf234('0x2f')]:_0x5a12ea['model'];if(!_0x46409e[_0xf234('0x27')][_0xf234('0x40')](_0xf234('0x41'))){_0x218c5f[_0xf234('0x14')]=qs[_0xf234('0x14')](_0x46409e[_0xf234('0x27')][_0xf234('0x14')]);_0x218c5f['offset']=qs['offset'](_0x46409e[_0xf234('0x27')][_0xf234('0x12')]);}_0x218c5f[_0xf234('0x42')]=qs[_0xf234('0x43')](_0x46409e['query'][_0xf234('0x43')]);_0x218c5f[_0xf234('0x44')]=qs[_0xf234('0x45')](_[_0xf234('0x46')](_0x46409e[_0xf234('0x27')],_0x5a12ea['filters']));_0x218c5f['where'][_0xf234('0x47')]=_0x28ba92['id'];if(_0x46409e['query'][_0xf234('0x48')]){_0x218c5f[_0xf234('0x44')]=_['merge'](_0x218c5f[_0xf234('0x44')],{'$or':_[_0xf234('0x1f')](_0x218c5f[_0xf234('0x2f')],function(_0x54cfe0){var _0x11e619={};_0x11e619[_0x54cfe0]={'$like':'%'+_0x46409e[_0xf234('0x27')]['filter']+'%'};return _0x11e619;})});}if(_0x46409e['query'][_0xf234('0x49')]){var _0xc4af45=_0x46409e[_0xf234('0x27')][_0xf234('0x49')][_0xf234('0x4a')](',');var _0x431bd0={};_0x431bd0[_0xc4af45[0x0]]={'$gte':moment(_0xc4af45[0x1])[_0xf234('0x4b')](_0xf234('0x4c'))};_0x218c5f['where']=_['merge'](_0x218c5f['where'],_0x431bd0);}_0x218c5f=_[_0xf234('0x35')]({},_0x218c5f,_0x46409e[_0xf234('0x36')]);return db[_0xf234('0x3c')][_0xf234('0x4d')]({'where':_0x218c5f['where']})[_0xf234('0x18')](function(_0xeb4ff4){_0x535b91[_0xf234('0x4d')]=_0xeb4ff4;if(_0x46409e['query'][_0xf234('0x33')]){_0x218c5f[_0xf234('0x34')]=[{'all':!![]}];}return db[_0xf234('0x3c')][_0xf234('0x25')](_0x218c5f);})[_0xf234('0x18')](function(_0x22c233){_0x535b91[_0xf234('0x4e')]=_0x22c233;return _0x535b91;});}})[_0xf234('0x18')](respondWithFilteredResult(_0x2c4f7f,_0x218c5f))[_0xf234('0x29')](handleError(_0x2c4f7f,null));};exports[_0xf234('0x4f')]=function(_0x32b594,_0x4f9471){return db[_0xf234('0x20')]['find']({'where':{'id':_0x32b594[_0xf234('0x2b')]['id']}})[_0xf234('0x18')](handleEntityNotFound(_0x4f9471,null))[_0xf234('0x18')](function(_0x580797){if(_0x580797){return _0x580797[_0xf234('0x50')](_0x32b594[_0xf234('0x39')]['ids'],_[_0xf234('0x3e')](_0x32b594['body'],['ids','id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xf234('0x1c'),_0xf234('0x51')],'where':{'id':_0x32b594[_0xf234('0x39')][_0xf234('0x3d')]}});})[_0xf234('0x18')](function(_0x15318a){socket['emit'](_0xf234('0x52'),{'id':Number(_0x32b594[_0xf234('0x2b')]['id']),'tags':_0x15318a||[]});return{'id':Number(_0x32b594[_0xf234('0x2b')]['id']),'tags':_0x15318a||[]};});}})[_0xf234('0x18')](respondWithResult(_0x4f9471,null))['catch'](handleError(_0x4f9471,null));};exports['removeTags']=function(_0x1369de,_0x10efa3){return db[_0xf234('0x20')][_0xf234('0x37')]({'where':{'id':_0x1369de[_0xf234('0x2b')]['id']}})[_0xf234('0x18')](handleEntityNotFound(_0x10efa3,null))['then'](function(_0x1df1e5){if(_0x1df1e5){return _0x1df1e5[_0xf234('0x53')](_0x1369de[_0xf234('0x27')][_0xf234('0x3d')]);}})['then'](respondWithStatusCode(_0x10efa3,null))[_0xf234('0x29')](handleError(_0x10efa3,null));};exports[_0xf234('0x54')]=function(_0x5dd25b,_0x53f767){var _0x16e3c0=moment()[_0xf234('0x55')]()['toString']();var _0x4f5b52=path[_0xf234('0x56')](config[_0xf234('0x57')],_0xf234('0x58'),'files',_0xf234('0x59'));var _0x42d352=path[_0xf234('0x56')](_0x4f5b52,_0x16e3c0);var _0x4a57e1=util[_0xf234('0x4b')](_0xf234('0x5a'),_0x5dd25b[_0xf234('0x2b')]['id'],_0x16e3c0);var _0x568291=path[_0xf234('0x56')](_0x4f5b52,_0x4a57e1);var _0x2f4305=[];_0x2f4305[_0xf234('0x5b')]({'model':db[_0xf234('0x5c')],'as':'User','attributes':['id',_0xf234('0x5d')],'raw':!![]});_0x2f4305[_0xf234('0x5b')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xf234('0x5e'),_0xf234('0x5f')],'raw':!![]});var _0x3f8700=[{'model':db[_0xf234('0x3c')],'as':_0xf234('0x60'),'attributes':['id',_0xf234('0x39'),_0xf234('0x61'),_0xf234('0x62'),'secret',_0xf234('0x63')],'include':_0x2f4305}];_0x3f8700[_0xf234('0x5b')]({'model':db[_0xf234('0x64')],'as':_0xf234('0x65'),'attributes':['id',_0xf234('0x1c')]});_0x3f8700[_0xf234('0x5b')]({'model':db['User'],'as':_0xf234('0x66'),'attributes':['id',_0xf234('0x5d')]});return db[_0xf234('0x20')][_0xf234('0x37')]({'where':{'id':_0x5dd25b[_0xf234('0x2b')]['id']},'include':_0x3f8700})[_0xf234('0x18')](handleEntityNotFound(_0x53f767,null))['then'](function(_0x2344e2){if(_0x2344e2){var _0x2f181f=_0x2344e2[_0xf234('0x67')]({'plain':!![]});fs[_0xf234('0x68')](_0x42d352);var _0x343ae9={'channel':'Sms','account':_0x2f181f[_0xf234('0x65')][_0xf234('0x1c')],'agent':_0x2f181f['Owner']?_0x2f181f[_0xf234('0x66')]['fullname']:_0xf234('0x69'),'createdAt':moment(_0x2f181f[_0xf234('0x61')])[_0xf234('0x4b')](_0xf234('0x4c'))[_0xf234('0x6a')](),'closedAt':_0x2f181f['closed']?moment(_0x2f181f[_0xf234('0x6b')])[_0xf234('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2f181f[_0xf234('0x6c')],'messages':_(_0x2f181f['Messages'])[_0xf234('0x48')]({'secret':![]})[_0xf234('0x1f')](function(_0x45f88c){return{'date':moment(_0x45f88c[_0xf234('0x61')])[_0xf234('0x4b')](_0xf234('0x4c'))[_0xf234('0x6a')](),'sender':_0x45f88c[_0xf234('0x62')]===_0xf234('0x6d')?_0x45f88c[_0xf234('0x5c')]?_0x45f88c[_0xf234('0x5c')][_0xf234('0x5d')]:_0xf234('0x6e'):_0x45f88c['Contact'][_0xf234('0x5e')]+(_0x45f88c['Contact'][_0xf234('0x5f')]?'\x20'+_0x45f88c[_0xf234('0x6f')][_0xf234('0x5f')]:''),'body':_0x45f88c[_0xf234('0x39')],'direction':_0x45f88c[_0xf234('0x62')]===_0xf234('0x6d')?'A':'C','secret':_0x45f88c[_0xf234('0x70')],'read':_0x45f88c[_0xf234('0x63')]};})[_0xf234('0x71')]()};return ejs['renderFile'](path['join'](config['root'],_0xf234('0x58'),_0xf234('0x72'),_0xf234('0x73')),{'interaction':_0x343ae9})[_0xf234('0x18')](function(_0x1c3aa6){var _0x5992ea=path['join'](_0x42d352,_0xf234('0x74')+_0x2f181f['id']+'-'+_0x16e3c0+'.pdf');var _0x55d1b3={'path':_0x5992ea,'channel':_0xf234('0x75'),'interactionId':_0x2f181f['id']};return pdf['createPdfFromHTML'](_0x1c3aa6,_0x55d1b3);})[_0xf234('0x18')](function(){return new BPromise(function(_0x43c591,_0x40ff71){zipdir(_0x42d352,{'saveTo':_0x568291},function(_0x37af0b,_0x382459){if(_0x37af0b)return _0x40ff71(_0x37af0b);return _0x43c591(_0x382459);});})[_0xf234('0x18')](function(){return new BPromise(function(_0x37184e,_0x4523d7){rimraf(_0x42d352,function(_0x265854){if(_0x265854)_0x4523d7(_0x265854);return _0x37184e();});});})[_0xf234('0x18')](function(){return _0x53f767[_0xf234('0x54')](_0x568291,_0x4a57e1,function(_0x108d66){if(_0x108d66){console[_0xf234('0x76')](_0xf234('0x77'),_0x108d66);}else{fs['unlinkSync'](_0x568291);}});});});}else{return _0x53f767['sendStatus'](0xc8);}})[_0xf234('0x29')](handleError(_0x53f767,null));}; \ No newline at end of file +var _0xb722=['where','pick','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','spread','Tag','findAll','color','smsInteractionTags:save','download','toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Messages','createdAt','SmsAccount','Account','Owner','get','Sms','N.A.','closed','closedAt','disposition','map','direction','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','getOptions','sms','query','show','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','length','merge','options','create','catch','body','find','describe','addMessage','SmsMessage','ids','findOne','hasOwnProperty','nolimit','order','sort'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb722,0xb0));var _0x2b72=function(_0x4f12ee,_0x5bfb94){_0x4f12ee=_0x4f12ee-0x0;var _0x22e8ce=_0xb722[_0x4f12ee];return _0x22e8ce;};'use strict';var rimraf=require(_0x2b72('0x0'));var zipdir=require(_0x2b72('0x1'));var moment=require(_0x2b72('0x2'));var BPromise=require(_0x2b72('0x3'));var util=require('util');var path=require(_0x2b72('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2b72('0x5'));var Redis=require(_0x2b72('0x6'));var interaction=require(_0x2b72('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x2b72('0x8'));var logger=require(_0x2b72('0x9'))(_0x2b72('0xa'));var config=require(_0x2b72('0xb'));var db=require(_0x2b72('0xc'))['db'];config['redis']=_[_0x2b72('0xd')](config[_0x2b72('0xe')],{'host':_0x2b72('0xf'),'port':0x18eb});var socket=require(_0x2b72('0x10'))(new Redis(config['redis']));require(_0x2b72('0x11'))[_0x2b72('0x12')](socket);function respondWithStatusCode(_0x20c045,_0x307843){_0x307843=_0x307843||0xcc;return function(_0x1edec1){if(_0x1edec1){return _0x20c045[_0x2b72('0x13')](_0x307843);}return _0x20c045[_0x2b72('0x14')](_0x307843)[_0x2b72('0x15')]();};}function respondWithResult(_0x787640,_0x59e48a){_0x59e48a=_0x59e48a||0xc8;return function(_0xfaac1e){if(_0xfaac1e){return _0x787640[_0x2b72('0x14')](_0x59e48a)[_0x2b72('0x16')](_0xfaac1e);}};}function respondWithFilteredResult(_0x4483f3,_0x520fe6){return function(_0x2b3481){if(_0x2b3481){var _0x443d7e=typeof _0x520fe6[_0x2b72('0x17')]===_0x2b72('0x18')&&typeof _0x520fe6['limit']==='undefined';var _0x12165c=_0x2b3481[_0x2b72('0x19')];var _0x3fbe6e=_0x443d7e?0x0:_0x520fe6[_0x2b72('0x17')];var _0xee4a23=_0x443d7e?_0x2b3481[_0x2b72('0x19')]:_0x520fe6['offset']+_0x520fe6[_0x2b72('0x1a')];var _0x3842bc;if(_0xee4a23>=_0x12165c){_0xee4a23=_0x12165c;_0x3842bc=0xc8;}else{_0x3842bc=0xce;}_0x4483f3[_0x2b72('0x14')](_0x3842bc);return _0x4483f3[_0x2b72('0x1b')](_0x2b72('0x1c'),_0x3fbe6e+'-'+_0xee4a23+'/'+_0x12165c)[_0x2b72('0x16')](_0x2b3481);}return null;};}function saveUpdates(_0x571020){return function(_0x278473){if(_0x278473){return _0x278473[_0x2b72('0x1d')](_0x571020)[_0x2b72('0x1e')](function(_0x14658a){return _0x14658a;});}return null;};}function removeEntity(_0x14b2d9){return function(_0x65c5dd){if(_0x65c5dd){return _0x65c5dd[_0x2b72('0x1f')]()[_0x2b72('0x1e')](function(){_0x14b2d9[_0x2b72('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d516e){return function(_0x50d6ad){if(!_0x50d6ad){_0x5d516e[_0x2b72('0x13')](0x194);}return _0x50d6ad;};}function handleError(_0x422a7c,_0x36a642){_0x36a642=_0x36a642||0x1f4;return function(_0x406c44){logger[_0x2b72('0x20')](_0x406c44[_0x2b72('0x21')]);if(_0x406c44[_0x2b72('0x22')]){delete _0x406c44[_0x2b72('0x22')];}_0x422a7c[_0x2b72('0x14')](_0x36a642)[_0x2b72('0x23')](_0x406c44);};}exports[_0x2b72('0x24')]=function(_0xd0f36a,_0x1959a4){var _0x162e5={};var _0x1207b2=_['map'](db['SmsInteraction'][_0x2b72('0x25')],function(_0x1c639d){return{'name':_0x1c639d['fieldName'],'type':_0x1c639d[_0x2b72('0x26')][_0x2b72('0x27')]};});_0x162e5=qs[_0x2b72('0x28')](_0x1207b2,_0xd0f36a);return interaction['findAll'](_0x2b72('0x29'),_0xd0f36a[_0x2b72('0x2a')],_0xd0f36a['user'],_0x162e5,_0x1207b2)['then'](respondWithFilteredResult(_0x1959a4,_0x162e5))['catch'](handleError(_0x1959a4,null));};exports[_0x2b72('0x2b')]=function(_0x2755c5,_0xd6a63e){var _0x1573b9={'raw':![],'where':{'id':_0x2755c5[_0x2b72('0x2c')]['id']}},_0x554fea={};_0x554fea[_0x2b72('0x2d')]=_[_0x2b72('0x2e')](db[_0x2b72('0x2f')][_0x2b72('0x25')]);_0x554fea[_0x2b72('0x2a')]=_[_0x2b72('0x2e')](_0x2755c5['query']);_0x554fea[_0x2b72('0x30')]=_[_0x2b72('0x31')](_0x554fea[_0x2b72('0x2d')],_0x554fea[_0x2b72('0x2a')]);_0x1573b9[_0x2b72('0x32')]=_[_0x2b72('0x31')](_0x554fea[_0x2b72('0x2d')],qs['fields'](_0x2755c5[_0x2b72('0x2a')][_0x2b72('0x33')]));_0x1573b9[_0x2b72('0x32')]=_0x1573b9[_0x2b72('0x32')][_0x2b72('0x34')]?_0x1573b9['attributes']:_0x554fea['model'];if(_0x2755c5[_0x2b72('0x2a')]['includeAll']){_0x1573b9['include']=[{'all':!![]}];}_0x1573b9=_[_0x2b72('0x35')]({},_0x1573b9,_0x2755c5[_0x2b72('0x36')]);return db[_0x2b72('0x2f')]['find'](_0x1573b9)[_0x2b72('0x1e')](handleEntityNotFound(_0xd6a63e,null))[_0x2b72('0x1e')](respondWithResult(_0xd6a63e,null))['catch'](handleError(_0xd6a63e,null));};exports[_0x2b72('0x37')]=function(_0x5e0f0a,_0x4bc0c1){return db[_0x2b72('0x2f')][_0x2b72('0x37')](_0x5e0f0a['body'],{})[_0x2b72('0x1e')](respondWithResult(_0x4bc0c1,0xc9))[_0x2b72('0x38')](handleError(_0x4bc0c1,null));};exports[_0x2b72('0x1d')]=function(_0xb473f7,_0x79dcc7){if(_0xb473f7[_0x2b72('0x39')]['id']){delete _0xb473f7[_0x2b72('0x39')]['id'];}return db[_0x2b72('0x2f')][_0x2b72('0x3a')]({'where':{'id':_0xb473f7[_0x2b72('0x2c')]['id']}})['then'](handleEntityNotFound(_0x79dcc7,null))[_0x2b72('0x1e')](saveUpdates(_0xb473f7[_0x2b72('0x39')],null))[_0x2b72('0x1e')](respondWithResult(_0x79dcc7,null))[_0x2b72('0x38')](handleError(_0x79dcc7,null));};exports[_0x2b72('0x1f')]=function(_0x537f69,_0x566d8e){return db['SmsInteraction'][_0x2b72('0x3a')]({'where':{'id':_0x537f69['params']['id']}})[_0x2b72('0x1e')](handleEntityNotFound(_0x566d8e,null))[_0x2b72('0x1e')](removeEntity(_0x566d8e,null))[_0x2b72('0x38')](handleError(_0x566d8e,null));};exports[_0x2b72('0x3b')]=function(_0x1758cb,_0xd944d){return db[_0x2b72('0x2f')][_0x2b72('0x3b')]()['then'](respondWithResult(_0xd944d,null))['catch'](handleError(_0xd944d,null));};exports[_0x2b72('0x3c')]=function(_0x59a652,_0x3a00d1){return db[_0x2b72('0x3d')][_0x2b72('0x3a')]({'where':{'id':_0x59a652[_0x2b72('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3a00d1,null))[_0x2b72('0x1e')](function(_0x2a6851){if(_0x2a6851){return _0x2a6851[_0x2b72('0x3c')](_0x59a652[_0x2b72('0x39')][_0x2b72('0x3e')],_['omit'](_0x59a652[_0x2b72('0x39')],[_0x2b72('0x3e'),'id'])||{});}})[_0x2b72('0x1e')](respondWithResult(_0x3a00d1,null))[_0x2b72('0x38')](handleError(_0x3a00d1,null));};exports['getMessages']=function(_0x48a4e3,_0x132931){var _0x178070={'raw':![],'where':{}};var _0x5534e6={};var _0x458436={'count':0x0,'rows':[]};return db[_0x2b72('0x2f')][_0x2b72('0x3f')]({'where':{'id':_0x48a4e3[_0x2b72('0x2c')]['id']}})[_0x2b72('0x1e')](handleEntityNotFound(_0x132931,null))[_0x2b72('0x1e')](function(_0x19bf5d){if(_0x19bf5d){_0x5534e6[_0x2b72('0x2d')]=_['keys'](db[_0x2b72('0x3d')][_0x2b72('0x25')]);_0x5534e6[_0x2b72('0x2a')]=_[_0x2b72('0x2e')](_0x48a4e3[_0x2b72('0x2a')]);_0x5534e6[_0x2b72('0x30')]=_[_0x2b72('0x31')](_0x5534e6['model'],_0x5534e6[_0x2b72('0x2a')]);_0x178070[_0x2b72('0x32')]=_['intersection'](_0x5534e6[_0x2b72('0x2d')],qs[_0x2b72('0x33')](_0x48a4e3[_0x2b72('0x2a')][_0x2b72('0x33')]));_0x178070[_0x2b72('0x32')]=_0x178070[_0x2b72('0x32')][_0x2b72('0x34')]?_0x178070['attributes']:_0x5534e6[_0x2b72('0x2d')];if(!_0x48a4e3[_0x2b72('0x2a')][_0x2b72('0x40')](_0x2b72('0x41'))){_0x178070[_0x2b72('0x1a')]=qs[_0x2b72('0x1a')](_0x48a4e3[_0x2b72('0x2a')][_0x2b72('0x1a')]);_0x178070[_0x2b72('0x17')]=qs['offset'](_0x48a4e3[_0x2b72('0x2a')][_0x2b72('0x17')]);}_0x178070[_0x2b72('0x42')]=qs[_0x2b72('0x43')](_0x48a4e3['query'][_0x2b72('0x43')]);_0x178070[_0x2b72('0x44')]=qs['filters'](_[_0x2b72('0x45')](_0x48a4e3['query'],_0x5534e6[_0x2b72('0x30')]));_0x178070[_0x2b72('0x44')][_0x2b72('0x46')]=_0x19bf5d['id'];if(_0x48a4e3[_0x2b72('0x2a')][_0x2b72('0x47')]){_0x178070['where']=_[_0x2b72('0x35')](_0x178070[_0x2b72('0x44')],{'$or':_['map'](_0x178070[_0x2b72('0x32')],function(_0x45fd4d){var _0x16dc67={};_0x16dc67[_0x45fd4d]={'$like':'%'+_0x48a4e3['query'][_0x2b72('0x47')]+'%'};return _0x16dc67;})});}if(_0x48a4e3[_0x2b72('0x2a')][_0x2b72('0x48')]){var _0x467a5c=_0x48a4e3['query'][_0x2b72('0x48')]['split'](',');var _0x3811f3={};_0x3811f3[_0x467a5c[0x0]]={'$gte':moment(_0x467a5c[0x1])['format'](_0x2b72('0x49'))};_0x178070['where']=_['merge'](_0x178070[_0x2b72('0x44')],_0x3811f3);}_0x178070=_['merge']({},_0x178070,_0x48a4e3['options']);return db[_0x2b72('0x3d')]['count']({'where':_0x178070[_0x2b72('0x44')]})[_0x2b72('0x1e')](function(_0xd6e3d8){_0x458436[_0x2b72('0x19')]=_0xd6e3d8;if(_0x48a4e3[_0x2b72('0x2a')]['includeAll']){_0x178070[_0x2b72('0x4a')]=[{'all':!![]}];}return db[_0x2b72('0x3d')]['findAll'](_0x178070);})[_0x2b72('0x1e')](function(_0x3b2d60){_0x458436[_0x2b72('0x4b')]=_0x3b2d60;return _0x458436;});}})[_0x2b72('0x1e')](respondWithFilteredResult(_0x132931,_0x178070))[_0x2b72('0x38')](handleError(_0x132931,null));};exports[_0x2b72('0x4c')]=function(_0x5ab8e0,_0x4d5a43){return db[_0x2b72('0x2f')][_0x2b72('0x3a')]({'where':{'id':_0x5ab8e0['params']['id']}})[_0x2b72('0x1e')](handleEntityNotFound(_0x4d5a43,null))[_0x2b72('0x1e')](function(_0x2be063){if(_0x2be063){return _0x2be063[_0x2b72('0x4d')](_0x5ab8e0[_0x2b72('0x39')][_0x2b72('0x3e')],_['omit'](_0x5ab8e0[_0x2b72('0x39')],[_0x2b72('0x3e'),'id'])||{})[_0x2b72('0x4e')](function(){return db[_0x2b72('0x4f')][_0x2b72('0x50')]({'attributes':['id','name',_0x2b72('0x51')],'where':{'id':_0x5ab8e0[_0x2b72('0x39')][_0x2b72('0x3e')]}});})[_0x2b72('0x1e')](function(_0x4dfc00){socket['emit'](_0x2b72('0x52'),{'id':Number(_0x5ab8e0[_0x2b72('0x2c')]['id']),'tags':_0x4dfc00||[]});return{'id':Number(_0x5ab8e0['params']['id']),'tags':_0x4dfc00||[]};});}})['then'](respondWithResult(_0x4d5a43,null))['catch'](handleError(_0x4d5a43,null));};exports['removeTags']=function(_0x3b519a,_0x5a1b1c){return db['SmsInteraction'][_0x2b72('0x3a')]({'where':{'id':_0x3b519a['params']['id']}})[_0x2b72('0x1e')](handleEntityNotFound(_0x5a1b1c,null))['then'](function(_0x516434){if(_0x516434){return _0x516434['removeTags'](_0x3b519a['query']['ids']);}})[_0x2b72('0x1e')](respondWithStatusCode(_0x5a1b1c,null))[_0x2b72('0x38')](handleError(_0x5a1b1c,null));};exports[_0x2b72('0x53')]=function(_0x58e0be,_0x11a99f){var _0x1217cd=moment()['unix']()[_0x2b72('0x54')]();var _0x2f817c=path[_0x2b72('0x55')](config[_0x2b72('0x56')],_0x2b72('0x57'),_0x2b72('0x58'),_0x2b72('0x59'));var _0x22506a=path[_0x2b72('0x55')](_0x2f817c,_0x1217cd);var _0x58b11d=util[_0x2b72('0x5a')](_0x2b72('0x5b'),_0x58e0be[_0x2b72('0x2c')]['id'],_0x1217cd);var _0xab4a7d=path[_0x2b72('0x55')](_0x2f817c,_0x58b11d);var _0x1bdf11=[];_0x1bdf11[_0x2b72('0x5c')]({'model':db[_0x2b72('0x5d')],'as':_0x2b72('0x5d'),'attributes':['id',_0x2b72('0x5e')],'raw':!![]});_0x1bdf11['push']({'model':db['CmContact'],'as':_0x2b72('0x5f'),'attributes':['id',_0x2b72('0x60'),_0x2b72('0x61')],'raw':!![]});var _0x42c0be=[{'model':db[_0x2b72('0x3d')],'as':_0x2b72('0x62'),'attributes':['id',_0x2b72('0x39'),_0x2b72('0x63'),'direction','secret','read'],'include':_0x1bdf11}];_0x42c0be[_0x2b72('0x5c')]({'model':db[_0x2b72('0x64')],'as':_0x2b72('0x65'),'attributes':['id',_0x2b72('0x22')]});_0x42c0be[_0x2b72('0x5c')]({'model':db[_0x2b72('0x5d')],'as':_0x2b72('0x66'),'attributes':['id',_0x2b72('0x5e')]});return db[_0x2b72('0x2f')][_0x2b72('0x3a')]({'where':{'id':_0x58e0be[_0x2b72('0x2c')]['id']},'include':_0x42c0be})[_0x2b72('0x1e')](handleEntityNotFound(_0x11a99f,null))[_0x2b72('0x1e')](function(_0x5a09ee){if(_0x5a09ee){var _0x42e087=_0x5a09ee[_0x2b72('0x67')]({'plain':!![]});fs['mkdirSync'](_0x22506a);var _0x565013={'channel':_0x2b72('0x68'),'account':_0x42e087[_0x2b72('0x65')][_0x2b72('0x22')],'agent':_0x42e087[_0x2b72('0x66')]?_0x42e087[_0x2b72('0x66')]['fullname']:_0x2b72('0x69'),'createdAt':moment(_0x42e087[_0x2b72('0x63')])[_0x2b72('0x5a')](_0x2b72('0x49'))['toString'](),'closedAt':_0x42e087[_0x2b72('0x6a')]?moment(_0x42e087[_0x2b72('0x6b')])['format'](_0x2b72('0x49'))[_0x2b72('0x54')]():'','disposition':_0x42e087[_0x2b72('0x6c')],'messages':_(_0x42e087[_0x2b72('0x62')])[_0x2b72('0x47')]({'secret':![]})[_0x2b72('0x6d')](function(_0x4a07d5){return{'date':moment(_0x4a07d5[_0x2b72('0x63')])[_0x2b72('0x5a')](_0x2b72('0x49'))[_0x2b72('0x54')](),'sender':_0x4a07d5[_0x2b72('0x6e')]===_0x2b72('0x6f')?_0x4a07d5[_0x2b72('0x5d')]?_0x4a07d5[_0x2b72('0x5d')]['fullname']:_0x2b72('0x70'):_0x4a07d5[_0x2b72('0x5f')][_0x2b72('0x60')]+(_0x4a07d5['Contact'][_0x2b72('0x61')]?'\x20'+_0x4a07d5[_0x2b72('0x5f')]['lastName']:''),'body':_0x4a07d5[_0x2b72('0x39')],'direction':_0x4a07d5[_0x2b72('0x6e')]===_0x2b72('0x6f')?'A':'C','secret':_0x4a07d5['secret'],'read':_0x4a07d5[_0x2b72('0x71')]};})[_0x2b72('0x72')]()};return ejs[_0x2b72('0x73')](path['join'](config[_0x2b72('0x56')],_0x2b72('0x57'),_0x2b72('0x74'),_0x2b72('0x75')),{'interaction':_0x565013})[_0x2b72('0x1e')](function(_0x10ba53){var _0x148746=path['join'](_0x22506a,_0x2b72('0x76')+_0x42e087['id']+'-'+_0x1217cd+_0x2b72('0x77'));var _0x59bc43={'path':_0x148746,'channel':_0x2b72('0x68'),'interactionId':_0x42e087['id']};return pdf[_0x2b72('0x78')](_0x10ba53,_0x59bc43);})[_0x2b72('0x1e')](function(){return new BPromise(function(_0x9392ea,_0x44b383){zipdir(_0x22506a,{'saveTo':_0xab4a7d},function(_0x13b2ff,_0x138069){if(_0x13b2ff)return _0x44b383(_0x13b2ff);return _0x9392ea(_0x138069);});})[_0x2b72('0x1e')](function(){return new BPromise(function(_0x2d113c,_0x3d8643){rimraf(_0x22506a,function(_0x188d25){if(_0x188d25)_0x3d8643(_0x188d25);return _0x2d113c();});});})[_0x2b72('0x1e')](function(){return _0x11a99f[_0x2b72('0x53')](_0xab4a7d,_0x58b11d,function(_0x2d99e9){if(_0x2d99e9){console['log']('err',_0x2d99e9);}else{fs[_0x2b72('0x79')](_0xab4a7d);}});});});}else{return _0x11a99f[_0x2b72('0x13')](0xc8);}})[_0x2b72('0x38')](handleError(_0x11a99f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f00f5e2..48bcb4b 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 _0x5f66=['update','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x1caf3f,_0x1b4800){var _0x1905f0=function(_0x36e1eb){while(--_0x36e1eb){_0x1caf3f['push'](_0x1caf3f['shift']());}};_0x1905f0(++_0x1b4800);}(_0x5f66,0x1a0));var _0x65f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f66[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x65f6('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x65f6('0x0'))['db'][_0x65f6('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x65f6('0x2')](0x0);var events={'afterCreate':_0x65f6('0x3'),'afterUpdate':_0x65f6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c5029){return function(_0x5150c8,_0x1c9f5b,_0x22b017){_0x5150c8['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1c0e12){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x6'),_0x1c0e12[_0x65f6('0x7')](function(_0xc44c70){return{'id':_0xc44c70['id']};}));return SmsMessage[_0x65f6('0x8')]({'where':{'SmsInteractionId':_0x5150c8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5123ee){_0x5150c8[_0x65f6('0x5')](_0x65f6('0x9'),_0x5123ee[_0x65f6('0xa')]);SmsInteractionEvents[_0x65f6('0xb')](_0x3c5029+':'+_0x5150c8['id'],_0x5150c8);SmsInteractionEvents['emit'](_0x3c5029,_0x5150c8);_0x22b017(null);})[_0x65f6('0xc')](_0x22b017(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x65f6('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0x25e7=['hasOwnProperty','hook','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit'];(function(_0x3aaf69,_0x318ff9){var _0x4542c6=function(_0x5d1369){while(--_0x5d1369){_0x3aaf69['push'](_0x3aaf69['shift']());}};_0x4542c6(++_0x318ff9);}(_0x25e7,0x1d6));var _0x725e=function(_0xfbc402,_0x5185fb){_0xfbc402=_0xfbc402-0x0;var _0x331507=_0x25e7[_0xfbc402];return _0x331507;};'use strict';var EventEmitter=require(_0x725e('0x0'));var SmsInteraction=require(_0x725e('0x1'))['db'][_0x725e('0x2')];var SmsMessage=require(_0x725e('0x1'))['db'][_0x725e('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x725e('0x4')](0x0);var events={'afterCreate':_0x725e('0x5'),'afterUpdate':_0x725e('0x6'),'afterDestroy':_0x725e('0x7')};function emitEvent(_0x3da706){return function(_0x493364,_0x5e17a9,_0x2497a5){_0x493364['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x111a50){_0x493364[_0x725e('0x8')](_0x725e('0x9'),_0x111a50[_0x725e('0xa')](function(_0x40d238){return{'id':_0x40d238['id']};}));return SmsMessage[_0x725e('0xb')]({'where':{'SmsInteractionId':_0x493364['id'],'direction':'in','read':![]},'raw':!![]});})[_0x725e('0xc')](function(_0x7c40ff){_0x493364[_0x725e('0x8')](_0x725e('0xd'),_0x7c40ff[_0x725e('0xe')]);SmsInteractionEvents[_0x725e('0xf')](_0x3da706+':'+_0x493364['id'],_0x493364);SmsInteractionEvents['emit'](_0x3da706,_0x493364);_0x2497a5(null);})['catch'](_0x2497a5(null));};}for(var e in events){if(events[_0x725e('0x10')](e)){var event=events[e];SmsInteraction[_0x725e('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index ff0dd5e..ed41116 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 _0x6bcc=['format','util','api','bluebird','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt'];(function(_0x3b6dff,_0x2031c8){var _0x274a55=function(_0x15647d){while(--_0x15647d){_0x3b6dff['push'](_0x3b6dff['shift']());}};_0x274a55(++_0x2031c8);}(_0x6bcc,0x17a));var _0xc6bc=function(_0x584bf4,_0x16c912){_0x584bf4=_0x584bf4-0x0;var _0x275380=_0x6bcc[_0x584bf4];return _0x275380;};'use strict';var _=require('lodash');var util=require(_0xc6bc('0x0'));var logger=require('../../config/logger')(_0xc6bc('0x1'));var moment=require('moment');var BPromise=require(_0xc6bc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc6bc('0x3'));var config=require(_0xc6bc('0x4'));var attributes=require(_0xc6bc('0x5'));module[_0xc6bc('0x6')]=function(_0x266ebd,_0x5ec36f){return _0x266ebd[_0xc6bc('0x7')](_0xc6bc('0x8'),attributes,{'tableName':_0xc6bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16fdf2,_0x3d492b,_0x3c767e){if(_0x16fdf2[_0xc6bc('0xa')]('closed')){_0x16fdf2[_0xc6bc('0xb')]=moment()[_0xc6bc('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3c767e(null,_0x16fdf2);}}});}; \ No newline at end of file +var _0xabf7=['../../config/environment','exports','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','request-promise','path','rimraf'];(function(_0x2e0094,_0x34efd3){var _0x1cef92=function(_0x551e90){while(--_0x551e90){_0x2e0094['push'](_0x2e0094['shift']());}};_0x1cef92(++_0x34efd3);}(_0xabf7,0x15a));var _0x7abf=function(_0x1a1eff,_0x7efb6b){_0x1a1eff=_0x1a1eff-0x0;var _0xfd93e9=_0xabf7[_0x1a1eff];return _0xfd93e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7abf('0x0'))(_0x7abf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7abf('0x2'));var fs=require('fs');var path=require(_0x7abf('0x3'));var rimraf=require(_0x7abf('0x4'));var config=require(_0x7abf('0x5'));var attributes=require('./smsInteraction.attributes');module[_0x7abf('0x6')]=function(_0x512d04,_0x333946){return _0x512d04['define'](_0x7abf('0x7'),attributes,{'tableName':_0x7abf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2361e6,_0x1d2eba,_0x2e3cad){if(_0x2361e6['changed'](_0x7abf('0x9'))){_0x2361e6[_0x7abf('0xa')]=moment()[_0x7abf('0xb')](_0x7abf('0xc'));}_0x2e3cad(null,_0x2361e6);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 2c2df96..8e16fa4 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 _0x6a06=['then','addTags','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','debug','find'];(function(_0x17eb4d,_0x2bc081){var _0x54170d=function(_0x21c1e7){while(--_0x21c1e7){_0x17eb4d['push'](_0x17eb4d['shift']());}};_0x54170d(++_0x2bc081);}(_0x6a06,0x81));var _0x66a0=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x6a06[_0x3c04ef];return _0x6a3a69;};'use strict';var _=require('lodash');var util=require(_0x66a0('0x0'));var moment=require(_0x66a0('0x1'));var BPromise=require('bluebird');var rs=require(_0x66a0('0x2'));var fs=require('fs');var Redis=require(_0x66a0('0x3'));var db=require(_0x66a0('0x4'))['db'];var utils=require(_0x66a0('0x5'));var logger=require('../../config/logger')(_0x66a0('0x6'));var config=require(_0x66a0('0x7'));var jayson=require(_0x66a0('0x8'));var client=jayson[_0x66a0('0x9')][_0x66a0('0xa')]({'port':0x232a});config[_0x66a0('0xb')]=_['defaults'](config[_0x66a0('0xb')],{'host':_0x66a0('0xc'),'port':0x18eb});var socket=require(_0x66a0('0xd'))(new Redis(config[_0x66a0('0xb')]));require(_0x66a0('0xe'))[_0x66a0('0xf')](socket);function respondWithRpcPromise(_0x265cd1,_0x53c4e4,_0x400578){return new BPromise(function(_0x38183b,_0x20cee7){return client['request'](_0x265cd1,_0x400578)['then'](function(_0x50f7e1){logger['info'](_0x66a0('0x10'),_0x53c4e4,_0x66a0('0x11'));logger['debug'](_0x66a0('0x12'),_0x53c4e4,_0x66a0('0x11'),JSON[_0x66a0('0x13')](_0x50f7e1));if(_0x50f7e1[_0x66a0('0x14')]){if(_0x50f7e1[_0x66a0('0x14')]['code']===0x1f4){logger[_0x66a0('0x14')](_0x66a0('0x10'),_0x53c4e4,_0x50f7e1[_0x66a0('0x14')][_0x66a0('0x15')]);return _0x20cee7(_0x50f7e1[_0x66a0('0x14')][_0x66a0('0x15')]);}logger[_0x66a0('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x53c4e4,_0x50f7e1[_0x66a0('0x14')][_0x66a0('0x15')]);return _0x38183b(_0x50f7e1['error'][_0x66a0('0x15')]);}else{logger[_0x66a0('0x16')](_0x66a0('0x10'),_0x53c4e4,'request\x20sent');_0x38183b(_0x50f7e1['result'][_0x66a0('0x15')]);}})[_0x66a0('0x17')](function(_0x581b5e){logger[_0x66a0('0x14')](_0x66a0('0x10'),_0x53c4e4,_0x581b5e);_0x20cee7(_0x581b5e);});});}exports[_0x66a0('0x18')]=function(_0x285b1b){var _0x572cc1=this;return new Promise(function(_0xc58597,_0x143e08){return db[_0x66a0('0x19')][_0x66a0('0x1a')](_0x285b1b[_0x66a0('0x1b')],{'raw':_0x285b1b['options']?_0x285b1b[_0x66a0('0x1c')][_0x66a0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285b1b[_0x66a0('0x1c')]?_0x285b1b[_0x66a0('0x1c')][_0x66a0('0x1e')]||null:null,'attributes':_0x285b1b[_0x66a0('0x1c')]?_0x285b1b[_0x66a0('0x1c')][_0x66a0('0x1f')]||null:null,'limit':_0x285b1b[_0x66a0('0x1c')]?_0x285b1b['options'][_0x66a0('0x20')]||null:null})['then'](function(_0x32e3e5){logger[_0x66a0('0x16')](_0x66a0('0x18'),_0x285b1b);logger[_0x66a0('0x21')](_0x66a0('0x18'),_0x285b1b,JSON[_0x66a0('0x13')](_0x32e3e5));_0xc58597(_0x32e3e5);})[_0x66a0('0x17')](function(_0x8fcc9d){logger[_0x66a0('0x14')](_0x66a0('0x18'),_0x8fcc9d[_0x66a0('0x15')],_0x285b1b);_0x143e08(_0x572cc1[_0x66a0('0x14')](0x1f4,_0x8fcc9d[_0x66a0('0x15')]));});});};exports['AddTagsToSmsInteraction']=function(_0x108b29){return new Promise(function(_0x5b1b93,_0x1a2bad){return db['SmsInteraction'][_0x66a0('0x22')]({'where':_0x108b29[_0x66a0('0x1c')]?_0x108b29['options'][_0x66a0('0x1e')]||null:null})[_0x66a0('0x23')](function(_0x383af1){if(_0x383af1){return _0x383af1[_0x66a0('0x24')](_0x108b29[_0x66a0('0x1b')][_0x66a0('0x25')],_[_0x66a0('0x26')](_0x108b29[_0x66a0('0x1b')],[_0x66a0('0x25'),'id'])||{});}})[_0x66a0('0x27')](function(_0x1f39df){logger['info']('AddTags',_0x108b29);logger['debug'](_0x66a0('0x28'),_0x108b29,JSON[_0x66a0('0x13')](_0x1f39df));_0x5b1b93(_0x1f39df);})[_0x66a0('0x17')](function(_0x570528){logger[_0x66a0('0x14')](_0x66a0('0x28'),_0x570528[_0x66a0('0x15')],_0x108b29);_0x1a2bad(_this[_0x66a0('0x14')](0x1f4,_0x570528[_0x66a0('0x15')]));});});}; \ No newline at end of file +var _0x8885=['options','raw','where','attributes','limit','debug','find','ids','AddTags','stringify','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','UpdateSmsInteraction','SmsInteraction','update','body'];(function(_0x3637ba,_0x4153ef){var _0x2d8e0e=function(_0x216146){while(--_0x216146){_0x3637ba['push'](_0x3637ba['shift']());}};_0x2d8e0e(++_0x4153ef);}(_0x8885,0x190));var _0x5888=function(_0x473c3c,_0x356759){_0x473c3c=_0x473c3c-0x0;var _0x35e131=_0x8885[_0x473c3c];return _0x35e131;};'use strict';var _=require(_0x5888('0x0'));var util=require('util');var moment=require(_0x5888('0x1'));var BPromise=require(_0x5888('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5888('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5888('0x4'))('rpc');var config=require(_0x5888('0x5'));var jayson=require(_0x5888('0x6'));var client=jayson[_0x5888('0x7')][_0x5888('0x8')]({'port':0x232a});config['redis']=_[_0x5888('0x9')](config[_0x5888('0xa')],{'host':_0x5888('0xb'),'port':0x18eb});var socket=require(_0x5888('0xc'))(new Redis(config['redis']));require(_0x5888('0xd'))[_0x5888('0xe')](socket);function respondWithRpcPromise(_0x47666d,_0x35f81a,_0x29c833){return new BPromise(function(_0x260447,_0x453b12){return client[_0x5888('0xf')](_0x47666d,_0x29c833)[_0x5888('0x10')](function(_0xe0c916){logger[_0x5888('0x11')](_0x5888('0x12'),_0x35f81a,'request\x20sent');logger['debug'](_0x5888('0x13'),_0x35f81a,'request\x20sent',JSON['stringify'](_0xe0c916));if(_0xe0c916[_0x5888('0x14')]){if(_0xe0c916[_0x5888('0x14')][_0x5888('0x15')]===0x1f4){logger[_0x5888('0x14')](_0x5888('0x12'),_0x35f81a,_0xe0c916['error'][_0x5888('0x16')]);return _0x453b12(_0xe0c916[_0x5888('0x14')]['message']);}logger[_0x5888('0x14')](_0x5888('0x12'),_0x35f81a,_0xe0c916[_0x5888('0x14')][_0x5888('0x16')]);return _0x260447(_0xe0c916[_0x5888('0x14')][_0x5888('0x16')]);}else{logger[_0x5888('0x11')](_0x5888('0x12'),_0x35f81a,_0x5888('0x17'));_0x260447(_0xe0c916['result'][_0x5888('0x16')]);}})[_0x5888('0x18')](function(_0x3d47c6){logger[_0x5888('0x14')](_0x5888('0x12'),_0x35f81a,_0x3d47c6);_0x453b12(_0x3d47c6);});});}exports[_0x5888('0x19')]=function(_0x305567){var _0x5c7714=this;return new Promise(function(_0xaee3ac,_0x26089d){return db[_0x5888('0x1a')][_0x5888('0x1b')](_0x305567[_0x5888('0x1c')],{'raw':_0x305567[_0x5888('0x1d')]?_0x305567[_0x5888('0x1d')][_0x5888('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x305567[_0x5888('0x1d')]?_0x305567[_0x5888('0x1d')][_0x5888('0x1f')]||null:null,'attributes':_0x305567[_0x5888('0x1d')]?_0x305567['options'][_0x5888('0x20')]||null:null,'limit':_0x305567[_0x5888('0x1d')]?_0x305567[_0x5888('0x1d')][_0x5888('0x21')]||null:null})[_0x5888('0x10')](function(_0x9bb5ed){logger[_0x5888('0x11')](_0x5888('0x19'),_0x305567);logger[_0x5888('0x22')](_0x5888('0x19'),_0x305567,JSON['stringify'](_0x9bb5ed));_0xaee3ac(_0x9bb5ed);})[_0x5888('0x18')](function(_0x3ecedd){logger[_0x5888('0x14')](_0x5888('0x19'),_0x3ecedd['message'],_0x305567);_0x26089d(_0x5c7714[_0x5888('0x14')](0x1f4,_0x3ecedd[_0x5888('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1c78b6){return new Promise(function(_0x1fd3b5,_0x4a68a6){return db['SmsInteraction'][_0x5888('0x23')]({'where':_0x1c78b6[_0x5888('0x1d')]?_0x1c78b6[_0x5888('0x1d')][_0x5888('0x1f')]||null:null})[_0x5888('0x10')](function(_0x275b6e){if(_0x275b6e){return _0x275b6e['addTags'](_0x1c78b6[_0x5888('0x1c')][_0x5888('0x24')],_['omit'](_0x1c78b6[_0x5888('0x1c')],[_0x5888('0x24'),'id'])||{});}})['spread'](function(_0x3082c6){logger[_0x5888('0x11')](_0x5888('0x25'),_0x1c78b6);logger[_0x5888('0x22')](_0x5888('0x25'),_0x1c78b6,JSON[_0x5888('0x26')](_0x3082c6));_0x1fd3b5(_0x3082c6);})[_0x5888('0x18')](function(_0xf75b2a){logger[_0x5888('0x14')](_0x5888('0x25'),_0xf75b2a[_0x5888('0x16')],_0x1c78b6);_0x4a68a6(_this[_0x5888('0x14')](0x1f4,_0xf75b2a[_0x5888('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f62fba2..70a8d56 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 _0xad26=['removeListener','length','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x1770af,_0x468922){var _0x2fac82=function(_0x31e3d5){while(--_0x31e3d5){_0x1770af['push'](_0x1770af['shift']());}};_0x2fac82(++_0x468922);}(_0xad26,0x1b5));var _0x6ad2=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xad26[_0x5416db];return _0x243e35;};'use strict';var SmsInteractionEvents=require(_0x6ad2('0x0'));var events=['save',_0x6ad2('0x1'),_0x6ad2('0x2')];function createListener(_0x1f75db,_0x503454){return function(_0x5cefcb){_0x503454[_0x6ad2('0x3')](_0x1f75db,_0x5cefcb);};}function removeListener(_0x33b065,_0x364f7f){return function(){SmsInteractionEvents[_0x6ad2('0x4')](_0x33b065,_0x364f7f);};}exports['register']=function(_0x3362df){for(var _0xc29058=0x0,_0x1f88a9=events[_0x6ad2('0x5')];_0xc29058<_0x1f88a9;_0xc29058++){var _0xa226b4=events[_0xc29058];var _0x46731c=createListener(_0x6ad2('0x6')+_0xa226b4,_0x3362df);SmsInteractionEvents['on'](_0xa226b4,_0x46731c);}}; \ No newline at end of file +var _0xaf4f=['register','length','smsInteraction:','./smsInteraction.events','remove','update','emit'];(function(_0x596921,_0x71146d){var _0x4b3ed0=function(_0x4c591c){while(--_0x4c591c){_0x596921['push'](_0x596921['shift']());}};_0x4b3ed0(++_0x71146d);}(_0xaf4f,0x145));var _0xfaf4=function(_0x20b18f,_0xf29421){_0x20b18f=_0x20b18f-0x0;var _0x510ea8=_0xaf4f[_0x20b18f];return _0x510ea8;};'use strict';var SmsInteractionEvents=require(_0xfaf4('0x0'));var events=['save',_0xfaf4('0x1'),_0xfaf4('0x2')];function createListener(_0x40c91d,_0x503e28){return function(_0x57bfac){_0x503e28[_0xfaf4('0x3')](_0x40c91d,_0x57bfac);};}function removeListener(_0x3234cc,_0x59a9b8){return function(){SmsInteractionEvents['removeListener'](_0x3234cc,_0x59a9b8);};}exports[_0xfaf4('0x4')]=function(_0x174be0){for(var _0x116b53=0x0,_0x146dae=events[_0xfaf4('0x5')];_0x116b53<_0x146dae;_0x116b53++){var _0x3a5449=events[_0x116b53];var _0x21ccd8=createListener(_0xfaf4('0x6')+_0x3a5449,_0x174be0);SmsInteractionEvents['on'](_0x3a5449,_0x21ccd8);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f72c619..5d3cd59 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 _0x1fc2=['status','put','/:id/accept','accept','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','sms','create','/:id/status'];(function(_0x7048b0,_0x218a7e){var _0x3063bd=function(_0x92bc79){while(--_0x92bc79){_0x7048b0['push'](_0x7048b0['shift']());}};_0x3063bd(++_0x218a7e);}(_0x1fc2,0x123));var _0x21fc=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x1fc2[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0x21fc('0x0'));var util=require(_0x21fc('0x1'));var path=require('path');var timeout=require(_0x21fc('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x21fc('0x3'));var interaction=require(_0x21fc('0x4'));var config=require(_0x21fc('0x5'));var controller=require('./smsMessage.controller');router[_0x21fc('0x6')]('/',auth[_0x21fc('0x7')](),controller[_0x21fc('0x8')]);router[_0x21fc('0x6')](_0x21fc('0x9'),auth[_0x21fc('0x7')](),controller[_0x21fc('0xa')]);router[_0x21fc('0x6')](_0x21fc('0xb'),auth['isAuthenticated'](),controller[_0x21fc('0xc')]);router[_0x21fc('0xd')]('/',auth[_0x21fc('0x7')](),interaction['tracked'](_0x21fc('0xe'),'smsmessage:create'),controller[_0x21fc('0xf')]);router[_0x21fc('0xd')](_0x21fc('0x10'),controller[_0x21fc('0x11')]);router[_0x21fc('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x21fc('0x12')](_0x21fc('0x13'),auth[_0x21fc('0x7')](),controller[_0x21fc('0x14')]);router['put']('/:id/reject',auth[_0x21fc('0x7')](),controller['reject']);router['delete'](_0x21fc('0xb'),auth[_0x21fc('0x7')](),controller['destroy']);module[_0x21fc('0x15')]=router; \ No newline at end of file +var _0xaec0=['show','post','tracked','smsmessage:create','create','/:id/status','status','put','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaec0,0x100));var _0x0aec=function(_0x150286,_0x7d6011){_0x150286=_0x150286-0x0;var _0x58f0a8=_0xaec0[_0x150286];return _0x58f0a8;};'use strict';var multer=require(_0x0aec('0x0'));var util=require(_0x0aec('0x1'));var path=require(_0x0aec('0x2'));var timeout=require(_0x0aec('0x3'));var express=require(_0x0aec('0x4'));var router=express[_0x0aec('0x5')]();var fs_extra=require(_0x0aec('0x6'));var auth=require(_0x0aec('0x7'));var interaction=require(_0x0aec('0x8'));var config=require(_0x0aec('0x9'));var controller=require('./smsMessage.controller');router[_0x0aec('0xa')]('/',auth[_0x0aec('0xb')](),controller['index']);router['get'](_0x0aec('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0aec('0xa')](_0x0aec('0xd'),auth[_0x0aec('0xb')](),controller[_0x0aec('0xe')]);router[_0x0aec('0xf')]('/',auth[_0x0aec('0xb')](),interaction[_0x0aec('0x10')]('sms',_0x0aec('0x11')),controller[_0x0aec('0x12')]);router[_0x0aec('0xf')](_0x0aec('0x13'),controller[_0x0aec('0x14')]);router[_0x0aec('0x15')](_0x0aec('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0aec('0x15')](_0x0aec('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0x0aec('0x15')](_0x0aec('0x17'),auth[_0x0aec('0xb')](),controller['reject']);router[_0x0aec('0x18')](_0x0aec('0xd'),auth[_0x0aec('0xb')](),controller[_0x0aec('0x19')]);module[_0x0aec('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 9c4f48a..d1bea2d 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 _0xf685=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xf685,0x117));var _0x5f68=function(_0x53bc4f,_0x4fcc7d){_0x53bc4f=_0x53bc4f-0x0;var _0x1886aa=_0xf685[_0x53bc4f];return _0x1886aa;};'use strict';var Sequelize=require(_0x5f68('0x0'));module[_0x5f68('0x1')]={'body':{'type':Sequelize[_0x5f68('0x2')](_0x5f68('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5f68('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5f68('0x5')]('in',_0x5f68('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5f68('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5f68('0x7')]},'providerResponse':{'type':Sequelize[_0x5f68('0x2')]}}; \ No newline at end of file +var _0x53bb=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x58763d,_0x357f90){var _0x2e1320=function(_0xfbe7d1){while(--_0xfbe7d1){_0x58763d['push'](_0x58763d['shift']());}};_0x2e1320(++_0x357f90);}(_0x53bb,0x168));var _0xb53b=function(_0x56a4a6,_0x28956f){_0x56a4a6=_0x56a4a6-0x0;var _0xf73a91=_0x53bb[_0x56a4a6];return _0xf73a91;};'use strict';var Sequelize=require(_0xb53b('0x0'));module[_0xb53b('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb53b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb53b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb53b('0x4')]('in',_0xb53b('0x5')),'defaultValue':_0xb53b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xb53b('0x6')]},'secret':{'type':Sequelize[_0xb53b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb53b('0x7')]},'providerResponse':{'type':Sequelize[_0xb53b('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1fdd734..e894e43 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 _0x52aa=['redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','destroy','stack','name','map','SmsMessage','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteraction','read1stAt','interaction','user','role','stringify','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','SmsInteractionId','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','User','internal','SIP/%s','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x527cc4,_0x30e676){var _0x8b8ed8=function(_0x544378){while(--_0x544378){_0x527cc4['push'](_0x527cc4['shift']());}};_0x8b8ed8(++_0x30e676);}(_0x52aa,0x113));var _0xa52a=function(_0x49aa23,_0x479060){_0x49aa23=_0x49aa23-0x0;var _0x343f82=_0x52aa[_0x49aa23];return _0x343f82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa52a('0x0'));var zipdir=require(_0xa52a('0x1'));var jsonpatch=require(_0xa52a('0x2'));var rp=require(_0xa52a('0x3'));var moment=require(_0xa52a('0x4'));var BPromise=require(_0xa52a('0x5'));var Mustache=require(_0xa52a('0x6'));var util=require(_0xa52a('0x7'));var path=require(_0xa52a('0x8'));var sox=require(_0xa52a('0x9'));var csv=require(_0xa52a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa52a('0xb'));var squel=require(_0xa52a('0xc'));var crypto=require(_0xa52a('0xd'));var jsforce=require(_0xa52a('0xe'));var deskjs=require(_0xa52a('0xf'));var toCsv=require(_0xa52a('0xa'));var querystring=require(_0xa52a('0x10'));var Papa=require(_0xa52a('0x11'));var Redis=require(_0xa52a('0x12'));var authService=require(_0xa52a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa52a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa52a('0x15'))(_0xa52a('0x16'));var utils=require(_0xa52a('0x17'));var config=require(_0xa52a('0x18'));var licenseUtil=require(_0xa52a('0x19'));var db=require(_0xa52a('0x1a'))['db'];config[_0xa52a('0x1b')]=_[_0xa52a('0x1c')](config[_0xa52a('0x1b')],{'host':_0xa52a('0x1d'),'port':0x18eb});var socket=require(_0xa52a('0x1e'))(new Redis(config[_0xa52a('0x1b')]));require(_0xa52a('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa52a('0x20')][_0xa52a('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xa52a('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x24cffa,_0x1380b1,_0x3b6cf7,_0xa0faac){return new BPromise(function(_0x3ec21a,_0x6e2ef1){var _0x243230=_0xa0faac||client;return _0x243230[_0xa52a('0x22')](_0x24cffa,_0x3b6cf7)[_0xa52a('0x23')](function(_0x5e0018){logger[_0xa52a('0x24')](_0xa52a('0x25'),_0x1380b1,_0xa52a('0x26'));logger[_0xa52a('0x27')](_0xa52a('0x28'),_0x1380b1,_0xa52a('0x26'),JSON['stringify'](_0x5e0018));if(_0x5e0018[_0xa52a('0x29')]){if(_0x5e0018[_0xa52a('0x29')][_0xa52a('0x2a')]===0x1f4){logger[_0xa52a('0x29')]('SmsMessage,\x20%s,\x20%s',_0x1380b1,_0x5e0018[_0xa52a('0x29')][_0xa52a('0x2b')]);return _0x6e2ef1(_0x5e0018[_0xa52a('0x29')][_0xa52a('0x2b')]);}logger[_0xa52a('0x29')]('SmsMessage,\x20%s,\x20%s',_0x1380b1,_0x5e0018[_0xa52a('0x29')]['message']);return _0x3ec21a(_0x5e0018['error'][_0xa52a('0x2b')]);}else{logger[_0xa52a('0x24')]('SmsMessage,\x20%s,\x20%s',_0x1380b1,'request\x20sent');_0x3ec21a(_0x5e0018[_0xa52a('0x2c')][_0xa52a('0x2b')]);}})['catch'](function(_0x1fbdc5){logger[_0xa52a('0x29')](_0xa52a('0x25'),_0x1380b1,_0x1fbdc5);_0x6e2ef1(_0x1fbdc5);});});}function respondWithStatusCode(_0x443c38,_0x286280){_0x286280=_0x286280||0xcc;return function(_0x269431){if(_0x269431){return _0x443c38[_0xa52a('0x2d')](_0x286280);}return _0x443c38[_0xa52a('0x2e')](_0x286280)[_0xa52a('0x2f')]();};}function respondWithResult(_0x1e8ff6,_0x2fd577){_0x2fd577=_0x2fd577||0xc8;return function(_0x2bae56){if(_0x2bae56){return _0x1e8ff6[_0xa52a('0x2e')](_0x2fd577)[_0xa52a('0x30')](_0x2bae56);}};}function respondWithFilteredResult(_0x15867e,_0x3bb4f7){return function(_0x1a82c4){if(_0x1a82c4){var _0x950f7e=typeof _0x3bb4f7['offset']===_0xa52a('0x31')&&typeof _0x3bb4f7[_0xa52a('0x32')]===_0xa52a('0x31');var _0x55418e=_0x1a82c4['count'];var _0x30449c=_0x950f7e?0x0:_0x3bb4f7[_0xa52a('0x33')];var _0x3c8c7d=_0x950f7e?_0x1a82c4['count']:_0x3bb4f7[_0xa52a('0x33')]+_0x3bb4f7[_0xa52a('0x32')];var _0x552fc5;if(_0x3c8c7d>=_0x55418e){_0x3c8c7d=_0x55418e;_0x552fc5=0xc8;}else{_0x552fc5=0xce;}_0x15867e[_0xa52a('0x2e')](_0x552fc5);return _0x15867e[_0xa52a('0x34')](_0xa52a('0x35'),_0x30449c+'-'+_0x3c8c7d+'/'+_0x55418e)[_0xa52a('0x30')](_0x1a82c4);}return null;};}function patchUpdates(_0x15a2a4){return function(_0x2d12f3){try{jsonpatch[_0xa52a('0x36')](_0x2d12f3,_0x15a2a4,!![]);}catch(_0x3282be){return BPromise['reject'](_0x3282be);}return _0x2d12f3[_0xa52a('0x37')]();};}function saveUpdates(_0x59b22f,_0x4897df){return function(_0x8cbdac){if(_0x8cbdac){return _0x8cbdac[_0xa52a('0x38')](_0x59b22f)[_0xa52a('0x23')](function(_0x11de63){return _0x11de63;});}return null;};}function removeEntity(_0x556d88,_0x4dcd3c){return function(_0x556e0e){if(_0x556e0e){return _0x556e0e[_0xa52a('0x39')]()['then'](function(){_0x556d88[_0xa52a('0x2e')](0xcc)[_0xa52a('0x2f')]();});}};}function handleEntityNotFound(_0xb977e,_0x493306){return function(_0x55b60f){if(!_0x55b60f){_0xb977e[_0xa52a('0x2d')](0x194);}return _0x55b60f;};}function handleError(_0x42cfb4,_0x3636f1){_0x3636f1=_0x3636f1||0x1f4;return function(_0x1660cf){logger[_0xa52a('0x29')](_0x1660cf[_0xa52a('0x3a')]);if(_0x1660cf[_0xa52a('0x3b')]){delete _0x1660cf[_0xa52a('0x3b')];}_0x42cfb4['status'](_0x3636f1)['send'](_0x1660cf);};}exports['index']=function(_0xbd41c1,_0xe71454){var _0x5aba37={},_0x55dbeb={},_0x455c28={'count':0x0,'rows':[]};var _0x4e0e16=_[_0xa52a('0x3c')](db[_0xa52a('0x3d')][_0xa52a('0x3e')],function(_0x27264b){return{'name':_0x27264b['fieldName'],'type':_0x27264b[_0xa52a('0x3f')][_0xa52a('0x40')]};});_0x55dbeb['model']=_['map'](_0x4e0e16,_0xa52a('0x3b'));_0x55dbeb[_0xa52a('0x41')]=_[_0xa52a('0x42')](_0xbd41c1['query']);_0x55dbeb[_0xa52a('0x43')]=_['intersection'](_0x55dbeb[_0xa52a('0x44')],_0x55dbeb[_0xa52a('0x41')]);_0x5aba37[_0xa52a('0x45')]=_[_0xa52a('0x46')](_0x55dbeb[_0xa52a('0x44')],qs[_0xa52a('0x47')](_0xbd41c1[_0xa52a('0x41')][_0xa52a('0x47')]));_0x5aba37['attributes']=_0x5aba37[_0xa52a('0x45')][_0xa52a('0x48')]?_0x5aba37[_0xa52a('0x45')]:_0x55dbeb[_0xa52a('0x44')];if(!_0xbd41c1['query'][_0xa52a('0x49')]('nolimit')){_0x5aba37[_0xa52a('0x32')]=qs['limit'](_0xbd41c1['query'][_0xa52a('0x32')]);_0x5aba37['offset']=qs[_0xa52a('0x33')](_0xbd41c1[_0xa52a('0x41')][_0xa52a('0x33')]);}_0x5aba37[_0xa52a('0x4a')]=qs['sort'](_0xbd41c1[_0xa52a('0x41')]['sort']);_0x5aba37[_0xa52a('0x4b')]=qs[_0xa52a('0x43')](_[_0xa52a('0x4c')](_0xbd41c1[_0xa52a('0x41')],_0x55dbeb[_0xa52a('0x43')]),_0x4e0e16);if(_0xbd41c1[_0xa52a('0x41')][_0xa52a('0x4d')]){_0x5aba37['where']=_[_0xa52a('0x4e')](_0x5aba37[_0xa52a('0x4b')],{'$or':_['map'](_0x4e0e16,function(_0x5f5a9e){if(_0x5f5a9e['type']!==_0xa52a('0x4f')){var _0x1fad81={};_0x1fad81[_0x5f5a9e[_0xa52a('0x3b')]]={'$like':'%'+_0xbd41c1['query'][_0xa52a('0x4d')]+'%'};return _0x1fad81;}})});}_0x5aba37=_[_0xa52a('0x4e')]({},_0x5aba37,_0xbd41c1[_0xa52a('0x50')]);var _0x4b3242={'where':_0x5aba37[_0xa52a('0x4b')]};return db[_0xa52a('0x3d')][_0xa52a('0x51')](_0x4b3242)[_0xa52a('0x23')](function(_0x324fc2){_0x455c28[_0xa52a('0x51')]=_0x324fc2;if(_0xbd41c1[_0xa52a('0x41')][_0xa52a('0x52')]){_0x5aba37[_0xa52a('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0xa52a('0x54')](_0x5aba37);})[_0xa52a('0x23')](function(_0x3c91bf){_0x455c28[_0xa52a('0x55')]=_0x3c91bf;return _0x455c28;})[_0xa52a('0x23')](respondWithFilteredResult(_0xe71454,_0x5aba37))['catch'](handleError(_0xe71454,null));};exports[_0xa52a('0x56')]=function(_0x17ff83,_0x1dc8a0){var _0x436ade={'raw':!![],'where':{'id':_0x17ff83[_0xa52a('0x57')]['id']}},_0x2f443c={};_0x2f443c[_0xa52a('0x44')]=_[_0xa52a('0x42')](db['SmsMessage'][_0xa52a('0x3e')]);_0x2f443c[_0xa52a('0x41')]=_['keys'](_0x17ff83['query']);_0x2f443c[_0xa52a('0x43')]=_['intersection'](_0x2f443c['model'],_0x2f443c['query']);_0x436ade[_0xa52a('0x45')]=_[_0xa52a('0x46')](_0x2f443c['model'],qs[_0xa52a('0x47')](_0x17ff83[_0xa52a('0x41')][_0xa52a('0x47')]));_0x436ade[_0xa52a('0x45')]=_0x436ade[_0xa52a('0x45')][_0xa52a('0x48')]?_0x436ade[_0xa52a('0x45')]:_0x2f443c[_0xa52a('0x44')];if(_0x17ff83[_0xa52a('0x41')][_0xa52a('0x52')]){_0x436ade['include']=[{'all':!![]}];}_0x436ade=_[_0xa52a('0x4e')]({},_0x436ade,_0x17ff83[_0xa52a('0x50')]);return db[_0xa52a('0x3d')]['find'](_0x436ade)['then'](handleEntityNotFound(_0x1dc8a0,null))[_0xa52a('0x23')](respondWithResult(_0x1dc8a0,null))[_0xa52a('0x58')](handleError(_0x1dc8a0,null));};exports[_0xa52a('0x59')]=function(_0x5b82c2,_0x128cee){return db[_0xa52a('0x3d')]['create'](_0x5b82c2['body'],{})[_0xa52a('0x23')](respondWithResult(_0x128cee,0xc9))[_0xa52a('0x58')](handleError(_0x128cee,null));};exports[_0xa52a('0x38')]=function(_0x2cdd4f,_0x28e920){if(_0x2cdd4f[_0xa52a('0x5a')]['id']){delete _0x2cdd4f[_0xa52a('0x5a')]['id'];}return db[_0xa52a('0x3d')][_0xa52a('0x5b')]({'where':{'id':_0x2cdd4f[_0xa52a('0x57')]['id']}})[_0xa52a('0x23')](handleEntityNotFound(_0x28e920,null))['then'](saveUpdates(_0x2cdd4f[_0xa52a('0x5a')],null))[_0xa52a('0x23')](respondWithResult(_0x28e920,null))[_0xa52a('0x58')](handleError(_0x28e920,null));};exports[_0xa52a('0x39')]=function(_0xeb80cf,_0x3bea59){return db['SmsMessage']['find']({'where':{'id':_0xeb80cf[_0xa52a('0x57')]['id']}})['then'](handleEntityNotFound(_0x3bea59,null))[_0xa52a('0x23')](removeEntity(_0x3bea59,null))[_0xa52a('0x58')](handleError(_0x3bea59,null));};exports[_0xa52a('0x5c')]=function(_0x27efc5,_0xae9d37){return db['SmsMessage'][_0xa52a('0x5c')]()[_0xa52a('0x23')](respondWithResult(_0xae9d37,null))[_0xa52a('0x58')](handleError(_0xae9d37,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xa52a('0x5d')]=function(_0x149461,_0xb5678f,_0x598326){var _0x1358f6={'agent':{},'channel':_0xa52a('0x5e')};if(_0x149461[_0xa52a('0x5a')]['id']){delete _0x149461[_0xa52a('0x5a')]['id'];}_0x149461[_0xa52a('0x5a')][_0xa52a('0x5f')]=!![];_0x149461[_0xa52a('0x5a')][_0xa52a('0x60')]=moment()[_0xa52a('0x61')](_0xa52a('0x62'));_0x149461[_0xa52a('0x5a')][_0xa52a('0x63')]=_0x149461[_0xa52a('0x5a')][_0xa52a('0x63')]||_0x149461['user']['id'];_0x1358f6[_0xa52a('0x64')]['id']=_0x149461[_0xa52a('0x5a')][_0xa52a('0x63')];return db[_0xa52a('0x3d')][_0xa52a('0x5b')]({'where':{'id':_0x149461[_0xa52a('0x57')]['id'],'UserId':null}})[_0xa52a('0x23')](handleEntityNotFound(_0xb5678f,null))[_0xa52a('0x23')](saveUpdates(_0x149461[_0xa52a('0x5a')],null))['then'](function(_0x4a06ac){if(_0x4a06ac){_0x1358f6[_0xa52a('0x2b')]=_0x4a06ac['get']({'plain':!![]});return db[_0xa52a('0x65')][_0xa52a('0x5b')]({'where':{'id':_0x4a06ac['SmsInteractionId']}});}return null;})[_0xa52a('0x23')](handleEntityNotFound(_0xb5678f,null))[_0xa52a('0x23')](function(_0x577a03){if(_0x577a03){return _0x577a03[_0xa52a('0x38')]({'UserId':_0x149461[_0xa52a('0x5a')][_0xa52a('0x63')],'read1stAt':_['isNil'](_0x577a03[_0xa52a('0x66')])?moment()[_0xa52a('0x61')](_0xa52a('0x62')):undefined});}return null;})['then'](function(_0x4960f8){if(_0x4960f8){_0x1358f6[_0xa52a('0x67')]=_0x4960f8['get']({'plain':!![]});interaction_log[_0xa52a('0x24')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x149461[_0xa52a('0x68')]['id'],_0x149461[_0xa52a('0x68')][_0xa52a('0x3b')],_0x149461['user'][_0xa52a('0x69')],_0x1358f6['interaction']['id'],_0x149461[_0xa52a('0x5a')]?JSON[_0xa52a('0x6a')](_0x149461['body']):_0xa52a('0x6b'));return respondWithRpcPromise(_0xa52a('0x6c'),_0xa52a('0x6d'),_0x1358f6);}return null;})[_0xa52a('0x23')](function(_0x19bf8c){var _0x10446d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x19bf8c[_0xa52a('0x2b')][_0xa52a('0x6e')];return db[_0xa52a('0x6f')][_0xa52a('0x41')](_0x10446d,{'type':db[_0xa52a('0x70')][_0xa52a('0x71')][_0xa52a('0x72')],'raw':!![]})['then'](function(_0x4a6ec3){return _0x4a6ec3;});})['then'](function(_0xfb83b){if(_0xfb83b){_0x1358f6[_0xa52a('0x2b')]['contact']=_0xfb83b[0x0];if(!_0x149461[_0xa52a('0x5a')][_0xa52a('0x63')])return;return db['User']['find']({'where':{'id':_0x149461[_0xa52a('0x5a')]['UserId'],'role':_0xa52a('0x64')},'attributes':['id',_0xa52a('0x3b'),_0xa52a('0x73'),_0xa52a('0x74'),'internal'],'raw':!![]});}return null;})[_0xa52a('0x23')](function(_0x19f6fe){if(!_0x19f6fe)return null;_0x1358f6['message'][_0xa52a('0x64')]=_0x19f6fe;return _0x1358f6;})[_0xa52a('0x23')](function(_0x1ec979){if(_0x1ec979){if(_0x149461[_0xa52a('0x5a')][_0xa52a('0x75')]){_0x1358f6[_0xa52a('0x2b')][_0xa52a('0x76')]=util[_0xa52a('0x61')]('SIP/%s',_0x149461[_0xa52a('0x68')][_0xa52a('0x3b')]);_0x1358f6[_0xa52a('0x2b')][_0xa52a('0x77')]=_0x1358f6[_0xa52a('0x77')];_0x1358f6[_0xa52a('0x2b')][_0xa52a('0x78')]=_0x1358f6[_0xa52a('0x77')];_0x1358f6[_0xa52a('0x2b')][_0xa52a('0x79')]=_0xa52a('0x5d');return respondWithRpcPromise(_0xa52a('0x7a'),'EventManager',{'event':_0xa52a('0x7b'),'message':_0x1358f6[_0xa52a('0x2b')]},client9002)['then'](function(){return _0x1358f6;});}return _0x1358f6;}return null;})[_0xa52a('0x23')](respondWithResult(_0xb5678f,null))['catch'](handleError(_0xb5678f,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xa52a('0x7c')]=function(_0x506f61,_0xc44217,_0x499e0e){var _0xbb4dde={'agent':{},'channel':_0xa52a('0x5e')};if(_0x506f61[_0xa52a('0x5a')]['id']){delete _0x506f61['body']['id'];}_0x506f61['body'][_0xa52a('0x63')]=_0x506f61['body'][_0xa52a('0x63')]||_0x506f61[_0xa52a('0x68')]['id'];_0xbb4dde['agent']['id']=_0x506f61['body'][_0xa52a('0x63')];return db[_0xa52a('0x3d')][_0xa52a('0x5b')]({'where':{'id':_0x506f61[_0xa52a('0x57')]['id'],'UserId':null}})[_0xa52a('0x23')](handleEntityNotFound(_0xc44217,null))[_0xa52a('0x23')](function(_0x726f1e){if(_0x726f1e){_0xbb4dde[_0xa52a('0x2b')]=_0x726f1e['get']({'plain':!![]});return db[_0xa52a('0x65')][_0xa52a('0x5b')]({'where':{'id':_0x726f1e[_0xa52a('0x7d')]}});}return null;})[_0xa52a('0x23')](handleEntityNotFound(_0xc44217,null))[_0xa52a('0x23')](function(_0x45cafd){if(_0x45cafd){_0xbb4dde[_0xa52a('0x67')]=_0x45cafd[_0xa52a('0x7e')]({'plain':!![]});interaction_log[_0xa52a('0x24')](_0xa52a('0x7f'),_0x506f61['user']['id'],_0x506f61[_0xa52a('0x68')][_0xa52a('0x3b')],_0x506f61['user']['role'],_0xbb4dde[_0xa52a('0x67')]['id'],_0x506f61[_0xa52a('0x5a')]?JSON[_0xa52a('0x6a')](_0x506f61[_0xa52a('0x5a')]):_0xa52a('0x6b'));return respondWithRpcPromise(_0xa52a('0x80'),_0xa52a('0x81'),_0xbb4dde);}return null;})['then'](function(_0x1daec0){var _0x55908d=_0xa52a('0x82')+_0x1daec0[_0xa52a('0x2b')][_0xa52a('0x6e')];return db[_0xa52a('0x6f')][_0xa52a('0x41')](_0x55908d,{'type':db[_0xa52a('0x70')][_0xa52a('0x71')]['SELECT'],'raw':!![]})[_0xa52a('0x23')](function(_0x557117){return _0x557117;});})['then'](function(_0x221022){if(_0x221022){_0xbb4dde['message'][_0xa52a('0x83')]=_0x221022[0x0];if(!_0x506f61[_0xa52a('0x5a')][_0xa52a('0x63')])return;return db[_0xa52a('0x84')][_0xa52a('0x5b')]({'where':{'id':_0x506f61[_0xa52a('0x5a')][_0xa52a('0x63')],'role':'agent'},'attributes':['id',_0xa52a('0x3b'),'fullname',_0xa52a('0x74'),_0xa52a('0x85')],'raw':!![]});}return null;})['then'](function(_0x4bfc64){if(!_0x4bfc64)return null;_0xbb4dde['message'][_0xa52a('0x64')]=_0x4bfc64;return _0xbb4dde;})[_0xa52a('0x23')](function(_0x45fc3b){if(_0x45fc3b){_0x45fc3b['message'][_0xa52a('0x76')]=util['format'](_0xa52a('0x86'),_0x506f61[_0xa52a('0x68')][_0xa52a('0x3b')]);_0x45fc3b[_0xa52a('0x2b')][_0xa52a('0x77')]=_0xbb4dde[_0xa52a('0x77')];_0x45fc3b[_0xa52a('0x2b')][_0xa52a('0x78')]=_0xbb4dde['channel'];_0x45fc3b[_0xa52a('0x2b')][_0xa52a('0x79')]=_0xa52a('0x7c');respondWithRpcPromise('EventManager',_0xa52a('0x7a'),{'event':_0xa52a('0x87'),'message':_0x45fc3b[_0xa52a('0x2b')]},client9002);return _0xbb4dde;}return null;})[_0xa52a('0x23')](respondWithResult(_0xc44217,null))[_0xa52a('0x58')](handleError(_0xc44217,null));};exports[_0xa52a('0x2e')]=function(_0x3fbc79,_0x5f3fc5,_0x274eb3){if(_0x3fbc79[_0xa52a('0x5a')]['id']){delete _0x3fbc79[_0xa52a('0x5a')]['id'];}var _0x6ac804;return db[_0xa52a('0x3d')][_0xa52a('0x5b')]({'where':{'id':_0x3fbc79[_0xa52a('0x57')]['id']}})['then'](handleEntityNotFound(_0x5f3fc5,null))['then'](function(_0x3f2f61){if(_0x3f2f61){_0x6ac804=_0x3f2f61;return db['SmsAccount'][_0xa52a('0x5b')]({'where':{'id':_0x3f2f61[_0xa52a('0x88')]}});}})[_0xa52a('0x23')](handleEntityNotFound(_0x5f3fc5,null))['then'](function(_0x44885b){if(_0x44885b){logger[_0xa52a('0x27')](_0xa52a('0x28'),_0xa52a('0x2e'),'received\x20delivery\x20report\x20from',_0x44885b[_0xa52a('0x3f')],util[_0xa52a('0x89')](_0x3fbc79[_0xa52a('0x5a')],{'showHidden':![],'depth':null}));switch(_0x44885b['type']){case _0xa52a('0x8a'):if(_0x3fbc79[_0xa52a('0x5a')][_0xa52a('0x8b')]&&_0x3fbc79[_0xa52a('0x5a')][_0xa52a('0x8b')]===_0x6ac804[_0xa52a('0x8c')]){return _0x6ac804['update']({'read':!![]});}else{logger[_0xa52a('0x29')](_0xa52a('0x8d'),_0xa52a('0x2e'),'twilio',util[_0xa52a('0x89')](_0x3fbc79[_0xa52a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xa52a('0x8e'):if(_0x3fbc79[_0xa52a('0x5a')][_0xa52a('0x8f')]&&_0x3fbc79['body'][_0xa52a('0x8f')]===_0x6ac804[_0xa52a('0x8c')]&&_[_0xa52a('0x90')]([_0xa52a('0x91'),_0xa52a('0x92')],_0x3fbc79['body'][_0xa52a('0x93')])>=0x0){return _0x6ac804[_0xa52a('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa52a('0x2e'),_0xa52a('0x94'),util[_0xa52a('0x89')](_0x3fbc79['body'],{'showHidden':![],'depth':null}));}break;case _0xa52a('0x95'):var _0x4f997f=_0x3fbc79['body'][_0xa52a('0x96')][0x0];if(_0x4f997f[_0xa52a('0x2e')]['groupName']==='DELIVERED'){return _0x6ac804[_0xa52a('0x38')]({'read':!![]});}else{logger[_0xa52a('0x29')](_0xa52a('0x8d'),_0xa52a('0x2e'),_0xa52a('0x95'),util[_0xa52a('0x89')](_0x3fbc79[_0xa52a('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x6ac804;}})[_0xa52a('0x23')](respondWithResult(_0x5f3fc5,null))[_0xa52a('0x58')](handleError(_0x5f3fc5,null));}; \ No newline at end of file +var _0xad07=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','show','params','length','find','create','body','describe','sms-interactions','accept','sms','readAt','format','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','agent','fullname','email','interface','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','User','internal','SIP/%s','SmsAccount','debug','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','delivered','Status','inspect','infobip','results','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','client','http','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model'];(function(_0x322c81,_0x4b52ac){var _0x25a44a=function(_0x157658){while(--_0x157658){_0x322c81['push'](_0x322c81['shift']());}};_0x25a44a(++_0x4b52ac);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7ad0('0x0'));var rimraf=require(_0x7ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ad0('0x2'));var rp=require(_0x7ad0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ad0('0x4'));var util=require(_0x7ad0('0x5'));var path=require(_0x7ad0('0x6'));var sox=require('sox');var csv=require(_0x7ad0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ad0('0x8'));var squel=require(_0x7ad0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7ad0('0xa'));var toCsv=require(_0x7ad0('0x7'));var querystring=require('querystring');var Papa=require(_0x7ad0('0xb'));var Redis=require(_0x7ad0('0xc'));var authService=require(_0x7ad0('0xd'));var qs=require(_0x7ad0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ad0('0xf'));var logger=require(_0x7ad0('0x10'))(_0x7ad0('0x11'));var utils=require(_0x7ad0('0x12'));var config=require(_0x7ad0('0x13'));var licenseUtil=require(_0x7ad0('0x14'));var db=require(_0x7ad0('0x15'))['db'];config[_0x7ad0('0x16')]=_[_0x7ad0('0x17')](config['redis'],{'host':_0x7ad0('0x18'),'port':0x18eb});var socket=require(_0x7ad0('0x19'))(new Redis(config[_0x7ad0('0x16')]));require(_0x7ad0('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7ad0('0x1b')][_0x7ad0('0x1c')]({'port':0x232c});var client9002=jayson[_0x7ad0('0x1b')][_0x7ad0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xebb4da,_0x901908,_0x11268b,_0x119fdf){return new BPromise(function(_0x52c802,_0x2286fa){var _0x40fa9c=_0x119fdf||client;return _0x40fa9c['request'](_0xebb4da,_0x11268b)['then'](function(_0x412578){logger['info'](_0x7ad0('0x1d'),_0x901908,_0x7ad0('0x1e'));logger['debug'](_0x7ad0('0x1f'),_0x901908,'request\x20sent',JSON[_0x7ad0('0x20')](_0x412578));if(_0x412578['error']){if(_0x412578[_0x7ad0('0x21')][_0x7ad0('0x22')]===0x1f4){logger[_0x7ad0('0x21')](_0x7ad0('0x1d'),_0x901908,_0x412578['error'][_0x7ad0('0x23')]);return _0x2286fa(_0x412578['error'][_0x7ad0('0x23')]);}logger[_0x7ad0('0x21')]('SmsMessage,\x20%s,\x20%s',_0x901908,_0x412578[_0x7ad0('0x21')]['message']);return _0x52c802(_0x412578['error']['message']);}else{logger[_0x7ad0('0x24')]('SmsMessage,\x20%s,\x20%s',_0x901908,_0x7ad0('0x1e'));_0x52c802(_0x412578['result'][_0x7ad0('0x23')]);}})[_0x7ad0('0x25')](function(_0x3894a7){logger[_0x7ad0('0x21')](_0x7ad0('0x1d'),_0x901908,_0x3894a7);_0x2286fa(_0x3894a7);});});}function respondWithStatusCode(_0x1e42b7,_0x51716e){_0x51716e=_0x51716e||0xcc;return function(_0x14ca11){if(_0x14ca11){return _0x1e42b7[_0x7ad0('0x26')](_0x51716e);}return _0x1e42b7[_0x7ad0('0x27')](_0x51716e)[_0x7ad0('0x28')]();};}function respondWithResult(_0x368931,_0x116e11){_0x116e11=_0x116e11||0xc8;return function(_0x1f9a7f){if(_0x1f9a7f){return _0x368931[_0x7ad0('0x27')](_0x116e11)['json'](_0x1f9a7f);}};}function respondWithFilteredResult(_0x5196df,_0x2b2e49){return function(_0x380eb3){if(_0x380eb3){var _0x8150f5=typeof _0x2b2e49[_0x7ad0('0x29')]===_0x7ad0('0x2a')&&typeof _0x2b2e49['limit']==='undefined';var _0x71bde1=_0x380eb3[_0x7ad0('0x2b')];var _0x2b497b=_0x8150f5?0x0:_0x2b2e49[_0x7ad0('0x29')];var _0x14b021=_0x8150f5?_0x380eb3[_0x7ad0('0x2b')]:_0x2b2e49[_0x7ad0('0x29')]+_0x2b2e49[_0x7ad0('0x2c')];var _0x3b283a;if(_0x14b021>=_0x71bde1){_0x14b021=_0x71bde1;_0x3b283a=0xc8;}else{_0x3b283a=0xce;}_0x5196df[_0x7ad0('0x27')](_0x3b283a);return _0x5196df['set']('Content-Range',_0x2b497b+'-'+_0x14b021+'/'+_0x71bde1)[_0x7ad0('0x2d')](_0x380eb3);}return null;};}function patchUpdates(_0x33fa3b){return function(_0x372f69){try{jsonpatch[_0x7ad0('0x2e')](_0x372f69,_0x33fa3b,!![]);}catch(_0x22c135){return BPromise[_0x7ad0('0x2f')](_0x22c135);}return _0x372f69[_0x7ad0('0x30')]();};}function saveUpdates(_0x41b882,_0x73574f){return function(_0xd76eab){if(_0xd76eab){return _0xd76eab[_0x7ad0('0x31')](_0x41b882)[_0x7ad0('0x32')](function(_0x254688){return _0x254688;});}return null;};}function removeEntity(_0x4aeb53,_0x460819){return function(_0x41a8aa){if(_0x41a8aa){return _0x41a8aa[_0x7ad0('0x33')]()[_0x7ad0('0x32')](function(){_0x4aeb53[_0x7ad0('0x27')](0xcc)[_0x7ad0('0x28')]();});}};}function handleEntityNotFound(_0x42a2e9,_0x19f0be){return function(_0x3989aa){if(!_0x3989aa){_0x42a2e9[_0x7ad0('0x26')](0x194);}return _0x3989aa;};}function handleError(_0x4dfb67,_0x3b75f4){_0x3b75f4=_0x3b75f4||0x1f4;return function(_0x48ef09){logger[_0x7ad0('0x21')](_0x48ef09[_0x7ad0('0x34')]);if(_0x48ef09[_0x7ad0('0x35')]){delete _0x48ef09['name'];}_0x4dfb67[_0x7ad0('0x27')](_0x3b75f4)[_0x7ad0('0x36')](_0x48ef09);};}exports[_0x7ad0('0x37')]=function(_0x13ff73,_0x572c7a){var _0x46e71f={},_0x532e1b={},_0x558992={'count':0x0,'rows':[]};var _0x2a610b=_['map'](db['SmsMessage'][_0x7ad0('0x38')],function(_0x1faccd){return{'name':_0x1faccd[_0x7ad0('0x39')],'type':_0x1faccd[_0x7ad0('0x3a')][_0x7ad0('0x3b')]};});_0x532e1b[_0x7ad0('0x3c')]=_['map'](_0x2a610b,_0x7ad0('0x35'));_0x532e1b[_0x7ad0('0x3d')]=_[_0x7ad0('0x3e')](_0x13ff73['query']);_0x532e1b[_0x7ad0('0x3f')]=_[_0x7ad0('0x40')](_0x532e1b[_0x7ad0('0x3c')],_0x532e1b['query']);_0x46e71f[_0x7ad0('0x41')]=_[_0x7ad0('0x40')](_0x532e1b[_0x7ad0('0x3c')],qs['fields'](_0x13ff73['query'][_0x7ad0('0x42')]));_0x46e71f[_0x7ad0('0x41')]=_0x46e71f['attributes']['length']?_0x46e71f[_0x7ad0('0x41')]:_0x532e1b[_0x7ad0('0x3c')];if(!_0x13ff73[_0x7ad0('0x3d')][_0x7ad0('0x43')]('nolimit')){_0x46e71f['limit']=qs['limit'](_0x13ff73[_0x7ad0('0x3d')][_0x7ad0('0x2c')]);_0x46e71f[_0x7ad0('0x29')]=qs[_0x7ad0('0x29')](_0x13ff73['query'][_0x7ad0('0x29')]);}_0x46e71f[_0x7ad0('0x44')]=qs['sort'](_0x13ff73['query'][_0x7ad0('0x45')]);_0x46e71f['where']=qs['filters'](_[_0x7ad0('0x46')](_0x13ff73[_0x7ad0('0x3d')],_0x532e1b[_0x7ad0('0x3f')]),_0x2a610b);if(_0x13ff73[_0x7ad0('0x3d')][_0x7ad0('0x47')]){_0x46e71f[_0x7ad0('0x48')]=_[_0x7ad0('0x49')](_0x46e71f['where'],{'$or':_[_0x7ad0('0x4a')](_0x2a610b,function(_0x4e8fcb){if(_0x4e8fcb['type']!==_0x7ad0('0x4b')){var _0x69eb1d={};_0x69eb1d[_0x4e8fcb[_0x7ad0('0x35')]]={'$like':'%'+_0x13ff73[_0x7ad0('0x3d')][_0x7ad0('0x47')]+'%'};return _0x69eb1d;}})});}_0x46e71f=_[_0x7ad0('0x49')]({},_0x46e71f,_0x13ff73[_0x7ad0('0x4c')]);var _0x2c8d35={'where':_0x46e71f['where']};return db[_0x7ad0('0x4d')][_0x7ad0('0x2b')](_0x2c8d35)[_0x7ad0('0x32')](function(_0x3c0f59){_0x558992[_0x7ad0('0x2b')]=_0x3c0f59;if(_0x13ff73[_0x7ad0('0x3d')][_0x7ad0('0x4e')]){_0x46e71f[_0x7ad0('0x4f')]=[{'all':!![]}];}return db[_0x7ad0('0x4d')][_0x7ad0('0x50')](_0x46e71f);})['then'](function(_0x58c5e1){_0x558992[_0x7ad0('0x51')]=_0x58c5e1;return _0x558992;})[_0x7ad0('0x32')](respondWithFilteredResult(_0x572c7a,_0x46e71f))[_0x7ad0('0x25')](handleError(_0x572c7a,null));};exports[_0x7ad0('0x52')]=function(_0x3018ca,_0x39bfee){var _0xbfd033={'raw':!![],'where':{'id':_0x3018ca[_0x7ad0('0x53')]['id']}},_0x1bb7a6={};_0x1bb7a6[_0x7ad0('0x3c')]=_['keys'](db[_0x7ad0('0x4d')][_0x7ad0('0x38')]);_0x1bb7a6[_0x7ad0('0x3d')]=_['keys'](_0x3018ca[_0x7ad0('0x3d')]);_0x1bb7a6[_0x7ad0('0x3f')]=_[_0x7ad0('0x40')](_0x1bb7a6[_0x7ad0('0x3c')],_0x1bb7a6[_0x7ad0('0x3d')]);_0xbfd033[_0x7ad0('0x41')]=_[_0x7ad0('0x40')](_0x1bb7a6['model'],qs[_0x7ad0('0x42')](_0x3018ca[_0x7ad0('0x3d')][_0x7ad0('0x42')]));_0xbfd033['attributes']=_0xbfd033['attributes'][_0x7ad0('0x54')]?_0xbfd033[_0x7ad0('0x41')]:_0x1bb7a6[_0x7ad0('0x3c')];if(_0x3018ca[_0x7ad0('0x3d')][_0x7ad0('0x4e')]){_0xbfd033[_0x7ad0('0x4f')]=[{'all':!![]}];}_0xbfd033=_[_0x7ad0('0x49')]({},_0xbfd033,_0x3018ca[_0x7ad0('0x4c')]);return db[_0x7ad0('0x4d')][_0x7ad0('0x55')](_0xbfd033)['then'](handleEntityNotFound(_0x39bfee,null))[_0x7ad0('0x32')](respondWithResult(_0x39bfee,null))[_0x7ad0('0x25')](handleError(_0x39bfee,null));};exports[_0x7ad0('0x56')]=function(_0x59b377,_0x1a4509){return db['SmsMessage']['create'](_0x59b377[_0x7ad0('0x57')],{})['then'](respondWithResult(_0x1a4509,0xc9))['catch'](handleError(_0x1a4509,null));};exports[_0x7ad0('0x31')]=function(_0x284d5a,_0x2cb19f){if(_0x284d5a[_0x7ad0('0x57')]['id']){delete _0x284d5a['body']['id'];}return db[_0x7ad0('0x4d')][_0x7ad0('0x55')]({'where':{'id':_0x284d5a[_0x7ad0('0x53')]['id']}})[_0x7ad0('0x32')](handleEntityNotFound(_0x2cb19f,null))[_0x7ad0('0x32')](saveUpdates(_0x284d5a[_0x7ad0('0x57')],null))[_0x7ad0('0x32')](respondWithResult(_0x2cb19f,null))['catch'](handleError(_0x2cb19f,null));};exports['destroy']=function(_0x268f85,_0xb45252){return db[_0x7ad0('0x4d')]['find']({'where':{'id':_0x268f85['params']['id']}})[_0x7ad0('0x32')](handleEntityNotFound(_0xb45252,null))[_0x7ad0('0x32')](removeEntity(_0xb45252,null))[_0x7ad0('0x25')](handleError(_0xb45252,null));};exports['describe']=function(_0x54afe3,_0x16956b){return db[_0x7ad0('0x4d')][_0x7ad0('0x58')]()[_0x7ad0('0x32')](respondWithResult(_0x16956b,null))[_0x7ad0('0x25')](handleError(_0x16956b,null));};var interaction_log=require('../../config/logger')(_0x7ad0('0x59'));exports[_0x7ad0('0x5a')]=function(_0x5258ab,_0x189cdb,_0x494384){var _0x234f99={'agent':{},'channel':_0x7ad0('0x5b')};if(_0x5258ab[_0x7ad0('0x57')]['id']){delete _0x5258ab[_0x7ad0('0x57')]['id'];}_0x5258ab[_0x7ad0('0x57')]['read']=!![];_0x5258ab['body'][_0x7ad0('0x5c')]=moment()[_0x7ad0('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5258ab[_0x7ad0('0x57')][_0x7ad0('0x5e')]=_0x5258ab[_0x7ad0('0x57')][_0x7ad0('0x5e')]||_0x5258ab[_0x7ad0('0x5f')]['id'];_0x234f99['agent']['id']=_0x5258ab[_0x7ad0('0x57')]['UserId'];return db[_0x7ad0('0x4d')][_0x7ad0('0x55')]({'where':{'id':_0x5258ab[_0x7ad0('0x53')]['id'],'UserId':null}})[_0x7ad0('0x32')](handleEntityNotFound(_0x189cdb,null))[_0x7ad0('0x32')](saveUpdates(_0x5258ab[_0x7ad0('0x57')],null))[_0x7ad0('0x32')](function(_0x21e15a){if(_0x21e15a){_0x234f99['message']=_0x21e15a[_0x7ad0('0x60')]({'plain':!![]});return db[_0x7ad0('0x61')]['find']({'where':{'id':_0x21e15a[_0x7ad0('0x62')]}});}return null;})[_0x7ad0('0x32')](handleEntityNotFound(_0x189cdb,null))['then'](function(_0x388712){if(_0x388712){return _0x388712['update']({'UserId':_0x5258ab['body']['UserId'],'read1stAt':_[_0x7ad0('0x63')](_0x388712[_0x7ad0('0x64')])?moment()['format'](_0x7ad0('0x65')):undefined});}return null;})[_0x7ad0('0x32')](function(_0x4fc932){if(_0x4fc932){_0x234f99[_0x7ad0('0x66')]=_0x4fc932['get']({'plain':!![]});interaction_log[_0x7ad0('0x24')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5258ab[_0x7ad0('0x5f')]['id'],_0x5258ab['user'][_0x7ad0('0x35')],_0x5258ab['user'][_0x7ad0('0x67')],_0x234f99['interaction']['id'],_0x5258ab[_0x7ad0('0x57')]?JSON[_0x7ad0('0x20')](_0x5258ab[_0x7ad0('0x57')]):_0x7ad0('0x68'));return respondWithRpcPromise(_0x7ad0('0x69'),_0x7ad0('0x6a'),_0x234f99);}return null;})[_0x7ad0('0x32')](function(_0x1a3579){var _0x264a99=_0x7ad0('0x6b')+_0x1a3579[_0x7ad0('0x23')][_0x7ad0('0x6c')];return db[_0x7ad0('0x6d')][_0x7ad0('0x3d')](_0x264a99,{'type':db[_0x7ad0('0x6e')][_0x7ad0('0x6f')]['SELECT'],'raw':!![]})[_0x7ad0('0x32')](function(_0x5ec3d9){return _0x5ec3d9;});})[_0x7ad0('0x32')](function(_0x2575cf){if(_0x2575cf){_0x234f99[_0x7ad0('0x23')][_0x7ad0('0x70')]=_0x2575cf[0x0];if(!_0x5258ab[_0x7ad0('0x57')][_0x7ad0('0x5e')])return;return db['User']['find']({'where':{'id':_0x5258ab[_0x7ad0('0x57')][_0x7ad0('0x5e')],'role':_0x7ad0('0x71')},'attributes':['id',_0x7ad0('0x35'),_0x7ad0('0x72'),_0x7ad0('0x73'),'internal'],'raw':!![]});}return null;})[_0x7ad0('0x32')](function(_0xa1bfe6){if(!_0xa1bfe6)return null;_0x234f99[_0x7ad0('0x23')][_0x7ad0('0x71')]=_0xa1bfe6;return _0x234f99;})[_0x7ad0('0x32')](function(_0x29308e){if(_0x29308e){if(_0x5258ab[_0x7ad0('0x57')]['manual']){_0x234f99[_0x7ad0('0x23')][_0x7ad0('0x74')]=util[_0x7ad0('0x5d')]('SIP/%s',_0x5258ab[_0x7ad0('0x5f')]['name']);_0x234f99[_0x7ad0('0x23')][_0x7ad0('0x75')]=_0x234f99['channel'];_0x234f99[_0x7ad0('0x23')][_0x7ad0('0x76')]=_0x234f99[_0x7ad0('0x75')];_0x234f99['message'][_0x7ad0('0x77')]='accept';return respondWithRpcPromise('EventManager',_0x7ad0('0x78'),{'event':'acceptmessage','message':_0x234f99[_0x7ad0('0x23')]},client9002)['then'](function(){return _0x234f99;});}return _0x234f99;}return null;})['then'](respondWithResult(_0x189cdb,null))[_0x7ad0('0x25')](handleError(_0x189cdb,null));};var interaction_log=require(_0x7ad0('0x10'))(_0x7ad0('0x59'));exports['reject']=function(_0x48d2f9,_0x110028,_0x3d10e2){var _0x40a247={'agent':{},'channel':'sms'};if(_0x48d2f9['body']['id']){delete _0x48d2f9['body']['id'];}_0x48d2f9['body'][_0x7ad0('0x5e')]=_0x48d2f9['body'][_0x7ad0('0x5e')]||_0x48d2f9[_0x7ad0('0x5f')]['id'];_0x40a247[_0x7ad0('0x71')]['id']=_0x48d2f9[_0x7ad0('0x57')][_0x7ad0('0x5e')];return db[_0x7ad0('0x4d')][_0x7ad0('0x55')]({'where':{'id':_0x48d2f9[_0x7ad0('0x53')]['id'],'UserId':null}})[_0x7ad0('0x32')](handleEntityNotFound(_0x110028,null))[_0x7ad0('0x32')](function(_0x4e2a83){if(_0x4e2a83){_0x40a247['message']=_0x4e2a83[_0x7ad0('0x60')]({'plain':!![]});return db[_0x7ad0('0x61')]['find']({'where':{'id':_0x4e2a83[_0x7ad0('0x62')]}});}return null;})[_0x7ad0('0x32')](handleEntityNotFound(_0x110028,null))[_0x7ad0('0x32')](function(_0x3b5c8b){if(_0x3b5c8b){_0x40a247[_0x7ad0('0x66')]=_0x3b5c8b[_0x7ad0('0x60')]({'plain':!![]});interaction_log[_0x7ad0('0x24')](_0x7ad0('0x79'),_0x48d2f9['user']['id'],_0x48d2f9[_0x7ad0('0x5f')][_0x7ad0('0x35')],_0x48d2f9[_0x7ad0('0x5f')][_0x7ad0('0x67')],_0x40a247[_0x7ad0('0x66')]['id'],_0x48d2f9[_0x7ad0('0x57')]?JSON[_0x7ad0('0x20')](_0x48d2f9[_0x7ad0('0x57')]):_0x7ad0('0x68'));return respondWithRpcPromise('RejectMessage',_0x7ad0('0x7a'),_0x40a247);}return null;})[_0x7ad0('0x32')](function(_0x5bb1ce){var _0x31580d=_0x7ad0('0x6b')+_0x5bb1ce[_0x7ad0('0x23')][_0x7ad0('0x6c')];return db[_0x7ad0('0x6d')][_0x7ad0('0x3d')](_0x31580d,{'type':db[_0x7ad0('0x6e')][_0x7ad0('0x6f')][_0x7ad0('0x7b')],'raw':!![]})['then'](function(_0x2ef405){return _0x2ef405;});})[_0x7ad0('0x32')](function(_0x409ffc){if(_0x409ffc){_0x40a247[_0x7ad0('0x23')][_0x7ad0('0x70')]=_0x409ffc[0x0];if(!_0x48d2f9['body']['UserId'])return;return db[_0x7ad0('0x7c')][_0x7ad0('0x55')]({'where':{'id':_0x48d2f9[_0x7ad0('0x57')][_0x7ad0('0x5e')],'role':_0x7ad0('0x71')},'attributes':['id',_0x7ad0('0x35'),_0x7ad0('0x72'),'email',_0x7ad0('0x7d')],'raw':!![]});}return null;})[_0x7ad0('0x32')](function(_0x236da9){if(!_0x236da9)return null;_0x40a247[_0x7ad0('0x23')][_0x7ad0('0x71')]=_0x236da9;return _0x40a247;})['then'](function(_0x953580){if(_0x953580){_0x953580[_0x7ad0('0x23')][_0x7ad0('0x74')]=util[_0x7ad0('0x5d')](_0x7ad0('0x7e'),_0x48d2f9['user'][_0x7ad0('0x35')]);_0x953580[_0x7ad0('0x23')][_0x7ad0('0x75')]=_0x40a247[_0x7ad0('0x75')];_0x953580['message'][_0x7ad0('0x76')]=_0x40a247[_0x7ad0('0x75')];_0x953580[_0x7ad0('0x23')]['event']=_0x7ad0('0x2f');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x953580[_0x7ad0('0x23')]},client9002);return _0x40a247;}return null;})['then'](respondWithResult(_0x110028,null))[_0x7ad0('0x25')](handleError(_0x110028,null));};exports[_0x7ad0('0x27')]=function(_0x390aa0,_0x34e038,_0x3634bd){if(_0x390aa0['body']['id']){delete _0x390aa0[_0x7ad0('0x57')]['id'];}var _0x19d458;return db['SmsMessage'][_0x7ad0('0x55')]({'where':{'id':_0x390aa0[_0x7ad0('0x53')]['id']}})['then'](handleEntityNotFound(_0x34e038,null))['then'](function(_0x14226f){if(_0x14226f){_0x19d458=_0x14226f;return db[_0x7ad0('0x7f')][_0x7ad0('0x55')]({'where':{'id':_0x14226f['SmsAccountId']}});}})[_0x7ad0('0x32')](handleEntityNotFound(_0x34e038,null))['then'](function(_0x58ed40){if(_0x58ed40){logger[_0x7ad0('0x80')](_0x7ad0('0x1f'),_0x7ad0('0x27'),_0x7ad0('0x81'),_0x58ed40[_0x7ad0('0x3a')],util['inspect'](_0x390aa0[_0x7ad0('0x57')],{'showHidden':![],'depth':null}));switch(_0x58ed40[_0x7ad0('0x3a')]){case'twilio':if(_0x390aa0[_0x7ad0('0x57')][_0x7ad0('0x82')]&&_0x390aa0[_0x7ad0('0x57')][_0x7ad0('0x82')]===_0x19d458[_0x7ad0('0x83')]){return _0x19d458[_0x7ad0('0x31')]({'read':!![]});}else{logger[_0x7ad0('0x21')](_0x7ad0('0x84'),_0x7ad0('0x27'),_0x7ad0('0x85'),util['inspect'](_0x390aa0[_0x7ad0('0x57')],{'showHidden':![],'depth':null}));}break;case _0x7ad0('0x86'):if(_0x390aa0[_0x7ad0('0x57')][_0x7ad0('0x87')]&&_0x390aa0['body']['MessageUUID']===_0x19d458[_0x7ad0('0x83')]&&_[_0x7ad0('0x88')](['sent',_0x7ad0('0x89')],_0x390aa0[_0x7ad0('0x57')][_0x7ad0('0x8a')])>=0x0){return _0x19d458[_0x7ad0('0x31')]({'read':!![]});}else{logger[_0x7ad0('0x21')](_0x7ad0('0x84'),_0x7ad0('0x27'),'plivio',util[_0x7ad0('0x8b')](_0x390aa0[_0x7ad0('0x57')],{'showHidden':![],'depth':null}));}break;case _0x7ad0('0x8c'):var _0x52b192=_0x390aa0[_0x7ad0('0x57')][_0x7ad0('0x8d')][0x0];if(_0x52b192[_0x7ad0('0x27')][_0x7ad0('0x8e')]===_0x7ad0('0x8f')){return _0x19d458['update']({'read':!![]});}else{logger[_0x7ad0('0x21')](_0x7ad0('0x84'),_0x7ad0('0x27'),'infobip',util['inspect'](_0x390aa0[_0x7ad0('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x19d458;}})[_0x7ad0('0x32')](respondWithResult(_0x34e038,null))[_0x7ad0('0x25')](handleError(_0x34e038,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f65ac76..b0056fb 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 _0xdab4=['SmsMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x27f17b,_0x4d416a){var _0x5b04f8=function(_0xef00fb){while(--_0xef00fb){_0x27f17b['push'](_0x27f17b['shift']());}};_0x5b04f8(++_0x4d416a);}(_0xdab4,0x117));var _0x4dab=function(_0x7f1d23,_0x2a883a){_0x7f1d23=_0x7f1d23-0x0;var _0xe6a945=_0xdab4[_0x7f1d23];return _0xe6a945;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x4dab('0x0'))['db'][_0x4dab('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4dab('0x2')](0x0);var events={'afterCreate':_0x4dab('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x112fde){return function(_0x5e8a84,_0x389674,_0x4578ea){SmsMessageEvents['emit'](_0x112fde+':'+_0x5e8a84['id'],_0x5e8a84);SmsMessageEvents[_0x4dab('0x4')](_0x112fde,_0x5e8a84);_0x4578ea(null);};}for(var e in events){if(events[_0x4dab('0x5')](e)){var event=events[e];SmsMessage[_0x4dab('0x6')](e,emitEvent(event));}}module[_0x4dab('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xf193=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf193,0xf3));var _0x3f19=function(_0x4f7618,_0x243df2){_0x4f7618=_0x4f7618-0x0;var _0x20ba5f=_0xf193[_0x4f7618];return _0x20ba5f;};'use strict';var EventEmitter=require(_0x3f19('0x0'));var SmsMessage=require(_0x3f19('0x1'))['db'][_0x3f19('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3f19('0x3')](0x0);var events={'afterCreate':_0x3f19('0x4'),'afterUpdate':_0x3f19('0x5'),'afterDestroy':_0x3f19('0x6')};function emitEvent(_0x12fcec){return function(_0x1d4e86,_0x58c37b,_0x585547){SmsMessageEvents[_0x3f19('0x7')](_0x12fcec+':'+_0x1d4e86['id'],_0x1d4e86);SmsMessageEvents[_0x3f19('0x7')](_0x12fcec,_0x1d4e86);_0x585547(null);};}for(var e in events){if(events[_0x3f19('0x8')](e)){var event=events[e];SmsMessage[_0x3f19('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ba653c6..8f4d9e1 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 _0xb4af=['bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','toString','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','intelepeer','Token\x20not\x20received','finally','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','messageId','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','update','createdAt','catch','SmsAccount','find','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','error','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','sender','login?username=','&password=','GET','split','POST','user_key','session_key','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','message_id','clickSend','plivo','authId','format','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','length','md5','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','UTF-8','apiMessageId'];(function(_0x2d3ec4,_0x119362){var _0x6d0b5=function(_0xd6d7da){while(--_0xd6d7da){_0x2d3ec4['push'](_0x2d3ec4['shift']());}};_0x6d0b5(++_0x119362);}(_0xb4af,0xf9));var _0xfb4a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb4af[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xfb4a('0x0'));var util=require(_0xfb4a('0x1'));var logger=require('../../config/logger')(_0xfb4a('0x2'));var moment=require(_0xfb4a('0x3'));var BPromise=require(_0xfb4a('0x4'));var rp=require(_0xfb4a('0x5'));var fs=require('fs');var path=require(_0xfb4a('0x6'));var rimraf=require('rimraf');var config=require(_0xfb4a('0x7'));var attributes=require(_0xfb4a('0x8'));module[_0xfb4a('0x9')]=function(_0x3752a5,_0x2aed2b){return _0x3752a5['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xfb4a('0xa'),'fields':['messageId']},{'name':'fti_sms_messages','fields':[_0xfb4a('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x492f40,_0x35c9b6,_0xb133d9){var _0x15777f=_0x3752a5[_0xfb4a('0xc')];var _0x48206a=_0x492f40[_0xfb4a('0xd')]({'plain':!![]});if(_0x48206a[_0xfb4a('0xe')][_0xfb4a('0xf')]()==='in'||_0x48206a['direction'][_0xfb4a('0xf')]()===_0xfb4a('0x10')&&!_0x48206a[_0xfb4a('0x11')]&&!_[_0xfb4a('0x12')](_0x48206a[_0xfb4a('0x13')])&&!_[_0xfb4a('0x12')](_0x48206a[_0xfb4a('0x14')])){_0x15777f['SmsInteraction'][_0xfb4a('0x15')]({'where':{'id':_0x48206a[_0xfb4a('0x14')]}})['then'](function(_0x3d56e5){if(_0x3d56e5){_0x3d56e5[_0xfb4a('0x16')]({'lastMsgAt':_0x48206a[_0xfb4a('0x17')],'lastMsgDirection':_0x48206a[_0xfb4a('0xe')][_0xfb4a('0xf')]()});}})[_0xfb4a('0x18')](function(_0x5f0dc1){console['error'](_0x5f0dc1);});}if(_0x48206a[_0xfb4a('0xe')]==='out'&&!_0x48206a[_0xfb4a('0x11')]){var _0x3368cf;_0x15777f[_0xfb4a('0x19')][_0xfb4a('0x1a')]({'where':{'id':_0x48206a['SmsAccountId']},'raw':!![]})[_0xfb4a('0x1b')](function(_0x5565e0){_0x3368cf=_0x5565e0;if(_0x3368cf&&_0x3368cf[_0xfb4a('0x1c')]){switch(_0x3368cf['type']){case _0xfb4a('0x1d'):var _0x2976b5=require(_0xfb4a('0x1d'));if(_0x3368cf[_0xfb4a('0x1e')]&&_0x3368cf[_0xfb4a('0x1f')]&&_0x3368cf[_0xfb4a('0x20')]){var _0x3e28cb=new _0x2976b5(_0x3368cf[_0xfb4a('0x1e')],_0x3368cf[_0xfb4a('0x1f')]);_0x3e28cb[_0xfb4a('0x21')][_0xfb4a('0x22')]({'body':_0x48206a[_0xfb4a('0xb')],'to':_0x48206a[_0xfb4a('0x20')],'from':_0x3368cf['phone'],'statusCallback':_0x3368cf[_0xfb4a('0x23')]+_0xfb4a('0x24')+_0x48206a['id']+'/status?token='+_0x3368cf[_0xfb4a('0x25')]})[_0xfb4a('0x1b')](function(_0x89aad7){if(_0x89aad7[_0xfb4a('0x26')]){return _0x492f40[_0xfb4a('0x16')]({'messageId':_0x89aad7[_0xfb4a('0x26')]});}})[_0xfb4a('0x18')](function(_0x3b7d6b){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util['inspect'](_0x3b7d6b,{'showHidden':![],'depth':null}));});}else{logger[_0xfb4a('0x27')](_0xfb4a('0x28'),_0xfb4a('0x29'),_0xfb4a('0x1d'),_0xfb4a('0x2a'));}break;case _0xfb4a('0x2b'):var _0x5564ef=_0xfb4a('0x2c');if(_0x3368cf[_0xfb4a('0x2d')]&&_0x3368cf[_0xfb4a('0x2e')]){var _0x366ff9={'recipient':[_0x48206a[_0xfb4a('0x20')]],'message':_0x48206a['body'],'message_type':_0x3368cf[_0xfb4a('0x2f')]};if(_0x3368cf[_0xfb4a('0x2f')]&&_0x3368cf[_0xfb4a('0x2f')]!=='SI'){_0x366ff9[_0xfb4a('0x30')]=_0x3368cf[_0xfb4a('0x20')];}var _0x438ed3={'url':_0x5564ef+_0xfb4a('0x31')+_0x3368cf[_0xfb4a('0x2d')]+_0xfb4a('0x32')+_0x3368cf[_0xfb4a('0x2e')],'method':_0xfb4a('0x33')};rp(_0x438ed3)[_0xfb4a('0x1b')](function(_0xe75583){var _0xa24b88=_0xe75583[_0xfb4a('0x34')](';');var _0x9cc6a0={'user_key':_0xa24b88[0x0],'session_key':_0xa24b88[0x1]};_0x438ed3={'url':_0x5564ef+'sms','method':_0xfb4a('0x35'),'headers':{'user_key':_0x9cc6a0[_0xfb4a('0x36')],'Session_key':_0x9cc6a0[_0xfb4a('0x37')]},'json':!![],'body':_0x366ff9};return rp(_0x438ed3);})[_0xfb4a('0x1b')](function(_0x14899c){if(_0x14899c['total_sent']>=0x1){var _0x4c6688={'messageId':_0x14899c[_0xfb4a('0x38')]};if(_0x3368cf[_0xfb4a('0x2f')]!=='GP'||!_0x3368cf[_0xfb4a('0x39')]){_0x4c6688[_0xfb4a('0x3a')]=!![];}return _0x492f40[_0xfb4a('0x16')](_0x4c6688);}else{return logger[_0xfb4a('0x27')](_0xfb4a('0x28'),_0xfb4a('0x29'),_0xfb4a('0x2b'),util[_0xfb4a('0x3b')](_0x14899c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5b4be3){return logger[_0xfb4a('0x27')](_0xfb4a('0x28'),_0xfb4a('0x29'),_0xfb4a('0x2b'),util[_0xfb4a('0x3b')](_0x5b4be3,{'showHidden':![],'depth':null}));});}else{logger[_0xfb4a('0x27')](_0xfb4a('0x28'),'afterCreate',_0xfb4a('0x2b'),_0xfb4a('0x3c'));}break;case _0xfb4a('0x3d'):if(_0x3368cf['authToken']){var _0x3961b8={'recipient':_0x48206a[_0xfb4a('0x20')],'message':_0x48206a[_0xfb4a('0xb')],'sender':_0x3368cf[_0xfb4a('0x3e')]||_0x3368cf['phone'],'authorization':_0x3368cf[_0xfb4a('0x1f')]};var _0x35c9b6={'method':'POST','uri':_0xfb4a('0x3f'),'body':_0x3961b8,'json':!![]};rp(_0x35c9b6)[_0xfb4a('0x1b')](function(_0x2afabe){var _0x52d27e={'messageId':_0x2afabe[_0xfb4a('0x40')]};if(!_0x3368cf[_0xfb4a('0x39')]){_0x52d27e['read']=!![];}return _0x492f40[_0xfb4a('0x16')](_0x52d27e);})[_0xfb4a('0x18')](function(_0x3a7fd0){logger['error'](_0xfb4a('0x28'),_0xfb4a('0x29'),'connectel',util[_0xfb4a('0x3b')](_0x3a7fd0,{'showHidden':![],'depth':null}));});}else{logger[_0xfb4a('0x27')](_0xfb4a('0x28'),'afterCreate',_0xfb4a('0x3d'),_0xfb4a('0x41'));}break;case _0xfb4a('0x42'):if(_0x3368cf['username']&&_0x3368cf[_0xfb4a('0x2e')]){var _0x3961b8={'messages':[{'source':'xCALLY\x20Motion','to':_0x48206a['phone'],'body':_0x48206a[_0xfb4a('0xb')],'from':_0x3368cf[_0xfb4a('0x3e')]||_0x3368cf['phone']}]};var _0x12e940=util['format']('%s:%s',_0x3368cf['username'],_0x3368cf[_0xfb4a('0x2e')]);var _0x35c9b6={'method':_0xfb4a('0x35'),'uri':_0xfb4a('0x43'),'body':_0x3961b8,'headers':{'Authorization':util['format'](_0xfb4a('0x44'),new Buffer(_0x12e940)['toString'](_0xfb4a('0x45')))},'json':!![]};rp(_0x35c9b6)[_0xfb4a('0x1b')](function(_0x42e3de){if(_0x42e3de['http_code']>=0xc8&&_0x42e3de[_0xfb4a('0x46')]<=0xce){if(_0x42e3de['data']&&_0x42e3de[_0xfb4a('0x47')]['queued_count']>0x0){var _0x3ad771=_['head'](_0x42e3de[_0xfb4a('0x47')][_0xfb4a('0x21')]);var _0x4dd9e3={'messageId':_0x3ad771[_0xfb4a('0x48')]};if(!_0x3368cf[_0xfb4a('0x39')]){_0x4dd9e3[_0xfb4a('0x3a')]=!![];}return _0x492f40['update'](_0x4dd9e3);}else{logger[_0xfb4a('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),'clickSend',util[_0xfb4a('0x3b')](_0x42e3de,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),_0xfb4a('0x49'),util[_0xfb4a('0x3b')](_0x42e3de,{'showHidden':![],'depth':null}));}})['catch'](function(_0x572494){logger[_0xfb4a('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),_0xfb4a('0x49'),util[_0xfb4a('0x3b')](_0x572494,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),_0xfb4a('0x49'),_0xfb4a('0x3c'));}break;case _0xfb4a('0x4a'):if(_0x3368cf[_0xfb4a('0x4b')]&&_0x3368cf[_0xfb4a('0x1f')]){var _0x3961b8={'dst':_0x48206a[_0xfb4a('0x20')],'text':_0x48206a['body'],'src':_0x3368cf[_0xfb4a('0x3e')]||_0x3368cf[_0xfb4a('0x20')],'url':_0x3368cf[_0xfb4a('0x23')]+_0xfb4a('0x24')+_0x48206a['id']+'/status?token='+_0x3368cf[_0xfb4a('0x25')]};var _0x12e940=util[_0xfb4a('0x4c')](_0xfb4a('0x4d'),_0x3368cf[_0xfb4a('0x4b')],_0x3368cf[_0xfb4a('0x1f')]);var _0x35c9b6={'method':_0xfb4a('0x35'),'uri':util[_0xfb4a('0x4c')](_0xfb4a('0x4e'),_0x3368cf[_0xfb4a('0x4b')]),'body':_0x3961b8,'headers':{'Authorization':util[_0xfb4a('0x4c')](_0xfb4a('0x44'),new Buffer(_0x12e940)['toString'](_0xfb4a('0x45')))},'json':!![]};rp(_0x35c9b6)['then'](function(_0x29a73d){var _0x65d666={'messageId':_0x29a73d[_0xfb4a('0x4f')][0x0]};return _0x492f40[_0xfb4a('0x16')](_0x65d666);})[_0xfb4a('0x18')](function(_0x513ea7){logger[_0xfb4a('0x27')](_0xfb4a('0x28'),_0xfb4a('0x29'),_0xfb4a('0x4a'),util[_0xfb4a('0x3b')](_0x513ea7,{'showHidden':![],'depth':null}));});}else{logger[_0xfb4a('0x27')](_0xfb4a('0x28'),_0xfb4a('0x29'),'plivo',_0xfb4a('0x50'));}break;case _0xfb4a('0x51'):if(_0x3368cf[_0xfb4a('0x2d')]&&_0x3368cf['password']){if(_0x3368cf[_0xfb4a('0x52')]){var _0xe7d2c9={'method':_0xfb4a('0x35'),'uri':_0x3368cf[_0xfb4a('0x52')]+_0xfb4a('0x53'),'body':{'username':_0x3368cf[_0xfb4a('0x2d')],'password':_0x3368cf[_0xfb4a('0x2e')]},'json':!![]};return rp(_0xe7d2c9)[_0xfb4a('0x1b')](function(_0x352de4){var _0x49e240={'method':_0xfb4a('0x35'),'uri':_0x3368cf['baseUrl']+_0xfb4a('0x54'),'body':{'messages':[{'from':_0x3368cf[_0xfb4a('0x20')],'destinations':[{'to':_0x48206a[_0xfb4a('0x20')]}],'text':_0x48206a['body'],'notifyUrl':_0x3368cf[_0xfb4a('0x23')]+'/api/sms/messages/'+_0x48206a['id']+'/status?token='+_0x3368cf[_0xfb4a('0x25')],'notifyContentType':_0xfb4a('0x55'),'callbackData':_0x3368cf['phone']+';'+_0x48206a[_0xfb4a('0xb')]}]},'headers':{'Authorization':_0xfb4a('0x56')+_0x352de4[_0xfb4a('0x25')]},'json':!![]};return rp(_0x49e240)[_0xfb4a('0x1b')](function(_0x85eb4b){if(_0x85eb4b[_0xfb4a('0x21')]){var _0x50c637={'messageId':_0x85eb4b[_0xfb4a('0x21')][0x0][_0xfb4a('0xa')]};if(!_0x3368cf[_0xfb4a('0x39')]){_0x50c637[_0xfb4a('0x3a')]=!![];}return _0x492f40[_0xfb4a('0x16')](_0x50c637);}else{return logger[_0xfb4a('0x27')](_0xfb4a('0x28'),_0xfb4a('0x29'),'infobip',util[_0xfb4a('0x3b')](_0x85eb4b,{'showHidden':![],'depth':null}));}});})[_0xfb4a('0x18')](function(_0x4dd9de){return logger[_0xfb4a('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),_0xfb4a('0x51'),util[_0xfb4a('0x3b')](_0x4dd9de,{'showHidden':![],'depth':null}));});}else{logger[_0xfb4a('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfb4a('0x51'),_0xfb4a('0x57'));}}else{logger[_0xfb4a('0x27')](_0xfb4a('0x28'),_0xfb4a('0x29'),_0xfb4a('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xfb4a('0x58'):var _0x3d6052=require(_0xfb4a('0x59'));if(_0x3368cf[_0xfb4a('0x5a')]){var _0x2bad6a={};_0x2bad6a[_0xfb4a('0x5b')]=_0x3368cf['username'];_0x2bad6a[_0xfb4a('0x20')]=_0x48206a[_0xfb4a('0x20')];_0x2bad6a['sender']=_0x3368cf['phone'];_0x2bad6a[_0xfb4a('0x5c')]=_0x48206a['body'];_0x2bad6a['timestamp']=+new Date();var _0x366260='';var _0x29c8f6='';var _0x1de949=Object[_0xfb4a('0x5d')](_0x2bad6a);_0x1de949[_0xfb4a('0x5e')]();for(var _0x144fe3=0x0;_0x144fe3<_0x1de949[_0xfb4a('0x5f')];_0x144fe3++){if(_0x366260!=''){_0x366260+='&';}_0x366260+=_0x1de949[_0x144fe3]+'='+encodeURIComponent(_0x2bad6a[_0x1de949[_0x144fe3]]);_0x29c8f6+=_0x2bad6a[_0x1de949[_0x144fe3]];}_0x29c8f6+=_0x3368cf[_0xfb4a('0x5a')];_0x29c8f6=_0x3d6052['createHash'](_0xfb4a('0x60'))['update'](_0x29c8f6)['digest'](_0xfb4a('0x61'));if(_0x366260!==''){_0x366260+='&';}_0x366260+=_0xfb4a('0x62')+_0x29c8f6;var _0x438ed3={'method':_0xfb4a('0x33'),'uri':_0x3368cf['baseUrl']+_0xfb4a('0x63')+_0x366260,'json':!![]};return rp(_0x438ed3)[_0xfb4a('0x1b')](function(_0x1c8f48){var _0x3c6f97=Object[_0xfb4a('0x5d')](_0x1c8f48);if(_0x1c8f48[_0x3c6f97[0x0]][_0xfb4a('0x27')]&&parseInt(_0x1c8f48[_0x3c6f97[0x0]][_0xfb4a('0x27')])===0x0){var _0x512f75={'messageId':_0x1c8f48[_0x3c6f97[0x0]][_0xfb4a('0x64')]};if(!_0x3368cf[_0xfb4a('0x39')]){_0x512f75['read']=!![];}return _0x492f40[_0xfb4a('0x16')](_0x512f75);}else{return logger[_0xfb4a('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),_0xfb4a('0x58'),util[_0xfb4a('0x3b')](_0x1c8f48[_0xfb4a('0x27')],{'showHidden':![],'depth':null}));}})[_0xfb4a('0x18')](function(_0x39c6d2){return logger[_0xfb4a('0x27')](_0xfb4a('0x28'),'afterCreate',_0xfb4a('0x58'),util[_0xfb4a('0x3b')](_0x39c6d2,{'showHidden':![],'depth':null}));});}else{logger[_0xfb4a('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),_0xfb4a('0x58'),_0xfb4a('0x65'));}break;case _0xfb4a('0x66'):if(_0x3368cf[_0xfb4a('0x5a')]){var _0x2410ab={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3368cf[_0xfb4a('0x5a')]},'body':{'content':_0x48206a['body'],'to':[_0x48206a[_0xfb4a('0x20')]],'from':_0x3368cf[_0xfb4a('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0xfb4a('0x67')},'json':!![]};rp(_0x2410ab)[_0xfb4a('0x1b')](function(_0x4d2630){if(!_0x4d2630['error']){var _0x391f27={'messageId':_0x4d2630['messages'][0x0][_0xfb4a('0x68')]};if(!_0x3368cf[_0xfb4a('0x39')]){_0x391f27['read']=!![];}return _0x492f40[_0xfb4a('0x16')](_0x391f27);}else{return logger[_0xfb4a('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfb4a('0x66'),util[_0xfb4a('0x3b')](_0x4d2630[_0xfb4a('0x27')],{'showHidden':![],'depth':null}));}})[_0xfb4a('0x18')](function(_0x5d9268){return logger[_0xfb4a('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),'clickatell',util[_0xfb4a('0x3b')](_0x5d9268,{'showHidden':![],'depth':null}));});}else{logger[_0xfb4a('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),_0xfb4a('0x66'),_0xfb4a('0x65'));}break;case _0xfb4a('0x69'):if(_0x3368cf[_0xfb4a('0x2d')]&&_0x3368cf[_0xfb4a('0x2e')]){var _0x12e940=util[_0xfb4a('0x4c')](_0xfb4a('0x4d'),_0x3368cf[_0xfb4a('0x2d')],_0x3368cf['password']);var _0x35c9b6={'method':_0xfb4a('0x35'),'uri':_0xfb4a('0x6a')+_0x3368cf[_0xfb4a('0x6b')]+'/messages','body':{'to':[_0x48206a[_0xfb4a('0x20')]],'text':_0x48206a[_0xfb4a('0xb')],'from':_0x3368cf[_0xfb4a('0x20')],'applicationId':_0x3368cf['applicationId']},'headers':{'Authorization':util[_0xfb4a('0x4c')](_0xfb4a('0x44'),new Buffer(_0x12e940)[_0xfb4a('0x6c')](_0xfb4a('0x45')))},'json':!![]};rp(_0x35c9b6)[_0xfb4a('0x1b')](function(_0x5e21c2){if(_0x5e21c2['id']){var _0x3e4297={'messageId':_0x5e21c2['id']};return _0x492f40['update'](_0x3e4297);}else{logger[_0xfb4a('0x27')](_0xfb4a('0x28'),'afterCreate',_0xfb4a('0x69'),util['inspect'](_0x5e21c2,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4aa060){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),_0xfb4a('0x69'),util[_0xfb4a('0x3b')](_0x4aa060,{'showHidden':![],'depth':null}));});}else{logger[_0xfb4a('0x27')](_0xfb4a('0x28'),'afterCreate',_0xfb4a('0x69'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x3368cf[_0xfb4a('0x5a')]){var _0x50d85e={};var _0x438ed3={'method':_0xfb4a('0x35'),'uri':_0xfb4a('0x6d'),'headers':{'Authorization':_0xfb4a('0x6e')+_0x3368cf[_0xfb4a('0x5a')],'Content-Type':_0xfb4a('0x55')},'body':{'from':_0x3368cf[_0xfb4a('0x20')],'to':_0x48206a[_0xfb4a('0x20')],'text':_0x48206a['body']},'json':!![]};return rp(_0x438ed3)[_0xfb4a('0x1b')](function(_0x24931a){if(_0x24931a[_0xfb4a('0x6f')]==0xca){_0x50d85e['message']=_0x24931a;var _0x3a522b={'method':_0xfb4a('0x35'),'uri':_0xfb4a('0x70'),'headers':{'Authorization':_0xfb4a('0x6e')+_0x3368cf[_0xfb4a('0x5a')],'Content-Type':_0xfb4a('0x55')},'body':{'refid':_0x50d85e[_0xfb4a('0x71')][_0xfb4a('0x72')]},'json':!![]};return rp(_0x3a522b)['then'](function(_0x420f12){_0x50d85e['status']=_0x420f12;var _0x99e932={'messageId':_0x50d85e[_0xfb4a('0x71')][_0xfb4a('0x72')],'read':!![]};return _0x492f40[_0xfb4a('0x16')](_0x99e932);});}else{return logger[_0xfb4a('0x27')](_0xfb4a('0x28'),_0xfb4a('0x29'),_0xfb4a('0x73'),util[_0xfb4a('0x3b')](_0x24931a,{'showHidden':![],'depth':null}));}})[_0xfb4a('0x18')](function(_0x3f7cc6){return logger[_0xfb4a('0x27')](_0xfb4a('0x28'),_0xfb4a('0x29'),_0xfb4a('0x73'),util[_0xfb4a('0x3b')](_0x3f7cc6,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb4a('0x29'),_0xfb4a('0x73'),_0xfb4a('0x74'));}break;}}})[_0xfb4a('0x75')](function(){_0xb133d9();});}else{_0xb133d9();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9af1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','messageId','fti_sms_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','error','find','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','sid','catch','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','token','format','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','https://messaging.bandwidth.com/api/v2/users/','accountId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9af1,0x166));var _0x19af=function(_0x9832fb,_0x5d904b){_0x9832fb=_0x9832fb-0x0;var _0x19a041=_0x9af1[_0x9832fb];return _0x19a041;};'use strict';var _=require(_0x19af('0x0'));var util=require('util');var logger=require(_0x19af('0x1'))(_0x19af('0x2'));var moment=require(_0x19af('0x3'));var BPromise=require(_0x19af('0x4'));var rp=require(_0x19af('0x5'));var fs=require('fs');var path=require(_0x19af('0x6'));var rimraf=require(_0x19af('0x7'));var config=require(_0x19af('0x8'));var attributes=require(_0x19af('0x9'));module[_0x19af('0xa')]=function(_0xd156ce,_0x1ae580){return _0xd156ce['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x19af('0xb'),'fields':['messageId']},{'name':_0x19af('0xc'),'fields':[_0x19af('0xd')],'type':_0x19af('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1498b6,_0x5d7339,_0x3d5475){var _0x525371=_0xd156ce['models'];var _0x55abb9=_0x1498b6[_0x19af('0xf')]({'plain':!![]});if(_0x55abb9['direction'][_0x19af('0x10')]()==='in'||_0x55abb9[_0x19af('0x11')][_0x19af('0x10')]()==='out'&&!_0x55abb9[_0x19af('0x12')]&&!_[_0x19af('0x13')](_0x55abb9['UserId'])&&!_[_0x19af('0x13')](_0x55abb9[_0x19af('0x14')])){_0x525371[_0x19af('0x15')][_0x19af('0x16')]({'where':{'id':_0x55abb9[_0x19af('0x14')]}})[_0x19af('0x17')](function(_0x1316c5){if(_0x1316c5){_0x1316c5[_0x19af('0x18')]({'lastMsgAt':_0x55abb9[_0x19af('0x19')],'lastMsgDirection':_0x55abb9['direction']['toLowerCase']()});}})['catch'](function(_0x432380){console[_0x19af('0x1a')](_0x432380);});}if(_0x55abb9[_0x19af('0x11')]==='out'&&!_0x55abb9['secret']){var _0x236be4;_0x525371['SmsAccount'][_0x19af('0x1b')]({'where':{'id':_0x55abb9['SmsAccountId']},'raw':!![]})[_0x19af('0x17')](function(_0x459ec9){_0x236be4=_0x459ec9;if(_0x236be4&&_0x236be4['type']){switch(_0x236be4[_0x19af('0x1c')]){case _0x19af('0x1d'):var _0xbc6a18=require(_0x19af('0x1d'));if(_0x236be4[_0x19af('0x1e')]&&_0x236be4[_0x19af('0x1f')]&&_0x236be4[_0x19af('0x20')]){var _0x220d84=new _0xbc6a18(_0x236be4['accountSid'],_0x236be4[_0x19af('0x1f')]);_0x220d84[_0x19af('0x21')]['create']({'body':_0x55abb9[_0x19af('0xd')],'to':_0x55abb9['phone'],'from':_0x236be4[_0x19af('0x20')],'statusCallback':_0x236be4[_0x19af('0x22')]+_0x19af('0x23')+_0x55abb9['id']+_0x19af('0x24')+_0x236be4['token']})[_0x19af('0x17')](function(_0x38f181){if(_0x38f181['sid']){return _0x1498b6[_0x19af('0x18')]({'messageId':_0x38f181[_0x19af('0x25')]});}})[_0x19af('0x26')](function(_0x5debcb){logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x1d'),util['inspect'](_0x5debcb,{'showHidden':![],'depth':null}));});}else{logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x1d'),_0x19af('0x28'));}break;case'skebby':var _0x4aa076=_0x19af('0x29');if(_0x236be4[_0x19af('0x2a')]&&_0x236be4[_0x19af('0x2b')]){var _0x111d26={'recipient':[_0x55abb9[_0x19af('0x20')]],'message':_0x55abb9[_0x19af('0xd')],'message_type':_0x236be4[_0x19af('0x2c')]};if(_0x236be4[_0x19af('0x2c')]&&_0x236be4['smsMethod']!=='SI'){_0x111d26[_0x19af('0x2d')]=_0x236be4[_0x19af('0x20')];}var _0x47a003={'url':_0x4aa076+_0x19af('0x2e')+_0x236be4[_0x19af('0x2a')]+_0x19af('0x2f')+_0x236be4[_0x19af('0x2b')],'method':_0x19af('0x30')};rp(_0x47a003)[_0x19af('0x17')](function(_0x2aa557){var _0x5394ff=_0x2aa557[_0x19af('0x31')](';');var _0x58ec83={'user_key':_0x5394ff[0x0],'session_key':_0x5394ff[0x1]};_0x47a003={'url':_0x4aa076+_0x19af('0x32'),'method':_0x19af('0x33'),'headers':{'user_key':_0x58ec83['user_key'],'Session_key':_0x58ec83[_0x19af('0x34')]},'json':!![],'body':_0x111d26};return rp(_0x47a003);})[_0x19af('0x17')](function(_0x196f93){if(_0x196f93[_0x19af('0x35')]>=0x1){var _0x46036e={'messageId':_0x196f93[_0x19af('0x36')]};if(_0x236be4[_0x19af('0x2c')]!=='GP'||!_0x236be4[_0x19af('0x37')]){_0x46036e[_0x19af('0x38')]=!![];}return _0x1498b6[_0x19af('0x18')](_0x46036e);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x39'),util[_0x19af('0x3a')](_0x196f93,{'showHidden':![],'depth':null}));}})['catch'](function(_0x123df9){return logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x39'),util[_0x19af('0x3a')](_0x123df9,{'showHidden':![],'depth':null}));});}else{logger[_0x19af('0x1a')](_0x19af('0x3b'),_0x19af('0x27'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x19af('0x3c'):if(_0x236be4[_0x19af('0x1f')]){var _0xf4c834={'recipient':_0x55abb9['phone'],'message':_0x55abb9[_0x19af('0xd')],'sender':_0x236be4['senderString']||_0x236be4[_0x19af('0x20')],'authorization':_0x236be4[_0x19af('0x1f')]};var _0x5d7339={'method':_0x19af('0x33'),'uri':_0x19af('0x3d'),'body':_0xf4c834,'json':!![]};rp(_0x5d7339)[_0x19af('0x17')](function(_0x142772){var _0x3364c6={'messageId':_0x142772[_0x19af('0x3e')]};if(!_0x236be4['deliveryReport']){_0x3364c6[_0x19af('0x38')]=!![];}return _0x1498b6['update'](_0x3364c6);})[_0x19af('0x26')](function(_0x3de240){logger['error'](_0x19af('0x3b'),_0x19af('0x27'),'connectel',util[_0x19af('0x3a')](_0x3de240,{'showHidden':![],'depth':null}));});}else{logger[_0x19af('0x1a')](_0x19af('0x3b'),'afterCreate',_0x19af('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0x19af('0x3f'):if(_0x236be4[_0x19af('0x2a')]&&_0x236be4[_0x19af('0x2b')]){var _0xf4c834={'messages':[{'source':_0x19af('0x40'),'to':_0x55abb9[_0x19af('0x20')],'body':_0x55abb9['body'],'from':_0x236be4['senderString']||_0x236be4['phone']}]};var _0x1b8d24=util['format'](_0x19af('0x41'),_0x236be4['username'],_0x236be4[_0x19af('0x2b')]);var _0x5d7339={'method':_0x19af('0x33'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xf4c834,'headers':{'Authorization':util['format'](_0x19af('0x42'),new Buffer(_0x1b8d24)[_0x19af('0x43')](_0x19af('0x44')))},'json':!![]};rp(_0x5d7339)[_0x19af('0x17')](function(_0x28c2ef){if(_0x28c2ef[_0x19af('0x45')]>=0xc8&&_0x28c2ef[_0x19af('0x45')]<=0xce){if(_0x28c2ef[_0x19af('0x46')]&&_0x28c2ef[_0x19af('0x46')][_0x19af('0x47')]>0x0){var _0x4af9e2=_[_0x19af('0x48')](_0x28c2ef[_0x19af('0x46')][_0x19af('0x21')]);var _0x3f0e19={'messageId':_0x4af9e2[_0x19af('0x49')]};if(!_0x236be4[_0x19af('0x37')]){_0x3f0e19[_0x19af('0x38')]=!![];}return _0x1498b6[_0x19af('0x18')](_0x3f0e19);}else{logger['error'](_0x19af('0x3b'),_0x19af('0x27'),_0x19af('0x4a'),util[_0x19af('0x3a')](_0x28c2ef,{'showHidden':![],'depth':null}));}}else{logger[_0x19af('0x1a')](_0x19af('0x3b'),_0x19af('0x27'),_0x19af('0x4a'),util[_0x19af('0x3a')](_0x28c2ef,{'showHidden':![],'depth':null}));}})[_0x19af('0x26')](function(_0x2b1c67){logger['error'](_0x19af('0x3b'),'afterCreate',_0x19af('0x4a'),util['inspect'](_0x2b1c67,{'showHidden':![],'depth':null}));});}else{logger[_0x19af('0x1a')](_0x19af('0x3b'),_0x19af('0x27'),'clickSend',_0x19af('0x4b'));}break;case _0x19af('0x4c'):if(_0x236be4[_0x19af('0x4d')]&&_0x236be4[_0x19af('0x1f')]){var _0xf4c834={'dst':_0x55abb9[_0x19af('0x20')],'text':_0x55abb9[_0x19af('0xd')],'src':_0x236be4['senderString']||_0x236be4[_0x19af('0x20')],'url':_0x236be4[_0x19af('0x22')]+_0x19af('0x23')+_0x55abb9['id']+_0x19af('0x24')+_0x236be4[_0x19af('0x4e')]};var _0x1b8d24=util[_0x19af('0x4f')](_0x19af('0x41'),_0x236be4[_0x19af('0x4d')],_0x236be4[_0x19af('0x1f')]);var _0x5d7339={'method':_0x19af('0x33'),'uri':util[_0x19af('0x4f')](_0x19af('0x50'),_0x236be4['authId']),'body':_0xf4c834,'headers':{'Authorization':util['format'](_0x19af('0x42'),new Buffer(_0x1b8d24)[_0x19af('0x43')]('base64'))},'json':!![]};rp(_0x5d7339)[_0x19af('0x17')](function(_0x455935){var _0x596072={'messageId':_0x455935[_0x19af('0x51')][0x0]};return _0x1498b6['update'](_0x596072);})[_0x19af('0x26')](function(_0x9052e4){logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x4c'),util[_0x19af('0x3a')](_0x9052e4,{'showHidden':![],'depth':null}));});}else{logger[_0x19af('0x1a')](_0x19af('0x3b'),'afterCreate',_0x19af('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x236be4['username']&&_0x236be4[_0x19af('0x2b')]){if(_0x236be4[_0x19af('0x52')]){var _0x334d8d={'method':_0x19af('0x33'),'uri':_0x236be4['baseUrl']+_0x19af('0x53'),'body':{'username':_0x236be4['username'],'password':_0x236be4[_0x19af('0x2b')]},'json':!![]};return rp(_0x334d8d)['then'](function(_0x16bc6b){var _0x549b0b={'method':_0x19af('0x33'),'uri':_0x236be4[_0x19af('0x52')]+_0x19af('0x54'),'body':{'messages':[{'from':_0x236be4['phone'],'destinations':[{'to':_0x55abb9['phone']}],'text':_0x55abb9[_0x19af('0xd')],'notifyUrl':_0x236be4[_0x19af('0x22')]+_0x19af('0x23')+_0x55abb9['id']+_0x19af('0x24')+_0x236be4['token'],'notifyContentType':_0x19af('0x55'),'callbackData':_0x236be4[_0x19af('0x20')]+';'+_0x55abb9['body']}]},'headers':{'Authorization':_0x19af('0x56')+_0x16bc6b[_0x19af('0x4e')]},'json':!![]};return rp(_0x549b0b)[_0x19af('0x17')](function(_0x4f5567){if(_0x4f5567[_0x19af('0x21')]){var _0x1c6d35={'messageId':_0x4f5567[_0x19af('0x21')][0x0]['messageId']};if(!_0x236be4[_0x19af('0x37')]){_0x1c6d35[_0x19af('0x38')]=!![];}return _0x1498b6[_0x19af('0x18')](_0x1c6d35);}else{return logger[_0x19af('0x1a')](_0x19af('0x3b'),_0x19af('0x27'),_0x19af('0x57'),util[_0x19af('0x3a')](_0x4f5567,{'showHidden':![],'depth':null}));}});})[_0x19af('0x26')](function(_0x364472){return logger[_0x19af('0x1a')](_0x19af('0x3b'),_0x19af('0x27'),'infobip',util['inspect'](_0x364472,{'showHidden':![],'depth':null}));});}else{logger[_0x19af('0x1a')](_0x19af('0x3b'),'afterCreate',_0x19af('0x57'),_0x19af('0x58'));}}else{logger['error'](_0x19af('0x3b'),'afterCreate',_0x19af('0x57'),_0x19af('0x4b'));}break;case _0x19af('0x59'):var _0xefdffe=require(_0x19af('0x5a'));if(_0x236be4[_0x19af('0x5b')]){var _0x3d8a69={};_0x3d8a69[_0x19af('0x5c')]=_0x236be4[_0x19af('0x2a')];_0x3d8a69['phone']=_0x55abb9[_0x19af('0x20')];_0x3d8a69[_0x19af('0x2d')]=_0x236be4[_0x19af('0x20')];_0x3d8a69[_0x19af('0x5d')]=_0x55abb9[_0x19af('0xd')];_0x3d8a69[_0x19af('0x5e')]=+new Date();var _0x38c0bf='';var _0x16fe16='';var _0x3a37a2=Object['keys'](_0x3d8a69);_0x3a37a2[_0x19af('0x5f')]();for(var _0x5ad7bd=0x0;_0x5ad7bd<_0x3a37a2[_0x19af('0x60')];_0x5ad7bd++){if(_0x38c0bf!=''){_0x38c0bf+='&';}_0x38c0bf+=_0x3a37a2[_0x5ad7bd]+'='+encodeURIComponent(_0x3d8a69[_0x3a37a2[_0x5ad7bd]]);_0x16fe16+=_0x3d8a69[_0x3a37a2[_0x5ad7bd]];}_0x16fe16+=_0x236be4[_0x19af('0x5b')];_0x16fe16=_0xefdffe[_0x19af('0x61')](_0x19af('0x62'))[_0x19af('0x18')](_0x16fe16)[_0x19af('0x63')](_0x19af('0x64'));if(_0x38c0bf!==''){_0x38c0bf+='&';}_0x38c0bf+=_0x19af('0x65')+_0x16fe16;var _0x47a003={'method':'GET','uri':_0x236be4[_0x19af('0x52')]+_0x19af('0x66')+_0x38c0bf,'json':!![]};return rp(_0x47a003)['then'](function(_0x2a9000){var _0x5bbfc6=Object['keys'](_0x2a9000);if(_0x2a9000[_0x5bbfc6[0x0]][_0x19af('0x1a')]&&parseInt(_0x2a9000[_0x5bbfc6[0x0]][_0x19af('0x1a')])===0x0){var _0x3615b0={'messageId':_0x2a9000[_0x5bbfc6[0x0]][_0x19af('0x67')]};if(!_0x236be4['deliveryReport']){_0x3615b0[_0x19af('0x38')]=!![];}return _0x1498b6[_0x19af('0x18')](_0x3615b0);}else{return logger['error'](_0x19af('0x3b'),_0x19af('0x27'),'csc',util['inspect'](_0x2a9000[_0x19af('0x1a')],{'showHidden':![],'depth':null}));}})[_0x19af('0x26')](function(_0x398ec8){return logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x59'),util[_0x19af('0x3a')](_0x398ec8,{'showHidden':![],'depth':null}));});}else{logger[_0x19af('0x1a')](_0x19af('0x3b'),_0x19af('0x27'),_0x19af('0x59'),_0x19af('0x68'));}break;case'clickatell':if(_0x236be4['apiKey']){var _0xfab409={'method':_0x19af('0x33'),'uri':_0x19af('0x69'),'headers':{'Authorization':_0x236be4[_0x19af('0x5b')]},'body':{'content':_0x55abb9['body'],'to':[_0x55abb9['phone']],'from':_0x236be4['phone'],'binary':![],'clientMessageId':_0x19af('0x6a'),'charset':_0x19af('0x6b')},'json':!![]};rp(_0xfab409)[_0x19af('0x17')](function(_0x36b8ce){if(!_0x36b8ce[_0x19af('0x1a')]){var _0x5e105c={'messageId':_0x36b8ce[_0x19af('0x21')][0x0]['apiMessageId']};if(!_0x236be4[_0x19af('0x37')]){_0x5e105c['read']=!![];}return _0x1498b6[_0x19af('0x18')](_0x5e105c);}else{return logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x6c'),util[_0x19af('0x3a')](_0x36b8ce[_0x19af('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x66b411){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x6c'),util['inspect'](_0x66b411,{'showHidden':![],'depth':null}));});}else{logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),'clickatell',_0x19af('0x68'));}break;case'bandwidth':if(_0x236be4[_0x19af('0x2a')]&&_0x236be4[_0x19af('0x2b')]){var _0x1b8d24=util[_0x19af('0x4f')](_0x19af('0x41'),_0x236be4[_0x19af('0x2a')],_0x236be4[_0x19af('0x2b')]);var _0x5d7339={'method':_0x19af('0x33'),'uri':_0x19af('0x6d')+_0x236be4[_0x19af('0x6e')]+'/messages','body':{'to':[_0x55abb9[_0x19af('0x20')]],'text':_0x55abb9['body'],'from':_0x236be4[_0x19af('0x20')],'applicationId':_0x236be4['applicationId']},'headers':{'Authorization':util['format'](_0x19af('0x42'),new Buffer(_0x1b8d24)[_0x19af('0x43')](_0x19af('0x44')))},'json':!![]};rp(_0x5d7339)[_0x19af('0x17')](function(_0x324630){if(_0x324630['id']){var _0x168dee={'messageId':_0x324630['id']};return _0x1498b6[_0x19af('0x18')](_0x168dee);}else{logger[_0x19af('0x1a')](_0x19af('0x3b'),'afterCreate',_0x19af('0x6f'),util['inspect'](_0x324630,{'showHidden':![],'depth':null}));}})[_0x19af('0x26')](function(_0x4f340b){logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x6f'),util['inspect'](_0x4f340b,{'showHidden':![],'depth':null}));});}else{logger[_0x19af('0x1a')](_0x19af('0x3b'),_0x19af('0x27'),_0x19af('0x6f'),_0x19af('0x4b'));}break;case _0x19af('0x70'):if(_0x236be4[_0x19af('0x5b')]){var _0xee085f={};var _0x47a003={'method':_0x19af('0x33'),'uri':_0x19af('0x71'),'headers':{'Authorization':_0x19af('0x72')+_0x236be4[_0x19af('0x5b')],'Content-Type':_0x19af('0x55')},'body':{'from':_0x236be4[_0x19af('0x20')],'to':_0x55abb9['phone'],'text':_0x55abb9['body']},'json':!![]};return rp(_0x47a003)['then'](function(_0x9001b5){if(_0x9001b5['code']==0xca){_0xee085f[_0x19af('0x73')]=_0x9001b5;var _0x229c2a={'method':_0x19af('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x19af('0x72')+_0x236be4['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0xee085f[_0x19af('0x73')][_0x19af('0x74')]},'json':!![]};return rp(_0x229c2a)[_0x19af('0x17')](function(_0x4ee8aa){_0xee085f['status']=_0x4ee8aa;var _0x48918e={'messageId':_0xee085f[_0x19af('0x73')][_0x19af('0x74')],'read':!![]};return _0x1498b6['update'](_0x48918e);});}else{return logger[_0x19af('0x1a')](_0x19af('0x3b'),_0x19af('0x27'),_0x19af('0x70'),util[_0x19af('0x3a')](_0x9001b5,{'showHidden':![],'depth':null}));}})[_0x19af('0x26')](function(_0x2e45a3){return logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x19af('0x70'),util[_0x19af('0x3a')](_0x2e45a3,{'showHidden':![],'depth':null}));});}else{return logger[_0x19af('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x19af('0x27'),_0x19af('0x70'),_0x19af('0x75'));}break;}}})['finally'](function(){_0x3d5475();});}else{_0x3d5475();}}},'charset':_0x19af('0x76'),'collate':_0x19af('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 5da92cf..d162dd0 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 _0x5301=['info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','request','then'];(function(_0x1ad8c1,_0xfb07c5){var _0x349050=function(_0xff5e1d){while(--_0xff5e1d){_0x1ad8c1['push'](_0x1ad8c1['shift']());}};_0x349050(++_0xfb07c5);}(_0x5301,0x11f));var _0x1530=function(_0x211aa7,_0x70aa04){_0x211aa7=_0x211aa7-0x0;var _0x745d2a=_0x5301[_0x211aa7];return _0x745d2a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1530('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1530('0x1'))['db'];var utils=require(_0x1530('0x2'));var logger=require(_0x1530('0x3'))('rpc');var config=require(_0x1530('0x4'));var jayson=require(_0x1530('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x1530('0x6')]=_[_0x1530('0x7')](config[_0x1530('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1530('0x6')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x435ef3,_0x393a19,_0x26150c){return new BPromise(function(_0x1240a9,_0x2b1be2){return client[_0x1530('0x8')](_0x435ef3,_0x26150c)[_0x1530('0x9')](function(_0x3c34d3){logger[_0x1530('0xa')](_0x1530('0xb'),_0x393a19,_0x1530('0xc'));logger[_0x1530('0xd')](_0x1530('0xe'),_0x393a19,_0x1530('0xc'),JSON[_0x1530('0xf')](_0x3c34d3));if(_0x3c34d3['error']){if(_0x3c34d3[_0x1530('0x10')][_0x1530('0x11')]===0x1f4){logger['error'](_0x1530('0xb'),_0x393a19,_0x3c34d3[_0x1530('0x10')][_0x1530('0x12')]);return _0x2b1be2(_0x3c34d3['error'][_0x1530('0x12')]);}logger[_0x1530('0x10')]('SmsMessage,\x20%s,\x20%s',_0x393a19,_0x3c34d3[_0x1530('0x10')][_0x1530('0x12')]);return _0x1240a9(_0x3c34d3['error'][_0x1530('0x12')]);}else{logger[_0x1530('0xa')]('SmsMessage,\x20%s,\x20%s',_0x393a19,_0x1530('0xc'));_0x1240a9(_0x3c34d3[_0x1530('0x13')][_0x1530('0x12')]);}})[_0x1530('0x14')](function(_0x1cbfb3){logger[_0x1530('0x10')](_0x1530('0xb'),_0x393a19,_0x1cbfb3);_0x2b1be2(_0x1cbfb3);});});}exports[_0x1530('0x15')]=function(_0x5caa12){var _0x2198e4=this;return new Promise(function(_0xf3cbbe,_0x40ec24){return db[_0x1530('0x16')][_0x1530('0x17')](_0x5caa12[_0x1530('0x18')],{'raw':_0x5caa12[_0x1530('0x19')]?_0x5caa12[_0x1530('0x19')][_0x1530('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x6b8aa4){logger[_0x1530('0xa')]('CreateSmsMessage',_0x5caa12);logger['debug'](_0x1530('0x15'),_0x5caa12,JSON[_0x1530('0xf')](_0x6b8aa4));_0xf3cbbe(_0x6b8aa4);})[_0x1530('0x14')](function(_0x3f137e){logger[_0x1530('0x10')]('CreateSmsMessage',_0x3f137e[_0x1530('0x12')],_0x5caa12);_0x40ec24(_0x2198e4[_0x1530('0x10')](0x1f4,_0x3f137e[_0x1530('0x12')]));});});}; \ No newline at end of file +var _0xac29=['redis','defaults','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xac29,0x104));var _0x9ac2=function(_0x349d80,_0x2913c4){_0x349d80=_0x349d80-0x0;var _0x5cd616=_0xac29[_0x349d80];return _0x5cd616;};'use strict';var _=require(_0x9ac2('0x0'));var util=require(_0x9ac2('0x1'));var moment=require(_0x9ac2('0x2'));var BPromise=require(_0x9ac2('0x3'));var rs=require(_0x9ac2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ac2('0x5'))['db'];var utils=require(_0x9ac2('0x6'));var logger=require('../../config/logger')(_0x9ac2('0x7'));var config=require(_0x9ac2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9ac2('0x9')]['http']({'port':0x232a});config[_0x9ac2('0xa')]=_[_0x9ac2('0xb')](config[_0x9ac2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ac2('0xa')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a5cc6,_0x2efb55,_0x404140){return new BPromise(function(_0x129175,_0x350231){return client[_0x9ac2('0xc')](_0x2a5cc6,_0x404140)[_0x9ac2('0xd')](function(_0x3b2390){logger[_0x9ac2('0xe')](_0x9ac2('0xf'),_0x2efb55,_0x9ac2('0x10'));logger[_0x9ac2('0x11')](_0x9ac2('0x12'),_0x2efb55,'request\x20sent',JSON[_0x9ac2('0x13')](_0x3b2390));if(_0x3b2390[_0x9ac2('0x14')]){if(_0x3b2390['error'][_0x9ac2('0x15')]===0x1f4){logger['error'](_0x9ac2('0xf'),_0x2efb55,_0x3b2390['error'][_0x9ac2('0x16')]);return _0x350231(_0x3b2390[_0x9ac2('0x14')]['message']);}logger[_0x9ac2('0x14')](_0x9ac2('0xf'),_0x2efb55,_0x3b2390[_0x9ac2('0x14')]['message']);return _0x129175(_0x3b2390[_0x9ac2('0x14')][_0x9ac2('0x16')]);}else{logger[_0x9ac2('0xe')](_0x9ac2('0xf'),_0x2efb55,_0x9ac2('0x10'));_0x129175(_0x3b2390['result']['message']);}})[_0x9ac2('0x17')](function(_0x75f3b0){logger[_0x9ac2('0x14')]('SmsMessage,\x20%s,\x20%s',_0x2efb55,_0x75f3b0);_0x350231(_0x75f3b0);});});}exports[_0x9ac2('0x18')]=function(_0x20d3b1){var _0x19d1ff=this;return new Promise(function(_0x118b0b,_0x365ff9){return db[_0x9ac2('0x19')][_0x9ac2('0x1a')](_0x20d3b1[_0x9ac2('0x1b')],{'raw':_0x20d3b1[_0x9ac2('0x1c')]?_0x20d3b1['options'][_0x9ac2('0x1d')]===undefined?!![]:![]:!![]})[_0x9ac2('0xd')](function(_0x4fb547){logger[_0x9ac2('0xe')](_0x9ac2('0x18'),_0x20d3b1);logger['debug'](_0x9ac2('0x18'),_0x20d3b1,JSON[_0x9ac2('0x13')](_0x4fb547));_0x118b0b(_0x4fb547);})[_0x9ac2('0x17')](function(_0x50ff40){logger[_0x9ac2('0x14')](_0x9ac2('0x18'),_0x50ff40['message'],_0x20d3b1);_0x365ff9(_0x19d1ff[_0x9ac2('0x14')](0x1f4,_0x50ff40['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 48a5295..ea2922c 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 _0x86d9=['register','save','remove','update','emit','removeListener'];(function(_0x7cf923,_0x2a21f7){var _0x48f48b=function(_0x520e22){while(--_0x520e22){_0x7cf923['push'](_0x7cf923['shift']());}};_0x48f48b(++_0x2a21f7);}(_0x86d9,0xfd));var _0x986d=function(_0x261b45,_0x143542){_0x261b45=_0x261b45-0x0;var _0x7975b4=_0x86d9[_0x261b45];return _0x7975b4;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x986d('0x0'),_0x986d('0x1'),_0x986d('0x2')];function createListener(_0x23bbbe,_0x408b00){return function(_0x4e5206){_0x408b00[_0x986d('0x3')](_0x23bbbe,_0x4e5206);};}function removeListener(_0x824c69,_0x53acbe){return function(){SmsMessageEvents[_0x986d('0x4')](_0x824c69,_0x53acbe);};}exports[_0x986d('0x5')]=function(_0x3e8f7c){for(var _0x1bd382=0x0,_0x3f9f48=events['length'];_0x1bd382<_0x3f9f48;_0x1bd382++){var _0x4b4341=events[_0x1bd382];var _0xd730ba=createListener('smsMessage:'+_0x4b4341,_0x3e8f7c);SmsMessageEvents['on'](_0x4b4341,_0xd730ba);}}; \ No newline at end of file +var _0x0d70=['emit','length','smsMessage:','save','remove','update'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x0d70,0xab));var _0x00d7=function(_0x23e90d,_0x2442b9){_0x23e90d=_0x23e90d-0x0;var _0x3a1c5f=_0x0d70[_0x23e90d];return _0x3a1c5f;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x00d7('0x0'),_0x00d7('0x1'),_0x00d7('0x2')];function createListener(_0x37c31f,_0x17e3e2){return function(_0x237bbd){_0x17e3e2[_0x00d7('0x3')](_0x37c31f,_0x237bbd);};}function removeListener(_0x58274b,_0x310619){return function(){SmsMessageEvents['removeListener'](_0x58274b,_0x310619);};}exports['register']=function(_0x5c4f4e){for(var _0x1640ce=0x0,_0x45c829=events[_0x00d7('0x4')];_0x1640ce<_0x45c829;_0x1640ce++){var _0x16d6ec=events[_0x1640ce];var _0x29fd08=createListener(_0x00d7('0x5')+_0x16d6ec,_0x5c4f4e);SmsMessageEvents['on'](_0x16d6ec,_0x29fd08);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8841674..b3872af 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 _0xe4fe=['fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','express','Router'];(function(_0x2c1ad0,_0x5c2efb){var _0x22da92=function(_0x104fb5){while(--_0x104fb5){_0x2c1ad0['push'](_0x2c1ad0['shift']());}};_0x22da92(++_0x5c2efb);}(_0xe4fe,0x1cc));var _0xee4f=function(_0x34cc9f,_0x4d891a){_0x34cc9f=_0x34cc9f-0x0;var _0x1991d3=_0xe4fe[_0x34cc9f];return _0x1991d3;};'use strict';var multer=require('multer');var util=require(_0xee4f('0x0'));var path=require(_0xee4f('0x1'));var timeout=require('connect-timeout');var express=require(_0xee4f('0x2'));var router=express[_0xee4f('0x3')]();var fs_extra=require(_0xee4f('0x4'));var auth=require(_0xee4f('0x5'));var interaction=require(_0xee4f('0x6'));var config=require('../../config/environment');var controller=require(_0xee4f('0x7'));router[_0xee4f('0x8')]('/',auth[_0xee4f('0x9')](),controller[_0xee4f('0xa')]);router[_0xee4f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xee4f('0x8')](_0xee4f('0xb'),auth[_0xee4f('0x9')](),controller[_0xee4f('0xc')]);router[_0xee4f('0x8')](_0xee4f('0xd'),auth[_0xee4f('0x9')](),controller[_0xee4f('0xe')]);router[_0xee4f('0x8')](_0xee4f('0xf'),auth[_0xee4f('0x9')](),controller[_0xee4f('0x10')]);router[_0xee4f('0x8')](_0xee4f('0x11'),auth[_0xee4f('0x9')](),controller[_0xee4f('0x12')]);router[_0xee4f('0x13')]('/',auth[_0xee4f('0x9')](),controller['create']);router[_0xee4f('0x13')](_0xee4f('0xf'),auth[_0xee4f('0x9')](),controller[_0xee4f('0x14')]);router[_0xee4f('0x13')](_0xee4f('0x11'),auth[_0xee4f('0x9')](),controller[_0xee4f('0x15')]);router[_0xee4f('0x16')](_0xee4f('0xb'),auth[_0xee4f('0x9')](),controller[_0xee4f('0x17')]);router[_0xee4f('0x18')](_0xee4f('0xb'),auth[_0xee4f('0x9')](),controller[_0xee4f('0x19')]);router[_0xee4f('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xee4f('0x1a')]);router[_0xee4f('0x18')](_0xee4f('0x11'),auth[_0xee4f('0x9')](),controller[_0xee4f('0x1b')]);module[_0xee4f('0x1c')]=router; \ No newline at end of file +var _0x85a7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','update','/:id','destroy','removeTeams','delete','removeAgents','multer','path','connect-timeout','express'];(function(_0x18b762,_0x5c68f5){var _0x305e96=function(_0xf66622){while(--_0xf66622){_0x18b762['push'](_0x18b762['shift']());}};_0x305e96(++_0x5c68f5);}(_0x85a7,0x1e9));var _0x785a=function(_0x4b6665,_0x4781b7){_0x4b6665=_0x4b6665-0x0;var _0x388079=_0x85a7[_0x4b6665];return _0x388079;};'use strict';var multer=require(_0x785a('0x0'));var util=require('util');var path=require(_0x785a('0x1'));var timeout=require(_0x785a('0x2'));var express=require(_0x785a('0x3'));var router=express[_0x785a('0x4')]();var fs_extra=require(_0x785a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x785a('0x6'));var config=require(_0x785a('0x7'));var controller=require(_0x785a('0x8'));router[_0x785a('0x9')]('/',auth['isAuthenticated'](),controller[_0x785a('0xa')]);router[_0x785a('0x9')](_0x785a('0xb'),auth[_0x785a('0xc')](),controller[_0x785a('0xd')]);router['get']('/:id',auth[_0x785a('0xc')](),controller[_0x785a('0xe')]);router[_0x785a('0x9')]('/:id/members',auth[_0x785a('0xc')](),controller[_0x785a('0xf')]);router[_0x785a('0x9')](_0x785a('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x785a('0x9')](_0x785a('0x11'),auth[_0x785a('0xc')](),controller[_0x785a('0x12')]);router[_0x785a('0x13')]('/',auth[_0x785a('0xc')](),controller[_0x785a('0x14')]);router[_0x785a('0x13')](_0x785a('0x10'),auth[_0x785a('0xc')](),controller[_0x785a('0x15')]);router[_0x785a('0x13')]('/:id/users',auth[_0x785a('0xc')](),controller[_0x785a('0x16')]);router['put']('/:id',auth[_0x785a('0xc')](),controller[_0x785a('0x17')]);router['delete'](_0x785a('0x18'),auth[_0x785a('0xc')](),controller[_0x785a('0x19')]);router['delete'](_0x785a('0x10'),auth[_0x785a('0xc')](),controller[_0x785a('0x1a')]);router[_0x785a('0x1b')](_0x785a('0x11'),auth['isAuthenticated'](),controller[_0x785a('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index bda3a97..5d3dc38 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 _0xf318=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0xf318,0x113));var _0x8f31=function(_0x26a970,_0x102e71){_0x26a970=_0x26a970-0x0;var _0x1a5076=_0xf318[_0x26a970];return _0x1a5076;};'use strict';var Sequelize=require(_0x8f31('0x0'));module[_0x8f31('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8f31('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8f31('0x3')]},'timeout':{'type':Sequelize[_0x8f31('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f31('0x5')](_0x8f31('0x6'),_0x8f31('0x7'),_0x8f31('0x8'))}}; \ No newline at end of file +var _0x4b7f=['beepall','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x58ef97,_0x572f92){var _0x44878f=function(_0x10afed){while(--_0x10afed){_0x58ef97['push'](_0x58ef97['shift']());}};_0x44878f(++_0x572f92);}(_0x4b7f,0xf1));var _0xf4b7=function(_0x2966bd,_0x1aa967){_0x2966bd=_0x2966bd-0x0;var _0x542e5e=_0x4b7f[_0x2966bd];return _0x542e5e;};'use strict';var Sequelize=require(_0xf4b7('0x0'));module['exports']={'name':{'type':Sequelize[_0xf4b7('0x1')],'unique':_0xf4b7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf4b7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf4b7('0x4')]('rrmemory',_0xf4b7('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 36a1083..7c877bb 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0xadb5,0xad));var _0x5adb=function(_0x34595d,_0x5d7771){_0x34595d=_0x34595d-0x0;var _0x534031=_0xadb5[_0x34595d];return _0x534031;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +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(_0x1ed511,_0x5bd8f0){var _0x32ab7b=function(_0x46066e){while(--_0x46066e){_0x1ed511['push'](_0x1ed511['shift']());}};_0x32ab7b(++_0x5bd8f0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'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 diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 18fa289..a2036ab 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 _0x98d0=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1dc122,_0x5c27aa){var _0x3dbe93=function(_0xd613cd){while(--_0xd613cd){_0x1dc122['push'](_0x1dc122['shift']());}};_0x3dbe93(++_0x5c27aa);}(_0x98d0,0xd0));var _0x098d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x98d0[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x098d('0x0'));var SmsQueue=require(_0x098d('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x098d('0x2')](0x0);var events={'afterCreate':_0x098d('0x3'),'afterUpdate':_0x098d('0x4'),'afterDestroy':_0x098d('0x5')};function emitEvent(_0x559f4a){return function(_0x3e0348,_0x175a64,_0x27614c){SmsQueueEvents[_0x098d('0x6')](_0x559f4a+':'+_0x3e0348['id'],_0x3e0348);SmsQueueEvents[_0x098d('0x6')](_0x559f4a,_0x3e0348);_0x27614c(null);};}for(var e in events){if(events[_0x098d('0x7')](e)){var event=events[e];SmsQueue[_0x098d('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x3ccd=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue'];(function(_0x1d3d50,_0x2a7e40){var _0x5c0195=function(_0x1a0c5e){while(--_0x1a0c5e){_0x1d3d50['push'](_0x1d3d50['shift']());}};_0x5c0195(++_0x2a7e40);}(_0x3ccd,0x126));var _0xd3cc=function(_0xe3886,_0x122d85){_0xe3886=_0xe3886-0x0;var _0x324fdd=_0x3ccd[_0xe3886];return _0x324fdd;};'use strict';var EventEmitter=require(_0xd3cc('0x0'));var SmsQueue=require(_0xd3cc('0x1'))['db'][_0xd3cc('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd3cc('0x3')](0x0);var events={'afterCreate':_0xd3cc('0x4'),'afterUpdate':'update','afterDestroy':_0xd3cc('0x5')};function emitEvent(_0x2294ba){return function(_0x2cec6e,_0x431d5c,_0x1e262f){SmsQueueEvents[_0xd3cc('0x6')](_0x2294ba+':'+_0x2cec6e['id'],_0x2cec6e);SmsQueueEvents['emit'](_0x2294ba,_0x2cec6e);_0x1e262f(null);};}for(var e in events){if(events[_0xd3cc('0x7')](e)){var event=events[e];SmsQueue[_0xd3cc('0x8')](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 34ee340..c93f3a6 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 _0x45c8=['bluebird','request-promise','rimraf','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x45c8,0x8b));var _0x845c=function(_0x527a17,_0x5500bb){_0x527a17=_0x527a17-0x0;var _0x1a6ae7=_0x45c8[_0x527a17];return _0x1a6ae7;};'use strict';var _=require(_0x845c('0x0'));var util=require(_0x845c('0x1'));var logger=require(_0x845c('0x2'))(_0x845c('0x3'));var moment=require(_0x845c('0x4'));var BPromise=require(_0x845c('0x5'));var rp=require(_0x845c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x845c('0x7'));var config=require('../../config/environment');var attributes=require(_0x845c('0x8'));module['exports']=function(_0x546795,_0x4211ae){return _0x546795[_0x845c('0x9')](_0x845c('0xa'),attributes,{'tableName':_0x845c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf160=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','../../config/logger','bluebird','request-promise'];(function(_0x290f5d,_0x1925f1){var _0x5b5d42=function(_0x1fcf45){while(--_0x1fcf45){_0x290f5d['push'](_0x290f5d['shift']());}};_0x5b5d42(++_0x1925f1);}(_0xf160,0xcd));var _0x0f16=function(_0x5ea9e1,_0x27b1e9){_0x5ea9e1=_0x5ea9e1-0x0;var _0x5a2e4c=_0xf160[_0x5ea9e1];return _0x5a2e4c;};'use strict';var _=require(_0x0f16('0x0'));var util=require('util');var logger=require(_0x0f16('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0f16('0x2'));var rp=require(_0x0f16('0x3'));var fs=require('fs');var path=require(_0x0f16('0x4'));var rimraf=require(_0x0f16('0x5'));var config=require(_0x0f16('0x6'));var attributes=require(_0x0f16('0x7'));module[_0x0f16('0x8')]=function(_0x559ff5,_0x4d7bc0){return _0x559ff5['define'](_0x0f16('0x9'),attributes,{'tableName':_0x0f16('0xa'),'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 6405ac6..c1e5fda 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 _0x0a52=['raw','where','limit','include','map','model','attributes','GetSmsQueue','catch','find','ShowSmsQueue','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsQueue','findAll','options'];(function(_0x2b7f97,_0x3fe5c6){var _0x3c2339=function(_0x12e36c){while(--_0x12e36c){_0x2b7f97['push'](_0x2b7f97['shift']());}};_0x3c2339(++_0x3fe5c6);}(_0x0a52,0x153));var _0x20a5=function(_0x3a7cd4,_0x3e8374){_0x3a7cd4=_0x3a7cd4-0x0;var _0x58bb88=_0x0a52[_0x3a7cd4];return _0x58bb88;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x20a5('0x0'));var BPromise=require('bluebird');var rs=require(_0x20a5('0x1'));var fs=require('fs');var Redis=require(_0x20a5('0x2'));var db=require(_0x20a5('0x3'))['db'];var utils=require(_0x20a5('0x4'));var logger=require(_0x20a5('0x5'))(_0x20a5('0x6'));var config=require(_0x20a5('0x7'));var jayson=require(_0x20a5('0x8'));var client=jayson['client'][_0x20a5('0x9')]({'port':0x232a});config[_0x20a5('0xa')]=_['defaults'](config[_0x20a5('0xa')],{'host':_0x20a5('0xb'),'port':0x18eb});var socket=require(_0x20a5('0xc'))(new Redis(config[_0x20a5('0xa')]));require(_0x20a5('0xd'))[_0x20a5('0xe')](socket);function respondWithRpcPromise(_0x22988a,_0x492f5f,_0x5121cd){return new BPromise(function(_0x295bbf,_0x594f29){return client[_0x20a5('0xf')](_0x22988a,_0x5121cd)[_0x20a5('0x10')](function(_0x2efb70){logger[_0x20a5('0x11')](_0x20a5('0x12'),_0x492f5f,_0x20a5('0x13'));logger[_0x20a5('0x14')](_0x20a5('0x15'),_0x492f5f,_0x20a5('0x13'),JSON[_0x20a5('0x16')](_0x2efb70));if(_0x2efb70[_0x20a5('0x17')]){if(_0x2efb70['error'][_0x20a5('0x18')]===0x1f4){logger[_0x20a5('0x17')](_0x20a5('0x12'),_0x492f5f,_0x2efb70['error']['message']);return _0x594f29(_0x2efb70[_0x20a5('0x17')][_0x20a5('0x19')]);}logger[_0x20a5('0x17')](_0x20a5('0x12'),_0x492f5f,_0x2efb70[_0x20a5('0x17')]['message']);return _0x295bbf(_0x2efb70[_0x20a5('0x17')][_0x20a5('0x19')]);}else{logger[_0x20a5('0x11')](_0x20a5('0x12'),_0x492f5f,_0x20a5('0x13'));_0x295bbf(_0x2efb70[_0x20a5('0x1a')][_0x20a5('0x19')]);}})['catch'](function(_0x1f43c1){logger[_0x20a5('0x17')](_0x20a5('0x12'),_0x492f5f,_0x1f43c1);_0x594f29(_0x1f43c1);});});}exports['GetSmsQueue']=function(_0x17f0e1){var _0x16506c=this;return new Promise(function(_0x540e87,_0x427c01){return db[_0x20a5('0x1b')][_0x20a5('0x1c')]({'raw':_0x17f0e1['options']?_0x17f0e1[_0x20a5('0x1d')][_0x20a5('0x1e')]===undefined?!![]:![]:!![],'where':_0x17f0e1[_0x20a5('0x1d')]?_0x17f0e1[_0x20a5('0x1d')][_0x20a5('0x1f')]||null:null,'attributes':_0x17f0e1[_0x20a5('0x1d')]?_0x17f0e1[_0x20a5('0x1d')]['attributes']||null:null,'limit':_0x17f0e1[_0x20a5('0x1d')]?_0x17f0e1[_0x20a5('0x1d')][_0x20a5('0x20')]||null:null,'include':_0x17f0e1['options']?_0x17f0e1['options'][_0x20a5('0x21')]?_[_0x20a5('0x22')](_0x17f0e1['options'][_0x20a5('0x21')],function(_0x39a818){return{'model':db[_0x39a818[_0x20a5('0x23')]],'as':_0x39a818['as'],'attributes':_0x39a818['attributes'],'include':_0x39a818[_0x20a5('0x21')]?_[_0x20a5('0x22')](_0x39a818[_0x20a5('0x21')],function(_0x377216){return{'model':db[_0x377216['model']],'as':_0x377216['as'],'attributes':_0x377216[_0x20a5('0x24')],'include':_0x377216[_0x20a5('0x21')]?_[_0x20a5('0x22')](_0x377216[_0x20a5('0x21')],function(_0x42ffe3){return{'model':db[_0x42ffe3[_0x20a5('0x23')]],'as':_0x42ffe3['as'],'attributes':_0x42ffe3[_0x20a5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x20a5('0x10')](function(_0x4c3e41){logger['info'](_0x20a5('0x25'),_0x17f0e1);logger[_0x20a5('0x14')](_0x20a5('0x25'),_0x17f0e1,JSON[_0x20a5('0x16')](_0x4c3e41));_0x540e87(_0x4c3e41);})[_0x20a5('0x26')](function(_0x3b6b9e){logger[_0x20a5('0x17')]('GetSmsQueue',_0x3b6b9e[_0x20a5('0x19')],_0x17f0e1);_0x427c01(_0x16506c[_0x20a5('0x17')](0x1f4,_0x3b6b9e[_0x20a5('0x19')]));});});};exports['ShowSmsQueue']=function(_0xb3b747){var _0x27bcf7=this;return new Promise(function(_0x40a0af,_0x38f178){return db[_0x20a5('0x1b')][_0x20a5('0x27')]({'raw':_0xb3b747[_0x20a5('0x1d')]?_0xb3b747['options']['raw']===undefined?!![]:![]:!![],'where':_0xb3b747[_0x20a5('0x1d')]?_0xb3b747[_0x20a5('0x1d')][_0x20a5('0x1f')]||null:null,'attributes':_0xb3b747[_0x20a5('0x1d')]?_0xb3b747[_0x20a5('0x1d')][_0x20a5('0x24')]||null:null,'include':_0xb3b747[_0x20a5('0x1d')]?_0xb3b747['options'][_0x20a5('0x21')]?_[_0x20a5('0x22')](_0xb3b747['options'][_0x20a5('0x21')],function(_0x4d6330){return{'model':db[_0x4d6330[_0x20a5('0x23')]],'as':_0x4d6330['as'],'attributes':_0x4d6330[_0x20a5('0x24')],'include':_0x4d6330['include']?_[_0x20a5('0x22')](_0x4d6330[_0x20a5('0x21')],function(_0x488e49){return{'model':db[_0x488e49[_0x20a5('0x23')]],'as':_0x488e49['as'],'attributes':_0x488e49[_0x20a5('0x24')],'include':_0x488e49[_0x20a5('0x21')]?_[_0x20a5('0x22')](_0x488e49[_0x20a5('0x21')],function(_0x180a2f){return{'model':db[_0x180a2f[_0x20a5('0x23')]],'as':_0x180a2f['as'],'attributes':_0x180a2f[_0x20a5('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33ed34){logger['info']('ShowSmsQueue',_0xb3b747);logger[_0x20a5('0x14')](_0x20a5('0x28'),_0xb3b747,JSON[_0x20a5('0x16')](_0x33ed34));_0x40a0af(_0x33ed34);})[_0x20a5('0x26')](function(_0x5c2778){logger[_0x20a5('0x17')]('ShowSmsQueue',_0x5c2778[_0x20a5('0x19')],_0xb3b747);_0x38f178(_0x27bcf7[_0x20a5('0x17')](0x1f4,_0x5c2778[_0x20a5('0x19')]));});});}; \ No newline at end of file +var _0x5e08=['raw','where','attributes','map','include','model','then','catch','ShowSmsQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSmsQueue','SmsQueue','options'];(function(_0x5e327e,_0x224abf){var _0x326561=function(_0x43ca91){while(--_0x43ca91){_0x5e327e['push'](_0x5e327e['shift']());}};_0x326561(++_0x224abf);}(_0x5e08,0x1b7));var _0x85e0=function(_0x4b8391,_0x3fd914){_0x4b8391=_0x4b8391-0x0;var _0x59b22b=_0x5e08[_0x4b8391];return _0x59b22b;};'use strict';var _=require(_0x85e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x85e0('0x1'));var rs=require(_0x85e0('0x2'));var fs=require('fs');var Redis=require(_0x85e0('0x3'));var db=require(_0x85e0('0x4'))['db'];var utils=require(_0x85e0('0x5'));var logger=require(_0x85e0('0x6'))(_0x85e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x85e0('0x8'));var client=jayson['client'][_0x85e0('0x9')]({'port':0x232a});config['redis']=_[_0x85e0('0xa')](config[_0x85e0('0xb')],{'host':_0x85e0('0xc'),'port':0x18eb});var socket=require(_0x85e0('0xd'))(new Redis(config[_0x85e0('0xb')]));require('./smsQueue.socket')[_0x85e0('0xe')](socket);function respondWithRpcPromise(_0x854fe9,_0x4339e6,_0x31ad69){return new BPromise(function(_0x50c48d,_0x1402ce){return client[_0x85e0('0xf')](_0x854fe9,_0x31ad69)['then'](function(_0x48027e){logger[_0x85e0('0x10')](_0x85e0('0x11'),_0x4339e6,'request\x20sent');logger[_0x85e0('0x12')](_0x85e0('0x13'),_0x4339e6,_0x85e0('0x14'),JSON[_0x85e0('0x15')](_0x48027e));if(_0x48027e[_0x85e0('0x16')]){if(_0x48027e[_0x85e0('0x16')][_0x85e0('0x17')]===0x1f4){logger[_0x85e0('0x16')](_0x85e0('0x11'),_0x4339e6,_0x48027e[_0x85e0('0x16')][_0x85e0('0x18')]);return _0x1402ce(_0x48027e[_0x85e0('0x16')][_0x85e0('0x18')]);}logger[_0x85e0('0x16')](_0x85e0('0x11'),_0x4339e6,_0x48027e[_0x85e0('0x16')][_0x85e0('0x18')]);return _0x50c48d(_0x48027e[_0x85e0('0x16')]['message']);}else{logger[_0x85e0('0x10')](_0x85e0('0x11'),_0x4339e6,'request\x20sent');_0x50c48d(_0x48027e[_0x85e0('0x19')][_0x85e0('0x18')]);}})['catch'](function(_0x3487cb){logger[_0x85e0('0x16')](_0x85e0('0x11'),_0x4339e6,_0x3487cb);_0x1402ce(_0x3487cb);});});}exports[_0x85e0('0x1a')]=function(_0x2a737a){var _0x284319=this;return new Promise(function(_0x21a8ed,_0x5d834c){return db[_0x85e0('0x1b')]['findAll']({'raw':_0x2a737a[_0x85e0('0x1c')]?_0x2a737a['options'][_0x85e0('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a737a['options']?_0x2a737a[_0x85e0('0x1c')][_0x85e0('0x1e')]||null:null,'attributes':_0x2a737a[_0x85e0('0x1c')]?_0x2a737a[_0x85e0('0x1c')][_0x85e0('0x1f')]||null:null,'limit':_0x2a737a[_0x85e0('0x1c')]?_0x2a737a['options']['limit']||null:null,'include':_0x2a737a[_0x85e0('0x1c')]?_0x2a737a[_0x85e0('0x1c')]['include']?_[_0x85e0('0x20')](_0x2a737a[_0x85e0('0x1c')][_0x85e0('0x21')],function(_0x4ead87){return{'model':db[_0x4ead87[_0x85e0('0x22')]],'as':_0x4ead87['as'],'attributes':_0x4ead87[_0x85e0('0x1f')],'include':_0x4ead87['include']?_[_0x85e0('0x20')](_0x4ead87[_0x85e0('0x21')],function(_0x2edd64){return{'model':db[_0x2edd64[_0x85e0('0x22')]],'as':_0x2edd64['as'],'attributes':_0x2edd64[_0x85e0('0x1f')],'include':_0x2edd64[_0x85e0('0x21')]?_[_0x85e0('0x20')](_0x2edd64[_0x85e0('0x21')],function(_0x392ede){return{'model':db[_0x392ede['model']],'as':_0x392ede['as'],'attributes':_0x392ede[_0x85e0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x85e0('0x23')](function(_0x5a4626){logger['info'](_0x85e0('0x1a'),_0x2a737a);logger[_0x85e0('0x12')](_0x85e0('0x1a'),_0x2a737a,JSON[_0x85e0('0x15')](_0x5a4626));_0x21a8ed(_0x5a4626);})[_0x85e0('0x24')](function(_0x442889){logger[_0x85e0('0x16')]('GetSmsQueue',_0x442889[_0x85e0('0x18')],_0x2a737a);_0x5d834c(_0x284319['error'](0x1f4,_0x442889[_0x85e0('0x18')]));});});};exports[_0x85e0('0x25')]=function(_0xc72c61){var _0x316703=this;return new Promise(function(_0x2a4481,_0x3adb1f){return db[_0x85e0('0x1b')][_0x85e0('0x26')]({'raw':_0xc72c61[_0x85e0('0x1c')]?_0xc72c61['options']['raw']===undefined?!![]:![]:!![],'where':_0xc72c61[_0x85e0('0x1c')]?_0xc72c61['options'][_0x85e0('0x1e')]||null:null,'attributes':_0xc72c61['options']?_0xc72c61[_0x85e0('0x1c')][_0x85e0('0x1f')]||null:null,'include':_0xc72c61[_0x85e0('0x1c')]?_0xc72c61[_0x85e0('0x1c')][_0x85e0('0x21')]?_[_0x85e0('0x20')](_0xc72c61[_0x85e0('0x1c')]['include'],function(_0x20bc78){return{'model':db[_0x20bc78['model']],'as':_0x20bc78['as'],'attributes':_0x20bc78['attributes'],'include':_0x20bc78[_0x85e0('0x21')]?_[_0x85e0('0x20')](_0x20bc78['include'],function(_0x20a23f){return{'model':db[_0x20a23f['model']],'as':_0x20a23f['as'],'attributes':_0x20a23f['attributes'],'include':_0x20a23f[_0x85e0('0x21')]?_['map'](_0x20a23f[_0x85e0('0x21')],function(_0x412b93){return{'model':db[_0x412b93[_0x85e0('0x22')]],'as':_0x412b93['as'],'attributes':_0x412b93[_0x85e0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x85e0('0x23')](function(_0x5dd8e0){logger[_0x85e0('0x10')](_0x85e0('0x25'),_0xc72c61);logger['debug']('ShowSmsQueue',_0xc72c61,JSON[_0x85e0('0x15')](_0x5dd8e0));_0x2a4481(_0x5dd8e0);})[_0x85e0('0x24')](function(_0x2a99b0){logger[_0x85e0('0x16')]('ShowSmsQueue',_0x2a99b0[_0x85e0('0x18')],_0xc72c61);_0x3adb1f(_0x316703[_0x85e0('0x16')](0x1f4,_0x2a99b0[_0x85e0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f246816..e8dce4e 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 _0x1904=['save','remove','update','emit','removeListener','register','length','./smsQueue.events'];(function(_0x5445fe,_0x17a013){var _0x3e78ae=function(_0x4caa07){while(--_0x4caa07){_0x5445fe['push'](_0x5445fe['shift']());}};_0x3e78ae(++_0x17a013);}(_0x1904,0xa7));var _0x4190=function(_0x3f888d,_0x205212){_0x3f888d=_0x3f888d-0x0;var _0x2c4295=_0x1904[_0x3f888d];return _0x2c4295;};'use strict';var SmsQueueEvents=require(_0x4190('0x0'));var events=[_0x4190('0x1'),_0x4190('0x2'),_0x4190('0x3')];function createListener(_0x28e30c,_0x4b172e){return function(_0x41a565){_0x4b172e[_0x4190('0x4')](_0x28e30c,_0x41a565);};}function removeListener(_0x2b9cf0,_0x3f6ff8){return function(){SmsQueueEvents[_0x4190('0x5')](_0x2b9cf0,_0x3f6ff8);};}exports[_0x4190('0x6')]=function(_0x54f4b2){for(var _0x37f0e9=0x0,_0x4dedf5=events[_0x4190('0x7')];_0x37f0e9<_0x4dedf5;_0x37f0e9++){var _0xe429b7=events[_0x37f0e9];var _0x29e7b1=createListener('smsQueue:'+_0xe429b7,_0x54f4b2);SmsQueueEvents['on'](_0xe429b7,_0x29e7b1);}}; \ No newline at end of file +var _0xd68e=['./smsQueue.events','save','remove','removeListener','register','length','smsQueue:'];(function(_0x382bba,_0x552036){var _0x208ad7=function(_0x47fed8){while(--_0x47fed8){_0x382bba['push'](_0x382bba['shift']());}};_0x208ad7(++_0x552036);}(_0xd68e,0xbd));var _0xed68=function(_0x302d1a,_0x387081){_0x302d1a=_0x302d1a-0x0;var _0xd82ca=_0xd68e[_0x302d1a];return _0xd82ca;};'use strict';var SmsQueueEvents=require(_0xed68('0x0'));var events=[_0xed68('0x1'),_0xed68('0x2'),'update'];function createListener(_0x41d61c,_0x4d1e93){return function(_0x4caaec){_0x4d1e93['emit'](_0x41d61c,_0x4caaec);};}function removeListener(_0x2caea7,_0x18e79a){return function(){SmsQueueEvents[_0xed68('0x3')](_0x2caea7,_0x18e79a);};}exports[_0xed68('0x4')]=function(_0x41b336){for(var _0x1c08fb=0x0,_0x5c8e5c=events[_0xed68('0x5')];_0x1c08fb<_0x5c8e5c;_0x1c08fb++){var _0x4c981b=events[_0x1c08fb];var _0x4191e5=createListener(_0xed68('0x6')+_0x4c981b,_0x41b336);SmsQueueEvents['on'](_0x4c981b,_0x4191e5);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 820df42..47dace9 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 _0x04b6=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','update'];(function(_0x1e2324,_0x300764){var _0x214aea=function(_0x2367b4){while(--_0x2367b4){_0x1e2324['push'](_0x1e2324['shift']());}};_0x214aea(++_0x300764);}(_0x04b6,0x1e0));var _0x604b=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0x04b6[_0x53c256];return _0x25feb6;};'use strict';var multer=require(_0x604b('0x0'));var util=require('util');var path=require(_0x604b('0x1'));var timeout=require(_0x604b('0x2'));var express=require(_0x604b('0x3'));var router=express[_0x604b('0x4')]();var fs_extra=require(_0x604b('0x5'));var auth=require(_0x604b('0x6'));var interaction=require(_0x604b('0x7'));var config=require(_0x604b('0x8'));var controller=require(_0x604b('0x9'));router[_0x604b('0xa')]('/',auth['isAuthenticated'](),controller[_0x604b('0xb')]);router[_0x604b('0xa')](_0x604b('0xc'),auth['isAuthenticated'](),controller[_0x604b('0xd')]);router[_0x604b('0xa')](_0x604b('0xe'),auth[_0x604b('0xf')](),controller[_0x604b('0x10')]);router[_0x604b('0x11')]('/',auth[_0x604b('0xf')](),controller[_0x604b('0x12')]);router['put'](_0x604b('0xe'),auth[_0x604b('0xf')](),controller[_0x604b('0x13')]);router['delete'](_0x604b('0xe'),auth[_0x604b('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x70e9=['update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0xa74a46,_0x5ef8fb){var _0x59d35a=function(_0xc9fc0b){while(--_0xc9fc0b){_0xa74a46['push'](_0xa74a46['shift']());}};_0x59d35a(++_0x5ef8fb);}(_0x70e9,0x193));var _0x970e=function(_0x38cbf0,_0xb8c7a1){_0x38cbf0=_0x38cbf0-0x0;var _0xdea2da=_0x70e9[_0x38cbf0];return _0xdea2da;};'use strict';var multer=require('multer');var util=require(_0x970e('0x0'));var path=require(_0x970e('0x1'));var timeout=require('connect-timeout');var express=require(_0x970e('0x2'));var router=express[_0x970e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x970e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x970e('0x5'));var controller=require(_0x970e('0x6'));router[_0x970e('0x7')]('/',auth[_0x970e('0x8')](),controller[_0x970e('0x9')]);router[_0x970e('0x7')](_0x970e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x970e('0x7')](_0x970e('0xb'),auth['isAuthenticated'](),controller[_0x970e('0xc')]);router[_0x970e('0xd')]('/',auth[_0x970e('0x8')](),controller['create']);router[_0x970e('0xe')](_0x970e('0xb'),auth[_0x970e('0x8')](),controller[_0x970e('0xf')]);router[_0x970e('0x10')](_0x970e('0xb'),auth['isAuthenticated'](),controller[_0x970e('0x11')]);module[_0x970e('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 d5ee0f6..5037dda 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 _0xeecc=['DATE','moment','sequelize','exports','STRING'];(function(_0x3a030e,_0x2621aa){var _0x572255=function(_0x5e23cf){while(--_0x5e23cf){_0x3a030e['push'](_0x3a030e['shift']());}};_0x572255(++_0x2621aa);}(_0xeecc,0x12d));var _0xceec=function(_0x33799f,_0x40daf6){_0x33799f=_0x33799f-0x0;var _0x5ab434=_0xeecc[_0x33799f];return _0x5ab434;};'use strict';var moment=require(_0xceec('0x0'));var Sequelize=require(_0xceec('0x1'));module[_0xceec('0x2')]={'uniqueid':{'type':Sequelize[_0xceec('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xceec('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xceec('0x3')]}}; \ No newline at end of file +var _0x21dc=['exports','STRING','DATE','moment','sequelize'];(function(_0x104e46,_0x6d095f){var _0x6e8232=function(_0xa5dce6){while(--_0xa5dce6){_0x104e46['push'](_0x104e46['shift']());}};_0x6e8232(++_0x6d095f);}(_0x21dc,0x170));var _0xc21d=function(_0x4618d7,_0x2883f4){_0x4618d7=_0x4618d7-0x0;var _0x46feee=_0x21dc[_0x4618d7];return _0x46feee;};'use strict';var moment=require(_0xc21d('0x0'));var Sequelize=require(_0xc21d('0x1'));module[_0xc21d('0x2')]={'uniqueid':{'type':Sequelize[_0xc21d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc21d('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc21d('0x4')]},'acceptAt':{'type':Sequelize[_0xc21d('0x4')]},'exitAt':{'type':Sequelize['DATE']},'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 e48b023..d48d6c2 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 _0xf928=['model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','catch','rawAttributes','intersection','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','SmsQueueReport','fieldName','type'];(function(_0x7325f3,_0x4c8836){var _0x4f5b5c=function(_0x265b3b){while(--_0x265b3b){_0x7325f3['push'](_0x7325f3['shift']());}};_0x4f5b5c(++_0x4c8836);}(_0xf928,0x14e));var _0x8f92=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf928[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f92('0x0'));var zipdir=require(_0x8f92('0x1'));var jsonpatch=require(_0x8f92('0x2'));var rp=require(_0x8f92('0x3'));var moment=require(_0x8f92('0x4'));var BPromise=require(_0x8f92('0x5'));var Mustache=require(_0x8f92('0x6'));var util=require(_0x8f92('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8f92('0x8'));var ejs=require(_0x8f92('0x9'));var fs=require('fs');var fs_extra=require(_0x8f92('0xa'));var _=require(_0x8f92('0xb'));var squel=require(_0x8f92('0xc'));var crypto=require(_0x8f92('0xd'));var jsforce=require(_0x8f92('0xe'));var deskjs=require(_0x8f92('0xf'));var toCsv=require(_0x8f92('0x8'));var querystring=require(_0x8f92('0x10'));var Papa=require(_0x8f92('0x11'));var Redis=require(_0x8f92('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8f92('0x13'));var as=require(_0x8f92('0x14'));var hardwareService=require(_0x8f92('0x15'));var logger=require(_0x8f92('0x16'))(_0x8f92('0x17'));var utils=require(_0x8f92('0x18'));var config=require(_0x8f92('0x19'));var licenseUtil=require(_0x8f92('0x1a'));var db=require(_0x8f92('0x1b'))['db'];function respondWithStatusCode(_0x47ca99,_0x50ed83){_0x50ed83=_0x50ed83||0xcc;return function(_0x2f4e12){if(_0x2f4e12){return _0x47ca99[_0x8f92('0x1c')](_0x50ed83);}return _0x47ca99[_0x8f92('0x1d')](_0x50ed83)[_0x8f92('0x1e')]();};}function respondWithResult(_0x2cb4ae,_0x9347d6){_0x9347d6=_0x9347d6||0xc8;return function(_0x47b1fe){if(_0x47b1fe){return _0x2cb4ae['status'](_0x9347d6)[_0x8f92('0x1f')](_0x47b1fe);}};}function respondWithFilteredResult(_0x1477d3,_0x1373ff){return function(_0xf7e788){if(_0xf7e788){var _0xf32fa0=typeof _0x1373ff[_0x8f92('0x20')]===_0x8f92('0x21')&&typeof _0x1373ff[_0x8f92('0x22')]===_0x8f92('0x21');var _0x307609=_0xf7e788[_0x8f92('0x23')];var _0x5c4e76=_0xf32fa0?0x0:_0x1373ff[_0x8f92('0x20')];var _0x30f7d3=_0xf32fa0?_0xf7e788[_0x8f92('0x23')]:_0x1373ff['offset']+_0x1373ff[_0x8f92('0x22')];var _0x1ccc1c;if(_0x30f7d3>=_0x307609){_0x30f7d3=_0x307609;_0x1ccc1c=0xc8;}else{_0x1ccc1c=0xce;}_0x1477d3[_0x8f92('0x1d')](_0x1ccc1c);return _0x1477d3[_0x8f92('0x24')](_0x8f92('0x25'),_0x5c4e76+'-'+_0x30f7d3+'/'+_0x307609)[_0x8f92('0x1f')](_0xf7e788);}return null;};}function patchUpdates(_0xef5652){return function(_0x2215f2){try{jsonpatch[_0x8f92('0x26')](_0x2215f2,_0xef5652,!![]);}catch(_0x426364){return BPromise[_0x8f92('0x27')](_0x426364);}return _0x2215f2[_0x8f92('0x28')]();};}function saveUpdates(_0x2b250d,_0x49560d){return function(_0x4531ec){if(_0x4531ec){return _0x4531ec[_0x8f92('0x29')](_0x2b250d)[_0x8f92('0x2a')](function(_0x24e895){return _0x24e895;});}return null;};}function removeEntity(_0x3f0460,_0xba703d){return function(_0x21b8d4){if(_0x21b8d4){return _0x21b8d4[_0x8f92('0x2b')]()[_0x8f92('0x2a')](function(){_0x3f0460['status'](0xcc)[_0x8f92('0x1e')]();});}};}function handleEntityNotFound(_0x29b307,_0x5c3b22){return function(_0x9f7b08){if(!_0x9f7b08){_0x29b307[_0x8f92('0x1c')](0x194);}return _0x9f7b08;};}function handleError(_0xd0b069,_0x30d157){_0x30d157=_0x30d157||0x1f4;return function(_0x234281){logger['error'](_0x234281[_0x8f92('0x2c')]);if(_0x234281[_0x8f92('0x2d')]){delete _0x234281[_0x8f92('0x2d')];}_0xd0b069[_0x8f92('0x1d')](_0x30d157)['send'](_0x234281);};}exports[_0x8f92('0x2e')]=function(_0x1aed7b,_0x4bdbd1){var _0x14c7ce={},_0x4e180d={},_0x58c875={'count':0x0,'rows':[]};var _0x4b4c23=_[_0x8f92('0x2f')](db[_0x8f92('0x30')]['rawAttributes'],function(_0x268890){return{'name':_0x268890[_0x8f92('0x31')],'type':_0x268890[_0x8f92('0x32')]['key']};});_0x4e180d[_0x8f92('0x33')]=_[_0x8f92('0x2f')](_0x4b4c23,_0x8f92('0x2d'));_0x4e180d[_0x8f92('0x34')]=_[_0x8f92('0x35')](_0x1aed7b[_0x8f92('0x34')]);_0x4e180d[_0x8f92('0x36')]=_['intersection'](_0x4e180d[_0x8f92('0x33')],_0x4e180d['query']);_0x14c7ce[_0x8f92('0x37')]=_['intersection'](_0x4e180d['model'],qs[_0x8f92('0x38')](_0x1aed7b[_0x8f92('0x34')]['fields']));_0x14c7ce[_0x8f92('0x37')]=_0x14c7ce[_0x8f92('0x37')][_0x8f92('0x39')]?_0x14c7ce['attributes']:_0x4e180d[_0x8f92('0x33')];if(!_0x1aed7b[_0x8f92('0x34')][_0x8f92('0x3a')](_0x8f92('0x3b'))){_0x14c7ce['limit']=qs[_0x8f92('0x22')](_0x1aed7b[_0x8f92('0x34')][_0x8f92('0x22')]);_0x14c7ce[_0x8f92('0x20')]=qs['offset'](_0x1aed7b['query'][_0x8f92('0x20')]);}_0x14c7ce[_0x8f92('0x3c')]=qs[_0x8f92('0x3d')](_0x1aed7b[_0x8f92('0x34')][_0x8f92('0x3d')]);_0x14c7ce[_0x8f92('0x3e')]=qs[_0x8f92('0x36')](_[_0x8f92('0x3f')](_0x1aed7b[_0x8f92('0x34')],_0x4e180d['filters']),_0x4b4c23);if(_0x1aed7b['query']['filter']){_0x14c7ce['where']=_[_0x8f92('0x40')](_0x14c7ce[_0x8f92('0x3e')],{'$or':_[_0x8f92('0x2f')](_0x4b4c23,function(_0x1cda3b){if(_0x1cda3b['type']!==_0x8f92('0x41')){var _0x489e4e={};_0x489e4e[_0x1cda3b['name']]={'$like':'%'+_0x1aed7b[_0x8f92('0x34')][_0x8f92('0x42')]+'%'};return _0x489e4e;}})});}_0x14c7ce=_[_0x8f92('0x40')]({},_0x14c7ce,_0x1aed7b['options']);var _0x30a749={'where':_0x14c7ce[_0x8f92('0x3e')]};return db['SmsQueueReport'][_0x8f92('0x23')](_0x30a749)['then'](function(_0x5557fb){_0x58c875[_0x8f92('0x23')]=_0x5557fb;if(_0x1aed7b[_0x8f92('0x34')][_0x8f92('0x43')]){_0x14c7ce['include']=[{'all':!![]}];}return db[_0x8f92('0x30')]['findAll'](_0x14c7ce);})['then'](function(_0x36cd44){_0x58c875[_0x8f92('0x44')]=_0x36cd44;return _0x58c875;})[_0x8f92('0x2a')](respondWithFilteredResult(_0x4bdbd1,_0x14c7ce))[_0x8f92('0x45')](handleError(_0x4bdbd1,null));};exports['show']=function(_0x3b2830,_0x4c8549){var _0x1447ac={'raw':!![],'where':{'id':_0x3b2830['params']['id']}},_0x5e8d3f={};_0x5e8d3f[_0x8f92('0x33')]=_[_0x8f92('0x35')](db['SmsQueueReport'][_0x8f92('0x46')]);_0x5e8d3f[_0x8f92('0x34')]=_['keys'](_0x3b2830[_0x8f92('0x34')]);_0x5e8d3f[_0x8f92('0x36')]=_[_0x8f92('0x47')](_0x5e8d3f[_0x8f92('0x33')],_0x5e8d3f['query']);_0x1447ac[_0x8f92('0x37')]=_[_0x8f92('0x47')](_0x5e8d3f[_0x8f92('0x33')],qs[_0x8f92('0x38')](_0x3b2830[_0x8f92('0x34')][_0x8f92('0x38')]));_0x1447ac[_0x8f92('0x37')]=_0x1447ac[_0x8f92('0x37')][_0x8f92('0x39')]?_0x1447ac['attributes']:_0x5e8d3f[_0x8f92('0x33')];if(_0x3b2830[_0x8f92('0x34')]['includeAll']){_0x1447ac['include']=[{'all':!![]}];}_0x1447ac=_['merge']({},_0x1447ac,_0x3b2830['options']);return db[_0x8f92('0x30')][_0x8f92('0x48')](_0x1447ac)[_0x8f92('0x2a')](handleEntityNotFound(_0x4c8549,null))[_0x8f92('0x2a')](respondWithResult(_0x4c8549,null))[_0x8f92('0x45')](handleError(_0x4c8549,null));};exports['create']=function(_0x2e884c,_0x5b56ec){return db['SmsQueueReport'][_0x8f92('0x49')](_0x2e884c[_0x8f92('0x4a')],{})[_0x8f92('0x2a')](respondWithResult(_0x5b56ec,0xc9))[_0x8f92('0x45')](handleError(_0x5b56ec,null));};exports[_0x8f92('0x29')]=function(_0x4aa3a0,_0x25608e){if(_0x4aa3a0[_0x8f92('0x4a')]['id']){delete _0x4aa3a0[_0x8f92('0x4a')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x4aa3a0['params']['id']}})['then'](handleEntityNotFound(_0x25608e,null))[_0x8f92('0x2a')](saveUpdates(_0x4aa3a0[_0x8f92('0x4a')],null))[_0x8f92('0x2a')](respondWithResult(_0x25608e,null))[_0x8f92('0x45')](handleError(_0x25608e,null));};exports[_0x8f92('0x2b')]=function(_0x55d90e,_0x1c43a3){return db[_0x8f92('0x30')][_0x8f92('0x48')]({'where':{'id':_0x55d90e[_0x8f92('0x4b')]['id']}})[_0x8f92('0x2a')](handleEntityNotFound(_0x1c43a3,null))['then'](removeEntity(_0x1c43a3,null))['catch'](handleError(_0x1c43a3,null));};exports[_0x8f92('0x4c')]=function(_0x2f3306,_0x5d6508){return db[_0x8f92('0x30')][_0x8f92('0x4c')]()[_0x8f92('0x2a')](respondWithResult(_0x5d6508,null))[_0x8f92('0x45')](handleError(_0x5d6508,null));}; \ No newline at end of file +var _0x934c=['save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x5dcfec,_0x20eb1a){var _0x1e18f5=function(_0x40e7f7){while(--_0x40e7f7){_0x5dcfec['push'](_0x5dcfec['shift']());}};_0x1e18f5(++_0x20eb1a);}(_0x934c,0x159));var _0xc934=function(_0x5c2c2d,_0x36484b){_0x5c2c2d=_0x5c2c2d-0x0;var _0x480f9c=_0x934c[_0x5c2c2d];return _0x480f9c;};'use strict';var emlformat=require(_0xc934('0x0'));var rimraf=require(_0xc934('0x1'));var zipdir=require(_0xc934('0x2'));var jsonpatch=require(_0xc934('0x3'));var rp=require(_0xc934('0x4'));var moment=require(_0xc934('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc934('0x6'));var util=require(_0xc934('0x7'));var path=require('path');var sox=require(_0xc934('0x8'));var csv=require(_0xc934('0x9'));var ejs=require(_0xc934('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc934('0xb'));var crypto=require(_0xc934('0xc'));var jsforce=require(_0xc934('0xd'));var deskjs=require(_0xc934('0xe'));var toCsv=require(_0xc934('0x9'));var querystring=require('querystring');var Papa=require(_0xc934('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc934('0x10'));var hardwareService=require(_0xc934('0x11'));var logger=require('../../config/logger')(_0xc934('0x12'));var utils=require(_0xc934('0x13'));var config=require(_0xc934('0x14'));var licenseUtil=require(_0xc934('0x15'));var db=require(_0xc934('0x16'))['db'];function respondWithStatusCode(_0x53a9fc,_0x297e2c){_0x297e2c=_0x297e2c||0xcc;return function(_0x1b3db6){if(_0x1b3db6){return _0x53a9fc[_0xc934('0x17')](_0x297e2c);}return _0x53a9fc[_0xc934('0x18')](_0x297e2c)[_0xc934('0x19')]();};}function respondWithResult(_0x359287,_0x3d0c67){_0x3d0c67=_0x3d0c67||0xc8;return function(_0x2d5e9f){if(_0x2d5e9f){return _0x359287['status'](_0x3d0c67)[_0xc934('0x1a')](_0x2d5e9f);}};}function respondWithFilteredResult(_0x485434,_0x5b053e){return function(_0x4a69f6){if(_0x4a69f6){var _0x3f4c42=typeof _0x5b053e[_0xc934('0x1b')]===_0xc934('0x1c')&&typeof _0x5b053e[_0xc934('0x1d')]==='undefined';var _0x430564=_0x4a69f6[_0xc934('0x1e')];var _0x336946=_0x3f4c42?0x0:_0x5b053e[_0xc934('0x1b')];var _0x4486c4=_0x3f4c42?_0x4a69f6[_0xc934('0x1e')]:_0x5b053e[_0xc934('0x1b')]+_0x5b053e[_0xc934('0x1d')];var _0x458263;if(_0x4486c4>=_0x430564){_0x4486c4=_0x430564;_0x458263=0xc8;}else{_0x458263=0xce;}_0x485434['status'](_0x458263);return _0x485434[_0xc934('0x1f')](_0xc934('0x20'),_0x336946+'-'+_0x4486c4+'/'+_0x430564)[_0xc934('0x1a')](_0x4a69f6);}return null;};}function patchUpdates(_0x2782b1){return function(_0x5a2d61){try{jsonpatch[_0xc934('0x21')](_0x5a2d61,_0x2782b1,!![]);}catch(_0x4fa29c){return BPromise[_0xc934('0x22')](_0x4fa29c);}return _0x5a2d61[_0xc934('0x23')]();};}function saveUpdates(_0xbd6fd9,_0x2a4e2f){return function(_0x472e4e){if(_0x472e4e){return _0x472e4e[_0xc934('0x24')](_0xbd6fd9)[_0xc934('0x25')](function(_0x1b9422){return _0x1b9422;});}return null;};}function removeEntity(_0xe5a25b,_0x2a559e){return function(_0x14522f){if(_0x14522f){return _0x14522f[_0xc934('0x26')]()[_0xc934('0x25')](function(){_0xe5a25b[_0xc934('0x18')](0xcc)[_0xc934('0x19')]();});}};}function handleEntityNotFound(_0x45fb00,_0x2c683f){return function(_0x51ed54){if(!_0x51ed54){_0x45fb00['sendStatus'](0x194);}return _0x51ed54;};}function handleError(_0x1e685,_0x1d14fa){_0x1d14fa=_0x1d14fa||0x1f4;return function(_0x53dc6e){logger[_0xc934('0x27')](_0x53dc6e[_0xc934('0x28')]);if(_0x53dc6e[_0xc934('0x29')]){delete _0x53dc6e[_0xc934('0x29')];}_0x1e685[_0xc934('0x18')](_0x1d14fa)[_0xc934('0x2a')](_0x53dc6e);};}exports[_0xc934('0x2b')]=function(_0x21e235,_0x28a642){var _0xd6d494={},_0x46388d={},_0x3d6ab5={'count':0x0,'rows':[]};var _0x1e3e57=_[_0xc934('0x2c')](db[_0xc934('0x2d')][_0xc934('0x2e')],function(_0x3e760f){return{'name':_0x3e760f[_0xc934('0x2f')],'type':_0x3e760f['type'][_0xc934('0x30')]};});_0x46388d[_0xc934('0x31')]=_[_0xc934('0x2c')](_0x1e3e57,'name');_0x46388d[_0xc934('0x32')]=_['keys'](_0x21e235['query']);_0x46388d[_0xc934('0x33')]=_[_0xc934('0x34')](_0x46388d['model'],_0x46388d[_0xc934('0x32')]);_0xd6d494[_0xc934('0x35')]=_[_0xc934('0x34')](_0x46388d[_0xc934('0x31')],qs[_0xc934('0x36')](_0x21e235['query'][_0xc934('0x36')]));_0xd6d494[_0xc934('0x35')]=_0xd6d494[_0xc934('0x35')]['length']?_0xd6d494[_0xc934('0x35')]:_0x46388d[_0xc934('0x31')];if(!_0x21e235['query'][_0xc934('0x37')](_0xc934('0x38'))){_0xd6d494['limit']=qs[_0xc934('0x1d')](_0x21e235[_0xc934('0x32')]['limit']);_0xd6d494[_0xc934('0x1b')]=qs['offset'](_0x21e235[_0xc934('0x32')][_0xc934('0x1b')]);}_0xd6d494['order']=qs['sort'](_0x21e235[_0xc934('0x32')][_0xc934('0x39')]);_0xd6d494[_0xc934('0x3a')]=qs[_0xc934('0x33')](_['pick'](_0x21e235[_0xc934('0x32')],_0x46388d[_0xc934('0x33')]),_0x1e3e57);if(_0x21e235[_0xc934('0x32')][_0xc934('0x3b')]){_0xd6d494[_0xc934('0x3a')]=_[_0xc934('0x3c')](_0xd6d494[_0xc934('0x3a')],{'$or':_[_0xc934('0x2c')](_0x1e3e57,function(_0x5e92b0){if(_0x5e92b0[_0xc934('0x3d')]!==_0xc934('0x3e')){var _0xf4ff67={};_0xf4ff67[_0x5e92b0[_0xc934('0x29')]]={'$like':'%'+_0x21e235[_0xc934('0x32')][_0xc934('0x3b')]+'%'};return _0xf4ff67;}})});}_0xd6d494=_[_0xc934('0x3c')]({},_0xd6d494,_0x21e235[_0xc934('0x3f')]);var _0x53bd58={'where':_0xd6d494[_0xc934('0x3a')]};return db[_0xc934('0x2d')][_0xc934('0x1e')](_0x53bd58)[_0xc934('0x25')](function(_0x357c95){_0x3d6ab5['count']=_0x357c95;if(_0x21e235[_0xc934('0x32')][_0xc934('0x40')]){_0xd6d494[_0xc934('0x41')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0xd6d494);})[_0xc934('0x25')](function(_0x7cba90){_0x3d6ab5[_0xc934('0x42')]=_0x7cba90;return _0x3d6ab5;})[_0xc934('0x25')](respondWithFilteredResult(_0x28a642,_0xd6d494))[_0xc934('0x43')](handleError(_0x28a642,null));};exports[_0xc934('0x44')]=function(_0x360f9a,_0x1bec76){var _0x36522b={'raw':!![],'where':{'id':_0x360f9a[_0xc934('0x45')]['id']}},_0x2e03e2={};_0x2e03e2[_0xc934('0x31')]=_[_0xc934('0x46')](db[_0xc934('0x2d')]['rawAttributes']);_0x2e03e2[_0xc934('0x32')]=_[_0xc934('0x46')](_0x360f9a[_0xc934('0x32')]);_0x2e03e2['filters']=_['intersection'](_0x2e03e2[_0xc934('0x31')],_0x2e03e2[_0xc934('0x32')]);_0x36522b[_0xc934('0x35')]=_[_0xc934('0x34')](_0x2e03e2[_0xc934('0x31')],qs[_0xc934('0x36')](_0x360f9a[_0xc934('0x32')][_0xc934('0x36')]));_0x36522b[_0xc934('0x35')]=_0x36522b[_0xc934('0x35')][_0xc934('0x47')]?_0x36522b[_0xc934('0x35')]:_0x2e03e2[_0xc934('0x31')];if(_0x360f9a['query'][_0xc934('0x40')]){_0x36522b[_0xc934('0x41')]=[{'all':!![]}];}_0x36522b=_[_0xc934('0x3c')]({},_0x36522b,_0x360f9a['options']);return db[_0xc934('0x2d')][_0xc934('0x48')](_0x36522b)[_0xc934('0x25')](handleEntityNotFound(_0x1bec76,null))[_0xc934('0x25')](respondWithResult(_0x1bec76,null))[_0xc934('0x43')](handleError(_0x1bec76,null));};exports[_0xc934('0x49')]=function(_0x41e11e,_0x4664c0){return db[_0xc934('0x2d')]['create'](_0x41e11e[_0xc934('0x4a')],{})['then'](respondWithResult(_0x4664c0,0xc9))[_0xc934('0x43')](handleError(_0x4664c0,null));};exports[_0xc934('0x24')]=function(_0x18529a,_0x1677d1){if(_0x18529a['body']['id']){delete _0x18529a['body']['id'];}return db[_0xc934('0x2d')][_0xc934('0x48')]({'where':{'id':_0x18529a[_0xc934('0x45')]['id']}})[_0xc934('0x25')](handleEntityNotFound(_0x1677d1,null))[_0xc934('0x25')](saveUpdates(_0x18529a[_0xc934('0x4a')],null))[_0xc934('0x25')](respondWithResult(_0x1677d1,null))[_0xc934('0x43')](handleError(_0x1677d1,null));};exports[_0xc934('0x26')]=function(_0x2a3676,_0x48292c){return db['SmsQueueReport'][_0xc934('0x48')]({'where':{'id':_0x2a3676[_0xc934('0x45')]['id']}})[_0xc934('0x25')](handleEntityNotFound(_0x48292c,null))[_0xc934('0x25')](removeEntity(_0x48292c,null))[_0xc934('0x43')](handleError(_0x48292c,null));};exports['describe']=function(_0x5077fe,_0x30903c){return db[_0xc934('0x2d')][_0xc934('0x4b')]()['then'](respondWithResult(_0x30903c,null))[_0xc934('0x43')](handleError(_0x30903c,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1cc71f4..7073f23 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14f69a,_0x13a0c9){var _0x2bbe09=function(_0x360963){while(--_0x360963){_0x14f69a['push'](_0x14f69a['shift']());}};_0x2bbe09(++_0x13a0c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x45146c,_0x300d6b){var _0x5d184b=function(_0x2fcbd5){while(--_0x2fcbd5){_0x45146c['push'](_0x45146c['shift']());}};_0x5d184b(++_0x300d6b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'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 diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 3c90660..0728229 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 _0x9346=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','SmsQueueReport','create','options','raw','CreateSmsQueueReport','update','body','where','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird'];(function(_0x66808a,_0x60f3bd){var _0x760006=function(_0x520c41){while(--_0x520c41){_0x66808a['push'](_0x66808a['shift']());}};_0x760006(++_0x60f3bd);}(_0x9346,0x85));var _0x6934=function(_0x9785e8,_0x3615b4){_0x9785e8=_0x9785e8-0x0;var _0x2007ec=_0x9346[_0x9785e8];return _0x2007ec;};'use strict';var _=require('lodash');var util=require(_0x6934('0x0'));var moment=require(_0x6934('0x1'));var BPromise=require(_0x6934('0x2'));var rs=require(_0x6934('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6934('0x4'))['db'];var utils=require(_0x6934('0x5'));var logger=require(_0x6934('0x6'))('rpc');var config=require(_0x6934('0x7'));var jayson=require(_0x6934('0x8'));var client=jayson[_0x6934('0x9')][_0x6934('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42fe74,_0x1c1add,_0x1851d6){return new BPromise(function(_0x316b69,_0x231d7e){return client[_0x6934('0xb')](_0x42fe74,_0x1851d6)[_0x6934('0xc')](function(_0x149977){logger[_0x6934('0xd')](_0x6934('0xe'),_0x1c1add,'request\x20sent');logger[_0x6934('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1c1add,'request\x20sent',JSON[_0x6934('0x10')](_0x149977));if(_0x149977[_0x6934('0x11')]){if(_0x149977[_0x6934('0x11')][_0x6934('0x12')]===0x1f4){logger[_0x6934('0x11')](_0x6934('0xe'),_0x1c1add,_0x149977['error'][_0x6934('0x13')]);return _0x231d7e(_0x149977[_0x6934('0x11')][_0x6934('0x13')]);}logger['error'](_0x6934('0xe'),_0x1c1add,_0x149977[_0x6934('0x11')]['message']);return _0x316b69(_0x149977[_0x6934('0x11')][_0x6934('0x13')]);}else{logger['info'](_0x6934('0xe'),_0x1c1add,_0x6934('0x14'));_0x316b69(_0x149977[_0x6934('0x15')][_0x6934('0x13')]);}})[_0x6934('0x16')](function(_0x575e22){logger['error'](_0x6934('0xe'),_0x1c1add,_0x575e22);_0x231d7e(_0x575e22);});});}exports['CreateSmsQueueReport']=function(_0x25efd3){var _0x326fd2=this;return new Promise(function(_0x5924c3,_0x185c82){return db[_0x6934('0x17')][_0x6934('0x18')](_0x25efd3['body'],{'raw':_0x25efd3[_0x6934('0x19')]?_0x25efd3[_0x6934('0x19')][_0x6934('0x1a')]===undefined?!![]:![]:!![]})[_0x6934('0xc')](function(_0x5b15ed){logger[_0x6934('0xd')](_0x6934('0x1b'),_0x25efd3);logger[_0x6934('0xf')]('CreateSmsQueueReport',_0x25efd3,JSON[_0x6934('0x10')](_0x5b15ed));_0x5924c3(_0x5b15ed);})[_0x6934('0x16')](function(_0x1c5685){logger['error'](_0x6934('0x1b'),_0x1c5685[_0x6934('0x13')],_0x25efd3);_0x185c82(_0x326fd2[_0x6934('0x11')](0x1f4,_0x1c5685['message']));});});};exports['UpdateSmsQueueReport']=function(_0x4faf55){var _0x1e3b3b=this;return new Promise(function(_0x546112,_0xaeb546){return db['SmsQueueReport'][_0x6934('0x1c')](_0x4faf55[_0x6934('0x1d')],{'raw':_0x4faf55[_0x6934('0x19')]?_0x4faf55[_0x6934('0x19')][_0x6934('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4faf55[_0x6934('0x19')]?_0x4faf55['options'][_0x6934('0x1e')]||null:null,'attributes':_0x4faf55['options']?_0x4faf55[_0x6934('0x19')][_0x6934('0x1f')]||null:null,'limit':_0x4faf55[_0x6934('0x19')]?_0x4faf55['options'][_0x6934('0x20')]||null:null})[_0x6934('0xc')](function(_0x2d8fe2){logger['info'](_0x6934('0x21'),_0x4faf55);logger[_0x6934('0xf')](_0x6934('0x21'),_0x4faf55,JSON[_0x6934('0x10')](_0x2d8fe2));_0x546112(_0x2d8fe2);})['catch'](function(_0x3f04f3){logger[_0x6934('0x11')]('UpdateSmsQueueReport',_0x3f04f3[_0x6934('0x13')],_0x4faf55);_0xaeb546(_0x1e3b3b[_0x6934('0x11')](0x1f4,_0x3f04f3[_0x6934('0x13')]));});});}; \ No newline at end of file +var _0x7d50=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','SmsQueueReport','body','options','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x422179,_0x5d5485){var _0x3119c7=function(_0x36deaf){while(--_0x36deaf){_0x422179['push'](_0x422179['shift']());}};_0x3119c7(++_0x5d5485);}(_0x7d50,0x138));var _0x07d5=function(_0x403bba,_0x4795cd){_0x403bba=_0x403bba-0x0;var _0x305d88=_0x7d50[_0x403bba];return _0x305d88;};'use strict';var _=require(_0x07d5('0x0'));var util=require(_0x07d5('0x1'));var moment=require(_0x07d5('0x2'));var BPromise=require(_0x07d5('0x3'));var rs=require(_0x07d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x07d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x07d5('0x6'))(_0x07d5('0x7'));var config=require(_0x07d5('0x8'));var jayson=require(_0x07d5('0x9'));var client=jayson[_0x07d5('0xa')][_0x07d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1414a3,_0x46c0e3,_0x5a9fa1){return new BPromise(function(_0x481364,_0x54c7dd){return client[_0x07d5('0xc')](_0x1414a3,_0x5a9fa1)[_0x07d5('0xd')](function(_0x5413c6){logger[_0x07d5('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x46c0e3,_0x07d5('0xf'));logger[_0x07d5('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x46c0e3,_0x07d5('0xf'),JSON[_0x07d5('0x11')](_0x5413c6));if(_0x5413c6[_0x07d5('0x12')]){if(_0x5413c6['error'][_0x07d5('0x13')]===0x1f4){logger['error'](_0x07d5('0x14'),_0x46c0e3,_0x5413c6[_0x07d5('0x12')][_0x07d5('0x15')]);return _0x54c7dd(_0x5413c6[_0x07d5('0x12')][_0x07d5('0x15')]);}logger[_0x07d5('0x12')](_0x07d5('0x14'),_0x46c0e3,_0x5413c6['error'][_0x07d5('0x15')]);return _0x481364(_0x5413c6[_0x07d5('0x12')]['message']);}else{logger[_0x07d5('0xe')](_0x07d5('0x14'),_0x46c0e3,_0x07d5('0xf'));_0x481364(_0x5413c6['result'][_0x07d5('0x15')]);}})[_0x07d5('0x16')](function(_0x2519a9){logger[_0x07d5('0x12')](_0x07d5('0x14'),_0x46c0e3,_0x2519a9);_0x54c7dd(_0x2519a9);});});}exports[_0x07d5('0x17')]=function(_0x40604a){var _0x5230d3=this;return new Promise(function(_0x504835,_0x3755c8){return db[_0x07d5('0x18')]['create'](_0x40604a[_0x07d5('0x19')],{'raw':_0x40604a[_0x07d5('0x1a')]?_0x40604a['options']['raw']===undefined?!![]:![]:!![]})[_0x07d5('0xd')](function(_0x1f25fe){logger[_0x07d5('0xe')](_0x07d5('0x17'),_0x40604a);logger[_0x07d5('0x10')](_0x07d5('0x17'),_0x40604a,JSON[_0x07d5('0x11')](_0x1f25fe));_0x504835(_0x1f25fe);})[_0x07d5('0x16')](function(_0x2c62bc){logger[_0x07d5('0x12')]('CreateSmsQueueReport',_0x2c62bc[_0x07d5('0x15')],_0x40604a);_0x3755c8(_0x5230d3['error'](0x1f4,_0x2c62bc[_0x07d5('0x15')]));});});};exports[_0x07d5('0x1b')]=function(_0x4401d0){var _0x26c8eb=this;return new Promise(function(_0x16c8bd,_0x37f1ba){return db[_0x07d5('0x18')][_0x07d5('0x1c')](_0x4401d0[_0x07d5('0x19')],{'raw':_0x4401d0[_0x07d5('0x1a')]?_0x4401d0['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4401d0[_0x07d5('0x1a')]?_0x4401d0['options'][_0x07d5('0x1d')]||null:null,'attributes':_0x4401d0['options']?_0x4401d0['options'][_0x07d5('0x1e')]||null:null,'limit':_0x4401d0[_0x07d5('0x1a')]?_0x4401d0[_0x07d5('0x1a')][_0x07d5('0x1f')]||null:null})[_0x07d5('0xd')](function(_0xd0ff5d){logger[_0x07d5('0xe')](_0x07d5('0x1b'),_0x4401d0);logger[_0x07d5('0x10')]('UpdateSmsQueueReport',_0x4401d0,JSON[_0x07d5('0x11')](_0xd0ff5d));_0x16c8bd(_0xd0ff5d);})['catch'](function(_0x2bf482){logger[_0x07d5('0x12')](_0x07d5('0x1b'),_0x2bf482['message'],_0x4401d0);_0x37f1ba(_0x26c8eb['error'](0x1f4,_0x2bf482['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a885de9..370b182 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 _0xc978=['/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2f9e84,_0x3f0f8a){var _0x3549e9=function(_0x5caf50){while(--_0x5caf50){_0x2f9e84['push'](_0x2f9e84['shift']());}};_0x3549e9(++_0x3f0f8a);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0xe')]);router[_0x8c97('0xa')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router['post']('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0x11')]);router[_0x8c97('0x12')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x13')]);router[_0x8c97('0x14')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller['destroy']);module[_0x8c97('0x15')]=router; \ No newline at end of file +var _0x6aa7=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','post','create','put','update','delete','exports','multer','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0x37330c,_0x1ffdbd){_0x37330c=_0x37330c-0x0;var _0x24206c=_0x6aa7[_0x37330c];return _0x24206c;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0xc')]('/',auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0xe')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x10')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['destroy']);module[_0x76aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 784dce5..42aa853 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x4956ff,_0x133ed8){var _0x47b801=function(_0xa38e3c){while(--_0xa38e3c){_0x4956ff['push'](_0x4956ff['shift']());}};_0x47b801(++_0x133ed8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xcb91[_0x4b5813];return _0x423465;};'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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x128e33,_0x59a513){var _0x22a992=function(_0x48817d){while(--_0x48817d){_0x128e33['push'](_0x128e33['shift']());}};_0x22a992(++_0x59a513);}(_0xf4eb,0xec));var _0xbf4e=function(_0x48df0f,_0x98bbbb){_0x48df0f=_0x48df0f-0x0;var _0x1b11f9=_0xf4eb[_0x48df0f];return _0x1b11f9;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ce89418..ec45cc7 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 _0x5b6d=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','SmsTransferReport','includeAll','findAll','rows','show','params','keys','include','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring'];(function(_0x1f5f0d,_0x1d5da6){var _0x407342=function(_0x46f487){while(--_0x46f487){_0x1f5f0d['push'](_0x1f5f0d['shift']());}};_0x407342(++_0x1d5da6);}(_0x5b6d,0x8c));var _0xd5b6=function(_0x11c032,_0x4ca503){_0x11c032=_0x11c032-0x0;var _0x55919f=_0x5b6d[_0x11c032];return _0x55919f;};'use strict';var emlformat=require(_0xd5b6('0x0'));var rimraf=require(_0xd5b6('0x1'));var zipdir=require(_0xd5b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5b6('0x3'));var moment=require(_0xd5b6('0x4'));var BPromise=require(_0xd5b6('0x5'));var Mustache=require(_0xd5b6('0x6'));var util=require(_0xd5b6('0x7'));var path=require(_0xd5b6('0x8'));var sox=require(_0xd5b6('0x9'));var csv=require(_0xd5b6('0xa'));var ejs=require(_0xd5b6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd5b6('0xc'));var jsforce=require(_0xd5b6('0xd'));var deskjs=require(_0xd5b6('0xe'));var toCsv=require(_0xd5b6('0xa'));var querystring=require(_0xd5b6('0xf'));var Papa=require(_0xd5b6('0x10'));var Redis=require('ioredis');var authService=require(_0xd5b6('0x11'));var qs=require(_0xd5b6('0x12'));var as=require(_0xd5b6('0x13'));var hardwareService=require(_0xd5b6('0x14'));var logger=require(_0xd5b6('0x15'))(_0xd5b6('0x16'));var utils=require(_0xd5b6('0x17'));var config=require(_0xd5b6('0x18'));var licenseUtil=require(_0xd5b6('0x19'));var db=require(_0xd5b6('0x1a'))['db'];function respondWithStatusCode(_0x2062d4,_0x48bd88){_0x48bd88=_0x48bd88||0xcc;return function(_0x3c98a0){if(_0x3c98a0){return _0x2062d4['sendStatus'](_0x48bd88);}return _0x2062d4[_0xd5b6('0x1b')](_0x48bd88)[_0xd5b6('0x1c')]();};}function respondWithResult(_0x590050,_0x313ecf){_0x313ecf=_0x313ecf||0xc8;return function(_0x1cc5a5){if(_0x1cc5a5){return _0x590050[_0xd5b6('0x1b')](_0x313ecf)[_0xd5b6('0x1d')](_0x1cc5a5);}};}function respondWithFilteredResult(_0x388be0,_0x3cba0a){return function(_0x411858){if(_0x411858){var _0x3d26a7=typeof _0x3cba0a[_0xd5b6('0x1e')]===_0xd5b6('0x1f')&&typeof _0x3cba0a[_0xd5b6('0x20')]===_0xd5b6('0x1f');var _0x208806=_0x411858[_0xd5b6('0x21')];var _0x117995=_0x3d26a7?0x0:_0x3cba0a[_0xd5b6('0x1e')];var _0x34ffba=_0x3d26a7?_0x411858[_0xd5b6('0x21')]:_0x3cba0a[_0xd5b6('0x1e')]+_0x3cba0a[_0xd5b6('0x20')];var _0x4cf6a6;if(_0x34ffba>=_0x208806){_0x34ffba=_0x208806;_0x4cf6a6=0xc8;}else{_0x4cf6a6=0xce;}_0x388be0[_0xd5b6('0x1b')](_0x4cf6a6);return _0x388be0[_0xd5b6('0x22')]('Content-Range',_0x117995+'-'+_0x34ffba+'/'+_0x208806)[_0xd5b6('0x1d')](_0x411858);}return null;};}function patchUpdates(_0x58a968){return function(_0x22e46d){try{jsonpatch[_0xd5b6('0x23')](_0x22e46d,_0x58a968,!![]);}catch(_0x2cf730){return BPromise['reject'](_0x2cf730);}return _0x22e46d['save']();};}function saveUpdates(_0x9e0789,_0x28506f){return function(_0x244f8b){if(_0x244f8b){return _0x244f8b['update'](_0x9e0789)[_0xd5b6('0x24')](function(_0x396731){return _0x396731;});}return null;};}function removeEntity(_0x736c3c,_0x2345b9){return function(_0x28bbbd){if(_0x28bbbd){return _0x28bbbd[_0xd5b6('0x25')]()[_0xd5b6('0x24')](function(){_0x736c3c[_0xd5b6('0x1b')](0xcc)[_0xd5b6('0x1c')]();});}};}function handleEntityNotFound(_0x3b056f,_0x4fc21e){return function(_0x4493b7){if(!_0x4493b7){_0x3b056f['sendStatus'](0x194);}return _0x4493b7;};}function handleError(_0x3ae297,_0x16140b){_0x16140b=_0x16140b||0x1f4;return function(_0x4c2375){logger[_0xd5b6('0x26')](_0x4c2375[_0xd5b6('0x27')]);if(_0x4c2375[_0xd5b6('0x28')]){delete _0x4c2375[_0xd5b6('0x28')];}_0x3ae297[_0xd5b6('0x1b')](_0x16140b)[_0xd5b6('0x29')](_0x4c2375);};}exports[_0xd5b6('0x2a')]=function(_0x4893a4,_0x38c902){var _0x42c810={},_0x279c2a={},_0x392d28={'count':0x0,'rows':[]};var _0x3250d1=_[_0xd5b6('0x2b')](db['SmsTransferReport'][_0xd5b6('0x2c')],function(_0x6ad960){return{'name':_0x6ad960[_0xd5b6('0x2d')],'type':_0x6ad960[_0xd5b6('0x2e')][_0xd5b6('0x2f')]};});_0x279c2a[_0xd5b6('0x30')]=_[_0xd5b6('0x2b')](_0x3250d1,_0xd5b6('0x28'));_0x279c2a[_0xd5b6('0x31')]=_['keys'](_0x4893a4[_0xd5b6('0x31')]);_0x279c2a['filters']=_[_0xd5b6('0x32')](_0x279c2a[_0xd5b6('0x30')],_0x279c2a['query']);_0x42c810[_0xd5b6('0x33')]=_[_0xd5b6('0x32')](_0x279c2a[_0xd5b6('0x30')],qs[_0xd5b6('0x34')](_0x4893a4[_0xd5b6('0x31')][_0xd5b6('0x34')]));_0x42c810[_0xd5b6('0x33')]=_0x42c810[_0xd5b6('0x33')][_0xd5b6('0x35')]?_0x42c810[_0xd5b6('0x33')]:_0x279c2a[_0xd5b6('0x30')];if(!_0x4893a4['query'][_0xd5b6('0x36')]('nolimit')){_0x42c810[_0xd5b6('0x20')]=qs[_0xd5b6('0x20')](_0x4893a4[_0xd5b6('0x31')][_0xd5b6('0x20')]);_0x42c810[_0xd5b6('0x1e')]=qs[_0xd5b6('0x1e')](_0x4893a4[_0xd5b6('0x31')][_0xd5b6('0x1e')]);}_0x42c810[_0xd5b6('0x37')]=qs[_0xd5b6('0x38')](_0x4893a4[_0xd5b6('0x31')][_0xd5b6('0x38')]);_0x42c810['where']=qs[_0xd5b6('0x39')](_[_0xd5b6('0x3a')](_0x4893a4[_0xd5b6('0x31')],_0x279c2a[_0xd5b6('0x39')]),_0x3250d1);if(_0x4893a4[_0xd5b6('0x31')][_0xd5b6('0x3b')]){_0x42c810[_0xd5b6('0x3c')]=_[_0xd5b6('0x3d')](_0x42c810[_0xd5b6('0x3c')],{'$or':_[_0xd5b6('0x2b')](_0x3250d1,function(_0x31b5e3){if(_0x31b5e3['type']!==_0xd5b6('0x3e')){var _0x83eebf={};_0x83eebf[_0x31b5e3[_0xd5b6('0x28')]]={'$like':'%'+_0x4893a4[_0xd5b6('0x31')][_0xd5b6('0x3b')]+'%'};return _0x83eebf;}})});}_0x42c810=_[_0xd5b6('0x3d')]({},_0x42c810,_0x4893a4[_0xd5b6('0x3f')]);var _0x21956b={'where':_0x42c810['where']};return db[_0xd5b6('0x40')][_0xd5b6('0x21')](_0x21956b)['then'](function(_0x3cec51){_0x392d28[_0xd5b6('0x21')]=_0x3cec51;if(_0x4893a4[_0xd5b6('0x31')][_0xd5b6('0x41')]){_0x42c810['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0xd5b6('0x42')](_0x42c810);})[_0xd5b6('0x24')](function(_0x5c3027){_0x392d28[_0xd5b6('0x43')]=_0x5c3027;return _0x392d28;})[_0xd5b6('0x24')](respondWithFilteredResult(_0x38c902,_0x42c810))['catch'](handleError(_0x38c902,null));};exports[_0xd5b6('0x44')]=function(_0x46b0cb,_0x1bc943){var _0x100ef4={'raw':!![],'where':{'id':_0x46b0cb[_0xd5b6('0x45')]['id']}},_0x4cbd26={};_0x4cbd26[_0xd5b6('0x30')]=_[_0xd5b6('0x46')](db[_0xd5b6('0x40')][_0xd5b6('0x2c')]);_0x4cbd26[_0xd5b6('0x31')]=_[_0xd5b6('0x46')](_0x46b0cb[_0xd5b6('0x31')]);_0x4cbd26['filters']=_[_0xd5b6('0x32')](_0x4cbd26[_0xd5b6('0x30')],_0x4cbd26[_0xd5b6('0x31')]);_0x100ef4[_0xd5b6('0x33')]=_[_0xd5b6('0x32')](_0x4cbd26[_0xd5b6('0x30')],qs[_0xd5b6('0x34')](_0x46b0cb['query']['fields']));_0x100ef4['attributes']=_0x100ef4[_0xd5b6('0x33')][_0xd5b6('0x35')]?_0x100ef4[_0xd5b6('0x33')]:_0x4cbd26[_0xd5b6('0x30')];if(_0x46b0cb[_0xd5b6('0x31')][_0xd5b6('0x41')]){_0x100ef4[_0xd5b6('0x47')]=[{'all':!![]}];}_0x100ef4=_[_0xd5b6('0x3d')]({},_0x100ef4,_0x46b0cb['options']);return db[_0xd5b6('0x40')][_0xd5b6('0x48')](_0x100ef4)[_0xd5b6('0x24')](handleEntityNotFound(_0x1bc943,null))[_0xd5b6('0x24')](respondWithResult(_0x1bc943,null))[_0xd5b6('0x49')](handleError(_0x1bc943,null));};exports[_0xd5b6('0x4a')]=function(_0x472888,_0x58ae6d){return db['SmsTransferReport']['create'](_0x472888['body'],{})[_0xd5b6('0x24')](respondWithResult(_0x58ae6d,0xc9))[_0xd5b6('0x49')](handleError(_0x58ae6d,null));};exports[_0xd5b6('0x4b')]=function(_0x2964d4,_0x41a7f9){if(_0x2964d4[_0xd5b6('0x4c')]['id']){delete _0x2964d4[_0xd5b6('0x4c')]['id'];}return db[_0xd5b6('0x40')][_0xd5b6('0x48')]({'where':{'id':_0x2964d4[_0xd5b6('0x45')]['id']}})[_0xd5b6('0x24')](handleEntityNotFound(_0x41a7f9,null))[_0xd5b6('0x24')](saveUpdates(_0x2964d4[_0xd5b6('0x4c')],null))[_0xd5b6('0x24')](respondWithResult(_0x41a7f9,null))[_0xd5b6('0x49')](handleError(_0x41a7f9,null));};exports[_0xd5b6('0x25')]=function(_0x2891c1,_0x30ad18){return db[_0xd5b6('0x40')][_0xd5b6('0x48')]({'where':{'id':_0x2891c1[_0xd5b6('0x45')]['id']}})['then'](handleEntityNotFound(_0x30ad18,null))[_0xd5b6('0x24')](removeEntity(_0x30ad18,null))[_0xd5b6('0x49')](handleError(_0x30ad18,null));};exports[_0xd5b6('0x4d')]=function(_0x17ec42,_0xb57ddb){return db['SmsTransferReport'][_0xd5b6('0x4d')]()['then'](respondWithResult(_0xb57ddb,null))[_0xd5b6('0x49')](handleError(_0xb57ddb,null));}; \ No newline at end of file +var _0xfe91=['find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','stack','send','index','map','rawAttributes','fieldName','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','params'];(function(_0x37bc45,_0x39f8fe){var _0xc2b3a=function(_0x3bf949){while(--_0x3bf949){_0x37bc45['push'](_0x37bc45['shift']());}};_0xc2b3a(++_0x39f8fe);}(_0xfe91,0x133));var _0x1fe9=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0xfe91[_0x14476b];return _0x24e2e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fe9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fe9('0x1'));var rp=require(_0x1fe9('0x2'));var moment=require(_0x1fe9('0x3'));var BPromise=require(_0x1fe9('0x4'));var Mustache=require(_0x1fe9('0x5'));var util=require(_0x1fe9('0x6'));var path=require(_0x1fe9('0x7'));var sox=require(_0x1fe9('0x8'));var csv=require(_0x1fe9('0x9'));var ejs=require(_0x1fe9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1fe9('0xb'));var crypto=require(_0x1fe9('0xc'));var jsforce=require(_0x1fe9('0xd'));var deskjs=require(_0x1fe9('0xe'));var toCsv=require(_0x1fe9('0x9'));var querystring=require(_0x1fe9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1fe9('0x10'));var qs=require(_0x1fe9('0x11'));var as=require(_0x1fe9('0x12'));var hardwareService=require(_0x1fe9('0x13'));var logger=require(_0x1fe9('0x14'))(_0x1fe9('0x15'));var utils=require(_0x1fe9('0x16'));var config=require(_0x1fe9('0x17'));var licenseUtil=require(_0x1fe9('0x18'));var db=require(_0x1fe9('0x19'))['db'];function respondWithStatusCode(_0x11079b,_0x3a22c6){_0x3a22c6=_0x3a22c6||0xcc;return function(_0xed2bfc){if(_0xed2bfc){return _0x11079b['sendStatus'](_0x3a22c6);}return _0x11079b['status'](_0x3a22c6)[_0x1fe9('0x1a')]();};}function respondWithResult(_0x3356ee,_0x16b0a4){_0x16b0a4=_0x16b0a4||0xc8;return function(_0x32d7d4){if(_0x32d7d4){return _0x3356ee[_0x1fe9('0x1b')](_0x16b0a4)[_0x1fe9('0x1c')](_0x32d7d4);}};}function respondWithFilteredResult(_0x1ecd36,_0x43c9f1){return function(_0x50b4b3){if(_0x50b4b3){var _0x487684=typeof _0x43c9f1[_0x1fe9('0x1d')]===_0x1fe9('0x1e')&&typeof _0x43c9f1[_0x1fe9('0x1f')]===_0x1fe9('0x1e');var _0xaf4af5=_0x50b4b3[_0x1fe9('0x20')];var _0x11fe59=_0x487684?0x0:_0x43c9f1['offset'];var _0x31c900=_0x487684?_0x50b4b3[_0x1fe9('0x20')]:_0x43c9f1[_0x1fe9('0x1d')]+_0x43c9f1['limit'];var _0x59bf2c;if(_0x31c900>=_0xaf4af5){_0x31c900=_0xaf4af5;_0x59bf2c=0xc8;}else{_0x59bf2c=0xce;}_0x1ecd36[_0x1fe9('0x1b')](_0x59bf2c);return _0x1ecd36[_0x1fe9('0x21')](_0x1fe9('0x22'),_0x11fe59+'-'+_0x31c900+'/'+_0xaf4af5)['json'](_0x50b4b3);}return null;};}function patchUpdates(_0x5dabdb){return function(_0xbcabdb){try{jsonpatch[_0x1fe9('0x23')](_0xbcabdb,_0x5dabdb,!![]);}catch(_0xb00481){return BPromise['reject'](_0xb00481);}return _0xbcabdb['save']();};}function saveUpdates(_0xc2161b,_0x4e8700){return function(_0x4fb5c1){if(_0x4fb5c1){return _0x4fb5c1[_0x1fe9('0x24')](_0xc2161b)[_0x1fe9('0x25')](function(_0x1f23a2){return _0x1f23a2;});}return null;};}function removeEntity(_0x1d891f,_0x1ecdb4){return function(_0x34e980){if(_0x34e980){return _0x34e980[_0x1fe9('0x26')]()['then'](function(){_0x1d891f[_0x1fe9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe430cc,_0x43ceb1){return function(_0xd085bb){if(!_0xd085bb){_0xe430cc[_0x1fe9('0x27')](0x194);}return _0xd085bb;};}function handleError(_0x42f2df,_0x3ded82){_0x3ded82=_0x3ded82||0x1f4;return function(_0x51fb49){logger['error'](_0x51fb49[_0x1fe9('0x28')]);if(_0x51fb49['name']){delete _0x51fb49['name'];}_0x42f2df[_0x1fe9('0x1b')](_0x3ded82)[_0x1fe9('0x29')](_0x51fb49);};}exports[_0x1fe9('0x2a')]=function(_0x108378,_0x18dbf5){var _0x1013b3={},_0x32d2e0={},_0x44c7a2={'count':0x0,'rows':[]};var _0x655828=_[_0x1fe9('0x2b')](db['SmsTransferReport'][_0x1fe9('0x2c')],function(_0x3362f3){return{'name':_0x3362f3[_0x1fe9('0x2d')],'type':_0x3362f3['type'][_0x1fe9('0x2e')]};});_0x32d2e0['model']=_[_0x1fe9('0x2b')](_0x655828,_0x1fe9('0x2f'));_0x32d2e0[_0x1fe9('0x30')]=_[_0x1fe9('0x31')](_0x108378[_0x1fe9('0x30')]);_0x32d2e0[_0x1fe9('0x32')]=_['intersection'](_0x32d2e0[_0x1fe9('0x33')],_0x32d2e0[_0x1fe9('0x30')]);_0x1013b3[_0x1fe9('0x34')]=_[_0x1fe9('0x35')](_0x32d2e0[_0x1fe9('0x33')],qs[_0x1fe9('0x36')](_0x108378[_0x1fe9('0x30')]['fields']));_0x1013b3['attributes']=_0x1013b3[_0x1fe9('0x34')][_0x1fe9('0x37')]?_0x1013b3[_0x1fe9('0x34')]:_0x32d2e0[_0x1fe9('0x33')];if(!_0x108378['query'][_0x1fe9('0x38')](_0x1fe9('0x39'))){_0x1013b3['limit']=qs[_0x1fe9('0x1f')](_0x108378[_0x1fe9('0x30')][_0x1fe9('0x1f')]);_0x1013b3['offset']=qs[_0x1fe9('0x1d')](_0x108378['query'][_0x1fe9('0x1d')]);}_0x1013b3['order']=qs[_0x1fe9('0x3a')](_0x108378[_0x1fe9('0x30')][_0x1fe9('0x3a')]);_0x1013b3[_0x1fe9('0x3b')]=qs[_0x1fe9('0x32')](_[_0x1fe9('0x3c')](_0x108378['query'],_0x32d2e0[_0x1fe9('0x32')]),_0x655828);if(_0x108378[_0x1fe9('0x30')][_0x1fe9('0x3d')]){_0x1013b3[_0x1fe9('0x3b')]=_[_0x1fe9('0x3e')](_0x1013b3[_0x1fe9('0x3b')],{'$or':_['map'](_0x655828,function(_0x467a5a){if(_0x467a5a[_0x1fe9('0x3f')]!==_0x1fe9('0x40')){var _0xcb6aa5={};_0xcb6aa5[_0x467a5a[_0x1fe9('0x2f')]]={'$like':'%'+_0x108378[_0x1fe9('0x30')]['filter']+'%'};return _0xcb6aa5;}})});}_0x1013b3=_['merge']({},_0x1013b3,_0x108378[_0x1fe9('0x41')]);var _0x276182={'where':_0x1013b3[_0x1fe9('0x3b')]};return db[_0x1fe9('0x42')][_0x1fe9('0x20')](_0x276182)[_0x1fe9('0x25')](function(_0x533f39){_0x44c7a2[_0x1fe9('0x20')]=_0x533f39;if(_0x108378[_0x1fe9('0x30')]['includeAll']){_0x1013b3[_0x1fe9('0x43')]=[{'all':!![]}];}return db[_0x1fe9('0x42')][_0x1fe9('0x44')](_0x1013b3);})[_0x1fe9('0x25')](function(_0x4170de){_0x44c7a2[_0x1fe9('0x45')]=_0x4170de;return _0x44c7a2;})[_0x1fe9('0x25')](respondWithFilteredResult(_0x18dbf5,_0x1013b3))[_0x1fe9('0x46')](handleError(_0x18dbf5,null));};exports[_0x1fe9('0x47')]=function(_0x41bab6,_0x513502){var _0x61b4ce={'raw':!![],'where':{'id':_0x41bab6[_0x1fe9('0x48')]['id']}},_0x58c4c0={};_0x58c4c0['model']=_['keys'](db[_0x1fe9('0x42')]['rawAttributes']);_0x58c4c0[_0x1fe9('0x30')]=_[_0x1fe9('0x31')](_0x41bab6[_0x1fe9('0x30')]);_0x58c4c0[_0x1fe9('0x32')]=_['intersection'](_0x58c4c0[_0x1fe9('0x33')],_0x58c4c0[_0x1fe9('0x30')]);_0x61b4ce['attributes']=_[_0x1fe9('0x35')](_0x58c4c0[_0x1fe9('0x33')],qs['fields'](_0x41bab6[_0x1fe9('0x30')][_0x1fe9('0x36')]));_0x61b4ce['attributes']=_0x61b4ce[_0x1fe9('0x34')]['length']?_0x61b4ce[_0x1fe9('0x34')]:_0x58c4c0[_0x1fe9('0x33')];if(_0x41bab6['query']['includeAll']){_0x61b4ce[_0x1fe9('0x43')]=[{'all':!![]}];}_0x61b4ce=_[_0x1fe9('0x3e')]({},_0x61b4ce,_0x41bab6[_0x1fe9('0x41')]);return db[_0x1fe9('0x42')][_0x1fe9('0x49')](_0x61b4ce)[_0x1fe9('0x25')](handleEntityNotFound(_0x513502,null))['then'](respondWithResult(_0x513502,null))[_0x1fe9('0x46')](handleError(_0x513502,null));};exports[_0x1fe9('0x4a')]=function(_0xd993cd,_0xd08c4b){return db['SmsTransferReport'][_0x1fe9('0x4a')](_0xd993cd[_0x1fe9('0x4b')],{})[_0x1fe9('0x25')](respondWithResult(_0xd08c4b,0xc9))[_0x1fe9('0x46')](handleError(_0xd08c4b,null));};exports[_0x1fe9('0x24')]=function(_0x1c31e9,_0x20786b){if(_0x1c31e9['body']['id']){delete _0x1c31e9[_0x1fe9('0x4b')]['id'];}return db[_0x1fe9('0x42')][_0x1fe9('0x49')]({'where':{'id':_0x1c31e9[_0x1fe9('0x48')]['id']}})[_0x1fe9('0x25')](handleEntityNotFound(_0x20786b,null))['then'](saveUpdates(_0x1c31e9[_0x1fe9('0x4b')],null))[_0x1fe9('0x25')](respondWithResult(_0x20786b,null))['catch'](handleError(_0x20786b,null));};exports[_0x1fe9('0x26')]=function(_0xee1d01,_0x4fb4ea){return db[_0x1fe9('0x42')][_0x1fe9('0x49')]({'where':{'id':_0xee1d01[_0x1fe9('0x48')]['id']}})[_0x1fe9('0x25')](handleEntityNotFound(_0x4fb4ea,null))[_0x1fe9('0x25')](removeEntity(_0x4fb4ea,null))['catch'](handleError(_0x4fb4ea,null));};exports['describe']=function(_0x2a43f3,_0x21e379){return db[_0x1fe9('0x42')]['describe']()['then'](respondWithResult(_0x21e379,null))[_0x1fe9('0x46')](handleError(_0x21e379,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4a39c24..b4b9bd1 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 _0x4fd7=['util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','report_sms_transfer','uniqueid','lodash'];(function(_0x2bd35e,_0xc6c574){var _0x2af201=function(_0x28c2ff){while(--_0x28c2ff){_0x2bd35e['push'](_0x2bd35e['shift']());}};_0x2af201(++_0xc6c574);}(_0x4fd7,0xe6));var _0x74fd=function(_0x2e9c79,_0x2d6aef){_0x2e9c79=_0x2e9c79-0x0;var _0x16797a=_0x4fd7[_0x2e9c79];return _0x16797a;};'use strict';var _=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var logger=require(_0x74fd('0x2'))(_0x74fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74fd('0x4'));var fs=require('fs');var path=require(_0x74fd('0x5'));var rimraf=require('rimraf');var config=require(_0x74fd('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x74fd('0x7')]=function(_0x480ec2,_0x1959e1){return _0x480ec2[_0x74fd('0x8')]('SmsTransferReport',attributes,{'tableName':_0x74fd('0x9'),'paranoid':![],'indexes':[{'name':_0x74fd('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x970a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util'];(function(_0x30eeb3,_0x2d0904){var _0xa556c9=function(_0x497302){while(--_0x497302){_0x30eeb3['push'](_0x30eeb3['shift']());}};_0xa556c9(++_0x2d0904);}(_0x970a,0xee));var _0xa970=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x970a[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0xa970('0x0'));var util=require(_0xa970('0x1'));var logger=require(_0xa970('0x2'))(_0xa970('0x3'));var moment=require(_0xa970('0x4'));var BPromise=require(_0xa970('0x5'));var rp=require(_0xa970('0x6'));var fs=require('fs');var path=require(_0xa970('0x7'));var rimraf=require(_0xa970('0x8'));var config=require(_0xa970('0x9'));var attributes=require(_0xa970('0xa'));module[_0xa970('0xb')]=function(_0x540b5d,_0xe78bc){return _0x540b5d[_0xa970('0xc')](_0xa970('0xd'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xa970('0xe'),'fields':[_0xa970('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index f796d2e..f3769f6 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 _0x7266=['request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x18f5b0,_0x2fe6e7){var _0x2ceb90=function(_0x4e554c){while(--_0x4e554c){_0x18f5b0['push'](_0x18f5b0['shift']());}};_0x2ceb90(++_0x2fe6e7);}(_0x7266,0xec));var _0x6726=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7266[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x6726('0x0'));var util=require(_0x6726('0x1'));var moment=require(_0x6726('0x2'));var BPromise=require(_0x6726('0x3'));var rs=require(_0x6726('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6726('0x5'));var logger=require(_0x6726('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6726('0x7'));var client=jayson[_0x6726('0x8')][_0x6726('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x180502,_0x217972,_0x3c8020){return new BPromise(function(_0x126ba7,_0x3d9f0f){return client[_0x6726('0xa')](_0x180502,_0x3c8020)[_0x6726('0xb')](function(_0x9f993){logger[_0x6726('0xc')](_0x6726('0xd'),_0x217972,'request\x20sent');logger[_0x6726('0xe')](_0x6726('0xf'),_0x217972,_0x6726('0x10'),JSON[_0x6726('0x11')](_0x9f993));if(_0x9f993['error']){if(_0x9f993[_0x6726('0x12')]['code']===0x1f4){logger[_0x6726('0x12')](_0x6726('0xd'),_0x217972,_0x9f993['error'][_0x6726('0x13')]);return _0x3d9f0f(_0x9f993[_0x6726('0x12')][_0x6726('0x13')]);}logger[_0x6726('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x217972,_0x9f993[_0x6726('0x12')][_0x6726('0x13')]);return _0x126ba7(_0x9f993['error'][_0x6726('0x13')]);}else{logger['info'](_0x6726('0xd'),_0x217972,_0x6726('0x10'));_0x126ba7(_0x9f993[_0x6726('0x14')][_0x6726('0x13')]);}})['catch'](function(_0x8323b2){logger[_0x6726('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x217972,_0x8323b2);_0x3d9f0f(_0x8323b2);});});} \ No newline at end of file +var _0x1a61=['error','code','SmsTransferReport,\x20%s,\x20%s','message','request\x20sent','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x586d28,_0x252dbc){var _0x1902e9=function(_0x1b3375){while(--_0x1b3375){_0x586d28['push'](_0x586d28['shift']());}};_0x1902e9(++_0x252dbc);}(_0x1a61,0x1e6));var _0x11a6=function(_0x1144a2,_0x5c30e0){_0x1144a2=_0x1144a2-0x0;var _0x945fab=_0x1a61[_0x1144a2];return _0x945fab;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var moment=require(_0x11a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x11a6('0x2'));var fs=require('fs');var Redis=require(_0x11a6('0x3'));var db=require(_0x11a6('0x4'))['db'];var utils=require(_0x11a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x11a6('0x6'));var jayson=require(_0x11a6('0x7'));var client=jayson['client'][_0x11a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c4b31,_0x124855,_0x333ec2){return new BPromise(function(_0x1c67ce,_0x33b9b4){return client[_0x11a6('0x9')](_0x1c4b31,_0x333ec2)[_0x11a6('0xa')](function(_0x1a7d57){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x124855,'request\x20sent');logger[_0x11a6('0xb')](_0x11a6('0xc'),_0x124855,'request\x20sent',JSON[_0x11a6('0xd')](_0x1a7d57));if(_0x1a7d57[_0x11a6('0xe')]){if(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0xf')]===0x1f4){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x1a7d57['error']['message']);return _0x33b9b4(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}logger['error'](_0x11a6('0x10'),_0x124855,_0x1a7d57[_0x11a6('0xe')]['message']);return _0x1c67ce(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}else{logger['info'](_0x11a6('0x10'),_0x124855,_0x11a6('0x12'));_0x1c67ce(_0x1a7d57[_0x11a6('0x13')][_0x11a6('0x11')]);}})['catch'](function(_0x3d6457){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x3d6457);_0x33b9b4(_0x3d6457);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3d6e9e9..e51f4e6 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 _0xd1b8=['basename','extname','now','post','file','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','/:id/download','download','join','originalname','replace','format','%s-%s%s'];(function(_0x530bef,_0x1f4cb6){var _0x8fd7e5=function(_0x201e8a){while(--_0x201e8a){_0x530bef['push'](_0x530bef['shift']());}};_0x8fd7e5(++_0x1f4cb6);}(_0xd1b8,0x117));var _0x8d1b=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0xd1b8[_0x279368];return _0x40b6d0;};'use strict';var multer=require(_0x8d1b('0x0'));var util=require(_0x8d1b('0x1'));var path=require(_0x8d1b('0x2'));var timeout=require(_0x8d1b('0x3'));var express=require(_0x8d1b('0x4'));var router=express[_0x8d1b('0x5')]();var fs_extra=require(_0x8d1b('0x6'));var auth=require(_0x8d1b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8d1b('0x8'));var controller=require(_0x8d1b('0x9'));router[_0x8d1b('0xa')]('/',auth['isAuthenticated'](),controller[_0x8d1b('0xb')]);router[_0x8d1b('0xa')](_0x8d1b('0xc'),auth[_0x8d1b('0xd')](),controller['show']);router[_0x8d1b('0xa')](_0x8d1b('0xe'),auth[_0x8d1b('0xd')](),controller[_0x8d1b('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1057ed,_0x59358e,_0x5119ba){_0x5119ba(null,path[_0x8d1b('0x10')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x490d20,_0xf71785,_0x3e7c5e){_0xf71785['originalname']=_0xf71785[_0x8d1b('0x11')][_0x8d1b('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e7c5e(null,util[_0x8d1b('0x13')](_0x8d1b('0x14'),path[_0x8d1b('0x15')](_0xf71785[_0x8d1b('0x11')],path[_0x8d1b('0x16')](_0xf71785[_0x8d1b('0x11')])),Date[_0x8d1b('0x17')](),path[_0x8d1b('0x16')](_0xf71785[_0x8d1b('0x11')])));}})});router[_0x8d1b('0x18')]('/',upload['single'](_0x8d1b('0x19')),controller[_0x8d1b('0x1a')]);router['put'](_0x8d1b('0xc'),auth[_0x8d1b('0xd')](),controller[_0x8d1b('0x1b')]);router[_0x8d1b('0x1c')](_0x8d1b('0xc'),auth[_0x8d1b('0xd')](),controller['delete']);module[_0x8d1b('0x1d')]=router; \ No newline at end of file +var _0x7a85=['root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','post','single','file','create','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a85,0x185));var _0x57a8=function(_0xbc58f0,_0x2e84c1){_0xbc58f0=_0xbc58f0-0x0;var _0x26dc33=_0x7a85[_0xbc58f0];return _0x26dc33;};'use strict';var multer=require(_0x57a8('0x0'));var util=require(_0x57a8('0x1'));var path=require(_0x57a8('0x2'));var timeout=require(_0x57a8('0x3'));var express=require(_0x57a8('0x4'));var router=express[_0x57a8('0x5')]();var fs_extra=require(_0x57a8('0x6'));var auth=require(_0x57a8('0x7'));var interaction=require(_0x57a8('0x8'));var config=require(_0x57a8('0x9'));var controller=require(_0x57a8('0xa'));router[_0x57a8('0xb')]('/',auth[_0x57a8('0xc')](),controller[_0x57a8('0xd')]);router[_0x57a8('0xb')](_0x57a8('0xe'),auth[_0x57a8('0xc')](),controller['show']);router[_0x57a8('0xb')](_0x57a8('0xf'),auth[_0x57a8('0xc')](),controller[_0x57a8('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7c7a83,_0x5e8863,_0x5ec148){_0x5ec148(null,path['join'](config[_0x57a8('0x11')],_0x57a8('0x12')));},'filename':function(_0x406068,_0x4f0a1f,_0x4b3b29){_0x4f0a1f[_0x57a8('0x13')]=_0x4f0a1f[_0x57a8('0x13')][_0x57a8('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4b3b29(null,util[_0x57a8('0x15')](_0x57a8('0x16'),path['basename'](_0x4f0a1f[_0x57a8('0x13')],path[_0x57a8('0x17')](_0x4f0a1f['originalname'])),Date['now'](),path[_0x57a8('0x17')](_0x4f0a1f[_0x57a8('0x13')])));}})});router[_0x57a8('0x18')]('/',upload[_0x57a8('0x19')](_0x57a8('0x1a')),controller[_0x57a8('0x1b')]);router['put'](_0x57a8('0xe'),auth['isAuthenticated'](),controller[_0x57a8('0x1c')]);router['delete'](_0x57a8('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5fe71fd..2890ce5 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 _0x0793=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x325260,_0x3fc854){var _0x23253f=function(_0x53018c){while(--_0x53018c){_0x325260['push'](_0x325260['shift']());}};_0x23253f(++_0x3fc854);}(_0x0793,0x1aa));var _0x3079=function(_0x35a3e4,_0x26b109){_0x35a3e4=_0x35a3e4-0x0;var _0x567beb=_0x0793[_0x35a3e4];return _0x567beb;};'use strict';var Sequelize=require(_0x3079('0x0'));module['exports']={'name':{'type':Sequelize[_0x3079('0x1')],'unique':_0x3079('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x3079('0x1')]},'original_format':{'type':Sequelize[_0x3079('0x1')]},'original_duration':{'type':Sequelize[_0x3079('0x3')]},'original_sampleCount':{'type':Sequelize[_0x3079('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x3079('0x4')]},'original_sampleRate':{'type':Sequelize[_0x3079('0x5')]},'converted_format':{'type':Sequelize[_0x3079('0x1')]},'converted_duration':{'type':Sequelize[_0x3079('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x3079('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x765a=['BIGINT','sequelize','STRING','FLOAT','INTEGER'];(function(_0x5eba16,_0x38132f){var _0x572995=function(_0x7ab845){while(--_0x7ab845){_0x5eba16['push'](_0x5eba16['shift']());}};_0x572995(++_0x38132f);}(_0x765a,0x182));var _0xa765=function(_0x381985,_0x56911e){_0x381985=_0x381985-0x0;var _0x1617bb=_0x765a[_0x381985];return _0x1617bb;};'use strict';var Sequelize=require(_0xa765('0x0'));module['exports']={'name':{'type':Sequelize[_0xa765('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xa765('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xa765('0x1')]},'original_duration':{'type':Sequelize[_0xa765('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xa765('0x3')]},'original_bitRate':{'type':Sequelize[_0xa765('0x4')]},'original_sampleRate':{'type':Sequelize[_0xa765('0x3')]},'converted_format':{'type':Sequelize[_0xa765('0x1')]},'converted_duration':{'type':Sequelize[_0xa765('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xa765('0x3')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xa765('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 218850b..7941f55 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 _0xccee=['sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Sound','includeAll','include','findAll','rows','catch','show','params','length','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xccee,0x93));var _0xecce=function(_0xca8e72,_0x1c16a2){_0xca8e72=_0xca8e72-0x0;var _0x45414a=_0xccee[_0xca8e72];return _0x45414a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecce('0x0'));var zipdir=require(_0xecce('0x1'));var jsonpatch=require(_0xecce('0x2'));var rp=require(_0xecce('0x3'));var moment=require(_0xecce('0x4'));var BPromise=require(_0xecce('0x5'));var Mustache=require('mustache');var util=require(_0xecce('0x6'));var path=require(_0xecce('0x7'));var sox=require(_0xecce('0x8'));var csv=require(_0xecce('0x9'));var ejs=require(_0xecce('0xa'));var fs=require('fs');var fs_extra=require(_0xecce('0xb'));var _=require('lodash');var squel=require(_0xecce('0xc'));var crypto=require(_0xecce('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xecce('0xe'));var toCsv=require(_0xecce('0x9'));var querystring=require('querystring');var Papa=require(_0xecce('0xf'));var Redis=require('ioredis');var authService=require(_0xecce('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xecce('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xecce('0x12'))(_0xecce('0x13'));var utils=require(_0xecce('0x14'));var config=require(_0xecce('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xecce('0x16'))['db'];function respondWithStatusCode(_0xaa628,_0x2cbdab){_0x2cbdab=_0x2cbdab||0xcc;return function(_0x2e943e){if(_0x2e943e){return _0xaa628['sendStatus'](_0x2cbdab);}return _0xaa628['status'](_0x2cbdab)[_0xecce('0x17')]();};}function respondWithResult(_0x5971dc,_0x14d232){_0x14d232=_0x14d232||0xc8;return function(_0x46ac7b){if(_0x46ac7b){return _0x5971dc['status'](_0x14d232)[_0xecce('0x18')](_0x46ac7b);}};}function respondWithFilteredResult(_0x1697af,_0x20bc25){return function(_0x4e983d){if(_0x4e983d){var _0x39274e=typeof _0x20bc25['offset']===_0xecce('0x19')&&typeof _0x20bc25[_0xecce('0x1a')]==='undefined';var _0x4e32c6=_0x4e983d[_0xecce('0x1b')];var _0x17f213=_0x39274e?0x0:_0x20bc25[_0xecce('0x1c')];var _0x2338b4=_0x39274e?_0x4e983d['count']:_0x20bc25['offset']+_0x20bc25[_0xecce('0x1a')];var _0x28c133;if(_0x2338b4>=_0x4e32c6){_0x2338b4=_0x4e32c6;_0x28c133=0xc8;}else{_0x28c133=0xce;}_0x1697af[_0xecce('0x1d')](_0x28c133);return _0x1697af[_0xecce('0x1e')](_0xecce('0x1f'),_0x17f213+'-'+_0x2338b4+'/'+_0x4e32c6)[_0xecce('0x18')](_0x4e983d);}return null;};}function patchUpdates(_0x42e79b){return function(_0x2f4114){try{jsonpatch[_0xecce('0x20')](_0x2f4114,_0x42e79b,!![]);}catch(_0x5bf16d){return BPromise[_0xecce('0x21')](_0x5bf16d);}return _0x2f4114[_0xecce('0x22')]();};}function saveUpdates(_0x284da1,_0x38c29a){return function(_0x8ed7af){if(_0x8ed7af){return _0x8ed7af[_0xecce('0x23')](_0x284da1)[_0xecce('0x24')](function(_0x457fde){return _0x457fde;});}return null;};}function removeEntity(_0x172505,_0x34baee){return function(_0x31cd6e){if(_0x31cd6e){return _0x31cd6e[_0xecce('0x25')]()['then'](function(){var _0x2eaea0=_0x31cd6e[_0xecce('0x26')]({'plain':!![]});var _0x15bbb3='Sounds';return db[_0xecce('0x27')][_0xecce('0x25')]({'where':{'type':_0x15bbb3,'resourceId':_0x2eaea0['id']}})[_0xecce('0x24')](function(){return _0x31cd6e;});})[_0xecce('0x24')](function(){_0x172505[_0xecce('0x1d')](0xcc)[_0xecce('0x17')]();});}};}function handleEntityNotFound(_0xb41669,_0x5e80f4){return function(_0x4b04fd){if(!_0x4b04fd){_0xb41669[_0xecce('0x28')](0x194);}return _0x4b04fd;};}function handleError(_0x2d1fa3,_0x23cdab){_0x23cdab=_0x23cdab||0x1f4;return function(_0x5ebd1e){logger[_0xecce('0x29')](_0x5ebd1e[_0xecce('0x2a')]);if(_0x5ebd1e['name']){delete _0x5ebd1e[_0xecce('0x2b')];}_0x2d1fa3[_0xecce('0x1d')](_0x23cdab)[_0xecce('0x2c')](_0x5ebd1e);};}exports[_0xecce('0x2d')]=function(_0x9fb0c1,_0x5e8fb5){var _0x4167fb={},_0x5286f9={},_0x4406f6={'count':0x0,'rows':[]};var _0x436b4d=_[_0xecce('0x2e')](db['Sound'][_0xecce('0x2f')],function(_0x2486ab){return{'name':_0x2486ab[_0xecce('0x30')],'type':_0x2486ab[_0xecce('0x31')][_0xecce('0x32')]};});_0x5286f9['model']=_[_0xecce('0x2e')](_0x436b4d,_0xecce('0x2b'));_0x5286f9[_0xecce('0x33')]=_[_0xecce('0x34')](_0x9fb0c1['query']);_0x5286f9[_0xecce('0x35')]=_[_0xecce('0x36')](_0x5286f9[_0xecce('0x37')],_0x5286f9[_0xecce('0x33')]);_0x4167fb[_0xecce('0x38')]=_[_0xecce('0x36')](_0x5286f9['model'],qs[_0xecce('0x39')](_0x9fb0c1[_0xecce('0x33')]['fields']));_0x4167fb[_0xecce('0x38')]=_0x4167fb[_0xecce('0x38')]['length']?_0x4167fb[_0xecce('0x38')]:_0x5286f9[_0xecce('0x37')];if(!_0x9fb0c1[_0xecce('0x33')][_0xecce('0x3a')](_0xecce('0x3b'))){_0x4167fb[_0xecce('0x1a')]=qs[_0xecce('0x1a')](_0x9fb0c1[_0xecce('0x33')][_0xecce('0x1a')]);_0x4167fb[_0xecce('0x1c')]=qs[_0xecce('0x1c')](_0x9fb0c1[_0xecce('0x33')]['offset']);}_0x4167fb[_0xecce('0x3c')]=qs[_0xecce('0x3d')](_0x9fb0c1[_0xecce('0x33')]['sort']);_0x4167fb[_0xecce('0x3e')]=qs[_0xecce('0x35')](_[_0xecce('0x3f')](_0x9fb0c1[_0xecce('0x33')],_0x5286f9[_0xecce('0x35')]),_0x436b4d);if(_0x9fb0c1[_0xecce('0x33')][_0xecce('0x40')]){_0x4167fb[_0xecce('0x3e')]=_[_0xecce('0x41')](_0x4167fb['where'],{'$or':_[_0xecce('0x2e')](_0x436b4d,function(_0x4b67eb){if(_0x4b67eb[_0xecce('0x31')]!=='VIRTUAL'){var _0x15911a={};_0x15911a[_0x4b67eb[_0xecce('0x2b')]]={'$like':'%'+_0x9fb0c1[_0xecce('0x33')][_0xecce('0x40')]+'%'};return _0x15911a;}})});}_0x4167fb=_['merge']({},_0x4167fb,_0x9fb0c1[_0xecce('0x42')]);var _0x19b758={'where':_0x4167fb[_0xecce('0x3e')]};return db[_0xecce('0x43')]['count'](_0x19b758)[_0xecce('0x24')](function(_0x4b4281){_0x4406f6[_0xecce('0x1b')]=_0x4b4281;if(_0x9fb0c1['query'][_0xecce('0x44')]){_0x4167fb[_0xecce('0x45')]=[{'all':!![]}];}return db[_0xecce('0x43')][_0xecce('0x46')](_0x4167fb);})[_0xecce('0x24')](function(_0x2c9e7b){_0x4406f6[_0xecce('0x47')]=_0x2c9e7b;return _0x4406f6;})['then'](respondWithFilteredResult(_0x5e8fb5,_0x4167fb))[_0xecce('0x48')](handleError(_0x5e8fb5,null));};exports[_0xecce('0x49')]=function(_0x593425,_0x581899){var _0x23dad5={'raw':!![],'where':{'id':_0x593425[_0xecce('0x4a')]['id']}},_0x397dc3={};_0x397dc3[_0xecce('0x37')]=_[_0xecce('0x34')](db['Sound'][_0xecce('0x2f')]);_0x397dc3['query']=_[_0xecce('0x34')](_0x593425[_0xecce('0x33')]);_0x397dc3[_0xecce('0x35')]=_[_0xecce('0x36')](_0x397dc3['model'],_0x397dc3[_0xecce('0x33')]);_0x23dad5[_0xecce('0x38')]=_[_0xecce('0x36')](_0x397dc3[_0xecce('0x37')],qs['fields'](_0x593425[_0xecce('0x33')]['fields']));_0x23dad5[_0xecce('0x38')]=_0x23dad5[_0xecce('0x38')][_0xecce('0x4b')]?_0x23dad5[_0xecce('0x38')]:_0x397dc3['model'];if(_0x593425[_0xecce('0x33')][_0xecce('0x44')]){_0x23dad5[_0xecce('0x45')]=[{'all':!![]}];}_0x23dad5=_['merge']({},_0x23dad5,_0x593425[_0xecce('0x42')]);return db[_0xecce('0x43')][_0xecce('0x4c')](_0x23dad5)[_0xecce('0x24')](handleEntityNotFound(_0x581899,null))['then'](respondWithResult(_0x581899,null))[_0xecce('0x48')](handleError(_0x581899,null));};exports[_0xecce('0x4d')]=function(_0x307177,_0x2774cf,_0x6a1b40){return db[_0xecce('0x43')]['find']({'where':{'id':_0x307177[_0xecce('0x4a')]['id']},'attributes':[_0xecce('0x2b'),_0xecce('0x4e'),'converted_format'],'raw':!![]})[_0xecce('0x24')](handleEntityNotFound(_0x2774cf,null))[_0xecce('0x24')](function(_0x1be14e){if(_0x1be14e){if(!fs[_0xecce('0x4f')](path[_0xecce('0x50')](config[_0xecce('0x51')],_0xecce('0x52'),_0x1be14e[_0xecce('0x4e')]+'.'+_0x1be14e[_0xecce('0x53')]))){throw new db[(_0xecce('0x54'))][(_0xecce('0x55'))](_0xecce('0x56'));}return _0x2774cf[_0xecce('0x4d')](path[_0xecce('0x50')](config[_0xecce('0x51')],'server/files/sounds/converted',util[_0xecce('0x57')](_0xecce('0x58'),_0x1be14e[_0xecce('0x4e')],_0x1be14e[_0xecce('0x53')])),util[_0xecce('0x57')](_0xecce('0x58'),_0x1be14e[_0xecce('0x2b')],_0x1be14e[_0xecce('0x53')]));}return null;})[_0xecce('0x48')](handleError(_0x2774cf,null));};exports[_0xecce('0x59')]=function(_0x2e9126,_0x372c8c,_0xd4276e){var _0x4bc2e5={'name':path['basename'](_0x2e9126[_0xecce('0x5a')][_0xecce('0x5b')],path[_0xecce('0x5c')](_0x2e9126[_0xecce('0x5a')]['originalname'])),'save_name':path[_0xecce('0x5d')](_0x2e9126[_0xecce('0x5a')][_0xecce('0x5e')],path['extname'](_0x2e9126[_0xecce('0x5a')][_0xecce('0x5e')])),'original_format':path[_0xecce('0x5c')](_0x2e9126[_0xecce('0x5a')][_0xecce('0x5b')])[_0xecce('0x5f')](0x1),'converted_format':_0xecce('0x60')};var _0x5c66da=path[_0xecce('0x50')](config[_0xecce('0x51')],_0xecce('0x61'),_0x2e9126['file'][_0xecce('0x5e')]);var _0x321c97=path[_0xecce('0x50')](config[_0xecce('0x51')],_0xecce('0x52'),util['format'](_0xecce('0x58'),path[_0xecce('0x5d')](_0x2e9126[_0xecce('0x5a')][_0xecce('0x5e')],path[_0xecce('0x5c')](_0x2e9126[_0xecce('0x5a')][_0xecce('0x5e')])),_0x4bc2e5['converted_format']));logger[_0xecce('0x62')](_0xecce('0x63'),_0x5c66da);logger[_0xecce('0x62')](_0xecce('0x64'),_0x321c97);try{fs[_0xecce('0x65')](_0x5c66da,parseInt(_0xecce('0x66'),0x8));var _0x4a5f5c=sox[_0xecce('0x67')](_0x5c66da,_0x321c97,{'sampleRate':0x1f40,'format':_0xecce('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4a5f5c['on'](_0xecce('0x29'),function(_0x4c4996){fs[_0xecce('0x68')](_0x5c66da);_0x372c8c[_0xecce('0x1d')](0x1f4)['send'](_0x4c4996);});_0x4a5f5c['on'](_0xecce('0x69'),function(_0x5c0755){_0x4bc2e5[_0xecce('0x6a')]=isNaN(_0x5c0755[_0xecce('0x6b')])?null:_0x5c0755[_0xecce('0x6b')]*0x3e8;_0x4bc2e5[_0xecce('0x6c')]=isNaN(_0x5c0755[_0xecce('0x6d')])?null:_0x5c0755[_0xecce('0x6d')];_0x4bc2e5['original_channelCount']=isNaN(_0x5c0755[_0xecce('0x6e')])?null:_0x5c0755[_0xecce('0x6e')];_0x4bc2e5['original_bitRate']=isNaN(_0x5c0755['bitRate'])?null:_0x5c0755['bitRate'];_0x4bc2e5['original_sampleRate']=isNaN(_0x5c0755[_0xecce('0x6f')])?null:_0x5c0755[_0xecce('0x6f')];});_0x4a5f5c['on'](_0xecce('0x70'),function(_0x14b878){_0x4bc2e5[_0xecce('0x71')]=isNaN(_0x14b878['duration'])?null:_0x14b878['duration']*0x3e8;_0x4bc2e5['converted_sampleCount']=isNaN(_0x14b878[_0xecce('0x6d')])?null:_0x14b878[_0xecce('0x6d')];_0x4bc2e5[_0xecce('0x72')]=isNaN(_0x14b878[_0xecce('0x6e')])?null:_0x14b878[_0xecce('0x6e')];_0x4bc2e5[_0xecce('0x73')]=isNaN(_0x14b878[_0xecce('0x74')])?null:_0x14b878[_0xecce('0x74')];_0x4bc2e5[_0xecce('0x75')]=isNaN(_0x14b878[_0xecce('0x6f')])?null:_0x14b878['sampleRate'];});_0x4a5f5c['on'](_0xecce('0x17'),function(){fs[_0xecce('0x65')](_0x321c97,parseInt(_0xecce('0x66'),0x8));return db[_0xecce('0x43')]['create'](_0x4bc2e5)[_0xecce('0x24')](function(_0x2e5ac9){var _0x167000={'role':_0x2e9126[_0xecce('0x76')][_0xecce('0x77')],'userProfileId':_0x2e9126[_0xecce('0x76')][_0xecce('0x78')]};if(!_0x167000)throw new Error(_0xecce('0x79'));if(_0x167000['role']==='user'){var _0x39d0e4=_0x2e5ac9[_0xecce('0x26')]({'plain':!![]});return db[_0xecce('0x7a')][_0xecce('0x4c')]({'where':{'name':'Sounds','userProfileId':_0x167000[_0xecce('0x78')]},'raw':!![]})[_0xecce('0x24')](function(_0x582f25){if(_0x582f25&&_0x582f25[_0xecce('0x7b')]===0x0){return db[_0xecce('0x27')][_0xecce('0x59')]({'name':_0x39d0e4[_0xecce('0x2b')],'resourceId':_0x39d0e4['id'],'type':_0x582f25['name'],'sectionId':_0x582f25['id']},{})['then'](function(){return _0x2e5ac9;});}else{return _0x2e5ac9;}})[_0xecce('0x48')](function(_0x17b9e3){logger['error'](_0xecce('0x7c'),_0x17b9e3);throw _0x17b9e3;});}return _0x2e5ac9;})['then'](respondWithResult(_0x372c8c,null))[_0xecce('0x48')](handleError(_0x372c8c,null));});_0x4a5f5c[_0xecce('0x7d')]();}catch(_0x278bde){_0x372c8c['status'](0x1f4)[_0xecce('0x2c')](_0x278bde);}};exports[_0xecce('0x23')]=function(_0x1d5f27,_0x2efdca,_0x3681be){return db[_0xecce('0x43')][_0xecce('0x4c')]({'where':{'id':_0x1d5f27[_0xecce('0x4a')]['id']}})[_0xecce('0x24')](handleEntityNotFound(_0x2efdca,null))[_0xecce('0x24')](saveUpdates(_[_0xecce('0x3f')](_0x1d5f27[_0xecce('0x76')],[_0xecce('0x2b'),_0xecce('0x7e')]),null))['then'](respondWithResult(_0x2efdca,null))[_0xecce('0x48')](handleError(_0x2efdca,null));};exports[_0xecce('0x7f')]=function(_0x239c8,_0x180dd0,_0x4e6c08){return db[_0xecce('0x43')]['find']({'where':{'id':_0x239c8['params']['id']}})['then'](function(_0x2ea570){if(_0x2ea570){return _0x2ea570[_0xecce('0x25')]();}})['then'](function(_0x2d494a){var _0x397912=path[_0xecce('0x50')](config[_0xecce('0x51')],_0xecce('0x61'),util[_0xecce('0x57')](_0xecce('0x58'),_0x2d494a['save_name'],_0x2d494a[_0xecce('0x80')]));var _0x2ee656=path[_0xecce('0x50')](config[_0xecce('0x51')],_0xecce('0x52'),util[_0xecce('0x57')](_0xecce('0x58'),_0x2d494a[_0xecce('0x4e')],_0x2d494a[_0xecce('0x53')]));fs[_0xecce('0x68')](_0x397912);fs['unlinkSync'](_0x2ee656);return _0x2d494a;})[_0xecce('0x24')](function(_0x3ef394){if(_0x3ef394){return _0x180dd0[_0xecce('0x1d')](0xcc)[_0xecce('0x17')]();}})[_0xecce('0x24')](handleEntityNotFound(_0x180dd0,null))[_0xecce('0x48')](handleError(_0x180dd0,null));}; \ No newline at end of file +var _0x3d51=['filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','download','server/files/sounds/converted','format','create','file','extname','basename','filename','originalname','substring','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','body','role','user','UserProfileSection','Sounds','userProfileId','autoAssociation','start','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','map','Sound','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x51d337,_0xa5c77e){var _0x47ff4d=function(_0x1dcf1b){while(--_0x1dcf1b){_0x51d337['push'](_0x51d337['shift']());}};_0x47ff4d(++_0xa5c77e);}(_0x3d51,0xbd));var _0x13d5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3d51[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x13d5('0x0'));var rimraf=require(_0x13d5('0x1'));var zipdir=require(_0x13d5('0x2'));var jsonpatch=require(_0x13d5('0x3'));var rp=require(_0x13d5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x13d5('0x5'));var util=require('util');var path=require(_0x13d5('0x6'));var sox=require(_0x13d5('0x7'));var csv=require('to-csv');var ejs=require(_0x13d5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x13d5('0x9'));var jsforce=require(_0x13d5('0xa'));var deskjs=require(_0x13d5('0xb'));var toCsv=require(_0x13d5('0xc'));var querystring=require('querystring');var Papa=require(_0x13d5('0xd'));var Redis=require(_0x13d5('0xe'));var authService=require(_0x13d5('0xf'));var qs=require(_0x13d5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13d5('0x11'));var logger=require(_0x13d5('0x12'))(_0x13d5('0x13'));var utils=require(_0x13d5('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20b912,_0x524a50){_0x524a50=_0x524a50||0xcc;return function(_0x206336){if(_0x206336){return _0x20b912['sendStatus'](_0x524a50);}return _0x20b912[_0x13d5('0x15')](_0x524a50)[_0x13d5('0x16')]();};}function respondWithResult(_0x57a3fc,_0x1c7ba2){_0x1c7ba2=_0x1c7ba2||0xc8;return function(_0x5a2228){if(_0x5a2228){return _0x57a3fc[_0x13d5('0x15')](_0x1c7ba2)[_0x13d5('0x17')](_0x5a2228);}};}function respondWithFilteredResult(_0x328219,_0x371d06){return function(_0x28c9c1){if(_0x28c9c1){var _0x516dfa=typeof _0x371d06[_0x13d5('0x18')]==='undefined'&&typeof _0x371d06[_0x13d5('0x19')]==='undefined';var _0x1aadfd=_0x28c9c1[_0x13d5('0x1a')];var _0x1080d2=_0x516dfa?0x0:_0x371d06[_0x13d5('0x18')];var _0x7ce20e=_0x516dfa?_0x28c9c1[_0x13d5('0x1a')]:_0x371d06[_0x13d5('0x18')]+_0x371d06[_0x13d5('0x19')];var _0x214248;if(_0x7ce20e>=_0x1aadfd){_0x7ce20e=_0x1aadfd;_0x214248=0xc8;}else{_0x214248=0xce;}_0x328219[_0x13d5('0x15')](_0x214248);return _0x328219[_0x13d5('0x1b')](_0x13d5('0x1c'),_0x1080d2+'-'+_0x7ce20e+'/'+_0x1aadfd)[_0x13d5('0x17')](_0x28c9c1);}return null;};}function patchUpdates(_0x577645){return function(_0x1fb636){try{jsonpatch[_0x13d5('0x1d')](_0x1fb636,_0x577645,!![]);}catch(_0x309155){return BPromise['reject'](_0x309155);}return _0x1fb636[_0x13d5('0x1e')]();};}function saveUpdates(_0x357984,_0x107bb9){return function(_0x9591ec){if(_0x9591ec){return _0x9591ec[_0x13d5('0x1f')](_0x357984)[_0x13d5('0x20')](function(_0x11a052){return _0x11a052;});}return null;};}function removeEntity(_0xbaf0d5,_0x4be79b){return function(_0x58e585){if(_0x58e585){return _0x58e585[_0x13d5('0x21')]()[_0x13d5('0x20')](function(){var _0x2454e7=_0x58e585[_0x13d5('0x22')]({'plain':!![]});var _0x2dece2='Sounds';return db[_0x13d5('0x23')][_0x13d5('0x21')]({'where':{'type':_0x2dece2,'resourceId':_0x2454e7['id']}})['then'](function(){return _0x58e585;});})['then'](function(){_0xbaf0d5[_0x13d5('0x15')](0xcc)[_0x13d5('0x16')]();});}};}function handleEntityNotFound(_0x2a02b9,_0x4db8ee){return function(_0x152c7e){if(!_0x152c7e){_0x2a02b9['sendStatus'](0x194);}return _0x152c7e;};}function handleError(_0x2cb808,_0x131e22){_0x131e22=_0x131e22||0x1f4;return function(_0x2aab02){logger[_0x13d5('0x24')](_0x2aab02['stack']);if(_0x2aab02[_0x13d5('0x25')]){delete _0x2aab02['name'];}_0x2cb808[_0x13d5('0x15')](_0x131e22)[_0x13d5('0x26')](_0x2aab02);};}exports['index']=function(_0x42fcd9,_0x4fd09a){var _0x3f3883={},_0x553b4b={},_0x142829={'count':0x0,'rows':[]};var _0x706153=_[_0x13d5('0x27')](db[_0x13d5('0x28')][_0x13d5('0x29')],function(_0x3a77dc){return{'name':_0x3a77dc[_0x13d5('0x2a')],'type':_0x3a77dc['type']['key']};});_0x553b4b[_0x13d5('0x2b')]=_[_0x13d5('0x27')](_0x706153,_0x13d5('0x25'));_0x553b4b[_0x13d5('0x2c')]=_[_0x13d5('0x2d')](_0x42fcd9['query']);_0x553b4b[_0x13d5('0x2e')]=_['intersection'](_0x553b4b[_0x13d5('0x2b')],_0x553b4b[_0x13d5('0x2c')]);_0x3f3883['attributes']=_[_0x13d5('0x2f')](_0x553b4b['model'],qs[_0x13d5('0x30')](_0x42fcd9['query'][_0x13d5('0x30')]));_0x3f3883[_0x13d5('0x31')]=_0x3f3883[_0x13d5('0x31')][_0x13d5('0x32')]?_0x3f3883[_0x13d5('0x31')]:_0x553b4b['model'];if(!_0x42fcd9[_0x13d5('0x2c')][_0x13d5('0x33')](_0x13d5('0x34'))){_0x3f3883[_0x13d5('0x19')]=qs[_0x13d5('0x19')](_0x42fcd9[_0x13d5('0x2c')]['limit']);_0x3f3883[_0x13d5('0x18')]=qs[_0x13d5('0x18')](_0x42fcd9[_0x13d5('0x2c')][_0x13d5('0x18')]);}_0x3f3883[_0x13d5('0x35')]=qs[_0x13d5('0x36')](_0x42fcd9[_0x13d5('0x2c')][_0x13d5('0x36')]);_0x3f3883[_0x13d5('0x37')]=qs['filters'](_[_0x13d5('0x38')](_0x42fcd9[_0x13d5('0x2c')],_0x553b4b[_0x13d5('0x2e')]),_0x706153);if(_0x42fcd9[_0x13d5('0x2c')][_0x13d5('0x39')]){_0x3f3883['where']=_['merge'](_0x3f3883['where'],{'$or':_[_0x13d5('0x27')](_0x706153,function(_0x47b905){if(_0x47b905[_0x13d5('0x3a')]!==_0x13d5('0x3b')){var _0xcdbb72={};_0xcdbb72[_0x47b905['name']]={'$like':'%'+_0x42fcd9[_0x13d5('0x2c')][_0x13d5('0x39')]+'%'};return _0xcdbb72;}})});}_0x3f3883=_[_0x13d5('0x3c')]({},_0x3f3883,_0x42fcd9[_0x13d5('0x3d')]);var _0x98217b={'where':_0x3f3883[_0x13d5('0x37')]};return db[_0x13d5('0x28')][_0x13d5('0x1a')](_0x98217b)[_0x13d5('0x20')](function(_0x272274){_0x142829[_0x13d5('0x1a')]=_0x272274;if(_0x42fcd9[_0x13d5('0x2c')]['includeAll']){_0x3f3883[_0x13d5('0x3e')]=[{'all':!![]}];}return db[_0x13d5('0x28')][_0x13d5('0x3f')](_0x3f3883);})[_0x13d5('0x20')](function(_0x1797d1){_0x142829[_0x13d5('0x40')]=_0x1797d1;return _0x142829;})[_0x13d5('0x20')](respondWithFilteredResult(_0x4fd09a,_0x3f3883))[_0x13d5('0x41')](handleError(_0x4fd09a,null));};exports[_0x13d5('0x42')]=function(_0x2c9bb2,_0x3aa0dd){var _0x480427={'raw':!![],'where':{'id':_0x2c9bb2[_0x13d5('0x43')]['id']}},_0x254ff5={};_0x254ff5['model']=_[_0x13d5('0x2d')](db[_0x13d5('0x28')][_0x13d5('0x29')]);_0x254ff5[_0x13d5('0x2c')]=_[_0x13d5('0x2d')](_0x2c9bb2[_0x13d5('0x2c')]);_0x254ff5[_0x13d5('0x2e')]=_[_0x13d5('0x2f')](_0x254ff5[_0x13d5('0x2b')],_0x254ff5[_0x13d5('0x2c')]);_0x480427[_0x13d5('0x31')]=_['intersection'](_0x254ff5['model'],qs['fields'](_0x2c9bb2[_0x13d5('0x2c')][_0x13d5('0x30')]));_0x480427[_0x13d5('0x31')]=_0x480427[_0x13d5('0x31')][_0x13d5('0x32')]?_0x480427[_0x13d5('0x31')]:_0x254ff5['model'];if(_0x2c9bb2['query'][_0x13d5('0x44')]){_0x480427[_0x13d5('0x3e')]=[{'all':!![]}];}_0x480427=_['merge']({},_0x480427,_0x2c9bb2[_0x13d5('0x3d')]);return db[_0x13d5('0x28')][_0x13d5('0x45')](_0x480427)['then'](handleEntityNotFound(_0x3aa0dd,null))[_0x13d5('0x20')](respondWithResult(_0x3aa0dd,null))[_0x13d5('0x41')](handleError(_0x3aa0dd,null));};exports['download']=function(_0x812d99,_0x1cff8d,_0x93c133){return db['Sound'][_0x13d5('0x45')]({'where':{'id':_0x812d99['params']['id']},'attributes':['name',_0x13d5('0x46'),_0x13d5('0x47')],'raw':!![]})[_0x13d5('0x20')](handleEntityNotFound(_0x1cff8d,null))[_0x13d5('0x20')](function(_0x4f80e6){if(_0x4f80e6){if(!fs[_0x13d5('0x48')](path[_0x13d5('0x49')](config[_0x13d5('0x4a')],'server/files/sounds/converted',_0x4f80e6['save_name']+'.'+_0x4f80e6[_0x13d5('0x47')]))){throw new db[(_0x13d5('0x4b'))][(_0x13d5('0x4c'))](_0x13d5('0x4d'));}return _0x1cff8d[_0x13d5('0x4e')](path[_0x13d5('0x49')](config[_0x13d5('0x4a')],_0x13d5('0x4f'),util[_0x13d5('0x50')]('%s.%s',_0x4f80e6[_0x13d5('0x46')],_0x4f80e6[_0x13d5('0x47')])),util[_0x13d5('0x50')]('%s.%s',_0x4f80e6[_0x13d5('0x25')],_0x4f80e6[_0x13d5('0x47')]));}return null;})[_0x13d5('0x41')](handleError(_0x1cff8d,null));};exports[_0x13d5('0x51')]=function(_0x5ef1bd,_0x54c342,_0x101010){var _0x5d6f27={'name':path['basename'](_0x5ef1bd[_0x13d5('0x52')]['originalname'],path[_0x13d5('0x53')](_0x5ef1bd['file']['originalname'])),'save_name':path[_0x13d5('0x54')](_0x5ef1bd['file'][_0x13d5('0x55')],path['extname'](_0x5ef1bd[_0x13d5('0x52')]['filename'])),'original_format':path[_0x13d5('0x53')](_0x5ef1bd[_0x13d5('0x52')][_0x13d5('0x56')])[_0x13d5('0x57')](0x1),'converted_format':_0x13d5('0x58')};var _0x2b2ed5=path[_0x13d5('0x49')](config[_0x13d5('0x4a')],_0x13d5('0x59'),_0x5ef1bd[_0x13d5('0x52')][_0x13d5('0x55')]);var _0x50d08f=path[_0x13d5('0x49')](config[_0x13d5('0x4a')],_0x13d5('0x4f'),util[_0x13d5('0x50')](_0x13d5('0x5a'),path[_0x13d5('0x54')](_0x5ef1bd[_0x13d5('0x52')]['filename'],path[_0x13d5('0x53')](_0x5ef1bd['file'][_0x13d5('0x55')])),_0x5d6f27[_0x13d5('0x47')]));logger[_0x13d5('0x5b')](_0x13d5('0x5c'),_0x2b2ed5);logger[_0x13d5('0x5b')](_0x13d5('0x5d'),_0x50d08f);try{fs[_0x13d5('0x5e')](_0x2b2ed5,parseInt('0777',0x8));var _0x44deac=sox[_0x13d5('0x5f')](_0x2b2ed5,_0x50d08f,{'sampleRate':0x1f40,'format':_0x13d5('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44deac['on'](_0x13d5('0x24'),function(_0x496d4c){fs[_0x13d5('0x60')](_0x2b2ed5);_0x54c342[_0x13d5('0x15')](0x1f4)[_0x13d5('0x26')](_0x496d4c);});_0x44deac['on'](_0x13d5('0x61'),function(_0x1435b2){_0x5d6f27[_0x13d5('0x62')]=isNaN(_0x1435b2[_0x13d5('0x63')])?null:_0x1435b2['duration']*0x3e8;_0x5d6f27[_0x13d5('0x64')]=isNaN(_0x1435b2[_0x13d5('0x65')])?null:_0x1435b2[_0x13d5('0x65')];_0x5d6f27[_0x13d5('0x66')]=isNaN(_0x1435b2[_0x13d5('0x67')])?null:_0x1435b2[_0x13d5('0x67')];_0x5d6f27[_0x13d5('0x68')]=isNaN(_0x1435b2['bitRate'])?null:_0x1435b2[_0x13d5('0x69')];_0x5d6f27[_0x13d5('0x6a')]=isNaN(_0x1435b2[_0x13d5('0x6b')])?null:_0x1435b2[_0x13d5('0x6b')];});_0x44deac['on']('dest',function(_0x41a233){_0x5d6f27[_0x13d5('0x6c')]=isNaN(_0x41a233[_0x13d5('0x63')])?null:_0x41a233[_0x13d5('0x63')]*0x3e8;_0x5d6f27[_0x13d5('0x6d')]=isNaN(_0x41a233[_0x13d5('0x65')])?null:_0x41a233['sampleCount'];_0x5d6f27[_0x13d5('0x6e')]=isNaN(_0x41a233[_0x13d5('0x67')])?null:_0x41a233[_0x13d5('0x67')];_0x5d6f27['converted_bitRate']=isNaN(_0x41a233['bitRate'])?null:_0x41a233[_0x13d5('0x69')];_0x5d6f27[_0x13d5('0x6f')]=isNaN(_0x41a233['sampleRate'])?null:_0x41a233['sampleRate'];});_0x44deac['on']('end',function(){fs[_0x13d5('0x5e')](_0x50d08f,parseInt(_0x13d5('0x70'),0x8));return db[_0x13d5('0x28')][_0x13d5('0x51')](_0x5d6f27)['then'](function(_0x34f8bf){var _0xb7d84e={'role':_0x5ef1bd[_0x13d5('0x71')][_0x13d5('0x72')],'userProfileId':_0x5ef1bd[_0x13d5('0x71')]['userProfileId']};if(!_0xb7d84e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb7d84e[_0x13d5('0x72')]===_0x13d5('0x73')){var _0x4a4234=_0x34f8bf['get']({'plain':!![]});return db[_0x13d5('0x74')][_0x13d5('0x45')]({'where':{'name':_0x13d5('0x75'),'userProfileId':_0xb7d84e[_0x13d5('0x76')]},'raw':!![]})[_0x13d5('0x20')](function(_0x127a83){if(_0x127a83&&_0x127a83[_0x13d5('0x77')]===0x0){return db[_0x13d5('0x23')][_0x13d5('0x51')]({'name':_0x4a4234[_0x13d5('0x25')],'resourceId':_0x4a4234['id'],'type':_0x127a83[_0x13d5('0x25')],'sectionId':_0x127a83['id']},{})[_0x13d5('0x20')](function(){return _0x34f8bf;});}else{return _0x34f8bf;}})[_0x13d5('0x41')](function(_0x5ecf1f){logger[_0x13d5('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ecf1f);throw _0x5ecf1f;});}return _0x34f8bf;})['then'](respondWithResult(_0x54c342,null))[_0x13d5('0x41')](handleError(_0x54c342,null));});_0x44deac[_0x13d5('0x78')]();}catch(_0x4b2a58){_0x54c342[_0x13d5('0x15')](0x1f4)['send'](_0x4b2a58);}};exports[_0x13d5('0x1f')]=function(_0x3d66df,_0xe07815,_0x103b0d){return db[_0x13d5('0x28')][_0x13d5('0x45')]({'where':{'id':_0x3d66df[_0x13d5('0x43')]['id']}})[_0x13d5('0x20')](handleEntityNotFound(_0xe07815,null))[_0x13d5('0x20')](saveUpdates(_[_0x13d5('0x38')](_0x3d66df[_0x13d5('0x71')],[_0x13d5('0x25'),_0x13d5('0x79')]),null))['then'](respondWithResult(_0xe07815,null))['catch'](handleError(_0xe07815,null));};exports['delete']=function(_0x22a735,_0x4b425e,_0x3b318d){return db['Sound']['find']({'where':{'id':_0x22a735[_0x13d5('0x43')]['id']}})[_0x13d5('0x20')](function(_0x5f2dc5){if(_0x5f2dc5){return _0x5f2dc5['destroy']();}})['then'](function(_0x3f1eb0){var _0x144d48=path['join'](config[_0x13d5('0x4a')],_0x13d5('0x59'),util[_0x13d5('0x50')](_0x13d5('0x5a'),_0x3f1eb0[_0x13d5('0x46')],_0x3f1eb0[_0x13d5('0x7a')]));var _0x21f4a6=path[_0x13d5('0x49')](config['root'],'server/files/sounds/converted',util['format'](_0x13d5('0x5a'),_0x3f1eb0[_0x13d5('0x46')],_0x3f1eb0[_0x13d5('0x47')]));fs[_0x13d5('0x60')](_0x144d48);fs[_0x13d5('0x60')](_0x21f4a6);return _0x3f1eb0;})['then'](function(_0x4cdd32){if(_0x4cdd32){return _0x4b425e[_0x13d5('0x15')](0xcc)[_0x13d5('0x16')]();}})[_0x13d5('0x20')](handleEntityNotFound(_0x4b425e,null))[_0x13d5('0x41')](handleError(_0x4b425e,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 293d78f..5b91278 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 _0xc529=['bluebird','request-promise','../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','api','moment'];(function(_0x8968fc,_0x2b1fee){var _0x273828=function(_0x3ab518){while(--_0x3ab518){_0x8968fc['push'](_0x8968fc['shift']());}};_0x273828(++_0x2b1fee);}(_0xc529,0x193));var _0x9c52=function(_0x3a7258,_0x4f9d4f){_0x3a7258=_0x3a7258-0x0;var _0x2f6012=_0xc529[_0x3a7258];return _0x2f6012;};'use strict';var _=require(_0x9c52('0x0'));var util=require(_0x9c52('0x1'));var logger=require('../../config/logger')(_0x9c52('0x2'));var moment=require(_0x9c52('0x3'));var BPromise=require(_0x9c52('0x4'));var rp=require(_0x9c52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9c52('0x6'));var attributes=require(_0x9c52('0x7'));module[_0x9c52('0x8')]=function(_0x24900f,_0x232e47){return _0x24900f[_0x9c52('0x9')](_0x9c52('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c26=['path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','moment','bluebird','request-promise'];(function(_0x284c97,_0x4ebc1c){var _0x2a8cd8=function(_0x57aae7){while(--_0x57aae7){_0x284c97['push'](_0x284c97['shift']());}};_0x2a8cd8(++_0x4ebc1c);}(_0x4c26,0xe5));var _0x64c2=function(_0x39e6e0,_0x5e6ea5){_0x39e6e0=_0x39e6e0-0x0;var _0xe22b60=_0x4c26[_0x39e6e0];return _0xe22b60;};'use strict';var _=require(_0x64c2('0x0'));var util=require(_0x64c2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x64c2('0x2'));var BPromise=require(_0x64c2('0x3'));var rp=require(_0x64c2('0x4'));var fs=require('fs');var path=require(_0x64c2('0x5'));var rimraf=require(_0x64c2('0x6'));var config=require(_0x64c2('0x7'));var attributes=require(_0x64c2('0x8'));module[_0x64c2('0x9')]=function(_0x7256c6,_0x3fca0b){return _0x7256c6[_0x64c2('0xa')](_0x64c2('0xb'),attributes,{'tableName':_0x64c2('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 5093d1a..418c242 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 _0x2690=['message','catch','ShowSound','Sound','find','options','where','include','map','attributes','model','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error'];(function(_0x2cecd4,_0x33dc5c){var _0x4e2d20=function(_0x50ba58){while(--_0x50ba58){_0x2cecd4['push'](_0x2cecd4['shift']());}};_0x4e2d20(++_0x33dc5c);}(_0x2690,0x185));var _0x0269=function(_0x455f19,_0x4f8f3a){_0x455f19=_0x455f19-0x0;var _0x422f21=_0x2690[_0x455f19];return _0x422f21;};'use strict';var _=require(_0x0269('0x0'));var util=require(_0x0269('0x1'));var moment=require(_0x0269('0x2'));var BPromise=require(_0x0269('0x3'));var rs=require(_0x0269('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0269('0x5'))['db'];var utils=require(_0x0269('0x6'));var logger=require(_0x0269('0x7'))('rpc');var config=require(_0x0269('0x8'));var jayson=require(_0x0269('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46b29c,_0x1c8bf2,_0x70a059){return new BPromise(function(_0x3e7ccb,_0x429612){return client[_0x0269('0xa')](_0x46b29c,_0x70a059)[_0x0269('0xb')](function(_0x473066){logger['info'](_0x0269('0xc'),_0x1c8bf2,_0x0269('0xd'));logger[_0x0269('0xe')](_0x0269('0xf'),_0x1c8bf2,_0x0269('0xd'),JSON['stringify'](_0x473066));if(_0x473066['error']){if(_0x473066[_0x0269('0x10')]['code']===0x1f4){logger[_0x0269('0x10')]('Sound,\x20%s,\x20%s',_0x1c8bf2,_0x473066['error']['message']);return _0x429612(_0x473066[_0x0269('0x10')][_0x0269('0x11')]);}logger[_0x0269('0x10')]('Sound,\x20%s,\x20%s',_0x1c8bf2,_0x473066['error']['message']);return _0x3e7ccb(_0x473066['error']['message']);}else{logger['info'](_0x0269('0xc'),_0x1c8bf2,'request\x20sent');_0x3e7ccb(_0x473066['result'][_0x0269('0x11')]);}})[_0x0269('0x12')](function(_0x3c82df){logger['error'](_0x0269('0xc'),_0x1c8bf2,_0x3c82df);_0x429612(_0x3c82df);});});}exports[_0x0269('0x13')]=function(_0x19afea){var _0x2fb440=this;return new Promise(function(_0x92a615,_0x15f4d8){return db[_0x0269('0x14')][_0x0269('0x15')]({'raw':_0x19afea[_0x0269('0x16')]?_0x19afea[_0x0269('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x19afea['options']?_0x19afea['options'][_0x0269('0x17')]||null:null,'attributes':_0x19afea[_0x0269('0x16')]?_0x19afea['options']['attributes']||null:null,'include':_0x19afea['options']?_0x19afea[_0x0269('0x16')][_0x0269('0x18')]?_[_0x0269('0x19')](_0x19afea['options']['include'],function(_0x4d15a4){return{'model':db[_0x4d15a4['model']],'as':_0x4d15a4['as'],'attributes':_0x4d15a4[_0x0269('0x1a')],'include':_0x4d15a4['include']?_[_0x0269('0x19')](_0x4d15a4[_0x0269('0x18')],function(_0x2ff81c){return{'model':db[_0x2ff81c[_0x0269('0x1b')]],'as':_0x2ff81c['as'],'attributes':_0x2ff81c['attributes'],'include':_0x2ff81c[_0x0269('0x18')]?_[_0x0269('0x19')](_0x2ff81c[_0x0269('0x18')],function(_0x1e39c2){return{'model':db[_0x1e39c2[_0x0269('0x1b')]],'as':_0x1e39c2['as'],'attributes':_0x1e39c2[_0x0269('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x181368){logger['info'](_0x0269('0x13'),_0x19afea);logger[_0x0269('0xe')](_0x0269('0x13'),_0x19afea,JSON[_0x0269('0x1c')](_0x181368));_0x92a615(_0x181368);})['catch'](function(_0xe2aed5){logger['error'](_0x0269('0x13'),_0xe2aed5[_0x0269('0x11')],_0x19afea);_0x15f4d8(_0x2fb440[_0x0269('0x10')](0x1f4,_0xe2aed5[_0x0269('0x11')]));});});}; \ No newline at end of file +var _0xee01=['request\x20sent','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','model','map','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xee01,0x18f));var _0x1ee0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xee01[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1ee0('0x0'));var util=require(_0x1ee0('0x1'));var moment=require(_0x1ee0('0x2'));var BPromise=require(_0x1ee0('0x3'));var rs=require(_0x1ee0('0x4'));var fs=require('fs');var Redis=require(_0x1ee0('0x5'));var db=require(_0x1ee0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ee0('0x7'))(_0x1ee0('0x8'));var config=require(_0x1ee0('0x9'));var jayson=require(_0x1ee0('0xa'));var client=jayson[_0x1ee0('0xb')][_0x1ee0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x44261b,_0x3f63f4,_0x353d94){return new BPromise(function(_0x1b320f,_0x17feb6){return client['request'](_0x44261b,_0x353d94)[_0x1ee0('0xd')](function(_0x1e1a29){logger['info'](_0x1ee0('0xe'),_0x3f63f4,'request\x20sent');logger[_0x1ee0('0xf')](_0x1ee0('0x10'),_0x3f63f4,'request\x20sent',JSON[_0x1ee0('0x11')](_0x1e1a29));if(_0x1e1a29[_0x1ee0('0x12')]){if(_0x1e1a29[_0x1ee0('0x12')][_0x1ee0('0x13')]===0x1f4){logger[_0x1ee0('0x12')]('Sound,\x20%s,\x20%s',_0x3f63f4,_0x1e1a29[_0x1ee0('0x12')][_0x1ee0('0x14')]);return _0x17feb6(_0x1e1a29[_0x1ee0('0x12')][_0x1ee0('0x14')]);}logger[_0x1ee0('0x12')](_0x1ee0('0xe'),_0x3f63f4,_0x1e1a29[_0x1ee0('0x12')]['message']);return _0x1b320f(_0x1e1a29['error'][_0x1ee0('0x14')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x3f63f4,_0x1ee0('0x15'));_0x1b320f(_0x1e1a29[_0x1ee0('0x16')][_0x1ee0('0x14')]);}})[_0x1ee0('0x17')](function(_0x66ab4e){logger[_0x1ee0('0x12')](_0x1ee0('0xe'),_0x3f63f4,_0x66ab4e);_0x17feb6(_0x66ab4e);});});}exports[_0x1ee0('0x18')]=function(_0x4f3728){var _0x4e0aab=this;return new Promise(function(_0x4abd47,_0x52e692){return db[_0x1ee0('0x19')][_0x1ee0('0x1a')]({'raw':_0x4f3728['options']?_0x4f3728[_0x1ee0('0x1b')][_0x1ee0('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f3728[_0x1ee0('0x1b')]?_0x4f3728['options'][_0x1ee0('0x1d')]||null:null,'attributes':_0x4f3728[_0x1ee0('0x1b')]?_0x4f3728[_0x1ee0('0x1b')][_0x1ee0('0x1e')]||null:null,'include':_0x4f3728[_0x1ee0('0x1b')]?_0x4f3728['options'][_0x1ee0('0x1f')]?_['map'](_0x4f3728[_0x1ee0('0x1b')][_0x1ee0('0x1f')],function(_0x427b30){return{'model':db[_0x427b30[_0x1ee0('0x20')]],'as':_0x427b30['as'],'attributes':_0x427b30[_0x1ee0('0x1e')],'include':_0x427b30['include']?_[_0x1ee0('0x21')](_0x427b30['include'],function(_0x4af40a){return{'model':db[_0x4af40a[_0x1ee0('0x20')]],'as':_0x4af40a['as'],'attributes':_0x4af40a[_0x1ee0('0x1e')],'include':_0x4af40a[_0x1ee0('0x1f')]?_[_0x1ee0('0x21')](_0x4af40a[_0x1ee0('0x1f')],function(_0x7e8805){return{'model':db[_0x7e8805[_0x1ee0('0x20')]],'as':_0x7e8805['as'],'attributes':_0x7e8805[_0x1ee0('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e3173){logger[_0x1ee0('0x22')]('ShowSound',_0x4f3728);logger['debug']('ShowSound',_0x4f3728,JSON[_0x1ee0('0x11')](_0x2e3173));_0x4abd47(_0x2e3173);})[_0x1ee0('0x17')](function(_0x1ce2eb){logger[_0x1ee0('0x12')](_0x1ee0('0x18'),_0x1ce2eb['message'],_0x4f3728);_0x52e692(_0x4e0aab[_0x1ee0('0x12')](0x1f4,_0x1ce2eb['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7c2243b..6164866 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(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0xda3f,0xec));var _0xfda3=function(_0x3910c8,_0xc063c8){_0x3910c8=_0x3910c8-0x0;var _0x596df2=_0xda3f[_0x3910c8];return _0x596df2;};'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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x743143,_0x429e0e){var _0x4d039a=function(_0x1936be){while(--_0x1936be){_0x743143['push'](_0x743143['shift']());}};_0x4d039a(++_0x429e0e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 70eb027..a3eee27 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 _0xba44=['STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x39748b,_0x303463){var _0x341bad=function(_0x15161c){while(--_0x15161c){_0x39748b['push'](_0x39748b['shift']());}};_0x341bad(++_0x303463);}(_0xba44,0xbf));var _0x4ba4=function(_0x24f7e0,_0x210411){_0x24f7e0=_0x24f7e0-0x0;var _0x49f0d0=_0xba44[_0x24f7e0];return _0x49f0d0;};'use strict';var Sequelize=require(_0x4ba4('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4ba4('0x1')]},'body':{'type':Sequelize[_0x4ba4('0x2')](_0x4ba4('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x4ba4('0x4')]('in',_0x4ba4('0x5')),'defaultValue':_0x4ba4('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4ba4('0x2')]}}; \ No newline at end of file +var _0x8d28=['STRING','TEXT','out','sequelize','exports'];(function(_0x391507,_0x564142){var _0x47fdc4=function(_0x2bc946){while(--_0x2bc946){_0x391507['push'](_0x391507['shift']());}};_0x47fdc4(++_0x564142);}(_0x8d28,0x10c));var _0x88d2=function(_0x5bd9b3,_0x38981d){_0x5bd9b3=_0x5bd9b3-0x0;var _0x5101c3=_0x8d28[_0x5bd9b3];return _0x5101c3;};'use strict';var Sequelize=require(_0x88d2('0x0'));module[_0x88d2('0x1')]={'uniqueid':{'type':Sequelize[_0x88d2('0x2')]},'body':{'type':Sequelize[_0x88d2('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x88d2('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x88d2('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 61a2480..2736877 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 _0x945e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','length','attributes','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','intersection','fields','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x136a60,_0x5bb51b){var _0xc72bc2=function(_0xdc9201){while(--_0xdc9201){_0x136a60['push'](_0x136a60['shift']());}};_0xc72bc2(++_0x5bb51b);}(_0x945e,0xca));var _0xe945=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x945e[_0xd0b415];return _0x2bdf2c;};'use strict';var emlformat=require(_0xe945('0x0'));var rimraf=require(_0xe945('0x1'));var zipdir=require(_0xe945('0x2'));var jsonpatch=require(_0xe945('0x3'));var rp=require(_0xe945('0x4'));var moment=require(_0xe945('0x5'));var BPromise=require(_0xe945('0x6'));var Mustache=require(_0xe945('0x7'));var util=require(_0xe945('0x8'));var path=require('path');var sox=require(_0xe945('0x9'));var csv=require(_0xe945('0xa'));var ejs=require(_0xe945('0xb'));var fs=require('fs');var fs_extra=require(_0xe945('0xc'));var _=require(_0xe945('0xd'));var squel=require(_0xe945('0xe'));var crypto=require(_0xe945('0xf'));var jsforce=require(_0xe945('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe945('0x11'));var Redis=require(_0xe945('0x12'));var authService=require(_0xe945('0x13'));var qs=require(_0xe945('0x14'));var as=require(_0xe945('0x15'));var hardwareService=require(_0xe945('0x16'));var logger=require(_0xe945('0x17'))(_0xe945('0x18'));var utils=require(_0xe945('0x19'));var config=require(_0xe945('0x1a'));var licenseUtil=require(_0xe945('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54266d,_0xb9b789){_0xb9b789=_0xb9b789||0xcc;return function(_0x5d9731){if(_0x5d9731){return _0x54266d[_0xe945('0x1c')](_0xb9b789);}return _0x54266d[_0xe945('0x1d')](_0xb9b789)[_0xe945('0x1e')]();};}function respondWithResult(_0x277a80,_0x123362){_0x123362=_0x123362||0xc8;return function(_0x477827){if(_0x477827){return _0x277a80['status'](_0x123362)[_0xe945('0x1f')](_0x477827);}};}function respondWithFilteredResult(_0x1b0130,_0x4fe162){return function(_0x11d1c3){if(_0x11d1c3){var _0x20042f=typeof _0x4fe162[_0xe945('0x20')]===_0xe945('0x21')&&typeof _0x4fe162[_0xe945('0x22')]===_0xe945('0x21');var _0x5c82f9=_0x11d1c3[_0xe945('0x23')];var _0xfbf1f5=_0x20042f?0x0:_0x4fe162[_0xe945('0x20')];var _0x5c438d=_0x20042f?_0x11d1c3[_0xe945('0x23')]:_0x4fe162[_0xe945('0x20')]+_0x4fe162[_0xe945('0x22')];var _0x23d833;if(_0x5c438d>=_0x5c82f9){_0x5c438d=_0x5c82f9;_0x23d833=0xc8;}else{_0x23d833=0xce;}_0x1b0130[_0xe945('0x1d')](_0x23d833);return _0x1b0130[_0xe945('0x24')]('Content-Range',_0xfbf1f5+'-'+_0x5c438d+'/'+_0x5c82f9)['json'](_0x11d1c3);}return null;};}function patchUpdates(_0x194a4a){return function(_0x4572ab){try{jsonpatch[_0xe945('0x25')](_0x4572ab,_0x194a4a,!![]);}catch(_0x4b3507){return BPromise['reject'](_0x4b3507);}return _0x4572ab[_0xe945('0x26')]();};}function saveUpdates(_0x5bd12e,_0x432d7e){return function(_0x3b1a2c){if(_0x3b1a2c){return _0x3b1a2c[_0xe945('0x27')](_0x5bd12e)['then'](function(_0x4d927c){return _0x4d927c;});}return null;};}function removeEntity(_0x10e890,_0x231673){return function(_0x71fc74){if(_0x71fc74){return _0x71fc74[_0xe945('0x28')]()[_0xe945('0x29')](function(){_0x10e890[_0xe945('0x1d')](0xcc)[_0xe945('0x1e')]();});}};}function handleEntityNotFound(_0x55efc5,_0x260fbc){return function(_0x1aee5b){if(!_0x1aee5b){_0x55efc5[_0xe945('0x1c')](0x194);}return _0x1aee5b;};}function handleError(_0x19307b,_0x246fc2){_0x246fc2=_0x246fc2||0x1f4;return function(_0xc58f1f){logger['error'](_0xc58f1f[_0xe945('0x2a')]);if(_0xc58f1f[_0xe945('0x2b')]){delete _0xc58f1f[_0xe945('0x2b')];}_0x19307b[_0xe945('0x1d')](_0x246fc2)['send'](_0xc58f1f);};}exports[_0xe945('0x2c')]=function(_0x5c0ec9,_0x108868){var _0x3ade55={},_0x5e76f3={},_0x5b002d={'count':0x0,'rows':[]};var _0x430e2f=_[_0xe945('0x2d')](db[_0xe945('0x2e')][_0xe945('0x2f')],function(_0x3d16f7){return{'name':_0x3d16f7[_0xe945('0x30')],'type':_0x3d16f7[_0xe945('0x31')][_0xe945('0x32')]};});_0x5e76f3[_0xe945('0x33')]=_[_0xe945('0x2d')](_0x430e2f,'name');_0x5e76f3[_0xe945('0x34')]=_[_0xe945('0x35')](_0x5c0ec9['query']);_0x5e76f3[_0xe945('0x36')]=_['intersection'](_0x5e76f3[_0xe945('0x33')],_0x5e76f3[_0xe945('0x34')]);_0x3ade55['attributes']=_['intersection'](_0x5e76f3['model'],qs['fields'](_0x5c0ec9[_0xe945('0x34')]['fields']));_0x3ade55['attributes']=_0x3ade55['attributes'][_0xe945('0x37')]?_0x3ade55[_0xe945('0x38')]:_0x5e76f3[_0xe945('0x33')];if(!_0x5c0ec9[_0xe945('0x34')]['hasOwnProperty'](_0xe945('0x39'))){_0x3ade55[_0xe945('0x22')]=qs[_0xe945('0x22')](_0x5c0ec9[_0xe945('0x34')]['limit']);_0x3ade55['offset']=qs[_0xe945('0x20')](_0x5c0ec9[_0xe945('0x34')][_0xe945('0x20')]);}_0x3ade55['order']=qs[_0xe945('0x3a')](_0x5c0ec9[_0xe945('0x34')][_0xe945('0x3a')]);_0x3ade55[_0xe945('0x3b')]=qs[_0xe945('0x36')](_[_0xe945('0x3c')](_0x5c0ec9[_0xe945('0x34')],_0x5e76f3[_0xe945('0x36')]),_0x430e2f);if(_0x5c0ec9[_0xe945('0x34')]['filter']){_0x3ade55['where']=_[_0xe945('0x3d')](_0x3ade55[_0xe945('0x3b')],{'$or':_[_0xe945('0x2d')](_0x430e2f,function(_0x465c5e){if(_0x465c5e[_0xe945('0x31')]!==_0xe945('0x3e')){var _0x18a917={};_0x18a917[_0x465c5e[_0xe945('0x2b')]]={'$like':'%'+_0x5c0ec9[_0xe945('0x34')]['filter']+'%'};return _0x18a917;}})});}_0x3ade55=_['merge']({},_0x3ade55,_0x5c0ec9['options']);var _0x17cc66={'where':_0x3ade55['where']};return db[_0xe945('0x2e')][_0xe945('0x23')](_0x17cc66)['then'](function(_0x3e1ed3){_0x5b002d[_0xe945('0x23')]=_0x3e1ed3;if(_0x5c0ec9[_0xe945('0x34')][_0xe945('0x3f')]){_0x3ade55[_0xe945('0x40')]=[{'all':!![]}];}return db[_0xe945('0x2e')][_0xe945('0x41')](_0x3ade55);})[_0xe945('0x29')](function(_0x11ce99){_0x5b002d[_0xe945('0x42')]=_0x11ce99;return _0x5b002d;})[_0xe945('0x29')](respondWithFilteredResult(_0x108868,_0x3ade55))['catch'](handleError(_0x108868,null));};exports['show']=function(_0x557513,_0x5aa681){var _0x4ca906={'raw':!![],'where':{'id':_0x557513['params']['id']}},_0x19f448={};_0x19f448[_0xe945('0x33')]=_[_0xe945('0x35')](db['SquareMessage'][_0xe945('0x2f')]);_0x19f448[_0xe945('0x34')]=_[_0xe945('0x35')](_0x557513[_0xe945('0x34')]);_0x19f448['filters']=_['intersection'](_0x19f448['model'],_0x19f448['query']);_0x4ca906[_0xe945('0x38')]=_[_0xe945('0x43')](_0x19f448[_0xe945('0x33')],qs[_0xe945('0x44')](_0x557513[_0xe945('0x34')][_0xe945('0x44')]));_0x4ca906[_0xe945('0x38')]=_0x4ca906[_0xe945('0x38')][_0xe945('0x37')]?_0x4ca906['attributes']:_0x19f448[_0xe945('0x33')];if(_0x557513[_0xe945('0x34')][_0xe945('0x3f')]){_0x4ca906[_0xe945('0x40')]=[{'all':!![]}];}_0x4ca906=_[_0xe945('0x3d')]({},_0x4ca906,_0x557513['options']);return db[_0xe945('0x2e')][_0xe945('0x45')](_0x4ca906)[_0xe945('0x29')](handleEntityNotFound(_0x5aa681,null))[_0xe945('0x29')](respondWithResult(_0x5aa681,null))['catch'](handleError(_0x5aa681,null));};exports[_0xe945('0x46')]=function(_0x4c59e4,_0x402017){return db['SquareMessage'][_0xe945('0x46')](_0x4c59e4[_0xe945('0x47')],{})[_0xe945('0x29')](respondWithResult(_0x402017,0xc9))[_0xe945('0x48')](handleError(_0x402017,null));};exports[_0xe945('0x27')]=function(_0x327d07,_0x5671ee){if(_0x327d07[_0xe945('0x47')]['id']){delete _0x327d07[_0xe945('0x47')]['id'];}return db[_0xe945('0x2e')][_0xe945('0x45')]({'where':{'id':_0x327d07[_0xe945('0x49')]['id']}})[_0xe945('0x29')](handleEntityNotFound(_0x5671ee,null))['then'](saveUpdates(_0x327d07[_0xe945('0x47')],null))[_0xe945('0x29')](respondWithResult(_0x5671ee,null))[_0xe945('0x48')](handleError(_0x5671ee,null));};exports['destroy']=function(_0x571ec4,_0x2dd372){return db[_0xe945('0x2e')][_0xe945('0x45')]({'where':{'id':_0x571ec4[_0xe945('0x49')]['id']}})[_0xe945('0x29')](handleEntityNotFound(_0x2dd372,null))[_0xe945('0x29')](removeEntity(_0x2dd372,null))[_0xe945('0x48')](handleError(_0x2dd372,null));}; \ No newline at end of file +var _0xa702=['zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','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','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','end','error','name','send','map','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','options','includeAll','include','SquareMessage','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0xa702,0x1ae));var _0x2a70=function(_0x3437b5,_0x2bc627){_0x3437b5=_0x3437b5-0x0;var _0x56bf67=_0xa702[_0x3437b5];return _0x56bf67;};'use strict';var emlformat=require(_0x2a70('0x0'));var rimraf=require(_0x2a70('0x1'));var zipdir=require(_0x2a70('0x2'));var jsonpatch=require(_0x2a70('0x3'));var rp=require(_0x2a70('0x4'));var moment=require('moment');var BPromise=require(_0x2a70('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a70('0x6'));var sox=require('sox');var csv=require(_0x2a70('0x7'));var ejs=require(_0x2a70('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a70('0x9'));var crypto=require(_0x2a70('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2a70('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2a70('0xc'));var Papa=require(_0x2a70('0xd'));var Redis=require(_0x2a70('0xe'));var authService=require(_0x2a70('0xf'));var qs=require(_0x2a70('0x10'));var as=require(_0x2a70('0x11'));var hardwareService=require(_0x2a70('0x12'));var logger=require(_0x2a70('0x13'))(_0x2a70('0x14'));var utils=require(_0x2a70('0x15'));var config=require(_0x2a70('0x16'));var licenseUtil=require(_0x2a70('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1327f4,_0x255eaa){_0x255eaa=_0x255eaa||0xcc;return function(_0x49dc04){if(_0x49dc04){return _0x1327f4[_0x2a70('0x18')](_0x255eaa);}return _0x1327f4[_0x2a70('0x19')](_0x255eaa)['end']();};}function respondWithResult(_0xc0b867,_0x9587d8){_0x9587d8=_0x9587d8||0xc8;return function(_0x5562cb){if(_0x5562cb){return _0xc0b867[_0x2a70('0x19')](_0x9587d8)[_0x2a70('0x1a')](_0x5562cb);}};}function respondWithFilteredResult(_0x58c9a4,_0x46f840){return function(_0x2c5619){if(_0x2c5619){var _0x5d992a=typeof _0x46f840['offset']===_0x2a70('0x1b')&&typeof _0x46f840[_0x2a70('0x1c')]===_0x2a70('0x1b');var _0xaca16b=_0x2c5619[_0x2a70('0x1d')];var _0x550ea0=_0x5d992a?0x0:_0x46f840[_0x2a70('0x1e')];var _0x2c59fe=_0x5d992a?_0x2c5619['count']:_0x46f840['offset']+_0x46f840[_0x2a70('0x1c')];var _0x4abbf9;if(_0x2c59fe>=_0xaca16b){_0x2c59fe=_0xaca16b;_0x4abbf9=0xc8;}else{_0x4abbf9=0xce;}_0x58c9a4[_0x2a70('0x19')](_0x4abbf9);return _0x58c9a4['set'](_0x2a70('0x1f'),_0x550ea0+'-'+_0x2c59fe+'/'+_0xaca16b)[_0x2a70('0x1a')](_0x2c5619);}return null;};}function patchUpdates(_0x1b7764){return function(_0x29fbf3){try{jsonpatch[_0x2a70('0x20')](_0x29fbf3,_0x1b7764,!![]);}catch(_0x395057){return BPromise[_0x2a70('0x21')](_0x395057);}return _0x29fbf3['save']();};}function saveUpdates(_0x558436,_0x932b18){return function(_0x5cdac3){if(_0x5cdac3){return _0x5cdac3[_0x2a70('0x22')](_0x558436)[_0x2a70('0x23')](function(_0x10bc80){return _0x10bc80;});}return null;};}function removeEntity(_0xe2a027,_0x3de817){return function(_0x1ef985){if(_0x1ef985){return _0x1ef985[_0x2a70('0x24')]()[_0x2a70('0x23')](function(){_0xe2a027[_0x2a70('0x19')](0xcc)[_0x2a70('0x25')]();});}};}function handleEntityNotFound(_0xf3d89e,_0x61a342){return function(_0x530b1b){if(!_0x530b1b){_0xf3d89e['sendStatus'](0x194);}return _0x530b1b;};}function handleError(_0x38208f,_0x163061){_0x163061=_0x163061||0x1f4;return function(_0x220be7){logger[_0x2a70('0x26')](_0x220be7['stack']);if(_0x220be7[_0x2a70('0x27')]){delete _0x220be7[_0x2a70('0x27')];}_0x38208f[_0x2a70('0x19')](_0x163061)[_0x2a70('0x28')](_0x220be7);};}exports['index']=function(_0x588efc,_0x47dafe){var _0x18f571={},_0x57dae1={},_0x22fb1b={'count':0x0,'rows':[]};var _0x5bfe28=_[_0x2a70('0x29')](db['SquareMessage'][_0x2a70('0x2a')],function(_0x1aa897){return{'name':_0x1aa897['fieldName'],'type':_0x1aa897['type'][_0x2a70('0x2b')]};});_0x57dae1[_0x2a70('0x2c')]=_['map'](_0x5bfe28,_0x2a70('0x27'));_0x57dae1[_0x2a70('0x2d')]=_[_0x2a70('0x2e')](_0x588efc[_0x2a70('0x2d')]);_0x57dae1['filters']=_[_0x2a70('0x2f')](_0x57dae1[_0x2a70('0x2c')],_0x57dae1[_0x2a70('0x2d')]);_0x18f571[_0x2a70('0x30')]=_[_0x2a70('0x2f')](_0x57dae1[_0x2a70('0x2c')],qs[_0x2a70('0x31')](_0x588efc[_0x2a70('0x2d')]['fields']));_0x18f571['attributes']=_0x18f571[_0x2a70('0x30')][_0x2a70('0x32')]?_0x18f571['attributes']:_0x57dae1[_0x2a70('0x2c')];if(!_0x588efc[_0x2a70('0x2d')][_0x2a70('0x33')](_0x2a70('0x34'))){_0x18f571[_0x2a70('0x1c')]=qs[_0x2a70('0x1c')](_0x588efc[_0x2a70('0x2d')][_0x2a70('0x1c')]);_0x18f571[_0x2a70('0x1e')]=qs['offset'](_0x588efc[_0x2a70('0x2d')][_0x2a70('0x1e')]);}_0x18f571[_0x2a70('0x35')]=qs['sort'](_0x588efc[_0x2a70('0x2d')][_0x2a70('0x36')]);_0x18f571[_0x2a70('0x37')]=qs[_0x2a70('0x38')](_[_0x2a70('0x39')](_0x588efc[_0x2a70('0x2d')],_0x57dae1[_0x2a70('0x38')]),_0x5bfe28);if(_0x588efc[_0x2a70('0x2d')]['filter']){_0x18f571[_0x2a70('0x37')]=_[_0x2a70('0x3a')](_0x18f571[_0x2a70('0x37')],{'$or':_[_0x2a70('0x29')](_0x5bfe28,function(_0x7715ef){if(_0x7715ef[_0x2a70('0x3b')]!=='VIRTUAL'){var _0x2227f1={};_0x2227f1[_0x7715ef[_0x2a70('0x27')]]={'$like':'%'+_0x588efc[_0x2a70('0x2d')]['filter']+'%'};return _0x2227f1;}})});}_0x18f571=_[_0x2a70('0x3a')]({},_0x18f571,_0x588efc[_0x2a70('0x3c')]);var _0x5330d1={'where':_0x18f571['where']};return db['SquareMessage'][_0x2a70('0x1d')](_0x5330d1)[_0x2a70('0x23')](function(_0x3979b9){_0x22fb1b['count']=_0x3979b9;if(_0x588efc[_0x2a70('0x2d')][_0x2a70('0x3d')]){_0x18f571[_0x2a70('0x3e')]=[{'all':!![]}];}return db[_0x2a70('0x3f')][_0x2a70('0x40')](_0x18f571);})['then'](function(_0x6c2295){_0x22fb1b[_0x2a70('0x41')]=_0x6c2295;return _0x22fb1b;})[_0x2a70('0x23')](respondWithFilteredResult(_0x47dafe,_0x18f571))[_0x2a70('0x42')](handleError(_0x47dafe,null));};exports[_0x2a70('0x43')]=function(_0xd1c3fb,_0x229ccc){var _0x848bc3={'raw':!![],'where':{'id':_0xd1c3fb[_0x2a70('0x44')]['id']}},_0xa0f46c={};_0xa0f46c[_0x2a70('0x2c')]=_[_0x2a70('0x2e')](db[_0x2a70('0x3f')][_0x2a70('0x2a')]);_0xa0f46c[_0x2a70('0x2d')]=_['keys'](_0xd1c3fb[_0x2a70('0x2d')]);_0xa0f46c[_0x2a70('0x38')]=_[_0x2a70('0x2f')](_0xa0f46c[_0x2a70('0x2c')],_0xa0f46c[_0x2a70('0x2d')]);_0x848bc3[_0x2a70('0x30')]=_[_0x2a70('0x2f')](_0xa0f46c[_0x2a70('0x2c')],qs[_0x2a70('0x31')](_0xd1c3fb['query']['fields']));_0x848bc3[_0x2a70('0x30')]=_0x848bc3[_0x2a70('0x30')][_0x2a70('0x32')]?_0x848bc3[_0x2a70('0x30')]:_0xa0f46c[_0x2a70('0x2c')];if(_0xd1c3fb[_0x2a70('0x2d')][_0x2a70('0x3d')]){_0x848bc3['include']=[{'all':!![]}];}_0x848bc3=_[_0x2a70('0x3a')]({},_0x848bc3,_0xd1c3fb[_0x2a70('0x3c')]);return db[_0x2a70('0x3f')]['find'](_0x848bc3)[_0x2a70('0x23')](handleEntityNotFound(_0x229ccc,null))[_0x2a70('0x23')](respondWithResult(_0x229ccc,null))['catch'](handleError(_0x229ccc,null));};exports[_0x2a70('0x45')]=function(_0x5ea976,_0x36e110){return db[_0x2a70('0x3f')][_0x2a70('0x45')](_0x5ea976[_0x2a70('0x46')],{})[_0x2a70('0x23')](respondWithResult(_0x36e110,0xc9))['catch'](handleError(_0x36e110,null));};exports[_0x2a70('0x22')]=function(_0x332af1,_0x4bcb2f){if(_0x332af1[_0x2a70('0x46')]['id']){delete _0x332af1['body']['id'];}return db[_0x2a70('0x3f')][_0x2a70('0x47')]({'where':{'id':_0x332af1[_0x2a70('0x44')]['id']}})[_0x2a70('0x23')](handleEntityNotFound(_0x4bcb2f,null))['then'](saveUpdates(_0x332af1[_0x2a70('0x46')],null))['then'](respondWithResult(_0x4bcb2f,null))[_0x2a70('0x42')](handleError(_0x4bcb2f,null));};exports['destroy']=function(_0x4f7dea,_0x358bb3){return db[_0x2a70('0x3f')][_0x2a70('0x47')]({'where':{'id':_0x4f7dea[_0x2a70('0x44')]['id']}})[_0x2a70('0x23')](handleEntityNotFound(_0x358bb3,null))[_0x2a70('0x23')](removeEntity(_0x358bb3,null))[_0x2a70('0x42')](handleError(_0x358bb3,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index cb58a60..5fa3e6a 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 _0xff2c=['SquareMessage','square_messages','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0xb1fda4,_0x2a544c){var _0x416f5d=function(_0x130a89){while(--_0x130a89){_0xb1fda4['push'](_0xb1fda4['shift']());}};_0x416f5d(++_0x2a544c);}(_0xff2c,0x18e));var _0xcff2=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xff2c[_0x220dbb];return _0x2b77de;};'use strict';var _=require('lodash');var util=require(_0xcff2('0x0'));var logger=require(_0xcff2('0x1'))(_0xcff2('0x2'));var moment=require('moment');var BPromise=require(_0xcff2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcff2('0x4'));var rimraf=require(_0xcff2('0x5'));var config=require(_0xcff2('0x6'));var attributes=require(_0xcff2('0x7'));module[_0xcff2('0x8')]=function(_0x1904d3,_0x18fa37){return _0x1904d3['define'](_0xcff2('0x9'),attributes,{'tableName':_0xcff2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d10=['request-promise','path','../../config/environment','exports','SquareMessage','api','bluebird'];(function(_0x3fd609,_0x4d0447){var _0x26487d=function(_0x314e6a){while(--_0x314e6a){_0x3fd609['push'](_0x3fd609['shift']());}};_0x26487d(++_0x4d0447);}(_0x2d10,0xa6));var _0x02d1=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x2d10[_0xef8146];return _0x5a6cb0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x02d1('0x0'));var moment=require('moment');var BPromise=require(_0x02d1('0x1'));var rp=require(_0x02d1('0x2'));var fs=require('fs');var path=require(_0x02d1('0x3'));var rimraf=require('rimraf');var config=require(_0x02d1('0x4'));var attributes=require('./squareMessage.attributes');module[_0x02d1('0x5')]=function(_0x446cf5,_0x57317c){return _0x446cf5['define'](_0x02d1('0x6'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 40b4cb9..561ae4d 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 _0xb5d4=['../../config/environment','client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','body','options','CreateSquareMessage','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0xb5d4,0x156));var _0x4b5d=function(_0x5b08dc,_0x4a8a21){_0x5b08dc=_0x5b08dc-0x0;var _0x3b57c4=_0xb5d4[_0x5b08dc];return _0x3b57c4;};'use strict';var _=require('lodash');var util=require(_0x4b5d('0x0'));var moment=require(_0x4b5d('0x1'));var BPromise=require(_0x4b5d('0x2'));var rs=require(_0x4b5d('0x3'));var fs=require('fs');var Redis=require(_0x4b5d('0x4'));var db=require(_0x4b5d('0x5'))['db'];var utils=require(_0x4b5d('0x6'));var logger=require(_0x4b5d('0x7'))(_0x4b5d('0x8'));var config=require(_0x4b5d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4b5d('0xa')][_0x4b5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24e349,_0xdb78da,_0x1c6ff5){return new BPromise(function(_0x3794fc,_0x296b91){return client[_0x4b5d('0xc')](_0x24e349,_0x1c6ff5)['then'](function(_0x4dc94e){logger[_0x4b5d('0xd')](_0x4b5d('0xe'),_0xdb78da,_0x4b5d('0xf'));logger['debug'](_0x4b5d('0x10'),_0xdb78da,_0x4b5d('0xf'),JSON[_0x4b5d('0x11')](_0x4dc94e));if(_0x4dc94e[_0x4b5d('0x12')]){if(_0x4dc94e[_0x4b5d('0x12')][_0x4b5d('0x13')]===0x1f4){logger[_0x4b5d('0x12')]('SquareMessage,\x20%s,\x20%s',_0xdb78da,_0x4dc94e[_0x4b5d('0x12')][_0x4b5d('0x14')]);return _0x296b91(_0x4dc94e[_0x4b5d('0x12')]['message']);}logger['error'](_0x4b5d('0xe'),_0xdb78da,_0x4dc94e[_0x4b5d('0x12')]['message']);return _0x3794fc(_0x4dc94e['error']['message']);}else{logger[_0x4b5d('0xd')](_0x4b5d('0xe'),_0xdb78da,_0x4b5d('0xf'));_0x3794fc(_0x4dc94e['result'][_0x4b5d('0x14')]);}})[_0x4b5d('0x15')](function(_0x46306d){logger[_0x4b5d('0x12')](_0x4b5d('0xe'),_0xdb78da,_0x46306d);_0x296b91(_0x46306d);});});}exports['CreateSquareMessage']=function(_0x5500fc){var _0x298b9f=this;return new Promise(function(_0x3fe9e5,_0x117521){return db['SquareMessage'][_0x4b5d('0x16')](_0x5500fc[_0x4b5d('0x17')],{'raw':_0x5500fc['options']?_0x5500fc[_0x4b5d('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x13dc9f){logger['info'](_0x4b5d('0x19'),_0x5500fc);logger[_0x4b5d('0x1a')](_0x4b5d('0x19'),_0x5500fc,JSON[_0x4b5d('0x11')](_0x13dc9f));_0x3fe9e5(_0x13dc9f);})[_0x4b5d('0x15')](function(_0x4ace1e){logger[_0x4b5d('0x12')](_0x4b5d('0x19'),_0x4ace1e[_0x4b5d('0x14')],_0x5500fc);_0x117521(_0x298b9f[_0x4b5d('0x12')](0x1f4,_0x4ace1e[_0x4b5d('0x14')]));});});}; \ No newline at end of file +var _0x3bfe=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','create','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5e270c,_0x17dcef){var _0x29340a=function(_0x24e2fc){while(--_0x24e2fc){_0x5e270c['push'](_0x5e270c['shift']());}};_0x29340a(++_0x17dcef);}(_0x3bfe,0x6d));var _0xe3bf=function(_0x125582,_0x508be1){_0x125582=_0x125582-0x0;var _0x28e6dc=_0x3bfe[_0x125582];return _0x28e6dc;};'use strict';var _=require(_0xe3bf('0x0'));var util=require('util');var moment=require(_0xe3bf('0x1'));var BPromise=require(_0xe3bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3bf('0x3'));var db=require(_0xe3bf('0x4'))['db'];var utils=require(_0xe3bf('0x5'));var logger=require(_0xe3bf('0x6'))(_0xe3bf('0x7'));var config=require(_0xe3bf('0x8'));var jayson=require(_0xe3bf('0x9'));var client=jayson[_0xe3bf('0xa')][_0xe3bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x431e7a,_0x59a4aa,_0x46080d){return new BPromise(function(_0xbe449d,_0x3ec2f0){return client[_0xe3bf('0xc')](_0x431e7a,_0x46080d)[_0xe3bf('0xd')](function(_0x11ea8d){logger[_0xe3bf('0xe')](_0xe3bf('0xf'),_0x59a4aa,_0xe3bf('0x10'));logger[_0xe3bf('0x11')](_0xe3bf('0x12'),_0x59a4aa,_0xe3bf('0x10'),JSON[_0xe3bf('0x13')](_0x11ea8d));if(_0x11ea8d['error']){if(_0x11ea8d[_0xe3bf('0x14')][_0xe3bf('0x15')]===0x1f4){logger[_0xe3bf('0x14')](_0xe3bf('0xf'),_0x59a4aa,_0x11ea8d[_0xe3bf('0x14')][_0xe3bf('0x16')]);return _0x3ec2f0(_0x11ea8d[_0xe3bf('0x14')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x59a4aa,_0x11ea8d['error']['message']);return _0xbe449d(_0x11ea8d[_0xe3bf('0x14')]['message']);}else{logger[_0xe3bf('0xe')](_0xe3bf('0xf'),_0x59a4aa,'request\x20sent');_0xbe449d(_0x11ea8d[_0xe3bf('0x17')]['message']);}})[_0xe3bf('0x18')](function(_0x8ce8a9){logger[_0xe3bf('0x14')](_0xe3bf('0xf'),_0x59a4aa,_0x8ce8a9);_0x3ec2f0(_0x8ce8a9);});});}exports[_0xe3bf('0x19')]=function(_0x2d134f){var _0x6b80ea=this;return new Promise(function(_0x2d1fe8,_0xc7aaaf){return db['SquareMessage'][_0xe3bf('0x1a')](_0x2d134f['body'],{'raw':_0x2d134f['options']?_0x2d134f[_0xe3bf('0x1b')][_0xe3bf('0x1c')]===undefined?!![]:![]:!![]})[_0xe3bf('0xd')](function(_0x35d0b5){logger['info'](_0xe3bf('0x19'),_0x2d134f);logger[_0xe3bf('0x11')](_0xe3bf('0x19'),_0x2d134f,JSON[_0xe3bf('0x13')](_0x35d0b5));_0x2d1fe8(_0x35d0b5);})[_0xe3bf('0x18')](function(_0x7ddf75){logger[_0xe3bf('0x14')](_0xe3bf('0x19'),_0x7ddf75[_0xe3bf('0x16')],_0x2d134f);_0xc7aaaf(_0x6b80ea['error'](0x1f4,_0x7ddf75['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 528b8b5..9e41246 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 _0x6d7f=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','post','create','put','/:id','delete','destroy','exports'];(function(_0x3314cc,_0x158c72){var _0x2ef318=function(_0x280ff7){while(--_0x280ff7){_0x3314cc['push'](_0x3314cc['shift']());}};_0x2ef318(++_0x158c72);}(_0x6d7f,0x93));var _0xf6d7=function(_0x37e089,_0x563882){_0x37e089=_0x37e089-0x0;var _0xed3344=_0x6d7f[_0x37e089];return _0xed3344;};'use strict';var multer=require(_0xf6d7('0x0'));var util=require(_0xf6d7('0x1'));var path=require(_0xf6d7('0x2'));var timeout=require(_0xf6d7('0x3'));var express=require('express');var router=express[_0xf6d7('0x4')]();var fs_extra=require(_0xf6d7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf6d7('0x6'));var config=require(_0xf6d7('0x7'));var controller=require(_0xf6d7('0x8'));router[_0xf6d7('0x9')]('/',auth[_0xf6d7('0xa')](),controller[_0xf6d7('0xb')]);router['get']('/:id',auth[_0xf6d7('0xa')](),controller[_0xf6d7('0xc')]);router[_0xf6d7('0x9')](_0xf6d7('0xd'),auth['isAuthenticated'](),timeout('15s'),controller['test']);router[_0xf6d7('0xe')]('/',auth[_0xf6d7('0xa')](),controller[_0xf6d7('0xf')]);router[_0xf6d7('0x10')](_0xf6d7('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xf6d7('0x12')](_0xf6d7('0x11'),auth[_0xf6d7('0xa')](),controller[_0xf6d7('0x13')]);module[_0xf6d7('0x14')]=router; \ No newline at end of file +var _0x1cf6=['get','isAuthenticated','show','/:id/test','15s','test','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37fcbd,_0x52fa4e){var _0x3896db=function(_0x3bc7a2){while(--_0x3bc7a2){_0x37fcbd['push'](_0x37fcbd['shift']());}};_0x3896db(++_0x52fa4e);}(_0x1cf6,0x139));var _0x61cf=function(_0x3e4468,_0x4166fe){_0x3e4468=_0x3e4468-0x0;var _0x1739c6=_0x1cf6[_0x3e4468];return _0x1739c6;};'use strict';var multer=require(_0x61cf('0x0'));var util=require(_0x61cf('0x1'));var path=require(_0x61cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x61cf('0x3'));var router=express[_0x61cf('0x4')]();var fs_extra=require(_0x61cf('0x5'));var auth=require(_0x61cf('0x6'));var interaction=require(_0x61cf('0x7'));var config=require(_0x61cf('0x8'));var controller=require('./squareOdbc.controller');router[_0x61cf('0x9')]('/',auth[_0x61cf('0xa')](),controller['index']);router[_0x61cf('0x9')]('/:id',auth[_0x61cf('0xa')](),controller[_0x61cf('0xb')]);router[_0x61cf('0x9')](_0x61cf('0xc'),auth[_0x61cf('0xa')](),timeout(_0x61cf('0xd')),controller[_0x61cf('0xe')]);router[_0x61cf('0xf')]('/',auth[_0x61cf('0xa')](),controller[_0x61cf('0x10')]);router[_0x61cf('0x11')](_0x61cf('0x12'),auth[_0x61cf('0xa')](),controller[_0x61cf('0x13')]);router[_0x61cf('0x14')](_0x61cf('0x12'),auth['isAuthenticated'](),controller[_0x61cf('0x15')]);module[_0x61cf('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 281d9a5..38a7458 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 _0x87b4=['name','sequelize','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x87b4,0x79));var _0x487b=function(_0x3f0e85,_0x211117){_0x3f0e85=_0x3f0e85-0x0;var _0x43821f=_0x87b4[_0x3f0e85];return _0x43821f;};'use strict';var Sequelize=require(_0x487b('0x0'));module[_0x487b('0x1')]={'name':{'type':Sequelize[_0x487b('0x2')],'unique':_0x487b('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x487b('0x2')]},'description':{'type':Sequelize[_0x487b('0x2')]}}; \ No newline at end of file +var _0x0af7=['exports','name'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0x0af7,0x118));var _0x70af=function(_0x2a1cf5,_0x33dd16){_0x2a1cf5=_0x2a1cf5-0x0;var _0x157387=_0x0af7[_0x2a1cf5];return _0x157387;};'use strict';var Sequelize=require('sequelize');module[_0x70af('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x70af('0x1'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a97be52..214d074 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 _0x0af5=['fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','SquareOdbc','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','closeSync','rimraf','zip-dir'];(function(_0x19d4f7,_0x41145f){var _0x3772fa=function(_0x2b1cbc){while(--_0x2b1cbc){_0x19d4f7['push'](_0x19d4f7['shift']());}};_0x3772fa(++_0x41145f);}(_0x0af5,0xa8));var _0x50af=function(_0x110d47,_0xa70e64){_0x110d47=_0x110d47-0x0;var _0x10c084=_0x0af5[_0x110d47];return _0x10c084;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50af('0x0'));var zipdir=require(_0x50af('0x1'));var jsonpatch=require(_0x50af('0x2'));var rp=require('request-promise');var moment=require(_0x50af('0x3'));var BPromise=require(_0x50af('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x50af('0x5'));var sox=require('sox');var csv=require(_0x50af('0x6'));var ejs=require(_0x50af('0x7'));var fs=require('fs');var fs_extra=require(_0x50af('0x8'));var _=require(_0x50af('0x9'));var squel=require(_0x50af('0xa'));var crypto=require(_0x50af('0xb'));var jsforce=require(_0x50af('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x50af('0x6'));var querystring=require(_0x50af('0xd'));var Papa=require(_0x50af('0xe'));var Redis=require('ioredis');var authService=require(_0x50af('0xf'));var qs=require(_0x50af('0x10'));var as=require(_0x50af('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50af('0x12'))('api');var utils=require(_0x50af('0x13'));var config=require(_0x50af('0x14'));var licenseUtil=require(_0x50af('0x15'));var db=require(_0x50af('0x16'))['db'];function respondWithStatusCode(_0x41978e,_0x5e0d43){_0x5e0d43=_0x5e0d43||0xcc;return function(_0x36f4d0){if(_0x36f4d0){return _0x41978e[_0x50af('0x17')](_0x5e0d43);}return _0x41978e[_0x50af('0x18')](_0x5e0d43)['end']();};}function respondWithResult(_0x4f9e4b,_0x3f33f2){_0x3f33f2=_0x3f33f2||0xc8;return function(_0x165971){if(_0x165971){return _0x4f9e4b['status'](_0x3f33f2)[_0x50af('0x19')](_0x165971);}};}function respondWithFilteredResult(_0x35e35b,_0x2b0040){return function(_0x23ff2c){if(_0x23ff2c){var _0xb77ccb=typeof _0x2b0040[_0x50af('0x1a')]===_0x50af('0x1b')&&typeof _0x2b0040[_0x50af('0x1c')]==='undefined';var _0x4a99bd=_0x23ff2c['count'];var _0x178806=_0xb77ccb?0x0:_0x2b0040[_0x50af('0x1a')];var _0x2bbfb9=_0xb77ccb?_0x23ff2c['count']:_0x2b0040['offset']+_0x2b0040[_0x50af('0x1c')];var _0x807a3b;if(_0x2bbfb9>=_0x4a99bd){_0x2bbfb9=_0x4a99bd;_0x807a3b=0xc8;}else{_0x807a3b=0xce;}_0x35e35b['status'](_0x807a3b);return _0x35e35b[_0x50af('0x1d')]('Content-Range',_0x178806+'-'+_0x2bbfb9+'/'+_0x4a99bd)[_0x50af('0x19')](_0x23ff2c);}return null;};}function patchUpdates(_0x7744a){return function(_0x784e22){try{jsonpatch[_0x50af('0x1e')](_0x784e22,_0x7744a,!![]);}catch(_0x106b14){return BPromise[_0x50af('0x1f')](_0x106b14);}return _0x784e22[_0x50af('0x20')]();};}function saveUpdates(_0xc208f7,_0x41a00a){return function(_0x35708c){if(_0x35708c){return _0x35708c[_0x50af('0x21')](_0xc208f7)[_0x50af('0x22')](function(_0x2b6892){return _0x2b6892;});}return null;};}function removeEntity(_0x2447b0,_0x2afea2){return function(_0x42c14e){if(_0x42c14e){return _0x42c14e[_0x50af('0x23')]()[_0x50af('0x22')](function(){var _0x1e8eb1=_0x42c14e[_0x50af('0x24')]({'plain':!![]});var _0x2d4add='ODBC';return db[_0x50af('0x25')][_0x50af('0x23')]({'where':{'type':_0x2d4add,'resourceId':_0x1e8eb1['id']}})[_0x50af('0x22')](function(){return _0x42c14e;});})[_0x50af('0x22')](function(){_0x2447b0[_0x50af('0x18')](0xcc)[_0x50af('0x26')]();});}};}function handleEntityNotFound(_0x4d001e,_0x4cab40){return function(_0x19ca89){if(!_0x19ca89){_0x4d001e[_0x50af('0x17')](0x194);}return _0x19ca89;};}function handleError(_0x362889,_0x27f75b){_0x27f75b=_0x27f75b||0x1f4;return function(_0x464bb3){logger[_0x50af('0x27')](_0x464bb3[_0x50af('0x28')]);if(_0x464bb3[_0x50af('0x29')]){delete _0x464bb3[_0x50af('0x29')];}_0x362889[_0x50af('0x18')](_0x27f75b)[_0x50af('0x2a')](_0x464bb3);};}exports['index']=function(_0x361b82,_0x51fd04){var _0x2dc8c1={},_0x17e28b={},_0xf9488={'count':0x0,'rows':[]};var _0x2cc277=_[_0x50af('0x2b')](db[_0x50af('0x2c')]['rawAttributes'],function(_0x20e983){return{'name':_0x20e983[_0x50af('0x2d')],'type':_0x20e983[_0x50af('0x2e')][_0x50af('0x2f')]};});_0x17e28b['model']=_[_0x50af('0x2b')](_0x2cc277,'name');_0x17e28b[_0x50af('0x30')]=_[_0x50af('0x31')](_0x361b82['query']);_0x17e28b[_0x50af('0x32')]=_['intersection'](_0x17e28b[_0x50af('0x33')],_0x17e28b[_0x50af('0x30')]);_0x2dc8c1[_0x50af('0x34')]=_[_0x50af('0x35')](_0x17e28b[_0x50af('0x33')],qs[_0x50af('0x36')](_0x361b82[_0x50af('0x30')]['fields']));_0x2dc8c1[_0x50af('0x34')]=_0x2dc8c1[_0x50af('0x34')]['length']?_0x2dc8c1[_0x50af('0x34')]:_0x17e28b['model'];if(!_0x361b82[_0x50af('0x30')]['hasOwnProperty'](_0x50af('0x37'))){_0x2dc8c1['limit']=qs[_0x50af('0x1c')](_0x361b82[_0x50af('0x30')]['limit']);_0x2dc8c1[_0x50af('0x1a')]=qs[_0x50af('0x1a')](_0x361b82[_0x50af('0x30')][_0x50af('0x1a')]);}_0x2dc8c1[_0x50af('0x38')]=qs[_0x50af('0x39')](_0x361b82['query']['sort']);_0x2dc8c1[_0x50af('0x3a')]=qs[_0x50af('0x32')](_[_0x50af('0x3b')](_0x361b82[_0x50af('0x30')],_0x17e28b[_0x50af('0x32')]),_0x2cc277);if(_0x361b82[_0x50af('0x30')][_0x50af('0x3c')]){_0x2dc8c1['where']=_[_0x50af('0x3d')](_0x2dc8c1[_0x50af('0x3a')],{'$or':_[_0x50af('0x2b')](_0x2cc277,function(_0x5aa382){if(_0x5aa382['type']!==_0x50af('0x3e')){var _0x1cbbad={};_0x1cbbad[_0x5aa382[_0x50af('0x29')]]={'$like':'%'+_0x361b82['query'][_0x50af('0x3c')]+'%'};return _0x1cbbad;}})});}_0x2dc8c1=_[_0x50af('0x3d')]({},_0x2dc8c1,_0x361b82[_0x50af('0x3f')]);var _0x131b05={'where':_0x2dc8c1[_0x50af('0x3a')]};return db[_0x50af('0x2c')][_0x50af('0x40')](_0x131b05)[_0x50af('0x22')](function(_0x4c2cc0){_0xf9488[_0x50af('0x40')]=_0x4c2cc0;if(_0x361b82[_0x50af('0x30')][_0x50af('0x41')]){_0x2dc8c1[_0x50af('0x42')]=[{'all':!![]}];}return db[_0x50af('0x2c')][_0x50af('0x43')](_0x2dc8c1);})[_0x50af('0x22')](function(_0x2b5a5c){_0xf9488['rows']=_0x2b5a5c;return _0xf9488;})[_0x50af('0x22')](respondWithFilteredResult(_0x51fd04,_0x2dc8c1))['catch'](handleError(_0x51fd04,null));};exports[_0x50af('0x44')]=function(_0x1a6ad2,_0x41aae1){var _0x5c6dd4={'raw':!![],'where':{'id':_0x1a6ad2[_0x50af('0x45')]['id']}},_0x48781e={};_0x48781e[_0x50af('0x33')]=_[_0x50af('0x31')](db[_0x50af('0x2c')][_0x50af('0x46')]);_0x48781e[_0x50af('0x30')]=_[_0x50af('0x31')](_0x1a6ad2[_0x50af('0x30')]);_0x48781e['filters']=_['intersection'](_0x48781e[_0x50af('0x33')],_0x48781e['query']);_0x5c6dd4[_0x50af('0x34')]=_['intersection'](_0x48781e['model'],qs[_0x50af('0x36')](_0x1a6ad2[_0x50af('0x30')][_0x50af('0x36')]));_0x5c6dd4[_0x50af('0x34')]=_0x5c6dd4[_0x50af('0x34')][_0x50af('0x47')]?_0x5c6dd4['attributes']:_0x48781e['model'];if(_0x1a6ad2['query'][_0x50af('0x41')]){_0x5c6dd4[_0x50af('0x42')]=[{'all':!![]}];}_0x5c6dd4=_[_0x50af('0x3d')]({},_0x5c6dd4,_0x1a6ad2[_0x50af('0x3f')]);return db[_0x50af('0x2c')][_0x50af('0x48')](_0x5c6dd4)[_0x50af('0x22')](handleEntityNotFound(_0x41aae1,null))[_0x50af('0x22')](respondWithResult(_0x41aae1,null))[_0x50af('0x49')](handleError(_0x41aae1,null));};exports['create']=function(_0x275f71,_0x271c91){return db[_0x50af('0x2c')][_0x50af('0x4a')](_0x275f71[_0x50af('0x4b')],{})[_0x50af('0x22')](function(_0x2ca0ee){var _0x46136a=_0x275f71[_0x50af('0x4c')][_0x50af('0x24')]({'plain':!![]});if(!_0x46136a)throw new Error(_0x50af('0x4d'));if(_0x46136a[_0x50af('0x4e')]==='user'){var _0xae8c41=_0x2ca0ee['get']({'plain':!![]});var _0x4d1e1c='ODBC';return db[_0x50af('0x4f')][_0x50af('0x48')]({'where':{'name':_0x4d1e1c,'userProfileId':_0x46136a[_0x50af('0x50')]},'raw':!![]})['then'](function(_0x5a3e56){if(_0x5a3e56&&_0x5a3e56[_0x50af('0x51')]===0x0){return db[_0x50af('0x25')][_0x50af('0x4a')]({'name':_0xae8c41['name'],'resourceId':_0xae8c41['id'],'type':_0x5a3e56[_0x50af('0x29')],'sectionId':_0x5a3e56['id']},{})[_0x50af('0x22')](function(){return _0x2ca0ee;});}else{return _0x2ca0ee;}})['catch'](function(_0x130315){logger['error'](_0x50af('0x52'),_0x130315);throw _0x130315;});}return _0x2ca0ee;})[_0x50af('0x22')](respondWithResult(_0x271c91,0xc9))[_0x50af('0x49')](handleError(_0x271c91,null));};exports[_0x50af('0x21')]=function(_0x23a63f,_0x221c18){if(_0x23a63f['body']['id']){delete _0x23a63f[_0x50af('0x4b')]['id'];}return db[_0x50af('0x2c')]['find']({'where':{'id':_0x23a63f[_0x50af('0x45')]['id']}})[_0x50af('0x22')](handleEntityNotFound(_0x221c18,null))[_0x50af('0x22')](saveUpdates(_0x23a63f[_0x50af('0x4b')],null))[_0x50af('0x22')](respondWithResult(_0x221c18,null))['catch'](handleError(_0x221c18,null));};exports[_0x50af('0x23')]=function(_0x46f62a,_0x38a787){return db['SquareOdbc'][_0x50af('0x48')]({'where':{'id':_0x46f62a[_0x50af('0x45')]['id']}})[_0x50af('0x22')](handleEntityNotFound(_0x38a787,null))[_0x50af('0x22')](removeEntity(_0x38a787,null))[_0x50af('0x49')](handleError(_0x38a787,null));};exports['test']=function(_0x186a40,_0x2e18b0,_0x4ebedf){var _0x2c8588;return db[_0x50af('0x2c')][_0x50af('0x48')]({'where':{'id':_0x186a40[_0x50af('0x45')]['id']},'attributes':['id','dsn']})[_0x50af('0x22')](handleEntityNotFound(_0x2e18b0,null))[_0x50af('0x22')](function(_0x418b47){if(_0x418b47){var _0x44da16=require('odbc')();_0x44da16['openSync'](_0x418b47[_0x50af('0x53')]);_0x44da16[_0x50af('0x54')]();return _0x418b47;}})[_0x50af('0x22')](respondWithResult(_0x2e18b0,null))['catch'](handleError(_0x2e18b0,null));}; \ No newline at end of file +var _0x070c=['../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','SquareOdbc','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x43c0d8,_0x59449e){var _0x255aaf=function(_0x204b32){while(--_0x204b32){_0x43c0d8['push'](_0x43c0d8['shift']());}};_0x255aaf(++_0x59449e);}(_0x070c,0x140));var _0xc070=function(_0x1156c2,_0x56c200){_0x1156c2=_0x1156c2-0x0;var _0x5aa96b=_0x070c[_0x1156c2];return _0x5aa96b;};'use strict';var emlformat=require(_0xc070('0x0'));var rimraf=require(_0xc070('0x1'));var zipdir=require(_0xc070('0x2'));var jsonpatch=require(_0xc070('0x3'));var rp=require(_0xc070('0x4'));var moment=require(_0xc070('0x5'));var BPromise=require(_0xc070('0x6'));var Mustache=require('mustache');var util=require(_0xc070('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xc070('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc070('0x9'));var squel=require(_0xc070('0xa'));var crypto=require(_0xc070('0xb'));var jsforce=require(_0xc070('0xc'));var deskjs=require(_0xc070('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc070('0xe'));var Papa=require(_0xc070('0xf'));var Redis=require(_0xc070('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc070('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc070('0x12'))(_0xc070('0x13'));var utils=require('../../config/utils');var config=require(_0xc070('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54e65c,_0x56c898){_0x56c898=_0x56c898||0xcc;return function(_0x41cbbc){if(_0x41cbbc){return _0x54e65c[_0xc070('0x15')](_0x56c898);}return _0x54e65c[_0xc070('0x16')](_0x56c898)[_0xc070('0x17')]();};}function respondWithResult(_0xac4779,_0x4a1c0d){_0x4a1c0d=_0x4a1c0d||0xc8;return function(_0x24b3d3){if(_0x24b3d3){return _0xac4779['status'](_0x4a1c0d)[_0xc070('0x18')](_0x24b3d3);}};}function respondWithFilteredResult(_0x3b343d,_0x2fc01d){return function(_0x510d87){if(_0x510d87){var _0x43381b=typeof _0x2fc01d[_0xc070('0x19')]==='undefined'&&typeof _0x2fc01d['limit']===_0xc070('0x1a');var _0x5d5808=_0x510d87[_0xc070('0x1b')];var _0x3cfc48=_0x43381b?0x0:_0x2fc01d[_0xc070('0x19')];var _0x1c518c=_0x43381b?_0x510d87[_0xc070('0x1b')]:_0x2fc01d['offset']+_0x2fc01d[_0xc070('0x1c')];var _0x2b366c;if(_0x1c518c>=_0x5d5808){_0x1c518c=_0x5d5808;_0x2b366c=0xc8;}else{_0x2b366c=0xce;}_0x3b343d[_0xc070('0x16')](_0x2b366c);return _0x3b343d['set'](_0xc070('0x1d'),_0x3cfc48+'-'+_0x1c518c+'/'+_0x5d5808)[_0xc070('0x18')](_0x510d87);}return null;};}function patchUpdates(_0x4622d1){return function(_0x59fb03){try{jsonpatch['apply'](_0x59fb03,_0x4622d1,!![]);}catch(_0x199154){return BPromise[_0xc070('0x1e')](_0x199154);}return _0x59fb03[_0xc070('0x1f')]();};}function saveUpdates(_0x2d8102,_0x197340){return function(_0x97d8ec){if(_0x97d8ec){return _0x97d8ec[_0xc070('0x20')](_0x2d8102)[_0xc070('0x21')](function(_0x2003ca){return _0x2003ca;});}return null;};}function removeEntity(_0x2eb7e8,_0x25bfd3){return function(_0x51eaa6){if(_0x51eaa6){return _0x51eaa6[_0xc070('0x22')]()['then'](function(){var _0x2631d7=_0x51eaa6[_0xc070('0x23')]({'plain':!![]});var _0x416b00=_0xc070('0x24');return db[_0xc070('0x25')][_0xc070('0x22')]({'where':{'type':_0x416b00,'resourceId':_0x2631d7['id']}})[_0xc070('0x21')](function(){return _0x51eaa6;});})[_0xc070('0x21')](function(){_0x2eb7e8[_0xc070('0x16')](0xcc)[_0xc070('0x17')]();});}};}function handleEntityNotFound(_0x257cbd,_0x4e9a82){return function(_0xdb0e11){if(!_0xdb0e11){_0x257cbd['sendStatus'](0x194);}return _0xdb0e11;};}function handleError(_0x4c56b5,_0x2a5253){_0x2a5253=_0x2a5253||0x1f4;return function(_0x22f200){logger[_0xc070('0x26')](_0x22f200[_0xc070('0x27')]);if(_0x22f200[_0xc070('0x28')]){delete _0x22f200[_0xc070('0x28')];}_0x4c56b5[_0xc070('0x16')](_0x2a5253)[_0xc070('0x29')](_0x22f200);};}exports['index']=function(_0x5a5c2f,_0x4a0062){var _0x49e2af={},_0x43e4d7={},_0x57d1fe={'count':0x0,'rows':[]};var _0x4283eb=_['map'](db[_0xc070('0x2a')][_0xc070('0x2b')],function(_0x217a11){return{'name':_0x217a11['fieldName'],'type':_0x217a11[_0xc070('0x2c')][_0xc070('0x2d')]};});_0x43e4d7[_0xc070('0x2e')]=_[_0xc070('0x2f')](_0x4283eb,_0xc070('0x28'));_0x43e4d7[_0xc070('0x30')]=_[_0xc070('0x31')](_0x5a5c2f[_0xc070('0x30')]);_0x43e4d7[_0xc070('0x32')]=_[_0xc070('0x33')](_0x43e4d7[_0xc070('0x2e')],_0x43e4d7[_0xc070('0x30')]);_0x49e2af['attributes']=_[_0xc070('0x33')](_0x43e4d7['model'],qs[_0xc070('0x34')](_0x5a5c2f[_0xc070('0x30')]['fields']));_0x49e2af[_0xc070('0x35')]=_0x49e2af[_0xc070('0x35')]['length']?_0x49e2af[_0xc070('0x35')]:_0x43e4d7[_0xc070('0x2e')];if(!_0x5a5c2f[_0xc070('0x30')][_0xc070('0x36')](_0xc070('0x37'))){_0x49e2af[_0xc070('0x1c')]=qs[_0xc070('0x1c')](_0x5a5c2f['query'][_0xc070('0x1c')]);_0x49e2af[_0xc070('0x19')]=qs[_0xc070('0x19')](_0x5a5c2f['query'][_0xc070('0x19')]);}_0x49e2af[_0xc070('0x38')]=qs[_0xc070('0x39')](_0x5a5c2f[_0xc070('0x30')][_0xc070('0x39')]);_0x49e2af['where']=qs[_0xc070('0x32')](_[_0xc070('0x3a')](_0x5a5c2f['query'],_0x43e4d7[_0xc070('0x32')]),_0x4283eb);if(_0x5a5c2f[_0xc070('0x30')]['filter']){_0x49e2af[_0xc070('0x3b')]=_[_0xc070('0x3c')](_0x49e2af[_0xc070('0x3b')],{'$or':_[_0xc070('0x2f')](_0x4283eb,function(_0x29efd9){if(_0x29efd9['type']!==_0xc070('0x3d')){var _0x156b49={};_0x156b49[_0x29efd9[_0xc070('0x28')]]={'$like':'%'+_0x5a5c2f[_0xc070('0x30')][_0xc070('0x3e')]+'%'};return _0x156b49;}})});}_0x49e2af=_['merge']({},_0x49e2af,_0x5a5c2f['options']);var _0x8129dd={'where':_0x49e2af['where']};return db[_0xc070('0x2a')]['count'](_0x8129dd)[_0xc070('0x21')](function(_0x1929bb){_0x57d1fe['count']=_0x1929bb;if(_0x5a5c2f[_0xc070('0x30')][_0xc070('0x3f')]){_0x49e2af['include']=[{'all':!![]}];}return db[_0xc070('0x2a')][_0xc070('0x40')](_0x49e2af);})[_0xc070('0x21')](function(_0x2ca224){_0x57d1fe[_0xc070('0x41')]=_0x2ca224;return _0x57d1fe;})['then'](respondWithFilteredResult(_0x4a0062,_0x49e2af))[_0xc070('0x42')](handleError(_0x4a0062,null));};exports[_0xc070('0x43')]=function(_0x50f00d,_0x4c8c74){var _0x158371={'raw':!![],'where':{'id':_0x50f00d[_0xc070('0x44')]['id']}},_0x189ba3={};_0x189ba3[_0xc070('0x2e')]=_[_0xc070('0x31')](db[_0xc070('0x2a')][_0xc070('0x2b')]);_0x189ba3[_0xc070('0x30')]=_[_0xc070('0x31')](_0x50f00d[_0xc070('0x30')]);_0x189ba3[_0xc070('0x32')]=_[_0xc070('0x33')](_0x189ba3[_0xc070('0x2e')],_0x189ba3[_0xc070('0x30')]);_0x158371[_0xc070('0x35')]=_[_0xc070('0x33')](_0x189ba3[_0xc070('0x2e')],qs[_0xc070('0x34')](_0x50f00d[_0xc070('0x30')][_0xc070('0x34')]));_0x158371[_0xc070('0x35')]=_0x158371[_0xc070('0x35')][_0xc070('0x45')]?_0x158371[_0xc070('0x35')]:_0x189ba3[_0xc070('0x2e')];if(_0x50f00d[_0xc070('0x30')][_0xc070('0x3f')]){_0x158371[_0xc070('0x46')]=[{'all':!![]}];}_0x158371=_[_0xc070('0x3c')]({},_0x158371,_0x50f00d[_0xc070('0x47')]);return db[_0xc070('0x2a')][_0xc070('0x48')](_0x158371)[_0xc070('0x21')](handleEntityNotFound(_0x4c8c74,null))[_0xc070('0x21')](respondWithResult(_0x4c8c74,null))[_0xc070('0x42')](handleError(_0x4c8c74,null));};exports[_0xc070('0x49')]=function(_0x2a044e,_0x177d95){return db[_0xc070('0x2a')]['create'](_0x2a044e[_0xc070('0x4a')],{})[_0xc070('0x21')](function(_0xff790a){var _0xb677f=_0x2a044e[_0xc070('0x4b')][_0xc070('0x23')]({'plain':!![]});if(!_0xb677f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb677f[_0xc070('0x4c')]===_0xc070('0x4b')){var _0x408b12=_0xff790a[_0xc070('0x23')]({'plain':!![]});var _0x44175d='ODBC';return db[_0xc070('0x4d')][_0xc070('0x48')]({'where':{'name':_0x44175d,'userProfileId':_0xb677f[_0xc070('0x4e')]},'raw':!![]})[_0xc070('0x21')](function(_0xc493cd){if(_0xc493cd&&_0xc493cd[_0xc070('0x4f')]===0x0){return db[_0xc070('0x25')][_0xc070('0x49')]({'name':_0x408b12[_0xc070('0x28')],'resourceId':_0x408b12['id'],'type':_0xc493cd[_0xc070('0x28')],'sectionId':_0xc493cd['id']},{})[_0xc070('0x21')](function(){return _0xff790a;});}else{return _0xff790a;}})[_0xc070('0x42')](function(_0x54ee70){logger[_0xc070('0x26')](_0xc070('0x50'),_0x54ee70);throw _0x54ee70;});}return _0xff790a;})[_0xc070('0x21')](respondWithResult(_0x177d95,0xc9))[_0xc070('0x42')](handleError(_0x177d95,null));};exports[_0xc070('0x20')]=function(_0x42e38b,_0x15e305){if(_0x42e38b[_0xc070('0x4a')]['id']){delete _0x42e38b[_0xc070('0x4a')]['id'];}return db[_0xc070('0x2a')][_0xc070('0x48')]({'where':{'id':_0x42e38b['params']['id']}})[_0xc070('0x21')](handleEntityNotFound(_0x15e305,null))['then'](saveUpdates(_0x42e38b[_0xc070('0x4a')],null))[_0xc070('0x21')](respondWithResult(_0x15e305,null))['catch'](handleError(_0x15e305,null));};exports[_0xc070('0x22')]=function(_0x316464,_0x274b77){return db[_0xc070('0x2a')][_0xc070('0x48')]({'where':{'id':_0x316464[_0xc070('0x44')]['id']}})['then'](handleEntityNotFound(_0x274b77,null))[_0xc070('0x21')](removeEntity(_0x274b77,null))[_0xc070('0x42')](handleError(_0x274b77,null));};exports[_0xc070('0x51')]=function(_0x17f41d,_0x473974,_0x122546){var _0xb6d789;return db[_0xc070('0x2a')][_0xc070('0x48')]({'where':{'id':_0x17f41d[_0xc070('0x44')]['id']},'attributes':['id',_0xc070('0x52')]})['then'](handleEntityNotFound(_0x473974,null))[_0xc070('0x21')](function(_0xe51f8){if(_0xe51f8){var _0x26a066=require('odbc')();_0x26a066[_0xc070('0x53')](_0xe51f8[_0xc070('0x52')]);_0x26a066[_0xc070('0x54')]();return _0xe51f8;}})[_0xc070('0x21')](respondWithResult(_0x473974,null))[_0xc070('0x42')](handleError(_0x473974,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 52e2a62..202650f 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 _0x971e=['api','bluebird','request-promise','rimraf','../../config/environment','exports','SquareOdbc','square_odbc','util','../../config/logger'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x971e,0x80));var _0xe971=function(_0x376d68,_0x309ddf){_0x376d68=_0x376d68-0x0;var _0x10bf62=_0x971e[_0x376d68];return _0x10bf62;};'use strict';var _=require('lodash');var util=require(_0xe971('0x0'));var logger=require(_0xe971('0x1'))(_0xe971('0x2'));var moment=require('moment');var BPromise=require(_0xe971('0x3'));var rp=require(_0xe971('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe971('0x5'));var config=require(_0xe971('0x6'));var attributes=require('./squareOdbc.attributes');module[_0xe971('0x7')]=function(_0xa2d66,_0x10f484){return _0xa2d66['define'](_0xe971('0x8'),attributes,{'tableName':_0xe971('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3b8=['request-promise','path','rimraf','exports','lodash','../../config/logger','api','moment','bluebird'];(function(_0x326d34,_0x2e4c9c){var _0x260ef0=function(_0x2aa06b){while(--_0x2aa06b){_0x326d34['push'](_0x326d34['shift']());}};_0x260ef0(++_0x2e4c9c);}(_0xa3b8,0x109));var _0x8a3b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa3b8[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x8a3b('0x0'));var util=require('util');var logger=require(_0x8a3b('0x1'))(_0x8a3b('0x2'));var moment=require(_0x8a3b('0x3'));var BPromise=require(_0x8a3b('0x4'));var rp=require(_0x8a3b('0x5'));var fs=require('fs');var path=require(_0x8a3b('0x6'));var rimraf=require(_0x8a3b('0x7'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x8a3b('0x8')]=function(_0xb4ab3d,_0x148cd9){return _0xb4ab3d['define']('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 49c8a9d..7a4bf4e 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 _0xa40b=['SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','attributes','model','include','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x4e1911,_0x3139fc){var _0x47baf5=function(_0x522a2d){while(--_0x522a2d){_0x4e1911['push'](_0x4e1911['shift']());}};_0x47baf5(++_0x3139fc);}(_0xa40b,0x1b1));var _0xba40=function(_0x369934,_0x2a68a5){_0x369934=_0x369934-0x0;var _0x36c2c1=_0xa40b[_0x369934];return _0x36c2c1;};'use strict';var _=require(_0xba40('0x0'));var util=require(_0xba40('0x1'));var moment=require(_0xba40('0x2'));var BPromise=require(_0xba40('0x3'));var rs=require(_0xba40('0x4'));var fs=require('fs');var Redis=require(_0xba40('0x5'));var db=require(_0xba40('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xba40('0x7'))(_0xba40('0x8'));var config=require(_0xba40('0x9'));var jayson=require(_0xba40('0xa'));var client=jayson[_0xba40('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0c89,_0x5ad0e4,_0x184058){return new BPromise(function(_0xc48d35,_0x596628){return client[_0xba40('0xc')](_0x3b0c89,_0x184058)[_0xba40('0xd')](function(_0x7e840){logger[_0xba40('0xe')](_0xba40('0xf'),_0x5ad0e4,_0xba40('0x10'));logger[_0xba40('0x11')](_0xba40('0x12'),_0x5ad0e4,_0xba40('0x10'),JSON[_0xba40('0x13')](_0x7e840));if(_0x7e840[_0xba40('0x14')]){if(_0x7e840[_0xba40('0x14')][_0xba40('0x15')]===0x1f4){logger[_0xba40('0x14')](_0xba40('0xf'),_0x5ad0e4,_0x7e840[_0xba40('0x14')][_0xba40('0x16')]);return _0x596628(_0x7e840[_0xba40('0x14')][_0xba40('0x16')]);}logger['error'](_0xba40('0xf'),_0x5ad0e4,_0x7e840[_0xba40('0x14')][_0xba40('0x16')]);return _0xc48d35(_0x7e840[_0xba40('0x14')][_0xba40('0x16')]);}else{logger['info'](_0xba40('0xf'),_0x5ad0e4,_0xba40('0x10'));_0xc48d35(_0x7e840[_0xba40('0x17')][_0xba40('0x16')]);}})[_0xba40('0x18')](function(_0x5e23ce){logger[_0xba40('0x14')](_0xba40('0xf'),_0x5ad0e4,_0x5e23ce);_0x596628(_0x5e23ce);});});}exports[_0xba40('0x19')]=function(_0x3d8272){var _0x5844a4=this;return new Promise(function(_0x8207c5,_0x5de7d8){return db['SquareOdbc'][_0xba40('0x1a')]({'raw':_0x3d8272[_0xba40('0x1b')]?_0x3d8272[_0xba40('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3d8272[_0xba40('0x1b')]?_0x3d8272[_0xba40('0x1b')]['where']||null:null,'attributes':_0x3d8272[_0xba40('0x1b')]?_0x3d8272[_0xba40('0x1b')][_0xba40('0x1c')]||null:null,'include':_0x3d8272[_0xba40('0x1b')]?_0x3d8272[_0xba40('0x1b')]['include']?_['map'](_0x3d8272[_0xba40('0x1b')]['include'],function(_0xdbc35c){return{'model':db[_0xdbc35c[_0xba40('0x1d')]],'as':_0xdbc35c['as'],'attributes':_0xdbc35c[_0xba40('0x1c')],'include':_0xdbc35c[_0xba40('0x1e')]?_[_0xba40('0x1f')](_0xdbc35c['include'],function(_0x152624){return{'model':db[_0x152624['model']],'as':_0x152624['as'],'attributes':_0x152624[_0xba40('0x1c')],'include':_0x152624['include']?_[_0xba40('0x1f')](_0x152624[_0xba40('0x1e')],function(_0x2c1ef0){return{'model':db[_0x2c1ef0[_0xba40('0x1d')]],'as':_0x2c1ef0['as'],'attributes':_0x2c1ef0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ff549){logger[_0xba40('0xe')](_0xba40('0x19'),_0x3d8272);logger[_0xba40('0x11')](_0xba40('0x19'),_0x3d8272,JSON[_0xba40('0x13')](_0x2ff549));_0x8207c5(_0x2ff549);})[_0xba40('0x18')](function(_0xa25ed6){logger['error'](_0xba40('0x19'),_0xa25ed6[_0xba40('0x16')],_0x3d8272);_0x5de7d8(_0x5844a4['error'](0x1f4,_0xa25ed6[_0xba40('0x16')]));});});}; \ No newline at end of file +var _0xb461=['include','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','attributes','map'];(function(_0x1f9aa2,_0x3d36b){var _0x355d0f=function(_0x19e69){while(--_0x19e69){_0x1f9aa2['push'](_0x1f9aa2['shift']());}};_0x355d0f(++_0x3d36b);}(_0xb461,0xce));var _0x1b46=function(_0x2517bb,_0x1b5a61){_0x2517bb=_0x2517bb-0x0;var _0x4e82fd=_0xb461[_0x2517bb];return _0x4e82fd;};'use strict';var _=require(_0x1b46('0x0'));var util=require(_0x1b46('0x1'));var moment=require(_0x1b46('0x2'));var BPromise=require(_0x1b46('0x3'));var rs=require(_0x1b46('0x4'));var fs=require('fs');var Redis=require(_0x1b46('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b46('0x6'));var logger=require(_0x1b46('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1b46('0x8'));var client=jayson['client'][_0x1b46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcb4777,_0x1605b1,_0x2a9216){return new BPromise(function(_0x195b9d,_0x28bf18){return client['request'](_0xcb4777,_0x2a9216)[_0x1b46('0xa')](function(_0x5f49cb){logger[_0x1b46('0xb')](_0x1b46('0xc'),_0x1605b1,'request\x20sent');logger[_0x1b46('0xd')](_0x1b46('0xe'),_0x1605b1,_0x1b46('0xf'),JSON[_0x1b46('0x10')](_0x5f49cb));if(_0x5f49cb[_0x1b46('0x11')]){if(_0x5f49cb[_0x1b46('0x11')]['code']===0x1f4){logger[_0x1b46('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x1605b1,_0x5f49cb[_0x1b46('0x11')][_0x1b46('0x12')]);return _0x28bf18(_0x5f49cb[_0x1b46('0x11')][_0x1b46('0x12')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1605b1,_0x5f49cb['error']['message']);return _0x195b9d(_0x5f49cb[_0x1b46('0x11')][_0x1b46('0x12')]);}else{logger[_0x1b46('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x1605b1,_0x1b46('0xf'));_0x195b9d(_0x5f49cb[_0x1b46('0x13')]['message']);}})['catch'](function(_0x2644df){logger[_0x1b46('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x1605b1,_0x2644df);_0x28bf18(_0x2644df);});});}exports[_0x1b46('0x14')]=function(_0x24f001){var _0x399838=this;return new Promise(function(_0x127c47,_0x95b50a){return db[_0x1b46('0x15')][_0x1b46('0x16')]({'raw':_0x24f001[_0x1b46('0x17')]?_0x24f001[_0x1b46('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x24f001[_0x1b46('0x17')]?_0x24f001[_0x1b46('0x17')]['where']||null:null,'attributes':_0x24f001[_0x1b46('0x17')]?_0x24f001[_0x1b46('0x17')][_0x1b46('0x18')]||null:null,'include':_0x24f001[_0x1b46('0x17')]?_0x24f001['options']['include']?_[_0x1b46('0x19')](_0x24f001[_0x1b46('0x17')][_0x1b46('0x1a')],function(_0xd786d){return{'model':db[_0xd786d['model']],'as':_0xd786d['as'],'attributes':_0xd786d['attributes'],'include':_0xd786d[_0x1b46('0x1a')]?_[_0x1b46('0x19')](_0xd786d[_0x1b46('0x1a')],function(_0x34066e){return{'model':db[_0x34066e[_0x1b46('0x1b')]],'as':_0x34066e['as'],'attributes':_0x34066e[_0x1b46('0x18')],'include':_0x34066e[_0x1b46('0x1a')]?_[_0x1b46('0x19')](_0x34066e[_0x1b46('0x1a')],function(_0x1c0fd6){return{'model':db[_0x1c0fd6[_0x1b46('0x1b')]],'as':_0x1c0fd6['as'],'attributes':_0x1c0fd6[_0x1b46('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24da82){logger[_0x1b46('0xb')](_0x1b46('0x14'),_0x24f001);logger[_0x1b46('0xd')](_0x1b46('0x14'),_0x24f001,JSON[_0x1b46('0x10')](_0x24da82));_0x127c47(_0x24da82);})[_0x1b46('0x1c')](function(_0x2e05ef){logger['error'](_0x1b46('0x14'),_0x2e05ef[_0x1b46('0x12')],_0x24f001);_0x95b50a(_0x399838[_0x1b46('0x11')](0x1f4,_0x2e05ef[_0x1b46('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 09b01b2..9e0b382 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 _0x2f15=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','multer','path','connect-timeout'];(function(_0x31f9e4,_0x44ac4e){var _0x501874=function(_0x4493e1){while(--_0x4493e1){_0x31f9e4['push'](_0x31f9e4['shift']());}};_0x501874(++_0x44ac4e);}(_0x2f15,0x1b7));var _0x52f1=function(_0x1d5e0e,_0x40f9eb){_0x1d5e0e=_0x1d5e0e-0x0;var _0x1acedc=_0x2f15[_0x1d5e0e];return _0x1acedc;};'use strict';var multer=require(_0x52f1('0x0'));var util=require('util');var path=require(_0x52f1('0x1'));var timeout=require(_0x52f1('0x2'));var express=require(_0x52f1('0x3'));var router=express[_0x52f1('0x4')]();var fs_extra=require(_0x52f1('0x5'));var auth=require(_0x52f1('0x6'));var interaction=require(_0x52f1('0x7'));var config=require('../../config/environment');var controller=require(_0x52f1('0x8'));router[_0x52f1('0x9')]('/',auth[_0x52f1('0xa')](),controller[_0x52f1('0xb')]);router[_0x52f1('0x9')](_0x52f1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x52f1('0xd')]('/',auth[_0x52f1('0xa')](),controller[_0x52f1('0xe')]);router['put']('/:id',auth[_0x52f1('0xa')](),controller[_0x52f1('0xf')]);router['delete']('/:id',auth[_0x52f1('0xa')](),controller[_0x52f1('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb9f9=['index','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0xb9f9,0x13a));var _0x9b9f=function(_0x26d019,_0x13ca4a){_0x26d019=_0x26d019-0x0;var _0x275632=_0xb9f9[_0x26d019];return _0x275632;};'use strict';var multer=require(_0x9b9f('0x0'));var util=require(_0x9b9f('0x1'));var path=require(_0x9b9f('0x2'));var timeout=require(_0x9b9f('0x3'));var express=require(_0x9b9f('0x4'));var router=express['Router']();var fs_extra=require(_0x9b9f('0x5'));var auth=require(_0x9b9f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9b9f('0x7'));var controller=require('./squareProject.controller');router[_0x9b9f('0x8')]('/',auth[_0x9b9f('0x9')](),controller[_0x9b9f('0xa')]);router['get']('/:id',auth[_0x9b9f('0x9')](),controller['show']);router['post']('/',auth[_0x9b9f('0x9')](),controller[_0x9b9f('0xb')]);router[_0x9b9f('0xc')](_0x9b9f('0xd'),auth['isAuthenticated'](),controller[_0x9b9f('0xe')]);router[_0x9b9f('0xf')](_0x9b9f('0xd'),auth[_0x9b9f('0x9')](),controller[_0x9b9f('0x10')]);module[_0x9b9f('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index aa407d4..a7aa801 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 _0x2c37=['DATE','sequelize','STRING','name','BLOB','preproduction','getDataValue','toString','utf8','long','production'];(function(_0x3d14d1,_0x23aa69){var _0xc78d1f=function(_0x40edbe){while(--_0x40edbe){_0x3d14d1['push'](_0x3d14d1['shift']());}};_0xc78d1f(++_0x23aa69);}(_0x2c37,0x135));var _0x72c3=function(_0x3ccec7,_0x180123){_0x3ccec7=_0x3ccec7-0x0;var _0x3e91c1=_0x2c37[_0x3ccec7];return _0x3e91c1;};'use strict';var Sequelize=require(_0x72c3('0x0'));module['exports']={'name':{'type':Sequelize[_0x72c3('0x1')],'unique':_0x72c3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x72c3('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x72c3('0x3')]('long'),'get':function(){if(this['getDataValue'](_0x72c3('0x4'))){return this[_0x72c3('0x5')](_0x72c3('0x4'))[_0x72c3('0x6')](_0x72c3('0x7'));}}},'production':{'type':Sequelize[_0x72c3('0x3')](_0x72c3('0x8')),'get':function(){if(this['getDataValue']('production')){return this[_0x72c3('0x5')](_0x72c3('0x9'))[_0x72c3('0x6')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x72c3('0xa')]}}; \ No newline at end of file +var _0x3127=['long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','name','STRING','TEXT'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x3127,0xbb));var _0x7312=function(_0x32003d,_0x50ed19){_0x32003d=_0x32003d-0x0;var _0x4c09ee=_0x3127[_0x32003d];return _0x4c09ee;};'use strict';var Sequelize=require(_0x7312('0x0'));module[_0x7312('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7312('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7312('0x3')]},'notes':{'type':Sequelize[_0x7312('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x7312('0x5')),'get':function(){if(this[_0x7312('0x6')]('preproduction')){return this['getDataValue'](_0x7312('0x7'))[_0x7312('0x8')](_0x7312('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x7312('0x5')),'get':function(){if(this[_0x7312('0x6')](_0x7312('0xa'))){return this[_0x7312('0x6')](_0x7312('0xa'))[_0x7312('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x7312('0xb')]},'publishedAt':{'type':Sequelize[_0x7312('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ef952c5..df03f40 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 _0x5cbb=['filters','filter','VIRTUAL','merge','options','SquareProject','findAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','pick','production','lodash','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cbb,0x1b6));var _0xb5cb=function(_0x31e9ce,_0x15e360){_0x31e9ce=_0x31e9ce-0x0;var _0x119708=_0x5cbb[_0x31e9ce];return _0x119708;};'use strict';var _=require(_0xb5cb('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xb5cb('0x1'))('api');var config=require('../../config/environment');var db=require(_0xb5cb('0x2'))['db'];config[_0xb5cb('0x3')]=_[_0xb5cb('0x4')](config[_0xb5cb('0x3')],{'host':_0xb5cb('0x5'),'port':0x18eb});var socket=require(_0xb5cb('0x6'))(new Redis(config[_0xb5cb('0x3')]));require(_0xb5cb('0x7'))[_0xb5cb('0x8')](socket);function respondWithResult(_0x526d98,_0x46764b){_0x46764b=_0x46764b||0xc8;return function(_0x11bf64){if(_0x11bf64){return _0x526d98[_0xb5cb('0x9')](_0x46764b)[_0xb5cb('0xa')](_0x11bf64);}};}function respondWithFilteredResult(_0xa87145,_0x1df5c3){return function(_0x54d19f){if(_0x54d19f){var _0x484baa=typeof _0x1df5c3[_0xb5cb('0xb')]===_0xb5cb('0xc')&&typeof _0x1df5c3[_0xb5cb('0xd')]===_0xb5cb('0xc');var _0x284e6e=_0x54d19f[_0xb5cb('0xe')];var _0x511236=_0x484baa?0x0:_0x1df5c3[_0xb5cb('0xb')];var _0xe21f4e=_0x484baa?_0x54d19f['count']:_0x1df5c3[_0xb5cb('0xb')]+_0x1df5c3[_0xb5cb('0xd')];var _0x28c4a9;if(_0xe21f4e>=_0x284e6e){_0xe21f4e=_0x284e6e;_0x28c4a9=0xc8;}else{_0x28c4a9=0xce;}_0xa87145[_0xb5cb('0x9')](_0x28c4a9);return _0xa87145[_0xb5cb('0xf')](_0xb5cb('0x10'),_0x511236+'-'+_0xe21f4e+'/'+_0x284e6e)[_0xb5cb('0xa')](_0x54d19f);}return null;};}function saveUpdates(_0x431c85){return function(_0x5d6b3b){if(_0x5d6b3b){return _0x5d6b3b['update'](_0x431c85)[_0xb5cb('0x11')](function(_0x1b6498){return _0x1b6498;});}return null;};}function removeEntity(_0x3c165a){return function(_0x938923){if(_0x938923){return _0x938923[_0xb5cb('0x12')]()[_0xb5cb('0x11')](function(){var _0x1c78b3=_0x938923[_0xb5cb('0x13')]({'plain':!![]});var _0x529990=_0xb5cb('0x14');return db[_0xb5cb('0x15')][_0xb5cb('0x12')]({'where':{'type':_0x529990,'resourceId':_0x1c78b3['id']}})['then'](function(){return _0x938923;});})[_0xb5cb('0x11')](function(){var _0x1745b0=new Redis(config[_0xb5cb('0x3')]);_0x1745b0[_0xb5cb('0x16')](_0xb5cb('0x17'),JSON[_0xb5cb('0x18')]({'id':_0x938923['id'],'deleted':!![]}));})[_0xb5cb('0x11')](function(){_0x3c165a['status'](0xcc)[_0xb5cb('0x19')]();});}};}function handleEntityNotFound(_0x530a8e){return function(_0x101ecd){if(!_0x101ecd){_0x530a8e[_0xb5cb('0x1a')](0x194);}return _0x101ecd;};}function handleError(_0x445d21,_0x53080a){_0x53080a=_0x53080a||0x1f4;return function(_0x10a991){logger[_0xb5cb('0x1b')](_0x10a991[_0xb5cb('0x1c')]);if(_0x10a991[_0xb5cb('0x1d')]){delete _0x10a991[_0xb5cb('0x1d')];}_0x445d21['status'](_0x53080a)['send'](_0x10a991);};}exports[_0xb5cb('0x1e')]=function(_0x2249f5,_0x436b62){var _0x9641f2={},_0xc0c0e0={},_0x2023cd={'count':0x0,'rows':[]};var _0x2523dc=_[_0xb5cb('0x1f')](db['SquareProject'][_0xb5cb('0x20')],function(_0x20b8ad){return{'name':_0x20b8ad[_0xb5cb('0x21')],'type':_0x20b8ad[_0xb5cb('0x22')]['key']};});_0xc0c0e0['model']=_[_0xb5cb('0x1f')](_0x2523dc,_0xb5cb('0x1d'));_0xc0c0e0[_0xb5cb('0x23')]=_['keys'](_0x2249f5['query']);_0xc0c0e0['filters']=_[_0xb5cb('0x24')](_0xc0c0e0[_0xb5cb('0x25')],_0xc0c0e0['query']);_0x9641f2[_0xb5cb('0x26')]=_[_0xb5cb('0x24')](_0xc0c0e0[_0xb5cb('0x25')],qs[_0xb5cb('0x27')](_0x2249f5[_0xb5cb('0x23')][_0xb5cb('0x27')]));_0x9641f2[_0xb5cb('0x26')]=_0x9641f2[_0xb5cb('0x26')][_0xb5cb('0x28')]?_0x9641f2['attributes']:_0xc0c0e0[_0xb5cb('0x25')];if(!_0x2249f5[_0xb5cb('0x23')][_0xb5cb('0x29')](_0xb5cb('0x2a'))){_0x9641f2['limit']=qs[_0xb5cb('0xd')](_0x2249f5[_0xb5cb('0x23')][_0xb5cb('0xd')]);_0x9641f2[_0xb5cb('0xb')]=qs[_0xb5cb('0xb')](_0x2249f5[_0xb5cb('0x23')][_0xb5cb('0xb')]);}_0x9641f2['order']=qs[_0xb5cb('0x2b')](_0x2249f5[_0xb5cb('0x23')][_0xb5cb('0x2b')]);_0x9641f2[_0xb5cb('0x2c')]=qs[_0xb5cb('0x2d')](_['pick'](_0x2249f5['query'],_0xc0c0e0['filters']),_0x2523dc);if(_0x2249f5[_0xb5cb('0x23')][_0xb5cb('0x2e')]){_0x9641f2[_0xb5cb('0x2c')]=_['merge'](_0x9641f2[_0xb5cb('0x2c')],{'$or':_[_0xb5cb('0x1f')](_0x2523dc,function(_0x8219f7){if(_0x8219f7[_0xb5cb('0x22')]!==_0xb5cb('0x2f')){var _0x8f475={};_0x8f475[_0x8219f7[_0xb5cb('0x1d')]]={'$like':'%'+_0x2249f5[_0xb5cb('0x23')][_0xb5cb('0x2e')]+'%'};return _0x8f475;}})});}_0x9641f2=_[_0xb5cb('0x30')]({},_0x9641f2,_0x2249f5[_0xb5cb('0x31')]);var _0x31f9fa={'where':_0x9641f2[_0xb5cb('0x2c')]};return db[_0xb5cb('0x32')]['count'](_0x31f9fa)[_0xb5cb('0x11')](function(_0x5e4fac){_0x2023cd[_0xb5cb('0xe')]=_0x5e4fac;if(_0x2249f5[_0xb5cb('0x23')]['includeAll']){_0x9641f2['include']=[{'all':!![]}];}return db[_0xb5cb('0x32')][_0xb5cb('0x33')](_0x9641f2);})['then'](function(_0x382670){_0x2023cd[_0xb5cb('0x34')]=_0x382670;return _0x2023cd;})[_0xb5cb('0x11')](respondWithFilteredResult(_0x436b62,_0x9641f2))[_0xb5cb('0x35')](handleError(_0x436b62,null));};exports[_0xb5cb('0x36')]=function(_0xccd06,_0x35fb00){var _0x9000f7={'raw':![],'where':{'id':_0xccd06[_0xb5cb('0x37')]['id']}},_0x228ca9={};_0x228ca9[_0xb5cb('0x25')]=_[_0xb5cb('0x38')](db[_0xb5cb('0x32')][_0xb5cb('0x20')]);_0x228ca9['query']=_[_0xb5cb('0x38')](_0xccd06[_0xb5cb('0x23')]);_0x228ca9[_0xb5cb('0x2d')]=_['intersection'](_0x228ca9[_0xb5cb('0x25')],_0x228ca9[_0xb5cb('0x23')]);_0x9000f7['attributes']=_[_0xb5cb('0x24')](_0x228ca9[_0xb5cb('0x25')],qs[_0xb5cb('0x27')](_0xccd06[_0xb5cb('0x23')][_0xb5cb('0x27')]));_0x9000f7[_0xb5cb('0x26')]=_0x9000f7[_0xb5cb('0x26')][_0xb5cb('0x28')]?_0x9000f7[_0xb5cb('0x26')]:_0x228ca9[_0xb5cb('0x25')];if(_0xccd06[_0xb5cb('0x23')]['includeAll']){_0x9000f7[_0xb5cb('0x39')]=[{'all':!![]}];}_0x9000f7=_[_0xb5cb('0x30')]({},_0x9000f7,_0xccd06[_0xb5cb('0x31')]);return db[_0xb5cb('0x32')][_0xb5cb('0x3a')](_0x9000f7)[_0xb5cb('0x11')](handleEntityNotFound(_0x35fb00,null))[_0xb5cb('0x11')](respondWithResult(_0x35fb00,null))[_0xb5cb('0x35')](handleError(_0x35fb00,null));};exports[_0xb5cb('0x3b')]=function(_0x4d5af8,_0x1db1fd){return db[_0xb5cb('0x32')][_0xb5cb('0x3b')](_0x4d5af8[_0xb5cb('0x3c')],{})['then'](function(_0x251931){var _0x2564c7=_0x4d5af8[_0xb5cb('0x3d')][_0xb5cb('0x13')]({'plain':!![]});if(!_0x2564c7)throw new Error(_0xb5cb('0x3e'));if(_0x2564c7[_0xb5cb('0x3f')]===_0xb5cb('0x3d')){var _0x3e62c2=_0x251931[_0xb5cb('0x13')]({'plain':!![]});var _0x128e15=_0xb5cb('0x14');return db['UserProfileSection']['find']({'where':{'name':_0x128e15,'userProfileId':_0x2564c7[_0xb5cb('0x40')]},'raw':!![]})['then'](function(_0x3aef2a){if(_0x3aef2a&&_0x3aef2a[_0xb5cb('0x41')]===0x0){return db['UserProfileResource'][_0xb5cb('0x3b')]({'name':_0x3e62c2[_0xb5cb('0x1d')],'resourceId':_0x3e62c2['id'],'type':_0x3aef2a[_0xb5cb('0x1d')],'sectionId':_0x3aef2a['id']},{})[_0xb5cb('0x11')](function(){return _0x251931;});}else{return _0x251931;}})[_0xb5cb('0x35')](function(_0x11969a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11969a);throw _0x11969a;});}return _0x251931;})[_0xb5cb('0x11')](respondWithResult(_0x1db1fd,0xc9))['catch'](handleError(_0x1db1fd,null));};exports[_0xb5cb('0x42')]=function(_0x378d88,_0x55ca7b){if(_0x378d88[_0xb5cb('0x3c')]['id']){delete _0x378d88[_0xb5cb('0x3c')]['id'];}return db[_0xb5cb('0x32')]['find']({'where':{'id':_0x378d88[_0xb5cb('0x37')]['id']}})[_0xb5cb('0x11')](handleEntityNotFound(_0x55ca7b,null))['then'](saveUpdates(_0x378d88[_0xb5cb('0x3c')],null))[_0xb5cb('0x11')](function(_0x425276){if(!_0x425276)return;var _0x4558f4=_0x425276['get']({'plain':!![]});return _0x4558f4;})[_0xb5cb('0x11')](function(_0x569e20){var _0x1a493a=new Redis(config[_0xb5cb('0x3')]);_0x1a493a[_0xb5cb('0x16')](_0xb5cb('0x17'),JSON[_0xb5cb('0x18')](_[_0xb5cb('0x43')](_0x569e20,['id',_0xb5cb('0x1d'),_0xb5cb('0x44')])));return _0x569e20;})[_0xb5cb('0x11')](respondWithResult(_0x55ca7b,null))[_0xb5cb('0x35')](handleError(_0x55ca7b,null));};exports[_0xb5cb('0x12')]=function(_0x13c872,_0x12de42){return db[_0xb5cb('0x32')]['find']({'where':{'id':_0x13c872[_0xb5cb('0x37')]['id']}})[_0xb5cb('0x11')](handleEntityNotFound(_0x12de42,null))[_0xb5cb('0x11')](removeEntity(_0x12de42,null))[_0xb5cb('0x35')](handleError(_0x12de42,null));}; \ No newline at end of file +var _0xe7b9=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','publish','pick','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','offset','limit','undefined','count','Content-Range','json','update','then','get','SquareProjects','destroy','agi','stringify','end','error','name','send','SquareProject','rawAttributes','fieldName','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body'];(function(_0x564a37,_0x1dda30){var _0x434713=function(_0x5c99ef){while(--_0x5c99ef){_0x564a37['push'](_0x564a37['shift']());}};_0x434713(++_0x1dda30);}(_0xe7b9,0x153));var _0x9e7b=function(_0x190d8a,_0x269800){_0x190d8a=_0x190d8a-0x0;var _0x16c898=_0xe7b9[_0x190d8a];return _0x16c898;};'use strict';var _=require(_0x9e7b('0x0'));var Redis=require('ioredis');var qs=require(_0x9e7b('0x1'));var logger=require(_0x9e7b('0x2'))(_0x9e7b('0x3'));var config=require(_0x9e7b('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9e7b('0x5')],{'host':_0x9e7b('0x6'),'port':0x18eb});var socket=require(_0x9e7b('0x7'))(new Redis(config['redis']));require(_0x9e7b('0x8'))[_0x9e7b('0x9')](socket);function respondWithResult(_0x59db73,_0x3882d8){_0x3882d8=_0x3882d8||0xc8;return function(_0x25afca){if(_0x25afca){return _0x59db73[_0x9e7b('0xa')](_0x3882d8)['json'](_0x25afca);}};}function respondWithFilteredResult(_0x4e753b,_0x237bd3){return function(_0x1f2429){if(_0x1f2429){var _0x283c4f=typeof _0x237bd3[_0x9e7b('0xb')]==='undefined'&&typeof _0x237bd3[_0x9e7b('0xc')]===_0x9e7b('0xd');var _0x12c76e=_0x1f2429[_0x9e7b('0xe')];var _0x5404c8=_0x283c4f?0x0:_0x237bd3[_0x9e7b('0xb')];var _0x2eb20f=_0x283c4f?_0x1f2429[_0x9e7b('0xe')]:_0x237bd3[_0x9e7b('0xb')]+_0x237bd3[_0x9e7b('0xc')];var _0x19155e;if(_0x2eb20f>=_0x12c76e){_0x2eb20f=_0x12c76e;_0x19155e=0xc8;}else{_0x19155e=0xce;}_0x4e753b[_0x9e7b('0xa')](_0x19155e);return _0x4e753b['set'](_0x9e7b('0xf'),_0x5404c8+'-'+_0x2eb20f+'/'+_0x12c76e)[_0x9e7b('0x10')](_0x1f2429);}return null;};}function saveUpdates(_0x2bbb0b){return function(_0x41032d){if(_0x41032d){return _0x41032d[_0x9e7b('0x11')](_0x2bbb0b)[_0x9e7b('0x12')](function(_0x5b49cd){return _0x5b49cd;});}return null;};}function removeEntity(_0x57a6d5){return function(_0x42d359){if(_0x42d359){return _0x42d359['destroy']()['then'](function(){var _0x5e8986=_0x42d359[_0x9e7b('0x13')]({'plain':!![]});var _0x302cf4=_0x9e7b('0x14');return db['UserProfileResource'][_0x9e7b('0x15')]({'where':{'type':_0x302cf4,'resourceId':_0x5e8986['id']}})['then'](function(){return _0x42d359;});})[_0x9e7b('0x12')](function(){var _0x447338=new Redis(config[_0x9e7b('0x5')]);_0x447338['publish'](_0x9e7b('0x16'),JSON[_0x9e7b('0x17')]({'id':_0x42d359['id'],'deleted':!![]}));})[_0x9e7b('0x12')](function(){_0x57a6d5['status'](0xcc)[_0x9e7b('0x18')]();});}};}function handleEntityNotFound(_0x2c5589){return function(_0x16360c){if(!_0x16360c){_0x2c5589['sendStatus'](0x194);}return _0x16360c;};}function handleError(_0x75e002,_0x15ac07){_0x15ac07=_0x15ac07||0x1f4;return function(_0x428659){logger[_0x9e7b('0x19')](_0x428659['stack']);if(_0x428659['name']){delete _0x428659[_0x9e7b('0x1a')];}_0x75e002[_0x9e7b('0xa')](_0x15ac07)[_0x9e7b('0x1b')](_0x428659);};}exports['index']=function(_0xae4db,_0x4ae31d){var _0x2a11aa={},_0x4f1bf7={},_0x163810={'count':0x0,'rows':[]};var _0x27b94f=_['map'](db[_0x9e7b('0x1c')][_0x9e7b('0x1d')],function(_0x26a737){return{'name':_0x26a737[_0x9e7b('0x1e')],'type':_0x26a737['type']['key']};});_0x4f1bf7['model']=_[_0x9e7b('0x1f')](_0x27b94f,_0x9e7b('0x1a'));_0x4f1bf7['query']=_['keys'](_0xae4db[_0x9e7b('0x20')]);_0x4f1bf7[_0x9e7b('0x21')]=_[_0x9e7b('0x22')](_0x4f1bf7['model'],_0x4f1bf7[_0x9e7b('0x20')]);_0x2a11aa[_0x9e7b('0x23')]=_[_0x9e7b('0x22')](_0x4f1bf7[_0x9e7b('0x24')],qs['fields'](_0xae4db[_0x9e7b('0x20')][_0x9e7b('0x25')]));_0x2a11aa['attributes']=_0x2a11aa[_0x9e7b('0x23')][_0x9e7b('0x26')]?_0x2a11aa[_0x9e7b('0x23')]:_0x4f1bf7[_0x9e7b('0x24')];if(!_0xae4db[_0x9e7b('0x20')]['hasOwnProperty'](_0x9e7b('0x27'))){_0x2a11aa[_0x9e7b('0xc')]=qs[_0x9e7b('0xc')](_0xae4db['query'][_0x9e7b('0xc')]);_0x2a11aa['offset']=qs['offset'](_0xae4db[_0x9e7b('0x20')][_0x9e7b('0xb')]);}_0x2a11aa[_0x9e7b('0x28')]=qs[_0x9e7b('0x29')](_0xae4db[_0x9e7b('0x20')][_0x9e7b('0x29')]);_0x2a11aa[_0x9e7b('0x2a')]=qs[_0x9e7b('0x21')](_['pick'](_0xae4db['query'],_0x4f1bf7[_0x9e7b('0x21')]),_0x27b94f);if(_0xae4db[_0x9e7b('0x20')][_0x9e7b('0x2b')]){_0x2a11aa[_0x9e7b('0x2a')]=_[_0x9e7b('0x2c')](_0x2a11aa[_0x9e7b('0x2a')],{'$or':_[_0x9e7b('0x1f')](_0x27b94f,function(_0xdfbb10){if(_0xdfbb10['type']!==_0x9e7b('0x2d')){var _0x9d5135={};_0x9d5135[_0xdfbb10[_0x9e7b('0x1a')]]={'$like':'%'+_0xae4db[_0x9e7b('0x20')]['filter']+'%'};return _0x9d5135;}})});}_0x2a11aa=_[_0x9e7b('0x2c')]({},_0x2a11aa,_0xae4db[_0x9e7b('0x2e')]);var _0x17c6fc={'where':_0x2a11aa[_0x9e7b('0x2a')]};return db['SquareProject'][_0x9e7b('0xe')](_0x17c6fc)['then'](function(_0x39f757){_0x163810[_0x9e7b('0xe')]=_0x39f757;if(_0xae4db[_0x9e7b('0x20')][_0x9e7b('0x2f')]){_0x2a11aa[_0x9e7b('0x30')]=[{'all':!![]}];}return db[_0x9e7b('0x1c')][_0x9e7b('0x31')](_0x2a11aa);})['then'](function(_0x3b0bab){_0x163810[_0x9e7b('0x32')]=_0x3b0bab;return _0x163810;})['then'](respondWithFilteredResult(_0x4ae31d,_0x2a11aa))['catch'](handleError(_0x4ae31d,null));};exports['show']=function(_0x4cedda,_0x126f21){var _0x5e5255={'raw':![],'where':{'id':_0x4cedda[_0x9e7b('0x33')]['id']}},_0x4825be={};_0x4825be[_0x9e7b('0x24')]=_[_0x9e7b('0x34')](db[_0x9e7b('0x1c')][_0x9e7b('0x1d')]);_0x4825be[_0x9e7b('0x20')]=_[_0x9e7b('0x34')](_0x4cedda[_0x9e7b('0x20')]);_0x4825be['filters']=_['intersection'](_0x4825be[_0x9e7b('0x24')],_0x4825be[_0x9e7b('0x20')]);_0x5e5255['attributes']=_['intersection'](_0x4825be[_0x9e7b('0x24')],qs[_0x9e7b('0x25')](_0x4cedda['query'][_0x9e7b('0x25')]));_0x5e5255['attributes']=_0x5e5255[_0x9e7b('0x23')][_0x9e7b('0x26')]?_0x5e5255['attributes']:_0x4825be[_0x9e7b('0x24')];if(_0x4cedda[_0x9e7b('0x20')][_0x9e7b('0x2f')]){_0x5e5255[_0x9e7b('0x30')]=[{'all':!![]}];}_0x5e5255=_[_0x9e7b('0x2c')]({},_0x5e5255,_0x4cedda[_0x9e7b('0x2e')]);return db[_0x9e7b('0x1c')][_0x9e7b('0x35')](_0x5e5255)[_0x9e7b('0x12')](handleEntityNotFound(_0x126f21,null))[_0x9e7b('0x12')](respondWithResult(_0x126f21,null))[_0x9e7b('0x36')](handleError(_0x126f21,null));};exports[_0x9e7b('0x37')]=function(_0xe6bd3a,_0xbb99bb){return db['SquareProject']['create'](_0xe6bd3a[_0x9e7b('0x38')],{})[_0x9e7b('0x12')](function(_0x4f81f2){var _0x3527e1=_0xe6bd3a['user']['get']({'plain':!![]});if(!_0x3527e1)throw new Error(_0x9e7b('0x39'));if(_0x3527e1[_0x9e7b('0x3a')]===_0x9e7b('0x3b')){var _0x19b337=_0x4f81f2[_0x9e7b('0x13')]({'plain':!![]});var _0x566787=_0x9e7b('0x14');return db['UserProfileSection'][_0x9e7b('0x35')]({'where':{'name':_0x566787,'userProfileId':_0x3527e1[_0x9e7b('0x3c')]},'raw':!![]})[_0x9e7b('0x12')](function(_0x1018b8){if(_0x1018b8&&_0x1018b8[_0x9e7b('0x3d')]===0x0){return db[_0x9e7b('0x3e')][_0x9e7b('0x37')]({'name':_0x19b337[_0x9e7b('0x1a')],'resourceId':_0x19b337['id'],'type':_0x1018b8[_0x9e7b('0x1a')],'sectionId':_0x1018b8['id']},{})[_0x9e7b('0x12')](function(){return _0x4f81f2;});}else{return _0x4f81f2;}})['catch'](function(_0xd1dfef){logger[_0x9e7b('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd1dfef);throw _0xd1dfef;});}return _0x4f81f2;})[_0x9e7b('0x12')](respondWithResult(_0xbb99bb,0xc9))['catch'](handleError(_0xbb99bb,null));};exports['update']=function(_0x4b449d,_0x32efb6){if(_0x4b449d['body']['id']){delete _0x4b449d[_0x9e7b('0x38')]['id'];}return db[_0x9e7b('0x1c')]['find']({'where':{'id':_0x4b449d[_0x9e7b('0x33')]['id']}})['then'](handleEntityNotFound(_0x32efb6,null))[_0x9e7b('0x12')](saveUpdates(_0x4b449d[_0x9e7b('0x38')],null))[_0x9e7b('0x12')](function(_0x26570d){if(!_0x26570d)return;var _0x4fbca0=_0x26570d[_0x9e7b('0x13')]({'plain':!![]});return _0x4fbca0;})[_0x9e7b('0x12')](function(_0xe5f806){var _0x1f6fe4=new Redis(config['redis']);_0x1f6fe4[_0x9e7b('0x3f')](_0x9e7b('0x16'),JSON[_0x9e7b('0x17')](_[_0x9e7b('0x40')](_0xe5f806,['id',_0x9e7b('0x1a'),_0x9e7b('0x41')])));return _0xe5f806;})['then'](respondWithResult(_0x32efb6,null))[_0x9e7b('0x36')](handleError(_0x32efb6,null));};exports['destroy']=function(_0xccc1be,_0x5c800b){return db[_0x9e7b('0x1c')][_0x9e7b('0x35')]({'where':{'id':_0xccc1be[_0x9e7b('0x33')]['id']}})[_0x9e7b('0x12')](handleEntityNotFound(_0x5c800b,null))[_0x9e7b('0x12')](removeEntity(_0x5c800b,null))[_0x9e7b('0x36')](handleError(_0x5c800b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index c95c523..e53f346 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 _0x5479=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4e8bcd,_0x232ffe){var _0x339018=function(_0x52153a){while(--_0x52153a){_0x4e8bcd['push'](_0x4e8bcd['shift']());}};_0x339018(++_0x232ffe);}(_0x5479,0x117));var _0x9547=function(_0x53b824,_0xe366b4){_0x53b824=_0x53b824-0x0;var _0x1f02a0=_0x5479[_0x53b824];return _0x1f02a0;};'use strict';var EventEmitter=require(_0x9547('0x0'));var SquareProject=require(_0x9547('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9547('0x2')](0x0);var events={'afterCreate':_0x9547('0x3'),'afterUpdate':_0x9547('0x4'),'afterDestroy':_0x9547('0x5')};function emitEvent(_0xa42b43){return function(_0x1502ab,_0x15ad2d,_0x102244){SquareProjectEvents[_0x9547('0x6')](_0xa42b43+':'+_0x1502ab['id'],_0x1502ab);SquareProjectEvents[_0x9547('0x6')](_0xa42b43,_0x1502ab);_0x102244(null);};}for(var e in events){if(events[_0x9547('0x7')](e)){var event=events[e];SquareProject[_0x9547('0x8')](e,emitEvent(event));}}module[_0x9547('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xa7d5=['exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x34ae37,_0x4faede){var _0x503398=function(_0x389e27){while(--_0x389e27){_0x34ae37['push'](_0x34ae37['shift']());}};_0x503398(++_0x4faede);}(_0xa7d5,0x1dd));var _0x5a7d=function(_0xc6be1b,_0x2437ac){_0xc6be1b=_0xc6be1b-0x0;var _0x49c768=_0xa7d5[_0xc6be1b];return _0x49c768;};'use strict';var EventEmitter=require(_0x5a7d('0x0'));var SquareProject=require(_0x5a7d('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5a7d('0x2'),'afterUpdate':'update','afterDestroy':_0x5a7d('0x3')};function emitEvent(_0x5da6b7){return function(_0x3358c,_0x3de5e7,_0x1eaf00){SquareProjectEvents['emit'](_0x5da6b7+':'+_0x3358c['id'],_0x3358c);SquareProjectEvents[_0x5a7d('0x4')](_0x5da6b7,_0x3358c);_0x1eaf00(null);};}for(var e in events){if(events[_0x5a7d('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x5a7d('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0348b71..47b61a0 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 _0xd92b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','changed','savedAt','publishedAt','format'];(function(_0xcd6db4,_0x1bfb50){var _0x3ef0ff=function(_0x11decb){while(--_0x11decb){_0xcd6db4['push'](_0xcd6db4['shift']());}};_0x3ef0ff(++_0x1bfb50);}(_0xd92b,0x1c2));var _0xbd92=function(_0x1f8492,_0x1b3f9b){_0x1f8492=_0x1f8492-0x0;var _0x43b7b3=_0xd92b[_0x1f8492];return _0x43b7b3;};'use strict';var _=require(_0xbd92('0x0'));var util=require(_0xbd92('0x1'));var logger=require(_0xbd92('0x2'))(_0xbd92('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbd92('0x4'));var fs=require('fs');var path=require(_0xbd92('0x5'));var rimraf=require(_0xbd92('0x6'));var config=require(_0xbd92('0x7'));var attributes=require(_0xbd92('0x8'));module[_0xbd92('0x9')]=function(_0x368d0f,_0x49b876){return _0x368d0f[_0xbd92('0xa')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x515b49,_0x482ddc,_0x46dc94){if(_0x515b49[_0xbd92('0xb')]('preproduction')){_0x515b49[_0xbd92('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x515b49[_0xbd92('0xb')]('production')){_0x515b49[_0xbd92('0xd')]=moment()[_0xbd92('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x46dc94(null,_0x515b49);}}});}; \ No newline at end of file +var _0xc33d=['changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareProject.attributes','exports','SquareProject','square_projects'];(function(_0x51b999,_0x56746d){var _0xcc4ad2=function(_0x3855e0){while(--_0x3855e0){_0x51b999['push'](_0x51b999['shift']());}};_0xcc4ad2(++_0x56746d);}(_0xc33d,0x15d));var _0xdc33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc33d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdc33('0x0'));var logger=require(_0xdc33('0x1'))(_0xdc33('0x2'));var moment=require(_0xdc33('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc33('0x4'));var fs=require('fs');var path=require(_0xdc33('0x5'));var rimraf=require(_0xdc33('0x6'));var config=require('../../config/environment');var attributes=require(_0xdc33('0x7'));module[_0xdc33('0x8')]=function(_0x4595cb,_0x3b4a1d){return _0x4595cb['define'](_0xdc33('0x9'),attributes,{'tableName':_0xdc33('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43e7b2,_0x34586e,_0x303b9a){if(_0x43e7b2[_0xdc33('0xb')](_0xdc33('0xc'))){_0x43e7b2[_0xdc33('0xd')]=moment()[_0xdc33('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x43e7b2['changed'](_0xdc33('0xf'))){_0x43e7b2[_0xdc33('0x10')]=moment()[_0xdc33('0xe')](_0xdc33('0x11'));}_0x303b9a(null,_0x43e7b2);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 791a85c..695f87a 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 _0x9dc6=['SquareProject','find','where','catch','message','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','findAll','options','attributes','include','map','model','then','info','debug','stringify','error','ShowSquareProject'];(function(_0x5ec60c,_0x110775){var _0x511af0=function(_0x25e9b0){while(--_0x25e9b0){_0x5ec60c['push'](_0x5ec60c['shift']());}};_0x511af0(++_0x110775);}(_0x9dc6,0x1c5));var _0x69dc=function(_0x3a27ca,_0x5f07c0){_0x3a27ca=_0x3a27ca-0x0;var _0x1faaf1=_0x9dc6[_0x3a27ca];return _0x1faaf1;};'use strict';var _=require(_0x69dc('0x0'));var Redis=require(_0x69dc('0x1'));var db=require(_0x69dc('0x2'))['db'];var logger=require(_0x69dc('0x3'))(_0x69dc('0x4'));var config=require(_0x69dc('0x5'));config[_0x69dc('0x6')]=_['defaults'](config[_0x69dc('0x6')],{'host':_0x69dc('0x7'),'port':0x18eb});var socket=require(_0x69dc('0x8'))(new Redis(config['redis']));require(_0x69dc('0x9'))['register'](socket);exports[_0x69dc('0xa')]=function(_0x3ba48c){var _0x1f8c56=this;return new Promise(function(_0x59d68a,_0x319742){return db['SquareProject'][_0x69dc('0xb')]({'raw':_0x3ba48c['options']?_0x3ba48c['options']['raw']===undefined?!![]:![]:!![],'where':_0x3ba48c[_0x69dc('0xc')]?_0x3ba48c[_0x69dc('0xc')]['where']||null:null,'attributes':_0x3ba48c[_0x69dc('0xc')]?_0x3ba48c['options'][_0x69dc('0xd')]||null:null,'limit':_0x3ba48c['options']?_0x3ba48c[_0x69dc('0xc')]['limit']||null:null,'include':_0x3ba48c['options']?_0x3ba48c['options'][_0x69dc('0xe')]?_[_0x69dc('0xf')](_0x3ba48c[_0x69dc('0xc')]['include'],function(_0x1495e6){return{'model':db[_0x1495e6[_0x69dc('0x10')]],'as':_0x1495e6['as'],'attributes':_0x1495e6[_0x69dc('0xd')],'include':_0x1495e6[_0x69dc('0xe')]?_[_0x69dc('0xf')](_0x1495e6[_0x69dc('0xe')],function(_0x35013d){return{'model':db[_0x35013d[_0x69dc('0x10')]],'as':_0x35013d['as'],'attributes':_0x35013d['attributes'],'include':_0x35013d['include']?_[_0x69dc('0xf')](_0x35013d[_0x69dc('0xe')],function(_0x24c65a){return{'model':db[_0x24c65a[_0x69dc('0x10')]],'as':_0x24c65a['as'],'attributes':_0x24c65a[_0x69dc('0xd')]};}):[]};}):[]};}):[]:[]})[_0x69dc('0x11')](function(_0x2e8693){logger[_0x69dc('0x12')](_0x69dc('0xa'),_0x3ba48c);logger[_0x69dc('0x13')](_0x69dc('0xa'),_0x3ba48c,JSON[_0x69dc('0x14')](_0x2e8693));_0x59d68a(_0x2e8693);})['catch'](function(_0x4db100){logger[_0x69dc('0x15')](_0x69dc('0xa'),_0x4db100['message'],_0x3ba48c);_0x319742(_0x1f8c56['error'](0x1f4,_0x4db100['message']));});});};exports[_0x69dc('0x16')]=function(_0x839345){var _0x464e94=this;return new Promise(function(_0x21d8c7,_0x49f344){return db[_0x69dc('0x17')][_0x69dc('0x18')]({'raw':_0x839345[_0x69dc('0xc')]?_0x839345[_0x69dc('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x839345[_0x69dc('0xc')]?_0x839345['options'][_0x69dc('0x19')]||null:null,'attributes':_0x839345['options']?_0x839345[_0x69dc('0xc')][_0x69dc('0xd')]||null:null,'include':_0x839345['options']?_0x839345[_0x69dc('0xc')][_0x69dc('0xe')]?_[_0x69dc('0xf')](_0x839345[_0x69dc('0xc')][_0x69dc('0xe')],function(_0x30c3ff){return{'model':db[_0x30c3ff[_0x69dc('0x10')]],'as':_0x30c3ff['as'],'attributes':_0x30c3ff[_0x69dc('0xd')],'include':_0x30c3ff[_0x69dc('0xe')]?_[_0x69dc('0xf')](_0x30c3ff[_0x69dc('0xe')],function(_0x163693){return{'model':db[_0x163693[_0x69dc('0x10')]],'as':_0x163693['as'],'attributes':_0x163693['attributes'],'include':_0x163693[_0x69dc('0xe')]?_[_0x69dc('0xf')](_0x163693[_0x69dc('0xe')],function(_0x125faa){return{'model':db[_0x125faa[_0x69dc('0x10')]],'as':_0x125faa['as'],'attributes':_0x125faa[_0x69dc('0xd')]};}):[]};}):[]};}):[]:[]})[_0x69dc('0x11')](function(_0x596a14){logger[_0x69dc('0x12')](_0x69dc('0x16'),_0x839345);logger[_0x69dc('0x13')](_0x69dc('0x16'),_0x839345,JSON[_0x69dc('0x14')](_0x596a14));_0x21d8c7(_0x596a14);})[_0x69dc('0x1a')](function(_0x4647b7){logger[_0x69dc('0x15')](_0x69dc('0x16'),_0x4647b7[_0x69dc('0x1b')],_0x839345);_0x49f344(_0x464e94[_0x69dc('0x15')](0x1f4,_0x4647b7[_0x69dc('0x1b')]));});});}; \ No newline at end of file +var _0xdf2b=['stringify','catch','error','message','ShowSquareProject','SquareProject','find','lodash','ioredis','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','options','where','attributes','include','map','model','then','GetSquareProjects','debug'];(function(_0x4133d0,_0xc13db4){var _0xc8222c=function(_0x309763){while(--_0x309763){_0x4133d0['push'](_0x4133d0['shift']());}};_0xc8222c(++_0xc13db4);}(_0xdf2b,0x165));var _0xbdf2=function(_0x13a7a2,_0x28589a){_0x13a7a2=_0x13a7a2-0x0;var _0x3e6e0a=_0xdf2b[_0x13a7a2];return _0x3e6e0a;};'use strict';var _=require(_0xbdf2('0x0'));var Redis=require(_0xbdf2('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xbdf2('0x2'))(_0xbdf2('0x3'));var config=require('../../config/environment');config[_0xbdf2('0x4')]=_[_0xbdf2('0x5')](config[_0xbdf2('0x4')],{'host':_0xbdf2('0x6'),'port':0x18eb});var socket=require(_0xbdf2('0x7'))(new Redis(config[_0xbdf2('0x4')]));require(_0xbdf2('0x8'))['register'](socket);exports['GetSquareProjects']=function(_0xe107c3){var _0x51092c=this;return new Promise(function(_0x4163c5,_0x178d47){return db['SquareProject']['findAll']({'raw':_0xe107c3[_0xbdf2('0x9')]?_0xe107c3[_0xbdf2('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0xe107c3[_0xbdf2('0x9')]?_0xe107c3[_0xbdf2('0x9')][_0xbdf2('0xa')]||null:null,'attributes':_0xe107c3[_0xbdf2('0x9')]?_0xe107c3[_0xbdf2('0x9')][_0xbdf2('0xb')]||null:null,'limit':_0xe107c3[_0xbdf2('0x9')]?_0xe107c3[_0xbdf2('0x9')]['limit']||null:null,'include':_0xe107c3['options']?_0xe107c3[_0xbdf2('0x9')][_0xbdf2('0xc')]?_[_0xbdf2('0xd')](_0xe107c3[_0xbdf2('0x9')]['include'],function(_0x96cc2f){return{'model':db[_0x96cc2f[_0xbdf2('0xe')]],'as':_0x96cc2f['as'],'attributes':_0x96cc2f['attributes'],'include':_0x96cc2f[_0xbdf2('0xc')]?_[_0xbdf2('0xd')](_0x96cc2f[_0xbdf2('0xc')],function(_0x36eed8){return{'model':db[_0x36eed8[_0xbdf2('0xe')]],'as':_0x36eed8['as'],'attributes':_0x36eed8[_0xbdf2('0xb')],'include':_0x36eed8[_0xbdf2('0xc')]?_[_0xbdf2('0xd')](_0x36eed8['include'],function(_0x2930a1){return{'model':db[_0x2930a1[_0xbdf2('0xe')]],'as':_0x2930a1['as'],'attributes':_0x2930a1[_0xbdf2('0xb')]};}):[]};}):[]};}):[]:[]})[_0xbdf2('0xf')](function(_0x115444){logger['info'](_0xbdf2('0x10'),_0xe107c3);logger[_0xbdf2('0x11')](_0xbdf2('0x10'),_0xe107c3,JSON[_0xbdf2('0x12')](_0x115444));_0x4163c5(_0x115444);})[_0xbdf2('0x13')](function(_0x83d52e){logger[_0xbdf2('0x14')](_0xbdf2('0x10'),_0x83d52e[_0xbdf2('0x15')],_0xe107c3);_0x178d47(_0x51092c[_0xbdf2('0x14')](0x1f4,_0x83d52e[_0xbdf2('0x15')]));});});};exports[_0xbdf2('0x16')]=function(_0x359575){var _0x112c58=this;return new Promise(function(_0x329c66,_0x5784c6){return db[_0xbdf2('0x17')][_0xbdf2('0x18')]({'raw':_0x359575[_0xbdf2('0x9')]?_0x359575[_0xbdf2('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x359575['options']?_0x359575[_0xbdf2('0x9')][_0xbdf2('0xa')]||null:null,'attributes':_0x359575[_0xbdf2('0x9')]?_0x359575[_0xbdf2('0x9')][_0xbdf2('0xb')]||null:null,'include':_0x359575['options']?_0x359575[_0xbdf2('0x9')][_0xbdf2('0xc')]?_['map'](_0x359575['options'][_0xbdf2('0xc')],function(_0x2aa545){return{'model':db[_0x2aa545[_0xbdf2('0xe')]],'as':_0x2aa545['as'],'attributes':_0x2aa545[_0xbdf2('0xb')],'include':_0x2aa545[_0xbdf2('0xc')]?_[_0xbdf2('0xd')](_0x2aa545[_0xbdf2('0xc')],function(_0x4b204d){return{'model':db[_0x4b204d[_0xbdf2('0xe')]],'as':_0x4b204d['as'],'attributes':_0x4b204d[_0xbdf2('0xb')],'include':_0x4b204d[_0xbdf2('0xc')]?_[_0xbdf2('0xd')](_0x4b204d['include'],function(_0x280793){return{'model':db[_0x280793[_0xbdf2('0xe')]],'as':_0x280793['as'],'attributes':_0x280793[_0xbdf2('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x366d10){logger['info'](_0xbdf2('0x16'),_0x359575);logger[_0xbdf2('0x11')](_0xbdf2('0x16'),_0x359575,JSON[_0xbdf2('0x12')](_0x366d10));_0x329c66(_0x366d10);})[_0xbdf2('0x13')](function(_0x32f728){logger[_0xbdf2('0x14')](_0xbdf2('0x16'),_0x32f728[_0xbdf2('0x15')],_0x359575);_0x5784c6(_0x112c58[_0xbdf2('0x14')](0x1f4,_0x32f728[_0xbdf2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 0e10f39..6892431 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 _0xdc01=['./squareProject.events','save','update','emit','removeListener','squareProject:'];(function(_0x4413d0,_0x113254){var _0x109c4b=function(_0x1f93a5){while(--_0x1f93a5){_0x4413d0['push'](_0x4413d0['shift']());}};_0x109c4b(++_0x113254);}(_0xdc01,0x66));var _0x1dc0=function(_0x11e0f0,_0x443a2b){_0x11e0f0=_0x11e0f0-0x0;var _0x568de9=_0xdc01[_0x11e0f0];return _0x568de9;};'use strict';var SquareProjectEvents=require(_0x1dc0('0x0'));var events=[_0x1dc0('0x1'),'remove',_0x1dc0('0x2')];function createListener(_0x5ef198,_0x2223d1){return function(_0x4b9c5f){_0x2223d1[_0x1dc0('0x3')](_0x5ef198,_0x4b9c5f);};}function removeListener(_0x8411b6,_0x5c3c80){return function(){SquareProjectEvents[_0x1dc0('0x4')](_0x8411b6,_0x5c3c80);};}exports['register']=function(_0x181e6e){for(var _0x1fc95d=0x0,_0x1b4c73=events['length'];_0x1fc95d<_0x1b4c73;_0x1fc95d++){var _0x1862fe=events[_0x1fc95d];var _0x5e66d8=createListener(_0x1dc0('0x5')+_0x1862fe,_0x181e6e);SquareProjectEvents['on'](_0x1862fe,_0x5e66d8);}}; \ No newline at end of file +var _0xd087=['./squareProject.events','remove','update','emit','removeListener','register','squareProject:'];(function(_0xfc331b,_0x3fcc18){var _0x5e26b1=function(_0x2bbe76){while(--_0x2bbe76){_0xfc331b['push'](_0xfc331b['shift']());}};_0x5e26b1(++_0x3fcc18);}(_0xd087,0x18f));var _0x7d08=function(_0x42fb0e,_0x55fc22){_0x42fb0e=_0x42fb0e-0x0;var _0x595566=_0xd087[_0x42fb0e];return _0x595566;};'use strict';var SquareProjectEvents=require(_0x7d08('0x0'));var events=['save',_0x7d08('0x1'),_0x7d08('0x2')];function createListener(_0x2d18d1,_0x4c0933){return function(_0x229238){_0x4c0933[_0x7d08('0x3')](_0x2d18d1,_0x229238);};}function removeListener(_0x3127e3,_0x5b2800){return function(){SquareProjectEvents[_0x7d08('0x4')](_0x3127e3,_0x5b2800);};}exports[_0x7d08('0x5')]=function(_0x11cecd){for(var _0x11f737=0x0,_0x318eb9=events['length'];_0x11f737<_0x318eb9;_0x11f737++){var _0x3ee5eb=events[_0x11f737];var _0x26de53=createListener(_0x7d08('0x6')+_0x3ee5eb,_0x11cecd);SquareProjectEvents['on'](_0x3ee5eb,_0x26de53);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b42b15d..768e005 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x4d9f8f,_0x61de47){var _0x1809df=function(_0x5eceb2){while(--_0x5eceb2){_0x4d9f8f['push'](_0x4d9f8f['shift']());}};_0x1809df(++_0x61de47);}(_0x1261,0x144));var _0x1126=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x1261[_0x4687df];return _0x32eaef;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x432bf7,_0x5d3424){var _0x197117=function(_0x306949){while(--_0x306949){_0x432bf7['push'](_0x432bf7['shift']());}};_0x197117(++_0x5d3424);}(_0x7a54,0x106));var _0x47a5=function(_0x31bd07,_0x42c4bb){_0x31bd07=_0x31bd07-0x0;var _0x34deac=_0x7a54[_0x31bd07];return _0x34deac;};'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('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('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 30ebca2..c128893 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 _0xf2ca=['getDataValue','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x5f31a8,_0x28246c){var _0x28a9ea=function(_0x179cb7){while(--_0x179cb7){_0x5f31a8['push'](_0x5f31a8['shift']());}};_0x28a9ea(++_0x28246c);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0xf2ca[_0x10791d];return _0x1b4f9c;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'uniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'extension':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'dnid':{'type':Sequelize[_0xaf2c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xaf2c('0x2')]},'filename':{'type':Sequelize[_0xaf2c('0x2')]},'savePath':{'type':Sequelize[_0xaf2c('0x2')]},'format':{'type':Sequelize[_0xaf2c('0x3')],'get':function(){var _0x58351f='';var _0x37fedd=this[_0xaf2c('0x4')]('savePath');if(_0x37fedd){_0x58351f=_0x37fedd[_0xaf2c('0x5')](_0x37fedd['lastIndexOf']('.'));}return _0x58351f;}}}; \ No newline at end of file +var _0x7217=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x2d7746,_0x393fb0){var _0x27779f=function(_0x1f22e4){while(--_0x1f22e4){_0x2d7746['push'](_0x2d7746['shift']());}};_0x27779f(++_0x393fb0);}(_0x7217,0x19e));var _0x7721=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7217[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'extension':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7721('0x1')]},'projectName':{'type':Sequelize[_0x7721('0x1')]},'saveName':{'type':Sequelize[_0x7721('0x1')]},'filename':{'type':Sequelize[_0x7721('0x1')]},'savePath':{'type':Sequelize[_0x7721('0x1')]},'format':{'type':Sequelize[_0x7721('0x2')],'get':function(){var _0x18ab6b='';var _0x21f680=this[_0x7721('0x3')](_0x7721('0x4'));if(_0x21f680){_0x18ab6b=_0x21f680[_0x7721('0x5')](_0x21f680[_0x7721('0x6')]('.'));}return _0x18ab6b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index d41822a..7197124 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 _0xe436=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','filename','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','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','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','destroy','end','sendStatus','error','stack','name','send','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order'];(function(_0xdc9add,_0x59f59f){var _0x3ab401=function(_0x5406cb){while(--_0x5406cb){_0xdc9add['push'](_0xdc9add['shift']());}};_0x3ab401(++_0x59f59f);}(_0xe436,0x89));var _0x6e43=function(_0xd406bd,_0x1f516e){_0xd406bd=_0xd406bd-0x0;var _0x57422b=_0xe436[_0xd406bd];return _0x57422b;};'use strict';var emlformat=require(_0x6e43('0x0'));var rimraf=require(_0x6e43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e43('0x2'));var rp=require(_0x6e43('0x3'));var moment=require(_0x6e43('0x4'));var BPromise=require(_0x6e43('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6e43('0x6'));var sox=require(_0x6e43('0x7'));var csv=require(_0x6e43('0x8'));var ejs=require(_0x6e43('0x9'));var fs=require('fs');var fs_extra=require(_0x6e43('0xa'));var _=require(_0x6e43('0xb'));var squel=require('squel');var crypto=require(_0x6e43('0xc'));var jsforce=require(_0x6e43('0xd'));var deskjs=require(_0x6e43('0xe'));var toCsv=require(_0x6e43('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6e43('0xf'));var authService=require(_0x6e43('0x10'));var qs=require(_0x6e43('0x11'));var as=require(_0x6e43('0x12'));var hardwareService=require(_0x6e43('0x13'));var logger=require(_0x6e43('0x14'))(_0x6e43('0x15'));var utils=require(_0x6e43('0x16'));var config=require(_0x6e43('0x17'));var licenseUtil=require(_0x6e43('0x18'));var db=require(_0x6e43('0x19'))['db'];function respondWithStatusCode(_0x417484,_0x226b4f){_0x226b4f=_0x226b4f||0xcc;return function(_0x5b6777){if(_0x5b6777){return _0x417484['sendStatus'](_0x226b4f);}return _0x417484[_0x6e43('0x1a')](_0x226b4f)['end']();};}function respondWithResult(_0x20451b,_0x17e046){_0x17e046=_0x17e046||0xc8;return function(_0x3a23bd){if(_0x3a23bd){return _0x20451b[_0x6e43('0x1a')](_0x17e046)['json'](_0x3a23bd);}};}function respondWithFilteredResult(_0x1b7e1d,_0x4b512a){return function(_0x37fb6a){if(_0x37fb6a){var _0x67d191=typeof _0x4b512a['offset']===_0x6e43('0x1b')&&typeof _0x4b512a[_0x6e43('0x1c')]===_0x6e43('0x1b');var _0x14d3b5=_0x37fb6a[_0x6e43('0x1d')];var _0x1da9d5=_0x67d191?0x0:_0x4b512a[_0x6e43('0x1e')];var _0x245cc4=_0x67d191?_0x37fb6a[_0x6e43('0x1d')]:_0x4b512a[_0x6e43('0x1e')]+_0x4b512a['limit'];var _0x1f6f05;if(_0x245cc4>=_0x14d3b5){_0x245cc4=_0x14d3b5;_0x1f6f05=0xc8;}else{_0x1f6f05=0xce;}_0x1b7e1d[_0x6e43('0x1a')](_0x1f6f05);return _0x1b7e1d[_0x6e43('0x1f')](_0x6e43('0x20'),_0x1da9d5+'-'+_0x245cc4+'/'+_0x14d3b5)[_0x6e43('0x21')](_0x37fb6a);}return null;};}function patchUpdates(_0xaf0fc4){return function(_0x35db81){try{jsonpatch[_0x6e43('0x22')](_0x35db81,_0xaf0fc4,!![]);}catch(_0x9341a){return BPromise['reject'](_0x9341a);}return _0x35db81['save']();};}function saveUpdates(_0x34aa24,_0x3ae1c4){return function(_0x3137aa){if(_0x3137aa){return _0x3137aa[_0x6e43('0x23')](_0x34aa24)[_0x6e43('0x24')](function(_0x1e6920){return _0x1e6920;});}return null;};}function removeEntity(_0x47c6eb,_0x21e374){return function(_0x502f14){if(_0x502f14){return _0x502f14[_0x6e43('0x25')]()[_0x6e43('0x24')](function(){_0x47c6eb['status'](0xcc)[_0x6e43('0x26')]();});}};}function handleEntityNotFound(_0x895dbd,_0x526fc5){return function(_0xd785b3){if(!_0xd785b3){_0x895dbd[_0x6e43('0x27')](0x194);}return _0xd785b3;};}function handleError(_0x14fc53,_0x5ac431){_0x5ac431=_0x5ac431||0x1f4;return function(_0x15e76e){logger[_0x6e43('0x28')](_0x15e76e[_0x6e43('0x29')]);if(_0x15e76e[_0x6e43('0x2a')]){delete _0x15e76e[_0x6e43('0x2a')];}_0x14fc53[_0x6e43('0x1a')](_0x5ac431)[_0x6e43('0x2b')](_0x15e76e);};}exports['index']=function(_0x227513,_0x503c40){var _0x2c73d4={},_0x3fd446={},_0x386ff1={'count':0x0,'rows':[]};var _0x31e005=_[_0x6e43('0x2c')](db[_0x6e43('0x2d')][_0x6e43('0x2e')],function(_0x470a5b){return{'name':_0x470a5b['fieldName'],'type':_0x470a5b[_0x6e43('0x2f')][_0x6e43('0x30')]};});_0x3fd446[_0x6e43('0x31')]=_['map'](_0x31e005,_0x6e43('0x2a'));_0x3fd446[_0x6e43('0x32')]=_[_0x6e43('0x33')](_0x227513[_0x6e43('0x32')]);_0x3fd446[_0x6e43('0x34')]=_[_0x6e43('0x35')](_0x3fd446[_0x6e43('0x31')],_0x3fd446[_0x6e43('0x32')]);_0x2c73d4['attributes']=_[_0x6e43('0x35')](_0x3fd446[_0x6e43('0x31')],qs['fields'](_0x227513[_0x6e43('0x32')][_0x6e43('0x36')]));_0x2c73d4[_0x6e43('0x37')]=_0x2c73d4['attributes'][_0x6e43('0x38')]?_0x2c73d4[_0x6e43('0x37')]:_0x3fd446[_0x6e43('0x31')];if(!_0x227513[_0x6e43('0x32')]['hasOwnProperty'](_0x6e43('0x39'))){_0x2c73d4[_0x6e43('0x1c')]=qs[_0x6e43('0x1c')](_0x227513[_0x6e43('0x32')][_0x6e43('0x1c')]);_0x2c73d4['offset']=qs[_0x6e43('0x1e')](_0x227513[_0x6e43('0x32')]['offset']);}_0x2c73d4[_0x6e43('0x3a')]=qs['sort'](_0x227513[_0x6e43('0x32')]['sort']);_0x2c73d4[_0x6e43('0x3b')]=qs[_0x6e43('0x34')](_[_0x6e43('0x3c')](_0x227513[_0x6e43('0x32')],_0x3fd446[_0x6e43('0x34')]),_0x31e005);if(_0x227513[_0x6e43('0x32')][_0x6e43('0x3d')]){_0x2c73d4['where']=_[_0x6e43('0x3e')](_0x2c73d4[_0x6e43('0x3b')],{'$or':_[_0x6e43('0x2c')](_0x31e005,function(_0x1cea43){if(_0x1cea43[_0x6e43('0x2f')]!==_0x6e43('0x3f')){var _0x3deebc={};_0x3deebc[_0x1cea43[_0x6e43('0x2a')]]={'$like':'%'+_0x227513[_0x6e43('0x32')][_0x6e43('0x3d')]+'%'};return _0x3deebc;}})});}_0x2c73d4=_[_0x6e43('0x3e')]({},_0x2c73d4,_0x227513[_0x6e43('0x40')]);var _0x3f1c9e={'where':_0x2c73d4[_0x6e43('0x3b')]};return db[_0x6e43('0x2d')]['count'](_0x3f1c9e)[_0x6e43('0x24')](function(_0x549ecf){_0x386ff1[_0x6e43('0x1d')]=_0x549ecf;if(_0x227513['query'][_0x6e43('0x41')]){_0x2c73d4[_0x6e43('0x42')]=[{'all':!![]}];}return db[_0x6e43('0x2d')][_0x6e43('0x43')](_0x2c73d4);})[_0x6e43('0x24')](function(_0x56cb91){_0x386ff1[_0x6e43('0x44')]=_0x56cb91;return _0x386ff1;})[_0x6e43('0x24')](respondWithFilteredResult(_0x503c40,_0x2c73d4))[_0x6e43('0x45')](handleError(_0x503c40,null));};exports['show']=function(_0x5cc5e2,_0x5ca9ad){var _0x2745ac={'raw':!![],'where':{'id':_0x5cc5e2[_0x6e43('0x46')]['id']}},_0x566798={};_0x566798['model']=_[_0x6e43('0x33')](db['SquareRecording'][_0x6e43('0x2e')]);_0x566798[_0x6e43('0x32')]=_[_0x6e43('0x33')](_0x5cc5e2[_0x6e43('0x32')]);_0x566798[_0x6e43('0x34')]=_['intersection'](_0x566798['model'],_0x566798[_0x6e43('0x32')]);_0x2745ac[_0x6e43('0x37')]=_[_0x6e43('0x35')](_0x566798[_0x6e43('0x31')],qs[_0x6e43('0x36')](_0x5cc5e2[_0x6e43('0x32')][_0x6e43('0x36')]));_0x2745ac[_0x6e43('0x37')]=_0x2745ac[_0x6e43('0x37')][_0x6e43('0x38')]?_0x2745ac[_0x6e43('0x37')]:_0x566798[_0x6e43('0x31')];if(_0x5cc5e2['query']['includeAll']){_0x2745ac[_0x6e43('0x42')]=[{'all':!![]}];}_0x2745ac=_['merge']({},_0x2745ac,_0x5cc5e2[_0x6e43('0x40')]);return db[_0x6e43('0x2d')][_0x6e43('0x47')](_0x2745ac)['then'](handleEntityNotFound(_0x5ca9ad,null))[_0x6e43('0x24')](respondWithResult(_0x5ca9ad,null))['catch'](handleError(_0x5ca9ad,null));};exports[_0x6e43('0x48')]=function(_0x3fe576,_0x4820e3){return db[_0x6e43('0x2d')][_0x6e43('0x48')](_0x3fe576[_0x6e43('0x49')],{})[_0x6e43('0x24')](respondWithResult(_0x4820e3,0xc9))[_0x6e43('0x45')](handleError(_0x4820e3,null));};exports[_0x6e43('0x23')]=function(_0x5557e1,_0x449329){if(_0x5557e1['body']['id']){delete _0x5557e1[_0x6e43('0x49')]['id'];}return db[_0x6e43('0x2d')][_0x6e43('0x47')]({'where':{'id':_0x5557e1[_0x6e43('0x46')]['id']}})[_0x6e43('0x24')](handleEntityNotFound(_0x449329,null))[_0x6e43('0x24')](saveUpdates(_0x5557e1[_0x6e43('0x49')],null))[_0x6e43('0x24')](respondWithResult(_0x449329,null))[_0x6e43('0x45')](handleError(_0x449329,null));};exports[_0x6e43('0x4a')]=function(_0x4c7a9f,_0x6cfbb4,_0x247449){var _0x25b6e9=require(_0x6e43('0x4b'));var _0x158e82=![];var _0x1a2e55={};if(_0x4c7a9f[_0x6e43('0x32')][_0x6e43('0x2f')]&&_0x4c7a9f[_0x6e43('0x32')][_0x6e43('0x2f')]===_0x6e43('0x4c')){_0x1a2e55[_0x6e43('0x4c')]=_0x4c7a9f['params']['id'];}else{_0x1a2e55['id']=_0x4c7a9f[_0x6e43('0x46')]['id'];}return db[_0x6e43('0x2d')][_0x6e43('0x47')]({'where':_0x1a2e55,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x6cfbb4,null))[_0x6e43('0x24')](function(_0x30ca4e){if(_0x30ca4e){var _0x24ee5d=_0x30ca4e[_0x6e43('0x4d')];var _0x533193=util[_0x6e43('0x4e')](_0x6e43('0x4f'),_0x24ee5d);if(fs[_0x6e43('0x50')](_0x533193)){_0x158e82=!![];return _0x25b6e9[_0x6e43('0x51')](_0x533193,_0x24ee5d,config[_0x6e43('0x52')][_0x6e43('0x53')])[_0x6e43('0x24')](function(){return _0x30ca4e;});}return _0x30ca4e;}})[_0x6e43('0x24')](function(_0x4185d6){if(_0x4185d6){var _0x492d01=_0x4185d6[_0x6e43('0x4d')];if(!fs[_0x6e43('0x50')](_0x492d01)){throw new db['Sequelize'][(_0x6e43('0x54'))](_0x6e43('0x55'));}if(_0x4185d6[_0x6e43('0x56')]){return _0x6cfbb4[_0x6e43('0x4a')](_0x492d01,_0x4185d6[_0x6e43('0x56')]+path['extname'](_0x492d01),function(){if(_0x158e82){fs[_0x6e43('0x57')](_0x492d01);}});}else{return _0x6cfbb4[_0x6e43('0x4a')](_0x492d01,function(_0x77abde){if(_0x158e82){fs[_0x6e43('0x57')](_0x492d01);}});}}})[_0x6e43('0x45')](function(_0x4bfe40){if(_0x4bfe40[_0x6e43('0x58')]===_0x6e43('0x55')){_0x6cfbb4[_0x6e43('0x1a')](0x194)[_0x6e43('0x2b')](_0x6e43('0x59'));}else{return handleError(_0x6cfbb4,null);}});};exports[_0x6e43('0x25')]=function(_0x2052d9,_0x3ba006){return db[_0x6e43('0x2d')][_0x6e43('0x47')]({'where':{'id':_0x2052d9['params']['id']}})[_0x6e43('0x24')](function(_0x3f94a5){if(_['isNil'](_0x3f94a5)){throw new ReferenceError(_0x6e43('0x5a'));}return _0x3f94a5;})[_0x6e43('0x24')](function(_0x3d13bf){var _0x38a253=_0x3d13bf[_0x6e43('0x4d')];logger[_0x6e43('0x5b')](_0x6e43('0x5c'),_0x38a253);if(!_[_0x6e43('0x5d')](_0x3d13bf['savePath'])&&fs['existsSync'](_0x38a253)){logger[_0x6e43('0x5b')](_0x6e43('0x5e')+_0x38a253+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6e43('0x5f')](_0x38a253);}_0x38a253=_0x38a253+_0x6e43('0x60');if(!_['isNil'](_0x3d13bf[_0x6e43('0x4d')])&&fs[_0x6e43('0x50')](_0x38a253)){logger[_0x6e43('0x5b')](_0x6e43('0x5e')+_0x38a253+_0x6e43('0x61'));fs[_0x6e43('0x5f')](_0x38a253);}return _0x3d13bf;})[_0x6e43('0x24')](function(_0x3e51){if(!_0x3e51)throw new InternalError();return _0x3e51[_0x6e43('0x25')]();})[_0x6e43('0x24')](function(){_0x3ba006[_0x6e43('0x1a')](0xcc)[_0x6e43('0x26')]();})['catch'](handleError(_0x3ba006,null));}; \ No newline at end of file +var _0x1bab=['secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','unlink','send','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','name','index','map','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','SquareRecording','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1bab,0x1eb));var _0xb1ba=function(_0x1b989f,_0x1cab2f){_0x1b989f=_0x1b989f-0x0;var _0x3d14cc=_0x1bab[_0x1b989f];return _0x3d14cc;};'use strict';var emlformat=require(_0xb1ba('0x0'));var rimraf=require(_0xb1ba('0x1'));var zipdir=require(_0xb1ba('0x2'));var jsonpatch=require(_0xb1ba('0x3'));var rp=require(_0xb1ba('0x4'));var moment=require(_0xb1ba('0x5'));var BPromise=require(_0xb1ba('0x6'));var Mustache=require('mustache');var util=require(_0xb1ba('0x7'));var path=require(_0xb1ba('0x8'));var sox=require(_0xb1ba('0x9'));var csv=require(_0xb1ba('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb1ba('0xb'));var squel=require(_0xb1ba('0xc'));var crypto=require('crypto');var jsforce=require(_0xb1ba('0xd'));var deskjs=require(_0xb1ba('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb1ba('0xf'));var Redis=require(_0xb1ba('0x10'));var authService=require(_0xb1ba('0x11'));var qs=require(_0xb1ba('0x12'));var as=require(_0xb1ba('0x13'));var hardwareService=require(_0xb1ba('0x14'));var logger=require(_0xb1ba('0x15'))(_0xb1ba('0x16'));var utils=require(_0xb1ba('0x17'));var config=require(_0xb1ba('0x18'));var licenseUtil=require(_0xb1ba('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e0689,_0x3dc9d4){_0x3dc9d4=_0x3dc9d4||0xcc;return function(_0x1cae48){if(_0x1cae48){return _0x1e0689[_0xb1ba('0x1a')](_0x3dc9d4);}return _0x1e0689[_0xb1ba('0x1b')](_0x3dc9d4)[_0xb1ba('0x1c')]();};}function respondWithResult(_0x49e214,_0x147903){_0x147903=_0x147903||0xc8;return function(_0x1ae052){if(_0x1ae052){return _0x49e214['status'](_0x147903)[_0xb1ba('0x1d')](_0x1ae052);}};}function respondWithFilteredResult(_0xeeebf7,_0x2fe0a4){return function(_0x38a1f5){if(_0x38a1f5){var _0x5d82b9=typeof _0x2fe0a4[_0xb1ba('0x1e')]===_0xb1ba('0x1f')&&typeof _0x2fe0a4[_0xb1ba('0x20')]===_0xb1ba('0x1f');var _0x5d7a09=_0x38a1f5['count'];var _0x278466=_0x5d82b9?0x0:_0x2fe0a4[_0xb1ba('0x1e')];var _0x43d238=_0x5d82b9?_0x38a1f5[_0xb1ba('0x21')]:_0x2fe0a4[_0xb1ba('0x1e')]+_0x2fe0a4['limit'];var _0x2e8999;if(_0x43d238>=_0x5d7a09){_0x43d238=_0x5d7a09;_0x2e8999=0xc8;}else{_0x2e8999=0xce;}_0xeeebf7['status'](_0x2e8999);return _0xeeebf7[_0xb1ba('0x22')]('Content-Range',_0x278466+'-'+_0x43d238+'/'+_0x5d7a09)['json'](_0x38a1f5);}return null;};}function patchUpdates(_0x3e45b5){return function(_0x5014b3){try{jsonpatch['apply'](_0x5014b3,_0x3e45b5,!![]);}catch(_0x1faed3){return BPromise['reject'](_0x1faed3);}return _0x5014b3['save']();};}function saveUpdates(_0x10f697,_0x31f05c){return function(_0x325987){if(_0x325987){return _0x325987[_0xb1ba('0x23')](_0x10f697)[_0xb1ba('0x24')](function(_0x4f67fc){return _0x4f67fc;});}return null;};}function removeEntity(_0x48bb08,_0x35ef3e){return function(_0xed191e){if(_0xed191e){return _0xed191e[_0xb1ba('0x25')]()[_0xb1ba('0x24')](function(){_0x48bb08[_0xb1ba('0x1b')](0xcc)[_0xb1ba('0x1c')]();});}};}function handleEntityNotFound(_0x573b6f,_0x379038){return function(_0x4ba849){if(!_0x4ba849){_0x573b6f[_0xb1ba('0x1a')](0x194);}return _0x4ba849;};}function handleError(_0x2b23fc,_0x350081){_0x350081=_0x350081||0x1f4;return function(_0x3868a9){logger[_0xb1ba('0x26')](_0x3868a9['stack']);if(_0x3868a9[_0xb1ba('0x27')]){delete _0x3868a9['name'];}_0x2b23fc[_0xb1ba('0x1b')](_0x350081)['send'](_0x3868a9);};}exports[_0xb1ba('0x28')]=function(_0x1457af,_0x5d11b7){var _0x24566b={},_0xb7e344={},_0x2fa951={'count':0x0,'rows':[]};var _0x1c6c77=_[_0xb1ba('0x29')](db['SquareRecording']['rawAttributes'],function(_0x264c37){return{'name':_0x264c37[_0xb1ba('0x2a')],'type':_0x264c37['type']['key']};});_0xb7e344[_0xb1ba('0x2b')]=_[_0xb1ba('0x29')](_0x1c6c77,_0xb1ba('0x27'));_0xb7e344[_0xb1ba('0x2c')]=_[_0xb1ba('0x2d')](_0x1457af[_0xb1ba('0x2c')]);_0xb7e344['filters']=_['intersection'](_0xb7e344[_0xb1ba('0x2b')],_0xb7e344[_0xb1ba('0x2c')]);_0x24566b['attributes']=_[_0xb1ba('0x2e')](_0xb7e344['model'],qs[_0xb1ba('0x2f')](_0x1457af['query'][_0xb1ba('0x2f')]));_0x24566b[_0xb1ba('0x30')]=_0x24566b['attributes'][_0xb1ba('0x31')]?_0x24566b[_0xb1ba('0x30')]:_0xb7e344[_0xb1ba('0x2b')];if(!_0x1457af['query'][_0xb1ba('0x32')](_0xb1ba('0x33'))){_0x24566b[_0xb1ba('0x20')]=qs['limit'](_0x1457af[_0xb1ba('0x2c')][_0xb1ba('0x20')]);_0x24566b['offset']=qs[_0xb1ba('0x1e')](_0x1457af[_0xb1ba('0x2c')][_0xb1ba('0x1e')]);}_0x24566b['order']=qs[_0xb1ba('0x34')](_0x1457af['query'][_0xb1ba('0x34')]);_0x24566b[_0xb1ba('0x35')]=qs['filters'](_[_0xb1ba('0x36')](_0x1457af[_0xb1ba('0x2c')],_0xb7e344[_0xb1ba('0x37')]),_0x1c6c77);if(_0x1457af['query'][_0xb1ba('0x38')]){_0x24566b[_0xb1ba('0x35')]=_[_0xb1ba('0x39')](_0x24566b[_0xb1ba('0x35')],{'$or':_[_0xb1ba('0x29')](_0x1c6c77,function(_0x11440c){if(_0x11440c[_0xb1ba('0x3a')]!==_0xb1ba('0x3b')){var _0x5e07ff={};_0x5e07ff[_0x11440c[_0xb1ba('0x27')]]={'$like':'%'+_0x1457af[_0xb1ba('0x2c')][_0xb1ba('0x38')]+'%'};return _0x5e07ff;}})});}_0x24566b=_[_0xb1ba('0x39')]({},_0x24566b,_0x1457af[_0xb1ba('0x3c')]);var _0x5bd3eb={'where':_0x24566b[_0xb1ba('0x35')]};return db[_0xb1ba('0x3d')][_0xb1ba('0x21')](_0x5bd3eb)['then'](function(_0x734849){_0x2fa951[_0xb1ba('0x21')]=_0x734849;if(_0x1457af[_0xb1ba('0x2c')]['includeAll']){_0x24566b[_0xb1ba('0x3e')]=[{'all':!![]}];}return db[_0xb1ba('0x3d')]['findAll'](_0x24566b);})['then'](function(_0x21610c){_0x2fa951[_0xb1ba('0x3f')]=_0x21610c;return _0x2fa951;})[_0xb1ba('0x24')](respondWithFilteredResult(_0x5d11b7,_0x24566b))[_0xb1ba('0x40')](handleError(_0x5d11b7,null));};exports[_0xb1ba('0x41')]=function(_0x1252ce,_0x1462c2){var _0x3623dc={'raw':!![],'where':{'id':_0x1252ce[_0xb1ba('0x42')]['id']}},_0x536279={};_0x536279['model']=_[_0xb1ba('0x2d')](db['SquareRecording'][_0xb1ba('0x43')]);_0x536279[_0xb1ba('0x2c')]=_[_0xb1ba('0x2d')](_0x1252ce['query']);_0x536279[_0xb1ba('0x37')]=_[_0xb1ba('0x2e')](_0x536279[_0xb1ba('0x2b')],_0x536279['query']);_0x3623dc['attributes']=_[_0xb1ba('0x2e')](_0x536279[_0xb1ba('0x2b')],qs['fields'](_0x1252ce[_0xb1ba('0x2c')][_0xb1ba('0x2f')]));_0x3623dc['attributes']=_0x3623dc['attributes']['length']?_0x3623dc[_0xb1ba('0x30')]:_0x536279[_0xb1ba('0x2b')];if(_0x1252ce['query'][_0xb1ba('0x44')]){_0x3623dc[_0xb1ba('0x3e')]=[{'all':!![]}];}_0x3623dc=_[_0xb1ba('0x39')]({},_0x3623dc,_0x1252ce[_0xb1ba('0x3c')]);return db[_0xb1ba('0x3d')][_0xb1ba('0x45')](_0x3623dc)[_0xb1ba('0x24')](handleEntityNotFound(_0x1462c2,null))[_0xb1ba('0x24')](respondWithResult(_0x1462c2,null))[_0xb1ba('0x40')](handleError(_0x1462c2,null));};exports[_0xb1ba('0x46')]=function(_0x5ee856,_0x19d433){return db['SquareRecording']['create'](_0x5ee856[_0xb1ba('0x47')],{})[_0xb1ba('0x24')](respondWithResult(_0x19d433,0xc9))['catch'](handleError(_0x19d433,null));};exports[_0xb1ba('0x23')]=function(_0x460264,_0x106ea1){if(_0x460264['body']['id']){delete _0x460264['body']['id'];}return db[_0xb1ba('0x3d')]['find']({'where':{'id':_0x460264[_0xb1ba('0x42')]['id']}})[_0xb1ba('0x24')](handleEntityNotFound(_0x106ea1,null))['then'](saveUpdates(_0x460264[_0xb1ba('0x47')],null))[_0xb1ba('0x24')](respondWithResult(_0x106ea1,null))['catch'](handleError(_0x106ea1,null));};exports['download']=function(_0x453b41,_0x5161f0,_0x55bf57){var _0x3e5bf4=require(_0xb1ba('0x48'));var _0x1bb4ab=![];var _0x294f3b={};if(_0x453b41[_0xb1ba('0x2c')][_0xb1ba('0x3a')]&&_0x453b41['query'][_0xb1ba('0x3a')]===_0xb1ba('0x49')){_0x294f3b[_0xb1ba('0x49')]=_0x453b41['params']['id'];}else{_0x294f3b['id']=_0x453b41[_0xb1ba('0x42')]['id'];}return db[_0xb1ba('0x3d')][_0xb1ba('0x45')]({'where':_0x294f3b,'attributes':['id',_0xb1ba('0x4a'),_0xb1ba('0x4b')],'raw':!![]})[_0xb1ba('0x24')](handleEntityNotFound(_0x5161f0,null))[_0xb1ba('0x24')](function(_0x1361ba){if(_0x1361ba){var _0x1ed26=_0x1361ba['savePath'];var _0x355a5c=util['format'](_0xb1ba('0x4c'),_0x1ed26);if(fs[_0xb1ba('0x4d')](_0x355a5c)){_0x1bb4ab=!![];return _0x3e5bf4[_0xb1ba('0x4e')](_0x355a5c,_0x1ed26,config[_0xb1ba('0x4f')][_0xb1ba('0x50')])[_0xb1ba('0x24')](function(){return _0x1361ba;});}return _0x1361ba;}})[_0xb1ba('0x24')](function(_0x248682){if(_0x248682){var _0x1f2fb8=_0x248682[_0xb1ba('0x4a')];if(!fs['existsSync'](_0x1f2fb8)){throw new db[(_0xb1ba('0x51'))][(_0xb1ba('0x52'))](_0xb1ba('0x53'));}if(_0x248682[_0xb1ba('0x4b')]){return _0x5161f0[_0xb1ba('0x54')](_0x1f2fb8,_0x248682[_0xb1ba('0x4b')]+path['extname'](_0x1f2fb8),function(){if(_0x1bb4ab){fs[_0xb1ba('0x55')](_0x1f2fb8);}});}else{return _0x5161f0[_0xb1ba('0x54')](_0x1f2fb8,function(_0x1bc074){if(_0x1bb4ab){fs[_0xb1ba('0x55')](_0x1f2fb8);}});}}})[_0xb1ba('0x40')](function(_0x547386){if(_0x547386['message']==='SquareRecording\x20not\x20found'){_0x5161f0[_0xb1ba('0x1b')](0x194)[_0xb1ba('0x56')](_0xb1ba('0x57'));}else{return handleError(_0x5161f0,null);}});};exports[_0xb1ba('0x25')]=function(_0x19ed33,_0x2cedc8){return db[_0xb1ba('0x3d')][_0xb1ba('0x45')]({'where':{'id':_0x19ed33[_0xb1ba('0x42')]['id']}})[_0xb1ba('0x24')](function(_0x3012f4){if(_[_0xb1ba('0x58')](_0x3012f4)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3012f4;})[_0xb1ba('0x24')](function(_0x98350d){var _0x286bb6=_0x98350d[_0xb1ba('0x4a')];logger[_0xb1ba('0x59')](_0xb1ba('0x5a'),_0x286bb6);if(!_[_0xb1ba('0x58')](_0x98350d[_0xb1ba('0x4a')])&&fs[_0xb1ba('0x4d')](_0x286bb6)){logger[_0xb1ba('0x59')](_0xb1ba('0x5b')+_0x286bb6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb1ba('0x5c')](_0x286bb6);}_0x286bb6=_0x286bb6+_0xb1ba('0x5d');if(!_['isNil'](_0x98350d[_0xb1ba('0x4a')])&&fs[_0xb1ba('0x4d')](_0x286bb6)){logger['info']('File:\x20\x22'+_0x286bb6+_0xb1ba('0x5e'));fs['unlinkSync'](_0x286bb6);}return _0x98350d;})[_0xb1ba('0x24')](function(_0x9f6658){if(!_0x9f6658)throw new InternalError();return _0x9f6658[_0xb1ba('0x25')]();})['then'](function(){_0x2cedc8['status'](0xcc)['end']();})[_0xb1ba('0x40')](handleError(_0x2cedc8,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 11f49a5..8f5d54d 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 _0x21cd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','SquareRecording','lodash','util'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x21cd,0x6a));var _0xd21c=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x21cd[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xd21c('0x0'));var util=require(_0xd21c('0x1'));var logger=require(_0xd21c('0x2'))(_0xd21c('0x3'));var moment=require(_0xd21c('0x4'));var BPromise=require(_0xd21c('0x5'));var rp=require(_0xd21c('0x6'));var fs=require('fs');var path=require(_0xd21c('0x7'));var rimraf=require(_0xd21c('0x8'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xd21c('0x9')]=function(_0x1ff4bd,_0x1ce1e6){return _0x1ff4bd[_0xd21c('0xa')](_0xd21c('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b11=['api','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger'];(function(_0x3f5d34,_0x20d463){var _0x27e78a=function(_0x41f239){while(--_0x41f239){_0x3f5d34['push'](_0x3f5d34['shift']());}};_0x27e78a(++_0x20d463);}(_0x4b11,0xf4));var _0x14b1=function(_0x42b309,_0x3e8168){_0x42b309=_0x42b309-0x0;var _0x252ff5=_0x4b11[_0x42b309];return _0x252ff5;};'use strict';var _=require(_0x14b1('0x0'));var util=require(_0x14b1('0x1'));var logger=require(_0x14b1('0x2'))(_0x14b1('0x3'));var moment=require('moment');var BPromise=require(_0x14b1('0x4'));var rp=require(_0x14b1('0x5'));var fs=require('fs');var path=require(_0x14b1('0x6'));var rimraf=require('rimraf');var config=require(_0x14b1('0x7'));var attributes=require(_0x14b1('0x8'));module[_0x14b1('0x9')]=function(_0x1fb89f,_0x322430){return _0x1fb89f[_0x14b1('0xa')](_0x14b1('0xb'),attributes,{'tableName':_0x14b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index c30a96b..9a96e85 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 _0xe205=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','options','raw','debug','catch','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe205,0x1ec));var _0x5e20=function(_0x1ed388,_0x4c1474){_0x1ed388=_0x1ed388-0x0;var _0x356c7f=_0xe205[_0x1ed388];return _0x356c7f;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e20('0x7'))(_0x5e20('0x8'));var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2542dc,_0x4b61c4,_0x5e8575){return new BPromise(function(_0x858b34,_0x2ec575){return client['request'](_0x2542dc,_0x5e8575)[_0x5e20('0xd')](function(_0xe65b65){logger[_0x5e20('0xe')](_0x5e20('0xf'),_0x4b61c4,_0x5e20('0x10'));logger['debug'](_0x5e20('0x11'),_0x4b61c4,'request\x20sent',JSON[_0x5e20('0x12')](_0xe65b65));if(_0xe65b65[_0x5e20('0x13')]){if(_0xe65b65['error'][_0x5e20('0x14')]===0x1f4){logger['error'](_0x5e20('0xf'),_0x4b61c4,_0xe65b65['error'][_0x5e20('0x15')]);return _0x2ec575(_0xe65b65[_0x5e20('0x13')][_0x5e20('0x15')]);}logger[_0x5e20('0x13')]('SquareRecording,\x20%s,\x20%s',_0x4b61c4,_0xe65b65[_0x5e20('0x13')]['message']);return _0x858b34(_0xe65b65[_0x5e20('0x13')][_0x5e20('0x15')]);}else{logger[_0x5e20('0xe')](_0x5e20('0xf'),_0x4b61c4,_0x5e20('0x10'));_0x858b34(_0xe65b65[_0x5e20('0x16')][_0x5e20('0x15')]);}})['catch'](function(_0x1d7adf){logger['error']('SquareRecording,\x20%s,\x20%s',_0x4b61c4,_0x1d7adf);_0x2ec575(_0x1d7adf);});});}exports[_0x5e20('0x17')]=function(_0x5b76bb){var _0x5c02b0=this;return new Promise(function(_0x5e7135,_0x8728d8){return db[_0x5e20('0x18')]['create'](_0x5b76bb['body'],{'raw':_0x5b76bb['options']?_0x5b76bb[_0x5e20('0x19')][_0x5e20('0x1a')]===undefined?!![]:![]:!![]})[_0x5e20('0xd')](function(_0x5a61df){logger['info'](_0x5e20('0x17'),_0x5b76bb);logger[_0x5e20('0x1b')](_0x5e20('0x17'),_0x5b76bb,JSON[_0x5e20('0x12')](_0x5a61df));_0x5e7135(_0x5a61df);})[_0x5e20('0x1c')](function(_0x1f1e6a){logger[_0x5e20('0x13')](_0x5e20('0x17'),_0x1f1e6a[_0x5e20('0x15')],_0x5b76bb);_0x8728d8(_0x5c02b0[_0x5e20('0x13')](0x1f4,_0x1f1e6a[_0x5e20('0x15')]));});});}; \ No newline at end of file +var _0x35f4=['request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareRecording','body','options','raw','then','CreateSquareRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x35f4,0x101));var _0x435f=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0x35f4[_0x685346];return _0x52e15b;};'use strict';var _=require(_0x435f('0x0'));var util=require(_0x435f('0x1'));var moment=require(_0x435f('0x2'));var BPromise=require(_0x435f('0x3'));var rs=require(_0x435f('0x4'));var fs=require('fs');var Redis=require(_0x435f('0x5'));var db=require(_0x435f('0x6'))['db'];var utils=require(_0x435f('0x7'));var logger=require(_0x435f('0x8'))(_0x435f('0x9'));var config=require(_0x435f('0xa'));var jayson=require(_0x435f('0xb'));var client=jayson[_0x435f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7d9b39,_0x519805,_0x412744){return new BPromise(function(_0x584cab,_0x5ab760){return client[_0x435f('0xd')](_0x7d9b39,_0x412744)['then'](function(_0xe772d){logger[_0x435f('0xe')](_0x435f('0xf'),_0x519805,_0x435f('0x10'));logger[_0x435f('0x11')](_0x435f('0x12'),_0x519805,_0x435f('0x10'),JSON[_0x435f('0x13')](_0xe772d));if(_0xe772d[_0x435f('0x14')]){if(_0xe772d[_0x435f('0x14')][_0x435f('0x15')]===0x1f4){logger['error'](_0x435f('0xf'),_0x519805,_0xe772d['error'][_0x435f('0x16')]);return _0x5ab760(_0xe772d[_0x435f('0x14')][_0x435f('0x16')]);}logger['error'](_0x435f('0xf'),_0x519805,_0xe772d[_0x435f('0x14')][_0x435f('0x16')]);return _0x584cab(_0xe772d[_0x435f('0x14')][_0x435f('0x16')]);}else{logger[_0x435f('0xe')](_0x435f('0xf'),_0x519805,_0x435f('0x10'));_0x584cab(_0xe772d['result'][_0x435f('0x16')]);}})[_0x435f('0x17')](function(_0x278313){logger[_0x435f('0x14')](_0x435f('0xf'),_0x519805,_0x278313);_0x5ab760(_0x278313);});});}exports['CreateSquareRecording']=function(_0x2c4866){var _0x278cb3=this;return new Promise(function(_0x3d0580,_0x17d912){return db[_0x435f('0x18')]['create'](_0x2c4866[_0x435f('0x19')],{'raw':_0x2c4866[_0x435f('0x1a')]?_0x2c4866[_0x435f('0x1a')][_0x435f('0x1b')]===undefined?!![]:![]:!![]})[_0x435f('0x1c')](function(_0x4f3508){logger['info']('CreateSquareRecording',_0x2c4866);logger[_0x435f('0x11')](_0x435f('0x1d'),_0x2c4866,JSON[_0x435f('0x13')](_0x4f3508));_0x3d0580(_0x4f3508);})[_0x435f('0x17')](function(_0x42e07d){logger[_0x435f('0x14')](_0x435f('0x1d'),_0x42e07d[_0x435f('0x16')],_0x2c4866);_0x17d912(_0x278cb3[_0x435f('0x14')](0x1f4,_0x42e07d[_0x435f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 924989e..e8389df 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_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('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x2ac8f0,_0x21d3df){var _0x4e9e93=function(_0x292289){while(--_0x292289){_0x2ac8f0['push'](_0x2ac8f0['shift']());}};_0x4e9e93(++_0x21d3df);}(_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('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 499e209..a887d7d 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 _0x2c92=['DATE','sequelize','exports','STRING'];(function(_0x4a12c7,_0x26e667){var _0x48dac7=function(_0x2d5eed){while(--_0x2d5eed){_0x4a12c7['push'](_0x4a12c7['shift']());}};_0x48dac7(++_0x26e667);}(_0x2c92,0xd9));var _0x22c9=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x2c92[_0x5cc8];return _0x450661;};'use strict';var Sequelize=require(_0x22c9('0x0'));module[_0x22c9('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x22c9('0x2')]},'channel':{'type':Sequelize[_0x22c9('0x2')]},'language':{'type':Sequelize[_0x22c9('0x2')]},'type':{'type':Sequelize[_0x22c9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x22c9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x22c9('0x2')]},'callington':{'type':Sequelize[_0x22c9('0x2')]},'callingtns':{'type':Sequelize[_0x22c9('0x2')]},'dnid':{'type':Sequelize[_0x22c9('0x2')]},'rdnis':{'type':Sequelize[_0x22c9('0x2')]},'context':{'type':Sequelize[_0x22c9('0x2')]},'extension':{'type':Sequelize[_0x22c9('0x2')]},'priority':{'type':Sequelize[_0x22c9('0x2')]},'enhanced':{'type':Sequelize[_0x22c9('0x2')]},'accountcode':{'type':Sequelize[_0x22c9('0x2')]},'threadid':{'type':Sequelize[_0x22c9('0x2')]},'project_name':{'type':Sequelize[_0x22c9('0x2')]},'joinAt':{'type':Sequelize[_0x22c9('0x3')]},'leaveAt':{'type':Sequelize[_0x22c9('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc7df=['exports','STRING','DATE','BOOLEAN'];(function(_0x990e2d,_0x1b9fda){var _0xd09751=function(_0x265dae){while(--_0x265dae){_0x990e2d['push'](_0x990e2d['shift']());}};_0xd09751(++_0x1b9fda);}(_0xc7df,0xd0));var _0xfc7d=function(_0x1b7209,_0x101b72){_0x1b7209=_0x1b7209-0x0;var _0x1002a8=_0xc7df[_0x1b7209];return _0x1002a8;};'use strict';var Sequelize=require('sequelize');module[_0xfc7d('0x0')]={'network':{'type':Sequelize[_0xfc7d('0x1')]},'network_script':{'type':Sequelize[_0xfc7d('0x1')]},'request':{'type':Sequelize[_0xfc7d('0x1')]},'channel':{'type':Sequelize[_0xfc7d('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfc7d('0x1')]},'uniqueid':{'type':Sequelize[_0xfc7d('0x1')]},'version':{'type':Sequelize[_0xfc7d('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfc7d('0x1')]},'callingpres':{'type':Sequelize[_0xfc7d('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xfc7d('0x1')]},'callingtns':{'type':Sequelize[_0xfc7d('0x1')]},'dnid':{'type':Sequelize[_0xfc7d('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfc7d('0x1')]},'extension':{'type':Sequelize[_0xfc7d('0x1')]},'priority':{'type':Sequelize[_0xfc7d('0x1')]},'enhanced':{'type':Sequelize[_0xfc7d('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xfc7d('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfc7d('0x2')]},'leaveAt':{'type':Sequelize[_0xfc7d('0x2')]},'bot':{'type':Sequelize[_0xfc7d('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 279e13e..5e29fb7 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 _0xd265=['error','stack','name','index','map','rawAttributes','fieldName','key','query','intersection','attributes','fields','length','model','order','sort','where','filters','pick','filter','merge','SquareReport','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy'];(function(_0x24b5d8,_0x203128){var _0x54908d=function(_0x3b0db0){while(--_0x3b0db0){_0x24b5d8['push'](_0x24b5d8['shift']());}};_0x54908d(++_0x203128);}(_0xd265,0x194));var _0x5d26=function(_0x3b690e,_0x2aa32b){_0x3b690e=_0x3b690e-0x0;var _0x5e0bfe=_0xd265[_0x3b690e];return _0x5e0bfe;};'use strict';var emlformat=require(_0x5d26('0x0'));var rimraf=require(_0x5d26('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d26('0x2'));var rp=require(_0x5d26('0x3'));var moment=require(_0x5d26('0x4'));var BPromise=require(_0x5d26('0x5'));var Mustache=require('mustache');var util=require(_0x5d26('0x6'));var path=require(_0x5d26('0x7'));var sox=require(_0x5d26('0x8'));var csv=require(_0x5d26('0x9'));var ejs=require(_0x5d26('0xa'));var fs=require('fs');var fs_extra=require(_0x5d26('0xb'));var _=require('lodash');var squel=require(_0x5d26('0xc'));var crypto=require(_0x5d26('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5d26('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5d26('0xf'));var Papa=require(_0x5d26('0x10'));var Redis=require('ioredis');var authService=require(_0x5d26('0x11'));var qs=require(_0x5d26('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d26('0x13'));var logger=require(_0x5d26('0x14'))(_0x5d26('0x15'));var utils=require('../../config/utils');var config=require(_0x5d26('0x16'));var licenseUtil=require(_0x5d26('0x17'));var db=require(_0x5d26('0x18'))['db'];function respondWithStatusCode(_0x56ec24,_0x18fab6){_0x18fab6=_0x18fab6||0xcc;return function(_0x16bf36){if(_0x16bf36){return _0x56ec24[_0x5d26('0x19')](_0x18fab6);}return _0x56ec24[_0x5d26('0x1a')](_0x18fab6)[_0x5d26('0x1b')]();};}function respondWithResult(_0x426ca7,_0x49f81a){_0x49f81a=_0x49f81a||0xc8;return function(_0x2f0584){if(_0x2f0584){return _0x426ca7[_0x5d26('0x1a')](_0x49f81a)['json'](_0x2f0584);}};}function respondWithFilteredResult(_0x3f124c,_0xbb04d9){return function(_0x2fdc64){if(_0x2fdc64){var _0x57aba7=typeof _0xbb04d9[_0x5d26('0x1c')]===_0x5d26('0x1d')&&typeof _0xbb04d9[_0x5d26('0x1e')]===_0x5d26('0x1d');var _0x372114=_0x2fdc64[_0x5d26('0x1f')];var _0x441f1b=_0x57aba7?0x0:_0xbb04d9['offset'];var _0x201ce2=_0x57aba7?_0x2fdc64[_0x5d26('0x1f')]:_0xbb04d9[_0x5d26('0x1c')]+_0xbb04d9[_0x5d26('0x1e')];var _0x398622;if(_0x201ce2>=_0x372114){_0x201ce2=_0x372114;_0x398622=0xc8;}else{_0x398622=0xce;}_0x3f124c[_0x5d26('0x1a')](_0x398622);return _0x3f124c[_0x5d26('0x20')](_0x5d26('0x21'),_0x441f1b+'-'+_0x201ce2+'/'+_0x372114)[_0x5d26('0x22')](_0x2fdc64);}return null;};}function patchUpdates(_0x3821f2){return function(_0x1c5e5c){try{jsonpatch['apply'](_0x1c5e5c,_0x3821f2,!![]);}catch(_0x3e914a){return BPromise[_0x5d26('0x23')](_0x3e914a);}return _0x1c5e5c[_0x5d26('0x24')]();};}function saveUpdates(_0x45a76f,_0x5a639f){return function(_0x1835ab){if(_0x1835ab){return _0x1835ab[_0x5d26('0x25')](_0x45a76f)[_0x5d26('0x26')](function(_0x4c0f7e){return _0x4c0f7e;});}return null;};}function removeEntity(_0x1b636b,_0x5b5a6e){return function(_0x5b034f){if(_0x5b034f){return _0x5b034f[_0x5d26('0x27')]()[_0x5d26('0x26')](function(){_0x1b636b[_0x5d26('0x1a')](0xcc)[_0x5d26('0x1b')]();});}};}function handleEntityNotFound(_0x363a10,_0x28615b){return function(_0x462e3f){if(!_0x462e3f){_0x363a10[_0x5d26('0x19')](0x194);}return _0x462e3f;};}function handleError(_0x2ec4e5,_0x3e0182){_0x3e0182=_0x3e0182||0x1f4;return function(_0x4f11ea){logger[_0x5d26('0x28')](_0x4f11ea[_0x5d26('0x29')]);if(_0x4f11ea[_0x5d26('0x2a')]){delete _0x4f11ea['name'];}_0x2ec4e5['status'](_0x3e0182)['send'](_0x4f11ea);};}exports[_0x5d26('0x2b')]=function(_0x196b62,_0xbea930){var _0x29d5de={},_0x53ad8f={},_0xf8b92b={'count':0x0,'rows':[]};var _0x1783e2=_[_0x5d26('0x2c')](db['SquareReport'][_0x5d26('0x2d')],function(_0x300207){return{'name':_0x300207[_0x5d26('0x2e')],'type':_0x300207['type'][_0x5d26('0x2f')]};});_0x53ad8f['model']=_[_0x5d26('0x2c')](_0x1783e2,_0x5d26('0x2a'));_0x53ad8f[_0x5d26('0x30')]=_['keys'](_0x196b62[_0x5d26('0x30')]);_0x53ad8f['filters']=_[_0x5d26('0x31')](_0x53ad8f['model'],_0x53ad8f[_0x5d26('0x30')]);_0x29d5de[_0x5d26('0x32')]=_['intersection'](_0x53ad8f['model'],qs['fields'](_0x196b62[_0x5d26('0x30')][_0x5d26('0x33')]));_0x29d5de['attributes']=_0x29d5de[_0x5d26('0x32')][_0x5d26('0x34')]?_0x29d5de['attributes']:_0x53ad8f[_0x5d26('0x35')];if(!_0x196b62[_0x5d26('0x30')]['hasOwnProperty']('nolimit')){_0x29d5de[_0x5d26('0x1e')]=qs[_0x5d26('0x1e')](_0x196b62[_0x5d26('0x30')][_0x5d26('0x1e')]);_0x29d5de[_0x5d26('0x1c')]=qs[_0x5d26('0x1c')](_0x196b62['query'][_0x5d26('0x1c')]);}_0x29d5de[_0x5d26('0x36')]=qs[_0x5d26('0x37')](_0x196b62['query'][_0x5d26('0x37')]);_0x29d5de[_0x5d26('0x38')]=qs[_0x5d26('0x39')](_[_0x5d26('0x3a')](_0x196b62[_0x5d26('0x30')],_0x53ad8f['filters']),_0x1783e2);if(_0x196b62[_0x5d26('0x30')][_0x5d26('0x3b')]){_0x29d5de[_0x5d26('0x38')]=_[_0x5d26('0x3c')](_0x29d5de[_0x5d26('0x38')],{'$or':_['map'](_0x1783e2,function(_0x28d3c7){if(_0x28d3c7['type']!=='VIRTUAL'){var _0x3b5f5e={};_0x3b5f5e[_0x28d3c7['name']]={'$like':'%'+_0x196b62[_0x5d26('0x30')][_0x5d26('0x3b')]+'%'};return _0x3b5f5e;}})});}_0x29d5de=_[_0x5d26('0x3c')]({},_0x29d5de,_0x196b62['options']);var _0x182a67={'where':_0x29d5de[_0x5d26('0x38')]};return db[_0x5d26('0x3d')][_0x5d26('0x1f')](_0x182a67)[_0x5d26('0x26')](function(_0xac0b3a){_0xf8b92b[_0x5d26('0x1f')]=_0xac0b3a;if(_0x196b62[_0x5d26('0x30')][_0x5d26('0x3e')]){_0x29d5de[_0x5d26('0x3f')]=[{'all':!![]}];}return db[_0x5d26('0x3d')][_0x5d26('0x40')](_0x29d5de);})[_0x5d26('0x26')](function(_0x5ba7cc){_0xf8b92b[_0x5d26('0x41')]=_0x5ba7cc;return _0xf8b92b;})[_0x5d26('0x26')](respondWithFilteredResult(_0xbea930,_0x29d5de))['catch'](handleError(_0xbea930,null));};exports[_0x5d26('0x42')]=function(_0x454588,_0x8c4ed5){var _0x4cab16={'raw':!![],'where':{'id':_0x454588[_0x5d26('0x43')]['id']}},_0x3fd288={};_0x3fd288[_0x5d26('0x35')]=_['keys'](db[_0x5d26('0x3d')][_0x5d26('0x2d')]);_0x3fd288[_0x5d26('0x30')]=_['keys'](_0x454588[_0x5d26('0x30')]);_0x3fd288[_0x5d26('0x39')]=_[_0x5d26('0x31')](_0x3fd288[_0x5d26('0x35')],_0x3fd288[_0x5d26('0x30')]);_0x4cab16['attributes']=_[_0x5d26('0x31')](_0x3fd288['model'],qs[_0x5d26('0x33')](_0x454588[_0x5d26('0x30')][_0x5d26('0x33')]));_0x4cab16[_0x5d26('0x32')]=_0x4cab16['attributes'][_0x5d26('0x34')]?_0x4cab16['attributes']:_0x3fd288[_0x5d26('0x35')];if(_0x454588['query'][_0x5d26('0x3e')]){_0x4cab16[_0x5d26('0x3f')]=[{'all':!![]}];}_0x4cab16=_['merge']({},_0x4cab16,_0x454588[_0x5d26('0x44')]);return db[_0x5d26('0x3d')][_0x5d26('0x45')](_0x4cab16)['then'](handleEntityNotFound(_0x8c4ed5,null))[_0x5d26('0x26')](respondWithResult(_0x8c4ed5,null))[_0x5d26('0x46')](handleError(_0x8c4ed5,null));};exports['create']=function(_0xc46fa5,_0x135a3d){return db['SquareReport'][_0x5d26('0x47')](_0xc46fa5['body'],{})[_0x5d26('0x26')](respondWithResult(_0x135a3d,0xc9))[_0x5d26('0x46')](handleError(_0x135a3d,null));};exports[_0x5d26('0x25')]=function(_0x3b2e61,_0x3cc22e){if(_0x3b2e61[_0x5d26('0x48')]['id']){delete _0x3b2e61[_0x5d26('0x48')]['id'];}return db[_0x5d26('0x3d')][_0x5d26('0x45')]({'where':{'id':_0x3b2e61[_0x5d26('0x43')]['id']}})[_0x5d26('0x26')](handleEntityNotFound(_0x3cc22e,null))[_0x5d26('0x26')](saveUpdates(_0x3b2e61[_0x5d26('0x48')],null))[_0x5d26('0x26')](respondWithResult(_0x3cc22e,null))[_0x5d26('0x46')](handleError(_0x3cc22e,null));};exports['destroy']=function(_0x47aa17,_0x40cdf6){return db[_0x5d26('0x3d')][_0x5d26('0x45')]({'where':{'id':_0x47aa17[_0x5d26('0x43')]['id']}})[_0x5d26('0x26')](handleEntityNotFound(_0x40cdf6,null))[_0x5d26('0x26')](removeEntity(_0x40cdf6,null))[_0x5d26('0x46')](handleError(_0x40cdf6,null));};exports[_0x5d26('0x49')]=function(_0x5bbc52,_0x104b54){return db[_0x5d26('0x3d')][_0x5d26('0x49')]()['then'](respondWithResult(_0x104b54,null))[_0x5d26('0x46')](handleError(_0x104b54,null));}; \ No newline at end of file +var _0xe0db=['mustache','sox','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','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x291053,_0x3e702c){var _0x25bab2=function(_0x347b74){while(--_0x347b74){_0x291053['push'](_0x291053['shift']());}};_0x25bab2(++_0x3e702c);}(_0xe0db,0x1a4));var _0xbe0d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe0db[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0xbe0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe0d('0x1'));var jsonpatch=require(_0xbe0d('0x2'));var rp=require(_0xbe0d('0x3'));var moment=require(_0xbe0d('0x4'));var BPromise=require(_0xbe0d('0x5'));var Mustache=require(_0xbe0d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbe0d('0x7'));var csv=require(_0xbe0d('0x8'));var ejs=require(_0xbe0d('0x9'));var fs=require('fs');var fs_extra=require(_0xbe0d('0xa'));var _=require('lodash');var squel=require(_0xbe0d('0xb'));var crypto=require(_0xbe0d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbe0d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbe0d('0xe'));var Papa=require(_0xbe0d('0xf'));var Redis=require(_0xbe0d('0x10'));var authService=require(_0xbe0d('0x11'));var qs=require(_0xbe0d('0x12'));var as=require(_0xbe0d('0x13'));var hardwareService=require(_0xbe0d('0x14'));var logger=require(_0xbe0d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xbe0d('0x16'));var licenseUtil=require(_0xbe0d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x283b50,_0x1d7d7b){_0x1d7d7b=_0x1d7d7b||0xcc;return function(_0x6ecd18){if(_0x6ecd18){return _0x283b50[_0xbe0d('0x18')](_0x1d7d7b);}return _0x283b50[_0xbe0d('0x19')](_0x1d7d7b)[_0xbe0d('0x1a')]();};}function respondWithResult(_0x5b7ef5,_0x32bba8){_0x32bba8=_0x32bba8||0xc8;return function(_0x25f0d9){if(_0x25f0d9){return _0x5b7ef5[_0xbe0d('0x19')](_0x32bba8)[_0xbe0d('0x1b')](_0x25f0d9);}};}function respondWithFilteredResult(_0x27a0ab,_0x20fe6f){return function(_0x1a3597){if(_0x1a3597){var _0x5ec2e1=typeof _0x20fe6f[_0xbe0d('0x1c')]===_0xbe0d('0x1d')&&typeof _0x20fe6f[_0xbe0d('0x1e')]==='undefined';var _0x32f875=_0x1a3597[_0xbe0d('0x1f')];var _0x16bb97=_0x5ec2e1?0x0:_0x20fe6f[_0xbe0d('0x1c')];var _0x291c61=_0x5ec2e1?_0x1a3597[_0xbe0d('0x1f')]:_0x20fe6f[_0xbe0d('0x1c')]+_0x20fe6f[_0xbe0d('0x1e')];var _0x2a91cf;if(_0x291c61>=_0x32f875){_0x291c61=_0x32f875;_0x2a91cf=0xc8;}else{_0x2a91cf=0xce;}_0x27a0ab[_0xbe0d('0x19')](_0x2a91cf);return _0x27a0ab['set'](_0xbe0d('0x20'),_0x16bb97+'-'+_0x291c61+'/'+_0x32f875)[_0xbe0d('0x1b')](_0x1a3597);}return null;};}function patchUpdates(_0x309b03){return function(_0x43aa81){try{jsonpatch['apply'](_0x43aa81,_0x309b03,!![]);}catch(_0x1d8fdf){return BPromise['reject'](_0x1d8fdf);}return _0x43aa81[_0xbe0d('0x21')]();};}function saveUpdates(_0x72d56,_0x15f922){return function(_0x3e4625){if(_0x3e4625){return _0x3e4625[_0xbe0d('0x22')](_0x72d56)[_0xbe0d('0x23')](function(_0x3d63e6){return _0x3d63e6;});}return null;};}function removeEntity(_0x5d6ece,_0x9d149b){return function(_0x4931d2){if(_0x4931d2){return _0x4931d2[_0xbe0d('0x24')]()[_0xbe0d('0x23')](function(){_0x5d6ece['status'](0xcc)[_0xbe0d('0x1a')]();});}};}function handleEntityNotFound(_0x2d638e,_0x36fc04){return function(_0x2788d7){if(!_0x2788d7){_0x2d638e[_0xbe0d('0x18')](0x194);}return _0x2788d7;};}function handleError(_0x209911,_0x10016a){_0x10016a=_0x10016a||0x1f4;return function(_0x27b384){logger[_0xbe0d('0x25')](_0x27b384[_0xbe0d('0x26')]);if(_0x27b384[_0xbe0d('0x27')]){delete _0x27b384['name'];}_0x209911[_0xbe0d('0x19')](_0x10016a)['send'](_0x27b384);};}exports[_0xbe0d('0x28')]=function(_0x339ebd,_0x11f50b){var _0x334c42={},_0x2f7ad6={},_0xf1c161={'count':0x0,'rows':[]};var _0x293117=_[_0xbe0d('0x29')](db[_0xbe0d('0x2a')][_0xbe0d('0x2b')],function(_0x93d00d){return{'name':_0x93d00d[_0xbe0d('0x2c')],'type':_0x93d00d['type'][_0xbe0d('0x2d')]};});_0x2f7ad6['model']=_[_0xbe0d('0x29')](_0x293117,_0xbe0d('0x27'));_0x2f7ad6[_0xbe0d('0x2e')]=_[_0xbe0d('0x2f')](_0x339ebd[_0xbe0d('0x2e')]);_0x2f7ad6[_0xbe0d('0x30')]=_['intersection'](_0x2f7ad6['model'],_0x2f7ad6['query']);_0x334c42[_0xbe0d('0x31')]=_['intersection'](_0x2f7ad6[_0xbe0d('0x32')],qs[_0xbe0d('0x33')](_0x339ebd[_0xbe0d('0x2e')][_0xbe0d('0x33')]));_0x334c42[_0xbe0d('0x31')]=_0x334c42[_0xbe0d('0x31')][_0xbe0d('0x34')]?_0x334c42[_0xbe0d('0x31')]:_0x2f7ad6['model'];if(!_0x339ebd[_0xbe0d('0x2e')][_0xbe0d('0x35')]('nolimit')){_0x334c42[_0xbe0d('0x1e')]=qs[_0xbe0d('0x1e')](_0x339ebd['query'][_0xbe0d('0x1e')]);_0x334c42['offset']=qs[_0xbe0d('0x1c')](_0x339ebd[_0xbe0d('0x2e')]['offset']);}_0x334c42['order']=qs[_0xbe0d('0x36')](_0x339ebd[_0xbe0d('0x2e')]['sort']);_0x334c42[_0xbe0d('0x37')]=qs[_0xbe0d('0x30')](_[_0xbe0d('0x38')](_0x339ebd[_0xbe0d('0x2e')],_0x2f7ad6[_0xbe0d('0x30')]),_0x293117);if(_0x339ebd[_0xbe0d('0x2e')][_0xbe0d('0x39')]){_0x334c42[_0xbe0d('0x37')]=_[_0xbe0d('0x3a')](_0x334c42[_0xbe0d('0x37')],{'$or':_[_0xbe0d('0x29')](_0x293117,function(_0x53afb3){if(_0x53afb3['type']!==_0xbe0d('0x3b')){var _0x43df8f={};_0x43df8f[_0x53afb3[_0xbe0d('0x27')]]={'$like':'%'+_0x339ebd[_0xbe0d('0x2e')]['filter']+'%'};return _0x43df8f;}})});}_0x334c42=_[_0xbe0d('0x3a')]({},_0x334c42,_0x339ebd[_0xbe0d('0x3c')]);var _0x23cfcd={'where':_0x334c42[_0xbe0d('0x37')]};return db[_0xbe0d('0x2a')][_0xbe0d('0x1f')](_0x23cfcd)[_0xbe0d('0x23')](function(_0x5d576b){_0xf1c161[_0xbe0d('0x1f')]=_0x5d576b;if(_0x339ebd['query'][_0xbe0d('0x3d')]){_0x334c42[_0xbe0d('0x3e')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x334c42);})[_0xbe0d('0x23')](function(_0x3f3ae9){_0xf1c161[_0xbe0d('0x3f')]=_0x3f3ae9;return _0xf1c161;})[_0xbe0d('0x23')](respondWithFilteredResult(_0x11f50b,_0x334c42))['catch'](handleError(_0x11f50b,null));};exports[_0xbe0d('0x40')]=function(_0x3f6aaf,_0x9c9b5c){var _0x434abf={'raw':!![],'where':{'id':_0x3f6aaf[_0xbe0d('0x41')]['id']}},_0x5de93e={};_0x5de93e[_0xbe0d('0x32')]=_['keys'](db[_0xbe0d('0x2a')]['rawAttributes']);_0x5de93e[_0xbe0d('0x2e')]=_[_0xbe0d('0x2f')](_0x3f6aaf[_0xbe0d('0x2e')]);_0x5de93e['filters']=_['intersection'](_0x5de93e[_0xbe0d('0x32')],_0x5de93e[_0xbe0d('0x2e')]);_0x434abf[_0xbe0d('0x31')]=_['intersection'](_0x5de93e[_0xbe0d('0x32')],qs[_0xbe0d('0x33')](_0x3f6aaf['query'][_0xbe0d('0x33')]));_0x434abf[_0xbe0d('0x31')]=_0x434abf[_0xbe0d('0x31')][_0xbe0d('0x34')]?_0x434abf['attributes']:_0x5de93e[_0xbe0d('0x32')];if(_0x3f6aaf[_0xbe0d('0x2e')][_0xbe0d('0x3d')]){_0x434abf[_0xbe0d('0x3e')]=[{'all':!![]}];}_0x434abf=_[_0xbe0d('0x3a')]({},_0x434abf,_0x3f6aaf[_0xbe0d('0x3c')]);return db[_0xbe0d('0x2a')][_0xbe0d('0x42')](_0x434abf)[_0xbe0d('0x23')](handleEntityNotFound(_0x9c9b5c,null))[_0xbe0d('0x23')](respondWithResult(_0x9c9b5c,null))[_0xbe0d('0x43')](handleError(_0x9c9b5c,null));};exports[_0xbe0d('0x44')]=function(_0x121361,_0x3b474b){return db['SquareReport'][_0xbe0d('0x44')](_0x121361[_0xbe0d('0x45')],{})[_0xbe0d('0x23')](respondWithResult(_0x3b474b,0xc9))[_0xbe0d('0x43')](handleError(_0x3b474b,null));};exports[_0xbe0d('0x22')]=function(_0x57d796,_0x1f8ae5){if(_0x57d796[_0xbe0d('0x45')]['id']){delete _0x57d796[_0xbe0d('0x45')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x57d796[_0xbe0d('0x41')]['id']}})[_0xbe0d('0x23')](handleEntityNotFound(_0x1f8ae5,null))['then'](saveUpdates(_0x57d796[_0xbe0d('0x45')],null))[_0xbe0d('0x23')](respondWithResult(_0x1f8ae5,null))['catch'](handleError(_0x1f8ae5,null));};exports['destroy']=function(_0x3f7a8e,_0x55ac45){return db[_0xbe0d('0x2a')][_0xbe0d('0x42')]({'where':{'id':_0x3f7a8e[_0xbe0d('0x41')]['id']}})[_0xbe0d('0x23')](handleEntityNotFound(_0x55ac45,null))[_0xbe0d('0x23')](removeEntity(_0x55ac45,null))[_0xbe0d('0x43')](handleError(_0x55ac45,null));};exports['describe']=function(_0xef6bb0,_0x34d000){return db[_0xbe0d('0x2a')][_0xbe0d('0x46')]()[_0xbe0d('0x23')](respondWithResult(_0x34d000,null))[_0xbe0d('0x43')](handleError(_0x34d000,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 535a1a9..dad83a8 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 _0x59d3=['request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1832a7,_0x3ef02b){var _0x4e6916=function(_0x5357e8){while(--_0x5357e8){_0x1832a7['push'](_0x1832a7['shift']());}};_0x4e6916(++_0x3ef02b);}(_0x59d3,0x1ca));var _0x359d=function(_0x1b5d16,_0x3fa23e){_0x1b5d16=_0x1b5d16-0x0;var _0x96a5ec=_0x59d3[_0x1b5d16];return _0x96a5ec;};'use strict';var _=require(_0x359d('0x0'));var util=require(_0x359d('0x1'));var logger=require(_0x359d('0x2'))(_0x359d('0x3'));var moment=require(_0x359d('0x4'));var BPromise=require(_0x359d('0x5'));var rp=require(_0x359d('0x6'));var fs=require('fs');var path=require(_0x359d('0x7'));var rimraf=require('rimraf');var config=require(_0x359d('0x8'));var attributes=require(_0x359d('0x9'));module[_0x359d('0xa')]=function(_0x42de07,_0x5310f4){return _0x42de07[_0x359d('0xb')](_0x359d('0xc'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x359d('0xd'),'fields':[_0x359d('0xe'),'project_name']},{'name':_0x359d('0xf'),'fields':[_0x359d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2cc6=['exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./squareReport.attributes'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x2cc6,0x13e));var _0x62cc=function(_0x17e0ff,_0x4dbd1e){_0x17e0ff=_0x17e0ff-0x0;var _0x357979=_0x2cc6[_0x17e0ff];return _0x357979;};'use strict';var _=require(_0x62cc('0x0'));var util=require('util');var logger=require(_0x62cc('0x1'))('api');var moment=require('moment');var BPromise=require(_0x62cc('0x2'));var rp=require(_0x62cc('0x3'));var fs=require('fs');var path=require(_0x62cc('0x4'));var rimraf=require('rimraf');var config=require(_0x62cc('0x5'));var attributes=require(_0x62cc('0x6'));module[_0x62cc('0x7')]=function(_0x53ff72,_0x568df4){return _0x53ff72['define'](_0x62cc('0x8'),attributes,{'tableName':_0x62cc('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x62cc('0xa'),_0x62cc('0xb')]},{'name':_0x62cc('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 5180459..e9d9ef4 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 _0x032a=['SquareReport','body','UpdateSquareReport','options','raw','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport'];(function(_0x4e66d6,_0x3692e0){var _0x3dedbf=function(_0x5c2daf){while(--_0x5c2daf){_0x4e66d6['push'](_0x4e66d6['shift']());}};_0x3dedbf(++_0x3692e0);}(_0x032a,0x1ba));var _0xa032=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0x032a[_0x2b0f81];return _0x5ce74c;};'use strict';var _=require(_0xa032('0x0'));var util=require(_0xa032('0x1'));var moment=require(_0xa032('0x2'));var BPromise=require('bluebird');var rs=require(_0xa032('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa032('0x4'))['db'];var utils=require(_0xa032('0x5'));var logger=require(_0xa032('0x6'))('rpc');var config=require(_0xa032('0x7'));var jayson=require(_0xa032('0x8'));var client=jayson['client'][_0xa032('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5952a8,_0x4db93e,_0x4c98bd){return new BPromise(function(_0x11c3a9,_0xc2e1f1){return client['request'](_0x5952a8,_0x4c98bd)[_0xa032('0xa')](function(_0x55b9d4){logger[_0xa032('0xb')]('SquareReport,\x20%s,\x20%s',_0x4db93e,'request\x20sent');logger[_0xa032('0xc')](_0xa032('0xd'),_0x4db93e,_0xa032('0xe'),JSON[_0xa032('0xf')](_0x55b9d4));if(_0x55b9d4[_0xa032('0x10')]){if(_0x55b9d4[_0xa032('0x10')][_0xa032('0x11')]===0x1f4){logger[_0xa032('0x10')](_0xa032('0x12'),_0x4db93e,_0x55b9d4[_0xa032('0x10')][_0xa032('0x13')]);return _0xc2e1f1(_0x55b9d4['error'][_0xa032('0x13')]);}logger[_0xa032('0x10')]('SquareReport,\x20%s,\x20%s',_0x4db93e,_0x55b9d4[_0xa032('0x10')]['message']);return _0x11c3a9(_0x55b9d4[_0xa032('0x10')][_0xa032('0x13')]);}else{logger[_0xa032('0xb')]('SquareReport,\x20%s,\x20%s',_0x4db93e,_0xa032('0xe'));_0x11c3a9(_0x55b9d4[_0xa032('0x14')][_0xa032('0x13')]);}})[_0xa032('0x15')](function(_0x26f7cd){logger[_0xa032('0x10')](_0xa032('0x12'),_0x4db93e,_0x26f7cd);_0xc2e1f1(_0x26f7cd);});});}exports[_0xa032('0x16')]=function(_0x3c0806){var _0x50548e=this;return new Promise(function(_0x5f499e,_0x8b9b32){return db[_0xa032('0x17')]['create'](_0x3c0806[_0xa032('0x18')],{'raw':_0x3c0806['options']?_0x3c0806['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x24f80d){logger[_0xa032('0xb')](_0xa032('0x16'),_0x3c0806);logger['debug'](_0xa032('0x16'),_0x3c0806,JSON[_0xa032('0xf')](_0x24f80d));_0x5f499e(_0x24f80d);})[_0xa032('0x15')](function(_0x3aadbf){logger['error'](_0xa032('0x16'),_0x3aadbf[_0xa032('0x13')],_0x3c0806);_0x8b9b32(_0x50548e[_0xa032('0x10')](0x1f4,_0x3aadbf[_0xa032('0x13')]));});});};exports[_0xa032('0x19')]=function(_0x56c671){var _0x4b18e0=this;return new Promise(function(_0x4dfde1,_0x452138){return db[_0xa032('0x17')]['update'](_0x56c671[_0xa032('0x18')],{'raw':_0x56c671['options']?_0x56c671[_0xa032('0x1a')][_0xa032('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c671['options']?_0x56c671[_0xa032('0x1a')][_0xa032('0x1c')]||null:null,'attributes':_0x56c671[_0xa032('0x1a')]?_0x56c671[_0xa032('0x1a')][_0xa032('0x1d')]||null:null,'limit':_0x56c671['options']?_0x56c671[_0xa032('0x1a')][_0xa032('0x1e')]||null:null})[_0xa032('0xa')](function(_0x7af5d0){logger[_0xa032('0xb')](_0xa032('0x19'),_0x56c671);logger[_0xa032('0xc')](_0xa032('0x19'),_0x56c671,JSON['stringify'](_0x7af5d0));_0x4dfde1(_0x7af5d0);})[_0xa032('0x15')](function(_0x27d50e){logger[_0xa032('0x10')](_0xa032('0x19'),_0x27d50e[_0xa032('0x13')],_0x56c671);_0x452138(_0x4b18e0[_0xa032('0x10')](0x1f4,_0x27d50e[_0xa032('0x13')]));});});}; \ No newline at end of file +var _0x1b98=['bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','UpdateSquareReport','update','raw','where','attributes','lodash','util'];(function(_0x1a5763,_0x19539b){var _0x18020e=function(_0x5c2817){while(--_0x5c2817){_0x1a5763['push'](_0x1a5763['shift']());}};_0x18020e(++_0x19539b);}(_0x1b98,0x1a2));var _0x81b9=function(_0x4e6a20,_0x4ab1cd){_0x4e6a20=_0x4e6a20-0x0;var _0x4e6f7b=_0x1b98[_0x4e6a20];return _0x4e6f7b;};'use strict';var _=require(_0x81b9('0x0'));var util=require(_0x81b9('0x1'));var moment=require('moment');var BPromise=require(_0x81b9('0x2'));var rs=require(_0x81b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x81b9('0x5'))('rpc');var config=require(_0x81b9('0x6'));var jayson=require(_0x81b9('0x7'));var client=jayson[_0x81b9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x170a9a,_0x1d941f,_0x16336c){return new BPromise(function(_0x292c07,_0x1a127d){return client[_0x81b9('0x9')](_0x170a9a,_0x16336c)[_0x81b9('0xa')](function(_0x536e4c){logger[_0x81b9('0xb')](_0x81b9('0xc'),_0x1d941f,_0x81b9('0xd'));logger[_0x81b9('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x1d941f,_0x81b9('0xd'),JSON[_0x81b9('0xf')](_0x536e4c));if(_0x536e4c[_0x81b9('0x10')]){if(_0x536e4c[_0x81b9('0x10')][_0x81b9('0x11')]===0x1f4){logger['error'](_0x81b9('0xc'),_0x1d941f,_0x536e4c['error'][_0x81b9('0x12')]);return _0x1a127d(_0x536e4c[_0x81b9('0x10')][_0x81b9('0x12')]);}logger[_0x81b9('0x10')](_0x81b9('0xc'),_0x1d941f,_0x536e4c['error'][_0x81b9('0x12')]);return _0x292c07(_0x536e4c[_0x81b9('0x10')]['message']);}else{logger[_0x81b9('0xb')](_0x81b9('0xc'),_0x1d941f,_0x81b9('0xd'));_0x292c07(_0x536e4c[_0x81b9('0x13')][_0x81b9('0x12')]);}})[_0x81b9('0x14')](function(_0x327fc9){logger[_0x81b9('0x10')](_0x81b9('0xc'),_0x1d941f,_0x327fc9);_0x1a127d(_0x327fc9);});});}exports[_0x81b9('0x15')]=function(_0x539e09){var _0x47a037=this;return new Promise(function(_0x55476c,_0x4d3bc4){return db[_0x81b9('0x16')]['create'](_0x539e09[_0x81b9('0x17')],{'raw':_0x539e09['options']?_0x539e09[_0x81b9('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x81b9('0xa')](function(_0x4fcd1a){logger[_0x81b9('0xb')](_0x81b9('0x15'),_0x539e09);logger[_0x81b9('0xe')]('CreateSquareReport',_0x539e09,JSON[_0x81b9('0xf')](_0x4fcd1a));_0x55476c(_0x4fcd1a);})[_0x81b9('0x14')](function(_0xf83db6){logger[_0x81b9('0x10')](_0x81b9('0x15'),_0xf83db6[_0x81b9('0x12')],_0x539e09);_0x4d3bc4(_0x47a037[_0x81b9('0x10')](0x1f4,_0xf83db6[_0x81b9('0x12')]));});});};exports[_0x81b9('0x19')]=function(_0x307d6a){var _0x55709c=this;return new Promise(function(_0x267f9b,_0x4e155b){return db[_0x81b9('0x16')][_0x81b9('0x1a')](_0x307d6a[_0x81b9('0x17')],{'raw':_0x307d6a[_0x81b9('0x18')]?_0x307d6a[_0x81b9('0x18')][_0x81b9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x307d6a[_0x81b9('0x18')]?_0x307d6a[_0x81b9('0x18')][_0x81b9('0x1c')]||null:null,'attributes':_0x307d6a[_0x81b9('0x18')]?_0x307d6a['options'][_0x81b9('0x1d')]||null:null,'limit':_0x307d6a[_0x81b9('0x18')]?_0x307d6a[_0x81b9('0x18')]['limit']||null:null})[_0x81b9('0xa')](function(_0x289254){logger[_0x81b9('0xb')](_0x81b9('0x19'),_0x307d6a);logger[_0x81b9('0xe')]('UpdateSquareReport',_0x307d6a,JSON[_0x81b9('0xf')](_0x289254));_0x267f9b(_0x289254);})[_0x81b9('0x14')](function(_0x566feb){logger['error']('UpdateSquareReport',_0x566feb['message'],_0x307d6a);_0x4e155b(_0x55709c[_0x81b9('0x10')](0x1f4,_0x566feb[_0x81b9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c29dd3d..64907a3 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 _0x2a7c=['update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x5cfce7,_0x17e90e){var _0x350223=function(_0x55a769){while(--_0x55a769){_0x5cfce7['push'](_0x5cfce7['shift']());}};_0x350223(++_0x17e90e);}(_0x2a7c,0x10b));var _0xc2a7=function(_0x228713,_0x56aa06){_0x228713=_0x228713-0x0;var _0xb4c687=_0x2a7c[_0x228713];return _0xb4c687;};'use strict';var multer=require(_0xc2a7('0x0'));var util=require('util');var path=require(_0xc2a7('0x1'));var timeout=require(_0xc2a7('0x2'));var express=require(_0xc2a7('0x3'));var router=express[_0xc2a7('0x4')]();var fs_extra=require(_0xc2a7('0x5'));var auth=require(_0xc2a7('0x6'));var interaction=require(_0xc2a7('0x7'));var config=require(_0xc2a7('0x8'));var controller=require('./squareReportDetail.controller');router[_0xc2a7('0x9')]('/',auth['isAuthenticated'](),controller[_0xc2a7('0xa')]);router['get'](_0xc2a7('0xb'),auth[_0xc2a7('0xc')](),controller[_0xc2a7('0xd')]);router[_0xc2a7('0x9')](_0xc2a7('0xe'),auth['isAuthenticated'](),controller[_0xc2a7('0xf')]);router[_0xc2a7('0x10')]('/',auth['isAuthenticated'](),controller[_0xc2a7('0x11')]);router[_0xc2a7('0x12')](_0xc2a7('0xe'),auth['isAuthenticated'](),controller[_0xc2a7('0x13')]);router[_0xc2a7('0x14')](_0xc2a7('0xe'),auth[_0xc2a7('0xc')](),controller[_0xc2a7('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfc41=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','/describe','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x91ed04,_0xdf5e11){var _0x1a26d3=function(_0x358bb9){while(--_0x358bb9){_0x91ed04['push'](_0x91ed04['shift']());}};_0x1a26d3(++_0xdf5e11);}(_0xfc41,0x19f));var _0x1fc4=function(_0x2ccbb9,_0x3ccdd3){_0x2ccbb9=_0x2ccbb9-0x0;var _0x5ab0cf=_0xfc41[_0x2ccbb9];return _0x5ab0cf;};'use strict';var multer=require(_0x1fc4('0x0'));var util=require(_0x1fc4('0x1'));var path=require('path');var timeout=require(_0x1fc4('0x2'));var express=require(_0x1fc4('0x3'));var router=express[_0x1fc4('0x4')]();var fs_extra=require(_0x1fc4('0x5'));var auth=require(_0x1fc4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1fc4('0x7'));var controller=require(_0x1fc4('0x8'));router[_0x1fc4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1fc4('0xa'),auth[_0x1fc4('0xb')](),controller['describe']);router[_0x1fc4('0x9')](_0x1fc4('0xc'),auth[_0x1fc4('0xb')](),controller[_0x1fc4('0xd')]);router[_0x1fc4('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1fc4('0xf')](_0x1fc4('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1fc4('0x10')](_0x1fc4('0xc'),auth[_0x1fc4('0xb')](),controller[_0x1fc4('0x11')]);module[_0x1fc4('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 74c85e9..e80ca71 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 _0xb562=['TEXT','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb562,0x1aa));var _0x2b56=function(_0x25e05b,_0x21f4cb){_0x25e05b=_0x25e05b-0x0;var _0x45f83a=_0xb562[_0x25e05b];return _0x45f83a;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x2b56('0x0')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2b56('0x1')]}}; \ No newline at end of file +var _0xb8fb=['sequelize','exports','STRING'];(function(_0x58329d,_0x405132){var _0x5c08bd=function(_0x2b0278){while(--_0x2b0278){_0x58329d['push'](_0x58329d['shift']());}};_0x5c08bd(++_0x405132);}(_0xb8fb,0x153));var _0xbb8f=function(_0x100a0b,_0x568997){_0x100a0b=_0x100a0b-0x0;var _0x553973=_0xb8fb[_0x100a0b];return _0x553973;};'use strict';var Sequelize=require(_0xbb8f('0x0'));module[_0xbb8f('0x1')]={'uniqueid':{'type':Sequelize[_0xbb8f('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xbb8f('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xbb8f('0x2')]},'callerid':{'type':Sequelize[_0xbb8f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1b98669..a967fd5 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 _0x7089=['SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','catch','params','keys','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x7089,0x10f));var _0x9708=function(_0x46d524,_0x19c4aa){_0x46d524=_0x46d524-0x0;var _0x342f46=_0x7089[_0x46d524];return _0x342f46;};'use strict';var emlformat=require(_0x9708('0x0'));var rimraf=require(_0x9708('0x1'));var zipdir=require(_0x9708('0x2'));var jsonpatch=require(_0x9708('0x3'));var rp=require(_0x9708('0x4'));var moment=require(_0x9708('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9708('0x6'));var util=require(_0x9708('0x7'));var path=require(_0x9708('0x8'));var sox=require(_0x9708('0x9'));var csv=require(_0x9708('0xa'));var ejs=require(_0x9708('0xb'));var fs=require('fs');var fs_extra=require(_0x9708('0xc'));var _=require(_0x9708('0xd'));var squel=require('squel');var crypto=require(_0x9708('0xe'));var jsforce=require(_0x9708('0xf'));var deskjs=require(_0x9708('0x10'));var toCsv=require(_0x9708('0xa'));var querystring=require(_0x9708('0x11'));var Papa=require(_0x9708('0x12'));var Redis=require('ioredis');var authService=require(_0x9708('0x13'));var qs=require(_0x9708('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9708('0x15'))(_0x9708('0x16'));var utils=require(_0x9708('0x17'));var config=require(_0x9708('0x18'));var licenseUtil=require(_0x9708('0x19'));var db=require(_0x9708('0x1a'))['db'];function respondWithStatusCode(_0x350030,_0x1e03c1){_0x1e03c1=_0x1e03c1||0xcc;return function(_0x1e0e11){if(_0x1e0e11){return _0x350030[_0x9708('0x1b')](_0x1e03c1);}return _0x350030['status'](_0x1e03c1)['end']();};}function respondWithResult(_0x3c32a8,_0x124690){_0x124690=_0x124690||0xc8;return function(_0xf6ac67){if(_0xf6ac67){return _0x3c32a8[_0x9708('0x1c')](_0x124690)[_0x9708('0x1d')](_0xf6ac67);}};}function respondWithFilteredResult(_0x3a9ed7,_0xdc333b){return function(_0x545e77){if(_0x545e77){var _0x52ed8e=typeof _0xdc333b[_0x9708('0x1e')]===_0x9708('0x1f')&&typeof _0xdc333b[_0x9708('0x20')]==='undefined';var _0x6de03b=_0x545e77['count'];var _0x57e75f=_0x52ed8e?0x0:_0xdc333b[_0x9708('0x1e')];var _0x2689b7=_0x52ed8e?_0x545e77[_0x9708('0x21')]:_0xdc333b['offset']+_0xdc333b[_0x9708('0x20')];var _0x472965;if(_0x2689b7>=_0x6de03b){_0x2689b7=_0x6de03b;_0x472965=0xc8;}else{_0x472965=0xce;}_0x3a9ed7[_0x9708('0x1c')](_0x472965);return _0x3a9ed7[_0x9708('0x22')](_0x9708('0x23'),_0x57e75f+'-'+_0x2689b7+'/'+_0x6de03b)['json'](_0x545e77);}return null;};}function patchUpdates(_0x3b82e3){return function(_0x499554){try{jsonpatch[_0x9708('0x24')](_0x499554,_0x3b82e3,!![]);}catch(_0x84ed0b){return BPromise['reject'](_0x84ed0b);}return _0x499554[_0x9708('0x25')]();};}function saveUpdates(_0x18c9c,_0x84ba0b){return function(_0x277d7c){if(_0x277d7c){return _0x277d7c[_0x9708('0x26')](_0x18c9c)[_0x9708('0x27')](function(_0x431084){return _0x431084;});}return null;};}function removeEntity(_0x367c09,_0x276b91){return function(_0x2842d0){if(_0x2842d0){return _0x2842d0['destroy']()[_0x9708('0x27')](function(){_0x367c09[_0x9708('0x1c')](0xcc)[_0x9708('0x28')]();});}};}function handleEntityNotFound(_0x15ab34,_0x3d063c){return function(_0x12b7d8){if(!_0x12b7d8){_0x15ab34[_0x9708('0x1b')](0x194);}return _0x12b7d8;};}function handleError(_0x50f3bc,_0x4eb5d1){_0x4eb5d1=_0x4eb5d1||0x1f4;return function(_0x21b549){logger[_0x9708('0x29')](_0x21b549[_0x9708('0x2a')]);if(_0x21b549[_0x9708('0x2b')]){delete _0x21b549[_0x9708('0x2b')];}_0x50f3bc[_0x9708('0x1c')](_0x4eb5d1)[_0x9708('0x2c')](_0x21b549);};}exports['index']=function(_0x3cc2c8,_0xbcbcca){var _0x20ec5b={},_0xdd0336={},_0x53caf6={'count':0x0,'rows':[]};var _0x1e9e74=_['map'](db[_0x9708('0x2d')][_0x9708('0x2e')],function(_0x14fbad){return{'name':_0x14fbad[_0x9708('0x2f')],'type':_0x14fbad[_0x9708('0x30')][_0x9708('0x31')]};});_0xdd0336[_0x9708('0x32')]=_['map'](_0x1e9e74,_0x9708('0x2b'));_0xdd0336[_0x9708('0x33')]=_['keys'](_0x3cc2c8[_0x9708('0x33')]);_0xdd0336[_0x9708('0x34')]=_[_0x9708('0x35')](_0xdd0336[_0x9708('0x32')],_0xdd0336[_0x9708('0x33')]);_0x20ec5b[_0x9708('0x36')]=_[_0x9708('0x35')](_0xdd0336[_0x9708('0x32')],qs[_0x9708('0x37')](_0x3cc2c8['query'][_0x9708('0x37')]));_0x20ec5b['attributes']=_0x20ec5b[_0x9708('0x36')][_0x9708('0x38')]?_0x20ec5b[_0x9708('0x36')]:_0xdd0336[_0x9708('0x32')];if(!_0x3cc2c8[_0x9708('0x33')][_0x9708('0x39')](_0x9708('0x3a'))){_0x20ec5b[_0x9708('0x20')]=qs[_0x9708('0x20')](_0x3cc2c8[_0x9708('0x33')][_0x9708('0x20')]);_0x20ec5b[_0x9708('0x1e')]=qs[_0x9708('0x1e')](_0x3cc2c8[_0x9708('0x33')][_0x9708('0x1e')]);}_0x20ec5b[_0x9708('0x3b')]=qs[_0x9708('0x3c')](_0x3cc2c8[_0x9708('0x33')]['sort']);_0x20ec5b[_0x9708('0x3d')]=qs[_0x9708('0x34')](_[_0x9708('0x3e')](_0x3cc2c8[_0x9708('0x33')],_0xdd0336[_0x9708('0x34')]),_0x1e9e74);if(_0x3cc2c8[_0x9708('0x33')][_0x9708('0x3f')]){_0x20ec5b[_0x9708('0x3d')]=_[_0x9708('0x40')](_0x20ec5b[_0x9708('0x3d')],{'$or':_[_0x9708('0x41')](_0x1e9e74,function(_0x38e59d){if(_0x38e59d[_0x9708('0x30')]!==_0x9708('0x42')){var _0x4af8c3={};_0x4af8c3[_0x38e59d[_0x9708('0x2b')]]={'$like':'%'+_0x3cc2c8['query'][_0x9708('0x3f')]+'%'};return _0x4af8c3;}})});}_0x20ec5b=_[_0x9708('0x40')]({},_0x20ec5b,_0x3cc2c8[_0x9708('0x43')]);var _0x2e887a={'where':_0x20ec5b[_0x9708('0x3d')]};return db[_0x9708('0x2d')]['count'](_0x2e887a)[_0x9708('0x27')](function(_0x5b7bd9){_0x53caf6[_0x9708('0x21')]=_0x5b7bd9;if(_0x3cc2c8[_0x9708('0x33')][_0x9708('0x44')]){_0x20ec5b['include']=[{'all':!![]}];}return db[_0x9708('0x2d')][_0x9708('0x45')](_0x20ec5b);})['then'](function(_0x52a450){_0x53caf6['rows']=_0x52a450;return _0x53caf6;})[_0x9708('0x27')](respondWithFilteredResult(_0xbcbcca,_0x20ec5b))[_0x9708('0x46')](handleError(_0xbcbcca,null));};exports['show']=function(_0x3fa50c,_0x21aaa3){var _0x5abd30={'raw':!![],'where':{'id':_0x3fa50c[_0x9708('0x47')]['id']}},_0x31f0d0={};_0x31f0d0['model']=_[_0x9708('0x48')](db[_0x9708('0x2d')][_0x9708('0x2e')]);_0x31f0d0[_0x9708('0x33')]=_['keys'](_0x3fa50c[_0x9708('0x33')]);_0x31f0d0['filters']=_['intersection'](_0x31f0d0[_0x9708('0x32')],_0x31f0d0[_0x9708('0x33')]);_0x5abd30[_0x9708('0x36')]=_[_0x9708('0x35')](_0x31f0d0['model'],qs[_0x9708('0x37')](_0x3fa50c['query'][_0x9708('0x37')]));_0x5abd30[_0x9708('0x36')]=_0x5abd30[_0x9708('0x36')][_0x9708('0x38')]?_0x5abd30[_0x9708('0x36')]:_0x31f0d0[_0x9708('0x32')];if(_0x3fa50c[_0x9708('0x33')][_0x9708('0x44')]){_0x5abd30[_0x9708('0x49')]=[{'all':!![]}];}_0x5abd30=_['merge']({},_0x5abd30,_0x3fa50c[_0x9708('0x43')]);return db[_0x9708('0x2d')][_0x9708('0x4a')](_0x5abd30)[_0x9708('0x27')](handleEntityNotFound(_0x21aaa3,null))['then'](respondWithResult(_0x21aaa3,null))['catch'](handleError(_0x21aaa3,null));};exports[_0x9708('0x4b')]=function(_0x4c16d5,_0x563ecd){return db['SquareDetailsReport'][_0x9708('0x4b')](_0x4c16d5['body'],{})[_0x9708('0x27')](respondWithResult(_0x563ecd,0xc9))[_0x9708('0x46')](handleError(_0x563ecd,null));};exports[_0x9708('0x26')]=function(_0x2d4bc8,_0x14ab6b){if(_0x2d4bc8[_0x9708('0x4c')]['id']){delete _0x2d4bc8[_0x9708('0x4c')]['id'];}return db[_0x9708('0x2d')]['find']({'where':{'id':_0x2d4bc8[_0x9708('0x47')]['id']}})['then'](handleEntityNotFound(_0x14ab6b,null))[_0x9708('0x27')](saveUpdates(_0x2d4bc8[_0x9708('0x4c')],null))['then'](respondWithResult(_0x14ab6b,null))['catch'](handleError(_0x14ab6b,null));};exports[_0x9708('0x4d')]=function(_0x452d2,_0x2e8fcb){return db[_0x9708('0x2d')][_0x9708('0x4a')]({'where':{'id':_0x452d2[_0x9708('0x47')]['id']}})[_0x9708('0x27')](handleEntityNotFound(_0x2e8fcb,null))[_0x9708('0x27')](removeEntity(_0x2e8fcb,null))[_0x9708('0x46')](handleError(_0x2e8fcb,null));};exports['describe']=function(_0x3b68ea,_0x33ab54){return db[_0x9708('0x2d')][_0x9708('0x4e')]()[_0x9708('0x27')](respondWithResult(_0x33ab54,null))[_0x9708('0x46')](handleError(_0x33ab54,null));}; \ No newline at end of file +var _0x5a0a=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','merge','where','map','options','count','includeAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x493088,_0x34459a){var _0x1a4a71=function(_0xd58d26){while(--_0xd58d26){_0x493088['push'](_0x493088['shift']());}};_0x1a4a71(++_0x34459a);}(_0x5a0a,0x1a9));var _0xa5a0=function(_0x19e140,_0x20c08f){_0x19e140=_0x19e140-0x0;var _0x233115=_0x5a0a[_0x19e140];return _0x233115;};'use strict';var emlformat=require(_0xa5a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5a0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5a0('0x2'));var moment=require(_0xa5a0('0x3'));var BPromise=require(_0xa5a0('0x4'));var Mustache=require(_0xa5a0('0x5'));var util=require(_0xa5a0('0x6'));var path=require('path');var sox=require(_0xa5a0('0x7'));var csv=require('to-csv');var ejs=require(_0xa5a0('0x8'));var fs=require('fs');var fs_extra=require(_0xa5a0('0x9'));var _=require(_0xa5a0('0xa'));var squel=require(_0xa5a0('0xb'));var crypto=require(_0xa5a0('0xc'));var jsforce=require(_0xa5a0('0xd'));var deskjs=require(_0xa5a0('0xe'));var toCsv=require(_0xa5a0('0xf'));var querystring=require(_0xa5a0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa5a0('0x11'));var qs=require(_0xa5a0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5a0('0x13'));var logger=require(_0xa5a0('0x14'))(_0xa5a0('0x15'));var utils=require(_0xa5a0('0x16'));var config=require(_0xa5a0('0x17'));var licenseUtil=require(_0xa5a0('0x18'));var db=require(_0xa5a0('0x19'))['db'];function respondWithStatusCode(_0x2edaa1,_0xce20ae){_0xce20ae=_0xce20ae||0xcc;return function(_0x52ba67){if(_0x52ba67){return _0x2edaa1[_0xa5a0('0x1a')](_0xce20ae);}return _0x2edaa1[_0xa5a0('0x1b')](_0xce20ae)['end']();};}function respondWithResult(_0x216860,_0xe140b7){_0xe140b7=_0xe140b7||0xc8;return function(_0xd34dd6){if(_0xd34dd6){return _0x216860[_0xa5a0('0x1b')](_0xe140b7)[_0xa5a0('0x1c')](_0xd34dd6);}};}function respondWithFilteredResult(_0x3017d8,_0x258ffc){return function(_0x3557a1){if(_0x3557a1){var _0x33a38e=typeof _0x258ffc['offset']==='undefined'&&typeof _0x258ffc['limit']===_0xa5a0('0x1d');var _0x58a90f=_0x3557a1['count'];var _0x197bd8=_0x33a38e?0x0:_0x258ffc[_0xa5a0('0x1e')];var _0x3ce681=_0x33a38e?_0x3557a1['count']:_0x258ffc['offset']+_0x258ffc[_0xa5a0('0x1f')];var _0x1c4541;if(_0x3ce681>=_0x58a90f){_0x3ce681=_0x58a90f;_0x1c4541=0xc8;}else{_0x1c4541=0xce;}_0x3017d8['status'](_0x1c4541);return _0x3017d8['set'](_0xa5a0('0x20'),_0x197bd8+'-'+_0x3ce681+'/'+_0x58a90f)[_0xa5a0('0x1c')](_0x3557a1);}return null;};}function patchUpdates(_0x3fd650){return function(_0x44adf3){try{jsonpatch[_0xa5a0('0x21')](_0x44adf3,_0x3fd650,!![]);}catch(_0x120ec2){return BPromise['reject'](_0x120ec2);}return _0x44adf3['save']();};}function saveUpdates(_0x39bb2b,_0x701d3c){return function(_0x36c7e0){if(_0x36c7e0){return _0x36c7e0[_0xa5a0('0x22')](_0x39bb2b)[_0xa5a0('0x23')](function(_0x53a4ea){return _0x53a4ea;});}return null;};}function removeEntity(_0x4e244a,_0x18b25c){return function(_0x501718){if(_0x501718){return _0x501718[_0xa5a0('0x24')]()[_0xa5a0('0x23')](function(){_0x4e244a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x488e30,_0x19db18){return function(_0xd93e21){if(!_0xd93e21){_0x488e30['sendStatus'](0x194);}return _0xd93e21;};}function handleError(_0x5b89c5,_0x49e9b0){_0x49e9b0=_0x49e9b0||0x1f4;return function(_0x459f61){logger[_0xa5a0('0x25')](_0x459f61[_0xa5a0('0x26')]);if(_0x459f61[_0xa5a0('0x27')]){delete _0x459f61[_0xa5a0('0x27')];}_0x5b89c5['status'](_0x49e9b0)[_0xa5a0('0x28')](_0x459f61);};}exports[_0xa5a0('0x29')]=function(_0x24ef8c,_0x5cd6a1){var _0x4bb3eb={},_0x1e7527={},_0x40d634={'count':0x0,'rows':[]};var _0x46873c=_['map'](db[_0xa5a0('0x2a')][_0xa5a0('0x2b')],function(_0x1efee8){return{'name':_0x1efee8[_0xa5a0('0x2c')],'type':_0x1efee8[_0xa5a0('0x2d')][_0xa5a0('0x2e')]};});_0x1e7527[_0xa5a0('0x2f')]=_['map'](_0x46873c,_0xa5a0('0x27'));_0x1e7527[_0xa5a0('0x30')]=_[_0xa5a0('0x31')](_0x24ef8c[_0xa5a0('0x30')]);_0x1e7527[_0xa5a0('0x32')]=_[_0xa5a0('0x33')](_0x1e7527[_0xa5a0('0x2f')],_0x1e7527[_0xa5a0('0x30')]);_0x4bb3eb[_0xa5a0('0x34')]=_[_0xa5a0('0x33')](_0x1e7527[_0xa5a0('0x2f')],qs[_0xa5a0('0x35')](_0x24ef8c[_0xa5a0('0x30')]['fields']));_0x4bb3eb['attributes']=_0x4bb3eb['attributes'][_0xa5a0('0x36')]?_0x4bb3eb[_0xa5a0('0x34')]:_0x1e7527[_0xa5a0('0x2f')];if(!_0x24ef8c[_0xa5a0('0x30')][_0xa5a0('0x37')](_0xa5a0('0x38'))){_0x4bb3eb[_0xa5a0('0x1f')]=qs[_0xa5a0('0x1f')](_0x24ef8c['query'][_0xa5a0('0x1f')]);_0x4bb3eb[_0xa5a0('0x1e')]=qs['offset'](_0x24ef8c['query'][_0xa5a0('0x1e')]);}_0x4bb3eb[_0xa5a0('0x39')]=qs['sort'](_0x24ef8c[_0xa5a0('0x30')]['sort']);_0x4bb3eb['where']=qs[_0xa5a0('0x32')](_['pick'](_0x24ef8c[_0xa5a0('0x30')],_0x1e7527[_0xa5a0('0x32')]),_0x46873c);if(_0x24ef8c[_0xa5a0('0x30')][_0xa5a0('0x3a')]){_0x4bb3eb['where']=_[_0xa5a0('0x3b')](_0x4bb3eb[_0xa5a0('0x3c')],{'$or':_[_0xa5a0('0x3d')](_0x46873c,function(_0x4f9be4){if(_0x4f9be4[_0xa5a0('0x2d')]!=='VIRTUAL'){var _0x802c4f={};_0x802c4f[_0x4f9be4['name']]={'$like':'%'+_0x24ef8c[_0xa5a0('0x30')][_0xa5a0('0x3a')]+'%'};return _0x802c4f;}})});}_0x4bb3eb=_['merge']({},_0x4bb3eb,_0x24ef8c[_0xa5a0('0x3e')]);var _0x1a869b={'where':_0x4bb3eb[_0xa5a0('0x3c')]};return db['SquareDetailsReport'][_0xa5a0('0x3f')](_0x1a869b)['then'](function(_0x27d3db){_0x40d634[_0xa5a0('0x3f')]=_0x27d3db;if(_0x24ef8c[_0xa5a0('0x30')][_0xa5a0('0x40')]){_0x4bb3eb['include']=[{'all':!![]}];}return db[_0xa5a0('0x2a')]['findAll'](_0x4bb3eb);})[_0xa5a0('0x23')](function(_0x51b8b0){_0x40d634[_0xa5a0('0x41')]=_0x51b8b0;return _0x40d634;})[_0xa5a0('0x23')](respondWithFilteredResult(_0x5cd6a1,_0x4bb3eb))[_0xa5a0('0x42')](handleError(_0x5cd6a1,null));};exports[_0xa5a0('0x43')]=function(_0x5a601a,_0x425c25){var _0x8674f7={'raw':!![],'where':{'id':_0x5a601a[_0xa5a0('0x44')]['id']}},_0x4ac9a3={};_0x4ac9a3[_0xa5a0('0x2f')]=_[_0xa5a0('0x31')](db[_0xa5a0('0x2a')][_0xa5a0('0x2b')]);_0x4ac9a3[_0xa5a0('0x30')]=_[_0xa5a0('0x31')](_0x5a601a[_0xa5a0('0x30')]);_0x4ac9a3[_0xa5a0('0x32')]=_[_0xa5a0('0x33')](_0x4ac9a3[_0xa5a0('0x2f')],_0x4ac9a3['query']);_0x8674f7[_0xa5a0('0x34')]=_[_0xa5a0('0x33')](_0x4ac9a3[_0xa5a0('0x2f')],qs[_0xa5a0('0x35')](_0x5a601a[_0xa5a0('0x30')]['fields']));_0x8674f7[_0xa5a0('0x34')]=_0x8674f7[_0xa5a0('0x34')][_0xa5a0('0x36')]?_0x8674f7[_0xa5a0('0x34')]:_0x4ac9a3[_0xa5a0('0x2f')];if(_0x5a601a['query']['includeAll']){_0x8674f7[_0xa5a0('0x45')]=[{'all':!![]}];}_0x8674f7=_[_0xa5a0('0x3b')]({},_0x8674f7,_0x5a601a[_0xa5a0('0x3e')]);return db['SquareDetailsReport'][_0xa5a0('0x46')](_0x8674f7)[_0xa5a0('0x23')](handleEntityNotFound(_0x425c25,null))[_0xa5a0('0x23')](respondWithResult(_0x425c25,null))[_0xa5a0('0x42')](handleError(_0x425c25,null));};exports['create']=function(_0x315870,_0xd156fd){return db[_0xa5a0('0x2a')][_0xa5a0('0x47')](_0x315870[_0xa5a0('0x48')],{})[_0xa5a0('0x23')](respondWithResult(_0xd156fd,0xc9))[_0xa5a0('0x42')](handleError(_0xd156fd,null));};exports['update']=function(_0xcae8db,_0x2d71fe){if(_0xcae8db['body']['id']){delete _0xcae8db[_0xa5a0('0x48')]['id'];}return db[_0xa5a0('0x2a')][_0xa5a0('0x46')]({'where':{'id':_0xcae8db[_0xa5a0('0x44')]['id']}})[_0xa5a0('0x23')](handleEntityNotFound(_0x2d71fe,null))['then'](saveUpdates(_0xcae8db[_0xa5a0('0x48')],null))['then'](respondWithResult(_0x2d71fe,null))[_0xa5a0('0x42')](handleError(_0x2d71fe,null));};exports[_0xa5a0('0x24')]=function(_0x156faf,_0x2280e3){return db[_0xa5a0('0x2a')][_0xa5a0('0x46')]({'where':{'id':_0x156faf[_0xa5a0('0x44')]['id']}})[_0xa5a0('0x23')](handleEntityNotFound(_0x2280e3,null))[_0xa5a0('0x23')](removeEntity(_0x2280e3,null))[_0xa5a0('0x42')](handleError(_0x2280e3,null));};exports[_0xa5a0('0x49')]=function(_0x54364a,_0x59bb87){return db['SquareDetailsReport'][_0xa5a0('0x49')]()[_0xa5a0('0x23')](respondWithResult(_0x59bb87,null))[_0xa5a0('0x42')](handleError(_0x59bb87,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 4265646..0abf397 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 _0x2838=['define','report_square_details','util','moment','request-promise','path','rimraf'];(function(_0x57cd69,_0x3afab8){var _0x18aac0=function(_0xdf497e){while(--_0xdf497e){_0x57cd69['push'](_0x57cd69['shift']());}};_0x18aac0(++_0x3afab8);}(_0x2838,0x152));var _0x8283=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x2838[_0x2cc8bb];return _0x140e40;};'use strict';var _=require('lodash');var util=require(_0x8283('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8283('0x1'));var BPromise=require('bluebird');var rp=require(_0x8283('0x2'));var fs=require('fs');var path=require(_0x8283('0x3'));var rimraf=require(_0x8283('0x4'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x487606,_0x3c47a8){return _0x487606[_0x8283('0x5')]('SquareDetailsReport',attributes,{'tableName':_0x8283('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f5e=['path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment'];(function(_0x5d9bc1,_0x5b5c20){var _0x22d71c=function(_0x38fb54){while(--_0x38fb54){_0x5d9bc1['push'](_0x5d9bc1['shift']());}};_0x22d71c(++_0x5b5c20);}(_0x1f5e,0x15c));var _0xe1f5=function(_0x596bee,_0x3a449f){_0x596bee=_0x596bee-0x0;var _0x4c7349=_0x1f5e[_0x596bee];return _0x4c7349;};'use strict';var _=require(_0xe1f5('0x0'));var util=require('util');var logger=require(_0xe1f5('0x1'))(_0xe1f5('0x2'));var moment=require(_0xe1f5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1f5('0x4'));var rimraf=require('rimraf');var config=require(_0xe1f5('0x5'));var attributes=require(_0xe1f5('0x6'));module[_0xe1f5('0x7')]=function(_0x4896c7,_0x4223a1){return _0x4896c7[_0xe1f5('0x8')](_0xe1f5('0x9'),attributes,{'tableName':_0xe1f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 369894d..f360bc1 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 _0x58a4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareDetailsReport','body','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0xc85ce5,_0x23c1a1){var _0x37d8da=function(_0x385d19){while(--_0x385d19){_0xc85ce5['push'](_0xc85ce5['shift']());}};_0x37d8da(++_0x23c1a1);}(_0x58a4,0xbf));var _0x458a=function(_0x315b61,_0x4bb11e){_0x315b61=_0x315b61-0x0;var _0x3521e8=_0x58a4[_0x315b61];return _0x3521e8;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var moment=require(_0x458a('0x2'));var BPromise=require(_0x458a('0x3'));var rs=require(_0x458a('0x4'));var fs=require('fs');var Redis=require(_0x458a('0x5'));var db=require(_0x458a('0x6'))['db'];var utils=require(_0x458a('0x7'));var logger=require(_0x458a('0x8'))(_0x458a('0x9'));var config=require(_0x458a('0xa'));var jayson=require(_0x458a('0xb'));var client=jayson[_0x458a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5358c2,_0x30b095,_0x11fcaa){return new BPromise(function(_0x2029bc,_0x1e658e){return client[_0x458a('0xd')](_0x5358c2,_0x11fcaa)['then'](function(_0x4bedce){logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,_0x458a('0x10'));logger[_0x458a('0x11')](_0x458a('0x12'),_0x30b095,'request\x20sent',JSON[_0x458a('0x13')](_0x4bedce));if(_0x4bedce[_0x458a('0x14')]){if(_0x4bedce['error'][_0x458a('0x15')]===0x1f4){logger[_0x458a('0x14')](_0x458a('0xf'),_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x1e658e(_0x4bedce['error']['message']);}logger[_0x458a('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x2029bc(_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);}else{logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,'request\x20sent');_0x2029bc(_0x4bedce['result']['message']);}})[_0x458a('0x17')](function(_0x3fd6d4){logger[_0x458a('0x14')]('SquareDetailsReport,\x20%s,\x20%s',_0x30b095,_0x3fd6d4);_0x1e658e(_0x3fd6d4);});});}exports[_0x458a('0x18')]=function(_0x260c87){var _0x18504d=this;return new Promise(function(_0x392986,_0xa91473){return db['SquareDetailsReport']['create'](_0x260c87[_0x458a('0x19')],{'raw':_0x260c87['options']?_0x260c87[_0x458a('0x1a')][_0x458a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x468416){logger['info'](_0x458a('0x18'),_0x260c87);logger[_0x458a('0x11')]('CreateSquareDetailsReport',_0x260c87,JSON[_0x458a('0x13')](_0x468416));_0x392986(_0x468416);})[_0x458a('0x17')](function(_0x5a2bcb){logger[_0x458a('0x14')]('CreateSquareDetailsReport',_0x5a2bcb[_0x458a('0x16')],_0x260c87);_0xa91473(_0x18504d['error'](0x1f4,_0x5a2bcb[_0x458a('0x16')]));});});}; \ No newline at end of file +var _0xccde=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','create','body','options','raw','debug','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x3b4cf9,_0x2018c9){var _0x466ef3=function(_0x534d61){while(--_0x534d61){_0x3b4cf9['push'](_0x3b4cf9['shift']());}};_0x466ef3(++_0x2018c9);}(_0xccde,0x1e1));var _0xeccd=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0xccde[_0x1d211b];return _0x47c88b;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var moment=require(_0xeccd('0x1'));var BPromise=require('bluebird');var rs=require(_0xeccd('0x2'));var fs=require('fs');var Redis=require(_0xeccd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeccd('0x4'))(_0xeccd('0x5'));var config=require(_0xeccd('0x6'));var jayson=require(_0xeccd('0x7'));var client=jayson[_0xeccd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x338742,_0x130f1c,_0x1b622f){return new BPromise(function(_0x1eebfb,_0x4b068e){return client[_0xeccd('0x9')](_0x338742,_0x1b622f)[_0xeccd('0xa')](function(_0x9dccd){logger[_0xeccd('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x130f1c,'request\x20sent');logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'),JSON[_0xeccd('0xd')](_0x9dccd));if(_0x9dccd[_0xeccd('0xe')]){if(_0x9dccd[_0xeccd('0xe')][_0xeccd('0xf')]===0x1f4){logger['error'](_0xeccd('0x10'),_0x130f1c,_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);return _0x4b068e(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}logger[_0xeccd('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x130f1c,_0x9dccd['error'][_0xeccd('0x11')]);return _0x1eebfb(_0x9dccd[_0xeccd('0xe')][_0xeccd('0x11')]);}else{logger[_0xeccd('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x130f1c,_0xeccd('0xc'));_0x1eebfb(_0x9dccd[_0xeccd('0x12')]['message']);}})['catch'](function(_0x42e47e){logger[_0xeccd('0xe')](_0xeccd('0x10'),_0x130f1c,_0x42e47e);_0x4b068e(_0x42e47e);});});}exports[_0xeccd('0x13')]=function(_0xb0fad7){var _0x360d25=this;return new Promise(function(_0x466d98,_0x17596a){return db['SquareDetailsReport'][_0xeccd('0x14')](_0xb0fad7[_0xeccd('0x15')],{'raw':_0xb0fad7[_0xeccd('0x16')]?_0xb0fad7[_0xeccd('0x16')][_0xeccd('0x17')]===undefined?!![]:![]:!![]})[_0xeccd('0xa')](function(_0x508439){logger['info']('CreateSquareDetailsReport',_0xb0fad7);logger[_0xeccd('0x18')]('CreateSquareDetailsReport',_0xb0fad7,JSON[_0xeccd('0xd')](_0x508439));_0x466d98(_0x508439);})[_0xeccd('0x19')](function(_0x54083d){logger[_0xeccd('0xe')]('CreateSquareDetailsReport',_0x54083d[_0xeccd('0x11')],_0xb0fad7);_0x17596a(_0x360d25[_0xeccd('0xe')](0x1f4,_0x54083d[_0xeccd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index dcea430..5e89a7b 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 _0x1bdd=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports'];(function(_0x284a61,_0x231686){var _0x220e3c=function(_0x104496){while(--_0x104496){_0x284a61['push'](_0x284a61['shift']());}};_0x220e3c(++_0x231686);}(_0x1bdd,0x7e));var _0xd1bd=function(_0xbfd058,_0x1ee59){_0xbfd058=_0xbfd058-0x0;var _0x568cb1=_0x1bdd[_0xbfd058];return _0x568cb1;};'use strict';var express=require(_0xd1bd('0x0'));var router=express[_0xd1bd('0x1')]();var auth=require(_0xd1bd('0x2'));var controller=require(_0xd1bd('0x3'));router[_0xd1bd('0x4')]('/',auth[_0xd1bd('0x5')](),controller['index']);router[_0xd1bd('0x4')](_0xd1bd('0x6'),auth[_0xd1bd('0x5')](),controller[_0xd1bd('0x7')]);module[_0xd1bd('0x8')]=router; \ No newline at end of file +var _0x8210=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated','index','get'];(function(_0x5a6983,_0x38627f){var _0x516234=function(_0x22fcdc){while(--_0x22fcdc){_0x5a6983['push'](_0x5a6983['shift']());}};_0x516234(++_0x38627f);}(_0x8210,0x193));var _0x0821=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x8210[_0x45d55e];return _0x29812a;};'use strict';var express=require(_0x0821('0x0'));var router=express[_0x0821('0x1')]();var auth=require(_0x0821('0x2'));var controller=require(_0x0821('0x3'));router['get']('/',auth[_0x0821('0x4')](),controller[_0x0821('0x5')]);router[_0x0821('0x6')](_0x0821('0x7'),auth['isAuthenticated'](),controller[_0x0821('0x8')]);module[_0x0821('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d0faf07..03e40a6 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 _0xa1d9=['json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData'];(function(_0x11447e,_0x33dab2){var _0x45a214=function(_0x1dce72){while(--_0x1dce72){_0x11447e['push'](_0x11447e['shift']());}};_0x45a214(++_0x33dab2);}(_0xa1d9,0x158));var _0x9a1d=function(_0x561944,_0x5a4783){_0x561944=_0x561944-0x0;var _0x179b7b=_0xa1d9[_0x561944];return _0x179b7b;};'use strict';var info=require(_0x9a1d('0x0'));var exec=require(_0x9a1d('0x1'))[_0x9a1d('0x2')];var logger=require(_0x9a1d('0x3'))(_0x9a1d('0x4'));var util=require(_0x9a1d('0x5'));var BPromise=require(_0x9a1d('0x6'));var _=require(_0x9a1d('0x7'));function handleError(_0x3bb7c9,_0x51166e,_0x403da1){_0x51166e=_0x51166e||0x1f4;return function(_0x8ab8c2){logger[_0x9a1d('0x8')](_0x9a1d('0x9'),_0x403da1,_0x51166e,util[_0x9a1d('0xa')](_0x8ab8c2,{'showHidden':![],'depth':null}));delete _0x8ab8c2[_0x9a1d('0xb')];_0x3bb7c9[_0x9a1d('0xc')](_0x51166e)[_0x9a1d('0xd')](_0x8ab8c2);};}exports[_0x9a1d('0xe')]=function(_0x469767,_0x1fd3aa){return info[_0x9a1d('0xf')]()['then'](function(_0x1c1c1b){return _0x1fd3aa[_0x9a1d('0xc')](0xc8)[_0x9a1d('0x10')](_0x1c1c1b);})['catch'](function(_0x499c90){return _0x1fd3aa[_0x9a1d('0xc')](0x1f4)[_0x9a1d('0x10')](_0x499c90);});};exports['killProcess']=function(_0x26f9ee,_0x30e17c){var _0x3ca430=[_0x9a1d('0x11')];return new BPromise(function(_0x3a9184,_0x5d2713){return exec(util[_0x9a1d('0x12')](_0x9a1d('0x13'),_0x26f9ee[_0x9a1d('0x14')][_0x9a1d('0x15')]),function(_0x191266,_0x5c33fe,_0x3d7bc2){if(_0x191266){return _0x5d2713(_0x191266);}return _0x3a9184(_0x5c33fe);});})[_0x9a1d('0x16')](function(_0x6f99b3){var _0x518a94=![];var _0x17cef7=_0x6f99b3['split'](/\n/);for(var _0x3ce69f=0x0,_0x3fd18d=_0x3ca430[_0x9a1d('0x17')];_0x3ce69f<_0x3fd18d,_0x518a94===![];_0x3ce69f+=0x1){if(_0x6f99b3[_0x9a1d('0x18')](_0x3ca430[_0x3ce69f])>=0x0){_0x518a94=!![];}}if(!_0x518a94){throw new Error(util[_0x9a1d('0x12')](_0x9a1d('0x19'),_0x26f9ee[_0x9a1d('0x14')][_0x9a1d('0x15')]));}process['kill'](_0x26f9ee['params'][_0x9a1d('0x15')],_0x9a1d('0x1a'));return _0x30e17c[_0x9a1d('0xc')](0xc8)[_0x9a1d('0x10')]({'message':util[_0x9a1d('0x12')](_0x9a1d('0x1b'),_0x26f9ee[_0x9a1d('0x14')][_0x9a1d('0x15')])});})[_0x9a1d('0x1c')](handleError(_0x30e17c,null,_0x9a1d('0x1d')));}; \ No newline at end of file +var _0x8399=['status','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name'];(function(_0x2ef8b7,_0x2ae1eb){var _0xd82440=function(_0x104ae5){while(--_0x104ae5){_0x2ef8b7['push'](_0x2ef8b7['shift']());}};_0xd82440(++_0x2ae1eb);}(_0x8399,0xc5));var _0x9839=function(_0x251dd9,_0x20f621){_0x251dd9=_0x251dd9-0x0;var _0x279e13=_0x8399[_0x251dd9];return _0x279e13;};'use strict';var info=require(_0x9839('0x0'));var exec=require(_0x9839('0x1'))[_0x9839('0x2')];var logger=require(_0x9839('0x3'))(_0x9839('0x4'));var util=require(_0x9839('0x5'));var BPromise=require(_0x9839('0x6'));var _=require(_0x9839('0x7'));function handleError(_0x1134c6,_0x22cc38,_0x417472){_0x22cc38=_0x22cc38||0x1f4;return function(_0x49f738){logger[_0x9839('0x8')](_0x9839('0x9'),_0x417472,_0x22cc38,util['inspect'](_0x49f738,{'showHidden':![],'depth':null}));delete _0x49f738[_0x9839('0xa')];_0x1134c6[_0x9839('0xb')](_0x22cc38)['send'](_0x49f738);};}exports[_0x9839('0xc')]=function(_0x23c4fc,_0x42c464){return info['getAllData']()[_0x9839('0xd')](function(_0x3d8f41){return _0x42c464[_0x9839('0xb')](0xc8)[_0x9839('0xe')](_0x3d8f41);})[_0x9839('0xf')](function(_0x4053db){return _0x42c464['status'](0x1f4)['json'](_0x4053db);});};exports[_0x9839('0x10')]=function(_0x1fd54b,_0x45023b){var _0x30e35a=['components/import/cm'];return new BPromise(function(_0x298bc0,_0x21dac5){return exec(util[_0x9839('0x11')](_0x9839('0x12'),_0x1fd54b[_0x9839('0x13')][_0x9839('0x14')]),function(_0x39cd3f,_0x359c73,_0x38e718){if(_0x39cd3f){return _0x21dac5(_0x39cd3f);}return _0x298bc0(_0x359c73);});})['then'](function(_0x516cc5){var _0x196652=![];var _0x5d2c93=_0x516cc5[_0x9839('0x15')](/\n/);for(var _0x3e6597=0x0,_0x288a99=_0x30e35a[_0x9839('0x16')];_0x3e6597<_0x288a99,_0x196652===![];_0x3e6597+=0x1){if(_0x516cc5['indexOf'](_0x30e35a[_0x3e6597])>=0x0){_0x196652=!![];}}if(!_0x196652){throw new Error(util[_0x9839('0x11')](_0x9839('0x17'),_0x1fd54b[_0x9839('0x13')][_0x9839('0x14')]));}process[_0x9839('0x18')](_0x1fd54b[_0x9839('0x13')][_0x9839('0x14')],'SIGINT');return _0x45023b[_0x9839('0xb')](0xc8)[_0x9839('0xe')]({'message':util[_0x9839('0x11')](_0x9839('0x19'),_0x1fd54b[_0x9839('0x13')][_0x9839('0x14')])});})[_0x9839('0xf')](handleError(_0x45023b,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 25a63e1..d487786 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 _0x84ab=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','/describe','describe','isAuthenticated','post','create','update','delete','/:id','destroy','multer'];(function(_0x57c501,_0x319f03){var _0x4f15ba=function(_0x52e0c1){while(--_0x52e0c1){_0x57c501['push'](_0x57c501['shift']());}};_0x4f15ba(++_0x319f03);}(_0x84ab,0x12f));var _0xb84a=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x84ab[_0x151418];return _0x40e29a;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var fs_extra=require(_0xb84a('0x5'));var auth=require(_0xb84a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb84a('0x7'));var controller=require(_0xb84a('0x8'));router[_0xb84a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router[_0xb84a('0x9')]('/:id',auth[_0xb84a('0xc')](),controller['show']);router[_0xb84a('0xd')]('/',auth[_0xb84a('0xc')](),controller[_0xb84a('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb84a('0xf')]);router[_0xb84a('0x10')](_0xb84a('0x11'),auth[_0xb84a('0xc')](),controller[_0xb84a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7bae=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x568c6c,_0x159a9e){var _0x272010=function(_0x59e9a3){while(--_0x59e9a3){_0x568c6c['push'](_0x568c6c['shift']());}};_0x272010(++_0x159a9e);}(_0x7bae,0x13b));var _0xe7ba=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x7bae[_0x455c6c];return _0x488242;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['show']);router[_0xe7ba('0xd')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 8450a29..896fef9 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 _0xceb0=['STRING'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xceb0,0x173));var _0x0ceb=function(_0x3ec098,_0x135cbf){_0x3ec098=_0x3ec098-0x0;var _0xd158ed=_0xceb0[_0x3ec098];return _0xd158ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0ceb('0x0')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x0ceb('0x0')]}}; \ No newline at end of file +var _0x2f68=['STRING','name','#0091EA','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f68,0x12b));var _0x82f6=function(_0x1d02e9,_0x2ae8c8){_0x1d02e9=_0x1d02e9-0x0;var _0x3501d5=_0x2f68[_0x1d02e9];return _0x3501d5;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'name':{'type':Sequelize[_0x82f6('0x1')],'unique':_0x82f6('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x82f6('0x1')],'defaultValue':_0x82f6('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 536c78c..724cc19 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 _0xbf49=['rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','error','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','send','index','map','Tag','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll'];(function(_0x191dab,_0x2ebe91){var _0x3f1206=function(_0x45c331){while(--_0x45c331){_0x191dab['push'](_0x191dab['shift']());}};_0x3f1206(++_0x2ebe91);}(_0xbf49,0x11f));var _0x9bf4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf49[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9bf4('0x0'));var rimraf=require(_0x9bf4('0x1'));var zipdir=require(_0x9bf4('0x2'));var jsonpatch=require(_0x9bf4('0x3'));var rp=require(_0x9bf4('0x4'));var moment=require(_0x9bf4('0x5'));var BPromise=require(_0x9bf4('0x6'));var Mustache=require(_0x9bf4('0x7'));var util=require(_0x9bf4('0x8'));var path=require(_0x9bf4('0x9'));var sox=require(_0x9bf4('0xa'));var csv=require(_0x9bf4('0xb'));var ejs=require(_0x9bf4('0xc'));var fs=require('fs');var fs_extra=require(_0x9bf4('0xd'));var _=require('lodash');var squel=require(_0x9bf4('0xe'));var crypto=require('crypto');var jsforce=require(_0x9bf4('0xf'));var deskjs=require(_0x9bf4('0x10'));var toCsv=require(_0x9bf4('0xb'));var querystring=require(_0x9bf4('0x11'));var Papa=require('papaparse');var Redis=require(_0x9bf4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9bf4('0x13'));var as=require(_0x9bf4('0x14'));var hardwareService=require(_0x9bf4('0x15'));var logger=require(_0x9bf4('0x16'))(_0x9bf4('0x17'));var utils=require('../../config/utils');var config=require(_0x9bf4('0x18'));var licenseUtil=require(_0x9bf4('0x19'));var db=require(_0x9bf4('0x1a'))['db'];function respondWithStatusCode(_0x141652,_0x507c97){_0x507c97=_0x507c97||0xcc;return function(_0x145857){if(_0x145857){return _0x141652[_0x9bf4('0x1b')](_0x507c97);}return _0x141652[_0x9bf4('0x1c')](_0x507c97)[_0x9bf4('0x1d')]();};}function respondWithResult(_0x268610,_0x47a176){_0x47a176=_0x47a176||0xc8;return function(_0x3ab11b){if(_0x3ab11b){return _0x268610[_0x9bf4('0x1c')](_0x47a176)[_0x9bf4('0x1e')](_0x3ab11b);}};}function respondWithFilteredResult(_0x45b87f,_0x3075cd){return function(_0x432a74){if(_0x432a74){var _0x3cd07c=typeof _0x3075cd['offset']===_0x9bf4('0x1f')&&typeof _0x3075cd[_0x9bf4('0x20')]===_0x9bf4('0x1f');var _0x1c6511=_0x432a74[_0x9bf4('0x21')];var _0x3a036e=_0x3cd07c?0x0:_0x3075cd[_0x9bf4('0x22')];var _0xbd3a39=_0x3cd07c?_0x432a74[_0x9bf4('0x21')]:_0x3075cd['offset']+_0x3075cd[_0x9bf4('0x20')];var _0x3573fb;if(_0xbd3a39>=_0x1c6511){_0xbd3a39=_0x1c6511;_0x3573fb=0xc8;}else{_0x3573fb=0xce;}_0x45b87f[_0x9bf4('0x1c')](_0x3573fb);return _0x45b87f[_0x9bf4('0x23')](_0x9bf4('0x24'),_0x3a036e+'-'+_0xbd3a39+'/'+_0x1c6511)[_0x9bf4('0x1e')](_0x432a74);}return null;};}function patchUpdates(_0x3c5116){return function(_0x2e6dbf){try{jsonpatch[_0x9bf4('0x25')](_0x2e6dbf,_0x3c5116,!![]);}catch(_0x4dba3f){return BPromise[_0x9bf4('0x26')](_0x4dba3f);}return _0x2e6dbf[_0x9bf4('0x27')]();};}function saveUpdates(_0x4934fb,_0x36b06f){return function(_0x13b8f3){if(_0x13b8f3){return _0x13b8f3[_0x9bf4('0x28')](_0x4934fb)[_0x9bf4('0x29')](function(_0x306045){return _0x306045;});}return null;};}function removeEntity(_0x2a22d3,_0x490768){return function(_0x5eca34){if(_0x5eca34){return _0x5eca34[_0x9bf4('0x2a')]()['then'](function(){var _0x1d1063=_0x5eca34['get']({'plain':!![]});var _0x575e19='Tags';return db[_0x9bf4('0x2b')][_0x9bf4('0x2a')]({'where':{'type':_0x575e19,'resourceId':_0x1d1063['id']}})[_0x9bf4('0x29')](function(){return _0x5eca34;});})['then'](function(){_0x2a22d3[_0x9bf4('0x1c')](0xcc)[_0x9bf4('0x1d')]();});}};}function handleEntityNotFound(_0x2e0c07,_0x3c4b37){return function(_0x157e8a){if(!_0x157e8a){_0x2e0c07[_0x9bf4('0x1b')](0x194);}return _0x157e8a;};}function handleError(_0x26bd3a,_0xa8414a){_0xa8414a=_0xa8414a||0x1f4;return function(_0x442a94){logger['error'](_0x442a94[_0x9bf4('0x2c')]);if(_0x442a94['name']){delete _0x442a94['name'];}_0x26bd3a[_0x9bf4('0x1c')](_0xa8414a)[_0x9bf4('0x2d')](_0x442a94);};}exports[_0x9bf4('0x2e')]=function(_0x1bb3fe,_0x18a35b){var _0x4b8d23={},_0x3ab1a7={},_0x36f252={'count':0x0,'rows':[]};var _0x25224d=_[_0x9bf4('0x2f')](db[_0x9bf4('0x30')][_0x9bf4('0x31')],function(_0x472f76){return{'name':_0x472f76['fieldName'],'type':_0x472f76[_0x9bf4('0x32')]['key']};});_0x3ab1a7['model']=_[_0x9bf4('0x2f')](_0x25224d,'name');_0x3ab1a7['query']=_[_0x9bf4('0x33')](_0x1bb3fe[_0x9bf4('0x34')]);_0x3ab1a7[_0x9bf4('0x35')]=_[_0x9bf4('0x36')](_0x3ab1a7[_0x9bf4('0x37')],_0x3ab1a7['query']);_0x4b8d23[_0x9bf4('0x38')]=_[_0x9bf4('0x36')](_0x3ab1a7[_0x9bf4('0x37')],qs[_0x9bf4('0x39')](_0x1bb3fe[_0x9bf4('0x34')]['fields']));_0x4b8d23['attributes']=_0x4b8d23[_0x9bf4('0x38')][_0x9bf4('0x3a')]?_0x4b8d23[_0x9bf4('0x38')]:_0x3ab1a7[_0x9bf4('0x37')];if(!_0x1bb3fe[_0x9bf4('0x34')][_0x9bf4('0x3b')](_0x9bf4('0x3c'))){_0x4b8d23[_0x9bf4('0x20')]=qs[_0x9bf4('0x20')](_0x1bb3fe['query']['limit']);_0x4b8d23[_0x9bf4('0x22')]=qs[_0x9bf4('0x22')](_0x1bb3fe[_0x9bf4('0x34')]['offset']);}_0x4b8d23[_0x9bf4('0x3d')]=qs['sort'](_0x1bb3fe[_0x9bf4('0x34')][_0x9bf4('0x3e')]);_0x4b8d23[_0x9bf4('0x3f')]=qs[_0x9bf4('0x35')](_[_0x9bf4('0x40')](_0x1bb3fe[_0x9bf4('0x34')],_0x3ab1a7[_0x9bf4('0x35')]),_0x25224d);if(_0x1bb3fe['query'][_0x9bf4('0x41')]){_0x4b8d23[_0x9bf4('0x3f')]=_[_0x9bf4('0x42')](_0x4b8d23[_0x9bf4('0x3f')],{'$or':_[_0x9bf4('0x2f')](_0x25224d,function(_0x54eed9){if(_0x54eed9['type']!==_0x9bf4('0x43')){var _0x330056={};_0x330056[_0x54eed9[_0x9bf4('0x44')]]={'$like':'%'+_0x1bb3fe[_0x9bf4('0x34')][_0x9bf4('0x41')]+'%'};return _0x330056;}})});}_0x4b8d23=_[_0x9bf4('0x42')]({},_0x4b8d23,_0x1bb3fe[_0x9bf4('0x45')]);var _0x12f95e={'where':_0x4b8d23[_0x9bf4('0x3f')]};return db[_0x9bf4('0x30')][_0x9bf4('0x21')](_0x12f95e)['then'](function(_0x581d13){_0x36f252[_0x9bf4('0x21')]=_0x581d13;if(_0x1bb3fe[_0x9bf4('0x34')][_0x9bf4('0x46')]){_0x4b8d23[_0x9bf4('0x47')]=[{'all':!![]}];}return db['Tag'][_0x9bf4('0x48')](_0x4b8d23);})[_0x9bf4('0x29')](function(_0x2c21bd){_0x36f252[_0x9bf4('0x49')]=_0x2c21bd;return _0x36f252;})[_0x9bf4('0x29')](respondWithFilteredResult(_0x18a35b,_0x4b8d23))[_0x9bf4('0x4a')](handleError(_0x18a35b,null));};exports[_0x9bf4('0x4b')]=function(_0x142579,_0x58d63c){var _0x4abd21={'raw':!![],'where':{'id':_0x142579[_0x9bf4('0x4c')]['id']}},_0x43945f={};_0x43945f[_0x9bf4('0x37')]=_[_0x9bf4('0x33')](db['Tag'][_0x9bf4('0x31')]);_0x43945f['query']=_[_0x9bf4('0x33')](_0x142579[_0x9bf4('0x34')]);_0x43945f[_0x9bf4('0x35')]=_[_0x9bf4('0x36')](_0x43945f['model'],_0x43945f[_0x9bf4('0x34')]);_0x4abd21[_0x9bf4('0x38')]=_[_0x9bf4('0x36')](_0x43945f['model'],qs['fields'](_0x142579['query'][_0x9bf4('0x39')]));_0x4abd21[_0x9bf4('0x38')]=_0x4abd21[_0x9bf4('0x38')][_0x9bf4('0x3a')]?_0x4abd21[_0x9bf4('0x38')]:_0x43945f[_0x9bf4('0x37')];if(_0x142579[_0x9bf4('0x34')][_0x9bf4('0x46')]){_0x4abd21[_0x9bf4('0x47')]=[{'all':!![]}];}_0x4abd21=_['merge']({},_0x4abd21,_0x142579[_0x9bf4('0x45')]);return db[_0x9bf4('0x30')][_0x9bf4('0x4d')](_0x4abd21)[_0x9bf4('0x29')](handleEntityNotFound(_0x58d63c,null))[_0x9bf4('0x29')](respondWithResult(_0x58d63c,null))['catch'](handleError(_0x58d63c,null));};exports[_0x9bf4('0x4e')]=function(_0x20caaf,_0x3e26b1){return db[_0x9bf4('0x30')][_0x9bf4('0x4e')](_0x20caaf[_0x9bf4('0x4f')],{})['then'](function(_0x17d5da){var _0x33acff=_0x20caaf[_0x9bf4('0x50')][_0x9bf4('0x51')]({'plain':!![]});if(!_0x33acff)throw new Error(_0x9bf4('0x52'));if(_0x33acff[_0x9bf4('0x53')]===_0x9bf4('0x50')){var _0x45dd0a=_0x17d5da[_0x9bf4('0x51')]({'plain':!![]});var _0xa31d29=_0x9bf4('0x54');return db[_0x9bf4('0x55')][_0x9bf4('0x4d')]({'where':{'name':_0xa31d29,'userProfileId':_0x33acff[_0x9bf4('0x56')]},'raw':!![]})[_0x9bf4('0x29')](function(_0x21c62a){if(_0x21c62a&&_0x21c62a[_0x9bf4('0x57')]===0x0){return db[_0x9bf4('0x2b')][_0x9bf4('0x4e')]({'name':_0x45dd0a[_0x9bf4('0x44')],'resourceId':_0x45dd0a['id'],'type':_0x21c62a[_0x9bf4('0x44')],'sectionId':_0x21c62a['id']},{})[_0x9bf4('0x29')](function(){return _0x17d5da;});}else{return _0x17d5da;}})[_0x9bf4('0x4a')](function(_0x4a3eae){logger[_0x9bf4('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a3eae);throw _0x4a3eae;});}return _0x17d5da;})[_0x9bf4('0x29')](respondWithResult(_0x3e26b1,0xc9))[_0x9bf4('0x4a')](handleError(_0x3e26b1,null));};exports[_0x9bf4('0x28')]=function(_0x49bc25,_0x110996){if(_0x49bc25[_0x9bf4('0x4f')]['id']){delete _0x49bc25[_0x9bf4('0x4f')]['id'];}return db[_0x9bf4('0x30')][_0x9bf4('0x4d')]({'where':{'id':_0x49bc25[_0x9bf4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x110996,null))['then'](saveUpdates(_0x49bc25['body'],null))['then'](respondWithResult(_0x110996,null))['catch'](handleError(_0x110996,null));};exports[_0x9bf4('0x2a')]=function(_0x29890b,_0xf8e7a4){return db[_0x9bf4('0x30')][_0x9bf4('0x4d')]({'where':{'id':_0x29890b[_0x9bf4('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf8e7a4,null))[_0x9bf4('0x29')](removeEntity(_0xf8e7a4,null))[_0x9bf4('0x4a')](handleError(_0xf8e7a4,null));};exports[_0x9bf4('0x59')]=function(_0x531ac4,_0x2e123c){return db['Tag'][_0x9bf4('0x59')]()[_0x9bf4('0x29')](respondWithResult(_0x2e123c,null))[_0x9bf4('0x4a')](handleError(_0x2e123c,null));}; \ No newline at end of file +var _0x7b70=['user','Tags','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','keys','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x7b70,0x1f3));var _0x07b7=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x7b70[_0x82129b];return _0x2ae5dc;};'use strict';var emlformat=require(_0x07b7('0x0'));var rimraf=require(_0x07b7('0x1'));var zipdir=require(_0x07b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07b7('0x3'));var moment=require(_0x07b7('0x4'));var BPromise=require(_0x07b7('0x5'));var Mustache=require(_0x07b7('0x6'));var util=require(_0x07b7('0x7'));var path=require(_0x07b7('0x8'));var sox=require(_0x07b7('0x9'));var csv=require(_0x07b7('0xa'));var ejs=require(_0x07b7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x07b7('0xc'));var squel=require('squel');var crypto=require(_0x07b7('0xd'));var jsforce=require(_0x07b7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x07b7('0xf'));var Redis=require(_0x07b7('0x10'));var authService=require(_0x07b7('0x11'));var qs=require(_0x07b7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x07b7('0x13'))('api');var utils=require(_0x07b7('0x14'));var config=require(_0x07b7('0x15'));var licenseUtil=require(_0x07b7('0x16'));var db=require(_0x07b7('0x17'))['db'];function respondWithStatusCode(_0x142e25,_0x3ec324){_0x3ec324=_0x3ec324||0xcc;return function(_0xba9838){if(_0xba9838){return _0x142e25['sendStatus'](_0x3ec324);}return _0x142e25[_0x07b7('0x18')](_0x3ec324)[_0x07b7('0x19')]();};}function respondWithResult(_0x3fb7eb,_0x1a6ab6){_0x1a6ab6=_0x1a6ab6||0xc8;return function(_0x3878ba){if(_0x3878ba){return _0x3fb7eb['status'](_0x1a6ab6)['json'](_0x3878ba);}};}function respondWithFilteredResult(_0x130b95,_0x5e55df){return function(_0xe61f76){if(_0xe61f76){var _0x237ee2=typeof _0x5e55df[_0x07b7('0x1a')]==='undefined'&&typeof _0x5e55df[_0x07b7('0x1b')]==='undefined';var _0x594746=_0xe61f76['count'];var _0x57de21=_0x237ee2?0x0:_0x5e55df[_0x07b7('0x1a')];var _0xe1ee81=_0x237ee2?_0xe61f76[_0x07b7('0x1c')]:_0x5e55df[_0x07b7('0x1a')]+_0x5e55df['limit'];var _0x36ab95;if(_0xe1ee81>=_0x594746){_0xe1ee81=_0x594746;_0x36ab95=0xc8;}else{_0x36ab95=0xce;}_0x130b95[_0x07b7('0x18')](_0x36ab95);return _0x130b95[_0x07b7('0x1d')](_0x07b7('0x1e'),_0x57de21+'-'+_0xe1ee81+'/'+_0x594746)[_0x07b7('0x1f')](_0xe61f76);}return null;};}function patchUpdates(_0x516f72){return function(_0x38eddd){try{jsonpatch['apply'](_0x38eddd,_0x516f72,!![]);}catch(_0x3c67c6){return BPromise[_0x07b7('0x20')](_0x3c67c6);}return _0x38eddd[_0x07b7('0x21')]();};}function saveUpdates(_0x165cbf,_0x282a90){return function(_0x27c66d){if(_0x27c66d){return _0x27c66d[_0x07b7('0x22')](_0x165cbf)[_0x07b7('0x23')](function(_0x1713b1){return _0x1713b1;});}return null;};}function removeEntity(_0x13ad64,_0x33f8db){return function(_0x377342){if(_0x377342){return _0x377342[_0x07b7('0x24')]()[_0x07b7('0x23')](function(){var _0x430607=_0x377342[_0x07b7('0x25')]({'plain':!![]});var _0x5e1828='Tags';return db[_0x07b7('0x26')][_0x07b7('0x24')]({'where':{'type':_0x5e1828,'resourceId':_0x430607['id']}})[_0x07b7('0x23')](function(){return _0x377342;});})[_0x07b7('0x23')](function(){_0x13ad64[_0x07b7('0x18')](0xcc)[_0x07b7('0x19')]();});}};}function handleEntityNotFound(_0x25fbac,_0x55aa9d){return function(_0x52bbbe){if(!_0x52bbbe){_0x25fbac[_0x07b7('0x27')](0x194);}return _0x52bbbe;};}function handleError(_0x5162c1,_0x1eef20){_0x1eef20=_0x1eef20||0x1f4;return function(_0x1b1744){logger[_0x07b7('0x28')](_0x1b1744[_0x07b7('0x29')]);if(_0x1b1744[_0x07b7('0x2a')]){delete _0x1b1744[_0x07b7('0x2a')];}_0x5162c1['status'](_0x1eef20)[_0x07b7('0x2b')](_0x1b1744);};}exports[_0x07b7('0x2c')]=function(_0x22d414,_0x5bcce0){var _0xf69b8f={},_0xeed7e4={},_0x474445={'count':0x0,'rows':[]};var _0x8499fa=_[_0x07b7('0x2d')](db[_0x07b7('0x2e')][_0x07b7('0x2f')],function(_0x5ca091){return{'name':_0x5ca091[_0x07b7('0x30')],'type':_0x5ca091[_0x07b7('0x31')][_0x07b7('0x32')]};});_0xeed7e4[_0x07b7('0x33')]=_[_0x07b7('0x2d')](_0x8499fa,'name');_0xeed7e4['query']=_['keys'](_0x22d414[_0x07b7('0x34')]);_0xeed7e4[_0x07b7('0x35')]=_['intersection'](_0xeed7e4['model'],_0xeed7e4[_0x07b7('0x34')]);_0xf69b8f[_0x07b7('0x36')]=_['intersection'](_0xeed7e4[_0x07b7('0x33')],qs['fields'](_0x22d414['query'][_0x07b7('0x37')]));_0xf69b8f[_0x07b7('0x36')]=_0xf69b8f[_0x07b7('0x36')][_0x07b7('0x38')]?_0xf69b8f['attributes']:_0xeed7e4[_0x07b7('0x33')];if(!_0x22d414[_0x07b7('0x34')][_0x07b7('0x39')]('nolimit')){_0xf69b8f[_0x07b7('0x1b')]=qs[_0x07b7('0x1b')](_0x22d414['query'][_0x07b7('0x1b')]);_0xf69b8f[_0x07b7('0x1a')]=qs[_0x07b7('0x1a')](_0x22d414[_0x07b7('0x34')][_0x07b7('0x1a')]);}_0xf69b8f[_0x07b7('0x3a')]=qs[_0x07b7('0x3b')](_0x22d414[_0x07b7('0x34')]['sort']);_0xf69b8f['where']=qs[_0x07b7('0x35')](_[_0x07b7('0x3c')](_0x22d414[_0x07b7('0x34')],_0xeed7e4['filters']),_0x8499fa);if(_0x22d414[_0x07b7('0x34')][_0x07b7('0x3d')]){_0xf69b8f[_0x07b7('0x3e')]=_[_0x07b7('0x3f')](_0xf69b8f['where'],{'$or':_[_0x07b7('0x2d')](_0x8499fa,function(_0x539be6){if(_0x539be6[_0x07b7('0x31')]!==_0x07b7('0x40')){var _0x328aaa={};_0x328aaa[_0x539be6[_0x07b7('0x2a')]]={'$like':'%'+_0x22d414[_0x07b7('0x34')][_0x07b7('0x3d')]+'%'};return _0x328aaa;}})});}_0xf69b8f=_[_0x07b7('0x3f')]({},_0xf69b8f,_0x22d414[_0x07b7('0x41')]);var _0x21bf63={'where':_0xf69b8f[_0x07b7('0x3e')]};return db[_0x07b7('0x2e')][_0x07b7('0x1c')](_0x21bf63)[_0x07b7('0x23')](function(_0x2bbd7f){_0x474445[_0x07b7('0x1c')]=_0x2bbd7f;if(_0x22d414[_0x07b7('0x34')][_0x07b7('0x42')]){_0xf69b8f[_0x07b7('0x43')]=[{'all':!![]}];}return db['Tag']['findAll'](_0xf69b8f);})['then'](function(_0x191ec1){_0x474445['rows']=_0x191ec1;return _0x474445;})['then'](respondWithFilteredResult(_0x5bcce0,_0xf69b8f))[_0x07b7('0x44')](handleError(_0x5bcce0,null));};exports['show']=function(_0x51c885,_0x1cfbde){var _0x2c8813={'raw':!![],'where':{'id':_0x51c885['params']['id']}},_0x3086ac={};_0x3086ac['model']=_[_0x07b7('0x45')](db[_0x07b7('0x2e')]['rawAttributes']);_0x3086ac[_0x07b7('0x34')]=_['keys'](_0x51c885[_0x07b7('0x34')]);_0x3086ac[_0x07b7('0x35')]=_[_0x07b7('0x46')](_0x3086ac[_0x07b7('0x33')],_0x3086ac['query']);_0x2c8813[_0x07b7('0x36')]=_[_0x07b7('0x46')](_0x3086ac[_0x07b7('0x33')],qs[_0x07b7('0x37')](_0x51c885[_0x07b7('0x34')]['fields']));_0x2c8813[_0x07b7('0x36')]=_0x2c8813[_0x07b7('0x36')][_0x07b7('0x38')]?_0x2c8813[_0x07b7('0x36')]:_0x3086ac[_0x07b7('0x33')];if(_0x51c885[_0x07b7('0x34')]['includeAll']){_0x2c8813[_0x07b7('0x43')]=[{'all':!![]}];}_0x2c8813=_[_0x07b7('0x3f')]({},_0x2c8813,_0x51c885[_0x07b7('0x41')]);return db['Tag'][_0x07b7('0x47')](_0x2c8813)[_0x07b7('0x23')](handleEntityNotFound(_0x1cfbde,null))[_0x07b7('0x23')](respondWithResult(_0x1cfbde,null))[_0x07b7('0x44')](handleError(_0x1cfbde,null));};exports['create']=function(_0x276f0f,_0x526dae){return db[_0x07b7('0x2e')][_0x07b7('0x48')](_0x276f0f[_0x07b7('0x49')],{})['then'](function(_0x28a519){var _0x4294ed=_0x276f0f['user'][_0x07b7('0x25')]({'plain':!![]});if(!_0x4294ed)throw new Error(_0x07b7('0x4a'));if(_0x4294ed['role']===_0x07b7('0x4b')){var _0x5131bd=_0x28a519[_0x07b7('0x25')]({'plain':!![]});var _0x508114=_0x07b7('0x4c');return db['UserProfileSection'][_0x07b7('0x47')]({'where':{'name':_0x508114,'userProfileId':_0x4294ed[_0x07b7('0x4d')]},'raw':!![]})[_0x07b7('0x23')](function(_0x5b7af8){if(_0x5b7af8&&_0x5b7af8[_0x07b7('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5131bd[_0x07b7('0x2a')],'resourceId':_0x5131bd['id'],'type':_0x5b7af8[_0x07b7('0x2a')],'sectionId':_0x5b7af8['id']},{})[_0x07b7('0x23')](function(){return _0x28a519;});}else{return _0x28a519;}})[_0x07b7('0x44')](function(_0x148689){logger[_0x07b7('0x28')](_0x07b7('0x4f'),_0x148689);throw _0x148689;});}return _0x28a519;})['then'](respondWithResult(_0x526dae,0xc9))[_0x07b7('0x44')](handleError(_0x526dae,null));};exports[_0x07b7('0x22')]=function(_0x457489,_0x57e3a0){if(_0x457489[_0x07b7('0x49')]['id']){delete _0x457489[_0x07b7('0x49')]['id'];}return db[_0x07b7('0x2e')]['find']({'where':{'id':_0x457489[_0x07b7('0x50')]['id']}})[_0x07b7('0x23')](handleEntityNotFound(_0x57e3a0,null))[_0x07b7('0x23')](saveUpdates(_0x457489['body'],null))[_0x07b7('0x23')](respondWithResult(_0x57e3a0,null))[_0x07b7('0x44')](handleError(_0x57e3a0,null));};exports[_0x07b7('0x24')]=function(_0x20aa08,_0x253e77){return db[_0x07b7('0x2e')][_0x07b7('0x47')]({'where':{'id':_0x20aa08[_0x07b7('0x50')]['id']}})[_0x07b7('0x23')](handleEntityNotFound(_0x253e77,null))[_0x07b7('0x23')](removeEntity(_0x253e77,null))[_0x07b7('0x44')](handleError(_0x253e77,null));};exports[_0x07b7('0x51')]=function(_0x17bd97,_0x3cfe1d){return db[_0x07b7('0x2e')]['describe']()['then'](respondWithResult(_0x3cfe1d,null))[_0x07b7('0x44')](handleError(_0x3cfe1d,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 03c2dbf..a6e41a3 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 _0x4bcc=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','lodash'];(function(_0x11af4d,_0x2bfd27){var _0x53694a=function(_0x563cfb){while(--_0x563cfb){_0x11af4d['push'](_0x11af4d['shift']());}};_0x53694a(++_0x2bfd27);}(_0x4bcc,0x1a6));var _0xc4bc=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x4bcc[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xc4bc('0x0'));var util=require(_0xc4bc('0x1'));var logger=require(_0xc4bc('0x2'))(_0xc4bc('0x3'));var moment=require('moment');var BPromise=require(_0xc4bc('0x4'));var rp=require(_0xc4bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4bc('0x6'));var config=require(_0xc4bc('0x7'));var attributes=require('./tag.attributes');module[_0xc4bc('0x8')]=function(_0x52fa5e,_0x31a4af){return _0x52fa5e['define']('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe61d=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','Tag','tools_tags','lodash'];(function(_0x5a6280,_0x5a22dd){var _0x24b3d9=function(_0x334ea1){while(--_0x334ea1){_0x5a6280['push'](_0x5a6280['shift']());}};_0x24b3d9(++_0x5a22dd);}(_0xe61d,0x6d));var _0xde61=function(_0x12ab2b,_0x141c63){_0x12ab2b=_0x12ab2b-0x0;var _0x1f3cec=_0xe61d[_0x12ab2b];return _0x1f3cec;};'use strict';var _=require(_0xde61('0x0'));var util=require('util');var logger=require(_0xde61('0x1'))('api');var moment=require(_0xde61('0x2'));var BPromise=require(_0xde61('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde61('0x4'));var rimraf=require(_0xde61('0x5'));var config=require(_0xde61('0x6'));var attributes=require('./tag.attributes');module[_0xde61('0x7')]=function(_0x8b240c,_0x2eff00){return _0x8b240c['define'](_0xde61('0x8'),attributes,{'tableName':_0xde61('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index beec74b..ce482d5 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 _0x98a8=['request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x433d7b,_0x24009e){var _0x7f4d53=function(_0x1e693d){while(--_0x1e693d){_0x433d7b['push'](_0x433d7b['shift']());}};_0x7f4d53(++_0x24009e);}(_0x98a8,0x12c));var _0x898a=function(_0x3f2afd,_0x402e17){_0x3f2afd=_0x3f2afd-0x0;var _0x4ee827=_0x98a8[_0x3f2afd];return _0x4ee827;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('Tag,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file +var _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Tag,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x40fe3b,_0x308371){var _0x89686c=function(_0x4152b7){while(--_0x4152b7){_0x40fe3b['push'](_0x40fe3b['shift']());}};_0x89686c(++_0x308371);}(_0xfd28,0x148));var _0x8fd2=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0xfd28[_0x10dbf6];return _0x452147;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f1231e9..46e90d1 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 6fb0e41..a31d5dc 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 _0xd8b0=['exports','sequelize'];(function(_0x468484,_0x3c1769){var _0x668d8d=function(_0xf3a508){while(--_0xf3a508){_0x468484['push'](_0x468484['shift']());}};_0x668d8d(++_0x3c1769);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x4ec560,_0x32b90b){var _0x34f73e=function(_0x18ec43){while(--_0x18ec43){_0x4ec560['push'](_0x4ec560['shift']());}};_0x34f73e(++_0x32b90b);}(_0xb10b,0x12a));var _0xbb10=function(_0x367c8e,_0x3a6502){_0x367c8e=_0x367c8e-0x0;var _0x1c2789=_0xb10b[_0x367c8e];return _0x1c2789;};'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/team/team.controller.js b/server/api/team/team.controller.js index 1f1e24b..1c4bfb8 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 _0x5d94=['name','send','index','map','Team','rawAttributes','fieldName','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','create','body','user','get','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','update','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','Queues','ids','removeQueues','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Openchannel','Queue:remove','VoicePrefixId','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','error','stack'];(function(_0x442a48,_0xc46eca){var _0x3e242e=function(_0x58fe79){while(--_0x58fe79){_0x442a48['push'](_0x442a48['shift']());}};_0x3e242e(++_0xc46eca);}(_0x5d94,0x1a6));var _0x45d9=function(_0x5ac8fb,_0x58384b){_0x5ac8fb=_0x5ac8fb-0x0;var _0x3c3a3f=_0x5d94[_0x5ac8fb];return _0x3c3a3f;};'use strict';var emlformat=require(_0x45d9('0x0'));var rimraf=require(_0x45d9('0x1'));var zipdir=require(_0x45d9('0x2'));var jsonpatch=require(_0x45d9('0x3'));var rp=require(_0x45d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x45d9('0x5'));var util=require('util');var path=require(_0x45d9('0x6'));var sox=require(_0x45d9('0x7'));var csv=require(_0x45d9('0x8'));var ejs=require(_0x45d9('0x9'));var fs=require('fs');var fs_extra=require(_0x45d9('0xa'));var _=require(_0x45d9('0xb'));var squel=require('squel');var crypto=require(_0x45d9('0xc'));var jsforce=require(_0x45d9('0xd'));var deskjs=require(_0x45d9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x45d9('0xf'));var Redis=require('ioredis');var authService=require(_0x45d9('0x10'));var qs=require(_0x45d9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45d9('0x12'));var logger=require(_0x45d9('0x13'))(_0x45d9('0x14'));var utils=require(_0x45d9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x45d9('0x16'))['db'];config[_0x45d9('0x17')]=_[_0x45d9('0x18')](config[_0x45d9('0x17')],{'host':_0x45d9('0x19'),'port':0x18eb});var socket=require(_0x45d9('0x1a'))(new Redis(config[_0x45d9('0x17')]));require(_0x45d9('0x1b'))[_0x45d9('0x1c')](socket);function respondWithStatusCode(_0x22920c,_0x2fca0e){_0x2fca0e=_0x2fca0e||0xcc;return function(_0x208068){if(_0x208068){return _0x22920c[_0x45d9('0x1d')](_0x2fca0e);}return _0x22920c[_0x45d9('0x1e')](_0x2fca0e)[_0x45d9('0x1f')]();};}function respondWithResult(_0x45bb61,_0x4b3a47){_0x4b3a47=_0x4b3a47||0xc8;return function(_0x36b8fa){if(_0x36b8fa){return _0x45bb61['status'](_0x4b3a47)[_0x45d9('0x20')](_0x36b8fa);}};}function respondWithFilteredResult(_0x20d3b1,_0x57cd8c){return function(_0x9cb1f1){if(_0x9cb1f1){var _0x13d42c=typeof _0x57cd8c[_0x45d9('0x21')]===_0x45d9('0x22')&&typeof _0x57cd8c['limit']===_0x45d9('0x22');var _0xe1a112=_0x9cb1f1[_0x45d9('0x23')];var _0x4c0da9=_0x13d42c?0x0:_0x57cd8c['offset'];var _0x46089f=_0x13d42c?_0x9cb1f1[_0x45d9('0x23')]:_0x57cd8c['offset']+_0x57cd8c['limit'];var _0x26667d;if(_0x46089f>=_0xe1a112){_0x46089f=_0xe1a112;_0x26667d=0xc8;}else{_0x26667d=0xce;}_0x20d3b1['status'](_0x26667d);return _0x20d3b1[_0x45d9('0x24')](_0x45d9('0x25'),_0x4c0da9+'-'+_0x46089f+'/'+_0xe1a112)[_0x45d9('0x20')](_0x9cb1f1);}return null;};}function patchUpdates(_0x3d3bf1){return function(_0x5fc2ca){try{jsonpatch['apply'](_0x5fc2ca,_0x3d3bf1,!![]);}catch(_0x322ca9){return BPromise[_0x45d9('0x26')](_0x322ca9);}return _0x5fc2ca[_0x45d9('0x27')]();};}function saveUpdates(_0x5b01af,_0x9a1f41){return function(_0x45fc48){if(_0x45fc48){return _0x45fc48['update'](_0x5b01af)[_0x45d9('0x28')](function(_0xda71cb){return _0xda71cb;});}return null;};}function handleEntityNotFound(_0x43a79c,_0x295fc5){return function(_0x2c4bac){if(!_0x2c4bac){_0x43a79c[_0x45d9('0x1d')](0x194);}return _0x2c4bac;};}function handleError(_0x31baa9,_0x4218bf){_0x4218bf=_0x4218bf||0x1f4;return function(_0xc25c00){logger[_0x45d9('0x29')](_0xc25c00[_0x45d9('0x2a')]);if(_0xc25c00[_0x45d9('0x2b')]){delete _0xc25c00[_0x45d9('0x2b')];}_0x31baa9[_0x45d9('0x1e')](_0x4218bf)[_0x45d9('0x2c')](_0xc25c00);};}exports[_0x45d9('0x2d')]=function(_0x2f87bb,_0x5abe80){var _0x116bfb={},_0x46e308={},_0x4abdf2={'count':0x0,'rows':[]};var _0x5bd779=_[_0x45d9('0x2e')](db[_0x45d9('0x2f')][_0x45d9('0x30')],function(_0x1a55ba){return{'name':_0x1a55ba[_0x45d9('0x31')],'type':_0x1a55ba['type']['key']};});_0x46e308['model']=_[_0x45d9('0x2e')](_0x5bd779,_0x45d9('0x2b'));_0x46e308[_0x45d9('0x32')]=_['keys'](_0x2f87bb[_0x45d9('0x32')]);_0x46e308[_0x45d9('0x33')]=_[_0x45d9('0x34')](_0x46e308[_0x45d9('0x35')],_0x46e308[_0x45d9('0x32')]);_0x116bfb['attributes']=_[_0x45d9('0x34')](_0x46e308[_0x45d9('0x35')],qs[_0x45d9('0x36')](_0x2f87bb[_0x45d9('0x32')][_0x45d9('0x36')]));_0x116bfb[_0x45d9('0x37')]=_0x116bfb[_0x45d9('0x37')][_0x45d9('0x38')]?_0x116bfb[_0x45d9('0x37')]:_0x46e308['model'];if(!_0x2f87bb[_0x45d9('0x32')][_0x45d9('0x39')](_0x45d9('0x3a'))){_0x116bfb['limit']=qs[_0x45d9('0x3b')](_0x2f87bb[_0x45d9('0x32')]['limit']);_0x116bfb[_0x45d9('0x21')]=qs[_0x45d9('0x21')](_0x2f87bb[_0x45d9('0x32')][_0x45d9('0x21')]);}_0x116bfb['order']=qs['sort'](_0x2f87bb[_0x45d9('0x32')][_0x45d9('0x3c')]);_0x116bfb[_0x45d9('0x3d')]=qs[_0x45d9('0x33')](_[_0x45d9('0x3e')](_0x2f87bb[_0x45d9('0x32')],_0x46e308[_0x45d9('0x33')]),_0x5bd779);if(_0x2f87bb[_0x45d9('0x32')][_0x45d9('0x3f')]){_0x116bfb[_0x45d9('0x3d')]=_[_0x45d9('0x40')](_0x116bfb[_0x45d9('0x3d')],{'$or':_[_0x45d9('0x2e')](_0x5bd779,function(_0x527acf){if(_0x527acf[_0x45d9('0x41')]!==_0x45d9('0x42')){var _0x1ecc85={};_0x1ecc85[_0x527acf[_0x45d9('0x2b')]]={'$like':'%'+_0x2f87bb[_0x45d9('0x32')]['filter']+'%'};return _0x1ecc85;}})});}_0x116bfb=_[_0x45d9('0x40')]({},_0x116bfb,_0x2f87bb[_0x45d9('0x43')]);var _0x1f7f97={'where':_0x116bfb[_0x45d9('0x3d')]};return db[_0x45d9('0x2f')][_0x45d9('0x23')](_0x1f7f97)[_0x45d9('0x28')](function(_0x7d9d34){_0x4abdf2[_0x45d9('0x23')]=_0x7d9d34;if(_0x2f87bb[_0x45d9('0x32')]['includeAll']){_0x116bfb[_0x45d9('0x44')]=[{'all':!![]}];}return db[_0x45d9('0x2f')][_0x45d9('0x45')](_0x116bfb);})[_0x45d9('0x28')](function(_0x32239a){_0x4abdf2[_0x45d9('0x46')]=_0x32239a;return _0x4abdf2;})['then'](respondWithFilteredResult(_0x5abe80,_0x116bfb))[_0x45d9('0x47')](handleError(_0x5abe80,null));};exports['show']=function(_0x1aa4ba,_0x3cff71){var _0x5d989d={'raw':![],'where':{'id':_0x1aa4ba[_0x45d9('0x48')]['id']}},_0x17dbf2={};_0x17dbf2[_0x45d9('0x35')]=_[_0x45d9('0x49')](db[_0x45d9('0x2f')][_0x45d9('0x30')]);_0x17dbf2[_0x45d9('0x32')]=_['keys'](_0x1aa4ba['query']);_0x17dbf2[_0x45d9('0x33')]=_['intersection'](_0x17dbf2[_0x45d9('0x35')],_0x17dbf2['query']);_0x5d989d[_0x45d9('0x37')]=_[_0x45d9('0x34')](_0x17dbf2['model'],qs[_0x45d9('0x36')](_0x1aa4ba[_0x45d9('0x32')][_0x45d9('0x36')]));_0x5d989d[_0x45d9('0x37')]=_0x5d989d['attributes'][_0x45d9('0x38')]?_0x5d989d['attributes']:_0x17dbf2[_0x45d9('0x35')];if(_0x1aa4ba[_0x45d9('0x32')][_0x45d9('0x4a')]){_0x5d989d[_0x45d9('0x44')]=[{'all':!![]}];}_0x5d989d=_[_0x45d9('0x40')]({},_0x5d989d,_0x1aa4ba[_0x45d9('0x43')]);return db[_0x45d9('0x2f')]['find'](_0x5d989d)[_0x45d9('0x28')](handleEntityNotFound(_0x3cff71,null))[_0x45d9('0x28')](respondWithResult(_0x3cff71,null))[_0x45d9('0x47')](handleError(_0x3cff71,null));};exports[_0x45d9('0x4b')]=function(_0x5632b6,_0x23fc93){return db[_0x45d9('0x2f')][_0x45d9('0x4b')](_0x5632b6[_0x45d9('0x4c')],{})['then'](function(_0x5e86bc){var _0x5099b4=_0x5632b6[_0x45d9('0x4d')][_0x45d9('0x4e')]({'plain':!![]});if(!_0x5099b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5099b4[_0x45d9('0x4f')]===_0x45d9('0x4d')){var _0x4f3959=_0x5e86bc[_0x45d9('0x4e')]({'plain':!![]});var _0x5359e1=_0x45d9('0x50');return db[_0x45d9('0x51')][_0x45d9('0x52')]({'where':{'name':_0x5359e1,'userProfileId':_0x5099b4[_0x45d9('0x53')]},'raw':!![]})[_0x45d9('0x28')](function(_0x59faeb){if(_0x59faeb&&_0x59faeb[_0x45d9('0x54')]===0x0){return db[_0x45d9('0x55')][_0x45d9('0x4b')]({'name':_0x4f3959[_0x45d9('0x2b')],'resourceId':_0x4f3959['id'],'type':_0x59faeb['name'],'sectionId':_0x59faeb['id']},{})[_0x45d9('0x28')](function(){return _0x5e86bc;});}else{return _0x5e86bc;}})[_0x45d9('0x47')](function(_0x182782){logger[_0x45d9('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x182782);throw _0x182782;});}return _0x5e86bc;})['then'](respondWithResult(_0x23fc93,0xc9))[_0x45d9('0x47')](handleError(_0x23fc93,null));};exports[_0x45d9('0x56')]=function(_0x44bd6d,_0x407eb7){if(_0x44bd6d[_0x45d9('0x4c')]['id']){delete _0x44bd6d[_0x45d9('0x4c')]['id'];}return db[_0x45d9('0x2f')][_0x45d9('0x52')]({'where':{'id':_0x44bd6d[_0x45d9('0x48')]['id']}})['then'](handleEntityNotFound(_0x407eb7,null))[_0x45d9('0x28')](saveUpdates(_0x44bd6d[_0x45d9('0x4c')],null))[_0x45d9('0x28')](respondWithResult(_0x407eb7,null))[_0x45d9('0x47')](handleError(_0x407eb7,null));};exports[_0x45d9('0x57')]=function(_0x266514,_0x1414bc){var _0x25e270=_0x266514[_0x45d9('0x48')]['id'];var _0x2a3365=[];return db['sequelize'][_0x45d9('0x58')](function(_0x434fa8){var _0x14babc=_0x45d9('0x59')+_0x25e270;return db[_0x45d9('0x5a')][_0x45d9('0x32')](_0x14babc,{'type':db[_0x45d9('0x5b')][_0x45d9('0x5c')][_0x45d9('0x5d')],'raw':!![],'transaction':_0x434fa8})[_0x45d9('0x28')](function(_0x3b1426){_0x2a3365=_[_0x45d9('0x2e')](_0x3b1426,function(_0x575c8a){return Number(_0x575c8a['UserId']);});})[_0x45d9('0x28')](function(){var _0x5a2b85=_0x45d9('0x5e')+_0x25e270;return db[_0x45d9('0x5a')][_0x45d9('0x32')](_0x5a2b85,{'type':db[_0x45d9('0x5b')]['QueryTypes'][_0x45d9('0x5d')],'raw':!![],'transaction':_0x434fa8});})[_0x45d9('0x28')](function(_0x8bf8a8){var _0x2f98be=_['map'](_0x8bf8a8,function(_0x2faf23){return Number(_0x2faf23[_0x45d9('0x5f')]);});return db[_0x45d9('0x60')][_0x45d9('0x57')]({'where':{'UserId':{'$in':_0x2a3365},'VoiceQueueId':{'$in':_0x2f98be}},'transaction':_0x434fa8});})['then'](function(){var _0x5b973c=_0x45d9('0x61')+_0x25e270;return db['sequelize'][_0x45d9('0x32')](_0x5b973c,{'type':db['Sequelize'][_0x45d9('0x5c')][_0x45d9('0x5d')],'raw':!![],'transaction':_0x434fa8});})[_0x45d9('0x28')](function(_0x5e7142){var _0x5a52d1=_[_0x45d9('0x2e')](_0x5e7142,function(_0x17d650){return Number(_0x17d650['MailQueueId']);});return db[_0x45d9('0x62')]['destroy']({'where':{'UserId':{'$in':_0x2a3365},'MailQueueId':{'$in':_0x5a52d1}},'transaction':_0x434fa8});})[_0x45d9('0x28')](function(){var _0x5bb91a=_0x45d9('0x63')+_0x25e270;return db[_0x45d9('0x5a')][_0x45d9('0x32')](_0x5bb91a,{'type':db[_0x45d9('0x5b')][_0x45d9('0x5c')][_0x45d9('0x5d')],'raw':!![],'transaction':_0x434fa8});})[_0x45d9('0x28')](function(_0x55e195){var _0x361162=_[_0x45d9('0x2e')](_0x55e195,function(_0x5c0b49){return Number(_0x5c0b49['SmsQueueId']);});return db[_0x45d9('0x64')][_0x45d9('0x57')]({'where':{'UserId':{'$in':_0x2a3365},'SmsQueueId':{'$in':_0x361162}},'transaction':_0x434fa8});})[_0x45d9('0x28')](function(){var _0x2737de=_0x45d9('0x65')+_0x25e270;return db['sequelize'][_0x45d9('0x32')](_0x2737de,{'type':db['Sequelize'][_0x45d9('0x5c')][_0x45d9('0x5d')],'raw':!![],'transaction':_0x434fa8});})['then'](function(_0x1d0237){var _0x206d35=_[_0x45d9('0x2e')](_0x1d0237,function(_0x5b1a96){return Number(_0x5b1a96['ChatQueueId']);});return db[_0x45d9('0x66')][_0x45d9('0x57')]({'where':{'UserId':{'$in':_0x2a3365},'ChatQueueId':{'$in':_0x206d35}},'transaction':_0x434fa8});})[_0x45d9('0x28')](function(){var _0x184fda=_0x45d9('0x67')+_0x25e270;return db['sequelize'][_0x45d9('0x32')](_0x184fda,{'type':db[_0x45d9('0x5b')][_0x45d9('0x5c')][_0x45d9('0x5d')],'raw':!![],'transaction':_0x434fa8});})[_0x45d9('0x28')](function(_0xe92275){var _0x3b97e0=_[_0x45d9('0x2e')](_0xe92275,function(_0xfbc7d5){return Number(_0xfbc7d5[_0x45d9('0x68')]);});return db[_0x45d9('0x69')][_0x45d9('0x57')]({'where':{'UserId':{'$in':_0x2a3365},'FaxQueueId':{'$in':_0x3b97e0}},'transaction':_0x434fa8});})[_0x45d9('0x28')](function(){var _0x968e8d=_0x45d9('0x6a')+_0x25e270;return db[_0x45d9('0x5a')][_0x45d9('0x32')](_0x968e8d,{'type':db[_0x45d9('0x5b')][_0x45d9('0x5c')][_0x45d9('0x5d')],'raw':!![],'transaction':_0x434fa8});})[_0x45d9('0x28')](function(_0xd79b5f){var _0xb420d1=_[_0x45d9('0x2e')](_0xd79b5f,function(_0x4411b3){return Number(_0x4411b3[_0x45d9('0x6b')]);});return db['UserOpenchannelQueue'][_0x45d9('0x57')]({'where':{'UserId':{'$in':_0x2a3365},'OpenchannelQueueId':{'$in':_0xb420d1}},'transaction':_0x434fa8});})[_0x45d9('0x28')](function(){var _0x5c567b=_0x45d9('0x6c')+_0x25e270;return db[_0x45d9('0x5a')][_0x45d9('0x32')](_0x5c567b,{'type':db[_0x45d9('0x5b')]['QueryTypes'][_0x45d9('0x5d')],'raw':!![],'transaction':_0x434fa8});})[_0x45d9('0x28')](function(_0x1c4abc){var _0x55dbf3=_[_0x45d9('0x2e')](_0x1c4abc,function(_0x316545){return Number(_0x316545[_0x45d9('0x6d')]);});return db[_0x45d9('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x2a3365},'WhatsappQueueId':{'$in':_0x55dbf3}},'transaction':_0x434fa8});})[_0x45d9('0x28')](function(){return db[_0x45d9('0x6f')][_0x45d9('0x52')]({'where':{'TeamId':_0x25e270}});})[_0x45d9('0x28')](function(_0x30c4f4){if(_0x30c4f4===null){return;}return db[_0x45d9('0x70')][_0x45d9('0x57')]({'where':{'UserId':{'$in':_0x2a3365},'VoicePrefixId':_0x30c4f4['VoicePrefixId']},'transaction':_0x434fa8});})[_0x45d9('0x28')](function(){return db[_0x45d9('0x2f')][_0x45d9('0x57')]({'where':{'id':_0x25e270},'cascade':!![],'transaction':_0x434fa8});})[_0x45d9('0x28')](function(_0x375dad){if(_0x375dad===0x0){_0x1414bc['sendStatus'](0x194);}else{return db[_0x45d9('0x55')][_0x45d9('0x57')]({'where':{'type':'Teams','resourceId':_0x25e270},'cascade':!![],'transaction':_0x434fa8})[_0x45d9('0x28')](function(){_0x1414bc[_0x45d9('0x1e')](0xcc)['end']();});}})[_0x45d9('0x47')](function(_0x1aa660){_0x1414bc[_0x45d9('0x1e')](0x1f4)[_0x45d9('0x2c')](_0x1aa660);});});};exports[_0x45d9('0x71')]=function(_0x27e1b3,_0x267fbc,_0x2d2e6a){return db[_0x45d9('0x2f')][_0x45d9('0x72')]({'where':{'id':_0x27e1b3[_0x45d9('0x48')]['id']}})['then'](handleEntityNotFound(_0x267fbc,null))[_0x45d9('0x28')](function(_0xaf9288){if(!_0x27e1b3['query'][_0x45d9('0x73')]||!utils[_0x45d9('0x74')](_0x27e1b3[_0x45d9('0x32')]['channel'])){throw new db[(_0x45d9('0x5b'))][(_0x45d9('0x75'))](_0x45d9('0x76'));}var _0x423b11={};var _0x3bb758={};_0x3bb758[_0x45d9('0x35')]=_['keys'](db[_[_0x45d9('0x77')](_0x27e1b3[_0x45d9('0x32')]['channel'][_0x45d9('0x78')]())+_0x45d9('0x79')][_0x45d9('0x30')]);_0x3bb758[_0x45d9('0x32')]=_[_0x45d9('0x49')](_0x27e1b3[_0x45d9('0x32')]);_0x3bb758['filters']=_[_0x45d9('0x34')](_0x3bb758[_0x45d9('0x35')],_0x3bb758[_0x45d9('0x32')]);_0x423b11[_0x45d9('0x37')]=_[_0x45d9('0x34')](_0x3bb758[_0x45d9('0x35')],qs[_0x45d9('0x36')](_0x27e1b3[_0x45d9('0x32')][_0x45d9('0x36')]));_0x423b11[_0x45d9('0x37')]=_0x423b11['attributes'][_0x45d9('0x38')]?_0x423b11[_0x45d9('0x37')]:_0x3bb758[_0x45d9('0x35')];_0x423b11['limit']=qs[_0x45d9('0x3b')](_0x27e1b3[_0x45d9('0x32')]['limit']);_0x423b11[_0x45d9('0x21')]=qs[_0x45d9('0x21')](_0x27e1b3[_0x45d9('0x32')][_0x45d9('0x21')]);_0x423b11['order']=qs[_0x45d9('0x3c')](_0x27e1b3[_0x45d9('0x32')][_0x45d9('0x3c')]);_0x423b11['where']=qs['filters'](_[_0x45d9('0x3e')](_0x27e1b3['query'],_0x3bb758[_0x45d9('0x33')]));_0x423b11=_[_0x45d9('0x40')]({},_0x423b11,_0x27e1b3[_0x45d9('0x43')]);return _0xaf9288['get'+_['capitalize'](_0x27e1b3['query'][_0x45d9('0x73')][_0x45d9('0x78')]())+'Queues'](_0x423b11);})[_0x45d9('0x28')](respondWithResult(_0x267fbc,null))[_0x45d9('0x47')](handleError(_0x267fbc,null));};exports[_0x45d9('0x7a')]=function(_0x251dfe,_0x4e9b20,_0x53bce7){return db[_0x45d9('0x2f')]['findOne']({'where':{'id':_0x251dfe[_0x45d9('0x48')]['id']}})[_0x45d9('0x28')](function(_0x43e801){if(_0x43e801){if(!_0x251dfe[_0x45d9('0x4c')][_0x45d9('0x73')]||!utils['isValidChannel'](_0x251dfe[_0x45d9('0x4c')]['channel'])){throw new db[(_0x45d9('0x5b'))][(_0x45d9('0x75'))]('Unknown\x20channel');}return _0x43e801['add'+_['capitalize'](_0x251dfe[_0x45d9('0x4c')][_0x45d9('0x73')][_0x45d9('0x78')]())+_0x45d9('0x7b')](_0x251dfe[_0x45d9('0x4c')][_0x45d9('0x7c')]);}return null;})[_0x45d9('0x28')](handleEntityNotFound(_0x4e9b20,null))['then'](respondWithStatusCode(_0x4e9b20,null))[_0x45d9('0x47')](handleError(_0x4e9b20,null));};exports[_0x45d9('0x7d')]=function(_0x5ed3b1,_0x4933e4,_0x2001ae){return db['Team']['findOne']({'where':{'id':_0x5ed3b1[_0x45d9('0x48')]['id']}})[_0x45d9('0x28')](function(_0x4d2da6){if(_0x4d2da6){if(!_0x5ed3b1['query'][_0x45d9('0x73')]||!utils[_0x45d9('0x74')](_0x5ed3b1[_0x45d9('0x32')]['channel'])){throw new db[(_0x45d9('0x5b'))][(_0x45d9('0x75'))](_0x45d9('0x76'));}return _0x4d2da6['remove'+_[_0x45d9('0x77')](_0x5ed3b1[_0x45d9('0x32')][_0x45d9('0x73')]['toLowerCase']())+_0x45d9('0x7b')](_0x5ed3b1[_0x45d9('0x32')]['ids']);}return null;})['then'](handleEntityNotFound(_0x4933e4,null))[_0x45d9('0x28')](respondWithStatusCode(_0x4933e4,null))[_0x45d9('0x47')](handleError(_0x4933e4,null));};exports[_0x45d9('0x7e')]=function(_0x56502b,_0x16d377){var _0x1e0656=_[_0x45d9('0x7f')](_0x56502b[_0x45d9('0x4c')]['ids'])?_0x56502b[_0x45d9('0x4c')][_0x45d9('0x7c')]:[_0x56502b[_0x45d9('0x4c')][_0x45d9('0x7c')]];var _0x5946ad=_0x56502b[_0x45d9('0x48')]['id'];return db[_0x45d9('0x2f')][_0x45d9('0x52')]({'where':{'id':_0x5946ad}})[_0x45d9('0x28')](handleEntityNotFound(_0x16d377,null))[_0x45d9('0x28')](function(_0x29a32a){if(_0x29a32a){var _0x55cb39=[_0x45d9('0x80'),_0x45d9('0x81'),_0x45d9('0x82'),_0x45d9('0x83'),_0x45d9('0x84'),'Openchannel',_0x45d9('0x85')];return db[_0x45d9('0x5a')]['transaction'](function(_0x59c2cc){var _0x4903a7=_[_0x45d9('0x2e')](_0x55cb39,function(_0x3b10d2){var _0x120bec={'attributes':['id',_0x45d9('0x2b')]};if(_0x3b10d2===_0x45d9('0x80')){_0x120bec[_0x45d9('0x86')]={'attributes':[_0x45d9('0x87')]};}return _0x29a32a[_0x45d9('0x4e')+_0x3b10d2+'Queues'](_0x120bec)[_0x45d9('0x28')](function(_0x4134de){var _0x1d31d0=_[_0x45d9('0x2e')](_0x4134de,function(_0xcf12ad){var _0x213651=_[_0x45d9('0x2e')](_0x1e0656,function(_0x28b925){var _0x6ecdc1={'where':{'UserId':_0x28b925,[_0x3b10d2+_0x45d9('0x88')]:_0xcf12ad['id']},'transaction':_0x59c2cc};if(_0x3b10d2===_0x45d9('0x80')){_0x6ecdc1[_0x45d9('0x18')]={'penalty':_0xcf12ad[_0x45d9('0x89')][_0x45d9('0x87')]};}return db[_0x45d9('0x8a')+_0x3b10d2+_0x45d9('0x79')][_0x45d9('0x8b')](_0x6ecdc1)['then'](function(){socket[_0x45d9('0x8c')](_0x45d9('0x4d')+_0x3b10d2+'Queue:save',{'UserId':_0x28b925,[_0x3b10d2+'QueueId']:_0xcf12ad['id']});if(_0x3b10d2!==_0x45d9('0x80')){return;}return db['User']['findAll']({'where':{'id':_0x1e0656,'online':0x1},'attributes':['id',_0x45d9('0x2b'),'online',_0x45d9('0x8d'),_0x45d9('0x8e')],'raw':!![]})['then'](function(_0xaa9528){var _0x37ec09=_[_0x45d9('0x2e')](_0xaa9528,function(_0x113ab0){return db[_0x45d9('0x8f')][_0x45d9('0x90')]({'membername':_0x113ab0['name'],'UserId':_0x113ab0['id'],'queue_name':_0xcf12ad[_0x45d9('0x2b')],'VoiceQueueId':_0xcf12ad['id'],'interface':_[_0x45d9('0x91')](_0x113ab0[_0x45d9('0x8e')])?util[_0x45d9('0x92')](_0x45d9('0x93'),_0x113ab0[_0x45d9('0x2b')]):_0x113ab0['interface'],'paused':_0x113ab0['voicePause']||![],'penalty':_0xcf12ad['TeamVoiceQueue'][_0x45d9('0x87')]},{'transaction':_0x59c2cc});});return Promise['all'](_0x37ec09);});});});return Promise[_0x45d9('0x94')](_0x213651);});return Promise[_0x45d9('0x94')](_0x1d31d0);})[_0x45d9('0x28')](function(){return db[_0x45d9('0x6f')][_0x45d9('0x72')]({'where':{'teamId':_0x5946ad}})[_0x45d9('0x28')](function(_0x4f6f44){if(_0x4f6f44){var _0x66383b=_[_0x45d9('0x2e')](_0x1e0656,function(_0x17db65){db['UserVoicePrefix'][_0x45d9('0x90')]({'UserId':_0x17db65,'VoicePrefixId':_0x4f6f44['VoicePrefixId']});});return Promise[_0x45d9('0x94')](_0x66383b);}});});});return Promise[_0x45d9('0x94')](_0x4903a7)['then'](function(){return _0x29a32a['addAgents'](_0x1e0656,{'transaction':_0x59c2cc})[_0x45d9('0x95')](function(_0x402821){return _0x402821;});});});}})[_0x45d9('0x28')](respondWithResult(_0x16d377,null))[_0x45d9('0x47')](handleError(_0x16d377,null));};exports[_0x45d9('0x96')]=function(_0x1e638a,_0x59959b){var _0x516eca=_[_0x45d9('0x7f')](_0x1e638a[_0x45d9('0x32')][_0x45d9('0x7c')])?_0x1e638a[_0x45d9('0x32')][_0x45d9('0x7c')]:[_0x1e638a[_0x45d9('0x32')]['ids']];var _0x406af9=_0x1e638a[_0x45d9('0x48')]['id'];return db['Team'][_0x45d9('0x52')]({'where':{'id':_0x406af9}})[_0x45d9('0x28')](handleEntityNotFound(_0x59959b,null))['then'](function(_0x12e675){if(_0x12e675){var _0x53510d=[_0x45d9('0x80'),_0x45d9('0x81'),_0x45d9('0x82'),_0x45d9('0x83'),_0x45d9('0x84'),_0x45d9('0x97'),_0x45d9('0x85')];return db[_0x45d9('0x5a')]['transaction'](function(_0xcec81d){var _0x53327c=_['map'](_0x53510d,function(_0x5605e9){var _0x4f8bba={'attributes':['id',_0x45d9('0x2b')]};return _0x12e675[_0x45d9('0x4e')+_0x5605e9+_0x45d9('0x7b')](_0x4f8bba)[_0x45d9('0x28')](function(_0x17f6e8){var _0x3f2ac1=_['map'](_0x17f6e8,function(_0x31c08b){return _0x31c08b[_0x45d9('0x96')](_0x516eca,{'transaction':_0xcec81d})[_0x45d9('0x28')](function(){var _0x1affa9=_[_0x45d9('0x2e')](_0x516eca,function(_0x242a2e){socket[_0x45d9('0x8c')](_0x45d9('0x4d')+_0x5605e9+_0x45d9('0x98'),{'UserId':Number(_0x242a2e),[_0x5605e9+_0x45d9('0x88')]:_0x31c08b['id']});if(_0x5605e9!==_0x45d9('0x80')){return;}return db[_0x45d9('0x8f')][_0x45d9('0x57')]({'where':{'VoiceQueueId':_0x31c08b['id'],'UserId':_0x242a2e},'transaction':_0xcec81d});});return Promise[_0x45d9('0x94')](_0x1affa9);});});return Promise[_0x45d9('0x94')](_0x3f2ac1);});});return Promise['all'](_0x53327c)[_0x45d9('0x28')](function(){return _0x12e675[_0x45d9('0x96')](_0x516eca,{'transaction':_0xcec81d});})[_0x45d9('0x28')](function(){return db['TeamVoicePrefix'][_0x45d9('0x72')]({'where':{'teamId':_0x406af9}})['then'](function(_0x218cc3){if(_0x218cc3){var _0x485060=_[_0x45d9('0x2e')](_0x516eca,function(_0x1aeaa4){db['UserVoicePrefix'][_0x45d9('0x57')]({'where':{'UserId':_0x1aeaa4,'VoicePrefixId':_0x218cc3[_0x45d9('0x99')]}});});return Promise[_0x45d9('0x94')](_0x485060);}});});});}})[_0x45d9('0x28')](respondWithStatusCode(_0x59959b,null))[_0x45d9('0x47')](handleError(_0x59959b,null));};exports[_0x45d9('0x9a')]=function(_0x4bf12e,_0x5c0308,_0x5d0592){var _0x58b570={};var _0x1b5982={};var _0x2b0b98;var _0x41be24;return db[_0x45d9('0x2f')]['findOne']({'where':{'id':_0x4bf12e[_0x45d9('0x48')]['id']}})[_0x45d9('0x28')](handleEntityNotFound(_0x5c0308,null))['then'](function(_0x10f649){if(_0x10f649){_0x2b0b98=_0x10f649;_0x1b5982[_0x45d9('0x35')]=_[_0x45d9('0x49')](db[_0x45d9('0x8a')]['rawAttributes']);_0x1b5982['query']=_[_0x45d9('0x49')](_0x4bf12e[_0x45d9('0x32')]);_0x1b5982[_0x45d9('0x33')]=_['intersection'](_0x1b5982[_0x45d9('0x35')],_0x1b5982['query']);_0x58b570[_0x45d9('0x37')]=_['intersection'](_0x1b5982[_0x45d9('0x35')],qs['fields'](_0x4bf12e[_0x45d9('0x32')][_0x45d9('0x36')]));_0x58b570['attributes']=_0x58b570['attributes'][_0x45d9('0x38')]?_0x58b570[_0x45d9('0x37')]:_0x1b5982[_0x45d9('0x35')];_0x58b570['order']=qs[_0x45d9('0x3c')](_0x4bf12e['query']['sort']);_0x58b570[_0x45d9('0x3d')]=qs[_0x45d9('0x33')](_[_0x45d9('0x3e')](_0x4bf12e['query'],_0x1b5982[_0x45d9('0x33')]));if(_0x4bf12e[_0x45d9('0x32')]['filter']){_0x58b570[_0x45d9('0x3d')]=_[_0x45d9('0x40')](_0x58b570['where'],{'$or':_[_0x45d9('0x2e')](_0x58b570[_0x45d9('0x37')],function(_0x39b269){var _0x2a716f={};_0x2a716f[_0x39b269]={'$like':'%'+_0x4bf12e[_0x45d9('0x32')][_0x45d9('0x3f')]+'%'};return _0x2a716f;})});}_0x58b570=_[_0x45d9('0x40')]({},_0x58b570,_0x4bf12e[_0x45d9('0x43')]);return _0x2b0b98[_0x45d9('0x9a')](_0x58b570);}})['then'](function(_0x185607){if(_0x185607){_0x41be24=_0x185607['length'];if(!_0x4bf12e['query'][_0x45d9('0x39')](_0x45d9('0x3a'))){_0x58b570[_0x45d9('0x3b')]=qs[_0x45d9('0x3b')](_0x4bf12e['query'][_0x45d9('0x3b')]);_0x58b570[_0x45d9('0x21')]=qs[_0x45d9('0x21')](_0x4bf12e[_0x45d9('0x32')]['offset']);}return _0x2b0b98['getAgents'](_0x58b570);}})[_0x45d9('0x28')](function(_0x30197c){if(_0x30197c){return _0x30197c?{'count':_0x41be24,'rows':_0x30197c}:null;}})['then'](respondWithResult(_0x5c0308,null))[_0x45d9('0x47')](handleError(_0x5c0308,null));}; \ No newline at end of file +var _0x57f1=['rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','isValidChannel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Openchannel','through','QueueId','TeamVoiceQueue','penalty','findOrCreate','emit','Queue:save','User','online','interface','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','all','removeAgents','Mail','Whatsapp','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','Content-Range','save','update','then','stack','name','send','index','map','Team'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x57f1,0x10b));var _0x157f=function(_0x130e67,_0x4e5d41){_0x130e67=_0x130e67-0x0;var _0x3b9641=_0x57f1[_0x130e67];return _0x3b9641;};'use strict';var emlformat=require(_0x157f('0x0'));var rimraf=require(_0x157f('0x1'));var zipdir=require(_0x157f('0x2'));var jsonpatch=require(_0x157f('0x3'));var rp=require(_0x157f('0x4'));var moment=require(_0x157f('0x5'));var BPromise=require(_0x157f('0x6'));var Mustache=require(_0x157f('0x7'));var util=require('util');var path=require('path');var sox=require(_0x157f('0x8'));var csv=require('to-csv');var ejs=require(_0x157f('0x9'));var fs=require('fs');var fs_extra=require(_0x157f('0xa'));var _=require(_0x157f('0xb'));var squel=require(_0x157f('0xc'));var crypto=require(_0x157f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x157f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x157f('0xf'));var Papa=require(_0x157f('0x10'));var Redis=require(_0x157f('0x11'));var authService=require(_0x157f('0x12'));var qs=require(_0x157f('0x13'));var as=require(_0x157f('0x14'));var hardwareService=require(_0x157f('0x15'));var logger=require(_0x157f('0x16'))(_0x157f('0x17'));var utils=require(_0x157f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x157f('0x19'));var db=require(_0x157f('0x1a'))['db'];config['redis']=_[_0x157f('0x1b')](config[_0x157f('0x1c')],{'host':_0x157f('0x1d'),'port':0x18eb});var socket=require(_0x157f('0x1e'))(new Redis(config['redis']));require('./team.socket')[_0x157f('0x1f')](socket);function respondWithStatusCode(_0x298651,_0x1c235f){_0x1c235f=_0x1c235f||0xcc;return function(_0x415fbb){if(_0x415fbb){return _0x298651[_0x157f('0x20')](_0x1c235f);}return _0x298651[_0x157f('0x21')](_0x1c235f)[_0x157f('0x22')]();};}function respondWithResult(_0x4ebd90,_0x2a6d5d){_0x2a6d5d=_0x2a6d5d||0xc8;return function(_0x4124a0){if(_0x4124a0){return _0x4ebd90[_0x157f('0x21')](_0x2a6d5d)[_0x157f('0x23')](_0x4124a0);}};}function respondWithFilteredResult(_0x324ef0,_0x441eee){return function(_0x473cc5){if(_0x473cc5){var _0x1ec4d4=typeof _0x441eee[_0x157f('0x24')]==='undefined'&&typeof _0x441eee[_0x157f('0x25')]==='undefined';var _0x20ca5a=_0x473cc5[_0x157f('0x26')];var _0x1e169c=_0x1ec4d4?0x0:_0x441eee[_0x157f('0x24')];var _0x4c2c59=_0x1ec4d4?_0x473cc5[_0x157f('0x26')]:_0x441eee[_0x157f('0x24')]+_0x441eee[_0x157f('0x25')];var _0xd6d8d6;if(_0x4c2c59>=_0x20ca5a){_0x4c2c59=_0x20ca5a;_0xd6d8d6=0xc8;}else{_0xd6d8d6=0xce;}_0x324ef0['status'](_0xd6d8d6);return _0x324ef0['set'](_0x157f('0x27'),_0x1e169c+'-'+_0x4c2c59+'/'+_0x20ca5a)[_0x157f('0x23')](_0x473cc5);}return null;};}function patchUpdates(_0x4da1f7){return function(_0xf2733b){try{jsonpatch['apply'](_0xf2733b,_0x4da1f7,!![]);}catch(_0x1799fb){return BPromise['reject'](_0x1799fb);}return _0xf2733b[_0x157f('0x28')]();};}function saveUpdates(_0x34c58a,_0x33ecb3){return function(_0x3fbf59){if(_0x3fbf59){return _0x3fbf59[_0x157f('0x29')](_0x34c58a)[_0x157f('0x2a')](function(_0x52bb5f){return _0x52bb5f;});}return null;};}function handleEntityNotFound(_0x2d4215,_0x2eb246){return function(_0x24465f){if(!_0x24465f){_0x2d4215[_0x157f('0x20')](0x194);}return _0x24465f;};}function handleError(_0x2bd5e4,_0x7d2d38){_0x7d2d38=_0x7d2d38||0x1f4;return function(_0x195264){logger['error'](_0x195264[_0x157f('0x2b')]);if(_0x195264[_0x157f('0x2c')]){delete _0x195264['name'];}_0x2bd5e4[_0x157f('0x21')](_0x7d2d38)[_0x157f('0x2d')](_0x195264);};}exports[_0x157f('0x2e')]=function(_0x5832ee,_0x30f9f2){var _0x5af6fa={},_0x3296b9={},_0x20deb5={'count':0x0,'rows':[]};var _0x5734df=_[_0x157f('0x2f')](db[_0x157f('0x30')][_0x157f('0x31')],function(_0x5b2202){return{'name':_0x5b2202[_0x157f('0x32')],'type':_0x5b2202[_0x157f('0x33')][_0x157f('0x34')]};});_0x3296b9['model']=_[_0x157f('0x2f')](_0x5734df,_0x157f('0x2c'));_0x3296b9[_0x157f('0x35')]=_[_0x157f('0x36')](_0x5832ee[_0x157f('0x35')]);_0x3296b9[_0x157f('0x37')]=_[_0x157f('0x38')](_0x3296b9[_0x157f('0x39')],_0x3296b9['query']);_0x5af6fa[_0x157f('0x3a')]=_[_0x157f('0x38')](_0x3296b9[_0x157f('0x39')],qs[_0x157f('0x3b')](_0x5832ee['query'][_0x157f('0x3b')]));_0x5af6fa[_0x157f('0x3a')]=_0x5af6fa[_0x157f('0x3a')][_0x157f('0x3c')]?_0x5af6fa[_0x157f('0x3a')]:_0x3296b9[_0x157f('0x39')];if(!_0x5832ee[_0x157f('0x35')][_0x157f('0x3d')](_0x157f('0x3e'))){_0x5af6fa[_0x157f('0x25')]=qs[_0x157f('0x25')](_0x5832ee['query'][_0x157f('0x25')]);_0x5af6fa[_0x157f('0x24')]=qs[_0x157f('0x24')](_0x5832ee[_0x157f('0x35')][_0x157f('0x24')]);}_0x5af6fa[_0x157f('0x3f')]=qs[_0x157f('0x40')](_0x5832ee['query'][_0x157f('0x40')]);_0x5af6fa[_0x157f('0x41')]=qs[_0x157f('0x37')](_[_0x157f('0x42')](_0x5832ee[_0x157f('0x35')],_0x3296b9['filters']),_0x5734df);if(_0x5832ee[_0x157f('0x35')][_0x157f('0x43')]){_0x5af6fa[_0x157f('0x41')]=_[_0x157f('0x44')](_0x5af6fa[_0x157f('0x41')],{'$or':_[_0x157f('0x2f')](_0x5734df,function(_0x2c80c0){if(_0x2c80c0['type']!==_0x157f('0x45')){var _0x4b4520={};_0x4b4520[_0x2c80c0['name']]={'$like':'%'+_0x5832ee['query'][_0x157f('0x43')]+'%'};return _0x4b4520;}})});}_0x5af6fa=_[_0x157f('0x44')]({},_0x5af6fa,_0x5832ee['options']);var _0x28e9e4={'where':_0x5af6fa[_0x157f('0x41')]};return db[_0x157f('0x30')]['count'](_0x28e9e4)[_0x157f('0x2a')](function(_0x3d72e0){_0x20deb5[_0x157f('0x26')]=_0x3d72e0;if(_0x5832ee[_0x157f('0x35')][_0x157f('0x46')]){_0x5af6fa[_0x157f('0x47')]=[{'all':!![]}];}return db[_0x157f('0x30')][_0x157f('0x48')](_0x5af6fa);})[_0x157f('0x2a')](function(_0x62f48a){_0x20deb5[_0x157f('0x49')]=_0x62f48a;return _0x20deb5;})[_0x157f('0x2a')](respondWithFilteredResult(_0x30f9f2,_0x5af6fa))[_0x157f('0x4a')](handleError(_0x30f9f2,null));};exports['show']=function(_0x1ec264,_0x1c0901){var _0xb7b89b={'raw':![],'where':{'id':_0x1ec264[_0x157f('0x4b')]['id']}},_0x2c2b1a={};_0x2c2b1a['model']=_[_0x157f('0x36')](db['Team'][_0x157f('0x31')]);_0x2c2b1a[_0x157f('0x35')]=_[_0x157f('0x36')](_0x1ec264['query']);_0x2c2b1a[_0x157f('0x37')]=_[_0x157f('0x38')](_0x2c2b1a[_0x157f('0x39')],_0x2c2b1a[_0x157f('0x35')]);_0xb7b89b['attributes']=_['intersection'](_0x2c2b1a['model'],qs['fields'](_0x1ec264[_0x157f('0x35')][_0x157f('0x3b')]));_0xb7b89b[_0x157f('0x3a')]=_0xb7b89b[_0x157f('0x3a')]['length']?_0xb7b89b['attributes']:_0x2c2b1a[_0x157f('0x39')];if(_0x1ec264[_0x157f('0x35')][_0x157f('0x46')]){_0xb7b89b['include']=[{'all':!![]}];}_0xb7b89b=_[_0x157f('0x44')]({},_0xb7b89b,_0x1ec264[_0x157f('0x4c')]);return db[_0x157f('0x30')][_0x157f('0x4d')](_0xb7b89b)[_0x157f('0x2a')](handleEntityNotFound(_0x1c0901,null))[_0x157f('0x2a')](respondWithResult(_0x1c0901,null))[_0x157f('0x4a')](handleError(_0x1c0901,null));};exports[_0x157f('0x4e')]=function(_0x2f0ae4,_0x18a75c){return db[_0x157f('0x30')]['create'](_0x2f0ae4[_0x157f('0x4f')],{})[_0x157f('0x2a')](function(_0x6649af){var _0x25a82=_0x2f0ae4[_0x157f('0x50')]['get']({'plain':!![]});if(!_0x25a82)throw new Error(_0x157f('0x51'));if(_0x25a82['role']==='user'){var _0xc34c6f=_0x6649af[_0x157f('0x52')]({'plain':!![]});var _0x23f87c='Teams';return db[_0x157f('0x53')]['find']({'where':{'name':_0x23f87c,'userProfileId':_0x25a82['userProfileId']},'raw':!![]})[_0x157f('0x2a')](function(_0x17141d){if(_0x17141d&&_0x17141d['autoAssociation']===0x0){return db['UserProfileResource'][_0x157f('0x4e')]({'name':_0xc34c6f['name'],'resourceId':_0xc34c6f['id'],'type':_0x17141d[_0x157f('0x2c')],'sectionId':_0x17141d['id']},{})['then'](function(){return _0x6649af;});}else{return _0x6649af;}})[_0x157f('0x4a')](function(_0x2ffcda){logger[_0x157f('0x54')](_0x157f('0x55'),_0x2ffcda);throw _0x2ffcda;});}return _0x6649af;})[_0x157f('0x2a')](respondWithResult(_0x18a75c,0xc9))['catch'](handleError(_0x18a75c,null));};exports[_0x157f('0x29')]=function(_0x492f15,_0x18bef9){if(_0x492f15[_0x157f('0x4f')]['id']){delete _0x492f15[_0x157f('0x4f')]['id'];}return db['Team']['find']({'where':{'id':_0x492f15['params']['id']}})[_0x157f('0x2a')](handleEntityNotFound(_0x18bef9,null))['then'](saveUpdates(_0x492f15[_0x157f('0x4f')],null))[_0x157f('0x2a')](respondWithResult(_0x18bef9,null))['catch'](handleError(_0x18bef9,null));};exports[_0x157f('0x56')]=function(_0x58953c,_0x9b3d7f){var _0x30c147=_0x58953c[_0x157f('0x4b')]['id'];var _0x4bbfa7=[];return db[_0x157f('0x57')][_0x157f('0x58')](function(_0x118cdd){var _0x3644b8=_0x157f('0x59')+_0x30c147;return db[_0x157f('0x57')][_0x157f('0x35')](_0x3644b8,{'type':db[_0x157f('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x118cdd})[_0x157f('0x2a')](function(_0x1e8f5a){_0x4bbfa7=_[_0x157f('0x2f')](_0x1e8f5a,function(_0x4de6f3){return Number(_0x4de6f3[_0x157f('0x5b')]);});})['then'](function(){var _0x2272a3=_0x157f('0x5c')+_0x30c147;return db[_0x157f('0x57')][_0x157f('0x35')](_0x2272a3,{'type':db[_0x157f('0x5a')][_0x157f('0x5d')][_0x157f('0x5e')],'raw':!![],'transaction':_0x118cdd});})[_0x157f('0x2a')](function(_0x180327){var _0x34eaba=_['map'](_0x180327,function(_0x562121){return Number(_0x562121['VoiceQueueId']);});return db[_0x157f('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x4bbfa7},'VoiceQueueId':{'$in':_0x34eaba}},'transaction':_0x118cdd});})[_0x157f('0x2a')](function(){var _0x4c10a8=_0x157f('0x60')+_0x30c147;return db['sequelize'][_0x157f('0x35')](_0x4c10a8,{'type':db[_0x157f('0x5a')][_0x157f('0x5d')][_0x157f('0x5e')],'raw':!![],'transaction':_0x118cdd});})[_0x157f('0x2a')](function(_0x3361bb){var _0x16a88a=_[_0x157f('0x2f')](_0x3361bb,function(_0xcf3e1e){return Number(_0xcf3e1e[_0x157f('0x61')]);});return db[_0x157f('0x62')][_0x157f('0x56')]({'where':{'UserId':{'$in':_0x4bbfa7},'MailQueueId':{'$in':_0x16a88a}},'transaction':_0x118cdd});})[_0x157f('0x2a')](function(){var _0x3ac68d=_0x157f('0x63')+_0x30c147;return db[_0x157f('0x57')][_0x157f('0x35')](_0x3ac68d,{'type':db[_0x157f('0x5a')][_0x157f('0x5d')][_0x157f('0x5e')],'raw':!![],'transaction':_0x118cdd});})[_0x157f('0x2a')](function(_0x4dfbd7){var _0x3d7daa=_[_0x157f('0x2f')](_0x4dfbd7,function(_0x5f4976){return Number(_0x5f4976[_0x157f('0x64')]);});return db[_0x157f('0x65')][_0x157f('0x56')]({'where':{'UserId':{'$in':_0x4bbfa7},'SmsQueueId':{'$in':_0x3d7daa}},'transaction':_0x118cdd});})[_0x157f('0x2a')](function(){var _0x479ae8=_0x157f('0x66')+_0x30c147;return db[_0x157f('0x57')]['query'](_0x479ae8,{'type':db['Sequelize'][_0x157f('0x5d')]['SELECT'],'raw':!![],'transaction':_0x118cdd});})[_0x157f('0x2a')](function(_0x12725c){var _0x519a58=_[_0x157f('0x2f')](_0x12725c,function(_0x2dad2d){return Number(_0x2dad2d[_0x157f('0x67')]);});return db[_0x157f('0x68')]['destroy']({'where':{'UserId':{'$in':_0x4bbfa7},'ChatQueueId':{'$in':_0x519a58}},'transaction':_0x118cdd});})[_0x157f('0x2a')](function(){var _0x54347c=_0x157f('0x69')+_0x30c147;return db[_0x157f('0x57')][_0x157f('0x35')](_0x54347c,{'type':db[_0x157f('0x5a')]['QueryTypes'][_0x157f('0x5e')],'raw':!![],'transaction':_0x118cdd});})[_0x157f('0x2a')](function(_0x443b5c){var _0x5d4a8c=_[_0x157f('0x2f')](_0x443b5c,function(_0x19f7db){return Number(_0x19f7db[_0x157f('0x6a')]);});return db[_0x157f('0x6b')][_0x157f('0x56')]({'where':{'UserId':{'$in':_0x4bbfa7},'FaxQueueId':{'$in':_0x5d4a8c}},'transaction':_0x118cdd});})['then'](function(){var _0x3c500d=_0x157f('0x6c')+_0x30c147;return db[_0x157f('0x57')][_0x157f('0x35')](_0x3c500d,{'type':db[_0x157f('0x5a')]['QueryTypes'][_0x157f('0x5e')],'raw':!![],'transaction':_0x118cdd});})[_0x157f('0x2a')](function(_0x371c63){var _0x30d8da=_[_0x157f('0x2f')](_0x371c63,function(_0x465dbc){return Number(_0x465dbc[_0x157f('0x6d')]);});return db[_0x157f('0x6e')][_0x157f('0x56')]({'where':{'UserId':{'$in':_0x4bbfa7},'OpenchannelQueueId':{'$in':_0x30d8da}},'transaction':_0x118cdd});})[_0x157f('0x2a')](function(){var _0x4f0976='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x30c147;return db[_0x157f('0x57')][_0x157f('0x35')](_0x4f0976,{'type':db[_0x157f('0x5a')][_0x157f('0x5d')][_0x157f('0x5e')],'raw':!![],'transaction':_0x118cdd});})['then'](function(_0xe12764){var _0x4762d3=_['map'](_0xe12764,function(_0x4eaac0){return Number(_0x4eaac0[_0x157f('0x6f')]);});return db['UserWhatsappQueue'][_0x157f('0x56')]({'where':{'UserId':{'$in':_0x4bbfa7},'WhatsappQueueId':{'$in':_0x4762d3}},'transaction':_0x118cdd});})['then'](function(){return db[_0x157f('0x70')]['find']({'where':{'TeamId':_0x30c147}});})[_0x157f('0x2a')](function(_0x4f8da4){if(_0x4f8da4===null){return;}return db[_0x157f('0x71')][_0x157f('0x56')]({'where':{'UserId':{'$in':_0x4bbfa7},'VoicePrefixId':_0x4f8da4[_0x157f('0x72')]},'transaction':_0x118cdd});})[_0x157f('0x2a')](function(){return db[_0x157f('0x30')][_0x157f('0x56')]({'where':{'id':_0x30c147},'cascade':!![],'transaction':_0x118cdd});})[_0x157f('0x2a')](function(_0x23b260){if(_0x23b260===0x0){_0x9b3d7f[_0x157f('0x20')](0x194);}else{return db[_0x157f('0x73')][_0x157f('0x56')]({'where':{'type':'Teams','resourceId':_0x30c147},'cascade':!![],'transaction':_0x118cdd})['then'](function(){_0x9b3d7f[_0x157f('0x21')](0xcc)[_0x157f('0x22')]();});}})['catch'](function(_0x1a4ea0){_0x9b3d7f[_0x157f('0x21')](0x1f4)[_0x157f('0x2d')](_0x1a4ea0);});});};exports[_0x157f('0x74')]=function(_0x43f550,_0x3d9250,_0x66fcb){return db['Team'][_0x157f('0x75')]({'where':{'id':_0x43f550[_0x157f('0x4b')]['id']}})[_0x157f('0x2a')](handleEntityNotFound(_0x3d9250,null))[_0x157f('0x2a')](function(_0x5f4774){if(!_0x43f550['query'][_0x157f('0x76')]||!utils['isValidChannel'](_0x43f550['query'][_0x157f('0x76')])){throw new db[(_0x157f('0x5a'))][(_0x157f('0x77'))](_0x157f('0x78'));}var _0x259ccb={};var _0x56c2cb={};_0x56c2cb[_0x157f('0x39')]=_[_0x157f('0x36')](db[_[_0x157f('0x79')](_0x43f550[_0x157f('0x35')][_0x157f('0x76')][_0x157f('0x7a')]())+_0x157f('0x7b')]['rawAttributes']);_0x56c2cb[_0x157f('0x35')]=_[_0x157f('0x36')](_0x43f550[_0x157f('0x35')]);_0x56c2cb['filters']=_[_0x157f('0x38')](_0x56c2cb[_0x157f('0x39')],_0x56c2cb[_0x157f('0x35')]);_0x259ccb[_0x157f('0x3a')]=_[_0x157f('0x38')](_0x56c2cb[_0x157f('0x39')],qs[_0x157f('0x3b')](_0x43f550[_0x157f('0x35')][_0x157f('0x3b')]));_0x259ccb['attributes']=_0x259ccb[_0x157f('0x3a')][_0x157f('0x3c')]?_0x259ccb[_0x157f('0x3a')]:_0x56c2cb[_0x157f('0x39')];_0x259ccb[_0x157f('0x25')]=qs['limit'](_0x43f550[_0x157f('0x35')][_0x157f('0x25')]);_0x259ccb[_0x157f('0x24')]=qs[_0x157f('0x24')](_0x43f550[_0x157f('0x35')][_0x157f('0x24')]);_0x259ccb['order']=qs[_0x157f('0x40')](_0x43f550[_0x157f('0x35')][_0x157f('0x40')]);_0x259ccb[_0x157f('0x41')]=qs[_0x157f('0x37')](_[_0x157f('0x42')](_0x43f550[_0x157f('0x35')],_0x56c2cb[_0x157f('0x37')]));_0x259ccb=_['merge']({},_0x259ccb,_0x43f550[_0x157f('0x4c')]);return _0x5f4774[_0x157f('0x52')+_[_0x157f('0x79')](_0x43f550[_0x157f('0x35')][_0x157f('0x76')]['toLowerCase']())+_0x157f('0x7c')](_0x259ccb);})[_0x157f('0x2a')](respondWithResult(_0x3d9250,null))[_0x157f('0x4a')](handleError(_0x3d9250,null));};exports['addQueues']=function(_0xd58f76,_0x5bd873,_0x555b89){return db[_0x157f('0x30')][_0x157f('0x75')]({'where':{'id':_0xd58f76['params']['id']}})[_0x157f('0x2a')](function(_0x47c02c){if(_0x47c02c){if(!_0xd58f76[_0x157f('0x4f')][_0x157f('0x76')]||!utils[_0x157f('0x7d')](_0xd58f76['body'][_0x157f('0x76')])){throw new db[(_0x157f('0x5a'))][(_0x157f('0x77'))]('Unknown\x20channel');}return _0x47c02c[_0x157f('0x7e')+_[_0x157f('0x79')](_0xd58f76['body'][_0x157f('0x76')][_0x157f('0x7a')]())+_0x157f('0x7c')](_0xd58f76[_0x157f('0x4f')][_0x157f('0x7f')]);}return null;})['then'](handleEntityNotFound(_0x5bd873,null))['then'](respondWithStatusCode(_0x5bd873,null))[_0x157f('0x4a')](handleError(_0x5bd873,null));};exports[_0x157f('0x80')]=function(_0x1dc808,_0x30952f,_0x100046){return db[_0x157f('0x30')][_0x157f('0x75')]({'where':{'id':_0x1dc808[_0x157f('0x4b')]['id']}})[_0x157f('0x2a')](function(_0x38ab13){if(_0x38ab13){if(!_0x1dc808[_0x157f('0x35')][_0x157f('0x76')]||!utils[_0x157f('0x7d')](_0x1dc808[_0x157f('0x35')]['channel'])){throw new db[(_0x157f('0x5a'))]['ValidationError'](_0x157f('0x78'));}return _0x38ab13[_0x157f('0x81')+_[_0x157f('0x79')](_0x1dc808[_0x157f('0x35')][_0x157f('0x76')][_0x157f('0x7a')]())+'Queues'](_0x1dc808[_0x157f('0x35')][_0x157f('0x7f')]);}return null;})[_0x157f('0x2a')](handleEntityNotFound(_0x30952f,null))[_0x157f('0x2a')](respondWithStatusCode(_0x30952f,null))['catch'](handleError(_0x30952f,null));};exports[_0x157f('0x82')]=function(_0xd34768,_0x37c84c){var _0x173089=_[_0x157f('0x83')](_0xd34768[_0x157f('0x4f')][_0x157f('0x7f')])?_0xd34768[_0x157f('0x4f')]['ids']:[_0xd34768[_0x157f('0x4f')]['ids']];var _0xb84045=_0xd34768[_0x157f('0x4b')]['id'];return db[_0x157f('0x30')][_0x157f('0x4d')]({'where':{'id':_0xb84045}})[_0x157f('0x2a')](handleEntityNotFound(_0x37c84c,null))[_0x157f('0x2a')](function(_0xd2f5da){if(_0xd2f5da){var _0x19ff80=[_0x157f('0x84'),_0x157f('0x85'),'Mail',_0x157f('0x86'),_0x157f('0x87'),_0x157f('0x88'),'Whatsapp'];return db[_0x157f('0x57')][_0x157f('0x58')](function(_0x34665e){var _0x2c7833=_['map'](_0x19ff80,function(_0x44a5d3){var _0x483e96={'attributes':['id',_0x157f('0x2c')]};if(_0x44a5d3===_0x157f('0x84')){_0x483e96[_0x157f('0x89')]={'attributes':['penalty']};}return _0xd2f5da[_0x157f('0x52')+_0x44a5d3+'Queues'](_0x483e96)[_0x157f('0x2a')](function(_0xb8a8c9){var _0x3b3a30=_[_0x157f('0x2f')](_0xb8a8c9,function(_0x43d8fa){var _0x1acba1=_[_0x157f('0x2f')](_0x173089,function(_0xb1ab8f){var _0x2ae651={'where':{'UserId':_0xb1ab8f,[_0x44a5d3+_0x157f('0x8a')]:_0x43d8fa['id']},'transaction':_0x34665e};if(_0x44a5d3==='Voice'){_0x2ae651[_0x157f('0x1b')]={'penalty':_0x43d8fa[_0x157f('0x8b')][_0x157f('0x8c')]};}return db['User'+_0x44a5d3+_0x157f('0x7b')][_0x157f('0x8d')](_0x2ae651)[_0x157f('0x2a')](function(){socket[_0x157f('0x8e')](_0x157f('0x50')+_0x44a5d3+_0x157f('0x8f'),{'UserId':_0xb1ab8f,[_0x44a5d3+_0x157f('0x8a')]:_0x43d8fa['id']});if(_0x44a5d3!==_0x157f('0x84')){return;}return db[_0x157f('0x90')][_0x157f('0x48')]({'where':{'id':_0x173089,'online':0x1},'attributes':['id','name',_0x157f('0x91'),'voicePause',_0x157f('0x92')],'raw':!![]})[_0x157f('0x2a')](function(_0x16e0df){var _0x30eb24=_['map'](_0x16e0df,function(_0x23cd48){return db[_0x157f('0x93')][_0x157f('0x94')]({'membername':_0x23cd48[_0x157f('0x2c')],'UserId':_0x23cd48['id'],'queue_name':_0x43d8fa['name'],'VoiceQueueId':_0x43d8fa['id'],'interface':_['isNil'](_0x23cd48[_0x157f('0x92')])?util[_0x157f('0x95')](_0x157f('0x96'),_0x23cd48['name']):_0x23cd48[_0x157f('0x92')],'paused':_0x23cd48[_0x157f('0x97')]||![],'penalty':_0x43d8fa[_0x157f('0x8b')][_0x157f('0x8c')]},{'transaction':_0x34665e});});return Promise[_0x157f('0x98')](_0x30eb24);});});});return Promise['all'](_0x1acba1);});return Promise[_0x157f('0x98')](_0x3b3a30);})[_0x157f('0x2a')](function(){return db['TeamVoicePrefix'][_0x157f('0x75')]({'where':{'teamId':_0xb84045}})[_0x157f('0x2a')](function(_0x190ffa){if(_0x190ffa){var _0x326020=_[_0x157f('0x2f')](_0x173089,function(_0x4085ba){db[_0x157f('0x71')][_0x157f('0x94')]({'UserId':_0x4085ba,'VoicePrefixId':_0x190ffa[_0x157f('0x72')]});});return Promise[_0x157f('0x98')](_0x326020);}});});});return Promise['all'](_0x2c7833)['then'](function(){return _0xd2f5da[_0x157f('0x82')](_0x173089,{'transaction':_0x34665e})['spread'](function(_0x12d510){return _0x12d510;});});});}})[_0x157f('0x2a')](respondWithResult(_0x37c84c,null))[_0x157f('0x4a')](handleError(_0x37c84c,null));};exports[_0x157f('0x99')]=function(_0x28cd13,_0xb0d320){var _0xe38ce4=_[_0x157f('0x83')](_0x28cd13[_0x157f('0x35')][_0x157f('0x7f')])?_0x28cd13[_0x157f('0x35')]['ids']:[_0x28cd13[_0x157f('0x35')][_0x157f('0x7f')]];var _0x32a99a=_0x28cd13['params']['id'];return db[_0x157f('0x30')][_0x157f('0x4d')]({'where':{'id':_0x32a99a}})['then'](handleEntityNotFound(_0xb0d320,null))[_0x157f('0x2a')](function(_0x334e9b){if(_0x334e9b){var _0x4c4530=['Voice',_0x157f('0x85'),_0x157f('0x9a'),_0x157f('0x86'),'Fax',_0x157f('0x88'),_0x157f('0x9b')];return db[_0x157f('0x57')]['transaction'](function(_0x324925){var _0x28f46d=_[_0x157f('0x2f')](_0x4c4530,function(_0x55e832){var _0x7cbad2={'attributes':['id',_0x157f('0x2c')]};return _0x334e9b[_0x157f('0x52')+_0x55e832+_0x157f('0x7c')](_0x7cbad2)[_0x157f('0x2a')](function(_0x18abfa){var _0x20f6a2=_[_0x157f('0x2f')](_0x18abfa,function(_0x208f16){return _0x208f16[_0x157f('0x99')](_0xe38ce4,{'transaction':_0x324925})[_0x157f('0x2a')](function(){var _0x14268f=_['map'](_0xe38ce4,function(_0x3e2b0e){socket[_0x157f('0x8e')](_0x157f('0x50')+_0x55e832+_0x157f('0x9c'),{'UserId':Number(_0x3e2b0e),[_0x55e832+_0x157f('0x8a')]:_0x208f16['id']});if(_0x55e832!==_0x157f('0x84')){return;}return db[_0x157f('0x93')][_0x157f('0x56')]({'where':{'VoiceQueueId':_0x208f16['id'],'UserId':_0x3e2b0e},'transaction':_0x324925});});return Promise['all'](_0x14268f);});});return Promise['all'](_0x20f6a2);});});return Promise[_0x157f('0x98')](_0x28f46d)[_0x157f('0x2a')](function(){return _0x334e9b[_0x157f('0x99')](_0xe38ce4,{'transaction':_0x324925});})[_0x157f('0x2a')](function(){return db[_0x157f('0x70')][_0x157f('0x75')]({'where':{'teamId':_0x32a99a}})[_0x157f('0x2a')](function(_0x4b20aa){if(_0x4b20aa){var _0x207ab8=_[_0x157f('0x2f')](_0xe38ce4,function(_0xa3bd56){db[_0x157f('0x71')][_0x157f('0x56')]({'where':{'UserId':_0xa3bd56,'VoicePrefixId':_0x4b20aa[_0x157f('0x72')]}});});return Promise['all'](_0x207ab8);}});});});}})['then'](respondWithStatusCode(_0xb0d320,null))[_0x157f('0x4a')](handleError(_0xb0d320,null));};exports[_0x157f('0x9d')]=function(_0x2f4ca0,_0x3756e2,_0x1b151b){var _0xa8062a={};var _0x328a06={};var _0x10bddd;var _0xdf0ed7;return db[_0x157f('0x30')][_0x157f('0x75')]({'where':{'id':_0x2f4ca0[_0x157f('0x4b')]['id']}})[_0x157f('0x2a')](handleEntityNotFound(_0x3756e2,null))[_0x157f('0x2a')](function(_0x31ad4d){if(_0x31ad4d){_0x10bddd=_0x31ad4d;_0x328a06[_0x157f('0x39')]=_[_0x157f('0x36')](db[_0x157f('0x90')][_0x157f('0x31')]);_0x328a06[_0x157f('0x35')]=_[_0x157f('0x36')](_0x2f4ca0[_0x157f('0x35')]);_0x328a06[_0x157f('0x37')]=_[_0x157f('0x38')](_0x328a06[_0x157f('0x39')],_0x328a06[_0x157f('0x35')]);_0xa8062a[_0x157f('0x3a')]=_[_0x157f('0x38')](_0x328a06[_0x157f('0x39')],qs['fields'](_0x2f4ca0[_0x157f('0x35')][_0x157f('0x3b')]));_0xa8062a['attributes']=_0xa8062a[_0x157f('0x3a')]['length']?_0xa8062a[_0x157f('0x3a')]:_0x328a06[_0x157f('0x39')];_0xa8062a['order']=qs[_0x157f('0x40')](_0x2f4ca0[_0x157f('0x35')][_0x157f('0x40')]);_0xa8062a[_0x157f('0x41')]=qs['filters'](_[_0x157f('0x42')](_0x2f4ca0[_0x157f('0x35')],_0x328a06['filters']));if(_0x2f4ca0[_0x157f('0x35')]['filter']){_0xa8062a['where']=_['merge'](_0xa8062a[_0x157f('0x41')],{'$or':_[_0x157f('0x2f')](_0xa8062a[_0x157f('0x3a')],function(_0x2f98f5){var _0x3c8e97={};_0x3c8e97[_0x2f98f5]={'$like':'%'+_0x2f4ca0[_0x157f('0x35')][_0x157f('0x43')]+'%'};return _0x3c8e97;})});}_0xa8062a=_[_0x157f('0x44')]({},_0xa8062a,_0x2f4ca0[_0x157f('0x4c')]);return _0x10bddd['getAgents'](_0xa8062a);}})[_0x157f('0x2a')](function(_0x4bb3c9){if(_0x4bb3c9){_0xdf0ed7=_0x4bb3c9[_0x157f('0x3c')];if(!_0x2f4ca0['query'][_0x157f('0x3d')](_0x157f('0x3e'))){_0xa8062a[_0x157f('0x25')]=qs[_0x157f('0x25')](_0x2f4ca0[_0x157f('0x35')][_0x157f('0x25')]);_0xa8062a[_0x157f('0x24')]=qs[_0x157f('0x24')](_0x2f4ca0[_0x157f('0x35')]['offset']);}return _0x10bddd['getAgents'](_0xa8062a);}})[_0x157f('0x2a')](function(_0x2494b2){if(_0x2494b2){return _0x2494b2?{'count':_0xdf0ed7,'rows':_0x2494b2}:null;}})[_0x157f('0x2a')](respondWithResult(_0x3756e2,null))[_0x157f('0x4a')](handleError(_0x3756e2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 193c159..a633bcb 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 _0xfcc8=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','Team'];(function(_0x74aa68,_0x3fd8d2){var _0x544e43=function(_0x13e141){while(--_0x13e141){_0x74aa68['push'](_0x74aa68['shift']());}};_0x544e43(++_0x3fd8d2);}(_0xfcc8,0x16f));var _0x8fcc=function(_0x88fd6a,_0x5a2152){_0x88fd6a=_0x88fd6a-0x0;var _0x1f423a=_0xfcc8[_0x88fd6a];return _0x1f423a;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x8fcc('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0x8fcc('0x1')](0x0);var events={'afterCreate':_0x8fcc('0x2'),'afterUpdate':_0x8fcc('0x3'),'afterDestroy':'remove'};function emitEvent(_0x14adb0){return function(_0x306501,_0x377a94,_0x543912){TeamEvents[_0x8fcc('0x4')](_0x14adb0+':'+_0x306501['id'],_0x306501);TeamEvents[_0x8fcc('0x4')](_0x14adb0,_0x306501);_0x543912(null);};}for(var e in events){if(events[_0x8fcc('0x5')](e)){var event=events[e];Team[_0x8fcc('0x6')](e,emitEvent(event));}}module[_0x8fcc('0x7')]=TeamEvents; \ No newline at end of file +var _0xf1f1=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0xc296b8,_0x1865a3){var _0x4683e3=function(_0x3bba47){while(--_0x3bba47){_0xc296b8['push'](_0xc296b8['shift']());}};_0x4683e3(++_0x1865a3);}(_0xf1f1,0xcb));var _0x1f1f=function(_0x26bae2,_0x1053d7){_0x26bae2=_0x26bae2-0x0;var _0x5de88d=_0xf1f1[_0x26bae2];return _0x5de88d;};'use strict';var EventEmitter=require(_0x1f1f('0x0'));var Team=require(_0x1f1f('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x1f1f('0x2')](0x0);var events={'afterCreate':_0x1f1f('0x3'),'afterUpdate':_0x1f1f('0x4'),'afterDestroy':_0x1f1f('0x5')};function emitEvent(_0x22c9df){return function(_0x42a67d,_0x2b9fa3,_0x1f1fab){TeamEvents[_0x1f1f('0x6')](_0x22c9df+':'+_0x42a67d['id'],_0x42a67d);TeamEvents[_0x1f1f('0x6')](_0x22c9df,_0x42a67d);_0x1f1fab(null);};}for(var e in events){if(events[_0x1f1f('0x7')](e)){var event=events[e];Team[_0x1f1f('0x8')](e,emitEvent(event));}}module[_0x1f1f('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4f2e938..f8a6553 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 _0x30bb=['Voice','Whatsapp','resolve','then','all','catch','lodash','get','Queues','map','channel','exports','define','teams','Mail','Openchannel','Sms'];(function(_0x415836,_0x5b8aad){var _0x4363f5=function(_0xeed357){while(--_0xeed357){_0x415836['push'](_0x415836['shift']());}};_0x4363f5(++_0x5b8aad);}(_0x30bb,0x18d));var _0xb30b=function(_0x90a741,_0x20a0f2){_0x90a741=_0x90a741-0x0;var _0xfab5b8=_0x30bb[_0x90a741];return _0xfab5b8;};'use strict';var _=require(_0xb30b('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0xcd01b4,_0x738d99){var _0x303d19=_0xb30b('0x1')+_0x738d99+_0xb30b('0x2');return _0xcd01b4[_0x303d19]()['then'](function(_0x4212db){return _[_0xb30b('0x3')](_0x4212db,function(_0x52a093){_0x52a093['setDataValue'](_0xb30b('0x4'),_0x738d99);return _0x52a093;});})['catch'](function(_0xc3e071){throw _0xc3e071;});}module[_0xb30b('0x5')]=function(_0x3fbb3f){return _0x3fbb3f[_0xb30b('0x6')]('Team',attributes,{'tableName':_0xb30b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x574c06=this;var _0x20cb5e=['Chat','Fax',_0xb30b('0x8'),_0xb30b('0x9'),_0xb30b('0xa'),_0xb30b('0xb'),_0xb30b('0xc')];return Promise[_0xb30b('0xd')]()[_0xb30b('0xe')](function(){var _0x46eb6c=_[_0xb30b('0x3')](_0x20cb5e,function(_0x59f8b5){return getQueuesByChannel(_0x574c06,_0x59f8b5);});return Promise[_0xb30b('0xf')](_0x46eb6c);})[_0xb30b('0x10')](function(_0x50a18a){throw _0x50a18a;});}}});}; \ No newline at end of file +var _0xba1b=['then','map','setDataValue','channel','exports','define','teams','Chat','Mail','Openchannel','Sms','Whatsapp','all','catch','lodash','./team.attributes','get','Queues'];(function(_0x4e161b,_0xe7d56d){var _0x548e6b=function(_0x20f25c){while(--_0x20f25c){_0x4e161b['push'](_0x4e161b['shift']());}};_0x548e6b(++_0xe7d56d);}(_0xba1b,0x1ac));var _0xbba1=function(_0x20810a,_0x11a8c5){_0x20810a=_0x20810a-0x0;var _0x1b9ce7=_0xba1b[_0x20810a];return _0x1b9ce7;};'use strict';var _=require(_0xbba1('0x0'));var attributes=require(_0xbba1('0x1'));function getQueuesByChannel(_0x18dc0d,_0x2fc85e){var _0x1033e4=_0xbba1('0x2')+_0x2fc85e+_0xbba1('0x3');return _0x18dc0d[_0x1033e4]()[_0xbba1('0x4')](function(_0x51c4d4){return _[_0xbba1('0x5')](_0x51c4d4,function(_0x2f7e49){_0x2f7e49[_0xbba1('0x6')](_0xbba1('0x7'),_0x2fc85e);return _0x2f7e49;});})['catch'](function(_0x319e91){throw _0x319e91;});}module[_0xbba1('0x8')]=function(_0x19cd38){return _0x19cd38[_0xbba1('0x9')]('Team',attributes,{'tableName':_0xbba1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x9f093d=this;var _0x4a8cd5=[_0xbba1('0xb'),'Fax',_0xbba1('0xc'),_0xbba1('0xd'),_0xbba1('0xe'),'Voice',_0xbba1('0xf')];return Promise['resolve']()[_0xbba1('0x4')](function(){var _0x641468=_[_0xbba1('0x5')](_0x4a8cd5,function(_0x26793b){return getQueuesByChannel(_0x9f093d,_0x26793b);});return Promise[_0xbba1('0x10')](_0x641468);})[_0xbba1('0x11')](function(_0x22a597){throw _0x22a597;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 7c9796e..0694889 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 _0xd344=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','moment'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xd344,0x16e));var _0x4d34=function(_0xa2ad66,_0x50aea6){_0xa2ad66=_0xa2ad66-0x0;var _0x2c6ec2=_0xd344[_0xa2ad66];return _0x2c6ec2;};'use strict';var _=require(_0x4d34('0x0'));var util=require('util');var moment=require(_0x4d34('0x1'));var BPromise=require('bluebird');var rs=require(_0x4d34('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d34('0x3'))['db'];var utils=require(_0x4d34('0x4'));var logger=require('../../config/logger')(_0x4d34('0x5'));var config=require('../../config/environment');var jayson=require(_0x4d34('0x6'));var client=jayson[_0x4d34('0x7')][_0x4d34('0x8')]({'port':0x232a});config[_0x4d34('0x9')]=_['defaults'](config['redis'],{'host':_0x4d34('0xa'),'port':0x18eb});var socket=require(_0x4d34('0xb'))(new Redis(config[_0x4d34('0x9')]));require('./team.socket')[_0x4d34('0xc')](socket);function respondWithRpcPromise(_0x496fc5,_0x247eaf,_0x9d538d){return new BPromise(function(_0x1ceca2,_0x217335){return client['request'](_0x496fc5,_0x9d538d)[_0x4d34('0xd')](function(_0x48d23f){logger[_0x4d34('0xe')](_0x4d34('0xf'),_0x247eaf,_0x4d34('0x10'));logger['debug'](_0x4d34('0x11'),_0x247eaf,_0x4d34('0x10'),JSON[_0x4d34('0x12')](_0x48d23f));if(_0x48d23f['error']){if(_0x48d23f['error'][_0x4d34('0x13')]===0x1f4){logger[_0x4d34('0x14')]('Team,\x20%s,\x20%s',_0x247eaf,_0x48d23f[_0x4d34('0x14')][_0x4d34('0x15')]);return _0x217335(_0x48d23f[_0x4d34('0x14')][_0x4d34('0x15')]);}logger[_0x4d34('0x14')](_0x4d34('0xf'),_0x247eaf,_0x48d23f[_0x4d34('0x14')]['message']);return _0x1ceca2(_0x48d23f[_0x4d34('0x14')]['message']);}else{logger['info'](_0x4d34('0xf'),_0x247eaf,_0x4d34('0x10'));_0x1ceca2(_0x48d23f[_0x4d34('0x16')][_0x4d34('0x15')]);}})['catch'](function(_0x2f6872){logger[_0x4d34('0x14')](_0x4d34('0xf'),_0x247eaf,_0x2f6872);_0x217335(_0x2f6872);});});} \ No newline at end of file +var _0x73c4=['debug','Team,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x5bb79a,_0x5534b3){var _0x32473c=function(_0x2b753f){while(--_0x2b753f){_0x5bb79a['push'](_0x5bb79a['shift']());}};_0x32473c(++_0x5534b3);}(_0x73c4,0x19e));var _0x473c=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x73c4[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x473c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x473c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x473c('0x2'));var logger=require(_0x473c('0x3'))(_0x473c('0x4'));var config=require(_0x473c('0x5'));var jayson=require(_0x473c('0x6'));var client=jayson['client'][_0x473c('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x473c('0x8')],{'host':_0x473c('0x9'),'port':0x18eb});var socket=require(_0x473c('0xa'))(new Redis(config[_0x473c('0x8')]));require(_0x473c('0xb'))[_0x473c('0xc')](socket);function respondWithRpcPromise(_0x5673e8,_0x595364,_0x5bc93d){return new BPromise(function(_0x1b4246,_0xf9a4c4){return client[_0x473c('0xd')](_0x5673e8,_0x5bc93d)[_0x473c('0xe')](function(_0x28233d){logger[_0x473c('0xf')](_0x473c('0x10'),_0x595364,_0x473c('0x11'));logger[_0x473c('0x12')](_0x473c('0x13'),_0x595364,_0x473c('0x11'),JSON['stringify'](_0x28233d));if(_0x28233d['error']){if(_0x28233d['error'][_0x473c('0x14')]===0x1f4){logger[_0x473c('0x15')]('Team,\x20%s,\x20%s',_0x595364,_0x28233d[_0x473c('0x15')][_0x473c('0x16')]);return _0xf9a4c4(_0x28233d[_0x473c('0x15')]['message']);}logger[_0x473c('0x15')]('Team,\x20%s,\x20%s',_0x595364,_0x28233d[_0x473c('0x15')]['message']);return _0x1b4246(_0x28233d[_0x473c('0x15')][_0x473c('0x16')]);}else{logger[_0x473c('0xf')]('Team,\x20%s,\x20%s',_0x595364,_0x473c('0x11'));_0x1b4246(_0x28233d[_0x473c('0x17')][_0x473c('0x16')]);}})['catch'](function(_0x43497b){logger['error']('Team,\x20%s,\x20%s',_0x595364,_0x43497b);_0xf9a4c4(_0x43497b);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 0f674d0..7de5b9f 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 _0xbfca=['length','team:','./team.events','save','remove','update','emit','removeListener'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0xbfca,0x112));var _0xabfc=function(_0x417463,_0x312d8a){_0x417463=_0x417463-0x0;var _0x221e9f=_0xbfca[_0x417463];return _0x221e9f;};'use strict';var TeamEvents=require(_0xabfc('0x0'));var events=[_0xabfc('0x1'),_0xabfc('0x2'),_0xabfc('0x3')];function createListener(_0xc1d7c9,_0x52d3a1){return function(_0x256acf){_0x52d3a1[_0xabfc('0x4')](_0xc1d7c9,_0x256acf);};}function removeListener(_0x3a18d8,_0x4bceb0){return function(){TeamEvents[_0xabfc('0x5')](_0x3a18d8,_0x4bceb0);};}exports['register']=function(_0x6a772a){for(var _0x28777d=0x0,_0x16abc7=events[_0xabfc('0x6')];_0x28777d<_0x16abc7;_0x28777d++){var _0x531e51=events[_0x28777d];var _0x254b5e=createListener(_0xabfc('0x7')+_0x531e51,_0x6a772a);TeamEvents['on'](_0x531e51,_0x254b5e);}}; \ No newline at end of file +var _0x38ac=['register','length','team:','./team.events','save','emit','removeListener'];(function(_0x22945e,_0x7d3b3e){var _0x4dc43f=function(_0x617545){while(--_0x617545){_0x22945e['push'](_0x22945e['shift']());}};_0x4dc43f(++_0x7d3b3e);}(_0x38ac,0x161));var _0xc38a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x38ac[_0x19950b];return _0x3c6b41;};'use strict';var TeamEvents=require(_0xc38a('0x0'));var events=[_0xc38a('0x1'),'remove','update'];function createListener(_0x5f462e,_0x12aafc){return function(_0x50c42c){_0x12aafc[_0xc38a('0x2')](_0x5f462e,_0x50c42c);};}function removeListener(_0x349a8f,_0xc583e7){return function(){TeamEvents[_0xc38a('0x3')](_0x349a8f,_0xc583e7);};}exports[_0xc38a('0x4')]=function(_0x4463d7){for(var _0x232e23=0x0,_0x32354b=events[_0xc38a('0x5')];_0x232e23<_0x32354b;_0x232e23++){var _0x576768=events[_0x232e23];var _0x2f32da=createListener(_0xc38a('0x6')+_0x576768,_0x4463d7);TeamEvents['on'](_0x576768,_0x2f32da);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 07a33c6..fe65e58 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 _0xe3c8=['INTEGER','sequelize','exports'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0xe3c8,0x145));var _0x8e3c=function(_0x574cf4,_0x5988d4){_0x574cf4=_0x574cf4-0x0;var _0x493f92=_0xe3c8[_0x574cf4];return _0x493f92;};'use strict';var Sequelize=require(_0x8e3c('0x0'));module[_0x8e3c('0x1')]={'TeamId':{'type':Sequelize[_0x8e3c('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8e3c('0x2')]}}; \ No newline at end of file +var _0x4dd3=['exports','INTEGER','sequelize'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x4dd3,0xf5));var _0x34dd=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0x4dd3[_0x4b6778];return _0x22dbb9;};'use strict';var Sequelize=require(_0x34dd('0x0'));module[_0x34dd('0x1')]={'TeamId':{'type':Sequelize[_0x34dd('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 897be9d..e37526c 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 _0x6cb4=['bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x26fc9e,_0x59073b){var _0x589ddc=function(_0x278875){while(--_0x278875){_0x26fc9e['push'](_0x26fc9e['shift']());}};_0x589ddc(++_0x59073b);}(_0x6cb4,0xff));var _0x46cb=function(_0x56bb86,_0x51d8c8){_0x56bb86=_0x56bb86-0x0;var _0x1a42e9=_0x6cb4[_0x56bb86];return _0x1a42e9;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57c3=['path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','request-promise'];(function(_0x224a17,_0x286968){var _0x2b97ab=function(_0xcb7484){while(--_0xcb7484){_0x224a17['push'](_0x224a17['shift']());}};_0x2b97ab(++_0x286968);}(_0x57c3,0xc2));var _0x357c=function(_0x36ba92,_0x4867bd){_0x36ba92=_0x36ba92-0x0;var _0x1b3049=_0x57c3[_0x36ba92];return _0x1b3049;};'use strict';var _=require(_0x357c('0x0'));var util=require(_0x357c('0x1'));var logger=require(_0x357c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x357c('0x3'));var fs=require('fs');var path=require(_0x357c('0x4'));var rimraf=require(_0x357c('0x5'));var config=require(_0x357c('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x357c('0x7')]=function(_0x4ef0ce,_0x26c35d){return _0x4ef0ce[_0x357c('0x8')](_0x357c('0x9'),attributes,{'tableName':_0x357c('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 0f022c0..5dedeba 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x87e0dc,_0x577dce){var _0x2cd2d1=function(_0x2d8173){while(--_0x2d8173){_0x87e0dc['push'](_0x87e0dc['shift']());}};_0x2cd2d1(++_0x577dce);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index ec8e31d..7974ab7 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 _0xa48b=['INTEGER','sequelize','exports'];(function(_0x7c2d21,_0x31bb23){var _0x20501f=function(_0x3e3d3e){while(--_0x3e3d3e){_0x7c2d21['push'](_0x7c2d21['shift']());}};_0x20501f(++_0x31bb23);}(_0xa48b,0xc4));var _0xba48=function(_0x22df9c,_0x3924c7){_0x22df9c=_0x22df9c-0x0;var _0x40e0f1=_0xa48b[_0x22df9c];return _0x40e0f1;};'use strict';var Sequelize=require(_0xba48('0x0'));module[_0xba48('0x1')]={'penalty':{'type':Sequelize[_0xba48('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2e4b=['INTEGER','sequelize','exports'];(function(_0x3ecfcb,_0xb8c77f){var _0xb238dc=function(_0x569fa9){while(--_0x569fa9){_0x3ecfcb['push'](_0x3ecfcb['shift']());}};_0xb238dc(++_0xb8c77f);}(_0x2e4b,0xfd));var _0xb2e4=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x2e4b[_0x217c2e];return _0x22b7d8;};'use strict';var Sequelize=require(_0xb2e4('0x0'));module[_0xb2e4('0x1')]={'penalty':{'type':Sequelize[_0xb2e4('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 3406249..9e3cbd3 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 _0x342b=['api','moment','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger'];(function(_0x256011,_0x28bb88){var _0xcb704f=function(_0x31feb3){while(--_0x31feb3){_0x256011['push'](_0x256011['shift']());}};_0xcb704f(++_0x28bb88);}(_0x342b,0xbc));var _0xb342=function(_0x13a850,_0x888642){_0x13a850=_0x13a850-0x0;var _0x1d7abe=_0x342b[_0x13a850];return _0x1d7abe;};'use strict';var _=require(_0xb342('0x0'));var util=require('util');var logger=require(_0xb342('0x1'))(_0xb342('0x2'));var moment=require(_0xb342('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb342('0x4'));var attributes=require(_0xb342('0x5'));module[_0xb342('0x6')]=function(_0x28bca8,_0x25ecba){return _0x28bca8[_0xb342('0x7')](_0xb342('0x8'),attributes,{'tableName':_0xb342('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc73=['exports','define','team_has_voice_queues','util','../../config/logger','bluebird','path','./teamVoiceQueue.attributes'];(function(_0x4db34e,_0x184bca){var _0x18d125=function(_0x1d8708){while(--_0x1d8708){_0x4db34e['push'](_0x4db34e['shift']());}};_0x18d125(++_0x184bca);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcc73[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x3cc7('0x0'));var logger=require(_0x3cc7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3cc7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cc7('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3cc7('0x4'));module[_0x3cc7('0x5')]=function(_0x1ccad1,_0x10d0f9){return _0x1ccad1[_0x3cc7('0x6')]('TeamVoiceQueue',attributes,{'tableName':_0x3cc7('0x7'),'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 d46d5e4..5bcd8da 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 _0xc577=['http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3cf208,_0x425724){var _0x3a323a=function(_0x2d1c75){while(--_0x2d1c75){_0x3cf208['push'](_0x3cf208['shift']());}};_0x3a323a(++_0x425724);}(_0xc577,0x172));var _0x7c57=function(_0x4d9443,_0xe0d01f){_0x4d9443=_0x4d9443-0x0;var _0x350586=_0xc577[_0x4d9443];return _0x350586;};'use strict';var _=require(_0x7c57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c57('0x1'));var rs=require(_0x7c57('0x2'));var fs=require('fs');var Redis=require(_0x7c57('0x3'));var db=require(_0x7c57('0x4'))['db'];var utils=require(_0x7c57('0x5'));var logger=require(_0x7c57('0x6'))(_0x7c57('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c57('0x8'));var client=jayson[_0x7c57('0x9')][_0x7c57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bc454,_0x2f2c8f,_0x4bb81b){return new BPromise(function(_0x4e5cb2,_0x5c7ffb){return client[_0x7c57('0xb')](_0x2bc454,_0x4bb81b)['then'](function(_0x3ea732){logger[_0x7c57('0xc')](_0x7c57('0xd'),_0x2f2c8f,_0x7c57('0xe'));logger['debug'](_0x7c57('0xf'),_0x2f2c8f,_0x7c57('0xe'),JSON['stringify'](_0x3ea732));if(_0x3ea732[_0x7c57('0x10')]){if(_0x3ea732[_0x7c57('0x10')][_0x7c57('0x11')]===0x1f4){logger[_0x7c57('0x10')](_0x7c57('0xd'),_0x2f2c8f,_0x3ea732[_0x7c57('0x10')][_0x7c57('0x12')]);return _0x5c7ffb(_0x3ea732['error']['message']);}logger['error'](_0x7c57('0xd'),_0x2f2c8f,_0x3ea732[_0x7c57('0x10')][_0x7c57('0x12')]);return _0x4e5cb2(_0x3ea732[_0x7c57('0x10')][_0x7c57('0x12')]);}else{logger[_0x7c57('0xc')](_0x7c57('0xd'),_0x2f2c8f,_0x7c57('0xe'));_0x4e5cb2(_0x3ea732['result']['message']);}})[_0x7c57('0x13')](function(_0x2975f0){logger[_0x7c57('0x10')](_0x7c57('0xd'),_0x2f2c8f,_0x2975f0);_0x5c7ffb(_0x2975f0);});});} \ No newline at end of file +var _0x3ed9=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x13096d,_0x140f94){var _0x4a4793=function(_0x2b142b){while(--_0x2b142b){_0x13096d['push'](_0x13096d['shift']());}};_0x4a4793(++_0x140f94);}(_0x3ed9,0xe0));var _0x93ed=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0x3ed9[_0x8b631b];return _0x3e6832;};'use strict';var _=require(_0x93ed('0x0'));var util=require(_0x93ed('0x1'));var moment=require(_0x93ed('0x2'));var BPromise=require(_0x93ed('0x3'));var rs=require(_0x93ed('0x4'));var fs=require('fs');var Redis=require(_0x93ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x93ed('0x6'));var logger=require('../../config/logger')(_0x93ed('0x7'));var config=require(_0x93ed('0x8'));var jayson=require(_0x93ed('0x9'));var client=jayson[_0x93ed('0xa')][_0x93ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1be7dc,_0x1021ca,_0x5bb1fd){return new BPromise(function(_0x400d2b,_0x495bad){return client[_0x93ed('0xc')](_0x1be7dc,_0x5bb1fd)[_0x93ed('0xd')](function(_0x4c0067){logger[_0x93ed('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1021ca,'request\x20sent');logger[_0x93ed('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1021ca,'request\x20sent',JSON[_0x93ed('0x10')](_0x4c0067));if(_0x4c0067[_0x93ed('0x11')]){if(_0x4c0067[_0x93ed('0x11')]['code']===0x1f4){logger['error'](_0x93ed('0x12'),_0x1021ca,_0x4c0067[_0x93ed('0x11')][_0x93ed('0x13')]);return _0x495bad(_0x4c0067[_0x93ed('0x11')][_0x93ed('0x13')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x1021ca,_0x4c0067[_0x93ed('0x11')][_0x93ed('0x13')]);return _0x400d2b(_0x4c0067[_0x93ed('0x11')][_0x93ed('0x13')]);}else{logger[_0x93ed('0xe')](_0x93ed('0x12'),_0x1021ca,_0x93ed('0x14'));_0x400d2b(_0x4c0067[_0x93ed('0x15')][_0x93ed('0x13')]);}})[_0x93ed('0x16')](function(_0x355971){logger[_0x93ed('0x11')](_0x93ed('0x12'),_0x1021ca,_0x355971);_0x495bad(_0x355971);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7c89891..9a66399 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 _0x431b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','get','show','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x431b,0x18d));var _0xb431=function(_0x1b925b,_0x1ab3c9){_0x1b925b=_0x1b925b-0x0;var _0x275f07=_0x431b[_0x1b925b];return _0x275f07;};'use strict';var multer=require(_0xb431('0x0'));var util=require(_0xb431('0x1'));var path=require(_0xb431('0x2'));var timeout=require('connect-timeout');var express=require(_0xb431('0x3'));var router=express[_0xb431('0x4')]();var fs_extra=require(_0xb431('0x5'));var auth=require(_0xb431('0x6'));var interaction=require(_0xb431('0x7'));var config=require(_0xb431('0x8'));var controller=require(_0xb431('0x9'));router['get']('/',auth[_0xb431('0xa')](),controller['index']);router[_0xb431('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb431('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb431('0xd')]);router[_0xb431('0xe')](_0xb431('0xf'),auth[_0xb431('0xa')](),controller[_0xb431('0x10')]);router[_0xb431('0x11')](_0xb431('0xf'),auth['isAuthenticated'](),controller[_0xb431('0x12')]);module[_0xb431('0x13')]=router; \ No newline at end of file +var _0x1681=['./template.controller','get','index','isAuthenticated','post','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x26c25e,_0x1cf1fb){var _0x4907e6=function(_0x19203e){while(--_0x19203e){_0x26c25e['push'](_0x26c25e['shift']());}};_0x4907e6(++_0x1cf1fb);}(_0x1681,0x12c));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1168('0x0'));var timeout=require(_0x1168('0x1'));var express=require(_0x1168('0x2'));var router=express[_0x1168('0x3')]();var fs_extra=require(_0x1168('0x4'));var auth=require(_0x1168('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1168('0x6'));router[_0x1168('0x7')]('/',auth['isAuthenticated'](),controller[_0x1168('0x8')]);router[_0x1168('0x7')]('/:id',auth[_0x1168('0x9')](),controller['show']);router[_0x1168('0xa')]('/',auth[_0x1168('0x9')](),controller['create']);router[_0x1168('0xb')](_0x1168('0xc'),auth['isAuthenticated'](),controller[_0x1168('0xd')]);router[_0x1168('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1168('0xf')]);module[_0x1168('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0daccbb..0b2f151 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 _0xc74f=['STRING','TEXT','sequelize'];(function(_0x55bf66,_0x4b36e0){var _0x73cf10=function(_0x2d0d3c){while(--_0x2d0d3c){_0x55bf66['push'](_0x55bf66['shift']());}};_0x73cf10(++_0x4b36e0);}(_0xc74f,0xf8));var _0xfc74=function(_0x22bb0c,_0x34403f){_0x22bb0c=_0x22bb0c-0x0;var _0x594588=_0xc74f[_0x22bb0c];return _0x594588;};'use strict';var Sequelize=require(_0xfc74('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc74('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xfc74('0x2')]}}; \ No newline at end of file +var _0xccfc=['exports','STRING','sequelize'];(function(_0xd989e9,_0x1c6c52){var _0x6c266c=function(_0x360820){while(--_0x360820){_0xd989e9['push'](_0xd989e9['shift']());}};_0x6c266c(++_0x1c6c52);}(_0xccfc,0xc5));var _0xcccf=function(_0x2726ad,_0x4abe6b){_0x2726ad=_0x2726ad-0x0;var _0x52983a=_0xccfc[_0x2726ad];return _0x52983a;};'use strict';var Sequelize=require(_0xcccf('0x0'));module[_0xcccf('0x1')]={'name':{'type':Sequelize[_0xcccf('0x2')]},'description':{'type':Sequelize[_0xcccf('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 460bcb4..017c561 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 _0x7077=['set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','Template','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x7077,0x8b));var _0x7707=function(_0x59900a,_0x510eb7){_0x59900a=_0x59900a-0x0;var _0x3e9a2d=_0x7077[_0x59900a];return _0x3e9a2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7707('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7707('0x1'));var rp=require('request-promise');var moment=require(_0x7707('0x2'));var BPromise=require(_0x7707('0x3'));var Mustache=require(_0x7707('0x4'));var util=require(_0x7707('0x5'));var path=require(_0x7707('0x6'));var sox=require(_0x7707('0x7'));var csv=require(_0x7707('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7707('0x9'));var _=require(_0x7707('0xa'));var squel=require(_0x7707('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7707('0xc'));var toCsv=require(_0x7707('0x8'));var querystring=require(_0x7707('0xd'));var Papa=require(_0x7707('0xe'));var Redis=require(_0x7707('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7707('0x10'));var as=require(_0x7707('0x11'));var hardwareService=require(_0x7707('0x12'));var logger=require(_0x7707('0x13'))(_0x7707('0x14'));var utils=require('../../config/utils');var config=require(_0x7707('0x15'));var licenseUtil=require(_0x7707('0x16'));var db=require(_0x7707('0x17'))['db'];function respondWithStatusCode(_0x56f212,_0x3bd915){_0x3bd915=_0x3bd915||0xcc;return function(_0x5dc637){if(_0x5dc637){return _0x56f212[_0x7707('0x18')](_0x3bd915);}return _0x56f212[_0x7707('0x19')](_0x3bd915)[_0x7707('0x1a')]();};}function respondWithResult(_0x22a5b6,_0x1b83fe){_0x1b83fe=_0x1b83fe||0xc8;return function(_0x1e5d48){if(_0x1e5d48){return _0x22a5b6[_0x7707('0x19')](_0x1b83fe)['json'](_0x1e5d48);}};}function respondWithFilteredResult(_0x280ba8,_0x5ab249){return function(_0x2dc65a){if(_0x2dc65a){var _0x5a7927=typeof _0x5ab249[_0x7707('0x1b')]==='undefined'&&typeof _0x5ab249['limit']===_0x7707('0x1c');var _0x2c4fff=_0x2dc65a[_0x7707('0x1d')];var _0xeb780d=_0x5a7927?0x0:_0x5ab249[_0x7707('0x1b')];var _0x2b2dd3=_0x5a7927?_0x2dc65a['count']:_0x5ab249[_0x7707('0x1b')]+_0x5ab249[_0x7707('0x1e')];var _0xbea262;if(_0x2b2dd3>=_0x2c4fff){_0x2b2dd3=_0x2c4fff;_0xbea262=0xc8;}else{_0xbea262=0xce;}_0x280ba8['status'](_0xbea262);return _0x280ba8[_0x7707('0x1f')](_0x7707('0x20'),_0xeb780d+'-'+_0x2b2dd3+'/'+_0x2c4fff)[_0x7707('0x21')](_0x2dc65a);}return null;};}function patchUpdates(_0x42ee28){return function(_0x9f1e30){try{jsonpatch[_0x7707('0x22')](_0x9f1e30,_0x42ee28,!![]);}catch(_0x5bf8ea){return BPromise[_0x7707('0x23')](_0x5bf8ea);}return _0x9f1e30[_0x7707('0x24')]();};}function saveUpdates(_0x99189c,_0x378a3c){return function(_0x3d61be){if(_0x3d61be){return _0x3d61be[_0x7707('0x25')](_0x99189c)[_0x7707('0x26')](function(_0x1e15a1){return _0x1e15a1;});}return null;};}function removeEntity(_0x1c3a8c,_0x3969ed){return function(_0x597fc0){if(_0x597fc0){return _0x597fc0[_0x7707('0x27')]()['then'](function(){var _0x32697f=_0x597fc0[_0x7707('0x28')]({'plain':!![]});var _0x502359='Templates';return db[_0x7707('0x29')][_0x7707('0x27')]({'where':{'type':_0x502359,'resourceId':_0x32697f['id']}})[_0x7707('0x26')](function(){return _0x597fc0;});})[_0x7707('0x26')](function(){_0x1c3a8c['status'](0xcc)[_0x7707('0x1a')]();});}};}function handleEntityNotFound(_0x22a11e,_0x185547){return function(_0xfa0839){if(!_0xfa0839){_0x22a11e[_0x7707('0x18')](0x194);}return _0xfa0839;};}function handleError(_0x2d9789,_0x1cc905){_0x1cc905=_0x1cc905||0x1f4;return function(_0x4adef7){logger[_0x7707('0x2a')](_0x4adef7['stack']);if(_0x4adef7[_0x7707('0x2b')]){delete _0x4adef7['name'];}_0x2d9789[_0x7707('0x19')](_0x1cc905)['send'](_0x4adef7);};}exports[_0x7707('0x2c')]=function(_0x9bfbb1,_0x47dc65){var _0x16b975={},_0x19bb21={},_0x47e766={'count':0x0,'rows':[]};var _0x4224ac=_[_0x7707('0x2d')](db[_0x7707('0x2e')][_0x7707('0x2f')],function(_0x582e09){return{'name':_0x582e09[_0x7707('0x30')],'type':_0x582e09[_0x7707('0x31')]['key']};});_0x19bb21['model']=_[_0x7707('0x2d')](_0x4224ac,'name');_0x19bb21[_0x7707('0x32')]=_[_0x7707('0x33')](_0x9bfbb1[_0x7707('0x32')]);_0x19bb21[_0x7707('0x34')]=_[_0x7707('0x35')](_0x19bb21[_0x7707('0x36')],_0x19bb21[_0x7707('0x32')]);_0x16b975[_0x7707('0x37')]=_['intersection'](_0x19bb21['model'],qs['fields'](_0x9bfbb1[_0x7707('0x32')][_0x7707('0x38')]));_0x16b975['attributes']=_0x16b975['attributes']['length']?_0x16b975[_0x7707('0x37')]:_0x19bb21[_0x7707('0x36')];if(!_0x9bfbb1[_0x7707('0x32')][_0x7707('0x39')](_0x7707('0x3a'))){_0x16b975[_0x7707('0x1e')]=qs[_0x7707('0x1e')](_0x9bfbb1[_0x7707('0x32')][_0x7707('0x1e')]);_0x16b975[_0x7707('0x1b')]=qs[_0x7707('0x1b')](_0x9bfbb1[_0x7707('0x32')][_0x7707('0x1b')]);}_0x16b975[_0x7707('0x3b')]=qs['sort'](_0x9bfbb1[_0x7707('0x32')][_0x7707('0x3c')]);_0x16b975[_0x7707('0x3d')]=qs['filters'](_[_0x7707('0x3e')](_0x9bfbb1[_0x7707('0x32')],_0x19bb21['filters']),_0x4224ac);if(_0x9bfbb1[_0x7707('0x32')][_0x7707('0x3f')]){_0x16b975['where']=_[_0x7707('0x40')](_0x16b975[_0x7707('0x3d')],{'$or':_[_0x7707('0x2d')](_0x4224ac,function(_0x29839b){if(_0x29839b['type']!==_0x7707('0x41')){var _0x37ec70={};_0x37ec70[_0x29839b[_0x7707('0x2b')]]={'$like':'%'+_0x9bfbb1['query']['filter']+'%'};return _0x37ec70;}})});}_0x16b975=_['merge']({},_0x16b975,_0x9bfbb1['options']);var _0x5db582={'where':_0x16b975[_0x7707('0x3d')]};return db['Template'][_0x7707('0x1d')](_0x5db582)[_0x7707('0x26')](function(_0x184f88){_0x47e766[_0x7707('0x1d')]=_0x184f88;if(_0x9bfbb1['query'][_0x7707('0x42')]){_0x16b975[_0x7707('0x43')]=[{'all':!![]}];}return db[_0x7707('0x2e')][_0x7707('0x44')](_0x16b975);})[_0x7707('0x26')](function(_0x1ab90a){_0x47e766[_0x7707('0x45')]=_0x1ab90a;return _0x47e766;})[_0x7707('0x26')](respondWithFilteredResult(_0x47dc65,_0x16b975))[_0x7707('0x46')](handleError(_0x47dc65,null));};exports[_0x7707('0x47')]=function(_0x1c3a80,_0x370f5f){var _0x2e2bdd={'raw':!![],'where':{'id':_0x1c3a80['params']['id']}},_0x428dd3={};_0x428dd3['model']=_['keys'](db[_0x7707('0x2e')][_0x7707('0x2f')]);_0x428dd3[_0x7707('0x32')]=_[_0x7707('0x33')](_0x1c3a80[_0x7707('0x32')]);_0x428dd3[_0x7707('0x34')]=_['intersection'](_0x428dd3[_0x7707('0x36')],_0x428dd3['query']);_0x2e2bdd[_0x7707('0x37')]=_[_0x7707('0x35')](_0x428dd3[_0x7707('0x36')],qs[_0x7707('0x38')](_0x1c3a80[_0x7707('0x32')]['fields']));_0x2e2bdd[_0x7707('0x37')]=_0x2e2bdd[_0x7707('0x37')][_0x7707('0x48')]?_0x2e2bdd['attributes']:_0x428dd3[_0x7707('0x36')];if(_0x1c3a80[_0x7707('0x32')]['includeAll']){_0x2e2bdd[_0x7707('0x43')]=[{'all':!![]}];}_0x2e2bdd=_[_0x7707('0x40')]({},_0x2e2bdd,_0x1c3a80['options']);return db[_0x7707('0x2e')]['find'](_0x2e2bdd)[_0x7707('0x26')](handleEntityNotFound(_0x370f5f,null))[_0x7707('0x26')](respondWithResult(_0x370f5f,null))['catch'](handleError(_0x370f5f,null));};exports[_0x7707('0x49')]=function(_0x2b82b5,_0x574691){return db[_0x7707('0x2e')][_0x7707('0x49')](_0x2b82b5[_0x7707('0x4a')],{})[_0x7707('0x26')](function(_0x292b8f){var _0x4bba52=_0x2b82b5[_0x7707('0x4b')][_0x7707('0x28')]({'plain':!![]});if(!_0x4bba52)throw new Error(_0x7707('0x4c'));if(_0x4bba52[_0x7707('0x4d')]===_0x7707('0x4b')){var _0x3cadd1=_0x292b8f[_0x7707('0x28')]({'plain':!![]});var _0x1cf9a1=_0x7707('0x4e');return db[_0x7707('0x4f')][_0x7707('0x50')]({'where':{'name':_0x1cf9a1,'userProfileId':_0x4bba52[_0x7707('0x51')]},'raw':!![]})['then'](function(_0x2a7888){if(_0x2a7888&&_0x2a7888[_0x7707('0x52')]===0x0){return db[_0x7707('0x29')][_0x7707('0x49')]({'name':_0x3cadd1['name'],'resourceId':_0x3cadd1['id'],'type':_0x2a7888[_0x7707('0x2b')],'sectionId':_0x2a7888['id']},{})['then'](function(){return _0x292b8f;});}else{return _0x292b8f;}})[_0x7707('0x46')](function(_0x3da220){logger['error'](_0x7707('0x53'),_0x3da220);throw _0x3da220;});}return _0x292b8f;})[_0x7707('0x26')](respondWithResult(_0x574691,0xc9))[_0x7707('0x46')](handleError(_0x574691,null));};exports[_0x7707('0x25')]=function(_0x321160,_0x7b31ad){if(_0x321160[_0x7707('0x4a')]['id']){delete _0x321160[_0x7707('0x4a')]['id'];}return db['Template'][_0x7707('0x50')]({'where':{'id':_0x321160[_0x7707('0x54')]['id']}})[_0x7707('0x26')](handleEntityNotFound(_0x7b31ad,null))[_0x7707('0x26')](saveUpdates(_0x321160[_0x7707('0x4a')],null))[_0x7707('0x26')](respondWithResult(_0x7b31ad,null))[_0x7707('0x46')](handleError(_0x7b31ad,null));};exports[_0x7707('0x27')]=function(_0x9cdf9d,_0x38d760){return db['Template']['find']({'where':{'id':_0x9cdf9d['params']['id']}})['then'](handleEntityNotFound(_0x38d760,null))[_0x7707('0x26')](removeEntity(_0x38d760,null))['catch'](handleError(_0x38d760,null));}; \ No newline at end of file +var _0xa433=['update','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','save'];(function(_0x1ac5ba,_0x45775e){var _0x503e65=function(_0x2268e1){while(--_0x2268e1){_0x1ac5ba['push'](_0x1ac5ba['shift']());}};_0x503e65(++_0x45775e);}(_0xa433,0x11a));var _0x3a43=function(_0x30378e,_0x2925e5){_0x30378e=_0x30378e-0x0;var _0x425e5a=_0xa433[_0x30378e];return _0x425e5a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a43('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3a43('0x1'));var moment=require('moment');var BPromise=require(_0x3a43('0x2'));var Mustache=require(_0x3a43('0x3'));var util=require(_0x3a43('0x4'));var path=require(_0x3a43('0x5'));var sox=require(_0x3a43('0x6'));var csv=require('to-csv');var ejs=require(_0x3a43('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a43('0x8'));var squel=require(_0x3a43('0x9'));var crypto=require(_0x3a43('0xa'));var jsforce=require(_0x3a43('0xb'));var deskjs=require(_0x3a43('0xc'));var toCsv=require(_0x3a43('0xd'));var querystring=require(_0x3a43('0xe'));var Papa=require(_0x3a43('0xf'));var Redis=require('ioredis');var authService=require(_0x3a43('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3a43('0x11'));var hardwareService=require(_0x3a43('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3a43('0x13'));var licenseUtil=require(_0x3a43('0x14'));var db=require(_0x3a43('0x15'))['db'];function respondWithStatusCode(_0x3ac500,_0x73f080){_0x73f080=_0x73f080||0xcc;return function(_0x316fe9){if(_0x316fe9){return _0x3ac500[_0x3a43('0x16')](_0x73f080);}return _0x3ac500['status'](_0x73f080)[_0x3a43('0x17')]();};}function respondWithResult(_0x457855,_0x2534a7){_0x2534a7=_0x2534a7||0xc8;return function(_0x166424){if(_0x166424){return _0x457855[_0x3a43('0x18')](_0x2534a7)[_0x3a43('0x19')](_0x166424);}};}function respondWithFilteredResult(_0x31df0b,_0x3fef16){return function(_0x1bf55c){if(_0x1bf55c){var _0x183394=typeof _0x3fef16[_0x3a43('0x1a')]==='undefined'&&typeof _0x3fef16[_0x3a43('0x1b')]===_0x3a43('0x1c');var _0x3f3ea6=_0x1bf55c[_0x3a43('0x1d')];var _0x2e31f6=_0x183394?0x0:_0x3fef16[_0x3a43('0x1a')];var _0x1a1c9d=_0x183394?_0x1bf55c[_0x3a43('0x1d')]:_0x3fef16[_0x3a43('0x1a')]+_0x3fef16[_0x3a43('0x1b')];var _0xcd3d6e;if(_0x1a1c9d>=_0x3f3ea6){_0x1a1c9d=_0x3f3ea6;_0xcd3d6e=0xc8;}else{_0xcd3d6e=0xce;}_0x31df0b[_0x3a43('0x18')](_0xcd3d6e);return _0x31df0b[_0x3a43('0x1e')]('Content-Range',_0x2e31f6+'-'+_0x1a1c9d+'/'+_0x3f3ea6)[_0x3a43('0x19')](_0x1bf55c);}return null;};}function patchUpdates(_0x80e06d){return function(_0x2caef8){try{jsonpatch[_0x3a43('0x1f')](_0x2caef8,_0x80e06d,!![]);}catch(_0x159dd9){return BPromise[_0x3a43('0x20')](_0x159dd9);}return _0x2caef8[_0x3a43('0x21')]();};}function saveUpdates(_0xfd3684,_0x49377c){return function(_0xe0559a){if(_0xe0559a){return _0xe0559a[_0x3a43('0x22')](_0xfd3684)['then'](function(_0x255c43){return _0x255c43;});}return null;};}function removeEntity(_0x4c72ff,_0x964eea){return function(_0x9d7d34){if(_0x9d7d34){return _0x9d7d34[_0x3a43('0x23')]()[_0x3a43('0x24')](function(){var _0x20a274=_0x9d7d34[_0x3a43('0x25')]({'plain':!![]});var _0x549ede=_0x3a43('0x26');return db[_0x3a43('0x27')][_0x3a43('0x23')]({'where':{'type':_0x549ede,'resourceId':_0x20a274['id']}})['then'](function(){return _0x9d7d34;});})[_0x3a43('0x24')](function(){_0x4c72ff['status'](0xcc)[_0x3a43('0x17')]();});}};}function handleEntityNotFound(_0x4c7970,_0x4c9d67){return function(_0x577a03){if(!_0x577a03){_0x4c7970[_0x3a43('0x16')](0x194);}return _0x577a03;};}function handleError(_0x2a3272,_0x47ab9a){_0x47ab9a=_0x47ab9a||0x1f4;return function(_0x213589){logger[_0x3a43('0x28')](_0x213589[_0x3a43('0x29')]);if(_0x213589[_0x3a43('0x2a')]){delete _0x213589[_0x3a43('0x2a')];}_0x2a3272['status'](_0x47ab9a)[_0x3a43('0x2b')](_0x213589);};}exports[_0x3a43('0x2c')]=function(_0x8d945,_0x25f2ba){var _0xd637e={},_0x350cf9={},_0x45460c={'count':0x0,'rows':[]};var _0x400bdb=_[_0x3a43('0x2d')](db[_0x3a43('0x2e')][_0x3a43('0x2f')],function(_0x2bb1bc){return{'name':_0x2bb1bc[_0x3a43('0x30')],'type':_0x2bb1bc[_0x3a43('0x31')]['key']};});_0x350cf9[_0x3a43('0x32')]=_[_0x3a43('0x2d')](_0x400bdb,'name');_0x350cf9[_0x3a43('0x33')]=_['keys'](_0x8d945[_0x3a43('0x33')]);_0x350cf9[_0x3a43('0x34')]=_[_0x3a43('0x35')](_0x350cf9[_0x3a43('0x32')],_0x350cf9['query']);_0xd637e['attributes']=_['intersection'](_0x350cf9[_0x3a43('0x32')],qs['fields'](_0x8d945[_0x3a43('0x33')][_0x3a43('0x36')]));_0xd637e[_0x3a43('0x37')]=_0xd637e[_0x3a43('0x37')][_0x3a43('0x38')]?_0xd637e[_0x3a43('0x37')]:_0x350cf9[_0x3a43('0x32')];if(!_0x8d945[_0x3a43('0x33')]['hasOwnProperty'](_0x3a43('0x39'))){_0xd637e[_0x3a43('0x1b')]=qs[_0x3a43('0x1b')](_0x8d945[_0x3a43('0x33')]['limit']);_0xd637e[_0x3a43('0x1a')]=qs[_0x3a43('0x1a')](_0x8d945['query'][_0x3a43('0x1a')]);}_0xd637e[_0x3a43('0x3a')]=qs[_0x3a43('0x3b')](_0x8d945[_0x3a43('0x33')][_0x3a43('0x3b')]);_0xd637e[_0x3a43('0x3c')]=qs[_0x3a43('0x34')](_[_0x3a43('0x3d')](_0x8d945[_0x3a43('0x33')],_0x350cf9[_0x3a43('0x34')]),_0x400bdb);if(_0x8d945[_0x3a43('0x33')]['filter']){_0xd637e[_0x3a43('0x3c')]=_[_0x3a43('0x3e')](_0xd637e[_0x3a43('0x3c')],{'$or':_['map'](_0x400bdb,function(_0x1888dd){if(_0x1888dd[_0x3a43('0x31')]!=='VIRTUAL'){var _0x2f771f={};_0x2f771f[_0x1888dd[_0x3a43('0x2a')]]={'$like':'%'+_0x8d945['query'][_0x3a43('0x3f')]+'%'};return _0x2f771f;}})});}_0xd637e=_['merge']({},_0xd637e,_0x8d945[_0x3a43('0x40')]);var _0x4c42bd={'where':_0xd637e[_0x3a43('0x3c')]};return db[_0x3a43('0x2e')][_0x3a43('0x1d')](_0x4c42bd)['then'](function(_0x44aca6){_0x45460c[_0x3a43('0x1d')]=_0x44aca6;if(_0x8d945[_0x3a43('0x33')]['includeAll']){_0xd637e[_0x3a43('0x41')]=[{'all':!![]}];}return db[_0x3a43('0x2e')][_0x3a43('0x42')](_0xd637e);})['then'](function(_0xfda666){_0x45460c['rows']=_0xfda666;return _0x45460c;})[_0x3a43('0x24')](respondWithFilteredResult(_0x25f2ba,_0xd637e))[_0x3a43('0x43')](handleError(_0x25f2ba,null));};exports[_0x3a43('0x44')]=function(_0x15154d,_0x371522){var _0x111662={'raw':!![],'where':{'id':_0x15154d[_0x3a43('0x45')]['id']}},_0x1b889a={};_0x1b889a[_0x3a43('0x32')]=_[_0x3a43('0x46')](db['Template']['rawAttributes']);_0x1b889a['query']=_[_0x3a43('0x46')](_0x15154d[_0x3a43('0x33')]);_0x1b889a['filters']=_[_0x3a43('0x35')](_0x1b889a[_0x3a43('0x32')],_0x1b889a['query']);_0x111662[_0x3a43('0x37')]=_[_0x3a43('0x35')](_0x1b889a['model'],qs[_0x3a43('0x36')](_0x15154d[_0x3a43('0x33')][_0x3a43('0x36')]));_0x111662[_0x3a43('0x37')]=_0x111662[_0x3a43('0x37')][_0x3a43('0x38')]?_0x111662['attributes']:_0x1b889a[_0x3a43('0x32')];if(_0x15154d[_0x3a43('0x33')][_0x3a43('0x47')]){_0x111662[_0x3a43('0x41')]=[{'all':!![]}];}_0x111662=_['merge']({},_0x111662,_0x15154d[_0x3a43('0x40')]);return db[_0x3a43('0x2e')]['find'](_0x111662)[_0x3a43('0x24')](handleEntityNotFound(_0x371522,null))[_0x3a43('0x24')](respondWithResult(_0x371522,null))['catch'](handleError(_0x371522,null));};exports[_0x3a43('0x48')]=function(_0x428577,_0xc009a1){return db['Template'][_0x3a43('0x48')](_0x428577[_0x3a43('0x49')],{})[_0x3a43('0x24')](function(_0x51c5f6){var _0x540d25=_0x428577[_0x3a43('0x4a')][_0x3a43('0x25')]({'plain':!![]});if(!_0x540d25)throw new Error(_0x3a43('0x4b'));if(_0x540d25[_0x3a43('0x4c')]===_0x3a43('0x4a')){var _0x314161=_0x51c5f6[_0x3a43('0x25')]({'plain':!![]});var _0xe4ced8=_0x3a43('0x26');return db['UserProfileSection'][_0x3a43('0x4d')]({'where':{'name':_0xe4ced8,'userProfileId':_0x540d25[_0x3a43('0x4e')]},'raw':!![]})[_0x3a43('0x24')](function(_0x2406df){if(_0x2406df&&_0x2406df['autoAssociation']===0x0){return db[_0x3a43('0x27')][_0x3a43('0x48')]({'name':_0x314161[_0x3a43('0x2a')],'resourceId':_0x314161['id'],'type':_0x2406df[_0x3a43('0x2a')],'sectionId':_0x2406df['id']},{})[_0x3a43('0x24')](function(){return _0x51c5f6;});}else{return _0x51c5f6;}})[_0x3a43('0x43')](function(_0x21bc53){logger[_0x3a43('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21bc53);throw _0x21bc53;});}return _0x51c5f6;})[_0x3a43('0x24')](respondWithResult(_0xc009a1,0xc9))['catch'](handleError(_0xc009a1,null));};exports['update']=function(_0x381d73,_0x5a87c2){if(_0x381d73[_0x3a43('0x49')]['id']){delete _0x381d73[_0x3a43('0x49')]['id'];}return db[_0x3a43('0x2e')][_0x3a43('0x4d')]({'where':{'id':_0x381d73[_0x3a43('0x45')]['id']}})[_0x3a43('0x24')](handleEntityNotFound(_0x5a87c2,null))['then'](saveUpdates(_0x381d73[_0x3a43('0x49')],null))['then'](respondWithResult(_0x5a87c2,null))[_0x3a43('0x43')](handleError(_0x5a87c2,null));};exports[_0x3a43('0x23')]=function(_0x38786b,_0x246052){return db[_0x3a43('0x2e')]['find']({'where':{'id':_0x38786b[_0x3a43('0x45')]['id']}})[_0x3a43('0x24')](handleEntityNotFound(_0x246052,null))[_0x3a43('0x24')](removeEntity(_0x246052,null))[_0x3a43('0x43')](handleError(_0x246052,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 9b6e38e..e5406aa 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 _0x6155=['../../config/environment','./template.attributes','exports','Template','tools_templates','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x4796a2,_0x2685db){var _0x45889a=function(_0x486393){while(--_0x486393){_0x4796a2['push'](_0x4796a2['shift']());}};_0x45889a(++_0x2685db);}(_0x6155,0x15a));var _0x5615=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x6155[_0x58e469];return _0x4c01c5;};'use strict';var _=require('lodash');var util=require(_0x5615('0x0'));var logger=require(_0x5615('0x1'))(_0x5615('0x2'));var moment=require('moment');var BPromise=require(_0x5615('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5615('0x4'));var rimraf=require(_0x5615('0x5'));var config=require(_0x5615('0x6'));var attributes=require(_0x5615('0x7'));module[_0x5615('0x8')]=function(_0x2de8bd,_0x405aca){return _0x2de8bd['define'](_0x5615('0x9'),attributes,{'tableName':_0x5615('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a83=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9a83,0x169));var _0x39a8=function(_0x5c1449,_0x2af4b4){_0x5c1449=_0x5c1449-0x0;var _0x270473=_0x9a83[_0x5c1449];return _0x270473;};'use strict';var _=require(_0x39a8('0x0'));var util=require(_0x39a8('0x1'));var logger=require(_0x39a8('0x2'))('api');var moment=require(_0x39a8('0x3'));var BPromise=require(_0x39a8('0x4'));var rp=require(_0x39a8('0x5'));var fs=require('fs');var path=require(_0x39a8('0x6'));var rimraf=require(_0x39a8('0x7'));var config=require(_0x39a8('0x8'));var attributes=require(_0x39a8('0x9'));module[_0x39a8('0xa')]=function(_0x130521,_0x5e537d){return _0x130521[_0x39a8('0xb')](_0x39a8('0xc'),attributes,{'tableName':_0x39a8('0xd'),'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 ad8b37f..a129c59 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 _0xef87=['options','attributes','limit','include','map','model','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','debug','request\x20sent','error','code','message','info','Template,\x20%s,\x20%s','result','catch','GetTemplate','Template'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xef87,0x1ab));var _0x7ef8=function(_0x552bb3,_0x533ded){_0x552bb3=_0x552bb3-0x0;var _0xbc5fb=_0xef87[_0x552bb3];return _0xbc5fb;};'use strict';var _=require(_0x7ef8('0x0'));var util=require(_0x7ef8('0x1'));var moment=require(_0x7ef8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ef8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ef8('0x4'));var logger=require(_0x7ef8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7ef8('0x6'));var client=jayson['client'][_0x7ef8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4bad9b,_0x3e8844,_0x19ab9a){return new BPromise(function(_0x4da628,_0x138d9f){return client[_0x7ef8('0x8')](_0x4bad9b,_0x19ab9a)[_0x7ef8('0x9')](function(_0xff033c){logger['info']('Template,\x20%s,\x20%s',_0x3e8844,'request\x20sent');logger[_0x7ef8('0xa')]('Template,\x20%s,\x20%s,\x20%s',_0x3e8844,_0x7ef8('0xb'),JSON['stringify'](_0xff033c));if(_0xff033c[_0x7ef8('0xc')]){if(_0xff033c[_0x7ef8('0xc')][_0x7ef8('0xd')]===0x1f4){logger[_0x7ef8('0xc')]('Template,\x20%s,\x20%s',_0x3e8844,_0xff033c['error']['message']);return _0x138d9f(_0xff033c[_0x7ef8('0xc')][_0x7ef8('0xe')]);}logger[_0x7ef8('0xc')]('Template,\x20%s,\x20%s',_0x3e8844,_0xff033c['error']['message']);return _0x4da628(_0xff033c[_0x7ef8('0xc')][_0x7ef8('0xe')]);}else{logger[_0x7ef8('0xf')](_0x7ef8('0x10'),_0x3e8844,_0x7ef8('0xb'));_0x4da628(_0xff033c[_0x7ef8('0x11')][_0x7ef8('0xe')]);}})[_0x7ef8('0x12')](function(_0x490a20){logger[_0x7ef8('0xc')](_0x7ef8('0x10'),_0x3e8844,_0x490a20);_0x138d9f(_0x490a20);});});}exports[_0x7ef8('0x13')]=function(_0x512730){var _0x917c4f=this;return new Promise(function(_0x9fff42,_0x54d4dd){return db[_0x7ef8('0x14')]['findAll']({'raw':_0x512730['options']?_0x512730[_0x7ef8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x512730[_0x7ef8('0x15')]?_0x512730[_0x7ef8('0x15')]['where']||null:null,'attributes':_0x512730[_0x7ef8('0x15')]?_0x512730[_0x7ef8('0x15')][_0x7ef8('0x16')]||null:null,'limit':_0x512730[_0x7ef8('0x15')]?_0x512730[_0x7ef8('0x15')][_0x7ef8('0x17')]||null:null,'include':_0x512730['options']?_0x512730['options'][_0x7ef8('0x18')]?_[_0x7ef8('0x19')](_0x512730[_0x7ef8('0x15')]['include'],function(_0x318b4a){return{'model':db[_0x318b4a[_0x7ef8('0x1a')]],'as':_0x318b4a['as'],'attributes':_0x318b4a[_0x7ef8('0x16')],'include':_0x318b4a[_0x7ef8('0x18')]?_[_0x7ef8('0x19')](_0x318b4a[_0x7ef8('0x18')],function(_0x2fd815){return{'model':db[_0x2fd815['model']],'as':_0x2fd815['as'],'attributes':_0x2fd815['attributes'],'include':_0x2fd815[_0x7ef8('0x18')]?_[_0x7ef8('0x19')](_0x2fd815['include'],function(_0x58e214){return{'model':db[_0x58e214[_0x7ef8('0x1a')]],'as':_0x58e214['as'],'attributes':_0x58e214[_0x7ef8('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d82e4){logger[_0x7ef8('0xf')](_0x7ef8('0x13'),_0x512730);logger[_0x7ef8('0xa')](_0x7ef8('0x13'),_0x512730,JSON[_0x7ef8('0x1b')](_0x1d82e4));_0x9fff42(_0x1d82e4);})[_0x7ef8('0x12')](function(_0xa736bc){logger['error']('GetTemplate',_0xa736bc[_0x7ef8('0xe')],_0x512730);_0x54d4dd(_0x917c4f[_0x7ef8('0xc')](0x1f4,_0xa736bc['message']));});});}; \ No newline at end of file +var _0xa631=['stringify','error','code','message','result','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Template,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa631,0x1cb));var _0x1a63=function(_0x51341c,_0x134d5d){_0x51341c=_0x51341c-0x0;var _0x361416=_0xa631[_0x51341c];return _0x361416;};'use strict';var _=require(_0x1a63('0x0'));var util=require(_0x1a63('0x1'));var moment=require(_0x1a63('0x2'));var BPromise=require(_0x1a63('0x3'));var rs=require(_0x1a63('0x4'));var fs=require('fs');var Redis=require(_0x1a63('0x5'));var db=require(_0x1a63('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a63('0x7'))(_0x1a63('0x8'));var config=require(_0x1a63('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1a63('0xa')][_0x1a63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359ecf,_0x5a6edd,_0x1131d0){return new BPromise(function(_0x19ab57,_0x58209e){return client[_0x1a63('0xc')](_0x359ecf,_0x1131d0)[_0x1a63('0xd')](function(_0x2a6e69){logger['info'](_0x1a63('0xe'),_0x5a6edd,'request\x20sent');logger[_0x1a63('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x5a6edd,_0x1a63('0x10'),JSON[_0x1a63('0x11')](_0x2a6e69));if(_0x2a6e69[_0x1a63('0x12')]){if(_0x2a6e69['error'][_0x1a63('0x13')]===0x1f4){logger[_0x1a63('0x12')]('Template,\x20%s,\x20%s',_0x5a6edd,_0x2a6e69[_0x1a63('0x12')][_0x1a63('0x14')]);return _0x58209e(_0x2a6e69[_0x1a63('0x12')][_0x1a63('0x14')]);}logger[_0x1a63('0x12')](_0x1a63('0xe'),_0x5a6edd,_0x2a6e69[_0x1a63('0x12')]['message']);return _0x19ab57(_0x2a6e69[_0x1a63('0x12')][_0x1a63('0x14')]);}else{logger['info'](_0x1a63('0xe'),_0x5a6edd,_0x1a63('0x10'));_0x19ab57(_0x2a6e69[_0x1a63('0x15')][_0x1a63('0x14')]);}})[_0x1a63('0x16')](function(_0xbbac3e){logger['error'](_0x1a63('0xe'),_0x5a6edd,_0xbbac3e);_0x58209e(_0xbbac3e);});});}exports[_0x1a63('0x17')]=function(_0x280d69){var _0x308466=this;return new Promise(function(_0x51816f,_0x237684){return db[_0x1a63('0x18')]['findAll']({'raw':_0x280d69[_0x1a63('0x19')]?_0x280d69[_0x1a63('0x19')][_0x1a63('0x1a')]===undefined?!![]:![]:!![],'where':_0x280d69[_0x1a63('0x19')]?_0x280d69[_0x1a63('0x19')][_0x1a63('0x1b')]||null:null,'attributes':_0x280d69[_0x1a63('0x19')]?_0x280d69['options'][_0x1a63('0x1c')]||null:null,'limit':_0x280d69[_0x1a63('0x19')]?_0x280d69[_0x1a63('0x19')][_0x1a63('0x1d')]||null:null,'include':_0x280d69['options']?_0x280d69['options'][_0x1a63('0x1e')]?_[_0x1a63('0x1f')](_0x280d69[_0x1a63('0x19')][_0x1a63('0x1e')],function(_0x4c0c5d){return{'model':db[_0x4c0c5d['model']],'as':_0x4c0c5d['as'],'attributes':_0x4c0c5d[_0x1a63('0x1c')],'include':_0x4c0c5d[_0x1a63('0x1e')]?_[_0x1a63('0x1f')](_0x4c0c5d['include'],function(_0x12a849){return{'model':db[_0x12a849[_0x1a63('0x20')]],'as':_0x12a849['as'],'attributes':_0x12a849['attributes'],'include':_0x12a849[_0x1a63('0x1e')]?_[_0x1a63('0x1f')](_0x12a849[_0x1a63('0x1e')],function(_0x10bfd0){return{'model':db[_0x10bfd0[_0x1a63('0x20')]],'as':_0x10bfd0['as'],'attributes':_0x10bfd0['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a63('0xd')](function(_0x1c449d){logger[_0x1a63('0x21')](_0x1a63('0x17'),_0x280d69);logger[_0x1a63('0xf')](_0x1a63('0x17'),_0x280d69,JSON[_0x1a63('0x11')](_0x1c449d));_0x51816f(_0x1c449d);})[_0x1a63('0x16')](function(_0x482002){logger[_0x1a63('0x12')]('GetTemplate',_0x482002[_0x1a63('0x14')],_0x280d69);_0x237684(_0x308466[_0x1a63('0x12')](0x1f4,_0x482002[_0x1a63('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 628bfa5..8605700 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 _0xef0b=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','./trigger.controller','get','isAuthenticated','index','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','/:id/actions','put','update'];(function(_0x3c0654,_0x39281b){var _0x31dac3=function(_0x3a567c){while(--_0x3a567c){_0x3c0654['push'](_0x3c0654['shift']());}};_0x31dac3(++_0x39281b);}(_0xef0b,0x1d7));var _0xbef0=function(_0x1df5f7,_0x3f56f1){_0x1df5f7=_0x1df5f7-0x0;var _0x3fcaa1=_0xef0b[_0x1df5f7];return _0x3fcaa1;};'use strict';var multer=require(_0xbef0('0x0'));var util=require('util');var path=require(_0xbef0('0x1'));var timeout=require('connect-timeout');var express=require(_0xbef0('0x2'));var router=express[_0xbef0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbef0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbef0('0x5'));router[_0xbef0('0x6')]('/',auth[_0xbef0('0x7')](),controller[_0xbef0('0x8')]);router[_0xbef0('0x6')](_0xbef0('0x9'),auth[_0xbef0('0x7')](),controller[_0xbef0('0xa')]);router[_0xbef0('0x6')]('/:id/all_conditions',auth[_0xbef0('0x7')](),controller[_0xbef0('0xb')]);router[_0xbef0('0x6')](_0xbef0('0xc'),auth[_0xbef0('0x7')](),controller[_0xbef0('0xd')]);router['get']('/:id/actions',auth[_0xbef0('0x7')](),controller[_0xbef0('0xe')]);router[_0xbef0('0xf')]('/',auth['isAuthenticated'](),controller[_0xbef0('0x10')]);router[_0xbef0('0xf')](_0xbef0('0x11'),auth[_0xbef0('0x7')](),controller[_0xbef0('0x12')]);router['post'](_0xbef0('0xc'),auth['isAuthenticated'](),controller[_0xbef0('0x13')]);router['post'](_0xbef0('0x14'),auth['isAuthenticated'](),controller['addAction']);router[_0xbef0('0x15')](_0xbef0('0x9'),auth['isAuthenticated'](),controller[_0xbef0('0x16')]);router[_0xbef0('0x17')](_0xbef0('0x9'),auth[_0xbef0('0x7')](),controller[_0xbef0('0x18')]);module[_0xbef0('0x19')]=router; \ No newline at end of file +var _0x1677=['../../config/environment','get','index','show','isAuthenticated','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAction','put','/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xef96aa,_0x1c4a29){var _0x49699c=function(_0x22cefe){while(--_0x22cefe){_0xef96aa['push'](_0xef96aa['shift']());}};_0x49699c(++_0x1c4a29);}(_0x1677,0x18f));var _0x7167=function(_0x351478,_0x2494c7){_0x351478=_0x351478-0x0;var _0x30e075=_0x1677[_0x351478];return _0x30e075;};'use strict';var multer=require('multer');var util=require(_0x7167('0x0'));var path=require('path');var timeout=require(_0x7167('0x1'));var express=require('express');var router=express[_0x7167('0x2')]();var fs_extra=require(_0x7167('0x3'));var auth=require(_0x7167('0x4'));var interaction=require(_0x7167('0x5'));var config=require(_0x7167('0x6'));var controller=require('./trigger.controller');router[_0x7167('0x7')]('/',auth['isAuthenticated'](),controller[_0x7167('0x8')]);router[_0x7167('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7167('0x9')]);router[_0x7167('0x7')]('/:id/all_conditions',auth[_0x7167('0xa')](),controller[_0x7167('0xb')]);router['get']('/:id/any_conditions',auth[_0x7167('0xa')](),controller[_0x7167('0xc')]);router[_0x7167('0x7')](_0x7167('0xd'),auth[_0x7167('0xa')](),controller[_0x7167('0xe')]);router[_0x7167('0xf')]('/',auth[_0x7167('0xa')](),controller[_0x7167('0x10')]);router[_0x7167('0xf')](_0x7167('0x11'),auth[_0x7167('0xa')](),controller[_0x7167('0x12')]);router['post'](_0x7167('0x13'),auth[_0x7167('0xa')](),controller['addAnyCondition']);router[_0x7167('0xf')](_0x7167('0xd'),auth[_0x7167('0xa')](),controller[_0x7167('0x14')]);router[_0x7167('0x15')](_0x7167('0x16'),auth[_0x7167('0xa')](),controller[_0x7167('0x17')]);router[_0x7167('0x18')](_0x7167('0x16'),auth[_0x7167('0xa')](),controller[_0x7167('0x19')]);module[_0x7167('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6b43ff9..9687d24 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 _0x6658=['BOOLEAN','sequelize','exports','STRING'];(function(_0x187f4b,_0x12fd52){var _0x132087=function(_0x2b68ef){while(--_0x2b68ef){_0x187f4b['push'](_0x187f4b['shift']());}};_0x132087(++_0x12fd52);}(_0x6658,0x79));var _0x8665=function(_0x55535c,_0x5b9dc2){_0x55535c=_0x55535c-0x0;var _0x502921=_0x6658[_0x55535c];return _0x502921;};'use strict';var Sequelize=require(_0x8665('0x0'));module[_0x8665('0x1')]={'name':{'type':Sequelize[_0x8665('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8665('0x2')]},'status':{'type':Sequelize[_0x8665('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf13d=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf13d,0x174));var _0xdf13=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xf13d[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xdf13('0x0'));module[_0xdf13('0x1')]={'name':{'type':Sequelize[_0xdf13('0x2')]},'channel':{'type':Sequelize[_0xdf13('0x2')]},'description':{'type':Sequelize[_0xdf13('0x2')]},'status':{'type':Sequelize[_0xdf13('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 6cf1395..38f1477 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 _0x1e62=['../../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','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','stack','send','Trigger','rawAttributes','fieldName','type','key','model','map','name','keys','query','attributes','intersection','fields','length','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','TriggerAllId','Condition','create','addAnyCondition','TriggerAnyId','getAllConditions','hasOwnProperty','nolimit','getAnyConditions','addAction','TriggerId','getActions','findOne','eml-format','rimraf','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x1834fb,_0x38bfa4){var _0x578b25=function(_0xb3980e){while(--_0xb3980e){_0x1834fb['push'](_0x1834fb['shift']());}};_0x578b25(++_0x38bfa4);}(_0x1e62,0xb1));var _0x21e6=function(_0xe854ef,_0x595f28){_0xe854ef=_0xe854ef-0x0;var _0x3fcc1d=_0x1e62[_0xe854ef];return _0x3fcc1d;};'use strict';var emlformat=require(_0x21e6('0x0'));var rimraf=require(_0x21e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x21e6('0x2'));var BPromise=require(_0x21e6('0x3'));var Mustache=require(_0x21e6('0x4'));var util=require('util');var path=require('path');var sox=require(_0x21e6('0x5'));var csv=require('to-csv');var ejs=require(_0x21e6('0x6'));var fs=require('fs');var fs_extra=require(_0x21e6('0x7'));var _=require('lodash');var squel=require(_0x21e6('0x8'));var crypto=require(_0x21e6('0x9'));var jsforce=require(_0x21e6('0xa'));var deskjs=require(_0x21e6('0xb'));var toCsv=require(_0x21e6('0xc'));var querystring=require('querystring');var Papa=require(_0x21e6('0xd'));var Redis=require(_0x21e6('0xe'));var authService=require(_0x21e6('0xf'));var qs=require(_0x21e6('0x10'));var as=require(_0x21e6('0x11'));var hardwareService=require(_0x21e6('0x12'));var logger=require(_0x21e6('0x13'))(_0x21e6('0x14'));var utils=require(_0x21e6('0x15'));var config=require(_0x21e6('0x16'));var licenseUtil=require(_0x21e6('0x17'));var db=require(_0x21e6('0x18'))['db'];function respondWithStatusCode(_0x4d7a4f,_0x6ad443){_0x6ad443=_0x6ad443||0xcc;return function(_0x287d83){if(_0x287d83){return _0x4d7a4f['sendStatus'](_0x6ad443);}return _0x4d7a4f[_0x21e6('0x19')](_0x6ad443)[_0x21e6('0x1a')]();};}function respondWithResult(_0x467098,_0x40d22c){_0x40d22c=_0x40d22c||0xc8;return function(_0xb7b0a9){if(_0xb7b0a9){return _0x467098[_0x21e6('0x19')](_0x40d22c)[_0x21e6('0x1b')](_0xb7b0a9);}};}function respondWithFilteredResult(_0x236012,_0x55c61e){return function(_0x21521d){if(_0x21521d){var _0x313afe=typeof _0x55c61e[_0x21e6('0x1c')]===_0x21e6('0x1d')&&typeof _0x55c61e[_0x21e6('0x1e')]===_0x21e6('0x1d');var _0x21b1a8=_0x21521d[_0x21e6('0x1f')];var _0x2403ff=_0x313afe?0x0:_0x55c61e['offset'];var _0x125e54=_0x313afe?_0x21521d[_0x21e6('0x1f')]:_0x55c61e[_0x21e6('0x1c')]+_0x55c61e[_0x21e6('0x1e')];var _0x38a65d;if(_0x125e54>=_0x21b1a8){_0x125e54=_0x21b1a8;_0x38a65d=0xc8;}else{_0x38a65d=0xce;}_0x236012['status'](_0x38a65d);return _0x236012[_0x21e6('0x20')](_0x21e6('0x21'),_0x2403ff+'-'+_0x125e54+'/'+_0x21b1a8)[_0x21e6('0x1b')](_0x21521d);}return null;};}function patchUpdates(_0x4df851){return function(_0x2b4c18){try{jsonpatch[_0x21e6('0x22')](_0x2b4c18,_0x4df851,!![]);}catch(_0x185d01){return BPromise[_0x21e6('0x23')](_0x185d01);}return _0x2b4c18[_0x21e6('0x24')]();};}function saveUpdates(_0xf7fab,_0x1c4dd4){return function(_0x34bb88){if(_0x34bb88){return _0x34bb88[_0x21e6('0x25')](_0xf7fab)[_0x21e6('0x26')](function(_0x22dda4){return _0x22dda4;});}return null;};}function removeEntity(_0x33dd6d,_0x6eccf3){return function(_0x125034){if(_0x125034){return _0x125034[_0x21e6('0x27')]()[_0x21e6('0x26')](function(){var _0x2b62fc=_0x125034[_0x21e6('0x28')]({'plain':!![]});var _0x357bf5=_0x21e6('0x29');return db[_0x21e6('0x2a')][_0x21e6('0x27')]({'where':{'type':_0x357bf5,'resourceId':_0x2b62fc['id']}})[_0x21e6('0x26')](function(){return _0x125034;});})[_0x21e6('0x26')](function(){_0x33dd6d[_0x21e6('0x19')](0xcc)[_0x21e6('0x1a')]();});}};}function handleEntityNotFound(_0x1805b3,_0x54f0d6){return function(_0x4771c2){if(!_0x4771c2){_0x1805b3[_0x21e6('0x2b')](0x194);}return _0x4771c2;};}function handleError(_0x228cc5,_0x3680b7){_0x3680b7=_0x3680b7||0x1f4;return function(_0x28d7c4){logger[_0x21e6('0x2c')](_0x28d7c4[_0x21e6('0x2d')]);if(_0x28d7c4['name']){delete _0x28d7c4['name'];}_0x228cc5[_0x21e6('0x19')](_0x3680b7)[_0x21e6('0x2e')](_0x28d7c4);};}exports['index']=function(_0x59696a,_0x423f91){var _0x2682ae={},_0x551b1f={},_0x21ac08={'count':0x0,'rows':[]};var _0x26987b=_['map'](db[_0x21e6('0x2f')][_0x21e6('0x30')],function(_0x3d3f4c){return{'name':_0x3d3f4c[_0x21e6('0x31')],'type':_0x3d3f4c[_0x21e6('0x32')][_0x21e6('0x33')]};});_0x551b1f[_0x21e6('0x34')]=_[_0x21e6('0x35')](_0x26987b,_0x21e6('0x36'));_0x551b1f['query']=_[_0x21e6('0x37')](_0x59696a[_0x21e6('0x38')]);_0x551b1f['filters']=_['intersection'](_0x551b1f[_0x21e6('0x34')],_0x551b1f[_0x21e6('0x38')]);_0x2682ae[_0x21e6('0x39')]=_[_0x21e6('0x3a')](_0x551b1f[_0x21e6('0x34')],qs[_0x21e6('0x3b')](_0x59696a[_0x21e6('0x38')][_0x21e6('0x3b')]));_0x2682ae[_0x21e6('0x39')]=_0x2682ae['attributes'][_0x21e6('0x3c')]?_0x2682ae[_0x21e6('0x39')]:_0x551b1f['model'];if(!_0x59696a[_0x21e6('0x38')]['hasOwnProperty']('nolimit')){_0x2682ae[_0x21e6('0x1e')]=qs[_0x21e6('0x1e')](_0x59696a[_0x21e6('0x38')][_0x21e6('0x1e')]);_0x2682ae[_0x21e6('0x1c')]=qs[_0x21e6('0x1c')](_0x59696a[_0x21e6('0x38')][_0x21e6('0x1c')]);}_0x2682ae[_0x21e6('0x3d')]=qs[_0x21e6('0x3e')](_0x59696a['query'][_0x21e6('0x3e')]);_0x2682ae[_0x21e6('0x3f')]=qs['filters'](_[_0x21e6('0x40')](_0x59696a['query'],_0x551b1f[_0x21e6('0x41')]),_0x26987b);if(_0x59696a['query'][_0x21e6('0x42')]){_0x2682ae[_0x21e6('0x3f')]=_[_0x21e6('0x43')](_0x2682ae['where'],{'$or':_[_0x21e6('0x35')](_0x26987b,function(_0x1f6a23){if(_0x1f6a23[_0x21e6('0x32')]!=='VIRTUAL'){var _0x16e1d0={};_0x16e1d0[_0x1f6a23[_0x21e6('0x36')]]={'$like':'%'+_0x59696a[_0x21e6('0x38')][_0x21e6('0x42')]+'%'};return _0x16e1d0;}})});}_0x2682ae=_[_0x21e6('0x43')]({},_0x2682ae,_0x59696a[_0x21e6('0x44')]);var _0x42fc3e={'where':_0x2682ae[_0x21e6('0x3f')]};return db[_0x21e6('0x2f')][_0x21e6('0x1f')](_0x42fc3e)[_0x21e6('0x26')](function(_0x32b09f){_0x21ac08[_0x21e6('0x1f')]=_0x32b09f;if(_0x59696a[_0x21e6('0x38')][_0x21e6('0x45')]){_0x2682ae[_0x21e6('0x46')]=[{'all':!![]}];}return db['Trigger'][_0x21e6('0x47')](_0x2682ae);})[_0x21e6('0x26')](function(_0x3e1ed2){_0x21ac08[_0x21e6('0x48')]=_0x3e1ed2;return _0x21ac08;})['then'](respondWithFilteredResult(_0x423f91,_0x2682ae))['catch'](handleError(_0x423f91,null));};exports[_0x21e6('0x49')]=function(_0x40674a,_0xd8a3d7){var _0x5d33e8={'raw':![],'where':{'id':_0x40674a[_0x21e6('0x4a')]['id']}},_0x302d2c={};_0x302d2c[_0x21e6('0x34')]=_[_0x21e6('0x37')](db[_0x21e6('0x2f')]['rawAttributes']);_0x302d2c['query']=_[_0x21e6('0x37')](_0x40674a['query']);_0x302d2c['filters']=_[_0x21e6('0x3a')](_0x302d2c[_0x21e6('0x34')],_0x302d2c[_0x21e6('0x38')]);_0x5d33e8[_0x21e6('0x39')]=_[_0x21e6('0x3a')](_0x302d2c['model'],qs[_0x21e6('0x3b')](_0x40674a['query'][_0x21e6('0x3b')]));_0x5d33e8[_0x21e6('0x39')]=_0x5d33e8[_0x21e6('0x39')][_0x21e6('0x3c')]?_0x5d33e8[_0x21e6('0x39')]:_0x302d2c[_0x21e6('0x34')];if(_0x40674a[_0x21e6('0x38')][_0x21e6('0x45')]){_0x5d33e8[_0x21e6('0x46')]=[{'all':!![]}];}_0x5d33e8=_[_0x21e6('0x43')]({},_0x5d33e8,_0x40674a[_0x21e6('0x44')]);return db[_0x21e6('0x2f')][_0x21e6('0x4b')](_0x5d33e8)['then'](handleEntityNotFound(_0xd8a3d7,null))[_0x21e6('0x26')](respondWithResult(_0xd8a3d7,null))[_0x21e6('0x4c')](handleError(_0xd8a3d7,null));};exports['create']=function(_0x1b6555,_0x539849){return db[_0x21e6('0x2f')]['create'](_0x1b6555['body'],{})[_0x21e6('0x26')](function(_0x1d4f57){var _0x360cc9=_0x1b6555[_0x21e6('0x4d')][_0x21e6('0x28')]({'plain':!![]});if(!_0x360cc9)throw new Error(_0x21e6('0x4e'));if(_0x360cc9['role']===_0x21e6('0x4d')){var _0x3403f1=_0x1d4f57[_0x21e6('0x28')]({'plain':!![]});var _0x4eefa3=_0x21e6('0x29');return db[_0x21e6('0x4f')][_0x21e6('0x4b')]({'where':{'name':_0x4eefa3,'userProfileId':_0x360cc9[_0x21e6('0x50')]},'raw':!![]})[_0x21e6('0x26')](function(_0x55178b){if(_0x55178b&&_0x55178b[_0x21e6('0x51')]===0x0){return db[_0x21e6('0x2a')]['create']({'name':_0x3403f1[_0x21e6('0x36')],'resourceId':_0x3403f1['id'],'type':_0x55178b[_0x21e6('0x36')],'sectionId':_0x55178b['id']},{})[_0x21e6('0x26')](function(){return _0x1d4f57;});}else{return _0x1d4f57;}})[_0x21e6('0x4c')](function(_0x21e242){logger[_0x21e6('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21e242);throw _0x21e242;});}return _0x1d4f57;})['then'](respondWithResult(_0x539849,0xc9))[_0x21e6('0x4c')](handleError(_0x539849,null));};exports[_0x21e6('0x25')]=function(_0x2cb479,_0x3dd843){if(_0x2cb479[_0x21e6('0x52')]['id']){delete _0x2cb479[_0x21e6('0x52')]['id'];}return db[_0x21e6('0x2f')][_0x21e6('0x4b')]({'where':{'id':_0x2cb479['params']['id']}})['then'](handleEntityNotFound(_0x3dd843,null))['then'](saveUpdates(_0x2cb479[_0x21e6('0x52')],null))[_0x21e6('0x26')](respondWithResult(_0x3dd843,null))['catch'](handleError(_0x3dd843,null));};exports['destroy']=function(_0x261f2c,_0xd25411){return db[_0x21e6('0x2f')][_0x21e6('0x4b')]({'where':{'id':_0x261f2c[_0x21e6('0x4a')]['id']}})[_0x21e6('0x26')](handleEntityNotFound(_0xd25411,null))[_0x21e6('0x26')](removeEntity(_0xd25411,null))[_0x21e6('0x4c')](handleError(_0xd25411,null));};exports['addAllCondition']=function(_0xd0bba4,_0x19cfe1,_0x193ff6){if(_0xd0bba4[_0x21e6('0x52')]['id']){delete _0xd0bba4[_0x21e6('0x52')]['id'];}return db[_0x21e6('0x2f')][_0x21e6('0x4b')]({'where':{'id':_0xd0bba4['params']['id']}})['then'](handleEntityNotFound(_0x19cfe1,null))[_0x21e6('0x26')](function(_0x36068d){if(_0x36068d){_0xd0bba4[_0x21e6('0x52')][_0x21e6('0x53')]=_0x36068d['id'];return db[_0x21e6('0x54')][_0x21e6('0x55')](_0xd0bba4[_0x21e6('0x52')]);}})[_0x21e6('0x26')](respondWithResult(_0x19cfe1,null))[_0x21e6('0x4c')](handleError(_0x19cfe1,null));};exports[_0x21e6('0x56')]=function(_0x4e3116,_0x130c0d,_0x3e4ddc){if(_0x4e3116[_0x21e6('0x52')]['id']){delete _0x4e3116[_0x21e6('0x52')]['id'];}return db[_0x21e6('0x2f')][_0x21e6('0x4b')]({'where':{'id':_0x4e3116[_0x21e6('0x4a')]['id']}})[_0x21e6('0x26')](handleEntityNotFound(_0x130c0d,null))[_0x21e6('0x26')](function(_0x109791){if(_0x109791){_0x4e3116[_0x21e6('0x52')][_0x21e6('0x57')]=_0x109791['id'];return db[_0x21e6('0x54')][_0x21e6('0x55')](_0x4e3116[_0x21e6('0x52')]);}})[_0x21e6('0x26')](respondWithResult(_0x130c0d,null))['catch'](handleError(_0x130c0d,null));};exports[_0x21e6('0x58')]=function(_0x92c657,_0x1a7240,_0x3360d7){var _0x4e9824={};var _0x5a0d61={};var _0xbcc12e;var _0x19e63a;return db[_0x21e6('0x2f')]['findOne']({'where':{'id':_0x92c657[_0x21e6('0x4a')]['id']}})[_0x21e6('0x26')](handleEntityNotFound(_0x1a7240,null))['then'](function(_0x270fa5){if(_0x270fa5){_0xbcc12e=_0x270fa5;_0x5a0d61['model']=_['keys'](db[_0x21e6('0x54')][_0x21e6('0x30')]);_0x5a0d61[_0x21e6('0x38')]=_['keys'](_0x92c657[_0x21e6('0x38')]);_0x5a0d61['filters']=_[_0x21e6('0x3a')](_0x5a0d61['model'],_0x5a0d61[_0x21e6('0x38')]);_0x4e9824[_0x21e6('0x39')]=_['intersection'](_0x5a0d61[_0x21e6('0x34')],qs[_0x21e6('0x3b')](_0x92c657[_0x21e6('0x38')][_0x21e6('0x3b')]));_0x4e9824[_0x21e6('0x39')]=_0x4e9824[_0x21e6('0x39')][_0x21e6('0x3c')]?_0x4e9824['attributes']:_0x5a0d61[_0x21e6('0x34')];_0x4e9824['order']=qs[_0x21e6('0x3e')](_0x92c657[_0x21e6('0x38')][_0x21e6('0x3e')]);_0x4e9824['where']=qs[_0x21e6('0x41')](_[_0x21e6('0x40')](_0x92c657['query'],_0x5a0d61[_0x21e6('0x41')]));if(_0x92c657[_0x21e6('0x38')]['filter']){_0x4e9824[_0x21e6('0x3f')]=_[_0x21e6('0x43')](_0x4e9824[_0x21e6('0x3f')],{'$or':_['map'](_0x4e9824[_0x21e6('0x39')],function(_0x109d44){var _0x11602e={};_0x11602e[_0x109d44]={'$like':'%'+_0x92c657[_0x21e6('0x38')][_0x21e6('0x42')]+'%'};return _0x11602e;})});}_0x4e9824=_['merge']({},_0x4e9824,_0x92c657['options']);return _0xbcc12e[_0x21e6('0x58')](_0x4e9824);}})[_0x21e6('0x26')](function(_0x2a2385){if(_0x2a2385){_0x19e63a=_0x2a2385['length'];if(!_0x92c657['query'][_0x21e6('0x59')](_0x21e6('0x5a'))){_0x4e9824[_0x21e6('0x1e')]=qs['limit'](_0x92c657[_0x21e6('0x38')][_0x21e6('0x1e')]);_0x4e9824[_0x21e6('0x1c')]=qs[_0x21e6('0x1c')](_0x92c657['query'][_0x21e6('0x1c')]);}return _0xbcc12e[_0x21e6('0x58')](_0x4e9824);}})[_0x21e6('0x26')](function(_0x488dfb){if(_0x488dfb){return _0x488dfb?{'count':_0x19e63a,'rows':_0x488dfb}:null;}})[_0x21e6('0x26')](respondWithResult(_0x1a7240,null))['catch'](handleError(_0x1a7240,null));};exports['getAnyConditions']=function(_0x3492db,_0x3a36c5,_0x324e17){var _0x33e0d4={};var _0x1bb27a={};var _0x57f249;var _0x1ddc82;return db[_0x21e6('0x2f')]['findOne']({'where':{'id':_0x3492db['params']['id']}})[_0x21e6('0x26')](handleEntityNotFound(_0x3a36c5,null))[_0x21e6('0x26')](function(_0x455d35){if(_0x455d35){_0x57f249=_0x455d35;_0x1bb27a[_0x21e6('0x34')]=_['keys'](db[_0x21e6('0x54')]['rawAttributes']);_0x1bb27a[_0x21e6('0x38')]=_[_0x21e6('0x37')](_0x3492db['query']);_0x1bb27a[_0x21e6('0x41')]=_[_0x21e6('0x3a')](_0x1bb27a['model'],_0x1bb27a['query']);_0x33e0d4['attributes']=_[_0x21e6('0x3a')](_0x1bb27a[_0x21e6('0x34')],qs[_0x21e6('0x3b')](_0x3492db['query'][_0x21e6('0x3b')]));_0x33e0d4[_0x21e6('0x39')]=_0x33e0d4[_0x21e6('0x39')]['length']?_0x33e0d4['attributes']:_0x1bb27a['model'];_0x33e0d4[_0x21e6('0x3d')]=qs[_0x21e6('0x3e')](_0x3492db[_0x21e6('0x38')][_0x21e6('0x3e')]);_0x33e0d4['where']=qs[_0x21e6('0x41')](_['pick'](_0x3492db[_0x21e6('0x38')],_0x1bb27a[_0x21e6('0x41')]));if(_0x3492db['query'][_0x21e6('0x42')]){_0x33e0d4[_0x21e6('0x3f')]=_[_0x21e6('0x43')](_0x33e0d4[_0x21e6('0x3f')],{'$or':_['map'](_0x33e0d4['attributes'],function(_0x5ce2c1){var _0xc52cc2={};_0xc52cc2[_0x5ce2c1]={'$like':'%'+_0x3492db[_0x21e6('0x38')][_0x21e6('0x42')]+'%'};return _0xc52cc2;})});}_0x33e0d4=_[_0x21e6('0x43')]({},_0x33e0d4,_0x3492db[_0x21e6('0x44')]);return _0x57f249[_0x21e6('0x5b')](_0x33e0d4);}})[_0x21e6('0x26')](function(_0x618028){if(_0x618028){_0x1ddc82=_0x618028[_0x21e6('0x3c')];if(!_0x3492db['query']['hasOwnProperty'](_0x21e6('0x5a'))){_0x33e0d4['limit']=qs[_0x21e6('0x1e')](_0x3492db[_0x21e6('0x38')][_0x21e6('0x1e')]);_0x33e0d4['offset']=qs[_0x21e6('0x1c')](_0x3492db[_0x21e6('0x38')][_0x21e6('0x1c')]);}return _0x57f249[_0x21e6('0x5b')](_0x33e0d4);}})[_0x21e6('0x26')](function(_0x5b20f6){if(_0x5b20f6){return _0x5b20f6?{'count':_0x1ddc82,'rows':_0x5b20f6}:null;}})[_0x21e6('0x26')](respondWithResult(_0x3a36c5,null))[_0x21e6('0x4c')](handleError(_0x3a36c5,null));};exports[_0x21e6('0x5c')]=function(_0x41be17,_0x3a0976,_0x5566b0){if(_0x41be17[_0x21e6('0x52')]['id']){delete _0x41be17[_0x21e6('0x52')]['id'];}return db['Trigger'][_0x21e6('0x4b')]({'where':{'id':_0x41be17[_0x21e6('0x4a')]['id']}})[_0x21e6('0x26')](handleEntityNotFound(_0x3a0976,null))[_0x21e6('0x26')](function(_0x128a2d){if(_0x128a2d){_0x41be17[_0x21e6('0x52')][_0x21e6('0x5d')]=_0x128a2d['id'];return db['Action'][_0x21e6('0x55')](_0x41be17[_0x21e6('0x52')]);}})[_0x21e6('0x26')](respondWithResult(_0x3a0976,null))['catch'](handleError(_0x3a0976,null));};exports[_0x21e6('0x5e')]=function(_0x5d5bb3,_0x8bf475,_0x3e14b2){var _0x25662b={};var _0x1ef6ed={};var _0x37fffc;var _0x46663c;return db[_0x21e6('0x2f')][_0x21e6('0x5f')]({'where':{'id':_0x5d5bb3[_0x21e6('0x4a')]['id']}})[_0x21e6('0x26')](handleEntityNotFound(_0x8bf475,null))[_0x21e6('0x26')](function(_0x53e088){if(_0x53e088){_0x37fffc=_0x53e088;_0x1ef6ed[_0x21e6('0x34')]=_[_0x21e6('0x37')](db['Action']['rawAttributes']);_0x1ef6ed[_0x21e6('0x38')]=_[_0x21e6('0x37')](_0x5d5bb3['query']);_0x1ef6ed[_0x21e6('0x41')]=_['intersection'](_0x1ef6ed['model'],_0x1ef6ed[_0x21e6('0x38')]);_0x25662b[_0x21e6('0x39')]=_['intersection'](_0x1ef6ed[_0x21e6('0x34')],qs['fields'](_0x5d5bb3[_0x21e6('0x38')][_0x21e6('0x3b')]));_0x25662b[_0x21e6('0x39')]=_0x25662b[_0x21e6('0x39')][_0x21e6('0x3c')]?_0x25662b[_0x21e6('0x39')]:_0x1ef6ed[_0x21e6('0x34')];_0x25662b[_0x21e6('0x3d')]=qs[_0x21e6('0x3e')](_0x5d5bb3[_0x21e6('0x38')][_0x21e6('0x3e')]);_0x25662b[_0x21e6('0x3f')]=qs[_0x21e6('0x41')](_['pick'](_0x5d5bb3[_0x21e6('0x38')],_0x1ef6ed[_0x21e6('0x41')]));if(_0x5d5bb3['query'][_0x21e6('0x42')]){_0x25662b['where']=_[_0x21e6('0x43')](_0x25662b[_0x21e6('0x3f')],{'$or':_['map'](_0x25662b[_0x21e6('0x39')],function(_0x62935){var _0xddbd78={};_0xddbd78[_0x62935]={'$like':'%'+_0x5d5bb3[_0x21e6('0x38')][_0x21e6('0x42')]+'%'};return _0xddbd78;})});}_0x25662b=_[_0x21e6('0x43')]({},_0x25662b,_0x5d5bb3[_0x21e6('0x44')]);return _0x37fffc[_0x21e6('0x5e')](_0x25662b);}})['then'](function(_0x5b6a21){if(_0x5b6a21){_0x46663c=_0x5b6a21[_0x21e6('0x3c')];if(!_0x5d5bb3[_0x21e6('0x38')][_0x21e6('0x59')](_0x21e6('0x5a'))){_0x25662b[_0x21e6('0x1e')]=qs[_0x21e6('0x1e')](_0x5d5bb3[_0x21e6('0x38')][_0x21e6('0x1e')]);_0x25662b[_0x21e6('0x1c')]=qs[_0x21e6('0x1c')](_0x5d5bb3[_0x21e6('0x38')][_0x21e6('0x1c')]);}return _0x37fffc['getActions'](_0x25662b);}})[_0x21e6('0x26')](function(_0x462b8a){if(_0x462b8a){return _0x462b8a?{'count':_0x46663c,'rows':_0x462b8a}:null;}})[_0x21e6('0x26')](respondWithResult(_0x8bf475,null))['catch'](handleError(_0x8bf475,null));}; \ No newline at end of file +var _0x7b93=['getActions','Action','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','get','Triggers','error','stack','name','send','index','map','Trigger','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','filter','where','merge','type','VIRTUAL','includeAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','findOne','order','pick','getAllConditions','hasOwnProperty','getAnyConditions','addAction','TriggerId'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x7b93,0x119));var _0x37b9=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x7b93[_0x1c8cc6];return _0x522936;};'use strict';var emlformat=require(_0x37b9('0x0'));var rimraf=require(_0x37b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37b9('0x2'));var rp=require(_0x37b9('0x3'));var moment=require('moment');var BPromise=require(_0x37b9('0x4'));var Mustache=require('mustache');var util=require(_0x37b9('0x5'));var path=require(_0x37b9('0x6'));var sox=require(_0x37b9('0x7'));var csv=require('to-csv');var ejs=require(_0x37b9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37b9('0x9'));var squel=require(_0x37b9('0xa'));var crypto=require(_0x37b9('0xb'));var jsforce=require(_0x37b9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x37b9('0xd'));var querystring=require(_0x37b9('0xe'));var Papa=require(_0x37b9('0xf'));var Redis=require('ioredis');var authService=require(_0x37b9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x37b9('0x11'));var hardwareService=require(_0x37b9('0x12'));var logger=require(_0x37b9('0x13'))(_0x37b9('0x14'));var utils=require(_0x37b9('0x15'));var config=require(_0x37b9('0x16'));var licenseUtil=require(_0x37b9('0x17'));var db=require(_0x37b9('0x18'))['db'];function respondWithStatusCode(_0x46124c,_0x338f97){_0x338f97=_0x338f97||0xcc;return function(_0x54224d){if(_0x54224d){return _0x46124c[_0x37b9('0x19')](_0x338f97);}return _0x46124c['status'](_0x338f97)['end']();};}function respondWithResult(_0x1af5ef,_0x472760){_0x472760=_0x472760||0xc8;return function(_0x992f18){if(_0x992f18){return _0x1af5ef[_0x37b9('0x1a')](_0x472760)['json'](_0x992f18);}};}function respondWithFilteredResult(_0x4482ee,_0x118c10){return function(_0x3b9a12){if(_0x3b9a12){var _0x36e024=typeof _0x118c10[_0x37b9('0x1b')]===_0x37b9('0x1c')&&typeof _0x118c10['limit']===_0x37b9('0x1c');var _0x21da2e=_0x3b9a12[_0x37b9('0x1d')];var _0x28b9ef=_0x36e024?0x0:_0x118c10[_0x37b9('0x1b')];var _0x33592e=_0x36e024?_0x3b9a12[_0x37b9('0x1d')]:_0x118c10[_0x37b9('0x1b')]+_0x118c10[_0x37b9('0x1e')];var _0x1a5f36;if(_0x33592e>=_0x21da2e){_0x33592e=_0x21da2e;_0x1a5f36=0xc8;}else{_0x1a5f36=0xce;}_0x4482ee[_0x37b9('0x1a')](_0x1a5f36);return _0x4482ee[_0x37b9('0x1f')](_0x37b9('0x20'),_0x28b9ef+'-'+_0x33592e+'/'+_0x21da2e)['json'](_0x3b9a12);}return null;};}function patchUpdates(_0xb7f723){return function(_0x3c358f){try{jsonpatch['apply'](_0x3c358f,_0xb7f723,!![]);}catch(_0x217844){return BPromise[_0x37b9('0x21')](_0x217844);}return _0x3c358f[_0x37b9('0x22')]();};}function saveUpdates(_0x28654d,_0x227ee0){return function(_0x336e8c){if(_0x336e8c){return _0x336e8c[_0x37b9('0x23')](_0x28654d)['then'](function(_0x44d8e6){return _0x44d8e6;});}return null;};}function removeEntity(_0x5b9f58,_0x211c79){return function(_0x2e9234){if(_0x2e9234){return _0x2e9234[_0x37b9('0x24')]()[_0x37b9('0x25')](function(){var _0xaee03a=_0x2e9234[_0x37b9('0x26')]({'plain':!![]});var _0x5c576f=_0x37b9('0x27');return db['UserProfileResource'][_0x37b9('0x24')]({'where':{'type':_0x5c576f,'resourceId':_0xaee03a['id']}})[_0x37b9('0x25')](function(){return _0x2e9234;});})[_0x37b9('0x25')](function(){_0x5b9f58[_0x37b9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ceab,_0x2aae63){return function(_0x53aaa4){if(!_0x53aaa4){_0x18ceab[_0x37b9('0x19')](0x194);}return _0x53aaa4;};}function handleError(_0x4b27de,_0x464163){_0x464163=_0x464163||0x1f4;return function(_0x5915ac){logger[_0x37b9('0x28')](_0x5915ac[_0x37b9('0x29')]);if(_0x5915ac[_0x37b9('0x2a')]){delete _0x5915ac['name'];}_0x4b27de[_0x37b9('0x1a')](_0x464163)[_0x37b9('0x2b')](_0x5915ac);};}exports[_0x37b9('0x2c')]=function(_0x31ac1a,_0x187745){var _0x2caf29={},_0x346fc5={},_0xbee24c={'count':0x0,'rows':[]};var _0x3fd6d0=_[_0x37b9('0x2d')](db[_0x37b9('0x2e')]['rawAttributes'],function(_0x584405){return{'name':_0x584405[_0x37b9('0x2f')],'type':_0x584405['type'][_0x37b9('0x30')]};});_0x346fc5['model']=_['map'](_0x3fd6d0,_0x37b9('0x2a'));_0x346fc5[_0x37b9('0x31')]=_[_0x37b9('0x32')](_0x31ac1a[_0x37b9('0x31')]);_0x346fc5[_0x37b9('0x33')]=_[_0x37b9('0x34')](_0x346fc5[_0x37b9('0x35')],_0x346fc5['query']);_0x2caf29[_0x37b9('0x36')]=_['intersection'](_0x346fc5[_0x37b9('0x35')],qs[_0x37b9('0x37')](_0x31ac1a[_0x37b9('0x31')][_0x37b9('0x37')]));_0x2caf29[_0x37b9('0x36')]=_0x2caf29[_0x37b9('0x36')][_0x37b9('0x38')]?_0x2caf29[_0x37b9('0x36')]:_0x346fc5[_0x37b9('0x35')];if(!_0x31ac1a[_0x37b9('0x31')]['hasOwnProperty'](_0x37b9('0x39'))){_0x2caf29[_0x37b9('0x1e')]=qs['limit'](_0x31ac1a[_0x37b9('0x31')][_0x37b9('0x1e')]);_0x2caf29['offset']=qs[_0x37b9('0x1b')](_0x31ac1a['query'][_0x37b9('0x1b')]);}_0x2caf29['order']=qs['sort'](_0x31ac1a['query'][_0x37b9('0x3a')]);_0x2caf29['where']=qs[_0x37b9('0x33')](_['pick'](_0x31ac1a['query'],_0x346fc5[_0x37b9('0x33')]),_0x3fd6d0);if(_0x31ac1a[_0x37b9('0x31')][_0x37b9('0x3b')]){_0x2caf29[_0x37b9('0x3c')]=_[_0x37b9('0x3d')](_0x2caf29[_0x37b9('0x3c')],{'$or':_[_0x37b9('0x2d')](_0x3fd6d0,function(_0x5ea546){if(_0x5ea546[_0x37b9('0x3e')]!==_0x37b9('0x3f')){var _0x54f947={};_0x54f947[_0x5ea546['name']]={'$like':'%'+_0x31ac1a[_0x37b9('0x31')][_0x37b9('0x3b')]+'%'};return _0x54f947;}})});}_0x2caf29=_['merge']({},_0x2caf29,_0x31ac1a['options']);var _0x12f93f={'where':_0x2caf29['where']};return db[_0x37b9('0x2e')][_0x37b9('0x1d')](_0x12f93f)[_0x37b9('0x25')](function(_0x358543){_0xbee24c[_0x37b9('0x1d')]=_0x358543;if(_0x31ac1a[_0x37b9('0x31')][_0x37b9('0x40')]){_0x2caf29['include']=[{'all':!![]}];}return db[_0x37b9('0x2e')]['findAll'](_0x2caf29);})[_0x37b9('0x25')](function(_0x22b609){_0xbee24c[_0x37b9('0x41')]=_0x22b609;return _0xbee24c;})[_0x37b9('0x25')](respondWithFilteredResult(_0x187745,_0x2caf29))[_0x37b9('0x42')](handleError(_0x187745,null));};exports[_0x37b9('0x43')]=function(_0x4bd21d,_0x22c6e8){var _0x4b1ca0={'raw':![],'where':{'id':_0x4bd21d[_0x37b9('0x44')]['id']}},_0x116af4={};_0x116af4[_0x37b9('0x35')]=_[_0x37b9('0x32')](db[_0x37b9('0x2e')][_0x37b9('0x45')]);_0x116af4[_0x37b9('0x31')]=_[_0x37b9('0x32')](_0x4bd21d[_0x37b9('0x31')]);_0x116af4[_0x37b9('0x33')]=_[_0x37b9('0x34')](_0x116af4[_0x37b9('0x35')],_0x116af4[_0x37b9('0x31')]);_0x4b1ca0[_0x37b9('0x36')]=_['intersection'](_0x116af4[_0x37b9('0x35')],qs['fields'](_0x4bd21d[_0x37b9('0x31')]['fields']));_0x4b1ca0[_0x37b9('0x36')]=_0x4b1ca0[_0x37b9('0x36')][_0x37b9('0x38')]?_0x4b1ca0[_0x37b9('0x36')]:_0x116af4[_0x37b9('0x35')];if(_0x4bd21d['query'][_0x37b9('0x40')]){_0x4b1ca0[_0x37b9('0x46')]=[{'all':!![]}];}_0x4b1ca0=_['merge']({},_0x4b1ca0,_0x4bd21d[_0x37b9('0x47')]);return db[_0x37b9('0x2e')][_0x37b9('0x48')](_0x4b1ca0)[_0x37b9('0x25')](handleEntityNotFound(_0x22c6e8,null))[_0x37b9('0x25')](respondWithResult(_0x22c6e8,null))[_0x37b9('0x42')](handleError(_0x22c6e8,null));};exports[_0x37b9('0x49')]=function(_0x1906f3,_0x500b88){return db[_0x37b9('0x2e')][_0x37b9('0x49')](_0x1906f3[_0x37b9('0x4a')],{})[_0x37b9('0x25')](function(_0x385e5a){var _0x26290e=_0x1906f3[_0x37b9('0x4b')][_0x37b9('0x26')]({'plain':!![]});if(!_0x26290e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26290e['role']===_0x37b9('0x4b')){var _0x336b6d=_0x385e5a['get']({'plain':!![]});var _0x211b50=_0x37b9('0x27');return db[_0x37b9('0x4c')][_0x37b9('0x48')]({'where':{'name':_0x211b50,'userProfileId':_0x26290e[_0x37b9('0x4d')]},'raw':!![]})['then'](function(_0x4a12cb){if(_0x4a12cb&&_0x4a12cb[_0x37b9('0x4e')]===0x0){return db[_0x37b9('0x4f')][_0x37b9('0x49')]({'name':_0x336b6d[_0x37b9('0x2a')],'resourceId':_0x336b6d['id'],'type':_0x4a12cb[_0x37b9('0x2a')],'sectionId':_0x4a12cb['id']},{})[_0x37b9('0x25')](function(){return _0x385e5a;});}else{return _0x385e5a;}})[_0x37b9('0x42')](function(_0x2d6f90){logger[_0x37b9('0x28')](_0x37b9('0x50'),_0x2d6f90);throw _0x2d6f90;});}return _0x385e5a;})[_0x37b9('0x25')](respondWithResult(_0x500b88,0xc9))[_0x37b9('0x42')](handleError(_0x500b88,null));};exports['update']=function(_0x2fc7da,_0x5841e8){if(_0x2fc7da[_0x37b9('0x4a')]['id']){delete _0x2fc7da[_0x37b9('0x4a')]['id'];}return db[_0x37b9('0x2e')][_0x37b9('0x48')]({'where':{'id':_0x2fc7da[_0x37b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x5841e8,null))['then'](saveUpdates(_0x2fc7da[_0x37b9('0x4a')],null))[_0x37b9('0x25')](respondWithResult(_0x5841e8,null))[_0x37b9('0x42')](handleError(_0x5841e8,null));};exports['destroy']=function(_0x473433,_0x3879d3){return db[_0x37b9('0x2e')][_0x37b9('0x48')]({'where':{'id':_0x473433[_0x37b9('0x44')]['id']}})[_0x37b9('0x25')](handleEntityNotFound(_0x3879d3,null))[_0x37b9('0x25')](removeEntity(_0x3879d3,null))['catch'](handleError(_0x3879d3,null));};exports[_0x37b9('0x51')]=function(_0x1fda45,_0x2efc84,_0x69fda4){if(_0x1fda45[_0x37b9('0x4a')]['id']){delete _0x1fda45[_0x37b9('0x4a')]['id'];}return db[_0x37b9('0x2e')][_0x37b9('0x48')]({'where':{'id':_0x1fda45['params']['id']}})[_0x37b9('0x25')](handleEntityNotFound(_0x2efc84,null))[_0x37b9('0x25')](function(_0x3ea5f7){if(_0x3ea5f7){_0x1fda45['body']['TriggerAllId']=_0x3ea5f7['id'];return db[_0x37b9('0x52')]['create'](_0x1fda45['body']);}})[_0x37b9('0x25')](respondWithResult(_0x2efc84,null))[_0x37b9('0x42')](handleError(_0x2efc84,null));};exports['addAnyCondition']=function(_0x2f1b19,_0x34f740,_0x3d4afb){if(_0x2f1b19[_0x37b9('0x4a')]['id']){delete _0x2f1b19['body']['id'];}return db['Trigger'][_0x37b9('0x48')]({'where':{'id':_0x2f1b19[_0x37b9('0x44')]['id']}})[_0x37b9('0x25')](handleEntityNotFound(_0x34f740,null))['then'](function(_0x530cee){if(_0x530cee){_0x2f1b19[_0x37b9('0x4a')]['TriggerAnyId']=_0x530cee['id'];return db[_0x37b9('0x52')][_0x37b9('0x49')](_0x2f1b19['body']);}})['then'](respondWithResult(_0x34f740,null))[_0x37b9('0x42')](handleError(_0x34f740,null));};exports['getAllConditions']=function(_0x10cc03,_0x546086,_0x4ca795){var _0x22e6d0={};var _0x6aec7a={};var _0x3ee4e9;var _0x4ebecf;return db[_0x37b9('0x2e')][_0x37b9('0x53')]({'where':{'id':_0x10cc03['params']['id']}})[_0x37b9('0x25')](handleEntityNotFound(_0x546086,null))[_0x37b9('0x25')](function(_0xd0e6a3){if(_0xd0e6a3){_0x3ee4e9=_0xd0e6a3;_0x6aec7a['model']=_['keys'](db[_0x37b9('0x52')]['rawAttributes']);_0x6aec7a[_0x37b9('0x31')]=_[_0x37b9('0x32')](_0x10cc03[_0x37b9('0x31')]);_0x6aec7a['filters']=_[_0x37b9('0x34')](_0x6aec7a[_0x37b9('0x35')],_0x6aec7a[_0x37b9('0x31')]);_0x22e6d0[_0x37b9('0x36')]=_[_0x37b9('0x34')](_0x6aec7a['model'],qs['fields'](_0x10cc03[_0x37b9('0x31')][_0x37b9('0x37')]));_0x22e6d0[_0x37b9('0x36')]=_0x22e6d0['attributes'][_0x37b9('0x38')]?_0x22e6d0[_0x37b9('0x36')]:_0x6aec7a[_0x37b9('0x35')];_0x22e6d0[_0x37b9('0x54')]=qs[_0x37b9('0x3a')](_0x10cc03[_0x37b9('0x31')]['sort']);_0x22e6d0[_0x37b9('0x3c')]=qs[_0x37b9('0x33')](_[_0x37b9('0x55')](_0x10cc03['query'],_0x6aec7a[_0x37b9('0x33')]));if(_0x10cc03[_0x37b9('0x31')][_0x37b9('0x3b')]){_0x22e6d0[_0x37b9('0x3c')]=_['merge'](_0x22e6d0['where'],{'$or':_[_0x37b9('0x2d')](_0x22e6d0['attributes'],function(_0x17c21e){var _0x227981={};_0x227981[_0x17c21e]={'$like':'%'+_0x10cc03[_0x37b9('0x31')][_0x37b9('0x3b')]+'%'};return _0x227981;})});}_0x22e6d0=_[_0x37b9('0x3d')]({},_0x22e6d0,_0x10cc03[_0x37b9('0x47')]);return _0x3ee4e9[_0x37b9('0x56')](_0x22e6d0);}})[_0x37b9('0x25')](function(_0x4c02f6){if(_0x4c02f6){_0x4ebecf=_0x4c02f6[_0x37b9('0x38')];if(!_0x10cc03[_0x37b9('0x31')][_0x37b9('0x57')](_0x37b9('0x39'))){_0x22e6d0[_0x37b9('0x1e')]=qs[_0x37b9('0x1e')](_0x10cc03[_0x37b9('0x31')]['limit']);_0x22e6d0[_0x37b9('0x1b')]=qs['offset'](_0x10cc03[_0x37b9('0x31')]['offset']);}return _0x3ee4e9[_0x37b9('0x56')](_0x22e6d0);}})[_0x37b9('0x25')](function(_0x49dde4){if(_0x49dde4){return _0x49dde4?{'count':_0x4ebecf,'rows':_0x49dde4}:null;}})['then'](respondWithResult(_0x546086,null))[_0x37b9('0x42')](handleError(_0x546086,null));};exports['getAnyConditions']=function(_0x591a09,_0x391099,_0x53fb67){var _0x2a3a3b={};var _0x29f61a={};var _0x34f358;var _0x3d3550;return db[_0x37b9('0x2e')]['findOne']({'where':{'id':_0x591a09[_0x37b9('0x44')]['id']}})[_0x37b9('0x25')](handleEntityNotFound(_0x391099,null))[_0x37b9('0x25')](function(_0x5ca677){if(_0x5ca677){_0x34f358=_0x5ca677;_0x29f61a[_0x37b9('0x35')]=_[_0x37b9('0x32')](db[_0x37b9('0x52')][_0x37b9('0x45')]);_0x29f61a[_0x37b9('0x31')]=_[_0x37b9('0x32')](_0x591a09['query']);_0x29f61a[_0x37b9('0x33')]=_[_0x37b9('0x34')](_0x29f61a[_0x37b9('0x35')],_0x29f61a[_0x37b9('0x31')]);_0x2a3a3b[_0x37b9('0x36')]=_[_0x37b9('0x34')](_0x29f61a[_0x37b9('0x35')],qs['fields'](_0x591a09[_0x37b9('0x31')]['fields']));_0x2a3a3b[_0x37b9('0x36')]=_0x2a3a3b[_0x37b9('0x36')][_0x37b9('0x38')]?_0x2a3a3b[_0x37b9('0x36')]:_0x29f61a[_0x37b9('0x35')];_0x2a3a3b[_0x37b9('0x54')]=qs['sort'](_0x591a09[_0x37b9('0x31')][_0x37b9('0x3a')]);_0x2a3a3b[_0x37b9('0x3c')]=qs[_0x37b9('0x33')](_[_0x37b9('0x55')](_0x591a09[_0x37b9('0x31')],_0x29f61a[_0x37b9('0x33')]));if(_0x591a09[_0x37b9('0x31')][_0x37b9('0x3b')]){_0x2a3a3b[_0x37b9('0x3c')]=_['merge'](_0x2a3a3b['where'],{'$or':_[_0x37b9('0x2d')](_0x2a3a3b[_0x37b9('0x36')],function(_0x269834){var _0x4c73af={};_0x4c73af[_0x269834]={'$like':'%'+_0x591a09['query'][_0x37b9('0x3b')]+'%'};return _0x4c73af;})});}_0x2a3a3b=_[_0x37b9('0x3d')]({},_0x2a3a3b,_0x591a09[_0x37b9('0x47')]);return _0x34f358[_0x37b9('0x58')](_0x2a3a3b);}})[_0x37b9('0x25')](function(_0x468f3b){if(_0x468f3b){_0x3d3550=_0x468f3b[_0x37b9('0x38')];if(!_0x591a09['query'][_0x37b9('0x57')](_0x37b9('0x39'))){_0x2a3a3b[_0x37b9('0x1e')]=qs['limit'](_0x591a09[_0x37b9('0x31')]['limit']);_0x2a3a3b[_0x37b9('0x1b')]=qs[_0x37b9('0x1b')](_0x591a09[_0x37b9('0x31')][_0x37b9('0x1b')]);}return _0x34f358[_0x37b9('0x58')](_0x2a3a3b);}})[_0x37b9('0x25')](function(_0x589106){if(_0x589106){return _0x589106?{'count':_0x3d3550,'rows':_0x589106}:null;}})[_0x37b9('0x25')](respondWithResult(_0x391099,null))['catch'](handleError(_0x391099,null));};exports[_0x37b9('0x59')]=function(_0x37caaf,_0x241ca3,_0x3780fd){if(_0x37caaf[_0x37b9('0x4a')]['id']){delete _0x37caaf[_0x37b9('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x37caaf[_0x37b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x241ca3,null))[_0x37b9('0x25')](function(_0x2d34cb){if(_0x2d34cb){_0x37caaf['body'][_0x37b9('0x5a')]=_0x2d34cb['id'];return db['Action'][_0x37b9('0x49')](_0x37caaf['body']);}})['then'](respondWithResult(_0x241ca3,null))['catch'](handleError(_0x241ca3,null));};exports[_0x37b9('0x5b')]=function(_0x916175,_0x2cdc89,_0xd8b6f0){var _0x719df2={};var _0xde9322={};var _0x40b40e;var _0x4af670;return db['Trigger']['findOne']({'where':{'id':_0x916175[_0x37b9('0x44')]['id']}})[_0x37b9('0x25')](handleEntityNotFound(_0x2cdc89,null))[_0x37b9('0x25')](function(_0x165314){if(_0x165314){_0x40b40e=_0x165314;_0xde9322[_0x37b9('0x35')]=_[_0x37b9('0x32')](db[_0x37b9('0x5c')][_0x37b9('0x45')]);_0xde9322[_0x37b9('0x31')]=_[_0x37b9('0x32')](_0x916175[_0x37b9('0x31')]);_0xde9322[_0x37b9('0x33')]=_[_0x37b9('0x34')](_0xde9322[_0x37b9('0x35')],_0xde9322[_0x37b9('0x31')]);_0x719df2[_0x37b9('0x36')]=_[_0x37b9('0x34')](_0xde9322[_0x37b9('0x35')],qs[_0x37b9('0x37')](_0x916175[_0x37b9('0x31')][_0x37b9('0x37')]));_0x719df2[_0x37b9('0x36')]=_0x719df2[_0x37b9('0x36')][_0x37b9('0x38')]?_0x719df2[_0x37b9('0x36')]:_0xde9322[_0x37b9('0x35')];_0x719df2[_0x37b9('0x54')]=qs[_0x37b9('0x3a')](_0x916175[_0x37b9('0x31')][_0x37b9('0x3a')]);_0x719df2[_0x37b9('0x3c')]=qs[_0x37b9('0x33')](_[_0x37b9('0x55')](_0x916175[_0x37b9('0x31')],_0xde9322[_0x37b9('0x33')]));if(_0x916175[_0x37b9('0x31')]['filter']){_0x719df2['where']=_[_0x37b9('0x3d')](_0x719df2[_0x37b9('0x3c')],{'$or':_[_0x37b9('0x2d')](_0x719df2[_0x37b9('0x36')],function(_0x291be2){var _0x254bd8={};_0x254bd8[_0x291be2]={'$like':'%'+_0x916175[_0x37b9('0x31')][_0x37b9('0x3b')]+'%'};return _0x254bd8;})});}_0x719df2=_['merge']({},_0x719df2,_0x916175[_0x37b9('0x47')]);return _0x40b40e['getActions'](_0x719df2);}})[_0x37b9('0x25')](function(_0x187246){if(_0x187246){_0x4af670=_0x187246[_0x37b9('0x38')];if(!_0x916175[_0x37b9('0x31')][_0x37b9('0x57')](_0x37b9('0x39'))){_0x719df2[_0x37b9('0x1e')]=qs['limit'](_0x916175[_0x37b9('0x31')][_0x37b9('0x1e')]);_0x719df2[_0x37b9('0x1b')]=qs[_0x37b9('0x1b')](_0x916175[_0x37b9('0x31')]['offset']);}return _0x40b40e[_0x37b9('0x5b')](_0x719df2);}})['then'](function(_0x47c1a2){if(_0x47c1a2){return _0x47c1a2?{'count':_0x4af670,'rows':_0x47c1a2}:null;}})['then'](respondWithResult(_0x2cdc89,null))[_0x37b9('0x42')](handleError(_0x2cdc89,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8ceef69..572d4c9 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 _0x3ee5=['rimraf','../../config/environment','./trigger.attributes','exports','define','tools_triggers','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x4af753,_0x592a92){_0x4af753=_0x4af753-0x0;var _0x1c8b1b=_0x3ee5[_0x4af753];return _0x1c8b1b;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var logger=require(_0x53ee('0x1'))('api');var moment=require(_0x53ee('0x2'));var BPromise=require(_0x53ee('0x3'));var rp=require(_0x53ee('0x4'));var fs=require('fs');var path=require(_0x53ee('0x5'));var rimraf=require(_0x53ee('0x6'));var config=require(_0x53ee('0x7'));var attributes=require(_0x53ee('0x8'));module[_0x53ee('0x9')]=function(_0x343bbb,_0x16ad68){return _0x343bbb[_0x53ee('0xa')]('Trigger',attributes,{'tableName':_0x53ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0be3=['tools_triggers','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','define'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x0be3,0x9a));var _0x30be=function(_0x1cc4e1,_0x1629d4){_0x1cc4e1=_0x1cc4e1-0x0;var _0x192d47=_0x0be3[_0x1cc4e1];return _0x192d47;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x30be('0x0'))(_0x30be('0x1'));var moment=require(_0x30be('0x2'));var BPromise=require('bluebird');var rp=require(_0x30be('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30be('0x4'));var config=require(_0x30be('0x5'));var attributes=require(_0x30be('0x6'));module['exports']=function(_0x47ef09,_0x429488){return _0x47ef09[_0x30be('0x7')]('Trigger',attributes,{'tableName':_0x30be('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 1a1a6b4..e7c7ea8 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 _0xa4b6=['message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowTrigger','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d4085,_0x236a28){var _0x4f78cb=function(_0x5cca18){while(--_0x5cca18){_0x2d4085['push'](_0x2d4085['shift']());}};_0x4f78cb(++_0x236a28);}(_0xa4b6,0x7f));var _0x6a4b=function(_0x4126ec,_0x4fd9c4){_0x4126ec=_0x4126ec-0x0;var _0x550a4e=_0xa4b6[_0x4126ec];return _0x550a4e;};'use strict';var _=require('lodash');var util=require(_0x6a4b('0x0'));var moment=require(_0x6a4b('0x1'));var BPromise=require(_0x6a4b('0x2'));var rs=require(_0x6a4b('0x3'));var fs=require('fs');var Redis=require(_0x6a4b('0x4'));var db=require(_0x6a4b('0x5'))['db'];var utils=require(_0x6a4b('0x6'));var logger=require(_0x6a4b('0x7'))(_0x6a4b('0x8'));var config=require(_0x6a4b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6a4b('0xa')][_0x6a4b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x124164,_0x36f8e8,_0x382fdc){return new BPromise(function(_0x53b613,_0x3e4c73){return client[_0x6a4b('0xc')](_0x124164,_0x382fdc)['then'](function(_0x5f02ac){logger[_0x6a4b('0xd')](_0x6a4b('0xe'),_0x36f8e8,_0x6a4b('0xf'));logger[_0x6a4b('0x10')](_0x6a4b('0x11'),_0x36f8e8,_0x6a4b('0xf'),JSON[_0x6a4b('0x12')](_0x5f02ac));if(_0x5f02ac[_0x6a4b('0x13')]){if(_0x5f02ac[_0x6a4b('0x13')][_0x6a4b('0x14')]===0x1f4){logger[_0x6a4b('0x13')](_0x6a4b('0xe'),_0x36f8e8,_0x5f02ac[_0x6a4b('0x13')]['message']);return _0x3e4c73(_0x5f02ac['error'][_0x6a4b('0x15')]);}logger['error'](_0x6a4b('0xe'),_0x36f8e8,_0x5f02ac[_0x6a4b('0x13')][_0x6a4b('0x15')]);return _0x53b613(_0x5f02ac[_0x6a4b('0x13')][_0x6a4b('0x15')]);}else{logger['info'](_0x6a4b('0xe'),_0x36f8e8,_0x6a4b('0xf'));_0x53b613(_0x5f02ac[_0x6a4b('0x16')]['message']);}})['catch'](function(_0x58da3a){logger['error'](_0x6a4b('0xe'),_0x36f8e8,_0x58da3a);_0x3e4c73(_0x58da3a);});});}exports[_0x6a4b('0x17')]=function(_0x5c5004){var _0x3c0bf6=this;return new Promise(function(_0x40185d,_0x40f77e){return db[_0x6a4b('0x18')][_0x6a4b('0x19')]({'raw':_0x5c5004[_0x6a4b('0x1a')]?_0x5c5004['options'][_0x6a4b('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c5004[_0x6a4b('0x1a')]?_0x5c5004[_0x6a4b('0x1a')][_0x6a4b('0x1c')]||null:null,'attributes':_0x5c5004[_0x6a4b('0x1a')]?_0x5c5004[_0x6a4b('0x1a')][_0x6a4b('0x1d')]||null:null,'limit':_0x5c5004[_0x6a4b('0x1a')]?_0x5c5004[_0x6a4b('0x1a')][_0x6a4b('0x1e')]||null:null,'include':_0x5c5004[_0x6a4b('0x1a')]?_0x5c5004[_0x6a4b('0x1a')][_0x6a4b('0x1f')]?_[_0x6a4b('0x20')](_0x5c5004['options'][_0x6a4b('0x1f')],function(_0x58db90){return{'model':db[_0x58db90[_0x6a4b('0x21')]],'as':_0x58db90['as'],'attributes':_0x58db90[_0x6a4b('0x1d')],'include':_0x58db90[_0x6a4b('0x1f')]?_['map'](_0x58db90[_0x6a4b('0x1f')],function(_0x1f7b45){return{'model':db[_0x1f7b45[_0x6a4b('0x21')]],'as':_0x1f7b45['as'],'attributes':_0x1f7b45[_0x6a4b('0x1d')],'include':_0x1f7b45['include']?_[_0x6a4b('0x20')](_0x1f7b45[_0x6a4b('0x1f')],function(_0x29acc){return{'model':db[_0x29acc['model']],'as':_0x29acc['as'],'attributes':_0x29acc[_0x6a4b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6a4b('0x22')](function(_0x2fb753){logger['info'](_0x6a4b('0x17'),_0x5c5004);logger[_0x6a4b('0x10')](_0x6a4b('0x17'),_0x5c5004,JSON['stringify'](_0x2fb753));_0x40185d(_0x2fb753);})['catch'](function(_0x955cbf){logger[_0x6a4b('0x13')](_0x6a4b('0x17'),_0x955cbf[_0x6a4b('0x15')],_0x5c5004);_0x40f77e(_0x3c0bf6['error'](0x1f4,_0x955cbf['message']));});});};exports[_0x6a4b('0x23')]=function(_0x4c59ee){var _0xebdf0d=this;return new Promise(function(_0x11aeb3,_0x4063c3){return db[_0x6a4b('0x18')][_0x6a4b('0x24')]({'raw':_0x4c59ee[_0x6a4b('0x1a')]?_0x4c59ee[_0x6a4b('0x1a')][_0x6a4b('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c59ee[_0x6a4b('0x1a')]?_0x4c59ee[_0x6a4b('0x1a')][_0x6a4b('0x1c')]||null:null,'attributes':_0x4c59ee[_0x6a4b('0x1a')]?_0x4c59ee[_0x6a4b('0x1a')][_0x6a4b('0x1d')]||null:null,'include':_0x4c59ee[_0x6a4b('0x1a')]?_0x4c59ee['options']['include']?_['map'](_0x4c59ee[_0x6a4b('0x1a')]['include'],function(_0x1029f8){return{'model':db[_0x1029f8[_0x6a4b('0x21')]],'as':_0x1029f8['as'],'attributes':_0x1029f8[_0x6a4b('0x1d')],'include':_0x1029f8[_0x6a4b('0x1f')]?_[_0x6a4b('0x20')](_0x1029f8[_0x6a4b('0x1f')],function(_0x1aad19){return{'model':db[_0x1aad19['model']],'as':_0x1aad19['as'],'attributes':_0x1aad19[_0x6a4b('0x1d')],'include':_0x1aad19[_0x6a4b('0x1f')]?_[_0x6a4b('0x20')](_0x1aad19['include'],function(_0x3abe6d){return{'model':db[_0x3abe6d[_0x6a4b('0x21')]],'as':_0x3abe6d['as'],'attributes':_0x3abe6d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6a4b('0x22')](function(_0xe7c66d){logger[_0x6a4b('0xd')](_0x6a4b('0x23'),_0x4c59ee);logger[_0x6a4b('0x10')](_0x6a4b('0x23'),_0x4c59ee,JSON[_0x6a4b('0x12')](_0xe7c66d));_0x11aeb3(_0xe7c66d);})['catch'](function(_0x57a927){logger[_0x6a4b('0x13')](_0x6a4b('0x23'),_0x57a927[_0x6a4b('0x15')],_0x4c59ee);_0x4063c3(_0xebdf0d[_0x6a4b('0x13')](0x1f4,_0x57a927[_0x6a4b('0x15')]));});});}; \ No newline at end of file +var _0x97e7=['jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x52759d,_0x12742e){var _0x1fbf40=function(_0x1dd420){while(--_0x1dd420){_0x52759d['push'](_0x52759d['shift']());}};_0x1fbf40(++_0x12742e);}(_0x97e7,0xf4));var _0x797e=function(_0x136e93,_0x354e52){_0x136e93=_0x136e93-0x0;var _0x3488f2=_0x97e7[_0x136e93];return _0x3488f2;};'use strict';var _=require(_0x797e('0x0'));var util=require(_0x797e('0x1'));var moment=require(_0x797e('0x2'));var BPromise=require('bluebird');var rs=require(_0x797e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x797e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x797e('0x5'))(_0x797e('0x6'));var config=require(_0x797e('0x7'));var jayson=require(_0x797e('0x8'));var client=jayson[_0x797e('0x9')][_0x797e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10233b,_0x370c5e,_0x1799c0){return new BPromise(function(_0x2ac9f9,_0x4b08d2){return client[_0x797e('0xb')](_0x10233b,_0x1799c0)[_0x797e('0xc')](function(_0x4c5953){logger[_0x797e('0xd')]('Trigger,\x20%s,\x20%s',_0x370c5e,_0x797e('0xe'));logger[_0x797e('0xf')](_0x797e('0x10'),_0x370c5e,_0x797e('0xe'),JSON[_0x797e('0x11')](_0x4c5953));if(_0x4c5953[_0x797e('0x12')]){if(_0x4c5953['error']['code']===0x1f4){logger[_0x797e('0x12')](_0x797e('0x13'),_0x370c5e,_0x4c5953[_0x797e('0x12')][_0x797e('0x14')]);return _0x4b08d2(_0x4c5953['error'][_0x797e('0x14')]);}logger[_0x797e('0x12')](_0x797e('0x13'),_0x370c5e,_0x4c5953[_0x797e('0x12')][_0x797e('0x14')]);return _0x2ac9f9(_0x4c5953['error']['message']);}else{logger[_0x797e('0xd')](_0x797e('0x13'),_0x370c5e,'request\x20sent');_0x2ac9f9(_0x4c5953[_0x797e('0x15')][_0x797e('0x14')]);}})[_0x797e('0x16')](function(_0x28f4bd){logger[_0x797e('0x12')](_0x797e('0x13'),_0x370c5e,_0x28f4bd);_0x4b08d2(_0x28f4bd);});});}exports[_0x797e('0x17')]=function(_0x371bb5){var _0x1a286d=this;return new Promise(function(_0x3699b3,_0x2f0b5e){return db[_0x797e('0x18')][_0x797e('0x19')]({'raw':_0x371bb5['options']?_0x371bb5[_0x797e('0x1a')][_0x797e('0x1b')]===undefined?!![]:![]:!![],'where':_0x371bb5[_0x797e('0x1a')]?_0x371bb5[_0x797e('0x1a')][_0x797e('0x1c')]||null:null,'attributes':_0x371bb5[_0x797e('0x1a')]?_0x371bb5[_0x797e('0x1a')][_0x797e('0x1d')]||null:null,'limit':_0x371bb5['options']?_0x371bb5[_0x797e('0x1a')][_0x797e('0x1e')]||null:null,'include':_0x371bb5[_0x797e('0x1a')]?_0x371bb5['options'][_0x797e('0x1f')]?_[_0x797e('0x20')](_0x371bb5['options'][_0x797e('0x1f')],function(_0xa3ca4d){return{'model':db[_0xa3ca4d[_0x797e('0x21')]],'as':_0xa3ca4d['as'],'attributes':_0xa3ca4d[_0x797e('0x1d')],'include':_0xa3ca4d[_0x797e('0x1f')]?_['map'](_0xa3ca4d[_0x797e('0x1f')],function(_0x4fcdfa){return{'model':db[_0x4fcdfa[_0x797e('0x21')]],'as':_0x4fcdfa['as'],'attributes':_0x4fcdfa[_0x797e('0x1d')],'include':_0x4fcdfa[_0x797e('0x1f')]?_[_0x797e('0x20')](_0x4fcdfa[_0x797e('0x1f')],function(_0x1b17a3){return{'model':db[_0x1b17a3[_0x797e('0x21')]],'as':_0x1b17a3['as'],'attributes':_0x1b17a3[_0x797e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c3767){logger[_0x797e('0xd')]('GetTrigger',_0x371bb5);logger[_0x797e('0xf')](_0x797e('0x17'),_0x371bb5,JSON[_0x797e('0x11')](_0x4c3767));_0x3699b3(_0x4c3767);})[_0x797e('0x16')](function(_0x5e3b05){logger[_0x797e('0x12')](_0x797e('0x17'),_0x5e3b05[_0x797e('0x14')],_0x371bb5);_0x2f0b5e(_0x1a286d[_0x797e('0x12')](0x1f4,_0x5e3b05[_0x797e('0x14')]));});});};exports[_0x797e('0x22')]=function(_0xe6cee8){var _0x2411f1=this;return new Promise(function(_0x2095cd,_0x24368d){return db[_0x797e('0x18')][_0x797e('0x23')]({'raw':_0xe6cee8[_0x797e('0x1a')]?_0xe6cee8['options'][_0x797e('0x1b')]===undefined?!![]:![]:!![],'where':_0xe6cee8['options']?_0xe6cee8[_0x797e('0x1a')][_0x797e('0x1c')]||null:null,'attributes':_0xe6cee8[_0x797e('0x1a')]?_0xe6cee8['options'][_0x797e('0x1d')]||null:null,'include':_0xe6cee8[_0x797e('0x1a')]?_0xe6cee8[_0x797e('0x1a')][_0x797e('0x1f')]?_[_0x797e('0x20')](_0xe6cee8['options'][_0x797e('0x1f')],function(_0x5b7133){return{'model':db[_0x5b7133[_0x797e('0x21')]],'as':_0x5b7133['as'],'attributes':_0x5b7133[_0x797e('0x1d')],'include':_0x5b7133[_0x797e('0x1f')]?_[_0x797e('0x20')](_0x5b7133[_0x797e('0x1f')],function(_0xcd678b){return{'model':db[_0xcd678b['model']],'as':_0xcd678b['as'],'attributes':_0xcd678b[_0x797e('0x1d')],'include':_0xcd678b[_0x797e('0x1f')]?_[_0x797e('0x20')](_0xcd678b[_0x797e('0x1f')],function(_0x2fdcef){return{'model':db[_0x2fdcef[_0x797e('0x21')]],'as':_0x2fdcef['as'],'attributes':_0x2fdcef[_0x797e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x797e('0xc')](function(_0x3f41a4){logger[_0x797e('0xd')](_0x797e('0x22'),_0xe6cee8);logger[_0x797e('0xf')](_0x797e('0x22'),_0xe6cee8,JSON[_0x797e('0x11')](_0x3f41a4));_0x2095cd(_0x3f41a4);})['catch'](function(_0x5739fe){logger[_0x797e('0x12')](_0x797e('0x22'),_0x5739fe[_0x797e('0x14')],_0xe6cee8);_0x24368d(_0x2411f1['error'](0x1f4,_0x5739fe['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3f3349d..3e76cd4 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 _0xe4fa=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/clone','clone','create','/:id','update'];(function(_0x400a07,_0x22316f){var _0x24c9fb=function(_0x78e188){while(--_0x78e188){_0x400a07['push'](_0x400a07['shift']());}};_0x24c9fb(++_0x22316f);}(_0xe4fa,0x1f0));var _0xae4f=function(_0x448e60,_0xa612f2){_0x448e60=_0x448e60-0x0;var _0x1603a0=_0xe4fa[_0x448e60];return _0x1603a0;};'use strict';var multer=require(_0xae4f('0x0'));var util=require(_0xae4f('0x1'));var path=require(_0xae4f('0x2'));var timeout=require(_0xae4f('0x3'));var express=require(_0xae4f('0x4'));var router=express['Router']();var fs_extra=require(_0xae4f('0x5'));var auth=require(_0xae4f('0x6'));var interaction=require(_0xae4f('0x7'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0xae4f('0x8')]('/',auth[_0xae4f('0x9')](),controller[_0xae4f('0xa')]);router['get']('/:id',auth[_0xae4f('0x9')](),controller[_0xae4f('0xb')]);router['post'](_0xae4f('0xc'),auth[_0xae4f('0x9')](),controller[_0xae4f('0xd')]);router['post']('/',auth[_0xae4f('0x9')](),controller[_0xae4f('0xe')]);router['put'](_0xae4f('0xf'),auth['isAuthenticated'](),controller[_0xae4f('0x10')]);router[_0xae4f('0x11')]('/:id',auth[_0xae4f('0x9')](),controller[_0xae4f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7efb=['put','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create'];(function(_0x54856d,_0x51bb52){var _0x2d18a3=function(_0x5b46a2){while(--_0x5b46a2){_0x54856d['push'](_0x54856d['shift']());}};_0x2d18a3(++_0x51bb52);}(_0x7efb,0x1ce));var _0xb7ef=function(_0x1efad3,_0x4ca9f7){_0x1efad3=_0x1efad3-0x0;var _0xd2e003=_0x7efb[_0x1efad3];return _0xd2e003;};'use strict';var multer=require(_0xb7ef('0x0'));var util=require('util');var path=require(_0xb7ef('0x1'));var timeout=require(_0xb7ef('0x2'));var express=require(_0xb7ef('0x3'));var router=express[_0xb7ef('0x4')]();var fs_extra=require(_0xb7ef('0x5'));var auth=require(_0xb7ef('0x6'));var interaction=require(_0xb7ef('0x7'));var config=require('../../config/environment');var controller=require(_0xb7ef('0x8'));router[_0xb7ef('0x9')]('/',auth[_0xb7ef('0xa')](),controller[_0xb7ef('0xb')]);router[_0xb7ef('0x9')](_0xb7ef('0xc'),auth[_0xb7ef('0xa')](),controller[_0xb7ef('0xd')]);router[_0xb7ef('0xe')](_0xb7ef('0xf'),auth['isAuthenticated'](),controller[_0xb7ef('0x10')]);router[_0xb7ef('0xe')]('/',auth['isAuthenticated'](),controller[_0xb7ef('0x11')]);router[_0xb7ef('0x12')](_0xb7ef('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb7ef('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xb7ef('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index a7dc50e..ec06982 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 _0x9508=['STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','shortinfo','inband','auto','rfc2833','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac','uas','pai','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','exports'];(function(_0x304efc,_0x2c6a48){var _0x34e2b9=function(_0x327c24){while(--_0x327c24){_0x304efc['push'](_0x304efc['shift']());}};_0x34e2b9(++_0x2c6a48);}(_0x9508,0x148));var _0x8950=function(_0x2e6270,_0x31a6a0){_0x2e6270=_0x2e6270-0x0;var _0x1ceb6b=_0x9508[_0x2e6270];return _0x1ceb6b;};'use strict';var Sequelize=require('sequelize');module[_0x8950('0x0')]={'name':{'type':Sequelize[_0x8950('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x3'),_0x8950('0x4'),_0x8950('0x5')),'allowNull':![],'defaultValue':_0x8950('0x3')},'context':{'type':Sequelize[_0x8950('0x1')],'allowNull':![],'defaultValue':_0x8950('0x6')},'callingpres':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x7'),_0x8950('0x8'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x8950('0x9'),'PROHIB_PASSED_SCREEN',_0x8950('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0x8950('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x8950('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x8950('0x1')]},'transport':{'type':Sequelize[_0x8950('0x1')],'defaultValue':_0x8950('0xb'),'set':function(_0x1d99fd){this[_0x8950('0xc')](_0x8950('0xd'),_0x1d99fd?_0x1d99fd[_0x8950('0xe')](','):null);},'get':function(){return this[_0x8950('0xf')]('transport')?this[_0x8950('0xf')](_0x8950('0xd'))[_0x8950('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x8950('0x2')]('rfc2833','info',_0x8950('0x11'),_0x8950('0x12'),_0x8950('0x13')),'defaultValue':_0x8950('0x14')},'directmedia':{'type':Sequelize[_0x8950('0x2')]('yes','no',_0x8950('0x15'),_0x8950('0x16'),_0x8950('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8950('0x1')]},'directmediadeny':{'type':Sequelize[_0x8950('0x1')]},'nat':{'type':Sequelize[_0x8950('0x1')],'defaultValue':_0x8950('0x19'),'set':function(_0xb29146){this[_0x8950('0xc')](_0x8950('0x1a'),_0xb29146?_0xb29146[_0x8950('0xe')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x8950('0xf')](_0x8950('0x1a'))[_0x8950('0x10')](','):null;},'comment':_0x8950('0x1b')},'callgroup':{'type':Sequelize[_0x8950('0x1')]},'namedcallgroup':{'type':Sequelize[_0x8950('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x8950('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8950('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x8950('0x1')],'defaultValue':_0x8950('0x1c')},'allow':{'type':Sequelize[_0x8950('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3993ea){this[_0x8950('0xc')](_0x8950('0x1d'),_0x3993ea?_0x3993ea[_0x8950('0xe')](';'):_0x8950('0x1e'));},'get':function(){return this['getDataValue'](_0x8950('0x1d'))?this[_0x8950('0xf')](_0x8950('0x1d'))[_0x8950('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no')},'insecure':{'type':Sequelize[_0x8950('0x1')],'defaultValue':'port,invite','set':function(_0x3e19cd){this[_0x8950('0xc')]('insecure',_0x3e19cd?_0x3e19cd[_0x8950('0xe')](','):null);},'get':function(){return this[_0x8950('0xf')](_0x8950('0x1f'))?this[_0x8950('0xf')](_0x8950('0x1f'))[_0x8950('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x8950('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x8950('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x8950('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x8950('0x1')]},'callerid':{'type':Sequelize[_0x8950('0x1')],'defaultValue':_0x8950('0x20')},'amaflags':{'type':Sequelize[_0x8950('0x1')]},'callcounter':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no'),'defaultValue':_0x8950('0x18')},'busylevel':{'type':Sequelize[_0x8950('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x8950('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x8950('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x8950('0x1')]},'template':{'type':Sequelize[_0x8950('0x1')]},'videosupport':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no',_0x8950('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8950('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no')},'mailbox':{'type':Sequelize[_0x8950('0x1')]},'session_timers':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x23'),_0x8950('0x24'),_0x8950('0x25'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x8950('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x26'),_0x8950('0x27')),'defaultValue':_0x8950('0x27')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x8950('0x1')]},'fromdomain':{'type':Sequelize[_0x8950('0x1')]},'fromuser':{'type':Sequelize[_0x8950('0x1')]},'port':{'type':Sequelize[_0x8950('0x21')](0x5)},'qualify':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no'),'defaultValue':_0x8950('0x18')},'keepalive':{'type':Sequelize[_0x8950('0x21')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x8950('0x1')]},'rtptimeout':{'type':Sequelize[_0x8950('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x8950('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x8950('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no',_0x8950('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x8950('0x21')](0xb)},'timerb':{'type':Sequelize[_0x8950('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x8950('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x8950('0x1')]},'contactdeny':{'type':Sequelize[_0x8950('0x1')]},'contactacl':{'type':Sequelize[_0x8950('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x8950('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x8950('0x21')](0xb)},'encryption':{'type':Sequelize[_0x8950('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no')},'force_avp':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no')},'icesupport':{'type':Sequelize[_0x8950('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x8950('0x18'),'no','fingerprint',_0x8950('0x29'))},'dtlsrekey':{'type':Sequelize[_0x8950('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x8950('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x8950('0x1')]},'dtlscipher':{'type':Sequelize[_0x8950('0x1')]},'dtlscafile':{'type':Sequelize[_0x8950('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x8950('0x2')]('active',_0x8950('0x2a'),_0x8950('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8950('0x1')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8950('0x1')]},'recordofffeature':{'type':Sequelize[_0x8950('0x1')]},'call_limit':{'type':Sequelize[_0x8950('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x8950('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no')},'vmexten':{'type':Sequelize[_0x8950('0x1')]},'mohinterpret':{'type':Sequelize[_0x8950('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x8950('0x1')]},'description':{'type':Sequelize[_0x8950('0x1')]},'host':{'type':Sequelize[_0x8950('0x1')],'defaultValue':_0x8950('0x2c')},'canreinvite':{'type':Sequelize[_0x8950('0x2')](_0x8950('0x18'),'no','nonat',_0x8950('0x16'),_0x8950('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x8950('0x1')]},'active':{'type':Sequelize[_0x8950('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x9a5d=['ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','INTEGER','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','join','getDataValue','transport','split','rfc2833','shortinfo','auto','yes','nonat','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x9a5d,0x104));var _0xd9a5=function(_0x13db05,_0x10ea87){_0x13db05=_0x13db05-0x0;var _0x1c2d6d=_0x9a5d[_0x13db05];return _0x1c2d6d;};'use strict';var Sequelize=require(_0xd9a5('0x0'));module[_0xd9a5('0x1')]={'name':{'type':Sequelize[_0xd9a5('0x2')],'allowNull':![],'unique':_0xd9a5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x5'),_0xd9a5('0x6'),_0xd9a5('0x7')),'allowNull':![],'defaultValue':_0xd9a5('0x5')},'context':{'type':Sequelize[_0xd9a5('0x2')],'allowNull':![],'defaultValue':_0xd9a5('0x8')},'callingpres':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x9'),_0xd9a5('0xa'),_0xd9a5('0xb'),'ALLOWED',_0xd9a5('0xc'),_0xd9a5('0xd'),_0xd9a5('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0xd9a5('0x2')]},'permit':{'type':Sequelize[_0xd9a5('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xd9a5('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x59b173){this[_0xd9a5('0xf')]('transport',_0x59b173?_0x59b173[_0xd9a5('0x10')](','):null);},'get':function(){return this[_0xd9a5('0x11')](_0xd9a5('0x12'))?this[_0xd9a5('0x11')](_0xd9a5('0x12'))[_0xd9a5('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x14'),'info',_0xd9a5('0x15'),'inband',_0xd9a5('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no',_0xd9a5('0x18'),'update',_0xd9a5('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xd9a5('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xd9a5('0x2')]},'nat':{'type':Sequelize[_0xd9a5('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x210967){this[_0xd9a5('0xf')](_0xd9a5('0x1a'),_0x210967?_0x210967['join'](','):null);},'get':function(){return this[_0xd9a5('0x11')](_0xd9a5('0x1a'))?this[_0xd9a5('0x11')](_0xd9a5('0x1a'))[_0xd9a5('0x13')](','):null;},'comment':_0xd9a5('0x1b')},'callgroup':{'type':Sequelize[_0xd9a5('0x2')]},'namedcallgroup':{'type':Sequelize[_0xd9a5('0x2')]},'pickupgroup':{'type':Sequelize[_0xd9a5('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xd9a5('0x2')]},'language':{'type':Sequelize[_0xd9a5('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd9a5('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd9a5('0x1c'),'set':function(_0x3033d6){this[_0xd9a5('0xf')]('allow',_0x3033d6?_0x3033d6[_0xd9a5('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xd9a5('0x11')](_0xd9a5('0x1d'))?this['getDataValue'](_0xd9a5('0x1d'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xd9a5('0x17'),'no')},'insecure':{'type':Sequelize[_0xd9a5('0x2')],'defaultValue':_0xd9a5('0x1e'),'set':function(_0xfe22f8){this[_0xd9a5('0xf')]('insecure',_0xfe22f8?_0xfe22f8[_0xd9a5('0x10')](','):null);},'get':function(){return this[_0xd9a5('0x11')](_0xd9a5('0x1f'))?this[_0xd9a5('0x11')](_0xd9a5('0x1f'))[_0xd9a5('0x13')](','):null;},'comment':_0xd9a5('0x20')},'trustrpid':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd9a5('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd9a5('0x2')],'defaultValue':_0xd9a5('0x21')},'amaflags':{'type':Sequelize[_0xd9a5('0x2')]},'callcounter':{'type':Sequelize[_0xd9a5('0x4')]('yes','no'),'defaultValue':_0xd9a5('0x17')},'busylevel':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xd9a5('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xd9a5('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd9a5('0x17'),'no')},'mailbox':{'type':Sequelize[_0xd9a5('0x2')]},'session_timers':{'type':Sequelize[_0xd9a5('0x4')]('accept',_0xd9a5('0x23'),_0xd9a5('0x24'))},'session_expires':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'session_minse':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0xd9a5('0x4')]('uac',_0xd9a5('0x25')),'defaultValue':_0xd9a5('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0xd9a5('0x2')]},'regexten':{'type':Sequelize[_0xd9a5('0x2')]},'fromdomain':{'type':Sequelize[_0xd9a5('0x2')]},'fromuser':{'type':Sequelize[_0xd9a5('0x2')]},'port':{'type':Sequelize[_0xd9a5('0x22')](0x5)},'qualify':{'type':Sequelize[_0xd9a5('0x4')]('yes','no'),'defaultValue':_0xd9a5('0x17')},'keepalive':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xd9a5('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no',_0xd9a5('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd9a5('0x2')]},'callbackextension':{'type':Sequelize[_0xd9a5('0x2')]},'timert1':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'timerb':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0xd9a5('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xd9a5('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xd9a5('0x2')]},'use_q850_reason':{'type':Sequelize[_0xd9a5('0x2')]},'maxforwards':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'encryption':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no')},'force_avp':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no')},'icesupport':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0xd9a5('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0xd9a5('0x27'),_0xd9a5('0x28'))},'dtlsrekey':{'type':Sequelize[_0xd9a5('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd9a5('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xd9a5('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xd9a5('0x2')]},'dtlscapath':{'type':Sequelize[_0xd9a5('0x2')]},'dtlssetup':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x29'),_0xd9a5('0x2a'),_0xd9a5('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xd9a5('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xd9a5('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xd9a5('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xd9a5('0x2')]},'description':{'type':Sequelize[_0xd9a5('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xd9a5('0x2c')},'canreinvite':{'type':Sequelize[_0xd9a5('0x4')](_0xd9a5('0x17'),'no','nonat',_0xd9a5('0x2d'),_0xd9a5('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xd9a5('0x2')]},'active':{'type':Sequelize[_0xd9a5('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd9a5('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 b0d0297..7081596 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 _0xf3cd=['length','limit','sort','where','filter','merge','options','Trunk','includeAll','include','findAll','show','find','clone','createdAt','updatedAt','omit','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','offset','count','json','reject','save','update','get','UserProfileResource','destroy','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3d4d8e,_0x4a450e){var _0x245fd4=function(_0x11fb54){while(--_0x11fb54){_0x3d4d8e['push'](_0x3d4d8e['shift']());}};_0x245fd4(++_0x4a450e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0xf3cd[_0x2389bc];return _0x170548;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdf3c('0x1a'));var client=jayson[_0xdf3c('0x1b')][_0xdf3c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17319c,_0x59e431,_0x2ae4ad,_0x461079){return new BPromise(function(_0x13ea5f,_0x5e0047){var _0x18aafa=_0x461079||client;return _0x18aafa[_0xdf3c('0x1d')](_0x17319c,_0x2ae4ad)[_0xdf3c('0x1e')](function(_0x4274fd){logger[_0xdf3c('0x1f')](_0xdf3c('0x20'),_0x59e431,_0xdf3c('0x21'));logger[_0xdf3c('0x22')](_0xdf3c('0x23'),_0x59e431,_0xdf3c('0x21'),JSON['stringify'](_0x4274fd));if(_0x4274fd[_0xdf3c('0x24')]){if(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x25')]===0x1f4){logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x5e0047(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);}logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x13ea5f(_0x4274fd['error']['message']);}else{logger[_0xdf3c('0x1f')]('Trunk,\x20%s,\x20%s',_0x59e431,_0xdf3c('0x21'));_0x13ea5f(_0x4274fd[_0xdf3c('0x27')][_0xdf3c('0x26')]);}})[_0xdf3c('0x28')](function(_0x33652f){logger[_0xdf3c('0x24')]('Trunk,\x20%s,\x20%s',_0x59e431,_0x33652f);_0x5e0047(_0x33652f);});});}function respondWithStatusCode(_0x22a164,_0x213d75){_0x213d75=_0x213d75||0xcc;return function(_0x13e3ca){if(_0x13e3ca){return _0x22a164[_0xdf3c('0x29')](_0x213d75);}return _0x22a164[_0xdf3c('0x2a')](_0x213d75)[_0xdf3c('0x2b')]();};}function respondWithResult(_0xef54cb,_0x155f54){_0x155f54=_0x155f54||0xc8;return function(_0x18cb46){if(_0x18cb46){return _0xef54cb[_0xdf3c('0x2a')](_0x155f54)['json'](_0x18cb46);}};}function respondWithFilteredResult(_0xd284d7,_0x153daa){return function(_0x4b57a4){if(_0x4b57a4){var _0xdc8962=typeof _0x153daa['offset']==='undefined'&&typeof _0x153daa['limit']===_0xdf3c('0x2c');var _0x186bba=_0x4b57a4['count'];var _0x5c3b5a=_0xdc8962?0x0:_0x153daa[_0xdf3c('0x2d')];var _0x1f2ce4=_0xdc8962?_0x4b57a4[_0xdf3c('0x2e')]:_0x153daa[_0xdf3c('0x2d')]+_0x153daa['limit'];var _0x43ce06;if(_0x1f2ce4>=_0x186bba){_0x1f2ce4=_0x186bba;_0x43ce06=0xc8;}else{_0x43ce06=0xce;}_0xd284d7[_0xdf3c('0x2a')](_0x43ce06);return _0xd284d7['set']('Content-Range',_0x5c3b5a+'-'+_0x1f2ce4+'/'+_0x186bba)[_0xdf3c('0x2f')](_0x4b57a4);}return null;};}function patchUpdates(_0x46f0e3){return function(_0x36937e){try{jsonpatch['apply'](_0x36937e,_0x46f0e3,!![]);}catch(_0x2355f6){return BPromise[_0xdf3c('0x30')](_0x2355f6);}return _0x36937e[_0xdf3c('0x31')]();};}function saveUpdates(_0x10099e,_0x575ae1){return function(_0xda0de0){if(_0xda0de0){return _0xda0de0[_0xdf3c('0x32')](_0x10099e)['then'](function(_0x40ae3d){return _0x40ae3d;});}return null;};}function removeEntity(_0x3daeda,_0x217a65){return function(_0x2287f){if(_0x2287f){return _0x2287f['destroy']()[_0xdf3c('0x1e')](function(){var _0x360d5c=_0x2287f[_0xdf3c('0x33')]({'plain':!![]});var _0x3b9ce8='Trunks';return db[_0xdf3c('0x34')][_0xdf3c('0x35')]({'where':{'type':_0x3b9ce8,'resourceId':_0x360d5c['id']}})['then'](function(){return _0x2287f;});})['then'](function(){_0x3daeda[_0xdf3c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216115,_0x5e8130){return function(_0x57faba){if(!_0x57faba){_0x216115['sendStatus'](0x194);}return _0x57faba;};}function handleError(_0x44a478,_0x2ee9ad){_0x2ee9ad=_0x2ee9ad||0x1f4;return function(_0x1d0b8a){logger[_0xdf3c('0x24')](_0x1d0b8a['stack']);if(_0x1d0b8a['name']){delete _0x1d0b8a[_0xdf3c('0x36')];}_0x44a478['status'](_0x2ee9ad)[_0xdf3c('0x37')](_0x1d0b8a);};}exports[_0xdf3c('0x38')]=function(_0x3628ae,_0xcdd731){var _0x1004e9={},_0x1e0cf2={},_0x1c7335={'count':0x0,'rows':[]};var _0x809f3d=_[_0xdf3c('0x39')](db['Trunk'][_0xdf3c('0x3a')],function(_0x54e689){return{'name':_0x54e689['fieldName'],'type':_0x54e689[_0xdf3c('0x3b')]['key']};});_0x1e0cf2[_0xdf3c('0x3c')]=_['map'](_0x809f3d,_0xdf3c('0x36'));_0x1e0cf2[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x3628ae[_0xdf3c('0x3d')]);_0x1e0cf2[_0xdf3c('0x3f')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],_0x1e0cf2[_0xdf3c('0x3d')]);_0x1004e9[_0xdf3c('0x41')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x3628ae['query']['fields']));_0x1004e9[_0xdf3c('0x41')]=_0x1004e9['attributes'][_0xdf3c('0x43')]?_0x1004e9[_0xdf3c('0x41')]:_0x1e0cf2[_0xdf3c('0x3c')];if(!_0x3628ae[_0xdf3c('0x3d')]['hasOwnProperty']('nolimit')){_0x1004e9[_0xdf3c('0x44')]=qs[_0xdf3c('0x44')](_0x3628ae[_0xdf3c('0x3d')]['limit']);_0x1004e9[_0xdf3c('0x2d')]=qs[_0xdf3c('0x2d')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x2d')]);}_0x1004e9['order']=qs[_0xdf3c('0x45')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x45')]);_0x1004e9[_0xdf3c('0x46')]=qs[_0xdf3c('0x3f')](_['pick'](_0x3628ae[_0xdf3c('0x3d')],_0x1e0cf2[_0xdf3c('0x3f')]),_0x809f3d);if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]){_0x1004e9[_0xdf3c('0x46')]=_[_0xdf3c('0x48')](_0x1004e9['where'],{'$or':_['map'](_0x809f3d,function(_0x2c6c6d){if(_0x2c6c6d[_0xdf3c('0x3b')]!=='VIRTUAL'){var _0x5c9885={};_0x5c9885[_0x2c6c6d[_0xdf3c('0x36')]]={'$like':'%'+_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]+'%'};return _0x5c9885;}})});}_0x1004e9=_[_0xdf3c('0x48')]({},_0x1004e9,_0x3628ae[_0xdf3c('0x49')]);var _0x2dbf54={'where':_0x1004e9[_0xdf3c('0x46')]};return db[_0xdf3c('0x4a')][_0xdf3c('0x2e')](_0x2dbf54)['then'](function(_0x129c2a){_0x1c7335[_0xdf3c('0x2e')]=_0x129c2a;if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x1004e9[_0xdf3c('0x4c')]=[{'all':!![]}];}return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')](_0x1004e9);})['then'](function(_0x1751a8){_0x1c7335['rows']=_0x1751a8;return _0x1c7335;})[_0xdf3c('0x1e')](respondWithFilteredResult(_0xcdd731,_0x1004e9))['catch'](handleError(_0xcdd731,null));};exports[_0xdf3c('0x4e')]=function(_0x28144f,_0x2ec575){var _0x94c5b9={'raw':![],'where':{'id':_0x28144f['params']['id']}},_0x5eef94={};_0x5eef94['model']=_[_0xdf3c('0x3e')](db['Trunk'][_0xdf3c('0x3a')]);_0x5eef94[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x28144f[_0xdf3c('0x3d')]);_0x5eef94[_0xdf3c('0x3f')]=_['intersection'](_0x5eef94['model'],_0x5eef94[_0xdf3c('0x3d')]);_0x94c5b9[_0xdf3c('0x41')]=_['intersection'](_0x5eef94[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x94c5b9[_0xdf3c('0x41')]=_0x94c5b9[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x94c5b9['attributes']:_0x5eef94['model'];if(_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x94c5b9[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x94c5b9=_[_0xdf3c('0x48')]({},_0x94c5b9,_0x28144f[_0xdf3c('0x49')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x94c5b9)[_0xdf3c('0x1e')](handleEntityNotFound(_0x2ec575,null))[_0xdf3c('0x1e')](respondWithResult(_0x2ec575,null))[_0xdf3c('0x28')](handleError(_0x2ec575,null));};exports[_0xdf3c('0x50')]=function(_0x4cb28f,_0x1eebcf){var _0x47cb74={'where':{'id':_0x4cb28f['params']['id']}},_0x5e7247={};_0x5e7247['model']=_['keys'](db[_0xdf3c('0x4a')][_0xdf3c('0x3a')]);_0x47cb74['attributes']=_[_0xdf3c('0x40')](_0x5e7247[_0xdf3c('0x3c')],qs['fields'](_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x47cb74[_0xdf3c('0x41')]=_0x47cb74[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x47cb74[_0xdf3c('0x41')]:_0x5e7247[_0xdf3c('0x3c')];if(_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x47cb74[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x47cb74=_[_0xdf3c('0x48')]({},_0x47cb74,_0x4cb28f['options']);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x47cb74)[_0xdf3c('0x1e')](handleEntityNotFound(_0x1eebcf,null))['then'](function(_0x245c68){if(_0x245c68){var _0x3e327e=_0x245c68[_0xdf3c('0x33')]({'plain':!![]});_0x3e327e=qs['omit'](_0x3e327e,['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);_0x4cb28f['body']=_[_0xdf3c('0x53')](_0x4cb28f['body'],['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_[_0xdf3c('0x48')](_0x3e327e,_0x4cb28f[_0xdf3c('0x55')]),{'include':_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]?[{'all':!![]}]:undefined})[_0xdf3c('0x1e')](function(_0x330730){var _0x283be2=_0x4cb28f[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x283be2)throw new Error(_0xdf3c('0x57'));if(_0x283be2[_0xdf3c('0x58')]===_0xdf3c('0x56')){var _0xd7fb2d=_0x330730['get']({'plain':!![]});var _0x4dade5=_0xdf3c('0x59');return db[_0xdf3c('0x5a')][_0xdf3c('0x4f')]({'where':{'name':_0x4dade5,'userProfileId':_0x283be2['userProfileId']},'raw':!![]})[_0xdf3c('0x1e')](function(_0x5f2765){if(_0x5f2765&&_0x5f2765['autoAssociation']===0x0){return db[_0xdf3c('0x34')][_0xdf3c('0x54')]({'name':_0xd7fb2d[_0xdf3c('0x36')],'resourceId':_0xd7fb2d['id'],'type':_0x5f2765[_0xdf3c('0x36')],'sectionId':_0x5f2765['id']},{})[_0xdf3c('0x1e')](function(){return _0x330730;});}else{return _0x330730;}})[_0xdf3c('0x28')](function(_0x1a31d7){logger[_0xdf3c('0x24')](_0xdf3c('0x5b'),_0x1a31d7);throw _0x1a31d7;});}return _0x330730;});}})[_0xdf3c('0x1e')](respondWithResult(_0x1eebcf,0xc9))[_0xdf3c('0x28')](handleError(_0x1eebcf,null));};exports[_0xdf3c('0x54')]=function(_0x34000c,_0x4be79a,_0x3febac){var _0x2cb0f5;return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_0x34000c[_0xdf3c('0x55')],{'raw':!![]})['then'](function(_0x18bf4f){_0x2cb0f5=_0x18bf4f;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x1efa9c){var _0x50805c=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x5f')),'utf8');var _0xb867a1=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x19c851=ejs['render'](_0x50805c,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x19c851);if(_0x2cb0f5['registry']){var _0x52a2e1=ejs[_0xdf3c('0x64')](_0xb867a1,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x52a2e1);}})[_0xdf3c('0x1e')](function(){return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x54'),{'module':_0xdf3c('0x67')});})[_0xdf3c('0x1e')](function(){var _0x5e6606=_0x34000c[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x5e6606)throw new Error(_0xdf3c('0x57'));if(_0x5e6606['role']===_0xdf3c('0x56')){var _0x354ff4=_0x2cb0f5[_0xdf3c('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xdf3c('0x4f')]({'where':{'name':_0xdf3c('0x59'),'userProfileId':_0x5e6606[_0xdf3c('0x68')]},'raw':!![]})[_0xdf3c('0x1e')](function(_0xe01538){if(_0xe01538&&_0xe01538[_0xdf3c('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x354ff4['name'],'resourceId':_0x354ff4['id'],'type':_0xe01538['name'],'sectionId':_0xe01538['id']},{})['then'](function(){return _0x2cb0f5;});}else{return _0x2cb0f5;}})[_0xdf3c('0x28')](function(_0x3f43a0){logger[_0xdf3c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f43a0);throw _0x3f43a0;});}return _0x2cb0f5;})[_0xdf3c('0x1e')](respondWithResult(_0x4be79a,0xc9))[_0xdf3c('0x28')](handleError(_0x4be79a,null));};exports[_0xdf3c('0x32')]=function(_0x51e8c6,_0x591936,_0x233718){var _0x4e3517;return db[_0xdf3c('0x4a')]['find']({'where':{'id':_0x51e8c6[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x591936,null))[_0xdf3c('0x1e')](saveUpdates(_0x51e8c6[_0xdf3c('0x55')],null))['then'](function(_0x5148f6){if(_0x5148f6){_0x4e3517=_0x5148f6;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});}})[_0xdf3c('0x1e')](function(_0x12a7b0){if(_0x12a7b0){var _0x39d9f0=fs[_0xdf3c('0x5c')](path['join'](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x9c761a=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/registry.ejs'),_0xdf3c('0x61'));var _0x5c27cc=ejs[_0xdf3c('0x64')](_0x39d9f0,{'trunks':_0x12a7b0||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x5c27cc);var _0x53b0c3=ejs['render'](_0x9c761a,{'trunks':_0x12a7b0||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x53b0c3);return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x32'),{'module':_0xdf3c('0x67')});}return null;})[_0xdf3c('0x1e')](function(_0x5c8e5e){if(_0x5c8e5e){return _0x4e3517;}})[_0xdf3c('0x1e')](respondWithResult(_0x591936,null))['catch'](handleError(_0x591936,null));};exports[_0xdf3c('0x35')]=function(_0x389708,_0x2e5f82,_0x15a057){var _0x320452;return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')]({'where':{'id':_0x389708[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x2e5f82,null))[_0xdf3c('0x1e')](removeEntity(_0x2e5f82,null))[_0xdf3c('0x1e')](function(){return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x55fd73){var _0x118ab5=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x1c8fe4=fs['readFileSync'](path['join'](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x1aaf8b=ejs[_0xdf3c('0x64')](_0x118ab5,{'trunks':_0x55fd73});var _0x56fc77=ejs[_0xdf3c('0x64')](_0x1c8fe4,{'trunks':_0x55fd73});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x1aaf8b);fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x56fc77);return respondWithRpcPromise(_0xdf3c('0x66'),'destroy',{'module':_0xdf3c('0x67')});})[_0xdf3c('0x28')](handleError(_0x2e5f82,null));}; \ No newline at end of file +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x4f25f9,_0x255051){var _0x92083c=function(_0x46ab7b){while(--_0x46ab7b){_0x4f25f9['push'](_0x4f25f9['shift']());}};_0x92083c(++_0x255051);}(_0x34e8,0x12c));var _0x834e=function(_0xc5f6f3,_0x10a738){_0xc5f6f3=_0xc5f6f3-0x0;var _0x1d647a=_0x34e8[_0xc5f6f3];return _0x1d647a;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 93ed270..9201429 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 _0xa9ec=['tools_trunks','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','define'];(function(_0x1288dd,_0x38f47c){var _0x3efba7=function(_0x31bbe5){while(--_0x31bbe5){_0x1288dd['push'](_0x1288dd['shift']());}};_0x3efba7(++_0x38f47c);}(_0xa9ec,0xe8));var _0xca9e=function(_0x5c5cfb,_0x856fe6){_0x5c5cfb=_0x5c5cfb-0x0;var _0xb89878=_0xa9ec[_0x5c5cfb];return _0xb89878;};'use strict';var _=require(_0xca9e('0x0'));var util=require('util');var logger=require(_0xca9e('0x1'))(_0xca9e('0x2'));var moment=require(_0xca9e('0x3'));var BPromise=require(_0xca9e('0x4'));var rp=require(_0xca9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca9e('0x6'));var config=require(_0xca9e('0x7'));var attributes=require(_0xca9e('0x8'));module['exports']=function(_0x4823d7,_0x2c3adb){return _0x4823d7[_0xca9e('0x9')]('Trunk',attributes,{'tableName':_0xca9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17a1=['define','Trunk','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x5b4af4,_0x457353){var _0x201e5a=function(_0x879dd4){while(--_0x879dd4){_0x5b4af4['push'](_0x5b4af4['shift']());}};_0x201e5a(++_0x457353);}(_0x17a1,0xed));var _0x117a=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x17a1[_0x455c6c];return _0x488242;};'use strict';var _=require('lodash');var util=require(_0x117a('0x0'));var logger=require(_0x117a('0x1'))(_0x117a('0x2'));var moment=require(_0x117a('0x3'));var BPromise=require(_0x117a('0x4'));var rp=require(_0x117a('0x5'));var fs=require('fs');var path=require(_0x117a('0x6'));var rimraf=require(_0x117a('0x7'));var config=require(_0x117a('0x8'));var attributes=require(_0x117a('0x9'));module['exports']=function(_0x28dd88,_0x4f92a7){return _0x28dd88[_0x117a('0xa')](_0x117a('0xb'),attributes,{'tableName':_0x117a('0xc'),'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 0b88245..eb0401a 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 _0x7910=['then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','GetTrunk','Trunk','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowTrunk','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7910,0xc2));var _0x0791=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0x7910[_0x44474f];return _0x427d97;};'use strict';var _=require(_0x0791('0x0'));var util=require(_0x0791('0x1'));var moment=require(_0x0791('0x2'));var BPromise=require(_0x0791('0x3'));var rs=require(_0x0791('0x4'));var fs=require('fs');var Redis=require(_0x0791('0x5'));var db=require(_0x0791('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0791('0x7'));var client=jayson[_0x0791('0x8')][_0x0791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x343ff9,_0x1993d9,_0x558fb4){return new BPromise(function(_0x4e775f,_0x51ea10){return client['request'](_0x343ff9,_0x558fb4)[_0x0791('0xa')](function(_0x713687){logger[_0x0791('0xb')](_0x0791('0xc'),_0x1993d9,_0x0791('0xd'));logger[_0x0791('0xe')](_0x0791('0xf'),_0x1993d9,_0x0791('0xd'),JSON['stringify'](_0x713687));if(_0x713687['error']){if(_0x713687[_0x0791('0x10')][_0x0791('0x11')]===0x1f4){logger[_0x0791('0x10')](_0x0791('0xc'),_0x1993d9,_0x713687[_0x0791('0x10')][_0x0791('0x12')]);return _0x51ea10(_0x713687[_0x0791('0x10')][_0x0791('0x12')]);}logger['error'](_0x0791('0xc'),_0x1993d9,_0x713687[_0x0791('0x10')][_0x0791('0x12')]);return _0x4e775f(_0x713687['error'][_0x0791('0x12')]);}else{logger['info'](_0x0791('0xc'),_0x1993d9,_0x0791('0xd'));_0x4e775f(_0x713687['result'][_0x0791('0x12')]);}})['catch'](function(_0x4f19b6){logger[_0x0791('0x10')]('Trunk,\x20%s,\x20%s',_0x1993d9,_0x4f19b6);_0x51ea10(_0x4f19b6);});});}exports[_0x0791('0x13')]=function(_0x2ccd9b){var _0x46b09b=this;return new Promise(function(_0xd832cf,_0x39e4ec){return db[_0x0791('0x14')][_0x0791('0x15')]({'raw':_0x2ccd9b['options']?_0x2ccd9b[_0x0791('0x16')][_0x0791('0x17')]===undefined?!![]:![]:!![],'where':_0x2ccd9b[_0x0791('0x16')]?_0x2ccd9b[_0x0791('0x16')][_0x0791('0x18')]||null:null,'attributes':_0x2ccd9b[_0x0791('0x16')]?_0x2ccd9b[_0x0791('0x16')]['attributes']||null:null,'limit':_0x2ccd9b[_0x0791('0x16')]?_0x2ccd9b['options'][_0x0791('0x19')]||null:null,'include':_0x2ccd9b[_0x0791('0x16')]?_0x2ccd9b[_0x0791('0x16')][_0x0791('0x1a')]?_[_0x0791('0x1b')](_0x2ccd9b['options'][_0x0791('0x1a')],function(_0x46dc13){return{'model':db[_0x46dc13[_0x0791('0x1c')]],'as':_0x46dc13['as'],'attributes':_0x46dc13[_0x0791('0x1d')],'include':_0x46dc13[_0x0791('0x1a')]?_[_0x0791('0x1b')](_0x46dc13[_0x0791('0x1a')],function(_0x19fb09){return{'model':db[_0x19fb09[_0x0791('0x1c')]],'as':_0x19fb09['as'],'attributes':_0x19fb09[_0x0791('0x1d')],'include':_0x19fb09[_0x0791('0x1a')]?_['map'](_0x19fb09[_0x0791('0x1a')],function(_0x597696){return{'model':db[_0x597696[_0x0791('0x1c')]],'as':_0x597696['as'],'attributes':_0x597696[_0x0791('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0791('0xa')](function(_0x455519){logger[_0x0791('0xb')]('GetTrunk',_0x2ccd9b);logger['debug'](_0x0791('0x13'),_0x2ccd9b,JSON['stringify'](_0x455519));_0xd832cf(_0x455519);})[_0x0791('0x1e')](function(_0x398301){logger['error'](_0x0791('0x13'),_0x398301[_0x0791('0x12')],_0x2ccd9b);_0x39e4ec(_0x46b09b[_0x0791('0x10')](0x1f4,_0x398301[_0x0791('0x12')]));});});};exports[_0x0791('0x1f')]=function(_0x5f3d2e){var _0x53530a=this;return new Promise(function(_0x1fc9c8,_0x5b143a){return db[_0x0791('0x14')][_0x0791('0x20')]({'raw':_0x5f3d2e[_0x0791('0x16')]?_0x5f3d2e[_0x0791('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5f3d2e[_0x0791('0x16')]?_0x5f3d2e['options'][_0x0791('0x18')]||null:null,'attributes':_0x5f3d2e['options']?_0x5f3d2e[_0x0791('0x16')][_0x0791('0x1d')]||null:null,'include':_0x5f3d2e[_0x0791('0x16')]?_0x5f3d2e[_0x0791('0x16')][_0x0791('0x1a')]?_[_0x0791('0x1b')](_0x5f3d2e['options'][_0x0791('0x1a')],function(_0x129f1f){return{'model':db[_0x129f1f['model']],'as':_0x129f1f['as'],'attributes':_0x129f1f['attributes'],'include':_0x129f1f[_0x0791('0x1a')]?_['map'](_0x129f1f[_0x0791('0x1a')],function(_0x99a504){return{'model':db[_0x99a504[_0x0791('0x1c')]],'as':_0x99a504['as'],'attributes':_0x99a504[_0x0791('0x1d')],'include':_0x99a504[_0x0791('0x1a')]?_[_0x0791('0x1b')](_0x99a504[_0x0791('0x1a')],function(_0x20ca7c){return{'model':db[_0x20ca7c[_0x0791('0x1c')]],'as':_0x20ca7c['as'],'attributes':_0x20ca7c[_0x0791('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0791('0xa')](function(_0x1d1fc3){logger['info'](_0x0791('0x1f'),_0x5f3d2e);logger[_0x0791('0xe')](_0x0791('0x1f'),_0x5f3d2e,JSON[_0x0791('0x21')](_0x1d1fc3));_0x1fc9c8(_0x1d1fc3);})['catch'](function(_0x4e9805){logger[_0x0791('0x10')](_0x0791('0x1f'),_0x4e9805[_0x0791('0x12')],_0x5f3d2e);_0x5b143a(_0x53530a[_0x0791('0x10')](0x1f4,_0x4e9805[_0x0791('0x12')]));});});}; \ No newline at end of file +var _0xec7a=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','info','GetTrunk','stringify','ShowTrunk','find'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0xec7a,0xbe));var _0xaec7=function(_0x3bb43c,_0x5e18f3){_0x3bb43c=_0x3bb43c-0x0;var _0x1c5bf9=_0xec7a[_0x3bb43c];return _0x1c5bf9;};'use strict';var _=require(_0xaec7('0x0'));var util=require(_0xaec7('0x1'));var moment=require(_0xaec7('0x2'));var BPromise=require('bluebird');var rs=require(_0xaec7('0x3'));var fs=require('fs');var Redis=require(_0xaec7('0x4'));var db=require(_0xaec7('0x5'))['db'];var utils=require(_0xaec7('0x6'));var logger=require(_0xaec7('0x7'))(_0xaec7('0x8'));var config=require(_0xaec7('0x9'));var jayson=require(_0xaec7('0xa'));var client=jayson[_0xaec7('0xb')][_0xaec7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x332f1c,_0x5778ef,_0x50599e){return new BPromise(function(_0x1bf3b1,_0x229d9b){return client[_0xaec7('0xd')](_0x332f1c,_0x50599e)[_0xaec7('0xe')](function(_0x4de3fb){logger['info'](_0xaec7('0xf'),_0x5778ef,_0xaec7('0x10'));logger[_0xaec7('0x11')](_0xaec7('0x12'),_0x5778ef,_0xaec7('0x10'),JSON['stringify'](_0x4de3fb));if(_0x4de3fb['error']){if(_0x4de3fb[_0xaec7('0x13')][_0xaec7('0x14')]===0x1f4){logger[_0xaec7('0x13')](_0xaec7('0xf'),_0x5778ef,_0x4de3fb['error'][_0xaec7('0x15')]);return _0x229d9b(_0x4de3fb['error'][_0xaec7('0x15')]);}logger[_0xaec7('0x13')](_0xaec7('0xf'),_0x5778ef,_0x4de3fb[_0xaec7('0x13')][_0xaec7('0x15')]);return _0x1bf3b1(_0x4de3fb['error'][_0xaec7('0x15')]);}else{logger['info'](_0xaec7('0xf'),_0x5778ef,_0xaec7('0x10'));_0x1bf3b1(_0x4de3fb['result'][_0xaec7('0x15')]);}})[_0xaec7('0x16')](function(_0xfa0a75){logger[_0xaec7('0x13')]('Trunk,\x20%s,\x20%s',_0x5778ef,_0xfa0a75);_0x229d9b(_0xfa0a75);});});}exports['GetTrunk']=function(_0x51464b){var _0x29d606=this;return new Promise(function(_0x1e627f,_0x37c935){return db[_0xaec7('0x17')][_0xaec7('0x18')]({'raw':_0x51464b[_0xaec7('0x19')]?_0x51464b['options'][_0xaec7('0x1a')]===undefined?!![]:![]:!![],'where':_0x51464b[_0xaec7('0x19')]?_0x51464b['options'][_0xaec7('0x1b')]||null:null,'attributes':_0x51464b[_0xaec7('0x19')]?_0x51464b[_0xaec7('0x19')][_0xaec7('0x1c')]||null:null,'limit':_0x51464b[_0xaec7('0x19')]?_0x51464b[_0xaec7('0x19')][_0xaec7('0x1d')]||null:null,'include':_0x51464b[_0xaec7('0x19')]?_0x51464b[_0xaec7('0x19')][_0xaec7('0x1e')]?_['map'](_0x51464b[_0xaec7('0x19')][_0xaec7('0x1e')],function(_0x22da13){return{'model':db[_0x22da13['model']],'as':_0x22da13['as'],'attributes':_0x22da13[_0xaec7('0x1c')],'include':_0x22da13[_0xaec7('0x1e')]?_[_0xaec7('0x1f')](_0x22da13[_0xaec7('0x1e')],function(_0x4d8df8){return{'model':db[_0x4d8df8[_0xaec7('0x20')]],'as':_0x4d8df8['as'],'attributes':_0x4d8df8['attributes'],'include':_0x4d8df8[_0xaec7('0x1e')]?_[_0xaec7('0x1f')](_0x4d8df8['include'],function(_0x2fb459){return{'model':db[_0x2fb459[_0xaec7('0x20')]],'as':_0x2fb459['as'],'attributes':_0x2fb459[_0xaec7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaec7('0xe')](function(_0x59c6d4){logger[_0xaec7('0x21')]('GetTrunk',_0x51464b);logger[_0xaec7('0x11')](_0xaec7('0x22'),_0x51464b,JSON[_0xaec7('0x23')](_0x59c6d4));_0x1e627f(_0x59c6d4);})[_0xaec7('0x16')](function(_0x2086c7){logger[_0xaec7('0x13')]('GetTrunk',_0x2086c7[_0xaec7('0x15')],_0x51464b);_0x37c935(_0x29d606[_0xaec7('0x13')](0x1f4,_0x2086c7[_0xaec7('0x15')]));});});};exports[_0xaec7('0x24')]=function(_0x1aa479){var _0x2986d2=this;return new Promise(function(_0x1bad57,_0x1cf026){return db[_0xaec7('0x17')][_0xaec7('0x25')]({'raw':_0x1aa479[_0xaec7('0x19')]?_0x1aa479[_0xaec7('0x19')][_0xaec7('0x1a')]===undefined?!![]:![]:!![],'where':_0x1aa479['options']?_0x1aa479['options']['where']||null:null,'attributes':_0x1aa479[_0xaec7('0x19')]?_0x1aa479[_0xaec7('0x19')][_0xaec7('0x1c')]||null:null,'include':_0x1aa479[_0xaec7('0x19')]?_0x1aa479['options'][_0xaec7('0x1e')]?_[_0xaec7('0x1f')](_0x1aa479[_0xaec7('0x19')][_0xaec7('0x1e')],function(_0x516919){return{'model':db[_0x516919['model']],'as':_0x516919['as'],'attributes':_0x516919[_0xaec7('0x1c')],'include':_0x516919[_0xaec7('0x1e')]?_[_0xaec7('0x1f')](_0x516919[_0xaec7('0x1e')],function(_0x558b64){return{'model':db[_0x558b64[_0xaec7('0x20')]],'as':_0x558b64['as'],'attributes':_0x558b64[_0xaec7('0x1c')],'include':_0x558b64[_0xaec7('0x1e')]?_['map'](_0x558b64[_0xaec7('0x1e')],function(_0x519412){return{'model':db[_0x519412[_0xaec7('0x20')]],'as':_0x519412['as'],'attributes':_0x519412['attributes']};}):[]};}):[]};}):[]:[]})[_0xaec7('0xe')](function(_0x495e8f){logger[_0xaec7('0x21')](_0xaec7('0x24'),_0x1aa479);logger[_0xaec7('0x11')](_0xaec7('0x24'),_0x1aa479,JSON[_0xaec7('0x23')](_0x495e8f));_0x1bad57(_0x495e8f);})[_0xaec7('0x16')](function(_0x12c641){logger[_0xaec7('0x13')]('ShowTrunk',_0x12c641['message'],_0x1aa479);_0x1cf026(_0x2986d2[_0xaec7('0x13')](0x1f4,_0x12c641[_0xaec7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index f68f1d8..a568b64 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 _0xc64b=['./user-setting.controller','put','/:id','isAuthenticated','update','../../components/auth/service'];(function(_0x56acd1,_0xfca357){var _0x257590=function(_0x629209){while(--_0x629209){_0x56acd1['push'](_0x56acd1['shift']());}};_0x257590(++_0xfca357);}(_0xc64b,0x173));var _0xbc64=function(_0x174583,_0x468485){_0x174583=_0x174583-0x0;var _0x14e46f=_0xc64b[_0x174583];return _0x14e46f;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xbc64('0x0'));var controller=require(_0xbc64('0x1'));router[_0xbc64('0x2')](_0xbc64('0x3'),auth[_0xbc64('0x4')](),controller[_0xbc64('0x5')]);module['exports']=router; \ No newline at end of file +var _0x4106=['./user-setting.controller','put','/:id','isAuthenticated','update','exports','express','Router'];(function(_0x2d0de1,_0x5b3150){var _0xacf89c=function(_0x4d8c49){while(--_0x4d8c49){_0x2d0de1['push'](_0x2d0de1['shift']());}};_0xacf89c(++_0x5b3150);}(_0x4106,0xf6));var _0x6410=function(_0x1563e6,_0x4e14e4){_0x1563e6=_0x1563e6-0x0;var _0x2237f1=_0x4106[_0x1563e6];return _0x2237f1;};'use strict';var express=require(_0x6410('0x0'));var router=express[_0x6410('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x6410('0x2'));router[_0x6410('0x3')](_0x6410('0x4'),auth[_0x6410('0x5')](),controller[_0x6410('0x6')]);module[_0x6410('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 8e47b30..6fea39e 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 _0x0438=['INTEGER','warning','debug','exports','error','TEXT','DATE'];(function(_0x111a8a,_0x411280){var _0x49a085=function(_0x5953ac){while(--_0x5953ac){_0x111a8a['push'](_0x111a8a['shift']());}};_0x49a085(++_0x411280);}(_0x0438,0x86));var _0x8043=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x0438[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x8043('0x0'),'info',_0x8043('0x1')];module[_0x8043('0x2')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8043('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8043('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8043('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8043('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0xfedf=['UserId','sequelize','error','exports','ENUM','BOOLEAN','DATE','INTEGER'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xfedf,0x191));var _0xffed=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xfedf[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0xffed('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xffed('0x1'),'warning','info','debug'];module[_0xffed('0x2')]={'clientSideLoggingLevel':{'type':Sequelize[_0xffed('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xffed('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xffed('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xffed('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xffed('0x6')],'unique':_0xffed('0x7')}}; \ 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 e68293d..ae209dc 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 _0xcb81=['sendStatus','error','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','then','body','catch','lodash','ioredis','api','redis','./user-setting.socket','register','defaults','localhost','status','json'];(function(_0x43dc6f,_0xbf2321){var _0x26ad2a=function(_0x10782a){while(--_0x10782a){_0x43dc6f['push'](_0x43dc6f['shift']());}};_0x26ad2a(++_0xbf2321);}(_0xcb81,0x154));var _0x1cb8=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0xcb81[_0x54ea7a];return _0x65a10d;};'use strict';var _=require(_0x1cb8('0x0'));var Redis=require(_0x1cb8('0x1'));var logger=require('../../config/logger')(_0x1cb8('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x1cb8('0x3')]));require(_0x1cb8('0x4'))[_0x1cb8('0x5')](socket);config[_0x1cb8('0x3')]=_[_0x1cb8('0x6')](config['redis'],{'host':_0x1cb8('0x7'),'port':0x18eb});function respondWithResult(_0x2ac2d6,_0x584b16){_0x584b16=_0x584b16||0xc8;return function(_0x2408c2){if(_0x2408c2){return _0x2ac2d6[_0x1cb8('0x8')](_0x584b16)[_0x1cb8('0x9')](_0x2408c2);}};}function saveUpdates(_0x503efb){return function(_0x1ff267){if(_0x1ff267){return _0x1ff267['update'](_0x503efb)['then'](function(_0x29e901){return _0x29e901;});}return null;};}function handleEntityNotFound(_0x2158a9){return function(_0x16600b){if(!_0x16600b){_0x2158a9[_0x1cb8('0xa')](0x194);}return _0x16600b;};}function handleError(_0x267dde,_0x32715a){_0x32715a=_0x32715a||0x1f4;return function(_0xb8048c){logger[_0x1cb8('0xb')](_0xb8048c['stack']);if(_0xb8048c[_0x1cb8('0xc')]){delete _0xb8048c[_0x1cb8('0xc')];}_0x267dde[_0x1cb8('0x8')](_0x32715a)[_0x1cb8('0xd')](_0xb8048c);};}exports[_0x1cb8('0xe')]=function(_0x5dfde1,_0x389c12){if(_0x5dfde1[_0x1cb8('0xf')][_0x1cb8('0x10')]!==_0x1cb8('0x11'))throw new Error(_0x1cb8('0x12'));if(isNaN(Number(_0x5dfde1[_0x1cb8('0x13')]['id'])))throw new Error(_0x1cb8('0x14'));return db[_0x1cb8('0x15')]['find']({'where':{'id':_0x5dfde1[_0x1cb8('0x13')]['id']}})['then'](handleEntityNotFound(_0x389c12,null))[_0x1cb8('0x16')](saveUpdates(_0x5dfde1[_0x1cb8('0x17')],null))[_0x1cb8('0x16')](respondWithResult(_0x389c12,null))[_0x1cb8('0x18')](handleError(_0x389c12,null));}; \ No newline at end of file +var _0x8e63=['Invalid\x20user\x20setting\x20id','find','body','catch','ioredis','../../config/environment','../../mysqldb','socket.io-emitter','register','redis','defaults','localhost','update','then','sendStatus','error','stack','name','status','user','role','admin','Unauthorized','params'];(function(_0x2f06e0,_0x2e1c2a){var _0xf2711b=function(_0x32036c){while(--_0x32036c){_0x2f06e0['push'](_0x2f06e0['shift']());}};_0xf2711b(++_0x2e1c2a);}(_0x8e63,0x7c));var _0x38e6=function(_0x1c1eba,_0x947631){_0x1c1eba=_0x1c1eba-0x0;var _0x438962=_0x8e63[_0x1c1eba];return _0x438962;};'use strict';var _=require('lodash');var Redis=require(_0x38e6('0x0'));var logger=require('../../config/logger')('api');var config=require(_0x38e6('0x1'));var db=require(_0x38e6('0x2'))['db'];var socket=require(_0x38e6('0x3'))(new Redis(config['redis']));require('./user-setting.socket')[_0x38e6('0x4')](socket);config[_0x38e6('0x5')]=_[_0x38e6('0x6')](config['redis'],{'host':_0x38e6('0x7'),'port':0x18eb});function respondWithResult(_0x19e7be,_0x9dd996){_0x9dd996=_0x9dd996||0xc8;return function(_0x315953){if(_0x315953){return _0x19e7be['status'](_0x9dd996)['json'](_0x315953);}};}function saveUpdates(_0x61cee2){return function(_0x1ea04f){if(_0x1ea04f){return _0x1ea04f[_0x38e6('0x8')](_0x61cee2)[_0x38e6('0x9')](function(_0x438258){return _0x438258;});}return null;};}function handleEntityNotFound(_0x58ccc2){return function(_0x563697){if(!_0x563697){_0x58ccc2[_0x38e6('0xa')](0x194);}return _0x563697;};}function handleError(_0x4c5e34,_0x36019a){_0x36019a=_0x36019a||0x1f4;return function(_0x4a97e3){logger[_0x38e6('0xb')](_0x4a97e3[_0x38e6('0xc')]);if(_0x4a97e3[_0x38e6('0xd')]){delete _0x4a97e3[_0x38e6('0xd')];}_0x4c5e34[_0x38e6('0xe')](_0x36019a)['send'](_0x4a97e3);};}exports[_0x38e6('0x8')]=function(_0x1059ab,_0x575b0b){if(_0x1059ab[_0x38e6('0xf')][_0x38e6('0x10')]!==_0x38e6('0x11'))throw new Error(_0x38e6('0x12'));if(isNaN(Number(_0x1059ab[_0x38e6('0x13')]['id'])))throw new Error(_0x38e6('0x14'));return db['UserSetting'][_0x38e6('0x15')]({'where':{'id':_0x1059ab[_0x38e6('0x13')]['id']}})[_0x38e6('0x9')](handleEntityNotFound(_0x575b0b,null))[_0x38e6('0x9')](saveUpdates(_0x1059ab[_0x38e6('0x16')],null))['then'](respondWithResult(_0x575b0b,null))[_0x38e6('0x17')](handleError(_0x575b0b,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 5177c70..4459a7d 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 _0xe5f0=['UserSetting','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x21c01f,_0x1641e4){var _0x49f9e3=function(_0x3ca03e){while(--_0x3ca03e){_0x21c01f['push'](_0x21c01f['shift']());}};_0x49f9e3(++_0x1641e4);}(_0xe5f0,0x10d));var _0x0e5f=function(_0x1729b2,_0xc95bcf){_0x1729b2=_0x1729b2-0x0;var _0x4fe362=_0xe5f0[_0x1729b2];return _0x4fe362;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x0e5f('0x0'))['db'][_0x0e5f('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0e5f('0x2')](0x0);var events={'afterCreate':_0x0e5f('0x3'),'afterUpdate':'update','afterDestroy':_0x0e5f('0x4')};function emitEvent(_0x5aaf51){return function(_0x4e3d38,_0xfdd37f,_0x4cec92){UserSettingEvents[_0x0e5f('0x5')](_0x5aaf51+':'+_0x4e3d38['id'],_0x4e3d38);UserSettingEvents[_0x0e5f('0x5')](_0x5aaf51,_0x4e3d38);_0x4cec92(null);};}for(var e in events){if(events[_0x0e5f('0x6')](e)){var event=events[e];UserSetting[_0x0e5f('0x7')](e,emitEvent(event));}}module[_0x0e5f('0x8')]=UserSettingEvents; \ No newline at end of file +var _0xffdd=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0xffdd,0x74));var _0xdffd=function(_0x3e43fa,_0x3b4fe0){_0x3e43fa=_0x3e43fa-0x0;var _0x4188ee=_0xffdd[_0x3e43fa];return _0x4188ee;};'use strict';var EventEmitter=require(_0xdffd('0x0'));var UserSetting=require(_0xdffd('0x1'))['db'][_0xdffd('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xdffd('0x3')](0x0);var events={'afterCreate':_0xdffd('0x4'),'afterUpdate':_0xdffd('0x5'),'afterDestroy':_0xdffd('0x6')};function emitEvent(_0x16585a){return function(_0x446f0b,_0xcf0f4f,_0x18d33e){UserSettingEvents[_0xdffd('0x7')](_0x16585a+':'+_0x446f0b['id'],_0x446f0b);UserSettingEvents['emit'](_0x16585a,_0x446f0b);_0x18d33e(null);};}for(var e in events){if(events[_0xdffd('0x8')](e)){var event=events[e];UserSetting[_0xdffd('0x9')](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 86445a7..3fec2c1 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 _0xd139=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0xd4e399,_0x4a8481){var _0x1186c9=function(_0x48aa19){while(--_0x48aa19){_0xd4e399['push'](_0xd4e399['shift']());}};_0x1186c9(++_0x4a8481);}(_0xd139,0x14e));var _0x9d13=function(_0x866ecf,_0x484490){_0x866ecf=_0x866ecf-0x0;var _0x359a7b=_0xd139[_0x866ecf];return _0x359a7b;};'use strict';var attributes=require(_0x9d13('0x0'));module[_0x9d13('0x1')]=function(_0x5ec4c7){return _0x5ec4c7['define'](_0x9d13('0x2'),attributes,{'tableName':_0x9d13('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d392a){if(!_0x3d392a[_0x9d13('0x4')])_0x3d392a[_0x9d13('0x5')]=null;else if(_0x3d392a[_0x9d13('0x5')]===null)_0x3d392a[_0x9d13('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x83e1=['exports','define','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x378fc2,_0x268b69){var _0xc61340=function(_0x3b61bc){while(--_0x3b61bc){_0x378fc2['push'](_0x378fc2['shift']());}};_0xc61340(++_0x268b69);}(_0x83e1,0x1ad));var _0x183e=function(_0x5e40a4,_0x467e47){_0x5e40a4=_0x5e40a4-0x0;var _0x182e33=_0x83e1[_0x5e40a4];return _0x182e33;};'use strict';var attributes=require(_0x183e('0x0'));module[_0x183e('0x1')]=function(_0x5f5222){return _0x5f5222[_0x183e('0x2')]('UserSetting',attributes,{'tableName':_0x183e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59d53f){if(!_0x59d53f['clientSideLoggingEnabled'])_0x59d53f[_0x183e('0x4')]=null;else if(_0x59d53f[_0x183e('0x4')]===null)_0x59d53f['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index c08240b..13a9a6c 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 _0xd090=['user-setting:','./user-setting.events','remove','emit','user-setting:update','user-setting:update:user-','UserId','register','length'];(function(_0x24203c,_0x2d77b0){var _0x2c9207=function(_0x42a403){while(--_0x42a403){_0x24203c['push'](_0x24203c['shift']());}};_0x2c9207(++_0x2d77b0);}(_0xd090,0x13c));var _0x0d09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd090[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require(_0x0d09('0x0'));var events=['save',_0x0d09('0x1'),'update'];function createListener(_0x41123c,_0x55117e){return function(_0xda44f6){_0x55117e[_0x0d09('0x2')](_0x41123c,_0xda44f6);if(_0x41123c===_0x0d09('0x3')){_0x55117e[_0x0d09('0x2')](_0x0d09('0x4')+_0xda44f6[_0x0d09('0x5')],_0xda44f6);}};}exports[_0x0d09('0x6')]=function(_0x2fca29){for(var _0x2c8b1c=0x0,_0x57047d=events[_0x0d09('0x7')];_0x2c8b1c<_0x57047d;_0x2c8b1c++){var _0x924b7e=events[_0x2c8b1c];var _0xe1e1b2=createListener(_0x0d09('0x8')+_0x924b7e,_0x2fca29);UserSettingEvents['on'](_0x924b7e,_0xe1e1b2);}}; \ No newline at end of file +var _0x6b37=['remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','./user-setting.events','save'];(function(_0x5d9b75,_0x218c0c){var _0x2916be=function(_0x1518c4){while(--_0x1518c4){_0x5d9b75['push'](_0x5d9b75['shift']());}};_0x2916be(++_0x218c0c);}(_0x6b37,0x130));var _0x76b3=function(_0x6005f4,_0x4f7436){_0x6005f4=_0x6005f4-0x0;var _0x4a8af6=_0x6b37[_0x6005f4];return _0x4a8af6;};'use strict';var UserSettingEvents=require(_0x76b3('0x0'));var events=[_0x76b3('0x1'),_0x76b3('0x2'),_0x76b3('0x3')];function createListener(_0x515543,_0x366b89){return function(_0xdb0be8){_0x366b89[_0x76b3('0x4')](_0x515543,_0xdb0be8);if(_0x515543===_0x76b3('0x5')){_0x366b89[_0x76b3('0x4')](_0x76b3('0x6')+_0xdb0be8[_0x76b3('0x7')],_0xdb0be8);}};}exports[_0x76b3('0x8')]=function(_0x61990){for(var _0x8c182=0x0,_0x33c7c8=events['length'];_0x8c182<_0x33c7c8;_0x8c182++){var _0x1f4577=events[_0x8c182];var _0x309c33=createListener('user-setting:'+_0x1f4577,_0x61990);UserSettingEvents['on'](_0x1f4577,_0x309c33);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2298e6a..b6e8a56 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 _0xbcd2=['removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','update','put','/:id/password','changePassword','removeQueues','delete','/:id/teams','removeTeams','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts'];(function(_0xb26dbc,_0x48769c){var _0x1c9dc4=function(_0x2baf2a){while(--_0x2baf2a){_0xb26dbc['push'](_0xb26dbc['shift']());}};_0x1c9dc4(++_0x48769c);}(_0xbcd2,0xf0));var _0x2bcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcd2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2bcd('0x0'));var util=require(_0x2bcd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2bcd('0x2'));var router=express[_0x2bcd('0x3')]();var fs_extra=require(_0x2bcd('0x4'));var auth=require(_0x2bcd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2bcd('0x6'));var controller=require(_0x2bcd('0x7'));router[_0x2bcd('0x8')]('/',auth[_0x2bcd('0x9')](),controller['index']);router['get'](_0x2bcd('0xa'),auth['isAuthenticated'](),controller[_0x2bcd('0xb')]);router[_0x2bcd('0x8')](_0x2bcd('0xc'),auth['isAuthenticated'](),controller[_0x2bcd('0xd')]);router[_0x2bcd('0x8')]('/presence',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0xe')]);router[_0x2bcd('0x8')](_0x2bcd('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x2bcd('0x10'),controller[_0x2bcd('0x11')]);router[_0x2bcd('0x8')](_0x2bcd('0x12'),auth['isAuthenticated'](),controller[_0x2bcd('0x13')]);router['get'](_0x2bcd('0x14'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x15')]);router[_0x2bcd('0x8')]('/:id/queues',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x16')]);router[_0x2bcd('0x8')](_0x2bcd('0x17'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x18')]);router[_0x2bcd('0x8')]('/:id/groups',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x19')]);router['get'](_0x2bcd('0x1a'),auth['isAuthenticated'](),controller[_0x2bcd('0x1b')]);router['get']('/:id/screen_recordings',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x1c')]);router[_0x2bcd('0x8')](_0x2bcd('0x1d'),auth[_0x2bcd('0x9')](),controller['getChatInteractions']);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x2bcd('0x1e')]);router['get'](_0x2bcd('0x1f'),auth[_0x2bcd('0x9')](),controller['getMailInteractions']);router[_0x2bcd('0x8')](_0x2bcd('0x20'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x21')]);router[_0x2bcd('0x8')](_0x2bcd('0x22'),auth[_0x2bcd('0x9')](),controller['getFaxInteractions']);router[_0x2bcd('0x8')](_0x2bcd('0x23'),auth['isAuthenticated'](),controller[_0x2bcd('0x24')]);router[_0x2bcd('0x8')]('/:id/teams',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x25')]);router[_0x2bcd('0x8')](_0x2bcd('0x26'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x27')]);router['get'](_0x2bcd('0x28'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x29')]);router[_0x2bcd('0x8')](_0x2bcd('0x2a'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x2b')]);router[_0x2bcd('0x8')](_0x2bcd('0x2c'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x2d')]);router[_0x2bcd('0x8')](_0x2bcd('0x2e'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x2f')]);router[_0x2bcd('0x8')](_0x2bcd('0x30'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x31')]);router[_0x2bcd('0x8')](_0x2bcd('0x32'),auth[_0x2bcd('0x9')](),controller['getSmsAccounts']);router[_0x2bcd('0x8')](_0x2bcd('0x33'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x34')]);router[_0x2bcd('0x8')]('/:id/whatsapp_accounts',auth[_0x2bcd('0x9')](),controller['getWhatsappAccounts']);router[_0x2bcd('0x8')](_0x2bcd('0x35'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x36')]);router[_0x2bcd('0x8')](_0x2bcd('0x37'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x38')]);router[_0x2bcd('0x39')](_0x2bcd('0x14'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x3a')]);router[_0x2bcd('0x39')]('/',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x3b')]);router[_0x2bcd('0x39')](_0x2bcd('0x3c'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x3d')]);router[_0x2bcd('0x39')](_0x2bcd('0x3e'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x3f')]);var upload=multer({'storage':multer[_0x2bcd('0x40')]({'destination':function(_0x59dd3e,_0x530217,_0x5810c3){_0x5810c3(null,path[_0x2bcd('0x41')](config['root'],_0x2bcd('0x42')));},'filename':function(_0x30d605,_0x54f04b,_0x4a45e1){_0x4a45e1(null,util[_0x2bcd('0x43')](_0x2bcd('0x44'),Date[_0x2bcd('0x45')](),_0x54f04b[_0x2bcd('0x46')]));}})});router[_0x2bcd('0x39')](_0x2bcd('0x10'),upload[_0x2bcd('0x47')]('file'),controller[_0x2bcd('0x48')]);router[_0x2bcd('0x39')](_0x2bcd('0x49'),auth['isAuthenticated'](),controller[_0x2bcd('0x4a')]);router[_0x2bcd('0x39')]('/:id/logout',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x4b')]);router[_0x2bcd('0x39')](_0x2bcd('0x4c'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x4d')]);router[_0x2bcd('0x39')](_0x2bcd('0x4e'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x4f')]);router[_0x2bcd('0x39')]('/:id/teams',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x50')]);router[_0x2bcd('0x39')]('/:id/chat_interactions',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x51')]);router['post']('/:id/mail_interactions',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x52')]);router[_0x2bcd('0x39')](_0x2bcd('0x53'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x54')]);router[_0x2bcd('0x39')](_0x2bcd('0x55'),auth[_0x2bcd('0x9')](),controller['addSmsInteractions']);router[_0x2bcd('0x39')](_0x2bcd('0x56'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x57')]);router['post']('/:id/whatsapp_interactions',auth[_0x2bcd('0x9')](),controller['addWhatsappInteractions']);router[_0x2bcd('0x39')](_0x2bcd('0x2c'),auth[_0x2bcd('0x9')](),controller['addFaxAccounts']);router[_0x2bcd('0x39')](_0x2bcd('0x2e'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x2bcd('0x39')]('/:id/openchannel_accounts',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x58')]);router[_0x2bcd('0x39')]('/:id/sms_accounts',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x59')]);router[_0x2bcd('0x39')](_0x2bcd('0x33'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x5a')]);router['post'](_0x2bcd('0x5b'),auth['isAuthenticated'](),controller[_0x2bcd('0x5c')]);router[_0x2bcd('0x39')](_0x2bcd('0x37'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x5d')]);router['put'](_0x2bcd('0xf'),auth['isAuthenticated'](),controller[_0x2bcd('0x5e')]);router[_0x2bcd('0x5f')](_0x2bcd('0x60'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x61')]);router['delete'](_0x2bcd('0x3e'),auth['isAuthenticated'](),controller[_0x2bcd('0x62')]);router[_0x2bcd('0x63')](_0x2bcd('0x64'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x65')]);router[_0x2bcd('0x63')](_0x2bcd('0xf'),auth[_0x2bcd('0x9')](),controller['destroy']);router[_0x2bcd('0x63')](_0x2bcd('0x66'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x67')]);router[_0x2bcd('0x63')]('/:id/mail_interactions',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x68')]);router[_0x2bcd('0x63')]('/:id/fax_interactions',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x69')]);router[_0x2bcd('0x63')](_0x2bcd('0x55'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x6a')]);router[_0x2bcd('0x63')](_0x2bcd('0x56'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x6b')]);router[_0x2bcd('0x63')](_0x2bcd('0x6c'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x6d')]);router[_0x2bcd('0x63')](_0x2bcd('0x2c'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x6e')]);router[_0x2bcd('0x63')](_0x2bcd('0x2e'),auth['isAuthenticated'](),controller[_0x2bcd('0x6f')]);router[_0x2bcd('0x63')](_0x2bcd('0x30'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x70')]);router[_0x2bcd('0x63')](_0x2bcd('0x32'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x71')]);router[_0x2bcd('0x63')](_0x2bcd('0x33'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x2bcd('0x63')](_0x2bcd('0x5b'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x72')]);router[_0x2bcd('0x63')](_0x2bcd('0x37'),auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x73')]);router[_0x2bcd('0x39')]('/:id/messengerSoundNotification',auth[_0x2bcd('0x9')](),controller[_0x2bcd('0x74')]);module[_0x2bcd('0x75')]=router; \ No newline at end of file +var _0x6bf1=['messengerSoundNotification','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','getApiKey','post','create','/create_many','bulkCreate','diskStorage','join','root','format','now','originalname','single','file','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','removeQueues','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification'];(function(_0x2d0cdd,_0x5b25b4){var _0x30ba3a=function(_0x150a0d){while(--_0x150a0d){_0x2d0cdd['push'](_0x2d0cdd['shift']());}};_0x30ba3a(++_0x5b25b4);}(_0x6bf1,0x71));var _0x16bf=function(_0x5296ee,_0x1c060f){_0x5296ee=_0x5296ee-0x0;var _0x374767=_0x6bf1[_0x5296ee];return _0x374767;};'use strict';var multer=require(_0x16bf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x16bf('0x1'));var express=require(_0x16bf('0x2'));var router=express[_0x16bf('0x3')]();var fs_extra=require(_0x16bf('0x4'));var auth=require(_0x16bf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x16bf('0x6'));var controller=require(_0x16bf('0x7'));router[_0x16bf('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x16bf('0x8')](_0x16bf('0x9'),auth[_0x16bf('0xa')](),controller[_0x16bf('0xb')]);router[_0x16bf('0x8')](_0x16bf('0xc'),auth[_0x16bf('0xa')](),controller[_0x16bf('0xd')]);router['get'](_0x16bf('0xe'),auth[_0x16bf('0xa')](),controller[_0x16bf('0xf')]);router[_0x16bf('0x8')](_0x16bf('0x10'),auth[_0x16bf('0xa')](),controller['show']);router['get'](_0x16bf('0x11'),controller[_0x16bf('0x12')]);router[_0x16bf('0x8')](_0x16bf('0x13'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x14')]);router[_0x16bf('0x8')](_0x16bf('0x15'),auth[_0x16bf('0xa')](),controller['getContacts']);router[_0x16bf('0x8')](_0x16bf('0x16'),auth['isAuthenticated'](),controller[_0x16bf('0x17')]);router[_0x16bf('0x8')](_0x16bf('0x18'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x19')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller[_0x16bf('0x1a')]);router['get'](_0x16bf('0x1b'),auth['isAuthenticated'](),controller[_0x16bf('0x1c')]);router['get'](_0x16bf('0x1d'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x1e')]);router[_0x16bf('0x8')](_0x16bf('0x1f'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x20')]);router['get']('/:id/openchannel/interactions',auth[_0x16bf('0xa')](),controller[_0x16bf('0x21')]);router['get']('/:id/mail/interactions',auth[_0x16bf('0xa')](),controller[_0x16bf('0x22')]);router[_0x16bf('0x8')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x16bf('0x23')]);router[_0x16bf('0x8')](_0x16bf('0x24'),auth[_0x16bf('0xa')](),controller['getFaxInteractions']);router[_0x16bf('0x8')](_0x16bf('0x25'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x26')]);router['get'](_0x16bf('0x27'),auth[_0x16bf('0xa')](),controller['getTeams']);router['get'](_0x16bf('0x28'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x29')]);router[_0x16bf('0x8')](_0x16bf('0x2a'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x2b')]);router['get'](_0x16bf('0x2c'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x2d')]);router['get'](_0x16bf('0x2e'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x2f')]);router[_0x16bf('0x8')](_0x16bf('0x30'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x31')]);router[_0x16bf('0x8')](_0x16bf('0x32'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x33')]);router[_0x16bf('0x8')](_0x16bf('0x34'),auth[_0x16bf('0xa')](),controller['getSmsAccounts']);router[_0x16bf('0x8')](_0x16bf('0x35'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x16bf('0x8')](_0x16bf('0x36'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x37')]);router[_0x16bf('0x8')]('/:id/scheduled_calls',auth[_0x16bf('0xa')](),controller[_0x16bf('0x38')]);router['get']('/:id/api_key',auth[_0x16bf('0xa')](),controller[_0x16bf('0x39')]);router[_0x16bf('0x3a')](_0x16bf('0x15'),auth[_0x16bf('0xa')](),controller['addContacts']);router['post']('/',auth['isAuthenticated'](),controller[_0x16bf('0x3b')]);router[_0x16bf('0x3a')](_0x16bf('0x3c'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x3d')]);router['post'](_0x16bf('0x16'),auth[_0x16bf('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x16bf('0x3e')]({'destination':function(_0x32d8b0,_0x338aca,_0x285932){_0x285932(null,path[_0x16bf('0x3f')](config[_0x16bf('0x40')],'server/files/images/'));},'filename':function(_0x87fabf,_0x3307b7,_0x5d5796){_0x5d5796(null,util[_0x16bf('0x41')]('%s-%s',Date[_0x16bf('0x42')](),_0x3307b7[_0x16bf('0x43')]));}})});router[_0x16bf('0x3a')](_0x16bf('0x11'),upload[_0x16bf('0x44')](_0x16bf('0x45')),controller['addAvatar']);router[_0x16bf('0x3a')](_0x16bf('0x46'),auth[_0x16bf('0xa')](),controller['login']);router[_0x16bf('0x3a')](_0x16bf('0x47'),auth['isAuthenticated'](),controller[_0x16bf('0x48')]);router[_0x16bf('0x3a')](_0x16bf('0x49'),auth[_0x16bf('0xa')](),controller['pause']);router[_0x16bf('0x3a')](_0x16bf('0x4a'),auth['isAuthenticated'](),controller[_0x16bf('0x4b')]);router['post'](_0x16bf('0x27'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x4c')]);router[_0x16bf('0x3a')](_0x16bf('0x4d'),auth[_0x16bf('0xa')](),controller['addChatInteractions']);router['post'](_0x16bf('0x4e'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x4f')]);router['post'](_0x16bf('0x50'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x51')]);router[_0x16bf('0x3a')](_0x16bf('0x52'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x53')]);router['post'](_0x16bf('0x54'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x55')]);router[_0x16bf('0x3a')](_0x16bf('0x56'),auth[_0x16bf('0xa')](),controller['addWhatsappInteractions']);router[_0x16bf('0x3a')](_0x16bf('0x2e'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x57')]);router[_0x16bf('0x3a')](_0x16bf('0x30'),auth[_0x16bf('0xa')](),controller['addMailAccounts']);router[_0x16bf('0x3a')](_0x16bf('0x32'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x58')]);router[_0x16bf('0x3a')](_0x16bf('0x34'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x59')]);router[_0x16bf('0x3a')](_0x16bf('0x35'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x5a')]);router[_0x16bf('0x3a')](_0x16bf('0x36'),auth['isAuthenticated'](),controller[_0x16bf('0x5b')]);router[_0x16bf('0x3a')](_0x16bf('0x5c'),auth['isAuthenticated'](),controller[_0x16bf('0x5d')]);router[_0x16bf('0x5e')](_0x16bf('0x10'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x5f')]);router[_0x16bf('0x5e')]('/:id/password',auth['isAuthenticated'](),controller['changePassword']);router['delete'](_0x16bf('0x16'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x60')]);router[_0x16bf('0x61')](_0x16bf('0x27'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x62')]);router[_0x16bf('0x61')]('/:id',auth[_0x16bf('0xa')](),controller[_0x16bf('0x63')]);router[_0x16bf('0x61')](_0x16bf('0x4d'),auth[_0x16bf('0xa')](),controller['removeChatInteractions']);router[_0x16bf('0x61')](_0x16bf('0x4e'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x64')]);router[_0x16bf('0x61')](_0x16bf('0x50'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x65')]);router[_0x16bf('0x61')]('/:id/sms_interactions',auth[_0x16bf('0xa')](),controller['removeSmsInteractions']);router['delete'](_0x16bf('0x54'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x66')]);router[_0x16bf('0x61')](_0x16bf('0x56'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x67')]);router[_0x16bf('0x61')](_0x16bf('0x2e'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x68')]);router[_0x16bf('0x61')](_0x16bf('0x30'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x69')]);router['delete'](_0x16bf('0x32'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x6a')]);router[_0x16bf('0x61')](_0x16bf('0x34'),auth['isAuthenticated'](),controller[_0x16bf('0x6b')]);router[_0x16bf('0x61')](_0x16bf('0x35'),auth[_0x16bf('0xa')](),controller['removeChatWebsites']);router[_0x16bf('0x61')](_0x16bf('0x36'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x6c')]);router['delete']('/:id/api_key',auth[_0x16bf('0xa')](),controller[_0x16bf('0x6d')]);router[_0x16bf('0x3a')](_0x16bf('0x6e'),auth[_0x16bf('0xa')](),controller[_0x16bf('0x6f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c3013ed..4c5b378 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 _0x35ba=['ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','uac','uas','fingerprint','certificate','active','passive','showWebBar','get','wss','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','icesupport','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','internal','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer'];(function(_0x1ba14f,_0x370fc2){var _0x23ca83=function(_0x41ee8b){while(--_0x41ee8b){_0x1ba14f['push'](_0x1ba14f['shift']());}};_0x23ca83(++_0x370fc2);}(_0x35ba,0x9b));var _0xa35b=function(_0xbe6d5d,_0x308a41){_0xbe6d5d=_0xbe6d5d-0x0;var _0x2cb584=_0x35ba[_0xbe6d5d];return _0x2cb584;};'use strict';var Sequelize=require(_0xa35b('0x0'));var moment=require(_0xa35b('0x1'));var util=require(_0xa35b('0x2'));var _=require(_0xa35b('0x3'));module[_0xa35b('0x4')]={'name':{'type':Sequelize[_0xa35b('0x5')],'allowNull':![],'unique':_0xa35b('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x93c319){this['setDataValue']('name',_0x93c319);this[_0xa35b('0x7')](_0xa35b('0x8'),_0x93c319);},'comment':_0xa35b('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1693c1){this[_0xa35b('0x7')](_0xa35b('0xa'),_0x1693c1);this[_0xa35b('0x7')](_0xa35b('0xb'),util['format'](_0xa35b('0xc'),_0x1693c1,this[_0xa35b('0xd')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa35b('0xe'),'validate':{'isEmail':!![]},'set':function(_0x16aa5c){if(_0x16aa5c){this['setDataValue'](_0xa35b('0xe'),_0x16aa5c[_0xa35b('0xf')]());}}},'role':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x11'),_0xa35b('0x12'),'agent',_0xa35b('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xa35b('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa35b('0x5')],'defaultValue':_0xa35b('0x14')},'internal':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':![],'unique':_0xa35b('0x16'),'set':function(_0x43a4cb){this[_0xa35b('0x7')]('internal',_0x43a4cb);this[_0xa35b('0x7')](_0xa35b('0x17'),_0x43a4cb);this[_0xa35b('0x7')](_0xa35b('0xb'),util[_0xa35b('0x18')]('\x22%s\x22\x20<%s>',this[_0xa35b('0xd')](_0xa35b('0xa')),_0x43a4cb));}},'salt':{'type':Sequelize[_0xa35b('0x5')]},'phone':{'type':Sequelize[_0xa35b('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xa35b('0x5')]},'zipcode':{'type':Sequelize[_0xa35b('0x5')]},'userpic':{'type':Sequelize[_0xa35b('0x5')]},'city':{'type':Sequelize[_0xa35b('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa35b('0x1a')]},'voicePause':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa35b('0x5')],'defaultValue':_0xa35b('0x1b')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa35b('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xa35b('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![],'defaultValue':_0xa35b('0x1c')},'ipaddr':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x1d'),_0xa35b('0x12'),_0xa35b('0x1e')),'allowNull':!![],'defaultValue':_0xa35b('0x1d')},'context':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x1f'),_0xa35b('0x20'),_0xa35b('0x21'),_0xa35b('0x22'),_0xa35b('0x23'),_0xa35b('0x24'),_0xa35b('0x25'),_0xa35b('0x26')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![],'defaultValue':_0xa35b('0x27'),'set':function(_0x779ace){this[_0xa35b('0x7')](_0xa35b('0x28'),_0x779ace?_0x779ace['join'](','):null);},'get':function(){return this[_0xa35b('0xd')]('transport')?this[_0xa35b('0xd')](_0xa35b('0x28'))[_0xa35b('0x29')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2a'),'info',_0xa35b('0x2b'),_0xa35b('0x2c'),_0xa35b('0x2d')),'allowNull':!![],'defaultValue':_0xa35b('0x2a')},'directmedia':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no',_0xa35b('0x2f'),_0xa35b('0x30'),_0xa35b('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa35b('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![],'defaultValue':_0xa35b('0x32'),'set':function(_0x3236b8){this[_0xa35b('0x7')](_0xa35b('0x33'),_0x3236b8?_0x3236b8[_0xa35b('0x34')](','):null);},'get':function(){return this[_0xa35b('0xd')](_0xa35b('0x33'))?this[_0xa35b('0xd')](_0xa35b('0x33'))[_0xa35b('0x29')](','):null;},'comment':_0xa35b('0x35')},'callgroup':{'type':Sequelize[_0xa35b('0x5')]},'namedcallgroup':{'type':Sequelize[_0xa35b('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xa35b('0x5')]},'language':{'type':Sequelize[_0xa35b('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa35b('0x5')]},'disallow':{'type':Sequelize[_0xa35b('0x5')],'allowNull':![],'defaultValue':_0xa35b('0x36')},'allow':{'type':Sequelize[_0xa35b('0x5')],'allowNull':![],'defaultValue':_0xa35b('0x37'),'set':function(_0x10e981){this['setDataValue'](_0xa35b('0x38'),_0x10e981?_0x10e981['join'](';'):_0xa35b('0x37'));},'get':function(){return this['getDataValue'](_0xa35b('0x38'))?this['getDataValue'](_0xa35b('0x38'))[_0xa35b('0x29')](';'):null;},'comment':_0xa35b('0x39')},'autoframing':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![],'set':function(_0x85570a){this['setDataValue'](_0xa35b('0x3a'),_0x85570a?_0x85570a[_0xa35b('0x34')](','):null);},'get':function(){return this[_0xa35b('0xd')](_0xa35b('0x3a'))?this['getDataValue'](_0xa35b('0x3a'))['split'](','):null;},'comment':_0xa35b('0x3b')},'trustrpid':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xa35b('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa35b('0x10')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![],'defaultValue':_0xa35b('0x3c')},'amaflags':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xa35b('0x2e')},'busylevel':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xa35b('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xa35b('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no',_0xa35b('0x3d')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa35b('0x10')]('accept','refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x3e'),_0xa35b('0x3f')),'allowNull':!![],'defaultValue':_0xa35b('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xa35b('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xa35b('0x2e')},'keepalive':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xa35b('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xa35b('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa35b('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa35b('0x10')]('yes','no',_0xa35b('0x40'),_0xa35b('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x42'),_0xa35b('0x43'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xa35b('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0xa35b('0x30'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa35b('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xa35b('0x1a')]},'passwordResetAt':{'type':Sequelize[_0xa35b('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0,'set':function(_0x1286e6){this[_0xa35b('0x7')](_0xa35b('0x44'),_0x1286e6);var _0x3be4ac=this[_0xa35b('0x45')]({'plain':!![]});switch(_0x1286e6){case 0x0:case 0x1:var _0x2733c1=_0x3be4ac[_0xa35b('0x28')]?_['isArray'](_0x3be4ac[_0xa35b('0x28')])?_0x3be4ac[_0xa35b('0x28')][_0xa35b('0x34')]():_0x3be4ac[_0xa35b('0x28')]:'udp';if(_0x2733c1===_0xa35b('0x46')){_0x2733c1=_0xa35b('0x27');}this[_0xa35b('0x7')](_0xa35b('0x28'),_0x2733c1);this['setDataValue'](_0xa35b('0x47'),'no');this[_0xa35b('0x7')](_0xa35b('0x48'),null);this[_0xa35b('0x7')](_0xa35b('0x49'),null);this[_0xa35b('0x7')]('icesupport',null);this[_0xa35b('0x7')](_0xa35b('0x4a'),null);this['setDataValue'](_0xa35b('0x4b'),null);this[_0xa35b('0x7')](_0xa35b('0x4c'),null);this[_0xa35b('0x7')](_0xa35b('0x4d'),null);this['setDataValue'](_0xa35b('0x4e'),null);this[_0xa35b('0x7')](_0xa35b('0x4f'),'no');break;case 0x2:this[_0xa35b('0x7')](_0xa35b('0x28'),'wss');this[_0xa35b('0x7')]('encryption',_0xa35b('0x2e'));this[_0xa35b('0x7')](_0xa35b('0x48'),_0xa35b('0x2e'));this[_0xa35b('0x7')]('force_avp',_0xa35b('0x2e'));this[_0xa35b('0x7')](_0xa35b('0x50'),_0xa35b('0x2e'));this[_0xa35b('0x7')](_0xa35b('0x4a'),_0xa35b('0x2e'));this[_0xa35b('0x7')](_0xa35b('0x4b'),'no');this[_0xa35b('0x7')](_0xa35b('0x4c'),_0xa35b('0x51'));this[_0xa35b('0x7')]('dtlscertfile',_0x3be4ac[_0xa35b('0x4d')]||_0xa35b('0x52'));this[_0xa35b('0x7')]('dtlsprivatekey',_0x3be4ac[_0xa35b('0x4e')]||_0xa35b('0x53'));this[_0xa35b('0x7')]('rtcp_mux',_0xa35b('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0xa35b('0x54')],'set':function(_0x3a052f){this[_0xa35b('0x7')](_0xa35b('0x55'),_0x3a052f?_0x3a052f[_0xa35b('0x34')](','):[]);},'get':function(){return this[_0xa35b('0xd')](_0xa35b('0x55'))?_['map'](this[_0xa35b('0xd')]('permissions')[_0xa35b('0x29')](','),function(_0x4f8499){return parseInt(_0x4f8499,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa35b('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa35b('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa35b('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa35b('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa35b('0x10')](_0xa35b('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa35b('0x56')],'get':function(){return this[_0xa35b('0xd')]('phoneBarEnableScreenRecordingByAgent')?this[_0xa35b('0xd')](_0xa35b('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa35b('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa35b('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![],'set':function(_0x274de4){if(typeof _0x274de4===_0xa35b('0x58')){var _0x2299a4=_0x274de4==='1'?!![]:_0x274de4==='0'?![]:_0x274de4===_0xa35b('0x59')?!![]:_0x274de4==='false'?![]:![];this[_0xa35b('0x7')](_0xa35b('0x5a'),_0x2299a4);}else{this[_0xa35b('0x7')](_0xa35b('0x5a'),_0x274de4);}}},'blocked':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![],'set':function(_0x5accfe){this[_0xa35b('0x7')](_0xa35b('0x5b'),_0x5accfe);if(_0x5accfe===!![]){this[_0xa35b('0x7')](_0xa35b('0x5c'),moment());this[_0xa35b('0x7')]('loginAttempts',0x0);}else{this[_0xa35b('0x7')](_0xa35b('0x5c'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa35b('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xa35b('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xa35b('0x19')],'defaultValue':![]}}; \ No newline at end of file +var _0x33f0=['STRING','setDataValue','name','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','accountcode','callerid','getDataValue','DATE','BOOLEAN','INTEGER','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','nonat','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','active','actpass','update','update,nonat','TEXT','showWebBar','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','string','true','screenrecording','blockedAt','loginAttempts','UNSIGNED','sequelize','lodash'];(function(_0x51434e,_0x5a7c93){var _0x404b83=function(_0x372327){while(--_0x372327){_0x51434e['push'](_0x51434e['shift']());}};_0x404b83(++_0x5a7c93);}(_0x33f0,0xa8));var _0x033f=function(_0x80851a,_0x170f0c){_0x80851a=_0x80851a-0x0;var _0x2d1880=_0x33f0[_0x80851a];return _0x2d1880;};'use strict';var Sequelize=require(_0x033f('0x0'));var moment=require('moment');var util=require('util');var _=require(_0x033f('0x1'));module['exports']={'name':{'type':Sequelize[_0x033f('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2cecc7){this[_0x033f('0x3')](_0x033f('0x4'),_0x2cecc7);this[_0x033f('0x3')]('defaultuser',_0x2cecc7);},'comment':_0x033f('0x5')},'fullname':{'type':Sequelize[_0x033f('0x2')],'allowNull':![],'set':function(_0x4211bc){this['setDataValue'](_0x033f('0x6'),_0x4211bc);this[_0x033f('0x3')]('callerid',util[_0x033f('0x7')](_0x033f('0x8'),_0x4211bc,this['getDataValue'](_0x033f('0x9'))));}},'alias':{'type':Sequelize[_0x033f('0x2')]},'email':{'type':Sequelize[_0x033f('0x2')],'allowNull':![],'unique':_0x033f('0xa'),'validate':{'isEmail':!![]},'set':function(_0x192ca4){if(_0x192ca4){this[_0x033f('0x3')]('email',_0x192ca4[_0x033f('0xb')]());}}},'role':{'type':Sequelize[_0x033f('0xc')](_0x033f('0xd'),_0x033f('0xe'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x033f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x033f('0x2')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x033f('0x9'),'set':function(_0x398498){this['setDataValue']('internal',_0x398498);this[_0x033f('0x3')](_0x033f('0xf'),_0x398498);this[_0x033f('0x3')](_0x033f('0x10'),util[_0x033f('0x7')](_0x033f('0x8'),this[_0x033f('0x11')](_0x033f('0x6')),_0x398498));}},'salt':{'type':Sequelize[_0x033f('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x033f('0x2')]},'address':{'type':Sequelize[_0x033f('0x2')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x033f('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x033f('0x12')]},'voicePause':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x033f('0x2')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x033f('0x12')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x033f('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x033f('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![],'defaultValue':_0x033f('0x15')},'ipaddr':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x033f('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x16'),_0x033f('0xe'),_0x033f('0x17')),'allowNull':!![],'defaultValue':_0x033f('0x16')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x18'),_0x033f('0x19'),_0x033f('0x1a'),'ALLOWED','PROHIB_NOT_SCREENED',_0x033f('0x1b'),_0x033f('0x1c'),_0x033f('0x1d')),'allowNull':!![]},'deny':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3966aa){this[_0x033f('0x3')](_0x033f('0x1e'),_0x3966aa?_0x3966aa['join'](','):null);},'get':function(){return this['getDataValue'](_0x033f('0x1e'))?this[_0x033f('0x11')](_0x033f('0x1e'))[_0x033f('0x1f')](','):null;},'comment':_0x033f('0x20')},'dtmfmode':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x21'),_0x033f('0x22'),'shortinfo',_0x033f('0x23'),_0x033f('0x24')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x033f('0xc')]('yes','no',_0x033f('0x25'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x033f('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![],'defaultValue':_0x033f('0x26'),'set':function(_0x29d35e){this[_0x033f('0x3')](_0x033f('0x27'),_0x29d35e?_0x29d35e[_0x033f('0x28')](','):null);},'get':function(){return this[_0x033f('0x11')]('nat')?this[_0x033f('0x11')](_0x033f('0x27'))['split'](','):null;},'comment':_0x033f('0x29')},'callgroup':{'type':Sequelize[_0x033f('0x2')]},'namedcallgroup':{'type':Sequelize[_0x033f('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x033f('0x2')]},'language':{'type':Sequelize[_0x033f('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x033f('0x2a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x47d771){this[_0x033f('0x3')](_0x033f('0x2b'),_0x47d771?_0x47d771['join'](';'):_0x033f('0x2c'));},'get':function(){return this[_0x033f('0x11')](_0x033f('0x2b'))?this[_0x033f('0x11')]('allow')[_0x033f('0x1f')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x4e8a09){this[_0x033f('0x3')]('insecure',_0x4e8a09?_0x4e8a09['join'](','):null);},'get':function(){return this[_0x033f('0x11')](_0x033f('0x2e'))?this[_0x033f('0x11')]('insecure')[_0x033f('0x1f')](','):null;},'comment':_0x033f('0x2f')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x033f('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no',_0x033f('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![],'defaultValue':_0x033f('0x31')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x033f('0x2d')},'busylevel':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x033f('0xc')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x033f('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x033f('0xc')]('yes','no',_0x033f('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x033f('0xc')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x033f('0x33'),_0x033f('0x34'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x033f('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x033f('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x033f('0x2d')},'keepalive':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x033f('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no',_0x033f('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x38'),'passive',_0x033f('0x39')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x033f('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x033f('0xc')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x033f('0xc')]('yes','no',_0x033f('0x25'),_0x033f('0x3a'),_0x033f('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x033f('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x033f('0x3c')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x572842){this['setDataValue'](_0x033f('0x3d'),_0x572842);var _0x3d2d5c=this['get']({'plain':!![]});switch(_0x572842){case 0x0:case 0x1:var _0x4a0662=_0x3d2d5c[_0x033f('0x1e')]?_[_0x033f('0x3e')](_0x3d2d5c[_0x033f('0x1e')])?_0x3d2d5c['transport'][_0x033f('0x28')]():_0x3d2d5c['transport']:_0x033f('0x3f');if(_0x4a0662===_0x033f('0x40')){_0x4a0662='udp';}this[_0x033f('0x3')](_0x033f('0x1e'),_0x4a0662);this[_0x033f('0x3')](_0x033f('0x41'),'no');this[_0x033f('0x3')](_0x033f('0x42'),null);this[_0x033f('0x3')](_0x033f('0x43'),null);this[_0x033f('0x3')](_0x033f('0x44'),null);this['setDataValue'](_0x033f('0x45'),null);this['setDataValue'](_0x033f('0x46'),null);this[_0x033f('0x3')](_0x033f('0x47'),null);this['setDataValue'](_0x033f('0x48'),null);this[_0x033f('0x3')]('dtlsprivatekey',null);this[_0x033f('0x3')](_0x033f('0x49'),'no');break;case 0x2:this['setDataValue'](_0x033f('0x1e'),'wss');this[_0x033f('0x3')]('encryption',_0x033f('0x2d'));this['setDataValue'](_0x033f('0x42'),_0x033f('0x2d'));this[_0x033f('0x3')](_0x033f('0x43'),_0x033f('0x2d'));this[_0x033f('0x3')](_0x033f('0x44'),'yes');this[_0x033f('0x3')](_0x033f('0x45'),_0x033f('0x2d'));this[_0x033f('0x3')]('dtlsverify','no');this[_0x033f('0x3')](_0x033f('0x47'),_0x033f('0x39'));this[_0x033f('0x3')]('dtlscertfile',_0x3d2d5c['dtlscertfile']||_0x033f('0x4a'));this['setDataValue']('dtlsprivatekey',_0x3d2d5c['dtlsprivatekey']||_0x033f('0x4b'));this['setDataValue'](_0x033f('0x49'),_0x033f('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x033f('0x3c')],'set':function(_0x10b6ef){this['setDataValue'](_0x033f('0x4c'),_0x10b6ef?_0x10b6ef[_0x033f('0x28')](','):[]);},'get':function(){return this[_0x033f('0x11')](_0x033f('0x4c'))?_[_0x033f('0x4d')](this[_0x033f('0x11')]('permissions')[_0x033f('0x1f')](','),function(_0x38c73c){return parseInt(_0x38c73c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x033f('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x033f('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0x033f('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x033f('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x033f('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x033f('0x2')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x033f('0xc')](_0x033f('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x033f('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x033f('0x4e')],'get':function(){return this[_0x033f('0x11')]('phoneBarEnableScreenRecordingByAgent')?this[_0x033f('0x11')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x033f('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x033f('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![],'set':function(_0x967734){if(typeof _0x967734===_0x033f('0x4f')){var _0x281ae9=_0x967734==='1'?!![]:_0x967734==='0'?![]:_0x967734===_0x033f('0x50')?!![]:_0x967734==='false'?![]:![];this[_0x033f('0x3')]('screenrecording',_0x281ae9);}else{this['setDataValue'](_0x033f('0x51'),_0x967734);}}},'blocked':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![],'set':function(_0x1dd03f){this[_0x033f('0x3')]('blocked',_0x1dd03f);if(_0x1dd03f===!![]){this[_0x033f('0x3')](_0x033f('0x52'),moment());this[_0x033f('0x3')](_0x033f('0x53'),0x0);}else{this[_0x033f('0x3')](_0x033f('0x52'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x033f('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x033f('0x14')](0x5)[_0x033f('0x54')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x033f('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x033f('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a309370..1922331 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 _0x7e74=['pick','filters','merge','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','order','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','resolve','pause','QueuePause','updateAttributes','bulkCreate','mailPause','chatPause','smsPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','Voice','CmList','getAgents','values','CmHopper','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$or','$gt','$gte','$lt','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$any','firstName','lastName','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','whoami','send','getUserSetting','getPresence','unknown','ringing','queues','flatten','toString','lower','desc','asc','substring','uniqBy','orderBy','offline','unavailable','voiceStatus','busy','slice','charAt','toUpperCase','QueryTypes','select','field','ui.','InteractionId','user_has_','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','path','lodash','ioredis','../../components/auth/service','../../components/contacts','../../components/realtime/agents','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APIForbiddenrror','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','client','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','update','emit','userNotification:recalc:','get','role','admin','Users','user','Agents','Telephones','telephone','ignore','map','value','includes','find','name','destroy','end','stack','User','rawAttributes','fieldName','type','key','filter','password','previousPasswords','resetPasswordExpires','md5secret','index','getOptions','query','includeAll','include','userSetting','true','UserSetting','attributes','push','rows','openTabs','length','chat','fax','mail','dataValues','openchannel','whatsapp','all','show','params','options','sms','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','agent','permissions','101','102','103','113','110','104','105','107','108','100','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','checkUserLimits','some','findAll','isEmpty','autoAssociation','compact','UserProfileResource','newPassword','Sequelize','ValidationError','authenticate','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Unauthorized','findOne','enforcePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','capitalize','toLowerCase','Queues','penalty','spread','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','Unknown\x20channel','QueueId','Queue:remove','addAvatar','userpic','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','ChatOpenTabs','CHAT','createdAt','OpenchannelOpenTabs','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','hasOwnProperty','Tags','color','tag','getQueues','model','Queue','keys','intersection','fields','sort','where'];(function(_0x52ca59,_0x279dda){var _0x1ab7e5=function(_0x2b8c74){while(--_0x2b8c74){_0x52ca59['push'](_0x52ca59['shift']());}};_0x1ab7e5(++_0x279dda);}(_0x7e74,0xb7));var _0x47e7=function(_0x5af98e,_0x13d8fd){_0x5af98e=_0x5af98e-0x0;var _0x88a7a7=_0x7e74[_0x5af98e];return _0x88a7a7;};'use strict';var moment=require(_0x47e7('0x0'));var util=require('util');var path=require(_0x47e7('0x1'));var fs=require('fs');var _=require(_0x47e7('0x2'));var squel=require('squel');var Redis=require(_0x47e7('0x3'));var jayson=require('jayson/promise');var authService=require(_0x47e7('0x4'));var contacts=require(_0x47e7('0x5'));var qs=require('../../components/parsers/qs');var rta=require(_0x47e7('0x6'));var logger=require(_0x47e7('0x7'))(_0x47e7('0x8'));var utils=require('../../config/utils');var config=require(_0x47e7('0x9'));var licenseUtil=require(_0x47e7('0xa'));var APIBadRequestError=require(_0x47e7('0xb'))[_0x47e7('0xc')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIForbiddenError=require(_0x47e7('0xb'))[_0x47e7('0xd')];var APIHandleError=require(_0x47e7('0xb'))['handleError'];var db=require(_0x47e7('0xe'))['db'];var socket=require(_0x47e7('0xf'))(new Redis(config[_0x47e7('0x10')]));require('./user.socket')[_0x47e7('0x11')](socket);config['redis']=_[_0x47e7('0x12')](config[_0x47e7('0x10')],{'host':_0x47e7('0x13'),'port':0x18eb});var amiClient=jayson[_0x47e7('0x14')]['http']({'port':0x232a});var values;function respondWithStatusCode(_0x60ee62,_0x59b735){_0x59b735=_0x59b735||0xcc;return function(_0x590972){if(_0x590972){return _0x60ee62[_0x47e7('0x15')](_0x59b735);}return _0x60ee62[_0x47e7('0x16')](_0x59b735)['end']();};}function respondWithResult(_0x6b2b7,_0x599517){_0x599517=_0x599517||0xc8;return function(_0x432b9c){if(_0x432b9c){return _0x6b2b7[_0x47e7('0x16')](_0x599517)[_0x47e7('0x17')](_0x432b9c);}};}function respondWithFilteredResult(_0x5a1eb3,_0x4625a1){return function(_0x227209){if(_0x227209){var _0x1f1700=typeof _0x4625a1[_0x47e7('0x18')]===_0x47e7('0x19')&&typeof _0x4625a1[_0x47e7('0x1a')]==='undefined';var _0x26258c=_0x227209[_0x47e7('0x1b')];var _0x4c8a5f=_0x1f1700?0x0:_0x4625a1[_0x47e7('0x18')];var _0x6b5758=_0x1f1700?_0x227209['count']:_0x4625a1[_0x47e7('0x18')]+_0x4625a1[_0x47e7('0x1a')];var _0x8d70d;if(_0x6b5758>=_0x26258c){_0x6b5758=_0x26258c;_0x8d70d=0xc8;}else{_0x8d70d=0xce;}_0x5a1eb3[_0x47e7('0x16')](_0x8d70d);return _0x5a1eb3[_0x47e7('0x1c')](_0x47e7('0x1d'),_0x4c8a5f+'-'+_0x6b5758+'/'+_0x26258c)['json'](_0x227209);}return null;};}function respondWithRpcPromise(_0x1f5f49,_0x299e3c,_0x41be0b,_0x2cd30e){return new Promise(function(_0x561591,_0x5a8d4f){var _0x5af157=_0x2cd30e||amiClient;return _0x5af157['request'](_0x1f5f49,_0x41be0b)[_0x47e7('0x1e')](function(_0x1550d0){logger[_0x47e7('0x1f')](_0x47e7('0x20'),_0x299e3c,'request\x20sent');logger[_0x47e7('0x21')](_0x47e7('0x22'),_0x299e3c,'request\x20sent',JSON[_0x47e7('0x23')](_0x1550d0));if(_0x1550d0[_0x47e7('0x24')]){if(_0x1550d0[_0x47e7('0x24')]['code']===0x1f4){logger[_0x47e7('0x24')](_0x47e7('0x20'),_0x299e3c,_0x1550d0[_0x47e7('0x24')][_0x47e7('0x25')]);return _0x5a8d4f(_0x1550d0[_0x47e7('0x24')]['message']);}logger[_0x47e7('0x24')](_0x47e7('0x20'),_0x299e3c,_0x1550d0[_0x47e7('0x24')][_0x47e7('0x25')]);return _0x561591(_0x1550d0['error'][_0x47e7('0x25')]);}else{logger[_0x47e7('0x1f')](_0x47e7('0x20'),_0x299e3c,_0x47e7('0x26'));_0x561591(_0x1550d0[_0x47e7('0x27')]['message']);}})[_0x47e7('0x28')](function(_0x19475e){logger[_0x47e7('0x24')]('User,\x20%s,\x20%s',_0x299e3c,_0x19475e);_0x5a8d4f(_0x19475e);});});}function saveUpdates(_0xafba11){return function(_0x55b6bb){if(_0x55b6bb){return _0x55b6bb[_0x47e7('0x29')](_0xafba11)[_0x47e7('0x1e')](function(_0x3c7f4e){if(_0x3c7f4e['role']==='agent'){socket[_0x47e7('0x2a')](_0x47e7('0x2b')+_0x3c7f4e['id'],_0x3c7f4e);}return _0x3c7f4e;});}return null;};}function removeEntity(_0x25c9d8,_0x55ed05){return function(_0x426ef2){if(_0x426ef2){return _0x426ef2['destroy']({'transaction':_0x55ed05})[_0x47e7('0x1e')](function(){var _0x1a50d9=_0x426ef2[_0x47e7('0x2c')]({'plain':!![]});if(_0x1a50d9[_0x47e7('0x2d')]===_0x47e7('0x2e'))return;var _0x135d24=[{'name':_0x47e7('0x2f'),'value':_0x47e7('0x30'),'ignore':!![]},{'name':_0x47e7('0x31'),'value':'agent','ignore':![]},{'name':_0x47e7('0x32'),'value':_0x47e7('0x33'),'ignore':![]}];var _0x193b60=_(_0x135d24)['filter'](_0x47e7('0x34'))[_0x47e7('0x35')](_0x47e7('0x36'))[_0x47e7('0x36')]();if(_[_0x47e7('0x37')](_0x193b60,_0x1a50d9[_0x47e7('0x2d')])){return;}var _0x130134=_[_0x47e7('0x38')](_0x135d24,[_0x47e7('0x36'),_0x1a50d9[_0x47e7('0x2d')]])[_0x47e7('0x39')];return db['UserProfileResource'][_0x47e7('0x3a')]({'where':{'type':_0x130134,'resourceId':_0x1a50d9['id']},'transaction':_0x55ed05})[_0x47e7('0x1e')](function(){return _0x426ef2;});})[_0x47e7('0x1e')](function(){_0x25c9d8[_0x47e7('0x16')](0xcc)[_0x47e7('0x3b')]();});}};}function handleEntityNotFound(_0x18b36d){return function(_0x50a533){if(!_0x50a533){_0x18b36d[_0x47e7('0x15')](0x194);}return _0x50a533;};}function handleError(_0xbddfca,_0x2e2ce3){_0x2e2ce3=_0x2e2ce3||0x1f4;return function(_0x34c8f3){logger[_0x47e7('0x24')](_0x34c8f3[_0x47e7('0x3c')]);if(_0x34c8f3[_0x47e7('0x39')]){delete _0x34c8f3[_0x47e7('0x39')];}_0xbddfca[_0x47e7('0x16')](_0x2e2ce3)['send'](_0x34c8f3);};}function getUserAttributes(){return _(db[_0x47e7('0x3d')][_0x47e7('0x3e')])[_0x47e7('0x35')](function(_0x20de71){return{'name':_0x20de71[_0x47e7('0x3f')],'type':_0x20de71[_0x47e7('0x40')][_0x47e7('0x41')]};})[_0x47e7('0x42')](function(_0x3f7bbc){return![_0x47e7('0x43'),'salt',_0x47e7('0x44'),'resetPasswordToken',_0x47e7('0x45'),_0x47e7('0x46')]['includes'](_0x3f7bbc['name']);})[_0x47e7('0x36')]();}exports[_0x47e7('0x47')]=function(_0x52180,_0x32f47f){var _0x5cd1ad={},_0x2d4b92={'count':0x0,'rows':[]};var _0x108274=getUserAttributes();_0x5cd1ad=qs[_0x47e7('0x48')](_0x108274,_0x52180);var _0x36b069={'where':_0x5cd1ad['where']};return db[_0x47e7('0x3d')][_0x47e7('0x1b')](_0x36b069)[_0x47e7('0x1e')](function(_0x7e3b77){_0x2d4b92[_0x47e7('0x1b')]=_0x7e3b77;if(_0x52180[_0x47e7('0x49')][_0x47e7('0x4a')]){_0x5cd1ad[_0x47e7('0x4b')]=[{'all':!![]}];}if(_0x52180['query'][_0x47e7('0x4c')]===_0x47e7('0x4d')){_0x5cd1ad['include']=[{'model':db[_0x47e7('0x4e')],'as':_0x47e7('0x4c')}];}if(!_[_0x47e7('0x37')](_0x5cd1ad[_0x47e7('0x4f')],'id')){_0x5cd1ad[_0x47e7('0x4f')][_0x47e7('0x50')]('id');}return db[_0x47e7('0x3d')]['findAll'](_0x5cd1ad);})['then'](function(_0x81753c){_0x2d4b92[_0x47e7('0x51')]=_0x81753c;if(_0x52180['query'][_0x47e7('0x52')]===_0x47e7('0x4d')){var _0x28f4d5=[];for(var _0xc62173=0x0;_0xc62173<_0x2d4b92[_0x47e7('0x51')][_0x47e7('0x53')];_0xc62173++){_0x28f4d5[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x54'),_0x2d4b92[_0x47e7('0x51')][_0xc62173]['dataValues']));_0x28f4d5[_0x47e7('0x50')](get_open_tabs('sms',_0x2d4b92[_0x47e7('0x51')][_0xc62173]['dataValues']));_0x28f4d5[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x55'),_0x2d4b92[_0x47e7('0x51')][_0xc62173]['dataValues']));_0x28f4d5['push'](get_open_tabs(_0x47e7('0x56'),_0x2d4b92[_0x47e7('0x51')][_0xc62173][_0x47e7('0x57')]));_0x28f4d5[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x58'),_0x2d4b92[_0x47e7('0x51')][_0xc62173]['dataValues']));_0x28f4d5[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x59'),_0x2d4b92['rows'][_0xc62173][_0x47e7('0x57')]));}return Promise[_0x47e7('0x5a')](_0x28f4d5)['then'](function(){return _0x2d4b92;});}else{return _0x2d4b92;}})[_0x47e7('0x1e')](respondWithFilteredResult(_0x32f47f,_0x5cd1ad))[_0x47e7('0x28')](handleError(_0x32f47f,null));};exports[_0x47e7('0x5b')]=function(_0x32d616,_0x5e3598){var _0x89daa7=getUserAttributes();_0x32d616[_0x47e7('0x49')]['id']=_0x32d616[_0x47e7('0x5c')]['id'];var _0x380a18=qs[_0x47e7('0x48')](_0x89daa7,_0x32d616);if(_0x32d616[_0x47e7('0x49')][_0x47e7('0x4a')]){_0x380a18[_0x47e7('0x4b')]=[{'all':!![]}];}if(_0x32d616[_0x47e7('0x49')][_0x47e7('0x4c')]===_0x47e7('0x4d')){_0x380a18[_0x47e7('0x4b')]=[{'model':db[_0x47e7('0x4e')],'as':_0x47e7('0x4c')}];}_0x380a18=_['merge']({},_0x380a18,_0x32d616[_0x47e7('0x5d')]);if(!_['includes'](_0x380a18[_0x47e7('0x4f')],'id')){_0x380a18[_0x47e7('0x4f')]['push']('id');}return db[_0x47e7('0x3d')][_0x47e7('0x38')](_0x380a18)[_0x47e7('0x1e')](handleEntityNotFound(_0x5e3598,null))[_0x47e7('0x1e')](function(_0x39c11f){var _0x39a138=[];values=_0x39c11f;if(_0x32d616[_0x47e7('0x49')][_0x47e7('0x52')]===_0x47e7('0x4d')){_0x39a138[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x54'),_0x39c11f[_0x47e7('0x57')]));_0x39a138[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x5e'),_0x39c11f['dataValues']));_0x39a138[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x58'),_0x39c11f[_0x47e7('0x57')]));_0x39a138[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x59'),_0x39c11f['dataValues']));_0x39a138[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x55'),_0x39c11f[_0x47e7('0x57')]));_0x39a138['push'](get_open_tabs(_0x47e7('0x56'),_0x39c11f[_0x47e7('0x57')]));return Promise[_0x47e7('0x5a')](_0x39a138);}else{return values;}})[_0x47e7('0x1e')](function(){return values;})[_0x47e7('0x1e')](respondWithResult(_0x5e3598,null))[_0x47e7('0x28')](handleError(_0x5e3598,null));};exports[_0x47e7('0x29')]=function(_0x1e73af,_0x259649){if(_0x1e73af[_0x47e7('0x5f')]['id']){delete _0x1e73af[_0x47e7('0x5f')]['id'];}delete _0x1e73af[_0x47e7('0x5f')][_0x47e7('0x2d')];return db[_0x47e7('0x3d')]['find']({'where':{'id':_0x1e73af[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0x259649,null))[_0x47e7('0x1e')](saveUpdates(_0x1e73af[_0x47e7('0x5f')],null))[_0x47e7('0x1e')](respondWithResult(_0x259649,null))[_0x47e7('0x28')](handleError(_0x259649,null));};exports[_0x47e7('0x60')]=function(_0x58efe7,_0x3bb11b){return db[_0x47e7('0x3d')]['describe']()['then'](respondWithResult(_0x3bb11b,null))[_0x47e7('0x28')](handleError(_0x3bb11b,null));};exports[_0x47e7('0x61')]=function(_0x4ddc24,_0x46d2c4){return db['User'][_0x47e7('0x38')]({'where':{'id':_0x4ddc24[_0x47e7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x46d2c4,null))['then'](function(_0xbb4a64){if(_0xbb4a64){return _0xbb4a64[_0x47e7('0x61')](_0x4ddc24[_0x47e7('0x5f')][_0x47e7('0x62')],_['omit'](_0x4ddc24[_0x47e7('0x5f')],[_0x47e7('0x62'),'id'])||{});}})['then'](respondWithResult(_0x46d2c4,null))[_0x47e7('0x28')](handleError(_0x46d2c4,null));};function validateUser(_0x186e5f){return new Promise(function(_0x260165,_0x2c5a4e){if(_0x186e5f[_0x47e7('0x63')])return _0x260165(_0x186e5f);return db[_0x47e7('0x64')][_0x47e7('0x65')](0x1)['then'](function(_0x2cca02){if(_0x2cca02[_0x47e7('0x66')])authService[_0x47e7('0x67')](_0x186e5f['password']);db[_0x47e7('0x3d')][_0x47e7('0x68')](_0x47e7('0x63'))[_0x47e7('0x1e')](function(_0x1d7ae5){if(_[_0x47e7('0x69')](_0x1d7ae5)){_0x186e5f['internal']=_0x2cca02[_0x47e7('0x6a')]||0x1;return;}if(_[_0x47e7('0x69')](_0x2cca02[_0x47e7('0x6a')])||_0x2cca02['min_internal']===_0x1d7ae5){_0x186e5f[_0x47e7('0x63')]=_0x1d7ae5+0x1;return;}if(_0x2cca02[_0x47e7('0x6a')]>_0x1d7ae5){_0x186e5f[_0x47e7('0x63')]=_0x2cca02['min_internal'];return;}return db['sequelize']['query'](_0x47e7('0x6b'),{'type':db[_0x47e7('0x6c')]['QueryTypes'][_0x47e7('0x6d')]})['then'](function(_0xe6c02c){if(_0xe6c02c&&_0xe6c02c[_0x47e7('0x53')]){for(var _0x190188=0x0,_0x52f274=_0xe6c02c[_0x47e7('0x53')];_0x190188<_0x52f274&&_['isNil'](_0x186e5f[_0x47e7('0x63')]);_0x190188++){if(_0x2cca02[_0x47e7('0x6a')]<=_0xe6c02c[_0x190188][_0x47e7('0x6e')]){_0x186e5f[_0x47e7('0x63')]=_0xe6c02c[_0x190188][_0x47e7('0x6e')];}else if(_0x2cca02[_0x47e7('0x6a')]>_0xe6c02c[_0x190188][_0x47e7('0x6e')]&&_0x2cca02['min_internal']<=_0xe6c02c[_0x190188]['to']){_0x186e5f[_0x47e7('0x63')]=_0x2cca02[_0x47e7('0x6a')];}}}if(_[_0x47e7('0x69')](_0x186e5f['internal'])){_0x186e5f[_0x47e7('0x63')]=_0x1d7ae5+0x1;}return _0x260165(_0x186e5f);});});})[_0x47e7('0x28')](function(_0x40bc21){_0x2c5a4e(_0x40bc21);});});}function updateUser(_0x5bdbc8){return new Promise(function(_0x2ac2d3,_0x13abe0){try{if(_0x5bdbc8[_0x47e7('0x6f')]){_0x5bdbc8[_0x47e7('0x70')]=_0x5bdbc8[_0x47e7('0x63')];_0x5bdbc8[_0x47e7('0x71')]={'mailbox':_0x5bdbc8[_0x47e7('0x63')],'password':_0x5bdbc8[_0x47e7('0x43')],'fullname':_0x5bdbc8[_0x47e7('0x72')],'email':_0x5bdbc8[_0x47e7('0x73')]};}if(_0x5bdbc8['role']===_0x47e7('0x74')){if(!_0x5bdbc8[_0x47e7('0x75')])_0x5bdbc8['permissions']=[_0x47e7('0x76'),_0x47e7('0x77'),_0x47e7('0x78'),_0x47e7('0x79'),_0x47e7('0x7a'),_0x47e7('0x7b'),_0x47e7('0x7c'),'106',_0x47e7('0x7d'),_0x47e7('0x7e'),'109',_0x47e7('0x7f'),'111',_0x47e7('0x80'),_0x47e7('0x81')];}_0x2ac2d3(_0x5bdbc8);}catch(_0x3a5823){_0x13abe0(_0x3a5823);}});}exports[_0x47e7('0x82')]=function(_0x20a20a,_0x6701cc){if(_0x20a20a[_0x47e7('0x30')][_0x47e7('0x2d')]===_0x47e7('0x74'))throw new Error('Unauthorized');if(_0x20a20a['body'][_0x47e7('0x2d')]===_0x47e7('0x30')&&_0x20a20a[_0x47e7('0x30')]['role']!==_0x47e7('0x2e')){throw new Error(_0x47e7('0x83'));}if(_0x20a20a[_0x47e7('0x5f')][_0x47e7('0x2d')]===_0x47e7('0x2e')&&_0x20a20a['user']['role']!==_0x47e7('0x2e')){throw new Error(_0x47e7('0x84'));}return licenseUtil['checkUserLimits']([_0x20a20a[_0x47e7('0x5f')]])[_0x47e7('0x1e')](function(){return validateUser(_0x20a20a[_0x47e7('0x5f')]);})[_0x47e7('0x1e')](function(_0x2bf6fe){return updateUser(_0x2bf6fe)[_0x47e7('0x1e')](function(_0x3693c0){if(_0x3693c0[_0x47e7('0x2d')]===_0x47e7('0x2e')){_0x3693c0[_0x47e7('0x85')]=_0x20a20a[_0x47e7('0x30')][_0x47e7('0x85')];delete _0x3693c0['userProfileId'];}return _0x3693c0;});})[_0x47e7('0x1e')](function(_0x2fd262){return db[_0x47e7('0x3d')][_0x47e7('0x82')](_0x2fd262,{'include':[{'model':db[_0x47e7('0x71')],'as':'VoiceMail'}]});})[_0x47e7('0x1e')](function(_0x1da155){if(_0x20a20a[_0x47e7('0x5f')][_0x47e7('0x2d')]==='user')return _0x1da155;if(_0x20a20a['user'][_0x47e7('0x2d')]!=='user')return _0x1da155;return db[_0x47e7('0x86')][_0x47e7('0x38')]({'where':{'name':_0x1da155[_0x47e7('0x2d')]===_0x47e7('0x74')?_0x47e7('0x31'):'Telephones','userProfileId':_0x20a20a[_0x47e7('0x30')][_0x47e7('0x87')]},'raw':!![]})[_0x47e7('0x1e')](function(_0x11be66){if(!_0x11be66||_0x11be66['autoAssociation']!=0x0)return _0x1da155;return db['UserProfileResource'][_0x47e7('0x82')]({'name':_0x1da155['name'],'resourceId':_0x1da155['id'],'type':_0x11be66[_0x47e7('0x39')],'sectionId':_0x11be66['id']},{})[_0x47e7('0x1e')](function(){return _0x1da155;});})[_0x47e7('0x28')](function(_0x55807c){logger[_0x47e7('0x24')](_0x47e7('0x88'),_0x55807c);throw _0x55807c;});})[_0x47e7('0x1e')](respondWithResult(_0x6701cc,0xc9))[_0x47e7('0x28')](handleError(_0x6701cc,null));};exports['bulkCreate']=function(_0x19ad16,_0x2da680){var _0x40566a=_0x19ad16[_0x47e7('0x5f')];var _0x52453e=[];if(_0x19ad16[_0x47e7('0x30')][_0x47e7('0x2d')]===_0x47e7('0x74'))throw new Error('Unauthorized');if(_['some'](_0x40566a,[_0x47e7('0x2d'),_0x47e7('0x30')])&&_0x19ad16[_0x47e7('0x30')][_0x47e7('0x2d')]!==_0x47e7('0x2e')){throw new Error(_0x47e7('0x83'));}if(_['some'](_0x40566a,[_0x47e7('0x2d'),_0x47e7('0x2e')])&&_0x19ad16[_0x47e7('0x30')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x47e7('0x89')](_0x40566a)[_0x47e7('0x1e')](function(){return validateUser(_0x40566a[0x0]);})[_0x47e7('0x1e')](function(){for(var _0x1c417d=0x1;_0x1c417d<_0x40566a[_0x47e7('0x53')];_0x1c417d++){var _0x9d7200=_0x40566a[_0x1c417d-0x1][_0x47e7('0x63')];if(!_0x40566a[_0x1c417d][_0x47e7('0x63')])_0x40566a[_0x1c417d][_0x47e7('0x63')]=_0x9d7200+0x1;_0x52453e['push'](validateUser(_0x40566a[_0x1c417d]));}return Promise[_0x47e7('0x5a')](_0x52453e);})[_0x47e7('0x1e')](function(){_0x52453e=[];for(var _0x37ebf5=0x0;_0x37ebf5<_0x40566a['length'];_0x37ebf5++){_0x52453e['push'](updateUser(_0x40566a[_0x37ebf5]));}return Promise[_0x47e7('0x5a')](_0x52453e);})[_0x47e7('0x1e')](function(){_0x52453e=_0x40566a[_0x47e7('0x35')](function(_0x282b4f){return db[_0x47e7('0x3d')]['create'](_0x282b4f,{'include':[{'model':db[_0x47e7('0x71')],'as':'VoiceMail'}]})[_0x47e7('0x1e')](function(_0x565b8d){_0x282b4f['id']=_0x565b8d['id'];return _0x282b4f;});});return Promise[_0x47e7('0x5a')](_0x52453e);})[_0x47e7('0x1e')](function(_0x37f555){if(_0x19ad16['body'][_0x47e7('0x2d')]===_0x47e7('0x30'))return _0x37f555;if(_0x19ad16[_0x47e7('0x30')][_0x47e7('0x2d')]!==_0x47e7('0x30'))return _0x37f555;var _0x1c1d97=_[_0x47e7('0x8a')](_0x37f555,function(_0x407432){return _0x407432[_0x47e7('0x2d')]===_0x47e7('0x74')||_0x407432[_0x47e7('0x2d')]===_0x47e7('0x33');});if(!_0x1c1d97)return _0x37f555;return db[_0x47e7('0x86')][_0x47e7('0x8b')]({'where':{'name':{'$or':[_0x47e7('0x31'),'Telephones']},'userProfileId':_0x19ad16[_0x47e7('0x30')][_0x47e7('0x87')]},'raw':!![]})[_0x47e7('0x1e')](function(_0xc93c1){if(_[_0x47e7('0x8c')](_0xc93c1)||!_[_0x47e7('0x8a')](_0xc93c1,[_0x47e7('0x8d'),0x0]))return _0x37f555;_0x52453e=[];var _0x41fa80=_(_0xc93c1)[_0x47e7('0x35')](function(_0x2c166d){if(_0x2c166d[_0x47e7('0x8d')]===0x1)return;return _0x2c166d[_0x47e7('0x39')]==='Agents'?'agent':_0x47e7('0x33');})[_0x47e7('0x8e')]()[_0x47e7('0x36')]();for(var _0x2582f1=0x0;_0x2582f1<_0x37f555[_0x47e7('0x53')];_0x2582f1++){if(!_[_0x47e7('0x37')](_0x41fa80,_0x37f555[_0x2582f1][_0x47e7('0x2d')]))return;var _0x21ab8b=_0x37f555[_0x2582f1][_0x47e7('0x2d')]===_0x47e7('0x74')?_0x47e7('0x31'):_0x47e7('0x32');_0x52453e[_0x47e7('0x50')](db[_0x47e7('0x8f')][_0x47e7('0x82')]({'name':_0x37f555[_0x2582f1][_0x47e7('0x39')],'resourceId':_0x37f555[_0x2582f1]['id'],'type':_0x21ab8b,'sectionId':_['find'](_0xc93c1,[_0x47e7('0x39'),_0x21ab8b])['id']},{}));}return Promise[_0x47e7('0x5a')](_0x52453e);});})['then'](respondWithResult(_0x2da680,0xc9))['catch'](handleError(_0x2da680,null));};exports['changePassword']=function(_0x2eff4d,_0x2c5332){if(_0x2eff4d[_0x47e7('0x5f')]['id']){delete _0x2eff4d[_0x47e7('0x5f')]['id'];}return db[_0x47e7('0x3d')]['find']({'where':{'id':_0x2eff4d[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](function(_0x5c484f){if(!_0x5c484f)return null;if(_0x5c484f['id']===_0x2eff4d['user']['id']){if(!_0x2eff4d[_0x47e7('0x5f')]['oldPassword']||!_0x2eff4d[_0x47e7('0x5f')][_0x47e7('0x90')]){throw new db[(_0x47e7('0x91'))][(_0x47e7('0x92'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x5c484f[_0x47e7('0x93')](_0x2eff4d[_0x47e7('0x5f')]['oldPassword'])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x2eff4d['body'][_0x47e7('0x94')]===_0x2eff4d[_0x47e7('0x5f')][_0x47e7('0x90')]){throw new db[(_0x47e7('0x91'))]['ValidationError'](_0x47e7('0x95'));}}else if(_0x2eff4d[_0x47e7('0x30')]['role']===_0x47e7('0x2e')){if(!_0x2eff4d[_0x47e7('0x5f')][_0x47e7('0x90')]){throw new db[(_0x47e7('0x91'))][(_0x47e7('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x2eff4d[_0x47e7('0x30')][_0x47e7('0x2d')]==='user'){if(!_0x2eff4d['body']['newPassword']){throw new db[(_0x47e7('0x91'))][(_0x47e7('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x5c484f[_0x47e7('0x2d')]!==_0x47e7('0x74')){throw new db['Sequelize'][(_0x47e7('0x92'))](_0x47e7('0x96'));}}else{throw new db[(_0x47e7('0x91'))][(_0x47e7('0x92'))](_0x47e7('0x96'));}return _0x5c484f;})[_0x47e7('0x1e')](handleEntityNotFound(_0x2c5332,null))[_0x47e7('0x1e')](function(_0x168107){return db['Setting'][_0x47e7('0x97')]({'attributes':['id',_0x47e7('0x66'),_0x47e7('0x98'),_0x47e7('0x99')]})[_0x47e7('0x1e')](function(_0x8cc8e){if(_0x8cc8e[_0x47e7('0x66')])authService[_0x47e7('0x67')](_0x2eff4d[_0x47e7('0x5f')][_0x47e7('0x90')]);if(!_0x8cc8e['enforcePasswordHistory']||!_0x168107['previousPasswords'])return _0x168107;authService['validatePasswordHistory'](_0x2eff4d[_0x47e7('0x5f')][_0x47e7('0x90')],_0x168107[_0x47e7('0x44')],_0x8cc8e['passwordHistoryLimit']);return _0x168107;})[_0x47e7('0x1e')](saveUpdates({'password':_0x2eff4d['body'][_0x47e7('0x90')],'passwordResetAt':_0x2eff4d['user']['id']==_0x2eff4d[_0x47e7('0x5c')]['id']?moment():null,'previousPasswords':authService[_0x47e7('0x9a')](_0x2eff4d[_0x47e7('0x5f')]['newPassword'],_0x168107[_0x47e7('0x44')])},null));})[_0x47e7('0x1e')](respondWithResult(_0x2c5332,null))[_0x47e7('0x28')](handleError(_0x2c5332,null));};exports[_0x47e7('0x9b')]=function(_0x42fc20,_0x5c20fd){var _0x517cbc=_0x42fc20[_0x47e7('0x5f')][_0x47e7('0x9c')];return db[_0x47e7('0x3d')][_0x47e7('0x38')]({'where':{'id':_0x42fc20['params']['id']},'attributes':['id','name',_0x47e7('0x2d'),_0x47e7('0x9d'),_0x47e7('0x9e'),_0x47e7('0x9f'),_0x47e7('0xa0')]})[_0x47e7('0x1e')](handleEntityNotFound(_0x5c20fd,null))[_0x47e7('0x1e')](function(_0x2e2614){if(_0x2e2614){if(!utils['isValidChannel'](_0x517cbc)){throw new db[(_0x47e7('0x91'))]['ValidationError']('Unknown\x20channel');}return _0x2e2614['add'+_[_0x47e7('0xa1')](_0x517cbc[_0x47e7('0xa2')]())+_0x47e7('0xa3')](_0x42fc20['body']['ids'],{'penalty':_0x42fc20[_0x47e7('0x5f')][_0x47e7('0xa4')]||0x0})[_0x47e7('0xa5')](function(_0x375f34){for(var _0x346fc5=0x0;_0x346fc5<_0x42fc20[_0x47e7('0x5f')]['ids'][_0x47e7('0x53')];_0x346fc5+=0x1){var _0xfafa4b={'UserId':Number(_0x42fc20[_0x47e7('0x5c')]['id'])};_0xfafa4b[_[_0x47e7('0xa1')](_0x517cbc['toLowerCase']())+'QueueId']=Number(_0x42fc20[_0x47e7('0x5f')][_0x47e7('0x62')][_0x346fc5]);socket['emit']('user'+_[_0x47e7('0xa1')](_0x517cbc[_0x47e7('0xa2')]())+'Queue:save',_0xfafa4b);}return _0x375f34;})[_0x47e7('0x1e')](function(){if(_0x517cbc==='voice'){return db['VoiceQueue'][_0x47e7('0x8b')]({'where':{'id':_0x42fc20[_0x47e7('0x5f')][_0x47e7('0x62')]||[]},'raw':!![],'attributes':['id',_0x47e7('0x39')]});}})[_0x47e7('0x1e')](function(_0x3b3769){var _0x33cd65=_0x2e2614[_0x47e7('0x2c')]({'plain':!![]});var _0x44d45d=[];if(_0x517cbc===_0x47e7('0xa6')&&_0x33cd65[_0x47e7('0x2d')]===_0x47e7('0x74')&&_0x33cd65[_0x47e7('0x9d')]){for(let _0x9dff11=0x0;_0x9dff11<_0x3b3769[_0x47e7('0x53')];_0x9dff11+=0x1){_0x44d45d['push']({'membername':_0x33cd65[_0x47e7('0x39')],'UserId':_0x33cd65['id'],'queue_name':_0x3b3769[_0x9dff11][_0x47e7('0x39')],'VoiceQueueId':_0x3b3769[_0x9dff11]['id'],'interface':_[_0x47e7('0x69')](_0x33cd65['interface'])?util[_0x47e7('0xa7')](_0x47e7('0xa8'),_0x33cd65[_0x47e7('0x39')]):_0x33cd65['interface'],'paused':_0x33cd65['voicePause']||![],'penalty':_0x42fc20[_0x47e7('0x5f')][_0x47e7('0xa4')]||0x0});}return Promise[_0x47e7('0x5a')](_0x44d45d[_0x47e7('0x35')](function(_0xfffb08){return db[_0x47e7('0xa9')][_0x47e7('0xaa')](_0xfffb08);}));}return _0x2e2614;});}})['then'](respondWithStatusCode(_0x5c20fd,null))['catch'](handleError(_0x5c20fd,null));};exports[_0x47e7('0xab')]=function(_0x1fb980,_0x108ffb){var _0x139479,_0x301b81;return db['User'][_0x47e7('0x38')]({'where':{'id':_0x1fb980[_0x47e7('0x5c')]['id']},'attributes':['id',_0x47e7('0x39'),_0x47e7('0x2d')]})[_0x47e7('0x1e')](handleEntityNotFound(_0x108ffb,null))[_0x47e7('0x1e')](function(_0xcd293c){if(_0xcd293c){_0x139479=_0xcd293c;if(!_0x1fb980[_0x47e7('0x49')][_0x47e7('0x9c')]||!utils[_0x47e7('0xac')](_0x1fb980[_0x47e7('0x49')][_0x47e7('0x9c')])){throw new db[(_0x47e7('0x91'))]['ValidationError'](_0x47e7('0xad'));}return _0xcd293c['remove'+_[_0x47e7('0xa1')](_0x1fb980['query']['channel'][_0x47e7('0xa2')]())+_0x47e7('0xa3')](_0x1fb980[_0x47e7('0x49')][_0x47e7('0x62')]);}})[_0x47e7('0x1e')](function(_0x5dc0c0){if(_['isArray'](_0x1fb980[_0x47e7('0x49')][_0x47e7('0x62')])){for(var _0x575104=0x0;_0x575104<_0x1fb980[_0x47e7('0x49')][_0x47e7('0x62')][_0x47e7('0x53')];_0x575104+=0x1){_0x301b81={'UserId':Number(_0x1fb980['params']['id'])};_0x301b81[_[_0x47e7('0xa1')](_0x1fb980[_0x47e7('0x49')][_0x47e7('0x9c')][_0x47e7('0xa2')]())+_0x47e7('0xae')]=Number(_0x1fb980[_0x47e7('0x49')][_0x47e7('0x62')][_0x575104]);socket['emit'](_0x47e7('0x30')+_[_0x47e7('0xa1')](_0x1fb980[_0x47e7('0x49')][_0x47e7('0x9c')]['toLowerCase']())+_0x47e7('0xaf'),_0x301b81);}}else{_0x301b81={'UserId':Number(_0x1fb980['params']['id'])};_0x301b81[_[_0x47e7('0xa1')](_0x1fb980[_0x47e7('0x49')]['channel'][_0x47e7('0xa2')]())+_0x47e7('0xae')]=Number(_0x1fb980[_0x47e7('0x49')]['ids']);socket[_0x47e7('0x2a')](_0x47e7('0x30')+_[_0x47e7('0xa1')](_0x1fb980[_0x47e7('0x49')][_0x47e7('0x9c')][_0x47e7('0xa2')]())+_0x47e7('0xaf'),_0x301b81);}return _0x5dc0c0;})[_0x47e7('0x1e')](function(){if(_0x1fb980[_0x47e7('0x49')][_0x47e7('0x9c')]===_0x47e7('0xa6')){return db['UserVoiceQueueRt'][_0x47e7('0x3a')]({'where':{'UserId':_0x1fb980[_0x47e7('0x5c')]['id'],'VoiceQueueId':_0x1fb980['query'][_0x47e7('0x62')]},'individualHooks':!![]})[_0x47e7('0x1e')](function(){return _0x139479;});}return _0x139479;})[_0x47e7('0x1e')](respondWithStatusCode(_0x108ffb,null))[_0x47e7('0x28')](handleError(_0x108ffb,null));};exports[_0x47e7('0xb0')]=function(_0x4a64a4,_0xe62cce){_0x4a64a4[_0x47e7('0x5f')][_0x47e7('0xb1')]=_0x4a64a4['file']['filename'];return db[_0x47e7('0x3d')][_0x47e7('0x38')]({'where':{'id':_0x4a64a4[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0xe62cce,null))['then'](saveUpdates(_0x4a64a4['body'],null))[_0x47e7('0x1e')](respondWithResult(_0xe62cce,null))[_0x47e7('0x28')](handleError(_0xe62cce,null));};exports[_0x47e7('0xb2')]=function(_0x190bd7,_0x52923d){var _0x592e9b=path[_0x47e7('0xb3')](config[_0x47e7('0xb4')],_0x47e7('0xb5'));return db[_0x47e7('0x3d')]['find']({'where':{'id':_0x190bd7['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x47e7('0x1e')](handleEntityNotFound(_0x52923d,null))['then'](function(_0x30caff){if(_0x30caff){if(_['isNil'](_0x30caff['userpic'])){return _0x52923d[_0x47e7('0xb6')](_0x592e9b);}else{if(!fs[_0x47e7('0xb7')](path[_0x47e7('0xb3')](config['root'],_0x47e7('0xb8'),_0x30caff['userpic']))){return _0x52923d[_0x47e7('0xb6')](_0x592e9b);}return _0x52923d[_0x47e7('0xb6')](path[_0x47e7('0xb3')](config[_0x47e7('0xb4')],_0x47e7('0xb8'),_0x30caff[_0x47e7('0xb1')]));}}})['catch'](handleError(_0x52923d,null));};exports['getOpenTabs']=function(_0x1af312,_0x4b779a){return db['User']['find']({'where':{'id':_0x1af312[_0x47e7('0x5c')]['id']},'attributes':['id']})[_0x47e7('0x1e')](handleEntityNotFound(_0x4b779a,null))[_0x47e7('0x1e')](function(_0x245902){var _0x1262de=[];values=_0x245902[_0x47e7('0x57')];_0x1262de[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x54'),_0x245902[_0x47e7('0x57')]));_0x1262de[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x5e'),_0x245902[_0x47e7('0x57')]));_0x1262de[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x58'),_0x245902[_0x47e7('0x57')]));_0x1262de[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x59'),_0x245902['dataValues']));_0x1262de['push'](get_open_tabs(_0x47e7('0x55'),_0x245902[_0x47e7('0x57')]));_0x1262de[_0x47e7('0x50')](get_open_tabs(_0x47e7('0x56'),_0x245902['dataValues']));return Promise[_0x47e7('0x5a')](_0x1262de);})[_0x47e7('0x1e')](function(_0x5dfd4d){if(_0x5dfd4d){var _0x34ad04=_[_0x47e7('0x35')](values[_0x47e7('0xb9')],function(_0x49817d){return{'channel':_0x47e7('0xba'),'id':_0x49817d['id'],'createdAt':_0x49817d[_0x47e7('0xbb')]};});var _0x35b3ef=_[_0x47e7('0x35')](values['FaxOpenTabs'],function(_0x5f2b46){return{'channel':'FAX','id':_0x5f2b46['id'],'createdAt':_0x5f2b46['createdAt']};});var _0x2435bb=_['map'](values[_0x47e7('0xbc')],function(_0x3e1823){return{'channel':'OPENCHANNEL','id':_0x3e1823['id'],'createdAt':_0x3e1823[_0x47e7('0xbb')]};});var _0x11bb84=_['map'](values[_0x47e7('0xbd')],function(_0x4e35cf){return{'channel':_0x47e7('0xbe'),'id':_0x4e35cf['id'],'createdAt':_0x4e35cf[_0x47e7('0xbb')]};});var _0x3991a2=_[_0x47e7('0x35')](values['SmsOpenTabs'],function(_0x5cb727){return{'channel':_0x47e7('0xbf'),'id':_0x5cb727['id'],'createdAt':_0x5cb727['createdAt']};});var _0x148267=_[_0x47e7('0x35')](values[_0x47e7('0xc0')],function(_0x4e1725){return{'channel':_0x47e7('0xc1'),'id':_0x4e1725['id'],'createdAt':_0x4e1725[_0x47e7('0xbb')]};});var _0x47452e=_[_0x47e7('0xc2')](_0x34ad04,_0x35b3ef,_0x2435bb,_0x11bb84,_0x3991a2,_0x148267);var _0x4ed840={'count':_0x47452e[_0x47e7('0x53')],'rows':_0x47452e};return _0x4ed840;}else return null;})[_0x47e7('0x1e')](respondWithResult(_0x4b779a,null))[_0x47e7('0x28')](handleError(_0x4b779a,null));};exports[_0x47e7('0xc3')]=function(_0xb5fb09,_0x465d3a){var _0x3ba160={};return db['User'][_0x47e7('0x97')]({'where':{'id':_0xb5fb09[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](function(_0x53551c){if(!_0x53551c){throw new APINotFoundError(util[_0x47e7('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0xb5fb09[_0x47e7('0x5c')]['id']));}return contacts[_0x47e7('0x60')]();})[_0x47e7('0x1e')](function(_0x3b7a3){_0xb5fb09['query'][_0x47e7('0x3d')]=_0xb5fb09[_0x47e7('0x5c')]['id'];_0x3ba160=qs[_0x47e7('0x48')](_0x3b7a3,_0xb5fb09);if(_0xb5fb09[_0x47e7('0x49')][_0x47e7('0xc4')](_0x47e7('0x4a'))){_0x3ba160[_0x47e7('0x4b')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db['Tag'],'as':_0x47e7('0xc5'),'attributes':['id',_0x47e7('0x39'),_0x47e7('0xc6')],'where':_0xb5fb09['query'][_0x47e7('0xc7')]?{'id':_0xb5fb09['query'][_0x47e7('0xc7')]}:undefined,'required':_0xb5fb09[_0x47e7('0x49')]['tag']?!![]:![]}];}return contacts[_0x47e7('0x8b')](_0xb5fb09[_0x47e7('0x49')],_0xb5fb09[_0x47e7('0x30')],_0x3ba160,_0x3b7a3);})[_0x47e7('0x1e')](respondWithFilteredResult(_0x465d3a,_0x3ba160))[_0x47e7('0x28')](APIHandleError(_0x465d3a));};exports[_0x47e7('0xc8')]=function(_0x1804a9,_0x237d24){var _0x7e70c7;var _0x107250={};var _0x2af619;return db['User'][_0x47e7('0x97')]({'where':{'id':_0x1804a9['params']['id']},'attributes':['id','name',_0x47e7('0x2d')]})[_0x47e7('0x1e')](handleEntityNotFound(_0x237d24,null))[_0x47e7('0x1e')](function(_0x265a03){if(!utils[_0x47e7('0xac')](_0x1804a9[_0x47e7('0x49')][_0x47e7('0x9c')])){throw new db[(_0x47e7('0x91'))][(_0x47e7('0x92'))](_0x47e7('0xad'));}_0x7e70c7=_0x265a03;var _0x56ba1d={};_0x56ba1d[_0x47e7('0xc9')]=_['keys'](db[_[_0x47e7('0xa1')](_0x1804a9[_0x47e7('0x49')][_0x47e7('0x9c')])+_0x47e7('0xca')]['rawAttributes']);_0x56ba1d[_0x47e7('0x49')]=_[_0x47e7('0xcb')](_0x1804a9[_0x47e7('0x49')]);_0x56ba1d['filters']=_[_0x47e7('0xcc')](_0x56ba1d[_0x47e7('0xc9')],_0x56ba1d[_0x47e7('0x49')]);_0x107250[_0x47e7('0x4f')]=_[_0x47e7('0xcc')](_0x56ba1d[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x1804a9['query'][_0x47e7('0xcd')]));_0x107250['attributes']=_0x107250[_0x47e7('0x4f')]['length']?_0x107250[_0x47e7('0x4f')]:_0x56ba1d['model'];_0x107250['order']=qs[_0x47e7('0xce')](_0x1804a9['query'][_0x47e7('0xce')]);_0x107250[_0x47e7('0xcf')]=qs['filters'](_[_0x47e7('0xd0')](_0x1804a9['query'],_0x56ba1d[_0x47e7('0xd1')]));if(_0x1804a9[_0x47e7('0x49')][_0x47e7('0x42')]){_0x107250['where']=_[_0x47e7('0xd2')](_0x107250[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0x107250[_0x47e7('0x4f')],function(_0x4aab16){var _0x3277b5={};_0x3277b5[_0x4aab16]={'$like':'%'+_0x1804a9[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x3277b5;})});}_0x107250=_['merge']({},_0x107250,_0x1804a9[_0x47e7('0x5d')]);switch(_0x7e70c7[_0x47e7('0x2d')]){case'admin':return db[_[_0x47e7('0xa1')](_0x1804a9[_0x47e7('0x49')][_0x47e7('0x9c')])+_0x47e7('0xca')]['findAll'](_0x107250);case _0x47e7('0x30'):case _0x47e7('0x74'):return _0x7e70c7[_0x47e7('0x2c')+_[_0x47e7('0xa1')](_0x1804a9[_0x47e7('0x49')]['channel'])+'Queues'](_0x107250);default:throw new db[(_0x47e7('0x91'))][(_0x47e7('0x92'))](_0x47e7('0xd3'));}})[_0x47e7('0x1e')](function(_0x515b9b){_0x2af619=_0x515b9b[_0x47e7('0x53')];if(!_0x1804a9[_0x47e7('0x49')][_0x47e7('0xc4')](_0x47e7('0xd4'))){_0x107250[_0x47e7('0x1a')]=qs[_0x47e7('0x1a')](_0x1804a9[_0x47e7('0x49')][_0x47e7('0x1a')]);_0x107250[_0x47e7('0x18')]=qs[_0x47e7('0x18')](_0x1804a9['query'][_0x47e7('0x18')]);}switch(_0x7e70c7['role']){case'admin':return db[_[_0x47e7('0xa1')](_0x1804a9[_0x47e7('0x49')][_0x47e7('0x9c')])+_0x47e7('0xca')]['findAll'](_0x107250);case _0x47e7('0x30'):case _0x47e7('0x74'):return _0x7e70c7['get'+_['capitalize'](_0x1804a9['query'][_0x47e7('0x9c')])+_0x47e7('0xa3')](_0x107250);}})[_0x47e7('0x1e')](function(_0x424be9){return{'count':_0x2af619,'rows':_0x424be9};})[_0x47e7('0x1e')](respondWithResult(_0x237d24,null))['catch'](handleError(_0x237d24,null));};exports[_0x47e7('0xd5')]=function(_0x2eb7f1,_0x4a0837){var _0x21300d={};var _0x42feec={};var _0x3b9be1;var _0x4cf8cd;return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x2eb7f1[_0x47e7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4a0837,null))[_0x47e7('0x1e')](function(_0x777418){if(_0x777418){_0x3b9be1=_0x777418;_0x42feec[_0x47e7('0xc9')]=_['keys'](db[_0x47e7('0xa9')][_0x47e7('0x3e')]);_0x42feec[_0x47e7('0x49')]=_[_0x47e7('0xcb')](_0x2eb7f1['query']);_0x42feec[_0x47e7('0xd1')]=_[_0x47e7('0xcc')](_0x42feec[_0x47e7('0xc9')],_0x42feec[_0x47e7('0x49')]);_0x21300d['attributes']=_[_0x47e7('0xcc')](_0x42feec[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x2eb7f1[_0x47e7('0x49')][_0x47e7('0xcd')]));_0x21300d[_0x47e7('0x4f')]=_0x21300d[_0x47e7('0x4f')][_0x47e7('0x53')]?_0x21300d['attributes']:_0x42feec[_0x47e7('0xc9')];_0x21300d['order']=qs['sort'](_0x2eb7f1[_0x47e7('0x49')][_0x47e7('0xce')]);_0x21300d[_0x47e7('0xcf')]=qs[_0x47e7('0xd1')](_[_0x47e7('0xd0')](_0x2eb7f1[_0x47e7('0x49')],_0x42feec[_0x47e7('0xd1')]));if(_0x2eb7f1[_0x47e7('0x49')][_0x47e7('0x42')]){_0x21300d[_0x47e7('0xcf')]=_['merge'](_0x21300d[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0x21300d[_0x47e7('0x4f')],function(_0x1371cb){var _0x232b55={};_0x232b55[_0x1371cb]={'$like':'%'+_0x2eb7f1[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x232b55;})});}_0x21300d=_['merge']({},_0x21300d,_0x2eb7f1[_0x47e7('0x5d')]);return _0x3b9be1[_0x47e7('0xd5')](_0x21300d);}})['then'](function(_0xea0360){if(_0xea0360){_0x4cf8cd=_0xea0360[_0x47e7('0x53')];if(!_0x2eb7f1[_0x47e7('0x49')][_0x47e7('0xc4')](_0x47e7('0xd4'))){_0x21300d[_0x47e7('0x1a')]=qs['limit'](_0x2eb7f1['query'][_0x47e7('0x1a')]);_0x21300d[_0x47e7('0x18')]=qs[_0x47e7('0x18')](_0x2eb7f1['query']['offset']);}return _0x3b9be1['getVoiceQueuesRt'](_0x21300d);}})['then'](function(_0x51829a){if(_0x51829a){return _0x51829a?{'count':_0x4cf8cd,'rows':_0x51829a}:null;}})['then'](respondWithResult(_0x4a0837,null))[_0x47e7('0x28')](handleError(_0x4a0837,null));};exports[_0x47e7('0xd6')]=function(_0x378f69,_0x47dbdc){var _0xba12f3={};var _0x3087bc={};var _0x1fbb09;var _0x36b0c9;return db[_0x47e7('0x3d')]['findOne']({'where':{'id':_0x378f69[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0x47dbdc,null))['then'](function(_0x55a36a){if(_0x55a36a){_0x1fbb09=_0x55a36a;_0x3087bc[_0x47e7('0xc9')]=_[_0x47e7('0xcb')](db[_0x47e7('0xd7')][_0x47e7('0x3e')]);_0x3087bc[_0x47e7('0x49')]=_['keys'](_0x378f69['query']);_0x3087bc[_0x47e7('0xd1')]=_['intersection'](_0x3087bc['model'],_0x3087bc[_0x47e7('0x49')]);_0xba12f3[_0x47e7('0x4f')]=_[_0x47e7('0xcc')](_0x3087bc[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x378f69[_0x47e7('0x49')][_0x47e7('0xcd')]));_0xba12f3[_0x47e7('0x4f')]=_0xba12f3['attributes'][_0x47e7('0x53')]?_0xba12f3[_0x47e7('0x4f')]:_0x3087bc[_0x47e7('0xc9')];_0xba12f3[_0x47e7('0xd8')]=qs[_0x47e7('0xce')](_0x378f69['query'][_0x47e7('0xce')]);_0xba12f3[_0x47e7('0xcf')]=qs[_0x47e7('0xd1')](_[_0x47e7('0xd0')](_0x378f69[_0x47e7('0x49')],_0x3087bc[_0x47e7('0xd1')]));if(_0x378f69['query'][_0x47e7('0x42')]){_0xba12f3['where']=_[_0x47e7('0xd2')](_0xba12f3[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0xba12f3[_0x47e7('0x4f')],function(_0x6fa691){var _0x5ab7fd={};_0x5ab7fd[_0x6fa691]={'$like':'%'+_0x378f69[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x5ab7fd;})});}_0xba12f3=_[_0x47e7('0xd2')]({},_0xba12f3,_0x378f69[_0x47e7('0x5d')]);return _0x1fbb09[_0x47e7('0xd6')](_0xba12f3);}})[_0x47e7('0x1e')](function(_0x127311){if(_0x127311){_0x36b0c9=_0x127311['length'];if(!_0x378f69[_0x47e7('0x49')]['hasOwnProperty'](_0x47e7('0xd4'))){_0xba12f3[_0x47e7('0x1a')]=qs[_0x47e7('0x1a')](_0x378f69[_0x47e7('0x49')]['limit']);_0xba12f3['offset']=qs[_0x47e7('0x18')](_0x378f69[_0x47e7('0x49')][_0x47e7('0x18')]);}return _0x1fbb09[_0x47e7('0xd6')](_0xba12f3);}})[_0x47e7('0x1e')](function(_0x291ea7){if(_0x291ea7){return _0x291ea7?{'count':_0x36b0c9,'rows':_0x291ea7}:null;}})['then'](respondWithResult(_0x47dbdc,null))[_0x47e7('0x28')](handleError(_0x47dbdc,null));};exports[_0x47e7('0xd9')]=function(_0x4be96a,_0x19fdcd){var _0x1fc868={'raw':!![],'where':{}};var _0x397829={};var _0x2f2f40={'count':0x0,'rows':[]};return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x4be96a['params']['id']}})['then'](handleEntityNotFound(_0x19fdcd,null))[_0x47e7('0x1e')](function(_0x2fd109){if(_0x2fd109){_0x397829[_0x47e7('0xc9')]=_[_0x47e7('0xcb')](db[_0x47e7('0xda')][_0x47e7('0x3e')]);_0x397829[_0x47e7('0x49')]=_[_0x47e7('0xcb')](_0x4be96a['query']);_0x397829[_0x47e7('0xd1')]=_[_0x47e7('0xcc')](_0x397829[_0x47e7('0xc9')],_0x397829[_0x47e7('0x49')]);_0x1fc868['attributes']=_[_0x47e7('0xcc')](_0x397829['model'],qs[_0x47e7('0xcd')](_0x4be96a['query'][_0x47e7('0xcd')]));_0x1fc868['attributes']=_0x1fc868[_0x47e7('0x4f')]['length']?_0x1fc868[_0x47e7('0x4f')]:_0x397829[_0x47e7('0xc9')];if(!_0x4be96a[_0x47e7('0x49')]['hasOwnProperty'](_0x47e7('0xd4'))){_0x1fc868[_0x47e7('0x1a')]=qs[_0x47e7('0x1a')](_0x4be96a[_0x47e7('0x49')][_0x47e7('0x1a')]);_0x1fc868[_0x47e7('0x18')]=qs[_0x47e7('0x18')](_0x4be96a[_0x47e7('0x49')][_0x47e7('0x18')]);}_0x1fc868['order']=qs[_0x47e7('0xce')](_0x4be96a[_0x47e7('0x49')][_0x47e7('0xce')]);_0x1fc868[_0x47e7('0xcf')]=qs[_0x47e7('0xd1')](_[_0x47e7('0xd0')](_0x4be96a['query'],_0x397829[_0x47e7('0xd1')]));_0x1fc868[_0x47e7('0xcf')][_0x47e7('0xdb')]=_0x2fd109['id'];if(_0x4be96a[_0x47e7('0x49')]['filter']){_0x1fc868[_0x47e7('0xcf')]=_[_0x47e7('0xd2')](_0x1fc868['where'],{'$or':_[_0x47e7('0x35')](_0x1fc868[_0x47e7('0x4f')],function(_0x4e24c1){var _0x49d31f={};_0x49d31f[_0x4e24c1]={'$like':'%'+_0x4be96a[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x49d31f;})});}_0x1fc868=_[_0x47e7('0xd2')]({},_0x1fc868,_0x4be96a[_0x47e7('0x5d')]);return db[_0x47e7('0xda')][_0x47e7('0x1b')]({'where':_0x1fc868[_0x47e7('0xcf')]})[_0x47e7('0x1e')](function(_0x54aab5){_0x2f2f40['count']=_0x54aab5;if(_0x4be96a['query'][_0x47e7('0x4a')]){_0x1fc868[_0x47e7('0x4b')]=[{'all':!![]}];}return db[_0x47e7('0xda')][_0x47e7('0x8b')](_0x1fc868);})['then'](function(_0xa4860f){_0x2f2f40[_0x47e7('0x51')]=_0xa4860f;return _0x2f2f40;});}})[_0x47e7('0x1e')](respondWithFilteredResult(_0x19fdcd,_0x1fc868))['catch'](handleError(_0x19fdcd,null));};exports[_0x47e7('0xdc')]=function(_0x417191,_0x4bac47){var _0x92ad4e={'raw':!![],'where':{}};var _0x740ef0={};var _0x1ca5f5={'count':0x0,'rows':[]};return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x417191['params']['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0x4bac47,null))[_0x47e7('0x1e')](function(_0x5cb305){if(_0x5cb305){_0x740ef0[_0x47e7('0xc9')]=_[_0x47e7('0xcb')](db[_0x47e7('0xdd')][_0x47e7('0x3e')]);_0x740ef0['query']=_[_0x47e7('0xcb')](_0x417191['query']);_0x740ef0[_0x47e7('0xd1')]=_['intersection'](_0x740ef0['model'],_0x740ef0[_0x47e7('0x49')]);_0x92ad4e[_0x47e7('0x4f')]=_[_0x47e7('0xcc')](_0x740ef0[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x417191[_0x47e7('0x49')][_0x47e7('0xcd')]));_0x92ad4e[_0x47e7('0x4f')]=_0x92ad4e[_0x47e7('0x4f')][_0x47e7('0x53')]?_0x92ad4e[_0x47e7('0x4f')]:_0x740ef0[_0x47e7('0xc9')];if(!_0x417191[_0x47e7('0x49')]['hasOwnProperty']('nolimit')){_0x92ad4e['limit']=qs[_0x47e7('0x1a')](_0x417191[_0x47e7('0x49')][_0x47e7('0x1a')]);_0x92ad4e['offset']=qs[_0x47e7('0x18')](_0x417191[_0x47e7('0x49')]['offset']);}_0x92ad4e[_0x47e7('0xd8')]=qs[_0x47e7('0xce')](_0x417191['query'][_0x47e7('0xce')]);_0x92ad4e[_0x47e7('0xcf')]=qs[_0x47e7('0xd1')](_['pick'](_0x417191[_0x47e7('0x49')],_0x740ef0[_0x47e7('0xd1')]));_0x92ad4e[_0x47e7('0xcf')][_0x47e7('0xdb')]=_0x5cb305['id'];if(_0x417191[_0x47e7('0x49')]['filter']){_0x92ad4e[_0x47e7('0xcf')]=_[_0x47e7('0xd2')](_0x92ad4e[_0x47e7('0xcf')],{'$or':_['map'](_0x92ad4e[_0x47e7('0x4f')],function(_0x42833d){var _0x3e8fc2={};_0x3e8fc2[_0x42833d]={'$like':'%'+_0x417191['query'][_0x47e7('0x42')]+'%'};return _0x3e8fc2;})});}_0x92ad4e=_[_0x47e7('0xd2')]({},_0x92ad4e,_0x417191[_0x47e7('0x5d')]);return db[_0x47e7('0xdd')][_0x47e7('0x1b')]({'where':_0x92ad4e[_0x47e7('0xcf')]})[_0x47e7('0x1e')](function(_0x2080e2){_0x1ca5f5['count']=_0x2080e2;if(_0x417191[_0x47e7('0x49')][_0x47e7('0x4a')]){_0x92ad4e[_0x47e7('0x4b')]=[{'all':!![]}];}return db['ScreenRecording'][_0x47e7('0x8b')](_0x92ad4e);})[_0x47e7('0x1e')](function(_0x44c6a2){_0x1ca5f5[_0x47e7('0x51')]=_0x44c6a2;return _0x1ca5f5;});}})[_0x47e7('0x1e')](respondWithFilteredResult(_0x4bac47,_0x92ad4e))[_0x47e7('0x28')](handleError(_0x4bac47,null));};exports[_0x47e7('0xde')]=function(_0x518006,_0xb840ab){var _0xc91988={};var _0x502930={};var _0xa90de;var _0x442578;return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x518006[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0xb840ab,null))[_0x47e7('0x1e')](function(_0x4d395d){if(_0x4d395d){_0xa90de=_0x4d395d;_0x502930[_0x47e7('0xc9')]=_[_0x47e7('0xcb')](db[_0x47e7('0xdf')][_0x47e7('0x3e')]);_0x502930[_0x47e7('0x49')]=_['keys'](_0x518006['query']);_0x502930[_0x47e7('0xd1')]=_['intersection'](_0x502930[_0x47e7('0xc9')],_0x502930[_0x47e7('0x49')]);_0xc91988['attributes']=_[_0x47e7('0xcc')](_0x502930[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x518006[_0x47e7('0x49')][_0x47e7('0xcd')]));_0xc91988['attributes']=_0xc91988['attributes'][_0x47e7('0x53')]?_0xc91988[_0x47e7('0x4f')]:_0x502930[_0x47e7('0xc9')];_0xc91988[_0x47e7('0xd8')]=qs[_0x47e7('0xce')](_0x518006[_0x47e7('0x49')][_0x47e7('0xce')]);_0xc91988['where']=qs[_0x47e7('0xd1')](_[_0x47e7('0xd0')](_0x518006[_0x47e7('0x49')],_0x502930[_0x47e7('0xd1')]));if(_0x518006[_0x47e7('0x49')][_0x47e7('0x42')]){_0xc91988['where']=_[_0x47e7('0xd2')](_0xc91988[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0xc91988[_0x47e7('0x4f')],function(_0x46a7f8){var _0xf5bd50={};_0xf5bd50[_0x46a7f8]={'$like':'%'+_0x518006[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0xf5bd50;})});}_0xc91988=_[_0x47e7('0xd2')]({},_0xc91988,_0x518006[_0x47e7('0x5d')]);return _0xa90de['getChatInteractions'](_0xc91988);}})[_0x47e7('0x1e')](function(_0x11d5c7){if(_0x11d5c7){_0x442578=_0x11d5c7[_0x47e7('0x53')];if(!_0x518006[_0x47e7('0x49')][_0x47e7('0xc4')](_0x47e7('0xd4'))){_0xc91988[_0x47e7('0x1a')]=qs[_0x47e7('0x1a')](_0x518006[_0x47e7('0x49')][_0x47e7('0x1a')]);_0xc91988[_0x47e7('0x18')]=qs[_0x47e7('0x18')](_0x518006['query'][_0x47e7('0x18')]);}return _0xa90de[_0x47e7('0xde')](_0xc91988);}})[_0x47e7('0x1e')](function(_0x24267d){if(_0x24267d){return _0x24267d?{'count':_0x442578,'rows':_0x24267d}:null;}})[_0x47e7('0x1e')](respondWithResult(_0xb840ab,null))[_0x47e7('0x28')](handleError(_0xb840ab,null));};exports['getOpenchannelInteractions']=function(_0x107eb1,_0x2ec388){var _0x52b3b9={};var _0xe11d7c={};var _0x116fcf;var _0xac9e31;return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x107eb1[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0x2ec388,null))[_0x47e7('0x1e')](function(_0x26bcf1){if(_0x26bcf1){_0x116fcf=_0x26bcf1;_0xe11d7c[_0x47e7('0xc9')]=_[_0x47e7('0xcb')](db['OpenchannelInteraction']['rawAttributes']);_0xe11d7c['query']=_['keys'](_0x107eb1['query']);_0xe11d7c['filters']=_[_0x47e7('0xcc')](_0xe11d7c[_0x47e7('0xc9')],_0xe11d7c[_0x47e7('0x49')]);_0x52b3b9[_0x47e7('0x4f')]=_[_0x47e7('0xcc')](_0xe11d7c[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x107eb1[_0x47e7('0x49')][_0x47e7('0xcd')]));_0x52b3b9['attributes']=_0x52b3b9['attributes'][_0x47e7('0x53')]?_0x52b3b9['attributes']:_0xe11d7c[_0x47e7('0xc9')];_0x52b3b9['order']=qs[_0x47e7('0xce')](_0x107eb1[_0x47e7('0x49')][_0x47e7('0xce')]);_0x52b3b9[_0x47e7('0xcf')]=qs[_0x47e7('0xd1')](_[_0x47e7('0xd0')](_0x107eb1[_0x47e7('0x49')],_0xe11d7c['filters']));if(_0x107eb1['query']['filter']){_0x52b3b9['where']=_['merge'](_0x52b3b9[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0x52b3b9[_0x47e7('0x4f')],function(_0x4d0e0c){var _0x18d6dd={};_0x18d6dd[_0x4d0e0c]={'$like':'%'+_0x107eb1[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x18d6dd;})});}_0x52b3b9=_['merge']({},_0x52b3b9,_0x107eb1['options']);return _0x116fcf['getOpenchannelInteractions'](_0x52b3b9);}})[_0x47e7('0x1e')](function(_0x5bce74){if(_0x5bce74){_0xac9e31=_0x5bce74[_0x47e7('0x53')];if(!_0x107eb1[_0x47e7('0x49')][_0x47e7('0xc4')](_0x47e7('0xd4'))){_0x52b3b9['limit']=qs['limit'](_0x107eb1[_0x47e7('0x49')]['limit']);_0x52b3b9['offset']=qs[_0x47e7('0x18')](_0x107eb1[_0x47e7('0x49')][_0x47e7('0x18')]);}return _0x116fcf['getOpenchannelInteractions'](_0x52b3b9);}})[_0x47e7('0x1e')](function(_0x137a15){if(_0x137a15){return _0x137a15?{'count':_0xac9e31,'rows':_0x137a15}:null;}})['then'](respondWithResult(_0x2ec388,null))['catch'](handleError(_0x2ec388,null));};exports[_0x47e7('0xe0')]=function(_0x396077,_0x56d01c){var _0x230031={'raw':!![],'where':{}};var _0x75f2bc={};var _0x3c342a={'count':0x0,'rows':[]};return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x396077[_0x47e7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x56d01c,null))['then'](function(_0x5cd205){if(_0x5cd205){_0x75f2bc[_0x47e7('0xc9')]=_['keys'](db[_0x47e7('0xe1')][_0x47e7('0x3e')]);_0x75f2bc[_0x47e7('0x49')]=_[_0x47e7('0xcb')](_0x396077[_0x47e7('0x49')]);_0x75f2bc['filters']=_['intersection'](_0x75f2bc[_0x47e7('0xc9')],_0x75f2bc[_0x47e7('0x49')]);_0x230031[_0x47e7('0x4f')]=_['intersection'](_0x75f2bc[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x396077[_0x47e7('0x49')][_0x47e7('0xcd')]));_0x230031['attributes']=_0x230031[_0x47e7('0x4f')][_0x47e7('0x53')]?_0x230031[_0x47e7('0x4f')]:_0x75f2bc[_0x47e7('0xc9')];if(!_0x396077['query'][_0x47e7('0xc4')](_0x47e7('0xd4'))){_0x230031['limit']=qs[_0x47e7('0x1a')](_0x396077[_0x47e7('0x49')]['limit']);_0x230031[_0x47e7('0x18')]=qs['offset'](_0x396077['query']['offset']);}_0x230031[_0x47e7('0xd8')]=qs[_0x47e7('0xce')](_0x396077[_0x47e7('0x49')][_0x47e7('0xce')]);_0x230031[_0x47e7('0xcf')]=qs[_0x47e7('0xd1')](_[_0x47e7('0xd0')](_0x396077[_0x47e7('0x49')],_0x75f2bc[_0x47e7('0xd1')]));_0x230031['where'][_0x47e7('0xdb')]=_0x5cd205['id'];if(_0x396077[_0x47e7('0x49')]['filter']){_0x230031[_0x47e7('0xcf')]=_['merge'](_0x230031['where'],{'$or':_[_0x47e7('0x35')](_0x230031[_0x47e7('0x4f')],function(_0x1c4c3c){var _0x5edd16={};_0x5edd16[_0x1c4c3c]={'$like':'%'+_0x396077[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x5edd16;})});}_0x230031=_[_0x47e7('0xd2')]({},_0x230031,_0x396077['options']);return db['MailInteraction']['count']({'where':_0x230031['where']})['then'](function(_0x276dd7){_0x3c342a[_0x47e7('0x1b')]=_0x276dd7;if(_0x396077[_0x47e7('0x49')][_0x47e7('0x4a')]){_0x230031[_0x47e7('0x4b')]=[{'all':!![]}];}return db[_0x47e7('0xe1')][_0x47e7('0x8b')](_0x230031);})[_0x47e7('0x1e')](function(_0x12bbb2){_0x3c342a[_0x47e7('0x51')]=_0x12bbb2;return _0x3c342a;});}})[_0x47e7('0x1e')](respondWithFilteredResult(_0x56d01c,_0x230031))['catch'](handleError(_0x56d01c,null));};exports['getSmsInteractions']=function(_0x3a621,_0x3cc46e){var _0x1a6e77={};var _0xb09765={};var _0x568cc2;var _0x2daa8f;return db[_0x47e7('0x3d')]['findOne']({'where':{'id':_0x3a621['params']['id']}})['then'](handleEntityNotFound(_0x3cc46e,null))[_0x47e7('0x1e')](function(_0x390fcf){if(_0x390fcf){_0x568cc2=_0x390fcf;_0xb09765['model']=_[_0x47e7('0xcb')](db[_0x47e7('0xe2')][_0x47e7('0x3e')]);_0xb09765[_0x47e7('0x49')]=_[_0x47e7('0xcb')](_0x3a621[_0x47e7('0x49')]);_0xb09765[_0x47e7('0xd1')]=_[_0x47e7('0xcc')](_0xb09765[_0x47e7('0xc9')],_0xb09765['query']);_0x1a6e77[_0x47e7('0x4f')]=_['intersection'](_0xb09765[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x3a621[_0x47e7('0x49')][_0x47e7('0xcd')]));_0x1a6e77[_0x47e7('0x4f')]=_0x1a6e77[_0x47e7('0x4f')][_0x47e7('0x53')]?_0x1a6e77[_0x47e7('0x4f')]:_0xb09765[_0x47e7('0xc9')];_0x1a6e77['order']=qs[_0x47e7('0xce')](_0x3a621['query'][_0x47e7('0xce')]);_0x1a6e77[_0x47e7('0xcf')]=qs['filters'](_[_0x47e7('0xd0')](_0x3a621[_0x47e7('0x49')],_0xb09765['filters']));if(_0x3a621[_0x47e7('0x49')][_0x47e7('0x42')]){_0x1a6e77[_0x47e7('0xcf')]=_[_0x47e7('0xd2')](_0x1a6e77[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0x1a6e77[_0x47e7('0x4f')],function(_0x45816d){var _0x4ef8cc={};_0x4ef8cc[_0x45816d]={'$like':'%'+_0x3a621[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x4ef8cc;})});}_0x1a6e77=_[_0x47e7('0xd2')]({},_0x1a6e77,_0x3a621['options']);return _0x568cc2[_0x47e7('0xe3')](_0x1a6e77);}})[_0x47e7('0x1e')](function(_0x5f1767){if(_0x5f1767){_0x2daa8f=_0x5f1767[_0x47e7('0x53')];if(!_0x3a621[_0x47e7('0x49')]['hasOwnProperty']('nolimit')){_0x1a6e77[_0x47e7('0x1a')]=qs['limit'](_0x3a621[_0x47e7('0x49')][_0x47e7('0x1a')]);_0x1a6e77[_0x47e7('0x18')]=qs[_0x47e7('0x18')](_0x3a621[_0x47e7('0x49')][_0x47e7('0x18')]);}return _0x568cc2['getSmsInteractions'](_0x1a6e77);}})['then'](function(_0x39c287){if(_0x39c287){return _0x39c287?{'count':_0x2daa8f,'rows':_0x39c287}:null;}})[_0x47e7('0x1e')](respondWithResult(_0x3cc46e,null))[_0x47e7('0x28')](handleError(_0x3cc46e,null));};exports['getFaxInteractions']=function(_0x5e4c7e,_0x516eb3){var _0x3c75be={};var _0x50d6ff={};var _0x269094;var _0x85e114;return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x5e4c7e['params']['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0x516eb3,null))[_0x47e7('0x1e')](function(_0x8df120){if(_0x8df120){_0x269094=_0x8df120;_0x50d6ff[_0x47e7('0xc9')]=_['keys'](db[_0x47e7('0xe4')][_0x47e7('0x3e')]);_0x50d6ff[_0x47e7('0x49')]=_['keys'](_0x5e4c7e[_0x47e7('0x49')]);_0x50d6ff[_0x47e7('0xd1')]=_[_0x47e7('0xcc')](_0x50d6ff[_0x47e7('0xc9')],_0x50d6ff[_0x47e7('0x49')]);_0x3c75be[_0x47e7('0x4f')]=_[_0x47e7('0xcc')](_0x50d6ff[_0x47e7('0xc9')],qs['fields'](_0x5e4c7e['query'][_0x47e7('0xcd')]));_0x3c75be['attributes']=_0x3c75be[_0x47e7('0x4f')][_0x47e7('0x53')]?_0x3c75be['attributes']:_0x50d6ff[_0x47e7('0xc9')];_0x3c75be[_0x47e7('0xd8')]=qs[_0x47e7('0xce')](_0x5e4c7e[_0x47e7('0x49')][_0x47e7('0xce')]);_0x3c75be[_0x47e7('0xcf')]=qs['filters'](_[_0x47e7('0xd0')](_0x5e4c7e['query'],_0x50d6ff[_0x47e7('0xd1')]));if(_0x5e4c7e['query']['filter']){_0x3c75be['where']=_[_0x47e7('0xd2')](_0x3c75be[_0x47e7('0xcf')],{'$or':_['map'](_0x3c75be[_0x47e7('0x4f')],function(_0x1e0753){var _0x51bf9b={};_0x51bf9b[_0x1e0753]={'$like':'%'+_0x5e4c7e['query'][_0x47e7('0x42')]+'%'};return _0x51bf9b;})});}_0x3c75be=_['merge']({},_0x3c75be,_0x5e4c7e[_0x47e7('0x5d')]);return _0x269094[_0x47e7('0xe5')](_0x3c75be);}})[_0x47e7('0x1e')](function(_0x1a0754){if(_0x1a0754){_0x85e114=_0x1a0754[_0x47e7('0x53')];if(!_0x5e4c7e[_0x47e7('0x49')][_0x47e7('0xc4')](_0x47e7('0xd4'))){_0x3c75be[_0x47e7('0x1a')]=qs[_0x47e7('0x1a')](_0x5e4c7e['query'][_0x47e7('0x1a')]);_0x3c75be[_0x47e7('0x18')]=qs[_0x47e7('0x18')](_0x5e4c7e['query'][_0x47e7('0x18')]);}return _0x269094[_0x47e7('0xe5')](_0x3c75be);}})[_0x47e7('0x1e')](function(_0x4b7c00){if(_0x4b7c00){return _0x4b7c00?{'count':_0x85e114,'rows':_0x4b7c00}:null;}})['then'](respondWithResult(_0x516eb3,null))[_0x47e7('0x28')](handleError(_0x516eb3,null));};exports['getWhatsappInteractions']=function(_0x36d6a6,_0x6d13ae){var _0x20b6aa={};var _0xc25605={};var _0x565f91;var _0x46d39c;return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x36d6a6[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0x6d13ae,null))['then'](function(_0x3a6641){if(_0x3a6641){_0x565f91=_0x3a6641;_0xc25605['model']=_['keys'](db['WhatsappInteraction'][_0x47e7('0x3e')]);_0xc25605['query']=_[_0x47e7('0xcb')](_0x36d6a6[_0x47e7('0x49')]);_0xc25605[_0x47e7('0xd1')]=_['intersection'](_0xc25605[_0x47e7('0xc9')],_0xc25605[_0x47e7('0x49')]);_0x20b6aa['attributes']=_[_0x47e7('0xcc')](_0xc25605[_0x47e7('0xc9')],qs['fields'](_0x36d6a6['query'][_0x47e7('0xcd')]));_0x20b6aa[_0x47e7('0x4f')]=_0x20b6aa['attributes'][_0x47e7('0x53')]?_0x20b6aa[_0x47e7('0x4f')]:_0xc25605[_0x47e7('0xc9')];_0x20b6aa[_0x47e7('0xd8')]=qs[_0x47e7('0xce')](_0x36d6a6[_0x47e7('0x49')]['sort']);_0x20b6aa['where']=qs[_0x47e7('0xd1')](_[_0x47e7('0xd0')](_0x36d6a6[_0x47e7('0x49')],_0xc25605[_0x47e7('0xd1')]));if(_0x36d6a6[_0x47e7('0x49')][_0x47e7('0x42')]){_0x20b6aa[_0x47e7('0xcf')]=_['merge'](_0x20b6aa[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0x20b6aa['attributes'],function(_0x4c964f){var _0x3079ea={};_0x3079ea[_0x4c964f]={'$like':'%'+_0x36d6a6['query']['filter']+'%'};return _0x3079ea;})});}_0x20b6aa=_[_0x47e7('0xd2')]({},_0x20b6aa,_0x36d6a6[_0x47e7('0x5d')]);return _0x565f91[_0x47e7('0xe6')](_0x20b6aa);}})[_0x47e7('0x1e')](function(_0x3506aa){if(_0x3506aa){_0x46d39c=_0x3506aa['length'];if(!_0x36d6a6[_0x47e7('0x49')][_0x47e7('0xc4')](_0x47e7('0xd4'))){_0x20b6aa['limit']=qs[_0x47e7('0x1a')](_0x36d6a6[_0x47e7('0x49')][_0x47e7('0x1a')]);_0x20b6aa[_0x47e7('0x18')]=qs['offset'](_0x36d6a6['query'][_0x47e7('0x18')]);}return _0x565f91[_0x47e7('0xe6')](_0x20b6aa);}})['then'](function(_0x249cb5){if(_0x249cb5){return _0x249cb5?{'count':_0x46d39c,'rows':_0x249cb5}:null;}})[_0x47e7('0x1e')](respondWithResult(_0x6d13ae,null))[_0x47e7('0x28')](handleError(_0x6d13ae,null));};exports['login']=function(_0x224320,_0x41f3f7,_0x5de468){var _0x219735;var _0x4b652b;var _0x307584;var _0x5ad7a9=!_[_0x47e7('0x69')](_0x224320['params']['id'])?_0x224320['params']['id']:!_['isNil'](_0x224320[_0x47e7('0x30')]['id'])?_0x224320['user']['id']:null;return db[_0x47e7('0x3d')][_0x47e7('0x38')]({'where':{'id':_0x5ad7a9,'role':{'$or':[_0x47e7('0x2e'),_0x47e7('0x30'),_0x47e7('0x74')]}},'attributes':['id',_0x47e7('0x39'),_0x47e7('0xe7'),_0x47e7('0xe8'),_0x47e7('0x2d'),_0x47e7('0x63'),_0x47e7('0x9e')]})[_0x47e7('0x1e')](function(_0x452716){if(_0x452716){if(_0x452716[_0x47e7('0x2d')]===_0x47e7('0x74')){_0x219735=_0x452716;if(_0x224320[_0x47e7('0x5f')][_0x47e7('0xa0')]){_0x307584=util[_0x47e7('0xa7')](_0x47e7('0xe9'),_0x219735[_0x224320[_0x47e7('0x5f')][_0x47e7('0xa0')]]);}else if(_0x224320[_0x47e7('0x5f')][_0x47e7('0xea')]){_0x307584=util[_0x47e7('0xa7')](_0x47e7('0xa8'),_0x224320[_0x47e7('0x5f')][_0x47e7('0xea')]);}else{_0x307584=util[_0x47e7('0xa7')](_0x47e7('0xa8'),_0x219735[_0x47e7('0x39')]);}socket['to'](util[_0x47e7('0xa7')](_0x47e7('0xeb'),_0x219735['name']))[_0x47e7('0x2a')](_0x47e7('0xec'),{'user':{'id':_0x219735['id'],'name':_0x219735[_0x47e7('0x39')]},'ip':_0x224320[_0x47e7('0xed')][_0x47e7('0xee')]||_0x224320[_0x47e7('0xef')][_0x47e7('0xf0')]||_0x224320['socket'][_0x47e7('0xf0')]||_0x224320['connection']['socket'][_0x47e7('0xf0')]});return db[_0x47e7('0xa9')]['destroy']({'where':{'membername':_0x219735[_0x47e7('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0x47e7('0x91'))]['ValidationError'](_0x47e7('0xf1'));}})['then'](function(){if(_0x219735){return _0x219735[_0x47e7('0xf2')]({'raw':!![]});}})[_0x47e7('0x1e')](function(_0x23dce5){if(_0x219735){if(_0x23dce5){_0x4b652b=_0x23dce5;if(_0x4b652b[_0x47e7('0x53')]){var _0x1cc6aa=_0x4b652b[_0x47e7('0x35')](function(_0x835bb2){var _0x2ab2c8={'membername':_0x219735['name'],'UserId':_0x219735['id'],'queue_name':_0x835bb2[_0x47e7('0x39')],'VoiceQueueId':_0x835bb2['id'],'interface':_0x307584,'paused':_0x219735[_0x47e7('0x9e')]||![],'penalty':_0x835bb2[_0x47e7('0xf3')]||0x0};return db[_0x47e7('0xa9')][_0x47e7('0xaa')](_0x2ab2c8);});return Promise[_0x47e7('0x5a')](_0x1cc6aa);}}}})[_0x47e7('0x1e')](function(){if(_0x219735){return db[_0x47e7('0xf4')]['findAll']({'where':{'membername':_0x219735[_0x47e7('0x39')],'exitAt':null}});}})[_0x47e7('0x1e')](function(_0x4cd7a3){if(_0x219735){var _0x376505=[];_0x4cd7a3['forEach'](function(_0x1d1d4b){_0x376505[_0x47e7('0x50')](_0x1d1d4b['update']({'exitAt':moment()[_0x47e7('0xa7')](_0x47e7('0xf5'))}));});return Promise[_0x47e7('0x5a')](_0x376505);}})['then'](function(){if(_0x219735){var _0x3907ab=[];var _0x248921=[];var _0x54209d=utils[_0x47e7('0xf6')]();var _0x5b708e={'membername':_0x219735['name'],'interface':_0x307584,'enterAt':moment()[_0x47e7('0xa7')](_0x47e7('0xf5')),'role':_0x219735[_0x47e7('0x2d')],'internal':_0x219735[_0x47e7('0x63')]};_0x54209d[_0x47e7('0xf7')](function(_0x56a414){_0x3907ab[_0x47e7('0x50')](_['merge']({'channel':_0x56a414,'type':_0x47e7('0xf8'),'data1':_0x224320[_0x47e7('0x5f')][_0x47e7('0xf9')],'data2':_0x307584},_0x5b708e));if(_0x219735[_0x47e7('0x9e')]){_0x248921[_0x47e7('0x50')](_[_0x47e7('0xd2')]({'channel':_0x56a414,'type':_0x47e7('0xfa'),'data1':_0x47e7('0xfb')},_0x5b708e));}});return db['MemberReport']['bulkCreate'](_0x3907ab[_0x47e7('0xc2')](_0x248921),{'individualHooks':!![]});}})['then'](function(){if(_0x219735){return _0x219735[_0x47e7('0x29')]({'online':!![],'lastLoginAt':moment()[_0x47e7('0xa7')](_0x47e7('0xf5')),'voicePause':_0x219735['loginInPause']||![],'mailPause':_0x219735['loginInPause']||![],'chatPause':_0x219735['loginInPause']||![],'faxPause':_0x219735[_0x47e7('0x9e')]||![],'smsPause':_0x219735[_0x47e7('0x9e')]||![],'openchannelPause':_0x219735[_0x47e7('0x9e')]||![],'whatsappPause':_0x219735[_0x47e7('0x9e')]||![],'pauseType':_0x219735[_0x47e7('0x9e')]?_0x47e7('0xfb'):null,'interface':_0x307584,'lastPauseAt':moment()[_0x47e7('0xa7')](_0x47e7('0xf5'))});}})[_0x47e7('0x1e')](function(_0x27a6a4){if(_0x224320['isMiddleware']){return _0x5de468();}else{return Promise[_0x47e7('0xfc')](_0x27a6a4)[_0x47e7('0x1e')](respondWithResult(_0x41f3f7,null));}})[_0x47e7('0x28')](handleError(_0x41f3f7,null));};exports['logout']=function(_0xe50364,_0x222181){var _0x49fe0a;return db[_0x47e7('0x3d')][_0x47e7('0x38')]({'where':{'id':_0xe50364[_0x47e7('0x5c')]['id'],'role':'agent'},'attributes':['id',_0x47e7('0x39'),'role']})[_0x47e7('0x1e')](handleEntityNotFound(_0x222181,null))[_0x47e7('0x1e')](function(_0x39e3bd){if(_0x39e3bd){_0x49fe0a=_0x39e3bd;return db[_0x47e7('0xa9')][_0x47e7('0x3a')]({'where':{'membername':_0x49fe0a['name']},'individualHooks':!![]});}})[_0x47e7('0x1e')](function(){return db['MemberReport'][_0x47e7('0x8b')]({'where':{'membername':_0x49fe0a[_0x47e7('0x39')],'exitAt':null}});})[_0x47e7('0x1e')](function(_0x1a125e){var _0x1038fd=[];_0x1a125e[_0x47e7('0xf7')](function(_0x286479){_0x1038fd[_0x47e7('0x50')](_0x286479['update']({'exitAt':moment()[_0x47e7('0xa7')](_0x47e7('0xf5'))}));});return Promise[_0x47e7('0x5a')](_0x1038fd);})['then'](function(){return _0x49fe0a[_0x47e7('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x47e7('0x1e')](respondWithResult(_0x222181,null))[_0x47e7('0x28')](handleError(_0x222181,null));};exports[_0x47e7('0xfd')]=function(_0xb36a9b,_0x5aba08){var _0x245f21;return db['UserVoiceQueueRt'][_0x47e7('0x29')]({'paused':0x1},{'where':{'UserId':_0xb36a9b['params']['id']},'individualHooks':!![]})[_0x47e7('0x1e')](function(){return db[_0x47e7('0x3d')][_0x47e7('0x38')]({'where':{'id':_0xb36a9b[_0x47e7('0x5c')]['id'],'role':_0x47e7('0x74')},'attributes':['id',_0x47e7('0x39'),_0x47e7('0x2d'),'internal',_0x47e7('0xa0'),_0x47e7('0x9d')]});})[_0x47e7('0x1e')](handleEntityNotFound(_0x5aba08,null))[_0x47e7('0x1e')](function(_0x1c5359){if(_0x1c5359){_0x245f21=_0x1c5359;return respondWithRpcPromise(_0x47e7('0xfe'),'pause',{'id':_0x245f21['id'],'name':_0x245f21[_0x47e7('0x39')],'pause':!![]});}})[_0x47e7('0x1e')](function(){if(_0x245f21){return db['MemberReport'][_0x47e7('0x8b')]({'where':{'membername':_0x245f21[_0x47e7('0x39')],'type':_0x47e7('0xfa'),'exitAt':null}});}})['then'](function(_0x146008){if(_0x146008[_0x47e7('0x53')]){var _0x548ac3=moment()[_0x47e7('0xa7')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2126f3=0x0,_0x5be44b=_0x146008[_0x47e7('0x53')];_0x2126f3<_0x5be44b;_0x2126f3++){_0x146008[_0x2126f3][_0x47e7('0xff')]({'exitAt':_0x548ac3});}}})[_0x47e7('0x1e')](function(){var _0x87059d=[];var _0x580824=utils['getChannels']();_0x580824[_0x47e7('0xf7')](function(_0x329c1a){_0x87059d[_0x47e7('0x50')]({'channel':_0x329c1a,'membername':_0x245f21['name'],'interface':_['isNil'](_0x245f21[_0x47e7('0xa0')])?util[_0x47e7('0xa7')](_0x47e7('0xa8'),_0x245f21[_0x47e7('0x39')]):_0x245f21[_0x47e7('0xa0')],'type':'PAUSE','enterAt':moment()[_0x47e7('0xa7')](_0x47e7('0xf5')),'data1':_0xb36a9b[_0x47e7('0x5f')]['type']||'DEFAULT\x20PAUSE','role':_0x245f21['role'],'internal':_0x245f21[_0x47e7('0x63')]});});return db['MemberReport'][_0x47e7('0x100')](_0x87059d,{'individualHooks':!![]});})[_0x47e7('0x1e')](function(){return _0x245f21['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0xb36a9b[_0x47e7('0x5f')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x47e7('0xa7')](_0x47e7('0xf5'))});})[_0x47e7('0x1e')](respondWithResult(_0x5aba08,null))[_0x47e7('0x28')](handleError(_0x5aba08,null));};exports['unpause']=function(_0x44f462,_0x37b6c3){if(_0x44f462['body'][_0x47e7('0x9c')]&&!utils[_0x47e7('0xac')](_0x44f462[_0x47e7('0x5f')]['channel'])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x44f462[_0x47e7('0x5f')]['channel']));}return db['User'][_0x47e7('0x38')]({'where':{'id':_0x44f462[_0x47e7('0x5c')]['id']},'attributes':['id','name',_0x47e7('0x2d'),'internal',_0x47e7('0xa0'),_0x47e7('0x9d'),_0x47e7('0x9f'),_0x47e7('0x101'),_0x47e7('0x102'),'faxPause','openchannelPause',_0x47e7('0x103'),'whatsappPause',_0x47e7('0x104'),_0x47e7('0x105')]})[_0x47e7('0x1e')](function(_0x57763f){if(!_0x57763f){throw new APINotFoundError(util[_0x47e7('0xa7')](_0x47e7('0x106'),_0x44f462[_0x47e7('0x5c')]['id']));}return _0x57763f[_0x47e7('0x107')](_0x44f462['body'][_0x47e7('0x9c')]);})['then'](respondWithResult(_0x37b6c3,null))[_0x47e7('0x28')](APIHandleError(_0x37b6c3));};exports[_0x47e7('0x108')]=function(_0x12be58,_0x9ba92b){var _0x5bf5ad={};var _0x51a5eb={};var _0x3a791b;var _0x1f2e53;return db[_0x47e7('0x3d')]['findOne']({'where':{'id':_0x12be58[_0x47e7('0x5c')]['id']}})['then'](handleEntityNotFound(_0x9ba92b,null))[_0x47e7('0x1e')](function(_0xd5e251){if(_0xd5e251){_0x3a791b=_0xd5e251;_0x51a5eb[_0x47e7('0xc9')]=_[_0x47e7('0xcb')](db[_0x47e7('0x109')]['rawAttributes']);_0x51a5eb[_0x47e7('0x49')]=_[_0x47e7('0xcb')](_0x12be58['query']);_0x51a5eb[_0x47e7('0xd1')]=_['intersection'](_0x51a5eb['model'],_0x51a5eb[_0x47e7('0x49')]);_0x5bf5ad[_0x47e7('0x4f')]=_[_0x47e7('0xcc')](_0x51a5eb[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x12be58[_0x47e7('0x49')][_0x47e7('0xcd')]));_0x5bf5ad[_0x47e7('0x4f')]=_0x5bf5ad[_0x47e7('0x4f')]['length']?_0x5bf5ad[_0x47e7('0x4f')]:_0x51a5eb[_0x47e7('0xc9')];_0x5bf5ad[_0x47e7('0xd8')]=qs[_0x47e7('0xce')](_0x12be58[_0x47e7('0x49')]['sort']);_0x5bf5ad[_0x47e7('0xcf')]=qs['filters'](_[_0x47e7('0xd0')](_0x12be58['query'],_0x51a5eb[_0x47e7('0xd1')]));if(_0x12be58[_0x47e7('0x49')][_0x47e7('0x42')]){_0x5bf5ad[_0x47e7('0xcf')]=_[_0x47e7('0xd2')](_0x5bf5ad[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0x5bf5ad[_0x47e7('0x4f')],function(_0x1fed0f){var _0x1f290a={};_0x1f290a[_0x1fed0f]={'$like':'%'+_0x12be58[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x1f290a;})});}_0x5bf5ad=_[_0x47e7('0xd2')]({},_0x5bf5ad,_0x12be58[_0x47e7('0x5d')]);return _0x3a791b['getTeams'](_0x5bf5ad);}})[_0x47e7('0x1e')](function(_0x1c46fa){if(_0x1c46fa){_0x1f2e53=_0x1c46fa[_0x47e7('0x53')];if(!_0x12be58[_0x47e7('0x49')]['hasOwnProperty'](_0x47e7('0xd4'))){_0x5bf5ad[_0x47e7('0x1a')]=qs[_0x47e7('0x1a')](_0x12be58[_0x47e7('0x49')][_0x47e7('0x1a')]);_0x5bf5ad[_0x47e7('0x18')]=qs[_0x47e7('0x18')](_0x12be58['query'][_0x47e7('0x18')]);}return _0x3a791b[_0x47e7('0x108')](_0x5bf5ad);}})[_0x47e7('0x1e')](function(_0x1992cd){if(_0x1992cd){return _0x1992cd?{'count':_0x1f2e53,'rows':_0x1992cd}:null;}})[_0x47e7('0x1e')](respondWithResult(_0x9ba92b,null))['catch'](handleError(_0x9ba92b,null));};exports[_0x47e7('0x10a')]=function(_0x5a3f2d,_0x331b07){var _0x7ff6da=_0x5a3f2d['params']['id'];var _0x5de275=_0x5a3f2d[_0x47e7('0x5f')]?_0x5a3f2d[_0x47e7('0x5f')][_0x47e7('0x62')]:null;var _0x3857a6=[];return Promise[_0x47e7('0xfc')]()[_0x47e7('0x1e')](function(){if(!_0x5de275)throw new APIBadRequestError(_0x47e7('0x10b'));})[_0x47e7('0x1e')](function(){return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x7ff6da}});})[_0x47e7('0x1e')](function(_0x427c84){if(!_0x427c84)throw new APINotFoundError(util[_0x47e7('0xa7')](_0x47e7('0x106'),_0x5a3f2d[_0x47e7('0x5c')]['id']));return db[_0x47e7('0x6c')][_0x47e7('0x10c')](function(_0x229f4e){return _0x427c84['addTeams'](_0x5de275,{'transaction':_0x229f4e})['then'](function(){return db[_0x47e7('0x109')]['findAll']({'where':{'id':{'$in':_0x5de275}}});})['then'](function(_0xa7c8bd){var _0x459c13=_[_0x47e7('0x35')](_0xa7c8bd,function(_0x52799c){return _0x52799c[_0x47e7('0x10d')]();});return Promise['all'](_0x459c13);})[_0x47e7('0x1e')](function(_0x3a2170){_0x3857a6=_[_0x47e7('0x10e')](_0x3a2170);var _0xe43b02=_[_0x47e7('0x35')](_0x3857a6,function(_0x4e2e77){return _0x4e2e77[_0x47e7('0x10f')](_0x427c84['id'],{'transaction':_0x229f4e});});return Promise[_0x47e7('0x5a')](_0xe43b02);})[_0x47e7('0x1e')](function(){if(!_0x427c84['online'])return;var _0x326e29=_[_0x47e7('0x42')](_0x3857a6,function(_0x252ed9){return _0x252ed9[_0x47e7('0x110')](_0x47e7('0x9c'))==='Voice';});var _0x2022dd=_[_0x47e7('0x35')](_0x326e29,function(_0x2a50c4){return db[_0x47e7('0xa9')][_0x47e7('0xaa')]({'membername':_0x427c84[_0x47e7('0x39')],'UserId':_0x427c84['id'],'queue_name':_0x2a50c4[_0x47e7('0x39')],'VoiceQueueId':_0x2a50c4['id'],'interface':_[_0x47e7('0x69')](_0x427c84[_0x47e7('0xa0')])?util[_0x47e7('0xa7')]('SIP/%s',_0x427c84[_0x47e7('0x39')]):_0x427c84[_0x47e7('0xa0')],'paused':_0x427c84['voicePause']||![],'penalty':_0x427c84['penalty']},{'transaction':_0x229f4e});});return Promise[_0x47e7('0x5a')](_0x2022dd);})[_0x47e7('0x1e')](function(){return db[_0x47e7('0x111')][_0x47e7('0x8b')]({'where':{'teamId':{'$in':_0x5de275}}});})[_0x47e7('0x1e')](function(_0x408899){var _0x25f185=_[_0x47e7('0x35')](_0x408899,function(_0x2eba57){return db[_0x47e7('0x112')]['create']({'UserId':_0x427c84['id'],'VoicePrefixId':_0x2eba57[_0x47e7('0x113')]},{'transaction':_0x229f4e});});return Promise[_0x47e7('0x5a')](_0x25f185);});});})[_0x47e7('0x1e')](function(){for(var _0x2896a3=0x0;_0x2896a3<_0x3857a6[_0x47e7('0x53')];_0x2896a3++){var _0x54e0ef=_0x3857a6[_0x2896a3][_0x47e7('0x110')](_0x47e7('0x9c'));var _0x476123=_0x54e0ef+_0x47e7('0xae');socket[_0x47e7('0x2a')](_0x47e7('0x30')+_0x54e0ef+_0x47e7('0x114'),{'UserId':_0x7ff6da,['queueField']:_0x3857a6[_0x2896a3]['id']});}})[_0x47e7('0x1e')](respondWithStatusCode(_0x331b07,null))[_0x47e7('0x28')](APIHandleError(_0x331b07));};exports[_0x47e7('0x115')]=function(_0x314d71,_0x151540){var _0x1fd670=_0x314d71['params']['id'];var _0x2e9a5e=null;if(_0x314d71['query'][_0x47e7('0x62')]){_0x2e9a5e=_[_0x47e7('0x116')](_0x314d71[_0x47e7('0x49')]['ids'])?_0x314d71[_0x47e7('0x49')][_0x47e7('0x62')]:[_0x314d71[_0x47e7('0x49')][_0x47e7('0x62')]];}var _0x5aab1c=[];return Promise[_0x47e7('0xfc')]()[_0x47e7('0x1e')](function(){if(!_0x2e9a5e)throw new APIBadRequestError(_0x47e7('0x117'));})[_0x47e7('0x1e')](function(){return db['User'][_0x47e7('0x97')]({'where':{'id':_0x1fd670}});})[_0x47e7('0x1e')](function(_0x11991b){if(!_0x11991b)throw new APINotFoundError(util[_0x47e7('0xa7')](_0x47e7('0x106'),_0x314d71[_0x47e7('0x5c')]['id']));return db[_0x47e7('0x6c')][_0x47e7('0x10c')](function(_0x58ca32){return _0x11991b[_0x47e7('0x115')](_0x2e9a5e,{'transaction':_0x58ca32})[_0x47e7('0x1e')](function(){return db[_0x47e7('0x109')][_0x47e7('0x8b')]({'where':{'id':{'$in':_0x2e9a5e}}});})[_0x47e7('0x1e')](function(_0x5e5949){var _0x1ed617=_[_0x47e7('0x35')](_0x5e5949,function(_0x2ddc5e){return _0x2ddc5e[_0x47e7('0x10d')]();});return Promise[_0x47e7('0x5a')](_0x1ed617);})[_0x47e7('0x1e')](function(_0x596c6d){_0x5aab1c=_[_0x47e7('0x10e')](_0x596c6d);var _0x1569c5=_[_0x47e7('0x35')](_0x5aab1c,function(_0x58ef34){return _0x58ef34[_0x47e7('0x118')](_0x11991b['id'],{'transaction':_0x58ca32});});return Promise[_0x47e7('0x5a')](_0x1569c5);})[_0x47e7('0x1e')](function(){if(!_0x11991b[_0x47e7('0x9d')])return;var _0x5506ed=_['filter'](_0x5aab1c,function(_0x5c39e8){return _0x5c39e8[_0x47e7('0x110')]('channel')===_0x47e7('0x119');});var _0x3b3e93=_['map'](_0x5506ed,function(_0x265e1c){return db[_0x47e7('0xa9')][_0x47e7('0x3a')]({'where':{'VoiceQueueId':_0x265e1c['id'],'UserId':_0x11991b['id']},'transaction':_0x58ca32});});return Promise[_0x47e7('0x5a')](_0x3b3e93);})[_0x47e7('0x1e')](function(){return db['TeamVoicePrefix'][_0x47e7('0x8b')]({'where':{'teamId':{'$in':_0x2e9a5e}}});})[_0x47e7('0x1e')](function(_0x2dc0b8){var _0x58e266=_['map'](_0x2dc0b8,function(_0xdc6f9c){return db[_0x47e7('0x112')][_0x47e7('0x3a')]({'where':{'UserId':_0x11991b['id'],'VoicePrefixId':_0xdc6f9c[_0x47e7('0x113')]}},{'transaction':_0x58ca32});});return Promise[_0x47e7('0x5a')](_0x58e266);});});})[_0x47e7('0x1e')](function(){for(var _0x1d3399=0x0;_0x1d3399<_0x5aab1c['length'];_0x1d3399++){var _0x332141=_0x5aab1c[_0x1d3399][_0x47e7('0x110')](_0x47e7('0x9c'));var _0x5b7b60=_0x332141+_0x47e7('0xae');socket[_0x47e7('0x2a')](_0x47e7('0x30')+_0x332141+_0x47e7('0xaf'),{'UserId':_0x1fd670,['queueField']:_0x5aab1c[_0x1d3399]['id']});}})['then'](respondWithStatusCode(_0x151540,null))[_0x47e7('0x28')](APIHandleError(_0x151540));};exports['getLists']=function(_0x131265,_0x5c642c){var _0x1e9e03={};var _0x170c75={};var _0x523349;var _0x5e01e6;return db[_0x47e7('0x3d')]['findOne']({'where':{'id':_0x131265[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0x5c642c,null))[_0x47e7('0x1e')](function(_0x2dccba){if(_0x2dccba){_0x523349=_0x2dccba;_0x170c75['model']=_[_0x47e7('0xcb')](db[_0x47e7('0x11a')][_0x47e7('0x3e')]);_0x170c75[_0x47e7('0x49')]=_[_0x47e7('0xcb')](_0x131265[_0x47e7('0x49')]);_0x170c75['filters']=_[_0x47e7('0xcc')](_0x170c75[_0x47e7('0xc9')],_0x170c75[_0x47e7('0x49')]);_0x1e9e03['attributes']=_[_0x47e7('0xcc')](_0x170c75[_0x47e7('0xc9')],qs['fields'](_0x131265['query'][_0x47e7('0xcd')]));_0x1e9e03[_0x47e7('0x4f')]=_0x1e9e03[_0x47e7('0x4f')][_0x47e7('0x53')]?_0x1e9e03[_0x47e7('0x4f')]:_0x170c75[_0x47e7('0xc9')];_0x1e9e03[_0x47e7('0xd8')]=qs[_0x47e7('0xce')](_0x131265[_0x47e7('0x49')][_0x47e7('0xce')]);_0x1e9e03[_0x47e7('0xcf')]=qs[_0x47e7('0xd1')](_[_0x47e7('0xd0')](_0x131265[_0x47e7('0x49')],_0x170c75['filters']));if(_0x131265[_0x47e7('0x49')][_0x47e7('0x42')]){_0x1e9e03[_0x47e7('0xcf')]=_['merge'](_0x1e9e03[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0x1e9e03[_0x47e7('0x4f')],function(_0xa47c50){var _0x83b798={};_0x83b798[_0xa47c50]={'$like':'%'+_0x131265[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x83b798;})});}_0x1e9e03=_[_0x47e7('0xd2')]({},_0x1e9e03,_0x131265['options']);return _0x523349['getLists'](_0x1e9e03);}})[_0x47e7('0x1e')](function(_0x44d692){if(_0x44d692){_0x5e01e6=_0x44d692[_0x47e7('0x53')];if(!_0x131265[_0x47e7('0x49')][_0x47e7('0xc4')](_0x47e7('0xd4'))){_0x1e9e03[_0x47e7('0x1a')]=qs['limit'](_0x131265[_0x47e7('0x49')]['limit']);_0x1e9e03[_0x47e7('0x18')]=qs[_0x47e7('0x18')](_0x131265[_0x47e7('0x49')][_0x47e7('0x18')]);}return _0x523349['getLists'](_0x1e9e03);}})[_0x47e7('0x1e')](function(_0x44cd19){if(_0x44cd19){return _0x44cd19?{'count':_0x5e01e6,'rows':_0x44cd19}:null;}})[_0x47e7('0x1e')](respondWithResult(_0x5c642c,null))[_0x47e7('0x28')](handleError(_0x5c642c,null));};exports[_0x47e7('0x11b')]=function(_0x1a8247,_0xe2f5ff){var _0x14dea1={};var _0x48a5bb={};var _0x529192;return db[_0x47e7('0x3d')][_0x47e7('0x97')]({'where':{'id':_0x1a8247[_0x47e7('0x5c')]['id']}})[_0x47e7('0x1e')](handleEntityNotFound(_0xe2f5ff,null))[_0x47e7('0x1e')](function(_0x2832ae){if(_0x2832ae){_0x529192=_0x2832ae;_0x48a5bb[_0x47e7('0xc9')]=_[_0x47e7('0xcb')](db[_0x47e7('0x3d')]['rawAttributes']);_0x48a5bb[_0x47e7('0x49')]=_[_0x47e7('0xcb')](_0x1a8247[_0x47e7('0x49')]);_0x48a5bb[_0x47e7('0xd1')]=_[_0x47e7('0xcc')](_0x48a5bb[_0x47e7('0xc9')],_0x48a5bb[_0x47e7('0x49')]);_0x14dea1[_0x47e7('0x4f')]=_[_0x47e7('0xcc')](_0x48a5bb[_0x47e7('0xc9')],qs[_0x47e7('0xcd')](_0x1a8247[_0x47e7('0x49')][_0x47e7('0xcd')]));_0x14dea1['attributes']=_0x14dea1[_0x47e7('0x4f')][_0x47e7('0x53')]?_0x14dea1[_0x47e7('0x4f')]:_0x48a5bb[_0x47e7('0xc9')];_0x14dea1[_0x47e7('0xd8')]=qs[_0x47e7('0xce')](_0x1a8247['query'][_0x47e7('0xce')]);_0x14dea1[_0x47e7('0xcf')]=qs[_0x47e7('0xd1')](_['pick'](_0x1a8247['query'],_0x48a5bb[_0x47e7('0xd1')]));if(_0x1a8247['query'][_0x47e7('0x42')]){_0x14dea1['where']=_[_0x47e7('0xd2')](_0x14dea1[_0x47e7('0xcf')],{'$or':_[_0x47e7('0x35')](_0x14dea1[_0x47e7('0x4f')],function(_0x21890c){var _0x3469fa={};_0x3469fa[_0x21890c]={'$like':'%'+_0x1a8247[_0x47e7('0x49')][_0x47e7('0x42')]+'%'};return _0x3469fa;})});}_0x14dea1['model']=db['User'];_0x14dea1['as']=_0x47e7('0x31');_0x14dea1=_[_0x47e7('0xd2')]({},_0x14dea1,_0x1a8247[_0x47e7('0x5d')]);return _0x529192[_0x47e7('0xf2')]({'include':[_0x14dea1]});}})[_0x47e7('0x1e')](function(_0x4aceb1){if(_0x4aceb1){var _0x2e5f31={},_0x12204a=[];for(var _0x474391=0x0;_0x474391<_0x4aceb1[_0x47e7('0x53')];_0x474391+=0x1){for(var _0x26c560=0x0,_0x59c71f;_0x26c560<_0x4aceb1[_0x474391]['Agents']['length'];_0x26c560+=0x1){_0x59c71f=_0x4aceb1[_0x474391][_0x47e7('0x31')][_0x26c560][_0x47e7('0x2c')]({'plain':!![]});_0x2e5f31[_0x59c71f['id']]=_0x59c71f;}}_0x2e5f31=_[_0x47e7('0x11c')](_0x2e5f31);for(var _0x439ccf=qs[_0x47e7('0x18')](_0x1a8247[_0x47e7('0x49')][_0x47e7('0x18')]);_0x439ccf<_0x2e5f31[_0x47e7('0x53')]&&_0x12204a[_0x47e7('0x53')]=_0x1dc954){_0x1936f8=_0x1dc954;_0x295dcc=0xc8;}else{_0x295dcc=0xce;}_0x269eb5[_0x4353('0x15')](_0x295dcc);return _0x269eb5['set'](_0x4353('0x1c'),_0x2a6c37+'-'+_0x1936f8+'/'+_0x1dc954)['json'](_0x54e273);}return null;};}function respondWithRpcPromise(_0x158609,_0x21db04,_0xbc87d5,_0x40ac71){return new Promise(function(_0x67af9,_0xe55dbc){var _0x5294d5=_0x40ac71||amiClient;return _0x5294d5[_0x4353('0x1d')](_0x158609,_0xbc87d5)[_0x4353('0x1e')](function(_0x3e26e5){logger['info'](_0x4353('0x1f'),_0x21db04,_0x4353('0x20'));logger[_0x4353('0x21')](_0x4353('0x22'),_0x21db04,_0x4353('0x20'),JSON[_0x4353('0x23')](_0x3e26e5));if(_0x3e26e5[_0x4353('0x24')]){if(_0x3e26e5[_0x4353('0x24')][_0x4353('0x25')]===0x1f4){logger[_0x4353('0x24')](_0x4353('0x1f'),_0x21db04,_0x3e26e5[_0x4353('0x24')][_0x4353('0x26')]);return _0xe55dbc(_0x3e26e5[_0x4353('0x24')][_0x4353('0x26')]);}logger[_0x4353('0x24')]('User,\x20%s,\x20%s',_0x21db04,_0x3e26e5[_0x4353('0x24')][_0x4353('0x26')]);return _0x67af9(_0x3e26e5[_0x4353('0x24')]['message']);}else{logger[_0x4353('0x27')](_0x4353('0x1f'),_0x21db04,_0x4353('0x20'));_0x67af9(_0x3e26e5[_0x4353('0x28')][_0x4353('0x26')]);}})[_0x4353('0x29')](function(_0x31c3f0){logger[_0x4353('0x24')](_0x4353('0x1f'),_0x21db04,_0x31c3f0);_0xe55dbc(_0x31c3f0);});});}function saveUpdates(_0x478242){return function(_0x5a2667){if(_0x5a2667){return _0x5a2667[_0x4353('0x2a')](_0x478242)[_0x4353('0x1e')](function(_0x2c939c){if(_0x2c939c[_0x4353('0x2b')]===_0x4353('0x2c')){socket['emit'](_0x4353('0x2d')+_0x2c939c['id'],_0x2c939c);}return _0x2c939c;});}return null;};}function removeEntity(_0x54772b,_0x580213){return function(_0x5bda5a){if(_0x5bda5a){return _0x5bda5a[_0x4353('0x2e')]({'transaction':_0x580213})[_0x4353('0x1e')](function(){var _0x69a53a=_0x5bda5a[_0x4353('0x2f')]({'plain':!![]});if(_0x69a53a[_0x4353('0x2b')]===_0x4353('0x30'))return;var _0x3e1fb9=[{'name':_0x4353('0x31'),'value':_0x4353('0x32'),'ignore':!![]},{'name':_0x4353('0x33'),'value':_0x4353('0x2c'),'ignore':![]},{'name':_0x4353('0x34'),'value':_0x4353('0x35'),'ignore':![]}];var _0x13d3e0=_(_0x3e1fb9)[_0x4353('0x36')](_0x4353('0x37'))[_0x4353('0x38')]('value')['value']();if(_[_0x4353('0x39')](_0x13d3e0,_0x69a53a[_0x4353('0x2b')])){return;}var _0x57cb12=_[_0x4353('0x3a')](_0x3e1fb9,[_0x4353('0x3b'),_0x69a53a[_0x4353('0x2b')]])[_0x4353('0x3c')];return db[_0x4353('0x3d')][_0x4353('0x2e')]({'where':{'type':_0x57cb12,'resourceId':_0x69a53a['id']},'transaction':_0x580213})[_0x4353('0x1e')](function(){return _0x5bda5a;});})[_0x4353('0x1e')](function(){_0x54772b[_0x4353('0x15')](0xcc)[_0x4353('0x16')]();});}};}function handleEntityNotFound(_0x506199){return function(_0x3f8f48){if(!_0x3f8f48){_0x506199[_0x4353('0x3e')](0x194);}return _0x3f8f48;};}function handleError(_0x117214,_0x4eebf1){_0x4eebf1=_0x4eebf1||0x1f4;return function(_0x3ddf44){logger['error'](_0x3ddf44['stack']);if(_0x3ddf44['name']){delete _0x3ddf44[_0x4353('0x3c')];}_0x117214[_0x4353('0x15')](_0x4eebf1)[_0x4353('0x3f')](_0x3ddf44);};}function getUserAttributes(){return _(db[_0x4353('0x40')]['rawAttributes'])['map'](function(_0x4104b1){return{'name':_0x4104b1[_0x4353('0x41')],'type':_0x4104b1[_0x4353('0x42')][_0x4353('0x43')]};})[_0x4353('0x36')](function(_0x5588ef){return![_0x4353('0x44'),'salt',_0x4353('0x45'),_0x4353('0x46'),_0x4353('0x47'),_0x4353('0x48')]['includes'](_0x5588ef['name']);})[_0x4353('0x3b')]();}exports[_0x4353('0x49')]=function(_0x409f1c,_0x2ef3e2){var _0x18bc0d={},_0x350c73={'count':0x0,'rows':[]};var _0xaf73ee=getUserAttributes();_0x18bc0d=qs[_0x4353('0x4a')](_0xaf73ee,_0x409f1c);var _0x149579={'where':_0x18bc0d[_0x4353('0x4b')]};return db['User']['count'](_0x149579)['then'](function(_0x1ce806){_0x350c73[_0x4353('0x1b')]=_0x1ce806;if(_0x409f1c[_0x4353('0x4c')]['includeAll']){_0x18bc0d['include']=[{'all':!![]}];}if(_0x409f1c[_0x4353('0x4c')][_0x4353('0x4d')]===_0x4353('0x4e')){_0x18bc0d[_0x4353('0x4f')]=[{'model':db[_0x4353('0x50')],'as':'userSetting'}];}if(!_[_0x4353('0x39')](_0x18bc0d[_0x4353('0x51')],'id')){_0x18bc0d[_0x4353('0x51')][_0x4353('0x52')]('id');}return db['User'][_0x4353('0x53')](_0x18bc0d);})['then'](function(_0x4ededb){_0x350c73[_0x4353('0x54')]=_0x4ededb;if(_0x409f1c[_0x4353('0x4c')][_0x4353('0x55')]===_0x4353('0x4e')){var _0x157b45=[];for(var _0xa6fdce=0x0;_0xa6fdce<_0x350c73['rows'][_0x4353('0x56')];_0xa6fdce++){_0x157b45[_0x4353('0x52')](get_open_tabs(_0x4353('0x57'),_0x350c73['rows'][_0xa6fdce][_0x4353('0x58')]));_0x157b45[_0x4353('0x52')](get_open_tabs(_0x4353('0x59'),_0x350c73['rows'][_0xa6fdce]['dataValues']));_0x157b45['push'](get_open_tabs('fax',_0x350c73['rows'][_0xa6fdce]['dataValues']));_0x157b45[_0x4353('0x52')](get_open_tabs(_0x4353('0x5a'),_0x350c73[_0x4353('0x54')][_0xa6fdce][_0x4353('0x58')]));_0x157b45[_0x4353('0x52')](get_open_tabs(_0x4353('0x5b'),_0x350c73['rows'][_0xa6fdce][_0x4353('0x58')]));_0x157b45[_0x4353('0x52')](get_open_tabs(_0x4353('0x5c'),_0x350c73[_0x4353('0x54')][_0xa6fdce]['dataValues']));}return Promise[_0x4353('0x5d')](_0x157b45)[_0x4353('0x1e')](function(){return _0x350c73;});}else{return _0x350c73;}})[_0x4353('0x1e')](respondWithFilteredResult(_0x2ef3e2,_0x18bc0d))['catch'](handleError(_0x2ef3e2,null));};exports[_0x4353('0x5e')]=function(_0x106648,_0x33f47e){var _0x2c8d27=getUserAttributes();_0x106648[_0x4353('0x4c')]['id']=_0x106648[_0x4353('0x5f')]['id'];var _0x51b864=qs['getOptions'](_0x2c8d27,_0x106648);if(_0x106648[_0x4353('0x4c')][_0x4353('0x60')]){_0x51b864[_0x4353('0x4f')]=[{'all':!![]}];}if(_0x106648[_0x4353('0x4c')]['userSetting']==='true'){_0x51b864[_0x4353('0x4f')]=[{'model':db['UserSetting'],'as':_0x4353('0x4d')}];}_0x51b864=_[_0x4353('0x61')]({},_0x51b864,_0x106648[_0x4353('0x62')]);if(!_[_0x4353('0x39')](_0x51b864[_0x4353('0x51')],'id')){_0x51b864[_0x4353('0x51')][_0x4353('0x52')]('id');}return db['User']['find'](_0x51b864)[_0x4353('0x1e')](handleEntityNotFound(_0x33f47e,null))[_0x4353('0x1e')](function(_0x540e95){var _0x43c5d5=[];values=_0x540e95;if(_0x106648[_0x4353('0x4c')][_0x4353('0x55')]==='true'){_0x43c5d5[_0x4353('0x52')](get_open_tabs(_0x4353('0x57'),_0x540e95[_0x4353('0x58')]));_0x43c5d5[_0x4353('0x52')](get_open_tabs(_0x4353('0x59'),_0x540e95[_0x4353('0x58')]));_0x43c5d5[_0x4353('0x52')](get_open_tabs(_0x4353('0x5b'),_0x540e95[_0x4353('0x58')]));_0x43c5d5['push'](get_open_tabs(_0x4353('0x5c'),_0x540e95['dataValues']));_0x43c5d5[_0x4353('0x52')](get_open_tabs(_0x4353('0x63'),_0x540e95[_0x4353('0x58')]));_0x43c5d5[_0x4353('0x52')](get_open_tabs(_0x4353('0x5a'),_0x540e95[_0x4353('0x58')]));return Promise[_0x4353('0x5d')](_0x43c5d5);}else{return values;}})[_0x4353('0x1e')](function(){return values;})[_0x4353('0x1e')](respondWithResult(_0x33f47e,null))[_0x4353('0x29')](handleError(_0x33f47e,null));};exports[_0x4353('0x2a')]=function(_0x55606f,_0x3cd169){if(_0x55606f[_0x4353('0x64')]['id']){delete _0x55606f[_0x4353('0x64')]['id'];}delete _0x55606f[_0x4353('0x64')][_0x4353('0x2b')];return db[_0x4353('0x40')][_0x4353('0x3a')]({'where':{'id':_0x55606f[_0x4353('0x5f')]['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x3cd169,null))['then'](saveUpdates(_0x55606f[_0x4353('0x64')],null))[_0x4353('0x1e')](respondWithResult(_0x3cd169,null))['catch'](handleError(_0x3cd169,null));};exports['describe']=function(_0x308c32,_0x1ea35e){return db[_0x4353('0x40')]['describe']()[_0x4353('0x1e')](respondWithResult(_0x1ea35e,null))[_0x4353('0x29')](handleError(_0x1ea35e,null));};exports[_0x4353('0x65')]=function(_0x5f29d5,_0x1f5639){return db[_0x4353('0x40')][_0x4353('0x3a')]({'where':{'id':_0x5f29d5[_0x4353('0x5f')]['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x1f5639,null))[_0x4353('0x1e')](function(_0x185cd2){if(_0x185cd2){return _0x185cd2[_0x4353('0x65')](_0x5f29d5[_0x4353('0x64')]['ids'],_[_0x4353('0x66')](_0x5f29d5['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x1f5639,null))[_0x4353('0x29')](handleError(_0x1f5639,null));};function validateUser(_0x39424f){return new Promise(function(_0x29b669,_0x31d741){if(_0x39424f['internal'])return _0x29b669(_0x39424f);return db[_0x4353('0x67')][_0x4353('0x68')](0x1)[_0x4353('0x1e')](function(_0x33d78f){if(_0x33d78f[_0x4353('0x69')])authService['validatePasswordPattern'](_0x39424f['password']);db[_0x4353('0x40')]['max']('internal')[_0x4353('0x1e')](function(_0x1e66ec){if(_[_0x4353('0x6a')](_0x1e66ec)){_0x39424f[_0x4353('0x6b')]=_0x33d78f[_0x4353('0x6c')]||0x1;return;}if(_[_0x4353('0x6a')](_0x33d78f['min_internal'])||_0x33d78f[_0x4353('0x6c')]===_0x1e66ec){_0x39424f[_0x4353('0x6b')]=_0x1e66ec+0x1;return;}if(_0x33d78f[_0x4353('0x6c')]>_0x1e66ec){_0x39424f[_0x4353('0x6b')]=_0x33d78f['min_internal'];return;}return db[_0x4353('0x6d')][_0x4353('0x4c')](_0x4353('0x6e'),{'type':db[_0x4353('0x6d')][_0x4353('0x6f')][_0x4353('0x70')]})[_0x4353('0x1e')](function(_0x1c4d8d){if(_0x1c4d8d&&_0x1c4d8d[_0x4353('0x56')]){for(var _0x4283cd=0x0,_0x229c97=_0x1c4d8d['length'];_0x4283cd<_0x229c97&&_['isNil'](_0x39424f[_0x4353('0x6b')]);_0x4283cd++){if(_0x33d78f[_0x4353('0x6c')]<=_0x1c4d8d[_0x4283cd]['from']){_0x39424f[_0x4353('0x6b')]=_0x1c4d8d[_0x4283cd][_0x4353('0x71')];}else if(_0x33d78f[_0x4353('0x6c')]>_0x1c4d8d[_0x4283cd]['from']&&_0x33d78f[_0x4353('0x6c')]<=_0x1c4d8d[_0x4283cd]['to']){_0x39424f[_0x4353('0x6b')]=_0x33d78f[_0x4353('0x6c')];}}}if(_[_0x4353('0x6a')](_0x39424f[_0x4353('0x6b')])){_0x39424f[_0x4353('0x6b')]=_0x1e66ec+0x1;}return _0x29b669(_0x39424f);});});})[_0x4353('0x29')](function(_0x3f237f){_0x31d741(_0x3f237f);});});}function updateUser(_0x39d7c3){return new Promise(function(_0x52e789,_0x1e0fa0){try{if(_0x39d7c3[_0x4353('0x72')]){_0x39d7c3[_0x4353('0x73')]=_0x39d7c3[_0x4353('0x6b')];_0x39d7c3[_0x4353('0x74')]={'mailbox':_0x39d7c3[_0x4353('0x6b')],'password':_0x39d7c3[_0x4353('0x44')],'fullname':_0x39d7c3['fullname'],'email':_0x39d7c3[_0x4353('0x75')]};}if(_0x39d7c3[_0x4353('0x2b')]==='agent'){if(!_0x39d7c3['permissions'])_0x39d7c3[_0x4353('0x76')]=['101',_0x4353('0x77'),_0x4353('0x78'),_0x4353('0x79'),_0x4353('0x7a'),'104',_0x4353('0x7b'),_0x4353('0x7c'),_0x4353('0x7d'),_0x4353('0x7e'),_0x4353('0x7f'),_0x4353('0x80'),'111','114',_0x4353('0x81')];}_0x52e789(_0x39d7c3);}catch(_0x281ca4){_0x1e0fa0(_0x281ca4);}});}exports['create']=function(_0x4b64b7,_0x4ce341){if(_0x4b64b7['user'][_0x4353('0x2b')]===_0x4353('0x2c'))throw new Error(_0x4353('0x82'));if(_0x4b64b7[_0x4353('0x64')][_0x4353('0x2b')]===_0x4353('0x32')&&_0x4b64b7[_0x4353('0x32')]['role']!==_0x4353('0x30')){throw new Error(_0x4353('0x83'));}if(_0x4b64b7[_0x4353('0x64')][_0x4353('0x2b')]===_0x4353('0x30')&&_0x4b64b7[_0x4353('0x32')][_0x4353('0x2b')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x4b64b7[_0x4353('0x64')]])[_0x4353('0x1e')](function(){return validateUser(_0x4b64b7[_0x4353('0x64')]);})[_0x4353('0x1e')](function(_0x1a276){return updateUser(_0x1a276)['then'](function(_0x2e4be6){if(_0x2e4be6[_0x4353('0x2b')]===_0x4353('0x30')){_0x2e4be6['settingsEnabled']=_0x4b64b7[_0x4353('0x32')][_0x4353('0x84')];delete _0x2e4be6[_0x4353('0x85')];}return _0x2e4be6;});})[_0x4353('0x1e')](function(_0x20b904){return db['User']['create'](_0x20b904,{'include':[{'model':db['VoiceMail'],'as':_0x4353('0x74')}]});})[_0x4353('0x1e')](function(_0x413b49){if(_0x4b64b7['body']['role']==='user')return _0x413b49;if(_0x4b64b7[_0x4353('0x32')]['role']!==_0x4353('0x32'))return _0x413b49;return db[_0x4353('0x86')][_0x4353('0x3a')]({'where':{'name':_0x413b49[_0x4353('0x2b')]===_0x4353('0x2c')?'Agents':_0x4353('0x34'),'userProfileId':_0x4b64b7['user'][_0x4353('0x85')]},'raw':!![]})['then'](function(_0x4412a7){if(!_0x4412a7||_0x4412a7['autoAssociation']!=0x0)return _0x413b49;return db[_0x4353('0x3d')][_0x4353('0x87')]({'name':_0x413b49['name'],'resourceId':_0x413b49['id'],'type':_0x4412a7[_0x4353('0x3c')],'sectionId':_0x4412a7['id']},{})[_0x4353('0x1e')](function(){return _0x413b49;});})[_0x4353('0x29')](function(_0x56f75e){logger[_0x4353('0x24')](_0x4353('0x88'),_0x56f75e);throw _0x56f75e;});})[_0x4353('0x1e')](respondWithResult(_0x4ce341,0xc9))[_0x4353('0x29')](handleError(_0x4ce341,null));};exports[_0x4353('0x89')]=function(_0x1157d1,_0x4c6a1e){var _0x62a4b0=_0x1157d1[_0x4353('0x64')];var _0x159880=[];if(_0x1157d1['user'][_0x4353('0x2b')]===_0x4353('0x2c'))throw new Error(_0x4353('0x82'));if(_[_0x4353('0x8a')](_0x62a4b0,[_0x4353('0x2b'),_0x4353('0x32')])&&_0x1157d1[_0x4353('0x32')][_0x4353('0x2b')]!=='admin'){throw new Error(_0x4353('0x83'));}if(_[_0x4353('0x8a')](_0x62a4b0,[_0x4353('0x2b'),_0x4353('0x30')])&&_0x1157d1['user'][_0x4353('0x2b')]!==_0x4353('0x30')){throw new Error(_0x4353('0x8b'));}return licenseUtil[_0x4353('0x8c')](_0x62a4b0)[_0x4353('0x1e')](function(){return validateUser(_0x62a4b0[0x0]);})['then'](function(){for(var _0x1fdcf7=0x1;_0x1fdcf7<_0x62a4b0['length'];_0x1fdcf7++){var _0x3a4120=_0x62a4b0[_0x1fdcf7-0x1][_0x4353('0x6b')];if(!_0x62a4b0[_0x1fdcf7]['internal'])_0x62a4b0[_0x1fdcf7][_0x4353('0x6b')]=_0x3a4120+0x1;_0x159880[_0x4353('0x52')](validateUser(_0x62a4b0[_0x1fdcf7]));}return Promise[_0x4353('0x5d')](_0x159880);})[_0x4353('0x1e')](function(){_0x159880=[];for(var _0x3b7410=0x0;_0x3b7410<_0x62a4b0[_0x4353('0x56')];_0x3b7410++){_0x159880[_0x4353('0x52')](updateUser(_0x62a4b0[_0x3b7410]));}return Promise[_0x4353('0x5d')](_0x159880);})[_0x4353('0x1e')](function(){_0x159880=_0x62a4b0[_0x4353('0x38')](function(_0x5c35ba){return db[_0x4353('0x40')][_0x4353('0x87')](_0x5c35ba,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x4353('0x1e')](function(_0x531005){_0x5c35ba['id']=_0x531005['id'];return _0x5c35ba;});});return Promise['all'](_0x159880);})[_0x4353('0x1e')](function(_0x2fd3cd){if(_0x1157d1[_0x4353('0x64')][_0x4353('0x2b')]===_0x4353('0x32'))return _0x2fd3cd;if(_0x1157d1[_0x4353('0x32')][_0x4353('0x2b')]!=='user')return _0x2fd3cd;var _0x3acd56=_[_0x4353('0x8a')](_0x2fd3cd,function(_0x3e88db){return _0x3e88db[_0x4353('0x2b')]===_0x4353('0x2c')||_0x3e88db[_0x4353('0x2b')]===_0x4353('0x35');});if(!_0x3acd56)return _0x2fd3cd;return db[_0x4353('0x86')]['findAll']({'where':{'name':{'$or':[_0x4353('0x33'),'Telephones']},'userProfileId':_0x1157d1[_0x4353('0x32')][_0x4353('0x85')]},'raw':!![]})[_0x4353('0x1e')](function(_0x2d620e){if(_[_0x4353('0x8d')](_0x2d620e)||!_[_0x4353('0x8a')](_0x2d620e,['autoAssociation',0x0]))return _0x2fd3cd;_0x159880=[];var _0x1eaa23=_(_0x2d620e)[_0x4353('0x38')](function(_0xc8c607){if(_0xc8c607[_0x4353('0x8e')]===0x1)return;return _0xc8c607[_0x4353('0x3c')]===_0x4353('0x33')?_0x4353('0x2c'):_0x4353('0x35');})[_0x4353('0x8f')]()[_0x4353('0x3b')]();for(var _0x4f6baa=0x0;_0x4f6baa<_0x2fd3cd['length'];_0x4f6baa++){if(!_[_0x4353('0x39')](_0x1eaa23,_0x2fd3cd[_0x4f6baa][_0x4353('0x2b')]))return;var _0x366fc8=_0x2fd3cd[_0x4f6baa][_0x4353('0x2b')]==='agent'?_0x4353('0x33'):_0x4353('0x34');_0x159880[_0x4353('0x52')](db[_0x4353('0x3d')][_0x4353('0x87')]({'name':_0x2fd3cd[_0x4f6baa]['name'],'resourceId':_0x2fd3cd[_0x4f6baa]['id'],'type':_0x366fc8,'sectionId':_[_0x4353('0x3a')](_0x2d620e,[_0x4353('0x3c'),_0x366fc8])['id']},{}));}return Promise[_0x4353('0x5d')](_0x159880);});})['then'](respondWithResult(_0x4c6a1e,0xc9))[_0x4353('0x29')](handleError(_0x4c6a1e,null));};exports[_0x4353('0x90')]=function(_0x3d9b38,_0x41d724){if(_0x3d9b38[_0x4353('0x64')]['id']){delete _0x3d9b38[_0x4353('0x64')]['id'];}return db[_0x4353('0x40')][_0x4353('0x3a')]({'where':{'id':_0x3d9b38['params']['id']}})[_0x4353('0x1e')](function(_0x4ac3e1){if(!_0x4ac3e1)return null;if(_0x4ac3e1['id']===_0x3d9b38[_0x4353('0x32')]['id']){if(!_0x3d9b38[_0x4353('0x64')][_0x4353('0x91')]||!_0x3d9b38['body']['newPassword']){throw new db[(_0x4353('0x92'))][(_0x4353('0x93'))](_0x4353('0x94'));}if(!_0x4ac3e1[_0x4353('0x95')](_0x3d9b38[_0x4353('0x64')][_0x4353('0x91')])){throw new db[(_0x4353('0x92'))]['ValidationError']('Wrong\x20credentials');}if(_0x3d9b38[_0x4353('0x64')]['oldPassword']===_0x3d9b38[_0x4353('0x64')]['newPassword']){throw new db[(_0x4353('0x92'))][(_0x4353('0x93'))](_0x4353('0x96'));}}else if(_0x3d9b38[_0x4353('0x32')][_0x4353('0x2b')]===_0x4353('0x30')){if(!_0x3d9b38[_0x4353('0x64')][_0x4353('0x97')]){throw new db[(_0x4353('0x92'))][(_0x4353('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x3d9b38[_0x4353('0x32')][_0x4353('0x2b')]===_0x4353('0x32')){if(!_0x3d9b38[_0x4353('0x64')][_0x4353('0x97')]){throw new db[(_0x4353('0x92'))]['ValidationError'](_0x4353('0x98'));}if(_0x4ac3e1['role']!==_0x4353('0x2c')){throw new db[(_0x4353('0x92'))][(_0x4353('0x93'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0x4353('0x93'))](_0x4353('0x82'));}return _0x4ac3e1;})[_0x4353('0x1e')](handleEntityNotFound(_0x41d724,null))['then'](function(_0x264d16){return db[_0x4353('0x67')][_0x4353('0x99')]({'attributes':['id','securePassword',_0x4353('0x9a'),_0x4353('0x9b')]})[_0x4353('0x1e')](function(_0x272e19){if(_0x272e19['securePassword'])authService[_0x4353('0x9c')](_0x3d9b38[_0x4353('0x64')][_0x4353('0x97')]);if(!_0x272e19[_0x4353('0x9a')]||!_0x264d16[_0x4353('0x45')])return _0x264d16;authService['validatePasswordHistory'](_0x3d9b38[_0x4353('0x64')][_0x4353('0x97')],_0x264d16[_0x4353('0x45')],_0x272e19[_0x4353('0x9b')]);return _0x264d16;})['then'](saveUpdates({'password':_0x3d9b38[_0x4353('0x64')][_0x4353('0x97')],'passwordResetAt':_0x3d9b38[_0x4353('0x32')]['id']==_0x3d9b38[_0x4353('0x5f')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x3d9b38[_0x4353('0x64')]['newPassword'],_0x264d16[_0x4353('0x45')])},null));})[_0x4353('0x1e')](respondWithResult(_0x41d724,null))[_0x4353('0x29')](handleError(_0x41d724,null));};exports[_0x4353('0x9d')]=function(_0x4e0e7d,_0x56b1da){var _0x1a1a28=_0x4e0e7d[_0x4353('0x64')][_0x4353('0x9e')];return db[_0x4353('0x40')]['find']({'where':{'id':_0x4e0e7d[_0x4353('0x5f')]['id']},'attributes':['id',_0x4353('0x3c'),_0x4353('0x2b'),_0x4353('0x9f'),_0x4353('0xa0'),_0x4353('0xa1'),_0x4353('0xa2')]})[_0x4353('0x1e')](handleEntityNotFound(_0x56b1da,null))['then'](function(_0x24b472){if(_0x24b472){if(!utils[_0x4353('0xa3')](_0x1a1a28)){throw new db[(_0x4353('0x92'))][(_0x4353('0x93'))](_0x4353('0xa4'));}return _0x24b472[_0x4353('0xa5')+_['capitalize'](_0x1a1a28[_0x4353('0xa6')]())+_0x4353('0xa7')](_0x4e0e7d[_0x4353('0x64')][_0x4353('0xa8')],{'penalty':_0x4e0e7d[_0x4353('0x64')][_0x4353('0xa9')]||0x0})[_0x4353('0xaa')](function(_0x2d873e){for(var _0x4a3656=0x0;_0x4a3656<_0x4e0e7d['body'][_0x4353('0xa8')]['length'];_0x4a3656+=0x1){var _0x4f133d={'UserId':Number(_0x4e0e7d['params']['id'])};_0x4f133d[_[_0x4353('0xab')](_0x1a1a28[_0x4353('0xa6')]())+_0x4353('0xac')]=Number(_0x4e0e7d[_0x4353('0x64')][_0x4353('0xa8')][_0x4a3656]);socket[_0x4353('0xad')](_0x4353('0x32')+_['capitalize'](_0x1a1a28['toLowerCase']())+'Queue:save',_0x4f133d);}return _0x2d873e;})[_0x4353('0x1e')](function(){if(_0x1a1a28===_0x4353('0xae')){return db[_0x4353('0xaf')][_0x4353('0x53')]({'where':{'id':_0x4e0e7d['body']['ids']||[]},'raw':!![],'attributes':['id',_0x4353('0x3c')]});}})[_0x4353('0x1e')](function(_0x39cfd5){var _0xf74faa=_0x24b472['get']({'plain':!![]});var _0x4d47a5=[];if(_0x1a1a28==='voice'&&_0xf74faa[_0x4353('0x2b')]===_0x4353('0x2c')&&_0xf74faa[_0x4353('0x9f')]){for(let _0x15677b=0x0;_0x15677b<_0x39cfd5[_0x4353('0x56')];_0x15677b+=0x1){_0x4d47a5[_0x4353('0x52')]({'membername':_0xf74faa[_0x4353('0x3c')],'UserId':_0xf74faa['id'],'queue_name':_0x39cfd5[_0x15677b][_0x4353('0x3c')],'VoiceQueueId':_0x39cfd5[_0x15677b]['id'],'interface':_['isNil'](_0xf74faa[_0x4353('0xa2')])?util['format'](_0x4353('0xb0'),_0xf74faa[_0x4353('0x3c')]):_0xf74faa['interface'],'paused':_0xf74faa[_0x4353('0xa1')]||![],'penalty':_0x4e0e7d[_0x4353('0x64')][_0x4353('0xa9')]||0x0});}return Promise[_0x4353('0x5d')](_0x4d47a5[_0x4353('0x38')](function(_0x4de725){return db[_0x4353('0xb1')][_0x4353('0xb2')](_0x4de725);}));}return _0x24b472;});}})[_0x4353('0x1e')](respondWithStatusCode(_0x56b1da,null))[_0x4353('0x29')](handleError(_0x56b1da,null));};exports[_0x4353('0xb3')]=function(_0x1c5fc4,_0x44e185){var _0x1fb8f9,_0x1e1d7e;return db[_0x4353('0x40')][_0x4353('0x3a')]({'where':{'id':_0x1c5fc4[_0x4353('0x5f')]['id']},'attributes':['id',_0x4353('0x3c'),_0x4353('0x2b')]})[_0x4353('0x1e')](handleEntityNotFound(_0x44e185,null))[_0x4353('0x1e')](function(_0x451747){if(_0x451747){_0x1fb8f9=_0x451747;if(!_0x1c5fc4[_0x4353('0x4c')][_0x4353('0x9e')]||!utils[_0x4353('0xa3')](_0x1c5fc4[_0x4353('0x4c')][_0x4353('0x9e')])){throw new db[(_0x4353('0x92'))][(_0x4353('0x93'))](_0x4353('0xa4'));}return _0x451747['remove'+_[_0x4353('0xab')](_0x1c5fc4['query'][_0x4353('0x9e')][_0x4353('0xa6')]())+_0x4353('0xa7')](_0x1c5fc4[_0x4353('0x4c')]['ids']);}})['then'](function(_0x2c0ba6){if(_[_0x4353('0xb4')](_0x1c5fc4[_0x4353('0x4c')][_0x4353('0xa8')])){for(var _0x4890ab=0x0;_0x4890ab<_0x1c5fc4[_0x4353('0x4c')][_0x4353('0xa8')][_0x4353('0x56')];_0x4890ab+=0x1){_0x1e1d7e={'UserId':Number(_0x1c5fc4['params']['id'])};_0x1e1d7e[_[_0x4353('0xab')](_0x1c5fc4[_0x4353('0x4c')][_0x4353('0x9e')][_0x4353('0xa6')]())+_0x4353('0xac')]=Number(_0x1c5fc4[_0x4353('0x4c')][_0x4353('0xa8')][_0x4890ab]);socket[_0x4353('0xad')](_0x4353('0x32')+_[_0x4353('0xab')](_0x1c5fc4['query']['channel']['toLowerCase']())+_0x4353('0xb5'),_0x1e1d7e);}}else{_0x1e1d7e={'UserId':Number(_0x1c5fc4[_0x4353('0x5f')]['id'])};_0x1e1d7e[_[_0x4353('0xab')](_0x1c5fc4[_0x4353('0x4c')][_0x4353('0x9e')][_0x4353('0xa6')]())+'QueueId']=Number(_0x1c5fc4[_0x4353('0x4c')][_0x4353('0xa8')]);socket['emit'](_0x4353('0x32')+_['capitalize'](_0x1c5fc4[_0x4353('0x4c')][_0x4353('0x9e')]['toLowerCase']())+'Queue:remove',_0x1e1d7e);}return _0x2c0ba6;})[_0x4353('0x1e')](function(){if(_0x1c5fc4[_0x4353('0x4c')][_0x4353('0x9e')]===_0x4353('0xae')){return db[_0x4353('0xb1')][_0x4353('0x2e')]({'where':{'UserId':_0x1c5fc4[_0x4353('0x5f')]['id'],'VoiceQueueId':_0x1c5fc4[_0x4353('0x4c')][_0x4353('0xa8')]},'individualHooks':!![]})[_0x4353('0x1e')](function(){return _0x1fb8f9;});}return _0x1fb8f9;})[_0x4353('0x1e')](respondWithStatusCode(_0x44e185,null))[_0x4353('0x29')](handleError(_0x44e185,null));};exports[_0x4353('0xb6')]=function(_0x3ad925,_0x5d7def){_0x3ad925['body'][_0x4353('0xb7')]=_0x3ad925['file'][_0x4353('0xb8')];return db[_0x4353('0x40')][_0x4353('0x3a')]({'where':{'id':_0x3ad925[_0x4353('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5d7def,null))['then'](saveUpdates(_0x3ad925[_0x4353('0x64')],null))[_0x4353('0x1e')](respondWithResult(_0x5d7def,null))[_0x4353('0x29')](handleError(_0x5d7def,null));};exports[_0x4353('0xb9')]=function(_0x5bfd81,_0xd3c46a){var _0x32289c=path[_0x4353('0xba')](config['root'],_0x4353('0xbb'));return db[_0x4353('0x40')]['find']({'where':{'id':_0x5bfd81['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x4353('0x1e')](handleEntityNotFound(_0xd3c46a,null))['then'](function(_0x4f4b2c){if(_0x4f4b2c){if(_[_0x4353('0x6a')](_0x4f4b2c['userpic'])){return _0xd3c46a[_0x4353('0xbc')](_0x32289c);}else{if(!fs[_0x4353('0xbd')](path[_0x4353('0xba')](config['root'],'server/files/images/',_0x4f4b2c['userpic']))){return _0xd3c46a['download'](_0x32289c);}return _0xd3c46a[_0x4353('0xbc')](path[_0x4353('0xba')](config['root'],_0x4353('0xbe'),_0x4f4b2c[_0x4353('0xb7')]));}}})[_0x4353('0x29')](handleError(_0xd3c46a,null));};exports[_0x4353('0xbf')]=function(_0x1dbf9d,_0x38de1a){return db[_0x4353('0x40')][_0x4353('0x3a')]({'where':{'id':_0x1dbf9d[_0x4353('0x5f')]['id']},'attributes':['id']})[_0x4353('0x1e')](handleEntityNotFound(_0x38de1a,null))[_0x4353('0x1e')](function(_0x1d57bf){var _0x52e065=[];values=_0x1d57bf[_0x4353('0x58')];_0x52e065[_0x4353('0x52')](get_open_tabs(_0x4353('0x57'),_0x1d57bf[_0x4353('0x58')]));_0x52e065[_0x4353('0x52')](get_open_tabs(_0x4353('0x59'),_0x1d57bf[_0x4353('0x58')]));_0x52e065['push'](get_open_tabs('openchannel',_0x1d57bf[_0x4353('0x58')]));_0x52e065['push'](get_open_tabs('whatsapp',_0x1d57bf['dataValues']));_0x52e065['push'](get_open_tabs(_0x4353('0x63'),_0x1d57bf[_0x4353('0x58')]));_0x52e065['push'](get_open_tabs(_0x4353('0x5a'),_0x1d57bf[_0x4353('0x58')]));return Promise[_0x4353('0x5d')](_0x52e065);})[_0x4353('0x1e')](function(_0x31b0ce){if(_0x31b0ce){var _0x479b8b=_[_0x4353('0x38')](values[_0x4353('0xc0')],function(_0x49e1a9){return{'channel':_0x4353('0xc1'),'id':_0x49e1a9['id'],'createdAt':_0x49e1a9[_0x4353('0xc2')]};});var _0x503968=_[_0x4353('0x38')](values['FaxOpenTabs'],function(_0x8a59bb){return{'channel':_0x4353('0xc3'),'id':_0x8a59bb['id'],'createdAt':_0x8a59bb['createdAt']};});var _0x4bd678=_[_0x4353('0x38')](values[_0x4353('0xc4')],function(_0x2d8979){return{'channel':_0x4353('0xc5'),'id':_0x2d8979['id'],'createdAt':_0x2d8979[_0x4353('0xc2')]};});var _0x580164=_[_0x4353('0x38')](values[_0x4353('0xc6')],function(_0x21d118){return{'channel':_0x4353('0xc7'),'id':_0x21d118['id'],'createdAt':_0x21d118[_0x4353('0xc2')]};});var _0x33f5de=_['map'](values[_0x4353('0xc8')],function(_0x537e90){return{'channel':_0x4353('0xc9'),'id':_0x537e90['id'],'createdAt':_0x537e90[_0x4353('0xc2')]};});var _0x2afa8c=_[_0x4353('0x38')](values[_0x4353('0xca')],function(_0x205e35){return{'channel':_0x4353('0xcb'),'id':_0x205e35['id'],'createdAt':_0x205e35[_0x4353('0xc2')]};});var _0xe920a4=_['concat'](_0x479b8b,_0x503968,_0x4bd678,_0x580164,_0x33f5de,_0x2afa8c);var _0x4be477={'count':_0xe920a4[_0x4353('0x56')],'rows':_0xe920a4};return _0x4be477;}else return null;})[_0x4353('0x1e')](respondWithResult(_0x38de1a,null))['catch'](handleError(_0x38de1a,null));};exports['getContacts']=function(_0x12a6e2,_0x1362f6){var _0x576217={};return db[_0x4353('0x40')][_0x4353('0x99')]({'where':{'id':_0x12a6e2[_0x4353('0x5f')]['id']}})['then'](function(_0x294e0b){if(!_0x294e0b){throw new APINotFoundError(util['format'](_0x4353('0xcc'),_0x12a6e2[_0x4353('0x5f')]['id']));}return contacts['describe']();})[_0x4353('0x1e')](function(_0x3b6035){_0x12a6e2['query'][_0x4353('0x40')]=_0x12a6e2[_0x4353('0x5f')]['id'];_0x576217=qs[_0x4353('0x4a')](_0x3b6035,_0x12a6e2);if(_0x12a6e2[_0x4353('0x4c')]['hasOwnProperty'](_0x4353('0x60'))){_0x576217[_0x4353('0x4f')]=[{'model':db[_0x4353('0xcd')],'as':_0x4353('0xce'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x4353('0x3c'),_0x4353('0xcf')],'where':_0x12a6e2[_0x4353('0x4c')][_0x4353('0xd0')]?{'id':_0x12a6e2['query']['tag']}:undefined,'required':_0x12a6e2[_0x4353('0x4c')][_0x4353('0xd0')]?!![]:![]}];}return contacts[_0x4353('0x53')](_0x12a6e2['query'],_0x12a6e2[_0x4353('0x32')],_0x576217,_0x3b6035);})[_0x4353('0x1e')](respondWithFilteredResult(_0x1362f6,_0x576217))['catch'](APIHandleError(_0x1362f6));};exports[_0x4353('0xd1')]=function(_0x3e8645,_0x551802){var _0x359416;var _0x48623c={};var _0x2c10fc;return db[_0x4353('0x40')][_0x4353('0x99')]({'where':{'id':_0x3e8645[_0x4353('0x5f')]['id']},'attributes':['id',_0x4353('0x3c'),'role']})[_0x4353('0x1e')](handleEntityNotFound(_0x551802,null))[_0x4353('0x1e')](function(_0x16ceb7){if(!utils['isValidChannel'](_0x3e8645[_0x4353('0x4c')]['channel'])){throw new db[(_0x4353('0x92'))][(_0x4353('0x93'))](_0x4353('0xa4'));}_0x359416=_0x16ceb7;var _0x2be608={};_0x2be608[_0x4353('0xd2')]=_['keys'](db[_[_0x4353('0xab')](_0x3e8645[_0x4353('0x4c')][_0x4353('0x9e')])+_0x4353('0xd3')][_0x4353('0xd4')]);_0x2be608[_0x4353('0x4c')]=_[_0x4353('0xd5')](_0x3e8645['query']);_0x2be608[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x2be608[_0x4353('0xd2')],_0x2be608['query']);_0x48623c[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x2be608[_0x4353('0xd2')],qs['fields'](_0x3e8645[_0x4353('0x4c')]['fields']));_0x48623c[_0x4353('0x51')]=_0x48623c['attributes'][_0x4353('0x56')]?_0x48623c[_0x4353('0x51')]:_0x2be608[_0x4353('0xd2')];_0x48623c[_0x4353('0xd8')]=qs[_0x4353('0xd9')](_0x3e8645[_0x4353('0x4c')][_0x4353('0xd9')]);_0x48623c[_0x4353('0x4b')]=qs[_0x4353('0xd6')](_[_0x4353('0xda')](_0x3e8645[_0x4353('0x4c')],_0x2be608['filters']));if(_0x3e8645[_0x4353('0x4c')][_0x4353('0x36')]){_0x48623c[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x48623c[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x48623c[_0x4353('0x51')],function(_0xdaddff){var _0x3db7b5={};_0x3db7b5[_0xdaddff]={'$like':'%'+_0x3e8645[_0x4353('0x4c')]['filter']+'%'};return _0x3db7b5;})});}_0x48623c=_[_0x4353('0x61')]({},_0x48623c,_0x3e8645[_0x4353('0x62')]);switch(_0x359416[_0x4353('0x2b')]){case _0x4353('0x30'):return db[_['capitalize'](_0x3e8645['query'][_0x4353('0x9e')])+_0x4353('0xd3')][_0x4353('0x53')](_0x48623c);case _0x4353('0x32'):case _0x4353('0x2c'):return _0x359416[_0x4353('0x2f')+_['capitalize'](_0x3e8645['query'][_0x4353('0x9e')])+_0x4353('0xa7')](_0x48623c);default:throw new db[(_0x4353('0x92'))][(_0x4353('0x93'))](_0x4353('0xdb'));}})[_0x4353('0x1e')](function(_0x27dba7){_0x2c10fc=_0x27dba7[_0x4353('0x56')];if(!_0x3e8645[_0x4353('0x4c')][_0x4353('0xdc')](_0x4353('0xdd'))){_0x48623c[_0x4353('0x19')]=qs[_0x4353('0x19')](_0x3e8645[_0x4353('0x4c')][_0x4353('0x19')]);_0x48623c[_0x4353('0x18')]=qs[_0x4353('0x18')](_0x3e8645[_0x4353('0x4c')][_0x4353('0x18')]);}switch(_0x359416['role']){case _0x4353('0x30'):return db[_[_0x4353('0xab')](_0x3e8645['query'][_0x4353('0x9e')])+_0x4353('0xd3')][_0x4353('0x53')](_0x48623c);case _0x4353('0x32'):case _0x4353('0x2c'):return _0x359416[_0x4353('0x2f')+_[_0x4353('0xab')](_0x3e8645[_0x4353('0x4c')][_0x4353('0x9e')])+'Queues'](_0x48623c);}})[_0x4353('0x1e')](function(_0x325ffa){return{'count':_0x2c10fc,'rows':_0x325ffa};})[_0x4353('0x1e')](respondWithResult(_0x551802,null))[_0x4353('0x29')](handleError(_0x551802,null));};exports[_0x4353('0xde')]=function(_0x4616a2,_0x40f642){var _0x391e14={};var _0x3fcfb0={};var _0x3b139b;var _0x4d6b6d;return db[_0x4353('0x40')][_0x4353('0x99')]({'where':{'id':_0x4616a2[_0x4353('0x5f')]['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x40f642,null))[_0x4353('0x1e')](function(_0x19900b){if(_0x19900b){_0x3b139b=_0x19900b;_0x3fcfb0[_0x4353('0xd2')]=_[_0x4353('0xd5')](db[_0x4353('0xb1')][_0x4353('0xd4')]);_0x3fcfb0[_0x4353('0x4c')]=_[_0x4353('0xd5')](_0x4616a2[_0x4353('0x4c')]);_0x3fcfb0[_0x4353('0xd6')]=_['intersection'](_0x3fcfb0['model'],_0x3fcfb0[_0x4353('0x4c')]);_0x391e14[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x3fcfb0[_0x4353('0xd2')],qs[_0x4353('0xdf')](_0x4616a2[_0x4353('0x4c')][_0x4353('0xdf')]));_0x391e14[_0x4353('0x51')]=_0x391e14[_0x4353('0x51')][_0x4353('0x56')]?_0x391e14[_0x4353('0x51')]:_0x3fcfb0[_0x4353('0xd2')];_0x391e14[_0x4353('0xd8')]=qs[_0x4353('0xd9')](_0x4616a2[_0x4353('0x4c')][_0x4353('0xd9')]);_0x391e14[_0x4353('0x4b')]=qs['filters'](_[_0x4353('0xda')](_0x4616a2['query'],_0x3fcfb0[_0x4353('0xd6')]));if(_0x4616a2[_0x4353('0x4c')][_0x4353('0x36')]){_0x391e14['where']=_['merge'](_0x391e14[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x391e14['attributes'],function(_0x54d06c){var _0x522383={};_0x522383[_0x54d06c]={'$like':'%'+_0x4616a2[_0x4353('0x4c')][_0x4353('0x36')]+'%'};return _0x522383;})});}_0x391e14=_[_0x4353('0x61')]({},_0x391e14,_0x4616a2['options']);return _0x3b139b['getVoiceQueuesRt'](_0x391e14);}})[_0x4353('0x1e')](function(_0x360777){if(_0x360777){_0x4d6b6d=_0x360777[_0x4353('0x56')];if(!_0x4616a2['query'][_0x4353('0xdc')](_0x4353('0xdd'))){_0x391e14[_0x4353('0x19')]=qs['limit'](_0x4616a2[_0x4353('0x4c')][_0x4353('0x19')]);_0x391e14[_0x4353('0x18')]=qs[_0x4353('0x18')](_0x4616a2[_0x4353('0x4c')][_0x4353('0x18')]);}return _0x3b139b['getVoiceQueuesRt'](_0x391e14);}})['then'](function(_0x4b1f3c){if(_0x4b1f3c){return _0x4b1f3c?{'count':_0x4d6b6d,'rows':_0x4b1f3c}:null;}})['then'](respondWithResult(_0x40f642,null))[_0x4353('0x29')](handleError(_0x40f642,null));};exports[_0x4353('0xe0')]=function(_0x1d9900,_0x25962a){var _0x3e5bd0={};var _0x457337={};var _0x246f53;var _0x43b655;return db[_0x4353('0x40')][_0x4353('0x99')]({'where':{'id':_0x1d9900['params']['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x25962a,null))[_0x4353('0x1e')](function(_0x17886d){if(_0x17886d){_0x246f53=_0x17886d;_0x457337['model']=_[_0x4353('0xd5')](db[_0x4353('0xe1')][_0x4353('0xd4')]);_0x457337[_0x4353('0x4c')]=_[_0x4353('0xd5')](_0x1d9900[_0x4353('0x4c')]);_0x457337[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x457337[_0x4353('0xd2')],_0x457337[_0x4353('0x4c')]);_0x3e5bd0['attributes']=_['intersection'](_0x457337['model'],qs[_0x4353('0xdf')](_0x1d9900[_0x4353('0x4c')][_0x4353('0xdf')]));_0x3e5bd0[_0x4353('0x51')]=_0x3e5bd0[_0x4353('0x51')][_0x4353('0x56')]?_0x3e5bd0[_0x4353('0x51')]:_0x457337[_0x4353('0xd2')];_0x3e5bd0[_0x4353('0xd8')]=qs['sort'](_0x1d9900['query'][_0x4353('0xd9')]);_0x3e5bd0[_0x4353('0x4b')]=qs[_0x4353('0xd6')](_[_0x4353('0xda')](_0x1d9900[_0x4353('0x4c')],_0x457337['filters']));if(_0x1d9900[_0x4353('0x4c')][_0x4353('0x36')]){_0x3e5bd0[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x3e5bd0[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x3e5bd0[_0x4353('0x51')],function(_0x1a4edf){var _0x4a1026={};_0x4a1026[_0x1a4edf]={'$like':'%'+_0x1d9900['query'][_0x4353('0x36')]+'%'};return _0x4a1026;})});}_0x3e5bd0=_[_0x4353('0x61')]({},_0x3e5bd0,_0x1d9900[_0x4353('0x62')]);return _0x246f53[_0x4353('0xe0')](_0x3e5bd0);}})[_0x4353('0x1e')](function(_0x423ca5){if(_0x423ca5){_0x43b655=_0x423ca5[_0x4353('0x56')];if(!_0x1d9900['query'][_0x4353('0xdc')]('nolimit')){_0x3e5bd0[_0x4353('0x19')]=qs[_0x4353('0x19')](_0x1d9900[_0x4353('0x4c')][_0x4353('0x19')]);_0x3e5bd0[_0x4353('0x18')]=qs[_0x4353('0x18')](_0x1d9900[_0x4353('0x4c')]['offset']);}return _0x246f53[_0x4353('0xe0')](_0x3e5bd0);}})['then'](function(_0x156802){if(_0x156802){return _0x156802?{'count':_0x43b655,'rows':_0x156802}:null;}})['then'](respondWithResult(_0x25962a,null))[_0x4353('0x29')](handleError(_0x25962a,null));};exports[_0x4353('0xe2')]=function(_0xbc36b1,_0x20c4fd){var _0x56241a={'raw':!![],'where':{}};var _0x51dfd9={};var _0x3ecf6d={'count':0x0,'rows':[]};return db[_0x4353('0x40')][_0x4353('0x99')]({'where':{'id':_0xbc36b1[_0x4353('0x5f')]['id']}})['then'](handleEntityNotFound(_0x20c4fd,null))['then'](function(_0x547555){if(_0x547555){_0x51dfd9[_0x4353('0xd2')]=_[_0x4353('0xd5')](db[_0x4353('0xe3')][_0x4353('0xd4')]);_0x51dfd9[_0x4353('0x4c')]=_[_0x4353('0xd5')](_0xbc36b1[_0x4353('0x4c')]);_0x51dfd9[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x51dfd9['model'],_0x51dfd9[_0x4353('0x4c')]);_0x56241a[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x51dfd9['model'],qs[_0x4353('0xdf')](_0xbc36b1[_0x4353('0x4c')][_0x4353('0xdf')]));_0x56241a[_0x4353('0x51')]=_0x56241a[_0x4353('0x51')][_0x4353('0x56')]?_0x56241a['attributes']:_0x51dfd9['model'];if(!_0xbc36b1[_0x4353('0x4c')][_0x4353('0xdc')](_0x4353('0xdd'))){_0x56241a[_0x4353('0x19')]=qs[_0x4353('0x19')](_0xbc36b1['query'][_0x4353('0x19')]);_0x56241a[_0x4353('0x18')]=qs['offset'](_0xbc36b1[_0x4353('0x4c')][_0x4353('0x18')]);}_0x56241a['order']=qs[_0x4353('0xd9')](_0xbc36b1[_0x4353('0x4c')]['sort']);_0x56241a['where']=qs[_0x4353('0xd6')](_[_0x4353('0xda')](_0xbc36b1[_0x4353('0x4c')],_0x51dfd9[_0x4353('0xd6')]));_0x56241a[_0x4353('0x4b')][_0x4353('0xe4')]=_0x547555['id'];if(_0xbc36b1['query']['filter']){_0x56241a[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x56241a[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x56241a[_0x4353('0x51')],function(_0x1a9796){var _0x2d0ae7={};_0x2d0ae7[_0x1a9796]={'$like':'%'+_0xbc36b1[_0x4353('0x4c')][_0x4353('0x36')]+'%'};return _0x2d0ae7;})});}_0x56241a=_[_0x4353('0x61')]({},_0x56241a,_0xbc36b1[_0x4353('0x62')]);return db['VoiceRecording'][_0x4353('0x1b')]({'where':_0x56241a[_0x4353('0x4b')]})[_0x4353('0x1e')](function(_0x1c1b0e){_0x3ecf6d['count']=_0x1c1b0e;if(_0xbc36b1['query']['includeAll']){_0x56241a[_0x4353('0x4f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x4353('0x53')](_0x56241a);})['then'](function(_0x3ef9c6){_0x3ecf6d['rows']=_0x3ef9c6;return _0x3ecf6d;});}})[_0x4353('0x1e')](respondWithFilteredResult(_0x20c4fd,_0x56241a))[_0x4353('0x29')](handleError(_0x20c4fd,null));};exports[_0x4353('0xe5')]=function(_0xc9aabc,_0x51f8b9){var _0x4870cf={'raw':!![],'where':{}};var _0x2be4ec={};var _0x31dc40={'count':0x0,'rows':[]};return db[_0x4353('0x40')]['findOne']({'where':{'id':_0xc9aabc[_0x4353('0x5f')]['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x51f8b9,null))['then'](function(_0x3577f7){if(_0x3577f7){_0x2be4ec[_0x4353('0xd2')]=_[_0x4353('0xd5')](db['ScreenRecording'][_0x4353('0xd4')]);_0x2be4ec[_0x4353('0x4c')]=_[_0x4353('0xd5')](_0xc9aabc['query']);_0x2be4ec[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x2be4ec[_0x4353('0xd2')],_0x2be4ec[_0x4353('0x4c')]);_0x4870cf[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x2be4ec[_0x4353('0xd2')],qs[_0x4353('0xdf')](_0xc9aabc[_0x4353('0x4c')][_0x4353('0xdf')]));_0x4870cf[_0x4353('0x51')]=_0x4870cf[_0x4353('0x51')][_0x4353('0x56')]?_0x4870cf[_0x4353('0x51')]:_0x2be4ec[_0x4353('0xd2')];if(!_0xc9aabc[_0x4353('0x4c')]['hasOwnProperty'](_0x4353('0xdd'))){_0x4870cf[_0x4353('0x19')]=qs[_0x4353('0x19')](_0xc9aabc[_0x4353('0x4c')][_0x4353('0x19')]);_0x4870cf[_0x4353('0x18')]=qs[_0x4353('0x18')](_0xc9aabc[_0x4353('0x4c')][_0x4353('0x18')]);}_0x4870cf['order']=qs[_0x4353('0xd9')](_0xc9aabc['query'][_0x4353('0xd9')]);_0x4870cf[_0x4353('0x4b')]=qs[_0x4353('0xd6')](_[_0x4353('0xda')](_0xc9aabc[_0x4353('0x4c')],_0x2be4ec[_0x4353('0xd6')]));_0x4870cf[_0x4353('0x4b')]['UserId']=_0x3577f7['id'];if(_0xc9aabc[_0x4353('0x4c')][_0x4353('0x36')]){_0x4870cf[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x4870cf['where'],{'$or':_[_0x4353('0x38')](_0x4870cf[_0x4353('0x51')],function(_0x2c2471){var _0x17f02b={};_0x17f02b[_0x2c2471]={'$like':'%'+_0xc9aabc['query'][_0x4353('0x36')]+'%'};return _0x17f02b;})});}_0x4870cf=_[_0x4353('0x61')]({},_0x4870cf,_0xc9aabc[_0x4353('0x62')]);return db['ScreenRecording']['count']({'where':_0x4870cf['where']})[_0x4353('0x1e')](function(_0x358041){_0x31dc40['count']=_0x358041;if(_0xc9aabc[_0x4353('0x4c')][_0x4353('0x60')]){_0x4870cf[_0x4353('0x4f')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4353('0x53')](_0x4870cf);})[_0x4353('0x1e')](function(_0x136812){_0x31dc40[_0x4353('0x54')]=_0x136812;return _0x31dc40;});}})[_0x4353('0x1e')](respondWithFilteredResult(_0x51f8b9,_0x4870cf))[_0x4353('0x29')](handleError(_0x51f8b9,null));};exports[_0x4353('0xe6')]=function(_0x5bf48b,_0x53c605){var _0x5419e9={};var _0x1368a4={};var _0x1b8272;var _0x378a2c;return db[_0x4353('0x40')][_0x4353('0x99')]({'where':{'id':_0x5bf48b[_0x4353('0x5f')]['id']}})['then'](handleEntityNotFound(_0x53c605,null))[_0x4353('0x1e')](function(_0x5887cf){if(_0x5887cf){_0x1b8272=_0x5887cf;_0x1368a4['model']=_[_0x4353('0xd5')](db[_0x4353('0xe7')][_0x4353('0xd4')]);_0x1368a4[_0x4353('0x4c')]=_['keys'](_0x5bf48b[_0x4353('0x4c')]);_0x1368a4[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x1368a4[_0x4353('0xd2')],_0x1368a4[_0x4353('0x4c')]);_0x5419e9[_0x4353('0x51')]=_['intersection'](_0x1368a4[_0x4353('0xd2')],qs['fields'](_0x5bf48b[_0x4353('0x4c')][_0x4353('0xdf')]));_0x5419e9[_0x4353('0x51')]=_0x5419e9[_0x4353('0x51')]['length']?_0x5419e9[_0x4353('0x51')]:_0x1368a4['model'];_0x5419e9['order']=qs[_0x4353('0xd9')](_0x5bf48b[_0x4353('0x4c')][_0x4353('0xd9')]);_0x5419e9[_0x4353('0x4b')]=qs['filters'](_[_0x4353('0xda')](_0x5bf48b[_0x4353('0x4c')],_0x1368a4[_0x4353('0xd6')]));if(_0x5bf48b[_0x4353('0x4c')]['filter']){_0x5419e9['where']=_[_0x4353('0x61')](_0x5419e9[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x5419e9[_0x4353('0x51')],function(_0x1d1fce){var _0x1f126c={};_0x1f126c[_0x1d1fce]={'$like':'%'+_0x5bf48b['query'][_0x4353('0x36')]+'%'};return _0x1f126c;})});}_0x5419e9=_[_0x4353('0x61')]({},_0x5419e9,_0x5bf48b[_0x4353('0x62')]);return _0x1b8272[_0x4353('0xe6')](_0x5419e9);}})[_0x4353('0x1e')](function(_0x1831e1){if(_0x1831e1){_0x378a2c=_0x1831e1[_0x4353('0x56')];if(!_0x5bf48b[_0x4353('0x4c')][_0x4353('0xdc')](_0x4353('0xdd'))){_0x5419e9[_0x4353('0x19')]=qs[_0x4353('0x19')](_0x5bf48b[_0x4353('0x4c')][_0x4353('0x19')]);_0x5419e9['offset']=qs[_0x4353('0x18')](_0x5bf48b[_0x4353('0x4c')][_0x4353('0x18')]);}return _0x1b8272[_0x4353('0xe6')](_0x5419e9);}})['then'](function(_0x4e9f9e){if(_0x4e9f9e){return _0x4e9f9e?{'count':_0x378a2c,'rows':_0x4e9f9e}:null;}})['then'](respondWithResult(_0x53c605,null))[_0x4353('0x29')](handleError(_0x53c605,null));};exports[_0x4353('0xe8')]=function(_0x319931,_0x1ad1f2){var _0x2cd418={};var _0x49ca45={};var _0x11f5c5;var _0x418305;return db[_0x4353('0x40')]['findOne']({'where':{'id':_0x319931[_0x4353('0x5f')]['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x1ad1f2,null))[_0x4353('0x1e')](function(_0x5e6eeb){if(_0x5e6eeb){_0x11f5c5=_0x5e6eeb;_0x49ca45[_0x4353('0xd2')]=_['keys'](db['OpenchannelInteraction'][_0x4353('0xd4')]);_0x49ca45[_0x4353('0x4c')]=_['keys'](_0x319931[_0x4353('0x4c')]);_0x49ca45[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x49ca45[_0x4353('0xd2')],_0x49ca45[_0x4353('0x4c')]);_0x2cd418[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x49ca45['model'],qs[_0x4353('0xdf')](_0x319931[_0x4353('0x4c')][_0x4353('0xdf')]));_0x2cd418[_0x4353('0x51')]=_0x2cd418[_0x4353('0x51')]['length']?_0x2cd418[_0x4353('0x51')]:_0x49ca45[_0x4353('0xd2')];_0x2cd418[_0x4353('0xd8')]=qs[_0x4353('0xd9')](_0x319931[_0x4353('0x4c')][_0x4353('0xd9')]);_0x2cd418['where']=qs[_0x4353('0xd6')](_[_0x4353('0xda')](_0x319931[_0x4353('0x4c')],_0x49ca45[_0x4353('0xd6')]));if(_0x319931[_0x4353('0x4c')][_0x4353('0x36')]){_0x2cd418[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x2cd418['where'],{'$or':_[_0x4353('0x38')](_0x2cd418['attributes'],function(_0x4b7bac){var _0x368ded={};_0x368ded[_0x4b7bac]={'$like':'%'+_0x319931['query'][_0x4353('0x36')]+'%'};return _0x368ded;})});}_0x2cd418=_[_0x4353('0x61')]({},_0x2cd418,_0x319931[_0x4353('0x62')]);return _0x11f5c5[_0x4353('0xe8')](_0x2cd418);}})['then'](function(_0x48e9c5){if(_0x48e9c5){_0x418305=_0x48e9c5['length'];if(!_0x319931[_0x4353('0x4c')][_0x4353('0xdc')](_0x4353('0xdd'))){_0x2cd418[_0x4353('0x19')]=qs[_0x4353('0x19')](_0x319931[_0x4353('0x4c')]['limit']);_0x2cd418[_0x4353('0x18')]=qs[_0x4353('0x18')](_0x319931[_0x4353('0x4c')][_0x4353('0x18')]);}return _0x11f5c5[_0x4353('0xe8')](_0x2cd418);}})[_0x4353('0x1e')](function(_0x3c7aba){if(_0x3c7aba){return _0x3c7aba?{'count':_0x418305,'rows':_0x3c7aba}:null;}})['then'](respondWithResult(_0x1ad1f2,null))[_0x4353('0x29')](handleError(_0x1ad1f2,null));};exports['getMailInteractions']=function(_0x56357b,_0x33c7a){var _0xf088e1={'raw':!![],'where':{}};var _0x53c687={};var _0x1b6cc7={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x56357b[_0x4353('0x5f')]['id']}})['then'](handleEntityNotFound(_0x33c7a,null))[_0x4353('0x1e')](function(_0x5d04cf){if(_0x5d04cf){_0x53c687[_0x4353('0xd2')]=_[_0x4353('0xd5')](db[_0x4353('0xe9')][_0x4353('0xd4')]);_0x53c687[_0x4353('0x4c')]=_['keys'](_0x56357b['query']);_0x53c687[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x53c687[_0x4353('0xd2')],_0x53c687[_0x4353('0x4c')]);_0xf088e1['attributes']=_[_0x4353('0xd7')](_0x53c687[_0x4353('0xd2')],qs[_0x4353('0xdf')](_0x56357b[_0x4353('0x4c')][_0x4353('0xdf')]));_0xf088e1['attributes']=_0xf088e1[_0x4353('0x51')]['length']?_0xf088e1[_0x4353('0x51')]:_0x53c687[_0x4353('0xd2')];if(!_0x56357b[_0x4353('0x4c')][_0x4353('0xdc')](_0x4353('0xdd'))){_0xf088e1[_0x4353('0x19')]=qs[_0x4353('0x19')](_0x56357b[_0x4353('0x4c')][_0x4353('0x19')]);_0xf088e1[_0x4353('0x18')]=qs[_0x4353('0x18')](_0x56357b['query']['offset']);}_0xf088e1[_0x4353('0xd8')]=qs[_0x4353('0xd9')](_0x56357b[_0x4353('0x4c')][_0x4353('0xd9')]);_0xf088e1[_0x4353('0x4b')]=qs['filters'](_[_0x4353('0xda')](_0x56357b['query'],_0x53c687[_0x4353('0xd6')]));_0xf088e1[_0x4353('0x4b')]['UserId']=_0x5d04cf['id'];if(_0x56357b['query']['filter']){_0xf088e1[_0x4353('0x4b')]=_['merge'](_0xf088e1[_0x4353('0x4b')],{'$or':_['map'](_0xf088e1[_0x4353('0x51')],function(_0x3fd156){var _0x45abcd={};_0x45abcd[_0x3fd156]={'$like':'%'+_0x56357b[_0x4353('0x4c')]['filter']+'%'};return _0x45abcd;})});}_0xf088e1=_[_0x4353('0x61')]({},_0xf088e1,_0x56357b['options']);return db['MailInteraction']['count']({'where':_0xf088e1['where']})['then'](function(_0x14b79b){_0x1b6cc7[_0x4353('0x1b')]=_0x14b79b;if(_0x56357b['query']['includeAll']){_0xf088e1[_0x4353('0x4f')]=[{'all':!![]}];}return db[_0x4353('0xe9')]['findAll'](_0xf088e1);})['then'](function(_0x3b7753){_0x1b6cc7['rows']=_0x3b7753;return _0x1b6cc7;});}})[_0x4353('0x1e')](respondWithFilteredResult(_0x33c7a,_0xf088e1))[_0x4353('0x29')](handleError(_0x33c7a,null));};exports[_0x4353('0xea')]=function(_0x51d74f,_0x525080){var _0x507a80={};var _0x56e0f3={};var _0x23878a;var _0x50d864;return db['User'][_0x4353('0x99')]({'where':{'id':_0x51d74f[_0x4353('0x5f')]['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x525080,null))['then'](function(_0x5bf38b){if(_0x5bf38b){_0x23878a=_0x5bf38b;_0x56e0f3[_0x4353('0xd2')]=_['keys'](db[_0x4353('0xeb')][_0x4353('0xd4')]);_0x56e0f3[_0x4353('0x4c')]=_['keys'](_0x51d74f[_0x4353('0x4c')]);_0x56e0f3[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x56e0f3[_0x4353('0xd2')],_0x56e0f3[_0x4353('0x4c')]);_0x507a80[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x56e0f3[_0x4353('0xd2')],qs['fields'](_0x51d74f[_0x4353('0x4c')][_0x4353('0xdf')]));_0x507a80[_0x4353('0x51')]=_0x507a80[_0x4353('0x51')]['length']?_0x507a80[_0x4353('0x51')]:_0x56e0f3[_0x4353('0xd2')];_0x507a80['order']=qs[_0x4353('0xd9')](_0x51d74f[_0x4353('0x4c')][_0x4353('0xd9')]);_0x507a80[_0x4353('0x4b')]=qs[_0x4353('0xd6')](_[_0x4353('0xda')](_0x51d74f['query'],_0x56e0f3['filters']));if(_0x51d74f[_0x4353('0x4c')][_0x4353('0x36')]){_0x507a80[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x507a80[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x507a80['attributes'],function(_0x2b7ede){var _0x2c3607={};_0x2c3607[_0x2b7ede]={'$like':'%'+_0x51d74f[_0x4353('0x4c')][_0x4353('0x36')]+'%'};return _0x2c3607;})});}_0x507a80=_['merge']({},_0x507a80,_0x51d74f[_0x4353('0x62')]);return _0x23878a[_0x4353('0xea')](_0x507a80);}})[_0x4353('0x1e')](function(_0x54c91b){if(_0x54c91b){_0x50d864=_0x54c91b[_0x4353('0x56')];if(!_0x51d74f['query']['hasOwnProperty'](_0x4353('0xdd'))){_0x507a80[_0x4353('0x19')]=qs[_0x4353('0x19')](_0x51d74f[_0x4353('0x4c')]['limit']);_0x507a80[_0x4353('0x18')]=qs[_0x4353('0x18')](_0x51d74f[_0x4353('0x4c')][_0x4353('0x18')]);}return _0x23878a[_0x4353('0xea')](_0x507a80);}})['then'](function(_0x151479){if(_0x151479){return _0x151479?{'count':_0x50d864,'rows':_0x151479}:null;}})[_0x4353('0x1e')](respondWithResult(_0x525080,null))[_0x4353('0x29')](handleError(_0x525080,null));};exports[_0x4353('0xec')]=function(_0x33ab40,_0x15295c){var _0x5d6fae={};var _0x1a57fd={};var _0x4af2a3;var _0x40a781;return db['User'][_0x4353('0x99')]({'where':{'id':_0x33ab40[_0x4353('0x5f')]['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x15295c,null))[_0x4353('0x1e')](function(_0x3e4155){if(_0x3e4155){_0x4af2a3=_0x3e4155;_0x1a57fd[_0x4353('0xd2')]=_[_0x4353('0xd5')](db['FaxInteraction'][_0x4353('0xd4')]);_0x1a57fd[_0x4353('0x4c')]=_['keys'](_0x33ab40[_0x4353('0x4c')]);_0x1a57fd['filters']=_[_0x4353('0xd7')](_0x1a57fd['model'],_0x1a57fd[_0x4353('0x4c')]);_0x5d6fae[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x1a57fd[_0x4353('0xd2')],qs[_0x4353('0xdf')](_0x33ab40['query'][_0x4353('0xdf')]));_0x5d6fae[_0x4353('0x51')]=_0x5d6fae['attributes']['length']?_0x5d6fae[_0x4353('0x51')]:_0x1a57fd[_0x4353('0xd2')];_0x5d6fae[_0x4353('0xd8')]=qs[_0x4353('0xd9')](_0x33ab40['query']['sort']);_0x5d6fae[_0x4353('0x4b')]=qs['filters'](_['pick'](_0x33ab40[_0x4353('0x4c')],_0x1a57fd['filters']));if(_0x33ab40[_0x4353('0x4c')][_0x4353('0x36')]){_0x5d6fae[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x5d6fae[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x5d6fae[_0x4353('0x51')],function(_0x3b6673){var _0x250e39={};_0x250e39[_0x3b6673]={'$like':'%'+_0x33ab40['query'][_0x4353('0x36')]+'%'};return _0x250e39;})});}_0x5d6fae=_[_0x4353('0x61')]({},_0x5d6fae,_0x33ab40[_0x4353('0x62')]);return _0x4af2a3[_0x4353('0xec')](_0x5d6fae);}})[_0x4353('0x1e')](function(_0x2d3bb4){if(_0x2d3bb4){_0x40a781=_0x2d3bb4[_0x4353('0x56')];if(!_0x33ab40[_0x4353('0x4c')][_0x4353('0xdc')](_0x4353('0xdd'))){_0x5d6fae[_0x4353('0x19')]=qs[_0x4353('0x19')](_0x33ab40[_0x4353('0x4c')][_0x4353('0x19')]);_0x5d6fae[_0x4353('0x18')]=qs['offset'](_0x33ab40[_0x4353('0x4c')][_0x4353('0x18')]);}return _0x4af2a3[_0x4353('0xec')](_0x5d6fae);}})[_0x4353('0x1e')](function(_0xa1adc9){if(_0xa1adc9){return _0xa1adc9?{'count':_0x40a781,'rows':_0xa1adc9}:null;}})[_0x4353('0x1e')](respondWithResult(_0x15295c,null))['catch'](handleError(_0x15295c,null));};exports[_0x4353('0xed')]=function(_0x22a5e7,_0xb71323){var _0x1b628e={};var _0x4e331e={};var _0x1b4749;var _0x164b36;return db['User'][_0x4353('0x99')]({'where':{'id':_0x22a5e7[_0x4353('0x5f')]['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0xb71323,null))['then'](function(_0x42295f){if(_0x42295f){_0x1b4749=_0x42295f;_0x4e331e[_0x4353('0xd2')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x4e331e[_0x4353('0x4c')]=_['keys'](_0x22a5e7[_0x4353('0x4c')]);_0x4e331e[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x4e331e[_0x4353('0xd2')],_0x4e331e[_0x4353('0x4c')]);_0x1b628e[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x4e331e[_0x4353('0xd2')],qs['fields'](_0x22a5e7[_0x4353('0x4c')][_0x4353('0xdf')]));_0x1b628e['attributes']=_0x1b628e['attributes'][_0x4353('0x56')]?_0x1b628e[_0x4353('0x51')]:_0x4e331e['model'];_0x1b628e['order']=qs[_0x4353('0xd9')](_0x22a5e7['query']['sort']);_0x1b628e[_0x4353('0x4b')]=qs[_0x4353('0xd6')](_['pick'](_0x22a5e7['query'],_0x4e331e[_0x4353('0xd6')]));if(_0x22a5e7[_0x4353('0x4c')][_0x4353('0x36')]){_0x1b628e[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x1b628e['where'],{'$or':_['map'](_0x1b628e['attributes'],function(_0x372fa9){var _0x429de5={};_0x429de5[_0x372fa9]={'$like':'%'+_0x22a5e7[_0x4353('0x4c')][_0x4353('0x36')]+'%'};return _0x429de5;})});}_0x1b628e=_[_0x4353('0x61')]({},_0x1b628e,_0x22a5e7[_0x4353('0x62')]);return _0x1b4749[_0x4353('0xed')](_0x1b628e);}})[_0x4353('0x1e')](function(_0x23cc15){if(_0x23cc15){_0x164b36=_0x23cc15[_0x4353('0x56')];if(!_0x22a5e7[_0x4353('0x4c')][_0x4353('0xdc')](_0x4353('0xdd'))){_0x1b628e[_0x4353('0x19')]=qs['limit'](_0x22a5e7['query'][_0x4353('0x19')]);_0x1b628e[_0x4353('0x18')]=qs[_0x4353('0x18')](_0x22a5e7[_0x4353('0x4c')][_0x4353('0x18')]);}return _0x1b4749[_0x4353('0xed')](_0x1b628e);}})[_0x4353('0x1e')](function(_0x2ed63f){if(_0x2ed63f){return _0x2ed63f?{'count':_0x164b36,'rows':_0x2ed63f}:null;}})[_0x4353('0x1e')](respondWithResult(_0xb71323,null))[_0x4353('0x29')](handleError(_0xb71323,null));};exports[_0x4353('0xee')]=function(_0x240d17,_0x1f5d8f,_0x5dedcf){var _0x533b9d;var _0x51aec7;var _0x11ac10;var _0x1ecb0b=!_[_0x4353('0x6a')](_0x240d17[_0x4353('0x5f')]['id'])?_0x240d17[_0x4353('0x5f')]['id']:!_[_0x4353('0x6a')](_0x240d17[_0x4353('0x32')]['id'])?_0x240d17[_0x4353('0x32')]['id']:null;return db[_0x4353('0x40')][_0x4353('0x3a')]({'where':{'id':_0x1ecb0b,'role':{'$or':[_0x4353('0x30'),_0x4353('0x32'),_0x4353('0x2c')]}},'attributes':['id',_0x4353('0x3c'),_0x4353('0xef'),_0x4353('0xf0'),_0x4353('0x2b'),_0x4353('0x6b'),_0x4353('0xa0')]})['then'](function(_0x1f7a84){if(_0x1f7a84){if(_0x1f7a84[_0x4353('0x2b')]==='agent'){_0x533b9d=_0x1f7a84;if(_0x240d17['body']['interface']){_0x11ac10=util[_0x4353('0xf1')](_0x4353('0xf2'),_0x533b9d[_0x240d17[_0x4353('0x64')][_0x4353('0xa2')]]);}else if(_0x240d17['body'][_0x4353('0xf3')]){_0x11ac10=util[_0x4353('0xf1')](_0x4353('0xb0'),_0x240d17[_0x4353('0x64')][_0x4353('0xf3')]);}else{_0x11ac10=util['format']('SIP/%s',_0x533b9d['name']);}socket['to'](util[_0x4353('0xf1')]('user:%s',_0x533b9d[_0x4353('0x3c')]))[_0x4353('0xad')](_0x4353('0xf4'),{'user':{'id':_0x533b9d['id'],'name':_0x533b9d[_0x4353('0x3c')]},'ip':_0x240d17['headers'][_0x4353('0xf5')]||_0x240d17[_0x4353('0xf6')][_0x4353('0xf7')]||_0x240d17[_0x4353('0xf8')][_0x4353('0xf7')]||_0x240d17['connection'][_0x4353('0xf8')]['remoteAddress']});return db[_0x4353('0xb1')][_0x4353('0x2e')]({'where':{'membername':_0x533b9d[_0x4353('0x3c')]},'individualHooks':!![]});}}else{throw new db[(_0x4353('0x92'))][(_0x4353('0x93'))](_0x4353('0xf9'));}})[_0x4353('0x1e')](function(){if(_0x533b9d){return _0x533b9d['getVoiceQueues']({'raw':!![]});}})[_0x4353('0x1e')](function(_0x384164){if(_0x533b9d){if(_0x384164){_0x51aec7=_0x384164;if(_0x51aec7['length']){var _0x357ca6=_0x51aec7['map'](function(_0x80b577){var _0x14a0c5={'membername':_0x533b9d[_0x4353('0x3c')],'UserId':_0x533b9d['id'],'queue_name':_0x80b577[_0x4353('0x3c')],'VoiceQueueId':_0x80b577['id'],'interface':_0x11ac10,'paused':_0x533b9d[_0x4353('0xa0')]||![],'penalty':_0x80b577[_0x4353('0xfa')]||0x0};return db['UserVoiceQueueRt'][_0x4353('0xb2')](_0x14a0c5);});return Promise[_0x4353('0x5d')](_0x357ca6);}}}})[_0x4353('0x1e')](function(){if(_0x533b9d){return db[_0x4353('0xfb')][_0x4353('0x53')]({'where':{'membername':_0x533b9d['name'],'exitAt':null}});}})[_0x4353('0x1e')](function(_0x5d770c){if(_0x533b9d){var _0x3dbe40=[];_0x5d770c[_0x4353('0xfc')](function(_0x504a30){_0x3dbe40[_0x4353('0x52')](_0x504a30['update']({'exitAt':moment()[_0x4353('0xf1')](_0x4353('0xfd'))}));});return Promise['all'](_0x3dbe40);}})[_0x4353('0x1e')](function(){if(_0x533b9d){var _0xaccc4=[];var _0x1f129a=[];var _0x47e6e3=utils['getChannels']();var _0x5e9873={'membername':_0x533b9d[_0x4353('0x3c')],'interface':_0x11ac10,'enterAt':moment()['format'](_0x4353('0xfd')),'role':_0x533b9d[_0x4353('0x2b')],'internal':_0x533b9d[_0x4353('0x6b')]};_0x47e6e3[_0x4353('0xfc')](function(_0x3ba811){_0xaccc4['push'](_[_0x4353('0x61')]({'channel':_0x3ba811,'type':_0x4353('0xfe'),'data1':_0x240d17[_0x4353('0x64')][_0x4353('0xff')],'data2':_0x11ac10},_0x5e9873));if(_0x533b9d[_0x4353('0xa0')]){_0x1f129a['push'](_['merge']({'channel':_0x3ba811,'type':_0x4353('0x100'),'data1':_0x4353('0x101')},_0x5e9873));}});return db[_0x4353('0xfb')][_0x4353('0x89')](_0xaccc4[_0x4353('0x102')](_0x1f129a),{'individualHooks':!![]});}})[_0x4353('0x1e')](function(){if(_0x533b9d){return _0x533b9d['update']({'online':!![],'lastLoginAt':moment()[_0x4353('0xf1')](_0x4353('0xfd')),'voicePause':_0x533b9d[_0x4353('0xa0')]||![],'mailPause':_0x533b9d[_0x4353('0xa0')]||![],'chatPause':_0x533b9d['loginInPause']||![],'faxPause':_0x533b9d[_0x4353('0xa0')]||![],'smsPause':_0x533b9d[_0x4353('0xa0')]||![],'openchannelPause':_0x533b9d['loginInPause']||![],'whatsappPause':_0x533b9d[_0x4353('0xa0')]||![],'pauseType':_0x533b9d[_0x4353('0xa0')]?_0x4353('0x101'):null,'interface':_0x11ac10,'lastPauseAt':moment()[_0x4353('0xf1')](_0x4353('0xfd'))});}})[_0x4353('0x1e')](function(_0x203e68){if(_0x240d17[_0x4353('0x103')]){return _0x5dedcf();}else{return Promise[_0x4353('0x104')](_0x203e68)['then'](respondWithResult(_0x1f5d8f,null));}})[_0x4353('0x29')](handleError(_0x1f5d8f,null));};exports[_0x4353('0x105')]=function(_0x4aa347,_0x36d29e){var _0x2d5b03;return db['User']['find']({'where':{'id':_0x4aa347['params']['id'],'role':_0x4353('0x2c')},'attributes':['id',_0x4353('0x3c'),_0x4353('0x2b')]})[_0x4353('0x1e')](handleEntityNotFound(_0x36d29e,null))['then'](function(_0x5ba2f7){if(_0x5ba2f7){_0x2d5b03=_0x5ba2f7;return db[_0x4353('0xb1')][_0x4353('0x2e')]({'where':{'membername':_0x2d5b03[_0x4353('0x3c')]},'individualHooks':!![]});}})[_0x4353('0x1e')](function(){return db[_0x4353('0xfb')][_0x4353('0x53')]({'where':{'membername':_0x2d5b03[_0x4353('0x3c')],'exitAt':null}});})[_0x4353('0x1e')](function(_0x1a216c){var _0x2e4cc7=[];_0x1a216c[_0x4353('0xfc')](function(_0x2f21a9){_0x2e4cc7[_0x4353('0x52')](_0x2f21a9[_0x4353('0x2a')]({'exitAt':moment()[_0x4353('0xf1')](_0x4353('0xfd'))}));});return Promise[_0x4353('0x5d')](_0x2e4cc7);})[_0x4353('0x1e')](function(){return _0x2d5b03[_0x4353('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4353('0x1e')](respondWithResult(_0x36d29e,null))[_0x4353('0x29')](handleError(_0x36d29e,null));};exports['pause']=function(_0x34befe,_0x2c20c9){var _0x57289e;return db[_0x4353('0xb1')]['update']({'paused':0x1},{'where':{'UserId':_0x34befe[_0x4353('0x5f')]['id']},'individualHooks':!![]})[_0x4353('0x1e')](function(){return db['User'][_0x4353('0x3a')]({'where':{'id':_0x34befe['params']['id'],'role':'agent'},'attributes':['id',_0x4353('0x3c'),_0x4353('0x2b'),'internal','interface','online']});})[_0x4353('0x1e')](handleEntityNotFound(_0x2c20c9,null))[_0x4353('0x1e')](function(_0x21ce03){if(_0x21ce03){_0x57289e=_0x21ce03;return respondWithRpcPromise(_0x4353('0x106'),_0x4353('0x107'),{'id':_0x57289e['id'],'name':_0x57289e[_0x4353('0x3c')],'pause':!![]});}})[_0x4353('0x1e')](function(){if(_0x57289e){return db[_0x4353('0xfb')][_0x4353('0x53')]({'where':{'membername':_0x57289e[_0x4353('0x3c')],'type':_0x4353('0x100'),'exitAt':null}});}})[_0x4353('0x1e')](function(_0x2cdfa7){if(_0x2cdfa7[_0x4353('0x56')]){var _0xdd8d45=moment()[_0x4353('0xf1')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x29b8bd=0x0,_0x53bd3c=_0x2cdfa7[_0x4353('0x56')];_0x29b8bd<_0x53bd3c;_0x29b8bd++){_0x2cdfa7[_0x29b8bd][_0x4353('0x108')]({'exitAt':_0xdd8d45});}}})[_0x4353('0x1e')](function(){var _0x2870c5=[];var _0xf10418=utils[_0x4353('0x109')]();_0xf10418[_0x4353('0xfc')](function(_0x17a51c){_0x2870c5['push']({'channel':_0x17a51c,'membername':_0x57289e[_0x4353('0x3c')],'interface':_['isNil'](_0x57289e['interface'])?util[_0x4353('0xf1')](_0x4353('0xb0'),_0x57289e[_0x4353('0x3c')]):_0x57289e[_0x4353('0xa2')],'type':_0x4353('0x100'),'enterAt':moment()[_0x4353('0xf1')](_0x4353('0xfd')),'data1':_0x34befe[_0x4353('0x64')][_0x4353('0x42')]||'DEFAULT\x20PAUSE','role':_0x57289e[_0x4353('0x2b')],'internal':_0x57289e['internal']});});return db[_0x4353('0xfb')][_0x4353('0x89')](_0x2870c5,{'individualHooks':!![]});})[_0x4353('0x1e')](function(){return _0x57289e[_0x4353('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x34befe[_0x4353('0x64')][_0x4353('0x42')]||_0x4353('0x10a'),'lastPauseAt':moment()[_0x4353('0xf1')](_0x4353('0xfd'))});})[_0x4353('0x1e')](respondWithResult(_0x2c20c9,null))[_0x4353('0x29')](handleError(_0x2c20c9,null));};exports[_0x4353('0x10b')]=function(_0x4c8542,_0x47d3f7){if(_0x4c8542[_0x4353('0x64')][_0x4353('0x9e')]&&!utils['isValidChannel'](_0x4c8542['body'][_0x4353('0x9e')])){throw new APIBadRequestError(util[_0x4353('0xf1')](_0x4353('0x10c'),_0x4c8542[_0x4353('0x64')][_0x4353('0x9e')]));}return db['User']['find']({'where':{'id':_0x4c8542['params']['id']},'attributes':['id',_0x4353('0x3c'),'role',_0x4353('0x6b'),_0x4353('0xa2'),_0x4353('0x9f'),_0x4353('0xa1'),_0x4353('0x10d'),_0x4353('0x10e'),_0x4353('0x10f'),_0x4353('0x110'),_0x4353('0x111'),'whatsappPause',_0x4353('0x112'),_0x4353('0x113')]})[_0x4353('0x1e')](function(_0x54be5f){if(!_0x54be5f){throw new APINotFoundError(util[_0x4353('0xf1')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4c8542[_0x4353('0x5f')]['id']));}return _0x54be5f[_0x4353('0x10b')](_0x4c8542[_0x4353('0x64')][_0x4353('0x9e')]);})['then'](respondWithResult(_0x47d3f7,null))[_0x4353('0x29')](APIHandleError(_0x47d3f7));};exports[_0x4353('0x114')]=function(_0x34cffa,_0x154de0){var _0x4f3edf={};var _0x35ef9d={};var _0xf26442;var _0x20c7d4;return db[_0x4353('0x40')][_0x4353('0x99')]({'where':{'id':_0x34cffa[_0x4353('0x5f')]['id']}})['then'](handleEntityNotFound(_0x154de0,null))['then'](function(_0x280b06){if(_0x280b06){_0xf26442=_0x280b06;_0x35ef9d[_0x4353('0xd2')]=_[_0x4353('0xd5')](db[_0x4353('0x115')][_0x4353('0xd4')]);_0x35ef9d[_0x4353('0x4c')]=_['keys'](_0x34cffa[_0x4353('0x4c')]);_0x35ef9d[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x35ef9d['model'],_0x35ef9d[_0x4353('0x4c')]);_0x4f3edf[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x35ef9d[_0x4353('0xd2')],qs[_0x4353('0xdf')](_0x34cffa[_0x4353('0x4c')]['fields']));_0x4f3edf[_0x4353('0x51')]=_0x4f3edf[_0x4353('0x51')][_0x4353('0x56')]?_0x4f3edf['attributes']:_0x35ef9d[_0x4353('0xd2')];_0x4f3edf[_0x4353('0xd8')]=qs[_0x4353('0xd9')](_0x34cffa['query'][_0x4353('0xd9')]);_0x4f3edf[_0x4353('0x4b')]=qs[_0x4353('0xd6')](_[_0x4353('0xda')](_0x34cffa[_0x4353('0x4c')],_0x35ef9d[_0x4353('0xd6')]));if(_0x34cffa[_0x4353('0x4c')][_0x4353('0x36')]){_0x4f3edf['where']=_[_0x4353('0x61')](_0x4f3edf[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x4f3edf[_0x4353('0x51')],function(_0x3447bb){var _0x4e7d6d={};_0x4e7d6d[_0x3447bb]={'$like':'%'+_0x34cffa[_0x4353('0x4c')][_0x4353('0x36')]+'%'};return _0x4e7d6d;})});}_0x4f3edf=_[_0x4353('0x61')]({},_0x4f3edf,_0x34cffa[_0x4353('0x62')]);return _0xf26442[_0x4353('0x114')](_0x4f3edf);}})[_0x4353('0x1e')](function(_0x59ff29){if(_0x59ff29){_0x20c7d4=_0x59ff29[_0x4353('0x56')];if(!_0x34cffa[_0x4353('0x4c')][_0x4353('0xdc')](_0x4353('0xdd'))){_0x4f3edf[_0x4353('0x19')]=qs[_0x4353('0x19')](_0x34cffa[_0x4353('0x4c')]['limit']);_0x4f3edf[_0x4353('0x18')]=qs[_0x4353('0x18')](_0x34cffa[_0x4353('0x4c')][_0x4353('0x18')]);}return _0xf26442[_0x4353('0x114')](_0x4f3edf);}})[_0x4353('0x1e')](function(_0x1eefbb){if(_0x1eefbb){return _0x1eefbb?{'count':_0x20c7d4,'rows':_0x1eefbb}:null;}})[_0x4353('0x1e')](respondWithResult(_0x154de0,null))[_0x4353('0x29')](handleError(_0x154de0,null));};exports[_0x4353('0x116')]=function(_0x319be7,_0x324cf7){var _0x2c9b7f=_0x319be7[_0x4353('0x5f')]['id'];var _0x1e3b6a=_0x319be7[_0x4353('0x64')]?_0x319be7[_0x4353('0x64')][_0x4353('0xa8')]:null;var _0x165b73=[];return Promise[_0x4353('0x104')]()['then'](function(){if(!_0x1e3b6a)throw new APIBadRequestError(_0x4353('0x117'));})[_0x4353('0x1e')](function(){return db['User']['findOne']({'where':{'id':_0x2c9b7f}});})[_0x4353('0x1e')](function(_0x143e33){if(!_0x143e33)throw new APINotFoundError(util[_0x4353('0xf1')](_0x4353('0xcc'),_0x319be7['params']['id']));return db[_0x4353('0x6d')]['transaction'](function(_0x5ac584){return _0x143e33['addTeams'](_0x1e3b6a,{'transaction':_0x5ac584})[_0x4353('0x1e')](function(){return db[_0x4353('0x115')][_0x4353('0x53')]({'where':{'id':{'$in':_0x1e3b6a}}});})[_0x4353('0x1e')](function(_0x1635ff){var _0x1a8eba=_[_0x4353('0x38')](_0x1635ff,function(_0x2bda33){return _0x2bda33[_0x4353('0x118')]();});return Promise[_0x4353('0x5d')](_0x1a8eba);})[_0x4353('0x1e')](function(_0x54f990){_0x165b73=_[_0x4353('0x119')](_0x54f990);var _0x27bb4b=_[_0x4353('0x38')](_0x165b73,function(_0x5d4ef7){return _0x5d4ef7[_0x4353('0x11a')](_0x143e33['id'],{'transaction':_0x5ac584});});return Promise[_0x4353('0x5d')](_0x27bb4b);})[_0x4353('0x1e')](function(){if(!_0x143e33['online'])return;var _0x200241=_[_0x4353('0x36')](_0x165b73,function(_0x4a924b){return _0x4a924b['getDataValue'](_0x4353('0x9e'))===_0x4353('0x11b');});var _0x1aed39=_[_0x4353('0x38')](_0x200241,function(_0x78190c){return db[_0x4353('0xb1')][_0x4353('0xb2')]({'membername':_0x143e33['name'],'UserId':_0x143e33['id'],'queue_name':_0x78190c[_0x4353('0x3c')],'VoiceQueueId':_0x78190c['id'],'interface':_[_0x4353('0x6a')](_0x143e33[_0x4353('0xa2')])?util[_0x4353('0xf1')](_0x4353('0xb0'),_0x143e33[_0x4353('0x3c')]):_0x143e33[_0x4353('0xa2')],'paused':_0x143e33['voicePause']||![],'penalty':_0x143e33[_0x4353('0xa9')]},{'transaction':_0x5ac584});});return Promise[_0x4353('0x5d')](_0x1aed39);})[_0x4353('0x1e')](function(){return db[_0x4353('0x11c')][_0x4353('0x53')]({'where':{'teamId':{'$in':_0x1e3b6a}}});})[_0x4353('0x1e')](function(_0x13bca6){var _0x2a754f=_[_0x4353('0x38')](_0x13bca6,function(_0x54fdd9){return db[_0x4353('0x11d')][_0x4353('0x87')]({'UserId':_0x143e33['id'],'VoicePrefixId':_0x54fdd9[_0x4353('0x11e')]},{'transaction':_0x5ac584});});return Promise[_0x4353('0x5d')](_0x2a754f);});});})[_0x4353('0x1e')](function(){for(var _0x38730b=0x0;_0x38730b<_0x165b73[_0x4353('0x56')];_0x38730b++){var _0x3bcd0a=_0x165b73[_0x38730b]['getDataValue'](_0x4353('0x9e'));var _0x2ae53f=_0x3bcd0a+_0x4353('0xac');socket['emit'](_0x4353('0x32')+_0x3bcd0a+_0x4353('0x11f'),{'UserId':_0x2c9b7f,['queueField']:_0x165b73[_0x38730b]['id']});}})[_0x4353('0x1e')](respondWithStatusCode(_0x324cf7,null))[_0x4353('0x29')](APIHandleError(_0x324cf7));};exports[_0x4353('0x120')]=function(_0x38d0c0,_0x1cbac4){var _0x57ec41=_0x38d0c0[_0x4353('0x5f')]['id'];var _0x5985d0=null;if(_0x38d0c0[_0x4353('0x4c')][_0x4353('0xa8')]){_0x5985d0=_['isArray'](_0x38d0c0[_0x4353('0x4c')]['ids'])?_0x38d0c0[_0x4353('0x4c')]['ids']:[_0x38d0c0[_0x4353('0x4c')][_0x4353('0xa8')]];}var _0x2f19bb=[];return Promise[_0x4353('0x104')]()[_0x4353('0x1e')](function(){if(!_0x5985d0)throw new APIBadRequestError(_0x4353('0x121'));})[_0x4353('0x1e')](function(){return db[_0x4353('0x40')][_0x4353('0x99')]({'where':{'id':_0x57ec41}});})['then'](function(_0x2ba7f0){if(!_0x2ba7f0)throw new APINotFoundError(util[_0x4353('0xf1')](_0x4353('0xcc'),_0x38d0c0[_0x4353('0x5f')]['id']));return db[_0x4353('0x6d')][_0x4353('0x122')](function(_0xa3371d){return _0x2ba7f0[_0x4353('0x120')](_0x5985d0,{'transaction':_0xa3371d})[_0x4353('0x1e')](function(){return db[_0x4353('0x115')][_0x4353('0x53')]({'where':{'id':{'$in':_0x5985d0}}});})[_0x4353('0x1e')](function(_0x3b5277){var _0x1f5060=_[_0x4353('0x38')](_0x3b5277,function(_0x3f1c82){return _0x3f1c82['getAssociatedQueues']();});return Promise[_0x4353('0x5d')](_0x1f5060);})['then'](function(_0x36c082){_0x2f19bb=_[_0x4353('0x119')](_0x36c082);var _0x1dd5ee=_['map'](_0x2f19bb,function(_0x1acddd){return _0x1acddd['removeAgent'](_0x2ba7f0['id'],{'transaction':_0xa3371d});});return Promise[_0x4353('0x5d')](_0x1dd5ee);})['then'](function(){if(!_0x2ba7f0[_0x4353('0x9f')])return;var _0x55b7f9=_['filter'](_0x2f19bb,function(_0x5e30ba){return _0x5e30ba['getDataValue'](_0x4353('0x9e'))==='Voice';});var _0x1e253c=_[_0x4353('0x38')](_0x55b7f9,function(_0x1b9a1b){return db[_0x4353('0xb1')][_0x4353('0x2e')]({'where':{'VoiceQueueId':_0x1b9a1b['id'],'UserId':_0x2ba7f0['id']},'transaction':_0xa3371d});});return Promise[_0x4353('0x5d')](_0x1e253c);})[_0x4353('0x1e')](function(){return db[_0x4353('0x11c')][_0x4353('0x53')]({'where':{'teamId':{'$in':_0x5985d0}}});})[_0x4353('0x1e')](function(_0x474fa8){var _0x1c0f8d=_[_0x4353('0x38')](_0x474fa8,function(_0xd4e617){return db[_0x4353('0x11d')][_0x4353('0x2e')]({'where':{'UserId':_0x2ba7f0['id'],'VoicePrefixId':_0xd4e617[_0x4353('0x11e')]}},{'transaction':_0xa3371d});});return Promise[_0x4353('0x5d')](_0x1c0f8d);});});})[_0x4353('0x1e')](function(){for(var _0x1e92ca=0x0;_0x1e92ca<_0x2f19bb[_0x4353('0x56')];_0x1e92ca++){var _0x27ef34=_0x2f19bb[_0x1e92ca]['getDataValue'](_0x4353('0x9e'));var _0x32ea84=_0x27ef34+_0x4353('0xac');socket['emit']('user'+_0x27ef34+_0x4353('0xb5'),{'UserId':_0x57ec41,['queueField']:_0x2f19bb[_0x1e92ca]['id']});}})[_0x4353('0x1e')](respondWithStatusCode(_0x1cbac4,null))['catch'](APIHandleError(_0x1cbac4));};exports[_0x4353('0x123')]=function(_0x219d97,_0x529cf2){var _0x11e720={};var _0x3b7257={};var _0x2e5f42;var _0x430977;return db['User'][_0x4353('0x99')]({'where':{'id':_0x219d97['params']['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x529cf2,null))['then'](function(_0x4005cc){if(_0x4005cc){_0x2e5f42=_0x4005cc;_0x3b7257[_0x4353('0xd2')]=_[_0x4353('0xd5')](db[_0x4353('0xcd')][_0x4353('0xd4')]);_0x3b7257[_0x4353('0x4c')]=_[_0x4353('0xd5')](_0x219d97[_0x4353('0x4c')]);_0x3b7257[_0x4353('0xd6')]=_[_0x4353('0xd7')](_0x3b7257[_0x4353('0xd2')],_0x3b7257['query']);_0x11e720[_0x4353('0x51')]=_[_0x4353('0xd7')](_0x3b7257[_0x4353('0xd2')],qs[_0x4353('0xdf')](_0x219d97[_0x4353('0x4c')][_0x4353('0xdf')]));_0x11e720['attributes']=_0x11e720[_0x4353('0x51')][_0x4353('0x56')]?_0x11e720[_0x4353('0x51')]:_0x3b7257['model'];_0x11e720[_0x4353('0xd8')]=qs[_0x4353('0xd9')](_0x219d97[_0x4353('0x4c')][_0x4353('0xd9')]);_0x11e720[_0x4353('0x4b')]=qs[_0x4353('0xd6')](_['pick'](_0x219d97[_0x4353('0x4c')],_0x3b7257[_0x4353('0xd6')]));if(_0x219d97[_0x4353('0x4c')]['filter']){_0x11e720[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x11e720[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x11e720[_0x4353('0x51')],function(_0x161346){var _0x13daaa={};_0x13daaa[_0x161346]={'$like':'%'+_0x219d97[_0x4353('0x4c')]['filter']+'%'};return _0x13daaa;})});}_0x11e720=_[_0x4353('0x61')]({},_0x11e720,_0x219d97['options']);return _0x2e5f42[_0x4353('0x123')](_0x11e720);}})['then'](function(_0x3f83cc){if(_0x3f83cc){_0x430977=_0x3f83cc[_0x4353('0x56')];if(!_0x219d97['query'][_0x4353('0xdc')]('nolimit')){_0x11e720['limit']=qs[_0x4353('0x19')](_0x219d97[_0x4353('0x4c')][_0x4353('0x19')]);_0x11e720[_0x4353('0x18')]=qs[_0x4353('0x18')](_0x219d97[_0x4353('0x4c')][_0x4353('0x18')]);}return _0x2e5f42[_0x4353('0x123')](_0x11e720);}})[_0x4353('0x1e')](function(_0x325798){if(_0x325798){return _0x325798?{'count':_0x430977,'rows':_0x325798}:null;}})[_0x4353('0x1e')](respondWithResult(_0x529cf2,null))[_0x4353('0x29')](handleError(_0x529cf2,null));};exports[_0x4353('0x124')]=function(_0x82a1cf,_0x3ac04c){var _0x215b0a={};var _0xe9dace={};var _0x35f4ee;return db['User']['findOne']({'where':{'id':_0x82a1cf[_0x4353('0x5f')]['id']}})[_0x4353('0x1e')](handleEntityNotFound(_0x3ac04c,null))[_0x4353('0x1e')](function(_0x2ab137){if(_0x2ab137){_0x35f4ee=_0x2ab137;_0xe9dace[_0x4353('0xd2')]=_['keys'](db[_0x4353('0x40')]['rawAttributes']);_0xe9dace[_0x4353('0x4c')]=_['keys'](_0x82a1cf[_0x4353('0x4c')]);_0xe9dace['filters']=_['intersection'](_0xe9dace[_0x4353('0xd2')],_0xe9dace[_0x4353('0x4c')]);_0x215b0a['attributes']=_[_0x4353('0xd7')](_0xe9dace[_0x4353('0xd2')],qs[_0x4353('0xdf')](_0x82a1cf[_0x4353('0x4c')][_0x4353('0xdf')]));_0x215b0a[_0x4353('0x51')]=_0x215b0a['attributes'][_0x4353('0x56')]?_0x215b0a['attributes']:_0xe9dace[_0x4353('0xd2')];_0x215b0a['order']=qs[_0x4353('0xd9')](_0x82a1cf[_0x4353('0x4c')][_0x4353('0xd9')]);_0x215b0a[_0x4353('0x4b')]=qs[_0x4353('0xd6')](_[_0x4353('0xda')](_0x82a1cf['query'],_0xe9dace[_0x4353('0xd6')]));if(_0x82a1cf[_0x4353('0x4c')][_0x4353('0x36')]){_0x215b0a[_0x4353('0x4b')]=_[_0x4353('0x61')](_0x215b0a[_0x4353('0x4b')],{'$or':_[_0x4353('0x38')](_0x215b0a['attributes'],function(_0x52bc4b){var _0x5948f0={};_0x5948f0[_0x52bc4b]={'$like':'%'+_0x82a1cf[_0x4353('0x4c')][_0x4353('0x36')]+'%'};return _0x5948f0;})});}_0x215b0a[_0x4353('0xd2')]=db[_0x4353('0x40')];_0x215b0a['as']=_0x4353('0x33');_0x215b0a=_[_0x4353('0x61')]({},_0x215b0a,_0x82a1cf['options']);return _0x35f4ee[_0x4353('0x125')]({'include':[_0x215b0a]});}})[_0x4353('0x1e')](function(_0x264489){if(_0x264489){var _0x3077ab={},_0x2e1c1b=[];for(var _0x1e7e91=0x0;_0x1e7e91<_0x264489[_0x4353('0x56')];_0x1e7e91+=0x1){for(var _0x3c50c3=0x0,_0xb45b23;_0x3c50c3<_0x264489[_0x1e7e91][_0x4353('0x33')][_0x4353('0x56')];_0x3c50c3+=0x1){_0xb45b23=_0x264489[_0x1e7e91]['Agents'][_0x3c50c3][_0x4353('0x2f')]({'plain':!![]});_0x3077ab[_0xb45b23['id']]=_0xb45b23;}}_0x3077ab=_[_0x4353('0x126')](_0x3077ab);for(var _0x31fd46=qs['offset'](_0x82a1cf[_0x4353('0x4c')][_0x4353('0x18')]);_0x31fd46<_0x3077ab[_0x4353('0x56')]&&_0x2e1c1b[_0x4353('0x56')]=_0x4aaace['agents']){throw new Error(_0xa323('0x4c'));}})[_0xa323('0x16')](function(){if(_0x20c4d9){return db[_0xa323('0x25')]['destroy']({'where':{'membername':_0x20c4d9[_0xa323('0x1f')]},'individualHooks':!![]});}})[_0xa323('0x16')](function(){if(_0x20c4d9){return _0x20c4d9['getVoiceQueues']({'raw':!![]});}})[_0xa323('0x16')](function(_0x1db271){if(_0x20c4d9){if(_0x1db271){var _0x439eae=[];_0x5764c0=_0x1db271;if(_0x5764c0[_0xa323('0x28')]){for(var _0x54b98c=0x0;_0x54b98c<_0x5764c0[_0xa323('0x28')];_0x54b98c++){_0x439eae[_0xa323('0x2d')](db[_0xa323('0x25')][_0xa323('0x4d')]({'membername':_0x20c4d9[_0xa323('0x1f')],'UserId':_0x20c4d9['id'],'queue_name':_0x5764c0[_0x54b98c][_0xa323('0x1f')],'VoiceQueueId':_0x5764c0[_0x54b98c]['id'],'interface':_0xf2f769,'paused':_0x20c4d9[_0xa323('0x48')]||![],'penalty':_0x5764c0[_0x54b98c]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xa323('0x4e')](_0x439eae);}}}})[_0xa323('0x16')](function(){if(_0x20c4d9){return db[_0xa323('0x27')][_0xa323('0xd')]({'where':{'membername':_0x20c4d9[_0xa323('0x1f')],'exitAt':null}});}})[_0xa323('0x16')](function(_0x2e4409){if(_0x20c4d9){if(_0x2e4409&&_0x2e4409[_0xa323('0x28')]){var _0x41644d=[];_0x2e4409[_0xa323('0x2c')](function(_0x42697b){_0x41644d[_0xa323('0x2d')](_0x42697b[_0xa323('0x26')]({'exitAt':moment()[_0xa323('0x22')](_0xa323('0x29'))}));});return BPromise[_0xa323('0x4e')](_0x41644d);}}})[_0xa323('0x16')](function(){if(_0x20c4d9){var _0x23d78b=[];var _0xa4964d=[];var _0x2c9b71=utils[_0xa323('0x2b')]();var _0x28f788={'membername':_0x20c4d9[_0xa323('0x1f')],'interface':_0xf2f769,'enterAt':moment()['format'](_0xa323('0x29')),'role':_0x20c4d9[_0xa323('0x20')],'internal':_0x20c4d9['internal']};_0x2c9b71['forEach'](function(_0x311f3c){_0x23d78b[_0xa323('0x2d')](_[_0xa323('0x4f')]({'channel':_0x311f3c,'type':_0xa323('0x50'),'data1':_0xa323('0x51'),'data2':_0xf2f769},_0x28f788));if(_0x20c4d9['loginInPause']){_0xa4964d[_0xa323('0x2d')](_[_0xa323('0x4f')]({'channel':_0x311f3c,'type':_0xa323('0x30'),'data1':_0xa323('0x52')},_0x28f788));}});return db[_0xa323('0x27')][_0xa323('0x53')](_0x23d78b[_0xa323('0x54')](_0xa4964d),{'individualHooks':!![]});}})[_0xa323('0x16')](function(){if(_0x20c4d9){return _0x20c4d9[_0xa323('0x26')]({'online':!![],'lastLoginAt':moment()[_0xa323('0x22')](_0xa323('0x29')),'voicePause':_0x20c4d9[_0xa323('0x48')]||![],'mailPause':_0x20c4d9['loginInPause']||![],'chatPause':_0x20c4d9['loginInPause']||![],'faxPause':_0x20c4d9[_0xa323('0x48')]||![],'smsPause':_0x20c4d9[_0xa323('0x48')]||![],'openchannelPause':_0x20c4d9[_0xa323('0x48')]||![],'pauseType':_0x20c4d9[_0xa323('0x48')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xa323('0x29')),'interface':_0xf2f769});}})[_0xa323('0x16')](function(_0x46e24e){_0x2b9c4b(_0x46e24e);})[_0xa323('0x18')](function(_0x529635){_0x2c7855(_0x48db13[_0xa323('0x19')](0x1f4,_0x529635[_0xa323('0x1a')]));});});}; \ No newline at end of file +var _0xb664=['find','ShowUser','debug','catch','PauseUser','name','role','interface','User\x20with\x20id\x20%s\x20not\x20found','params','update','length','updateAttributes','forEach','push','isNil','SIP/%s','PAUSE','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','internal','bulkCreate','format','resolve','isValidChannel','channel','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','UserVoiceQueueRt','destroy','MemberReport','all','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','./user.socket','User','findAll','options','where','attributes','include','map','model','then','info','GetUser','stringify','error','message'];(function(_0x35bb09,_0x1cbd65){var _0x1583ae=function(_0x93c972){while(--_0x93c972){_0x35bb09['push'](_0x35bb09['shift']());}};_0x1583ae(++_0x1cbd65);}(_0xb664,0x19b));var _0x4b66=function(_0x34ead5,_0x20a286){_0x34ead5=_0x34ead5-0x0;var _0x53f6bb=_0xb664[_0x34ead5];return _0x53f6bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4b66('0x0'));var BPromise=require(_0x4b66('0x1'));var Redis=require(_0x4b66('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4b66('0x3'));var logger=require('../../config/logger')(_0x4b66('0x4'));var config=require(_0x4b66('0x5'));config[_0x4b66('0x6')]=_[_0x4b66('0x7')](config['redis'],{'host':_0x4b66('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4b66('0x9'))['register'](socket);exports['GetUser']=function(_0x126d85){var _0x1384cf=this;return new Promise(function(_0x53e3da,_0x1d41a0){return db[_0x4b66('0xa')][_0x4b66('0xb')]({'raw':_0x126d85[_0x4b66('0xc')]?_0x126d85['options']['raw']===undefined?!![]:![]:!![],'where':_0x126d85['options']?_0x126d85[_0x4b66('0xc')][_0x4b66('0xd')]||null:null,'attributes':_0x126d85['options']?_0x126d85[_0x4b66('0xc')][_0x4b66('0xe')]||null:null,'limit':_0x126d85['options']?_0x126d85[_0x4b66('0xc')]['limit']||null:null,'include':_0x126d85[_0x4b66('0xc')]?_0x126d85[_0x4b66('0xc')][_0x4b66('0xf')]?_[_0x4b66('0x10')](_0x126d85[_0x4b66('0xc')][_0x4b66('0xf')],function(_0xdaf070){return{'model':db[_0xdaf070[_0x4b66('0x11')]],'as':_0xdaf070['as'],'attributes':_0xdaf070[_0x4b66('0xe')],'include':_0xdaf070[_0x4b66('0xf')]?_[_0x4b66('0x10')](_0xdaf070['include'],function(_0x44dfaa){return{'model':db[_0x44dfaa[_0x4b66('0x11')]],'as':_0x44dfaa['as'],'attributes':_0x44dfaa[_0x4b66('0xe')],'include':_0x44dfaa['include']?_[_0x4b66('0x10')](_0x44dfaa['include'],function(_0x192aa5){return{'model':db[_0x192aa5[_0x4b66('0x11')]],'as':_0x192aa5['as'],'attributes':_0x192aa5[_0x4b66('0xe')]};}):[]};}):[]};}):[]:[]})[_0x4b66('0x12')](function(_0x24dc30){logger[_0x4b66('0x13')](_0x4b66('0x14'),_0x126d85);logger['debug']('GetUser',_0x126d85,JSON[_0x4b66('0x15')](_0x24dc30));_0x53e3da(_0x24dc30);})['catch'](function(_0x536f2b){logger[_0x4b66('0x16')](_0x4b66('0x14'),_0x536f2b[_0x4b66('0x17')],_0x126d85);_0x1d41a0(_0x1384cf[_0x4b66('0x16')](0x1f4,_0x536f2b['message']));});});};exports['ShowUser']=function(_0x3bc290){var _0x46b3c5=this;return new Promise(function(_0x5b4f2c,_0x4ff22e){return db[_0x4b66('0xa')][_0x4b66('0x18')]({'raw':_0x3bc290[_0x4b66('0xc')]?_0x3bc290[_0x4b66('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x3bc290[_0x4b66('0xc')]?_0x3bc290[_0x4b66('0xc')][_0x4b66('0xd')]||null:null,'attributes':_0x3bc290[_0x4b66('0xc')]?_0x3bc290['options'][_0x4b66('0xe')]||null:null,'include':_0x3bc290[_0x4b66('0xc')]?_0x3bc290[_0x4b66('0xc')][_0x4b66('0xf')]?_[_0x4b66('0x10')](_0x3bc290[_0x4b66('0xc')][_0x4b66('0xf')],function(_0xec38a0){return{'model':db[_0xec38a0[_0x4b66('0x11')]],'as':_0xec38a0['as'],'attributes':_0xec38a0['attributes'],'include':_0xec38a0['include']?_['map'](_0xec38a0[_0x4b66('0xf')],function(_0x461e5d){return{'model':db[_0x461e5d[_0x4b66('0x11')]],'as':_0x461e5d['as'],'attributes':_0x461e5d[_0x4b66('0xe')],'include':_0x461e5d[_0x4b66('0xf')]?_[_0x4b66('0x10')](_0x461e5d[_0x4b66('0xf')],function(_0x2ade7b){return{'model':db[_0x2ade7b[_0x4b66('0x11')]],'as':_0x2ade7b['as'],'attributes':_0x2ade7b[_0x4b66('0xe')]};}):[]};}):[]};}):[]:[]})[_0x4b66('0x12')](function(_0x277873){logger[_0x4b66('0x13')](_0x4b66('0x19'),_0x3bc290);logger[_0x4b66('0x1a')](_0x4b66('0x19'),_0x3bc290,JSON[_0x4b66('0x15')](_0x277873));_0x5b4f2c(_0x277873);})[_0x4b66('0x1b')](function(_0x5ba412){logger[_0x4b66('0x16')](_0x4b66('0x19'),_0x5ba412[_0x4b66('0x17')],_0x3bc290);_0x4ff22e(_0x46b3c5['error'](0x1f4,_0x5ba412[_0x4b66('0x17')]));});});};exports[_0x4b66('0x1c')]=function(_0x3e6e4c){var _0x4340c4;return db[_0x4b66('0xa')][_0x4b66('0x18')]({'where':_0x3e6e4c[_0x4b66('0xc')][_0x4b66('0xd')]||{},'attributes':['id',_0x4b66('0x1d'),_0x4b66('0x1e'),'internal',_0x4b66('0x1f')]})[_0x4b66('0x12')](function(_0x59434e){if(!_0x59434e){throw new Error(util['format'](_0x4b66('0x20'),_0x3e6e4c[_0x4b66('0x21')]['id']));}_0x4340c4=_0x59434e;return db['UserVoiceQueueRt'][_0x4b66('0x22')]({'paused':0x1},{'where':{'UserId':_0x4340c4['id']},'individualHooks':!![]});})[_0x4b66('0x12')](function(){return db['MemberReport'][_0x4b66('0xb')]({'where':{'membername':_0x4340c4[_0x4b66('0x1d')],'type':'PAUSE','exitAt':null}});})[_0x4b66('0x12')](function(_0x526be2){if(_0x526be2&&_0x526be2['length']){var _0x4516c4=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x240820=0x0,_0x3d6177=_0x526be2[_0x4b66('0x23')];_0x240820<_0x3d6177;_0x240820++){_0x526be2[_0x240820][_0x4b66('0x24')]({'exitAt':_0x4516c4});}}})[_0x4b66('0x12')](function(){var _0x4d4b19=[];var _0x2d0ca3=utils['getChannels']();_0x2d0ca3[_0x4b66('0x25')](function(_0x3b1cb5){_0x4d4b19[_0x4b66('0x26')]({'channel':_0x3b1cb5,'membername':_0x4340c4[_0x4b66('0x1d')],'interface':_[_0x4b66('0x27')](_0x4340c4[_0x4b66('0x1f')])?util['format'](_0x4b66('0x28'),_0x4340c4['name']):_0x4340c4[_0x4b66('0x1f')],'type':_0x4b66('0x29'),'enterAt':moment()['format'](_0x4b66('0x2a')),'data1':_0x3e6e4c[_0x4b66('0x2b')][_0x4b66('0x2c')]||_0x4b66('0x2d'),'role':_0x4340c4['role'],'internal':_0x4340c4[_0x4b66('0x2e')],'uniqueid':_0x3e6e4c[_0x4b66('0x2b')]['uniqueid']||null});});return db['MemberReport'][_0x4b66('0x2f')](_0x4d4b19,{'individualHooks':!![]});})[_0x4b66('0x12')](function(){return _0x4340c4[_0x4b66('0x22')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3e6e4c[_0x4b66('0x2b')]['type']||_0x4b66('0x2d'),'lastPauseAt':moment()[_0x4b66('0x30')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x441865){throw _0x441865;});};exports['UnpauseUser']=function(_0x15e538){return Promise[_0x4b66('0x31')]()[_0x4b66('0x12')](function(){if(_0x15e538['body']['channel']&&!utils[_0x4b66('0x32')](_0x15e538[_0x4b66('0x2b')][_0x4b66('0x33')])){throw new Error(util[_0x4b66('0x30')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x15e538[_0x4b66('0x2b')][_0x4b66('0x33')]));}return db[_0x4b66('0xa')][_0x4b66('0x34')]({'where':_0x15e538[_0x4b66('0xc')][_0x4b66('0xd')]||{},'attributes':['id','name',_0x4b66('0x1e'),_0x4b66('0x2e'),_0x4b66('0x1f'),_0x4b66('0x35'),_0x4b66('0x36'),_0x4b66('0x37'),_0x4b66('0x38'),_0x4b66('0x39'),_0x4b66('0x3a'),_0x4b66('0x3b'),_0x4b66('0x3c'),_0x4b66('0x3d'),_0x4b66('0x3e')]});})[_0x4b66('0x12')](function(_0x112fc4){if(!_0x112fc4){throw new Error(util[_0x4b66('0x30')](_0x4b66('0x20'),_0x15e538['params']['id']));}return _0x112fc4[_0x4b66('0x3f')](_0x15e538[_0x4b66('0x2b')][_0x4b66('0x33')],_0x4b66('0x40'));})[_0x4b66('0x1b')](function(_0x158958){throw _0x158958;});};exports[_0x4b66('0x41')]=function(_0x1d6fee){var _0x2b7e61=this;return new Promise(function(_0x192d8c,_0x3fb7ef){var _0x252eb8;return db[_0x4b66('0xa')]['findOne']({'where':_0x1d6fee[_0x4b66('0xc')]['where']||{},'attributes':['id',_0x4b66('0x1d')]})[_0x4b66('0x12')](function(_0x5d0014){if(_0x5d0014){_0x252eb8=_0x5d0014;return db[_0x4b66('0x42')][_0x4b66('0x43')]({'where':{'membername':_0x252eb8[_0x4b66('0x1d')]},'individualHooks':!![]});}})[_0x4b66('0x12')](function(){if(_0x252eb8){return db[_0x4b66('0x44')][_0x4b66('0xb')]({'where':{'membername':_0x252eb8[_0x4b66('0x1d')],'exitAt':null}});}})['then'](function(_0x3ae1cb){if(_0x252eb8){if(_0x3ae1cb&&_0x3ae1cb[_0x4b66('0x23')]){var _0x2f29a3=[];_0x3ae1cb['forEach'](function(_0x414efb){_0x2f29a3['push'](_0x414efb[_0x4b66('0x22')]({'exitAt':moment()[_0x4b66('0x30')](_0x4b66('0x2a'))}));});return BPromise[_0x4b66('0x45')](_0x2f29a3);}}})[_0x4b66('0x12')](function(){if(_0x252eb8){return _0x252eb8[_0x4b66('0x22')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x4b66('0x12')](function(_0x55d998){_0x192d8c(_0x55d998);})['catch'](function(_0x321552){_0x3fb7ef(_0x2b7e61[_0x4b66('0x16')](0x1f4,_0x321552[_0x4b66('0x17')]));});});};exports['LoginUser']=function(_0x5aa3b1){var _0x43f4be=this;return new Promise(function(_0x320a37,_0x62ff39){var _0x5202f6;var _0x268c68;var _0x462211;var _0x46b482;return db['User'][_0x4b66('0x34')]({'where':_0x5aa3b1['options'][_0x4b66('0xd')]||{},'attributes':['id',_0x4b66('0x1d'),_0x4b66('0x1e'),_0x4b66('0x46'),_0x4b66('0x47'),_0x4b66('0x2e'),_0x4b66('0x48'),'interface']})[_0x4b66('0x12')](function(_0x58eec9){if(_0x58eec9){_0x5202f6=_0x58eec9;_0x46b482=_0x5aa3b1['body'][_0x4b66('0x1f')]?_0x5aa3b1[_0x4b66('0x2b')][_0x4b66('0x1f')]:util[_0x4b66('0x30')](_0x4b66('0x28'),_0x5202f6[_0x4b66('0x1d')]);return db[_0x4b66('0xa')][_0x4b66('0x49')]({'where':{'role':_0x4b66('0x4a'),'online':!![],'id':{'$ne':_0x5202f6['id']}}});}})[_0x4b66('0x12')](function(_0x584ae6){if(_0x584ae6){_0x462211=_0x584ae6;return require(_0x4b66('0x4b'))[_0x4b66('0x4c')]();}})[_0x4b66('0x12')](function(_0x4ade83){if(_0x4ade83&&_0x4ade83[_0x4b66('0x4d')]&&_0x462211>=_0x4ade83[_0x4b66('0x4d')]){throw new Error(_0x4b66('0x4e'));}})[_0x4b66('0x12')](function(){if(_0x5202f6){return db[_0x4b66('0x42')][_0x4b66('0x43')]({'where':{'membername':_0x5202f6[_0x4b66('0x1d')]},'individualHooks':!![]});}})[_0x4b66('0x12')](function(){if(_0x5202f6){return _0x5202f6['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x2d3610){if(_0x5202f6){if(_0x2d3610){var _0x564eaf=[];_0x268c68=_0x2d3610;if(_0x268c68[_0x4b66('0x23')]){for(var _0x507cfa=0x0;_0x507cfa<_0x268c68['length'];_0x507cfa++){_0x564eaf[_0x4b66('0x26')](db[_0x4b66('0x42')][_0x4b66('0x4f')]({'membername':_0x5202f6[_0x4b66('0x1d')],'UserId':_0x5202f6['id'],'queue_name':_0x268c68[_0x507cfa][_0x4b66('0x1d')],'VoiceQueueId':_0x268c68[_0x507cfa]['id'],'interface':_0x46b482,'paused':_0x5202f6[_0x4b66('0x48')]||![],'penalty':_0x268c68[_0x507cfa][_0x4b66('0x50')]||0x0}));}return BPromise['all'](_0x564eaf);}}}})['then'](function(){if(_0x5202f6){return db[_0x4b66('0x44')]['findAll']({'where':{'membername':_0x5202f6['name'],'exitAt':null}});}})[_0x4b66('0x12')](function(_0x3db1ff){if(_0x5202f6){if(_0x3db1ff&&_0x3db1ff[_0x4b66('0x23')]){var _0x3fd798=[];_0x3db1ff[_0x4b66('0x25')](function(_0x29a4a3){_0x3fd798[_0x4b66('0x26')](_0x29a4a3[_0x4b66('0x22')]({'exitAt':moment()[_0x4b66('0x30')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x3fd798);}}})['then'](function(){if(_0x5202f6){var _0x1cb8db=[];var _0x73d0e0=[];var _0x4fdb71=utils[_0x4b66('0x51')]();var _0x364476={'membername':_0x5202f6['name'],'interface':_0x46b482,'enterAt':moment()['format'](_0x4b66('0x2a')),'role':_0x5202f6['role'],'internal':_0x5202f6['internal']};_0x4fdb71['forEach'](function(_0x17b43f){_0x1cb8db[_0x4b66('0x26')](_[_0x4b66('0x52')]({'channel':_0x17b43f,'type':_0x4b66('0x53'),'data1':_0x4b66('0x54'),'data2':_0x46b482},_0x364476));if(_0x5202f6['loginInPause']){_0x73d0e0[_0x4b66('0x26')](_['merge']({'channel':_0x17b43f,'type':_0x4b66('0x29'),'data1':_0x4b66('0x55')},_0x364476));}});return db[_0x4b66('0x44')]['bulkCreate'](_0x1cb8db[_0x4b66('0x56')](_0x73d0e0),{'individualHooks':!![]});}})['then'](function(){if(_0x5202f6){return _0x5202f6[_0x4b66('0x22')]({'online':!![],'lastLoginAt':moment()[_0x4b66('0x30')](_0x4b66('0x2a')),'voicePause':_0x5202f6[_0x4b66('0x48')]||![],'mailPause':_0x5202f6[_0x4b66('0x48')]||![],'chatPause':_0x5202f6[_0x4b66('0x48')]||![],'faxPause':_0x5202f6[_0x4b66('0x48')]||![],'smsPause':_0x5202f6[_0x4b66('0x48')]||![],'openchannelPause':_0x5202f6[_0x4b66('0x48')]||![],'pauseType':_0x5202f6['loginInPause']?_0x4b66('0x55'):null,'lastPauseAt':moment()['format'](_0x4b66('0x2a')),'interface':_0x46b482});}})[_0x4b66('0x12')](function(_0x3a8832){_0x320a37(_0x3a8832);})[_0x4b66('0x1b')](function(_0x29881d){_0x62ff39(_0x43f4be[_0x4b66('0x16')](0x1f4,_0x29881d[_0x4b66('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fb3b52c..c834912 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 _0xafde=['register','length','./user.events','save','emit','removeListener'];(function(_0x8914f4,_0x4361bc){var _0xe8ab94=function(_0x30be62){while(--_0x30be62){_0x8914f4['push'](_0x8914f4['shift']());}};_0xe8ab94(++_0x4361bc);}(_0xafde,0x1f4));var _0xeafd=function(_0x2e5fd3,_0x28ab1b){_0x2e5fd3=_0x2e5fd3-0x0;var _0x39274b=_0xafde[_0x2e5fd3];return _0x39274b;};'use strict';var UserEvents=require(_0xeafd('0x0'));var events=[_0xeafd('0x1'),'remove','update'];function createListener(_0x12f9db,_0x650649){return function(_0xd59bc){_0x650649[_0xeafd('0x2')](_0x12f9db,_0xd59bc);};}function removeListener(_0x3edbbb,_0x2527f2){return function(){UserEvents[_0xeafd('0x3')](_0x3edbbb,_0x2527f2);};}exports[_0xeafd('0x4')]=function(_0x5cf901){for(var _0x1d0945=0x0,_0x123ea2=events[_0xeafd('0x5')];_0x1d0945<_0x123ea2;_0x1d0945++){var _0x73b83a=events[_0x1d0945];var _0x4b3315=createListener('user:'+_0x73b83a,_0x5cf901);UserEvents['on'](_0x73b83a,_0x4b3315);}}; \ No newline at end of file +var _0xc665=['removeListener','register','user:','./user.events','save','remove','update','emit'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0xc665,0x12b));var _0x5c66=function(_0x5b2011,_0x59cd2e){_0x5b2011=_0x5b2011-0x0;var _0xca3680=_0xc665[_0x5b2011];return _0xca3680;};'use strict';var UserEvents=require(_0x5c66('0x0'));var events=[_0x5c66('0x1'),_0x5c66('0x2'),_0x5c66('0x3')];function createListener(_0x2e9a2b,_0x17ce4b){return function(_0x566509){_0x17ce4b[_0x5c66('0x4')](_0x2e9a2b,_0x566509);};}function removeListener(_0x3504c0,_0x10dbd7){return function(){UserEvents[_0x5c66('0x5')](_0x3504c0,_0x10dbd7);};}exports[_0x5c66('0x6')]=function(_0x41a3ca){for(var _0x5c20bd=0x0,_0x4b43fa=events['length'];_0x5c20bd<_0x4b43fa;_0x5c20bd++){var _0x3078f9=events[_0x5c20bd];var _0xdde11c=createListener(_0x5c66('0x7')+_0x3078f9,_0x41a3ca);UserEvents['on'](_0x3078f9,_0xdde11c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index d29439e..01623a2 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x28f2e6,_0x1d1fb7){var _0x2e16f6=function(_0x230ea4){while(--_0x230ea4){_0x28f2e6['push'](_0x28f2e6['shift']());}};_0x2e16f6(++_0x1d1fb7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x340ddf,_0x3f60ba){var _0x3ce80b=function(_0x4f301a){while(--_0x4f301a){_0x340ddf['push'](_0x340ddf['shift']());}};_0x3ce80b(++_0x3f60ba);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a4ae193..3192f14 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 _0x9a82=['INTEGER','sequelize','exports'];(function(_0x3ee7e2,_0x15cf09){var _0x1c1f18=function(_0x3426e0){while(--_0x3426e0){_0x3ee7e2['push'](_0x3ee7e2['shift']());}};_0x1c1f18(++_0x15cf09);}(_0x9a82,0x97));var _0x29a8=function(_0x227027,_0x7369a3){_0x227027=_0x227027-0x0;var _0x2e5250=_0x9a82[_0x227027];return _0x2e5250;};'use strict';var Sequelize=require(_0x29a8('0x0'));module[_0x29a8('0x1')]={'penalty':{'type':Sequelize[_0x29a8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x74e5=['sequelize','INTEGER'];(function(_0x90edf5,_0x50f404){var _0x317d48=function(_0x319c1c){while(--_0x319c1c){_0x90edf5['push'](_0x90edf5['shift']());}};_0x317d48(++_0x50f404);}(_0x74e5,0x172));var _0x574e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x74e5[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x574e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x574e('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 10d36b9..57cf6bb 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 _0xad25=['exports','UserChatQueue','lodash','util','request-promise','rimraf','./userChatQueue.attributes'];(function(_0x33b6f1,_0x3de281){var _0x417f2a=function(_0xb803d6){while(--_0xb803d6){_0x33b6f1['push'](_0x33b6f1['shift']());}};_0x417f2a(++_0x3de281);}(_0xad25,0x191));var _0x5ad2=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xad25[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x5ad2('0x0'));var util=require(_0x5ad2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ad2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ad2('0x3'));var config=require('../../config/environment');var attributes=require(_0x5ad2('0x4'));module[_0x5ad2('0x5')]=function(_0x3807cd,_0x3fc31b){return _0x3807cd['define'](_0x5ad2('0x6'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb143=['request-promise','rimraf','./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','bluebird'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0xb143,0x1e6));var _0x3b14=function(_0xa63ea3,_0x4367ff){_0xa63ea3=_0xa63ea3-0x0;var _0x2aa5ff=_0xb143[_0xa63ea3];return _0x2aa5ff;};'use strict';var _=require(_0x3b14('0x0'));var util=require('util');var logger=require(_0x3b14('0x1'))(_0x3b14('0x2'));var moment=require('moment');var BPromise=require(_0x3b14('0x3'));var rp=require(_0x3b14('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b14('0x5'));var config=require('../../config/environment');var attributes=require(_0x3b14('0x6'));module['exports']=function(_0x227129,_0x5407d8){return _0x227129[_0x3b14('0x7')](_0x3b14('0x8'),attributes,{'tableName':_0x3b14('0x9'),'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 12595c9..2d3e697 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 _0x1dce=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2d04a6,_0x5bbf0a){var _0x3cd00e=function(_0x38887c){while(--_0x38887c){_0x2d04a6['push'](_0x2d04a6['shift']());}};_0x3cd00e(++_0x5bbf0a);}(_0x1dce,0x151));var _0xe1dc=function(_0x39ba00,_0x369bfb){_0x39ba00=_0x39ba00-0x0;var _0x50488=_0x1dce[_0x39ba00];return _0x50488;};'use strict';var _=require(_0xe1dc('0x0'));var util=require(_0xe1dc('0x1'));var moment=require(_0xe1dc('0x2'));var BPromise=require(_0xe1dc('0x3'));var rs=require(_0xe1dc('0x4'));var fs=require('fs');var Redis=require(_0xe1dc('0x5'));var db=require(_0xe1dc('0x6'))['db'];var utils=require(_0xe1dc('0x7'));var logger=require(_0xe1dc('0x8'))(_0xe1dc('0x9'));var config=require(_0xe1dc('0xa'));var jayson=require(_0xe1dc('0xb'));var client=jayson['client'][_0xe1dc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x450276,_0x18e40e,_0x2d0467){return new BPromise(function(_0x3ba746,_0x3bc718){return client[_0xe1dc('0xd')](_0x450276,_0x2d0467)[_0xe1dc('0xe')](function(_0x5802ef){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x18e40e,_0xe1dc('0xf'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x18e40e,_0xe1dc('0xf'),JSON[_0xe1dc('0x10')](_0x5802ef));if(_0x5802ef[_0xe1dc('0x11')]){if(_0x5802ef[_0xe1dc('0x11')][_0xe1dc('0x12')]===0x1f4){logger[_0xe1dc('0x11')](_0xe1dc('0x13'),_0x18e40e,_0x5802ef[_0xe1dc('0x11')]['message']);return _0x3bc718(_0x5802ef[_0xe1dc('0x11')][_0xe1dc('0x14')]);}logger[_0xe1dc('0x11')](_0xe1dc('0x13'),_0x18e40e,_0x5802ef['error'][_0xe1dc('0x14')]);return _0x3ba746(_0x5802ef[_0xe1dc('0x11')]['message']);}else{logger[_0xe1dc('0x15')](_0xe1dc('0x13'),_0x18e40e,_0xe1dc('0xf'));_0x3ba746(_0x5802ef['result'][_0xe1dc('0x14')]);}})[_0xe1dc('0x16')](function(_0x7ac38){logger[_0xe1dc('0x11')](_0xe1dc('0x13'),_0x18e40e,_0x7ac38);_0x3bc718(_0x7ac38);});});} \ No newline at end of file +var _0x4329=['error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x4329,0x16e));var _0x9432=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4329[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var moment=require(_0x9432('0x2'));var BPromise=require(_0x9432('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9432('0x4'));var db=require(_0x9432('0x5'))['db'];var utils=require(_0x9432('0x6'));var logger=require(_0x9432('0x7'))(_0x9432('0x8'));var config=require(_0x9432('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9432('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53b531,_0x121e5b,_0x36d59c){return new BPromise(function(_0x506982,_0x1defc6){return client[_0x9432('0xb')](_0x53b531,_0x36d59c)[_0x9432('0xc')](function(_0x274617){logger['info'](_0x9432('0xd'),_0x121e5b,_0x9432('0xe'));logger[_0x9432('0xf')](_0x9432('0x10'),_0x121e5b,_0x9432('0xe'),JSON[_0x9432('0x11')](_0x274617));if(_0x274617['error']){if(_0x274617[_0x9432('0x12')][_0x9432('0x13')]===0x1f4){logger[_0x9432('0x12')](_0x9432('0xd'),_0x121e5b,_0x274617[_0x9432('0x12')][_0x9432('0x14')]);return _0x1defc6(_0x274617['error'][_0x9432('0x14')]);}logger[_0x9432('0x12')](_0x9432('0xd'),_0x121e5b,_0x274617['error'][_0x9432('0x14')]);return _0x506982(_0x274617[_0x9432('0x12')][_0x9432('0x14')]);}else{logger[_0x9432('0x15')]('UserChatQueue,\x20%s,\x20%s',_0x121e5b,_0x9432('0xe'));_0x506982(_0x274617[_0x9432('0x16')][_0x9432('0x14')]);}})[_0x9432('0x17')](function(_0x271c31){logger[_0x9432('0x12')](_0x9432('0xd'),_0x121e5b,_0x271c31);_0x1defc6(_0x271c31);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index a522356..5dd9667 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x59bd45,_0x3ec67){var _0x4093b8=function(_0x499366){while(--_0x499366){_0x59bd45['push'](_0x59bd45['shift']());}};_0x4093b8(++_0x3ec67);}(_0x70e0,0x17b));var _0x070e=function(_0x107c7b,_0x5cc8d8){_0x107c7b=_0x107c7b-0x0;var _0x29ed23=_0x70e0[_0x107c7b];return _0x29ed23;};'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(_0x8eb3ce,_0x130a49){var _0x44df65=function(_0x508073){while(--_0x508073){_0x8eb3ce['push'](_0x8eb3ce['shift']());}};_0x44df65(++_0x130a49);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e4eb15b..c3d7d97 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 _0x5f20=['STRING','exports','INTEGER'];(function(_0x45b6f2,_0x2936c5){var _0x317ba0=function(_0x56572f){while(--_0x56572f){_0x45b6f2['push'](_0x45b6f2['shift']());}};_0x317ba0(++_0x2936c5);}(_0x5f20,0x1f0));var _0x05f2=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x5f20[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require('sequelize');module[_0x05f2('0x0')]={'penalty':{'type':Sequelize[_0x05f2('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x05f2('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x05f2('0x2')]}}; \ No newline at end of file +var _0x39ee=['INTEGER'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x39ee,0xae));var _0xe39e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x39ee[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xe39e('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 40e7b77..ef48ec4 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 _0x69f3=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues'];(function(_0x351b97,_0x60125b){var _0x5b3b7e=function(_0x284562){while(--_0x284562){_0x351b97['push'](_0x351b97['shift']());}};_0x5b3b7e(++_0x60125b);}(_0x69f3,0x12b));var _0x369f=function(_0x5ed5fb,_0x457fca){_0x5ed5fb=_0x5ed5fb-0x0;var _0x18f94f=_0x69f3[_0x5ed5fb];return _0x18f94f;};'use strict';var _=require('lodash');var util=require(_0x369f('0x0'));var logger=require(_0x369f('0x1'))(_0x369f('0x2'));var moment=require(_0x369f('0x3'));var BPromise=require(_0x369f('0x4'));var rp=require(_0x369f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x369f('0x6'));var config=require(_0x369f('0x7'));var attributes=require(_0x369f('0x8'));module[_0x369f('0x9')]=function(_0x2e2167,_0x2f7a25){return _0x2e2167[_0x369f('0xa')](_0x369f('0xb'),attributes,{'tableName':_0x369f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe34c=['../../config/logger','api','request-promise','path','../../config/environment','exports','define','user_has_fax_queues','lodash','util'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xe34c,0x184));var _0xce34=function(_0x340511,_0x26445f){_0x340511=_0x340511-0x0;var _0x433ef6=_0xe34c[_0x340511];return _0x433ef6;};'use strict';var _=require(_0xce34('0x0'));var util=require(_0xce34('0x1'));var logger=require(_0xce34('0x2'))(_0xce34('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xce34('0x4'));var fs=require('fs');var path=require(_0xce34('0x5'));var rimraf=require('rimraf');var config=require(_0xce34('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xce34('0x7')]=function(_0x1992d9,_0x1f3de2){return _0x1992d9[_0xce34('0x8')]('UserFaxQueue',attributes,{'tableName':_0xce34('0x9'),'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 f600b20..9b3a1cd 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 _0x931c=['error','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5710db,_0x410db1){var _0xee92e=function(_0x1606e7){while(--_0x1606e7){_0x5710db['push'](_0x5710db['shift']());}};_0xee92e(++_0x410db1);}(_0x931c,0x134));var _0xc931=function(_0x5edcdf,_0xbc6078){_0x5edcdf=_0x5edcdf-0x0;var _0x2180e1=_0x931c[_0x5edcdf];return _0x2180e1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc931('0x0'));var BPromise=require(_0xc931('0x1'));var rs=require(_0xc931('0x2'));var fs=require('fs');var Redis=require(_0xc931('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc931('0x4'))(_0xc931('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc931('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5d56d5,_0x374016,_0x1b801a){return new BPromise(function(_0x293222,_0x260912){return client['request'](_0x5d56d5,_0x1b801a)[_0xc931('0x7')](function(_0x589dc6){logger['info'](_0xc931('0x8'),_0x374016,_0xc931('0x9'));logger[_0xc931('0xa')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x374016,_0xc931('0x9'),JSON[_0xc931('0xb')](_0x589dc6));if(_0x589dc6[_0xc931('0xc')]){if(_0x589dc6[_0xc931('0xc')]['code']===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x374016,_0x589dc6[_0xc931('0xc')][_0xc931('0xd')]);return _0x260912(_0x589dc6[_0xc931('0xc')][_0xc931('0xd')]);}logger['error'](_0xc931('0x8'),_0x374016,_0x589dc6[_0xc931('0xc')][_0xc931('0xd')]);return _0x293222(_0x589dc6[_0xc931('0xc')]['message']);}else{logger['info'](_0xc931('0x8'),_0x374016,_0xc931('0x9'));_0x293222(_0x589dc6[_0xc931('0xe')][_0xc931('0xd')]);}})[_0xc931('0xf')](function(_0x4280f1){logger[_0xc931('0xc')](_0xc931('0x8'),_0x374016,_0x4280f1);_0x260912(_0x4280f1);});});} \ No newline at end of file +var _0x1def=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','randomstring','ioredis'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x1def,0x9f));var _0xf1de=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x1def[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0xf1de('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf1de('0x1'));var fs=require('fs');var Redis=require(_0xf1de('0x2'));var db=require(_0xf1de('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf1de('0x4'))(_0xf1de('0x5'));var config=require(_0xf1de('0x6'));var jayson=require(_0xf1de('0x7'));var client=jayson[_0xf1de('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x164271,_0x4bb686,_0x2e20c1){return new BPromise(function(_0x28f501,_0x15451b){return client[_0xf1de('0x9')](_0x164271,_0x2e20c1)[_0xf1de('0xa')](function(_0x2a1848){logger['info'](_0xf1de('0xb'),_0x4bb686,_0xf1de('0xc'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4bb686,_0xf1de('0xc'),JSON['stringify'](_0x2a1848));if(_0x2a1848[_0xf1de('0xd')]){if(_0x2a1848[_0xf1de('0xd')][_0xf1de('0xe')]===0x1f4){logger[_0xf1de('0xd')](_0xf1de('0xb'),_0x4bb686,_0x2a1848[_0xf1de('0xd')][_0xf1de('0xf')]);return _0x15451b(_0x2a1848[_0xf1de('0xd')][_0xf1de('0xf')]);}logger[_0xf1de('0xd')](_0xf1de('0xb'),_0x4bb686,_0x2a1848['error'][_0xf1de('0xf')]);return _0x28f501(_0x2a1848[_0xf1de('0xd')][_0xf1de('0xf')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x4bb686,'request\x20sent');_0x28f501(_0x2a1848[_0xf1de('0x10')][_0xf1de('0xf')]);}})[_0xf1de('0x11')](function(_0x393f08){logger[_0xf1de('0xd')](_0xf1de('0xb'),_0x4bb686,_0x393f08);_0x15451b(_0x393f08);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f5ca11a..e3ad81f 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(_0x4a9dd3,_0x378439){var _0x14bb4b=function(_0x5c9204){while(--_0x5c9204){_0x4a9dd3['push'](_0x4a9dd3['shift']());}};_0x14bb4b(++_0x378439);}(_0x70e0,0x17b));var _0x070e=function(_0xac674f,_0x379d51){_0xac674f=_0xac674f-0x0;var _0xebc81=_0x70e0[_0xac674f];return _0xebc81;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3ed091,_0x3491d4){var _0x49f07c=function(_0x296cbc){while(--_0x296cbc){_0x3ed091['push'](_0x3ed091['shift']());}};_0x49f07c(++_0x3491d4);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2f5862e..2e66ea0 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 _0x2f02=['sequelize','exports'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x2f02,0x11e));var _0x22f0=function(_0x4287fe,_0x14ad49){_0x4287fe=_0x4287fe-0x0;var _0x329a39=_0x2f02[_0x4287fe];return _0x329a39;};'use strict';var Sequelize=require(_0x22f0('0x0'));module[_0x22f0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x91ea=['exports','INTEGER','sequelize'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0x91ea,0x92));var _0xa91e=function(_0x1f1f2d,_0xcf9b51){_0x1f1f2d=_0x1f1f2d-0x0;var _0x1b9160=_0x91ea[_0x1f1f2d];return _0x1b9160;};'use strict';var Sequelize=require(_0xa91e('0x0'));module[_0xa91e('0x1')]={'penalty':{'type':Sequelize[_0xa91e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index f8e27ef..9c133bf 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 _0xa013=['moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','util','../../config/logger','api'];(function(_0x594cd2,_0x31896d){var _0x17a200=function(_0x28f8a6){while(--_0x28f8a6){_0x594cd2['push'](_0x594cd2['shift']());}};_0x17a200(++_0x31896d);}(_0xa013,0xbd));var _0x3a01=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0xa013[_0x119705];return _0x2affc2;};'use strict';var _=require('lodash');var util=require(_0x3a01('0x0'));var logger=require(_0x3a01('0x1'))(_0x3a01('0x2'));var moment=require(_0x3a01('0x3'));var BPromise=require(_0x3a01('0x4'));var rp=require(_0x3a01('0x5'));var fs=require('fs');var path=require(_0x3a01('0x6'));var rimraf=require(_0x3a01('0x7'));var config=require('../../config/environment');var attributes=require(_0x3a01('0x8'));module[_0x3a01('0x9')]=function(_0x42eee5,_0x52a9a8){return _0x42eee5[_0x3a01('0xa')](_0x3a01('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4350=['request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','api','moment','bluebird'];(function(_0xa828c,_0xf69d03){var _0x2df6fc=function(_0x28541b){while(--_0x28541b){_0xa828c['push'](_0xa828c['shift']());}};_0x2df6fc(++_0xf69d03);}(_0x4350,0x167));var _0x0435=function(_0x45555f,_0x5baa1b){_0x45555f=_0x45555f-0x0;var _0x43a0b6=_0x4350[_0x45555f];return _0x43a0b6;};'use strict';var _=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var logger=require('../../config/logger')(_0x0435('0x2'));var moment=require(_0x0435('0x3'));var BPromise=require(_0x0435('0x4'));var rp=require(_0x0435('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0435('0x6'));var config=require(_0x0435('0x7'));var attributes=require(_0x0435('0x8'));module[_0x0435('0x9')]=function(_0x42f3e0,_0x53b45d){return _0x42f3e0[_0x0435('0xa')](_0x0435('0xb'),attributes,{'tableName':_0x0435('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 40d8663..b75336e 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x177ab0,_0x24fed6){var _0x2cba32=function(_0x3c67d6){while(--_0x3c67d6){_0x177ab0['push'](_0x177ab0['shift']());}};_0x2cba32(++_0x24fed6);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x008c,0x188));var _0xc008=function(_0x1fbf82,_0x5a47f3){_0x1fbf82=_0x1fbf82-0x0;var _0x2374a5=_0x008c[_0x1fbf82];return _0x2374a5;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 192ff3d..5427c30 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 _0x947d=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','isAuthenticated','exports'];(function(_0x23f564,_0x48d2ba){var _0x47582b=function(_0x3a8876){while(--_0x3a8876){_0x23f564['push'](_0x23f564['shift']());}};_0x47582b(++_0x48d2ba);}(_0x947d,0x118));var _0xd947=function(_0x5c965a,_0x42cc16){_0x5c965a=_0x5c965a-0x0;var _0x3b6bd9=_0x947d[_0x5c965a];return _0x3b6bd9;};'use strict';var multer=require('multer');var util=require(_0xd947('0x0'));var path=require('path');var timeout=require(_0xd947('0x1'));var express=require(_0xd947('0x2'));var router=express[_0xd947('0x3')]();var fs_extra=require(_0xd947('0x4'));var auth=require(_0xd947('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd947('0x6'));var controller=require(_0xd947('0x7'));router['post']('/',auth[_0xd947('0x8')](),controller['sendUserNotification']);module[_0xd947('0x9')]=router; \ No newline at end of file +var _0x7809=['isAuthenticated','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x7809,0x178));var _0x9780=function(_0x37d11c,_0x3b72e2){_0x37d11c=_0x37d11c-0x0;var _0x35f57f=_0x7809[_0x37d11c];return _0x35f57f;};'use strict';var multer=require(_0x9780('0x0'));var util=require(_0x9780('0x1'));var path=require('path');var timeout=require(_0x9780('0x2'));var express=require('express');var router=express[_0x9780('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9780('0x4'));var interaction=require(_0x9780('0x5'));var config=require(_0x9780('0x6'));var controller=require(_0x9780('0x7'));router[_0x9780('0x8')]('/',auth[_0x9780('0x9')](),controller['sendUserNotification']);module[_0x9780('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0a0c7cc..d8bbaef 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 _0xbd54=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x1eca35,_0x214670){var _0x1d565f=function(_0x10855f){while(--_0x10855f){_0x1eca35['push'](_0x1eca35['shift']());}};_0x1d565f(++_0x214670);}(_0xbd54,0x104));var _0x4bd5=function(_0x588bf2,_0xe6fb8){_0x588bf2=_0x588bf2-0x0;var _0x571db3=_0xbd54[_0x588bf2];return _0x571db3;};'use strict';var Sequelize=require(_0x4bd5('0x0'));module[_0x4bd5('0x1')]={'body':{'type':Sequelize[_0x4bd5('0x2')]},'senderName':{'type':Sequelize[_0x4bd5('0x3')]},'recipientsId':{'type':Sequelize[_0x4bd5('0x2')]},'recipientsDescription':{'type':Sequelize[_0x4bd5('0x3')]},'beep':{'type':Sequelize[_0x4bd5('0x4')]}}; \ No newline at end of file +var _0xb166=['TEXT','BOOLEAN','sequelize','exports','STRING'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0xb166,0x1ab));var _0x6b16=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0xb166[_0x9b5bb2];return _0x2e1e92;};'use strict';var Sequelize=require(_0x6b16('0x0'));module[_0x6b16('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x6b16('0x2')]},'recipientsId':{'type':Sequelize[_0x6b16('0x3')]},'recipientsDescription':{'type':Sequelize[_0x6b16('0x2')]},'beep':{'type':Sequelize[_0x6b16('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d87a9e8..f5374e7 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 _0xe794=['findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','queue','replace','Queue','ids','all','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','end','error','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','recipientsId','join','sequelize','transaction','UserNotification','create','beep','forEach','recipient','emit','userNotification:send','catch','Template'];(function(_0x57fb52,_0x5201a7){var _0x313a9c=function(_0x5241e0){while(--_0x5241e0){_0x57fb52['push'](_0x57fb52['shift']());}};_0x313a9c(++_0x5201a7);}(_0xe794,0x13d));var _0x4e79=function(_0x11a984,_0x3fd55c){_0x11a984=_0x11a984-0x0;var _0x324b97=_0xe794[_0x11a984];return _0x324b97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e79('0x0'));var zipdir=require(_0x4e79('0x1'));var jsonpatch=require(_0x4e79('0x2'));var rp=require(_0x4e79('0x3'));var moment=require(_0x4e79('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4e79('0x5'));var util=require(_0x4e79('0x6'));var path=require(_0x4e79('0x7'));var sox=require(_0x4e79('0x8'));var csv=require(_0x4e79('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4e79('0xa'));var crypto=require(_0x4e79('0xb'));var jsforce=require(_0x4e79('0xc'));var deskjs=require(_0x4e79('0xd'));var toCsv=require(_0x4e79('0x9'));var querystring=require(_0x4e79('0xe'));var Papa=require(_0x4e79('0xf'));var Redis=require(_0x4e79('0x10'));var authService=require(_0x4e79('0x11'));var qs=require(_0x4e79('0x12'));var as=require(_0x4e79('0x13'));var hardwareService=require(_0x4e79('0x14'));var logger=require('../../config/logger')(_0x4e79('0x15'));var utils=require(_0x4e79('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4e79('0x17'));var db=require('../../mysqldb')['db'];config[_0x4e79('0x18')]=_['defaults'](config['redis'],{'host':_0x4e79('0x19'),'port':0x18eb});var socket=require(_0x4e79('0x1a'))(new Redis(config[_0x4e79('0x18')]));require(_0x4e79('0x1b'))[_0x4e79('0x1c')](socket);function respondWithStatusCode(_0x4bad04,_0x356ad1){_0x356ad1=_0x356ad1||0xcc;return function(_0x99924f){if(_0x99924f){return _0x4bad04[_0x4e79('0x1d')](_0x356ad1);}return _0x4bad04[_0x4e79('0x1e')](_0x356ad1)['end']();};}function respondWithResult(_0x2714da,_0x30aa94){_0x30aa94=_0x30aa94||0xc8;return function(_0x583182){if(_0x583182){return _0x2714da[_0x4e79('0x1e')](_0x30aa94)[_0x4e79('0x1f')](_0x583182);}};}function respondWithFilteredResult(_0x38a967,_0x15ea28){return function(_0x417985){if(_0x417985){var _0x1ffead=typeof _0x15ea28[_0x4e79('0x20')]===_0x4e79('0x21')&&typeof _0x15ea28[_0x4e79('0x22')]===_0x4e79('0x21');var _0x2732b2=_0x417985[_0x4e79('0x23')];var _0x2fecf2=_0x1ffead?0x0:_0x15ea28['offset'];var _0x5e0241=_0x1ffead?_0x417985['count']:_0x15ea28[_0x4e79('0x20')]+_0x15ea28[_0x4e79('0x22')];var _0x456198;if(_0x5e0241>=_0x2732b2){_0x5e0241=_0x2732b2;_0x456198=0xc8;}else{_0x456198=0xce;}_0x38a967['status'](_0x456198);return _0x38a967[_0x4e79('0x24')](_0x4e79('0x25'),_0x2fecf2+'-'+_0x5e0241+'/'+_0x2732b2)[_0x4e79('0x1f')](_0x417985);}return null;};}function patchUpdates(_0x1f2e69){return function(_0x3faa3e){try{jsonpatch['apply'](_0x3faa3e,_0x1f2e69,!![]);}catch(_0xc3d9fb){return BPromise[_0x4e79('0x26')](_0xc3d9fb);}return _0x3faa3e[_0x4e79('0x27')]();};}function saveUpdates(_0x487b68,_0x24b201){return function(_0x5813e3){if(_0x5813e3){return _0x5813e3[_0x4e79('0x28')](_0x487b68)['then'](function(_0x102eab){return _0x102eab;});}return null;};}function removeEntity(_0x2dbadc,_0x3eb312){return function(_0x53f4ae){if(_0x53f4ae){return _0x53f4ae[_0x4e79('0x29')]()[_0x4e79('0x2a')](function(){_0x2dbadc['status'](0xcc)[_0x4e79('0x2b')]();});}};}function handleEntityNotFound(_0x5edd5d,_0x1e3cfa){return function(_0xd2fc4){if(!_0xd2fc4){_0x5edd5d[_0x4e79('0x1d')](0x194);}return _0xd2fc4;};}function handleError(_0x4b8d28,_0xa0b07){_0xa0b07=_0xa0b07||0x1f4;return function(_0x47d2de){logger[_0x4e79('0x2c')](_0x47d2de['stack']);if(_0x47d2de[_0x4e79('0x2d')]){delete _0x47d2de[_0x4e79('0x2d')];}_0x4b8d28[_0x4e79('0x1e')](_0xa0b07)['send'](_0x47d2de);};}exports[_0x4e79('0x2e')]=function(_0x50ad58,_0x15bce2,_0x3536c6){if(!_0x50ad58[_0x4e79('0x2f')][_0x4e79('0x30')](_0x4e79('0x31'))&&!_0x50ad58['body'][_0x4e79('0x30')](_0x4e79('0x32'))){throw new db[(_0x4e79('0x33'))][(_0x4e79('0x34'))](_0x4e79('0x35'));}else{if(_0x50ad58[_0x4e79('0x2f')][_0x4e79('0x30')](_0x4e79('0x32'))&&!_0x50ad58[_0x4e79('0x2f')][_0x4e79('0x30')](_0x4e79('0x36'))){throw new db[(_0x4e79('0x33'))][(_0x4e79('0x34'))](_0x4e79('0x37'));}if(!_0x50ad58[_0x4e79('0x2f')][_0x4e79('0x30')](_0x4e79('0x38'))){throw new db['Sequelize'][(_0x4e79('0x34'))](_0x4e79('0x39'));}else{try{var _0x2e8f8f=JSON[_0x4e79('0x3a')](_0x50ad58[_0x4e79('0x2f')][_0x4e79('0x38')]);}catch(_0x4f81d2){logger[_0x4e79('0x2c')](_0x4f81d2);throw new db['Sequelize'][(_0x4e79('0x34'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x23ef11=[_0x4e79('0x3b'),_0x4e79('0x3c'),_0x4e79('0x3d'),_0x4e79('0x3e'),'smsqueue','voicequeue','whatsappqueue',_0x4e79('0x3f'),_0x4e79('0x40')];if(_[_0x4e79('0x41')](_0x2e8f8f,function(_0x49a028){return!_[_0x4e79('0x42')](_0x23ef11,_0x49a028[_0x4e79('0x43')][_0x4e79('0x44')]());})){throw new db['Sequelize'][(_0x4e79('0x34'))](_0x4e79('0x45'));}}}var _0x39c678={};_0x39c678[_0x4e79('0x46')]=_0x50ad58[_0x4e79('0x2f')][_0x4e79('0x30')](_0x4e79('0x46'))?_0x50ad58['body'][_0x4e79('0x46')]:_0x50ad58[_0x4e79('0x40')][_0x4e79('0x47')];_0x39c678[_0x4e79('0x48')]=_[_0x4e79('0x49')](_0x50ad58[_0x4e79('0x2f')][_0x4e79('0x48')])?null:_0x50ad58[_0x4e79('0x2f')][_0x4e79('0x48')];_0x39c678['beep']=_0x50ad58['body']['beep']||![];_0x39c678['SenderId']=_0x50ad58[_0x4e79('0x40')]['id'];return getContent(_0x50ad58['body'])['then'](function(_0x24cf5f){_0x39c678[_0x4e79('0x2f')]=_0x24cf5f;return getRecipients(_0x2e8f8f);})[_0x4e79('0x2a')](function(_0x290976){_0x39c678[_0x4e79('0x4a')]=_['sortBy'](_0x290976)[_0x4e79('0x4b')](',');return db[_0x4e79('0x4c')][_0x4e79('0x4d')](function(_0x29ddab){return db[_0x4e79('0x4e')][_0x4e79('0x4f')](_0x39c678,{'raw':!![],'transaction':_0x29ddab})[_0x4e79('0x2a')](function(_0x2d1220){var _0x20c0bc={'sender':_0x39c678[_0x4e79('0x46')],'description':_0x39c678[_0x4e79('0x48')],'content':_0x39c678[_0x4e79('0x2f')],'beep':_0x39c678[_0x4e79('0x50')]};_0x290976[_0x4e79('0x51')](function(_0x3a39af){_0x20c0bc[_0x4e79('0x52')]=_0x3a39af;socket[_0x4e79('0x53')](_0x4e79('0x54'),_0x20c0bc);});return _0x2d1220;});});})['then'](respondWithResult(_0x15bce2,0xc9))[_0x4e79('0x55')](handleError(_0x15bce2,null));};function getContent(_0x5d8f69){return new BPromise(function(_0x207538,_0x18ea7d){if(_0x5d8f69[_0x4e79('0x31')]){_0x207538(_0x5d8f69[_0x4e79('0x31')]);return;}return db[_0x4e79('0x56')][_0x4e79('0x57')]({'attributes':[_0x4e79('0x58')],'where':{'id':_0x5d8f69[_0x4e79('0x32')]},'raw':!![]})[_0x4e79('0x2a')](function(_0x5839fb){if(!_0x5839fb)throw new db[(_0x4e79('0x33'))][(_0x4e79('0x34'))](_0x4e79('0x59'));var _0x5f4156=Mustache[_0x4e79('0x5a')](_0x5839fb[_0x4e79('0x58')],_0x5d8f69['view']);_0x207538(_0x5f4156);})[_0x4e79('0x55')](function(_0x4fc80c){_0x18ea7d(_0x4fc80c);});});}function getRecipients(_0x5918d3){return new BPromise(function(_0x410c50,_0xd9700f){var _0x59b1c9=[];var _0x31b903=[];_0x5918d3['forEach'](function(_0x1a60c7){var _0x34972e=_[_0x4e79('0x5b')](_0x1a60c7[_0x4e79('0x43')][_0x4e79('0x44')]());if(_0x34972e===_0x4e79('0x5c')){_0x59b1c9=_[_0x4e79('0x5d')](_0x59b1c9,_0x1a60c7['ids']);}else{if(_[_0x4e79('0x42')](_0x34972e,_0x4e79('0x5e')))_0x34972e=_0x34972e[_0x4e79('0x5f')](_0x4e79('0x5e'),_0x4e79('0x60'));_0x1a60c7[_0x4e79('0x61')]['forEach'](function(_0x20034c){_0x31b903['push'](getAgents(_0x34972e,_0x20034c));});}});return BPromise[_0x4e79('0x62')](_0x31b903)[_0x4e79('0x2a')](function(_0x424b7e){_0x59b1c9=_[_0x4e79('0x5d')](_0x59b1c9,_['flatten'](_0x424b7e));_0x410c50(_0x59b1c9);})[_0x4e79('0x55')](function(_0x30f700){_0xd9700f(_0x30f700);});});}function getAgents(_0xbd659d,_0x14a132){return new BPromise(function(_0x334ed1,_0xed7d40){return db[_0xbd659d][_0x4e79('0x57')]({'where':{'id':_0x14a132}})[_0x4e79('0x2a')](function(_0x2fd9ee){return _0x2fd9ee[_0x4e79('0x63')]({'attributes':['id'],'raw':!![]})['then'](function(_0x43398e){var _0x38e0e7=_[_0x4e79('0x64')](_0x43398e,'id');_0x334ed1(_0x38e0e7);});})[_0x4e79('0x55')](function(_0x657c84){_0xed7d40(_0x657c84);});});} \ No newline at end of file +var _0xf9b9=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./userNotification.socket','register','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','sendStatus','error','stack','name','send','sendUserNotification','body','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','Sequelize','Missing\x20\x27recipients\x27\x20parameter','chatqueue','mailqueue','team','user','some','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','then','sortBy','join','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','toLowerCase','User','ids','includes','queue','Queue','all','union','flatten','getAgents','map','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x2dd752,_0x59b4fc){var _0x297823=function(_0x44a37f){while(--_0x44a37f){_0x2dd752['push'](_0x2dd752['shift']());}};_0x297823(++_0x59b4fc);}(_0xf9b9,0x15a));var _0x9f9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf9b9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9f9b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f9b('0x1'));var BPromise=require(_0x9f9b('0x2'));var Mustache=require(_0x9f9b('0x3'));var util=require('util');var path=require('path');var sox=require(_0x9f9b('0x4'));var csv=require(_0x9f9b('0x5'));var ejs=require(_0x9f9b('0x6'));var fs=require('fs');var fs_extra=require(_0x9f9b('0x7'));var _=require('lodash');var squel=require(_0x9f9b('0x8'));var crypto=require('crypto');var jsforce=require(_0x9f9b('0x9'));var deskjs=require(_0x9f9b('0xa'));var toCsv=require(_0x9f9b('0x5'));var querystring=require(_0x9f9b('0xb'));var Papa=require('papaparse');var Redis=require(_0x9f9b('0xc'));var authService=require(_0x9f9b('0xd'));var qs=require(_0x9f9b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f9b('0xf'));var logger=require(_0x9f9b('0x10'))(_0x9f9b('0x11'));var utils=require(_0x9f9b('0x12'));var config=require(_0x9f9b('0x13'));var licenseUtil=require(_0x9f9b('0x14'));var db=require(_0x9f9b('0x15'))['db'];config[_0x9f9b('0x16')]=_['defaults'](config[_0x9f9b('0x16')],{'host':_0x9f9b('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9f9b('0x18'))[_0x9f9b('0x19')](socket);function respondWithStatusCode(_0x2123b6,_0x9f0e66){_0x9f0e66=_0x9f0e66||0xcc;return function(_0x2c086c){if(_0x2c086c){return _0x2123b6['sendStatus'](_0x9f0e66);}return _0x2123b6[_0x9f9b('0x1a')](_0x9f0e66)['end']();};}function respondWithResult(_0x5b965a,_0x530722){_0x530722=_0x530722||0xc8;return function(_0x5e3a1c){if(_0x5e3a1c){return _0x5b965a[_0x9f9b('0x1a')](_0x530722)['json'](_0x5e3a1c);}};}function respondWithFilteredResult(_0x2e1928,_0x34ea9b){return function(_0xa620e6){if(_0xa620e6){var _0x36ce8a=typeof _0x34ea9b[_0x9f9b('0x1b')]==='undefined'&&typeof _0x34ea9b[_0x9f9b('0x1c')]===_0x9f9b('0x1d');var _0x12bb33=_0xa620e6['count'];var _0x324b49=_0x36ce8a?0x0:_0x34ea9b[_0x9f9b('0x1b')];var _0x142fed=_0x36ce8a?_0xa620e6[_0x9f9b('0x1e')]:_0x34ea9b[_0x9f9b('0x1b')]+_0x34ea9b['limit'];var _0x1f75b0;if(_0x142fed>=_0x12bb33){_0x142fed=_0x12bb33;_0x1f75b0=0xc8;}else{_0x1f75b0=0xce;}_0x2e1928['status'](_0x1f75b0);return _0x2e1928[_0x9f9b('0x1f')](_0x9f9b('0x20'),_0x324b49+'-'+_0x142fed+'/'+_0x12bb33)[_0x9f9b('0x21')](_0xa620e6);}return null;};}function patchUpdates(_0x3ed550){return function(_0xadc599){try{jsonpatch['apply'](_0xadc599,_0x3ed550,!![]);}catch(_0x3529e3){return BPromise[_0x9f9b('0x22')](_0x3529e3);}return _0xadc599[_0x9f9b('0x23')]();};}function saveUpdates(_0x2fec06,_0x24b170){return function(_0xdd9178){if(_0xdd9178){return _0xdd9178[_0x9f9b('0x24')](_0x2fec06)['then'](function(_0x3cf9b6){return _0x3cf9b6;});}return null;};}function removeEntity(_0x5bfe3a,_0x4bbca4){return function(_0x7def7d){if(_0x7def7d){return _0x7def7d[_0x9f9b('0x25')]()['then'](function(){_0x5bfe3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f54d7,_0xc33b1f){return function(_0xdaeb82){if(!_0xdaeb82){_0x2f54d7[_0x9f9b('0x26')](0x194);}return _0xdaeb82;};}function handleError(_0x4713f7,_0x341632){_0x341632=_0x341632||0x1f4;return function(_0x13bad7){logger[_0x9f9b('0x27')](_0x13bad7[_0x9f9b('0x28')]);if(_0x13bad7[_0x9f9b('0x29')]){delete _0x13bad7[_0x9f9b('0x29')];}_0x4713f7[_0x9f9b('0x1a')](_0x341632)[_0x9f9b('0x2a')](_0x13bad7);};}exports[_0x9f9b('0x2b')]=function(_0xe40993,_0x348acc,_0x13eb47){if(!_0xe40993[_0x9f9b('0x2c')]['hasOwnProperty'](_0x9f9b('0x2d'))&&!_0xe40993[_0x9f9b('0x2c')]['hasOwnProperty'](_0x9f9b('0x2e'))){throw new db['Sequelize'][(_0x9f9b('0x2f'))](_0x9f9b('0x30'));}else{if(_0xe40993['body'][_0x9f9b('0x31')]('TemplateId')&&!_0xe40993['body'][_0x9f9b('0x31')](_0x9f9b('0x32'))){throw new db[(_0x9f9b('0x33'))][(_0x9f9b('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xe40993[_0x9f9b('0x2c')]['hasOwnProperty']('recipients')){throw new db['Sequelize'][(_0x9f9b('0x2f'))](_0x9f9b('0x34'));}else{try{var _0x2ea8cf=JSON['parse'](_0xe40993[_0x9f9b('0x2c')]['recipients']);}catch(_0x53698b){logger[_0x9f9b('0x27')](_0x53698b);throw new db[(_0x9f9b('0x33'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x5e74bb=[_0x9f9b('0x35'),'faxqueue',_0x9f9b('0x36'),'openchannelqueue','smsqueue','voicequeue','whatsappqueue',_0x9f9b('0x37'),_0x9f9b('0x38')];if(_[_0x9f9b('0x39')](_0x2ea8cf,function(_0xdb678b){return!_['includes'](_0x5e74bb,_0xdb678b['model']['toLowerCase']());})){throw new db['Sequelize'][(_0x9f9b('0x2f'))](_0x9f9b('0x3a'));}}}var _0x3b4f67={};_0x3b4f67[_0x9f9b('0x3b')]=_0xe40993[_0x9f9b('0x2c')][_0x9f9b('0x31')](_0x9f9b('0x3b'))?_0xe40993[_0x9f9b('0x2c')][_0x9f9b('0x3b')]:_0xe40993[_0x9f9b('0x38')]['fullname'];_0x3b4f67[_0x9f9b('0x3c')]=_[_0x9f9b('0x3d')](_0xe40993[_0x9f9b('0x2c')][_0x9f9b('0x3c')])?null:_0xe40993[_0x9f9b('0x2c')][_0x9f9b('0x3c')];_0x3b4f67[_0x9f9b('0x3e')]=_0xe40993[_0x9f9b('0x2c')][_0x9f9b('0x3e')]||![];_0x3b4f67['SenderId']=_0xe40993[_0x9f9b('0x38')]['id'];return getContent(_0xe40993['body'])[_0x9f9b('0x3f')](function(_0x13b00c){_0x3b4f67[_0x9f9b('0x2c')]=_0x13b00c;return getRecipients(_0x2ea8cf);})['then'](function(_0x48a49b){_0x3b4f67['recipientsId']=_[_0x9f9b('0x40')](_0x48a49b)[_0x9f9b('0x41')](',');return db[_0x9f9b('0x42')][_0x9f9b('0x43')](function(_0x3a22ca){return db[_0x9f9b('0x44')]['create'](_0x3b4f67,{'raw':!![],'transaction':_0x3a22ca})[_0x9f9b('0x3f')](function(_0x187099){var _0x47f373={'sender':_0x3b4f67['senderName'],'description':_0x3b4f67[_0x9f9b('0x3c')],'content':_0x3b4f67[_0x9f9b('0x2c')],'beep':_0x3b4f67[_0x9f9b('0x3e')]};_0x48a49b['forEach'](function(_0x1175f8){_0x47f373[_0x9f9b('0x45')]=_0x1175f8;socket[_0x9f9b('0x46')](_0x9f9b('0x47'),_0x47f373);});return _0x187099;});});})['then'](respondWithResult(_0x348acc,0xc9))[_0x9f9b('0x48')](handleError(_0x348acc,null));};function getContent(_0x45ed1c){return new BPromise(function(_0x3a1d03,_0x39796e){if(_0x45ed1c[_0x9f9b('0x2d')]){_0x3a1d03(_0x45ed1c[_0x9f9b('0x2d')]);return;}return db[_0x9f9b('0x49')][_0x9f9b('0x4a')]({'attributes':[_0x9f9b('0x4b')],'where':{'id':_0x45ed1c['TemplateId']},'raw':!![]})[_0x9f9b('0x3f')](function(_0x546cb9){if(!_0x546cb9)throw new db[(_0x9f9b('0x33'))]['ValidationError'](_0x9f9b('0x4c'));var _0x1cad4c=Mustache[_0x9f9b('0x4d')](_0x546cb9[_0x9f9b('0x4b')],_0x45ed1c['view']);_0x3a1d03(_0x1cad4c);})[_0x9f9b('0x48')](function(_0x5996a7){_0x39796e(_0x5996a7);});});}function getRecipients(_0x495a24){return new BPromise(function(_0x33f821,_0x2b7ab0){var _0xf93c4f=[];var _0x4f67cb=[];_0x495a24[_0x9f9b('0x4e')](function(_0xa79013){var _0x43c1de=_[_0x9f9b('0x4f')](_0xa79013['model'][_0x9f9b('0x50')]());if(_0x43c1de===_0x9f9b('0x51')){_0xf93c4f=_['union'](_0xf93c4f,_0xa79013[_0x9f9b('0x52')]);}else{if(_[_0x9f9b('0x53')](_0x43c1de,'queue'))_0x43c1de=_0x43c1de['replace'](_0x9f9b('0x54'),_0x9f9b('0x55'));_0xa79013['ids'][_0x9f9b('0x4e')](function(_0x1cecc9){_0x4f67cb['push'](getAgents(_0x43c1de,_0x1cecc9));});}});return BPromise[_0x9f9b('0x56')](_0x4f67cb)[_0x9f9b('0x3f')](function(_0x40011a){_0xf93c4f=_[_0x9f9b('0x57')](_0xf93c4f,_[_0x9f9b('0x58')](_0x40011a));_0x33f821(_0xf93c4f);})[_0x9f9b('0x48')](function(_0x4a2275){_0x2b7ab0(_0x4a2275);});});}function getAgents(_0x243b73,_0x2fede0){return new BPromise(function(_0x4b447d,_0x24d5f8){return db[_0x243b73]['findOne']({'where':{'id':_0x2fede0}})[_0x9f9b('0x3f')](function(_0x6984a7){return _0x6984a7[_0x9f9b('0x59')]({'attributes':['id'],'raw':!![]})['then'](function(_0x576089){var _0x47f97c=_[_0x9f9b('0x5a')](_0x576089,'id');_0x4b447d(_0x47f97c);});})['catch'](function(_0x8b3182){_0x24d5f8(_0x8b3182);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7397221..ecc9988 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 _0xbd4b=['hook','UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0xbd4b,0x174));var _0xbbd4=function(_0x28b3f2,_0x4e616c){_0x28b3f2=_0x28b3f2-0x0;var _0x16879b=_0xbd4b[_0x28b3f2];return _0x16879b;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0xbbd4('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xbbd4('0x1')](0x0);var events={'afterCreate':_0xbbd4('0x2'),'afterUpdate':'update','afterDestroy':_0xbbd4('0x3')};function emitEvent(_0x491311){return function(_0x2cb66f,_0x1d473e,_0x3d97ee){UserNotificationEvents[_0xbbd4('0x4')](_0x491311+':'+_0x2cb66f['id'],_0x2cb66f);UserNotificationEvents[_0xbbd4('0x4')](_0x491311,_0x2cb66f);_0x3d97ee(null);};}for(var e in events){if(events[_0xbbd4('0x5')](e)){var event=events[e];UserNotification[_0xbbd4('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x814b=['save','update','remove','emit','hasOwnProperty','hook','events','UserNotification','setMaxListeners'];(function(_0x3006db,_0x5d2a9b){var _0x2ecb92=function(_0x56621f){while(--_0x56621f){_0x3006db['push'](_0x3006db['shift']());}};_0x2ecb92(++_0x5d2a9b);}(_0x814b,0x114));var _0xb814=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0x814b[_0x21f9c2];return _0x3da17f;};'use strict';var EventEmitter=require(_0xb814('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xb814('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb814('0x2')](0x0);var events={'afterCreate':_0xb814('0x3'),'afterUpdate':_0xb814('0x4'),'afterDestroy':_0xb814('0x5')};function emitEvent(_0x10b3cc){return function(_0x290a42,_0x3f98ee,_0x394334){UserNotificationEvents[_0xb814('0x6')](_0x10b3cc+':'+_0x290a42['id'],_0x290a42);UserNotificationEvents[_0xb814('0x6')](_0x10b3cc,_0x290a42);_0x394334(null);};}for(var e in events){if(events[_0xb814('0x7')](e)){var event=events[e];UserNotification[_0xb814('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 451ce62..6c80b61 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 _0x3760=['./userNotification.attributes','userNotifications','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3760,0x157));var _0x0376=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0x3760[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0x0376('0x0'));var util=require('util');var logger=require(_0x0376('0x1'))('api');var moment=require(_0x0376('0x2'));var BPromise=require(_0x0376('0x3'));var rp=require(_0x0376('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0376('0x5'));var config=require(_0x0376('0x6'));var attributes=require(_0x0376('0x7'));module['exports']=function(_0x397306,_0x190425){return _0x397306['define']('UserNotification',attributes,{'tableName':_0x0376('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0376('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc3af=['api','bluebird','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2016d8,_0x100b3d){var _0xe519af=function(_0x585b14){while(--_0x585b14){_0x2016d8['push'](_0x2016d8['shift']());}};_0xe519af(++_0x100b3d);}(_0xc3af,0x112));var _0xfc3a=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0xc3af[_0x2ade6c];return _0x2cb372;};'use strict';var _=require(_0xfc3a('0x0'));var util=require(_0xfc3a('0x1'));var logger=require('../../config/logger')(_0xfc3a('0x2'));var moment=require('moment');var BPromise=require(_0xfc3a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc3a('0x4'));var config=require('../../config/environment');var attributes=require(_0xfc3a('0x5'));module[_0xfc3a('0x6')]=function(_0x20c214,_0x5dedef){return _0x20c214[_0xfc3a('0x7')](_0xfc3a('0x8'),attributes,{'tableName':_0xfc3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfc3a('0xa'),'collate':_0xfc3a('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index adbbef5..317d9fb 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 _0x11b9=['result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x30a193,_0x158ad6){var _0x5d6ccd=function(_0xaf5a46){while(--_0xaf5a46){_0x30a193['push'](_0x30a193['shift']());}};_0x5d6ccd(++_0x158ad6);}(_0x11b9,0x9e));var _0x911b=function(_0x12b345,_0x60adea){_0x12b345=_0x12b345-0x0;var _0x378c6d=_0x11b9[_0x12b345];return _0x378c6d;};'use strict';var _=require(_0x911b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x911b('0x1'));var rs=require(_0x911b('0x2'));var fs=require('fs');var Redis=require(_0x911b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x911b('0x4'))(_0x911b('0x5'));var config=require(_0x911b('0x6'));var jayson=require(_0x911b('0x7'));var client=jayson[_0x911b('0x8')]['http']({'port':0x232a});config['redis']=_[_0x911b('0x9')](config[_0x911b('0xa')],{'host':_0x911b('0xb'),'port':0x18eb});var socket=require(_0x911b('0xc'))(new Redis(config[_0x911b('0xa')]));require(_0x911b('0xd'))[_0x911b('0xe')](socket);function respondWithRpcPromise(_0x1f5413,_0x26a4cc,_0x1e7ead){return new BPromise(function(_0x43a155,_0x2673e8){return client['request'](_0x1f5413,_0x1e7ead)[_0x911b('0xf')](function(_0x9793b5){logger['info'](_0x911b('0x10'),_0x26a4cc,_0x911b('0x11'));logger[_0x911b('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x26a4cc,_0x911b('0x11'),JSON[_0x911b('0x13')](_0x9793b5));if(_0x9793b5[_0x911b('0x14')]){if(_0x9793b5['error'][_0x911b('0x15')]===0x1f4){logger['error'](_0x911b('0x10'),_0x26a4cc,_0x9793b5[_0x911b('0x14')][_0x911b('0x16')]);return _0x2673e8(_0x9793b5[_0x911b('0x14')][_0x911b('0x16')]);}logger[_0x911b('0x14')](_0x911b('0x10'),_0x26a4cc,_0x9793b5[_0x911b('0x14')]['message']);return _0x43a155(_0x9793b5[_0x911b('0x14')][_0x911b('0x16')]);}else{logger[_0x911b('0x17')](_0x911b('0x10'),_0x26a4cc,'request\x20sent');_0x43a155(_0x9793b5[_0x911b('0x18')][_0x911b('0x16')]);}})[_0x911b('0x19')](function(_0x47d844){logger[_0x911b('0x14')](_0x911b('0x10'),_0x26a4cc,_0x47d844);_0x2673e8(_0x47d844);});});} \ No newline at end of file +var _0x86b1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x345c86,_0x1bd36e){var _0xf5e63d=function(_0x65d1c2){while(--_0x65d1c2){_0x345c86['push'](_0x345c86['shift']());}};_0xf5e63d(++_0x1bd36e);}(_0x86b1,0x132));var _0x186b=function(_0x46042d,_0x3a1a09){_0x46042d=_0x46042d-0x0;var _0x301323=_0x86b1[_0x46042d];return _0x301323;};'use strict';var _=require(_0x186b('0x0'));var util=require(_0x186b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x186b('0x2'));var db=require(_0x186b('0x3'))['db'];var utils=require(_0x186b('0x4'));var logger=require(_0x186b('0x5'))(_0x186b('0x6'));var config=require('../../config/environment');var jayson=require(_0x186b('0x7'));var client=jayson[_0x186b('0x8')][_0x186b('0x9')]({'port':0x232a});config[_0x186b('0xa')]=_[_0x186b('0xb')](config[_0x186b('0xa')],{'host':_0x186b('0xc'),'port':0x18eb});var socket=require(_0x186b('0xd'))(new Redis(config[_0x186b('0xa')]));require(_0x186b('0xe'))[_0x186b('0xf')](socket);function respondWithRpcPromise(_0x1761e9,_0x50f798,_0xbeb2fd){return new BPromise(function(_0x45f871,_0x5c878d){return client[_0x186b('0x10')](_0x1761e9,_0xbeb2fd)['then'](function(_0x5b4604){logger[_0x186b('0x11')](_0x186b('0x12'),_0x50f798,_0x186b('0x13'));logger[_0x186b('0x14')](_0x186b('0x15'),_0x50f798,'request\x20sent',JSON[_0x186b('0x16')](_0x5b4604));if(_0x5b4604[_0x186b('0x17')]){if(_0x5b4604[_0x186b('0x17')][_0x186b('0x18')]===0x1f4){logger['error'](_0x186b('0x12'),_0x50f798,_0x5b4604[_0x186b('0x17')]['message']);return _0x5c878d(_0x5b4604[_0x186b('0x17')]['message']);}logger[_0x186b('0x17')](_0x186b('0x12'),_0x50f798,_0x5b4604[_0x186b('0x17')][_0x186b('0x19')]);return _0x45f871(_0x5b4604[_0x186b('0x17')][_0x186b('0x19')]);}else{logger[_0x186b('0x11')](_0x186b('0x12'),_0x50f798,'request\x20sent');_0x45f871(_0x5b4604[_0x186b('0x1a')][_0x186b('0x19')]);}})[_0x186b('0x1b')](function(_0x54822d){logger['error'](_0x186b('0x12'),_0x50f798,_0x54822d);_0x5c878d(_0x54822d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5264673..501effb 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 _0x2091=['remove','emit','removeListener','register','userNotification:','save'];(function(_0x116ff4,_0x14b84d){var _0x273964=function(_0x171e0c){while(--_0x171e0c){_0x116ff4['push'](_0x116ff4['shift']());}};_0x273964(++_0x14b84d);}(_0x2091,0xcb));var _0x1209=function(_0x387e84,_0x5fffe7){_0x387e84=_0x387e84-0x0;var _0x1add03=_0x2091[_0x387e84];return _0x1add03;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x1209('0x0'),_0x1209('0x1'),'update'];function createListener(_0x425748,_0x13d0e1){return function(_0xd33fbe){_0x13d0e1[_0x1209('0x2')](_0x425748,_0xd33fbe);};}function removeListener(_0x44bade,_0x46567d){return function(){UserNotificationEvents[_0x1209('0x3')](_0x44bade,_0x46567d);};}exports[_0x1209('0x4')]=function(_0x4e561c){for(var _0x49d2f1=0x0,_0x4341a1=events['length'];_0x49d2f1<_0x4341a1;_0x49d2f1++){var _0x3c7d22=events[_0x49d2f1];var _0x23d247=createListener(_0x1209('0x5')+_0x3c7d22,_0x4e561c);UserNotificationEvents['on'](_0x3c7d22,_0x23d247);}}; \ No newline at end of file +var _0x5ab5=['emit','removeListener','length','userNotification:','remove','update'];(function(_0x2d202c,_0x1ca655){var _0x1be60c=function(_0x2ea1e5){while(--_0x2ea1e5){_0x2d202c['push'](_0x2d202c['shift']());}};_0x1be60c(++_0x1ca655);}(_0x5ab5,0x16c));var _0x55ab=function(_0x5647cf,_0x292b9e){_0x5647cf=_0x5647cf-0x0;var _0x4fecb9=_0x5ab5[_0x5647cf];return _0x4fecb9;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save',_0x55ab('0x0'),_0x55ab('0x1')];function createListener(_0x276ba1,_0x277013){return function(_0x1b70dd){_0x277013[_0x55ab('0x2')](_0x276ba1,_0x1b70dd);};}function removeListener(_0x14d4b2,_0xab3e58){return function(){UserNotificationEvents[_0x55ab('0x3')](_0x14d4b2,_0xab3e58);};}exports['register']=function(_0xaba743){for(var _0x1edbab=0x0,_0x37e0b9=events[_0x55ab('0x4')];_0x1edbab<_0x37e0b9;_0x1edbab++){var _0x3d29cf=events[_0x1edbab];var _0xb3a989=createListener(_0x55ab('0x5')+_0x3d29cf,_0xaba743);UserNotificationEvents['on'](_0x3d29cf,_0xb3a989);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f11104d..62ecf4d 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(_0x371841,_0x30d8db){var _0xc41d83=function(_0x2ca64d){while(--_0x2ca64d){_0x371841['push'](_0x371841['shift']());}};_0xc41d83(++_0x30d8db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x19da50,_0x115627){var _0x117317=function(_0x455621){while(--_0x455621){_0x19da50['push'](_0x19da50['shift']());}};_0x117317(++_0x115627);}(_0xedd9,0xfc));var _0x9edd=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0xedd9[_0x39a04c];return _0x580cb0;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 6c7ed11..d5f6d43 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 _0x7768=['INTEGER','sequelize','exports'];(function(_0x2c38f2,_0x432576){var _0x3db426=function(_0x85279d){while(--_0x85279d){_0x2c38f2['push'](_0x2c38f2['shift']());}};_0x3db426(++_0x432576);}(_0x7768,0x1ea));var _0x8776=function(_0x4b5570,_0x4bc370){_0x4b5570=_0x4b5570-0x0;var _0x677eee=_0x7768[_0x4b5570];return _0x677eee;};'use strict';var Sequelize=require(_0x8776('0x0'));module[_0x8776('0x1')]={'penalty':{'type':Sequelize[_0x8776('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5035=['exports'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0x5035,0x1da));var _0x5503=function(_0x5d45df,_0x50c787){_0x5d45df=_0x5d45df-0x0;var _0x705c9a=_0x5035[_0x5d45df];return _0x705c9a;};'use strict';var Sequelize=require('sequelize');module[_0x5503('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 453a30d..810052e 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 _0x5e50=['user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x1d3fdc,_0x2b5c54){var _0x128bb0=function(_0x3b7184){while(--_0x3b7184){_0x1d3fdc['push'](_0x1d3fdc['shift']());}};_0x128bb0(++_0x2b5c54);}(_0x5e50,0x97));var _0x05e5=function(_0x336eae,_0x576f2b){_0x336eae=_0x336eae-0x0;var _0x1d6e0a=_0x5e50[_0x336eae];return _0x1d6e0a;};'use strict';var _=require(_0x05e5('0x0'));var util=require(_0x05e5('0x1'));var logger=require(_0x05e5('0x2'))(_0x05e5('0x3'));var moment=require(_0x05e5('0x4'));var BPromise=require(_0x05e5('0x5'));var rp=require(_0x05e5('0x6'));var fs=require('fs');var path=require(_0x05e5('0x7'));var rimraf=require(_0x05e5('0x8'));var config=require(_0x05e5('0x9'));var attributes=require(_0x05e5('0xa'));module[_0x05e5('0xb')]=function(_0x482a4f,_0x50b31a){return _0x482a4f[_0x05e5('0xc')](_0x05e5('0xd'),attributes,{'tableName':_0x05e5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa637=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x39236e,_0xbc4e64){var _0xfa840a=function(_0x114e1a){while(--_0x114e1a){_0x39236e['push'](_0x39236e['shift']());}};_0xfa840a(++_0xbc4e64);}(_0xa637,0xdf));var _0x7a63=function(_0x377b3d,_0x7dc54e){_0x377b3d=_0x377b3d-0x0;var _0x1f9324=_0xa637[_0x377b3d];return _0x1f9324;};'use strict';var _=require(_0x7a63('0x0'));var util=require('util');var logger=require(_0x7a63('0x1'))(_0x7a63('0x2'));var moment=require(_0x7a63('0x3'));var BPromise=require(_0x7a63('0x4'));var rp=require(_0x7a63('0x5'));var fs=require('fs');var path=require(_0x7a63('0x6'));var rimraf=require(_0x7a63('0x7'));var config=require(_0x7a63('0x8'));var attributes=require(_0x7a63('0x9'));module[_0x7a63('0xa')]=function(_0x2947c4,_0xe9c29d){return _0x2947c4[_0x7a63('0xb')](_0x7a63('0xc'),attributes,{'tableName':_0x7a63('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index b90c844..d84aad4 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 _0x0644=['then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','UserOpenchannelQueue,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3ffda3,_0x59fb20){var _0x4e3697=function(_0x32ddaa){while(--_0x32ddaa){_0x3ffda3['push'](_0x3ffda3['shift']());}};_0x4e3697(++_0x59fb20);}(_0x0644,0x1ee));var _0x4064=function(_0x549111,_0x31c984){_0x549111=_0x549111-0x0;var _0x586adc=_0x0644[_0x549111];return _0x586adc;};'use strict';var _=require(_0x4064('0x0'));var util=require(_0x4064('0x1'));var moment=require(_0x4064('0x2'));var BPromise=require(_0x4064('0x3'));var rs=require(_0x4064('0x4'));var fs=require('fs');var Redis=require(_0x4064('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4064('0x6'));var logger=require('../../config/logger')(_0x4064('0x7'));var config=require(_0x4064('0x8'));var jayson=require(_0x4064('0x9'));var client=jayson[_0x4064('0xa')][_0x4064('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x481cb1,_0x5cb01b,_0x5f13dd){return new BPromise(function(_0x37f739,_0x5b4265){return client['request'](_0x481cb1,_0x5f13dd)[_0x4064('0xc')](function(_0x1e13ca){logger[_0x4064('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5cb01b,_0x4064('0xe'));logger[_0x4064('0xf')](_0x4064('0x10'),_0x5cb01b,'request\x20sent',JSON[_0x4064('0x11')](_0x1e13ca));if(_0x1e13ca[_0x4064('0x12')]){if(_0x1e13ca[_0x4064('0x12')]['code']===0x1f4){logger[_0x4064('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5cb01b,_0x1e13ca[_0x4064('0x12')][_0x4064('0x13')]);return _0x5b4265(_0x1e13ca['error'][_0x4064('0x13')]);}logger['error'](_0x4064('0x14'),_0x5cb01b,_0x1e13ca[_0x4064('0x12')][_0x4064('0x13')]);return _0x37f739(_0x1e13ca['error'][_0x4064('0x13')]);}else{logger['info'](_0x4064('0x14'),_0x5cb01b,_0x4064('0xe'));_0x37f739(_0x1e13ca[_0x4064('0x15')][_0x4064('0x13')]);}})['catch'](function(_0x387e26){logger[_0x4064('0x12')](_0x4064('0x14'),_0x5cb01b,_0x387e26);_0x5b4265(_0x387e26);});});} \ No newline at end of file +var _0x5410=['result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x5410,0x7a));var _0x0541=function(_0x5a4d6e,_0x42faef){_0x5a4d6e=_0x5a4d6e-0x0;var _0x28e7ad=_0x5410[_0x5a4d6e];return _0x28e7ad;};'use strict';var _=require('lodash');var util=require(_0x0541('0x0'));var moment=require(_0x0541('0x1'));var BPromise=require(_0x0541('0x2'));var rs=require(_0x0541('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0541('0x4'))['db'];var utils=require(_0x0541('0x5'));var logger=require(_0x0541('0x6'))(_0x0541('0x7'));var config=require(_0x0541('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0541('0x9')][_0x0541('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x267e58,_0x494e32,_0x23ca6b){return new BPromise(function(_0x30c5c8,_0x219bf6){return client[_0x0541('0xb')](_0x267e58,_0x23ca6b)[_0x0541('0xc')](function(_0x2678c2){logger[_0x0541('0xd')](_0x0541('0xe'),_0x494e32,'request\x20sent');logger[_0x0541('0xf')](_0x0541('0x10'),_0x494e32,'request\x20sent',JSON[_0x0541('0x11')](_0x2678c2));if(_0x2678c2[_0x0541('0x12')]){if(_0x2678c2[_0x0541('0x12')][_0x0541('0x13')]===0x1f4){logger[_0x0541('0x12')](_0x0541('0xe'),_0x494e32,_0x2678c2[_0x0541('0x12')][_0x0541('0x14')]);return _0x219bf6(_0x2678c2[_0x0541('0x12')][_0x0541('0x14')]);}logger[_0x0541('0x12')](_0x0541('0xe'),_0x494e32,_0x2678c2[_0x0541('0x12')]['message']);return _0x30c5c8(_0x2678c2[_0x0541('0x12')][_0x0541('0x14')]);}else{logger[_0x0541('0xd')](_0x0541('0xe'),_0x494e32,_0x0541('0x15'));_0x30c5c8(_0x2678c2[_0x0541('0x16')]['message']);}})[_0x0541('0x17')](function(_0x500b26){logger[_0x0541('0x12')](_0x0541('0xe'),_0x494e32,_0x500b26);_0x219bf6(_0x500b26);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e917e6a..7385b33 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 _0xd04a=['get','isAuthenticated','index','/describe','show','/:id/sections','getSections','/:id/resources','/:id/clone','clone','post','addSections','addResources','/:id','destroy','delete','removeSections','removeResources','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd04a,0x94));var _0xad04=function(_0x5da56b,_0x262f71){_0x5da56b=_0x5da56b-0x0;var _0x2c1e83=_0xd04a[_0x5da56b];return _0x2c1e83;};'use strict';var multer=require(_0xad04('0x0'));var util=require(_0xad04('0x1'));var path=require('path');var timeout=require(_0xad04('0x2'));var express=require(_0xad04('0x3'));var router=express[_0xad04('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xad04('0x5'));var interaction=require(_0xad04('0x6'));var config=require('../../config/environment');var controller=require(_0xad04('0x7'));router[_0xad04('0x8')]('/',auth[_0xad04('0x9')](),controller[_0xad04('0xa')]);router['get'](_0xad04('0xb'),auth[_0xad04('0x9')](),controller['describe']);router['get']('/:id',auth[_0xad04('0x9')](),controller[_0xad04('0xc')]);router[_0xad04('0x8')](_0xad04('0xd'),auth['isAuthenticated'](),controller[_0xad04('0xe')]);router[_0xad04('0x8')](_0xad04('0xf'),auth[_0xad04('0x9')](),controller['getResources']);router['post']('/',auth[_0xad04('0x9')](),controller['create']);router['post'](_0xad04('0x10'),auth['isAuthenticated'](),controller[_0xad04('0x11')]);router[_0xad04('0x12')](_0xad04('0xd'),auth[_0xad04('0x9')](),controller[_0xad04('0x13')]);router[_0xad04('0x12')]('/:id/resources',auth[_0xad04('0x9')](),controller[_0xad04('0x14')]);router['put'](_0xad04('0x15'),auth[_0xad04('0x9')](),controller['update']);router['delete'](_0xad04('0x15'),auth[_0xad04('0x9')](),controller[_0xad04('0x16')]);router[_0xad04('0x17')]('/:id/sections',auth[_0xad04('0x9')](),controller[_0xad04('0x18')]);router[_0xad04('0x17')](_0xad04('0xf'),auth[_0xad04('0x9')](),controller[_0xad04('0x19')]);module['exports']=router; \ No newline at end of file +var _0x36d2=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getSections','getResources','post','create','/:id/clone','clone','/:id/sections','/:id/resources','put','update','delete','destroy','removeResources'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x36d2,0x79));var _0x236d=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x36d2[_0xc87d08];return _0x30a714;};'use strict';var multer=require(_0x236d('0x0'));var util=require(_0x236d('0x1'));var path=require(_0x236d('0x2'));var timeout=require(_0x236d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x236d('0x4'));var auth=require(_0x236d('0x5'));var interaction=require(_0x236d('0x6'));var config=require(_0x236d('0x7'));var controller=require(_0x236d('0x8'));router[_0x236d('0x9')]('/',auth['isAuthenticated'](),controller[_0x236d('0xa')]);router['get'](_0x236d('0xb'),auth[_0x236d('0xc')](),controller[_0x236d('0xd')]);router[_0x236d('0x9')](_0x236d('0xe'),auth[_0x236d('0xc')](),controller[_0x236d('0xf')]);router[_0x236d('0x9')]('/:id/sections',auth[_0x236d('0xc')](),controller[_0x236d('0x10')]);router['get']('/:id/resources',auth[_0x236d('0xc')](),controller[_0x236d('0x11')]);router[_0x236d('0x12')]('/',auth[_0x236d('0xc')](),controller[_0x236d('0x13')]);router['post'](_0x236d('0x14'),auth[_0x236d('0xc')](),controller[_0x236d('0x15')]);router[_0x236d('0x12')](_0x236d('0x16'),auth[_0x236d('0xc')](),controller['addSections']);router[_0x236d('0x12')](_0x236d('0x17'),auth[_0x236d('0xc')](),controller['addResources']);router[_0x236d('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x236d('0x19')]);router[_0x236d('0x1a')](_0x236d('0xe'),auth[_0x236d('0xc')](),controller[_0x236d('0x1b')]);router[_0x236d('0x1a')](_0x236d('0x16'),auth[_0x236d('0xc')](),controller['removeSections']);router[_0x236d('0x1a')](_0x236d('0x17'),auth[_0x236d('0xc')](),controller[_0x236d('0x1c')]);module[_0x236d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4c3c9ed..e5afd57 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 _0x1c7b=['exports','STRING','setDataValue','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x556ff5,_0x22f331){var _0x2ba588=function(_0x12dfdc){while(--_0x12dfdc){_0x556ff5['push'](_0x556ff5['shift']());}};_0x2ba588(++_0x22f331);}(_0x1c7b,0x87));var _0xb1c7=function(_0x56cb4c,_0x3721a0){_0x56cb4c=_0x56cb4c-0x0;var _0x416449=_0x1c7b[_0x56cb4c];return _0x416449;};'use strict';var Sequelize=require(_0xb1c7('0x0'));module[_0xb1c7('0x1')]={'name':{'type':Sequelize[_0xb1c7('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xb1c7('0x2')],'set':function(_0x254e13){this[_0xb1c7('0x3')]('crudPermissions',_0x254e13?_0x254e13[_0xb1c7('0x4')](''):[]);},'get':function(){return this[_0xb1c7('0x5')]('crudPermissions')?this['getDataValue']('crudPermissions')[_0xb1c7('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb1c7('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb1c7('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb1c7('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb1c7('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb1c7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb1c7('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb1c7('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x362c=['STRING','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports'];(function(_0x1925df,_0xbd3e63){var _0x2f4e05=function(_0x4ffc0b){while(--_0x4ffc0b){_0x1925df['push'](_0x1925df['shift']());}};_0x2f4e05(++_0xbd3e63);}(_0x362c,0x85));var _0xc362=function(_0x157713,_0x15ed45){_0x157713=_0x157713-0x0;var _0x3b8347=_0x362c[_0x157713];return _0x3b8347;};'use strict';var Sequelize=require(_0xc362('0x0'));module[_0xc362('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xc362('0x2')],'set':function(_0x1d9bf3){this[_0xc362('0x3')]('crudPermissions',_0x1d9bf3?_0x1d9bf3[_0xc362('0x4')](''):[]);},'get':function(){return this[_0xc362('0x5')](_0xc362('0x6'))?this['getDataValue'](_0xc362('0x6'))[_0xc362('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xc362('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc362('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc362('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xc362('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc362('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xc362('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc362('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d4d8ab6..3ca218d 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 _0x84e6=['crudPermissions','updatedAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','describe','addSections','sequelize','push','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','UserProfile','includeAll','include','findAll','catch','show','params','find','create','body','clone','length','options','get','createdAt'];(function(_0x37ce94,_0xbe541){var _0x5a9a52=function(_0x3fa025){while(--_0x3fa025){_0x37ce94['push'](_0x37ce94['shift']());}};_0x5a9a52(++_0xbe541);}(_0x84e6,0x8f));var _0x684e=function(_0x36032c,_0x120a0e){_0x36032c=_0x36032c-0x0;var _0x38fa38=_0x84e6[_0x36032c];return _0x38fa38;};'use strict';var emlformat=require(_0x684e('0x0'));var rimraf=require(_0x684e('0x1'));var zipdir=require(_0x684e('0x2'));var jsonpatch=require(_0x684e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x684e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x684e('0x5'));var sox=require(_0x684e('0x6'));var csv=require(_0x684e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x684e('0x8'));var _=require('lodash');var squel=require(_0x684e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x684e('0xa'));var toCsv=require(_0x684e('0x7'));var querystring=require(_0x684e('0xb'));var Papa=require(_0x684e('0xc'));var Redis=require(_0x684e('0xd'));var authService=require(_0x684e('0xe'));var qs=require(_0x684e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x684e('0x10'))(_0x684e('0x11'));var utils=require('../../config/utils');var config=require(_0x684e('0x12'));var licenseUtil=require(_0x684e('0x13'));var db=require('../../mysqldb')['db'];config[_0x684e('0x14')]=_['defaults'](config[_0x684e('0x14')],{'host':_0x684e('0x15'),'port':0x18eb});var socket=require(_0x684e('0x16'))(new Redis(config[_0x684e('0x14')]));require(_0x684e('0x17'))[_0x684e('0x18')](socket);function respondWithStatusCode(_0x389075,_0x4318a9){_0x4318a9=_0x4318a9||0xcc;return function(_0x109281){if(_0x109281){return _0x389075[_0x684e('0x19')](_0x4318a9);}return _0x389075[_0x684e('0x1a')](_0x4318a9)[_0x684e('0x1b')]();};}function respondWithResult(_0x2a8e90,_0x2ba383){_0x2ba383=_0x2ba383||0xc8;return function(_0x13d3ba){if(_0x13d3ba){return _0x2a8e90[_0x684e('0x1a')](_0x2ba383)[_0x684e('0x1c')](_0x13d3ba);}};}function respondWithFilteredResult(_0x284801,_0x5c8382){return function(_0x4f3b8c){if(_0x4f3b8c){var _0x421dd7=typeof _0x5c8382[_0x684e('0x1d')]==='undefined'&&typeof _0x5c8382[_0x684e('0x1e')]===_0x684e('0x1f');var _0x184ff8=_0x4f3b8c[_0x684e('0x20')];var _0x555559=_0x421dd7?0x0:_0x5c8382[_0x684e('0x1d')];var _0x561471=_0x421dd7?_0x4f3b8c[_0x684e('0x20')]:_0x5c8382[_0x684e('0x1d')]+_0x5c8382[_0x684e('0x1e')];var _0x411a03;if(_0x561471>=_0x184ff8){_0x561471=_0x184ff8;_0x411a03=0xc8;}else{_0x411a03=0xce;}_0x284801[_0x684e('0x1a')](_0x411a03);return _0x284801['set'](_0x684e('0x21'),_0x555559+'-'+_0x561471+'/'+_0x184ff8)[_0x684e('0x1c')](_0x4f3b8c);}return null;};}function patchUpdates(_0x5077ec){return function(_0x4b2dff){try{jsonpatch['apply'](_0x4b2dff,_0x5077ec,!![]);}catch(_0x13f15f){return BPromise[_0x684e('0x22')](_0x13f15f);}return _0x4b2dff[_0x684e('0x23')]();};}function saveUpdates(_0xa565a8,_0x48a18b){return function(_0xa0dde9){if(_0xa0dde9){return _0xa0dde9[_0x684e('0x24')](_0xa565a8)[_0x684e('0x25')](function(_0x5a6264){return _0x5a6264;});}return null;};}function removeEntity(_0x245f69,_0x57d303){return function(_0x218eda){if(_0x218eda){return _0x218eda[_0x684e('0x26')]()[_0x684e('0x25')](function(){_0x245f69[_0x684e('0x1a')](0xcc)[_0x684e('0x1b')]();});}};}function handleEntityNotFound(_0x195a72,_0x50ee80){return function(_0x2a3d8d){if(!_0x2a3d8d){_0x195a72['sendStatus'](0x194);}return _0x2a3d8d;};}function handleError(_0x3ad849,_0x16dfcf){_0x16dfcf=_0x16dfcf||0x1f4;return function(_0x2e0107){logger[_0x684e('0x27')](_0x2e0107[_0x684e('0x28')]);if(_0x2e0107[_0x684e('0x29')]){delete _0x2e0107[_0x684e('0x29')];}_0x3ad849[_0x684e('0x1a')](_0x16dfcf)['send'](_0x2e0107);};}exports[_0x684e('0x2a')]=function(_0x204297,_0x3032eb){var _0x1438f0={},_0xee5518={},_0xff5533={'count':0x0,'rows':[]};var _0x4b1c9c=_['map'](db['UserProfile'][_0x684e('0x2b')],function(_0x5ed129){return{'name':_0x5ed129[_0x684e('0x2c')],'type':_0x5ed129[_0x684e('0x2d')][_0x684e('0x2e')]};});_0xee5518['model']=_['map'](_0x4b1c9c,_0x684e('0x29'));_0xee5518['query']=_[_0x684e('0x2f')](_0x204297['query']);_0xee5518[_0x684e('0x30')]=_[_0x684e('0x31')](_0xee5518[_0x684e('0x32')],_0xee5518[_0x684e('0x33')]);_0x1438f0['attributes']=_[_0x684e('0x31')](_0xee5518[_0x684e('0x32')],qs[_0x684e('0x34')](_0x204297[_0x684e('0x33')][_0x684e('0x34')]));_0x1438f0['attributes']=_0x1438f0[_0x684e('0x35')]['length']?_0x1438f0['attributes']:_0xee5518['model'];if(!_0x204297[_0x684e('0x33')][_0x684e('0x36')](_0x684e('0x37'))){_0x1438f0[_0x684e('0x1e')]=qs[_0x684e('0x1e')](_0x204297[_0x684e('0x33')][_0x684e('0x1e')]);_0x1438f0[_0x684e('0x1d')]=qs[_0x684e('0x1d')](_0x204297[_0x684e('0x33')][_0x684e('0x1d')]);}_0x1438f0[_0x684e('0x38')]=qs['sort'](_0x204297['query'][_0x684e('0x39')]);_0x1438f0['where']=qs[_0x684e('0x30')](_[_0x684e('0x3a')](_0x204297[_0x684e('0x33')],_0xee5518[_0x684e('0x30')]),_0x4b1c9c);if(_0x204297[_0x684e('0x33')][_0x684e('0x3b')]){_0x1438f0['where']=_['merge'](_0x1438f0[_0x684e('0x3c')],{'$or':_[_0x684e('0x3d')](_0x4b1c9c,function(_0x278e2c){if(_0x278e2c[_0x684e('0x2d')]!==_0x684e('0x3e')){var _0xf85310={};_0xf85310[_0x278e2c[_0x684e('0x29')]]={'$like':'%'+_0x204297[_0x684e('0x33')][_0x684e('0x3b')]+'%'};return _0xf85310;}})});}_0x1438f0=_[_0x684e('0x3f')]({},_0x1438f0,_0x204297['options']);var _0x3e3d4e={'where':_0x1438f0['where']};return db[_0x684e('0x40')][_0x684e('0x20')](_0x3e3d4e)[_0x684e('0x25')](function(_0x1dfe09){_0xff5533[_0x684e('0x20')]=_0x1dfe09;if(_0x204297[_0x684e('0x33')][_0x684e('0x41')]){_0x1438f0[_0x684e('0x42')]=[{'all':!![]}];}return db[_0x684e('0x40')][_0x684e('0x43')](_0x1438f0);})['then'](function(_0x16589a){_0xff5533['rows']=_0x16589a;return _0xff5533;})[_0x684e('0x25')](respondWithFilteredResult(_0x3032eb,_0x1438f0))[_0x684e('0x44')](handleError(_0x3032eb,null));};exports[_0x684e('0x45')]=function(_0x54263a,_0x3feb8b){var _0x1b4e96={'raw':![],'where':{'id':_0x54263a[_0x684e('0x46')]['id']}},_0x4fb9aa={};_0x4fb9aa['model']=_['keys'](db[_0x684e('0x40')][_0x684e('0x2b')]);_0x4fb9aa[_0x684e('0x33')]=_['keys'](_0x54263a[_0x684e('0x33')]);_0x4fb9aa[_0x684e('0x30')]=_[_0x684e('0x31')](_0x4fb9aa['model'],_0x4fb9aa[_0x684e('0x33')]);_0x1b4e96['attributes']=_[_0x684e('0x31')](_0x4fb9aa[_0x684e('0x32')],qs[_0x684e('0x34')](_0x54263a[_0x684e('0x33')][_0x684e('0x34')]));_0x1b4e96[_0x684e('0x35')]=_0x1b4e96[_0x684e('0x35')]['length']?_0x1b4e96[_0x684e('0x35')]:_0x4fb9aa[_0x684e('0x32')];if(_0x54263a[_0x684e('0x33')][_0x684e('0x41')]){_0x1b4e96[_0x684e('0x42')]=[{'all':!![]}];}_0x1b4e96=_['merge']({},_0x1b4e96,_0x54263a['options']);return db[_0x684e('0x40')][_0x684e('0x47')](_0x1b4e96)[_0x684e('0x25')](handleEntityNotFound(_0x3feb8b,null))['then'](respondWithResult(_0x3feb8b,null))[_0x684e('0x44')](handleError(_0x3feb8b,null));};exports[_0x684e('0x48')]=function(_0x31685f,_0x5a806e){return db[_0x684e('0x40')]['create'](_0x31685f[_0x684e('0x49')],{})['then'](respondWithResult(_0x5a806e,0xc9))[_0x684e('0x44')](handleError(_0x5a806e,null));};exports[_0x684e('0x4a')]=function(_0x5c0400,_0x5dac54){var _0x57b774={'where':{'id':_0x5c0400['params']['id']}},_0x30ab5a={};_0x30ab5a[_0x684e('0x32')]=_['keys'](db[_0x684e('0x40')]['rawAttributes']);_0x57b774['attributes']=_['intersection'](_0x30ab5a['model'],qs[_0x684e('0x34')](_0x5c0400[_0x684e('0x33')]['fields']));_0x57b774[_0x684e('0x35')]=_0x57b774[_0x684e('0x35')][_0x684e('0x4b')]?_0x57b774[_0x684e('0x35')]:_0x30ab5a[_0x684e('0x32')];if(_0x5c0400[_0x684e('0x33')]['includeAll']){_0x57b774[_0x684e('0x42')]=[{'all':!![]}];}_0x57b774=_[_0x684e('0x3f')]({},_0x57b774,_0x5c0400[_0x684e('0x4c')]);return db[_0x684e('0x40')]['find'](_0x57b774)[_0x684e('0x25')](handleEntityNotFound(_0x5dac54,null))['then'](function(_0x77c33){if(_0x77c33){var _0x2de9ad=_0x77c33[_0x684e('0x4d')]({'plain':!![]});_0x2de9ad=qs['omit'](_0x2de9ad,['id',_0x684e('0x4e'),'updatedAt',_0x684e('0x4f')]);_0x5c0400[_0x684e('0x49')]=_['omit'](_0x5c0400[_0x684e('0x49')],['id','createdAt',_0x684e('0x50')]);return db['sequelize'][_0x684e('0x51')](function(_0x363b90){return db['UserProfile'][_0x684e('0x48')](_['merge'](_0x2de9ad,_0x5c0400['body']),{'include':_0x5c0400[_0x684e('0x33')][_0x684e('0x41')]?[{'all':!![]}]:undefined,'transaction':_0x363b90})[_0x684e('0x25')](function(_0x5d0087){var _0x4b9996=_0x5d0087['get']({'plain':!![]});return db[_0x684e('0x52')][_0x684e('0x43')]({'where':{'userProfileId':_0x5c0400[_0x684e('0x46')]['id']},'raw':!![]})[_0x684e('0x25')](function(_0x258363){if(_0x258363){return BPromise[_0x684e('0x53')](_0x258363,function(_0x4262c1){return new BPromise(function(_0x45484b,_0x33dfaa){if(_0x4262c1[_0x684e('0x54')]===null||_0x4262c1[_0x684e('0x54')]===0x1)_0x45484b(null);return db[_0x684e('0x55')]['findAll']({'where':{'sectionId':_0x4262c1['id']},'raw':!![]})[_0x684e('0x25')](function(_0x5c340d){var _0x1c978e=_['map'](_0x5c340d,function(_0x32a59a){return qs[_0x684e('0x56')](_0x32a59a,['id',_0x684e('0x4e'),_0x684e('0x50'),_0x684e('0x57')]);});_0x45484b(_0x1c978e);})[_0x684e('0x44')](function(_0xeb50bb){_0x33dfaa(_0xeb50bb);});})['then'](function(_0x2251f2){var _0x168048=qs[_0x684e('0x56')](_0x4262c1,['id','createdAt','updatedAt']);_0x168048[_0x684e('0x58')]=_0x4b9996['id'];if(_0x2251f2)_0x168048[_0x684e('0x59')]=_0x2251f2;return _0x168048;})[_0x684e('0x25')](function(_0xf1fa3c){return db[_0x684e('0x52')][_0x684e('0x48')](_0xf1fa3c,{'include':[{'model':db[_0x684e('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x363b90});});})['then'](function(){return _0x4b9996;});}});});});}})[_0x684e('0x25')](respondWithResult(_0x5dac54,0xc9))['catch'](handleError(_0x5dac54,null));};exports[_0x684e('0x24')]=function(_0x45ec54,_0x2ef934){if(_0x45ec54[_0x684e('0x49')]['id']){delete _0x45ec54['body']['id'];}return db[_0x684e('0x40')][_0x684e('0x47')]({'where':{'id':_0x45ec54[_0x684e('0x46')]['id']}})[_0x684e('0x25')](handleEntityNotFound(_0x2ef934,null))[_0x684e('0x25')](saveUpdates(_0x45ec54['body'],null))['then'](respondWithResult(_0x2ef934,null))[_0x684e('0x44')](handleError(_0x2ef934,null));};exports['destroy']=function(_0x1abeb4,_0x3463c4){return db['UserProfile']['find']({'where':{'id':_0x1abeb4[_0x684e('0x46')]['id']}})['then'](handleEntityNotFound(_0x3463c4,null))[_0x684e('0x25')](removeEntity(_0x3463c4,null))['catch'](handleError(_0x3463c4,null));};exports[_0x684e('0x5a')]=function(_0x32d6df,_0xfa6553){return db[_0x684e('0x40')][_0x684e('0x5a')]()['then'](respondWithResult(_0xfa6553,null))[_0x684e('0x44')](handleError(_0xfa6553,null));};exports[_0x684e('0x5b')]=function(_0x416f36,_0x5d2ca5){var _0x4dc642=_0x416f36[_0x684e('0x49')];return db['UserProfile'][_0x684e('0x47')]({'where':{'id':_0x416f36[_0x684e('0x46')]['id']}})[_0x684e('0x25')](handleEntityNotFound(_0x5d2ca5,null))[_0x684e('0x25')](function(_0x5b510c){if(_0x5b510c){return db[_0x684e('0x5c')][_0x684e('0x51')](function(_0x548bff){return db[_0x684e('0x52')]['destroy']({'where':{'userProfileId':_0x416f36[_0x684e('0x46')]['id'],'sectionId':_[_0x684e('0x3d')](_0x4dc642,function(_0x3c4865){return _0x3c4865[_0x684e('0x57')];})},'transaction':_0x548bff})['then'](function(){var _0x3eaabe=_[_0x684e('0x3d')](_0x4dc642,function(_0x403f8d){_0x403f8d[_0x684e('0x58')]=_0x416f36[_0x684e('0x46')]['id'];return _0x403f8d;});var _0x9abc95=[];return BPromise['each'](_0x3eaabe,function(_0x550ec3){return db[_0x684e('0x52')][_0x684e('0x48')](_0x550ec3,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x548bff})[_0x684e('0x25')](function(_0xfcd79c){_0x9abc95[_0x684e('0x5d')](_0xfcd79c[_0x684e('0x4d')]({'plain':!![]}));});})[_0x684e('0x25')](function(){return _0x9abc95;});});});}})['then'](function(_0x3efcd5){return _0x3efcd5;})['then'](respondWithResult(_0x5d2ca5,null))[_0x684e('0x44')](handleError(_0x5d2ca5,null));};exports['removeSections']=function(_0x554e11,_0x5673db){var _0x4fe984;return db[_0x684e('0x40')][_0x684e('0x47')]({'where':{'id':_0x554e11[_0x684e('0x46')]['id']},'attributes':['id','name']})[_0x684e('0x25')](handleEntityNotFound(_0x5673db,null))[_0x684e('0x25')](function(_0x537b92){if(_0x537b92){_0x4fe984=_0x537b92;return db[_0x684e('0x52')][_0x684e('0x26')]({'where':{'userProfileId':_0x554e11[_0x684e('0x46')]['id'],'sectionId':_0x554e11['query'][_0x684e('0x5e')]}});}})[_0x684e('0x25')](function(){return _0x4fe984;})['then'](respondWithStatusCode(_0x5673db,null))[_0x684e('0x44')](handleError(_0x5673db,null));};exports[_0x684e('0x5f')]=function(_0x5bbc68,_0x53edda){var _0x196be3=[];var _0x722042=[];return db[_0x684e('0x52')][_0x684e('0x43')]({'where':{'userProfileId':_0x5bbc68[_0x684e('0x46')]['id']},'raw':!![]})[_0x684e('0x25')](function(_0x4cc7d3){_0x196be3=_[_0x684e('0x3b')](_0x4cc7d3,function(_0x20f8bc){return _0x20f8bc[_0x684e('0x60')]===0x1||_[_0x684e('0x61')]([0x3eb,0x709],_0x20f8bc['sectionId']);});if(!_[_0x684e('0x62')](_0x196be3)){return _['map'](_0x196be3,function(_0x4617cc){return _0x4617cc[_0x684e('0x57')];});}else{return;}})[_0x684e('0x25')](function(_0x2ab040){if(_0x2ab040)_0x722042=_0x2ab040;if(_[_0x684e('0x61')](_0x722042,0x64)){var _0xd76463=_[_0x684e('0x47')](_0x196be3,{'sectionId':0x64});return hasDefaultDashboard(_0xd76463)[_0x684e('0x25')](function(_0x5da204){return _[_0x684e('0x3d')](_0x196be3,function(_0x126d21){if(_0x126d21['sectionId']===0x64){_0x126d21[_0x684e('0x63')]=_0x5da204;}return _0x126d21;});});}else{return;}})[_0x684e('0x25')](function(_0x1eae54){if(_0x1eae54)_0x196be3=_0x1eae54;if(_[_0x684e('0x61')](_0x722042,0x3eb)){var _0xd5c5d7=_[_0x684e('0x47')](_0x196be3,{'sectionId':0x3eb});return getCustomDashboards(_0xd5c5d7)[_0x684e('0x25')](function(_0x47639e){return _['map'](_0x196be3,function(_0x29e377){if(_0xd5c5d7[_0x684e('0x60')]){if(_0x29e377[_0x684e('0x57')]===0x3eb){_0x29e377[_0x684e('0x63')]=_0x47639e;}}else{if(_0x29e377['sectionId']===0x64){if(!_0x29e377[_0x684e('0x63')]){_0x29e377[_0x684e('0x63')]=[];}_0x29e377[_0x684e('0x63')]=_0x29e377[_0x684e('0x63')][_0x684e('0x64')](_0x47639e);}}return _0x29e377;});});}else{return;}})[_0x684e('0x25')](function(_0x35c109){if(_0x35c109)_0x196be3=_0x35c109;if(_[_0x684e('0x61')](_0x722042,0x709)){var _0x283638=_['find'](_0x196be3,{'sectionId':0x709});return getPlugins(_0x283638)[_0x684e('0x25')](function(_0x2a082b){if(_0x283638[_0x684e('0x60')]){return _[_0x684e('0x3d')](_0x196be3,function(_0x297db1){if(_0x297db1[_0x684e('0x57')]===0x709){_0x297db1[_0x684e('0x63')]=_0x2a082b;}return _0x297db1;});}else{var _0xad698c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2a082b};var _0x476e0a=_[_0x684e('0x3d')](_0x196be3);_0x476e0a[_0x684e('0x5d')](_0xad698c);return _0x476e0a;}});}else{return;}})[_0x684e('0x25')](function(_0x2313fb){if(_0x2313fb)_0x196be3=_0x2313fb;return _[_0x684e('0x3b')](_0x196be3,[_0x684e('0x60'),0x1]);})['then'](respondWithResult(_0x53edda,null))[_0x684e('0x44')](handleError(_0x53edda,null));};function hasDefaultDashboard(_0x3ae2d1){var _0x3c97a3=[0x65];return new BPromise(function(_0x27ad04,_0x5b3827){try{if(_0x3ae2d1[_0x684e('0x54')]){_0x27ad04(_0x3c97a3);}else{return db['UserProfileResource'][_0x684e('0x65')]({'where':{'sectionId':_0x3ae2d1['id']},'raw':!![]})[_0x684e('0x25')](function(_0x193f41){_0x193f41?_0x27ad04(_0x3c97a3):_0x27ad04();});}}catch(_0x1832bc){_0x5b3827(_0x1832bc);}});}function getCustomDashboards(_0x577f35){var _0xdb40d1=[];return new BPromise(function(_0x5af67e,_0x167476){try{if(_0x577f35[_0x684e('0x54')]){return db['Dashboard'][_0x684e('0x43')]({'raw':!![]})[_0x684e('0x25')](function(_0x4e0471){_0x4e0471['forEach'](function(_0x2d6832){_0xdb40d1['push'](_0x2d6832['id']+0x1869f);});_0x5af67e(_0xdb40d1);});}else{return db['UserProfileResource'][_0x684e('0x43')]({'where':{'sectionId':_0x577f35['id']},'raw':!![]})['then'](function(_0xc9b60a){_0xc9b60a['forEach'](function(_0x1aaf17){_0xdb40d1[_0x684e('0x5d')](_0x1aaf17[_0x684e('0x66')]+0x1869f);});_0x5af67e(_0xdb40d1);});}}catch(_0x204177){_0x167476(_0x204177);}});}function getPlugins(_0x1e0890){var _0x23a168=[];return new BPromise(function(_0x491911,_0x431f15){try{if(_0x1e0890[_0x684e('0x54')]){return db[_0x684e('0x67')]['findAll']({'raw':!![]})[_0x684e('0x25')](function(_0x2ac3f8){_0x2ac3f8['forEach'](function(_0x13194e){_0x23a168['push'](_0x13194e['id']+0x15b38);});_0x491911(_0x23a168);});}else{return db[_0x684e('0x55')][_0x684e('0x43')]({'where':{'sectionId':_0x1e0890['id']},'raw':!![]})[_0x684e('0x25')](function(_0x3b8cba){_0x3b8cba[_0x684e('0x68')](function(_0x1e34f2){_0x23a168[_0x684e('0x5d')](_0x1e34f2['resourceId']+0x15b38);});_0x491911(_0x23a168);});}}catch(_0x57febd){_0x431f15(_0x57febd);}});}exports[_0x684e('0x69')]=function(_0x4c51ae,_0x4d10ad){return db[_0x684e('0x40')][_0x684e('0x47')]({'where':{'id':_0x4c51ae[_0x684e('0x46')]['id']}})[_0x684e('0x25')](handleEntityNotFound(_0x4d10ad,null))['then'](function(_0x494d32){if(_0x494d32){return db[_0x684e('0x5c')][_0x684e('0x51')](function(_0x556294){return db['UserProfileSection'][_0x684e('0x43')]({'where':{'userProfileId':_0x4c51ae[_0x684e('0x46')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x19d5cb){if(_0x19d5cb){return db[_0x684e('0x52')][_0x684e('0x26')]({'where':{'userProfileId':_0x4c51ae[_0x684e('0x46')]['id'],'id':_[_0x684e('0x3d')](_0x19d5cb,function(_0x4a977d){return _0x4a977d['id'];})},'transaction':_0x556294});}})['then'](function(_0x3c1de1){var _0x27a79f=_['map'](_0x4c51ae['body'],function(_0x1f5e13){_0x1f5e13[_0x684e('0x58')]=_0x4c51ae[_0x684e('0x46')]['id'];return _0x1f5e13;});return db['UserProfileSection'][_0x684e('0x6a')](_0x27a79f,{'raw':!![],'transaction':_0x556294});})[_0x684e('0x25')](function(_0x158a6e){var _0x1776b4=_[_0x684e('0x3b')](_[_0x684e('0x3d')](_0x158a6e,function(_0x88eaea){return _0x88eaea[_0x684e('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x1776b4){return db['UserProfileSection'][_0x684e('0x43')]({'where':{'userProfileId':_0x4c51ae[_0x684e('0x46')]['id'],'sectionId':_['map'](_0x1776b4,function(_0x415c03){return _0x415c03['sectionId'];})},'attributes':['id',_0x684e('0x57')],'raw':!![]})[_0x684e('0x25')](function(_0x4259c8){var _0xb89a47=_[_0x684e('0x3d')](_0x4c51ae[_0x684e('0x49')],function(_0x56142d){_0x56142d[_0x684e('0x58')]=_0x4c51ae[_0x684e('0x46')]['id'];return _0x56142d;});return db['UserProfileResource'][_0x684e('0x6a')](_0xb89a47,{'raw':!![],'transaction':_0x556294});});}})[_0x684e('0x44')](handleError(_0x4d10ad,null));});}})[_0x684e('0x25')](function(_0xa97588){var _0x3808e7=_[_0x684e('0x3d')](_0xa97588,function(_0x2e1449){return _0x2e1449[_0x684e('0x4d')]({'plain':!![]});});})[_0x684e('0x25')](respondWithResult(_0x4d10ad,null))[_0x684e('0x44')](handleError(_0x4d10ad,null));};exports['removeResources']=function(_0x4a0749,_0x4d3839,_0x4cb89a){return db[_0x684e('0x40')]['find']({'where':{'id':_0x4a0749[_0x684e('0x46')]['id']}})[_0x684e('0x25')](handleEntityNotFound(_0x4d3839,null))['then'](function(_0x30301e){if(_0x30301e){return _0x30301e[_0x684e('0x6b')](_0x4a0749[_0x684e('0x33')][_0x684e('0x5e')]);}})[_0x684e('0x25')](respondWithStatusCode(_0x4d3839,null))[_0x684e('0x44')](handleError(_0x4d3839,null));};exports[_0x684e('0x6c')]=function(_0x4c48fc,_0x166750){var _0x296142={};if(!_0x4c48fc['query'][_0x684e('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x4c48fc[_0x684e('0x33')][_0x684e('0x36')](_0x684e('0x37'))){_0x296142[_0x684e('0x1e')]=qs[_0x684e('0x1e')](_0x4c48fc[_0x684e('0x33')][_0x684e('0x1e')]);_0x296142[_0x684e('0x1d')]=qs[_0x684e('0x1d')](_0x4c48fc[_0x684e('0x33')]['offset']);}return db[_0x684e('0x40')][_0x684e('0x47')]({'where':{'id':_0x4c48fc[_0x684e('0x46')]['id']}})[_0x684e('0x25')](function(_0x5be455){if(!_0x5be455)throw new Error(_0x684e('0x6e')+_0x4c48fc['params']['id']);return db[_0x684e('0x40')][_0x684e('0x6c')](_0x4c48fc);})[_0x684e('0x25')](respondWithFilteredResult(_0x166750,_0x296142))[_0x684e('0x44')](handleError(_0x166750,null));}; \ No newline at end of file +var _0x6238=['request-promise','bluebird','mustache','util','path','sox','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','name','index','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','length','create','body','clone','find','omit','createdAt','updatedAt','sequelize','transaction','get','UserProfileSection','params','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','push','removeSections','ids','getSections','enabled','sectionId','isEmpty','subsections','concat','Dashboard','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch'];(function(_0x3f391b,_0x2dee8c){var _0x40cea4=function(_0x484704){while(--_0x484704){_0x3f391b['push'](_0x3f391b['shift']());}};_0x40cea4(++_0x2dee8c);}(_0x6238,0x144));var _0x8623=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6238[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8623('0x0'));var zipdir=require(_0x8623('0x1'));var jsonpatch=require(_0x8623('0x2'));var rp=require(_0x8623('0x3'));var moment=require('moment');var BPromise=require(_0x8623('0x4'));var Mustache=require(_0x8623('0x5'));var util=require(_0x8623('0x6'));var path=require(_0x8623('0x7'));var sox=require(_0x8623('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8623('0x9'));var deskjs=require(_0x8623('0xa'));var toCsv=require(_0x8623('0xb'));var querystring=require(_0x8623('0xc'));var Papa=require(_0x8623('0xd'));var Redis=require(_0x8623('0xe'));var authService=require(_0x8623('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8623('0x10'))(_0x8623('0x11'));var utils=require(_0x8623('0x12'));var config=require(_0x8623('0x13'));var licenseUtil=require(_0x8623('0x14'));var db=require('../../mysqldb')['db'];config[_0x8623('0x15')]=_[_0x8623('0x16')](config[_0x8623('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x8623('0x17'))(new Redis(config[_0x8623('0x15')]));require(_0x8623('0x18'))[_0x8623('0x19')](socket);function respondWithStatusCode(_0x127aed,_0x1ebf90){_0x1ebf90=_0x1ebf90||0xcc;return function(_0x4f60cb){if(_0x4f60cb){return _0x127aed[_0x8623('0x1a')](_0x1ebf90);}return _0x127aed[_0x8623('0x1b')](_0x1ebf90)['end']();};}function respondWithResult(_0x4fe050,_0x4a6d72){_0x4a6d72=_0x4a6d72||0xc8;return function(_0x18a53b){if(_0x18a53b){return _0x4fe050[_0x8623('0x1b')](_0x4a6d72)[_0x8623('0x1c')](_0x18a53b);}};}function respondWithFilteredResult(_0x584fae,_0x39d26d){return function(_0x52f17e){if(_0x52f17e){var _0x142c35=typeof _0x39d26d[_0x8623('0x1d')]===_0x8623('0x1e')&&typeof _0x39d26d['limit']===_0x8623('0x1e');var _0x320942=_0x52f17e['count'];var _0x8e1e5c=_0x142c35?0x0:_0x39d26d[_0x8623('0x1d')];var _0x11d1c5=_0x142c35?_0x52f17e['count']:_0x39d26d[_0x8623('0x1d')]+_0x39d26d[_0x8623('0x1f')];var _0x1c649b;if(_0x11d1c5>=_0x320942){_0x11d1c5=_0x320942;_0x1c649b=0xc8;}else{_0x1c649b=0xce;}_0x584fae['status'](_0x1c649b);return _0x584fae[_0x8623('0x20')](_0x8623('0x21'),_0x8e1e5c+'-'+_0x11d1c5+'/'+_0x320942)[_0x8623('0x1c')](_0x52f17e);}return null;};}function patchUpdates(_0x1e81c9){return function(_0x15dfe1){try{jsonpatch['apply'](_0x15dfe1,_0x1e81c9,!![]);}catch(_0x392e65){return BPromise[_0x8623('0x22')](_0x392e65);}return _0x15dfe1[_0x8623('0x23')]();};}function saveUpdates(_0x2cf522,_0x40b4b8){return function(_0x266f6c){if(_0x266f6c){return _0x266f6c[_0x8623('0x24')](_0x2cf522)[_0x8623('0x25')](function(_0xc0ec0c){return _0xc0ec0c;});}return null;};}function removeEntity(_0xf9e475,_0x18bd15){return function(_0x175c25){if(_0x175c25){return _0x175c25[_0x8623('0x26')]()[_0x8623('0x25')](function(){_0xf9e475['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x460b51,_0x56fc96){return function(_0x57d363){if(!_0x57d363){_0x460b51[_0x8623('0x1a')](0x194);}return _0x57d363;};}function handleError(_0x426d9a,_0x4e60a8){_0x4e60a8=_0x4e60a8||0x1f4;return function(_0x2cc704){logger['error'](_0x2cc704['stack']);if(_0x2cc704[_0x8623('0x27')]){delete _0x2cc704['name'];}_0x426d9a['status'](_0x4e60a8)['send'](_0x2cc704);};}exports[_0x8623('0x28')]=function(_0x996f78,_0x4ed48f){var _0x311df7={},_0x27fcdc={},_0x3aa391={'count':0x0,'rows':[]};var _0x5a2ab9=_['map'](db[_0x8623('0x29')][_0x8623('0x2a')],function(_0x3b46d9){return{'name':_0x3b46d9[_0x8623('0x2b')],'type':_0x3b46d9[_0x8623('0x2c')][_0x8623('0x2d')]};});_0x27fcdc[_0x8623('0x2e')]=_['map'](_0x5a2ab9,_0x8623('0x27'));_0x27fcdc[_0x8623('0x2f')]=_[_0x8623('0x30')](_0x996f78['query']);_0x27fcdc[_0x8623('0x31')]=_[_0x8623('0x32')](_0x27fcdc[_0x8623('0x2e')],_0x27fcdc[_0x8623('0x2f')]);_0x311df7['attributes']=_[_0x8623('0x32')](_0x27fcdc[_0x8623('0x2e')],qs[_0x8623('0x33')](_0x996f78[_0x8623('0x2f')]['fields']));_0x311df7[_0x8623('0x34')]=_0x311df7[_0x8623('0x34')]['length']?_0x311df7[_0x8623('0x34')]:_0x27fcdc[_0x8623('0x2e')];if(!_0x996f78['query'][_0x8623('0x35')]('nolimit')){_0x311df7[_0x8623('0x1f')]=qs['limit'](_0x996f78[_0x8623('0x2f')][_0x8623('0x1f')]);_0x311df7[_0x8623('0x1d')]=qs[_0x8623('0x1d')](_0x996f78[_0x8623('0x2f')]['offset']);}_0x311df7[_0x8623('0x36')]=qs[_0x8623('0x37')](_0x996f78[_0x8623('0x2f')][_0x8623('0x37')]);_0x311df7[_0x8623('0x38')]=qs['filters'](_[_0x8623('0x39')](_0x996f78['query'],_0x27fcdc[_0x8623('0x31')]),_0x5a2ab9);if(_0x996f78[_0x8623('0x2f')][_0x8623('0x3a')]){_0x311df7[_0x8623('0x38')]=_['merge'](_0x311df7[_0x8623('0x38')],{'$or':_[_0x8623('0x3b')](_0x5a2ab9,function(_0x2c70c1){if(_0x2c70c1['type']!==_0x8623('0x3c')){var _0x42cd3d={};_0x42cd3d[_0x2c70c1[_0x8623('0x27')]]={'$like':'%'+_0x996f78[_0x8623('0x2f')][_0x8623('0x3a')]+'%'};return _0x42cd3d;}})});}_0x311df7=_[_0x8623('0x3d')]({},_0x311df7,_0x996f78[_0x8623('0x3e')]);var _0x3c5151={'where':_0x311df7['where']};return db[_0x8623('0x29')][_0x8623('0x3f')](_0x3c5151)[_0x8623('0x25')](function(_0x242ade){_0x3aa391[_0x8623('0x3f')]=_0x242ade;if(_0x996f78[_0x8623('0x2f')][_0x8623('0x40')]){_0x311df7[_0x8623('0x41')]=[{'all':!![]}];}return db[_0x8623('0x29')][_0x8623('0x42')](_0x311df7);})[_0x8623('0x25')](function(_0x12840d){_0x3aa391[_0x8623('0x43')]=_0x12840d;return _0x3aa391;})[_0x8623('0x25')](respondWithFilteredResult(_0x4ed48f,_0x311df7))[_0x8623('0x44')](handleError(_0x4ed48f,null));};exports[_0x8623('0x45')]=function(_0x1cb020,_0x53a453){var _0x165d6d={'raw':![],'where':{'id':_0x1cb020['params']['id']}},_0x49f8f6={};_0x49f8f6[_0x8623('0x2e')]=_[_0x8623('0x30')](db[_0x8623('0x29')][_0x8623('0x2a')]);_0x49f8f6['query']=_[_0x8623('0x30')](_0x1cb020[_0x8623('0x2f')]);_0x49f8f6['filters']=_[_0x8623('0x32')](_0x49f8f6[_0x8623('0x2e')],_0x49f8f6[_0x8623('0x2f')]);_0x165d6d[_0x8623('0x34')]=_[_0x8623('0x32')](_0x49f8f6['model'],qs['fields'](_0x1cb020[_0x8623('0x2f')]['fields']));_0x165d6d['attributes']=_0x165d6d['attributes'][_0x8623('0x46')]?_0x165d6d[_0x8623('0x34')]:_0x49f8f6[_0x8623('0x2e')];if(_0x1cb020[_0x8623('0x2f')][_0x8623('0x40')]){_0x165d6d[_0x8623('0x41')]=[{'all':!![]}];}_0x165d6d=_[_0x8623('0x3d')]({},_0x165d6d,_0x1cb020[_0x8623('0x3e')]);return db['UserProfile']['find'](_0x165d6d)[_0x8623('0x25')](handleEntityNotFound(_0x53a453,null))[_0x8623('0x25')](respondWithResult(_0x53a453,null))['catch'](handleError(_0x53a453,null));};exports[_0x8623('0x47')]=function(_0x8c1ec2,_0x47c923){return db[_0x8623('0x29')][_0x8623('0x47')](_0x8c1ec2[_0x8623('0x48')],{})[_0x8623('0x25')](respondWithResult(_0x47c923,0xc9))[_0x8623('0x44')](handleError(_0x47c923,null));};exports[_0x8623('0x49')]=function(_0x569cb2,_0x5efab8){var _0xc5fcb4={'where':{'id':_0x569cb2['params']['id']}},_0x1f2c64={};_0x1f2c64['model']=_[_0x8623('0x30')](db['UserProfile'][_0x8623('0x2a')]);_0xc5fcb4['attributes']=_[_0x8623('0x32')](_0x1f2c64[_0x8623('0x2e')],qs[_0x8623('0x33')](_0x569cb2[_0x8623('0x2f')][_0x8623('0x33')]));_0xc5fcb4[_0x8623('0x34')]=_0xc5fcb4[_0x8623('0x34')][_0x8623('0x46')]?_0xc5fcb4['attributes']:_0x1f2c64[_0x8623('0x2e')];if(_0x569cb2['query'][_0x8623('0x40')]){_0xc5fcb4[_0x8623('0x41')]=[{'all':!![]}];}_0xc5fcb4=_[_0x8623('0x3d')]({},_0xc5fcb4,_0x569cb2['options']);return db[_0x8623('0x29')][_0x8623('0x4a')](_0xc5fcb4)['then'](handleEntityNotFound(_0x5efab8,null))['then'](function(_0x1d44a2){if(_0x1d44a2){var _0x4c7a43=_0x1d44a2['get']({'plain':!![]});_0x4c7a43=qs[_0x8623('0x4b')](_0x4c7a43,['id',_0x8623('0x4c'),_0x8623('0x4d'),'crudPermissions']);_0x569cb2[_0x8623('0x48')]=_['omit'](_0x569cb2['body'],['id',_0x8623('0x4c'),_0x8623('0x4d')]);return db[_0x8623('0x4e')][_0x8623('0x4f')](function(_0x3a60ac){return db['UserProfile']['create'](_[_0x8623('0x3d')](_0x4c7a43,_0x569cb2[_0x8623('0x48')]),{'include':_0x569cb2[_0x8623('0x2f')][_0x8623('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x3a60ac})[_0x8623('0x25')](function(_0x1130dc){var _0x522833=_0x1130dc[_0x8623('0x50')]({'plain':!![]});return db[_0x8623('0x51')][_0x8623('0x42')]({'where':{'userProfileId':_0x569cb2[_0x8623('0x52')]['id']},'raw':!![]})[_0x8623('0x25')](function(_0x1e17e3){if(_0x1e17e3){return BPromise[_0x8623('0x53')](_0x1e17e3,function(_0x16f411){return new BPromise(function(_0x40f549,_0x9f80b8){if(_0x16f411[_0x8623('0x54')]===null||_0x16f411[_0x8623('0x54')]===0x1)_0x40f549(null);return db[_0x8623('0x55')][_0x8623('0x42')]({'where':{'sectionId':_0x16f411['id']},'raw':!![]})[_0x8623('0x25')](function(_0x2cb994){var _0x3a9e69=_[_0x8623('0x3b')](_0x2cb994,function(_0x5a037f){return qs[_0x8623('0x4b')](_0x5a037f,['id',_0x8623('0x4c'),_0x8623('0x4d'),'sectionId']);});_0x40f549(_0x3a9e69);})['catch'](function(_0x26b8ee){_0x9f80b8(_0x26b8ee);});})[_0x8623('0x25')](function(_0x1e427b){var _0x2c1b16=qs[_0x8623('0x4b')](_0x16f411,['id',_0x8623('0x4c'),_0x8623('0x4d')]);_0x2c1b16[_0x8623('0x56')]=_0x522833['id'];if(_0x1e427b)_0x2c1b16[_0x8623('0x57')]=_0x1e427b;return _0x2c1b16;})[_0x8623('0x25')](function(_0xb8f551){return db[_0x8623('0x51')][_0x8623('0x47')](_0xb8f551,{'include':[{'model':db['UserProfileResource'],'as':_0x8623('0x57')}],'raw':!![],'transaction':_0x3a60ac});});})[_0x8623('0x25')](function(){return _0x522833;});}});});});}})[_0x8623('0x25')](respondWithResult(_0x5efab8,0xc9))[_0x8623('0x44')](handleError(_0x5efab8,null));};exports['update']=function(_0x10f194,_0x414a5b){if(_0x10f194[_0x8623('0x48')]['id']){delete _0x10f194['body']['id'];}return db['UserProfile'][_0x8623('0x4a')]({'where':{'id':_0x10f194[_0x8623('0x52')]['id']}})['then'](handleEntityNotFound(_0x414a5b,null))[_0x8623('0x25')](saveUpdates(_0x10f194[_0x8623('0x48')],null))[_0x8623('0x25')](respondWithResult(_0x414a5b,null))[_0x8623('0x44')](handleError(_0x414a5b,null));};exports['destroy']=function(_0x73d7,_0x1b3b3b){return db[_0x8623('0x29')][_0x8623('0x4a')]({'where':{'id':_0x73d7[_0x8623('0x52')]['id']}})[_0x8623('0x25')](handleEntityNotFound(_0x1b3b3b,null))[_0x8623('0x25')](removeEntity(_0x1b3b3b,null))['catch'](handleError(_0x1b3b3b,null));};exports[_0x8623('0x58')]=function(_0x4f48b7,_0x400d05){return db[_0x8623('0x29')]['describe']()['then'](respondWithResult(_0x400d05,null))[_0x8623('0x44')](handleError(_0x400d05,null));};exports['addSections']=function(_0x50d08b,_0x32f81d){var _0x1d21f7=_0x50d08b[_0x8623('0x48')];return db['UserProfile'][_0x8623('0x4a')]({'where':{'id':_0x50d08b['params']['id']}})[_0x8623('0x25')](handleEntityNotFound(_0x32f81d,null))[_0x8623('0x25')](function(_0x390e54){if(_0x390e54){return db['sequelize']['transaction'](function(_0x31988f){return db[_0x8623('0x51')]['destroy']({'where':{'userProfileId':_0x50d08b['params']['id'],'sectionId':_[_0x8623('0x3b')](_0x1d21f7,function(_0x1a2494){return _0x1a2494['sectionId'];})},'transaction':_0x31988f})['then'](function(){var _0x1b08ac=_[_0x8623('0x3b')](_0x1d21f7,function(_0x31b0fa){_0x31b0fa[_0x8623('0x56')]=_0x50d08b[_0x8623('0x52')]['id'];return _0x31b0fa;});var _0x538e66=[];return BPromise['each'](_0x1b08ac,function(_0x4637e5){return db[_0x8623('0x51')][_0x8623('0x47')](_0x4637e5,{'include':[{'model':db['UserProfileResource'],'as':_0x8623('0x57')}],'raw':!![],'transaction':_0x31988f})['then'](function(_0xac3221){_0x538e66[_0x8623('0x59')](_0xac3221[_0x8623('0x50')]({'plain':!![]}));});})[_0x8623('0x25')](function(){return _0x538e66;});});});}})[_0x8623('0x25')](function(_0x185364){return _0x185364;})['then'](respondWithResult(_0x32f81d,null))[_0x8623('0x44')](handleError(_0x32f81d,null));};exports[_0x8623('0x5a')]=function(_0x4c4ed1,_0x52ee76){var _0x139d8e;return db[_0x8623('0x29')][_0x8623('0x4a')]({'where':{'id':_0x4c4ed1[_0x8623('0x52')]['id']},'attributes':['id',_0x8623('0x27')]})[_0x8623('0x25')](handleEntityNotFound(_0x52ee76,null))['then'](function(_0x2e5a21){if(_0x2e5a21){_0x139d8e=_0x2e5a21;return db['UserProfileSection'][_0x8623('0x26')]({'where':{'userProfileId':_0x4c4ed1[_0x8623('0x52')]['id'],'sectionId':_0x4c4ed1[_0x8623('0x2f')][_0x8623('0x5b')]}});}})[_0x8623('0x25')](function(){return _0x139d8e;})['then'](respondWithStatusCode(_0x52ee76,null))[_0x8623('0x44')](handleError(_0x52ee76,null));};exports[_0x8623('0x5c')]=function(_0x2c0298,_0x2a686d){var _0x2fd05e=[];var _0x5e4fc3=[];return db[_0x8623('0x51')][_0x8623('0x42')]({'where':{'userProfileId':_0x2c0298['params']['id']},'raw':!![]})[_0x8623('0x25')](function(_0x4d3ad8){_0x2fd05e=_[_0x8623('0x3a')](_0x4d3ad8,function(_0x4ee09e){return _0x4ee09e[_0x8623('0x5d')]===0x1||_['includes']([0x3eb,0x709],_0x4ee09e[_0x8623('0x5e')]);});if(!_[_0x8623('0x5f')](_0x2fd05e)){return _['map'](_0x2fd05e,function(_0x7c5bce){return _0x7c5bce[_0x8623('0x5e')];});}else{return;}})[_0x8623('0x25')](function(_0x4a42cd){if(_0x4a42cd)_0x5e4fc3=_0x4a42cd;if(_['includes'](_0x5e4fc3,0x64)){var _0x342d85=_['find'](_0x2fd05e,{'sectionId':0x64});return hasDefaultDashboard(_0x342d85)[_0x8623('0x25')](function(_0x2086fb){return _['map'](_0x2fd05e,function(_0x107bfa){if(_0x107bfa[_0x8623('0x5e')]===0x64){_0x107bfa['subsections']=_0x2086fb;}return _0x107bfa;});});}else{return;}})[_0x8623('0x25')](function(_0x1a3b62){if(_0x1a3b62)_0x2fd05e=_0x1a3b62;if(_['includes'](_0x5e4fc3,0x3eb)){var _0x5e5e85=_[_0x8623('0x4a')](_0x2fd05e,{'sectionId':0x3eb});return getCustomDashboards(_0x5e5e85)[_0x8623('0x25')](function(_0x582ef2){return _[_0x8623('0x3b')](_0x2fd05e,function(_0x2b5afc){if(_0x5e5e85[_0x8623('0x5d')]){if(_0x2b5afc['sectionId']===0x3eb){_0x2b5afc[_0x8623('0x60')]=_0x582ef2;}}else{if(_0x2b5afc[_0x8623('0x5e')]===0x64){if(!_0x2b5afc[_0x8623('0x60')]){_0x2b5afc[_0x8623('0x60')]=[];}_0x2b5afc['subsections']=_0x2b5afc[_0x8623('0x60')][_0x8623('0x61')](_0x582ef2);}}return _0x2b5afc;});});}else{return;}})[_0x8623('0x25')](function(_0x28f13a){if(_0x28f13a)_0x2fd05e=_0x28f13a;if(_['includes'](_0x5e4fc3,0x709)){var _0x20acda=_[_0x8623('0x4a')](_0x2fd05e,{'sectionId':0x709});return getPlugins(_0x20acda)[_0x8623('0x25')](function(_0x590fea){if(_0x20acda['enabled']){return _[_0x8623('0x3b')](_0x2fd05e,function(_0x184334){if(_0x184334['sectionId']===0x709){_0x184334[_0x8623('0x60')]=_0x590fea;}return _0x184334;});}else{var _0x5f5b53={'sectionId':0x76c,'enabled':0x1,'subsections':_0x590fea};var _0x3e0e30=_[_0x8623('0x3b')](_0x2fd05e);_0x3e0e30['push'](_0x5f5b53);return _0x3e0e30;}});}else{return;}})[_0x8623('0x25')](function(_0x21e86a){if(_0x21e86a)_0x2fd05e=_0x21e86a;return _[_0x8623('0x3a')](_0x2fd05e,[_0x8623('0x5d'),0x1]);})[_0x8623('0x25')](respondWithResult(_0x2a686d,null))[_0x8623('0x44')](handleError(_0x2a686d,null));};function hasDefaultDashboard(_0x5b8135){var _0x2da55b=[0x65];return new BPromise(function(_0xafc60f,_0x4bb36d){try{if(_0x5b8135[_0x8623('0x54')]){_0xafc60f(_0x2da55b);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x5b8135['id']},'raw':!![]})[_0x8623('0x25')](function(_0x168ce8){_0x168ce8?_0xafc60f(_0x2da55b):_0xafc60f();});}}catch(_0x55bef6){_0x4bb36d(_0x55bef6);}});}function getCustomDashboards(_0x3c003e){var _0x311b9d=[];return new BPromise(function(_0x2c1fa2,_0x13becf){try{if(_0x3c003e[_0x8623('0x54')]){return db[_0x8623('0x62')][_0x8623('0x42')]({'raw':!![]})[_0x8623('0x25')](function(_0x2df7b5){_0x2df7b5[_0x8623('0x63')](function(_0x440276){_0x311b9d['push'](_0x440276['id']+0x1869f);});_0x2c1fa2(_0x311b9d);});}else{return db[_0x8623('0x55')][_0x8623('0x42')]({'where':{'sectionId':_0x3c003e['id']},'raw':!![]})['then'](function(_0xa306b){_0xa306b[_0x8623('0x63')](function(_0xaa679){_0x311b9d[_0x8623('0x59')](_0xaa679['resourceId']+0x1869f);});_0x2c1fa2(_0x311b9d);});}}catch(_0x35dc4e){_0x13becf(_0x35dc4e);}});}function getPlugins(_0x1d41bd){var _0x19d338=[];return new BPromise(function(_0x473cf0,_0x1f20bb){try{if(_0x1d41bd[_0x8623('0x54')]){return db[_0x8623('0x64')][_0x8623('0x42')]({'raw':!![]})[_0x8623('0x25')](function(_0x51b42e){_0x51b42e[_0x8623('0x63')](function(_0x5c1fd8){_0x19d338[_0x8623('0x59')](_0x5c1fd8['id']+0x15b38);});_0x473cf0(_0x19d338);});}else{return db[_0x8623('0x55')][_0x8623('0x42')]({'where':{'sectionId':_0x1d41bd['id']},'raw':!![]})[_0x8623('0x25')](function(_0x1e5963){_0x1e5963[_0x8623('0x63')](function(_0x1c152b){_0x19d338['push'](_0x1c152b['resourceId']+0x15b38);});_0x473cf0(_0x19d338);});}}catch(_0xe0381d){_0x1f20bb(_0xe0381d);}});}exports[_0x8623('0x65')]=function(_0x19ab0f,_0x30aecb){return db[_0x8623('0x29')][_0x8623('0x4a')]({'where':{'id':_0x19ab0f[_0x8623('0x52')]['id']}})[_0x8623('0x25')](handleEntityNotFound(_0x30aecb,null))[_0x8623('0x25')](function(_0x669a9b){if(_0x669a9b){return db[_0x8623('0x4e')]['transaction'](function(_0x239b84){return db[_0x8623('0x51')][_0x8623('0x42')]({'where':{'userProfileId':_0x19ab0f['params']['id']},'attributes':['id'],'raw':!![]})[_0x8623('0x25')](function(_0x35a5a1){if(_0x35a5a1){return db[_0x8623('0x51')]['destroy']({'where':{'userProfileId':_0x19ab0f[_0x8623('0x52')]['id'],'id':_[_0x8623('0x3b')](_0x35a5a1,function(_0x5db681){return _0x5db681['id'];})},'transaction':_0x239b84});}})[_0x8623('0x25')](function(_0xf7be70){var _0x2119d6=_['map'](_0x19ab0f[_0x8623('0x48')],function(_0x59d3fb){_0x59d3fb[_0x8623('0x56')]=_0x19ab0f[_0x8623('0x52')]['id'];return _0x59d3fb;});return db['UserProfileSection']['bulkCreate'](_0x2119d6,{'raw':!![],'transaction':_0x239b84});})['then'](function(_0x24825d){var _0x2453fc=_[_0x8623('0x3a')](_[_0x8623('0x3b')](_0x24825d,function(_0x51f06d){return _0x51f06d['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2453fc){return db[_0x8623('0x51')][_0x8623('0x42')]({'where':{'userProfileId':_0x19ab0f[_0x8623('0x52')]['id'],'sectionId':_[_0x8623('0x3b')](_0x2453fc,function(_0x3aa647){return _0x3aa647[_0x8623('0x5e')];})},'attributes':['id',_0x8623('0x5e')],'raw':!![]})[_0x8623('0x25')](function(_0x40a375){var _0x527a5c=_[_0x8623('0x3b')](_0x19ab0f[_0x8623('0x48')],function(_0x5baa20){_0x5baa20[_0x8623('0x56')]=_0x19ab0f[_0x8623('0x52')]['id'];return _0x5baa20;});return db[_0x8623('0x55')][_0x8623('0x66')](_0x527a5c,{'raw':!![],'transaction':_0x239b84});});}})[_0x8623('0x44')](handleError(_0x30aecb,null));});}})['then'](function(_0x44beb3){var _0x2b2002=_[_0x8623('0x3b')](_0x44beb3,function(_0x2a15bf){return _0x2a15bf['get']({'plain':!![]});});})[_0x8623('0x25')](respondWithResult(_0x30aecb,null))[_0x8623('0x44')](handleError(_0x30aecb,null));};exports['removeResources']=function(_0x33e589,_0x35bc95,_0x3f40fa){return db['UserProfile'][_0x8623('0x4a')]({'where':{'id':_0x33e589[_0x8623('0x52')]['id']}})[_0x8623('0x25')](handleEntityNotFound(_0x35bc95,null))['then'](function(_0x9e186f){if(_0x9e186f){return _0x9e186f[_0x8623('0x67')](_0x33e589[_0x8623('0x2f')][_0x8623('0x5b')]);}})[_0x8623('0x25')](respondWithStatusCode(_0x35bc95,null))[_0x8623('0x44')](handleError(_0x35bc95,null));};exports[_0x8623('0x68')]=function(_0x5377da,_0x4a2186){var _0x4c19d3={};if(!_0x5377da[_0x8623('0x2f')][_0x8623('0x69')])throw new Error(_0x8623('0x6a'));if(!_0x5377da['query'][_0x8623('0x35')](_0x8623('0x6b'))){_0x4c19d3['limit']=qs[_0x8623('0x1f')](_0x5377da[_0x8623('0x2f')][_0x8623('0x1f')]);_0x4c19d3['offset']=qs[_0x8623('0x1d')](_0x5377da[_0x8623('0x2f')][_0x8623('0x1d')]);}return db[_0x8623('0x29')][_0x8623('0x4a')]({'where':{'id':_0x5377da[_0x8623('0x52')]['id']}})[_0x8623('0x25')](function(_0x304147){if(!_0x304147)throw new Error(_0x8623('0x6c')+_0x5377da[_0x8623('0x52')]['id']);return db[_0x8623('0x29')][_0x8623('0x68')](_0x5377da);})[_0x8623('0x25')](respondWithFilteredResult(_0x4a2186,_0x4c19d3))['catch'](handleError(_0x4a2186,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9eeb123..cce2dbd 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 _0xf61e=['hook','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xbd4746,_0x9ca2c8){var _0x2afcef=function(_0x5c6a0b){while(--_0x5c6a0b){_0xbd4746['push'](_0xbd4746['shift']());}};_0x2afcef(++_0x9ca2c8);}(_0xf61e,0x191));var _0xef61=function(_0x92a4a7,_0x105843){_0x92a4a7=_0x92a4a7-0x0;var _0x18ad30=_0xf61e[_0x92a4a7];return _0x18ad30;};'use strict';var EventEmitter=require(_0xef61('0x0'));var UserProfile=require(_0xef61('0x1'))['db'][_0xef61('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xef61('0x3')](0x0);var events={'afterCreate':_0xef61('0x4'),'afterUpdate':_0xef61('0x5'),'afterDestroy':_0xef61('0x6')};function emitEvent(_0x40509e){return function(_0x2bd1d0,_0x14122a,_0x239fa9){UserProfileEvents[_0xef61('0x7')](_0x40509e+':'+_0x2bd1d0['id'],_0x2bd1d0);UserProfileEvents['emit'](_0x40509e,_0x2bd1d0);_0x239fa9(null);};}for(var e in events){if(events[_0xef61('0x8')](e)){var event=events[e];UserProfile[_0xef61('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xa423=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x53a2a1,_0x595e09){var _0x270bc4=function(_0x27c716){while(--_0x27c716){_0x53a2a1['push'](_0x53a2a1['shift']());}};_0x270bc4(++_0x595e09);}(_0xa423,0x16c));var _0x3a42=function(_0x153a9f,_0x4ab2bd){_0x153a9f=_0x153a9f-0x0;var _0x11b1e0=_0xa423[_0x153a9f];return _0x11b1e0;};'use strict';var EventEmitter=require(_0x3a42('0x0'));var UserProfile=require(_0x3a42('0x1'))['db'][_0x3a42('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3a42('0x3')](0x0);var events={'afterCreate':_0x3a42('0x4'),'afterUpdate':'update','afterDestroy':_0x3a42('0x5')};function emitEvent(_0x857de4){return function(_0x5c4f6a,_0xc6780b,_0x33f87e){UserProfileEvents[_0x3a42('0x6')](_0x857de4+':'+_0x5c4f6a['id'],_0x5c4f6a);UserProfileEvents[_0x3a42('0x6')](_0x857de4,_0x5c4f6a);_0x33f87e(null);};}for(var e in events){if(events[_0x3a42('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x3a42('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 6f960a8..31576d3 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 _0x7a9f=['from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','merge','VIRTUAL','forEach','options','reportType','default','reportId','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','includeAll','include','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','mail','lodash','./userProfile.attributes','exports','models','filter','field','findAll','then','model','associatedResources','map','name','catch','resolve','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','VoiceQueues','queue','VoiceQueue','outbound','musiconholds','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','zohoaccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','variables','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','slice','Sequelize','SELECT','ui.createdAt'];(function(_0x5484cb,_0x225674){var _0x5dffb2=function(_0x924de6){while(--_0x924de6){_0x5484cb['push'](_0x5484cb['shift']());}};_0x5dffb2(++_0x225674);}(_0x7a9f,0x1a1));var _0xf7a9=function(_0x44a6bc,_0xa0794c){_0x44a6bc=_0x44a6bc-0x0;var _0x1f87b1=_0x7a9f[_0x44a6bc];return _0x1f87b1;};'use strict';var _=require(_0xf7a9('0x0'));var attributes=require(_0xf7a9('0x1'));var squel=require('squel');module[_0xf7a9('0x2')]=function(_0x587f4b){var _0x116c4e=_0x587f4b[_0xf7a9('0x3')];function _0x348eab(_0x184634,_0x15a359){return new Promise(function(_0x4b9084,_0x38353c){if(!_0x15a359)return _0x4b9084(null);var _0x254398=_0x15a359[_0xf7a9('0x4')]?{[_0x15a359['filter'][_0xf7a9('0x5')]]:_0x15a359[_0xf7a9('0x4')]['value']}:undefined;return _0x116c4e[_0x184634][_0xf7a9('0x6')]({'where':_0x254398,'raw':!![]})[_0xf7a9('0x7')](function(_0x1d8057){_0x15a359['associatedResources']=_['map'](_0x1d8057,'id');_0x4b9084(_0x15a359);})['catch'](function(_0x22a3fe){_0x38353c(_0x22a3fe);});});}function _0x302bde(_0x1b0455,_0x555986){return new Promise(function(_0x1493ab,_0xe3e87a){var _0x5c3e91=_0x1b0455[_0xf7a9('0x4')]?{[_0x1b0455[_0xf7a9('0x4')][_0xf7a9('0x5')]]:_0x1b0455[_0xf7a9('0x4')]['value']}:undefined;return _0x116c4e[_0x1b0455[_0xf7a9('0x8')]]['findAll']({'where':_0x5c3e91,'raw':!![]})[_0xf7a9('0x7')](function(_0x58d943){_0x555986[_0xf7a9('0x9')]=_[_0xf7a9('0xa')](_0x58d943,function(_0x4128ca){return _0x4128ca[_0xf7a9('0xb')];});_0x1493ab(_0x555986);})[_0xf7a9('0xc')](function(_0x5cf683){_0xe3e87a(_0x5cf683);});});}function _0x5ed739(_0x657449,_0x3a9782,_0x25cc2f){if(!_0x3a9782)return Promise[_0xf7a9('0xd')](null);return new Promise(function(_0x4dbe26,_0x38df37){return _0x116c4e['UserProfileResource']['findAll']({'where':{'sectionId':_0x3a9782['id']},'raw':!![]})['then'](function(_0x2ce8f7){if(_0x657449[_0xf7a9('0x5')]&&_0x657449[_0xf7a9('0x5')]!=='id'){_0x3a9782[_0xf7a9('0x9')]=_[_0xf7a9('0xa')](_0x2ce8f7,function(_0x243ae5){return _0x243ae5[_0x657449[_0xf7a9('0x5')]];});}else{if(_0x25cc2f===_0xf7a9('0xe')){_0x3a9782['associatedResources']=_[_0xf7a9('0xa')](_0x2ce8f7,function(_0xc6f106){return{'id':_0xc6f106[_0xf7a9('0xf')],'type':_0xc6f106[_0xf7a9('0x10')]};});}else{_0x3a9782[_0xf7a9('0x9')]=_['map'](_0x2ce8f7,function(_0x27382d){return _0x27382d[_0xf7a9('0xf')];});}}_0x4dbe26(_0x3a9782);})[_0xf7a9('0xc')](function(_0x173126){_0x38df37(_0x173126);});});}function _0x9d3870(_0x51a244,_0x3d405f){var _0x465346={'parentSections':[]};switch(_0x51a244['toLowerCase']()){case _0xf7a9('0x11'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x13');break;case'odbc':_0x465346[_0xf7a9('0x12')]='SquareOdbc';break;case _0xf7a9('0x14'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x15');_0x465346[_0xf7a9('0x16')]=[{'name':'SquareProjects','field':_0xf7a9('0xb'),'foreignKey':_0xf7a9('0x17')}];break;case _0xf7a9('0x18'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x19');break;case _0xf7a9('0x1a'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x1b');_0x465346[_0xf7a9('0x16')]=[{'name':_0xf7a9('0x1c'),'field':'id','foreignKey':_0xf7a9('0x1d')}];break;case _0xf7a9('0x1e'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x1f');break;case _0xf7a9('0x20'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x21');break;case'globalcustomfields':_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x22');break;case _0xf7a9('0x23'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x24');break;case _0xf7a9('0x25'):_0x465346['childModel']=_0xf7a9('0x26');break;case'faxqueues':_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x27');break;case _0xf7a9('0x28'):_0x465346['childModel']=_0xf7a9('0x29');break;case _0xf7a9('0x2a'):case _0xf7a9('0x2b'):case _0xf7a9('0x2c'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x2d');break;case _0xf7a9('0x2e'):_0x465346[_0xf7a9('0x12')]='VoiceContext';break;case _0xf7a9('0x2f'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x30');break;case _0xf7a9('0x31'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x32');_0x465346[_0xf7a9('0x16')]=[{'name':_0xf7a9('0x33'),'field':_0xf7a9('0xb'),'foreignKey':'membername','model':_0xf7a9('0x34'),'filter':{'field':_0xf7a9('0x35'),'value':[_0xf7a9('0x36')]}},{'name':_0xf7a9('0x37'),'field':_0xf7a9('0xb'),'foreignKey':_0xf7a9('0x38'),'model':_0xf7a9('0x34'),'filter':{'field':'role','value':['telephone']}},{'name':_0xf7a9('0x39'),'field':_0xf7a9('0xb'),'foreignKey':_0xf7a9('0x3a'),'model':_0xf7a9('0x3b'),'filter':{'field':_0xf7a9('0x10'),'value':['inbound']}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xf7a9('0x3a'),'model':'VoiceQueue','filter':{'field':_0xf7a9('0x10'),'value':[_0xf7a9('0x3c')]}}];break;case _0xf7a9('0x3d'):_0x465346[_0xf7a9('0x12')]='VoiceMusicOnHold';break;case'chanspies':_0x465346[_0xf7a9('0x12')]='VoiceChanSpy';break;case _0xf7a9('0x3e'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x3f');break;case _0xf7a9('0x40'):_0x465346[_0xf7a9('0x12')]='Campaign';break;case'mailqueues':_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x41');break;case _0xf7a9('0x42'):_0x465346['childModel']=_0xf7a9('0x43');break;case _0xf7a9('0x44'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x45');break;case _0xf7a9('0x46'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x47');break;case _0xf7a9('0x48'):_0x465346['childModel']=_0xf7a9('0x49');break;case _0xf7a9('0x4a'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x4b');break;case'smsaccounts':_0x465346[_0xf7a9('0x12')]='SmsAccount';break;case'whatsappqueues':_0x465346['childModel']='WhatsappQueue';break;case _0xf7a9('0x4c'):_0x465346['childModel']=_0xf7a9('0x4d');break;case _0xf7a9('0x4e'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x4f');break;case _0xf7a9('0x50'):case _0xf7a9('0x51'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x3b');if(_0x3d405f){_0x465346[_0xf7a9('0x16')]=[{'name':_0xf7a9('0x39')},{'name':_0xf7a9('0x52')}];}break;case'users':case _0xf7a9('0x53'):case _0xf7a9('0x54'):_0x465346['childModel']=_0xf7a9('0x34');if(_0x3d405f){_0x465346[_0xf7a9('0x16')]=[{'name':_0xf7a9('0x55'),'filter':{'field':_0xf7a9('0x35'),'value':[_0xf7a9('0x56'),_0xf7a9('0x57')]},'ignore':!![]},{'name':_0xf7a9('0x33')},{'name':_0xf7a9('0x37')}];}break;case _0xf7a9('0x58'):_0x465346[_0xf7a9('0x12')]='ZendeskAccount';break;case _0xf7a9('0x59'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x5a');break;case'freshdeskaccounts':_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x5b');break;case'sugarcrmaccounts':_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x5c');break;case'deskaccounts':_0x465346[_0xf7a9('0x12')]='DeskAccount';break;case _0xf7a9('0x5d'):_0x465346[_0xf7a9('0x12')]='ZohoAccount';break;case'vtigeraccounts':_0x465346[_0xf7a9('0x12')]='User';break;case _0xf7a9('0x5e'):_0x465346['childModel']=_0xf7a9('0x5f');break;case _0xf7a9('0x60'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x61');break;case _0xf7a9('0x62'):_0x465346[_0xf7a9('0x12')]='Dashboard';break;case _0xf7a9('0x63'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x64');break;case _0xf7a9('0x65'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x66');break;case _0xf7a9('0x67'):_0x465346[_0xf7a9('0x12')]='Schedule';break;case _0xf7a9('0x68'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x69');break;case _0xf7a9('0x6a'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x6b');break;case _0xf7a9('0x6c'):_0x465346['childModel']='Template';break;case _0xf7a9('0x6d'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x6e');break;case _0xf7a9('0x6f'):_0x465346[_0xf7a9('0x12')]='Trunk';break;case _0xf7a9('0x70'):_0x465346[_0xf7a9('0x12')]='Variable';break;case'plugins':_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x71');break;case _0xf7a9('0x72'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0xe');_0x465346['parentSections']=[{'name':_0xf7a9('0x73'),'field':'id','foreignKey':'reportId'}];break;case _0xf7a9('0x74'):_0x465346[_0xf7a9('0x12')]=_0xf7a9('0x75');break;}return _0x465346;}function _0x5b0514(_0xcfc7b0,_0x76b4db){var _0xbcc2d7=_0xcfc7b0[_0xf7a9('0x76')](0x0)['toUpperCase']()+_0xcfc7b0[_0xf7a9('0x77')](0x1);var _0x31d0b0={'type':_0x116c4e[_0xf7a9('0x78')]['QueryTypes'][_0xf7a9('0x79')],'raw':!![]};return new Promise(function(_0x54ae4a,_0x242bbf){var _0x3e83a4=squel['select']()[_0xf7a9('0x5')]('ui.'+_0xbcc2d7+'InteractionId','id')[_0xf7a9('0x5')](_0xf7a9('0x7a'))[_0xf7a9('0x7b')]('user_has_'+_0xcfc7b0+_0xf7a9('0x7c'),'ui')[_0xf7a9('0x7d')](_0xf7a9('0x7e'),_0x76b4db['id']);return _0x116c4e[_0xf7a9('0x7f')][_0xf7a9('0x80')](_0x3e83a4[_0xf7a9('0x81')](),_0x31d0b0)[_0xf7a9('0x7')](function(_0x478fb8){_0x76b4db[_0xbcc2d7+_0xf7a9('0x82')]=_0x478fb8;_0x54ae4a(_0x478fb8);})['catch'](function(_0x4a5d28){_0x242bbf(_0x4a5d28);});});}return _0x587f4b[_0xf7a9('0x83')]('UserProfile',attributes,{'tableName':_0xf7a9('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x358a45){var _0x114821=require('../../components/parsers/qs');var _0x30943d={'raw':_0x358a45[_0xf7a9('0x80')]['raw'],'where':{}};var _0x295ae3={};var _0x226071={'count':0x0,'rows':[]};var _0xbd4554=_0x358a45['query'][_0xf7a9('0x85')];var _0x1f3e77=_0x358a45[_0xf7a9('0x80')][_0xf7a9('0x86')]||![];var _0x35c6e7=_0x9d3870(_0xbd4554,_0x1f3e77);if(!_0x35c6e7[_0xf7a9('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0xbd4554+'\x27');var _0x4bd2be=[{'name':_0xbd4554}];if(!_[_0xf7a9('0x87')](_0x35c6e7[_0xf7a9('0x16')]))_0x4bd2be=_0x35c6e7['parentSections'];var _0x5f3d83=[];for(var _0x438422=0x0;_0x438422<_0x4bd2be[_0xf7a9('0x88')];_0x438422++){_0x5f3d83[_0xf7a9('0x89')](_0x116c4e[_0xf7a9('0x8a')][_0xf7a9('0x8b')]({'where':{'userProfileId':_0x358a45[_0xf7a9('0x8c')]['id'],'name':_0x4bd2be[_0x438422]['name']},'raw':!![]}));}return Promise[_0xf7a9('0x8d')](_0x5f3d83)[_0xf7a9('0x7')](function(_0x18507f){var _0x4024b5=_[_0xf7a9('0x4')](_0x18507f,function(_0x2f92c3){return _0x2f92c3?_0x2f92c3:undefined;});var _0x1a3e94=_['filter'](_0x4bd2be,[_0xf7a9('0x8e'),!![]]);var _0x2c3a86=_['isEmpty'](_0x4024b5)&&_[_0xf7a9('0x87')](_0x1a3e94)?null:_[_0xf7a9('0x8f')](_0x1a3e94,_0x4024b5);if(!_0x2c3a86)return null;var _0x42f2a1=[];for(var _0x261445=0x0;_0x261445<_0x2c3a86[_0xf7a9('0x88')];_0x261445++){var _0x26e439=_['find'](_0x4bd2be,function(_0xa36314){return _0x2c3a86[_0x261445]?_0xa36314[_0xf7a9('0xb')]===_0x2c3a86[_0x261445]['name']:null;});if(_0x26e439){if(_0x2c3a86[_0x261445][_0xf7a9('0x8e')]){_0x42f2a1[_0xf7a9('0x89')](_0x348eab(_0x35c6e7[_0xf7a9('0x12')],_0x2c3a86[_0x261445]));}else{if(!_0x2c3a86[_0x261445][_0xf7a9('0x90')]){_0x42f2a1[_0xf7a9('0x89')](_0x5ed739(_0x26e439,_0x2c3a86[_0x261445],_0x35c6e7['childModel']));}else{if(_0x26e439[_0xf7a9('0x8')]){_0x42f2a1[_0xf7a9('0x89')](_0x302bde(_0x26e439,_0x2c3a86[_0x261445]));}}}}}return Promise[_0xf7a9('0x8d')](_0x42f2a1);})[_0xf7a9('0x7')](function(_0x590c24){var _0xd08f7b=_0x590c24;var _0x4771d0=null;if(_0xd08f7b){_0x4771d0=_0xd08f7b[_0xf7a9('0x88')]===0x1?_0xd08f7b[0x0]:null;}if(!_0x4771d0&&!_0xd08f7b)return _0x226071;var _0x205b1c=_0x116c4e[_0x35c6e7[_0xf7a9('0x12')]]['rawAttributes'];_0x295ae3['model']=_[_0xf7a9('0x91')](_0x205b1c);_0x295ae3[_0xf7a9('0x80')]=_[_0xf7a9('0x91')](_0x358a45[_0xf7a9('0x80')]);_0x295ae3['filters']=_[_0xf7a9('0x92')](_0x295ae3['model'],_0x295ae3[_0xf7a9('0x80')]);_0x30943d[_0xf7a9('0x93')]=_[_0xf7a9('0x92')](_0x295ae3[_0xf7a9('0x8')],_0x114821[_0xf7a9('0x94')](_0x358a45[_0xf7a9('0x80')][_0xf7a9('0x94')]));_0x30943d['attributes']=_0x30943d[_0xf7a9('0x93')][_0xf7a9('0x88')]?_0x30943d[_0xf7a9('0x93')]:_0x295ae3['model'];if(!_0x358a45[_0xf7a9('0x80')][_0xf7a9('0x95')]('nolimit')){_0x30943d['limit']=_0x114821[_0xf7a9('0x96')](_0x358a45[_0xf7a9('0x80')]['limit']);_0x30943d[_0xf7a9('0x97')]=_0x114821[_0xf7a9('0x97')](_0x358a45[_0xf7a9('0x80')][_0xf7a9('0x97')]);}_0x30943d[_0xf7a9('0x98')]=_0x114821[_0xf7a9('0x99')](_0x358a45['query'][_0xf7a9('0x99')]);_0x30943d[_0xf7a9('0x7d')]=_0x114821[_0xf7a9('0x9a')](_['pick'](_0x358a45[_0xf7a9('0x80')],_0x295ae3['filters']));if(_0x358a45[_0xf7a9('0x80')][_0xf7a9('0x4')]){_0x30943d[_0xf7a9('0x7d')]=_[_0xf7a9('0x9b')](_0x30943d[_0xf7a9('0x7d')],{'$or':_[_0xf7a9('0xa')](_0x205b1c,function(_0x43bd55){if(_0x43bd55[_0xf7a9('0x10')]['key']!==_0xf7a9('0x9c')){var _0x44c5f6={};_0x44c5f6[_0x43bd55[_0xf7a9('0x5')]]={'$like':'%'+_0x358a45[_0xf7a9('0x80')][_0xf7a9('0x4')]+'%'};return _0x44c5f6;}})});}var _0x26996b=[];var _0x44d44b=null;var _0x29036c={};if(_0x4771d0){_0x44d44b=_[_0xf7a9('0x8b')](_0x4bd2be,[_0xf7a9('0xb'),_0x4771d0['name']]);if(_0x44d44b[_0xf7a9('0x5')]){_0x29036c={};if(_0x35c6e7['childModel']===_0xf7a9('0xe')){_0x29036c[_0x44d44b['foreignKey']]=_['map'](_0x4771d0['associatedResources'],'id');}else{_0x29036c[_0x44d44b['foreignKey']]=_0x4771d0[_0xf7a9('0x9')];}_0x26996b[_0xf7a9('0x89')](_0x29036c);}else{_0x30943d['where']['id']=_0x4771d0[_0xf7a9('0x9')];}}else{for(var _0x514fa1=0x0;_0x514fa1<_0xd08f7b[_0xf7a9('0x88')];_0x514fa1++){_0x44d44b=_['find'](_0x4bd2be,[_0xf7a9('0xb'),_0xd08f7b[_0x514fa1][_0xf7a9('0xb')]]);if(_0x44d44b['field']){_0x29036c={};_0x29036c[_0x44d44b['foreignKey']]=_0xd08f7b[_0x514fa1][_0xf7a9('0x9')];_0x26996b[_0xf7a9('0x89')](_0x29036c);}else{if(!_0x30943d['where']['id'])_0x30943d['where']['id']=[];_0xd08f7b[_0x514fa1][_0xf7a9('0x9')][_0xf7a9('0x9d')](function(_0x575a16){_0x30943d[_0xf7a9('0x7d')]['id'][_0xf7a9('0x89')](_0x575a16);});}}}if(!_[_0xf7a9('0x87')](_0x26996b)){_0x30943d['where']=_['merge'](_0x30943d[_0xf7a9('0x7d')],{'$and':{'$or':_0x26996b}});}_0x30943d=_[_0xf7a9('0x9b')]({},_0x30943d,_0x358a45[_0xf7a9('0x9e')]);if(_0x4771d0&&!_0x4771d0[_0xf7a9('0x90')]&&_0x35c6e7[_0xf7a9('0x12')]===_0xf7a9('0xe')){if(_0x358a45[_0xf7a9('0x80')]['includeAll']){_0x30943d['include']=[{'all':!![]}];}return _0x116c4e[_0x35c6e7[_0xf7a9('0x12')]][_0xf7a9('0x6')](_0x30943d)[_0xf7a9('0x7')](function(_0x35da1a){var _0x2d498b=[];_0x35da1a[_0xf7a9('0x9d')](function(_0x2df947){var _0x465d3c;switch(_0x2df947[_0xf7a9('0x9f')]){case _0xf7a9('0xa0'):_0x465d3c=_[_0xf7a9('0x8b')](_0x4771d0[_0xf7a9('0x9')],function(_0x287fbb){return _0x287fbb['id']===_0x2df947[_0xf7a9('0xa1')]&&_0x287fbb['type']===_0xf7a9('0xa2');});break;case _0xf7a9('0xa3'):_0x465d3c=_['find'](_0x4771d0['associatedResources'],function(_0x2ddb74){return _0x2ddb74['id']===_0x2df947[_0xf7a9('0xa1')]&&_0x2ddb74[_0xf7a9('0x10')]==='CustomReports';});break;}if(_0x465d3c)_0x2d498b['push'](_0x2df947);});_0x226071[_0xf7a9('0xa4')]=_0x2d498b[_0xf7a9('0x88')];_0x226071[_0xf7a9('0xa5')]=_0x2d498b;return _0x226071;});}else{if(!_[_0xf7a9('0x87')](_0x358a45[_0xf7a9('0x80')][_0xf7a9('0xa6')])){_0x30943d[_0xf7a9('0x7d')]['id']=_0x30943d['where']['id']?_[_0xf7a9('0x92')](_0x30943d[_0xf7a9('0x7d')]['id'],_0x358a45[_0xf7a9('0x80')][_0xf7a9('0xa6')]):_0x358a45['query'][_0xf7a9('0xa6')];if(_0x358a45[_0xf7a9('0x80')][_0xf7a9('0xa7')]){_0x30943d[_0xf7a9('0x98')]=_0x358a45[_0xf7a9('0x80')][_0xf7a9('0xa7')];}}if(_0x358a45[_0xf7a9('0x80')][_0xf7a9('0xa8')]){_0x30943d['where']=_[_0xf7a9('0x9b')](_0x30943d['where'],{'$and':_0x358a45['query'][_0xf7a9('0xa8')]});}return _0x116c4e[_0x35c6e7[_0xf7a9('0x12')]][_0xf7a9('0xa4')]({'where':_0x30943d[_0xf7a9('0x7d')]})[_0xf7a9('0x7')](function(_0x2b2cc1){_0x226071[_0xf7a9('0xa4')]=_0x2b2cc1;if(_0x358a45[_0xf7a9('0x80')][_0xf7a9('0xa9')]){if(_0x35c6e7['childModel']==='CmContact'){_0x30943d[_0xf7a9('0xaa')]=[{'model':_0x116c4e['Tag'],'as':_0xf7a9('0xab'),'attributes':['id',_0xf7a9('0xb'),_0xf7a9('0xac')],'required':_0x358a45[_0xf7a9('0x80')][_0xf7a9('0xad')]?!![]:![]},{'model':_0x116c4e[_0xf7a9('0x6b')],'as':_0xf7a9('0xae'),'attributes':['id',_0xf7a9('0xb'),'color'],'through':_0x358a45[_0xf7a9('0x80')][_0xf7a9('0xad')]?{'attributes':[],'where':{'TagId':_0x358a45['query'][_0xf7a9('0xad')]||undefined}}:{},'required':_0x358a45[_0xf7a9('0x80')]['tag']?!![]:![]}];}else{_0x30943d['include']=[{'all':!![]}];}}return _0x116c4e[_0x35c6e7[_0xf7a9('0x12')]][_0xf7a9('0x6')](_0x30943d);})[_0xf7a9('0x7')](function(_0x1c3e4f){_0x226071['rows']=_0x1c3e4f;if(_0xbd4554===_0xf7a9('0x33')&&_0x358a45[_0xf7a9('0x80')][_0xf7a9('0xaf')]===_0xf7a9('0xb0')){var _0x554af8=[];for(var _0x21a90f=0x0;_0x21a90f<_0x226071[_0xf7a9('0xa5')][_0xf7a9('0x88')];_0x21a90f++){_0x554af8[_0xf7a9('0x89')](_0x5b0514(_0xf7a9('0xb1'),_0x226071[_0xf7a9('0xa5')][_0x21a90f][_0xf7a9('0xb2')]));_0x554af8['push'](_0x5b0514('sms',_0x226071[_0xf7a9('0xa5')][_0x21a90f]['dataValues']));_0x554af8['push'](_0x5b0514('fax',_0x226071[_0xf7a9('0xa5')][_0x21a90f][_0xf7a9('0xb2')]));_0x554af8[_0xf7a9('0x89')](_0x5b0514(_0xf7a9('0xb3'),_0x226071[_0xf7a9('0xa5')][_0x21a90f][_0xf7a9('0xb2')]));_0x554af8[_0xf7a9('0x89')](_0x5b0514('openchannel',_0x226071[_0xf7a9('0xa5')][_0x21a90f][_0xf7a9('0xb2')]));_0x554af8['push'](_0x5b0514('whatsapp',_0x226071[_0xf7a9('0xa5')][_0x21a90f][_0xf7a9('0xb2')]));}return Promise[_0xf7a9('0x8d')](_0x554af8)[_0xf7a9('0x7')](function(){return _0x226071;});}return _0x226071;});}});}}});}; \ No newline at end of file +var _0x4db5=['params','all','union','ignore','autoAssociation','rawAttributes','keys','intersection','attributes','fields','nolimit','limit','offset','order','sort','filters','pick','merge','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','ids','customSorting','extraQueryConditions','CmContact','Tags','tag','ThroughTags','color','rows','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','squel','exports','models','filter','field','value','findAll','then','catch','model','associatedResources','map','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','childModel','SquareProject','squarerecordings','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','contexts','VoiceContext','VoiceRecording','User','role','agent','Telephones','membername','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','users','agents','telephones','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','Dashboard','intervals','scheduler','Schedule','sounds','Sound','Tag','Template','triggers','Trigger','trunks','Variable','plugins','extractedreports','reportId','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','ui.','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','UserProfile','user_profiles','query','raw','isEmpty','length','push','UserProfileSection','find'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4db5,0x196));var _0x54db=function(_0x3434db,_0x55f7e3){_0x3434db=_0x3434db-0x0;var _0x1c0c49=_0x4db5[_0x3434db];return _0x1c0c49;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var squel=require(_0x54db('0x0'));module[_0x54db('0x1')]=function(_0x548421){var _0x8986f6=_0x548421[_0x54db('0x2')];function _0x2a5c36(_0x4f788b,_0x2a137a){return new Promise(function(_0x2968ec,_0x192b2f){if(!_0x2a137a)return _0x2968ec(null);var _0x4bcb43=_0x2a137a[_0x54db('0x3')]?{[_0x2a137a[_0x54db('0x3')][_0x54db('0x4')]]:_0x2a137a[_0x54db('0x3')][_0x54db('0x5')]}:undefined;return _0x8986f6[_0x4f788b][_0x54db('0x6')]({'where':_0x4bcb43,'raw':!![]})[_0x54db('0x7')](function(_0x4b7212){_0x2a137a['associatedResources']=_['map'](_0x4b7212,'id');_0x2968ec(_0x2a137a);})[_0x54db('0x8')](function(_0x1c647a){_0x192b2f(_0x1c647a);});});}function _0x49c9d3(_0x11e56d,_0x47a5dc){return new Promise(function(_0x2554e3,_0x2460c1){var _0x8083ab=_0x11e56d[_0x54db('0x3')]?{[_0x11e56d[_0x54db('0x3')][_0x54db('0x4')]]:_0x11e56d['filter'][_0x54db('0x5')]}:undefined;return _0x8986f6[_0x11e56d[_0x54db('0x9')]]['findAll']({'where':_0x8083ab,'raw':!![]})[_0x54db('0x7')](function(_0xdcc434){_0x47a5dc[_0x54db('0xa')]=_[_0x54db('0xb')](_0xdcc434,function(_0x74f852){return _0x74f852['name'];});_0x2554e3(_0x47a5dc);})[_0x54db('0x8')](function(_0x508698){_0x2460c1(_0x508698);});});}function _0x28a193(_0x14d47d,_0xeebe94,_0x4d2c69){if(!_0xeebe94)return Promise[_0x54db('0xc')](null);return new Promise(function(_0x1327e5,_0x46b206){return _0x8986f6[_0x54db('0xd')][_0x54db('0x6')]({'where':{'sectionId':_0xeebe94['id']},'raw':!![]})['then'](function(_0x132365){if(_0x14d47d[_0x54db('0x4')]&&_0x14d47d['field']!=='id'){_0xeebe94['associatedResources']=_[_0x54db('0xb')](_0x132365,function(_0x29dec1){return _0x29dec1[_0x14d47d['field']];});}else{if(_0x4d2c69===_0x54db('0xe')){_0xeebe94[_0x54db('0xa')]=_[_0x54db('0xb')](_0x132365,function(_0xd6dc95){return{'id':_0xd6dc95['resourceId'],'type':_0xd6dc95[_0x54db('0xf')]};});}else{_0xeebe94[_0x54db('0xa')]=_[_0x54db('0xb')](_0x132365,function(_0x1044c6){return _0x1044c6[_0x54db('0x10')];});}}_0x1327e5(_0xeebe94);})[_0x54db('0x8')](function(_0x441923){_0x46b206(_0x441923);});});}function _0xa2c65c(_0x58978f,_0x11c399){var _0x3fa77b={'parentSections':[]};switch(_0x58978f[_0x54db('0x11')]()){case'squareprojects':_0x3fa77b[_0x54db('0x12')]=_0x54db('0x13');break;case'odbc':_0x3fa77b['childModel']='SquareOdbc';break;case _0x54db('0x14'):_0x3fa77b['childModel']='SquareRecording';_0x3fa77b[_0x54db('0x15')]=[{'name':_0x54db('0x16'),'field':_0x54db('0x17'),'foreignKey':_0x54db('0x18')}];break;case _0x54db('0x19'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x1a');break;case _0x54db('0x1b'):_0x3fa77b[_0x54db('0x12')]='CmContact';_0x3fa77b[_0x54db('0x15')]=[{'name':'Lists','field':'id','foreignKey':_0x54db('0x1c')}];break;case _0x54db('0x1d'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x1e');break;case _0x54db('0x1f'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x20');break;case _0x54db('0x21'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x22');break;case _0x54db('0x23'):_0x3fa77b['childModel']=_0x54db('0x24');break;case _0x54db('0x25'):_0x3fa77b[_0x54db('0x12')]='ChatWebsite';break;case _0x54db('0x26'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x27');break;case _0x54db('0x28'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x29');break;case'inboundroutes':case'internalroutes':case _0x54db('0x2a'):_0x3fa77b['childModel']='VoiceExtension';break;case _0x54db('0x2b'):_0x3fa77b['childModel']=_0x54db('0x2c');break;case'voicemails':_0x3fa77b[_0x54db('0x12')]='VoiceMail';break;case'voicerecordings':_0x3fa77b[_0x54db('0x12')]=_0x54db('0x2d');_0x3fa77b[_0x54db('0x15')]=[{'name':'Agents','field':_0x54db('0x17'),'foreignKey':'membername','model':_0x54db('0x2e'),'filter':{'field':_0x54db('0x2f'),'value':[_0x54db('0x30')]}},{'name':_0x54db('0x31'),'field':_0x54db('0x17'),'foreignKey':_0x54db('0x32'),'model':_0x54db('0x2e'),'filter':{'field':_0x54db('0x2f'),'value':['telephone']}},{'name':_0x54db('0x33'),'field':'name','foreignKey':_0x54db('0x34'),'model':_0x54db('0x35'),'filter':{'field':'type','value':[_0x54db('0x36')]}},{'name':_0x54db('0x37'),'field':_0x54db('0x17'),'foreignKey':_0x54db('0x34'),'model':_0x54db('0x35'),'filter':{'field':_0x54db('0xf'),'value':[_0x54db('0x38')]}}];break;case _0x54db('0x39'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x3a');break;case _0x54db('0x3b'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x3c');break;case _0x54db('0x3d'):_0x3fa77b[_0x54db('0x12')]='VoicePrefix';break;case _0x54db('0x3e'):_0x3fa77b['childModel']='Campaign';break;case'mailqueues':_0x3fa77b[_0x54db('0x12')]=_0x54db('0x3f');break;case _0x54db('0x40'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x41');break;case _0x54db('0x42'):_0x3fa77b['childModel']=_0x54db('0x43');break;case _0x54db('0x44'):_0x3fa77b[_0x54db('0x12')]='OpenchannelQueue';break;case _0x54db('0x45'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x46');break;case _0x54db('0x47'):_0x3fa77b[_0x54db('0x12')]='SmsQueue';break;case _0x54db('0x48'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x49');break;case _0x54db('0x4a'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x4b');break;case _0x54db('0x4c'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x4d');break;case'teams':_0x3fa77b['childModel']=_0x54db('0x4e');break;case _0x54db('0x4f'):case'queuecampaigns':_0x3fa77b[_0x54db('0x12')]=_0x54db('0x35');if(_0x11c399){_0x3fa77b['parentSections']=[{'name':_0x54db('0x33')},{'name':_0x54db('0x37')}];}break;case _0x54db('0x50'):case _0x54db('0x51'):case _0x54db('0x52'):_0x3fa77b[_0x54db('0x12')]='User';if(_0x11c399){_0x3fa77b[_0x54db('0x15')]=[{'name':'Users','filter':{'field':_0x54db('0x2f'),'value':['admin','user']},'ignore':!![]},{'name':_0x54db('0x53')},{'name':_0x54db('0x31')}];}break;case _0x54db('0x54'):_0x3fa77b['childModel']=_0x54db('0x55');break;case _0x54db('0x56'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x57');break;case _0x54db('0x58'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x59');break;case _0x54db('0x5a'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x5b');break;case _0x54db('0x5c'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x5d');break;case _0x54db('0x5e'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x5f');break;case'vtigeraccounts':_0x3fa77b[_0x54db('0x12')]='User';break;case _0x54db('0x60'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x61');break;case'dispositions':_0x3fa77b[_0x54db('0x12')]='Disposition';break;case'customdashboards':_0x3fa77b[_0x54db('0x12')]=_0x54db('0x62');break;case _0x54db('0x63'):_0x3fa77b[_0x54db('0x12')]='Interval';break;case'pauses':_0x3fa77b[_0x54db('0x12')]='Pause';break;case _0x54db('0x64'):_0x3fa77b['childModel']=_0x54db('0x65');break;case _0x54db('0x66'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x67');break;case'tags':_0x3fa77b[_0x54db('0x12')]=_0x54db('0x68');break;case'templates':_0x3fa77b['childModel']=_0x54db('0x69');break;case _0x54db('0x6a'):_0x3fa77b[_0x54db('0x12')]=_0x54db('0x6b');break;case _0x54db('0x6c'):_0x3fa77b[_0x54db('0x12')]='Trunk';break;case'variables':_0x3fa77b[_0x54db('0x12')]=_0x54db('0x6d');break;case _0x54db('0x6e'):_0x3fa77b['childModel']='Plugin';break;case _0x54db('0x6f'):_0x3fa77b['childModel']=_0x54db('0xe');_0x3fa77b[_0x54db('0x15')]=[{'name':'Reports','field':'id','foreignKey':_0x54db('0x70')}];break;case'metrics':_0x3fa77b[_0x54db('0x12')]=_0x54db('0x71');break;}return _0x3fa77b;}function _0x1be509(_0xada79f,_0x1ac965){var _0x344148=_0xada79f[_0x54db('0x72')](0x0)[_0x54db('0x73')]()+_0xada79f['slice'](0x1);var _0x40e064={'type':_0x8986f6[_0x54db('0x74')][_0x54db('0x75')][_0x54db('0x76')],'raw':!![]};return new Promise(function(_0x3817ca,_0x29d88d){var _0x12ab0b=squel['select']()[_0x54db('0x4')](_0x54db('0x77')+_0x344148+'InteractionId','id')[_0x54db('0x4')]('ui.createdAt')['from'](_0x54db('0x78')+_0xada79f+_0x54db('0x79'),'ui')[_0x54db('0x7a')](_0x54db('0x7b'),_0x1ac965['id']);return _0x8986f6[_0x54db('0x7c')]['query'](_0x12ab0b['toString'](),_0x40e064)[_0x54db('0x7')](function(_0x56fd48){_0x1ac965[_0x344148+'OpenTabs']=_0x56fd48;_0x3817ca(_0x56fd48);})[_0x54db('0x8')](function(_0x42f396){_0x29d88d(_0x42f396);});});}return _0x548421['define'](_0x54db('0x7d'),attributes,{'tableName':_0x54db('0x7e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x9c7fb0){var _0x47cf2d=require('../../components/parsers/qs');var _0x5393cf={'raw':_0x9c7fb0[_0x54db('0x7f')][_0x54db('0x80')],'where':{}};var _0x519f76={};var _0x51e670={'count':0x0,'rows':[]};var _0x3765bb=_0x9c7fb0[_0x54db('0x7f')]['section'];var _0xe342f8=_0x9c7fb0[_0x54db('0x7f')]['mergeResources']||![];var _0x2f0172=_0xa2c65c(_0x3765bb,_0xe342f8);if(!_0x2f0172[_0x54db('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0x3765bb+'\x27');var _0x59900a=[{'name':_0x3765bb}];if(!_[_0x54db('0x81')](_0x2f0172['parentSections']))_0x59900a=_0x2f0172[_0x54db('0x15')];var _0x1c8b50=[];for(var _0x38ee10=0x0;_0x38ee10<_0x59900a[_0x54db('0x82')];_0x38ee10++){_0x1c8b50[_0x54db('0x83')](_0x8986f6[_0x54db('0x84')][_0x54db('0x85')]({'where':{'userProfileId':_0x9c7fb0[_0x54db('0x86')]['id'],'name':_0x59900a[_0x38ee10][_0x54db('0x17')]},'raw':!![]}));}return Promise[_0x54db('0x87')](_0x1c8b50)[_0x54db('0x7')](function(_0x1668a8){var _0x507e20=_[_0x54db('0x3')](_0x1668a8,function(_0x11620e){return _0x11620e?_0x11620e:undefined;});var _0x2e1031=_[_0x54db('0x3')](_0x59900a,['ignore',!![]]);var _0x54b00b=_[_0x54db('0x81')](_0x507e20)&&_[_0x54db('0x81')](_0x2e1031)?null:_[_0x54db('0x88')](_0x2e1031,_0x507e20);if(!_0x54b00b)return null;var _0x12e6be=[];for(var _0x5f3d90=0x0;_0x5f3d90<_0x54b00b['length'];_0x5f3d90++){var _0x58e09f=_[_0x54db('0x85')](_0x59900a,function(_0x4b11b8){return _0x54b00b[_0x5f3d90]?_0x4b11b8['name']===_0x54b00b[_0x5f3d90][_0x54db('0x17')]:null;});if(_0x58e09f){if(_0x54b00b[_0x5f3d90][_0x54db('0x89')]){_0x12e6be[_0x54db('0x83')](_0x2a5c36(_0x2f0172['childModel'],_0x54b00b[_0x5f3d90]));}else{if(!_0x54b00b[_0x5f3d90][_0x54db('0x8a')]){_0x12e6be[_0x54db('0x83')](_0x28a193(_0x58e09f,_0x54b00b[_0x5f3d90],_0x2f0172['childModel']));}else{if(_0x58e09f[_0x54db('0x9')]){_0x12e6be[_0x54db('0x83')](_0x49c9d3(_0x58e09f,_0x54b00b[_0x5f3d90]));}}}}}return Promise[_0x54db('0x87')](_0x12e6be);})[_0x54db('0x7')](function(_0x5c0ad4){var _0x2c590d=_0x5c0ad4;var _0x47388a=null;if(_0x2c590d){_0x47388a=_0x2c590d['length']===0x1?_0x2c590d[0x0]:null;}if(!_0x47388a&&!_0x2c590d)return _0x51e670;var _0x9fecd4=_0x8986f6[_0x2f0172[_0x54db('0x12')]][_0x54db('0x8b')];_0x519f76[_0x54db('0x9')]=_[_0x54db('0x8c')](_0x9fecd4);_0x519f76[_0x54db('0x7f')]=_[_0x54db('0x8c')](_0x9c7fb0[_0x54db('0x7f')]);_0x519f76['filters']=_[_0x54db('0x8d')](_0x519f76[_0x54db('0x9')],_0x519f76[_0x54db('0x7f')]);_0x5393cf[_0x54db('0x8e')]=_[_0x54db('0x8d')](_0x519f76['model'],_0x47cf2d[_0x54db('0x8f')](_0x9c7fb0[_0x54db('0x7f')][_0x54db('0x8f')]));_0x5393cf[_0x54db('0x8e')]=_0x5393cf['attributes']['length']?_0x5393cf[_0x54db('0x8e')]:_0x519f76[_0x54db('0x9')];if(!_0x9c7fb0[_0x54db('0x7f')]['hasOwnProperty'](_0x54db('0x90'))){_0x5393cf['limit']=_0x47cf2d[_0x54db('0x91')](_0x9c7fb0[_0x54db('0x7f')][_0x54db('0x91')]);_0x5393cf[_0x54db('0x92')]=_0x47cf2d[_0x54db('0x92')](_0x9c7fb0[_0x54db('0x7f')][_0x54db('0x92')]);}_0x5393cf[_0x54db('0x93')]=_0x47cf2d[_0x54db('0x94')](_0x9c7fb0[_0x54db('0x7f')]['sort']);_0x5393cf[_0x54db('0x7a')]=_0x47cf2d[_0x54db('0x95')](_[_0x54db('0x96')](_0x9c7fb0[_0x54db('0x7f')],_0x519f76[_0x54db('0x95')]));if(_0x9c7fb0[_0x54db('0x7f')][_0x54db('0x3')]){_0x5393cf[_0x54db('0x7a')]=_[_0x54db('0x97')](_0x5393cf[_0x54db('0x7a')],{'$or':_['map'](_0x9fecd4,function(_0x830cb0){if(_0x830cb0[_0x54db('0xf')]['key']!==_0x54db('0x98')){var _0x5662bb={};_0x5662bb[_0x830cb0['field']]={'$like':'%'+_0x9c7fb0[_0x54db('0x7f')][_0x54db('0x3')]+'%'};return _0x5662bb;}})});}var _0x3ab764=[];var _0x168d0b=null;var _0xe8ae45={};if(_0x47388a){_0x168d0b=_[_0x54db('0x85')](_0x59900a,[_0x54db('0x17'),_0x47388a[_0x54db('0x17')]]);if(_0x168d0b[_0x54db('0x4')]){_0xe8ae45={};if(_0x2f0172[_0x54db('0x12')]==='AnalyticExtractedReport'){_0xe8ae45[_0x168d0b[_0x54db('0x99')]]=_[_0x54db('0xb')](_0x47388a[_0x54db('0xa')],'id');}else{_0xe8ae45[_0x168d0b['foreignKey']]=_0x47388a['associatedResources'];}_0x3ab764[_0x54db('0x83')](_0xe8ae45);}else{_0x5393cf[_0x54db('0x7a')]['id']=_0x47388a[_0x54db('0xa')];}}else{for(var _0x480d33=0x0;_0x480d33<_0x2c590d[_0x54db('0x82')];_0x480d33++){_0x168d0b=_[_0x54db('0x85')](_0x59900a,[_0x54db('0x17'),_0x2c590d[_0x480d33][_0x54db('0x17')]]);if(_0x168d0b['field']){_0xe8ae45={};_0xe8ae45[_0x168d0b[_0x54db('0x99')]]=_0x2c590d[_0x480d33][_0x54db('0xa')];_0x3ab764[_0x54db('0x83')](_0xe8ae45);}else{if(!_0x5393cf[_0x54db('0x7a')]['id'])_0x5393cf['where']['id']=[];_0x2c590d[_0x480d33][_0x54db('0xa')][_0x54db('0x9a')](function(_0x3c0c17){_0x5393cf[_0x54db('0x7a')]['id'][_0x54db('0x83')](_0x3c0c17);});}}}if(!_[_0x54db('0x81')](_0x3ab764)){_0x5393cf[_0x54db('0x7a')]=_['merge'](_0x5393cf[_0x54db('0x7a')],{'$and':{'$or':_0x3ab764}});}_0x5393cf=_[_0x54db('0x97')]({},_0x5393cf,_0x9c7fb0['options']);if(_0x47388a&&!_0x47388a['autoAssociation']&&_0x2f0172['childModel']===_0x54db('0xe')){if(_0x9c7fb0[_0x54db('0x7f')][_0x54db('0x9b')]){_0x5393cf[_0x54db('0x9c')]=[{'all':!![]}];}return _0x8986f6[_0x2f0172['childModel']]['findAll'](_0x5393cf)[_0x54db('0x7')](function(_0x1d0705){var _0x7ce180=[];_0x1d0705[_0x54db('0x9a')](function(_0x5b8817){var _0x2ccad7;switch(_0x5b8817[_0x54db('0x9d')]){case _0x54db('0x9e'):_0x2ccad7=_[_0x54db('0x85')](_0x47388a[_0x54db('0xa')],function(_0x574480){return _0x574480['id']===_0x5b8817[_0x54db('0x70')]&&_0x574480[_0x54db('0xf')]===_0x54db('0x9f');});break;case _0x54db('0xa0'):_0x2ccad7=_[_0x54db('0x85')](_0x47388a[_0x54db('0xa')],function(_0x36315f){return _0x36315f['id']===_0x5b8817[_0x54db('0x70')]&&_0x36315f[_0x54db('0xf')]===_0x54db('0xa1');});break;}if(_0x2ccad7)_0x7ce180[_0x54db('0x83')](_0x5b8817);});_0x51e670[_0x54db('0xa2')]=_0x7ce180[_0x54db('0x82')];_0x51e670['rows']=_0x7ce180;return _0x51e670;});}else{if(!_['isEmpty'](_0x9c7fb0['query'][_0x54db('0xa3')])){_0x5393cf[_0x54db('0x7a')]['id']=_0x5393cf[_0x54db('0x7a')]['id']?_[_0x54db('0x8d')](_0x5393cf[_0x54db('0x7a')]['id'],_0x9c7fb0[_0x54db('0x7f')][_0x54db('0xa3')]):_0x9c7fb0[_0x54db('0x7f')][_0x54db('0xa3')];if(_0x9c7fb0[_0x54db('0x7f')][_0x54db('0xa4')]){_0x5393cf[_0x54db('0x93')]=_0x9c7fb0[_0x54db('0x7f')][_0x54db('0xa4')];}}if(_0x9c7fb0[_0x54db('0x7f')]['extraQueryConditions']){_0x5393cf[_0x54db('0x7a')]=_[_0x54db('0x97')](_0x5393cf['where'],{'$and':_0x9c7fb0[_0x54db('0x7f')][_0x54db('0xa5')]});}return _0x8986f6[_0x2f0172[_0x54db('0x12')]][_0x54db('0xa2')]({'where':_0x5393cf[_0x54db('0x7a')]})[_0x54db('0x7')](function(_0x1b6608){_0x51e670[_0x54db('0xa2')]=_0x1b6608;if(_0x9c7fb0['query']['includeAll']){if(_0x2f0172[_0x54db('0x12')]===_0x54db('0xa6')){_0x5393cf[_0x54db('0x9c')]=[{'model':_0x8986f6['Tag'],'as':_0x54db('0xa7'),'attributes':['id',_0x54db('0x17'),'color'],'required':_0x9c7fb0[_0x54db('0x7f')][_0x54db('0xa8')]?!![]:![]},{'model':_0x8986f6[_0x54db('0x68')],'as':_0x54db('0xa9'),'attributes':['id',_0x54db('0x17'),_0x54db('0xaa')],'through':_0x9c7fb0[_0x54db('0x7f')][_0x54db('0xa8')]?{'attributes':[],'where':{'TagId':_0x9c7fb0[_0x54db('0x7f')][_0x54db('0xa8')]||undefined}}:{},'required':_0x9c7fb0[_0x54db('0x7f')][_0x54db('0xa8')]?!![]:![]}];}else{_0x5393cf['include']=[{'all':!![]}];}}return _0x8986f6[_0x2f0172[_0x54db('0x12')]]['findAll'](_0x5393cf);})[_0x54db('0x7')](function(_0x417876){_0x51e670[_0x54db('0xab')]=_0x417876;if(_0x3765bb==='Agents'&&_0x9c7fb0[_0x54db('0x7f')]['openTabs']===_0x54db('0xac')){var _0x33e482=[];for(var _0x20ad1d=0x0;_0x20ad1d<_0x51e670[_0x54db('0xab')][_0x54db('0x82')];_0x20ad1d++){_0x33e482[_0x54db('0x83')](_0x1be509(_0x54db('0xad'),_0x51e670[_0x54db('0xab')][_0x20ad1d]['dataValues']));_0x33e482[_0x54db('0x83')](_0x1be509(_0x54db('0xae'),_0x51e670[_0x54db('0xab')][_0x20ad1d][_0x54db('0xaf')]));_0x33e482[_0x54db('0x83')](_0x1be509(_0x54db('0xb0'),_0x51e670[_0x54db('0xab')][_0x20ad1d][_0x54db('0xaf')]));_0x33e482[_0x54db('0x83')](_0x1be509(_0x54db('0xb1'),_0x51e670[_0x54db('0xab')][_0x20ad1d][_0x54db('0xaf')]));_0x33e482[_0x54db('0x83')](_0x1be509(_0x54db('0xb2'),_0x51e670[_0x54db('0xab')][_0x20ad1d][_0x54db('0xaf')]));_0x33e482[_0x54db('0x83')](_0x1be509(_0x54db('0xb3'),_0x51e670[_0x54db('0xab')][_0x20ad1d]['dataValues']));}return Promise['all'](_0x33e482)['then'](function(){return _0x51e670;});}return _0x51e670;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index fcc9e60..9659a43 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 _0x94ff=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','randomstring','ioredis'];(function(_0x52c1b9,_0x4f706f){var _0x1bf53e=function(_0x44e537){while(--_0x44e537){_0x52c1b9['push'](_0x52c1b9['shift']());}};_0x1bf53e(++_0x4f706f);}(_0x94ff,0xc3));var _0xf94f=function(_0x4ee5a4,_0x173f85){_0x4ee5a4=_0x4ee5a4-0x0;var _0x399a54=_0x94ff[_0x4ee5a4];return _0x399a54;};'use strict';var _=require(_0xf94f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf94f('0x1'));var fs=require('fs');var Redis=require(_0xf94f('0x2'));var db=require(_0xf94f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf94f('0x4'))(_0xf94f('0x5'));var config=require('../../config/environment');var jayson=require(_0xf94f('0x6'));var client=jayson[_0xf94f('0x7')]['http']({'port':0x232a});config[_0xf94f('0x8')]=_['defaults'](config[_0xf94f('0x8')],{'host':_0xf94f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf94f('0x8')]));require(_0xf94f('0xa'))[_0xf94f('0xb')](socket);function respondWithRpcPromise(_0x57b900,_0x5c518f,_0x510972){return new BPromise(function(_0x2d3ea6,_0x234f34){return client[_0xf94f('0xc')](_0x57b900,_0x510972)[_0xf94f('0xd')](function(_0x18a8a6){logger[_0xf94f('0xe')](_0xf94f('0xf'),_0x5c518f,_0xf94f('0x10'));logger['debug'](_0xf94f('0x11'),_0x5c518f,_0xf94f('0x10'),JSON[_0xf94f('0x12')](_0x18a8a6));if(_0x18a8a6[_0xf94f('0x13')]){if(_0x18a8a6['error'][_0xf94f('0x14')]===0x1f4){logger[_0xf94f('0x13')](_0xf94f('0xf'),_0x5c518f,_0x18a8a6[_0xf94f('0x13')][_0xf94f('0x15')]);return _0x234f34(_0x18a8a6[_0xf94f('0x13')]['message']);}logger[_0xf94f('0x13')]('UserProfile,\x20%s,\x20%s',_0x5c518f,_0x18a8a6[_0xf94f('0x13')][_0xf94f('0x15')]);return _0x2d3ea6(_0x18a8a6['error']['message']);}else{logger['info'](_0xf94f('0xf'),_0x5c518f,'request\x20sent');_0x2d3ea6(_0x18a8a6['result'][_0xf94f('0x15')]);}})['catch'](function(_0x33defc){logger['error'](_0xf94f('0xf'),_0x5c518f,_0x33defc);_0x234f34(_0x33defc);});});} \ No newline at end of file +var _0xcefd=['UserProfile,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','info'];(function(_0x3b5bef,_0x2461fb){var _0x206784=function(_0x5ff750){while(--_0x5ff750){_0x3b5bef['push'](_0x3b5bef['shift']());}};_0x206784(++_0x2461fb);}(_0xcefd,0x126));var _0xdcef=function(_0x598e0e,_0x3607d3){_0x598e0e=_0x598e0e-0x0;var _0x11318c=_0xcefd[_0x598e0e];return _0x11318c;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var moment=require(_0xdcef('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcef('0x6'))(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdcef('0x9')][_0xdcef('0xa')]({'port':0x232a});config[_0xdcef('0xb')]=_[_0xdcef('0xc')](config['redis'],{'host':_0xdcef('0xd'),'port':0x18eb});var socket=require(_0xdcef('0xe'))(new Redis(config[_0xdcef('0xb')]));require(_0xdcef('0xf'))['register'](socket);function respondWithRpcPromise(_0x1946c9,_0x451606,_0x28ac35){return new BPromise(function(_0x37c1c3,_0x3fd234){return client[_0xdcef('0x10')](_0x1946c9,_0x28ac35)['then'](function(_0x4a2973){logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,'request\x20sent');logger[_0xdcef('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x451606,'request\x20sent',JSON[_0xdcef('0x14')](_0x4a2973));if(_0x4a2973[_0xdcef('0x15')]){if(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x16')]===0x1f4){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);return _0x3fd234(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);}logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973['error'][_0xdcef('0x17')]);return _0x37c1c3(_0x4a2973['error'][_0xdcef('0x17')]);}else{logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,_0xdcef('0x18'));_0x37c1c3(_0x4a2973['result']['message']);}})[_0xdcef('0x19')](function(_0x19283a){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x19283a);_0x3fd234(_0x19283a);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 44d8d32..ac624c9 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 _0x0846=['emit','removeListener','length','./userProfile.events','save','remove','update'];(function(_0x4abe09,_0x1dc41b){var _0x5ee77d=function(_0x125b0f){while(--_0x125b0f){_0x4abe09['push'](_0x4abe09['shift']());}};_0x5ee77d(++_0x1dc41b);}(_0x0846,0x1ae));var _0x6084=function(_0x516a2b,_0x4cb2ec){_0x516a2b=_0x516a2b-0x0;var _0x3262b5=_0x0846[_0x516a2b];return _0x3262b5;};'use strict';var UserProfileEvents=require(_0x6084('0x0'));var events=[_0x6084('0x1'),_0x6084('0x2'),_0x6084('0x3')];function createListener(_0x5718bf,_0x2acc8f){return function(_0x4ca595){_0x2acc8f[_0x6084('0x4')](_0x5718bf,_0x4ca595);};}function removeListener(_0x8d7568,_0x15dba6){return function(){UserProfileEvents[_0x6084('0x5')](_0x8d7568,_0x15dba6);};}exports['register']=function(_0x5d5692){for(var _0x43262f=0x0,_0x3f486a=events[_0x6084('0x6')];_0x43262f<_0x3f486a;_0x43262f++){var _0xa1d619=events[_0x43262f];var _0x2252f8=createListener('userProfile:'+_0xa1d619,_0x5d5692);UserProfileEvents['on'](_0xa1d619,_0x2252f8);}}; \ No newline at end of file +var _0xee77=['emit','register','userProfile:','update'];(function(_0x43947c,_0x1e59b7){var _0x38bd4b=function(_0x1273b6){while(--_0x1273b6){_0x43947c['push'](_0x43947c['shift']());}};_0x38bd4b(++_0x1e59b7);}(_0xee77,0x83));var _0x7ee7=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xee77[_0xc67528];return _0x38e26d;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0x7ee7('0x0')];function createListener(_0x32b7be,_0x4e9cd0){return function(_0x182878){_0x4e9cd0[_0x7ee7('0x1')](_0x32b7be,_0x182878);};}function removeListener(_0x1e4669,_0x214b89){return function(){UserProfileEvents['removeListener'](_0x1e4669,_0x214b89);};}exports[_0x7ee7('0x2')]=function(_0x3bb069){for(var _0x4e4410=0x0,_0x51230d=events['length'];_0x4e4410<_0x51230d;_0x4e4410++){var _0x1074d3=events[_0x4e4410];var _0x1254fa=createListener(_0x7ee7('0x3')+_0x1074d3,_0x3bb069);UserProfileEvents['on'](_0x1074d3,_0x1254fa);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f2733e0..850cad5 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 _0x8089=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','/describe','isAuthenticated','describe','show','post','create','/:id','delete','exports','multer','path'];(function(_0x4b74c6,_0x6b7f86){var _0x232268=function(_0x354639){while(--_0x354639){_0x4b74c6['push'](_0x4b74c6['shift']());}};_0x232268(++_0x6b7f86);}(_0x8089,0x178));var _0x9808=function(_0x3f61c2,_0x9fbfde){_0x3f61c2=_0x3f61c2-0x0;var _0x52a80a=_0x8089[_0x3f61c2];return _0x52a80a;};'use strict';var multer=require(_0x9808('0x0'));var util=require('util');var path=require(_0x9808('0x1'));var timeout=require(_0x9808('0x2'));var express=require(_0x9808('0x3'));var router=express['Router']();var fs_extra=require(_0x9808('0x4'));var auth=require(_0x9808('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9808('0x6'));var controller=require(_0x9808('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9808('0x8')](_0x9808('0x9'),auth[_0x9808('0xa')](),controller[_0x9808('0xb')]);router[_0x9808('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9808('0xc')]);router[_0x9808('0xd')]('/',auth['isAuthenticated'](),controller[_0x9808('0xe')]);router['put'](_0x9808('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x9808('0x10')](_0x9808('0xf'),auth[_0x9808('0xa')](),controller['destroy']);module[_0x9808('0x11')]=router; \ No newline at end of file +var _0xc34f=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xc34f,0x19e));var _0xfc34=function(_0x564e9f,_0x225a15){_0x564e9f=_0x564e9f-0x0;var _0x3a9f3e=_0xc34f[_0x564e9f];return _0x3a9f3e;};'use strict';var multer=require(_0xfc34('0x0'));var util=require(_0xfc34('0x1'));var path=require(_0xfc34('0x2'));var timeout=require(_0xfc34('0x3'));var express=require(_0xfc34('0x4'));var router=express[_0xfc34('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfc34('0x6'));var config=require(_0xfc34('0x7'));var controller=require(_0xfc34('0x8'));router[_0xfc34('0x9')]('/',auth[_0xfc34('0xa')](),controller['index']);router[_0xfc34('0x9')](_0xfc34('0xb'),auth[_0xfc34('0xa')](),controller[_0xfc34('0xc')]);router[_0xfc34('0x9')](_0xfc34('0xd'),auth[_0xfc34('0xa')](),controller[_0xfc34('0xe')]);router[_0xfc34('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfc34('0x10')](_0xfc34('0xd'),auth[_0xfc34('0xa')](),controller['update']);router[_0xfc34('0x11')](_0xfc34('0xd'),auth[_0xfc34('0xa')](),controller[_0xfc34('0x12')]);module[_0xfc34('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3753e7f..19472c6 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 _0xd1b2=['STRING','INTEGER','sequelize'];(function(_0x11d876,_0x4dc816){var _0x5c7084=function(_0x2947ef){while(--_0x2947ef){_0x11d876['push'](_0x11d876['shift']());}};_0x5c7084(++_0x4dc816);}(_0xd1b2,0x74));var _0x2d1b=function(_0x377e61,_0x4d7f70){_0x377e61=_0x377e61-0x0;var _0x100260=_0xd1b2[_0x377e61];return _0x100260;};'use strict';var Sequelize=require(_0x2d1b('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d1b('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2d1b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2d1b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf37b=['sequelize','STRING','INTEGER'];(function(_0x1c675f,_0xb7ee2e){var _0x4a9c21=function(_0x4a8535){while(--_0x4a8535){_0x1c675f['push'](_0x1c675f['shift']());}};_0x4a9c21(++_0xb7ee2e);}(_0xf37b,0x72));var _0xbf37=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0xf37b[_0xb7a459];return _0x104ab5;};'use strict';var Sequelize=require(_0xbf37('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf37('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xbf37('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 0a5b486..a74b85c 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 _0x1a37=['index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x1a37[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file +var _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileResource','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x4d77ad,_0x49c53d){var _0x50c482=function(_0xaf2b1f){while(--_0xaf2b1f){_0x4d77ad['push'](_0x4d77ad['shift']());}};_0x50c482(++_0x49c53d);}(_0xef0f,0x168));var _0xfef0=function(_0x5dbb04,_0x213d3d){_0x5dbb04=_0x5dbb04-0x0;var _0x3de2d9=_0xef0f[_0x5dbb04];return _0x3de2d9;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['UserProfileResource']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 45f5f0e..c34e776 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 _0x36a4=['../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','sectionId','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x36a4,0xe3));var _0x436a=function(_0xf97195,_0x194d67){_0xf97195=_0xf97195-0x0;var _0x5a4a9f=_0x36a4[_0xf97195];return _0x5a4a9f;};'use strict';var _=require('lodash');var util=require(_0x436a('0x0'));var logger=require(_0x436a('0x1'))(_0x436a('0x2'));var moment=require(_0x436a('0x3'));var BPromise=require(_0x436a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x436a('0x5'));var rimraf=require(_0x436a('0x6'));var config=require(_0x436a('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x436a('0x8')]=function(_0x4545d3,_0x580b28){return _0x4545d3[_0x436a('0x9')](_0x436a('0xa'),attributes,{'tableName':_0x436a('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x436a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9be1=['./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','api','moment','path','rimraf'];(function(_0x5ab2a7,_0x5cfdef){var _0x1eda7f=function(_0x55b0f3){while(--_0x55b0f3){_0x5ab2a7['push'](_0x5ab2a7['shift']());}};_0x1eda7f(++_0x5cfdef);}(_0x9be1,0x1c3));var _0x19be=function(_0x1235a8,_0x4595c2){_0x1235a8=_0x1235a8-0x0;var _0x184042=_0x9be1[_0x1235a8];return _0x184042;};'use strict';var _=require('lodash');var util=require(_0x19be('0x0'));var logger=require('../../config/logger')(_0x19be('0x1'));var moment=require(_0x19be('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x19be('0x3'));var rimraf=require(_0x19be('0x4'));var config=require('../../config/environment');var attributes=require(_0x19be('0x5'));module['exports']=function(_0x248f7c,_0x1ed872){return _0x248f7c[_0x19be('0x6')](_0x19be('0x7'),attributes,{'tableName':_0x19be('0x8'),'paranoid':![],'indexes':[{'name':_0x19be('0x9'),'fields':[_0x19be('0xa'),_0x19be('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 4a27b4b..084bbc9 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 _0xfb88=['then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3aa497,_0x478c35){var _0x4d7ada=function(_0x29e935){while(--_0x29e935){_0x3aa497['push'](_0x3aa497['shift']());}};_0x4d7ada(++_0x478c35);}(_0xfb88,0x1ed));var _0x8fb8=function(_0x36e198,_0x177c76){_0x36e198=_0x36e198-0x0;var _0x3e8493=_0xfb88[_0x36e198];return _0x3e8493;};'use strict';var _=require(_0x8fb8('0x0'));var util=require(_0x8fb8('0x1'));var moment=require(_0x8fb8('0x2'));var BPromise=require(_0x8fb8('0x3'));var rs=require(_0x8fb8('0x4'));var fs=require('fs');var Redis=require(_0x8fb8('0x5'));var db=require(_0x8fb8('0x6'))['db'];var utils=require(_0x8fb8('0x7'));var logger=require('../../config/logger')(_0x8fb8('0x8'));var config=require(_0x8fb8('0x9'));var jayson=require(_0x8fb8('0xa'));var client=jayson['client'][_0x8fb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b917f,_0x499f8d,_0x3d9ae9){return new BPromise(function(_0xc9e25f,_0x5e6a23){return client[_0x8fb8('0xc')](_0x5b917f,_0x3d9ae9)[_0x8fb8('0xd')](function(_0x10d5bd){logger['info'](_0x8fb8('0xe'),_0x499f8d,_0x8fb8('0xf'));logger[_0x8fb8('0x10')](_0x8fb8('0x11'),_0x499f8d,'request\x20sent',JSON[_0x8fb8('0x12')](_0x10d5bd));if(_0x10d5bd[_0x8fb8('0x13')]){if(_0x10d5bd[_0x8fb8('0x13')][_0x8fb8('0x14')]===0x1f4){logger['error'](_0x8fb8('0xe'),_0x499f8d,_0x10d5bd[_0x8fb8('0x13')][_0x8fb8('0x15')]);return _0x5e6a23(_0x10d5bd[_0x8fb8('0x13')]['message']);}logger['error'](_0x8fb8('0xe'),_0x499f8d,_0x10d5bd[_0x8fb8('0x13')][_0x8fb8('0x15')]);return _0xc9e25f(_0x10d5bd['error'][_0x8fb8('0x15')]);}else{logger[_0x8fb8('0x16')](_0x8fb8('0xe'),_0x499f8d,_0x8fb8('0xf'));_0xc9e25f(_0x10d5bd['result']['message']);}})['catch'](function(_0x263d66){logger['error'](_0x8fb8('0xe'),_0x499f8d,_0x263d66);_0x5e6a23(_0x263d66);});});} \ No newline at end of file +var _0x5142=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2d3d18,_0x475f4c){var _0x202f49=function(_0x41abb5){while(--_0x41abb5){_0x2d3d18['push'](_0x2d3d18['shift']());}};_0x202f49(++_0x475f4c);}(_0x5142,0xf8));var _0x2514=function(_0x5d272b,_0x37880d){_0x5d272b=_0x5d272b-0x0;var _0x58d55d=_0x5142[_0x5d272b];return _0x58d55d;};'use strict';var _=require(_0x2514('0x0'));var util=require(_0x2514('0x1'));var moment=require(_0x2514('0x2'));var BPromise=require(_0x2514('0x3'));var rs=require(_0x2514('0x4'));var fs=require('fs');var Redis=require(_0x2514('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2514('0x6'));var logger=require(_0x2514('0x7'))(_0x2514('0x8'));var config=require('../../config/environment');var jayson=require(_0x2514('0x9'));var client=jayson[_0x2514('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x528d5a,_0x1c89b5,_0x3ba303){return new BPromise(function(_0x42706e,_0x33abc7){return client[_0x2514('0xb')](_0x528d5a,_0x3ba303)[_0x2514('0xc')](function(_0x3bb76c){logger['info'](_0x2514('0xd'),_0x1c89b5,_0x2514('0xe'));logger[_0x2514('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x1c89b5,'request\x20sent',JSON[_0x2514('0x10')](_0x3bb76c));if(_0x3bb76c[_0x2514('0x11')]){if(_0x3bb76c[_0x2514('0x11')][_0x2514('0x12')]===0x1f4){logger[_0x2514('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x1c89b5,_0x3bb76c['error'][_0x2514('0x13')]);return _0x33abc7(_0x3bb76c[_0x2514('0x11')][_0x2514('0x13')]);}logger['error'](_0x2514('0xd'),_0x1c89b5,_0x3bb76c[_0x2514('0x11')][_0x2514('0x13')]);return _0x42706e(_0x3bb76c[_0x2514('0x11')][_0x2514('0x13')]);}else{logger[_0x2514('0x14')](_0x2514('0xd'),_0x1c89b5,_0x2514('0xe'));_0x42706e(_0x3bb76c[_0x2514('0x15')][_0x2514('0x13')]);}})[_0x2514('0x16')](function(_0x416435){logger[_0x2514('0x11')](_0x2514('0xd'),_0x1c89b5,_0x416435);_0x33abc7(_0x416435);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index cb9ccb6..f57a088 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 _0x101e=['put','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','show','post','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x101e,0x1a6));var _0xe101=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x101e[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xe101('0x0'));var util=require(_0xe101('0x1'));var path=require(_0xe101('0x2'));var timeout=require(_0xe101('0x3'));var express=require(_0xe101('0x4'));var router=express[_0xe101('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe101('0x6'));var interaction=require(_0xe101('0x7'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xe101('0x8')]('/',auth['isAuthenticated'](),controller[_0xe101('0x9')]);router['get'](_0xe101('0xa'),auth[_0xe101('0xb')](),controller['describe']);router[_0xe101('0x8')]('/:id',auth[_0xe101('0xb')](),controller[_0xe101('0xc')]);router[_0xe101('0xd')]('/',auth[_0xe101('0xb')](),controller[_0xe101('0xe')]);router[_0xe101('0xf')]('/:id',auth[_0xe101('0xb')](),controller['update']);router[_0xe101('0x10')](_0xe101('0x11'),auth[_0xe101('0xb')](),controller['destroy']);module[_0xe101('0x12')]=router; \ No newline at end of file +var _0x49ce=['isAuthenticated','/describe','/:id','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x17ba07,_0x3734f7){var _0x14377f=function(_0x5156d3){while(--_0x5156d3){_0x17ba07['push'](_0x17ba07['shift']());}};_0x14377f(++_0x3734f7);}(_0x49ce,0x7a));var _0xe49c=function(_0x4482af,_0x2df282){_0x4482af=_0x4482af-0x0;var _0x1874e5=_0x49ce[_0x4482af];return _0x1874e5;};'use strict';var multer=require('multer');var util=require(_0xe49c('0x0'));var path=require(_0xe49c('0x1'));var timeout=require(_0xe49c('0x2'));var express=require(_0xe49c('0x3'));var router=express[_0xe49c('0x4')]();var fs_extra=require(_0xe49c('0x5'));var auth=require(_0xe49c('0x6'));var interaction=require(_0xe49c('0x7'));var config=require(_0xe49c('0x8'));var controller=require(_0xe49c('0x9'));router[_0xe49c('0xa')]('/',auth[_0xe49c('0xb')](),controller['index']);router['get'](_0xe49c('0xc'),auth[_0xe49c('0xb')](),controller['describe']);router['get'](_0xe49c('0xd'),auth[_0xe49c('0xb')](),controller['show']);router['post']('/',auth[_0xe49c('0xb')](),controller[_0xe49c('0xe')]);router[_0xe49c('0xf')](_0xe49c('0xd'),auth[_0xe49c('0xb')](),controller[_0xe49c('0x10')]);router['delete'](_0xe49c('0xd'),auth[_0xe49c('0xb')](),controller[_0xe49c('0x11')]);module[_0xe49c('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d6ee12e..7c9bd39 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 _0x4cf8=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0xd7c05d,_0x18c29f){var _0x2556d6=function(_0x418e45){while(--_0x418e45){_0xd7c05d['push'](_0xd7c05d['shift']());}};_0x2556d6(++_0x18c29f);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0x4cf8[_0x4a3acd];return _0x3efdaa;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'name':{'type':Sequelize[_0x84cf('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x84cf('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x84cf('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x84cf('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x84cf('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x84cf('0x2')],'set':function(_0x3bbbc3){this[_0x84cf('0x5')](_0x84cf('0x6'),_0x3bbbc3?_0x3bbbc3[_0x84cf('0x7')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x84cf('0x8')]('crudPermissions')[_0x84cf('0x9')](''):[];}}}; \ No newline at end of file +var _0x7d25=['INTEGER','BOOLEAN','getDataValue','crudPermissions','split','exports','STRING'];(function(_0x3746fe,_0x30b6b0){var _0xb3093d=function(_0x424b01){while(--_0x424b01){_0x3746fe['push'](_0x3746fe['shift']());}};_0xb3093d(++_0x30b6b0);}(_0x7d25,0x8a));var _0x57d2=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7d25[_0x47fd36];return _0x21a0fc;};'use strict';var Sequelize=require('sequelize');module[_0x57d2('0x0')]={'name':{'type':Sequelize[_0x57d2('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x57d2('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x57d2('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x57d2('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x57d2('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x57d2('0x1')],'set':function(_0x5c1baa){this['setDataValue']('crudPermissions',_0x5c1baa?_0x5c1baa['join'](''):[]);},'get':function(){return this[_0x57d2('0x4')]('crudPermissions')?this[_0x57d2('0x4')](_0x57d2('0x5'))[_0x57d2('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 51466e8..abef4ec 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 _0x8835=['intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','include','findAll','rows','show','keys','includeAll','find','catch','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','Content-Range','apply','reject','then','end','error','stack','name','map','UserProfileSection','rawAttributes','fieldName','type','model','query','filters','attributes'];(function(_0x463741,_0x3e8521){var _0x41da54=function(_0x4e6928){while(--_0x4e6928){_0x463741['push'](_0x463741['shift']());}};_0x41da54(++_0x3e8521);}(_0x8835,0x127));var _0x5883=function(_0x527209,_0x1ad0bd){_0x527209=_0x527209-0x0;var _0x27f805=_0x8835[_0x527209];return _0x27f805;};'use strict';var emlformat=require(_0x5883('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5883('0x1'));var jsonpatch=require(_0x5883('0x2'));var rp=require(_0x5883('0x3'));var moment=require(_0x5883('0x4'));var BPromise=require(_0x5883('0x5'));var Mustache=require(_0x5883('0x6'));var util=require(_0x5883('0x7'));var path=require(_0x5883('0x8'));var sox=require('sox');var csv=require(_0x5883('0x9'));var ejs=require(_0x5883('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5883('0xb'));var squel=require(_0x5883('0xc'));var crypto=require(_0x5883('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5883('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5883('0xf'));var Papa=require(_0x5883('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5883('0x11'));var as=require(_0x5883('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5883('0x13'));var licenseUtil=require(_0x5883('0x14'));var db=require(_0x5883('0x15'))['db'];function respondWithStatusCode(_0x337de6,_0xbbeaea){_0xbbeaea=_0xbbeaea||0xcc;return function(_0x1076aa){if(_0x1076aa){return _0x337de6[_0x5883('0x16')](_0xbbeaea);}return _0x337de6[_0x5883('0x17')](_0xbbeaea)['end']();};}function respondWithResult(_0x223295,_0x21f55e){_0x21f55e=_0x21f55e||0xc8;return function(_0xdf717a){if(_0xdf717a){return _0x223295[_0x5883('0x17')](_0x21f55e)['json'](_0xdf717a);}};}function respondWithFilteredResult(_0x1c0aca,_0x3c5dea){return function(_0x57277e){if(_0x57277e){var _0x149652=typeof _0x3c5dea['offset']==='undefined'&&typeof _0x3c5dea['limit']===_0x5883('0x18');var _0x96b84f=_0x57277e[_0x5883('0x19')];var _0x13cbaa=_0x149652?0x0:_0x3c5dea[_0x5883('0x1a')];var _0x19547d=_0x149652?_0x57277e[_0x5883('0x19')]:_0x3c5dea[_0x5883('0x1a')]+_0x3c5dea[_0x5883('0x1b')];var _0x27848c;if(_0x19547d>=_0x96b84f){_0x19547d=_0x96b84f;_0x27848c=0xc8;}else{_0x27848c=0xce;}_0x1c0aca[_0x5883('0x17')](_0x27848c);return _0x1c0aca['set'](_0x5883('0x1c'),_0x13cbaa+'-'+_0x19547d+'/'+_0x96b84f)['json'](_0x57277e);}return null;};}function patchUpdates(_0x57f653){return function(_0xe40690){try{jsonpatch[_0x5883('0x1d')](_0xe40690,_0x57f653,!![]);}catch(_0x2a768a){return BPromise[_0x5883('0x1e')](_0x2a768a);}return _0xe40690['save']();};}function saveUpdates(_0x2cb37d,_0x591bd3){return function(_0x47c672){if(_0x47c672){return _0x47c672['update'](_0x2cb37d)['then'](function(_0x4a8e80){return _0x4a8e80;});}return null;};}function removeEntity(_0x3ac754,_0x4e5ba5){return function(_0x1e0eea){if(_0x1e0eea){return _0x1e0eea['destroy']()[_0x5883('0x1f')](function(){_0x3ac754[_0x5883('0x17')](0xcc)[_0x5883('0x20')]();});}};}function handleEntityNotFound(_0xba0f7f,_0x401551){return function(_0x197cfa){if(!_0x197cfa){_0xba0f7f[_0x5883('0x16')](0x194);}return _0x197cfa;};}function handleError(_0x575a57,_0x21b671){_0x21b671=_0x21b671||0x1f4;return function(_0x2548ca){logger[_0x5883('0x21')](_0x2548ca[_0x5883('0x22')]);if(_0x2548ca[_0x5883('0x23')]){delete _0x2548ca[_0x5883('0x23')];}_0x575a57[_0x5883('0x17')](_0x21b671)['send'](_0x2548ca);};}exports['index']=function(_0xf9c119,_0x3f7e39){var _0x15faba={},_0x506d5b={},_0x366254={'count':0x0,'rows':[]};var _0x134b28=_[_0x5883('0x24')](db[_0x5883('0x25')][_0x5883('0x26')],function(_0x392caa){return{'name':_0x392caa[_0x5883('0x27')],'type':_0x392caa[_0x5883('0x28')]['key']};});_0x506d5b[_0x5883('0x29')]=_['map'](_0x134b28,_0x5883('0x23'));_0x506d5b[_0x5883('0x2a')]=_['keys'](_0xf9c119[_0x5883('0x2a')]);_0x506d5b[_0x5883('0x2b')]=_['intersection'](_0x506d5b['model'],_0x506d5b[_0x5883('0x2a')]);_0x15faba[_0x5883('0x2c')]=_[_0x5883('0x2d')](_0x506d5b['model'],qs[_0x5883('0x2e')](_0xf9c119[_0x5883('0x2a')]['fields']));_0x15faba[_0x5883('0x2c')]=_0x15faba['attributes'][_0x5883('0x2f')]?_0x15faba['attributes']:_0x506d5b[_0x5883('0x29')];if(!_0xf9c119[_0x5883('0x2a')][_0x5883('0x30')]('nolimit')){_0x15faba[_0x5883('0x1b')]=qs[_0x5883('0x1b')](_0xf9c119[_0x5883('0x2a')][_0x5883('0x1b')]);_0x15faba['offset']=qs[_0x5883('0x1a')](_0xf9c119['query'][_0x5883('0x1a')]);}_0x15faba[_0x5883('0x31')]=qs[_0x5883('0x32')](_0xf9c119[_0x5883('0x2a')][_0x5883('0x32')]);_0x15faba['where']=qs[_0x5883('0x2b')](_['pick'](_0xf9c119[_0x5883('0x2a')],_0x506d5b[_0x5883('0x2b')]),_0x134b28);if(_0xf9c119[_0x5883('0x2a')][_0x5883('0x33')]){_0x15faba[_0x5883('0x34')]=_[_0x5883('0x35')](_0x15faba[_0x5883('0x34')],{'$or':_[_0x5883('0x24')](_0x134b28,function(_0x2ae265){if(_0x2ae265[_0x5883('0x28')]!=='VIRTUAL'){var _0xcdfdf4={};_0xcdfdf4[_0x2ae265['name']]={'$like':'%'+_0xf9c119[_0x5883('0x2a')][_0x5883('0x33')]+'%'};return _0xcdfdf4;}})});}_0x15faba=_[_0x5883('0x35')]({},_0x15faba,_0xf9c119[_0x5883('0x36')]);var _0x2b35ae={'where':_0x15faba[_0x5883('0x34')]};return db['UserProfileSection']['count'](_0x2b35ae)[_0x5883('0x1f')](function(_0x4fbb77){_0x366254[_0x5883('0x19')]=_0x4fbb77;if(_0xf9c119[_0x5883('0x2a')]['includeAll']){_0x15faba[_0x5883('0x37')]=[{'all':!![]}];}return db[_0x5883('0x25')][_0x5883('0x38')](_0x15faba);})['then'](function(_0x511373){_0x366254[_0x5883('0x39')]=_0x511373;return _0x366254;})[_0x5883('0x1f')](respondWithFilteredResult(_0x3f7e39,_0x15faba))['catch'](handleError(_0x3f7e39,null));};exports[_0x5883('0x3a')]=function(_0xe50082,_0x17f709){var _0xc120fa={'raw':![],'where':{'id':_0xe50082['params']['id']}},_0x3c1670={};_0x3c1670[_0x5883('0x29')]=_[_0x5883('0x3b')](db[_0x5883('0x25')][_0x5883('0x26')]);_0x3c1670[_0x5883('0x2a')]=_[_0x5883('0x3b')](_0xe50082[_0x5883('0x2a')]);_0x3c1670['filters']=_[_0x5883('0x2d')](_0x3c1670[_0x5883('0x29')],_0x3c1670[_0x5883('0x2a')]);_0xc120fa[_0x5883('0x2c')]=_[_0x5883('0x2d')](_0x3c1670[_0x5883('0x29')],qs[_0x5883('0x2e')](_0xe50082[_0x5883('0x2a')][_0x5883('0x2e')]));_0xc120fa['attributes']=_0xc120fa[_0x5883('0x2c')]['length']?_0xc120fa['attributes']:_0x3c1670['model'];if(_0xe50082['query'][_0x5883('0x3c')]){_0xc120fa['include']=[{'all':!![]}];}_0xc120fa=_['merge']({},_0xc120fa,_0xe50082['options']);return db[_0x5883('0x25')][_0x5883('0x3d')](_0xc120fa)['then'](handleEntityNotFound(_0x17f709,null))[_0x5883('0x1f')](respondWithResult(_0x17f709,null))[_0x5883('0x3e')](handleError(_0x17f709,null));};exports[_0x5883('0x3f')]=function(_0xdc222d,_0x4929c5){return db[_0x5883('0x25')]['create'](_0xdc222d[_0x5883('0x40')],{})['then'](respondWithResult(_0x4929c5,0xc9))[_0x5883('0x3e')](handleError(_0x4929c5,null));};exports[_0x5883('0x41')]=function(_0x5db55b,_0x187d5e){if(_0x5db55b[_0x5883('0x40')]['id']){delete _0x5db55b[_0x5883('0x40')]['id'];}return db[_0x5883('0x25')][_0x5883('0x3d')]({'where':{'id':_0x5db55b['params']['id']}})[_0x5883('0x1f')](handleEntityNotFound(_0x187d5e,null))[_0x5883('0x1f')](saveUpdates(_0x5db55b[_0x5883('0x40')],null))['then'](respondWithResult(_0x187d5e,null))[_0x5883('0x3e')](handleError(_0x187d5e,null));};exports[_0x5883('0x42')]=function(_0x19cc9e,_0x2ed9fb){return db['UserProfileSection']['find']({'where':{'id':_0x19cc9e['params']['id']}})[_0x5883('0x1f')](handleEntityNotFound(_0x2ed9fb,null))['then'](removeEntity(_0x2ed9fb,null))[_0x5883('0x3e')](handleError(_0x2ed9fb,null));};exports['describe']=function(_0x3da1f1,_0x4cb2a7){return db[_0x5883('0x25')][_0x5883('0x43')]()[_0x5883('0x1f')](respondWithResult(_0x4cb2a7,null))[_0x5883('0x3e')](handleError(_0x4cb2a7,null));}; \ No newline at end of file +var _0x61c2=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','apply','reject','destroy','then','sendStatus','error','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x67fdc8,_0x1f4686){var _0x3d5ad8=function(_0xba2be1){while(--_0xba2be1){_0x67fdc8['push'](_0x67fdc8['shift']());}};_0x3d5ad8(++_0x1f4686);}(_0x61c2,0x120));var _0x261c=function(_0x10b1f7,_0x206201){_0x10b1f7=_0x10b1f7-0x0;var _0x418ca6=_0x61c2[_0x10b1f7];return _0x418ca6;};'use strict';var emlformat=require(_0x261c('0x0'));var rimraf=require(_0x261c('0x1'));var zipdir=require(_0x261c('0x2'));var jsonpatch=require(_0x261c('0x3'));var rp=require(_0x261c('0x4'));var moment=require(_0x261c('0x5'));var BPromise=require(_0x261c('0x6'));var Mustache=require(_0x261c('0x7'));var util=require(_0x261c('0x8'));var path=require(_0x261c('0x9'));var sox=require(_0x261c('0xa'));var csv=require('to-csv');var ejs=require(_0x261c('0xb'));var fs=require('fs');var fs_extra=require(_0x261c('0xc'));var _=require(_0x261c('0xd'));var squel=require('squel');var crypto=require(_0x261c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x261c('0xf'));var toCsv=require(_0x261c('0x10'));var querystring=require(_0x261c('0x11'));var Papa=require('papaparse');var Redis=require(_0x261c('0x12'));var authService=require(_0x261c('0x13'));var qs=require(_0x261c('0x14'));var as=require(_0x261c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x261c('0x16'))('api');var utils=require(_0x261c('0x17'));var config=require(_0x261c('0x18'));var licenseUtil=require(_0x261c('0x19'));var db=require(_0x261c('0x1a'))['db'];function respondWithStatusCode(_0x1909f6,_0x25dd6e){_0x25dd6e=_0x25dd6e||0xcc;return function(_0x18bffe){if(_0x18bffe){return _0x1909f6['sendStatus'](_0x25dd6e);}return _0x1909f6[_0x261c('0x1b')](_0x25dd6e)[_0x261c('0x1c')]();};}function respondWithResult(_0x52736d,_0x576003){_0x576003=_0x576003||0xc8;return function(_0x334070){if(_0x334070){return _0x52736d[_0x261c('0x1b')](_0x576003)[_0x261c('0x1d')](_0x334070);}};}function respondWithFilteredResult(_0x1b5405,_0x1b6b51){return function(_0x1a096a){if(_0x1a096a){var _0x452076=typeof _0x1b6b51['offset']==='undefined'&&typeof _0x1b6b51['limit']===_0x261c('0x1e');var _0x4bb99a=_0x1a096a['count'];var _0x569cfa=_0x452076?0x0:_0x1b6b51[_0x261c('0x1f')];var _0x1afff6=_0x452076?_0x1a096a[_0x261c('0x20')]:_0x1b6b51['offset']+_0x1b6b51[_0x261c('0x21')];var _0xcdc8c1;if(_0x1afff6>=_0x4bb99a){_0x1afff6=_0x4bb99a;_0xcdc8c1=0xc8;}else{_0xcdc8c1=0xce;}_0x1b5405[_0x261c('0x1b')](_0xcdc8c1);return _0x1b5405['set']('Content-Range',_0x569cfa+'-'+_0x1afff6+'/'+_0x4bb99a)[_0x261c('0x1d')](_0x1a096a);}return null;};}function patchUpdates(_0x4743bf){return function(_0x49c6fb){try{jsonpatch[_0x261c('0x22')](_0x49c6fb,_0x4743bf,!![]);}catch(_0x113047){return BPromise[_0x261c('0x23')](_0x113047);}return _0x49c6fb['save']();};}function saveUpdates(_0x113526,_0x28a296){return function(_0x17da9a){if(_0x17da9a){return _0x17da9a['update'](_0x113526)['then'](function(_0x2968a3){return _0x2968a3;});}return null;};}function removeEntity(_0x1c75a,_0x419ba0){return function(_0x3c798d){if(_0x3c798d){return _0x3c798d[_0x261c('0x24')]()[_0x261c('0x25')](function(){_0x1c75a['status'](0xcc)[_0x261c('0x1c')]();});}};}function handleEntityNotFound(_0x36331f,_0x3978a8){return function(_0x4b3c17){if(!_0x4b3c17){_0x36331f[_0x261c('0x26')](0x194);}return _0x4b3c17;};}function handleError(_0x38bb2f,_0x12c8fb){_0x12c8fb=_0x12c8fb||0x1f4;return function(_0x4d7c46){logger[_0x261c('0x27')](_0x4d7c46['stack']);if(_0x4d7c46[_0x261c('0x28')]){delete _0x4d7c46[_0x261c('0x28')];}_0x38bb2f[_0x261c('0x1b')](_0x12c8fb)[_0x261c('0x29')](_0x4d7c46);};}exports[_0x261c('0x2a')]=function(_0x668e8,_0x4de293){var _0x532b8b={},_0x1ce852={},_0x3e0d5a={'count':0x0,'rows':[]};var _0x4c128a=_['map'](db[_0x261c('0x2b')][_0x261c('0x2c')],function(_0x3a5e96){return{'name':_0x3a5e96[_0x261c('0x2d')],'type':_0x3a5e96[_0x261c('0x2e')][_0x261c('0x2f')]};});_0x1ce852[_0x261c('0x30')]=_[_0x261c('0x31')](_0x4c128a,_0x261c('0x28'));_0x1ce852['query']=_[_0x261c('0x32')](_0x668e8[_0x261c('0x33')]);_0x1ce852[_0x261c('0x34')]=_[_0x261c('0x35')](_0x1ce852[_0x261c('0x30')],_0x1ce852['query']);_0x532b8b[_0x261c('0x36')]=_['intersection'](_0x1ce852['model'],qs[_0x261c('0x37')](_0x668e8[_0x261c('0x33')][_0x261c('0x37')]));_0x532b8b[_0x261c('0x36')]=_0x532b8b[_0x261c('0x36')][_0x261c('0x38')]?_0x532b8b[_0x261c('0x36')]:_0x1ce852[_0x261c('0x30')];if(!_0x668e8[_0x261c('0x33')][_0x261c('0x39')](_0x261c('0x3a'))){_0x532b8b[_0x261c('0x21')]=qs[_0x261c('0x21')](_0x668e8['query'][_0x261c('0x21')]);_0x532b8b[_0x261c('0x1f')]=qs[_0x261c('0x1f')](_0x668e8[_0x261c('0x33')][_0x261c('0x1f')]);}_0x532b8b[_0x261c('0x3b')]=qs[_0x261c('0x3c')](_0x668e8['query']['sort']);_0x532b8b[_0x261c('0x3d')]=qs[_0x261c('0x34')](_[_0x261c('0x3e')](_0x668e8['query'],_0x1ce852[_0x261c('0x34')]),_0x4c128a);if(_0x668e8[_0x261c('0x33')]['filter']){_0x532b8b[_0x261c('0x3d')]=_[_0x261c('0x3f')](_0x532b8b[_0x261c('0x3d')],{'$or':_[_0x261c('0x31')](_0x4c128a,function(_0x3fefe5){if(_0x3fefe5[_0x261c('0x2e')]!==_0x261c('0x40')){var _0x216c18={};_0x216c18[_0x3fefe5[_0x261c('0x28')]]={'$like':'%'+_0x668e8[_0x261c('0x33')][_0x261c('0x41')]+'%'};return _0x216c18;}})});}_0x532b8b=_[_0x261c('0x3f')]({},_0x532b8b,_0x668e8[_0x261c('0x42')]);var _0x23478c={'where':_0x532b8b[_0x261c('0x3d')]};return db[_0x261c('0x2b')][_0x261c('0x20')](_0x23478c)[_0x261c('0x25')](function(_0x4e0032){_0x3e0d5a[_0x261c('0x20')]=_0x4e0032;if(_0x668e8['query'][_0x261c('0x43')]){_0x532b8b['include']=[{'all':!![]}];}return db[_0x261c('0x2b')][_0x261c('0x44')](_0x532b8b);})['then'](function(_0x10d344){_0x3e0d5a[_0x261c('0x45')]=_0x10d344;return _0x3e0d5a;})[_0x261c('0x25')](respondWithFilteredResult(_0x4de293,_0x532b8b))[_0x261c('0x46')](handleError(_0x4de293,null));};exports[_0x261c('0x47')]=function(_0x387ff7,_0x2e53e4){var _0x1e8a60={'raw':![],'where':{'id':_0x387ff7[_0x261c('0x48')]['id']}},_0x456393={};_0x456393['model']=_[_0x261c('0x32')](db[_0x261c('0x2b')][_0x261c('0x2c')]);_0x456393[_0x261c('0x33')]=_[_0x261c('0x32')](_0x387ff7[_0x261c('0x33')]);_0x456393[_0x261c('0x34')]=_['intersection'](_0x456393[_0x261c('0x30')],_0x456393[_0x261c('0x33')]);_0x1e8a60['attributes']=_[_0x261c('0x35')](_0x456393[_0x261c('0x30')],qs[_0x261c('0x37')](_0x387ff7[_0x261c('0x33')][_0x261c('0x37')]));_0x1e8a60[_0x261c('0x36')]=_0x1e8a60[_0x261c('0x36')]['length']?_0x1e8a60[_0x261c('0x36')]:_0x456393['model'];if(_0x387ff7['query'][_0x261c('0x43')]){_0x1e8a60[_0x261c('0x49')]=[{'all':!![]}];}_0x1e8a60=_[_0x261c('0x3f')]({},_0x1e8a60,_0x387ff7[_0x261c('0x42')]);return db[_0x261c('0x2b')][_0x261c('0x4a')](_0x1e8a60)['then'](handleEntityNotFound(_0x2e53e4,null))[_0x261c('0x25')](respondWithResult(_0x2e53e4,null))[_0x261c('0x46')](handleError(_0x2e53e4,null));};exports[_0x261c('0x4b')]=function(_0x3e6285,_0x11b39c){return db[_0x261c('0x2b')][_0x261c('0x4b')](_0x3e6285[_0x261c('0x4c')],{})[_0x261c('0x25')](respondWithResult(_0x11b39c,0xc9))['catch'](handleError(_0x11b39c,null));};exports['update']=function(_0x4d42bf,_0x35596e){if(_0x4d42bf[_0x261c('0x4c')]['id']){delete _0x4d42bf[_0x261c('0x4c')]['id'];}return db[_0x261c('0x2b')][_0x261c('0x4a')]({'where':{'id':_0x4d42bf[_0x261c('0x48')]['id']}})[_0x261c('0x25')](handleEntityNotFound(_0x35596e,null))[_0x261c('0x25')](saveUpdates(_0x4d42bf[_0x261c('0x4c')],null))[_0x261c('0x25')](respondWithResult(_0x35596e,null))['catch'](handleError(_0x35596e,null));};exports[_0x261c('0x24')]=function(_0x2ca863,_0x15c66c){return db[_0x261c('0x2b')]['find']({'where':{'id':_0x2ca863['params']['id']}})['then'](handleEntityNotFound(_0x15c66c,null))[_0x261c('0x25')](removeEntity(_0x15c66c,null))[_0x261c('0x46')](handleError(_0x15c66c,null));};exports[_0x261c('0x4d')]=function(_0x1350a9,_0x131008){return db[_0x261c('0x2b')][_0x261c('0x4d')]()[_0x261c('0x25')](respondWithResult(_0x131008,null))['catch'](handleError(_0x131008,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 9ca28b1..aeb07b0 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 _0x06ce=['request-promise','path','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','api','moment','bluebird'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x06ce,0x1db));var _0xe06c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x06ce[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xe06c('0x0'));var util=require(_0xe06c('0x1'));var logger=require('../../config/logger')(_0xe06c('0x2'));var moment=require(_0xe06c('0x3'));var BPromise=require(_0xe06c('0x4'));var rp=require(_0xe06c('0x5'));var fs=require('fs');var path=require(_0xe06c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x1edb71,_0x313773){return _0x1edb71[_0xe06c('0x7')](_0xe06c('0x8'),attributes,{'tableName':_0xe06c('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe06c('0xa'),_0xe06c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae08=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xae08,0x115));var _0x8ae0=function(_0x1cc318,_0x1dbad7){_0x1cc318=_0x1cc318-0x0;var _0x3dfc76=_0xae08[_0x1cc318];return _0x3dfc76;};'use strict';var _=require('lodash');var util=require(_0x8ae0('0x0'));var logger=require(_0x8ae0('0x1'))(_0x8ae0('0x2'));var moment=require(_0x8ae0('0x3'));var BPromise=require(_0x8ae0('0x4'));var rp=require(_0x8ae0('0x5'));var fs=require('fs');var path=require(_0x8ae0('0x6'));var rimraf=require(_0x8ae0('0x7'));var config=require(_0x8ae0('0x8'));var attributes=require(_0x8ae0('0x9'));module[_0x8ae0('0xa')]=function(_0x5eab60,_0x417452){return _0x5eab60[_0x8ae0('0xb')](_0x8ae0('0xc'),attributes,{'tableName':_0x8ae0('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x8ae0('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e4db22b..8b82c97 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 _0x8274=['code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','UserProfileSection,\x20%s,\x20%s','debug','stringify','error'];(function(_0x720b49,_0x4b4106){var _0x57f8bc=function(_0x5c6efd){while(--_0x5c6efd){_0x720b49['push'](_0x720b49['shift']());}};_0x57f8bc(++_0x4b4106);}(_0x8274,0x14f));var _0x4827=function(_0x1e5e1a,_0x4a678c){_0x1e5e1a=_0x1e5e1a-0x0;var _0x43f280=_0x8274[_0x1e5e1a];return _0x43f280;};'use strict';var _=require(_0x4827('0x0'));var util=require(_0x4827('0x1'));var moment=require(_0x4827('0x2'));var BPromise=require(_0x4827('0x3'));var rs=require(_0x4827('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4827('0x5'))['db'];var utils=require(_0x4827('0x6'));var logger=require(_0x4827('0x7'))('rpc');var config=require(_0x4827('0x8'));var jayson=require(_0x4827('0x9'));var client=jayson['client'][_0x4827('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xafb959,_0x137f5e,_0x2ca396){return new BPromise(function(_0x1f6bd1,_0x1b30f2){return client[_0x4827('0xb')](_0xafb959,_0x2ca396)['then'](function(_0x15f1f1){logger[_0x4827('0xc')](_0x4827('0xd'),_0x137f5e,'request\x20sent');logger[_0x4827('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x137f5e,'request\x20sent',JSON[_0x4827('0xf')](_0x15f1f1));if(_0x15f1f1[_0x4827('0x10')]){if(_0x15f1f1[_0x4827('0x10')][_0x4827('0x11')]===0x1f4){logger['error'](_0x4827('0xd'),_0x137f5e,_0x15f1f1[_0x4827('0x10')]['message']);return _0x1b30f2(_0x15f1f1[_0x4827('0x10')]['message']);}logger[_0x4827('0x10')](_0x4827('0xd'),_0x137f5e,_0x15f1f1[_0x4827('0x10')][_0x4827('0x12')]);return _0x1f6bd1(_0x15f1f1[_0x4827('0x10')]['message']);}else{logger[_0x4827('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x137f5e,_0x4827('0x13'));_0x1f6bd1(_0x15f1f1[_0x4827('0x14')][_0x4827('0x12')]);}})[_0x4827('0x15')](function(_0x552c6c){logger[_0x4827('0x10')](_0x4827('0xd'),_0x137f5e,_0x552c6c);_0x1b30f2(_0x552c6c);});});} \ No newline at end of file +var _0xfb30=['util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0xf153ba,_0x72667d){var _0x565782=function(_0x5cb94d){while(--_0x5cb94d){_0xf153ba['push'](_0xf153ba['shift']());}};_0x565782(++_0x72667d);}(_0xfb30,0x167));var _0x0fb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfb30[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0fb3('0x0'));var util=require(_0x0fb3('0x1'));var moment=require('moment');var BPromise=require(_0x0fb3('0x2'));var rs=require(_0x0fb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0fb3('0x4'));var logger=require(_0x0fb3('0x5'))('rpc');var config=require(_0x0fb3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0fb3('0x7')][_0x0fb3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5aecb1,_0x2be2fb,_0x3e83cb){return new BPromise(function(_0x37bd9a,_0x51de18){return client['request'](_0x5aecb1,_0x3e83cb)[_0x0fb3('0x9')](function(_0x29e687){logger[_0x0fb3('0xa')](_0x0fb3('0xb'),_0x2be2fb,_0x0fb3('0xc'));logger[_0x0fb3('0xd')](_0x0fb3('0xe'),_0x2be2fb,_0x0fb3('0xc'),JSON[_0x0fb3('0xf')](_0x29e687));if(_0x29e687['error']){if(_0x29e687[_0x0fb3('0x10')][_0x0fb3('0x11')]===0x1f4){logger[_0x0fb3('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2be2fb,_0x29e687[_0x0fb3('0x10')][_0x0fb3('0x12')]);return _0x51de18(_0x29e687['error']['message']);}logger[_0x0fb3('0x10')](_0x0fb3('0xb'),_0x2be2fb,_0x29e687['error'][_0x0fb3('0x12')]);return _0x37bd9a(_0x29e687[_0x0fb3('0x10')]['message']);}else{logger[_0x0fb3('0xa')](_0x0fb3('0xb'),_0x2be2fb,_0x0fb3('0xc'));_0x37bd9a(_0x29e687['result']['message']);}})[_0x0fb3('0x13')](function(_0x184ec6){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2be2fb,_0x184ec6);_0x51de18(_0x184ec6);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index acf937f..3ef4607 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x595add,_0x15feb9){var _0x52eb1a=function(_0x32fcec){while(--_0x32fcec){_0x595add['push'](_0x595add['shift']());}};_0x52eb1a(++_0x15feb9);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5dc0de,_0x25bba4){var _0x54ba0e=function(_0xc95566){while(--_0xc95566){_0x5dc0de['push'](_0x5dc0de['shift']());}};_0x54ba0e(++_0x25bba4);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9264045..7038432 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 _0xd790=['INTEGER','sequelize','exports'];(function(_0x5256d6,_0x5ef4af){var _0x50b792=function(_0x5cb615){while(--_0x5cb615){_0x5256d6['push'](_0x5256d6['shift']());}};_0x50b792(++_0x5ef4af);}(_0xd790,0xaf));var _0x0d79=function(_0xc3ca5e,_0x184b39){_0xc3ca5e=_0xc3ca5e-0x0;var _0x2a7387=_0xd790[_0xc3ca5e];return _0x2a7387;};'use strict';var Sequelize=require(_0x0d79('0x0'));module[_0x0d79('0x1')]={'penalty':{'type':Sequelize[_0x0d79('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xec12=['exports','sequelize'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xec12,0x1bf));var _0x2ec1=function(_0x5dcc12,_0x3b84d9){_0x5dcc12=_0x5dcc12-0x0;var _0xc2294e=_0xec12[_0x5dcc12];return _0xc2294e;};'use strict';var Sequelize=require(_0x2ec1('0x0'));module[_0x2ec1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index b8e79f8..121d720 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 _0x71ab=['exports','define','UserSmsQueue','user_has_sms_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x2e204e,_0x11af47){var _0x3fa6da=function(_0x4a8383){while(--_0x4a8383){_0x2e204e['push'](_0x2e204e['shift']());}};_0x3fa6da(++_0x11af47);}(_0x71ab,0x64));var _0xb71a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71ab[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['user_has_sms_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x43364f,_0x1a29a0){var _0x53b765=function(_0x409779){while(--_0x409779){_0x43364f['push'](_0x43364f['shift']());}};_0x53b765(++_0x1a29a0);}(_0x326f,0xd1));var _0xf326=function(_0x2028c1,_0x58f5d2){_0x2028c1=_0x2028c1-0x0;var _0x347d09=_0x326f[_0x2028c1];return _0x347d09;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index c944038..e1eac83 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 _0x12f1=['jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xaec147,_0x503b84){var _0x23a2e7=function(_0x3ea36f){while(--_0x3ea36f){_0xaec147['push'](_0xaec147['shift']());}};_0x23a2e7(++_0x503b84);}(_0x12f1,0x184));var _0x112f=function(_0x5b43ac,_0x9424bc){_0x5b43ac=_0x5b43ac-0x0;var _0x2f0a71=_0x12f1[_0x5b43ac];return _0x2f0a71;};'use strict';var _=require('lodash');var util=require(_0x112f('0x0'));var moment=require(_0x112f('0x1'));var BPromise=require(_0x112f('0x2'));var rs=require(_0x112f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x112f('0x4'))['db'];var utils=require(_0x112f('0x5'));var logger=require(_0x112f('0x6'))(_0x112f('0x7'));var config=require('../../config/environment');var jayson=require(_0x112f('0x8'));var client=jayson[_0x112f('0x9')][_0x112f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b9460,_0x3c5e09,_0x3425f7){return new BPromise(function(_0x3b4829,_0x341b8b){return client['request'](_0x4b9460,_0x3425f7)[_0x112f('0xb')](function(_0x1b4071){logger[_0x112f('0xc')](_0x112f('0xd'),_0x3c5e09,'request\x20sent');logger[_0x112f('0xe')](_0x112f('0xf'),_0x3c5e09,_0x112f('0x10'),JSON[_0x112f('0x11')](_0x1b4071));if(_0x1b4071[_0x112f('0x12')]){if(_0x1b4071[_0x112f('0x12')][_0x112f('0x13')]===0x1f4){logger[_0x112f('0x12')](_0x112f('0xd'),_0x3c5e09,_0x1b4071['error'][_0x112f('0x14')]);return _0x341b8b(_0x1b4071[_0x112f('0x12')]['message']);}logger['error'](_0x112f('0xd'),_0x3c5e09,_0x1b4071[_0x112f('0x12')][_0x112f('0x14')]);return _0x3b4829(_0x1b4071['error'][_0x112f('0x14')]);}else{logger[_0x112f('0xc')](_0x112f('0xd'),_0x3c5e09,_0x112f('0x10'));_0x3b4829(_0x1b4071['result'][_0x112f('0x14')]);}})[_0x112f('0x15')](function(_0x846314){logger[_0x112f('0x12')](_0x112f('0xd'),_0x3c5e09,_0x846314);_0x341b8b(_0x846314);});});} \ No newline at end of file +var _0x242e=['moment','bluebird','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','util'];(function(_0xb8a8bc,_0x50295f){var _0xf591fb=function(_0x308875){while(--_0x308875){_0xb8a8bc['push'](_0xb8a8bc['shift']());}};_0xf591fb(++_0x50295f);}(_0x242e,0x98));var _0xe242=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x242e[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xe242('0x0'));var moment=require(_0xe242('0x1'));var BPromise=require(_0xe242('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe242('0x3'));var logger=require(_0xe242('0x4'))('rpc');var config=require(_0xe242('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe242('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x160869,_0x28923a,_0x3fbbee){return new BPromise(function(_0x2d1478,_0x21bf2c){return client[_0xe242('0x7')](_0x160869,_0x3fbbee)['then'](function(_0x22aeb4){logger[_0xe242('0x8')]('UserSmsQueue,\x20%s,\x20%s',_0x28923a,_0xe242('0x9'));logger[_0xe242('0xa')](_0xe242('0xb'),_0x28923a,_0xe242('0x9'),JSON['stringify'](_0x22aeb4));if(_0x22aeb4[_0xe242('0xc')]){if(_0x22aeb4[_0xe242('0xc')][_0xe242('0xd')]===0x1f4){logger[_0xe242('0xc')](_0xe242('0xe'),_0x28923a,_0x22aeb4['error'][_0xe242('0xf')]);return _0x21bf2c(_0x22aeb4['error'][_0xe242('0xf')]);}logger[_0xe242('0xc')](_0xe242('0xe'),_0x28923a,_0x22aeb4[_0xe242('0xc')][_0xe242('0xf')]);return _0x2d1478(_0x22aeb4[_0xe242('0xc')][_0xe242('0xf')]);}else{logger[_0xe242('0x8')](_0xe242('0xe'),_0x28923a,_0xe242('0x9'));_0x2d1478(_0x22aeb4[_0xe242('0x10')][_0xe242('0xf')]);}})['catch'](function(_0x1fea60){logger[_0xe242('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x28923a,_0x1fea60);_0x21bf2c(_0x1fea60);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 265d4f5..570000b 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 _0xdc5b=['exports','INTEGER'];(function(_0x28add5,_0x3bcdd7){var _0x2eb5f7=function(_0x996ef){while(--_0x996ef){_0x28add5['push'](_0x28add5['shift']());}};_0x2eb5f7(++_0x3bcdd7);}(_0xdc5b,0x98));var _0xbdc5=function(_0x5f0d94,_0x5618be){_0x5f0d94=_0x5f0d94-0x0;var _0x4fe50d=_0xdc5b[_0x5f0d94];return _0x4fe50d;};'use strict';var Sequelize=require('sequelize');module[_0xbdc5('0x0')]={'UserId':{'type':Sequelize[_0xbdc5('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xbdc5('0x1')]}}; \ No newline at end of file +var _0x42c9=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42c9,0xbe));var _0x942c=function(_0x4fa166,_0x58b7fb){_0x4fa166=_0x4fa166-0x0;var _0x5dd974=_0x42c9[_0x4fa166];return _0x5dd974;};'use strict';var Sequelize=require(_0x942c('0x0'));module[_0x942c('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x942c('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 6820cb8..562785d 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(_0x374152,_0x3a5889){var _0x280bb5=function(_0x158849){while(--_0x158849){_0x374152['push'](_0x374152['shift']());}};_0x280bb5(++_0x3a5889);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x4673ca,_0x4e84ba){var _0x1f61d3=function(_0x2e1f51){while(--_0x2e1f51){_0x4673ca['push'](_0x4673ca['shift']());}};_0x1f61d3(++_0x4e84ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 fb2dcb6..bd0c17c 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5dd0d3,_0x304e93){var _0x5bd978=function(_0x29cd88){while(--_0x29cd88){_0x5dd0d3['push'](_0x5dd0d3['shift']());}};_0x5bd978(++_0x304e93);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x5277fc,_0x38ff34){var _0x79c18c=function(_0x27b321){while(--_0x27b321){_0x5277fc['push'](_0x5277fc['shift']());}};_0x79c18c(++_0x38ff34);}(_0x70e0,0x17b));var _0x070e=function(_0x586f03,_0x279185){_0x586f03=_0x586f03-0x0;var _0x53fb9f=_0x70e0[_0x586f03];return _0x53fb9f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index a7a0be0..71ba1cf 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 _0xd1d3=['exports','INTEGER'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd1d3,0x7a));var _0x3d1d=function(_0x506f24,_0x2f471b){_0x506f24=_0x506f24-0x0;var _0x1d4d59=_0xd1d3[_0x506f24];return _0x1d4d59;};'use strict';var Sequelize=require('sequelize');module[_0x3d1d('0x0')]={'penalty':{'type':Sequelize[_0x3d1d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc627=['exports','INTEGER'];(function(_0x304e5f,_0x3b62e8){var _0x321ebc=function(_0x2fa89f){while(--_0x2fa89f){_0x304e5f['push'](_0x304e5f['shift']());}};_0x321ebc(++_0x3b62e8);}(_0xc627,0x14a));var _0x7c62=function(_0x2c9511,_0x56186a){_0x2c9511=_0x2c9511-0x0;var _0x2e07d3=_0xc627[_0x2c9511];return _0x2e07d3;};'use strict';var Sequelize=require('sequelize');module[_0x7c62('0x0')]={'penalty':{'type':Sequelize[_0x7c62('0x1')],'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 a9c43fc..510a917 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 _0x7f92=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','lodash'];(function(_0x5681a9,_0x27cee8){var _0x273d96=function(_0x1d3fbb){while(--_0x1d3fbb){_0x5681a9['push'](_0x5681a9['shift']());}};_0x273d96(++_0x27cee8);}(_0x7f92,0xd7));var _0x27f9=function(_0xcceba1,_0x56d63b){_0xcceba1=_0xcceba1-0x0;var _0x529b91=_0x7f92[_0xcceba1];return _0x529b91;};'use strict';var _=require(_0x27f9('0x0'));var util=require(_0x27f9('0x1'));var logger=require('../../config/logger')(_0x27f9('0x2'));var moment=require('moment');var BPromise=require(_0x27f9('0x3'));var rp=require(_0x27f9('0x4'));var fs=require('fs');var path=require(_0x27f9('0x5'));var rimraf=require(_0x27f9('0x6'));var config=require(_0x27f9('0x7'));var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x1d20fb,_0x14feb2){return _0x1d20fb[_0x27f9('0x8')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36c3=['moment','bluebird','request-promise','rimraf','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x36c3,0x17c));var _0x336c=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0x36c3[_0x5534fe];return _0x3d1dc2;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var logger=require(_0x336c('0x2'))(_0x336c('0x3'));var moment=require(_0x336c('0x4'));var BPromise=require(_0x336c('0x5'));var rp=require(_0x336c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x336c('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x336c('0x8')]=function(_0x322d49,_0x1bce28){return _0x322d49[_0x336c('0x9')](_0x336c('0xa'),attributes,{'tableName':_0x336c('0xb'),'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 ff3fc67..da1ad60 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 _0x55ad=['rpc','../../config/environment','client','http','request','then','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2511e7,_0x1fb1ed){var _0x377f5e=function(_0x109472){while(--_0x109472){_0x2511e7['push'](_0x2511e7['shift']());}};_0x377f5e(++_0x1fb1ed);}(_0x55ad,0x197));var _0xd55a=function(_0x320465,_0x7165da){_0x320465=_0x320465-0x0;var _0x1b0882=_0x55ad[_0x320465];return _0x1b0882;};'use strict';var _=require('lodash');var util=require(_0xd55a('0x0'));var moment=require(_0xd55a('0x1'));var BPromise=require('bluebird');var rs=require(_0xd55a('0x2'));var fs=require('fs');var Redis=require(_0xd55a('0x3'));var db=require(_0xd55a('0x4'))['db'];var utils=require(_0xd55a('0x5'));var logger=require(_0xd55a('0x6'))(_0xd55a('0x7'));var config=require(_0xd55a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd55a('0x9')][_0xd55a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f9a45,_0x478e12,_0x33fc0a){return new BPromise(function(_0x56eb8f,_0xe74df4){return client[_0xd55a('0xb')](_0x3f9a45,_0x33fc0a)[_0xd55a('0xc')](function(_0xd63ef2){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x478e12,_0xd55a('0xd'));logger[_0xd55a('0xe')](_0xd55a('0xf'),_0x478e12,'request\x20sent',JSON[_0xd55a('0x10')](_0xd63ef2));if(_0xd63ef2[_0xd55a('0x11')]){if(_0xd63ef2[_0xd55a('0x11')][_0xd55a('0x12')]===0x1f4){logger[_0xd55a('0x11')](_0xd55a('0x13'),_0x478e12,_0xd63ef2[_0xd55a('0x11')]['message']);return _0xe74df4(_0xd63ef2[_0xd55a('0x11')][_0xd55a('0x14')]);}logger[_0xd55a('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x478e12,_0xd63ef2[_0xd55a('0x11')]['message']);return _0x56eb8f(_0xd63ef2[_0xd55a('0x11')][_0xd55a('0x14')]);}else{logger[_0xd55a('0x15')]('UserVoiceQueue,\x20%s,\x20%s',_0x478e12,_0xd55a('0xd'));_0x56eb8f(_0xd63ef2[_0xd55a('0x16')][_0xd55a('0x14')]);}})['catch'](function(_0x46206d){logger[_0xd55a('0x11')](_0xd55a('0x13'),_0x478e12,_0x46206d);_0xe74df4(_0x46206d);});});} \ No newline at end of file +var _0xc3e0=['request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','UserVoiceQueue,\x20%s,\x20%s'];(function(_0xa13e6,_0x52f51f){var _0x3ce084=function(_0x4941d6){while(--_0x4941d6){_0xa13e6['push'](_0xa13e6['shift']());}};_0x3ce084(++_0x52f51f);}(_0xc3e0,0x133));var _0x0c3e=function(_0x2815bc,_0x39f4b4){_0x2815bc=_0x2815bc-0x0;var _0x5d0762=_0xc3e0[_0x2815bc];return _0x5d0762;};'use strict';var _=require('lodash');var util=require(_0x0c3e('0x0'));var moment=require(_0x0c3e('0x1'));var BPromise=require(_0x0c3e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c3e('0x3'));var db=require(_0x0c3e('0x4'))['db'];var utils=require(_0x0c3e('0x5'));var logger=require(_0x0c3e('0x6'))(_0x0c3e('0x7'));var config=require(_0x0c3e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0c3e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e832c,_0x21e240,_0x3a0409){return new BPromise(function(_0x31971f,_0x5177db){return client['request'](_0x2e832c,_0x3a0409)[_0x0c3e('0xa')](function(_0x3dfcd9){logger[_0x0c3e('0xb')](_0x0c3e('0xc'),_0x21e240,_0x0c3e('0xd'));logger['debug'](_0x0c3e('0xe'),_0x21e240,'request\x20sent',JSON['stringify'](_0x3dfcd9));if(_0x3dfcd9['error']){if(_0x3dfcd9['error'][_0x0c3e('0xf')]===0x1f4){logger[_0x0c3e('0x10')](_0x0c3e('0xc'),_0x21e240,_0x3dfcd9[_0x0c3e('0x10')]['message']);return _0x5177db(_0x3dfcd9[_0x0c3e('0x10')][_0x0c3e('0x11')]);}logger[_0x0c3e('0x10')](_0x0c3e('0xc'),_0x21e240,_0x3dfcd9[_0x0c3e('0x10')][_0x0c3e('0x11')]);return _0x31971f(_0x3dfcd9[_0x0c3e('0x10')][_0x0c3e('0x11')]);}else{logger[_0x0c3e('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x21e240,_0x0c3e('0xd'));_0x31971f(_0x3dfcd9[_0x0c3e('0x12')][_0x0c3e('0x11')]);}})[_0x0c3e('0x13')](function(_0x160aab){logger[_0x0c3e('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x21e240,_0x160aab);_0x5177db(_0x160aab);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3c68e59..2bdd0ba 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x46640c,_0x4d27c5){var _0x32fb77=function(_0x2384b6){while(--_0x2384b6){_0x46640c['push'](_0x46640c['shift']());}};_0x32fb77(++_0x4d27c5);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x87fb9d,_0x2ba366){var _0x30dcf6=function(_0x21c9f9){while(--_0x21c9f9){_0x87fb9d['push'](_0x87fb9d['shift']());}};_0x30dcf6(++_0x2ba366);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ef5cf4f..c21e056 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 _0x2228=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface'];(function(_0x49c890,_0x425615){var _0x48dbee=function(_0x3ac99f){while(--_0x3ac99f){_0x49c890['push'](_0x49c890['shift']());}};_0x48dbee(++_0x425615);}(_0x2228,0x118));var _0x8222=function(_0x4a0b3d,_0x51a79c){_0x4a0b3d=_0x4a0b3d-0x0;var _0x534053=_0x2228[_0x4a0b3d];return _0x534053;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8222('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x8222('0x1')],'allowNull':![],'comment':_0x8222('0x2')},'UserId':{'type':Sequelize[_0x8222('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8222('0x1')],'allowNull':![],'unique':_0x8222('0x3'),'comment':_0x8222('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8222('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0x8222('0x1')],'allowNull':![],'unique':_0x8222('0x3'),'comment':_0x8222('0x2')},'penalty':{'type':Sequelize[_0x8222('0x0')](0xb),'defaultValue':0x0,'comment':_0x8222('0x2')},'paused':{'type':Sequelize[_0x8222('0x0')](0xb),'defaultValue':0x0,'comment':_0x8222('0x2')}}; \ No newline at end of file +var _0x8a62=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x118e16,_0x2a6f97){var _0x9f7b89=function(_0xd8909a){while(--_0xd8909a){_0x118e16['push'](_0x118e16['shift']());}};_0x9f7b89(++_0x2a6f97);}(_0x8a62,0x18f));var _0x28a6=function(_0x312718,_0x87d29c){_0x312718=_0x312718-0x0;var _0x555039=_0x8a62[_0x312718];return _0x555039;};'use strict';var Sequelize=require(_0x28a6('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x28a6('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x28a6('0x2')},'membername':{'type':Sequelize[_0x28a6('0x3')],'allowNull':![],'comment':_0x28a6('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x28a6('0x3')],'allowNull':![],'unique':_0x28a6('0x4'),'comment':_0x28a6('0x2')},'VoiceQueueId':{'type':Sequelize[_0x28a6('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x28a6('0x3')],'allowNull':![],'unique':_0x28a6('0x4'),'comment':_0x28a6('0x2')},'penalty':{'type':Sequelize[_0x28a6('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x28a6('0x1')](0xb),'defaultValue':0x0,'comment':_0x28a6('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index fd90c0f..7c4cf10 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 _0xd5ae=['UserVoiceQueueRt','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0xd5ae,0x11e));var _0xed5a=function(_0x6451c3,_0xb216c2){_0x6451c3=_0x6451c3-0x0;var _0x338723=_0xd5ae[_0x6451c3];return _0x338723;};'use strict';var EventEmitter=require(_0xed5a('0x0'));var UserVoiceQueueRt=require(_0xed5a('0x1'))['db'][_0xed5a('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xed5a('0x3'),'afterDestroy':_0xed5a('0x4')};function emitEvent(_0x12ad47){return function(_0x4f5ee9,_0xc4fe3e,_0x4017f7){UserVoiceQueueRtEvents[_0xed5a('0x5')](_0x12ad47+':'+_0x4f5ee9['id'],_0x4f5ee9);UserVoiceQueueRtEvents[_0xed5a('0x5')](_0x12ad47,_0x4f5ee9);_0x4017f7(null);};}for(var e in events){if(events[_0xed5a('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xed5a('0x7')](e,emitEvent(event));}}module[_0xed5a('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x610f=['hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0xee3f56,_0xc57ae1){var _0x5194a5=function(_0xb815db){while(--_0xb815db){_0xee3f56['push'](_0xee3f56['shift']());}};_0x5194a5(++_0xc57ae1);}(_0x610f,0x14c));var _0xf610=function(_0x3ddb6f,_0x254d4a){_0x3ddb6f=_0x3ddb6f-0x0;var _0x3d24a1=_0x610f[_0x3ddb6f];return _0x3d24a1;};'use strict';var EventEmitter=require(_0xf610('0x0'));var UserVoiceQueueRt=require(_0xf610('0x1'))['db'][_0xf610('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf610('0x3')](0x0);var events={'afterCreate':_0xf610('0x4'),'afterUpdate':_0xf610('0x5'),'afterDestroy':_0xf610('0x6')};function emitEvent(_0x94dbef){return function(_0x4867be,_0x48256c,_0x3af7bc){UserVoiceQueueRtEvents['emit'](_0x94dbef+':'+_0x4867be['id'],_0x4867be);UserVoiceQueueRtEvents[_0xf610('0x7')](_0x94dbef,_0x4867be);_0x3af7bc(null);};}for(var e in events){if(events[_0xf610('0x8')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xf610('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 60e26a7..c3769d2 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 _0x1ffa=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1ffa,0x16a));var _0xa1ff=function(_0x5183c5,_0x2b4655){_0x5183c5=_0x5183c5-0x0;var _0x50028d=_0x1ffa[_0x5183c5];return _0x50028d;};'use strict';var _=require(_0xa1ff('0x0'));var util=require(_0xa1ff('0x1'));var logger=require(_0xa1ff('0x2'))(_0xa1ff('0x3'));var moment=require(_0xa1ff('0x4'));var BPromise=require(_0xa1ff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1ff('0x6'));var rimraf=require(_0xa1ff('0x7'));var config=require(_0xa1ff('0x8'));var attributes=require(_0xa1ff('0x9'));module[_0xa1ff('0xa')]=function(_0x546e8a,_0x39bac7){return _0x546e8a[_0xa1ff('0xb')](_0xa1ff('0xc'),attributes,{'tableName':_0xa1ff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d08=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt'];(function(_0x5f4266,_0x3d0fc4){var _0x2aa2f6=function(_0x41da4d){while(--_0x41da4d){_0x5f4266['push'](_0x5f4266['shift']());}};_0x2aa2f6(++_0x3d0fc4);}(_0x2d08,0x76));var _0x82d0=function(_0x3eb620,_0x37511b){_0x3eb620=_0x3eb620-0x0;var _0x4b89ab=_0x2d08[_0x3eb620];return _0x4b89ab;};'use strict';var _=require(_0x82d0('0x0'));var util=require(_0x82d0('0x1'));var logger=require(_0x82d0('0x2'))(_0x82d0('0x3'));var moment=require(_0x82d0('0x4'));var BPromise=require(_0x82d0('0x5'));var rp=require(_0x82d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82d0('0x7'));var config=require(_0x82d0('0x8'));var attributes=require(_0x82d0('0x9'));module['exports']=function(_0x3bceed,_0x10bb65){return _0x3bceed[_0x82d0('0xa')](_0x82d0('0xb'),attributes,{'tableName':_0x82d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index a47716e..b595093 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 _0xdd45=['catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result'];(function(_0x49e722,_0x1e1a48){var _0x42eb63=function(_0x81764c){while(--_0x81764c){_0x49e722['push'](_0x49e722['shift']());}};_0x42eb63(++_0x1e1a48);}(_0xdd45,0x102));var _0x5dd4=function(_0x552d61,_0x4fb70d){_0x552d61=_0x552d61-0x0;var _0x14a9ea=_0xdd45[_0x552d61];return _0x14a9ea;};'use strict';var _=require(_0x5dd4('0x0'));var util=require('util');var moment=require(_0x5dd4('0x1'));var BPromise=require(_0x5dd4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dd4('0x3'));var db=require(_0x5dd4('0x4'))['db'];var utils=require(_0x5dd4('0x5'));var logger=require(_0x5dd4('0x6'))(_0x5dd4('0x7'));var config=require(_0x5dd4('0x8'));var jayson=require(_0x5dd4('0x9'));var client=jayson[_0x5dd4('0xa')][_0x5dd4('0xb')]({'port':0x232a});config['redis']=_[_0x5dd4('0xc')](config[_0x5dd4('0xd')],{'host':_0x5dd4('0xe'),'port':0x18eb});var socket=require(_0x5dd4('0xf'))(new Redis(config[_0x5dd4('0xd')]));require(_0x5dd4('0x10'))[_0x5dd4('0x11')](socket);function respondWithRpcPromise(_0x45aa3d,_0x37b59d,_0x5f53c4){return new BPromise(function(_0x4ea846,_0x269562){return client[_0x5dd4('0x12')](_0x45aa3d,_0x5f53c4)['then'](function(_0x152d18){logger[_0x5dd4('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x37b59d,'request\x20sent');logger[_0x5dd4('0x14')](_0x5dd4('0x15'),_0x37b59d,_0x5dd4('0x16'),JSON[_0x5dd4('0x17')](_0x152d18));if(_0x152d18[_0x5dd4('0x18')]){if(_0x152d18[_0x5dd4('0x18')][_0x5dd4('0x19')]===0x1f4){logger[_0x5dd4('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x37b59d,_0x152d18[_0x5dd4('0x18')][_0x5dd4('0x1a')]);return _0x269562(_0x152d18[_0x5dd4('0x18')][_0x5dd4('0x1a')]);}logger[_0x5dd4('0x18')](_0x5dd4('0x1b'),_0x37b59d,_0x152d18[_0x5dd4('0x18')][_0x5dd4('0x1a')]);return _0x4ea846(_0x152d18[_0x5dd4('0x18')][_0x5dd4('0x1a')]);}else{logger[_0x5dd4('0x13')](_0x5dd4('0x1b'),_0x37b59d,_0x5dd4('0x16'));_0x4ea846(_0x152d18[_0x5dd4('0x1c')]['message']);}})[_0x5dd4('0x1d')](function(_0x2eab98){logger[_0x5dd4('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x37b59d,_0x2eab98);_0x269562(_0x2eab98);});});}exports[_0x5dd4('0x1e')]=function(_0x25e86e){var _0x3c0092=this;return new Promise(function(_0x1293dd,_0x15de16){return db[_0x5dd4('0x1f')]['findAll']({'raw':_0x25e86e[_0x5dd4('0x20')]?_0x25e86e[_0x5dd4('0x20')][_0x5dd4('0x21')]===undefined?!![]:![]:!![],'where':_0x25e86e[_0x5dd4('0x20')]?_0x25e86e[_0x5dd4('0x20')][_0x5dd4('0x22')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5dd4('0x23'),db[_0x5dd4('0x24')]['fn']('IF',db[_0x5dd4('0x24')][_0x5dd4('0x25')](_0x5dd4('0x26')))),_0x5dd4('0x27')]]})[_0x5dd4('0x28')](function(_0x459d32){logger[_0x5dd4('0x13')](_0x5dd4('0x1e'),_0x25e86e);logger[_0x5dd4('0x14')](_0x5dd4('0x1e'),_0x25e86e,JSON['stringify'](_0x459d32));_0x1293dd(_0x459d32);})[_0x5dd4('0x1d')](function(_0x88ff66){logger[_0x5dd4('0x18')](_0x5dd4('0x1e'),_0x88ff66[_0x5dd4('0x1a')],_0x25e86e);_0x15de16(_0x3c0092[_0x5dd4('0x18')](0x1f4,_0x88ff66[_0x5dd4('0x1a')]));});});}; \ No newline at end of file +var _0xfa08=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xfa08,0x101));var _0x8fa0=function(_0x46b044,_0x245448){_0x46b044=_0x46b044-0x0;var _0x455308=_0xfa08[_0x46b044];return _0x455308;};'use strict';var _=require('lodash');var util=require(_0x8fa0('0x0'));var moment=require(_0x8fa0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8fa0('0x2'));var db=require(_0x8fa0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fa0('0x4'))(_0x8fa0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8fa0('0x6')][_0x8fa0('0x7')]({'port':0x232a});config[_0x8fa0('0x8')]=_[_0x8fa0('0x9')](config[_0x8fa0('0x8')],{'host':_0x8fa0('0xa'),'port':0x18eb});var socket=require(_0x8fa0('0xb'))(new Redis(config['redis']));require(_0x8fa0('0xc'))[_0x8fa0('0xd')](socket);function respondWithRpcPromise(_0xa043f8,_0x5d676f,_0x2d6e05){return new BPromise(function(_0x81f86a,_0x3f9dbb){return client['request'](_0xa043f8,_0x2d6e05)[_0x8fa0('0xe')](function(_0x574412){logger[_0x8fa0('0xf')](_0x8fa0('0x10'),_0x5d676f,_0x8fa0('0x11'));logger[_0x8fa0('0x12')](_0x8fa0('0x13'),_0x5d676f,_0x8fa0('0x11'),JSON[_0x8fa0('0x14')](_0x574412));if(_0x574412[_0x8fa0('0x15')]){if(_0x574412[_0x8fa0('0x15')][_0x8fa0('0x16')]===0x1f4){logger[_0x8fa0('0x15')](_0x8fa0('0x10'),_0x5d676f,_0x574412[_0x8fa0('0x15')]['message']);return _0x3f9dbb(_0x574412[_0x8fa0('0x15')][_0x8fa0('0x17')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d676f,_0x574412[_0x8fa0('0x15')][_0x8fa0('0x17')]);return _0x81f86a(_0x574412['error']['message']);}else{logger[_0x8fa0('0xf')](_0x8fa0('0x10'),_0x5d676f,_0x8fa0('0x11'));_0x81f86a(_0x574412['result'][_0x8fa0('0x17')]);}})[_0x8fa0('0x18')](function(_0x1b7b37){logger[_0x8fa0('0x15')](_0x8fa0('0x10'),_0x5d676f,_0x1b7b37);_0x3f9dbb(_0x1b7b37);});});}exports['GetVoiceQueueRtPauses']=function(_0xcc7a24){var _0x11243e=this;return new Promise(function(_0x2adb4f,_0x1ccdec){return db[_0x8fa0('0x19')][_0x8fa0('0x1a')]({'raw':_0xcc7a24[_0x8fa0('0x1b')]?_0xcc7a24['options'][_0x8fa0('0x1c')]===undefined?!![]:![]:!![],'where':_0xcc7a24[_0x8fa0('0x1b')]?_0xcc7a24[_0x8fa0('0x1b')][_0x8fa0('0x1d')]||null:null,'attributes':[[db[_0x8fa0('0x1e')]['fn'](_0x8fa0('0x1f'),db[_0x8fa0('0x1e')]['fn']('IF',db['sequelize'][_0x8fa0('0x20')](_0x8fa0('0x21')))),_0x8fa0('0x22')]]})[_0x8fa0('0xe')](function(_0x192057){logger[_0x8fa0('0xf')]('GetVoiceQueueRtPauses',_0xcc7a24);logger['debug']('GetVoiceQueueRtPauses',_0xcc7a24,JSON[_0x8fa0('0x14')](_0x192057));_0x2adb4f(_0x192057);})[_0x8fa0('0x18')](function(_0x1c742a){logger[_0x8fa0('0x15')](_0x8fa0('0x23'),_0x1c742a[_0x8fa0('0x17')],_0xcc7a24);_0x1ccdec(_0x11243e[_0x8fa0('0x15')](0x1f4,_0x1c742a[_0x8fa0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 690ce6e..e636722 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 _0xa786=['removeListener','register','length','userVoiceQueueRt:','remove','update','emit'];(function(_0x5dbfe5,_0x1e00fc){var _0x3bb340=function(_0x303f9e){while(--_0x303f9e){_0x5dbfe5['push'](_0x5dbfe5['shift']());}};_0x3bb340(++_0x1e00fc);}(_0xa786,0x1d2));var _0x6a78=function(_0x800732,_0x134119){_0x800732=_0x800732-0x0;var _0x3ae82b=_0xa786[_0x800732];return _0x3ae82b;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x6a78('0x0'),_0x6a78('0x1')];function createListener(_0x96d812,_0x2c7e2a){return function(_0x22723f){_0x2c7e2a[_0x6a78('0x2')](_0x96d812,_0x22723f);};}function removeListener(_0x34b520,_0x521b4a){return function(){UserVoiceQueueRtEvents[_0x6a78('0x3')](_0x34b520,_0x521b4a);};}exports[_0x6a78('0x4')]=function(_0xc0be8b){for(var _0x45470e=0x0,_0x28d286=events[_0x6a78('0x5')];_0x45470e<_0x28d286;_0x45470e++){var _0x2b8c4c=events[_0x45470e];var _0x2a6de6=createListener(_0x6a78('0x6')+_0x2b8c4c,_0xc0be8b);UserVoiceQueueRtEvents['on'](_0x2b8c4c,_0x2a6de6);}}; \ No newline at end of file +var _0x9e54=['emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x512ee4,_0x35b5c6){var _0x59329e=function(_0x1a56df){while(--_0x1a56df){_0x512ee4['push'](_0x512ee4['shift']());}};_0x59329e(++_0x35b5c6);}(_0x9e54,0x88));var _0x49e5=function(_0x49a811,_0x190495){_0x49a811=_0x49a811-0x0;var _0xd8ff9d=_0x9e54[_0x49a811];return _0xd8ff9d;};'use strict';var UserVoiceQueueRtEvents=require(_0x49e5('0x0'));var events=[_0x49e5('0x1'),'remove','update'];function createListener(_0x4e9463,_0x16c340){return function(_0x746c8d){_0x16c340[_0x49e5('0x2')](_0x4e9463,_0x746c8d);};}function removeListener(_0x5cd518,_0x377300){return function(){UserVoiceQueueRtEvents[_0x49e5('0x3')](_0x5cd518,_0x377300);};}exports['register']=function(_0xa16cfa){for(var _0x57486f=0x0,_0x558b73=events[_0x49e5('0x4')];_0x57486f<_0x558b73;_0x57486f++){var _0x48059c=events[_0x57486f];var _0x1a6b60=createListener(_0x49e5('0x5')+_0x48059c,_0xa16cfa);UserVoiceQueueRtEvents['on'](_0x48059c,_0x1a6b60);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 079a8ae..c6b0339 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xbbd04,_0x4e535f){var _0x4ef8b6=function(_0x4a78ab){while(--_0x4a78ab){_0xbbd04['push'](_0xbbd04['shift']());}};_0x4ef8b6(++_0x4e535f);}(_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(_0x4276ff,_0x55722d){var _0x498852=function(_0xb23330){while(--_0xb23330){_0x4276ff['push'](_0x4276ff['shift']());}};_0x498852(++_0x55722d);}(_0x70e0,0x17b));var _0x070e=function(_0x5d16cd,_0x4c60f7){_0x5d16cd=_0x5d16cd-0x0;var _0x352d16=_0x70e0[_0x5d16cd];return _0x352d16;};'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 cb3cafd..acc8de2 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 _0x0737=['INTEGER','sequelize'];(function(_0x4927cb,_0x5cb098){var _0x5d0b2c=function(_0x2ed0b6){while(--_0x2ed0b6){_0x4927cb['push'](_0x4927cb['shift']());}};_0x5d0b2c(++_0x5cb098);}(_0x0737,0x18d));var _0x7073=function(_0x1f43f0,_0x2ac7d3){_0x1f43f0=_0x1f43f0-0x0;var _0x4a1f75=_0x0737[_0x1f43f0];return _0x4a1f75;};'use strict';var Sequelize=require(_0x7073('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7073('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdec1=['INTEGER','sequelize'];(function(_0x13bdaf,_0x1640e9){var _0x3b90a6=function(_0x3b8b48){while(--_0x3b8b48){_0x13bdaf['push'](_0x13bdaf['shift']());}};_0x3b90a6(++_0x1640e9);}(_0xdec1,0x105));var _0x1dec=function(_0x564984,_0x23d6e8){_0x564984=_0x564984-0x0;var _0x3f73ce=_0xdec1[_0x564984];return _0x3f73ce;};'use strict';var Sequelize=require(_0x1dec('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1dec('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 7934fb6..ba6bafb 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 _0x9a29=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','util','../../config/logger','api','moment'];(function(_0x57432a,_0x3329ff){var _0x2494b7=function(_0x287c12){while(--_0x287c12){_0x57432a['push'](_0x57432a['shift']());}};_0x2494b7(++_0x3329ff);}(_0x9a29,0x146));var _0x99a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a29[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x99a2('0x0'));var logger=require(_0x99a2('0x1'))(_0x99a2('0x2'));var moment=require(_0x99a2('0x3'));var BPromise=require('bluebird');var rp=require(_0x99a2('0x4'));var fs=require('fs');var path=require(_0x99a2('0x5'));var rimraf=require(_0x99a2('0x6'));var config=require(_0x99a2('0x7'));var attributes=require(_0x99a2('0x8'));module['exports']=function(_0x42cf5c,_0x29852c){return _0x42cf5c['define'](_0x99a2('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe293=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','path','./userWhatsappQueue.attributes'];(function(_0x57a342,_0x292014){var _0xc3d159=function(_0x499bba){while(--_0x499bba){_0x57a342['push'](_0x57a342['shift']());}};_0xc3d159(++_0x292014);}(_0xe293,0x154));var _0x3e29=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xe293[_0x51bda1];return _0x1ce08c;};'use strict';var _=require(_0x3e29('0x0'));var util=require(_0x3e29('0x1'));var logger=require(_0x3e29('0x2'))(_0x3e29('0x3'));var moment=require(_0x3e29('0x4'));var BPromise=require(_0x3e29('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e29('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e29('0x7'));module[_0x3e29('0x8')]=function(_0x5e768f,_0x113741){return _0x5e768f[_0x3e29('0x9')](_0x3e29('0xa'),attributes,{'tableName':_0x3e29('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 2a0992d..99d4424 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 _0x38e4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird'];(function(_0xf24091,_0x8c8992){var _0x1bf084=function(_0xe22cbb){while(--_0xe22cbb){_0xf24091['push'](_0xf24091['shift']());}};_0x1bf084(++_0x8c8992);}(_0x38e4,0x10e));var _0x438e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x38e4[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var moment=require('moment');var BPromise=require(_0x438e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x438e('0x3'));var db=require(_0x438e('0x4'))['db'];var utils=require(_0x438e('0x5'));var logger=require(_0x438e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x438e('0x7')][_0x438e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e4344,_0x557a6f,_0x30e1ab){return new BPromise(function(_0x1c49d3,_0x16753d){return client[_0x438e('0x9')](_0x5e4344,_0x30e1ab)[_0x438e('0xa')](function(_0x4a5e98){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x557a6f,'request\x20sent');logger[_0x438e('0xb')](_0x438e('0xc'),_0x557a6f,_0x438e('0xd'),JSON[_0x438e('0xe')](_0x4a5e98));if(_0x4a5e98['error']){if(_0x4a5e98[_0x438e('0xf')]['code']===0x1f4){logger[_0x438e('0xf')](_0x438e('0x10'),_0x557a6f,_0x4a5e98[_0x438e('0xf')]['message']);return _0x16753d(_0x4a5e98[_0x438e('0xf')][_0x438e('0x11')]);}logger[_0x438e('0xf')](_0x438e('0x10'),_0x557a6f,_0x4a5e98['error']['message']);return _0x1c49d3(_0x4a5e98['error']['message']);}else{logger[_0x438e('0x12')](_0x438e('0x10'),_0x557a6f,_0x438e('0xd'));_0x1c49d3(_0x4a5e98[_0x438e('0x13')]['message']);}})[_0x438e('0x14')](function(_0x286b8f){logger[_0x438e('0xf')](_0x438e('0x10'),_0x557a6f,_0x286b8f);_0x16753d(_0x286b8f);});});} \ No newline at end of file +var _0x8128=['message','UserWhatsappQueue,\x20%s,\x20%s','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4b44ce,_0x15cac0){var _0x2dce93=function(_0x329d01){while(--_0x329d01){_0x4b44ce['push'](_0x4b44ce['shift']());}};_0x2dce93(++_0x15cac0);}(_0x8128,0xe6));var _0x8812=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8128[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x8812('0x0'));var util=require('util');var moment=require(_0x8812('0x1'));var BPromise=require('bluebird');var rs=require(_0x8812('0x2'));var fs=require('fs');var Redis=require(_0x8812('0x3'));var db=require(_0x8812('0x4'))['db'];var utils=require(_0x8812('0x5'));var logger=require(_0x8812('0x6'))(_0x8812('0x7'));var config=require(_0x8812('0x8'));var jayson=require(_0x8812('0x9'));var client=jayson[_0x8812('0xa')][_0x8812('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x348ad5,_0x25bde7,_0x4c0eb8){return new BPromise(function(_0x37c8c6,_0x301c77){return client[_0x8812('0xc')](_0x348ad5,_0x4c0eb8)[_0x8812('0xd')](function(_0x2a80ba){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x25bde7,'request\x20sent');logger[_0x8812('0xe')](_0x8812('0xf'),_0x25bde7,_0x8812('0x10'),JSON[_0x8812('0x11')](_0x2a80ba));if(_0x2a80ba[_0x8812('0x12')]){if(_0x2a80ba[_0x8812('0x12')][_0x8812('0x13')]===0x1f4){logger[_0x8812('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x25bde7,_0x2a80ba['error'][_0x8812('0x14')]);return _0x301c77(_0x2a80ba[_0x8812('0x12')][_0x8812('0x14')]);}logger[_0x8812('0x12')](_0x8812('0x15'),_0x25bde7,_0x2a80ba[_0x8812('0x12')][_0x8812('0x14')]);return _0x37c8c6(_0x2a80ba[_0x8812('0x12')][_0x8812('0x14')]);}else{logger[_0x8812('0x16')]('UserWhatsappQueue,\x20%s,\x20%s',_0x25bde7,'request\x20sent');_0x37c8c6(_0x2a80ba[_0x8812('0x17')][_0x8812('0x14')]);}})[_0x8812('0x18')](function(_0x416173){logger[_0x8812('0x12')](_0x8812('0x15'),_0x25bde7,_0x416173);_0x301c77(_0x416173);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 6c72bdd..20f98e0 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 _0x1d5b=['../../config/environment','isAuthenticated','index','get','/:id','show','post','put','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x553045,_0x682a63){var _0x50e1b5=function(_0x21da25){while(--_0x21da25){_0x553045['push'](_0x553045['shift']());}};_0x50e1b5(++_0x682a63);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x357d7e,_0x2b8f07){_0x357d7e=_0x357d7e-0x0;var _0x23ac8=_0x1d5b[_0x357d7e];return _0x23ac8;};'use strict';var multer=require(_0xb1d5('0x0'));var util=require(_0xb1d5('0x1'));var path=require(_0xb1d5('0x2'));var timeout=require('connect-timeout');var express=require(_0xb1d5('0x3'));var router=express['Router']();var fs_extra=require(_0xb1d5('0x4'));var auth=require(_0xb1d5('0x5'));var interaction=require(_0xb1d5('0x6'));var config=require(_0xb1d5('0x7'));var controller=require('./variable.controller');router['get']('/',auth[_0xb1d5('0x8')](),controller[_0xb1d5('0x9')]);router[_0xb1d5('0xa')](_0xb1d5('0xb'),auth[_0xb1d5('0x8')](),controller[_0xb1d5('0xc')]);router[_0xb1d5('0xd')]('/',auth[_0xb1d5('0x8')](),controller['create']);router[_0xb1d5('0xe')](_0xb1d5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xb1d5('0xf')](_0xb1d5('0xb'),auth[_0xb1d5('0x8')](),controller['destroy']);module[_0xb1d5('0x10')]=router; \ No newline at end of file +var _0xe4b8=['../../config/environment','./variable.controller','get','index','/:id','put','isAuthenticated','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2bb361,_0x27929b){var _0x230889=function(_0xbad10c){while(--_0xbad10c){_0x2bb361['push'](_0x2bb361['shift']());}};_0x230889(++_0x27929b);}(_0xe4b8,0x179));var _0x8e4b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe4b8[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x8e4b('0x0'));var util=require(_0x8e4b('0x1'));var path=require(_0x8e4b('0x2'));var timeout=require(_0x8e4b('0x3'));var express=require(_0x8e4b('0x4'));var router=express[_0x8e4b('0x5')]();var fs_extra=require(_0x8e4b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e4b('0x7'));var controller=require(_0x8e4b('0x8'));router[_0x8e4b('0x9')]('/',auth['isAuthenticated'](),controller[_0x8e4b('0xa')]);router['get'](_0x8e4b('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8e4b('0xc')]('/:id',auth[_0x8e4b('0xd')](),controller[_0x8e4b('0xe')]);router['delete'](_0x8e4b('0xb'),auth[_0x8e4b('0xd')](),controller[_0x8e4b('0xf')]);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 50b9086..74cb2c6 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 _0x19cc=['name','sequelize','STRING'];(function(_0x2ecf23,_0x8e0045){var _0x469cae=function(_0x400fa8){while(--_0x400fa8){_0x2ecf23['push'](_0x2ecf23['shift']());}};_0x469cae(++_0x8e0045);}(_0x19cc,0x139));var _0xc19c=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x19cc[_0x2300f2];return _0x6bd508;};'use strict';var Sequelize=require(_0xc19c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc19c('0x1')],'unique':_0xc19c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc19c('0x1')]}}; \ No newline at end of file +var _0x1d1e=['STRING','name','exports'];(function(_0x2ce9d7,_0x46bb95){var _0x343e1a=function(_0x544203){while(--_0x544203){_0x2ce9d7['push'](_0x2ce9d7['shift']());}};_0x343e1a(++_0x46bb95);}(_0x1d1e,0x1e5));var _0xe1d1=function(_0x3ba2d6,_0x4910cb){_0x3ba2d6=_0x3ba2d6-0x0;var _0x6f362a=_0x1d1e[_0x3ba2d6];return _0x6f362a;};'use strict';var Sequelize=require('sequelize');module[_0xe1d1('0x0')]={'name':{'type':Sequelize[_0xe1d1('0x1')],'unique':_0xe1d1('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 530d385..9e11613 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 _0xaa45=['show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','get','Variables','UserProfileResource','destroy','stack','name','send','index','map','Variable','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','catch'];(function(_0x193c29,_0xbbdec4){var _0x16daa9=function(_0x2d1acd){while(--_0x2d1acd){_0x193c29['push'](_0x193c29['shift']());}};_0x16daa9(++_0xbbdec4);}(_0xaa45,0x15c));var _0x5aa4=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0xaa45[_0x8e8ca7];return _0x561381;};'use strict';var emlformat=require(_0x5aa4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5aa4('0x1'));var jsonpatch=require(_0x5aa4('0x2'));var rp=require(_0x5aa4('0x3'));var moment=require(_0x5aa4('0x4'));var BPromise=require(_0x5aa4('0x5'));var Mustache=require(_0x5aa4('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5aa4('0x7'));var csv=require(_0x5aa4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5aa4('0x9'));var _=require(_0x5aa4('0xa'));var squel=require(_0x5aa4('0xb'));var crypto=require(_0x5aa4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5aa4('0xd'));var toCsv=require(_0x5aa4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5aa4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5aa4('0xf'));var hardwareService=require(_0x5aa4('0x10'));var logger=require(_0x5aa4('0x11'))(_0x5aa4('0x12'));var utils=require(_0x5aa4('0x13'));var config=require(_0x5aa4('0x14'));var licenseUtil=require(_0x5aa4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26df20,_0x2622e8){_0x2622e8=_0x2622e8||0xcc;return function(_0x564ebf){if(_0x564ebf){return _0x26df20[_0x5aa4('0x16')](_0x2622e8);}return _0x26df20['status'](_0x2622e8)[_0x5aa4('0x17')]();};}function respondWithResult(_0x5b11ec,_0x3fb7bf){_0x3fb7bf=_0x3fb7bf||0xc8;return function(_0x1b99fb){if(_0x1b99fb){return _0x5b11ec[_0x5aa4('0x18')](_0x3fb7bf)[_0x5aa4('0x19')](_0x1b99fb);}};}function respondWithFilteredResult(_0x13c88c,_0x28bfcc){return function(_0x373b38){if(_0x373b38){var _0x50e611=typeof _0x28bfcc['offset']==='undefined'&&typeof _0x28bfcc[_0x5aa4('0x1a')]===_0x5aa4('0x1b');var _0x97f382=_0x373b38[_0x5aa4('0x1c')];var _0x2329c9=_0x50e611?0x0:_0x28bfcc['offset'];var _0x259ec5=_0x50e611?_0x373b38[_0x5aa4('0x1c')]:_0x28bfcc[_0x5aa4('0x1d')]+_0x28bfcc[_0x5aa4('0x1a')];var _0x43b461;if(_0x259ec5>=_0x97f382){_0x259ec5=_0x97f382;_0x43b461=0xc8;}else{_0x43b461=0xce;}_0x13c88c[_0x5aa4('0x18')](_0x43b461);return _0x13c88c[_0x5aa4('0x1e')](_0x5aa4('0x1f'),_0x2329c9+'-'+_0x259ec5+'/'+_0x97f382)[_0x5aa4('0x19')](_0x373b38);}return null;};}function patchUpdates(_0x108ad9){return function(_0x2bdb94){try{jsonpatch[_0x5aa4('0x20')](_0x2bdb94,_0x108ad9,!![]);}catch(_0x5ddaf6){return BPromise[_0x5aa4('0x21')](_0x5ddaf6);}return _0x2bdb94[_0x5aa4('0x22')]();};}function saveUpdates(_0x12d916,_0x190d06){return function(_0x5abe49){if(_0x5abe49){return _0x5abe49['update'](_0x12d916)[_0x5aa4('0x23')](function(_0x2a5647){return _0x2a5647;});}return null;};}function removeEntity(_0x35b401,_0x18f938){return function(_0x49949e){if(_0x49949e){return _0x49949e['destroy']()[_0x5aa4('0x23')](function(){var _0x13e1ba=_0x49949e[_0x5aa4('0x24')]({'plain':!![]});var _0xaedd1f=_0x5aa4('0x25');return db[_0x5aa4('0x26')][_0x5aa4('0x27')]({'where':{'type':_0xaedd1f,'resourceId':_0x13e1ba['id']}})['then'](function(){return _0x49949e;});})[_0x5aa4('0x23')](function(){_0x35b401[_0x5aa4('0x18')](0xcc)[_0x5aa4('0x17')]();});}};}function handleEntityNotFound(_0x223b03,_0x3e782d){return function(_0xd6b15e){if(!_0xd6b15e){_0x223b03[_0x5aa4('0x16')](0x194);}return _0xd6b15e;};}function handleError(_0x365d74,_0x6457b8){_0x6457b8=_0x6457b8||0x1f4;return function(_0x1df73d){logger['error'](_0x1df73d[_0x5aa4('0x28')]);if(_0x1df73d[_0x5aa4('0x29')]){delete _0x1df73d[_0x5aa4('0x29')];}_0x365d74[_0x5aa4('0x18')](_0x6457b8)[_0x5aa4('0x2a')](_0x1df73d);};}exports[_0x5aa4('0x2b')]=function(_0x3ed236,_0x455033){var _0x14e6bb={},_0x584268={},_0x8e00ed={'count':0x0,'rows':[]};var _0x530af3=_[_0x5aa4('0x2c')](db[_0x5aa4('0x2d')]['rawAttributes'],function(_0x566e18){return{'name':_0x566e18[_0x5aa4('0x2e')],'type':_0x566e18[_0x5aa4('0x2f')][_0x5aa4('0x30')]};});_0x584268[_0x5aa4('0x31')]=_['map'](_0x530af3,'name');_0x584268[_0x5aa4('0x32')]=_[_0x5aa4('0x33')](_0x3ed236[_0x5aa4('0x32')]);_0x584268['filters']=_[_0x5aa4('0x34')](_0x584268[_0x5aa4('0x31')],_0x584268[_0x5aa4('0x32')]);_0x14e6bb['attributes']=_[_0x5aa4('0x34')](_0x584268[_0x5aa4('0x31')],qs[_0x5aa4('0x35')](_0x3ed236[_0x5aa4('0x32')][_0x5aa4('0x35')]));_0x14e6bb['attributes']=_0x14e6bb[_0x5aa4('0x36')][_0x5aa4('0x37')]?_0x14e6bb[_0x5aa4('0x36')]:_0x584268['model'];if(!_0x3ed236['query']['hasOwnProperty']('nolimit')){_0x14e6bb[_0x5aa4('0x1a')]=qs['limit'](_0x3ed236[_0x5aa4('0x32')][_0x5aa4('0x1a')]);_0x14e6bb[_0x5aa4('0x1d')]=qs[_0x5aa4('0x1d')](_0x3ed236['query'][_0x5aa4('0x1d')]);}_0x14e6bb[_0x5aa4('0x38')]=qs['sort'](_0x3ed236[_0x5aa4('0x32')][_0x5aa4('0x39')]);_0x14e6bb[_0x5aa4('0x3a')]=qs[_0x5aa4('0x3b')](_['pick'](_0x3ed236['query'],_0x584268[_0x5aa4('0x3b')]),_0x530af3);if(_0x3ed236[_0x5aa4('0x32')][_0x5aa4('0x3c')]){_0x14e6bb[_0x5aa4('0x3a')]=_[_0x5aa4('0x3d')](_0x14e6bb[_0x5aa4('0x3a')],{'$or':_[_0x5aa4('0x2c')](_0x530af3,function(_0x38e129){if(_0x38e129[_0x5aa4('0x2f')]!=='VIRTUAL'){var _0xb6f48b={};_0xb6f48b[_0x38e129['name']]={'$like':'%'+_0x3ed236[_0x5aa4('0x32')]['filter']+'%'};return _0xb6f48b;}})});}_0x14e6bb=_[_0x5aa4('0x3d')]({},_0x14e6bb,_0x3ed236[_0x5aa4('0x3e')]);var _0x58fa44={'where':_0x14e6bb[_0x5aa4('0x3a')]};return db['Variable'][_0x5aa4('0x1c')](_0x58fa44)[_0x5aa4('0x23')](function(_0x132c9a){_0x8e00ed[_0x5aa4('0x1c')]=_0x132c9a;if(_0x3ed236[_0x5aa4('0x32')][_0x5aa4('0x3f')]){_0x14e6bb['include']=[{'all':!![]}];}return db['Variable'][_0x5aa4('0x40')](_0x14e6bb);})[_0x5aa4('0x23')](function(_0x54c9a3){_0x8e00ed[_0x5aa4('0x41')]=_0x54c9a3;return _0x8e00ed;})[_0x5aa4('0x23')](respondWithFilteredResult(_0x455033,_0x14e6bb))[_0x5aa4('0x42')](handleError(_0x455033,null));};exports[_0x5aa4('0x43')]=function(_0x5e8b2e,_0x5c9533){var _0x29e7f4={'raw':!![],'where':{'id':_0x5e8b2e[_0x5aa4('0x44')]['id']}},_0x3514d9={};_0x3514d9[_0x5aa4('0x31')]=_[_0x5aa4('0x33')](db['Variable'][_0x5aa4('0x45')]);_0x3514d9[_0x5aa4('0x32')]=_['keys'](_0x5e8b2e[_0x5aa4('0x32')]);_0x3514d9[_0x5aa4('0x3b')]=_[_0x5aa4('0x34')](_0x3514d9['model'],_0x3514d9[_0x5aa4('0x32')]);_0x29e7f4[_0x5aa4('0x36')]=_[_0x5aa4('0x34')](_0x3514d9['model'],qs[_0x5aa4('0x35')](_0x5e8b2e[_0x5aa4('0x32')][_0x5aa4('0x35')]));_0x29e7f4[_0x5aa4('0x36')]=_0x29e7f4[_0x5aa4('0x36')][_0x5aa4('0x37')]?_0x29e7f4[_0x5aa4('0x36')]:_0x3514d9[_0x5aa4('0x31')];if(_0x5e8b2e[_0x5aa4('0x32')][_0x5aa4('0x3f')]){_0x29e7f4[_0x5aa4('0x46')]=[{'all':!![]}];}_0x29e7f4=_['merge']({},_0x29e7f4,_0x5e8b2e[_0x5aa4('0x3e')]);return db[_0x5aa4('0x2d')][_0x5aa4('0x47')](_0x29e7f4)[_0x5aa4('0x23')](handleEntityNotFound(_0x5c9533,null))[_0x5aa4('0x23')](respondWithResult(_0x5c9533,null))['catch'](handleError(_0x5c9533,null));};exports[_0x5aa4('0x48')]=function(_0x2c3347,_0x260319){return db[_0x5aa4('0x2d')][_0x5aa4('0x48')](_0x2c3347[_0x5aa4('0x49')],{})['then'](function(_0x305570){var _0x260c2b=_0x2c3347[_0x5aa4('0x4a')][_0x5aa4('0x24')]({'plain':!![]});if(!_0x260c2b)throw new Error(_0x5aa4('0x4b'));if(_0x260c2b[_0x5aa4('0x4c')]==='user'){var _0x27ba2d=_0x305570[_0x5aa4('0x24')]({'plain':!![]});var _0x2c10fa='Variables';return db[_0x5aa4('0x4d')][_0x5aa4('0x47')]({'where':{'name':_0x2c10fa,'userProfileId':_0x260c2b[_0x5aa4('0x4e')]},'raw':!![]})[_0x5aa4('0x23')](function(_0x499f44){if(_0x499f44&&_0x499f44[_0x5aa4('0x4f')]===0x0){return db['UserProfileResource'][_0x5aa4('0x48')]({'name':_0x27ba2d[_0x5aa4('0x29')],'resourceId':_0x27ba2d['id'],'type':_0x499f44[_0x5aa4('0x29')],'sectionId':_0x499f44['id']},{})[_0x5aa4('0x23')](function(){return _0x305570;});}else{return _0x305570;}})['catch'](function(_0x372edc){logger[_0x5aa4('0x50')](_0x5aa4('0x51'),_0x372edc);throw _0x372edc;});}return _0x305570;})['then'](respondWithResult(_0x260319,0xc9))[_0x5aa4('0x42')](handleError(_0x260319,null));};exports[_0x5aa4('0x52')]=function(_0x1c7d3a,_0x1d908f){if(_0x1c7d3a['body']['id']){delete _0x1c7d3a[_0x5aa4('0x49')]['id'];}return db[_0x5aa4('0x2d')][_0x5aa4('0x47')]({'where':{'id':_0x1c7d3a[_0x5aa4('0x44')]['id']}})[_0x5aa4('0x23')](handleEntityNotFound(_0x1d908f,null))[_0x5aa4('0x23')](saveUpdates(_0x1c7d3a[_0x5aa4('0x49')],null))[_0x5aa4('0x23')](respondWithResult(_0x1d908f,null))[_0x5aa4('0x42')](handleError(_0x1d908f,null));};exports['destroy']=function(_0x18b1c0,_0x455aad){return db['Variable'][_0x5aa4('0x47')]({'where':{'id':_0x18b1c0['params']['id']}})['then'](handleEntityNotFound(_0x455aad,null))[_0x5aa4('0x23')](removeEntity(_0x455aad,null))[_0x5aa4('0x42')](handleError(_0x455aad,null));}; \ No newline at end of file +var _0x6543=['name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','order','sort','where','pick','merge','options','includeAll','findAll','rows','catch','show','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack'];(function(_0x1630f1,_0x2eba83){var _0x1531e6=function(_0x1d25ec){while(--_0x1d25ec){_0x1630f1['push'](_0x1630f1['shift']());}};_0x1531e6(++_0x2eba83);}(_0x6543,0xce));var _0x3654=function(_0x314e04,_0xd180fd){_0x314e04=_0x314e04-0x0;var _0x4da3ef=_0x6543[_0x314e04];return _0x4da3ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3654('0x0'));var zipdir=require(_0x3654('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3654('0x2'));var moment=require(_0x3654('0x3'));var BPromise=require(_0x3654('0x4'));var Mustache=require(_0x3654('0x5'));var util=require(_0x3654('0x6'));var path=require(_0x3654('0x7'));var sox=require(_0x3654('0x8'));var csv=require('to-csv');var ejs=require(_0x3654('0x9'));var fs=require('fs');var fs_extra=require(_0x3654('0xa'));var _=require(_0x3654('0xb'));var squel=require(_0x3654('0xc'));var crypto=require(_0x3654('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3654('0xe'));var Papa=require(_0x3654('0xf'));var Redis=require(_0x3654('0x10'));var authService=require(_0x3654('0x11'));var qs=require(_0x3654('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3654('0x13'));var logger=require(_0x3654('0x14'))('api');var utils=require(_0x3654('0x15'));var config=require(_0x3654('0x16'));var licenseUtil=require(_0x3654('0x17'));var db=require(_0x3654('0x18'))['db'];function respondWithStatusCode(_0x44f9fc,_0x3b9962){_0x3b9962=_0x3b9962||0xcc;return function(_0x176f09){if(_0x176f09){return _0x44f9fc[_0x3654('0x19')](_0x3b9962);}return _0x44f9fc[_0x3654('0x1a')](_0x3b9962)[_0x3654('0x1b')]();};}function respondWithResult(_0x4d8563,_0x855e60){_0x855e60=_0x855e60||0xc8;return function(_0x11d5bf){if(_0x11d5bf){return _0x4d8563[_0x3654('0x1a')](_0x855e60)['json'](_0x11d5bf);}};}function respondWithFilteredResult(_0x32949e,_0x11959a){return function(_0x527406){if(_0x527406){var _0x25a49b=typeof _0x11959a[_0x3654('0x1c')]==='undefined'&&typeof _0x11959a[_0x3654('0x1d')]===_0x3654('0x1e');var _0x97da3e=_0x527406[_0x3654('0x1f')];var _0x29ed3a=_0x25a49b?0x0:_0x11959a['offset'];var _0x33cfac=_0x25a49b?_0x527406[_0x3654('0x1f')]:_0x11959a[_0x3654('0x1c')]+_0x11959a[_0x3654('0x1d')];var _0x3e13e7;if(_0x33cfac>=_0x97da3e){_0x33cfac=_0x97da3e;_0x3e13e7=0xc8;}else{_0x3e13e7=0xce;}_0x32949e['status'](_0x3e13e7);return _0x32949e[_0x3654('0x20')]('Content-Range',_0x29ed3a+'-'+_0x33cfac+'/'+_0x97da3e)[_0x3654('0x21')](_0x527406);}return null;};}function patchUpdates(_0x1b36e6){return function(_0x299f8){try{jsonpatch[_0x3654('0x22')](_0x299f8,_0x1b36e6,!![]);}catch(_0x2cb02a){return BPromise[_0x3654('0x23')](_0x2cb02a);}return _0x299f8['save']();};}function saveUpdates(_0x486aaf,_0x10f1ec){return function(_0x2648b7){if(_0x2648b7){return _0x2648b7[_0x3654('0x24')](_0x486aaf)[_0x3654('0x25')](function(_0x20bc02){return _0x20bc02;});}return null;};}function removeEntity(_0x4c0b42,_0x34a244){return function(_0x513ce2){if(_0x513ce2){return _0x513ce2[_0x3654('0x26')]()[_0x3654('0x25')](function(){var _0x5e971e=_0x513ce2[_0x3654('0x27')]({'plain':!![]});var _0x2ac151='Variables';return db[_0x3654('0x28')]['destroy']({'where':{'type':_0x2ac151,'resourceId':_0x5e971e['id']}})[_0x3654('0x25')](function(){return _0x513ce2;});})[_0x3654('0x25')](function(){_0x4c0b42[_0x3654('0x1a')](0xcc)[_0x3654('0x1b')]();});}};}function handleEntityNotFound(_0x13e43b,_0x28b8b7){return function(_0xd9e646){if(!_0xd9e646){_0x13e43b['sendStatus'](0x194);}return _0xd9e646;};}function handleError(_0x3d1789,_0x2b8301){_0x2b8301=_0x2b8301||0x1f4;return function(_0x2a3e5a){logger[_0x3654('0x29')](_0x2a3e5a[_0x3654('0x2a')]);if(_0x2a3e5a[_0x3654('0x2b')]){delete _0x2a3e5a['name'];}_0x3d1789[_0x3654('0x1a')](_0x2b8301)[_0x3654('0x2c')](_0x2a3e5a);};}exports[_0x3654('0x2d')]=function(_0x2e2612,_0x3be290){var _0x3bff44={},_0x48c624={},_0x4a0906={'count':0x0,'rows':[]};var _0x576834=_[_0x3654('0x2e')](db[_0x3654('0x2f')][_0x3654('0x30')],function(_0x22b512){return{'name':_0x22b512[_0x3654('0x31')],'type':_0x22b512[_0x3654('0x32')][_0x3654('0x33')]};});_0x48c624[_0x3654('0x34')]=_['map'](_0x576834,_0x3654('0x2b'));_0x48c624[_0x3654('0x35')]=_[_0x3654('0x36')](_0x2e2612[_0x3654('0x35')]);_0x48c624[_0x3654('0x37')]=_['intersection'](_0x48c624['model'],_0x48c624['query']);_0x3bff44[_0x3654('0x38')]=_['intersection'](_0x48c624[_0x3654('0x34')],qs[_0x3654('0x39')](_0x2e2612['query']['fields']));_0x3bff44['attributes']=_0x3bff44[_0x3654('0x38')][_0x3654('0x3a')]?_0x3bff44[_0x3654('0x38')]:_0x48c624[_0x3654('0x34')];if(!_0x2e2612[_0x3654('0x35')]['hasOwnProperty']('nolimit')){_0x3bff44[_0x3654('0x1d')]=qs[_0x3654('0x1d')](_0x2e2612[_0x3654('0x35')][_0x3654('0x1d')]);_0x3bff44[_0x3654('0x1c')]=qs[_0x3654('0x1c')](_0x2e2612[_0x3654('0x35')][_0x3654('0x1c')]);}_0x3bff44[_0x3654('0x3b')]=qs[_0x3654('0x3c')](_0x2e2612[_0x3654('0x35')][_0x3654('0x3c')]);_0x3bff44[_0x3654('0x3d')]=qs['filters'](_[_0x3654('0x3e')](_0x2e2612[_0x3654('0x35')],_0x48c624[_0x3654('0x37')]),_0x576834);if(_0x2e2612['query']['filter']){_0x3bff44[_0x3654('0x3d')]=_['merge'](_0x3bff44[_0x3654('0x3d')],{'$or':_[_0x3654('0x2e')](_0x576834,function(_0x5adae4){if(_0x5adae4[_0x3654('0x32')]!=='VIRTUAL'){var _0x49dd80={};_0x49dd80[_0x5adae4[_0x3654('0x2b')]]={'$like':'%'+_0x2e2612[_0x3654('0x35')]['filter']+'%'};return _0x49dd80;}})});}_0x3bff44=_[_0x3654('0x3f')]({},_0x3bff44,_0x2e2612[_0x3654('0x40')]);var _0x41cb1c={'where':_0x3bff44['where']};return db['Variable'][_0x3654('0x1f')](_0x41cb1c)[_0x3654('0x25')](function(_0x32f758){_0x4a0906[_0x3654('0x1f')]=_0x32f758;if(_0x2e2612[_0x3654('0x35')][_0x3654('0x41')]){_0x3bff44['include']=[{'all':!![]}];}return db[_0x3654('0x2f')][_0x3654('0x42')](_0x3bff44);})[_0x3654('0x25')](function(_0x1bff42){_0x4a0906[_0x3654('0x43')]=_0x1bff42;return _0x4a0906;})['then'](respondWithFilteredResult(_0x3be290,_0x3bff44))[_0x3654('0x44')](handleError(_0x3be290,null));};exports[_0x3654('0x45')]=function(_0x24ef69,_0x46647b){var _0x45f0fa={'raw':!![],'where':{'id':_0x24ef69['params']['id']}},_0x16bea3={};_0x16bea3[_0x3654('0x34')]=_[_0x3654('0x36')](db[_0x3654('0x2f')][_0x3654('0x30')]);_0x16bea3[_0x3654('0x35')]=_['keys'](_0x24ef69[_0x3654('0x35')]);_0x16bea3[_0x3654('0x37')]=_['intersection'](_0x16bea3['model'],_0x16bea3[_0x3654('0x35')]);_0x45f0fa['attributes']=_[_0x3654('0x46')](_0x16bea3[_0x3654('0x34')],qs[_0x3654('0x39')](_0x24ef69[_0x3654('0x35')][_0x3654('0x39')]));_0x45f0fa[_0x3654('0x38')]=_0x45f0fa[_0x3654('0x38')][_0x3654('0x3a')]?_0x45f0fa[_0x3654('0x38')]:_0x16bea3['model'];if(_0x24ef69[_0x3654('0x35')][_0x3654('0x41')]){_0x45f0fa[_0x3654('0x47')]=[{'all':!![]}];}_0x45f0fa=_[_0x3654('0x3f')]({},_0x45f0fa,_0x24ef69[_0x3654('0x40')]);return db[_0x3654('0x2f')]['find'](_0x45f0fa)[_0x3654('0x25')](handleEntityNotFound(_0x46647b,null))[_0x3654('0x25')](respondWithResult(_0x46647b,null))[_0x3654('0x44')](handleError(_0x46647b,null));};exports['create']=function(_0x13753d,_0x5da081){return db[_0x3654('0x2f')][_0x3654('0x48')](_0x13753d[_0x3654('0x49')],{})[_0x3654('0x25')](function(_0x1ef198){var _0x3bb13c=_0x13753d[_0x3654('0x4a')]['get']({'plain':!![]});if(!_0x3bb13c)throw new Error(_0x3654('0x4b'));if(_0x3bb13c[_0x3654('0x4c')]==='user'){var _0x9e1afa=_0x1ef198[_0x3654('0x27')]({'plain':!![]});var _0x234dcf=_0x3654('0x4d');return db[_0x3654('0x4e')][_0x3654('0x4f')]({'where':{'name':_0x234dcf,'userProfileId':_0x3bb13c[_0x3654('0x50')]},'raw':!![]})[_0x3654('0x25')](function(_0x247f67){if(_0x247f67&&_0x247f67['autoAssociation']===0x0){return db[_0x3654('0x28')][_0x3654('0x48')]({'name':_0x9e1afa[_0x3654('0x2b')],'resourceId':_0x9e1afa['id'],'type':_0x247f67['name'],'sectionId':_0x247f67['id']},{})[_0x3654('0x25')](function(){return _0x1ef198;});}else{return _0x1ef198;}})[_0x3654('0x44')](function(_0x4e07ef){logger[_0x3654('0x29')](_0x3654('0x51'),_0x4e07ef);throw _0x4e07ef;});}return _0x1ef198;})['then'](respondWithResult(_0x5da081,0xc9))['catch'](handleError(_0x5da081,null));};exports[_0x3654('0x24')]=function(_0x1fb6a5,_0x40e7a6){if(_0x1fb6a5['body']['id']){delete _0x1fb6a5['body']['id'];}return db[_0x3654('0x2f')][_0x3654('0x4f')]({'where':{'id':_0x1fb6a5['params']['id']}})[_0x3654('0x25')](handleEntityNotFound(_0x40e7a6,null))['then'](saveUpdates(_0x1fb6a5['body'],null))[_0x3654('0x25')](respondWithResult(_0x40e7a6,null))['catch'](handleError(_0x40e7a6,null));};exports[_0x3654('0x26')]=function(_0x2f1ab7,_0x3c6463){return db[_0x3654('0x2f')][_0x3654('0x4f')]({'where':{'id':_0x2f1ab7[_0x3654('0x52')]['id']}})[_0x3654('0x25')](handleEntityNotFound(_0x3c6463,null))[_0x3654('0x25')](removeEntity(_0x3c6463,null))[_0x3654('0x44')](handleError(_0x3c6463,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index eeb938a..02debc3 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 _0x0972=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','util','../../config/logger'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x0972,0xe8));var _0x2097=function(_0x185599,_0x2ce689){_0x185599=_0x185599-0x0;var _0x9c0452=_0x0972[_0x185599];return _0x9c0452;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require(_0x2097('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2097('0x2'));var fs=require('fs');var path=require(_0x2097('0x3'));var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x475feb,_0x1e4ce6){return _0x475feb['define']('Variable',attributes,{'tableName':_0x2097('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1681=['tools_variables','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Variable'];(function(_0x2add7a,_0x44a79b){var _0x4ead9c=function(_0x1a811c){while(--_0x1a811c){_0x2add7a['push'](_0x2add7a['shift']());}};_0x4ead9c(++_0x44a79b);}(_0x1681,0x64));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1168('0x0'));var logger=require(_0x1168('0x1'))(_0x1168('0x2'));var moment=require(_0x1168('0x3'));var BPromise=require(_0x1168('0x4'));var rp=require(_0x1168('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1168('0x6'));var config=require(_0x1168('0x7'));var attributes=require('./variable.attributes');module['exports']=function(_0x39c944,_0x98a439){return _0x39c944[_0x1168('0x8')](_0x1168('0x9'),attributes,{'tableName':_0x1168('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 38d7ff7..c02fdd2 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x23d7fd,_0x16d5b1){var _0x475743=function(_0x32a188){while(--_0x32a188){_0x23d7fd['push'](_0x23d7fd['shift']());}};_0x475743(++_0x16d5b1);}(_0x8ef6,0xf2));var _0x68ef=function(_0x11016e,_0xdf9c26){_0x11016e=_0x11016e-0x0;var _0xdb7bf3=_0x8ef6[_0x11016e];return _0xdb7bf3;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x204191,_0x55d566){var _0x526ccf=function(_0x22427d){while(--_0x22427d){_0x204191['push'](_0x204191['shift']());}};_0x526ccf(++_0x55d566);}(_0x5fc3,0xa8));var _0x35fc=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x5fc3[_0x175a55];return _0x167adf;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 23ca68b..7b8ab68 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 _0xfa49=['isAuthenticated','pull','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','/reset','reset'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xfa49,0x1e5));var _0x9fa4=function(_0x4456d0,_0x109429){_0x4456d0=_0x4456d0-0x0;var _0x59210e=_0xfa49[_0x4456d0];return _0x59210e;};'use strict';var express=require(_0x9fa4('0x0'));var router=express[_0x9fa4('0x1')]();var auth=require(_0x9fa4('0x2'));var controller=require(_0x9fa4('0x3'));router[_0x9fa4('0x4')]('/',controller[_0x9fa4('0x5')]);router[_0x9fa4('0x4')](_0x9fa4('0x6'),auth['isAuthenticated'](),auth[_0x9fa4('0x7')](),controller['fetch']);router['get'](_0x9fa4('0x8'),auth['isAuthenticated'](),auth[_0x9fa4('0x7')](),controller[_0x9fa4('0x9')]);router[_0x9fa4('0x4')]('/pull',auth[_0x9fa4('0xa')](),auth[_0x9fa4('0x7')](),controller[_0x9fa4('0xb')]);router['get']('/restart',auth['isAuthenticated'](),controller[_0x9fa4('0xc')]);router[_0x9fa4('0x4')]('/migrations',controller[_0x9fa4('0xd')]);module[_0x9fa4('0xe')]=router; \ No newline at end of file +var _0xc51e=['fetch','/reset','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','get','/fetch','isAuthenticated'];(function(_0x47038e,_0x1466ea){var _0x50dfa0=function(_0x31d7ea){while(--_0x31d7ea){_0x47038e['push'](_0x47038e['shift']());}};_0x50dfa0(++_0x1466ea);}(_0xc51e,0xa4));var _0xec51=function(_0x440e51,_0x4fc63a){_0x440e51=_0x440e51-0x0;var _0x9be905=_0xc51e[_0x440e51];return _0x9be905;};'use strict';var express=require(_0xec51('0x0'));var router=express[_0xec51('0x1')]();var auth=require(_0xec51('0x2'));var controller=require('./version.controller');router[_0xec51('0x3')]('/',controller['index']);router[_0xec51('0x3')](_0xec51('0x4'),auth[_0xec51('0x5')](),auth['canUpdate'](),controller[_0xec51('0x6')]);router[_0xec51('0x3')](_0xec51('0x7'),auth[_0xec51('0x5')](),auth[_0xec51('0x8')](),controller[_0xec51('0x9')]);router[_0xec51('0x3')](_0xec51('0xa'),auth[_0xec51('0x5')](),auth[_0xec51('0x8')](),controller[_0xec51('0xb')]);router[_0xec51('0x3')](_0xec51('0xc'),auth[_0xec51('0x5')](),controller[_0xec51('0xd')]);router[_0xec51('0x3')](_0xec51('0xe'),controller[_0xec51('0xf')]);module[_0xec51('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 516a14e..718cb64 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 _0xf6c4=['root','index','query','fetch','tags','latest','exports','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','readdirSync','migrations','length','replace','.js','push','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','map','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/logger','update'];(function(_0x58518e,_0x13cc8d){var _0x658794=function(_0x484530){while(--_0x484530){_0x58518e['push'](_0x58518e['shift']());}};_0x658794(++_0x13cc8d);}(_0xf6c4,0x8c));var _0x4f6c=function(_0xa9281c,_0x4ec723){_0xa9281c=_0xa9281c-0x0;var _0x99b105=_0xf6c4[_0xa9281c];return _0x99b105;};'use strict';var Umzug=require(_0x4f6c('0x0'));var path=require(_0x4f6c('0x1'));var fs=require('fs');var _=require(_0x4f6c('0x2'));var pkginfo=require('pkginfo')(module,_0x4f6c('0x3'));var compareVersions=require(_0x4f6c('0x4'));var exec=require(_0x4f6c('0x5'))['exec'];var db=require(_0x4f6c('0x6'))['db'];var config=require(_0x4f6c('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x4f6c('0x8'))(_0x4f6c('0x9'));var git=require('simple-git')(config[_0x4f6c('0xa')]);exports[_0x4f6c('0xb')]=function(_0x21a707,_0x3ef6c8){var _0x5c4a02={'current':module['exports'][_0x4f6c('0x3')],'phonebar':0x2};if(_0x21a707[_0x4f6c('0xc')]&&_0x21a707[_0x4f6c('0xc')]['latest']){return git[_0x4f6c('0xd')]()[_0x4f6c('0xe')](function(_0x310178,_0x151cc2){_0x5c4a02[_0x4f6c('0xf')]=(_0x310178?module[_0x4f6c('0x10')][_0x4f6c('0x3')]:_0x151cc2['latest'])||_0x4f6c('0x11');return _0x3ef6c8[_0x4f6c('0x12')](0xc8)[_0x4f6c('0x13')](_0x5c4a02);});}else{return _0x3ef6c8[_0x4f6c('0x12')](0xc8)['json'](_0x5c4a02);}};exports[_0x4f6c('0xd')]=function(_0x3a5ab9,_0x21f384){return git[_0x4f6c('0xd')]([_0x4f6c('0x14'),_0x4f6c('0x15')],function(_0x56b841){if(_0x56b841){logger[_0x4f6c('0x16')](_0x56b841);return _0x21f384[_0x4f6c('0x12')](0x1f4)[_0x4f6c('0x13')](_0x56b841);}logger[_0x4f6c('0x17')](_0x4f6c('0x18'));return _0x21f384[_0x4f6c('0x12')](0xc8)[_0x4f6c('0x13')]({'output':_0x4f6c('0x19')});});};exports[_0x4f6c('0x1a')]=function(_0x42ed5a,_0x541ad0){return git['reset'](['--hard','FETCH_HEAD'],function(_0x3c9732){if(_0x3c9732){logger[_0x4f6c('0x16')](_0x3c9732);return _0x541ad0[_0x4f6c('0x12')](0x1f4)[_0x4f6c('0x13')](_0x3c9732);}logger[_0x4f6c('0x17')](_0x4f6c('0x1b'));return _0x541ad0[_0x4f6c('0x12')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports[_0x4f6c('0x1c')]=function(_0x2ed627,_0x2a4ad3){exec(_0x4f6c('0x1d'),function(_0x3c5508,_0x5b55fe,_0x37749c){logger['info'](_0x5b55fe);logger[_0x4f6c('0x17')](_0x37749c);if(_0x3c5508){logger['error'](_0x3c5508);return _0x2a4ad3[_0x4f6c('0x12')](0x1f4)['json'](_0x3c5508);}return _0x2a4ad3[_0x4f6c('0x12')](0xc8)[_0x4f6c('0x13')]({'output':_0x5b55fe});});};exports[_0x4f6c('0x1e')]=function(_0x4d3171,_0x596071){return pm2['restart'](_0x4f6c('0x1f'))[_0x4f6c('0x20')](function(_0x5cfb41){logger[_0x4f6c('0x17')](_0x4f6c('0x21'),_0x5cfb41);return _0x596071['status'](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x24095d){logger[_0x4f6c('0x16')](_0x24095d);return _0x596071[_0x4f6c('0x12')](0x1f4)['json'](_0x24095d);});};exports['migrations']=function(_0x2aa934,_0x37233a){var _0x5c7927=fs[_0x4f6c('0x22')](path['join'](config[_0x4f6c('0xa')],'server',_0x4f6c('0x23')));var _0x57ff7d=[];for(var _0x2917fe=0x0;_0x2917fe<_0x5c7927[_0x4f6c('0x24')];_0x2917fe++){var _0x1fa00c=_0x5c7927[_0x2917fe][_0x4f6c('0x25')](_0x4f6c('0x26'),'');if(compareVersions(module['exports'][_0x4f6c('0x3')],_0x1fa00c)===-0x1){_0x57ff7d[_0x4f6c('0x27')](_0x1fa00c);}}if(_0x57ff7d['length']){var _0xf1d192=_0x57ff7d['sort'](compareVersions);var _0x5b0bed=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x4f6c('0x28')],'modelName':_0x4f6c('0x28'),'columnName':'version'},'migrations':{'params':[db[_0x4f6c('0x29')]['getQueryInterface'](),db['sequelize'][_0x4f6c('0x2a')],function(){throw new Error(_0x4f6c('0x2b'));}],'path':path[_0x4f6c('0x2c')](config[_0x4f6c('0xa')],_0x4f6c('0x2d'),'migrations'),'pattern':/\.js$/}});_0x5b0bed['up']({'migrations':_[_0x4f6c('0x2e')](_0xf1d192,function(_0x361b9d){return _0x361b9d+'.js';})})[_0x4f6c('0x20')](function(){return _0x37233a[_0x4f6c('0x12')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x4f6c('0x3')]+'\x20to\x20'+_['last'](_0xf1d192),'migrations':_[_0x4f6c('0x2c')](_0xf1d192)});})[_0x4f6c('0x2f')](function(_0x12e6dd){if(_0x12e6dd instanceof db[_0x4f6c('0x29')][_0x4f6c('0x30')]){return _0x37233a[_0x4f6c('0x12')](0xc8)[_0x4f6c('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x37233a['status'](0x1f4)[_0x4f6c('0x13')](_0x12e6dd);}});}else{return _0x37233a[_0x4f6c('0x12')](0xc8)[_0x4f6c('0x13')]({'output':_0x4f6c('0x31')});}}; \ No newline at end of file +var _0x4227=['git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','version','child_process','exec','../../config/environment','update','simple-git','exports','query','tags','latest','2.0.0','status','json','fetch','origin','master','info','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x4227,0x1d2));var _0x7422=function(_0x5630cb,_0xbe3475){_0x5630cb=_0x5630cb-0x0;var _0x69b9e5=_0x4227[_0x5630cb];return _0x69b9e5;};'use strict';var Umzug=require('umzug');var path=require(_0x7422('0x0'));var fs=require('fs');var _=require(_0x7422('0x1'));var pkginfo=require('pkginfo')(module,_0x7422('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x7422('0x3'))[_0x7422('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0x7422('0x5'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x7422('0x6'));var git=require(_0x7422('0x7'))(config['root']);exports['index']=function(_0x27e79e,_0x272645){var _0x55fdb1={'current':module[_0x7422('0x8')][_0x7422('0x2')],'phonebar':0x2};if(_0x27e79e[_0x7422('0x9')]&&_0x27e79e['query']['latest']){return git['fetch']()[_0x7422('0xa')](function(_0x488692,_0x43f282){_0x55fdb1[_0x7422('0xb')]=(_0x488692?module[_0x7422('0x8')][_0x7422('0x2')]:_0x43f282[_0x7422('0xb')])||_0x7422('0xc');return _0x272645[_0x7422('0xd')](0xc8)[_0x7422('0xe')](_0x55fdb1);});}else{return _0x272645['status'](0xc8)[_0x7422('0xe')](_0x55fdb1);}};exports[_0x7422('0xf')]=function(_0x3a3e30,_0x2c51a2){return git[_0x7422('0xf')]([_0x7422('0x10'),_0x7422('0x11')],function(_0x1ad9cb){if(_0x1ad9cb){logger['error'](_0x1ad9cb);return _0x2c51a2[_0x7422('0xd')](0x1f4)['json'](_0x1ad9cb);}logger[_0x7422('0x12')]('git\x20fetch');return _0x2c51a2[_0x7422('0xd')](0xc8)[_0x7422('0xe')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x7422('0x13')]=function(_0x474182,_0xb968b){return git[_0x7422('0x13')]([_0x7422('0x14'),_0x7422('0x15')],function(_0x478567){if(_0x478567){logger[_0x7422('0x16')](_0x478567);return _0xb968b['status'](0x1f4)[_0x7422('0xe')](_0x478567);}logger['info'](_0x7422('0x17'));return _0xb968b[_0x7422('0xd')](0xc8)[_0x7422('0xe')]({'output':_0x7422('0x18')});});};exports[_0x7422('0x19')]=function(_0x121f0e,_0x546b1a){exec(_0x7422('0x1a'),function(_0x11e6d7,_0x33edba,_0x1a7a0a){logger[_0x7422('0x12')](_0x33edba);logger['info'](_0x1a7a0a);if(_0x11e6d7){logger[_0x7422('0x16')](_0x11e6d7);return _0x546b1a['status'](0x1f4)[_0x7422('0xe')](_0x11e6d7);}return _0x546b1a['status'](0xc8)[_0x7422('0xe')]({'output':_0x33edba});});};exports[_0x7422('0x1b')]=function(_0x29c439,_0x5afd0c){return pm2[_0x7422('0x1b')](_0x7422('0x1c'))[_0x7422('0x1d')](function(_0x35d601){logger['info'](_0x7422('0x1e'),_0x35d601);return _0x5afd0c['status'](0xc8)[_0x7422('0xe')]({'output':_0x7422('0x1f')});})[_0x7422('0x20')](function(_0x567a60){logger[_0x7422('0x16')](_0x567a60);return _0x5afd0c[_0x7422('0xd')](0x1f4)[_0x7422('0xe')](_0x567a60);});};exports[_0x7422('0x21')]=function(_0x18d268,_0x5d5082){var _0x11da1e=fs[_0x7422('0x22')](path[_0x7422('0x23')](config[_0x7422('0x24')],_0x7422('0x25'),'migrations'));var _0x26e395=[];for(var _0x35faa1=0x0;_0x35faa1<_0x11da1e[_0x7422('0x26')];_0x35faa1++){var _0x3fab0d=_0x11da1e[_0x35faa1]['replace'](_0x7422('0x27'),'');if(compareVersions(module[_0x7422('0x8')][_0x7422('0x2')],_0x3fab0d)===-0x1){_0x26e395[_0x7422('0x28')](_0x3fab0d);}}if(_0x26e395[_0x7422('0x26')]){var _0x1e2d20=_0x26e395[_0x7422('0x29')](compareVersions);var _0x2f5e4c=new Umzug({'storage':_0x7422('0x2a'),'storageOptions':{'model':db[_0x7422('0x2b')],'modelName':'Migration','columnName':_0x7422('0x2')},'migrations':{'params':[db['sequelize'][_0x7422('0x2c')](),db[_0x7422('0x2a')]['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[_0x7422('0x23')](config[_0x7422('0x24')],_0x7422('0x25'),_0x7422('0x21')),'pattern':/\.js$/}});_0x2f5e4c['up']({'migrations':_['map'](_0x1e2d20,function(_0x1cb150){return _0x1cb150+_0x7422('0x27');})})[_0x7422('0x1d')](function(){return _0x5d5082[_0x7422('0xd')](0xc8)['json']({'output':_0x7422('0x2d')+module['exports'][_0x7422('0x2')]+_0x7422('0x2e')+_['last'](_0x1e2d20),'migrations':_[_0x7422('0x23')](_0x1e2d20)});})[_0x7422('0x20')](function(_0x2b31bd){if(_0x2b31bd instanceof db[_0x7422('0x2a')][_0x7422('0x2f')]){return _0x5d5082['status'](0xc8)[_0x7422('0xe')]({'output':_0x7422('0x30')});}else{return _0x5d5082['status'](0x1f4)[_0x7422('0xe')](_0x2b31bd);}});}else{return _0x5d5082[_0x7422('0xd')](0xc8)[_0x7422('0xe')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index b319fd9..5b6cbbc 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 _0x3d1e=['Router','fs-extra','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5b2270,_0x4cded3){var _0x58cd6e=function(_0x15ee72){while(--_0x15ee72){_0x5b2270['push'](_0x5b2270['shift']());}};_0x58cd6e(++_0x4cded3);}(_0x3d1e,0x19d));var _0xe3d1=function(_0x63d906,_0x328d17){_0x63d906=_0x63d906-0x0;var _0x571949=_0x3d1e[_0x63d906];return _0x571949;};'use strict';var multer=require(_0xe3d1('0x0'));var util=require(_0xe3d1('0x1'));var path=require(_0xe3d1('0x2'));var timeout=require(_0xe3d1('0x3'));var express=require(_0xe3d1('0x4'));var router=express[_0xe3d1('0x5')]();var fs_extra=require(_0xe3d1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe3d1('0x7'));var config=require('../../config/environment');var controller=require(_0xe3d1('0x8'));router[_0xe3d1('0x9')]('/',auth[_0xe3d1('0xa')](),controller['index']);router[_0xe3d1('0x9')](_0xe3d1('0xb'),auth[_0xe3d1('0xa')](),controller[_0xe3d1('0xc')]);router[_0xe3d1('0x9')](_0xe3d1('0xd'),auth['isAuthenticated'](),controller[_0xe3d1('0xe')]);router[_0xe3d1('0xf')]('/',auth[_0xe3d1('0xa')](),controller[_0xe3d1('0x10')]);router[_0xe3d1('0x11')](_0xe3d1('0xd'),auth['isAuthenticated'](),controller[_0xe3d1('0x12')]);router[_0xe3d1('0x13')](_0xe3d1('0xd'),auth[_0xe3d1('0xa')](),controller[_0xe3d1('0x14')]);module[_0xe3d1('0x15')]=router; \ No newline at end of file +var _0xe602=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','delete','exports','multer','util','path','express'];(function(_0x2e00eb,_0x318307){var _0x20221a=function(_0x12a33e){while(--_0x12a33e){_0x2e00eb['push'](_0x2e00eb['shift']());}};_0x20221a(++_0x318307);}(_0xe602,0x1b4));var _0x2e60=function(_0x27f83b,_0x5ba021){_0x27f83b=_0x27f83b-0x0;var _0x1f1bbb=_0xe602[_0x27f83b];return _0x1f1bbb;};'use strict';var multer=require(_0x2e60('0x0'));var util=require(_0x2e60('0x1'));var path=require(_0x2e60('0x2'));var timeout=require('connect-timeout');var express=require(_0x2e60('0x3'));var router=express[_0x2e60('0x4')]();var fs_extra=require(_0x2e60('0x5'));var auth=require(_0x2e60('0x6'));var interaction=require(_0x2e60('0x7'));var config=require(_0x2e60('0x8'));var controller=require(_0x2e60('0x9'));router['get']('/',auth[_0x2e60('0xa')](),controller[_0x2e60('0xb')]);router[_0x2e60('0xc')](_0x2e60('0xd'),auth['isAuthenticated'](),controller[_0x2e60('0xe')]);router[_0x2e60('0xc')](_0x2e60('0xf'),auth[_0x2e60('0xa')](),controller['show']);router['post']('/',auth[_0x2e60('0xa')](),controller[_0x2e60('0x10')]);router[_0x2e60('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2e60('0x12')]('/:id',auth[_0x2e60('0xa')](),controller['destroy']);module[_0x2e60('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 3d45af3..64962c5 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 _0xd7a0=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0xce1a87,_0x372c44){var _0x26669d=function(_0x215038){while(--_0x215038){_0xce1a87['push'](_0xce1a87['shift']());}};_0x26669d(++_0x372c44);}(_0xd7a0,0x163));var _0x0d7a=function(_0x11f2ba,_0x15ed34){_0x11f2ba=_0x11f2ba-0x0;var _0x31f60b=_0xd7a0[_0x11f2ba];return _0x31f60b;};'use strict';var Sequelize=require(_0x0d7a('0x0'));module[_0x0d7a('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0d7a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0d7a('0x2')]},'queue':{'type':Sequelize[_0x0d7a('0x2')]},'interface':{'type':Sequelize[_0x0d7a('0x2')]},'membername':{'type':Sequelize[_0x0d7a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0d7a('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x0d7a('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x0d7a('0x3')]},'agentdumpAt':{'type':Sequelize[_0x0d7a('0x3')]},'holdtime':{'type':Sequelize[_0x0d7a('0x4')]},'agentcomplete':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0d7a('0x4')]},'reason':{'type':Sequelize[_0x0d7a('0x2')]},'lastevent':{'type':Sequelize[_0x0d7a('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x0d7a('0x4')]},'channelstatedesc':{'type':Sequelize[_0x0d7a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0d7a('0x2')]},'language':{'type':Sequelize[_0x0d7a('0x2')]},'accountcode':{'type':Sequelize[_0x0d7a('0x2')]},'context':{'type':Sequelize[_0x0d7a('0x2')]},'exten':{'type':Sequelize[_0x0d7a('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x0d7a('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x0d7a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x0d7a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x0d7a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x0d7a('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x0d7a('0x2')]},'destpriority':{'type':Sequelize[_0x0d7a('0x2')]},'destuniqueid':{'type':Sequelize[_0x0d7a('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0d7a('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0d7a('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0d7a('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0d7a('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0d7a('0x2')]},'agententerreason':{'type':Sequelize[_0x0d7a('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ace=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x3e1438,_0xc6962a){var _0x39ee96=function(_0x1f7698){while(--_0x1f7698){_0x3e1438['push'](_0x3e1438['shift']());}};_0x39ee96(++_0xc6962a);}(_0x2ace,0x17e));var _0xe2ac=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0x2ace[_0x4bfcbe];return _0x5b65e6;};'use strict';var Sequelize=require('sequelize');module[_0xe2ac('0x0')]={'type':{'type':Sequelize[_0xe2ac('0x1')]},'uniqueid':{'type':Sequelize[_0xe2ac('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe2ac('0x1')]},'queue':{'type':Sequelize[_0xe2ac('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe2ac('0x1')]},'agentcalledAt':{'type':Sequelize[_0xe2ac('0x2')]},'agentconnectAt':{'type':Sequelize[_0xe2ac('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xe2ac('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xe2ac('0x2')]},'agentdumpAt':{'type':Sequelize[_0xe2ac('0x2')]},'holdtime':{'type':Sequelize[_0xe2ac('0x3')]},'agentcomplete':{'type':Sequelize[_0xe2ac('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe2ac('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe2ac('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe2ac('0x3')]},'agentacw':{'type':Sequelize[_0xe2ac('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe2ac('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe2ac('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe2ac('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe2ac('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe2ac('0x1')]},'accountcode':{'type':Sequelize[_0xe2ac('0x1')]},'context':{'type':Sequelize[_0xe2ac('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe2ac('0x1')]},'destchannel':{'type':Sequelize[_0xe2ac('0x1')]},'destchannelstate':{'type':Sequelize[_0xe2ac('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xe2ac('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe2ac('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xe2ac('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xe2ac('0x1')]},'destaccountcode':{'type':Sequelize[_0xe2ac('0x1')]},'destcontext':{'type':Sequelize[_0xe2ac('0x1')]},'destexten':{'type':Sequelize[_0xe2ac('0x1')]},'destpriority':{'type':Sequelize[_0xe2ac('0x1')]},'destuniqueid':{'type':Sequelize[_0xe2ac('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe2ac('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xe2ac('0x1')]},'transfer':{'type':Sequelize[_0xe2ac('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xe2ac('0x5')},'transferexten':{'type':Sequelize[_0xe2ac('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xe2ac('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 c7460a7..a0d0189 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(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +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(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index e83932a..f19c41d 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 _0x3561=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','../../config/logger'];(function(_0x5550f9,_0x36bd22){var _0x58f71a=function(_0x31311d){while(--_0x31311d){_0x5550f9['push'](_0x5550f9['shift']());}};_0x58f71a(++_0x36bd22);}(_0x3561,0x94));var _0x1356=function(_0x17c0e5,_0x4e4c0b){_0x17c0e5=_0x17c0e5-0x0;var _0xc2e7f8=_0x3561[_0x17c0e5];return _0xc2e7f8;};'use strict';var _=require(_0x1356('0x0'));var util=require('util');var logger=require(_0x1356('0x1'))(_0x1356('0x2'));var moment=require(_0x1356('0x3'));var BPromise=require(_0x1356('0x4'));var rp=require(_0x1356('0x5'));var fs=require('fs');var path=require(_0x1356('0x6'));var rimraf=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var attributes=require(_0x1356('0x9'));module[_0x1356('0xa')]=function(_0x417d11,_0x36e81f){return _0x417d11[_0x1356('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x1356('0xc'),'paranoid':![],'indexes':[{'fields':[_0x1356('0xd'),_0x1356('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83d3=['report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport'];(function(_0x38c2b5,_0x4de8fa){var _0x46deb3=function(_0x49dd48){while(--_0x49dd48){_0x38c2b5['push'](_0x38c2b5['shift']());}};_0x46deb3(++_0x4de8fa);}(_0x83d3,0x17c));var _0x383d=function(_0x2a7c2a,_0x37cc9e){_0x2a7c2a=_0x2a7c2a-0x0;var _0x195732=_0x83d3[_0x2a7c2a];return _0x195732;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x383d('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 742ad80..1db758d 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 _0xa6b3=['client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceAgentReport,\x20%s,\x20%s','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','stringify','UpdateVoiceAgentReport','limit','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4e10ef,_0x43bb57){var _0x3528ef=function(_0x40cbf4){while(--_0x40cbf4){_0x4e10ef['push'](_0x4e10ef['shift']());}};_0x3528ef(++_0x43bb57);}(_0xa6b3,0x165));var _0x3a6b=function(_0x33e48f,_0x47ef69){_0x33e48f=_0x33e48f-0x0;var _0x591d05=_0xa6b3[_0x33e48f];return _0x591d05;};'use strict';var _=require('lodash');var util=require(_0x3a6b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3a6b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a6b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a6b('0x3'))(_0x3a6b('0x4'));var config=require(_0x3a6b('0x5'));var jayson=require(_0x3a6b('0x6'));var client=jayson[_0x3a6b('0x7')][_0x3a6b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bef23,_0x1cf7b7,_0x5082ca){return new BPromise(function(_0xa97ad5,_0x33fdff){return client[_0x3a6b('0x9')](_0x3bef23,_0x5082ca)[_0x3a6b('0xa')](function(_0x30d4f4){logger[_0x3a6b('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x1cf7b7,_0x3a6b('0xc'));logger[_0x3a6b('0xd')](_0x3a6b('0xe'),_0x1cf7b7,_0x3a6b('0xc'),JSON['stringify'](_0x30d4f4));if(_0x30d4f4[_0x3a6b('0xf')]){if(_0x30d4f4[_0x3a6b('0xf')][_0x3a6b('0x10')]===0x1f4){logger[_0x3a6b('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x1cf7b7,_0x30d4f4[_0x3a6b('0xf')][_0x3a6b('0x11')]);return _0x33fdff(_0x30d4f4[_0x3a6b('0xf')]['message']);}logger[_0x3a6b('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x1cf7b7,_0x30d4f4[_0x3a6b('0xf')][_0x3a6b('0x11')]);return _0xa97ad5(_0x30d4f4['error'][_0x3a6b('0x11')]);}else{logger[_0x3a6b('0xb')](_0x3a6b('0x12'),_0x1cf7b7,_0x3a6b('0xc'));_0xa97ad5(_0x30d4f4['result'][_0x3a6b('0x11')]);}})[_0x3a6b('0x13')](function(_0x4d8756){logger['error'](_0x3a6b('0x12'),_0x1cf7b7,_0x4d8756);_0x33fdff(_0x4d8756);});});}exports[_0x3a6b('0x14')]=function(_0x4d0ae8){var _0x3120a6=this;return new Promise(function(_0x194117,_0x275efa){return db[_0x3a6b('0x15')][_0x3a6b('0x16')](_0x4d0ae8[_0x3a6b('0x17')],{'raw':_0x4d0ae8[_0x3a6b('0x18')]?_0x4d0ae8[_0x3a6b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x3a6b('0xa')](function(_0x550ee3){logger[_0x3a6b('0xb')](_0x3a6b('0x14'),_0x4d0ae8);logger[_0x3a6b('0xd')](_0x3a6b('0x14'),_0x4d0ae8,JSON[_0x3a6b('0x19')](_0x550ee3));_0x194117(_0x550ee3);})[_0x3a6b('0x13')](function(_0x580c01){logger[_0x3a6b('0xf')](_0x3a6b('0x14'),_0x580c01['message'],_0x4d0ae8);_0x275efa(_0x3120a6['error'](0x1f4,_0x580c01[_0x3a6b('0x11')]));});});};exports[_0x3a6b('0x1a')]=function(_0x35f726){var _0x37f52d=this;return new Promise(function(_0xa1de39,_0x1e25b3){return db['VoiceAgentReport']['update'](_0x35f726[_0x3a6b('0x17')],{'raw':_0x35f726['options']?_0x35f726[_0x3a6b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f726[_0x3a6b('0x18')]?_0x35f726[_0x3a6b('0x18')]['where']||null:null,'attributes':_0x35f726['options']?_0x35f726[_0x3a6b('0x18')]['attributes']||null:null,'limit':_0x35f726[_0x3a6b('0x18')]?_0x35f726[_0x3a6b('0x18')][_0x3a6b('0x1b')]||null:null})['then'](function(_0x29485d){logger[_0x3a6b('0xb')]('UpdateVoiceAgentReport',_0x35f726);logger[_0x3a6b('0xd')](_0x3a6b('0x1a'),_0x35f726,JSON[_0x3a6b('0x19')](_0x29485d));_0xa1de39(_0x29485d);})[_0x3a6b('0x13')](function(_0x545ede){logger['error']('UpdateVoiceAgentReport',_0x545ede['message'],_0x35f726);_0x1e25b3(_0x37f52d[_0x3a6b('0xf')](0x1f4,_0x545ede[_0x3a6b('0x11')]));});});}; \ No newline at end of file +var _0xe802=['body','options','then','stringify','catch','UpdateVoiceAgentReport','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create'];(function(_0x5a4257,_0x3ae34d){var _0x3746a7=function(_0x31fff0){while(--_0x31fff0){_0x5a4257['push'](_0x5a4257['shift']());}};_0x3746a7(++_0x3ae34d);}(_0xe802,0xe8));var _0x2e80=function(_0x3864cd,_0x54c59b){_0x3864cd=_0x3864cd-0x0;var _0x4d98d0=_0xe802[_0x3864cd];return _0x4d98d0;};'use strict';var _=require(_0x2e80('0x0'));var util=require(_0x2e80('0x1'));var moment=require(_0x2e80('0x2'));var BPromise=require(_0x2e80('0x3'));var rs=require(_0x2e80('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e80('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e80('0x6'))(_0x2e80('0x7'));var config=require(_0x2e80('0x8'));var jayson=require(_0x2e80('0x9'));var client=jayson['client'][_0x2e80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x412d9,_0xc5bf57,_0x272714){return new BPromise(function(_0x4cc315,_0x270805){return client[_0x2e80('0xb')](_0x412d9,_0x272714)['then'](function(_0x559212){logger[_0x2e80('0xc')](_0x2e80('0xd'),_0xc5bf57,_0x2e80('0xe'));logger[_0x2e80('0xf')](_0x2e80('0x10'),_0xc5bf57,_0x2e80('0xe'),JSON['stringify'](_0x559212));if(_0x559212['error']){if(_0x559212[_0x2e80('0x11')][_0x2e80('0x12')]===0x1f4){logger[_0x2e80('0x11')](_0x2e80('0xd'),_0xc5bf57,_0x559212[_0x2e80('0x11')][_0x2e80('0x13')]);return _0x270805(_0x559212[_0x2e80('0x11')][_0x2e80('0x13')]);}logger[_0x2e80('0x11')](_0x2e80('0xd'),_0xc5bf57,_0x559212[_0x2e80('0x11')][_0x2e80('0x13')]);return _0x4cc315(_0x559212[_0x2e80('0x11')][_0x2e80('0x13')]);}else{logger[_0x2e80('0xc')](_0x2e80('0xd'),_0xc5bf57,_0x2e80('0xe'));_0x4cc315(_0x559212[_0x2e80('0x14')][_0x2e80('0x13')]);}})['catch'](function(_0x2ccfc5){logger['error'](_0x2e80('0xd'),_0xc5bf57,_0x2ccfc5);_0x270805(_0x2ccfc5);});});}exports[_0x2e80('0x15')]=function(_0x383196){var _0x50fb73=this;return new Promise(function(_0x59b12f,_0x456347){return db[_0x2e80('0x16')][_0x2e80('0x17')](_0x383196[_0x2e80('0x18')],{'raw':_0x383196[_0x2e80('0x19')]?_0x383196[_0x2e80('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2e80('0x1a')](function(_0x8d11b0){logger[_0x2e80('0xc')](_0x2e80('0x15'),_0x383196);logger[_0x2e80('0xf')]('CreateVoiceAgentReport',_0x383196,JSON[_0x2e80('0x1b')](_0x8d11b0));_0x59b12f(_0x8d11b0);})[_0x2e80('0x1c')](function(_0x2255f5){logger[_0x2e80('0x11')](_0x2e80('0x15'),_0x2255f5[_0x2e80('0x13')],_0x383196);_0x456347(_0x50fb73[_0x2e80('0x11')](0x1f4,_0x2255f5[_0x2e80('0x13')]));});});};exports[_0x2e80('0x1d')]=function(_0x50201a){var _0x407ac4=this;return new Promise(function(_0x42e92e,_0x12f6c2){return db[_0x2e80('0x16')]['update'](_0x50201a[_0x2e80('0x18')],{'raw':_0x50201a[_0x2e80('0x19')]?_0x50201a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50201a[_0x2e80('0x19')]?_0x50201a[_0x2e80('0x19')]['where']||null:null,'attributes':_0x50201a['options']?_0x50201a[_0x2e80('0x19')][_0x2e80('0x1e')]||null:null,'limit':_0x50201a[_0x2e80('0x19')]?_0x50201a[_0x2e80('0x19')][_0x2e80('0x1f')]||null:null})['then'](function(_0x36b16a){logger[_0x2e80('0xc')](_0x2e80('0x1d'),_0x50201a);logger[_0x2e80('0xf')](_0x2e80('0x1d'),_0x50201a,JSON['stringify'](_0x36b16a));_0x42e92e(_0x36b16a);})[_0x2e80('0x1c')](function(_0x59abcd){logger[_0x2e80('0x11')](_0x2e80('0x1d'),_0x59abcd[_0x2e80('0x13')],_0x50201a);_0x12f6c2(_0x407ac4[_0x2e80('0x11')](0x1f4,_0x59abcd[_0x2e80('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 996f284..077972a 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 _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe'];(function(_0x2fcc8a,_0x47c3af){var _0x515d53=function(_0x290368){while(--_0x290368){_0x2fcc8a['push'](_0x2fcc8a['shift']());}};_0x515d53(++_0x47c3af);}(_0xa630,0xbe));var _0x0a63=function(_0x52e1ac,_0x128df9){_0x52e1ac=_0x52e1ac-0x0;var _0x258f06=_0xa630[_0x52e1ac];return _0x258f06;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file +var _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x4e9622,_0x25b4d1){var _0x592727=function(_0x228398){while(--_0x228398){_0x4e9622['push'](_0x4e9622['shift']());}};_0x592727(++_0x25b4d1);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x458e3e,_0x576c7f){_0x458e3e=_0x458e3e-0x0;var _0x4bb0ee=_0xd0bb[_0x458e3e];return _0x4bb0ee;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 2aadbc8..c8b046f 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 _0xb6a1=['TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','internal','outbound','inbound-fax','dialer'];(function(_0x546c6a,_0x20ece7){var _0x362547=function(_0x491e9c){while(--_0x491e9c){_0x546c6a['push'](_0x546c6a['shift']());}};_0x362547(++_0x20ece7);}(_0xb6a1,0x14d));var _0x1b6a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb6a1[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x1b6a('0x0'));module[_0x1b6a('0x1')]={'uniqueid':{'type':Sequelize[_0x1b6a('0x2')]},'type':{'type':Sequelize[_0x1b6a('0x3')]('inbound',_0x1b6a('0x4'),_0x1b6a('0x5'),_0x1b6a('0x6'),'outbound-fax',_0x1b6a('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1b6a('0x2')]},'source':{'type':Sequelize[_0x1b6a('0x2')]},'destination':{'type':Sequelize[_0x1b6a('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1b6a('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x1b6a('0x2')]},'lastapplication':{'type':Sequelize[_0x1b6a('0x2')]},'lastdata':{'type':Sequelize[_0x1b6a('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x1b6a('0x9')]},'answertime':{'type':Sequelize[_0x1b6a('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x1b6a('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1b6a('0x2')]},'amaflags':{'type':Sequelize[_0x1b6a('0x2')]},'userfield':{'type':Sequelize[_0x1b6a('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x1b6a('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x1b6a('0x2')]},'note':{'type':Sequelize[_0x1b6a('0x2')]},'prefix':{'type':Sequelize[_0x1b6a('0x2')]},'routeid':{'type':Sequelize[_0x1b6a('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5097=['dialer','STRING','TEXT','DATE','INTEGER','ENUM','inbound','outbound','outbound-fax'];(function(_0x5ae5c2,_0x1aebd2){var _0x30993f=function(_0x1d0c80){while(--_0x1d0c80){_0x5ae5c2['push'](_0x5ae5c2['shift']());}};_0x30993f(++_0x1aebd2);}(_0x5097,0xf8));var _0x7509=function(_0x29e01f,_0x42a2f5){_0x29e01f=_0x29e01f-0x0;var _0x1a099f=_0x5097[_0x29e01f];return _0x1a099f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7509('0x0')](_0x7509('0x1'),'internal',_0x7509('0x2'),'inbound-fax',_0x7509('0x3'),_0x7509('0x4'))},'tag':{'type':Sequelize[_0x7509('0x5')]},'accountcode':{'type':Sequelize[_0x7509('0x5')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7509('0x5')]},'channel':{'type':Sequelize[_0x7509('0x5')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x7509('0x6')]},'starttime':{'type':Sequelize[_0x7509('0x7')]},'systemanswertime':{'type':Sequelize[_0x7509('0x7')]},'answertime':{'type':Sequelize[_0x7509('0x7')]},'endtime':{'type':Sequelize[_0x7509('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x7509('0x8')]},'mohtime':{'type':Sequelize[_0x7509('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7509('0x5')]},'userfield':{'type':Sequelize[_0x7509('0x5')]},'userDisposition':{'type':Sequelize[_0x7509('0x5')]},'userSecondDisposition':{'type':Sequelize[_0x7509('0x5')]},'userThirdDisposition':{'type':Sequelize[_0x7509('0x5')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x7509('0x5')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x7509('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e0f7115..e1afa54 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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x4c4b04,_0x3db067){var _0x267c5c=function(_0x232300){while(--_0x232300){_0x4c4b04['push'](_0x4c4b04['shift']());}};_0x267c5c(++_0x3db067);}(_0xb10b,0x12a));var _0xbb10=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0xb10b[_0x519c88];return _0x4668d7;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c1a65a6..6ec27f3 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 _0x0d27=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','VoiceCallReport','uniqueid','lodash','util'];(function(_0x183ee6,_0xf68dac){var _0x28b3d5=function(_0x1cc5e5){while(--_0x1cc5e5){_0x183ee6['push'](_0x183ee6['shift']());}};_0x28b3d5(++_0xf68dac);}(_0x0d27,0x112));var _0x70d2=function(_0x450651,_0x38be69){_0x450651=_0x450651-0x0;var _0x3cff3e=_0x0d27[_0x450651];return _0x3cff3e;};'use strict';var _=require(_0x70d2('0x0'));var util=require(_0x70d2('0x1'));var logger=require(_0x70d2('0x2'))(_0x70d2('0x3'));var moment=require(_0x70d2('0x4'));var BPromise=require(_0x70d2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70d2('0x6'));var rimraf=require('rimraf');var config=require(_0x70d2('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x70d2('0x8')]=function(_0x25f5ac,_0x5808ed){return _0x25f5ac[_0x70d2('0x9')](_0x70d2('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x70d2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2917=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x2917,0x142));var _0x7291=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0x2917[_0x58eec7];return _0x25c5d3;};'use strict';var _=require(_0x7291('0x0'));var util=require(_0x7291('0x1'));var logger=require(_0x7291('0x2'))(_0x7291('0x3'));var moment=require(_0x7291('0x4'));var BPromise=require(_0x7291('0x5'));var rp=require(_0x7291('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7291('0x7'));var attributes=require(_0x7291('0x8'));module[_0x7291('0x9')]=function(_0x6aac19,_0x1ee790){return _0x6aac19[_0x7291('0xa')](_0x7291('0xb'),attributes,{'tableName':_0x7291('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7291('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index e6fa987..cdd4674 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 _0x847b=['findAll','options','raw','where','attributes','limit','map','include','model','GetVoiceCallReport','create','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceCallReport'];(function(_0x26b729,_0x5a770c){var _0x5e5ea5=function(_0x4ef74e){while(--_0x4ef74e){_0x26b729['push'](_0x26b729['shift']());}};_0x5e5ea5(++_0x5a770c);}(_0x847b,0xf2));var _0xb847=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x847b[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xb847('0x0'));var util=require('util');var moment=require(_0xb847('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb847('0x2'));var db=require(_0xb847('0x3'))['db'];var utils=require(_0xb847('0x4'));var logger=require(_0xb847('0x5'))(_0xb847('0x6'));var config=require(_0xb847('0x7'));var jayson=require(_0xb847('0x8'));var client=jayson[_0xb847('0x9')][_0xb847('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x498e33,_0x1225ee,_0x1da7c8){return new BPromise(function(_0x46274d,_0x233ef1){return client[_0xb847('0xb')](_0x498e33,_0x1da7c8)[_0xb847('0xc')](function(_0x4ab21d){logger[_0xb847('0xd')](_0xb847('0xe'),_0x1225ee,_0xb847('0xf'));logger[_0xb847('0x10')](_0xb847('0x11'),_0x1225ee,_0xb847('0xf'),JSON[_0xb847('0x12')](_0x4ab21d));if(_0x4ab21d['error']){if(_0x4ab21d['error']['code']===0x1f4){logger[_0xb847('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x1225ee,_0x4ab21d[_0xb847('0x13')][_0xb847('0x14')]);return _0x233ef1(_0x4ab21d[_0xb847('0x13')][_0xb847('0x14')]);}logger[_0xb847('0x13')](_0xb847('0xe'),_0x1225ee,_0x4ab21d['error'][_0xb847('0x14')]);return _0x46274d(_0x4ab21d[_0xb847('0x13')][_0xb847('0x14')]);}else{logger['info'](_0xb847('0xe'),_0x1225ee,_0xb847('0xf'));_0x46274d(_0x4ab21d[_0xb847('0x15')]['message']);}})[_0xb847('0x16')](function(_0x25b8b5){logger['error'](_0xb847('0xe'),_0x1225ee,_0x25b8b5);_0x233ef1(_0x25b8b5);});});}exports['GetVoiceCallReport']=function(_0x2bdd18){var _0x11d00d=this;return new Promise(function(_0x292f00,_0xe31ce7){return db[_0xb847('0x17')][_0xb847('0x18')]({'raw':_0x2bdd18[_0xb847('0x19')]?_0x2bdd18['options'][_0xb847('0x1a')]===undefined?!![]:![]:!![],'where':_0x2bdd18[_0xb847('0x19')]?_0x2bdd18['options'][_0xb847('0x1b')]||null:null,'attributes':_0x2bdd18[_0xb847('0x19')]?_0x2bdd18['options'][_0xb847('0x1c')]||null:null,'limit':_0x2bdd18['options']?_0x2bdd18[_0xb847('0x19')][_0xb847('0x1d')]||null:null,'include':_0x2bdd18[_0xb847('0x19')]?_0x2bdd18[_0xb847('0x19')]['include']?_[_0xb847('0x1e')](_0x2bdd18[_0xb847('0x19')][_0xb847('0x1f')],function(_0x4a078f){return{'model':db[_0x4a078f['model']],'as':_0x4a078f['as'],'attributes':_0x4a078f[_0xb847('0x1c')],'include':_0x4a078f[_0xb847('0x1f')]?_[_0xb847('0x1e')](_0x4a078f[_0xb847('0x1f')],function(_0xe21669){return{'model':db[_0xe21669['model']],'as':_0xe21669['as'],'attributes':_0xe21669['attributes'],'include':_0xe21669['include']?_[_0xb847('0x1e')](_0xe21669['include'],function(_0x5e0cf1){return{'model':db[_0x5e0cf1[_0xb847('0x20')]],'as':_0x5e0cf1['as'],'attributes':_0x5e0cf1[_0xb847('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20b63b){logger['info']('GetVoiceCallReport',_0x2bdd18);logger['debug']('GetVoiceCallReport',_0x2bdd18,JSON[_0xb847('0x12')](_0x20b63b));_0x292f00(_0x20b63b);})[_0xb847('0x16')](function(_0x3dac15){logger[_0xb847('0x13')](_0xb847('0x21'),_0x3dac15['message'],_0x2bdd18);_0xe31ce7(_0x11d00d[_0xb847('0x13')](0x1f4,_0x3dac15['message']));});});};exports['CreateVoiceCallReport']=function(_0x4601bc){var _0x1bf669=this;return new Promise(function(_0x4d4e0d,_0x3aa941){return db['VoiceCallReport'][_0xb847('0x22')](_0x4601bc['body'],{'raw':_0x4601bc['options']?_0x4601bc[_0xb847('0x19')][_0xb847('0x1a')]===undefined?!![]:![]:!![]})[_0xb847('0xc')](function(_0x58f9ab){logger[_0xb847('0xd')](_0xb847('0x23'),_0x4601bc);logger[_0xb847('0x10')](_0xb847('0x23'),_0x4601bc,JSON[_0xb847('0x12')](_0x58f9ab));_0x4d4e0d(_0x58f9ab);})[_0xb847('0x16')](function(_0x4f4ef2){logger[_0xb847('0x13')](_0xb847('0x23'),_0x4f4ef2['message'],_0x4601bc);_0x3aa941(_0x1bf669[_0xb847('0x13')](0x1f4,_0x4f4ef2[_0xb847('0x14')]));});});};exports[_0xb847('0x24')]=function(_0x49b8f2){var _0x16aace=this;return new Promise(function(_0x1c8123,_0x7e66f3){return db[_0xb847('0x17')][_0xb847('0x25')](_0x49b8f2['body'],{'raw':_0x49b8f2['options']?_0x49b8f2[_0xb847('0x19')][_0xb847('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49b8f2[_0xb847('0x19')]?_0x49b8f2['options']['where']||null:null,'attributes':_0x49b8f2[_0xb847('0x19')]?_0x49b8f2[_0xb847('0x19')][_0xb847('0x1c')]||null:null,'limit':_0x49b8f2['options']?_0x49b8f2[_0xb847('0x19')][_0xb847('0x1d')]||null:null})[_0xb847('0xc')](function(_0x3c3c40){logger[_0xb847('0xd')]('UpdateVoiceCallReport',_0x49b8f2);logger[_0xb847('0x10')](_0xb847('0x24'),_0x49b8f2,JSON[_0xb847('0x12')](_0x3c3c40));_0x1c8123(_0x3c3c40);})[_0xb847('0x16')](function(_0x2543b1){logger[_0xb847('0x13')](_0xb847('0x24'),_0x2543b1[_0xb847('0x14')],_0x49b8f2);_0x7e66f3(_0x16aace['error'](0x1f4,_0x2543b1[_0xb847('0x14')]));});});}; \ No newline at end of file +var _0x739f=['../../config/environment','jayson/promise','client','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','debug','CreateVoiceCallReport','create','UpdateVoiceCallReport','body','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x739f,0x8d));var _0xf739=function(_0x548a53,_0x1fdb02){_0x548a53=_0x548a53-0x0;var _0x4177ed=_0x739f[_0x548a53];return _0x4177ed;};'use strict';var _=require('lodash');var util=require(_0xf739('0x0'));var moment=require(_0xf739('0x1'));var BPromise=require(_0xf739('0x2'));var rs=require(_0xf739('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf739('0x4'))['db'];var utils=require(_0xf739('0x5'));var logger=require(_0xf739('0x6'))('rpc');var config=require(_0xf739('0x7'));var jayson=require(_0xf739('0x8'));var client=jayson[_0xf739('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cafcf,_0x16d4c8,_0x41a1e0){return new BPromise(function(_0x4bb784,_0xf62e4f){return client[_0xf739('0xa')](_0x2cafcf,_0x41a1e0)[_0xf739('0xb')](function(_0x306b3c){logger['info'](_0xf739('0xc'),_0x16d4c8,_0xf739('0xd'));logger['debug'](_0xf739('0xe'),_0x16d4c8,_0xf739('0xd'),JSON[_0xf739('0xf')](_0x306b3c));if(_0x306b3c[_0xf739('0x10')]){if(_0x306b3c[_0xf739('0x10')]['code']===0x1f4){logger[_0xf739('0x10')](_0xf739('0xc'),_0x16d4c8,_0x306b3c[_0xf739('0x10')][_0xf739('0x11')]);return _0xf62e4f(_0x306b3c[_0xf739('0x10')][_0xf739('0x11')]);}logger[_0xf739('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x16d4c8,_0x306b3c['error'][_0xf739('0x11')]);return _0x4bb784(_0x306b3c[_0xf739('0x10')][_0xf739('0x11')]);}else{logger[_0xf739('0x12')](_0xf739('0xc'),_0x16d4c8,_0xf739('0xd'));_0x4bb784(_0x306b3c[_0xf739('0x13')][_0xf739('0x11')]);}})[_0xf739('0x14')](function(_0xb0457){logger[_0xf739('0x10')](_0xf739('0xc'),_0x16d4c8,_0xb0457);_0xf62e4f(_0xb0457);});});}exports[_0xf739('0x15')]=function(_0x78f0ab){var _0x20c9af=this;return new Promise(function(_0x3807b7,_0x443f37){return db[_0xf739('0x16')][_0xf739('0x17')]({'raw':_0x78f0ab[_0xf739('0x18')]?_0x78f0ab[_0xf739('0x18')][_0xf739('0x19')]===undefined?!![]:![]:!![],'where':_0x78f0ab[_0xf739('0x18')]?_0x78f0ab['options'][_0xf739('0x1a')]||null:null,'attributes':_0x78f0ab[_0xf739('0x18')]?_0x78f0ab[_0xf739('0x18')][_0xf739('0x1b')]||null:null,'limit':_0x78f0ab['options']?_0x78f0ab['options'][_0xf739('0x1c')]||null:null,'include':_0x78f0ab['options']?_0x78f0ab[_0xf739('0x18')]['include']?_['map'](_0x78f0ab[_0xf739('0x18')][_0xf739('0x1d')],function(_0x17fe25){return{'model':db[_0x17fe25[_0xf739('0x1e')]],'as':_0x17fe25['as'],'attributes':_0x17fe25[_0xf739('0x1b')],'include':_0x17fe25['include']?_[_0xf739('0x1f')](_0x17fe25['include'],function(_0x139b97){return{'model':db[_0x139b97[_0xf739('0x1e')]],'as':_0x139b97['as'],'attributes':_0x139b97[_0xf739('0x1b')],'include':_0x139b97['include']?_[_0xf739('0x1f')](_0x139b97[_0xf739('0x1d')],function(_0x2c1bbb){return{'model':db[_0x2c1bbb['model']],'as':_0x2c1bbb['as'],'attributes':_0x2c1bbb[_0xf739('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf739('0xb')](function(_0x4a161c){logger['info'](_0xf739('0x15'),_0x78f0ab);logger[_0xf739('0x20')](_0xf739('0x15'),_0x78f0ab,JSON[_0xf739('0xf')](_0x4a161c));_0x3807b7(_0x4a161c);})[_0xf739('0x14')](function(_0x4c079f){logger[_0xf739('0x10')](_0xf739('0x15'),_0x4c079f[_0xf739('0x11')],_0x78f0ab);_0x443f37(_0x20c9af[_0xf739('0x10')](0x1f4,_0x4c079f[_0xf739('0x11')]));});});};exports[_0xf739('0x21')]=function(_0x570f48){var _0x5bb382=this;return new Promise(function(_0x126a24,_0x5e7e61){return db[_0xf739('0x16')][_0xf739('0x22')](_0x570f48['body'],{'raw':_0x570f48[_0xf739('0x18')]?_0x570f48[_0xf739('0x18')][_0xf739('0x19')]===undefined?!![]:![]:!![]})[_0xf739('0xb')](function(_0xefffbd){logger[_0xf739('0x12')](_0xf739('0x21'),_0x570f48);logger[_0xf739('0x20')](_0xf739('0x21'),_0x570f48,JSON['stringify'](_0xefffbd));_0x126a24(_0xefffbd);})[_0xf739('0x14')](function(_0x36f719){logger[_0xf739('0x10')](_0xf739('0x21'),_0x36f719[_0xf739('0x11')],_0x570f48);_0x5e7e61(_0x5bb382['error'](0x1f4,_0x36f719[_0xf739('0x11')]));});});};exports[_0xf739('0x23')]=function(_0x58361b){var _0x2e98da=this;return new Promise(function(_0x17bb26,_0x26abaa){return db['VoiceCallReport']['update'](_0x58361b[_0xf739('0x24')],{'raw':_0x58361b['options']?_0x58361b[_0xf739('0x18')][_0xf739('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58361b[_0xf739('0x18')]?_0x58361b[_0xf739('0x18')][_0xf739('0x1a')]||null:null,'attributes':_0x58361b[_0xf739('0x18')]?_0x58361b[_0xf739('0x18')][_0xf739('0x1b')]||null:null,'limit':_0x58361b[_0xf739('0x18')]?_0x58361b[_0xf739('0x18')][_0xf739('0x1c')]||null:null})['then'](function(_0x54cbf9){logger[_0xf739('0x12')]('UpdateVoiceCallReport',_0x58361b);logger['debug'](_0xf739('0x23'),_0x58361b,JSON['stringify'](_0x54cbf9));_0x17bb26(_0x54cbf9);})['catch'](function(_0x1cb58b){logger[_0xf739('0x10')](_0xf739('0x23'),_0x1cb58b[_0xf739('0x11')],_0x58361b);_0x26abaa(_0x2e98da[_0xf739('0x10')](0x1f4,_0x1cb58b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 7444100..afa00f4 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 _0xfee6=['get','isAuthenticated','/:id','post','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xfee6,0x1b2));var _0x6fee=function(_0x5aed76,_0x22c450){_0x5aed76=_0x5aed76-0x0;var _0x26b84c=_0xfee6[_0x5aed76];return _0x26b84c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6fee('0x0'));var timeout=require('connect-timeout');var express=require(_0x6fee('0x1'));var router=express[_0x6fee('0x2')]();var fs_extra=require(_0x6fee('0x3'));var auth=require(_0x6fee('0x4'));var interaction=require(_0x6fee('0x5'));var config=require(_0x6fee('0x6'));var controller=require(_0x6fee('0x7'));router[_0x6fee('0x8')]('/',auth[_0x6fee('0x9')](),controller['index']);router[_0x6fee('0x8')](_0x6fee('0xa'),auth[_0x6fee('0x9')](),controller['show']);router[_0x6fee('0xb')]('/',auth[_0x6fee('0x9')](),controller['create']);router[_0x6fee('0xc')]('/:id',auth[_0x6fee('0x9')](),controller[_0x6fee('0xd')]);router[_0x6fee('0xe')](_0x6fee('0xa'),auth[_0x6fee('0x9')](),controller[_0x6fee('0xf')]);module[_0x6fee('0x10')]=router; \ No newline at end of file +var _0x618d=['/:id','show','post','create','put','update','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x618d,0xbd));var _0xd618=function(_0x3424ca,_0x19b913){_0x3424ca=_0x3424ca-0x0;var _0x1010d5=_0x618d[_0x3424ca];return _0x1010d5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd618('0x0'));var router=express[_0xd618('0x1')]();var fs_extra=require(_0xd618('0x2'));var auth=require(_0xd618('0x3'));var interaction=require(_0xd618('0x4'));var config=require('../../config/environment');var controller=require(_0xd618('0x5'));router[_0xd618('0x6')]('/',auth[_0xd618('0x7')](),controller[_0xd618('0x8')]);router['get'](_0xd618('0x9'),auth[_0xd618('0x7')](),controller[_0xd618('0xa')]);router[_0xd618('0xb')]('/',auth[_0xd618('0x7')](),controller[_0xd618('0xc')]);router[_0xd618('0xd')]('/:id',auth[_0xd618('0x7')](),controller[_0xd618('0xe')]);router[_0xd618('0xf')](_0xd618('0x9'),auth[_0xd618('0x7')](),controller[_0xd618('0x10')]);module[_0xd618('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 2167a05..3d983c4 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 _0xde32=['BOOLEAN','STRING','name','setDataValue','join','options','getDataValue','split'];(function(_0xc3a71f,_0x54fe71){var _0x46a474=function(_0x47e601){while(--_0x47e601){_0xc3a71f['push'](_0xc3a71f['shift']());}};_0x46a474(++_0x54fe71);}(_0xde32,0x119));var _0x2de3=function(_0x442f8a,_0x12ef37){_0x442f8a=_0x442f8a-0x0;var _0x44731f=_0xde32[_0x442f8a];return _0x44731f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2de3('0x0')]},'prefix':{'type':Sequelize[_0x2de3('0x0')],'unique':_0x2de3('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x2de3('0x0')],'set':function(_0x603b90){this[_0x2de3('0x2')]('options',_0x603b90?_0x603b90[_0x2de3('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0x2de3('0x4'))?this[_0x2de3('0x5')](_0x2de3('0x4'))[_0x2de3('0x6')](''):[];}},'auth':{'type':Sequelize[_0x2de3('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x2de3('0x0')]},'record':{'type':Sequelize[_0x2de3('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2de3('0x0')]},'description':{'type':Sequelize[_0x2de3('0x0')]}}; \ No newline at end of file +var _0xa294=['split','BOOLEAN','sequelize','exports','name','STRING','setDataValue','options','join','getDataValue'];(function(_0x27dfe4,_0x59f4f6){var _0xba8e56=function(_0x9c6af0){while(--_0x9c6af0){_0x27dfe4['push'](_0x27dfe4['shift']());}};_0xba8e56(++_0x59f4f6);}(_0xa294,0xb6));var _0x4a29=function(_0x548bfb,_0x260b5d){_0x548bfb=_0x548bfb-0x0;var _0x550bb8=_0xa294[_0x548bfb];return _0x550bb8;};'use strict';var Sequelize=require(_0x4a29('0x0'));module[_0x4a29('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x4a29('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x4a29('0x3')],'set':function(_0x2ea504){this[_0x4a29('0x4')](_0x4a29('0x5'),_0x2ea504?_0x2ea504[_0x4a29('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x4a29('0x5'))?this[_0x4a29('0x7')]('options')[_0x4a29('0x8')](''):[];}},'auth':{'type':Sequelize[_0x4a29('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x4a29('0x3')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4a29('0x3')]},'description':{'type':Sequelize[_0x4a29('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 4a6f8f6..cd3795d 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 _0xd624=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','end','error','stack','name','map','VoiceChanSpy','rawAttributes','type','key','model','filters','intersection','fields','query','attributes','length','order','sort','where','merge','filter','options','includeAll','include','rows','show','params','keys','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0xd624,0x124));var _0x4d62=function(_0x162fc0,_0x3cdfa9){_0x162fc0=_0x162fc0-0x0;var _0x42eebc=_0xd624[_0x162fc0];return _0x42eebc;};'use strict';var emlformat=require(_0x4d62('0x0'));var rimraf=require(_0x4d62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d62('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4d62('0x3'));var util=require(_0x4d62('0x4'));var path=require(_0x4d62('0x5'));var sox=require(_0x4d62('0x6'));var csv=require(_0x4d62('0x7'));var ejs=require(_0x4d62('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d62('0x9'));var crypto=require(_0x4d62('0xa'));var jsforce=require(_0x4d62('0xb'));var deskjs=require(_0x4d62('0xc'));var toCsv=require(_0x4d62('0x7'));var querystring=require('querystring');var Papa=require(_0x4d62('0xd'));var Redis=require(_0x4d62('0xe'));var authService=require(_0x4d62('0xf'));var qs=require(_0x4d62('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d62('0x11'));var logger=require(_0x4d62('0x12'))(_0x4d62('0x13'));var utils=require(_0x4d62('0x14'));var config=require(_0x4d62('0x15'));var licenseUtil=require(_0x4d62('0x16'));var db=require(_0x4d62('0x17'))['db'];function respondWithStatusCode(_0xc94193,_0x3d30a7){_0x3d30a7=_0x3d30a7||0xcc;return function(_0x282d79){if(_0x282d79){return _0xc94193[_0x4d62('0x18')](_0x3d30a7);}return _0xc94193[_0x4d62('0x19')](_0x3d30a7)['end']();};}function respondWithResult(_0x117c68,_0x409910){_0x409910=_0x409910||0xc8;return function(_0x1c6768){if(_0x1c6768){return _0x117c68['status'](_0x409910)[_0x4d62('0x1a')](_0x1c6768);}};}function respondWithFilteredResult(_0x1f3b54,_0x142396){return function(_0x5e2cee){if(_0x5e2cee){var _0x4974f4=typeof _0x142396[_0x4d62('0x1b')]===_0x4d62('0x1c')&&typeof _0x142396['limit']==='undefined';var _0x2e8602=_0x5e2cee[_0x4d62('0x1d')];var _0x54920b=_0x4974f4?0x0:_0x142396[_0x4d62('0x1b')];var _0x27ca77=_0x4974f4?_0x5e2cee[_0x4d62('0x1d')]:_0x142396[_0x4d62('0x1b')]+_0x142396[_0x4d62('0x1e')];var _0x45f78f;if(_0x27ca77>=_0x2e8602){_0x27ca77=_0x2e8602;_0x45f78f=0xc8;}else{_0x45f78f=0xce;}_0x1f3b54[_0x4d62('0x19')](_0x45f78f);return _0x1f3b54[_0x4d62('0x1f')](_0x4d62('0x20'),_0x54920b+'-'+_0x27ca77+'/'+_0x2e8602)[_0x4d62('0x1a')](_0x5e2cee);}return null;};}function patchUpdates(_0x494a8f){return function(_0x5d9e64){try{jsonpatch['apply'](_0x5d9e64,_0x494a8f,!![]);}catch(_0x435035){return BPromise[_0x4d62('0x21')](_0x435035);}return _0x5d9e64[_0x4d62('0x22')]();};}function saveUpdates(_0x5a0796,_0x3a5e4f){return function(_0x16fa3a){if(_0x16fa3a){return _0x16fa3a[_0x4d62('0x23')](_0x5a0796)['then'](function(_0x26c5e3){return _0x26c5e3;});}return null;};}function removeEntity(_0x30c443,_0x1a7ee9){return function(_0x57987b){if(_0x57987b){return _0x57987b[_0x4d62('0x24')]()[_0x4d62('0x25')](function(){var _0x4d4b94=_0x57987b[_0x4d62('0x26')]({'plain':!![]});var _0x3b4eee=_0x4d62('0x27');return db[_0x4d62('0x28')][_0x4d62('0x24')]({'where':{'type':_0x3b4eee,'resourceId':_0x4d4b94['id']}})[_0x4d62('0x25')](function(){return _0x57987b;});})[_0x4d62('0x25')](function(){_0x30c443[_0x4d62('0x19')](0xcc)[_0x4d62('0x29')]();});}};}function handleEntityNotFound(_0x474c69,_0xb5036e){return function(_0x54536c){if(!_0x54536c){_0x474c69['sendStatus'](0x194);}return _0x54536c;};}function handleError(_0x5174da,_0x43bf5b){_0x43bf5b=_0x43bf5b||0x1f4;return function(_0x566cce){logger[_0x4d62('0x2a')](_0x566cce[_0x4d62('0x2b')]);if(_0x566cce[_0x4d62('0x2c')]){delete _0x566cce['name'];}_0x5174da[_0x4d62('0x19')](_0x43bf5b)['send'](_0x566cce);};}exports['index']=function(_0x45458a,_0x5776d6){var _0x4379a4={},_0x46dcd3={},_0x1e73ba={'count':0x0,'rows':[]};var _0x33fc96=_[_0x4d62('0x2d')](db[_0x4d62('0x2e')][_0x4d62('0x2f')],function(_0x261872){return{'name':_0x261872['fieldName'],'type':_0x261872[_0x4d62('0x30')][_0x4d62('0x31')]};});_0x46dcd3[_0x4d62('0x32')]=_['map'](_0x33fc96,_0x4d62('0x2c'));_0x46dcd3['query']=_['keys'](_0x45458a['query']);_0x46dcd3[_0x4d62('0x33')]=_['intersection'](_0x46dcd3['model'],_0x46dcd3['query']);_0x4379a4['attributes']=_[_0x4d62('0x34')](_0x46dcd3[_0x4d62('0x32')],qs[_0x4d62('0x35')](_0x45458a[_0x4d62('0x36')][_0x4d62('0x35')]));_0x4379a4[_0x4d62('0x37')]=_0x4379a4[_0x4d62('0x37')][_0x4d62('0x38')]?_0x4379a4[_0x4d62('0x37')]:_0x46dcd3['model'];if(!_0x45458a[_0x4d62('0x36')]['hasOwnProperty']('nolimit')){_0x4379a4['limit']=qs[_0x4d62('0x1e')](_0x45458a[_0x4d62('0x36')][_0x4d62('0x1e')]);_0x4379a4[_0x4d62('0x1b')]=qs[_0x4d62('0x1b')](_0x45458a[_0x4d62('0x36')]['offset']);}_0x4379a4[_0x4d62('0x39')]=qs['sort'](_0x45458a[_0x4d62('0x36')][_0x4d62('0x3a')]);_0x4379a4[_0x4d62('0x3b')]=qs[_0x4d62('0x33')](_['pick'](_0x45458a[_0x4d62('0x36')],_0x46dcd3[_0x4d62('0x33')]),_0x33fc96);if(_0x45458a['query']['filter']){_0x4379a4[_0x4d62('0x3b')]=_[_0x4d62('0x3c')](_0x4379a4[_0x4d62('0x3b')],{'$or':_['map'](_0x33fc96,function(_0x5da096){if(_0x5da096['type']!=='VIRTUAL'){var _0x4997e9={};_0x4997e9[_0x5da096['name']]={'$like':'%'+_0x45458a[_0x4d62('0x36')][_0x4d62('0x3d')]+'%'};return _0x4997e9;}})});}_0x4379a4=_[_0x4d62('0x3c')]({},_0x4379a4,_0x45458a[_0x4d62('0x3e')]);var _0x45e5f0={'where':_0x4379a4['where']};return db[_0x4d62('0x2e')][_0x4d62('0x1d')](_0x45e5f0)['then'](function(_0x178d83){_0x1e73ba[_0x4d62('0x1d')]=_0x178d83;if(_0x45458a[_0x4d62('0x36')][_0x4d62('0x3f')]){_0x4379a4[_0x4d62('0x40')]=[{'all':!![]}];}return db[_0x4d62('0x2e')]['findAll'](_0x4379a4);})[_0x4d62('0x25')](function(_0x570d11){_0x1e73ba[_0x4d62('0x41')]=_0x570d11;return _0x1e73ba;})[_0x4d62('0x25')](respondWithFilteredResult(_0x5776d6,_0x4379a4))['catch'](handleError(_0x5776d6,null));};exports[_0x4d62('0x42')]=function(_0x5a84e3,_0x39a102){var _0x1e1600={'raw':![],'where':{'id':_0x5a84e3[_0x4d62('0x43')]['id']}},_0x1165bd={};_0x1165bd[_0x4d62('0x32')]=_['keys'](db[_0x4d62('0x2e')][_0x4d62('0x2f')]);_0x1165bd[_0x4d62('0x36')]=_[_0x4d62('0x44')](_0x5a84e3[_0x4d62('0x36')]);_0x1165bd[_0x4d62('0x33')]=_[_0x4d62('0x34')](_0x1165bd[_0x4d62('0x32')],_0x1165bd[_0x4d62('0x36')]);_0x1e1600[_0x4d62('0x37')]=_[_0x4d62('0x34')](_0x1165bd['model'],qs['fields'](_0x5a84e3[_0x4d62('0x36')][_0x4d62('0x35')]));_0x1e1600[_0x4d62('0x37')]=_0x1e1600[_0x4d62('0x37')][_0x4d62('0x38')]?_0x1e1600['attributes']:_0x1165bd['model'];if(_0x5a84e3[_0x4d62('0x36')][_0x4d62('0x3f')]){_0x1e1600[_0x4d62('0x40')]=[{'all':!![]}];}_0x1e1600=_[_0x4d62('0x3c')]({},_0x1e1600,_0x5a84e3[_0x4d62('0x3e')]);return db['VoiceChanSpy']['find'](_0x1e1600)[_0x4d62('0x25')](handleEntityNotFound(_0x39a102,null))['then'](respondWithResult(_0x39a102,null))[_0x4d62('0x45')](handleError(_0x39a102,null));};exports[_0x4d62('0x46')]=function(_0x230798,_0x485fe2){return db[_0x4d62('0x2e')][_0x4d62('0x46')](_0x230798[_0x4d62('0x47')],{})[_0x4d62('0x25')](function(_0x315797){var _0x2fc33e=_0x230798[_0x4d62('0x48')][_0x4d62('0x26')]({'plain':!![]});if(!_0x2fc33e)throw new Error(_0x4d62('0x49'));if(_0x2fc33e[_0x4d62('0x4a')]===_0x4d62('0x48')){var _0x51adc7=_0x315797[_0x4d62('0x26')]({'plain':!![]});var _0x9fe769=_0x4d62('0x27');return db['UserProfileSection'][_0x4d62('0x4b')]({'where':{'name':_0x9fe769,'userProfileId':_0x2fc33e[_0x4d62('0x4c')]},'raw':!![]})[_0x4d62('0x25')](function(_0x583cf5){if(_0x583cf5&&_0x583cf5['autoAssociation']===0x0){return db[_0x4d62('0x28')][_0x4d62('0x46')]({'name':_0x51adc7['name'],'resourceId':_0x51adc7['id'],'type':_0x583cf5['name'],'sectionId':_0x583cf5['id']},{})[_0x4d62('0x25')](function(){return _0x315797;});}else{return _0x315797;}})[_0x4d62('0x45')](function(_0x47e932){logger[_0x4d62('0x2a')](_0x4d62('0x4d'),_0x47e932);throw _0x47e932;});}return _0x315797;})[_0x4d62('0x25')](respondWithResult(_0x485fe2,0xc9))['catch'](handleError(_0x485fe2,null));};exports[_0x4d62('0x23')]=function(_0x5066b0,_0x5e43e5){if(_0x5066b0[_0x4d62('0x47')]['id']){delete _0x5066b0[_0x4d62('0x47')]['id'];}return db[_0x4d62('0x2e')][_0x4d62('0x4b')]({'where':{'id':_0x5066b0[_0x4d62('0x43')]['id']}})[_0x4d62('0x25')](handleEntityNotFound(_0x5e43e5,null))['then'](saveUpdates(_0x5066b0[_0x4d62('0x47')],null))[_0x4d62('0x25')](respondWithResult(_0x5e43e5,null))['catch'](handleError(_0x5e43e5,null));};exports[_0x4d62('0x24')]=function(_0x3e1536,_0x444459){return db['VoiceChanSpy'][_0x4d62('0x4b')]({'where':{'id':_0x3e1536[_0x4d62('0x43')]['id']}})[_0x4d62('0x25')](handleEntityNotFound(_0x444459,null))['then'](removeEntity(_0x444459,null))[_0x4d62('0x45')](handleError(_0x444459,null));}; \ No newline at end of file +var _0x3df4=['VIRTUAL','options','includeAll','include','findAll','catch','params','length','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','get','ChanSpies','UserProfileResource','then','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','filters','pick','filter','where'];(function(_0x6e2020,_0x5f3b6a){var _0x475ca5=function(_0xd3a45d){while(--_0xd3a45d){_0x6e2020['push'](_0x6e2020['shift']());}};_0x475ca5(++_0x5f3b6a);}(_0x3df4,0x102));var _0x43df=function(_0x15294d,_0x56c15c){_0x15294d=_0x15294d-0x0;var _0x332084=_0x3df4[_0x15294d];return _0x332084;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x43df('0x0'));var jsonpatch=require(_0x43df('0x1'));var rp=require(_0x43df('0x2'));var moment=require(_0x43df('0x3'));var BPromise=require(_0x43df('0x4'));var Mustache=require(_0x43df('0x5'));var util=require(_0x43df('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x43df('0x7'));var ejs=require(_0x43df('0x8'));var fs=require('fs');var fs_extra=require(_0x43df('0x9'));var _=require(_0x43df('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43df('0xb'));var deskjs=require(_0x43df('0xc'));var toCsv=require(_0x43df('0x7'));var querystring=require(_0x43df('0xd'));var Papa=require('papaparse');var Redis=require(_0x43df('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x43df('0xf'));var as=require(_0x43df('0x10'));var hardwareService=require(_0x43df('0x11'));var logger=require(_0x43df('0x12'))(_0x43df('0x13'));var utils=require(_0x43df('0x14'));var config=require(_0x43df('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x43df('0x16'))['db'];function respondWithStatusCode(_0x1140a9,_0x592a64){_0x592a64=_0x592a64||0xcc;return function(_0x14df5c){if(_0x14df5c){return _0x1140a9['sendStatus'](_0x592a64);}return _0x1140a9[_0x43df('0x17')](_0x592a64)[_0x43df('0x18')]();};}function respondWithResult(_0x4c4105,_0x3cbca1){_0x3cbca1=_0x3cbca1||0xc8;return function(_0x549159){if(_0x549159){return _0x4c4105['status'](_0x3cbca1)[_0x43df('0x19')](_0x549159);}};}function respondWithFilteredResult(_0x3748f2,_0x5c00d9){return function(_0x24f026){if(_0x24f026){var _0x592c70=typeof _0x5c00d9[_0x43df('0x1a')]===_0x43df('0x1b')&&typeof _0x5c00d9[_0x43df('0x1c')]===_0x43df('0x1b');var _0x2126fd=_0x24f026[_0x43df('0x1d')];var _0x571404=_0x592c70?0x0:_0x5c00d9[_0x43df('0x1a')];var _0x334fae=_0x592c70?_0x24f026[_0x43df('0x1d')]:_0x5c00d9[_0x43df('0x1a')]+_0x5c00d9['limit'];var _0x22314c;if(_0x334fae>=_0x2126fd){_0x334fae=_0x2126fd;_0x22314c=0xc8;}else{_0x22314c=0xce;}_0x3748f2[_0x43df('0x17')](_0x22314c);return _0x3748f2[_0x43df('0x1e')]('Content-Range',_0x571404+'-'+_0x334fae+'/'+_0x2126fd)['json'](_0x24f026);}return null;};}function patchUpdates(_0x4303c5){return function(_0x18e382){try{jsonpatch['apply'](_0x18e382,_0x4303c5,!![]);}catch(_0x3b51b2){return BPromise[_0x43df('0x1f')](_0x3b51b2);}return _0x18e382[_0x43df('0x20')]();};}function saveUpdates(_0x5c1cfc,_0x3b44d8){return function(_0x493e2c){if(_0x493e2c){return _0x493e2c[_0x43df('0x21')](_0x5c1cfc)['then'](function(_0xa975dc){return _0xa975dc;});}return null;};}function removeEntity(_0x37ecf9,_0xbb793b){return function(_0x4d05c9){if(_0x4d05c9){return _0x4d05c9[_0x43df('0x22')]()['then'](function(){var _0x252bcb=_0x4d05c9[_0x43df('0x23')]({'plain':!![]});var _0xda44f3=_0x43df('0x24');return db[_0x43df('0x25')][_0x43df('0x22')]({'where':{'type':_0xda44f3,'resourceId':_0x252bcb['id']}})[_0x43df('0x26')](function(){return _0x4d05c9;});})[_0x43df('0x26')](function(){_0x37ecf9[_0x43df('0x17')](0xcc)[_0x43df('0x18')]();});}};}function handleEntityNotFound(_0x2aa723,_0x4ade02){return function(_0x38f9b8){if(!_0x38f9b8){_0x2aa723[_0x43df('0x27')](0x194);}return _0x38f9b8;};}function handleError(_0x5afab5,_0x29f984){_0x29f984=_0x29f984||0x1f4;return function(_0x250fda){logger[_0x43df('0x28')](_0x250fda[_0x43df('0x29')]);if(_0x250fda[_0x43df('0x2a')]){delete _0x250fda[_0x43df('0x2a')];}_0x5afab5['status'](_0x29f984)['send'](_0x250fda);};}exports[_0x43df('0x2b')]=function(_0x5fdcab,_0x257a57){var _0x4665c7={},_0x2c6b4d={},_0x4b83a9={'count':0x0,'rows':[]};var _0x1973a3=_[_0x43df('0x2c')](db[_0x43df('0x2d')][_0x43df('0x2e')],function(_0xd7aaf9){return{'name':_0xd7aaf9[_0x43df('0x2f')],'type':_0xd7aaf9[_0x43df('0x30')][_0x43df('0x31')]};});_0x2c6b4d[_0x43df('0x32')]=_[_0x43df('0x2c')](_0x1973a3,_0x43df('0x2a'));_0x2c6b4d[_0x43df('0x33')]=_[_0x43df('0x34')](_0x5fdcab[_0x43df('0x33')]);_0x2c6b4d['filters']=_['intersection'](_0x2c6b4d[_0x43df('0x32')],_0x2c6b4d['query']);_0x4665c7[_0x43df('0x35')]=_[_0x43df('0x36')](_0x2c6b4d[_0x43df('0x32')],qs[_0x43df('0x37')](_0x5fdcab['query'][_0x43df('0x37')]));_0x4665c7[_0x43df('0x35')]=_0x4665c7[_0x43df('0x35')]['length']?_0x4665c7[_0x43df('0x35')]:_0x2c6b4d[_0x43df('0x32')];if(!_0x5fdcab[_0x43df('0x33')][_0x43df('0x38')]('nolimit')){_0x4665c7[_0x43df('0x1c')]=qs[_0x43df('0x1c')](_0x5fdcab[_0x43df('0x33')][_0x43df('0x1c')]);_0x4665c7[_0x43df('0x1a')]=qs[_0x43df('0x1a')](_0x5fdcab['query']['offset']);}_0x4665c7[_0x43df('0x39')]=qs['sort'](_0x5fdcab['query']['sort']);_0x4665c7['where']=qs[_0x43df('0x3a')](_[_0x43df('0x3b')](_0x5fdcab[_0x43df('0x33')],_0x2c6b4d[_0x43df('0x3a')]),_0x1973a3);if(_0x5fdcab['query'][_0x43df('0x3c')]){_0x4665c7[_0x43df('0x3d')]=_['merge'](_0x4665c7[_0x43df('0x3d')],{'$or':_[_0x43df('0x2c')](_0x1973a3,function(_0xed9f0d){if(_0xed9f0d[_0x43df('0x30')]!==_0x43df('0x3e')){var _0x29f1e1={};_0x29f1e1[_0xed9f0d['name']]={'$like':'%'+_0x5fdcab[_0x43df('0x33')]['filter']+'%'};return _0x29f1e1;}})});}_0x4665c7=_['merge']({},_0x4665c7,_0x5fdcab[_0x43df('0x3f')]);var _0xd16ae1={'where':_0x4665c7[_0x43df('0x3d')]};return db[_0x43df('0x2d')][_0x43df('0x1d')](_0xd16ae1)[_0x43df('0x26')](function(_0x50a37d){_0x4b83a9[_0x43df('0x1d')]=_0x50a37d;if(_0x5fdcab[_0x43df('0x33')][_0x43df('0x40')]){_0x4665c7[_0x43df('0x41')]=[{'all':!![]}];}return db[_0x43df('0x2d')][_0x43df('0x42')](_0x4665c7);})['then'](function(_0xe946a4){_0x4b83a9['rows']=_0xe946a4;return _0x4b83a9;})[_0x43df('0x26')](respondWithFilteredResult(_0x257a57,_0x4665c7))[_0x43df('0x43')](handleError(_0x257a57,null));};exports['show']=function(_0x16802c,_0x2d8f6b){var _0x233989={'raw':![],'where':{'id':_0x16802c[_0x43df('0x44')]['id']}},_0x309057={};_0x309057[_0x43df('0x32')]=_[_0x43df('0x34')](db[_0x43df('0x2d')][_0x43df('0x2e')]);_0x309057[_0x43df('0x33')]=_['keys'](_0x16802c[_0x43df('0x33')]);_0x309057['filters']=_['intersection'](_0x309057[_0x43df('0x32')],_0x309057[_0x43df('0x33')]);_0x233989[_0x43df('0x35')]=_['intersection'](_0x309057[_0x43df('0x32')],qs[_0x43df('0x37')](_0x16802c[_0x43df('0x33')][_0x43df('0x37')]));_0x233989[_0x43df('0x35')]=_0x233989[_0x43df('0x35')][_0x43df('0x45')]?_0x233989[_0x43df('0x35')]:_0x309057[_0x43df('0x32')];if(_0x16802c[_0x43df('0x33')][_0x43df('0x40')]){_0x233989['include']=[{'all':!![]}];}_0x233989=_[_0x43df('0x46')]({},_0x233989,_0x16802c['options']);return db[_0x43df('0x2d')][_0x43df('0x47')](_0x233989)['then'](handleEntityNotFound(_0x2d8f6b,null))[_0x43df('0x26')](respondWithResult(_0x2d8f6b,null))['catch'](handleError(_0x2d8f6b,null));};exports[_0x43df('0x48')]=function(_0x5f323b,_0x258ae7){return db[_0x43df('0x2d')][_0x43df('0x48')](_0x5f323b[_0x43df('0x49')],{})['then'](function(_0xd9cba6){var _0x10d596=_0x5f323b[_0x43df('0x4a')]['get']({'plain':!![]});if(!_0x10d596)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10d596[_0x43df('0x4b')]===_0x43df('0x4a')){var _0x35b1c2=_0xd9cba6['get']({'plain':!![]});var _0x352feb=_0x43df('0x24');return db[_0x43df('0x4c')][_0x43df('0x47')]({'where':{'name':_0x352feb,'userProfileId':_0x10d596[_0x43df('0x4d')]},'raw':!![]})[_0x43df('0x26')](function(_0x2cf198){if(_0x2cf198&&_0x2cf198[_0x43df('0x4e')]===0x0){return db[_0x43df('0x25')]['create']({'name':_0x35b1c2[_0x43df('0x2a')],'resourceId':_0x35b1c2['id'],'type':_0x2cf198[_0x43df('0x2a')],'sectionId':_0x2cf198['id']},{})[_0x43df('0x26')](function(){return _0xd9cba6;});}else{return _0xd9cba6;}})[_0x43df('0x43')](function(_0x5c87fc){logger[_0x43df('0x28')](_0x43df('0x4f'),_0x5c87fc);throw _0x5c87fc;});}return _0xd9cba6;})[_0x43df('0x26')](respondWithResult(_0x258ae7,0xc9))[_0x43df('0x43')](handleError(_0x258ae7,null));};exports[_0x43df('0x21')]=function(_0x1bfbc5,_0x576079){if(_0x1bfbc5[_0x43df('0x49')]['id']){delete _0x1bfbc5[_0x43df('0x49')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x1bfbc5['params']['id']}})['then'](handleEntityNotFound(_0x576079,null))[_0x43df('0x26')](saveUpdates(_0x1bfbc5[_0x43df('0x49')],null))['then'](respondWithResult(_0x576079,null))['catch'](handleError(_0x576079,null));};exports['destroy']=function(_0x17bc47,_0x23cedf){return db[_0x43df('0x2d')]['find']({'where':{'id':_0x17bc47[_0x43df('0x44')]['id']}})['then'](handleEntityNotFound(_0x23cedf,null))[_0x43df('0x26')](removeEntity(_0x23cedf,null))['catch'](handleError(_0x23cedf,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index db2bf89..4b04a9b 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 _0xdee7=['Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','models','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','Set','format','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','auth'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xdee7,0x125));var _0x7dee=function(_0x2b5c25,_0x47f3e0){_0x2b5c25=_0x2b5c25-0x0;var _0x45878a=_0xdee7[_0x2b5c25];return _0x45878a;};'use strict';var _=require(_0x7dee('0x0'));var util=require(_0x7dee('0x1'));var BPromise=require(_0x7dee('0x2'));var attributes=require(_0x7dee('0x3'));var getUserApplications=function(_0x9392ba,_0x7a45f4,_0xc3c3ff){var _0x2298f3=0x1;var _0x18c5a6=[];var _0x5205f3={'context':_0x7a45f4[_0x7dee('0x4')]||_0x7dee('0x5'),'exten':util['format'](_0x7dee('0x6'),_0x9392ba[_0x7dee('0x7')],_0xc3c3ff),'type':_0x7dee('0x8'),'isApp':![],'ChanSpyId':_0x9392ba['id'],'UserId':_0x7a45f4['id']};_0x18c5a6[_0x7dee('0x9')](_['merge']({'app':_0x7dee('0xa'),'appdata':util[_0x7dee('0xb')](_0x7dee('0xc'),_0x7dee('0xd')),'priority':_0x2298f3++},_0x5205f3));if(_0x9392ba[_0x7dee('0xe')]){_0x18c5a6['push'](_[_0x7dee('0xf')]({'app':_0x7dee('0x10'),'appdata':util[_0x7dee('0xb')](_0x7dee('0x11'),_0x9392ba['recordingFormat']),'priority':_0x2298f3++},_0x5205f3));}if(_0x9392ba[_0x7dee('0x12')]){_0x18c5a6[_0x7dee('0x9')](_[_0x7dee('0xf')]({'app':_0x7dee('0x13'),'appdata':_0x9392ba[_0x7dee('0x14')],'priority':_0x2298f3++},_0x5205f3));}_0x18c5a6[_0x7dee('0x9')](_[_0x7dee('0xf')]({'app':_0x7dee('0x15'),'appdata':util['format'](_0x7dee('0x16'),_0x7a45f4[_0x7dee('0x17')],_0x9392ba['options']?_0x9392ba[_0x7dee('0x18')][_0x7dee('0x19')](''):''),'priority':_0x2298f3++},_0x5205f3));if(_0x9392ba[_0x7dee('0xe')]){_0x18c5a6[_0x7dee('0x9')](_['merge']({'app':_0x7dee('0x1a'),'priority':_0x2298f3++},_0x5205f3));}return _0x18c5a6;};var getChanSpyApplications=function(_0x590436,_0x3dbde2){var _0x3c301e=[];for(var _0x311ed4=0x0,_0x1cb7e3=0x1;_0x311ed4<_0x3dbde2[_0x7dee('0x1b')];_0x311ed4++,_0x1cb7e3=0x1){_0x3c301e=_0x3c301e[_0x7dee('0x1c')](getUserApplications(_0x590436,_0x3dbde2[_0x311ed4],_0x3dbde2[_0x311ed4][_0x7dee('0x1d')]));if(_0x3dbde2[_0x311ed4][_0x7dee('0x1d')]!=_0x3dbde2[_0x311ed4][_0x7dee('0x17')]){_0x3c301e=_0x3c301e[_0x7dee('0x1c')](getUserApplications(_0x590436,_0x3dbde2[_0x311ed4],_0x3dbde2[_0x311ed4][_0x7dee('0x17')]));}}return _0x3c301e;};var getChanSpyPromise=function(_0x45d9e0,_0x5abae7){return new BPromise(function(_0x1bc75f,_0x2ef3d0){return _0x45d9e0['User'][_0x7dee('0x1e')]({'attributes':['id',_0x7dee('0x17'),_0x7dee('0x1d')],'where':{'role':_0x7dee('0x1f'),'chanspy':!![]},'raw':!![]})[_0x7dee('0x20')](function(_0x153a90){if(_0x153a90){return _0x1bc75f(getChanSpyApplications(_0x5abae7,_0x153a90));}return _0x1bc75f([]);})[_0x7dee('0x21')](function(_0x266e24){_0x2ef3d0(_0x266e24);});});};module['exports']=function(_0x2784d7,_0x4a7d92){var _0x3150fd=_0x2784d7[_0x7dee('0x22')];return _0x2784d7['define'](_0x7dee('0x23'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc65101,_0x13a1b3,_0x19f453){return getChanSpyPromise(_0x3150fd,_0xc65101)[_0x7dee('0x20')](function(_0x500457){if(_0x500457&&_0x500457[_0x7dee('0x1b')]){return _0x3150fd[_0x7dee('0x24')][_0x7dee('0x25')](_0x500457);}})[_0x7dee('0x20')](function(){_0x19f453();})[_0x7dee('0x21')](function(_0x36ae18){_0x19f453(_0x36ae18);});},'afterUpdate':function(_0x33485c,_0x3ea087,_0x3309be){return _0x3150fd[_0x7dee('0x24')][_0x7dee('0x26')]({'where':{'ChanSpyId':_0x33485c['id']}})[_0x7dee('0x20')](function(){return getChanSpyPromise(_0x3150fd,_0x33485c);})[_0x7dee('0x20')](function(_0x362012){if(_0x362012&&_0x362012[_0x7dee('0x1b')]){return _0x3150fd[_0x7dee('0x24')]['bulkCreate'](_0x362012);}})[_0x7dee('0x20')](function(){_0x3309be();})[_0x7dee('0x21')](function(_0xadb74){_0x3309be(_0xadb74);});},'afterDestroy':function(_0x69568e,_0x81c11d,_0xfce9ef){return _0x3150fd[_0x7dee('0x24')]['destroy']({'where':{'ChanSpyId':_0x69568e['id']}})[_0x7dee('0x20')](function(){_0xfce9ef();})['catch'](function(_0x37f098){_0xfce9ef(_0x37f098);});}}});}; \ No newline at end of file +var _0x355f=['name','User','agent','then','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','context','format','prefix','system','CDR(type)=%s','push','MixMonitor','${UNIQUEID}.%s,a','auth','merge','Authenticate','password','ChanSpy','SIP/%s,%s','join','record','StopMixMonitor','length','internal','concat'];(function(_0x2aeded,_0x485860){var _0x58fdaa=function(_0x4e4a88){while(--_0x4e4a88){_0x2aeded['push'](_0x2aeded['shift']());}};_0x58fdaa(++_0x485860);}(_0x355f,0x93));var _0xf355=function(_0x3b2779,_0x2a7352){_0x3b2779=_0x3b2779-0x0;var _0x2dc967=_0x355f[_0x3b2779];return _0x2dc967;};'use strict';var _=require(_0xf355('0x0'));var util=require(_0xf355('0x1'));var BPromise=require(_0xf355('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x4ecd35,_0x546e19,_0x344f5b){var _0x206d95=0x1;var _0x47d63c=[];var _0x295263={'context':_0x546e19[_0xf355('0x3')]||'from-sip','exten':util[_0xf355('0x4')]('%s%s',_0x4ecd35[_0xf355('0x5')],_0x344f5b),'type':_0xf355('0x6'),'isApp':![],'ChanSpyId':_0x4ecd35['id'],'UserId':_0x546e19['id']};_0x47d63c['push'](_['merge']({'app':'Set','appdata':util[_0xf355('0x4')](_0xf355('0x7'),'chanspy'),'priority':_0x206d95++},_0x295263));if(_0x4ecd35['record']){_0x47d63c[_0xf355('0x8')](_['merge']({'app':_0xf355('0x9'),'appdata':util[_0xf355('0x4')](_0xf355('0xa'),_0x4ecd35['recordingFormat']),'priority':_0x206d95++},_0x295263));}if(_0x4ecd35[_0xf355('0xb')]){_0x47d63c['push'](_[_0xf355('0xc')]({'app':_0xf355('0xd'),'appdata':_0x4ecd35[_0xf355('0xe')],'priority':_0x206d95++},_0x295263));}_0x47d63c[_0xf355('0x8')](_[_0xf355('0xc')]({'app':_0xf355('0xf'),'appdata':util[_0xf355('0x4')](_0xf355('0x10'),_0x546e19['name'],_0x4ecd35['options']?_0x4ecd35['options'][_0xf355('0x11')](''):''),'priority':_0x206d95++},_0x295263));if(_0x4ecd35[_0xf355('0x12')]){_0x47d63c['push'](_[_0xf355('0xc')]({'app':_0xf355('0x13'),'priority':_0x206d95++},_0x295263));}return _0x47d63c;};var getChanSpyApplications=function(_0x788cd1,_0x2db89c){var _0xe9cb2=[];for(var _0x1e8cab=0x0,_0x335f48=0x1;_0x1e8cab<_0x2db89c[_0xf355('0x14')];_0x1e8cab++,_0x335f48=0x1){_0xe9cb2=_0xe9cb2['concat'](getUserApplications(_0x788cd1,_0x2db89c[_0x1e8cab],_0x2db89c[_0x1e8cab][_0xf355('0x15')]));if(_0x2db89c[_0x1e8cab][_0xf355('0x15')]!=_0x2db89c[_0x1e8cab]['name']){_0xe9cb2=_0xe9cb2[_0xf355('0x16')](getUserApplications(_0x788cd1,_0x2db89c[_0x1e8cab],_0x2db89c[_0x1e8cab][_0xf355('0x17')]));}}return _0xe9cb2;};var getChanSpyPromise=function(_0x334b9f,_0x30df7d){return new BPromise(function(_0x25a18f,_0x3196b7){return _0x334b9f[_0xf355('0x18')]['findAll']({'attributes':['id',_0xf355('0x17'),_0xf355('0x15')],'where':{'role':_0xf355('0x19'),'chanspy':!![]},'raw':!![]})[_0xf355('0x1a')](function(_0x188c89){if(_0x188c89){return _0x25a18f(getChanSpyApplications(_0x30df7d,_0x188c89));}return _0x25a18f([]);})['catch'](function(_0x149444){_0x3196b7(_0x149444);});});};module['exports']=function(_0x1ee08c,_0x2a1c57){var _0x372ebe=_0x1ee08c['models'];return _0x1ee08c[_0xf355('0x1b')](_0xf355('0x1c'),attributes,{'tableName':_0xf355('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c0b77,_0x2b4134,_0x3a3511){return getChanSpyPromise(_0x372ebe,_0x3c0b77)[_0xf355('0x1a')](function(_0x2a35e5){if(_0x2a35e5&&_0x2a35e5[_0xf355('0x14')]){return _0x372ebe[_0xf355('0x1e')][_0xf355('0x1f')](_0x2a35e5);}})['then'](function(){_0x3a3511();})['catch'](function(_0x45de9f){_0x3a3511(_0x45de9f);});},'afterUpdate':function(_0x409f5e,_0x2665b2,_0x470459){return _0x372ebe[_0xf355('0x1e')]['destroy']({'where':{'ChanSpyId':_0x409f5e['id']}})[_0xf355('0x1a')](function(){return getChanSpyPromise(_0x372ebe,_0x409f5e);})[_0xf355('0x1a')](function(_0x31b411){if(_0x31b411&&_0x31b411[_0xf355('0x14')]){return _0x372ebe[_0xf355('0x1e')]['bulkCreate'](_0x31b411);}})[_0xf355('0x1a')](function(){_0x470459();})[_0xf355('0x20')](function(_0x9992f0){_0x470459(_0x9992f0);});},'afterDestroy':function(_0x3e1c39,_0x35cb5,_0x2023a8){return _0x372ebe[_0xf355('0x1e')][_0xf355('0x21')]({'where':{'ChanSpyId':_0x3e1c39['id']}})[_0xf355('0x1a')](function(){_0x2023a8();})[_0xf355('0x20')](function(_0x56a682){_0x2023a8(_0x56a682);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index fd976c8..ebd858b 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 _0x6b24=['client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x6b24,0x1ce));var _0x46b2=function(_0x58c053,_0x51c43f){_0x58c053=_0x58c053-0x0;var _0xe1079=_0x6b24[_0x58c053];return _0xe1079;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var moment=require(_0x46b2('0x1'));var BPromise=require(_0x46b2('0x2'));var rs=require(_0x46b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x46b2('0x4'))('rpc');var config=require(_0x46b2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x46b2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512905,_0x326eb7,_0x233ccf){return new BPromise(function(_0x1f81b8,_0x1531c){return client[_0x46b2('0x7')](_0x512905,_0x233ccf)[_0x46b2('0x8')](function(_0x3144df){logger[_0x46b2('0x9')](_0x46b2('0xa'),_0x326eb7,'request\x20sent');logger['debug'](_0x46b2('0xb'),_0x326eb7,_0x46b2('0xc'),JSON[_0x46b2('0xd')](_0x3144df));if(_0x3144df['error']){if(_0x3144df[_0x46b2('0xe')][_0x46b2('0xf')]===0x1f4){logger[_0x46b2('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x326eb7,_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);return _0x1531c(_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);}logger[_0x46b2('0xe')](_0x46b2('0xa'),_0x326eb7,_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);return _0x1f81b8(_0x3144df[_0x46b2('0xe')][_0x46b2('0x10')]);}else{logger['info'](_0x46b2('0xa'),_0x326eb7,_0x46b2('0xc'));_0x1f81b8(_0x3144df['result'][_0x46b2('0x10')]);}})[_0x46b2('0x11')](function(_0xe3d3d9){logger[_0x46b2('0xe')](_0x46b2('0xa'),_0x326eb7,_0xe3d3d9);_0x1531c(_0xe3d3d9);});});} \ No newline at end of file +var _0x6ae2=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x54864a,_0x13f772){_0x54864a=_0x54864a-0x0;var _0x506e29=_0x6ae2[_0x54864a];return _0x506e29;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var moment=require(_0x26ae('0x2'));var BPromise=require(_0x26ae('0x3'));var rs=require(_0x26ae('0x4'));var fs=require('fs');var Redis=require(_0x26ae('0x5'));var db=require(_0x26ae('0x6'))['db'];var utils=require(_0x26ae('0x7'));var logger=require(_0x26ae('0x8'))('rpc');var config=require(_0x26ae('0x9'));var jayson=require(_0x26ae('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13cb27,_0xde4226,_0x473907){return new BPromise(function(_0x151de3,_0x3bc9de){return client[_0x26ae('0xb')](_0x13cb27,_0x473907)[_0x26ae('0xc')](function(_0x4b3eca){logger[_0x26ae('0xd')](_0x26ae('0xe'),_0xde4226,_0x26ae('0xf'));logger[_0x26ae('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0xde4226,_0x26ae('0xf'),JSON['stringify'](_0x4b3eca));if(_0x4b3eca[_0x26ae('0x11')]){if(_0x4b3eca['error']['code']===0x1f4){logger[_0x26ae('0x11')](_0x26ae('0xe'),_0xde4226,_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);return _0x3bc9de(_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);}logger[_0x26ae('0x11')](_0x26ae('0xe'),_0xde4226,_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);return _0x151de3(_0x4b3eca[_0x26ae('0x11')][_0x26ae('0x12')]);}else{logger['info'](_0x26ae('0xe'),_0xde4226,_0x26ae('0xf'));_0x151de3(_0x4b3eca['result'][_0x26ae('0x12')]);}})[_0x26ae('0x13')](function(_0x4f71d8){logger[_0x26ae('0x11')](_0x26ae('0xe'),_0xde4226,_0x4f71d8);_0x3bc9de(_0x4f71d8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b2593a3..edc223e 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 _0xb799=['isAuthenticated','show','put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./voiceContext.controller','index','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb799,0x1c6));var _0x9b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb799[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9b79('0x0'));var path=require(_0x9b79('0x1'));var timeout=require(_0x9b79('0x2'));var express=require(_0x9b79('0x3'));var router=express[_0x9b79('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9b79('0x5'));var controller=require(_0x9b79('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b79('0x7')]);router[_0x9b79('0x8')](_0x9b79('0x9'),auth[_0x9b79('0xa')](),controller[_0x9b79('0xb')]);router['post']('/',auth[_0x9b79('0xa')](),controller['create']);router[_0x9b79('0xc')](_0x9b79('0x9'),auth[_0x9b79('0xa')](),controller[_0x9b79('0xd')]);router[_0x9b79('0xe')](_0x9b79('0x9'),auth[_0x9b79('0xa')](),controller['destroy']);module[_0x9b79('0xf')]=router; \ No newline at end of file +var _0x6f59=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x2ea183,_0x3cff11){var _0x47c16c=function(_0x3d91e5){while(--_0x3d91e5){_0x2ea183['push'](_0x2ea183['shift']());}};_0x47c16c(++_0x3cff11);}(_0x6f59,0x168));var _0x96f5=function(_0x2ac301,_0x39484f){_0x2ac301=_0x2ac301-0x0;var _0x286d45=_0x6f59[_0x2ac301];return _0x286d45;};'use strict';var multer=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var path=require('path');var timeout=require(_0x96f5('0x2'));var express=require('express');var router=express[_0x96f5('0x3')]();var fs_extra=require(_0x96f5('0x4'));var auth=require(_0x96f5('0x5'));var interaction=require(_0x96f5('0x6'));var config=require(_0x96f5('0x7'));var controller=require(_0x96f5('0x8'));router[_0x96f5('0x9')]('/',auth[_0x96f5('0xa')](),controller[_0x96f5('0xb')]);router[_0x96f5('0x9')](_0x96f5('0xc'),auth[_0x96f5('0xa')](),controller[_0x96f5('0xd')]);router[_0x96f5('0xe')]('/',auth['isAuthenticated'](),controller[_0x96f5('0xf')]);router[_0x96f5('0x10')](_0x96f5('0xc'),auth[_0x96f5('0xa')](),controller[_0x96f5('0x11')]);router[_0x96f5('0x12')](_0x96f5('0xc'),auth[_0x96f5('0xa')](),controller[_0x96f5('0x13')]);module[_0x96f5('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 29fdfa4..5b31085 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 _0x4c62=['sequelize','exports','name'];(function(_0x43c492,_0xffa620){var _0x168a62=function(_0x4f6204){while(--_0x4f6204){_0x43c492['push'](_0x43c492['shift']());}};_0x168a62(++_0xffa620);}(_0x4c62,0x177));var _0x24c6=function(_0x5a1a16,_0x345725){_0x5a1a16=_0x5a1a16-0x0;var _0x2da3cc=_0x4c62[_0x5a1a16];return _0x2da3cc;};'use strict';var Sequelize=require(_0x24c6('0x0'));module[_0x24c6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x24c6('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4050=['STRING','name','sequelize','exports'];(function(_0x59d9ed,_0x8e8cd4){var _0x26bce8=function(_0x1b0aba){while(--_0x1b0aba){_0x59d9ed['push'](_0x59d9ed['shift']());}};_0x26bce8(++_0x8e8cd4);}(_0x4050,0x1be));var _0x0405=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x4050[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x0405('0x0'));module[_0x0405('0x1')]={'name':{'type':Sequelize[_0x0405('0x2')],'unique':_0x0405('0x3')},'description':{'type':Sequelize['STRING'],'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 b6957ca..3eb9036 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 _0x846e=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','offset','limit','undefined','count','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','send','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','options','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0x846e,0x1eb));var _0xe846=function(_0x4d12ec,_0x5af936){_0x4d12ec=_0x4d12ec-0x0;var _0xcda1a8=_0x846e[_0x4d12ec];return _0xcda1a8;};'use strict';var emlformat=require(_0xe846('0x0'));var rimraf=require(_0xe846('0x1'));var zipdir=require(_0xe846('0x2'));var jsonpatch=require(_0xe846('0x3'));var rp=require(_0xe846('0x4'));var moment=require(_0xe846('0x5'));var BPromise=require(_0xe846('0x6'));var Mustache=require(_0xe846('0x7'));var util=require(_0xe846('0x8'));var path=require(_0xe846('0x9'));var sox=require(_0xe846('0xa'));var csv=require(_0xe846('0xb'));var ejs=require(_0xe846('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe846('0xd'));var crypto=require('crypto');var jsforce=require(_0xe846('0xe'));var deskjs=require(_0xe846('0xf'));var toCsv=require(_0xe846('0xb'));var querystring=require('querystring');var Papa=require(_0xe846('0x10'));var Redis=require(_0xe846('0x11'));var authService=require(_0xe846('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe846('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe846('0x14'))(_0xe846('0x15'));var utils=require(_0xe846('0x16'));var config=require(_0xe846('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe846('0x18'))['db'];var jayson=require(_0xe846('0x19'));var client=jayson['client'][_0xe846('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x442492,_0xe8020e,_0x4dfcc8,_0x5d492c){return new BPromise(function(_0x18a727,_0x2e55c5){var _0x39e1ec=_0x5d492c||client;return _0x39e1ec['request'](_0x442492,_0x4dfcc8)[_0xe846('0x1b')](function(_0x18c15d){logger[_0xe846('0x1c')](_0xe846('0x1d'),_0xe8020e,_0xe846('0x1e'));logger[_0xe846('0x1f')](_0xe846('0x20'),_0xe8020e,'request\x20sent',JSON['stringify'](_0x18c15d));if(_0x18c15d['error']){if(_0x18c15d['error']['code']===0x1f4){logger[_0xe846('0x21')]('VoiceContext,\x20%s,\x20%s',_0xe8020e,_0x18c15d[_0xe846('0x21')][_0xe846('0x22')]);return _0x2e55c5(_0x18c15d[_0xe846('0x21')][_0xe846('0x22')]);}logger['error'](_0xe846('0x1d'),_0xe8020e,_0x18c15d[_0xe846('0x21')][_0xe846('0x22')]);return _0x18a727(_0x18c15d[_0xe846('0x21')][_0xe846('0x22')]);}else{logger[_0xe846('0x1c')](_0xe846('0x1d'),_0xe8020e,_0xe846('0x1e'));_0x18a727(_0x18c15d[_0xe846('0x23')][_0xe846('0x22')]);}})['catch'](function(_0x5db390){logger[_0xe846('0x21')](_0xe846('0x1d'),_0xe8020e,_0x5db390);_0x2e55c5(_0x5db390);});});}function respondWithStatusCode(_0x3a1698,_0xa4941c){_0xa4941c=_0xa4941c||0xcc;return function(_0x3c7c0b){if(_0x3c7c0b){return _0x3a1698[_0xe846('0x24')](_0xa4941c);}return _0x3a1698[_0xe846('0x25')](_0xa4941c)[_0xe846('0x26')]();};}function respondWithResult(_0x532c77,_0x6c3d6d){_0x6c3d6d=_0x6c3d6d||0xc8;return function(_0x252ea5){if(_0x252ea5){return _0x532c77[_0xe846('0x25')](_0x6c3d6d)['json'](_0x252ea5);}};}function respondWithFilteredResult(_0xbc563f,_0x5cd110){return function(_0x31375c){if(_0x31375c){var _0xb64659=typeof _0x5cd110[_0xe846('0x27')]==='undefined'&&typeof _0x5cd110[_0xe846('0x28')]===_0xe846('0x29');var _0x40b3b4=_0x31375c[_0xe846('0x2a')];var _0x4ee051=_0xb64659?0x0:_0x5cd110['offset'];var _0x2132d2=_0xb64659?_0x31375c[_0xe846('0x2a')]:_0x5cd110[_0xe846('0x27')]+_0x5cd110[_0xe846('0x28')];var _0x33a4c4;if(_0x2132d2>=_0x40b3b4){_0x2132d2=_0x40b3b4;_0x33a4c4=0xc8;}else{_0x33a4c4=0xce;}_0xbc563f[_0xe846('0x25')](_0x33a4c4);return _0xbc563f['set']('Content-Range',_0x4ee051+'-'+_0x2132d2+'/'+_0x40b3b4)['json'](_0x31375c);}return null;};}function patchUpdates(_0x33ca0f){return function(_0x54668b){try{jsonpatch[_0xe846('0x2b')](_0x54668b,_0x33ca0f,!![]);}catch(_0x138666){return BPromise[_0xe846('0x2c')](_0x138666);}return _0x54668b[_0xe846('0x2d')]();};}function saveUpdates(_0x5579a5,_0x3dee08){return function(_0x3c3cb7){if(_0x3c3cb7){return _0x3c3cb7[_0xe846('0x2e')](_0x5579a5)[_0xe846('0x1b')](function(_0x3b3be3){return _0x3b3be3;});}return null;};}function removeEntity(_0x3208fc,_0x3246ff){return function(_0x2262a8){if(_0x2262a8){return _0x2262a8['destroy']()['then'](function(){var _0x49f383=_0x2262a8[_0xe846('0x2f')]({'plain':!![]});var _0x2ea3e7=_0xe846('0x30');return db[_0xe846('0x31')][_0xe846('0x32')]({'where':{'type':_0x2ea3e7,'resourceId':_0x49f383['id']}})[_0xe846('0x1b')](function(){return _0x2262a8;});})[_0xe846('0x1b')](function(){_0x3208fc[_0xe846('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3164d7,_0x5dd180){return function(_0x297aab){if(!_0x297aab){_0x3164d7[_0xe846('0x24')](0x194);}return _0x297aab;};}function handleError(_0x454539,_0x24fc3b){_0x24fc3b=_0x24fc3b||0x1f4;return function(_0x59e166){logger[_0xe846('0x21')](_0x59e166[_0xe846('0x33')]);if(_0x59e166['name']){delete _0x59e166['name'];}_0x454539[_0xe846('0x25')](_0x24fc3b)[_0xe846('0x34')](_0x59e166);};}exports['index']=function(_0x25fcc7,_0x2a46a1){var _0x396c9f={},_0x55be00={},_0x354b26={'count':0x0,'rows':[]};var _0x4dc768=_[_0xe846('0x35')](db[_0xe846('0x36')][_0xe846('0x37')],function(_0x2ecf29){return{'name':_0x2ecf29['fieldName'],'type':_0x2ecf29[_0xe846('0x38')][_0xe846('0x39')]};});_0x55be00[_0xe846('0x3a')]=_[_0xe846('0x35')](_0x4dc768,'name');_0x55be00[_0xe846('0x3b')]=_[_0xe846('0x3c')](_0x25fcc7[_0xe846('0x3b')]);_0x55be00[_0xe846('0x3d')]=_[_0xe846('0x3e')](_0x55be00['model'],_0x55be00[_0xe846('0x3b')]);_0x396c9f[_0xe846('0x3f')]=_[_0xe846('0x3e')](_0x55be00[_0xe846('0x3a')],qs[_0xe846('0x40')](_0x25fcc7[_0xe846('0x3b')][_0xe846('0x40')]));_0x396c9f[_0xe846('0x3f')]=_0x396c9f[_0xe846('0x3f')][_0xe846('0x41')]?_0x396c9f[_0xe846('0x3f')]:_0x55be00[_0xe846('0x3a')];if(!_0x25fcc7['query']['hasOwnProperty']('nolimit')){_0x396c9f[_0xe846('0x28')]=qs[_0xe846('0x28')](_0x25fcc7[_0xe846('0x3b')]['limit']);_0x396c9f[_0xe846('0x27')]=qs[_0xe846('0x27')](_0x25fcc7[_0xe846('0x3b')][_0xe846('0x27')]);}_0x396c9f['order']=qs['sort'](_0x25fcc7[_0xe846('0x3b')][_0xe846('0x42')]);_0x396c9f[_0xe846('0x43')]=qs[_0xe846('0x3d')](_['pick'](_0x25fcc7[_0xe846('0x3b')],_0x55be00['filters']),_0x4dc768);if(_0x25fcc7['query']['filter']){_0x396c9f['where']=_[_0xe846('0x44')](_0x396c9f[_0xe846('0x43')],{'$or':_[_0xe846('0x35')](_0x4dc768,function(_0x53155e){if(_0x53155e[_0xe846('0x38')]!==_0xe846('0x45')){var _0x2eaeeb={};_0x2eaeeb[_0x53155e['name']]={'$like':'%'+_0x25fcc7[_0xe846('0x3b')][_0xe846('0x46')]+'%'};return _0x2eaeeb;}})});}_0x396c9f=_['merge']({},_0x396c9f,_0x25fcc7['options']);var _0xde0552={'where':_0x396c9f[_0xe846('0x43')]};return db[_0xe846('0x36')]['count'](_0xde0552)['then'](function(_0xb0db21){_0x354b26['count']=_0xb0db21;if(_0x25fcc7[_0xe846('0x3b')][_0xe846('0x47')]){_0x396c9f[_0xe846('0x48')]=[{'all':!![]}];}return db[_0xe846('0x36')][_0xe846('0x49')](_0x396c9f);})['then'](function(_0x8d2a83){_0x354b26['rows']=_0x8d2a83;return _0x354b26;})[_0xe846('0x1b')](respondWithFilteredResult(_0x2a46a1,_0x396c9f))['catch'](handleError(_0x2a46a1,null));};exports[_0xe846('0x4a')]=function(_0x79a68,_0x28cea7){var _0x59b7df={'raw':![],'where':{'id':_0x79a68[_0xe846('0x4b')]['id']}},_0x45fd19={};_0x45fd19[_0xe846('0x3a')]=_[_0xe846('0x3c')](db[_0xe846('0x36')][_0xe846('0x37')]);_0x45fd19[_0xe846('0x3b')]=_['keys'](_0x79a68[_0xe846('0x3b')]);_0x45fd19[_0xe846('0x3d')]=_[_0xe846('0x3e')](_0x45fd19[_0xe846('0x3a')],_0x45fd19[_0xe846('0x3b')]);_0x59b7df[_0xe846('0x3f')]=_[_0xe846('0x3e')](_0x45fd19[_0xe846('0x3a')],qs['fields'](_0x79a68[_0xe846('0x3b')][_0xe846('0x40')]));_0x59b7df['attributes']=_0x59b7df[_0xe846('0x3f')]['length']?_0x59b7df['attributes']:_0x45fd19[_0xe846('0x3a')];if(_0x79a68['query']['includeAll']){_0x59b7df[_0xe846('0x48')]=[{'all':!![]}];}_0x59b7df=_['merge']({},_0x59b7df,_0x79a68[_0xe846('0x4c')]);return db[_0xe846('0x36')][_0xe846('0x4d')](_0x59b7df)[_0xe846('0x1b')](handleEntityNotFound(_0x28cea7,null))[_0xe846('0x1b')](respondWithResult(_0x28cea7,null))['catch'](handleError(_0x28cea7,null));};exports[_0xe846('0x4e')]=function(_0x98fe73,_0x1da5f1,_0x190b63){var _0x240944;return db[_0xe846('0x36')]['create'](_0x98fe73['body'],{'raw':!![]})[_0xe846('0x1b')](function(_0x1e57c1){_0x240944=_0x1e57c1;return db[_0xe846('0x36')]['findAll']({'raw':!![]});})[_0xe846('0x1b')](function(_0x380110){var _0x2ab3a5=fs[_0xe846('0x4f')](path[_0xe846('0x50')](config[_0xe846('0x51')],_0xe846('0x52')),_0xe846('0x53'));var _0x16a157=ejs[_0xe846('0x54')](_0x2ab3a5,{'contexts':_0x380110||[]});fs[_0xe846('0x55')](_0xe846('0x56'),_0x16a157);})[_0xe846('0x1b')](function(){return respondWithRpcPromise(_0xe846('0x57'),_0xe846('0x4e'),{'module':_0xe846('0x58')});})['then'](function(){var _0x329589=_0x98fe73[_0xe846('0x59')]['get']({'plain':!![]});if(!_0x329589)throw new Error(_0xe846('0x5a'));if(_0x329589[_0xe846('0x5b')]===_0xe846('0x59')){var _0x4ca731=_0x240944[_0xe846('0x2f')]({'plain':!![]});return db[_0xe846('0x5c')][_0xe846('0x4d')]({'where':{'name':_0xe846('0x30'),'userProfileId':_0x329589[_0xe846('0x5d')]},'raw':!![]})['then'](function(_0xc0bd07){if(_0xc0bd07&&_0xc0bd07['autoAssociation']===0x0){return db['UserProfileResource'][_0xe846('0x4e')]({'name':_0x4ca731[_0xe846('0x5e')],'resourceId':_0x4ca731['id'],'type':_0xc0bd07[_0xe846('0x5e')],'sectionId':_0xc0bd07['id']},{})['then'](function(){return _0x240944;});}else{return _0x240944;}})[_0xe846('0x5f')](function(_0x78b5e1){logger[_0xe846('0x21')](_0xe846('0x60'),_0x78b5e1);throw _0x78b5e1;});}return _0x240944;})[_0xe846('0x1b')](respondWithResult(_0x1da5f1,0xc9))['catch'](handleError(_0x1da5f1,null));};exports[_0xe846('0x2e')]=function(_0x339be5,_0x305698,_0x1b6041){var _0x520130;return db[_0xe846('0x36')][_0xe846('0x4d')]({'where':{'id':_0x339be5[_0xe846('0x4b')]['id']}})[_0xe846('0x1b')](handleEntityNotFound(_0x305698,null))[_0xe846('0x1b')](saveUpdates(_0x339be5[_0xe846('0x61')],null))[_0xe846('0x1b')](function(_0x358c0c){if(_0x358c0c){_0x520130=_0x358c0c;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0xe846('0x1b')](function(_0x3e20dd){var _0x3737f7=fs[_0xe846('0x4f')](path[_0xe846('0x50')](config[_0xe846('0x51')],'server/files/templates/context.ejs'),_0xe846('0x53'));var _0x4378c9=ejs[_0xe846('0x54')](_0x3737f7,{'contexts':_0x3e20dd||[]});fs['writeFileSync'](_0xe846('0x56'),_0x4378c9);})[_0xe846('0x1b')](function(){return respondWithRpcPromise('Reload',_0xe846('0x2e'),{'module':_0xe846('0x58')});})['then'](function(){return _0x520130;})[_0xe846('0x1b')](respondWithResult(_0x305698,null))['catch'](handleError(_0x305698,null));};exports[_0xe846('0x32')]=function(_0x3bd162,_0x256967,_0x1eb366){var _0x5a085a;return db[_0xe846('0x36')][_0xe846('0x4d')]({'where':{'id':_0x3bd162[_0xe846('0x4b')]['id']}})[_0xe846('0x1b')](handleEntityNotFound(_0x256967,null))['then'](removeEntity(_0x256967,null))[_0xe846('0x1b')](function(){return db[_0xe846('0x36')][_0xe846('0x49')]({'raw':!![]});})[_0xe846('0x1b')](function(_0x53abd7){var _0x5af0a8=fs[_0xe846('0x4f')](path['join'](config[_0xe846('0x51')],_0xe846('0x52')),_0xe846('0x53'));var _0xb41030=ejs[_0xe846('0x54')](_0x5af0a8,{'contexts':_0x53abd7});fs[_0xe846('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xb41030);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});})[_0xe846('0x5f')](handleError(_0x256967,null));}; \ No newline at end of file +var _0xb516=['render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','get','Contexts','UserProfileResource','destroy','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','merge','create','join','root','server/files/templates/context.ejs','utf8'];(function(_0x221a6f,_0x1674c8){var _0x3db53d=function(_0x4706a6){while(--_0x4706a6){_0x221a6f['push'](_0x221a6f['shift']());}};_0x3db53d(++_0x1674c8);}(_0xb516,0x14d));var _0x6b51=function(_0x310648,_0x166d5c){_0x310648=_0x310648-0x0;var _0x98e886=_0xb516[_0x310648];return _0x98e886;};'use strict';var emlformat=require(_0x6b51('0x0'));var rimraf=require(_0x6b51('0x1'));var zipdir=require(_0x6b51('0x2'));var jsonpatch=require(_0x6b51('0x3'));var rp=require(_0x6b51('0x4'));var moment=require(_0x6b51('0x5'));var BPromise=require(_0x6b51('0x6'));var Mustache=require(_0x6b51('0x7'));var util=require(_0x6b51('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6b51('0x9'));var fs=require('fs');var fs_extra=require(_0x6b51('0xa'));var _=require(_0x6b51('0xb'));var squel=require('squel');var crypto=require(_0x6b51('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6b51('0xd'));var toCsv=require(_0x6b51('0xe'));var querystring=require('querystring');var Papa=require(_0x6b51('0xf'));var Redis=require(_0x6b51('0x10'));var authService=require(_0x6b51('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6b51('0x12'));var hardwareService=require(_0x6b51('0x13'));var logger=require('../../config/logger')(_0x6b51('0x14'));var utils=require(_0x6b51('0x15'));var config=require(_0x6b51('0x16'));var licenseUtil=require(_0x6b51('0x17'));var db=require(_0x6b51('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6b51('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f5f6e,_0x5002ed,_0x298656,_0x29734a){return new BPromise(function(_0x2f57cb,_0x319dbe){var _0x551943=_0x29734a||client;return _0x551943[_0x6b51('0x1a')](_0x3f5f6e,_0x298656)[_0x6b51('0x1b')](function(_0x518539){logger[_0x6b51('0x1c')](_0x6b51('0x1d'),_0x5002ed,_0x6b51('0x1e'));logger[_0x6b51('0x1f')](_0x6b51('0x20'),_0x5002ed,'request\x20sent',JSON[_0x6b51('0x21')](_0x518539));if(_0x518539[_0x6b51('0x22')]){if(_0x518539[_0x6b51('0x22')][_0x6b51('0x23')]===0x1f4){logger[_0x6b51('0x22')](_0x6b51('0x1d'),_0x5002ed,_0x518539[_0x6b51('0x22')][_0x6b51('0x24')]);return _0x319dbe(_0x518539['error'][_0x6b51('0x24')]);}logger['error'](_0x6b51('0x1d'),_0x5002ed,_0x518539['error']['message']);return _0x2f57cb(_0x518539[_0x6b51('0x22')][_0x6b51('0x24')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x5002ed,'request\x20sent');_0x2f57cb(_0x518539[_0x6b51('0x25')]['message']);}})['catch'](function(_0x50bc32){logger[_0x6b51('0x22')]('VoiceContext,\x20%s,\x20%s',_0x5002ed,_0x50bc32);_0x319dbe(_0x50bc32);});});}function respondWithStatusCode(_0x4054bb,_0x1d5ff9){_0x1d5ff9=_0x1d5ff9||0xcc;return function(_0x31504b){if(_0x31504b){return _0x4054bb[_0x6b51('0x26')](_0x1d5ff9);}return _0x4054bb['status'](_0x1d5ff9)[_0x6b51('0x27')]();};}function respondWithResult(_0x426ce8,_0x2c08b6){_0x2c08b6=_0x2c08b6||0xc8;return function(_0x4a0254){if(_0x4a0254){return _0x426ce8[_0x6b51('0x28')](_0x2c08b6)[_0x6b51('0x29')](_0x4a0254);}};}function respondWithFilteredResult(_0x19567a,_0x4f0efd){return function(_0x3e77ab){if(_0x3e77ab){var _0x3b9779=typeof _0x4f0efd[_0x6b51('0x2a')]==='undefined'&&typeof _0x4f0efd[_0x6b51('0x2b')]==='undefined';var _0x13b8fe=_0x3e77ab['count'];var _0x477903=_0x3b9779?0x0:_0x4f0efd[_0x6b51('0x2a')];var _0x3903dd=_0x3b9779?_0x3e77ab[_0x6b51('0x2c')]:_0x4f0efd['offset']+_0x4f0efd[_0x6b51('0x2b')];var _0x2b33fa;if(_0x3903dd>=_0x13b8fe){_0x3903dd=_0x13b8fe;_0x2b33fa=0xc8;}else{_0x2b33fa=0xce;}_0x19567a[_0x6b51('0x28')](_0x2b33fa);return _0x19567a[_0x6b51('0x2d')](_0x6b51('0x2e'),_0x477903+'-'+_0x3903dd+'/'+_0x13b8fe)['json'](_0x3e77ab);}return null;};}function patchUpdates(_0x56c902){return function(_0x578593){try{jsonpatch['apply'](_0x578593,_0x56c902,!![]);}catch(_0x57d491){return BPromise[_0x6b51('0x2f')](_0x57d491);}return _0x578593[_0x6b51('0x30')]();};}function saveUpdates(_0x38a33f,_0x3e9bd0){return function(_0x2e5291){if(_0x2e5291){return _0x2e5291[_0x6b51('0x31')](_0x38a33f)[_0x6b51('0x1b')](function(_0x54e961){return _0x54e961;});}return null;};}function removeEntity(_0x48b51e,_0x51f371){return function(_0x3133e6){if(_0x3133e6){return _0x3133e6['destroy']()[_0x6b51('0x1b')](function(){var _0x4d21ac=_0x3133e6[_0x6b51('0x32')]({'plain':!![]});var _0x3d01f3=_0x6b51('0x33');return db[_0x6b51('0x34')][_0x6b51('0x35')]({'where':{'type':_0x3d01f3,'resourceId':_0x4d21ac['id']}})[_0x6b51('0x1b')](function(){return _0x3133e6;});})[_0x6b51('0x1b')](function(){_0x48b51e[_0x6b51('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4453f5,_0x5b5e82){return function(_0x39e273){if(!_0x39e273){_0x4453f5[_0x6b51('0x26')](0x194);}return _0x39e273;};}function handleError(_0x4df769,_0x3a5448){_0x3a5448=_0x3a5448||0x1f4;return function(_0x13bb7d){logger[_0x6b51('0x22')](_0x13bb7d['stack']);if(_0x13bb7d[_0x6b51('0x36')]){delete _0x13bb7d[_0x6b51('0x36')];}_0x4df769['status'](_0x3a5448)['send'](_0x13bb7d);};}exports[_0x6b51('0x37')]=function(_0x15b3ce,_0x31a475){var _0x1537d3={},_0xc18001={},_0x537f47={'count':0x0,'rows':[]};var _0x541acb=_[_0x6b51('0x38')](db[_0x6b51('0x39')][_0x6b51('0x3a')],function(_0x2ab50c){return{'name':_0x2ab50c[_0x6b51('0x3b')],'type':_0x2ab50c[_0x6b51('0x3c')][_0x6b51('0x3d')]};});_0xc18001[_0x6b51('0x3e')]=_['map'](_0x541acb,_0x6b51('0x36'));_0xc18001[_0x6b51('0x3f')]=_[_0x6b51('0x40')](_0x15b3ce['query']);_0xc18001[_0x6b51('0x41')]=_[_0x6b51('0x42')](_0xc18001[_0x6b51('0x3e')],_0xc18001[_0x6b51('0x3f')]);_0x1537d3[_0x6b51('0x43')]=_[_0x6b51('0x42')](_0xc18001['model'],qs[_0x6b51('0x44')](_0x15b3ce[_0x6b51('0x3f')]['fields']));_0x1537d3['attributes']=_0x1537d3[_0x6b51('0x43')][_0x6b51('0x45')]?_0x1537d3[_0x6b51('0x43')]:_0xc18001['model'];if(!_0x15b3ce[_0x6b51('0x3f')][_0x6b51('0x46')](_0x6b51('0x47'))){_0x1537d3[_0x6b51('0x2b')]=qs['limit'](_0x15b3ce[_0x6b51('0x3f')][_0x6b51('0x2b')]);_0x1537d3[_0x6b51('0x2a')]=qs[_0x6b51('0x2a')](_0x15b3ce['query'][_0x6b51('0x2a')]);}_0x1537d3[_0x6b51('0x48')]=qs[_0x6b51('0x49')](_0x15b3ce[_0x6b51('0x3f')]['sort']);_0x1537d3[_0x6b51('0x4a')]=qs['filters'](_[_0x6b51('0x4b')](_0x15b3ce[_0x6b51('0x3f')],_0xc18001['filters']),_0x541acb);if(_0x15b3ce[_0x6b51('0x3f')][_0x6b51('0x4c')]){_0x1537d3[_0x6b51('0x4a')]=_['merge'](_0x1537d3['where'],{'$or':_[_0x6b51('0x38')](_0x541acb,function(_0x25cde8){if(_0x25cde8['type']!==_0x6b51('0x4d')){var _0x487243={};_0x487243[_0x25cde8[_0x6b51('0x36')]]={'$like':'%'+_0x15b3ce[_0x6b51('0x3f')][_0x6b51('0x4c')]+'%'};return _0x487243;}})});}_0x1537d3=_['merge']({},_0x1537d3,_0x15b3ce['options']);var _0x87b4d8={'where':_0x1537d3[_0x6b51('0x4a')]};return db[_0x6b51('0x39')][_0x6b51('0x2c')](_0x87b4d8)[_0x6b51('0x1b')](function(_0xd900b8){_0x537f47[_0x6b51('0x2c')]=_0xd900b8;if(_0x15b3ce[_0x6b51('0x3f')][_0x6b51('0x4e')]){_0x1537d3[_0x6b51('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0x6b51('0x50')](_0x1537d3);})[_0x6b51('0x1b')](function(_0x10bfa3){_0x537f47[_0x6b51('0x51')]=_0x10bfa3;return _0x537f47;})[_0x6b51('0x1b')](respondWithFilteredResult(_0x31a475,_0x1537d3))[_0x6b51('0x52')](handleError(_0x31a475,null));};exports[_0x6b51('0x53')]=function(_0x57238e,_0x509bb0){var _0x493fbf={'raw':![],'where':{'id':_0x57238e[_0x6b51('0x54')]['id']}},_0x3a0636={};_0x3a0636[_0x6b51('0x3e')]=_[_0x6b51('0x40')](db[_0x6b51('0x39')]['rawAttributes']);_0x3a0636[_0x6b51('0x3f')]=_[_0x6b51('0x40')](_0x57238e[_0x6b51('0x3f')]);_0x3a0636['filters']=_[_0x6b51('0x42')](_0x3a0636[_0x6b51('0x3e')],_0x3a0636['query']);_0x493fbf['attributes']=_['intersection'](_0x3a0636[_0x6b51('0x3e')],qs['fields'](_0x57238e[_0x6b51('0x3f')][_0x6b51('0x44')]));_0x493fbf[_0x6b51('0x43')]=_0x493fbf[_0x6b51('0x43')][_0x6b51('0x45')]?_0x493fbf['attributes']:_0x3a0636[_0x6b51('0x3e')];if(_0x57238e['query'][_0x6b51('0x4e')]){_0x493fbf['include']=[{'all':!![]}];}_0x493fbf=_[_0x6b51('0x55')]({},_0x493fbf,_0x57238e['options']);return db[_0x6b51('0x39')]['find'](_0x493fbf)['then'](handleEntityNotFound(_0x509bb0,null))['then'](respondWithResult(_0x509bb0,null))[_0x6b51('0x52')](handleError(_0x509bb0,null));};exports[_0x6b51('0x56')]=function(_0xbef062,_0x594c13,_0x43f26d){var _0xc0d92a;return db[_0x6b51('0x39')]['create'](_0xbef062['body'],{'raw':!![]})['then'](function(_0x37fc1b){_0xc0d92a=_0x37fc1b;return db[_0x6b51('0x39')]['findAll']({'raw':!![]});})[_0x6b51('0x1b')](function(_0x218c06){var _0x47d66f=fs['readFileSync'](path[_0x6b51('0x57')](config[_0x6b51('0x58')],_0x6b51('0x59')),_0x6b51('0x5a'));var _0xf1360b=ejs[_0x6b51('0x5b')](_0x47d66f,{'contexts':_0x218c06||[]});fs[_0x6b51('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xf1360b);})['then'](function(){return respondWithRpcPromise(_0x6b51('0x5d'),_0x6b51('0x56'),{'module':_0x6b51('0x5e')});})[_0x6b51('0x1b')](function(){var _0x336317=_0xbef062[_0x6b51('0x5f')][_0x6b51('0x32')]({'plain':!![]});if(!_0x336317)throw new Error(_0x6b51('0x60'));if(_0x336317[_0x6b51('0x61')]===_0x6b51('0x5f')){var _0x6da7ce=_0xc0d92a[_0x6b51('0x32')]({'plain':!![]});return db[_0x6b51('0x62')][_0x6b51('0x63')]({'where':{'name':'Contexts','userProfileId':_0x336317[_0x6b51('0x64')]},'raw':!![]})[_0x6b51('0x1b')](function(_0x332303){if(_0x332303&&_0x332303[_0x6b51('0x65')]===0x0){return db[_0x6b51('0x34')][_0x6b51('0x56')]({'name':_0x6da7ce['name'],'resourceId':_0x6da7ce['id'],'type':_0x332303[_0x6b51('0x36')],'sectionId':_0x332303['id']},{})[_0x6b51('0x1b')](function(){return _0xc0d92a;});}else{return _0xc0d92a;}})[_0x6b51('0x52')](function(_0x7e858a){logger[_0x6b51('0x22')](_0x6b51('0x66'),_0x7e858a);throw _0x7e858a;});}return _0xc0d92a;})['then'](respondWithResult(_0x594c13,0xc9))[_0x6b51('0x52')](handleError(_0x594c13,null));};exports['update']=function(_0xbd4929,_0x879960,_0x16418b){var _0x71164;return db['VoiceContext'][_0x6b51('0x63')]({'where':{'id':_0xbd4929['params']['id']}})['then'](handleEntityNotFound(_0x879960,null))[_0x6b51('0x1b')](saveUpdates(_0xbd4929[_0x6b51('0x67')],null))['then'](function(_0x13cdac){if(_0x13cdac){_0x71164=_0x13cdac;return db[_0x6b51('0x39')][_0x6b51('0x50')]({'raw':!![]});}})['then'](function(_0x55aa22){var _0xb9b112=fs[_0x6b51('0x68')](path[_0x6b51('0x57')](config[_0x6b51('0x58')],_0x6b51('0x59')),'utf8');var _0x5dcaba=ejs[_0x6b51('0x5b')](_0xb9b112,{'contexts':_0x55aa22||[]});fs[_0x6b51('0x5c')](_0x6b51('0x69'),_0x5dcaba);})[_0x6b51('0x1b')](function(){return respondWithRpcPromise(_0x6b51('0x5d'),_0x6b51('0x31'),{'module':_0x6b51('0x5e')});})[_0x6b51('0x1b')](function(){return _0x71164;})[_0x6b51('0x1b')](respondWithResult(_0x879960,null))[_0x6b51('0x52')](handleError(_0x879960,null));};exports[_0x6b51('0x35')]=function(_0x42d077,_0x381235,_0x291daf){var _0x203093;return db[_0x6b51('0x39')][_0x6b51('0x63')]({'where':{'id':_0x42d077[_0x6b51('0x54')]['id']}})[_0x6b51('0x1b')](handleEntityNotFound(_0x381235,null))['then'](removeEntity(_0x381235,null))[_0x6b51('0x1b')](function(){return db[_0x6b51('0x39')][_0x6b51('0x50')]({'raw':!![]});})['then'](function(_0x2103e1){var _0x1e5ec3=fs[_0x6b51('0x68')](path[_0x6b51('0x57')](config[_0x6b51('0x58')],_0x6b51('0x59')),_0x6b51('0x5a'));var _0x1d73b1=ejs[_0x6b51('0x5b')](_0x1e5ec3,{'contexts':_0x2103e1});fs[_0x6b51('0x5c')](_0x6b51('0x69'),_0x1d73b1);return respondWithRpcPromise(_0x6b51('0x5d'),_0x6b51('0x35'),{'module':_0x6b51('0x5e')});})['catch'](handleError(_0x381235,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d1e352b..e1d2918 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 _0x71d5=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x71d5,0x109));var _0x571d=function(_0x31ffbf,_0x3a8aad){_0x31ffbf=_0x31ffbf-0x0;var _0x536035=_0x71d5[_0x31ffbf];return _0x536035;};'use strict';var _=require(_0x571d('0x0'));var util=require(_0x571d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x571d('0x2'));var BPromise=require(_0x571d('0x3'));var rp=require(_0x571d('0x4'));var fs=require('fs');var path=require(_0x571d('0x5'));var rimraf=require(_0x571d('0x6'));var config=require(_0x571d('0x7'));var attributes=require(_0x571d('0x8'));module[_0x571d('0x9')]=function(_0xee95c4,_0x562de5){return _0xee95c4[_0x571d('0xa')](_0x571d('0xb'),attributes,{'tableName':_0x571d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e7d=['path','rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment','request-promise'];(function(_0x358913,_0x52ed94){var _0x41c913=function(_0x588f21){while(--_0x588f21){_0x358913['push'](_0x358913['shift']());}};_0x41c913(++_0x52ed94);}(_0x2e7d,0x103));var _0xd2e7=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x2e7d[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require(_0xd2e7('0x0'));var logger=require(_0xd2e7('0x1'))(_0xd2e7('0x2'));var moment=require(_0xd2e7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd2e7('0x4'));var fs=require('fs');var path=require(_0xd2e7('0x5'));var rimraf=require(_0xd2e7('0x6'));var config=require(_0xd2e7('0x7'));var attributes=require('./voiceContext.attributes');module[_0xd2e7('0x8')]=function(_0x5b69c8,_0x702871){return _0x5b69c8[_0xd2e7('0x9')](_0xd2e7('0xa'),attributes,{'tableName':_0xd2e7('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 55d7582..e41fa65 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 _0x622f=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x622f,0x172));var _0xf622=function(_0x1b1e90,_0x1d2cde){_0x1b1e90=_0x1b1e90-0x0;var _0x401173=_0x622f[_0x1b1e90];return _0x401173;};'use strict';var _=require(_0xf622('0x0'));var util=require(_0xf622('0x1'));var moment=require('moment');var BPromise=require(_0xf622('0x2'));var rs=require(_0xf622('0x3'));var fs=require('fs');var Redis=require(_0xf622('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf622('0x5'));var logger=require('../../config/logger')(_0xf622('0x6'));var config=require(_0xf622('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf622('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x847984,_0x540b19,_0x4211d8){return new BPromise(function(_0x8b4fab,_0x54a7bc){return client['request'](_0x847984,_0x4211d8)[_0xf622('0x9')](function(_0x54f10a){logger[_0xf622('0xa')](_0xf622('0xb'),_0x540b19,_0xf622('0xc'));logger[_0xf622('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x540b19,_0xf622('0xc'),JSON[_0xf622('0xe')](_0x54f10a));if(_0x54f10a[_0xf622('0xf')]){if(_0x54f10a[_0xf622('0xf')]['code']===0x1f4){logger[_0xf622('0xf')](_0xf622('0xb'),_0x540b19,_0x54f10a[_0xf622('0xf')]['message']);return _0x54a7bc(_0x54f10a[_0xf622('0xf')][_0xf622('0x10')]);}logger[_0xf622('0xf')](_0xf622('0xb'),_0x540b19,_0x54f10a[_0xf622('0xf')][_0xf622('0x10')]);return _0x8b4fab(_0x54f10a['error'][_0xf622('0x10')]);}else{logger['info'](_0xf622('0xb'),_0x540b19,'request\x20sent');_0x8b4fab(_0x54f10a[_0xf622('0x11')][_0xf622('0x10')]);}})[_0xf622('0x12')](function(_0x52c66f){logger[_0xf622('0xf')](_0xf622('0xb'),_0x540b19,_0x52c66f);_0x54a7bc(_0x52c66f);});});} \ No newline at end of file +var _0x9993=['error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d0744,_0x1d1323){var _0x207654=function(_0x338f57){while(--_0x338f57){_0x5d0744['push'](_0x5d0744['shift']());}};_0x207654(++_0x1d1323);}(_0x9993,0x109));var _0x3999=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9993[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3999('0x0'));var util=require('util');var moment=require(_0x3999('0x1'));var BPromise=require(_0x3999('0x2'));var rs=require(_0x3999('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3999('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3999('0x5'))(_0x3999('0x6'));var config=require(_0x3999('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3999('0x8')][_0x3999('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x536de7,_0xc27316,_0x85b5af){return new BPromise(function(_0x4c1a49,_0x77282){return client[_0x3999('0xa')](_0x536de7,_0x85b5af)['then'](function(_0x3dd61){logger['info'](_0x3999('0xb'),_0xc27316,_0x3999('0xc'));logger['debug'](_0x3999('0xd'),_0xc27316,_0x3999('0xc'),JSON[_0x3999('0xe')](_0x3dd61));if(_0x3dd61[_0x3999('0xf')]){if(_0x3dd61[_0x3999('0xf')][_0x3999('0x10')]===0x1f4){logger[_0x3999('0xf')]('VoiceContext,\x20%s,\x20%s',_0xc27316,_0x3dd61[_0x3999('0xf')][_0x3999('0x11')]);return _0x77282(_0x3dd61['error'][_0x3999('0x11')]);}logger[_0x3999('0xf')](_0x3999('0xb'),_0xc27316,_0x3dd61[_0x3999('0xf')]['message']);return _0x4c1a49(_0x3dd61[_0x3999('0xf')]['message']);}else{logger[_0x3999('0x12')]('VoiceContext,\x20%s,\x20%s',_0xc27316,_0x3999('0xc'));_0x4c1a49(_0x3dd61['result'][_0x3999('0x11')]);}})[_0x3999('0x13')](function(_0x27a62b){logger[_0x3999('0xf')]('VoiceContext,\x20%s,\x20%s',_0xc27316,_0x27a62b);_0x77282(_0x27a62b);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a51589e..03263b0 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 _0xfbf0=['Router','fs-extra','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','delete','destroy','util','path'];(function(_0x2ee700,_0x2ac643){var _0x123a9d=function(_0x28ab7e){while(--_0x28ab7e){_0x2ee700['push'](_0x2ee700['shift']());}};_0x123a9d(++_0x2ac643);}(_0xfbf0,0x141));var _0x0fbf=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xfbf0[_0x58afd5];return _0x3e503b;};'use strict';var multer=require('multer');var util=require(_0x0fbf('0x0'));var path=require(_0x0fbf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0fbf('0x2')]();var fs_extra=require(_0x0fbf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0fbf('0x4'));var config=require('../../config/environment');var controller=require(_0x0fbf('0x5'));router['get']('/',auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x7')]);router['get'](_0x0fbf('0x8'),auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x9')]);router[_0x0fbf('0xa')](_0x0fbf('0xb'),auth[_0x0fbf('0x6')](),controller[_0x0fbf('0xc')]);router[_0x0fbf('0xd')]('/',auth[_0x0fbf('0x6')](),controller[_0x0fbf('0xe')]);router['put'](_0x0fbf('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0fbf('0xf')](_0x0fbf('0xb'),auth[_0x0fbf('0x6')](),controller[_0x0fbf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x12dc=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','index','/describe','isAuthenticated','describe','get','post','create','put','delete','/:id','destroy','exports'];(function(_0x21cce0,_0x22984c){var _0x1359b6=function(_0x1af4da){while(--_0x1af4da){_0x21cce0['push'](_0x21cce0['shift']());}};_0x1359b6(++_0x22984c);}(_0x12dc,0xab));var _0xc12d=function(_0x40967e,_0x313764){_0x40967e=_0x40967e-0x0;var _0x180a5f=_0x12dc[_0x40967e];return _0x180a5f;};'use strict';var multer=require(_0xc12d('0x0'));var util=require(_0xc12d('0x1'));var path=require('path');var timeout=require(_0xc12d('0x2'));var express=require('express');var router=express[_0xc12d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc12d('0x4'));var interaction=require(_0xc12d('0x5'));var config=require('../../config/environment');var controller=require(_0xc12d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc12d('0x7')]);router['get'](_0xc12d('0x8'),auth[_0xc12d('0x9')](),controller[_0xc12d('0xa')]);router[_0xc12d('0xb')]('/:id',auth[_0xc12d('0x9')](),controller['show']);router[_0xc12d('0xc')]('/',auth[_0xc12d('0x9')](),controller[_0xc12d('0xd')]);router[_0xc12d('0xe')]('/:id',auth[_0xc12d('0x9')](),controller['update']);router[_0xc12d('0xf')](_0xc12d('0x10'),auth[_0xc12d('0x9')](),controller[_0xc12d('0x11')]);module[_0xc12d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index e8a65de..1ff0ca4 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 _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x3e74,0x175));var _0x43e7=function(_0x543bcb,_0x221c9c){_0x543bcb=_0x543bcb-0x0;var _0x3b4a76=_0x3e74[_0x543bcb];return _0x3b4a76;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0xb821,0xa7));var _0x1b82=function(_0x197316,_0x134995){_0x197316=_0x197316-0x0;var _0x4a92e3=_0xb821[_0x197316];return _0x4a92e3;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 845df60..0e92dd2 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 _0xde22=['update','destroy','sendStatus','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','then','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde22,0x113));var _0x2de2=function(_0x385e1b,_0x4ddc71){_0x385e1b=_0x385e1b-0x0;var _0x27f144=_0xde22[_0x385e1b];return _0x27f144;};'use strict';var emlformat=require(_0x2de2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2de2('0x1'));var jsonpatch=require(_0x2de2('0x2'));var rp=require(_0x2de2('0x3'));var moment=require(_0x2de2('0x4'));var BPromise=require(_0x2de2('0x5'));var Mustache=require(_0x2de2('0x6'));var util=require(_0x2de2('0x7'));var path=require(_0x2de2('0x8'));var sox=require(_0x2de2('0x9'));var csv=require(_0x2de2('0xa'));var ejs=require(_0x2de2('0xb'));var fs=require('fs');var fs_extra=require(_0x2de2('0xc'));var _=require('lodash');var squel=require(_0x2de2('0xd'));var crypto=require(_0x2de2('0xe'));var jsforce=require(_0x2de2('0xf'));var deskjs=require(_0x2de2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2de2('0x11'));var Papa=require(_0x2de2('0x12'));var Redis=require('ioredis');var authService=require(_0x2de2('0x13'));var qs=require(_0x2de2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2de2('0x15'));var logger=require(_0x2de2('0x16'))(_0x2de2('0x17'));var utils=require('../../config/utils');var config=require(_0x2de2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2de2('0x19'))['db'];function respondWithStatusCode(_0x15dfca,_0x18e6d3){_0x18e6d3=_0x18e6d3||0xcc;return function(_0x36cfdb){if(_0x36cfdb){return _0x15dfca['sendStatus'](_0x18e6d3);}return _0x15dfca[_0x2de2('0x1a')](_0x18e6d3)[_0x2de2('0x1b')]();};}function respondWithResult(_0x2920b8,_0x367165){_0x367165=_0x367165||0xc8;return function(_0x5b563e){if(_0x5b563e){return _0x2920b8[_0x2de2('0x1a')](_0x367165)[_0x2de2('0x1c')](_0x5b563e);}};}function respondWithFilteredResult(_0xa9a680,_0x3227c8){return function(_0x4f5467){if(_0x4f5467){var _0x3170d7=typeof _0x3227c8[_0x2de2('0x1d')]===_0x2de2('0x1e')&&typeof _0x3227c8[_0x2de2('0x1f')]===_0x2de2('0x1e');var _0x15faf3=_0x4f5467['count'];var _0x3bd941=_0x3170d7?0x0:_0x3227c8[_0x2de2('0x1d')];var _0x2c6503=_0x3170d7?_0x4f5467[_0x2de2('0x20')]:_0x3227c8[_0x2de2('0x1d')]+_0x3227c8[_0x2de2('0x1f')];var _0x1c86c7;if(_0x2c6503>=_0x15faf3){_0x2c6503=_0x15faf3;_0x1c86c7=0xc8;}else{_0x1c86c7=0xce;}_0xa9a680['status'](_0x1c86c7);return _0xa9a680[_0x2de2('0x21')]('Content-Range',_0x3bd941+'-'+_0x2c6503+'/'+_0x15faf3)[_0x2de2('0x1c')](_0x4f5467);}return null;};}function patchUpdates(_0x3bb05a){return function(_0x3053ce){try{jsonpatch[_0x2de2('0x22')](_0x3053ce,_0x3bb05a,!![]);}catch(_0x1a6fb3){return BPromise[_0x2de2('0x23')](_0x1a6fb3);}return _0x3053ce[_0x2de2('0x24')]();};}function saveUpdates(_0x2417dc,_0xf7cfb1){return function(_0x74d4a1){if(_0x74d4a1){return _0x74d4a1[_0x2de2('0x25')](_0x2417dc)['then'](function(_0x51a5d0){return _0x51a5d0;});}return null;};}function removeEntity(_0x452d1f,_0x552cdd){return function(_0x453f65){if(_0x453f65){return _0x453f65[_0x2de2('0x26')]()['then'](function(){_0x452d1f[_0x2de2('0x1a')](0xcc)[_0x2de2('0x1b')]();});}};}function handleEntityNotFound(_0xe82486,_0x2a8a61){return function(_0x591832){if(!_0x591832){_0xe82486[_0x2de2('0x27')](0x194);}return _0x591832;};}function handleError(_0x3f64ba,_0x214a31){_0x214a31=_0x214a31||0x1f4;return function(_0x305d5d){logger[_0x2de2('0x28')](_0x305d5d[_0x2de2('0x29')]);if(_0x305d5d[_0x2de2('0x2a')]){delete _0x305d5d[_0x2de2('0x2a')];}_0x3f64ba[_0x2de2('0x1a')](_0x214a31)[_0x2de2('0x2b')](_0x305d5d);};}exports[_0x2de2('0x2c')]=function(_0x31a754,_0x3155a4){var _0x52df86={},_0xf570a4={},_0x34d46b={'count':0x0,'rows':[]};var _0x29269a=_[_0x2de2('0x2d')](db[_0x2de2('0x2e')]['rawAttributes'],function(_0x5d4f54){return{'name':_0x5d4f54[_0x2de2('0x2f')],'type':_0x5d4f54[_0x2de2('0x30')][_0x2de2('0x31')]};});_0xf570a4[_0x2de2('0x32')]=_[_0x2de2('0x2d')](_0x29269a,'name');_0xf570a4[_0x2de2('0x33')]=_[_0x2de2('0x34')](_0x31a754[_0x2de2('0x33')]);_0xf570a4['filters']=_[_0x2de2('0x35')](_0xf570a4['model'],_0xf570a4[_0x2de2('0x33')]);_0x52df86[_0x2de2('0x36')]=_[_0x2de2('0x35')](_0xf570a4['model'],qs[_0x2de2('0x37')](_0x31a754[_0x2de2('0x33')][_0x2de2('0x37')]));_0x52df86[_0x2de2('0x36')]=_0x52df86[_0x2de2('0x36')][_0x2de2('0x38')]?_0x52df86['attributes']:_0xf570a4[_0x2de2('0x32')];if(!_0x31a754[_0x2de2('0x33')][_0x2de2('0x39')](_0x2de2('0x3a'))){_0x52df86[_0x2de2('0x1f')]=qs[_0x2de2('0x1f')](_0x31a754[_0x2de2('0x33')]['limit']);_0x52df86[_0x2de2('0x1d')]=qs[_0x2de2('0x1d')](_0x31a754[_0x2de2('0x33')]['offset']);}_0x52df86['order']=qs['sort'](_0x31a754['query'][_0x2de2('0x3b')]);_0x52df86['where']=qs[_0x2de2('0x3c')](_[_0x2de2('0x3d')](_0x31a754[_0x2de2('0x33')],_0xf570a4['filters']),_0x29269a);if(_0x31a754['query']['filter']){_0x52df86[_0x2de2('0x3e')]=_[_0x2de2('0x3f')](_0x52df86[_0x2de2('0x3e')],{'$or':_[_0x2de2('0x2d')](_0x29269a,function(_0x53438f){if(_0x53438f[_0x2de2('0x30')]!==_0x2de2('0x40')){var _0x5ce98a={};_0x5ce98a[_0x53438f[_0x2de2('0x2a')]]={'$like':'%'+_0x31a754[_0x2de2('0x33')][_0x2de2('0x41')]+'%'};return _0x5ce98a;}})});}_0x52df86=_[_0x2de2('0x3f')]({},_0x52df86,_0x31a754['options']);var _0x558502={'where':_0x52df86['where']};return db['VoiceDialReport'][_0x2de2('0x20')](_0x558502)[_0x2de2('0x42')](function(_0x586cd8){_0x34d46b[_0x2de2('0x20')]=_0x586cd8;if(_0x31a754['query'][_0x2de2('0x43')]){_0x52df86[_0x2de2('0x44')]=[{'all':!![]}];}return db[_0x2de2('0x2e')]['findAll'](_0x52df86);})[_0x2de2('0x42')](function(_0xaf4a3c){_0x34d46b[_0x2de2('0x45')]=_0xaf4a3c;return _0x34d46b;})['then'](respondWithFilteredResult(_0x3155a4,_0x52df86))[_0x2de2('0x46')](handleError(_0x3155a4,null));};exports[_0x2de2('0x47')]=function(_0x59660c,_0x3d407c){var _0x44dac0={'raw':!![],'where':{'id':_0x59660c[_0x2de2('0x48')]['id']}},_0x27023d={};_0x27023d[_0x2de2('0x32')]=_[_0x2de2('0x34')](db[_0x2de2('0x2e')][_0x2de2('0x49')]);_0x27023d['query']=_[_0x2de2('0x34')](_0x59660c['query']);_0x27023d[_0x2de2('0x3c')]=_[_0x2de2('0x35')](_0x27023d[_0x2de2('0x32')],_0x27023d[_0x2de2('0x33')]);_0x44dac0[_0x2de2('0x36')]=_[_0x2de2('0x35')](_0x27023d[_0x2de2('0x32')],qs[_0x2de2('0x37')](_0x59660c[_0x2de2('0x33')]['fields']));_0x44dac0['attributes']=_0x44dac0[_0x2de2('0x36')][_0x2de2('0x38')]?_0x44dac0['attributes']:_0x27023d[_0x2de2('0x32')];if(_0x59660c[_0x2de2('0x33')][_0x2de2('0x43')]){_0x44dac0[_0x2de2('0x44')]=[{'all':!![]}];}_0x44dac0=_[_0x2de2('0x3f')]({},_0x44dac0,_0x59660c['options']);return db[_0x2de2('0x2e')][_0x2de2('0x4a')](_0x44dac0)[_0x2de2('0x42')](handleEntityNotFound(_0x3d407c,null))['then'](respondWithResult(_0x3d407c,null))['catch'](handleError(_0x3d407c,null));};exports[_0x2de2('0x4b')]=function(_0x1193ad,_0x1a14ef){return db[_0x2de2('0x2e')][_0x2de2('0x4b')](_0x1193ad[_0x2de2('0x4c')],{})[_0x2de2('0x42')](respondWithResult(_0x1a14ef,0xc9))[_0x2de2('0x46')](handleError(_0x1a14ef,null));};exports[_0x2de2('0x25')]=function(_0x475145,_0x3cf81a){if(_0x475145['body']['id']){delete _0x475145[_0x2de2('0x4c')]['id'];}return db[_0x2de2('0x2e')][_0x2de2('0x4a')]({'where':{'id':_0x475145[_0x2de2('0x48')]['id']}})[_0x2de2('0x42')](handleEntityNotFound(_0x3cf81a,null))[_0x2de2('0x42')](saveUpdates(_0x475145['body'],null))[_0x2de2('0x42')](respondWithResult(_0x3cf81a,null))[_0x2de2('0x46')](handleError(_0x3cf81a,null));};exports['destroy']=function(_0x4dc508,_0x48637a){return db['VoiceDialReport'][_0x2de2('0x4a')]({'where':{'id':_0x4dc508[_0x2de2('0x48')]['id']}})[_0x2de2('0x42')](handleEntityNotFound(_0x48637a,null))[_0x2de2('0x42')](removeEntity(_0x48637a,null))[_0x2de2('0x46')](handleError(_0x48637a,null));};exports[_0x2de2('0x4d')]=function(_0x13f1b2,_0x4e4419){return db['VoiceDialReport'][_0x2de2('0x4d')]()[_0x2de2('0x42')](respondWithResult(_0x4e4419,null))[_0x2de2('0x46')](handleError(_0x4e4419,null));}; \ No newline at end of file +var _0x6f8d=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/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','count','offset','set','Content-Range','apply','reject','save','then','destroy','name','send','map','VoiceDialReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','catch','show','params','merge','options','find','create','body','update'];(function(_0x1efe7f,_0x5a25fc){var _0x5b61ef=function(_0x35b11e){while(--_0x35b11e){_0x1efe7f['push'](_0x1efe7f['shift']());}};_0x5b61ef(++_0x5a25fc);}(_0x6f8d,0x186));var _0xd6f8=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x6f8d[_0x1ac6e5];return _0x5877dc;};'use strict';var emlformat=require(_0xd6f8('0x0'));var rimraf=require(_0xd6f8('0x1'));var zipdir=require(_0xd6f8('0x2'));var jsonpatch=require(_0xd6f8('0x3'));var rp=require('request-promise');var moment=require(_0xd6f8('0x4'));var BPromise=require(_0xd6f8('0x5'));var Mustache=require(_0xd6f8('0x6'));var util=require(_0xd6f8('0x7'));var path=require(_0xd6f8('0x8'));var sox=require(_0xd6f8('0x9'));var csv=require(_0xd6f8('0xa'));var ejs=require(_0xd6f8('0xb'));var fs=require('fs');var fs_extra=require(_0xd6f8('0xc'));var _=require(_0xd6f8('0xd'));var squel=require(_0xd6f8('0xe'));var crypto=require(_0xd6f8('0xf'));var jsforce=require(_0xd6f8('0x10'));var deskjs=require(_0xd6f8('0x11'));var toCsv=require(_0xd6f8('0xa'));var querystring=require(_0xd6f8('0x12'));var Papa=require(_0xd6f8('0x13'));var Redis=require(_0xd6f8('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xd6f8('0x15'));var as=require(_0xd6f8('0x16'));var hardwareService=require(_0xd6f8('0x17'));var logger=require(_0xd6f8('0x18'))(_0xd6f8('0x19'));var utils=require(_0xd6f8('0x1a'));var config=require(_0xd6f8('0x1b'));var licenseUtil=require(_0xd6f8('0x1c'));var db=require(_0xd6f8('0x1d'))['db'];function respondWithStatusCode(_0x3affc6,_0xeac82f){_0xeac82f=_0xeac82f||0xcc;return function(_0xe0436){if(_0xe0436){return _0x3affc6[_0xd6f8('0x1e')](_0xeac82f);}return _0x3affc6[_0xd6f8('0x1f')](_0xeac82f)[_0xd6f8('0x20')]();};}function respondWithResult(_0x16712b,_0xec180b){_0xec180b=_0xec180b||0xc8;return function(_0xa2bf0e){if(_0xa2bf0e){return _0x16712b[_0xd6f8('0x1f')](_0xec180b)[_0xd6f8('0x21')](_0xa2bf0e);}};}function respondWithFilteredResult(_0x4ad9bc,_0x1f8556){return function(_0x22f152){if(_0x22f152){var _0x300e50=typeof _0x1f8556['offset']==='undefined'&&typeof _0x1f8556[_0xd6f8('0x22')]===_0xd6f8('0x23');var _0x4065e1=_0x22f152[_0xd6f8('0x24')];var _0x4b8f0f=_0x300e50?0x0:_0x1f8556['offset'];var _0x3da7c3=_0x300e50?_0x22f152[_0xd6f8('0x24')]:_0x1f8556[_0xd6f8('0x25')]+_0x1f8556[_0xd6f8('0x22')];var _0x3724a9;if(_0x3da7c3>=_0x4065e1){_0x3da7c3=_0x4065e1;_0x3724a9=0xc8;}else{_0x3724a9=0xce;}_0x4ad9bc['status'](_0x3724a9);return _0x4ad9bc[_0xd6f8('0x26')](_0xd6f8('0x27'),_0x4b8f0f+'-'+_0x3da7c3+'/'+_0x4065e1)[_0xd6f8('0x21')](_0x22f152);}return null;};}function patchUpdates(_0x3ffd10){return function(_0x593eef){try{jsonpatch[_0xd6f8('0x28')](_0x593eef,_0x3ffd10,!![]);}catch(_0x374541){return BPromise[_0xd6f8('0x29')](_0x374541);}return _0x593eef[_0xd6f8('0x2a')]();};}function saveUpdates(_0x2a8de5,_0x3f3f29){return function(_0x22b9ad){if(_0x22b9ad){return _0x22b9ad['update'](_0x2a8de5)[_0xd6f8('0x2b')](function(_0x174b12){return _0x174b12;});}return null;};}function removeEntity(_0x13100d,_0x5c447f){return function(_0xc024bf){if(_0xc024bf){return _0xc024bf[_0xd6f8('0x2c')]()[_0xd6f8('0x2b')](function(){_0x13100d[_0xd6f8('0x1f')](0xcc)[_0xd6f8('0x20')]();});}};}function handleEntityNotFound(_0x21795b,_0x4d2dce){return function(_0x5bea68){if(!_0x5bea68){_0x21795b[_0xd6f8('0x1e')](0x194);}return _0x5bea68;};}function handleError(_0x24d35b,_0xf57fa5){_0xf57fa5=_0xf57fa5||0x1f4;return function(_0xb0d714){logger['error'](_0xb0d714['stack']);if(_0xb0d714[_0xd6f8('0x2d')]){delete _0xb0d714[_0xd6f8('0x2d')];}_0x24d35b[_0xd6f8('0x1f')](_0xf57fa5)[_0xd6f8('0x2e')](_0xb0d714);};}exports['index']=function(_0x587404,_0x754bd2){var _0x3bf825={},_0xf09d39={},_0x411616={'count':0x0,'rows':[]};var _0x2887bb=_[_0xd6f8('0x2f')](db[_0xd6f8('0x30')][_0xd6f8('0x31')],function(_0x33bbb0){return{'name':_0x33bbb0['fieldName'],'type':_0x33bbb0[_0xd6f8('0x32')]['key']};});_0xf09d39[_0xd6f8('0x33')]=_[_0xd6f8('0x2f')](_0x2887bb,'name');_0xf09d39[_0xd6f8('0x34')]=_[_0xd6f8('0x35')](_0x587404[_0xd6f8('0x34')]);_0xf09d39[_0xd6f8('0x36')]=_[_0xd6f8('0x37')](_0xf09d39[_0xd6f8('0x33')],_0xf09d39[_0xd6f8('0x34')]);_0x3bf825[_0xd6f8('0x38')]=_[_0xd6f8('0x37')](_0xf09d39[_0xd6f8('0x33')],qs['fields'](_0x587404[_0xd6f8('0x34')][_0xd6f8('0x39')]));_0x3bf825['attributes']=_0x3bf825[_0xd6f8('0x38')][_0xd6f8('0x3a')]?_0x3bf825[_0xd6f8('0x38')]:_0xf09d39[_0xd6f8('0x33')];if(!_0x587404[_0xd6f8('0x34')][_0xd6f8('0x3b')](_0xd6f8('0x3c'))){_0x3bf825['limit']=qs[_0xd6f8('0x22')](_0x587404[_0xd6f8('0x34')][_0xd6f8('0x22')]);_0x3bf825[_0xd6f8('0x25')]=qs[_0xd6f8('0x25')](_0x587404[_0xd6f8('0x34')]['offset']);}_0x3bf825['order']=qs['sort'](_0x587404[_0xd6f8('0x34')][_0xd6f8('0x3d')]);_0x3bf825[_0xd6f8('0x3e')]=qs[_0xd6f8('0x36')](_[_0xd6f8('0x3f')](_0x587404[_0xd6f8('0x34')],_0xf09d39[_0xd6f8('0x36')]),_0x2887bb);if(_0x587404[_0xd6f8('0x34')][_0xd6f8('0x40')]){_0x3bf825[_0xd6f8('0x3e')]=_['merge'](_0x3bf825[_0xd6f8('0x3e')],{'$or':_[_0xd6f8('0x2f')](_0x2887bb,function(_0xeb7812){if(_0xeb7812[_0xd6f8('0x32')]!==_0xd6f8('0x41')){var _0x449088={};_0x449088[_0xeb7812[_0xd6f8('0x2d')]]={'$like':'%'+_0x587404[_0xd6f8('0x34')][_0xd6f8('0x40')]+'%'};return _0x449088;}})});}_0x3bf825=_['merge']({},_0x3bf825,_0x587404['options']);var _0x4cf7f0={'where':_0x3bf825[_0xd6f8('0x3e')]};return db[_0xd6f8('0x30')][_0xd6f8('0x24')](_0x4cf7f0)[_0xd6f8('0x2b')](function(_0x554f0f){_0x411616[_0xd6f8('0x24')]=_0x554f0f;if(_0x587404[_0xd6f8('0x34')][_0xd6f8('0x42')]){_0x3bf825[_0xd6f8('0x43')]=[{'all':!![]}];}return db[_0xd6f8('0x30')][_0xd6f8('0x44')](_0x3bf825);})['then'](function(_0x5d6fef){_0x411616['rows']=_0x5d6fef;return _0x411616;})[_0xd6f8('0x2b')](respondWithFilteredResult(_0x754bd2,_0x3bf825))[_0xd6f8('0x45')](handleError(_0x754bd2,null));};exports[_0xd6f8('0x46')]=function(_0x47a929,_0x5923b7){var _0x109c9b={'raw':!![],'where':{'id':_0x47a929[_0xd6f8('0x47')]['id']}},_0x5f4788={};_0x5f4788['model']=_[_0xd6f8('0x35')](db[_0xd6f8('0x30')][_0xd6f8('0x31')]);_0x5f4788['query']=_[_0xd6f8('0x35')](_0x47a929['query']);_0x5f4788[_0xd6f8('0x36')]=_[_0xd6f8('0x37')](_0x5f4788[_0xd6f8('0x33')],_0x5f4788[_0xd6f8('0x34')]);_0x109c9b['attributes']=_[_0xd6f8('0x37')](_0x5f4788[_0xd6f8('0x33')],qs[_0xd6f8('0x39')](_0x47a929['query'][_0xd6f8('0x39')]));_0x109c9b[_0xd6f8('0x38')]=_0x109c9b[_0xd6f8('0x38')][_0xd6f8('0x3a')]?_0x109c9b[_0xd6f8('0x38')]:_0x5f4788[_0xd6f8('0x33')];if(_0x47a929[_0xd6f8('0x34')][_0xd6f8('0x42')]){_0x109c9b['include']=[{'all':!![]}];}_0x109c9b=_[_0xd6f8('0x48')]({},_0x109c9b,_0x47a929[_0xd6f8('0x49')]);return db[_0xd6f8('0x30')][_0xd6f8('0x4a')](_0x109c9b)[_0xd6f8('0x2b')](handleEntityNotFound(_0x5923b7,null))['then'](respondWithResult(_0x5923b7,null))[_0xd6f8('0x45')](handleError(_0x5923b7,null));};exports[_0xd6f8('0x4b')]=function(_0x116d86,_0x52ff6f){return db['VoiceDialReport'][_0xd6f8('0x4b')](_0x116d86[_0xd6f8('0x4c')],{})[_0xd6f8('0x2b')](respondWithResult(_0x52ff6f,0xc9))['catch'](handleError(_0x52ff6f,null));};exports[_0xd6f8('0x4d')]=function(_0x2c4a63,_0x4a68e0){if(_0x2c4a63[_0xd6f8('0x4c')]['id']){delete _0x2c4a63['body']['id'];}return db[_0xd6f8('0x30')][_0xd6f8('0x4a')]({'where':{'id':_0x2c4a63[_0xd6f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a68e0,null))['then'](saveUpdates(_0x2c4a63[_0xd6f8('0x4c')],null))[_0xd6f8('0x2b')](respondWithResult(_0x4a68e0,null))[_0xd6f8('0x45')](handleError(_0x4a68e0,null));};exports[_0xd6f8('0x2c')]=function(_0x145ddb,_0x4670b6){return db['VoiceDialReport'][_0xd6f8('0x4a')]({'where':{'id':_0x145ddb[_0xd6f8('0x47')]['id']}})[_0xd6f8('0x2b')](handleEntityNotFound(_0x4670b6,null))[_0xd6f8('0x2b')](removeEntity(_0x4670b6,null))[_0xd6f8('0x45')](handleError(_0x4670b6,null));};exports['describe']=function(_0xf32a09,_0x1067cb){return db[_0xd6f8('0x30')]['describe']()[_0xd6f8('0x2b')](respondWithResult(_0x1067cb,null))[_0xd6f8('0x45')](handleError(_0x1067cb,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 702f103..1065928 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 _0xbb49=['moment','bluebird','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','lodash','../../config/logger','api'];(function(_0xcb1869,_0x53ce11){var _0x4151fd=function(_0x4b4de1){while(--_0x4b4de1){_0xcb1869['push'](_0xcb1869['shift']());}};_0x4151fd(++_0x53ce11);}(_0xbb49,0xbd));var _0x9bb4=function(_0x4e4364,_0x15bfc3){_0x4e4364=_0x4e4364-0x0;var _0x147487=_0xbb49[_0x4e4364];return _0x147487;};'use strict';var _=require(_0x9bb4('0x0'));var util=require('util');var logger=require(_0x9bb4('0x1'))(_0x9bb4('0x2'));var moment=require(_0x9bb4('0x3'));var BPromise=require(_0x9bb4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bb4('0x5'));var rimraf=require(_0x9bb4('0x6'));var config=require('../../config/environment');var attributes=require(_0x9bb4('0x7'));module[_0x9bb4('0x8')]=function(_0x18c2ef,_0x1c6db9){return _0x18c2ef[_0x9bb4('0x9')](_0x9bb4('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x9bb4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e79=['path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','api','moment','bluebird','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2e79,0xeb));var _0x92e7=function(_0x40afb4,_0x4271a2){_0x40afb4=_0x40afb4-0x0;var _0xae80e5=_0x2e79[_0x40afb4];return _0xae80e5;};'use strict';var _=require(_0x92e7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x92e7('0x1'));var moment=require(_0x92e7('0x2'));var BPromise=require(_0x92e7('0x3'));var rp=require(_0x92e7('0x4'));var fs=require('fs');var path=require(_0x92e7('0x5'));var rimraf=require('rimraf');var config=require(_0x92e7('0x6'));var attributes=require(_0x92e7('0x7'));module[_0x92e7('0x8')]=function(_0x9f6195,_0x110f47){return _0x9f6195[_0x92e7('0x9')](_0x92e7('0xa'),attributes,{'tableName':_0x92e7('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index adb9dd3..85c1ef5 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 _0xe514=['attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','where'];(function(_0x208e27,_0x2a59dc){var _0x3dfc09=function(_0x577dff){while(--_0x577dff){_0x208e27['push'](_0x208e27['shift']());}};_0x3dfc09(++_0x2a59dc);}(_0xe514,0x134));var _0x4e51=function(_0x4fdca2,_0x203c30){_0x4fdca2=_0x4fdca2-0x0;var _0x3e6515=_0xe514[_0x4fdca2];return _0x3e6515;};'use strict';var _=require(_0x4e51('0x0'));var util=require(_0x4e51('0x1'));var moment=require(_0x4e51('0x2'));var BPromise=require(_0x4e51('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e51('0x4'));var db=require(_0x4e51('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e51('0x6'))(_0x4e51('0x7'));var config=require(_0x4e51('0x8'));var jayson=require(_0x4e51('0x9'));var client=jayson[_0x4e51('0xa')][_0x4e51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56daa0,_0x143bf2,_0x4f756e){return new BPromise(function(_0x38d618,_0x2efb2d){return client[_0x4e51('0xc')](_0x56daa0,_0x4f756e)[_0x4e51('0xd')](function(_0x31d1bf){logger[_0x4e51('0xe')](_0x4e51('0xf'),_0x143bf2,_0x4e51('0x10'));logger[_0x4e51('0x11')](_0x4e51('0x12'),_0x143bf2,_0x4e51('0x10'),JSON[_0x4e51('0x13')](_0x31d1bf));if(_0x31d1bf['error']){if(_0x31d1bf[_0x4e51('0x14')][_0x4e51('0x15')]===0x1f4){logger[_0x4e51('0x14')](_0x4e51('0xf'),_0x143bf2,_0x31d1bf[_0x4e51('0x14')][_0x4e51('0x16')]);return _0x2efb2d(_0x31d1bf[_0x4e51('0x14')]['message']);}logger[_0x4e51('0x14')](_0x4e51('0xf'),_0x143bf2,_0x31d1bf[_0x4e51('0x14')][_0x4e51('0x16')]);return _0x38d618(_0x31d1bf[_0x4e51('0x14')][_0x4e51('0x16')]);}else{logger[_0x4e51('0xe')](_0x4e51('0xf'),_0x143bf2,_0x4e51('0x10'));_0x38d618(_0x31d1bf[_0x4e51('0x17')]['message']);}})[_0x4e51('0x18')](function(_0x2bd77a){logger[_0x4e51('0x14')](_0x4e51('0xf'),_0x143bf2,_0x2bd77a);_0x2efb2d(_0x2bd77a);});});}exports[_0x4e51('0x19')]=function(_0x2cab22){var _0x4efab6=this;return new Promise(function(_0x466f4b,_0xc2ba37){return db[_0x4e51('0x1a')]['create'](_0x2cab22[_0x4e51('0x1b')],{'raw':_0x2cab22['options']?_0x2cab22[_0x4e51('0x1c')][_0x4e51('0x1d')]===undefined?!![]:![]:!![]})[_0x4e51('0xd')](function(_0x5b07ce){logger[_0x4e51('0xe')](_0x4e51('0x19'),_0x2cab22);logger[_0x4e51('0x11')](_0x4e51('0x19'),_0x2cab22,JSON['stringify'](_0x5b07ce));_0x466f4b(_0x5b07ce);})[_0x4e51('0x18')](function(_0x2d8afb){logger[_0x4e51('0x14')](_0x4e51('0x19'),_0x2d8afb['message'],_0x2cab22);_0xc2ba37(_0x4efab6[_0x4e51('0x14')](0x1f4,_0x2d8afb['message']));});});};exports[_0x4e51('0x1e')]=function(_0x2a481d){var _0x2bb252=this;return new Promise(function(_0x21e114,_0x5841d2){return db[_0x4e51('0x1a')]['update'](_0x2a481d[_0x4e51('0x1b')],{'raw':_0x2a481d[_0x4e51('0x1c')]?_0x2a481d[_0x4e51('0x1c')][_0x4e51('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a481d['options']?_0x2a481d[_0x4e51('0x1c')][_0x4e51('0x1f')]||null:null,'attributes':_0x2a481d['options']?_0x2a481d['options'][_0x4e51('0x20')]||null:null,'limit':_0x2a481d['options']?_0x2a481d[_0x4e51('0x1c')][_0x4e51('0x21')]||null:null})[_0x4e51('0xd')](function(_0x190bde){logger[_0x4e51('0xe')](_0x4e51('0x1e'),_0x2a481d);logger[_0x4e51('0x11')](_0x4e51('0x1e'),_0x2a481d,JSON['stringify'](_0x190bde));_0x21e114(_0x190bde);})[_0x4e51('0x18')](function(_0x586aa3){logger[_0x4e51('0x14')](_0x4e51('0x1e'),_0x586aa3['message'],_0x2a481d);_0x5841d2(_0x2bb252['error'](0x1f4,_0x586aa3[_0x4e51('0x16')]));});});}; \ No newline at end of file +var _0xfe04=['update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceDialReport','options','raw','then','stringify','VoiceDialReport'];(function(_0x3b86f5,_0x37aee3){var _0x21aaff=function(_0x41b79f){while(--_0x41b79f){_0x3b86f5['push'](_0x3b86f5['shift']());}};_0x21aaff(++_0x37aee3);}(_0xfe04,0xed));var _0x4fe0=function(_0xedd520,_0x2ac008){_0xedd520=_0xedd520-0x0;var _0x52a0ba=_0xfe04[_0xedd520];return _0x52a0ba;};'use strict';var _=require(_0x4fe0('0x0'));var util=require(_0x4fe0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4fe0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fe0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fe0('0x4'))(_0x4fe0('0x5'));var config=require(_0x4fe0('0x6'));var jayson=require(_0x4fe0('0x7'));var client=jayson[_0x4fe0('0x8')][_0x4fe0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a97fd,_0x1ea9d3,_0x250a33){return new BPromise(function(_0x1d35b6,_0x46d4f7){return client['request'](_0x1a97fd,_0x250a33)['then'](function(_0x356826){logger[_0x4fe0('0xa')](_0x4fe0('0xb'),_0x1ea9d3,_0x4fe0('0xc'));logger['debug'](_0x4fe0('0xd'),_0x1ea9d3,_0x4fe0('0xc'),JSON['stringify'](_0x356826));if(_0x356826[_0x4fe0('0xe')]){if(_0x356826['error'][_0x4fe0('0xf')]===0x1f4){logger[_0x4fe0('0xe')](_0x4fe0('0xb'),_0x1ea9d3,_0x356826[_0x4fe0('0xe')][_0x4fe0('0x10')]);return _0x46d4f7(_0x356826[_0x4fe0('0xe')][_0x4fe0('0x10')]);}logger['error'](_0x4fe0('0xb'),_0x1ea9d3,_0x356826[_0x4fe0('0xe')]['message']);return _0x1d35b6(_0x356826[_0x4fe0('0xe')][_0x4fe0('0x10')]);}else{logger[_0x4fe0('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x1ea9d3,_0x4fe0('0xc'));_0x1d35b6(_0x356826['result'][_0x4fe0('0x10')]);}})[_0x4fe0('0x11')](function(_0x37b422){logger['error'](_0x4fe0('0xb'),_0x1ea9d3,_0x37b422);_0x46d4f7(_0x37b422);});});}exports[_0x4fe0('0x12')]=function(_0x22a2b3){var _0x1e52d1=this;return new Promise(function(_0x343e08,_0x25699c){return db['VoiceDialReport']['create'](_0x22a2b3['body'],{'raw':_0x22a2b3[_0x4fe0('0x13')]?_0x22a2b3[_0x4fe0('0x13')][_0x4fe0('0x14')]===undefined?!![]:![]:!![]})[_0x4fe0('0x15')](function(_0x25fb01){logger[_0x4fe0('0xa')](_0x4fe0('0x12'),_0x22a2b3);logger['debug'](_0x4fe0('0x12'),_0x22a2b3,JSON[_0x4fe0('0x16')](_0x25fb01));_0x343e08(_0x25fb01);})[_0x4fe0('0x11')](function(_0x23e9cb){logger[_0x4fe0('0xe')](_0x4fe0('0x12'),_0x23e9cb[_0x4fe0('0x10')],_0x22a2b3);_0x25699c(_0x1e52d1['error'](0x1f4,_0x23e9cb[_0x4fe0('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x56b5a9){var _0x358525=this;return new Promise(function(_0x382ba2,_0x1e1055){return db[_0x4fe0('0x17')][_0x4fe0('0x18')](_0x56b5a9['body'],{'raw':_0x56b5a9[_0x4fe0('0x13')]?_0x56b5a9['options'][_0x4fe0('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56b5a9[_0x4fe0('0x13')]?_0x56b5a9['options'][_0x4fe0('0x19')]||null:null,'attributes':_0x56b5a9['options']?_0x56b5a9[_0x4fe0('0x13')][_0x4fe0('0x1a')]||null:null,'limit':_0x56b5a9[_0x4fe0('0x13')]?_0x56b5a9[_0x4fe0('0x13')][_0x4fe0('0x1b')]||null:null})[_0x4fe0('0x15')](function(_0x3f98d1){logger['info'](_0x4fe0('0x1c'),_0x56b5a9);logger['debug'](_0x4fe0('0x1c'),_0x56b5a9,JSON[_0x4fe0('0x16')](_0x3f98d1));_0x382ba2(_0x3f98d1);})['catch'](function(_0x5b6e55){logger[_0x4fe0('0xe')](_0x4fe0('0x1c'),_0x5b6e55[_0x4fe0('0x10')],_0x56b5a9);_0x1e1055(_0x358525[_0x4fe0('0xe')](0x1f4,_0x5b6e55[_0x4fe0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7ba25df..070b424 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 _0xc117=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout'];(function(_0x50a9af,_0x24df09){var _0x3478f9=function(_0x2228ff){while(--_0x2228ff){_0x50a9af['push'](_0x50a9af['shift']());}};_0x3478f9(++_0x24df09);}(_0xc117,0xe1));var _0x7c11=function(_0x540d2f,_0x165b9a){_0x540d2f=_0x540d2f-0x0;var _0x1668b3=_0xc117[_0x540d2f];return _0x1668b3;};'use strict';var multer=require(_0x7c11('0x0'));var util=require(_0x7c11('0x1'));var path=require('path');var timeout=require(_0x7c11('0x2'));var express=require('express');var router=express[_0x7c11('0x3')]();var fs_extra=require(_0x7c11('0x4'));var auth=require(_0x7c11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7c11('0x6'));var controller=require(_0x7c11('0x7'));router['get']('/',auth[_0x7c11('0x8')](),controller[_0x7c11('0x9')]);router[_0x7c11('0xa')]('/:id',auth[_0x7c11('0x8')](),controller[_0x7c11('0xb')]);router[_0x7c11('0xc')]('/',auth[_0x7c11('0x8')](),controller[_0x7c11('0xd')]);router[_0x7c11('0xc')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x7c11('0xe')](_0x7c11('0xf'),auth['isAuthenticated'](),controller[_0x7c11('0x10')]);router[_0x7c11('0x11')](_0x7c11('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x7c11('0x12')]=router; \ No newline at end of file +var _0xe2de=['../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','post','create','addApplications','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe2de,0xa5));var _0xee2d=function(_0x2a6a22,_0x1fc1de){_0x2a6a22=_0x2a6a22-0x0;var _0x26747b=_0xe2de[_0x2a6a22];return _0x26747b;};'use strict';var multer=require(_0xee2d('0x0'));var util=require(_0xee2d('0x1'));var path=require('path');var timeout=require(_0xee2d('0x2'));var express=require(_0xee2d('0x3'));var router=express['Router']();var fs_extra=require(_0xee2d('0x4'));var auth=require(_0xee2d('0x5'));var interaction=require(_0xee2d('0x6'));var config=require('../../config/environment');var controller=require(_0xee2d('0x7'));router[_0xee2d('0x8')]('/',auth[_0xee2d('0x9')](),controller['index']);router[_0xee2d('0x8')]('/:id',auth[_0xee2d('0x9')](),controller['show']);router[_0xee2d('0xa')]('/',auth['isAuthenticated'](),controller[_0xee2d('0xb')]);router[_0xee2d('0xa')]('/:id/applications',auth[_0xee2d('0x9')](),controller[_0xee2d('0xc')]);router[_0xee2d('0xd')](_0xee2d('0xe'),auth[_0xee2d('0x9')](),controller[_0xee2d('0xf')]);router[_0xee2d('0x10')]('/:id',auth[_0xee2d('0x9')](),controller[_0xee2d('0x11')]);module[_0xee2d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 49b4190..54cf900 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 _0xe1eb=['STRING','NoOp','ENUM','inbound','inbound-fax','outbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','compositeIndex'];(function(_0x57afc6,_0x4025cc){var _0x20f7de=function(_0x80b048){while(--_0x80b048){_0x57afc6['push'](_0x57afc6['shift']());}};_0x20f7de(++_0x4025cc);}(_0xe1eb,0x85));var _0xbe1e=function(_0x472ee2,_0x295444){_0x472ee2=_0x472ee2-0x0;var _0x18387b=_0xe1eb[_0x472ee2];return _0x18387b;};'use strict';var Sequelize=require(_0xbe1e('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbe1e('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xbe1e('0x2')],'allowNull':![],'unique':_0xbe1e('0x1')},'priority':{'type':Sequelize[_0xbe1e('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xbe1e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xbe1e('0x2')],'allowNull':![],'defaultValue':_0xbe1e('0x3')},'appdata':{'type':Sequelize[_0xbe1e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xbe1e('0x4')](_0xbe1e('0x5'),'outbound','internal',_0xbe1e('0x6'),_0xbe1e('0x7'),_0xbe1e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbe1e('0x2')],'allowNull':![],'defaultValue':_0xbe1e('0x9')},'IntervalId':{'type':Sequelize[_0xbe1e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xbe1e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xbe1e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xbe1e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xbe1e('0xa')]},'recordingFormat':{'type':Sequelize[_0xbe1e('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xbe1e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0xbe1e('0xc')],'get':function(_0x1b5423){return this[_0xbe1e('0xd')](_0xbe1e('0xe'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x4970=['STRING','NoOp','ENUM','internal','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex'];(function(_0x3ca225,_0x30ff4c){var _0x104776=function(_0x1f8ae6){while(--_0x1f8ae6){_0x3ca225['push'](_0x3ca225['shift']());}};_0x104776(++_0x30ff4c);}(_0x4970,0x15d));var _0x0497=function(_0x163465,_0x5b49d2){_0x163465=_0x163465-0x0;var _0x164a7c=_0x4970[_0x163465];return _0x164a7c;};'use strict';var Sequelize=require(_0x0497('0x0'));module[_0x0497('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0497('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0497('0x3')],'allowNull':![],'unique':_0x0497('0x2')},'priority':{'type':Sequelize[_0x0497('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x0497('0x2')},'tag':{'type':Sequelize[_0x0497('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0497('0x3')],'allowNull':![],'defaultValue':_0x0497('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0497('0x5')]('inbound','outbound',_0x0497('0x6'),'inbound-fax',_0x0497('0x7'),_0x0497('0x8'),_0x0497('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0497('0x3')]},'interval':{'type':Sequelize[_0x0497('0x3')],'allowNull':![],'defaultValue':_0x0497('0xa')},'IntervalId':{'type':Sequelize[_0x0497('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0497('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0497('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0x0497('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0497('0xb')]},'recordingFormat':{'type':Sequelize[_0x0497('0x3')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x0497('0xd')],'get':function(_0x332259){return this[_0x0497('0xe')](_0x0497('0xf'));}},'alias':{'type':Sequelize[_0x0497('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 482c570..d7e0389 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 _0x4728=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','json','limit','undefined','offset','set','Content-Range','then','get','InboundRoutes','inbound','outbound','internal','filter','ignore','map','value','includes','type','find','destroy','sendStatus','error','name','send','VoiceExtension','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','nolimit','sort','pick','where','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','InternalRoutes','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','ioredis','../../config/logger','api','../../config/environment'];(function(_0x6c3c46,_0x4ae7df){var _0x434c10=function(_0x222911){while(--_0x222911){_0x6c3c46['push'](_0x6c3c46['shift']());}};_0x434c10(++_0x4ae7df);}(_0x4728,0x174));var _0x8472=function(_0x539724,_0x120b2d){_0x539724=_0x539724-0x0;var _0x1752e5=_0x4728[_0x539724];return _0x1752e5;};'use strict';var _=require('lodash');var Redis=require(_0x8472('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x8472('0x1'))(_0x8472('0x2'));var config=require(_0x8472('0x3'));var db=require(_0x8472('0x4'))['db'];config[_0x8472('0x5')]=_[_0x8472('0x6')](config[_0x8472('0x5')],{'host':_0x8472('0x7'),'port':0x18eb});var socket=require(_0x8472('0x8'))(new Redis(config[_0x8472('0x5')]));require(_0x8472('0x9'))[_0x8472('0xa')](socket);function respondWithStatusCode(_0x154552,_0x5b07c7){_0x5b07c7=_0x5b07c7||0xcc;return function(_0x2fba51){if(_0x2fba51){return _0x154552['sendStatus'](_0x5b07c7);}return _0x154552[_0x8472('0xb')](_0x5b07c7)[_0x8472('0xc')]();};}function respondWithResult(_0x33762c,_0x402d45){_0x402d45=_0x402d45||0xc8;return function(_0x35f3a4){if(_0x35f3a4){return _0x33762c['status'](_0x402d45)[_0x8472('0xd')](_0x35f3a4);}};}function respondWithFilteredResult(_0x54c939,_0x3e5f7f){return function(_0x2c3e67){if(_0x2c3e67){var _0xba8825=typeof _0x3e5f7f['offset']==='undefined'&&typeof _0x3e5f7f[_0x8472('0xe')]===_0x8472('0xf');var _0x753c6c=_0x2c3e67['count'];var _0x47e7ca=_0xba8825?0x0:_0x3e5f7f['offset'];var _0x47c008=_0xba8825?_0x2c3e67['count']:_0x3e5f7f[_0x8472('0x10')]+_0x3e5f7f[_0x8472('0xe')];var _0x132973;if(_0x47c008>=_0x753c6c){_0x47c008=_0x753c6c;_0x132973=0xc8;}else{_0x132973=0xce;}_0x54c939[_0x8472('0xb')](_0x132973);return _0x54c939[_0x8472('0x11')](_0x8472('0x12'),_0x47e7ca+'-'+_0x47c008+'/'+_0x753c6c)['json'](_0x2c3e67);}return null;};}function removeEntity(_0x457f9c){return function(_0x326f06){if(_0x326f06){return _0x326f06['destroy']()[_0x8472('0x13')](function(){var _0x423f7b=_0x326f06[_0x8472('0x14')]({'plain':!![]});var _0xe79332=[{'name':_0x8472('0x15'),'value':_0x8472('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0x8472('0x17'),'ignore':![]},{'name':'InternalRoutes','value':_0x8472('0x18'),'ignore':![]}];var _0x5957b1=_(_0xe79332)[_0x8472('0x19')](_0x8472('0x1a'))[_0x8472('0x1b')](_0x8472('0x1c'))[_0x8472('0x1c')]();if(_[_0x8472('0x1d')](_0x5957b1,_0x423f7b[_0x8472('0x1e')])){return;}var _0x4611d4=_[_0x8472('0x1f')](_0xe79332,[_0x8472('0x1c'),_0x423f7b[_0x8472('0x1e')]])['name'];return db['UserProfileResource'][_0x8472('0x20')]({'where':{'type':_0x4611d4,'resourceId':_0x423f7b['id']}})[_0x8472('0x13')](function(){return _0x326f06;});})[_0x8472('0x13')](function(){_0x457f9c[_0x8472('0xb')](0xcc)[_0x8472('0xc')]();});}};}function handleEntityNotFound(_0x64e63c){return function(_0xd383a0){if(!_0xd383a0){_0x64e63c[_0x8472('0x21')](0x194);}return _0xd383a0;};}function handleError(_0x540a38,_0x89cf09){_0x89cf09=_0x89cf09||0x1f4;return function(_0x1b5af7){logger[_0x8472('0x22')](_0x1b5af7['stack']);if(_0x1b5af7['name']){delete _0x1b5af7[_0x8472('0x23')];}_0x540a38[_0x8472('0xb')](_0x89cf09)[_0x8472('0x24')](_0x1b5af7);};}exports['index']=function(_0x503459,_0x2e87ff){var _0x13e8d2={},_0x4fdacb={},_0x4022fd={'count':0x0,'rows':[]};var _0x328360=_['map'](db[_0x8472('0x25')][_0x8472('0x26')],function(_0x1a846a){return{'name':_0x1a846a[_0x8472('0x27')],'type':_0x1a846a[_0x8472('0x1e')][_0x8472('0x28')]};});_0x4fdacb[_0x8472('0x29')]=_[_0x8472('0x1b')](_0x328360,_0x8472('0x23'));_0x4fdacb['query']=_[_0x8472('0x2a')](_0x503459['query']);_0x4fdacb[_0x8472('0x2b')]=_[_0x8472('0x2c')](_0x4fdacb[_0x8472('0x29')],_0x4fdacb[_0x8472('0x2d')]);_0x13e8d2['attributes']=_[_0x8472('0x2c')](_0x4fdacb[_0x8472('0x29')],qs[_0x8472('0x2e')](_0x503459[_0x8472('0x2d')]['fields']));_0x13e8d2[_0x8472('0x2f')]=_0x13e8d2[_0x8472('0x2f')][_0x8472('0x30')]?_0x13e8d2[_0x8472('0x2f')]:_0x4fdacb[_0x8472('0x29')];if(!_0x503459[_0x8472('0x2d')]['hasOwnProperty'](_0x8472('0x31'))){_0x13e8d2[_0x8472('0xe')]=qs[_0x8472('0xe')](_0x503459[_0x8472('0x2d')]['limit']);_0x13e8d2['offset']=qs['offset'](_0x503459['query'][_0x8472('0x10')]);}_0x13e8d2['order']=qs[_0x8472('0x32')](_0x503459[_0x8472('0x2d')]['sort']);_0x13e8d2['where']=qs[_0x8472('0x2b')](_[_0x8472('0x33')](_0x503459[_0x8472('0x2d')],_0x4fdacb[_0x8472('0x2b')]),_0x328360);if(_0x503459[_0x8472('0x2d')]['filter']){_0x13e8d2[_0x8472('0x34')]=_[_0x8472('0x35')](_0x13e8d2[_0x8472('0x34')],{'$or':_[_0x8472('0x1b')](_0x328360,function(_0x1a48a6){if(_0x1a48a6['type']!==_0x8472('0x36')){var _0x5c815b={};_0x5c815b[_0x1a48a6['name']]={'$like':'%'+_0x503459[_0x8472('0x2d')][_0x8472('0x19')]+'%'};return _0x5c815b;}})});}_0x13e8d2=_[_0x8472('0x35')]({},_0x13e8d2,_0x503459[_0x8472('0x37')]);var _0x5ec008={'where':_0x13e8d2[_0x8472('0x34')]};return db[_0x8472('0x25')][_0x8472('0x38')](_0x5ec008)[_0x8472('0x13')](function(_0x498d91){_0x4022fd[_0x8472('0x38')]=_0x498d91;if(_0x503459[_0x8472('0x2d')][_0x8472('0x39')]){_0x13e8d2[_0x8472('0x3a')]=[{'all':!![]}];}return db[_0x8472('0x25')]['findAll'](_0x13e8d2);})[_0x8472('0x13')](function(_0x4ef39f){_0x4022fd['rows']=_0x4ef39f;return _0x4022fd;})[_0x8472('0x13')](respondWithFilteredResult(_0x2e87ff,_0x13e8d2))[_0x8472('0x3b')](handleError(_0x2e87ff,null));};exports[_0x8472('0x3c')]=function(_0x19f228,_0x47228e){var _0x5b94db={'raw':![],'where':{'id':_0x19f228[_0x8472('0x3d')]['id']}},_0x1d38f1={};_0x1d38f1[_0x8472('0x29')]=_[_0x8472('0x2a')](db['VoiceExtension'][_0x8472('0x26')]);_0x1d38f1[_0x8472('0x2d')]=_['keys'](_0x19f228[_0x8472('0x2d')]);_0x1d38f1[_0x8472('0x2b')]=_[_0x8472('0x2c')](_0x1d38f1[_0x8472('0x29')],_0x1d38f1[_0x8472('0x2d')]);_0x5b94db[_0x8472('0x2f')]=_[_0x8472('0x2c')](_0x1d38f1[_0x8472('0x29')],qs['fields'](_0x19f228['query'][_0x8472('0x2e')]));_0x5b94db[_0x8472('0x2f')]=_0x5b94db[_0x8472('0x2f')][_0x8472('0x30')]?_0x5b94db[_0x8472('0x2f')]:_0x1d38f1[_0x8472('0x29')];if(_0x19f228[_0x8472('0x2d')]['includeAll']){_0x5b94db[_0x8472('0x3a')]=[{'all':!![]}];}_0x5b94db=_[_0x8472('0x35')]({},_0x5b94db,_0x19f228[_0x8472('0x37')]);return db['VoiceExtension'][_0x8472('0x1f')](_0x5b94db)['then'](handleEntityNotFound(_0x47228e,null))[_0x8472('0x13')](respondWithResult(_0x47228e,null))[_0x8472('0x3b')](handleError(_0x47228e,null));};exports[_0x8472('0x20')]=function(_0x1b6c58,_0x335365){return db[_0x8472('0x25')]['find']({'where':{'id':_0x1b6c58[_0x8472('0x3d')]['id']}})['then'](handleEntityNotFound(_0x335365,null))['then'](removeEntity(_0x335365,null))[_0x8472('0x3b')](handleError(_0x335365,null));};exports[_0x8472('0x3e')]=function(_0x78caf4,_0x3b4d86){if(_0x78caf4[_0x8472('0x3f')][_0x8472('0x1e')]==='outbound'&&!_[_0x8472('0x40')](_0x78caf4[_0x8472('0x3f')][_0x8472('0x41')],'_')){_0x78caf4[_0x8472('0x3f')][_0x8472('0x41')]='_'['concat'](_0x78caf4['body'][_0x8472('0x41')]);}return db[_0x8472('0x25')]['create'](_0x78caf4[_0x8472('0x3f')],{'raw':![]})[_0x8472('0x13')](function(_0x5e3289){var _0x116d1b=_0x78caf4[_0x8472('0x42')][_0x8472('0x14')]({'plain':!![]});if(!_0x116d1b)throw new Error(_0x8472('0x43'));if(_0x116d1b[_0x8472('0x44')]===_0x8472('0x42')){var _0x24334c=_0x5e3289[_0x8472('0x14')]({'plain':!![]});var _0x23059a=[{'name':_0x8472('0x15'),'value':_0x8472('0x16')},{'name':_0x8472('0x45'),'value':_0x8472('0x17')},{'name':_0x8472('0x46'),'value':'internal'}];var _0x5242fe=_['find'](_0x23059a,[_0x8472('0x1c'),_0x24334c[_0x8472('0x1e')]])['name'];return db[_0x8472('0x47')][_0x8472('0x1f')]({'where':{'name':_0x5242fe,'userProfileId':_0x116d1b[_0x8472('0x48')]},'raw':!![]})[_0x8472('0x13')](function(_0x159cfb){if(_0x159cfb&&_0x159cfb['autoAssociation']===0x0){return db[_0x8472('0x49')][_0x8472('0x3e')]({'name':_0x24334c['name'],'resourceId':_0x24334c['id'],'type':_0x159cfb[_0x8472('0x23')],'sectionId':_0x159cfb['id']},{})['then'](function(){return _0x5e3289;});}else{return _0x5e3289;}})['catch'](function(_0x41ce0b){logger[_0x8472('0x22')](_0x8472('0x4a'),_0x41ce0b);throw _0x41ce0b;});}return _0x5e3289;})[_0x8472('0x13')](respondWithResult(_0x3b4d86,0xc9))[_0x8472('0x3b')](handleError(_0x3b4d86,null));};exports[_0x8472('0x4b')]=function(_0x90a954,_0x3acc22){if(_0x90a954[_0x8472('0x3f')]['id']){delete _0x90a954[_0x8472('0x3f')]['id'];}return db[_0x8472('0x25')][_0x8472('0x1f')]({'where':{'id':_0x90a954['params']['id']}})[_0x8472('0x13')](handleEntityNotFound(_0x3acc22,null))['then'](function(_0x52545b){if(_0x52545b){return db[_0x8472('0x25')][_0x8472('0x4b')](_[_0x8472('0x33')](_0x90a954['body'],[_0x8472('0x41'),_0x8472('0x4c'),_0x8472('0x4d'),_0x8472('0x4e'),_0x8472('0x4f'),_0x8472('0x50'),'alias']),{'where':{'context':_0x52545b[_0x8472('0x4c')],'exten':_0x52545b[_0x8472('0x41')]},'individualHooks':!![]})['then'](function(_0x2377ea){return _0x2377ea;});}return null;})['then'](respondWithStatusCode(_0x3acc22,null))[_0x8472('0x3b')](handleError(_0x3acc22,null));};exports['addApplications']=function(_0x315699,_0x1d69f6){var _0x1c5e85=_0x315699['params']['id'];var _0x32f848=_0x315699[_0x8472('0x3f')];var _0x230665=0xc8;var _0x36a435=null;return db[_0x8472('0x51')][_0x8472('0x52')]({'isolationLevel':db[_0x8472('0x51')][_0x8472('0x53')][_0x8472('0x54')][_0x8472('0x55')]},function(_0x247818){return db[_0x8472('0x25')][_0x8472('0x56')]({'where':{'id':_0x1c5e85},'transaction':_0x247818})[_0x8472('0x13')](function(_0x22dce9){if(_0x22dce9){return db['VoiceExtension'][_0x8472('0x20')]({'where':{'VoiceExtensionId':_0x1c5e85},'transaction':_0x247818})[_0x8472('0x13')](function(){var _0x25335f=_[_0x8472('0x1b')](_0x32f848,function(_0x32d643){_0x32d643[_0x8472('0x57')]=_0x1c5e85;_0x32d643[_0x8472('0x58')]=!![];return _0x32d643;});return _0x22dce9[_0x8472('0x59')](_0x25335f);})[_0x8472('0x13')](function(_0x2214e4){return db[_0x8472('0x25')]['bulkCreate'](_0x2214e4,{'transaction':_0x247818});});}else{_0x230665=0x194;_0x36a435=[];}});})[_0x8472('0x13')](function(){if(_0x230665!==0x194){return db['VoiceExtension'][_0x8472('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1c5e85},'order':_0x8472('0x5b')})[_0x8472('0x13')](function(_0x5953a6){_0x36a435=_0x5953a6;});}})[_0x8472('0x3b')](function(_0x32e832){_0x230665=0x1f4;logger[_0x8472('0x22')](_0x32e832[_0x8472('0x5c')]);if(_0x32e832[_0x8472('0x23')]){delete _0x32e832[_0x8472('0x23')];}_0x36a435=_0x32e832;})[_0x8472('0x5d')](function(){if(_0x36a435===null){_0x1d69f6[_0x8472('0x21')](_0x230665);}else{if(_0x230665===0x1f4){_0x1d69f6[_0x8472('0xb')](_0x230665)['send'](_0x36a435);}else{_0x1d69f6[_0x8472('0xb')](_0x230665)[_0x8472('0xd')](_0x36a435);}}});}; \ No newline at end of file +var _0x779b=['internal','filter','ignore','value','includes','type','find','error','stack','name','VoiceExtension','fieldName','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','findAll','show','params','keys','rawAttributes','catch','create','startsWith','exten','body','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','lodash','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x779b,0x149));var _0xb779=function(_0x1c9c43,_0x323bdd){_0x1c9c43=_0x1c9c43-0x0;var _0x665be8=_0x779b[_0x1c9c43];return _0x665be8;};'use strict';var _=require(_0xb779('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xb779('0x1'))(_0xb779('0x2'));var config=require(_0xb779('0x3'));var db=require('../../mysqldb')['db'];config[_0xb779('0x4')]=_['defaults'](config[_0xb779('0x4')],{'host':_0xb779('0x5'),'port':0x18eb});var socket=require(_0xb779('0x6'))(new Redis(config[_0xb779('0x4')]));require(_0xb779('0x7'))[_0xb779('0x8')](socket);function respondWithStatusCode(_0x13cf18,_0x4a6d31){_0x4a6d31=_0x4a6d31||0xcc;return function(_0x271736){if(_0x271736){return _0x13cf18[_0xb779('0x9')](_0x4a6d31);}return _0x13cf18['status'](_0x4a6d31)[_0xb779('0xa')]();};}function respondWithResult(_0xc78193,_0x321df4){_0x321df4=_0x321df4||0xc8;return function(_0x268dcb){if(_0x268dcb){return _0xc78193['status'](_0x321df4)[_0xb779('0xb')](_0x268dcb);}};}function respondWithFilteredResult(_0x5d2d9b,_0xe8537a){return function(_0x3d755f){if(_0x3d755f){var _0x4e034f=typeof _0xe8537a[_0xb779('0xc')]==='undefined'&&typeof _0xe8537a[_0xb779('0xd')]===_0xb779('0xe');var _0x19d196=_0x3d755f[_0xb779('0xf')];var _0x4da679=_0x4e034f?0x0:_0xe8537a[_0xb779('0xc')];var _0x2a03c3=_0x4e034f?_0x3d755f[_0xb779('0xf')]:_0xe8537a[_0xb779('0xc')]+_0xe8537a['limit'];var _0x2dee03;if(_0x2a03c3>=_0x19d196){_0x2a03c3=_0x19d196;_0x2dee03=0xc8;}else{_0x2dee03=0xce;}_0x5d2d9b[_0xb779('0x10')](_0x2dee03);return _0x5d2d9b[_0xb779('0x11')](_0xb779('0x12'),_0x4da679+'-'+_0x2a03c3+'/'+_0x19d196)['json'](_0x3d755f);}return null;};}function removeEntity(_0x1a63f0){return function(_0x2d1243){if(_0x2d1243){return _0x2d1243[_0xb779('0x13')]()[_0xb779('0x14')](function(){var _0x5df387=_0x2d1243[_0xb779('0x15')]({'plain':!![]});var _0x2f3ff8=[{'name':_0xb779('0x16'),'value':_0xb779('0x17'),'ignore':![]},{'name':_0xb779('0x18'),'value':_0xb779('0x19'),'ignore':![]},{'name':_0xb779('0x1a'),'value':_0xb779('0x1b'),'ignore':![]}];var _0x99bfe3=_(_0x2f3ff8)[_0xb779('0x1c')](_0xb779('0x1d'))['map'](_0xb779('0x1e'))['value']();if(_[_0xb779('0x1f')](_0x99bfe3,_0x5df387[_0xb779('0x20')])){return;}var _0xd435d9=_[_0xb779('0x21')](_0x2f3ff8,['value',_0x5df387[_0xb779('0x20')]])['name'];return db['UserProfileResource'][_0xb779('0x13')]({'where':{'type':_0xd435d9,'resourceId':_0x5df387['id']}})[_0xb779('0x14')](function(){return _0x2d1243;});})[_0xb779('0x14')](function(){_0x1a63f0[_0xb779('0x10')](0xcc)[_0xb779('0xa')]();});}};}function handleEntityNotFound(_0x58c480){return function(_0x3dd1a7){if(!_0x3dd1a7){_0x58c480[_0xb779('0x9')](0x194);}return _0x3dd1a7;};}function handleError(_0x200736,_0x363823){_0x363823=_0x363823||0x1f4;return function(_0xd2cd14){logger[_0xb779('0x22')](_0xd2cd14[_0xb779('0x23')]);if(_0xd2cd14[_0xb779('0x24')]){delete _0xd2cd14['name'];}_0x200736['status'](_0x363823)['send'](_0xd2cd14);};}exports['index']=function(_0x316599,_0x1dcf1a){var _0x309993={},_0x36fb65={},_0x3f718d={'count':0x0,'rows':[]};var _0x15aefb=_['map'](db[_0xb779('0x25')]['rawAttributes'],function(_0x4c7600){return{'name':_0x4c7600[_0xb779('0x26')],'type':_0x4c7600['type'][_0xb779('0x27')]};});_0x36fb65[_0xb779('0x28')]=_[_0xb779('0x29')](_0x15aefb,'name');_0x36fb65[_0xb779('0x2a')]=_['keys'](_0x316599[_0xb779('0x2a')]);_0x36fb65['filters']=_['intersection'](_0x36fb65[_0xb779('0x28')],_0x36fb65[_0xb779('0x2a')]);_0x309993[_0xb779('0x2b')]=_[_0xb779('0x2c')](_0x36fb65['model'],qs[_0xb779('0x2d')](_0x316599['query'][_0xb779('0x2d')]));_0x309993[_0xb779('0x2b')]=_0x309993[_0xb779('0x2b')][_0xb779('0x2e')]?_0x309993['attributes']:_0x36fb65['model'];if(!_0x316599[_0xb779('0x2a')][_0xb779('0x2f')]('nolimit')){_0x309993[_0xb779('0xd')]=qs['limit'](_0x316599[_0xb779('0x2a')][_0xb779('0xd')]);_0x309993[_0xb779('0xc')]=qs[_0xb779('0xc')](_0x316599[_0xb779('0x2a')][_0xb779('0xc')]);}_0x309993['order']=qs[_0xb779('0x30')](_0x316599[_0xb779('0x2a')][_0xb779('0x30')]);_0x309993[_0xb779('0x31')]=qs[_0xb779('0x32')](_[_0xb779('0x33')](_0x316599[_0xb779('0x2a')],_0x36fb65['filters']),_0x15aefb);if(_0x316599[_0xb779('0x2a')][_0xb779('0x1c')]){_0x309993['where']=_['merge'](_0x309993['where'],{'$or':_[_0xb779('0x29')](_0x15aefb,function(_0x673754){if(_0x673754[_0xb779('0x20')]!==_0xb779('0x34')){var _0x285160={};_0x285160[_0x673754['name']]={'$like':'%'+_0x316599[_0xb779('0x2a')][_0xb779('0x1c')]+'%'};return _0x285160;}})});}_0x309993=_[_0xb779('0x35')]({},_0x309993,_0x316599[_0xb779('0x36')]);var _0x7fe881={'where':_0x309993[_0xb779('0x31')]};return db[_0xb779('0x25')][_0xb779('0xf')](_0x7fe881)[_0xb779('0x14')](function(_0x4604a7){_0x3f718d[_0xb779('0xf')]=_0x4604a7;if(_0x316599['query'][_0xb779('0x37')]){_0x309993['include']=[{'all':!![]}];}return db[_0xb779('0x25')][_0xb779('0x38')](_0x309993);})['then'](function(_0x2f205e){_0x3f718d['rows']=_0x2f205e;return _0x3f718d;})[_0xb779('0x14')](respondWithFilteredResult(_0x1dcf1a,_0x309993))['catch'](handleError(_0x1dcf1a,null));};exports[_0xb779('0x39')]=function(_0x240d8d,_0xb101f5){var _0x21b92f={'raw':![],'where':{'id':_0x240d8d[_0xb779('0x3a')]['id']}},_0x18072d={};_0x18072d[_0xb779('0x28')]=_[_0xb779('0x3b')](db[_0xb779('0x25')][_0xb779('0x3c')]);_0x18072d['query']=_[_0xb779('0x3b')](_0x240d8d[_0xb779('0x2a')]);_0x18072d[_0xb779('0x32')]=_[_0xb779('0x2c')](_0x18072d['model'],_0x18072d['query']);_0x21b92f['attributes']=_[_0xb779('0x2c')](_0x18072d[_0xb779('0x28')],qs[_0xb779('0x2d')](_0x240d8d[_0xb779('0x2a')]['fields']));_0x21b92f[_0xb779('0x2b')]=_0x21b92f[_0xb779('0x2b')][_0xb779('0x2e')]?_0x21b92f['attributes']:_0x18072d[_0xb779('0x28')];if(_0x240d8d[_0xb779('0x2a')][_0xb779('0x37')]){_0x21b92f['include']=[{'all':!![]}];}_0x21b92f=_[_0xb779('0x35')]({},_0x21b92f,_0x240d8d[_0xb779('0x36')]);return db[_0xb779('0x25')][_0xb779('0x21')](_0x21b92f)[_0xb779('0x14')](handleEntityNotFound(_0xb101f5,null))[_0xb779('0x14')](respondWithResult(_0xb101f5,null))[_0xb779('0x3d')](handleError(_0xb101f5,null));};exports[_0xb779('0x13')]=function(_0x11b335,_0x251bf5){return db[_0xb779('0x25')][_0xb779('0x21')]({'where':{'id':_0x11b335['params']['id']}})[_0xb779('0x14')](handleEntityNotFound(_0x251bf5,null))[_0xb779('0x14')](removeEntity(_0x251bf5,null))[_0xb779('0x3d')](handleError(_0x251bf5,null));};exports[_0xb779('0x3e')]=function(_0xfefda5,_0x1c6059){if(_0xfefda5['body']['type']===_0xb779('0x19')&&!_[_0xb779('0x3f')](_0xfefda5['body'][_0xb779('0x40')],'_')){_0xfefda5[_0xb779('0x41')][_0xb779('0x40')]='_'[_0xb779('0x42')](_0xfefda5['body'][_0xb779('0x40')]);}return db['VoiceExtension'][_0xb779('0x3e')](_0xfefda5[_0xb779('0x41')],{'raw':![]})[_0xb779('0x14')](function(_0xe49e25){var _0x21472d=_0xfefda5[_0xb779('0x43')][_0xb779('0x15')]({'plain':!![]});if(!_0x21472d)throw new Error(_0xb779('0x44'));if(_0x21472d['role']===_0xb779('0x43')){var _0x573b57=_0xe49e25['get']({'plain':!![]});var _0x8d1c28=[{'name':_0xb779('0x16'),'value':_0xb779('0x17')},{'name':'OutboundRoutes','value':_0xb779('0x19')},{'name':_0xb779('0x1a'),'value':_0xb779('0x1b')}];var _0x5b19c4=_[_0xb779('0x21')](_0x8d1c28,[_0xb779('0x1e'),_0x573b57[_0xb779('0x20')]])[_0xb779('0x24')];return db[_0xb779('0x45')]['find']({'where':{'name':_0x5b19c4,'userProfileId':_0x21472d['userProfileId']},'raw':!![]})['then'](function(_0x49f065){if(_0x49f065&&_0x49f065[_0xb779('0x46')]===0x0){return db[_0xb779('0x47')]['create']({'name':_0x573b57[_0xb779('0x24')],'resourceId':_0x573b57['id'],'type':_0x49f065[_0xb779('0x24')],'sectionId':_0x49f065['id']},{})[_0xb779('0x14')](function(){return _0xe49e25;});}else{return _0xe49e25;}})[_0xb779('0x3d')](function(_0x46adf2){logger[_0xb779('0x22')](_0xb779('0x48'),_0x46adf2);throw _0x46adf2;});}return _0xe49e25;})[_0xb779('0x14')](respondWithResult(_0x1c6059,0xc9))[_0xb779('0x3d')](handleError(_0x1c6059,null));};exports[_0xb779('0x49')]=function(_0x3407be,_0x2d7839){if(_0x3407be['body']['id']){delete _0x3407be[_0xb779('0x41')]['id'];}return db['VoiceExtension'][_0xb779('0x21')]({'where':{'id':_0x3407be[_0xb779('0x3a')]['id']}})[_0xb779('0x14')](handleEntityNotFound(_0x2d7839,null))[_0xb779('0x14')](function(_0x4d38a3){if(_0x4d38a3){return db[_0xb779('0x25')][_0xb779('0x49')](_[_0xb779('0x33')](_0x3407be[_0xb779('0x41')],['exten','context','description',_0xb779('0x4a'),_0xb779('0x4b'),_0xb779('0x4c'),_0xb779('0x4d')]),{'where':{'context':_0x4d38a3[_0xb779('0x4e')],'exten':_0x4d38a3[_0xb779('0x40')]},'individualHooks':!![]})['then'](function(_0x31a1f6){return _0x31a1f6;});}return null;})[_0xb779('0x14')](respondWithStatusCode(_0x2d7839,null))[_0xb779('0x3d')](handleError(_0x2d7839,null));};exports['addApplications']=function(_0x3d53b4,_0x476a52){var _0x16f25c=_0x3d53b4[_0xb779('0x3a')]['id'];var _0x26357a=_0x3d53b4[_0xb779('0x41')];var _0x599447=0xc8;var _0x36c92f=null;return db[_0xb779('0x4f')][_0xb779('0x50')]({'isolationLevel':db[_0xb779('0x4f')][_0xb779('0x51')][_0xb779('0x52')]['READ_COMMITTED']},function(_0x2f271f){return db[_0xb779('0x25')]['findOne']({'where':{'id':_0x16f25c},'transaction':_0x2f271f})[_0xb779('0x14')](function(_0x13d83b){if(_0x13d83b){return db[_0xb779('0x25')]['destroy']({'where':{'VoiceExtensionId':_0x16f25c},'transaction':_0x2f271f})[_0xb779('0x14')](function(){var _0x8ec29e=_[_0xb779('0x29')](_0x26357a,function(_0x5c1df1){_0x5c1df1['VoiceExtensionId']=_0x16f25c;_0x5c1df1[_0xb779('0x53')]=!![];return _0x5c1df1;});return _0x13d83b['createRouting'](_0x8ec29e);})[_0xb779('0x14')](function(_0x549e84){return db['VoiceExtension'][_0xb779('0x54')](_0x549e84,{'transaction':_0x2f271f});});}else{_0x599447=0x194;_0x36c92f=[];}});})[_0xb779('0x14')](function(){if(_0x599447!==0x194){return db[_0xb779('0x25')][_0xb779('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x16f25c},'order':_0xb779('0x56')})['then'](function(_0x3c72eb){_0x36c92f=_0x3c72eb;});}})[_0xb779('0x3d')](function(_0x4b47e5){_0x599447=0x1f4;logger['error'](_0x4b47e5[_0xb779('0x23')]);if(_0x4b47e5[_0xb779('0x24')]){delete _0x4b47e5[_0xb779('0x24')];}_0x36c92f=_0x4b47e5;})[_0xb779('0x57')](function(){if(_0x36c92f===null){_0x476a52[_0xb779('0x9')](_0x599447);}else{if(_0x599447===0x1f4){_0x476a52['status'](_0x599447)[_0xb779('0x58')](_0x36c92f);}else{_0x476a52[_0xb779('0x10')](_0x599447)['json'](_0x36c92f);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index e403e75..7ae7289 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 _0x10c4=['hook','exports','events','../../mysqldb','save','remove','emit'];(function(_0x18fc00,_0x4a93d1){var _0x2ab2bd=function(_0x119745){while(--_0x119745){_0x18fc00['push'](_0x18fc00['shift']());}};_0x2ab2bd(++_0x4a93d1);}(_0x10c4,0x17c));var _0x410c=function(_0x1bd5b7,_0x5efc82){_0x1bd5b7=_0x1bd5b7-0x0;var _0x126235=_0x10c4[_0x1bd5b7];return _0x126235;};'use strict';var EventEmitter=require(_0x410c('0x0'));var VoiceExtension=require(_0x410c('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x410c('0x2'),'afterUpdate':'update','afterDestroy':_0x410c('0x3')};function emitEvent(_0x321db4){return function(_0x5ad004,_0x145d11,_0x141580){VoiceExtensionEvents[_0x410c('0x4')](_0x321db4+':'+_0x5ad004['id'],_0x5ad004);VoiceExtensionEvents[_0x410c('0x4')](_0x321db4,_0x5ad004);_0x141580(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x410c('0x5')](e,emitEvent(event));}}module[_0x410c('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5850=['events','VoiceExtension','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x29bb51,_0x1fb819){var _0x2dbdb3=function(_0x2b038d){while(--_0x2b038d){_0x29bb51['push'](_0x29bb51['shift']());}};_0x2dbdb3(++_0x1fb819);}(_0x5850,0x196));var _0x0585=function(_0x1d3d6f,_0xf1c065){_0x1d3d6f=_0x1d3d6f-0x0;var _0x3d5db7=_0x5850[_0x1d3d6f];return _0x3d5db7;};'use strict';var EventEmitter=require(_0x0585('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x0585('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0585('0x2')](0x0);var events={'afterCreate':_0x0585('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x326d07){return function(_0x4c9b2b,_0x4a79ce,_0x23580a){VoiceExtensionEvents[_0x0585('0x4')](_0x326d07+':'+_0x4c9b2b['id'],_0x4c9b2b);VoiceExtensionEvents['emit'](_0x326d07,_0x4c9b2b);_0x23580a(null);};}for(var e in events){if(events[_0x0585('0x5')](e)){var event=events[e];VoiceExtension[_0x0585('0x6')](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 2e103d9..f024ccf 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 _0x64f7=['catch','define','VoiceExtension','voice_extensions','get','concat','Hangup','./voiceExtension.attributes','exports','type','context','exten','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','inbound','Set','CDR(routeid)=','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','length','trunk','param','phone','split','prefix','${EXTEN:','${EXTEN}','SIP','none','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','map','tag','toLowerCase','CDR(tag)=','callerID','Set(CALLERID(all)=','playback','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last'];(function(_0x1298e5,_0x429a78){var _0x39d2b0=function(_0x5dd000){while(--_0x5dd000){_0x1298e5['push'](_0x1298e5['shift']());}};_0x39d2b0(++_0x429a78);}(_0x64f7,0xa3));var _0x764f=function(_0x1c190b,_0x12bfb1){_0x1c190b=_0x1c190b-0x0;var _0x53535a=_0x64f7[_0x1c190b];return _0x53535a;};'use strict';var _=require('lodash');var attributes=require(_0x764f('0x0'));module[_0x764f('0x1')]=function(_0x368a80){var _0x585aff=_0x368a80['models'];function _0x5f0064(_0x183ed3){var _0x594a2d=0x2;var _0x425fc4=[{'type':_0x183ed3[_0x764f('0x2')],'app':'Set','appdata':'CDR(type)='+_0x183ed3['type'],'context':_0x183ed3[_0x764f('0x3')],'exten':_0x183ed3[_0x764f('0x4')],'priority':_0x594a2d++,'VoiceExtensionId':_0x183ed3['id']},{'type':_0x183ed3[_0x764f('0x2')],'app':_0x183ed3['alias']?'Set':_0x764f('0x5'),'appdata':_0x183ed3['alias']?_0x764f('0x6')+_0x183ed3[_0x764f('0x7')]:_0x764f('0x8'),'context':_0x183ed3['context'],'exten':_0x183ed3[_0x764f('0x4')],'priority':_0x594a2d++,'VoiceExtensionId':_0x183ed3['id']}];if(_0x183ed3['type']==='inbound'){_0x425fc4['push']({'type':_0x764f('0x9'),'app':_0x764f('0xa'),'appdata':_0x764f('0xb')+_0x183ed3['id'],'context':_0x183ed3['context'],'exten':_0x183ed3[_0x764f('0x4')],'priority':_0x594a2d++,'VoiceExtensionId':_0x183ed3['id']});}_0x425fc4[_0x764f('0xc')]({'type':_0x183ed3[_0x764f('0x2')],'app':_0x764f('0xa'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x183ed3[_0x764f('0x3')],'exten':_0x183ed3[_0x764f('0x4')],'priority':_0x594a2d++,'VoiceExtensionId':_0x183ed3['id']},{'type':_0x183ed3[_0x764f('0x2')],'app':_0x764f('0xa'),'appdata':_0x764f('0xd'),'context':_0x183ed3[_0x764f('0x3')],'exten':_0x183ed3[_0x764f('0x4')],'priority':_0x594a2d++,'VoiceExtensionId':_0x183ed3['id']},{'type':_0x183ed3[_0x764f('0x2')],'app':'Set','appdata':_0x764f('0xe'),'context':_0x183ed3[_0x764f('0x3')],'exten':_0x183ed3[_0x764f('0x4')],'priority':_0x594a2d++,'VoiceExtensionId':_0x183ed3['id']});return _0x425fc4;}function _0x3e3316(_0x1f4265){var _0x3cceb8=0x2;var _0x139e46=[{'type':_0x764f('0xf'),'app':_0x764f('0xa'),'appdata':_0x764f('0x10'),'context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265['exten'],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':_0x764f('0xf'),'app':_0x1f4265[_0x764f('0x7')]?_0x764f('0xa'):_0x764f('0x5'),'appdata':_0x1f4265['alias']?'CDR(routeAlias)='+_0x1f4265[_0x764f('0x7')]:_0x764f('0x8'),'context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265['exten'],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':_0x764f('0xf'),'app':_0x764f('0xa'),'appdata':_0x764f('0x11')+(_0x1f4265['cutdigits']?'${EXTEN:'+_0x1f4265[_0x764f('0x12')]+'}':'${EXTEN}'),'context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265[_0x764f('0x4')],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':_0x764f('0xf'),'app':_0x764f('0xa'),'appdata':_0x764f('0xb')+_0x1f4265['id'],'context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265[_0x764f('0x4')],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':_0x764f('0xf'),'app':_0x764f('0x13'),'appdata':_0x764f('0x14')+(_0x3cceb8+0x2)+'):Goto('+(_0x3cceb8+0x1)+')','context':_0x1f4265['context'],'exten':_0x1f4265['exten'],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':_0x764f('0xf'),'app':_0x764f('0xa'),'appdata':_0x1f4265[_0x764f('0x12')]?_0x764f('0x15')+_0x1f4265[_0x764f('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265[_0x764f('0x4')],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':_0x764f('0xf'),'app':_0x764f('0xa'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1f4265['context'],'exten':_0x1f4265[_0x764f('0x4')],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':_0x764f('0xf'),'app':_0x764f('0xa'),'appdata':_0x764f('0xd'),'context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265[_0x764f('0x4')],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':'outbound','app':_0x764f('0xa'),'appdata':_0x764f('0xe'),'context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265[_0x764f('0x4')],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':_0x764f('0xf'),'app':_0x764f('0xa'),'appdata':_0x764f('0x16')+_0x1f4265['id'],'context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265[_0x764f('0x4')],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']}];if(_0x1f4265[_0x764f('0x17')](_0x764f('0x18'))&&_0x1f4265['recordingFormat']!=='none'){_0x139e46[_0x764f('0xc')]({'type':_0x764f('0xf'),'app':_0x764f('0xa'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265[_0x764f('0x4')],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']},{'type':'outbound','app':_0x764f('0xa'),'appdata':_0x764f('0x19')+_0x1f4265['recordingFormat']||_0x764f('0x1a'),'context':_0x1f4265[_0x764f('0x3')],'exten':_0x1f4265[_0x764f('0x4')],'priority':_0x3cceb8++,'VoiceExtensionId':_0x1f4265['id']});}return _0x139e46;}function _0x2f5403(_0x21c1cc,_0x584478){var _0x536e31=[{'name':'trunk','param':0x0},{'name':_0x764f('0x1b'),'param':0x1},{'name':_0x764f('0x1c'),'param':0x2},{'name':_0x764f('0x1d'),'param':0x3}];var _0x2247df={};var _0x42c7f8=_0x584478['split'](',');var _0x36cfd0=[];for(var _0x35937a=0x0;_0x35937a<_0x536e31[_0x764f('0x1e')];_0x35937a++){switch(_0x536e31[_0x35937a]['name']){case _0x764f('0x1f'):_0x2247df[_0x764f('0x1f')]=_0x42c7f8[_0x536e31[_0x35937a][_0x764f('0x20')]]['split']('/')[0x1];_0x2247df[_0x764f('0x21')]=_0x42c7f8[_0x536e31[_0x35937a][_0x764f('0x20')]][_0x764f('0x22')]('/')[0x2];_0x2247df['prefix']=_0x2247df[_0x764f('0x21')]?_0x2247df[_0x764f('0x21')]['split']('$')[0x0]:undefined;_0x2247df[_0x764f('0x21')]=_0x21c1cc[_0x764f('0x12')]?(_0x2247df[_0x764f('0x23')]||'')+_0x764f('0x24')+_0x21c1cc[_0x764f('0x12')]+'}':(_0x2247df['prefix']||'')+_0x764f('0x25');_0x36cfd0[_0x536e31[_0x35937a][_0x764f('0x20')]]=[_0x764f('0x26'),_0x2247df[_0x764f('0x1f')],_0x2247df[_0x764f('0x21')]]['join']('/');break;case _0x764f('0x1c'):_0x2247df['options']=_0x42c7f8[_0x536e31[_0x35937a]['param']];if(_0x21c1cc['recordingFormat']!==_0x764f('0x27')){if(_0x2247df[_0x764f('0x1c')]['indexOf'](_0x764f('0x28'))<0x0){_0x2247df['options']+=_0x764f('0x28');}}else{_0x2247df[_0x764f('0x1c')]=_0x2247df[_0x764f('0x1c')][_0x764f('0x29')](_0x764f('0x28'),'');}_0x36cfd0[_0x536e31[_0x35937a][_0x764f('0x20')]]=_0x2247df[_0x764f('0x1c')];break;default:_0x36cfd0[_0x536e31[_0x35937a][_0x764f('0x20')]]=_0x42c7f8[_0x536e31[_0x35937a][_0x764f('0x20')]];}}return _0x36cfd0[_0x764f('0x2a')](',');}function _0x1aad7d(_0x41b5a0,_0x4a5eac,_0x98460c){return new Promise(function(_0x3aa761,_0x3595e9){var _0x1f800b=[];if(_[_0x764f('0x2b')](_0x4a5eac))return _0x3aa761(_0x1f800b);_0x585aff[_0x764f('0x2c')][_0x764f('0x2d')]({'attributes':['id',_0x764f('0x2e'),_0x764f('0x2f')],'raw':!![]})[_0x764f('0x30')](function(_0x4f7b40){for(var _0x10a032=0x0,_0x1f967e=0x0;_0x10a032<_0x4a5eac[_0x764f('0x1e')];_0x10a032++,_0x1f967e=0x0){var _0x2f686f=_0x4a5eac[_0x10a032];var _0x5e1e29=[];var _0x4e7117=[];delete _0x2f686f['id'];if(_0x2f686f[_0x764f('0x2e')]!=='*,*,*,*'){_0x2f686f[_0x764f('0x31')]=[_0x2f686f['interval']];}else{_0x2f686f['intervals']=_0x2f686f['IntervalId']?_[_0x764f('0x32')](_['filter'](_0x4f7b40,{'IntervalId':_0x2f686f['IntervalId']}),'interval'):[];}_0x2f686f[_0x764f('0x3')]=_0x41b5a0[_0x764f('0x3')];_0x2f686f[_0x764f('0x4')]=_0x41b5a0[_0x764f('0x4')];if(_0x2f686f[_0x764f('0x2')])_0x2f686f[_0x764f('0x2')]=_0x2f686f[_0x764f('0x2')]['toLowerCase']();if(_0x41b5a0[_0x764f('0x2')]===_0x764f('0xf')){if(_0x2f686f[_0x764f('0x17')](_0x764f('0x33'))&&_0x2f686f['tag']&&_0x2f686f[_0x764f('0x33')]!=='--'){_0x5e1e29[_0x764f('0xc')]({'type':_0x2f686f[_0x764f('0x2')][_0x764f('0x34')](),'app':'Set','appdata':_0x764f('0x35')+_0x2f686f['tag'],'context':_0x41b5a0[_0x764f('0x3')],'exten':_0x41b5a0[_0x764f('0x4')],'priority':_0x2f686f[_0x764f('0x31')]['length']+_0x98460c+_0x1f967e++,'VoiceExtensionId':_0x41b5a0['id']});}_0x5e1e29[_0x764f('0xc')]({'type':_0x2f686f[_0x764f('0x2')][_0x764f('0x34')](),'app':_0x764f('0x13'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x2f686f[_0x764f('0x36')]?_0x764f('0x37')+_0x2f686f[_0x764f('0x36')]+')':'NoOp(No\x20number\x20available)'),'context':_0x41b5a0[_0x764f('0x3')],'exten':_0x41b5a0[_0x764f('0x4')],'priority':_0x2f686f[_0x764f('0x31')][_0x764f('0x1e')]+_0x98460c+_0x1f967e++,'VoiceExtensionId':_0x41b5a0['id']});}else{if(_0x2f686f[_0x764f('0x17')]('answer')){if(['queue',_0x764f('0x38')][_0x764f('0x39')](_0x2f686f[_0x764f('0x3a')]['toLowerCase']())&&_0x2f686f['appType']!==_0x764f('0x3b')){if(_0x2f686f[_0x764f('0x3c')]){_0x5e1e29['push']({'type':_0x2f686f[_0x764f('0x2')][_0x764f('0x34')](),'app':_0x764f('0x13'),'appdata':_0x764f('0x3d'),'context':_0x41b5a0[_0x764f('0x3')],'exten':_0x41b5a0[_0x764f('0x4')],'priority':_0x2f686f['intervals'][_0x764f('0x1e')]+_0x98460c+_0x1f967e++,'VoiceExtensionId':_0x41b5a0['id']});_0x5e1e29[_0x764f('0xc')]({'type':_0x2f686f[_0x764f('0x2')][_0x764f('0x34')](),'app':_0x764f('0xa'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x41b5a0['context'],'exten':_0x41b5a0[_0x764f('0x4')],'priority':_0x2f686f[_0x764f('0x31')][_0x764f('0x1e')]+_0x98460c+_0x1f967e++,'VoiceExtensionId':_0x41b5a0['id']});}else{_0x5e1e29[_0x764f('0xc')]({'type':_0x2f686f[_0x764f('0x2')]['toLowerCase'](),'app':_0x764f('0x13'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x41b5a0['context'],'exten':_0x41b5a0[_0x764f('0x4')],'priority':_0x2f686f['intervals']['length']+_0x98460c+_0x1f967e++,'VoiceExtensionId':_0x41b5a0['id']});_0x5e1e29[_0x764f('0xc')]({'type':_0x2f686f[_0x764f('0x2')]['toLowerCase'](),'app':_0x764f('0xa'),'appdata':_0x764f('0x3e'),'context':_0x41b5a0[_0x764f('0x3')],'exten':_0x41b5a0[_0x764f('0x4')],'priority':_0x2f686f['intervals'][_0x764f('0x1e')]+_0x98460c+_0x1f967e++,'VoiceExtensionId':_0x41b5a0['id']});}}}}for(var _0x18c1e0=0x0;_0x18c1e0<_0x2f686f[_0x764f('0x31')][_0x764f('0x1e')];_0x18c1e0++){var _0x8ac1c0=_0x98460c+_0x2f686f[_0x764f('0x31')][_0x764f('0x1e')];var _0x38c565=_0x18c1e0===_0x2f686f['intervals'][_0x764f('0x1e')]-0x1?_0x98460c+_0x5e1e29[_0x764f('0x1e')]+_0x4e7117[_0x764f('0x1e')]+0x2:_0x98460c+_0x18c1e0+0x1;_0x5e1e29[_0x764f('0x3f')](_0x18c1e0,0x0,{'type':_0x41b5a0['type'],'app':'GotoIfTime','appdata':_0x2f686f['intervals'][_0x18c1e0]+'?'+_0x41b5a0[_0x764f('0x3')]+_0x764f('0x40')+_0x8ac1c0+':'+_0x41b5a0[_0x764f('0x3')]+',${EXTEN},'+_0x38c565,'exten':_0x41b5a0[_0x764f('0x4')],'context':_0x41b5a0['context'],'priority':_0x98460c+_0x18c1e0,'VoiceExtensionId':_0x41b5a0['id']});}if(_0x2f686f[_0x764f('0x41')]==='outboundDial'){_0x2f686f[_0x764f('0x42')]=_0x2f5403(_0x41b5a0,_0x2f686f[_0x764f('0x42')]);}if(_0x2f686f[_0x764f('0x41')]===_0x764f('0x43')){_0x5e1e29[_0x764f('0xc')]({'type':_0x2f686f['type'][_0x764f('0x34')](),'app':_0x764f('0xa'),'appdata':_0x764f('0x44'),'context':_0x41b5a0['context'],'exten':_0x41b5a0[_0x764f('0x4')],'priority':_0x2f686f['intervals'][_0x764f('0x1e')]+_0x98460c+_0x1f967e++,'VoiceExtensionId':_0x41b5a0['id']});}_0x2f686f[_0x764f('0x45')]=_0x5e1e29[_0x764f('0x1e')]?_[_0x764f('0x46')](_0x5e1e29)[_0x764f('0x45')]+0x1:_0x98460c;_0x1f800b=_['concat'](_0x1f800b,_0x5e1e29,[_0x2f686f],_0x4e7117);_0x98460c=_[_0x764f('0x46')](_0x1f800b)[_0x764f('0x45')]+0x1;}return _0x3aa761(_0x1f800b);})[_0x764f('0x47')](function(_0xdad216){_0x3595e9(_0xdad216);});});}return _0x368a80[_0x764f('0x48')](_0x764f('0x49'),attributes,{'tableName':_0x764f('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x354e28){var _0x25d507=this[_0x764f('0x4b')]({'plain':!![]});var _0x1760ac=_0x25d507[_0x764f('0x2')]===_0x764f('0xf')?_0x3e3316(_0x25d507):_0x5f0064(_0x25d507);return _0x1aad7d(_0x25d507,_0x354e28,_[_0x764f('0x46')](_0x1760ac)['priority']+0x1)[_0x764f('0x30')](function(_0x2daedb){var _0x146615=_[_0x764f('0x4c')](_0x1760ac,_0x2daedb);_0x146615[_0x764f('0xc')]({'type':_0x25d507[_0x764f('0x2')],'app':_0x764f('0x4d'),'exten':_0x25d507[_0x764f('0x4')],'context':_0x25d507[_0x764f('0x3')],'priority':_[_0x764f('0x46')](_0x146615)[_0x764f('0x45')]+0x1,'VoiceExtensionId':_0x25d507['id']});return _0x146615;});}}});}; \ No newline at end of file +var _0x3182=['inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','split','trunk','param','phone','prefix','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','interval','IntervalId','then','length','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','Set','CDR(type)=','type','context','exten','alias','No\x20alias\x20set'];(function(_0x22c19e,_0x574112){var _0x387ffa=function(_0x410842){while(--_0x410842){_0x22c19e['push'](_0x22c19e['shift']());}};_0x387ffa(++_0x574112);}(_0x3182,0x99));var _0x2318=function(_0x3d2295,_0x2eb436){_0x3d2295=_0x3d2295-0x0;var _0x2fb84a=_0x3182[_0x3d2295];return _0x2fb84a;};'use strict';var _=require(_0x2318('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x2318('0x1')]=function(_0x57d04b){var _0x11da18=_0x57d04b['models'];function _0xaf0d9e(_0x5b0d74){var _0x556d75=0x2;var _0x21cd0a=[{'type':_0x5b0d74['type'],'app':_0x2318('0x2'),'appdata':_0x2318('0x3')+_0x5b0d74[_0x2318('0x4')],'context':_0x5b0d74[_0x2318('0x5')],'exten':_0x5b0d74[_0x2318('0x6')],'priority':_0x556d75++,'VoiceExtensionId':_0x5b0d74['id']},{'type':_0x5b0d74['type'],'app':_0x5b0d74[_0x2318('0x7')]?_0x2318('0x2'):'NoOp','appdata':_0x5b0d74[_0x2318('0x7')]?'CDR(routeAlias)='+_0x5b0d74[_0x2318('0x7')]:_0x2318('0x8'),'context':_0x5b0d74['context'],'exten':_0x5b0d74['exten'],'priority':_0x556d75++,'VoiceExtensionId':_0x5b0d74['id']}];if(_0x5b0d74['type']===_0x2318('0x9')){_0x21cd0a[_0x2318('0xa')]({'type':_0x2318('0x9'),'app':_0x2318('0x2'),'appdata':_0x2318('0xb')+_0x5b0d74['id'],'context':_0x5b0d74[_0x2318('0x5')],'exten':_0x5b0d74[_0x2318('0x6')],'priority':_0x556d75++,'VoiceExtensionId':_0x5b0d74['id']});}_0x21cd0a['push']({'type':_0x5b0d74[_0x2318('0x4')],'app':_0x2318('0x2'),'appdata':_0x2318('0xc'),'context':_0x5b0d74[_0x2318('0x5')],'exten':_0x5b0d74[_0x2318('0x6')],'priority':_0x556d75++,'VoiceExtensionId':_0x5b0d74['id']},{'type':_0x5b0d74['type'],'app':_0x2318('0x2'),'appdata':_0x2318('0xd'),'context':_0x5b0d74[_0x2318('0x5')],'exten':_0x5b0d74[_0x2318('0x6')],'priority':_0x556d75++,'VoiceExtensionId':_0x5b0d74['id']},{'type':_0x5b0d74[_0x2318('0x4')],'app':_0x2318('0x2'),'appdata':_0x2318('0xe'),'context':_0x5b0d74[_0x2318('0x5')],'exten':_0x5b0d74['exten'],'priority':_0x556d75++,'VoiceExtensionId':_0x5b0d74['id']});return _0x21cd0a;}function _0x46aa1f(_0x4f38b0){var _0x5e97b7=0x2;var _0x1960a3=[{'type':_0x2318('0xf'),'app':_0x2318('0x2'),'appdata':_0x2318('0x10'),'context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0[_0x2318('0x6')],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':'outbound','app':_0x4f38b0['alias']?_0x2318('0x2'):'NoOp','appdata':_0x4f38b0[_0x2318('0x7')]?'CDR(routeAlias)='+_0x4f38b0[_0x2318('0x7')]:_0x2318('0x8'),'context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0[_0x2318('0x6')],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':_0x2318('0xf'),'app':_0x2318('0x2'),'appdata':'CDR(destination)='+(_0x4f38b0[_0x2318('0x11')]?_0x2318('0x12')+_0x4f38b0[_0x2318('0x11')]+'}':_0x2318('0x13')),'context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0[_0x2318('0x6')],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':_0x2318('0xf'),'app':_0x2318('0x2'),'appdata':_0x2318('0xb')+_0x4f38b0['id'],'context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0[_0x2318('0x6')],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':_0x2318('0xf'),'app':_0x2318('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5e97b7+0x2)+_0x2318('0x15')+(_0x5e97b7+0x1)+')','context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0[_0x2318('0x6')],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':_0x2318('0xf'),'app':_0x2318('0x2'),'appdata':_0x4f38b0[_0x2318('0x11')]?_0x2318('0x16')+_0x4f38b0[_0x2318('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0['exten'],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':_0x2318('0xf'),'app':_0x2318('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0[_0x2318('0x6')],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':_0x2318('0xf'),'app':_0x2318('0x2'),'appdata':_0x2318('0xd'),'context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0['exten'],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':_0x2318('0xf'),'app':_0x2318('0x2'),'appdata':_0x2318('0xe'),'context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0['exten'],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':_0x2318('0xf'),'app':_0x2318('0x2'),'appdata':_0x2318('0x17')+_0x4f38b0['id'],'context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0[_0x2318('0x6')],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']}];if(_0x4f38b0[_0x2318('0x18')](_0x2318('0x19'))&&_0x4f38b0[_0x2318('0x19')]!==_0x2318('0x1a')){_0x1960a3['push']({'type':_0x2318('0xf'),'app':'Set','appdata':_0x2318('0x1b'),'context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0['exten'],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']},{'type':'outbound','app':_0x2318('0x2'),'appdata':_0x2318('0x1c')+_0x4f38b0[_0x2318('0x19')]||'wav','context':_0x4f38b0[_0x2318('0x5')],'exten':_0x4f38b0[_0x2318('0x6')],'priority':_0x5e97b7++,'VoiceExtensionId':_0x4f38b0['id']});}return _0x1960a3;}function _0x4347ec(_0x1c7b04,_0x567e82){var _0x1280f9=[{'name':'trunk','param':0x0},{'name':_0x2318('0x1d'),'param':0x1},{'name':_0x2318('0x1e'),'param':0x2},{'name':_0x2318('0x1f'),'param':0x3}];var _0x12b33c={};var _0x40edc0=_0x567e82[_0x2318('0x20')](',');var _0xb234e8=[];for(var _0x57b34e=0x0;_0x57b34e<_0x1280f9['length'];_0x57b34e++){switch(_0x1280f9[_0x57b34e]['name']){case'trunk':_0x12b33c[_0x2318('0x21')]=_0x40edc0[_0x1280f9[_0x57b34e][_0x2318('0x22')]][_0x2318('0x20')]('/')[0x1];_0x12b33c[_0x2318('0x23')]=_0x40edc0[_0x1280f9[_0x57b34e][_0x2318('0x22')]][_0x2318('0x20')]('/')[0x2];_0x12b33c[_0x2318('0x24')]=_0x12b33c[_0x2318('0x23')]?_0x12b33c[_0x2318('0x23')][_0x2318('0x20')]('$')[0x0]:undefined;_0x12b33c['phone']=_0x1c7b04[_0x2318('0x11')]?(_0x12b33c[_0x2318('0x24')]||'')+_0x2318('0x12')+_0x1c7b04[_0x2318('0x11')]+'}':(_0x12b33c['prefix']||'')+_0x2318('0x13');_0xb234e8[_0x1280f9[_0x57b34e][_0x2318('0x22')]]=[_0x2318('0x25'),_0x12b33c[_0x2318('0x21')],_0x12b33c[_0x2318('0x23')]]['join']('/');break;case _0x2318('0x1e'):_0x12b33c[_0x2318('0x1e')]=_0x40edc0[_0x1280f9[_0x57b34e][_0x2318('0x22')]];if(_0x1c7b04[_0x2318('0x19')]!==_0x2318('0x1a')){if(_0x12b33c['options'][_0x2318('0x26')]('U(xcally-mixmonitor-context)')<0x0){_0x12b33c[_0x2318('0x1e')]+=_0x2318('0x27');}}else{_0x12b33c[_0x2318('0x1e')]=_0x12b33c[_0x2318('0x1e')][_0x2318('0x28')](_0x2318('0x27'),'');}_0xb234e8[_0x1280f9[_0x57b34e][_0x2318('0x22')]]=_0x12b33c['options'];break;default:_0xb234e8[_0x1280f9[_0x57b34e][_0x2318('0x22')]]=_0x40edc0[_0x1280f9[_0x57b34e]['param']];}}return _0xb234e8[_0x2318('0x29')](',');}function _0x2a2d00(_0x2a1f6e,_0x2c438,_0x3442d8){return new Promise(function(_0x51ce31,_0x24c4fe){var _0xe1cdce=[];if(_[_0x2318('0x2a')](_0x2c438))return _0x51ce31(_0xe1cdce);_0x11da18[_0x2318('0x2b')]['findAll']({'attributes':['id',_0x2318('0x2c'),_0x2318('0x2d')],'raw':!![]})[_0x2318('0x2e')](function(_0x56bd4a){for(var _0x3a0aeb=0x0,_0x4a7d01=0x0;_0x3a0aeb<_0x2c438[_0x2318('0x2f')];_0x3a0aeb++,_0x4a7d01=0x0){var _0x2e0f62=_0x2c438[_0x3a0aeb];var _0x3eb534=[];var _0x49b879=[];delete _0x2e0f62['id'];if(_0x2e0f62[_0x2318('0x2c')]!==_0x2318('0x30')){_0x2e0f62[_0x2318('0x31')]=[_0x2e0f62[_0x2318('0x2c')]];}else{_0x2e0f62['intervals']=_0x2e0f62[_0x2318('0x2d')]?_[_0x2318('0x32')](_['filter'](_0x56bd4a,{'IntervalId':_0x2e0f62[_0x2318('0x2d')]}),_0x2318('0x2c')):[];}_0x2e0f62[_0x2318('0x5')]=_0x2a1f6e['context'];_0x2e0f62[_0x2318('0x6')]=_0x2a1f6e['exten'];if(_0x2e0f62[_0x2318('0x4')])_0x2e0f62['type']=_0x2e0f62['type']['toLowerCase']();if(_0x2a1f6e[_0x2318('0x4')]===_0x2318('0xf')){if(_0x2e0f62['hasOwnProperty'](_0x2318('0x33'))&&_0x2e0f62['tag']&&_0x2e0f62[_0x2318('0x33')]!=='--'){_0x3eb534[_0x2318('0xa')]({'type':_0x2e0f62['type'][_0x2318('0x34')](),'app':_0x2318('0x2'),'appdata':_0x2318('0x35')+_0x2e0f62[_0x2318('0x33')],'context':_0x2a1f6e[_0x2318('0x5')],'exten':_0x2a1f6e['exten'],'priority':_0x2e0f62[_0x2318('0x31')]['length']+_0x3442d8+_0x4a7d01++,'VoiceExtensionId':_0x2a1f6e['id']});}_0x3eb534['push']({'type':_0x2e0f62[_0x2318('0x4')][_0x2318('0x34')](),'app':_0x2318('0x14'),'appdata':_0x2318('0x36')+(_0x2e0f62[_0x2318('0x37')]?_0x2318('0x38')+_0x2e0f62[_0x2318('0x37')]+')':_0x2318('0x39')),'context':_0x2a1f6e[_0x2318('0x5')],'exten':_0x2a1f6e['exten'],'priority':_0x2e0f62[_0x2318('0x31')][_0x2318('0x2f')]+_0x3442d8+_0x4a7d01++,'VoiceExtensionId':_0x2a1f6e['id']});}else{if(_0x2e0f62[_0x2318('0x18')](_0x2318('0x3a'))){if([_0x2318('0x3b'),'playback']['includes'](_0x2e0f62[_0x2318('0x3c')][_0x2318('0x34')]())&&_0x2e0f62['appType']!==_0x2318('0x3d')){if(_0x2e0f62[_0x2318('0x3a')]){_0x3eb534['push']({'type':_0x2e0f62[_0x2318('0x4')][_0x2318('0x34')](),'app':_0x2318('0x14'),'appdata':_0x2318('0x3e'),'context':_0x2a1f6e['context'],'exten':_0x2a1f6e[_0x2318('0x6')],'priority':_0x2e0f62[_0x2318('0x31')]['length']+_0x3442d8+_0x4a7d01++,'VoiceExtensionId':_0x2a1f6e['id']});_0x3eb534[_0x2318('0xa')]({'type':_0x2e0f62[_0x2318('0x4')]['toLowerCase'](),'app':_0x2318('0x2'),'appdata':_0x2318('0x3f'),'context':_0x2a1f6e['context'],'exten':_0x2a1f6e[_0x2318('0x6')],'priority':_0x2e0f62['intervals'][_0x2318('0x2f')]+_0x3442d8+_0x4a7d01++,'VoiceExtensionId':_0x2a1f6e['id']});}else{_0x3eb534[_0x2318('0xa')]({'type':_0x2e0f62['type']['toLowerCase'](),'app':'ExecIf','appdata':_0x2318('0x40'),'context':_0x2a1f6e[_0x2318('0x5')],'exten':_0x2a1f6e[_0x2318('0x6')],'priority':_0x2e0f62['intervals'][_0x2318('0x2f')]+_0x3442d8+_0x4a7d01++,'VoiceExtensionId':_0x2a1f6e['id']});_0x3eb534[_0x2318('0xa')]({'type':_0x2e0f62[_0x2318('0x4')][_0x2318('0x34')](),'app':_0x2318('0x2'),'appdata':_0x2318('0x41'),'context':_0x2a1f6e[_0x2318('0x5')],'exten':_0x2a1f6e['exten'],'priority':_0x2e0f62['intervals'][_0x2318('0x2f')]+_0x3442d8+_0x4a7d01++,'VoiceExtensionId':_0x2a1f6e['id']});}}}}for(var _0x7a1880=0x0;_0x7a1880<_0x2e0f62[_0x2318('0x31')][_0x2318('0x2f')];_0x7a1880++){var _0x5e2ae3=_0x3442d8+_0x2e0f62[_0x2318('0x31')][_0x2318('0x2f')];var _0x39cdd5=_0x7a1880===_0x2e0f62[_0x2318('0x31')][_0x2318('0x2f')]-0x1?_0x3442d8+_0x3eb534[_0x2318('0x2f')]+_0x49b879[_0x2318('0x2f')]+0x2:_0x3442d8+_0x7a1880+0x1;_0x3eb534[_0x2318('0x42')](_0x7a1880,0x0,{'type':_0x2a1f6e[_0x2318('0x4')],'app':_0x2318('0x43'),'appdata':_0x2e0f62[_0x2318('0x31')][_0x7a1880]+'?'+_0x2a1f6e[_0x2318('0x5')]+_0x2318('0x44')+_0x5e2ae3+':'+_0x2a1f6e[_0x2318('0x5')]+_0x2318('0x44')+_0x39cdd5,'exten':_0x2a1f6e[_0x2318('0x6')],'context':_0x2a1f6e['context'],'priority':_0x3442d8+_0x7a1880,'VoiceExtensionId':_0x2a1f6e['id']});}if(_0x2e0f62[_0x2318('0x45')]==='outboundDial'){_0x2e0f62[_0x2318('0x46')]=_0x4347ec(_0x2a1f6e,_0x2e0f62[_0x2318('0x46')]);}if(_0x2e0f62[_0x2318('0x45')]===_0x2318('0x47')){_0x3eb534[_0x2318('0xa')]({'type':_0x2e0f62[_0x2318('0x4')][_0x2318('0x34')](),'app':_0x2318('0x2'),'appdata':_0x2318('0x48'),'context':_0x2a1f6e[_0x2318('0x5')],'exten':_0x2a1f6e['exten'],'priority':_0x2e0f62['intervals'][_0x2318('0x2f')]+_0x3442d8+_0x4a7d01++,'VoiceExtensionId':_0x2a1f6e['id']});}_0x2e0f62[_0x2318('0x49')]=_0x3eb534[_0x2318('0x2f')]?_[_0x2318('0x4a')](_0x3eb534)['priority']+0x1:_0x3442d8;_0xe1cdce=_[_0x2318('0x4b')](_0xe1cdce,_0x3eb534,[_0x2e0f62],_0x49b879);_0x3442d8=_['last'](_0xe1cdce)['priority']+0x1;}return _0x51ce31(_0xe1cdce);})[_0x2318('0x4c')](function(_0x10fee6){_0x24c4fe(_0x10fee6);});});}return _0x57d04b['define'](_0x2318('0x4d'),attributes,{'tableName':_0x2318('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3c557c){var _0x4cff0d=this[_0x2318('0x4f')]({'plain':!![]});var _0x5bf1d6=_0x4cff0d[_0x2318('0x4')]==='outbound'?_0x46aa1f(_0x4cff0d):_0xaf0d9e(_0x4cff0d);return _0x2a2d00(_0x4cff0d,_0x3c557c,_[_0x2318('0x4a')](_0x5bf1d6)[_0x2318('0x49')]+0x1)[_0x2318('0x2e')](function(_0x1b5d1c){var _0x24fe45=_[_0x2318('0x4b')](_0x5bf1d6,_0x1b5d1c);_0x24fe45[_0x2318('0xa')]({'type':_0x4cff0d['type'],'app':_0x2318('0x50'),'exten':_0x4cff0d[_0x2318('0x6')],'context':_0x4cff0d['context'],'priority':_[_0x2318('0x4a')](_0x24fe45)[_0x2318('0x49')]+0x1,'VoiceExtensionId':_0x4cff0d['id']});return _0x24fe45;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 5c62db0..33be1e9 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 _0x15b2=['stringify','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','request\x20sent','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','include','map','model','attributes','then','debug','GetVoiceExtension'];(function(_0x19d591,_0xc2d9b6){var _0x29da9b=function(_0x4a57a1){while(--_0x4a57a1){_0x19d591['push'](_0x19d591['shift']());}};_0x29da9b(++_0xc2d9b6);}(_0x15b2,0x145));var _0x215b=function(_0xdc42d1,_0x458707){_0xdc42d1=_0xdc42d1-0x0;var _0x3cf972=_0x15b2[_0xdc42d1];return _0x3cf972;};'use strict';var _=require('lodash');var util=require(_0x215b('0x0'));var moment=require('moment');var BPromise=require(_0x215b('0x1'));var rs=require(_0x215b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x215b('0x3'))['db'];var utils=require(_0x215b('0x4'));var logger=require(_0x215b('0x5'))(_0x215b('0x6'));var config=require('../../config/environment');var jayson=require(_0x215b('0x7'));var client=jayson['client'][_0x215b('0x8')]({'port':0x232a});config[_0x215b('0x9')]=_[_0x215b('0xa')](config[_0x215b('0x9')],{'host':_0x215b('0xb'),'port':0x18eb});var socket=require(_0x215b('0xc'))(new Redis(config['redis']));require(_0x215b('0xd'))[_0x215b('0xe')](socket);function respondWithRpcPromise(_0x50ef7a,_0x2f736e,_0x44bbd9){return new BPromise(function(_0x5578e4,_0x4de4ad){return client[_0x215b('0xf')](_0x50ef7a,_0x44bbd9)['then'](function(_0x401260){logger[_0x215b('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x2f736e,_0x215b('0x11'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2f736e,_0x215b('0x11'),JSON['stringify'](_0x401260));if(_0x401260[_0x215b('0x12')]){if(_0x401260['error'][_0x215b('0x13')]===0x1f4){logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x401260['error']['message']);return _0x4de4ad(_0x401260['error'][_0x215b('0x15')]);}logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x401260[_0x215b('0x12')][_0x215b('0x15')]);return _0x5578e4(_0x401260[_0x215b('0x12')][_0x215b('0x15')]);}else{logger['info'](_0x215b('0x14'),_0x2f736e,_0x215b('0x11'));_0x5578e4(_0x401260[_0x215b('0x16')][_0x215b('0x15')]);}})[_0x215b('0x17')](function(_0x4492da){logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x4492da);_0x4de4ad(_0x4492da);});});}exports['GetVoiceExtension']=function(_0x534e73){var _0x2cb718=this;return new Promise(function(_0x5d1998,_0x16732d){return db[_0x215b('0x18')][_0x215b('0x19')]({'raw':_0x534e73[_0x215b('0x1a')]?_0x534e73[_0x215b('0x1a')][_0x215b('0x1b')]===undefined?!![]:![]:!![],'where':_0x534e73[_0x215b('0x1a')]?_0x534e73[_0x215b('0x1a')]['where']||null:null,'attributes':_0x534e73['options']?_0x534e73[_0x215b('0x1a')]['attributes']||null:null,'limit':_0x534e73[_0x215b('0x1a')]?_0x534e73[_0x215b('0x1a')]['limit']||null:null,'include':_0x534e73[_0x215b('0x1a')]?_0x534e73['options'][_0x215b('0x1c')]?_[_0x215b('0x1d')](_0x534e73[_0x215b('0x1a')][_0x215b('0x1c')],function(_0x1f30b1){return{'model':db[_0x1f30b1[_0x215b('0x1e')]],'as':_0x1f30b1['as'],'attributes':_0x1f30b1[_0x215b('0x1f')],'include':_0x1f30b1[_0x215b('0x1c')]?_['map'](_0x1f30b1[_0x215b('0x1c')],function(_0x1f1a6f){return{'model':db[_0x1f1a6f['model']],'as':_0x1f1a6f['as'],'attributes':_0x1f1a6f[_0x215b('0x1f')],'include':_0x1f1a6f[_0x215b('0x1c')]?_[_0x215b('0x1d')](_0x1f1a6f['include'],function(_0x23ffca){return{'model':db[_0x23ffca[_0x215b('0x1e')]],'as':_0x23ffca['as'],'attributes':_0x23ffca[_0x215b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x215b('0x20')](function(_0x8dea4c){logger[_0x215b('0x10')]('GetVoiceExtension',_0x534e73);logger[_0x215b('0x21')](_0x215b('0x22'),_0x534e73,JSON[_0x215b('0x23')](_0x8dea4c));_0x5d1998(_0x8dea4c);})[_0x215b('0x17')](function(_0x5eb42b){logger['error']('GetVoiceExtension',_0x5eb42b['message'],_0x534e73);_0x16732d(_0x2cb718['error'](0x1f4,_0x5eb42b[_0x215b('0x15')]));});});}; \ No newline at end of file +var _0x277c=['localhost','./voiceExtension.socket','register','request','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','map','include','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x277c,0x153));var _0xc277=function(_0x31e031,_0xb852ef){_0x31e031=_0x31e031-0x0;var _0x3015b8=_0x277c[_0x31e031];return _0x3015b8;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var moment=require(_0xc277('0x1'));var BPromise=require(_0xc277('0x2'));var rs=require(_0xc277('0x3'));var fs=require('fs');var Redis=require(_0xc277('0x4'));var db=require(_0xc277('0x5'))['db'];var utils=require(_0xc277('0x6'));var logger=require(_0xc277('0x7'))(_0xc277('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc277('0x9')]['http']({'port':0x232a});config[_0xc277('0xa')]=_['defaults'](config[_0xc277('0xa')],{'host':_0xc277('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc277('0xa')]));require(_0xc277('0xc'))[_0xc277('0xd')](socket);function respondWithRpcPromise(_0x1b1db0,_0x3f766f,_0x1e4087){return new BPromise(function(_0x4a4137,_0x58eb8b){return client[_0xc277('0xe')](_0x1b1db0,_0x1e4087)[_0xc277('0xf')](function(_0x2df373){logger[_0xc277('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x3f766f,_0xc277('0x11'));logger['debug'](_0xc277('0x12'),_0x3f766f,_0xc277('0x11'),JSON[_0xc277('0x13')](_0x2df373));if(_0x2df373[_0xc277('0x14')]){if(_0x2df373['error'][_0xc277('0x15')]===0x1f4){logger[_0xc277('0x14')](_0xc277('0x16'),_0x3f766f,_0x2df373['error']['message']);return _0x58eb8b(_0x2df373[_0xc277('0x14')]['message']);}logger[_0xc277('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x3f766f,_0x2df373[_0xc277('0x14')][_0xc277('0x17')]);return _0x4a4137(_0x2df373[_0xc277('0x14')]['message']);}else{logger['info'](_0xc277('0x16'),_0x3f766f,'request\x20sent');_0x4a4137(_0x2df373['result'][_0xc277('0x17')]);}})[_0xc277('0x18')](function(_0x3b247e){logger[_0xc277('0x14')](_0xc277('0x16'),_0x3f766f,_0x3b247e);_0x58eb8b(_0x3b247e);});});}exports[_0xc277('0x19')]=function(_0x391cc3){var _0x4a7a79=this;return new Promise(function(_0x51e828,_0x697d6f){return db[_0xc277('0x1a')][_0xc277('0x1b')]({'raw':_0x391cc3[_0xc277('0x1c')]?_0x391cc3[_0xc277('0x1c')][_0xc277('0x1d')]===undefined?!![]:![]:!![],'where':_0x391cc3[_0xc277('0x1c')]?_0x391cc3[_0xc277('0x1c')][_0xc277('0x1e')]||null:null,'attributes':_0x391cc3[_0xc277('0x1c')]?_0x391cc3[_0xc277('0x1c')]['attributes']||null:null,'limit':_0x391cc3[_0xc277('0x1c')]?_0x391cc3[_0xc277('0x1c')]['limit']||null:null,'include':_0x391cc3[_0xc277('0x1c')]?_0x391cc3['options']['include']?_[_0xc277('0x1f')](_0x391cc3[_0xc277('0x1c')][_0xc277('0x20')],function(_0x436784){return{'model':db[_0x436784[_0xc277('0x21')]],'as':_0x436784['as'],'attributes':_0x436784[_0xc277('0x22')],'include':_0x436784[_0xc277('0x20')]?_[_0xc277('0x1f')](_0x436784[_0xc277('0x20')],function(_0x3e04cb){return{'model':db[_0x3e04cb[_0xc277('0x21')]],'as':_0x3e04cb['as'],'attributes':_0x3e04cb['attributes'],'include':_0x3e04cb['include']?_[_0xc277('0x1f')](_0x3e04cb[_0xc277('0x20')],function(_0x4ebb0f){return{'model':db[_0x4ebb0f['model']],'as':_0x4ebb0f['as'],'attributes':_0x4ebb0f[_0xc277('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc277('0xf')](function(_0x37e27b){logger[_0xc277('0x10')](_0xc277('0x19'),_0x391cc3);logger['debug'](_0xc277('0x19'),_0x391cc3,JSON['stringify'](_0x37e27b));_0x51e828(_0x37e27b);})[_0xc277('0x18')](function(_0x74ff17){logger[_0xc277('0x14')](_0xc277('0x19'),_0x74ff17['message'],_0x391cc3);_0x697d6f(_0x4a7a79[_0xc277('0x14')](0x1f4,_0x74ff17['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a5fbe7d..11e3bcf 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x264022,_0x51bd31){var _0x39b495=function(_0x1bdbc9){while(--_0x1bdbc9){_0x264022['push'](_0x264022['shift']());}};_0x39b495(++_0x51bd31);}(_0x4975,0x86));var _0x5497=function(_0x46f625,_0xae8459){_0x46f625=_0x46f625-0x0;var _0x3df0b4=_0x4975[_0x46f625];return _0x3df0b4;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x814b,0x1a2));var _0xb814=function(_0xa8b370,_0x2b77db){_0xa8b370=_0xa8b370-0x0;var _0x643e37=_0x814b[_0xa8b370];return _0x643e37;};'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 1fd962e..4e72ffc 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 _0x7bd0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5c3db0,_0x32780e){var _0x48aa2d=function(_0x457094){while(--_0x457094){_0x5c3db0['push'](_0x5c3db0['shift']());}};_0x48aa2d(++_0x32780e);}(_0x7bd0,0x111));var _0x07bd=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0x7bd0[_0x1e393b];return _0x3d0bfe;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['get'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x10')]);router['post']('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0x11')]);router[_0x07bd('0x12')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0x13')]);router[_0x07bd('0x14')](_0x07bd('0xd'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x15')]);module[_0x07bd('0x16')]=router; \ No newline at end of file +var _0xd117=['./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x39479d,_0x416fac){var _0x1bba5f=function(_0x939f1e){while(--_0x939f1e){_0x39479d['push'](_0x39479d['shift']());}};_0x1bba5f(++_0x416fac);}(_0xd117,0x182));var _0x7d11=function(_0x560924,_0x258a47){_0x560924=_0x560924-0x0;var _0x5c694d=_0xd117[_0x560924];return _0x5c694d;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0x12')]('/',auth[_0x7d11('0xc')](),controller['create']);router[_0x7d11('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7d11('0x14')]);router['delete']('/:id',auth[_0x7d11('0xc')](),controller['destroy']);module[_0x7d11('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 918bc3d..af9fb1c 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 _0x4ece=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TIMESTAMP'];(function(_0x558980,_0x19bd71){var _0x3bbc70=function(_0x2a93af){while(--_0x2a93af){_0x558980['push'](_0x558980['shift']());}};_0x3bbc70(++_0x19bd71);}(_0x4ece,0x195));var _0xe4ec=function(_0x8bffc8,_0x2da09a){_0x8bffc8=_0x8bffc8-0x0;var _0x5d5a92=_0x4ece[_0x8bffc8];return _0x5d5a92;};'use strict';var Sequelize=require(_0xe4ec('0x0'));module[_0xe4ec('0x1')]={'customer_id':{'type':Sequelize[_0xe4ec('0x2')]},'context':{'type':Sequelize[_0xe4ec('0x2')],'defaultValue':'from-voicemail','unique':_0xe4ec('0x3')},'mailbox':{'type':Sequelize[_0xe4ec('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xe4ec('0x2')]},'fullname':{'type':Sequelize[_0xe4ec('0x2')]},'email':{'type':Sequelize[_0xe4ec('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1a7367){this[_0xe4ec('0x4')](_0xe4ec('0x5'),typeof _0x1a7367===_0xe4ec('0x6')&&_0x1a7367[_0xe4ec('0x7')]()?_0x1a7367[_0xe4ec('0x7')]():null);}},'pager':{'type':Sequelize[_0xe4ec('0x2')]},'tz':{'type':Sequelize[_0xe4ec('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xe4ec('0x8')]('yes','no'),'defaultValue':_0xe4ec('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xe4ec('0x8')](_0xe4ec('0x9'),'no'),'defaultValue':_0xe4ec('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe4ec('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xe4ec('0x8')](_0xe4ec('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe4ec('0x8')](_0xe4ec('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xe4ec('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe4ec('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe4ec('0x8')](_0xe4ec('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe4ec('0x8')](_0xe4ec('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xe4ec('0x8')](_0xe4ec('0x9'),'no'),'defaultValue':_0xe4ec('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe4ec('0x8')](_0xe4ec('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe4ec('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe4ec('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xe4ec('0xa')},'emailsubject':{'type':Sequelize[_0xe4ec('0x2')]},'emailbody':{'type':Sequelize[_0xe4ec('0x2')]},'maxsecs':{'type':Sequelize[_0xe4ec('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe4ec('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe4ec('0xc')],'get':function(){return this[_0xe4ec('0xd')](_0xe4ec('0xe'))+_0xe4ec('0xf')+this[_0xe4ec('0xd')]('mailbox');}}}; \ No newline at end of file +var _0xb6be=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x132fa3,_0x263c65){var _0x164605=function(_0x4703d1){while(--_0x4703d1){_0x132fa3['push'](_0x132fa3['shift']());}};_0x164605(++_0x263c65);}(_0xb6be,0x144));var _0xeb6b=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xb6be[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require('sequelize');module[_0xeb6b('0x0')]={'customer_id':{'type':Sequelize[_0xeb6b('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xeb6b('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xeb6b('0x1')],'defaultValue':'','allowNull':![],'unique':_0xeb6b('0x3')},'password':{'type':Sequelize[_0xeb6b('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xeb6b('0x1')],'validate':{'isEmail':!![]},'set':function(_0x535af3){this[_0xeb6b('0x4')](_0xeb6b('0x5'),typeof _0x535af3===_0xeb6b('0x6')&&_0x535af3[_0xeb6b('0x7')]()?_0x535af3[_0xeb6b('0x7')]():null);}},'pager':{'type':Sequelize[_0xeb6b('0x1')]},'tz':{'type':Sequelize[_0xeb6b('0x1')],'defaultValue':_0xeb6b('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xeb6b('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xeb6b('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xeb6b('0x1')]},'review':{'type':Sequelize[_0xeb6b('0xa')](_0xeb6b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xeb6b('0xa')](_0xeb6b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xeb6b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xeb6b('0xa')](_0xeb6b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xeb6b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xeb6b('0xa')](_0xeb6b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xeb6b('0xa')](_0xeb6b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xeb6b('0x9'),'no'),'defaultValue':_0xeb6b('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xeb6b('0xa')](_0xeb6b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xeb6b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xeb6b('0xa')](_0xeb6b('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xeb6b('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xeb6b('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xeb6b('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xeb6b('0xd')],'get':function(){return this[_0xeb6b('0xe')](_0xeb6b('0xf'))+_0xeb6b('0x10')+this[_0xeb6b('0xe')](_0xeb6b('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 4154292..0bcacef 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 _0xb7e7=['sort','where','pick','filter','options','show','params','keys','rawAttributes','intersection','includeAll','include','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','findAndCountAll','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','destroy','error','name','send','index','VoiceMail','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x7199c0,_0x5aef22){var _0x4da511=function(_0x1de8c9){while(--_0x1de8c9){_0x7199c0['push'](_0x7199c0['shift']());}};_0x4da511(++_0x5aef22);}(_0xb7e7,0x121));var _0x7b7e=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xb7e7[_0x45f951];return _0x24756c;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];function respondWithStatusCode(_0xaadda,_0x54d8ce){_0x54d8ce=_0x54d8ce||0xcc;return function(_0x267446){if(_0x267446){return _0xaadda[_0x7b7e('0x19')](_0x54d8ce);}return _0xaadda['status'](_0x54d8ce)[_0x7b7e('0x1a')]();};}function respondWithResult(_0x5976ac,_0x4c6011){_0x4c6011=_0x4c6011||0xc8;return function(_0x2889ed){if(_0x2889ed){return _0x5976ac[_0x7b7e('0x1b')](_0x4c6011)[_0x7b7e('0x1c')](_0x2889ed);}};}function respondWithFilteredResult(_0x457ec5,_0x3d2fb2){return function(_0x5703fd){if(_0x5703fd){var _0x51baf6=typeof _0x3d2fb2[_0x7b7e('0x1d')]===_0x7b7e('0x1e')&&typeof _0x3d2fb2[_0x7b7e('0x1f')]===_0x7b7e('0x1e');var _0x2cc400=_0x5703fd[_0x7b7e('0x20')];var _0x242368=_0x51baf6?0x0:_0x3d2fb2[_0x7b7e('0x1d')];var _0x2acb8c=_0x51baf6?_0x5703fd[_0x7b7e('0x20')]:_0x3d2fb2[_0x7b7e('0x1d')]+_0x3d2fb2[_0x7b7e('0x1f')];var _0x448980;if(_0x2acb8c>=_0x2cc400){_0x2acb8c=_0x2cc400;_0x448980=0xc8;}else{_0x448980=0xce;}_0x457ec5[_0x7b7e('0x1b')](_0x448980);return _0x457ec5[_0x7b7e('0x21')](_0x7b7e('0x22'),_0x242368+'-'+_0x2acb8c+'/'+_0x2cc400)[_0x7b7e('0x1c')](_0x5703fd);}return null;};}function patchUpdates(_0x49eddb){return function(_0x69262b){try{jsonpatch[_0x7b7e('0x23')](_0x69262b,_0x49eddb,!![]);}catch(_0x24718c){return BPromise['reject'](_0x24718c);}return _0x69262b[_0x7b7e('0x24')]();};}function saveUpdates(_0xbf0cb3,_0x14243b){return function(_0x200156){if(_0x200156){return _0x200156[_0x7b7e('0x25')](_0xbf0cb3)[_0x7b7e('0x26')](function(_0x28bf43){return _0x28bf43;});}return null;};}function removeEntity(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(_0x5d6215){return _0x5d6215['destroy']()[_0x7b7e('0x26')](function(){var _0x22598e=_0x5d6215[_0x7b7e('0x27')]({'plain':!![]});var _0x483c6f='Voicemails';return db['UserProfileResource'][_0x7b7e('0x28')]({'where':{'type':_0x483c6f,'resourceId':_0x22598e['id']}})[_0x7b7e('0x26')](function(){return _0x5d6215;});})[_0x7b7e('0x26')](function(){_0x10a66a[_0x7b7e('0x1b')](0xcc)[_0x7b7e('0x1a')]();});}};}function handleEntityNotFound(_0x48fad1,_0x6a1e71){return function(_0x21a15){if(!_0x21a15){_0x48fad1['sendStatus'](0x194);}return _0x21a15;};}function handleError(_0x57b9da,_0x4e5de7){_0x4e5de7=_0x4e5de7||0x1f4;return function(_0x12ef0b){logger[_0x7b7e('0x29')](_0x12ef0b['stack']);if(_0x12ef0b[_0x7b7e('0x2a')]){delete _0x12ef0b['name'];}_0x57b9da[_0x7b7e('0x1b')](_0x4e5de7)[_0x7b7e('0x2b')](_0x12ef0b);};}exports[_0x7b7e('0x2c')]=function(_0x5515ca,_0x3960b8){var _0xe31336={},_0x35602a={},_0x326dd2={'count':0x0,'rows':[]};var _0x33f9a1=_['map'](db[_0x7b7e('0x2d')]['rawAttributes'],function(_0x23a453){return{'name':_0x23a453[_0x7b7e('0x2e')],'type':_0x23a453[_0x7b7e('0x2f')][_0x7b7e('0x30')]};});_0x35602a[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x33f9a1,_0x7b7e('0x2a'));_0x35602a['query']=_['keys'](_0x5515ca[_0x7b7e('0x33')]);_0x35602a[_0x7b7e('0x34')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],_0x35602a[_0x7b7e('0x33')]);_0xe31336[_0x7b7e('0x35')]=_['intersection'](_0x35602a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0xe31336[_0x7b7e('0x35')]=_0xe31336[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0xe31336[_0x7b7e('0x35')]:_0x35602a[_0x7b7e('0x31')];if(!_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0xe31336[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1f')]);_0xe31336['offset']=qs[_0x7b7e('0x1d')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x1d')]);}_0xe31336[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3b')]);_0xe31336[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x5515ca['query'],_0x35602a[_0x7b7e('0x34')]),_0x33f9a1);if(_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]){_0xe31336[_0x7b7e('0x3c')]=_['merge'](_0xe31336[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x32')](_0x33f9a1,function(_0x3d5280){if(_0x3d5280['type']!=='VIRTUAL'){var _0x22651e={};_0x22651e[_0x3d5280['name']]={'$like':'%'+_0x5515ca[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x22651e;}})});}_0xe31336=_['merge']({},_0xe31336,_0x5515ca[_0x7b7e('0x3f')]);var _0x2074d1={'where':_0xe31336[_0x7b7e('0x3c')]};return db[_0x7b7e('0x2d')][_0x7b7e('0x20')](_0x2074d1)[_0x7b7e('0x26')](function(_0xc888e4){_0x326dd2[_0x7b7e('0x20')]=_0xc888e4;if(_0x5515ca[_0x7b7e('0x33')]['includeAll']){_0xe31336['include']=[{'all':!![]}];}return db[_0x7b7e('0x2d')]['findAll'](_0xe31336);})[_0x7b7e('0x26')](function(_0x5e8b5d){_0x326dd2['rows']=_0x5e8b5d;return _0x326dd2;})[_0x7b7e('0x26')](respondWithFilteredResult(_0x3960b8,_0xe31336))['catch'](handleError(_0x3960b8,null));};exports[_0x7b7e('0x40')]=function(_0x52051c,_0xa8521d){var _0x3e58be={'raw':!![],'where':{'id':_0x52051c[_0x7b7e('0x41')]['id']}},_0x7ea84c={};_0x7ea84c['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x2d')][_0x7b7e('0x43')]);_0x7ea84c[_0x7b7e('0x33')]=_[_0x7b7e('0x42')](_0x52051c[_0x7b7e('0x33')]);_0x7ea84c['filters']=_['intersection'](_0x7ea84c['model'],_0x7ea84c[_0x7b7e('0x33')]);_0x3e58be[_0x7b7e('0x35')]=_[_0x7b7e('0x44')](_0x7ea84c[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x52051c[_0x7b7e('0x33')]['fields']));_0x3e58be[_0x7b7e('0x35')]=_0x3e58be[_0x7b7e('0x35')]['length']?_0x3e58be['attributes']:_0x7ea84c[_0x7b7e('0x31')];if(_0x52051c[_0x7b7e('0x33')][_0x7b7e('0x45')]){_0x3e58be[_0x7b7e('0x46')]=[{'all':!![]}];}_0x3e58be=_[_0x7b7e('0x47')]({},_0x3e58be,_0x52051c[_0x7b7e('0x3f')]);return db['VoiceMail'][_0x7b7e('0x48')](_0x3e58be)['then'](handleEntityNotFound(_0xa8521d,null))[_0x7b7e('0x26')](respondWithResult(_0xa8521d,null))[_0x7b7e('0x49')](handleError(_0xa8521d,null));};exports[_0x7b7e('0x4a')]=function(_0x5874e2,_0x58e4e6){return db[_0x7b7e('0x2d')][_0x7b7e('0x4a')](_0x5874e2[_0x7b7e('0x4b')],{})[_0x7b7e('0x26')](function(_0x1f9d0f){var _0x5cce7c=_0x5874e2[_0x7b7e('0x4c')][_0x7b7e('0x27')]({'plain':!![]});if(!_0x5cce7c)throw new Error(_0x7b7e('0x4d'));if(_0x5cce7c[_0x7b7e('0x4e')]===_0x7b7e('0x4c')){var _0x5a9697=_0x1f9d0f[_0x7b7e('0x27')]({'plain':!![]});var _0x29024e=_0x7b7e('0x4f');return db[_0x7b7e('0x50')][_0x7b7e('0x48')]({'where':{'name':_0x29024e,'userProfileId':_0x5cce7c[_0x7b7e('0x51')]},'raw':!![]})[_0x7b7e('0x26')](function(_0x4a7be0){if(_0x4a7be0&&_0x4a7be0[_0x7b7e('0x52')]===0x0){return db['UserProfileResource'][_0x7b7e('0x4a')]({'name':_0x5a9697[_0x7b7e('0x2a')],'resourceId':_0x5a9697['id'],'type':_0x4a7be0['name'],'sectionId':_0x4a7be0['id']},{})[_0x7b7e('0x26')](function(){return _0x1f9d0f;});}else{return _0x1f9d0f;}})[_0x7b7e('0x49')](function(_0x16c81d){logger[_0x7b7e('0x29')](_0x7b7e('0x53'),_0x16c81d);throw _0x16c81d;});}return _0x1f9d0f;})[_0x7b7e('0x26')](respondWithResult(_0x58e4e6,0xc9))[_0x7b7e('0x49')](handleError(_0x58e4e6,null));};exports['update']=function(_0xbf044d,_0x3ff731){if(_0xbf044d[_0x7b7e('0x4b')]['id']){delete _0xbf044d[_0x7b7e('0x4b')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0xbf044d['params']['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x3ff731,null))[_0x7b7e('0x26')](saveUpdates(_0xbf044d[_0x7b7e('0x4b')],null))['then'](respondWithResult(_0x3ff731,null))['catch'](handleError(_0x3ff731,null));};exports[_0x7b7e('0x28')]=function(_0x39efb5,_0x4fecf7){return db[_0x7b7e('0x2d')][_0x7b7e('0x48')]({'where':{'id':_0x39efb5[_0x7b7e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fecf7,null))[_0x7b7e('0x26')](removeEntity(_0x4fecf7,null))[_0x7b7e('0x49')](handleError(_0x4fecf7,null));};exports['getMessages']=function(_0x25c933,_0x441c3c,_0x1d7db1){return db[_0x7b7e('0x2d')][_0x7b7e('0x54')]({'where':{'id':_0x25c933[_0x7b7e('0x41')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x441c3c,null))[_0x7b7e('0x26')](function(_0x45fff9){var _0x5509ad;var _0x29d0af={},_0x20108a={};_0x20108a['model']=_[_0x7b7e('0x42')](db[_0x7b7e('0x55')][_0x7b7e('0x43')]);_0x20108a['query']=_[_0x7b7e('0x42')](_0x25c933['query']);_0x20108a[_0x7b7e('0x34')]=_[_0x7b7e('0x44')](_0x20108a['model'],_0x20108a[_0x7b7e('0x33')]);_0x29d0af[_0x7b7e('0x35')]=_['intersection'](_0x20108a[_0x7b7e('0x31')],qs[_0x7b7e('0x36')](_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x36')]));_0x29d0af['attributes']=_0x29d0af[_0x7b7e('0x35')][_0x7b7e('0x37')]?_0x29d0af[_0x7b7e('0x35')]:_0x20108a[_0x7b7e('0x31')];if(!_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0x29d0af[_0x7b7e('0x1f')]=qs[_0x7b7e('0x1f')](_0x25c933[_0x7b7e('0x33')]['limit']);_0x29d0af[_0x7b7e('0x1d')]=qs['offset'](_0x25c933['query'][_0x7b7e('0x1d')]);}_0x29d0af[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x25c933[_0x7b7e('0x33')]['sort']);_0x29d0af[_0x7b7e('0x3c')]=qs[_0x7b7e('0x34')](_[_0x7b7e('0x3d')](_0x25c933[_0x7b7e('0x33')],_0x20108a[_0x7b7e('0x34')]));if(_0x25c933[_0x7b7e('0x33')]['filter']){_0x29d0af[_0x7b7e('0x3c')]=_['merge'](_0x29d0af['where'],{'$or':_[_0x7b7e('0x32')](_0x29d0af['attributes'],function(_0x47aa4c){var _0x4a2378={};_0x4a2378[_0x47aa4c]={'$like':'%'+_0x25c933[_0x7b7e('0x33')][_0x7b7e('0x3e')]+'%'};return _0x4a2378;})});}_0x29d0af['where']=_[_0x7b7e('0x47')](_0x29d0af[_0x7b7e('0x3c')],{'mailboxuser':_0x45fff9['mailbox']});_0x29d0af=_[_0x7b7e('0x47')]({},_0x29d0af,_0x25c933[_0x7b7e('0x3f')]);return db[_0x7b7e('0x55')][_0x7b7e('0x56')](_0x29d0af)[_0x7b7e('0x26')](respondWithFilteredResult(_0x441c3c,_0x29d0af));})[_0x7b7e('0x49')](handleError(_0x441c3c,null));}; \ No newline at end of file +var _0xbc9d=['mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','get','UserProfileResource','stack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','name','options','include','VoiceMail','findAll','rows','params','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage'];(function(_0xc199a7,_0x2fb7df){var _0x2277ca=function(_0x4d4a91){while(--_0x4d4a91){_0xc199a7['push'](_0xc199a7['shift']());}};_0x2277ca(++_0x2fb7df);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x5c58d7,_0x58a31c){_0x5c58d7=_0x5c58d7-0x0;var _0x258e5b=_0xbc9d[_0x5c58d7];return _0x258e5b;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){var _0x32822f=_0x119230[_0xdbc9('0x27')]({'plain':!![]});var _0x3c8c1d='Voicemails';return db[_0xdbc9('0x28')][_0xdbc9('0x25')]({'where':{'type':_0x3c8c1d,'resourceId':_0x32822f['id']}})[_0xdbc9('0x26')](function(){return _0x119230;});})[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf121e9,_0x2ee00a){return function(_0x5300bd){if(!_0x5300bd){_0xf121e9['sendStatus'](0x194);}return _0x5300bd;};}function handleError(_0x45aebe,_0x278db2){_0x278db2=_0x278db2||0x1f4;return function(_0x473430){logger['error'](_0x473430[_0xdbc9('0x29')]);if(_0x473430['name']){delete _0x473430['name'];}_0x45aebe[_0xdbc9('0x1a')](_0x278db2)['send'](_0x473430);};}exports['index']=function(_0x417b17,_0x20eb4f){var _0x1cb557={},_0x4db824={},_0x35eaf8={'count':0x0,'rows':[]};var _0x22f8aa=_['map'](db['VoiceMail'][_0xdbc9('0x2a')],function(_0x245496){return{'name':_0x245496[_0xdbc9('0x2b')],'type':_0x245496[_0xdbc9('0x2c')][_0xdbc9('0x2d')]};});_0x4db824[_0xdbc9('0x2e')]=_[_0xdbc9('0x2f')](_0x22f8aa,'name');_0x4db824[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x417b17[_0xdbc9('0x30')]);_0x4db824[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x4db824[_0xdbc9('0x2e')],_0x4db824['query']);_0x1cb557[_0xdbc9('0x34')]=_['intersection'](_0x4db824['model'],qs['fields'](_0x417b17['query']['fields']));_0x1cb557[_0xdbc9('0x34')]=_0x1cb557[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x1cb557['attributes']:_0x4db824[_0xdbc9('0x2e')];if(!_0x417b17[_0xdbc9('0x30')][_0xdbc9('0x36')](_0xdbc9('0x37'))){_0x1cb557[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x417b17['query'][_0xdbc9('0x1e')]);_0x1cb557[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x417b17['query'][_0xdbc9('0x20')]);}_0x1cb557[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x417b17[_0xdbc9('0x30')]['sort']);_0x1cb557['where']=qs[_0xdbc9('0x32')](_[_0xdbc9('0x3a')](_0x417b17[_0xdbc9('0x30')],_0x4db824[_0xdbc9('0x32')]),_0x22f8aa);if(_0x417b17['query'][_0xdbc9('0x3b')]){_0x1cb557[_0xdbc9('0x3c')]=_[_0xdbc9('0x3d')](_0x1cb557['where'],{'$or':_[_0xdbc9('0x2f')](_0x22f8aa,function(_0x38a2a7){if(_0x38a2a7[_0xdbc9('0x2c')]!=='VIRTUAL'){var _0xa11bc8={};_0xa11bc8[_0x38a2a7[_0xdbc9('0x3e')]]={'$like':'%'+_0x417b17['query']['filter']+'%'};return _0xa11bc8;}})});}_0x1cb557=_[_0xdbc9('0x3d')]({},_0x1cb557,_0x417b17[_0xdbc9('0x3f')]);var _0x387b57={'where':_0x1cb557[_0xdbc9('0x3c')]};return db['VoiceMail'][_0xdbc9('0x1f')](_0x387b57)[_0xdbc9('0x26')](function(_0x577725){_0x35eaf8[_0xdbc9('0x1f')]=_0x577725;if(_0x417b17[_0xdbc9('0x30')]['includeAll']){_0x1cb557[_0xdbc9('0x40')]=[{'all':!![]}];}return db[_0xdbc9('0x41')][_0xdbc9('0x42')](_0x1cb557);})[_0xdbc9('0x26')](function(_0x3ed4de){_0x35eaf8[_0xdbc9('0x43')]=_0x3ed4de;return _0x35eaf8;})[_0xdbc9('0x26')](respondWithFilteredResult(_0x20eb4f,_0x1cb557))['catch'](handleError(_0x20eb4f,null));};exports['show']=function(_0x768856,_0x3b8437){var _0xc77676={'raw':!![],'where':{'id':_0x768856[_0xdbc9('0x44')]['id']}},_0x41f56a={};_0x41f56a[_0xdbc9('0x2e')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x41')][_0xdbc9('0x2a')]);_0x41f56a[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x768856['query']);_0x41f56a['filters']=_[_0xdbc9('0x33')](_0x41f56a[_0xdbc9('0x2e')],_0x41f56a[_0xdbc9('0x30')]);_0xc77676[_0xdbc9('0x34')]=_[_0xdbc9('0x33')](_0x41f56a[_0xdbc9('0x2e')],qs[_0xdbc9('0x45')](_0x768856[_0xdbc9('0x30')]['fields']));_0xc77676['attributes']=_0xc77676[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0xc77676[_0xdbc9('0x34')]:_0x41f56a[_0xdbc9('0x2e')];if(_0x768856[_0xdbc9('0x30')][_0xdbc9('0x46')]){_0xc77676[_0xdbc9('0x40')]=[{'all':!![]}];}_0xc77676=_[_0xdbc9('0x3d')]({},_0xc77676,_0x768856[_0xdbc9('0x3f')]);return db['VoiceMail'][_0xdbc9('0x47')](_0xc77676)[_0xdbc9('0x26')](handleEntityNotFound(_0x3b8437,null))['then'](respondWithResult(_0x3b8437,null))['catch'](handleError(_0x3b8437,null));};exports[_0xdbc9('0x48')]=function(_0xc3db3c,_0x133a13){return db['VoiceMail'][_0xdbc9('0x48')](_0xc3db3c[_0xdbc9('0x49')],{})[_0xdbc9('0x26')](function(_0x274607){var _0x5aee83=_0xc3db3c[_0xdbc9('0x4a')][_0xdbc9('0x27')]({'plain':!![]});if(!_0x5aee83)throw new Error(_0xdbc9('0x4b'));if(_0x5aee83[_0xdbc9('0x4c')]==='user'){var _0x3e89f5=_0x274607[_0xdbc9('0x27')]({'plain':!![]});var _0x3f49b7=_0xdbc9('0x4d');return db[_0xdbc9('0x4e')][_0xdbc9('0x47')]({'where':{'name':_0x3f49b7,'userProfileId':_0x5aee83[_0xdbc9('0x4f')]},'raw':!![]})[_0xdbc9('0x26')](function(_0x4b34dd){if(_0x4b34dd&&_0x4b34dd[_0xdbc9('0x50')]===0x0){return db['UserProfileResource'][_0xdbc9('0x48')]({'name':_0x3e89f5[_0xdbc9('0x3e')],'resourceId':_0x3e89f5['id'],'type':_0x4b34dd['name'],'sectionId':_0x4b34dd['id']},{})['then'](function(){return _0x274607;});}else{return _0x274607;}})[_0xdbc9('0x51')](function(_0x4b55df){logger[_0xdbc9('0x52')](_0xdbc9('0x53'),_0x4b55df);throw _0x4b55df;});}return _0x274607;})[_0xdbc9('0x26')](respondWithResult(_0x133a13,0xc9))['catch'](handleError(_0x133a13,null));};exports[_0xdbc9('0x24')]=function(_0x1c52e6,_0x3d8b01){if(_0x1c52e6[_0xdbc9('0x49')]['id']){delete _0x1c52e6[_0xdbc9('0x49')]['id'];}return db[_0xdbc9('0x41')][_0xdbc9('0x47')]({'where':{'id':_0x1c52e6[_0xdbc9('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d8b01,null))['then'](saveUpdates(_0x1c52e6['body'],null))[_0xdbc9('0x26')](respondWithResult(_0x3d8b01,null))[_0xdbc9('0x51')](handleError(_0x3d8b01,null));};exports[_0xdbc9('0x25')]=function(_0x55d8ba,_0x519ac9){return db[_0xdbc9('0x41')][_0xdbc9('0x47')]({'where':{'id':_0x55d8ba['params']['id']}})['then'](handleEntityNotFound(_0x519ac9,null))[_0xdbc9('0x26')](removeEntity(_0x519ac9,null))[_0xdbc9('0x51')](handleError(_0x519ac9,null));};exports[_0xdbc9('0x54')]=function(_0x2f90a8,_0x3021be,_0x1f52bb){return db['VoiceMail'][_0xdbc9('0x55')]({'where':{'id':_0x2f90a8[_0xdbc9('0x44')]['id']}})[_0xdbc9('0x26')](handleEntityNotFound(_0x3021be,null))['then'](function(_0x189d8a){var _0x14ccb4;var _0x1819fa={},_0x57b4ab={};_0x57b4ab[_0xdbc9('0x2e')]=_['keys'](db[_0xdbc9('0x56')][_0xdbc9('0x2a')]);_0x57b4ab[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2f90a8[_0xdbc9('0x30')]);_0x57b4ab[_0xdbc9('0x32')]=_['intersection'](_0x57b4ab[_0xdbc9('0x2e')],_0x57b4ab['query']);_0x1819fa[_0xdbc9('0x34')]=_[_0xdbc9('0x33')](_0x57b4ab['model'],qs[_0xdbc9('0x45')](_0x2f90a8[_0xdbc9('0x30')]['fields']));_0x1819fa['attributes']=_0x1819fa[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x1819fa[_0xdbc9('0x34')]:_0x57b4ab['model'];if(!_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x36')]('nolimit')){_0x1819fa[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x2f90a8['query']['limit']);_0x1819fa[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x20')]);}_0x1819fa[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x1819fa['where']=qs[_0xdbc9('0x32')](_[_0xdbc9('0x3a')](_0x2f90a8[_0xdbc9('0x30')],_0x57b4ab[_0xdbc9('0x32')]));if(_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x3b')]){_0x1819fa[_0xdbc9('0x3c')]=_[_0xdbc9('0x3d')](_0x1819fa['where'],{'$or':_[_0xdbc9('0x2f')](_0x1819fa['attributes'],function(_0x2678b2){var _0x4c5207={};_0x4c5207[_0x2678b2]={'$like':'%'+_0x2f90a8[_0xdbc9('0x30')][_0xdbc9('0x3b')]+'%'};return _0x4c5207;})});}_0x1819fa['where']=_['merge'](_0x1819fa['where'],{'mailboxuser':_0x189d8a[_0xdbc9('0x57')]});_0x1819fa=_[_0xdbc9('0x3d')]({},_0x1819fa,_0x2f90a8[_0xdbc9('0x3f')]);return db['VoiceMailMessage'][_0xdbc9('0x58')](_0x1819fa)[_0xdbc9('0x26')](respondWithFilteredResult(_0x3021be,_0x1819fa));})[_0xdbc9('0x51')](handleError(_0x3021be,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 705a146..6b332cd 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 _0x2399=['path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','bluebird'];(function(_0x4521e3,_0x10a8a4){var _0x46a272=function(_0x2f4c64){while(--_0x2f4c64){_0x4521e3['push'](_0x4521e3['shift']());}};_0x46a272(++_0x10a8a4);}(_0x2399,0xcd));var _0x9239=function(_0x8daa25,_0x41191f){_0x8daa25=_0x8daa25-0x0;var _0x260b85=_0x2399[_0x8daa25];return _0x260b85;};'use strict';var _=require(_0x9239('0x0'));var util=require(_0x9239('0x1'));var logger=require(_0x9239('0x2'))(_0x9239('0x3'));var moment=require('moment');var BPromise=require(_0x9239('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9239('0x5'));var rimraf=require(_0x9239('0x6'));var config=require('../../config/environment');var attributes=require(_0x9239('0x7'));module[_0x9239('0x8')]=function(_0x296b72,_0x1a2a5e){return _0x296b72[_0x9239('0x9')](_0x9239('0xa'),attributes,{'tableName':_0x9239('0xb'),'paranoid':![],'indexes':[{'name':_0x9239('0xc'),'fields':[_0x9239('0xd'),_0x9239('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x76c2=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x464148,_0x37f186){var _0x3e668c=function(_0x279947){while(--_0x279947){_0x464148['push'](_0x464148['shift']());}};_0x3e668c(++_0x37f186);}(_0x76c2,0x1da));var _0x276c=function(_0x5e788d,_0x1afcc8){_0x5e788d=_0x5e788d-0x0;var _0x1af32f=_0x76c2[_0x5e788d];return _0x1af32f;};'use strict';var _=require(_0x276c('0x0'));var util=require(_0x276c('0x1'));var logger=require(_0x276c('0x2'))('api');var moment=require(_0x276c('0x3'));var BPromise=require(_0x276c('0x4'));var rp=require(_0x276c('0x5'));var fs=require('fs');var path=require(_0x276c('0x6'));var rimraf=require(_0x276c('0x7'));var config=require(_0x276c('0x8'));var attributes=require(_0x276c('0x9'));module[_0x276c('0xa')]=function(_0x1f5e4c,_0x4c8061){return _0x1f5e4c[_0x276c('0xb')](_0x276c('0xc'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x276c('0xd'),'fields':[_0x276c('0xe'),_0x276c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 36de4ab..4e2f6d4 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 _0x6442=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMail,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0xe6e6c1,_0x2108b4){var _0x34ecd9=function(_0x954f5c){while(--_0x954f5c){_0xe6e6c1['push'](_0xe6e6c1['shift']());}};_0x34ecd9(++_0x2108b4);}(_0x6442,0x9c));var _0x2644=function(_0x51f492,_0x6b3e08){_0x51f492=_0x51f492-0x0;var _0x4c76eb=_0x6442[_0x51f492];return _0x4c76eb;};'use strict';var _=require(_0x2644('0x0'));var util=require(_0x2644('0x1'));var moment=require(_0x2644('0x2'));var BPromise=require('bluebird');var rs=require(_0x2644('0x3'));var fs=require('fs');var Redis=require(_0x2644('0x4'));var db=require(_0x2644('0x5'))['db'];var utils=require(_0x2644('0x6'));var logger=require('../../config/logger')(_0x2644('0x7'));var config=require(_0x2644('0x8'));var jayson=require(_0x2644('0x9'));var client=jayson[_0x2644('0xa')][_0x2644('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25825c,_0x24ecdc,_0x25c910){return new BPromise(function(_0x69b3fa,_0x700e8){return client[_0x2644('0xc')](_0x25825c,_0x25c910)[_0x2644('0xd')](function(_0x3e6e5c){logger['info']('VoiceMail,\x20%s,\x20%s',_0x24ecdc,_0x2644('0xe'));logger['debug'](_0x2644('0xf'),_0x24ecdc,_0x2644('0xe'),JSON[_0x2644('0x10')](_0x3e6e5c));if(_0x3e6e5c[_0x2644('0x11')]){if(_0x3e6e5c[_0x2644('0x11')]['code']===0x1f4){logger[_0x2644('0x11')](_0x2644('0x12'),_0x24ecdc,_0x3e6e5c[_0x2644('0x11')][_0x2644('0x13')]);return _0x700e8(_0x3e6e5c[_0x2644('0x11')][_0x2644('0x13')]);}logger[_0x2644('0x11')]('VoiceMail,\x20%s,\x20%s',_0x24ecdc,_0x3e6e5c[_0x2644('0x11')][_0x2644('0x13')]);return _0x69b3fa(_0x3e6e5c[_0x2644('0x11')][_0x2644('0x13')]);}else{logger[_0x2644('0x14')](_0x2644('0x12'),_0x24ecdc,_0x2644('0xe'));_0x69b3fa(_0x3e6e5c[_0x2644('0x15')][_0x2644('0x13')]);}})[_0x2644('0x16')](function(_0x21aa67){logger[_0x2644('0x11')](_0x2644('0x12'),_0x24ecdc,_0x21aa67);_0x700e8(_0x21aa67);});});} \ No newline at end of file +var _0x2efb=['request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMail,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x150d01,_0x4e97ef){var _0x1c5450=function(_0x9df7c3){while(--_0x9df7c3){_0x150d01['push'](_0x150d01['shift']());}};_0x1c5450(++_0x4e97ef);}(_0x2efb,0x1a7));var _0xb2ef=function(_0x523243,_0xf0ff28){_0x523243=_0x523243-0x0;var _0x107842=_0x2efb[_0x523243];return _0x107842;};'use strict';var _=require('lodash');var util=require(_0xb2ef('0x0'));var moment=require(_0xb2ef('0x1'));var BPromise=require(_0xb2ef('0x2'));var rs=require(_0xb2ef('0x3'));var fs=require('fs');var Redis=require(_0xb2ef('0x4'));var db=require(_0xb2ef('0x5'))['db'];var utils=require(_0xb2ef('0x6'));var logger=require(_0xb2ef('0x7'))(_0xb2ef('0x8'));var config=require('../../config/environment');var jayson=require(_0xb2ef('0x9'));var client=jayson[_0xb2ef('0xa')][_0xb2ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2de5e4,_0x1f9b04,_0x44caad){return new BPromise(function(_0x323875,_0xb7f51a){return client[_0xb2ef('0xc')](_0x2de5e4,_0x44caad)[_0xb2ef('0xd')](function(_0x1a235b){logger['info']('VoiceMail,\x20%s,\x20%s',_0x1f9b04,_0xb2ef('0xe'));logger[_0xb2ef('0xf')](_0xb2ef('0x10'),_0x1f9b04,_0xb2ef('0xe'),JSON[_0xb2ef('0x11')](_0x1a235b));if(_0x1a235b[_0xb2ef('0x12')]){if(_0x1a235b['error']['code']===0x1f4){logger[_0xb2ef('0x12')](_0xb2ef('0x13'),_0x1f9b04,_0x1a235b[_0xb2ef('0x12')][_0xb2ef('0x14')]);return _0xb7f51a(_0x1a235b['error'][_0xb2ef('0x14')]);}logger[_0xb2ef('0x12')](_0xb2ef('0x13'),_0x1f9b04,_0x1a235b['error'][_0xb2ef('0x14')]);return _0x323875(_0x1a235b['error'][_0xb2ef('0x14')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x1f9b04,_0xb2ef('0xe'));_0x323875(_0x1a235b[_0xb2ef('0x15')][_0xb2ef('0x14')]);}})[_0xb2ef('0x16')](function(_0x394e46){logger['error'](_0xb2ef('0x13'),_0x1f9b04,_0x394e46);_0xb7f51a(_0x394e46);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 24d522c..04bb94c 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 _0xb9a4=['put','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/download','download','post','create'];(function(_0x8353d0,_0x592d3f){var _0x52ee64=function(_0x328b53){while(--_0x328b53){_0x8353d0['push'](_0x8353d0['shift']());}};_0x52ee64(++_0x592d3f);}(_0xb9a4,0xf2));var _0x4b9a=function(_0x1ae59c,_0x7b8339){_0x1ae59c=_0x1ae59c-0x0;var _0x176aae=_0xb9a4[_0x1ae59c];return _0x176aae;};'use strict';var multer=require('multer');var util=require(_0x4b9a('0x0'));var path=require('path');var timeout=require(_0x4b9a('0x1'));var express=require(_0x4b9a('0x2'));var router=express['Router']();var fs_extra=require(_0x4b9a('0x3'));var auth=require(_0x4b9a('0x4'));var interaction=require(_0x4b9a('0x5'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4b9a('0x6')](_0x4b9a('0x7'),auth[_0x4b9a('0x8')](),controller[_0x4b9a('0x9')]);router['get'](_0x4b9a('0xa'),auth[_0x4b9a('0x8')](),controller[_0x4b9a('0xb')]);router[_0x4b9a('0xc')]('/',auth[_0x4b9a('0x8')](),controller[_0x4b9a('0xd')]);router[_0x4b9a('0xe')](_0x4b9a('0x7'),auth[_0x4b9a('0x8')](),controller['update']);router['delete'](_0x4b9a('0x7'),auth[_0x4b9a('0x8')](),controller['destroy']);module[_0x4b9a('0xf')]=router; \ No newline at end of file +var _0x8807=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','put','update','delete','destroy','exports'];(function(_0x4c96f2,_0x39b8f4){var _0x5c3ff4=function(_0x1f509f){while(--_0x1f509f){_0x4c96f2['push'](_0x4c96f2['shift']());}};_0x5c3ff4(++_0x39b8f4);}(_0x8807,0x1cc));var _0x7880=function(_0x355535,_0x1e2607){_0x355535=_0x355535-0x0;var _0x2a4242=_0x8807[_0x355535];return _0x2a4242;};'use strict';var multer=require(_0x7880('0x0'));var util=require(_0x7880('0x1'));var path=require(_0x7880('0x2'));var timeout=require(_0x7880('0x3'));var express=require(_0x7880('0x4'));var router=express['Router']();var fs_extra=require(_0x7880('0x5'));var auth=require(_0x7880('0x6'));var interaction=require(_0x7880('0x7'));var config=require(_0x7880('0x8'));var controller=require('./voiceMailMessage.controller');router[_0x7880('0x9')]('/',auth[_0x7880('0xa')](),controller[_0x7880('0xb')]);router[_0x7880('0x9')](_0x7880('0xc'),auth[_0x7880('0xa')](),controller[_0x7880('0xd')]);router[_0x7880('0x9')](_0x7880('0xe'),auth[_0x7880('0xa')](),controller['download']);router['post']('/',auth[_0x7880('0xa')](),controller['create']);router[_0x7880('0xf')](_0x7880('0xc'),auth[_0x7880('0xa')](),controller[_0x7880('0x10')]);router[_0x7880('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7880('0x12')]);module[_0x7880('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 879de31..5eec18f 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 _0xbd15=['STRING','BLOB','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xbd15,0x6f));var _0x5bd1=function(_0x56a74a,_0x1ebcc4){_0x56a74a=_0x56a74a-0x0;var _0x136f4d=_0xbd15[_0x56a74a];return _0x136f4d;};'use strict';var Sequelize=require(_0x5bd1('0x0'));module[_0x5bd1('0x1')]={'name':{'type':Sequelize[_0x5bd1('0x2')],'get':function(_0x3645ff){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5bd1('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5bd1('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5bd1('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x5bd1('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5bd1('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5bd1('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x5bd1('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x5bd1('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5bd1('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x5bd1('0x5'))}}; \ No newline at end of file +var _0x3af3=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x1955f8,_0x405720){var _0x1ae7bf=function(_0x290a23){while(--_0x290a23){_0x1955f8['push'](_0x1955f8['shift']());}};_0x1ae7bf(++_0x405720);}(_0x3af3,0xd0));var _0x33af=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0x3af3[_0x1a0c59];return _0xed67c9;};'use strict';var Sequelize=require(_0x33af('0x0'));module['exports']={'name':{'type':Sequelize[_0x33af('0x1')],'get':function(_0x453382){return this[_0x33af('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x33af('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x33af('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x33af('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x33af('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x33af('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x33af('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x33af('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x33af('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x33af('0x5')](_0x33af('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x33af('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x33af('0x4')],'defaultValue':''},'stamp':{'type':_0x33af('0x7'),'defaultValue':Sequelize[_0x33af('0x8')](_0x33af('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5263a34..37ae2c5 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 _0x2afa=['includeAll','findAll','rows','catch','show','params','length','include','options','find','create','body','update','msg_id','recording','Sequelize','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL'];(function(_0x4b6a33,_0x367275){var _0x51af0a=function(_0x2ac4eb){while(--_0x2ac4eb){_0x4b6a33['push'](_0x4b6a33['shift']());}};_0x51af0a(++_0x367275);}(_0x2afa,0x67));var _0xa2af=function(_0x708b52,_0x3ac80c){_0x708b52=_0x708b52-0x0;var _0x5470e2=_0x2afa[_0x708b52];return _0x5470e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2af('0x0'));var zipdir=require(_0xa2af('0x1'));var jsonpatch=require(_0xa2af('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa2af('0x3'));var Mustache=require(_0xa2af('0x4'));var util=require(_0xa2af('0x5'));var path=require('path');var sox=require(_0xa2af('0x6'));var csv=require('to-csv');var ejs=require(_0xa2af('0x7'));var fs=require('fs');var fs_extra=require(_0xa2af('0x8'));var _=require('lodash');var squel=require(_0xa2af('0x9'));var crypto=require(_0xa2af('0xa'));var jsforce=require(_0xa2af('0xb'));var deskjs=require(_0xa2af('0xc'));var toCsv=require(_0xa2af('0xd'));var querystring=require(_0xa2af('0xe'));var Papa=require('papaparse');var Redis=require(_0xa2af('0xf'));var authService=require(_0xa2af('0x10'));var qs=require(_0xa2af('0x11'));var as=require(_0xa2af('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa2af('0x13'));var utils=require(_0xa2af('0x14'));var config=require(_0xa2af('0x15'));var licenseUtil=require(_0xa2af('0x16'));var db=require(_0xa2af('0x17'))['db'];function respondWithStatusCode(_0x2cffc1,_0xe295f0){_0xe295f0=_0xe295f0||0xcc;return function(_0x4de435){if(_0x4de435){return _0x2cffc1['sendStatus'](_0xe295f0);}return _0x2cffc1[_0xa2af('0x18')](_0xe295f0)[_0xa2af('0x19')]();};}function respondWithResult(_0x10db88,_0x261f10){_0x261f10=_0x261f10||0xc8;return function(_0x556583){if(_0x556583){return _0x10db88[_0xa2af('0x18')](_0x261f10)['json'](_0x556583);}};}function respondWithFilteredResult(_0x12266a,_0x30ad15){return function(_0x19b31a){if(_0x19b31a){var _0xf277cf=typeof _0x30ad15[_0xa2af('0x1a')]==='undefined'&&typeof _0x30ad15['limit']===_0xa2af('0x1b');var _0x21e6df=_0x19b31a['count'];var _0x21bf11=_0xf277cf?0x0:_0x30ad15[_0xa2af('0x1a')];var _0x4cee10=_0xf277cf?_0x19b31a[_0xa2af('0x1c')]:_0x30ad15[_0xa2af('0x1a')]+_0x30ad15[_0xa2af('0x1d')];var _0x181663;if(_0x4cee10>=_0x21e6df){_0x4cee10=_0x21e6df;_0x181663=0xc8;}else{_0x181663=0xce;}_0x12266a[_0xa2af('0x18')](_0x181663);return _0x12266a[_0xa2af('0x1e')]('Content-Range',_0x21bf11+'-'+_0x4cee10+'/'+_0x21e6df)['json'](_0x19b31a);}return null;};}function patchUpdates(_0x5acc5c){return function(_0x481f9f){try{jsonpatch[_0xa2af('0x1f')](_0x481f9f,_0x5acc5c,!![]);}catch(_0x211b34){return BPromise[_0xa2af('0x20')](_0x211b34);}return _0x481f9f[_0xa2af('0x21')]();};}function saveUpdates(_0x58989e,_0x273f23){return function(_0x6af977){if(_0x6af977){return _0x6af977['update'](_0x58989e)[_0xa2af('0x22')](function(_0x582173){return _0x582173;});}return null;};}function removeEntity(_0x24b7f2,_0x49663e){return function(_0x4f1674){if(_0x4f1674){return _0x4f1674[_0xa2af('0x23')]()['then'](function(){_0x24b7f2[_0xa2af('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x210660,_0x4733d1){return function(_0x489aed){if(!_0x489aed){_0x210660[_0xa2af('0x24')](0x194);}return _0x489aed;};}function handleError(_0x4b52c4,_0x1dda1a){_0x1dda1a=_0x1dda1a||0x1f4;return function(_0x170771){logger[_0xa2af('0x25')](_0x170771[_0xa2af('0x26')]);if(_0x170771[_0xa2af('0x27')]){delete _0x170771[_0xa2af('0x27')];}_0x4b52c4[_0xa2af('0x18')](_0x1dda1a)[_0xa2af('0x28')](_0x170771);};}exports['index']=function(_0x19ca28,_0x3e7a2b){var _0x309249={},_0x37efbd={},_0x1d3ff5={'count':0x0,'rows':[]};var _0x7088af=_['map'](db[_0xa2af('0x29')][_0xa2af('0x2a')],function(_0x579bb5){return{'name':_0x579bb5[_0xa2af('0x2b')],'type':_0x579bb5[_0xa2af('0x2c')][_0xa2af('0x2d')]};});_0x37efbd[_0xa2af('0x2e')]=_['differenceBy'](_['map'](_0x7088af,'name'),[_0xa2af('0x27')]);_0x37efbd[_0xa2af('0x2f')]=_[_0xa2af('0x30')](_0x19ca28['query']);_0x37efbd[_0xa2af('0x31')]=_[_0xa2af('0x32')](_0x37efbd[_0xa2af('0x2e')],_0x37efbd['query']);_0x309249['attributes']=_[_0xa2af('0x32')](_0x37efbd[_0xa2af('0x2e')],qs[_0xa2af('0x33')](_0x19ca28[_0xa2af('0x2f')][_0xa2af('0x33')]));_0x309249[_0xa2af('0x34')]=_0x309249['attributes']['length']?_0x309249[_0xa2af('0x34')]:_0x37efbd[_0xa2af('0x2e')];if(!_0x19ca28[_0xa2af('0x2f')][_0xa2af('0x35')](_0xa2af('0x36'))){_0x309249['limit']=qs['limit'](_0x19ca28[_0xa2af('0x2f')][_0xa2af('0x1d')]);_0x309249[_0xa2af('0x1a')]=qs[_0xa2af('0x1a')](_0x19ca28[_0xa2af('0x2f')][_0xa2af('0x1a')]);}_0x309249[_0xa2af('0x37')]=qs[_0xa2af('0x38')](_0x19ca28[_0xa2af('0x2f')][_0xa2af('0x38')]);_0x309249[_0xa2af('0x39')]=qs[_0xa2af('0x31')](_[_0xa2af('0x3a')](_0x19ca28['query'],_0x37efbd[_0xa2af('0x31')]),_0x7088af);if(_0x19ca28[_0xa2af('0x2f')][_0xa2af('0x3b')]){_0x309249[_0xa2af('0x39')]=_[_0xa2af('0x3c')](_0x309249[_0xa2af('0x39')],{'$or':_[_0xa2af('0x3d')](_0x7088af,function(_0x260b88){if(_0x260b88[_0xa2af('0x2c')]!==_0xa2af('0x3e')){var _0x155ef0={};_0x155ef0[_0x260b88[_0xa2af('0x27')]]={'$like':'%'+_0x19ca28['query']['filter']+'%'};return _0x155ef0;}})});}_0x309249=_['merge']({},_0x309249,_0x19ca28['options']);var _0x44fb0a={'where':_0x309249['where']};return db[_0xa2af('0x29')][_0xa2af('0x1c')](_0x44fb0a)['then'](function(_0x14ac85){_0x1d3ff5[_0xa2af('0x1c')]=_0x14ac85;if(_0x19ca28[_0xa2af('0x2f')][_0xa2af('0x3f')]){_0x309249['include']=[{'all':!![]}];}return db[_0xa2af('0x29')][_0xa2af('0x40')](_0x309249);})[_0xa2af('0x22')](function(_0x144a80){_0x1d3ff5[_0xa2af('0x41')]=_0x144a80;return _0x1d3ff5;})['then'](respondWithFilteredResult(_0x3e7a2b,_0x309249))[_0xa2af('0x42')](handleError(_0x3e7a2b,null));};exports[_0xa2af('0x43')]=function(_0x2fcdef,_0x2a23c5){var _0x3d05b2={'raw':!![],'where':{'id':_0x2fcdef[_0xa2af('0x44')]['id']}},_0x44d7f1={};_0x44d7f1[_0xa2af('0x2e')]=_[_0xa2af('0x30')](db['VoiceMailMessage']['rawAttributes']);_0x44d7f1[_0xa2af('0x2f')]=_[_0xa2af('0x30')](_0x2fcdef[_0xa2af('0x2f')]);_0x44d7f1['filters']=_['intersection'](_0x44d7f1[_0xa2af('0x2e')],_0x44d7f1[_0xa2af('0x2f')]);_0x3d05b2[_0xa2af('0x34')]=_[_0xa2af('0x32')](_0x44d7f1['model'],qs['fields'](_0x2fcdef[_0xa2af('0x2f')][_0xa2af('0x33')]));_0x3d05b2[_0xa2af('0x34')]=_0x3d05b2[_0xa2af('0x34')][_0xa2af('0x45')]?_0x3d05b2['attributes']:_0x44d7f1['model'];if(_0x2fcdef[_0xa2af('0x2f')]['includeAll']){_0x3d05b2[_0xa2af('0x46')]=[{'all':!![]}];}_0x3d05b2=_[_0xa2af('0x3c')]({},_0x3d05b2,_0x2fcdef[_0xa2af('0x47')]);return db[_0xa2af('0x29')][_0xa2af('0x48')](_0x3d05b2)['then'](handleEntityNotFound(_0x2a23c5,null))[_0xa2af('0x22')](respondWithResult(_0x2a23c5,null))[_0xa2af('0x42')](handleError(_0x2a23c5,null));};exports[_0xa2af('0x49')]=function(_0x24c337,_0x1e90d6){return db['VoiceMailMessage'][_0xa2af('0x49')](_0x24c337[_0xa2af('0x4a')],{})[_0xa2af('0x22')](respondWithResult(_0x1e90d6,0xc9))[_0xa2af('0x42')](handleError(_0x1e90d6,null));};exports[_0xa2af('0x4b')]=function(_0x42f817,_0x149998){if(_0x42f817['body']['id']){delete _0x42f817['body']['id'];}return db[_0xa2af('0x29')]['find']({'where':{'id':_0x42f817[_0xa2af('0x44')]['id']}})[_0xa2af('0x22')](handleEntityNotFound(_0x149998,null))['then'](saveUpdates(_0x42f817[_0xa2af('0x4a')],null))[_0xa2af('0x22')](respondWithResult(_0x149998,null))[_0xa2af('0x42')](handleError(_0x149998,null));};exports[_0xa2af('0x23')]=function(_0x49e50a,_0x6571d1){return db[_0xa2af('0x29')][_0xa2af('0x48')]({'where':{'id':_0x49e50a['params']['id']}})['then'](handleEntityNotFound(_0x6571d1,null))[_0xa2af('0x22')](removeEntity(_0x6571d1,null))[_0xa2af('0x42')](handleError(_0x6571d1,null));};exports['download']=function(_0x5a9eac,_0x2cd3f7,_0x353654){return db[_0xa2af('0x29')][_0xa2af('0x48')]({'where':{'id':_0x5a9eac[_0xa2af('0x44')]['id']},'attributes':['id','recording',_0xa2af('0x4c')]})[_0xa2af('0x22')](handleEntityNotFound(_0x2cd3f7,null))[_0xa2af('0x22')](function(_0x44572f){if(_0x44572f){if(!_0x44572f[_0xa2af('0x4d')]){throw new db[(_0xa2af('0x4e'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x32c2d3={'Content-Type':'audio/wav','Content-Disposition':_0xa2af('0x4f')};if(_0x44572f[_0xa2af('0x4c')]){_0x32c2d3[_0xa2af('0x50')]=_0xa2af('0x51')+_0x44572f['msg_id']+_0xa2af('0x52');}_0x2cd3f7['set'](_0x32c2d3);return _0x2cd3f7[_0xa2af('0x28')](new Buffer(_0x44572f[_0xa2af('0x4d')]));}})[_0xa2af('0x42')](handleError(_0x2cd3f7,null));}; \ No newline at end of file +var _0x0f4e=['VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','rows','catch','include','create','body','find','params','msg_id','recording','Sequelize','audio/wav','attachment','Content-Disposition','.wav\x22','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','map'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0x0f4e,0x180));var _0xe0f4=function(_0x211576,_0xcc41af){_0x211576=_0x211576-0x0;var _0x3ce235=_0x0f4e[_0x211576];return _0x3ce235;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe0f4('0x0'));var zipdir=require(_0xe0f4('0x1'));var jsonpatch=require(_0xe0f4('0x2'));var rp=require('request-promise');var moment=require(_0xe0f4('0x3'));var BPromise=require(_0xe0f4('0x4'));var Mustache=require(_0xe0f4('0x5'));var util=require('util');var path=require(_0xe0f4('0x6'));var sox=require(_0xe0f4('0x7'));var csv=require(_0xe0f4('0x8'));var ejs=require(_0xe0f4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0f4('0xa'));var squel=require(_0xe0f4('0xb'));var crypto=require(_0xe0f4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe0f4('0xd'));var toCsv=require(_0xe0f4('0x8'));var querystring=require(_0xe0f4('0xe'));var Papa=require(_0xe0f4('0xf'));var Redis=require(_0xe0f4('0x10'));var authService=require(_0xe0f4('0x11'));var qs=require(_0xe0f4('0x12'));var as=require(_0xe0f4('0x13'));var hardwareService=require(_0xe0f4('0x14'));var logger=require(_0xe0f4('0x15'))(_0xe0f4('0x16'));var utils=require(_0xe0f4('0x17'));var config=require(_0xe0f4('0x18'));var licenseUtil=require(_0xe0f4('0x19'));var db=require(_0xe0f4('0x1a'))['db'];function respondWithStatusCode(_0x4cf34b,_0xba5a01){_0xba5a01=_0xba5a01||0xcc;return function(_0x5202d3){if(_0x5202d3){return _0x4cf34b[_0xe0f4('0x1b')](_0xba5a01);}return _0x4cf34b[_0xe0f4('0x1c')](_0xba5a01)[_0xe0f4('0x1d')]();};}function respondWithResult(_0x4d8b38,_0x179ea6){_0x179ea6=_0x179ea6||0xc8;return function(_0x37ea4e){if(_0x37ea4e){return _0x4d8b38[_0xe0f4('0x1c')](_0x179ea6)[_0xe0f4('0x1e')](_0x37ea4e);}};}function respondWithFilteredResult(_0x116957,_0x15550f){return function(_0x3a6ded){if(_0x3a6ded){var _0x631408=typeof _0x15550f[_0xe0f4('0x1f')]===_0xe0f4('0x20')&&typeof _0x15550f[_0xe0f4('0x21')]===_0xe0f4('0x20');var _0x38ce22=_0x3a6ded['count'];var _0xf8a66e=_0x631408?0x0:_0x15550f[_0xe0f4('0x1f')];var _0x15df42=_0x631408?_0x3a6ded[_0xe0f4('0x22')]:_0x15550f['offset']+_0x15550f[_0xe0f4('0x21')];var _0x3424f1;if(_0x15df42>=_0x38ce22){_0x15df42=_0x38ce22;_0x3424f1=0xc8;}else{_0x3424f1=0xce;}_0x116957[_0xe0f4('0x1c')](_0x3424f1);return _0x116957[_0xe0f4('0x23')](_0xe0f4('0x24'),_0xf8a66e+'-'+_0x15df42+'/'+_0x38ce22)[_0xe0f4('0x1e')](_0x3a6ded);}return null;};}function patchUpdates(_0x3a2387){return function(_0x102f0d){try{jsonpatch[_0xe0f4('0x25')](_0x102f0d,_0x3a2387,!![]);}catch(_0x1d6c8e){return BPromise[_0xe0f4('0x26')](_0x1d6c8e);}return _0x102f0d[_0xe0f4('0x27')]();};}function saveUpdates(_0x391bc0,_0x1424e6){return function(_0x1ce8fb){if(_0x1ce8fb){return _0x1ce8fb['update'](_0x391bc0)['then'](function(_0x12fa18){return _0x12fa18;});}return null;};}function removeEntity(_0x4d2eb4,_0x1cb5d3){return function(_0x222f56){if(_0x222f56){return _0x222f56[_0xe0f4('0x28')]()['then'](function(){_0x4d2eb4[_0xe0f4('0x1c')](0xcc)[_0xe0f4('0x1d')]();});}};}function handleEntityNotFound(_0x45abb7,_0x32a96e){return function(_0x362af7){if(!_0x362af7){_0x45abb7[_0xe0f4('0x1b')](0x194);}return _0x362af7;};}function handleError(_0x16ae63,_0x156bc3){_0x156bc3=_0x156bc3||0x1f4;return function(_0x3c9b34){logger[_0xe0f4('0x29')](_0x3c9b34[_0xe0f4('0x2a')]);if(_0x3c9b34[_0xe0f4('0x2b')]){delete _0x3c9b34['name'];}_0x16ae63['status'](_0x156bc3)[_0xe0f4('0x2c')](_0x3c9b34);};}exports['index']=function(_0x56d122,_0x12c2e0){var _0x45e737={},_0x19b2a2={},_0x1fd9f5={'count':0x0,'rows':[]};var _0x536cfe=_[_0xe0f4('0x2d')](db[_0xe0f4('0x2e')][_0xe0f4('0x2f')],function(_0x304b36){return{'name':_0x304b36[_0xe0f4('0x30')],'type':_0x304b36[_0xe0f4('0x31')][_0xe0f4('0x32')]};});_0x19b2a2[_0xe0f4('0x33')]=_[_0xe0f4('0x34')](_[_0xe0f4('0x2d')](_0x536cfe,_0xe0f4('0x2b')),[_0xe0f4('0x2b')]);_0x19b2a2[_0xe0f4('0x35')]=_[_0xe0f4('0x36')](_0x56d122[_0xe0f4('0x35')]);_0x19b2a2[_0xe0f4('0x37')]=_[_0xe0f4('0x38')](_0x19b2a2[_0xe0f4('0x33')],_0x19b2a2[_0xe0f4('0x35')]);_0x45e737['attributes']=_[_0xe0f4('0x38')](_0x19b2a2[_0xe0f4('0x33')],qs[_0xe0f4('0x39')](_0x56d122[_0xe0f4('0x35')][_0xe0f4('0x39')]));_0x45e737[_0xe0f4('0x3a')]=_0x45e737[_0xe0f4('0x3a')][_0xe0f4('0x3b')]?_0x45e737['attributes']:_0x19b2a2[_0xe0f4('0x33')];if(!_0x56d122['query'][_0xe0f4('0x3c')](_0xe0f4('0x3d'))){_0x45e737[_0xe0f4('0x21')]=qs[_0xe0f4('0x21')](_0x56d122[_0xe0f4('0x35')][_0xe0f4('0x21')]);_0x45e737[_0xe0f4('0x1f')]=qs[_0xe0f4('0x1f')](_0x56d122[_0xe0f4('0x35')][_0xe0f4('0x1f')]);}_0x45e737[_0xe0f4('0x3e')]=qs[_0xe0f4('0x3f')](_0x56d122[_0xe0f4('0x35')]['sort']);_0x45e737[_0xe0f4('0x40')]=qs[_0xe0f4('0x37')](_[_0xe0f4('0x41')](_0x56d122['query'],_0x19b2a2[_0xe0f4('0x37')]),_0x536cfe);if(_0x56d122[_0xe0f4('0x35')]['filter']){_0x45e737['where']=_[_0xe0f4('0x42')](_0x45e737[_0xe0f4('0x40')],{'$or':_['map'](_0x536cfe,function(_0x1a1b7d){if(_0x1a1b7d[_0xe0f4('0x31')]!==_0xe0f4('0x43')){var _0x62a319={};_0x62a319[_0x1a1b7d['name']]={'$like':'%'+_0x56d122['query'][_0xe0f4('0x44')]+'%'};return _0x62a319;}})});}_0x45e737=_[_0xe0f4('0x42')]({},_0x45e737,_0x56d122[_0xe0f4('0x45')]);var _0x4a2620={'where':_0x45e737[_0xe0f4('0x40')]};return db['VoiceMailMessage'][_0xe0f4('0x22')](_0x4a2620)[_0xe0f4('0x46')](function(_0x3a6b29){_0x1fd9f5[_0xe0f4('0x22')]=_0x3a6b29;if(_0x56d122[_0xe0f4('0x35')][_0xe0f4('0x47')]){_0x45e737['include']=[{'all':!![]}];}return db[_0xe0f4('0x2e')]['findAll'](_0x45e737);})[_0xe0f4('0x46')](function(_0x1d2428){_0x1fd9f5[_0xe0f4('0x48')]=_0x1d2428;return _0x1fd9f5;})['then'](respondWithFilteredResult(_0x12c2e0,_0x45e737))[_0xe0f4('0x49')](handleError(_0x12c2e0,null));};exports['show']=function(_0x1ddddf,_0x5ca61b){var _0x58cd90={'raw':!![],'where':{'id':_0x1ddddf['params']['id']}},_0x15e921={};_0x15e921[_0xe0f4('0x33')]=_[_0xe0f4('0x36')](db[_0xe0f4('0x2e')][_0xe0f4('0x2f')]);_0x15e921[_0xe0f4('0x35')]=_[_0xe0f4('0x36')](_0x1ddddf[_0xe0f4('0x35')]);_0x15e921[_0xe0f4('0x37')]=_[_0xe0f4('0x38')](_0x15e921[_0xe0f4('0x33')],_0x15e921[_0xe0f4('0x35')]);_0x58cd90[_0xe0f4('0x3a')]=_[_0xe0f4('0x38')](_0x15e921['model'],qs[_0xe0f4('0x39')](_0x1ddddf[_0xe0f4('0x35')][_0xe0f4('0x39')]));_0x58cd90[_0xe0f4('0x3a')]=_0x58cd90['attributes'][_0xe0f4('0x3b')]?_0x58cd90[_0xe0f4('0x3a')]:_0x15e921[_0xe0f4('0x33')];if(_0x1ddddf[_0xe0f4('0x35')][_0xe0f4('0x47')]){_0x58cd90[_0xe0f4('0x4a')]=[{'all':!![]}];}_0x58cd90=_[_0xe0f4('0x42')]({},_0x58cd90,_0x1ddddf[_0xe0f4('0x45')]);return db['VoiceMailMessage']['find'](_0x58cd90)[_0xe0f4('0x46')](handleEntityNotFound(_0x5ca61b,null))[_0xe0f4('0x46')](respondWithResult(_0x5ca61b,null))[_0xe0f4('0x49')](handleError(_0x5ca61b,null));};exports[_0xe0f4('0x4b')]=function(_0x2e8762,_0x2bc87a){return db[_0xe0f4('0x2e')][_0xe0f4('0x4b')](_0x2e8762[_0xe0f4('0x4c')],{})[_0xe0f4('0x46')](respondWithResult(_0x2bc87a,0xc9))[_0xe0f4('0x49')](handleError(_0x2bc87a,null));};exports['update']=function(_0x20d38f,_0x2a0055){if(_0x20d38f[_0xe0f4('0x4c')]['id']){delete _0x20d38f['body']['id'];}return db['VoiceMailMessage'][_0xe0f4('0x4d')]({'where':{'id':_0x20d38f['params']['id']}})['then'](handleEntityNotFound(_0x2a0055,null))[_0xe0f4('0x46')](saveUpdates(_0x20d38f[_0xe0f4('0x4c')],null))[_0xe0f4('0x46')](respondWithResult(_0x2a0055,null))[_0xe0f4('0x49')](handleError(_0x2a0055,null));};exports[_0xe0f4('0x28')]=function(_0x5b2c3e,_0x5cee8e){return db[_0xe0f4('0x2e')][_0xe0f4('0x4d')]({'where':{'id':_0x5b2c3e[_0xe0f4('0x4e')]['id']}})[_0xe0f4('0x46')](handleEntityNotFound(_0x5cee8e,null))[_0xe0f4('0x46')](removeEntity(_0x5cee8e,null))[_0xe0f4('0x49')](handleError(_0x5cee8e,null));};exports['download']=function(_0x3a34ce,_0x41e54b,_0x54dbf3){return db['VoiceMailMessage'][_0xe0f4('0x4d')]({'where':{'id':_0x3a34ce[_0xe0f4('0x4e')]['id']},'attributes':['id','recording',_0xe0f4('0x4f')]})[_0xe0f4('0x46')](handleEntityNotFound(_0x41e54b,null))[_0xe0f4('0x46')](function(_0x46535a){if(_0x46535a){if(!_0x46535a[_0xe0f4('0x50')]){throw new db[(_0xe0f4('0x51'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x156061={'Content-Type':_0xe0f4('0x52'),'Content-Disposition':_0xe0f4('0x53')};if(_0x46535a['msg_id']){_0x156061[_0xe0f4('0x54')]='attachment;\x20filename=\x22'+_0x46535a[_0xe0f4('0x4f')]+_0xe0f4('0x55');}_0x41e54b[_0xe0f4('0x23')](_0x156061);return _0x41e54b['send'](new Buffer(_0x46535a[_0xe0f4('0x50')]));}})['catch'](handleError(_0x41e54b,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e4f9212..44628ed 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 _0x4988=['rimraf','../../config/environment','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4a1056,_0x466230){var _0x325776=function(_0xdc970c){while(--_0xdc970c){_0x4a1056['push'](_0x4a1056['shift']());}};_0x325776(++_0x466230);}(_0x4988,0xf4));var _0x8498=function(_0x596073,_0x4ce28d){_0x596073=_0x596073-0x0;var _0x4392c8=_0x4988[_0x596073];return _0x4392c8;};'use strict';var _=require(_0x8498('0x0'));var util=require(_0x8498('0x1'));var logger=require(_0x8498('0x2'))(_0x8498('0x3'));var moment=require(_0x8498('0x4'));var BPromise=require(_0x8498('0x5'));var rp=require(_0x8498('0x6'));var fs=require('fs');var path=require(_0x8498('0x7'));var rimraf=require(_0x8498('0x8'));var config=require(_0x8498('0x9'));var attributes=require(_0x8498('0xa'));module['exports']=function(_0x5aa94b,_0x4a1296){return _0x5aa94b['define'](_0x8498('0xb'),attributes,{'tableName':_0x8498('0xc'),'paranoid':![],'indexes':[{'name':_0x8498('0xd'),'fields':[_0x8498('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa165=['VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xa165,0x1d6));var _0x5a16=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa165[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x5a16('0x0'));var util=require(_0x5a16('0x1'));var logger=require(_0x5a16('0x2'))(_0x5a16('0x3'));var moment=require(_0x5a16('0x4'));var BPromise=require(_0x5a16('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5a16('0x6'));var config=require(_0x5a16('0x7'));var attributes=require(_0x5a16('0x8'));module[_0x5a16('0x9')]=function(_0x5018b7,_0x363792){return _0x5018b7['define'](_0x5a16('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x5a16('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 2f62c9c..c97b3e9 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 _0xba04=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x2b948f,_0x398e62){var _0x1237bc=function(_0x3c1843){while(--_0x3c1843){_0x2b948f['push'](_0x2b948f['shift']());}};_0x1237bc(++_0x398e62);}(_0xba04,0x10d));var _0x4ba0=function(_0x4be165,_0x3cefb4){_0x4be165=_0x4be165-0x0;var _0x5133b8=_0xba04[_0x4be165];return _0x5133b8;};'use strict';var _=require(_0x4ba0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4ba0('0x1'));var rs=require(_0x4ba0('0x2'));var fs=require('fs');var Redis=require(_0x4ba0('0x3'));var db=require(_0x4ba0('0x4'))['db'];var utils=require(_0x4ba0('0x5'));var logger=require(_0x4ba0('0x6'))(_0x4ba0('0x7'));var config=require(_0x4ba0('0x8'));var jayson=require(_0x4ba0('0x9'));var client=jayson[_0x4ba0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a3ec4,_0x16f748,_0x69b1d1){return new BPromise(function(_0x23db72,_0x3af716){return client[_0x4ba0('0xb')](_0x2a3ec4,_0x69b1d1)['then'](function(_0x5a6c25){logger[_0x4ba0('0xc')](_0x4ba0('0xd'),_0x16f748,_0x4ba0('0xe'));logger[_0x4ba0('0xf')](_0x4ba0('0x10'),_0x16f748,_0x4ba0('0xe'),JSON['stringify'](_0x5a6c25));if(_0x5a6c25[_0x4ba0('0x11')]){if(_0x5a6c25['error']['code']===0x1f4){logger['error'](_0x4ba0('0xd'),_0x16f748,_0x5a6c25[_0x4ba0('0x11')][_0x4ba0('0x12')]);return _0x3af716(_0x5a6c25[_0x4ba0('0x11')][_0x4ba0('0x12')]);}logger[_0x4ba0('0x11')](_0x4ba0('0xd'),_0x16f748,_0x5a6c25[_0x4ba0('0x11')][_0x4ba0('0x12')]);return _0x23db72(_0x5a6c25[_0x4ba0('0x11')][_0x4ba0('0x12')]);}else{logger[_0x4ba0('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x16f748,_0x4ba0('0xe'));_0x23db72(_0x5a6c25[_0x4ba0('0x13')][_0x4ba0('0x12')]);}})[_0x4ba0('0x14')](function(_0x3ca948){logger['error'](_0x4ba0('0xd'),_0x16f748,_0x3ca948);_0x3af716(_0x3ca948);});});} \ No newline at end of file +var _0x79e0=['../../config/utils','../../config/environment','client','then','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','lodash','util','randomstring','ioredis'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x79e0,0x10a));var _0x079e=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x79e0[_0x2a1b33];return _0x4c50e7;};'use strict';var _=require(_0x079e('0x0'));var util=require(_0x079e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x079e('0x2'));var fs=require('fs');var Redis=require(_0x079e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x079e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x079e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x079e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e5af2,_0x38e04e,_0x23acc8){return new BPromise(function(_0x31c798,_0x3f7cd8){return client['request'](_0x3e5af2,_0x23acc8)[_0x079e('0x7')](function(_0x5d1380){logger[_0x079e('0x8')]('VoiceMailMessage,\x20%s,\x20%s',_0x38e04e,_0x079e('0x9'));logger['debug'](_0x079e('0xa'),_0x38e04e,_0x079e('0x9'),JSON['stringify'](_0x5d1380));if(_0x5d1380[_0x079e('0xb')]){if(_0x5d1380['error'][_0x079e('0xc')]===0x1f4){logger[_0x079e('0xb')](_0x079e('0xd'),_0x38e04e,_0x5d1380[_0x079e('0xb')][_0x079e('0xe')]);return _0x3f7cd8(_0x5d1380[_0x079e('0xb')][_0x079e('0xe')]);}logger[_0x079e('0xb')](_0x079e('0xd'),_0x38e04e,_0x5d1380[_0x079e('0xb')][_0x079e('0xe')]);return _0x31c798(_0x5d1380[_0x079e('0xb')][_0x079e('0xe')]);}else{logger['info'](_0x079e('0xd'),_0x38e04e,'request\x20sent');_0x31c798(_0x5d1380['result'][_0x079e('0xe')]);}})['catch'](function(_0x59cc58){logger[_0x079e('0xb')](_0x079e('0xd'),_0x38e04e,_0x59cc58);_0x3f7cd8(_0x59cc58);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4018a13..cda87b3 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 _0x1ca6=['/:id/sounds/:id2','removeSound','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','getSounds','post','create','/:id/sounds','put','update','delete','destroy'];(function(_0x2da4ab,_0x3d4809){var _0x4d03c4=function(_0x82bd3c){while(--_0x82bd3c){_0x2da4ab['push'](_0x2da4ab['shift']());}};_0x4d03c4(++_0x3d4809);}(_0x1ca6,0x1b7));var _0x61ca=function(_0x19d813,_0x366b4a){_0x19d813=_0x19d813-0x0;var _0x47fd7b=_0x1ca6[_0x19d813];return _0x47fd7b;};'use strict';var multer=require(_0x61ca('0x0'));var util=require(_0x61ca('0x1'));var path=require('path');var timeout=require(_0x61ca('0x2'));var express=require(_0x61ca('0x3'));var router=express['Router']();var fs_extra=require(_0x61ca('0x4'));var auth=require(_0x61ca('0x5'));var interaction=require(_0x61ca('0x6'));var config=require(_0x61ca('0x7'));var controller=require(_0x61ca('0x8'));router[_0x61ca('0x9')]('/',auth[_0x61ca('0xa')](),controller[_0x61ca('0xb')]);router[_0x61ca('0x9')]('/:id',auth[_0x61ca('0xa')](),controller[_0x61ca('0xc')]);router[_0x61ca('0x9')]('/:id/sounds',auth[_0x61ca('0xa')](),controller[_0x61ca('0xd')]);router[_0x61ca('0xe')]('/',auth[_0x61ca('0xa')](),controller[_0x61ca('0xf')]);router[_0x61ca('0xe')](_0x61ca('0x10'),auth[_0x61ca('0xa')](),controller['addSound']);router[_0x61ca('0x11')]('/:id',auth[_0x61ca('0xa')](),controller[_0x61ca('0x12')]);router[_0x61ca('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x61ca('0x14')]);router['delete'](_0x61ca('0x15'),auth[_0x61ca('0xa')](),controller[_0x61ca('0x16')]);module['exports']=router; \ No newline at end of file +var _0xfd8f=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','/:id','isAuthenticated','show','get','/:id/sounds','getSounds','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1054ec,_0x458d5a){var _0x46f81a=function(_0x73e515){while(--_0x73e515){_0x1054ec['push'](_0x1054ec['shift']());}};_0x46f81a(++_0x458d5a);}(_0xfd8f,0x94));var _0xffd8=function(_0x175c13,_0x3629d0){_0x175c13=_0x175c13-0x0;var _0x24d00a=_0xfd8f[_0x175c13];return _0x24d00a;};'use strict';var multer=require(_0xffd8('0x0'));var util=require(_0xffd8('0x1'));var path=require(_0xffd8('0x2'));var timeout=require(_0xffd8('0x3'));var express=require('express');var router=express[_0xffd8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xffd8('0x5'));var interaction=require(_0xffd8('0x6'));var config=require(_0xffd8('0x7'));var controller=require(_0xffd8('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xffd8('0x9'),auth[_0xffd8('0xa')](),controller[_0xffd8('0xb')]);router[_0xffd8('0xc')](_0xffd8('0xd'),auth[_0xffd8('0xa')](),controller[_0xffd8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xffd8('0xd'),auth[_0xffd8('0xa')](),controller[_0xffd8('0xf')]);router['put']('/:id',auth[_0xffd8('0xa')](),controller[_0xffd8('0x10')]);router[_0xffd8('0x11')](_0xffd8('0x9'),auth['isAuthenticated'](),controller[_0xffd8('0x12')]);router[_0xffd8('0x11')](_0xffd8('0x13'),auth[_0xffd8('0xa')](),controller[_0xffd8('0x14')]);module[_0xffd8('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index e28f94c..3d1dee0 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 _0xde63=['name','ENUM','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING'];(function(_0x33b4e2,_0x203f8b){var _0x14ab5b=function(_0xba257){while(--_0xba257){_0x33b4e2['push'](_0x33b4e2['shift']());}};_0x14ab5b(++_0x203f8b);}(_0xde63,0xe5));var _0x3de6=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xde63[_0x36f47c];return _0x296c55;};'use strict';var Sequelize=require(_0x3de6('0x0'));module['exports']={'name':{'type':Sequelize[_0x3de6('0x1')],'allowNull':![],'unique':_0x3de6('0x2')},'mode':{'type':Sequelize[_0x3de6('0x3')]('custom',_0x3de6('0x4'),_0x3de6('0x5'),_0x3de6('0x6'),'quietmp3',_0x3de6('0x7')),'allowNull':!![],'defaultValue':_0x3de6('0x4')},'directory':{'type':Sequelize[_0x3de6('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x3de6('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x3de6('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x3de6('0x1')],'allowNull':!![],'defaultValue':_0x3de6('0x8')},'format':{'type':Sequelize[_0x3de6('0x1')],'allowNull':!![]},'stamp':{'type':_0x3de6('0x9')},'defaultEntry':{'type':Sequelize[_0x3de6('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbfd2=['name','custom','files','mp3nb','quietmp3','mp3','alpha','STRING'];(function(_0x2bb121,_0xb11dc1){var _0x10ec2a=function(_0x11d808){while(--_0x11d808){_0x2bb121['push'](_0x2bb121['shift']());}};_0x10ec2a(++_0xb11dc1);}(_0xbfd2,0x14f));var _0x2bfd=function(_0x570464,_0x2a5a1d){_0x570464=_0x570464-0x0;var _0x4b9f28=_0xbfd2[_0x570464];return _0x4b9f28;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2bfd('0x0')],'allowNull':![],'unique':_0x2bfd('0x1')},'mode':{'type':Sequelize['ENUM'](_0x2bfd('0x2'),_0x2bfd('0x3'),_0x2bfd('0x4'),'quietmp3nb',_0x2bfd('0x5'),_0x2bfd('0x6')),'allowNull':!![],'defaultValue':_0x2bfd('0x3')},'directory':{'type':Sequelize[_0x2bfd('0x0')],'allowNull':!![]},'application':{'type':Sequelize[_0x2bfd('0x0')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2bfd('0x7')},'format':{'type':Sequelize[_0x2bfd('0x0')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'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 6b89de5..7730687 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 _0x35a8=['rows','catch','show','params','includeAll','body','create','sequelize','transaction','mode','join','root','server/files/moh','files','mkdirSync','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','format','%s.%s','basename','symlinkSync','message','removeSound','id2','getSounds','order','rimraf','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll'];(function(_0x2bbb56,_0x121360){var _0x2967d8=function(_0x2fc382){while(--_0x2fc382){_0x2bbb56['push'](_0x2bbb56['shift']());}};_0x2967d8(++_0x121360);}(_0x35a8,0x173));var _0x835a=function(_0x4e1a7d,_0x28ecaa){_0x4e1a7d=_0x4e1a7d-0x0;var _0x43b58a=_0x35a8[_0x4e1a7d];return _0x43b58a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x835a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x835a('0x1'));var util=require(_0x835a('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0x835a('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x835a('0x4'));var _=require(_0x835a('0x5'));var squel=require('squel');var crypto=require(_0x835a('0x6'));var jsforce=require(_0x835a('0x7'));var deskjs=require(_0x835a('0x8'));var toCsv=require('to-csv');var querystring=require(_0x835a('0x9'));var Papa=require('papaparse');var Redis=require(_0x835a('0xa'));var authService=require(_0x835a('0xb'));var qs=require(_0x835a('0xc'));var as=require(_0x835a('0xd'));var hardwareService=require(_0x835a('0xe'));var logger=require('../../config/logger')(_0x835a('0xf'));var utils=require(_0x835a('0x10'));var config=require(_0x835a('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x835a('0x12'))['db'];function respondWithStatusCode(_0x22bc23,_0x42a1fd){_0x42a1fd=_0x42a1fd||0xcc;return function(_0x2a6979){if(_0x2a6979){return _0x22bc23[_0x835a('0x13')](_0x42a1fd);}return _0x22bc23[_0x835a('0x14')](_0x42a1fd)[_0x835a('0x15')]();};}function respondWithResult(_0x476df0,_0x3e2bda){_0x3e2bda=_0x3e2bda||0xc8;return function(_0x2c26da){if(_0x2c26da){return _0x476df0[_0x835a('0x14')](_0x3e2bda)['json'](_0x2c26da);}};}function respondWithFilteredResult(_0x598bf8,_0x3ab361){return function(_0x2b2daa){if(_0x2b2daa){var _0x925b70=typeof _0x3ab361[_0x835a('0x16')]==='undefined'&&typeof _0x3ab361[_0x835a('0x17')]===_0x835a('0x18');var _0x552c4e=_0x2b2daa[_0x835a('0x19')];var _0x53e20b=_0x925b70?0x0:_0x3ab361[_0x835a('0x16')];var _0x39cf95=_0x925b70?_0x2b2daa[_0x835a('0x19')]:_0x3ab361[_0x835a('0x16')]+_0x3ab361[_0x835a('0x17')];var _0x3ef2ae;if(_0x39cf95>=_0x552c4e){_0x39cf95=_0x552c4e;_0x3ef2ae=0xc8;}else{_0x3ef2ae=0xce;}_0x598bf8[_0x835a('0x14')](_0x3ef2ae);return _0x598bf8[_0x835a('0x1a')](_0x835a('0x1b'),_0x53e20b+'-'+_0x39cf95+'/'+_0x552c4e)[_0x835a('0x1c')](_0x2b2daa);}return null;};}function patchUpdates(_0x3a5da7){return function(_0x3dd8e8){try{jsonpatch['apply'](_0x3dd8e8,_0x3a5da7,!![]);}catch(_0x58b185){return BPromise[_0x835a('0x1d')](_0x58b185);}return _0x3dd8e8[_0x835a('0x1e')]();};}function saveUpdates(_0xe9bdd9,_0x3fc921){return function(_0x55f1c8){if(_0x55f1c8){return _0x55f1c8[_0x835a('0x1f')](_0xe9bdd9)['then'](function(_0x3b20b8){return _0x3b20b8;});}return null;};}function removeEntity(_0x49263e,_0x4ccf34){return function(_0x7a2506){if(_0x7a2506){return _0x7a2506[_0x835a('0x20')]()[_0x835a('0x21')](function(){var _0x526f8b=_0x7a2506[_0x835a('0x22')]({'plain':!![]});var _0xe9b06e=_0x835a('0x23');return db[_0x835a('0x24')][_0x835a('0x20')]({'where':{'type':_0xe9b06e,'resourceId':_0x526f8b['id']}})[_0x835a('0x21')](function(){return _0x7a2506;});})[_0x835a('0x21')](function(){_0x49263e[_0x835a('0x14')](0xcc)[_0x835a('0x15')]();});}};}function handleEntityNotFound(_0x550e76,_0x1277de){return function(_0x196084){if(!_0x196084){_0x550e76[_0x835a('0x13')](0x194);}return _0x196084;};}function handleError(_0x2f4e5f,_0x4272b5){_0x4272b5=_0x4272b5||0x1f4;return function(_0x33b82b){logger[_0x835a('0x25')](_0x33b82b[_0x835a('0x26')]);if(_0x33b82b[_0x835a('0x27')]){delete _0x33b82b[_0x835a('0x27')];}_0x2f4e5f[_0x835a('0x14')](_0x4272b5)['send'](_0x33b82b);};}exports[_0x835a('0x28')]=function(_0x34e9f2,_0xfb5bef){var _0x384edf={},_0x533dcf={},_0x308d72={'count':0x0,'rows':[]};var _0x1c129a=_[_0x835a('0x29')](db[_0x835a('0x2a')][_0x835a('0x2b')],function(_0x2e1a42){return{'name':_0x2e1a42['fieldName'],'type':_0x2e1a42['type'][_0x835a('0x2c')]};});_0x533dcf[_0x835a('0x2d')]=_[_0x835a('0x29')](_0x1c129a,_0x835a('0x27'));_0x533dcf[_0x835a('0x2e')]=_[_0x835a('0x2f')](_0x34e9f2[_0x835a('0x2e')]);_0x533dcf[_0x835a('0x30')]=_['intersection'](_0x533dcf['model'],_0x533dcf['query']);_0x384edf[_0x835a('0x31')]=_[_0x835a('0x32')](_0x533dcf['model'],qs[_0x835a('0x33')](_0x34e9f2[_0x835a('0x2e')]['fields']));_0x384edf[_0x835a('0x31')]=_0x384edf[_0x835a('0x31')][_0x835a('0x34')]?_0x384edf[_0x835a('0x31')]:_0x533dcf[_0x835a('0x2d')];if(!_0x34e9f2['query'][_0x835a('0x35')](_0x835a('0x36'))){_0x384edf[_0x835a('0x17')]=qs[_0x835a('0x17')](_0x34e9f2[_0x835a('0x2e')][_0x835a('0x17')]);_0x384edf['offset']=qs[_0x835a('0x16')](_0x34e9f2[_0x835a('0x2e')][_0x835a('0x16')]);}_0x384edf['order']=qs[_0x835a('0x37')](_0x34e9f2[_0x835a('0x2e')][_0x835a('0x37')]);delete _0x34e9f2[_0x835a('0x2e')][_0x835a('0x37')];_0x384edf[_0x835a('0x38')]=qs[_0x835a('0x30')](_[_0x835a('0x39')](_0x34e9f2[_0x835a('0x2e')],_0x533dcf[_0x835a('0x30')]),_0x1c129a);if(_0x34e9f2[_0x835a('0x2e')][_0x835a('0x3a')]){_0x384edf['where']=_[_0x835a('0x3b')](_0x384edf['where'],{'$or':_['map'](_0x1c129a,function(_0x42b2e2){if(_0x42b2e2[_0x835a('0x3c')]!==_0x835a('0x3d')){var _0x5dca5b={};_0x5dca5b[_0x42b2e2[_0x835a('0x27')]]={'$like':'%'+_0x34e9f2[_0x835a('0x2e')][_0x835a('0x3a')]+'%'};return _0x5dca5b;}})});}_0x384edf=_[_0x835a('0x3b')]({},_0x384edf,_0x34e9f2[_0x835a('0x3e')]);var _0x2accc2={'where':_0x384edf[_0x835a('0x38')]};return db[_0x835a('0x2a')]['count'](_0x2accc2)['then'](function(_0xd2bbad){_0x308d72[_0x835a('0x19')]=_0xd2bbad;if(_0x34e9f2[_0x835a('0x2e')]['includeAll']){_0x384edf[_0x835a('0x3f')]=[{'all':!![]}];}return db[_0x835a('0x2a')][_0x835a('0x40')](_0x384edf);})['then'](function(_0x474a4a){_0x308d72[_0x835a('0x41')]=_0x474a4a;return _0x308d72;})[_0x835a('0x21')](respondWithFilteredResult(_0xfb5bef,_0x384edf))[_0x835a('0x42')](handleError(_0xfb5bef,null));};exports[_0x835a('0x43')]=function(_0x22ecbd,_0x44c2f4){var _0x1fa542={'raw':![],'where':{'id':_0x22ecbd[_0x835a('0x44')]['id']}},_0x18761f={};_0x18761f['model']=_['keys'](db['VoiceMusicOnHold'][_0x835a('0x2b')]);_0x18761f[_0x835a('0x2e')]=_[_0x835a('0x2f')](_0x22ecbd['query']);_0x18761f[_0x835a('0x30')]=_[_0x835a('0x32')](_0x18761f[_0x835a('0x2d')],_0x18761f['query']);_0x1fa542[_0x835a('0x31')]=_[_0x835a('0x32')](_0x18761f[_0x835a('0x2d')],qs[_0x835a('0x33')](_0x22ecbd['query']['fields']));_0x1fa542[_0x835a('0x31')]=_0x1fa542['attributes'][_0x835a('0x34')]?_0x1fa542[_0x835a('0x31')]:_0x18761f[_0x835a('0x2d')];if(_0x22ecbd[_0x835a('0x2e')][_0x835a('0x45')]){_0x1fa542[_0x835a('0x3f')]=[{'all':!![]}];}_0x1fa542=_[_0x835a('0x3b')]({},_0x1fa542,_0x22ecbd[_0x835a('0x3e')]);return db['VoiceMusicOnHold']['find'](_0x1fa542)['then'](handleEntityNotFound(_0x44c2f4,null))['then'](respondWithResult(_0x44c2f4,null))[_0x835a('0x42')](handleError(_0x44c2f4,null));};exports[_0x835a('0x1f')]=function(_0x411b88,_0x36a983){if(_0x411b88[_0x835a('0x46')]['id']){delete _0x411b88[_0x835a('0x46')]['id'];}return db[_0x835a('0x2a')]['find']({'where':{'id':_0x411b88[_0x835a('0x44')]['id']}})[_0x835a('0x21')](handleEntityNotFound(_0x36a983,null))[_0x835a('0x21')](saveUpdates(_0x411b88[_0x835a('0x46')],null))['then'](respondWithResult(_0x36a983,null))[_0x835a('0x42')](handleError(_0x36a983,null));};exports[_0x835a('0x47')]=function(_0x4ef015,_0x57773a,_0x1e4d8b){return db[_0x835a('0x48')][_0x835a('0x49')](function(_0x528f86){if(_0x4ef015['body'][_0x835a('0x4a')]==='files'){_0x4ef015[_0x835a('0x46')]['directory']=path[_0x835a('0x4b')](config[_0x835a('0x4c')],_0x835a('0x4d'),_0x4ef015['body'][_0x835a('0x27')]);}return db[_0x835a('0x2a')][_0x835a('0x47')](_0x4ef015[_0x835a('0x46')],{'transaction':_0x528f86})[_0x835a('0x21')](function(_0x3eb836){if(_0x4ef015[_0x835a('0x46')][_0x835a('0x4a')]===_0x835a('0x4e')){fs[_0x835a('0x4f')](_0x3eb836[_0x835a('0x50')],parseInt('0777',0x8));}var _0x5caf35=_0x4ef015[_0x835a('0x51')][_0x835a('0x22')]({'plain':!![]});if(!_0x5caf35)throw new Error(_0x835a('0x52'));if(_0x5caf35[_0x835a('0x53')]===_0x835a('0x51')){var _0x3de650=_0x3eb836[_0x835a('0x22')]({'plain':!![]});return db[_0x835a('0x54')][_0x835a('0x55')]({'where':{'name':_0x835a('0x23'),'userProfileId':_0x5caf35[_0x835a('0x56')]},'raw':!![]})[_0x835a('0x21')](function(_0x13a672){if(_0x13a672&&_0x13a672['autoAssociation']===0x0){return db[_0x835a('0x24')][_0x835a('0x47')]({'name':_0x3de650[_0x835a('0x27')],'resourceId':_0x3de650['id'],'type':_0x13a672[_0x835a('0x27')],'sectionId':_0x13a672['id']},{})[_0x835a('0x21')](function(){return _0x3eb836;});}else{return _0x3eb836;}})[_0x835a('0x42')](function(_0x5d8fae){logger[_0x835a('0x25')](_0x835a('0x57'),_0x5d8fae);});}return _0x3eb836;});})[_0x835a('0x21')](respondWithResult(_0x57773a,0xc9))[_0x835a('0x42')](handleError(_0x57773a,null));};exports[_0x835a('0x20')]=function(_0xfdad5,_0x272025,_0x281504){var _0x3f9ad1;return db[_0x835a('0x2a')]['find']({'where':{'id':_0xfdad5['params']['id']}})[_0x835a('0x21')](function(_0x42546e){if(_0x42546e){return db[_0x835a('0x48')][_0x835a('0x49')](function(_0xfe068b){return _0x42546e['destroy']({'transaction':_0xfe068b,'raw':!![]})[_0x835a('0x21')](function(_0x30b253){if(_0x30b253[_0x835a('0x50')]){fs[_0x835a('0x58')](_0x30b253[_0x835a('0x50')])[_0x835a('0x59')](function(_0x2fb251){fs[_0x835a('0x5a')](path[_0x835a('0x4b')](_0x30b253[_0x835a('0x50')],_0x2fb251));});fs[_0x835a('0x5b')](_0x30b253[_0x835a('0x50')]);}return _0x30b253;});})[_0x835a('0x42')](function(_0x33183b){throw new db[(_0x835a('0x5c'))][(_0x835a('0x5d'))](_0x33183b['message']);});}})[_0x835a('0x21')](handleEntityNotFound(_0x272025,null))[_0x835a('0x21')](removeEntity(_0x272025,null))[_0x835a('0x42')](handleError(_0x272025,null));};exports[_0x835a('0x5e')]=function(_0x3aeed3,_0x30d756,_0x57c231){return db['sequelize'][_0x835a('0x49')](function(_0x2239f7){var _0x25bd70;return db[_0x835a('0x2a')][_0x835a('0x55')]({'where':{'id':_0x3aeed3['params']['id']}})['then'](function(_0x3c9a9c){if(_0x3c9a9c){_0x25bd70=_0x3c9a9c;return _0x3c9a9c[_0x835a('0x5e')](_0x3aeed3['body']['id'],{'transaction':_0x2239f7});}})['then'](function(_0x2db04d){if(_0x2db04d){return db[_0x835a('0x5f')][_0x835a('0x60')]({'where':{'id':_0x3aeed3[_0x835a('0x46')]['id']},'attributes':['id',_0x835a('0x27'),_0x835a('0x61'),_0x835a('0x62'),_0x835a('0x63')],'raw':!![]});}})[_0x835a('0x21')](function(_0x369862){if(_0x369862){var _0x4a79c1=path[_0x835a('0x4b')](config[_0x835a('0x4c')],'server/files/sounds/converted',util[_0x835a('0x64')](_0x835a('0x65'),path[_0x835a('0x66')](_0x369862[_0x835a('0x61')],path['extname'](_0x369862[_0x835a('0x61')])),_0x369862[_0x835a('0x62')]));var _0x3c1f81=path[_0x835a('0x4b')](config[_0x835a('0x4c')],'server/files/moh',_0x25bd70[_0x835a('0x27')],util[_0x835a('0x64')](_0x835a('0x65'),_0x369862[_0x835a('0x27')],_0x369862[_0x835a('0x62')]));fs[_0x835a('0x67')](_0x4a79c1,_0x3c1f81);return _0x369862;}})[_0x835a('0x42')](function(_0x628873){throw new db['Sequelize'][(_0x835a('0x5d'))](_0x628873[_0x835a('0x68')]);});})['then'](handleEntityNotFound(_0x30d756,null))[_0x835a('0x21')](respondWithResult(_0x30d756,0xc9))[_0x835a('0x42')](handleError(_0x30d756,null));};exports['removeSound']=function(_0x2ca369,_0x2b6bbe,_0x3f1042){return db['sequelize'][_0x835a('0x49')](function(_0x1a8efe){var _0x3f7c5e;return db[_0x835a('0x2a')][_0x835a('0x60')]({'where':{'id':_0x2ca369[_0x835a('0x44')]['id']}})[_0x835a('0x21')](handleEntityNotFound(_0x2b6bbe,null))[_0x835a('0x21')](function(_0xf895eb){if(_0xf895eb){_0x3f7c5e=_0xf895eb;return _0xf895eb[_0x835a('0x69')](_0x2ca369['params'][_0x835a('0x6a')]);}})[_0x835a('0x21')](function(_0x206d88){if(_0x206d88){return db[_0x835a('0x5f')][_0x835a('0x60')]({'where':{'id':_0x2ca369[_0x835a('0x44')][_0x835a('0x6a')]},'attributes':['id',_0x835a('0x27'),'save_name',_0x835a('0x62'),'createdAt'],'raw':!![]});}})[_0x835a('0x21')](function(_0x1ba27a){if(_0x1ba27a){fs[_0x835a('0x5a')](path[_0x835a('0x4b')](_0x3f7c5e[_0x835a('0x50')],util[_0x835a('0x64')](_0x835a('0x65'),_0x1ba27a[_0x835a('0x27')],_0x1ba27a[_0x835a('0x62')])));return _0x1ba27a;}})['catch'](function(_0x47f52b){throw new db['Sequelize'][(_0x835a('0x5d'))](_0x47f52b[_0x835a('0x68')]);});})[_0x835a('0x21')](handleEntityNotFound(_0x2b6bbe,null))[_0x835a('0x21')](respondWithStatusCode(_0x2b6bbe,0xcc))[_0x835a('0x42')](handleError(_0x2b6bbe,null));};exports[_0x835a('0x6b')]=function(_0x2a049a,_0x5e3d4d,_0x374962){var _0x56158={};var _0xd16f7e={};var _0x36ccb5;var _0x269075;return db[_0x835a('0x2a')]['findOne']({'where':{'id':_0x2a049a[_0x835a('0x44')]['id']}})[_0x835a('0x21')](handleEntityNotFound(_0x5e3d4d,null))[_0x835a('0x21')](function(_0x34ab79){if(_0x34ab79){_0x36ccb5=_0x34ab79;_0xd16f7e['model']=_['keys'](db[_0x835a('0x5f')][_0x835a('0x2b')]);_0xd16f7e[_0x835a('0x2e')]=_['keys'](_0x2a049a[_0x835a('0x2e')]);_0xd16f7e[_0x835a('0x30')]=_[_0x835a('0x32')](_0xd16f7e[_0x835a('0x2d')],_0xd16f7e['query']);_0x56158[_0x835a('0x31')]=_[_0x835a('0x32')](_0xd16f7e[_0x835a('0x2d')],qs[_0x835a('0x33')](_0x2a049a[_0x835a('0x2e')][_0x835a('0x33')]));_0x56158['attributes']=_0x56158[_0x835a('0x31')][_0x835a('0x34')]?_0x56158['attributes']:_0xd16f7e[_0x835a('0x2d')];_0x56158[_0x835a('0x6c')]=qs[_0x835a('0x37')](_0x2a049a[_0x835a('0x2e')][_0x835a('0x37')]);_0x56158['where']=qs[_0x835a('0x30')](_[_0x835a('0x39')](_0x2a049a[_0x835a('0x2e')],_0xd16f7e['filters']));if(_0x2a049a[_0x835a('0x2e')][_0x835a('0x3a')]){_0x56158['where']=_[_0x835a('0x3b')](_0x56158['where'],{'$or':_[_0x835a('0x29')](_0x56158['attributes'],function(_0x35e877){var _0x521ca6={};_0x521ca6[_0x35e877]={'$like':'%'+_0x2a049a[_0x835a('0x2e')][_0x835a('0x3a')]+'%'};return _0x521ca6;})});}_0x56158=_[_0x835a('0x3b')]({},_0x56158,_0x2a049a[_0x835a('0x3e')]);return _0x36ccb5[_0x835a('0x6b')](_0x56158);}})['then'](function(_0x5b3ebe){if(_0x5b3ebe){_0x269075=_0x5b3ebe['length'];if(!_0x2a049a['query'][_0x835a('0x35')]('nolimit')){_0x56158[_0x835a('0x17')]=qs[_0x835a('0x17')](_0x2a049a[_0x835a('0x2e')][_0x835a('0x17')]);_0x56158['offset']=qs[_0x835a('0x16')](_0x2a049a[_0x835a('0x2e')][_0x835a('0x16')]);}return _0x36ccb5[_0x835a('0x6b')](_0x56158);}})['then'](function(_0x4ee6b3){if(_0x4ee6b3){return _0x4ee6b3?{'count':_0x269075,'rows':_0x4ee6b3}:null;}})[_0x835a('0x21')](respondWithResult(_0x5e3d4d,null))[_0x835a('0x42')](handleError(_0x5e3d4d,null));}; \ No newline at end of file +var _0xb234=['pick','filter','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','json','apply','then','destroy','get','MusicOnHolds','end','stack','name','index','rawAttributes','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','options','VoiceMusicOnHold','includeAll','rows','catch','show','keys','include','update','body','params','create','sequelize','files','join','root','server/files/moh','mode','mkdirSync','directory','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','error','transaction','readdirSync','forEach','Sequelize','ValidationError','addSound','save_name','converted_format','format','%s.%s','symlinkSync','message','findOne','removeSound','id2','createdAt','unlinkSync','getSounds','Sound'];(function(_0x396ec6,_0x4e6842){var _0x5ee601=function(_0x164e5b){while(--_0x164e5b){_0x396ec6['push'](_0x396ec6['shift']());}};_0x5ee601(++_0x4e6842);}(_0xb234,0x69));var _0x4b23=function(_0x125666,_0x3b928c){_0x125666=_0x125666-0x0;var _0x1e52be=_0xb234[_0x125666];return _0x1e52be;};'use strict';var emlformat=require(_0x4b23('0x0'));var rimraf=require(_0x4b23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4b23('0x2'));var moment=require(_0x4b23('0x3'));var BPromise=require(_0x4b23('0x4'));var Mustache=require(_0x4b23('0x5'));var util=require(_0x4b23('0x6'));var path=require(_0x4b23('0x7'));var sox=require(_0x4b23('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b23('0x9'));var squel=require(_0x4b23('0xa'));var crypto=require('crypto');var jsforce=require(_0x4b23('0xb'));var deskjs=require(_0x4b23('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4b23('0xd'));var Papa=require(_0x4b23('0xe'));var Redis=require('ioredis');var authService=require(_0x4b23('0xf'));var qs=require(_0x4b23('0x10'));var as=require(_0x4b23('0x11'));var hardwareService=require(_0x4b23('0x12'));var logger=require(_0x4b23('0x13'))(_0x4b23('0x14'));var utils=require('../../config/utils');var config=require(_0x4b23('0x15'));var licenseUtil=require(_0x4b23('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2318f1,_0x120ce5){_0x120ce5=_0x120ce5||0xcc;return function(_0x3a0c16){if(_0x3a0c16){return _0x2318f1['sendStatus'](_0x120ce5);}return _0x2318f1[_0x4b23('0x17')](_0x120ce5)['end']();};}function respondWithResult(_0x4ce799,_0x355645){_0x355645=_0x355645||0xc8;return function(_0xdea79e){if(_0xdea79e){return _0x4ce799[_0x4b23('0x17')](_0x355645)['json'](_0xdea79e);}};}function respondWithFilteredResult(_0x39cde0,_0x3c82bf){return function(_0x139e1a){if(_0x139e1a){var _0x110b98=typeof _0x3c82bf[_0x4b23('0x18')]===_0x4b23('0x19')&&typeof _0x3c82bf[_0x4b23('0x1a')]===_0x4b23('0x19');var _0x524919=_0x139e1a[_0x4b23('0x1b')];var _0xcdb5d3=_0x110b98?0x0:_0x3c82bf[_0x4b23('0x18')];var _0x47b8e5=_0x110b98?_0x139e1a[_0x4b23('0x1b')]:_0x3c82bf[_0x4b23('0x18')]+_0x3c82bf[_0x4b23('0x1a')];var _0x4cceb7;if(_0x47b8e5>=_0x524919){_0x47b8e5=_0x524919;_0x4cceb7=0xc8;}else{_0x4cceb7=0xce;}_0x39cde0[_0x4b23('0x17')](_0x4cceb7);return _0x39cde0[_0x4b23('0x1c')]('Content-Range',_0xcdb5d3+'-'+_0x47b8e5+'/'+_0x524919)[_0x4b23('0x1d')](_0x139e1a);}return null;};}function patchUpdates(_0x49cdd0){return function(_0x2d75a0){try{jsonpatch[_0x4b23('0x1e')](_0x2d75a0,_0x49cdd0,!![]);}catch(_0x13ffd1){return BPromise['reject'](_0x13ffd1);}return _0x2d75a0['save']();};}function saveUpdates(_0x57fe8e,_0x3f6aa4){return function(_0x1a6e3c){if(_0x1a6e3c){return _0x1a6e3c['update'](_0x57fe8e)[_0x4b23('0x1f')](function(_0x2319fa){return _0x2319fa;});}return null;};}function removeEntity(_0x146acc,_0x52dfed){return function(_0x58cec1){if(_0x58cec1){return _0x58cec1[_0x4b23('0x20')]()['then'](function(){var _0x1a091c=_0x58cec1[_0x4b23('0x21')]({'plain':!![]});var _0x44321c=_0x4b23('0x22');return db['UserProfileResource'][_0x4b23('0x20')]({'where':{'type':_0x44321c,'resourceId':_0x1a091c['id']}})['then'](function(){return _0x58cec1;});})[_0x4b23('0x1f')](function(){_0x146acc['status'](0xcc)[_0x4b23('0x23')]();});}};}function handleEntityNotFound(_0x785c84,_0x1c24d5){return function(_0x22f11e){if(!_0x22f11e){_0x785c84['sendStatus'](0x194);}return _0x22f11e;};}function handleError(_0x130a05,_0x3ef281){_0x3ef281=_0x3ef281||0x1f4;return function(_0x10375f){logger['error'](_0x10375f[_0x4b23('0x24')]);if(_0x10375f[_0x4b23('0x25')]){delete _0x10375f[_0x4b23('0x25')];}_0x130a05[_0x4b23('0x17')](_0x3ef281)['send'](_0x10375f);};}exports[_0x4b23('0x26')]=function(_0x5b1c7a,_0x36c239){var _0x404754={},_0x2c667c={},_0x1a2539={'count':0x0,'rows':[]};var _0x39e378=_['map'](db['VoiceMusicOnHold'][_0x4b23('0x27')],function(_0x3ab56c){return{'name':_0x3ab56c['fieldName'],'type':_0x3ab56c['type']['key']};});_0x2c667c[_0x4b23('0x28')]=_[_0x4b23('0x29')](_0x39e378,_0x4b23('0x25'));_0x2c667c['query']=_['keys'](_0x5b1c7a[_0x4b23('0x2a')]);_0x2c667c['filters']=_[_0x4b23('0x2b')](_0x2c667c[_0x4b23('0x28')],_0x2c667c[_0x4b23('0x2a')]);_0x404754[_0x4b23('0x2c')]=_[_0x4b23('0x2b')](_0x2c667c[_0x4b23('0x28')],qs[_0x4b23('0x2d')](_0x5b1c7a['query']['fields']));_0x404754['attributes']=_0x404754['attributes'][_0x4b23('0x2e')]?_0x404754[_0x4b23('0x2c')]:_0x2c667c[_0x4b23('0x28')];if(!_0x5b1c7a[_0x4b23('0x2a')][_0x4b23('0x2f')](_0x4b23('0x30'))){_0x404754['limit']=qs['limit'](_0x5b1c7a[_0x4b23('0x2a')][_0x4b23('0x1a')]);_0x404754[_0x4b23('0x18')]=qs[_0x4b23('0x18')](_0x5b1c7a[_0x4b23('0x2a')][_0x4b23('0x18')]);}_0x404754[_0x4b23('0x31')]=qs['sort'](_0x5b1c7a['query'][_0x4b23('0x32')]);delete _0x5b1c7a[_0x4b23('0x2a')][_0x4b23('0x32')];_0x404754[_0x4b23('0x33')]=qs[_0x4b23('0x34')](_['pick'](_0x5b1c7a['query'],_0x2c667c['filters']),_0x39e378);if(_0x5b1c7a[_0x4b23('0x2a')]['filter']){_0x404754[_0x4b23('0x33')]=_[_0x4b23('0x35')](_0x404754[_0x4b23('0x33')],{'$or':_[_0x4b23('0x29')](_0x39e378,function(_0x6e6ad9){if(_0x6e6ad9[_0x4b23('0x36')]!=='VIRTUAL'){var _0x4d56d7={};_0x4d56d7[_0x6e6ad9[_0x4b23('0x25')]]={'$like':'%'+_0x5b1c7a[_0x4b23('0x2a')]['filter']+'%'};return _0x4d56d7;}})});}_0x404754=_['merge']({},_0x404754,_0x5b1c7a[_0x4b23('0x37')]);var _0x3add7d={'where':_0x404754[_0x4b23('0x33')]};return db[_0x4b23('0x38')][_0x4b23('0x1b')](_0x3add7d)['then'](function(_0x32ef2f){_0x1a2539[_0x4b23('0x1b')]=_0x32ef2f;if(_0x5b1c7a['query'][_0x4b23('0x39')]){_0x404754['include']=[{'all':!![]}];}return db[_0x4b23('0x38')]['findAll'](_0x404754);})[_0x4b23('0x1f')](function(_0x3bea77){_0x1a2539[_0x4b23('0x3a')]=_0x3bea77;return _0x1a2539;})[_0x4b23('0x1f')](respondWithFilteredResult(_0x36c239,_0x404754))[_0x4b23('0x3b')](handleError(_0x36c239,null));};exports[_0x4b23('0x3c')]=function(_0x5ec884,_0x5ce563){var _0x375352={'raw':![],'where':{'id':_0x5ec884['params']['id']}},_0x470ede={};_0x470ede[_0x4b23('0x28')]=_[_0x4b23('0x3d')](db[_0x4b23('0x38')]['rawAttributes']);_0x470ede['query']=_[_0x4b23('0x3d')](_0x5ec884['query']);_0x470ede['filters']=_[_0x4b23('0x2b')](_0x470ede[_0x4b23('0x28')],_0x470ede['query']);_0x375352[_0x4b23('0x2c')]=_['intersection'](_0x470ede['model'],qs[_0x4b23('0x2d')](_0x5ec884['query'][_0x4b23('0x2d')]));_0x375352[_0x4b23('0x2c')]=_0x375352[_0x4b23('0x2c')][_0x4b23('0x2e')]?_0x375352[_0x4b23('0x2c')]:_0x470ede['model'];if(_0x5ec884[_0x4b23('0x2a')][_0x4b23('0x39')]){_0x375352[_0x4b23('0x3e')]=[{'all':!![]}];}_0x375352=_[_0x4b23('0x35')]({},_0x375352,_0x5ec884[_0x4b23('0x37')]);return db[_0x4b23('0x38')]['find'](_0x375352)[_0x4b23('0x1f')](handleEntityNotFound(_0x5ce563,null))[_0x4b23('0x1f')](respondWithResult(_0x5ce563,null))[_0x4b23('0x3b')](handleError(_0x5ce563,null));};exports[_0x4b23('0x3f')]=function(_0x376bca,_0x32f4e3){if(_0x376bca['body']['id']){delete _0x376bca[_0x4b23('0x40')]['id'];}return db[_0x4b23('0x38')]['find']({'where':{'id':_0x376bca[_0x4b23('0x41')]['id']}})[_0x4b23('0x1f')](handleEntityNotFound(_0x32f4e3,null))[_0x4b23('0x1f')](saveUpdates(_0x376bca['body'],null))['then'](respondWithResult(_0x32f4e3,null))[_0x4b23('0x3b')](handleError(_0x32f4e3,null));};exports[_0x4b23('0x42')]=function(_0xf46fbd,_0x2ecc83,_0x23dbef){return db[_0x4b23('0x43')]['transaction'](function(_0x355ad7){if(_0xf46fbd[_0x4b23('0x40')]['mode']===_0x4b23('0x44')){_0xf46fbd[_0x4b23('0x40')]['directory']=path[_0x4b23('0x45')](config[_0x4b23('0x46')],_0x4b23('0x47'),_0xf46fbd[_0x4b23('0x40')][_0x4b23('0x25')]);}return db['VoiceMusicOnHold'][_0x4b23('0x42')](_0xf46fbd[_0x4b23('0x40')],{'transaction':_0x355ad7})[_0x4b23('0x1f')](function(_0x22935b){if(_0xf46fbd[_0x4b23('0x40')][_0x4b23('0x48')]===_0x4b23('0x44')){fs[_0x4b23('0x49')](_0x22935b[_0x4b23('0x4a')],parseInt('0777',0x8));}var _0x4901f7=_0xf46fbd['user']['get']({'plain':!![]});if(!_0x4901f7)throw new Error(_0x4b23('0x4b'));if(_0x4901f7[_0x4b23('0x4c')]==='user'){var _0x149c1c=_0x22935b[_0x4b23('0x21')]({'plain':!![]});return db['UserProfileSection'][_0x4b23('0x4d')]({'where':{'name':_0x4b23('0x22'),'userProfileId':_0x4901f7[_0x4b23('0x4e')]},'raw':!![]})[_0x4b23('0x1f')](function(_0x43f7a3){if(_0x43f7a3&&_0x43f7a3[_0x4b23('0x4f')]===0x0){return db[_0x4b23('0x50')]['create']({'name':_0x149c1c[_0x4b23('0x25')],'resourceId':_0x149c1c['id'],'type':_0x43f7a3[_0x4b23('0x25')],'sectionId':_0x43f7a3['id']},{})[_0x4b23('0x1f')](function(){return _0x22935b;});}else{return _0x22935b;}})[_0x4b23('0x3b')](function(_0xbbcd2a){logger[_0x4b23('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbbcd2a);});}return _0x22935b;});})[_0x4b23('0x1f')](respondWithResult(_0x2ecc83,0xc9))[_0x4b23('0x3b')](handleError(_0x2ecc83,null));};exports[_0x4b23('0x20')]=function(_0x5db6bc,_0x18cacf,_0x9f76f2){var _0x31e377;return db[_0x4b23('0x38')][_0x4b23('0x4d')]({'where':{'id':_0x5db6bc[_0x4b23('0x41')]['id']}})[_0x4b23('0x1f')](function(_0x4f0309){if(_0x4f0309){return db[_0x4b23('0x43')][_0x4b23('0x52')](function(_0x30dd52){return _0x4f0309[_0x4b23('0x20')]({'transaction':_0x30dd52,'raw':!![]})[_0x4b23('0x1f')](function(_0x1a6de3){if(_0x1a6de3[_0x4b23('0x4a')]){fs[_0x4b23('0x53')](_0x1a6de3[_0x4b23('0x4a')])[_0x4b23('0x54')](function(_0x2709dc){fs['unlinkSync'](path[_0x4b23('0x45')](_0x1a6de3['directory'],_0x2709dc));});fs['rmdirSync'](_0x1a6de3[_0x4b23('0x4a')]);}return _0x1a6de3;});})[_0x4b23('0x3b')](function(_0x9f705b){throw new db[(_0x4b23('0x55'))][(_0x4b23('0x56'))](_0x9f705b['message']);});}})[_0x4b23('0x1f')](handleEntityNotFound(_0x18cacf,null))[_0x4b23('0x1f')](removeEntity(_0x18cacf,null))[_0x4b23('0x3b')](handleError(_0x18cacf,null));};exports['addSound']=function(_0xa583a1,_0x7a6c,_0x5f2733){return db[_0x4b23('0x43')][_0x4b23('0x52')](function(_0x1066e5){var _0xaf3c21;return db[_0x4b23('0x38')][_0x4b23('0x4d')]({'where':{'id':_0xa583a1[_0x4b23('0x41')]['id']}})[_0x4b23('0x1f')](function(_0x21a6b3){if(_0x21a6b3){_0xaf3c21=_0x21a6b3;return _0x21a6b3[_0x4b23('0x57')](_0xa583a1[_0x4b23('0x40')]['id'],{'transaction':_0x1066e5});}})[_0x4b23('0x1f')](function(_0x33449b){if(_0x33449b){return db['Sound']['findOne']({'where':{'id':_0xa583a1[_0x4b23('0x40')]['id']},'attributes':['id',_0x4b23('0x25'),_0x4b23('0x58'),_0x4b23('0x59'),'createdAt'],'raw':!![]});}})[_0x4b23('0x1f')](function(_0x35c59f){if(_0x35c59f){var _0x3364bb=path[_0x4b23('0x45')](config[_0x4b23('0x46')],'server/files/sounds/converted',util[_0x4b23('0x5a')](_0x4b23('0x5b'),path['basename'](_0x35c59f['save_name'],path['extname'](_0x35c59f[_0x4b23('0x58')])),_0x35c59f[_0x4b23('0x59')]));var _0x4f210a=path[_0x4b23('0x45')](config[_0x4b23('0x46')],'server/files/moh',_0xaf3c21[_0x4b23('0x25')],util[_0x4b23('0x5a')](_0x4b23('0x5b'),_0x35c59f[_0x4b23('0x25')],_0x35c59f[_0x4b23('0x59')]));fs[_0x4b23('0x5c')](_0x3364bb,_0x4f210a);return _0x35c59f;}})[_0x4b23('0x3b')](function(_0x2e98eb){throw new db[(_0x4b23('0x55'))][(_0x4b23('0x56'))](_0x2e98eb[_0x4b23('0x5d')]);});})[_0x4b23('0x1f')](handleEntityNotFound(_0x7a6c,null))['then'](respondWithResult(_0x7a6c,0xc9))[_0x4b23('0x3b')](handleError(_0x7a6c,null));};exports['removeSound']=function(_0x471001,_0x8619eb,_0x57cb88){return db[_0x4b23('0x43')]['transaction'](function(_0x75dbea){var _0x2a2a85;return db[_0x4b23('0x38')][_0x4b23('0x5e')]({'where':{'id':_0x471001[_0x4b23('0x41')]['id']}})[_0x4b23('0x1f')](handleEntityNotFound(_0x8619eb,null))['then'](function(_0x3e3b14){if(_0x3e3b14){_0x2a2a85=_0x3e3b14;return _0x3e3b14[_0x4b23('0x5f')](_0x471001[_0x4b23('0x41')][_0x4b23('0x60')]);}})[_0x4b23('0x1f')](function(_0xacf4b4){if(_0xacf4b4){return db['Sound'][_0x4b23('0x5e')]({'where':{'id':_0x471001['params']['id2']},'attributes':['id',_0x4b23('0x25'),_0x4b23('0x58'),'converted_format',_0x4b23('0x61')],'raw':!![]});}})['then'](function(_0x27b968){if(_0x27b968){fs[_0x4b23('0x62')](path[_0x4b23('0x45')](_0x2a2a85[_0x4b23('0x4a')],util['format']('%s.%s',_0x27b968[_0x4b23('0x25')],_0x27b968[_0x4b23('0x59')])));return _0x27b968;}})[_0x4b23('0x3b')](function(_0x4e62e7){throw new db[(_0x4b23('0x55'))][(_0x4b23('0x56'))](_0x4e62e7[_0x4b23('0x5d')]);});})[_0x4b23('0x1f')](handleEntityNotFound(_0x8619eb,null))[_0x4b23('0x1f')](respondWithStatusCode(_0x8619eb,0xcc))[_0x4b23('0x3b')](handleError(_0x8619eb,null));};exports[_0x4b23('0x63')]=function(_0x58831b,_0x3339fc,_0x37373d){var _0x3363af={};var _0x28ad06={};var _0x12560a;var _0x27a1db;return db[_0x4b23('0x38')][_0x4b23('0x5e')]({'where':{'id':_0x58831b[_0x4b23('0x41')]['id']}})['then'](handleEntityNotFound(_0x3339fc,null))['then'](function(_0x2cd40c){if(_0x2cd40c){_0x12560a=_0x2cd40c;_0x28ad06[_0x4b23('0x28')]=_['keys'](db[_0x4b23('0x64')][_0x4b23('0x27')]);_0x28ad06[_0x4b23('0x2a')]=_['keys'](_0x58831b[_0x4b23('0x2a')]);_0x28ad06[_0x4b23('0x34')]=_[_0x4b23('0x2b')](_0x28ad06[_0x4b23('0x28')],_0x28ad06[_0x4b23('0x2a')]);_0x3363af[_0x4b23('0x2c')]=_['intersection'](_0x28ad06['model'],qs[_0x4b23('0x2d')](_0x58831b[_0x4b23('0x2a')][_0x4b23('0x2d')]));_0x3363af[_0x4b23('0x2c')]=_0x3363af[_0x4b23('0x2c')][_0x4b23('0x2e')]?_0x3363af[_0x4b23('0x2c')]:_0x28ad06[_0x4b23('0x28')];_0x3363af[_0x4b23('0x31')]=qs[_0x4b23('0x32')](_0x58831b[_0x4b23('0x2a')][_0x4b23('0x32')]);_0x3363af[_0x4b23('0x33')]=qs[_0x4b23('0x34')](_[_0x4b23('0x65')](_0x58831b[_0x4b23('0x2a')],_0x28ad06['filters']));if(_0x58831b[_0x4b23('0x2a')][_0x4b23('0x66')]){_0x3363af['where']=_[_0x4b23('0x35')](_0x3363af['where'],{'$or':_[_0x4b23('0x29')](_0x3363af[_0x4b23('0x2c')],function(_0x12d8e7){var _0x56c923={};_0x56c923[_0x12d8e7]={'$like':'%'+_0x58831b[_0x4b23('0x2a')][_0x4b23('0x66')]+'%'};return _0x56c923;})});}_0x3363af=_[_0x4b23('0x35')]({},_0x3363af,_0x58831b[_0x4b23('0x37')]);return _0x12560a[_0x4b23('0x63')](_0x3363af);}})['then'](function(_0x21de37){if(_0x21de37){_0x27a1db=_0x21de37[_0x4b23('0x2e')];if(!_0x58831b[_0x4b23('0x2a')][_0x4b23('0x2f')](_0x4b23('0x30'))){_0x3363af['limit']=qs[_0x4b23('0x1a')](_0x58831b[_0x4b23('0x2a')]['limit']);_0x3363af['offset']=qs[_0x4b23('0x18')](_0x58831b[_0x4b23('0x2a')][_0x4b23('0x18')]);}return _0x12560a[_0x4b23('0x63')](_0x3363af);}})['then'](function(_0x1be8da){if(_0x1be8da){return _0x1be8da?{'count':_0x27a1db,'rows':_0x1be8da}:null;}})[_0x4b23('0x1f')](respondWithResult(_0x3339fc,null))[_0x4b23('0x3b')](handleError(_0x3339fc,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index dbd9edb..e862f0b 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 _0xea61=['define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x422165,_0x1eed41){var _0x2492b0=function(_0x291908){while(--_0x291908){_0x422165['push'](_0x422165['shift']());}};_0x2492b0(++_0x1eed41);}(_0xea61,0x148));var _0x1ea6=function(_0x382153,_0x1724be){_0x382153=_0x382153-0x0;var _0x3edc3d=_0xea61[_0x382153];return _0x3edc3d;};'use strict';var _=require(_0x1ea6('0x0'));var util=require('util');var logger=require(_0x1ea6('0x1'))(_0x1ea6('0x2'));var moment=require(_0x1ea6('0x3'));var BPromise=require(_0x1ea6('0x4'));var rp=require(_0x1ea6('0x5'));var fs=require('fs');var path=require(_0x1ea6('0x6'));var rimraf=require(_0x1ea6('0x7'));var config=require(_0x1ea6('0x8'));var attributes=require(_0x1ea6('0x9'));module['exports']=function(_0x34bd68,_0x4dad29){return _0x34bd68[_0x1ea6('0xa')](_0x1ea6('0xb'),attributes,{'tableName':_0x1ea6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3046=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','util','../../config/logger','api'];(function(_0x47b37e,_0x5afb98){var _0x1c1eb9=function(_0x59c1a3){while(--_0x59c1a3){_0x47b37e['push'](_0x47b37e['shift']());}};_0x1c1eb9(++_0x5afb98);}(_0x3046,0x80));var _0x6304=function(_0x4bec48,_0x2c2129){_0x4bec48=_0x4bec48-0x0;var _0x3c8b0a=_0x3046[_0x4bec48];return _0x3c8b0a;};'use strict';var _=require(_0x6304('0x0'));var util=require(_0x6304('0x1'));var logger=require(_0x6304('0x2'))(_0x6304('0x3'));var moment=require(_0x6304('0x4'));var BPromise=require(_0x6304('0x5'));var rp=require(_0x6304('0x6'));var fs=require('fs');var path=require(_0x6304('0x7'));var rimraf=require(_0x6304('0x8'));var config=require(_0x6304('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x311168,_0x5ef388){return _0x311168[_0x6304('0xa')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','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 71ba9f9..b49bbc9 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x555977,_0x290185){var _0x5b1695=function(_0x4886ef){while(--_0x4886ef){_0x555977['push'](_0x555977['shift']());}};_0x5b1695(++_0x290185);}(_0x34e8,0x12c));var _0x834e=function(_0x42f848,_0x4efeaf){_0x42f848=_0x42f848-0x0;var _0x439bac=_0x34e8[_0x42f848];return _0x439bac;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +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(_0x3df5b5,_0x4f776c){var _0x24df1c=function(_0x39191b){while(--_0x39191b){_0x3df5b5['push'](_0x3df5b5['shift']());}};_0x24df1c(++_0x4f776c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 c5a8b7c..1c85361 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 _0x74eb=['index','isAuthenticated','/:id','show','getAgents','/:id/teams','getTeams','post','/:id/users','addAgents','addTeams','update','delete','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x74eb,0x13b));var _0xb74e=function(_0x59afbd,_0x1f72e4){_0x59afbd=_0x59afbd-0x0;var _0x1b9242=_0x74eb[_0x59afbd];return _0x1b9242;};'use strict';var multer=require(_0xb74e('0x0'));var util=require(_0xb74e('0x1'));var path=require(_0xb74e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb74e('0x3'));var router=express[_0xb74e('0x4')]();var fs_extra=require(_0xb74e('0x5'));var auth=require(_0xb74e('0x6'));var interaction=require(_0xb74e('0x7'));var config=require(_0xb74e('0x8'));var controller=require('./voicePrefix.controller');router[_0xb74e('0x9')]('/',auth['isAuthenticated'](),controller[_0xb74e('0xa')]);router[_0xb74e('0x9')]('/describe',auth[_0xb74e('0xb')](),controller['describe']);router['get'](_0xb74e('0xc'),auth['isAuthenticated'](),controller[_0xb74e('0xd')]);router[_0xb74e('0x9')]('/:id/users',auth[_0xb74e('0xb')](),controller[_0xb74e('0xe')]);router[_0xb74e('0x9')](_0xb74e('0xf'),auth[_0xb74e('0xb')](),controller[_0xb74e('0x10')]);router[_0xb74e('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb74e('0x11')](_0xb74e('0x12'),auth[_0xb74e('0xb')](),controller[_0xb74e('0x13')]);router[_0xb74e('0x11')](_0xb74e('0xf'),auth[_0xb74e('0xb')](),controller[_0xb74e('0x14')]);router['put'](_0xb74e('0xc'),auth[_0xb74e('0xb')](),controller[_0xb74e('0x15')]);router['delete']('/:id',auth[_0xb74e('0xb')](),controller['destroy']);router[_0xb74e('0x16')]('/:id/users',auth[_0xb74e('0xb')](),controller[_0xb74e('0x17')]);router[_0xb74e('0x16')](_0xb74e('0xf'),auth['isAuthenticated'](),controller['removeTeams']);module[_0xb74e('0x18')]=router; \ No newline at end of file +var _0xc43c=['describe','/:id','show','/:id/users','getAgents','getTeams','post','create','/:id/teams','put','update','delete','removeAgents','removeTeams','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe'];(function(_0x2c697f,_0x39cb6a){var _0x18d8bb=function(_0x58dd0b){while(--_0x58dd0b){_0x2c697f['push'](_0x2c697f['shift']());}};_0x18d8bb(++_0x39cb6a);}(_0xc43c,0x152));var _0xcc43=function(_0x45745f,_0x547042){_0x45745f=_0x45745f-0x0;var _0x123706=_0xc43c[_0x45745f];return _0x123706;};'use strict';var multer=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var path=require(_0xcc43('0x2'));var timeout=require(_0xcc43('0x3'));var express=require(_0xcc43('0x4'));var router=express[_0xcc43('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcc43('0x6'));var interaction=require(_0xcc43('0x7'));var config=require('../../config/environment');var controller=require(_0xcc43('0x8'));router[_0xcc43('0x9')]('/',auth[_0xcc43('0xa')](),controller[_0xcc43('0xb')]);router[_0xcc43('0x9')](_0xcc43('0xc'),auth[_0xcc43('0xa')](),controller[_0xcc43('0xd')]);router[_0xcc43('0x9')](_0xcc43('0xe'),auth['isAuthenticated'](),controller[_0xcc43('0xf')]);router[_0xcc43('0x9')](_0xcc43('0x10'),auth[_0xcc43('0xa')](),controller[_0xcc43('0x11')]);router[_0xcc43('0x9')]('/:id/teams',auth[_0xcc43('0xa')](),controller[_0xcc43('0x12')]);router[_0xcc43('0x13')]('/',auth[_0xcc43('0xa')](),controller[_0xcc43('0x14')]);router[_0xcc43('0x13')]('/:id/users',auth[_0xcc43('0xa')](),controller['addAgents']);router[_0xcc43('0x13')](_0xcc43('0x15'),auth['isAuthenticated'](),controller['addTeams']);router[_0xcc43('0x16')](_0xcc43('0xe'),auth[_0xcc43('0xa')](),controller[_0xcc43('0x17')]);router[_0xcc43('0x18')](_0xcc43('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xcc43('0x18')](_0xcc43('0x10'),auth[_0xcc43('0xa')](),controller[_0xcc43('0x19')]);router['delete'](_0xcc43('0x15'),auth[_0xcc43('0xa')](),controller[_0xcc43('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index bd7ea94..5b3af36 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 _0x6c07=['name','VIRTUAL','system-','getDataValue','STRING','INTEGER','sequelize','exports'];(function(_0x2b6677,_0x1dab11){var _0x56ca1a=function(_0x2c8f44){while(--_0x2c8f44){_0x2b6677['push'](_0x2b6677['shift']());}};_0x56ca1a(++_0x1dab11);}(_0x6c07,0x166));var _0x76c0=function(_0x3f07b7,_0x2e4c76){_0x3f07b7=_0x3f07b7-0x0;var _0x511826=_0x6c07[_0x3f07b7];return _0x511826;};'use strict';var Sequelize=require(_0x76c0('0x0'));module[_0x76c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x76c0('0x2')},'prefix':{'type':Sequelize[_0x76c0('0x3')],'get':function(_0x39110b){return _0x76c0('0x4')+this[_0x76c0('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x76c0('0x6')]},'callerIdAll':{'type':Sequelize[_0x76c0('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0x76c0('0x7')]}}; \ No newline at end of file +var _0x9896=['VIRTUAL','system-','getDataValue','name','sequelize','STRING'];(function(_0x30839b,_0x3053e9){var _0x5c1734=function(_0x179f2e){while(--_0x179f2e){_0x30839b['push'](_0x30839b['shift']());}};_0x5c1734(++_0x3053e9);}(_0x9896,0xfa));var _0x6989=function(_0xd56319,_0x497fd8){_0xd56319=_0xd56319-0x0;var _0x52d641=_0x9896[_0xd56319];return _0x52d641;};'use strict';var Sequelize=require(_0x6989('0x0'));module['exports']={'name':{'type':Sequelize[_0x6989('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x6989('0x2')],'get':function(_0x575f33){return _0x6989('0x3')+this[_0x6989('0x4')](_0x6989('0x5'))+'-';}},'description':{'type':Sequelize[_0x6989('0x1')]},'callerIdAll':{'type':Sequelize[_0x6989('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a13f1a1..44857c6 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 _0x5f66=['map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoicePrefix','count','includeAll','include','findAll','rows','catch','find','destroy','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','goto','charAt','system-','findById','params','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','getAgents','hasOwnProperty','getTeams','Team','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','User','select','from','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','update','get','VoicePrefixes','UserProfileResource','then','error','stack','send'];(function(_0x652c36,_0xbd54a1){var _0x30c32f=function(_0x1533dc){while(--_0x1533dc){_0x652c36['push'](_0x652c36['shift']());}};_0x30c32f(++_0xbd54a1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];config[_0x65f6('0x14')]=_['defaults'](config[_0x65f6('0x14')],{'host':_0x65f6('0x15'),'port':0x18eb});var socket=require(_0x65f6('0x16'))(new Redis(config[_0x65f6('0x14')]));require(_0x65f6('0x17'))[_0x65f6('0x18')](socket);function respondWithStatusCode(_0x44144b,_0xb1d40a){_0xb1d40a=_0xb1d40a||0xcc;return function(_0x46dbc6){if(_0x46dbc6){return _0x44144b[_0x65f6('0x19')](_0xb1d40a);}return _0x44144b['status'](_0xb1d40a)[_0x65f6('0x1a')]();};}function respondWithResult(_0x49a913,_0x5dd324){_0x5dd324=_0x5dd324||0xc8;return function(_0x1693e6){if(_0x1693e6){return _0x49a913[_0x65f6('0x1b')](_0x5dd324)[_0x65f6('0x1c')](_0x1693e6);}};}function respondWithFilteredResult(_0x1c955c,_0x1b1cbb){return function(_0x1f974c){if(_0x1f974c){var _0xc8660c=typeof _0x1b1cbb[_0x65f6('0x1d')]==='undefined'&&typeof _0x1b1cbb['limit']===_0x65f6('0x1e');var _0x5b4055=_0x1f974c['count'];var _0x5c5b91=_0xc8660c?0x0:_0x1b1cbb[_0x65f6('0x1d')];var _0x21ea88=_0xc8660c?_0x1f974c['count']:_0x1b1cbb[_0x65f6('0x1d')]+_0x1b1cbb[_0x65f6('0x1f')];var _0xbee6a4;if(_0x21ea88>=_0x5b4055){_0x21ea88=_0x5b4055;_0xbee6a4=0xc8;}else{_0xbee6a4=0xce;}_0x1c955c[_0x65f6('0x1b')](_0xbee6a4);return _0x1c955c[_0x65f6('0x20')](_0x65f6('0x21'),_0x5c5b91+'-'+_0x21ea88+'/'+_0x5b4055)['json'](_0x1f974c);}return null;};}function patchUpdates(_0x197a49){return function(_0x4bb39e){try{jsonpatch['apply'](_0x4bb39e,_0x197a49,!![]);}catch(_0x212247){return BPromise[_0x65f6('0x22')](_0x212247);}return _0x4bb39e['save']();};}function saveUpdates(_0x1eeaaa,_0x471a33){return function(_0x2317ce){if(_0x2317ce){return _0x2317ce[_0x65f6('0x23')](_0x1eeaaa)['then'](function(_0x9d7bb0){return _0x9d7bb0;});}return null;};}function removeEntity(_0x59ea32,_0x20a161){return function(_0x5963e0){if(_0x5963e0){return _0x5963e0['destroy']()['then'](function(){var _0x29abdb=_0x5963e0[_0x65f6('0x24')]({'plain':!![]});var _0x4b2292=_0x65f6('0x25');return db[_0x65f6('0x26')]['destroy']({'where':{'type':_0x4b2292,'resourceId':_0x29abdb['id']}})[_0x65f6('0x27')](function(){return _0x5963e0;});})[_0x65f6('0x27')](function(){_0x59ea32[_0x65f6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac04b,_0x488d36){return function(_0x266cfe){if(!_0x266cfe){_0x4ac04b[_0x65f6('0x19')](0x194);}return _0x266cfe;};}function handleError(_0x4344b3,_0x408ccc){_0x408ccc=_0x408ccc||0x1f4;return function(_0x518cac){logger[_0x65f6('0x28')](_0x518cac[_0x65f6('0x29')]);if(_0x518cac['name']){delete _0x518cac['name'];}_0x4344b3[_0x65f6('0x1b')](_0x408ccc)[_0x65f6('0x2a')](_0x518cac);};}exports['index']=function(_0x4e50c0,_0x10b368){var _0x1ce43c={},_0x11fe3b={},_0xc53cb7={'count':0x0,'rows':[]};var _0x1217fd=_[_0x65f6('0x2b')](db['VoicePrefix'][_0x65f6('0x2c')],function(_0x38f3c6){return{'name':_0x38f3c6[_0x65f6('0x2d')],'type':_0x38f3c6['type'][_0x65f6('0x2e')]};});_0x11fe3b[_0x65f6('0x2f')]=_[_0x65f6('0x2b')](_0x1217fd,_0x65f6('0x30'));_0x11fe3b[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x4e50c0['query']);_0x11fe3b[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x11fe3b['model'],_0x11fe3b[_0x65f6('0x31')]);_0x1ce43c['attributes']=_[_0x65f6('0x34')](_0x11fe3b['model'],qs[_0x65f6('0x35')](_0x4e50c0[_0x65f6('0x31')]['fields']));_0x1ce43c[_0x65f6('0x36')]=_0x1ce43c[_0x65f6('0x36')][_0x65f6('0x37')]?_0x1ce43c['attributes']:_0x11fe3b['model'];if(!_0x4e50c0[_0x65f6('0x31')]['hasOwnProperty'](_0x65f6('0x38'))){_0x1ce43c['limit']=qs[_0x65f6('0x1f')](_0x4e50c0[_0x65f6('0x31')]['limit']);_0x1ce43c[_0x65f6('0x1d')]=qs['offset'](_0x4e50c0['query'][_0x65f6('0x1d')]);}_0x1ce43c[_0x65f6('0x39')]=qs[_0x65f6('0x3a')](_0x4e50c0[_0x65f6('0x31')][_0x65f6('0x3a')]);_0x1ce43c[_0x65f6('0x3b')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3c')](_0x4e50c0['query'],_0x11fe3b[_0x65f6('0x33')]),_0x1217fd);if(_0x4e50c0['query'][_0x65f6('0x3d')]){_0x1ce43c[_0x65f6('0x3b')]=_[_0x65f6('0x3e')](_0x1ce43c[_0x65f6('0x3b')],{'$or':_['map'](_0x1217fd,function(_0x32148f){if(_0x32148f[_0x65f6('0x3f')]!==_0x65f6('0x40')){var _0x3fb1c6={};_0x3fb1c6[_0x32148f[_0x65f6('0x30')]]={'$like':'%'+_0x4e50c0[_0x65f6('0x31')][_0x65f6('0x3d')]+'%'};return _0x3fb1c6;}})});}_0x1ce43c=_[_0x65f6('0x3e')]({},_0x1ce43c,_0x4e50c0[_0x65f6('0x41')]);var _0x5d8e48={'where':_0x1ce43c[_0x65f6('0x3b')]};return db[_0x65f6('0x42')][_0x65f6('0x43')](_0x5d8e48)[_0x65f6('0x27')](function(_0x83e2d9){_0xc53cb7[_0x65f6('0x43')]=_0x83e2d9;if(_0x4e50c0[_0x65f6('0x31')][_0x65f6('0x44')]){_0x1ce43c[_0x65f6('0x45')]=[{'all':!![]}];}return db[_0x65f6('0x42')][_0x65f6('0x46')](_0x1ce43c);})[_0x65f6('0x27')](function(_0x6c4d94){_0xc53cb7[_0x65f6('0x47')]=_0x6c4d94;return _0xc53cb7;})[_0x65f6('0x27')](respondWithFilteredResult(_0x10b368,_0x1ce43c))[_0x65f6('0x48')](handleError(_0x10b368,null));};exports['show']=function(_0x2dd16c,_0x37cd36){var _0x2d8c45={'raw':![],'where':{'id':_0x2dd16c['params']['id']}},_0x3828c9={};_0x3828c9[_0x65f6('0x2f')]=_[_0x65f6('0x32')](db[_0x65f6('0x42')]['rawAttributes']);_0x3828c9[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x2dd16c[_0x65f6('0x31')]);_0x3828c9[_0x65f6('0x33')]=_['intersection'](_0x3828c9[_0x65f6('0x2f')],_0x3828c9['query']);_0x2d8c45[_0x65f6('0x36')]=_[_0x65f6('0x34')](_0x3828c9['model'],qs[_0x65f6('0x35')](_0x2dd16c['query'][_0x65f6('0x35')]));_0x2d8c45[_0x65f6('0x36')]=_0x2d8c45[_0x65f6('0x36')][_0x65f6('0x37')]?_0x2d8c45[_0x65f6('0x36')]:_0x3828c9[_0x65f6('0x2f')];if(_0x2dd16c['query']['includeAll']){_0x2d8c45[_0x65f6('0x45')]=[{'all':!![]}];}_0x2d8c45=_[_0x65f6('0x3e')]({},_0x2d8c45,_0x2dd16c[_0x65f6('0x41')]);return db[_0x65f6('0x42')][_0x65f6('0x49')](_0x2d8c45)[_0x65f6('0x27')](handleEntityNotFound(_0x37cd36,null))[_0x65f6('0x27')](respondWithResult(_0x37cd36,null))[_0x65f6('0x48')](handleError(_0x37cd36,null));};exports[_0x65f6('0x4a')]=function(_0x517a47,_0x1f16cf){return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x517a47['params']['id']}})[_0x65f6('0x27')](handleEntityNotFound(_0x1f16cf,null))[_0x65f6('0x27')](removeEntity(_0x1f16cf,null))['catch'](handleError(_0x1f16cf,null));};exports[_0x65f6('0x4b')]=function(_0x253d52,_0x57eb04){return db[_0x65f6('0x42')]['describe']()[_0x65f6('0x27')](respondWithResult(_0x57eb04,null))[_0x65f6('0x48')](handleError(_0x57eb04,null));};exports[_0x65f6('0x4c')]=function(_0x4b9f0a,_0x1646c5){var _0x43a52e;return db['sequelize'][_0x65f6('0x4d')](function(_0x34312c){return db['VoicePrefix'][_0x65f6('0x4c')](_0x4b9f0a[_0x65f6('0x4e')],{'transaction':_0x34312c})[_0x65f6('0x27')](function(_0x25d504){_0x43a52e=_0x25d504[_0x65f6('0x24')]({'plain':!![]});return db[_0x65f6('0x4f')][_0x65f6('0x49')]({'where':{'id':_0x43a52e[_0x65f6('0x50')]},'raw':!![]})['then'](function(_0x52c5a4){return createVoicePrefixExtensions(_0x43a52e,_0x52c5a4,_0x34312c);});});})['then'](function(){var _0x19f40c=_0x4b9f0a[_0x65f6('0x51')][_0x65f6('0x24')]({'plain':!![]});if(!_0x19f40c)throw new Error(_0x65f6('0x52'));if(_0x19f40c['role']===_0x65f6('0x51')){var _0x2032b9=_0x43a52e;return db[_0x65f6('0x53')]['find']({'where':{'name':_0x65f6('0x25'),'userProfileId':_0x19f40c[_0x65f6('0x54')]},'raw':!![]})[_0x65f6('0x27')](function(_0x4e289e){if(_0x4e289e&&_0x4e289e['autoAssociation']===0x0){return db[_0x65f6('0x26')][_0x65f6('0x4c')]({'name':_0x2032b9[_0x65f6('0x30')],'resourceId':_0x2032b9['id'],'type':_0x4e289e[_0x65f6('0x30')],'sectionId':_0x4e289e['id']},{})[_0x65f6('0x27')](function(){return _0x43a52e;});}else{return _0x43a52e;}})[_0x65f6('0x48')](function(_0x35d77f){logger[_0x65f6('0x28')](_0x65f6('0x55'),_0x35d77f);throw _0x35d77f;});}return _0x43a52e;})[_0x65f6('0x27')](respondWithResult(_0x1646c5,null))[_0x65f6('0x48')](handleError(_0x1646c5,null));};function Extension(_0x141fcc,_0x30adee,_0x3e3143,_0x5ba9c6){this[_0x65f6('0x56')]=_0x65f6('0x57');this[_0x65f6('0x58')]=_0x141fcc;this['app']=_0x3e3143;this[_0x65f6('0x3f')]=_0x65f6('0x59');this[_0x65f6('0x5a')]=_0x65f6('0x5b');this['priority']=_0x30adee;this[_0x65f6('0x5c')]=_0x5ba9c6;}function createVoicePrefixExtensions(_0x4227f5,_0xe5fc65,_0x3e0d8b){return new BPromise(function(_0x553ff0,_0x2923ff){var _0x2fc20f=new Extension(formatPrefixName(_0x4227f5['prefix']),0x1,_0x65f6('0x5d'),_0x65f6('0x5e'));_0x2fc20f[_0x65f6('0x5f')]=_0x4227f5['id'];return db['VoiceExtension'][_0x65f6('0x4c')](_0x2fc20f,{'transaction':_0x3e0d8b})[_0x65f6('0x27')](function(_0x3974ef){var _0x3c23e3=_0x3974ef[_0x65f6('0x24')]({'plain':!![]});var _0x334fa1=_['map'](addVoicePrefixExtensions(_0x4227f5,_0xe5fc65),function(_0x4ee8bd){_0x4ee8bd['VoiceExtensionId']=_0x3c23e3['id'];_0x4ee8bd[_0x65f6('0x5f')]=_0x4227f5['id'];return _0x4ee8bd;});return db[_0x65f6('0x4f')][_0x65f6('0x60')](_0x334fa1,{'transaction':_0x3e0d8b})[_0x65f6('0x27')](function(_0xab6f0){if(!_0xab6f0){return _0x2923ff(_0x65f6('0x61'));}else{return _0x553ff0(_0xab6f0);}})['catch'](function(_0xfbfebc){return _0x2923ff(_0xfbfebc);});});;});};function addVoicePrefixExtensions(_0x1d1532,_0x54b569){var _0x225aeb=[];var _0x39c244=formatPrefixName(_0x1d1532[_0x65f6('0x62')]);_0x225aeb['push'](new Extension(_0x39c244,0x2,_0x65f6('0x63'),_0x65f6('0x64')+_0x1d1532['name']));if(_0x1d1532[_0x65f6('0x65')]){_0x225aeb[_0x65f6('0x66')](new Extension(_0x39c244,0x3,_0x65f6('0x63'),_0x65f6('0x67')+_0x1d1532[_0x65f6('0x65')]));}else{_0x225aeb[_0x65f6('0x66')](new Extension(_0x39c244,0x3,_0x65f6('0x5d'),'No\x20callerid\x20available'));}_0x225aeb['push'](new Extension(_0x39c244,0x4,_0x65f6('0x68'),_0x54b569[_0x65f6('0x56')]+','+'${EXTEN:'+(0x8+_0x1d1532[_0x65f6('0x30')]['length'])+'}'+','+0x1));return _0x225aeb;}function formatPrefixName(_0x3a483b){var _0x4e0450='_';for(var _0x440df1=0x0;_0x440df1<_0x3a483b[_0x65f6('0x37')];_0x440df1++){if(_0x3a483b[_0x65f6('0x69')](_0x440df1)=='-'){_0x4e0450+=_0x3a483b[_0x65f6('0x69')](_0x440df1);}else{_0x4e0450+='['+_0x3a483b[_0x65f6('0x69')](_0x440df1)+']';}}_0x4e0450+='.';return _0x4e0450;}exports[_0x65f6('0x23')]=function(_0x1aaf75,_0x1cc66a,_0x2405a7){var _0x4b7ecd=_0x1aaf75['body'];_0x4b7ecd[_0x65f6('0x62')]=_0x65f6('0x6a')+_0x4b7ecd[_0x65f6('0x30')]+'-';return db['sequelize']['transaction'](function(_0x2dbec2){return db[_0x65f6('0x42')][_0x65f6('0x23')](_0x4b7ecd,{'where':{'id':_0x4b7ecd['id']},'transaction':_0x2dbec2})[_0x65f6('0x27')](function(){return db[_0x65f6('0x4f')][_0x65f6('0x4a')]({'where':{'VoicePrefixId':_0x4b7ecd['id']},'transaction':_0x2dbec2})['then'](function(){return db['VoiceExtension'][_0x65f6('0x49')]({'where':{'id':_0x4b7ecd[_0x65f6('0x50')]},'raw':!![]})['then'](function(_0x219bf8){return createVoicePrefixExtensions(_0x4b7ecd,_0x219bf8,_0x2dbec2);});});});})['then'](function(){return db[_0x65f6('0x42')][_0x65f6('0x6b')](_0x4b7ecd['id']);})[_0x65f6('0x27')](respondWithResult(_0x1cc66a,null))[_0x65f6('0x48')](handleError(_0x1cc66a,null));};exports['addAgents']=function(_0x34ab7b,_0x351d43,_0x11411c){return db['VoicePrefix']['find']({'where':{'id':_0x34ab7b[_0x65f6('0x6c')]['id']}})['then'](handleEntityNotFound(_0x351d43,null))[_0x65f6('0x27')](function(_0xf6de){if(_0xf6de){return _0xf6de[_0x65f6('0x6d')](_0x34ab7b[_0x65f6('0x4e')]['ids'],_['omit'](_0x34ab7b['body'],[_0x65f6('0x6e'),'id'])||{})[_0x65f6('0x6f')](function(_0x161fb2){for(var _0x57464e=0x0;_0x57464e<_0x34ab7b[_0x65f6('0x4e')][_0x65f6('0x6e')][_0x65f6('0x37')];_0x57464e+=0x1){socket['emit'](_0x65f6('0x70'),{'UserId':Number(_0x34ab7b[_0x65f6('0x4e')]['ids'][_0x57464e]),'VoicePrefixId':Number(_0x34ab7b[_0x65f6('0x6c')]['id'])});}return _0x161fb2;});}})[_0x65f6('0x27')](respondWithResult(_0x351d43,null))['catch'](handleError(_0x351d43,null));};exports[_0x65f6('0x71')]=function(_0x5ef825,_0xe8449b,_0x55ea91){return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x5ef825['params']['id']}})[_0x65f6('0x27')](handleEntityNotFound(_0xe8449b,null))[_0x65f6('0x27')](function(_0x2a700b){if(_0x2a700b){return _0x2a700b[_0x65f6('0x71')](_0x5ef825[_0x65f6('0x31')][_0x65f6('0x6e')])[_0x65f6('0x27')](function(){if(_[_0x65f6('0x72')](_0x5ef825[_0x65f6('0x31')][_0x65f6('0x6e')])){for(var _0x288eb0=0x0;_0x288eb0<_0x5ef825['query'][_0x65f6('0x6e')][_0x65f6('0x37')];_0x288eb0+=0x1){socket[_0x65f6('0x73')](_0x65f6('0x74'),{'UserId':Number(_0x5ef825['query'][_0x65f6('0x6e')][_0x288eb0]),'VoicePrefixId':Number(_0x5ef825[_0x65f6('0x6c')]['id'])});}}else{socket['emit'](_0x65f6('0x74'),{'UserId':Number(_0x5ef825['query'][_0x65f6('0x6e')]),'VoicePrefixId':Number(_0x5ef825['params']['id'])});}});}})[_0x65f6('0x27')](respondWithStatusCode(_0xe8449b,null))[_0x65f6('0x48')](handleError(_0xe8449b,null));};exports['getAgents']=function(_0x4946c7,_0xa4a742,_0x413c21){var _0x5158c9={};var _0x2d86c8={};var _0x3b3bd5;var _0x73d359;return db['VoicePrefix'][_0x65f6('0x75')]({'where':{'id':_0x4946c7[_0x65f6('0x6c')]['id']}})['then'](handleEntityNotFound(_0xa4a742,null))[_0x65f6('0x27')](function(_0x504b39){if(_0x504b39){_0x3b3bd5=_0x504b39;_0x2d86c8[_0x65f6('0x2f')]=_['keys'](db['User'][_0x65f6('0x2c')]);_0x2d86c8[_0x65f6('0x31')]=_[_0x65f6('0x32')](_0x4946c7[_0x65f6('0x31')]);_0x2d86c8[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x2d86c8[_0x65f6('0x2f')],_0x2d86c8[_0x65f6('0x31')]);_0x5158c9['attributes']=_['intersection'](_0x2d86c8[_0x65f6('0x2f')],qs['fields'](_0x4946c7[_0x65f6('0x31')][_0x65f6('0x35')]));_0x5158c9[_0x65f6('0x36')]=_0x5158c9[_0x65f6('0x36')][_0x65f6('0x37')]?_0x5158c9['attributes']:_0x2d86c8[_0x65f6('0x2f')];_0x5158c9[_0x65f6('0x39')]=qs[_0x65f6('0x3a')](_0x4946c7['query'][_0x65f6('0x3a')]);_0x5158c9[_0x65f6('0x3b')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3c')](_0x4946c7[_0x65f6('0x31')],_0x2d86c8[_0x65f6('0x33')]));if(_0x4946c7['query']['filter']){_0x5158c9[_0x65f6('0x3b')]=_[_0x65f6('0x3e')](_0x5158c9[_0x65f6('0x3b')],{'$or':_[_0x65f6('0x2b')](_0x5158c9['attributes'],function(_0x4bda86){var _0x336076={};_0x336076[_0x4bda86]={'$like':'%'+_0x4946c7[_0x65f6('0x31')][_0x65f6('0x3d')]+'%'};return _0x336076;})});}_0x5158c9=_[_0x65f6('0x3e')]({},_0x5158c9,_0x4946c7[_0x65f6('0x41')]);return _0x3b3bd5[_0x65f6('0x76')](_0x5158c9);}})['then'](function(_0x4d607a){if(_0x4d607a){_0x73d359=_0x4d607a['length'];if(!_0x4946c7[_0x65f6('0x31')][_0x65f6('0x77')](_0x65f6('0x38'))){_0x5158c9[_0x65f6('0x1f')]=qs['limit'](_0x4946c7['query'][_0x65f6('0x1f')]);_0x5158c9[_0x65f6('0x1d')]=qs['offset'](_0x4946c7[_0x65f6('0x31')]['offset']);}return _0x3b3bd5[_0x65f6('0x76')](_0x5158c9);}})['then'](function(_0x3a30ed){if(_0x3a30ed){return _0x3a30ed?{'count':_0x73d359,'rows':_0x3a30ed}:null;}})[_0x65f6('0x27')](respondWithResult(_0xa4a742,null))['catch'](handleError(_0xa4a742,null));};exports[_0x65f6('0x78')]=function(_0x330e18,_0x13c03b,_0x9f6e0c){var _0xec6a56={};var _0x144db0={};var _0x584ea4;var _0x45b3e6;return db['VoicePrefix'][_0x65f6('0x75')]({'where':{'id':_0x330e18['params']['id']}})[_0x65f6('0x27')](handleEntityNotFound(_0x13c03b,null))[_0x65f6('0x27')](function(_0xdf396c){if(_0xdf396c){_0x584ea4=_0xdf396c;_0x144db0[_0x65f6('0x2f')]=_['keys'](db[_0x65f6('0x79')][_0x65f6('0x2c')]);_0x144db0[_0x65f6('0x31')]=_['keys'](_0x330e18['query']);_0x144db0[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x144db0['model'],_0x144db0[_0x65f6('0x31')]);_0xec6a56[_0x65f6('0x36')]=_[_0x65f6('0x34')](_0x144db0['model'],qs[_0x65f6('0x35')](_0x330e18[_0x65f6('0x31')]['fields']));_0xec6a56[_0x65f6('0x36')]=_0xec6a56[_0x65f6('0x36')][_0x65f6('0x37')]?_0xec6a56['attributes']:_0x144db0[_0x65f6('0x2f')];_0xec6a56[_0x65f6('0x39')]=qs[_0x65f6('0x3a')](_0x330e18['query'][_0x65f6('0x3a')]);_0xec6a56['where']=qs[_0x65f6('0x33')](_[_0x65f6('0x3c')](_0x330e18[_0x65f6('0x31')],_0x144db0[_0x65f6('0x33')]));if(_0x330e18[_0x65f6('0x31')][_0x65f6('0x3d')]){_0xec6a56['where']=_[_0x65f6('0x3e')](_0xec6a56[_0x65f6('0x3b')],{'$or':_[_0x65f6('0x2b')](_0xec6a56[_0x65f6('0x36')],function(_0x207d15){var _0x59407d={};_0x59407d[_0x207d15]={'$like':'%'+_0x330e18['query']['filter']+'%'};return _0x59407d;})});}_0xec6a56=_[_0x65f6('0x3e')]({},_0xec6a56,_0x330e18[_0x65f6('0x41')]);return _0x584ea4[_0x65f6('0x78')](_0xec6a56);}})['then'](function(_0x151cee){if(_0x151cee){_0x45b3e6=_0x151cee['length'];if(!_0x330e18['query'][_0x65f6('0x77')](_0x65f6('0x38'))){_0xec6a56['limit']=qs[_0x65f6('0x1f')](_0x330e18[_0x65f6('0x31')][_0x65f6('0x1f')]);_0xec6a56[_0x65f6('0x1d')]=qs[_0x65f6('0x1d')](_0x330e18[_0x65f6('0x31')][_0x65f6('0x1d')]);}return _0x584ea4[_0x65f6('0x78')](_0xec6a56);}})[_0x65f6('0x27')](function(_0x350641){if(_0x350641){return _0x350641?{'count':_0x45b3e6,'rows':_0x350641}:null;}})[_0x65f6('0x27')](respondWithResult(_0x13c03b,null))[_0x65f6('0x48')](handleError(_0x13c03b,null));};exports['addTeams']=function(_0x349af7,_0x52dc75,_0x55355f){var _0x24d524=_0x349af7[_0x65f6('0x4e')][_0x65f6('0x6e')];var _0x3727f9;return db['Team'][_0x65f6('0x46')]({'where':{'id':_0x24d524},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x65f6('0x30'),_0x65f6('0x7a'),_0x65f6('0x7b'),_0x65f6('0x7c')],'raw':!![]}]})[_0x65f6('0x27')](function(_0xcdfebe){if(_0xcdfebe){_0x3727f9=_0xcdfebe;var _0x5a33cf=_[_0x65f6('0x7d')](_0xcdfebe,function(_0x56bf49){var _0x1ef2a0=_0x56bf49[_0x65f6('0x24')]({'plain':!![]});return _0x1ef2a0[_0x65f6('0x7e')];});return db['VoicePrefix'][_0x65f6('0x49')]({'where':{'id':_0x349af7['params']['id']}})['then'](function(_0x377d5e){return db[_0x65f6('0x7f')][_0x65f6('0x4d')](function(_0xf364a9){return _0x377d5e[_0x65f6('0x80')](_0x24d524,{'transaction':_0xf364a9})['then'](function(){return BPromise[_0x65f6('0x81')](_0x3727f9,function(_0x400633){return db[_0x65f6('0x82')][_0x65f6('0x83')]({'TeamId':_0x400633['id'],'VoicePrefixId':_0x349af7['params']['id']},{'transaction':_0xf364a9});});})[_0x65f6('0x27')](function(){return BPromise[_0x65f6('0x81')](_0x5a33cf,function(_0x344163){return db[_0x65f6('0x84')][_0x65f6('0x85')]({'where':{'UserId':_0x344163['id'],'VoicePrefixId':_0x349af7[_0x65f6('0x6c')]['id']},'transaction':_0xf364a9});});})[_0x65f6('0x27')](function(){_0x5a33cf[_0x65f6('0x86')](function(_0x558410){socket[_0x65f6('0x73')](_0x65f6('0x70'),{'UserId':_0x558410['id'],'VoicePrefixId':_0x377d5e['id']});});});});});}})[_0x65f6('0x27')](respondWithStatusCode(_0x52dc75,null))[_0x65f6('0x48')](handleError(_0x52dc75,null));};exports[_0x65f6('0x87')]=function(_0x4171a1,_0x57667e,_0x3fd6ee){return db[_0x65f6('0x79')]['findAll']({'where':{'id':_0x4171a1[_0x65f6('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0x65f6('0x88')],'as':_0x65f6('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x27')](handleEntityNotFound(_0x57667e,null))[_0x65f6('0x27')](function(_0x2177f1){var _0x55c9bd=_[_0x65f6('0x2b')](_0x2177f1,'id');var _0x395642=[];var _0x2394eb=[];var _0x31870f=squel[_0x65f6('0x89')]();_0x31870f['field']('tq.TeamId')[_0x65f6('0x8a')](_0x65f6('0x8b'),'tq')[_0x65f6('0x8c')](_0x65f6('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x4171a1[_0x65f6('0x6c')]['id']);for(var _0x3b0a97=0x0;_0x3b0a97<_0x2177f1[_0x65f6('0x37')];_0x3b0a97+=0x1){let _0x50e159=_0x2177f1[_0x3b0a97];for(var _0x12730b=0x0;_0x12730b<_0x50e159[_0x65f6('0x7e')][_0x65f6('0x37')];_0x12730b+=0x1){let _0x18c6a8=_0x50e159[_0x65f6('0x7e')][_0x12730b];var _0x54e258=_0x31870f[_0x65f6('0x8e')]();_0x54e258[_0x65f6('0x3b')]('ut.UserId\x20=\x20?',_0x18c6a8['id']);_0x2394eb['push'](db[_0x65f6('0x7f')][_0x65f6('0x31')](_0x54e258[_0x65f6('0x8f')](),{'type':db[_0x65f6('0x7f')][_0x65f6('0x90')]['SELECT']})[_0x65f6('0x27')](function(_0x4b080a){if(_0x4b080a[_0x65f6('0x37')]===0x1){return _0x18c6a8['id'];}else{var _0x5d181a=_[_0x65f6('0x91')](_['map'](_0x4b080a,_0x65f6('0x92')),function(_0x48a9df){return _[_0x65f6('0x93')](_0x55c9bd,_0x48a9df);});if(_0x5d181a){return _0x18c6a8['id'];}}}));}}return BPromise[_0x65f6('0x94')](_0x2394eb)['then'](function(_0x4f2f43){_0x395642=_(_0x395642)[_0x65f6('0x95')](_0x4f2f43)[_0x65f6('0x96')]()[_0x65f6('0x97')]();return db[_0x65f6('0x42')][_0x65f6('0x49')]({'where':{'id':_0x4171a1[_0x65f6('0x6c')]['id']}})[_0x65f6('0x27')](function(_0x1b5957){return db[_0x65f6('0x7f')][_0x65f6('0x4d')](function(_0x4a90e3){return _0x1b5957[_0x65f6('0x87')](_0x4171a1[_0x65f6('0x31')][_0x65f6('0x6e')],{'transaction':_0x4a90e3})[_0x65f6('0x27')](function(){if(!_[_0x65f6('0x98')](_0x395642)){return _0x1b5957[_0x65f6('0x71')](_0x395642,{'transaction':_0x4a90e3});}})['then'](function(){_0x395642[_0x65f6('0x86')](function(_0x91d7bf){socket[_0x65f6('0x73')](_0x65f6('0x74'),{'UserId':_0x91d7bf,'VoicePrefixId':_0x1b5957['id']});});});});});});})[_0x65f6('0x27')](respondWithStatusCode(_0x57667e,null))[_0x65f6('0x48')](handleError(_0x57667e,null));}; \ No newline at end of file +var _0xdb28=['length','nolimit','order','sort','where','filters','pick','filter','merge','VoicePrefix','includeAll','include','findAll','rows','catch','params','fields','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','findById','addAgents','omit','spread','ids','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','findOne','User','options','hasOwnProperty','getAgents','getTeams','rawAttributes','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','value','isEmpty','removeAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','VoicePrefixes','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x51c489,_0x3dfd08){var _0x3f8a1f=function(_0x189fa7){while(--_0x189fa7){_0x51c489['push'](_0x51c489['shift']());}};_0x3f8a1f(++_0x3dfd08);}(_0xdb28,0x106));var _0x8db2=function(_0x8361fe,_0x323af7){_0x8361fe=_0x8361fe-0x0;var _0x393301=_0xdb28[_0x8361fe];return _0x393301;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];config[_0x8db2('0x19')]=_[_0x8db2('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8db2('0x1b'))(new Redis(config[_0x8db2('0x19')]));require(_0x8db2('0x1c'))[_0x8db2('0x1d')](socket);function respondWithStatusCode(_0x227355,_0xfa285b){_0xfa285b=_0xfa285b||0xcc;return function(_0x2f177a){if(_0x2f177a){return _0x227355[_0x8db2('0x1e')](_0xfa285b);}return _0x227355[_0x8db2('0x1f')](_0xfa285b)[_0x8db2('0x20')]();};}function respondWithResult(_0x5489a9,_0x13b0f5){_0x13b0f5=_0x13b0f5||0xc8;return function(_0x24da1b){if(_0x24da1b){return _0x5489a9['status'](_0x13b0f5)[_0x8db2('0x21')](_0x24da1b);}};}function respondWithFilteredResult(_0x44957d,_0x21db8c){return function(_0x3fddc2){if(_0x3fddc2){var _0x2efd06=typeof _0x21db8c[_0x8db2('0x22')]==='undefined'&&typeof _0x21db8c['limit']===_0x8db2('0x23');var _0x104e33=_0x3fddc2[_0x8db2('0x24')];var _0x1b64e4=_0x2efd06?0x0:_0x21db8c['offset'];var _0x431d60=_0x2efd06?_0x3fddc2[_0x8db2('0x24')]:_0x21db8c[_0x8db2('0x22')]+_0x21db8c[_0x8db2('0x25')];var _0x3dbe8e;if(_0x431d60>=_0x104e33){_0x431d60=_0x104e33;_0x3dbe8e=0xc8;}else{_0x3dbe8e=0xce;}_0x44957d['status'](_0x3dbe8e);return _0x44957d[_0x8db2('0x26')](_0x8db2('0x27'),_0x1b64e4+'-'+_0x431d60+'/'+_0x104e33)[_0x8db2('0x21')](_0x3fddc2);}return null;};}function patchUpdates(_0x125be2){return function(_0x2260d8){try{jsonpatch[_0x8db2('0x28')](_0x2260d8,_0x125be2,!![]);}catch(_0x796ec1){return BPromise['reject'](_0x796ec1);}return _0x2260d8[_0x8db2('0x29')]();};}function saveUpdates(_0x4f6516,_0x5725f0){return function(_0x52a9ca){if(_0x52a9ca){return _0x52a9ca['update'](_0x4f6516)[_0x8db2('0x2a')](function(_0x29b5cd){return _0x29b5cd;});}return null;};}function removeEntity(_0x3be281,_0x2baed0){return function(_0x145328){if(_0x145328){return _0x145328[_0x8db2('0x2b')]()['then'](function(){var _0x3544ba=_0x145328[_0x8db2('0x2c')]({'plain':!![]});var _0x430dd5=_0x8db2('0x2d');return db['UserProfileResource'][_0x8db2('0x2b')]({'where':{'type':_0x430dd5,'resourceId':_0x3544ba['id']}})[_0x8db2('0x2a')](function(){return _0x145328;});})[_0x8db2('0x2a')](function(){_0x3be281[_0x8db2('0x1f')](0xcc)[_0x8db2('0x20')]();});}};}function handleEntityNotFound(_0x21bae5,_0xa54ea3){return function(_0x3124d5){if(!_0x3124d5){_0x21bae5[_0x8db2('0x1e')](0x194);}return _0x3124d5;};}function handleError(_0x493cab,_0x4718ec){_0x4718ec=_0x4718ec||0x1f4;return function(_0x50b28d){logger['error'](_0x50b28d[_0x8db2('0x2e')]);if(_0x50b28d[_0x8db2('0x2f')]){delete _0x50b28d[_0x8db2('0x2f')];}_0x493cab['status'](_0x4718ec)[_0x8db2('0x30')](_0x50b28d);};}exports['index']=function(_0x3f7aac,_0x2b653b){var _0x14bd12={},_0x4d9e26={},_0x56e9c1={'count':0x0,'rows':[]};var _0x35d337=_[_0x8db2('0x31')](db['VoicePrefix']['rawAttributes'],function(_0x173989){return{'name':_0x173989[_0x8db2('0x32')],'type':_0x173989[_0x8db2('0x33')][_0x8db2('0x34')]};});_0x4d9e26[_0x8db2('0x35')]=_[_0x8db2('0x31')](_0x35d337,_0x8db2('0x2f'));_0x4d9e26[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x3f7aac[_0x8db2('0x36')]);_0x4d9e26['filters']=_[_0x8db2('0x38')](_0x4d9e26[_0x8db2('0x35')],_0x4d9e26['query']);_0x14bd12[_0x8db2('0x39')]=_[_0x8db2('0x38')](_0x4d9e26['model'],qs['fields'](_0x3f7aac[_0x8db2('0x36')]['fields']));_0x14bd12[_0x8db2('0x39')]=_0x14bd12[_0x8db2('0x39')][_0x8db2('0x3a')]?_0x14bd12[_0x8db2('0x39')]:_0x4d9e26['model'];if(!_0x3f7aac[_0x8db2('0x36')]['hasOwnProperty'](_0x8db2('0x3b'))){_0x14bd12[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0x3f7aac[_0x8db2('0x36')]['limit']);_0x14bd12['offset']=qs[_0x8db2('0x22')](_0x3f7aac[_0x8db2('0x36')]['offset']);}_0x14bd12[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0x3f7aac[_0x8db2('0x36')]['sort']);_0x14bd12[_0x8db2('0x3e')]=qs[_0x8db2('0x3f')](_[_0x8db2('0x40')](_0x3f7aac[_0x8db2('0x36')],_0x4d9e26[_0x8db2('0x3f')]),_0x35d337);if(_0x3f7aac[_0x8db2('0x36')][_0x8db2('0x41')]){_0x14bd12[_0x8db2('0x3e')]=_[_0x8db2('0x42')](_0x14bd12[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x31')](_0x35d337,function(_0x20bf0b){if(_0x20bf0b[_0x8db2('0x33')]!=='VIRTUAL'){var _0x3ee510={};_0x3ee510[_0x20bf0b[_0x8db2('0x2f')]]={'$like':'%'+_0x3f7aac['query']['filter']+'%'};return _0x3ee510;}})});}_0x14bd12=_[_0x8db2('0x42')]({},_0x14bd12,_0x3f7aac['options']);var _0x130eb9={'where':_0x14bd12[_0x8db2('0x3e')]};return db[_0x8db2('0x43')][_0x8db2('0x24')](_0x130eb9)[_0x8db2('0x2a')](function(_0x30d606){_0x56e9c1[_0x8db2('0x24')]=_0x30d606;if(_0x3f7aac['query'][_0x8db2('0x44')]){_0x14bd12[_0x8db2('0x45')]=[{'all':!![]}];}return db[_0x8db2('0x43')][_0x8db2('0x46')](_0x14bd12);})['then'](function(_0x424c27){_0x56e9c1[_0x8db2('0x47')]=_0x424c27;return _0x56e9c1;})[_0x8db2('0x2a')](respondWithFilteredResult(_0x2b653b,_0x14bd12))[_0x8db2('0x48')](handleError(_0x2b653b,null));};exports['show']=function(_0x12d62d,_0x4e0749){var _0x19bd06={'raw':![],'where':{'id':_0x12d62d[_0x8db2('0x49')]['id']}},_0x116b69={};_0x116b69['model']=_['keys'](db[_0x8db2('0x43')]['rawAttributes']);_0x116b69[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x12d62d[_0x8db2('0x36')]);_0x116b69[_0x8db2('0x3f')]=_[_0x8db2('0x38')](_0x116b69[_0x8db2('0x35')],_0x116b69[_0x8db2('0x36')]);_0x19bd06[_0x8db2('0x39')]=_[_0x8db2('0x38')](_0x116b69[_0x8db2('0x35')],qs[_0x8db2('0x4a')](_0x12d62d[_0x8db2('0x36')]['fields']));_0x19bd06[_0x8db2('0x39')]=_0x19bd06[_0x8db2('0x39')][_0x8db2('0x3a')]?_0x19bd06[_0x8db2('0x39')]:_0x116b69['model'];if(_0x12d62d['query'][_0x8db2('0x44')]){_0x19bd06[_0x8db2('0x45')]=[{'all':!![]}];}_0x19bd06=_[_0x8db2('0x42')]({},_0x19bd06,_0x12d62d['options']);return db['VoicePrefix']['find'](_0x19bd06)[_0x8db2('0x2a')](handleEntityNotFound(_0x4e0749,null))[_0x8db2('0x2a')](respondWithResult(_0x4e0749,null))[_0x8db2('0x48')](handleError(_0x4e0749,null));};exports[_0x8db2('0x2b')]=function(_0xaab731,_0x4195ef){return db[_0x8db2('0x43')]['find']({'where':{'id':_0xaab731['params']['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x4195ef,null))[_0x8db2('0x2a')](removeEntity(_0x4195ef,null))[_0x8db2('0x48')](handleError(_0x4195ef,null));};exports[_0x8db2('0x4b')]=function(_0x3daed6,_0x2bf408){return db[_0x8db2('0x43')][_0x8db2('0x4b')]()[_0x8db2('0x2a')](respondWithResult(_0x2bf408,null))[_0x8db2('0x48')](handleError(_0x2bf408,null));};exports[_0x8db2('0x4c')]=function(_0x319273,_0x345c74){var _0x2d518a;return db[_0x8db2('0x4d')]['transaction'](function(_0x2ded23){return db[_0x8db2('0x43')]['create'](_0x319273[_0x8db2('0x4e')],{'transaction':_0x2ded23})[_0x8db2('0x2a')](function(_0x3af298){_0x2d518a=_0x3af298['get']({'plain':!![]});return db[_0x8db2('0x4f')][_0x8db2('0x50')]({'where':{'id':_0x2d518a[_0x8db2('0x51')]},'raw':!![]})[_0x8db2('0x2a')](function(_0x1167d5){return createVoicePrefixExtensions(_0x2d518a,_0x1167d5,_0x2ded23);});});})['then'](function(){var _0x467505=_0x319273[_0x8db2('0x52')][_0x8db2('0x2c')]({'plain':!![]});if(!_0x467505)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x467505[_0x8db2('0x53')]===_0x8db2('0x52')){var _0x33dddd=_0x2d518a;return db[_0x8db2('0x54')][_0x8db2('0x50')]({'where':{'name':_0x8db2('0x2d'),'userProfileId':_0x467505[_0x8db2('0x55')]},'raw':!![]})['then'](function(_0x39ff90){if(_0x39ff90&&_0x39ff90[_0x8db2('0x56')]===0x0){return db['UserProfileResource'][_0x8db2('0x4c')]({'name':_0x33dddd[_0x8db2('0x2f')],'resourceId':_0x33dddd['id'],'type':_0x39ff90['name'],'sectionId':_0x39ff90['id']},{})[_0x8db2('0x2a')](function(){return _0x2d518a;});}else{return _0x2d518a;}})[_0x8db2('0x48')](function(_0x63e8f7){logger[_0x8db2('0x57')](_0x8db2('0x58'),_0x63e8f7);throw _0x63e8f7;});}return _0x2d518a;})[_0x8db2('0x2a')](respondWithResult(_0x345c74,null))[_0x8db2('0x48')](handleError(_0x345c74,null));};function Extension(_0x33a600,_0x120ef2,_0x173a5e,_0x12fd12){this[_0x8db2('0x59')]=_0x8db2('0x5a');this[_0x8db2('0x5b')]=_0x33a600;this[_0x8db2('0x5c')]=_0x173a5e;this[_0x8db2('0x33')]='system';this[_0x8db2('0x5d')]=_0x8db2('0x5e');this[_0x8db2('0x5f')]=_0x120ef2;this[_0x8db2('0x60')]=_0x12fd12;}function createVoicePrefixExtensions(_0x349db0,_0x53b2dc,_0x3dd6b1){return new BPromise(function(_0x2c3087,_0x3ab670){var _0x1e1c0d=new Extension(formatPrefixName(_0x349db0[_0x8db2('0x61')]),0x1,_0x8db2('0x62'),_0x8db2('0x63'));_0x1e1c0d[_0x8db2('0x64')]=_0x349db0['id'];return db[_0x8db2('0x4f')][_0x8db2('0x4c')](_0x1e1c0d,{'transaction':_0x3dd6b1})[_0x8db2('0x2a')](function(_0xfe6bac){var _0x170a72=_0xfe6bac[_0x8db2('0x2c')]({'plain':!![]});var _0xed9d36=_[_0x8db2('0x31')](addVoicePrefixExtensions(_0x349db0,_0x53b2dc),function(_0x1d7862){_0x1d7862[_0x8db2('0x51')]=_0x170a72['id'];_0x1d7862['VoicePrefixId']=_0x349db0['id'];return _0x1d7862;});return db[_0x8db2('0x4f')]['bulkCreate'](_0xed9d36,{'transaction':_0x3dd6b1})[_0x8db2('0x2a')](function(_0x570c53){if(!_0x570c53){return _0x3ab670(_0x8db2('0x65'));}else{return _0x2c3087(_0x570c53);}})[_0x8db2('0x48')](function(_0xe4fd6a){return _0x3ab670(_0xe4fd6a);});});;});};function addVoicePrefixExtensions(_0x1e2ccd,_0x1e812e){var _0x59a32e=[];var _0x50c5fb=formatPrefixName(_0x1e2ccd[_0x8db2('0x61')]);_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x2,_0x8db2('0x67'),_0x8db2('0x68')+_0x1e2ccd[_0x8db2('0x2f')]));if(_0x1e2ccd[_0x8db2('0x69')]){_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x3,_0x8db2('0x67'),'PREFIX-CALLERIDALL='+_0x1e2ccd[_0x8db2('0x69')]));}else{_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x3,_0x8db2('0x62'),_0x8db2('0x6a')));}_0x59a32e[_0x8db2('0x66')](new Extension(_0x50c5fb,0x4,_0x8db2('0x6b'),_0x1e812e[_0x8db2('0x59')]+','+_0x8db2('0x6c')+(0x8+_0x1e2ccd['name']['length'])+'}'+','+0x1));return _0x59a32e;}function formatPrefixName(_0x358009){var _0x2f8beb='_';for(var _0x1d2dfc=0x0;_0x1d2dfc<_0x358009[_0x8db2('0x3a')];_0x1d2dfc++){if(_0x358009[_0x8db2('0x6d')](_0x1d2dfc)=='-'){_0x2f8beb+=_0x358009['charAt'](_0x1d2dfc);}else{_0x2f8beb+='['+_0x358009['charAt'](_0x1d2dfc)+']';}}_0x2f8beb+='.';return _0x2f8beb;}exports[_0x8db2('0x6e')]=function(_0x364807,_0x54f0d4,_0xa698bd){var _0x2be647=_0x364807[_0x8db2('0x4e')];_0x2be647['prefix']=_0x8db2('0x6f')+_0x2be647[_0x8db2('0x2f')]+'-';return db[_0x8db2('0x4d')]['transaction'](function(_0x3ff023){return db[_0x8db2('0x43')][_0x8db2('0x6e')](_0x2be647,{'where':{'id':_0x2be647['id']},'transaction':_0x3ff023})[_0x8db2('0x2a')](function(){return db[_0x8db2('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x2be647['id']},'transaction':_0x3ff023})[_0x8db2('0x2a')](function(){return db[_0x8db2('0x4f')][_0x8db2('0x50')]({'where':{'id':_0x2be647['VoiceExtensionId']},'raw':!![]})['then'](function(_0x2cdf3c){return createVoicePrefixExtensions(_0x2be647,_0x2cdf3c,_0x3ff023);});});});})[_0x8db2('0x2a')](function(){return db['VoicePrefix'][_0x8db2('0x70')](_0x2be647['id']);})[_0x8db2('0x2a')](respondWithResult(_0x54f0d4,null))[_0x8db2('0x48')](handleError(_0x54f0d4,null));};exports[_0x8db2('0x71')]=function(_0xbf1fce,_0x16848b,_0x395ebb){return db[_0x8db2('0x43')][_0x8db2('0x50')]({'where':{'id':_0xbf1fce[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x16848b,null))[_0x8db2('0x2a')](function(_0x24a52d){if(_0x24a52d){return _0x24a52d['addAgents'](_0xbf1fce[_0x8db2('0x4e')]['ids'],_[_0x8db2('0x72')](_0xbf1fce[_0x8db2('0x4e')],['ids','id'])||{})[_0x8db2('0x73')](function(_0x2fa89d){for(var _0x5cdf53=0x0;_0x5cdf53<_0xbf1fce[_0x8db2('0x4e')][_0x8db2('0x74')][_0x8db2('0x3a')];_0x5cdf53+=0x1){socket[_0x8db2('0x75')](_0x8db2('0x76'),{'UserId':Number(_0xbf1fce[_0x8db2('0x4e')][_0x8db2('0x74')][_0x5cdf53]),'VoicePrefixId':Number(_0xbf1fce[_0x8db2('0x49')]['id'])});}return _0x2fa89d;});}})[_0x8db2('0x2a')](respondWithResult(_0x16848b,null))['catch'](handleError(_0x16848b,null));};exports['removeAgents']=function(_0x198c3b,_0x508f4a,_0xf8afa5){return db[_0x8db2('0x43')][_0x8db2('0x50')]({'where':{'id':_0x198c3b['params']['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0x508f4a,null))[_0x8db2('0x2a')](function(_0x3e37e7){if(_0x3e37e7){return _0x3e37e7['removeAgents'](_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')])[_0x8db2('0x2a')](function(){if(_[_0x8db2('0x77')](_0x198c3b['query'][_0x8db2('0x74')])){for(var _0x5f61b8=0x0;_0x5f61b8<_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')][_0x8db2('0x3a')];_0x5f61b8+=0x1){socket[_0x8db2('0x75')](_0x8db2('0x78'),{'UserId':Number(_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')][_0x5f61b8]),'VoicePrefixId':Number(_0x198c3b[_0x8db2('0x49')]['id'])});}}else{socket[_0x8db2('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x198c3b[_0x8db2('0x36')][_0x8db2('0x74')]),'VoicePrefixId':Number(_0x198c3b[_0x8db2('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x508f4a,null))['catch'](handleError(_0x508f4a,null));};exports['getAgents']=function(_0xa09b1d,_0xdba223,_0x3191c8){var _0x454377={};var _0x2ad024={};var _0x313918;var _0x339d09;return db[_0x8db2('0x43')][_0x8db2('0x79')]({'where':{'id':_0xa09b1d[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](handleEntityNotFound(_0xdba223,null))['then'](function(_0x360a06){if(_0x360a06){_0x313918=_0x360a06;_0x2ad024[_0x8db2('0x35')]=_[_0x8db2('0x37')](db[_0x8db2('0x7a')]['rawAttributes']);_0x2ad024['query']=_[_0x8db2('0x37')](_0xa09b1d[_0x8db2('0x36')]);_0x2ad024['filters']=_[_0x8db2('0x38')](_0x2ad024[_0x8db2('0x35')],_0x2ad024[_0x8db2('0x36')]);_0x454377['attributes']=_['intersection'](_0x2ad024['model'],qs[_0x8db2('0x4a')](_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x4a')]));_0x454377[_0x8db2('0x39')]=_0x454377[_0x8db2('0x39')]['length']?_0x454377[_0x8db2('0x39')]:_0x2ad024['model'];_0x454377[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x3d')]);_0x454377[_0x8db2('0x3e')]=qs['filters'](_['pick'](_0xa09b1d[_0x8db2('0x36')],_0x2ad024['filters']));if(_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x41')]){_0x454377[_0x8db2('0x3e')]=_[_0x8db2('0x42')](_0x454377[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x31')](_0x454377['attributes'],function(_0x19f9a0){var _0x222ea2={};_0x222ea2[_0x19f9a0]={'$like':'%'+_0xa09b1d[_0x8db2('0x36')]['filter']+'%'};return _0x222ea2;})});}_0x454377=_[_0x8db2('0x42')]({},_0x454377,_0xa09b1d[_0x8db2('0x7b')]);return _0x313918['getAgents'](_0x454377);}})[_0x8db2('0x2a')](function(_0x7cb97d){if(_0x7cb97d){_0x339d09=_0x7cb97d[_0x8db2('0x3a')];if(!_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x7c')](_0x8db2('0x3b'))){_0x454377[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0xa09b1d[_0x8db2('0x36')]['limit']);_0x454377[_0x8db2('0x22')]=qs[_0x8db2('0x22')](_0xa09b1d[_0x8db2('0x36')][_0x8db2('0x22')]);}return _0x313918[_0x8db2('0x7d')](_0x454377);}})[_0x8db2('0x2a')](function(_0x16d1c5){if(_0x16d1c5){return _0x16d1c5?{'count':_0x339d09,'rows':_0x16d1c5}:null;}})[_0x8db2('0x2a')](respondWithResult(_0xdba223,null))[_0x8db2('0x48')](handleError(_0xdba223,null));};exports[_0x8db2('0x7e')]=function(_0x5e6fc4,_0x3e79cc,_0x7e4bf){var _0x339ffe={};var _0x1587e8={};var _0x5d371b;var _0x4589c7;return db[_0x8db2('0x43')][_0x8db2('0x79')]({'where':{'id':_0x5e6fc4['params']['id']}})['then'](handleEntityNotFound(_0x3e79cc,null))[_0x8db2('0x2a')](function(_0x6e5a58){if(_0x6e5a58){_0x5d371b=_0x6e5a58;_0x1587e8[_0x8db2('0x35')]=_[_0x8db2('0x37')](db['Team'][_0x8db2('0x7f')]);_0x1587e8[_0x8db2('0x36')]=_[_0x8db2('0x37')](_0x5e6fc4[_0x8db2('0x36')]);_0x1587e8['filters']=_[_0x8db2('0x38')](_0x1587e8[_0x8db2('0x35')],_0x1587e8[_0x8db2('0x36')]);_0x339ffe['attributes']=_['intersection'](_0x1587e8['model'],qs[_0x8db2('0x4a')](_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x4a')]));_0x339ffe[_0x8db2('0x39')]=_0x339ffe['attributes']['length']?_0x339ffe[_0x8db2('0x39')]:_0x1587e8[_0x8db2('0x35')];_0x339ffe[_0x8db2('0x3c')]=qs[_0x8db2('0x3d')](_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x3d')]);_0x339ffe['where']=qs[_0x8db2('0x3f')](_['pick'](_0x5e6fc4[_0x8db2('0x36')],_0x1587e8[_0x8db2('0x3f')]));if(_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x41')]){_0x339ffe[_0x8db2('0x3e')]=_['merge'](_0x339ffe[_0x8db2('0x3e')],{'$or':_[_0x8db2('0x31')](_0x339ffe['attributes'],function(_0x28beec){var _0x1334ea={};_0x1334ea[_0x28beec]={'$like':'%'+_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x41')]+'%'};return _0x1334ea;})});}_0x339ffe=_['merge']({},_0x339ffe,_0x5e6fc4[_0x8db2('0x7b')]);return _0x5d371b['getTeams'](_0x339ffe);}})['then'](function(_0xaa90b9){if(_0xaa90b9){_0x4589c7=_0xaa90b9[_0x8db2('0x3a')];if(!_0x5e6fc4[_0x8db2('0x36')][_0x8db2('0x7c')](_0x8db2('0x3b'))){_0x339ffe[_0x8db2('0x25')]=qs[_0x8db2('0x25')](_0x5e6fc4['query'][_0x8db2('0x25')]);_0x339ffe['offset']=qs['offset'](_0x5e6fc4[_0x8db2('0x36')]['offset']);}return _0x5d371b['getTeams'](_0x339ffe);}})[_0x8db2('0x2a')](function(_0x1642a7){if(_0x1642a7){return _0x1642a7?{'count':_0x4589c7,'rows':_0x1642a7}:null;}})[_0x8db2('0x2a')](respondWithResult(_0x3e79cc,null))['catch'](handleError(_0x3e79cc,null));};exports[_0x8db2('0x80')]=function(_0xb2ab8e,_0x30d410,_0x555ed0){var _0x27a916=_0xb2ab8e[_0x8db2('0x4e')][_0x8db2('0x74')];var _0x7ff636;return db[_0x8db2('0x81')][_0x8db2('0x46')]({'where':{'id':_0x27a916},'attributes':['id'],'include':[{'model':db[_0x8db2('0x7a')],'as':_0x8db2('0x82'),'attributes':['id','name',_0x8db2('0x83'),_0x8db2('0x84'),_0x8db2('0x85')],'raw':!![]}]})[_0x8db2('0x2a')](function(_0x20d69b){if(_0x20d69b){_0x7ff636=_0x20d69b;var _0x36199d=_[_0x8db2('0x86')](_0x20d69b,function(_0x2910c8){var _0x3a53e2=_0x2910c8[_0x8db2('0x2c')]({'plain':!![]});return _0x3a53e2[_0x8db2('0x82')];});return db['VoicePrefix'][_0x8db2('0x50')]({'where':{'id':_0xb2ab8e[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](function(_0x58063b){return db[_0x8db2('0x4d')][_0x8db2('0x87')](function(_0x3c105f){return _0x58063b['addTeams'](_0x27a916,{'transaction':_0x3c105f})['then'](function(){return BPromise[_0x8db2('0x88')](_0x7ff636,function(_0x17d3ee){return db[_0x8db2('0x89')][_0x8db2('0x8a')]({'TeamId':_0x17d3ee['id'],'VoicePrefixId':_0xb2ab8e[_0x8db2('0x49')]['id']},{'transaction':_0x3c105f});});})[_0x8db2('0x2a')](function(){return BPromise[_0x8db2('0x88')](_0x36199d,function(_0x1f1aa5){return db[_0x8db2('0x8b')][_0x8db2('0x8c')]({'where':{'UserId':_0x1f1aa5['id'],'VoicePrefixId':_0xb2ab8e['params']['id']},'transaction':_0x3c105f});});})[_0x8db2('0x2a')](function(){_0x36199d[_0x8db2('0x8d')](function(_0x5b8adc){socket[_0x8db2('0x75')](_0x8db2('0x76'),{'UserId':_0x5b8adc['id'],'VoicePrefixId':_0x58063b['id']});});});});});}})[_0x8db2('0x2a')](respondWithStatusCode(_0x30d410,null))[_0x8db2('0x48')](handleError(_0x30d410,null));};exports[_0x8db2('0x8e')]=function(_0x2e4fb3,_0x8f84e4,_0x372efd){return db[_0x8db2('0x81')][_0x8db2('0x46')]({'where':{'id':_0x2e4fb3[_0x8db2('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8db2('0x7a')],'as':_0x8db2('0x82'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x2a')](handleEntityNotFound(_0x8f84e4,null))[_0x8db2('0x2a')](function(_0x1d27e3){var _0x296981=_['map'](_0x1d27e3,'id');var _0x137788=[];var _0x19bc4d=[];var _0x339dbf=squel[_0x8db2('0x8f')]();_0x339dbf[_0x8db2('0x90')](_0x8db2('0x91'))[_0x8db2('0x92')](_0x8db2('0x93'),'tq')[_0x8db2('0x94')](_0x8db2('0x95'),'ut',_0x8db2('0x96'))['where']('VoicePrefixId\x20=\x20?',_0x2e4fb3[_0x8db2('0x49')]['id']);for(var _0x56f59b=0x0;_0x56f59b<_0x1d27e3[_0x8db2('0x3a')];_0x56f59b+=0x1){let _0xccdab2=_0x1d27e3[_0x56f59b];for(var _0x2428f1=0x0;_0x2428f1<_0xccdab2['Agents'][_0x8db2('0x3a')];_0x2428f1+=0x1){let _0x28cfee=_0xccdab2[_0x8db2('0x82')][_0x2428f1];var _0x3e154a=_0x339dbf['clone']();_0x3e154a[_0x8db2('0x3e')](_0x8db2('0x97'),_0x28cfee['id']);_0x19bc4d[_0x8db2('0x66')](db['sequelize'][_0x8db2('0x36')](_0x3e154a[_0x8db2('0x98')](),{'type':db[_0x8db2('0x4d')]['QueryTypes'][_0x8db2('0x99')]})[_0x8db2('0x2a')](function(_0x41957f){if(_0x41957f['length']===0x1){return _0x28cfee['id'];}else{var _0x18ac5c=_[_0x8db2('0x9a')](_['map'](_0x41957f,_0x8db2('0x9b')),function(_0x231360){return _['includes'](_0x296981,_0x231360);});if(_0x18ac5c){return _0x28cfee['id'];}}}));}}return BPromise[_0x8db2('0x9c')](_0x19bc4d)[_0x8db2('0x2a')](function(_0x3d2729){_0x137788=_(_0x137788)['union'](_0x3d2729)['compact']()[_0x8db2('0x9d')]();return db['VoicePrefix']['find']({'where':{'id':_0x2e4fb3[_0x8db2('0x49')]['id']}})[_0x8db2('0x2a')](function(_0x37fda2){return db[_0x8db2('0x4d')][_0x8db2('0x87')](function(_0x3695cd){return _0x37fda2['removeTeams'](_0x2e4fb3['query'][_0x8db2('0x74')],{'transaction':_0x3695cd})[_0x8db2('0x2a')](function(){if(!_[_0x8db2('0x9e')](_0x137788)){return _0x37fda2[_0x8db2('0x9f')](_0x137788,{'transaction':_0x3695cd});}})['then'](function(){_0x137788[_0x8db2('0x8d')](function(_0x51d15e){socket[_0x8db2('0x75')]('userVoicePrefix:remove',{'UserId':_0x51d15e,'VoicePrefixId':_0x37fda2['id']});});});});});});})[_0x8db2('0x2a')](respondWithStatusCode(_0x8f84e4,null))[_0x8db2('0x48')](handleError(_0x8f84e4,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ffcf82a..1a35caf 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 _0xac2e=['save','update','emit','hook','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x5b47ed,_0x30abf4){var _0x5cae85=function(_0x423031){while(--_0x423031){_0x5b47ed['push'](_0x5b47ed['shift']());}};_0x5cae85(++_0x30abf4);}(_0xac2e,0x169));var _0xeac2=function(_0x2a4bb1,_0x8d5834){_0x2a4bb1=_0x2a4bb1-0x0;var _0x5c71aa=_0xac2e[_0x2a4bb1];return _0x5c71aa;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xeac2('0x0'))['db'][_0xeac2('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xeac2('0x2')](0x0);var events={'afterCreate':_0xeac2('0x3'),'afterUpdate':_0xeac2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x26dfcf){return function(_0x63a94,_0xbce388,_0x1e8441){VoicePrefixEvents[_0xeac2('0x5')](_0x26dfcf+':'+_0x63a94['id'],_0x63a94);VoicePrefixEvents[_0xeac2('0x5')](_0x26dfcf,_0x63a94);_0x1e8441(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xeac2('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x7d88=['remove','emit','hasOwnProperty','exports','../../mysqldb','VoicePrefix','setMaxListeners','save','update'];(function(_0x2fd2f8,_0x8b1a2){var _0x222cd1=function(_0x22046c){while(--_0x22046c){_0x2fd2f8['push'](_0x2fd2f8['shift']());}};_0x222cd1(++_0x8b1a2);}(_0x7d88,0x175));var _0x87d8=function(_0x5390bd,_0xde4921){_0x5390bd=_0x5390bd-0x0;var _0x3cc920=_0x7d88[_0x5390bd];return _0x3cc920;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x87d8('0x0'))['db'][_0x87d8('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x87d8('0x2')](0x0);var events={'afterCreate':_0x87d8('0x3'),'afterUpdate':_0x87d8('0x4'),'afterDestroy':_0x87d8('0x5')};function emitEvent(_0x286051){return function(_0x3aa84c,_0x128411,_0x239cbd){VoicePrefixEvents[_0x87d8('0x6')](_0x286051+':'+_0x3aa84c['id'],_0x3aa84c);VoicePrefixEvents[_0x87d8('0x6')](_0x286051,_0x3aa84c);_0x239cbd(null);};}for(var e in events){if(events[_0x87d8('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x87d8('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 308660b..bbc7871 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 _0xb324=['exports','VoicePrefix','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x434f2e,_0x68493e){var _0x76c0b9=function(_0x7db698){while(--_0x7db698){_0x434f2e['push'](_0x434f2e['shift']());}};_0x76c0b9(++_0x68493e);}(_0xb324,0x1b2));var _0x4b32=function(_0x15ebd6,_0x4d4b9a){_0x15ebd6=_0x15ebd6-0x0;var _0x219a9f=_0xb324[_0x15ebd6];return _0x219a9f;};'use strict';var _=require(_0x4b32('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4b32('0x1'));var moment=require(_0x4b32('0x2'));var BPromise=require(_0x4b32('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b32('0x4'));var rimraf=require(_0x4b32('0x5'));var config=require(_0x4b32('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x4b32('0x7')]=function(_0x23502f,_0x4391fe){return _0x23502f['define'](_0x4b32('0x8'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc755=['../../config/environment','./voicePrefix.attributes','define','voice_prefixes','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c7c5f,_0x399137){var _0x37f35f=function(_0x15c616){while(--_0x15c616){_0x4c7c5f['push'](_0x4c7c5f['shift']());}};_0x37f35f(++_0x399137);}(_0xc755,0xe8));var _0x5c75=function(_0x2f4d6d,_0x1f9db7){_0x2f4d6d=_0x2f4d6d-0x0;var _0x5c318d=_0xc755[_0x2f4d6d];return _0x5c318d;};'use strict';var _=require(_0x5c75('0x0'));var util=require(_0x5c75('0x1'));var logger=require('../../config/logger')(_0x5c75('0x2'));var moment=require(_0x5c75('0x3'));var BPromise=require(_0x5c75('0x4'));var rp=require(_0x5c75('0x5'));var fs=require('fs');var path=require(_0x5c75('0x6'));var rimraf=require(_0x5c75('0x7'));var config=require(_0x5c75('0x8'));var attributes=require(_0x5c75('0x9'));module['exports']=function(_0x50869e,_0x426433){return _0x50869e[_0x5c75('0xa')]('VoicePrefix',attributes,{'tableName':_0x5c75('0xb'),'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 5011c4e..ef8e261 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 _0x042a=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird'];(function(_0x355111,_0x3b0eb1){var _0x512763=function(_0x5085e3){while(--_0x5085e3){_0x355111['push'](_0x355111['shift']());}};_0x512763(++_0x3b0eb1);}(_0x042a,0x1d9));var _0xa042=function(_0x1629db,_0x3af456){_0x1629db=_0x1629db-0x0;var _0x57bb60=_0x042a[_0x1629db];return _0x57bb60;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var moment=require(_0xa042('0x1'));var BPromise=require(_0xa042('0x2'));var rs=require(_0xa042('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa042('0x4'))['db'];var utils=require(_0xa042('0x5'));var logger=require(_0xa042('0x6'))(_0xa042('0x7'));var config=require(_0xa042('0x8'));var jayson=require(_0xa042('0x9'));var client=jayson[_0xa042('0xa')][_0xa042('0xb')]({'port':0x232a});config['redis']=_[_0xa042('0xc')](config[_0xa042('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa042('0xe'))(new Redis(config['redis']));require(_0xa042('0xf'))[_0xa042('0x10')](socket);function respondWithRpcPromise(_0x15426e,_0x2f195a,_0x172c37){return new BPromise(function(_0x2146f3,_0x550ee2){return client[_0xa042('0x11')](_0x15426e,_0x172c37)['then'](function(_0x411e3c){logger['info'](_0xa042('0x12'),_0x2f195a,_0xa042('0x13'));logger[_0xa042('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2f195a,_0xa042('0x13'),JSON[_0xa042('0x15')](_0x411e3c));if(_0x411e3c[_0xa042('0x16')]){if(_0x411e3c['error'][_0xa042('0x17')]===0x1f4){logger[_0xa042('0x16')](_0xa042('0x12'),_0x2f195a,_0x411e3c[_0xa042('0x16')]['message']);return _0x550ee2(_0x411e3c[_0xa042('0x16')][_0xa042('0x18')]);}logger[_0xa042('0x16')](_0xa042('0x12'),_0x2f195a,_0x411e3c[_0xa042('0x16')][_0xa042('0x18')]);return _0x2146f3(_0x411e3c['error']['message']);}else{logger[_0xa042('0x19')](_0xa042('0x12'),_0x2f195a,_0xa042('0x13'));_0x2146f3(_0x411e3c[_0xa042('0x1a')][_0xa042('0x18')]);}})[_0xa042('0x1b')](function(_0x42f2e4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2f195a,_0x42f2e4);_0x550ee2(_0x42f2e4);});});} \ No newline at end of file +var _0x6829=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./voicePrefix.socket','register','request','then','request\x20sent','debug','error','code','VoicePrefix,\x20%s,\x20%s','message','info','lodash','util','ioredis','../../mysqldb'];(function(_0x2f18f7,_0x4e909c){var _0x1c3b76=function(_0x10b2d3){while(--_0x10b2d3){_0x2f18f7['push'](_0x2f18f7['shift']());}};_0x1c3b76(++_0x4e909c);}(_0x6829,0x14c));var _0x9682=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6829[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9682('0x2'));var db=require(_0x9682('0x3'))['db'];var utils=require(_0x9682('0x4'));var logger=require(_0x9682('0x5'))(_0x9682('0x6'));var config=require(_0x9682('0x7'));var jayson=require(_0x9682('0x8'));var client=jayson[_0x9682('0x9')][_0x9682('0xa')]({'port':0x232a});config[_0x9682('0xb')]=_[_0x9682('0xc')](config[_0x9682('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9682('0xd'))[_0x9682('0xe')](socket);function respondWithRpcPromise(_0x4dc25f,_0x2d7493,_0x4a6d12){return new BPromise(function(_0x3da429,_0x59b429){return client[_0x9682('0xf')](_0x4dc25f,_0x4a6d12)[_0x9682('0x10')](function(_0x42b057){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2d7493,_0x9682('0x11'));logger[_0x9682('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2d7493,_0x9682('0x11'),JSON['stringify'](_0x42b057));if(_0x42b057[_0x9682('0x13')]){if(_0x42b057[_0x9682('0x13')][_0x9682('0x14')]===0x1f4){logger[_0x9682('0x13')](_0x9682('0x15'),_0x2d7493,_0x42b057[_0x9682('0x13')][_0x9682('0x16')]);return _0x59b429(_0x42b057[_0x9682('0x13')][_0x9682('0x16')]);}logger[_0x9682('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x2d7493,_0x42b057[_0x9682('0x13')]['message']);return _0x3da429(_0x42b057[_0x9682('0x13')][_0x9682('0x16')]);}else{logger[_0x9682('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x2d7493,_0x9682('0x11'));_0x3da429(_0x42b057['result'][_0x9682('0x16')]);}})['catch'](function(_0x263e4b){logger[_0x9682('0x13')](_0x9682('0x15'),_0x2d7493,_0x263e4b);_0x59b429(_0x263e4b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 82cf9f5..c517db7 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 _0x47fd=['remove','update','emit','register','./voicePrefix.events','save'];(function(_0x35d9c8,_0x267f41){var _0x24cafc=function(_0x259757){while(--_0x259757){_0x35d9c8['push'](_0x35d9c8['shift']());}};_0x24cafc(++_0x267f41);}(_0x47fd,0x13c));var _0xd47f=function(_0x323c60,_0x219b72){_0x323c60=_0x323c60-0x0;var _0x103f23=_0x47fd[_0x323c60];return _0x103f23;};'use strict';var VoicePrefixEvents=require(_0xd47f('0x0'));var events=[_0xd47f('0x1'),_0xd47f('0x2'),_0xd47f('0x3')];function createListener(_0x3cc8ea,_0x2eabd0){return function(_0x31b0da){_0x2eabd0[_0xd47f('0x4')](_0x3cc8ea,_0x31b0da);};}function removeListener(_0x285b39,_0x1dfe62){return function(){VoicePrefixEvents['removeListener'](_0x285b39,_0x1dfe62);};}exports[_0xd47f('0x5')]=function(_0x138753){for(var _0x5d07ac=0x0,_0x11c1d4=events['length'];_0x5d07ac<_0x11c1d4;_0x5d07ac++){var _0x55433e=events[_0x5d07ac];var _0x38b07c=createListener('voicePrefix:'+_0x55433e,_0x138753);VoicePrefixEvents['on'](_0x55433e,_0x38b07c);}}; \ No newline at end of file +var _0x833b=['removeListener','register','length','voicePrefix:','save','update','emit'];(function(_0x21a70f,_0x41596e){var _0x59ba50=function(_0x4f75c0){while(--_0x4f75c0){_0x21a70f['push'](_0x21a70f['shift']());}};_0x59ba50(++_0x41596e);}(_0x833b,0x131));var _0xb833=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x833b[_0x344a3f];return _0x264712;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xb833('0x0'),'remove',_0xb833('0x1')];function createListener(_0x59fa54,_0x3588c8){return function(_0x54d82d){_0x3588c8[_0xb833('0x2')](_0x59fa54,_0x54d82d);};}function removeListener(_0x37ea87,_0x1f9d90){return function(){VoicePrefixEvents[_0xb833('0x3')](_0x37ea87,_0x1f9d90);};}exports[_0xb833('0x4')]=function(_0x35b3f0){for(var _0x4422a2=0x0,_0x4eaff4=events[_0xb833('0x5')];_0x4422a2<_0x4eaff4;_0x4422a2++){var _0xb60891=events[_0x4422a2];var _0x3922f5=createListener(_0xb833('0x6')+_0xb60891,_0x35b3f0);VoicePrefixEvents['on'](_0xb60891,_0x3922f5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 17176c9..d2f3908 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 _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f2cb6,_0x5f5576){_0x2f2cb6=_0x2f2cb6-0x0;var _0x33c4a7=_0xb10b[_0x2f2cb6];return _0x33c4a7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0xb10b,0x12a));var _0xbb10=function(_0x28d231,_0x55888a){_0x28d231=_0x28d231-0x0;var _0x3814c5=_0xb10b[_0x28d231];return _0x3814c5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 3a53a68..da297df 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 _0x41a7=['rrordered','strategy','getDataValue','dialMethod','outbound','preview','booked','roundrobin','INTEGER','yes','all','once','periodic_announce','split','setDataValue','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','inbound','STRING','default','ENUM','ringall','leastrecent','fewestcalls','random','rrmemory','linear'];(function(_0xdec73b,_0x1790a7){var _0x169f7d=function(_0xf15fd4){while(--_0xf15fd4){_0xdec73b['push'](_0xdec73b['shift']());}};_0x169f7d(++_0x1790a7);}(_0x41a7,0x143));var _0x741a=function(_0x3d0d29,_0x2e1f54){_0x3d0d29=_0x3d0d29-0x0;var _0x2d65c7=_0x41a7[_0x3d0d29];return _0x2d65c7;};'use strict';var Sequelize=require(_0x741a('0x0'));module[_0x741a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x741a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x741a('0x3'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x741a('0x4')],'defaultValue':_0x741a('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x741a('0x6')]('rr',_0x741a('0x7'),_0x741a('0x8'),_0x741a('0x9'),_0x741a('0xa'),_0x741a('0xb'),_0x741a('0xc'),'wrandom',_0x741a('0xd')),'allowNull':![],'defaultValue':_0x741a('0x7'),'set':function(_0x3a037c){this['setDataValue'](_0x741a('0xe'),_0x3a037c?_0x3a037c:_0x741a('0xb'));},'get':function(){var _0x26d6bf=this[_0x741a('0xf')]('type');var _0x5155fa=this[_0x741a('0xf')](_0x741a('0x10'));var _0x24641c=this[_0x741a('0xf')](_0x741a('0xe'));if(_0x26d6bf===_0x741a('0x11')){if(_0x5155fa===_0x741a('0x12')){return null;}if(_0x5155fa===_0x741a('0x13')&&![_0x741a('0xb'),_0x741a('0x14')]['includes'](_0x24641c)){this['setDataValue'](_0x741a('0xe'),'rrmemory');}}return _0x24641c;}},'servicelevel':{'type':Sequelize[_0x741a('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x741a('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x741a('0x15')](0xb)},'timeout':{'type':Sequelize[_0x741a('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x741a('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x741a('0x4')]},'weight':{'type':Sequelize[_0x741a('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x741a('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x741a('0x6')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no',_0x741a('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x741a('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x741a('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x741a('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x741a('0x6')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x741a('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x741a('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x741a('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no'),'defaultValue':_0x741a('0x16')},'announce_holdtime':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no',_0x741a('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x741a('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x741a('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x741a('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x741a('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x741a('0x4')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x741a('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x741a('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x741a('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x741a('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x741a('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x741a('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x741a('0x4')]},'queue_quantity1':{'type':Sequelize[_0x741a('0x4')]},'queue_quantity2':{'type':Sequelize[_0x741a('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0x741a('0x4')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x4ca766){this['setDataValue'](_0x741a('0x19'),_0x4ca766?_0x4ca766['join'](','):[]);},'get':function(){return this[_0x741a('0xf')](_0x741a('0x19'))?this[_0x741a('0xf')](_0x741a('0x19'))[_0x741a('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x741a('0x4')],'defaultValue':'yes','set':function(_0x387f74){this[_0x741a('0x1b')](_0x741a('0x1c'),_0x387f74?_0x387f74[_0x741a('0x1d')](','):undefined);},'get':function(){return this[_0x741a('0xf')](_0x741a('0x1c'))?this[_0x741a('0xf')](_0x741a('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x741a('0x4')],'defaultValue':'no','set':function(_0x5a7955){this[_0x741a('0x1b')](_0x741a('0x1e'),_0x5a7955?_0x5a7955[_0x741a('0x1d')](','):undefined);},'get':function(){return this[_0x741a('0xf')](_0x741a('0x1e'))?this['getDataValue'](_0x741a('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x741a('0x6')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x741a('0x6')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x741a('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x741a('0x4')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x741a('0x1f')],'defaultValue':0x0,'set':function(_0x34c4fd){this[_0x741a('0x1b')](_0x741a('0x20'),_0x34c4fd);if(_0x34c4fd){if(this[_0x741a('0xf')]('wrapuptime')<0x2){this['setDataValue'](_0x741a('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x741a('0x22')},'dialMethod':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x12'),_0x741a('0x23'),'power',_0x741a('0x24'),_0x741a('0x13')),'defaultValue':_0x741a('0x23'),'comment':_0x741a('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x741a('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x741a('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x741a('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x741a('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x741a('0x6')](_0x741a('0x2a'),_0x741a('0x2b')),'defaultValue':_0x741a('0x2b'),'comment':_0x741a('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x741a('0x28')](0x2)[_0x741a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x741a('0x15')](0x3)[_0x741a('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x741a('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x741a('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x741a('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x741a('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x741a('0x4')],'defaultValue':_0x741a('0x2f'),'comment':_0x741a('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x741a('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x741a('0x31')},'dialQueueProject':{'type':Sequelize[_0x741a('0x4')],'comment':_0x741a('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x741a('0x15')](0x3)[_0x741a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x741a('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x741a('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x741a('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x741a('0x15')](0x3)[_0x741a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x741a('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x741a('0x15')](0x5)[_0x741a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x741a('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x741a('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x741a('0x37')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x741a('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x741a('0x38')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x741a('0x4')],'defaultValue':_0x741a('0x39')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x741a('0x3a')),'defaultValue':_0x741a('0x3b')},'dialAMDActive':{'type':Sequelize[_0x741a('0x1f')],'defaultValue':0x0,'comment':_0x741a('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x741a('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x741a('0x3d')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x741a('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x741a('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x741a('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x741a('0x3f')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x741a('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x741a('0x40')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x741a('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x741a('0x41')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x741a('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x741a('0x42')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x741a('0x15')](0x9)[_0x741a('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x741a('0x43')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x741a('0x15')](0x5)[_0x741a('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x741a('0x44')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x741a('0x15')](0x9)[_0x741a('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x741a('0x45')},'dialRecallMeTimeout':{'type':Sequelize[_0x741a('0x15')](0x5)[_0x741a('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x741a('0x6')]('DESC',_0x741a('0x46')),'defaultValue':_0x741a('0x47')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x741a('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x741a('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x741a('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x741a('0x48')},'dialCutDigit':{'type':Sequelize[_0x741a('0x15')](0x3)[_0x741a('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x741a('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x741a('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x741a('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x741a('0x15')](0x5)[_0x741a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x741a('0x4b')},'dialDropMaxRetry':{'type':Sequelize[_0x741a('0x15')](0x3)[_0x741a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x741a('0x4c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x741a('0x4d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x741a('0x15')](0x3)[_0x741a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x741a('0x15')](0x5)[_0x741a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x741a('0x15')](0x3)[_0x741a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x741a('0x15')](0x5)[_0x741a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x741a('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x741a('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x741a('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x741a('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x741a('0x15')],'allowNull':!![],'comment':_0x741a('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x741a('0x1f')],'defaultValue':![],'comment':_0x741a('0x51'),'set':function(_0x341821){if(!_0x341821)this[_0x741a('0x1b')](_0x741a('0x52'),null);this['setDataValue'](_0x741a('0x53'),_0x341821);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x741a('0x15')](0x3)[_0x741a('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x741a('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x741a('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x741a('0x15')](0x3)[_0x741a('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x741a('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x0c88=['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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','name','ENUM','inbound','outbound','default','ringall','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','roundrobin','includes','INTEGER','yes','all','once','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','booked','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)'];(function(_0x5d59e8,_0x141b4f){var _0x1f13b6=function(_0x5e8bac){while(--_0x5e8bac){_0x5d59e8['push'](_0x5d59e8['shift']());}};_0x1f13b6(++_0x141b4f);}(_0x0c88,0x1ee));var _0x80c8=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0x0c88[_0x43de22];return _0x4b15ee;};'use strict';var Sequelize=require('sequelize');module[_0x80c8('0x0')]={'name':{'type':Sequelize[_0x80c8('0x1')],'allowNull':![],'unique':_0x80c8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x4'),_0x80c8('0x5')),'allowNull':![],'defaultValue':_0x80c8('0x4')},'musiconhold':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':_0x80c8('0x6')},'announce':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x80c8('0x3')]('rr',_0x80c8('0x7'),'leastrecent',_0x80c8('0x8'),'random',_0x80c8('0x9'),_0x80c8('0xa'),_0x80c8('0xb'),_0x80c8('0xc')),'allowNull':![],'defaultValue':_0x80c8('0x7'),'set':function(_0x10a898){this[_0x80c8('0xd')](_0x80c8('0xe'),_0x10a898?_0x10a898:_0x80c8('0x9'));},'get':function(){var _0x2c6ddf=this[_0x80c8('0xf')](_0x80c8('0x10'));var _0x57ce50=this[_0x80c8('0xf')](_0x80c8('0x11'));var _0x529659=this[_0x80c8('0xf')](_0x80c8('0xe'));if(_0x2c6ddf==='outbound'){if(_0x57ce50===_0x80c8('0x12')){return null;}if(_0x57ce50==='booked'&&![_0x80c8('0x9'),_0x80c8('0x13')][_0x80c8('0x14')](_0x529659)){this[_0x80c8('0xd')](_0x80c8('0xe'),'rrmemory');}}return _0x529659;}},'servicelevel':{'type':Sequelize[_0x80c8('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x80c8('0x15')](0xb)},'timeout':{'type':Sequelize[_0x80c8('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x80c8('0x1')]},'weight':{'type':Sequelize[_0x80c8('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x80c8('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x80c8('0x16'),'no'),'defaultValue':_0x80c8('0x16')},'autopause':{'type':Sequelize[_0x80c8('0x3')]('yes','no',_0x80c8('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x80c8('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x80c8('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x80c8('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x80c8('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x80c8('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x80c8('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x80c8('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x80c8('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x16'),'no',_0x80c8('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x80c8('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x80c8('0x1')]},'queue_youarenext':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x80c8('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x80c8('0x1')]},'queue_quantity1':{'type':Sequelize[_0x80c8('0x1')]},'queue_quantity2':{'type':Sequelize[_0x80c8('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x80c8('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x3325f7){this[_0x80c8('0xd')]('periodic_announce',_0x3325f7?_0x3325f7[_0x80c8('0x19')](','):[]);},'get':function(){return this[_0x80c8('0xf')]('periodic_announce')?this[_0x80c8('0xf')](_0x80c8('0x1a'))[_0x80c8('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':_0x80c8('0x16'),'set':function(_0x5ee5e6){this['setDataValue'](_0x80c8('0x1c'),_0x5ee5e6?_0x5ee5e6[_0x80c8('0x19')](','):undefined);},'get':function(){return this[_0x80c8('0xf')](_0x80c8('0x1c'))?this[_0x80c8('0xf')](_0x80c8('0x1c'))[_0x80c8('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':'no','set':function(_0x2d64af){this[_0x80c8('0xd')](_0x80c8('0x1d'),_0x2d64af?_0x2d64af[_0x80c8('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x80c8('0x1d'))?this[_0x80c8('0xf')](_0x80c8('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x80c8('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x80c8('0x1')]},'acw':{'type':Sequelize[_0x80c8('0x1e')],'defaultValue':0x0,'set':function(_0x88494){this[_0x80c8('0xd')](_0x80c8('0x1f'),_0x88494);if(_0x88494){if(this[_0x80c8('0xf')]('wrapuptime')<0x2){this[_0x80c8('0xd')](_0x80c8('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x80c8('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x80c8('0x1e')],'defaultValue':0x0,'comment':_0x80c8('0x21')},'dialMethod':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x12'),'progressive',_0x80c8('0x22'),_0x80c8('0x23'),_0x80c8('0x24')),'defaultValue':_0x80c8('0x25'),'comment':_0x80c8('0x26')},'dialLimitChannel':{'type':Sequelize[_0x80c8('0x15')](0x4)[_0x80c8('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x80c8('0x28')},'dialLimitQueue':{'type':Sequelize[_0x80c8('0x15')](0x4)[_0x80c8('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x80c8('0x29')},'dialPowerLevel':{'type':Sequelize[_0x80c8('0x2a')](0x2)[_0x80c8('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x80c8('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x2c'),_0x80c8('0x2d')),'defaultValue':'dropRate','comment':_0x80c8('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x80c8('0x2a')](0x2)[_0x80c8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x80c8('0x2f')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x80c8('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x80c8('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80c8('0x30')},'dialQueueOptions':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':_0x80c8('0x31'),'comment':_0x80c8('0x32')},'dialQueueTimeout':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80c8('0x33')},'dialQueueProject':{'type':Sequelize[_0x80c8('0x1')],'comment':_0x80c8('0x34')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x80c8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x80c8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80c8('0x35')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x80c8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x80c8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x80c8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80c8('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x80c8('0x37')},'dialTimezone':{'type':Sequelize[_0x80c8('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x38'),_0x80c8('0x39'),_0x80c8('0x3a')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x80c8('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0x80c8('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x80c8('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x80c8('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x80c8('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x80c8('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x80c8('0x15')](0x9)[_0x80c8('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x80c8('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x80c8('0x15')](0x9)[_0x80c8('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x80c8('0x15')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x80c8('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x80c8('0x15')](0x5)[_0x80c8('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x80c8('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x80c8('0x15')](0x9)[_0x80c8('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x80c8('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x80c8('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x80c8('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x80c8('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x80c8('0x3')](_0x80c8('0x42'),_0x80c8('0x43')),'defaultValue':_0x80c8('0x42')},'dialQueueProject2':{'type':Sequelize[_0x80c8('0x1')],'comment':_0x80c8('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x80c8('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x80c8('0x44')},'dialCutDigit':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x80c8('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80c8('0x45')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80c8('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x80c8('0x15')](0x5)[_0x80c8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80c8('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x80c8('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80c8('0x48')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x80c8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80c8('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x80c8('0x15')](0x5)[_0x80c8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80c8('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x80c8('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x80c8('0x15')](0x5)[_0x80c8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x80c8('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x80c8('0x15')],'allowNull':!![],'comment':_0x80c8('0x4d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x80c8('0x4e'),'set':function(_0x3da4ac){if(!_0x3da4ac)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x80c8('0xd')](_0x80c8('0x4f'),_0x3da4ac);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x80c8('0x15')](0x3)[_0x80c8('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x80c8('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x80c8('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 381cbbb..21e659b 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x4b84[_0x2a8860];return _0x2f47a4;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file +var _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x2cdd68,_0x24e2fc){var _0x5076cf=function(_0x56adfe){while(--_0x56adfe){_0x2cdd68['push'](_0x2cdd68['shift']());}};_0x5076cf(++_0x24e2fc);}(_0xe14b,0x93));var _0xbe14=function(_0x181b70,_0x88e45f){_0x181b70=_0x181b70-0x0;var _0x170400=_0xe14b[_0x181b70];return _0x170400;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 698862b..9bf027d 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 _0x6289=['exports','events','setMaxListeners','update','remove','emit'];(function(_0x1fbbed,_0x5ea039){var _0x3a666d=function(_0x15b3a1){while(--_0x15b3a1){_0x1fbbed['push'](_0x1fbbed['shift']());}};_0x3a666d(++_0x5ea039);}(_0x6289,0x11b));var _0x9628=function(_0xedea6a,_0x23fa84){_0xedea6a=_0xedea6a-0x0;var _0x3bc2f8=_0x6289[_0xedea6a];return _0x3bc2f8;};'use strict';var EventEmitter=require(_0x9628('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9628('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9628('0x2'),'afterDestroy':_0x9628('0x3')};function emitEvent(_0x56f961){return function(_0x801b29,_0x2b6173,_0x3219c4){VoiceQueueEvents[_0x9628('0x4')](_0x56f961+':'+_0x801b29['id'],_0x801b29);VoiceQueueEvents[_0x9628('0x4')](_0x56f961,_0x801b29);_0x3219c4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x9628('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0xd6fa=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0xd6fa,0x11d));var _0xad6f=function(_0x58e29f,_0x475e63){_0x58e29f=_0x58e29f-0x0;var _0x32a7ab=_0xd6fa[_0x58e29f];return _0x32a7ab;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xad6f('0x0'))['db'][_0xad6f('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xad6f('0x2')](0x0);var events={'afterCreate':_0xad6f('0x3'),'afterUpdate':'update','afterDestroy':_0xad6f('0x4')};function emitEvent(_0x2c6aa8){return function(_0x477e63,_0xc9cac2,_0x93396b){VoiceQueueEvents[_0xad6f('0x5')](_0x2c6aa8+':'+_0x477e63['id'],_0x477e63);VoiceQueueEvents[_0xad6f('0x5')](_0x2c6aa8,_0x477e63);_0x93396b(null);};}for(var e in events){if(events[_0xad6f('0x6')](e)){var event=events[e];VoiceQueue[_0xad6f('0x7')](e,emitEvent(event));}}module[_0xad6f('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 11cdb85..ee5feeb 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x53eea2,_0x9bdf03){var _0x591b17=function(_0x22cf07){while(--_0x22cf07){_0x53eea2['push'](_0x53eea2['shift']());}};_0x591b17(++_0x9bdf03);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x55ca,0x126));var _0xa55c=function(_0x52e64,_0x6ba4e8){_0x52e64=_0x52e64-0x0;var _0x282b80=_0x55ca[_0x52e64];return _0x282b80;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 785b2fa..56aef4f 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 _0x5b69=['find','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','model','map','debug','ShowVoiceQueue'];(function(_0x55855c,_0x151e65){var _0x551f70=function(_0x1ed38f){while(--_0x1ed38f){_0x55855c['push'](_0x55855c['shift']());}};_0x551f70(++_0x151e65);}(_0x5b69,0x192));var _0x95b6=function(_0x29f9af,_0x4f3d10){_0x29f9af=_0x29f9af-0x0;var _0x56e4a8=_0x5b69[_0x29f9af];return _0x56e4a8;};'use strict';var _=require(_0x95b6('0x0'));var util=require(_0x95b6('0x1'));var moment=require('moment');var BPromise=require(_0x95b6('0x2'));var rs=require(_0x95b6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95b6('0x4'))['db'];var utils=require(_0x95b6('0x5'));var logger=require(_0x95b6('0x6'))(_0x95b6('0x7'));var config=require(_0x95b6('0x8'));var jayson=require(_0x95b6('0x9'));var client=jayson[_0x95b6('0xa')]['http']({'port':0x232a});config[_0x95b6('0xb')]=_['defaults'](config[_0x95b6('0xb')],{'host':_0x95b6('0xc'),'port':0x18eb});var socket=require(_0x95b6('0xd'))(new Redis(config[_0x95b6('0xb')]));require('./voiceQueue.socket')[_0x95b6('0xe')](socket);function respondWithRpcPromise(_0x2ee11b,_0x2f0af7,_0x265394){return new BPromise(function(_0x5af439,_0x8e34ed){return client[_0x95b6('0xf')](_0x2ee11b,_0x265394)[_0x95b6('0x10')](function(_0x5438d3){logger[_0x95b6('0x11')](_0x95b6('0x12'),_0x2f0af7,_0x95b6('0x13'));logger['debug'](_0x95b6('0x14'),_0x2f0af7,_0x95b6('0x13'),JSON[_0x95b6('0x15')](_0x5438d3));if(_0x5438d3[_0x95b6('0x16')]){if(_0x5438d3[_0x95b6('0x16')][_0x95b6('0x17')]===0x1f4){logger[_0x95b6('0x16')](_0x95b6('0x12'),_0x2f0af7,_0x5438d3[_0x95b6('0x16')][_0x95b6('0x18')]);return _0x8e34ed(_0x5438d3['error'][_0x95b6('0x18')]);}logger['error'](_0x95b6('0x12'),_0x2f0af7,_0x5438d3['error'][_0x95b6('0x18')]);return _0x5af439(_0x5438d3[_0x95b6('0x16')][_0x95b6('0x18')]);}else{logger[_0x95b6('0x11')](_0x95b6('0x12'),_0x2f0af7,'request\x20sent');_0x5af439(_0x5438d3[_0x95b6('0x19')][_0x95b6('0x18')]);}})[_0x95b6('0x1a')](function(_0x31598f){logger[_0x95b6('0x16')](_0x95b6('0x12'),_0x2f0af7,_0x31598f);_0x8e34ed(_0x31598f);});});}exports[_0x95b6('0x1b')]=function(_0x16a672){var _0x3b283f=this;return new Promise(function(_0x8bdb6a,_0x5284bd){return db[_0x95b6('0x1c')]['findAll']({'raw':_0x16a672[_0x95b6('0x1d')]?_0x16a672[_0x95b6('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x16a672[_0x95b6('0x1d')]?_0x16a672['options'][_0x95b6('0x1e')]||null:null,'attributes':_0x16a672[_0x95b6('0x1d')]?_0x16a672[_0x95b6('0x1d')][_0x95b6('0x1f')]||null:null,'limit':_0x16a672[_0x95b6('0x1d')]?_0x16a672[_0x95b6('0x1d')][_0x95b6('0x20')]||null:null,'include':_0x16a672[_0x95b6('0x1d')]?_0x16a672['options']['include']?_['map'](_0x16a672[_0x95b6('0x1d')][_0x95b6('0x21')],function(_0x20e067){return{'model':db[_0x20e067[_0x95b6('0x22')]],'as':_0x20e067['as'],'attributes':_0x20e067[_0x95b6('0x1f')],'include':_0x20e067['include']?_[_0x95b6('0x23')](_0x20e067[_0x95b6('0x21')],function(_0x552c0c){return{'model':db[_0x552c0c[_0x95b6('0x22')]],'as':_0x552c0c['as'],'attributes':_0x552c0c[_0x95b6('0x1f')],'include':_0x552c0c[_0x95b6('0x21')]?_['map'](_0x552c0c[_0x95b6('0x21')],function(_0x217061){return{'model':db[_0x217061[_0x95b6('0x22')]],'as':_0x217061['as'],'attributes':_0x217061[_0x95b6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x95b6('0x10')](function(_0x1ac1c9){logger[_0x95b6('0x11')](_0x95b6('0x1b'),_0x16a672);logger[_0x95b6('0x24')](_0x95b6('0x1b'),_0x16a672,JSON[_0x95b6('0x15')](_0x1ac1c9));_0x8bdb6a(_0x1ac1c9);})['catch'](function(_0x1d6089){logger[_0x95b6('0x16')](_0x95b6('0x1b'),_0x1d6089[_0x95b6('0x18')],_0x16a672);_0x5284bd(_0x3b283f[_0x95b6('0x16')](0x1f4,_0x1d6089[_0x95b6('0x18')]));});});};exports[_0x95b6('0x25')]=function(_0x41b2b2){var _0x52b00c=this;return new Promise(function(_0x2477e4,_0x2533fe){return db[_0x95b6('0x1c')][_0x95b6('0x26')]({'raw':_0x41b2b2[_0x95b6('0x1d')]?_0x41b2b2[_0x95b6('0x1d')][_0x95b6('0x27')]===undefined?!![]:![]:!![],'where':_0x41b2b2['options']?_0x41b2b2[_0x95b6('0x1d')][_0x95b6('0x1e')]||null:null,'attributes':_0x41b2b2[_0x95b6('0x1d')]?_0x41b2b2['options'][_0x95b6('0x1f')]||null:null,'include':_0x41b2b2[_0x95b6('0x1d')]?_0x41b2b2[_0x95b6('0x1d')][_0x95b6('0x21')]?_[_0x95b6('0x23')](_0x41b2b2['options']['include'],function(_0x7b1fb9){return{'model':db[_0x7b1fb9[_0x95b6('0x22')]],'as':_0x7b1fb9['as'],'attributes':_0x7b1fb9[_0x95b6('0x1f')],'include':_0x7b1fb9['include']?_[_0x95b6('0x23')](_0x7b1fb9[_0x95b6('0x21')],function(_0x1e055b){return{'model':db[_0x1e055b[_0x95b6('0x22')]],'as':_0x1e055b['as'],'attributes':_0x1e055b[_0x95b6('0x1f')],'include':_0x1e055b['include']?_['map'](_0x1e055b[_0x95b6('0x21')],function(_0x311329){return{'model':db[_0x311329['model']],'as':_0x311329['as'],'attributes':_0x311329[_0x95b6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25e342){logger[_0x95b6('0x11')](_0x95b6('0x25'),_0x41b2b2);logger[_0x95b6('0x24')](_0x95b6('0x25'),_0x41b2b2,JSON[_0x95b6('0x15')](_0x25e342));_0x2477e4(_0x25e342);})['catch'](function(_0x2b6974){logger[_0x95b6('0x16')]('ShowVoiceQueue',_0x2b6974['message'],_0x41b2b2);_0x2533fe(_0x52b00c[_0x95b6('0x16')](0x1f4,_0x2b6974['message']));});});}; \ No newline at end of file +var _0x7e68=['socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x7e68,0x1e9));var _0x87e6=function(_0x24b7a2,_0x14f97c){_0x24b7a2=_0x24b7a2-0x0;var _0x29e1e9=_0x7e68[_0x24b7a2];return _0x29e1e9;};'use strict';var _=require(_0x87e6('0x0'));var util=require(_0x87e6('0x1'));var moment=require(_0x87e6('0x2'));var BPromise=require(_0x87e6('0x3'));var rs=require(_0x87e6('0x4'));var fs=require('fs');var Redis=require(_0x87e6('0x5'));var db=require(_0x87e6('0x6'))['db'];var utils=require(_0x87e6('0x7'));var logger=require(_0x87e6('0x8'))('rpc');var config=require(_0x87e6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x87e6('0xa')][_0x87e6('0xb')]({'port':0x232a});config[_0x87e6('0xc')]=_[_0x87e6('0xd')](config[_0x87e6('0xc')],{'host':_0x87e6('0xe'),'port':0x18eb});var socket=require(_0x87e6('0xf'))(new Redis(config[_0x87e6('0xc')]));require(_0x87e6('0x10'))[_0x87e6('0x11')](socket);function respondWithRpcPromise(_0x3c79ac,_0x550b6f,_0x10cfa3){return new BPromise(function(_0x14fd2c,_0x59fbc6){return client[_0x87e6('0x12')](_0x3c79ac,_0x10cfa3)[_0x87e6('0x13')](function(_0x5ad9e7){logger[_0x87e6('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x550b6f,_0x87e6('0x15'));logger[_0x87e6('0x16')](_0x87e6('0x17'),_0x550b6f,'request\x20sent',JSON['stringify'](_0x5ad9e7));if(_0x5ad9e7[_0x87e6('0x18')]){if(_0x5ad9e7[_0x87e6('0x18')][_0x87e6('0x19')]===0x1f4){logger['error'](_0x87e6('0x1a'),_0x550b6f,_0x5ad9e7['error'][_0x87e6('0x1b')]);return _0x59fbc6(_0x5ad9e7[_0x87e6('0x18')][_0x87e6('0x1b')]);}logger[_0x87e6('0x18')](_0x87e6('0x1a'),_0x550b6f,_0x5ad9e7[_0x87e6('0x18')][_0x87e6('0x1b')]);return _0x14fd2c(_0x5ad9e7[_0x87e6('0x18')][_0x87e6('0x1b')]);}else{logger[_0x87e6('0x14')](_0x87e6('0x1a'),_0x550b6f,_0x87e6('0x15'));_0x14fd2c(_0x5ad9e7[_0x87e6('0x1c')][_0x87e6('0x1b')]);}})[_0x87e6('0x1d')](function(_0x1483ac){logger[_0x87e6('0x18')](_0x87e6('0x1a'),_0x550b6f,_0x1483ac);_0x59fbc6(_0x1483ac);});});}exports['GetVoiceQueue']=function(_0x5747bf){var _0x408cde=this;return new Promise(function(_0x5183b1,_0xb6be43){return db[_0x87e6('0x1e')]['findAll']({'raw':_0x5747bf[_0x87e6('0x1f')]?_0x5747bf['options'][_0x87e6('0x20')]===undefined?!![]:![]:!![],'where':_0x5747bf[_0x87e6('0x1f')]?_0x5747bf[_0x87e6('0x1f')][_0x87e6('0x21')]||null:null,'attributes':_0x5747bf[_0x87e6('0x1f')]?_0x5747bf[_0x87e6('0x1f')][_0x87e6('0x22')]||null:null,'limit':_0x5747bf['options']?_0x5747bf[_0x87e6('0x1f')][_0x87e6('0x23')]||null:null,'include':_0x5747bf[_0x87e6('0x1f')]?_0x5747bf[_0x87e6('0x1f')][_0x87e6('0x24')]?_[_0x87e6('0x25')](_0x5747bf[_0x87e6('0x1f')][_0x87e6('0x24')],function(_0x147184){return{'model':db[_0x147184[_0x87e6('0x26')]],'as':_0x147184['as'],'attributes':_0x147184['attributes'],'include':_0x147184[_0x87e6('0x24')]?_['map'](_0x147184[_0x87e6('0x24')],function(_0x511145){return{'model':db[_0x511145['model']],'as':_0x511145['as'],'attributes':_0x511145[_0x87e6('0x22')],'include':_0x511145[_0x87e6('0x24')]?_[_0x87e6('0x25')](_0x511145[_0x87e6('0x24')],function(_0x1dedfb){return{'model':db[_0x1dedfb[_0x87e6('0x26')]],'as':_0x1dedfb['as'],'attributes':_0x1dedfb[_0x87e6('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33231d){logger[_0x87e6('0x14')](_0x87e6('0x27'),_0x5747bf);logger[_0x87e6('0x16')]('GetVoiceQueue',_0x5747bf,JSON['stringify'](_0x33231d));_0x5183b1(_0x33231d);})['catch'](function(_0x592722){logger[_0x87e6('0x18')](_0x87e6('0x27'),_0x592722['message'],_0x5747bf);_0xb6be43(_0x408cde[_0x87e6('0x18')](0x1f4,_0x592722[_0x87e6('0x1b')]));});});};exports[_0x87e6('0x28')]=function(_0x40e720){var _0x42de4f=this;return new Promise(function(_0x535332,_0x37b214){return db[_0x87e6('0x1e')]['find']({'raw':_0x40e720[_0x87e6('0x1f')]?_0x40e720[_0x87e6('0x1f')][_0x87e6('0x20')]===undefined?!![]:![]:!![],'where':_0x40e720[_0x87e6('0x1f')]?_0x40e720[_0x87e6('0x1f')]['where']||null:null,'attributes':_0x40e720[_0x87e6('0x1f')]?_0x40e720['options'][_0x87e6('0x22')]||null:null,'include':_0x40e720[_0x87e6('0x1f')]?_0x40e720['options'][_0x87e6('0x24')]?_['map'](_0x40e720['options'][_0x87e6('0x24')],function(_0x1a730e){return{'model':db[_0x1a730e['model']],'as':_0x1a730e['as'],'attributes':_0x1a730e[_0x87e6('0x22')],'include':_0x1a730e['include']?_[_0x87e6('0x25')](_0x1a730e['include'],function(_0x3061e4){return{'model':db[_0x3061e4['model']],'as':_0x3061e4['as'],'attributes':_0x3061e4[_0x87e6('0x22')],'include':_0x3061e4[_0x87e6('0x24')]?_['map'](_0x3061e4[_0x87e6('0x24')],function(_0x3b5b08){return{'model':db[_0x3b5b08[_0x87e6('0x26')]],'as':_0x3b5b08['as'],'attributes':_0x3b5b08[_0x87e6('0x22')]};}):[]};}):[]};}):[]:[]})[_0x87e6('0x13')](function(_0x121af5){logger[_0x87e6('0x14')](_0x87e6('0x28'),_0x40e720);logger[_0x87e6('0x16')](_0x87e6('0x28'),_0x40e720,JSON[_0x87e6('0x29')](_0x121af5));_0x535332(_0x121af5);})[_0x87e6('0x1d')](function(_0x41dada){logger[_0x87e6('0x18')](_0x87e6('0x28'),_0x41dada[_0x87e6('0x1b')],_0x40e720);_0x37b214(_0x42de4f[_0x87e6('0x18')](0x1f4,_0x41dada[_0x87e6('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a1e6496..6d0a325 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 _0x0078=['register','length','voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener'];(function(_0x35181c,_0xaefce6){var _0x3f5987=function(_0x4980af){while(--_0x4980af){_0x35181c['push'](_0x35181c['shift']());}};_0x3f5987(++_0xaefce6);}(_0x0078,0x73));var _0x8007=function(_0x145b00,_0xf24eda){_0x145b00=_0x145b00-0x0;var _0x46fd2e=_0x0078[_0x145b00];return _0x46fd2e;};'use strict';var VoiceQueueEvents=require(_0x8007('0x0'));var events=[_0x8007('0x1'),_0x8007('0x2'),'update'];function createListener(_0x480520,_0x1c7ca7){return function(_0x576dcb){_0x1c7ca7[_0x8007('0x3')](_0x480520,_0x576dcb);};}function removeListener(_0x37164e,_0x45b341){return function(){VoiceQueueEvents[_0x8007('0x4')](_0x37164e,_0x45b341);};}exports[_0x8007('0x5')]=function(_0xcc7ba4){for(var _0x253e07=0x0,_0x4796e1=events[_0x8007('0x6')];_0x253e07<_0x4796e1;_0x253e07++){var _0x2ec7d3=events[_0x253e07];var _0x1234f8=createListener(_0x8007('0x7')+_0x2ec7d3,_0xcc7ba4);VoiceQueueEvents['on'](_0x2ec7d3,_0x1234f8);}}; \ No newline at end of file +var _0xf86c=['length','voiceQueue:','./voiceQueue.events','save','removeListener','register'];(function(_0x48cf04,_0x4f8d89){var _0x59f9db=function(_0x29035d){while(--_0x29035d){_0x48cf04['push'](_0x48cf04['shift']());}};_0x59f9db(++_0x4f8d89);}(_0xf86c,0x8c));var _0xcf86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf86c[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueEvents=require(_0xcf86('0x0'));var events=[_0xcf86('0x1'),'remove','update'];function createListener(_0xb7f746,_0x43fa5d){return function(_0x5e5fad){_0x43fa5d['emit'](_0xb7f746,_0x5e5fad);};}function removeListener(_0x2917b3,_0x27b820){return function(){VoiceQueueEvents[_0xcf86('0x2')](_0x2917b3,_0x27b820);};}exports[_0xcf86('0x3')]=function(_0x5bc6e6){for(var _0x2dc91a=0x0,_0x249574=events[_0xcf86('0x4')];_0x2dc91a<_0x249574;_0x2dc91a++){var _0x4bbfca=events[_0x2dc91a];var _0x2adc56=createListener(_0xcf86('0x5')+_0x4bbfca,_0x5bc6e6);VoiceQueueEvents['on'](_0x4bbfca,_0x2adc56);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 75d5ca8..36a0dfc 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 _0x8baf=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','/describe','describe','/index','getVoiceQueuesReport','show','post','put','/:id','delete','destroy','exports','multer'];(function(_0x54516e,_0x5df54c){var _0x4d1e6f=function(_0x454bbc){while(--_0x454bbc){_0x54516e['push'](_0x54516e['shift']());}};_0x4d1e6f(++_0x5df54c);}(_0x8baf,0x11d));var _0xf8ba=function(_0x51b1bd,_0xd9d2aa){_0x51b1bd=_0x51b1bd-0x0;var _0x1ce3d8=_0x8baf[_0x51b1bd];return _0x1ce3d8;};'use strict';var multer=require(_0xf8ba('0x0'));var util=require('util');var path=require(_0xf8ba('0x1'));var timeout=require('connect-timeout');var express=require(_0xf8ba('0x2'));var router=express[_0xf8ba('0x3')]();var fs_extra=require(_0xf8ba('0x4'));var auth=require(_0xf8ba('0x5'));var interaction=require(_0xf8ba('0x6'));var config=require(_0xf8ba('0x7'));var controller=require(_0xf8ba('0x8'));router['get']('/',auth[_0xf8ba('0x9')](),controller['index']);router[_0xf8ba('0xa')](_0xf8ba('0xb'),auth[_0xf8ba('0x9')](),controller[_0xf8ba('0xc')]);router[_0xf8ba('0xa')](_0xf8ba('0xd'),auth['isAuthenticated'](),controller[_0xf8ba('0xe')]);router[_0xf8ba('0xa')]('/:id',auth[_0xf8ba('0x9')](),controller[_0xf8ba('0xf')]);router[_0xf8ba('0x10')]('/',auth[_0xf8ba('0x9')](),controller['create']);router[_0xf8ba('0x11')](_0xf8ba('0x12'),auth[_0xf8ba('0x9')](),controller['update']);router[_0xf8ba('0x13')](_0xf8ba('0x12'),auth[_0xf8ba('0x9')](),controller[_0xf8ba('0x14')]);module[_0xf8ba('0x15')]=router; \ No newline at end of file +var _0x699c=['/describe','get','/index','getVoiceQueuesReport','show','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','isAuthenticated','index'];(function(_0x14d034,_0x514a1a){var _0x37075b=function(_0x2a877f){while(--_0x2a877f){_0x14d034['push'](_0x14d034['shift']());}};_0x37075b(++_0x514a1a);}(_0x699c,0x1a1));var _0xc699=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x699c[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xc699('0x0'));var util=require(_0xc699('0x1'));var path=require(_0xc699('0x2'));var timeout=require(_0xc699('0x3'));var express=require(_0xc699('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc699('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xc699('0x6')](),controller[_0xc699('0x7')]);router['get'](_0xc699('0x8'),auth[_0xc699('0x6')](),controller['describe']);router[_0xc699('0x9')](_0xc699('0xa'),auth[_0xc699('0x6')](),controller[_0xc699('0xb')]);router[_0xc699('0x9')]('/:id',auth[_0xc699('0x6')](),controller[_0xc699('0xc')]);router['post']('/',auth[_0xc699('0x6')](),controller[_0xc699('0xd')]);router[_0xc699('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc699('0xf')]('/:id',auth[_0xc699('0x6')](),controller[_0xc699('0x10')]);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 475ca91..6aff42e 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 _0xe4a6=['format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x23b4b3,_0x4c092b){var _0x387006=function(_0x2ec4bd){while(--_0x2ec4bd){_0x23b4b3['push'](_0x23b4b3['shift']());}};_0x387006(++_0x4c092b);}(_0xe4a6,0x16a));var _0x6e4a=function(_0x3cf868,_0x28a57a){_0x3cf868=_0x3cf868-0x0;var _0x104034=_0xe4a6[_0x3cf868];return _0x104034;};'use strict';var Sequelize=require(_0x6e4a('0x0'));var moment=require(_0x6e4a('0x1'));module['exports']={'type':{'type':Sequelize[_0x6e4a('0x2')]},'uniqueid':{'type':Sequelize[_0x6e4a('0x2')]},'calleridnum':{'type':Sequelize[_0x6e4a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6e4a('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x6e4a('0x3')],'set':function(_0x23d634){var _0x267e73=moment(_0x23d634);var _0x2d0fdc=moment(this[_0x6e4a('0x4')](_0x6e4a('0x5')))[_0x6e4a('0x6')](_0x6e4a('0x7'));var _0x2b194b=_0x267e73[_0x6e4a('0x8')](_0x2d0fdc,'seconds');this[_0x6e4a('0x9')](_0x6e4a('0xa'),_0x23d634);this[_0x6e4a('0x9')](_0x6e4a('0xb'),_0x2b194b||null);}},'position':{'type':Sequelize[_0x6e4a('0xc')]},'count':{'type':Sequelize[_0x6e4a('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x6e4a('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6e4a('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x6e4a('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6e4a('0x3')]},'queuecallerexit':{'type':Sequelize[_0x6e4a('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x6e4a('0x2')],'comment':_0x6e4a('0xe')},'originalposition':{'type':Sequelize[_0x6e4a('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6e4a('0x2')]},'context':{'type':Sequelize[_0x6e4a('0x2')]},'exten':{'type':Sequelize[_0x6e4a('0x2')]},'priority':{'type':Sequelize[_0x6e4a('0x2')]},'holdtime':{'type':Sequelize[_0x6e4a('0xc')]},'mohtime':{'type':Sequelize[_0x6e4a('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6e4a('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x6e4a('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6e4a('0x2')],'comment':_0x6e4a('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x6e4a('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6e4a('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6e4a('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x6e4a('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x6e4a('0x2')]}}; \ No newline at end of file +var _0x138b=['exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x2a6929,_0x3d6e5b){var _0x5a6334=function(_0x479698){while(--_0x479698){_0x2a6929['push'](_0x2a6929['shift']());}};_0x5a6334(++_0x3d6e5b);}(_0x138b,0x132));var _0xb138=function(_0xda04e3,_0x4ceca8){_0xda04e3=_0xda04e3-0x0;var _0x344f1b=_0x138b[_0xda04e3];return _0x344f1b;};'use strict';var Sequelize=require(_0xb138('0x0'));var moment=require(_0xb138('0x1'));module[_0xb138('0x2')]={'type':{'type':Sequelize[_0xb138('0x3')]},'uniqueid':{'type':Sequelize[_0xb138('0x3')]},'calleridnum':{'type':Sequelize[_0xb138('0x3')]},'calleridname':{'type':Sequelize[_0xb138('0x3')]},'queue':{'type':Sequelize[_0xb138('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xb138('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xb138('0x4')],'set':function(_0x4af8ae){var _0xe0d04d=moment(_0x4af8ae);var _0x38f92a=moment(this['getDataValue'](_0xb138('0x5')))['format'](_0xb138('0x6'));var _0x4919dd=_0xe0d04d[_0xb138('0x7')](_0x38f92a,_0xb138('0x8'));this[_0xb138('0x9')]('queuecallerleaveAt',_0x4af8ae);this[_0xb138('0x9')](_0xb138('0xa'),_0x4919dd||null);}},'position':{'type':Sequelize[_0xb138('0xb')]},'count':{'type':Sequelize[_0xb138('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xb138('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb138('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xb138('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb138('0x4')]},'queuecallerexit':{'type':Sequelize[_0xb138('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb138('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xb138('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb138('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb138('0x3')]},'context':{'type':Sequelize[_0xb138('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xb138('0xb')]},'mohtime':{'type':Sequelize[_0xb138('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb138('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb138('0x3')]},'transfer':{'type':Sequelize[_0xb138('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xb138('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xb138('0x3')]},'disposition':{'type':Sequelize[_0xb138('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb138('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xb138('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0xb138('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index af985f0..91aa1f9 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 _0xbd83=['filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceQueueReport','findAll','rows','show','rawAttributes','find','catch','create','body','params','describe','getVoiceQueuesReport','nolimit','eml-format','rimraf','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','type','key','model','query','keys'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xbd83,0x168));var _0x3bd8=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0xbd83[_0x5a6de2];return _0x2c0525;};'use strict';var emlformat=require(_0x3bd8('0x0'));var rimraf=require(_0x3bd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bd8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3bd8('0x3'));var Mustache=require(_0x3bd8('0x4'));var util=require('util');var path=require(_0x3bd8('0x5'));var sox=require(_0x3bd8('0x6'));var csv=require(_0x3bd8('0x7'));var ejs=require(_0x3bd8('0x8'));var fs=require('fs');var fs_extra=require(_0x3bd8('0x9'));var _=require(_0x3bd8('0xa'));var squel=require(_0x3bd8('0xb'));var crypto=require(_0x3bd8('0xc'));var jsforce=require(_0x3bd8('0xd'));var deskjs=require(_0x3bd8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3bd8('0xf'));var Papa=require('papaparse');var Redis=require(_0x3bd8('0x10'));var authService=require(_0x3bd8('0x11'));var qs=require(_0x3bd8('0x12'));var as=require(_0x3bd8('0x13'));var hardwareService=require(_0x3bd8('0x14'));var logger=require(_0x3bd8('0x15'))(_0x3bd8('0x16'));var utils=require(_0x3bd8('0x17'));var config=require(_0x3bd8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bd8('0x19'))['db'];config[_0x3bd8('0x1a')]=_[_0x3bd8('0x1b')](config['redis'],{'host':_0x3bd8('0x1c'),'port':0x18eb});var socket=require(_0x3bd8('0x1d'))(new Redis(config['redis']));require(_0x3bd8('0x1e'))['register'](socket);function respondWithStatusCode(_0x3fd37a,_0x402919){_0x402919=_0x402919||0xcc;return function(_0xedb49){if(_0xedb49){return _0x3fd37a[_0x3bd8('0x1f')](_0x402919);}return _0x3fd37a[_0x3bd8('0x20')](_0x402919)[_0x3bd8('0x21')]();};}function respondWithResult(_0x42f25f,_0xeeb014){_0xeeb014=_0xeeb014||0xc8;return function(_0x16b2cd){if(_0x16b2cd){return _0x42f25f['status'](_0xeeb014)[_0x3bd8('0x22')](_0x16b2cd);}};}function respondWithFilteredResult(_0x577333,_0x3e2283){return function(_0x2e6980){if(_0x2e6980){var _0x4b3863=typeof _0x3e2283['offset']==='undefined'&&typeof _0x3e2283['limit']===_0x3bd8('0x23');var _0x343926=_0x2e6980[_0x3bd8('0x24')];var _0x4f5650=_0x4b3863?0x0:_0x3e2283[_0x3bd8('0x25')];var _0x46d682=_0x4b3863?_0x2e6980[_0x3bd8('0x24')]:_0x3e2283[_0x3bd8('0x25')]+_0x3e2283[_0x3bd8('0x26')];var _0x30eacc;if(_0x46d682>=_0x343926){_0x46d682=_0x343926;_0x30eacc=0xc8;}else{_0x30eacc=0xce;}_0x577333[_0x3bd8('0x20')](_0x30eacc);return _0x577333['set'](_0x3bd8('0x27'),_0x4f5650+'-'+_0x46d682+'/'+_0x343926)['json'](_0x2e6980);}return null;};}function patchUpdates(_0x3d4b1a){return function(_0x2ad819){try{jsonpatch[_0x3bd8('0x28')](_0x2ad819,_0x3d4b1a,!![]);}catch(_0x4cae65){return BPromise[_0x3bd8('0x29')](_0x4cae65);}return _0x2ad819[_0x3bd8('0x2a')]();};}function saveUpdates(_0x5da2a4,_0x11e72d){return function(_0x503ca1){if(_0x503ca1){return _0x503ca1[_0x3bd8('0x2b')](_0x5da2a4)[_0x3bd8('0x2c')](function(_0x581b93){return _0x581b93;});}return null;};}function removeEntity(_0x47fa25,_0x363b14){return function(_0x449ac6){if(_0x449ac6){return _0x449ac6[_0x3bd8('0x2d')]()[_0x3bd8('0x2c')](function(){_0x47fa25[_0x3bd8('0x20')](0xcc)[_0x3bd8('0x21')]();});}};}function handleEntityNotFound(_0x5ec3be,_0x2a74cb){return function(_0x5d8dec){if(!_0x5d8dec){_0x5ec3be[_0x3bd8('0x1f')](0x194);}return _0x5d8dec;};}function handleError(_0xd1096f,_0x470bda){_0x470bda=_0x470bda||0x1f4;return function(_0x52275b){logger[_0x3bd8('0x2e')](_0x52275b['stack']);if(_0x52275b[_0x3bd8('0x2f')]){delete _0x52275b['name'];}_0xd1096f['status'](_0x470bda)['send'](_0x52275b);};}exports[_0x3bd8('0x30')]=function(_0x312045,_0x4a6184){var _0x2d78d8={},_0x4ea3ba={},_0x2e78d3={'count':0x0,'rows':[]};var _0x5a6486=_[_0x3bd8('0x31')](db['VoiceQueueReport']['rawAttributes'],function(_0x202cae){return{'name':_0x202cae['fieldName'],'type':_0x202cae[_0x3bd8('0x32')][_0x3bd8('0x33')]};});_0x4ea3ba[_0x3bd8('0x34')]=_['map'](_0x5a6486,'name');_0x4ea3ba[_0x3bd8('0x35')]=_[_0x3bd8('0x36')](_0x312045[_0x3bd8('0x35')]);_0x4ea3ba[_0x3bd8('0x37')]=_[_0x3bd8('0x38')](_0x4ea3ba['model'],_0x4ea3ba['query']);_0x2d78d8[_0x3bd8('0x39')]=_[_0x3bd8('0x38')](_0x4ea3ba[_0x3bd8('0x34')],qs['fields'](_0x312045['query'][_0x3bd8('0x3a')]));_0x2d78d8['attributes']=_0x2d78d8[_0x3bd8('0x39')]['length']?_0x2d78d8['attributes']:_0x4ea3ba[_0x3bd8('0x34')];if(!_0x312045[_0x3bd8('0x35')][_0x3bd8('0x3b')]('nolimit')){_0x2d78d8[_0x3bd8('0x26')]=qs[_0x3bd8('0x26')](_0x312045['query'][_0x3bd8('0x26')]);_0x2d78d8[_0x3bd8('0x25')]=qs[_0x3bd8('0x25')](_0x312045[_0x3bd8('0x35')][_0x3bd8('0x25')]);}_0x2d78d8[_0x3bd8('0x3c')]=qs[_0x3bd8('0x3d')](_0x312045[_0x3bd8('0x35')]['sort']);_0x2d78d8[_0x3bd8('0x3e')]=qs[_0x3bd8('0x37')](_[_0x3bd8('0x3f')](_0x312045[_0x3bd8('0x35')],_0x4ea3ba['filters']),_0x5a6486);if(_0x312045['query'][_0x3bd8('0x40')]){_0x2d78d8['where']=_[_0x3bd8('0x41')](_0x2d78d8['where'],{'$or':_[_0x3bd8('0x31')](_0x5a6486,function(_0x24ef23){if(_0x24ef23[_0x3bd8('0x32')]!==_0x3bd8('0x42')){var _0x2993d8={};_0x2993d8[_0x24ef23['name']]={'$like':'%'+_0x312045[_0x3bd8('0x35')][_0x3bd8('0x40')]+'%'};return _0x2993d8;}})});}_0x2d78d8=_[_0x3bd8('0x41')]({},_0x2d78d8,_0x312045[_0x3bd8('0x43')]);var _0x3465e5={'where':_0x2d78d8[_0x3bd8('0x3e')]};return db['VoiceQueueReport'][_0x3bd8('0x24')](_0x3465e5)[_0x3bd8('0x2c')](function(_0x13acab){_0x2e78d3[_0x3bd8('0x24')]=_0x13acab;if(_0x312045[_0x3bd8('0x35')][_0x3bd8('0x44')]){_0x2d78d8[_0x3bd8('0x45')]=[{'all':!![]}];}return db[_0x3bd8('0x46')][_0x3bd8('0x47')](_0x2d78d8);})[_0x3bd8('0x2c')](function(_0x25c3ff){_0x2e78d3[_0x3bd8('0x48')]=_0x25c3ff;return _0x2e78d3;})[_0x3bd8('0x2c')](respondWithFilteredResult(_0x4a6184,_0x2d78d8))['catch'](handleError(_0x4a6184,null));};exports[_0x3bd8('0x49')]=function(_0x2a4349,_0x51a98e){var _0x4baec1={'raw':![],'where':{'id':_0x2a4349['params']['id']}},_0x45403e={};_0x45403e[_0x3bd8('0x34')]=_[_0x3bd8('0x36')](db[_0x3bd8('0x46')][_0x3bd8('0x4a')]);_0x45403e['query']=_['keys'](_0x2a4349[_0x3bd8('0x35')]);_0x45403e[_0x3bd8('0x37')]=_['intersection'](_0x45403e[_0x3bd8('0x34')],_0x45403e[_0x3bd8('0x35')]);_0x4baec1[_0x3bd8('0x39')]=_[_0x3bd8('0x38')](_0x45403e[_0x3bd8('0x34')],qs[_0x3bd8('0x3a')](_0x2a4349[_0x3bd8('0x35')]['fields']));_0x4baec1[_0x3bd8('0x39')]=_0x4baec1['attributes']['length']?_0x4baec1['attributes']:_0x45403e[_0x3bd8('0x34')];if(_0x2a4349['query'][_0x3bd8('0x44')]){_0x4baec1[_0x3bd8('0x45')]=[{'all':!![]}];}_0x4baec1=_[_0x3bd8('0x41')]({},_0x4baec1,_0x2a4349[_0x3bd8('0x43')]);return db[_0x3bd8('0x46')][_0x3bd8('0x4b')](_0x4baec1)['then'](handleEntityNotFound(_0x51a98e,null))[_0x3bd8('0x2c')](respondWithResult(_0x51a98e,null))[_0x3bd8('0x4c')](handleError(_0x51a98e,null));};exports[_0x3bd8('0x4d')]=function(_0x40bf38,_0x31f8e0){return db['VoiceQueueReport']['create'](_0x40bf38[_0x3bd8('0x4e')],{})['then'](respondWithResult(_0x31f8e0,0xc9))[_0x3bd8('0x4c')](handleError(_0x31f8e0,null));};exports['update']=function(_0x5a3cfc,_0x15b27a){if(_0x5a3cfc['body']['id']){delete _0x5a3cfc['body']['id'];}return db[_0x3bd8('0x46')][_0x3bd8('0x4b')]({'where':{'id':_0x5a3cfc['params']['id']}})[_0x3bd8('0x2c')](handleEntityNotFound(_0x15b27a,null))[_0x3bd8('0x2c')](saveUpdates(_0x5a3cfc[_0x3bd8('0x4e')],null))[_0x3bd8('0x2c')](respondWithResult(_0x15b27a,null))[_0x3bd8('0x4c')](handleError(_0x15b27a,null));};exports['destroy']=function(_0x300bc3,_0x32bd27){return db[_0x3bd8('0x46')][_0x3bd8('0x4b')]({'where':{'id':_0x300bc3[_0x3bd8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x32bd27,null))[_0x3bd8('0x2c')](removeEntity(_0x32bd27,null))[_0x3bd8('0x4c')](handleError(_0x32bd27,null));};exports[_0x3bd8('0x50')]=function(_0x32135a,_0x2bb3a0){return db[_0x3bd8('0x46')][_0x3bd8('0x50')]()['then'](respondWithResult(_0x2bb3a0,null))[_0x3bd8('0x4c')](handleError(_0x2bb3a0,null));};exports[_0x3bd8('0x51')]=function(_0x5f2a44,_0x340287){var _0x4148bb={},_0x198eb2={},_0x46b2f2={'count':0x0,'rows':[]};_0x198eb2['model']=_[_0x3bd8('0x36')](db['VoiceQueueReport'][_0x3bd8('0x4a')]);_0x198eb2[_0x3bd8('0x35')]=_[_0x3bd8('0x36')](_0x5f2a44[_0x3bd8('0x35')]);_0x198eb2[_0x3bd8('0x37')]=_[_0x3bd8('0x38')](_0x198eb2[_0x3bd8('0x34')],_0x198eb2[_0x3bd8('0x35')]);_0x4148bb[_0x3bd8('0x39')]=_[_0x3bd8('0x38')](_0x198eb2[_0x3bd8('0x34')],qs['fields'](_0x5f2a44[_0x3bd8('0x35')][_0x3bd8('0x3a')]));_0x4148bb[_0x3bd8('0x39')]=_0x4148bb[_0x3bd8('0x39')]['length']?_0x4148bb[_0x3bd8('0x39')]:_0x198eb2[_0x3bd8('0x34')];if(!_0x5f2a44[_0x3bd8('0x35')][_0x3bd8('0x3b')](_0x3bd8('0x52'))){_0x4148bb[_0x3bd8('0x26')]=qs[_0x3bd8('0x26')](_0x5f2a44[_0x3bd8('0x35')]['limit']);_0x4148bb['offset']=qs[_0x3bd8('0x25')](_0x5f2a44[_0x3bd8('0x35')][_0x3bd8('0x25')]);}_0x4148bb[_0x3bd8('0x3c')]=qs[_0x3bd8('0x3d')](_0x5f2a44['query'][_0x3bd8('0x3d')]);_0x4148bb[_0x3bd8('0x3e')]=qs[_0x3bd8('0x37')](_[_0x3bd8('0x3f')](_0x5f2a44[_0x3bd8('0x35')],_0x198eb2['filters']));if(_0x5f2a44[_0x3bd8('0x35')][_0x3bd8('0x40')]){_0x4148bb[_0x3bd8('0x3e')]=_[_0x3bd8('0x41')](_0x4148bb['where'],{'$or':_[_0x3bd8('0x31')](_0x4148bb['attributes'],function(_0x2695e7){var _0x238972={};_0x238972[_0x2695e7]={'$like':'%'+_0x5f2a44['query'][_0x3bd8('0x40')]+'%'};return _0x238972;})});}_0x4148bb=_[_0x3bd8('0x41')]({},_0x4148bb,_0x5f2a44['options']);var _0x4d8db3={'where':_0x4148bb[_0x3bd8('0x3e')]};return db[_0x3bd8('0x46')][_0x3bd8('0x24')](_0x4d8db3)[_0x3bd8('0x2c')](function(_0x2cd10c){_0x46b2f2['count']=_0x2cd10c;if(_0x5f2a44['query'][_0x3bd8('0x44')]){_0x4148bb['include']=[{'all':!![]}];}return db[_0x3bd8('0x46')][_0x3bd8('0x47')](_0x4148bb);})[_0x3bd8('0x2c')](function(_0x221b3e){_0x46b2f2[_0x3bd8('0x48')]=_0x221b3e;return _0x46b2f2;})[_0x3bd8('0x2c')](respondWithFilteredResult(_0x340287,_0x4148bb,_0x3bd8('0x51')))['catch'](handleError(_0x340287,null,_0x3bd8('0x51')));}; \ No newline at end of file +var _0xdd6c=['type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','pick','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdd6c,0x180));var _0xcdd6=function(_0x32b3e0,_0x4a6942){_0x32b3e0=_0x32b3e0-0x0;var _0x4d9531=_0xdd6c[_0x32b3e0];return _0x4d9531;};'use strict';var emlformat=require(_0xcdd6('0x0'));var rimraf=require(_0xcdd6('0x1'));var zipdir=require(_0xcdd6('0x2'));var jsonpatch=require(_0xcdd6('0x3'));var rp=require(_0xcdd6('0x4'));var moment=require('moment');var BPromise=require(_0xcdd6('0x5'));var Mustache=require(_0xcdd6('0x6'));var util=require(_0xcdd6('0x7'));var path=require(_0xcdd6('0x8'));var sox=require(_0xcdd6('0x9'));var csv=require(_0xcdd6('0xa'));var ejs=require(_0xcdd6('0xb'));var fs=require('fs');var fs_extra=require(_0xcdd6('0xc'));var _=require(_0xcdd6('0xd'));var squel=require(_0xcdd6('0xe'));var crypto=require(_0xcdd6('0xf'));var jsforce=require(_0xcdd6('0x10'));var deskjs=require(_0xcdd6('0x11'));var toCsv=require('to-csv');var querystring=require(_0xcdd6('0x12'));var Papa=require(_0xcdd6('0x13'));var Redis=require(_0xcdd6('0x14'));var authService=require(_0xcdd6('0x15'));var qs=require(_0xcdd6('0x16'));var as=require(_0xcdd6('0x17'));var hardwareService=require(_0xcdd6('0x18'));var logger=require('../../config/logger')(_0xcdd6('0x19'));var utils=require(_0xcdd6('0x1a'));var config=require(_0xcdd6('0x1b'));var licenseUtil=require(_0xcdd6('0x1c'));var db=require(_0xcdd6('0x1d'))['db'];config['redis']=_[_0xcdd6('0x1e')](config[_0xcdd6('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0xcdd6('0x20'))(new Redis(config[_0xcdd6('0x1f')]));require('./voiceQueueReport.socket')[_0xcdd6('0x21')](socket);function respondWithStatusCode(_0x4db423,_0x5d2b7f){_0x5d2b7f=_0x5d2b7f||0xcc;return function(_0x46e319){if(_0x46e319){return _0x4db423[_0xcdd6('0x22')](_0x5d2b7f);}return _0x4db423['status'](_0x5d2b7f)[_0xcdd6('0x23')]();};}function respondWithResult(_0xe1d748,_0x52eb7d){_0x52eb7d=_0x52eb7d||0xc8;return function(_0x4d6db1){if(_0x4d6db1){return _0xe1d748[_0xcdd6('0x24')](_0x52eb7d)[_0xcdd6('0x25')](_0x4d6db1);}};}function respondWithFilteredResult(_0x279199,_0xca0619){return function(_0x49d45e){if(_0x49d45e){var _0x18d3c3=typeof _0xca0619[_0xcdd6('0x26')]==='undefined'&&typeof _0xca0619['limit']===_0xcdd6('0x27');var _0x300b4f=_0x49d45e[_0xcdd6('0x28')];var _0x55492a=_0x18d3c3?0x0:_0xca0619[_0xcdd6('0x26')];var _0x23ff72=_0x18d3c3?_0x49d45e['count']:_0xca0619[_0xcdd6('0x26')]+_0xca0619[_0xcdd6('0x29')];var _0x59c332;if(_0x23ff72>=_0x300b4f){_0x23ff72=_0x300b4f;_0x59c332=0xc8;}else{_0x59c332=0xce;}_0x279199['status'](_0x59c332);return _0x279199[_0xcdd6('0x2a')](_0xcdd6('0x2b'),_0x55492a+'-'+_0x23ff72+'/'+_0x300b4f)[_0xcdd6('0x25')](_0x49d45e);}return null;};}function patchUpdates(_0x5aa211){return function(_0x4575c1){try{jsonpatch[_0xcdd6('0x2c')](_0x4575c1,_0x5aa211,!![]);}catch(_0x2b48f7){return BPromise[_0xcdd6('0x2d')](_0x2b48f7);}return _0x4575c1[_0xcdd6('0x2e')]();};}function saveUpdates(_0x1f4aab,_0x5dedb4){return function(_0x174c96){if(_0x174c96){return _0x174c96[_0xcdd6('0x2f')](_0x1f4aab)['then'](function(_0x1cd15c){return _0x1cd15c;});}return null;};}function removeEntity(_0x54fba1,_0x30b44e){return function(_0x3b8fbb){if(_0x3b8fbb){return _0x3b8fbb['destroy']()['then'](function(){_0x54fba1['status'](0xcc)[_0xcdd6('0x23')]();});}};}function handleEntityNotFound(_0x20572b,_0x429187){return function(_0x564c7e){if(!_0x564c7e){_0x20572b[_0xcdd6('0x22')](0x194);}return _0x564c7e;};}function handleError(_0xeffa41,_0x3ef8e8){_0x3ef8e8=_0x3ef8e8||0x1f4;return function(_0x5209d3){logger[_0xcdd6('0x30')](_0x5209d3['stack']);if(_0x5209d3[_0xcdd6('0x31')]){delete _0x5209d3[_0xcdd6('0x31')];}_0xeffa41[_0xcdd6('0x24')](_0x3ef8e8)[_0xcdd6('0x32')](_0x5209d3);};}exports[_0xcdd6('0x33')]=function(_0x1ad932,_0x34da67){var _0x4a0441={},_0x3f1e29={},_0x4b4deb={'count':0x0,'rows':[]};var _0x5d38e5=_[_0xcdd6('0x34')](db[_0xcdd6('0x35')][_0xcdd6('0x36')],function(_0x295c89){return{'name':_0x295c89[_0xcdd6('0x37')],'type':_0x295c89[_0xcdd6('0x38')][_0xcdd6('0x39')]};});_0x3f1e29[_0xcdd6('0x3a')]=_['map'](_0x5d38e5,_0xcdd6('0x31'));_0x3f1e29['query']=_[_0xcdd6('0x3b')](_0x1ad932[_0xcdd6('0x3c')]);_0x3f1e29['filters']=_[_0xcdd6('0x3d')](_0x3f1e29['model'],_0x3f1e29[_0xcdd6('0x3c')]);_0x4a0441[_0xcdd6('0x3e')]=_[_0xcdd6('0x3d')](_0x3f1e29['model'],qs[_0xcdd6('0x3f')](_0x1ad932[_0xcdd6('0x3c')][_0xcdd6('0x3f')]));_0x4a0441[_0xcdd6('0x3e')]=_0x4a0441[_0xcdd6('0x3e')][_0xcdd6('0x40')]?_0x4a0441[_0xcdd6('0x3e')]:_0x3f1e29[_0xcdd6('0x3a')];if(!_0x1ad932[_0xcdd6('0x3c')]['hasOwnProperty']('nolimit')){_0x4a0441[_0xcdd6('0x29')]=qs['limit'](_0x1ad932[_0xcdd6('0x3c')][_0xcdd6('0x29')]);_0x4a0441[_0xcdd6('0x26')]=qs[_0xcdd6('0x26')](_0x1ad932[_0xcdd6('0x3c')][_0xcdd6('0x26')]);}_0x4a0441[_0xcdd6('0x41')]=qs[_0xcdd6('0x42')](_0x1ad932[_0xcdd6('0x3c')][_0xcdd6('0x42')]);_0x4a0441[_0xcdd6('0x43')]=qs[_0xcdd6('0x44')](_['pick'](_0x1ad932[_0xcdd6('0x3c')],_0x3f1e29['filters']),_0x5d38e5);if(_0x1ad932[_0xcdd6('0x3c')][_0xcdd6('0x45')]){_0x4a0441[_0xcdd6('0x43')]=_['merge'](_0x4a0441[_0xcdd6('0x43')],{'$or':_[_0xcdd6('0x34')](_0x5d38e5,function(_0x4d10ea){if(_0x4d10ea[_0xcdd6('0x38')]!==_0xcdd6('0x46')){var _0x2c6609={};_0x2c6609[_0x4d10ea['name']]={'$like':'%'+_0x1ad932[_0xcdd6('0x3c')][_0xcdd6('0x45')]+'%'};return _0x2c6609;}})});}_0x4a0441=_[_0xcdd6('0x47')]({},_0x4a0441,_0x1ad932[_0xcdd6('0x48')]);var _0x2662ca={'where':_0x4a0441['where']};return db[_0xcdd6('0x35')]['count'](_0x2662ca)[_0xcdd6('0x49')](function(_0x1f805c){_0x4b4deb['count']=_0x1f805c;if(_0x1ad932[_0xcdd6('0x3c')][_0xcdd6('0x4a')]){_0x4a0441[_0xcdd6('0x4b')]=[{'all':!![]}];}return db[_0xcdd6('0x35')][_0xcdd6('0x4c')](_0x4a0441);})[_0xcdd6('0x49')](function(_0x30a96c){_0x4b4deb[_0xcdd6('0x4d')]=_0x30a96c;return _0x4b4deb;})['then'](respondWithFilteredResult(_0x34da67,_0x4a0441))[_0xcdd6('0x4e')](handleError(_0x34da67,null));};exports['show']=function(_0x444ea6,_0x3e3cf7){var _0x57ce81={'raw':![],'where':{'id':_0x444ea6[_0xcdd6('0x4f')]['id']}},_0x554b78={};_0x554b78[_0xcdd6('0x3a')]=_[_0xcdd6('0x3b')](db[_0xcdd6('0x35')]['rawAttributes']);_0x554b78['query']=_[_0xcdd6('0x3b')](_0x444ea6[_0xcdd6('0x3c')]);_0x554b78['filters']=_[_0xcdd6('0x3d')](_0x554b78[_0xcdd6('0x3a')],_0x554b78[_0xcdd6('0x3c')]);_0x57ce81[_0xcdd6('0x3e')]=_[_0xcdd6('0x3d')](_0x554b78[_0xcdd6('0x3a')],qs['fields'](_0x444ea6[_0xcdd6('0x3c')][_0xcdd6('0x3f')]));_0x57ce81[_0xcdd6('0x3e')]=_0x57ce81[_0xcdd6('0x3e')][_0xcdd6('0x40')]?_0x57ce81[_0xcdd6('0x3e')]:_0x554b78['model'];if(_0x444ea6['query']['includeAll']){_0x57ce81[_0xcdd6('0x4b')]=[{'all':!![]}];}_0x57ce81=_['merge']({},_0x57ce81,_0x444ea6[_0xcdd6('0x48')]);return db[_0xcdd6('0x35')][_0xcdd6('0x50')](_0x57ce81)[_0xcdd6('0x49')](handleEntityNotFound(_0x3e3cf7,null))['then'](respondWithResult(_0x3e3cf7,null))['catch'](handleError(_0x3e3cf7,null));};exports[_0xcdd6('0x51')]=function(_0x1d3f78,_0xa1b91){return db[_0xcdd6('0x35')][_0xcdd6('0x51')](_0x1d3f78[_0xcdd6('0x52')],{})[_0xcdd6('0x49')](respondWithResult(_0xa1b91,0xc9))[_0xcdd6('0x4e')](handleError(_0xa1b91,null));};exports[_0xcdd6('0x2f')]=function(_0x47cdf1,_0xefadbe){if(_0x47cdf1[_0xcdd6('0x52')]['id']){delete _0x47cdf1[_0xcdd6('0x52')]['id'];}return db[_0xcdd6('0x35')]['find']({'where':{'id':_0x47cdf1[_0xcdd6('0x4f')]['id']}})[_0xcdd6('0x49')](handleEntityNotFound(_0xefadbe,null))[_0xcdd6('0x49')](saveUpdates(_0x47cdf1['body'],null))[_0xcdd6('0x49')](respondWithResult(_0xefadbe,null))[_0xcdd6('0x4e')](handleError(_0xefadbe,null));};exports['destroy']=function(_0x8f7396,_0xb9b85b){return db[_0xcdd6('0x35')][_0xcdd6('0x50')]({'where':{'id':_0x8f7396[_0xcdd6('0x4f')]['id']}})[_0xcdd6('0x49')](handleEntityNotFound(_0xb9b85b,null))[_0xcdd6('0x49')](removeEntity(_0xb9b85b,null))['catch'](handleError(_0xb9b85b,null));};exports[_0xcdd6('0x53')]=function(_0x3248c9,_0x35d605){return db[_0xcdd6('0x35')][_0xcdd6('0x53')]()[_0xcdd6('0x49')](respondWithResult(_0x35d605,null))[_0xcdd6('0x4e')](handleError(_0x35d605,null));};exports[_0xcdd6('0x54')]=function(_0x573227,_0x1f6207){var _0x596f85={},_0x5774ed={},_0x172799={'count':0x0,'rows':[]};_0x5774ed[_0xcdd6('0x3a')]=_[_0xcdd6('0x3b')](db[_0xcdd6('0x35')]['rawAttributes']);_0x5774ed[_0xcdd6('0x3c')]=_[_0xcdd6('0x3b')](_0x573227[_0xcdd6('0x3c')]);_0x5774ed[_0xcdd6('0x44')]=_['intersection'](_0x5774ed[_0xcdd6('0x3a')],_0x5774ed['query']);_0x596f85[_0xcdd6('0x3e')]=_['intersection'](_0x5774ed[_0xcdd6('0x3a')],qs[_0xcdd6('0x3f')](_0x573227['query'][_0xcdd6('0x3f')]));_0x596f85[_0xcdd6('0x3e')]=_0x596f85['attributes']['length']?_0x596f85['attributes']:_0x5774ed[_0xcdd6('0x3a')];if(!_0x573227[_0xcdd6('0x3c')][_0xcdd6('0x55')](_0xcdd6('0x56'))){_0x596f85['limit']=qs['limit'](_0x573227['query'][_0xcdd6('0x29')]);_0x596f85[_0xcdd6('0x26')]=qs[_0xcdd6('0x26')](_0x573227['query']['offset']);}_0x596f85['order']=qs[_0xcdd6('0x42')](_0x573227['query']['sort']);_0x596f85['where']=qs[_0xcdd6('0x44')](_[_0xcdd6('0x57')](_0x573227[_0xcdd6('0x3c')],_0x5774ed[_0xcdd6('0x44')]));if(_0x573227['query']['filter']){_0x596f85[_0xcdd6('0x43')]=_[_0xcdd6('0x47')](_0x596f85['where'],{'$or':_[_0xcdd6('0x34')](_0x596f85[_0xcdd6('0x3e')],function(_0x3cc298){var _0x181477={};_0x181477[_0x3cc298]={'$like':'%'+_0x573227[_0xcdd6('0x3c')][_0xcdd6('0x45')]+'%'};return _0x181477;})});}_0x596f85=_[_0xcdd6('0x47')]({},_0x596f85,_0x573227[_0xcdd6('0x48')]);var _0xb36a82={'where':_0x596f85[_0xcdd6('0x43')]};return db[_0xcdd6('0x35')][_0xcdd6('0x28')](_0xb36a82)[_0xcdd6('0x49')](function(_0x19c04a){_0x172799[_0xcdd6('0x28')]=_0x19c04a;if(_0x573227[_0xcdd6('0x3c')]['includeAll']){_0x596f85['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0xcdd6('0x4c')](_0x596f85);})['then'](function(_0x19a43d){_0x172799['rows']=_0x19a43d;return _0x172799;})[_0xcdd6('0x49')](respondWithFilteredResult(_0x1f6207,_0x596f85,_0xcdd6('0x54')))[_0xcdd6('0x4e')](handleError(_0x1f6207,null,_0xcdd6('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b5db9cf..c232098 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 _0x3e09=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','remove','emit','hasOwnProperty','exports'];(function(_0x54e298,_0x519e23){var _0x4fff82=function(_0x453441){while(--_0x453441){_0x54e298['push'](_0x54e298['shift']());}};_0x4fff82(++_0x519e23);}(_0x3e09,0x70));var _0x93e0=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0x3e09[_0x540160];return _0x476120;};'use strict';var EventEmitter=require(_0x93e0('0x0'));var VoiceQueueReport=require(_0x93e0('0x1'))['db'][_0x93e0('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x93e0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x93e0('0x4')};function emitEvent(_0x161b1b){return function(_0x55adfc,_0x4d058a,_0x4fe7b2){VoiceQueueReportEvents[_0x93e0('0x5')](_0x161b1b+':'+_0x55adfc['id'],_0x55adfc);VoiceQueueReportEvents[_0x93e0('0x5')](_0x161b1b,_0x55adfc);_0x4fe7b2(null);};}for(var e in events){if(events[_0x93e0('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x93e0('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x5bf2=['exports','events','../../mysqldb','save','update','emit','hasOwnProperty','hook'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x5bf2,0x1f1));var _0x25bf=function(_0x4d81ec,_0x4fc556){_0x4d81ec=_0x4d81ec-0x0;var _0x5aa140=_0x5bf2[_0x4d81ec];return _0x5aa140;};'use strict';var EventEmitter=require(_0x25bf('0x0'));var VoiceQueueReport=require(_0x25bf('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x25bf('0x2'),'afterUpdate':_0x25bf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x17ad69){return function(_0x68200e,_0x3e45d2,_0x442ecf){VoiceQueueReportEvents['emit'](_0x17ad69+':'+_0x68200e['id'],_0x68200e);VoiceQueueReportEvents[_0x25bf('0x4')](_0x17ad69,_0x68200e);_0x442ecf(null);};}for(var e in events){if(events[_0x25bf('0x5')](e)){var event=events[e];VoiceQueueReport[_0x25bf('0x6')](e,emitEvent(event));}}module[_0x25bf('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3bfe095..00e5bb1 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 _0x089e=['calleridnum','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid'];(function(_0x6970d1,_0x871130){var _0x1f14ef=function(_0x4a7862){while(--_0x4a7862){_0x6970d1['push'](_0x6970d1['shift']());}};_0x1f14ef(++_0x871130);}(_0x089e,0x10b));var _0xe089=function(_0x4a0873,_0x3057c8){_0x4a0873=_0x4a0873-0x0;var _0x4b623a=_0x089e[_0x4a0873];return _0x4b623a;};'use strict';var _=require(_0xe089('0x0'));var util=require('util');var logger=require(_0xe089('0x1'))('api');var moment=require(_0xe089('0x2'));var BPromise=require(_0xe089('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe089('0x4'));var rimraf=require(_0xe089('0x5'));var config=require(_0xe089('0x6'));var attributes=require(_0xe089('0x7'));module[_0xe089('0x8')]=function(_0x2b3b15,_0x385aa7){return _0x2b3b15[_0xe089('0x9')](_0xe089('0xa'),attributes,{'tableName':_0xe089('0xb'),'paranoid':![],'indexes':[{'fields':[_0xe089('0xc')]},{'fields':[_0xe089('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ff5=['uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0x5a9841,_0x950566){var _0xb4f748=function(_0xdecea8){while(--_0xdecea8){_0x5a9841['push'](_0x5a9841['shift']());}};_0xb4f748(++_0x950566);}(_0x3ff5,0x15b));var _0x53ff=function(_0x1954ae,_0x2a846d){_0x1954ae=_0x1954ae-0x0;var _0x31f1d1=_0x3ff5[_0x1954ae];return _0x31f1d1;};'use strict';var _=require(_0x53ff('0x0'));var util=require(_0x53ff('0x1'));var logger=require(_0x53ff('0x2'))(_0x53ff('0x3'));var moment=require('moment');var BPromise=require(_0x53ff('0x4'));var rp=require(_0x53ff('0x5'));var fs=require('fs');var path=require(_0x53ff('0x6'));var rimraf=require(_0x53ff('0x7'));var config=require('../../config/environment');var attributes=require(_0x53ff('0x8'));module[_0x53ff('0x9')]=function(_0x2d16d8,_0x1c9754){return _0x2d16d8[_0x53ff('0xa')](_0x53ff('0xb'),attributes,{'tableName':_0x53ff('0xc'),'paranoid':![],'indexes':[{'fields':[_0x53ff('0xd')]},{'fields':[_0x53ff('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 27f11dc..ba19360 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 _0x66f8=['bluebird','ioredis','rpc','jayson/promise','client','http','redis','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueueReport','options','attributes','limit','include','map','model','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','where','lodash','util','moment'];(function(_0x4cd0de,_0x1a5174){var _0x38c6bd=function(_0x1c66ef){while(--_0x1c66ef){_0x4cd0de['push'](_0x4cd0de['shift']());}};_0x38c6bd(++_0x1a5174);}(_0x66f8,0xd5));var _0x866f=function(_0x4e4ac3,_0x39c201){_0x4e4ac3=_0x4e4ac3-0x0;var _0xddbf5b=_0x66f8[_0x4e4ac3];return _0xddbf5b;};'use strict';var _=require(_0x866f('0x0'));var util=require(_0x866f('0x1'));var moment=require(_0x866f('0x2'));var BPromise=require(_0x866f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x866f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x866f('0x5'));var config=require('../../config/environment');var jayson=require(_0x866f('0x6'));var client=jayson[_0x866f('0x7')][_0x866f('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x866f('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x866f('0xa'))['register'](socket);function respondWithRpcPromise(_0x531bca,_0x4ef168,_0x31397c){return new BPromise(function(_0x90790d,_0x34448d){return client['request'](_0x531bca,_0x31397c)[_0x866f('0xb')](function(_0xff2965){logger[_0x866f('0xc')](_0x866f('0xd'),_0x4ef168,_0x866f('0xe'));logger[_0x866f('0xf')](_0x866f('0x10'),_0x4ef168,'request\x20sent',JSON[_0x866f('0x11')](_0xff2965));if(_0xff2965[_0x866f('0x12')]){if(_0xff2965[_0x866f('0x12')]['code']===0x1f4){logger[_0x866f('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x4ef168,_0xff2965['error'][_0x866f('0x13')]);return _0x34448d(_0xff2965[_0x866f('0x12')][_0x866f('0x13')]);}logger[_0x866f('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x4ef168,_0xff2965['error'][_0x866f('0x13')]);return _0x90790d(_0xff2965[_0x866f('0x12')][_0x866f('0x13')]);}else{logger[_0x866f('0xc')](_0x866f('0xd'),_0x4ef168,_0x866f('0xe'));_0x90790d(_0xff2965['result'][_0x866f('0x13')]);}})[_0x866f('0x14')](function(_0x217f92){logger['error'](_0x866f('0xd'),_0x4ef168,_0x217f92);_0x34448d(_0x217f92);});});}exports[_0x866f('0x15')]=function(_0x2cda13){var _0x28caff=this;return new Promise(function(_0x1cc611,_0xcf089d){return db['VoiceQueueReport']['findAll']({'raw':_0x2cda13[_0x866f('0x16')]?_0x2cda13[_0x866f('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2cda13[_0x866f('0x16')]?_0x2cda13[_0x866f('0x16')]['where']||null:null,'attributes':_0x2cda13[_0x866f('0x16')]?_0x2cda13['options'][_0x866f('0x17')]||null:null,'limit':_0x2cda13['options']?_0x2cda13[_0x866f('0x16')][_0x866f('0x18')]||null:null,'include':_0x2cda13[_0x866f('0x16')]?_0x2cda13['options'][_0x866f('0x19')]?_[_0x866f('0x1a')](_0x2cda13[_0x866f('0x16')]['include'],function(_0x5bd78d){return{'model':db[_0x5bd78d[_0x866f('0x1b')]],'as':_0x5bd78d['as'],'attributes':_0x5bd78d[_0x866f('0x17')],'include':_0x5bd78d[_0x866f('0x19')]?_[_0x866f('0x1a')](_0x5bd78d[_0x866f('0x19')],function(_0x34fb89){return{'model':db[_0x34fb89[_0x866f('0x1b')]],'as':_0x34fb89['as'],'attributes':_0x34fb89[_0x866f('0x17')],'include':_0x34fb89[_0x866f('0x19')]?_['map'](_0x34fb89[_0x866f('0x19')],function(_0x44b698){return{'model':db[_0x44b698[_0x866f('0x1b')]],'as':_0x44b698['as'],'attributes':_0x44b698[_0x866f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x866f('0xb')](function(_0x2766d0){logger['info']('GetVoiceQueueReport',_0x2cda13);logger[_0x866f('0xf')](_0x866f('0x15'),_0x2cda13,JSON[_0x866f('0x11')](_0x2766d0));_0x1cc611(_0x2766d0);})[_0x866f('0x14')](function(_0x15a218){logger['error'](_0x866f('0x15'),_0x15a218[_0x866f('0x13')],_0x2cda13);_0xcf089d(_0x28caff[_0x866f('0x12')](0x1f4,_0x15a218[_0x866f('0x13')]));});});};exports[_0x866f('0x1c')]=function(_0x50102c){var _0x2e20af=this;return new Promise(function(_0x2a53fc,_0x5bf473){return db[_0x866f('0x1d')][_0x866f('0x1e')](_0x50102c[_0x866f('0x1f')],{'raw':_0x50102c['options']?_0x50102c[_0x866f('0x16')][_0x866f('0x20')]===undefined?!![]:![]:!![]})[_0x866f('0xb')](function(_0x5d9712){logger[_0x866f('0xc')]('CreateVoiceQueueReport',_0x50102c);logger[_0x866f('0xf')](_0x866f('0x1c'),_0x50102c,JSON['stringify'](_0x5d9712));_0x2a53fc(_0x5d9712);})[_0x866f('0x14')](function(_0x1aef2b){logger['error'](_0x866f('0x1c'),_0x1aef2b[_0x866f('0x13')],_0x50102c);_0x5bf473(_0x2e20af[_0x866f('0x12')](0x1f4,_0x1aef2b['message']));});});};exports[_0x866f('0x21')]=function(_0x25ee93){var _0x3abd79=this;return new Promise(function(_0x12d4b5,_0x2ec4d0){return db[_0x866f('0x1d')][_0x866f('0x22')](_0x25ee93[_0x866f('0x1f')],{'raw':_0x25ee93['options']?_0x25ee93[_0x866f('0x16')][_0x866f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25ee93[_0x866f('0x16')]?_0x25ee93[_0x866f('0x16')][_0x866f('0x23')]||null:null,'attributes':_0x25ee93['options']?_0x25ee93[_0x866f('0x16')]['attributes']||null:null,'limit':_0x25ee93[_0x866f('0x16')]?_0x25ee93[_0x866f('0x16')][_0x866f('0x18')]||null:null})[_0x866f('0xb')](function(_0x4aa68d){logger[_0x866f('0xc')](_0x866f('0x21'),_0x25ee93);logger['debug']('UpdateVoiceQueueReport',_0x25ee93,JSON[_0x866f('0x11')](_0x4aa68d));_0x12d4b5(_0x4aa68d);})['catch'](function(_0x494574){logger[_0x866f('0x12')](_0x866f('0x21'),_0x494574[_0x866f('0x13')],_0x25ee93);_0x2ec4d0(_0x3abd79[_0x866f('0x12')](0x1f4,_0x494574[_0x866f('0x13')]));});});}; \ No newline at end of file +var _0xa491=['catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','limit','map','model','attributes','include','then','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','request\x20sent','debug','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0xa491,0xb2));var _0x1a49=function(_0x1c765b,_0x31732e){_0x1c765b=_0x1c765b-0x0;var _0x5c9085=_0xa491[_0x1c765b];return _0x5c9085;};'use strict';var _=require('lodash');var util=require(_0x1a49('0x0'));var moment=require(_0x1a49('0x1'));var BPromise=require(_0x1a49('0x2'));var rs=require(_0x1a49('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a49('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1a49('0x5'));var jayson=require(_0x1a49('0x6'));var client=jayson[_0x1a49('0x7')][_0x1a49('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x1a49('0x9'),'port':0x18eb});var socket=require(_0x1a49('0xa'))(new Redis(config['redis']));require(_0x1a49('0xb'))[_0x1a49('0xc')](socket);function respondWithRpcPromise(_0x53468f,_0xd8de81,_0x5c0282){return new BPromise(function(_0x572e69,_0x2bd881){return client['request'](_0x53468f,_0x5c0282)['then'](function(_0x22d6a6){logger[_0x1a49('0xd')]('VoiceQueueReport,\x20%s,\x20%s',_0xd8de81,_0x1a49('0xe'));logger[_0x1a49('0xf')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0xd8de81,_0x1a49('0xe'),JSON[_0x1a49('0x10')](_0x22d6a6));if(_0x22d6a6[_0x1a49('0x11')]){if(_0x22d6a6[_0x1a49('0x11')][_0x1a49('0x12')]===0x1f4){logger[_0x1a49('0x11')](_0x1a49('0x13'),_0xd8de81,_0x22d6a6[_0x1a49('0x11')]['message']);return _0x2bd881(_0x22d6a6[_0x1a49('0x11')][_0x1a49('0x14')]);}logger[_0x1a49('0x11')](_0x1a49('0x13'),_0xd8de81,_0x22d6a6[_0x1a49('0x11')][_0x1a49('0x14')]);return _0x572e69(_0x22d6a6[_0x1a49('0x11')]['message']);}else{logger[_0x1a49('0xd')]('VoiceQueueReport,\x20%s,\x20%s',_0xd8de81,'request\x20sent');_0x572e69(_0x22d6a6[_0x1a49('0x15')][_0x1a49('0x14')]);}})[_0x1a49('0x16')](function(_0x363cff){logger[_0x1a49('0x11')](_0x1a49('0x13'),_0xd8de81,_0x363cff);_0x2bd881(_0x363cff);});});}exports[_0x1a49('0x17')]=function(_0x5616f6){var _0xf075a7=this;return new Promise(function(_0x287fcf,_0x48f1be){return db[_0x1a49('0x18')][_0x1a49('0x19')]({'raw':_0x5616f6[_0x1a49('0x1a')]?_0x5616f6[_0x1a49('0x1a')][_0x1a49('0x1b')]===undefined?!![]:![]:!![],'where':_0x5616f6[_0x1a49('0x1a')]?_0x5616f6[_0x1a49('0x1a')]['where']||null:null,'attributes':_0x5616f6['options']?_0x5616f6[_0x1a49('0x1a')]['attributes']||null:null,'limit':_0x5616f6['options']?_0x5616f6[_0x1a49('0x1a')][_0x1a49('0x1c')]||null:null,'include':_0x5616f6['options']?_0x5616f6[_0x1a49('0x1a')]['include']?_[_0x1a49('0x1d')](_0x5616f6[_0x1a49('0x1a')]['include'],function(_0x1e64a9){return{'model':db[_0x1e64a9[_0x1a49('0x1e')]],'as':_0x1e64a9['as'],'attributes':_0x1e64a9[_0x1a49('0x1f')],'include':_0x1e64a9[_0x1a49('0x20')]?_[_0x1a49('0x1d')](_0x1e64a9[_0x1a49('0x20')],function(_0x392e02){return{'model':db[_0x392e02[_0x1a49('0x1e')]],'as':_0x392e02['as'],'attributes':_0x392e02[_0x1a49('0x1f')],'include':_0x392e02[_0x1a49('0x20')]?_[_0x1a49('0x1d')](_0x392e02[_0x1a49('0x20')],function(_0xa5c27a){return{'model':db[_0xa5c27a['model']],'as':_0xa5c27a['as'],'attributes':_0xa5c27a['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a49('0x21')](function(_0x1ee4f3){logger[_0x1a49('0xd')](_0x1a49('0x17'),_0x5616f6);logger[_0x1a49('0xf')](_0x1a49('0x17'),_0x5616f6,JSON['stringify'](_0x1ee4f3));_0x287fcf(_0x1ee4f3);})[_0x1a49('0x16')](function(_0x5d5e0b){logger[_0x1a49('0x11')](_0x1a49('0x17'),_0x5d5e0b['message'],_0x5616f6);_0x48f1be(_0xf075a7[_0x1a49('0x11')](0x1f4,_0x5d5e0b['message']));});});};exports[_0x1a49('0x22')]=function(_0x493e5c){var _0x310077=this;return new Promise(function(_0xbad15e,_0x2ed509){return db[_0x1a49('0x18')][_0x1a49('0x23')](_0x493e5c[_0x1a49('0x24')],{'raw':_0x493e5c[_0x1a49('0x1a')]?_0x493e5c[_0x1a49('0x1a')][_0x1a49('0x1b')]===undefined?!![]:![]:!![]})[_0x1a49('0x21')](function(_0x102504){logger[_0x1a49('0xd')]('CreateVoiceQueueReport',_0x493e5c);logger['debug'](_0x1a49('0x22'),_0x493e5c,JSON[_0x1a49('0x10')](_0x102504));_0xbad15e(_0x102504);})[_0x1a49('0x16')](function(_0x1da3f3){logger[_0x1a49('0x11')](_0x1a49('0x22'),_0x1da3f3[_0x1a49('0x14')],_0x493e5c);_0x2ed509(_0x310077[_0x1a49('0x11')](0x1f4,_0x1da3f3['message']));});});};exports[_0x1a49('0x25')]=function(_0x2d97ca){var _0x21887d=this;return new Promise(function(_0x16dce6,_0x19f705){return db[_0x1a49('0x18')][_0x1a49('0x26')](_0x2d97ca[_0x1a49('0x24')],{'raw':_0x2d97ca['options']?_0x2d97ca['options'][_0x1a49('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d97ca['options']?_0x2d97ca['options'][_0x1a49('0x27')]||null:null,'attributes':_0x2d97ca[_0x1a49('0x1a')]?_0x2d97ca['options'][_0x1a49('0x1f')]||null:null,'limit':_0x2d97ca[_0x1a49('0x1a')]?_0x2d97ca['options']['limit']||null:null})[_0x1a49('0x21')](function(_0x276da4){logger[_0x1a49('0xd')](_0x1a49('0x25'),_0x2d97ca);logger[_0x1a49('0xf')](_0x1a49('0x25'),_0x2d97ca,JSON['stringify'](_0x276da4));_0x16dce6(_0x276da4);})[_0x1a49('0x16')](function(_0x2f9a85){logger[_0x1a49('0x11')]('UpdateVoiceQueueReport',_0x2f9a85[_0x1a49('0x14')],_0x2d97ca);_0x19f705(_0x21887d[_0x1a49('0x11')](0x1f4,_0x2f9a85['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 98680bb..7968874 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 _0xab33=['remove','emit','voiceQueueReport:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab33,0x1a3));var _0x3ab3=function(_0xa23ff1,_0x31b069){_0xa23ff1=_0xa23ff1-0x0;var _0x36eefa=_0xab33[_0xa23ff1];return _0x36eefa;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x3ab3('0x0'),_0x3ab3('0x1'),'update'];function createListener(_0x18a618,_0x4d8430){return function(_0x481512){_0x4d8430[_0x3ab3('0x2')](_0x18a618,_0x481512);};}function removeListener(_0x2843e1,_0x310872){return function(){VoiceQueueReportEvents['removeListener'](_0x2843e1,_0x310872);};}exports['register']=function(_0x1495c2){for(var _0x543906=0x0,_0x4451ba=events['length'];_0x543906<_0x4451ba;_0x543906++){var _0x4f760a=events[_0x543906];var _0x277d51=createListener(_0x3ab3('0x3')+_0x4f760a,_0x1495c2);VoiceQueueReportEvents['on'](_0x4f760a,_0x277d51);}}; \ No newline at end of file +var _0x49fe=['emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0x49fe,0x100));var _0xe49f=function(_0x50404e,_0x2aee0c){_0x50404e=_0x50404e-0x0;var _0x15a5b5=_0x49fe[_0x50404e];return _0x15a5b5;};'use strict';var VoiceQueueReportEvents=require(_0xe49f('0x0'));var events=[_0xe49f('0x1'),_0xe49f('0x2'),'update'];function createListener(_0x4d17b1,_0x277bc4){return function(_0x595aeb){_0x277bc4[_0xe49f('0x3')](_0x4d17b1,_0x595aeb);};}function removeListener(_0x199a0b,_0xb0e197){return function(){VoiceQueueReportEvents[_0xe49f('0x4')](_0x199a0b,_0xb0e197);};}exports['register']=function(_0x20633a){for(var _0x51fe70=0x0,_0xbef6f5=events[_0xe49f('0x5')];_0x51fe70<_0xbef6f5;_0x51fe70++){var _0x4f9b1f=events[_0x51fe70];var _0x384c48=createListener(_0xe49f('0x6')+_0x4f9b1f,_0x20633a);VoiceQueueReportEvents['on'](_0x4f9b1f,_0x384c48);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 6ef6bfc..0197db6 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 _0xf759=['exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x241710,_0x232aba){var _0x14710d=function(_0x4ef889){while(--_0x4ef889){_0x241710['push'](_0x241710['shift']());}};_0x14710d(++_0x232aba);}(_0xf759,0x1e1));var _0x9f75=function(_0x2c0c24,_0x587e07){_0x2c0c24=_0x2c0c24-0x0;var _0x1bd5d3=_0xf759[_0x2c0c24];return _0x1bd5d3;};'use strict';var multer=require(_0x9f75('0x0'));var util=require(_0x9f75('0x1'));var path=require(_0x9f75('0x2'));var timeout=require(_0x9f75('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9f75('0x4'));var config=require(_0x9f75('0x5'));var controller=require(_0x9f75('0x6'));router['get']('/',auth[_0x9f75('0x7')](),controller[_0x9f75('0x8')]);router[_0x9f75('0x9')](_0x9f75('0xa'),auth[_0x9f75('0x7')](),controller[_0x9f75('0xb')]);router[_0x9f75('0xc')]('/',auth['isAuthenticated'](),controller[_0x9f75('0xd')]);router[_0x9f75('0xe')](_0x9f75('0xa'),auth[_0x9f75('0x7')](),controller['update']);router['delete'](_0x9f75('0xa'),auth[_0x9f75('0x7')](),controller['destroy']);module[_0x9f75('0xf')]=router; \ No newline at end of file +var _0xd319=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x381dbe,_0x46dbcb){var _0x41a6a0=function(_0x588882){while(--_0x588882){_0x381dbe['push'](_0x381dbe['shift']());}};_0x41a6a0(++_0x46dbcb);}(_0xd319,0x12e));var _0x9d31=function(_0x23a3e2,_0x2fc915){_0x23a3e2=_0x23a3e2-0x0;var _0x308d2b=_0xd319[_0x23a3e2];return _0x308d2b;};'use strict';var multer=require(_0x9d31('0x0'));var util=require(_0x9d31('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9d31('0x2')]();var fs_extra=require(_0x9d31('0x3'));var auth=require(_0x9d31('0x4'));var interaction=require(_0x9d31('0x5'));var config=require(_0x9d31('0x6'));var controller=require(_0x9d31('0x7'));router['get']('/',auth[_0x9d31('0x8')](),controller[_0x9d31('0x9')]);router[_0x9d31('0xa')](_0x9d31('0xb'),auth['isAuthenticated'](),controller[_0x9d31('0xc')]);router[_0x9d31('0xd')]('/',auth[_0x9d31('0x8')](),controller[_0x9d31('0xe')]);router[_0x9d31('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9d31('0x10')]);router[_0x9d31('0x11')]('/:id',auth[_0x9d31('0x8')](),controller[_0x9d31('0x12')]);module[_0x9d31('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 12c8659..463960e 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 _0xe216=['STRING','DATE','literal','moment'];(function(_0x4286ad,_0x5a99ed){var _0x4382d3=function(_0xdc43a8){while(--_0xdc43a8){_0x4286ad['push'](_0x4286ad['shift']());}};_0x4382d3(++_0x5a99ed);}(_0xe216,0x7f));var _0x6e21=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0xe216[_0x2afbb0];return _0x411ff2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6e21('0x0'));module['exports']={'time':{'type':Sequelize[_0x6e21('0x1')]},'callid':{'type':Sequelize[_0x6e21('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6e21('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6e21('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6e21('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6e21('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6e21('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6e21('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x6e21('0x3')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x9f5e=['DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports','STRING'];(function(_0x59aca6,_0x3de044){var _0x84963a=function(_0x1eae41){while(--_0x1eae41){_0x59aca6['push'](_0x59aca6['shift']());}};_0x84963a(++_0x3de044);}(_0x9f5e,0x1b8));var _0xe9f5=function(_0x1b5ca2,_0x2718ce){_0x1b5ca2=_0x1b5ca2-0x0;var _0x240f69=_0x9f5e[_0x1b5ca2];return _0x240f69;};'use strict';var Sequelize=require(_0xe9f5('0x0'));var moment=require(_0xe9f5('0x1'));module[_0xe9f5('0x2')]={'time':{'type':Sequelize[_0xe9f5('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xe9f5('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xe9f5('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe9f5('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xe9f5('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xe9f5('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xe9f5('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xe9f5('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xe9f5('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a1f1776..c8472cd 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 _0x6f02=['stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','catch','params','keys','includeAll','include','find','create','body','update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x3ee21e,_0x5cf64c){var _0x10755a=function(_0x31d3a9){while(--_0x31d3a9){_0x3ee21e['push'](_0x3ee21e['shift']());}};_0x10755a(++_0x5cf64c);}(_0x6f02,0x1f3));var _0x26f0=function(_0x88924a,_0x1431dc){_0x88924a=_0x88924a-0x0;var _0x48acdf=_0x6f02[_0x88924a];return _0x48acdf;};'use strict';var emlformat=require(_0x26f0('0x0'));var rimraf=require(_0x26f0('0x1'));var zipdir=require(_0x26f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26f0('0x3'));var moment=require(_0x26f0('0x4'));var BPromise=require(_0x26f0('0x5'));var Mustache=require(_0x26f0('0x6'));var util=require(_0x26f0('0x7'));var path=require(_0x26f0('0x8'));var sox=require(_0x26f0('0x9'));var csv=require('to-csv');var ejs=require(_0x26f0('0xa'));var fs=require('fs');var fs_extra=require(_0x26f0('0xb'));var _=require(_0x26f0('0xc'));var squel=require('squel');var crypto=require(_0x26f0('0xd'));var jsforce=require(_0x26f0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x26f0('0xf'));var querystring=require('querystring');var Papa=require(_0x26f0('0x10'));var Redis=require(_0x26f0('0x11'));var authService=require(_0x26f0('0x12'));var qs=require(_0x26f0('0x13'));var as=require(_0x26f0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26f0('0x15'))(_0x26f0('0x16'));var utils=require('../../config/utils');var config=require(_0x26f0('0x17'));var licenseUtil=require(_0x26f0('0x18'));var db=require(_0x26f0('0x19'))['db'];function respondWithStatusCode(_0x17ab60,_0x1f2c0a){_0x1f2c0a=_0x1f2c0a||0xcc;return function(_0x900c7f){if(_0x900c7f){return _0x17ab60[_0x26f0('0x1a')](_0x1f2c0a);}return _0x17ab60[_0x26f0('0x1b')](_0x1f2c0a)[_0x26f0('0x1c')]();};}function respondWithResult(_0x446ef5,_0x5703f9){_0x5703f9=_0x5703f9||0xc8;return function(_0x2c1135){if(_0x2c1135){return _0x446ef5[_0x26f0('0x1b')](_0x5703f9)[_0x26f0('0x1d')](_0x2c1135);}};}function respondWithFilteredResult(_0x50f36d,_0x5861a9){return function(_0x1d0fbd){if(_0x1d0fbd){var _0x51d28a=typeof _0x5861a9[_0x26f0('0x1e')]===_0x26f0('0x1f')&&typeof _0x5861a9[_0x26f0('0x20')]==='undefined';var _0x697661=_0x1d0fbd[_0x26f0('0x21')];var _0x4299c9=_0x51d28a?0x0:_0x5861a9[_0x26f0('0x1e')];var _0x5e59e6=_0x51d28a?_0x1d0fbd[_0x26f0('0x21')]:_0x5861a9[_0x26f0('0x1e')]+_0x5861a9[_0x26f0('0x20')];var _0x6e4a1c;if(_0x5e59e6>=_0x697661){_0x5e59e6=_0x697661;_0x6e4a1c=0xc8;}else{_0x6e4a1c=0xce;}_0x50f36d[_0x26f0('0x1b')](_0x6e4a1c);return _0x50f36d[_0x26f0('0x22')](_0x26f0('0x23'),_0x4299c9+'-'+_0x5e59e6+'/'+_0x697661)[_0x26f0('0x1d')](_0x1d0fbd);}return null;};}function patchUpdates(_0x4783ac){return function(_0x335fbd){try{jsonpatch[_0x26f0('0x24')](_0x335fbd,_0x4783ac,!![]);}catch(_0x28fe1c){return BPromise[_0x26f0('0x25')](_0x28fe1c);}return _0x335fbd[_0x26f0('0x26')]();};}function saveUpdates(_0x998791,_0x11adbd){return function(_0x67f77f){if(_0x67f77f){return _0x67f77f['update'](_0x998791)[_0x26f0('0x27')](function(_0x2e60a6){return _0x2e60a6;});}return null;};}function removeEntity(_0x337f94,_0x1f33d7){return function(_0x17e4f2){if(_0x17e4f2){return _0x17e4f2['destroy']()['then'](function(){_0x337f94[_0x26f0('0x1b')](0xcc)[_0x26f0('0x1c')]();});}};}function handleEntityNotFound(_0x5930c3,_0x5b51fa){return function(_0x406af7){if(!_0x406af7){_0x5930c3[_0x26f0('0x1a')](0x194);}return _0x406af7;};}function handleError(_0x5f51a8,_0x187789){_0x187789=_0x187789||0x1f4;return function(_0x10e6e4){logger['error'](_0x10e6e4[_0x26f0('0x28')]);if(_0x10e6e4[_0x26f0('0x29')]){delete _0x10e6e4[_0x26f0('0x29')];}_0x5f51a8['status'](_0x187789)[_0x26f0('0x2a')](_0x10e6e4);};}exports[_0x26f0('0x2b')]=function(_0x146581,_0x4d4b48){var _0x563b04={},_0x5499e8={},_0x12894b={'count':0x0,'rows':[]};var _0x3b2537=_[_0x26f0('0x2c')](db[_0x26f0('0x2d')][_0x26f0('0x2e')],function(_0x47d53f){return{'name':_0x47d53f['fieldName'],'type':_0x47d53f[_0x26f0('0x2f')][_0x26f0('0x30')]};});_0x5499e8['model']=_[_0x26f0('0x2c')](_0x3b2537,_0x26f0('0x29'));_0x5499e8[_0x26f0('0x31')]=_['keys'](_0x146581[_0x26f0('0x31')]);_0x5499e8[_0x26f0('0x32')]=_['intersection'](_0x5499e8[_0x26f0('0x33')],_0x5499e8[_0x26f0('0x31')]);_0x563b04[_0x26f0('0x34')]=_[_0x26f0('0x35')](_0x5499e8[_0x26f0('0x33')],qs[_0x26f0('0x36')](_0x146581[_0x26f0('0x31')]['fields']));_0x563b04[_0x26f0('0x34')]=_0x563b04[_0x26f0('0x34')][_0x26f0('0x37')]?_0x563b04[_0x26f0('0x34')]:_0x5499e8[_0x26f0('0x33')];if(!_0x146581[_0x26f0('0x31')][_0x26f0('0x38')](_0x26f0('0x39'))){_0x563b04['limit']=qs[_0x26f0('0x20')](_0x146581['query']['limit']);_0x563b04[_0x26f0('0x1e')]=qs[_0x26f0('0x1e')](_0x146581[_0x26f0('0x31')][_0x26f0('0x1e')]);}_0x563b04[_0x26f0('0x3a')]=qs[_0x26f0('0x3b')](_0x146581[_0x26f0('0x31')]['sort']);_0x563b04[_0x26f0('0x3c')]=qs['filters'](_[_0x26f0('0x3d')](_0x146581[_0x26f0('0x31')],_0x5499e8[_0x26f0('0x32')]),_0x3b2537);if(_0x146581[_0x26f0('0x31')]['filter']){_0x563b04[_0x26f0('0x3c')]=_[_0x26f0('0x3e')](_0x563b04[_0x26f0('0x3c')],{'$or':_[_0x26f0('0x2c')](_0x3b2537,function(_0x30c9dc){if(_0x30c9dc[_0x26f0('0x2f')]!==_0x26f0('0x3f')){var _0x5204b7={};_0x5204b7[_0x30c9dc['name']]={'$like':'%'+_0x146581[_0x26f0('0x31')][_0x26f0('0x40')]+'%'};return _0x5204b7;}})});}_0x563b04=_[_0x26f0('0x3e')]({},_0x563b04,_0x146581[_0x26f0('0x41')]);var _0x4d8386={'where':_0x563b04[_0x26f0('0x3c')]};return db['VoiceQueuesLog'][_0x26f0('0x21')](_0x4d8386)[_0x26f0('0x27')](function(_0x36c55d){_0x12894b['count']=_0x36c55d;if(_0x146581[_0x26f0('0x31')]['includeAll']){_0x563b04['include']=[{'all':!![]}];}return db[_0x26f0('0x2d')][_0x26f0('0x42')](_0x563b04);})[_0x26f0('0x27')](function(_0x21d210){_0x12894b['rows']=_0x21d210;return _0x12894b;})[_0x26f0('0x27')](respondWithFilteredResult(_0x4d4b48,_0x563b04))[_0x26f0('0x43')](handleError(_0x4d4b48,null));};exports['show']=function(_0x4c5de5,_0x16947d){var _0x14c58d={'raw':!![],'where':{'id':_0x4c5de5[_0x26f0('0x44')]['id']}},_0x3b5679={};_0x3b5679[_0x26f0('0x33')]=_['keys'](db[_0x26f0('0x2d')][_0x26f0('0x2e')]);_0x3b5679[_0x26f0('0x31')]=_[_0x26f0('0x45')](_0x4c5de5[_0x26f0('0x31')]);_0x3b5679[_0x26f0('0x32')]=_[_0x26f0('0x35')](_0x3b5679[_0x26f0('0x33')],_0x3b5679[_0x26f0('0x31')]);_0x14c58d[_0x26f0('0x34')]=_[_0x26f0('0x35')](_0x3b5679[_0x26f0('0x33')],qs[_0x26f0('0x36')](_0x4c5de5['query'][_0x26f0('0x36')]));_0x14c58d['attributes']=_0x14c58d[_0x26f0('0x34')][_0x26f0('0x37')]?_0x14c58d[_0x26f0('0x34')]:_0x3b5679[_0x26f0('0x33')];if(_0x4c5de5[_0x26f0('0x31')][_0x26f0('0x46')]){_0x14c58d[_0x26f0('0x47')]=[{'all':!![]}];}_0x14c58d=_[_0x26f0('0x3e')]({},_0x14c58d,_0x4c5de5[_0x26f0('0x41')]);return db[_0x26f0('0x2d')][_0x26f0('0x48')](_0x14c58d)[_0x26f0('0x27')](handleEntityNotFound(_0x16947d,null))[_0x26f0('0x27')](respondWithResult(_0x16947d,null))['catch'](handleError(_0x16947d,null));};exports[_0x26f0('0x49')]=function(_0x5c53ee,_0x26211b){return db[_0x26f0('0x2d')][_0x26f0('0x49')](_0x5c53ee[_0x26f0('0x4a')],{})['then'](respondWithResult(_0x26211b,0xc9))['catch'](handleError(_0x26211b,null));};exports[_0x26f0('0x4b')]=function(_0x5eeebf,_0x5619ac){if(_0x5eeebf[_0x26f0('0x4a')]['id']){delete _0x5eeebf['body']['id'];}return db['VoiceQueuesLog'][_0x26f0('0x48')]({'where':{'id':_0x5eeebf[_0x26f0('0x44')]['id']}})[_0x26f0('0x27')](handleEntityNotFound(_0x5619ac,null))[_0x26f0('0x27')](saveUpdates(_0x5eeebf[_0x26f0('0x4a')],null))[_0x26f0('0x27')](respondWithResult(_0x5619ac,null))['catch'](handleError(_0x5619ac,null));};exports[_0x26f0('0x4c')]=function(_0x17efbe,_0x1e014d){return db[_0x26f0('0x2d')][_0x26f0('0x48')]({'where':{'id':_0x17efbe[_0x26f0('0x44')]['id']}})[_0x26f0('0x27')](handleEntityNotFound(_0x1e014d,null))[_0x26f0('0x27')](removeEntity(_0x1e014d,null))[_0x26f0('0x43')](handleError(_0x1e014d,null));}; \ No newline at end of file +var _0x12e4=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','VoiceQueuesLog','includeAll','findAll','catch','show','params','rawAttributes','include','options','find','create','body','eml-format','zip-dir'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12e4,0x11a));var _0x412e=function(_0x59f005,_0x3b2764){_0x59f005=_0x59f005-0x0;var _0x1becc2=_0x12e4[_0x59f005];return _0x1becc2;};'use strict';var emlformat=require(_0x412e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x412e('0x1'));var jsonpatch=require(_0x412e('0x2'));var rp=require(_0x412e('0x3'));var moment=require(_0x412e('0x4'));var BPromise=require(_0x412e('0x5'));var Mustache=require(_0x412e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x412e('0x7'));var csv=require(_0x412e('0x8'));var ejs=require(_0x412e('0x9'));var fs=require('fs');var fs_extra=require(_0x412e('0xa'));var _=require(_0x412e('0xb'));var squel=require(_0x412e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x412e('0xd'));var toCsv=require(_0x412e('0x8'));var querystring=require(_0x412e('0xe'));var Papa=require(_0x412e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x412e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x412e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x412e('0x12'));var config=require(_0x412e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x412e('0x14'))['db'];function respondWithStatusCode(_0x21279a,_0x3e98f5){_0x3e98f5=_0x3e98f5||0xcc;return function(_0x2a30b0){if(_0x2a30b0){return _0x21279a[_0x412e('0x15')](_0x3e98f5);}return _0x21279a[_0x412e('0x16')](_0x3e98f5)[_0x412e('0x17')]();};}function respondWithResult(_0x4dc903,_0xd24fab){_0xd24fab=_0xd24fab||0xc8;return function(_0x5db1fc){if(_0x5db1fc){return _0x4dc903['status'](_0xd24fab)[_0x412e('0x18')](_0x5db1fc);}};}function respondWithFilteredResult(_0x4377fb,_0x3c3ef9){return function(_0x39b18b){if(_0x39b18b){var _0x5d3e4d=typeof _0x3c3ef9[_0x412e('0x19')]===_0x412e('0x1a')&&typeof _0x3c3ef9[_0x412e('0x1b')]===_0x412e('0x1a');var _0x42ccf6=_0x39b18b[_0x412e('0x1c')];var _0x5f0b98=_0x5d3e4d?0x0:_0x3c3ef9[_0x412e('0x19')];var _0x8e3f3c=_0x5d3e4d?_0x39b18b[_0x412e('0x1c')]:_0x3c3ef9[_0x412e('0x19')]+_0x3c3ef9[_0x412e('0x1b')];var _0x28aa00;if(_0x8e3f3c>=_0x42ccf6){_0x8e3f3c=_0x42ccf6;_0x28aa00=0xc8;}else{_0x28aa00=0xce;}_0x4377fb[_0x412e('0x16')](_0x28aa00);return _0x4377fb['set'](_0x412e('0x1d'),_0x5f0b98+'-'+_0x8e3f3c+'/'+_0x42ccf6)[_0x412e('0x18')](_0x39b18b);}return null;};}function patchUpdates(_0x505429){return function(_0x306395){try{jsonpatch['apply'](_0x306395,_0x505429,!![]);}catch(_0x550e40){return BPromise['reject'](_0x550e40);}return _0x306395['save']();};}function saveUpdates(_0xa6a266,_0x1b47dc){return function(_0x3bbb29){if(_0x3bbb29){return _0x3bbb29[_0x412e('0x1e')](_0xa6a266)[_0x412e('0x1f')](function(_0x5f20bf){return _0x5f20bf;});}return null;};}function removeEntity(_0x960c30,_0x4dc588){return function(_0x47fb91){if(_0x47fb91){return _0x47fb91[_0x412e('0x20')]()[_0x412e('0x1f')](function(){_0x960c30[_0x412e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba1308,_0xc0e89f){return function(_0x5d233f){if(!_0x5d233f){_0xba1308[_0x412e('0x15')](0x194);}return _0x5d233f;};}function handleError(_0x40e0b3,_0x57c5f9){_0x57c5f9=_0x57c5f9||0x1f4;return function(_0x4e12de){logger[_0x412e('0x21')](_0x4e12de[_0x412e('0x22')]);if(_0x4e12de[_0x412e('0x23')]){delete _0x4e12de[_0x412e('0x23')];}_0x40e0b3[_0x412e('0x16')](_0x57c5f9)[_0x412e('0x24')](_0x4e12de);};}exports[_0x412e('0x25')]=function(_0x17083d,_0x14d7a9){var _0x3ef559={},_0x27e358={},_0x16b2a1={'count':0x0,'rows':[]};var _0x5dd351=_[_0x412e('0x26')](db['VoiceQueuesLog']['rawAttributes'],function(_0x3949c2){return{'name':_0x3949c2[_0x412e('0x27')],'type':_0x3949c2['type'][_0x412e('0x28')]};});_0x27e358['model']=_[_0x412e('0x26')](_0x5dd351,_0x412e('0x23'));_0x27e358[_0x412e('0x29')]=_[_0x412e('0x2a')](_0x17083d[_0x412e('0x29')]);_0x27e358['filters']=_[_0x412e('0x2b')](_0x27e358[_0x412e('0x2c')],_0x27e358[_0x412e('0x29')]);_0x3ef559[_0x412e('0x2d')]=_['intersection'](_0x27e358[_0x412e('0x2c')],qs[_0x412e('0x2e')](_0x17083d[_0x412e('0x29')][_0x412e('0x2e')]));_0x3ef559[_0x412e('0x2d')]=_0x3ef559[_0x412e('0x2d')][_0x412e('0x2f')]?_0x3ef559[_0x412e('0x2d')]:_0x27e358['model'];if(!_0x17083d['query'][_0x412e('0x30')](_0x412e('0x31'))){_0x3ef559['limit']=qs[_0x412e('0x1b')](_0x17083d[_0x412e('0x29')]['limit']);_0x3ef559[_0x412e('0x19')]=qs[_0x412e('0x19')](_0x17083d['query'][_0x412e('0x19')]);}_0x3ef559[_0x412e('0x32')]=qs[_0x412e('0x33')](_0x17083d[_0x412e('0x29')][_0x412e('0x33')]);_0x3ef559[_0x412e('0x34')]=qs[_0x412e('0x35')](_[_0x412e('0x36')](_0x17083d[_0x412e('0x29')],_0x27e358[_0x412e('0x35')]),_0x5dd351);if(_0x17083d[_0x412e('0x29')]['filter']){_0x3ef559[_0x412e('0x34')]=_['merge'](_0x3ef559[_0x412e('0x34')],{'$or':_[_0x412e('0x26')](_0x5dd351,function(_0x18a8a9){if(_0x18a8a9[_0x412e('0x37')]!==_0x412e('0x38')){var _0x559605={};_0x559605[_0x18a8a9[_0x412e('0x23')]]={'$like':'%'+_0x17083d[_0x412e('0x29')][_0x412e('0x39')]+'%'};return _0x559605;}})});}_0x3ef559=_[_0x412e('0x3a')]({},_0x3ef559,_0x17083d['options']);var _0x194435={'where':_0x3ef559[_0x412e('0x34')]};return db[_0x412e('0x3b')]['count'](_0x194435)['then'](function(_0x51bd71){_0x16b2a1[_0x412e('0x1c')]=_0x51bd71;if(_0x17083d[_0x412e('0x29')][_0x412e('0x3c')]){_0x3ef559['include']=[{'all':!![]}];}return db[_0x412e('0x3b')][_0x412e('0x3d')](_0x3ef559);})[_0x412e('0x1f')](function(_0x3cc40d){_0x16b2a1['rows']=_0x3cc40d;return _0x16b2a1;})[_0x412e('0x1f')](respondWithFilteredResult(_0x14d7a9,_0x3ef559))[_0x412e('0x3e')](handleError(_0x14d7a9,null));};exports[_0x412e('0x3f')]=function(_0x5fd8c4,_0x5a83e1){var _0x44046d={'raw':!![],'where':{'id':_0x5fd8c4[_0x412e('0x40')]['id']}},_0x547eea={};_0x547eea[_0x412e('0x2c')]=_['keys'](db['VoiceQueuesLog'][_0x412e('0x41')]);_0x547eea[_0x412e('0x29')]=_[_0x412e('0x2a')](_0x5fd8c4[_0x412e('0x29')]);_0x547eea[_0x412e('0x35')]=_[_0x412e('0x2b')](_0x547eea['model'],_0x547eea[_0x412e('0x29')]);_0x44046d[_0x412e('0x2d')]=_[_0x412e('0x2b')](_0x547eea['model'],qs[_0x412e('0x2e')](_0x5fd8c4['query'][_0x412e('0x2e')]));_0x44046d[_0x412e('0x2d')]=_0x44046d[_0x412e('0x2d')]['length']?_0x44046d[_0x412e('0x2d')]:_0x547eea[_0x412e('0x2c')];if(_0x5fd8c4[_0x412e('0x29')][_0x412e('0x3c')]){_0x44046d[_0x412e('0x42')]=[{'all':!![]}];}_0x44046d=_[_0x412e('0x3a')]({},_0x44046d,_0x5fd8c4[_0x412e('0x43')]);return db['VoiceQueuesLog'][_0x412e('0x44')](_0x44046d)[_0x412e('0x1f')](handleEntityNotFound(_0x5a83e1,null))[_0x412e('0x1f')](respondWithResult(_0x5a83e1,null))[_0x412e('0x3e')](handleError(_0x5a83e1,null));};exports[_0x412e('0x45')]=function(_0x101b3c,_0x27f1f3){return db[_0x412e('0x3b')][_0x412e('0x45')](_0x101b3c[_0x412e('0x46')],{})[_0x412e('0x1f')](respondWithResult(_0x27f1f3,0xc9))[_0x412e('0x3e')](handleError(_0x27f1f3,null));};exports[_0x412e('0x1e')]=function(_0x557ba6,_0x540b87){if(_0x557ba6['body']['id']){delete _0x557ba6['body']['id'];}return db[_0x412e('0x3b')][_0x412e('0x44')]({'where':{'id':_0x557ba6[_0x412e('0x40')]['id']}})[_0x412e('0x1f')](handleEntityNotFound(_0x540b87,null))[_0x412e('0x1f')](saveUpdates(_0x557ba6[_0x412e('0x46')],null))[_0x412e('0x1f')](respondWithResult(_0x540b87,null))['catch'](handleError(_0x540b87,null));};exports['destroy']=function(_0x14d131,_0x509143){return db[_0x412e('0x3b')][_0x412e('0x44')]({'where':{'id':_0x14d131[_0x412e('0x40')]['id']}})[_0x412e('0x1f')](handleEntityNotFound(_0x509143,null))[_0x412e('0x1f')](removeEntity(_0x509143,null))['catch'](handleError(_0x509143,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index cda275e..3037320 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 _0xc404=['event_dtm','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log'];(function(_0x520e79,_0x503a3f){var _0x249fda=function(_0x462767){while(--_0x462767){_0x520e79['push'](_0x520e79['shift']());}};_0x249fda(++_0x503a3f);}(_0xc404,0xe2));var _0x4c40=function(_0x38ea83,_0x1b1fe6){_0x38ea83=_0x38ea83-0x0;var _0x90a5e=_0xc404[_0x38ea83];return _0x90a5e;};'use strict';var _=require(_0x4c40('0x0'));var util=require(_0x4c40('0x1'));var logger=require(_0x4c40('0x2'))('api');var moment=require(_0x4c40('0x3'));var BPromise=require(_0x4c40('0x4'));var rp=require(_0x4c40('0x5'));var fs=require('fs');var path=require(_0x4c40('0x6'));var rimraf=require(_0x4c40('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c40('0x8'));module[_0x4c40('0x9')]=function(_0x5c52cc,_0x1d05ae){return _0x5c52cc['define'](_0x4c40('0xa'),attributes,{'tableName':_0x4c40('0xb'),'paranoid':![],'indexes':[{'name':_0x4c40('0xc'),'fields':['event',_0x4c40('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2828=['request-promise','rimraf','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event','dtm','util','../../config/logger','api','moment','bluebird'];(function(_0x5d00ae,_0x330a15){var _0x58f6b9=function(_0x15baf9){while(--_0x15baf9){_0x5d00ae['push'](_0x5d00ae['shift']());}};_0x58f6b9(++_0x330a15);}(_0x2828,0x1dc));var _0x8282=function(_0x23dc29,_0x4127b3){_0x23dc29=_0x23dc29-0x0;var _0x5a79bb=_0x2828[_0x23dc29];return _0x5a79bb;};'use strict';var _=require('lodash');var util=require(_0x8282('0x0'));var logger=require(_0x8282('0x1'))(_0x8282('0x2'));var moment=require(_0x8282('0x3'));var BPromise=require(_0x8282('0x4'));var rp=require(_0x8282('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8282('0x6'));var config=require('../../config/environment');var attributes=require(_0x8282('0x7'));module['exports']=function(_0x2003b8,_0x214502){return _0x2003b8[_0x8282('0x8')](_0x8282('0x9'),attributes,{'tableName':_0x8282('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x8282('0xb'),_0x8282('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index fbd4375..f1fb375 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 _0x90db=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x90db,0x1c0));var _0xb90d=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x90db[_0x487b0c];return _0x1adbdc;};'use strict';var _=require('lodash');var util=require(_0xb90d('0x0'));var moment=require(_0xb90d('0x1'));var BPromise=require(_0xb90d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb90d('0x3'));var config=require(_0xb90d('0x4'));var jayson=require(_0xb90d('0x5'));var client=jayson[_0xb90d('0x6')][_0xb90d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d8398,_0x180781,_0x126e17){return new BPromise(function(_0x2ef5e6,_0x108b88){return client[_0xb90d('0x8')](_0x2d8398,_0x126e17)[_0xb90d('0x9')](function(_0x48c4f6){logger[_0xb90d('0xa')](_0xb90d('0xb'),_0x180781,_0xb90d('0xc'));logger['debug'](_0xb90d('0xd'),_0x180781,_0xb90d('0xc'),JSON[_0xb90d('0xe')](_0x48c4f6));if(_0x48c4f6[_0xb90d('0xf')]){if(_0x48c4f6[_0xb90d('0xf')]['code']===0x1f4){logger[_0xb90d('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x180781,_0x48c4f6[_0xb90d('0xf')][_0xb90d('0x10')]);return _0x108b88(_0x48c4f6[_0xb90d('0xf')][_0xb90d('0x10')]);}logger[_0xb90d('0xf')](_0xb90d('0xb'),_0x180781,_0x48c4f6[_0xb90d('0xf')]['message']);return _0x2ef5e6(_0x48c4f6[_0xb90d('0xf')]['message']);}else{logger[_0xb90d('0xa')](_0xb90d('0xb'),_0x180781,'request\x20sent');_0x2ef5e6(_0x48c4f6[_0xb90d('0x11')]['message']);}})[_0xb90d('0x12')](function(_0x396f3f){logger[_0xb90d('0xf')](_0xb90d('0xb'),_0x180781,_0x396f3f);_0x108b88(_0x396f3f);});});} \ No newline at end of file +var _0x95b9=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x42e5ea,_0x350f7a){var _0x2f4864=function(_0x5d418a){while(--_0x5d418a){_0x42e5ea['push'](_0x42e5ea['shift']());}};_0x2f4864(++_0x350f7a);}(_0x95b9,0x10c));var _0x995b=function(_0x2dfb46,_0x2de4bc){_0x2dfb46=_0x2dfb46-0x0;var _0x5c18e0=_0x95b9[_0x2dfb46];return _0x5c18e0;};'use strict';var _=require(_0x995b('0x0'));var util=require(_0x995b('0x1'));var moment=require('moment');var BPromise=require(_0x995b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x995b('0x3'));var db=require(_0x995b('0x4'))['db'];var utils=require(_0x995b('0x5'));var logger=require(_0x995b('0x6'))(_0x995b('0x7'));var config=require('../../config/environment');var jayson=require(_0x995b('0x8'));var client=jayson[_0x995b('0x9')][_0x995b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288eab,_0x3bdc1a,_0x416c0c){return new BPromise(function(_0x240a63,_0x409d1d){return client[_0x995b('0xb')](_0x288eab,_0x416c0c)[_0x995b('0xc')](function(_0x6893b0){logger[_0x995b('0xd')](_0x995b('0xe'),_0x3bdc1a,_0x995b('0xf'));logger['debug'](_0x995b('0x10'),_0x3bdc1a,_0x995b('0xf'),JSON[_0x995b('0x11')](_0x6893b0));if(_0x6893b0[_0x995b('0x12')]){if(_0x6893b0[_0x995b('0x12')]['code']===0x1f4){logger[_0x995b('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3bdc1a,_0x6893b0[_0x995b('0x12')][_0x995b('0x13')]);return _0x409d1d(_0x6893b0[_0x995b('0x12')][_0x995b('0x13')]);}logger[_0x995b('0x12')](_0x995b('0xe'),_0x3bdc1a,_0x6893b0[_0x995b('0x12')][_0x995b('0x13')]);return _0x240a63(_0x6893b0[_0x995b('0x12')][_0x995b('0x13')]);}else{logger['info'](_0x995b('0xe'),_0x3bdc1a,'request\x20sent');_0x240a63(_0x6893b0[_0x995b('0x14')][_0x995b('0x13')]);}})['catch'](function(_0x5a5e70){logger[_0x995b('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3bdc1a,_0x5a5e70);_0x409d1d(_0x5a5e70);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 80187a3..a38a7b2 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 _0x4f3c=['/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get'];(function(_0x546db7,_0x59d31a){var _0x3f5c5f=function(_0x1d6976){while(--_0x1d6976){_0x546db7['push'](_0x546db7['shift']());}};_0x3f5c5f(++_0x59d31a);}(_0x4f3c,0x11f));var _0xc4f3=function(_0x2cbd58,_0x278e75){_0x2cbd58=_0x2cbd58-0x0;var _0x42ef2a=_0x4f3c[_0x2cbd58];return _0x42ef2a;};'use strict';var multer=require('multer');var util=require(_0xc4f3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc4f3('0x1')]();var fs_extra=require(_0xc4f3('0x2'));var auth=require(_0xc4f3('0x3'));var interaction=require(_0xc4f3('0x4'));var config=require(_0xc4f3('0x5'));var controller=require(_0xc4f3('0x6'));router['get']('/',auth[_0xc4f3('0x7')](),controller[_0xc4f3('0x8')]);router[_0xc4f3('0x9')](_0xc4f3('0xa'),auth[_0xc4f3('0x7')](),controller[_0xc4f3('0xb')]);router['get'](_0xc4f3('0xc'),auth[_0xc4f3('0x7')](),controller[_0xc4f3('0xd')]);router[_0xc4f3('0x9')](_0xc4f3('0xe'),auth[_0xc4f3('0x7')](),controller[_0xc4f3('0xf')]);router['get'](_0xc4f3('0x10'),controller[_0xc4f3('0x11')]);router[_0xc4f3('0x9')](_0xc4f3('0x12'),auth[_0xc4f3('0x7')](),controller[_0xc4f3('0x13')]);router[_0xc4f3('0x14')]('/',auth['isAuthenticated'](),controller[_0xc4f3('0x15')]);router['post'](_0xc4f3('0x12'),auth[_0xc4f3('0x7')](),controller[_0xc4f3('0x16')]);router[_0xc4f3('0x17')]('/:id',auth[_0xc4f3('0x7')](),controller[_0xc4f3('0x18')]);router[_0xc4f3('0x19')](_0xc4f3('0xc'),auth[_0xc4f3('0x7')](),controller[_0xc4f3('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x1560=['downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','download','/:id/downloads'];(function(_0x361c38,_0x2e0fd3){var _0x1f3947=function(_0x3f841d){while(--_0x3f841d){_0x361c38['push'](_0x361c38['shift']());}};_0x1f3947(++_0x2e0fd3);}(_0x1560,0xd1));var _0x0156=function(_0x1c8cab,_0x1e8d13){_0x1c8cab=_0x1c8cab-0x0;var _0x2b812f=_0x1560[_0x1c8cab];return _0x2b812f;};'use strict';var multer=require(_0x0156('0x0'));var util=require(_0x0156('0x1'));var path=require(_0x0156('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0156('0x3')]();var fs_extra=require(_0x0156('0x4'));var auth=require(_0x0156('0x5'));var interaction=require(_0x0156('0x6'));var config=require('../../config/environment');var controller=require(_0x0156('0x7'));router['get']('/',auth[_0x0156('0x8')](),controller['index']);router[_0x0156('0x9')](_0x0156('0xa'),auth[_0x0156('0x8')](),controller['describe']);router['get'](_0x0156('0xb'),auth[_0x0156('0x8')](),controller[_0x0156('0xc')]);router[_0x0156('0x9')](_0x0156('0xd'),auth[_0x0156('0x8')](),controller[_0x0156('0xe')]);router[_0x0156('0x9')](_0x0156('0xf'),controller[_0x0156('0x10')]);router[_0x0156('0x9')](_0x0156('0x11'),auth[_0x0156('0x8')](),controller[_0x0156('0x12')]);router[_0x0156('0x13')]('/',auth[_0x0156('0x8')](),controller['create']);router['post'](_0x0156('0x11'),auth[_0x0156('0x8')](),controller[_0x0156('0x14')]);router[_0x0156('0x15')](_0x0156('0xb'),auth[_0x0156('0x8')](),controller[_0x0156('0x16')]);router[_0x0156('0x17')]('/:id',auth[_0x0156('0x8')](),controller['destroy']);module[_0x0156('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 029975b..e4635c4 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(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 63c7df1..a39153a 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 _0x052d=['show','params','keys','rawAttributes','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','../../components/encryptor','sequelize','token','$and','push','secrets','recording','Sequelize','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','listBuckets','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','index','map','VoiceRecording','fieldName','type','key','differenceBy','format','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x4d02c7,_0x554d40){var _0x2ffff6=function(_0x5bd870){while(--_0x5bd870){_0x4d02c7['push'](_0x4d02c7['shift']());}};_0x2ffff6(++_0x554d40);}(_0x052d,0xe3));var _0xd052=function(_0x7a8884,_0x3bf33c){_0x7a8884=_0x7a8884-0x0;var _0xe75372=_0x052d[_0x7a8884];return _0xe75372;};'use strict';var emlformat=require(_0xd052('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd052('0x1'));var jsonpatch=require(_0xd052('0x2'));var rp=require(_0xd052('0x3'));var moment=require(_0xd052('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd052('0x5'));var util=require(_0xd052('0x6'));var path=require(_0xd052('0x7'));var sox=require('sox');var csv=require(_0xd052('0x8'));var ejs=require(_0xd052('0x9'));var fs=require('fs');var fs_extra=require(_0xd052('0xa'));var _=require(_0xd052('0xb'));var squel=require('squel');var crypto=require(_0xd052('0xc'));var jsforce=require(_0xd052('0xd'));var deskjs=require(_0xd052('0xe'));var toCsv=require(_0xd052('0x8'));var querystring=require('querystring');var Papa=require(_0xd052('0xf'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0xd052('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd052('0x11'));var utils=require('../../config/utils');var config=require(_0xd052('0x12'));var licenseUtil=require(_0xd052('0x13'));var db=require(_0xd052('0x14'))['db'];function respondWithStatusCode(_0x5c7886,_0x57c5e4){_0x57c5e4=_0x57c5e4||0xcc;return function(_0xb4be6e){if(_0xb4be6e){return _0x5c7886[_0xd052('0x15')](_0x57c5e4);}return _0x5c7886[_0xd052('0x16')](_0x57c5e4)[_0xd052('0x17')]();};}function respondWithResult(_0xf27d1b,_0x1f1d1e){_0x1f1d1e=_0x1f1d1e||0xc8;return function(_0x5c87ed){if(_0x5c87ed){return _0xf27d1b[_0xd052('0x16')](_0x1f1d1e)[_0xd052('0x18')](_0x5c87ed);}};}function respondWithFilteredResult(_0x312144,_0xa42e45){return function(_0x544818){if(_0x544818){var _0x498c58=typeof _0xa42e45[_0xd052('0x19')]===_0xd052('0x1a')&&typeof _0xa42e45['limit']==='undefined';var _0x4362b9=_0x544818[_0xd052('0x1b')];var _0x514213=_0x498c58?0x0:_0xa42e45['offset'];var _0x17a3a9=_0x498c58?_0x544818[_0xd052('0x1b')]:_0xa42e45[_0xd052('0x19')]+_0xa42e45[_0xd052('0x1c')];var _0x18da36;if(_0x17a3a9>=_0x4362b9){_0x17a3a9=_0x4362b9;_0x18da36=0xc8;}else{_0x18da36=0xce;}_0x312144[_0xd052('0x16')](_0x18da36);return _0x312144[_0xd052('0x1d')](_0xd052('0x1e'),_0x514213+'-'+_0x17a3a9+'/'+_0x4362b9)['json'](_0x544818);}return null;};}function patchUpdates(_0x32c963){return function(_0x2681e3){try{jsonpatch['apply'](_0x2681e3,_0x32c963,!![]);}catch(_0x2fcd7e){return BPromise[_0xd052('0x1f')](_0x2fcd7e);}return _0x2681e3['save']();};}function saveUpdates(_0x2e5596,_0x53a4bb){return function(_0x7bb170){if(_0x7bb170){return _0x7bb170[_0xd052('0x20')](_0x2e5596)[_0xd052('0x21')](function(_0x20426c){return _0x20426c;});}return null;};}function removeEntity(_0x8f0ea5,_0x1e7ff4){return function(_0x3a9765){if(_0x3a9765){return _0x3a9765[_0xd052('0x22')]()[_0xd052('0x21')](function(){_0x8f0ea5[_0xd052('0x16')](0xcc)[_0xd052('0x17')]();});}};}function handleEntityNotFound(_0x2d825e,_0x361789){return function(_0x52b31c){if(!_0x52b31c){_0x2d825e[_0xd052('0x15')](0x194);}return _0x52b31c;};}function handleError(_0x1b36b1,_0x4ee70a){_0x4ee70a=_0x4ee70a||0x1f4;return function(_0x12f55d){logger['error'](_0x12f55d[_0xd052('0x23')]);if(_0x12f55d[_0xd052('0x24')]){delete _0x12f55d['name'];}_0x1b36b1[_0xd052('0x16')](_0x4ee70a)[_0xd052('0x25')](_0x12f55d);};}exports[_0xd052('0x26')]=function(_0x2d4b6f,_0xd0f2b4){var _0x242567={},_0x4f0a39={},_0x4a95c8={'count':0x0,'rows':[]};var _0x530a67=_[_0xd052('0x27')](db[_0xd052('0x28')]['rawAttributes'],function(_0x5649fe){return{'name':_0x5649fe[_0xd052('0x29')],'type':_0x5649fe[_0xd052('0x2a')][_0xd052('0x2b')]};});_0x4f0a39['model']=_[_0xd052('0x2c')](_[_0xd052('0x27')](_0x530a67,_0xd052('0x24')),[_0xd052('0x2d')]);_0x4f0a39[_0xd052('0x2e')]=_['keys'](_0x2d4b6f['query']);_0x4f0a39[_0xd052('0x2f')]=_[_0xd052('0x30')](_0x4f0a39[_0xd052('0x31')],_0x4f0a39[_0xd052('0x2e')]);_0x242567[_0xd052('0x32')]=_[_0xd052('0x30')](_0x4f0a39[_0xd052('0x31')],qs['fields'](_0x2d4b6f[_0xd052('0x2e')][_0xd052('0x33')]));_0x242567['attributes']=_0x242567['attributes'][_0xd052('0x34')]?_0x242567[_0xd052('0x32')]:_0x4f0a39[_0xd052('0x31')];if(!_0x2d4b6f[_0xd052('0x2e')][_0xd052('0x35')](_0xd052('0x36'))){_0x242567[_0xd052('0x1c')]=qs[_0xd052('0x1c')](_0x2d4b6f[_0xd052('0x2e')][_0xd052('0x1c')]);_0x242567[_0xd052('0x19')]=qs[_0xd052('0x19')](_0x2d4b6f[_0xd052('0x2e')]['offset']);}_0x242567[_0xd052('0x37')]=qs[_0xd052('0x38')](_0x2d4b6f['query']['sort']);_0x242567['where']=qs[_0xd052('0x2f')](_['pick'](_0x2d4b6f[_0xd052('0x2e')],_0x4f0a39[_0xd052('0x2f')]),_0x530a67);if(_0x2d4b6f[_0xd052('0x2e')][_0xd052('0x39')]){_0x242567[_0xd052('0x3a')]=_[_0xd052('0x3b')](_0x242567[_0xd052('0x3a')],{'$or':_['map'](_0x530a67,function(_0x1f6bee){if(_0x1f6bee[_0xd052('0x2a')]!==_0xd052('0x3c')){var _0x12c8bc={};_0x12c8bc[_0x1f6bee[_0xd052('0x24')]]={'$like':'%'+_0x2d4b6f['query'][_0xd052('0x39')]+'%'};return _0x12c8bc;}})});}_0x242567=_[_0xd052('0x3b')]({},_0x242567,_0x2d4b6f[_0xd052('0x3d')]);var _0x58ada6={'where':_0x242567[_0xd052('0x3a')]};return db[_0xd052('0x28')][_0xd052('0x1b')](_0x58ada6)['then'](function(_0xca1fb3){_0x4a95c8[_0xd052('0x1b')]=_0xca1fb3;if(_0x2d4b6f[_0xd052('0x2e')][_0xd052('0x3e')]){_0x242567[_0xd052('0x3f')]=[{'all':!![]}];}return db['VoiceRecording'][_0xd052('0x40')](_0x242567);})[_0xd052('0x21')](function(_0x29dcd1){_0x4a95c8[_0xd052('0x41')]=_0x29dcd1;return _0x4a95c8;})[_0xd052('0x21')](respondWithFilteredResult(_0xd0f2b4,_0x242567))[_0xd052('0x42')](handleError(_0xd0f2b4,null));};exports[_0xd052('0x43')]=function(_0x11fd65,_0x32f5f1){var _0x23a387={'raw':![],'where':{'id':_0x11fd65[_0xd052('0x44')]['id']}},_0x2993da={};_0x2993da[_0xd052('0x31')]=_[_0xd052('0x45')](db['VoiceRecording'][_0xd052('0x46')]);_0x2993da[_0xd052('0x2e')]=_[_0xd052('0x45')](_0x11fd65[_0xd052('0x2e')]);_0x2993da[_0xd052('0x2f')]=_['intersection'](_0x2993da[_0xd052('0x31')],_0x2993da[_0xd052('0x2e')]);_0x23a387['attributes']=_['intersection'](_0x2993da['model'],qs['fields'](_0x11fd65['query'][_0xd052('0x33')]));_0x23a387[_0xd052('0x32')]=_0x23a387['attributes'][_0xd052('0x34')]?_0x23a387[_0xd052('0x32')]:_0x2993da[_0xd052('0x31')];if(_0x11fd65[_0xd052('0x2e')][_0xd052('0x3e')]){_0x23a387[_0xd052('0x3f')]=[{'all':!![]}];}_0x23a387=_['merge']({},_0x23a387,_0x11fd65[_0xd052('0x3d')]);return db['VoiceRecording'][_0xd052('0x47')](_0x23a387)[_0xd052('0x21')](handleEntityNotFound(_0x32f5f1,null))[_0xd052('0x21')](respondWithResult(_0x32f5f1,null))[_0xd052('0x42')](handleError(_0x32f5f1,null));};exports[_0xd052('0x48')]=function(_0x1a780c,_0x597acf){return db['VoiceRecording']['create'](_0x1a780c['body'],{})['then'](respondWithResult(_0x597acf,0xc9))['catch'](handleError(_0x597acf,null));};exports[_0xd052('0x20')]=function(_0x3c6c25,_0xc9de98){if(_0x3c6c25[_0xd052('0x49')]['id']){delete _0x3c6c25[_0xd052('0x49')]['id'];}return db[_0xd052('0x28')][_0xd052('0x47')]({'where':{'id':_0x3c6c25[_0xd052('0x44')]['id']}})[_0xd052('0x21')](handleEntityNotFound(_0xc9de98,null))[_0xd052('0x21')](saveUpdates(_0x3c6c25[_0xd052('0x49')],null))['then'](respondWithResult(_0xc9de98,null))[_0xd052('0x42')](handleError(_0xc9de98,null));};exports['describe']=function(_0x4c969d,_0x3355c8){return db[_0xd052('0x28')][_0xd052('0x4a')]()[_0xd052('0x21')](respondWithResult(_0x3355c8,null))[_0xd052('0x42')](handleError(_0x3355c8,null));};exports[_0xd052('0x4b')]=function(_0x1b569c,_0x11ede8,_0x18e40a){var _0x2b14ea=require('../../components/encryptor');var _0x4e3b88=![];var _0xb02b8d={};if(_0x1b569c[_0xd052('0x2e')][_0xd052('0x2a')]&&_0x1b569c[_0xd052('0x2e')]['type']===_0xd052('0x4c')){_0xb02b8d['uniqueid']=_0x1b569c[_0xd052('0x44')]['id'];}else{_0xb02b8d['id']=_0x1b569c['params']['id'];}return db['VoiceRecording'][_0xd052('0x47')]({'where':_0xb02b8d,'attributes':['id',_0xd052('0x4d')],'raw':!![]})[_0xd052('0x21')](handleEntityNotFound(_0x11ede8,null))[_0xd052('0x21')](function(_0x566f41){if(_0x566f41){var _0x58be39=_0x566f41[_0xd052('0x4d')];var _0x269816=util[_0xd052('0x2d')](_0xd052('0x4e'),_0x58be39);if(fs[_0xd052('0x4f')](_0x269816)){_0x4e3b88=!![];return _0x2b14ea[_0xd052('0x50')](_0x269816,_0x58be39,config['secrets']['recording'])[_0xd052('0x21')](function(){return _0x566f41;});}return _0x566f41;}})[_0xd052('0x21')](function(_0x20ff3a){if(_0x20ff3a){var _0x50dfaf=_0x20ff3a[_0xd052('0x4d')];if(!fs[_0xd052('0x4f')](_0x50dfaf)){throw new db['Sequelize'][(_0xd052('0x51'))](_0xd052('0x52'));}if(_0x20ff3a[_0xd052('0x53')]){return _0x11ede8[_0xd052('0x4b')](_0x50dfaf,_0x20ff3a[_0xd052('0x53')]+path[_0xd052('0x54')](_0x50dfaf),function(){if(_0x4e3b88){fs[_0xd052('0x55')](_0x50dfaf);}});}else{return _0x11ede8[_0xd052('0x4b')](_0x50dfaf,function(_0x14298c){if(_0x4e3b88){fs[_0xd052('0x55')](_0x50dfaf);}});}}})['catch'](function(_0xa90d33){if(_0xa90d33[_0xd052('0x56')]===_0xd052('0x52')){_0x11ede8[_0xd052('0x16')](0x194)[_0xd052('0x25')](_0xd052('0x57'));}else{return handleError(_0x11ede8,null);}});};exports['downloads']=function(_0x40755c,_0x851618,_0x32ac74){var _0x3d001a=require(_0xd052('0x58'));var _0x553899=![];var _0x2fe351={'$and':[db['sequelize'][_0xd052('0x3a')](db[_0xd052('0x59')]['fn']('MD5',db[_0xd052('0x59')]['col'](_0xd052('0x4c'))),_0x40755c[_0xd052('0x2e')][_0xd052('0x5a')])]};if(_0x40755c[_0xd052('0x2e')][_0xd052('0x2a')]&&_0x40755c['query'][_0xd052('0x2a')]==='uniqueid'){_0x2fe351[_0xd052('0x5b')][_0xd052('0x5c')]({'uniqueid':_0x40755c[_0xd052('0x44')]['id']});}else{_0x2fe351['$and']['push']({'id':_0x40755c[_0xd052('0x44')]['id']});}return db['VoiceRecording'][_0xd052('0x47')]({'where':_0x2fe351,'attributes':['id','value'],'raw':!![]})[_0xd052('0x21')](handleEntityNotFound(_0x851618,null))['then'](function(_0x48c371){if(_0x48c371){var _0x2dcd21=util[_0xd052('0x2d')]('%s.cypher',_0x48c371['value']);if(fs['existsSync'](_0x2dcd21)){_0x553899=!![];return _0x3d001a[_0xd052('0x50')](_0x2dcd21,_0x48c371[_0xd052('0x4d')],config[_0xd052('0x5d')][_0xd052('0x5e')])[_0xd052('0x21')](function(){return _0x48c371;});}return _0x48c371;}})[_0xd052('0x21')](function(_0x31eee9){if(_0x31eee9){if(!fs[_0xd052('0x4f')](_0x31eee9[_0xd052('0x4d')])){throw new db[(_0xd052('0x5f'))][(_0xd052('0x51'))]('VoiceRecording\x20not\x20found');}if(_0x31eee9[_0xd052('0x53')]){return _0x851618[_0xd052('0x4b')](_0x31eee9[_0xd052('0x4d')],_0x31eee9[_0xd052('0x53')]+path[_0xd052('0x54')](_0x31eee9[_0xd052('0x4d')]),function(){if(_0x553899){fs[_0xd052('0x55')](_0x31eee9[_0xd052('0x4d')]);}});}else{return _0x851618[_0xd052('0x4b')](_0x31eee9[_0xd052('0x4d')],function(_0x93020){if(_0x553899){fs[_0xd052('0x55')](_0x31eee9['value']);}});}}})['catch'](handleError(_0x851618,null));};exports[_0xd052('0x22')]=function(_0x425396,_0x483c85){return db[_0xd052('0x28')][_0xd052('0x47')]({'where':{'id':_0x425396[_0xd052('0x44')]['id']}})['then'](function(_0x3551f9){if(_[_0xd052('0x60')](_0x3551f9)){throw new ReferenceError(_0xd052('0x61'));}return _0x3551f9;})[_0xd052('0x21')](function(_0x22d838){var _0x2468bc=_0x22d838[_0xd052('0x4d')];logger[_0xd052('0x62')](_0xd052('0x63'),_0x2468bc);if(!_[_0xd052('0x60')](_0x22d838['value'])&&fs[_0xd052('0x4f')](_0x2468bc)){logger[_0xd052('0x62')](_0xd052('0x64')+_0x2468bc+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd052('0x65')](_0x2468bc);}_0x2468bc=_0x2468bc+_0xd052('0x66');if(!_[_0xd052('0x60')](_0x22d838[_0xd052('0x4d')])&&fs[_0xd052('0x4f')](_0x2468bc)){logger[_0xd052('0x62')]('File:\x20\x22'+_0x2468bc+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd052('0x65')](_0x2468bc);}return _0x22d838;})[_0xd052('0x21')](function(_0x408606){if(!_0x408606)throw new InternalError();return _0x408606[_0xd052('0x22')]();})['then'](function(){_0x483c85[_0xd052('0x16')](0xcc)[_0xd052('0x17')]();})[_0xd052('0x42')](handleError(_0x483c85,null));};function getBucketslist(_0x129f06,_0x1ff8aa,_0x25fedd){return new Promise(function(_0x3981ec,_0x11435e){var _0x5580bf=new AWS['S3']({'accessKeyId':_0x1ff8aa,'secretAccessKey':_0x129f06,'region':_0x25fedd});_0x5580bf[_0xd052('0x67')]({},function(_0x1a34a9,_0x2a5c31){if(_0x1a34a9){return _0x11435e(_0x1a34a9);}else{return _0x3981ec(_0x2a5c31);}});});}function createBucket(_0x464f7b,_0x40b0f9,_0x1d33ce,_0x7538bb){return new Promise(function(_0x35119d,_0x26505c){var _0x5b1c07=new AWS['S3']({'accessKeyId':_0x40b0f9,'secretAccessKey':_0x464f7b,'region':_0x1d33ce});_0x5b1c07['createBucket']({'Bucket':_0x7538bb},function(_0x218724,_0x399ac2){if(_0x218724){return _0x26505c(_0x218724);}else{return _0x35119d(_0x399ac2);}});});}function uploadFile(_0x3bc666,_0x405b97,_0xe82595,_0x545ee4,_0x757fc6,_0x3b6a23){return new Promise(function(_0x1cde21,_0x281282){var _0x52cab3=new AWS['S3']({'accessKeyId':_0x405b97,'secretAccessKey':_0x3bc666,'region':_0xe82595});_0x52cab3[_0xd052('0x68')]({'Bucket':_0x545ee4,'Key':_0x757fc6,'Body':_0x3b6a23},function(_0x1406c0,_0x4685f9){if(_0x1406c0){return _0x281282(_0x1406c0);}else{return _0x1cde21(_0x4685f9);}});});}function startTranscribe(_0x4c65c9,_0x30bbb7,_0x637778,_0x5c2b2e,_0x4ba8e0,_0x287e1b){return new Promise(function(_0x41dcaa,_0x561563){var _0x3f033a=new AWS['TranscribeService']({'accessKeyId':_0x30bbb7,'secretAccessKey':_0x4c65c9,'region':_0x637778});_0x3f033a[_0xd052('0x69')]({'TranscriptionJobName':_0x5c2b2e,'LanguageCode':_0x4ba8e0,'Media':{'MediaFileUri':_0x287e1b}},function(_0x3c2a9f,_0x384dc3){if(_0x3c2a9f){return _0x561563(_0x3c2a9f);}else{return _0x41dcaa(_0x384dc3);}});});}function transcribe(_0x3de128,_0x51be20,_0x17fd17,_0x485b69,_0x17f9aa,_0x55914d,_0x585674){return new Promise(function(_0x3f8867,_0x380405){var _0x14c1f1={};logger[_0xd052('0x62')](util[_0xd052('0x2d')](_0xd052('0x6a'),_0x3de128,_0x17f9aa));return uploadFile(_0x51be20,_0x17fd17,_0x485b69,_0x17f9aa,path[_0xd052('0x6b')](_0x55914d),fs[_0xd052('0x6c')](_0x55914d))['then'](function(_0xac7b36){logger[_0xd052('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x3de128,_0x17f9aa,_0xac7b36[_0xd052('0x6d')]));_0x14c1f1[_0xd052('0x6e')]=_0xac7b36[_0xd052('0x6f')];_0x14c1f1['location']=_0xac7b36['Location'];logger[_0xd052('0x62')](util[_0xd052('0x2d')](_0xd052('0x70'),_0x3de128));return startTranscribe(_0x51be20,_0x17fd17,_0x485b69,uuidv4(),_0x585674,_0xac7b36[_0xd052('0x6d')]);})['then'](function(_0x4ee8e1){logger[_0xd052('0x62')](util[_0xd052('0x2d')](_0xd052('0x71'),_0x3de128,_0x4ee8e1[_0xd052('0x72')][_0xd052('0x73')]));_0x14c1f1[_0xd052('0x74')]=_0x4ee8e1[_0xd052('0x72')][_0xd052('0x73')];_0x14c1f1['transcribeStatus']=_0x4ee8e1[_0xd052('0x72')][_0xd052('0x75')];return _0x3f8867(_0x14c1f1);})[_0xd052('0x42')](function(_0x3a8675){return _0x380405(_0x3a8675);});});}exports[_0xd052('0x76')]=function(_0x48d526,_0x81c02f,_0x217c9e){var _0x1da502;var _0xad9259;var _0x38a90b;var _0x328006=require('../../components/encryptor');return db[_0xd052('0x28')]['findOne']({'where':{'id':_0x48d526[_0xd052('0x44')]['id']}})['then'](function(_0x1ebb03){if(_0x1ebb03){var _0x4e60c3=util[_0xd052('0x2d')]('%s.cypher',_0x1ebb03[_0xd052('0x4d')]);if(fs[_0xd052('0x4f')](_0x4e60c3)){cypher=!![];return _0x328006[_0xd052('0x50')](_0x4e60c3,_0x1ebb03[_0xd052('0x4d')],config[_0xd052('0x5d')][_0xd052('0x5e')])[_0xd052('0x21')](function(){return _0x1ebb03;});}return _0x1ebb03;}})[_0xd052('0x21')](function(_0x32c139){if(!_0x32c139){throw new db[(_0xd052('0x5f'))][(_0xd052('0x51'))]('Voice\x20Recording\x20not\x20found');}_0xad9259=_0x32c139;return db['Setting'][_0xd052('0x77')]({'where':{'id':0x1}});})[_0xd052('0x21')](handleEntityNotFound(_0x81c02f,null))[_0xd052('0x21')](function(_0x175a55){if(_0x175a55){_0x1da502=_0x175a55;if(!_0x1da502[_0xd052('0x78')]||!_0x1da502['transcribeAccountId']||!_0x1da502[_0xd052('0x79')]||!_0x1da502[_0xd052('0x7a')]||!_0x1da502['bucket']){throw new db[(_0xd052('0x5f'))][(_0xd052('0x51'))](_0xd052('0x7b'));}if(_0x48d526[_0xd052('0x49')][_0xd052('0x7c')]&&(!_0x1da502[_0xd052('0x7d')]||!_0x1da502['sentimentAccountId']||!_0x1da502[_0xd052('0x7e')]||!_0x1da502[_0xd052('0x7a')]||!_0x1da502['bucket'])){throw new db[(_0xd052('0x5f'))][(_0xd052('0x51'))](_0xd052('0x7f'));}return db[_0xd052('0x80')][_0xd052('0x77')]({'where':{'id':_0x1da502['transcribeAccountId']}});}})[_0xd052('0x21')](function(_0x58596c){if(!_0x58596c){throw new db[(_0xd052('0x5f'))][(_0xd052('0x51'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x58596c[_0xd052('0x81')]||!_0x58596c[_0xd052('0x82')]){throw new db[(_0xd052('0x5f'))][(_0xd052('0x51'))](_0xd052('0x83'));}_0x38a90b=_0x58596c;return getBucketslist(_0x38a90b[_0xd052('0x81')],_0x38a90b['data2'],_0x1da502[_0xd052('0x79')]);})[_0xd052('0x21')](function(_0x3e27ea){if(_0x3e27ea&&_0x3e27ea[_0xd052('0x84')]){var _0x4c84e3=_['find'](_0x3e27ea[_0xd052('0x84')],function(_0x4d04d0){return _0x4d04d0[_0xd052('0x85')]===_0x1da502['bucket'];});if(!_0x4c84e3){logger[_0xd052('0x62')](util['format'](_0xd052('0x86'),_0x48d526[_0xd052('0x44')]['id'],_0x1da502[_0xd052('0x6e')]));return createBucket(_0x38a90b[_0xd052('0x81')],_0x38a90b[_0xd052('0x82')],_0x1da502['transcribeRegion'],_0x1da502[_0xd052('0x6e')]);}logger[_0xd052('0x62')](util[_0xd052('0x2d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x48d526[_0xd052('0x44')]['id'],_0x1da502['bucket']));return;}})[_0xd052('0x21')](function(_0x873c13){if(_0xad9259[_0xd052('0x87')]===_0xd052('0x88')){return transcribe(_0x48d526[_0xd052('0x44')]['id'],_0x38a90b[_0xd052('0x81')],_0x38a90b[_0xd052('0x82')],_0x1da502[_0xd052('0x79')],_0x1da502[_0xd052('0x6e')],_0xad9259['value'],_0x1da502[_0xd052('0x7a')]);}else{logger[_0xd052('0x62')](util[_0xd052('0x2d')](_0xd052('0x89'),_0x48d526[_0xd052('0x44')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xd052('0x21')](function(_0x2c25f4){if(_0x2c25f4){_0x2c25f4[_0xd052('0x8a')]=_0x48d526[_0xd052('0x49')][_0xd052('0x7c')];return _0xad9259[_0xd052('0x8b')](_0x2c25f4);}})[_0xd052('0x21')](respondWithResult(_0x81c02f,null))['catch'](handleError(_0x81c02f,null));};function writeFile(_0x173d4b,_0x1d799f){return new Promise(function(_0x4ff9a5,_0x5eb2b9){fs[_0xd052('0x8c')](_0x1d799f,_0x173d4b,function(_0x49024d,_0x3bd1d3){if(_0x49024d){return _0x5eb2b9(_0x49024d);}else{return _0x4ff9a5(_0x3bd1d3);}});});}exports[_0xd052('0x8d')]=function(_0x596183,_0x3af1b3,_0x158858){return db['VoiceRecording'][_0xd052('0x77')]({'where':{'id':_0x596183[_0xd052('0x44')]['id']}})['then'](handleEntityNotFound(_0x3af1b3))[_0xd052('0x21')](function(_0x3812c4){if(_0x3812c4&&_0x3812c4[_0xd052('0x8e')]){var _0x118e96=_0x3812c4[_0xd052('0x8e')];var _0x28989d=config[_0xd052('0x8f')]+_0xd052('0x90')+_0x3812c4['id']+_0xd052('0x91');if(fs['existsSync'](_0x28989d)){return _0x28989d;}return writeFile(_0x118e96,_0x28989d)[_0xd052('0x21')](function(){return _0x28989d;});}else{throw new db[(_0xd052('0x5f'))][(_0xd052('0x51'))](_0xd052('0x92'));}})[_0xd052('0x21')](function(_0xc53496){return _0x3af1b3[_0xd052('0x4b')](_0xc53496);})[_0xd052('0x42')](handleError(_0x3af1b3));}; \ No newline at end of file +var _0x2fe7=['runTranscribe','findOne','secrets','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','updateAttributes','downloadTranscribe','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','querystring','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','status','name','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','merge','find','create','update','body','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','decryptFile','Sequelize','VoiceRecording\x20not\x20found','download','filename','extname','unlink','message','send','downloads','sequelize','col','token','$and','push','existsSync','recording','ValidationError','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2fe7,0xaa));var _0x72fe=function(_0x254a3b,_0x580676){_0x254a3b=_0x254a3b-0x0;var _0x206842=_0x2fe7[_0x254a3b];return _0x206842;};'use strict';var emlformat=require(_0x72fe('0x0'));var rimraf=require(_0x72fe('0x1'));var zipdir=require(_0x72fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x72fe('0x3'));var BPromise=require(_0x72fe('0x4'));var Mustache=require(_0x72fe('0x5'));var util=require(_0x72fe('0x6'));var path=require(_0x72fe('0x7'));var sox=require(_0x72fe('0x8'));var csv=require('to-csv');var ejs=require(_0x72fe('0x9'));var fs=require('fs');var fs_extra=require(_0x72fe('0xa'));var _=require('lodash');var squel=require(_0x72fe('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x72fe('0xc'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x72fe('0xd'));var Redis=require(_0x72fe('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x72fe('0xf'));var as=require(_0x72fe('0x10'));var hardwareService=require(_0x72fe('0x11'));var logger=require(_0x72fe('0x12'))(_0x72fe('0x13'));var utils=require(_0x72fe('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x72fe('0x15'));var db=require(_0x72fe('0x16'))['db'];function respondWithStatusCode(_0x2ecb00,_0x309cda){_0x309cda=_0x309cda||0xcc;return function(_0x226b63){if(_0x226b63){return _0x2ecb00[_0x72fe('0x17')](_0x309cda);}return _0x2ecb00['status'](_0x309cda)[_0x72fe('0x18')]();};}function respondWithResult(_0x2d3ccd,_0x568d2d){_0x568d2d=_0x568d2d||0xc8;return function(_0x4e601b){if(_0x4e601b){return _0x2d3ccd['status'](_0x568d2d)['json'](_0x4e601b);}};}function respondWithFilteredResult(_0x2113a0,_0x488e16){return function(_0x5422af){if(_0x5422af){var _0x459def=typeof _0x488e16[_0x72fe('0x19')]==='undefined'&&typeof _0x488e16[_0x72fe('0x1a')]===_0x72fe('0x1b');var _0x5d1542=_0x5422af[_0x72fe('0x1c')];var _0x1a331d=_0x459def?0x0:_0x488e16['offset'];var _0x14911=_0x459def?_0x5422af[_0x72fe('0x1c')]:_0x488e16[_0x72fe('0x19')]+_0x488e16[_0x72fe('0x1a')];var _0xeccff1;if(_0x14911>=_0x5d1542){_0x14911=_0x5d1542;_0xeccff1=0xc8;}else{_0xeccff1=0xce;}_0x2113a0['status'](_0xeccff1);return _0x2113a0[_0x72fe('0x1d')](_0x72fe('0x1e'),_0x1a331d+'-'+_0x14911+'/'+_0x5d1542)['json'](_0x5422af);}return null;};}function patchUpdates(_0x5a51ac){return function(_0x7d58f1){try{jsonpatch[_0x72fe('0x1f')](_0x7d58f1,_0x5a51ac,!![]);}catch(_0x46de78){return BPromise[_0x72fe('0x20')](_0x46de78);}return _0x7d58f1[_0x72fe('0x21')]();};}function saveUpdates(_0x149dd6,_0x28b496){return function(_0x24e26f){if(_0x24e26f){return _0x24e26f['update'](_0x149dd6)['then'](function(_0x1d1fc0){return _0x1d1fc0;});}return null;};}function removeEntity(_0x298b3a,_0x178b20){return function(_0x105603){if(_0x105603){return _0x105603[_0x72fe('0x22')]()[_0x72fe('0x23')](function(){_0x298b3a[_0x72fe('0x24')](0xcc)[_0x72fe('0x18')]();});}};}function handleEntityNotFound(_0x5b6c94,_0x123a54){return function(_0x29f296){if(!_0x29f296){_0x5b6c94[_0x72fe('0x17')](0x194);}return _0x29f296;};}function handleError(_0x2b5611,_0x36baba){_0x36baba=_0x36baba||0x1f4;return function(_0x47dfd1){logger['error'](_0x47dfd1['stack']);if(_0x47dfd1[_0x72fe('0x25')]){delete _0x47dfd1['name'];}_0x2b5611[_0x72fe('0x24')](_0x36baba)['send'](_0x47dfd1);};}exports['index']=function(_0x49928f,_0x182097){var _0x432ade={},_0x586e04={},_0x77480={'count':0x0,'rows':[]};var _0x46f591=_[_0x72fe('0x26')](db[_0x72fe('0x27')][_0x72fe('0x28')],function(_0x4cfb2e){return{'name':_0x4cfb2e[_0x72fe('0x29')],'type':_0x4cfb2e[_0x72fe('0x2a')]['key']};});_0x586e04[_0x72fe('0x2b')]=_[_0x72fe('0x2c')](_[_0x72fe('0x26')](_0x46f591,'name'),['format']);_0x586e04[_0x72fe('0x2d')]=_[_0x72fe('0x2e')](_0x49928f['query']);_0x586e04[_0x72fe('0x2f')]=_[_0x72fe('0x30')](_0x586e04[_0x72fe('0x2b')],_0x586e04[_0x72fe('0x2d')]);_0x432ade[_0x72fe('0x31')]=_[_0x72fe('0x30')](_0x586e04[_0x72fe('0x2b')],qs[_0x72fe('0x32')](_0x49928f[_0x72fe('0x2d')][_0x72fe('0x32')]));_0x432ade['attributes']=_0x432ade[_0x72fe('0x31')][_0x72fe('0x33')]?_0x432ade[_0x72fe('0x31')]:_0x586e04[_0x72fe('0x2b')];if(!_0x49928f[_0x72fe('0x2d')][_0x72fe('0x34')](_0x72fe('0x35'))){_0x432ade[_0x72fe('0x1a')]=qs['limit'](_0x49928f[_0x72fe('0x2d')][_0x72fe('0x1a')]);_0x432ade['offset']=qs[_0x72fe('0x19')](_0x49928f[_0x72fe('0x2d')][_0x72fe('0x19')]);}_0x432ade[_0x72fe('0x36')]=qs['sort'](_0x49928f[_0x72fe('0x2d')][_0x72fe('0x37')]);_0x432ade['where']=qs[_0x72fe('0x2f')](_[_0x72fe('0x38')](_0x49928f[_0x72fe('0x2d')],_0x586e04['filters']),_0x46f591);if(_0x49928f[_0x72fe('0x2d')][_0x72fe('0x39')]){_0x432ade[_0x72fe('0x3a')]=_['merge'](_0x432ade[_0x72fe('0x3a')],{'$or':_[_0x72fe('0x26')](_0x46f591,function(_0x53b3f6){if(_0x53b3f6[_0x72fe('0x2a')]!==_0x72fe('0x3b')){var _0x200bdb={};_0x200bdb[_0x53b3f6['name']]={'$like':'%'+_0x49928f[_0x72fe('0x2d')][_0x72fe('0x39')]+'%'};return _0x200bdb;}})});}_0x432ade=_['merge']({},_0x432ade,_0x49928f[_0x72fe('0x3c')]);var _0x1809fe={'where':_0x432ade[_0x72fe('0x3a')]};return db[_0x72fe('0x27')][_0x72fe('0x1c')](_0x1809fe)[_0x72fe('0x23')](function(_0x4ee61b){_0x77480[_0x72fe('0x1c')]=_0x4ee61b;if(_0x49928f[_0x72fe('0x2d')]['includeAll']){_0x432ade['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x72fe('0x3d')](_0x432ade);})[_0x72fe('0x23')](function(_0x19b227){_0x77480[_0x72fe('0x3e')]=_0x19b227;return _0x77480;})[_0x72fe('0x23')](respondWithFilteredResult(_0x182097,_0x432ade))[_0x72fe('0x3f')](handleError(_0x182097,null));};exports[_0x72fe('0x40')]=function(_0x53468e,_0x30a4bf){var _0x2c8ed3={'raw':![],'where':{'id':_0x53468e[_0x72fe('0x41')]['id']}},_0x372ae5={};_0x372ae5[_0x72fe('0x2b')]=_[_0x72fe('0x2e')](db['VoiceRecording']['rawAttributes']);_0x372ae5[_0x72fe('0x2d')]=_[_0x72fe('0x2e')](_0x53468e[_0x72fe('0x2d')]);_0x372ae5[_0x72fe('0x2f')]=_[_0x72fe('0x30')](_0x372ae5['model'],_0x372ae5[_0x72fe('0x2d')]);_0x2c8ed3[_0x72fe('0x31')]=_[_0x72fe('0x30')](_0x372ae5[_0x72fe('0x2b')],qs[_0x72fe('0x32')](_0x53468e['query'][_0x72fe('0x32')]));_0x2c8ed3[_0x72fe('0x31')]=_0x2c8ed3['attributes'][_0x72fe('0x33')]?_0x2c8ed3[_0x72fe('0x31')]:_0x372ae5['model'];if(_0x53468e[_0x72fe('0x2d')][_0x72fe('0x42')]){_0x2c8ed3[_0x72fe('0x43')]=[{'all':!![]}];}_0x2c8ed3=_[_0x72fe('0x44')]({},_0x2c8ed3,_0x53468e['options']);return db[_0x72fe('0x27')][_0x72fe('0x45')](_0x2c8ed3)['then'](handleEntityNotFound(_0x30a4bf,null))[_0x72fe('0x23')](respondWithResult(_0x30a4bf,null))[_0x72fe('0x3f')](handleError(_0x30a4bf,null));};exports[_0x72fe('0x46')]=function(_0x1db320,_0x9697b2){return db[_0x72fe('0x27')][_0x72fe('0x46')](_0x1db320['body'],{})[_0x72fe('0x23')](respondWithResult(_0x9697b2,0xc9))[_0x72fe('0x3f')](handleError(_0x9697b2,null));};exports[_0x72fe('0x47')]=function(_0x1bb9ff,_0x27b8d0){if(_0x1bb9ff[_0x72fe('0x48')]['id']){delete _0x1bb9ff['body']['id'];}return db[_0x72fe('0x27')][_0x72fe('0x45')]({'where':{'id':_0x1bb9ff['params']['id']}})[_0x72fe('0x23')](handleEntityNotFound(_0x27b8d0,null))[_0x72fe('0x23')](saveUpdates(_0x1bb9ff[_0x72fe('0x48')],null))[_0x72fe('0x23')](respondWithResult(_0x27b8d0,null))[_0x72fe('0x3f')](handleError(_0x27b8d0,null));};exports[_0x72fe('0x49')]=function(_0x3b3bda,_0x5e5ceb){return db['VoiceRecording'][_0x72fe('0x49')]()[_0x72fe('0x23')](respondWithResult(_0x5e5ceb,null))['catch'](handleError(_0x5e5ceb,null));};exports['download']=function(_0x530894,_0x5be620,_0x35ccbe){var _0x41b183=require(_0x72fe('0x4a'));var _0x4f7e90=![];var _0x22f7b3={};if(_0x530894[_0x72fe('0x2d')][_0x72fe('0x2a')]&&_0x530894[_0x72fe('0x2d')][_0x72fe('0x2a')]===_0x72fe('0x4b')){_0x22f7b3['uniqueid']=_0x530894[_0x72fe('0x41')]['id'];}else{_0x22f7b3['id']=_0x530894[_0x72fe('0x41')]['id'];}return db[_0x72fe('0x27')][_0x72fe('0x45')]({'where':_0x22f7b3,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x5be620,null))[_0x72fe('0x23')](function(_0x324d5b){if(_0x324d5b){var _0x34b9ec=_0x324d5b[_0x72fe('0x4c')];var _0x458d4f=util[_0x72fe('0x4d')](_0x72fe('0x4e'),_0x34b9ec);if(fs['existsSync'](_0x458d4f)){_0x4f7e90=!![];return _0x41b183[_0x72fe('0x4f')](_0x458d4f,_0x34b9ec,config['secrets']['recording'])[_0x72fe('0x23')](function(){return _0x324d5b;});}return _0x324d5b;}})[_0x72fe('0x23')](function(_0x42d9fb){if(_0x42d9fb){var _0x6ba9e4=_0x42d9fb[_0x72fe('0x4c')];if(!fs['existsSync'](_0x6ba9e4)){throw new db[(_0x72fe('0x50'))]['ValidationError'](_0x72fe('0x51'));}if(_0x42d9fb['filename']){return _0x5be620[_0x72fe('0x52')](_0x6ba9e4,_0x42d9fb[_0x72fe('0x53')]+path[_0x72fe('0x54')](_0x6ba9e4),function(){if(_0x4f7e90){fs[_0x72fe('0x55')](_0x6ba9e4);}});}else{return _0x5be620[_0x72fe('0x52')](_0x6ba9e4,function(_0x57ccab){if(_0x4f7e90){fs[_0x72fe('0x55')](_0x6ba9e4);}});}}})['catch'](function(_0x20d2d3){if(_0x20d2d3[_0x72fe('0x56')]===_0x72fe('0x51')){_0x5be620[_0x72fe('0x24')](0x194)[_0x72fe('0x57')]('Not\x20found');}else{return handleError(_0x5be620,null);}});};exports[_0x72fe('0x58')]=function(_0x433660,_0x38f2e9,_0x16d2f0){var _0x4ea041=require('../../components/encryptor');var _0x3d0237=![];var _0x498314={'$and':[db['sequelize']['where'](db[_0x72fe('0x59')]['fn']('MD5',db['sequelize'][_0x72fe('0x5a')](_0x72fe('0x4b'))),_0x433660[_0x72fe('0x2d')][_0x72fe('0x5b')])]};if(_0x433660[_0x72fe('0x2d')]['type']&&_0x433660[_0x72fe('0x2d')][_0x72fe('0x2a')]===_0x72fe('0x4b')){_0x498314[_0x72fe('0x5c')][_0x72fe('0x5d')]({'uniqueid':_0x433660['params']['id']});}else{_0x498314[_0x72fe('0x5c')][_0x72fe('0x5d')]({'id':_0x433660[_0x72fe('0x41')]['id']});}return db[_0x72fe('0x27')][_0x72fe('0x45')]({'where':_0x498314,'attributes':['id',_0x72fe('0x4c')],'raw':!![]})[_0x72fe('0x23')](handleEntityNotFound(_0x38f2e9,null))[_0x72fe('0x23')](function(_0x159460){if(_0x159460){var _0xe6e3de=util[_0x72fe('0x4d')]('%s.cypher',_0x159460['value']);if(fs[_0x72fe('0x5e')](_0xe6e3de)){_0x3d0237=!![];return _0x4ea041['decryptFile'](_0xe6e3de,_0x159460[_0x72fe('0x4c')],config['secrets'][_0x72fe('0x5f')])[_0x72fe('0x23')](function(){return _0x159460;});}return _0x159460;}})['then'](function(_0x387739){if(_0x387739){if(!fs['existsSync'](_0x387739['value'])){throw new db[(_0x72fe('0x50'))][(_0x72fe('0x60'))](_0x72fe('0x51'));}if(_0x387739[_0x72fe('0x53')]){return _0x38f2e9[_0x72fe('0x52')](_0x387739[_0x72fe('0x4c')],_0x387739[_0x72fe('0x53')]+path[_0x72fe('0x54')](_0x387739[_0x72fe('0x4c')]),function(){if(_0x3d0237){fs[_0x72fe('0x55')](_0x387739[_0x72fe('0x4c')]);}});}else{return _0x38f2e9[_0x72fe('0x52')](_0x387739[_0x72fe('0x4c')],function(_0x37f67e){if(_0x3d0237){fs['unlink'](_0x387739[_0x72fe('0x4c')]);}});}}})[_0x72fe('0x3f')](handleError(_0x38f2e9,null));};exports[_0x72fe('0x22')]=function(_0x9bf611,_0x4dc55f){return db[_0x72fe('0x27')][_0x72fe('0x45')]({'where':{'id':_0x9bf611[_0x72fe('0x41')]['id']}})[_0x72fe('0x23')](function(_0x2cc081){if(_[_0x72fe('0x61')](_0x2cc081)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2cc081;})[_0x72fe('0x23')](function(_0x35f40b){var _0xf6273a=_0x35f40b['value'];logger[_0x72fe('0x62')](_0x72fe('0x63'),_0xf6273a);if(!_[_0x72fe('0x61')](_0x35f40b[_0x72fe('0x4c')])&&fs[_0x72fe('0x5e')](_0xf6273a)){logger[_0x72fe('0x62')]('File:\x20\x22'+_0xf6273a+_0x72fe('0x64'));fs[_0x72fe('0x65')](_0xf6273a);}_0xf6273a=_0xf6273a+_0x72fe('0x66');if(!_[_0x72fe('0x61')](_0x35f40b[_0x72fe('0x4c')])&&fs[_0x72fe('0x5e')](_0xf6273a)){logger['info'](_0x72fe('0x67')+_0xf6273a+_0x72fe('0x64'));fs[_0x72fe('0x65')](_0xf6273a);}return _0x35f40b;})[_0x72fe('0x23')](function(_0x3d0146){if(!_0x3d0146)throw new InternalError();return _0x3d0146[_0x72fe('0x22')]();})[_0x72fe('0x23')](function(){_0x4dc55f['status'](0xcc)[_0x72fe('0x18')]();})[_0x72fe('0x3f')](handleError(_0x4dc55f,null));};function getBucketslist(_0x418b36,_0x8e1aa8,_0x5aa4dd){return new Promise(function(_0x51b6eb,_0x15ac81){var _0x35343b=new AWS['S3']({'accessKeyId':_0x8e1aa8,'secretAccessKey':_0x418b36,'region':_0x5aa4dd});_0x35343b[_0x72fe('0x68')]({},function(_0x35ea51,_0x1d5e17){if(_0x35ea51){return _0x15ac81(_0x35ea51);}else{return _0x51b6eb(_0x1d5e17);}});});}function createBucket(_0x272c30,_0x101fd8,_0x4cc1fe,_0x4dc9b0){return new Promise(function(_0x411e67,_0x313af3){var _0x4d46b4=new AWS['S3']({'accessKeyId':_0x101fd8,'secretAccessKey':_0x272c30,'region':_0x4cc1fe});_0x4d46b4[_0x72fe('0x69')]({'Bucket':_0x4dc9b0},function(_0x1fd74c,_0x4dc928){if(_0x1fd74c){return _0x313af3(_0x1fd74c);}else{return _0x411e67(_0x4dc928);}});});}function uploadFile(_0xd1abd8,_0x2ae3c4,_0x40a361,_0xbe44e4,_0x173085,_0x477043){return new Promise(function(_0x35ea2d,_0x6bf0c7){var _0x557345=new AWS['S3']({'accessKeyId':_0x2ae3c4,'secretAccessKey':_0xd1abd8,'region':_0x40a361});_0x557345['upload']({'Bucket':_0xbe44e4,'Key':_0x173085,'Body':_0x477043},function(_0x173958,_0x9fe506){if(_0x173958){return _0x6bf0c7(_0x173958);}else{return _0x35ea2d(_0x9fe506);}});});}function startTranscribe(_0xe52710,_0x5440d7,_0xaf4587,_0x494187,_0x2efc34,_0x4983f7){return new Promise(function(_0x349a0c,_0x28eb27){var _0x151ac2=new AWS[(_0x72fe('0x6a'))]({'accessKeyId':_0x5440d7,'secretAccessKey':_0xe52710,'region':_0xaf4587});_0x151ac2[_0x72fe('0x6b')]({'TranscriptionJobName':_0x494187,'LanguageCode':_0x2efc34,'Media':{'MediaFileUri':_0x4983f7}},function(_0x188b71,_0x2ea229){if(_0x188b71){return _0x28eb27(_0x188b71);}else{return _0x349a0c(_0x2ea229);}});});}function transcribe(_0x544da0,_0xd8e71,_0x34d4ba,_0x5ad66a,_0x17d9dc,_0x279b8d,_0x281d31){return new Promise(function(_0x4807a7,_0x3fd06a){var _0x50cc0c={};logger['info'](util[_0x72fe('0x4d')](_0x72fe('0x6c'),_0x544da0,_0x17d9dc));return uploadFile(_0xd8e71,_0x34d4ba,_0x5ad66a,_0x17d9dc,path['basename'](_0x279b8d),fs[_0x72fe('0x6d')](_0x279b8d))['then'](function(_0x1fe4f4){logger[_0x72fe('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x544da0,_0x17d9dc,_0x1fe4f4[_0x72fe('0x6e')]));_0x50cc0c[_0x72fe('0x6f')]=_0x1fe4f4[_0x72fe('0x70')];_0x50cc0c[_0x72fe('0x71')]=_0x1fe4f4['Location'];logger[_0x72fe('0x62')](util[_0x72fe('0x4d')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x544da0));return startTranscribe(_0xd8e71,_0x34d4ba,_0x5ad66a,uuidv4(),_0x281d31,_0x1fe4f4['Location']);})['then'](function(_0x59e7cd){logger[_0x72fe('0x62')](util['format'](_0x72fe('0x72'),_0x544da0,_0x59e7cd['TranscriptionJob']['TranscriptionJobName']));_0x50cc0c[_0x72fe('0x73')]=_0x59e7cd[_0x72fe('0x74')][_0x72fe('0x75')];_0x50cc0c[_0x72fe('0x76')]=_0x59e7cd['TranscriptionJob'][_0x72fe('0x77')];return _0x4807a7(_0x50cc0c);})[_0x72fe('0x3f')](function(_0x14f6db){return _0x3fd06a(_0x14f6db);});});}exports[_0x72fe('0x78')]=function(_0x5aa564,_0x1755e6,_0x1e9afb){var _0x387002;var _0x9590ea;var _0x58fb5d;var _0x4843e2=require(_0x72fe('0x4a'));return db[_0x72fe('0x27')][_0x72fe('0x79')]({'where':{'id':_0x5aa564['params']['id']}})['then'](function(_0x43259b){if(_0x43259b){var _0x3af227=util['format'](_0x72fe('0x4e'),_0x43259b[_0x72fe('0x4c')]);if(fs[_0x72fe('0x5e')](_0x3af227)){cypher=!![];return _0x4843e2[_0x72fe('0x4f')](_0x3af227,_0x43259b[_0x72fe('0x4c')],config[_0x72fe('0x7a')]['recording'])[_0x72fe('0x23')](function(){return _0x43259b;});}return _0x43259b;}})[_0x72fe('0x23')](function(_0x529c90){if(!_0x529c90){throw new db[(_0x72fe('0x50'))][(_0x72fe('0x60'))]('Voice\x20Recording\x20not\x20found');}_0x9590ea=_0x529c90;return db[_0x72fe('0x7b')][_0x72fe('0x79')]({'where':{'id':0x1}});})[_0x72fe('0x23')](handleEntityNotFound(_0x1755e6,null))['then'](function(_0x49f70b){if(_0x49f70b){_0x387002=_0x49f70b;if(!_0x387002[_0x72fe('0x7c')]||!_0x387002[_0x72fe('0x7d')]||!_0x387002[_0x72fe('0x7e')]||!_0x387002[_0x72fe('0x7f')]||!_0x387002['bucket']){throw new db[(_0x72fe('0x50'))][(_0x72fe('0x60'))](_0x72fe('0x80'));}if(_0x5aa564['body'][_0x72fe('0x81')]&&(!_0x387002[_0x72fe('0x82')]||!_0x387002['sentimentAccountId']||!_0x387002['sentimentRegion']||!_0x387002['language']||!_0x387002[_0x72fe('0x6f')])){throw new db[(_0x72fe('0x50'))][(_0x72fe('0x60'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x72fe('0x83')][_0x72fe('0x79')]({'where':{'id':_0x387002['transcribeAccountId']}});}})['then'](function(_0x4b327c){if(!_0x4b327c){throw new db[(_0x72fe('0x50'))][(_0x72fe('0x60'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4b327c[_0x72fe('0x84')]||!_0x4b327c[_0x72fe('0x85')]){throw new db[(_0x72fe('0x50'))][(_0x72fe('0x60'))](_0x72fe('0x86'));}_0x58fb5d=_0x4b327c;return getBucketslist(_0x58fb5d[_0x72fe('0x84')],_0x58fb5d['data2'],_0x387002[_0x72fe('0x7e')]);})['then'](function(_0x10b774){if(_0x10b774&&_0x10b774[_0x72fe('0x87')]){var _0x52d8d2=_[_0x72fe('0x45')](_0x10b774[_0x72fe('0x87')],function(_0x45aa5b){return _0x45aa5b[_0x72fe('0x88')]===_0x387002['bucket'];});if(!_0x52d8d2){logger[_0x72fe('0x62')](util[_0x72fe('0x4d')](_0x72fe('0x89'),_0x5aa564[_0x72fe('0x41')]['id'],_0x387002['bucket']));return createBucket(_0x58fb5d[_0x72fe('0x84')],_0x58fb5d[_0x72fe('0x85')],_0x387002[_0x72fe('0x7e')],_0x387002['bucket']);}logger['info'](util[_0x72fe('0x4d')](_0x72fe('0x8a'),_0x5aa564[_0x72fe('0x41')]['id'],_0x387002[_0x72fe('0x6f')]));return;}})[_0x72fe('0x23')](function(_0x163606){if(_0x9590ea['transcribeStatus']===_0x72fe('0x8b')){return transcribe(_0x5aa564['params']['id'],_0x58fb5d[_0x72fe('0x84')],_0x58fb5d['data2'],_0x387002['transcribeRegion'],_0x387002[_0x72fe('0x6f')],_0x9590ea[_0x72fe('0x4c')],_0x387002['language']);}else{logger[_0x72fe('0x62')](util[_0x72fe('0x4d')](_0x72fe('0x8c'),_0x5aa564[_0x72fe('0x41')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x72fe('0x23')](function(_0x4c3845){if(_0x4c3845){_0x4c3845['tempSentiment']=_0x5aa564[_0x72fe('0x48')][_0x72fe('0x81')];return _0x9590ea[_0x72fe('0x8d')](_0x4c3845);}})[_0x72fe('0x23')](respondWithResult(_0x1755e6,null))[_0x72fe('0x3f')](handleError(_0x1755e6,null));};function writeFile(_0x5da8b3,_0x33c281){return new Promise(function(_0x1650df,_0x3eeb4a){fs['writeFile'](_0x33c281,_0x5da8b3,function(_0x469b94,_0x4a1324){if(_0x469b94){return _0x3eeb4a(_0x469b94);}else{return _0x1650df(_0x4a1324);}});});}exports[_0x72fe('0x8e')]=function(_0x3a4195,_0x24937a,_0x35ce5d){return db[_0x72fe('0x27')]['findOne']({'where':{'id':_0x3a4195[_0x72fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x24937a))[_0x72fe('0x23')](function(_0x355062){if(_0x355062&&_0x355062['fileText']){var _0x3de2b7=_0x355062['fileText'];var _0x13d9cb=config[_0x72fe('0x8f')]+'/server/files/transcribes/transcribe_'+_0x355062['id']+'.txt';if(fs[_0x72fe('0x5e')](_0x13d9cb)){return _0x13d9cb;}return writeFile(_0x3de2b7,_0x13d9cb)['then'](function(){return _0x13d9cb;});}else{throw new db[(_0x72fe('0x50'))]['ValidationError'](_0x72fe('0x90'));}})[_0x72fe('0x23')](function(_0x454cb7){return _0x24937a[_0x72fe('0x52')](_0x454cb7);})[_0x72fe('0x3f')](handleError(_0x24937a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 1d91885..facf2b2 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 _0x2137=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2137,0x134));var _0x7213=function(_0x59ce68,_0x98d1b5){_0x59ce68=_0x59ce68-0x0;var _0x37c816=_0x2137[_0x59ce68];return _0x37c816;};'use strict';var attributes=require(_0x7213('0x0'));module[_0x7213('0x1')]=function(_0x23e0c8,_0x4d04cb){return _0x23e0c8['define'](_0x7213('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x7213('0x3'),'fields':[_0x7213('0x3')]},{'name':_0x7213('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0xadec=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x316e41,_0x4fe79d){var _0x470edf=function(_0x3e76f0){while(--_0x3e76f0){_0x316e41['push'](_0x316e41['shift']());}};_0x470edf(++_0x4fe79d);}(_0xadec,0x156));var _0xcade=function(_0x23895f,_0x43e4a9){_0x23895f=_0x23895f-0x0;var _0x39cfc9=_0xadec[_0x23895f];return _0x39cfc9;};'use strict';var attributes=require(_0xcade('0x0'));module[_0xcade('0x1')]=function(_0x11d900,_0x210817){return _0x11d900[_0xcade('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcade('0x3')]},{'name':_0xcade('0x4'),'fields':[_0xcade('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c8ad46f..8384954 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 _0x77e6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','options','raw','attributes','limit','UpdateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x77e6,0x1a6));var _0x677e=function(_0x733135,_0x433b1f){_0x733135=_0x733135-0x0;var _0x352277=_0x77e6[_0x733135];return _0x352277;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});}exports['UpdateVoiceRecording']=function(_0x1c5124){var _0x2ef2bf=this;return new Promise(function(_0x385b06,_0x221b6d){return db[_0x677e('0x18')][_0x677e('0x19')](_0x1c5124['body'],{'raw':_0x1c5124[_0x677e('0x1a')]?_0x1c5124['options'][_0x677e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')]['where']||null:null,'attributes':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1c')]||null:null,'limit':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1d')]||null:null})[_0x677e('0xc')](function(_0x52ee8b){logger['info']('UpdateVoiceRecording',_0x1c5124);logger[_0x677e('0xf')](_0x677e('0x1e'),_0x1c5124,JSON[_0x677e('0x11')](_0x52ee8b));_0x385b06(_0x52ee8b);})[_0x677e('0x17')](function(_0x424e5d){logger[_0x677e('0x12')](_0x677e('0x1e'),_0x424e5d[_0x677e('0x15')],_0x1c5124);_0x221b6d(_0x2ef2bf[_0x677e('0x12')](0x1f4,_0x424e5d[_0x677e('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x5f0ba2){var _0x3d3370=this;return new Promise(function(_0x184f68,_0x4d9e0b){var _0x51e39d=require(_0x677e('0x1f'));var _0xf6b3ad;return db[_0x677e('0x20')][_0x677e('0x21')]({'attributes':['id',_0x677e('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0xcd4646){_0xf6b3ad=_0xcd4646;return db[_0x677e('0x18')][_0x677e('0x23')](_0x5f0ba2[_0x677e('0x24')]);})[_0x677e('0xc')](function(_0x2bd6fb){if(_0xf6b3ad[_0x677e('0x22')]&&fs[_0x677e('0x25')](_0x2bd6fb[_0x677e('0x26')])){var _0x4c5113=util[_0x677e('0x27')](_0x677e('0x28'),_0x2bd6fb[_0x677e('0x26')]);return _0x51e39d[_0x677e('0x29')](_0x2bd6fb[_0x677e('0x26')],_0x4c5113,config[_0x677e('0x2a')][_0x677e('0x2b')])[_0x677e('0xc')](function(){fs[_0x677e('0x2c')](_0x2bd6fb[_0x677e('0x26')]);logger['info'](_0x677e('0x2d'));return _0x2bd6fb;});}return _0x2bd6fb;})[_0x677e('0xc')](function(_0x2b6f24){logger[_0x677e('0xd')](_0x677e('0x2e'),_0x5f0ba2);logger[_0x677e('0xf')]('CreateVoiceRecording',_0x5f0ba2,JSON[_0x677e('0x11')](_0x2b6f24));_0x184f68(_0x2b6f24);})[_0x677e('0x17')](function(_0x2d0bc0){logger['error'](_0x677e('0x2e'),_0x2d0bc0[_0x677e('0x15')],_0x5f0ba2);_0x4d9e0b(_0x3d3370[_0x677e('0x12')](0x1f4,_0x2d0bc0[_0x677e('0x15')]));});});}; \ No newline at end of file +var _0x6a55=['callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateVoiceRecording','update','body','options','where','limit','findOne'];(function(_0x142e26,_0x57c340){var _0x5d13af=function(_0x4802c6){while(--_0x4802c6){_0x142e26['push'](_0x142e26['shift']());}};_0x5d13af(++_0x57c340);}(_0x6a55,0xdb));var _0x56a5=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x6a55[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});}exports[_0x56a5('0x13')]=function(_0x28fe74){var _0x1ba472=this;return new Promise(function(_0x143f3d,_0x1dddec){return db['VoiceRecording'][_0x56a5('0x14')](_0x28fe74[_0x56a5('0x15')],{'raw':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x17')]||null:null,'attributes':_0x28fe74[_0x56a5('0x16')]?_0x28fe74[_0x56a5('0x16')]['attributes']||null:null,'limit':_0x28fe74['options']?_0x28fe74[_0x56a5('0x16')][_0x56a5('0x18')]||null:null})['then'](function(_0x1556eb){logger[_0x56a5('0x8')](_0x56a5('0x13'),_0x28fe74);logger[_0x56a5('0xb')](_0x56a5('0x13'),_0x28fe74,JSON[_0x56a5('0xd')](_0x1556eb));_0x143f3d(_0x1556eb);})[_0x56a5('0x12')](function(_0x8431df){logger[_0x56a5('0xf')](_0x56a5('0x13'),_0x8431df[_0x56a5('0x10')],_0x28fe74);_0x1dddec(_0x1ba472[_0x56a5('0xf')](0x1f4,_0x8431df[_0x56a5('0x10')]));});});};exports['CreateVoiceRecording']=function(_0x5c76a7){var _0x2d8e68=this;return new Promise(function(_0x42cd45,_0x2706f9){var _0x43a815=require('../../components/encryptor');var _0x18e863;return db['Setting'][_0x56a5('0x19')]({'attributes':['id',_0x56a5('0x1a')],'where':{'id':0x1},'raw':!![]})[_0x56a5('0x7')](function(_0x284ee5){_0x18e863=_0x284ee5;return db['VoiceRecording'][_0x56a5('0x1b')](_0x5c76a7[_0x56a5('0x15')]);})[_0x56a5('0x7')](function(_0x51ef6f){if(_0x18e863[_0x56a5('0x1a')]&&fs[_0x56a5('0x1c')](_0x51ef6f[_0x56a5('0x1d')])){var _0x214649=util[_0x56a5('0x1e')]('%s.cypher',_0x51ef6f[_0x56a5('0x1d')]);return _0x43a815[_0x56a5('0x1f')](_0x51ef6f[_0x56a5('0x1d')],_0x214649,config[_0x56a5('0x20')][_0x56a5('0x21')])['then'](function(){fs['unlink'](_0x51ef6f[_0x56a5('0x1d')]);logger[_0x56a5('0x8')](_0x56a5('0x22'));return _0x51ef6f;});}return _0x51ef6f;})['then'](function(_0x1de021){logger[_0x56a5('0x8')]('CreateVoiceRecording',_0x5c76a7);logger['debug']('CreateVoiceRecording',_0x5c76a7,JSON['stringify'](_0x1de021));_0x42cd45(_0x1de021);})[_0x56a5('0x12')](function(_0x29c8f1){logger[_0x56a5('0xf')]('CreateVoiceRecording',_0x29c8f1[_0x56a5('0x10')],_0x5c76a7);_0x2706f9(_0x2d8e68['error'](0x1f4,_0x29c8f1[_0x56a5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8585226..eed777a 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 _0x8b68=['destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','get','/:id','create','put','update'];(function(_0x14be10,_0xd28b15){var _0xbb393c=function(_0x4691be){while(--_0x4691be){_0x14be10['push'](_0x14be10['shift']());}};_0xbb393c(++_0xd28b15);}(_0x8b68,0x1b5));var _0x88b6=function(_0x1e52aa,_0x5b2829){_0x1e52aa=_0x1e52aa-0x0;var _0x50a76a=_0x8b68[_0x1e52aa];return _0x50a76a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x88b6('0x0'));var timeout=require('connect-timeout');var express=require(_0x88b6('0x1'));var router=express['Router']();var fs_extra=require(_0x88b6('0x2'));var auth=require(_0x88b6('0x3'));var interaction=require(_0x88b6('0x4'));var config=require(_0x88b6('0x5'));var controller=require(_0x88b6('0x6'));router['get']('/',auth[_0x88b6('0x7')](),controller['index']);router[_0x88b6('0x8')]('/describe',auth[_0x88b6('0x7')](),controller['describe']);router[_0x88b6('0x8')](_0x88b6('0x9'),auth[_0x88b6('0x7')](),controller['show']);router['post']('/',auth[_0x88b6('0x7')](),controller[_0x88b6('0xa')]);router[_0x88b6('0xb')](_0x88b6('0x9'),auth['isAuthenticated'](),controller[_0x88b6('0xc')]);router['delete'](_0x88b6('0x9'),auth[_0x88b6('0x7')](),controller[_0x88b6('0xd')]);module[_0x88b6('0xe')]=router; \ No newline at end of file +var _0xad02=['get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','path','express','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x16ff13,_0x574da6){var _0x167afd=function(_0x183173){while(--_0x183173){_0x16ff13['push'](_0x16ff13['shift']());}};_0x167afd(++_0x574da6);}(_0xad02,0x93));var _0x2ad0=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0xad02[_0x329d13];return _0x33efd9;};'use strict';var multer=require(_0x2ad0('0x0'));var util=require('util');var path=require(_0x2ad0('0x1'));var timeout=require('connect-timeout');var express=require(_0x2ad0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2ad0('0x3'));var config=require(_0x2ad0('0x4'));var controller=require(_0x2ad0('0x5'));router[_0x2ad0('0x6')]('/',auth[_0x2ad0('0x7')](),controller['index']);router[_0x2ad0('0x6')](_0x2ad0('0x8'),auth['isAuthenticated'](),controller[_0x2ad0('0x9')]);router[_0x2ad0('0x6')](_0x2ad0('0xa'),auth['isAuthenticated'](),controller[_0x2ad0('0xb')]);router[_0x2ad0('0xc')]('/',auth[_0x2ad0('0x7')](),controller[_0x2ad0('0xd')]);router['put'](_0x2ad0('0xa'),auth[_0x2ad0('0x7')](),controller['update']);router[_0x2ad0('0xe')](_0x2ad0('0xa'),auth[_0x2ad0('0x7')](),controller[_0x2ad0('0xf')]);module[_0x2ad0('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 d8f2597..0e4b24a 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 _0x37b2=['ENUM','attended','STRING','Yes','sequelize','exports'];(function(_0x2bba9a,_0x2baa5c){var _0x2cd8df=function(_0x5ee111){while(--_0x5ee111){_0x2bba9a['push'](_0x2bba9a['shift']());}};_0x2cd8df(++_0x2baa5c);}(_0x37b2,0x166));var _0x237b=function(_0x2ac3dd,_0x3bc187){_0x2ac3dd=_0x2ac3dd-0x0;var _0x487a05=_0x37b2[_0x2ac3dd];return _0x487a05;};'use strict';var Sequelize=require(_0x237b('0x0'));var moment=require('moment');module[_0x237b('0x1')]={'type':{'type':Sequelize[_0x237b('0x2')]('blind',_0x237b('0x3'))},'result':{'type':Sequelize[_0x237b('0x4')]},'transfererchannel':{'type':Sequelize[_0x237b('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x237b('0x4')]},'transferercalleridname':{'type':Sequelize[_0x237b('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x237b('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x237b('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x237b('0x4')]},'transferercontext':{'type':Sequelize[_0x237b('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x237b('0x4')]},'transfereechannel':{'type':Sequelize[_0x237b('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x237b('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x237b('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x237b('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x237b('0x4')]},'transfereecontext':{'type':Sequelize[_0x237b('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x237b('0x2')](_0x237b('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x237b('0x4')]}}; \ No newline at end of file +var _0xf7ad=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x264ab8,_0xed577d){var _0x175c53=function(_0x58bfbb){while(--_0x58bfbb){_0x264ab8['push'](_0x264ab8['shift']());}};_0x175c53(++_0xed577d);}(_0xf7ad,0x1d6));var _0xdf7a=function(_0x5e44f9,_0x41cdad){_0x5e44f9=_0x5e44f9-0x0;var _0x213979=_0xf7ad[_0x5e44f9];return _0x213979;};'use strict';var Sequelize=require(_0xdf7a('0x0'));var moment=require(_0xdf7a('0x1'));module[_0xdf7a('0x2')]={'type':{'type':Sequelize[_0xdf7a('0x3')](_0xdf7a('0x4'),_0xdf7a('0x5'))},'result':{'type':Sequelize[_0xdf7a('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xdf7a('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xdf7a('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xdf7a('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xdf7a('0x6')]},'transferercontext':{'type':Sequelize[_0xdf7a('0x6')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xdf7a('0x6')]},'transfereechannel':{'type':Sequelize[_0xdf7a('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xdf7a('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xdf7a('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xdf7a('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xdf7a('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xdf7a('0x6')]},'transfereecontext':{'type':Sequelize[_0xdf7a('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xdf7a('0x3')](_0xdf7a('0x7'),'No')},'context':{'type':Sequelize[_0xdf7a('0x6')]},'extension':{'type':Sequelize[_0xdf7a('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 4aa6341..0a96c0b 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 _0x49d6=['index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','then','rows','catch','find','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','offset','count','Content-Range','apply','reject','error','stack','name'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x49d6,0x69));var _0x649d=function(_0x17c140,_0x66f2af){_0x17c140=_0x17c140-0x0;var _0x57598e=_0x49d6[_0x17c140];return _0x57598e;};'use strict';var emlformat=require(_0x649d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x649d('0x1'));var jsonpatch=require(_0x649d('0x2'));var rp=require('request-promise');var moment=require(_0x649d('0x3'));var BPromise=require(_0x649d('0x4'));var Mustache=require(_0x649d('0x5'));var util=require(_0x649d('0x6'));var path=require(_0x649d('0x7'));var sox=require(_0x649d('0x8'));var csv=require(_0x649d('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(_0x649d('0xa'));var jsforce=require(_0x649d('0xb'));var deskjs=require(_0x649d('0xc'));var toCsv=require(_0x649d('0x9'));var querystring=require(_0x649d('0xd'));var Papa=require(_0x649d('0xe'));var Redis=require(_0x649d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x649d('0x10'));var as=require(_0x649d('0x11'));var hardwareService=require(_0x649d('0x12'));var logger=require('../../config/logger')(_0x649d('0x13'));var utils=require('../../config/utils');var config=require(_0x649d('0x14'));var licenseUtil=require(_0x649d('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cc34d,_0xba24ff){_0xba24ff=_0xba24ff||0xcc;return function(_0x3a0570){if(_0x3a0570){return _0x2cc34d[_0x649d('0x16')](_0xba24ff);}return _0x2cc34d['status'](_0xba24ff)[_0x649d('0x17')]();};}function respondWithResult(_0x37829e,_0x2591b8){_0x2591b8=_0x2591b8||0xc8;return function(_0x121aac){if(_0x121aac){return _0x37829e[_0x649d('0x18')](_0x2591b8)['json'](_0x121aac);}};}function respondWithFilteredResult(_0x181244,_0x23e437){return function(_0x532039){if(_0x532039){var _0x54dbda=typeof _0x23e437['offset']===_0x649d('0x19')&&typeof _0x23e437[_0x649d('0x1a')]===_0x649d('0x19');var _0x10c88b=_0x532039['count'];var _0x4affb7=_0x54dbda?0x0:_0x23e437[_0x649d('0x1b')];var _0xd7e4c8=_0x54dbda?_0x532039[_0x649d('0x1c')]:_0x23e437['offset']+_0x23e437['limit'];var _0x1c5829;if(_0xd7e4c8>=_0x10c88b){_0xd7e4c8=_0x10c88b;_0x1c5829=0xc8;}else{_0x1c5829=0xce;}_0x181244[_0x649d('0x18')](_0x1c5829);return _0x181244['set'](_0x649d('0x1d'),_0x4affb7+'-'+_0xd7e4c8+'/'+_0x10c88b)['json'](_0x532039);}return null;};}function patchUpdates(_0x390c81){return function(_0x244032){try{jsonpatch[_0x649d('0x1e')](_0x244032,_0x390c81,!![]);}catch(_0x5a475e){return BPromise[_0x649d('0x1f')](_0x5a475e);}return _0x244032['save']();};}function saveUpdates(_0x143db7,_0x250538){return function(_0x22ee4b){if(_0x22ee4b){return _0x22ee4b['update'](_0x143db7)['then'](function(_0x25e884){return _0x25e884;});}return null;};}function removeEntity(_0x24d16f,_0x4273a0){return function(_0x5274b9){if(_0x5274b9){return _0x5274b9['destroy']()['then'](function(){_0x24d16f[_0x649d('0x18')](0xcc)[_0x649d('0x17')]();});}};}function handleEntityNotFound(_0x5900c4,_0x86a717){return function(_0x2286a3){if(!_0x2286a3){_0x5900c4[_0x649d('0x16')](0x194);}return _0x2286a3;};}function handleError(_0x2022af,_0x4e03b7){_0x4e03b7=_0x4e03b7||0x1f4;return function(_0x1c110e){logger[_0x649d('0x20')](_0x1c110e[_0x649d('0x21')]);if(_0x1c110e[_0x649d('0x22')]){delete _0x1c110e[_0x649d('0x22')];}_0x2022af[_0x649d('0x18')](_0x4e03b7)['send'](_0x1c110e);};}exports[_0x649d('0x23')]=function(_0x47dcf8,_0x504543){var _0x27b63f={},_0x153fc0={},_0x10fd32={'count':0x0,'rows':[]};var _0x116fb9=_[_0x649d('0x24')](db[_0x649d('0x25')][_0x649d('0x26')],function(_0x5146df){return{'name':_0x5146df[_0x649d('0x27')],'type':_0x5146df[_0x649d('0x28')][_0x649d('0x29')]};});_0x153fc0[_0x649d('0x2a')]=_[_0x649d('0x24')](_0x116fb9,'name');_0x153fc0[_0x649d('0x2b')]=_[_0x649d('0x2c')](_0x47dcf8[_0x649d('0x2b')]);_0x153fc0[_0x649d('0x2d')]=_[_0x649d('0x2e')](_0x153fc0[_0x649d('0x2a')],_0x153fc0[_0x649d('0x2b')]);_0x27b63f['attributes']=_[_0x649d('0x2e')](_0x153fc0[_0x649d('0x2a')],qs[_0x649d('0x2f')](_0x47dcf8[_0x649d('0x2b')][_0x649d('0x2f')]));_0x27b63f['attributes']=_0x27b63f[_0x649d('0x30')][_0x649d('0x31')]?_0x27b63f['attributes']:_0x153fc0[_0x649d('0x2a')];if(!_0x47dcf8[_0x649d('0x2b')][_0x649d('0x32')](_0x649d('0x33'))){_0x27b63f['limit']=qs[_0x649d('0x1a')](_0x47dcf8[_0x649d('0x2b')][_0x649d('0x1a')]);_0x27b63f['offset']=qs[_0x649d('0x1b')](_0x47dcf8[_0x649d('0x2b')][_0x649d('0x1b')]);}_0x27b63f[_0x649d('0x34')]=qs['sort'](_0x47dcf8[_0x649d('0x2b')][_0x649d('0x35')]);_0x27b63f[_0x649d('0x36')]=qs[_0x649d('0x2d')](_['pick'](_0x47dcf8[_0x649d('0x2b')],_0x153fc0[_0x649d('0x2d')]),_0x116fb9);if(_0x47dcf8[_0x649d('0x2b')][_0x649d('0x37')]){_0x27b63f['where']=_[_0x649d('0x38')](_0x27b63f['where'],{'$or':_[_0x649d('0x24')](_0x116fb9,function(_0x209e0f){if(_0x209e0f[_0x649d('0x28')]!==_0x649d('0x39')){var _0x6c0dbf={};_0x6c0dbf[_0x209e0f[_0x649d('0x22')]]={'$like':'%'+_0x47dcf8[_0x649d('0x2b')]['filter']+'%'};return _0x6c0dbf;}})});}_0x27b63f=_[_0x649d('0x38')]({},_0x27b63f,_0x47dcf8[_0x649d('0x3a')]);var _0x5923ff={'where':_0x27b63f['where']};return db[_0x649d('0x25')][_0x649d('0x1c')](_0x5923ff)['then'](function(_0x398b31){_0x10fd32[_0x649d('0x1c')]=_0x398b31;if(_0x47dcf8['query'][_0x649d('0x3b')]){_0x27b63f[_0x649d('0x3c')]=[{'all':!![]}];}return db[_0x649d('0x25')]['findAll'](_0x27b63f);})[_0x649d('0x3d')](function(_0x55776f){_0x10fd32[_0x649d('0x3e')]=_0x55776f;return _0x10fd32;})[_0x649d('0x3d')](respondWithFilteredResult(_0x504543,_0x27b63f))[_0x649d('0x3f')](handleError(_0x504543,null));};exports['show']=function(_0x140b9a,_0x5e3dca){var _0x55f2fa={'raw':!![],'where':{'id':_0x140b9a['params']['id']}},_0x10793f={};_0x10793f[_0x649d('0x2a')]=_[_0x649d('0x2c')](db[_0x649d('0x25')][_0x649d('0x26')]);_0x10793f[_0x649d('0x2b')]=_[_0x649d('0x2c')](_0x140b9a[_0x649d('0x2b')]);_0x10793f[_0x649d('0x2d')]=_['intersection'](_0x10793f['model'],_0x10793f['query']);_0x55f2fa['attributes']=_[_0x649d('0x2e')](_0x10793f['model'],qs[_0x649d('0x2f')](_0x140b9a[_0x649d('0x2b')][_0x649d('0x2f')]));_0x55f2fa[_0x649d('0x30')]=_0x55f2fa[_0x649d('0x30')]['length']?_0x55f2fa[_0x649d('0x30')]:_0x10793f[_0x649d('0x2a')];if(_0x140b9a[_0x649d('0x2b')][_0x649d('0x3b')]){_0x55f2fa['include']=[{'all':!![]}];}_0x55f2fa=_['merge']({},_0x55f2fa,_0x140b9a['options']);return db['VoiceTransferReport'][_0x649d('0x40')](_0x55f2fa)[_0x649d('0x3d')](handleEntityNotFound(_0x5e3dca,null))[_0x649d('0x3d')](respondWithResult(_0x5e3dca,null))[_0x649d('0x3f')](handleError(_0x5e3dca,null));};exports[_0x649d('0x41')]=function(_0x57d0b7,_0x2dd9af){return db[_0x649d('0x25')][_0x649d('0x41')](_0x57d0b7[_0x649d('0x42')],{})['then'](respondWithResult(_0x2dd9af,0xc9))[_0x649d('0x3f')](handleError(_0x2dd9af,null));};exports[_0x649d('0x43')]=function(_0x34c44f,_0x449e4d){if(_0x34c44f['body']['id']){delete _0x34c44f['body']['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x34c44f[_0x649d('0x44')]['id']}})[_0x649d('0x3d')](handleEntityNotFound(_0x449e4d,null))[_0x649d('0x3d')](saveUpdates(_0x34c44f[_0x649d('0x42')],null))[_0x649d('0x3d')](respondWithResult(_0x449e4d,null))[_0x649d('0x3f')](handleError(_0x449e4d,null));};exports['destroy']=function(_0x1970bc,_0x2d44b3){return db[_0x649d('0x25')][_0x649d('0x40')]({'where':{'id':_0x1970bc['params']['id']}})[_0x649d('0x3d')](handleEntityNotFound(_0x2d44b3,null))[_0x649d('0x3d')](removeEntity(_0x2d44b3,null))[_0x649d('0x3f')](handleError(_0x2d44b3,null));};exports[_0x649d('0x45')]=function(_0x459548,_0xb0f34){return db['VoiceTransferReport'][_0x649d('0x45')]()['then'](respondWithResult(_0xb0f34,null))[_0x649d('0x3f')](handleError(_0xb0f34,null));}; \ No newline at end of file +var _0x23f9=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','include','rows','catch','show','params','options','find','create','body','update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../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','reject','save','then','error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x23f9,0x1db));var _0x923f=function(_0x351a39,_0x524d1a){_0x351a39=_0x351a39-0x0;var _0x528de0=_0x23f9[_0x351a39];return _0x528de0;};'use strict';var emlformat=require(_0x923f('0x0'));var rimraf=require(_0x923f('0x1'));var zipdir=require(_0x923f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x923f('0x3'));var moment=require(_0x923f('0x4'));var BPromise=require(_0x923f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x923f('0x6'));var sox=require(_0x923f('0x7'));var csv=require('to-csv');var ejs=require(_0x923f('0x8'));var fs=require('fs');var fs_extra=require(_0x923f('0x9'));var _=require(_0x923f('0xa'));var squel=require(_0x923f('0xb'));var crypto=require(_0x923f('0xc'));var jsforce=require(_0x923f('0xd'));var deskjs=require(_0x923f('0xe'));var toCsv=require(_0x923f('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x923f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x923f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x923f('0x12'))(_0x923f('0x13'));var utils=require(_0x923f('0x14'));var config=require(_0x923f('0x15'));var licenseUtil=require(_0x923f('0x16'));var db=require(_0x923f('0x17'))['db'];function respondWithStatusCode(_0x45e65d,_0x25902d){_0x25902d=_0x25902d||0xcc;return function(_0x1103f0){if(_0x1103f0){return _0x45e65d[_0x923f('0x18')](_0x25902d);}return _0x45e65d[_0x923f('0x19')](_0x25902d)[_0x923f('0x1a')]();};}function respondWithResult(_0x4b0282,_0x5dddd5){_0x5dddd5=_0x5dddd5||0xc8;return function(_0xad2ef6){if(_0xad2ef6){return _0x4b0282[_0x923f('0x19')](_0x5dddd5)[_0x923f('0x1b')](_0xad2ef6);}};}function respondWithFilteredResult(_0xfb4202,_0x28c4d3){return function(_0x32bb07){if(_0x32bb07){var _0x245178=typeof _0x28c4d3[_0x923f('0x1c')]===_0x923f('0x1d')&&typeof _0x28c4d3[_0x923f('0x1e')]===_0x923f('0x1d');var _0x362ccd=_0x32bb07[_0x923f('0x1f')];var _0x1aa5ef=_0x245178?0x0:_0x28c4d3['offset'];var _0x58b297=_0x245178?_0x32bb07[_0x923f('0x1f')]:_0x28c4d3[_0x923f('0x1c')]+_0x28c4d3[_0x923f('0x1e')];var _0x254b24;if(_0x58b297>=_0x362ccd){_0x58b297=_0x362ccd;_0x254b24=0xc8;}else{_0x254b24=0xce;}_0xfb4202[_0x923f('0x19')](_0x254b24);return _0xfb4202[_0x923f('0x20')](_0x923f('0x21'),_0x1aa5ef+'-'+_0x58b297+'/'+_0x362ccd)[_0x923f('0x1b')](_0x32bb07);}return null;};}function patchUpdates(_0x4143ca){return function(_0x438f71){try{jsonpatch['apply'](_0x438f71,_0x4143ca,!![]);}catch(_0x3bd137){return BPromise[_0x923f('0x22')](_0x3bd137);}return _0x438f71[_0x923f('0x23')]();};}function saveUpdates(_0x9979d7,_0x446e4a){return function(_0x33505f){if(_0x33505f){return _0x33505f['update'](_0x9979d7)['then'](function(_0x40e78f){return _0x40e78f;});}return null;};}function removeEntity(_0x3dd997,_0x278f27){return function(_0x4be4e3){if(_0x4be4e3){return _0x4be4e3['destroy']()[_0x923f('0x24')](function(){_0x3dd997[_0x923f('0x19')](0xcc)[_0x923f('0x1a')]();});}};}function handleEntityNotFound(_0xef6a24,_0x2cda36){return function(_0x3801f6){if(!_0x3801f6){_0xef6a24[_0x923f('0x18')](0x194);}return _0x3801f6;};}function handleError(_0x528a5c,_0x1f2863){_0x1f2863=_0x1f2863||0x1f4;return function(_0x428b1f){logger[_0x923f('0x25')](_0x428b1f[_0x923f('0x26')]);if(_0x428b1f[_0x923f('0x27')]){delete _0x428b1f[_0x923f('0x27')];}_0x528a5c[_0x923f('0x19')](_0x1f2863)[_0x923f('0x28')](_0x428b1f);};}exports[_0x923f('0x29')]=function(_0x3b89ff,_0x5e60aa){var _0x55635a={},_0x2bda24={},_0x43c2fd={'count':0x0,'rows':[]};var _0xc99d27=_['map'](db[_0x923f('0x2a')][_0x923f('0x2b')],function(_0x208978){return{'name':_0x208978[_0x923f('0x2c')],'type':_0x208978[_0x923f('0x2d')][_0x923f('0x2e')]};});_0x2bda24['model']=_[_0x923f('0x2f')](_0xc99d27,'name');_0x2bda24[_0x923f('0x30')]=_[_0x923f('0x31')](_0x3b89ff[_0x923f('0x30')]);_0x2bda24[_0x923f('0x32')]=_[_0x923f('0x33')](_0x2bda24[_0x923f('0x34')],_0x2bda24[_0x923f('0x30')]);_0x55635a['attributes']=_[_0x923f('0x33')](_0x2bda24[_0x923f('0x34')],qs[_0x923f('0x35')](_0x3b89ff[_0x923f('0x30')][_0x923f('0x35')]));_0x55635a['attributes']=_0x55635a[_0x923f('0x36')][_0x923f('0x37')]?_0x55635a[_0x923f('0x36')]:_0x2bda24['model'];if(!_0x3b89ff[_0x923f('0x30')][_0x923f('0x38')](_0x923f('0x39'))){_0x55635a[_0x923f('0x1e')]=qs[_0x923f('0x1e')](_0x3b89ff[_0x923f('0x30')][_0x923f('0x1e')]);_0x55635a[_0x923f('0x1c')]=qs[_0x923f('0x1c')](_0x3b89ff[_0x923f('0x30')][_0x923f('0x1c')]);}_0x55635a[_0x923f('0x3a')]=qs[_0x923f('0x3b')](_0x3b89ff[_0x923f('0x30')][_0x923f('0x3b')]);_0x55635a[_0x923f('0x3c')]=qs[_0x923f('0x32')](_[_0x923f('0x3d')](_0x3b89ff[_0x923f('0x30')],_0x2bda24[_0x923f('0x32')]),_0xc99d27);if(_0x3b89ff[_0x923f('0x30')]['filter']){_0x55635a['where']=_['merge'](_0x55635a[_0x923f('0x3c')],{'$or':_[_0x923f('0x2f')](_0xc99d27,function(_0x50f104){if(_0x50f104[_0x923f('0x2d')]!==_0x923f('0x3e')){var _0x4fd537={};_0x4fd537[_0x50f104['name']]={'$like':'%'+_0x3b89ff[_0x923f('0x30')]['filter']+'%'};return _0x4fd537;}})});}_0x55635a=_[_0x923f('0x3f')]({},_0x55635a,_0x3b89ff['options']);var _0x4e3447={'where':_0x55635a[_0x923f('0x3c')]};return db[_0x923f('0x2a')][_0x923f('0x1f')](_0x4e3447)[_0x923f('0x24')](function(_0x141afe){_0x43c2fd[_0x923f('0x1f')]=_0x141afe;if(_0x3b89ff[_0x923f('0x30')]['includeAll']){_0x55635a[_0x923f('0x40')]=[{'all':!![]}];}return db[_0x923f('0x2a')]['findAll'](_0x55635a);})['then'](function(_0x6f4ab6){_0x43c2fd[_0x923f('0x41')]=_0x6f4ab6;return _0x43c2fd;})[_0x923f('0x24')](respondWithFilteredResult(_0x5e60aa,_0x55635a))[_0x923f('0x42')](handleError(_0x5e60aa,null));};exports[_0x923f('0x43')]=function(_0x475356,_0xf3ccd0){var _0x4ec682={'raw':!![],'where':{'id':_0x475356[_0x923f('0x44')]['id']}},_0x5f356d={};_0x5f356d['model']=_['keys'](db[_0x923f('0x2a')][_0x923f('0x2b')]);_0x5f356d[_0x923f('0x30')]=_['keys'](_0x475356[_0x923f('0x30')]);_0x5f356d[_0x923f('0x32')]=_[_0x923f('0x33')](_0x5f356d[_0x923f('0x34')],_0x5f356d[_0x923f('0x30')]);_0x4ec682['attributes']=_[_0x923f('0x33')](_0x5f356d[_0x923f('0x34')],qs[_0x923f('0x35')](_0x475356[_0x923f('0x30')][_0x923f('0x35')]));_0x4ec682[_0x923f('0x36')]=_0x4ec682[_0x923f('0x36')][_0x923f('0x37')]?_0x4ec682[_0x923f('0x36')]:_0x5f356d[_0x923f('0x34')];if(_0x475356[_0x923f('0x30')]['includeAll']){_0x4ec682[_0x923f('0x40')]=[{'all':!![]}];}_0x4ec682=_['merge']({},_0x4ec682,_0x475356[_0x923f('0x45')]);return db[_0x923f('0x2a')][_0x923f('0x46')](_0x4ec682)[_0x923f('0x24')](handleEntityNotFound(_0xf3ccd0,null))[_0x923f('0x24')](respondWithResult(_0xf3ccd0,null))[_0x923f('0x42')](handleError(_0xf3ccd0,null));};exports[_0x923f('0x47')]=function(_0xb8e8d9,_0x2b380d){return db[_0x923f('0x2a')][_0x923f('0x47')](_0xb8e8d9[_0x923f('0x48')],{})[_0x923f('0x24')](respondWithResult(_0x2b380d,0xc9))[_0x923f('0x42')](handleError(_0x2b380d,null));};exports[_0x923f('0x49')]=function(_0x41904c,_0x236f2f){if(_0x41904c[_0x923f('0x48')]['id']){delete _0x41904c[_0x923f('0x48')]['id'];}return db[_0x923f('0x2a')][_0x923f('0x46')]({'where':{'id':_0x41904c['params']['id']}})[_0x923f('0x24')](handleEntityNotFound(_0x236f2f,null))['then'](saveUpdates(_0x41904c[_0x923f('0x48')],null))[_0x923f('0x24')](respondWithResult(_0x236f2f,null))[_0x923f('0x42')](handleError(_0x236f2f,null));};exports[_0x923f('0x4a')]=function(_0x8f512,_0x1ac1de){return db[_0x923f('0x2a')][_0x923f('0x46')]({'where':{'id':_0x8f512[_0x923f('0x44')]['id']}})[_0x923f('0x24')](handleEntityNotFound(_0x1ac1de,null))[_0x923f('0x24')](removeEntity(_0x1ac1de,null))[_0x923f('0x42')](handleError(_0x1ac1de,null));};exports['describe']=function(_0x1af6c9,_0x42e504){return db[_0x923f('0x2a')]['describe']()['then'](respondWithResult(_0x42e504,null))[_0x923f('0x42')](handleError(_0x42e504,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 5568d6b..8bea0a9 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 _0xbac0=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xbac0,0x126));var _0x0bac=function(_0x289874,_0x1b6752){_0x289874=_0x289874-0x0;var _0x2f8bbb=_0xbac0[_0x289874];return _0x2f8bbb;};'use strict';var _=require(_0x0bac('0x0'));var util=require('util');var logger=require(_0x0bac('0x1'))('api');var moment=require(_0x0bac('0x2'));var BPromise=require(_0x0bac('0x3'));var rp=require(_0x0bac('0x4'));var fs=require('fs');var path=require(_0x0bac('0x5'));var rimraf=require(_0x0bac('0x6'));var config=require(_0x0bac('0x7'));var attributes=require(_0x0bac('0x8'));module[_0x0bac('0x9')]=function(_0x4f011d,_0x3795a4){return _0x4f011d['define'](_0x0bac('0xa'),attributes,{'tableName':_0x0bac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14e0=['./voiceTransferReport.attributes','define','report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x42ba1f,_0x19529f){var _0x25d6f1=function(_0x101699){while(--_0x101699){_0x42ba1f['push'](_0x42ba1f['shift']());}};_0x25d6f1(++_0x19529f);}(_0x14e0,0x189));var _0x014e=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0x14e0[_0x2a4095];return _0x52eeab;};'use strict';var _=require(_0x014e('0x0'));var util=require(_0x014e('0x1'));var logger=require(_0x014e('0x2'))(_0x014e('0x3'));var moment=require(_0x014e('0x4'));var BPromise=require('bluebird');var rp=require(_0x014e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x014e('0x6'));var config=require('../../config/environment');var attributes=require(_0x014e('0x7'));module['exports']=function(_0x24a5e6,_0x512638){return _0x24a5e6[_0x014e('0x8')]('VoiceTransferReport',attributes,{'tableName':_0x014e('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 218fbe9..710fc46 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 _0xf37a=['rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateVoiceTransferReport','create','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x17418e,_0x3d28fd){var _0x58fea4=function(_0x1ce19c){while(--_0x1ce19c){_0x17418e['push'](_0x17418e['shift']());}};_0x58fea4(++_0x3d28fd);}(_0xf37a,0x131));var _0xaf37=function(_0x3e45b1,_0x62c209){_0x3e45b1=_0x3e45b1-0x0;var _0x1ef1bf=_0xf37a[_0x3e45b1];return _0x1ef1bf;};'use strict';var _=require('lodash');var util=require(_0xaf37('0x0'));var moment=require(_0xaf37('0x1'));var BPromise=require(_0xaf37('0x2'));var rs=require(_0xaf37('0x3'));var fs=require('fs');var Redis=require(_0xaf37('0x4'));var db=require(_0xaf37('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf37('0x6'))(_0xaf37('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf37('0x8'));var client=jayson[_0xaf37('0x9')][_0xaf37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4535c5,_0x4aa509,_0x4a95c3){return new BPromise(function(_0x1f6fc5,_0x5d6d00){return client[_0xaf37('0xb')](_0x4535c5,_0x4a95c3)[_0xaf37('0xc')](function(_0x5db324){logger[_0xaf37('0xd')](_0xaf37('0xe'),_0x4aa509,_0xaf37('0xf'));logger[_0xaf37('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4aa509,'request\x20sent',JSON[_0xaf37('0x11')](_0x5db324));if(_0x5db324[_0xaf37('0x12')]){if(_0x5db324[_0xaf37('0x12')][_0xaf37('0x13')]===0x1f4){logger[_0xaf37('0x12')](_0xaf37('0xe'),_0x4aa509,_0x5db324[_0xaf37('0x12')][_0xaf37('0x14')]);return _0x5d6d00(_0x5db324[_0xaf37('0x12')]['message']);}logger[_0xaf37('0x12')](_0xaf37('0xe'),_0x4aa509,_0x5db324['error'][_0xaf37('0x14')]);return _0x1f6fc5(_0x5db324[_0xaf37('0x12')][_0xaf37('0x14')]);}else{logger[_0xaf37('0xd')](_0xaf37('0xe'),_0x4aa509,'request\x20sent');_0x1f6fc5(_0x5db324['result'][_0xaf37('0x14')]);}})['catch'](function(_0x49b966){logger[_0xaf37('0x12')](_0xaf37('0xe'),_0x4aa509,_0x49b966);_0x5d6d00(_0x49b966);});});}exports[_0xaf37('0x15')]=function(_0x1e184f){var _0x244ec8=this;return new Promise(function(_0x2bfcde,_0x24fdbb){return db['VoiceTransferReport'][_0xaf37('0x16')](_0x1e184f['body'],{'raw':_0x1e184f['options']?_0x1e184f[_0xaf37('0x17')][_0xaf37('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2a3df1){logger[_0xaf37('0xd')](_0xaf37('0x15'),_0x1e184f);logger['debug'](_0xaf37('0x15'),_0x1e184f,JSON[_0xaf37('0x11')](_0x2a3df1));_0x2bfcde(_0x2a3df1);})[_0xaf37('0x19')](function(_0x474c2e){logger['error'](_0xaf37('0x15'),_0x474c2e[_0xaf37('0x14')],_0x1e184f);_0x24fdbb(_0x244ec8[_0xaf37('0x12')](0x1f4,_0x474c2e[_0xaf37('0x14')]));});});}; \ No newline at end of file +var _0x68e1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','error','code','VoiceTransferReport,\x20%s,\x20%s','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','info','stringify','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68e1,0xbc));var _0x168e=function(_0x4c2498,_0x3f989c){_0x4c2498=_0x4c2498-0x0;var _0x7b5671=_0x68e1[_0x4c2498];return _0x7b5671;};'use strict';var _=require(_0x168e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x168e('0x1'));var rs=require(_0x168e('0x2'));var fs=require('fs');var Redis=require(_0x168e('0x3'));var db=require(_0x168e('0x4'))['db'];var utils=require(_0x168e('0x5'));var logger=require(_0x168e('0x6'))(_0x168e('0x7'));var config=require(_0x168e('0x8'));var jayson=require(_0x168e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x266310,_0x4dca5e,_0x1c3385){return new BPromise(function(_0x41ecfa,_0x20b4d9){return client[_0x168e('0xa')](_0x266310,_0x1c3385)[_0x168e('0xb')](function(_0x28b312){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x4dca5e,_0x168e('0xc'));logger[_0x168e('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x4dca5e,_0x168e('0xc'),JSON['stringify'](_0x28b312));if(_0x28b312['error']){if(_0x28b312[_0x168e('0xe')][_0x168e('0xf')]===0x1f4){logger[_0x168e('0xe')](_0x168e('0x10'),_0x4dca5e,_0x28b312[_0x168e('0xe')][_0x168e('0x11')]);return _0x20b4d9(_0x28b312[_0x168e('0xe')][_0x168e('0x11')]);}logger[_0x168e('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x4dca5e,_0x28b312[_0x168e('0xe')][_0x168e('0x11')]);return _0x41ecfa(_0x28b312[_0x168e('0xe')][_0x168e('0x11')]);}else{logger['info'](_0x168e('0x10'),_0x4dca5e,_0x168e('0xc'));_0x41ecfa(_0x28b312['result'][_0x168e('0x11')]);}})[_0x168e('0x12')](function(_0x2aee15){logger[_0x168e('0xe')](_0x168e('0x10'),_0x4dca5e,_0x2aee15);_0x20b4d9(_0x2aee15);});});}exports[_0x168e('0x13')]=function(_0x334ba6){var _0x4eb268=this;return new Promise(function(_0x4d7d8e,_0x10ec3c){return db[_0x168e('0x14')][_0x168e('0x15')](_0x334ba6[_0x168e('0x16')],{'raw':_0x334ba6[_0x168e('0x17')]?_0x334ba6[_0x168e('0x17')][_0x168e('0x18')]===undefined?!![]:![]:!![]})[_0x168e('0xb')](function(_0x41db9a){logger[_0x168e('0x19')](_0x168e('0x13'),_0x334ba6);logger[_0x168e('0xd')](_0x168e('0x13'),_0x334ba6,JSON[_0x168e('0x1a')](_0x41db9a));_0x4d7d8e(_0x41db9a);})[_0x168e('0x12')](function(_0x482bfe){logger[_0x168e('0xe')](_0x168e('0x13'),_0x482bfe[_0x168e('0x11')],_0x334ba6);_0x10ec3c(_0x4eb268['error'](0x1f4,_0x482bfe[_0x168e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ff8f872..5beac73 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 _0x9a19=['hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup'];(function(_0x567274,_0x18c70a){var _0x3d08f5=function(_0x54b641){while(--_0x54b641){_0x567274['push'](_0x567274['shift']());}};_0x3d08f5(++_0x18c70a);}(_0x9a19,0x114));var _0x99a1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9a19[_0x4b055c];return _0x4b62bb;};'use strict';var express=require(_0x99a1('0x0'));var router=express[_0x99a1('0x1')]();var auth=require(_0x99a1('0x2'));var controller=require('./webbar.controller');router[_0x99a1('0x3')](_0x99a1('0x4'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x7')]);router[_0x99a1('0x3')](_0x99a1('0x8'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x9')]);router[_0x99a1('0x3')]('/answer',auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x99a1('0xa')]);router[_0x99a1('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x3')](_0x99a1('0xc'),auth[_0x99a1('0x5')](),auth['isWebrtcLicence'](),controller[_0x99a1('0xd')]);router[_0x99a1('0x3')](_0x99a1('0xe'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x3')](_0x99a1('0x10'),auth[_0x99a1('0x5')](),auth[_0x99a1('0x6')](),controller[_0x99a1('0x11')]);module[_0x99a1('0x12')]=router; \ No newline at end of file +var _0x54ef=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/hold','hold','/unhold'];(function(_0x1a95db,_0x1831fa){var _0x5804c4=function(_0x32c331){while(--_0x32c331){_0x1a95db['push'](_0x1a95db['shift']());}};_0x5804c4(++_0x1831fa);}(_0x54ef,0x112));var _0xf54e=function(_0xee2ab0,_0xef41){_0xee2ab0=_0xee2ab0-0x0;var _0x265b2c=_0x54ef[_0xee2ab0];return _0x265b2c;};'use strict';var express=require(_0xf54e('0x0'));var router=express[_0xf54e('0x1')]();var auth=require(_0xf54e('0x2'));var controller=require('./webbar.controller');router[_0xf54e('0x3')](_0xf54e('0x4'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x7')]);router[_0xf54e('0x3')](_0xf54e('0x8'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xf54e('0x9')]);router[_0xf54e('0x3')](_0xf54e('0xa'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['answer']);router[_0xf54e('0x3')](_0xf54e('0xb'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xc')]);router[_0xf54e('0x3')](_0xf54e('0xd'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xe')]);router[_0xf54e('0x3')](_0xf54e('0xf'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['calls']);router['post'](_0xf54e('0x10'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index cb6a7c4..c4fb972 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 _0x9aea=['calls\x20fired:','conference\x20fired:','conference\x20executed!','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','stack','name','status','send','NotFound','error','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','length','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','webbar:unhold','unhold\x20executed!','calls'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9aea,0xdd));var _0xa9ae=function(_0x546eba,_0x270791){_0x546eba=_0x546eba-0x0;var _0x4f618c=_0x9aea[_0x546eba];return _0x4f618c;};'use strict';var path=require(_0xa9ae('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xa9ae('0x1'))['db'];var config=require('../../config/environment');var util=require(_0xa9ae('0x2'));var BPromise=require(_0xa9ae('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa9ae('0x4')][_0xa9ae('0x5')]({'port':0x232a});var logger=require(_0xa9ae('0x6'))(_0xa9ae('0x7'));var Redis=require(_0xa9ae('0x8'));config['redis']=_[_0xa9ae('0x9')](config[_0xa9ae('0xa')],{'host':_0xa9ae('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa9ae('0xa')]));var Schema=require(_0xa9ae('0xc'));var originateValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]},'callNumber':{'type':_0xa9ae('0xf'),'required':[!![],_0xa9ae('0x10')]},'callerId':{'type':_0xa9ae('0xf')},'callbackUrl':{'type':_0xa9ae('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa9ae('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':_0xa9ae('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':_0xa9ae('0xf'),'required':[!![],_0xa9ae('0x11')]},'transferNumber':{'type':_0xa9ae('0xf'),'required':[!![],_0xa9ae('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':_0xa9ae('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]}});function emit(_0x77b0a4,_0xddb095,_0x524bb2){logger[_0xa9ae('0x13')](_0x77b0a4,_0xddb095,JSON[_0xa9ae('0x14')](_0x524bb2));io['to'](_0x77b0a4)[_0xa9ae('0x15')](_0xddb095,_0x524bb2);}function handleError(_0x4ac5a6){return function(_0x4dbb30){console[_0xa9ae('0x16')]('handleError:',_0x4dbb30,_0x4dbb30 instanceof RangeError);logger['error'](_0x4dbb30[_0xa9ae('0x17')]);if(_0x4dbb30 instanceof RangeError){if(_0x4dbb30[_0xa9ae('0x18')]){delete _0x4dbb30[_0xa9ae('0x18')];}_0x4ac5a6[_0xa9ae('0x19')](0x194)['send'](_0x4dbb30);}else{if(_0x4dbb30[_0xa9ae('0x18')]){delete _0x4dbb30[_0xa9ae('0x18')];}_0x4ac5a6[_0xa9ae('0x19')](0x1f4)[_0xa9ae('0x1a')](_0x4dbb30);}};}function checkError(){return function(_0x426317){if(!_0x426317){throw new RangeError(_0xa9ae('0x1b'));}return _0x426317;};}function respondWithRpcPromise(_0x971ee1,_0x5a062d){return new BPromise(function(_0xc021cf,_0x4ca9a9){var _0x49dca9=amiClient;return _0x49dca9['request'](_0x971ee1,_0x5a062d)['then'](function(_0x1afd07){if(_0x1afd07['error']){if(_0x1afd07[_0xa9ae('0x1c')]['code']===0x1f4){return _0x4ca9a9(_0x1afd07[_0xa9ae('0x1c')][_0xa9ae('0x1d')]);}return _0xc021cf(_0x1afd07[_0xa9ae('0x1c')][_0xa9ae('0x1d')]);}else{_0xc021cf(_0x1afd07[_0xa9ae('0x1e')]);}})[_0xa9ae('0x1f')](function(_0x23c1ec){_0x4ca9a9(_0x23c1ec);});});}function getAgent(_0x5e82f1){return db[_0xa9ae('0x20')][_0xa9ae('0x21')]({'where':{'id':_0x5e82f1,'role':_0xa9ae('0x22')}})[_0xa9ae('0x23')](checkError());}function getAgentCheckSession(_0x222db7,_0x428934){return new BPromise(function(_0xb12fa8,_0x5dfcd7){var _0x489e88=respondWithRpcPromise(_0xa9ae('0x24'));var _0x3c324e=getAgent(_0x222db7);Promise[_0xa9ae('0x25')]([_0x489e88,_0x3c324e])[_0xa9ae('0x23')](function(_0x74cd94){var _0x54a821=_0x74cd94[0x0];var _0x52dd4f=_0x74cd94[0x1];var _0x1892b5=_[_0xa9ae('0x26')](_0x54a821[_0xa9ae('0x27')],function(_0x3a48b7){return _0x3a48b7[_0xa9ae('0x28')]==_0x52dd4f['id']&&_0x3a48b7[_0xa9ae('0x29')]==_0x428934;});if(_0x1892b5['length']==0x1){_0xb12fa8(_0x52dd4f);}else{_0x5dfcd7(new RangeError('sessionId\x20'+_0x428934+_0xa9ae('0x2a')));}});});}exports[_0xa9ae('0x2b')]=function(_0x3d9b30,_0x3cd87a){logger[_0xa9ae('0x13')](_0xa9ae('0x2c'),_0x3d9b30[_0xa9ae('0x2d')]);var _0x3e2ec2=originateValidation['validate'](_0x3d9b30[_0xa9ae('0x2d')]);if(_0x3e2ec2['length']>0x0){return _0x3cd87a[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x3e2ec2);}var _0x3a701b=_0x3d9b30['body'][_0xa9ae('0x2f')];var _0x3eb867=_0x3d9b30[_0xa9ae('0x2d')][_0xa9ae('0x30')];var _0x353227=_0x3d9b30['body'][_0xa9ae('0x31')];var _0xa0730a=_0x3d9b30[_0xa9ae('0x2d')]['callbackUrl'];return getAgent(_0x3a701b)['then'](function(_0x2155c8){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x2155c8[_0xa9ae('0x18')]);emit(util['format'](_0xa9ae('0x33'),_0x2155c8[_0xa9ae('0x18')]),_0xa9ae('0x34'),{'callNumber':_0x3eb867,'callerId':_0x353227,'callbackUrl':_0xa0730a});return _0x3cd87a[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0xa9ae('0x1f')](handleError(_0x3cd87a));};exports['hangup']=function(_0x26c8fb,_0x38f360){logger[_0xa9ae('0x13')]('hangup\x20fired:',_0x26c8fb[_0xa9ae('0x2d')]);var _0x1ffcab=hangupValidation[_0xa9ae('0xc')](_0x26c8fb['body']);if(_0x1ffcab[_0xa9ae('0x35')]>0x0){return _0x38f360[_0xa9ae('0x19')](0x190)['json'](_0x1ffcab);}var _0x2993b2=_0x26c8fb['body'][_0xa9ae('0x2f')];var _0x24c237=_0x26c8fb['body'][_0xa9ae('0x29')];return getAgent(_0x2993b2)[_0xa9ae('0x23')](function(_0x234da5){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x234da5[_0xa9ae('0x18')]);emit(util['format'](_0xa9ae('0x33'),_0x234da5[_0xa9ae('0x18')]),'webbar:hangup',{'sessionId':_0x24c237});return _0x38f360['status'](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x36')});})[_0xa9ae('0x1f')](handleError(_0x38f360));};exports[_0xa9ae('0x37')]=function(_0x4c110a,_0x1b0f5e){logger[_0xa9ae('0x13')](_0xa9ae('0x38'),_0x4c110a[_0xa9ae('0x2d')]);var _0x23c91d=answerValidation[_0xa9ae('0xc')](_0x4c110a[_0xa9ae('0x2d')]);if(_0x23c91d['length']>0x0){return _0x1b0f5e[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x23c91d);}var _0x566cb0=_0x4c110a[_0xa9ae('0x2d')]['userId'];var _0xb51a6c=_0x4c110a[_0xa9ae('0x2d')][_0xa9ae('0x29')];return getAgent(_0x566cb0)[_0xa9ae('0x23')](function(_0x250d2b){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x250d2b['name']);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0x250d2b['name']),_0xa9ae('0x3a'),{'sessionId':_0xb51a6c});return _0x1b0f5e[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x3b')});})[_0xa9ae('0x1f')](handleError(_0x1b0f5e));};exports[_0xa9ae('0x3c')]=function(_0x571cb4,_0x1416a2){logger['info'](_0xa9ae('0x3d'),_0x571cb4[_0xa9ae('0x2d')]);var _0x52c6e9=holdValidation['validate'](_0x571cb4[_0xa9ae('0x2d')]);if(_0x52c6e9[_0xa9ae('0x35')]>0x0){return _0x1416a2[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x52c6e9);}var _0x435c29=_0x571cb4[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x60342a=_0x571cb4['body']['sessionId'];return getAgent(_0x435c29)[_0xa9ae('0x23')](function(_0x3cf89c){logger['info'](_0xa9ae('0x32'),_0x3cf89c[_0xa9ae('0x18')]);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0x3cf89c[_0xa9ae('0x18')]),_0xa9ae('0x3e'),{'sessionId':_0x60342a});return _0x1416a2[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':'hold\x20executed!'});})[_0xa9ae('0x1f')](handleError(_0x1416a2));};exports[_0xa9ae('0x3f')]=function(_0x5ea18d,_0x128f88){logger['info']('unhold\x20fired:',_0x5ea18d['body']);var _0x3b8916=unholdValidation[_0xa9ae('0xc')](_0x5ea18d['body']);if(_0x3b8916['length']>0x0){return _0x128f88['status'](0x190)[_0xa9ae('0x2e')](_0x3b8916);}var _0x54c67c=_0x5ea18d[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x4e39d5=_0x5ea18d[_0xa9ae('0x2d')]['sessionId'];return getAgent(_0x54c67c)[_0xa9ae('0x23')](function(_0xade70a){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0xade70a[_0xa9ae('0x18')]);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0xade70a[_0xa9ae('0x18')]),_0xa9ae('0x40'),{'sessionId':_0x4e39d5});return _0x128f88[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x41')});})['catch'](handleError(_0x128f88));};exports[_0xa9ae('0x42')]=function(_0x9e42b3,_0x24087a){logger[_0xa9ae('0x13')](_0xa9ae('0x43'),_0x24087a['body']);var _0x4fe9e7=callsValidation[_0xa9ae('0xc')](_0x9e42b3[_0xa9ae('0x2d')]);if(_0x4fe9e7['length']>0x0){return _0x24087a['status'](0x190)[_0xa9ae('0x2e')](_0x4fe9e7);}var _0x48637a=_0x9e42b3[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x1a1605=respondWithRpcPromise('VoiceChannels');var _0x36d844=getAgent(_0x48637a);return Promise['all']([_0x1a1605,_0x36d844])[_0xa9ae('0x23')](function(_0x56e847){var _0x157628=_0x56e847[0x0];var _0x38ad8f=_0x56e847[0x1];var _0x46ab4c=_[_0xa9ae('0x26')](_0x157628[_0xa9ae('0x27')],function(_0x44c3cc){return _0x44c3cc['UserId']==_0x38ad8f['id'];});return _0x24087a[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'count':_0x46ab4c[_0xa9ae('0x35')],'rows':_0x46ab4c});})[_0xa9ae('0x1f')](handleError(_0x24087a));};exports['conference']=function(_0x2ebb14,_0x2803fb){logger[_0xa9ae('0x13')](_0xa9ae('0x44'),_0x2ebb14[_0xa9ae('0x2d')]);var _0x1f563a=conferenceValidation[_0xa9ae('0xc')](_0x2ebb14[_0xa9ae('0x2d')]);if(_0x1f563a[_0xa9ae('0x35')]>0x0){return _0x2803fb[_0xa9ae('0x19')](0x190)['json'](_0x1f563a);}var _0xc6b8a4=_0x2ebb14[_0xa9ae('0x2d')][_0xa9ae('0x2f')];return getAgent(_0xc6b8a4)[_0xa9ae('0x23')](function(_0x5b2f69){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x5b2f69['name']);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0x5b2f69[_0xa9ae('0x18')]),'webbar:conference');return _0x2803fb['status'](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x45')});})['catch'](handleError(_0x2803fb));};exports['transfer']=function(_0x2369e4,_0x7d0c93){logger[_0xa9ae('0x13')]('transfer\x20fired:',_0x2369e4[_0xa9ae('0x2d')]);var _0x619ae4=transferValidation[_0xa9ae('0xc')](_0x2369e4[_0xa9ae('0x2d')]);if(_0x619ae4[_0xa9ae('0x35')]>0x0){return _0x7d0c93[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x619ae4);}var _0x381298=_0x2369e4[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x53445e=_0x2369e4['body'][_0xa9ae('0x29')];var _0x1a632a=_0x2369e4[_0xa9ae('0x2d')]['transferNumber'];return getAgent(_0x381298)[_0xa9ae('0x23')](function(_0xf2cd59){logger[_0xa9ae('0x13')]('entityFound:',_0xf2cd59['name']);emit(util[_0xa9ae('0x39')]('user:%s',_0xf2cd59[_0xa9ae('0x18')]),_0xa9ae('0x46'),{'sessionId':_0x53445e,'transferNumber':_0x1a632a});return _0x7d0c93[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x47')});})[_0xa9ae('0x1f')](handleError(_0x7d0c93));}; \ No newline at end of file +var _0xda65=['number','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','error','stack','name','send','status','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda65,0x1d0));var _0x5da6=function(_0x437340,_0x151ddb){_0x437340=_0x437340-0x0;var _0x1e846d=_0xda65[_0x437340];return _0x1e846d;};'use strict';var path=require(_0x5da6('0x0'));var fs=require('fs');var _=require(_0x5da6('0x1'));var db=require(_0x5da6('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x5da6('0x3'));var BPromise=require(_0x5da6('0x4'));var jayson=require(_0x5da6('0x5'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x5da6('0x6'))(_0x5da6('0x7'));var Redis=require(_0x5da6('0x8'));config[_0x5da6('0x9')]=_[_0x5da6('0xa')](config['redis'],{'host':_0x5da6('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x5da6('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5da6('0xd')]},'callNumber':{'type':_0x5da6('0xe'),'required':[!![],_0x5da6('0xf')]},'callerId':{'type':_0x5da6('0xe')},'callbackUrl':{'type':_0x5da6('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x5da6('0x10'),'required':[!![],_0x5da6('0xd')]},'sessionId':{'type':_0x5da6('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5da6('0xd')]},'sessionId':{'type':_0x5da6('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x5da6('0x10'),'required':[!![],_0x5da6('0xd')]},'sessionId':{'type':_0x5da6('0xe'),'required':[!![],_0x5da6('0x11')]},'transferNumber':{'type':_0x5da6('0xe'),'required':[!![],_0x5da6('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x5da6('0x10'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x5da6('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5da6('0x10'),'required':[!![],_0x5da6('0xd')]},'sessionId':{'type':_0x5da6('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5da6('0x10'),'required':[!![],_0x5da6('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x5da6('0x10'),'required':[!![],_0x5da6('0xd')]}});function emit(_0x4f594e,_0x272b50,_0x478ce5){logger['info'](_0x4f594e,_0x272b50,JSON[_0x5da6('0x13')](_0x478ce5));io['to'](_0x4f594e)[_0x5da6('0x14')](_0x272b50,_0x478ce5);}function handleError(_0x41534d){return function(_0x4c3b2d){console[_0x5da6('0x15')]('handleError:',_0x4c3b2d,_0x4c3b2d instanceof RangeError);logger[_0x5da6('0x16')](_0x4c3b2d[_0x5da6('0x17')]);if(_0x4c3b2d instanceof RangeError){if(_0x4c3b2d[_0x5da6('0x18')]){delete _0x4c3b2d[_0x5da6('0x18')];}_0x41534d['status'](0x194)[_0x5da6('0x19')](_0x4c3b2d);}else{if(_0x4c3b2d[_0x5da6('0x18')]){delete _0x4c3b2d[_0x5da6('0x18')];}_0x41534d[_0x5da6('0x1a')](0x1f4)[_0x5da6('0x19')](_0x4c3b2d);}};}function checkError(){return function(_0x4107e4){if(!_0x4107e4){throw new RangeError(_0x5da6('0x1b'));}return _0x4107e4;};}function respondWithRpcPromise(_0xabbd18,_0x4eca61){return new BPromise(function(_0x317cdb,_0x5ad81b){var _0x92171e=amiClient;return _0x92171e[_0x5da6('0x1c')](_0xabbd18,_0x4eca61)[_0x5da6('0x1d')](function(_0xdbaece){if(_0xdbaece[_0x5da6('0x16')]){if(_0xdbaece[_0x5da6('0x16')][_0x5da6('0x1e')]===0x1f4){return _0x5ad81b(_0xdbaece[_0x5da6('0x16')]['message']);}return _0x317cdb(_0xdbaece['error'][_0x5da6('0x1f')]);}else{_0x317cdb(_0xdbaece[_0x5da6('0x20')]);}})['catch'](function(_0x559855){_0x5ad81b(_0x559855);});});}function getAgent(_0x2db51e){return db[_0x5da6('0x21')][_0x5da6('0x22')]({'where':{'id':_0x2db51e,'role':_0x5da6('0x23')}})[_0x5da6('0x1d')](checkError());}function getAgentCheckSession(_0x495138,_0x471873){return new BPromise(function(_0x1bc214,_0x42aa03){var _0x573b0c=respondWithRpcPromise(_0x5da6('0x24'));var _0x2b3be1=getAgent(_0x495138);Promise['all']([_0x573b0c,_0x2b3be1])[_0x5da6('0x1d')](function(_0x34545f){var _0x440895=_0x34545f[0x0];var _0x10432a=_0x34545f[0x1];var _0x2be5ac=_[_0x5da6('0x25')](_0x440895[_0x5da6('0x26')],function(_0x25e8ae){return _0x25e8ae[_0x5da6('0x27')]==_0x10432a['id']&&_0x25e8ae[_0x5da6('0x28')]==_0x471873;});if(_0x2be5ac[_0x5da6('0x29')]==0x1){_0x1bc214(_0x10432a);}else{_0x42aa03(new RangeError(_0x5da6('0x2a')+_0x471873+_0x5da6('0x2b')));}});});}exports[_0x5da6('0x2c')]=function(_0x5d6b39,_0x42af0d){logger[_0x5da6('0x2d')](_0x5da6('0x2e'),_0x5d6b39['body']);var _0x1a1fb6=originateValidation[_0x5da6('0xc')](_0x5d6b39[_0x5da6('0x2f')]);if(_0x1a1fb6[_0x5da6('0x29')]>0x0){return _0x42af0d[_0x5da6('0x1a')](0x190)[_0x5da6('0x30')](_0x1a1fb6);}var _0x2d7bd2=_0x5d6b39[_0x5da6('0x2f')][_0x5da6('0x31')];var _0x4f8544=_0x5d6b39['body'][_0x5da6('0x32')];var _0x5bbe10=_0x5d6b39['body'][_0x5da6('0x33')];var _0x150b1d=_0x5d6b39['body']['callbackUrl'];return getAgent(_0x2d7bd2)[_0x5da6('0x1d')](function(_0x57e8c2){logger['info'](_0x5da6('0x34'),_0x57e8c2[_0x5da6('0x18')]);emit(util['format'](_0x5da6('0x35'),_0x57e8c2[_0x5da6('0x18')]),_0x5da6('0x36'),{'callNumber':_0x4f8544,'callerId':_0x5bbe10,'callbackUrl':_0x150b1d});return _0x42af0d[_0x5da6('0x1a')](0xc8)['json']({'error':![],'message':_0x5da6('0x37')});})[_0x5da6('0x38')](handleError(_0x42af0d));};exports[_0x5da6('0x39')]=function(_0x4aab18,_0x44c3a2){logger[_0x5da6('0x2d')](_0x5da6('0x3a'),_0x4aab18[_0x5da6('0x2f')]);var _0x17dd2f=hangupValidation[_0x5da6('0xc')](_0x4aab18['body']);if(_0x17dd2f[_0x5da6('0x29')]>0x0){return _0x44c3a2[_0x5da6('0x1a')](0x190)[_0x5da6('0x30')](_0x17dd2f);}var _0x4bc07d=_0x4aab18['body']['userId'];var _0x36e215=_0x4aab18['body'][_0x5da6('0x28')];return getAgent(_0x4bc07d)['then'](function(_0x2afd1e){logger['info'](_0x5da6('0x34'),_0x2afd1e[_0x5da6('0x18')]);emit(util['format'](_0x5da6('0x35'),_0x2afd1e[_0x5da6('0x18')]),_0x5da6('0x3b'),{'sessionId':_0x36e215});return _0x44c3a2[_0x5da6('0x1a')](0xc8)[_0x5da6('0x30')]({'error':![],'message':_0x5da6('0x3c')});})[_0x5da6('0x38')](handleError(_0x44c3a2));};exports[_0x5da6('0x3d')]=function(_0x1b1a5d,_0x3071ed){logger[_0x5da6('0x2d')](_0x5da6('0x3e'),_0x1b1a5d[_0x5da6('0x2f')]);var _0x2ba795=answerValidation[_0x5da6('0xc')](_0x1b1a5d[_0x5da6('0x2f')]);if(_0x2ba795[_0x5da6('0x29')]>0x0){return _0x3071ed['status'](0x190)[_0x5da6('0x30')](_0x2ba795);}var _0x313a24=_0x1b1a5d[_0x5da6('0x2f')][_0x5da6('0x31')];var _0x5e01d2=_0x1b1a5d[_0x5da6('0x2f')][_0x5da6('0x28')];return getAgent(_0x313a24)[_0x5da6('0x1d')](function(_0x297007){logger['info'](_0x5da6('0x34'),_0x297007[_0x5da6('0x18')]);emit(util[_0x5da6('0x3f')](_0x5da6('0x35'),_0x297007[_0x5da6('0x18')]),_0x5da6('0x40'),{'sessionId':_0x5e01d2});return _0x3071ed[_0x5da6('0x1a')](0xc8)[_0x5da6('0x30')]({'error':![],'message':_0x5da6('0x41')});})['catch'](handleError(_0x3071ed));};exports[_0x5da6('0x42')]=function(_0x351848,_0x4583f4){logger['info']('hold\x20fired:',_0x351848[_0x5da6('0x2f')]);var _0x369ad5=holdValidation[_0x5da6('0xc')](_0x351848[_0x5da6('0x2f')]);if(_0x369ad5[_0x5da6('0x29')]>0x0){return _0x4583f4['status'](0x190)['json'](_0x369ad5);}var _0x4dd635=_0x351848[_0x5da6('0x2f')][_0x5da6('0x31')];var _0x3ce7b5=_0x351848[_0x5da6('0x2f')][_0x5da6('0x28')];return getAgent(_0x4dd635)[_0x5da6('0x1d')](function(_0x4a8da1){logger[_0x5da6('0x2d')](_0x5da6('0x34'),_0x4a8da1[_0x5da6('0x18')]);emit(util['format']('user:%s',_0x4a8da1[_0x5da6('0x18')]),_0x5da6('0x43'),{'sessionId':_0x3ce7b5});return _0x4583f4['status'](0xc8)[_0x5da6('0x30')]({'error':![],'message':_0x5da6('0x44')});})[_0x5da6('0x38')](handleError(_0x4583f4));};exports['unhold']=function(_0x2c90e2,_0x57de51){logger[_0x5da6('0x2d')](_0x5da6('0x45'),_0x2c90e2[_0x5da6('0x2f')]);var _0x33bea1=unholdValidation[_0x5da6('0xc')](_0x2c90e2[_0x5da6('0x2f')]);if(_0x33bea1[_0x5da6('0x29')]>0x0){return _0x57de51[_0x5da6('0x1a')](0x190)[_0x5da6('0x30')](_0x33bea1);}var _0x2e5ab7=_0x2c90e2[_0x5da6('0x2f')][_0x5da6('0x31')];var _0x50744d=_0x2c90e2[_0x5da6('0x2f')][_0x5da6('0x28')];return getAgent(_0x2e5ab7)['then'](function(_0xee8548){logger[_0x5da6('0x2d')](_0x5da6('0x34'),_0xee8548[_0x5da6('0x18')]);emit(util['format']('user:%s',_0xee8548['name']),_0x5da6('0x46'),{'sessionId':_0x50744d});return _0x57de51[_0x5da6('0x1a')](0xc8)[_0x5da6('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x5da6('0x38')](handleError(_0x57de51));};exports[_0x5da6('0x47')]=function(_0x3a07d7,_0x2d3e76){logger[_0x5da6('0x2d')](_0x5da6('0x48'),_0x2d3e76['body']);var _0x23fe40=callsValidation[_0x5da6('0xc')](_0x3a07d7[_0x5da6('0x2f')]);if(_0x23fe40[_0x5da6('0x29')]>0x0){return _0x2d3e76[_0x5da6('0x1a')](0x190)[_0x5da6('0x30')](_0x23fe40);}var _0x25145a=_0x3a07d7[_0x5da6('0x2f')][_0x5da6('0x31')];var _0x4cf66d=respondWithRpcPromise('VoiceChannels');var _0x1a6014=getAgent(_0x25145a);return Promise[_0x5da6('0x49')]([_0x4cf66d,_0x1a6014])['then'](function(_0x298970){var _0x2eca9f=_0x298970[0x0];var _0x16840a=_0x298970[0x1];var _0x33b059=_[_0x5da6('0x25')](_0x2eca9f['rows'],function(_0x5d2189){return _0x5d2189[_0x5da6('0x27')]==_0x16840a['id'];});return _0x2d3e76[_0x5da6('0x1a')](0xc8)[_0x5da6('0x30')]({'count':_0x33b059[_0x5da6('0x29')],'rows':_0x33b059});})[_0x5da6('0x38')](handleError(_0x2d3e76));};exports[_0x5da6('0x4a')]=function(_0x298dc4,_0x1bbe3a){logger[_0x5da6('0x2d')](_0x5da6('0x4b'),_0x298dc4[_0x5da6('0x2f')]);var _0x5ed4a7=conferenceValidation['validate'](_0x298dc4[_0x5da6('0x2f')]);if(_0x5ed4a7[_0x5da6('0x29')]>0x0){return _0x1bbe3a[_0x5da6('0x1a')](0x190)[_0x5da6('0x30')](_0x5ed4a7);}var _0x1f8360=_0x298dc4[_0x5da6('0x2f')][_0x5da6('0x31')];return getAgent(_0x1f8360)[_0x5da6('0x1d')](function(_0x5a1891){logger['info'](_0x5da6('0x34'),_0x5a1891[_0x5da6('0x18')]);emit(util['format'](_0x5da6('0x35'),_0x5a1891[_0x5da6('0x18')]),_0x5da6('0x4c'));return _0x1bbe3a[_0x5da6('0x1a')](0xc8)[_0x5da6('0x30')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x1bbe3a));};exports['transfer']=function(_0x77db56,_0x4d3dc4){logger['info'](_0x5da6('0x4d'),_0x77db56[_0x5da6('0x2f')]);var _0x42e7b7=transferValidation[_0x5da6('0xc')](_0x77db56[_0x5da6('0x2f')]);if(_0x42e7b7[_0x5da6('0x29')]>0x0){return _0x4d3dc4[_0x5da6('0x1a')](0x190)[_0x5da6('0x30')](_0x42e7b7);}var _0x4fbe0a=_0x77db56[_0x5da6('0x2f')]['userId'];var _0x6103b9=_0x77db56[_0x5da6('0x2f')][_0x5da6('0x28')];var _0x34c096=_0x77db56['body'][_0x5da6('0x4e')];return getAgent(_0x4fbe0a)[_0x5da6('0x1d')](function(_0x47aaaf){logger['info']('entityFound:',_0x47aaaf['name']);emit(util[_0x5da6('0x3f')]('user:%s',_0x47aaaf['name']),'webbar:transfer',{'sessionId':_0x6103b9,'transferNumber':_0x34c096});return _0x4d3dc4[_0x5da6('0x1a')](0xc8)[_0x5da6('0x30')]({'error':![],'message':_0x5da6('0x4f')});})[_0x5da6('0x38')](handleError(_0x4d3dc4));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index cac9b04..2d100c9 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 _0xcf7e=['util','path','express','fs-extra','../../components/auth/service','./whatsappAccount.controller','get','isAuthenticated','/describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','/:id/dispositions','addAnswer','addApplications','notify','/:id/send','send','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x3bd634,_0x594ee8){var _0x12afbb=function(_0x4ae2a7){while(--_0x4ae2a7){_0x3bd634['push'](_0x3bd634['shift']());}};_0x12afbb(++_0x594ee8);}(_0xcf7e,0xb9));var _0xecf7=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xcf7e[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xecf7('0x0'));var util=require(_0xecf7('0x1'));var path=require(_0xecf7('0x2'));var timeout=require('connect-timeout');var express=require(_0xecf7('0x3'));var router=express['Router']();var fs_extra=require(_0xecf7('0x4'));var auth=require(_0xecf7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xecf7('0x6'));router[_0xecf7('0x7')]('/',auth[_0xecf7('0x8')](),controller['index']);router[_0xecf7('0x7')](_0xecf7('0x9'),auth[_0xecf7('0x8')](),controller['describe']);router['get'](_0xecf7('0xa'),auth[_0xecf7('0x8')](),controller['show']);router[_0xecf7('0x7')]('/:id/dispositions',auth[_0xecf7('0x8')](),controller[_0xecf7('0xb')]);router['get'](_0xecf7('0xc'),auth[_0xecf7('0x8')](),controller[_0xecf7('0xd')]);router[_0xecf7('0x7')](_0xecf7('0xe'),auth[_0xecf7('0x8')](),controller['getAgents']);router[_0xecf7('0x7')](_0xecf7('0xf'),auth[_0xecf7('0x8')](),controller[_0xecf7('0x10')]);router[_0xecf7('0x11')]('/',auth[_0xecf7('0x8')](),controller[_0xecf7('0x12')]);router[_0xecf7('0x11')](_0xecf7('0x13'),auth[_0xecf7('0x8')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xecf7('0x8')](),controller[_0xecf7('0x14')]);router[_0xecf7('0x11')]('/:id/users',auth[_0xecf7('0x8')](),controller['addAgents']);router['post'](_0xecf7('0xf'),auth[_0xecf7('0x8')](),controller[_0xecf7('0x15')]);router['post']('/:id/notify',controller[_0xecf7('0x16')]);router[_0xecf7('0x11')](_0xecf7('0x17'),auth['isAuthenticated'](),controller[_0xecf7('0x18')]);router['put']('/:id',auth[_0xecf7('0x8')](),controller['update']);router[_0xecf7('0x19')]('/:id',auth[_0xecf7('0x8')](),controller[_0xecf7('0x1a')]);router[_0xecf7('0x19')](_0xecf7('0x13'),auth['isAuthenticated'](),controller[_0xecf7('0x1b')]);router[_0xecf7('0x19')]('/:id/canned_answers',auth[_0xecf7('0x8')](),controller[_0xecf7('0x1c')]);router[_0xecf7('0x19')](_0xecf7('0xe'),auth[_0xecf7('0x8')](),controller[_0xecf7('0x1d')]);module[_0xecf7('0x1e')]=router; \ No newline at end of file +var _0x4d2e=['/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','/:id/applications','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe'];(function(_0x26b60d,_0x48437b){var _0x59777d=function(_0x4f6181){while(--_0x4f6181){_0x26b60d['push'](_0x26b60d['shift']());}};_0x59777d(++_0x48437b);}(_0x4d2e,0x1a3));var _0xe4d2=function(_0x39c7be,_0x3a0db2){_0x39c7be=_0x39c7be-0x0;var _0x156aac=_0x4d2e[_0x39c7be];return _0x156aac;};'use strict';var multer=require(_0xe4d2('0x0'));var util=require(_0xe4d2('0x1'));var path=require(_0xe4d2('0x2'));var timeout=require(_0xe4d2('0x3'));var express=require(_0xe4d2('0x4'));var router=express[_0xe4d2('0x5')]();var fs_extra=require(_0xe4d2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe4d2('0x7'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x9')]);router[_0xe4d2('0xa')](_0xe4d2('0xb'),auth[_0xe4d2('0x8')](),controller[_0xe4d2('0xc')]);router[_0xe4d2('0xa')](_0xe4d2('0xd'),auth['isAuthenticated'](),controller[_0xe4d2('0xe')]);router[_0xe4d2('0xa')](_0xe4d2('0xf'),auth[_0xe4d2('0x8')](),controller['getDispositions']);router['get'](_0xe4d2('0x10'),auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x11')]);router[_0xe4d2('0xa')](_0xe4d2('0x12'),auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x13')]);router[_0xe4d2('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe4d2('0x14')]);router[_0xe4d2('0x15')]('/',auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x16')]);router[_0xe4d2('0x15')](_0xe4d2('0xf'),auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x17')]);router[_0xe4d2('0x15')](_0xe4d2('0x10'),auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x18')]);router[_0xe4d2('0x15')](_0xe4d2('0x12'),auth[_0xe4d2('0x8')](),controller['addAgents']);router[_0xe4d2('0x15')](_0xe4d2('0x19'),auth[_0xe4d2('0x8')](),controller['addApplications']);router[_0xe4d2('0x15')](_0xe4d2('0x1a'),controller[_0xe4d2('0x1b')]);router[_0xe4d2('0x15')](_0xe4d2('0x1c'),auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x1d')]);router[_0xe4d2('0x1e')](_0xe4d2('0xd'),auth[_0xe4d2('0x8')](),controller['update']);router[_0xe4d2('0x1f')](_0xe4d2('0xd'),auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x20')]);router[_0xe4d2('0x1f')]('/:id/dispositions',auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x21')]);router[_0xe4d2('0x1f')](_0xe4d2('0x10'),auth[_0xe4d2('0x8')](),controller['removeAnswers']);router[_0xe4d2('0x1f')]('/:id/users',auth[_0xe4d2('0x8')](),controller[_0xe4d2('0x22')]);module[_0xe4d2('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1ecc149..b58cb52 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 _0x6e1e=['sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x6e1e,0x91));var _0xe6e1=function(_0x116475,_0xd21355){_0x116475=_0x116475-0x0;var _0x7f68b6=_0x6e1e[_0x116475];return _0x7f68b6;};'use strict';var Sequelize=require(_0xe6e1('0x0'));var rs=require(_0xe6e1('0x1'));module[_0xe6e1('0x2')]={'name':{'type':Sequelize[_0xe6e1('0x3')],'unique':_0xe6e1('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xe6e1('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xe6e1('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe6e1('0x5')]();}},'phone':{'type':Sequelize[_0xe6e1('0x3')]},'type':{'type':Sequelize[_0xe6e1('0x6')](_0xe6e1('0x7'),_0xe6e1('0x8'))},'accountSid':{'type':Sequelize[_0xe6e1('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe6e1('0x9')],'defaultValue':function(){return _0xe6e1('0xa');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe6e1('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe6e1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe6e1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe6e1('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe6e1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe6e1('0xd'),'set':function(_0xec3838){if(!_0xec3838){this[_0xe6e1('0xe')](_0xe6e1('0xf'),null);}this[_0xe6e1('0xe')](_0xe6e1('0x10'),_0xec3838);}},'description':{'type':Sequelize[_0xe6e1('0x3')]}}; \ No newline at end of file +var _0xca66=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xca66,0x141));var _0x6ca6=function(_0x2b0978,_0x4427d1){_0x2b0978=_0x2b0978-0x0;var _0x216a14=_0xca66[_0x2b0978];return _0x216a14;};'use strict';var Sequelize=require(_0x6ca6('0x0'));var rs=require('randomstring');module[_0x6ca6('0x1')]={'name':{'type':Sequelize[_0x6ca6('0x2')],'unique':_0x6ca6('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x6ca6('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6ca6('0x2')],'defaultValue':function(){return rs[_0x6ca6('0x4')]();}},'phone':{'type':Sequelize[_0x6ca6('0x2')]},'type':{'type':Sequelize[_0x6ca6('0x5')]('twilio',_0x6ca6('0x6'))},'accountSid':{'type':Sequelize[_0x6ca6('0x2')]},'baseUrl':{'type':Sequelize[_0x6ca6('0x2')]},'authToken':{'type':Sequelize[_0x6ca6('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6ca6('0x7')],'defaultValue':function(){return _0x6ca6('0x8');}},'notificationSound':{'type':Sequelize[_0x6ca6('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6ca6('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ca6('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6ca6('0xa')],'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[_0x6ca6('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6ca6('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ca6('0xa')],'comment':_0x6ca6('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x6ca6('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x20bfb8){if(!_0x20bfb8){this[_0x6ca6('0xc')](_0x6ca6('0xd'),null);}this[_0x6ca6('0xc')](_0x6ca6('0xe'),_0x20bfb8);}},'description':{'type':Sequelize[_0x6ca6('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 7f3a756..89a6fd3 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 _0xcfc8=['../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','name','send','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','keys','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','nolimit','removeAnswers','addAgents','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','findOne','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','Contacts','DESC','list','omit','defaults','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','Content-Type','text/xml','List','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x633566,_0x545c91){var _0xb4488d=function(_0x2b4418){while(--_0x2b4418){_0x633566['push'](_0x633566['shift']());}};_0xb4488d(++_0x545c91);}(_0xcfc8,0x172));var _0x8cfc=function(_0x4e8708,_0x1d380d){_0x4e8708=_0x4e8708-0x0;var _0x4339be=_0xcfc8[_0x4e8708];return _0x4339be;};'use strict';var emlformat=require(_0x8cfc('0x0'));var rimraf=require(_0x8cfc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cfc('0x2'));var rp=require(_0x8cfc('0x3'));var moment=require(_0x8cfc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8cfc('0x5'));var path=require(_0x8cfc('0x6'));var sox=require('sox');var csv=require(_0x8cfc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8cfc('0x8'));var _=require(_0x8cfc('0x9'));var squel=require(_0x8cfc('0xa'));var crypto=require('crypto');var jsforce=require(_0x8cfc('0xb'));var deskjs=require(_0x8cfc('0xc'));var toCsv=require(_0x8cfc('0x7'));var querystring=require(_0x8cfc('0xd'));var Papa=require(_0x8cfc('0xe'));var Redis=require(_0x8cfc('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8cfc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8cfc('0x11'))(_0x8cfc('0x12'));var utils=require(_0x8cfc('0x13'));var config=require(_0x8cfc('0x14'));var licenseUtil=require(_0x8cfc('0x15'));var db=require(_0x8cfc('0x16'))['db'];config['redis']=_['defaults'](config[_0x8cfc('0x17')],{'host':_0x8cfc('0x18'),'port':0x18eb});var socket=require(_0x8cfc('0x19'))(new Redis(config[_0x8cfc('0x17')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x8cfc('0x1a'));var client=jayson[_0x8cfc('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1d9ba9,_0x404c1f,_0x3dbe12,_0x258db5){return new BPromise(function(_0x4d98d1,_0x4fe32d){var _0x35b90b=_0x258db5||client;return _0x35b90b['request'](_0x1d9ba9,_0x3dbe12)[_0x8cfc('0x1c')](function(_0x26eda6){logger['info'](_0x8cfc('0x1d'),_0x404c1f,_0x8cfc('0x1e'));logger['debug'](_0x8cfc('0x1f'),_0x404c1f,_0x8cfc('0x1e'),JSON['stringify'](_0x26eda6));if(_0x26eda6[_0x8cfc('0x20')]){if(_0x26eda6[_0x8cfc('0x20')][_0x8cfc('0x21')]===0x1f4){logger[_0x8cfc('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x404c1f,_0x26eda6['error'][_0x8cfc('0x22')]);return _0x4fe32d(_0x26eda6[_0x8cfc('0x20')]['message']);}logger['error'](_0x8cfc('0x1d'),_0x404c1f,_0x26eda6[_0x8cfc('0x20')][_0x8cfc('0x22')]);return _0x4d98d1(_0x26eda6[_0x8cfc('0x20')][_0x8cfc('0x22')]);}else{logger[_0x8cfc('0x23')](_0x8cfc('0x1d'),_0x404c1f,'request\x20sent');_0x4d98d1(_0x26eda6[_0x8cfc('0x24')]['message']);}})[_0x8cfc('0x25')](function(_0x89c55){logger[_0x8cfc('0x20')](_0x8cfc('0x1d'),_0x404c1f,_0x89c55);_0x4fe32d(_0x89c55);});});}function respondWithStatusCode(_0xcbbf01,_0x220f69){_0x220f69=_0x220f69||0xcc;return function(_0x580b71){if(_0x580b71){return _0xcbbf01['sendStatus'](_0x220f69);}return _0xcbbf01[_0x8cfc('0x26')](_0x220f69)[_0x8cfc('0x27')]();};}function respondWithResult(_0x1ba798,_0x542a1f){_0x542a1f=_0x542a1f||0xc8;return function(_0xf558f9){if(_0xf558f9){return _0x1ba798['status'](_0x542a1f)[_0x8cfc('0x28')](_0xf558f9);}};}function respondWithFilteredResult(_0xe2b028,_0x426c25){return function(_0x16088a){if(_0x16088a){var _0x30c4e3=typeof _0x426c25['offset']===_0x8cfc('0x29')&&typeof _0x426c25[_0x8cfc('0x2a')]===_0x8cfc('0x29');var _0x23fb5b=_0x16088a[_0x8cfc('0x2b')];var _0x45b309=_0x30c4e3?0x0:_0x426c25[_0x8cfc('0x2c')];var _0x115bde=_0x30c4e3?_0x16088a[_0x8cfc('0x2b')]:_0x426c25[_0x8cfc('0x2c')]+_0x426c25[_0x8cfc('0x2a')];var _0x46e8f8;if(_0x115bde>=_0x23fb5b){_0x115bde=_0x23fb5b;_0x46e8f8=0xc8;}else{_0x46e8f8=0xce;}_0xe2b028[_0x8cfc('0x26')](_0x46e8f8);return _0xe2b028[_0x8cfc('0x2d')](_0x8cfc('0x2e'),_0x45b309+'-'+_0x115bde+'/'+_0x23fb5b)['json'](_0x16088a);}return null;};}function patchUpdates(_0x28dc09){return function(_0x5a562b){try{jsonpatch['apply'](_0x5a562b,_0x28dc09,!![]);}catch(_0x1499d3){return BPromise[_0x8cfc('0x2f')](_0x1499d3);}return _0x5a562b[_0x8cfc('0x30')]();};}function saveUpdates(_0x5d7d7f,_0x53dde3){return function(_0x1c4bea){if(_0x1c4bea){return _0x1c4bea[_0x8cfc('0x31')](_0x5d7d7f)[_0x8cfc('0x1c')](function(_0xd9df1c){return _0xd9df1c;});}return null;};}function removeEntity(_0x1c99f6,_0x3774dc){return function(_0x2aad4c){if(_0x2aad4c){return _0x2aad4c[_0x8cfc('0x32')]()['then'](function(){var _0x2e4949=_0x2aad4c[_0x8cfc('0x33')]({'plain':!![]});var _0x14d8e8=_0x8cfc('0x34');return db[_0x8cfc('0x35')][_0x8cfc('0x32')]({'where':{'type':_0x14d8e8,'resourceId':_0x2e4949['id']}})[_0x8cfc('0x1c')](function(){return _0x2aad4c;});})[_0x8cfc('0x1c')](function(){_0x1c99f6['status'](0xcc)[_0x8cfc('0x27')]();});}};}function handleEntityNotFound(_0x3fe936,_0x2af6cd){return function(_0xedc937){if(!_0xedc937){_0x3fe936[_0x8cfc('0x36')](0x194);}return _0xedc937;};}function handleError(_0x23c927,_0x3c3fd9){_0x3c3fd9=_0x3c3fd9||0x1f4;return function(_0x4d761c){logger[_0x8cfc('0x20')](_0x4d761c['stack']);if(_0x4d761c[_0x8cfc('0x37')]){delete _0x4d761c[_0x8cfc('0x37')];}_0x23c927[_0x8cfc('0x26')](_0x3c3fd9)[_0x8cfc('0x38')](_0x4d761c);};}exports['index']=function(_0x3c30eb,_0x1e0e69){var _0x10f7ee={'include':[{'model':db[_0x8cfc('0x39')],'as':_0x8cfc('0x3a')}]},_0x23a7d4={},_0x4f7ef7={'count':0x0,'rows':[]};var _0x2519d5=_['map'](db[_0x8cfc('0x3b')][_0x8cfc('0x3c')],function(_0x2b393d){return{'name':_0x2b393d[_0x8cfc('0x3d')],'type':_0x2b393d[_0x8cfc('0x3e')][_0x8cfc('0x3f')]};});_0x23a7d4[_0x8cfc('0x40')]=_[_0x8cfc('0x41')](_0x2519d5,'name');_0x23a7d4[_0x8cfc('0x42')]=_['keys'](_0x3c30eb[_0x8cfc('0x42')]);_0x23a7d4[_0x8cfc('0x43')]=_[_0x8cfc('0x44')](_0x23a7d4[_0x8cfc('0x40')],_0x23a7d4['query']);_0x10f7ee[_0x8cfc('0x45')]=_[_0x8cfc('0x44')](_0x23a7d4[_0x8cfc('0x40')],qs[_0x8cfc('0x46')](_0x3c30eb[_0x8cfc('0x42')][_0x8cfc('0x46')]));_0x10f7ee[_0x8cfc('0x45')]=_0x10f7ee[_0x8cfc('0x45')][_0x8cfc('0x47')]?_0x10f7ee[_0x8cfc('0x45')]:_0x23a7d4[_0x8cfc('0x40')];if(!_0x3c30eb[_0x8cfc('0x42')]['hasOwnProperty']('nolimit')){_0x10f7ee[_0x8cfc('0x2a')]=qs[_0x8cfc('0x2a')](_0x3c30eb[_0x8cfc('0x42')][_0x8cfc('0x2a')]);_0x10f7ee[_0x8cfc('0x2c')]=qs['offset'](_0x3c30eb[_0x8cfc('0x42')][_0x8cfc('0x2c')]);}_0x10f7ee[_0x8cfc('0x48')]=qs[_0x8cfc('0x49')](_0x3c30eb[_0x8cfc('0x42')][_0x8cfc('0x49')]);_0x10f7ee[_0x8cfc('0x4a')]=qs[_0x8cfc('0x43')](_[_0x8cfc('0x4b')](_0x3c30eb[_0x8cfc('0x42')],_0x23a7d4[_0x8cfc('0x43')]),_0x2519d5);if(_0x3c30eb['query'][_0x8cfc('0x4c')]){_0x10f7ee[_0x8cfc('0x4a')]=_[_0x8cfc('0x4d')](_0x10f7ee[_0x8cfc('0x4a')],{'$or':_[_0x8cfc('0x41')](_0x2519d5,function(_0x3a5ea4){if(_0x3a5ea4[_0x8cfc('0x3e')]!==_0x8cfc('0x4e')){var _0x4663e6={};_0x4663e6[_0x3a5ea4[_0x8cfc('0x37')]]={'$like':'%'+_0x3c30eb['query'][_0x8cfc('0x4c')]+'%'};return _0x4663e6;}})});}_0x10f7ee=_['merge']({},_0x10f7ee,_0x3c30eb[_0x8cfc('0x4f')]);var _0x5b9b7b={'where':_0x10f7ee[_0x8cfc('0x4a')]};return db['WhatsappAccount'][_0x8cfc('0x2b')](_0x5b9b7b)[_0x8cfc('0x1c')](function(_0x594fb2){_0x4f7ef7[_0x8cfc('0x2b')]=_0x594fb2;if(_0x3c30eb[_0x8cfc('0x42')][_0x8cfc('0x50')]){_0x10f7ee[_0x8cfc('0x51')]=[{'all':!![]}];}return db[_0x8cfc('0x3b')][_0x8cfc('0x52')](_0x10f7ee);})['then'](function(_0x2ee13e){_0x4f7ef7[_0x8cfc('0x53')]=_0x2ee13e;return _0x4f7ef7;})[_0x8cfc('0x1c')](respondWithFilteredResult(_0x1e0e69,_0x10f7ee))[_0x8cfc('0x25')](handleError(_0x1e0e69,null));};exports[_0x8cfc('0x54')]=function(_0x22de04,_0x23fc3b){var _0x472edd={'raw':![],'where':{'id':_0x22de04[_0x8cfc('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x8cfc('0x3a')}]},_0x12a1e7={};_0x12a1e7[_0x8cfc('0x40')]=_['keys'](db[_0x8cfc('0x3b')][_0x8cfc('0x3c')]);_0x12a1e7[_0x8cfc('0x42')]=_['keys'](_0x22de04[_0x8cfc('0x42')]);_0x12a1e7['filters']=_[_0x8cfc('0x44')](_0x12a1e7[_0x8cfc('0x40')],_0x12a1e7[_0x8cfc('0x42')]);_0x472edd[_0x8cfc('0x45')]=_['intersection'](_0x12a1e7[_0x8cfc('0x40')],qs[_0x8cfc('0x46')](_0x22de04[_0x8cfc('0x42')][_0x8cfc('0x46')]));_0x472edd[_0x8cfc('0x45')]=_0x472edd[_0x8cfc('0x45')][_0x8cfc('0x47')]?_0x472edd['attributes']:_0x12a1e7[_0x8cfc('0x40')];if(_0x22de04['query'][_0x8cfc('0x50')]){_0x472edd[_0x8cfc('0x51')]=[{'all':!![]}];}_0x472edd=_['merge']({},_0x472edd,_0x22de04['options']);return db[_0x8cfc('0x3b')][_0x8cfc('0x56')](_0x472edd)[_0x8cfc('0x1c')](handleEntityNotFound(_0x23fc3b,null))[_0x8cfc('0x1c')](respondWithResult(_0x23fc3b,null))[_0x8cfc('0x25')](handleError(_0x23fc3b,null));};exports['create']=function(_0x5cab06,_0x8373f4){return db[_0x8cfc('0x3b')][_0x8cfc('0x57')](_0x5cab06[_0x8cfc('0x58')],{})[_0x8cfc('0x1c')](function(_0x1ebeca){var _0x1240d0=_0x5cab06[_0x8cfc('0x59')][_0x8cfc('0x33')]({'plain':!![]});if(!_0x1240d0)throw new Error(_0x8cfc('0x5a'));if(_0x1240d0[_0x8cfc('0x5b')]==='user'){var _0x29005e=_0x1ebeca['get']({'plain':!![]});var _0x467fe0=_0x8cfc('0x34');return db[_0x8cfc('0x5c')][_0x8cfc('0x56')]({'where':{'name':_0x467fe0,'userProfileId':_0x1240d0[_0x8cfc('0x5d')]},'raw':!![]})['then'](function(_0xf8c8d3){if(_0xf8c8d3&&_0xf8c8d3[_0x8cfc('0x5e')]===0x0){return db[_0x8cfc('0x35')][_0x8cfc('0x57')]({'name':_0x29005e['name'],'resourceId':_0x29005e['id'],'type':_0xf8c8d3[_0x8cfc('0x37')],'sectionId':_0xf8c8d3['id']},{})[_0x8cfc('0x1c')](function(){return _0x1ebeca;});}else{return _0x1ebeca;}})['catch'](function(_0x57dbab){logger[_0x8cfc('0x20')](_0x8cfc('0x5f'),_0x57dbab);throw _0x57dbab;});}return _0x1ebeca;})['then'](respondWithResult(_0x8373f4,0xc9))[_0x8cfc('0x25')](handleError(_0x8373f4,null));};exports[_0x8cfc('0x31')]=function(_0x419bac,_0x221207){if(_0x419bac[_0x8cfc('0x58')]['id']){delete _0x419bac[_0x8cfc('0x58')]['id'];}return db[_0x8cfc('0x3b')][_0x8cfc('0x56')]({'where':{'id':_0x419bac[_0x8cfc('0x55')]['id']},'include':[{'model':db[_0x8cfc('0x39')],'as':_0x8cfc('0x3a')}]})[_0x8cfc('0x1c')](handleEntityNotFound(_0x221207,null))[_0x8cfc('0x1c')](saveUpdates(_0x419bac['body'],null))['then'](respondWithResult(_0x221207,null))['catch'](handleError(_0x221207,null));};exports[_0x8cfc('0x32')]=function(_0x206e1d,_0x3fb70f){return db[_0x8cfc('0x3b')][_0x8cfc('0x56')]({'where':{'id':_0x206e1d[_0x8cfc('0x55')]['id']}})[_0x8cfc('0x1c')](handleEntityNotFound(_0x3fb70f,null))[_0x8cfc('0x1c')](removeEntity(_0x3fb70f,null))[_0x8cfc('0x25')](handleError(_0x3fb70f,null));};exports['describe']=function(_0x54a054,_0x5f4bc1){return db[_0x8cfc('0x3b')][_0x8cfc('0x60')]()[_0x8cfc('0x1c')](respondWithResult(_0x5f4bc1,null))['catch'](handleError(_0x5f4bc1,null));};exports[_0x8cfc('0x61')]=function(_0xf80ba3,_0x459b3c,_0x285044){if(_0xf80ba3[_0x8cfc('0x58')]['id']){delete _0xf80ba3[_0x8cfc('0x58')]['id'];}return db[_0x8cfc('0x3b')][_0x8cfc('0x56')]({'where':{'id':_0xf80ba3[_0x8cfc('0x55')]['id']}})[_0x8cfc('0x1c')](handleEntityNotFound(_0x459b3c,null))[_0x8cfc('0x1c')](function(_0x2e81ef){if(_0x2e81ef){_0xf80ba3[_0x8cfc('0x58')]['WhatsappAccountId']=_0x2e81ef['id'];return db[_0x8cfc('0x62')]['create'](_0xf80ba3[_0x8cfc('0x58')]);}})['then'](respondWithResult(_0x459b3c,null))[_0x8cfc('0x25')](handleError(_0x459b3c,null));};exports[_0x8cfc('0x63')]=function(_0x49c12c,_0x1dd7c2,_0xd3f603){var _0x53206a={'raw':![],'where':{}};var _0x27bb88={};var _0x252f4a={'count':0x0,'rows':[]};return db[_0x8cfc('0x3b')]['findOne']({'where':{'id':_0x49c12c['params']['id']}})['then'](handleEntityNotFound(_0x1dd7c2,null))[_0x8cfc('0x1c')](function(_0x4a83fb){if(_0x4a83fb){_0x27bb88[_0x8cfc('0x40')]=_[_0x8cfc('0x64')](db[_0x8cfc('0x62')][_0x8cfc('0x3c')]);_0x27bb88[_0x8cfc('0x42')]=_[_0x8cfc('0x64')](_0x49c12c[_0x8cfc('0x42')]);_0x27bb88[_0x8cfc('0x43')]=_[_0x8cfc('0x44')](_0x27bb88['model'],_0x27bb88[_0x8cfc('0x42')]);_0x53206a['attributes']=_['intersection'](_0x27bb88[_0x8cfc('0x40')],qs['fields'](_0x49c12c[_0x8cfc('0x42')][_0x8cfc('0x46')]));_0x53206a['attributes']=_0x53206a['attributes']['length']?_0x53206a[_0x8cfc('0x45')]:_0x27bb88[_0x8cfc('0x40')];if(!_0x49c12c['query']['hasOwnProperty']('nolimit')){_0x53206a['limit']=qs['limit'](_0x49c12c[_0x8cfc('0x42')]['limit']);_0x53206a[_0x8cfc('0x2c')]=qs[_0x8cfc('0x2c')](_0x49c12c[_0x8cfc('0x42')][_0x8cfc('0x2c')]);}_0x53206a[_0x8cfc('0x48')]=qs[_0x8cfc('0x49')](_0x49c12c['query'][_0x8cfc('0x49')]);_0x53206a[_0x8cfc('0x4a')]=qs[_0x8cfc('0x43')](_['pick'](_0x49c12c[_0x8cfc('0x42')],_0x27bb88[_0x8cfc('0x43')]));_0x53206a[_0x8cfc('0x4a')][_0x8cfc('0x65')]=_0x4a83fb['id'];if(_0x49c12c[_0x8cfc('0x42')]['filter']){_0x53206a['where']=_[_0x8cfc('0x4d')](_0x53206a[_0x8cfc('0x4a')],{'$or':_[_0x8cfc('0x41')](_0x53206a[_0x8cfc('0x45')],function(_0xa89a8d){var _0x13fc20={};_0x13fc20[_0xa89a8d]={'$like':'%'+_0x49c12c['query'][_0x8cfc('0x4c')]+'%'};return _0x13fc20;})});}_0x53206a=_[_0x8cfc('0x4d')]({},_0x53206a,_0x49c12c[_0x8cfc('0x4f')]);return db[_0x8cfc('0x62')][_0x8cfc('0x2b')]({'where':_0x53206a[_0x8cfc('0x4a')]})['then'](function(_0x4f9856){_0x252f4a['count']=_0x4f9856;if(_0x49c12c['query'][_0x8cfc('0x50')]){_0x53206a[_0x8cfc('0x51')]=[{'all':!![]}];}return db[_0x8cfc('0x62')]['findAll'](_0x53206a);})['then'](function(_0x21e98e){_0x252f4a[_0x8cfc('0x53')]=_0x21e98e;return _0x252f4a;});}})[_0x8cfc('0x1c')](respondWithFilteredResult(_0x1dd7c2,_0x53206a))[_0x8cfc('0x25')](handleError(_0x1dd7c2,null));};exports[_0x8cfc('0x66')]=function(_0x102a22,_0x3af2d6,_0x249d6c){return db[_0x8cfc('0x3b')][_0x8cfc('0x56')]({'where':{'id':_0x102a22[_0x8cfc('0x55')]['id']}})['then'](handleEntityNotFound(_0x3af2d6,null))[_0x8cfc('0x1c')](function(_0x255500){if(_0x255500){return _0x255500[_0x8cfc('0x66')](_0x102a22[_0x8cfc('0x42')][_0x8cfc('0x67')]);}})[_0x8cfc('0x1c')](respondWithStatusCode(_0x3af2d6,null))[_0x8cfc('0x25')](handleError(_0x3af2d6,null));};exports[_0x8cfc('0x68')]=function(_0xfeaeda,_0x1da19a,_0x33f4b9){if(_0xfeaeda[_0x8cfc('0x58')]['id']){delete _0xfeaeda[_0x8cfc('0x58')]['id'];}return db[_0x8cfc('0x3b')][_0x8cfc('0x56')]({'where':{'id':_0xfeaeda[_0x8cfc('0x55')]['id']}})[_0x8cfc('0x1c')](handleEntityNotFound(_0x1da19a,null))[_0x8cfc('0x1c')](function(_0x1d7508){if(_0x1d7508){_0xfeaeda[_0x8cfc('0x58')]['WhatsappAccountId']=_0x1d7508['id'];return db[_0x8cfc('0x69')][_0x8cfc('0x57')](_0xfeaeda[_0x8cfc('0x58')]);}})[_0x8cfc('0x1c')](respondWithResult(_0x1da19a,null))[_0x8cfc('0x25')](handleError(_0x1da19a,null));};exports[_0x8cfc('0x6a')]=function(_0x51f8d8,_0x23cb78,_0x4eb31e){var _0x21a752={'raw':![],'where':{}};var _0x5f5595={};var _0x443b00={'count':0x0,'rows':[]};return db[_0x8cfc('0x3b')]['findOne']({'where':{'id':_0x51f8d8[_0x8cfc('0x55')]['id']}})[_0x8cfc('0x1c')](handleEntityNotFound(_0x23cb78,null))[_0x8cfc('0x1c')](function(_0x208dbb){if(_0x208dbb){_0x5f5595['model']=_[_0x8cfc('0x64')](db['CannedAnswer'][_0x8cfc('0x3c')]);_0x5f5595['query']=_[_0x8cfc('0x64')](_0x51f8d8[_0x8cfc('0x42')]);_0x5f5595[_0x8cfc('0x43')]=_[_0x8cfc('0x44')](_0x5f5595['model'],_0x5f5595[_0x8cfc('0x42')]);_0x21a752[_0x8cfc('0x45')]=_[_0x8cfc('0x44')](_0x5f5595[_0x8cfc('0x40')],qs[_0x8cfc('0x46')](_0x51f8d8[_0x8cfc('0x42')][_0x8cfc('0x46')]));_0x21a752[_0x8cfc('0x45')]=_0x21a752[_0x8cfc('0x45')]['length']?_0x21a752[_0x8cfc('0x45')]:_0x5f5595['model'];if(!_0x51f8d8[_0x8cfc('0x42')][_0x8cfc('0x6b')](_0x8cfc('0x6c'))){_0x21a752['limit']=qs['limit'](_0x51f8d8['query']['limit']);_0x21a752[_0x8cfc('0x2c')]=qs[_0x8cfc('0x2c')](_0x51f8d8['query'][_0x8cfc('0x2c')]);}_0x21a752[_0x8cfc('0x48')]=qs[_0x8cfc('0x49')](_0x51f8d8[_0x8cfc('0x42')][_0x8cfc('0x49')]);_0x21a752[_0x8cfc('0x4a')]=qs[_0x8cfc('0x43')](_['pick'](_0x51f8d8['query'],_0x5f5595[_0x8cfc('0x43')]));_0x21a752[_0x8cfc('0x4a')][_0x8cfc('0x65')]=_0x208dbb['id'];if(_0x51f8d8[_0x8cfc('0x42')][_0x8cfc('0x4c')]){_0x21a752[_0x8cfc('0x4a')]=_[_0x8cfc('0x4d')](_0x21a752['where'],{'$or':_[_0x8cfc('0x41')](_0x21a752[_0x8cfc('0x45')],function(_0xaede88){var _0x26fef1={};_0x26fef1[_0xaede88]={'$like':'%'+_0x51f8d8[_0x8cfc('0x42')][_0x8cfc('0x4c')]+'%'};return _0x26fef1;})});}_0x21a752=_[_0x8cfc('0x4d')]({},_0x21a752,_0x51f8d8[_0x8cfc('0x4f')]);return db['CannedAnswer'][_0x8cfc('0x2b')]({'where':_0x21a752['where']})[_0x8cfc('0x1c')](function(_0x55ff7d){_0x443b00[_0x8cfc('0x2b')]=_0x55ff7d;if(_0x51f8d8[_0x8cfc('0x42')][_0x8cfc('0x50')]){_0x21a752[_0x8cfc('0x51')]=[{'all':!![]}];}return db[_0x8cfc('0x69')][_0x8cfc('0x52')](_0x21a752);})[_0x8cfc('0x1c')](function(_0x2af3c4){_0x443b00[_0x8cfc('0x53')]=_0x2af3c4;return _0x443b00;});}})[_0x8cfc('0x1c')](respondWithFilteredResult(_0x23cb78,_0x21a752))[_0x8cfc('0x25')](handleError(_0x23cb78,null));};exports[_0x8cfc('0x6d')]=function(_0x35cf44,_0x336959,_0x1f4e2c){return db[_0x8cfc('0x3b')][_0x8cfc('0x56')]({'where':{'id':_0x35cf44[_0x8cfc('0x55')]['id']}})['then'](handleEntityNotFound(_0x336959,null))[_0x8cfc('0x1c')](function(_0x57c652){if(_0x57c652){return _0x57c652[_0x8cfc('0x6d')](_0x35cf44[_0x8cfc('0x42')][_0x8cfc('0x67')]);}})['then'](respondWithStatusCode(_0x336959,null))[_0x8cfc('0x25')](handleError(_0x336959,null));};exports[_0x8cfc('0x6e')]=function(_0x16d5b5,_0xce6460,_0x3e75f3){return db[_0x8cfc('0x3b')]['find']({'where':{'id':_0x16d5b5[_0x8cfc('0x55')]['id']}})[_0x8cfc('0x1c')](handleEntityNotFound(_0xce6460,null))['then'](function(_0x49e827){if(_0x49e827){return _0x49e827[_0x8cfc('0x6e')](_0x16d5b5[_0x8cfc('0x58')]['ids'],_['omit'](_0x16d5b5[_0x8cfc('0x58')],[_0x8cfc('0x67'),'id'])||{})['spread'](function(_0x304edf){for(var _0x56e750=0x0;_0x56e750<_0x16d5b5[_0x8cfc('0x58')][_0x8cfc('0x67')][_0x8cfc('0x47')];_0x56e750+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0x16d5b5[_0x8cfc('0x58')][_0x8cfc('0x67')][_0x56e750]),'WhatsappAccountId':Number(_0x16d5b5['params']['id'])});}return _0x304edf;});}})[_0x8cfc('0x1c')](respondWithResult(_0xce6460,null))[_0x8cfc('0x25')](handleError(_0xce6460,null));};exports[_0x8cfc('0x6f')]=function(_0x5da2f6,_0x16a466,_0x46b254){return db[_0x8cfc('0x3b')]['find']({'where':{'id':_0x5da2f6[_0x8cfc('0x55')]['id']}})['then'](handleEntityNotFound(_0x16a466,null))[_0x8cfc('0x1c')](function(_0x3e4f71){if(_0x3e4f71){return _0x3e4f71[_0x8cfc('0x6f')](_0x5da2f6[_0x8cfc('0x42')]['ids'])['then'](function(){if(_[_0x8cfc('0x70')](_0x5da2f6[_0x8cfc('0x42')][_0x8cfc('0x67')])){for(var _0x268bb0=0x0;_0x268bb0<_0x5da2f6[_0x8cfc('0x42')][_0x8cfc('0x67')][_0x8cfc('0x47')];_0x268bb0+=0x1){socket[_0x8cfc('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x5da2f6[_0x8cfc('0x42')][_0x8cfc('0x67')][_0x268bb0]),'WhatsappAccountId':Number(_0x5da2f6[_0x8cfc('0x55')]['id'])});}}else{socket[_0x8cfc('0x71')](_0x8cfc('0x72'),{'UserId':Number(_0x5da2f6['query'][_0x8cfc('0x67')]),'WhatsappAccountId':Number(_0x5da2f6[_0x8cfc('0x55')]['id'])});}});}})[_0x8cfc('0x1c')](respondWithStatusCode(_0x16a466,null))['catch'](handleError(_0x16a466,null));};exports[_0x8cfc('0x73')]=function(_0x4867e2,_0x38cc45,_0x19db2e){var _0x11ea0d={};var _0x5332e7={};var _0x19e500;var _0x3143aa;return db[_0x8cfc('0x3b')][_0x8cfc('0x74')]({'where':{'id':_0x4867e2['params']['id']}})[_0x8cfc('0x1c')](handleEntityNotFound(_0x38cc45,null))[_0x8cfc('0x1c')](function(_0x149f4d){if(_0x149f4d){_0x19e500=_0x149f4d;_0x5332e7[_0x8cfc('0x40')]=_[_0x8cfc('0x64')](db['User']['rawAttributes']);_0x5332e7[_0x8cfc('0x42')]=_[_0x8cfc('0x64')](_0x4867e2['query']);_0x5332e7[_0x8cfc('0x43')]=_[_0x8cfc('0x44')](_0x5332e7[_0x8cfc('0x40')],_0x5332e7[_0x8cfc('0x42')]);_0x11ea0d[_0x8cfc('0x45')]=_[_0x8cfc('0x44')](_0x5332e7[_0x8cfc('0x40')],qs[_0x8cfc('0x46')](_0x4867e2[_0x8cfc('0x42')][_0x8cfc('0x46')]));_0x11ea0d['attributes']=_0x11ea0d[_0x8cfc('0x45')][_0x8cfc('0x47')]?_0x11ea0d[_0x8cfc('0x45')]:_0x5332e7[_0x8cfc('0x40')];_0x11ea0d[_0x8cfc('0x48')]=qs[_0x8cfc('0x49')](_0x4867e2[_0x8cfc('0x42')]['sort']);_0x11ea0d[_0x8cfc('0x4a')]=qs['filters'](_[_0x8cfc('0x4b')](_0x4867e2[_0x8cfc('0x42')],_0x5332e7[_0x8cfc('0x43')]));if(_0x4867e2[_0x8cfc('0x42')][_0x8cfc('0x4c')]){_0x11ea0d[_0x8cfc('0x4a')]=_['merge'](_0x11ea0d[_0x8cfc('0x4a')],{'$or':_[_0x8cfc('0x41')](_0x11ea0d[_0x8cfc('0x45')],function(_0xc234f1){var _0x196b48={};_0x196b48[_0xc234f1]={'$like':'%'+_0x4867e2['query'][_0x8cfc('0x4c')]+'%'};return _0x196b48;})});}_0x11ea0d=_[_0x8cfc('0x4d')]({},_0x11ea0d,_0x4867e2[_0x8cfc('0x4f')]);return _0x19e500[_0x8cfc('0x73')](_0x11ea0d);}})[_0x8cfc('0x1c')](function(_0x1ee1c3){if(_0x1ee1c3){_0x3143aa=_0x1ee1c3['length'];if(!_0x4867e2[_0x8cfc('0x42')]['hasOwnProperty'](_0x8cfc('0x6c'))){_0x11ea0d['limit']=qs[_0x8cfc('0x2a')](_0x4867e2[_0x8cfc('0x42')][_0x8cfc('0x2a')]);_0x11ea0d[_0x8cfc('0x2c')]=qs[_0x8cfc('0x2c')](_0x4867e2[_0x8cfc('0x42')]['offset']);}return _0x19e500[_0x8cfc('0x73')](_0x11ea0d);}})['then'](function(_0x4d1ab0){if(_0x4d1ab0){return _0x4d1ab0?{'count':_0x3143aa,'rows':_0x4d1ab0}:null;}})['then'](respondWithResult(_0x38cc45,null))[_0x8cfc('0x25')](handleError(_0x38cc45,null));};exports['addApplications']=function(_0x36325c,_0x3b2249){var _0x2734a0=_0x36325c[_0x8cfc('0x55')]['id'];var _0x7035c4=_0x36325c[_0x8cfc('0x58')];var _0x49a8c3=0xc8;var _0x2dd56f=null;return db[_0x8cfc('0x75')][_0x8cfc('0x76')]({'isolationLevel':db['sequelize'][_0x8cfc('0x77')][_0x8cfc('0x78')]['READ_COMMITTED']},function(_0x2067f9){return db[_0x8cfc('0x3b')][_0x8cfc('0x74')]({'where':{'id':_0x2734a0},'transaction':_0x2067f9})[_0x8cfc('0x1c')](function(_0x2a08bb){if(_0x2a08bb){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x2734a0},'transaction':_0x2067f9})['then'](function(){var _0x4c4f98=_[_0x8cfc('0x41')](_0x7035c4,function(_0xdde6f3){_0xdde6f3[_0x8cfc('0x65')]=_0x2734a0;return _0xdde6f3;});return db[_0x8cfc('0x79')][_0x8cfc('0x7a')](_0x4c4f98,{'transaction':_0x2067f9});});}else{_0x49a8c3=0x194;_0x2dd56f=[];}});})[_0x8cfc('0x1c')](function(){if(_0x49a8c3!==0x194){return db['WhatsappApplication'][_0x8cfc('0x7b')]({'where':{'WhatsappAccountId':_0x2734a0},'order':_0x8cfc('0x7c')})[_0x8cfc('0x1c')](function(_0x47a7d5){_0x2dd56f=_0x47a7d5;});}})[_0x8cfc('0x25')](function(_0x1b4ec2){_0x49a8c3=0x1f4;logger[_0x8cfc('0x20')](_0x1b4ec2['stack']);if(_0x1b4ec2[_0x8cfc('0x37')]){delete _0x1b4ec2[_0x8cfc('0x37')];}_0x2dd56f=_0x1b4ec2;})['finally'](function(){if(_0x2dd56f===null){_0x3b2249[_0x8cfc('0x36')](_0x49a8c3);}else{if(_0x49a8c3===0x1f4){_0x3b2249['status'](_0x49a8c3)['send'](_0x2dd56f);}else{_0x3b2249[_0x8cfc('0x26')](_0x49a8c3)[_0x8cfc('0x28')](_0x2dd56f);}}});};exports['getApplications']=function(_0x21ae92,_0x10c01f,_0x2c69e7){var _0x39a77d={};var _0x54d42b={};var _0x2a1931;var _0x2bd264;return db[_0x8cfc('0x3b')][_0x8cfc('0x74')]({'where':{'id':_0x21ae92[_0x8cfc('0x55')]['id']}})[_0x8cfc('0x1c')](handleEntityNotFound(_0x10c01f,null))[_0x8cfc('0x1c')](function(_0x5dd0ee){if(_0x5dd0ee){_0x2a1931=_0x5dd0ee;_0x54d42b[_0x8cfc('0x40')]=_['keys'](db[_0x8cfc('0x79')]['rawAttributes']);_0x54d42b[_0x8cfc('0x42')]=_[_0x8cfc('0x64')](_0x21ae92[_0x8cfc('0x42')]);_0x54d42b[_0x8cfc('0x43')]=_['intersection'](_0x54d42b[_0x8cfc('0x40')],_0x54d42b[_0x8cfc('0x42')]);_0x39a77d[_0x8cfc('0x45')]=_['intersection'](_0x54d42b[_0x8cfc('0x40')],qs[_0x8cfc('0x46')](_0x21ae92[_0x8cfc('0x42')][_0x8cfc('0x46')]));_0x39a77d[_0x8cfc('0x45')]=_0x39a77d['attributes'][_0x8cfc('0x47')]?_0x39a77d[_0x8cfc('0x45')]:_0x54d42b[_0x8cfc('0x40')];_0x39a77d['order']=qs[_0x8cfc('0x49')](_0x21ae92[_0x8cfc('0x42')][_0x8cfc('0x49')]);_0x39a77d[_0x8cfc('0x4a')]=qs[_0x8cfc('0x43')](_[_0x8cfc('0x4b')](_0x21ae92[_0x8cfc('0x42')],_0x54d42b[_0x8cfc('0x43')]));if(_0x21ae92[_0x8cfc('0x42')][_0x8cfc('0x4c')]){_0x39a77d[_0x8cfc('0x4a')]=_['merge'](_0x39a77d['where'],{'$or':_[_0x8cfc('0x41')](_0x39a77d[_0x8cfc('0x45')],function(_0x360bbb){var _0x4298ae={};_0x4298ae[_0x360bbb]={'$like':'%'+_0x21ae92[_0x8cfc('0x42')][_0x8cfc('0x4c')]+'%'};return _0x4298ae;})});}_0x39a77d=_[_0x8cfc('0x4d')]({},_0x39a77d,_0x21ae92[_0x8cfc('0x4f')]);return _0x2a1931['getApplications'](_0x39a77d);}})['then'](function(_0x56cf4a){if(_0x56cf4a){_0x2bd264=_0x56cf4a[_0x8cfc('0x47')];if(!_0x21ae92[_0x8cfc('0x42')][_0x8cfc('0x6b')](_0x8cfc('0x6c'))){_0x39a77d[_0x8cfc('0x2a')]=qs[_0x8cfc('0x2a')](_0x21ae92[_0x8cfc('0x42')][_0x8cfc('0x2a')]);_0x39a77d['offset']=qs[_0x8cfc('0x2c')](_0x21ae92[_0x8cfc('0x42')][_0x8cfc('0x2c')]);}return _0x2a1931[_0x8cfc('0x7d')](_0x39a77d);}})[_0x8cfc('0x1c')](function(_0x27efc1){if(_0x27efc1){return _0x27efc1?{'count':_0x2bd264,'rows':_0x27efc1}:null;}})[_0x8cfc('0x1c')](respondWithResult(_0x10c01f,null))[_0x8cfc('0x25')](handleError(_0x10c01f,null));};exports[_0x8cfc('0x7e')]=function(_0x201a91,_0x1fc217,_0x3fd2fb){var _0x11597b={'channel':_0x8cfc('0x7f')};var _0x121def=[];var _0xeb8456=[];var _0x2d2685={};return db['WhatsappAccount'][_0x8cfc('0x56')]({'where':{'id':_0x201a91[_0x8cfc('0x55')]['id']},'include':[{'model':db[_0x8cfc('0x79')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x1fc217,null))[_0x8cfc('0x1c')](function(_0x1a1950){_0x11597b[_0x8cfc('0x80')]=_0x1a1950;if(_0x11597b[_0x8cfc('0x80')]&&_0x11597b[_0x8cfc('0x80')]['type']===_0x8cfc('0x81')&&_0x201a91[_0x8cfc('0x58')][_0x8cfc('0x82')]){if(_0x201a91[_0x8cfc('0x58')]['statuses'][_0x8cfc('0x47')]===0x0)return;if(_0x201a91['body']['statuses'][0x0][_0x8cfc('0x83')]!==_0x8cfc('0x84'))return;return db[_0x8cfc('0x85')][_0x8cfc('0x31')]({'read':!![],'readAt':_0x201a91[_0x8cfc('0x58')][_0x8cfc('0x82')][0x0]['timestamp']},{'where':{'messageId':_0x201a91[_0x8cfc('0x58')][_0x8cfc('0x82')][0x0][_0x8cfc('0x86')]},'individualHooks':!![]})['then'](function(_0x91946b){return _0x1fc217[_0x8cfc('0x26')](0xc8)[_0x8cfc('0x28')](_0x91946b);});}_0x11597b[_0x8cfc('0x87')]=_[_0x8cfc('0x88')](_0x1a1950['Applications'],[_0x8cfc('0x7c')],['asc']);if(_0x11597b[_0x8cfc('0x80')]['Applications']){delete _0x11597b[_0x8cfc('0x80')][_0x8cfc('0x89')];}return db[_0x8cfc('0x8a')][_0x8cfc('0x60')]()[_0x8cfc('0x1c')](function(_0x16da17){if(!_0x16da17){throw new db[(_0x8cfc('0x8b'))][(_0x8cfc('0x8c'))](_0x8cfc('0x8d'));}_0x121def=_[_0x8cfc('0x8e')](_[_0x8cfc('0x64')](_0x16da17),[_0x8cfc('0x8f'),_0x8cfc('0x90')]);_0xeb8456=_[_0x8cfc('0x8e')](_[_0x8cfc('0x64')](_0x16da17),['createdAt',_0x8cfc('0x90'),'CompanyId',_0x8cfc('0x91')]);_0x11597b[_0x8cfc('0x58')]={'mapKey':_0x8cfc('0x92')};if(_0x11597b[_0x8cfc('0x80')]&&_0x11597b[_0x8cfc('0x80')][_0x8cfc('0x3e')]==='twilio'){_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x93')]=_0x201a91[_0x8cfc('0x58')]['From'][_0x8cfc('0x94')](_0x8cfc('0x95'),'');_0x11597b['body'][_0x8cfc('0x58')]=_0x201a91['body'][_0x8cfc('0x96')];_0x11597b['body'][_0x8cfc('0x97')]=_0x201a91[_0x8cfc('0x58')][_0x8cfc('0x98')];}if(_0x11597b['account']&&_0x11597b[_0x8cfc('0x80')][_0x8cfc('0x3e')]==='sinch'){_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x93')]=_0x201a91['body'][_0x8cfc('0x99')][0x0][_0x8cfc('0x93')];_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x58')]=_0x201a91[_0x8cfc('0x58')][_0x8cfc('0x99')][0x0][_0x8cfc('0x22')][_0x8cfc('0x58')];_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x97')]=_0x201a91[_0x8cfc('0x58')][_0x8cfc('0x99')][0x0][_0x8cfc('0x86')];}if(_0x11597b[_0x8cfc('0x58')]['id']){delete _0x11597b[_0x8cfc('0x58')]['id'];}if(_[_0x8cfc('0x9a')](_0x11597b['body'][_0x8cfc('0x93')])){throw new db[(_0x8cfc('0x8b'))][(_0x8cfc('0x8c'))]('from\x20is\x20mandatory');}if(_[_0x8cfc('0x9a')](_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x58')])||_0x11597b[_0x8cfc('0x58')]['body']===''){throw new db[(_0x8cfc('0x8b'))][(_0x8cfc('0x8c'))](_0x8cfc('0x9b'));}if(_['isNil'](_0x11597b[_0x8cfc('0x58')]['mapKey'])){throw new db[(_0x8cfc('0x8b'))][(_0x8cfc('0x8c'))](_0x8cfc('0x9c')+_0xeb8456);}if(!_['includes'](_0xeb8456,_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x9d')])){throw new db['Sequelize'][(_0x8cfc('0x8c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xeb8456);}_0x2d2685[_0x11597b['body'][_0x8cfc('0x9d')]]=_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x93')];return db[_0x8cfc('0x9e')]['find']({'where':{'id':_0x11597b['account']['ListId']},'include':[{'model':db['CmContact'],'as':_0x8cfc('0x9f'),'where':_0x2d2685,'limit':0x1,'order':[[_0x8cfc('0x90'),_0x8cfc('0xa0')]]}]});})[_0x8cfc('0x1c')](handleEntityNotFound(_0x1fc217,null))[_0x8cfc('0x1c')](function(_0x2bfcaf){if(_0x2bfcaf){_0x11597b[_0x8cfc('0xa1')]=_[_0x8cfc('0xa2')](_0x2bfcaf,[_0x8cfc('0x9f')]);if(_0x2bfcaf[_0x8cfc('0x9f')][_0x8cfc('0x47')]){return _0x2bfcaf['Contacts'][0x0];}var _0x1c9b1d=_[_0x8cfc('0xa3')](_0x11597b['body'],{'firstName':_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x93')],'ListId':_0x2bfcaf['id']});_0x1c9b1d[_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x9d')]]=_0x11597b['body'][_0x8cfc('0x93')];return db[_0x8cfc('0x8a')]['create'](_0x1c9b1d,{'fields':_0x121def,'raw':!![]});}})[_0x8cfc('0x1c')](handleEntityNotFound(_0x1fc217,null))[_0x8cfc('0x1c')](function(_0x3910e2){if(_0x3910e2){_0x11597b[_0x8cfc('0xa4')]=_0x3910e2;var _0x4ec940={'ContactId':_0x3910e2['id'],'phone':_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x93')],'WhatsappAccountId':_0x201a91[_0x8cfc('0x55')]['id']};var _0x5496c9={'ContactId':_0x3910e2['id'],'WhatsappAccountId':_0x201a91[_0x8cfc('0x55')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x8cfc('0x56')]({'where':_0x5496c9})[_0x8cfc('0x1c')](function(_0x1cbe64){if(_0x1cbe64){return[_0x1cbe64,![]];}return db[_0x8cfc('0xa5')]['create'](_0x4ec940)['then'](function(_0x131f59){return[_0x131f59,!![]];});});}})['spread'](function(_0x382f1c,_0x5887e3){_0x11597b[_0x8cfc('0xa6')]=_0x382f1c[_0x8cfc('0x33')]({'plain':!![]});_0x11597b[_0x8cfc('0xa6')][_0x8cfc('0xa7')]=![];if(_0x5887e3){if(_0x11597b[_0x8cfc('0x80')][_0x8cfc('0xa8')]){_0x11597b[_0x8cfc('0x87')]['push']({'id':0x0,'priority':_0x11597b[_0x8cfc('0x87')]['length']+0x1,'app':_0x8cfc('0xa9'),'appdata':_0x8cfc('0xaa'),'interval':_0x8cfc('0xab')});}_0x11597b['interaction'][_0x8cfc('0xa7')]=!![];}return db['WhatsappMessage'][_0x8cfc('0x57')]({'phone':_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x93')],'messageId':_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x97')],'body':_0x11597b[_0x8cfc('0x58')][_0x8cfc('0x58')],'WhatsappAccountId':_0x201a91[_0x8cfc('0x55')]['id'],'WhatsappInteractionId':_0x382f1c['id'],'direction':'in','ContactId':_0x382f1c['ContactId'],'AttachmentId':_0x11597b[_0x8cfc('0x58')][_0x8cfc('0xac')]});})['then'](function(_0xf8d6c1){_0x11597b[_0x8cfc('0x22')]=_0xf8d6c1;if(!_0x11597b['interaction']['UserId'])return;return db[_0x8cfc('0xad')]['find']({'attributes':['id',_0x8cfc('0x37')],'where':{'id':_0x11597b[_0x8cfc('0xa6')][_0x8cfc('0xae')]}});})[_0x8cfc('0x1c')](function(_0x1eb95b){if(_0x1eb95b){_0x11597b[_0x8cfc('0x87')][_0x8cfc('0xaf')]({'id':0x0,'priority':0x0,'app':_0x8cfc('0xb0'),'appdata':_0x1eb95b[_0x8cfc('0x37')]+','+(_0x11597b[_0x8cfc('0x80')][_0x8cfc('0xb1')]||0xa),'interval':_0x8cfc('0xab')});}if(!_0x11597b[_0x8cfc('0xa6')][_0x8cfc('0xb2')])return;return db[_0x8cfc('0xb3')][_0x8cfc('0x56')]({'attributes':['id',_0x8cfc('0x37')],'where':{'id':_0x11597b[_0x8cfc('0xa6')][_0x8cfc('0xb2')]}});})[_0x8cfc('0x1c')](function(_0x2c7857){if(_0x2c7857){_0x11597b[_0x8cfc('0x87')]['unshift']({'id':0x0,'priority':0x1,'app':_0x8cfc('0xb4'),'appdata':_0x2c7857[_0x8cfc('0x37')]+','+(_0x11597b[_0x8cfc('0x80')][_0x8cfc('0xb5')]||0x12c),'interval':_0x8cfc('0xab')});}return respondWithRpcPromise(_0x8cfc('0xb6'),_0x8cfc('0xb7'),_0x11597b);})[_0x8cfc('0x1c')](function(_0x501d2c){if(_0x501d2c){var _0x28f8e9=0xc8;var _0x5c239a=_0x8cfc('0xb8');logger[_0x8cfc('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5c239a,_0x28f8e9,_0x8cfc('0xb9'));logger[_0x8cfc('0xba')](_0x8cfc('0xbb'),_0x5c239a,_0x28f8e9,_0x8cfc('0xb9'),JSON[_0x8cfc('0xbc')](_0x501d2c));if(_0x11597b['account']['type']===_0x8cfc('0xbd')){return _0x1fc217[_0x8cfc('0x26')](_0x28f8e9)[_0x8cfc('0x2d')](_0x8cfc('0xbe'),_0x8cfc('0xbf'))[_0x8cfc('0x38')]('\x0a');}else{return _0x1fc217[_0x8cfc('0x26')](_0x28f8e9)['json'](_0x501d2c);}}});})[_0x8cfc('0x25')](handleError(_0x1fc217,null));};exports[_0x8cfc('0x38')]=function(_0x43d559,_0xcf61a1,_0x6b3c6e){var _0x4b80fc,_0x4ee526,_0x192680;if(_[_0x8cfc('0x9a')](_0x43d559[_0x8cfc('0x58')][_0x8cfc('0x58')])||_0x43d559[_0x8cfc('0x58')]['body']===''){throw new db[(_0x8cfc('0x8b'))][(_0x8cfc('0x8c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8cfc('0x9a')](_0x43d559['body']['to'])){throw new db[(_0x8cfc('0x8b'))][(_0x8cfc('0x8c'))]('to\x20is\x20mandatory');}_0x4b80fc=_0x43d559[_0x8cfc('0x58')]['to'];return db['WhatsappAccount'][_0x8cfc('0x56')]({'where':{'id':_0x43d559[_0x8cfc('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x8cfc('0xc0'),'include':[{'model':db[_0x8cfc('0x8a')],'as':_0x8cfc('0x9f'),'where':{'mobile':_0x4b80fc},'limit':0x1,'order':[['updatedAt',_0x8cfc('0xa0')]]}]}]})[_0x8cfc('0x1c')](handleEntityNotFound(_0xcf61a1,null))[_0x8cfc('0x1c')](function(_0x23ef6a){if(_0x23ef6a&&_0x23ef6a[_0x8cfc('0xc0')]){_0x4ee526=_0x23ef6a['get']({'plain':!![]});if(_0x4ee526[_0x8cfc('0xc0')]&&_0x4ee526[_0x8cfc('0xc0')][_0x8cfc('0x9f')][_0x8cfc('0x47')]){return _0x4ee526[_0x8cfc('0xc0')]['Contacts'][0x0];}return db[_0x8cfc('0x8a')][_0x8cfc('0x57')](_['defaults'](_0x43d559[_0x8cfc('0x58')],{'firstName':_0x4b80fc,'mobile':_0x4b80fc,'phone':_0x4b80fc,'ListId':_0x4ee526['ListId']}));}})[_0x8cfc('0x1c')](handleEntityNotFound(_0xcf61a1,null))[_0x8cfc('0x1c')](function(_0x5778d2){if(_0x5778d2){_0x192680=_0x5778d2;return db[_0x8cfc('0xa5')][_0x8cfc('0x56')]({'where':{'ContactId':_0x192680['id'],'closed':![],'WhatsappAccountId':_0x4ee526['id']}})[_0x8cfc('0x1c')](function(_0x43a140){if(_0x43a140){return[_0x43a140,![]];}return db[_0x8cfc('0xa5')][_0x8cfc('0x57')]({'UserId':_0x43d559[_0x8cfc('0x59')]['id'],'ContactId':_0x192680['id'],'WhatsappAccountId':_0x4ee526['id'],'phone':_0x4b80fc,'firstMsgDirection':'out','Messages':[_[_0x8cfc('0x4d')](_0x43d559['body'],{'read':![],'body':_0x43d559[_0x8cfc('0x58')]['body'],'phone':_0x4b80fc,'WhatsappAccountId':_0x4ee526['id'],'UserId':_0x43d559[_0x8cfc('0x59')]['id'],'ContactId':_0x192680['id']})]},{'include':[{'model':db[_0x8cfc('0x85')],'as':_0x8cfc('0xc1')}]})[_0x8cfc('0x1c')](function(_0x23684e){return[_0x23684e,!![]];});});}})['spread'](function(_0x544e73,_0x21eed5){if(_0x21eed5){return _0x544e73;}return db[_0x8cfc('0x85')][_0x8cfc('0x57')](_[_0x8cfc('0x4d')](_0x43d559['body'],{'read':![],'body':_0x43d559[_0x8cfc('0x58')][_0x8cfc('0x58')],'phone':_0x4b80fc,'WhatsappAccountId':_0x4ee526['id'],'WhatsappInteractionId':_0x544e73['id'],'UserId':_0x43d559['user']['id'],'ContactId':_0x192680['id']}))[_0x8cfc('0x1c')](function(_0xdcc441){_0x544e73[_0x8cfc('0xc2')]['Messages']=[];_0x544e73['dataValues'][_0x8cfc('0xc1')][_0x8cfc('0xc3')](_0xdcc441['dataValues']);return _0x544e73;});})[_0x8cfc('0x1c')](respondWithResult(_0xcf61a1,null))['catch'](handleError(_0xcf61a1,null));}; \ No newline at end of file +var _0xdfc8=['WhatsappAccountId','getDispositions','findOne','nolimit','filter','Disposition','ids','addAnswer','getAnswers','CannedAnswer','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','register','client','http','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','update','destroy','get','UserProfileResource','name','send','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','Pause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xdfc8,0x127));var _0x8dfc=function(_0x550ee5,_0x2f277e){_0x550ee5=_0x550ee5-0x0;var _0x354ca8=_0xdfc8[_0x550ee5];return _0x354ca8;};'use strict';var emlformat=require(_0x8dfc('0x0'));var rimraf=require(_0x8dfc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8dfc('0x2'));var rp=require(_0x8dfc('0x3'));var moment=require(_0x8dfc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8dfc('0x5'));var util=require(_0x8dfc('0x6'));var path=require(_0x8dfc('0x7'));var sox=require(_0x8dfc('0x8'));var csv=require(_0x8dfc('0x9'));var ejs=require(_0x8dfc('0xa'));var fs=require('fs');var fs_extra=require(_0x8dfc('0xb'));var _=require(_0x8dfc('0xc'));var squel=require(_0x8dfc('0xd'));var crypto=require('crypto');var jsforce=require(_0x8dfc('0xe'));var deskjs=require(_0x8dfc('0xf'));var toCsv=require(_0x8dfc('0x9'));var querystring=require(_0x8dfc('0x10'));var Papa=require(_0x8dfc('0x11'));var Redis=require(_0x8dfc('0x12'));var authService=require(_0x8dfc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8dfc('0x14'));var hardwareService=require(_0x8dfc('0x15'));var logger=require(_0x8dfc('0x16'))(_0x8dfc('0x17'));var utils=require(_0x8dfc('0x18'));var config=require(_0x8dfc('0x19'));var licenseUtil=require(_0x8dfc('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8dfc('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8dfc('0x1c'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x8dfc('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8dfc('0x1e')][_0x8dfc('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x166f85,_0x43a341,_0x25ee11,_0x28fabb){return new BPromise(function(_0xd7cfbd,_0xf80fe1){var _0x30d7a1=_0x28fabb||client;return _0x30d7a1[_0x8dfc('0x20')](_0x166f85,_0x25ee11)[_0x8dfc('0x21')](function(_0x2e6c63){logger[_0x8dfc('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x43a341,'request\x20sent');logger[_0x8dfc('0x23')](_0x8dfc('0x24'),_0x43a341,'request\x20sent',JSON[_0x8dfc('0x25')](_0x2e6c63));if(_0x2e6c63[_0x8dfc('0x26')]){if(_0x2e6c63[_0x8dfc('0x26')][_0x8dfc('0x27')]===0x1f4){logger[_0x8dfc('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x43a341,_0x2e6c63['error'][_0x8dfc('0x28')]);return _0xf80fe1(_0x2e6c63[_0x8dfc('0x26')][_0x8dfc('0x28')]);}logger[_0x8dfc('0x26')](_0x8dfc('0x29'),_0x43a341,_0x2e6c63['error']['message']);return _0xd7cfbd(_0x2e6c63[_0x8dfc('0x26')]['message']);}else{logger[_0x8dfc('0x22')](_0x8dfc('0x29'),_0x43a341,_0x8dfc('0x2a'));_0xd7cfbd(_0x2e6c63[_0x8dfc('0x2b')][_0x8dfc('0x28')]);}})[_0x8dfc('0x2c')](function(_0x1ed8ba){logger[_0x8dfc('0x26')](_0x8dfc('0x29'),_0x43a341,_0x1ed8ba);_0xf80fe1(_0x1ed8ba);});});}function respondWithStatusCode(_0x2e0a5b,_0x1df43c){_0x1df43c=_0x1df43c||0xcc;return function(_0x2cf791){if(_0x2cf791){return _0x2e0a5b[_0x8dfc('0x2d')](_0x1df43c);}return _0x2e0a5b[_0x8dfc('0x2e')](_0x1df43c)[_0x8dfc('0x2f')]();};}function respondWithResult(_0x225eb6,_0x2d7bfe){_0x2d7bfe=_0x2d7bfe||0xc8;return function(_0x25941e){if(_0x25941e){return _0x225eb6[_0x8dfc('0x2e')](_0x2d7bfe)['json'](_0x25941e);}};}function respondWithFilteredResult(_0x2a3205,_0x291378){return function(_0x3e0924){if(_0x3e0924){var _0x4a45b0=typeof _0x291378[_0x8dfc('0x30')]===_0x8dfc('0x31')&&typeof _0x291378['limit']===_0x8dfc('0x31');var _0x18a3b5=_0x3e0924[_0x8dfc('0x32')];var _0x58317a=_0x4a45b0?0x0:_0x291378[_0x8dfc('0x30')];var _0x32cd01=_0x4a45b0?_0x3e0924[_0x8dfc('0x32')]:_0x291378[_0x8dfc('0x30')]+_0x291378['limit'];var _0x5af89e;if(_0x32cd01>=_0x18a3b5){_0x32cd01=_0x18a3b5;_0x5af89e=0xc8;}else{_0x5af89e=0xce;}_0x2a3205[_0x8dfc('0x2e')](_0x5af89e);return _0x2a3205[_0x8dfc('0x33')]('Content-Range',_0x58317a+'-'+_0x32cd01+'/'+_0x18a3b5)[_0x8dfc('0x34')](_0x3e0924);}return null;};}function patchUpdates(_0xa61629){return function(_0x28f06c){try{jsonpatch[_0x8dfc('0x35')](_0x28f06c,_0xa61629,!![]);}catch(_0x15caea){return BPromise[_0x8dfc('0x36')](_0x15caea);}return _0x28f06c[_0x8dfc('0x37')]();};}function saveUpdates(_0x50bb5f,_0x4c000e){return function(_0x3d9061){if(_0x3d9061){return _0x3d9061[_0x8dfc('0x38')](_0x50bb5f)[_0x8dfc('0x21')](function(_0x70c65d){return _0x70c65d;});}return null;};}function removeEntity(_0x202c3c,_0x321ed3){return function(_0xa7a051){if(_0xa7a051){return _0xa7a051[_0x8dfc('0x39')]()[_0x8dfc('0x21')](function(){var _0x3a00ba=_0xa7a051[_0x8dfc('0x3a')]({'plain':!![]});var _0x2b357a='WhatsappAccounts';return db[_0x8dfc('0x3b')][_0x8dfc('0x39')]({'where':{'type':_0x2b357a,'resourceId':_0x3a00ba['id']}})[_0x8dfc('0x21')](function(){return _0xa7a051;});})['then'](function(){_0x202c3c[_0x8dfc('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb4f8,_0x229352){return function(_0x200a12){if(!_0x200a12){_0x4bb4f8['sendStatus'](0x194);}return _0x200a12;};}function handleError(_0x9d187f,_0x1ea5f1){_0x1ea5f1=_0x1ea5f1||0x1f4;return function(_0x5b2c1d){logger[_0x8dfc('0x26')](_0x5b2c1d['stack']);if(_0x5b2c1d[_0x8dfc('0x3c')]){delete _0x5b2c1d[_0x8dfc('0x3c')];}_0x9d187f['status'](_0x1ea5f1)[_0x8dfc('0x3d')](_0x5b2c1d);};}exports['index']=function(_0x37d55b,_0x4a12d1){var _0x4600e1={'include':[{'model':db['Pause'],'as':_0x8dfc('0x3e')}]},_0x264ba8={},_0x11a973={'count':0x0,'rows':[]};var _0x54b9ed=_[_0x8dfc('0x3f')](db[_0x8dfc('0x40')][_0x8dfc('0x41')],function(_0x36481f){return{'name':_0x36481f['fieldName'],'type':_0x36481f[_0x8dfc('0x42')][_0x8dfc('0x43')]};});_0x264ba8[_0x8dfc('0x44')]=_[_0x8dfc('0x3f')](_0x54b9ed,_0x8dfc('0x3c'));_0x264ba8[_0x8dfc('0x45')]=_[_0x8dfc('0x46')](_0x37d55b['query']);_0x264ba8['filters']=_[_0x8dfc('0x47')](_0x264ba8[_0x8dfc('0x44')],_0x264ba8[_0x8dfc('0x45')]);_0x4600e1[_0x8dfc('0x48')]=_[_0x8dfc('0x47')](_0x264ba8[_0x8dfc('0x44')],qs['fields'](_0x37d55b[_0x8dfc('0x45')][_0x8dfc('0x49')]));_0x4600e1[_0x8dfc('0x48')]=_0x4600e1[_0x8dfc('0x48')][_0x8dfc('0x4a')]?_0x4600e1[_0x8dfc('0x48')]:_0x264ba8[_0x8dfc('0x44')];if(!_0x37d55b[_0x8dfc('0x45')][_0x8dfc('0x4b')]('nolimit')){_0x4600e1['limit']=qs[_0x8dfc('0x4c')](_0x37d55b[_0x8dfc('0x45')][_0x8dfc('0x4c')]);_0x4600e1['offset']=qs[_0x8dfc('0x30')](_0x37d55b[_0x8dfc('0x45')][_0x8dfc('0x30')]);}_0x4600e1[_0x8dfc('0x4d')]=qs[_0x8dfc('0x4e')](_0x37d55b['query']['sort']);_0x4600e1['where']=qs[_0x8dfc('0x4f')](_[_0x8dfc('0x50')](_0x37d55b[_0x8dfc('0x45')],_0x264ba8['filters']),_0x54b9ed);if(_0x37d55b[_0x8dfc('0x45')]['filter']){_0x4600e1[_0x8dfc('0x51')]=_['merge'](_0x4600e1[_0x8dfc('0x51')],{'$or':_[_0x8dfc('0x3f')](_0x54b9ed,function(_0xe13a58){if(_0xe13a58['type']!==_0x8dfc('0x52')){var _0x10ea30={};_0x10ea30[_0xe13a58['name']]={'$like':'%'+_0x37d55b[_0x8dfc('0x45')]['filter']+'%'};return _0x10ea30;}})});}_0x4600e1=_[_0x8dfc('0x53')]({},_0x4600e1,_0x37d55b[_0x8dfc('0x54')]);var _0x234a41={'where':_0x4600e1[_0x8dfc('0x51')]};return db[_0x8dfc('0x40')][_0x8dfc('0x32')](_0x234a41)[_0x8dfc('0x21')](function(_0x39491c){_0x11a973['count']=_0x39491c;if(_0x37d55b[_0x8dfc('0x45')][_0x8dfc('0x55')]){_0x4600e1[_0x8dfc('0x56')]=[{'all':!![]}];}return db[_0x8dfc('0x40')][_0x8dfc('0x57')](_0x4600e1);})[_0x8dfc('0x21')](function(_0x3b6d34){_0x11a973[_0x8dfc('0x58')]=_0x3b6d34;return _0x11a973;})[_0x8dfc('0x21')](respondWithFilteredResult(_0x4a12d1,_0x4600e1))[_0x8dfc('0x2c')](handleError(_0x4a12d1,null));};exports[_0x8dfc('0x59')]=function(_0xa330cb,_0x1c580b){var _0xb16fca={'raw':![],'where':{'id':_0xa330cb[_0x8dfc('0x5a')]['id']},'include':[{'model':db[_0x8dfc('0x5b')],'as':_0x8dfc('0x3e')}]},_0x580001={};_0x580001[_0x8dfc('0x44')]=_['keys'](db[_0x8dfc('0x40')]['rawAttributes']);_0x580001[_0x8dfc('0x45')]=_[_0x8dfc('0x46')](_0xa330cb[_0x8dfc('0x45')]);_0x580001[_0x8dfc('0x4f')]=_[_0x8dfc('0x47')](_0x580001[_0x8dfc('0x44')],_0x580001[_0x8dfc('0x45')]);_0xb16fca[_0x8dfc('0x48')]=_['intersection'](_0x580001[_0x8dfc('0x44')],qs['fields'](_0xa330cb[_0x8dfc('0x45')][_0x8dfc('0x49')]));_0xb16fca[_0x8dfc('0x48')]=_0xb16fca[_0x8dfc('0x48')][_0x8dfc('0x4a')]?_0xb16fca['attributes']:_0x580001['model'];if(_0xa330cb[_0x8dfc('0x45')][_0x8dfc('0x55')]){_0xb16fca[_0x8dfc('0x56')]=[{'all':!![]}];}_0xb16fca=_[_0x8dfc('0x53')]({},_0xb16fca,_0xa330cb['options']);return db[_0x8dfc('0x40')][_0x8dfc('0x5c')](_0xb16fca)[_0x8dfc('0x21')](handleEntityNotFound(_0x1c580b,null))[_0x8dfc('0x21')](respondWithResult(_0x1c580b,null))[_0x8dfc('0x2c')](handleError(_0x1c580b,null));};exports[_0x8dfc('0x5d')]=function(_0x297309,_0x23ff1a){return db[_0x8dfc('0x40')][_0x8dfc('0x5d')](_0x297309['body'],{})[_0x8dfc('0x21')](function(_0x52f488){var _0x5950e8=_0x297309[_0x8dfc('0x5e')][_0x8dfc('0x3a')]({'plain':!![]});if(!_0x5950e8)throw new Error(_0x8dfc('0x5f'));if(_0x5950e8[_0x8dfc('0x60')]===_0x8dfc('0x5e')){var _0x588d0=_0x52f488[_0x8dfc('0x3a')]({'plain':!![]});var _0x2b7f60=_0x8dfc('0x61');return db[_0x8dfc('0x62')][_0x8dfc('0x5c')]({'where':{'name':_0x2b7f60,'userProfileId':_0x5950e8['userProfileId']},'raw':!![]})[_0x8dfc('0x21')](function(_0x18a4d9){if(_0x18a4d9&&_0x18a4d9[_0x8dfc('0x63')]===0x0){return db[_0x8dfc('0x3b')][_0x8dfc('0x5d')]({'name':_0x588d0['name'],'resourceId':_0x588d0['id'],'type':_0x18a4d9[_0x8dfc('0x3c')],'sectionId':_0x18a4d9['id']},{})[_0x8dfc('0x21')](function(){return _0x52f488;});}else{return _0x52f488;}})['catch'](function(_0x5e9a4b){logger[_0x8dfc('0x26')](_0x8dfc('0x64'),_0x5e9a4b);throw _0x5e9a4b;});}return _0x52f488;})[_0x8dfc('0x21')](respondWithResult(_0x23ff1a,0xc9))[_0x8dfc('0x2c')](handleError(_0x23ff1a,null));};exports[_0x8dfc('0x38')]=function(_0x511aef,_0x49e0ef){if(_0x511aef[_0x8dfc('0x65')]['id']){delete _0x511aef[_0x8dfc('0x65')]['id'];}return db['WhatsappAccount'][_0x8dfc('0x5c')]({'where':{'id':_0x511aef[_0x8dfc('0x5a')]['id']},'include':[{'model':db[_0x8dfc('0x5b')],'as':_0x8dfc('0x3e')}]})[_0x8dfc('0x21')](handleEntityNotFound(_0x49e0ef,null))['then'](saveUpdates(_0x511aef[_0x8dfc('0x65')],null))[_0x8dfc('0x21')](respondWithResult(_0x49e0ef,null))['catch'](handleError(_0x49e0ef,null));};exports[_0x8dfc('0x39')]=function(_0x69cdad,_0x1c4fc2){return db[_0x8dfc('0x40')][_0x8dfc('0x5c')]({'where':{'id':_0x69cdad['params']['id']}})['then'](handleEntityNotFound(_0x1c4fc2,null))[_0x8dfc('0x21')](removeEntity(_0x1c4fc2,null))[_0x8dfc('0x2c')](handleError(_0x1c4fc2,null));};exports[_0x8dfc('0x66')]=function(_0x45343f,_0x2dd11a){return db[_0x8dfc('0x40')][_0x8dfc('0x66')]()['then'](respondWithResult(_0x2dd11a,null))[_0x8dfc('0x2c')](handleError(_0x2dd11a,null));};exports['addDisposition']=function(_0x250dc4,_0x2c9a2d,_0x5be7ef){if(_0x250dc4[_0x8dfc('0x65')]['id']){delete _0x250dc4[_0x8dfc('0x65')]['id'];}return db[_0x8dfc('0x40')][_0x8dfc('0x5c')]({'where':{'id':_0x250dc4[_0x8dfc('0x5a')]['id']}})[_0x8dfc('0x21')](handleEntityNotFound(_0x2c9a2d,null))[_0x8dfc('0x21')](function(_0x290341){if(_0x290341){_0x250dc4[_0x8dfc('0x65')][_0x8dfc('0x67')]=_0x290341['id'];return db['Disposition']['create'](_0x250dc4['body']);}})[_0x8dfc('0x21')](respondWithResult(_0x2c9a2d,null))[_0x8dfc('0x2c')](handleError(_0x2c9a2d,null));};exports[_0x8dfc('0x68')]=function(_0x113d55,_0x1b4e5c,_0x2bbba5){var _0x378dc2={'raw':![],'where':{}};var _0x1a3b4e={};var _0x1a291d={'count':0x0,'rows':[]};return db[_0x8dfc('0x40')][_0x8dfc('0x69')]({'where':{'id':_0x113d55[_0x8dfc('0x5a')]['id']}})[_0x8dfc('0x21')](handleEntityNotFound(_0x1b4e5c,null))['then'](function(_0x596212){if(_0x596212){_0x1a3b4e[_0x8dfc('0x44')]=_[_0x8dfc('0x46')](db['Disposition'][_0x8dfc('0x41')]);_0x1a3b4e[_0x8dfc('0x45')]=_[_0x8dfc('0x46')](_0x113d55[_0x8dfc('0x45')]);_0x1a3b4e[_0x8dfc('0x4f')]=_[_0x8dfc('0x47')](_0x1a3b4e[_0x8dfc('0x44')],_0x1a3b4e[_0x8dfc('0x45')]);_0x378dc2['attributes']=_[_0x8dfc('0x47')](_0x1a3b4e[_0x8dfc('0x44')],qs['fields'](_0x113d55[_0x8dfc('0x45')][_0x8dfc('0x49')]));_0x378dc2[_0x8dfc('0x48')]=_0x378dc2[_0x8dfc('0x48')][_0x8dfc('0x4a')]?_0x378dc2[_0x8dfc('0x48')]:_0x1a3b4e['model'];if(!_0x113d55['query'][_0x8dfc('0x4b')](_0x8dfc('0x6a'))){_0x378dc2['limit']=qs['limit'](_0x113d55[_0x8dfc('0x45')][_0x8dfc('0x4c')]);_0x378dc2['offset']=qs[_0x8dfc('0x30')](_0x113d55[_0x8dfc('0x45')][_0x8dfc('0x30')]);}_0x378dc2[_0x8dfc('0x4d')]=qs[_0x8dfc('0x4e')](_0x113d55[_0x8dfc('0x45')]['sort']);_0x378dc2['where']=qs['filters'](_[_0x8dfc('0x50')](_0x113d55[_0x8dfc('0x45')],_0x1a3b4e[_0x8dfc('0x4f')]));_0x378dc2[_0x8dfc('0x51')]['WhatsappAccountId']=_0x596212['id'];if(_0x113d55['query'][_0x8dfc('0x6b')]){_0x378dc2[_0x8dfc('0x51')]=_[_0x8dfc('0x53')](_0x378dc2[_0x8dfc('0x51')],{'$or':_[_0x8dfc('0x3f')](_0x378dc2[_0x8dfc('0x48')],function(_0x45d63c){var _0x3801dc={};_0x3801dc[_0x45d63c]={'$like':'%'+_0x113d55[_0x8dfc('0x45')][_0x8dfc('0x6b')]+'%'};return _0x3801dc;})});}_0x378dc2=_[_0x8dfc('0x53')]({},_0x378dc2,_0x113d55[_0x8dfc('0x54')]);return db[_0x8dfc('0x6c')][_0x8dfc('0x32')]({'where':_0x378dc2[_0x8dfc('0x51')]})[_0x8dfc('0x21')](function(_0xda56a3){_0x1a291d[_0x8dfc('0x32')]=_0xda56a3;if(_0x113d55[_0x8dfc('0x45')][_0x8dfc('0x55')]){_0x378dc2['include']=[{'all':!![]}];}return db['Disposition'][_0x8dfc('0x57')](_0x378dc2);})[_0x8dfc('0x21')](function(_0x3d2c97){_0x1a291d[_0x8dfc('0x58')]=_0x3d2c97;return _0x1a291d;});}})[_0x8dfc('0x21')](respondWithFilteredResult(_0x1b4e5c,_0x378dc2))[_0x8dfc('0x2c')](handleError(_0x1b4e5c,null));};exports['removeDispositions']=function(_0x2fd8db,_0x69265,_0x4dc670){return db[_0x8dfc('0x40')][_0x8dfc('0x5c')]({'where':{'id':_0x2fd8db[_0x8dfc('0x5a')]['id']}})[_0x8dfc('0x21')](handleEntityNotFound(_0x69265,null))['then'](function(_0x4b67e9){if(_0x4b67e9){return _0x4b67e9['removeDispositions'](_0x2fd8db['query'][_0x8dfc('0x6d')]);}})['then'](respondWithStatusCode(_0x69265,null))[_0x8dfc('0x2c')](handleError(_0x69265,null));};exports[_0x8dfc('0x6e')]=function(_0x2ba619,_0x3aa669,_0x31b3f2){if(_0x2ba619[_0x8dfc('0x65')]['id']){delete _0x2ba619[_0x8dfc('0x65')]['id'];}return db[_0x8dfc('0x40')][_0x8dfc('0x5c')]({'where':{'id':_0x2ba619[_0x8dfc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3aa669,null))[_0x8dfc('0x21')](function(_0x310115){if(_0x310115){_0x2ba619[_0x8dfc('0x65')][_0x8dfc('0x67')]=_0x310115['id'];return db['CannedAnswer'][_0x8dfc('0x5d')](_0x2ba619[_0x8dfc('0x65')]);}})['then'](respondWithResult(_0x3aa669,null))[_0x8dfc('0x2c')](handleError(_0x3aa669,null));};exports[_0x8dfc('0x6f')]=function(_0x2c15e5,_0x239aaa,_0x29dca1){var _0x501f24={'raw':![],'where':{}};var _0x52658d={};var _0x1668c1={'count':0x0,'rows':[]};return db[_0x8dfc('0x40')]['findOne']({'where':{'id':_0x2c15e5['params']['id']}})[_0x8dfc('0x21')](handleEntityNotFound(_0x239aaa,null))[_0x8dfc('0x21')](function(_0x44f4ef){if(_0x44f4ef){_0x52658d[_0x8dfc('0x44')]=_[_0x8dfc('0x46')](db[_0x8dfc('0x70')]['rawAttributes']);_0x52658d[_0x8dfc('0x45')]=_['keys'](_0x2c15e5[_0x8dfc('0x45')]);_0x52658d[_0x8dfc('0x4f')]=_[_0x8dfc('0x47')](_0x52658d[_0x8dfc('0x44')],_0x52658d[_0x8dfc('0x45')]);_0x501f24[_0x8dfc('0x48')]=_[_0x8dfc('0x47')](_0x52658d['model'],qs[_0x8dfc('0x49')](_0x2c15e5[_0x8dfc('0x45')][_0x8dfc('0x49')]));_0x501f24[_0x8dfc('0x48')]=_0x501f24[_0x8dfc('0x48')][_0x8dfc('0x4a')]?_0x501f24[_0x8dfc('0x48')]:_0x52658d[_0x8dfc('0x44')];if(!_0x2c15e5['query'][_0x8dfc('0x4b')](_0x8dfc('0x6a'))){_0x501f24['limit']=qs[_0x8dfc('0x4c')](_0x2c15e5['query'][_0x8dfc('0x4c')]);_0x501f24[_0x8dfc('0x30')]=qs[_0x8dfc('0x30')](_0x2c15e5[_0x8dfc('0x45')][_0x8dfc('0x30')]);}_0x501f24['order']=qs['sort'](_0x2c15e5['query'][_0x8dfc('0x4e')]);_0x501f24[_0x8dfc('0x51')]=qs[_0x8dfc('0x4f')](_[_0x8dfc('0x50')](_0x2c15e5[_0x8dfc('0x45')],_0x52658d[_0x8dfc('0x4f')]));_0x501f24[_0x8dfc('0x51')][_0x8dfc('0x67')]=_0x44f4ef['id'];if(_0x2c15e5[_0x8dfc('0x45')]['filter']){_0x501f24[_0x8dfc('0x51')]=_[_0x8dfc('0x53')](_0x501f24['where'],{'$or':_['map'](_0x501f24[_0x8dfc('0x48')],function(_0x5c92ee){var _0x163d13={};_0x163d13[_0x5c92ee]={'$like':'%'+_0x2c15e5[_0x8dfc('0x45')][_0x8dfc('0x6b')]+'%'};return _0x163d13;})});}_0x501f24=_['merge']({},_0x501f24,_0x2c15e5['options']);return db[_0x8dfc('0x70')][_0x8dfc('0x32')]({'where':_0x501f24[_0x8dfc('0x51')]})[_0x8dfc('0x21')](function(_0x2d24d0){_0x1668c1['count']=_0x2d24d0;if(_0x2c15e5['query'][_0x8dfc('0x55')]){_0x501f24['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x501f24);})['then'](function(_0x1b554e){_0x1668c1[_0x8dfc('0x58')]=_0x1b554e;return _0x1668c1;});}})[_0x8dfc('0x21')](respondWithFilteredResult(_0x239aaa,_0x501f24))[_0x8dfc('0x2c')](handleError(_0x239aaa,null));};exports['removeAnswers']=function(_0x5d4ebf,_0x3ffc54,_0x494a63){return db[_0x8dfc('0x40')][_0x8dfc('0x5c')]({'where':{'id':_0x5d4ebf[_0x8dfc('0x5a')]['id']}})[_0x8dfc('0x21')](handleEntityNotFound(_0x3ffc54,null))[_0x8dfc('0x21')](function(_0x33818a){if(_0x33818a){return _0x33818a['removeAnswers'](_0x5d4ebf[_0x8dfc('0x45')][_0x8dfc('0x6d')]);}})[_0x8dfc('0x21')](respondWithStatusCode(_0x3ffc54,null))[_0x8dfc('0x2c')](handleError(_0x3ffc54,null));};exports[_0x8dfc('0x71')]=function(_0x3ebc52,_0x4c5b6f,_0x4d1801){return db[_0x8dfc('0x40')][_0x8dfc('0x5c')]({'where':{'id':_0x3ebc52[_0x8dfc('0x5a')]['id']}})[_0x8dfc('0x21')](handleEntityNotFound(_0x4c5b6f,null))[_0x8dfc('0x21')](function(_0x43acaa){if(_0x43acaa){return _0x43acaa[_0x8dfc('0x71')](_0x3ebc52[_0x8dfc('0x65')][_0x8dfc('0x6d')],_[_0x8dfc('0x72')](_0x3ebc52[_0x8dfc('0x65')],[_0x8dfc('0x6d'),'id'])||{})[_0x8dfc('0x73')](function(_0x5a96ad){for(var _0x4576e0=0x0;_0x4576e0<_0x3ebc52[_0x8dfc('0x65')]['ids'][_0x8dfc('0x4a')];_0x4576e0+=0x1){socket[_0x8dfc('0x74')](_0x8dfc('0x75'),{'UserId':Number(_0x3ebc52['body'][_0x8dfc('0x6d')][_0x4576e0]),'WhatsappAccountId':Number(_0x3ebc52[_0x8dfc('0x5a')]['id'])});}return _0x5a96ad;});}})[_0x8dfc('0x21')](respondWithResult(_0x4c5b6f,null))['catch'](handleError(_0x4c5b6f,null));};exports['removeAgents']=function(_0x59ad0b,_0x1474dd,_0x1a989b){return db[_0x8dfc('0x40')][_0x8dfc('0x5c')]({'where':{'id':_0x59ad0b[_0x8dfc('0x5a')]['id']}})[_0x8dfc('0x21')](handleEntityNotFound(_0x1474dd,null))[_0x8dfc('0x21')](function(_0x1722cf){if(_0x1722cf){return _0x1722cf['removeAgents'](_0x59ad0b[_0x8dfc('0x45')][_0x8dfc('0x6d')])[_0x8dfc('0x21')](function(){if(_[_0x8dfc('0x76')](_0x59ad0b[_0x8dfc('0x45')]['ids'])){for(var _0x5f01ff=0x0;_0x5f01ff<_0x59ad0b[_0x8dfc('0x45')][_0x8dfc('0x6d')][_0x8dfc('0x4a')];_0x5f01ff+=0x1){socket['emit'](_0x8dfc('0x77'),{'UserId':Number(_0x59ad0b[_0x8dfc('0x45')][_0x8dfc('0x6d')][_0x5f01ff]),'WhatsappAccountId':Number(_0x59ad0b['params']['id'])});}}else{socket[_0x8dfc('0x74')](_0x8dfc('0x77'),{'UserId':Number(_0x59ad0b[_0x8dfc('0x45')]['ids']),'WhatsappAccountId':Number(_0x59ad0b[_0x8dfc('0x5a')]['id'])});}});}})[_0x8dfc('0x21')](respondWithStatusCode(_0x1474dd,null))[_0x8dfc('0x2c')](handleError(_0x1474dd,null));};exports[_0x8dfc('0x78')]=function(_0x37f20d,_0xcfd572,_0x3a443f){var _0x20dd4d={};var _0x3b51ec={};var _0x1ff662;var _0x4ee11e;return db[_0x8dfc('0x40')][_0x8dfc('0x69')]({'where':{'id':_0x37f20d[_0x8dfc('0x5a')]['id']}})['then'](handleEntityNotFound(_0xcfd572,null))[_0x8dfc('0x21')](function(_0x2f92ee){if(_0x2f92ee){_0x1ff662=_0x2f92ee;_0x3b51ec[_0x8dfc('0x44')]=_[_0x8dfc('0x46')](db[_0x8dfc('0x79')]['rawAttributes']);_0x3b51ec[_0x8dfc('0x45')]=_['keys'](_0x37f20d[_0x8dfc('0x45')]);_0x3b51ec[_0x8dfc('0x4f')]=_[_0x8dfc('0x47')](_0x3b51ec['model'],_0x3b51ec[_0x8dfc('0x45')]);_0x20dd4d[_0x8dfc('0x48')]=_[_0x8dfc('0x47')](_0x3b51ec['model'],qs['fields'](_0x37f20d['query'][_0x8dfc('0x49')]));_0x20dd4d[_0x8dfc('0x48')]=_0x20dd4d[_0x8dfc('0x48')][_0x8dfc('0x4a')]?_0x20dd4d[_0x8dfc('0x48')]:_0x3b51ec['model'];_0x20dd4d[_0x8dfc('0x4d')]=qs[_0x8dfc('0x4e')](_0x37f20d[_0x8dfc('0x45')]['sort']);_0x20dd4d[_0x8dfc('0x51')]=qs['filters'](_['pick'](_0x37f20d[_0x8dfc('0x45')],_0x3b51ec[_0x8dfc('0x4f')]));if(_0x37f20d[_0x8dfc('0x45')][_0x8dfc('0x6b')]){_0x20dd4d[_0x8dfc('0x51')]=_[_0x8dfc('0x53')](_0x20dd4d[_0x8dfc('0x51')],{'$or':_[_0x8dfc('0x3f')](_0x20dd4d[_0x8dfc('0x48')],function(_0x3ebf2a){var _0x5c072d={};_0x5c072d[_0x3ebf2a]={'$like':'%'+_0x37f20d[_0x8dfc('0x45')]['filter']+'%'};return _0x5c072d;})});}_0x20dd4d=_[_0x8dfc('0x53')]({},_0x20dd4d,_0x37f20d['options']);return _0x1ff662[_0x8dfc('0x78')](_0x20dd4d);}})[_0x8dfc('0x21')](function(_0xbfab79){if(_0xbfab79){_0x4ee11e=_0xbfab79[_0x8dfc('0x4a')];if(!_0x37f20d[_0x8dfc('0x45')][_0x8dfc('0x4b')](_0x8dfc('0x6a'))){_0x20dd4d['limit']=qs[_0x8dfc('0x4c')](_0x37f20d[_0x8dfc('0x45')][_0x8dfc('0x4c')]);_0x20dd4d[_0x8dfc('0x30')]=qs[_0x8dfc('0x30')](_0x37f20d['query']['offset']);}return _0x1ff662[_0x8dfc('0x78')](_0x20dd4d);}})[_0x8dfc('0x21')](function(_0x3ce399){if(_0x3ce399){return _0x3ce399?{'count':_0x4ee11e,'rows':_0x3ce399}:null;}})[_0x8dfc('0x21')](respondWithResult(_0xcfd572,null))[_0x8dfc('0x2c')](handleError(_0xcfd572,null));};exports[_0x8dfc('0x7a')]=function(_0x27834c,_0x1b35d2){var _0x3619bc=_0x27834c[_0x8dfc('0x5a')]['id'];var _0x4a335f=_0x27834c[_0x8dfc('0x65')];var _0x47c312=0xc8;var _0x1ae9c9=null;return db[_0x8dfc('0x7b')][_0x8dfc('0x7c')]({'isolationLevel':db['sequelize']['Transaction'][_0x8dfc('0x7d')][_0x8dfc('0x7e')]},function(_0x42b611){return db['WhatsappAccount']['findOne']({'where':{'id':_0x3619bc},'transaction':_0x42b611})[_0x8dfc('0x21')](function(_0x48af10){if(_0x48af10){return db[_0x8dfc('0x7f')][_0x8dfc('0x39')]({'where':{'WhatsappAccountId':_0x3619bc},'transaction':_0x42b611})[_0x8dfc('0x21')](function(){var _0x2ec28c=_[_0x8dfc('0x3f')](_0x4a335f,function(_0x4e5c4a){_0x4e5c4a['WhatsappAccountId']=_0x3619bc;return _0x4e5c4a;});return db['WhatsappApplication'][_0x8dfc('0x80')](_0x2ec28c,{'transaction':_0x42b611});});}else{_0x47c312=0x194;_0x1ae9c9=[];}});})[_0x8dfc('0x21')](function(){if(_0x47c312!==0x194){return db['WhatsappApplication'][_0x8dfc('0x81')]({'where':{'WhatsappAccountId':_0x3619bc},'order':_0x8dfc('0x82')})[_0x8dfc('0x21')](function(_0x8b15b){_0x1ae9c9=_0x8b15b;});}})[_0x8dfc('0x2c')](function(_0x407440){_0x47c312=0x1f4;logger[_0x8dfc('0x26')](_0x407440['stack']);if(_0x407440['name']){delete _0x407440['name'];}_0x1ae9c9=_0x407440;})[_0x8dfc('0x83')](function(){if(_0x1ae9c9===null){_0x1b35d2[_0x8dfc('0x2d')](_0x47c312);}else{if(_0x47c312===0x1f4){_0x1b35d2[_0x8dfc('0x2e')](_0x47c312)[_0x8dfc('0x3d')](_0x1ae9c9);}else{_0x1b35d2[_0x8dfc('0x2e')](_0x47c312)['json'](_0x1ae9c9);}}});};exports[_0x8dfc('0x84')]=function(_0x18ce74,_0x3dab4a,_0x163c90){var _0x57e232={};var _0x1eb631={};var _0x24e34b;var _0x3ff2a4;return db[_0x8dfc('0x40')][_0x8dfc('0x69')]({'where':{'id':_0x18ce74['params']['id']}})['then'](handleEntityNotFound(_0x3dab4a,null))[_0x8dfc('0x21')](function(_0x14621d){if(_0x14621d){_0x24e34b=_0x14621d;_0x1eb631['model']=_[_0x8dfc('0x46')](db[_0x8dfc('0x7f')][_0x8dfc('0x41')]);_0x1eb631[_0x8dfc('0x45')]=_[_0x8dfc('0x46')](_0x18ce74['query']);_0x1eb631[_0x8dfc('0x4f')]=_[_0x8dfc('0x47')](_0x1eb631['model'],_0x1eb631[_0x8dfc('0x45')]);_0x57e232[_0x8dfc('0x48')]=_[_0x8dfc('0x47')](_0x1eb631['model'],qs[_0x8dfc('0x49')](_0x18ce74[_0x8dfc('0x45')][_0x8dfc('0x49')]));_0x57e232[_0x8dfc('0x48')]=_0x57e232[_0x8dfc('0x48')]['length']?_0x57e232['attributes']:_0x1eb631['model'];_0x57e232[_0x8dfc('0x4d')]=qs[_0x8dfc('0x4e')](_0x18ce74['query']['sort']);_0x57e232[_0x8dfc('0x51')]=qs['filters'](_['pick'](_0x18ce74[_0x8dfc('0x45')],_0x1eb631[_0x8dfc('0x4f')]));if(_0x18ce74['query'][_0x8dfc('0x6b')]){_0x57e232['where']=_[_0x8dfc('0x53')](_0x57e232[_0x8dfc('0x51')],{'$or':_[_0x8dfc('0x3f')](_0x57e232[_0x8dfc('0x48')],function(_0x88950f){var _0x5728cd={};_0x5728cd[_0x88950f]={'$like':'%'+_0x18ce74[_0x8dfc('0x45')][_0x8dfc('0x6b')]+'%'};return _0x5728cd;})});}_0x57e232=_[_0x8dfc('0x53')]({},_0x57e232,_0x18ce74['options']);return _0x24e34b[_0x8dfc('0x84')](_0x57e232);}})[_0x8dfc('0x21')](function(_0x29cfc6){if(_0x29cfc6){_0x3ff2a4=_0x29cfc6[_0x8dfc('0x4a')];if(!_0x18ce74['query'][_0x8dfc('0x4b')](_0x8dfc('0x6a'))){_0x57e232[_0x8dfc('0x4c')]=qs[_0x8dfc('0x4c')](_0x18ce74[_0x8dfc('0x45')][_0x8dfc('0x4c')]);_0x57e232[_0x8dfc('0x30')]=qs[_0x8dfc('0x30')](_0x18ce74['query'][_0x8dfc('0x30')]);}return _0x24e34b[_0x8dfc('0x84')](_0x57e232);}})[_0x8dfc('0x21')](function(_0x3b1b81){if(_0x3b1b81){return _0x3b1b81?{'count':_0x3ff2a4,'rows':_0x3b1b81}:null;}})[_0x8dfc('0x21')](respondWithResult(_0x3dab4a,null))[_0x8dfc('0x2c')](handleError(_0x3dab4a,null));};exports[_0x8dfc('0x85')]=function(_0x224c5c,_0x146772,_0xa0e26f){var _0x30dd04={'channel':'whatsapp'};var _0x40f0ac=[];var _0x58430e=[];var _0x4ad427={};return db['WhatsappAccount'][_0x8dfc('0x5c')]({'where':{'id':_0x224c5c[_0x8dfc('0x5a')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x8dfc('0x21')](handleEntityNotFound(_0x146772,null))['then'](function(_0x387087){_0x30dd04[_0x8dfc('0x86')]=_0x387087;if(_0x30dd04[_0x8dfc('0x86')]&&_0x30dd04['account'][_0x8dfc('0x42')]===_0x8dfc('0x87')&&_0x224c5c[_0x8dfc('0x65')]['statuses']){if(_0x224c5c[_0x8dfc('0x65')][_0x8dfc('0x88')][_0x8dfc('0x4a')]===0x0)return;if(_0x224c5c['body']['statuses'][0x0][_0x8dfc('0x89')]!==_0x8dfc('0x8a'))return;return db[_0x8dfc('0x8b')][_0x8dfc('0x38')]({'read':!![],'readAt':_0x224c5c[_0x8dfc('0x65')][_0x8dfc('0x88')][0x0][_0x8dfc('0x8c')]},{'where':{'messageId':_0x224c5c[_0x8dfc('0x65')][_0x8dfc('0x88')][0x0][_0x8dfc('0x8d')]},'individualHooks':!![]})[_0x8dfc('0x21')](function(_0x2149e5){return _0x146772['status'](0xc8)[_0x8dfc('0x34')](_0x2149e5);});}_0x30dd04[_0x8dfc('0x8e')]=_[_0x8dfc('0x8f')](_0x387087[_0x8dfc('0x90')],[_0x8dfc('0x82')],['asc']);if(_0x30dd04['account'][_0x8dfc('0x90')]){delete _0x30dd04[_0x8dfc('0x86')][_0x8dfc('0x90')];}return db[_0x8dfc('0x91')][_0x8dfc('0x66')]()['then'](function(_0x2f1b54){if(!_0x2f1b54){throw new db['Sequelize']['ValidationError'](_0x8dfc('0x92'));}_0x40f0ac=_[_0x8dfc('0x93')](_[_0x8dfc('0x46')](_0x2f1b54),['createdAt',_0x8dfc('0x94')]);_0x58430e=_[_0x8dfc('0x93')](_['keys'](_0x2f1b54),[_0x8dfc('0x95'),_0x8dfc('0x94'),_0x8dfc('0x96'),_0x8dfc('0x97')]);_0x30dd04[_0x8dfc('0x65')]={'mapKey':_0x8dfc('0x98')};if(_0x30dd04['account']&&_0x30dd04[_0x8dfc('0x86')][_0x8dfc('0x42')]===_0x8dfc('0x99')){_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0x9a')]=_0x224c5c[_0x8dfc('0x65')][_0x8dfc('0x9b')]['replace'](_0x8dfc('0x9c'),'');_0x30dd04['body']['body']=_0x224c5c[_0x8dfc('0x65')][_0x8dfc('0x9d')];_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0x9e')]=_0x224c5c[_0x8dfc('0x65')][_0x8dfc('0x9f')];}if(_0x30dd04[_0x8dfc('0x86')]&&_0x30dd04[_0x8dfc('0x86')]['type']==='sinch'){_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0x9a')]=_0x224c5c[_0x8dfc('0x65')][_0x8dfc('0xa0')][0x0][_0x8dfc('0x9a')];_0x30dd04['body']['body']=_0x224c5c['body'][_0x8dfc('0xa0')][0x0][_0x8dfc('0x28')][_0x8dfc('0x65')];_0x30dd04['body'][_0x8dfc('0x9e')]=_0x224c5c[_0x8dfc('0x65')][_0x8dfc('0xa0')][0x0][_0x8dfc('0x8d')];}if(_0x30dd04['body']['id']){delete _0x30dd04[_0x8dfc('0x65')]['id'];}if(_[_0x8dfc('0xa1')](_0x30dd04['body']['from'])){throw new db[(_0x8dfc('0xa2'))][(_0x8dfc('0xa3'))](_0x8dfc('0xa4'));}if(_['isNil'](_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0x65')])||_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0x65')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8dfc('0xa1')](_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0xa5')])){throw new db[(_0x8dfc('0xa2'))][(_0x8dfc('0xa3'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58430e);}if(!_['includes'](_0x58430e,_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0xa5')])){throw new db[(_0x8dfc('0xa2'))][(_0x8dfc('0xa3'))](_0x8dfc('0xa6')+_0x58430e);}_0x4ad427[_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0xa5')]]=_0x30dd04['body'][_0x8dfc('0x9a')];return db[_0x8dfc('0xa7')]['find']({'where':{'id':_0x30dd04[_0x8dfc('0x86')][_0x8dfc('0x97')]},'include':[{'model':db[_0x8dfc('0x91')],'as':_0x8dfc('0xa8'),'where':_0x4ad427,'limit':0x1,'order':[[_0x8dfc('0x94'),'DESC']]}]});})[_0x8dfc('0x21')](handleEntityNotFound(_0x146772,null))[_0x8dfc('0x21')](function(_0x1fb9ba){if(_0x1fb9ba){_0x30dd04[_0x8dfc('0xa9')]=_[_0x8dfc('0x72')](_0x1fb9ba,[_0x8dfc('0xa8')]);if(_0x1fb9ba[_0x8dfc('0xa8')][_0x8dfc('0x4a')]){return _0x1fb9ba[_0x8dfc('0xa8')][0x0];}var _0x171969=_[_0x8dfc('0x1b')](_0x30dd04[_0x8dfc('0x65')],{'firstName':_0x30dd04['body']['from'],'ListId':_0x1fb9ba['id']});_0x171969[_0x30dd04[_0x8dfc('0x65')]['mapKey']]=_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0x9a')];return db[_0x8dfc('0x91')][_0x8dfc('0x5d')](_0x171969,{'fields':_0x40f0ac,'raw':!![]});}})[_0x8dfc('0x21')](handleEntityNotFound(_0x146772,null))['then'](function(_0x698335){if(_0x698335){_0x30dd04[_0x8dfc('0xaa')]=_0x698335;var _0x579773={'ContactId':_0x698335['id'],'phone':_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0x9a')],'WhatsappAccountId':_0x224c5c[_0x8dfc('0x5a')]['id']};var _0x3d4c8d={'ContactId':_0x698335['id'],'WhatsappAccountId':_0x224c5c[_0x8dfc('0x5a')]['id'],'closed':![]};return db[_0x8dfc('0xab')][_0x8dfc('0x5c')]({'where':_0x3d4c8d})[_0x8dfc('0x21')](function(_0x477987){if(_0x477987){return[_0x477987,![]];}return db[_0x8dfc('0xab')][_0x8dfc('0x5d')](_0x579773)[_0x8dfc('0x21')](function(_0x303a7e){return[_0x303a7e,!![]];});});}})[_0x8dfc('0x73')](function(_0x311d7d,_0x44db70){_0x30dd04['interaction']=_0x311d7d[_0x8dfc('0x3a')]({'plain':!![]});_0x30dd04[_0x8dfc('0xac')][_0x8dfc('0xad')]=![];if(_0x44db70){if(_0x30dd04[_0x8dfc('0x86')]['autoclose']){_0x30dd04[_0x8dfc('0x8e')][_0x8dfc('0xae')]({'id':0x0,'priority':_0x30dd04[_0x8dfc('0x8e')]['length']+0x1,'app':_0x8dfc('0xaf'),'appdata':_0x8dfc('0xb0'),'interval':_0x8dfc('0xb1')});}_0x30dd04[_0x8dfc('0xac')][_0x8dfc('0xad')]=!![];}return db['WhatsappMessage'][_0x8dfc('0x5d')]({'phone':_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0x9a')],'messageId':_0x30dd04['body'][_0x8dfc('0x9e')],'body':_0x30dd04[_0x8dfc('0x65')][_0x8dfc('0x65')],'WhatsappAccountId':_0x224c5c[_0x8dfc('0x5a')]['id'],'WhatsappInteractionId':_0x311d7d['id'],'direction':'in','ContactId':_0x311d7d[_0x8dfc('0xb2')],'AttachmentId':_0x30dd04[_0x8dfc('0x65')]['AttachmentId']});})['then'](function(_0x1cb82e){_0x30dd04[_0x8dfc('0x28')]=_0x1cb82e;if(!_0x30dd04[_0x8dfc('0xac')][_0x8dfc('0xb3')])return;return db[_0x8dfc('0x79')][_0x8dfc('0x5c')]({'attributes':['id',_0x8dfc('0x3c')],'where':{'id':_0x30dd04['interaction'][_0x8dfc('0xb3')]}});})['then'](function(_0x1c4b06){if(_0x1c4b06){_0x30dd04[_0x8dfc('0x8e')][_0x8dfc('0xb4')]({'id':0x0,'priority':0x0,'app':_0x8dfc('0xb5'),'appdata':_0x1c4b06['name']+','+(_0x30dd04[_0x8dfc('0x86')][_0x8dfc('0xb6')]||0xa),'interval':_0x8dfc('0xb1')});}if(!_0x30dd04[_0x8dfc('0xac')][_0x8dfc('0xb7')])return;return db[_0x8dfc('0xb8')]['find']({'attributes':['id',_0x8dfc('0x3c')],'where':{'id':_0x30dd04['interaction'][_0x8dfc('0xb7')]}});})['then'](function(_0xfaa97b){if(_0xfaa97b){_0x30dd04[_0x8dfc('0x8e')][_0x8dfc('0xb4')]({'id':0x0,'priority':0x1,'app':_0x8dfc('0xb9'),'appdata':_0xfaa97b[_0x8dfc('0x3c')]+','+(_0x30dd04['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x8dfc('0xb1')});}return respondWithRpcPromise(_0x8dfc('0xba'),'startRouting',_0x30dd04);})[_0x8dfc('0x21')](function(_0x57ae00){if(_0x57ae00){var _0xb91c1b=0xc8;var _0x43123a=_0x8dfc('0xbb');logger[_0x8dfc('0x22')](_0x8dfc('0x24'),_0x43123a,_0xb91c1b,_0x8dfc('0xbc'));logger[_0x8dfc('0x23')](_0x8dfc('0xbd'),_0x43123a,_0xb91c1b,'entity\x20found',JSON['stringify'](_0x57ae00));if(_0x30dd04[_0x8dfc('0x86')]['type']===_0x8dfc('0x99')){return _0x146772[_0x8dfc('0x2e')](_0xb91c1b)[_0x8dfc('0x33')](_0x8dfc('0xbe'),_0x8dfc('0xbf'))['send']('\x0a');}else{return _0x146772['status'](_0xb91c1b)[_0x8dfc('0x34')](_0x57ae00);}}});})['catch'](handleError(_0x146772,null));};exports[_0x8dfc('0x3d')]=function(_0x26b004,_0x19d703,_0x29a193){var _0x196330,_0x36a124,_0x37e544;if(_[_0x8dfc('0xa1')](_0x26b004[_0x8dfc('0x65')][_0x8dfc('0x65')])||_0x26b004[_0x8dfc('0x65')]['body']===''){throw new db[(_0x8dfc('0xa2'))][(_0x8dfc('0xa3'))](_0x8dfc('0xc0'));}if(_[_0x8dfc('0xa1')](_0x26b004[_0x8dfc('0x65')]['to'])){throw new db[(_0x8dfc('0xa2'))][(_0x8dfc('0xa3'))](_0x8dfc('0xc1'));}_0x196330=_0x26b004[_0x8dfc('0x65')]['to'];return db[_0x8dfc('0x40')][_0x8dfc('0x5c')]({'where':{'id':_0x26b004['params']['id']},'include':[{'model':db['CmList'],'as':_0x8dfc('0xc2'),'include':[{'model':db[_0x8dfc('0x91')],'as':_0x8dfc('0xa8'),'where':{'mobile':_0x196330},'limit':0x1,'order':[[_0x8dfc('0x94'),_0x8dfc('0xc3')]]}]}]})[_0x8dfc('0x21')](handleEntityNotFound(_0x19d703,null))[_0x8dfc('0x21')](function(_0x5c1ae5){if(_0x5c1ae5&&_0x5c1ae5['List']){_0x36a124=_0x5c1ae5[_0x8dfc('0x3a')]({'plain':!![]});if(_0x36a124[_0x8dfc('0xc2')]&&_0x36a124['List'][_0x8dfc('0xa8')][_0x8dfc('0x4a')]){return _0x36a124[_0x8dfc('0xc2')][_0x8dfc('0xa8')][0x0];}return db[_0x8dfc('0x91')][_0x8dfc('0x5d')](_['defaults'](_0x26b004['body'],{'firstName':_0x196330,'mobile':_0x196330,'phone':_0x196330,'ListId':_0x36a124[_0x8dfc('0x97')]}));}})['then'](handleEntityNotFound(_0x19d703,null))[_0x8dfc('0x21')](function(_0x50321b){if(_0x50321b){_0x37e544=_0x50321b;return db['WhatsappInteraction'][_0x8dfc('0x5c')]({'where':{'ContactId':_0x37e544['id'],'closed':![],'WhatsappAccountId':_0x36a124['id']}})[_0x8dfc('0x21')](function(_0xf511d3){if(_0xf511d3){return[_0xf511d3,![]];}return db[_0x8dfc('0xab')][_0x8dfc('0x5d')]({'UserId':_0x26b004[_0x8dfc('0x5e')]['id'],'ContactId':_0x37e544['id'],'WhatsappAccountId':_0x36a124['id'],'phone':_0x196330,'firstMsgDirection':_0x8dfc('0xc4'),'Messages':[_[_0x8dfc('0x53')](_0x26b004[_0x8dfc('0x65')],{'read':![],'body':_0x26b004['body'][_0x8dfc('0x65')],'phone':_0x196330,'WhatsappAccountId':_0x36a124['id'],'UserId':_0x26b004[_0x8dfc('0x5e')]['id'],'ContactId':_0x37e544['id']})]},{'include':[{'model':db[_0x8dfc('0x8b')],'as':'Messages'}]})['then'](function(_0x58e5ee){return[_0x58e5ee,!![]];});});}})[_0x8dfc('0x73')](function(_0x259b16,_0x430ae3){if(_0x430ae3){return _0x259b16;}return db[_0x8dfc('0x8b')][_0x8dfc('0x5d')](_[_0x8dfc('0x53')](_0x26b004[_0x8dfc('0x65')],{'read':![],'body':_0x26b004[_0x8dfc('0x65')][_0x8dfc('0x65')],'phone':_0x196330,'WhatsappAccountId':_0x36a124['id'],'WhatsappInteractionId':_0x259b16['id'],'UserId':_0x26b004[_0x8dfc('0x5e')]['id'],'ContactId':_0x37e544['id']}))['then'](function(_0x2baecb){_0x259b16[_0x8dfc('0xc5')][_0x8dfc('0xc6')]=[];_0x259b16['dataValues'][_0x8dfc('0xc6')][_0x8dfc('0xae')](_0x2baecb[_0x8dfc('0xc5')]);return _0x259b16;});})[_0x8dfc('0x21')](respondWithResult(_0x19d703,null))[_0x8dfc('0x2c')](handleError(_0x19d703,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 6bc87c1..7b0911a 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 _0xb52f=['emit','hasOwnProperty','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb52f,0x134));var _0xfb52=function(_0x41fb85,_0x1057b7){_0x41fb85=_0x41fb85-0x0;var _0x1c802c=_0xb52f[_0x41fb85];return _0x1c802c;};'use strict';var EventEmitter=require(_0xfb52('0x0'));var WhatsappAccount=require(_0xfb52('0x1'))['db'][_0xfb52('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xfb52('0x3')](0x0);var events={'afterCreate':_0xfb52('0x4'),'afterUpdate':_0xfb52('0x5'),'afterDestroy':_0xfb52('0x6')};function emitEvent(_0x4033a7){return function(_0x4ef54e,_0x1cffe1,_0xa51b48){WhatsappAccountEvents[_0xfb52('0x7')](_0x4033a7+':'+_0x4ef54e['id'],_0x4ef54e);WhatsappAccountEvents['emit'](_0x4033a7,_0x4ef54e);_0xa51b48(null);};}for(var e in events){if(events[_0xfb52('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xf678=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf678,0x134));var _0x8f67=function(_0x45aefe,_0x5e585a){_0x45aefe=_0x45aefe-0x0;var _0x9e1825=_0xf678[_0x45aefe];return _0x9e1825;};'use strict';var EventEmitter=require(_0x8f67('0x0'));var WhatsappAccount=require(_0x8f67('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8f67('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8f67('0x3')};function emitEvent(_0x3b0842){return function(_0x308097,_0x17a7f3,_0x41d6d7){WhatsappAccountEvents['emit'](_0x3b0842+':'+_0x308097['id'],_0x308097);WhatsappAccountEvents[_0x8f67('0x4')](_0x3b0842,_0x308097);_0x41d6d7(null);};}for(var e in events){if(events[_0x8f67('0x5')](e)){var event=events[e];WhatsappAccount[_0x8f67('0x6')](e,emitEvent(event));}}module[_0x8f67('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a1d1ae9..3d4bb76 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 _0x8969=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x8969,0x113));var _0x9896=function(_0x20c7f6,_0x2f7942){_0x20c7f6=_0x20c7f6-0x0;var _0x214abc=_0x8969[_0x20c7f6];return _0x214abc;};'use strict';var _=require(_0x9896('0x0'));var util=require('util');var logger=require(_0x9896('0x1'))('api');var moment=require(_0x9896('0x2'));var BPromise=require(_0x9896('0x3'));var rp=require(_0x9896('0x4'));var fs=require('fs');var path=require(_0x9896('0x5'));var rimraf=require(_0x9896('0x6'));var config=require(_0x9896('0x7'));var attributes=require(_0x9896('0x8'));module[_0x9896('0x9')]=function(_0x3449a6,_0x47a65b){return _0x3449a6[_0x9896('0xa')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15fe=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x379e80,_0x8893d2){var _0x429653=function(_0x39b412){while(--_0x39b412){_0x379e80['push'](_0x379e80['shift']());}};_0x429653(++_0x8893d2);}(_0x15fe,0x10c));var _0xe15f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x15fe[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe15f('0x0'));var util=require(_0xe15f('0x1'));var logger=require(_0xe15f('0x2'))(_0xe15f('0x3'));var moment=require(_0xe15f('0x4'));var BPromise=require(_0xe15f('0x5'));var rp=require(_0xe15f('0x6'));var fs=require('fs');var path=require(_0xe15f('0x7'));var rimraf=require(_0xe15f('0x8'));var config=require(_0xe15f('0x9'));var attributes=require(_0xe15f('0xa'));module['exports']=function(_0xec55c6,_0x3c0551){return _0xec55c6['define'](_0xe15f('0xb'),attributes,{'tableName':_0xe15f('0xc'),'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 1c758c5..6c2cc58 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 _0xf9a9=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','find','options','raw','where','include','map','model','attributes','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappAccount.socket','register','request','then'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0xf9a9,0xfe));var _0x9f9a=function(_0x39c42a,_0x598fd9){_0x39c42a=_0x39c42a-0x0;var _0x33d579=_0xf9a9[_0x39c42a];return _0x33d579;};'use strict';var _=require(_0x9f9a('0x0'));var util=require(_0x9f9a('0x1'));var moment=require(_0x9f9a('0x2'));var BPromise=require(_0x9f9a('0x3'));var rs=require(_0x9f9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f9a('0x5'))['db'];var utils=require(_0x9f9a('0x6'));var logger=require(_0x9f9a('0x7'))(_0x9f9a('0x8'));var config=require(_0x9f9a('0x9'));var jayson=require(_0x9f9a('0xa'));var client=jayson[_0x9f9a('0xb')][_0x9f9a('0xc')]({'port':0x232a});config[_0x9f9a('0xd')]=_['defaults'](config[_0x9f9a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f9a('0xe'))(new Redis(config['redis']));require(_0x9f9a('0xf'))[_0x9f9a('0x10')](socket);function respondWithRpcPromise(_0x4d3666,_0x4e9f84,_0xf4796a){return new BPromise(function(_0x485fdb,_0x96425a){return client[_0x9f9a('0x11')](_0x4d3666,_0xf4796a)[_0x9f9a('0x12')](function(_0x330d00){logger['info'](_0x9f9a('0x13'),_0x4e9f84,_0x9f9a('0x14'));logger[_0x9f9a('0x15')](_0x9f9a('0x16'),_0x4e9f84,_0x9f9a('0x14'),JSON[_0x9f9a('0x17')](_0x330d00));if(_0x330d00['error']){if(_0x330d00[_0x9f9a('0x18')][_0x9f9a('0x19')]===0x1f4){logger[_0x9f9a('0x18')](_0x9f9a('0x13'),_0x4e9f84,_0x330d00['error']['message']);return _0x96425a(_0x330d00[_0x9f9a('0x18')][_0x9f9a('0x1a')]);}logger['error'](_0x9f9a('0x13'),_0x4e9f84,_0x330d00[_0x9f9a('0x18')][_0x9f9a('0x1a')]);return _0x485fdb(_0x330d00['error'][_0x9f9a('0x1a')]);}else{logger[_0x9f9a('0x1b')](_0x9f9a('0x13'),_0x4e9f84,'request\x20sent');_0x485fdb(_0x330d00[_0x9f9a('0x1c')]['message']);}})[_0x9f9a('0x1d')](function(_0xf45736){logger[_0x9f9a('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x4e9f84,_0xf45736);_0x96425a(_0xf45736);});});}exports['ShowWhatsappAccount']=function(_0x387c9d){var _0x8e28e0=this;return new Promise(function(_0x35350b,_0x320446){return db['WhatsappAccount'][_0x9f9a('0x1e')]({'raw':_0x387c9d[_0x9f9a('0x1f')]?_0x387c9d[_0x9f9a('0x1f')][_0x9f9a('0x20')]===undefined?!![]:![]:!![],'where':_0x387c9d[_0x9f9a('0x1f')]?_0x387c9d[_0x9f9a('0x1f')][_0x9f9a('0x21')]||null:null,'attributes':_0x387c9d[_0x9f9a('0x1f')]?_0x387c9d['options']['attributes']||null:null,'include':_0x387c9d[_0x9f9a('0x1f')]?_0x387c9d[_0x9f9a('0x1f')][_0x9f9a('0x22')]?_[_0x9f9a('0x23')](_0x387c9d['options'][_0x9f9a('0x22')],function(_0x4d8925){return{'model':db[_0x4d8925[_0x9f9a('0x24')]],'as':_0x4d8925['as'],'attributes':_0x4d8925[_0x9f9a('0x25')],'include':_0x4d8925[_0x9f9a('0x22')]?_[_0x9f9a('0x23')](_0x4d8925['include'],function(_0x203389){return{'model':db[_0x203389['model']],'as':_0x203389['as'],'attributes':_0x203389['attributes'],'include':_0x203389[_0x9f9a('0x22')]?_['map'](_0x203389[_0x9f9a('0x22')],function(_0x1ab947){return{'model':db[_0x1ab947[_0x9f9a('0x24')]],'as':_0x1ab947['as'],'attributes':_0x1ab947['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f9a('0x12')](function(_0x105d64){logger['info']('ShowWhatsappAccount',_0x387c9d);logger[_0x9f9a('0x15')]('ShowWhatsappAccount',_0x387c9d,JSON['stringify'](_0x105d64));_0x35350b(_0x105d64);})['catch'](function(_0x51a5e1){logger['error'](_0x9f9a('0x26'),_0x51a5e1[_0x9f9a('0x1a')],_0x387c9d);_0x320446(_0x8e28e0[_0x9f9a('0x18')](0x1f4,_0x51a5e1[_0x9f9a('0x1a')]));});});}; \ No newline at end of file +var _0x6037=['include','map','attributes','model','debug','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','localhost','./whatsappAccount.socket','register','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6037,0x1c0));var _0x7603=function(_0x4445cd,_0x2c64e9){_0x4445cd=_0x4445cd-0x0;var _0x5c6f18=_0x6037[_0x4445cd];return _0x5c6f18;};'use strict';var _=require(_0x7603('0x0'));var util=require('util');var moment=require(_0x7603('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7603('0x2'))['db'];var utils=require(_0x7603('0x3'));var logger=require(_0x7603('0x4'))(_0x7603('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7603('0x6')]['http']({'port':0x232a});config['redis']=_[_0x7603('0x7')](config[_0x7603('0x8')],{'host':_0x7603('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7603('0x8')]));require(_0x7603('0xa'))[_0x7603('0xb')](socket);function respondWithRpcPromise(_0x48ad9b,_0x163fcd,_0x280033){return new BPromise(function(_0x17dcf5,_0x3ca135){return client['request'](_0x48ad9b,_0x280033)[_0x7603('0xc')](function(_0x17c8a3){logger[_0x7603('0xd')]('WhatsappAccount,\x20%s,\x20%s',_0x163fcd,_0x7603('0xe'));logger['debug'](_0x7603('0xf'),_0x163fcd,'request\x20sent',JSON[_0x7603('0x10')](_0x17c8a3));if(_0x17c8a3[_0x7603('0x11')]){if(_0x17c8a3[_0x7603('0x11')][_0x7603('0x12')]===0x1f4){logger[_0x7603('0x11')](_0x7603('0x13'),_0x163fcd,_0x17c8a3[_0x7603('0x11')][_0x7603('0x14')]);return _0x3ca135(_0x17c8a3[_0x7603('0x11')]['message']);}logger[_0x7603('0x11')](_0x7603('0x13'),_0x163fcd,_0x17c8a3['error'][_0x7603('0x14')]);return _0x17dcf5(_0x17c8a3[_0x7603('0x11')]['message']);}else{logger[_0x7603('0xd')](_0x7603('0x13'),_0x163fcd,_0x7603('0xe'));_0x17dcf5(_0x17c8a3[_0x7603('0x15')][_0x7603('0x14')]);}})['catch'](function(_0x2063c1){logger[_0x7603('0x11')](_0x7603('0x13'),_0x163fcd,_0x2063c1);_0x3ca135(_0x2063c1);});});}exports[_0x7603('0x16')]=function(_0x169e90){var _0xcfb387=this;return new Promise(function(_0x33a82d,_0xc8492b){return db[_0x7603('0x17')][_0x7603('0x18')]({'raw':_0x169e90[_0x7603('0x19')]?_0x169e90[_0x7603('0x19')][_0x7603('0x1a')]===undefined?!![]:![]:!![],'where':_0x169e90['options']?_0x169e90[_0x7603('0x19')][_0x7603('0x1b')]||null:null,'attributes':_0x169e90[_0x7603('0x19')]?_0x169e90['options']['attributes']||null:null,'include':_0x169e90['options']?_0x169e90[_0x7603('0x19')][_0x7603('0x1c')]?_[_0x7603('0x1d')](_0x169e90['options'][_0x7603('0x1c')],function(_0x57cf4e){return{'model':db[_0x57cf4e['model']],'as':_0x57cf4e['as'],'attributes':_0x57cf4e[_0x7603('0x1e')],'include':_0x57cf4e[_0x7603('0x1c')]?_[_0x7603('0x1d')](_0x57cf4e[_0x7603('0x1c')],function(_0x4f89f1){return{'model':db[_0x4f89f1[_0x7603('0x1f')]],'as':_0x4f89f1['as'],'attributes':_0x4f89f1['attributes'],'include':_0x4f89f1[_0x7603('0x1c')]?_[_0x7603('0x1d')](_0x4f89f1[_0x7603('0x1c')],function(_0x21da8e){return{'model':db[_0x21da8e[_0x7603('0x1f')]],'as':_0x21da8e['as'],'attributes':_0x21da8e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x29ecbb){logger[_0x7603('0xd')](_0x7603('0x16'),_0x169e90);logger[_0x7603('0x20')](_0x7603('0x16'),_0x169e90,JSON[_0x7603('0x10')](_0x29ecbb));_0x33a82d(_0x29ecbb);})[_0x7603('0x21')](function(_0x2c6327){logger['error'](_0x7603('0x16'),_0x2c6327['message'],_0x169e90);_0xc8492b(_0xcfb387['error'](0x1f4,_0x2c6327[_0x7603('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 35f5da2..f848f84 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 _0x94cb=['update','emit','removeListener','register','length','whatsappAccount:','save','remove'];(function(_0x37e57d,_0x52d437){var _0x4d3bbe=function(_0x2d58a6){while(--_0x2d58a6){_0x37e57d['push'](_0x37e57d['shift']());}};_0x4d3bbe(++_0x52d437);}(_0x94cb,0x76));var _0xb94c=function(_0x2afd47,_0x59ccbb){_0x2afd47=_0x2afd47-0x0;var _0x5d95bd=_0x94cb[_0x2afd47];return _0x5d95bd;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xb94c('0x0'),_0xb94c('0x1'),_0xb94c('0x2')];function createListener(_0x254e00,_0x4a8490){return function(_0x3bab82){_0x4a8490[_0xb94c('0x3')](_0x254e00,_0x3bab82);};}function removeListener(_0x14860a,_0x31e2d9){return function(){WhatsappAccountEvents[_0xb94c('0x4')](_0x14860a,_0x31e2d9);};}exports[_0xb94c('0x5')]=function(_0x3b062d){for(var _0x41da4c=0x0,_0x2dfb0b=events[_0xb94c('0x6')];_0x41da4c<_0x2dfb0b;_0x41da4c++){var _0x2ceaf2=events[_0x41da4c];var _0x1532d0=createListener(_0xb94c('0x7')+_0x2ceaf2,_0x3b062d);WhatsappAccountEvents['on'](_0x2ceaf2,_0x1532d0);}}; \ No newline at end of file +var _0x9a1d=['removeListener','register','length','whatsappAccount:','./whatsappAccount.events','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9a1d,0x1e0));var _0xd9a1=function(_0x42b931,_0x3b67f1){_0x42b931=_0x42b931-0x0;var _0x3cd6a2=_0x9a1d[_0x42b931];return _0x3cd6a2;};'use strict';var WhatsappAccountEvents=require(_0xd9a1('0x0'));var events=['save','remove',_0xd9a1('0x1')];function createListener(_0x13fe5f,_0x5ef61c){return function(_0x5d872b){_0x5ef61c[_0xd9a1('0x2')](_0x13fe5f,_0x5d872b);};}function removeListener(_0x3d3a6d,_0x1c6f91){return function(){WhatsappAccountEvents[_0xd9a1('0x3')](_0x3d3a6d,_0x1c6f91);};}exports[_0xd9a1('0x4')]=function(_0x4048b9){for(var _0x2ae17d=0x0,_0x578220=events[_0xd9a1('0x5')];_0x2ae17d<_0x578220;_0x2ae17d++){var _0x44bb11=events[_0x2ae17d];var _0x3452b5=createListener(_0xd9a1('0x6')+_0x44bb11,_0x4048b9);WhatsappAccountEvents['on'](_0x44bb11,_0x3452b5);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 3f8a07c..19b7e60 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 _0xe37b=['/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index'];(function(_0x1f00c2,_0xcbc08a){var _0x2c425e=function(_0x191137){while(--_0x191137){_0x1f00c2['push'](_0x1f00c2['shift']());}};_0x2c425e(++_0xcbc08a);}(_0xe37b,0xd9));var _0xbe37=function(_0x49fcdc,_0xa1199c){_0x49fcdc=_0x49fcdc-0x0;var _0x3b73bc=_0xe37b[_0x49fcdc];return _0x3b73bc;};'use strict';var multer=require(_0xbe37('0x0'));var util=require('util');var path=require(_0xbe37('0x1'));var timeout=require(_0xbe37('0x2'));var express=require(_0xbe37('0x3'));var router=express[_0xbe37('0x4')]();var fs_extra=require(_0xbe37('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe37('0x6'));var controller=require(_0xbe37('0x7'));router[_0xbe37('0x8')]('/',auth[_0xbe37('0x9')](),controller[_0xbe37('0xa')]);router['get'](_0xbe37('0xb'),auth[_0xbe37('0x9')](),controller[_0xbe37('0xc')]);router[_0xbe37('0xd')]('/',auth[_0xbe37('0x9')](),controller[_0xbe37('0xe')]);router[_0xbe37('0xf')](_0xbe37('0xb'),auth[_0xbe37('0x9')](),controller['update']);router[_0xbe37('0x10')](_0xbe37('0xb'),auth[_0xbe37('0x9')](),controller[_0xbe37('0x11')]);module[_0xbe37('0x12')]=router; \ No newline at end of file +var _0xa730=['../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x47b9d3,_0x18f3a1){var _0xfa7c91=function(_0x51e0d2){while(--_0x51e0d2){_0x47b9d3['push'](_0x47b9d3['shift']());}};_0xfa7c91(++_0x18f3a1);}(_0xa730,0x71));var _0x0a73=function(_0x30a643,_0x353e60){_0x30a643=_0x30a643-0x0;var _0x59b894=_0xa730[_0x30a643];return _0x59b894;};'use strict';var multer=require(_0x0a73('0x0'));var util=require(_0x0a73('0x1'));var path=require(_0x0a73('0x2'));var timeout=require(_0x0a73('0x3'));var express=require(_0x0a73('0x4'));var router=express[_0x0a73('0x5')]();var fs_extra=require(_0x0a73('0x6'));var auth=require(_0x0a73('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0a73('0x8'));var controller=require(_0x0a73('0x9'));router[_0x0a73('0xa')]('/',auth[_0x0a73('0xb')](),controller[_0x0a73('0xc')]);router[_0x0a73('0xa')](_0x0a73('0xd'),auth['isAuthenticated'](),controller[_0x0a73('0xe')]);router['post']('/',auth[_0x0a73('0xb')](),controller[_0x0a73('0xf')]);router[_0x0a73('0x10')](_0x0a73('0xd'),auth[_0x0a73('0xb')](),controller['update']);router[_0x0a73('0x11')](_0x0a73('0xd'),auth['isAuthenticated'](),controller[_0x0a73('0x12')]);module[_0x0a73('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 39de5f0..368bdb7 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 _0xf265=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0xcea585,_0x1c3444){var _0x5db945=function(_0x2177f){while(--_0x2177f){_0xcea585['push'](_0xcea585['shift']());}};_0x5db945(++_0x1c3444);}(_0xf265,0x64));var _0x5f26=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xf265[_0x1a0daa];return _0x1dbe15;};'use strict';var Sequelize=require(_0x5f26('0x0'));module[_0x5f26('0x1')]={'priority':{'type':Sequelize[_0x5f26('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5f26('0x3')],'allowNull':![],'defaultValue':_0x5f26('0x4')},'appdata':{'type':Sequelize[_0x5f26('0x5')]()},'description':{'type':Sequelize[_0x5f26('0x3')]},'interval':{'type':Sequelize[_0x5f26('0x3')],'defaultValue':_0x5f26('0x6')}}; \ No newline at end of file +var _0xc34f=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x581949,_0x17036a){var _0x1174af=function(_0x518a89){while(--_0x518a89){_0x581949['push'](_0x581949['shift']());}};_0x1174af(++_0x17036a);}(_0xc34f,0xfd));var _0xfc34=function(_0x1bbce7,_0x581b65){_0x1bbce7=_0x1bbce7-0x0;var _0xe3a3ef=_0xc34f[_0x1bbce7];return _0xe3a3ef;};'use strict';var Sequelize=require('sequelize');module[_0xfc34('0x0')]={'priority':{'type':Sequelize[_0xfc34('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfc34('0x2')],'allowNull':![],'defaultValue':_0xfc34('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfc34('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xfc34('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 94939a0..ed53db1 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 _0x0ef4=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','Content-Range','json','apply','save','update','then','destroy','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','WhatsappApplication','count','includeAll','include','findAll','catch','show','params','length','merge','options','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','fs-extra'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x0ef4,0xc7));var _0x40ef=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0x0ef4[_0x3b3f4f];return _0x174dbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40ef('0x0'));var zipdir=require(_0x40ef('0x1'));var jsonpatch=require(_0x40ef('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40ef('0x3'));var Mustache=require(_0x40ef('0x4'));var util=require(_0x40ef('0x5'));var path=require('path');var sox=require(_0x40ef('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40ef('0x7'));var _=require(_0x40ef('0x8'));var squel=require(_0x40ef('0x9'));var crypto=require(_0x40ef('0xa'));var jsforce=require(_0x40ef('0xb'));var deskjs=require(_0x40ef('0xc'));var toCsv=require(_0x40ef('0xd'));var querystring=require(_0x40ef('0xe'));var Papa=require(_0x40ef('0xf'));var Redis=require('ioredis');var authService=require(_0x40ef('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x40ef('0x11'));var hardwareService=require(_0x40ef('0x12'));var logger=require(_0x40ef('0x13'))(_0x40ef('0x14'));var utils=require('../../config/utils');var config=require(_0x40ef('0x15'));var licenseUtil=require(_0x40ef('0x16'));var db=require(_0x40ef('0x17'))['db'];function respondWithStatusCode(_0x3d44c7,_0x1c4ed4){_0x1c4ed4=_0x1c4ed4||0xcc;return function(_0x136ccd){if(_0x136ccd){return _0x3d44c7[_0x40ef('0x18')](_0x1c4ed4);}return _0x3d44c7[_0x40ef('0x19')](_0x1c4ed4)[_0x40ef('0x1a')]();};}function respondWithResult(_0x3d5a16,_0xaf0020){_0xaf0020=_0xaf0020||0xc8;return function(_0x256142){if(_0x256142){return _0x3d5a16['status'](_0xaf0020)['json'](_0x256142);}};}function respondWithFilteredResult(_0x1ab3ba,_0x5010b3){return function(_0x39d022){if(_0x39d022){var _0xdb24fd=typeof _0x5010b3['offset']===_0x40ef('0x1b')&&typeof _0x5010b3[_0x40ef('0x1c')]==='undefined';var _0x3ddcf0=_0x39d022['count'];var _0x3a3ba2=_0xdb24fd?0x0:_0x5010b3[_0x40ef('0x1d')];var _0x3573bd=_0xdb24fd?_0x39d022['count']:_0x5010b3['offset']+_0x5010b3[_0x40ef('0x1c')];var _0x54c35d;if(_0x3573bd>=_0x3ddcf0){_0x3573bd=_0x3ddcf0;_0x54c35d=0xc8;}else{_0x54c35d=0xce;}_0x1ab3ba[_0x40ef('0x19')](_0x54c35d);return _0x1ab3ba['set'](_0x40ef('0x1e'),_0x3a3ba2+'-'+_0x3573bd+'/'+_0x3ddcf0)[_0x40ef('0x1f')](_0x39d022);}return null;};}function patchUpdates(_0x514263){return function(_0x2f6fd5){try{jsonpatch[_0x40ef('0x20')](_0x2f6fd5,_0x514263,!![]);}catch(_0xa60df3){return BPromise['reject'](_0xa60df3);}return _0x2f6fd5[_0x40ef('0x21')]();};}function saveUpdates(_0x4cef12,_0x3fb29c){return function(_0x5d2d53){if(_0x5d2d53){return _0x5d2d53[_0x40ef('0x22')](_0x4cef12)[_0x40ef('0x23')](function(_0x33ffdf){return _0x33ffdf;});}return null;};}function removeEntity(_0x362c81,_0x98d8ef){return function(_0x3d5266){if(_0x3d5266){return _0x3d5266[_0x40ef('0x24')]()[_0x40ef('0x23')](function(){_0x362c81[_0x40ef('0x19')](0xcc)[_0x40ef('0x1a')]();});}};}function handleEntityNotFound(_0x1df9e1,_0x435ce2){return function(_0x14f620){if(!_0x14f620){_0x1df9e1[_0x40ef('0x18')](0x194);}return _0x14f620;};}function handleError(_0x48cfb0,_0x3539bc){_0x3539bc=_0x3539bc||0x1f4;return function(_0x336c03){logger['error'](_0x336c03['stack']);if(_0x336c03[_0x40ef('0x25')]){delete _0x336c03[_0x40ef('0x25')];}_0x48cfb0['status'](_0x3539bc)['send'](_0x336c03);};}exports['index']=function(_0x7a3c7c,_0x570145){var _0x5c87c9={},_0xa1846c={},_0xd4338d={'count':0x0,'rows':[]};var _0x5b541d=_[_0x40ef('0x26')](db['WhatsappApplication'][_0x40ef('0x27')],function(_0x13552e){return{'name':_0x13552e[_0x40ef('0x28')],'type':_0x13552e[_0x40ef('0x29')][_0x40ef('0x2a')]};});_0xa1846c[_0x40ef('0x2b')]=_[_0x40ef('0x26')](_0x5b541d,_0x40ef('0x25'));_0xa1846c[_0x40ef('0x2c')]=_[_0x40ef('0x2d')](_0x7a3c7c['query']);_0xa1846c['filters']=_[_0x40ef('0x2e')](_0xa1846c[_0x40ef('0x2b')],_0xa1846c['query']);_0x5c87c9['attributes']=_['intersection'](_0xa1846c[_0x40ef('0x2b')],qs['fields'](_0x7a3c7c['query'][_0x40ef('0x2f')]));_0x5c87c9[_0x40ef('0x30')]=_0x5c87c9[_0x40ef('0x30')]['length']?_0x5c87c9[_0x40ef('0x30')]:_0xa1846c[_0x40ef('0x2b')];if(!_0x7a3c7c[_0x40ef('0x2c')][_0x40ef('0x31')]('nolimit')){_0x5c87c9['limit']=qs[_0x40ef('0x1c')](_0x7a3c7c['query']['limit']);_0x5c87c9[_0x40ef('0x1d')]=qs[_0x40ef('0x1d')](_0x7a3c7c['query'][_0x40ef('0x1d')]);}_0x5c87c9['order']=qs[_0x40ef('0x32')](_0x7a3c7c['query'][_0x40ef('0x32')]);_0x5c87c9[_0x40ef('0x33')]=qs[_0x40ef('0x34')](_[_0x40ef('0x35')](_0x7a3c7c['query'],_0xa1846c[_0x40ef('0x34')]),_0x5b541d);if(_0x7a3c7c['query'][_0x40ef('0x36')]){_0x5c87c9['where']=_['merge'](_0x5c87c9[_0x40ef('0x33')],{'$or':_[_0x40ef('0x26')](_0x5b541d,function(_0x159a28){if(_0x159a28['type']!==_0x40ef('0x37')){var _0x54345f={};_0x54345f[_0x159a28[_0x40ef('0x25')]]={'$like':'%'+_0x7a3c7c[_0x40ef('0x2c')]['filter']+'%'};return _0x54345f;}})});}_0x5c87c9=_['merge']({},_0x5c87c9,_0x7a3c7c['options']);var _0x1b68d3={'where':_0x5c87c9[_0x40ef('0x33')]};return db[_0x40ef('0x38')][_0x40ef('0x39')](_0x1b68d3)[_0x40ef('0x23')](function(_0x221006){_0xd4338d[_0x40ef('0x39')]=_0x221006;if(_0x7a3c7c[_0x40ef('0x2c')][_0x40ef('0x3a')]){_0x5c87c9[_0x40ef('0x3b')]=[{'all':!![]}];}return db[_0x40ef('0x38')][_0x40ef('0x3c')](_0x5c87c9);})[_0x40ef('0x23')](function(_0x5bf9f3){_0xd4338d['rows']=_0x5bf9f3;return _0xd4338d;})[_0x40ef('0x23')](respondWithFilteredResult(_0x570145,_0x5c87c9))[_0x40ef('0x3d')](handleError(_0x570145,null));};exports[_0x40ef('0x3e')]=function(_0x32e749,_0x2e7971){var _0x5583d3={'raw':!![],'where':{'id':_0x32e749[_0x40ef('0x3f')]['id']}},_0xd75ebe={};_0xd75ebe[_0x40ef('0x2b')]=_[_0x40ef('0x2d')](db[_0x40ef('0x38')]['rawAttributes']);_0xd75ebe[_0x40ef('0x2c')]=_[_0x40ef('0x2d')](_0x32e749[_0x40ef('0x2c')]);_0xd75ebe[_0x40ef('0x34')]=_[_0x40ef('0x2e')](_0xd75ebe[_0x40ef('0x2b')],_0xd75ebe[_0x40ef('0x2c')]);_0x5583d3[_0x40ef('0x30')]=_['intersection'](_0xd75ebe[_0x40ef('0x2b')],qs[_0x40ef('0x2f')](_0x32e749[_0x40ef('0x2c')]['fields']));_0x5583d3[_0x40ef('0x30')]=_0x5583d3[_0x40ef('0x30')][_0x40ef('0x40')]?_0x5583d3['attributes']:_0xd75ebe[_0x40ef('0x2b')];if(_0x32e749[_0x40ef('0x2c')]['includeAll']){_0x5583d3[_0x40ef('0x3b')]=[{'all':!![]}];}_0x5583d3=_[_0x40ef('0x41')]({},_0x5583d3,_0x32e749[_0x40ef('0x42')]);return db[_0x40ef('0x38')]['find'](_0x5583d3)[_0x40ef('0x23')](handleEntityNotFound(_0x2e7971,null))['then'](respondWithResult(_0x2e7971,null))[_0x40ef('0x3d')](handleError(_0x2e7971,null));};exports[_0x40ef('0x43')]=function(_0x1ccc24,_0x407f23){return db[_0x40ef('0x38')]['create'](_0x1ccc24[_0x40ef('0x44')],{})[_0x40ef('0x23')](respondWithResult(_0x407f23,0xc9))[_0x40ef('0x3d')](handleError(_0x407f23,null));};exports['update']=function(_0x10e2a7,_0x1e5190){if(_0x10e2a7[_0x40ef('0x44')]['id']){delete _0x10e2a7[_0x40ef('0x44')]['id'];}return db[_0x40ef('0x38')]['find']({'where':{'id':_0x10e2a7[_0x40ef('0x3f')]['id']}})[_0x40ef('0x23')](handleEntityNotFound(_0x1e5190,null))[_0x40ef('0x23')](saveUpdates(_0x10e2a7[_0x40ef('0x44')],null))[_0x40ef('0x23')](respondWithResult(_0x1e5190,null))[_0x40ef('0x3d')](handleError(_0x1e5190,null));};exports[_0x40ef('0x24')]=function(_0x4a5446,_0xc5306a){return db[_0x40ef('0x38')]['find']({'where':{'id':_0x4a5446[_0x40ef('0x3f')]['id']}})[_0x40ef('0x23')](handleEntityNotFound(_0xc5306a,null))[_0x40ef('0x23')](removeEntity(_0xc5306a,null))[_0x40ef('0x3d')](handleError(_0xc5306a,null));}; \ No newline at end of file +var _0x5078=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5078,0x148));var _0x8507=function(_0x206453,_0x46c9ec){_0x206453=_0x206453-0x0;var _0xcde5a9=_0x5078[_0x206453];return _0xcde5a9;};'use strict';var emlformat=require(_0x8507('0x0'));var rimraf=require(_0x8507('0x1'));var zipdir=require(_0x8507('0x2'));var jsonpatch=require(_0x8507('0x3'));var rp=require(_0x8507('0x4'));var moment=require(_0x8507('0x5'));var BPromise=require(_0x8507('0x6'));var Mustache=require(_0x8507('0x7'));var util=require(_0x8507('0x8'));var path=require(_0x8507('0x9'));var sox=require(_0x8507('0xa'));var csv=require(_0x8507('0xb'));var ejs=require(_0x8507('0xc'));var fs=require('fs');var fs_extra=require(_0x8507('0xd'));var _=require(_0x8507('0xe'));var squel=require(_0x8507('0xf'));var crypto=require('crypto');var jsforce=require(_0x8507('0x10'));var deskjs=require(_0x8507('0x11'));var toCsv=require(_0x8507('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8507('0x12'));var authService=require(_0x8507('0x13'));var qs=require(_0x8507('0x14'));var as=require(_0x8507('0x15'));var hardwareService=require(_0x8507('0x16'));var logger=require(_0x8507('0x17'))(_0x8507('0x18'));var utils=require('../../config/utils');var config=require(_0x8507('0x19'));var licenseUtil=require(_0x8507('0x1a'));var db=require(_0x8507('0x1b'))['db'];function respondWithStatusCode(_0x31109f,_0x21a236){_0x21a236=_0x21a236||0xcc;return function(_0x5c41e2){if(_0x5c41e2){return _0x31109f['sendStatus'](_0x21a236);}return _0x31109f[_0x8507('0x1c')](_0x21a236)[_0x8507('0x1d')]();};}function respondWithResult(_0x1f5550,_0x3bafeb){_0x3bafeb=_0x3bafeb||0xc8;return function(_0x2ea0e1){if(_0x2ea0e1){return _0x1f5550[_0x8507('0x1c')](_0x3bafeb)['json'](_0x2ea0e1);}};}function respondWithFilteredResult(_0x4f5aa0,_0x58ff83){return function(_0x1ec9b8){if(_0x1ec9b8){var _0x3f1ed1=typeof _0x58ff83['offset']===_0x8507('0x1e')&&typeof _0x58ff83[_0x8507('0x1f')]===_0x8507('0x1e');var _0x412aee=_0x1ec9b8[_0x8507('0x20')];var _0x13b285=_0x3f1ed1?0x0:_0x58ff83[_0x8507('0x21')];var _0x36e387=_0x3f1ed1?_0x1ec9b8['count']:_0x58ff83['offset']+_0x58ff83[_0x8507('0x1f')];var _0xc556a4;if(_0x36e387>=_0x412aee){_0x36e387=_0x412aee;_0xc556a4=0xc8;}else{_0xc556a4=0xce;}_0x4f5aa0[_0x8507('0x1c')](_0xc556a4);return _0x4f5aa0[_0x8507('0x22')](_0x8507('0x23'),_0x13b285+'-'+_0x36e387+'/'+_0x412aee)['json'](_0x1ec9b8);}return null;};}function patchUpdates(_0x1b8dbf){return function(_0x16501a){try{jsonpatch[_0x8507('0x24')](_0x16501a,_0x1b8dbf,!![]);}catch(_0x192f1c){return BPromise[_0x8507('0x25')](_0x192f1c);}return _0x16501a[_0x8507('0x26')]();};}function saveUpdates(_0x42e5ff,_0x2dc900){return function(_0x539cf9){if(_0x539cf9){return _0x539cf9[_0x8507('0x27')](_0x42e5ff)[_0x8507('0x28')](function(_0x37fd9c){return _0x37fd9c;});}return null;};}function removeEntity(_0x40ad72,_0x873ec4){return function(_0x438001){if(_0x438001){return _0x438001[_0x8507('0x29')]()[_0x8507('0x28')](function(){_0x40ad72['status'](0xcc)[_0x8507('0x1d')]();});}};}function handleEntityNotFound(_0x24fc61,_0x188ae0){return function(_0x5a559e){if(!_0x5a559e){_0x24fc61[_0x8507('0x2a')](0x194);}return _0x5a559e;};}function handleError(_0x15c710,_0x404d73){_0x404d73=_0x404d73||0x1f4;return function(_0x160402){logger['error'](_0x160402[_0x8507('0x2b')]);if(_0x160402[_0x8507('0x2c')]){delete _0x160402[_0x8507('0x2c')];}_0x15c710[_0x8507('0x1c')](_0x404d73)[_0x8507('0x2d')](_0x160402);};}exports['index']=function(_0x23c6e1,_0xb01c06){var _0x232182={},_0x2ca452={},_0x25fe12={'count':0x0,'rows':[]};var _0x8b5a47=_[_0x8507('0x2e')](db[_0x8507('0x2f')][_0x8507('0x30')],function(_0x6e9a38){return{'name':_0x6e9a38[_0x8507('0x31')],'type':_0x6e9a38[_0x8507('0x32')][_0x8507('0x33')]};});_0x2ca452['model']=_['map'](_0x8b5a47,_0x8507('0x2c'));_0x2ca452['query']=_[_0x8507('0x34')](_0x23c6e1[_0x8507('0x35')]);_0x2ca452['filters']=_['intersection'](_0x2ca452['model'],_0x2ca452[_0x8507('0x35')]);_0x232182[_0x8507('0x36')]=_[_0x8507('0x37')](_0x2ca452[_0x8507('0x38')],qs[_0x8507('0x39')](_0x23c6e1[_0x8507('0x35')]['fields']));_0x232182['attributes']=_0x232182[_0x8507('0x36')][_0x8507('0x3a')]?_0x232182[_0x8507('0x36')]:_0x2ca452['model'];if(!_0x23c6e1['query'][_0x8507('0x3b')](_0x8507('0x3c'))){_0x232182['limit']=qs[_0x8507('0x1f')](_0x23c6e1[_0x8507('0x35')]['limit']);_0x232182['offset']=qs['offset'](_0x23c6e1[_0x8507('0x35')][_0x8507('0x21')]);}_0x232182[_0x8507('0x3d')]=qs[_0x8507('0x3e')](_0x23c6e1['query']['sort']);_0x232182[_0x8507('0x3f')]=qs[_0x8507('0x40')](_['pick'](_0x23c6e1[_0x8507('0x35')],_0x2ca452[_0x8507('0x40')]),_0x8b5a47);if(_0x23c6e1[_0x8507('0x35')]['filter']){_0x232182[_0x8507('0x3f')]=_[_0x8507('0x41')](_0x232182[_0x8507('0x3f')],{'$or':_[_0x8507('0x2e')](_0x8b5a47,function(_0x46e6dd){if(_0x46e6dd[_0x8507('0x32')]!=='VIRTUAL'){var _0x42e640={};_0x42e640[_0x46e6dd[_0x8507('0x2c')]]={'$like':'%'+_0x23c6e1['query'][_0x8507('0x42')]+'%'};return _0x42e640;}})});}_0x232182=_[_0x8507('0x41')]({},_0x232182,_0x23c6e1['options']);var _0x2297a8={'where':_0x232182['where']};return db[_0x8507('0x2f')][_0x8507('0x20')](_0x2297a8)['then'](function(_0x2d344e){_0x25fe12['count']=_0x2d344e;if(_0x23c6e1[_0x8507('0x35')][_0x8507('0x43')]){_0x232182[_0x8507('0x44')]=[{'all':!![]}];}return db[_0x8507('0x2f')][_0x8507('0x45')](_0x232182);})[_0x8507('0x28')](function(_0x54d8d3){_0x25fe12[_0x8507('0x46')]=_0x54d8d3;return _0x25fe12;})[_0x8507('0x28')](respondWithFilteredResult(_0xb01c06,_0x232182))[_0x8507('0x47')](handleError(_0xb01c06,null));};exports[_0x8507('0x48')]=function(_0x57083e,_0x260a98){var _0x2e49d0={'raw':!![],'where':{'id':_0x57083e[_0x8507('0x49')]['id']}},_0x55b156={};_0x55b156[_0x8507('0x38')]=_[_0x8507('0x34')](db['WhatsappApplication'][_0x8507('0x30')]);_0x55b156['query']=_[_0x8507('0x34')](_0x57083e[_0x8507('0x35')]);_0x55b156[_0x8507('0x40')]=_[_0x8507('0x37')](_0x55b156['model'],_0x55b156[_0x8507('0x35')]);_0x2e49d0[_0x8507('0x36')]=_[_0x8507('0x37')](_0x55b156[_0x8507('0x38')],qs['fields'](_0x57083e['query']['fields']));_0x2e49d0[_0x8507('0x36')]=_0x2e49d0[_0x8507('0x36')][_0x8507('0x3a')]?_0x2e49d0[_0x8507('0x36')]:_0x55b156[_0x8507('0x38')];if(_0x57083e[_0x8507('0x35')]['includeAll']){_0x2e49d0[_0x8507('0x44')]=[{'all':!![]}];}_0x2e49d0=_[_0x8507('0x41')]({},_0x2e49d0,_0x57083e['options']);return db[_0x8507('0x2f')][_0x8507('0x4a')](_0x2e49d0)[_0x8507('0x28')](handleEntityNotFound(_0x260a98,null))[_0x8507('0x28')](respondWithResult(_0x260a98,null))[_0x8507('0x47')](handleError(_0x260a98,null));};exports[_0x8507('0x4b')]=function(_0x4858b6,_0x5e119e){return db['WhatsappApplication'][_0x8507('0x4b')](_0x4858b6[_0x8507('0x4c')],{})[_0x8507('0x28')](respondWithResult(_0x5e119e,0xc9))[_0x8507('0x47')](handleError(_0x5e119e,null));};exports[_0x8507('0x27')]=function(_0x2c3a5d,_0x5bb3c4){if(_0x2c3a5d[_0x8507('0x4c')]['id']){delete _0x2c3a5d[_0x8507('0x4c')]['id'];}return db[_0x8507('0x2f')][_0x8507('0x4a')]({'where':{'id':_0x2c3a5d[_0x8507('0x49')]['id']}})[_0x8507('0x28')](handleEntityNotFound(_0x5bb3c4,null))['then'](saveUpdates(_0x2c3a5d['body'],null))[_0x8507('0x28')](respondWithResult(_0x5bb3c4,null))[_0x8507('0x47')](handleError(_0x5bb3c4,null));};exports[_0x8507('0x29')]=function(_0x75b763,_0x50465d){return db[_0x8507('0x2f')][_0x8507('0x4a')]({'where':{'id':_0x75b763['params']['id']}})[_0x8507('0x28')](handleEntityNotFound(_0x50465d,null))[_0x8507('0x28')](removeEntity(_0x50465d,null))['catch'](handleError(_0x50465d,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index af374f1..4307941 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 _0x032e=['api','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x262ab2,_0x3d0bcd){var _0x59903c=function(_0x1f716f){while(--_0x1f716f){_0x262ab2['push'](_0x262ab2['shift']());}};_0x59903c(++_0x3d0bcd);}(_0x032e,0x124));var _0xe032=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x032e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe032('0x3'));var fs=require('fs');var path=require(_0xe032('0x4'));var rimraf=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var attributes=require(_0xe032('0x7'));module[_0xe032('0x8')]=function(_0x2ba8a0,_0x33ad0b){return _0x2ba8a0[_0xe032('0x9')](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe032('0xc'),'collate':_0xe032('0xd')});}; \ No newline at end of file +var _0x6921=['request-promise','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird'];(function(_0x4f2ab5,_0x384cb4){var _0x5b8417=function(_0x50e0a6){while(--_0x50e0a6){_0x4f2ab5['push'](_0x4f2ab5['shift']());}};_0x5b8417(++_0x384cb4);}(_0x6921,0x1d1));var _0x1692=function(_0x1e37b5,_0x20a8ef){_0x1e37b5=_0x1e37b5-0x0;var _0x4a8afe=_0x6921[_0x1e37b5];return _0x4a8afe;};'use strict';var _=require('lodash');var util=require(_0x1692('0x0'));var logger=require('../../config/logger')(_0x1692('0x1'));var moment=require('moment');var BPromise=require(_0x1692('0x2'));var rp=require(_0x1692('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1692('0x4'));var config=require('../../config/environment');var attributes=require(_0x1692('0x5'));module[_0x1692('0x6')]=function(_0x15f20e,_0x14fbfe){return _0x15f20e[_0x1692('0x7')](_0x1692('0x8'),attributes,{'tableName':_0x1692('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1692('0xa'),'collate':_0x1692('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index c195c38..1a4942c 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 _0xa8a8=['stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x321737,_0x402581){var _0x27ced5=function(_0x56bd2b){while(--_0x56bd2b){_0x321737['push'](_0x321737['shift']());}};_0x27ced5(++_0x402581);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4ea990,_0x4f7ae9){_0x4ea990=_0x4ea990-0x0;var _0x4c00a5=_0xa8a8[_0x4ea990];return _0x4c00a5;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file +var _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x256011,_0x28bb88){var _0xcb704f=function(_0x31feb3){while(--_0x31feb3){_0x256011['push'](_0x256011['shift']());}};_0xcb704f(++_0x28bb88);}(_0x2d17,0x17e));var _0x72d1=function(_0x1a44e0,_0x87741b){_0x1a44e0=_0x1a44e0-0x0;var _0x112d85=_0x2d17[_0x1a44e0];return _0x112d85;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6968ab8..f10d679 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 _0x938d=['addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked','whatsapp','whatsappinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd938('0x0'));var util=require(_0xd938('0x1'));var path=require('path');var timeout=require(_0xd938('0x2'));var express=require(_0xd938('0x3'));var router=express[_0xd938('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd938('0x5'));var config=require(_0xd938('0x6'));var controller=require(_0xd938('0x7'));router['get']('/',auth[_0xd938('0x8')](),controller[_0xd938('0x9')]);router[_0xd938('0xa')](_0xd938('0xb'),auth[_0xd938('0x8')](),controller[_0xd938('0xc')]);router['get'](_0xd938('0xd'),auth[_0xd938('0x8')](),controller[_0xd938('0xe')]);router[_0xd938('0xa')](_0xd938('0xf'),auth[_0xd938('0x8')](),controller['getMessages']);router[_0xd938('0xa')](_0xd938('0x10'),auth[_0xd938('0x8')](),controller[_0xd938('0x11')]);router[_0xd938('0x12')]('/',auth[_0xd938('0x8')](),controller[_0xd938('0x13')]);router[_0xd938('0x12')](_0xd938('0xf'),auth[_0xd938('0x8')](),controller[_0xd938('0x14')]);router[_0xd938('0x12')](_0xd938('0x15'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xd938('0x16')),controller[_0xd938('0x17')]);router[_0xd938('0x18')]('/:id',auth['isAuthenticated'](),interaction[_0xd938('0x19')](_0xd938('0x1a'),'whatsappinteraction:update'),controller['update']);router['delete'](_0xd938('0xd'),auth[_0xd938('0x8')](),interaction[_0xd938('0x19')]('whatsapp',_0xd938('0x1b')),controller[_0xd938('0x1c')]);router[_0xd938('0x1d')](_0xd938('0x15'),auth[_0xd938('0x8')](),controller['removeTags']);module[_0xd938('0x1e')]=router; \ No newline at end of file +var _0xdf98=['create','post','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','/:id','tracked','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download'];(function(_0x341ea0,_0x41d71a){var _0x1ca694=function(_0x396829){while(--_0x396829){_0x341ea0['push'](_0x341ea0['shift']());}};_0x1ca694(++_0x41d71a);}(_0xdf98,0xcf));var _0x8df9=function(_0x411511,_0x13b21a){_0x411511=_0x411511-0x0;var _0xda7b33=_0xdf98[_0x411511];return _0xda7b33;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var fs_extra=require(_0x8df9('0x3'));var auth=require(_0x8df9('0x4'));var interaction=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var controller=require(_0x8df9('0x7'));router[_0x8df9('0x8')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xa')]);router['get'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xc')]);router['get']('/:id',auth[_0x8df9('0x9')](),controller['show']);router[_0x8df9('0x8')](_0x8df9('0xd'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xe')]);router[_0x8df9('0x8')](_0x8df9('0xf'),auth[_0x8df9('0x9')](),controller[_0x8df9('0x10')]);router['post']('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0x11')]);router[_0x8df9('0x12')]('/:id/messages',auth[_0x8df9('0x9')](),controller[_0x8df9('0x13')]);router[_0x8df9('0x12')](_0x8df9('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x8df9('0x15'),_0x8df9('0x16')),controller[_0x8df9('0x17')]);router['put'](_0x8df9('0x18'),auth['isAuthenticated'](),interaction[_0x8df9('0x19')]('whatsapp',_0x8df9('0x1a')),controller[_0x8df9('0x1b')]);router[_0x8df9('0x1c')](_0x8df9('0x18'),auth[_0x8df9('0x9')](),interaction[_0x8df9('0x19')]('whatsapp','whatsappinteraction:destroy'),controller[_0x8df9('0x1d')]);router['delete']('/:id/tags',auth[_0x8df9('0x9')](),controller[_0x8df9('0x1e')]);module[_0x8df9('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 4db22c3..3f3838c 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 _0xf34f=['out','ENUM','BOOLEAN','INTEGER','sequelize','exports','DATE','STRING'];(function(_0x572e25,_0x36f59c){var _0x2e2cf6=function(_0x4a75d2){while(--_0x4a75d2){_0x572e25['push'](_0x572e25['shift']());}};_0x2e2cf6(++_0x36f59c);}(_0xf34f,0x64));var _0xff34=function(_0x4a509f,_0xbe75f7){_0x4a509f=_0x4a509f-0x0;var _0x56d94e=_0xf34f[_0x4a509f];return _0x56d94e;};'use strict';var Sequelize=require(_0xff34('0x0'));var moment=require('moment');module[_0xff34('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xff34('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xff34('0x3')]},'thirdDisposition':{'type':Sequelize[_0xff34('0x3')]},'note':{'type':Sequelize[_0xff34('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xff34('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xff34('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xff34('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xff34('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xff34('0x7')]}}; \ No newline at end of file +var _0xf970=['INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x12ae78,_0x241615){var _0x3fc644=function(_0x51c35b){while(--_0x51c35b){_0x12ae78['push'](_0x12ae78['shift']());}};_0x3fc644(++_0x241615);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x0f97('0x0'));var moment=require('moment');module[_0x0f97('0x1')]={'closed':{'type':Sequelize[_0x0f97('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0f97('0x3')]},'disposition':{'type':Sequelize[_0x0f97('0x4')]},'secondDisposition':{'type':Sequelize[_0x0f97('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0f97('0x4')]},'note':{'type':Sequelize[_0x0f97('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0f97('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0f97('0x5')]('in',_0x0f97('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0f97('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0f97('0x5')]('in',_0x0f97('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0f97('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0f97('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index d04622a..d2a35c4 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 _0x0dfc=['server','files','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','disposition','basename','existsSync','pipe','createWriteStream','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappInteraction.socket','register','end','status','undefined','limit','count','offset','set','Content-Range','json','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','catch','show','params','model','WhatsappInteraction','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','update','find','describe','WhatsappMessage','ids','omit','getMessages','findOne','keys','hasOwnProperty','nolimit','order','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x0dfc,0xaa));var _0xc0df=function(_0x591cfe,_0x37eb93){_0x591cfe=_0x591cfe-0x0;var _0x440020=_0x0dfc[_0x591cfe];return _0x440020;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc0df('0x0'));var moment=require(_0xc0df('0x1'));var BPromise=require(_0xc0df('0x2'));var util=require(_0xc0df('0x3'));var path=require(_0xc0df('0x4'));var ejs=require(_0xc0df('0x5'));var fs=require('fs');var _=require(_0xc0df('0x6'));var Redis=require(_0xc0df('0x7'));var interaction=require(_0xc0df('0x8'));var qs=require(_0xc0df('0x9'));var pdf=require(_0xc0df('0xa'));var logger=require(_0xc0df('0xb'))(_0xc0df('0xc'));var config=require(_0xc0df('0xd'));var db=require(_0xc0df('0xe'))['db'];config[_0xc0df('0xf')]=_['defaults'](config[_0xc0df('0xf')],{'host':_0xc0df('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc0df('0xf')]));require(_0xc0df('0x11'))[_0xc0df('0x12')](socket);function respondWithStatusCode(_0x29ca8a,_0x5a7b4b){_0x5a7b4b=_0x5a7b4b||0xcc;return function(_0x30c1e1){if(_0x30c1e1){return _0x29ca8a['sendStatus'](_0x5a7b4b);}return _0x29ca8a['status'](_0x5a7b4b)[_0xc0df('0x13')]();};}function respondWithResult(_0x3b90bd,_0x580ae6){_0x580ae6=_0x580ae6||0xc8;return function(_0x47cf7d){if(_0x47cf7d){return _0x3b90bd[_0xc0df('0x14')](_0x580ae6)['json'](_0x47cf7d);}};}function respondWithFilteredResult(_0x119ef4,_0x5bad7d){return function(_0xefd4f6){if(_0xefd4f6){var _0x201307=typeof _0x5bad7d['offset']===_0xc0df('0x15')&&typeof _0x5bad7d[_0xc0df('0x16')]===_0xc0df('0x15');var _0x2d86d0=_0xefd4f6[_0xc0df('0x17')];var _0x33848d=_0x201307?0x0:_0x5bad7d[_0xc0df('0x18')];var _0x38d221=_0x201307?_0xefd4f6[_0xc0df('0x17')]:_0x5bad7d[_0xc0df('0x18')]+_0x5bad7d[_0xc0df('0x16')];var _0x175696;if(_0x38d221>=_0x2d86d0){_0x38d221=_0x2d86d0;_0x175696=0xc8;}else{_0x175696=0xce;}_0x119ef4['status'](_0x175696);return _0x119ef4[_0xc0df('0x19')](_0xc0df('0x1a'),_0x33848d+'-'+_0x38d221+'/'+_0x2d86d0)[_0xc0df('0x1b')](_0xefd4f6);}return null;};}function saveUpdates(_0x4470ad){return function(_0x4f04a2){if(_0x4f04a2){return _0x4f04a2['update'](_0x4470ad)[_0xc0df('0x1c')](function(_0x194219){return _0x194219;});}return null;};}function removeEntity(_0x2d786e){return function(_0x41a5e5){if(_0x41a5e5){return _0x41a5e5[_0xc0df('0x1d')]()[_0xc0df('0x1c')](function(){_0x2d786e[_0xc0df('0x14')](0xcc)[_0xc0df('0x13')]();});}};}function handleEntityNotFound(_0x51f55c){return function(_0x5df8c3){if(!_0x5df8c3){_0x51f55c[_0xc0df('0x1e')](0x194);}return _0x5df8c3;};}function handleError(_0x2893dc,_0x1118c3){_0x1118c3=_0x1118c3||0x1f4;return function(_0x34e963){logger[_0xc0df('0x1f')](_0x34e963[_0xc0df('0x20')]);if(_0x34e963[_0xc0df('0x21')]){delete _0x34e963[_0xc0df('0x21')];}_0x2893dc[_0xc0df('0x14')](_0x1118c3)[_0xc0df('0x22')](_0x34e963);};}exports[_0xc0df('0x23')]=function(_0x163384,_0x3815a3){var _0x47cbe3={};var _0x4f32cb=_[_0xc0df('0x24')](db['WhatsappInteraction'][_0xc0df('0x25')],function(_0x36dd20){return{'name':_0x36dd20[_0xc0df('0x26')],'type':_0x36dd20[_0xc0df('0x27')]['key']};});_0x47cbe3=qs[_0xc0df('0x28')](_0x4f32cb,_0x163384);return interaction[_0xc0df('0x29')](_0xc0df('0x2a'),_0x163384[_0xc0df('0x2b')],_0x163384[_0xc0df('0x2c')],_0x47cbe3,_0x4f32cb)[_0xc0df('0x1c')](respondWithFilteredResult(_0x3815a3,_0x47cbe3))[_0xc0df('0x2d')](handleError(_0x3815a3,null));};exports[_0xc0df('0x2e')]=function(_0x38e8b1,_0x475d9c){var _0x2f1cba={'raw':![],'where':{'id':_0x38e8b1[_0xc0df('0x2f')]['id']}},_0x1cafa9={};_0x1cafa9[_0xc0df('0x30')]=_['keys'](db[_0xc0df('0x31')][_0xc0df('0x25')]);_0x1cafa9[_0xc0df('0x2b')]=_['keys'](_0x38e8b1['query']);_0x1cafa9[_0xc0df('0x32')]=_[_0xc0df('0x33')](_0x1cafa9['model'],_0x1cafa9[_0xc0df('0x2b')]);_0x2f1cba[_0xc0df('0x34')]=_[_0xc0df('0x33')](_0x1cafa9[_0xc0df('0x30')],qs[_0xc0df('0x35')](_0x38e8b1[_0xc0df('0x2b')][_0xc0df('0x35')]));_0x2f1cba[_0xc0df('0x34')]=_0x2f1cba['attributes'][_0xc0df('0x36')]?_0x2f1cba[_0xc0df('0x34')]:_0x1cafa9[_0xc0df('0x30')];if(_0x38e8b1[_0xc0df('0x2b')][_0xc0df('0x37')]){_0x2f1cba['include']=[{'all':!![]}];}_0x2f1cba=_[_0xc0df('0x38')]({},_0x2f1cba,_0x38e8b1[_0xc0df('0x39')]);return db[_0xc0df('0x31')]['find'](_0x2f1cba)[_0xc0df('0x1c')](handleEntityNotFound(_0x475d9c,null))['then'](respondWithResult(_0x475d9c,null))[_0xc0df('0x2d')](handleError(_0x475d9c,null));};exports[_0xc0df('0x3a')]=function(_0x4f8bb9,_0x106355){return db[_0xc0df('0x31')]['create'](_0x4f8bb9[_0xc0df('0x3b')],{})[_0xc0df('0x1c')](respondWithResult(_0x106355,0xc9))[_0xc0df('0x2d')](handleError(_0x106355,null));};exports[_0xc0df('0x3c')]=function(_0x2448d5,_0xeed6fd){if(_0x2448d5[_0xc0df('0x3b')]['id']){delete _0x2448d5[_0xc0df('0x3b')]['id'];}return db[_0xc0df('0x31')][_0xc0df('0x3d')]({'where':{'id':_0x2448d5[_0xc0df('0x2f')]['id']}})[_0xc0df('0x1c')](handleEntityNotFound(_0xeed6fd,null))[_0xc0df('0x1c')](saveUpdates(_0x2448d5[_0xc0df('0x3b')],null))[_0xc0df('0x1c')](respondWithResult(_0xeed6fd,null))[_0xc0df('0x2d')](handleError(_0xeed6fd,null));};exports[_0xc0df('0x1d')]=function(_0x5d492e,_0x21a508){return db[_0xc0df('0x31')][_0xc0df('0x3d')]({'where':{'id':_0x5d492e[_0xc0df('0x2f')]['id']}})[_0xc0df('0x1c')](handleEntityNotFound(_0x21a508,null))[_0xc0df('0x1c')](removeEntity(_0x21a508,null))[_0xc0df('0x2d')](handleError(_0x21a508,null));};exports[_0xc0df('0x3e')]=function(_0x382865,_0x409859){return db['WhatsappInteraction'][_0xc0df('0x3e')]()[_0xc0df('0x1c')](respondWithResult(_0x409859,null))['catch'](handleError(_0x409859,null));};exports['addMessage']=function(_0x3e6642,_0x3a7f36){return db[_0xc0df('0x3f')][_0xc0df('0x3d')]({'where':{'id':_0x3e6642['params']['id']}})['then'](handleEntityNotFound(_0x3a7f36,null))[_0xc0df('0x1c')](function(_0x488870){if(_0x488870){return _0x488870['addMessage'](_0x3e6642['body'][_0xc0df('0x40')],_[_0xc0df('0x41')](_0x3e6642[_0xc0df('0x3b')],[_0xc0df('0x40'),'id'])||{});}})[_0xc0df('0x1c')](respondWithResult(_0x3a7f36,null))[_0xc0df('0x2d')](handleError(_0x3a7f36,null));};exports[_0xc0df('0x42')]=function(_0x1814b5,_0x15bbbf){var _0x4bd1fd={'raw':![],'where':{}};var _0x6c4f90={};var _0x1ced44={'count':0x0,'rows':[]};return db[_0xc0df('0x31')][_0xc0df('0x43')]({'where':{'id':_0x1814b5[_0xc0df('0x2f')]['id']}})[_0xc0df('0x1c')](handleEntityNotFound(_0x15bbbf,null))[_0xc0df('0x1c')](function(_0x2a7aa0){if(_0x2a7aa0){_0x6c4f90['model']=_[_0xc0df('0x44')](db[_0xc0df('0x3f')][_0xc0df('0x25')]);_0x6c4f90[_0xc0df('0x2b')]=_[_0xc0df('0x44')](_0x1814b5[_0xc0df('0x2b')]);_0x6c4f90['filters']=_[_0xc0df('0x33')](_0x6c4f90[_0xc0df('0x30')],_0x6c4f90[_0xc0df('0x2b')]);_0x4bd1fd[_0xc0df('0x34')]=_[_0xc0df('0x33')](_0x6c4f90[_0xc0df('0x30')],qs[_0xc0df('0x35')](_0x1814b5[_0xc0df('0x2b')]['fields']));_0x4bd1fd['attributes']=_0x4bd1fd[_0xc0df('0x34')][_0xc0df('0x36')]?_0x4bd1fd[_0xc0df('0x34')]:_0x6c4f90['model'];if(!_0x1814b5[_0xc0df('0x2b')][_0xc0df('0x45')](_0xc0df('0x46'))){_0x4bd1fd[_0xc0df('0x16')]=qs[_0xc0df('0x16')](_0x1814b5[_0xc0df('0x2b')]['limit']);_0x4bd1fd['offset']=qs[_0xc0df('0x18')](_0x1814b5[_0xc0df('0x2b')]['offset']);}_0x4bd1fd[_0xc0df('0x47')]=qs['sort'](_0x1814b5[_0xc0df('0x2b')]['sort']);_0x4bd1fd[_0xc0df('0x48')]=qs[_0xc0df('0x32')](_['pick'](_0x1814b5['query'],_0x6c4f90[_0xc0df('0x32')]));_0x4bd1fd[_0xc0df('0x48')]['WhatsappInteractionId']=_0x2a7aa0['id'];if(_0x1814b5[_0xc0df('0x2b')][_0xc0df('0x49')]){_0x4bd1fd['where']=_[_0xc0df('0x38')](_0x4bd1fd[_0xc0df('0x48')],{'$or':_[_0xc0df('0x24')](_0x4bd1fd[_0xc0df('0x34')],function(_0x4069d0){var _0x5d0344={};_0x5d0344[_0x4069d0]={'$like':'%'+_0x1814b5[_0xc0df('0x2b')][_0xc0df('0x49')]+'%'};return _0x5d0344;})});}if(_0x1814b5[_0xc0df('0x2b')][_0xc0df('0x4a')]){var _0x2341fc=_0x1814b5[_0xc0df('0x2b')][_0xc0df('0x4a')][_0xc0df('0x4b')](',');var _0x122bfd={};_0x122bfd[_0x2341fc[0x0]]={'$gte':moment(_0x2341fc[0x1])[_0xc0df('0x4c')](_0xc0df('0x4d'))};_0x4bd1fd[_0xc0df('0x48')]=_[_0xc0df('0x38')](_0x4bd1fd[_0xc0df('0x48')],_0x122bfd);}_0x4bd1fd=_[_0xc0df('0x38')]({},_0x4bd1fd,_0x1814b5[_0xc0df('0x39')]);return db[_0xc0df('0x3f')][_0xc0df('0x17')]({'where':_0x4bd1fd['where']})['then'](function(_0x2e265b){_0x1ced44[_0xc0df('0x17')]=_0x2e265b;if(_0x1814b5[_0xc0df('0x2b')][_0xc0df('0x37')]){_0x4bd1fd[_0xc0df('0x4e')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xc0df('0x29')](_0x4bd1fd);})['then'](function(_0x2bf8b3){_0x1ced44[_0xc0df('0x4f')]=_0x2bf8b3;return _0x1ced44;});}})[_0xc0df('0x1c')](respondWithFilteredResult(_0x15bbbf,_0x4bd1fd))['catch'](handleError(_0x15bbbf,null));};exports['addTags']=function(_0x42c20e,_0x3b4f8d){return db[_0xc0df('0x31')][_0xc0df('0x3d')]({'where':{'id':_0x42c20e[_0xc0df('0x2f')]['id']}})[_0xc0df('0x1c')](handleEntityNotFound(_0x3b4f8d,null))[_0xc0df('0x1c')](function(_0x11c3be){if(_0x11c3be){return _0x11c3be['setTags'](_0x42c20e[_0xc0df('0x3b')][_0xc0df('0x40')],_[_0xc0df('0x41')](_0x42c20e[_0xc0df('0x3b')],[_0xc0df('0x40'),'id'])||{})[_0xc0df('0x50')](function(){return db[_0xc0df('0x51')]['findAll']({'attributes':['id',_0xc0df('0x21'),_0xc0df('0x52')],'where':{'id':_0x42c20e['body']['ids']}});})['then'](function(_0x5c4a9d){socket[_0xc0df('0x53')](_0xc0df('0x54'),{'id':Number(_0x42c20e[_0xc0df('0x2f')]['id']),'tags':_0x5c4a9d||[]});return{'id':Number(_0x42c20e[_0xc0df('0x2f')]['id']),'tags':_0x5c4a9d||[]};});}})[_0xc0df('0x1c')](respondWithResult(_0x3b4f8d,null))[_0xc0df('0x2d')](handleError(_0x3b4f8d,null));};exports['removeTags']=function(_0x83e0a2,_0x50fd4f){return db[_0xc0df('0x31')][_0xc0df('0x3d')]({'where':{'id':_0x83e0a2[_0xc0df('0x2f')]['id']}})['then'](handleEntityNotFound(_0x50fd4f,null))['then'](function(_0x585569){if(_0x585569){return _0x585569[_0xc0df('0x55')](_0x83e0a2[_0xc0df('0x2b')]['ids']);}})['then'](respondWithStatusCode(_0x50fd4f,null))[_0xc0df('0x2d')](handleError(_0x50fd4f,null));};exports[_0xc0df('0x56')]=function(_0x5ae52c,_0xa47de6){var _0x3c88a7=moment()[_0xc0df('0x57')]()[_0xc0df('0x58')]();var _0x32ba22=path['join'](config[_0xc0df('0x59')],_0xc0df('0x5a'),_0xc0df('0x5b'),'tmp');var _0x23ae51=path[_0xc0df('0x5c')](config[_0xc0df('0x59')],'server','files','attachments');var _0x11b573=path[_0xc0df('0x5c')](_0x32ba22,_0x3c88a7);var _0x497ae1=util[_0xc0df('0x4c')](_0xc0df('0x5d'),_0x5ae52c[_0xc0df('0x2f')]['id'],_0x3c88a7);var _0x577798=path[_0xc0df('0x5c')](_0x32ba22,_0x497ae1);var _0x5bd5f5=[];_0x5bd5f5[_0xc0df('0x5e')]({'model':db[_0xc0df('0x5f')],'as':_0xc0df('0x5f'),'attributes':['id',_0xc0df('0x60')],'raw':!![]});_0x5bd5f5['push']({'model':db[_0xc0df('0x61')],'as':_0xc0df('0x62'),'attributes':['id',_0xc0df('0x63'),_0xc0df('0x64')],'raw':!![]});if(_0x5ae52c[_0xc0df('0x2b')][_0xc0df('0x65')]){_0x5bd5f5['push']({'model':db[_0xc0df('0x66')],'as':'Attachment','raw':!![]});}var _0x4098b6=[{'model':db[_0xc0df('0x3f')],'as':_0xc0df('0x67'),'attributes':['id',_0xc0df('0x3b'),_0xc0df('0x68'),_0xc0df('0x69'),_0xc0df('0x6a'),_0xc0df('0x6b')],'include':_0x5bd5f5}];_0x4098b6[_0xc0df('0x5e')]({'model':db[_0xc0df('0x6c')],'as':_0xc0df('0x6d'),'attributes':['id',_0xc0df('0x21')]});_0x4098b6[_0xc0df('0x5e')]({'model':db['User'],'as':_0xc0df('0x6e'),'attributes':['id',_0xc0df('0x60')]});return db[_0xc0df('0x31')][_0xc0df('0x3d')]({'where':{'id':_0x5ae52c[_0xc0df('0x2f')]['id']},'include':_0x4098b6})['then'](handleEntityNotFound(_0xa47de6,null))[_0xc0df('0x1c')](function(_0xec11b1){if(_0xec11b1){var _0x24c62e=_0xec11b1[_0xc0df('0x6f')]({'plain':!![]});fs[_0xc0df('0x70')](_0x11b573);var _0x2905c7={'channel':_0xc0df('0x71'),'account':_0x24c62e['Account'][_0xc0df('0x21')],'agent':_0x24c62e[_0xc0df('0x6e')]?_0x24c62e[_0xc0df('0x6e')][_0xc0df('0x60')]:_0xc0df('0x72'),'createdAt':moment(_0x24c62e[_0xc0df('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x24c62e['closed']?moment(_0x24c62e['closedAt'])['format'](_0xc0df('0x4d'))[_0xc0df('0x58')]():'','disposition':_0x24c62e[_0xc0df('0x73')],'messages':_(_0x24c62e['Messages'])[_0xc0df('0x49')]({'secret':![]})[_0xc0df('0x24')](function(_0x5b4fa8){if(_0x5b4fa8[_0xc0df('0x66')]){var _0xa887a3=path[_0xc0df('0x5c')](_0x23ae51,_0x5b4fa8[_0xc0df('0x66')][_0xc0df('0x74')]);if(fs[_0xc0df('0x75')](_0xa887a3)){fs['createReadStream'](_0xa887a3)[_0xc0df('0x76')](fs[_0xc0df('0x77')](path[_0xc0df('0x5c')](_0x11b573,_0x5b4fa8[_0xc0df('0x66')]['basename'])));}}return{'date':moment(_0x5b4fa8[_0xc0df('0x68')])[_0xc0df('0x4c')](_0xc0df('0x4d'))[_0xc0df('0x58')](),'sender':_0x5b4fa8['direction']===_0xc0df('0x78')?_0x5b4fa8['User']?_0x5b4fa8[_0xc0df('0x5f')][_0xc0df('0x60')]:'System':_0x5b4fa8['Contact']['firstName']+(_0x5b4fa8['Contact'][_0xc0df('0x64')]?'\x20'+_0x5b4fa8['Contact'][_0xc0df('0x64')]:''),'body':_0x5b4fa8['Attachment']?_0x5b4fa8[_0xc0df('0x66')][_0xc0df('0x74')]:_0x5b4fa8[_0xc0df('0x3b')],'direction':_0x5b4fa8[_0xc0df('0x69')]===_0xc0df('0x78')?'A':'C','secret':_0x5b4fa8[_0xc0df('0x6a')],'read':_0x5b4fa8[_0xc0df('0x6b')],'attachment':_0x5b4fa8['Attachment']};})[_0xc0df('0x79')]()};return ejs[_0xc0df('0x7a')](path[_0xc0df('0x5c')](config[_0xc0df('0x59')],_0xc0df('0x5a'),_0xc0df('0x7b'),_0xc0df('0x7c')),{'interaction':_0x2905c7})['then'](function(_0x1e506a){var _0x3c9270=path[_0xc0df('0x5c')](_0x11b573,_0xc0df('0x7d')+_0x24c62e['id']+'-'+_0x3c88a7+_0xc0df('0x7e'));var _0x2e822a={'path':_0x3c9270,'channel':_0xc0df('0x71'),'interactionId':_0x24c62e['id']};return pdf['createPdfFromHTML'](_0x1e506a,_0x2e822a);})[_0xc0df('0x1c')](function(){return new BPromise(function(_0x35c9ec,_0x2e92fa){zipdir(_0x11b573,{'saveTo':_0x577798},function(_0x5ee316,_0x515879){if(_0x5ee316)return _0x2e92fa(_0x5ee316);return _0x35c9ec(_0x515879);});})['then'](function(){return new BPromise(function(_0x33cbff,_0x1778a5){rimraf(_0x11b573,function(_0xb9179d){if(_0xb9179d)_0x1778a5(_0xb9179d);return _0x33cbff();});});})['then'](function(){return _0xa47de6[_0xc0df('0x56')](_0x577798,_0x497ae1,function(_0x234d5f){if(_0x234d5f){console[_0xc0df('0x7f')](_0xc0df('0x80'),_0x234d5f);}else{fs[_0xc0df('0x81')](_0x577798);}});});});}else{return _0xa47de6['sendStatus'](0xc8);}})[_0xc0df('0x2d')](handleError(_0xa47de6,null));}; \ No newline at end of file +var _0x4aeb=['root','server','files','tmp','attachments','User','fullname','CmContact','Contact','firstName','lastName','push','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','out','System','value','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','log','err','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','sendStatus','stack','index','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','catch','show','model','keys','filters','intersection','attributes','fields','length','merge','options','create','body','find','params','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','rows','spread','Tag','name','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join'];(function(_0x2920dd,_0x19d049){var _0x5d4e52=function(_0x46c751){while(--_0x46c751){_0x2920dd['push'](_0x2920dd['shift']());}};_0x5d4e52(++_0x19d049);}(_0x4aeb,0x1b0));var _0xb4ae=function(_0x588dbb,_0x21efea){_0x588dbb=_0x588dbb-0x0;var _0x4dca09=_0x4aeb[_0x588dbb];return _0x4dca09;};'use strict';var rimraf=require(_0xb4ae('0x0'));var zipdir=require(_0xb4ae('0x1'));var moment=require(_0xb4ae('0x2'));var BPromise=require('bluebird');var util=require(_0xb4ae('0x3'));var path=require(_0xb4ae('0x4'));var ejs=require(_0xb4ae('0x5'));var fs=require('fs');var _=require(_0xb4ae('0x6'));var Redis=require(_0xb4ae('0x7'));var interaction=require(_0xb4ae('0x8'));var qs=require(_0xb4ae('0x9'));var pdf=require(_0xb4ae('0xa'));var logger=require('../../config/logger')(_0xb4ae('0xb'));var config=require(_0xb4ae('0xc'));var db=require('../../mysqldb')['db'];config[_0xb4ae('0xd')]=_[_0xb4ae('0xe')](config[_0xb4ae('0xd')],{'host':_0xb4ae('0xf'),'port':0x18eb});var socket=require(_0xb4ae('0x10'))(new Redis(config[_0xb4ae('0xd')]));require('./whatsappInteraction.socket')[_0xb4ae('0x11')](socket);function respondWithStatusCode(_0x45ade8,_0xdee621){_0xdee621=_0xdee621||0xcc;return function(_0x4f8056){if(_0x4f8056){return _0x45ade8['sendStatus'](_0xdee621);}return _0x45ade8[_0xb4ae('0x12')](_0xdee621)[_0xb4ae('0x13')]();};}function respondWithResult(_0x46c65d,_0x473d2f){_0x473d2f=_0x473d2f||0xc8;return function(_0x23c61d){if(_0x23c61d){return _0x46c65d[_0xb4ae('0x12')](_0x473d2f)[_0xb4ae('0x14')](_0x23c61d);}};}function respondWithFilteredResult(_0x539321,_0x366035){return function(_0x438df7){if(_0x438df7){var _0x3d578d=typeof _0x366035['offset']===_0xb4ae('0x15')&&typeof _0x366035[_0xb4ae('0x16')]===_0xb4ae('0x15');var _0x5b534a=_0x438df7[_0xb4ae('0x17')];var _0x2e1cd4=_0x3d578d?0x0:_0x366035[_0xb4ae('0x18')];var _0x48462d=_0x3d578d?_0x438df7[_0xb4ae('0x17')]:_0x366035['offset']+_0x366035[_0xb4ae('0x16')];var _0x1e5e26;if(_0x48462d>=_0x5b534a){_0x48462d=_0x5b534a;_0x1e5e26=0xc8;}else{_0x1e5e26=0xce;}_0x539321['status'](_0x1e5e26);return _0x539321[_0xb4ae('0x19')](_0xb4ae('0x1a'),_0x2e1cd4+'-'+_0x48462d+'/'+_0x5b534a)[_0xb4ae('0x14')](_0x438df7);}return null;};}function saveUpdates(_0x1c2c18){return function(_0x18462b){if(_0x18462b){return _0x18462b[_0xb4ae('0x1b')](_0x1c2c18)['then'](function(_0x5cb25d){return _0x5cb25d;});}return null;};}function removeEntity(_0x1fc080){return function(_0x4330f8){if(_0x4330f8){return _0x4330f8['destroy']()[_0xb4ae('0x1c')](function(){_0x1fc080[_0xb4ae('0x12')](0xcc)[_0xb4ae('0x13')]();});}};}function handleEntityNotFound(_0x370669){return function(_0x55a22e){if(!_0x55a22e){_0x370669[_0xb4ae('0x1d')](0x194);}return _0x55a22e;};}function handleError(_0x2ca8c9,_0x5cc16d){_0x5cc16d=_0x5cc16d||0x1f4;return function(_0x435c53){logger['error'](_0x435c53[_0xb4ae('0x1e')]);if(_0x435c53['name']){delete _0x435c53['name'];}_0x2ca8c9[_0xb4ae('0x12')](_0x5cc16d)['send'](_0x435c53);};}exports[_0xb4ae('0x1f')]=function(_0x4fa69f,_0x45c7f7){var _0x29ed9a={};var _0x13b605=_['map'](db[_0xb4ae('0x20')][_0xb4ae('0x21')],function(_0x5e3ee5){return{'name':_0x5e3ee5[_0xb4ae('0x22')],'type':_0x5e3ee5['type'][_0xb4ae('0x23')]};});_0x29ed9a=qs[_0xb4ae('0x24')](_0x13b605,_0x4fa69f);return interaction[_0xb4ae('0x25')]('whatsapp',_0x4fa69f[_0xb4ae('0x26')],_0x4fa69f['user'],_0x29ed9a,_0x13b605)['then'](respondWithFilteredResult(_0x45c7f7,_0x29ed9a))[_0xb4ae('0x27')](handleError(_0x45c7f7,null));};exports[_0xb4ae('0x28')]=function(_0x148ba4,_0x15ec03){var _0x3b5ecb={'raw':![],'where':{'id':_0x148ba4['params']['id']}},_0x3a436c={};_0x3a436c[_0xb4ae('0x29')]=_[_0xb4ae('0x2a')](db[_0xb4ae('0x20')][_0xb4ae('0x21')]);_0x3a436c[_0xb4ae('0x26')]=_[_0xb4ae('0x2a')](_0x148ba4[_0xb4ae('0x26')]);_0x3a436c[_0xb4ae('0x2b')]=_[_0xb4ae('0x2c')](_0x3a436c['model'],_0x3a436c[_0xb4ae('0x26')]);_0x3b5ecb[_0xb4ae('0x2d')]=_[_0xb4ae('0x2c')](_0x3a436c[_0xb4ae('0x29')],qs[_0xb4ae('0x2e')](_0x148ba4[_0xb4ae('0x26')]['fields']));_0x3b5ecb[_0xb4ae('0x2d')]=_0x3b5ecb[_0xb4ae('0x2d')][_0xb4ae('0x2f')]?_0x3b5ecb[_0xb4ae('0x2d')]:_0x3a436c[_0xb4ae('0x29')];if(_0x148ba4['query']['includeAll']){_0x3b5ecb['include']=[{'all':!![]}];}_0x3b5ecb=_[_0xb4ae('0x30')]({},_0x3b5ecb,_0x148ba4[_0xb4ae('0x31')]);return db[_0xb4ae('0x20')]['find'](_0x3b5ecb)[_0xb4ae('0x1c')](handleEntityNotFound(_0x15ec03,null))[_0xb4ae('0x1c')](respondWithResult(_0x15ec03,null))['catch'](handleError(_0x15ec03,null));};exports[_0xb4ae('0x32')]=function(_0x487c0a,_0x18a504){return db[_0xb4ae('0x20')][_0xb4ae('0x32')](_0x487c0a[_0xb4ae('0x33')],{})[_0xb4ae('0x1c')](respondWithResult(_0x18a504,0xc9))[_0xb4ae('0x27')](handleError(_0x18a504,null));};exports[_0xb4ae('0x1b')]=function(_0x3db46e,_0x2e25eb){if(_0x3db46e[_0xb4ae('0x33')]['id']){delete _0x3db46e[_0xb4ae('0x33')]['id'];}return db['WhatsappInteraction'][_0xb4ae('0x34')]({'where':{'id':_0x3db46e[_0xb4ae('0x35')]['id']}})[_0xb4ae('0x1c')](handleEntityNotFound(_0x2e25eb,null))[_0xb4ae('0x1c')](saveUpdates(_0x3db46e[_0xb4ae('0x33')],null))[_0xb4ae('0x1c')](respondWithResult(_0x2e25eb,null))['catch'](handleError(_0x2e25eb,null));};exports[_0xb4ae('0x36')]=function(_0x2c3b04,_0x48ed1f){return db[_0xb4ae('0x20')][_0xb4ae('0x34')]({'where':{'id':_0x2c3b04['params']['id']}})[_0xb4ae('0x1c')](handleEntityNotFound(_0x48ed1f,null))[_0xb4ae('0x1c')](removeEntity(_0x48ed1f,null))[_0xb4ae('0x27')](handleError(_0x48ed1f,null));};exports[_0xb4ae('0x37')]=function(_0x42b348,_0xd108af){return db['WhatsappInteraction'][_0xb4ae('0x37')]()['then'](respondWithResult(_0xd108af,null))[_0xb4ae('0x27')](handleError(_0xd108af,null));};exports[_0xb4ae('0x38')]=function(_0x582530,_0x44743f){return db[_0xb4ae('0x39')][_0xb4ae('0x34')]({'where':{'id':_0x582530['params']['id']}})[_0xb4ae('0x1c')](handleEntityNotFound(_0x44743f,null))[_0xb4ae('0x1c')](function(_0x3ed748){if(_0x3ed748){return _0x3ed748[_0xb4ae('0x38')](_0x582530[_0xb4ae('0x33')][_0xb4ae('0x3a')],_[_0xb4ae('0x3b')](_0x582530['body'],[_0xb4ae('0x3a'),'id'])||{});}})[_0xb4ae('0x1c')](respondWithResult(_0x44743f,null))[_0xb4ae('0x27')](handleError(_0x44743f,null));};exports[_0xb4ae('0x3c')]=function(_0x33575d,_0x18ab84){var _0x32f32a={'raw':![],'where':{}};var _0x39f86c={};var _0x43d86a={'count':0x0,'rows':[]};return db[_0xb4ae('0x20')][_0xb4ae('0x3d')]({'where':{'id':_0x33575d['params']['id']}})[_0xb4ae('0x1c')](handleEntityNotFound(_0x18ab84,null))[_0xb4ae('0x1c')](function(_0x405950){if(_0x405950){_0x39f86c['model']=_['keys'](db['WhatsappMessage'][_0xb4ae('0x21')]);_0x39f86c['query']=_['keys'](_0x33575d[_0xb4ae('0x26')]);_0x39f86c['filters']=_['intersection'](_0x39f86c['model'],_0x39f86c[_0xb4ae('0x26')]);_0x32f32a['attributes']=_[_0xb4ae('0x2c')](_0x39f86c[_0xb4ae('0x29')],qs[_0xb4ae('0x2e')](_0x33575d['query']['fields']));_0x32f32a['attributes']=_0x32f32a[_0xb4ae('0x2d')][_0xb4ae('0x2f')]?_0x32f32a[_0xb4ae('0x2d')]:_0x39f86c[_0xb4ae('0x29')];if(!_0x33575d[_0xb4ae('0x26')][_0xb4ae('0x3e')](_0xb4ae('0x3f'))){_0x32f32a[_0xb4ae('0x16')]=qs[_0xb4ae('0x16')](_0x33575d['query'][_0xb4ae('0x16')]);_0x32f32a[_0xb4ae('0x18')]=qs[_0xb4ae('0x18')](_0x33575d[_0xb4ae('0x26')][_0xb4ae('0x18')]);}_0x32f32a[_0xb4ae('0x40')]=qs[_0xb4ae('0x41')](_0x33575d[_0xb4ae('0x26')][_0xb4ae('0x41')]);_0x32f32a[_0xb4ae('0x42')]=qs[_0xb4ae('0x2b')](_[_0xb4ae('0x43')](_0x33575d[_0xb4ae('0x26')],_0x39f86c[_0xb4ae('0x2b')]));_0x32f32a[_0xb4ae('0x42')][_0xb4ae('0x44')]=_0x405950['id'];if(_0x33575d[_0xb4ae('0x26')][_0xb4ae('0x45')]){_0x32f32a[_0xb4ae('0x42')]=_[_0xb4ae('0x30')](_0x32f32a[_0xb4ae('0x42')],{'$or':_[_0xb4ae('0x46')](_0x32f32a[_0xb4ae('0x2d')],function(_0x2dce36){var _0x536fe4={};_0x536fe4[_0x2dce36]={'$like':'%'+_0x33575d[_0xb4ae('0x26')][_0xb4ae('0x45')]+'%'};return _0x536fe4;})});}if(_0x33575d[_0xb4ae('0x26')][_0xb4ae('0x47')]){var _0x569647=_0x33575d[_0xb4ae('0x26')]['$gte'][_0xb4ae('0x48')](',');var _0x3e62bd={};_0x3e62bd[_0x569647[0x0]]={'$gte':moment(_0x569647[0x1])[_0xb4ae('0x49')](_0xb4ae('0x4a'))};_0x32f32a[_0xb4ae('0x42')]=_['merge'](_0x32f32a[_0xb4ae('0x42')],_0x3e62bd);}_0x32f32a=_[_0xb4ae('0x30')]({},_0x32f32a,_0x33575d[_0xb4ae('0x31')]);return db['WhatsappMessage'][_0xb4ae('0x17')]({'where':_0x32f32a[_0xb4ae('0x42')]})['then'](function(_0x4358ae){_0x43d86a[_0xb4ae('0x17')]=_0x4358ae;if(_0x33575d[_0xb4ae('0x26')][_0xb4ae('0x4b')]){_0x32f32a[_0xb4ae('0x4c')]=[{'all':!![]}];}return db[_0xb4ae('0x39')][_0xb4ae('0x25')](_0x32f32a);})[_0xb4ae('0x1c')](function(_0x3215f2){_0x43d86a[_0xb4ae('0x4d')]=_0x3215f2;return _0x43d86a;});}})[_0xb4ae('0x1c')](respondWithFilteredResult(_0x18ab84,_0x32f32a))[_0xb4ae('0x27')](handleError(_0x18ab84,null));};exports['addTags']=function(_0x2a1c1b,_0x27fdfd){return db[_0xb4ae('0x20')][_0xb4ae('0x34')]({'where':{'id':_0x2a1c1b['params']['id']}})['then'](handleEntityNotFound(_0x27fdfd,null))[_0xb4ae('0x1c')](function(_0x339a3c){if(_0x339a3c){return _0x339a3c['setTags'](_0x2a1c1b[_0xb4ae('0x33')][_0xb4ae('0x3a')],_['omit'](_0x2a1c1b[_0xb4ae('0x33')],[_0xb4ae('0x3a'),'id'])||{})[_0xb4ae('0x4e')](function(){return db[_0xb4ae('0x4f')][_0xb4ae('0x25')]({'attributes':['id',_0xb4ae('0x50'),'color'],'where':{'id':_0x2a1c1b[_0xb4ae('0x33')][_0xb4ae('0x3a')]}});})[_0xb4ae('0x1c')](function(_0x89820){socket[_0xb4ae('0x51')](_0xb4ae('0x52'),{'id':Number(_0x2a1c1b[_0xb4ae('0x35')]['id']),'tags':_0x89820||[]});return{'id':Number(_0x2a1c1b[_0xb4ae('0x35')]['id']),'tags':_0x89820||[]};});}})[_0xb4ae('0x1c')](respondWithResult(_0x27fdfd,null))['catch'](handleError(_0x27fdfd,null));};exports[_0xb4ae('0x53')]=function(_0xab7416,_0xe5e8dc){return db[_0xb4ae('0x20')]['find']({'where':{'id':_0xab7416['params']['id']}})['then'](handleEntityNotFound(_0xe5e8dc,null))[_0xb4ae('0x1c')](function(_0xcb5074){if(_0xcb5074){return _0xcb5074[_0xb4ae('0x53')](_0xab7416['query'][_0xb4ae('0x3a')]);}})[_0xb4ae('0x1c')](respondWithStatusCode(_0xe5e8dc,null))[_0xb4ae('0x27')](handleError(_0xe5e8dc,null));};exports[_0xb4ae('0x54')]=function(_0x4706bb,_0x2cee61){var _0x4baa11=moment()[_0xb4ae('0x55')]()[_0xb4ae('0x56')]();var _0x54cfdc=path[_0xb4ae('0x57')](config[_0xb4ae('0x58')],_0xb4ae('0x59'),_0xb4ae('0x5a'),_0xb4ae('0x5b'));var _0x1aa1aa=path['join'](config[_0xb4ae('0x58')],_0xb4ae('0x59'),_0xb4ae('0x5a'),_0xb4ae('0x5c'));var _0x2c2c95=path[_0xb4ae('0x57')](_0x54cfdc,_0x4baa11);var _0x53d9ab=util['format']('transcript-%d-%s.zip',_0x4706bb[_0xb4ae('0x35')]['id'],_0x4baa11);var _0x5ee175=path[_0xb4ae('0x57')](_0x54cfdc,_0x53d9ab);var _0x167070=[];_0x167070['push']({'model':db[_0xb4ae('0x5d')],'as':_0xb4ae('0x5d'),'attributes':['id',_0xb4ae('0x5e')],'raw':!![]});_0x167070['push']({'model':db[_0xb4ae('0x5f')],'as':_0xb4ae('0x60'),'attributes':['id',_0xb4ae('0x61'),_0xb4ae('0x62')],'raw':!![]});if(_0x4706bb[_0xb4ae('0x26')]['attachments']){_0x167070[_0xb4ae('0x63')]({'model':db[_0xb4ae('0x64')],'as':_0xb4ae('0x64'),'raw':!![]});}var _0x133628=[{'model':db[_0xb4ae('0x39')],'as':_0xb4ae('0x65'),'attributes':['id',_0xb4ae('0x33'),_0xb4ae('0x66'),_0xb4ae('0x67'),_0xb4ae('0x68'),_0xb4ae('0x69')],'include':_0x167070}];_0x133628[_0xb4ae('0x63')]({'model':db[_0xb4ae('0x6a')],'as':_0xb4ae('0x6b'),'attributes':['id',_0xb4ae('0x50')]});_0x133628[_0xb4ae('0x63')]({'model':db['User'],'as':_0xb4ae('0x6c'),'attributes':['id','fullname']});return db[_0xb4ae('0x20')][_0xb4ae('0x34')]({'where':{'id':_0x4706bb[_0xb4ae('0x35')]['id']},'include':_0x133628})[_0xb4ae('0x1c')](handleEntityNotFound(_0x2cee61,null))[_0xb4ae('0x1c')](function(_0x10ac3b){if(_0x10ac3b){var _0x27d359=_0x10ac3b[_0xb4ae('0x6d')]({'plain':!![]});fs[_0xb4ae('0x6e')](_0x2c2c95);var _0x1b5638={'channel':'Whatsapp','account':_0x27d359['Account'][_0xb4ae('0x50')],'agent':_0x27d359[_0xb4ae('0x6c')]?_0x27d359['Owner'][_0xb4ae('0x5e')]:_0xb4ae('0x6f'),'createdAt':moment(_0x27d359[_0xb4ae('0x66')])[_0xb4ae('0x49')](_0xb4ae('0x4a'))[_0xb4ae('0x56')](),'closedAt':_0x27d359[_0xb4ae('0x70')]?moment(_0x27d359[_0xb4ae('0x71')])[_0xb4ae('0x49')](_0xb4ae('0x4a'))[_0xb4ae('0x56')]():'','disposition':_0x27d359[_0xb4ae('0x72')],'messages':_(_0x27d359[_0xb4ae('0x65')])[_0xb4ae('0x45')]({'secret':![]})[_0xb4ae('0x46')](function(_0x3f9703){if(_0x3f9703[_0xb4ae('0x64')]){var _0x182c1d=path['join'](_0x1aa1aa,_0x3f9703['Attachment'][_0xb4ae('0x73')]);if(fs[_0xb4ae('0x74')](_0x182c1d)){fs[_0xb4ae('0x75')](_0x182c1d)[_0xb4ae('0x76')](fs['createWriteStream'](path[_0xb4ae('0x57')](_0x2c2c95,_0x3f9703['Attachment'][_0xb4ae('0x73')])));}}return{'date':moment(_0x3f9703[_0xb4ae('0x66')])[_0xb4ae('0x49')](_0xb4ae('0x4a'))[_0xb4ae('0x56')](),'sender':_0x3f9703['direction']===_0xb4ae('0x77')?_0x3f9703[_0xb4ae('0x5d')]?_0x3f9703['User'][_0xb4ae('0x5e')]:_0xb4ae('0x78'):_0x3f9703[_0xb4ae('0x60')][_0xb4ae('0x61')]+(_0x3f9703[_0xb4ae('0x60')]['lastName']?'\x20'+_0x3f9703[_0xb4ae('0x60')][_0xb4ae('0x62')]:''),'body':_0x3f9703[_0xb4ae('0x64')]?_0x3f9703[_0xb4ae('0x64')][_0xb4ae('0x73')]:_0x3f9703[_0xb4ae('0x33')],'direction':_0x3f9703[_0xb4ae('0x67')]===_0xb4ae('0x77')?'A':'C','secret':_0x3f9703['secret'],'read':_0x3f9703[_0xb4ae('0x69')],'attachment':_0x3f9703[_0xb4ae('0x64')]};})[_0xb4ae('0x79')]()};return ejs[_0xb4ae('0x7a')](path['join'](config[_0xb4ae('0x58')],_0xb4ae('0x59'),_0xb4ae('0x7b'),_0xb4ae('0x7c')),{'interaction':_0x1b5638})['then'](function(_0x5f4693){var _0x57a777=path[_0xb4ae('0x57')](_0x2c2c95,'transcript-'+_0x27d359['id']+'-'+_0x4baa11+_0xb4ae('0x7d'));var _0x1953cc={'path':_0x57a777,'channel':_0xb4ae('0x7e'),'interactionId':_0x27d359['id']};return pdf[_0xb4ae('0x7f')](_0x5f4693,_0x1953cc);})[_0xb4ae('0x1c')](function(){return new BPromise(function(_0x33766d,_0x52985b){zipdir(_0x2c2c95,{'saveTo':_0x5ee175},function(_0xee9361,_0x51dcfb){if(_0xee9361)return _0x52985b(_0xee9361);return _0x33766d(_0x51dcfb);});})[_0xb4ae('0x1c')](function(){return new BPromise(function(_0x25b25c,_0x3137bc){rimraf(_0x2c2c95,function(_0x3a2444){if(_0x3a2444)_0x3137bc(_0x3a2444);return _0x25b25c();});});})[_0xb4ae('0x1c')](function(){return _0x2cee61[_0xb4ae('0x54')](_0x5ee175,_0x53d9ab,function(_0x558430){if(_0x558430){console[_0xb4ae('0x80')](_0xb4ae('0x81'),_0x558430);}else{fs['unlinkSync'](_0x5ee175);}});});});}else{return _0x2cee61[_0xb4ae('0x1d')](0xc8);}})[_0xb4ae('0x27')](handleError(_0x2cee61,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 042262c..42553da 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 _0xb43b=['Users','map','then','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','getUsers','setDataValue'];(function(_0x3f0a71,_0x47ece4){var _0x308419=function(_0x434828){while(--_0x434828){_0x3f0a71['push'](_0x3f0a71['shift']());}};_0x308419(++_0x47ece4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3b7c44,_0x1a614c){_0x3b7c44=_0x3b7c44-0x0;var _0x5f4d8b=_0xb43b[_0x3b7c44];return _0x5f4d8b;};'use strict';var EventEmitter=require(_0xbb43('0x0'));var WhatsappInteraction=require(_0xbb43('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xbb43('0x1'))['db'][_0xbb43('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbb43('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb43('0x4'),'afterDestroy':_0xbb43('0x5')};function emitEvent(_0x351254){return function(_0x16432a,_0x5dfb22,_0x491fb9){_0x16432a[_0xbb43('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x80fe61){_0x16432a[_0xbb43('0x7')](_0xbb43('0x8'),_0x80fe61[_0xbb43('0x9')](function(_0x364718){return{'id':_0x364718['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x16432a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbb43('0xa')](function(_0xf54ac5){_0x16432a['setDataValue'](_0xbb43('0xb'),_0xf54ac5[_0xbb43('0xc')]);WhatsappInteractionEvents[_0xbb43('0xd')](_0x351254+':'+_0x16432a['id'],_0x16432a);WhatsappInteractionEvents[_0xbb43('0xd')](_0x351254,_0x16432a);_0x491fb9(null);})[_0xbb43('0xe')](_0x491fb9(null));};}for(var e in events){if(events[_0xbb43('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xbb43('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x9b87=['unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','findAll'];(function(_0x20ce3c,_0x4b0f2a){var _0x454631=function(_0x756d15){while(--_0x756d15){_0x20ce3c['push'](_0x20ce3c['shift']());}};_0x454631(++_0x4b0f2a);}(_0x9b87,0x8e));var _0x79b8=function(_0x2078bd,_0x4956ec){_0x2078bd=_0x2078bd-0x0;var _0x24d2ac=_0x9b87[_0x2078bd];return _0x24d2ac;};'use strict';var EventEmitter=require(_0x79b8('0x0'));var WhatsappInteraction=require(_0x79b8('0x1'))['db'][_0x79b8('0x2')];var WhatsappMessage=require(_0x79b8('0x1'))['db'][_0x79b8('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x79b8('0x4')](0x0);var events={'afterCreate':_0x79b8('0x5'),'afterUpdate':_0x79b8('0x6'),'afterDestroy':_0x79b8('0x7')};function emitEvent(_0xa65bbc){return function(_0x1f9679,_0x399796,_0x3ccc53){_0x1f9679[_0x79b8('0x8')]({'attributes':['id'],'raw':!![]})[_0x79b8('0x9')](function(_0xf5e0f2){_0x1f9679['setDataValue']('Users',_0xf5e0f2['map'](function(_0x4c058b){return{'id':_0x4c058b['id']};}));return WhatsappMessage[_0x79b8('0xa')]({'where':{'WhatsappInteractionId':_0x1f9679['id'],'direction':'in','read':![]},'raw':!![]});})[_0x79b8('0x9')](function(_0x2f3453){_0x1f9679['setDataValue'](_0x79b8('0xb'),_0x2f3453[_0x79b8('0xc')]);WhatsappInteractionEvents[_0x79b8('0xd')](_0xa65bbc+':'+_0x1f9679['id'],_0x1f9679);WhatsappInteractionEvents['emit'](_0xa65bbc,_0x1f9679);_0x3ccc53(null);})['catch'](_0x3ccc53(null));};}for(var e in events){if(events[_0x79b8('0xe')](e)){var event=events[e];WhatsappInteraction[_0x79b8('0xf')](e,emitEvent(event));}}module[_0x79b8('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 dd8fc57..86422ef 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 _0x16d4=['changed','closedAt','format','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x4f840d,_0x5d6218){var _0x315f81=function(_0x1a6e6a){while(--_0x1a6e6a){_0x4f840d['push'](_0x4f840d['shift']());}};_0x315f81(++_0x5d6218);}(_0x16d4,0x189));var _0x416d=function(_0x55da8b,_0x138713){_0x55da8b=_0x55da8b-0x0;var _0x4d12e3=_0x16d4[_0x55da8b];return _0x4d12e3;};'use strict';var _=require(_0x416d('0x0'));var util=require(_0x416d('0x1'));var logger=require(_0x416d('0x2'))(_0x416d('0x3'));var moment=require(_0x416d('0x4'));var BPromise=require('bluebird');var rp=require(_0x416d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x416d('0x6'));var attributes=require(_0x416d('0x7'));module[_0x416d('0x8')]=function(_0x10dd13,_0xe3a307){return _0x10dd13[_0x416d('0x9')](_0x416d('0xa'),attributes,{'tableName':_0x416d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32235a,_0x3f9673,_0x1e9074){if(_0x32235a[_0x416d('0xc')]('closed')){_0x32235a[_0x416d('0xd')]=moment()[_0x416d('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1e9074(null,_0x32235a);}}});}; \ No newline at end of file +var _0x2836=['define','WhatsappInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x2b0244,_0x585716){var _0x3f6813=function(_0x3146aa){while(--_0x3146aa){_0x2b0244['push'](_0x2b0244['shift']());}};_0x3f6813(++_0x585716);}(_0x2836,0x67));var _0x6283=function(_0x1aa71e,_0x5efd84){_0x1aa71e=_0x1aa71e-0x0;var _0x2038bc=_0x2836[_0x1aa71e];return _0x2038bc;};'use strict';var _=require(_0x6283('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6283('0x1'));var BPromise=require(_0x6283('0x2'));var rp=require(_0x6283('0x3'));var fs=require('fs');var path=require(_0x6283('0x4'));var rimraf=require(_0x6283('0x5'));var config=require(_0x6283('0x6'));var attributes=require(_0x6283('0x7'));module[_0x6283('0x8')]=function(_0x217b56,_0x360b0f){return _0x217b56[_0x6283('0x9')](_0x6283('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2cc1c8,_0x4bf2cb,_0xd97f81){if(_0x2cc1c8[_0x6283('0xb')]('closed')){_0x2cc1c8['closedAt']=moment()[_0x6283('0xc')](_0x6283('0xd'));}_0xd97f81(null,_0x2cc1c8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 08ccf20..818e236 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 _0x2a50=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5a4cd7,_0x465e61){var _0x256212=function(_0x13ef0c){while(--_0x13ef0c){_0x5a4cd7['push'](_0x5a4cd7['shift']());}};_0x256212(++_0x465e61);}(_0x2a50,0x168));var _0x02a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x02a5('0x0'));var util=require(_0x02a5('0x1'));var moment=require(_0x02a5('0x2'));var BPromise=require(_0x02a5('0x3'));var rs=require(_0x02a5('0x4'));var fs=require('fs');var Redis=require(_0x02a5('0x5'));var db=require(_0x02a5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x02a5('0x7'))(_0x02a5('0x8'));var config=require('../../config/environment');var jayson=require(_0x02a5('0x9'));var client=jayson[_0x02a5('0xa')][_0x02a5('0xb')]({'port':0x232a});config[_0x02a5('0xc')]=_[_0x02a5('0xd')](config['redis'],{'host':_0x02a5('0xe'),'port':0x18eb});var socket=require(_0x02a5('0xf'))(new Redis(config[_0x02a5('0xc')]));require(_0x02a5('0x10'))[_0x02a5('0x11')](socket);function respondWithRpcPromise(_0x381d6e,_0x193433,_0x3c358e){return new BPromise(function(_0x5437e2,_0x201987){return client[_0x02a5('0x12')](_0x381d6e,_0x3c358e)[_0x02a5('0x13')](function(_0x1e7eb9){logger['info'](_0x02a5('0x14'),_0x193433,_0x02a5('0x15'));logger[_0x02a5('0x16')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x193433,'request\x20sent',JSON[_0x02a5('0x17')](_0x1e7eb9));if(_0x1e7eb9[_0x02a5('0x18')]){if(_0x1e7eb9[_0x02a5('0x18')][_0x02a5('0x19')]===0x1f4){logger[_0x02a5('0x18')](_0x02a5('0x14'),_0x193433,_0x1e7eb9[_0x02a5('0x18')][_0x02a5('0x1a')]);return _0x201987(_0x1e7eb9[_0x02a5('0x18')]['message']);}logger[_0x02a5('0x18')](_0x02a5('0x14'),_0x193433,_0x1e7eb9[_0x02a5('0x18')]['message']);return _0x5437e2(_0x1e7eb9[_0x02a5('0x18')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x193433,_0x02a5('0x15'));_0x5437e2(_0x1e7eb9[_0x02a5('0x1b')][_0x02a5('0x1a')]);}})[_0x02a5('0x1c')](function(_0x203675){logger[_0x02a5('0x18')](_0x02a5('0x14'),_0x193433,_0x203675);_0x201987(_0x203675);});});}exports['UpdateWhatsappInteraction']=function(_0x586cc5){var _0x2ae703=this;return new Promise(function(_0x20499a,_0x4e6441){return db[_0x02a5('0x1d')][_0x02a5('0x1e')](_0x586cc5[_0x02a5('0x1f')],{'raw':_0x586cc5[_0x02a5('0x20')]?_0x586cc5[_0x02a5('0x20')][_0x02a5('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x586cc5['options']?_0x586cc5[_0x02a5('0x20')][_0x02a5('0x22')]||null:null,'attributes':_0x586cc5[_0x02a5('0x20')]?_0x586cc5[_0x02a5('0x20')][_0x02a5('0x23')]||null:null,'limit':_0x586cc5[_0x02a5('0x20')]?_0x586cc5[_0x02a5('0x20')][_0x02a5('0x24')]||null:null})[_0x02a5('0x13')](function(_0x5f4cc3){logger['info'](_0x02a5('0x25'),_0x586cc5);logger[_0x02a5('0x16')](_0x02a5('0x25'),_0x586cc5,JSON['stringify'](_0x5f4cc3));_0x20499a(_0x5f4cc3);})[_0x02a5('0x1c')](function(_0x55572e){logger[_0x02a5('0x18')](_0x02a5('0x25'),_0x55572e[_0x02a5('0x1a')],_0x586cc5);_0x4e6441(_0x2ae703[_0x02a5('0x18')](0x1f4,_0x55572e[_0x02a5('0x1a')]));});});};exports[_0x02a5('0x26')]=function(_0x435246){return new Promise(function(_0x3f417d,_0x177352){return db[_0x02a5('0x1d')][_0x02a5('0x27')]({'where':_0x435246['options']?_0x435246['options']['where']||null:null})[_0x02a5('0x13')](function(_0x2f7503){if(_0x2f7503){return _0x2f7503[_0x02a5('0x28')](_0x435246['body']['ids'],_[_0x02a5('0x29')](_0x435246[_0x02a5('0x1f')],[_0x02a5('0x2a'),'id'])||{});}})[_0x02a5('0x2b')](function(_0x166d1a){logger[_0x02a5('0x2c')](_0x02a5('0x2d'),_0x435246);logger[_0x02a5('0x16')](_0x02a5('0x2d'),_0x435246,JSON['stringify'](_0x166d1a));_0x3f417d(_0x166d1a);})[_0x02a5('0x1c')](function(_0x552669){logger[_0x02a5('0x18')](_0x02a5('0x2d'),_0x552669['message'],_0x435246);_0x177352(_this['error'](0x1f4,_0x552669[_0x02a5('0x1a')]));});});}; \ No newline at end of file +var _0xf597=['AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes'];(function(_0x6287b6,_0x5682e7){var _0x5d6be4=function(_0x3e3975){while(--_0x3e3975){_0x6287b6['push'](_0x6287b6['shift']());}};_0x5d6be4(++_0x5682e7);}(_0xf597,0x11f));var _0x7f59=function(_0x2820e2,_0x3ce800){_0x2820e2=_0x2820e2-0x0;var _0x582f72=_0xf597[_0x2820e2];return _0x582f72;};'use strict';var _=require(_0x7f59('0x0'));var util=require('util');var moment=require(_0x7f59('0x1'));var BPromise=require(_0x7f59('0x2'));var rs=require(_0x7f59('0x3'));var fs=require('fs');var Redis=require(_0x7f59('0x4'));var db=require(_0x7f59('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f59('0x6'))(_0x7f59('0x7'));var config=require(_0x7f59('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7f59('0x9')]=_[_0x7f59('0xa')](config['redis'],{'host':_0x7f59('0xb'),'port':0x18eb});var socket=require(_0x7f59('0xc'))(new Redis(config[_0x7f59('0x9')]));require('./whatsappInteraction.socket')[_0x7f59('0xd')](socket);function respondWithRpcPromise(_0x1a4b34,_0x5e3c66,_0x248783){return new BPromise(function(_0x3cd2fb,_0x44f414){return client[_0x7f59('0xe')](_0x1a4b34,_0x248783)[_0x7f59('0xf')](function(_0x290acc){logger[_0x7f59('0x10')](_0x7f59('0x11'),_0x5e3c66,'request\x20sent');logger[_0x7f59('0x12')](_0x7f59('0x13'),_0x5e3c66,_0x7f59('0x14'),JSON[_0x7f59('0x15')](_0x290acc));if(_0x290acc[_0x7f59('0x16')]){if(_0x290acc[_0x7f59('0x16')][_0x7f59('0x17')]===0x1f4){logger[_0x7f59('0x16')](_0x7f59('0x11'),_0x5e3c66,_0x290acc[_0x7f59('0x16')][_0x7f59('0x18')]);return _0x44f414(_0x290acc[_0x7f59('0x16')][_0x7f59('0x18')]);}logger[_0x7f59('0x16')](_0x7f59('0x11'),_0x5e3c66,_0x290acc[_0x7f59('0x16')][_0x7f59('0x18')]);return _0x3cd2fb(_0x290acc[_0x7f59('0x16')][_0x7f59('0x18')]);}else{logger[_0x7f59('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x5e3c66,_0x7f59('0x14'));_0x3cd2fb(_0x290acc['result'][_0x7f59('0x18')]);}})[_0x7f59('0x19')](function(_0x3cd181){logger[_0x7f59('0x16')](_0x7f59('0x11'),_0x5e3c66,_0x3cd181);_0x44f414(_0x3cd181);});});}exports[_0x7f59('0x1a')]=function(_0xcf4f38){var _0x3b8dd1=this;return new Promise(function(_0x537841,_0x147447){return db[_0x7f59('0x1b')][_0x7f59('0x1c')](_0xcf4f38[_0x7f59('0x1d')],{'raw':_0xcf4f38[_0x7f59('0x1e')]?_0xcf4f38[_0x7f59('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcf4f38['options']?_0xcf4f38[_0x7f59('0x1e')][_0x7f59('0x1f')]||null:null,'attributes':_0xcf4f38[_0x7f59('0x1e')]?_0xcf4f38[_0x7f59('0x1e')][_0x7f59('0x20')]||null:null,'limit':_0xcf4f38[_0x7f59('0x1e')]?_0xcf4f38['options']['limit']||null:null})[_0x7f59('0xf')](function(_0x33cf70){logger[_0x7f59('0x10')](_0x7f59('0x1a'),_0xcf4f38);logger['debug'](_0x7f59('0x1a'),_0xcf4f38,JSON[_0x7f59('0x15')](_0x33cf70));_0x537841(_0x33cf70);})['catch'](function(_0x13c0d2){logger['error'](_0x7f59('0x1a'),_0x13c0d2[_0x7f59('0x18')],_0xcf4f38);_0x147447(_0x3b8dd1[_0x7f59('0x16')](0x1f4,_0x13c0d2[_0x7f59('0x18')]));});});};exports[_0x7f59('0x21')]=function(_0x3a727a){return new Promise(function(_0x5be2b7,_0x3bf495){return db[_0x7f59('0x1b')][_0x7f59('0x22')]({'where':_0x3a727a[_0x7f59('0x1e')]?_0x3a727a[_0x7f59('0x1e')][_0x7f59('0x1f')]||null:null})[_0x7f59('0xf')](function(_0x5453cb){if(_0x5453cb){return _0x5453cb[_0x7f59('0x23')](_0x3a727a[_0x7f59('0x1d')][_0x7f59('0x24')],_[_0x7f59('0x25')](_0x3a727a['body'],[_0x7f59('0x24'),'id'])||{});}})[_0x7f59('0x26')](function(_0x12776f){logger[_0x7f59('0x10')](_0x7f59('0x27'),_0x3a727a);logger[_0x7f59('0x12')](_0x7f59('0x27'),_0x3a727a,JSON['stringify'](_0x12776f));_0x5be2b7(_0x12776f);})[_0x7f59('0x19')](function(_0x299a20){logger[_0x7f59('0x16')](_0x7f59('0x27'),_0x299a20[_0x7f59('0x18')],_0x3a727a);_0x3bf495(_this[_0x7f59('0x16')](0x1f4,_0x299a20[_0x7f59('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 52e3dbb..573e101 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 _0xb377=['./whatsappInteraction.events','save','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x4ddef8,_0x3c78fe){var _0x456403=function(_0x439273){while(--_0x439273){_0x4ddef8['push'](_0x4ddef8['shift']());}};_0x456403(++_0x3c78fe);}(_0xb377,0x100));var _0x7b37=function(_0x340021,_0x47a231){_0x340021=_0x340021-0x0;var _0x44d0b1=_0xb377[_0x340021];return _0x44d0b1;};'use strict';var WhatsappInteractionEvents=require(_0x7b37('0x0'));var events=[_0x7b37('0x1'),'remove',_0x7b37('0x2')];function createListener(_0x2708d8,_0x503562){return function(_0x2e82ff){_0x503562[_0x7b37('0x3')](_0x2708d8,_0x2e82ff);};}function removeListener(_0x3d2284,_0x9b08fd){return function(){WhatsappInteractionEvents[_0x7b37('0x4')](_0x3d2284,_0x9b08fd);};}exports[_0x7b37('0x5')]=function(_0xa1f460){for(var _0x24facb=0x0,_0x900cce=events[_0x7b37('0x6')];_0x24facb<_0x900cce;_0x24facb++){var _0x375962=events[_0x24facb];var _0x5bb9fa=createListener(_0x7b37('0x7')+_0x375962,_0xa1f460);WhatsappInteractionEvents['on'](_0x375962,_0x5bb9fa);}}; \ No newline at end of file +var _0xbb64=['whatsappInteraction:','update','emit','removeListener','length'];(function(_0x3f71a0,_0x2c18be){var _0x2d28b3=function(_0x3b7e0b){while(--_0x3b7e0b){_0x3f71a0['push'](_0x3f71a0['shift']());}};_0x2d28b3(++_0x2c18be);}(_0xbb64,0x1dc));var _0x4bb6=function(_0x418dd6,_0x3437be){_0x418dd6=_0x418dd6-0x0;var _0x23d332=_0xbb64[_0x418dd6];return _0x23d332;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save','remove',_0x4bb6('0x0')];function createListener(_0x3d5ebf,_0x54df91){return function(_0x3ce270){_0x54df91[_0x4bb6('0x1')](_0x3d5ebf,_0x3ce270);};}function removeListener(_0x5794cc,_0x222495){return function(){WhatsappInteractionEvents[_0x4bb6('0x2')](_0x5794cc,_0x222495);};}exports['register']=function(_0x454b4c){for(var _0x314cfe=0x0,_0x1e5bdf=events[_0x4bb6('0x3')];_0x314cfe<_0x1e5bdf;_0x314cfe++){var _0x31c195=events[_0x314cfe];var _0x1f3269=createListener(_0x4bb6('0x4')+_0x31c195,_0x454b4c);WhatsappInteractionEvents['on'](_0x31c195,_0x1f3269);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 5d10a03..5a6dfd8 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 _0xcbe5=['/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0xcbe5,0xc3));var _0x5cbe=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcbe5[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x5cbe('0x0'));var util=require(_0x5cbe('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5cbe('0x2'));var router=express[_0x5cbe('0x3')]();var fs_extra=require(_0x5cbe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5cbe('0x5'));var config=require(_0x5cbe('0x6'));var controller=require(_0x5cbe('0x7'));router[_0x5cbe('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5cbe('0x8')](_0x5cbe('0x9'),auth[_0x5cbe('0xa')](),controller[_0x5cbe('0xb')]);router[_0x5cbe('0x8')](_0x5cbe('0xc'),auth[_0x5cbe('0xa')](),controller[_0x5cbe('0xd')]);router[_0x5cbe('0xe')]('/',auth['isAuthenticated'](),interaction[_0x5cbe('0xf')](_0x5cbe('0x10'),'whatsappmessage:create'),controller[_0x5cbe('0x11')]);router[_0x5cbe('0xe')](_0x5cbe('0x12'),controller[_0x5cbe('0x13')]);router['put'](_0x5cbe('0xc'),auth[_0x5cbe('0xa')](),controller['update']);router[_0x5cbe('0x14')](_0x5cbe('0x15'),auth[_0x5cbe('0xa')](),controller[_0x5cbe('0x16')]);router[_0x5cbe('0x14')](_0x5cbe('0x17'),auth[_0x5cbe('0xa')](),controller[_0x5cbe('0x18')]);router['delete'](_0x5cbe('0xc'),auth[_0x5cbe('0xa')](),controller[_0x5cbe('0x19')]);module[_0x5cbe('0x1a')]=router; \ No newline at end of file +var _0xd679=['/describe','describe','get','/:id','show','post','whatsapp','create','put','update','/:id/accept','/:id/reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index'];(function(_0x401b2f,_0x1c471e){var _0x4dc6d2=function(_0x189c72){while(--_0x189c72){_0x401b2f['push'](_0x401b2f['shift']());}};_0x4dc6d2(++_0x1c471e);}(_0xd679,0x121));var _0x9d67=function(_0x2dc6e1,_0x1def95){_0x2dc6e1=_0x2dc6e1-0x0;var _0x2387d4=_0xd679[_0x2dc6e1];return _0x2387d4;};'use strict';var multer=require('multer');var util=require(_0x9d67('0x0'));var path=require(_0x9d67('0x1'));var timeout=require(_0x9d67('0x2'));var express=require(_0x9d67('0x3'));var router=express[_0x9d67('0x4')]();var fs_extra=require(_0x9d67('0x5'));var auth=require(_0x9d67('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d67('0x7'));var controller=require(_0x9d67('0x8'));router['get']('/',auth[_0x9d67('0x9')](),controller[_0x9d67('0xa')]);router['get'](_0x9d67('0xb'),auth['isAuthenticated'](),controller[_0x9d67('0xc')]);router[_0x9d67('0xd')](_0x9d67('0xe'),auth['isAuthenticated'](),controller[_0x9d67('0xf')]);router[_0x9d67('0x10')]('/',auth[_0x9d67('0x9')](),interaction['tracked'](_0x9d67('0x11'),'whatsappmessage:create'),controller[_0x9d67('0x12')]);router[_0x9d67('0x10')]('/:id/status',controller['status']);router[_0x9d67('0x13')](_0x9d67('0xe'),auth[_0x9d67('0x9')](),controller[_0x9d67('0x14')]);router[_0x9d67('0x13')](_0x9d67('0x15'),auth[_0x9d67('0x9')](),controller['accept']);router[_0x9d67('0x13')](_0x9d67('0x16'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x9d67('0xe'),auth[_0x9d67('0x9')](),controller[_0x9d67('0x17')]);module[_0x9d67('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 4406be0..8304dc3 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 _0xcfa1=['BOOLEAN','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x1928fb,_0x152e80){var _0x2e467b=function(_0x2c1ce8){while(--_0x2c1ce8){_0x1928fb['push'](_0x1928fb['shift']());}};_0x2e467b(++_0x152e80);}(_0xcfa1,0xc8));var _0x1cfa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcfa1[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x1cfa('0x0'));module['exports']={'body':{'type':Sequelize[_0x1cfa('0x1')](_0x1cfa('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1cfa('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x1cfa('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1cfa('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1cfa('0x5')]},'readAt':{'type':Sequelize[_0x1cfa('0x6')]},'secret':{'type':Sequelize[_0x1cfa('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1cfa('0x5')]},'providerResponse':{'type':Sequelize[_0x1cfa('0x1')]}}; \ No newline at end of file +var _0x245c=['exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x544e4f,_0xf5be75){var _0x631f28=function(_0xccdce3){while(--_0xccdce3){_0x544e4f['push'](_0x544e4f['shift']());}};_0x631f28(++_0xf5be75);}(_0x245c,0x10a));var _0xc245=function(_0x91b0d6,_0x295bdf){_0x91b0d6=_0x91b0d6-0x0;var _0x183308=_0x245c[_0x91b0d6];return _0x183308;};'use strict';var Sequelize=require('sequelize');module[_0xc245('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc245('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc245('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc245('0x3')]('in',_0xc245('0x4')),'defaultValue':_0xc245('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc245('0x5')](0xbe)},'phone':{'type':Sequelize[_0xc245('0x5')]},'readAt':{'type':Sequelize[_0xc245('0x6')]},'secret':{'type':Sequelize[_0xc245('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index d388d1e..3b512a5 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 _0xeaf2=['type','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','findAll','rows','catch','show','intersection','length','include','find','body','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','SELECT','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','sendStatus','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xeaf2,0x1f1));var _0x2eaf=function(_0x74115b,_0x31f752){_0x74115b=_0x74115b-0x0;var _0x57ebbd=_0xeaf2[_0x74115b];return _0x57ebbd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2eaf('0x0'));var zipdir=require(_0x2eaf('0x1'));var jsonpatch=require(_0x2eaf('0x2'));var rp=require(_0x2eaf('0x3'));var moment=require(_0x2eaf('0x4'));var BPromise=require(_0x2eaf('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2eaf('0x6'));var sox=require('sox');var csv=require(_0x2eaf('0x7'));var ejs=require(_0x2eaf('0x8'));var fs=require('fs');var fs_extra=require(_0x2eaf('0x9'));var _=require(_0x2eaf('0xa'));var squel=require(_0x2eaf('0xb'));var crypto=require(_0x2eaf('0xc'));var jsforce=require(_0x2eaf('0xd'));var deskjs=require(_0x2eaf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2eaf('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2eaf('0x10'));var qs=require(_0x2eaf('0x11'));var as=require(_0x2eaf('0x12'));var hardwareService=require(_0x2eaf('0x13'));var logger=require(_0x2eaf('0x14'))(_0x2eaf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2eaf('0x16'));var db=require(_0x2eaf('0x17'))['db'];config['redis']=_[_0x2eaf('0x18')](config[_0x2eaf('0x19')],{'host':_0x2eaf('0x1a'),'port':0x18eb});var socket=require(_0x2eaf('0x1b'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x2eaf('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2eaf('0x1d')][_0x2eaf('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaed2fa,_0x444624,_0x2ca9ea,_0x1f8134){return new BPromise(function(_0x2d760b,_0x5b8b23){var _0x3d93ec=_0x1f8134||client;return _0x3d93ec[_0x2eaf('0x1f')](_0xaed2fa,_0x2ca9ea)[_0x2eaf('0x20')](function(_0x5981e4){logger[_0x2eaf('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x444624,_0x2eaf('0x22'));logger[_0x2eaf('0x23')](_0x2eaf('0x24'),_0x444624,'request\x20sent',JSON[_0x2eaf('0x25')](_0x5981e4));if(_0x5981e4[_0x2eaf('0x26')]){if(_0x5981e4[_0x2eaf('0x26')][_0x2eaf('0x27')]===0x1f4){logger[_0x2eaf('0x26')](_0x2eaf('0x28'),_0x444624,_0x5981e4[_0x2eaf('0x26')]['message']);return _0x5b8b23(_0x5981e4[_0x2eaf('0x26')][_0x2eaf('0x29')]);}logger[_0x2eaf('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x444624,_0x5981e4[_0x2eaf('0x26')][_0x2eaf('0x29')]);return _0x2d760b(_0x5981e4[_0x2eaf('0x26')][_0x2eaf('0x29')]);}else{logger[_0x2eaf('0x21')](_0x2eaf('0x28'),_0x444624,_0x2eaf('0x22'));_0x2d760b(_0x5981e4[_0x2eaf('0x2a')][_0x2eaf('0x29')]);}})['catch'](function(_0x546aeb){logger[_0x2eaf('0x26')](_0x2eaf('0x28'),_0x444624,_0x546aeb);_0x5b8b23(_0x546aeb);});});}function respondWithStatusCode(_0x40f2ab,_0x4c26f1){_0x4c26f1=_0x4c26f1||0xcc;return function(_0x5c0987){if(_0x5c0987){return _0x40f2ab['sendStatus'](_0x4c26f1);}return _0x40f2ab[_0x2eaf('0x2b')](_0x4c26f1)[_0x2eaf('0x2c')]();};}function respondWithResult(_0x1321b3,_0x3dba9c){_0x3dba9c=_0x3dba9c||0xc8;return function(_0xc3e4cc){if(_0xc3e4cc){return _0x1321b3[_0x2eaf('0x2b')](_0x3dba9c)[_0x2eaf('0x2d')](_0xc3e4cc);}};}function respondWithFilteredResult(_0x56d06c,_0x30ab54){return function(_0x329cf0){if(_0x329cf0){var _0x34dcb4=typeof _0x30ab54[_0x2eaf('0x2e')]===_0x2eaf('0x2f')&&typeof _0x30ab54[_0x2eaf('0x30')]==='undefined';var _0x29e4c3=_0x329cf0[_0x2eaf('0x31')];var _0x155604=_0x34dcb4?0x0:_0x30ab54[_0x2eaf('0x2e')];var _0x1359fc=_0x34dcb4?_0x329cf0[_0x2eaf('0x31')]:_0x30ab54['offset']+_0x30ab54[_0x2eaf('0x30')];var _0x367f52;if(_0x1359fc>=_0x29e4c3){_0x1359fc=_0x29e4c3;_0x367f52=0xc8;}else{_0x367f52=0xce;}_0x56d06c['status'](_0x367f52);return _0x56d06c[_0x2eaf('0x32')](_0x2eaf('0x33'),_0x155604+'-'+_0x1359fc+'/'+_0x29e4c3)['json'](_0x329cf0);}return null;};}function patchUpdates(_0x55eab6){return function(_0x316d7a){try{jsonpatch['apply'](_0x316d7a,_0x55eab6,!![]);}catch(_0x3d1d6f){return BPromise['reject'](_0x3d1d6f);}return _0x316d7a[_0x2eaf('0x34')]();};}function saveUpdates(_0x1d84b8,_0x5950d4){return function(_0x1ce6be){if(_0x1ce6be){return _0x1ce6be[_0x2eaf('0x35')](_0x1d84b8)['then'](function(_0x372ded){return _0x372ded;});}return null;};}function removeEntity(_0x1c4630,_0x3ec7ac){return function(_0x56035a){if(_0x56035a){return _0x56035a[_0x2eaf('0x36')]()['then'](function(){_0x1c4630[_0x2eaf('0x2b')](0xcc)[_0x2eaf('0x2c')]();});}};}function handleEntityNotFound(_0x239eda,_0x33df0e){return function(_0x2b1c1d){if(!_0x2b1c1d){_0x239eda[_0x2eaf('0x37')](0x194);}return _0x2b1c1d;};}function handleError(_0x89dd05,_0x2edd09){_0x2edd09=_0x2edd09||0x1f4;return function(_0xb4a1c0){logger[_0x2eaf('0x26')](_0xb4a1c0[_0x2eaf('0x38')]);if(_0xb4a1c0[_0x2eaf('0x39')]){delete _0xb4a1c0[_0x2eaf('0x39')];}_0x89dd05[_0x2eaf('0x2b')](_0x2edd09)[_0x2eaf('0x3a')](_0xb4a1c0);};}exports['index']=function(_0x5d3716,_0x3dbb87){var _0x3ebe05={},_0x15a26c={},_0x11074d={'count':0x0,'rows':[]};var _0x54c2d0=_[_0x2eaf('0x3b')](db[_0x2eaf('0x3c')][_0x2eaf('0x3d')],function(_0x3e01ba){return{'name':_0x3e01ba[_0x2eaf('0x3e')],'type':_0x3e01ba[_0x2eaf('0x3f')][_0x2eaf('0x40')]};});_0x15a26c[_0x2eaf('0x41')]=_[_0x2eaf('0x3b')](_0x54c2d0,_0x2eaf('0x39'));_0x15a26c[_0x2eaf('0x42')]=_[_0x2eaf('0x43')](_0x5d3716['query']);_0x15a26c['filters']=_['intersection'](_0x15a26c['model'],_0x15a26c[_0x2eaf('0x42')]);_0x3ebe05[_0x2eaf('0x44')]=_['intersection'](_0x15a26c['model'],qs[_0x2eaf('0x45')](_0x5d3716[_0x2eaf('0x42')][_0x2eaf('0x45')]));_0x3ebe05['attributes']=_0x3ebe05[_0x2eaf('0x44')]['length']?_0x3ebe05[_0x2eaf('0x44')]:_0x15a26c[_0x2eaf('0x41')];if(!_0x5d3716[_0x2eaf('0x42')][_0x2eaf('0x46')](_0x2eaf('0x47'))){_0x3ebe05[_0x2eaf('0x30')]=qs['limit'](_0x5d3716[_0x2eaf('0x42')]['limit']);_0x3ebe05[_0x2eaf('0x2e')]=qs['offset'](_0x5d3716[_0x2eaf('0x42')][_0x2eaf('0x2e')]);}_0x3ebe05[_0x2eaf('0x48')]=qs['sort'](_0x5d3716[_0x2eaf('0x42')][_0x2eaf('0x49')]);_0x3ebe05[_0x2eaf('0x4a')]=qs[_0x2eaf('0x4b')](_['pick'](_0x5d3716['query'],_0x15a26c[_0x2eaf('0x4b')]),_0x54c2d0);if(_0x5d3716['query'][_0x2eaf('0x4c')]){_0x3ebe05[_0x2eaf('0x4a')]=_['merge'](_0x3ebe05[_0x2eaf('0x4a')],{'$or':_[_0x2eaf('0x3b')](_0x54c2d0,function(_0x1a8757){if(_0x1a8757[_0x2eaf('0x3f')]!=='VIRTUAL'){var _0x36b8d4={};_0x36b8d4[_0x1a8757['name']]={'$like':'%'+_0x5d3716[_0x2eaf('0x42')]['filter']+'%'};return _0x36b8d4;}})});}_0x3ebe05=_[_0x2eaf('0x4d')]({},_0x3ebe05,_0x5d3716['options']);var _0x236ca6={'where':_0x3ebe05[_0x2eaf('0x4a')]};return db[_0x2eaf('0x3c')][_0x2eaf('0x31')](_0x236ca6)[_0x2eaf('0x20')](function(_0x5b8048){_0x11074d['count']=_0x5b8048;if(_0x5d3716[_0x2eaf('0x42')][_0x2eaf('0x4e')]){_0x3ebe05['include']=[{'all':!![]}];}return db[_0x2eaf('0x3c')][_0x2eaf('0x4f')](_0x3ebe05);})['then'](function(_0x5b6733){_0x11074d[_0x2eaf('0x50')]=_0x5b6733;return _0x11074d;})['then'](respondWithFilteredResult(_0x3dbb87,_0x3ebe05))[_0x2eaf('0x51')](handleError(_0x3dbb87,null));};exports[_0x2eaf('0x52')]=function(_0x1faa94,_0x288619){var _0x324219={'raw':!![],'where':{'id':_0x1faa94['params']['id']}},_0x20e80a={};_0x20e80a[_0x2eaf('0x41')]=_[_0x2eaf('0x43')](db['WhatsappMessage'][_0x2eaf('0x3d')]);_0x20e80a[_0x2eaf('0x42')]=_['keys'](_0x1faa94[_0x2eaf('0x42')]);_0x20e80a[_0x2eaf('0x4b')]=_[_0x2eaf('0x53')](_0x20e80a['model'],_0x20e80a[_0x2eaf('0x42')]);_0x324219[_0x2eaf('0x44')]=_[_0x2eaf('0x53')](_0x20e80a[_0x2eaf('0x41')],qs[_0x2eaf('0x45')](_0x1faa94[_0x2eaf('0x42')]['fields']));_0x324219[_0x2eaf('0x44')]=_0x324219[_0x2eaf('0x44')][_0x2eaf('0x54')]?_0x324219['attributes']:_0x20e80a[_0x2eaf('0x41')];if(_0x1faa94[_0x2eaf('0x42')]['includeAll']){_0x324219[_0x2eaf('0x55')]=[{'all':!![]}];}_0x324219=_[_0x2eaf('0x4d')]({},_0x324219,_0x1faa94['options']);return db[_0x2eaf('0x3c')][_0x2eaf('0x56')](_0x324219)[_0x2eaf('0x20')](handleEntityNotFound(_0x288619,null))[_0x2eaf('0x20')](respondWithResult(_0x288619,null))[_0x2eaf('0x51')](handleError(_0x288619,null));};exports['create']=function(_0x3cc37f,_0x4f1556){return db[_0x2eaf('0x3c')]['create'](_0x3cc37f[_0x2eaf('0x57')],{})[_0x2eaf('0x20')](respondWithResult(_0x4f1556,0xc9))[_0x2eaf('0x51')](handleError(_0x4f1556,null));};exports[_0x2eaf('0x35')]=function(_0x549496,_0xfa1f59){if(_0x549496[_0x2eaf('0x57')]['id']){delete _0x549496[_0x2eaf('0x57')]['id'];}return db[_0x2eaf('0x3c')][_0x2eaf('0x56')]({'where':{'id':_0x549496[_0x2eaf('0x58')]['id']}})[_0x2eaf('0x20')](handleEntityNotFound(_0xfa1f59,null))['then'](saveUpdates(_0x549496['body'],null))[_0x2eaf('0x20')](respondWithResult(_0xfa1f59,null))[_0x2eaf('0x51')](handleError(_0xfa1f59,null));};exports[_0x2eaf('0x36')]=function(_0xa96dbe,_0x2d3337){return db[_0x2eaf('0x3c')][_0x2eaf('0x56')]({'where':{'id':_0xa96dbe[_0x2eaf('0x58')]['id']}})['then'](handleEntityNotFound(_0x2d3337,null))['then'](removeEntity(_0x2d3337,null))[_0x2eaf('0x51')](handleError(_0x2d3337,null));};exports[_0x2eaf('0x59')]=function(_0x33fac6,_0x1a2a2f){return db['WhatsappMessage']['describe']()[_0x2eaf('0x20')](respondWithResult(_0x1a2a2f,null))[_0x2eaf('0x51')](handleError(_0x1a2a2f,null));};var interaction_log=require(_0x2eaf('0x14'))(_0x2eaf('0x5a'));exports[_0x2eaf('0x5b')]=function(_0x376348,_0x2775da,_0x2e8414){var _0x1d88ae={'agent':{},'channel':_0x2eaf('0x5c')};if(_0x376348[_0x2eaf('0x57')]['id']){delete _0x376348[_0x2eaf('0x57')]['id'];}_0x376348[_0x2eaf('0x57')][_0x2eaf('0x5d')]=!![];_0x376348[_0x2eaf('0x57')][_0x2eaf('0x5e')]=moment()[_0x2eaf('0x5f')](_0x2eaf('0x60'));_0x376348[_0x2eaf('0x57')][_0x2eaf('0x61')]=_0x376348[_0x2eaf('0x57')][_0x2eaf('0x61')]||_0x376348[_0x2eaf('0x62')]['id'];_0x1d88ae[_0x2eaf('0x63')]['id']=_0x376348[_0x2eaf('0x57')][_0x2eaf('0x61')];return db[_0x2eaf('0x3c')][_0x2eaf('0x56')]({'where':{'id':_0x376348[_0x2eaf('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2775da,null))[_0x2eaf('0x20')](saveUpdates(_0x376348[_0x2eaf('0x57')],null))['then'](function(_0x304614){if(_0x304614){_0x1d88ae[_0x2eaf('0x29')]=_0x304614[_0x2eaf('0x64')]({'plain':!![]});return db[_0x2eaf('0x65')][_0x2eaf('0x56')]({'where':{'id':_0x304614[_0x2eaf('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2775da,null))[_0x2eaf('0x20')](function(_0x178b78){if(_0x178b78){return _0x178b78[_0x2eaf('0x35')]({'UserId':_0x376348[_0x2eaf('0x57')][_0x2eaf('0x61')],'read1stAt':_[_0x2eaf('0x67')](_0x178b78['read1stAt'])?moment()['format'](_0x2eaf('0x60')):undefined});}return null;})['then'](function(_0xcfabe9){if(_0xcfabe9){_0x1d88ae[_0x2eaf('0x68')]=_0xcfabe9[_0x2eaf('0x64')]({'plain':!![]});interaction_log[_0x2eaf('0x21')](_0x2eaf('0x69'),_0x376348[_0x2eaf('0x62')]['id'],_0x376348[_0x2eaf('0x62')]['name'],_0x376348[_0x2eaf('0x62')][_0x2eaf('0x6a')],_0x1d88ae[_0x2eaf('0x68')]['id'],_0x376348['body']?JSON[_0x2eaf('0x25')](_0x376348[_0x2eaf('0x57')]):_0x2eaf('0x6b'));return respondWithRpcPromise(_0x2eaf('0x6c'),_0x2eaf('0x6d'),_0x1d88ae);}return null;})[_0x2eaf('0x20')](function(_0x1088fa){var _0xb097a4=_0x2eaf('0x6e')+_0x1088fa[_0x2eaf('0x29')][_0x2eaf('0x6f')];return db[_0x2eaf('0x70')]['query'](_0xb097a4,{'type':db[_0x2eaf('0x71')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2eaf('0x20')](function(_0x224483){return _0x224483;});})[_0x2eaf('0x20')](function(_0x1f2a4b){if(_0x1f2a4b){_0x1d88ae['message'][_0x2eaf('0x72')]=_0x1f2a4b[0x0];if(!_0x376348[_0x2eaf('0x57')][_0x2eaf('0x61')])return;return db[_0x2eaf('0x73')]['find']({'where':{'id':_0x376348['body'][_0x2eaf('0x61')],'role':_0x2eaf('0x63')},'attributes':['id','name',_0x2eaf('0x74'),'email',_0x2eaf('0x75')],'raw':!![]});}return null;})[_0x2eaf('0x20')](function(_0x26602e){if(!_0x26602e)return null;_0x1d88ae['message'][_0x2eaf('0x63')]=_0x26602e;return _0x1d88ae;})[_0x2eaf('0x20')](function(_0x42146b){if(_0x42146b){if(_0x376348['body']['manual']){_0x1d88ae[_0x2eaf('0x29')][_0x2eaf('0x76')]=util[_0x2eaf('0x5f')](_0x2eaf('0x77'),_0x376348[_0x2eaf('0x62')][_0x2eaf('0x39')]);_0x1d88ae[_0x2eaf('0x29')]['channel']=_0x1d88ae[_0x2eaf('0x78')];_0x1d88ae['message'][_0x2eaf('0x79')]=_0x1d88ae[_0x2eaf('0x78')];_0x1d88ae['message'][_0x2eaf('0x7a')]=_0x2eaf('0x5b');return respondWithRpcPromise(_0x2eaf('0x7b'),_0x2eaf('0x7b'),{'event':_0x2eaf('0x7c'),'message':_0x1d88ae[_0x2eaf('0x29')]},client9002)['then'](function(){return _0x1d88ae;});}return _0x1d88ae;}return null;})[_0x2eaf('0x20')](respondWithResult(_0x2775da,null))[_0x2eaf('0x51')](handleError(_0x2775da,null));};var interaction_log=require(_0x2eaf('0x14'))(_0x2eaf('0x5a'));exports[_0x2eaf('0x7d')]=function(_0x111a6f,_0xf6d121,_0x420bdb){var _0x12eae7={'agent':{},'channel':_0x2eaf('0x5c')};if(_0x111a6f[_0x2eaf('0x57')]['id']){delete _0x111a6f['body']['id'];}_0x111a6f[_0x2eaf('0x57')][_0x2eaf('0x61')]=_0x111a6f[_0x2eaf('0x57')][_0x2eaf('0x61')]||_0x111a6f[_0x2eaf('0x62')]['id'];_0x12eae7[_0x2eaf('0x63')]['id']=_0x111a6f[_0x2eaf('0x57')]['UserId'];return db['WhatsappMessage'][_0x2eaf('0x56')]({'where':{'id':_0x111a6f[_0x2eaf('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xf6d121,null))[_0x2eaf('0x20')](function(_0x5b11d3){if(_0x5b11d3){_0x12eae7['message']=_0x5b11d3[_0x2eaf('0x64')]({'plain':!![]});return db[_0x2eaf('0x65')]['find']({'where':{'id':_0x5b11d3[_0x2eaf('0x66')]}});}return null;})['then'](handleEntityNotFound(_0xf6d121,null))[_0x2eaf('0x20')](function(_0x445a86){if(_0x445a86){_0x12eae7[_0x2eaf('0x68')]=_0x445a86[_0x2eaf('0x64')]({'plain':!![]});interaction_log[_0x2eaf('0x21')](_0x2eaf('0x7e'),_0x111a6f[_0x2eaf('0x62')]['id'],_0x111a6f[_0x2eaf('0x62')]['name'],_0x111a6f[_0x2eaf('0x62')][_0x2eaf('0x6a')],_0x12eae7['interaction']['id'],_0x111a6f[_0x2eaf('0x57')]?JSON['stringify'](_0x111a6f[_0x2eaf('0x57')]):_0x2eaf('0x6b'));return respondWithRpcPromise(_0x2eaf('0x7f'),'rejectMessage',_0x12eae7);}return null;})[_0x2eaf('0x20')](function(_0x4b176e){var _0xb0d176=_0x2eaf('0x6e')+_0x4b176e[_0x2eaf('0x29')]['ContactId'];return db[_0x2eaf('0x70')]['query'](_0xb0d176,{'type':db[_0x2eaf('0x71')][_0x2eaf('0x80')][_0x2eaf('0x81')],'raw':!![]})[_0x2eaf('0x20')](function(_0x20b27d){return _0x20b27d;});})[_0x2eaf('0x20')](function(_0xd0dd01){if(_0xd0dd01){_0x12eae7['message'][_0x2eaf('0x72')]=_0xd0dd01[0x0];if(!_0x111a6f[_0x2eaf('0x57')][_0x2eaf('0x61')])return;return db[_0x2eaf('0x73')]['find']({'where':{'id':_0x111a6f[_0x2eaf('0x57')][_0x2eaf('0x61')],'role':_0x2eaf('0x63')},'attributes':['id','name',_0x2eaf('0x74'),'email',_0x2eaf('0x75')],'raw':!![]});}return null;})[_0x2eaf('0x20')](function(_0x2e73b2){if(!_0x2e73b2)return null;_0x12eae7[_0x2eaf('0x29')][_0x2eaf('0x63')]=_0x2e73b2;return _0x12eae7;})[_0x2eaf('0x20')](function(_0x2c112a){if(_0x2c112a){_0x2c112a[_0x2eaf('0x29')][_0x2eaf('0x76')]=util[_0x2eaf('0x5f')](_0x2eaf('0x77'),_0x111a6f[_0x2eaf('0x62')]['name']);_0x2c112a[_0x2eaf('0x29')]['channel']=_0x12eae7[_0x2eaf('0x78')];_0x2c112a[_0x2eaf('0x29')][_0x2eaf('0x79')]=_0x12eae7['channel'];_0x2c112a[_0x2eaf('0x29')][_0x2eaf('0x7a')]='reject';respondWithRpcPromise(_0x2eaf('0x7b'),_0x2eaf('0x7b'),{'event':_0x2eaf('0x82'),'message':_0x2c112a[_0x2eaf('0x29')]},client9002);return _0x12eae7;}return null;})[_0x2eaf('0x20')](respondWithResult(_0xf6d121,null))[_0x2eaf('0x51')](handleError(_0xf6d121,null));};exports[_0x2eaf('0x2b')]=function(_0x10083d,_0x56fcc2,_0x314b7d){if(_0x10083d['body']['id']){delete _0x10083d[_0x2eaf('0x57')]['id'];}var _0x27d2d3;return db[_0x2eaf('0x3c')][_0x2eaf('0x56')]({'where':{'id':_0x10083d['params']['id']}})[_0x2eaf('0x20')](handleEntityNotFound(_0x56fcc2,null))[_0x2eaf('0x20')](function(_0x4f99fa){if(_0x4f99fa){_0x27d2d3=_0x4f99fa;return db[_0x2eaf('0x83')][_0x2eaf('0x56')]({'where':{'id':_0x4f99fa['WhatsappAccountId']}});}})[_0x2eaf('0x20')](handleEntityNotFound(_0x56fcc2,null))[_0x2eaf('0x20')](function(_0x20a644){if(_0x20a644){logger[_0x2eaf('0x23')](_0x2eaf('0x84'),'status',_0x2eaf('0x85'),_0x20a644['type'],util[_0x2eaf('0x86')](_0x10083d[_0x2eaf('0x57')],{'showHidden':![],'depth':null}));switch(_0x20a644[_0x2eaf('0x3f')]){case _0x2eaf('0x87'):if(_0x10083d[_0x2eaf('0x57')][_0x2eaf('0x88')]&&_0x10083d[_0x2eaf('0x57')][_0x2eaf('0x88')]===_0x27d2d3[_0x2eaf('0x89')]&&_0x10083d[_0x2eaf('0x57')][_0x2eaf('0x8a')]&&_0x10083d['body'][_0x2eaf('0x8a')]===_0x2eaf('0x5d')){return _0x27d2d3['update']({'read':!![]});}else{logger[_0x2eaf('0x26')](_0x2eaf('0x8b'),_0x2eaf('0x2b'),_0x2eaf('0x87'),util[_0x2eaf('0x86')](_0x10083d[_0x2eaf('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x27d2d3;}})['then'](respondWithResult(_0x56fcc2,null))[_0x2eaf('0x51')](handleError(_0x56fcc2,null));}; \ No newline at end of file +var _0x1dd6=['WhatsappInteraction','WhatsappInteractionId','isNil','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SELECT','User','event','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','jayson/promise','http','client','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','show','params','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get'];(function(_0xe9fdc4,_0x1cc454){var _0x529cdd=function(_0x49d040){while(--_0x49d040){_0xe9fdc4['push'](_0xe9fdc4['shift']());}};_0x529cdd(++_0x1cc454);}(_0x1dd6,0x1b2));var _0x61dd=function(_0x51d25c,_0x54c213){_0x51d25c=_0x51d25c-0x0;var _0x221787=_0x1dd6[_0x51d25c];return _0x221787;};'use strict';var emlformat=require(_0x61dd('0x0'));var rimraf=require(_0x61dd('0x1'));var zipdir=require(_0x61dd('0x2'));var jsonpatch=require(_0x61dd('0x3'));var rp=require(_0x61dd('0x4'));var moment=require(_0x61dd('0x5'));var BPromise=require(_0x61dd('0x6'));var Mustache=require(_0x61dd('0x7'));var util=require(_0x61dd('0x8'));var path=require('path');var sox=require(_0x61dd('0x9'));var csv=require(_0x61dd('0xa'));var ejs=require(_0x61dd('0xb'));var fs=require('fs');var fs_extra=require(_0x61dd('0xc'));var _=require(_0x61dd('0xd'));var squel=require(_0x61dd('0xe'));var crypto=require('crypto');var jsforce=require(_0x61dd('0xf'));var deskjs=require(_0x61dd('0x10'));var toCsv=require('to-csv');var querystring=require(_0x61dd('0x11'));var Papa=require(_0x61dd('0x12'));var Redis=require(_0x61dd('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x61dd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x61dd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x61dd('0x16'))['db'];config[_0x61dd('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x61dd('0x18'))(new Redis(config[_0x61dd('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x61dd('0x19'));var client=jayson['client'][_0x61dd('0x1a')]({'port':0x232c});var client9002=jayson[_0x61dd('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b40b2,_0x224ae4,_0x3c4a55,_0x46f7c8){return new BPromise(function(_0x18eeb9,_0x34792f){var _0x1710ec=_0x46f7c8||client;return _0x1710ec[_0x61dd('0x1c')](_0x4b40b2,_0x3c4a55)['then'](function(_0x1bb76e){logger[_0x61dd('0x1d')](_0x61dd('0x1e'),_0x224ae4,_0x61dd('0x1f'));logger[_0x61dd('0x20')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x224ae4,_0x61dd('0x1f'),JSON[_0x61dd('0x21')](_0x1bb76e));if(_0x1bb76e[_0x61dd('0x22')]){if(_0x1bb76e[_0x61dd('0x22')][_0x61dd('0x23')]===0x1f4){logger[_0x61dd('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x224ae4,_0x1bb76e[_0x61dd('0x22')][_0x61dd('0x24')]);return _0x34792f(_0x1bb76e['error'][_0x61dd('0x24')]);}logger[_0x61dd('0x22')](_0x61dd('0x1e'),_0x224ae4,_0x1bb76e['error'][_0x61dd('0x24')]);return _0x18eeb9(_0x1bb76e[_0x61dd('0x22')][_0x61dd('0x24')]);}else{logger[_0x61dd('0x1d')]('WhatsappMessage,\x20%s,\x20%s',_0x224ae4,'request\x20sent');_0x18eeb9(_0x1bb76e[_0x61dd('0x25')][_0x61dd('0x24')]);}})[_0x61dd('0x26')](function(_0x2157ba){logger[_0x61dd('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x224ae4,_0x2157ba);_0x34792f(_0x2157ba);});});}function respondWithStatusCode(_0x113b79,_0xfd8f06){_0xfd8f06=_0xfd8f06||0xcc;return function(_0x105b43){if(_0x105b43){return _0x113b79['sendStatus'](_0xfd8f06);}return _0x113b79[_0x61dd('0x27')](_0xfd8f06)[_0x61dd('0x28')]();};}function respondWithResult(_0x10b766,_0x54a28a){_0x54a28a=_0x54a28a||0xc8;return function(_0x4d4b03){if(_0x4d4b03){return _0x10b766[_0x61dd('0x27')](_0x54a28a)[_0x61dd('0x29')](_0x4d4b03);}};}function respondWithFilteredResult(_0x4e39d1,_0x14a1e7){return function(_0x403313){if(_0x403313){var _0x37854f=typeof _0x14a1e7[_0x61dd('0x2a')]===_0x61dd('0x2b')&&typeof _0x14a1e7[_0x61dd('0x2c')]===_0x61dd('0x2b');var _0x512b9b=_0x403313['count'];var _0x5253ce=_0x37854f?0x0:_0x14a1e7[_0x61dd('0x2a')];var _0x8f80a5=_0x37854f?_0x403313[_0x61dd('0x2d')]:_0x14a1e7['offset']+_0x14a1e7['limit'];var _0x6acb98;if(_0x8f80a5>=_0x512b9b){_0x8f80a5=_0x512b9b;_0x6acb98=0xc8;}else{_0x6acb98=0xce;}_0x4e39d1['status'](_0x6acb98);return _0x4e39d1[_0x61dd('0x2e')](_0x61dd('0x2f'),_0x5253ce+'-'+_0x8f80a5+'/'+_0x512b9b)[_0x61dd('0x29')](_0x403313);}return null;};}function patchUpdates(_0x2de4c1){return function(_0x1888c9){try{jsonpatch[_0x61dd('0x30')](_0x1888c9,_0x2de4c1,!![]);}catch(_0x531e3e){return BPromise[_0x61dd('0x31')](_0x531e3e);}return _0x1888c9[_0x61dd('0x32')]();};}function saveUpdates(_0x2c882e,_0x33b04b){return function(_0x7b2db4){if(_0x7b2db4){return _0x7b2db4[_0x61dd('0x33')](_0x2c882e)['then'](function(_0x37af4b){return _0x37af4b;});}return null;};}function removeEntity(_0xa69a43,_0x5ac752){return function(_0x25d08c){if(_0x25d08c){return _0x25d08c[_0x61dd('0x34')]()[_0x61dd('0x35')](function(){_0xa69a43[_0x61dd('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ffd0,_0xbc9e47){return function(_0x535f34){if(!_0x535f34){_0x10ffd0[_0x61dd('0x36')](0x194);}return _0x535f34;};}function handleError(_0x1c820f,_0x59b26f){_0x59b26f=_0x59b26f||0x1f4;return function(_0x2de595){logger[_0x61dd('0x22')](_0x2de595[_0x61dd('0x37')]);if(_0x2de595[_0x61dd('0x38')]){delete _0x2de595[_0x61dd('0x38')];}_0x1c820f['status'](_0x59b26f)[_0x61dd('0x39')](_0x2de595);};}exports[_0x61dd('0x3a')]=function(_0x46c99f,_0xa02bd2){var _0x5584a9={},_0x9ea8e6={},_0x5ad8a3={'count':0x0,'rows':[]};var _0x26d830=_[_0x61dd('0x3b')](db[_0x61dd('0x3c')][_0x61dd('0x3d')],function(_0x152ed5){return{'name':_0x152ed5[_0x61dd('0x3e')],'type':_0x152ed5[_0x61dd('0x3f')][_0x61dd('0x40')]};});_0x9ea8e6[_0x61dd('0x41')]=_[_0x61dd('0x3b')](_0x26d830,_0x61dd('0x38'));_0x9ea8e6['query']=_[_0x61dd('0x42')](_0x46c99f[_0x61dd('0x43')]);_0x9ea8e6['filters']=_[_0x61dd('0x44')](_0x9ea8e6[_0x61dd('0x41')],_0x9ea8e6[_0x61dd('0x43')]);_0x5584a9[_0x61dd('0x45')]=_[_0x61dd('0x44')](_0x9ea8e6[_0x61dd('0x41')],qs[_0x61dd('0x46')](_0x46c99f[_0x61dd('0x43')]['fields']));_0x5584a9[_0x61dd('0x45')]=_0x5584a9[_0x61dd('0x45')]['length']?_0x5584a9['attributes']:_0x9ea8e6[_0x61dd('0x41')];if(!_0x46c99f[_0x61dd('0x43')][_0x61dd('0x47')]('nolimit')){_0x5584a9[_0x61dd('0x2c')]=qs['limit'](_0x46c99f['query']['limit']);_0x5584a9[_0x61dd('0x2a')]=qs[_0x61dd('0x2a')](_0x46c99f['query']['offset']);}_0x5584a9['order']=qs['sort'](_0x46c99f['query'][_0x61dd('0x48')]);_0x5584a9[_0x61dd('0x49')]=qs['filters'](_[_0x61dd('0x4a')](_0x46c99f[_0x61dd('0x43')],_0x9ea8e6[_0x61dd('0x4b')]),_0x26d830);if(_0x46c99f['query'][_0x61dd('0x4c')]){_0x5584a9[_0x61dd('0x49')]=_[_0x61dd('0x4d')](_0x5584a9[_0x61dd('0x49')],{'$or':_[_0x61dd('0x3b')](_0x26d830,function(_0x5a484f){if(_0x5a484f[_0x61dd('0x3f')]!==_0x61dd('0x4e')){var _0xac05ac={};_0xac05ac[_0x5a484f[_0x61dd('0x38')]]={'$like':'%'+_0x46c99f[_0x61dd('0x43')][_0x61dd('0x4c')]+'%'};return _0xac05ac;}})});}_0x5584a9=_['merge']({},_0x5584a9,_0x46c99f[_0x61dd('0x4f')]);var _0x4866fd={'where':_0x5584a9['where']};return db[_0x61dd('0x3c')][_0x61dd('0x2d')](_0x4866fd)['then'](function(_0x45cee9){_0x5ad8a3[_0x61dd('0x2d')]=_0x45cee9;if(_0x46c99f[_0x61dd('0x43')]['includeAll']){_0x5584a9[_0x61dd('0x50')]=[{'all':!![]}];}return db[_0x61dd('0x3c')]['findAll'](_0x5584a9);})[_0x61dd('0x35')](function(_0x292991){_0x5ad8a3[_0x61dd('0x51')]=_0x292991;return _0x5ad8a3;})[_0x61dd('0x35')](respondWithFilteredResult(_0xa02bd2,_0x5584a9))[_0x61dd('0x26')](handleError(_0xa02bd2,null));};exports[_0x61dd('0x52')]=function(_0x20ad2c,_0x1ea8d0){var _0x5be7a3={'raw':!![],'where':{'id':_0x20ad2c[_0x61dd('0x53')]['id']}},_0x8cf466={};_0x8cf466[_0x61dd('0x41')]=_[_0x61dd('0x42')](db[_0x61dd('0x3c')][_0x61dd('0x3d')]);_0x8cf466['query']=_[_0x61dd('0x42')](_0x20ad2c['query']);_0x8cf466[_0x61dd('0x4b')]=_[_0x61dd('0x44')](_0x8cf466[_0x61dd('0x41')],_0x8cf466['query']);_0x5be7a3[_0x61dd('0x45')]=_['intersection'](_0x8cf466[_0x61dd('0x41')],qs[_0x61dd('0x46')](_0x20ad2c[_0x61dd('0x43')][_0x61dd('0x46')]));_0x5be7a3[_0x61dd('0x45')]=_0x5be7a3[_0x61dd('0x45')]['length']?_0x5be7a3[_0x61dd('0x45')]:_0x8cf466[_0x61dd('0x41')];if(_0x20ad2c[_0x61dd('0x43')]['includeAll']){_0x5be7a3[_0x61dd('0x50')]=[{'all':!![]}];}_0x5be7a3=_['merge']({},_0x5be7a3,_0x20ad2c[_0x61dd('0x4f')]);return db[_0x61dd('0x3c')][_0x61dd('0x54')](_0x5be7a3)['then'](handleEntityNotFound(_0x1ea8d0,null))[_0x61dd('0x35')](respondWithResult(_0x1ea8d0,null))[_0x61dd('0x26')](handleError(_0x1ea8d0,null));};exports[_0x61dd('0x55')]=function(_0x1d31b7,_0x48912a){return db[_0x61dd('0x3c')][_0x61dd('0x55')](_0x1d31b7[_0x61dd('0x56')],{})['then'](respondWithResult(_0x48912a,0xc9))['catch'](handleError(_0x48912a,null));};exports[_0x61dd('0x33')]=function(_0x52147b,_0x510ec3){if(_0x52147b[_0x61dd('0x56')]['id']){delete _0x52147b[_0x61dd('0x56')]['id'];}return db[_0x61dd('0x3c')][_0x61dd('0x54')]({'where':{'id':_0x52147b[_0x61dd('0x53')]['id']}})['then'](handleEntityNotFound(_0x510ec3,null))['then'](saveUpdates(_0x52147b[_0x61dd('0x56')],null))[_0x61dd('0x35')](respondWithResult(_0x510ec3,null))[_0x61dd('0x26')](handleError(_0x510ec3,null));};exports['destroy']=function(_0x348f1a,_0x3c79a0){return db['WhatsappMessage']['find']({'where':{'id':_0x348f1a[_0x61dd('0x53')]['id']}})['then'](handleEntityNotFound(_0x3c79a0,null))[_0x61dd('0x35')](removeEntity(_0x3c79a0,null))[_0x61dd('0x26')](handleError(_0x3c79a0,null));};exports[_0x61dd('0x57')]=function(_0x4d7782,_0x1362ab){return db[_0x61dd('0x3c')][_0x61dd('0x57')]()['then'](respondWithResult(_0x1362ab,null))['catch'](handleError(_0x1362ab,null));};var interaction_log=require(_0x61dd('0x14'))(_0x61dd('0x58'));exports[_0x61dd('0x59')]=function(_0x645dee,_0x560046,_0x4df4e9){var _0x352118={'agent':{},'channel':_0x61dd('0x5a')};if(_0x645dee[_0x61dd('0x56')]['id']){delete _0x645dee[_0x61dd('0x56')]['id'];}_0x645dee[_0x61dd('0x56')][_0x61dd('0x5b')]=!![];_0x645dee[_0x61dd('0x56')]['readAt']=moment()[_0x61dd('0x5c')](_0x61dd('0x5d'));_0x645dee[_0x61dd('0x56')]['UserId']=_0x645dee['body'][_0x61dd('0x5e')]||_0x645dee[_0x61dd('0x5f')]['id'];_0x352118[_0x61dd('0x60')]['id']=_0x645dee[_0x61dd('0x56')][_0x61dd('0x5e')];return db[_0x61dd('0x3c')][_0x61dd('0x54')]({'where':{'id':_0x645dee[_0x61dd('0x53')]['id'],'UserId':null}})[_0x61dd('0x35')](handleEntityNotFound(_0x560046,null))[_0x61dd('0x35')](saveUpdates(_0x645dee[_0x61dd('0x56')],null))['then'](function(_0x573012){if(_0x573012){_0x352118[_0x61dd('0x24')]=_0x573012[_0x61dd('0x61')]({'plain':!![]});return db[_0x61dd('0x62')][_0x61dd('0x54')]({'where':{'id':_0x573012[_0x61dd('0x63')]}});}return null;})[_0x61dd('0x35')](handleEntityNotFound(_0x560046,null))[_0x61dd('0x35')](function(_0x5312bb){if(_0x5312bb){return _0x5312bb['update']({'UserId':_0x645dee[_0x61dd('0x56')][_0x61dd('0x5e')],'read1stAt':_[_0x61dd('0x64')](_0x5312bb['read1stAt'])?moment()[_0x61dd('0x5c')](_0x61dd('0x5d')):undefined});}return null;})[_0x61dd('0x35')](function(_0x1c8d2e){if(_0x1c8d2e){_0x352118[_0x61dd('0x65')]=_0x1c8d2e[_0x61dd('0x61')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x645dee[_0x61dd('0x5f')]['id'],_0x645dee['user'][_0x61dd('0x38')],_0x645dee[_0x61dd('0x5f')]['role'],_0x352118[_0x61dd('0x65')]['id'],_0x645dee[_0x61dd('0x56')]?JSON['stringify'](_0x645dee['body']):'null');return respondWithRpcPromise(_0x61dd('0x66'),_0x61dd('0x67'),_0x352118);}return null;})['then'](function(_0x333a01){var _0x24199c=_0x61dd('0x68')+_0x333a01['message'][_0x61dd('0x69')];return db['sequelize']['query'](_0x24199c,{'type':db[_0x61dd('0x6a')][_0x61dd('0x6b')]['SELECT'],'raw':!![]})[_0x61dd('0x35')](function(_0x9235fc){return _0x9235fc;});})['then'](function(_0x4dcecc){if(_0x4dcecc){_0x352118[_0x61dd('0x24')][_0x61dd('0x6c')]=_0x4dcecc[0x0];if(!_0x645dee['body'][_0x61dd('0x5e')])return;return db['User']['find']({'where':{'id':_0x645dee[_0x61dd('0x56')][_0x61dd('0x5e')],'role':_0x61dd('0x60')},'attributes':['id',_0x61dd('0x38'),_0x61dd('0x6d'),_0x61dd('0x6e'),_0x61dd('0x6f')],'raw':!![]});}return null;})[_0x61dd('0x35')](function(_0x42355f){if(!_0x42355f)return null;_0x352118['message'][_0x61dd('0x60')]=_0x42355f;return _0x352118;})['then'](function(_0x37dfb8){if(_0x37dfb8){if(_0x645dee[_0x61dd('0x56')][_0x61dd('0x70')]){_0x352118[_0x61dd('0x24')][_0x61dd('0x71')]=util[_0x61dd('0x5c')]('SIP/%s',_0x645dee[_0x61dd('0x5f')][_0x61dd('0x38')]);_0x352118[_0x61dd('0x24')][_0x61dd('0x72')]=_0x352118[_0x61dd('0x72')];_0x352118['message'][_0x61dd('0x73')]=_0x352118[_0x61dd('0x72')];_0x352118[_0x61dd('0x24')]['event']=_0x61dd('0x59');return respondWithRpcPromise(_0x61dd('0x74'),_0x61dd('0x74'),{'event':_0x61dd('0x75'),'message':_0x352118[_0x61dd('0x24')]},client9002)['then'](function(){return _0x352118;});}return _0x352118;}return null;})[_0x61dd('0x35')](respondWithResult(_0x560046,null))['catch'](handleError(_0x560046,null));};var interaction_log=require(_0x61dd('0x14'))(_0x61dd('0x58'));exports[_0x61dd('0x31')]=function(_0x5a7f30,_0x5d2b74,_0x2cc9a5){var _0x5b60b7={'agent':{},'channel':'whatsapp'};if(_0x5a7f30[_0x61dd('0x56')]['id']){delete _0x5a7f30[_0x61dd('0x56')]['id'];}_0x5a7f30[_0x61dd('0x56')][_0x61dd('0x5e')]=_0x5a7f30[_0x61dd('0x56')]['UserId']||_0x5a7f30[_0x61dd('0x5f')]['id'];_0x5b60b7[_0x61dd('0x60')]['id']=_0x5a7f30[_0x61dd('0x56')][_0x61dd('0x5e')];return db[_0x61dd('0x3c')][_0x61dd('0x54')]({'where':{'id':_0x5a7f30[_0x61dd('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d2b74,null))[_0x61dd('0x35')](function(_0x2ba02f){if(_0x2ba02f){_0x5b60b7[_0x61dd('0x24')]=_0x2ba02f[_0x61dd('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x61dd('0x54')]({'where':{'id':_0x2ba02f[_0x61dd('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x5d2b74,null))[_0x61dd('0x35')](function(_0x337e11){if(_0x337e11){_0x5b60b7[_0x61dd('0x65')]=_0x337e11[_0x61dd('0x61')]({'plain':!![]});interaction_log[_0x61dd('0x1d')](_0x61dd('0x76'),_0x5a7f30[_0x61dd('0x5f')]['id'],_0x5a7f30[_0x61dd('0x5f')][_0x61dd('0x38')],_0x5a7f30[_0x61dd('0x5f')]['role'],_0x5b60b7['interaction']['id'],_0x5a7f30['body']?JSON['stringify'](_0x5a7f30[_0x61dd('0x56')]):'null');return respondWithRpcPromise(_0x61dd('0x77'),_0x61dd('0x78'),_0x5b60b7);}return null;})[_0x61dd('0x35')](function(_0x2390e4){var _0x2fbc65='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2390e4[_0x61dd('0x24')][_0x61dd('0x69')];return db[_0x61dd('0x79')][_0x61dd('0x43')](_0x2fbc65,{'type':db[_0x61dd('0x6a')][_0x61dd('0x6b')][_0x61dd('0x7a')],'raw':!![]})['then'](function(_0x25d4e4){return _0x25d4e4;});})[_0x61dd('0x35')](function(_0x81b387){if(_0x81b387){_0x5b60b7[_0x61dd('0x24')]['contact']=_0x81b387[0x0];if(!_0x5a7f30['body'][_0x61dd('0x5e')])return;return db[_0x61dd('0x7b')][_0x61dd('0x54')]({'where':{'id':_0x5a7f30['body']['UserId'],'role':_0x61dd('0x60')},'attributes':['id',_0x61dd('0x38'),_0x61dd('0x6d'),'email','internal'],'raw':!![]});}return null;})[_0x61dd('0x35')](function(_0x2b7a58){if(!_0x2b7a58)return null;_0x5b60b7[_0x61dd('0x24')]['agent']=_0x2b7a58;return _0x5b60b7;})['then'](function(_0x2fe642){if(_0x2fe642){_0x2fe642[_0x61dd('0x24')][_0x61dd('0x71')]=util[_0x61dd('0x5c')]('SIP/%s',_0x5a7f30[_0x61dd('0x5f')]['name']);_0x2fe642[_0x61dd('0x24')][_0x61dd('0x72')]=_0x5b60b7[_0x61dd('0x72')];_0x2fe642[_0x61dd('0x24')]['motionChannel']=_0x5b60b7['channel'];_0x2fe642[_0x61dd('0x24')][_0x61dd('0x7c')]=_0x61dd('0x31');respondWithRpcPromise(_0x61dd('0x74'),_0x61dd('0x74'),{'event':'rejectmessage','message':_0x2fe642[_0x61dd('0x24')]},client9002);return _0x5b60b7;}return null;})[_0x61dd('0x35')](respondWithResult(_0x5d2b74,null))[_0x61dd('0x26')](handleError(_0x5d2b74,null));};exports[_0x61dd('0x27')]=function(_0x147feb,_0x5e872e,_0xce5941){if(_0x147feb[_0x61dd('0x56')]['id']){delete _0x147feb[_0x61dd('0x56')]['id'];}var _0x1dc396;return db[_0x61dd('0x3c')]['find']({'where':{'id':_0x147feb[_0x61dd('0x53')]['id']}})[_0x61dd('0x35')](handleEntityNotFound(_0x5e872e,null))[_0x61dd('0x35')](function(_0x201056){if(_0x201056){_0x1dc396=_0x201056;return db[_0x61dd('0x7d')][_0x61dd('0x54')]({'where':{'id':_0x201056[_0x61dd('0x7e')]}});}})[_0x61dd('0x35')](handleEntityNotFound(_0x5e872e,null))[_0x61dd('0x35')](function(_0x864fc9){if(_0x864fc9){logger[_0x61dd('0x20')](_0x61dd('0x7f'),_0x61dd('0x27'),'received\x20delivery\x20report\x20from',_0x864fc9[_0x61dd('0x3f')],util[_0x61dd('0x80')](_0x147feb['body'],{'showHidden':![],'depth':null}));switch(_0x864fc9['type']){case _0x61dd('0x81'):if(_0x147feb[_0x61dd('0x56')][_0x61dd('0x82')]&&_0x147feb[_0x61dd('0x56')][_0x61dd('0x82')]===_0x1dc396['messageId']&&_0x147feb['body'][_0x61dd('0x83')]&&_0x147feb['body'][_0x61dd('0x83')]===_0x61dd('0x5b')){return _0x1dc396[_0x61dd('0x33')]({'read':!![]});}else{logger['error'](_0x61dd('0x84'),'status',_0x61dd('0x81'),util['inspect'](_0x147feb[_0x61dd('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x1dc396;}})[_0x61dd('0x35')](respondWithResult(_0x5e872e,null))[_0x61dd('0x26')](handleError(_0x5e872e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2a1b33c..284bc55 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 _0x6e6c=['../../mysqldb','setMaxListeners','save','emit','hook','exports','events'];(function(_0x5d728a,_0x241ba5){var _0x1ebb5c=function(_0x4615d0){while(--_0x4615d0){_0x5d728a['push'](_0x5d728a['shift']());}};_0x1ebb5c(++_0x241ba5);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xc6e6('0x0'));var WhatsappMessage=require(_0xc6e6('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc6e6('0x2')](0x0);var events={'afterCreate':_0xc6e6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e97f5){return function(_0x5a9e2b,_0x40b7e1,_0x4b13f0){WhatsappMessageEvents[_0xc6e6('0x4')](_0x2e97f5+':'+_0x5a9e2b['id'],_0x5a9e2b);WhatsappMessageEvents[_0xc6e6('0x4')](_0x2e97f5,_0x5a9e2b);_0x4b13f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xc6e6('0x5')](e,emitEvent(event));}}module[_0xc6e6('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x41bb=['../../mysqldb','setMaxListeners','update','remove','emit','events'];(function(_0x834b0b,_0xa3b2fb){var _0x4f840d=function(_0x3c8862){while(--_0x3c8862){_0x834b0b['push'](_0x834b0b['shift']());}};_0x4f840d(++_0xa3b2fb);}(_0x41bb,0xc5));var _0xb41b=function(_0x2f38fb,_0x27d85e){_0x2f38fb=_0x2f38fb-0x0;var _0x149d1f=_0x41bb[_0x2f38fb];return _0x149d1f;};'use strict';var EventEmitter=require(_0xb41b('0x0'));var WhatsappMessage=require(_0xb41b('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb41b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb41b('0x3'),'afterDestroy':_0xb41b('0x4')};function emitEvent(_0x148333){return function(_0x448c8e,_0x4ee21b,_0x12cea3){WhatsappMessageEvents[_0xb41b('0x5')](_0x148333+':'+_0x448c8e['id'],_0x448c8e);WhatsappMessageEvents[_0xb41b('0x5')](_0x148333,_0x448c8e);_0x12cea3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](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 96dda50..d221427 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 _0x0233=['sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','accountSid','baseUrl','/messages/','text','POST','Bearer\x20','then','statuses','message_id','update','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','toLowerCase','direction','out','secret','isNil','UserId','findOne','createdAt','catch','error','find','WhatsappAccountId','type','twilio','phone','authToken','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token'];(function(_0x1f2cba,_0x32c613){var _0x5bfbcb=function(_0x3d14fa){while(--_0x3d14fa){_0x1f2cba['push'](_0x1f2cba['shift']());}};_0x5bfbcb(++_0x32c613);}(_0x0233,0x1b0));var _0x3023=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x0233[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x3023('0x0'));var util=require(_0x3023('0x1'));var logger=require(_0x3023('0x2'))(_0x3023('0x3'));var moment=require(_0x3023('0x4'));var BPromise=require('bluebird');var rp=require(_0x3023('0x5'));var fetch=require(_0x3023('0x6'));var fs=require('fs');var path=require(_0x3023('0x7'));var rimraf=require(_0x3023('0x8'));var config=require('../../config/environment');var attributes=require(_0x3023('0x9'));module[_0x3023('0xa')]=function(_0x19ec57,_0x4623ea){return _0x19ec57[_0x3023('0xb')](_0x3023('0xc'),attributes,{'tableName':_0x3023('0xd'),'paranoid':![],'indexes':[{'name':_0x3023('0xe'),'fields':['messageId']},{'name':_0x3023('0xf'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa78079,_0x1452ce,_0x16b0a1){var _0xb57882=_0x19ec57['models'];var _0x13dc3f=_0xa78079['get']({'plain':!![]});if(_0x13dc3f['direction'][_0x3023('0x10')]()==='in'||_0x13dc3f[_0x3023('0x11')][_0x3023('0x10')]()===_0x3023('0x12')&&!_0x13dc3f[_0x3023('0x13')]&&!_[_0x3023('0x14')](_0x13dc3f[_0x3023('0x15')])){_0xb57882['WhatsappInteraction'][_0x3023('0x16')]({'where':{'id':_0x13dc3f['WhatsappInteractionId']}})['then'](function(_0xf7934d){if(_0xf7934d){_0xf7934d['update']({'lastMsgAt':_0x13dc3f[_0x3023('0x17')],'lastMsgDirection':_0x13dc3f[_0x3023('0x11')][_0x3023('0x10')]()});}})[_0x3023('0x18')](function(_0x19fbdf){console[_0x3023('0x19')](_0x19fbdf);});}if(_0x13dc3f[_0x3023('0x11')]===_0x3023('0x12')&&!_0x13dc3f['secret']){var _0x3dfa3a;_0xb57882['WhatsappAccount'][_0x3023('0x1a')]({'where':{'id':_0x13dc3f[_0x3023('0x1b')]},'raw':!![]})['then'](function(_0x3cbde7){_0x3dfa3a=_0x3cbde7;if(_0x3dfa3a&&_0x3dfa3a[_0x3023('0x1c')]){switch(_0x3dfa3a['type']){case _0x3023('0x1d'):var _0xab05d8=require(_0x3023('0x1d'));if(_0x3dfa3a['accountSid']&&_0x3dfa3a['authToken']&&_0x3dfa3a[_0x3023('0x1e')]){var _0x2857d6=new _0xab05d8(_0x3dfa3a['accountSid'],_0x3dfa3a[_0x3023('0x1f')]);_0x2857d6[_0x3023('0x20')][_0x3023('0x21')]({'body':_0x13dc3f[_0x3023('0x22')],'to':_0x3023('0x23')+_0x13dc3f['phone'],'from':'whatsapp:'+_0x3dfa3a[_0x3023('0x1e')],'statusCallback':_0x3dfa3a[_0x3023('0x24')]+_0x3023('0x25')+_0x13dc3f['id']+_0x3023('0x26')+_0x3dfa3a[_0x3023('0x27')]})['then'](function(_0x1b5e73){if(_0x1b5e73[_0x3023('0x28')]){return _0xa78079['update']({'messageId':_0x1b5e73['sid']});}})[_0x3023('0x18')](function(_0x4a720c){logger[_0x3023('0x19')](_0x3023('0x29'),_0x3023('0x2a'),_0x3023('0x1d'),util['inspect'](_0x4a720c,{'showHidden':![],'depth':null}));});}else{logger[_0x3023('0x19')](_0x3023('0x29'),_0x3023('0x2a'),'twilio',_0x3023('0x2b'));}break;case _0x3023('0x2c'):var _0x4817b8=_0x3dfa3a[_0x3023('0x2d')];var _0x186aed=_0x3dfa3a[_0x3023('0x1f')];var _0x2cf3fa=_0x3dfa3a[_0x3023('0x2e')]+'/whatsapp/v1/'+_0x4817b8+_0x3023('0x2f');var _0x549026={'to':[_0x13dc3f['phone']],'message':{'type':_0x3023('0x30'),'text':_0x13dc3f[_0x3023('0x22')]}};var _0x185d04={'method':_0x3023('0x31'),'uri':_0x2cf3fa,'headers':{'Authorization':_0x3023('0x32')+_0x186aed,'Content-Type':'application/json'},'body':_0x549026,'json':!![]};rp(_0x185d04)[_0x3023('0x33')](function(_0x16e5f3){if(_0x16e5f3[_0x3023('0x34')][0x0][_0x3023('0x35')]){return _0xa78079[_0x3023('0x36')]({'messageId':_0x16e5f3['statuses'][0x0][_0x3023('0x35')]});}})[_0x3023('0x18')](function(_0x1d50d0){logger[_0x3023('0x37')](_0x3023('0x38'),_0x1d50d0);});break;}}})[_0x3023('0x39')](function(){_0x16b0a1();});}else{_0x16b0a1();}}},'charset':'utf8mb4','collate':_0x3023('0x3a')});}; \ No newline at end of file +var _0x0141=['WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','sid','afterCreate','/whatsapp/v1/','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error'];(function(_0x39fc53,_0x15191d){var _0x58374d=function(_0x3e36bb){while(--_0x3e36bb){_0x39fc53['push'](_0x39fc53['shift']());}};_0x58374d(++_0x15191d);}(_0x0141,0xbe));var _0x1014=function(_0x699855,_0x52878c){_0x699855=_0x699855-0x0;var _0x1e34c5=_0x0141[_0x699855];return _0x1e34c5;};'use strict';var _=require('lodash');var util=require(_0x1014('0x0'));var logger=require('../../config/logger')(_0x1014('0x1'));var moment=require(_0x1014('0x2'));var BPromise=require('bluebird');var rp=require(_0x1014('0x3'));var fetch=require(_0x1014('0x4'));var fs=require('fs');var path=require(_0x1014('0x5'));var rimraf=require(_0x1014('0x6'));var config=require(_0x1014('0x7'));var attributes=require(_0x1014('0x8'));module['exports']=function(_0x17a985,_0x4bee95){return _0x17a985[_0x1014('0x9')](_0x1014('0xa'),attributes,{'tableName':_0x1014('0xb'),'paranoid':![],'indexes':[{'name':_0x1014('0xc'),'fields':[_0x1014('0xc')]},{'name':_0x1014('0xd'),'fields':[_0x1014('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d1806,_0x1dbdf4,_0x40f916){var _0x80521f=_0x17a985[_0x1014('0xf')];var _0x3219cd=_0x1d1806[_0x1014('0x10')]({'plain':!![]});if(_0x3219cd[_0x1014('0x11')]['toLowerCase']()==='in'||_0x3219cd['direction'][_0x1014('0x12')]()===_0x1014('0x13')&&!_0x3219cd[_0x1014('0x14')]&&!_['isNil'](_0x3219cd[_0x1014('0x15')])){_0x80521f[_0x1014('0x16')][_0x1014('0x17')]({'where':{'id':_0x3219cd[_0x1014('0x18')]}})[_0x1014('0x19')](function(_0x23fb15){if(_0x23fb15){_0x23fb15[_0x1014('0x1a')]({'lastMsgAt':_0x3219cd[_0x1014('0x1b')],'lastMsgDirection':_0x3219cd[_0x1014('0x11')][_0x1014('0x12')]()});}})[_0x1014('0x1c')](function(_0x1a16c2){console[_0x1014('0x1d')](_0x1a16c2);});}if(_0x3219cd[_0x1014('0x11')]===_0x1014('0x13')&&!_0x3219cd[_0x1014('0x14')]){var _0x98ff23;_0x80521f[_0x1014('0x1e')][_0x1014('0x1f')]({'where':{'id':_0x3219cd[_0x1014('0x20')]},'raw':!![]})['then'](function(_0x2cd3dc){_0x98ff23=_0x2cd3dc;if(_0x98ff23&&_0x98ff23['type']){switch(_0x98ff23[_0x1014('0x21')]){case _0x1014('0x22'):var _0x3fda3e=require(_0x1014('0x22'));if(_0x98ff23[_0x1014('0x23')]&&_0x98ff23[_0x1014('0x24')]&&_0x98ff23[_0x1014('0x25')]){var _0x3c1432=new _0x3fda3e(_0x98ff23[_0x1014('0x23')],_0x98ff23[_0x1014('0x24')]);_0x3c1432[_0x1014('0x26')][_0x1014('0x27')]({'body':_0x3219cd[_0x1014('0xe')],'to':'whatsapp:'+_0x3219cd[_0x1014('0x25')],'from':_0x1014('0x28')+_0x98ff23['phone'],'statusCallback':_0x98ff23[_0x1014('0x29')]+'/api/whatsapp/messages/'+_0x3219cd['id']+_0x1014('0x2a')+_0x98ff23['token']})[_0x1014('0x19')](function(_0x21913d){if(_0x21913d[_0x1014('0x2b')]){return _0x1d1806[_0x1014('0x1a')]({'messageId':_0x21913d[_0x1014('0x2b')]});}})[_0x1014('0x1c')](function(_0x59c06f){logger[_0x1014('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1014('0x2c'),_0x1014('0x22'),util['inspect'](_0x59c06f,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1014('0x2c'),_0x1014('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x450fb0=_0x98ff23[_0x1014('0x23')];var _0x1c2403=_0x98ff23['authToken'];var _0x2d0eaa=_0x98ff23['baseUrl']+_0x1014('0x2d')+_0x450fb0+'/messages/';var _0x1e8c5b={'to':[_0x3219cd[_0x1014('0x25')]],'message':{'type':'text','text':_0x3219cd[_0x1014('0xe')]}};var _0x43e76c={'method':'POST','uri':_0x2d0eaa,'headers':{'Authorization':_0x1014('0x2e')+_0x1c2403,'Content-Type':_0x1014('0x2f')},'body':_0x1e8c5b,'json':!![]};rp(_0x43e76c)[_0x1014('0x19')](function(_0x36ac3c){if(_0x36ac3c[_0x1014('0x30')][0x0][_0x1014('0x31')]){return _0x1d1806['update']({'messageId':_0x36ac3c['statuses'][0x0][_0x1014('0x31')]});}})['catch'](function(_0xec488b){logger[_0x1014('0x32')](_0x1014('0x33'),_0xec488b);});break;}}})[_0x1014('0x34')](function(){_0x40f916();});}else{_0x40f916();}}},'charset':_0x1014('0x35'),'collate':_0x1014('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index efa79cb..8667daa 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 _0x62a6=['localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','CreateWhatsappMessage','WhatsappMessage','create','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','redis','defaults'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x62a6,0x12a));var _0x662a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x62a6[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x662a('0x0'));var util=require(_0x662a('0x1'));var moment=require(_0x662a('0x2'));var BPromise=require(_0x662a('0x3'));var rs=require(_0x662a('0x4'));var fs=require('fs');var Redis=require(_0x662a('0x5'));var db=require(_0x662a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x662a('0x7'))(_0x662a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x662a('0x9')]({'port':0x232a});config[_0x662a('0xa')]=_[_0x662a('0xb')](config[_0x662a('0xa')],{'host':_0x662a('0xc'),'port':0x18eb});var socket=require(_0x662a('0xd'))(new Redis(config[_0x662a('0xa')]));require(_0x662a('0xe'))[_0x662a('0xf')](socket);function respondWithRpcPromise(_0x574f50,_0x3db5c6,_0x541919){return new BPromise(function(_0x37b17c,_0x42b2c6){return client[_0x662a('0x10')](_0x574f50,_0x541919)[_0x662a('0x11')](function(_0x52f206){logger['info'](_0x662a('0x12'),_0x3db5c6,_0x662a('0x13'));logger['debug'](_0x662a('0x14'),_0x3db5c6,_0x662a('0x13'),JSON[_0x662a('0x15')](_0x52f206));if(_0x52f206[_0x662a('0x16')]){if(_0x52f206[_0x662a('0x16')]['code']===0x1f4){logger['error'](_0x662a('0x12'),_0x3db5c6,_0x52f206[_0x662a('0x16')][_0x662a('0x17')]);return _0x42b2c6(_0x52f206['error']['message']);}logger['error'](_0x662a('0x12'),_0x3db5c6,_0x52f206[_0x662a('0x16')][_0x662a('0x17')]);return _0x37b17c(_0x52f206[_0x662a('0x16')][_0x662a('0x17')]);}else{logger[_0x662a('0x18')](_0x662a('0x12'),_0x3db5c6,_0x662a('0x13'));_0x37b17c(_0x52f206['result'][_0x662a('0x17')]);}})[_0x662a('0x19')](function(_0x83ec1c){logger[_0x662a('0x16')](_0x662a('0x12'),_0x3db5c6,_0x83ec1c);_0x42b2c6(_0x83ec1c);});});}exports[_0x662a('0x1a')]=function(_0x542eb6){var _0x281aba=this;return new Promise(function(_0x1bf79f,_0x55575a){return db[_0x662a('0x1b')][_0x662a('0x1c')](_0x542eb6['body'],{'raw':_0x542eb6[_0x662a('0x1d')]?_0x542eb6[_0x662a('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x662a('0x11')](function(_0x24e92f){logger[_0x662a('0x18')](_0x662a('0x1a'),_0x542eb6);logger[_0x662a('0x1e')](_0x662a('0x1a'),_0x542eb6,JSON['stringify'](_0x24e92f));_0x1bf79f(_0x24e92f);})[_0x662a('0x19')](function(_0x1c687a){logger[_0x662a('0x16')](_0x662a('0x1a'),_0x1c687a[_0x662a('0x17')],_0x542eb6);_0x55575a(_0x281aba['error'](0x1f4,_0x1c687a[_0x662a('0x17')]));});});}; \ No newline at end of file +var _0x274c=['http','redis','defaults','localhost','socket.io-emitter','./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','create','body','options','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x274c,0x1bc));var _0xc274=function(_0x127c7b,_0x1f65e7){_0x127c7b=_0x127c7b-0x0;var _0x1708eb=_0x274c[_0x127c7b];return _0x1708eb;};'use strict';var _=require(_0xc274('0x0'));var util=require(_0xc274('0x1'));var moment=require(_0xc274('0x2'));var BPromise=require(_0xc274('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc274('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc274('0x5'));var logger=require(_0xc274('0x6'))(_0xc274('0x7'));var config=require(_0xc274('0x8'));var jayson=require(_0xc274('0x9'));var client=jayson[_0xc274('0xa')][_0xc274('0xb')]({'port':0x232a});config[_0xc274('0xc')]=_[_0xc274('0xd')](config[_0xc274('0xc')],{'host':_0xc274('0xe'),'port':0x18eb});var socket=require(_0xc274('0xf'))(new Redis(config['redis']));require(_0xc274('0x10'))[_0xc274('0x11')](socket);function respondWithRpcPromise(_0x5456b4,_0xda58b4,_0x18bdad){return new BPromise(function(_0x1e7dd4,_0x309c9b){return client[_0xc274('0x12')](_0x5456b4,_0x18bdad)[_0xc274('0x13')](function(_0x371f3d){logger[_0xc274('0x14')](_0xc274('0x15'),_0xda58b4,_0xc274('0x16'));logger[_0xc274('0x17')](_0xc274('0x18'),_0xda58b4,'request\x20sent',JSON[_0xc274('0x19')](_0x371f3d));if(_0x371f3d[_0xc274('0x1a')]){if(_0x371f3d[_0xc274('0x1a')][_0xc274('0x1b')]===0x1f4){logger['error'](_0xc274('0x15'),_0xda58b4,_0x371f3d[_0xc274('0x1a')][_0xc274('0x1c')]);return _0x309c9b(_0x371f3d[_0xc274('0x1a')][_0xc274('0x1c')]);}logger[_0xc274('0x1a')](_0xc274('0x15'),_0xda58b4,_0x371f3d[_0xc274('0x1a')][_0xc274('0x1c')]);return _0x1e7dd4(_0x371f3d[_0xc274('0x1a')][_0xc274('0x1c')]);}else{logger[_0xc274('0x14')](_0xc274('0x15'),_0xda58b4,_0xc274('0x16'));_0x1e7dd4(_0x371f3d[_0xc274('0x1d')][_0xc274('0x1c')]);}})[_0xc274('0x1e')](function(_0x4933fc){logger[_0xc274('0x1a')](_0xc274('0x15'),_0xda58b4,_0x4933fc);_0x309c9b(_0x4933fc);});});}exports[_0xc274('0x1f')]=function(_0x5ba9c5){var _0x92f201=this;return new Promise(function(_0x4659c3,_0x6b7204){return db['WhatsappMessage'][_0xc274('0x20')](_0x5ba9c5[_0xc274('0x21')],{'raw':_0x5ba9c5[_0xc274('0x22')]?_0x5ba9c5[_0xc274('0x22')]['raw']===undefined?!![]:![]:!![]})[_0xc274('0x13')](function(_0x2f94ae){logger[_0xc274('0x14')](_0xc274('0x1f'),_0x5ba9c5);logger[_0xc274('0x17')]('CreateWhatsappMessage',_0x5ba9c5,JSON[_0xc274('0x19')](_0x2f94ae));_0x4659c3(_0x2f94ae);})[_0xc274('0x1e')](function(_0x14c0b2){logger[_0xc274('0x1a')](_0xc274('0x1f'),_0x14c0b2['message'],_0x5ba9c5);_0x6b7204(_0x92f201[_0xc274('0x1a')](0x1f4,_0x14c0b2[_0xc274('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index c3e6586..c123f83 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 _0x9128=['./whatsappMessage.events','save','emit','register','whatsappMessage:'];(function(_0x525264,_0x4eafd3){var _0x550ed1=function(_0x418644){while(--_0x418644){_0x525264['push'](_0x525264['shift']());}};_0x550ed1(++_0x4eafd3);}(_0x9128,0x1bd));var _0x8912=function(_0x234577,_0x3b9004){_0x234577=_0x234577-0x0;var _0x28fea6=_0x9128[_0x234577];return _0x28fea6;};'use strict';var WhatsappMessageEvents=require(_0x8912('0x0'));var events=[_0x8912('0x1'),'remove','update'];function createListener(_0x10db42,_0x380de8){return function(_0x333777){_0x380de8[_0x8912('0x2')](_0x10db42,_0x333777);};}function removeListener(_0x81e07d,_0x380f17){return function(){WhatsappMessageEvents['removeListener'](_0x81e07d,_0x380f17);};}exports[_0x8912('0x3')]=function(_0x33710c){for(var _0x26d828=0x0,_0x596aba=events['length'];_0x26d828<_0x596aba;_0x26d828++){var _0x4fcec8=events[_0x26d828];var _0x1cb6d6=createListener(_0x8912('0x4')+_0x4fcec8,_0x33710c);WhatsappMessageEvents['on'](_0x4fcec8,_0x1cb6d6);}}; \ No newline at end of file +var _0x1836=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x1f355e,_0x2dadaa){var _0x31b208=function(_0x6148cf){while(--_0x6148cf){_0x1f355e['push'](_0x1f355e['shift']());}};_0x31b208(++_0x2dadaa);}(_0x1836,0x16b));var _0x6183=function(_0x244c99,_0x55ce1c){_0x244c99=_0x244c99-0x0;var _0xee1b47=_0x1836[_0x244c99];return _0xee1b47;};'use strict';var WhatsappMessageEvents=require(_0x6183('0x0'));var events=[_0x6183('0x1'),_0x6183('0x2'),_0x6183('0x3')];function createListener(_0x551b84,_0x14423f){return function(_0x976f7){_0x14423f[_0x6183('0x4')](_0x551b84,_0x976f7);};}function removeListener(_0x441c04,_0x21c0ab){return function(){WhatsappMessageEvents['removeListener'](_0x441c04,_0x21c0ab);};}exports[_0x6183('0x5')]=function(_0x440a24){for(var _0x3565a6=0x0,_0x5bf2f9=events[_0x6183('0x6')];_0x3565a6<_0x5bf2f9;_0x3565a6++){var _0x22cecd=events[_0x3565a6];var _0x1170e7=createListener(_0x6183('0x7')+_0x22cecd,_0x440a24);WhatsappMessageEvents['on'](_0x22cecd,_0x1170e7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a1b1e00..6f4242a 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 _0xf9fd=['/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3b21f7,_0x278ae8){var _0x39b0da=function(_0x206036){while(--_0x206036){_0x3b21f7['push'](_0x3b21f7['shift']());}};_0x39b0da(++_0x278ae8);}(_0xf9fd,0x131));var _0xdf9f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9fd[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var path=require(_0xdf9f('0x2'));var timeout=require(_0xdf9f('0x3'));var express=require(_0xdf9f('0x4'));var router=express[_0xdf9f('0x5')]();var fs_extra=require(_0xdf9f('0x6'));var auth=require(_0xdf9f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdf9f('0x8'));var controller=require(_0xdf9f('0x9'));router[_0xdf9f('0xa')]('/',auth[_0xdf9f('0xb')](),controller[_0xdf9f('0xc')]);router['get'](_0xdf9f('0xd'),auth[_0xdf9f('0xb')](),controller[_0xdf9f('0xe')]);router[_0xdf9f('0xa')]('/:id',auth[_0xdf9f('0xb')](),controller['show']);router['get'](_0xdf9f('0xf'),auth[_0xdf9f('0xb')](),controller[_0xdf9f('0x10')]);router[_0xdf9f('0xa')](_0xdf9f('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xdf9f('0xa')](_0xdf9f('0x12'),auth['isAuthenticated'](),controller[_0xdf9f('0x13')]);router[_0xdf9f('0x14')]('/',auth[_0xdf9f('0xb')](),controller[_0xdf9f('0x15')]);router[_0xdf9f('0x14')](_0xdf9f('0x11'),auth[_0xdf9f('0xb')](),controller[_0xdf9f('0x16')]);router[_0xdf9f('0x14')]('/:id/users',auth[_0xdf9f('0xb')](),controller[_0xdf9f('0x17')]);router[_0xdf9f('0x18')](_0xdf9f('0x19'),auth['isAuthenticated'](),controller[_0xdf9f('0x1a')]);router[_0xdf9f('0x1b')](_0xdf9f('0x19'),auth[_0xdf9f('0xb')](),controller[_0xdf9f('0x1c')]);router[_0xdf9f('0x1b')](_0xdf9f('0x11'),auth[_0xdf9f('0xb')](),controller[_0xdf9f('0x1d')]);router[_0xdf9f('0x1b')](_0xdf9f('0x12'),auth[_0xdf9f('0xb')](),controller[_0xdf9f('0x1e')]);module[_0xdf9f('0x1f')]=router; \ No newline at end of file +var _0xc7da=['../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x103a02,_0x92770b){var _0x4aa466=function(_0x56fa40){while(--_0x56fa40){_0x103a02['push'](_0x103a02['shift']());}};_0x4aa466(++_0x92770b);}(_0xc7da,0x16c));var _0xac7d=function(_0x350dd9,_0x865c9e){_0x350dd9=_0x350dd9-0x0;var _0x1db3bd=_0xc7da[_0x350dd9];return _0x1db3bd;};'use strict';var multer=require(_0xac7d('0x0'));var util=require(_0xac7d('0x1'));var path=require(_0xac7d('0x2'));var timeout=require(_0xac7d('0x3'));var express=require(_0xac7d('0x4'));var router=express[_0xac7d('0x5')]();var fs_extra=require(_0xac7d('0x6'));var auth=require(_0xac7d('0x7'));var interaction=require(_0xac7d('0x8'));var config=require(_0xac7d('0x9'));var controller=require(_0xac7d('0xa'));router[_0xac7d('0xb')]('/',auth[_0xac7d('0xc')](),controller[_0xac7d('0xd')]);router[_0xac7d('0xb')](_0xac7d('0xe'),auth[_0xac7d('0xc')](),controller[_0xac7d('0xf')]);router[_0xac7d('0xb')](_0xac7d('0x10'),auth['isAuthenticated'](),controller[_0xac7d('0x11')]);router['get'](_0xac7d('0x12'),auth['isAuthenticated'](),controller['getMembers']);router[_0xac7d('0xb')](_0xac7d('0x13'),auth[_0xac7d('0xc')](),controller['getTeams']);router[_0xac7d('0xb')](_0xac7d('0x14'),auth[_0xac7d('0xc')](),controller[_0xac7d('0x15')]);router[_0xac7d('0x16')]('/',auth[_0xac7d('0xc')](),controller[_0xac7d('0x17')]);router['post'](_0xac7d('0x13'),auth[_0xac7d('0xc')](),controller['addTeams']);router[_0xac7d('0x16')](_0xac7d('0x14'),auth[_0xac7d('0xc')](),controller[_0xac7d('0x18')]);router[_0xac7d('0x19')](_0xac7d('0x10'),auth['isAuthenticated'](),controller[_0xac7d('0x1a')]);router['delete'](_0xac7d('0x10'),auth[_0xac7d('0xc')](),controller[_0xac7d('0x1b')]);router[_0xac7d('0x1c')](_0xac7d('0x13'),auth[_0xac7d('0xc')](),controller[_0xac7d('0x1d')]);router['delete'](_0xac7d('0x14'),auth[_0xac7d('0xc')](),controller[_0xac7d('0x1e')]);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 7fd0b93..b40ec83 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 _0x85b5=['ENUM','roundrobin','sequelize','exports','name'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x85b5,0x7f));var _0x585b=function(_0x13d1b0,_0x21ce77){_0x13d1b0=_0x13d1b0-0x0;var _0x3c8971=_0x85b5[_0x13d1b0];return _0x3c8971;};'use strict';var Sequelize=require(_0x585b('0x0'));module[_0x585b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x585b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x585b('0x3')]('rrmemory','beepall',_0x585b('0x4'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1306=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x479b99,_0x1e5bec){var _0x1e7eb7=function(_0x52ac6c){while(--_0x52ac6c){_0x479b99['push'](_0x479b99['shift']());}};_0x1e7eb7(++_0x1e5bec);}(_0x1306,0x17a));var _0x6130=function(_0x544bda,_0x1fb75c){_0x544bda=_0x544bda-0x0;var _0x2ae1af=_0x1306[_0x544bda];return _0x2ae1af;};'use strict';var Sequelize=require(_0x6130('0x0'));module[_0x6130('0x1')]={'name':{'type':Sequelize[_0x6130('0x2')],'unique':_0x6130('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6130('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6130('0x5')](_0x6130('0x6'),_0x6130('0x7'),_0x6130('0x8'))},'description':{'type':Sequelize[_0x6130('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8141230..be660cc 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 _0xc7dd=['squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','json','offset','undefined','limit','count','status','set','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','name','send','index','map','WhatsappQueue','fieldName','type','key','getOptions','include','findAll','rows','catch','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','options','create','body','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','where','WhatsappQueueId','filter','merge','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','%s/%s','SIP','createdAt','Team','order','sort','pick','getTeams','nolimit','addTeams','ids','Agents','online','flatMap','transaction','forEach','emit','userWhatsappQueue:save','select','field','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util'];(function(_0x3bf02b,_0x5762ac){var _0xa6f349=function(_0x3e14eb){while(--_0x3e14eb){_0x3bf02b['push'](_0x3bf02b['shift']());}};_0xa6f349(++_0x5762ac);}(_0xc7dd,0x1e6));var _0xdc7d=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0xc7dd[_0x5ce3c8];return _0xa76867;};'use strict';var BPromise=require(_0xdc7d('0x0'));var util=require(_0xdc7d('0x1'));var _=require('lodash');var squel=require(_0xdc7d('0x2'));var Redis=require(_0xdc7d('0x3'));var qs=require(_0xdc7d('0x4'));var logger=require(_0xdc7d('0x5'))(_0xdc7d('0x6'));var config=require(_0xdc7d('0x7'));var db=require(_0xdc7d('0x8'))['db'];config[_0xdc7d('0x9')]=_['defaults'](config[_0xdc7d('0x9')],{'host':_0xdc7d('0xa'),'port':0x18eb});var socket=require(_0xdc7d('0xb'))(new Redis(config[_0xdc7d('0x9')]));require(_0xdc7d('0xc'))['register'](socket);function respondWithStatusCode(_0x3e108f,_0x7a7f7f){_0x7a7f7f=_0x7a7f7f||0xcc;return function(_0x2c3452){if(_0x2c3452){return _0x3e108f[_0xdc7d('0xd')](_0x7a7f7f);}return _0x3e108f['status'](_0x7a7f7f)['end']();};}function respondWithResult(_0x52e2a5,_0x5f1359){_0x5f1359=_0x5f1359||0xc8;return function(_0x393eb1){if(_0x393eb1){return _0x52e2a5['status'](_0x5f1359)[_0xdc7d('0xe')](_0x393eb1);}};}function respondWithFilteredResult(_0x1279fe,_0xc364c5){return function(_0x52cdaa){if(_0x52cdaa){var _0x204d95=typeof _0xc364c5[_0xdc7d('0xf')]===_0xdc7d('0x10')&&typeof _0xc364c5[_0xdc7d('0x11')]===_0xdc7d('0x10');var _0x4f48ae=_0x52cdaa[_0xdc7d('0x12')];var _0x3aea53=_0x204d95?0x0:_0xc364c5[_0xdc7d('0xf')];var _0x40ca9d=_0x204d95?_0x52cdaa[_0xdc7d('0x12')]:_0xc364c5[_0xdc7d('0xf')]+_0xc364c5[_0xdc7d('0x11')];var _0x5f08e4;if(_0x40ca9d>=_0x4f48ae){_0x40ca9d=_0x4f48ae;_0x5f08e4=0xc8;}else{_0x5f08e4=0xce;}_0x1279fe[_0xdc7d('0x13')](_0x5f08e4);return _0x1279fe[_0xdc7d('0x14')]('Content-Range',_0x3aea53+'-'+_0x40ca9d+'/'+_0x4f48ae)[_0xdc7d('0xe')](_0x52cdaa);}return null;};}function saveUpdates(_0x47b541){return function(_0x7666d5){if(_0x7666d5){return _0x7666d5[_0xdc7d('0x15')](_0x47b541)[_0xdc7d('0x16')](function(_0x3b337a){return _0x3b337a;});}return null;};}function removeEntity(_0x5aca90){return function(_0x70742a){if(_0x70742a){return _0x70742a[_0xdc7d('0x17')]()[_0xdc7d('0x16')](function(){var _0x40eeaf=_0x70742a[_0xdc7d('0x18')]({'plain':!![]});var _0x1c163c=_0xdc7d('0x19');return db[_0xdc7d('0x1a')][_0xdc7d('0x17')]({'where':{'type':_0x1c163c,'resourceId':_0x40eeaf['id']}})[_0xdc7d('0x16')](function(){return _0x70742a;});})[_0xdc7d('0x16')](function(){_0x5aca90[_0xdc7d('0x13')](0xcc)[_0xdc7d('0x1b')]();});}};}function handleEntityNotFound(_0x45f928){return function(_0x20a763){if(!_0x20a763){_0x45f928[_0xdc7d('0xd')](0x194);}return _0x20a763;};}function handleError(_0x4470de,_0x33f484){_0x33f484=_0x33f484||0x1f4;return function(_0x5588c2){logger[_0xdc7d('0x1c')](_0x5588c2['stack']);if(_0x5588c2[_0xdc7d('0x1d')]){delete _0x5588c2[_0xdc7d('0x1d')];}_0x4470de['status'](_0x33f484)[_0xdc7d('0x1e')](_0x5588c2);};}exports[_0xdc7d('0x1f')]=function(_0x37e3da,_0x426cd2){var _0x1e8579={};var _0x1c46e1={'count':0x0,'rows':[]};var _0x50f9de=_[_0xdc7d('0x20')](db[_0xdc7d('0x21')]['rawAttributes'],function(_0x1b42b1){return{'name':_0x1b42b1[_0xdc7d('0x22')],'type':_0x1b42b1[_0xdc7d('0x23')][_0xdc7d('0x24')]};});_0x1e8579=qs[_0xdc7d('0x25')](_0x50f9de,_0x37e3da);var _0x5f36b3={'where':_0x1e8579['where']};return db[_0xdc7d('0x21')][_0xdc7d('0x12')](_0x5f36b3)[_0xdc7d('0x16')](function(_0x59bb23){_0x1c46e1[_0xdc7d('0x12')]=_0x59bb23;_0x1e8579['include']=qs[_0xdc7d('0x26')](_0x37e3da['query']);return db[_0xdc7d('0x21')][_0xdc7d('0x27')](_0x1e8579);})[_0xdc7d('0x16')](function(_0x81873b){_0x1c46e1[_0xdc7d('0x28')]=_0x81873b;return _0x1c46e1;})[_0xdc7d('0x16')](respondWithFilteredResult(_0x426cd2,_0x1e8579))[_0xdc7d('0x29')](handleError(_0x426cd2,null));};exports['show']=function(_0x459c54,_0x4dc280){var _0x3af6ef={'raw':!![],'where':{'id':_0x459c54[_0xdc7d('0x2a')]['id']}},_0xdec2c8={};_0xdec2c8[_0xdc7d('0x2b')]=_[_0xdc7d('0x2c')](db[_0xdc7d('0x21')][_0xdc7d('0x2d')]);_0xdec2c8[_0xdc7d('0x2e')]=_[_0xdc7d('0x2c')](_0x459c54[_0xdc7d('0x2e')]);_0xdec2c8[_0xdc7d('0x2f')]=_['intersection'](_0xdec2c8[_0xdc7d('0x2b')],_0xdec2c8['query']);_0x3af6ef[_0xdc7d('0x30')]=_[_0xdc7d('0x31')](_0xdec2c8[_0xdc7d('0x2b')],qs['fields'](_0x459c54['query'][_0xdc7d('0x32')]));_0x3af6ef['attributes']=_0x3af6ef[_0xdc7d('0x30')][_0xdc7d('0x33')]?_0x3af6ef[_0xdc7d('0x30')]:_0xdec2c8[_0xdc7d('0x2b')];if(_0x459c54[_0xdc7d('0x2e')]['includeAll']){_0x3af6ef[_0xdc7d('0x26')]=[{'all':!![]}];}_0x3af6ef=_['merge']({},_0x3af6ef,_0x459c54[_0xdc7d('0x34')]);return db['WhatsappQueue']['find'](_0x3af6ef)[_0xdc7d('0x16')](handleEntityNotFound(_0x4dc280,null))['then'](respondWithResult(_0x4dc280,null))[_0xdc7d('0x29')](handleError(_0x4dc280,null));};exports[_0xdc7d('0x35')]=function(_0x33f5ab,_0x12f38e){return db['WhatsappQueue']['create'](_0x33f5ab[_0xdc7d('0x36')],{})[_0xdc7d('0x16')](function(_0x4b906){var _0xd87240=_0x33f5ab['user']['get']({'plain':!![]});if(!_0xd87240)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd87240[_0xdc7d('0x37')]===_0xdc7d('0x38')){var _0x11153b=_0x4b906[_0xdc7d('0x18')]({'plain':!![]});var _0x7906dd=_0xdc7d('0x19');return db[_0xdc7d('0x39')][_0xdc7d('0x3a')]({'where':{'name':_0x7906dd,'userProfileId':_0xd87240['userProfileId']},'raw':!![]})[_0xdc7d('0x16')](function(_0x377e76){if(_0x377e76&&_0x377e76[_0xdc7d('0x3b')]===0x0){return db['UserProfileResource']['create']({'name':_0x11153b[_0xdc7d('0x1d')],'resourceId':_0x11153b['id'],'type':_0x377e76['name'],'sectionId':_0x377e76['id']},{})[_0xdc7d('0x16')](function(){return _0x4b906;});}else{return _0x4b906;}})[_0xdc7d('0x29')](function(_0x500047){logger[_0xdc7d('0x1c')](_0xdc7d('0x3c'),_0x500047);throw _0x500047;});}return _0x4b906;})[_0xdc7d('0x16')](respondWithResult(_0x12f38e,0xc9))[_0xdc7d('0x29')](handleError(_0x12f38e,null));};exports[_0xdc7d('0x15')]=function(_0x298803,_0x5a5bae){if(_0x298803[_0xdc7d('0x36')]['id']){delete _0x298803[_0xdc7d('0x36')]['id'];}return db[_0xdc7d('0x21')]['find']({'where':{'id':_0x298803['params']['id']}})[_0xdc7d('0x16')](handleEntityNotFound(_0x5a5bae,null))[_0xdc7d('0x16')](saveUpdates(_0x298803[_0xdc7d('0x36')],null))[_0xdc7d('0x16')](respondWithResult(_0x5a5bae,null))[_0xdc7d('0x29')](handleError(_0x5a5bae,null));};exports[_0xdc7d('0x17')]=function(_0x2c5e0e,_0x4c3e54){return db[_0xdc7d('0x21')][_0xdc7d('0x3a')]({'where':{'id':_0x2c5e0e[_0xdc7d('0x2a')]['id']}})[_0xdc7d('0x16')](handleEntityNotFound(_0x4c3e54,null))[_0xdc7d('0x16')](removeEntity(_0x4c3e54,null))[_0xdc7d('0x29')](handleError(_0x4c3e54,null));};exports[_0xdc7d('0x3d')]=function(_0xb0d211,_0x4d5cc6){return db[_0xdc7d('0x21')][_0xdc7d('0x3d')]()[_0xdc7d('0x16')](respondWithResult(_0x4d5cc6,null))['catch'](handleError(_0x4d5cc6,null));};exports[_0xdc7d('0x3e')]=function(_0x5e9e8b,_0x10a5c2){var _0x59c0dc={'raw':!![],'where':{}},_0x36c70e={},_0x5c7966;return db[_0xdc7d('0x21')][_0xdc7d('0x3f')]({'where':{'id':_0x5e9e8b[_0xdc7d('0x2a')]['id']}})[_0xdc7d('0x16')](handleEntityNotFound(_0x10a5c2,null))[_0xdc7d('0x16')](function(_0x25a0b5){if(_0x25a0b5){_0x5c7966=_0x25a0b5[_0xdc7d('0x18')]({'plain':!![]});_0x36c70e[_0xdc7d('0x2b')]=_[_0xdc7d('0x2c')](db[_0xdc7d('0x40')][_0xdc7d('0x2d')]);_0x36c70e['query']=_['keys'](_0x5e9e8b['query']);_0x36c70e['filters']=_[_0xdc7d('0x31')](_0x36c70e[_0xdc7d('0x2b')],_0x36c70e[_0xdc7d('0x2e')]);_0x59c0dc[_0xdc7d('0x30')]=_[_0xdc7d('0x31')](_0x36c70e[_0xdc7d('0x2b')],qs[_0xdc7d('0x32')](_0x5e9e8b[_0xdc7d('0x2e')]['fields']));_0x59c0dc[_0xdc7d('0x30')]=_0x59c0dc['attributes'][_0xdc7d('0x33')]?_0x59c0dc[_0xdc7d('0x30')]:_0x36c70e['model'];if(!_0x5e9e8b[_0xdc7d('0x2e')][_0xdc7d('0x41')]('nolimit')){_0x59c0dc[_0xdc7d('0x11')]=qs['limit'](_0x5e9e8b[_0xdc7d('0x2e')][_0xdc7d('0x11')]);_0x59c0dc[_0xdc7d('0xf')]=qs[_0xdc7d('0xf')](_0x5e9e8b['query'][_0xdc7d('0xf')]);}_0x59c0dc['order']=qs['sort'](_0x5e9e8b[_0xdc7d('0x2e')]['sort']);_0x59c0dc['where']=qs[_0xdc7d('0x2f')](_['pick'](_0x5e9e8b[_0xdc7d('0x2e')],_0x36c70e['filters']));_0x59c0dc[_0xdc7d('0x42')][_0xdc7d('0x43')]=_0x25a0b5['id'];if(_0x5e9e8b[_0xdc7d('0x2e')][_0xdc7d('0x44')]){_0x59c0dc[_0xdc7d('0x42')]=_['merge'](_0x59c0dc['where'],{'$or':_[_0xdc7d('0x20')](_0x59c0dc[_0xdc7d('0x30')],function(_0x4cad80){var _0xe9b800={};_0xe9b800[_0x4cad80]={'$like':'%'+_0x5e9e8b[_0xdc7d('0x2e')][_0xdc7d('0x44')]+'%'};return _0xe9b800;})});}_0x59c0dc=_[_0xdc7d('0x45')]({},_0x59c0dc,_0x5e9e8b['options']);return db['UserWhatsappQueue'][_0xdc7d('0x27')](_0x59c0dc);}})[_0xdc7d('0x16')](function(_0x1131f2){if(_0x1131f2){return db[_0xdc7d('0x46')][_0xdc7d('0x47')]({'where':{'id':_[_0xdc7d('0x20')](_0x1131f2,_0xdc7d('0x48')),'role':_0xdc7d('0x49')},'attributes':['id',_0xdc7d('0x1d'),_0xdc7d('0x4a'),_0xdc7d('0x4b'),'createdAt']});}})[_0xdc7d('0x16')](function(_0x1c3c9c){if(_0x1c3c9c){return{'count':_0x1c3c9c[_0xdc7d('0x12')],'rows':_['map'](_0x1c3c9c[_0xdc7d('0x28')],function(_0x10474b){return{'membername':_0x10474b[_0xdc7d('0x1d')],'UserId':_0x10474b['id'],'queue_name':_0x5c7966['name'],'WhatsappQueueId':_0x5c7966['id'],'interface':util['format'](_0xdc7d('0x4c'),_0xdc7d('0x4d'),_0x10474b['name']),'penalty':0x0,'paused':_0x10474b[_0xdc7d('0x4a')],'createdAt':_0x10474b[_0xdc7d('0x4e')],'updatedAt':_0x10474b[_0xdc7d('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x10a5c2,_0x59c0dc))[_0xdc7d('0x29')](handleError(_0x10a5c2,null));};exports['getTeams']=function(_0x211492,_0x5a857f){var _0x2a5e02={};var _0x250266={};var _0xf45afc;var _0x3b0ddd;return db[_0xdc7d('0x21')]['findOne']({'where':{'id':_0x211492[_0xdc7d('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5a857f,null))[_0xdc7d('0x16')](function(_0x14c6e8){if(_0x14c6e8){_0xf45afc=_0x14c6e8;_0x250266[_0xdc7d('0x2b')]=_[_0xdc7d('0x2c')](db[_0xdc7d('0x4f')][_0xdc7d('0x2d')]);_0x250266[_0xdc7d('0x2e')]=_[_0xdc7d('0x2c')](_0x211492[_0xdc7d('0x2e')]);_0x250266[_0xdc7d('0x2f')]=_['intersection'](_0x250266[_0xdc7d('0x2b')],_0x250266[_0xdc7d('0x2e')]);_0x2a5e02['attributes']=_[_0xdc7d('0x31')](_0x250266['model'],qs[_0xdc7d('0x32')](_0x211492[_0xdc7d('0x2e')][_0xdc7d('0x32')]));_0x2a5e02['attributes']=_0x2a5e02[_0xdc7d('0x30')]['length']?_0x2a5e02[_0xdc7d('0x30')]:_0x250266['model'];_0x2a5e02[_0xdc7d('0x50')]=qs[_0xdc7d('0x51')](_0x211492[_0xdc7d('0x2e')][_0xdc7d('0x51')]);_0x2a5e02[_0xdc7d('0x42')]=qs[_0xdc7d('0x2f')](_[_0xdc7d('0x52')](_0x211492[_0xdc7d('0x2e')],_0x250266['filters']));if(_0x211492[_0xdc7d('0x2e')][_0xdc7d('0x44')]){_0x2a5e02[_0xdc7d('0x42')]=_[_0xdc7d('0x45')](_0x2a5e02[_0xdc7d('0x42')],{'$or':_[_0xdc7d('0x20')](_0x2a5e02[_0xdc7d('0x30')],function(_0x1b2998){var _0xeafc78={};_0xeafc78[_0x1b2998]={'$like':'%'+_0x211492['query'][_0xdc7d('0x44')]+'%'};return _0xeafc78;})});}_0x2a5e02=_['merge']({},_0x2a5e02,_0x211492[_0xdc7d('0x34')]);return _0xf45afc[_0xdc7d('0x53')](_0x2a5e02);}})['then'](function(_0x17fdda){if(_0x17fdda){_0x3b0ddd=_0x17fdda[_0xdc7d('0x33')];if(!_0x211492['query'][_0xdc7d('0x41')](_0xdc7d('0x54'))){_0x2a5e02[_0xdc7d('0x11')]=qs[_0xdc7d('0x11')](_0x211492[_0xdc7d('0x2e')][_0xdc7d('0x11')]);_0x2a5e02[_0xdc7d('0xf')]=qs[_0xdc7d('0xf')](_0x211492['query'][_0xdc7d('0xf')]);}return _0xf45afc[_0xdc7d('0x53')](_0x2a5e02);}})['then'](function(_0x727779){if(_0x727779){return _0x727779?{'count':_0x3b0ddd,'rows':_0x727779}:null;}})[_0xdc7d('0x16')](respondWithResult(_0x5a857f,null))[_0xdc7d('0x29')](handleError(_0x5a857f,null));};exports[_0xdc7d('0x55')]=function(_0x36609f,_0x4ef564){var _0x3b3698=_0x36609f['body'][_0xdc7d('0x56')];return db[_0xdc7d('0x4f')][_0xdc7d('0x27')]({'where':{'id':_0x3b3698},'attributes':['id'],'include':[{'model':db[_0xdc7d('0x46')],'as':_0xdc7d('0x57'),'attributes':['id',_0xdc7d('0x1d'),_0xdc7d('0x58'),'voicePause','interface'],'raw':!![]}]})[_0xdc7d('0x16')](function(_0x1e5d12){if(_0x1e5d12){var _0x41f383=_[_0xdc7d('0x59')](_0x1e5d12,function(_0x3dc1fa){var _0x2b9c04=_0x3dc1fa['get']({'plain':!![]});return _0x2b9c04[_0xdc7d('0x57')];});return db[_0xdc7d('0x21')][_0xdc7d('0x3a')]({'where':{'id':_0x36609f['params']['id']}})[_0xdc7d('0x16')](function(_0x38cba6){return db['sequelize'][_0xdc7d('0x5a')](function(_0x2aaa6b){return _0x38cba6['addTeams'](_0x3b3698,{'transaction':_0x2aaa6b})[_0xdc7d('0x16')](function(){return BPromise['each'](_0x41f383,function(_0x4852ba){return db[_0xdc7d('0x40')]['findOrCreate']({'where':{'UserId':_0x4852ba['id'],'WhatsappQueueId':_0x36609f[_0xdc7d('0x2a')]['id']},'transaction':_0x2aaa6b});});})[_0xdc7d('0x16')](function(){_0x41f383[_0xdc7d('0x5b')](function(_0x279364){socket[_0xdc7d('0x5c')](_0xdc7d('0x5d'),{'UserId':_0x279364['id'],'WhatsappQueueId':_0x38cba6['id']});});});});});}})[_0xdc7d('0x16')](respondWithStatusCode(_0x4ef564,null))['catch'](handleError(_0x4ef564,null));};exports['removeTeams']=function(_0x221ffd,_0x16b640){return db['Team']['findAll']({'where':{'id':_0x221ffd[_0xdc7d('0x2e')][_0xdc7d('0x56')]},'attributes':['id'],'include':[{'model':db[_0xdc7d('0x46')],'as':_0xdc7d('0x57'),'attributes':['id'],'raw':!![]}]})[_0xdc7d('0x16')](handleEntityNotFound(_0x16b640,null))['then'](function(_0x47b5ab){var _0x1a4566=_['map'](_0x47b5ab,'id');var _0x59c876=[];var _0x41d793=[];var _0x481e7a=squel[_0xdc7d('0x5e')]();_0x481e7a[_0xdc7d('0x5f')](_0xdc7d('0x60'))['from'](_0xdc7d('0x61'),'tq')[_0xdc7d('0x62')]('user_has_teams','ut',_0xdc7d('0x63'))[_0xdc7d('0x42')](_0xdc7d('0x64'),_0x221ffd[_0xdc7d('0x2a')]['id']);for(var _0x1d936b=0x0;_0x1d936b<_0x47b5ab[_0xdc7d('0x33')];_0x1d936b+=0x1){let _0x4b133c=_0x47b5ab[_0x1d936b];for(var _0x55aba8=0x0;_0x55aba8<_0x4b133c[_0xdc7d('0x57')][_0xdc7d('0x33')];_0x55aba8+=0x1){let _0x1213cb=_0x4b133c[_0xdc7d('0x57')][_0x55aba8];var _0x3c1821=_0x481e7a[_0xdc7d('0x65')]();_0x3c1821[_0xdc7d('0x42')]('ut.UserId\x20=\x20?',_0x1213cb['id']);_0x41d793[_0xdc7d('0x66')](db[_0xdc7d('0x67')][_0xdc7d('0x2e')](_0x3c1821[_0xdc7d('0x68')](),{'type':db[_0xdc7d('0x67')][_0xdc7d('0x69')][_0xdc7d('0x6a')]})[_0xdc7d('0x16')](function(_0x14be7f){if(_0x14be7f[_0xdc7d('0x33')]===0x1){return _0x1213cb['id'];}else{var _0x4b882c=_[_0xdc7d('0x6b')](_[_0xdc7d('0x20')](_0x14be7f,_0xdc7d('0x6c')),function(_0x212fd2){return _[_0xdc7d('0x6d')](_0x1a4566,_0x212fd2);});if(_0x4b882c){return _0x1213cb['id'];}}}));}}return BPromise[_0xdc7d('0x6e')](_0x41d793)[_0xdc7d('0x16')](function(_0xbdafe1){_0x59c876=_(_0x59c876)[_0xdc7d('0x6f')](_0xbdafe1)['compact']()[_0xdc7d('0x70')]();return db[_0xdc7d('0x21')][_0xdc7d('0x3a')]({'where':{'id':_0x221ffd['params']['id']}})[_0xdc7d('0x16')](function(_0x19200b){return db[_0xdc7d('0x67')][_0xdc7d('0x5a')](function(_0x78b9d1){return _0x19200b[_0xdc7d('0x71')](_0x221ffd[_0xdc7d('0x2e')][_0xdc7d('0x56')],{'transaction':_0x78b9d1})[_0xdc7d('0x16')](function(){if(!_[_0xdc7d('0x72')](_0x59c876)){return _0x19200b[_0xdc7d('0x73')](_0x59c876,{'transaction':_0x78b9d1});}})[_0xdc7d('0x16')](function(){_0x59c876['forEach'](function(_0x3cb301){socket[_0xdc7d('0x5c')](_0xdc7d('0x74'),{'UserId':_0x3cb301,'WhatsappQueueId':_0x19200b['id']});});});});});});})[_0xdc7d('0x16')](respondWithStatusCode(_0x16b640,null))['catch'](handleError(_0x16b640,null));};exports['addAgents']=function(_0x3581e2,_0x6c9ee2){return db[_0xdc7d('0x21')]['find']({'where':{'id':_0x3581e2[_0xdc7d('0x2a')]['id']}})[_0xdc7d('0x16')](handleEntityNotFound(_0x6c9ee2,null))[_0xdc7d('0x16')](function(_0x28276b){if(_0x28276b){return _0x28276b[_0xdc7d('0x75')](_0x3581e2[_0xdc7d('0x36')][_0xdc7d('0x56')],_[_0xdc7d('0x76')](_0x3581e2[_0xdc7d('0x36')],['ids','id'])||{})[_0xdc7d('0x77')](function(_0x50e713){for(var _0x4ef8d1=0x0;_0x4ef8d1<_0x3581e2['body'][_0xdc7d('0x56')][_0xdc7d('0x33')];_0x4ef8d1+=0x1){socket[_0xdc7d('0x5c')](_0xdc7d('0x5d'),{'UserId':Number(_0x3581e2[_0xdc7d('0x36')]['ids'][_0x4ef8d1]),'WhatsappQueueId':Number(_0x3581e2['params']['id'])});}return _0x50e713;});}})[_0xdc7d('0x16')](respondWithResult(_0x6c9ee2,null))[_0xdc7d('0x29')](handleError(_0x6c9ee2,null));};exports[_0xdc7d('0x73')]=function(_0x1497d4,_0x42c7d6){return db[_0xdc7d('0x21')]['find']({'where':{'id':_0x1497d4[_0xdc7d('0x2a')]['id']}})[_0xdc7d('0x16')](handleEntityNotFound(_0x42c7d6,null))['then'](function(_0x50d252){if(_0x50d252){return _0x50d252['removeAgents'](_0x1497d4[_0xdc7d('0x2e')][_0xdc7d('0x56')])[_0xdc7d('0x16')](function(){if(_[_0xdc7d('0x78')](_0x1497d4[_0xdc7d('0x2e')][_0xdc7d('0x56')])){for(var _0x3bfdbc=0x0;_0x3bfdbc<_0x1497d4[_0xdc7d('0x2e')][_0xdc7d('0x56')][_0xdc7d('0x33')];_0x3bfdbc+=0x1){socket['emit'](_0xdc7d('0x74'),{'UserId':Number(_0x1497d4[_0xdc7d('0x2e')][_0xdc7d('0x56')][_0x3bfdbc]),'WhatsappQueueId':Number(_0x1497d4[_0xdc7d('0x2a')]['id'])});}}else{socket[_0xdc7d('0x5c')]('userWhatsappQueue:remove',{'UserId':Number(_0x1497d4[_0xdc7d('0x2e')][_0xdc7d('0x56')]),'WhatsappQueueId':Number(_0x1497d4['params']['id'])});}});}})[_0xdc7d('0x16')](respondWithStatusCode(_0x42c7d6,null))[_0xdc7d('0x29')](handleError(_0x42c7d6,null));};exports[_0xdc7d('0x79')]=function(_0x5dff79,_0x36316e){var _0x560f89={};var _0x175732={};var _0x16b403;var _0x4e0b45;return db[_0xdc7d('0x21')]['findOne']({'where':{'id':_0x5dff79[_0xdc7d('0x2a')]['id']}})['then'](handleEntityNotFound(_0x36316e,null))[_0xdc7d('0x16')](function(_0x81d340){if(_0x81d340){_0x16b403=_0x81d340;_0x175732[_0xdc7d('0x2b')]=_[_0xdc7d('0x2c')](db[_0xdc7d('0x46')][_0xdc7d('0x2d')]);_0x175732[_0xdc7d('0x2e')]=_[_0xdc7d('0x2c')](_0x5dff79['query']);_0x175732[_0xdc7d('0x2f')]=_['intersection'](_0x175732['model'],_0x175732['query']);_0x560f89[_0xdc7d('0x30')]=_[_0xdc7d('0x31')](_0x175732[_0xdc7d('0x2b')],qs['fields'](_0x5dff79[_0xdc7d('0x2e')]['fields']));_0x560f89[_0xdc7d('0x30')]=_0x560f89['attributes']['length']?_0x560f89[_0xdc7d('0x30')]:_0x175732[_0xdc7d('0x2b')];_0x560f89[_0xdc7d('0x50')]=qs['sort'](_0x5dff79[_0xdc7d('0x2e')]['sort']);_0x560f89['where']=qs[_0xdc7d('0x2f')](_[_0xdc7d('0x52')](_0x5dff79[_0xdc7d('0x2e')],_0x175732[_0xdc7d('0x2f')]));if(_0x5dff79[_0xdc7d('0x2e')][_0xdc7d('0x44')]){_0x560f89[_0xdc7d('0x42')]=_['merge'](_0x560f89[_0xdc7d('0x42')],{'$or':_[_0xdc7d('0x20')](_0x560f89[_0xdc7d('0x30')],function(_0x43694f){var _0x158fdf={};_0x158fdf[_0x43694f]={'$like':'%'+_0x5dff79['query'][_0xdc7d('0x44')]+'%'};return _0x158fdf;})});}_0x560f89=_[_0xdc7d('0x45')]({},_0x560f89,_0x5dff79[_0xdc7d('0x34')]);return _0x16b403[_0xdc7d('0x79')](_0x560f89);}})[_0xdc7d('0x16')](function(_0x1c0bfa){if(_0x1c0bfa){_0x4e0b45=_0x1c0bfa['length'];if(!_0x5dff79[_0xdc7d('0x2e')][_0xdc7d('0x41')](_0xdc7d('0x54'))){_0x560f89[_0xdc7d('0x11')]=qs[_0xdc7d('0x11')](_0x5dff79[_0xdc7d('0x2e')][_0xdc7d('0x11')]);_0x560f89['offset']=qs[_0xdc7d('0xf')](_0x5dff79[_0xdc7d('0x2e')][_0xdc7d('0xf')]);}return _0x16b403[_0xdc7d('0x79')](_0x560f89);}})[_0xdc7d('0x16')](function(_0x59b71b){if(_0x59b71b){return _0x59b71b?{'count':_0x4e0b45,'rows':_0x59b71b}:null;}})[_0xdc7d('0x16')](respondWithResult(_0x36316e,null))[_0xdc7d('0x29')](handleError(_0x36316e,null));}; \ No newline at end of file +var _0x19e4=['getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','update','then','get','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','catch','model','keys','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','params','UserWhatsappQueue','filters','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','Team','getTeams','addTeams','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','WhatsappQueueId\x20=\x20?','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x19e4,0x79));var _0x419e=function(_0x34d110,_0xec230e){_0x34d110=_0x34d110-0x0;var _0x126253=_0x19e4[_0x34d110];return _0x126253;};'use strict';var BPromise=require(_0x419e('0x0'));var util=require(_0x419e('0x1'));var _=require(_0x419e('0x2'));var squel=require(_0x419e('0x3'));var Redis=require(_0x419e('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x419e('0x5'))('api');var config=require(_0x419e('0x6'));var db=require(_0x419e('0x7'))['db'];config[_0x419e('0x8')]=_[_0x419e('0x9')](config[_0x419e('0x8')],{'host':_0x419e('0xa'),'port':0x18eb});var socket=require(_0x419e('0xb'))(new Redis(config[_0x419e('0x8')]));require(_0x419e('0xc'))['register'](socket);function respondWithStatusCode(_0x1bad3d,_0x43bf7d){_0x43bf7d=_0x43bf7d||0xcc;return function(_0x1ee482){if(_0x1ee482){return _0x1bad3d[_0x419e('0xd')](_0x43bf7d);}return _0x1bad3d[_0x419e('0xe')](_0x43bf7d)[_0x419e('0xf')]();};}function respondWithResult(_0x2de8a4,_0x1d9c95){_0x1d9c95=_0x1d9c95||0xc8;return function(_0x5a4cb0){if(_0x5a4cb0){return _0x2de8a4[_0x419e('0xe')](_0x1d9c95)[_0x419e('0x10')](_0x5a4cb0);}};}function respondWithFilteredResult(_0x2555b6,_0x5956f0){return function(_0x1b8113){if(_0x1b8113){var _0x28e73e=typeof _0x5956f0[_0x419e('0x11')]===_0x419e('0x12')&&typeof _0x5956f0['limit']==='undefined';var _0x3004dd=_0x1b8113[_0x419e('0x13')];var _0x38828b=_0x28e73e?0x0:_0x5956f0[_0x419e('0x11')];var _0x3d431a=_0x28e73e?_0x1b8113[_0x419e('0x13')]:_0x5956f0[_0x419e('0x11')]+_0x5956f0[_0x419e('0x14')];var _0x158d7b;if(_0x3d431a>=_0x3004dd){_0x3d431a=_0x3004dd;_0x158d7b=0xc8;}else{_0x158d7b=0xce;}_0x2555b6[_0x419e('0xe')](_0x158d7b);return _0x2555b6[_0x419e('0x15')]('Content-Range',_0x38828b+'-'+_0x3d431a+'/'+_0x3004dd)[_0x419e('0x10')](_0x1b8113);}return null;};}function saveUpdates(_0x30cb93){return function(_0x24adf2){if(_0x24adf2){return _0x24adf2[_0x419e('0x16')](_0x30cb93)[_0x419e('0x17')](function(_0x44ff4f){return _0x44ff4f;});}return null;};}function removeEntity(_0xfb900d){return function(_0x5597d3){if(_0x5597d3){return _0x5597d3['destroy']()[_0x419e('0x17')](function(){var _0x34fcb6=_0x5597d3[_0x419e('0x18')]({'plain':!![]});var _0x50c541='WhatsappQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x50c541,'resourceId':_0x34fcb6['id']}})['then'](function(){return _0x5597d3;});})[_0x419e('0x17')](function(){_0xfb900d[_0x419e('0xe')](0xcc)[_0x419e('0xf')]();});}};}function handleEntityNotFound(_0x4d9205){return function(_0x2d1776){if(!_0x2d1776){_0x4d9205[_0x419e('0xd')](0x194);}return _0x2d1776;};}function handleError(_0x120c77,_0x3310a3){_0x3310a3=_0x3310a3||0x1f4;return function(_0x28129c){logger[_0x419e('0x19')](_0x28129c[_0x419e('0x1a')]);if(_0x28129c[_0x419e('0x1b')]){delete _0x28129c[_0x419e('0x1b')];}_0x120c77[_0x419e('0xe')](_0x3310a3)[_0x419e('0x1c')](_0x28129c);};}exports[_0x419e('0x1d')]=function(_0x7004ad,_0x572682){var _0x5d85b7={};var _0x5b883f={'count':0x0,'rows':[]};var _0x15045a=_[_0x419e('0x1e')](db[_0x419e('0x1f')][_0x419e('0x20')],function(_0xf16a13){return{'name':_0xf16a13[_0x419e('0x21')],'type':_0xf16a13[_0x419e('0x22')]['key']};});_0x5d85b7=qs[_0x419e('0x23')](_0x15045a,_0x7004ad);var _0x4f3c8d={'where':_0x5d85b7[_0x419e('0x24')]};return db[_0x419e('0x1f')][_0x419e('0x13')](_0x4f3c8d)['then'](function(_0x1d5dae){_0x5b883f[_0x419e('0x13')]=_0x1d5dae;_0x5d85b7[_0x419e('0x25')]=qs[_0x419e('0x25')](_0x7004ad[_0x419e('0x26')]);return db[_0x419e('0x1f')]['findAll'](_0x5d85b7);})[_0x419e('0x17')](function(_0xd48e90){_0x5b883f[_0x419e('0x27')]=_0xd48e90;return _0x5b883f;})[_0x419e('0x17')](respondWithFilteredResult(_0x572682,_0x5d85b7))[_0x419e('0x28')](handleError(_0x572682,null));};exports['show']=function(_0x1800d0,_0x31b16a){var _0x45859d={'raw':!![],'where':{'id':_0x1800d0['params']['id']}},_0x4f18ce={};_0x4f18ce[_0x419e('0x29')]=_[_0x419e('0x2a')](db[_0x419e('0x1f')]['rawAttributes']);_0x4f18ce[_0x419e('0x26')]=_[_0x419e('0x2a')](_0x1800d0[_0x419e('0x26')]);_0x4f18ce['filters']=_[_0x419e('0x2b')](_0x4f18ce[_0x419e('0x29')],_0x4f18ce['query']);_0x45859d[_0x419e('0x2c')]=_[_0x419e('0x2b')](_0x4f18ce[_0x419e('0x29')],qs['fields'](_0x1800d0[_0x419e('0x26')][_0x419e('0x2d')]));_0x45859d[_0x419e('0x2c')]=_0x45859d[_0x419e('0x2c')][_0x419e('0x2e')]?_0x45859d['attributes']:_0x4f18ce[_0x419e('0x29')];if(_0x1800d0[_0x419e('0x26')][_0x419e('0x2f')]){_0x45859d[_0x419e('0x25')]=[{'all':!![]}];}_0x45859d=_[_0x419e('0x30')]({},_0x45859d,_0x1800d0[_0x419e('0x31')]);return db[_0x419e('0x1f')][_0x419e('0x32')](_0x45859d)['then'](handleEntityNotFound(_0x31b16a,null))[_0x419e('0x17')](respondWithResult(_0x31b16a,null))[_0x419e('0x28')](handleError(_0x31b16a,null));};exports[_0x419e('0x33')]=function(_0x5d48d9,_0x137896){return db[_0x419e('0x1f')][_0x419e('0x33')](_0x5d48d9['body'],{})['then'](function(_0x156745){var _0x521e98=_0x5d48d9[_0x419e('0x34')][_0x419e('0x18')]({'plain':!![]});if(!_0x521e98)throw new Error(_0x419e('0x35'));if(_0x521e98[_0x419e('0x36')]===_0x419e('0x34')){var _0x3af415=_0x156745[_0x419e('0x18')]({'plain':!![]});var _0x24db1c=_0x419e('0x37');return db['UserProfileSection']['find']({'where':{'name':_0x24db1c,'userProfileId':_0x521e98[_0x419e('0x38')]},'raw':!![]})[_0x419e('0x17')](function(_0x40cd8b){if(_0x40cd8b&&_0x40cd8b[_0x419e('0x39')]===0x0){return db['UserProfileResource'][_0x419e('0x33')]({'name':_0x3af415[_0x419e('0x1b')],'resourceId':_0x3af415['id'],'type':_0x40cd8b['name'],'sectionId':_0x40cd8b['id']},{})[_0x419e('0x17')](function(){return _0x156745;});}else{return _0x156745;}})[_0x419e('0x28')](function(_0x4d1bf1){logger[_0x419e('0x19')](_0x419e('0x3a'),_0x4d1bf1);throw _0x4d1bf1;});}return _0x156745;})['then'](respondWithResult(_0x137896,0xc9))[_0x419e('0x28')](handleError(_0x137896,null));};exports[_0x419e('0x16')]=function(_0x470c5c,_0x283ddd){if(_0x470c5c['body']['id']){delete _0x470c5c[_0x419e('0x3b')]['id'];}return db[_0x419e('0x1f')][_0x419e('0x32')]({'where':{'id':_0x470c5c['params']['id']}})[_0x419e('0x17')](handleEntityNotFound(_0x283ddd,null))[_0x419e('0x17')](saveUpdates(_0x470c5c[_0x419e('0x3b')],null))[_0x419e('0x17')](respondWithResult(_0x283ddd,null))[_0x419e('0x28')](handleError(_0x283ddd,null));};exports[_0x419e('0x3c')]=function(_0x1ac07f,_0x894ee2){return db['WhatsappQueue'][_0x419e('0x32')]({'where':{'id':_0x1ac07f['params']['id']}})[_0x419e('0x17')](handleEntityNotFound(_0x894ee2,null))['then'](removeEntity(_0x894ee2,null))['catch'](handleError(_0x894ee2,null));};exports['describe']=function(_0x40d210,_0x273bdd){return db['WhatsappQueue'][_0x419e('0x3d')]()['then'](respondWithResult(_0x273bdd,null))[_0x419e('0x28')](handleError(_0x273bdd,null));};exports[_0x419e('0x3e')]=function(_0x5807c9,_0x489a2b){var _0x2a7000={'raw':!![],'where':{}},_0x4c51ac={},_0x37e684;return db[_0x419e('0x1f')][_0x419e('0x3f')]({'where':{'id':_0x5807c9[_0x419e('0x40')]['id']}})['then'](handleEntityNotFound(_0x489a2b,null))['then'](function(_0x5f0bcf){if(_0x5f0bcf){_0x37e684=_0x5f0bcf[_0x419e('0x18')]({'plain':!![]});_0x4c51ac[_0x419e('0x29')]=_[_0x419e('0x2a')](db[_0x419e('0x41')][_0x419e('0x20')]);_0x4c51ac['query']=_[_0x419e('0x2a')](_0x5807c9['query']);_0x4c51ac[_0x419e('0x42')]=_[_0x419e('0x2b')](_0x4c51ac['model'],_0x4c51ac[_0x419e('0x26')]);_0x2a7000['attributes']=_['intersection'](_0x4c51ac[_0x419e('0x29')],qs[_0x419e('0x2d')](_0x5807c9[_0x419e('0x26')]['fields']));_0x2a7000[_0x419e('0x2c')]=_0x2a7000['attributes']['length']?_0x2a7000[_0x419e('0x2c')]:_0x4c51ac[_0x419e('0x29')];if(!_0x5807c9[_0x419e('0x26')][_0x419e('0x43')](_0x419e('0x44'))){_0x2a7000[_0x419e('0x14')]=qs[_0x419e('0x14')](_0x5807c9[_0x419e('0x26')][_0x419e('0x14')]);_0x2a7000[_0x419e('0x11')]=qs[_0x419e('0x11')](_0x5807c9[_0x419e('0x26')][_0x419e('0x11')]);}_0x2a7000[_0x419e('0x45')]=qs['sort'](_0x5807c9[_0x419e('0x26')][_0x419e('0x46')]);_0x2a7000[_0x419e('0x24')]=qs[_0x419e('0x42')](_[_0x419e('0x47')](_0x5807c9[_0x419e('0x26')],_0x4c51ac[_0x419e('0x42')]));_0x2a7000[_0x419e('0x24')][_0x419e('0x48')]=_0x5f0bcf['id'];if(_0x5807c9[_0x419e('0x26')][_0x419e('0x49')]){_0x2a7000[_0x419e('0x24')]=_[_0x419e('0x30')](_0x2a7000[_0x419e('0x24')],{'$or':_[_0x419e('0x1e')](_0x2a7000[_0x419e('0x2c')],function(_0x155a3a){var _0x40b3d7={};_0x40b3d7[_0x155a3a]={'$like':'%'+_0x5807c9['query'][_0x419e('0x49')]+'%'};return _0x40b3d7;})});}_0x2a7000=_['merge']({},_0x2a7000,_0x5807c9[_0x419e('0x31')]);return db[_0x419e('0x41')]['findAll'](_0x2a7000);}})[_0x419e('0x17')](function(_0x5834b5){if(_0x5834b5){return db[_0x419e('0x4a')][_0x419e('0x4b')]({'where':{'id':_['map'](_0x5834b5,_0x419e('0x4c')),'role':_0x419e('0x4d')},'attributes':['id',_0x419e('0x1b'),_0x419e('0x4e'),'updatedAt',_0x419e('0x4f')]});}})[_0x419e('0x17')](function(_0x459d0d){if(_0x459d0d){return{'count':_0x459d0d[_0x419e('0x13')],'rows':_[_0x419e('0x1e')](_0x459d0d[_0x419e('0x27')],function(_0x4191ea){return{'membername':_0x4191ea[_0x419e('0x1b')],'UserId':_0x4191ea['id'],'queue_name':_0x37e684[_0x419e('0x1b')],'WhatsappQueueId':_0x37e684['id'],'interface':util[_0x419e('0x50')]('%s/%s','SIP',_0x4191ea[_0x419e('0x1b')]),'penalty':0x0,'paused':_0x4191ea[_0x419e('0x4e')],'createdAt':_0x4191ea[_0x419e('0x4f')],'updatedAt':_0x4191ea['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x419e('0x17')](respondWithFilteredResult(_0x489a2b,_0x2a7000))[_0x419e('0x28')](handleError(_0x489a2b,null));};exports['getTeams']=function(_0x2abcaa,_0x24a753){var _0x34ee7b={};var _0x42b1e7={};var _0x54a524;var _0x5d6393;return db[_0x419e('0x1f')][_0x419e('0x3f')]({'where':{'id':_0x2abcaa['params']['id']}})[_0x419e('0x17')](handleEntityNotFound(_0x24a753,null))[_0x419e('0x17')](function(_0x3b0e6a){if(_0x3b0e6a){_0x54a524=_0x3b0e6a;_0x42b1e7['model']=_['keys'](db[_0x419e('0x51')][_0x419e('0x20')]);_0x42b1e7['query']=_['keys'](_0x2abcaa['query']);_0x42b1e7[_0x419e('0x42')]=_[_0x419e('0x2b')](_0x42b1e7[_0x419e('0x29')],_0x42b1e7[_0x419e('0x26')]);_0x34ee7b[_0x419e('0x2c')]=_[_0x419e('0x2b')](_0x42b1e7[_0x419e('0x29')],qs[_0x419e('0x2d')](_0x2abcaa['query'][_0x419e('0x2d')]));_0x34ee7b[_0x419e('0x2c')]=_0x34ee7b['attributes']['length']?_0x34ee7b[_0x419e('0x2c')]:_0x42b1e7['model'];_0x34ee7b[_0x419e('0x45')]=qs[_0x419e('0x46')](_0x2abcaa['query']['sort']);_0x34ee7b[_0x419e('0x24')]=qs[_0x419e('0x42')](_['pick'](_0x2abcaa['query'],_0x42b1e7[_0x419e('0x42')]));if(_0x2abcaa[_0x419e('0x26')][_0x419e('0x49')]){_0x34ee7b['where']=_[_0x419e('0x30')](_0x34ee7b[_0x419e('0x24')],{'$or':_[_0x419e('0x1e')](_0x34ee7b[_0x419e('0x2c')],function(_0x896f18){var _0x3bae44={};_0x3bae44[_0x896f18]={'$like':'%'+_0x2abcaa[_0x419e('0x26')][_0x419e('0x49')]+'%'};return _0x3bae44;})});}_0x34ee7b=_[_0x419e('0x30')]({},_0x34ee7b,_0x2abcaa[_0x419e('0x31')]);return _0x54a524[_0x419e('0x52')](_0x34ee7b);}})['then'](function(_0x45ca7a){if(_0x45ca7a){_0x5d6393=_0x45ca7a[_0x419e('0x2e')];if(!_0x2abcaa[_0x419e('0x26')]['hasOwnProperty'](_0x419e('0x44'))){_0x34ee7b[_0x419e('0x14')]=qs['limit'](_0x2abcaa[_0x419e('0x26')][_0x419e('0x14')]);_0x34ee7b[_0x419e('0x11')]=qs['offset'](_0x2abcaa['query']['offset']);}return _0x54a524['getTeams'](_0x34ee7b);}})[_0x419e('0x17')](function(_0x434b1d){if(_0x434b1d){return _0x434b1d?{'count':_0x5d6393,'rows':_0x434b1d}:null;}})['then'](respondWithResult(_0x24a753,null))[_0x419e('0x28')](handleError(_0x24a753,null));};exports[_0x419e('0x53')]=function(_0x219b5d,_0x55e787){var _0x40528f=_0x219b5d[_0x419e('0x3b')][_0x419e('0x54')];return db[_0x419e('0x51')][_0x419e('0x55')]({'where':{'id':_0x40528f},'attributes':['id'],'include':[{'model':db[_0x419e('0x4a')],'as':_0x419e('0x56'),'attributes':['id','name',_0x419e('0x57'),_0x419e('0x58'),_0x419e('0x59')],'raw':!![]}]})['then'](function(_0x2f1b4d){if(_0x2f1b4d){var _0x380acc=_[_0x419e('0x5a')](_0x2f1b4d,function(_0x289a3c){var _0xb76d45=_0x289a3c[_0x419e('0x18')]({'plain':!![]});return _0xb76d45['Agents'];});return db['WhatsappQueue'][_0x419e('0x32')]({'where':{'id':_0x219b5d[_0x419e('0x40')]['id']}})[_0x419e('0x17')](function(_0x43ca4d){return db[_0x419e('0x5b')][_0x419e('0x5c')](function(_0x1e7b51){return _0x43ca4d[_0x419e('0x53')](_0x40528f,{'transaction':_0x1e7b51})[_0x419e('0x17')](function(){return BPromise[_0x419e('0x5d')](_0x380acc,function(_0x8df8ac){return db['UserWhatsappQueue'][_0x419e('0x5e')]({'where':{'UserId':_0x8df8ac['id'],'WhatsappQueueId':_0x219b5d[_0x419e('0x40')]['id']},'transaction':_0x1e7b51});});})[_0x419e('0x17')](function(){_0x380acc[_0x419e('0x5f')](function(_0x1861f3){socket[_0x419e('0x60')](_0x419e('0x61'),{'UserId':_0x1861f3['id'],'WhatsappQueueId':_0x43ca4d['id']});});});});});}})[_0x419e('0x17')](respondWithStatusCode(_0x55e787,null))[_0x419e('0x28')](handleError(_0x55e787,null));};exports[_0x419e('0x62')]=function(_0x2e388c,_0x337ca9){return db[_0x419e('0x51')][_0x419e('0x55')]({'where':{'id':_0x2e388c[_0x419e('0x26')][_0x419e('0x54')]},'attributes':['id'],'include':[{'model':db[_0x419e('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x419e('0x17')](handleEntityNotFound(_0x337ca9,null))[_0x419e('0x17')](function(_0x13ed63){var _0x2a754c=_[_0x419e('0x1e')](_0x13ed63,'id');var _0x55b476=[];var _0x13d73a=[];var _0x3aec8f=squel[_0x419e('0x63')]();_0x3aec8f[_0x419e('0x64')](_0x419e('0x65'))[_0x419e('0x66')]('team_has_whatsapp_queues','tq')[_0x419e('0x67')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x419e('0x24')](_0x419e('0x68'),_0x2e388c[_0x419e('0x40')]['id']);for(var _0x2f1a90=0x0;_0x2f1a90<_0x13ed63['length'];_0x2f1a90+=0x1){let _0x3a49ef=_0x13ed63[_0x2f1a90];for(var _0x3d329f=0x0;_0x3d329f<_0x3a49ef[_0x419e('0x56')][_0x419e('0x2e')];_0x3d329f+=0x1){let _0x4efc40=_0x3a49ef[_0x419e('0x56')][_0x3d329f];var _0x4271dd=_0x3aec8f['clone']();_0x4271dd[_0x419e('0x24')]('ut.UserId\x20=\x20?',_0x4efc40['id']);_0x13d73a['push'](db[_0x419e('0x5b')][_0x419e('0x26')](_0x4271dd['toString'](),{'type':db[_0x419e('0x5b')]['QueryTypes'][_0x419e('0x69')]})[_0x419e('0x17')](function(_0x106c59){if(_0x106c59[_0x419e('0x2e')]===0x1){return _0x4efc40['id'];}else{var _0x253c4f=_[_0x419e('0x6a')](_[_0x419e('0x1e')](_0x106c59,_0x419e('0x6b')),function(_0x264392){return _[_0x419e('0x6c')](_0x2a754c,_0x264392);});if(_0x253c4f){return _0x4efc40['id'];}}}));}}return BPromise[_0x419e('0x6d')](_0x13d73a)[_0x419e('0x17')](function(_0x2fd251){_0x55b476=_(_0x55b476)[_0x419e('0x6e')](_0x2fd251)[_0x419e('0x6f')]()[_0x419e('0x70')]();return db[_0x419e('0x1f')][_0x419e('0x32')]({'where':{'id':_0x2e388c[_0x419e('0x40')]['id']}})[_0x419e('0x17')](function(_0x3e2468){return db[_0x419e('0x5b')][_0x419e('0x5c')](function(_0x3c86c1){return _0x3e2468[_0x419e('0x62')](_0x2e388c[_0x419e('0x26')][_0x419e('0x54')],{'transaction':_0x3c86c1})[_0x419e('0x17')](function(){if(!_['isEmpty'](_0x55b476)){return _0x3e2468[_0x419e('0x71')](_0x55b476,{'transaction':_0x3c86c1});}})[_0x419e('0x17')](function(){_0x55b476[_0x419e('0x5f')](function(_0x19add2){socket[_0x419e('0x60')](_0x419e('0x72'),{'UserId':_0x19add2,'WhatsappQueueId':_0x3e2468['id']});});});});});});})[_0x419e('0x17')](respondWithStatusCode(_0x337ca9,null))[_0x419e('0x28')](handleError(_0x337ca9,null));};exports[_0x419e('0x73')]=function(_0x5b4737,_0x22b27d){return db[_0x419e('0x1f')][_0x419e('0x32')]({'where':{'id':_0x5b4737[_0x419e('0x40')]['id']}})['then'](handleEntityNotFound(_0x22b27d,null))[_0x419e('0x17')](function(_0x240acc){if(_0x240acc){return _0x240acc['addAgents'](_0x5b4737[_0x419e('0x3b')][_0x419e('0x54')],_[_0x419e('0x74')](_0x5b4737['body'],['ids','id'])||{})[_0x419e('0x75')](function(_0x493b1e){for(var _0x337b23=0x0;_0x337b23<_0x5b4737[_0x419e('0x3b')][_0x419e('0x54')][_0x419e('0x2e')];_0x337b23+=0x1){socket[_0x419e('0x60')]('userWhatsappQueue:save',{'UserId':Number(_0x5b4737['body'][_0x419e('0x54')][_0x337b23]),'WhatsappQueueId':Number(_0x5b4737[_0x419e('0x40')]['id'])});}return _0x493b1e;});}})[_0x419e('0x17')](respondWithResult(_0x22b27d,null))[_0x419e('0x28')](handleError(_0x22b27d,null));};exports[_0x419e('0x71')]=function(_0x37de89,_0x1825c8){return db[_0x419e('0x1f')]['find']({'where':{'id':_0x37de89['params']['id']}})[_0x419e('0x17')](handleEntityNotFound(_0x1825c8,null))[_0x419e('0x17')](function(_0x8fce6f){if(_0x8fce6f){return _0x8fce6f['removeAgents'](_0x37de89[_0x419e('0x26')][_0x419e('0x54')])[_0x419e('0x17')](function(){if(_[_0x419e('0x76')](_0x37de89['query'][_0x419e('0x54')])){for(var _0x1c7f84=0x0;_0x1c7f84<_0x37de89[_0x419e('0x26')][_0x419e('0x54')][_0x419e('0x2e')];_0x1c7f84+=0x1){socket['emit'](_0x419e('0x72'),{'UserId':Number(_0x37de89['query'][_0x419e('0x54')][_0x1c7f84]),'WhatsappQueueId':Number(_0x37de89[_0x419e('0x40')]['id'])});}}else{socket[_0x419e('0x60')](_0x419e('0x72'),{'UserId':Number(_0x37de89['query'][_0x419e('0x54')]),'WhatsappQueueId':Number(_0x37de89[_0x419e('0x40')]['id'])});}});}})[_0x419e('0x17')](respondWithStatusCode(_0x1825c8,null))['catch'](handleError(_0x1825c8,null));};exports[_0x419e('0x77')]=function(_0x1b6c18,_0x24d073){var _0x2cb85d={};var _0x1c98bd={};var _0x27c5db;var _0x1cb73c;return db[_0x419e('0x1f')][_0x419e('0x3f')]({'where':{'id':_0x1b6c18[_0x419e('0x40')]['id']}})[_0x419e('0x17')](handleEntityNotFound(_0x24d073,null))[_0x419e('0x17')](function(_0x316350){if(_0x316350){_0x27c5db=_0x316350;_0x1c98bd[_0x419e('0x29')]=_['keys'](db[_0x419e('0x4a')][_0x419e('0x20')]);_0x1c98bd[_0x419e('0x26')]=_[_0x419e('0x2a')](_0x1b6c18[_0x419e('0x26')]);_0x1c98bd[_0x419e('0x42')]=_['intersection'](_0x1c98bd[_0x419e('0x29')],_0x1c98bd[_0x419e('0x26')]);_0x2cb85d[_0x419e('0x2c')]=_[_0x419e('0x2b')](_0x1c98bd['model'],qs[_0x419e('0x2d')](_0x1b6c18['query'][_0x419e('0x2d')]));_0x2cb85d['attributes']=_0x2cb85d[_0x419e('0x2c')][_0x419e('0x2e')]?_0x2cb85d[_0x419e('0x2c')]:_0x1c98bd[_0x419e('0x29')];_0x2cb85d[_0x419e('0x45')]=qs[_0x419e('0x46')](_0x1b6c18[_0x419e('0x26')][_0x419e('0x46')]);_0x2cb85d['where']=qs[_0x419e('0x42')](_[_0x419e('0x47')](_0x1b6c18[_0x419e('0x26')],_0x1c98bd['filters']));if(_0x1b6c18[_0x419e('0x26')][_0x419e('0x49')]){_0x2cb85d[_0x419e('0x24')]=_[_0x419e('0x30')](_0x2cb85d[_0x419e('0x24')],{'$or':_['map'](_0x2cb85d[_0x419e('0x2c')],function(_0x37bf61){var _0x2ca83a={};_0x2ca83a[_0x37bf61]={'$like':'%'+_0x1b6c18['query'][_0x419e('0x49')]+'%'};return _0x2ca83a;})});}_0x2cb85d=_[_0x419e('0x30')]({},_0x2cb85d,_0x1b6c18[_0x419e('0x31')]);return _0x27c5db['getAgents'](_0x2cb85d);}})[_0x419e('0x17')](function(_0x226552){if(_0x226552){_0x1cb73c=_0x226552[_0x419e('0x2e')];if(!_0x1b6c18[_0x419e('0x26')][_0x419e('0x43')](_0x419e('0x44'))){_0x2cb85d['limit']=qs[_0x419e('0x14')](_0x1b6c18[_0x419e('0x26')][_0x419e('0x14')]);_0x2cb85d[_0x419e('0x11')]=qs[_0x419e('0x11')](_0x1b6c18[_0x419e('0x26')][_0x419e('0x11')]);}return _0x27c5db[_0x419e('0x77')](_0x2cb85d);}})[_0x419e('0x17')](function(_0x2a0206){if(_0x2a0206){return _0x2a0206?{'count':_0x1cb73c,'rows':_0x2a0206}:null;}})[_0x419e('0x17')](respondWithResult(_0x24d073,null))[_0x419e('0x28')](handleError(_0x24d073,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e59acc7..b4e4d4d 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 _0xe7cb=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x17a49f,_0x4f3c3a){var _0x4e24bd=function(_0x363544){while(--_0x363544){_0x17a49f['push'](_0x17a49f['shift']());}};_0x4e24bd(++_0x4f3c3a);}(_0xe7cb,0xde));var _0xbe7c=function(_0x1dfdb5,_0x4f5868){_0x1dfdb5=_0x1dfdb5-0x0;var _0x7965c0=_0xe7cb[_0x1dfdb5];return _0x7965c0;};'use strict';var EventEmitter=require(_0xbe7c('0x0'));var WhatsappQueue=require(_0xbe7c('0x1'))['db'][_0xbe7c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe7c('0x3'),'afterUpdate':_0xbe7c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x41fa95){return function(_0x46ea63,_0x328a67,_0x3e36ab){WhatsappQueueEvents[_0xbe7c('0x5')](_0x41fa95+':'+_0x46ea63['id'],_0x46ea63);WhatsappQueueEvents[_0xbe7c('0x5')](_0x41fa95,_0x46ea63);_0x3e36ab(null);};}for(var e in events){if(events[_0xbe7c('0x6')](e)){var event=events[e];WhatsappQueue[_0xbe7c('0x7')](e,emitEvent(event));}}module[_0xbe7c('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xdee3=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x283563,_0x4b3afa){var _0x5d8047=function(_0xc1f894){while(--_0xc1f894){_0x283563['push'](_0x283563['shift']());}};_0x5d8047(++_0x4b3afa);}(_0xdee3,0xbc));var _0x3dee=function(_0x585c58,_0x566922){_0x585c58=_0x585c58-0x0;var _0x99f259=_0xdee3[_0x585c58];return _0x99f259;};'use strict';var EventEmitter=require(_0x3dee('0x0'));var WhatsappQueue=require(_0x3dee('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3dee('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3dee('0x3'),'afterDestroy':_0x3dee('0x4')};function emitEvent(_0x977773){return function(_0x4e6833,_0xdc942e,_0xb5937f){WhatsappQueueEvents[_0x3dee('0x5')](_0x977773+':'+_0x4e6833['id'],_0x4e6833);WhatsappQueueEvents[_0x3dee('0x5')](_0x977773,_0x4e6833);_0xb5937f(null);};}for(var e in events){if(events[_0x3dee('0x6')](e)){var event=events[e];WhatsappQueue[_0x3dee('0x7')](e,emitEvent(event));}}module[_0x3dee('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 61de357..6e32b70 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 _0xbda7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x335715,_0xd4a18f){var _0x50d417=function(_0x3eb9f7){while(--_0x3eb9f7){_0x335715['push'](_0x335715['shift']());}};_0x50d417(++_0xd4a18f);}(_0xbda7,0xfb));var _0x7bda=function(_0x4e9010,_0x1fa085){_0x4e9010=_0x4e9010-0x0;var _0x4188c6=_0xbda7[_0x4e9010];return _0x4188c6;};'use strict';var _=require(_0x7bda('0x0'));var util=require(_0x7bda('0x1'));var logger=require(_0x7bda('0x2'))('api');var moment=require(_0x7bda('0x3'));var BPromise=require(_0x7bda('0x4'));var rp=require(_0x7bda('0x5'));var fs=require('fs');var path=require(_0x7bda('0x6'));var rimraf=require(_0x7bda('0x7'));var config=require(_0x7bda('0x8'));var attributes=require(_0x7bda('0x9'));module[_0x7bda('0xa')]=function(_0x93815b,_0x334af1){return _0x93815b[_0x7bda('0xb')](_0x7bda('0xc'),attributes,{'tableName':_0x7bda('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb964=['whatsapp_queues','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x357849,_0x4d60d4){var _0x4fb1fa=function(_0x378616){while(--_0x378616){_0x357849['push'](_0x357849['shift']());}};_0x4fb1fa(++_0x4d60d4);}(_0xb964,0x179));var _0x4b96=function(_0x4b5434,_0x2d0440){_0x4b5434=_0x4b5434-0x0;var _0x55ebc=_0xb964[_0x4b5434];return _0x55ebc;};'use strict';var _=require(_0x4b96('0x0'));var util=require(_0x4b96('0x1'));var logger=require('../../config/logger')(_0x4b96('0x2'));var moment=require('moment');var BPromise=require(_0x4b96('0x3'));var rp=require(_0x4b96('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b96('0x5'));var config=require(_0x4b96('0x6'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x3e0b17,_0x5e258e){return _0x3e0b17['define']('WhatsappQueue',attributes,{'tableName':_0x4b96('0x7'),'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 c00360e..5e0ba16 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 _0x24cf=['error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','map','model','attributes','then','ShowWhatsappQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1d3756,_0x3411bb){var _0x3dd1a8=function(_0x454358){while(--_0x454358){_0x1d3756['push'](_0x1d3756['shift']());}};_0x3dd1a8(++_0x3411bb);}(_0x24cf,0x17b));var _0xf24c=function(_0xf60c8,_0xf932a4){_0xf60c8=_0xf60c8-0x0;var _0x3816a1=_0x24cf[_0xf60c8];return _0x3816a1;};'use strict';var _=require('lodash');var util=require(_0xf24c('0x0'));var moment=require(_0xf24c('0x1'));var BPromise=require('bluebird');var rs=require(_0xf24c('0x2'));var fs=require('fs');var Redis=require(_0xf24c('0x3'));var db=require(_0xf24c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf24c('0x5'))(_0xf24c('0x6'));var config=require(_0xf24c('0x7'));var jayson=require(_0xf24c('0x8'));var client=jayson['client'][_0xf24c('0x9')]({'port':0x232a});config[_0xf24c('0xa')]=_[_0xf24c('0xb')](config['redis'],{'host':_0xf24c('0xc'),'port':0x18eb});var socket=require(_0xf24c('0xd'))(new Redis(config[_0xf24c('0xa')]));require(_0xf24c('0xe'))[_0xf24c('0xf')](socket);function respondWithRpcPromise(_0x2325f4,_0x31645b,_0xf1ab01){return new BPromise(function(_0x286101,_0x3fbf85){return client['request'](_0x2325f4,_0xf1ab01)['then'](function(_0x90fe90){logger[_0xf24c('0x10')](_0xf24c('0x11'),_0x31645b,_0xf24c('0x12'));logger[_0xf24c('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x31645b,'request\x20sent',JSON[_0xf24c('0x14')](_0x90fe90));if(_0x90fe90[_0xf24c('0x15')]){if(_0x90fe90[_0xf24c('0x15')][_0xf24c('0x16')]===0x1f4){logger[_0xf24c('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x31645b,_0x90fe90[_0xf24c('0x15')]['message']);return _0x3fbf85(_0x90fe90[_0xf24c('0x15')][_0xf24c('0x17')]);}logger['error'](_0xf24c('0x11'),_0x31645b,_0x90fe90[_0xf24c('0x15')][_0xf24c('0x17')]);return _0x286101(_0x90fe90[_0xf24c('0x15')]['message']);}else{logger[_0xf24c('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x31645b,_0xf24c('0x12'));_0x286101(_0x90fe90[_0xf24c('0x18')]['message']);}})[_0xf24c('0x19')](function(_0x2bd9d2){logger[_0xf24c('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x31645b,_0x2bd9d2);_0x3fbf85(_0x2bd9d2);});});}exports[_0xf24c('0x1a')]=function(_0x516df8){var _0x1d043b=this;return new Promise(function(_0x4dae4e,_0x59b000){return db[_0xf24c('0x1b')][_0xf24c('0x1c')]({'raw':_0x516df8[_0xf24c('0x1d')]?_0x516df8[_0xf24c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x516df8['options']?_0x516df8[_0xf24c('0x1d')][_0xf24c('0x1e')]||null:null,'attributes':_0x516df8[_0xf24c('0x1d')]?_0x516df8[_0xf24c('0x1d')]['attributes']||null:null,'limit':_0x516df8[_0xf24c('0x1d')]?_0x516df8[_0xf24c('0x1d')][_0xf24c('0x1f')]||null:null,'include':_0x516df8['options']?_0x516df8['options'][_0xf24c('0x20')]?_[_0xf24c('0x21')](_0x516df8[_0xf24c('0x1d')][_0xf24c('0x20')],function(_0x622aeb){return{'model':db[_0x622aeb[_0xf24c('0x22')]],'as':_0x622aeb['as'],'attributes':_0x622aeb['attributes'],'include':_0x622aeb[_0xf24c('0x20')]?_[_0xf24c('0x21')](_0x622aeb[_0xf24c('0x20')],function(_0x389688){return{'model':db[_0x389688[_0xf24c('0x22')]],'as':_0x389688['as'],'attributes':_0x389688[_0xf24c('0x23')],'include':_0x389688['include']?_['map'](_0x389688['include'],function(_0xfc67e1){return{'model':db[_0xfc67e1['model']],'as':_0xfc67e1['as'],'attributes':_0xfc67e1[_0xf24c('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf24c('0x24')](function(_0x6baadd){logger[_0xf24c('0x10')]('GetWhatsappQueue',_0x516df8);logger[_0xf24c('0x13')](_0xf24c('0x1a'),_0x516df8,JSON[_0xf24c('0x14')](_0x6baadd));_0x4dae4e(_0x6baadd);})[_0xf24c('0x19')](function(_0x2fbd6a){logger[_0xf24c('0x15')]('GetWhatsappQueue',_0x2fbd6a[_0xf24c('0x17')],_0x516df8);_0x59b000(_0x1d043b['error'](0x1f4,_0x2fbd6a[_0xf24c('0x17')]));});});};exports[_0xf24c('0x25')]=function(_0x25ca7d){var _0x3bf5a7=this;return new Promise(function(_0x31e854,_0xe982a0){return db[_0xf24c('0x1b')][_0xf24c('0x26')]({'raw':_0x25ca7d[_0xf24c('0x1d')]?_0x25ca7d[_0xf24c('0x1d')][_0xf24c('0x27')]===undefined?!![]:![]:!![],'where':_0x25ca7d[_0xf24c('0x1d')]?_0x25ca7d[_0xf24c('0x1d')][_0xf24c('0x1e')]||null:null,'attributes':_0x25ca7d[_0xf24c('0x1d')]?_0x25ca7d[_0xf24c('0x1d')]['attributes']||null:null,'include':_0x25ca7d[_0xf24c('0x1d')]?_0x25ca7d[_0xf24c('0x1d')]['include']?_[_0xf24c('0x21')](_0x25ca7d[_0xf24c('0x1d')][_0xf24c('0x20')],function(_0x350cdf){return{'model':db[_0x350cdf['model']],'as':_0x350cdf['as'],'attributes':_0x350cdf[_0xf24c('0x23')],'include':_0x350cdf[_0xf24c('0x20')]?_[_0xf24c('0x21')](_0x350cdf['include'],function(_0x1b014a){return{'model':db[_0x1b014a[_0xf24c('0x22')]],'as':_0x1b014a['as'],'attributes':_0x1b014a[_0xf24c('0x23')],'include':_0x1b014a[_0xf24c('0x20')]?_['map'](_0x1b014a[_0xf24c('0x20')],function(_0x3b06e8){return{'model':db[_0x3b06e8[_0xf24c('0x22')]],'as':_0x3b06e8['as'],'attributes':_0x3b06e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xf24c('0x24')](function(_0x21dc1f){logger[_0xf24c('0x10')](_0xf24c('0x25'),_0x25ca7d);logger[_0xf24c('0x13')](_0xf24c('0x25'),_0x25ca7d,JSON[_0xf24c('0x14')](_0x21dc1f));_0x31e854(_0x21dc1f);})['catch'](function(_0x187564){logger[_0xf24c('0x15')](_0xf24c('0x25'),_0x187564[_0xf24c('0x17')],_0x25ca7d);_0xe982a0(_0x3bf5a7[_0xf24c('0x15')](0x1f4,_0x187564[_0xf24c('0x17')]));});});}; \ No newline at end of file +var _0xd6c1=['message','catch','GetWhatsappQueue','findAll','options','where','attributes','limit','include','map','model','ShowWhatsappQueue','find','raw','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x304123,_0x31caa9){var _0x50c2a3=function(_0xfcdc76){while(--_0xfcdc76){_0x304123['push'](_0x304123['shift']());}};_0x50c2a3(++_0x31caa9);}(_0xd6c1,0x1d6));var _0x1d6c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd6c1[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x1d6c('0x0'));var util=require(_0x1d6c('0x1'));var moment=require('moment');var BPromise=require(_0x1d6c('0x2'));var rs=require(_0x1d6c('0x3'));var fs=require('fs');var Redis=require(_0x1d6c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d6c('0x5'));var logger=require('../../config/logger')(_0x1d6c('0x6'));var config=require(_0x1d6c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d6c('0x8')][_0x1d6c('0x9')]({'port':0x232a});config[_0x1d6c('0xa')]=_[_0x1d6c('0xb')](config[_0x1d6c('0xa')],{'host':_0x1d6c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d6c('0xa')]));require(_0x1d6c('0xd'))[_0x1d6c('0xe')](socket);function respondWithRpcPromise(_0x51adf0,_0x495c72,_0x4aeeda){return new BPromise(function(_0x2732b6,_0x946681){return client[_0x1d6c('0xf')](_0x51adf0,_0x4aeeda)[_0x1d6c('0x10')](function(_0x445116){logger[_0x1d6c('0x11')](_0x1d6c('0x12'),_0x495c72,'request\x20sent');logger[_0x1d6c('0x13')](_0x1d6c('0x14'),_0x495c72,_0x1d6c('0x15'),JSON[_0x1d6c('0x16')](_0x445116));if(_0x445116[_0x1d6c('0x17')]){if(_0x445116[_0x1d6c('0x17')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x495c72,_0x445116[_0x1d6c('0x17')][_0x1d6c('0x18')]);return _0x946681(_0x445116[_0x1d6c('0x17')]['message']);}logger[_0x1d6c('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x495c72,_0x445116['error'][_0x1d6c('0x18')]);return _0x2732b6(_0x445116[_0x1d6c('0x17')]['message']);}else{logger[_0x1d6c('0x11')](_0x1d6c('0x12'),_0x495c72,_0x1d6c('0x15'));_0x2732b6(_0x445116['result'][_0x1d6c('0x18')]);}})[_0x1d6c('0x19')](function(_0x2fb877){logger[_0x1d6c('0x17')](_0x1d6c('0x12'),_0x495c72,_0x2fb877);_0x946681(_0x2fb877);});});}exports[_0x1d6c('0x1a')]=function(_0x2dce23){var _0x2837d3=this;return new Promise(function(_0x508fbe,_0x9a9f70){return db['WhatsappQueue'][_0x1d6c('0x1b')]({'raw':_0x2dce23['options']?_0x2dce23['options']['raw']===undefined?!![]:![]:!![],'where':_0x2dce23['options']?_0x2dce23[_0x1d6c('0x1c')][_0x1d6c('0x1d')]||null:null,'attributes':_0x2dce23[_0x1d6c('0x1c')]?_0x2dce23[_0x1d6c('0x1c')][_0x1d6c('0x1e')]||null:null,'limit':_0x2dce23[_0x1d6c('0x1c')]?_0x2dce23['options'][_0x1d6c('0x1f')]||null:null,'include':_0x2dce23[_0x1d6c('0x1c')]?_0x2dce23[_0x1d6c('0x1c')][_0x1d6c('0x20')]?_[_0x1d6c('0x21')](_0x2dce23[_0x1d6c('0x1c')][_0x1d6c('0x20')],function(_0x47b75c){return{'model':db[_0x47b75c[_0x1d6c('0x22')]],'as':_0x47b75c['as'],'attributes':_0x47b75c[_0x1d6c('0x1e')],'include':_0x47b75c[_0x1d6c('0x20')]?_[_0x1d6c('0x21')](_0x47b75c[_0x1d6c('0x20')],function(_0x4a9717){return{'model':db[_0x4a9717[_0x1d6c('0x22')]],'as':_0x4a9717['as'],'attributes':_0x4a9717[_0x1d6c('0x1e')],'include':_0x4a9717['include']?_[_0x1d6c('0x21')](_0x4a9717[_0x1d6c('0x20')],function(_0x33faba){return{'model':db[_0x33faba[_0x1d6c('0x22')]],'as':_0x33faba['as'],'attributes':_0x33faba[_0x1d6c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1d6c('0x10')](function(_0x4e7f93){logger[_0x1d6c('0x11')](_0x1d6c('0x1a'),_0x2dce23);logger[_0x1d6c('0x13')]('GetWhatsappQueue',_0x2dce23,JSON[_0x1d6c('0x16')](_0x4e7f93));_0x508fbe(_0x4e7f93);})['catch'](function(_0xbc801){logger['error'](_0x1d6c('0x1a'),_0xbc801[_0x1d6c('0x18')],_0x2dce23);_0x9a9f70(_0x2837d3[_0x1d6c('0x17')](0x1f4,_0xbc801['message']));});});};exports[_0x1d6c('0x23')]=function(_0x3eedb5){var _0x12298d=this;return new Promise(function(_0x30928e,_0x1678c1){return db['WhatsappQueue'][_0x1d6c('0x24')]({'raw':_0x3eedb5['options']?_0x3eedb5['options'][_0x1d6c('0x25')]===undefined?!![]:![]:!![],'where':_0x3eedb5[_0x1d6c('0x1c')]?_0x3eedb5[_0x1d6c('0x1c')][_0x1d6c('0x1d')]||null:null,'attributes':_0x3eedb5[_0x1d6c('0x1c')]?_0x3eedb5[_0x1d6c('0x1c')][_0x1d6c('0x1e')]||null:null,'include':_0x3eedb5[_0x1d6c('0x1c')]?_0x3eedb5[_0x1d6c('0x1c')][_0x1d6c('0x20')]?_[_0x1d6c('0x21')](_0x3eedb5[_0x1d6c('0x1c')][_0x1d6c('0x20')],function(_0x157829){return{'model':db[_0x157829[_0x1d6c('0x22')]],'as':_0x157829['as'],'attributes':_0x157829[_0x1d6c('0x1e')],'include':_0x157829['include']?_[_0x1d6c('0x21')](_0x157829[_0x1d6c('0x20')],function(_0x1a461f){return{'model':db[_0x1a461f[_0x1d6c('0x22')]],'as':_0x1a461f['as'],'attributes':_0x1a461f[_0x1d6c('0x1e')],'include':_0x1a461f[_0x1d6c('0x20')]?_[_0x1d6c('0x21')](_0x1a461f[_0x1d6c('0x20')],function(_0x280fac){return{'model':db[_0x280fac['model']],'as':_0x280fac['as'],'attributes':_0x280fac[_0x1d6c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1d6c('0x10')](function(_0x47b491){logger[_0x1d6c('0x11')](_0x1d6c('0x23'),_0x3eedb5);logger['debug'](_0x1d6c('0x23'),_0x3eedb5,JSON['stringify'](_0x47b491));_0x30928e(_0x47b491);})['catch'](function(_0x2d83fb){logger[_0x1d6c('0x17')]('ShowWhatsappQueue',_0x2d83fb[_0x1d6c('0x18')],_0x3eedb5);_0x1678c1(_0x12298d[_0x1d6c('0x17')](0x1f4,_0x2d83fb[_0x1d6c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index e008bef..c2961f6 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 _0x203d=['./whatsappQueue.events','remove','update','emit','removeListener','register','length','whatsappQueue:'];(function(_0x1422dd,_0x4465cf){var _0x304e54=function(_0xb46c63){while(--_0xb46c63){_0x1422dd['push'](_0x1422dd['shift']());}};_0x304e54(++_0x4465cf);}(_0x203d,0xc8));var _0xd203=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x203d[_0xb833b1];return _0x1ab87a;};'use strict';var WhatsappQueueEvents=require(_0xd203('0x0'));var events=['save',_0xd203('0x1'),_0xd203('0x2')];function createListener(_0x5bd63e,_0x11d3f6){return function(_0x4dcfbc){_0x11d3f6[_0xd203('0x3')](_0x5bd63e,_0x4dcfbc);};}function removeListener(_0x411b41,_0x3ccb30){return function(){WhatsappQueueEvents[_0xd203('0x4')](_0x411b41,_0x3ccb30);};}exports[_0xd203('0x5')]=function(_0x5bcebb){for(var _0x5deb86=0x0,_0x329701=events[_0xd203('0x6')];_0x5deb86<_0x329701;_0x5deb86++){var _0x70b46c=events[_0x5deb86];var _0x1f551e=createListener(_0xd203('0x7')+_0x70b46c,_0x5bcebb);WhatsappQueueEvents['on'](_0x70b46c,_0x1f551e);}}; \ No newline at end of file +var _0x58bb=['update','emit','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x2958f8,_0x1b8fda){var _0x1a02c0=function(_0x47642c){while(--_0x47642c){_0x2958f8['push'](_0x2958f8['shift']());}};_0x1a02c0(++_0x1b8fda);}(_0x58bb,0x14d));var _0xb58b=function(_0x46f731,_0x5d7fdc){_0x46f731=_0x46f731-0x0;var _0x33b46e=_0x58bb[_0x46f731];return _0x33b46e;};'use strict';var WhatsappQueueEvents=require(_0xb58b('0x0'));var events=[_0xb58b('0x1'),_0xb58b('0x2'),_0xb58b('0x3')];function createListener(_0x38cd63,_0x2cb1aa){return function(_0x23efff){_0x2cb1aa[_0xb58b('0x4')](_0x38cd63,_0x23efff);};}function removeListener(_0xc47d6e,_0x5069bb){return function(){WhatsappQueueEvents['removeListener'](_0xc47d6e,_0x5069bb);};}exports['register']=function(_0x95cf52){for(var _0x526f65=0x0,_0x14a47a=events[_0xb58b('0x5')];_0x526f65<_0x14a47a;_0x526f65++){var _0x322e3e=events[_0x526f65];var _0x451dfb=createListener(_0xb58b('0x6')+_0x322e3e,_0x95cf52);WhatsappQueueEvents['on'](_0x322e3e,_0x451dfb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 348f607..e04fa16 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 _0xb8d9=['../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','multer','connect-timeout','express'];(function(_0x4801a0,_0x252c24){var _0x338e26=function(_0x1599c2){while(--_0x1599c2){_0x4801a0['push'](_0x4801a0['shift']());}};_0x338e26(++_0x252c24);}(_0xb8d9,0x11a));var _0x9b8d=function(_0x1e736c,_0x4ea18c){_0x1e736c=_0x1e736c-0x0;var _0x38c68d=_0xb8d9[_0x1e736c];return _0x38c68d;};'use strict';var multer=require(_0x9b8d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9b8d('0x1'));var express=require(_0x9b8d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9b8d('0x3'));var config=require('../../config/environment');var controller=require(_0x9b8d('0x4'));router[_0x9b8d('0x5')]('/',auth[_0x9b8d('0x6')](),controller['index']);router[_0x9b8d('0x5')]('/describe',auth[_0x9b8d('0x6')](),controller[_0x9b8d('0x7')]);router[_0x9b8d('0x5')](_0x9b8d('0x8'),auth[_0x9b8d('0x6')](),controller[_0x9b8d('0x9')]);router['post']('/',auth[_0x9b8d('0x6')](),controller[_0x9b8d('0xa')]);router[_0x9b8d('0xb')]('/:id',auth[_0x9b8d('0x6')](),controller[_0x9b8d('0xc')]);router[_0x9b8d('0xd')](_0x9b8d('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x9b8d('0xe')]=router; \ No newline at end of file +var _0x0279=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','create','put','/:id','destroy','exports','multer','util'];(function(_0x506c82,_0x1e9814){var _0x9b637f=function(_0x312560){while(--_0x312560){_0x506c82['push'](_0x506c82['shift']());}};_0x9b637f(++_0x1e9814);}(_0x0279,0x75));var _0x9027=function(_0x2a27de,_0x4aaa18){_0x2a27de=_0x2a27de-0x0;var _0x4335d=_0x0279[_0x2a27de];return _0x4335d;};'use strict';var multer=require(_0x9027('0x0'));var util=require(_0x9027('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9027('0x2'));var router=express[_0x9027('0x3')]();var fs_extra=require(_0x9027('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9027('0x5'));var config=require(_0x9027('0x6'));var controller=require(_0x9027('0x7'));router[_0x9027('0x8')]('/',auth[_0x9027('0x9')](),controller[_0x9027('0xa')]);router[_0x9027('0x8')](_0x9027('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x9027('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9027('0xc')]);router[_0x9027('0xd')](_0x9027('0xe'),auth[_0x9027('0x9')](),controller['update']);router['delete'](_0x9027('0xe'),auth[_0x9027('0x9')](),controller[_0x9027('0xf')]);module[_0x9027('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 362eb15..0489cbe 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4c7d81,_0x2a698c){var _0x1aa6bd=function(_0x31ecc8){while(--_0x31ecc8){_0x4c7d81['push'](_0x4c7d81['shift']());}};_0x1aa6bd(++_0x2a698c);}(_0x7a54,0x106));var _0x47a5=function(_0xbc0126,_0x3999e5){_0xbc0126=_0xbc0126-0x0;var _0x3458d6=_0x7a54[_0xbc0126];return _0x3458d6;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2e266c,_0x1582d9){var _0x24eb7e=function(_0x426494){while(--_0x426494){_0x2e266c['push'](_0x2e266c['shift']());}};_0x24eb7e(++_0x1582d9);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index bb5832f..8b102c9 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 _0x84a0=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','then','name','map','WhatsappQueueReport'];(function(_0x2c94ad,_0x13e8be){var _0x4b6732=function(_0x6d3c2a){while(--_0x6d3c2a){_0x2c94ad['push'](_0x2c94ad['shift']());}};_0x4b6732(++_0x13e8be);}(_0x84a0,0x66));var _0x084a=function(_0x9c473d,_0x102fa4){_0x9c473d=_0x9c473d-0x0;var _0x25369d=_0x84a0[_0x9c473d];return _0x25369d;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];function respondWithStatusCode(_0x3ca72f,_0xec90a5){_0xec90a5=_0xec90a5||0xcc;return function(_0x9245b1){if(_0x9245b1){return _0x3ca72f[_0x084a('0x18')](_0xec90a5);}return _0x3ca72f[_0x084a('0x19')](_0xec90a5)[_0x084a('0x1a')]();};}function respondWithResult(_0x3a76d1,_0x5aef40){_0x5aef40=_0x5aef40||0xc8;return function(_0x4277c9){if(_0x4277c9){return _0x3a76d1['status'](_0x5aef40)[_0x084a('0x1b')](_0x4277c9);}};}function respondWithFilteredResult(_0x3ccaca,_0x366624){return function(_0x2d35b8){if(_0x2d35b8){var _0xd20527=typeof _0x366624['offset']===_0x084a('0x1c')&&typeof _0x366624['limit']===_0x084a('0x1c');var _0x355b45=_0x2d35b8['count'];var _0xf2c333=_0xd20527?0x0:_0x366624[_0x084a('0x1d')];var _0x4134b9=_0xd20527?_0x2d35b8[_0x084a('0x1e')]:_0x366624[_0x084a('0x1d')]+_0x366624[_0x084a('0x1f')];var _0x447a19;if(_0x4134b9>=_0x355b45){_0x4134b9=_0x355b45;_0x447a19=0xc8;}else{_0x447a19=0xce;}_0x3ccaca[_0x084a('0x19')](_0x447a19);return _0x3ccaca[_0x084a('0x20')](_0x084a('0x21'),_0xf2c333+'-'+_0x4134b9+'/'+_0x355b45)[_0x084a('0x1b')](_0x2d35b8);}return null;};}function patchUpdates(_0x279e25){return function(_0x116328){try{jsonpatch[_0x084a('0x22')](_0x116328,_0x279e25,!![]);}catch(_0xf0dd98){return BPromise['reject'](_0xf0dd98);}return _0x116328[_0x084a('0x23')]();};}function saveUpdates(_0x1ad257,_0x41a90f){return function(_0x2d62bf){if(_0x2d62bf){return _0x2d62bf[_0x084a('0x24')](_0x1ad257)['then'](function(_0x755c24){return _0x755c24;});}return null;};}function removeEntity(_0x288e9e,_0x6346a5){return function(_0x1f2c9f){if(_0x1f2c9f){return _0x1f2c9f[_0x084a('0x25')]()[_0x084a('0x26')](function(){_0x288e9e['status'](0xcc)[_0x084a('0x1a')]();});}};}function handleEntityNotFound(_0x2af138,_0x54233b){return function(_0x5b1474){if(!_0x5b1474){_0x2af138[_0x084a('0x18')](0x194);}return _0x5b1474;};}function handleError(_0x3dd8b9,_0xfc9b8c){_0xfc9b8c=_0xfc9b8c||0x1f4;return function(_0x4c5658){logger['error'](_0x4c5658['stack']);if(_0x4c5658['name']){delete _0x4c5658[_0x084a('0x27')];}_0x3dd8b9['status'](_0xfc9b8c)['send'](_0x4c5658);};}exports['index']=function(_0x3b8176,_0x4651e6){var _0x388062={},_0x2c4149={},_0x3be7a6={'count':0x0,'rows':[]};var _0x25a2a1=_[_0x084a('0x28')](db[_0x084a('0x29')]['rawAttributes'],function(_0x2ed3cd){return{'name':_0x2ed3cd[_0x084a('0x2a')],'type':_0x2ed3cd['type'][_0x084a('0x2b')]};});_0x2c4149[_0x084a('0x2c')]=_[_0x084a('0x28')](_0x25a2a1,_0x084a('0x27'));_0x2c4149[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0x3b8176[_0x084a('0x2d')]);_0x2c4149[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x2c4149[_0x084a('0x2c')],_0x2c4149[_0x084a('0x2d')]);_0x388062[_0x084a('0x31')]=_[_0x084a('0x30')](_0x2c4149['model'],qs['fields'](_0x3b8176[_0x084a('0x2d')][_0x084a('0x32')]));_0x388062[_0x084a('0x31')]=_0x388062[_0x084a('0x31')][_0x084a('0x33')]?_0x388062['attributes']:_0x2c4149[_0x084a('0x2c')];if(!_0x3b8176[_0x084a('0x2d')][_0x084a('0x34')]('nolimit')){_0x388062[_0x084a('0x1f')]=qs[_0x084a('0x1f')](_0x3b8176[_0x084a('0x2d')]['limit']);_0x388062['offset']=qs['offset'](_0x3b8176[_0x084a('0x2d')][_0x084a('0x1d')]);}_0x388062[_0x084a('0x35')]=qs['sort'](_0x3b8176[_0x084a('0x2d')][_0x084a('0x36')]);_0x388062[_0x084a('0x37')]=qs[_0x084a('0x2f')](_[_0x084a('0x38')](_0x3b8176[_0x084a('0x2d')],_0x2c4149[_0x084a('0x2f')]),_0x25a2a1);if(_0x3b8176[_0x084a('0x2d')][_0x084a('0x39')]){_0x388062[_0x084a('0x37')]=_[_0x084a('0x3a')](_0x388062[_0x084a('0x37')],{'$or':_[_0x084a('0x28')](_0x25a2a1,function(_0x1659d3){if(_0x1659d3[_0x084a('0x3b')]!=='VIRTUAL'){var _0x220f88={};_0x220f88[_0x1659d3[_0x084a('0x27')]]={'$like':'%'+_0x3b8176[_0x084a('0x2d')][_0x084a('0x39')]+'%'};return _0x220f88;}})});}_0x388062=_[_0x084a('0x3a')]({},_0x388062,_0x3b8176[_0x084a('0x3c')]);var _0xa7b652={'where':_0x388062[_0x084a('0x37')]};return db[_0x084a('0x29')]['count'](_0xa7b652)[_0x084a('0x26')](function(_0x3d1aa5){_0x3be7a6[_0x084a('0x1e')]=_0x3d1aa5;if(_0x3b8176[_0x084a('0x2d')][_0x084a('0x3d')]){_0x388062[_0x084a('0x3e')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x084a('0x3f')](_0x388062);})[_0x084a('0x26')](function(_0x55c5f4){_0x3be7a6[_0x084a('0x40')]=_0x55c5f4;return _0x3be7a6;})[_0x084a('0x26')](respondWithFilteredResult(_0x4651e6,_0x388062))[_0x084a('0x41')](handleError(_0x4651e6,null));};exports['show']=function(_0x1aa4ea,_0xba1081){var _0x4fe9c2={'raw':!![],'where':{'id':_0x1aa4ea[_0x084a('0x42')]['id']}},_0x3e2b92={};_0x3e2b92['model']=_['keys'](db[_0x084a('0x29')][_0x084a('0x43')]);_0x3e2b92[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0x1aa4ea[_0x084a('0x2d')]);_0x3e2b92[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x3e2b92[_0x084a('0x2c')],_0x3e2b92[_0x084a('0x2d')]);_0x4fe9c2[_0x084a('0x31')]=_[_0x084a('0x30')](_0x3e2b92['model'],qs['fields'](_0x1aa4ea[_0x084a('0x2d')][_0x084a('0x32')]));_0x4fe9c2[_0x084a('0x31')]=_0x4fe9c2['attributes'][_0x084a('0x33')]?_0x4fe9c2[_0x084a('0x31')]:_0x3e2b92[_0x084a('0x2c')];if(_0x1aa4ea[_0x084a('0x2d')][_0x084a('0x3d')]){_0x4fe9c2['include']=[{'all':!![]}];}_0x4fe9c2=_[_0x084a('0x3a')]({},_0x4fe9c2,_0x1aa4ea['options']);return db[_0x084a('0x29')][_0x084a('0x44')](_0x4fe9c2)[_0x084a('0x26')](handleEntityNotFound(_0xba1081,null))['then'](respondWithResult(_0xba1081,null))['catch'](handleError(_0xba1081,null));};exports[_0x084a('0x45')]=function(_0xef8fc7,_0x505965){return db[_0x084a('0x29')][_0x084a('0x45')](_0xef8fc7[_0x084a('0x46')],{})[_0x084a('0x26')](respondWithResult(_0x505965,0xc9))['catch'](handleError(_0x505965,null));};exports[_0x084a('0x24')]=function(_0x865368,_0x31677b){if(_0x865368[_0x084a('0x46')]['id']){delete _0x865368['body']['id'];}return db[_0x084a('0x29')][_0x084a('0x44')]({'where':{'id':_0x865368[_0x084a('0x42')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x31677b,null))['then'](saveUpdates(_0x865368['body'],null))[_0x084a('0x26')](respondWithResult(_0x31677b,null))[_0x084a('0x41')](handleError(_0x31677b,null));};exports[_0x084a('0x25')]=function(_0x264f09,_0xf936e){return db[_0x084a('0x29')][_0x084a('0x44')]({'where':{'id':_0x264f09[_0x084a('0x42')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0xf936e,null))[_0x084a('0x26')](removeEntity(_0xf936e,null))[_0x084a('0x41')](handleError(_0xf936e,null));};exports[_0x084a('0x47')]=function(_0x4fe1b5,_0xcdd5b){return db[_0x084a('0x29')][_0x084a('0x47')]()[_0x084a('0x26')](respondWithResult(_0xcdd5b,null))[_0x084a('0x41')](handleError(_0xcdd5b,null));}; \ No newline at end of file +var _0xf7b4=['../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','WhatsappQueueReport','rows','catch','show','params','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','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'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5ea3b1,_0x16189f){_0x5ea3b1=_0x5ea3b1-0x0;var _0x35d4b7=_0xf7b4[_0x5ea3b1];return _0x35d4b7;};'use strict';var emlformat=require(_0x4f7b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f7b('0x1'));var rp=require(_0x4f7b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f7b('0x3'));var util=require(_0x4f7b('0x4'));var path=require(_0x4f7b('0x5'));var sox=require(_0x4f7b('0x6'));var csv=require(_0x4f7b('0x7'));var ejs=require(_0x4f7b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f7b('0x9'));var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd9b349,_0x2e8dd9){_0x2e8dd9=_0x2e8dd9||0xcc;return function(_0x3c55e1){if(_0x3c55e1){return _0xd9b349[_0x4f7b('0x17')](_0x2e8dd9);}return _0xd9b349['status'](_0x2e8dd9)[_0x4f7b('0x18')]();};}function respondWithResult(_0x368091,_0x407cee){_0x407cee=_0x407cee||0xc8;return function(_0x43a51a){if(_0x43a51a){return _0x368091[_0x4f7b('0x19')](_0x407cee)[_0x4f7b('0x1a')](_0x43a51a);}};}function respondWithFilteredResult(_0x40ecb0,_0x2437cc){return function(_0x260667){if(_0x260667){var _0x29fdd5=typeof _0x2437cc[_0x4f7b('0x1b')]===_0x4f7b('0x1c')&&typeof _0x2437cc['limit']===_0x4f7b('0x1c');var _0x496322=_0x260667['count'];var _0x24e5cf=_0x29fdd5?0x0:_0x2437cc[_0x4f7b('0x1b')];var _0x519d90=_0x29fdd5?_0x260667[_0x4f7b('0x1d')]:_0x2437cc[_0x4f7b('0x1b')]+_0x2437cc[_0x4f7b('0x1e')];var _0xf2311f;if(_0x519d90>=_0x496322){_0x519d90=_0x496322;_0xf2311f=0xc8;}else{_0xf2311f=0xce;}_0x40ecb0['status'](_0xf2311f);return _0x40ecb0[_0x4f7b('0x1f')]('Content-Range',_0x24e5cf+'-'+_0x519d90+'/'+_0x496322)[_0x4f7b('0x1a')](_0x260667);}return null;};}function patchUpdates(_0x12374b){return function(_0xa2f54e){try{jsonpatch[_0x4f7b('0x20')](_0xa2f54e,_0x12374b,!![]);}catch(_0x27127b){return BPromise[_0x4f7b('0x21')](_0x27127b);}return _0xa2f54e[_0x4f7b('0x22')]();};}function saveUpdates(_0x1f545e,_0x2a8b50){return function(_0x5508bd){if(_0x5508bd){return _0x5508bd[_0x4f7b('0x23')](_0x1f545e)[_0x4f7b('0x24')](function(_0x2c9ea6){return _0x2c9ea6;});}return null;};}function removeEntity(_0x5bd43f,_0x150f57){return function(_0x4610a4){if(_0x4610a4){return _0x4610a4['destroy']()[_0x4f7b('0x24')](function(){_0x5bd43f['status'](0xcc)[_0x4f7b('0x18')]();});}};}function handleEntityNotFound(_0x2429be,_0x23c820){return function(_0x278c41){if(!_0x278c41){_0x2429be[_0x4f7b('0x17')](0x194);}return _0x278c41;};}function handleError(_0x94478b,_0x181e13){_0x181e13=_0x181e13||0x1f4;return function(_0x3ad769){logger['error'](_0x3ad769[_0x4f7b('0x25')]);if(_0x3ad769[_0x4f7b('0x26')]){delete _0x3ad769[_0x4f7b('0x26')];}_0x94478b['status'](_0x181e13)[_0x4f7b('0x27')](_0x3ad769);};}exports[_0x4f7b('0x28')]=function(_0x1db684,_0x3a56ff){var _0x1ccce0={},_0x4ebffa={},_0xac1f93={'count':0x0,'rows':[]};var _0x3331b2=_[_0x4f7b('0x29')](db['WhatsappQueueReport'][_0x4f7b('0x2a')],function(_0x5d13a1){return{'name':_0x5d13a1['fieldName'],'type':_0x5d13a1[_0x4f7b('0x2b')]['key']};});_0x4ebffa[_0x4f7b('0x2c')]=_[_0x4f7b('0x29')](_0x3331b2,_0x4f7b('0x26'));_0x4ebffa[_0x4f7b('0x2d')]=_[_0x4f7b('0x2e')](_0x1db684[_0x4f7b('0x2d')]);_0x4ebffa[_0x4f7b('0x2f')]=_[_0x4f7b('0x30')](_0x4ebffa[_0x4f7b('0x2c')],_0x4ebffa[_0x4f7b('0x2d')]);_0x1ccce0[_0x4f7b('0x31')]=_[_0x4f7b('0x30')](_0x4ebffa[_0x4f7b('0x2c')],qs[_0x4f7b('0x32')](_0x1db684[_0x4f7b('0x2d')][_0x4f7b('0x32')]));_0x1ccce0[_0x4f7b('0x31')]=_0x1ccce0[_0x4f7b('0x31')][_0x4f7b('0x33')]?_0x1ccce0[_0x4f7b('0x31')]:_0x4ebffa[_0x4f7b('0x2c')];if(!_0x1db684[_0x4f7b('0x2d')]['hasOwnProperty'](_0x4f7b('0x34'))){_0x1ccce0['limit']=qs[_0x4f7b('0x1e')](_0x1db684[_0x4f7b('0x2d')]['limit']);_0x1ccce0[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x1db684[_0x4f7b('0x2d')]['offset']);}_0x1ccce0[_0x4f7b('0x35')]=qs[_0x4f7b('0x36')](_0x1db684[_0x4f7b('0x2d')][_0x4f7b('0x36')]);_0x1ccce0[_0x4f7b('0x37')]=qs[_0x4f7b('0x2f')](_[_0x4f7b('0x38')](_0x1db684['query'],_0x4ebffa[_0x4f7b('0x2f')]),_0x3331b2);if(_0x1db684['query'][_0x4f7b('0x39')]){_0x1ccce0[_0x4f7b('0x37')]=_[_0x4f7b('0x3a')](_0x1ccce0['where'],{'$or':_[_0x4f7b('0x29')](_0x3331b2,function(_0x53da14){if(_0x53da14[_0x4f7b('0x2b')]!==_0x4f7b('0x3b')){var _0x49644e={};_0x49644e[_0x53da14['name']]={'$like':'%'+_0x1db684[_0x4f7b('0x2d')]['filter']+'%'};return _0x49644e;}})});}_0x1ccce0=_[_0x4f7b('0x3a')]({},_0x1ccce0,_0x1db684[_0x4f7b('0x3c')]);var _0x54f9e8={'where':_0x1ccce0[_0x4f7b('0x37')]};return db['WhatsappQueueReport']['count'](_0x54f9e8)['then'](function(_0x1e4421){_0xac1f93[_0x4f7b('0x1d')]=_0x1e4421;if(_0x1db684[_0x4f7b('0x2d')][_0x4f7b('0x3d')]){_0x1ccce0['include']=[{'all':!![]}];}return db[_0x4f7b('0x3e')]['findAll'](_0x1ccce0);})[_0x4f7b('0x24')](function(_0x586406){_0xac1f93[_0x4f7b('0x3f')]=_0x586406;return _0xac1f93;})['then'](respondWithFilteredResult(_0x3a56ff,_0x1ccce0))[_0x4f7b('0x40')](handleError(_0x3a56ff,null));};exports[_0x4f7b('0x41')]=function(_0x302163,_0x3ab08f){var _0x2986cd={'raw':!![],'where':{'id':_0x302163[_0x4f7b('0x42')]['id']}},_0x325cd6={};_0x325cd6[_0x4f7b('0x2c')]=_[_0x4f7b('0x2e')](db[_0x4f7b('0x3e')][_0x4f7b('0x2a')]);_0x325cd6[_0x4f7b('0x2d')]=_[_0x4f7b('0x2e')](_0x302163[_0x4f7b('0x2d')]);_0x325cd6[_0x4f7b('0x2f')]=_[_0x4f7b('0x30')](_0x325cd6[_0x4f7b('0x2c')],_0x325cd6[_0x4f7b('0x2d')]);_0x2986cd['attributes']=_['intersection'](_0x325cd6[_0x4f7b('0x2c')],qs[_0x4f7b('0x32')](_0x302163[_0x4f7b('0x2d')][_0x4f7b('0x32')]));_0x2986cd['attributes']=_0x2986cd['attributes'][_0x4f7b('0x33')]?_0x2986cd[_0x4f7b('0x31')]:_0x325cd6[_0x4f7b('0x2c')];if(_0x302163[_0x4f7b('0x2d')]['includeAll']){_0x2986cd['include']=[{'all':!![]}];}_0x2986cd=_[_0x4f7b('0x3a')]({},_0x2986cd,_0x302163[_0x4f7b('0x3c')]);return db[_0x4f7b('0x3e')][_0x4f7b('0x43')](_0x2986cd)[_0x4f7b('0x24')](handleEntityNotFound(_0x3ab08f,null))['then'](respondWithResult(_0x3ab08f,null))[_0x4f7b('0x40')](handleError(_0x3ab08f,null));};exports[_0x4f7b('0x44')]=function(_0x35c0ea,_0x5df68e){return db[_0x4f7b('0x3e')][_0x4f7b('0x44')](_0x35c0ea[_0x4f7b('0x45')],{})[_0x4f7b('0x24')](respondWithResult(_0x5df68e,0xc9))[_0x4f7b('0x40')](handleError(_0x5df68e,null));};exports[_0x4f7b('0x23')]=function(_0xee485,_0x2e563f){if(_0xee485[_0x4f7b('0x45')]['id']){delete _0xee485[_0x4f7b('0x45')]['id'];}return db['WhatsappQueueReport'][_0x4f7b('0x43')]({'where':{'id':_0xee485[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x2e563f,null))['then'](saveUpdates(_0xee485[_0x4f7b('0x45')],null))[_0x4f7b('0x24')](respondWithResult(_0x2e563f,null))[_0x4f7b('0x40')](handleError(_0x2e563f,null));};exports[_0x4f7b('0x46')]=function(_0x145dd7,_0x7e624){return db[_0x4f7b('0x3e')][_0x4f7b('0x43')]({'where':{'id':_0x145dd7[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x24')](handleEntityNotFound(_0x7e624,null))['then'](removeEntity(_0x7e624,null))[_0x4f7b('0x40')](handleError(_0x7e624,null));};exports[_0x4f7b('0x47')]=function(_0x12b6a6,_0x4d1ac9){return db[_0x4f7b('0x3e')][_0x4f7b('0x47')]()[_0x4f7b('0x24')](respondWithResult(_0x4d1ac9,null))[_0x4f7b('0x40')](handleError(_0x4d1ac9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ef8beea..b05f16b 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 _0xfce6=['rimraf','../../config/environment','./whatsappQueueReport.attributes','define','uniqueid','lodash','util','api','moment','request-promise','path'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0xfce6,0x94));var _0x6fce=function(_0x2b7de5,_0x1c41d0){_0x2b7de5=_0x2b7de5-0x0;var _0x2b4613=_0xfce6[_0x2b7de5];return _0x2b4613;};'use strict';var _=require(_0x6fce('0x0'));var util=require(_0x6fce('0x1'));var logger=require('../../config/logger')(_0x6fce('0x2'));var moment=require(_0x6fce('0x3'));var BPromise=require('bluebird');var rp=require(_0x6fce('0x4'));var fs=require('fs');var path=require(_0x6fce('0x5'));var rimraf=require(_0x6fce('0x6'));var config=require(_0x6fce('0x7'));var attributes=require(_0x6fce('0x8'));module['exports']=function(_0x2dff9d,_0x2acfca){return _0x2dff9d[_0x6fce('0x9')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x6fce('0xa'),'fields':[_0x6fce('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd62=['bluebird','request-promise','rimraf','../../config/environment','exports','define','WhatsappQueueReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x174977,_0x117c44){var _0x2d400b=function(_0x3c4c8f){while(--_0x3c4c8f){_0x174977['push'](_0x174977['shift']());}};_0x2d400b(++_0x117c44);}(_0xfd62,0x74));var _0x2fd6=function(_0x15e837,_0x320ca8){_0x15e837=_0x15e837-0x0;var _0x201018=_0xfd62[_0x15e837];return _0x201018;};'use strict';var _=require('lodash');var util=require(_0x2fd6('0x0'));var logger=require(_0x2fd6('0x1'))(_0x2fd6('0x2'));var moment=require(_0x2fd6('0x3'));var BPromise=require(_0x2fd6('0x4'));var rp=require(_0x2fd6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fd6('0x6'));var config=require(_0x2fd6('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x2fd6('0x8')]=function(_0x2e4fd0,_0x3e4e88){return _0x2e4fd0[_0x2fd6('0x9')](_0x2fd6('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x2fd6('0xb'),'fields':[_0x2fd6('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 6f26ff4..005f295 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 _0x200a=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','body','where','attributes'];(function(_0x4266d5,_0x4b9d46){var _0x23ac3f=function(_0x34be93){while(--_0x34be93){_0x4266d5['push'](_0x4266d5['shift']());}};_0x23ac3f(++_0x4b9d46);}(_0x200a,0xf8));var _0xa200=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x200a[_0x1529a3];return _0x1a0d4b;};'use strict';var _=require(_0xa200('0x0'));var util=require(_0xa200('0x1'));var moment=require('moment');var BPromise=require(_0xa200('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa200('0x3'));var db=require(_0xa200('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa200('0x5'))(_0xa200('0x6'));var config=require(_0xa200('0x7'));var jayson=require(_0xa200('0x8'));var client=jayson['client'][_0xa200('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26d020,_0x2912b8,_0xf7685e){return new BPromise(function(_0x5df8c8,_0x204803){return client[_0xa200('0xa')](_0x26d020,_0xf7685e)[_0xa200('0xb')](function(_0x3a0c93){logger['info'](_0xa200('0xc'),_0x2912b8,_0xa200('0xd'));logger[_0xa200('0xe')](_0xa200('0xf'),_0x2912b8,'request\x20sent',JSON[_0xa200('0x10')](_0x3a0c93));if(_0x3a0c93['error']){if(_0x3a0c93['error'][_0xa200('0x11')]===0x1f4){logger[_0xa200('0x12')](_0xa200('0xc'),_0x2912b8,_0x3a0c93[_0xa200('0x12')][_0xa200('0x13')]);return _0x204803(_0x3a0c93[_0xa200('0x12')][_0xa200('0x13')]);}logger['error'](_0xa200('0xc'),_0x2912b8,_0x3a0c93['error'][_0xa200('0x13')]);return _0x5df8c8(_0x3a0c93[_0xa200('0x12')]['message']);}else{logger[_0xa200('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2912b8,'request\x20sent');_0x5df8c8(_0x3a0c93['result'][_0xa200('0x13')]);}})[_0xa200('0x15')](function(_0x54dc79){logger[_0xa200('0x12')](_0xa200('0xc'),_0x2912b8,_0x54dc79);_0x204803(_0x54dc79);});});}exports[_0xa200('0x16')]=function(_0x37d326){var _0x5b9830=this;return new Promise(function(_0x553c89,_0x5cd6f9){return db[_0xa200('0x17')][_0xa200('0x18')](_0x37d326['body'],{'raw':_0x37d326[_0xa200('0x19')]?_0x37d326[_0xa200('0x19')][_0xa200('0x1a')]===undefined?!![]:![]:!![]})[_0xa200('0xb')](function(_0x130944){logger[_0xa200('0x14')](_0xa200('0x16'),_0x37d326);logger['debug'](_0xa200('0x16'),_0x37d326,JSON[_0xa200('0x10')](_0x130944));_0x553c89(_0x130944);})[_0xa200('0x15')](function(_0x103f1f){logger[_0xa200('0x12')]('CreateWhatsappQueueReport',_0x103f1f[_0xa200('0x13')],_0x37d326);_0x5cd6f9(_0x5b9830[_0xa200('0x12')](0x1f4,_0x103f1f[_0xa200('0x13')]));});});};exports[_0xa200('0x1b')]=function(_0x137b83){var _0x3d0239=this;return new Promise(function(_0xd182be,_0x331105){return db[_0xa200('0x17')]['update'](_0x137b83[_0xa200('0x1c')],{'raw':_0x137b83[_0xa200('0x19')]?_0x137b83[_0xa200('0x19')][_0xa200('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137b83[_0xa200('0x19')]?_0x137b83[_0xa200('0x19')][_0xa200('0x1d')]||null:null,'attributes':_0x137b83[_0xa200('0x19')]?_0x137b83['options'][_0xa200('0x1e')]||null:null,'limit':_0x137b83[_0xa200('0x19')]?_0x137b83[_0xa200('0x19')]['limit']||null:null})[_0xa200('0xb')](function(_0x1ffd3f){logger[_0xa200('0x14')](_0xa200('0x1b'),_0x137b83);logger[_0xa200('0xe')](_0xa200('0x1b'),_0x137b83,JSON[_0xa200('0x10')](_0x1ffd3f));_0xd182be(_0x1ffd3f);})[_0xa200('0x15')](function(_0x39a36f){logger[_0xa200('0x12')](_0xa200('0x1b'),_0x39a36f['message'],_0x137b83);_0x331105(_0x3d0239['error'](0x1f4,_0x39a36f[_0xa200('0x13')]));});});}; \ No newline at end of file +var _0xbf47=['stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','update','raw','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','error','message','catch','WhatsappQueueReport,\x20%s,\x20%s','CreateWhatsappQueueReport','create','body','options','debug'];(function(_0x4cc8e2,_0x1aa3d6){var _0x140ea5=function(_0x2d60a5){while(--_0x2d60a5){_0x4cc8e2['push'](_0x4cc8e2['shift']());}};_0x140ea5(++_0x1aa3d6);}(_0xbf47,0x16f));var _0x7bf4=function(_0x2de2ed,_0x28cd92){_0x2de2ed=_0x2de2ed-0x0;var _0x5edd69=_0xbf47[_0x2de2ed];return _0x5edd69;};'use strict';var _=require(_0x7bf4('0x0'));var util=require('util');var moment=require(_0x7bf4('0x1'));var BPromise=require(_0x7bf4('0x2'));var rs=require(_0x7bf4('0x3'));var fs=require('fs');var Redis=require(_0x7bf4('0x4'));var db=require(_0x7bf4('0x5'))['db'];var utils=require(_0x7bf4('0x6'));var logger=require(_0x7bf4('0x7'))(_0x7bf4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7bf4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27b1cf,_0x29c997,_0x41a366){return new BPromise(function(_0xf6c894,_0x16cee0){return client[_0x7bf4('0xa')](_0x27b1cf,_0x41a366)[_0x7bf4('0xb')](function(_0x13dda9){logger[_0x7bf4('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x29c997,_0x7bf4('0xd'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x29c997,_0x7bf4('0xd'),JSON['stringify'](_0x13dda9));if(_0x13dda9[_0x7bf4('0xe')]){if(_0x13dda9['error']['code']===0x1f4){logger[_0x7bf4('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x29c997,_0x13dda9['error']['message']);return _0x16cee0(_0x13dda9[_0x7bf4('0xe')][_0x7bf4('0xf')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x29c997,_0x13dda9[_0x7bf4('0xe')]['message']);return _0xf6c894(_0x13dda9[_0x7bf4('0xe')][_0x7bf4('0xf')]);}else{logger[_0x7bf4('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x29c997,'request\x20sent');_0xf6c894(_0x13dda9['result'][_0x7bf4('0xf')]);}})[_0x7bf4('0x10')](function(_0x39fb0c){logger[_0x7bf4('0xe')](_0x7bf4('0x11'),_0x29c997,_0x39fb0c);_0x16cee0(_0x39fb0c);});});}exports[_0x7bf4('0x12')]=function(_0x19b9e0){var _0x5a0f8a=this;return new Promise(function(_0x3c5b2b,_0x3b0963){return db['WhatsappQueueReport'][_0x7bf4('0x13')](_0x19b9e0[_0x7bf4('0x14')],{'raw':_0x19b9e0[_0x7bf4('0x15')]?_0x19b9e0['options']['raw']===undefined?!![]:![]:!![]})[_0x7bf4('0xb')](function(_0x4c34c3){logger[_0x7bf4('0xc')](_0x7bf4('0x12'),_0x19b9e0);logger[_0x7bf4('0x16')](_0x7bf4('0x12'),_0x19b9e0,JSON[_0x7bf4('0x17')](_0x4c34c3));_0x3c5b2b(_0x4c34c3);})[_0x7bf4('0x10')](function(_0x53a82d){logger[_0x7bf4('0xe')]('CreateWhatsappQueueReport',_0x53a82d[_0x7bf4('0xf')],_0x19b9e0);_0x3b0963(_0x5a0f8a[_0x7bf4('0xe')](0x1f4,_0x53a82d['message']));});});};exports[_0x7bf4('0x18')]=function(_0x277f58){var _0x11f5b3=this;return new Promise(function(_0x27b9b7,_0x5da71c){return db[_0x7bf4('0x19')][_0x7bf4('0x1a')](_0x277f58[_0x7bf4('0x14')],{'raw':_0x277f58[_0x7bf4('0x15')]?_0x277f58['options'][_0x7bf4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x277f58['options']?_0x277f58[_0x7bf4('0x15')][_0x7bf4('0x1c')]||null:null,'attributes':_0x277f58[_0x7bf4('0x15')]?_0x277f58[_0x7bf4('0x15')]['attributes']||null:null,'limit':_0x277f58[_0x7bf4('0x15')]?_0x277f58['options'][_0x7bf4('0x1d')]||null:null})[_0x7bf4('0xb')](function(_0x46de7a){logger['info'](_0x7bf4('0x18'),_0x277f58);logger['debug']('UpdateWhatsappQueueReport',_0x277f58,JSON[_0x7bf4('0x17')](_0x46de7a));_0x27b9b7(_0x46de7a);})[_0x7bf4('0x10')](function(_0x1f0cd3){logger[_0x7bf4('0xe')](_0x7bf4('0x18'),_0x1f0cd3[_0x7bf4('0xf')],_0x277f58);_0x5da71c(_0x11f5b3[_0x7bf4('0xe')](0x1f4,_0x1f0cd3[_0x7bf4('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4b34763..5690d0d 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 _0x22f8=['get','isAuthenticated','describe','/:id','show','create','put','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','index'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x22f8,0x13b));var _0x822f=function(_0x76e09b,_0x5d18a3){_0x76e09b=_0x76e09b-0x0;var _0xd18014=_0x22f8[_0x76e09b];return _0xd18014;};'use strict';var multer=require(_0x822f('0x0'));var util=require(_0x822f('0x1'));var path=require(_0x822f('0x2'));var timeout=require('connect-timeout');var express=require(_0x822f('0x3'));var router=express['Router']();var fs_extra=require(_0x822f('0x4'));var auth=require(_0x822f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x822f('0x6'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x822f('0x7')]);router[_0x822f('0x8')]('/describe',auth[_0x822f('0x9')](),controller[_0x822f('0xa')]);router[_0x822f('0x8')](_0x822f('0xb'),auth[_0x822f('0x9')](),controller[_0x822f('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x822f('0xd')]);router[_0x822f('0xe')](_0x822f('0xb'),auth[_0x822f('0x9')](),controller[_0x822f('0xf')]);router[_0x822f('0x10')](_0x822f('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5a09=['/describe','describe','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index'];(function(_0x599570,_0xecc72a){var _0x28f859=function(_0x2530dc){while(--_0x2530dc){_0x599570['push'](_0x599570['shift']());}};_0x28f859(++_0xecc72a);}(_0x5a09,0x11b));var _0x95a0=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x5a09[_0x49fcfb];return _0x964926;};'use strict';var multer=require(_0x95a0('0x0'));var util=require(_0x95a0('0x1'));var path=require(_0x95a0('0x2'));var timeout=require(_0x95a0('0x3'));var express=require('express');var router=express[_0x95a0('0x4')]();var fs_extra=require(_0x95a0('0x5'));var auth=require(_0x95a0('0x6'));var interaction=require(_0x95a0('0x7'));var config=require('../../config/environment');var controller=require(_0x95a0('0x8'));router[_0x95a0('0x9')]('/',auth['isAuthenticated'](),controller[_0x95a0('0xa')]);router[_0x95a0('0x9')](_0x95a0('0xb'),auth['isAuthenticated'](),controller[_0x95a0('0xc')]);router[_0x95a0('0x9')](_0x95a0('0xd'),auth[_0x95a0('0xe')](),controller[_0x95a0('0xf')]);router[_0x95a0('0x10')]('/',auth[_0x95a0('0xe')](),controller['create']);router[_0x95a0('0x11')](_0x95a0('0xd'),auth[_0x95a0('0xe')](),controller['update']);router[_0x95a0('0x12')]('/:id',auth[_0x95a0('0xe')](),controller[_0x95a0('0x13')]);module[_0x95a0('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index a5a9658..72b95f3 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 _0x98d8=['account','agent','queue','sequelize','exports','STRING','ENUM'];(function(_0x170bfd,_0x2347f5){var _0xc216b7=function(_0x86700b){while(--_0x86700b){_0x170bfd['push'](_0x170bfd['shift']());}};_0xc216b7(++_0x2347f5);}(_0x98d8,0xce));var _0x898d=function(_0x180bc5,_0x17fd8d){_0x180bc5=_0x180bc5-0x0;var _0x310566=_0x98d8[_0x180bc5];return _0x310566;};'use strict';var Sequelize=require(_0x898d('0x0'));module[_0x898d('0x1')]={'uniqueid':{'type':Sequelize[_0x898d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x898d('0x3')](_0x898d('0x4'),_0x898d('0x5'),_0x898d('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xadcc=['ENUM','account','agent','queue','sequelize','STRING'];(function(_0x1259bb,_0x530c54){var _0x43fadd=function(_0x5301f2){while(--_0x5301f2){_0x1259bb['push'](_0x1259bb['shift']());}};_0x43fadd(++_0x530c54);}(_0xadcc,0x76));var _0xcadc=function(_0x2f8de4,_0x2025ae){_0x2f8de4=_0x2f8de4-0x0;var _0x2dc577=_0xadcc[_0x2f8de4];return _0x2dc577;};'use strict';var Sequelize=require(_0xcadc('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xcadc('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xcadc('0x2')](_0xcadc('0x3'),_0xcadc('0x4'),_0xcadc('0x5')),'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 3766a11..de5ac88 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 _0x3149=['params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x5abcc9,_0x1e6359){var _0x3169bb=function(_0x3ef704){while(--_0x3ef704){_0x5abcc9['push'](_0x5abcc9['shift']());}};_0x3169bb(++_0x1e6359);}(_0x3149,0x181));var _0x9314=function(_0x2a20ab,_0x4ab2a5){_0x2a20ab=_0x2a20ab-0x0;var _0xb4887c=_0x3149[_0x2a20ab];return _0xb4887c;};'use strict';var emlformat=require(_0x9314('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9314('0x1'));var jsonpatch=require(_0x9314('0x2'));var rp=require(_0x9314('0x3'));var moment=require(_0x9314('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9314('0x5'));var util=require(_0x9314('0x6'));var path=require(_0x9314('0x7'));var sox=require(_0x9314('0x8'));var csv=require(_0x9314('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9314('0xa'));var _=require(_0x9314('0xb'));var squel=require(_0x9314('0xc'));var crypto=require(_0x9314('0xd'));var jsforce=require(_0x9314('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9314('0x9'));var querystring=require('querystring');var Papa=require(_0x9314('0xf'));var Redis=require('ioredis');var authService=require(_0x9314('0x10'));var qs=require(_0x9314('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9314('0x12'));var logger=require('../../config/logger')(_0x9314('0x13'));var utils=require(_0x9314('0x14'));var config=require(_0x9314('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9314('0x16'))['db'];function respondWithStatusCode(_0x23fa9b,_0x4363a0){_0x4363a0=_0x4363a0||0xcc;return function(_0x172b9a){if(_0x172b9a){return _0x23fa9b[_0x9314('0x17')](_0x4363a0);}return _0x23fa9b[_0x9314('0x18')](_0x4363a0)[_0x9314('0x19')]();};}function respondWithResult(_0x577d5e,_0x227027){_0x227027=_0x227027||0xc8;return function(_0x397f13){if(_0x397f13){return _0x577d5e[_0x9314('0x18')](_0x227027)['json'](_0x397f13);}};}function respondWithFilteredResult(_0x3bdd1b,_0x2728db){return function(_0x3cc9bf){if(_0x3cc9bf){var _0x5c3ad0=typeof _0x2728db[_0x9314('0x1a')]===_0x9314('0x1b')&&typeof _0x2728db['limit']===_0x9314('0x1b');var _0x1f5571=_0x3cc9bf[_0x9314('0x1c')];var _0x563a71=_0x5c3ad0?0x0:_0x2728db['offset'];var _0x9dcb3c=_0x5c3ad0?_0x3cc9bf['count']:_0x2728db[_0x9314('0x1a')]+_0x2728db[_0x9314('0x1d')];var _0x16b36f;if(_0x9dcb3c>=_0x1f5571){_0x9dcb3c=_0x1f5571;_0x16b36f=0xc8;}else{_0x16b36f=0xce;}_0x3bdd1b[_0x9314('0x18')](_0x16b36f);return _0x3bdd1b[_0x9314('0x1e')](_0x9314('0x1f'),_0x563a71+'-'+_0x9dcb3c+'/'+_0x1f5571)['json'](_0x3cc9bf);}return null;};}function patchUpdates(_0x1046ae){return function(_0x3250ae){try{jsonpatch[_0x9314('0x20')](_0x3250ae,_0x1046ae,!![]);}catch(_0x5c5976){return BPromise[_0x9314('0x21')](_0x5c5976);}return _0x3250ae[_0x9314('0x22')]();};}function saveUpdates(_0x345dda,_0x1dfba0){return function(_0x5881e6){if(_0x5881e6){return _0x5881e6[_0x9314('0x23')](_0x345dda)[_0x9314('0x24')](function(_0x14b58d){return _0x14b58d;});}return null;};}function removeEntity(_0x2a4212,_0x535e05){return function(_0x2b5047){if(_0x2b5047){return _0x2b5047[_0x9314('0x25')]()[_0x9314('0x24')](function(){_0x2a4212['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x430144,_0x24d781){return function(_0x242096){if(!_0x242096){_0x430144[_0x9314('0x17')](0x194);}return _0x242096;};}function handleError(_0x5f6c11,_0x496dc6){_0x496dc6=_0x496dc6||0x1f4;return function(_0x4af880){logger[_0x9314('0x26')](_0x4af880[_0x9314('0x27')]);if(_0x4af880['name']){delete _0x4af880[_0x9314('0x28')];}_0x5f6c11[_0x9314('0x18')](_0x496dc6)[_0x9314('0x29')](_0x4af880);};}exports[_0x9314('0x2a')]=function(_0x239822,_0x4d16fa){var _0x10a9c4={},_0x282929={},_0x9242d7={'count':0x0,'rows':[]};var _0x4b8544=_[_0x9314('0x2b')](db[_0x9314('0x2c')][_0x9314('0x2d')],function(_0x60a0b0){return{'name':_0x60a0b0[_0x9314('0x2e')],'type':_0x60a0b0[_0x9314('0x2f')]['key']};});_0x282929['model']=_[_0x9314('0x2b')](_0x4b8544,_0x9314('0x28'));_0x282929['query']=_[_0x9314('0x30')](_0x239822['query']);_0x282929[_0x9314('0x31')]=_[_0x9314('0x32')](_0x282929[_0x9314('0x33')],_0x282929[_0x9314('0x34')]);_0x10a9c4[_0x9314('0x35')]=_[_0x9314('0x32')](_0x282929[_0x9314('0x33')],qs[_0x9314('0x36')](_0x239822[_0x9314('0x34')][_0x9314('0x36')]));_0x10a9c4['attributes']=_0x10a9c4[_0x9314('0x35')][_0x9314('0x37')]?_0x10a9c4[_0x9314('0x35')]:_0x282929[_0x9314('0x33')];if(!_0x239822[_0x9314('0x34')][_0x9314('0x38')](_0x9314('0x39'))){_0x10a9c4[_0x9314('0x1d')]=qs['limit'](_0x239822[_0x9314('0x34')][_0x9314('0x1d')]);_0x10a9c4[_0x9314('0x1a')]=qs[_0x9314('0x1a')](_0x239822[_0x9314('0x34')]['offset']);}_0x10a9c4[_0x9314('0x3a')]=qs[_0x9314('0x3b')](_0x239822['query'][_0x9314('0x3b')]);_0x10a9c4[_0x9314('0x3c')]=qs[_0x9314('0x31')](_['pick'](_0x239822[_0x9314('0x34')],_0x282929[_0x9314('0x31')]),_0x4b8544);if(_0x239822[_0x9314('0x34')][_0x9314('0x3d')]){_0x10a9c4[_0x9314('0x3c')]=_[_0x9314('0x3e')](_0x10a9c4[_0x9314('0x3c')],{'$or':_[_0x9314('0x2b')](_0x4b8544,function(_0x529b12){if(_0x529b12[_0x9314('0x2f')]!==_0x9314('0x3f')){var _0x21666a={};_0x21666a[_0x529b12[_0x9314('0x28')]]={'$like':'%'+_0x239822[_0x9314('0x34')][_0x9314('0x3d')]+'%'};return _0x21666a;}})});}_0x10a9c4=_[_0x9314('0x3e')]({},_0x10a9c4,_0x239822[_0x9314('0x40')]);var _0x351690={'where':_0x10a9c4[_0x9314('0x3c')]};return db[_0x9314('0x2c')][_0x9314('0x1c')](_0x351690)[_0x9314('0x24')](function(_0xda3293){_0x9242d7[_0x9314('0x1c')]=_0xda3293;if(_0x239822[_0x9314('0x34')][_0x9314('0x41')]){_0x10a9c4[_0x9314('0x42')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x9314('0x43')](_0x10a9c4);})['then'](function(_0x598807){_0x9242d7[_0x9314('0x44')]=_0x598807;return _0x9242d7;})[_0x9314('0x24')](respondWithFilteredResult(_0x4d16fa,_0x10a9c4))[_0x9314('0x45')](handleError(_0x4d16fa,null));};exports[_0x9314('0x46')]=function(_0x5db511,_0x4d38ff){var _0x3fce84={'raw':!![],'where':{'id':_0x5db511[_0x9314('0x47')]['id']}},_0x541bb5={};_0x541bb5[_0x9314('0x33')]=_[_0x9314('0x30')](db[_0x9314('0x2c')][_0x9314('0x2d')]);_0x541bb5[_0x9314('0x34')]=_[_0x9314('0x30')](_0x5db511[_0x9314('0x34')]);_0x541bb5[_0x9314('0x31')]=_[_0x9314('0x32')](_0x541bb5[_0x9314('0x33')],_0x541bb5[_0x9314('0x34')]);_0x3fce84[_0x9314('0x35')]=_[_0x9314('0x32')](_0x541bb5[_0x9314('0x33')],qs[_0x9314('0x36')](_0x5db511[_0x9314('0x34')]['fields']));_0x3fce84[_0x9314('0x35')]=_0x3fce84[_0x9314('0x35')]['length']?_0x3fce84['attributes']:_0x541bb5['model'];if(_0x5db511[_0x9314('0x34')]['includeAll']){_0x3fce84[_0x9314('0x42')]=[{'all':!![]}];}_0x3fce84=_['merge']({},_0x3fce84,_0x5db511[_0x9314('0x40')]);return db[_0x9314('0x2c')][_0x9314('0x48')](_0x3fce84)[_0x9314('0x24')](handleEntityNotFound(_0x4d38ff,null))['then'](respondWithResult(_0x4d38ff,null))['catch'](handleError(_0x4d38ff,null));};exports[_0x9314('0x49')]=function(_0x2518ea,_0x3bf985){return db[_0x9314('0x2c')][_0x9314('0x49')](_0x2518ea['body'],{})[_0x9314('0x24')](respondWithResult(_0x3bf985,0xc9))[_0x9314('0x45')](handleError(_0x3bf985,null));};exports[_0x9314('0x23')]=function(_0x5ead5b,_0x1b947b){if(_0x5ead5b[_0x9314('0x4a')]['id']){delete _0x5ead5b['body']['id'];}return db['WhatsappTransferReport'][_0x9314('0x48')]({'where':{'id':_0x5ead5b[_0x9314('0x47')]['id']}})[_0x9314('0x24')](handleEntityNotFound(_0x1b947b,null))[_0x9314('0x24')](saveUpdates(_0x5ead5b['body'],null))[_0x9314('0x24')](respondWithResult(_0x1b947b,null))[_0x9314('0x45')](handleError(_0x1b947b,null));};exports[_0x9314('0x25')]=function(_0x1e3c92,_0x1b0adb){return db[_0x9314('0x2c')][_0x9314('0x48')]({'where':{'id':_0x1e3c92[_0x9314('0x47')]['id']}})[_0x9314('0x24')](handleEntityNotFound(_0x1b0adb,null))[_0x9314('0x24')](removeEntity(_0x1b0adb,null))[_0x9314('0x45')](handleError(_0x1b0adb,null));};exports['describe']=function(_0x5c691e,_0x3d2780){return db[_0x9314('0x2c')][_0x9314('0x4b')]()['then'](respondWithResult(_0x3d2780,null))['catch'](handleError(_0x3d2780,null));}; \ No newline at end of file +var _0x898a=['save','update','then','destroy','error','rawAttributes','fieldName','type','key','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','WhatsappTransferReport','includeAll','rows','catch','show','include','find','create','body','params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject'];(function(_0x1a0cdb,_0x5d69ad){var _0x23619d=function(_0x4aeb95){while(--_0x4aeb95){_0x1a0cdb['push'](_0x1a0cdb['shift']());}};_0x23619d(++_0x5d69ad);}(_0x898a,0xbb));var _0xa898=function(_0x3a835c,_0x1d5744){_0x3a835c=_0x3a835c-0x0;var _0x1099f2=_0x898a[_0x3a835c];return _0x1099f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa898('0x0'));var zipdir=require(_0xa898('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa898('0x2'));var moment=require(_0xa898('0x3'));var BPromise=require(_0xa898('0x4'));var Mustache=require(_0xa898('0x5'));var util=require(_0xa898('0x6'));var path=require(_0xa898('0x7'));var sox=require(_0xa898('0x8'));var csv=require('to-csv');var ejs=require(_0xa898('0x9'));var fs=require('fs');var fs_extra=require(_0xa898('0xa'));var _=require(_0xa898('0xb'));var squel=require('squel');var crypto=require(_0xa898('0xc'));var jsforce=require(_0xa898('0xd'));var deskjs=require(_0xa898('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa898('0xf'));var Papa=require(_0xa898('0x10'));var Redis=require(_0xa898('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa898('0x12'));var hardwareService=require(_0xa898('0x13'));var logger=require(_0xa898('0x14'))(_0xa898('0x15'));var utils=require(_0xa898('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa898('0x17'));var db=require(_0xa898('0x18'))['db'];function respondWithStatusCode(_0x5f2bce,_0xdc536f){_0xdc536f=_0xdc536f||0xcc;return function(_0xd8cd5d){if(_0xd8cd5d){return _0x5f2bce[_0xa898('0x19')](_0xdc536f);}return _0x5f2bce[_0xa898('0x1a')](_0xdc536f)[_0xa898('0x1b')]();};}function respondWithResult(_0x1acc63,_0x18d2f7){_0x18d2f7=_0x18d2f7||0xc8;return function(_0x3ed2e5){if(_0x3ed2e5){return _0x1acc63[_0xa898('0x1a')](_0x18d2f7)['json'](_0x3ed2e5);}};}function respondWithFilteredResult(_0x1dc9ce,_0x42acd0){return function(_0xfd123e){if(_0xfd123e){var _0x371a6d=typeof _0x42acd0[_0xa898('0x1c')]===_0xa898('0x1d')&&typeof _0x42acd0['limit']==='undefined';var _0x52be7f=_0xfd123e[_0xa898('0x1e')];var _0x587979=_0x371a6d?0x0:_0x42acd0[_0xa898('0x1c')];var _0x451d45=_0x371a6d?_0xfd123e[_0xa898('0x1e')]:_0x42acd0[_0xa898('0x1c')]+_0x42acd0['limit'];var _0x283122;if(_0x451d45>=_0x52be7f){_0x451d45=_0x52be7f;_0x283122=0xc8;}else{_0x283122=0xce;}_0x1dc9ce['status'](_0x283122);return _0x1dc9ce[_0xa898('0x1f')](_0xa898('0x20'),_0x587979+'-'+_0x451d45+'/'+_0x52be7f)['json'](_0xfd123e);}return null;};}function patchUpdates(_0x735705){return function(_0x3780fd){try{jsonpatch[_0xa898('0x21')](_0x3780fd,_0x735705,!![]);}catch(_0x10c526){return BPromise[_0xa898('0x22')](_0x10c526);}return _0x3780fd[_0xa898('0x23')]();};}function saveUpdates(_0xb0066d,_0x4f1189){return function(_0x2264bc){if(_0x2264bc){return _0x2264bc[_0xa898('0x24')](_0xb0066d)[_0xa898('0x25')](function(_0xfe161e){return _0xfe161e;});}return null;};}function removeEntity(_0x4eda3c,_0x7c3a3c){return function(_0x450ae7){if(_0x450ae7){return _0x450ae7[_0xa898('0x26')]()['then'](function(){_0x4eda3c[_0xa898('0x1a')](0xcc)[_0xa898('0x1b')]();});}};}function handleEntityNotFound(_0x186c0d,_0x3f98f0){return function(_0x51fa8b){if(!_0x51fa8b){_0x186c0d['sendStatus'](0x194);}return _0x51fa8b;};}function handleError(_0xbbb616,_0x3e39b2){_0x3e39b2=_0x3e39b2||0x1f4;return function(_0x16d16c){logger[_0xa898('0x27')](_0x16d16c['stack']);if(_0x16d16c['name']){delete _0x16d16c['name'];}_0xbbb616[_0xa898('0x1a')](_0x3e39b2)['send'](_0x16d16c);};}exports['index']=function(_0x113f8e,_0x509d0c){var _0x165fce={},_0x5c0361={},_0xb06e50={'count':0x0,'rows':[]};var _0x56a3a0=_['map'](db['WhatsappTransferReport'][_0xa898('0x28')],function(_0x43b1b6){return{'name':_0x43b1b6[_0xa898('0x29')],'type':_0x43b1b6[_0xa898('0x2a')][_0xa898('0x2b')]};});_0x5c0361['model']=_[_0xa898('0x2c')](_0x56a3a0,_0xa898('0x2d'));_0x5c0361[_0xa898('0x2e')]=_[_0xa898('0x2f')](_0x113f8e[_0xa898('0x2e')]);_0x5c0361[_0xa898('0x30')]=_[_0xa898('0x31')](_0x5c0361[_0xa898('0x32')],_0x5c0361[_0xa898('0x2e')]);_0x165fce[_0xa898('0x33')]=_[_0xa898('0x31')](_0x5c0361[_0xa898('0x32')],qs[_0xa898('0x34')](_0x113f8e['query'][_0xa898('0x34')]));_0x165fce[_0xa898('0x33')]=_0x165fce[_0xa898('0x33')][_0xa898('0x35')]?_0x165fce[_0xa898('0x33')]:_0x5c0361['model'];if(!_0x113f8e['query'][_0xa898('0x36')](_0xa898('0x37'))){_0x165fce[_0xa898('0x38')]=qs[_0xa898('0x38')](_0x113f8e['query'][_0xa898('0x38')]);_0x165fce[_0xa898('0x1c')]=qs[_0xa898('0x1c')](_0x113f8e[_0xa898('0x2e')][_0xa898('0x1c')]);}_0x165fce[_0xa898('0x39')]=qs[_0xa898('0x3a')](_0x113f8e[_0xa898('0x2e')][_0xa898('0x3a')]);_0x165fce[_0xa898('0x3b')]=qs[_0xa898('0x30')](_[_0xa898('0x3c')](_0x113f8e[_0xa898('0x2e')],_0x5c0361['filters']),_0x56a3a0);if(_0x113f8e[_0xa898('0x2e')][_0xa898('0x3d')]){_0x165fce[_0xa898('0x3b')]=_[_0xa898('0x3e')](_0x165fce[_0xa898('0x3b')],{'$or':_[_0xa898('0x2c')](_0x56a3a0,function(_0x2154b1){if(_0x2154b1['type']!=='VIRTUAL'){var _0x5c54ec={};_0x5c54ec[_0x2154b1[_0xa898('0x2d')]]={'$like':'%'+_0x113f8e[_0xa898('0x2e')][_0xa898('0x3d')]+'%'};return _0x5c54ec;}})});}_0x165fce=_['merge']({},_0x165fce,_0x113f8e[_0xa898('0x3f')]);var _0x36708e={'where':_0x165fce[_0xa898('0x3b')]};return db[_0xa898('0x40')][_0xa898('0x1e')](_0x36708e)[_0xa898('0x25')](function(_0x170c3c){_0xb06e50[_0xa898('0x1e')]=_0x170c3c;if(_0x113f8e['query'][_0xa898('0x41')]){_0x165fce['include']=[{'all':!![]}];}return db[_0xa898('0x40')]['findAll'](_0x165fce);})['then'](function(_0x52451c){_0xb06e50[_0xa898('0x42')]=_0x52451c;return _0xb06e50;})[_0xa898('0x25')](respondWithFilteredResult(_0x509d0c,_0x165fce))[_0xa898('0x43')](handleError(_0x509d0c,null));};exports[_0xa898('0x44')]=function(_0x38df98,_0x2fa129){var _0x58d78e={'raw':!![],'where':{'id':_0x38df98['params']['id']}},_0x113975={};_0x113975[_0xa898('0x32')]=_[_0xa898('0x2f')](db[_0xa898('0x40')][_0xa898('0x28')]);_0x113975[_0xa898('0x2e')]=_[_0xa898('0x2f')](_0x38df98['query']);_0x113975[_0xa898('0x30')]=_[_0xa898('0x31')](_0x113975['model'],_0x113975[_0xa898('0x2e')]);_0x58d78e[_0xa898('0x33')]=_[_0xa898('0x31')](_0x113975['model'],qs['fields'](_0x38df98[_0xa898('0x2e')]['fields']));_0x58d78e[_0xa898('0x33')]=_0x58d78e['attributes'][_0xa898('0x35')]?_0x58d78e[_0xa898('0x33')]:_0x113975[_0xa898('0x32')];if(_0x38df98[_0xa898('0x2e')][_0xa898('0x41')]){_0x58d78e[_0xa898('0x45')]=[{'all':!![]}];}_0x58d78e=_['merge']({},_0x58d78e,_0x38df98[_0xa898('0x3f')]);return db[_0xa898('0x40')][_0xa898('0x46')](_0x58d78e)['then'](handleEntityNotFound(_0x2fa129,null))[_0xa898('0x25')](respondWithResult(_0x2fa129,null))[_0xa898('0x43')](handleError(_0x2fa129,null));};exports[_0xa898('0x47')]=function(_0x25f0a9,_0x1ee4c9){return db[_0xa898('0x40')][_0xa898('0x47')](_0x25f0a9['body'],{})[_0xa898('0x25')](respondWithResult(_0x1ee4c9,0xc9))[_0xa898('0x43')](handleError(_0x1ee4c9,null));};exports[_0xa898('0x24')]=function(_0x32c276,_0x2d2fea){if(_0x32c276[_0xa898('0x48')]['id']){delete _0x32c276[_0xa898('0x48')]['id'];}return db[_0xa898('0x40')][_0xa898('0x46')]({'where':{'id':_0x32c276[_0xa898('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d2fea,null))['then'](saveUpdates(_0x32c276[_0xa898('0x48')],null))[_0xa898('0x25')](respondWithResult(_0x2d2fea,null))[_0xa898('0x43')](handleError(_0x2d2fea,null));};exports['destroy']=function(_0x1267a4,_0x415e62){return db['WhatsappTransferReport'][_0xa898('0x46')]({'where':{'id':_0x1267a4[_0xa898('0x49')]['id']}})[_0xa898('0x25')](handleEntityNotFound(_0x415e62,null))[_0xa898('0x25')](removeEntity(_0x415e62,null))['catch'](handleError(_0x415e62,null));};exports['describe']=function(_0x3bb7a1,_0x34c7bb){return db['WhatsappTransferReport']['describe']()[_0xa898('0x25')](respondWithResult(_0x34c7bb,null))[_0xa898('0x43')](handleError(_0x34c7bb,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 0f2508c..38581a4 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 _0xfa0a=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport'];(function(_0x20bedd,_0x39694b){var _0x3041f3=function(_0x1f53ee){while(--_0x1f53ee){_0x20bedd['push'](_0x20bedd['shift']());}};_0x3041f3(++_0x39694b);}(_0xfa0a,0x91));var _0xafa0=function(_0xaff1d2,_0x423d2a){_0xaff1d2=_0xaff1d2-0x0;var _0x32f4ed=_0xfa0a[_0xaff1d2];return _0x32f4ed;};'use strict';var _=require(_0xafa0('0x0'));var util=require(_0xafa0('0x1'));var logger=require(_0xafa0('0x2'))(_0xafa0('0x3'));var moment=require(_0xafa0('0x4'));var BPromise=require(_0xafa0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xafa0('0x6'));var config=require('../../config/environment');var attributes=require(_0xafa0('0x7'));module[_0xafa0('0x8')]=function(_0x1ab6b6,_0xfc7b44){return _0x1ab6b6[_0xafa0('0x9')](_0xafa0('0xa'),attributes,{'tableName':_0xafa0('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xafa0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe1d2=['exports','report_whatsapp_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x383308,_0x47a155){var _0x287bfb=function(_0x304dcd){while(--_0x304dcd){_0x383308['push'](_0x383308['shift']());}};_0x287bfb(++_0x47a155);}(_0xe1d2,0xab));var _0x2e1d=function(_0x40ddfc,_0xb0486d){_0x40ddfc=_0x40ddfc-0x0;var _0x1cacc0=_0xe1d2[_0x40ddfc];return _0x1cacc0;};'use strict';var _=require(_0x2e1d('0x0'));var util=require(_0x2e1d('0x1'));var logger=require('../../config/logger')(_0x2e1d('0x2'));var moment=require(_0x2e1d('0x3'));var BPromise=require(_0x2e1d('0x4'));var rp=require(_0x2e1d('0x5'));var fs=require('fs');var path=require(_0x2e1d('0x6'));var rimraf=require('rimraf');var config=require(_0x2e1d('0x7'));var attributes=require(_0x2e1d('0x8'));module[_0x2e1d('0x9')]=function(_0x3cb92f,_0x29cf9b){return _0x3cb92f['define']('WhatsappTransferReport',attributes,{'tableName':_0x2e1d('0xa'),'paranoid':![],'indexes':[{'name':_0x2e1d('0xb'),'fields':[_0x2e1d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c0100cb..b0b10b9 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 _0x3102=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x287d9a,_0x73e23c){var _0x1ac1ab=function(_0x5d048e){while(--_0x5d048e){_0x287d9a['push'](_0x287d9a['shift']());}};_0x1ac1ab(++_0x73e23c);}(_0x3102,0x83));var _0x2310=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x3102[_0x44d9ab];return _0x31485e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2310('0x0'));var BPromise=require(_0x2310('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2310('0x2'));var db=require(_0x2310('0x3'))['db'];var utils=require(_0x2310('0x4'));var logger=require(_0x2310('0x5'))(_0x2310('0x6'));var config=require(_0x2310('0x7'));var jayson=require(_0x2310('0x8'));var client=jayson[_0x2310('0x9')][_0x2310('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11de11,_0x4e2269,_0x129960){return new BPromise(function(_0x5c10da,_0x4b04ab){return client['request'](_0x11de11,_0x129960)[_0x2310('0xb')](function(_0x14fb36){logger[_0x2310('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4e2269,_0x2310('0xd'));logger[_0x2310('0xe')](_0x2310('0xf'),_0x4e2269,_0x2310('0xd'),JSON[_0x2310('0x10')](_0x14fb36));if(_0x14fb36[_0x2310('0x11')]){if(_0x14fb36[_0x2310('0x11')]['code']===0x1f4){logger[_0x2310('0x11')](_0x2310('0x12'),_0x4e2269,_0x14fb36['error'][_0x2310('0x13')]);return _0x4b04ab(_0x14fb36[_0x2310('0x11')]['message']);}logger[_0x2310('0x11')](_0x2310('0x12'),_0x4e2269,_0x14fb36[_0x2310('0x11')][_0x2310('0x13')]);return _0x5c10da(_0x14fb36[_0x2310('0x11')][_0x2310('0x13')]);}else{logger[_0x2310('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4e2269,_0x2310('0xd'));_0x5c10da(_0x14fb36[_0x2310('0x14')][_0x2310('0x13')]);}})[_0x2310('0x15')](function(_0x11da86){logger[_0x2310('0x11')](_0x2310('0x12'),_0x4e2269,_0x11da86);_0x4b04ab(_0x11da86);});});} \ No newline at end of file +var _0xaae9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x478c37,_0x2c5f5f){var _0x2cf7c8=function(_0x57e334){while(--_0x57e334){_0x478c37['push'](_0x478c37['shift']());}};_0x2cf7c8(++_0x2c5f5f);}(_0xaae9,0x18e));var _0x9aae=function(_0x331f1a,_0xf1e493){_0x331f1a=_0x331f1a-0x0;var _0x5f4632=_0xaae9[_0x331f1a];return _0x5f4632;};'use strict';var _=require(_0x9aae('0x0'));var util=require(_0x9aae('0x1'));var moment=require(_0x9aae('0x2'));var BPromise=require(_0x9aae('0x3'));var rs=require(_0x9aae('0x4'));var fs=require('fs');var Redis=require(_0x9aae('0x5'));var db=require(_0x9aae('0x6'))['db'];var utils=require(_0x9aae('0x7'));var logger=require(_0x9aae('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9aae('0x9')][_0x9aae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77a20b,_0x182c66,_0x1f843b){return new BPromise(function(_0x431de2,_0x324746){return client['request'](_0x77a20b,_0x1f843b)[_0x9aae('0xb')](function(_0xbd3f4d){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x182c66,_0x9aae('0xc'));logger['debug'](_0x9aae('0xd'),_0x182c66,'request\x20sent',JSON[_0x9aae('0xe')](_0xbd3f4d));if(_0xbd3f4d[_0x9aae('0xf')]){if(_0xbd3f4d[_0x9aae('0xf')]['code']===0x1f4){logger[_0x9aae('0xf')](_0x9aae('0x10'),_0x182c66,_0xbd3f4d[_0x9aae('0xf')][_0x9aae('0x11')]);return _0x324746(_0xbd3f4d[_0x9aae('0xf')][_0x9aae('0x11')]);}logger['error'](_0x9aae('0x10'),_0x182c66,_0xbd3f4d[_0x9aae('0xf')][_0x9aae('0x11')]);return _0x431de2(_0xbd3f4d[_0x9aae('0xf')][_0x9aae('0x11')]);}else{logger[_0x9aae('0x12')](_0x9aae('0x10'),_0x182c66,_0x9aae('0xc'));_0x431de2(_0xbd3f4d['result'][_0x9aae('0x11')]);}})[_0x9aae('0x13')](function(_0x1ad285){logger[_0x9aae('0xf')](_0x9aae('0x10'),_0x182c66,_0x1ad285);_0x324746(_0x1ad285);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2a504d5..9d2fb6b 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8fb=['default','listen','info','start','filter','exitCode','number','length','map','name','join','Offline\x20apps:','status','online','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','seedDB'];(function(_0x1add93,_0x5f18f1){var _0x1996e0=function(_0x497508){while(--_0x497508){_0x1add93['push'](_0x1add93['shift']());}};_0x1996e0(++_0x5f18f1);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4069f3,_0x16be22){_0x4069f3=_0x4069f3-0x0;var _0x3cb8be=_0xd8fb[_0x4069f3];return _0x3cb8be;};'use strict';var _=require(_0xbd8f('0x0'));var db=require(_0xbd8f('0x1'))['db'];var seedDb=require(_0xbd8f('0x2'));var checkLicense=require(_0xbd8f('0x3'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require('./config/logger')(_0xbd8f('0x4'));var pm2=require(_0xbd8f('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xbd8f('0x6'));var chat=require(_0xbd8f('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xbd8f('0x8'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xbd8f('0x9')]['sync']()[_0xbd8f('0xa')](function(){if(config[_0xbd8f('0xb')]){return seedDb['default']();}})['then'](function(){return checkLicense[_0xbd8f('0xc')]();})[_0xbd8f('0xa')](function(){return rpc[_0xbd8f('0xd')]();})['then'](function(_0x255af3){logger[_0xbd8f('0xe')](_0x255af3);return chat['start']();})['then'](function(){return whatsapp[_0xbd8f('0xf')]();})[_0xbd8f('0xa')](function(){return schedule[_0xbd8f('0xf')]();})['then'](function(){return transcribe[_0xbd8f('0xf')]();})[_0xbd8f('0xa')](function(){return provider[_0xbd8f('0xf')]();})[_0xbd8f('0xa')](function(_0x8bc054){logger[_0xbd8f('0xe')](_0x8bc054);return pm2[_0xbd8f('0xf')](pm2Config);})[_0xbd8f('0xa')](function(_0x14606c){var _0x5e59ae=_0x14606c[_0xbd8f('0x10')](function(_0x829fb2){return typeof _0x829fb2[_0xbd8f('0x11')]===_0xbd8f('0x12')&&_0x829fb2['exitCode']>=0x0;});if(_0x5e59ae[_0xbd8f('0x13')]>0x0){throw new Error(_0x5e59ae[_0xbd8f('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xbd8f('0x14')](_0x5e59ae,function(_0xf5e7a){return'\x22'+_0xf5e7a['pm2_env'][_0xbd8f('0x15')]+'\x22';}));}logger[_0xbd8f('0xe')]('Online\x20apps:',_['map'](_[_0xbd8f('0x10')](_0x14606c,{'status':'online'}),'name')[_0xbd8f('0x16')]());logger['info'](_0xbd8f('0x17'),_[_0xbd8f('0x14')](_[_0xbd8f('0x10')](_0x14606c,function(_0x897f25){return _0x897f25[_0xbd8f('0x18')]!==_0xbd8f('0x19');}),_0xbd8f('0x15'))[_0xbd8f('0x16')]()||_0xbd8f('0x1a'));console[_0xbd8f('0x1b')](_0xbd8f('0x1c'));})[_0xbd8f('0x1d')](function(_0x2f7c45){console[_0xbd8f('0x1b')](_0xbd8f('0x1e'),_0x2f7c45);logger[_0xbd8f('0x1f')](_0xbd8f('0x20'),_0x2f7c45);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x43fd=['app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','Online\x20apps:','filter','online','name','join','Offline\x20apps:','map','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/environment'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x43fd,0x1ec));var _0xd43f=function(_0x30335e,_0x5046f0){_0x30335e=_0x30335e-0x0;var _0x10ecaa=_0x43fd[_0x30335e];return _0x10ecaa;};'use strict';var _=require('lodash');var db=require(_0xd43f('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0xd43f('0x1'));var config=require(_0xd43f('0x2'));var logger=require('./config/logger')(_0xd43f('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0xd43f('0x4'));var schedule=require(_0xd43f('0x5'));var chat=require(_0xd43f('0x6'));var whatsapp=require(_0xd43f('0x7'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xd43f('0x8'));function main(){return db[_0xd43f('0x9')][_0xd43f('0xa')]()[_0xd43f('0xb')](function(){if(config['seedDB']){return seedDb[_0xd43f('0xc')]();}})[_0xd43f('0xb')](function(){return checkLicense['default']();})[_0xd43f('0xb')](function(){return rpc[_0xd43f('0xd')]();})[_0xd43f('0xb')](function(_0x1a91e9){logger[_0xd43f('0xe')](_0x1a91e9);return chat['start']();})[_0xd43f('0xb')](function(){return whatsapp[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(){return schedule[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(){return transcribe[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(){return provider[_0xd43f('0xf')]();})[_0xd43f('0xb')](function(_0x1bed70){logger[_0xd43f('0xe')](_0x1bed70);return pm2['start'](pm2Config);})[_0xd43f('0xb')](function(_0x922f49){var _0x41be43=_0x922f49['filter'](function(_0x4c576e){return typeof _0x4c576e['exitCode']===_0xd43f('0x10')&&_0x4c576e[_0xd43f('0x11')]>=0x0;});if(_0x41be43['length']>0x0){throw new Error(_0x41be43[_0xd43f('0x12')]+_0xd43f('0x13')+_['map'](_0x41be43,function(_0x5ced70){return'\x22'+_0x5ced70['pm2_env']['name']+'\x22';}));}logger[_0xd43f('0xe')](_0xd43f('0x14'),_['map'](_[_0xd43f('0x15')](_0x922f49,{'status':_0xd43f('0x16')}),_0xd43f('0x17'))[_0xd43f('0x18')]());logger['info'](_0xd43f('0x19'),_[_0xd43f('0x1a')](_[_0xd43f('0x15')](_0x922f49,function(_0x564261){return _0x564261['status']!=='online';}),_0xd43f('0x17'))[_0xd43f('0x18')]()||_0xd43f('0x1b'));console[_0xd43f('0x1c')](_0xd43f('0x1d'));})[_0xd43f('0x1e')](function(_0x296a77){console['log'](_0xd43f('0x1f'),_0x296a77);logger['error'](_0xd43f('0x20'),_0x296a77);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1e49859..330186a 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 _0x3ed3=['toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','splice','encryptString','join','promisify','secret','payload','options','verify','randomBytes','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','name','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','pauseType','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','query','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','pass','Wrong\x20credentials.','catch','Bearer','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','validatePasswordHistory','decryptString','split'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x3ed3,0x122));var _0x33ed=function(_0x169e88,_0x2959f4){_0x169e88=_0x169e88-0x0;var _0x3f2517=_0x3ed3[_0x169e88];return _0x3f2517;};'use strict';var db=require(_0x33ed('0x0'))['db'];var config=require(_0x33ed('0x1'));var hardwareConf=require(_0x33ed('0x2'));var licenseUtil=require(_0x33ed('0x3'));var encryptor=require(_0x33ed('0x4'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x33ed('0x5'));var compose=require(_0x33ed('0x6'));var basicAuth=require(_0x33ed('0x7'));var crypto=require(_0x33ed('0x8'));var BPromise=require(_0x33ed('0x9'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x33ed('0xa')][_0x33ed('0xb')]});var userAttributes=['id',_0x33ed('0xc'),'fullname',_0x33ed('0xd'),'internal',_0x33ed('0xe'),_0x33ed('0xf'),_0x33ed('0x10'),_0x33ed('0x11'),_0x33ed('0x12'),_0x33ed('0x13'),'mailPause',_0x33ed('0x14'),_0x33ed('0x15'),'openchannelPause',_0x33ed('0x16'),'showWebBar','lastLoginAt',_0x33ed('0x17'),_0x33ed('0x18'),_0x33ed('0x19'),'passwordResetAt',_0x33ed('0x1a'),_0x33ed('0x1b'),_0x33ed('0x1c'),'phoneBarDnd',_0x33ed('0x1d'),_0x33ed('0x1e'),_0x33ed('0x1f'),_0x33ed('0x20'),_0x33ed('0x21'),_0x33ed('0x22'),_0x33ed('0x23'),_0x33ed('0x24'),_0x33ed('0x25'),_0x33ed('0x26'),_0x33ed('0x27'),_0x33ed('0x28'),'wssPort',_0x33ed('0x29'),_0x33ed('0x2a'),_0x33ed('0x2b'),_0x33ed('0x2c'),_0x33ed('0x2d'),'chatAutoanswer',_0x33ed('0x2e'),_0x33ed('0x2f'),_0x33ed('0x30'),_0x33ed('0x31'),_0x33ed('0x32'),'openchannelAutoanswer',_0x33ed('0x33'),_0x33ed('0x34'),_0x33ed('0x35'),'whatsappAutoanswer',_0x33ed('0x36'),_0x33ed('0x37')];exports[_0x33ed('0x38')]=function(){return this[_0x33ed('0x39')](!![])[_0x33ed('0x3a')](function(_0x35c25e,_0x152097,_0x50db3a){if(_0x35c25e[_0x33ed('0x3b')]){_0x50db3a();}else{return db[_0x33ed('0x3c')]['findOne']({'where':{'id':_0x35c25e[_0x33ed('0x3d')]['id']},'attributes':['id',_0x33ed('0x3e'),_0x33ed('0x3f')],'raw':!![]})[_0x33ed('0x40')](function(_0x35318c){if(_0x35318c&&_0x35318c[_0x33ed('0x3e')]&&!_0x35c25e[_0x33ed('0x41')][_0x33ed('0x42')]){return _0x152097[_0x33ed('0x43')](_0x35318c[_0x33ed('0x3f')]===_0x33ed('0x44')?0x195:0x193)[_0x33ed('0x45')]({'message':_0x35318c[_0x33ed('0x3f')]==='unmanaged'?_0x33ed('0x46'):_0x33ed('0x47')});}else{_0x50db3a();}})['catch'](function(_0x13acf0){_0x50db3a(_0x13acf0);});}});};exports[_0x33ed('0x39')]=function isAuthenticated(_0x301bb5){return compose()['use'](function(_0x5bb12d,_0x525d02,_0x32077b){var _0x429d8d;if(_0x5bb12d[_0x33ed('0x48')][_0x33ed('0x49')]){if(_[_0x33ed('0x4a')](_0x5bb12d[_0x33ed('0x48')]['authorization'],'Basic')){var _0x3c3e6b=basicAuth(_0x5bb12d);db[_0x33ed('0x4b')][_0x33ed('0x4c')]({'where':{'name':_0x3c3e6b['name']}})[_0x33ed('0x40')](function(_0x176944){if(!_0x176944||!_0x176944['authenticate'](_0x3c3e6b[_0x33ed('0x4d')])){return _0x525d02[_0x33ed('0x43')](0x191)['json']({'message':_0x33ed('0x4e')});}_0x5bb12d[_0x33ed('0x3b')]={'id':_0x176944['id']};_0x32077b();})[_0x33ed('0x4f')](function(_0x5defdf){_0x32077b(_0x5defdf);});}else if(_['startsWith'](_0x5bb12d[_0x33ed('0x48')][_0x33ed('0x49')],_0x33ed('0x50'))){validateJwt(_0x5bb12d,_0x525d02,_0x32077b);}else{if(_0x301bb5){_0x32077b();}else{return _0x525d02[_0x33ed('0x43')](0x193)[_0x33ed('0x45')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5bb12d[_0x33ed('0x41')]['apikey']){try{var _0x3fbb23={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x33ed('0x51')]()};verifyJwt(_0x5bb12d['query']['apikey'],_0x3fbb23)[_0x33ed('0x40')](function(_0x2616ad){return db[_0x33ed('0x4b')][_0x33ed('0x4c')]({'where':{'id':_0x2616ad[_0x33ed('0x52')]}})['then'](function(_0x383f8a){_0x429d8d=_0x383f8a;return db[_0x33ed('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x33ed('0x54'),_0x33ed('0x55')],'raw':!![]});})[_0x33ed('0x40')](function(_0xc438ad){if(!_0x429d8d||!_[_0x33ed('0x56')](_0x429d8d[_0x33ed('0x57')],_0x2616ad[_0x33ed('0x58')])){return _0x525d02[_0x33ed('0x43')](0x191)[_0x33ed('0x45')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x429d8d['disabled']){return _0x525d02[_0x33ed('0x43')](0x191)['json']({'message':_0x33ed('0x59')});}if(_0x429d8d[_0x33ed('0x5a')]){if(_0xc438ad[_0x33ed('0x55')]>0x0){if(moment(_0x429d8d[_0x33ed('0x5b')])[_0x33ed('0x5c')](_0xc438ad[_0x33ed('0x55')],'minutes')>moment()){return _0x525d02[_0x33ed('0x43')](0x191)[_0x33ed('0x45')]({'message':_0x33ed('0x59')});}}else{return _0x525d02[_0x33ed('0x43')](0x191)[_0x33ed('0x45')]({'message':_0x33ed('0x59')});}}_0x5bb12d[_0x33ed('0x3b')]={'id':_0x429d8d['id']};_0x32077b();});})[_0x33ed('0x4f')](function(){return _0x525d02['status'](0x191)[_0x33ed('0x45')]({'message':_0x33ed('0x59')});});}catch(_0x909c29){_0x32077b(_0x909c29);}}else if(_0x301bb5){_0x32077b();}else{return _0x525d02[_0x33ed('0x43')](0x193)[_0x33ed('0x45')]({'message':_0x33ed('0x5d')});}})[_0x33ed('0x3a')](function(_0x37cc0c,_0x4fdd76,_0x44e0ba){if(_0x37cc0c['user']){db[_0x33ed('0x4b')]['find']({'where':{'id':_0x37cc0c[_0x33ed('0x3b')]['id']},'attributes':userAttributes})['then'](function(_0x3014f9){if(!_0x3014f9){return _0x4fdd76['status'](0x194)[_0x33ed('0x45')]({'message':_0x33ed('0x5e')});}_0x37cc0c[_0x33ed('0x3b')]=_0x3014f9;_0x44e0ba();})[_0x33ed('0x4f')](function(_0xbf8e99){_0x44e0ba(_0xbf8e99);});}else if(_0x301bb5){_0x44e0ba();}else{return _0x4fdd76[_0x33ed('0x43')](0x194)[_0x33ed('0x45')]({'message':_0x33ed('0x5f')});}});};exports[_0x33ed('0x60')]=function canUpdate(){return compose()[_0x33ed('0x3a')](function(_0x44c0e2,_0x415401,_0x413470){return licenseUtil['getLicense']()[_0x33ed('0x40')](function(_0x7256e6){if(_0x7256e6['update']){_0x413470();}else{return _0x415401[_0x33ed('0x43')](0x193)['json']({'message':'Forbidden'});}})[_0x33ed('0x4f')](function(_0x6ff8f2){_0x413470(_0x6ff8f2);});});};exports[_0x33ed('0x61')]=function isWebrtcLicence(){return compose()[_0x33ed('0x3a')](function(_0x1130d8,_0x55de2b,_0x32fdff){return licenseUtil[_0x33ed('0x62')]()[_0x33ed('0x40')](function(_0x1cfce2){if(_0x1cfce2[_0x33ed('0x63')]){_0x32fdff();}else{return _0x55de2b[_0x33ed('0x43')](0x193)['json']({'message':_0x33ed('0x64')});}})[_0x33ed('0x4f')](function(_0x40887b){_0x32fdff(_0x40887b);});});};exports[_0x33ed('0x65')]=function(_0x2ce6e6,_0x2a5f36,_0x24b4d2){_0x2ce6e6[_0x33ed('0x65')]=!![];return _0x24b4d2();};exports[_0x33ed('0x66')]=function signToken(_0x34f399){return signJwt(_0x34f399);};exports[_0x33ed('0x67')]=function(_0x472d57,_0x3c9db5){if(!_0x472d57[_0x33ed('0x3b')]){return _0x3c9db5[_0x33ed('0x43')](0x194)[_0x33ed('0x45')]({'message':_0x33ed('0x68')});}var _0x809cfd={'payload':{'id':_0x472d57[_0x33ed('0x3b')]['id'],'role':_0x472d57[_0x33ed('0x3b')][_0x33ed('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x809cfd)['then'](function(_0x4dfed9){_0x3c9db5[_0x33ed('0x69')](_0x33ed('0x6a'),_0x4dfed9);_0x3c9db5[_0x33ed('0x6b')](_0x33ed('0x6c'));})[_0x33ed('0x4f')](function(_0x34d051){return _0x3c9db5['status'](0x1f4)[_0x33ed('0x6d')](_0x34d051);});};exports[_0x33ed('0x6e')]=function(_0x1af943){if(_['isNil'](_0x1af943[_0x33ed('0x57')])||_['isNil'](_0x1af943[_0x33ed('0x6f')])){return null;}else{return createJwt(_0x1af943);}};exports['generateApiKey']=function(_0x1328d1){_0x1328d1[_0x33ed('0x57')]=generateNonce();_0x1328d1[_0x33ed('0x6f')]=generateIssuedAt();return createJwt(_0x1328d1);};exports[_0x33ed('0x70')]=function(_0xc5e8c9,_0x7384d){var _0x160aa9=_0xc5e8c9[_0x33ed('0x41')][_0x33ed('0x71')];if(_0x160aa9){var _0x196924={'nonce':_0x7384d[_0x33ed('0x57')],'iat':_0x7384d[_0x33ed('0x6f')],'audience':hardwareConf[_0x33ed('0x51')](),'issuer':hardwareConf[_0x33ed('0x51')]()};return verifyJwt(_0x160aa9,_0x196924)[_0x33ed('0x40')](function(){return generateApiKey(_0x7384d);});}else{throw{'message':_0x33ed('0x72')};}};exports[_0x33ed('0x73')]=function(_0x43768b){var _0x1258d8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1258d8[_0x33ed('0x74')](_0x43768b))throw new db[(_0x33ed('0x75'))]['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[_0x33ed('0x76')]=function(_0x1dfb51,_0x3b8353,_0x1dcb69){var _0x3fd101=encryptor[_0x33ed('0x77')](_0x3b8353)[_0x33ed('0x78')](',');for(var _0x48a528=0x0;_0x48a528<_0x1dcb69;_0x48a528++){if(!_0x3fd101[_0x48a528])break;if(_0x1dfb51[_0x33ed('0x79')]()===_0x3fd101[_0x48a528][_0x33ed('0x79')]()){var _0x47869f=util['format'](_0x33ed('0x7a'),_0x1dcb69);if(_0x1dcb69===0x1){_0x47869f=_0x33ed('0x7b');}throw new db[(_0x33ed('0x75'))][(_0x33ed('0x7c'))](_0x47869f);}}return;};exports[_0x33ed('0x7d')]=function(_0x150b62,_0x47890e){var _0x18ddec=_0x47890e?encryptor[_0x33ed('0x77')](_0x47890e)[_0x33ed('0x78')](','):[];if(_0x18ddec['length']===0x5){_0x18ddec[_0x33ed('0x7e')](-0x1,0x1);}_0x18ddec['unshift'](_0x150b62);return encryptor[_0x33ed('0x7f')](_0x18ddec[_0x33ed('0x80')](','));};function signJwt(_0x22a0ac){var _0x4831e1=BPromise[_0x33ed('0x81')](jwt['sign'],{'context':jwt});var _0x4d1b77=_0x22a0ac[_0x33ed('0x82')]||config[_0x33ed('0xa')][_0x33ed('0xb')];return new BPromise(function(_0x446ece,_0x1146ce){_0x4831e1(_0x22a0ac[_0x33ed('0x83')],_0x4d1b77,_0x22a0ac[_0x33ed('0x84')])[_0x33ed('0x40')](function(_0x109129){_0x446ece(_0x109129);})[_0x33ed('0x4f')](function(_0x567849){_0x1146ce(_0x567849);});});}function verifyJwt(_0x15499d,_0x18eaa6,_0x305a82){var _0x91f771=BPromise[_0x33ed('0x81')](jwt[_0x33ed('0x85')],{'context':jwt});var _0x3d26b0=_0x305a82||config[_0x33ed('0xa')][_0x33ed('0xb')];return new BPromise(function(_0x58786b,_0x344db7){_0x91f771(_0x15499d,_0x3d26b0,_0x18eaa6)[_0x33ed('0x40')](function(_0xda726e){_0x58786b(_0xda726e);})['catch'](function(_0x30e745){_0x344db7(_0x30e745);});});}function generateNonce(){return crypto[_0x33ed('0x86')](0x10)[_0x33ed('0x87')](_0x33ed('0x88'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x33ed('0x87')]();}function createJwt(_0x33086f){var _0x326abf={'payload':{'iat':_0x33086f[_0x33ed('0x6f')],'nonce':_0x33086f[_0x33ed('0x57')]},'options':{'algorithm':'HS512','subject':_0x33086f['id']['toString'](),'issuer':hardwareConf[_0x33ed('0x51')](),'audience':hardwareConf[_0x33ed('0x51')]()}};return signJwt(_0x326abf)[_0x33ed('0x40')](function(_0x130d53){return{'iat':_0x33086f[_0x33ed('0x6f')],'nonce':_0x33086f[_0x33ed('0x57')],'token':_0x130d53};});} \ No newline at end of file +var _0x6345=['Unknown\x20authorization\x20format','apikey','getUuid','Setting','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','query','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','encryptString','promisify','secret','payload','options','verify','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','crypto','bluebird','util','secrets','session','role','fullname','name','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','findOne','params','closed','disposition','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','Basic','User','find','then','authenticate','pass','Wrong\x20credentials.','Bearer'];(function(_0xe7d655,_0x184955){var _0x3e4804=function(_0x5cebfb){while(--_0x5cebfb){_0xe7d655['push'](_0xe7d655['shift']());}};_0x3e4804(++_0x184955);}(_0x6345,0x14b));var _0x5634=function(_0x5d36e7,_0xdc4767){_0x5d36e7=_0x5d36e7-0x0;var _0x3def65=_0x6345[_0x5d36e7];return _0x3def65;};'use strict';var db=require(_0x5634('0x0'))['db'];var config=require(_0x5634('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5634('0x2'));var encryptor=require(_0x5634('0x3'));var _=require('lodash');var jwt=require(_0x5634('0x4'));var expressJwt=require(_0x5634('0x5'));var compose=require(_0x5634('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x5634('0x7'));var BPromise=require(_0x5634('0x8'));var util=require(_0x5634('0x9'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x5634('0xa')][_0x5634('0xb')]});var userAttributes=['id',_0x5634('0xc'),_0x5634('0xd'),_0x5634('0xe'),'internal','email','userpic',_0x5634('0xf'),_0x5634('0x10'),_0x5634('0x11'),_0x5634('0x12'),'mailPause',_0x5634('0x13'),_0x5634('0x14'),_0x5634('0x15'),_0x5634('0x16'),_0x5634('0x17'),_0x5634('0x18'),'lastPauseAt','crudPermissions',_0x5634('0x19'),_0x5634('0x1a'),'alias','phoneBarAutoAnswer',_0x5634('0x1b'),_0x5634('0x1c'),_0x5634('0x1d'),_0x5634('0x1e'),_0x5634('0x1f'),'phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl',_0x5634('0x20'),_0x5634('0x21'),_0x5634('0x22'),_0x5634('0x23'),_0x5634('0x24'),_0x5634('0x25'),_0x5634('0x26'),_0x5634('0x27'),_0x5634('0x28'),'downloadAttachments',_0x5634('0x29'),_0x5634('0x2a'),_0x5634('0x2b'),_0x5634('0x2c'),'emailAutoanswer',_0x5634('0x2d'),_0x5634('0x2e'),_0x5634('0x2f'),_0x5634('0x30'),'openchannelAutoanswerDelay','faxAutoanswer',_0x5634('0x31'),_0x5634('0x32'),_0x5634('0x33'),_0x5634('0x34')];exports[_0x5634('0x35')]=function(){return this['isAuthenticated'](!![])[_0x5634('0x36')](function(_0xdc33cd,_0x291a6e,_0x4a668e){if(_0xdc33cd[_0x5634('0x37')]){_0x4a668e();}else{return db['ChatInteraction'][_0x5634('0x38')]({'where':{'id':_0xdc33cd[_0x5634('0x39')]['id']},'attributes':['id',_0x5634('0x3a'),_0x5634('0x3b')],'raw':!![]})['then'](function(_0x57c488){if(_0x57c488&&_0x57c488[_0x5634('0x3a')]&&!_0xdc33cd['query'][_0x5634('0x3c')]){return _0x291a6e[_0x5634('0x3d')](_0x57c488[_0x5634('0x3b')]===_0x5634('0x3e')?0x195:0x193)[_0x5634('0x3f')]({'message':_0x57c488[_0x5634('0x3b')]==='unmanaged'?_0x5634('0x40'):_0x5634('0x41')});}else{_0x4a668e();}})[_0x5634('0x42')](function(_0x41aa5f){_0x4a668e(_0x41aa5f);});}});};exports['isAuthenticated']=function isAuthenticated(_0x21c561){return compose()['use'](function(_0x27e22b,_0x5c600f,_0x381d2d){var _0x143a25;if(_0x27e22b[_0x5634('0x43')][_0x5634('0x44')]){if(_['startsWith'](_0x27e22b[_0x5634('0x43')]['authorization'],_0x5634('0x45'))){var _0x272c43=basicAuth(_0x27e22b);db[_0x5634('0x46')][_0x5634('0x47')]({'where':{'name':_0x272c43[_0x5634('0xe')]}})[_0x5634('0x48')](function(_0x1272c1){if(!_0x1272c1||!_0x1272c1[_0x5634('0x49')](_0x272c43[_0x5634('0x4a')])){return _0x5c600f[_0x5634('0x3d')](0x191)[_0x5634('0x3f')]({'message':_0x5634('0x4b')});}_0x27e22b[_0x5634('0x37')]={'id':_0x1272c1['id']};_0x381d2d();})[_0x5634('0x42')](function(_0x4ab538){_0x381d2d(_0x4ab538);});}else if(_['startsWith'](_0x27e22b['headers'][_0x5634('0x44')],_0x5634('0x4c'))){validateJwt(_0x27e22b,_0x5c600f,_0x381d2d);}else{if(_0x21c561){_0x381d2d();}else{return _0x5c600f[_0x5634('0x3d')](0x193)[_0x5634('0x3f')]({'message':_0x5634('0x4d')});}}}else if(_0x27e22b['query'][_0x5634('0x4e')]){try{var _0x4b41ee={'audience':hardwareConf[_0x5634('0x4f')](),'issuer':hardwareConf[_0x5634('0x4f')]()};verifyJwt(_0x27e22b['query']['apikey'],_0x4b41ee)[_0x5634('0x48')](function(_0x50dcdf){return db['User'][_0x5634('0x47')]({'where':{'id':_0x50dcdf['sub']}})[_0x5634('0x48')](function(_0x1ad497){_0x143a25=_0x1ad497;return db[_0x5634('0x50')][_0x5634('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x5634('0x48')](function(_0x327617){if(!_0x143a25||!_['isEqual'](_0x143a25[_0x5634('0x51')],_0x50dcdf[_0x5634('0x52')])){return _0x5c600f['status'](0x191)[_0x5634('0x3f')]({'message':_0x5634('0x53')});}if(_0x143a25[_0x5634('0x54')]){return _0x5c600f[_0x5634('0x3d')](0x191)[_0x5634('0x3f')]({'message':_0x5634('0x55')});}if(_0x143a25[_0x5634('0x56')]){if(_0x327617[_0x5634('0x57')]>0x0){if(moment(_0x143a25[_0x5634('0x58')])[_0x5634('0x59')](_0x327617[_0x5634('0x57')],_0x5634('0x5a'))>moment()){return _0x5c600f['status'](0x191)[_0x5634('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x5c600f[_0x5634('0x3d')](0x191)[_0x5634('0x3f')]({'message':_0x5634('0x55')});}}_0x27e22b[_0x5634('0x37')]={'id':_0x143a25['id']};_0x381d2d();});})[_0x5634('0x42')](function(){return _0x5c600f[_0x5634('0x3d')](0x191)['json']({'message':_0x5634('0x55')});});}catch(_0x4b0b12){_0x381d2d(_0x4b0b12);}}else if(_0x21c561){_0x381d2d();}else{return _0x5c600f['status'](0x193)[_0x5634('0x3f')]({'message':'Unknown\x20authorization\x20format'});}})[_0x5634('0x36')](function(_0x48057f,_0x13795e,_0x3cf918){if(_0x48057f[_0x5634('0x37')]){db['User'][_0x5634('0x47')]({'where':{'id':_0x48057f[_0x5634('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x3f80e4){if(!_0x3f80e4){return _0x13795e['status'](0x194)[_0x5634('0x3f')]({'message':_0x5634('0x5b')});}_0x48057f[_0x5634('0x37')]=_0x3f80e4;_0x3cf918();})[_0x5634('0x42')](function(_0x39853b){_0x3cf918(_0x39853b);});}else if(_0x21c561){_0x3cf918();}else{return _0x13795e[_0x5634('0x3d')](0x194)[_0x5634('0x3f')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x5634('0x5c')]=function canUpdate(){return compose()[_0x5634('0x36')](function(_0x55669b,_0x821a2d,_0xeabaa1){return licenseUtil[_0x5634('0x5d')]()[_0x5634('0x48')](function(_0x1c2c18){if(_0x1c2c18[_0x5634('0x5e')]){_0xeabaa1();}else{return _0x821a2d[_0x5634('0x3d')](0x193)[_0x5634('0x3f')]({'message':_0x5634('0x5f')});}})[_0x5634('0x42')](function(_0x1e3891){_0xeabaa1(_0x1e3891);});});};exports[_0x5634('0x60')]=function isWebrtcLicence(){return compose()[_0x5634('0x36')](function(_0x462ff6,_0x57e27d,_0x560759){return licenseUtil[_0x5634('0x5d')]()[_0x5634('0x48')](function(_0x21a48c){if(_0x21a48c[_0x5634('0x61')]){_0x560759();}else{return _0x57e27d[_0x5634('0x3d')](0x193)['json']({'message':_0x5634('0x5f')});}})[_0x5634('0x42')](function(_0x36311c){_0x560759(_0x36311c);});});};exports[_0x5634('0x62')]=function(_0x1f0177,_0x4aea78,_0x22e2c6){_0x1f0177['isMiddleware']=!![];return _0x22e2c6();};exports[_0x5634('0x63')]=function signToken(_0x37bc4f){return signJwt(_0x37bc4f);};exports[_0x5634('0x64')]=function(_0x110279,_0x3d0610){if(!_0x110279[_0x5634('0x37')]){return _0x3d0610[_0x5634('0x3d')](0x194)[_0x5634('0x3f')]({'message':_0x5634('0x65')});}var _0x44df28={'payload':{'id':_0x110279['user']['id'],'role':_0x110279[_0x5634('0x37')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x44df28)['then'](function(_0xdd49a2){_0x3d0610['cookie']('motion.token',_0xdd49a2);_0x3d0610['redirect'](_0x5634('0x66'));})[_0x5634('0x42')](function(_0x31aed5){return _0x3d0610['status'](0x1f4)[_0x5634('0x67')](_0x31aed5);});};exports[_0x5634('0x68')]=function(_0x52b07a){if(_[_0x5634('0x69')](_0x52b07a[_0x5634('0x51')])||_[_0x5634('0x69')](_0x52b07a[_0x5634('0x6a')])){return null;}else{return createJwt(_0x52b07a);}};exports[_0x5634('0x6b')]=function(_0x25f3ed){_0x25f3ed[_0x5634('0x51')]=generateNonce();_0x25f3ed[_0x5634('0x6a')]=generateIssuedAt();return createJwt(_0x25f3ed);};exports[_0x5634('0x6c')]=function(_0xe7a7db,_0x3b9e5f){var _0x21ebb8=_0xe7a7db[_0x5634('0x6d')][_0x5634('0x4e')];if(_0x21ebb8){var _0x2bf097={'nonce':_0x3b9e5f[_0x5634('0x51')],'iat':_0x3b9e5f[_0x5634('0x6a')],'audience':hardwareConf[_0x5634('0x4f')](),'issuer':hardwareConf[_0x5634('0x4f')]()};return verifyJwt(_0x21ebb8,_0x2bf097)[_0x5634('0x48')](function(){return generateApiKey(_0x3b9e5f);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x5634('0x6e')]=function(_0xb9b9c3){var _0x2c923f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2c923f[_0x5634('0x6f')](_0xb9b9c3))throw new db[(_0x5634('0x70'))][(_0x5634('0x71'))](_0x5634('0x72'));return;};exports[_0x5634('0x73')]=function(_0x4c5a92,_0x1a2727,_0x2252c8){var _0x41de57=encryptor[_0x5634('0x74')](_0x1a2727)[_0x5634('0x75')](',');for(var _0x117fdd=0x0;_0x117fdd<_0x2252c8;_0x117fdd++){if(!_0x41de57[_0x117fdd])break;if(_0x4c5a92[_0x5634('0x76')]()===_0x41de57[_0x117fdd][_0x5634('0x76')]()){var _0x2f1636=util[_0x5634('0x77')](_0x5634('0x78'),_0x2252c8);if(_0x2252c8===0x1){_0x2f1636=_0x5634('0x79');}throw new db['Sequelize'][(_0x5634('0x71'))](_0x2f1636);}}return;};exports[_0x5634('0x7a')]=function(_0x3cc9f2,_0x2bdbcc){var _0x30aa02=_0x2bdbcc?encryptor[_0x5634('0x74')](_0x2bdbcc)[_0x5634('0x75')](','):[];if(_0x30aa02['length']===0x5){_0x30aa02[_0x5634('0x7b')](-0x1,0x1);}_0x30aa02[_0x5634('0x7c')](_0x3cc9f2);return encryptor[_0x5634('0x7d')](_0x30aa02['join'](','));};function signJwt(_0x5c2895){var _0x208dd7=BPromise[_0x5634('0x7e')](jwt['sign'],{'context':jwt});var _0x1fa1d5=_0x5c2895[_0x5634('0x7f')]||config[_0x5634('0xa')][_0x5634('0xb')];return new BPromise(function(_0x4fba9c,_0x37a67b){_0x208dd7(_0x5c2895[_0x5634('0x80')],_0x1fa1d5,_0x5c2895[_0x5634('0x81')])[_0x5634('0x48')](function(_0x27646e){_0x4fba9c(_0x27646e);})[_0x5634('0x42')](function(_0x42f14c){_0x37a67b(_0x42f14c);});});}function verifyJwt(_0x26b42f,_0x2608f8,_0x57fd67){var _0x51afa1=BPromise[_0x5634('0x7e')](jwt[_0x5634('0x82')],{'context':jwt});var _0x3fd853=_0x57fd67||config[_0x5634('0xa')][_0x5634('0xb')];return new BPromise(function(_0x1a283d,_0x174fb4){_0x51afa1(_0x26b42f,_0x3fd853,_0x2608f8)[_0x5634('0x48')](function(_0x57633f){_0x1a283d(_0x57633f);})[_0x5634('0x42')](function(_0x2a6614){_0x174fb4(_0x2a6614);});});}function generateNonce(){return crypto[_0x5634('0x83')](0x10)[_0x5634('0x84')](_0x5634('0x85'));}function generateIssuedAt(){return Math[_0x5634('0x86')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x18ca7f){var _0x3289cf={'payload':{'iat':_0x18ca7f[_0x5634('0x6a')],'nonce':_0x18ca7f[_0x5634('0x51')]},'options':{'algorithm':_0x5634('0x87'),'subject':_0x18ca7f['id'][_0x5634('0x84')](),'issuer':hardwareConf[_0x5634('0x4f')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x3289cf)[_0x5634('0x48')](function(_0x43721d){return{'iat':_0x18ca7f[_0x5634('0x6a')],'nonce':_0x18ca7f[_0x5634('0x51')],'token':_0x43721d};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index cce4c30..ab76884 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 _0x34c9=['startsWith','cf_','CmCustomField','findOne','all','fieldType','type','map','./sql-utils','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','tags','user','skip','checkListsRestrictions','ids','countFilteredContacts','User','buildContactsQuery','clause','getFilteredContacts','catch','describe','CmContact','keys','filter'];(function(_0x51505f,_0x7ac9e9){var _0x3e7c2d=function(_0x4c449e){while(--_0x4c449e){_0x51505f['push'](_0x51505f['shift']());}};_0x3e7c2d(++_0x7ac9e9);}(_0x34c9,0xb2));var _0x934c=function(_0x270ebc,_0x5102fc){_0x270ebc=_0x270ebc-0x0;var _0x315d25=_0x34c9[_0x270ebc];return _0x315d25;};'use strict';var _=require('lodash');var sqlUtils=require(_0x934c('0x0'));var db=require('../../mysqldb')['db'];exports[_0x934c('0x1')]=function(_0xee7443,_0x216f60,_0x416dd8,_0x1df59f){var _0x56be91={'count':0x0,'rows':[]};var _0x1a0d8d=sqlUtils[_0x934c('0x2')](_0x216f60,_0xee7443);if(_0x1a0d8d){return Promise[_0x934c('0x3')](_0x56be91);}var _0x16c3a9=sqlUtils['getContactsSubquery']();var _0x38b9d5={};var _0x33f165=![];var _0x4ea497=![];return Promise[_0x934c('0x3')]()[_0x934c('0x4')](function(){if(_0xee7443[_0x934c('0x5')]){return sqlUtils[_0x934c('0x6')](_0xee7443['search'],_0x1df59f);}else{return sqlUtils[_0x934c('0x7')](_0xee7443,_0x1df59f);}})[_0x934c('0x4')](function(_0x1d9803){_0x16c3a9['where'](_0x1d9803[_0x934c('0x8')]);_0x16c3a9[_0x934c('0x9')](_0x1d9803[_0x934c('0xa')]);_0x16c3a9[_0x934c('0x9')](_0x1d9803['filter']);_0x16c3a9['where'](_0x1d9803['user']['clause']);_0x38b9d5=_0x1d9803[_0x934c('0xb')];_0x4ea497=_0x1d9803[_0x934c('0xc')][_0x934c('0xd')];return sqlUtils[_0x934c('0xe')](_0x216f60,_0xee7443,_0x4ea497);})[_0x934c('0x4')](function(_0x589c95){_0x16c3a9[_0x934c('0x9')](_0x589c95);var _0x2e1139=_0xee7443[_0x934c('0x5')]?_0x38b9d5[_0x934c('0xf')]:_0xee7443['tag'];_0x33f165=_0x2e1139?!![]:![];return sqlUtils[_0x934c('0x10')](_0x16c3a9,_0x2e1139);})['then'](function(_0x596873){_0x56be91['count']=_0x596873;if(_0x56be91['count']===0x0){return;}if(_0xee7443[_0x934c('0x11')]){_0x4ea497=!![];}return sqlUtils[_0x934c('0x12')](_0x16c3a9,_0xee7443[_0x934c('0xa')],_0x416dd8,_0x33f165,_0x38b9d5[_0x934c('0x13')],_0x4ea497);})['then'](function(_0x12929b){if(!_0x12929b){return[];}return sqlUtils[_0x934c('0x14')](_0x12929b,_0xee7443,_0x416dd8);})[_0x934c('0x4')](function(_0x336f8c){_0x56be91['rows']=_0x336f8c;return _0x56be91;})[_0x934c('0x15')](function(_0x4831cb){throw _0x4831cb;});};exports[_0x934c('0x16')]=function(){var _0x46a4ba={};var _0x47fa56=[];return db[_0x934c('0x17')][_0x934c('0x16')]()[_0x934c('0x4')](function(_0x47684a){_0x46a4ba=_0x47684a;var _0x249562=Object[_0x934c('0x18')](_0x46a4ba)[_0x934c('0x19')](function(_0x3abc34){return _[_0x934c('0x1a')](_0x3abc34,_0x934c('0x1b'))?_0x3abc34:undefined;});var _0x45a6b2=_0x249562['map'](function(_0x71710c){return db[_0x934c('0x1c')][_0x934c('0x1d')]({'where':{'id':_0x71710c['slice'](0x3)},'raw':!![]});});return Promise[_0x934c('0x1e')](_0x45a6b2);})[_0x934c('0x4')](function(_0x283c47){for(var _0x2eed31=0x0;_0x2eed31<_0x283c47['length'];_0x2eed31++){if(_0x283c47[_0x2eed31]){var _0x40c730=_0x934c('0x1b')+_0x283c47[_0x2eed31]['id'];_0x46a4ba[_0x40c730][_0x934c('0x1f')]=_0x283c47[_0x2eed31][_0x934c('0x20')];}}_0x47fa56=_[_0x934c('0x21')](Object['keys'](_0x46a4ba),function(_0x10b5a1){return{'name':_0x10b5a1,'type':_0x46a4ba[_0x10b5a1][_0x934c('0x20')]};});return _0x47fa56;})['catch'](function(_0x52ffa0){throw _0x52ffa0;});}; \ No newline at end of file +var _0x86b9=['length','fieldType','type','map','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','resolve','parseAdvancedSearchFilter','search','parseQueryParameters','then','where','default','filter','user','clause','tags','skip','checkListsRestrictions','tag','countFilteredContacts','count','User','buildContactsQuery','fields','rows','catch','CmContact','describe','keys','startsWith','cf_','CmCustomField','findOne','all'];(function(_0x584bfa,_0x15fccb){var _0x3b55a6=function(_0x299738){while(--_0x299738){_0x584bfa['push'](_0x584bfa['shift']());}};_0x3b55a6(++_0x15fccb);}(_0x86b9,0x9c));var _0x986b=function(_0x239850,_0x40b4a6){_0x239850=_0x239850-0x0;var _0x37716e=_0x86b9[_0x239850];return _0x37716e;};'use strict';var _=require('lodash');var sqlUtils=require(_0x986b('0x0'));var db=require(_0x986b('0x1'))['db'];exports[_0x986b('0x2')]=function(_0x33f3f3,_0x226ee3,_0x31f30e,_0xe75bfd){var _0x581afa={'count':0x0,'rows':[]};var _0x4dc23f=sqlUtils[_0x986b('0x3')](_0x226ee3,_0x33f3f3);if(_0x4dc23f){return Promise['resolve'](_0x581afa);}var _0x12878b=sqlUtils[_0x986b('0x4')]();var _0x2bc1d6={};var _0x301931=![];var _0x36f5aa=![];return Promise[_0x986b('0x5')]()['then'](function(){if(_0x33f3f3['search']){return sqlUtils[_0x986b('0x6')](_0x33f3f3[_0x986b('0x7')],_0xe75bfd);}else{return sqlUtils[_0x986b('0x8')](_0x33f3f3,_0xe75bfd);}})[_0x986b('0x9')](function(_0x131cc3){_0x12878b[_0x986b('0xa')](_0x131cc3[_0x986b('0xb')]);_0x12878b[_0x986b('0xa')](_0x131cc3['fields']);_0x12878b[_0x986b('0xa')](_0x131cc3[_0x986b('0xc')]);_0x12878b[_0x986b('0xa')](_0x131cc3[_0x986b('0xd')][_0x986b('0xe')]);_0x2bc1d6=_0x131cc3[_0x986b('0xf')];_0x36f5aa=_0x131cc3['user'][_0x986b('0x10')];return sqlUtils[_0x986b('0x11')](_0x226ee3,_0x33f3f3,_0x36f5aa);})[_0x986b('0x9')](function(_0x284182){_0x12878b[_0x986b('0xa')](_0x284182);var _0x5bf80a=_0x33f3f3[_0x986b('0x7')]?_0x2bc1d6['ids']:_0x33f3f3[_0x986b('0x12')];_0x301931=_0x5bf80a?!![]:![];return sqlUtils[_0x986b('0x13')](_0x12878b,_0x5bf80a);})[_0x986b('0x9')](function(_0xa19a17){_0x581afa[_0x986b('0x14')]=_0xa19a17;if(_0x581afa[_0x986b('0x14')]===0x0){return;}if(_0x33f3f3[_0x986b('0x15')]){_0x36f5aa=!![];}return sqlUtils[_0x986b('0x16')](_0x12878b,_0x33f3f3[_0x986b('0x17')],_0x31f30e,_0x301931,_0x2bc1d6['clause'],_0x36f5aa);})['then'](function(_0x5a980a){if(!_0x5a980a){return[];}return sqlUtils['getFilteredContacts'](_0x5a980a,_0x33f3f3,_0x31f30e);})['then'](function(_0xacfda6){_0x581afa[_0x986b('0x18')]=_0xacfda6;return _0x581afa;})[_0x986b('0x19')](function(_0x56612f){throw _0x56612f;});};exports['describe']=function(){var _0xb9fe9c={};var _0x552f6f=[];return db[_0x986b('0x1a')][_0x986b('0x1b')]()[_0x986b('0x9')](function(_0x41f43a){_0xb9fe9c=_0x41f43a;var _0x3dfe3b=Object[_0x986b('0x1c')](_0xb9fe9c)[_0x986b('0xc')](function(_0x36d171){return _[_0x986b('0x1d')](_0x36d171,_0x986b('0x1e'))?_0x36d171:undefined;});var _0x3bc2f4=_0x3dfe3b['map'](function(_0x2bdbcc){return db[_0x986b('0x1f')][_0x986b('0x20')]({'where':{'id':_0x2bdbcc['slice'](0x3)},'raw':!![]});});return Promise[_0x986b('0x21')](_0x3bc2f4);})['then'](function(_0xaad466){for(var _0x38f15e=0x0;_0x38f15e<_0xaad466[_0x986b('0x22')];_0x38f15e++){if(_0xaad466[_0x38f15e]){var _0x55c2f2=_0x986b('0x1e')+_0xaad466[_0x38f15e]['id'];_0xb9fe9c[_0x55c2f2][_0x986b('0x23')]=_0xaad466[_0x38f15e][_0x986b('0x24')];}}_0x552f6f=_[_0x986b('0x25')](Object[_0x986b('0x1c')](_0xb9fe9c),function(_0x5da665){return{'name':_0x5da665,'type':_0xb9fe9c[_0x5da665][_0x986b('0x24')]};});return _0x552f6f;})[_0x986b('0x19')](function(_0x28a57c){throw _0x28a57c;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 50db580..db04877 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 _0xfc7e=['clone','getSelectedTags','t.id\x20IN\x20?','COUNT(*)','exports','lodash','../interaction/utils','../../mysqldb','agent','search','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','ct.CmContactId\x20=\x20','.id','t.id\x20=\x20ct.TagId','subqry','lastName','mobile','fax','ListId','CompanyId','updatedAt','deletedAt','TagIds','includes','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','datetime','castTo','DATE','text','value','start','end','Tag','map','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','keys','some','compact','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','subqry.id','order','DESC','subqry.','name','color','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0xfc7e,0xd3));var _0xefc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc7e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xefc7('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var utils=require(_0xefc7('0x1'));var db=require(_0xefc7('0x2'))['db'];function skipContactsQuery(_0x2a3994,_0x10cc57){var _0x1e9ad0=![];if(_0x2a3994['role']===_0xefc7('0x3')&&!_0x10cc57[_0xefc7('0x4')]&&!_0x10cc57['ListId']&&_0x10cc57[_0xefc7('0x5')]!==_0xefc7('0x6')){_0x1e9ad0=!![];}return _0x1e9ad0;}function getContactsSubquery(){return squel[_0xefc7('0x7')]()[_0xefc7('0x8')](_0xefc7('0x9'),'c')[_0xefc7('0xa')](_0xefc7('0xb'));}function applyJoinClauses(_0x40f433,_0x476b1b){var _0x106303=_0x476b1b?'c':'subqry';_0x40f433[_0xefc7('0xc')](_0xefc7('0xd'),'uc','uc.CmContactId\x20=\x20'+_0x106303+'.id')[_0xefc7('0xc')]('cm_contact_has_tags','ct',_0xefc7('0xe')+_0x106303+_0xefc7('0xf'))['left_join']('tools_tags','t',_0xefc7('0x10'));return _0x40f433;}function addFieldsToQuery(_0x55d20f,_0x4a19ee,_0x2be269,_0x22136a,_0x35ed4e){var _0x21ada1=_0x35ed4e?'c':_0xefc7('0x11');if(!_0x4a19ee){_0x4a19ee=['id','firstName',_0xefc7('0x12'),'phone',_0xefc7('0x13'),_0xefc7('0x14'),'email',_0xefc7('0x15'),_0xefc7('0x16'),'createdAt',_0xefc7('0x17'),_0xefc7('0x18'),_0xefc7('0x19')];}else if(!_0x4a19ee[_0xefc7('0x1a')]('id')){_0x4a19ee['push']('id');}var _0x27ef8e=_0x2be269&&_0x35ed4e||!_0x2be269&&!_0x35ed4e;if(_0x22136a){_0x27ef8e=_0x22136a&&_0x35ed4e||!_0x22136a&&!_0x35ed4e;}_0x4a19ee[_0xefc7('0x1b')](function(_0x467651){if(_0x467651===_0xefc7('0x19')){if(_0x27ef8e){_0x55d20f['field'](_0xefc7('0x1c'),_0x467651);}else if(_0x2be269||_0x22136a){_0x55d20f[_0xefc7('0x1d')](_0x21ada1+'.'+_0x467651);}}else{_0x55d20f[_0xefc7('0x1d')](_0x21ada1+'.'+_0x467651);}});return _0x55d20f;}function getSqlClauses(){var _0x39af3a={'default':squel[_0xefc7('0x1e')](),'fields':squel[_0xefc7('0x1e')](),'filter':squel[_0xefc7('0x1e')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xefc7('0x1e')](),'skip':![]}};return _0x39af3a;}function parseTagParameter(_0x3e176d){var _0x1bada0=squel[_0xefc7('0x1e')]();if(_0x3e176d){var _0x32a886=utils['getSelectedTags'](_0x3e176d);_0x32a886[_0xefc7('0x1b')](function(_0x55f67c){_0x1bada0['or'](_0xefc7('0x1f'),'%,'+_0x55f67c+',%');});}return _0x1bada0;}function parseSearchFilter(_0x145047){var _0xcffd4a=squel[_0xefc7('0x1e')]();if(_0x145047){var _0x356ae5=_0x145047['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x356ae5[_0xefc7('0x20')]('\x20')[_0xefc7('0x21')]>0x1){_0xcffd4a['or'](_0xefc7('0x22'),qs[_0xefc7('0x23')](_0x356ae5,!![]),null);}else{if(qs[_0xefc7('0x24')](_0x356ae5)){_0xcffd4a['or'](_0xefc7('0x25'),_0x356ae5+'%');_0xcffd4a['or'](_0xefc7('0x26'),_0x356ae5+'%');_0xcffd4a['or'](_0xefc7('0x27'),_0x356ae5+'%');_0xcffd4a['or'](_0xefc7('0x28'),_0x356ae5+'%');}else if(qs[_0xefc7('0x29')](_0x356ae5)){_0xcffd4a['or']('c.email\x20LIKE\x20?',_0x356ae5+'%');}else{_0xcffd4a['or']('c.firstName\x20LIKE\x20?','%'+_0x356ae5+'%');_0xcffd4a['or'](_0xefc7('0x2a'),'%'+_0x356ae5+'%');_0xcffd4a['or'](_0xefc7('0x2b'),'%'+_0x356ae5+'%');}}}return _0xcffd4a;}function parseAdvancedSearchFilter(_0x209ea1,_0xba8f35){var _0x39b100=getSqlClauses();var _0x124efa=as[_0xefc7('0x2c')](_0x209ea1);var _0x1c86df=_0x124efa[_0xefc7('0x2d')];for(var _0x42f3d9=0x0;_0x42f3d9<_0x124efa[_0xefc7('0x2e')]['length'];_0x42f3d9++){var _0x151d4a=_0x124efa[_0xefc7('0x2e')][_0x42f3d9];var _0x5b3599='c';var _0x45aa30=_[_0xefc7('0x2f')](_0xba8f35,['name',_0x151d4a[_0xefc7('0x1d')]]);if(_0x45aa30){if(_0x151d4a[_0xefc7('0x1d')]===_0xefc7('0x30')||_0x45aa30['fieldType']===_0xefc7('0x31')){_0x151d4a[_0xefc7('0x32')]=_0xefc7('0x33');}var _0x352b9d=as['buildExpression'](_0x5b3599,_0x45aa30['type'],_0x151d4a);_0x39b100['default'][_0x1c86df](_0x352b9d[_0xefc7('0x34')],_0x352b9d[_0xefc7('0x35')][_0xefc7('0x36')],_0x352b9d[_0xefc7('0x35')][_0xefc7('0x37')]);}else{if(_0x151d4a[_0xefc7('0x1d')]===_0xefc7('0x38')){var _0x39d4aa=_0x151d4a['value']['split'](',')[_0xefc7('0x39')](function(_0x1b0ab7){return Number(_0x1b0ab7);});var _0x204b45=parseTagParameter(_0x39d4aa);_0x39b100['tags'][_0xefc7('0x3a')][_0xefc7('0x3b')](_0x204b45);_0x39b100[_0xefc7('0x3c')][_0xefc7('0x3d')]=_0x39d4aa;}else if(_0x151d4a['field']===_0xefc7('0x3e')){_0x39b100[_0xefc7('0x3f')][_0xefc7('0x3a')][_0xefc7('0x3b')](_0xefc7('0x40'),_0x151d4a['value']);_0x39b100[_0xefc7('0x3f')]['skip']=!![];}}}return _0x39b100;}function parseModelFields(_0x3701ca,_0x123462){var _0x44ac82=squel[_0xefc7('0x1e')]();var _0x3a38a8=_(_0x3701ca)[_0xefc7('0x41')]()[_0xefc7('0x39')](function(_0x38aa96){return _[_0xefc7('0x42')](_0x123462,['name',_0x38aa96])?_0x38aa96:undefined;})[_0xefc7('0x43')]()[_0xefc7('0x35')]();if(_0x3701ca[_0xefc7('0x44')]){_0x3a38a8['push'](_0xefc7('0x44'));}if(_0x3701ca[_0xefc7('0x3e')]){_0x3a38a8[_0xefc7('0x45')](_0xefc7('0x3e'));}if(_0x3a38a8[_0xefc7('0x21')]>0x0){_0x3a38a8['forEach'](function(_0x13b46d){if(_0x13b46d===_0xefc7('0x15')){_0x44ac82['and'](_0xefc7('0x46'),[][_0xefc7('0x47')](_0x3701ca[_0x13b46d]));}else if(_0x13b46d===_0xefc7('0x44')){var _0x104a93='%'+_0x3701ca[_0x13b46d]+'%';_0x44ac82['and'](_0xefc7('0x48'),_0x104a93);}else if(_0x13b46d===_0xefc7('0x3e')){_0x44ac82[_0xefc7('0x3b')](_0xefc7('0x40'),_0x3701ca[_0x13b46d]);}else{_0x44ac82[_0xefc7('0x3b')]('c.'+_0x13b46d+_0xefc7('0x49'),_0x3701ca[_0x13b46d]);}});}return _0x44ac82;}function parseQueryParameters(_0x1977f4,_0x50c8fb){var _0x320611=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x1977f4,_0x50c8fb);})[_0xefc7('0x4a')](function(_0x1c43c5){_0x320611[_0xefc7('0x4b')][_0xefc7('0x3b')](_0x1c43c5);return parseTagParameter(_0x1977f4[_0xefc7('0x4c')]);})['then'](function(_0x5436ca){_0x320611[_0xefc7('0x3c')][_0xefc7('0x3a')][_0xefc7('0x3b')](_0x5436ca);return parseSearchFilter(_0x1977f4[_0xefc7('0x4d')]);})['then'](function(_0x474f4d){_0x320611[_0xefc7('0x4d')]=_0x474f4d;return _0x320611;});}function checkListsRestrictions(_0x349b21,_0x109cc1,_0x44112a){var _0x24e033=squel[_0xefc7('0x1e')]();return Promise['resolve']()[_0xefc7('0x4a')](function(){if(_0x109cc1[_0xefc7('0x4')]&&_0x349b21['role']===_0xefc7('0x3')&&!_0x44112a){return _0x349b21[_0xefc7('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0xefc7('0x4a')](function(_0x37e15f){if(_0x37e15f){if(_0x37e15f['length']===0x0){_0x24e033['and'](_0xefc7('0x4f'));}else{_0x24e033[_0xefc7('0x3b')](_0xefc7('0x46'),_[_0xefc7('0x39')](_0x37e15f,'id'));}}})[_0xefc7('0x4a')](function(){return _0x24e033;});}function buildContactsQuery(_0x71b20b,_0x2b1589,_0x3343a5,_0x20c09,_0x2924a7,_0x367731){if(_0x2b1589){_0x2b1589=_0x3343a5['attributes'];}_0x71b20b=addFieldsToQuery(_0x71b20b,_0x2b1589,_0x20c09,_0x367731,!![]);var _0xf9b936=squel[_0xefc7('0x7')]();_0xf9b936=addFieldsToQuery(_0xf9b936,_0x2b1589,_0x20c09,_0x367731,![]);if(_0x20c09||_0x367731){_0x71b20b=applyJoinClauses(_0x71b20b,!![]);_0x71b20b[_0xefc7('0x50')](_0xefc7('0x51'));if(_0x3343a5[_0xefc7('0x52')]){_0xf9b936[_0xefc7('0x52')](_0x3343a5['limit']);}if(_0x3343a5['offset']){_0xf9b936[_0xefc7('0x53')](_0x3343a5[_0xefc7('0x53')]);}}else{_0xf9b936=applyJoinClauses(_0xf9b936,![]);_0xf9b936[_0xefc7('0x50')](_0xefc7('0x54'));if(_0x3343a5[_0xefc7('0x52')]){_0x71b20b[_0xefc7('0x52')](_0x3343a5['limit']);}if(_0x3343a5[_0xefc7('0x53')]){_0x71b20b['offset'](_0x3343a5[_0xefc7('0x53')]);}}_0xf9b936['having'](_0x2924a7);if(_0x3343a5[_0xefc7('0x55')]){_0x3343a5[_0xefc7('0x55')]['forEach'](function(_0x5815f1){_0x71b20b[_0xefc7('0x55')]('c.'+_0x5815f1[0x0],_0x5815f1[0x1]===_0xefc7('0x56')?![]:!![]);_0xf9b936[_0xefc7('0x55')](_0xefc7('0x57')+_0x5815f1[0x0],_0x5815f1[0x1]===_0xefc7('0x56')?![]:!![]);});}_0xf9b936[_0xefc7('0x8')](_0x71b20b,_0xefc7('0x11'));return _0xf9b936;}function getFilteredContacts(_0x38d4dd){var _0x54a304=[];return db['Tag']['findAll']({'attributes':['id',_0xefc7('0x58'),_0xefc7('0x59')],'raw':!![]})['then'](function(_0x46ee9e){_0x54a304=_['keyBy'](_0x46ee9e,'id');var _0x7f05b3={'type':db[_0xefc7('0x5a')][_0xefc7('0x5b')][_0xefc7('0x5c')],'model':db[_0xefc7('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xefc7('0x5e')][_0xefc7('0x5f')](_0x38d4dd[_0xefc7('0x60')](),_0x7f05b3);})[_0xefc7('0x4a')](function(_0x437e58){_0x437e58[_0xefc7('0x1b')](function(_0x2047e7){if(_0x2047e7[_0xefc7('0x19')]){_0x2047e7[_0xefc7('0x61')]=[];_0x2047e7[_0xefc7('0x19')]['split'](',')[_0xefc7('0x1b')](function(_0x513448){_0x2047e7['Tags'][_0xefc7('0x45')](_0x54a304[_0x513448]);});}delete _0x2047e7[_0xefc7('0x19')];});return _0x437e58;});}function countFilteredContacts(_0x432620,_0x58591d){var _0x18971f=_0x432620[_0xefc7('0x62')]();_0x18971f[_0xefc7('0x1d')]('COUNT(*)');_0x18971f=applyJoinClauses(_0x18971f,!![]);_0x432620[_0xefc7('0x50')](_0xefc7('0x51'));var _0x373f96=utils[_0xefc7('0x63')](_0x58591d);if(!_['isEmpty'](_0x373f96)){_0x18971f['where'](_0xefc7('0x64'),_0x373f96);}var _0x40fa16={'type':db[_0xefc7('0x5a')]['QueryTypes'][_0xefc7('0x5c')],'raw':!![]};return db[_0xefc7('0x5e')]['query'](_0x18971f['toString'](),_0x40fa16)[_0xefc7('0x4a')](function(_0x1313f7){return _0x1313f7[0x0][_0xefc7('0x65')];});}module[_0xefc7('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xc91a=['c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','fields','tag','then','filter','role','attributes','c.id','limit','offset','group','subqry.id','order','DESC','subqry.','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','isEmpty','QueryTypes','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','ListId','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','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','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','find','name','fieldType','datetime','castTo','DATE','buildExpression','type','default','value','start','Tag','map','clause','and','tags','User','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0xc91a,0x88));var _0xac91=function(_0x305be3,_0x2a807a){_0x305be3=_0x305be3-0x0;var _0x3f8584=_0xc91a[_0x305be3];return _0x3f8584;};'use strict';var _=require(_0xac91('0x0'));var squel=require('squel');var as=require(_0xac91('0x1'));var qs=require(_0xac91('0x2'));var utils=require(_0xac91('0x3'));var db=require(_0xac91('0x4'))['db'];function skipContactsQuery(_0x3108c9,_0x48325e){var _0x5f1356=![];if(_0x3108c9['role']===_0xac91('0x5')&&!_0x48325e[_0xac91('0x6')]&&!_0x48325e[_0xac91('0x7')]&&_0x48325e['autocomplete']!==_0xac91('0x8')){_0x5f1356=!![];}return _0x5f1356;}function getContactsSubquery(){return squel[_0xac91('0x9')]()[_0xac91('0xa')](_0xac91('0xb'),'c')[_0xac91('0xc')](_0xac91('0xd'));}function applyJoinClauses(_0x5d830a,_0x35c2d9){var _0x5abf40=_0x35c2d9?'c':_0xac91('0xe');_0x5d830a[_0xac91('0xf')]('cm_user_has_contacts','uc',_0xac91('0x10')+_0x5abf40+_0xac91('0x11'))[_0xac91('0xf')](_0xac91('0x12'),'ct',_0xac91('0x13')+_0x5abf40+'.id')[_0xac91('0xf')]('tools_tags','t',_0xac91('0x14'));return _0x5d830a;}function addFieldsToQuery(_0x361704,_0x2a0dc9,_0x16c46e,_0x581e1c,_0x460a45){var _0x6fef47=_0x460a45?'c':_0xac91('0xe');if(!_0x2a0dc9){_0x2a0dc9=['id','firstName',_0xac91('0x15'),_0xac91('0x16'),_0xac91('0x17'),_0xac91('0x18'),_0xac91('0x19'),'ListId',_0xac91('0x1a'),'createdAt',_0xac91('0x1b'),_0xac91('0x1c'),_0xac91('0x1d')];}else if(!_0x2a0dc9[_0xac91('0x1e')]('id')){_0x2a0dc9[_0xac91('0x1f')]('id');}var _0x4d375e=_0x16c46e&&_0x460a45||!_0x16c46e&&!_0x460a45;if(_0x581e1c){_0x4d375e=_0x581e1c&&_0x460a45||!_0x581e1c&&!_0x460a45;}_0x2a0dc9[_0xac91('0x20')](function(_0x14fbc9){if(_0x14fbc9===_0xac91('0x1d')){if(_0x4d375e){_0x361704[_0xac91('0x21')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x14fbc9);}else if(_0x16c46e||_0x581e1c){_0x361704['field'](_0x6fef47+'.'+_0x14fbc9);}}else{_0x361704[_0xac91('0x21')](_0x6fef47+'.'+_0x14fbc9);}});return _0x361704;}function getSqlClauses(){var _0x23345b={'default':squel[_0xac91('0x22')](),'fields':squel[_0xac91('0x22')](),'filter':squel[_0xac91('0x22')](),'tags':{'clause':squel[_0xac91('0x22')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x23345b;}function parseTagParameter(_0x31d212){var _0x57a9bf=squel[_0xac91('0x22')]();if(_0x31d212){var _0x422c88=utils[_0xac91('0x23')](_0x31d212);_0x422c88['forEach'](function(_0x39a4ac){_0x57a9bf['or'](_0xac91('0x24'),'%,'+_0x39a4ac+',%');});}return _0x57a9bf;}function parseSearchFilter(_0x2aafb3){var _0x4ce760=squel[_0xac91('0x22')]();if(_0x2aafb3){var _0x2b081c=_0x2aafb3[_0xac91('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x2b081c[_0xac91('0x26')]('\x20')[_0xac91('0x27')]>0x1){_0x4ce760['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2b081c,!![]),null);}else{if(qs[_0xac91('0x28')](_0x2b081c)){_0x4ce760['or'](_0xac91('0x29'),_0x2b081c+'%');_0x4ce760['or'](_0xac91('0x2a'),_0x2b081c+'%');_0x4ce760['or'](_0xac91('0x2b'),_0x2b081c+'%');_0x4ce760['or'](_0xac91('0x2c'),_0x2b081c+'%');}else if(qs[_0xac91('0x2d')](_0x2b081c)){_0x4ce760['or'](_0xac91('0x2e'),_0x2b081c+'%');}else{_0x4ce760['or'](_0xac91('0x2f'),'%'+_0x2b081c+'%');_0x4ce760['or'](_0xac91('0x30'),'%'+_0x2b081c+'%');_0x4ce760['or']('c.email\x20LIKE\x20?','%'+_0x2b081c+'%');}}}return _0x4ce760;}function parseAdvancedSearchFilter(_0x51bb4f,_0x151a19){var _0x581011=getSqlClauses();var _0x3ec19e=as[_0xac91('0x31')](_0x51bb4f);var _0x301e5a=_0x3ec19e[_0xac91('0x32')];for(var _0x226411=0x0;_0x226411<_0x3ec19e['conditions'][_0xac91('0x27')];_0x226411++){var _0x29355e=_0x3ec19e[_0xac91('0x33')][_0x226411];var _0x58e61e='c';var _0x145832=_[_0xac91('0x34')](_0x151a19,[_0xac91('0x35'),_0x29355e[_0xac91('0x21')]]);if(_0x145832){if(_0x29355e[_0xac91('0x21')]==='dateOfBirth'||_0x145832[_0xac91('0x36')]===_0xac91('0x37')){_0x29355e[_0xac91('0x38')]=_0xac91('0x39');}var _0xff49fa=as[_0xac91('0x3a')](_0x58e61e,_0x145832[_0xac91('0x3b')],_0x29355e);_0x581011[_0xac91('0x3c')][_0x301e5a](_0xff49fa['text'],_0xff49fa[_0xac91('0x3d')][_0xac91('0x3e')],_0xff49fa[_0xac91('0x3d')]['end']);}else{if(_0x29355e[_0xac91('0x21')]===_0xac91('0x3f')){var _0x10053e=_0x29355e['value']['split'](',')[_0xac91('0x40')](function(_0x43d218){return Number(_0x43d218);});var _0x46d286=parseTagParameter(_0x10053e);_0x581011['tags'][_0xac91('0x41')][_0xac91('0x42')](_0x46d286);_0x581011[_0xac91('0x43')]['ids']=_0x10053e;}else if(_0x29355e[_0xac91('0x21')]===_0xac91('0x44')){_0x581011[_0xac91('0x45')][_0xac91('0x41')]['and'](_0xac91('0x46'),_0x29355e[_0xac91('0x3d')]);_0x581011['user'][_0xac91('0x47')]=!![];}}}return _0x581011;}function parseModelFields(_0x784d67,_0x4bea33){var _0x6a6ad1=squel['expr']();var _0x5679ad=_(_0x784d67)[_0xac91('0x48')]()[_0xac91('0x40')](function(_0x4d5d86){return _[_0xac91('0x49')](_0x4bea33,[_0xac91('0x35'),_0x4d5d86])?_0x4d5d86:undefined;})[_0xac91('0x4a')]()[_0xac91('0x3d')]();if(_0x784d67[_0xac91('0x4b')]){_0x5679ad[_0xac91('0x1f')](_0xac91('0x4b'));}if(_0x784d67[_0xac91('0x44')]){_0x5679ad[_0xac91('0x1f')]('User');}if(_0x5679ad['length']>0x0){_0x5679ad[_0xac91('0x20')](function(_0x5215ab){if(_0x5215ab===_0xac91('0x7')){_0x6a6ad1[_0xac91('0x42')](_0xac91('0x4c'),[]['concat'](_0x784d67[_0x5215ab]));}else if(_0x5215ab===_0xac91('0x4b')){var _0xf22630='%'+_0x784d67[_0x5215ab]+'%';_0x6a6ad1[_0xac91('0x42')](_0xac91('0x4d'),_0xf22630);}else if(_0x5215ab===_0xac91('0x44')){_0x6a6ad1[_0xac91('0x42')](_0xac91('0x46'),_0x784d67[_0x5215ab]);}else{_0x6a6ad1['and']('c.'+_0x5215ab+'\x20=\x20?',_0x784d67[_0x5215ab]);}});}return _0x6a6ad1;}function parseQueryParameters(_0x368365,_0x28cfb5){var _0x4655e1=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x368365,_0x28cfb5);})['then'](function(_0x2992ac){_0x4655e1[_0xac91('0x4e')][_0xac91('0x42')](_0x2992ac);return parseTagParameter(_0x368365[_0xac91('0x4f')]);})[_0xac91('0x50')](function(_0x4397c5){_0x4655e1[_0xac91('0x43')][_0xac91('0x41')]['and'](_0x4397c5);return parseSearchFilter(_0x368365[_0xac91('0x51')]);})[_0xac91('0x50')](function(_0xa17896){_0x4655e1['filter']=_0xa17896;return _0x4655e1;});}function checkListsRestrictions(_0x5b3958,_0x2d5b2f,_0x479007){var _0x162b6f=squel['expr']();return Promise['resolve']()[_0xac91('0x50')](function(){if(_0x2d5b2f['search']&&_0x5b3958[_0xac91('0x52')]==='agent'&&!_0x479007){return _0x5b3958['getLists']({'attributes':['id'],'raw':!![]});}})[_0xac91('0x50')](function(_0x4f1616){if(_0x4f1616){if(_0x4f1616[_0xac91('0x27')]===0x0){_0x162b6f[_0xac91('0x42')]('c.ListId\x20IS\x20NULL');}else{_0x162b6f[_0xac91('0x42')](_0xac91('0x4c'),_['map'](_0x4f1616,'id'));}}})['then'](function(){return _0x162b6f;});}function buildContactsQuery(_0x322603,_0x33f3dd,_0x119008,_0xbee3d,_0x5cbc67,_0x153d96){if(_0x33f3dd){_0x33f3dd=_0x119008[_0xac91('0x53')];}_0x322603=addFieldsToQuery(_0x322603,_0x33f3dd,_0xbee3d,_0x153d96,!![]);var _0xc8a873=squel[_0xac91('0x9')]();_0xc8a873=addFieldsToQuery(_0xc8a873,_0x33f3dd,_0xbee3d,_0x153d96,![]);if(_0xbee3d||_0x153d96){_0x322603=applyJoinClauses(_0x322603,!![]);_0x322603['group'](_0xac91('0x54'));if(_0x119008[_0xac91('0x55')]){_0xc8a873['limit'](_0x119008[_0xac91('0x55')]);}if(_0x119008[_0xac91('0x56')]){_0xc8a873['offset'](_0x119008[_0xac91('0x56')]);}}else{_0xc8a873=applyJoinClauses(_0xc8a873,![]);_0xc8a873[_0xac91('0x57')](_0xac91('0x58'));if(_0x119008[_0xac91('0x55')]){_0x322603['limit'](_0x119008[_0xac91('0x55')]);}if(_0x119008['offset']){_0x322603[_0xac91('0x56')](_0x119008[_0xac91('0x56')]);}}_0xc8a873['having'](_0x5cbc67);if(_0x119008[_0xac91('0x59')]){_0x119008['order'][_0xac91('0x20')](function(_0x5b35e6){_0x322603[_0xac91('0x59')]('c.'+_0x5b35e6[0x0],_0x5b35e6[0x1]===_0xac91('0x5a')?![]:!![]);_0xc8a873[_0xac91('0x59')](_0xac91('0x5b')+_0x5b35e6[0x0],_0x5b35e6[0x1]===_0xac91('0x5a')?![]:!![]);});}_0xc8a873[_0xac91('0xa')](_0x322603,'subqry');return _0xc8a873;}function getFilteredContacts(_0x33710f){var _0x560db0=[];return db[_0xac91('0x3f')][_0xac91('0x5c')]({'attributes':['id',_0xac91('0x35'),_0xac91('0x5d')],'raw':!![]})[_0xac91('0x50')](function(_0x505b77){_0x560db0=_[_0xac91('0x5e')](_0x505b77,'id');var _0x14060b={'type':db[_0xac91('0x5f')]['QueryTypes'][_0xac91('0x60')],'model':db[_0xac91('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xac91('0x62')][_0xac91('0x63')](_0x33710f['toString'](),_0x14060b);})[_0xac91('0x50')](function(_0x34c4ee){_0x34c4ee[_0xac91('0x20')](function(_0xc49b5d){if(_0xc49b5d[_0xac91('0x1d')]){_0xc49b5d[_0xac91('0x64')]=[];_0xc49b5d[_0xac91('0x1d')]['split'](',')[_0xac91('0x20')](function(_0x246d9e){_0xc49b5d[_0xac91('0x64')][_0xac91('0x1f')](_0x560db0[_0x246d9e]);});}delete _0xc49b5d[_0xac91('0x1d')];});return _0x34c4ee;});}function countFilteredContacts(_0x582904,_0x5b04e4){var _0xefd89=_0x582904[_0xac91('0x65')]();_0xefd89[_0xac91('0x21')](_0xac91('0x66'));_0xefd89=applyJoinClauses(_0xefd89,!![]);_0x582904['group'](_0xac91('0x54'));var _0x3d63fb=utils[_0xac91('0x23')](_0x5b04e4);if(!_[_0xac91('0x67')](_0x3d63fb)){_0xefd89[_0xac91('0xc')]('t.id\x20IN\x20?',_0x3d63fb);}var _0x33e4f1={'type':db[_0xac91('0x5f')][_0xac91('0x68')][_0xac91('0x60')],'raw':!![]};return db[_0xac91('0x62')][_0xac91('0x63')](_0xefd89['toString'](),_0x33e4f1)[_0xac91('0x50')](function(_0x44c8b0){return _0x44c8b0[0x0][_0xac91('0x66')];});}module[_0xac91('0x69')]={'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 0b244b5..936432a 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 _0x2889=['encryptFile','createCipher','data','binary','write','end','close','unlink','createReadStream','createDecipher','update','encryptString','base64','final','decryptString','secret','utf8','crypto','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty'];(function(_0x4569b4,_0x1df34a){var _0x3f965=function(_0x3e3367){while(--_0x3e3367){_0x4569b4['push'](_0x4569b4['shift']());}};_0x3f965(++_0x1df34a);}(_0x2889,0x187));var _0x9288=function(_0x29cba9,_0x177869){_0x29cba9=_0x29cba9-0x0;var _0x514c3f=_0x2889[_0x29cba9];return _0x514c3f;};'use strict';var crypto=require(_0x9288('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x9288('0x1'));var config=require(_0x9288('0x2'));var logger=require(_0x9288('0x3'))(_0x9288('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x9288('0x5')]['session'],'algorithm':_0x9288('0x6')};const fileOptions={'algorithm':_0x9288('0x7')};if(config['encrypt']&&config[_0x9288('0x8')][_0x9288('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x9288('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x9288('0x8')][_0x9288('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x9288('0xa')](',\x20');logger[_0x9288('0xb')](config['encrypt']['algorithm'],_0x9288('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x57d520){return AES_SUPPORTED_RX[_0x9288('0xd')](_0x57d520);}function getSupportedCiphers(){return crypto[_0x9288('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x2a785b){return getSupportedCiphers()[_0x9288('0xf')](_0x2a785b)>-0x1;}function combineOptions(_0x153e0f){var _0x206eb2={};for(var _0xebc84b in fileOptions){if(fileOptions['hasOwnProperty'](_0xebc84b)){_0x206eb2[_0xebc84b]=fileOptions[_0xebc84b];}}if(_0x153e0f){for(var _0x57d34d in _0x153e0f){if(_0x153e0f[_0x9288('0x10')](_0x57d34d)){_0x206eb2[_0x57d34d]=_0x153e0f[_0x57d34d];}}}return _0x206eb2;}exports[_0x9288('0x11')]=function(_0x3fcbf4,_0x357e8b,_0x4c1c67,_0x130a20){return new BPromise(function(_0x14d814,_0x2d0fae){_0x130a20=combineOptions(_0x130a20);var _0x58f913=new Buffer(_0x4c1c67);var _0x399c5a=fs['createReadStream'](_0x3fcbf4);var _0x3b5dc6=fs['createWriteStream'](_0x357e8b);var _0x2cce8c=crypto[_0x9288('0x12')](_0x130a20['algorithm'],_0x58f913);_0x399c5a['on'](_0x9288('0x13'),function(_0x16d9c0){var _0xc77ee1=new Buffer(_0x2cce8c['update'](_0x16d9c0),_0x9288('0x14'));_0x3b5dc6[_0x9288('0x15')](_0xc77ee1);});_0x399c5a['on'](_0x9288('0x16'),function(){try{var _0x4edb95=new Buffer(_0x2cce8c['final'](_0x9288('0x14')),_0x9288('0x14'));_0x3b5dc6[_0x9288('0x15')](_0x4edb95);_0x3b5dc6['end']();_0x3b5dc6['on'](_0x9288('0x17'),function(){return _0x14d814(_0x357e8b);});}catch(_0x5d9964){fs[_0x9288('0x18')](_0x357e8b);return _0x2d0fae(_0x5d9964);}});});};exports['decryptFile']=function(_0x34c231,_0x4839d2,_0x1db392,_0x40be91){return new BPromise(function(_0x1a44b5,_0x3fe25f){_0x40be91=combineOptions(_0x40be91);var _0x337598=new Buffer(_0x1db392);var _0x3ecb5a=fs[_0x9288('0x19')](_0x34c231);var _0x395a32=fs['createWriteStream'](_0x4839d2);var _0x28b03b=crypto[_0x9288('0x1a')](_0x40be91[_0x9288('0x9')],_0x337598);_0x3ecb5a['on']('data',function(_0x901b2a){var _0x52ed41=new Buffer(_0x28b03b[_0x9288('0x1b')](_0x901b2a),_0x9288('0x14'));_0x395a32[_0x9288('0x15')](_0x52ed41);});_0x3ecb5a['on'](_0x9288('0x16'),function(){try{var _0x18181c=new Buffer(_0x28b03b['final'](_0x9288('0x14')),_0x9288('0x14'));_0x395a32[_0x9288('0x15')](_0x18181c);_0x395a32['end']();_0x395a32['on'](_0x9288('0x17'),function(){return _0x1a44b5(_0x4839d2);});}catch(_0x56598b){fs[_0x9288('0x18')](_0x4839d2);return _0x3fe25f(_0x56598b);}});});};exports[_0x9288('0x1c')]=function(_0x159ba8,_0x2ab1d6,_0x4aa36d){var _0x4775e1=_0x4aa36d||stringOptions[_0x9288('0x9')];var _0x49bed0=_0x2ab1d6||stringOptions['secret'];var _0x323a40=crypto[_0x9288('0x12')](_0x4775e1,_0x49bed0);var _0x196871=_0x323a40[_0x9288('0x1b')](_0x159ba8,'utf8',_0x9288('0x1d'));_0x196871+=_0x323a40[_0x9288('0x1e')](_0x9288('0x1d'));return _0x196871;};exports[_0x9288('0x1f')]=function(_0x54aa27,_0x39444d,_0x518310){var _0x4dbcf7=_0x518310||stringOptions[_0x9288('0x9')];var _0x46f746=_0x39444d||stringOptions[_0x9288('0x20')];var _0x1250a8=crypto['createDecipher'](_0x4dbcf7,_0x46f746);var _0x360fda=_0x1250a8['update'](_0x54aa27,_0x9288('0x1d'),_0x9288('0x21'));_0x360fda+=_0x1250a8['final'](_0x9288('0x21'));return _0x360fda;}; \ No newline at end of file +var _0x8c73=['createDecipher','encryptString','secret','utf8','base64','crypto','bluebird','lodash','../../config/logger','app','aes192','encrypt','algorithm','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','final','end','close','unlink','decryptFile','createReadStream'];(function(_0x5ca82d,_0x7d11a0){var _0x397661=function(_0x4ce955){while(--_0x4ce955){_0x5ca82d['push'](_0x5ca82d['shift']());}};_0x397661(++_0x7d11a0);}(_0x8c73,0x145));var _0x38c7=function(_0x3eec42,_0x192ed2){_0x3eec42=_0x3eec42-0x0;var _0x110bf0=_0x8c73[_0x3eec42];return _0x110bf0;};'use strict';var crypto=require(_0x38c7('0x0'));var fs=require('fs');var BPromise=require(_0x38c7('0x1'));var _=require(_0x38c7('0x2'));var config=require('../../config/environment');var logger=require(_0x38c7('0x3'))(_0x38c7('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x38c7('0x5')};if(config[_0x38c7('0x6')]&&config[_0x38c7('0x6')][_0x38c7('0x7')]){var isSupported=isAlgorithmSupported(config[_0x38c7('0x6')][_0x38c7('0x7')]);if(isSupported){fileOptions[_0x38c7('0x7')]=config[_0x38c7('0x6')][_0x38c7('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x38c7('0x8')](config['encrypt'][_0x38c7('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x3b27ef){return AES_SUPPORTED_RX[_0x38c7('0x9')](_0x3b27ef);}function getSupportedCiphers(){return crypto[_0x38c7('0xa')]()[_0x38c7('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x414593){return getSupportedCiphers()[_0x38c7('0xc')](_0x414593)>-0x1;}function combineOptions(_0x468a2c){var _0xbacd49={};for(var _0x3c8c75 in fileOptions){if(fileOptions[_0x38c7('0xd')](_0x3c8c75)){_0xbacd49[_0x3c8c75]=fileOptions[_0x3c8c75];}}if(_0x468a2c){for(var _0x2a963c in _0x468a2c){if(_0x468a2c[_0x38c7('0xd')](_0x2a963c)){_0xbacd49[_0x2a963c]=_0x468a2c[_0x2a963c];}}}return _0xbacd49;}exports[_0x38c7('0xe')]=function(_0x52d47e,_0x23baee,_0x3610c8,_0x3c665d){return new BPromise(function(_0x249556,_0x5b4e4a){_0x3c665d=combineOptions(_0x3c665d);var _0x4a5606=new Buffer(_0x3610c8);var _0x45f756=fs['createReadStream'](_0x52d47e);var _0x300a7b=fs[_0x38c7('0xf')](_0x23baee);var _0x3c3a8b=crypto[_0x38c7('0x10')](_0x3c665d[_0x38c7('0x7')],_0x4a5606);_0x45f756['on'](_0x38c7('0x11'),function(_0x43fed1){var _0x3508de=new Buffer(_0x3c3a8b[_0x38c7('0x12')](_0x43fed1),_0x38c7('0x13'));_0x300a7b[_0x38c7('0x14')](_0x3508de);});_0x45f756['on']('end',function(){try{var _0x3fd786=new Buffer(_0x3c3a8b[_0x38c7('0x15')]('binary'),_0x38c7('0x13'));_0x300a7b[_0x38c7('0x14')](_0x3fd786);_0x300a7b[_0x38c7('0x16')]();_0x300a7b['on'](_0x38c7('0x17'),function(){return _0x249556(_0x23baee);});}catch(_0x4d3622){fs[_0x38c7('0x18')](_0x23baee);return _0x5b4e4a(_0x4d3622);}});});};exports[_0x38c7('0x19')]=function(_0x241408,_0x26456d,_0xbed8ab,_0x479ed0){return new BPromise(function(_0x23cbbc,_0x3abfbb){_0x479ed0=combineOptions(_0x479ed0);var _0xa32dbb=new Buffer(_0xbed8ab);var _0x13c14b=fs[_0x38c7('0x1a')](_0x241408);var _0x1bbac2=fs[_0x38c7('0xf')](_0x26456d);var _0xa99dc=crypto[_0x38c7('0x1b')](_0x479ed0['algorithm'],_0xa32dbb);_0x13c14b['on'](_0x38c7('0x11'),function(_0x437787){var _0x1b413b=new Buffer(_0xa99dc[_0x38c7('0x12')](_0x437787),_0x38c7('0x13'));_0x1bbac2[_0x38c7('0x14')](_0x1b413b);});_0x13c14b['on'](_0x38c7('0x16'),function(){try{var _0x1d3d38=new Buffer(_0xa99dc[_0x38c7('0x15')]('binary'),_0x38c7('0x13'));_0x1bbac2[_0x38c7('0x14')](_0x1d3d38);_0x1bbac2[_0x38c7('0x16')]();_0x1bbac2['on'](_0x38c7('0x17'),function(){return _0x23cbbc(_0x26456d);});}catch(_0x4a5227){fs[_0x38c7('0x18')](_0x26456d);return _0x3abfbb(_0x4a5227);}});});};exports[_0x38c7('0x1c')]=function(_0x45ad29,_0x3f2c6f,_0x10fa14){var _0x20dc3f=_0x10fa14||stringOptions[_0x38c7('0x7')];var _0x5ccb46=_0x3f2c6f||stringOptions[_0x38c7('0x1d')];var _0x5f4fb5=crypto[_0x38c7('0x10')](_0x20dc3f,_0x5ccb46);var _0x3423a9=_0x5f4fb5[_0x38c7('0x12')](_0x45ad29,_0x38c7('0x1e'),_0x38c7('0x1f'));_0x3423a9+=_0x5f4fb5[_0x38c7('0x15')](_0x38c7('0x1f'));return _0x3423a9;};exports['decryptString']=function(_0x42d178,_0x1dccba,_0x40f0af){var _0x146ec9=_0x40f0af||stringOptions['algorithm'];var _0x4b3790=_0x1dccba||stringOptions['secret'];var _0x1e213f=crypto[_0x38c7('0x1b')](_0x146ec9,_0x4b3790);var _0x5aeb3e=_0x1e213f[_0x38c7('0x12')](_0x42d178,_0x38c7('0x1f'),'utf8');_0x5aeb3e+=_0x1e213f['final'](_0x38c7('0x1e'));return _0x5aeb3e;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 5fc77cc..d04780f 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 _0xf862=['Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect'];(function(_0x3c1099,_0x4cd808){var _0x1ae4bf=function(_0x1406fc){while(--_0x1406fc){_0x3c1099['push'](_0x3c1099['shift']());}};_0x1ae4bf(++_0x4cd808);}(_0xf862,0x9f));var _0x2f86=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xf862[_0x3ea913];return _0x2b4f28;};'use strict';var util=require(_0x2f86('0x0'));var path=require(_0x2f86('0x1'));var _=require('lodash');var csv=require(_0x2f86('0x2'));var fs=require('fs');var BPromise=require(_0x2f86('0x3'));var zipdir=require(_0x2f86('0x4'));var rimraf=require(_0x2f86('0x5'));var db=require(_0x2f86('0x6'))['db'];var dbH=require(_0x2f86('0x6'))['dbH'];var logger=require(_0x2f86('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x2f86('0x8')][0x2]);var QUERY=process[_0x2f86('0x8')][0x3];var PATH=process[_0x2f86('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x564548,_0x5e3574){var _0x10d065={'status':_0x564548};var _0x244ab3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5e3574){_0x10d065[_0x2f86('0x9')]=_0x5e3574;}return db[_0x2f86('0xa')][_0x2f86('0xb')](_0x10d065,_0x244ab3);}function main(){var _0x2e5b6c=0x1388;var _0x3521f0;logger[_0x2f86('0xc')](util[_0x2f86('0xd')](_0x2f86('0xe'),EXTRACTED_REPORT_ID,_0x2f86('0xf')));return db[_0x2f86('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2f86('0x11'),'splitSizeCsv']})[_0x2f86('0x12')](function(_0x5dd90d){if(_0x5dd90d){_0x3521f0=_0x5dd90d;_0x2e5b6c=_0x3521f0[_0x2f86('0x13')]||0x1388;}})['then'](function(){return dbH[_0x2f86('0x14')]['query'](util[_0x2f86('0xd')](_0x2f86('0x15'),QUERY),{'type':dbH[_0x2f86('0x14')][_0x2f86('0x16')][_0x2f86('0x17')]});})['then'](function(_0x23cbac){if(!_0x23cbac[0x0][_0x2f86('0x18')]){return analyticExtractedReport(_0x2f86('0x19'));}var _0xa1fecc=[];var _0x4e1080=0x0;if(_0x3521f0[_0x2f86('0x11')]){if(_0x23cbac&&_0x23cbac[_0x2f86('0x1a')]){var _0x302b74=_[_0x2f86('0x1b')](_0x23cbac[0x0][_0x2f86('0x18')]/_0x2e5b6c);var _0x76b4ca=Number[_0x2f86('0x1c')](_0x23cbac[0x0][_0x2f86('0x18')]/_0x2e5b6c)?_0x23cbac[0x0][_0x2f86('0x18')]%_0x2e5b6c:0x0;_0x302b74[_0x2f86('0x1d')](function(_0x1ed3d5){if(_0x1ed3d5>0x0){_0x4e1080+=_0x2e5b6c;}_0xa1fecc['push'](dbH[_0x2f86('0x14')][_0x2f86('0x1e')](util[_0x2f86('0xd')](_0x2f86('0x1f'),QUERY,_0x2e5b6c,_0x4e1080),{'type':dbH[_0x2f86('0x14')][_0x2f86('0x16')]['SELECT']}));});if(_0x76b4ca>0x0){_0x4e1080+=_0x2e5b6c;_0xa1fecc[_0x2f86('0x20')](dbH[_0x2f86('0x14')][_0x2f86('0x1e')](util[_0x2f86('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x76b4ca,_0x4e1080),{'type':dbH[_0x2f86('0x14')][_0x2f86('0x16')][_0x2f86('0x17')]}));}}}else{_0xa1fecc[_0x2f86('0x20')](dbH[_0x2f86('0x14')][_0x2f86('0x1e')](QUERY,{'type':dbH[_0x2f86('0x14')][_0x2f86('0x16')][_0x2f86('0x17')]}));}var _0x5af866=path[_0x2f86('0x21')](PATH);var _0x1d337c=path[_0x2f86('0x22')](PATH,_0x2f86('0x23'));var _0x174eed=_0x3521f0[_0x2f86('0x11')]&&_0xa1fecc['length']>0x1;var _0x1b9fc3=[];if(!fs[_0x2f86('0x24')](path[_0x2f86('0x25')](_0x5af866,_0x1d337c))&&_0x174eed){fs[_0x2f86('0x26')](path['join'](_0x5af866,_0x1d337c));}return BPromise[_0x2f86('0x27')](_0xa1fecc,function(_0x16d281){_0x1b9fc3[_0x2f86('0x20')](_0x16d281);})[_0x2f86('0x12')](function(){for(var _0x4ecab3=0x0;_0x4ecab3<_0x1b9fc3['length'];_0x4ecab3+=0x1){var _0x299c23;var _0x3047bf=_0x1b9fc3[_0x4ecab3];if(_0x174eed){_0x299c23=path[_0x2f86('0x25')](_0x5af866,_0x1d337c,util[_0x2f86('0xd')](_0x2f86('0x28'),_0x1d337c,_0x4ecab3,_0x2f86('0x29')));}else{_0x299c23=path['join'](_0x5af866,util[_0x2f86('0xd')](_0x2f86('0x2a'),_0x1d337c,_0x2f86('0x29')));}fs['writeFileSync'](_0x299c23,csv(_0x3047bf));}})[_0x2f86('0x12')](function(){if(_0x174eed){return new Promise(function(_0x326143){zipdir(path[_0x2f86('0x25')](_0x5af866,_0x1d337c),{'saveTo':path[_0x2f86('0x25')](_0x5af866,util[_0x2f86('0xd')]('%s.%s',_0x1d337c,_0x2f86('0x2b')))},function(_0x4749a2,_0x44ae91){rimraf(path[_0x2f86('0x25')](_0x5af866,_0x1d337c),function(){});_0x326143(_0x2f86('0x2c'));});});}})[_0x2f86('0x12')](function(){logger[_0x2f86('0xc')](util[_0x2f86('0xd')](_0x2f86('0x2d'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x2f86('0x2e'),_0x174eed?util[_0x2f86('0xd')](_0x2f86('0x2a'),_0x1d337c,_0x174eed?_0x2f86('0x2b'):'csv'):null);});})[_0x2f86('0x2f')](function(_0x2aeef0){logger[_0x2f86('0xc')](util[_0x2f86('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2f86('0xf')),util[_0x2f86('0x30')](_0x2aeef0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2f86('0x31'));})[_0x2f86('0x32')](function(){process[_0x2f86('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x54bf=['Setting','split','splitSizeCsv','sequelize','QueryTypes','SELECT','Empty','length','range','num','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','mkdirSync','each','then','join','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x86a170,_0x1a31d7){var _0x640e8b=function(_0xa7d2a2){while(--_0xa7d2a2){_0x86a170['push'](_0x86a170['shift']());}};_0x640e8b(++_0x1a31d7);}(_0x54bf,0x7c));var _0xf54b=function(_0x487308,_0xc78364){_0x487308=_0x487308-0x0;var _0x5e3b09=_0x54bf[_0x487308];return _0x5e3b09;};'use strict';var util=require(_0xf54b('0x0'));var path=require(_0xf54b('0x1'));var _=require('lodash');var csv=require(_0xf54b('0x2'));var fs=require('fs');var BPromise=require(_0xf54b('0x3'));var zipdir=require(_0xf54b('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf54b('0x5')];var logger=require('../../config/logger')(_0xf54b('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf54b('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3fcefe,_0x5bec79){var _0x243af8={'status':_0x3fcefe};var _0x1345f7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5bec79){_0x243af8[_0xf54b('0x8')]=_0x5bec79;}return db[_0xf54b('0x9')][_0xf54b('0xa')](_0x243af8,_0x1345f7);}function main(){var _0x5a3407=0x1388;var _0x4e4150;logger[_0xf54b('0xb')](util[_0xf54b('0xc')](_0xf54b('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xf54b('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf54b('0xf'),_0xf54b('0x10')]})['then'](function(_0x56539c){if(_0x56539c){_0x4e4150=_0x56539c;_0x5a3407=_0x4e4150['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xf54b('0x11')]['query'](util[_0xf54b('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf54b('0x11')][_0xf54b('0x12')][_0xf54b('0x13')]});})['then'](function(_0x2fe7d0){if(!_0x2fe7d0[0x0]['num']){return analyticExtractedReport(_0xf54b('0x14'));}var _0x1208db=[];var _0x5b777a=0x0;if(_0x4e4150[_0xf54b('0xf')]){if(_0x2fe7d0&&_0x2fe7d0[_0xf54b('0x15')]){var _0x3c3888=_[_0xf54b('0x16')](_0x2fe7d0[0x0][_0xf54b('0x17')]/_0x5a3407);var _0xd9cc50=Number[_0xf54b('0x18')](_0x2fe7d0[0x0][_0xf54b('0x17')]/_0x5a3407)?_0x2fe7d0[0x0][_0xf54b('0x17')]%_0x5a3407:0x0;_0x3c3888['forEach'](function(_0x333273){if(_0x333273>0x0){_0x5b777a+=_0x5a3407;}_0x1208db[_0xf54b('0x19')](dbH[_0xf54b('0x11')][_0xf54b('0x1a')](util['format'](_0xf54b('0x1b'),QUERY,_0x5a3407,_0x5b777a),{'type':dbH[_0xf54b('0x11')]['QueryTypes']['SELECT']}));});if(_0xd9cc50>0x0){_0x5b777a+=_0x5a3407;_0x1208db[_0xf54b('0x19')](dbH[_0xf54b('0x11')][_0xf54b('0x1a')](util[_0xf54b('0xc')](_0xf54b('0x1b'),QUERY,_0xd9cc50,_0x5b777a),{'type':dbH[_0xf54b('0x11')][_0xf54b('0x12')][_0xf54b('0x13')]}));}}}else{_0x1208db['push'](dbH[_0xf54b('0x11')]['query'](QUERY,{'type':dbH[_0xf54b('0x11')][_0xf54b('0x12')][_0xf54b('0x13')]}));}var _0x82e8e0=path['dirname'](PATH);var _0x5be256=path[_0xf54b('0x1c')](PATH,'.csv');var _0x3f69e3=_0x4e4150[_0xf54b('0xf')]&&_0x1208db[_0xf54b('0x15')]>0x1;var _0x1c25bf=[];if(!fs['existsSync'](path['join'](_0x82e8e0,_0x5be256))&&_0x3f69e3){fs[_0xf54b('0x1d')](path['join'](_0x82e8e0,_0x5be256));}return BPromise[_0xf54b('0x1e')](_0x1208db,function(_0x5e852a){_0x1c25bf['push'](_0x5e852a);})[_0xf54b('0x1f')](function(){for(var _0xc54523=0x0;_0xc54523<_0x1c25bf[_0xf54b('0x15')];_0xc54523+=0x1){var _0x4c4269;var _0x44444c=_0x1c25bf[_0xc54523];if(_0x3f69e3){_0x4c4269=path[_0xf54b('0x20')](_0x82e8e0,_0x5be256,util[_0xf54b('0xc')]('%s%d.%s',_0x5be256,_0xc54523,_0xf54b('0x21')));}else{_0x4c4269=path[_0xf54b('0x20')](_0x82e8e0,util[_0xf54b('0xc')]('%s.%s',_0x5be256,'csv'));}fs[_0xf54b('0x22')](_0x4c4269,csv(_0x44444c));}})['then'](function(){if(_0x3f69e3){return new Promise(function(_0x5efd08){zipdir(path['join'](_0x82e8e0,_0x5be256),{'saveTo':path[_0xf54b('0x20')](_0x82e8e0,util['format'](_0xf54b('0x23'),_0x5be256,_0xf54b('0x24')))},function(_0x385741,_0x18dd89){rimraf(path['join'](_0x82e8e0,_0x5be256),function(){});_0x5efd08(_0xf54b('0x25'));});});}})[_0xf54b('0x1f')](function(){logger[_0xf54b('0xb')](util[_0xf54b('0xc')](_0xf54b('0x26'),EXTRACTED_REPORT_ID,_0xf54b('0x27')));return analyticExtractedReport(_0xf54b('0x28'),_0x3f69e3?util['format'](_0xf54b('0x23'),_0x5be256,_0x3f69e3?'zip':_0xf54b('0x21')):null);});})[_0xf54b('0x29')](function(_0xee204f){logger[_0xf54b('0xb')](util[_0xf54b('0xc')](_0xf54b('0x2a'),EXTRACTED_REPORT_ID,_0xf54b('0x27')),util['inspect'](_0xee204f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf54b('0x2b'));})[_0xf54b('0x2c')](function(){process[_0xf54b('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 4cd88d8..e3411dc 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 _0x7ff0=['info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','toString','fill','auto','body','concat','chunk','keys','forEach','format','name','startDate','endDate','pageBreak','push','landscape','\x20/\x20','Arial','right','num','Empty','Setting','split','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','length','join','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished'];(function(_0x283d65,_0x5513d2){var _0x521f04=function(_0x5c7e73){while(--_0x5c7e73){_0x283d65['push'](_0x283d65['shift']());}};_0x521f04(++_0x5513d2);}(_0x7ff0,0xc9));var _0x07ff=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x7ff0[_0x2d61ac];return _0x3f7d3c;};'use strict';var _=require(_0x07ff('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x07ff('0x1'));var moment=require(_0x07ff('0x2'));var htmlToPdfmake=require(_0x07ff('0x3'));var PdfPrinter=require(_0x07ff('0x4'));var zipdir=require(_0x07ff('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x07ff('0x6'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x07ff('0x7'));var db=require(_0x07ff('0x8'))['db'];var dbH=require(_0x07ff('0x8'))[_0x07ff('0x9')];var logger=require('../../config/logger')(_0x07ff('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x07ff('0xb')][0x2]);var QUERY=process[_0x07ff('0xb')][0x3];var PATH=process[_0x07ff('0xb')][0x4];var NAME=process[_0x07ff('0xb')][0x5];var FORMAT=_0x07ff('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4b8935,_0x20ed48){var _0x10e1fd={'status':_0x4b8935};var _0xe44b30={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x20ed48){_0x10e1fd[_0x07ff('0xd')]=_0x20ed48;}return db[_0x07ff('0xe')][_0x07ff('0xf')](_0x10e1fd,_0xe44b30);}function getHeaders(_0x4b94aa){return _['map'](_0x4b94aa,function(_0x14b274){return{'text':_0x14b274,'style':'tableHeader'};});}function getRows(_0x57dc9a,_0x539bba){return _[_0x07ff('0x10')](_0x539bba,function(_0x2e31d0){return _(_0x2e31d0)['pick'](_0x57dc9a)[_0x07ff('0x10')](function(_0x13200d){return _0x13200d?_[_0x07ff('0x11')](_0x13200d):'';})['value']();});}function createTable(_0x32136b,_0x13cdd8){var _0x574187={'widths':_[_0x07ff('0x12')](Array(_0x32136b['length']),0x91),'heights':function(_0x32b1ef){return _0x32b1ef===0x0?_0x07ff('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5c577c=getHeaders(_0x32136b);_0x574187[_0x07ff('0x14')]['push'](_0x5c577c);var _0x1d5544=getRows(_0x32136b,_0x13cdd8);_0x574187['body']=_0x574187[_0x07ff('0x14')][_0x07ff('0x15')](_0x1d5544);return _0x574187;}function createTables(_0x44f76b){var _0x463548=[];var _0x1f4319=_[_0x07ff('0x16')](Object[_0x07ff('0x17')](_0x44f76b[0x0]),0x5);_0x1f4319[_0x07ff('0x18')](function(_0x472dee){_0x463548['push'](createTable(_0x472dee,_0x44f76b));});return _0x463548;}function getPDFDocDefinition(_0xe6bd78){var _0x3cb818=util[_0x07ff('0x19')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x07ff('0x1a')],moment(EXTRACTED_REPORT[_0x07ff('0x1b')])[_0x07ff('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0x07ff('0x1c')])[_0x07ff('0x19')](FORMAT));var _0x189169=[];for(var _0x28f20d=0x0;_0x28f20d<_0xe6bd78['length'];_0x28f20d++){var _0x15ec1c=[];if(_0x28f20d===0x0){_0x15ec1c['push']({'text':_0x3cb818,'style':'header'});}var _0x49981d={'table':_0xe6bd78[_0x28f20d]};if(_0x28f20d>0x0){_0x49981d[_0x07ff('0x1d')]='before';_0x49981d['margin']=[0x0,0x46,0x0,0x0];}_0x15ec1c[_0x07ff('0x1e')](_0x49981d);_0x189169[_0x07ff('0x1e')](_0x15ec1c);}return{'pageSize':'A4','pageOrientation':_0x07ff('0x1f'),'content':_0x189169,'footer':function(_0x21e961,_0xcdb67){return{'text':_0x21e961['toString']()+_0x07ff('0x20')+_0xcdb67,'style':'footer'};},'defaultStyle':{'font':_0x07ff('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x07ff('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5c62dd){var _0x400c1d=0x1388;var _0x357cf8;if(!_0x5c62dd[0x0][_0x07ff('0x23')]){return analyticExtractedReport(_0x07ff('0x24'));}return db[_0x07ff('0x25')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x07ff('0x26'),_0x07ff('0x27')]})[_0x07ff('0x28')](function(_0x1c8dcf){if(_0x1c8dcf){_0x357cf8=_0x1c8dcf;_0x400c1d=_0x357cf8[_0x07ff('0x27')]||0x3e8;}})['then'](function(){var _0xc9f65b=[];var _0x1f5910=0x0;if(_0x357cf8[_0x07ff('0x26')]){if(_0x5c62dd&&_0x5c62dd['length']){var _0x24e1d3=_['range'](_0x5c62dd[0x0][_0x07ff('0x23')]/_0x400c1d);var _0x4f5c10=Number[_0x07ff('0x29')](_0x5c62dd[0x0]['num']/_0x400c1d)?_0x5c62dd[0x0][_0x07ff('0x23')]%_0x400c1d:0x0;_0x24e1d3[_0x07ff('0x18')](function(_0x34b22d){if(_0x34b22d>0x0){_0x1f5910+=_0x400c1d;}_0xc9f65b[_0x07ff('0x1e')](dbH[_0x07ff('0x2a')][_0x07ff('0x2b')](util['format'](_0x07ff('0x2c'),QUERY,_0x400c1d,_0x1f5910),{'type':dbH[_0x07ff('0x2a')]['QueryTypes'][_0x07ff('0x2d')]}));});if(_0x4f5c10>0x0){_0x1f5910+=_0x400c1d;_0xc9f65b[_0x07ff('0x1e')](dbH[_0x07ff('0x2a')]['query'](util['format'](_0x07ff('0x2c'),QUERY,_0x4f5c10,_0x1f5910),{'type':dbH['sequelize'][_0x07ff('0x2e')][_0x07ff('0x2d')]}));}}}else{_0xc9f65b[_0x07ff('0x1e')](dbH[_0x07ff('0x2a')][_0x07ff('0x2b')](QUERY,{'type':dbH[_0x07ff('0x2a')][_0x07ff('0x2e')][_0x07ff('0x2d')]}));}var _0x17cd73=path[_0x07ff('0x2f')](PATH);var _0x5862de=path[_0x07ff('0x30')](PATH,_0x07ff('0x31'));var _0x380f00=_0x357cf8[_0x07ff('0x26')]&&_0xc9f65b[_0x07ff('0x32')]>0x1;var _0x1c2d76=[];if(!fs['existsSync'](path[_0x07ff('0x33')](_0x17cd73,_0x5862de))&&_0x380f00){fs['mkdirSync'](path[_0x07ff('0x33')](_0x17cd73,_0x5862de));}return BPromise['each'](_0xc9f65b,function(_0x5459be){_0x1c2d76['push'](_0x5459be);})['then'](function(){var _0x1bc194=[];for(var _0x348e13=0x0;_0x348e13<_0x1c2d76[_0x07ff('0x32')];_0x348e13+=0x1){var _0x864b10=_0x1c2d76[_0x348e13];var _0xb646c0=createTables(_[_0x07ff('0x34')](_0x864b10));var _0x59beab;var _0x143b0a=getPDFDocDefinition(_0xb646c0);var _0x24a5b6=getPDFPrinter();var _0x514ed1=_0x24a5b6[_0x07ff('0x35')](_0x143b0a);if(_0x380f00){_0x59beab=path['join'](_0x17cd73,_0x5862de,util[_0x07ff('0x19')](_0x07ff('0x36'),_0x5862de,_0x348e13,_0x07ff('0x37')));}else{_0x59beab=path['join'](_0x17cd73,util[_0x07ff('0x19')](_0x07ff('0x38'),_0x5862de,_0x07ff('0x37')));}_0x1bc194['push'](writePDFDocument(_0x514ed1,_0x59beab));}return Promise[_0x07ff('0x39')](_0x1bc194);})['then'](function(){if(_0x380f00){return new Promise(function(_0x73f0e5){zipdir(path[_0x07ff('0x33')](_0x17cd73,_0x5862de),{'saveTo':path[_0x07ff('0x33')](_0x17cd73,util[_0x07ff('0x19')](_0x07ff('0x38'),_0x5862de,_0x07ff('0x3a')))},function(){rimraf(path[_0x07ff('0x33')](_0x17cd73,_0x5862de),function(){});_0x73f0e5(_0x07ff('0x3b'));});});}})['then'](function(){if(!_0x380f00)return;rimraf(path[_0x07ff('0x33')](_0x17cd73,_0x5862de),function(){});})[_0x07ff('0x28')](function(){logger[_0x07ff('0x3c')](util[_0x07ff('0x19')](_0x07ff('0x3d'),EXTRACTED_REPORT_ID,_0x07ff('0x3e')));return analyticExtractedReport(_0x07ff('0x3f'),_0x380f00?util[_0x07ff('0x19')](_0x07ff('0x38'),_0x5862de,_0x380f00?_0x07ff('0x3a'):_0x07ff('0x37')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x07ff('0x3c')](util[_0x07ff('0x19')](_0x07ff('0x40'),EXTRACTED_REPORT_ID,_0x07ff('0x3e')));return db[_0x07ff('0xe')][_0x07ff('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x07ff('0x28')](function(_0x12b139){EXTRACTED_REPORT=_0x12b139;return dbH[_0x07ff('0x2a')][_0x07ff('0x2b')](util[_0x07ff('0x19')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x07ff('0x2e')][_0x07ff('0x2d')]});})[_0x07ff('0x28')](extractReport)[_0x07ff('0x42')](function(_0xc895bf){logger[_0x07ff('0x3c')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x07ff('0x43')](_0xc895bf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x07ff('0x44'));})[_0x07ff('0x45')](function(){process[_0x07ff('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x50a331=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x07ff('0x47'),'italics':__dirname+_0x07ff('0x48'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x50a331;}function getPDFDocDefinitionFromHTML(_0x20174e,_0x41f26e){var _0x275146=util['format']('%s\x20#%d',_0x41f26e[_0x07ff('0x49')],_0x41f26e[_0x07ff('0x4a')]);var _0x1940da=moment()[_0x07ff('0x19')](_0x07ff('0x4b'))[_0x07ff('0x11')]();var _0x289af9=htmlToPdfmake(_0x20174e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x289af9],'defaultStyle':{'font':_0x07ff('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x07ff('0x4c'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x07ff('0x4c')}},'header':function(){return[{'text':_0x07ff('0x4d'),'style':_0x07ff('0x4e')}];},'footer':function(_0x1a5f3b,_0x34b6ed){return[{'text':util['format'](_0x07ff('0x4f'),_0x275146,_0x1a5f3b,_0x34b6ed,_0x1940da),'style':_0x07ff('0x50')}];}};}function writePDFDocument(_0x1630ed,_0x293b51){return new Promise(function(_0x23ace6,_0x5444de){var _0x26cc73=_0x1630ed[_0x07ff('0x51')](fs[_0x07ff('0x52')](_0x293b51));_0x26cc73['on']('finish',function(){_0x23ace6(_0x07ff('0x53'));});_0x26cc73['on'](_0x07ff('0x54'),function(_0x1d1af4){_0x5444de(_0x1d1af4);});_0x1630ed[_0x07ff('0x55')]();});}exports[_0x07ff('0x56')]=function(_0x31f1f8,_0x233ae9){var _0x454577=getPDFPrinter();var _0x3569b0=getPDFDocDefinitionFromHTML(_0x31f1f8,_0x233ae9);var _0x4b6750=_0x454577['createPdfKitDocument'](_0x3569b0);return writePDFDocument(_0x4b6750,_0x233ae9[_0x07ff('0x1')])[_0x07ff('0x42')](function(_0x5720c4){throw _0x5720c4;});}; \ No newline at end of file +var _0xfb2a=['finish','createPdfFromHTML','catch','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','fill','length','auto','body','concat','keys','forEach','push','format','name','endDate','pageBreak','before','margin','\x20/\x20','footer','Arial','right','num','Empty','Setting','splitSizePdf','then','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%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','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','createWriteStream'];(function(_0x41d07c,_0x2f0ed1){var _0x3685f8=function(_0x4035e2){while(--_0x4035e2){_0x41d07c['push'](_0x41d07c['shift']());}};_0x3685f8(++_0x2f0ed1);}(_0xfb2a,0x1c0));var _0xafb2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfb2a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xafb2('0x0'));var fs=require('fs');var util=require(_0xafb2('0x1'));var path=require(_0xafb2('0x2'));var moment=require(_0xafb2('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xafb2('0x4'));var zipdir=require(_0xafb2('0x5'));var rimraf=require(_0xafb2('0x6'));var JSDOM=require(_0xafb2('0x7'))[_0xafb2('0x8')];var window=new JSDOM('')[_0xafb2('0x9')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xafb2('0xa')];var logger=require(_0xafb2('0xb'))(_0xafb2('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xafb2('0xd')][0x3];var PATH=process[_0xafb2('0xd')][0x4];var NAME=process[_0xafb2('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1d0ec0,_0x1b569e){var _0x6aeb71={'status':_0x1d0ec0};var _0x53dc09={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b569e){_0x6aeb71[_0xafb2('0xe')]=_0x1b569e;}return db[_0xafb2('0xf')][_0xafb2('0x10')](_0x6aeb71,_0x53dc09);}function getHeaders(_0x27ebf2){return _[_0xafb2('0x11')](_0x27ebf2,function(_0x113b5c){return{'text':_0x113b5c,'style':_0xafb2('0x12')};});}function getRows(_0x25d992,_0x48d9dc){return _[_0xafb2('0x11')](_0x48d9dc,function(_0x1ae523){return _(_0x1ae523)[_0xafb2('0x13')](_0x25d992)[_0xafb2('0x11')](function(_0x1002c5){return _0x1002c5?_[_0xafb2('0x14')](_0x1002c5):'';})['value']();});}function createTable(_0x4b2847,_0x92cb70){var _0x3845fb={'widths':_[_0xafb2('0x15')](Array(_0x4b2847[_0xafb2('0x16')]),0x91),'heights':function(_0x3968eb){return _0x3968eb===0x0?_0xafb2('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x14f34e=getHeaders(_0x4b2847);_0x3845fb[_0xafb2('0x18')]['push'](_0x14f34e);var _0x239ee0=getRows(_0x4b2847,_0x92cb70);_0x3845fb[_0xafb2('0x18')]=_0x3845fb[_0xafb2('0x18')][_0xafb2('0x19')](_0x239ee0);return _0x3845fb;}function createTables(_0x4fbba1){var _0x541a6f=[];var _0x4208ab=_['chunk'](Object[_0xafb2('0x1a')](_0x4fbba1[0x0]),0x5);_0x4208ab[_0xafb2('0x1b')](function(_0x5791fe){_0x541a6f[_0xafb2('0x1c')](createTable(_0x5791fe,_0x4fbba1));});return _0x541a6f;}function getPDFDocDefinition(_0x5e2d3a){var _0x13a55c=util[_0xafb2('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xafb2('0x1e')],moment(EXTRACTED_REPORT['startDate'])[_0xafb2('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xafb2('0x1f')])[_0xafb2('0x1d')](FORMAT));var _0x3ecbbb=[];for(var _0x1c21cc=0x0;_0x1c21cc<_0x5e2d3a[_0xafb2('0x16')];_0x1c21cc++){var _0x3a883a=[];if(_0x1c21cc===0x0){_0x3a883a[_0xafb2('0x1c')]({'text':_0x13a55c,'style':'header'});}var _0x339a88={'table':_0x5e2d3a[_0x1c21cc]};if(_0x1c21cc>0x0){_0x339a88[_0xafb2('0x20')]=_0xafb2('0x21');_0x339a88[_0xafb2('0x22')]=[0x0,0x46,0x0,0x0];}_0x3a883a[_0xafb2('0x1c')](_0x339a88);_0x3ecbbb[_0xafb2('0x1c')](_0x3a883a);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3ecbbb,'footer':function(_0x2846e8,_0x5e9d3b){return{'text':_0x2846e8[_0xafb2('0x14')]()+_0xafb2('0x23')+_0x5e9d3b,'style':_0xafb2('0x24')};},'defaultStyle':{'font':_0xafb2('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xafb2('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1dbcaa){var _0x21d8b0=0x1388;var _0x28d481;if(!_0x1dbcaa[0x0][_0xafb2('0x27')]){return analyticExtractedReport(_0xafb2('0x28'));}return db[_0xafb2('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xafb2('0x2a')]})[_0xafb2('0x2b')](function(_0x4e004f){if(_0x4e004f){_0x28d481=_0x4e004f;_0x21d8b0=_0x28d481[_0xafb2('0x2a')]||0x3e8;}})['then'](function(){var _0xcad82=[];var _0x39dce2=0x0;if(_0x28d481[_0xafb2('0x2c')]){if(_0x1dbcaa&&_0x1dbcaa[_0xafb2('0x16')]){var _0x3091a8=_[_0xafb2('0x2d')](_0x1dbcaa[0x0][_0xafb2('0x27')]/_0x21d8b0);var _0x5d5ab6=Number[_0xafb2('0x2e')](_0x1dbcaa[0x0][_0xafb2('0x27')]/_0x21d8b0)?_0x1dbcaa[0x0][_0xafb2('0x27')]%_0x21d8b0:0x0;_0x3091a8[_0xafb2('0x1b')](function(_0x28569f){if(_0x28569f>0x0){_0x39dce2+=_0x21d8b0;}_0xcad82[_0xafb2('0x1c')](dbH[_0xafb2('0x2f')][_0xafb2('0x30')](util['format'](_0xafb2('0x31'),QUERY,_0x21d8b0,_0x39dce2),{'type':dbH['sequelize'][_0xafb2('0x32')][_0xafb2('0x33')]}));});if(_0x5d5ab6>0x0){_0x39dce2+=_0x21d8b0;_0xcad82['push'](dbH[_0xafb2('0x2f')][_0xafb2('0x30')](util[_0xafb2('0x1d')](_0xafb2('0x31'),QUERY,_0x5d5ab6,_0x39dce2),{'type':dbH[_0xafb2('0x2f')][_0xafb2('0x32')]['SELECT']}));}}}else{_0xcad82['push'](dbH[_0xafb2('0x2f')][_0xafb2('0x30')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xafb2('0x33')]}));}var _0x558c66=path[_0xafb2('0x34')](PATH);var _0x20dc07=path[_0xafb2('0x35')](PATH,_0xafb2('0x36'));var _0x521a27=_0x28d481[_0xafb2('0x2c')]&&_0xcad82[_0xafb2('0x16')]>0x1;var _0xf8ebd=[];if(!fs[_0xafb2('0x37')](path[_0xafb2('0x38')](_0x558c66,_0x20dc07))&&_0x521a27){fs[_0xafb2('0x39')](path[_0xafb2('0x38')](_0x558c66,_0x20dc07));}return BPromise['each'](_0xcad82,function(_0x35275c){_0xf8ebd[_0xafb2('0x1c')](_0x35275c);})[_0xafb2('0x2b')](function(){var _0x135406=[];for(var _0x5b087e=0x0;_0x5b087e<_0xf8ebd[_0xafb2('0x16')];_0x5b087e+=0x1){var _0x39ba43=_0xf8ebd[_0x5b087e];var _0x5cda87=createTables(_[_0xafb2('0x3a')](_0x39ba43));var _0x8e4af0;var _0x420334=getPDFDocDefinition(_0x5cda87);var _0x11a8cc=getPDFPrinter();var _0x597fba=_0x11a8cc[_0xafb2('0x3b')](_0x420334);if(_0x521a27){_0x8e4af0=path['join'](_0x558c66,_0x20dc07,util['format'](_0xafb2('0x3c'),_0x20dc07,_0x5b087e,_0xafb2('0x3d')));}else{_0x8e4af0=path[_0xafb2('0x38')](_0x558c66,util[_0xafb2('0x1d')](_0xafb2('0x3e'),_0x20dc07,'pdf'));}_0x135406[_0xafb2('0x1c')](writePDFDocument(_0x597fba,_0x8e4af0));}return Promise[_0xafb2('0x3f')](_0x135406);})[_0xafb2('0x2b')](function(){if(_0x521a27){return new Promise(function(_0x209009){zipdir(path[_0xafb2('0x38')](_0x558c66,_0x20dc07),{'saveTo':path[_0xafb2('0x38')](_0x558c66,util[_0xafb2('0x1d')](_0xafb2('0x3e'),_0x20dc07,_0xafb2('0x40')))},function(){rimraf(path[_0xafb2('0x38')](_0x558c66,_0x20dc07),function(){});_0x209009(_0xafb2('0x41'));});});}})[_0xafb2('0x2b')](function(){if(!_0x521a27)return;rimraf(path[_0xafb2('0x38')](_0x558c66,_0x20dc07),function(){});})[_0xafb2('0x2b')](function(){logger[_0xafb2('0x42')](util[_0xafb2('0x1d')](_0xafb2('0x43'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xafb2('0x44'),_0x521a27?util[_0xafb2('0x1d')]('%s.%s',_0x20dc07,_0x521a27?_0xafb2('0x40'):_0xafb2('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xafb2('0x42')](util[_0xafb2('0x1d')](_0xafb2('0x45'),EXTRACTED_REPORT_ID,_0xafb2('0x46')));return db['AnalyticExtractedReport'][_0xafb2('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x12b711){EXTRACTED_REPORT=_0x12b711;return dbH[_0xafb2('0x2f')][_0xafb2('0x30')](util['format'](_0xafb2('0x48'),QUERY),{'type':dbH['sequelize'][_0xafb2('0x32')][_0xafb2('0x33')]});})[_0xafb2('0x2b')](extractReport)['catch'](function(_0x21eb93){logger[_0xafb2('0x42')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xafb2('0x46')),util[_0xafb2('0x49')](_0x21eb93,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xafb2('0x4a'));})[_0xafb2('0x4b')](function(){process[_0xafb2('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x297826=new PdfPrinter({'Arial':{'normal':__dirname+_0xafb2('0x4d'),'bold':__dirname+_0xafb2('0x4e'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xafb2('0x4f')}});return _0x297826;}function getPDFDocDefinitionFromHTML(_0x50223b,_0x8eb32){var _0x49b9c0=util[_0xafb2('0x1d')](_0xafb2('0x50'),_0x8eb32[_0xafb2('0x51')],_0x8eb32[_0xafb2('0x52')]);var _0x3a804e=moment()[_0xafb2('0x1d')]('YYYY-MM-DD')['toString']();var _0x3f12cc=htmlToPdfmake(_0x50223b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3f12cc],'defaultStyle':{'font':_0xafb2('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xafb2('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xafb2('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xafb2('0x54'),'style':'header'}];},'footer':function(_0x1a7316,_0x24f76d){return[{'text':util[_0xafb2('0x1d')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x49b9c0,_0x1a7316,_0x24f76d,_0x3a804e),'style':_0xafb2('0x24')}];}};}function writePDFDocument(_0x4bed11,_0x55a7ab){return new Promise(function(_0x370cae,_0x2200d5){var _0x8fb548=_0x4bed11['pipe'](fs[_0xafb2('0x55')](_0x55a7ab));_0x8fb548['on'](_0xafb2('0x56'),function(){_0x370cae(_0xafb2('0x56'));});_0x8fb548['on']('error',function(_0xdd461b){_0x2200d5(_0xdd461b);});_0x4bed11['end']();});}exports[_0xafb2('0x57')]=function(_0x5ea1e1,_0x265214){var _0x5e5fbc=getPDFPrinter();var _0x552a48=getPDFDocDefinitionFromHTML(_0x5ea1e1,_0x265214);var _0x158de3=_0x5e5fbc['createPdfKitDocument'](_0x552a48);return writePDFDocument(_0x158de3,_0x265214[_0xafb2('0x2')])[_0xafb2('0x58')](function(_0x33e357){throw _0x33e357;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 467f0fa..765542f 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 _0xc113=['basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','inspect','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','SELECT'];(function(_0x139254,_0x53097b){var _0x5b1f66=function(_0x2444ab){while(--_0x2444ab){_0x139254['push'](_0x139254['shift']());}};_0x5b1f66(++_0x53097b);}(_0xc113,0x1ab));var _0x3c11=function(_0xd91e4c,_0x5d707f){_0xd91e4c=_0xd91e4c-0x0;var _0x34b657=_0xc113[_0xd91e4c];return _0x34b657;};'use strict';var util=require(_0x3c11('0x0'));var path=require(_0x3c11('0x1'));var _=require(_0x3c11('0x2'));var fs=require('fs');var json2xls=require(_0x3c11('0x3'));var BPromise=require(_0x3c11('0x4'));var zipdir=require(_0x3c11('0x5'));var rimraf=require(_0x3c11('0x6'));var db=require(_0x3c11('0x7'))['db'];var dbH=require(_0x3c11('0x7'))['dbH'];var logger=require(_0x3c11('0x8'))(_0x3c11('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3c11('0xa')][0x3];var PATH=process[_0x3c11('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2fa44d,_0x5d6f91){var _0x16959a={'status':_0x2fa44d};var _0x4e98c0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5d6f91){_0x16959a['savename']=_0x5d6f91;}return db['AnalyticExtractedReport'][_0x3c11('0xb')](_0x16959a,_0x4e98c0);}function main(){var _0x23d4ad=0x1388;var _0x5275df;logger[_0x3c11('0xc')](util[_0x3c11('0xd')](_0x3c11('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x3c11('0xf')][_0x3c11('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3c11('0x11'),_0x3c11('0x12')]})[_0x3c11('0x13')](function(_0x58c7c8){if(_0x58c7c8){_0x5275df=_0x58c7c8;_0x23d4ad=_0x5275df[_0x3c11('0x12')]||0x1388;}})[_0x3c11('0x13')](function(){return dbH['sequelize'][_0x3c11('0x14')](util[_0x3c11('0xd')](_0x3c11('0x15'),QUERY),{'type':dbH[_0x3c11('0x16')][_0x3c11('0x17')]['SELECT']});})[_0x3c11('0x13')](function(_0x2ba437){if(!_0x2ba437[0x0][_0x3c11('0x18')]){return analyticExtractedReport(_0x3c11('0x19'));}var _0x1d05f2=[];var _0x5b223f=0x0;if(_0x5275df['split']){if(_0x2ba437&&_0x2ba437['length']){var _0x43ee61=_[_0x3c11('0x1a')](_0x2ba437[0x0][_0x3c11('0x18')]/_0x23d4ad);var _0x42db8d=Number[_0x3c11('0x1b')](_0x2ba437[0x0][_0x3c11('0x18')]/_0x23d4ad)?_0x2ba437[0x0][_0x3c11('0x18')]%_0x23d4ad:0x0;_0x43ee61[_0x3c11('0x1c')](function(_0x3c2a18){if(_0x3c2a18>0x0){_0x5b223f+=_0x23d4ad;}_0x1d05f2['push'](dbH['sequelize'][_0x3c11('0x14')](util['format'](_0x3c11('0x1d'),QUERY,_0x23d4ad,_0x5b223f),{'type':dbH['sequelize'][_0x3c11('0x17')]['SELECT']}));});if(_0x42db8d>0x0){_0x5b223f+=_0x23d4ad;_0x1d05f2[_0x3c11('0x1e')](dbH['sequelize']['query'](util[_0x3c11('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x42db8d,_0x5b223f),{'type':dbH[_0x3c11('0x16')][_0x3c11('0x17')][_0x3c11('0x1f')]}));}}}else{_0x1d05f2[_0x3c11('0x1e')](dbH[_0x3c11('0x16')]['query'](QUERY,{'type':dbH[_0x3c11('0x16')]['QueryTypes'][_0x3c11('0x1f')]}));}var _0x414c02=path['dirname'](PATH);var _0x29f3cd=path[_0x3c11('0x20')](PATH,_0x3c11('0x21'));var _0x2df95d=_0x5275df[_0x3c11('0x11')]&&_0x1d05f2[_0x3c11('0x22')]>0x1;var _0x1af1fb=[];if(!fs[_0x3c11('0x23')](path[_0x3c11('0x24')](_0x414c02,_0x29f3cd))&&_0x2df95d){fs[_0x3c11('0x25')](path['join'](_0x414c02,_0x29f3cd));}return BPromise[_0x3c11('0x26')](_0x1d05f2,function(_0x3de4ab){_0x1af1fb[_0x3c11('0x1e')](_0x3de4ab);})[_0x3c11('0x13')](function(){for(var _0x50aec6=0x0;_0x50aec6<_0x1af1fb[_0x3c11('0x22')];_0x50aec6+=0x1){var _0x21401c;var _0x5151b0=_0x1af1fb[_0x50aec6];if(_0x2df95d){_0x21401c=path[_0x3c11('0x24')](_0x414c02,_0x29f3cd,util[_0x3c11('0xd')](_0x3c11('0x27'),_0x29f3cd,_0x50aec6,_0x3c11('0x28')));}else{_0x21401c=path[_0x3c11('0x24')](_0x414c02,util[_0x3c11('0xd')](_0x3c11('0x29'),_0x29f3cd,_0x3c11('0x28')));}fs['writeFileSync'](_0x21401c,json2xls(_0x5151b0),_0x3c11('0x2a'));}})[_0x3c11('0x13')](function(){if(_0x2df95d){return new Promise(function(_0x1ec787){zipdir(path[_0x3c11('0x24')](_0x414c02,_0x29f3cd),{'saveTo':path[_0x3c11('0x24')](_0x414c02,util[_0x3c11('0xd')](_0x3c11('0x29'),_0x29f3cd,'zip'))},function(_0xe9a49f,_0x6db1f0){rimraf(path[_0x3c11('0x24')](_0x414c02,_0x29f3cd),function(){});_0x1ec787(_0x3c11('0x2b'));});});}})[_0x3c11('0x13')](function(){logger[_0x3c11('0xc')](util['format'](_0x3c11('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x2df95d?util[_0x3c11('0xd')](_0x3c11('0x29'),_0x29f3cd,_0x2df95d?'zip':_0x3c11('0x28')):null);});})[_0x3c11('0x2d')](function(_0x19b137){logger['info'](util[_0x3c11('0xd')](_0x3c11('0x2e'),EXTRACTED_REPORT_ID,_0x3c11('0x2f')),util[_0x3c11('0x30')](_0x19b137,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x3c11('0x31')](function(){process[_0x3c11('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf1a2=['dirname','basename','.xlsx','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','zip\x20finished','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','push'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf1a2,0x1f0));var _0x2f1a=function(_0x3624b2,_0x3d8b1e){_0x3624b2=_0x3624b2-0x0;var _0x299a02=_0xf1a2[_0x3624b2];return _0x299a02;};'use strict';var util=require(_0x2f1a('0x0'));var path=require(_0x2f1a('0x1'));var _=require(_0x2f1a('0x2'));var fs=require('fs');var json2xls=require(_0x2f1a('0x3'));var BPromise=require(_0x2f1a('0x4'));var zipdir=require(_0x2f1a('0x5'));var rimraf=require(_0x2f1a('0x6'));var db=require(_0x2f1a('0x7'))['db'];var dbH=require(_0x2f1a('0x7'))['dbH'];var logger=require(_0x2f1a('0x8'))(_0x2f1a('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x2f1a('0xa')][0x2]);var QUERY=process[_0x2f1a('0xa')][0x3];var PATH=process[_0x2f1a('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x460898,_0x50fa39){var _0x3fef11={'status':_0x460898};var _0x54d94c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50fa39){_0x3fef11[_0x2f1a('0xb')]=_0x50fa39;}return db['AnalyticExtractedReport'][_0x2f1a('0xc')](_0x3fef11,_0x54d94c);}function main(){var _0x14a6f5=0x1388;var _0x2dba44;logger[_0x2f1a('0xd')](util[_0x2f1a('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2f1a('0xf')));return db[_0x2f1a('0x10')][_0x2f1a('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2f1a('0x12'),_0x2f1a('0x13')]})[_0x2f1a('0x14')](function(_0x1083e9){if(_0x1083e9){_0x2dba44=_0x1083e9;_0x14a6f5=_0x2dba44[_0x2f1a('0x13')]||0x1388;}})['then'](function(){return dbH[_0x2f1a('0x15')][_0x2f1a('0x16')](util[_0x2f1a('0xe')](_0x2f1a('0x17'),QUERY),{'type':dbH[_0x2f1a('0x15')][_0x2f1a('0x18')][_0x2f1a('0x19')]});})['then'](function(_0x458929){if(!_0x458929[0x0][_0x2f1a('0x1a')]){return analyticExtractedReport(_0x2f1a('0x1b'));}var _0x57467e=[];var _0x1b9787=0x0;if(_0x2dba44[_0x2f1a('0x12')]){if(_0x458929&&_0x458929[_0x2f1a('0x1c')]){var _0x6be30b=_[_0x2f1a('0x1d')](_0x458929[0x0][_0x2f1a('0x1a')]/_0x14a6f5);var _0x2cb7af=Number[_0x2f1a('0x1e')](_0x458929[0x0][_0x2f1a('0x1a')]/_0x14a6f5)?_0x458929[0x0][_0x2f1a('0x1a')]%_0x14a6f5:0x0;_0x6be30b['forEach'](function(_0x12f24e){if(_0x12f24e>0x0){_0x1b9787+=_0x14a6f5;}_0x57467e[_0x2f1a('0x1f')](dbH[_0x2f1a('0x15')]['query'](util[_0x2f1a('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14a6f5,_0x1b9787),{'type':dbH[_0x2f1a('0x15')][_0x2f1a('0x18')][_0x2f1a('0x19')]}));});if(_0x2cb7af>0x0){_0x1b9787+=_0x14a6f5;_0x57467e[_0x2f1a('0x1f')](dbH['sequelize'][_0x2f1a('0x16')](util[_0x2f1a('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2cb7af,_0x1b9787),{'type':dbH[_0x2f1a('0x15')]['QueryTypes']['SELECT']}));}}}else{_0x57467e[_0x2f1a('0x1f')](dbH[_0x2f1a('0x15')][_0x2f1a('0x16')](QUERY,{'type':dbH[_0x2f1a('0x15')]['QueryTypes']['SELECT']}));}var _0x4572ba=path[_0x2f1a('0x20')](PATH);var _0x2bf848=path[_0x2f1a('0x21')](PATH,_0x2f1a('0x22'));var _0x526d28=_0x2dba44[_0x2f1a('0x12')]&&_0x57467e['length']>0x1;var _0x182357=[];if(!fs['existsSync'](path[_0x2f1a('0x23')](_0x4572ba,_0x2bf848))&&_0x526d28){fs[_0x2f1a('0x24')](path['join'](_0x4572ba,_0x2bf848));}return BPromise[_0x2f1a('0x25')](_0x57467e,function(_0x3d3894){_0x182357['push'](_0x3d3894);})['then'](function(){for(var _0x2ab0ed=0x0;_0x2ab0ed<_0x182357[_0x2f1a('0x1c')];_0x2ab0ed+=0x1){var _0x22d28d;var _0x109a47=_0x182357[_0x2ab0ed];if(_0x526d28){_0x22d28d=path['join'](_0x4572ba,_0x2bf848,util[_0x2f1a('0xe')]('%s%d.%s',_0x2bf848,_0x2ab0ed,_0x2f1a('0x26')));}else{_0x22d28d=path[_0x2f1a('0x23')](_0x4572ba,util['format'](_0x2f1a('0x27'),_0x2bf848,_0x2f1a('0x26')));}fs[_0x2f1a('0x28')](_0x22d28d,json2xls(_0x109a47),'binary');}})[_0x2f1a('0x14')](function(){if(_0x526d28){return new Promise(function(_0x2cb525){zipdir(path[_0x2f1a('0x23')](_0x4572ba,_0x2bf848),{'saveTo':path[_0x2f1a('0x23')](_0x4572ba,util[_0x2f1a('0xe')]('%s.%s',_0x2bf848,'zip'))},function(_0x208664,_0x2b88c5){rimraf(path[_0x2f1a('0x23')](_0x4572ba,_0x2bf848),function(){});_0x2cb525(_0x2f1a('0x29'));});});}})[_0x2f1a('0x14')](function(){logger[_0x2f1a('0xd')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2f1a('0xf')));return analyticExtractedReport(_0x2f1a('0x2a'),_0x526d28?util[_0x2f1a('0xe')](_0x2f1a('0x27'),_0x2bf848,_0x526d28?_0x2f1a('0x2b'):_0x2f1a('0x26')):null);});})[_0x2f1a('0x2c')](function(_0x278c9a){logger[_0x2f1a('0xd')](util['format'](_0x2f1a('0x2d'),EXTRACTED_REPORT_ID,_0x2f1a('0xf')),util[_0x2f1a('0x2e')](_0x278c9a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2f1a('0x2f'));})['finally'](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 4fbd36a..57ff97d 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 _0x7a88=['format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','catch','error','rewrite','lodash','util','Interval','then','models','VoiceExtension','findAll','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','hasOwnProperty','priority','extensions','extension','find','push','type','Set'];(function(_0x5702c6,_0x2c56f7){var _0x5c8757=function(_0x502066){while(--_0x502066){_0x5702c6['push'](_0x5702c6['shift']());}};_0x5c8757(++_0x2c56f7);}(_0x7a88,0x73));var _0x87a8=function(_0x2650de,_0x12c23e){_0x2650de=_0x2650de-0x0;var _0x2db8c0=_0x7a88[_0x2650de];return _0x2db8c0;};'use strict';var _=require(_0x87a8('0x0'));var util=require(_0x87a8('0x1'));function rewrite(_0x164a00,_0x438a57){var _0x2bf87f=this;return _0x164a00['models'][_0x87a8('0x2')]['findAll']({'raw':!![]})[_0x87a8('0x3')](function(_0x4414d4){_0x2bf87f['intervals']=_0x4414d4;return _0x164a00[_0x87a8('0x4')][_0x87a8('0x5')][_0x87a8('0x6')]({'where':{'IntervalId':_0x438a57['IntervalId']},'raw':!![]});})[_0x87a8('0x3')](function(_0x2c4ca0){return _0x164a00[_0x87a8('0x4')][_0x87a8('0x5')][_0x87a8('0x6')]({'where':{'exten':{'$in':_[_0x87a8('0x7')](_['map'](_0x2c4ca0,'exten'))}},'order':[{'raw':_0x87a8('0x8')}],'raw':!![]});})[_0x87a8('0x3')](function(_0x10b728){var _0x131b5a=_[_0x87a8('0x9')](_0x10b728,{'priority':'1'});var _0x4b7f0e=_[_0x87a8('0x9')](_0x10b728,{'isApp':0x1});var _0x5757d9=_[_0x87a8('0xa')](_0x4b7f0e,_0x87a8('0xb'));var _0x196637=[_0x87a8('0xc'),'playback'];var _0x41e5cb=[];var _0x592b01=[];for(var _0x3b738c in _0x5757d9){if(_0x5757d9[_0x87a8('0xd')](_0x3b738c)){_0x2bf87f[_0x87a8('0xe')]=0x2;_0x2bf87f[_0x87a8('0xf')]=[];_0x2bf87f[_0x87a8('0x10')]=_[_0x87a8('0x11')](_0x131b5a,{'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')]});_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':_0x87a8('0x14'),'appdata':util[_0x87a8('0x15')](_0x87a8('0x16'),_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')]),'context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'priority':_0x2bf87f['priority']++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});if(_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')]===_0x87a8('0x19')){_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0]['type'],'app':'Set','appdata':_0x87a8('0x1a')+_0x5757d9[_0x3b738c][0x0]['VoiceExtensionId'],'context':_0x5757d9[_0x3b738c][0x0]['context'],'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'priority':_0x2bf87f[_0x87a8('0xe')]++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0]['VoiceExtensionId']});}else if(_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')]===_0x87a8('0x1b')){if(_0x2bf87f[_0x87a8('0x10')]){_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':'Set','appdata':_0x87a8('0x1c')+(_0x2bf87f[_0x87a8('0x10')][_0x87a8('0x1d')]?_0x87a8('0x1e')+_0x2bf87f[_0x87a8('0x10')][_0x87a8('0x1d')]+'}':'${EXTEN}'),'context':_0x5757d9[_0x3b738c][0x0]['context'],'exten':_0x5757d9[_0x3b738c][0x0]['exten'],'priority':_0x2bf87f[_0x87a8('0xe')]++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});}_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':_0x87a8('0x14'),'appdata':_0x87a8('0x1a')+_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')],'context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'exten':_0x5757d9[_0x3b738c][0x0]['exten'],'priority':_0x2bf87f[_0x87a8('0xe')]++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0]['VoiceExtensionId']});var _0x20d30b=_0x2bf87f[_0x87a8('0xe')]++;_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':_0x87a8('0x1f'),'appdata':_0x87a8('0x20')+(_0x20d30b+0x2)+_0x87a8('0x21')+(_0x20d30b+0x1)+')','context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'exten':_0x5757d9[_0x3b738c][0x0]['exten'],'priority':_0x20d30b,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});if(_0x2bf87f[_0x87a8('0x10')]){_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':'Set','appdata':_0x2bf87f[_0x87a8('0x10')][_0x87a8('0x1d')]?_0x87a8('0x22')+_0x2bf87f['extension'][_0x87a8('0x1d')]+'}':_0x87a8('0x23'),'context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'priority':_0x2bf87f[_0x87a8('0xe')]++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});}_0x2bf87f[_0x87a8('0xf')]['push']({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':'Set','appdata':'outboundrouteid='+_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')],'context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'priority':_0x2bf87f[_0x87a8('0xe')]++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});if(_0x2bf87f[_0x87a8('0x10')]&&_0x2bf87f['extension'][_0x87a8('0xd')](_0x87a8('0x24'))&&_0x2bf87f['extension'][_0x87a8('0x24')]!=='none'){_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'priority':_0x2bf87f[_0x87a8('0xe')]++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});_0x2bf87f[_0x87a8('0xf')]['push']({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':_0x87a8('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2bf87f[_0x87a8('0x10')]['recordingFormat']||_0x87a8('0x25'),'context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'priority':_0x2bf87f['priority']++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});}}_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0]['type'],'app':_0x87a8('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'priority':_0x2bf87f['priority']++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0]['type'],'app':_0x87a8('0x14'),'appdata':_0x87a8('0x26'),'context':_0x5757d9[_0x3b738c][0x0]['context'],'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'priority':_0x2bf87f[_0x87a8('0xe')]++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});_0x2bf87f['extensions'][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':'Set','appdata':_0x87a8('0x27'),'context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'priority':_0x2bf87f[_0x87a8('0xe')]++,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0]['VoiceExtensionId']});for(var _0x4556ce=0x0,_0x5051bb=0x0;_0x4556ce<_0x5757d9[_0x3b738c][_0x87a8('0x28')];_0x4556ce+=0x1,_0x5051bb=0x0){var _0x18e88f=_0x5757d9[_0x3b738c][_0x4556ce];if(_0x18e88f[_0x87a8('0x13')]){_0x18e88f[_0x87a8('0x13')]=_0x18e88f[_0x87a8('0x13')][_0x87a8('0x29')]();}var _0x25885d=[];var _0x4c2dee=[];delete _0x18e88f['id'];delete _0x18e88f[_0x87a8('0x2a')];delete _0x18e88f[_0x87a8('0x2b')];var _0x321938=_0x18e88f[_0x87a8('0x2c')]!==_0x87a8('0x2d')?[_0x18e88f[_0x87a8('0x2c')]]:_0x18e88f[_0x87a8('0x2e')]?_['map'](_[_0x87a8('0x9')](_0x2bf87f[_0x87a8('0x2f')],{'IntervalId':_0x18e88f[_0x87a8('0x2e')]}),_0x87a8('0x2c')):[];if(_0x18e88f['hasOwnProperty'](_0x87a8('0x30'))){if(_0x18e88f[_0x87a8('0x30')]&&_0x18e88f[_0x87a8('0x30')]!=='--'){_0x25885d[_0x87a8('0x12')]({'type':_0x18e88f[_0x87a8('0x13')],'app':_0x87a8('0x14'),'appdata':_0x87a8('0x31')+_0x18e88f[_0x87a8('0x30')],'context':_0x18e88f['context'],'exten':_0x18e88f[_0x87a8('0xb')],'priority':_0x321938[_0x87a8('0x28')]+_0x2bf87f[_0x87a8('0xe')]+_0x5051bb++,'VoiceExtensionId':_0x18e88f['VoiceExtensionId']});}}if(_0x18e88f[_0x87a8('0x13')]===_0x87a8('0x1b')&&_0x18e88f[_0x87a8('0xd')](_0x87a8('0x32'))){if(_0x18e88f[_0x87a8('0x32')]){_0x25885d[_0x87a8('0x12')]({'type':_0x18e88f[_0x87a8('0x13')],'app':_0x87a8('0x1f'),'appdata':_0x87a8('0x33')+_0x18e88f['callerID']+')','context':_0x18e88f[_0x87a8('0x17')],'exten':_0x18e88f['exten'],'priority':_0x321938[_0x87a8('0x28')]+_0x2bf87f[_0x87a8('0xe')]+_0x5051bb++,'VoiceExtensionId':_0x18e88f['VoiceExtensionId']});}else{_0x25885d['push']({'type':_0x18e88f[_0x87a8('0x13')],'app':'ExecIf','appdata':_0x87a8('0x34'),'context':_0x18e88f[_0x87a8('0x17')],'exten':_0x18e88f[_0x87a8('0xb')],'priority':_0x321938[_0x87a8('0x28')]+_0x2bf87f[_0x87a8('0xe')]+_0x5051bb++,'VoiceExtensionId':_0x18e88f[_0x87a8('0x18')]});}}if(_0x18e88f['hasOwnProperty'](_0x87a8('0x35'))){if(_0x196637[_0x87a8('0x36')](_0x18e88f[_0x87a8('0x37')][_0x87a8('0x29')]())>=0x0&&_0x18e88f[_0x87a8('0x38')]!=='custom'){if(_0x18e88f['answer']){_0x25885d[_0x87a8('0x12')]({'type':_0x18e88f['type'],'app':_0x87a8('0x1f'),'appdata':_0x87a8('0x39'),'context':_0x18e88f[_0x87a8('0x17')],'exten':_0x18e88f[_0x87a8('0xb')],'priority':_0x321938['length']+_0x2bf87f['priority']+_0x5051bb++,'VoiceExtensionId':_0x18e88f[_0x87a8('0x18')]});_0x25885d[_0x87a8('0x12')]({'type':_0x18e88f['type'],'app':_0x87a8('0x14'),'appdata':_0x87a8('0x3a'),'context':_0x18e88f['context'],'exten':_0x18e88f[_0x87a8('0xb')],'priority':_0x321938[_0x87a8('0x28')]+_0x2bf87f[_0x87a8('0xe')]+_0x5051bb++,'VoiceExtensionId':_0x18e88f['VoiceExtensionId']});}else{_0x25885d[_0x87a8('0x12')]({'type':_0x18e88f[_0x87a8('0x13')],'app':_0x87a8('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x18e88f['context'],'exten':_0x18e88f[_0x87a8('0xb')],'priority':_0x321938['length']+_0x2bf87f[_0x87a8('0xe')]+_0x5051bb++,'VoiceExtensionId':_0x18e88f[_0x87a8('0x18')]});_0x25885d['push']({'type':_0x18e88f[_0x87a8('0x13')],'app':_0x87a8('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x18e88f['context'],'exten':_0x18e88f['exten'],'priority':_0x321938[_0x87a8('0x28')]+_0x2bf87f['priority']+_0x5051bb++,'VoiceExtensionId':_0x18e88f['VoiceExtensionId']});}}}for(var _0x492d79=0x0;_0x492d79<_0x321938['length'];_0x492d79+=0x1){var _0x40499f=_0x2bf87f[_0x87a8('0xe')]+_0x321938[_0x87a8('0x28')];var _0x525261=_0x492d79===_0x321938['length']-0x1?_0x2bf87f['priority']+_0x25885d[_0x87a8('0x28')]+_0x4c2dee[_0x87a8('0x28')]+0x2:_0x2bf87f[_0x87a8('0xe')]+_0x492d79+0x1;_0x25885d['splice'](_0x492d79,0x0,{'type':_0x18e88f[_0x87a8('0x13')],'app':'GotoIfTime','appdata':_0x321938[_0x492d79]+'?'+_0x18e88f['context']+_0x87a8('0x3b')+_0x40499f+':'+_0x18e88f[_0x87a8('0x17')]+_0x87a8('0x3b')+_0x525261,'exten':_0x18e88f[_0x87a8('0xb')],'context':_0x18e88f[_0x87a8('0x17')],'priority':_0x2bf87f[_0x87a8('0xe')]+_0x492d79,'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]});}_0x18e88f[_0x87a8('0xe')]=_0x25885d[_0x87a8('0x28')]?_[_0x87a8('0x3c')](_0x25885d)[_0x87a8('0xe')]+0x1:_0x2bf87f['priority'];_0x2bf87f[_0x87a8('0xe')]=(_0x4c2dee['length']?_[_0x87a8('0x3c')](_0x4c2dee)[_0x87a8('0xe')]:_0x18e88f[_0x87a8('0xe')])+0x1;_0x2bf87f[_0x87a8('0xf')]=_['concat'](_0x2bf87f[_0x87a8('0xf')],_0x25885d,[_0x18e88f],_0x4c2dee);}_0x2bf87f[_0x87a8('0xf')][_0x87a8('0x12')]({'type':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x13')],'app':_0x87a8('0x3d'),'exten':_0x5757d9[_0x3b738c][0x0][_0x87a8('0xb')],'context':_0x5757d9[_0x3b738c][0x0][_0x87a8('0x17')],'priority':_0x2bf87f[_0x87a8('0xe')],'VoiceExtensionId':_0x5757d9[_0x3b738c][0x0]['VoiceExtensionId']});_0x41e5cb[_0x87a8('0x12')](_0x5757d9[_0x3b738c][0x0][_0x87a8('0x18')]);_0x592b01=_[_0x87a8('0x3e')](_0x592b01,_0x2bf87f['extensions']);}}return _0x164a00['transaction'](function(_0x44a7d0){return _0x164a00[_0x87a8('0x4')]['VoiceExtension'][_0x87a8('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x41e5cb}},'transaction':_0x44a7d0})['then'](function(_0x4ad508){return _0x164a00['models']['VoiceExtension'][_0x87a8('0x40')](_['sortBy'](_0x592b01,_0x87a8('0xe')),{'transaction':_0x44a7d0});});});})[_0x87a8('0x41')](function(_0x249216){console[_0x87a8('0x42')](_0x249216);});}exports[_0x87a8('0x43')]=rewrite; \ No newline at end of file +var _0x94d0=['exten','playback','hasOwnProperty','priority','extensions','find','push','Set','CDR(type)=%s','type','context','VoiceExtensionId','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','models','destroy','bulkCreate','catch','error','rewrite','lodash','then','intervals','VoiceExtension','findAll','IntervalId','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x94d0,0x164));var _0x094d=function(_0x36bf9e,_0x1c4d61){_0x36bf9e=_0x36bf9e-0x0;var _0x5c9f96=_0x94d0[_0x36bf9e];return _0x5c9f96;};'use strict';var _=require(_0x094d('0x0'));var util=require('util');function rewrite(_0x1ce810,_0x2742bd){var _0x4612d8=this;return _0x1ce810['models']['Interval']['findAll']({'raw':!![]})[_0x094d('0x1')](function(_0x4eee8d){_0x4612d8[_0x094d('0x2')]=_0x4eee8d;return _0x1ce810['models'][_0x094d('0x3')][_0x094d('0x4')]({'where':{'IntervalId':_0x2742bd[_0x094d('0x5')]},'raw':!![]});})[_0x094d('0x1')](function(_0x45eb16){return _0x1ce810['models'][_0x094d('0x3')]['findAll']({'where':{'exten':{'$in':_[_0x094d('0x6')](_['map'](_0x45eb16,'exten'))}},'order':[{'raw':_0x094d('0x7')}],'raw':!![]});})['then'](function(_0x5cb46e){var _0x5a4a4f=_[_0x094d('0x8')](_0x5cb46e,{'priority':'1'});var _0x4184ae=_[_0x094d('0x8')](_0x5cb46e,{'isApp':0x1});var _0x46d7e=_['groupBy'](_0x4184ae,_0x094d('0x9'));var _0x188591=['queue',_0x094d('0xa')];var _0x569b38=[];var _0x38ed70=[];for(var _0x3797d3 in _0x46d7e){if(_0x46d7e[_0x094d('0xb')](_0x3797d3)){_0x4612d8[_0x094d('0xc')]=0x2;_0x4612d8[_0x094d('0xd')]=[];_0x4612d8['extension']=_[_0x094d('0xe')](_0x5a4a4f,{'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')]});_0x4612d8[_0x094d('0xd')][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0]['type'],'app':_0x094d('0x10'),'appdata':util['format'](_0x094d('0x11'),_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')]),'context':_0x46d7e[_0x3797d3][0x0][_0x094d('0x13')],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8[_0x094d('0xc')]++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});if(_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')]==='inbound'){_0x4612d8['extensions'][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':'Set','appdata':_0x094d('0x15')+_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')],'context':_0x46d7e[_0x3797d3][0x0]['context'],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8[_0x094d('0xc')]++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});}else if(_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')]===_0x094d('0x16')){if(_0x4612d8[_0x094d('0x17')]){_0x4612d8[_0x094d('0xd')][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':_0x094d('0x10'),'appdata':_0x094d('0x18')+(_0x4612d8[_0x094d('0x17')][_0x094d('0x19')]?_0x094d('0x1a')+_0x4612d8[_0x094d('0x17')][_0x094d('0x19')]+'}':_0x094d('0x1b')),'context':_0x46d7e[_0x3797d3][0x0][_0x094d('0x13')],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8[_0x094d('0xc')]++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});}_0x4612d8[_0x094d('0xd')][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':_0x094d('0x10'),'appdata':_0x094d('0x15')+_0x46d7e[_0x3797d3][0x0]['VoiceExtensionId'],'context':_0x46d7e[_0x3797d3][0x0][_0x094d('0x13')],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8['priority']++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});var _0xe11ba1=_0x4612d8[_0x094d('0xc')]++;_0x4612d8[_0x094d('0xd')][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':'ExecIf','appdata':_0x094d('0x1c')+(_0xe11ba1+0x2)+_0x094d('0x1d')+(_0xe11ba1+0x1)+')','context':_0x46d7e[_0x3797d3][0x0]['context'],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0xe11ba1,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0]['VoiceExtensionId']});if(_0x4612d8[_0x094d('0x17')]){_0x4612d8[_0x094d('0xd')][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':'Set','appdata':_0x4612d8[_0x094d('0x17')]['cutdigits']?_0x094d('0x1e')+_0x4612d8['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x46d7e[_0x3797d3][0x0]['context'],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8[_0x094d('0xc')]++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});}_0x4612d8[_0x094d('0xd')][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':_0x094d('0x10'),'appdata':_0x094d('0x1f')+_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')],'context':_0x46d7e[_0x3797d3][0x0][_0x094d('0x13')],'exten':_0x46d7e[_0x3797d3][0x0]['exten'],'priority':_0x4612d8[_0x094d('0xc')]++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});if(_0x4612d8[_0x094d('0x17')]&&_0x4612d8[_0x094d('0x17')]['hasOwnProperty']('recordingFormat')&&_0x4612d8[_0x094d('0x17')]['recordingFormat']!==_0x094d('0x20')){_0x4612d8[_0x094d('0xd')][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':'Set','appdata':_0x094d('0x21'),'context':_0x46d7e[_0x3797d3][0x0][_0x094d('0x13')],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8[_0x094d('0xc')]++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});_0x4612d8['extensions']['push']({'type':_0x46d7e[_0x3797d3][0x0]['type'],'app':_0x094d('0x10'),'appdata':_0x094d('0x22')+_0x4612d8[_0x094d('0x17')][_0x094d('0x23')]||_0x094d('0x24'),'context':_0x46d7e[_0x3797d3][0x0][_0x094d('0x13')],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8[_0x094d('0xc')]++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});}}_0x4612d8[_0x094d('0xd')][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':_0x094d('0x10'),'appdata':_0x094d('0x25'),'context':_0x46d7e[_0x3797d3][0x0][_0x094d('0x13')],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8[_0x094d('0xc')]++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});_0x4612d8[_0x094d('0xd')]['push']({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':_0x094d('0x10'),'appdata':_0x094d('0x26'),'context':_0x46d7e[_0x3797d3][0x0][_0x094d('0x13')],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8['priority']++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0]['VoiceExtensionId']});_0x4612d8['extensions'][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':_0x094d('0x10'),'appdata':_0x094d('0x27'),'context':_0x46d7e[_0x3797d3][0x0]['context'],'exten':_0x46d7e[_0x3797d3][0x0][_0x094d('0x9')],'priority':_0x4612d8['priority']++,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});for(var _0x233ae1=0x0,_0x3bad34=0x0;_0x233ae1<_0x46d7e[_0x3797d3][_0x094d('0x28')];_0x233ae1+=0x1,_0x3bad34=0x0){var _0x32004f=_0x46d7e[_0x3797d3][_0x233ae1];if(_0x32004f[_0x094d('0x12')]){_0x32004f[_0x094d('0x12')]=_0x32004f[_0x094d('0x12')][_0x094d('0x29')]();}var _0xdb3f30=[];var _0xd7db41=[];delete _0x32004f['id'];delete _0x32004f[_0x094d('0x2a')];delete _0x32004f[_0x094d('0x2b')];var _0x5af1f4=_0x32004f[_0x094d('0x2c')]!==_0x094d('0x2d')?[_0x32004f[_0x094d('0x2c')]]:_0x32004f[_0x094d('0x5')]?_[_0x094d('0x2e')](_['filter'](_0x4612d8[_0x094d('0x2')],{'IntervalId':_0x32004f['IntervalId']}),_0x094d('0x2c')):[];if(_0x32004f[_0x094d('0xb')](_0x094d('0x2f'))){if(_0x32004f['tag']&&_0x32004f[_0x094d('0x2f')]!=='--'){_0xdb3f30[_0x094d('0xf')]({'type':_0x32004f[_0x094d('0x12')],'app':'Set','appdata':_0x094d('0x30')+_0x32004f[_0x094d('0x2f')],'context':_0x32004f[_0x094d('0x13')],'exten':_0x32004f[_0x094d('0x9')],'priority':_0x5af1f4[_0x094d('0x28')]+_0x4612d8['priority']+_0x3bad34++,'VoiceExtensionId':_0x32004f['VoiceExtensionId']});}}if(_0x32004f[_0x094d('0x12')]===_0x094d('0x16')&&_0x32004f['hasOwnProperty'](_0x094d('0x31'))){if(_0x32004f[_0x094d('0x31')]){_0xdb3f30[_0x094d('0xf')]({'type':_0x32004f['type'],'app':_0x094d('0x32'),'appdata':_0x094d('0x33')+_0x32004f[_0x094d('0x31')]+')','context':_0x32004f['context'],'exten':_0x32004f[_0x094d('0x9')],'priority':_0x5af1f4[_0x094d('0x28')]+_0x4612d8['priority']+_0x3bad34++,'VoiceExtensionId':_0x32004f[_0x094d('0x14')]});}else{_0xdb3f30['push']({'type':_0x32004f[_0x094d('0x12')],'app':_0x094d('0x32'),'appdata':_0x094d('0x34'),'context':_0x32004f[_0x094d('0x13')],'exten':_0x32004f[_0x094d('0x9')],'priority':_0x5af1f4[_0x094d('0x28')]+_0x4612d8[_0x094d('0xc')]+_0x3bad34++,'VoiceExtensionId':_0x32004f[_0x094d('0x14')]});}}if(_0x32004f[_0x094d('0xb')](_0x094d('0x35'))){if(_0x188591[_0x094d('0x36')](_0x32004f[_0x094d('0x37')][_0x094d('0x29')]())>=0x0&&_0x32004f[_0x094d('0x38')]!==_0x094d('0x39')){if(_0x32004f['answer']){_0xdb3f30[_0x094d('0xf')]({'type':_0x32004f[_0x094d('0x12')],'app':'ExecIf','appdata':_0x094d('0x3a'),'context':_0x32004f[_0x094d('0x13')],'exten':_0x32004f[_0x094d('0x9')],'priority':_0x5af1f4[_0x094d('0x28')]+_0x4612d8['priority']+_0x3bad34++,'VoiceExtensionId':_0x32004f['VoiceExtensionId']});_0xdb3f30[_0x094d('0xf')]({'type':_0x32004f[_0x094d('0x12')],'app':_0x094d('0x10'),'appdata':_0x094d('0x3b'),'context':_0x32004f[_0x094d('0x13')],'exten':_0x32004f[_0x094d('0x9')],'priority':_0x5af1f4[_0x094d('0x28')]+_0x4612d8[_0x094d('0xc')]+_0x3bad34++,'VoiceExtensionId':_0x32004f[_0x094d('0x14')]});}else{_0xdb3f30[_0x094d('0xf')]({'type':_0x32004f[_0x094d('0x12')],'app':'ExecIf','appdata':_0x094d('0x3c'),'context':_0x32004f[_0x094d('0x13')],'exten':_0x32004f['exten'],'priority':_0x5af1f4[_0x094d('0x28')]+_0x4612d8[_0x094d('0xc')]+_0x3bad34++,'VoiceExtensionId':_0x32004f[_0x094d('0x14')]});_0xdb3f30[_0x094d('0xf')]({'type':_0x32004f[_0x094d('0x12')],'app':_0x094d('0x10'),'appdata':_0x094d('0x3d'),'context':_0x32004f['context'],'exten':_0x32004f[_0x094d('0x9')],'priority':_0x5af1f4[_0x094d('0x28')]+_0x4612d8['priority']+_0x3bad34++,'VoiceExtensionId':_0x32004f[_0x094d('0x14')]});}}}for(var _0x13af3d=0x0;_0x13af3d<_0x5af1f4['length'];_0x13af3d+=0x1){var _0x593fa5=_0x4612d8['priority']+_0x5af1f4[_0x094d('0x28')];var _0x4be099=_0x13af3d===_0x5af1f4[_0x094d('0x28')]-0x1?_0x4612d8[_0x094d('0xc')]+_0xdb3f30['length']+_0xd7db41[_0x094d('0x28')]+0x2:_0x4612d8[_0x094d('0xc')]+_0x13af3d+0x1;_0xdb3f30[_0x094d('0x3e')](_0x13af3d,0x0,{'type':_0x32004f[_0x094d('0x12')],'app':'GotoIfTime','appdata':_0x5af1f4[_0x13af3d]+'?'+_0x32004f[_0x094d('0x13')]+_0x094d('0x3f')+_0x593fa5+':'+_0x32004f[_0x094d('0x13')]+_0x094d('0x3f')+_0x4be099,'exten':_0x32004f[_0x094d('0x9')],'context':_0x32004f[_0x094d('0x13')],'priority':_0x4612d8['priority']+_0x13af3d,'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0]['VoiceExtensionId']});}_0x32004f['priority']=_0xdb3f30[_0x094d('0x28')]?_[_0x094d('0x40')](_0xdb3f30)[_0x094d('0xc')]+0x1:_0x4612d8[_0x094d('0xc')];_0x4612d8['priority']=(_0xd7db41['length']?_['last'](_0xd7db41)['priority']:_0x32004f[_0x094d('0xc')])+0x1;_0x4612d8[_0x094d('0xd')]=_[_0x094d('0x41')](_0x4612d8[_0x094d('0xd')],_0xdb3f30,[_0x32004f],_0xd7db41);}_0x4612d8[_0x094d('0xd')][_0x094d('0xf')]({'type':_0x46d7e[_0x3797d3][0x0][_0x094d('0x12')],'app':'Hangup','exten':_0x46d7e[_0x3797d3][0x0]['exten'],'context':_0x46d7e[_0x3797d3][0x0][_0x094d('0x13')],'priority':_0x4612d8[_0x094d('0xc')],'VoiceExtensionId':_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]});_0x569b38[_0x094d('0xf')](_0x46d7e[_0x3797d3][0x0][_0x094d('0x14')]);_0x38ed70=_[_0x094d('0x41')](_0x38ed70,_0x4612d8['extensions']);}}return _0x1ce810[_0x094d('0x42')](function(_0x4ebd4e){return _0x1ce810[_0x094d('0x43')]['VoiceExtension'][_0x094d('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x569b38}},'transaction':_0x4ebd4e})[_0x094d('0x1')](function(_0x3f4943){return _0x1ce810[_0x094d('0x43')][_0x094d('0x3')][_0x094d('0x45')](_['sortBy'](_0x38ed70,_0x094d('0xc')),{'transaction':_0x4ebd4e});});});})[_0x094d('0x46')](function(_0x2f6441){console[_0x094d('0x47')](_0x2f6441);});}exports[_0x094d('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 63fb3cc..2496a1d 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 _0xb919=['email','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','str','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','then','get','dialCheckDuplicateType','sequelize','query','onlyIfOpen','VoiceQueueId','all','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xb919,0x191));var _0x9b91=function(_0x3c0f35,_0x44051a){_0x3c0f35=_0x3c0f35-0x0;var _0x1de893=_0xb919[_0x3c0f35];return _0x1de893;};'use strict';var BPromise=require(_0x9b91('0x0'));var util=require(_0x9b91('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x9b91('0x2'));var Papa=require(_0x9b91('0x3'));var Redis=require(_0x9b91('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x9b91('0x5'));var logger=require(_0x9b91('0x6'))('api');config[_0x9b91('0x7')]=_['defaults'](config[_0x9b91('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9b91('0x7')]));require(_0x9b91('0x8'))[_0x9b91('0x9')](socket);try{if(!process[_0x9b91('0xa')][0x2]||process[_0x9b91('0xa')][0x2]===_0x9b91('0xb')||process[_0x9b91('0xa')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x9b91('0xa')][0x2];if(!process[_0x9b91('0xa')][0x3]||process['argv'][0x3]===_0x9b91('0xb')||process[_0x9b91('0xa')][0x3]==='null'||!process[_0x9b91('0xa')][0x4]||process[_0x9b91('0xa')][0x4]==='undefined'||process[_0x9b91('0xa')][0x4]===_0x9b91('0xc')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x9b91('0xd')](process[_0x9b91('0xa')][0x3][_0x9b91('0xe')](','),process[_0x9b91('0xa')][0x4][_0x9b91('0xe')](','));if(!process[_0x9b91('0xa')][0x5]||process[_0x9b91('0xa')][0x5]===_0x9b91('0xb')||process[_0x9b91('0xa')][0x5]===_0x9b91('0xc')){throw new Error(_0x9b91('0xf'));}var LISTID=process[_0x9b91('0xa')][0x5];var COMPANYID=process[_0x9b91('0xa')][0x6]&&process[_0x9b91('0xa')][0x6]!==_0x9b91('0xb')&&process[_0x9b91('0xa')][0x6]!==_0x9b91('0xc')?process[_0x9b91('0xa')][0x6]:null;var DUPLICATES=process[_0x9b91('0xa')][0x7]&&process[_0x9b91('0xa')][0x7]!==_0x9b91('0xb')&&process['argv'][0x7]!==_0x9b91('0xc')?process[_0x9b91('0xa')][0x7]:null;if(!process[_0x9b91('0xa')][0x8]||process[_0x9b91('0xa')][0x8]===_0x9b91('0xb')||process['argv'][0x8]===_0x9b91('0xc')){throw new Error(_0x9b91('0x10'));}var SOCKET_TIMESTAMP=process[_0x9b91('0xa')][0x8];}catch(_0x852cfe){logger[_0x9b91('0x11')](_0x852cfe);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(_0x32950f,_0x36c659,_0x50f960,_0x4c2d4){var _0x3cda3b={'message':_0x36c659};_0x3cda3b[_0x32950f]=!![];if(_0x50f960){_0x3cda3b[_0x9b91('0x12')]=_0x50f960;}if(_0x4c2d4){_0x3cda3b[_0x9b91('0x13')]=_0x4c2d4;}return _0x3cda3b;}function isEmail(_0x277160){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))*$/[_0x9b91('0x14')](_0x277160);}function checkRow(_0x22ec99,_0x307874,_0x45af00){return new BPromise(function(_0x5bb8e3,_0xf6b558){if(_['isNil'](_0x22ec99)){return _0xf6b558(handleCheckRowError('error',_0x9b91('0x15'),null,_0x45af00));}if(_0x22ec99[_0x9b91('0x16')]&&_0x22ec99[_0x9b91('0x16')][_0x9b91('0x17')]){var _0x3c833d=_[_0x9b91('0x18')](_0x22ec99[_0x9b91('0x16')],_0x9b91('0x19'))[_0x9b91('0x1a')](';');return _0xf6b558(handleCheckRowError(_0x9b91('0x11'),_0x3c833d,null,_0x45af00));}var _0x1bb21d={};for(var _0x5c0c59 in FIELDS){if(FIELDS['hasOwnProperty'](_0x5c0c59)&&FIELDS[_0x5c0c59]){_0x1bb21d[_0x5c0c59]=_0x22ec99[_0x9b91('0x1b')][0x0][FIELDS[_0x5c0c59]]||_0x22ec99['data'][0x0]['\ufeff'+FIELDS[_0x5c0c59]];}}if(!_0x1bb21d[_0x9b91('0x1c')]){return _0xf6b558(handleCheckRowError(_0x9b91('0x11'),_0x9b91('0x1d'),null,_0x45af00));}if(!_0x1bb21d[_0x9b91('0x1e')]){return _0xf6b558(handleCheckRowError(_0x9b91('0x11'),_0x9b91('0x1f'),null,_0x45af00));}if(_0x1bb21d[_0x9b91('0x20')]){var _0x5be807=moment(_0x1bb21d[_0x9b91('0x20')],_0x9b91('0x21'));if(!_0x5be807['isValid']()){return _0xf6b558(handleCheckRowError('error',_0x9b91('0x22'),null,_0x45af00));}}if(_0x1bb21d[_0x9b91('0x23')]){if(!isEmail(_0x1bb21d['email'])){return _0xf6b558(handleCheckRowError(_0x9b91('0x11'),'email\x20format\x20is\x20not\x20valid!',null,_0x45af00));}}_0x1bb21d[_0x9b91('0x24')]=LISTID;_0x1bb21d['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x9b91('0x17')]&&_0x307874){var _0x4e97fe={};for(var _0x28a3d9=0x0,_0x5916c9=DUPLICATES[_0x9b91('0x17')];_0x28a3d9<_0x5916c9;_0x28a3d9+=0x1){_0x4e97fe[DUPLICATES[_0x28a3d9]]=_0x1bb21d[DUPLICATES[_0x28a3d9]];}var _0x91f2b2=_[_0x9b91('0x25')](_0x307874,_0x4e97fe);if(_0x91f2b2){return _0xf6b558(handleCheckRowError(_0x9b91('0x26'),_0x9b91('0x27'),_0x91f2b2,_0x45af00));}}return db[_0x9b91('0x28')][_0x9b91('0x29')](_0x1bb21d,{'raw':!![],'hooks':![],'fields':_[_0x9b91('0x2a')](_0x1bb21d)})['then'](function(_0x52f8dd){if(DUPLICATES&&DUPLICATES[_0x9b91('0x17')]&&_0x307874){_0x307874[_0x9b91('0x2b')](_[_0x9b91('0x2c')](_0x1bb21d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x52f8dd['id'];return _0x5bb8e3();})[_0x9b91('0x2d')](function(_0x51413b){return _0xf6b558(handleCheckRowError(_0x9b91('0x11'),_0x9b91('0x2e')+(_0x51413b[_0x9b91('0x19')]||JSON[_0x9b91('0x2f')](_0x51413b)),null,_0x45af00));});});}function checkHopper(){function _0x1ec312(){return function(_0x5ed6a2){logger['error'](_0x9b91('0x30'),_0x9b91('0x31'),util[_0x9b91('0x32')](_0x5ed6a2,{'showHidden':![],'depth':null}));};}var _0x8cf86b=function(_0x5569f3,_0x35263f){var _0x4e4a09=squel[_0x9b91('0x33')]()['into'](_0x9b91('0x34'))[_0x9b91('0x35')]([_0x9b91('0x1e'),_0x9b91('0x36'),_0x9b91('0x37'),_0x9b91('0x24'),_0x35263f,_0x9b91('0x38'),_0x9b91('0x39')],squel[_0x9b91('0x3a')]()['field'](_0x9b91('0x1e'),'phone')[_0x9b91('0x3b')](_0x9b91('0x3c'),_0x9b91('0x36'))[_0x9b91('0x3b')]('id','ContactId')[_0x9b91('0x3b')](LISTID[_0x9b91('0x3d')](),_0x9b91('0x24'))[_0x9b91('0x3b')](_0x5569f3['id'][_0x9b91('0x3d')](),_0x35263f)[_0x9b91('0x3b')]('NOW()',_0x9b91('0x38'))[_0x9b91('0x3b')](_0x9b91('0x3c'),_0x9b91('0x39'))[_0x9b91('0x3e')](_0x9b91('0x3f'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x9b91('0x40'),LISTID['toString']())[_0x9b91('0x41')](_0x9b91('0x42'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x9b91('0x3a')]()[_0x9b91('0x3b')](_0x9b91('0x1e'))['from'](_0x9b91('0x34'))[_0x9b91('0x41')](_0x35263f+_0x9b91('0x43'),_0x5569f3['id'][_0x9b91('0x3d')]())))[_0x9b91('0x3d')]();return _0x4e4a09;};var _0x827288=function(_0x582bbe,_0x593b16){var _0x5c2e21=squel[_0x9b91('0x33')]()[_0x9b91('0x44')](_0x9b91('0x34'))[_0x9b91('0x35')]([_0x9b91('0x1e'),'scheduledAt',_0x9b91('0x37'),_0x9b91('0x24'),_0x593b16,_0x9b91('0x38'),'updatedAt'],squel['select']()[_0x9b91('0x3b')](_0x9b91('0x1e'),_0x9b91('0x1e'))['field'](_0x9b91('0x3c'),_0x9b91('0x36'))[_0x9b91('0x3b')]('id','ContactId')['field'](LISTID[_0x9b91('0x3d')](),_0x9b91('0x24'))['field'](_0x582bbe['id']['toString'](),_0x593b16)['field']('NOW()',_0x9b91('0x38'))[_0x9b91('0x3b')]('NOW()','updatedAt')[_0x9b91('0x3e')](_0x9b91('0x3f'))['where'](_0x9b91('0x45'))['where']('ListId\x20=\x20?',LISTID[_0x9b91('0x3d')]())[_0x9b91('0x41')](_0x9b91('0x46'),squel['str'](hopperContacts))['where'](_0x9b91('0x42'))[_0x9b91('0x41')](_0x9b91('0x47'),squel[_0x9b91('0x3a')]()[_0x9b91('0x3b')](_0x9b91('0x48'))[_0x9b91('0x3e')](_0x9b91('0x49'))['where'](_0x593b16+'\x20=\x20?',_0x582bbe['id'][_0x9b91('0x3d')]()))[_0x9b91('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9b91('0x3a')]()[_0x9b91('0x3b')]('phone')[_0x9b91('0x3e')](_0x9b91('0x34'))[_0x9b91('0x41')](_0x593b16+_0x9b91('0x43'),_0x582bbe['id'][_0x9b91('0x3d')]())))[_0x9b91('0x3d')]();return _0x5c2e21;};function _0x13a70c(_0x1d1eca,_0x19e6f5){var _0x8f1de6=squel['insert']()['into'](_0x9b91('0x34'))[_0x9b91('0x35')]([_0x9b91('0x1e'),_0x9b91('0x36'),_0x9b91('0x37'),'ListId',_0x19e6f5,'createdAt',_0x9b91('0x39')],squel[_0x9b91('0x3a')]()[_0x9b91('0x3b')](_0x9b91('0x1e'),_0x9b91('0x1e'))[_0x9b91('0x3b')](_0x9b91('0x3c'),_0x9b91('0x36'))['field']('id',_0x9b91('0x37'))[_0x9b91('0x3b')](LISTID[_0x9b91('0x3d')](),_0x9b91('0x24'))[_0x9b91('0x3b')](_0x1d1eca['id'][_0x9b91('0x3d')](),_0x19e6f5)[_0x9b91('0x3b')]('NOW()',_0x9b91('0x38'))['field'](_0x9b91('0x3c'),_0x9b91('0x39'))[_0x9b91('0x3e')](_0x9b91('0x3f'))[_0x9b91('0x41')](_0x9b91('0x45'))[_0x9b91('0x41')](_0x9b91('0x40'),LISTID['toString']())[_0x9b91('0x41')](_0x9b91('0x46'),squel[_0x9b91('0x4a')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x9b91('0x3d')]();return _0x8f1de6;}function _0x370e38(_0x3a6c9a,_0x472dae){var _0x422080=squel[_0x9b91('0x33')]()['into'](_0x9b91('0x4b'))[_0x9b91('0x35')]([_0x9b91('0x1e'),_0x9b91('0x37'),_0x9b91('0x24'),_0x472dae,'createdAt',_0x9b91('0x39')],squel[_0x9b91('0x3a')]()[_0x9b91('0x3b')](_0x9b91('0x1e'),_0x9b91('0x1e'))[_0x9b91('0x3b')]('id',_0x9b91('0x37'))[_0x9b91('0x3b')](LISTID['toString'](),'ListId')[_0x9b91('0x3b')](_0x3a6c9a['id'][_0x9b91('0x3d')](),_0x472dae)['field'](_0x9b91('0x3c'),_0x9b91('0x38'))['field'](_0x9b91('0x3c'),_0x9b91('0x39'))['from'](_0x9b91('0x3f'))[_0x9b91('0x41')](_0x9b91('0x45'))[_0x9b91('0x41')](_0x9b91('0x40'),LISTID[_0x9b91('0x3d')]())[_0x9b91('0x41')]('id\x20IN\x20?',squel[_0x9b91('0x4a')](hopperContacts))['where'](_0x9b91('0x42')))[_0x9b91('0x3d')]();return _0x422080;}return db[_0x9b91('0x4c')][_0x9b91('0x4d')]({'where':{'type':_0x9b91('0x4e')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x9b91('0x4f')],'as':_0x9b91('0x50'),'where':{'id':LISTID}}]})[_0x9b91('0x51')](function(_0x17d2bf){var _0x523314=[];if(_0x17d2bf){var _0x16f1f3;for(var _0x25c101=0x0,_0x4b4a02;_0x25c101<_0x17d2bf['length'];_0x25c101+=0x1){_0x4b4a02=_0x17d2bf[_0x25c101][_0x9b91('0x52')]({'plain':!![]});switch(_0x4b4a02[_0x9b91('0x53')]){case'always':_0x523314[_0x9b91('0x2b')](db[_0x9b91('0x54')][_0x9b91('0x55')](_0x827288(_0x4b4a02,'VoiceQueueId'))[_0x9b91('0x51')](function(){})['catch'](_0x1ec312()));break;case _0x9b91('0x56'):_0x523314[_0x9b91('0x2b')](db[_0x9b91('0x54')][_0x9b91('0x55')](_0x8cf86b(_0x4b4a02,_0x9b91('0x57')))[_0x9b91('0x51')](function(){})[_0x9b91('0x2d')](_0x1ec312()));break;default:_0x523314['push'](db[_0x9b91('0x54')][_0x9b91('0x55')](_0x13a70c(_0x4b4a02,_0x9b91('0x57')))[_0x9b91('0x51')](function(){})[_0x9b91('0x2d')](_0x1ec312()));}}}return _0x523314;})['all']()['then'](function(){return db[_0x9b91('0x4c')][_0x9b91('0x4d')]({'where':{'type':_0x9b91('0x4e')},'attributes':['id'],'include':[{'model':db[_0x9b91('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x9b91('0x51')](function(_0x455d37){var _0x3e3bdd=[];if(_0x455d37){var _0x109ac8;for(var _0x29cfdf=0x0,_0x232b1a;_0x29cfdf<_0x455d37['length'];_0x29cfdf+=0x1){_0x232b1a=_0x455d37[_0x29cfdf][_0x9b91('0x52')]({'plain':!![]});_0x3e3bdd[_0x9b91('0x2b')](db['sequelize']['query'](_0x370e38(_0x232b1a,_0x9b91('0x57')))[_0x9b91('0x51')](function(){})[_0x9b91('0x2d')](_0x1ec312()));}}return _0x3e3bdd;})[_0x9b91('0x58')]();})[_0x9b91('0x51')](function(){return db['Campaign'][_0x9b91('0x4d')]({'attributes':['id',_0x9b91('0x53')],'include':[{'model':db[_0x9b91('0x4f')],'as':_0x9b91('0x50'),'where':{'id':LISTID}}]})[_0x9b91('0x51')](function(_0x1055d3){var _0x46219d=[];if(_0x1055d3){for(var _0xb6bec5=0x0,_0x3916b0;_0xb6bec5<_0x1055d3[_0x9b91('0x17')];_0xb6bec5+=0x1){_0x3916b0=_0x1055d3[_0xb6bec5][_0x9b91('0x52')]({'plain':!![]});switch(_0x3916b0[_0x9b91('0x53')]){case _0x9b91('0x59'):_0x46219d[_0x9b91('0x2b')](db['sequelize'][_0x9b91('0x55')](_0x827288(_0x3916b0,_0x9b91('0x5a')))[_0x9b91('0x51')](function(){})['catch'](_0x1ec312()));break;case _0x9b91('0x56'):_0x46219d[_0x9b91('0x2b')](db[_0x9b91('0x54')][_0x9b91('0x55')](_0x8cf86b(_0x3916b0,'CampaignId'))[_0x9b91('0x51')](function(){})[_0x9b91('0x2d')](_0x1ec312()));break;default:_0x46219d[_0x9b91('0x2b')](db[_0x9b91('0x54')][_0x9b91('0x55')](_0x13a70c(_0x3916b0,_0x9b91('0x5a')))[_0x9b91('0x51')](function(){})[_0x9b91('0x2d')](_0x1ec312()));}}}return _0x46219d;})[_0x9b91('0x58')]();})[_0x9b91('0x51')](function(){return db['Campaign'][_0x9b91('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x9b91('0x4f')],'as':_0x9b91('0x5b'),'where':{'id':LISTID}}]})['then'](function(_0x16574b){var _0x5c4b14=[];if(_0x16574b){for(var _0x1767ec=0x0,_0x52acbe;_0x1767ec<_0x16574b[_0x9b91('0x17')];_0x1767ec+=0x1){_0x52acbe=_0x16574b[_0x1767ec][_0x9b91('0x52')]({'plain':!![]});_0x5c4b14['push'](db[_0x9b91('0x54')][_0x9b91('0x55')](_0x370e38(_0x52acbe,_0x9b91('0x5a')))[_0x9b91('0x51')](function(){})['catch'](_0x1ec312()));}}return _0x5c4b14;})[_0x9b91('0x58')]();})[_0x9b91('0x2d')](function(_0x25288b){logger['error'](_0x9b91('0x5c'),_0x9b91('0x5d'),_0x25288b['message']);});}var processPromises=function(_0x53f7d5){return BPromise[_0x9b91('0x58')](promises)[_0x9b91('0x51')](function(_0x390b53){})['catch'](function(_0xf7cb97){logger['error'](_0x9b91('0x5e'),JSON[_0x9b91('0x2f')](_0xf7cb97));})['finally'](function(){socket[_0x9b91('0x5f')](_0x9b91('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x53f7d5){return _0x53f7d5[_0x9b91('0x61')]();}});};var endCsv=function(){return BPromise[_0x9b91('0x62')]()[_0x9b91('0x51')](function(){if(hopperContacts){return checkHopper();}})[_0x9b91('0x51')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x9b91('0x63')](FILEPATH);}catch(_0x1b0347){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x1b0347));}finally{process[_0x9b91('0x64')](0x0);}});};process['on'](_0x9b91('0x65'),function(){logger[_0x9b91('0x66')](_0x9b91('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0x9b91('0x51')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x9b91('0xe')](',');return db[_0x9b91('0x28')][_0x9b91('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x9b91('0x51')](function(_0x432a25){var _0x43a6de=fs[_0x9b91('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x43a6de,{'header':!![],'skipEmptyLines':!![],'step':function(_0x37e04b,_0xb4eaba){total+=0x1;var _0x164160=total;promises[_0x9b91('0x2b')](checkRow(_0x37e04b,_0x432a25,_0x164160)[_0x9b91('0x51')](function(){success+=0x1;})[_0x9b91('0x2d')](function(_0x349af9){if(_0x349af9[_0x9b91('0x11')]){errors+=0x1;delete _0x349af9['error'];}else if(_0x349af9[_0x9b91('0x26')]){duplicates+=0x1;delete _0x349af9['duplicate'];}rows[_0x9b91('0x2b')](_0x349af9);}));if(total%0xc8===0x0){_0xb4eaba[_0x9b91('0x69')]();return processPromises(_0xb4eaba);}},'complete':function(){return processPromises()[_0x9b91('0x51')](function(){logger[_0x9b91('0x66')](_0x9b91('0x6a'));endCsv();});},'error':function(_0x17028e,_0xd13e1f){logger[_0x9b91('0x66')](_0x9b91('0x6b'),JSON[_0x9b91('0x2f')](_0x17028e));endCsv();}});})[_0x9b91('0x2d')](function(_0x3c4327){logger[_0x9b91('0x11')](_0x9b91('0x6c'),JSON['stringify'](_0x3c4327));});}main(); \ No newline at end of file +var _0xc07b=['CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','stringify','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','../../../config/environment','../../../config/logger','api','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','errors','length','message','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','select','field','NOW()','scheduledAt','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','query','onlyIfOpen','VoiceQueueId','all','BlackLists','Campaign'];(function(_0x16cd37,_0x3a87fe){var _0x2ea739=function(_0x21ef8b){while(--_0x21ef8b){_0x16cd37['push'](_0x16cd37['shift']());}};_0x2ea739(++_0x3a87fe);}(_0xc07b,0x162));var _0xbc07=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0xc07b[_0x5d0609];return _0xaa3fd1;};'use strict';var BPromise=require(_0xbc07('0x0'));var util=require(_0xbc07('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xbc07('0x2'));var Papa=require(_0xbc07('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xbc07('0x4'));var logger=require(_0xbc07('0x5'))(_0xbc07('0x6'));config[_0xbc07('0x7')]=_['defaults'](config[_0xbc07('0x7')],{'host':_0xbc07('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc07('0x7')]));require(_0xbc07('0x9'))[_0xbc07('0xa')](socket);try{if(!process[_0xbc07('0xb')][0x2]||process[_0xbc07('0xb')][0x2]===_0xbc07('0xc')||process[_0xbc07('0xb')][0x2]===_0xbc07('0xd')){throw new Error(_0xbc07('0xe'));}var FILEPATH=process[_0xbc07('0xb')][0x2];if(!process[_0xbc07('0xb')][0x3]||process['argv'][0x3]===_0xbc07('0xc')||process[_0xbc07('0xb')][0x3]===_0xbc07('0xd')||!process[_0xbc07('0xb')][0x4]||process['argv'][0x4]===_0xbc07('0xc')||process[_0xbc07('0xb')][0x4]==='null'){throw new Error(_0xbc07('0xf'));}var FIELDS=_[_0xbc07('0x10')](process[_0xbc07('0xb')][0x3][_0xbc07('0x11')](','),process[_0xbc07('0xb')][0x4][_0xbc07('0x11')](','));if(!process['argv'][0x5]||process[_0xbc07('0xb')][0x5]===_0xbc07('0xc')||process[_0xbc07('0xb')][0x5]===_0xbc07('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xbc07('0xb')][0x6]&&process[_0xbc07('0xb')][0x6]!==_0xbc07('0xc')&&process[_0xbc07('0xb')][0x6]!==_0xbc07('0xd')?process[_0xbc07('0xb')][0x6]:null;var DUPLICATES=process[_0xbc07('0xb')][0x7]&&process[_0xbc07('0xb')][0x7]!==_0xbc07('0xc')&&process[_0xbc07('0xb')][0x7]!==_0xbc07('0xd')?process[_0xbc07('0xb')][0x7]:null;if(!process[_0xbc07('0xb')][0x8]||process['argv'][0x8]===_0xbc07('0xc')||process['argv'][0x8]==='null'){throw new Error(_0xbc07('0x12'));}var SOCKET_TIMESTAMP=process[_0xbc07('0xb')][0x8];}catch(_0x3ed3a7){logger[_0xbc07('0x13')](_0x3ed3a7);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(_0x23788d,_0x5ab81c,_0x43e5b6,_0x4eaf6f){var _0xb847a9={'message':_0x5ab81c};_0xb847a9[_0x23788d]=!![];if(_0x43e5b6){_0xb847a9['contact']=_0x43e5b6;}if(_0x4eaf6f){_0xb847a9[_0xbc07('0x14')]=_0x4eaf6f;}return _0xb847a9;}function isEmail(_0x7115f0){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))*$/[_0xbc07('0x15')](_0x7115f0);}function checkRow(_0x32d55c,_0x5438d9,_0x21f1bb){return new BPromise(function(_0x2993d2,_0x3ea060){if(_[_0xbc07('0x16')](_0x32d55c)){return _0x3ea060(handleCheckRowError(_0xbc07('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x21f1bb));}if(_0x32d55c[_0xbc07('0x17')]&&_0x32d55c['errors'][_0xbc07('0x18')]){var _0x7c3ffb=_['map'](_0x32d55c[_0xbc07('0x17')],_0xbc07('0x19'))['join'](';');return _0x3ea060(handleCheckRowError(_0xbc07('0x13'),_0x7c3ffb,null,_0x21f1bb));}var _0x413238={};for(var _0x19057c in FIELDS){if(FIELDS['hasOwnProperty'](_0x19057c)&&FIELDS[_0x19057c]){_0x413238[_0x19057c]=_0x32d55c[_0xbc07('0x1a')][0x0][FIELDS[_0x19057c]]||_0x32d55c[_0xbc07('0x1a')][0x0]['\ufeff'+FIELDS[_0x19057c]];}}if(!_0x413238[_0xbc07('0x1b')]){return _0x3ea060(handleCheckRowError(_0xbc07('0x13'),_0xbc07('0x1c'),null,_0x21f1bb));}if(!_0x413238[_0xbc07('0x1d')]){return _0x3ea060(handleCheckRowError(_0xbc07('0x13'),_0xbc07('0x1e'),null,_0x21f1bb));}if(_0x413238[_0xbc07('0x1f')]){var _0xbceeb=moment(_0x413238['birthDate'],_0xbc07('0x20'));if(!_0xbceeb[_0xbc07('0x21')]()){return _0x3ea060(handleCheckRowError(_0xbc07('0x13'),_0xbc07('0x22'),null,_0x21f1bb));}}if(_0x413238[_0xbc07('0x23')]){if(!isEmail(_0x413238['email'])){return _0x3ea060(handleCheckRowError(_0xbc07('0x13'),_0xbc07('0x24'),null,_0x21f1bb));}}_0x413238[_0xbc07('0x25')]=LISTID;_0x413238[_0xbc07('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xbc07('0x18')]&&_0x5438d9){var _0x22a001={};for(var _0x1dcc20=0x0,_0x1b982e=DUPLICATES[_0xbc07('0x18')];_0x1dcc20<_0x1b982e;_0x1dcc20+=0x1){_0x22a001[DUPLICATES[_0x1dcc20]]=_0x413238[DUPLICATES[_0x1dcc20]];}var _0x272efc=_[_0xbc07('0x27')](_0x5438d9,_0x22a001);if(_0x272efc){return _0x3ea060(handleCheckRowError('duplicate',_0xbc07('0x28'),_0x272efc,_0x21f1bb));}}return db[_0xbc07('0x29')][_0xbc07('0x2a')](_0x413238,{'raw':!![],'hooks':![],'fields':_[_0xbc07('0x2b')](_0x413238)})[_0xbc07('0x2c')](function(_0x2634f6){if(DUPLICATES&&DUPLICATES[_0xbc07('0x18')]&&_0x5438d9){_0x5438d9['push'](_[_0xbc07('0x2d')](_0x413238,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2634f6['id'];return _0x2993d2();})[_0xbc07('0x2e')](function(_0x4f0155){return _0x3ea060(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x4f0155['message']||JSON['stringify'](_0x4f0155)),null,_0x21f1bb));});});}function checkHopper(){function _0x2780be(){return function(_0x4b515b){logger['error'](_0xbc07('0x2f'),_0xbc07('0x30'),util['inspect'](_0x4b515b,{'showHidden':![],'depth':null}));};}var _0x2f1bd9=function(_0x50b609,_0x1425a5){var _0x347298=squel[_0xbc07('0x31')]()[_0xbc07('0x32')](_0xbc07('0x33'))[_0xbc07('0x34')](['phone','scheduledAt',_0xbc07('0x35'),_0xbc07('0x25'),_0x1425a5,'createdAt',_0xbc07('0x36')],squel[_0xbc07('0x37')]()[_0xbc07('0x38')]('phone','phone')[_0xbc07('0x38')](_0xbc07('0x39'),_0xbc07('0x3a'))['field']('id',_0xbc07('0x35'))[_0xbc07('0x38')](LISTID[_0xbc07('0x3b')](),'ListId')[_0xbc07('0x38')](_0x50b609['id']['toString'](),_0x1425a5)[_0xbc07('0x38')](_0xbc07('0x39'),_0xbc07('0x3c'))[_0xbc07('0x38')](_0xbc07('0x39'),_0xbc07('0x36'))[_0xbc07('0x3d')](_0xbc07('0x3e'))[_0xbc07('0x3f')](_0xbc07('0x40'))[_0xbc07('0x3f')](_0xbc07('0x41'),LISTID[_0xbc07('0x3b')]())[_0xbc07('0x3f')](_0xbc07('0x42'))[_0xbc07('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbc07('0x37')]()[_0xbc07('0x38')](_0xbc07('0x1d'))['from'](_0xbc07('0x33'))[_0xbc07('0x3f')](_0x1425a5+_0xbc07('0x43'),_0x50b609['id'][_0xbc07('0x3b')]())))[_0xbc07('0x3b')]();return _0x347298;};var _0x7a2d22=function(_0x31c47a,_0x2a0d94){var _0x3de20c=squel[_0xbc07('0x31')]()[_0xbc07('0x32')]('cm_hopper')['fromQuery'](['phone',_0xbc07('0x3a'),_0xbc07('0x35'),_0xbc07('0x25'),_0x2a0d94,'createdAt','updatedAt'],squel['select']()['field']('phone','phone')[_0xbc07('0x38')](_0xbc07('0x39'),_0xbc07('0x3a'))[_0xbc07('0x38')]('id',_0xbc07('0x35'))[_0xbc07('0x38')](LISTID[_0xbc07('0x3b')](),'ListId')[_0xbc07('0x38')](_0x31c47a['id'][_0xbc07('0x3b')](),_0x2a0d94)[_0xbc07('0x38')](_0xbc07('0x39'),'createdAt')[_0xbc07('0x38')](_0xbc07('0x39'),_0xbc07('0x36'))['from'](_0xbc07('0x3e'))[_0xbc07('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0xbc07('0x41'),LISTID['toString']())[_0xbc07('0x3f')](_0xbc07('0x44'),squel[_0xbc07('0x45')](hopperContacts))[_0xbc07('0x3f')](_0xbc07('0x42'))[_0xbc07('0x3f')](_0xbc07('0x46'),squel[_0xbc07('0x37')]()[_0xbc07('0x38')](_0xbc07('0x47'))['from'](_0xbc07('0x48'))[_0xbc07('0x3f')](_0x2a0d94+_0xbc07('0x43'),_0x31c47a['id'][_0xbc07('0x3b')]()))['where'](_0xbc07('0x46'),squel[_0xbc07('0x37')]()[_0xbc07('0x38')](_0xbc07('0x1d'))[_0xbc07('0x3d')](_0xbc07('0x33'))[_0xbc07('0x3f')](_0x2a0d94+_0xbc07('0x43'),_0x31c47a['id'][_0xbc07('0x3b')]())))[_0xbc07('0x3b')]();return _0x3de20c;};function _0x29651b(_0x444beb,_0x4dd444){var _0x5b3150=squel['insert']()[_0xbc07('0x32')](_0xbc07('0x33'))[_0xbc07('0x34')]([_0xbc07('0x1d'),_0xbc07('0x3a'),_0xbc07('0x35'),_0xbc07('0x25'),_0x4dd444,_0xbc07('0x3c'),'updatedAt'],squel[_0xbc07('0x37')]()[_0xbc07('0x38')](_0xbc07('0x1d'),_0xbc07('0x1d'))['field']('NOW()','scheduledAt')['field']('id',_0xbc07('0x35'))['field'](LISTID[_0xbc07('0x3b')](),_0xbc07('0x25'))['field'](_0x444beb['id'][_0xbc07('0x3b')](),_0x4dd444)[_0xbc07('0x38')]('NOW()',_0xbc07('0x3c'))[_0xbc07('0x38')](_0xbc07('0x39'),'updatedAt')['from'](_0xbc07('0x3e'))[_0xbc07('0x3f')](_0xbc07('0x40'))[_0xbc07('0x3f')](_0xbc07('0x41'),LISTID[_0xbc07('0x3b')]())[_0xbc07('0x3f')](_0xbc07('0x44'),squel[_0xbc07('0x45')](hopperContacts))[_0xbc07('0x3f')](_0xbc07('0x42')))[_0xbc07('0x3b')]();return _0x5b3150;}function _0x58dbf4(_0x10452c,_0x3f06d3){var _0x35c5cb=squel[_0xbc07('0x31')]()[_0xbc07('0x32')](_0xbc07('0x49'))[_0xbc07('0x34')]([_0xbc07('0x1d'),_0xbc07('0x35'),_0xbc07('0x25'),_0x3f06d3,'createdAt',_0xbc07('0x36')],squel[_0xbc07('0x37')]()[_0xbc07('0x38')]('phone',_0xbc07('0x1d'))['field']('id','ContactId')[_0xbc07('0x38')](LISTID[_0xbc07('0x3b')](),_0xbc07('0x25'))['field'](_0x10452c['id'][_0xbc07('0x3b')](),_0x3f06d3)[_0xbc07('0x38')]('NOW()',_0xbc07('0x3c'))[_0xbc07('0x38')](_0xbc07('0x39'),_0xbc07('0x36'))['from'](_0xbc07('0x3e'))[_0xbc07('0x3f')]('deletedAt\x20IS\x20NULL')[_0xbc07('0x3f')](_0xbc07('0x41'),LISTID['toString']())[_0xbc07('0x3f')](_0xbc07('0x44'),squel[_0xbc07('0x45')](hopperContacts))[_0xbc07('0x3f')](_0xbc07('0x42')))[_0xbc07('0x3b')]();return _0x35c5cb;}return db[_0xbc07('0x4a')][_0xbc07('0x4b')]({'where':{'type':_0xbc07('0x4c')},'attributes':['id',_0xbc07('0x4d')],'include':[{'model':db[_0xbc07('0x4e')],'as':_0xbc07('0x4f'),'where':{'id':LISTID}}]})[_0xbc07('0x2c')](function(_0x575f61){var _0x33d3bf=[];if(_0x575f61){var _0x496c2a;for(var _0x29dcb5=0x0,_0xea84b6;_0x29dcb5<_0x575f61['length'];_0x29dcb5+=0x1){_0xea84b6=_0x575f61[_0x29dcb5][_0xbc07('0x50')]({'plain':!![]});switch(_0xea84b6[_0xbc07('0x4d')]){case _0xbc07('0x51'):_0x33d3bf[_0xbc07('0x52')](db[_0xbc07('0x53')][_0xbc07('0x54')](_0x7a2d22(_0xea84b6,'VoiceQueueId'))[_0xbc07('0x2c')](function(){})[_0xbc07('0x2e')](_0x2780be()));break;case _0xbc07('0x55'):_0x33d3bf['push'](db['sequelize'][_0xbc07('0x54')](_0x2f1bd9(_0xea84b6,_0xbc07('0x56')))['then'](function(){})['catch'](_0x2780be()));break;default:_0x33d3bf[_0xbc07('0x52')](db['sequelize'][_0xbc07('0x54')](_0x29651b(_0xea84b6,_0xbc07('0x56')))[_0xbc07('0x2c')](function(){})[_0xbc07('0x2e')](_0x2780be()));}}}return _0x33d3bf;})[_0xbc07('0x57')]()[_0xbc07('0x2c')](function(){return db[_0xbc07('0x4a')][_0xbc07('0x4b')]({'where':{'type':_0xbc07('0x4c')},'attributes':['id'],'include':[{'model':db[_0xbc07('0x4e')],'as':_0xbc07('0x58'),'where':{'id':LISTID}}]})[_0xbc07('0x2c')](function(_0x46895f){var _0x372378=[];if(_0x46895f){var _0x2786a8;for(var _0x2da09a=0x0,_0x4bf27c;_0x2da09a<_0x46895f[_0xbc07('0x18')];_0x2da09a+=0x1){_0x4bf27c=_0x46895f[_0x2da09a][_0xbc07('0x50')]({'plain':!![]});_0x372378[_0xbc07('0x52')](db['sequelize'][_0xbc07('0x54')](_0x58dbf4(_0x4bf27c,_0xbc07('0x56')))[_0xbc07('0x2c')](function(){})[_0xbc07('0x2e')](_0x2780be()));}}return _0x372378;})[_0xbc07('0x57')]();})[_0xbc07('0x2c')](function(){return db[_0xbc07('0x59')][_0xbc07('0x4b')]({'attributes':['id',_0xbc07('0x4d')],'include':[{'model':db[_0xbc07('0x4e')],'as':_0xbc07('0x4f'),'where':{'id':LISTID}}]})[_0xbc07('0x2c')](function(_0x55398a){var _0x1b7daf=[];if(_0x55398a){for(var _0x1f38c5=0x0,_0x44576b;_0x1f38c5<_0x55398a[_0xbc07('0x18')];_0x1f38c5+=0x1){_0x44576b=_0x55398a[_0x1f38c5][_0xbc07('0x50')]({'plain':!![]});switch(_0x44576b[_0xbc07('0x4d')]){case _0xbc07('0x51'):_0x1b7daf['push'](db[_0xbc07('0x53')][_0xbc07('0x54')](_0x7a2d22(_0x44576b,'CampaignId'))['then'](function(){})[_0xbc07('0x2e')](_0x2780be()));break;case _0xbc07('0x55'):_0x1b7daf['push'](db[_0xbc07('0x53')]['query'](_0x2f1bd9(_0x44576b,_0xbc07('0x5a')))[_0xbc07('0x2c')](function(){})[_0xbc07('0x2e')](_0x2780be()));break;default:_0x1b7daf['push'](db[_0xbc07('0x53')][_0xbc07('0x54')](_0x29651b(_0x44576b,_0xbc07('0x5a')))[_0xbc07('0x2c')](function(){})[_0xbc07('0x2e')](_0x2780be()));}}}return _0x1b7daf;})[_0xbc07('0x57')]();})[_0xbc07('0x2c')](function(){return db[_0xbc07('0x59')][_0xbc07('0x4b')]({'attributes':['id'],'include':[{'model':db[_0xbc07('0x4e')],'as':_0xbc07('0x58'),'where':{'id':LISTID}}]})[_0xbc07('0x2c')](function(_0x51d04a){var _0xe2cb2d=[];if(_0x51d04a){for(var _0x152e71=0x0,_0x4d827a;_0x152e71<_0x51d04a[_0xbc07('0x18')];_0x152e71+=0x1){_0x4d827a=_0x51d04a[_0x152e71][_0xbc07('0x50')]({'plain':!![]});_0xe2cb2d[_0xbc07('0x52')](db[_0xbc07('0x53')]['query'](_0x58dbf4(_0x4d827a,_0xbc07('0x5a')))[_0xbc07('0x2c')](function(){})['catch'](_0x2780be()));}}return _0xe2cb2d;})['all']();})['catch'](function(_0x38b36c){logger[_0xbc07('0x13')](_0xbc07('0x5b'),_0xbc07('0x5c'),_0x38b36c[_0xbc07('0x19')]);});}var processPromises=function(_0x1b90a1){return BPromise[_0xbc07('0x57')](promises)[_0xbc07('0x2c')](function(_0x52497c){})[_0xbc07('0x2e')](function(_0x112507){logger[_0xbc07('0x13')](_0xbc07('0x5d'),JSON['stringify'](_0x112507));})[_0xbc07('0x5e')](function(){socket[_0xbc07('0x5f')](_0xbc07('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1b90a1){return _0x1b90a1[_0xbc07('0x61')]();}});};var endCsv=function(){return BPromise[_0xbc07('0x62')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xbc07('0x2c')](function(){socket[_0xbc07('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xbc07('0x63')](FILEPATH);}catch(_0x5ea6a9){logger[_0xbc07('0x13')](_0xbc07('0x64'),JSON[_0xbc07('0x65')](_0x5ea6a9));}finally{process[_0xbc07('0x66')](0x0);}});};process['on'](_0xbc07('0x67'),function(){logger['info'](_0xbc07('0x68'));endCsv();});function main(){return BPromise[_0xbc07('0x62')]()[_0xbc07('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xbc07('0x11')](',');return db['CmContact'][_0xbc07('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xbc07('0x2c')](function(_0x4427dc){var _0x389492=fs[_0xbc07('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xbc07('0x6a')](_0x389492,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3852b8,_0x5a1c43){total+=0x1;var _0x4c4ba7=total;promises[_0xbc07('0x52')](checkRow(_0x3852b8,_0x4427dc,_0x4c4ba7)[_0xbc07('0x2c')](function(){success+=0x1;})[_0xbc07('0x2e')](function(_0x492fd3){if(_0x492fd3['error']){errors+=0x1;delete _0x492fd3[_0xbc07('0x13')];}else if(_0x492fd3['duplicate']){duplicates+=0x1;delete _0x492fd3['duplicate'];}rows[_0xbc07('0x52')](_0x492fd3);}));if(total%0xc8===0x0){_0x5a1c43['pause']();return processPromises(_0x5a1c43);}},'complete':function(){return processPromises()[_0xbc07('0x2c')](function(){logger[_0xbc07('0x6b')](_0xbc07('0x6c'));endCsv();});},'error':function(_0x26ab1c,_0x4c6d88){logger[_0xbc07('0x6b')](_0xbc07('0x6d'),JSON[_0xbc07('0x65')](_0x26ab1c));endCsv();}});})[_0xbc07('0x2e')](function(_0x56899a){logger[_0xbc07('0x13')](_0xbc07('0x6e'),JSON[_0xbc07('0x65')](_0x56899a));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 3493574..55986ac 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 _0xda2d=['.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.createdAt','cm_hopper_black','fields','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','.id\x20=\x20','\x22onlyIfOpen\x22','toString','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','min_id','group','info','exit','errors','code','sequelize','query','spread','catch','message','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','error','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','timezones','offset','set','dialTimezone','main','stringify','send','start','binding','socket_timestamp','server/files/tmp','.csv','includes','findAll','name','_description','header','writeFileSync','parse','data','rows','find','hasOwnProperty','trim','isValid','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','\x20not\x20specified','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','orderBy','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','where','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','then','length','push','all','AdditionalPhones','split','isNil','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xda2d,0x1e0));var _0xdda2=function(_0x327329,_0x4f3c34){_0x327329=_0x327329-0x0;var _0x2a226c=_0xda2d[_0x327329];return _0x2a226c;};'use strict';var fs=require('fs');var path=require(_0xdda2('0x0'));var _=require('lodash');var Papa=require(_0xdda2('0x1'));var util=require(_0xdda2('0x2'));var BPromise=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var squel=require(_0xdda2('0x5'));var Redis=require(_0xdda2('0x6'));var db=require(_0xdda2('0x7'))['db'];var config=require(_0xdda2('0x8'));var shared=require(_0xdda2('0x9'));var logger=require(_0xdda2('0xa'))('import');config[_0xdda2('0xb')]=_[_0xdda2('0xc')](config['redis'],{'host':_0xdda2('0xd'),'port':0x18eb});var socket=require(_0xdda2('0xe'))(new Redis(config[_0xdda2('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xdda2('0xf')](_0xdda2('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5c178d){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))*$/[_0xdda2('0x11')](_0x5c178d);}function selectNotIn(_0x3d5e3c,_0x3a249c,_0x21fe57,_0x1c277d,_0x5b59df){return squel[_0xdda2('0x12')]()[_0xdda2('0x13')](_0xdda2('0x14'))[_0xdda2('0x15')](_0x1c277d)['join'](_0x3a249c,null,_0x3a249c+'.id\x20=\x20'+_0x1c277d+'.'+_0x21fe57)[_0xdda2('0x16')](_0x1c277d+'.'+_0x21fe57+'\x20=\x20'+_0x3d5e3c+'.'+_0x21fe57)[_0xdda2('0x16')](_0x3a249c+_0xdda2('0x17')+_0x5b59df[_0xdda2('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e71a2,_0x3dd809){promisesAdditionalPhones=[];return db[_0xdda2('0x19')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xdda2('0x1a')](function(_0x19cc6f){if(_0x19cc6f!==null){var _0x6dc72a=[];for(var _0x43ac97=0x0;_0x43ac97<_0x19cc6f[_0xdda2('0x1b')];_0x43ac97++){var _0x5f4f64=_0x19cc6f[_0x43ac97];_0x6dc72a[_0xdda2('0x1c')](insertAdditionalPhones(_0x5f4f64));}}Promise[_0xdda2('0x1d')](_0x6dc72a)[_0xdda2('0x1a')](function(){_0x4e71a2({'val':0x1});});});});}function insertAdditionalPhones(_0x1a1b54){return new Promise(function(_0x3b7980,_0x40eba3){var _0x1ccb7f=_0x1a1b54[_0xdda2('0x1e')];var _0x5cad32=_0x1ccb7f[_0xdda2('0x1f')](';');var _0x20826c=[];orderBy=0x0;for(var _0x529f9e=0x0;_0x529f9e<_0x5cad32['length'];_0x529f9e++){_0x20826c[_0xdda2('0x1c')](splitAdditionalPhone(_0x1a1b54['id'],_0x5cad32[_0x529f9e]));}Promise[_0xdda2('0x1d')](_0x20826c)[_0xdda2('0x1a')](function(){_0x3b7980({'val':_0x5cad32['length']});});});}function splitAdditionalPhone(_0x392213,_0x216aa2){return new Promise(function(_0x199cf6,_0x42ee02){var _0x2d71c9=_0x216aa2[_0xdda2('0x1f')](':');var _0x1d6006=_0x2d71c9[0x0];var _0x54c85b=_0x2d71c9[0x1];if(!_[_0xdda2('0x20')](_0x54c85b)){var _0x165573=_0x54c85b[_0xdda2('0x1f')]('|');var _0x12b437=[];for(var _0x36949c=0x0;_0x36949c<_0x165573[_0xdda2('0x1b')];_0x36949c++){if(_0x165573[_0x36949c]!==''){var _0x499dda=_[_0xdda2('0x21')](promisesAdditionalPhones,{'contactId':_0x392213,'phone':_0x165573[_0x36949c]});if(_0x499dda[_0xdda2('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xdda2('0x1c')]({'contactId':_0x392213,'contactTypeId':_0x1d6006,'phone':_0x165573[_0x36949c],'orderBy':orderBy});}}}_0x199cf6({'ok':0x1});}else _0x199cf6({'res':0x0});});}function createAdditionalPhone(_0x16d801,_0x3dadc8,_0x3517cb,_0x455758){var _0x1d5277='';var _0x4a8703='';var _0x18e1c7=_0x3517cb[_0xdda2('0x1f')]('§');_0x1d5277=_0x18e1c7[0x0];if(_0x18e1c7['length']==0x2)_0x4a8703=_0x18e1c7[0x1];return new Promise(function(_0x3a6807,_0x5d21fe){return db[_0xdda2('0x22')]['findOne']({'where':{'CmContactId':_0x16d801,'item':_0x1d5277}})[_0xdda2('0x1a')](function(_0x5d182e){if(_0x5d182e){return db[_0xdda2('0x22')][_0xdda2('0x23')]({'ItemTypeId':_0x3dadc8,'description':_0x4a8703,'OrderBy':_0x455758},{'where':{'CmContactId':_0x16d801,'item':_0x1d5277}})[_0xdda2('0x1a')](function(_0x2f00c6){_0x3a6807({'res':_0xdda2('0x24')});});}else{return db[_0xdda2('0x22')][_0xdda2('0x25')]({'CmContactId':_0x16d801,'item':_0x1d5277,'description':_0x4a8703,'ItemTypeId':_0x3dadc8,'OrderBy':_0x455758,'ItemClass':_0xdda2('0x26')})[_0xdda2('0x1a')](function(_0x4b2658){_0x3a6807({'res':_0xdda2('0x27')});});}});});}function insertCmHopper(_0x16ffe5,_0x192b46,_0x448282,_0xa8ec52,_0x1300fd){var _0x55c96e=[_0xdda2('0x28'),_0xdda2('0x29'),_0xdda2('0x2a'),_0xdda2('0x2b'),_0x192b46+'.'+_0xa8ec52,'cm_contacts.createdAt',_0xdda2('0x2c'),'cm_contacts.priority',_0xdda2('0x2d'),'\x22'+_0x1300fd+'\x22'];return squel[_0xdda2('0x2e')]()[_0xdda2('0x2f')](_0xdda2('0x30'))[_0xdda2('0x31')]([_0xdda2('0x14'),_0xdda2('0x32'),_0xdda2('0x33'),_0xdda2('0x34'),_0xa8ec52,_0xdda2('0x35'),_0xdda2('0x36'),_0xdda2('0x37'),_0xdda2('0x38'),'recallme'],squel[_0xdda2('0x12')]()['fields'](_0x55c96e)[_0xdda2('0x15')](_0x192b46)[_0xdda2('0x18')](_0xdda2('0x39'),null,_0xdda2('0x3a')+_0x192b46+_0xdda2('0x3b'))[_0xdda2('0x18')](_0x448282,null,_0x448282+'.id\x20=\x20'+_0x192b46+'.'+_0xa8ec52)[_0xdda2('0x16')](_0x192b46+_0xdda2('0x3c'),_0x16ffe5)['where'](_0xdda2('0x3d'),NOW)[_0xdda2('0x16')](_0xdda2('0x3e'),selectNotIn(_0x192b46,_0x448282,_0xa8ec52,_0xdda2('0x30'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xdda2('0x16')](_0xdda2('0x3e'),selectNotIn(_0x192b46,_0x448282,_0xa8ec52,_0xdda2('0x30'),[_0xdda2('0x3f')])))['toString']();}function insertCmHopperBlack(_0xa8f3bd,_0x54114f,_0x3d86d4,_0x2de72c){var _0x29dba5=[_0xdda2('0x28'),_0xdda2('0x2a'),_0xdda2('0x2b'),_0x54114f+'.'+_0x2de72c,_0xdda2('0x40'),_0xdda2('0x2c')];return squel[_0xdda2('0x2e')]()['into'](_0xdda2('0x41'))[_0xdda2('0x31')](['phone',_0xdda2('0x33'),_0xdda2('0x34'),_0x2de72c,_0xdda2('0x35'),'updatedAt'],squel['select']()[_0xdda2('0x42')](_0x29dba5)[_0xdda2('0x15')](_0x54114f)[_0xdda2('0x18')](_0xdda2('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x54114f+_0xdda2('0x3b'))[_0xdda2('0x18')](_0x3d86d4,null,_0x3d86d4+'.id\x20=\x20'+_0x54114f+'.'+_0x2de72c)[_0xdda2('0x16')](_0x54114f+_0xdda2('0x3c'),_0xa8f3bd)['where'](_0xdda2('0x3d'),NOW)[_0xdda2('0x16')](_0xdda2('0x3e'),squel[_0xdda2('0x12')]()[_0xdda2('0x13')](_0xdda2('0x14'))[_0xdda2('0x15')]('cm_hopper_black')['where'](_0xdda2('0x43'),_0xa8f3bd)['where'](_0x2de72c+_0xdda2('0x44')+_0x54114f+'.'+_0x2de72c)))['toString']();}function insertTzCmHopper(_0x57a0af,_0x30a6f7,_0x7d808f,_0x32e7a2,_0x56c869,_0x124ac2){var _0x29a536=[_0xdda2('0x28'),_0xdda2('0x45')+_0x124ac2+_0xdda2('0x46'),_0xdda2('0x2a'),_0xdda2('0x2b'),_0x30a6f7+'.'+_0x32e7a2,_0xdda2('0x40'),_0xdda2('0x2c'),'cm_contacts.priority',_0xdda2('0x2d'),'\x22'+_0x56c869+'\x22'];var _0x3cc1d9=squel[_0xdda2('0x2e')]()[_0xdda2('0x2f')](_0xdda2('0x30'))[_0xdda2('0x31')](['phone','scheduledat','ContactId',_0xdda2('0x34'),_0x32e7a2,_0xdda2('0x35'),_0xdda2('0x36'),_0xdda2('0x37'),'UserId','recallme'],squel[_0xdda2('0x12')]()[_0xdda2('0x42')](_0x29a536)[_0xdda2('0x15')](_0x30a6f7)[_0xdda2('0x18')]('cm_contacts',null,_0xdda2('0x3a')+_0x30a6f7+_0xdda2('0x3b'))[_0xdda2('0x18')](_0x7d808f,null,_0x7d808f+_0xdda2('0x47')+_0x30a6f7+'.'+_0x32e7a2)[_0xdda2('0x18')](_0x124ac2,null,_0x124ac2+_0xdda2('0x47')+_0x30a6f7+'.'+_0x32e7a2)[_0xdda2('0x16')](_0x30a6f7+'.CmListId\x20=\x20?',_0x57a0af)[_0xdda2('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xdda2('0x16')](_0xdda2('0x3e'),selectNotIn(_0x30a6f7,_0x7d808f,_0x32e7a2,_0xdda2('0x30'),[_0xdda2('0x3f'),_0xdda2('0x48')]))[_0xdda2('0x16')](_0xdda2('0x3e'),selectNotIn(_0x30a6f7,_0x7d808f,_0x32e7a2,_0xdda2('0x30'),[_0xdda2('0x3f')])))[_0xdda2('0x49')]();return _0x3cc1d9;}function insertTzCmHopperBlack(_0x3836f2,_0x394eb8,_0x2230a0,_0x3dcaca){var _0x3e0a72=[_0xdda2('0x28'),_0xdda2('0x2a'),_0xdda2('0x2b'),_0x394eb8+'.'+_0x3dcaca,_0xdda2('0x40'),_0xdda2('0x2c')];return squel[_0xdda2('0x2e')]()['into'](_0xdda2('0x41'))[_0xdda2('0x31')](['phone',_0xdda2('0x33'),_0xdda2('0x34'),_0x3dcaca,'createdAt',_0xdda2('0x36')],squel['select']()[_0xdda2('0x42')](_0x3e0a72)[_0xdda2('0x15')](_0x394eb8)[_0xdda2('0x18')]('cm_contacts',null,_0xdda2('0x3a')+_0x394eb8+_0xdda2('0x3b'))[_0xdda2('0x18')](_0x2230a0,null,_0x2230a0+'.id\x20=\x20'+_0x394eb8+'.'+_0x3dcaca)['where'](_0x394eb8+_0xdda2('0x3c'),_0x3836f2)[_0xdda2('0x16')](_0xdda2('0x3d'),NOW)[_0xdda2('0x16')](_0xdda2('0x3e'),squel[_0xdda2('0x12')]()[_0xdda2('0x13')]('phone')[_0xdda2('0x15')](_0xdda2('0x41'))[_0xdda2('0x16')](_0xdda2('0x43'),_0x3836f2)[_0xdda2('0x16')](_0x3dcaca+_0xdda2('0x44')+_0x394eb8+'.'+_0x3dcaca)))['toString']();}function insertCmHopperAdditionalPhones(_0x4f91e1){var _0x50f898=['cm_hopper.id',_0xdda2('0x4a'),'cm_contact_has_items.OrderBy',_0xdda2('0x4b'),_0xdda2('0x4c')];return squel['insert']()[_0xdda2('0x2f')]('cm_hopper_additional_phones')[_0xdda2('0x31')]([_0xdda2('0x4d'),'phone','OrderBy',_0xdda2('0x35'),_0xdda2('0x36')],squel[_0xdda2('0x12')]()['fields'](_0x50f898)[_0xdda2('0x15')](_0xdda2('0x30'))[_0xdda2('0x18')]('cm_contacts',null,_0xdda2('0x4e'))['join'](_0xdda2('0x4f'),null,_0xdda2('0x50'))[_0xdda2('0x16')](_0xdda2('0x51'),_0x4f91e1)[_0xdda2('0x16')](_0xdda2('0x3d'),NOW))[_0xdda2('0x49')]();}function insertCmContact(_0x5f1542,_0x318130,_0x12a5d3,_0x34aef3){var _0x3e9b35=_[_0xdda2('0x52')](_[_0xdda2('0x53')](_0x34aef3),[_0xdda2('0x34'),_0xdda2('0x54'),_0xdda2('0x35'),'updatedAt',_0xdda2('0x55')]);return squel[_0xdda2('0x2e')]()['into'](_0xdda2('0x39'))['fromQuery'](_0x3e9b35,squel[_0xdda2('0x12')]()[_0xdda2('0x42')](_0x3e9b35)[_0xdda2('0x15')](_0x318130)[_0xdda2('0x16')]('('+_0x12a5d3[_0xdda2('0x18')](',')+')\x20NOT\x20IN\x20?',squel[_0xdda2('0x12')]()['fields'](_0x12a5d3)[_0xdda2('0x15')](_0xdda2('0x39'))['where']('ListId\x20=\x20?',_0x5f1542)[_0xdda2('0x16')](_0xdda2('0x56')))['where']('id\x20IN\x20?',squel['select']()[_0xdda2('0x13')]('MIN(id)',_0xdda2('0x57'))[_0xdda2('0x15')](_0x318130)[_0xdda2('0x58')](_0x12a5d3['join'](','))))['toString']();}function handleStop(){logger[_0xdda2('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x3f5769){logger['error'](_0x3f5769['message']);process[_0xdda2('0x5a')](0x1);}function handleError(_0x3bca93,_0x296295){stats[_0xdda2('0x5b')]['push']({'name':_0x296295[_0xdda2('0x5c')],'message':_0x296295['message'],'row':_0x3bca93});}function handleQuery(_0x3e34a0){logger['info'](_0x3e34a0);return db[_0xdda2('0x5d')][_0xdda2('0x5e')](_0x3e34a0)[_0xdda2('0x5f')](function(_0x886cb7){results[_0xdda2('0x1c')](_0x886cb7);})[_0xdda2('0x60')](function(_0x71e559){logger['error'](_0x71e559[_0xdda2('0x61')]);});}function updateTzCampaigns(_0x396a64){return new Promise(function(_0x18ffe0,_0x462790){var _0x3c69dd=squel['select']()[_0xdda2('0x42')]([_0xdda2('0x62'),_0xdda2('0x63')])['from'](_0xdda2('0x64'))[_0xdda2('0x18')](_0xdda2('0x65'),null,_0xdda2('0x66'))[_0xdda2('0x16')](_0xdda2('0x67')+_0x396a64);db['sequelize'][_0xdda2('0x5e')](_0x3c69dd[_0xdda2('0x49')]())['spread'](function(_0x69a800){var _0x13fc4f=[];for(var _0x1e287e=0x0;_0x1e287e<_0x69a800['length'];_0x1e287e++){_0x13fc4f[_0xdda2('0x1c')](getTimezoneData(_0x69a800[_0x1e287e],tmp_campaigns));}BPromise['all'](_0x13fc4f)['then'](function(){_0x18ffe0({'val':0x1});});})[_0xdda2('0x60')](function(_0x1175aa){logger[_0xdda2('0x68')](_0x1175aa['message']);_0x18ffe0({'val':0x0});});});}function updateTzVoiceQueues(_0xe90d07){return new Promise(function(_0x12a49b,_0x40c673){var _0x33c5a8=squel[_0xdda2('0x12')]()[_0xdda2('0x42')](['voice_queues.id',_0xdda2('0x69')])[_0xdda2('0x15')](_0xdda2('0x6a'))[_0xdda2('0x18')](_0xdda2('0x6b'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xdda2('0x16')]('voice_queues_has_cm_lists.CmListId='+_0xe90d07);db[_0xdda2('0x5d')][_0xdda2('0x5e')](_0x33c5a8[_0xdda2('0x49')]())['spread'](function(_0x1e083f){var _0x135323=[];for(var _0x3cffca=0x0;_0x3cffca<_0x1e083f[_0xdda2('0x1b')];_0x3cffca++){_0x135323[_0xdda2('0x1c')](getTimezoneData(_0x1e083f[_0x3cffca],tmp_voice_queues));}BPromise[_0xdda2('0x1d')](_0x135323)['then'](function(){_0x12a49b({'val':0x1});});})[_0xdda2('0x60')](function(_0x3190a4){logger[_0xdda2('0x68')](_0x3190a4[_0xdda2('0x61')]);_0x12a49b({'val':0x0});});});}function getTimezoneData(_0xe614ef,_0x33e3f9){return new Promise(function(_0x5059c1,_0x3248fe){var _0x1c1d8e=shared[_0xdda2('0x6c')];var _0x25b8c9=_0x1c1d8e[_0xe614ef['dialTimezone']];if(_[_0xdda2('0x20')](_0x25b8c9)){_0x5059c1({'ret':0x1});}else{var _0x848e20=_0x25b8c9['utcOffset'];var _0x330636=squel['insert']()[_0xdda2('0x2f')](_0x33e3f9)['set']('id',_0xe614ef['id'])['set'](_0xdda2('0x6d'),_0x848e20)[_0xdda2('0x6e')](_0xdda2('0x6f'),_0xe614ef[_0xdda2('0x6f')])[_0xdda2('0x49')]();return db['sequelize']['query'](_0x330636)[_0xdda2('0x5f')](function(_0x504d30){_0x5059c1({'ret':0x1});})[_0xdda2('0x60')](function(_0x3e64ee){logger[_0xdda2('0x68')](_0x3e64ee[_0xdda2('0x61')]);_0x3248fe({'ret':0x1});});}});}function handleTZQuery(_0x519966){logger[_0xdda2('0x59')](_0x519966);return db[_0xdda2('0x5d')]['query'](_0x519966)[_0xdda2('0x5f')](function(_0x16af22){})['catch'](function(_0x8d863){logger[_0xdda2('0x68')](_0x8d863[_0xdda2('0x61')]);});}function main(_0x18b569,_0x4ddd29,_0xec4584,_0x52a8dc){logger[_0xdda2('0x59')](_0xdda2('0x70'),_0x18b569,JSON[_0xdda2('0x71')](_0x4ddd29));process[_0xdda2('0x72')](_0xdda2('0x73'));var _0x1421fd=_0x4ddd29[_0xdda2('0x74')];var _0x247b01=_['clone'](_0x1421fd);var _0x1b5271=_0x4ddd29[_0xdda2('0x75')];var _0x3db41b=path[_0xdda2('0x18')](config['root'],_0xdda2('0x76'),_0x1b5271+_0xdda2('0x77'));hasTZ=_[_0xdda2('0x53')](_0x1421fd)[_0xdda2('0x78')](_0xdda2('0x6f'));var _0x42b800=_['keys'](_0x1421fd)[_0xdda2('0x18')]();logger[_0xdda2('0x59')]('header',_0x42b800);db['ContactItemType'][_0xdda2('0x79')]({'raw':!![],'attributes':['id',_0xdda2('0x7a')]})[_0xdda2('0x1a')](function(_0x3f4cea){for(var _0x5ae21d=0x0;_0x5ae21d<_0x3f4cea[_0xdda2('0x1b')];_0x5ae21d++){if(_0x3f4cea[_0x5ae21d][_0xdda2('0x7a')]in _0x1421fd){contactItemTypes[_0xdda2('0x1c')](_0x3f4cea[_0x5ae21d]);delete _0x247b01[_0x3f4cea[_0x5ae21d]['name']];hasAdditionalPhones=!![];}for(var _0x14647a in _0x1421fd){if(_0x3f4cea[_0x5ae21d][_0xdda2('0x7a')]+_0xdda2('0x7b')===_0x14647a){phoneDescriptions[_0xdda2('0x1c')]({'itemTypeId':_0x3f4cea[_0x5ae21d]['id'],'description':_0x14647a});delete _0x247b01[_0x14647a];}}}if(hasAdditionalPhones)_0x247b01['AdditionalPhones']='';var _0x277e1e=_[_0xdda2('0x53')](_0x247b01)[_0xdda2('0x18')]();logger[_0xdda2('0x59')](_0xdda2('0x7c'),_0x277e1e);fs[_0xdda2('0x7d')](_0x3db41b,_0x277e1e+'\x0a');Papa[_0xdda2('0x7e')](fs['createReadStream'](_0x18b569),{'header':!![],'skipEmptyLines':!![],'step':function(_0x49b598,_0x31efa7){try{for(var _0xb09826=0x0,_0x5e98c5=[];_0xb09826<_0x49b598[_0xdda2('0x7f')][_0xdda2('0x1b')];_0xb09826++){stats[_0xdda2('0x80')]+=0x1;if(_0x49b598[_0xdda2('0x5b')][_0xb09826]){handleError(_0x49b598['data'][_0xb09826],_0x49b598[_0xdda2('0x5b')][_0xb09826]);}else{var _0x45d03b=[];var _0x356bae=[];var _0x1b8633={};for(var _0x1bd109 in _0x1421fd){let _0x462afd=contactItemTypes[_0xdda2('0x81')](_0x1a63c5=>_0x1a63c5[_0xdda2('0x7a')]===_0x1bd109);let _0x2bf7cc=contactItemTypes[_0xdda2('0x81')](_0x108d77=>_0x108d77[_0xdda2('0x7a')]+'_description'===_0x1bd109);if(_[_0xdda2('0x20')](_0x462afd)&&_['isNil'](_0x2bf7cc)){if(_0x1421fd[_0xdda2('0x82')](_0x1bd109)){if(_0x49b598[_0xdda2('0x7f')][_0xb09826][_0x1421fd[_0x1bd109]]){var _0x325d5b=_[_0xdda2('0x83')](_0x49b598[_0xdda2('0x7f')][_0xb09826][_0x1421fd[_0x1bd109]]['replace'](/"/g,'\x27'));switch(_0x1bd109){case'scheduledat':var _0x469259=moment(_0x325d5b,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x469259[_0xdda2('0x84')]()){_0x5e98c5[_0xdda2('0x1c')]('\x22'+_0x325d5b+'\x22');}else{_0x45d03b[_0xdda2('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x5ad758=parseInt(_0x325d5b);_0x325d5b=_[_0xdda2('0x85')](_0x5ad758)||_0x5ad758<0x0||_0x5ad758>0x4?_0x52a8dc?0x3:0x2:_0x5ad758;_0x5e98c5['push']('\x22'+_0x325d5b+'\x22');break;case _0xdda2('0x38'):var _0x3f12d0=parseInt(_0x325d5b);if(_['isNumber'](_0x3f12d0)&&_[_0xdda2('0x78')](_0xec4584,_0x3f12d0)){_0x5e98c5[_0xdda2('0x1c')]('\x22'+_0x3f12d0+'\x22');}else{_0x45d03b[_0xdda2('0x1c')](_0xdda2('0x86'));}break;case _0xdda2('0x87'):if(isEmail(_0x325d5b)){_0x5e98c5[_0xdda2('0x1c')]('\x22'+_0x325d5b+'\x22');}else{_0x45d03b[_0xdda2('0x1c')](_0xdda2('0x88'));}break;case _0xdda2('0x89'):var _0x56d89e=moment(_0x325d5b,_0xdda2('0x8a'),!![]);if(_0x56d89e[_0xdda2('0x84')]()){_0x5e98c5[_0xdda2('0x1c')]('\x22'+_0x325d5b+'\x22');}else{_0x45d03b['push'](_0xdda2('0x8b'));}break;case _0xdda2('0x6f'):var _0xc8ba23=shared[_0xdda2('0x6c')];var _0x4f611e=_0xc8ba23[_0x325d5b];if(!_[_0xdda2('0x20')](_0x4f611e)){var _0x5f2729=_0x4f611e[_0xdda2('0x8c')];_0x5e98c5[_0xdda2('0x1c')]('\x22'+_0x325d5b+'\x22');_0x5e98c5[_0xdda2('0x1c')]('\x22'+_0x5f2729+'\x22');}break;default:_0x5e98c5['push']('\x22'+_0x325d5b+'\x22');}}else{switch(_0x1bd109){case _0xdda2('0x8d'):case'phone':_0x45d03b['push'](_0x1bd109+_0xdda2('0x8e'));break;default:_0x5e98c5[_0xdda2('0x1c')]('\x22\x22');}}}}else{var _0x1f628e='';if(!_['isNil'](_0x462afd)){if(!_0x1b8633['hasOwnProperty'](_0x462afd['id'])){if(!_[_0xdda2('0x20')](_0x49b598[_0xdda2('0x7f')][_0xb09826][_0x1421fd[_0x1bd109]])){var _0x325d5b=_[_0xdda2('0x83')](_0x49b598[_0xdda2('0x7f')][_0xb09826][_0x1421fd[_0x1bd109]][_0xdda2('0x8f')](/"/g,'\x27'));var _0x369b8a=phoneDescriptions['find'](_0x51b45a=>_0x51b45a[_0xdda2('0x90')]===_0x462afd['id']);if(!_[_0xdda2('0x20')](_0x369b8a)){var _0x26be24=_[_0xdda2('0x83')](_0x49b598[_0xdda2('0x7f')][_0xb09826][_0x1421fd[_0x369b8a[_0xdda2('0x91')]]][_0xdda2('0x8f')](/"/g,'\x27'));if(!_[_0xdda2('0x20')](_0x26be24))_0x325d5b=_0x325d5b+'§'+_0x26be24;}if(_0x1f628e=='')_0x1f628e=_0x325d5b;else _0x1f628e+='|'+_0x325d5b;}_0x356bae[_0xdda2('0x1c')](_0x462afd['id']+':'+_0x1f628e);_0x1b8633[_0x462afd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5e98c5[_0xdda2('0x1c')]('\x22'+_0x356bae[_0xdda2('0x18')](';')+'\x22');}if(_0x45d03b[_0xdda2('0x1b')]){handleError(_0x49b598['data'][_0xb09826],{'code':_0xdda2('0x92'),'message':_0x45d03b[_0xdda2('0x18')]()});}else{fs[_0xdda2('0x93')](_0x3db41b,_0x5e98c5[_0xdda2('0x18')]()+'\x0a');}_0x5e98c5=[];}if(!(stats['rows']%0xc8)){socket[_0xdda2('0x94')](_0xdda2('0x95')+_0x1b5271,stats);stats[_0xdda2('0x5b')]=[];}}if(stopped){logger[_0xdda2('0x59')]('Abort\x20parser');_0x31efa7['abort']();}}catch(_0x56a243){handleError(_0x49b598[_0xdda2('0x7f')][_0xb09826],{'code':_0xdda2('0x96'),'message':_0x56a243['message']});logger[_0xdda2('0x68')]('step',_0x56a243[_0xdda2('0x61')]);}},'complete':function(){try{var _0x36abe9=[];var _0x26eaaa=[];var _0x4f6812=_0xdda2('0x39');if(_0x4ddd29[_0xdda2('0x97')]&&_0x4ddd29[_0xdda2('0x97')][_0xdda2('0x1b')]){_0x4f6812='cm_contacts_'+_0x1b5271;_0x36abe9[_0xdda2('0x1c')](_0xdda2('0x98')+_0x4f6812+_0xdda2('0x99'));}tmp_campaigns=_0xdda2('0x9a')+_0x1b5271;tmp_voice_queues='voice_queues_'+_0x1b5271;_0x26eaaa[_0xdda2('0x1c')](_0xdda2('0x98')+tmp_campaigns+_0xdda2('0x9b'));_0x26eaaa[_0xdda2('0x1c')](_0xdda2('0x98')+tmp_voice_queues+_0xdda2('0x9b'));BPromise[_0xdda2('0x9c')](_0x26eaaa,handleTZQuery)[_0xdda2('0x1a')](function(_0x434876){updateTzCampaigns(_0x4ddd29['ListId'])['then'](function(_0x1ccc8a){updateTzVoiceQueues(_0x4ddd29[_0xdda2('0x34')])[_0xdda2('0x1a')](function(_0x18839f){if(hasTZ)_0x277e1e=_0x277e1e[_0xdda2('0x8f')](_0xdda2('0x6f'),_0xdda2('0x9d'));var _0x1737ff=util['format'](_0xdda2('0x9e'),_0x3db41b,_0x4f6812,_0x277e1e,_0x4ddd29[_0xdda2('0x34')],_0x4ddd29['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x1421fd['scheduledat'])){_0x1737ff+=_0xdda2('0x9f');}_0x36abe9[_0xdda2('0x1c')](_0x1737ff);if(_0x4ddd29[_0xdda2('0x97')]&&_0x4ddd29[_0xdda2('0x97')]['length']){_0x36abe9[_0xdda2('0x1c')](insertCmContact(_0x4ddd29[_0xdda2('0x34')],_0x4f6812,_0x4ddd29['duplicates'],_0x1421fd));_0x36abe9['push'](_0xdda2('0xa0')+_0x4f6812+';');}BPromise['each'](_0x36abe9,handleQuery)['then'](function(_0x54bf8a){BPromise[_0xdda2('0x1d')]([handleAdditionalPhones()])[_0xdda2('0x1a')](function(){_0x36abe9=[];for(var _0x544bc5=0x0;_0x544bc5\x20\x20');}var _0x3baddb=path[_0xdda2('0x18')](config[_0xdda2('0xac')],_0xdda2('0x76'),process[_0xdda2('0xab')][0x2]);if(!fs[_0xdda2('0xad')](_0x3baddb)){throw new Error(_0xdda2('0xae'));}var _0x58faf9={};try{_0x58faf9=JSON[_0xdda2('0x7e')](process['argv'][0x3]);if(!_0x58faf9[_0xdda2('0x74')]){throw new Error(_0xdda2('0xaf'));}if(!_0x58faf9[_0xdda2('0x74')][_0xdda2('0x14')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x58faf9[_0xdda2('0x74')][_0xdda2('0x8d')]){throw new Error(_0xdda2('0xb0'));}var _0x3e1975=0x0;if(_0x58faf9[_0xdda2('0x74')][_0xdda2('0x38')]){_0x3e1975=0x1;}if(!_0x58faf9[_0xdda2('0x34')]){throw new Error(_0xdda2('0xb1'));}}catch(_0x2ed733){throw new Error('body\x20id\x20mandatory');}var _0x536485=[];try{_0x536485=_['map'](JSON[_0xdda2('0x7e')](process[_0xdda2('0xab')][0x4]),'id');}catch(_0xe1b2d3){logger[_0xdda2('0x59')]('No\x20agent\x20available');}main(_0x3baddb,_0x58faf9,_0x536485,_0x3e1975);}validate();process['on'](_0xdda2('0xb2'),handleStop);process['on'](_0xdda2('0xb3'),handleUncaughtException); \ No newline at end of file +var _0x245d=['cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper','toString','cm_contacts.phone','cm_contacts.updatedAt','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','recallme','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','insert','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','error','exit','sequelize','query','spread','catch','message','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','all','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','errors','find','_description','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','\x20not\x20specified','itemTypeId','description','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','CREATE\x20TABLE\x20','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','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','bluebird','squel','ioredis','../../../config/environment','../../../config/environment/shared','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','length','push','then','split','isNil','CmContactHasItem','update','PHONE','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','select','fields','.CmListId'];(function(_0x238817,_0x4a531e){var _0x4aa42c=function(_0x28846e){while(--_0x28846e){_0x238817['push'](_0x238817['shift']());}};_0x4aa42c(++_0x4a531e);}(_0x245d,0x7e));var _0xd245=function(_0x1c400f,_0x10bec0){_0x1c400f=_0x1c400f-0x0;var _0x4d00c6=_0x245d[_0x1c400f];return _0x4d00c6;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xd245('0x0'));var Papa=require(_0xd245('0x1'));var util=require(_0xd245('0x2'));var BPromise=require(_0xd245('0x3'));var moment=require('moment');var squel=require(_0xd245('0x4'));var Redis=require(_0xd245('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xd245('0x6'));var shared=require(_0xd245('0x7'));var logger=require('../../../config/logger')(_0xd245('0x8'));config[_0xd245('0x9')]=_['defaults'](config[_0xd245('0x9')],{'host':_0xd245('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd245('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xd245('0xb')](_0xd245('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xd245('0xb')](_0xd245('0xc'));function isEmail(_0x399f16){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))*$/[_0xd245('0xd')](_0x399f16);}function selectNotIn(_0x409bd3,_0x5dba1e,_0x4a3bae,_0x4dc1d0,_0x34f23b){return squel['select']()[_0xd245('0xe')](_0xd245('0xf'))[_0xd245('0x10')](_0x4dc1d0)[_0xd245('0x11')](_0x5dba1e,null,_0x5dba1e+_0xd245('0x12')+_0x4dc1d0+'.'+_0x4a3bae)['where'](_0x4dc1d0+'.'+_0x4a3bae+_0xd245('0x13')+_0x409bd3+'.'+_0x4a3bae)[_0xd245('0x14')](_0x5dba1e+_0xd245('0x15')+_0x34f23b[_0xd245('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x11cf7c,_0x39a716){promisesAdditionalPhones=[];return db['CmContact'][_0xd245('0x16')]({'raw':!![],'attributes':['id',_0xd245('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x44a3f9){if(_0x44a3f9!==null){var _0x3756bf=[];for(var _0x527dc=0x0;_0x527dc<_0x44a3f9[_0xd245('0x18')];_0x527dc++){var _0xd3b1e1=_0x44a3f9[_0x527dc];_0x3756bf[_0xd245('0x19')](insertAdditionalPhones(_0xd3b1e1));}}Promise['all'](_0x3756bf)[_0xd245('0x1a')](function(){_0x11cf7c({'val':0x1});});});});}function insertAdditionalPhones(_0x407c94){return new Promise(function(_0x2c60ec,_0x43504e){var _0x5ccbd2=_0x407c94[_0xd245('0x17')];var _0x32ccb3=_0x5ccbd2[_0xd245('0x1b')](';');var _0x4be62f=[];orderBy=0x0;for(var _0x595c56=0x0;_0x595c56<_0x32ccb3[_0xd245('0x18')];_0x595c56++){_0x4be62f[_0xd245('0x19')](splitAdditionalPhone(_0x407c94['id'],_0x32ccb3[_0x595c56]));}Promise['all'](_0x4be62f)['then'](function(){_0x2c60ec({'val':_0x32ccb3[_0xd245('0x18')]});});});}function splitAdditionalPhone(_0x11566d,_0x582aae){return new Promise(function(_0x5777d2,_0x5a49c3){var _0x57540a=_0x582aae['split'](':');var _0x587f30=_0x57540a[0x0];var _0x4d302d=_0x57540a[0x1];if(!_[_0xd245('0x1c')](_0x4d302d)){var _0x2e73cd=_0x4d302d[_0xd245('0x1b')]('|');var _0x121abf=[];for(var _0x376344=0x0;_0x376344<_0x2e73cd[_0xd245('0x18')];_0x376344++){if(_0x2e73cd[_0x376344]!==''){var _0x21d668=_['filter'](promisesAdditionalPhones,{'contactId':_0x11566d,'phone':_0x2e73cd[_0x376344]});if(_0x21d668[_0xd245('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x11566d,'contactTypeId':_0x587f30,'phone':_0x2e73cd[_0x376344],'orderBy':orderBy});}}}_0x5777d2({'ok':0x1});}else _0x5777d2({'res':0x0});});}function createAdditionalPhone(_0x41c616,_0x2c6b0a,_0x5722f2,_0x2cba34){var _0x5b9e98='';var _0x24c8e3='';var _0x547ef0=_0x5722f2[_0xd245('0x1b')]('§');_0x5b9e98=_0x547ef0[0x0];if(_0x547ef0['length']==0x2)_0x24c8e3=_0x547ef0[0x1];return new Promise(function(_0x4e0922,_0x5490c4){return db[_0xd245('0x1d')]['findOne']({'where':{'CmContactId':_0x41c616,'item':_0x5b9e98}})[_0xd245('0x1a')](function(_0x1c4279){if(_0x1c4279){return db[_0xd245('0x1d')][_0xd245('0x1e')]({'ItemTypeId':_0x2c6b0a,'description':_0x24c8e3,'OrderBy':_0x2cba34},{'where':{'CmContactId':_0x41c616,'item':_0x5b9e98}})['then'](function(_0x58d197){_0x4e0922({'res':'updated'});});}else{return db[_0xd245('0x1d')]['create']({'CmContactId':_0x41c616,'item':_0x5b9e98,'description':_0x24c8e3,'ItemTypeId':_0x2c6b0a,'OrderBy':_0x2cba34,'ItemClass':_0xd245('0x1f')})[_0xd245('0x1a')](function(_0x47dd27){_0x4e0922({'res':'inserted'});});}});});}function insertCmHopper(_0x7bad,_0x48faee,_0x328446,_0xe77911,_0x2af93a){var _0x38f7a1=['cm_contacts.phone',_0xd245('0x20'),_0xd245('0x21'),_0xd245('0x22'),_0x48faee+'.'+_0xe77911,_0xd245('0x23'),'cm_contacts.updatedAt','cm_contacts.priority',_0xd245('0x24'),'\x22'+_0x2af93a+'\x22'];return squel['insert']()[_0xd245('0x25')]('cm_hopper')[_0xd245('0x26')](['phone',_0xd245('0x27'),_0xd245('0x28'),_0xd245('0x29'),_0xe77911,_0xd245('0x2a'),_0xd245('0x2b'),_0xd245('0x2c'),'UserId','recallme'],squel[_0xd245('0x2d')]()[_0xd245('0x2e')](_0x38f7a1)[_0xd245('0x10')](_0x48faee)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x48faee+_0xd245('0x2f'))[_0xd245('0x11')](_0x328446,null,_0x328446+_0xd245('0x12')+_0x48faee+'.'+_0xe77911)['where'](_0x48faee+'.CmListId\x20=\x20?',_0x7bad)['where'](_0xd245('0x30'),NOW)[_0xd245('0x14')](_0xd245('0x31'),selectNotIn(_0x48faee,_0x328446,_0xe77911,'cm_hopper',[_0xd245('0x32'),_0xd245('0x33')]))[_0xd245('0x14')](_0xd245('0x31'),selectNotIn(_0x48faee,_0x328446,_0xe77911,_0xd245('0x34'),[_0xd245('0x32')])))[_0xd245('0x35')]();}function insertCmHopperBlack(_0x4420dd,_0x4e772a,_0xac4808,_0x456b72){var _0x5363a1=[_0xd245('0x36'),_0xd245('0x21'),_0xd245('0x22'),_0x4e772a+'.'+_0x456b72,_0xd245('0x23'),_0xd245('0x37')];return squel['insert']()[_0xd245('0x25')]('cm_hopper_black')[_0xd245('0x26')](['phone',_0xd245('0x28'),_0xd245('0x29'),_0x456b72,_0xd245('0x2a'),_0xd245('0x2b')],squel['select']()['fields'](_0x5363a1)[_0xd245('0x10')](_0x4e772a)[_0xd245('0x11')](_0xd245('0x38'),null,_0xd245('0x39')+_0x4e772a+'.CmListId')[_0xd245('0x11')](_0xac4808,null,_0xac4808+_0xd245('0x12')+_0x4e772a+'.'+_0x456b72)[_0xd245('0x14')](_0x4e772a+_0xd245('0x3a'),_0x4420dd)[_0xd245('0x14')](_0xd245('0x30'),NOW)[_0xd245('0x14')](_0xd245('0x31'),squel[_0xd245('0x2d')]()[_0xd245('0xe')](_0xd245('0xf'))[_0xd245('0x10')](_0xd245('0x3b'))[_0xd245('0x14')]('ListId\x20=\x20?',_0x4420dd)[_0xd245('0x14')](_0x456b72+'\x20=\x20'+_0x4e772a+'.'+_0x456b72)))[_0xd245('0x35')]();}function insertTzCmHopper(_0x43f562,_0x267c47,_0xb6bcf4,_0x3559e2,_0x4202d3,_0x35de48){var _0x35e72c=['cm_contacts.phone',_0xd245('0x3c')+_0x35de48+_0xd245('0x3d'),_0xd245('0x21'),_0xd245('0x22'),_0x267c47+'.'+_0x3559e2,_0xd245('0x23'),_0xd245('0x37'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x4202d3+'\x22'];var _0x8aaab8=squel['insert']()[_0xd245('0x25')](_0xd245('0x34'))[_0xd245('0x26')]([_0xd245('0xf'),_0xd245('0x27'),_0xd245('0x28'),_0xd245('0x29'),_0x3559e2,_0xd245('0x2a'),_0xd245('0x2b'),_0xd245('0x2c'),'UserId',_0xd245('0x3e')],squel[_0xd245('0x2d')]()[_0xd245('0x2e')](_0x35e72c)[_0xd245('0x10')](_0x267c47)[_0xd245('0x11')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x267c47+_0xd245('0x2f'))[_0xd245('0x11')](_0xb6bcf4,null,_0xb6bcf4+'.id\x20=\x20'+_0x267c47+'.'+_0x3559e2)[_0xd245('0x11')](_0x35de48,null,_0x35de48+_0xd245('0x12')+_0x267c47+'.'+_0x3559e2)[_0xd245('0x14')](_0x267c47+_0xd245('0x3a'),_0x43f562)[_0xd245('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xd245('0x14')](_0xd245('0x31'),selectNotIn(_0x267c47,_0xb6bcf4,_0x3559e2,_0xd245('0x34'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xd245('0x14')](_0xd245('0x31'),selectNotIn(_0x267c47,_0xb6bcf4,_0x3559e2,'cm_hopper',[_0xd245('0x32')])))[_0xd245('0x35')]();return _0x8aaab8;}function insertTzCmHopperBlack(_0x14740d,_0x4cf163,_0x27f55a,_0x307fea){var _0x2605eb=['cm_contacts.phone','cm_contacts.id',_0xd245('0x22'),_0x4cf163+'.'+_0x307fea,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()[_0xd245('0x25')](_0xd245('0x3b'))[_0xd245('0x26')]([_0xd245('0xf'),_0xd245('0x28'),_0xd245('0x29'),_0x307fea,'createdAt',_0xd245('0x2b')],squel[_0xd245('0x2d')]()[_0xd245('0x2e')](_0x2605eb)[_0xd245('0x10')](_0x4cf163)[_0xd245('0x11')](_0xd245('0x38'),null,_0xd245('0x39')+_0x4cf163+_0xd245('0x2f'))[_0xd245('0x11')](_0x27f55a,null,_0x27f55a+_0xd245('0x12')+_0x4cf163+'.'+_0x307fea)[_0xd245('0x14')](_0x4cf163+_0xd245('0x3a'),_0x14740d)[_0xd245('0x14')](_0xd245('0x30'),NOW)[_0xd245('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xd245('0x2d')]()[_0xd245('0xe')](_0xd245('0xf'))[_0xd245('0x10')]('cm_hopper_black')[_0xd245('0x14')](_0xd245('0x3f'),_0x14740d)[_0xd245('0x14')](_0x307fea+_0xd245('0x13')+_0x4cf163+'.'+_0x307fea)))[_0xd245('0x35')]();}function insertCmHopperAdditionalPhones(_0x4b365e){var _0x5dcb5f=[_0xd245('0x40'),_0xd245('0x41'),'cm_contact_has_items.OrderBy',_0xd245('0x42'),_0xd245('0x43')];return squel[_0xd245('0x44')]()['into']('cm_hopper_additional_phones')[_0xd245('0x26')]([_0xd245('0x45'),_0xd245('0xf'),'OrderBy',_0xd245('0x2a'),_0xd245('0x2b')],squel[_0xd245('0x2d')]()[_0xd245('0x2e')](_0x5dcb5f)[_0xd245('0x10')](_0xd245('0x34'))[_0xd245('0x11')]('cm_contacts',null,_0xd245('0x46'))[_0xd245('0x11')](_0xd245('0x47'),null,_0xd245('0x48'))[_0xd245('0x14')](_0xd245('0x49'),_0x4b365e)[_0xd245('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xd245('0x35')]();}function insertCmContact(_0x52615e,_0x36f630,_0x15145c,_0x188618){var _0x1f9fa0=_[_0xd245('0x4a')](_[_0xd245('0x4b')](_0x188618),[_0xd245('0x29'),_0xd245('0x4c'),_0xd245('0x2a'),_0xd245('0x2b'),_0xd245('0x4d')]);return squel[_0xd245('0x44')]()[_0xd245('0x25')](_0xd245('0x38'))['fromQuery'](_0x1f9fa0,squel[_0xd245('0x2d')]()[_0xd245('0x2e')](_0x1f9fa0)['from'](_0x36f630)[_0xd245('0x14')]('('+_0x15145c[_0xd245('0x11')](',')+_0xd245('0x4e'),squel[_0xd245('0x2d')]()[_0xd245('0x2e')](_0x15145c)[_0xd245('0x10')]('cm_contacts')[_0xd245('0x14')](_0xd245('0x3f'),_0x52615e)[_0xd245('0x14')]('deletedAt\x20IS\x20NULL'))[_0xd245('0x14')](_0xd245('0x4f'),squel[_0xd245('0x2d')]()[_0xd245('0xe')](_0xd245('0x50'),_0xd245('0x51'))[_0xd245('0x10')](_0x36f630)['group'](_0x15145c[_0xd245('0x11')](','))))['toString']();}function handleStop(){logger[_0xd245('0x52')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xfd9cc6){logger[_0xd245('0x53')](_0xfd9cc6['message']);process[_0xd245('0x54')](0x1);}function handleError(_0x2f3224,_0x5a3bc6){stats['errors'][_0xd245('0x19')]({'name':_0x5a3bc6['code'],'message':_0x5a3bc6['message'],'row':_0x2f3224});}function handleQuery(_0x3ba0dc){logger[_0xd245('0x52')](_0x3ba0dc);return db[_0xd245('0x55')][_0xd245('0x56')](_0x3ba0dc)[_0xd245('0x57')](function(_0x3909bb){results['push'](_0x3909bb);})[_0xd245('0x58')](function(_0x171f65){logger[_0xd245('0x53')](_0x171f65[_0xd245('0x59')]);});}function updateTzCampaigns(_0xbc99e){return new Promise(function(_0x93446b,_0x2cd032){var _0x20d50a=squel[_0xd245('0x2d')]()[_0xd245('0x2e')]([_0xd245('0x5a'),_0xd245('0x5b')])[_0xd245('0x10')](_0xd245('0x5c'))['join'](_0xd245('0x5d'),null,_0xd245('0x5e'))[_0xd245('0x14')](_0xd245('0x5f')+_0xbc99e);db[_0xd245('0x55')][_0xd245('0x56')](_0x20d50a[_0xd245('0x35')]())['spread'](function(_0x2389ca){var _0x8df558=[];for(var _0x17e3ca=0x0;_0x17e3ca<_0x2389ca[_0xd245('0x18')];_0x17e3ca++){_0x8df558[_0xd245('0x19')](getTimezoneData(_0x2389ca[_0x17e3ca],tmp_campaigns));}BPromise[_0xd245('0x60')](_0x8df558)[_0xd245('0x1a')](function(){_0x93446b({'val':0x1});});})[_0xd245('0x58')](function(_0x1b5b3d){logger[_0xd245('0x53')](_0x1b5b3d[_0xd245('0x59')]);_0x93446b({'val':0x0});});});}function updateTzVoiceQueues(_0x297293){return new Promise(function(_0xbc333e,_0x27a245){var _0x2754aa=squel[_0xd245('0x2d')]()[_0xd245('0x2e')]([_0xd245('0x61'),_0xd245('0x62')])[_0xd245('0x10')]('voice_queues')[_0xd245('0x11')](_0xd245('0x63'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xd245('0x14')](_0xd245('0x64')+_0x297293);db['sequelize'][_0xd245('0x56')](_0x2754aa['toString']())[_0xd245('0x57')](function(_0x3b867f){var _0x266ff6=[];for(var _0x10b2d4=0x0;_0x10b2d4<_0x3b867f[_0xd245('0x18')];_0x10b2d4++){_0x266ff6[_0xd245('0x19')](getTimezoneData(_0x3b867f[_0x10b2d4],tmp_voice_queues));}BPromise['all'](_0x266ff6)[_0xd245('0x1a')](function(){_0xbc333e({'val':0x1});});})['catch'](function(_0x2d38b6){logger['error'](_0x2d38b6[_0xd245('0x59')]);_0xbc333e({'val':0x0});});});}function getTimezoneData(_0x1c623b,_0xd0d6e0){return new Promise(function(_0x1b3e45,_0x1ea1ed){var _0x42a623=shared['timezones'];var _0x52e2b8=_0x42a623[_0x1c623b[_0xd245('0x65')]];if(_[_0xd245('0x1c')](_0x52e2b8)){_0x1b3e45({'ret':0x1});}else{var _0x3ef072=_0x52e2b8[_0xd245('0x66')];var _0x1e03e0=squel['insert']()['into'](_0xd0d6e0)[_0xd245('0x67')]('id',_0x1c623b['id'])[_0xd245('0x67')](_0xd245('0x68'),_0x3ef072)[_0xd245('0x67')](_0xd245('0x65'),_0x1c623b[_0xd245('0x65')])[_0xd245('0x35')]();return db[_0xd245('0x55')][_0xd245('0x56')](_0x1e03e0)[_0xd245('0x57')](function(_0x1f792e){_0x1b3e45({'ret':0x1});})['catch'](function(_0x74a2a3){logger[_0xd245('0x53')](_0x74a2a3[_0xd245('0x59')]);_0x1ea1ed({'ret':0x1});});}});}function handleTZQuery(_0x5f2d86){logger[_0xd245('0x52')](_0x5f2d86);return db[_0xd245('0x55')][_0xd245('0x56')](_0x5f2d86)[_0xd245('0x57')](function(_0x4b092c){})[_0xd245('0x58')](function(_0xd478){logger['error'](_0xd478[_0xd245('0x59')]);});}function main(_0x9b2549,_0x6bfffb,_0x5e03ef,_0x298a0f){logger[_0xd245('0x52')](_0xd245('0x69'),_0x9b2549,JSON[_0xd245('0x6a')](_0x6bfffb));process[_0xd245('0x6b')](_0xd245('0x6c'));var _0x4a6361=_0x6bfffb[_0xd245('0x6d')];var _0x16c793=_[_0xd245('0x6e')](_0x4a6361);var _0x326400=_0x6bfffb[_0xd245('0x6f')];var _0x573dd3=path[_0xd245('0x11')](config['root'],_0xd245('0x70'),_0x326400+_0xd245('0x71'));hasTZ=_[_0xd245('0x4b')](_0x4a6361)[_0xd245('0x72')](_0xd245('0x65'));var _0x40a148=_[_0xd245('0x4b')](_0x4a6361)['join']();logger['info'](_0xd245('0x73'),_0x40a148);db[_0xd245('0x74')][_0xd245('0x16')]({'raw':!![],'attributes':['id',_0xd245('0x75')]})[_0xd245('0x1a')](function(_0x5f2c5e){for(var _0x1e7de3=0x0;_0x1e7de3<_0x5f2c5e[_0xd245('0x18')];_0x1e7de3++){if(_0x5f2c5e[_0x1e7de3][_0xd245('0x75')]in _0x4a6361){contactItemTypes[_0xd245('0x19')](_0x5f2c5e[_0x1e7de3]);delete _0x16c793[_0x5f2c5e[_0x1e7de3][_0xd245('0x75')]];hasAdditionalPhones=!![];}for(var _0x444a1c in _0x4a6361){if(_0x5f2c5e[_0x1e7de3][_0xd245('0x75')]+'_description'===_0x444a1c){phoneDescriptions['push']({'itemTypeId':_0x5f2c5e[_0x1e7de3]['id'],'description':_0x444a1c});delete _0x16c793[_0x444a1c];}}}if(hasAdditionalPhones)_0x16c793['AdditionalPhones']='';var _0x275d47=_['keys'](_0x16c793)[_0xd245('0x11')]();logger['info'](_0xd245('0x73'),_0x275d47);fs[_0xd245('0x76')](_0x573dd3,_0x275d47+'\x0a');Papa[_0xd245('0x77')](fs[_0xd245('0x78')](_0x9b2549),{'header':!![],'skipEmptyLines':!![],'step':function(_0xa40587,_0x2c2d5b){try{for(var _0xcb63d9=0x0,_0x34fe53=[];_0xcb63d9<_0xa40587[_0xd245('0x79')]['length'];_0xcb63d9++){stats[_0xd245('0x7a')]+=0x1;if(_0xa40587[_0xd245('0x7b')][_0xcb63d9]){handleError(_0xa40587['data'][_0xcb63d9],_0xa40587[_0xd245('0x7b')][_0xcb63d9]);}else{var _0x55d044=[];var _0x577162=[];var _0x421624={};for(var _0x443251 in _0x4a6361){let _0x63f251=contactItemTypes[_0xd245('0x7c')](_0x32240f=>_0x32240f['name']===_0x443251);let _0x57f369=contactItemTypes[_0xd245('0x7c')](_0x134b69=>_0x134b69[_0xd245('0x75')]+_0xd245('0x7d')===_0x443251);if(_[_0xd245('0x1c')](_0x63f251)&&_[_0xd245('0x1c')](_0x57f369)){if(_0x4a6361[_0xd245('0x7e')](_0x443251)){if(_0xa40587[_0xd245('0x79')][_0xcb63d9][_0x4a6361[_0x443251]]){var _0x390cd1=_[_0xd245('0x7f')](_0xa40587['data'][_0xcb63d9][_0x4a6361[_0x443251]][_0xd245('0x80')](/"/g,'\x27'));switch(_0x443251){case _0xd245('0x27'):var _0x1c0c3a=moment(_0x390cd1,_0xd245('0xc'),!![]);if(_0x1c0c3a[_0xd245('0x81')]()){_0x34fe53[_0xd245('0x19')]('\x22'+_0x390cd1+'\x22');}else{_0x55d044[_0xd245('0x19')](_0xd245('0x82'));}break;case _0xd245('0x2c'):var _0x3570cb=parseInt(_0x390cd1);_0x390cd1=_['isNaN'](_0x3570cb)||_0x3570cb<0x0||_0x3570cb>0x4?_0x298a0f?0x3:0x2:_0x3570cb;_0x34fe53[_0xd245('0x19')]('\x22'+_0x390cd1+'\x22');break;case _0xd245('0x83'):var _0x140a0f=parseInt(_0x390cd1);if(_['isNumber'](_0x140a0f)&&_[_0xd245('0x72')](_0x5e03ef,_0x140a0f)){_0x34fe53['push']('\x22'+_0x140a0f+'\x22');}else{_0x55d044['push']('agent\x20not\x20exists');}break;case _0xd245('0x84'):if(isEmail(_0x390cd1)){_0x34fe53[_0xd245('0x19')]('\x22'+_0x390cd1+'\x22');}else{_0x55d044[_0xd245('0x19')](_0xd245('0x85'));}break;case _0xd245('0x86'):var _0x2930b4=moment(_0x390cd1,_0xd245('0x87'),!![]);if(_0x2930b4['isValid']()){_0x34fe53[_0xd245('0x19')]('\x22'+_0x390cd1+'\x22');}else{_0x55d044['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xd245('0x65'):var _0x428a3a=shared['timezones'];var _0xd92062=_0x428a3a[_0x390cd1];if(!_[_0xd245('0x1c')](_0xd92062)){var _0x26fe62=_0xd92062['utcOffset'];_0x34fe53[_0xd245('0x19')]('\x22'+_0x390cd1+'\x22');_0x34fe53[_0xd245('0x19')]('\x22'+_0x26fe62+'\x22');}break;default:_0x34fe53['push']('\x22'+_0x390cd1+'\x22');}}else{switch(_0x443251){case'firstName':case _0xd245('0xf'):_0x55d044[_0xd245('0x19')](_0x443251+_0xd245('0x88'));break;default:_0x34fe53['push']('\x22\x22');}}}}else{var _0x210bd7='';if(!_[_0xd245('0x1c')](_0x63f251)){if(!_0x421624[_0xd245('0x7e')](_0x63f251['id'])){if(!_[_0xd245('0x1c')](_0xa40587[_0xd245('0x79')][_0xcb63d9][_0x4a6361[_0x443251]])){var _0x390cd1=_[_0xd245('0x7f')](_0xa40587[_0xd245('0x79')][_0xcb63d9][_0x4a6361[_0x443251]][_0xd245('0x80')](/"/g,'\x27'));var _0x277a8b=phoneDescriptions['find'](_0x49bfe3=>_0x49bfe3[_0xd245('0x89')]===_0x63f251['id']);if(!_['isNil'](_0x277a8b)){var _0x5c8f9c=_[_0xd245('0x7f')](_0xa40587[_0xd245('0x79')][_0xcb63d9][_0x4a6361[_0x277a8b[_0xd245('0x8a')]]][_0xd245('0x80')](/"/g,'\x27'));if(!_[_0xd245('0x1c')](_0x5c8f9c))_0x390cd1=_0x390cd1+'§'+_0x5c8f9c;}if(_0x210bd7=='')_0x210bd7=_0x390cd1;else _0x210bd7+='|'+_0x390cd1;}_0x577162[_0xd245('0x19')](_0x63f251['id']+':'+_0x210bd7);_0x421624[_0x63f251['id']]=0x1;}}}}if(hasAdditionalPhones){_0x34fe53['push']('\x22'+_0x577162[_0xd245('0x11')](';')+'\x22');}if(_0x55d044['length']){handleError(_0xa40587['data'][_0xcb63d9],{'code':'SystemRow','message':_0x55d044['join']()});}else{fs['appendFileSync'](_0x573dd3,_0x34fe53[_0xd245('0x11')]()+'\x0a');}_0x34fe53=[];}if(!(stats[_0xd245('0x7a')]%0xc8)){socket[_0xd245('0x8b')](_0xd245('0x8c')+_0x326400,stats);stats['errors']=[];}}if(stopped){logger[_0xd245('0x52')](_0xd245('0x8d'));_0x2c2d5b[_0xd245('0x8e')]();}}catch(_0x561e61){handleError(_0xa40587[_0xd245('0x79')][_0xcb63d9],{'code':_0xd245('0x8f'),'message':_0x561e61['message']});logger[_0xd245('0x53')]('step',_0x561e61[_0xd245('0x59')]);}},'complete':function(){try{var _0x172dff=[];var _0x346471=[];var _0x5ef5c3=_0xd245('0x38');if(_0x6bfffb['duplicates']&&_0x6bfffb[_0xd245('0x90')][_0xd245('0x18')]){_0x5ef5c3=_0xd245('0x91')+_0x326400;_0x172dff[_0xd245('0x19')]('CREATE\x20TABLE\x20'+_0x5ef5c3+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xd245('0x92')+_0x326400;tmp_voice_queues='voice_queues_'+_0x326400;_0x346471[_0xd245('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xd245('0x93'));_0x346471[_0xd245('0x19')](_0xd245('0x94')+tmp_voice_queues+_0xd245('0x93'));BPromise[_0xd245('0x95')](_0x346471,handleTZQuery)[_0xd245('0x1a')](function(_0x11c720){updateTzCampaigns(_0x6bfffb[_0xd245('0x29')])[_0xd245('0x1a')](function(_0x2b9b3d){updateTzVoiceQueues(_0x6bfffb[_0xd245('0x29')])['then'](function(_0x278612){if(hasTZ)_0x275d47=_0x275d47[_0xd245('0x80')](_0xd245('0x65'),_0xd245('0x96'));var _0x3aa0e3=util[_0xd245('0xb')](_0xd245('0x97'),_0x573dd3,_0x5ef5c3,_0x275d47,_0x6bfffb[_0xd245('0x29')],_0x6bfffb[_0xd245('0x4c')]||null,NOW,NOW);if(_[_0xd245('0x1c')](_0x4a6361[_0xd245('0x27')])){_0x3aa0e3+=',\x20scheduledAt\x20=\x20NOW()';}_0x172dff[_0xd245('0x19')](_0x3aa0e3);if(_0x6bfffb['duplicates']&&_0x6bfffb[_0xd245('0x90')][_0xd245('0x18')]){_0x172dff[_0xd245('0x19')](insertCmContact(_0x6bfffb['ListId'],_0x5ef5c3,_0x6bfffb[_0xd245('0x90')],_0x4a6361));_0x172dff[_0xd245('0x19')](_0xd245('0x98')+_0x5ef5c3+';');}BPromise['each'](_0x172dff,handleQuery)['then'](function(_0x47e4d6){BPromise[_0xd245('0x60')]([handleAdditionalPhones()])[_0xd245('0x1a')](function(){_0x172dff=[];for(var _0x5156d9=0x0;_0x5156d9\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','push','all','then','catch','error','message','AdditionalPhones','split','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','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','cm_contacts.phone','insert','cm_hopper_black','createdAt','field','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','exit','errors','code','sequelize','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','ContactItemType','findAll','name','_description','keys','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x2ff9a4,_0x4e0c70){_0x2ff9a4=_0x2ff9a4-0x0;var _0x38f928=_0x4e2e[_0x2ff9a4];return _0x38f928;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xe4e2('0x0'));var Papa=require(_0xe4e2('0x1'));var util=require(_0xe4e2('0x2'));var BPromise=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var squel=require(_0xe4e2('0x5'));var Redis=require('ioredis');var db=require(_0xe4e2('0x6'))['db'];var config=require(_0xe4e2('0x7'));var logger=require(_0xe4e2('0x8'))(_0xe4e2('0x9'));config['redis']=_[_0xe4e2('0xa')](config[_0xe4e2('0xb')],{'host':_0xe4e2('0xc'),'port':0x18eb});var socket=require(_0xe4e2('0xd'))(new Redis(config[_0xe4e2('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xe4e2('0xe')](_0xe4e2('0xf'));var tempTableName=_0xe4e2('0x10')+moment()['format'](_0xe4e2('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x14fe0d){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))*$/[_0xe4e2('0x12')](_0x14fe0d);}function selectNotIn(_0x5b7889,_0x1954f8,_0x42a1f0,_0x137047,_0x107816){return squel[_0xe4e2('0x13')]()['field'](_0xe4e2('0x14'))[_0xe4e2('0x15')](_0x137047)[_0xe4e2('0x16')](_0x1954f8,null,_0x1954f8+_0xe4e2('0x17')+_0x137047+'.'+_0x42a1f0)['where'](_0x137047+'.'+_0x42a1f0+_0xe4e2('0x18')+_0x5b7889+'.'+_0x42a1f0)[_0xe4e2('0x19')](_0x1954f8+_0xe4e2('0x1a')+_0x107816[_0xe4e2('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x202486,_0x50678d){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xe4e2('0x1b')](_0xe4e2('0x1c')+tempTableName)[_0xe4e2('0x1d')](function(_0x28ee12){if(_0x28ee12!==null){var _0x217ea5=[];for(var _0x54107a=0x0;_0x54107a<_0x28ee12[_0xe4e2('0x1e')];_0x54107a++){var _0x3e8bb6=_0x28ee12[_0x54107a];if(!_[_0xe4e2('0x1f')](_0x3e8bb6['phone'])){if(!_[_0xe4e2('0x1f')](_0x3e8bb6['AdditionalPhones']))_0x217ea5[_0xe4e2('0x20')](insertAdditionalPhones(_0x3e8bb6));promisesContact[_0xe4e2('0x20')]({'contact':_0x3e8bb6});}}}Promise[_0xe4e2('0x21')](_0x217ea5)[_0xe4e2('0x22')](function(){_0x202486({'val':0x1});});})[_0xe4e2('0x23')](function(_0x156243){logger[_0xe4e2('0x24')](_0x156243[_0xe4e2('0x25')]);});});}function insertAdditionalPhones(_0x4769dd){return new Promise(function(_0x362741,_0x5a84c5){var _0xb7b3ab=_0x4769dd[_0xe4e2('0x26')];if(_[_0xe4e2('0x1f')](_0xb7b3ab))_0x5a84c5({'val':0x0});else{var _0x3491ff=_0xb7b3ab[_0xe4e2('0x27')](';');var _0x23b466=[];orderBy=0x0;for(var _0x16f14b=0x0;_0x16f14b<_0x3491ff['length'];_0x16f14b++){_0x23b466[_0xe4e2('0x20')](splitAdditionalPhone(_0x4769dd['id'],_0x3491ff[_0x16f14b]));}Promise[_0xe4e2('0x21')](_0x23b466)[_0xe4e2('0x22')](function(){_0x362741({'val':_0x3491ff['length']});});}});}function splitAdditionalPhone(_0x353030,_0x12ad33){return new Promise(function(_0x598fa3,_0xcba85a){var _0x234c38=_0x12ad33[_0xe4e2('0x27')](':');var _0x3f5265=_0x234c38[0x0];var _0x249b7e=_0x234c38[0x1];if(_0x249b7e!==''){var _0x5887c9=_0x249b7e[_0xe4e2('0x27')]('|');var _0x357903=[];for(var _0x1f6d1f=0x0;_0x1f6d1f<_0x5887c9['length'];_0x1f6d1f++){if(_0x5887c9[_0x1f6d1f]!==''){var _0x3a31b8=_[_0xe4e2('0x28')](promisesAdditionalPhones,{'contactId':_0x353030,'phone':_0x5887c9[_0x1f6d1f]});if(_0x3a31b8[_0xe4e2('0x1e')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x353030,'contactTypeId':_0x3f5265,'phone':_0x5887c9[_0x1f6d1f],'orderBy':orderBy});}}}_0x598fa3({'ok':0x1});}else _0x598fa3({'res':0x0});});}function createAdditionalPhone(_0x2e5a65,_0x50b4d9,_0x477b5c,_0x1e21c0){var _0x52c849='';var _0x46926a='';var _0x18e2e5=_0x477b5c[_0xe4e2('0x27')]('§');_0x52c849=_0x18e2e5[0x0];if(_0x18e2e5[_0xe4e2('0x1e')]==0x2)_0x46926a=_0x18e2e5[0x1];return new Promise(function(_0x1f7bcc,_0x4d33de){return db['CmContactHasItem'][_0xe4e2('0x29')]({'where':{'CmContactId':_0x2e5a65,'item':_0x52c849}})[_0xe4e2('0x22')](function(_0x12848d){if(_0x12848d){return db[_0xe4e2('0x2a')][_0xe4e2('0x2b')]({'ItemTypeId':_0x50b4d9,'description':_0x46926a,'OrderBy':_0x1e21c0},{'where':{'CmContactId':_0x2e5a65,'item':_0x52c849}})[_0xe4e2('0x22')](function(_0x1c7f9a){_0x1f7bcc({'res':_0xe4e2('0x2c')});});}else{return db[_0xe4e2('0x2a')][_0xe4e2('0x2d')]({'CmContactId':_0x2e5a65,'item':_0x52c849,'ItemTypeId':_0x50b4d9,'description':_0x46926a,'OrderBy':_0x1e21c0,'ItemClass':_0xe4e2('0x2e')})[_0xe4e2('0x22')](function(_0x4ce75b){_0x1f7bcc({'res':_0xe4e2('0x2f')});});}});});}function updateContact(_0x8ffc6){return new Promise(function(_0xe0846a,_0x1fd3c5){var _0x1431b0=_0x8ffc6['id'];delete _0x8ffc6['id'];return db[_0xe4e2('0x30')]['update'](_0x8ffc6,{'where':{'id':_0x1431b0}})[_0xe4e2('0x22')](function(_0x286714){updatedRows+=0x1;return db[_0xe4e2('0x31')][_0xe4e2('0x2b')]({'phone':_0x8ffc6[_0xe4e2('0x14')]},{'where':{'ContactId':_0x1431b0}})[_0xe4e2('0x22')](function(_0x444b99){_0xe0846a({'ret':'OK'});});});});}function insertCmHopper(_0x36a26d,_0xe3d34a,_0x337b42,_0x2767df,_0x4ac14d){var _0x2c831f=['cm_contacts.phone',_0xe4e2('0x32'),_0xe4e2('0x33'),'cm_contacts.ListId',_0xe3d34a+'.'+_0x2767df,_0xe4e2('0x34'),_0xe4e2('0x35'),_0xe4e2('0x36'),_0xe4e2('0x37'),'\x22'+_0x4ac14d+'\x22'];return squel['insert']()[_0xe4e2('0x38')]('cm_hopper')[_0xe4e2('0x39')](['phone',_0xe4e2('0x3a'),_0xe4e2('0x3b'),_0xe4e2('0x3c'),_0x2767df,'createdAt',_0xe4e2('0x3d'),_0xe4e2('0x3e'),'UserId',_0xe4e2('0x3f')],squel[_0xe4e2('0x13')]()[_0xe4e2('0x40')](_0x2c831f)[_0xe4e2('0x15')](_0xe3d34a)[_0xe4e2('0x16')](_0xe4e2('0x41'),null,_0xe4e2('0x42')+_0xe3d34a+_0xe4e2('0x43'))[_0xe4e2('0x16')](_0x337b42,null,_0x337b42+'.id\x20=\x20'+_0xe3d34a+'.'+_0x2767df)['where'](_0xe3d34a+_0xe4e2('0x44'),_0x36a26d)[_0xe4e2('0x19')](_0xe4e2('0x45'),NOW)[_0xe4e2('0x19')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xe3d34a,_0x337b42,_0x2767df,'cm_hopper',[_0xe4e2('0x46'),_0xe4e2('0x47')]))[_0xe4e2('0x19')](_0xe4e2('0x48'),selectNotIn(_0xe3d34a,_0x337b42,_0x2767df,'cm_hopper',[_0xe4e2('0x46')])))[_0xe4e2('0x49')]();}function insertCmHopperBlack(_0x385572,_0x577d4c,_0x1b54f6,_0x4789cf){var _0x67ee4f=[_0xe4e2('0x4a'),'cm_contacts.id','cm_contacts.ListId',_0x577d4c+'.'+_0x4789cf,_0xe4e2('0x34'),_0xe4e2('0x35')];return squel[_0xe4e2('0x4b')]()['into'](_0xe4e2('0x4c'))[_0xe4e2('0x39')](['phone',_0xe4e2('0x3b'),_0xe4e2('0x3c'),_0x4789cf,_0xe4e2('0x4d'),_0xe4e2('0x3d')],squel[_0xe4e2('0x13')]()[_0xe4e2('0x40')](_0x67ee4f)[_0xe4e2('0x15')](_0x577d4c)[_0xe4e2('0x16')]('cm_contacts',null,_0xe4e2('0x42')+_0x577d4c+_0xe4e2('0x43'))['join'](_0x1b54f6,null,_0x1b54f6+'.id\x20=\x20'+_0x577d4c+'.'+_0x4789cf)[_0xe4e2('0x19')](_0x577d4c+_0xe4e2('0x44'),_0x385572)[_0xe4e2('0x19')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe4e2('0x19')](_0xe4e2('0x48'),squel[_0xe4e2('0x13')]()[_0xe4e2('0x4e')]('phone')[_0xe4e2('0x15')](_0xe4e2('0x4c'))[_0xe4e2('0x19')](_0xe4e2('0x4f'),_0x385572)['where'](_0x4789cf+_0xe4e2('0x50'),_0x577d4c+'.'+_0x4789cf)))[_0xe4e2('0x49')]();}function insertCmHopperAdditionalPhones(_0x59c52d){var _0x37a988=[_0xe4e2('0x51'),_0xe4e2('0x52'),'cm_contact_has_items.OrderBy',_0xe4e2('0x53'),_0xe4e2('0x54')];return squel[_0xe4e2('0x4b')]()['into']('cm_hopper_additional_phones')[_0xe4e2('0x39')](['CmHopperId',_0xe4e2('0x14'),'OrderBy',_0xe4e2('0x4d'),_0xe4e2('0x3d')],squel[_0xe4e2('0x13')]()['fields'](_0x37a988)[_0xe4e2('0x15')]('cm_hopper')[_0xe4e2('0x16')](_0xe4e2('0x41'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xe4e2('0x16')]('cm_contact_has_items',null,_0xe4e2('0x55'))[_0xe4e2('0x19')]('cm_hopper.ListId\x20=\x20?',_0x59c52d)[_0xe4e2('0x19')](_0xe4e2('0x45'),NOW))[_0xe4e2('0x49')]();}function insertCmContact(_0x3e540d,_0x3c0107,_0xf7409d,_0x315255){var _0x37b33b=_[_0xe4e2('0x56')](_['keys'](_0x315255),[_0xe4e2('0x3c'),_0xe4e2('0x57'),_0xe4e2('0x4d'),_0xe4e2('0x3d')]);return squel[_0xe4e2('0x4b')]()[_0xe4e2('0x38')](_0xe4e2('0x41'))[_0xe4e2('0x39')](_0x37b33b,squel[_0xe4e2('0x13')]()[_0xe4e2('0x40')](_0x37b33b)[_0xe4e2('0x15')](_0x3c0107)['where']('('+_0xf7409d[_0xe4e2('0x16')](',')+_0xe4e2('0x58'),squel[_0xe4e2('0x13')]()[_0xe4e2('0x40')](_0xf7409d)['from'](_0xe4e2('0x41'))[_0xe4e2('0x19')]('ListId\x20=\x20?',_0x3e540d))[_0xe4e2('0x19')](_0xe4e2('0x59'),squel[_0xe4e2('0x13')]()[_0xe4e2('0x4e')]('MIN(id)',_0xe4e2('0x5a'))['from'](_0x3c0107)[_0xe4e2('0x5b')](_0xf7409d[_0xe4e2('0x16')](','))))[_0xe4e2('0x49')]();}function handleStop(){logger[_0xe4e2('0x5c')](_0xe4e2('0x5d'));stopped=!![];}function handleUncaughtException(_0x26ab38){logger[_0xe4e2('0x24')](_0x26ab38[_0xe4e2('0x25')]);process[_0xe4e2('0x5e')](0x1);}function handleError(_0x230969,_0x3cb0d2){stats[_0xe4e2('0x5f')]['push']({'name':_0x3cb0d2[_0xe4e2('0x60')],'message':_0x3cb0d2['message'],'row':_0x230969});}function handleQuery(_0x5eb739){logger[_0xe4e2('0x5c')](_0x5eb739);return db[_0xe4e2('0x61')][_0xe4e2('0x1b')](_0x5eb739)['spread'](function(_0x477acd){results['push'](_0x477acd);})[_0xe4e2('0x23')](function(_0x9ba757){logger['error'](_0x9ba757[_0xe4e2('0x25')]);});}function main(_0x14f7da,_0x55d442,_0x3f2b39,_0x4e3a01){logger['info'](_0xe4e2('0x62'),_0x14f7da,JSON[_0xe4e2('0x63')](_0x55d442));process[_0xe4e2('0x64')](_0xe4e2('0x65'));var _0x4bd248=_0x55d442[_0xe4e2('0x66')];var _0x3f94ef=_[_0xe4e2('0x67')](_0x4bd248);var _0x133f62=_0x55d442[_0xe4e2('0x68')];var _0x472b0d=path[_0xe4e2('0x16')](config[_0xe4e2('0x69')],_0xe4e2('0x6a'),_0x133f62+'.csv');logger['info']('body',_0x55d442);db[_0xe4e2('0x6b')][_0xe4e2('0x6c')]({'raw':!![],'attributes':['id',_0xe4e2('0x6d')]})[_0xe4e2('0x22')](function(_0x346e88){for(var _0x2c38a7=0x0;_0x2c38a7<_0x346e88[_0xe4e2('0x1e')];_0x2c38a7++){if(_0x346e88[_0x2c38a7]['name']in _0x4bd248){contactItemTypes[_0xe4e2('0x20')](_0x346e88[_0x2c38a7]);delete _0x3f94ef[_0x346e88[_0x2c38a7][_0xe4e2('0x6d')]];hasAdditionalPhones=!![];}for(var _0x1a96af in _0x4bd248){if(_0x346e88[_0x2c38a7][_0xe4e2('0x6d')]+_0xe4e2('0x6e')===_0x1a96af){phoneDescriptions[_0xe4e2('0x20')]({'itemTypeId':_0x346e88[_0x2c38a7]['id'],'description':_0x1a96af});delete _0x3f94ef[_0x1a96af];}}}if(hasAdditionalPhones)_0x3f94ef[_0xe4e2('0x26')]='';var _0x38eb8a=_[_0xe4e2('0x6f')](_0x3f94ef)[_0xe4e2('0x16')]();logger[_0xe4e2('0x5c')](_0xe4e2('0x70'),_0x38eb8a);fs[_0xe4e2('0x71')](_0x472b0d,_0x38eb8a+'\x0a');Papa[_0xe4e2('0x72')](fs[_0xe4e2('0x73')](_0x14f7da),{'header':!![],'skipEmptyLines':!![],'step':function(_0x51d58d,_0x4434c9){try{for(var _0xdeb76a=0x0,_0x32185b=[];_0xdeb76a<_0x51d58d[_0xe4e2('0x74')][_0xe4e2('0x1e')];_0xdeb76a++){stats[_0xe4e2('0x75')]+=0x1;if(_0x51d58d[_0xe4e2('0x5f')][_0xdeb76a]){handleError(_0x51d58d[_0xe4e2('0x74')][_0xdeb76a],_0x51d58d[_0xe4e2('0x5f')][_0xdeb76a]);}else{var _0x23e014=[];var _0x57a7eb=[];var _0x31cdfe={};for(var _0x46b5bc in _0x4bd248){let _0x11679c=contactItemTypes[_0xe4e2('0x76')](_0x24859b=>_0x24859b[_0xe4e2('0x6d')]===_0x46b5bc);let _0xacef79=contactItemTypes[_0xe4e2('0x76')](_0x4d6bbd=>_0x4d6bbd[_0xe4e2('0x6d')]+_0xe4e2('0x6e')===_0x46b5bc);if(_[_0xe4e2('0x1f')](_0x11679c)&&_[_0xe4e2('0x1f')](_0xacef79)){if(_0x4bd248[_0xe4e2('0x77')](_0x46b5bc)){if(_0x51d58d[_0xe4e2('0x74')][_0xdeb76a][_0x4bd248[_0x46b5bc]]){var _0x150c1a=_[_0xe4e2('0x78')](_0x51d58d[_0xe4e2('0x74')][_0xdeb76a][_0x4bd248[_0x46b5bc]][_0xe4e2('0x79')](/"/g,'\x27'));switch(_0x46b5bc){case'scheduledat':var _0x10fe72=moment(_0x150c1a,_0xe4e2('0xf'),!![]);if(_0x10fe72['isValid']()){_0x32185b[_0xe4e2('0x20')]('\x22'+_0x150c1a+'\x22');}else{_0x23e014[_0xe4e2('0x20')](_0xe4e2('0x7a'));}break;case _0xe4e2('0x3e'):var _0x16f0d1=parseInt(_0x150c1a);_0x150c1a=_['isNaN'](_0x16f0d1)||_0x16f0d1<0x0||_0x16f0d1>0x4?_0x4e3a01?0x3:0x2:_0x16f0d1;_0x32185b[_0xe4e2('0x20')]('\x22'+_0x150c1a+'\x22');break;case _0xe4e2('0x7b'):var _0x287546=parseInt(_0x150c1a);if(_[_0xe4e2('0x7c')](_0x287546)&&_[_0xe4e2('0x7d')](_0x3f2b39,_0x287546)){_0x32185b[_0xe4e2('0x20')]('\x22'+_0x287546+'\x22');}else{_0x23e014[_0xe4e2('0x20')](_0xe4e2('0x7e'));}break;case'email':if(isEmail(_0x150c1a)){_0x32185b[_0xe4e2('0x20')]('\x22'+_0x150c1a+'\x22');}else{_0x23e014[_0xe4e2('0x20')](_0xe4e2('0x7f'));}break;case _0xe4e2('0x80'):var _0x2fec7a=moment(_0x150c1a,_0xe4e2('0x81'),!![]);if(_0x2fec7a[_0xe4e2('0x82')]()){_0x32185b[_0xe4e2('0x20')]('\x22'+_0x150c1a+'\x22');}else{_0x23e014[_0xe4e2('0x20')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x32185b[_0xe4e2('0x20')]('\x22'+_0x150c1a+'\x22');}}else{switch(_0x46b5bc){case _0xe4e2('0x83'):case _0xe4e2('0x14'):_0x23e014[_0xe4e2('0x20')](_0x46b5bc+_0xe4e2('0x84'));break;default:_0x32185b[_0xe4e2('0x20')]('\x22\x22');}}}}else{var _0x1255e0='';if(!_[_0xe4e2('0x1f')](_0x11679c)){if(!_0x31cdfe[_0xe4e2('0x77')](_0x11679c['id'])){for(var _0x428f83=0x0;_0x428f83<_0x4bd248[_0x46b5bc][_0xe4e2('0x1e')];_0x428f83++){var _0x150c1a=_[_0xe4e2('0x78')](_0x51d58d['data'][_0xdeb76a][_0x4bd248[_0x46b5bc][_0x428f83]][_0xe4e2('0x79')](/"/g,'\x27'));var _0x5ed108=phoneDescriptions[_0xe4e2('0x76')](_0x18e8b3=>_0x18e8b3['itemTypeId']===_0x11679c['id']);if(!_[_0xe4e2('0x1f')](_0x5ed108)){var _0xd829a8=_[_0xe4e2('0x78')](_0x51d58d[_0xe4e2('0x74')][_0xdeb76a][_0x4bd248[_0x5ed108[_0xe4e2('0x85')]][0x0]][_0xe4e2('0x79')](/"/g,'\x27'));if(!_[_0xe4e2('0x1f')](_0xd829a8))_0x150c1a=_0x150c1a+'§'+_0xd829a8;}if(_0x1255e0=='')_0x1255e0=_0x150c1a;else _0x1255e0+='|'+_0x150c1a;}_0x57a7eb['push'](_0x11679c['id']+':'+_0x1255e0);_0x31cdfe[_0x11679c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x32185b[_0xe4e2('0x20')]('\x22'+_0x57a7eb[_0xe4e2('0x16')](';')+'\x22');}if(_0x23e014['length']){handleError(_0x51d58d['data'][_0xdeb76a],{'code':_0xe4e2('0x86'),'message':_0x23e014[_0xe4e2('0x16')]()});}else{fs[_0xe4e2('0x87')](_0x472b0d,_0x32185b['join']()+'\x0a');}_0x32185b=[];}if(!(stats[_0xe4e2('0x75')]%0xc8)){socket['emit'](_0xe4e2('0x88')+_0x133f62,stats);stats[_0xe4e2('0x5f')]=[];}}if(stopped){logger['info'](_0xe4e2('0x89'));_0x4434c9[_0xe4e2('0x8a')]();}}catch(_0x45ecb8){handleError(_0x51d58d[_0xe4e2('0x74')][_0xdeb76a],{'code':_0xe4e2('0x8b'),'message':_0x45ecb8[_0xe4e2('0x25')]});logger[_0xe4e2('0x24')](_0xe4e2('0x8c'),_0x45ecb8[_0xe4e2('0x25')]);}},'complete':function(){try{var _0x18fb51=[];var _0x5a6a7c=tempTableName;_0x18fb51[_0xe4e2('0x20')](_0xe4e2('0x8d')+_0x5a6a7c+'\x20LIKE\x20cm_contacts;');logger[_0xe4e2('0x5c')]('CIS\x20len',contactItemTypes[_0xe4e2('0x1e')]);var _0x388f48=util[_0xe4e2('0xe')](_0xe4e2('0x8e'),_0x472b0d,_0x5a6a7c,_0x38eb8a,_0x55d442['ListId'],_0x55d442[_0xe4e2('0x57')]||null,NOW,NOW);if(_[_0xe4e2('0x1f')](_0x4bd248[_0xe4e2('0x3a')])){_0x388f48+=_0xe4e2('0x8f');}_0x18fb51[_0xe4e2('0x20')](_0x388f48);BPromise[_0xe4e2('0x90')](_0x18fb51,handleQuery)[_0xe4e2('0x22')](function(_0x526a50){BPromise['all']([handleAdditionalPhones()])[_0xe4e2('0x22')](function(){_0x18fb51=[];for(var _0x3d7f70=0x0;_0x3d7f70\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','lodash','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','YYYYMMDDHHmmss','select','field','from','join','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','phone','AdditionalPhones','push','all','then','catch'];(function(_0x1fd138,_0xd626e2){var _0x6cabbc=function(_0x4c2771){while(--_0x4c2771){_0x1fd138['push'](_0x1fd138['shift']());}};_0x6cabbc(++_0xd626e2);}(_0x04fa,0x119));var _0xa04f=function(_0x54376c,_0x47d41c){_0x54376c=_0x54376c-0x0;var _0x3533e7=_0x04fa[_0x54376c];return _0x3533e7;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xa04f('0x0'));var Papa=require(_0xa04f('0x1'));var util=require(_0xa04f('0x2'));var BPromise=require(_0xa04f('0x3'));var moment=require(_0xa04f('0x4'));var squel=require('squel');var Redis=require(_0xa04f('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xa04f('0x6'));var logger=require(_0xa04f('0x7'))(_0xa04f('0x8'));config['redis']=_[_0xa04f('0x9')](config[_0xa04f('0xa')],{'host':_0xa04f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa04f('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()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()['format'](_0xa04f('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x497a13){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'](_0x497a13);}function selectNotIn(_0x4005da,_0x33ad5a,_0x50539b,_0x3e4235,_0x485814){return squel[_0xa04f('0xd')]()[_0xa04f('0xe')]('phone')[_0xa04f('0xf')](_0x3e4235)[_0xa04f('0x10')](_0x33ad5a,null,_0x33ad5a+'.id\x20=\x20'+_0x3e4235+'.'+_0x50539b)['where'](_0x3e4235+'.'+_0x50539b+'\x20=\x20'+_0x4005da+'.'+_0x50539b)[_0xa04f('0x11')](_0x33ad5a+_0xa04f('0x12')+_0x485814[_0xa04f('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xb396b,_0x24a32d){promisesAdditionalPhones=[];promisesContact=[];return db[_0xa04f('0x13')]['query'](_0xa04f('0x14')+tempTableName)[_0xa04f('0x15')](function(_0x509830){if(_0x509830!==null){var _0x202232=[];for(var _0x2e58de=0x0;_0x2e58de<_0x509830[_0xa04f('0x16')];_0x2e58de++){var _0x2b00e6=_0x509830[_0x2e58de];if(!_['isNil'](_0x2b00e6[_0xa04f('0x17')])){if(!_['isNil'](_0x2b00e6[_0xa04f('0x18')]))_0x202232[_0xa04f('0x19')](insertAdditionalPhones(_0x2b00e6));promisesContact['push']({'contact':_0x2b00e6});}}}Promise[_0xa04f('0x1a')](_0x202232)[_0xa04f('0x1b')](function(){_0xb396b({'val':0x1});});})[_0xa04f('0x1c')](function(_0x4ee169){logger['error'](_0x4ee169[_0xa04f('0x1d')]);});});}function insertAdditionalPhones(_0x5c2a71){return new Promise(function(_0x5d68f4,_0x141fc8){var _0x3bf269=_0x5c2a71['AdditionalPhones'];if(_['isNil'](_0x3bf269))_0x141fc8({'val':0x0});else{var _0x3c07a5=_0x3bf269[_0xa04f('0x1e')](';');var _0x17d471=[];orderBy=0x0;for(var _0x3f7268=0x0;_0x3f7268<_0x3c07a5[_0xa04f('0x16')];_0x3f7268++){_0x17d471[_0xa04f('0x19')](splitAdditionalPhone(_0x5c2a71['id'],_0x3c07a5[_0x3f7268]));}Promise[_0xa04f('0x1a')](_0x17d471)[_0xa04f('0x1b')](function(){_0x5d68f4({'val':_0x3c07a5[_0xa04f('0x16')]});});}});}function splitAdditionalPhone(_0x3ee16d,_0x3f6cab){return new Promise(function(_0x1b1dad,_0x10ae93){var _0x15f0cc=_0x3f6cab['split'](':');var _0x18c13e=_0x15f0cc[0x0];var _0xee0a84=_0x15f0cc[0x1];if(_0xee0a84!==''){var _0x2a0a91=_0xee0a84['split']('|');var _0x54ed09=[];for(var _0x3faa79=0x0;_0x3faa79<_0x2a0a91[_0xa04f('0x16')];_0x3faa79++){if(_0x2a0a91[_0x3faa79]!==''){var _0x12fac3=_['filter'](promisesAdditionalPhones,{'contactId':_0x3ee16d,'phone':_0x2a0a91[_0x3faa79]});if(_0x12fac3[_0xa04f('0x16')]==0x0){orderBy++;promisesAdditionalPhones[_0xa04f('0x19')]({'contactId':_0x3ee16d,'contactTypeId':_0x18c13e,'phone':_0x2a0a91[_0x3faa79],'orderBy':orderBy});}}}_0x1b1dad({'ok':0x1});}else _0x1b1dad({'res':0x0});});}function createAdditionalPhone(_0x3d50c9,_0x5c27cc,_0x3c6ccd,_0x1c0cc5){var _0x25a96f='';var _0x7e0865='';var _0x1e441c=_0x3c6ccd[_0xa04f('0x1e')]('§');_0x25a96f=_0x1e441c[0x0];if(_0x1e441c[_0xa04f('0x16')]==0x2)_0x7e0865=_0x1e441c[0x1];return new Promise(function(_0x4bde12,_0x406131){return db[_0xa04f('0x1f')]['findOne']({'where':{'CmContactId':_0x3d50c9,'item':_0x25a96f}})['then'](function(_0x27f968){if(_0x27f968){return db[_0xa04f('0x1f')][_0xa04f('0x20')]({'ItemTypeId':_0x5c27cc,'description':_0x7e0865,'OrderBy':_0x1c0cc5},{'where':{'CmContactId':_0x3d50c9,'item':_0x25a96f}})[_0xa04f('0x1b')](function(_0xec37a0){_0x4bde12({'res':_0xa04f('0x21')});});}else{return db['CmContactHasItem'][_0xa04f('0x22')]({'CmContactId':_0x3d50c9,'item':_0x25a96f,'ItemTypeId':_0x5c27cc,'description':_0x7e0865,'OrderBy':_0x1c0cc5,'ItemClass':_0xa04f('0x23')})[_0xa04f('0x1b')](function(_0x4b1ec8){_0x4bde12({'res':'inserted'});});}});});}function updateContact(_0x4b22e7){return new Promise(function(_0x380ae5,_0x264f76){var _0x3fe0b9=_0x4b22e7['id'];delete _0x4b22e7['id'];return db['CmContact']['update'](_0x4b22e7,{'where':{'id':_0x3fe0b9}})[_0xa04f('0x1b')](function(_0x1e1471){updatedRows+=0x1;return db[_0xa04f('0x24')][_0xa04f('0x20')]({'phone':_0x4b22e7[_0xa04f('0x17')]},{'where':{'ContactId':_0x3fe0b9}})[_0xa04f('0x1b')](function(_0x5d874a){_0x380ae5({'ret':'OK'});});});});}function insertCmHopper(_0xc6cb01,_0x31c613,_0x158996,_0x5b92ae,_0x295fca){var _0xb727c9=[_0xa04f('0x25'),_0xa04f('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x31c613+'.'+_0x5b92ae,'cm_contacts.createdAt',_0xa04f('0x27'),_0xa04f('0x28'),_0xa04f('0x29'),'\x22'+_0x295fca+'\x22'];return squel[_0xa04f('0x2a')]()[_0xa04f('0x2b')](_0xa04f('0x2c'))['fromQuery'](['phone','scheduledat',_0xa04f('0x2d'),_0xa04f('0x2e'),_0x5b92ae,'createdAt',_0xa04f('0x2f'),_0xa04f('0x30'),'UserId','recallme'],squel[_0xa04f('0xd')]()[_0xa04f('0x31')](_0xb727c9)[_0xa04f('0xf')](_0x31c613)[_0xa04f('0x10')](_0xa04f('0x32'),null,_0xa04f('0x33')+_0x31c613+_0xa04f('0x34'))['join'](_0x158996,null,_0x158996+_0xa04f('0x35')+_0x31c613+'.'+_0x5b92ae)['where'](_0x31c613+_0xa04f('0x36'),_0xc6cb01)['where'](_0xa04f('0x37'),NOW)[_0xa04f('0x11')](_0xa04f('0x38'),selectNotIn(_0x31c613,_0x158996,_0x5b92ae,_0xa04f('0x2c'),['\x22always\x22',_0xa04f('0x39')]))['where'](_0xa04f('0x38'),selectNotIn(_0x31c613,_0x158996,_0x5b92ae,_0xa04f('0x2c'),[_0xa04f('0x3a')])))['toString']();}function insertCmHopperBlack(_0x54ea98,_0x5abd61,_0x731d6b,_0x34a56b){var _0x350806=['cm_contacts.phone',_0xa04f('0x3b'),_0xa04f('0x3c'),_0x5abd61+'.'+_0x34a56b,_0xa04f('0x3d'),'cm_contacts.updatedAt'];return squel[_0xa04f('0x2a')]()[_0xa04f('0x2b')](_0xa04f('0x3e'))[_0xa04f('0x3f')]([_0xa04f('0x17'),_0xa04f('0x2d'),_0xa04f('0x2e'),_0x34a56b,_0xa04f('0x40'),_0xa04f('0x2f')],squel[_0xa04f('0xd')]()[_0xa04f('0x31')](_0x350806)['from'](_0x5abd61)['join'](_0xa04f('0x32'),null,_0xa04f('0x33')+_0x5abd61+_0xa04f('0x34'))['join'](_0x731d6b,null,_0x731d6b+_0xa04f('0x35')+_0x5abd61+'.'+_0x34a56b)[_0xa04f('0x11')](_0x5abd61+_0xa04f('0x36'),_0x54ea98)[_0xa04f('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa04f('0x11')](_0xa04f('0x38'),squel[_0xa04f('0xd')]()[_0xa04f('0xe')](_0xa04f('0x17'))[_0xa04f('0xf')](_0xa04f('0x3e'))[_0xa04f('0x11')](_0xa04f('0x41'),_0x54ea98)['where'](_0x34a56b+_0xa04f('0x42'),_0x5abd61+'.'+_0x34a56b)))['toString']();}function insertCmHopperAdditionalPhones(_0x347d0a){var _0x25ab33=[_0xa04f('0x43'),_0xa04f('0x44'),_0xa04f('0x45'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xa04f('0x2a')]()[_0xa04f('0x2b')](_0xa04f('0x46'))['fromQuery']([_0xa04f('0x47'),_0xa04f('0x17'),'OrderBy',_0xa04f('0x40'),'updatedAt'],squel[_0xa04f('0xd')]()['fields'](_0x25ab33)[_0xa04f('0xf')](_0xa04f('0x2c'))['join'](_0xa04f('0x32'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xa04f('0x10')](_0xa04f('0x48'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xa04f('0x11')]('cm_hopper.ListId\x20=\x20?',_0x347d0a)[_0xa04f('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x28b5ab,_0x46dd1b,_0x489f1f,_0x29d25b){var _0x301c7a=_[_0xa04f('0x49')](_['keys'](_0x29d25b),['ListId','CompanyId',_0xa04f('0x40'),_0xa04f('0x2f')]);return squel[_0xa04f('0x2a')]()[_0xa04f('0x2b')](_0xa04f('0x32'))['fromQuery'](_0x301c7a,squel[_0xa04f('0xd')]()['fields'](_0x301c7a)[_0xa04f('0xf')](_0x46dd1b)[_0xa04f('0x11')]('('+_0x489f1f['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xa04f('0xd')]()[_0xa04f('0x31')](_0x489f1f)[_0xa04f('0xf')](_0xa04f('0x32'))['where'](_0xa04f('0x41'),_0x28b5ab))['where']('id\x20IN\x20?',squel[_0xa04f('0xd')]()[_0xa04f('0xe')](_0xa04f('0x4a'),_0xa04f('0x4b'))[_0xa04f('0xf')](_0x46dd1b)[_0xa04f('0x4c')](_0x489f1f['join'](','))))[_0xa04f('0x4d')]();}function handleStop(){logger[_0xa04f('0x4e')](_0xa04f('0x4f'));stopped=!![];}function handleUncaughtException(_0x519fc4){logger[_0xa04f('0x50')](_0x519fc4['message']);process[_0xa04f('0x51')](0x1);}function handleError(_0x36bdec,_0x271bdf){stats[_0xa04f('0x52')]['push']({'name':_0x271bdf[_0xa04f('0x53')],'message':_0x271bdf[_0xa04f('0x1d')],'row':_0x36bdec});}function handleQuery(_0x3cf00c){logger['info'](_0x3cf00c);return db[_0xa04f('0x13')][_0xa04f('0x54')](_0x3cf00c)['spread'](function(_0x2f3cab){results['push'](_0x2f3cab);})[_0xa04f('0x1c')](function(_0x5002ae){logger['error'](_0x5002ae[_0xa04f('0x1d')]);});}function main(_0x5552e8,_0x3c95c4,_0x594ff2,_0x3fb16b){logger['info']('main',_0x5552e8,JSON[_0xa04f('0x55')](_0x3c95c4));process[_0xa04f('0x56')]('start');var _0x586c4b=_0x3c95c4[_0xa04f('0x57')];var _0x42e7a1=_[_0xa04f('0x58')](_0x586c4b);var _0x2e5aec=_0x3c95c4[_0xa04f('0x59')];var _0x2dac33=path['join'](config['root'],_0xa04f('0x5a'),_0x2e5aec+_0xa04f('0x5b'));logger[_0xa04f('0x4e')](_0xa04f('0x5c'),_0x3c95c4);db[_0xa04f('0x5d')][_0xa04f('0x5e')]({'raw':!![],'attributes':['id',_0xa04f('0x5f')]})[_0xa04f('0x1b')](function(_0x5f0011){for(var _0x56567c=0x0;_0x56567c<_0x5f0011[_0xa04f('0x16')];_0x56567c++){if(_0x5f0011[_0x56567c][_0xa04f('0x5f')]in _0x586c4b){contactItemTypes[_0xa04f('0x19')](_0x5f0011[_0x56567c]);delete _0x42e7a1[_0x5f0011[_0x56567c]['name']];hasAdditionalPhones=!![];}for(var _0x5db09a in _0x586c4b){if(_0x5f0011[_0x56567c][_0xa04f('0x5f')]+_0xa04f('0x60')===_0x5db09a){phoneDescriptions[_0xa04f('0x19')]({'itemTypeId':_0x5f0011[_0x56567c]['id'],'description':_0x5db09a});delete _0x42e7a1[_0x5db09a];}}}if(hasAdditionalPhones)_0x42e7a1[_0xa04f('0x18')]='';var _0x51cc6d=_[_0xa04f('0x61')](_0x42e7a1)[_0xa04f('0x10')]();logger[_0xa04f('0x4e')](_0xa04f('0x62'),_0x51cc6d);fs[_0xa04f('0x63')](_0x2dac33,_0x51cc6d+'\x0a');Papa[_0xa04f('0x64')](fs[_0xa04f('0x65')](_0x5552e8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x37ffa9,_0x8e1e8e){try{for(var _0xadb3fa=0x0,_0x2b56b2=[];_0xadb3fa<_0x37ffa9[_0xa04f('0x66')][_0xa04f('0x16')];_0xadb3fa++){stats[_0xa04f('0x67')]+=0x1;if(_0x37ffa9[_0xa04f('0x52')][_0xadb3fa]){handleError(_0x37ffa9[_0xa04f('0x66')][_0xadb3fa],_0x37ffa9[_0xa04f('0x52')][_0xadb3fa]);}else{var _0x4d6001=[];var _0x3b313c=[];var _0x32492f={};for(var _0x4ccc32 in _0x586c4b){let _0x2f8eb3=contactItemTypes[_0xa04f('0x68')](_0x593894=>_0x593894['name']===_0x4ccc32);let _0x35242f=contactItemTypes[_0xa04f('0x68')](_0x201771=>_0x201771[_0xa04f('0x5f')]+_0xa04f('0x60')===_0x4ccc32);if(_['isNil'](_0x2f8eb3)&&_[_0xa04f('0x69')](_0x35242f)){if(_0x586c4b[_0xa04f('0x6a')](_0x4ccc32)){if(_0x37ffa9[_0xa04f('0x66')][_0xadb3fa][_0x586c4b[_0x4ccc32]]){var _0x5dcc42=_[_0xa04f('0x6b')](_0x37ffa9[_0xa04f('0x66')][_0xadb3fa][_0x586c4b[_0x4ccc32]][_0xa04f('0x6c')](/"/g,'\x27'));switch(_0x4ccc32){case'scheduledat':var _0x191a2b=moment(_0x5dcc42,_0xa04f('0x6d'),!![]);if(_0x191a2b['isValid']()){_0x2b56b2[_0xa04f('0x19')]('\x22'+_0x5dcc42+'\x22');}else{_0x4d6001[_0xa04f('0x19')](_0xa04f('0x6e'));}break;case _0xa04f('0x30'):var _0x4b15f7=parseInt(_0x5dcc42);_0x5dcc42=_['isNaN'](_0x4b15f7)||_0x4b15f7<0x0||_0x4b15f7>0x4?_0x3fb16b?0x3:0x2:_0x4b15f7;_0x2b56b2[_0xa04f('0x19')]('\x22'+_0x5dcc42+'\x22');break;case'UserId':var _0x1eff96=parseInt(_0x5dcc42);if(_['isNumber'](_0x1eff96)&&_[_0xa04f('0x6f')](_0x594ff2,_0x1eff96)){_0x2b56b2['push']('\x22'+_0x1eff96+'\x22');}else{_0x4d6001[_0xa04f('0x19')](_0xa04f('0x70'));}break;case _0xa04f('0x71'):if(isEmail(_0x5dcc42)){_0x2b56b2['push']('\x22'+_0x5dcc42+'\x22');}else{_0x4d6001[_0xa04f('0x19')](_0xa04f('0x72'));}break;case _0xa04f('0x73'):var _0xff6e96=moment(_0x5dcc42,_0xa04f('0x74'),!![]);if(_0xff6e96['isValid']()){_0x2b56b2[_0xa04f('0x19')]('\x22'+_0x5dcc42+'\x22');}else{_0x4d6001[_0xa04f('0x19')](_0xa04f('0x75'));}break;default:_0x2b56b2['push']('\x22'+_0x5dcc42+'\x22');}}else{switch(_0x4ccc32){case _0xa04f('0x76'):case'phone':_0x4d6001[_0xa04f('0x19')](_0x4ccc32+_0xa04f('0x77'));break;default:_0x2b56b2[_0xa04f('0x19')]('\x22\x22');}}}}else{var _0x4c9d9d='';if(!_['isNil'](_0x2f8eb3)){if(!_0x32492f['hasOwnProperty'](_0x2f8eb3['id'])){for(var _0x153bf0=0x0;_0x153bf0<_0x586c4b[_0x4ccc32]['length'];_0x153bf0++){var _0x5dcc42=_[_0xa04f('0x6b')](_0x37ffa9[_0xa04f('0x66')][_0xadb3fa][_0x586c4b[_0x4ccc32][_0x153bf0]]['replace'](/"/g,'\x27'));var _0x3ad490=phoneDescriptions[_0xa04f('0x68')](_0x5db333=>_0x5db333[_0xa04f('0x78')]===_0x2f8eb3['id']);if(!_[_0xa04f('0x69')](_0x3ad490)){var _0x4a480e=_[_0xa04f('0x6b')](_0x37ffa9['data'][_0xadb3fa][_0x586c4b[_0x3ad490[_0xa04f('0x79')]][0x0]][_0xa04f('0x6c')](/"/g,'\x27'));if(!_[_0xa04f('0x69')](_0x4a480e))_0x5dcc42=_0x5dcc42+'§'+_0x4a480e;}if(_0x4c9d9d=='')_0x4c9d9d=_0x5dcc42;else _0x4c9d9d+='|'+_0x5dcc42;}_0x3b313c[_0xa04f('0x19')](_0x2f8eb3['id']+':'+_0x4c9d9d);_0x32492f[_0x2f8eb3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2b56b2[_0xa04f('0x19')]('\x22'+_0x3b313c['join'](';')+'\x22');}if(_0x4d6001[_0xa04f('0x16')]){handleError(_0x37ffa9[_0xa04f('0x66')][_0xadb3fa],{'code':_0xa04f('0x7a'),'message':_0x4d6001[_0xa04f('0x10')]()});}else{fs[_0xa04f('0x7b')](_0x2dac33,_0x2b56b2[_0xa04f('0x10')]()+'\x0a');}_0x2b56b2=[];}if(!(stats['rows']%0xc8)){socket[_0xa04f('0x7c')](_0xa04f('0x7d')+_0x2e5aec,stats);stats[_0xa04f('0x52')]=[];}}if(stopped){logger['info'](_0xa04f('0x7e'));_0x8e1e8e[_0xa04f('0x7f')]();}}catch(_0x4cbce6){handleError(_0x37ffa9['data'][_0xadb3fa],{'code':_0xa04f('0x80'),'message':_0x4cbce6[_0xa04f('0x1d')]});logger[_0xa04f('0x50')](_0xa04f('0x81'),_0x4cbce6[_0xa04f('0x1d')]);}},'complete':function(){try{var _0xe1195f=[];var _0x21eb43=tempTableName;_0xe1195f['push'](_0xa04f('0x82')+_0x21eb43+_0xa04f('0x83'));logger['info']('CIS\x20len',contactItemTypes[_0xa04f('0x16')]);var _0x19788a=util[_0xa04f('0x84')](_0xa04f('0x85'),_0x2dac33,_0x21eb43,_0x51cc6d,_0x3c95c4[_0xa04f('0x2e')],_0x3c95c4[_0xa04f('0x86')]||null,NOW,NOW);if(_[_0xa04f('0x69')](_0x586c4b['scheduledat'])){_0x19788a+=_0xa04f('0x87');}_0xe1195f['push'](_0x19788a);BPromise[_0xa04f('0x88')](_0xe1195f,handleQuery)[_0xa04f('0x1b')](function(_0x5da120){BPromise[_0xa04f('0x1a')]([handleAdditionalPhones()])['then'](function(){_0xe1195f=[];for(var _0x572020=0x0;_0x572020\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xc963,0xbf));var _0x3c96=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0xc963[_0x36f243];return _0x426436;};'use strict';var _=require(_0x3c96('0x0'));var squel=require(_0x3c96('0x1'));var as=require(_0x3c96('0x2'));var qs=require(_0x3c96('0x3'));var updateInteraction=require('./update-interaction')[_0x3c96('0x4')];var utils=require(_0x3c96('0x5'));var db=require(_0x3c96('0x6'))['db'];function skipInteractionsQuery(_0x535b5b,_0x232c50,_0x12da48){var _0x5b1a5e=![];var _0x148c37=utils[_0x3c96('0x7')](_0x535b5b);if(_0x232c50[_0x3c96('0x8')]==='agent'&&!_0x12da48[_0x3c96('0x9')]&&!_0x12da48[_0x148c37]){_0x5b1a5e=!![];}return _0x5b1a5e;}function getTagsQuery(){return squel[_0x3c96('0xa')]()[_0x3c96('0xb')]('id')[_0x3c96('0xb')](_0x3c96('0xc'))['field'](_0x3c96('0xd'))['from'](_0x3c96('0xe'));}function getUsersQuery(_0x4429e3,_0x1ae4c0){var _0x280651=utils['getInteractionFK'](_0x4429e3);var _0x3bdccb=_0x3c96('0xf')+_0x4429e3+_0x3c96('0x10');var _0xeb9026=squel[_0x3c96('0xa')]()[_0x3c96('0xb')](_0x3c96('0x11'))[_0x3c96('0xb')](_0x3c96('0x12'))[_0x3c96('0xb')](_0x3c96('0x13')+_0x280651)[_0x3c96('0x14')](_0x3bdccb,'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');if(_0x1ae4c0[_0x3c96('0x15')]>0x0){_0xeb9026[_0x3c96('0x16')](_0x3c96('0x13')+_0x280651+_0x3c96('0x17'),_[_0x3c96('0x18')](_0x1ae4c0,'id'));}return _0xeb9026;}function getInteractionsQuery(_0x4776e4){var _0x77aa3b=utils[_0x3c96('0x19')](_0x4776e4);var _0x24229a=utils[_0x3c96('0x7')](_0x4776e4);var _0x21f18a=utils[_0x3c96('0x1a')](_0x4776e4);return squel[_0x3c96('0xa')]()['from'](_0x77aa3b[_0x3c96('0x1b')],'i')['left_join'](_0x3c96('0x1c'),'c',_0x3c96('0x1d'))[_0x3c96('0x1e')](_0x3c96('0x1f'),'o',_0x3c96('0x20'))[_0x3c96('0x1e')](_0x77aa3b[_0x3c96('0x21')],'a',_0x3c96('0x22')+_0x24229a)[_0x3c96('0x1e')](_0x77aa3b['messages'],'me',_0x3c96('0x23')+_0x21f18a+_0x3c96('0x24'))['left_join'](_0x77aa3b['interactionsTags'],'it',_0x3c96('0x25')+_0x21f18a+'\x20=\x20i.id')['left_join'](_0x3c96('0xe'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x15ea9e={'body':squel[_0x3c96('0x26')](),'contact':squel[_0x3c96('0x26')](),'default':squel[_0x3c96('0x26')](),'fields':squel[_0x3c96('0x26')](),'filter':squel[_0x3c96('0x26')](),'read':squel[_0x3c96('0x26')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x3c96('0x26')]()};return _0x15ea9e;}function parseTagParameter(_0x41d174){var _0x1069b0=squel[_0x3c96('0x26')]();if(_0x41d174){var _0xa510f7=utils[_0x3c96('0x27')](_0x41d174);_0xa510f7[_0x3c96('0x28')](function(_0x9a403){_0x1069b0['or'](_0x3c96('0x29'),'%,'+_0x9a403+',%');});}return _0x1069b0;}function parseReadParameter(_0x3d3094){var _0x11d60f='';if(_0x3d3094){_0x11d60f=_0x3c96('0x2a');if(_0x3d3094==='1'){_0x11d60f=_0x11d60f[_0x3c96('0x2b')]('{OPERATOR}','=');}else{_0x11d60f=_0x11d60f[_0x3c96('0x2b')](_0x3c96('0x2c'),'>');}}return _0x11d60f;}function parseSearchFilter(_0xdbef53,_0x5a4fc0){var _0x51bffd=squel[_0x3c96('0x26')]();if(_0x5a4fc0){var _0x484683=_0x5a4fc0[_0x3c96('0x2b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x484683)){_0x51bffd['or'](_0x3c96('0x2d'),_0x484683+'%');if([_0x3c96('0x2e'),_0x3c96('0x2f')]['includes'](_0xdbef53)){_0x51bffd['or'](_0x3c96('0x30'),_0x484683+'%');}else if(_0xdbef53===_0x3c96('0x31')){_0x51bffd['or'](_0x3c96('0x32'),_0x484683+'%');}else if(_0xdbef53===_0x3c96('0x33')){_0x51bffd['or'](_0x3c96('0x34'),_0x484683+'%');}}else if(_0xdbef53==='mail'&&qs[_0x3c96('0x35')](_0x484683)){_0x51bffd['or']('c.email\x20LIKE\x20?',_0x484683+'%');}else{if(_0xdbef53===_0x3c96('0x36')){_0x51bffd['or'](_0x3c96('0x37'),qs[_0x3c96('0x38')](_0x484683,!![]))['or'](_0x3c96('0x39'),qs[_0x3c96('0x38')](_0x484683));}else if(_0xdbef53!==_0x3c96('0x31')){_0x51bffd['or'](_0x3c96('0x3a'),qs[_0x3c96('0x38')](_0x484683));}_0x51bffd['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3c96('0x38')](_0x484683,!![]),null);}}return _0x51bffd;}function parseAdvancedSearchFilter(_0x21542e,_0x2b09ab){var _0x3de53b=getSqlClauses();var _0x2f1145=as['parseSearch'](_0x21542e);var _0x1265bb=_0x2f1145[_0x3c96('0x3b')];for(var _0x546b97=0x0;_0x546b97<_0x2f1145[_0x3c96('0x3c')][_0x3c96('0x15')];_0x546b97++){var _0x38600e=_0x2f1145[_0x3c96('0x3c')][_0x546b97];var _0x7c0852='i';var _0x4215e8=_[_0x3c96('0x3d')](_0x2b09ab,['name',_0x38600e[_0x3c96('0xb')]]);if(_0x4215e8){var _0x7cb0d7=as['buildExpression'](_0x7c0852,_0x4215e8['type'],_0x38600e);_0x3de53b[_0x3c96('0x3e')][_0x1265bb](_0x7cb0d7['text'],_0x7cb0d7[_0x3c96('0x3f')]['start'],_0x7cb0d7[_0x3c96('0x3f')][_0x3c96('0x40')]);}else{switch(_0x38600e[_0x3c96('0xb')]){case _0x3c96('0x41'):var _0x41092f=parseReadParameter(_0x38600e[_0x3c96('0x3f')]);_0x3de53b[_0x3c96('0x42')][_0x3c96('0x43')](_0x41092f);break;case'Contact':if(_0x38600e[_0x3c96('0x44')]===_0x3c96('0x45')){if(_0x38600e[_0x3c96('0x3f')][_0x3c96('0x46')]('\x20')[_0x3c96('0x15')]>0x1){_0x3de53b[_0x3c96('0x47')][_0x1265bb](_0x3c96('0x48'),qs['getFullTextValue'](_0x38600e[_0x3c96('0x3f')],!![]),null);}else{var _0x22c6b8='%'+_0x38600e['value']+'%';_0x3de53b[_0x3c96('0x47')][_0x1265bb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x22c6b8,_0x22c6b8,_0x22c6b8);}}else{_0x4215e8=_[_0x3c96('0x3d')](_0x2b09ab,[_0x3c96('0xc'),_0x3c96('0x49')]);_0x38600e[_0x3c96('0xb')]='ContactId';_0x7cb0d7=as[_0x3c96('0x4a')](_0x7c0852,_0x4215e8[_0x3c96('0x4b')],_0x38600e);_0x3de53b[_0x3c96('0x47')][_0x1265bb](_0x7cb0d7[_0x3c96('0x4c')],_0x7cb0d7[_0x3c96('0x3f')]['start'],_0x7cb0d7['value'][_0x3c96('0x40')]);}break;case _0x3c96('0x4d'):var _0x25da80=_0x38600e[_0x3c96('0x3f')]['split'](',')[_0x3c96('0x18')](function(_0x798b96){return Number(_0x798b96);});var _0x1826b3=parseTagParameter(_0x25da80);_0x3de53b[_0x3c96('0x4e')][_0x3c96('0x4f')][_0x3c96('0x43')](_0x1826b3);_0x3de53b[_0x3c96('0x4e')][_0x3c96('0x50')]=_0x25da80;break;case _0x3c96('0x51'):if(_0x38600e[_0x3c96('0x44')]===_0x3c96('0x45')){_0x3de53b[_0x3c96('0x52')][_0x1265bb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x38600e['value']+'%',null);}else{_0x4215e8=_[_0x3c96('0x3d')](_0x2b09ab,[_0x3c96('0xc'),'UserId']);_0x38600e[_0x3c96('0xb')]=_0x3c96('0x53');_0x7cb0d7=as[_0x3c96('0x4a')](_0x7c0852,_0x4215e8[_0x3c96('0x4b')],_0x38600e);_0x3de53b['user'][_0x1265bb](_0x7cb0d7[_0x3c96('0x4c')],_0x7cb0d7['value'][_0x3c96('0x54')],_0x7cb0d7['value'][_0x3c96('0x40')]);}break;case _0x3c96('0x55'):case _0x3c96('0x56'):_0x7cb0d7=as[_0x3c96('0x4a')]('me',null,_0x38600e);_0x3de53b[_0x3c96('0x55')][_0x1265bb](_0x7cb0d7[_0x3c96('0x4c')],_0x7cb0d7[_0x3c96('0x3f')][_0x3c96('0x54')],_0x7cb0d7['value'][_0x3c96('0x40')]);break;}}}return _0x3de53b;}function parseModelFields(_0x5613a4,_0x500db2,_0x24ed49){var _0xb86b9f=utils[_0x3c96('0x7')](_0x5613a4);var _0x2334d1=squel[_0x3c96('0x26')]();var _0x39140f=_(_0x500db2)[_0x3c96('0x57')]()[_0x3c96('0x18')](function(_0x5b1c9e){return _[_0x3c96('0x58')](_0x24ed49,['name',_0x5b1c9e])?_0x5b1c9e:undefined;})[_0x3c96('0x59')]()[_0x3c96('0x3f')]();if(_0x39140f[_0x3c96('0x15')]>0x0){_0x39140f['forEach'](function(_0x2c9245){if(_0x2c9245===_0xb86b9f){_0x2334d1['and']('i.'+_0xb86b9f+'\x20IN\x20?',[][_0x3c96('0x5a')](_0x500db2[_0x2c9245]));}else if(_0x2c9245==='createdAt'){var _0x4fa6e4=JSON[_0x3c96('0x5b')](_0x500db2[_0x2c9245])[_0x3c96('0x5c')];var _0x30a885=JSON[_0x3c96('0x5b')](_0x500db2[_0x2c9245])[_0x3c96('0x5d')];_0x2334d1[_0x3c96('0x43')](_0x3c96('0x5e'),_0x4fa6e4,_0x30a885);}else{if(_0x500db2[_0x2c9245]===_0x3c96('0x5f')){_0x2334d1[_0x3c96('0x43')]('i.'+_0x2c9245+_0x3c96('0x60'));}else{_0x2334d1[_0x3c96('0x43')]('i.'+_0x2c9245+_0x3c96('0x61'),_0x500db2[_0x2c9245]);}}});}return _0x2334d1;}function parseQueryParameters(_0x3eeca3,_0x42ca1f,_0x4353a0){var _0x14e37b=getSqlClauses();return Promise[_0x3c96('0x62')]()[_0x3c96('0x63')](function(){return parseModelFields(_0x3eeca3,_0x42ca1f,_0x4353a0);})[_0x3c96('0x63')](function(_0x20a724){_0x14e37b['fields'][_0x3c96('0x43')](_0x20a724);return parseReadParameter(_0x42ca1f[_0x3c96('0x42')]);})[_0x3c96('0x63')](function(_0x4911ac){_0x14e37b['read']['and'](_0x4911ac);return parseTagParameter(_0x42ca1f[_0x3c96('0x64')]);})[_0x3c96('0x63')](function(_0x2ad71c){_0x14e37b[_0x3c96('0x4e')][_0x3c96('0x4f')][_0x3c96('0x43')](_0x2ad71c);return parseSearchFilter(_0x3eeca3,_0x42ca1f[_0x3c96('0x65')]);})[_0x3c96('0x63')](function(_0x597637){_0x14e37b[_0x3c96('0x65')]=_0x597637;return _0x14e37b;});}function checkAccountsRestrictions(_0x3d15e0,_0x41951d,_0x1dfea7){var _0x1c6897=utils[_0x3c96('0x7')](_0x3d15e0);var _0x16c337=_0x3c96('0x66')+_[_0x3c96('0x67')](_0x3d15e0)+(_0x3d15e0===_0x3c96('0x68')?_0x3c96('0x69'):'Accounts');var _0x2f7570=squel[_0x3c96('0x26')]();return Promise[_0x3c96('0x62')]()[_0x3c96('0x63')](function(){if(_0x1dfea7['search']&&_0x41951d[_0x3c96('0x8')]===_0x3c96('0x6a')){return _0x41951d[_0x16c337]({'attributes':['id'],'raw':!![]});}})[_0x3c96('0x63')](function(_0x2cbd8a){if(_0x2cbd8a){if(_0x2cbd8a[_0x3c96('0x15')]===0x0){_0x2f7570[_0x3c96('0x43')]('i.'+_0x1c6897+_0x3c96('0x60'));}else{_0x2f7570[_0x3c96('0x43')]('i.'+_0x1c6897+'\x20IN\x20?',_['map'](_0x2cbd8a,'id'));}}else if(!_0x1dfea7[_0x1c6897]){_0x2f7570[_0x3c96('0x43')]('i.'+_0x1c6897+'\x20IS\x20NOT\x20NULL');}})[_0x3c96('0x63')](function(){return _0x2f7570;});}function getClosedOrderClause(_0x57e90f,_0x920341){var _0x3cc284='';var _0x1e3461=[_0x3c96('0x6b'),_0x3c96('0x6c'),_0x3c96('0x6d')];if(_0x57e90f==='mail'){_0x1e3461[_0x3c96('0x6e')](_0x3c96('0x6f'));}if(_0x920341[_0x3c96('0x70')]==='0'&&_0x57e90f===_0x3c96('0x36')){_0x3cc284='i.substatus';}else{if(_0x920341[_0x3c96('0x70')]==='1'){_0x1e3461[_0x3c96('0x71')]();}_0x3cc284=_0x3c96('0x72')+_0x1e3461[_0x3c96('0x73')](',\x20')+')';}return _0x3cc284;}function getFilteredInteractions(_0x3c3c16,_0xbfd684,_0x33928b,_0x4506a6){var _0x24c224=utils[_0x3c96('0x1a')](_0x3c3c16);var _0x39d0ea=_[_0x3c96('0x67')](_0x3c3c16)+_0x3c96('0x74');var _0x4cad93=[];var _0x27feb3=getTagsQuery();var _0x162e1a={'type':db['Sequelize']['QueryTypes'][_0x3c96('0x75')],'raw':!![]};var _0x155ef6=[];var _0x130d90=[];return db[_0x3c96('0x76')][_0x3c96('0x77')](_0x27feb3[_0x3c96('0x78')](),_0x162e1a)[_0x3c96('0x63')](function(_0x481b88){_0x4cad93=_['keyBy'](_0x481b88,'id');_0x162e1a=_[_0x3c96('0x79')](_0x162e1a,{'model':db[_0x39d0ea],'mapToModel':!![],'nest':!![]});if(_0x33928b[_0x3c96('0x7a')]){_0x4506a6['attributes'][_0x3c96('0x28')](function(_0x26471d){_0xbfd684['field']('i.'+_0x26471d);});}else{_0xbfd684[_0x3c96('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3c96('0x41'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x7b'),_0x3c96('0x7c'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x7d'),_0x3c96('0x7e'));if(_0x3c3c16==='mail'){_0xbfd684[_0x3c96('0xb')]('a.email',_0x3c96('0x7f'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x80'),_0x3c96('0x81'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x82'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x83'));_0xbfd684['field'](_0x3c96('0x84'));_0xbfd684['field'](_0x3c96('0x85'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x86'));_0xbfd684['field'](_0x3c96('0x87'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x88'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x89'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x8a'));_0xbfd684['field'](_0x3c96('0x6d'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x6c'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x6b'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x6f'));_0xbfd684[_0x3c96('0xb')]('i.to');_0xbfd684[_0x3c96('0xb')](_0x3c96('0x8b'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x8c'));_0xbfd684['field'](_0x3c96('0x8d'));}else if(_0x3c3c16===_0x3c96('0x33')){_0xbfd684[_0x3c96('0xb')](_0x3c96('0x8e'),_0x3c96('0x81'));}else{_0xbfd684[_0x3c96('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',_0x3c96('0x81'));}if(_0x3c3c16!=='mail'){_0xbfd684[_0x3c96('0xb')]('i.*');}_0xbfd684[_0x3c96('0xb')]('c.firstName',_0x3c96('0x8f'));_0xbfd684['field'](_0x3c96('0x90'),_0x3c96('0x91'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x92'),'Contact.email');_0xbfd684[_0x3c96('0xb')]('c.phone',_0x3c96('0x93'));_0xbfd684['field'](_0x3c96('0x94'),_0x3c96('0x95'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x96'),_0x3c96('0x97'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x98'),_0x3c96('0x99'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x9a'),_0x3c96('0x9b'));_0xbfd684[_0x3c96('0xb')](_0x3c96('0x9c'),_0x3c96('0x9d'));}if(_0x4506a6[_0x3c96('0x9e')]){_0xbfd684['limit'](_0x4506a6[_0x3c96('0x9e')]);}if(_0x4506a6[_0x3c96('0x9f')]){_0xbfd684[_0x3c96('0x9f')](_0x4506a6['offset']);}return db[_0x3c96('0x76')]['query'](_0xbfd684[_0x3c96('0x78')](),_0x162e1a);})[_0x3c96('0x63')](function(_0x1023ea){_0x155ef6=_0x1023ea;var _0x5a5b9b=getUsersQuery(_0x3c3c16,_0x155ef6);return db['sequelize']['query'](_0x5a5b9b[_0x3c96('0x78')](),_0x162e1a);})['then'](function(_0x40a2f5){_0x130d90=_[_0x3c96('0xa0')](_0x40a2f5,_0x24c224);if(_0x3c3c16===_0x3c96('0x36')){return db[_0x3c96('0xa1')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x3c96('0x63')](function(_0x34782e){var _0x524d10=_0x34782e?_0x34782e['enableEmailPreview']:undefined;var _0x5eb71=_0x155ef6[_0x3c96('0x18')](function(_0x62a461){return updateInteraction(_0x62a461,_0x4cad93,_0x130d90,_0x524d10);});return Promise[_0x3c96('0xa2')](_0x5eb71);});}function countFilteredInteractions(_0x558309,_0x586703){var _0x30a5bb=_0x558309['clone']();_0x30a5bb[_0x3c96('0xb')](_0x3c96('0xa3'));_0x30a5bb[_0x3c96('0xb')](_0x3c96('0xa4'),_0x3c96('0x41'));var _0x2319ba=utils[_0x3c96('0x27')](_0x586703);if(!_[_0x3c96('0xa5')](_0x2319ba)){_0x30a5bb['where'](_0x3c96('0xa6'),_0x2319ba);}var _0x11fcab={'type':db[_0x3c96('0xa7')][_0x3c96('0xa8')][_0x3c96('0x75')],'raw':!![]};return db[_0x3c96('0x76')][_0x3c96('0x77')](_0x30a5bb[_0x3c96('0x78')](),_0x11fcab);}module[_0x3c96('0xa9')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x670a=['i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','exports','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','select','field','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','interactions','cm_contacts','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','value','read','and','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','name','ContactId','text','start','Tag','map','tags','clause','ids','User','user','body','plainBody','end','keys','some','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','resolve','then','fields','tag','filter','get','chat','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','Account.mandatoryDisposition','contactName','i.id','i.createdAt','i.closed'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x670a,0x172));var _0xa670=function(_0x5a2be1,_0xca851c){_0x5a2be1=_0x5a2be1-0x0;var _0x1a21e4=_0x670a[_0x5a2be1];return _0x1a21e4;};'use strict';var _=require('lodash');var squel=require(_0xa670('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xa670('0x1'));var updateInteraction=require(_0xa670('0x2'))[_0xa670('0x3')];var utils=require(_0xa670('0x4'));var db=require(_0xa670('0x5'))['db'];function skipInteractionsQuery(_0x36ec77,_0x38aa1d,_0x5bd632){var _0x255ccc=![];var _0xc84fe2=utils[_0xa670('0x6')](_0x36ec77);if(_0x38aa1d[_0xa670('0x7')]===_0xa670('0x8')&&!_0x5bd632['search']&&!_0x5bd632[_0xc84fe2]){_0x255ccc=!![];}return _0x255ccc;}function getTagsQuery(){return squel[_0xa670('0x9')]()[_0xa670('0xa')]('id')['field']('name')['field'](_0xa670('0xb'))[_0xa670('0xc')](_0xa670('0xd'));}function getUsersQuery(_0x4ddf84,_0x4761b9){var _0x883faa=utils[_0xa670('0xe')](_0x4ddf84);var _0x137bef=_0xa670('0xf')+_0x4ddf84+_0xa670('0x10');var _0x348520=squel[_0xa670('0x9')]()[_0xa670('0xa')](_0xa670('0x11'))['field'](_0xa670('0x12'))[_0xa670('0xa')](_0xa670('0x13')+_0x883faa)[_0xa670('0xc')](_0x137bef,'ui')[_0xa670('0x14')](_0xa670('0x15'),'u',_0xa670('0x16'));if(_0x4761b9[_0xa670('0x17')]>0x0){_0x348520[_0xa670('0x18')](_0xa670('0x13')+_0x883faa+_0xa670('0x19'),_['map'](_0x4761b9,'id'));}return _0x348520;}function getInteractionsQuery(_0x25b303){var _0x3a0d8f=utils[_0xa670('0x1a')](_0x25b303);var _0x3009b1=utils['getAccountFK'](_0x25b303);var _0x1309a2=utils[_0xa670('0xe')](_0x25b303);return squel['select']()[_0xa670('0xc')](_0x3a0d8f[_0xa670('0x1b')],'i')[_0xa670('0x14')](_0xa670('0x1c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xa670('0x1d'))['left_join'](_0x3a0d8f['accounts'],'a',_0xa670('0x1e')+_0x3009b1)['left_join'](_0x3a0d8f['messages'],'me',_0xa670('0x1f')+_0x1309a2+_0xa670('0x20'))['left_join'](_0x3a0d8f[_0xa670('0x21')],'it',_0xa670('0x22')+_0x1309a2+'\x20=\x20i.id')['left_join'](_0xa670('0xd'),'t',_0xa670('0x23'));}function getSqlClauses(){var _0xaaf35a={'body':squel[_0xa670('0x24')](),'contact':squel[_0xa670('0x24')](),'default':squel['expr'](),'fields':squel[_0xa670('0x24')](),'filter':squel[_0xa670('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0xa670('0x24')](),'ids':null},'user':squel[_0xa670('0x24')]()};return _0xaaf35a;}function parseTagParameter(_0x7f2b7c){var _0x5066b9=squel['expr']();if(_0x7f2b7c){var _0x28ca08=utils['getSelectedTags'](_0x7f2b7c);_0x28ca08[_0xa670('0x25')](function(_0x8c34c9){_0x5066b9['or'](_0xa670('0x26'),'%,'+_0x8c34c9+',%');});}return _0x5066b9;}function parseReadParameter(_0x43f430){var _0xb218d='';if(_0x43f430){_0xb218d='unreadMessages\x20{OPERATOR}\x200';if(_0x43f430==='1'){_0xb218d=_0xb218d[_0xa670('0x27')]('{OPERATOR}','=');}else{_0xb218d=_0xb218d[_0xa670('0x27')](_0xa670('0x28'),'>');}}return _0xb218d;}function parseSearchFilter(_0x276107,_0xec7d70){var _0x690b72=squel[_0xa670('0x24')]();if(_0xec7d70){var _0x1f4efd=_0xec7d70['replace']('\x5c','\x5c\x5c')[_0xa670('0x27')](/'/g,'\x27\x27');if(qs[_0xa670('0x29')](_0x1f4efd)){_0x690b72['or'](_0xa670('0x2a'),_0x1f4efd+'%');if([_0xa670('0x2b'),_0xa670('0x2c')][_0xa670('0x2d')](_0x276107)){_0x690b72['or'](_0xa670('0x2e'),_0x1f4efd+'%');}else if(_0x276107===_0xa670('0x2f')){_0x690b72['or'](_0xa670('0x30'),_0x1f4efd+'%');}else if(_0x276107===_0xa670('0x31')){_0x690b72['or']('i.from\x20LIKE\x20?',_0x1f4efd+'%');}}else if(_0x276107===_0xa670('0x32')&&qs[_0xa670('0x33')](_0x1f4efd)){_0x690b72['or'](_0xa670('0x34'),_0x1f4efd+'%');}else{if(_0x276107===_0xa670('0x32')){_0x690b72['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1f4efd,!![]))['or'](_0xa670('0x35'),qs[_0xa670('0x36')](_0x1f4efd));}else if(_0x276107!==_0xa670('0x2f')){_0x690b72['or'](_0xa670('0x37'),qs[_0xa670('0x36')](_0x1f4efd));}_0x690b72['or'](_0xa670('0x38'),qs[_0xa670('0x36')](_0x1f4efd,!![]),null);}}return _0x690b72;}function parseAdvancedSearchFilter(_0x103c86,_0x463e97){var _0x17005c=getSqlClauses();var _0x2ee196=as[_0xa670('0x39')](_0x103c86);var _0x20535e=_0x2ee196[_0xa670('0x3a')];for(var _0x48aadb=0x0;_0x48aadb<_0x2ee196[_0xa670('0x3b')][_0xa670('0x17')];_0x48aadb++){var _0x388136=_0x2ee196['conditions'][_0x48aadb];var _0x5bb1fa='i';var _0x261e7e=_[_0xa670('0x3c')](_0x463e97,['name',_0x388136[_0xa670('0xa')]]);if(_0x261e7e){var _0x25a98f=as[_0xa670('0x3d')](_0x5bb1fa,_0x261e7e[_0xa670('0x3e')],_0x388136);_0x17005c[_0xa670('0x3f')][_0x20535e](_0x25a98f['text'],_0x25a98f[_0xa670('0x40')]['start'],_0x25a98f['value']['end']);}else{switch(_0x388136[_0xa670('0xa')]){case'unreadMessages':var _0x5d546c=parseReadParameter(_0x388136[_0xa670('0x40')]);_0x17005c[_0xa670('0x41')][_0xa670('0x42')](_0x5d546c);break;case'Contact':if(_0x388136[_0xa670('0x43')]===_0xa670('0x44')){if(_0x388136['value'][_0xa670('0x45')]('\x20')[_0xa670('0x17')]>0x1){_0x17005c[_0xa670('0x46')][_0x20535e](_0xa670('0x38'),qs[_0xa670('0x36')](_0x388136[_0xa670('0x40')],!![]),null);}else{var _0x3b6fe3='%'+_0x388136['value']+'%';_0x17005c[_0xa670('0x46')][_0x20535e](_0xa670('0x47'),_0x3b6fe3,_0x3b6fe3,_0x3b6fe3);}}else{_0x261e7e=_[_0xa670('0x3c')](_0x463e97,[_0xa670('0x48'),_0xa670('0x49')]);_0x388136[_0xa670('0xa')]=_0xa670('0x49');_0x25a98f=as[_0xa670('0x3d')](_0x5bb1fa,_0x261e7e[_0xa670('0x3e')],_0x388136);_0x17005c[_0xa670('0x46')][_0x20535e](_0x25a98f[_0xa670('0x4a')],_0x25a98f[_0xa670('0x40')][_0xa670('0x4b')],_0x25a98f['value']['end']);}break;case _0xa670('0x4c'):var _0x5a109b=_0x388136[_0xa670('0x40')]['split'](',')[_0xa670('0x4d')](function(_0x8144e1){return Number(_0x8144e1);});var _0x60fe46=parseTagParameter(_0x5a109b);_0x17005c[_0xa670('0x4e')][_0xa670('0x4f')]['and'](_0x60fe46);_0x17005c['tags'][_0xa670('0x50')]=_0x5a109b;break;case _0xa670('0x51'):if(_0x388136[_0xa670('0x43')]===_0xa670('0x44')){_0x17005c[_0xa670('0x52')][_0x20535e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x388136[_0xa670('0x40')]+'%',null);}else{_0x261e7e=_['find'](_0x463e97,[_0xa670('0x48'),'UserId']);_0x388136[_0xa670('0xa')]='UserId';_0x25a98f=as[_0xa670('0x3d')](_0x5bb1fa,_0x261e7e[_0xa670('0x3e')],_0x388136);_0x17005c[_0xa670('0x52')][_0x20535e](_0x25a98f[_0xa670('0x4a')],_0x25a98f['value'][_0xa670('0x4b')],_0x25a98f['value']['end']);}break;case _0xa670('0x53'):case _0xa670('0x54'):_0x25a98f=as[_0xa670('0x3d')]('me',null,_0x388136);_0x17005c[_0xa670('0x53')][_0x20535e](_0x25a98f[_0xa670('0x4a')],_0x25a98f[_0xa670('0x40')]['start'],_0x25a98f['value'][_0xa670('0x55')]);break;}}}return _0x17005c;}function parseModelFields(_0x3a65ea,_0x576a1b,_0x492f3f){var _0x23174e=utils['getAccountFK'](_0x3a65ea);var _0x3d9406=squel[_0xa670('0x24')]();var _0x1a6b56=_(_0x576a1b)[_0xa670('0x56')]()[_0xa670('0x4d')](function(_0x2b939c){return _[_0xa670('0x57')](_0x492f3f,['name',_0x2b939c])?_0x2b939c:undefined;})[_0xa670('0x58')]()[_0xa670('0x40')]();if(_0x1a6b56['length']>0x0){_0x1a6b56[_0xa670('0x25')](function(_0x2d4c23){if(_0x2d4c23===_0x23174e){_0x3d9406[_0xa670('0x42')]('i.'+_0x23174e+_0xa670('0x19'),[][_0xa670('0x59')](_0x576a1b[_0x2d4c23]));}else if(_0x2d4c23===_0xa670('0x5a')){var _0x183348=JSON[_0xa670('0x5b')](_0x576a1b[_0x2d4c23])[_0xa670('0x5c')];var _0xf9c3b6=JSON[_0xa670('0x5b')](_0x576a1b[_0x2d4c23])[_0xa670('0x5d')];_0x3d9406[_0xa670('0x42')](_0xa670('0x5e'),_0x183348,_0xf9c3b6);}else{if(_0x576a1b[_0x2d4c23]==='null'){_0x3d9406[_0xa670('0x42')]('i.'+_0x2d4c23+_0xa670('0x5f'));}else{_0x3d9406[_0xa670('0x42')]('i.'+_0x2d4c23+'\x20=\x20?',_0x576a1b[_0x2d4c23]);}}});}return _0x3d9406;}function parseQueryParameters(_0x3781d9,_0x122f1e,_0x3f60c7){var _0x52dafa=getSqlClauses();return Promise[_0xa670('0x60')]()[_0xa670('0x61')](function(){return parseModelFields(_0x3781d9,_0x122f1e,_0x3f60c7);})[_0xa670('0x61')](function(_0x133b3e){_0x52dafa[_0xa670('0x62')][_0xa670('0x42')](_0x133b3e);return parseReadParameter(_0x122f1e[_0xa670('0x41')]);})[_0xa670('0x61')](function(_0x599a2e){_0x52dafa[_0xa670('0x41')][_0xa670('0x42')](_0x599a2e);return parseTagParameter(_0x122f1e[_0xa670('0x63')]);})[_0xa670('0x61')](function(_0x2ed097){_0x52dafa['tags'][_0xa670('0x4f')][_0xa670('0x42')](_0x2ed097);return parseSearchFilter(_0x3781d9,_0x122f1e[_0xa670('0x64')]);})[_0xa670('0x61')](function(_0x5ad0bf){_0x52dafa[_0xa670('0x64')]=_0x5ad0bf;return _0x52dafa;});}function checkAccountsRestrictions(_0xc70561,_0x1fb7bb,_0x387ecd){var _0x25cd6a=utils[_0xa670('0x6')](_0xc70561);var _0x5a9ed6=_0xa670('0x65')+_['capitalize'](_0xc70561)+(_0xc70561===_0xa670('0x66')?_0xa670('0x67'):_0xa670('0x68'));var _0x44b2ba=squel[_0xa670('0x24')]();return Promise[_0xa670('0x60')]()[_0xa670('0x61')](function(){if(_0x387ecd[_0xa670('0x69')]&&_0x1fb7bb[_0xa670('0x7')]===_0xa670('0x8')){return _0x1fb7bb[_0x5a9ed6]({'attributes':['id'],'raw':!![]});}})[_0xa670('0x61')](function(_0x1cbe19){if(_0x1cbe19){if(_0x1cbe19[_0xa670('0x17')]===0x0){_0x44b2ba[_0xa670('0x42')]('i.'+_0x25cd6a+_0xa670('0x5f'));}else{_0x44b2ba[_0xa670('0x42')]('i.'+_0x25cd6a+_0xa670('0x19'),_[_0xa670('0x4d')](_0x1cbe19,'id'));}}else if(!_0x387ecd[_0x25cd6a]){_0x44b2ba['and']('i.'+_0x25cd6a+_0xa670('0x6a'));}})[_0xa670('0x61')](function(){return _0x44b2ba;});}function getClosedOrderClause(_0x45f906,_0xcbf1cd){var _0x31a987='';var _0x1014c0=['i.thirdDisposition',_0xa670('0x6b'),_0xa670('0x6c')];if(_0x45f906===_0xa670('0x32')){_0x1014c0[_0xa670('0x6d')](_0xa670('0x6e'));}if(_0xcbf1cd[_0xa670('0x6f')]==='0'&&_0x45f906==='mail'){_0x31a987=_0xa670('0x6e');}else{if(_0xcbf1cd[_0xa670('0x6f')]==='1'){_0x1014c0[_0xa670('0x70')]();}_0x31a987=_0xa670('0x71')+_0x1014c0['join'](',\x20')+')';}return _0x31a987;}function getFilteredInteractions(_0x33e6d2,_0x31823b,_0xb31a1e,_0x23840b){var _0x28fff8=utils[_0xa670('0xe')](_0x33e6d2);var _0x561649=_[_0xa670('0x72')](_0x33e6d2)+_0xa670('0x73');var _0x4a8816=[];var _0x254598=getTagsQuery();var _0x5b6293={'type':db[_0xa670('0x74')][_0xa670('0x75')][_0xa670('0x76')],'raw':!![]};var _0x37642c=[];var _0x3756be=[];return db[_0xa670('0x77')][_0xa670('0x78')](_0x254598[_0xa670('0x79')](),_0x5b6293)['then'](function(_0x4dee11){_0x4a8816=_[_0xa670('0x7a')](_0x4dee11,'id');_0x5b6293=_[_0xa670('0x7b')](_0x5b6293,{'model':db[_0x561649],'mapToModel':!![],'nest':!![]});if(_0xb31a1e[_0xa670('0x62')]){_0x23840b[_0xa670('0x7c')][_0xa670('0x25')](function(_0x4a8cce){_0x31823b[_0xa670('0xa')]('i.'+_0x4a8cce);});}else{_0x31823b[_0xa670('0xa')](_0xa670('0x7d'),_0xa670('0x7e'));_0x31823b[_0xa670('0xa')](_0xa670('0x7f'),_0xa670('0x80'));_0x31823b[_0xa670('0xa')]('a.mandatoryDisposition',_0xa670('0x81'));if(_0x33e6d2==='mail'){_0x31823b['field']('a.email','Account.email');_0x31823b[_0xa670('0xa')]('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',_0xa670('0x82'));_0x31823b[_0xa670('0xa')](_0xa670('0x83'));_0x31823b[_0xa670('0xa')](_0xa670('0x84'));_0x31823b['field']('i.updatedAt');_0x31823b[_0xa670('0xa')](_0xa670('0x85'));_0x31823b[_0xa670('0xa')](_0xa670('0x86'));_0x31823b[_0xa670('0xa')](_0xa670('0x87'));_0x31823b[_0xa670('0xa')](_0xa670('0x88'));_0x31823b[_0xa670('0xa')](_0xa670('0x89'));_0x31823b[_0xa670('0xa')]('i.subject');_0x31823b[_0xa670('0xa')](_0xa670('0x6c'));_0x31823b['field'](_0xa670('0x6b'));_0x31823b[_0xa670('0xa')](_0xa670('0x8a'));_0x31823b['field'](_0xa670('0x6e'));_0x31823b[_0xa670('0xa')](_0xa670('0x8b'));_0x31823b[_0xa670('0xa')](_0xa670('0x8c'));_0x31823b['field'](_0xa670('0x8d'));_0x31823b[_0xa670('0xa')](_0xa670('0x8e'));}else if(_0x33e6d2===_0xa670('0x31')){_0x31823b['field'](_0xa670('0x8f'),'contactName');}else{_0x31823b[_0xa670('0xa')]('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',_0xa670('0x82'));}if(_0x33e6d2!==_0xa670('0x32')){_0x31823b['field'](_0xa670('0x90'));}_0x31823b[_0xa670('0xa')](_0xa670('0x91'),'Contact.firstName');_0x31823b[_0xa670('0xa')](_0xa670('0x92'),_0xa670('0x93'));_0x31823b[_0xa670('0xa')](_0xa670('0x94'),_0xa670('0x95'));_0x31823b['field']('c.phone','Contact.phone');_0x31823b['field'](_0xa670('0x96'),_0xa670('0x97'));_0x31823b[_0xa670('0xa')](_0xa670('0x98'),'Contact.fax');_0x31823b[_0xa670('0xa')](_0xa670('0x99'),'Owner.fullname');_0x31823b['field'](_0xa670('0x9a'),_0xa670('0x9b'));_0x31823b['field'](_0xa670('0x9c'),_0xa670('0x9d'));}if(_0x23840b['limit']){_0x31823b['limit'](_0x23840b[_0xa670('0x9e')]);}if(_0x23840b[_0xa670('0x9f')]){_0x31823b[_0xa670('0x9f')](_0x23840b[_0xa670('0x9f')]);}return db[_0xa670('0x77')][_0xa670('0x78')](_0x31823b[_0xa670('0x79')](),_0x5b6293);})[_0xa670('0x61')](function(_0x1d1c45){_0x37642c=_0x1d1c45;var _0x12474b=getUsersQuery(_0x33e6d2,_0x37642c);return db[_0xa670('0x77')][_0xa670('0x78')](_0x12474b[_0xa670('0x79')](),_0x5b6293);})[_0xa670('0x61')](function(_0xde563a){_0x3756be=_[_0xa670('0xa0')](_0xde563a,_0x28fff8);if(_0x33e6d2==='mail'){return db[_0xa670('0xa1')]['findOne']({'attributes':[_0xa670('0xa2')],'raw':!![]});}})[_0xa670('0x61')](function(_0x14cc2b){var _0x257ba7=_0x14cc2b?_0x14cc2b[_0xa670('0xa2')]:undefined;var _0x208c9d=_0x37642c[_0xa670('0x4d')](function(_0x2ee0c1){return updateInteraction(_0x2ee0c1,_0x4a8816,_0x3756be,_0x257ba7);});return Promise[_0xa670('0xa3')](_0x208c9d);});}function countFilteredInteractions(_0x40de44,_0x203581){var _0x5e50f0=_0x40de44[_0xa670('0xa4')]();_0x5e50f0[_0xa670('0xa')](_0xa670('0xa5'));_0x5e50f0[_0xa670('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x5dca3e=utils['getSelectedTags'](_0x203581);if(!_[_0xa670('0xa6')](_0x5dca3e)){_0x5e50f0['where']('t.id\x20IN\x20?',_0x5dca3e);}var _0x12b924={'type':db[_0xa670('0x74')][_0xa670('0x75')][_0xa670('0x76')],'raw':!![]};return db[_0xa670('0x77')][_0xa670('0x78')](_0x5e50f0[_0xa670('0x79')](),_0x12b924);}module[_0xa670('0xa7')]={'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 49c4eb7..24819bf 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 _0x125f=['Users','TagIds','Tags','catch','lodash','map','fullname','forEach','push','waiting','abandoned','total','closed','UserId','answered','disposition','unmanaged','talking','MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart','updateInteraction'];(function(_0x48b081,_0x3caf44){var _0x5bafe8=function(_0x28cefb){while(--_0x28cefb){_0x48b081['push'](_0x48b081['shift']());}};_0x5bafe8(++_0x3caf44);}(_0x125f,0x1be));var _0xf125=function(_0x37bcd8,_0x27bed9){_0x37bcd8=_0x37bcd8-0x0;var _0x422480=_0x125f[_0x37bcd8];return _0x422480;};'use strict';var _=require(_0xf125('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x670b75,_0x2dc0d2){return new Promise(function(_0x569e5e,_0x28c3ec){try{var _0x553389=[];if(_0x2dc0d2[_0x670b75]){_0x553389=_0x2dc0d2[_0x670b75][_0xf125('0x1')](function(_0x41e6a2){return{'id':_0x41e6a2['id'],'fullname':_0x41e6a2[_0xf125('0x2')]};});}return _0x569e5e(_0x553389);}catch(_0x30d5e9){_0x28c3ec(_0x30d5e9);}});}function getInteractionTags(_0x576df8,_0x4b055e){var _0x340c53=[];if(_0x576df8){_0x576df8['split'](',')[_0xf125('0x3')](function(_0x3d744c){_0x340c53[_0xf125('0x4')](_0x4b055e[_0x3d744c]);});}return _0x340c53;}function updateWaitingCounter(_0x284418){if(_0x284418['waiting']){_0x284418[_0xf125('0x5')]-=0x1;}}function updateInteractionCounters(_0x1579f1){_0x1579f1[_0xf125('0x5')]=0x0;_0x1579f1['talking']=0x0;_0x1579f1['answered']=0x0;_0x1579f1['unmanaged']=0x0;_0x1579f1[_0xf125('0x6')]=0x0;_0x1579f1[_0xf125('0x7')]=0x0;if(_0x1579f1[_0xf125('0x8')]){if(_0x1579f1['disposition']===_0xf125('0x6')){_0x1579f1['abandoned']+=0x1;updateWaitingCounter(_0x1579f1);}if(_0x1579f1[_0xf125('0x9')]){_0x1579f1[_0xf125('0xa')]+=0x1;if(_0x1579f1['talking']){_0x1579f1['talking']-=0x1;}}else{if(_0x1579f1[_0xf125('0xb')]){_0x1579f1[_0xf125('0xc')]+=0x1;updateWaitingCounter(_0x1579f1);}}}else{if(!_0x1579f1[_0xf125('0x9')]){_0x1579f1[_0xf125('0x5')]+=0x1;}if(_0x1579f1[_0xf125('0x9')]){_0x1579f1[_0xf125('0xd')]+=0x1;updateWaitingCounter(_0x1579f1);}}_0x1579f1['total']+=0x1;return _0x1579f1;}function getLastMessageText(_0x5d13d1){return db[_0xf125('0xe')][_0xf125('0xf')]({'where':{'$and':[{'MailInteractionId':_0x5d13d1['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xf125('0x10')],'order':_0xf125('0x11'),'raw':!![]})[_0xf125('0x12')](function(_0xcbf8ea){if(_0xcbf8ea&&_0xcbf8ea[_0xf125('0x10')]){_0x5d13d1[_0xf125('0x13')]=_[_0xf125('0x14')](_0xcbf8ea[_0xf125('0x10')]);}return _0x5d13d1;})['catch'](function(_0x5d08c9){throw _0x5d08c9;});}exports[_0xf125('0x15')]=function(_0x470086,_0x442c44,_0x5d5c9e,_0x4722da){return new Promise(function(_0x1481a7,_0x34a1be){return getInteractionUsers(_0x470086['id'],_0x5d5c9e)['then'](function(_0x3c0b91){_0x470086[_0xf125('0x16')]=_0x3c0b91;return getInteractionTags(_0x470086[_0xf125('0x17')],_0x442c44);})[_0xf125('0x12')](function(_0x36f0b6){_0x470086[_0xf125('0x18')]=_0x36f0b6;delete _0x470086[_0xf125('0x17')];return updateInteractionCounters(_0x470086);})[_0xf125('0x12')](function(_0x1bf3eb){if(_0x4722da){return getLastMessageText(_0x1bf3eb);}else{return _0x1bf3eb;}})['then'](function(_0x49e6ea){_0x1481a7(_0x49e6ea);})[_0xf125('0x19')](function(_0x4801a5){_0x34a1be(_0x4801a5);});});}; \ No newline at end of file +var _0xe0e3=['plainBody','-id','then','lastMsgText','Users','TagIds','catch','lodash','../../mysqldb','map','fullname','split','forEach','waiting','unmanaged','abandoned','total','UserId','answered','talking','disposition','MailMessage','findOne','out'];(function(_0x2e7f2d,_0x197e09){var _0x391ab6=function(_0x49e3ed){while(--_0x49e3ed){_0x2e7f2d['push'](_0x2e7f2d['shift']());}};_0x391ab6(++_0x197e09);}(_0xe0e3,0x19f));var _0x3e0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0e('0x0'));var db=require(_0x3e0e('0x1'))['db'];function getInteractionUsers(_0x5cac3a,_0x2cc7f6){return new Promise(function(_0x5bf727,_0x58641c){try{var _0x13d2b4=[];if(_0x2cc7f6[_0x5cac3a]){_0x13d2b4=_0x2cc7f6[_0x5cac3a][_0x3e0e('0x2')](function(_0x3081fc){return{'id':_0x3081fc['id'],'fullname':_0x3081fc[_0x3e0e('0x3')]};});}return _0x5bf727(_0x13d2b4);}catch(_0x3783f7){_0x58641c(_0x3783f7);}});}function getInteractionTags(_0x1ea47b,_0x48e291){var _0x3ad2f9=[];if(_0x1ea47b){_0x1ea47b[_0x3e0e('0x4')](',')[_0x3e0e('0x5')](function(_0x1b9289){_0x3ad2f9['push'](_0x48e291[_0x1b9289]);});}return _0x3ad2f9;}function updateWaitingCounter(_0x1acce6){if(_0x1acce6[_0x3e0e('0x6')]){_0x1acce6[_0x3e0e('0x6')]-=0x1;}}function updateInteractionCounters(_0x328287){_0x328287['waiting']=0x0;_0x328287['talking']=0x0;_0x328287['answered']=0x0;_0x328287[_0x3e0e('0x7')]=0x0;_0x328287[_0x3e0e('0x8')]=0x0;_0x328287[_0x3e0e('0x9')]=0x0;if(_0x328287['closed']){if(_0x328287['disposition']===_0x3e0e('0x8')){_0x328287[_0x3e0e('0x8')]+=0x1;updateWaitingCounter(_0x328287);}if(_0x328287[_0x3e0e('0xa')]){_0x328287[_0x3e0e('0xb')]+=0x1;if(_0x328287['talking']){_0x328287[_0x3e0e('0xc')]-=0x1;}}else{if(_0x328287[_0x3e0e('0xd')]){_0x328287[_0x3e0e('0x7')]+=0x1;updateWaitingCounter(_0x328287);}}}else{if(!_0x328287[_0x3e0e('0xa')]){_0x328287['waiting']+=0x1;}if(_0x328287[_0x3e0e('0xa')]){_0x328287['talking']+=0x1;updateWaitingCounter(_0x328287);}}_0x328287['total']+=0x1;return _0x328287;}function getLastMessageText(_0x20b8d0){return db[_0x3e0e('0xe')][_0x3e0e('0xf')]({'where':{'$and':[{'MailInteractionId':_0x20b8d0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x3e0e('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x3e0e('0x11')],'order':_0x3e0e('0x12'),'raw':!![]})[_0x3e0e('0x13')](function(_0x6093d8){if(_0x6093d8&&_0x6093d8[_0x3e0e('0x11')]){_0x20b8d0[_0x3e0e('0x14')]=_['trimStart'](_0x6093d8[_0x3e0e('0x11')]);}return _0x20b8d0;})['catch'](function(_0x41859a){throw _0x41859a;});}exports['updateInteraction']=function(_0x55ceb8,_0x311ddf,_0x46d87f,_0xbf170c){return new Promise(function(_0x2beb9b,_0x20b8ca){return getInteractionUsers(_0x55ceb8['id'],_0x46d87f)['then'](function(_0x13369a){_0x55ceb8[_0x3e0e('0x15')]=_0x13369a;return getInteractionTags(_0x55ceb8[_0x3e0e('0x16')],_0x311ddf);})['then'](function(_0x40f36d){_0x55ceb8['Tags']=_0x40f36d;delete _0x55ceb8[_0x3e0e('0x16')];return updateInteractionCounters(_0x55ceb8);})['then'](function(_0x23ee0a){if(_0xbf170c){return getLastMessageText(_0x23ee0a);}else{return _0x23ee0a;}})[_0x3e0e('0x13')](function(_0x338b8a){_0x2beb9b(_0x338b8a);})[_0x3e0e('0x17')](function(_0x1c31b0){_0x20b8ca(_0x1c31b0);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 508daa2..71cf09a 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 _0xe3da=['then','info','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interaction_has_tags','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','update'];(function(_0x915485,_0x5f0dd9){var _0x125035=function(_0xf40ea1){while(--_0xf40ea1){_0x915485['push'](_0x915485['shift']());}};_0x125035(++_0x5f0dd9);}(_0xe3da,0x99));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var db=require(_0xae3d('0x0'))['db'];var loggers={'openchannel':require(_0xae3d('0x1'))(_0xae3d('0x2')),'mail':require('../../config/logger')(_0xae3d('0x3')),'fax':require(_0xae3d('0x1'))('fax-interactions'),'sms':require(_0xae3d('0x1'))(_0xae3d('0x4')),'chat':require(_0xae3d('0x1'))(_0xae3d('0x5')),'whatsapp':require(_0xae3d('0x1'))('whatsapp-interactions')};function getAccountFK(_0x49e5ab){return _[_0xae3d('0x6')](_0x49e5ab)+(_0x49e5ab===_0xae3d('0x7')?_0xae3d('0x8'):_0xae3d('0x9'))+'Id';}function getInteractionFK(_0xeddce8){return _[_0xae3d('0x6')](_0xeddce8)+_0xae3d('0xa');}function getInteractionId(_0x40dd7f,_0x175650,_0x3c0c5b){if(_0x40dd7f&&_0x40dd7f[_[_0xae3d('0xb')](_0x3c0c5b)+'InteractionId']){return _0x40dd7f[_['upperFirst'](_0x3c0c5b)+_0xae3d('0xa')];}else if(_0x40dd7f&&_0x40dd7f['id']){return _0x40dd7f['id'];}else if(_0x175650&&_0x175650['id']){return _0x175650['id'];}else{return _0xae3d('0xc');}}function getInteractionsTables(_0xd0f79){return{'accounts':_0xd0f79+'_'+(_0xd0f79===_0xae3d('0x7')?_0xae3d('0xd'):_0xae3d('0xe')),'interactions':_0xd0f79+'_interactions','interactionsTags':_0xd0f79+_0xae3d('0xf'),'messages':_0xd0f79+'_messages','userInteractions':'user_has_'+_0xd0f79+_0xae3d('0x10')};}function getSelectedTags(_0x5d9b53){var _0x2442bb=[];if(_0x5d9b53){_0x2442bb=Array[_0xae3d('0x11')](_0x5d9b53)?_0x5d9b53:[_0x5d9b53];}return _0x2442bb;}function log(_0x3feebf,_0x39956a,_0x3a99e0,_0x48022a,_0x12ed64,_0x14761b){loggers[_0x12ed64[_0xae3d('0x12')]()][_0x3feebf](_0xae3d('0x13'),_0x14761b[_0xae3d('0x14')](),_0x39956a?_0x39956a['id']:null,_0x39956a?_0x39956a[_0xae3d('0x15')]:null,_0x39956a?_0x39956a[_0xae3d('0x16')]:null,getInteractionId(_0x3a99e0,_0x48022a,_0x12ed64),_0x3a99e0?JSON[_0xae3d('0x17')](_0x3a99e0):_0xae3d('0x18'));}function updateUser(_0x85b162,_0x323a0a,_0x213787,_0x4eec27,_0x5f5420){db[_[_0xae3d('0xb')](_0x4eec27)+'Interaction'][_0xae3d('0x19')]({'where':{'id':getInteractionId(_0x323a0a,_0x213787,_0x4eec27)}})['then'](function(_0x2d216b){if(_0x2d216b){return _0x2d216b[_0xae3d('0x1a')]({'UserId':_0x85b162?_0x85b162['id']:null});}})[_0xae3d('0x1b')](function(_0x42ea4f){if(_0x42ea4f){log(_0xae3d('0x1c'),_0x85b162,_0x323a0a,_0x213787,_0x4eec27,_0x5f5420);}})['catch'](function(){log('error',_0x85b162,_0x323a0a,_0x213787,_0x4eec27,_0x5f5420);});}module[_0xae3d('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xc7a7=['role','null','Interaction','findOne','then','update','info','catch','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','whatsapp-interactions','capitalize','Website','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','toUpperCase','name'];(function(_0x2f02d4,_0x27b24a){var _0x4b707d=function(_0x52f3ba){while(--_0x52f3ba){_0x2f02d4['push'](_0x2f02d4['shift']());}};_0x4b707d(++_0x27b24a);}(_0xc7a7,0xcc));var _0x7c7a=function(_0x6ab478,_0x98840a){_0x6ab478=_0x6ab478-0x0;var _0x26a6c3=_0xc7a7[_0x6ab478];return _0x26a6c3;};'use strict';var _=require(_0x7c7a('0x0'));var db=require(_0x7c7a('0x1'))['db'];var loggers={'openchannel':require(_0x7c7a('0x2'))(_0x7c7a('0x3')),'mail':require(_0x7c7a('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0x7c7a('0x4')),'sms':require(_0x7c7a('0x2'))('sms-interactions'),'chat':require(_0x7c7a('0x2'))('chat-interactions'),'whatsapp':require(_0x7c7a('0x2'))(_0x7c7a('0x5'))};function getAccountFK(_0x300aaa){return _[_0x7c7a('0x6')](_0x300aaa)+(_0x300aaa==='chat'?_0x7c7a('0x7'):'Account')+'Id';}function getInteractionFK(_0x52e811){return _['capitalize'](_0x52e811)+_0x7c7a('0x8');}function getInteractionId(_0x268f08,_0x1a64b0,_0x3e6fdc){if(_0x268f08&&_0x268f08[_['upperFirst'](_0x3e6fdc)+_0x7c7a('0x8')]){return _0x268f08[_[_0x7c7a('0x9')](_0x3e6fdc)+_0x7c7a('0x8')];}else if(_0x268f08&&_0x268f08['id']){return _0x268f08['id'];}else if(_0x1a64b0&&_0x1a64b0['id']){return _0x1a64b0['id'];}else{return _0x7c7a('0xa');}}function getInteractionsTables(_0x4c33fe){return{'accounts':_0x4c33fe+'_'+(_0x4c33fe==='chat'?'websites':_0x7c7a('0xb')),'interactions':_0x4c33fe+_0x7c7a('0xc'),'interactionsTags':_0x4c33fe+_0x7c7a('0xd'),'messages':_0x4c33fe+_0x7c7a('0xe'),'userInteractions':_0x7c7a('0xf')+_0x4c33fe+_0x7c7a('0xc')};}function getSelectedTags(_0xc57653){var _0x8c4873=[];if(_0xc57653){_0x8c4873=Array[_0x7c7a('0x10')](_0xc57653)?_0xc57653:[_0xc57653];}return _0x8c4873;}function log(_0x25c30e,_0x3e29e3,_0x2cdedc,_0x22aa20,_0x27ba19,_0x22b2c3){loggers[_0x27ba19[_0x7c7a('0x11')]()][_0x25c30e]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22b2c3[_0x7c7a('0x12')](),_0x3e29e3?_0x3e29e3['id']:null,_0x3e29e3?_0x3e29e3[_0x7c7a('0x13')]:null,_0x3e29e3?_0x3e29e3[_0x7c7a('0x14')]:null,getInteractionId(_0x2cdedc,_0x22aa20,_0x27ba19),_0x2cdedc?JSON['stringify'](_0x2cdedc):_0x7c7a('0x15'));}function updateUser(_0x1b865a,_0x39617a,_0x29496e,_0x1e5ec5,_0x45d1d5){db[_[_0x7c7a('0x9')](_0x1e5ec5)+_0x7c7a('0x16')][_0x7c7a('0x17')]({'where':{'id':getInteractionId(_0x39617a,_0x29496e,_0x1e5ec5)}})[_0x7c7a('0x18')](function(_0x4a1a7c){if(_0x4a1a7c){return _0x4a1a7c[_0x7c7a('0x19')]({'UserId':_0x1b865a?_0x1b865a['id']:null});}})['then'](function(_0x4f209e){if(_0x4f209e){log(_0x7c7a('0x1a'),_0x1b865a,_0x39617a,_0x29496e,_0x1e5ec5,_0x45d1d5);}})[_0x7c7a('0x1b')](function(){log('error',_0x1b865a,_0x39617a,_0x29496e,_0x1e5ec5,_0x45d1d5);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 9e92531..e1daae7 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 _0x1ee4=['crypto','util','composable-middleware','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit'];(function(_0x53d1ba,_0x935486){var _0x1a8621=function(_0x251018){while(--_0x251018){_0x53d1ba['push'](_0x53d1ba['shift']());}};_0x1a8621(++_0x935486);}(_0x1ee4,0x16c));var _0x41ee=function(_0x41820c,_0x591c79){_0x41820c=_0x41820c-0x0;var _0x4112ca=_0x1ee4[_0x41820c];return _0x4112ca;};'use strict';var crypto=require(_0x41ee('0x0'));var util=require(_0x41ee('0x1'));var compose=require(_0x41ee('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4cd36a,_0x390157){if(_0x4cd36a&&_0x390157){if(_0x390157[_0x41ee('0x3')]&&_0x390157[_0x41ee('0x4')]){var _0x37b7d8=_0x390157[_0x41ee('0x3')];var _0x13dd74=_0x390157[_0x41ee('0x4')];var _0x44195b=_0x37b7d8[_0x41ee('0x5')]('-')[0x4];var _0x5ea4e3=_0x37b7d8[_0x41ee('0x5')]('-')[0x0];var _0x99eff1=crypto[_0x41ee('0x6')](_0x41ee('0x7'),util[_0x41ee('0x8')](_0x41ee('0x9'),_0x44195b,_0x37b7d8,_0x5ea4e3));var _0x92f897=_0x99eff1[_0x41ee('0xa')](_0x13dd74,_0x41ee('0xb'),_0x41ee('0xc'));_0x92f897+=_0x99eff1[_0x41ee('0xd')]('utf8');var _0x4969f2=JSON[_0x41ee('0xe')](_0x92f897);return _0x4969f2[_0x41ee('0xf')](_0x4cd36a)?_0x4969f2[_0x4cd36a]:null;}}return null;}function isLimit(_0x14b7c9,_0x461bd3,_0x38f255,_0x4f0cbc){var _0x4946ae=_0x461bd3;return compose()[_0x41ee('0x10')](function(_0x1b3121,_0x43f792,_0x4cf3bf){return db[_0x41ee('0x11')][_0x41ee('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x41ee('0x13')](function(_0x13fdb2){var _0x14de2b=getValueFromLicense(_0x14b7c9,_0x13fdb2);return _0x14de2b?_0x14de2b:_0x4946ae;})['then'](function(_0xb61a6b){_0x4946ae=_0xb61a6b;return _0x38f255[_0x41ee('0x14')](_0x4f0cbc);})[_0x41ee('0x13')](function(_0x44afeb){if(_0x44afeb>=_0x4946ae){return _0x43f792['status'](0x193)[_0x41ee('0x15')]({'message':util[_0x41ee('0x8')](_0x41ee('0x16'),_0x14b7c9)});}_0x4cf3bf();})[_0x41ee('0x17')](function(_0x5af035){_0x4cf3bf(_0x5af035);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x41ee('0x18')],{'where':{'$or':[{'role':_0x41ee('0x19')},{'role':_0x41ee('0x1a')}]}});}exports[_0x41ee('0x1b')]=isUserLimit; \ No newline at end of file +var _0x6283=['composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','status','json','catch','User','admin','crypto','util'];(function(_0x249d63,_0x27f0d0){var _0x34e8bc=function(_0x4dbec6){while(--_0x4dbec6){_0x249d63['push'](_0x249d63['shift']());}};_0x34e8bc(++_0x27f0d0);}(_0x6283,0x193));var _0x3628=function(_0x4578ba,_0x2d9b68){_0x4578ba=_0x4578ba-0x0;var _0x54e570=_0x6283[_0x4578ba];return _0x54e570;};'use strict';var crypto=require(_0x3628('0x0'));var util=require(_0x3628('0x1'));var compose=require(_0x3628('0x2'));var db=require(_0x3628('0x3'))['db'];var config=require(_0x3628('0x4'));function getValueFromLicense(_0x5baac7,_0x2faeb1){if(_0x5baac7&&_0x2faeb1){if(_0x2faeb1['data1']&&_0x2faeb1['license']){var _0x184fa7=_0x2faeb1[_0x3628('0x5')];var _0x50a4ee=_0x2faeb1[_0x3628('0x6')];var _0x187696=_0x184fa7[_0x3628('0x7')]('-')[0x4];var _0x13f4eb=_0x184fa7[_0x3628('0x7')]('-')[0x0];var _0x708988=crypto[_0x3628('0x8')](_0x3628('0x9'),util[_0x3628('0xa')](_0x3628('0xb'),_0x187696,_0x184fa7,_0x13f4eb));var _0x1aa8a6=_0x708988[_0x3628('0xc')](_0x50a4ee,_0x3628('0xd'),_0x3628('0xe'));_0x1aa8a6+=_0x708988[_0x3628('0xf')]('utf8');var _0x2beeb2=JSON[_0x3628('0x10')](_0x1aa8a6);return _0x2beeb2[_0x3628('0x11')](_0x5baac7)?_0x2beeb2[_0x5baac7]:null;}}return null;}function isLimit(_0x46ce3d,_0x46d030,_0xa745cc,_0x4a625d){var _0x5c8239=_0x46d030;return compose()[_0x3628('0x12')](function(_0x5d0fba,_0x5f31ad,_0x55e877){return db[_0x3628('0x13')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x3628('0x14')](function(_0x483fae){var _0x1a2be6=getValueFromLicense(_0x46ce3d,_0x483fae);return _0x1a2be6?_0x1a2be6:_0x5c8239;})['then'](function(_0x9b164){_0x5c8239=_0x9b164;return _0xa745cc[_0x3628('0x15')](_0x4a625d);})['then'](function(_0x20d4ce){if(_0x20d4ce>=_0x5c8239){return _0x5f31ad[_0x3628('0x16')](0x193)[_0x3628('0x17')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x46ce3d)});}_0x55e877();})[_0x3628('0x18')](function(_0x48f8b4){_0x55e877(_0x48f8b4);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x3628('0x19')],{'where':{'$or':[{'role':_0x3628('0x1a')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index cb84624..70144ce 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 _0x5d6c=['YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','shift','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$or]','split','length','slice','forEach','match','filter','indexOf','map','conditions','push','DATE','operator','value','includes','$gt','$lte','add','format'];(function(_0x4b6ccc,_0x146dc3){var _0x15e250=function(_0xef70d5){while(--_0xef70d5){_0x4b6ccc['push'](_0x4b6ccc['shift']());}};_0x15e250(++_0x146dc3);}(_0x5d6c,0xfe));var _0xc5d6=function(_0x4120d6,_0x469587){_0x4120d6=_0x4120d6-0x0;var _0x10724c=_0x5d6c[_0x4120d6];return _0x10724c;};'use strict';var _=require(_0xc5d6('0x0'));var moment=require(_0xc5d6('0x1'));exports[_0xc5d6('0x2')]=function(_0x29632c){var _0x12666a={'conditions':[]};_0x12666a[_0xc5d6('0x3')]=_[_0xc5d6('0x4')](_0x29632c,'[$or]')?'or':_0xc5d6('0x5');var _0x4241bc=_0x29632c[_0xc5d6('0x6')]('[$and]','')['replace'](_0xc5d6('0x7'),'')[_0xc5d6('0x8')]('||');for(var _0x34499f=0x0;_0x34499f<_0x4241bc[_0xc5d6('0x9')];_0x34499f++){var _0x166839=_0x4241bc[_0x34499f][_0xc5d6('0x8')](':=');var _0x4a2a2b=_0x166839[0x0];var _0x1ee126=_0x166839[_0xc5d6('0xa')](0x1);_0x1ee126[_0xc5d6('0xb')](function(_0x536208){var _0xfcdd50=_0x536208[_0xc5d6('0x8')]('[')['shift']();var _0x5bbad7=_0x536208[_0xc5d6('0xc')](/\[(.*?)\]/g);_0x5bbad7[_0xc5d6('0xb')](function(_0x170ff3){var _0x5d1cb5=_0x170ff3[_0xc5d6('0x8')]('[')[_0xc5d6('0xd')](function(_0x3d0478){return _0x3d0478[_0xc5d6('0xe')](']')>-0x1;})[_0xc5d6('0xf')](function(_0x35e851){return _0x35e851[_0xc5d6('0x8')](']')[0x0];})[0x0];_0x12666a[_0xc5d6('0x10')][_0xc5d6('0x11')]({'field':_0x4a2a2b,'operator':_0xfcdd50,'value':_0x5d1cb5});});});}return _0x12666a;};exports['buildExpression']=function(_0x58b7e9,_0x3369b6,_0xb5b796){var _0x5795c0={};if(_0x3369b6===_0xc5d6('0x12')){if(_0xb5b796[_0xc5d6('0x13')]==='$eq'){_0xb5b796['operator']='$between';_0xb5b796[_0xc5d6('0x14')]+=','+_0xb5b796[_0xc5d6('0x14')];}else if(_[_0xc5d6('0x15')]([_0xc5d6('0x16'),_0xc5d6('0x17')],_0xb5b796[_0xc5d6('0x13')])){_0xb5b796[_0xc5d6('0x14')]=moment(_0xb5b796[_0xc5d6('0x14')])[_0xc5d6('0x18')](0x1,'days')[_0xc5d6('0x19')](_0xc5d6('0x1a'));}}if(_0xb5b796[_0xc5d6('0x1b')]){_0x3369b6=_0xb5b796[_0xc5d6('0x1b')];_0x5795c0[_0xc5d6('0x1c')]=_0xc5d6('0x1d')+_0x58b7e9+'.'+_0xb5b796[_0xc5d6('0x1e')]+_0xc5d6('0x1f')+_0xb5b796[_0xc5d6('0x1b')]+')\x20'+parseOperator(_0xb5b796[_0xc5d6('0x13')]);}else{_0x5795c0[_0xc5d6('0x1c')]=_0x58b7e9+'.'+_0xb5b796[_0xc5d6('0x1e')]+'\x20'+parseOperator(_0xb5b796[_0xc5d6('0x13')]);}if(_[_0xc5d6('0x15')]([_0xc5d6('0x20'),_0xc5d6('0x21')],_0xb5b796[_0xc5d6('0x13')]))_0x5795c0['text']='('+_0x5795c0['text']+_0xc5d6('0x22')+_0x58b7e9+'.'+_0xb5b796[_0xc5d6('0x1e')]+_0xc5d6('0x23');_0x5795c0[_0xc5d6('0x14')]=parseValue(_0x3369b6,_0xb5b796['operator'],_0xb5b796['value']);return _0x5795c0;};function parseOperator(_0x370150){var _0xec4e93;switch(_0x370150){case _0xc5d6('0x24'):_0xec4e93=_0xc5d6('0x25');break;case _0xc5d6('0x21'):_0xec4e93=_0xc5d6('0x26');break;case _0xc5d6('0x27'):_0xec4e93=_0xc5d6('0x28');break;case _0xc5d6('0x20'):_0xec4e93='<>\x20?';break;case _0xc5d6('0x29'):case _0xc5d6('0x2a'):case _0xc5d6('0x2b'):_0xec4e93=_0xc5d6('0x2c');break;case _0xc5d6('0x2d'):_0xec4e93='<\x20?';break;case'$gt':_0xec4e93=_0xc5d6('0x2e');break;case _0xc5d6('0x17'):_0xec4e93=_0xc5d6('0x2f');break;case _0xc5d6('0x30'):_0xec4e93=_0xc5d6('0x31');break;case _0xc5d6('0x32'):_0xec4e93=_0xc5d6('0x33');break;}return _0xec4e93;}function parseValue(_0x376429,_0x44f9c9,_0x4883af){var _0x28d725={'start':undefined,'end':undefined};switch(_0x44f9c9){case'$in':case _0xc5d6('0x21'):_0x28d725[_0xc5d6('0x34')]=_0x4883af[_0xc5d6('0x8')](',');break;case _0xc5d6('0x29'):_0x28d725[_0xc5d6('0x34')]='%'+_0x4883af+'%';break;case _0xc5d6('0x2a'):_0x28d725[_0xc5d6('0x34')]=_0x4883af+'%';break;case _0xc5d6('0x2b'):_0x28d725['start']='%'+_0x4883af;break;case _0xc5d6('0x32'):var _0x417e20=_0x4883af['split'](',');var _0x4883af=_0x417e20[_0xc5d6('0x35')]();var _0x520a27=_0x417e20['pop']();if(_0x376429===_0xc5d6('0x12')){_0x4883af=moment(_0x4883af)['utcOffset'](0x0,!![])['format']();_0x520a27=moment(_0x520a27)['utcOffset'](0x0,!![])[_0xc5d6('0x18')](0x17,_0xc5d6('0x36'))[_0xc5d6('0x18')](0x3b,_0xc5d6('0x37'))[_0xc5d6('0x18')](0x3b,'seconds')[_0xc5d6('0x19')]();}_0x28d725={'start':_0x4883af,'end':_0x520a27};break;default:_0x28d725[_0xc5d6('0x34')]=_0x4883af;break;}return _0x28d725;} \ No newline at end of file +var _0x6844=['\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$in','start','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','and','[$and]','replace','[$or]','split','length','forEach','shift','match','filter','indexOf','push','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20'];(function(_0x4e6815,_0x997991){var _0x3d1b3a=function(_0x226a7d){while(--_0x226a7d){_0x4e6815['push'](_0x4e6815['shift']());}};_0x3d1b3a(++_0x997991);}(_0x6844,0x152));var _0x4684=function(_0x2236fe,_0x4ef9e1){_0x2236fe=_0x2236fe-0x0;var _0x54ec9b=_0x6844[_0x2236fe];return _0x54ec9b;};'use strict';var _=require(_0x4684('0x0'));var moment=require(_0x4684('0x1'));exports['parseSearch']=function(_0x13eaa3){var _0x50b68d={'conditions':[]};_0x50b68d[_0x4684('0x2')]=_['startsWith'](_0x13eaa3,'[$or]')?'or':_0x4684('0x3');var _0x490ad7=_0x13eaa3['replace'](_0x4684('0x4'),'')[_0x4684('0x5')](_0x4684('0x6'),'')[_0x4684('0x7')]('||');for(var _0x2a422a=0x0;_0x2a422a<_0x490ad7[_0x4684('0x8')];_0x2a422a++){var _0x54b2e3=_0x490ad7[_0x2a422a][_0x4684('0x7')](':=');var _0x5a4b70=_0x54b2e3[0x0];var _0x1ae6da=_0x54b2e3['slice'](0x1);_0x1ae6da[_0x4684('0x9')](function(_0x19bd11){var _0x32c5f7=_0x19bd11['split']('[')[_0x4684('0xa')]();var _0x54ce3a=_0x19bd11[_0x4684('0xb')](/\[(.*?)\]/g);_0x54ce3a[_0x4684('0x9')](function(_0x15f215){var _0x281a6b=_0x15f215[_0x4684('0x7')]('[')[_0x4684('0xc')](function(_0x1dc955){return _0x1dc955[_0x4684('0xd')](']')>-0x1;})['map'](function(_0x1ba2b1){return _0x1ba2b1[_0x4684('0x7')](']')[0x0];})[0x0];_0x50b68d['conditions'][_0x4684('0xe')]({'field':_0x5a4b70,'operator':_0x32c5f7,'value':_0x281a6b});});});}return _0x50b68d;};exports[_0x4684('0xf')]=function(_0x2b2f07,_0x25d49b,_0x3d6454){var _0x5bf837={};if(_0x25d49b==='DATE'){if(_0x3d6454[_0x4684('0x10')]===_0x4684('0x11')){_0x3d6454[_0x4684('0x10')]=_0x4684('0x12');_0x3d6454[_0x4684('0x13')]+=','+_0x3d6454['value'];}else if(_[_0x4684('0x14')]([_0x4684('0x15'),_0x4684('0x16')],_0x3d6454['operator'])){_0x3d6454[_0x4684('0x13')]=moment(_0x3d6454['value'])[_0x4684('0x17')](0x1,'days')[_0x4684('0x18')](_0x4684('0x19'));}}if(_0x3d6454['castTo']){_0x25d49b=_0x3d6454[_0x4684('0x1a')];_0x5bf837[_0x4684('0x1b')]=_0x4684('0x1c')+_0x2b2f07+'.'+_0x3d6454[_0x4684('0x1d')]+'\x20AS\x20'+_0x3d6454['castTo']+')\x20'+parseOperator(_0x3d6454[_0x4684('0x10')]);}else{_0x5bf837[_0x4684('0x1b')]=_0x2b2f07+'.'+_0x3d6454[_0x4684('0x1d')]+'\x20'+parseOperator(_0x3d6454[_0x4684('0x10')]);}if(_[_0x4684('0x14')]([_0x4684('0x1e'),_0x4684('0x1f')],_0x3d6454['operator']))_0x5bf837[_0x4684('0x1b')]='('+_0x5bf837[_0x4684('0x1b')]+_0x4684('0x20')+_0x2b2f07+'.'+_0x3d6454[_0x4684('0x1d')]+_0x4684('0x21');_0x5bf837[_0x4684('0x13')]=parseValue(_0x25d49b,_0x3d6454[_0x4684('0x10')],_0x3d6454['value']);return _0x5bf837;};function parseOperator(_0x38d1bb){var _0x350ed3;switch(_0x38d1bb){case'$in':_0x350ed3=_0x4684('0x22');break;case _0x4684('0x1f'):_0x350ed3=_0x4684('0x23');break;case _0x4684('0x11'):_0x350ed3=_0x4684('0x24');break;case _0x4684('0x1e'):_0x350ed3=_0x4684('0x25');break;case'$substring':case _0x4684('0x26'):case _0x4684('0x27'):_0x350ed3='LIKE\x20?';break;case'$lt':_0x350ed3=_0x4684('0x28');break;case _0x4684('0x15'):_0x350ed3=_0x4684('0x29');break;case _0x4684('0x16'):_0x350ed3=_0x4684('0x2a');break;case _0x4684('0x2b'):_0x350ed3=_0x4684('0x2c');break;case _0x4684('0x12'):_0x350ed3='BETWEEN\x20?\x20AND\x20?';break;}return _0x350ed3;}function parseValue(_0x317325,_0x25c6a9,_0x263714){var _0x54a768={'start':undefined,'end':undefined};switch(_0x25c6a9){case _0x4684('0x2d'):case _0x4684('0x1f'):_0x54a768[_0x4684('0x2e')]=_0x263714[_0x4684('0x7')](',');break;case'$substring':_0x54a768[_0x4684('0x2e')]='%'+_0x263714+'%';break;case _0x4684('0x26'):_0x54a768[_0x4684('0x2e')]=_0x263714+'%';break;case _0x4684('0x27'):_0x54a768[_0x4684('0x2e')]='%'+_0x263714;break;case _0x4684('0x12'):var _0x2feb13=_0x263714['split'](',');var _0x263714=_0x2feb13[_0x4684('0xa')]();var _0x1c29b0=_0x2feb13[_0x4684('0x2f')]();if(_0x317325===_0x4684('0x30')){_0x263714=moment(_0x263714)[_0x4684('0x31')](0x0,!![])[_0x4684('0x18')]();_0x1c29b0=moment(_0x1c29b0)[_0x4684('0x31')](0x0,!![])[_0x4684('0x17')](0x17,_0x4684('0x32'))[_0x4684('0x17')](0x3b,_0x4684('0x33'))[_0x4684('0x17')](0x3b,_0x4684('0x34'))['format']();}_0x54a768={'start':_0x263714,'end':_0x1c29b0};break;default:_0x54a768['start']=_0x263714;break;}return _0x54a768;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e30dea0..e4f8995 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 _0xf981=['split','isEmpty','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','ASC','length','isObject','isString','unset','hasOwnProperty','omit','isEmail','match','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','query','$id','intersection','attributes','nolimit','order','where','filters','filter','object','columns','merge','VIRTUAL','lower','include','includeAll','lodash','sequelize','moment','parse','keys','includes','model','alias','fields','raw'];(function(_0x215492,_0x3e9947){var _0x4b4dd5=function(_0x59c418){while(--_0x59c418){_0x215492['push'](_0x215492['shift']());}};_0x4b4dd5(++_0x3e9947);}(_0xf981,0x1af));var _0x1f98=function(_0x9ae0dd,_0x1caf3f){_0x9ae0dd=_0x9ae0dd-0x0;var _0x40838b=_0xf981[_0x9ae0dd];return _0x40838b;};'use strict';var _=require(_0x1f98('0x0'));var sequelize=require(_0x1f98('0x1'));var moment=require(_0x1f98('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2177ee){var _0x54d75c=['ne'];try{var _0x5068d1=JSON[_0x1f98('0x3')](_0x2177ee);var _0x40884d=Object[_0x1f98('0x4')](_0x5068d1)[0x0];return _0x54d75c[_0x1f98('0x5')](_0x40884d);}catch(_0x1182bb){return![];}}function getOperatorValue(_0x503ab2){var _0x57e694=JSON[_0x1f98('0x3')](_0x503ab2);var _0x55a92d=Object[_0x1f98('0x4')](_0x57e694)[0x0];var _0x25d264=_0x57e694[_0x55a92d];return{['$'+_0x55a92d]:_0x25d264};}function parseIncludeModel(_0x539c8e){var _0x169c00=JSON[_0x1f98('0x3')](_0x539c8e);return{'model':db[_0x169c00[_0x1f98('0x6')]],'as':_0x169c00[_0x1f98('0x7')],'attributes':_0x169c00[_0x1f98('0x8')],'raw':_0x169c00[_0x1f98('0x9')]};}exports[_0x1f98('0x8')]=function(_0x291102){var _0x31c1b2=null;if(_0x291102){_0x31c1b2=_0x291102[_0x1f98('0xa')](',');}return _0x31c1b2;};exports['filters']=function(_0x3edc65,_0x4b2c6c){var _0x34e878={};if(!_[_0x1f98('0xb')](_0x3edc65)){_['forOwn'](_0x3edc65,function(_0xa92d51,_0xd741ce){try{if(_0x4b2c6c){var _0xe00fa0=_['find'](_0x4b2c6c,{'name':_0xd741ce})||{};if(hasSequelizeOperator(_0xa92d51)){_0x34e878[_0xd741ce]=getOperatorValue(_0xa92d51);}else if(_0xe00fa0[_0x1f98('0xc')]===_0x1f98('0xd')&&_['isPlainObject'](_0xa92d51)){var _0xf94509=JSON[_0x1f98('0x3')](_0xa92d51);var _0x4439a2={'$gte':moment(moment(_0xf94509[_0x1f98('0xe')])[_0x1f98('0xf')](_0x1f98('0x10')))[_0x1f98('0x11')]()['format'](),'$lte':moment(moment(_0xf94509[_0x1f98('0x12')])[_0x1f98('0xf')](_0x1f98('0x10')))[_0x1f98('0x11')]()[_0x1f98('0x13')](0x1,'s')[_0x1f98('0xf')]()};_0x34e878[_0xd741ce]=_0x4439a2;}else if(_0xe00fa0[_0x1f98('0x14')]==='uniqueid'){_0x34e878[_0xd741ce]=_0xa92d51;}else{_0x34e878[_0xd741ce]=_[_0x1f98('0x15')](_0xa92d51)?_0xa92d51:JSON[_0x1f98('0x3')](_0xa92d51);}}else{_0x34e878[_0xd741ce]=_['isArray'](_0xa92d51)?_0xa92d51:JSON['parse'](_0xa92d51);}}catch(_0x3a07b3){_0x34e878[_0xd741ce]=_0xa92d51[_0x1f98('0xa')](',');}});}return _0x34e878;};exports[_0x1f98('0x16')]=function(_0x2b56fd){_0x2b56fd=parseInt(_0x2b56fd,0xa);if(!_0x2b56fd||_0x2b56fd<0x0){_0x2b56fd=LIMIT_VALUE;}return _0x2b56fd;};exports[_0x1f98('0x17')]=function(_0x31dcb7){_0x31dcb7=parseInt(_0x31dcb7,0xa);if(!_0x31dcb7||_0x31dcb7<0x0){_0x31dcb7=0x0;}return _0x31dcb7;};exports[_0x1f98('0x18')]=function(_0x549e34){var _0x215367,_0x51f9a1=null;if(_0x549e34){_0x215367=_0x549e34[_0x1f98('0xa')](',');_0x51f9a1=_[_0x1f98('0x19')](_0x215367,function(_0x37589e){if(_0x37589e[_0x1f98('0x1a')]('-')===0x0){return[_0x37589e===_0x1f98('0x1b')?sequelize[_0x1f98('0x1c')](sequelize['col'](_0x1f98('0x1b')),_0x1f98('0x1d')):_0x37589e[_0x1f98('0x1e')](0x1),_0x1f98('0x1f')];}else{return[_0x37589e===_0x1f98('0x1b')?sequelize[_0x1f98('0x1c')](sequelize[_0x1f98('0x20')](_0x1f98('0x1b')),_0x1f98('0x1d')):_0x37589e,_0x1f98('0x21')];}});}return _0x51f9a1;};exports['omit']=function(_0x45fbbb,_0x430834){if(_[_0x1f98('0xb')](_0x45fbbb)){return _0x45fbbb;}if(_[_0x1f98('0x15')](_0x45fbbb)){for(var _0x2f5846=0x0;_0x2f5846<_0x45fbbb[_0x1f98('0x22')];_0x2f5846+=0x1){_0x45fbbb[_0x2f5846]=this['omit'](_0x45fbbb[_0x2f5846],_0x430834);}return _0x45fbbb;}if(!_[_0x1f98('0x23')](_0x45fbbb)){return _0x45fbbb;}if(_[_0x1f98('0x24')](_0x430834)){_0x430834=[_0x430834];}if(!_[_0x1f98('0x15')](_0x430834)){return _0x45fbbb;}for(var _0x35ff0a=0x0;_0x35ff0a<_0x430834[_0x1f98('0x22')];_0x35ff0a+=0x1){_[_0x1f98('0x25')](_0x45fbbb,_0x430834[_0x35ff0a]);}for(var _0x2383d8 in _0x45fbbb){if(_0x45fbbb[_0x1f98('0x26')](_0x2383d8)){_0x45fbbb[_0x2383d8]=this[_0x1f98('0x27')](_0x45fbbb[_0x2383d8],_0x430834);}}return _0x45fbbb;};exports['isNumeric']=function(_0x5e2b03){return _0x5e2b03['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x1f98('0x28')]=function(_0x782eb8){return _0x782eb8[_0x1f98('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0x1f98('0x2a')]=function(_0x32bec3,_0x588353){var _0x5d0dae=[];var _0x2ebb2f=/[ `!@#$%^&*()_\-?~]/;var _0x5e227b=_0x588353?_0x1f98('0x2b'):'{EXPR}';_0x32bec3[_0x1f98('0xa')](/[ ,]+/)[_0x1f98('0x2c')](function(_0x1b0410){_0x1b0410=_0x1b0410[_0x1f98('0x2d')](/([^:]")"+/g,'$1');_0x1b0410='+'+_0x1b0410+'*';var _0x1dc4fc=_0x1b0410[_0x1f98('0x29')](_0x2ebb2f);if(_0x1dc4fc){_0x1b0410='\x22'+_0x1b0410+'\x22';}_0x5d0dae[_0x1f98('0x2e')](_0x1b0410);});_0x5e227b=_0x5e227b[_0x1f98('0x2d')]('{EXPR}',_0x5d0dae['join']('\x20'));return _0x5e227b;};exports['getOptions']=function(_0x52fb85,_0x4a2a90,_0x449a1e){var _0x2df24b={},_0x1b6b31={};if(_0x4a2a90[_0x1f98('0x2f')][_0x1f98('0x30')]){_0x4a2a90[_0x1f98('0x2f')]['id']=_0x4a2a90[_0x1f98('0x2f')][_0x1f98('0x30')];delete _0x4a2a90[_0x1f98('0x2f')]['$id'];}_0x2df24b[_0x1f98('0x6')]=_[_0x1f98('0x19')](_0x52fb85,'name');_0x2df24b['query']=_[_0x1f98('0x4')](_0x4a2a90[_0x1f98('0x2f')]);_0x2df24b['filters']=_[_0x1f98('0x31')](_0x2df24b[_0x1f98('0x6')],_0x2df24b[_0x1f98('0x2f')]);_0x1b6b31['attributes']=_[_0x1f98('0x31')](_0x2df24b['model'],this[_0x1f98('0x8')](_0x4a2a90[_0x1f98('0x2f')][_0x1f98('0x8')]));_0x1b6b31[_0x1f98('0x32')]=_0x1b6b31[_0x1f98('0x32')][_0x1f98('0x22')]?_0x1b6b31[_0x1f98('0x32')]:_0x2df24b['model'];if(!_0x4a2a90[_0x1f98('0x2f')][_0x1f98('0x26')](_0x1f98('0x33'))){_0x1b6b31[_0x1f98('0x16')]=this[_0x1f98('0x16')](_0x4a2a90['query'][_0x1f98('0x16')]);_0x1b6b31[_0x1f98('0x17')]=this[_0x1f98('0x17')](_0x4a2a90[_0x1f98('0x2f')][_0x1f98('0x17')]);}_0x1b6b31[_0x1f98('0x34')]=this[_0x1f98('0x18')](_0x4a2a90['query']['sort']);_0x1b6b31[_0x1f98('0x35')]=this[_0x1f98('0x36')](_['pick'](_0x4a2a90['query'],_0x2df24b[_0x1f98('0x36')]),_0x52fb85);if(_0x4a2a90[_0x1f98('0x2f')][_0x1f98('0x37')]){var _0x9d46a4=_0x52fb85;var _0x141888=_0x4a2a90[_0x1f98('0x2f')][_0x1f98('0x37')];if(typeof _0x141888===_0x1f98('0x38')){_0x9d46a4=_['filter'](_0x52fb85,function(_0x303009){return _[_0x1f98('0x5')](_0x141888[_0x1f98('0x39')],_0x303009[_0x1f98('0x14')]);});_0x141888=_0x141888['value'];}_0x1b6b31['where']=_[_0x1f98('0x3a')](_0x1b6b31[_0x1f98('0x35')],{'$or':_[_0x1f98('0x19')](_0x9d46a4,function(_0x46d0b3){if(_0x46d0b3[_0x1f98('0xc')]!==_0x1f98('0x3b')){if(_0x449a1e){return sequelize[_0x1f98('0x35')](sequelize['fn']('lower',sequelize[_0x1f98('0x20')](_0x46d0b3['name'])),{'$like':sequelize['fn'](_0x1f98('0x3c'),'%'+_0x4a2a90[_0x1f98('0x2f')][_0x1f98('0x37')]+'%')});}else{var _0x5a233c={};_0x5a233c[_0x46d0b3[_0x1f98('0x14')]]={'$like':'%'+_0x4a2a90['query']['filter']+'%'};return _0x5a233c;}}})});}_0x1b6b31=_['merge']({},_0x1b6b31,_0x4a2a90['options']);return _0x1b6b31;};exports[_0x1f98('0x3d')]=function(_0x359a35){var _0x5142b2=[];if(_0x359a35[_0x1f98('0x3e')]){_0x5142b2['push']({'all':!![]});}else if(_0x359a35[_0x1f98('0x3d')]){if(Array[_0x1f98('0x15')](_0x359a35[_0x1f98('0x3d')])){_0x5142b2=Object['keys'](_0x359a35[_0x1f98('0x3d')])[_0x1f98('0x19')](function(_0x2a0aa7){return parseIncludeModel(_0x359a35[_0x1f98('0x3d')][_0x2a0aa7]);});}else{var _0x2d0861=parseIncludeModel(_0x359a35[_0x1f98('0x3d')]);_0x5142b2['push'](_0x2d0861);}}return _0x5142b2;}; \ No newline at end of file +var _0x05bc=['filters','isEmpty','forOwn','type','DATE','$gte','format','YYYY-MM-DD','utc','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','unsigned','DESC','col','omit','length','isObject','isString','unset','hasOwnProperty','^[+]?[0-9]*$','match','getFullTextValue','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','attributes','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','options','include','includeAll','sequelize','../../mysqldb','parse','keys','includes','alias','fields','raw','split'];(function(_0x53a54b,_0x86f3a6){var _0x593448=function(_0x13def3){while(--_0x13def3){_0x53a54b['push'](_0x53a54b['shift']());}};_0x593448(++_0x86f3a6);}(_0x05bc,0xae));var _0xc05b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x05bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var sequelize=require(_0xc05b('0x0'));var moment=require('moment');var db=require(_0xc05b('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2762de){var _0x59d194=['ne'];try{var _0x36c0ca=JSON[_0xc05b('0x2')](_0x2762de);var _0xf971c9=Object[_0xc05b('0x3')](_0x36c0ca)[0x0];return _0x59d194[_0xc05b('0x4')](_0xf971c9);}catch(_0x46d195){return![];}}function getOperatorValue(_0x2514a1){var _0x22c8db=JSON[_0xc05b('0x2')](_0x2514a1);var _0x1b501a=Object[_0xc05b('0x3')](_0x22c8db)[0x0];var _0x143ba4=_0x22c8db[_0x1b501a];return{['$'+_0x1b501a]:_0x143ba4};}function parseIncludeModel(_0x45245b){var _0x2b6c75=JSON['parse'](_0x45245b);return{'model':db[_0x2b6c75['model']],'as':_0x2b6c75[_0xc05b('0x5')],'attributes':_0x2b6c75[_0xc05b('0x6')],'raw':_0x2b6c75[_0xc05b('0x7')]};}exports[_0xc05b('0x6')]=function(_0x321c76){var _0x39b413=null;if(_0x321c76){_0x39b413=_0x321c76[_0xc05b('0x8')](',');}return _0x39b413;};exports[_0xc05b('0x9')]=function(_0x1aa6a1,_0x5a7ad0){var _0x2976c2={};if(!_[_0xc05b('0xa')](_0x1aa6a1)){_[_0xc05b('0xb')](_0x1aa6a1,function(_0x160659,_0x141dbf){try{if(_0x5a7ad0){var _0x5e8304=_['find'](_0x5a7ad0,{'name':_0x141dbf})||{};if(hasSequelizeOperator(_0x160659)){_0x2976c2[_0x141dbf]=getOperatorValue(_0x160659);}else if(_0x5e8304[_0xc05b('0xc')]===_0xc05b('0xd')&&_['isPlainObject'](_0x160659)){var _0x4d4698=JSON[_0xc05b('0x2')](_0x160659);var _0x142fd8={'$gte':moment(moment(_0x4d4698[_0xc05b('0xe')])[_0xc05b('0xf')](_0xc05b('0x10')))[_0xc05b('0x11')]()[_0xc05b('0xf')](),'$lte':moment(moment(_0x4d4698['$lte'])[_0xc05b('0xf')](_0xc05b('0x10')))[_0xc05b('0x11')]()[_0xc05b('0x12')](0x1,'s')[_0xc05b('0xf')]()};_0x2976c2[_0x141dbf]=_0x142fd8;}else if(_0x5e8304[_0xc05b('0x13')]==='uniqueid'){_0x2976c2[_0x141dbf]=_0x160659;}else{_0x2976c2[_0x141dbf]=_[_0xc05b('0x14')](_0x160659)?_0x160659:JSON['parse'](_0x160659);}}else{_0x2976c2[_0x141dbf]=_[_0xc05b('0x14')](_0x160659)?_0x160659:JSON[_0xc05b('0x2')](_0x160659);}}catch(_0x45d561){_0x2976c2[_0x141dbf]=_0x160659[_0xc05b('0x8')](',');}});}return _0x2976c2;};exports[_0xc05b('0x15')]=function(_0x48c36e){_0x48c36e=parseInt(_0x48c36e,0xa);if(!_0x48c36e||_0x48c36e<0x0){_0x48c36e=LIMIT_VALUE;}return _0x48c36e;};exports[_0xc05b('0x16')]=function(_0x40de30){_0x40de30=parseInt(_0x40de30,0xa);if(!_0x40de30||_0x40de30<0x0){_0x40de30=0x0;}return _0x40de30;};exports[_0xc05b('0x17')]=function(_0x311fcb){var _0x58374e,_0x1766bd=null;if(_0x311fcb){_0x58374e=_0x311fcb[_0xc05b('0x8')](',');_0x1766bd=_[_0xc05b('0x18')](_0x58374e,function(_0x1edaa0){if(_0x1edaa0[_0xc05b('0x19')]('-')===0x0){return[_0x1edaa0===_0xc05b('0x1a')?sequelize['cast'](sequelize['col'](_0xc05b('0x1a')),_0xc05b('0x1b')):_0x1edaa0['substr'](0x1),_0xc05b('0x1c')];}else{return[_0x1edaa0==='priority'?sequelize['cast'](sequelize[_0xc05b('0x1d')]('priority'),'unsigned'):_0x1edaa0,'ASC'];}});}return _0x1766bd;};exports[_0xc05b('0x1e')]=function(_0x4c133c,_0x2d8e4c){if(_[_0xc05b('0xa')](_0x4c133c)){return _0x4c133c;}if(_['isArray'](_0x4c133c)){for(var _0x337cc1=0x0;_0x337cc1<_0x4c133c[_0xc05b('0x1f')];_0x337cc1+=0x1){_0x4c133c[_0x337cc1]=this[_0xc05b('0x1e')](_0x4c133c[_0x337cc1],_0x2d8e4c);}return _0x4c133c;}if(!_[_0xc05b('0x20')](_0x4c133c)){return _0x4c133c;}if(_[_0xc05b('0x21')](_0x2d8e4c)){_0x2d8e4c=[_0x2d8e4c];}if(!_[_0xc05b('0x14')](_0x2d8e4c)){return _0x4c133c;}for(var _0x2f1364=0x0;_0x2f1364<_0x2d8e4c[_0xc05b('0x1f')];_0x2f1364+=0x1){_[_0xc05b('0x22')](_0x4c133c,_0x2d8e4c[_0x2f1364]);}for(var _0x12e0d3 in _0x4c133c){if(_0x4c133c[_0xc05b('0x23')](_0x12e0d3)){_0x4c133c[_0x12e0d3]=this[_0xc05b('0x1e')](_0x4c133c[_0x12e0d3],_0x2d8e4c);}}return _0x4c133c;};exports['isNumeric']=function(_0x3ca295){return _0x3ca295['match'](RegExp(_0xc05b('0x24')))?!![]:![];};exports['isEmail']=function(_0x580d43){return _0x580d43[_0xc05b('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xc05b('0x26')]=function(_0x1c39d5,_0x48366c){var _0x884fcb=[];var _0x4deec8=/[ `!@#$%^&*()_\-?~]/;var _0x4dee50=_0x48366c?'\x22{EXPR}\x22':_0xc05b('0x27');_0x1c39d5[_0xc05b('0x8')](/[ ,]+/)[_0xc05b('0x28')](function(_0x5dbceb){_0x5dbceb=_0x5dbceb[_0xc05b('0x29')](/([^:]")"+/g,'$1');_0x5dbceb='+'+_0x5dbceb+'*';var _0x1601e3=_0x5dbceb[_0xc05b('0x25')](_0x4deec8);if(_0x1601e3){_0x5dbceb='\x22'+_0x5dbceb+'\x22';}_0x884fcb[_0xc05b('0x2a')](_0x5dbceb);});_0x4dee50=_0x4dee50['replace'](_0xc05b('0x27'),_0x884fcb[_0xc05b('0x2b')]('\x20'));return _0x4dee50;};exports[_0xc05b('0x2c')]=function(_0x5d1997,_0x3e3309,_0x1b2e4d){var _0x5b57d7={},_0x185c98={};if(_0x3e3309[_0xc05b('0x2d')]['$id']){_0x3e3309['query']['id']=_0x3e3309[_0xc05b('0x2d')][_0xc05b('0x2e')];delete _0x3e3309[_0xc05b('0x2d')][_0xc05b('0x2e')];}_0x5b57d7['model']=_[_0xc05b('0x18')](_0x5d1997,'name');_0x5b57d7[_0xc05b('0x2d')]=_[_0xc05b('0x3')](_0x3e3309[_0xc05b('0x2d')]);_0x5b57d7[_0xc05b('0x9')]=_['intersection'](_0x5b57d7[_0xc05b('0x2f')],_0x5b57d7[_0xc05b('0x2d')]);_0x185c98['attributes']=_['intersection'](_0x5b57d7[_0xc05b('0x2f')],this[_0xc05b('0x6')](_0x3e3309[_0xc05b('0x2d')][_0xc05b('0x6')]));_0x185c98[_0xc05b('0x30')]=_0x185c98['attributes'][_0xc05b('0x1f')]?_0x185c98[_0xc05b('0x30')]:_0x5b57d7[_0xc05b('0x2f')];if(!_0x3e3309[_0xc05b('0x2d')]['hasOwnProperty']('nolimit')){_0x185c98[_0xc05b('0x15')]=this['limit'](_0x3e3309[_0xc05b('0x2d')]['limit']);_0x185c98[_0xc05b('0x16')]=this[_0xc05b('0x16')](_0x3e3309[_0xc05b('0x2d')][_0xc05b('0x16')]);}_0x185c98['order']=this['sort'](_0x3e3309[_0xc05b('0x2d')]['sort']);_0x185c98[_0xc05b('0x31')]=this['filters'](_[_0xc05b('0x32')](_0x3e3309[_0xc05b('0x2d')],_0x5b57d7['filters']),_0x5d1997);if(_0x3e3309[_0xc05b('0x2d')][_0xc05b('0x33')]){var _0x51b3ee=_0x5d1997;var _0x1f7288=_0x3e3309[_0xc05b('0x2d')][_0xc05b('0x33')];if(typeof _0x1f7288===_0xc05b('0x34')){_0x51b3ee=_[_0xc05b('0x33')](_0x5d1997,function(_0x3d9542){return _[_0xc05b('0x4')](_0x1f7288[_0xc05b('0x35')],_0x3d9542['name']);});_0x1f7288=_0x1f7288[_0xc05b('0x36')];}_0x185c98[_0xc05b('0x31')]=_[_0xc05b('0x37')](_0x185c98['where'],{'$or':_[_0xc05b('0x18')](_0x51b3ee,function(_0x2b830a){if(_0x2b830a[_0xc05b('0xc')]!==_0xc05b('0x38')){if(_0x1b2e4d){return sequelize['where'](sequelize['fn'](_0xc05b('0x39'),sequelize[_0xc05b('0x1d')](_0x2b830a['name'])),{'$like':sequelize['fn'](_0xc05b('0x39'),'%'+_0x3e3309[_0xc05b('0x2d')][_0xc05b('0x33')]+'%')});}else{var _0x595f7a={};_0x595f7a[_0x2b830a[_0xc05b('0x13')]]={'$like':'%'+_0x3e3309[_0xc05b('0x2d')][_0xc05b('0x33')]+'%'};return _0x595f7a;}}})});}_0x185c98=_[_0xc05b('0x37')]({},_0x185c98,_0x3e3309[_0xc05b('0x3a')]);return _0x185c98;};exports[_0xc05b('0x3b')]=function(_0x45ad9c){var _0x4f1f51=[];if(_0x45ad9c[_0xc05b('0x3c')]){_0x4f1f51[_0xc05b('0x2a')]({'all':!![]});}else if(_0x45ad9c[_0xc05b('0x3b')]){if(Array[_0xc05b('0x14')](_0x45ad9c[_0xc05b('0x3b')])){_0x4f1f51=Object['keys'](_0x45ad9c[_0xc05b('0x3b')])[_0xc05b('0x18')](function(_0x28ca5f){return parseIncludeModel(_0x45ad9c[_0xc05b('0x3b')][_0x28ca5f]);});}else{var _0xea513b=parseIncludeModel(_0x45ad9c[_0xc05b('0x3b')]);_0x4f1f51[_0xc05b('0x2a')](_0xea513b);}}return _0x4f1f51;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 6422ba4..6ec3180 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 _0xc4aa=['substring','indexOf','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','role','openchannelStatusTime','voiceStatusTime','chatCapacity','whatsappCapacity','smsCurrentCapacity','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unknown','ringing','voiceStatus','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','merge','catch','getRealtimeAgents','pause','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','findAll','name','fullname','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','DESC','internal'];(function(_0xcb71e,_0x378c69){var _0x5c1cd9=function(_0x35f881){while(--_0x35f881){_0xcb71e['push'](_0xcb71e['shift']());}};_0x5c1cd9(++_0x378c69);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var jayson=require(_0xac4a('0x1'));var db=require(_0xac4a('0x2'))['db'];var amiClient=jayson[_0xac4a('0x3')][_0xac4a('0x4')]({'port':0x232a});var routingClient=jayson[_0xac4a('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x5cda73,_0x47d4f6){var _0x2f48ed=[_0x5cda73[_0xac4a('0x5')],_0x5cda73[_0xac4a('0x6')],_0x5cda73[_0xac4a('0x7')],_0x5cda73[_0xac4a('0x8')],_0x5cda73[_0xac4a('0x9')],_0x5cda73[_0xac4a('0xa')],_0x5cda73[_0xac4a('0xb')]];if(!_0x47d4f6)return _['every'](_0x2f48ed);var _0x5b8339=_[_0xac4a('0xc')](_0x2f48ed);return _0x5b8339[_0xac4a('0xd')]>0x0&&_0x5b8339[_0xac4a('0xd')]<_0x2f48ed['length']?!![]:![];}function isIdle(_0x1d182e){return _0x1d182e===_0xac4a('0xe')||_0x1d182e===_0xac4a('0xf')||_0x1d182e==='unavailable'||_0x1d182e===_0xac4a('0x10')||_['isNil'](_0x1d182e);}function isAgentIdle(_0x2f062c){if(_0x2f062c['voiceStatus']!==_0xac4a('0xe')&&_0x2f062c[_0xac4a('0xa')]){_0x2f062c[_0xac4a('0x11')]='pause';return![];}return _[_0xac4a('0x12')]([_0x2f062c[_0xac4a('0x13')],_0x2f062c[_0xac4a('0x14')],_0x2f062c[_0xac4a('0x15')],_0x2f062c[_0xac4a('0x16')],_0x2f062c[_0xac4a('0x17')],_0x2f062c[_0xac4a('0x11')],_0x2f062c[_0xac4a('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xac4a('0x19')](_0xac4a('0x1a'),{})[_0xac4a('0x1b')](function(_0x26dbb8){if(_0x26dbb8['error']){throw new Error(_0xac4a('0x1c'));}var _0x34d797=_0x26dbb8[_0xac4a('0x1d')];return routingClient[_0xac4a('0x19')](_0xac4a('0x1a'),{})[_0xac4a('0x1b')](function(_0x28e304){if(_0x28e304[_0xac4a('0x1e')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x5ac21e=_0x28e304[_0xac4a('0x1d')];return _[_0xac4a('0x1f')]({},_0x34d797,_0x5ac21e);});})[_0xac4a('0x20')](function(_0x4d837c){throw _0x4d837c;});}exports[_0xac4a('0x21')]=getRealtimeAgents;function getAgentStatus(_0x15c223){var _0x3752e4=_0xac4a('0xf');if(isAgentPaused(_0x15c223))_0x3752e4=_0xac4a('0x22');else if(isAgentPaused(_0x15c223,!![]))_0x3752e4=_0xac4a('0x23');else if(isAgentIdle(_0x15c223))_0x3752e4=_0xac4a('0xe');else _0x3752e4=_0xac4a('0x24');return _0x3752e4;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x3d8f0a,_0x3204ad){var _0x599787=_[_0xac4a('0x25')](_0x3d8f0a)?_0x3d8f0a:[_0x3d8f0a];var _0x4169c0=_[_0xac4a('0x26')](_0x3204ad)+_0xac4a('0x27');var _0x4d2d6c=_[_0xac4a('0x28')](_0x599787,function(_0x2503d8){return db[_0x4169c0][_0xac4a('0x29')]({'where':{'id':_0x2503d8}})[_0xac4a('0x1b')](function(_0x594f36){if(!_0x594f36)return[];return _0x594f36[_0xac4a('0x2a')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xac4a('0x2b')](_0x4d2d6c)[_0xac4a('0x1b')](function(_0x3e2c69){var _0x3bc318=_(_0x3e2c69)[_0xac4a('0x2c')]()[_0xac4a('0x28')]('id')[_0xac4a('0x2d')]()[_0xac4a('0x2e')]();return _0x3bc318;});}exports[_0xac4a('0x2f')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x20202c,_0x4e17ce,_0x23b061){try{if(_0x4e17ce[_0xac4a('0xd')]>0x0){_0x20202c=_0x20202c[_0xac4a('0xc')](function(_0x2772fe){return _0x4e17ce[_0xac4a('0x30')](_0x2772fe['id']);});}var _0x4a5a9e=_0x20202c['filter'](function(_0xdb7e){var _0x7a948b=_0xac4a('0x24');if(isAgentIdle(_0xdb7e)){_0x7a948b='idle';}return _0x7a948b===_0x23b061;});return _['map'](_0x4a5a9e,'id');}catch(_0x355755){throw _0x355755;}}exports[_0xac4a('0x31')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x228629,_0x432066,_0x17118e){return Promise['resolve']()[_0xac4a('0x1b')](function(){if(_0x432066['length']>0x0){_0x228629=_0x228629[_0xac4a('0xc')](function(_0x57adcf){return _0x432066[_0xac4a('0x30')](_0x57adcf['id']);});}return _0x228629;})[_0xac4a('0x1b')](function(){return db[_0xac4a('0x32')][_0xac4a('0x33')]({'attributes':['id',_0xac4a('0x34'),_0xac4a('0x35'),_0xac4a('0x5'),_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0x36')],'where':{'id':{'$in':_['map'](_0x228629,'id')}},'raw':!![]});})[_0xac4a('0x1b')](function(_0x1c41fb){return _0x1c41fb['map'](function(_0x2a5419){var _0x1af1c1=_['find'](_0x228629,['id',_0x2a5419['id']]);var _0x58804b=filterAgentAttributes(_0x1af1c1);_[_0xac4a('0x1f')](_0x2a5419,_0x58804b);_0x2a5419[_0xac4a('0x37')]=getAgentStatus(_0x2a5419);return _0x2a5419;});})[_0xac4a('0x1b')](function(_0x3de9e2){var _0x4f5986=sortAgentsByStatus(_0x3de9e2,_0x17118e);return _[_0xac4a('0x28')](_0x4f5986,'id');})[_0xac4a('0x20')](function(_0x4e7630){throw _0x4e7630;});}exports[_0xac4a('0x38')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x34f55c){var _0x3ea5c8={'fields':[],'order':null};var _0x5f0eb8=_0x34f55c[_0xac4a('0x39')](',');_0x3ea5c8[_0xac4a('0x3a')]=_[_0xac4a('0xc')](_0x5f0eb8,function(_0x4e0445){if(!_0x4e0445[_0xac4a('0x30')](_0xac4a('0x37'))){return!![];}_0x3ea5c8['order']=_['startsWith'](_0x4e0445,'-')?_0xac4a('0x3b'):'ASC';return![];});return _0x3ea5c8;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x5f0af0){if(!_0x5f0af0){_0x5f0af0='fullname,internal';}if(_0x5f0af0[_0xac4a('0x30')](_0xac4a('0x35'))&&!_0x5f0af0[_0xac4a('0x30')](_0xac4a('0x3c'))){var _0x2bdb21=_0x5f0af0[_0xac4a('0x3d')](0x0,_0x5f0af0[_0xac4a('0x3e')](_0xac4a('0x35')));_0x5f0af0+=','+_0x2bdb21+_0xac4a('0x3c');}return _0x5f0af0;}exports[_0xac4a('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x14f7d5,_0x1c2a87){var _0x4e4994=_0x14f7d5['sort'](function(_0x5cd24f,_0x1e1cc5){if(_0x5cd24f[_0xac4a('0x37')]===_0x1e1cc5[_0xac4a('0x37')]){if(_0x5cd24f[_0xac4a('0x37')]===_0xac4a('0x22')){if(_0x1c2a87===_0xac4a('0x3b')){return(_0x5cd24f[_0xac4a('0x36')]||'')<(_0x1e1cc5[_0xac4a('0x36')]||'')||_0x5cd24f[_0xac4a('0x35')][_0xac4a('0x40')]()>_0x1e1cc5['fullname'][_0xac4a('0x40')]()?0x1:-0x1;}else{return(_0x5cd24f[_0xac4a('0x36')]||'')<(_0x1e1cc5[_0xac4a('0x36')]||'')||_0x5cd24f[_0xac4a('0x35')][_0xac4a('0x40')]()>_0x1e1cc5['fullname'][_0xac4a('0x40')]()?-0x1:0x1;}}else{if(_0x1c2a87===_0xac4a('0x3b')){return _0x5cd24f['fullname'][_0xac4a('0x40')]()<_0x1e1cc5['fullname'][_0xac4a('0x40')]()?0x1:-0x1;}else{return _0x5cd24f[_0xac4a('0x35')][_0xac4a('0x40')]()<_0x1e1cc5[_0xac4a('0x35')][_0xac4a('0x40')]()?-0x1:0x1;}}}else{if(_0x1c2a87===_0xac4a('0x3b')){return _0x5cd24f[_0xac4a('0x37')]<_0x1e1cc5[_0xac4a('0x37')]?0x1:-0x1;}else{return _0x5cd24f[_0xac4a('0x37')]<_0x1e1cc5[_0xac4a('0x37')]?-0x1:0x1;}}});return _0x4e4994;}exports[_0xac4a('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x3b68b3){var _0x569812=[_0xac4a('0x42'),_0xac4a('0x43'),_0xac4a('0x44'),'lastPauseAt',_0xac4a('0x36'),_0xac4a('0x45'),'internal',_0xac4a('0x46'),'chatPause',_0xac4a('0x8'),_0xac4a('0x7'),_0xac4a('0x9'),'whatsappPause','faxPause',_0xac4a('0xa'),'chatCapacity',_0xac4a('0x47'),'mailCapacity',_0xac4a('0x48'),'whatsappCapacity',_0xac4a('0x49'),_0xac4a('0x4a'),_0xac4a('0x4b'),_0xac4a('0x4c'),'smsCurrentCapacity',_0xac4a('0x4d'),_0xac4a('0x4e'),_0xac4a('0x13'),_0xac4a('0x16'),_0xac4a('0x15'),_0xac4a('0x17'),_0xac4a('0x18'),'faxStatus',_0xac4a('0x11'),_0xac4a('0x4f'),'openchannelStatusTime',_0xac4a('0x50'),_0xac4a('0x51'),_0xac4a('0x52'),_0xac4a('0x53'),'voiceStatusTime',_0xac4a('0x54'),_0xac4a('0x55'),_0xac4a('0x56'),_0xac4a('0x57'),_0xac4a('0x58'),'routealias'];var _0x179373=['chatPause',_0xac4a('0x8'),_0xac4a('0x7'),'smsPause','whatsappPause',_0xac4a('0x6'),_0xac4a('0xa'),'online'];var _0x18d29c=_(_0x3b68b3)[_0xac4a('0x59')](_0x179373)[_0xac4a('0x5a')](_0x569812)[_0xac4a('0x2e')]();return _0x18d29c;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xac4a('0x34'),_0xac4a('0x35'),_0xac4a('0x5b'),_0xac4a('0x3c'),_0xac4a('0x43'),_0xac4a('0x37'),_0xac4a('0x42'),'lastLoginAt',_0xac4a('0x36'),_0xac4a('0x45'),_0xac4a('0x6'),_0xac4a('0x5'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0x13'),_0xac4a('0x14'),_0xac4a('0x15'),_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x11'),_0xac4a('0x18'),'chatStatusTime',_0xac4a('0x53'),'mailStatusTime',_0xac4a('0x5c'),'smsStatusTime',_0xac4a('0x5d'),'whatsappStatusTime',_0xac4a('0x5e'),'faxCapacity','mailCapacity',_0xac4a('0x47'),_0xac4a('0x48'),_0xac4a('0x5f'),_0xac4a('0x4a'),_0xac4a('0x4e'),_0xac4a('0x4c'),'openchannelCurrentCapacity',_0xac4a('0x60'),'whatsappCurrentCapacity',_0xac4a('0x57'),'phoneBarEnableAutomaticScreenRecording',_0xac4a('0x55'),_0xac4a('0x61'),_0xac4a('0x54'),_0xac4a('0x62'),_0xac4a('0x56')];}exports[_0xac4a('0x63')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x31f0=['mailStatus','openchannelStatus','smsStatus','whatsappStatus','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','isArray','map','findOne','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','faxPause','mailPause','openchannelPause','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','indexOf','sort','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','role','lastLoginAt','faxStatus','openchannelStatusTime','voiceStatusTime','whatsappStatusTime','faxCapacity','openchannelCurrentCapacity','destconnectedlinenum','onhold','getRealtimeAgentsQueryFields','lodash','../../mysqldb','http','client','chatPause','smsPause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','voicePause','pause','chatStatus'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0x31f0,0xb7));var _0x031f=function(_0x37283c,_0x1159ab){_0x37283c=_0x37283c-0x0;var _0x26be53=_0x31f0[_0x37283c];return _0x26be53;};'use strict';var _=require(_0x031f('0x0'));var jayson=require('jayson/promise');var db=require(_0x031f('0x1'))['db'];var amiClient=jayson['client'][_0x031f('0x2')]({'port':0x232a});var routingClient=jayson[_0x031f('0x3')][_0x031f('0x2')]({'port':0x232c});function isAgentPaused(_0xf20620,_0x526a45){var _0x3c0612=[_0xf20620[_0x031f('0x4')],_0xf20620['faxPause'],_0xf20620['mailPause'],_0xf20620['openchannelPause'],_0xf20620[_0x031f('0x5')],_0xf20620['voicePause'],_0xf20620[_0x031f('0x6')]];if(!_0x526a45)return _[_0x031f('0x7')](_0x3c0612);var _0x2569b6=_[_0x031f('0x8')](_0x3c0612);return _0x2569b6['length']>0x0&&_0x2569b6[_0x031f('0x9')]<_0x3c0612[_0x031f('0x9')]?!![]:![];}function isIdle(_0x327f11){return _0x327f11===_0x031f('0xa')||_0x327f11===_0x031f('0xb')||_0x327f11===_0x031f('0xc')||_0x327f11===_0x031f('0xd')||_[_0x031f('0xe')](_0x327f11);}function isAgentIdle(_0x4df318){if(_0x4df318[_0x031f('0xf')]!==_0x031f('0xa')&&_0x4df318[_0x031f('0x10')]){_0x4df318[_0x031f('0xf')]=_0x031f('0x11');return![];}return _[_0x031f('0x7')]([_0x4df318[_0x031f('0x12')],_0x4df318['faxStatus'],_0x4df318[_0x031f('0x13')],_0x4df318[_0x031f('0x14')],_0x4df318[_0x031f('0x15')],_0x4df318[_0x031f('0xf')],_0x4df318[_0x031f('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})[_0x031f('0x17')](function(_0x3a10aa){if(_0x3a10aa[_0x031f('0x18')]){throw new Error(_0x031f('0x19'));}var _0x5196b1=_0x3a10aa[_0x031f('0x1a')];return routingClient[_0x031f('0x1b')]('Agents',{})[_0x031f('0x17')](function(_0x535e70){if(_0x535e70[_0x031f('0x18')]){throw new Error(_0x031f('0x1c'));}var _0x563bc8=_0x535e70[_0x031f('0x1a')];return _[_0x031f('0x1d')]({},_0x5196b1,_0x563bc8);});})[_0x031f('0x1e')](function(_0x1b76d6){throw _0x1b76d6;});}exports[_0x031f('0x1f')]=getRealtimeAgents;function getAgentStatus(_0xf76f1b){var _0x345bde=_0x031f('0xb');if(isAgentPaused(_0xf76f1b))_0x345bde='pause';else if(isAgentPaused(_0xf76f1b,!![]))_0x345bde=_0x031f('0x20');else if(isAgentIdle(_0xf76f1b))_0x345bde=_0x031f('0xa');else _0x345bde=_0x031f('0x21');return _0x345bde;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x5c4184,_0xa11a2b){var _0x4d0f92=_[_0x031f('0x22')](_0x5c4184)?_0x5c4184:[_0x5c4184];var _0x57f6c4=_['startCase'](_0xa11a2b)+'Queue';var _0x971691=_[_0x031f('0x23')](_0x4d0f92,function(_0x2920cd){return db[_0x57f6c4][_0x031f('0x24')]({'where':{'id':_0x2920cd}})['then'](function(_0x374b65){if(!_0x374b65)return[];return _0x374b65['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x031f('0x25')](_0x971691)[_0x031f('0x17')](function(_0xfa77b1){var _0x567666=_(_0xfa77b1)[_0x031f('0x26')]()[_0x031f('0x23')]('id')['uniq']()[_0x031f('0x27')]();return _0x567666;});}exports[_0x031f('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2403e9,_0x5395ea,_0xa308b){try{if(_0x5395ea[_0x031f('0x9')]>0x0){_0x2403e9=_0x2403e9[_0x031f('0x8')](function(_0xaf5bea){return _0x5395ea[_0x031f('0x29')](_0xaf5bea['id']);});}var _0x301bd2=_0x2403e9['filter'](function(_0x1f62eb){var _0xab24ad=_0x031f('0x21');if(isAgentIdle(_0x1f62eb)){_0xab24ad=_0x031f('0xa');}return _0xab24ad===_0xa308b;});return _[_0x031f('0x23')](_0x301bd2,'id');}catch(_0x2d24f0){throw _0x2d24f0;}}exports[_0x031f('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x87dc07,_0x2034ac,_0xfc4a89){return Promise[_0x031f('0x2b')]()['then'](function(){if(_0x2034ac[_0x031f('0x9')]>0x0){_0x87dc07=_0x87dc07[_0x031f('0x8')](function(_0xb3a6bd){return _0x2034ac[_0x031f('0x29')](_0xb3a6bd['id']);});}return _0x87dc07;})[_0x031f('0x17')](function(){return db[_0x031f('0x2c')][_0x031f('0x2d')]({'attributes':['id',_0x031f('0x2e'),_0x031f('0x2f'),_0x031f('0x4'),_0x031f('0x30'),_0x031f('0x31'),_0x031f('0x32'),'smsPause',_0x031f('0x10'),_0x031f('0x6'),'pauseType'],'where':{'id':{'$in':_[_0x031f('0x23')](_0x87dc07,'id')}},'raw':!![]});})[_0x031f('0x17')](function(_0x4ec696){return _0x4ec696[_0x031f('0x23')](function(_0x22e486){var _0x41750a=_[_0x031f('0x33')](_0x87dc07,['id',_0x22e486['id']]);var _0x4b5c42=filterAgentAttributes(_0x41750a);_['merge'](_0x22e486,_0x4b5c42);_0x22e486[_0x031f('0x34')]=getAgentStatus(_0x22e486);return _0x22e486;});})['then'](function(_0x43ab76){var _0x2aa0aa=sortAgentsByStatus(_0x43ab76,_0xfc4a89);return _[_0x031f('0x23')](_0x2aa0aa,'id');})['catch'](function(_0x5c33c5){throw _0x5c33c5;});}exports[_0x031f('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5ed480){var _0x57b9c8={'fields':[],'order':null};var _0x2d489a=_0x5ed480[_0x031f('0x36')](',');_0x57b9c8[_0x031f('0x37')]=_[_0x031f('0x8')](_0x2d489a,function(_0x11c03c){if(!_0x11c03c[_0x031f('0x29')](_0x031f('0x34'))){return!![];}_0x57b9c8['order']=_[_0x031f('0x38')](_0x11c03c,'-')?_0x031f('0x39'):_0x031f('0x3a');return![];});return _0x57b9c8;}exports[_0x031f('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x58daa2){if(!_0x58daa2){_0x58daa2=_0x031f('0x3c');}if(_0x58daa2[_0x031f('0x29')](_0x031f('0x2f'))&&!_0x58daa2['includes'](_0x031f('0x3d'))){var _0x3b504c=_0x58daa2['substring'](0x0,_0x58daa2[_0x031f('0x3e')](_0x031f('0x2f')));_0x58daa2+=','+_0x3b504c+'internal';}return _0x58daa2;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x178135,_0x1d85bb){var _0x9efbc4=_0x178135[_0x031f('0x3f')](function(_0x2691b7,_0xf0fb95){if(_0x2691b7[_0x031f('0x34')]===_0xf0fb95['globalStatus']){if(_0x2691b7[_0x031f('0x34')]===_0x031f('0x11')){if(_0x1d85bb==='DESC'){return(_0x2691b7[_0x031f('0x40')]||'')<(_0xf0fb95['pauseType']||'')||_0x2691b7[_0x031f('0x2f')][_0x031f('0x41')]()>_0xf0fb95['fullname'][_0x031f('0x41')]()?0x1:-0x1;}else{return(_0x2691b7[_0x031f('0x40')]||'')<(_0xf0fb95[_0x031f('0x40')]||'')||_0x2691b7['fullname'][_0x031f('0x41')]()>_0xf0fb95[_0x031f('0x2f')][_0x031f('0x41')]()?-0x1:0x1;}}else{if(_0x1d85bb===_0x031f('0x39')){return _0x2691b7[_0x031f('0x2f')][_0x031f('0x41')]()<_0xf0fb95[_0x031f('0x2f')][_0x031f('0x41')]()?0x1:-0x1;}else{return _0x2691b7[_0x031f('0x2f')]['toLowerCase']()<_0xf0fb95[_0x031f('0x2f')][_0x031f('0x41')]()?-0x1:0x1;}}}else{if(_0x1d85bb===_0x031f('0x39')){return _0x2691b7[_0x031f('0x34')]<_0xf0fb95[_0x031f('0x34')]?0x1:-0x1;}else{return _0x2691b7[_0x031f('0x34')]<_0xf0fb95[_0x031f('0x34')]?-0x1:0x1;}}});return _0x9efbc4;}exports[_0x031f('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x3411f1){var _0x5f033b=[_0x031f('0x43'),'online','lastLoginAt',_0x031f('0x44'),_0x031f('0x40'),_0x031f('0x44'),_0x031f('0x3d'),_0x031f('0x45'),'chatPause',_0x031f('0x32'),_0x031f('0x31'),_0x031f('0x5'),'whatsappPause',_0x031f('0x30'),_0x031f('0x10'),_0x031f('0x46'),_0x031f('0x47'),_0x031f('0x48'),_0x031f('0x49'),'whatsappCapacity','faxCapacity',_0x031f('0x4a'),'openchannelCurrentCapacity',_0x031f('0x4b'),_0x031f('0x4c'),'whatsappCurrentCapacity',_0x031f('0x4d'),'chatStatus','openchannelStatus',_0x031f('0x13'),'smsStatus',_0x031f('0x16'),'faxStatus',_0x031f('0xf'),_0x031f('0x4e'),'openchannelStatusTime',_0x031f('0x4f'),_0x031f('0x50'),'whatsappStatusTime',_0x031f('0x51'),'voiceStatusTime',_0x031f('0x52'),'destconnectedlinenum',_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x56')];var _0x691a68=['chatPause',_0x031f('0x32'),'mailPause',_0x031f('0x5'),_0x031f('0x6'),'faxPause',_0x031f('0x10'),_0x031f('0x57')];var _0x510d17=_(_0x3411f1)[_0x031f('0x58')](_0x691a68)[_0x031f('0x59')](_0x5f033b)[_0x031f('0x27')]();return _0x510d17;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x031f('0x2e'),'fullname',_0x031f('0x5a'),'internal',_0x031f('0x57'),'globalStatus',_0x031f('0x43'),_0x031f('0x5b'),'pauseType','lastPauseAt',_0x031f('0x30'),_0x031f('0x4'),'mailPause',_0x031f('0x32'),_0x031f('0x5'),_0x031f('0x10'),_0x031f('0x6'),_0x031f('0x12'),_0x031f('0x5c'),_0x031f('0x13'),_0x031f('0x14'),'smsStatus',_0x031f('0xf'),_0x031f('0x16'),_0x031f('0x4e'),'faxStatusTime',_0x031f('0x4f'),_0x031f('0x5d'),'smsStatusTime',_0x031f('0x5e'),_0x031f('0x5f'),_0x031f('0x46'),_0x031f('0x60'),'mailCapacity','openchannelCapacity','smsCapacity','whatsappCapacity',_0x031f('0x4a'),_0x031f('0x4d'),'mailCurrentCapacity',_0x031f('0x61'),_0x031f('0x4c'),'whatsappCurrentCapacity',_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x62'),_0x031f('0x63'),_0x031f('0x52'),_0x031f('0x56'),_0x031f('0x53')];}exports[_0x031f('0x64')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 6b8514e..6da17b8 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 _0x9e30=['find','merge','pick','initializeQueues','lodash','util','client','http','available','loggedIn','paused','waiting','busy','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','statusMessage','dialActive','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','startCase','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','concat','outbound','map'];(function(_0x474f02,_0x44c5af){var _0x47321d=function(_0x40e0de){while(--_0x40e0de){_0x474f02['push'](_0x474f02['shift']());}};_0x47321d(++_0x44c5af);}(_0x9e30,0x1ee));var _0x09e3=function(_0x43747e,_0x13b832){_0x43747e=_0x43747e-0x0;var _0x7fb853=_0x9e30[_0x43747e];return _0x7fb853;};'use strict';var _=require(_0x09e3('0x0'));var jayson=require('jayson/promise');var util=require(_0x09e3('0x1'));var amiClient=jayson[_0x09e3('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x09e3('0x2')][_0x09e3('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x09e3('0x4'),_0x09e3('0x5'),_0x09e3('0x6'),_0x09e3('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x09e3('0x8'),'inUse',_0x09e3('0x9'),_0x09e3('0xa'),_0x09e3('0xb'),_0x09e3('0xc'),_0x09e3('0xd'),_0x09e3('0xe'),_0x09e3('0xf'),_0x09e3('0x10'),_0x09e3('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x09e3('0x12'),_0x09e3('0x13'),'message',_0x09e3('0x14'),_0x09e3('0x15'),_0x09e3('0x16'),'Trunk','startPredictive',_0x09e3('0x17'),_0x09e3('0x18'),_0x09e3('0x19'),_0x09e3('0x1a'),_0x09e3('0x1b'),_0x09e3('0x1c'),'dialPredictiveIntervalMaxThreshold',_0x09e3('0x1d'),'predictiveIntervalAvailable',_0x09e3('0x1e'),_0x09e3('0x1f'),_0x09e3('0x20'),_0x09e3('0x21'),'predictiveIntervalAvgHoldtime',_0x09e3('0x22')];function getRealtimeQueues(_0x4326e8,_0x1836b7){var _0x41e239=_0x1836b7===_0x09e3('0x23')?amiClient:routingClient;return _0x41e239['request'](_[_0x09e3('0x24')](_0x1836b7)+'Queues',_0x4326e8)['then'](function(_0x2bda7c){if(_0x2bda7c[_0x09e3('0x25')])throw new Error(util[_0x09e3('0x26')](_0x09e3('0x27'),_0x1836b7));return _0x2bda7c['result'];})[_0x09e3('0x28')](function(_0x2ecc1e){throw _0x2ecc1e;});}exports[_0x09e3('0x29')]=getRealtimeQueues;function initializeQueues(_0x1110d5,_0x1c2011,_0x575296,_0x14367a){var _0x4e2452=DEFAULT_QUEUE_ATTRIBUTES;if(_0x575296===_0x09e3('0x23')){if(_0x14367a==='inbound'){_0x4e2452=_0x4e2452[_0x09e3('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x14367a===_0x09e3('0x2b')){_0x4e2452=_0x4e2452['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1110d5[_0x09e3('0x2c')](function(_0x47e66b){var _0x3984ae=_0x47e66b['get']({'plain':!![]});_0x3984ae[_0x09e3('0x6')]=0x0;_0x3984ae['loggedInDb']=0x0;_0x3984ae[_0x09e3('0x5')]=0x0;_0x3984ae['available']=0x0;_0x3984ae[_0x09e3('0x7')]=0x0;if(_0x575296===_0x09e3('0x23')){_0x3984ae[_0x09e3('0xf')]=0x0;_0x3984ae[_0x09e3('0x8')]=0x0;if(_0x14367a===_0x09e3('0x2b')){_0x3984ae[_0x09e3('0x12')]=0x0;_0x3984ae[_0x09e3('0x13')]=0x0;}}var _0x489ad1=_[_0x09e3('0x2d')](_0x1c2011,['id',_0x3984ae['id']]);if(_0x489ad1){_[_0x09e3('0x2e')](_0x3984ae,_[_0x09e3('0x2f')](_0x489ad1,_0x4e2452));}return _0x3984ae;});}exports[_0x09e3('0x30')]=initializeQueues; \ No newline at end of file +var _0x6924=['then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','map','loggedInDb','outbound','pTalking','originated','find','merge','lodash','jayson/promise','util','client','http','loggedIn','paused','waiting','busy','inUse','onHold','ringing','ringInUse','talking','unavailable','unknown','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues'];(function(_0x3bc325,_0xd0df50){var _0x27ac39=function(_0x30a028){while(--_0x30a028){_0x3bc325['push'](_0x3bc325['shift']());}};_0x27ac39(++_0xd0df50);}(_0x6924,0x136));var _0x4692=function(_0xeda976,_0x5e6928){_0xeda976=_0xeda976-0x0;var _0x5a7486=_0x6924[_0xeda976];return _0x5a7486;};'use strict';var _=require(_0x4692('0x0'));var jayson=require(_0x4692('0x1'));var util=require(_0x4692('0x2'));var amiClient=jayson[_0x4692('0x3')][_0x4692('0x4')]({'port':0x232a});var routingClient=jayson[_0x4692('0x3')][_0x4692('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x4692('0x5'),_0x4692('0x6'),_0x4692('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x4692('0x8'),_0x4692('0x9'),'invalid','loggedInDb','notInUse',_0x4692('0xa'),_0x4692('0xb'),_0x4692('0xc'),_0x4692('0xd'),_0x4692('0xe'),_0x4692('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated','message',_0x4692('0x10'),_0x4692('0x11'),_0x4692('0x12'),_0x4692('0x13'),_0x4692('0x14'),_0x4692('0x15'),_0x4692('0x16'),_0x4692('0x17'),_0x4692('0x18'),_0x4692('0x19'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x4692('0x1a'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x4692('0x1b'),'predictiveIntervalAvgHoldtime',_0x4692('0x1c')];function getRealtimeQueues(_0x94ae6a,_0x19fbb5){var _0x15af5d=_0x19fbb5===_0x4692('0x1d')?amiClient:routingClient;return _0x15af5d[_0x4692('0x1e')](_[_0x4692('0x1f')](_0x19fbb5)+_0x4692('0x20'),_0x94ae6a)[_0x4692('0x21')](function(_0x3eecc7){if(_0x3eecc7[_0x4692('0x22')])throw new Error(util[_0x4692('0x23')](_0x4692('0x24'),_0x19fbb5));return _0x3eecc7[_0x4692('0x25')];})[_0x4692('0x26')](function(_0x1ad645){throw _0x1ad645;});}exports[_0x4692('0x27')]=getRealtimeQueues;function initializeQueues(_0x27d5ad,_0x560fa2,_0x4853ce,_0x20d91f){var _0xbb4fb5=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4853ce===_0x4692('0x1d')){if(_0x20d91f===_0x4692('0x28')){_0xbb4fb5=_0xbb4fb5[_0x4692('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x20d91f==='outbound'){_0xbb4fb5=_0xbb4fb5[_0x4692('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x27d5ad[_0x4692('0x2a')](function(_0x21f4f6){var _0xb73ada=_0x21f4f6['get']({'plain':!![]});_0xb73ada['paused']=0x0;_0xb73ada[_0x4692('0x2b')]=0x0;_0xb73ada[_0x4692('0x5')]=0x0;_0xb73ada['available']=0x0;_0xb73ada[_0x4692('0x7')]=0x0;if(_0x4853ce===_0x4692('0x1d')){_0xb73ada[_0x4692('0xd')]=0x0;_0xb73ada[_0x4692('0x8')]=0x0;if(_0x20d91f===_0x4692('0x2c')){_0xb73ada[_0x4692('0x2d')]=0x0;_0xb73ada[_0x4692('0x2e')]=0x0;}}var _0x47984d=_[_0x4692('0x2f')](_0x560fa2,['id',_0xb73ada['id']]);if(_0x47984d){_[_0x4692('0x30')](_0xb73ada,_['pick'](_0x47984d,_0xbb4fb5));}return _0xb73ada;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 4401ad1..ebd1a26 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(_0x91ec40,_0xa1ec3b){var _0x428c7a=function(_0x196f25){while(--_0x196f25){_0x91ec40['push'](_0x91ec40['shift']());}};_0x428c7a(++_0xa1ec3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 871a775..80d12f0 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 _0x26fd=['lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','keys','length','filter','family','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','cpus','model','md5','update','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','createHash','substring'];(function(_0x45b6d5,_0x55c53c){var _0x46d9d8=function(_0x43031f){while(--_0x43031f){_0x45b6d5['push'](_0x45b6d5['shift']());}};_0x46d9d8(++_0x55c53c);}(_0x26fd,0xcc));var _0xd26f=function(_0xf13ca6,_0x5735ea){_0xf13ca6=_0xf13ca6-0x0;var _0x4a4387=_0x26fd[_0xf13ca6];return _0x4a4387;};'use strict';var _=require(_0xd26f('0x0'));var os=require('os');var crypto=require(_0xd26f('0x1'));var machine=require(_0xd26f('0x2'));var exec=require(_0xd26f('0x3'))[_0xd26f('0x4')];var config=require(_0xd26f('0x5'));function getInterfaces(){var _0xf2f3d0=[];var _0x5d118e=os['networkInterfaces']();var _0x5c48d1=_['orderBy'](_[_0xd26f('0x6')](_0x5d118e));for(var _0x42ed80=0x0;_0x42ed80<_0x5c48d1[_0xd26f('0x7')];_0x42ed80++){var _0x5e0328=_0x5d118e[_0x5c48d1[_0x42ed80]][_0xd26f('0x8')](function(_0x55afb4){return _0x55afb4[_0xd26f('0x9')]===_0xd26f('0xa')&&_0x55afb4['internal']===![];});_0xf2f3d0=_0xf2f3d0[_0xd26f('0xb')](_0x5e0328);}return _0xf2f3d0;}function getFirstInterface(){var _0x4b88e1=_['head'](getInterfaces());return{'macAddress':_0x4b88e1&&_0x4b88e1[_0xd26f('0xc')]?_0x4b88e1[_0xd26f('0xc')]:_0xd26f('0xd'),'ipAddress':_0x4b88e1&&_0x4b88e1['address']?_0x4b88e1[_0xd26f('0xe')]:_0xd26f('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x101743=_[_0xd26f('0x10')](os[_0xd26f('0x11')]()['map'](function(_0x2ccf46){return _0x2ccf46[_0xd26f('0x12')];}))['join'](':');return crypto['createHash'](_0xd26f('0x13'))[_0xd26f('0x14')](_0x101743)[_0xd26f('0x15')](_0xd26f('0x16'));}exports[_0xd26f('0x17')]=function(){var _0x34c752=os['platform']();var _0x23a7da=/[0-9a-f-]{36}/;if(config[_0xd26f('0x18')]&&_0x23a7da[_0xd26f('0x19')](config['licenseToken'])){return config[_0xd26f('0x18')];}else if(_0x34c752===_0xd26f('0x1a')){return exec(_0xd26f('0x1b'),{'encoding':'utf8'})[_0xd26f('0x1c')]('\x0d\x0a','');}else{var _0x1779ac=getFirstInterface();var _0x1852dc=getCPUhash();var _0x228b52=_0x1852dc+'|'+os[_0xd26f('0x1d')]()+'|'+_0x1779ac[_0xd26f('0x1e')]+'|'+_0x1779ac[_0xd26f('0x1f')];var _0x1e7466=crypto[_0xd26f('0x20')](_0xd26f('0x13'))['update'](_0x228b52)['digest']('hex');return _0x1e7466[_0xd26f('0x21')](0x0,0x8)+'-'+_0x1e7466[_0xd26f('0x21')](0x8,0xc)+'-'+_0x1e7466[_0xd26f('0x21')](0xc,0x10)+'-'+_0x1e7466['substring'](0x10,0x14)+'-'+_0x1e7466[_0xd26f('0x21')](0x14);}}; \ No newline at end of file +var _0x8cc7=['filter','IPv4','internal','concat','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','model','createHash','md5','update','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys'];(function(_0x540036,_0x4cc668){var _0x35f8da=function(_0x5b3087){while(--_0x5b3087){_0x540036['push'](_0x540036['shift']());}};_0x35f8da(++_0x4cc668);}(_0x8cc7,0xee));var _0x78cc=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x8cc7[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x78cc('0x0'));var machine=require(_0x78cc('0x1'));var exec=require(_0x78cc('0x2'))[_0x78cc('0x3')];var config=require(_0x78cc('0x4'));function getInterfaces(){var _0x4efc04=[];var _0x35ad3c=os[_0x78cc('0x5')]();var _0x5baee9=_['orderBy'](_[_0x78cc('0x6')](_0x35ad3c));for(var _0x3236e5=0x0;_0x3236e5<_0x5baee9['length'];_0x3236e5++){var _0x4a7472=_0x35ad3c[_0x5baee9[_0x3236e5]][_0x78cc('0x7')](function(_0x361ad0){return _0x361ad0['family']===_0x78cc('0x8')&&_0x361ad0[_0x78cc('0x9')]===![];});_0x4efc04=_0x4efc04[_0x78cc('0xa')](_0x4a7472);}return _0x4efc04;}function getFirstInterface(){var _0x19a935=_['head'](getInterfaces());return{'macAddress':_0x19a935&&_0x19a935[_0x78cc('0xb')]?_0x19a935[_0x78cc('0xb')]:_0x78cc('0xc'),'ipAddress':_0x19a935&&_0x19a935[_0x78cc('0xd')]?_0x19a935[_0x78cc('0xd')]:'127.0.0.1'};}exports[_0x78cc('0xe')]=getFirstInterface;function getCPUhash(){var _0x4faa72=_[_0x78cc('0xf')](os[_0x78cc('0x10')]()[_0x78cc('0x11')](function(_0x11e9cd){return _0x11e9cd[_0x78cc('0x12')];}))['join'](':');return crypto[_0x78cc('0x13')](_0x78cc('0x14'))[_0x78cc('0x15')](_0x4faa72)['digest'](_0x78cc('0x16'));}exports[_0x78cc('0x17')]=function(){var _0x47e3b8=os[_0x78cc('0x18')]();var _0x2b5f80=/[0-9a-f-]{36}/;if(config[_0x78cc('0x19')]&&_0x2b5f80['test'](config[_0x78cc('0x19')])){return config['licenseToken'];}else if(_0x47e3b8===_0x78cc('0x1a')){return exec(_0x78cc('0x1b'),{'encoding':_0x78cc('0x1c')})[_0x78cc('0x1d')]('\x0d\x0a','');}else{var _0x3b2055=getFirstInterface();var _0x5e7613=getCPUhash();var _0x3d2415=_0x5e7613+'|'+os[_0x78cc('0x1e')]()+'|'+_0x3b2055[_0x78cc('0x1f')]+'|'+_0x3b2055[_0x78cc('0x20')];var _0x2b33fe=crypto[_0x78cc('0x13')](_0x78cc('0x14'))['update'](_0x3d2415)[_0x78cc('0x21')](_0x78cc('0x16'));return _0x2b33fe[_0x78cc('0x22')](0x0,0x8)+'-'+_0x2b33fe[_0x78cc('0x22')](0x8,0xc)+'-'+_0x2b33fe[_0x78cc('0x22')](0xc,0x10)+'-'+_0x2b33fe[_0x78cc('0x22')](0x10,0x14)+'-'+_0x2b33fe[_0x78cc('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a39dc62..7a0c86a 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 _0x43b2=['bluebird','../../mysqldb','./hardware','license','https://www.xcallymotion.com','format','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','moment'];(function(_0x30c5ce,_0x3e3f7a){var _0x33cc16=function(_0x5138af){while(--_0x5138af){_0x30c5ce['push'](_0x30c5ce['shift']());}};_0x33cc16(++_0x3e3f7a);}(_0x43b2,0xb7));var _0x243b=function(_0x12c31a,_0x2b9ca4){_0x12c31a=_0x12c31a-0x0;var _0x12dc12=_0x43b2[_0x12c31a];return _0x12dc12;};'use strict';var util=require(_0x243b('0x0'));var moment=require(_0x243b('0x1'));var rp=require('request-promise');var BPromise=require(_0x243b('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0x243b('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x243b('0x4'));var logger=require('../logger')(_0x243b('0x5'));var HOST=_0x243b('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x40d209){return new BPromise(function(_0x46eac8,_0x24f169){var _0x218b4b=util[_0x243b('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0x40d209,module['exports'][_0x243b('0x8')]);if(oldToken){_0x218b4b=util['format'](_0x243b('0x9'),HOST,_0x40d209,module[_0x243b('0xa')][_0x243b('0x8')],oldToken);}var _0xb00b3e={'uri':_0x218b4b,'method':_0x243b('0xb'),'timeout':0xea60,'json':!![]};return rp(_0xb00b3e)[_0x243b('0xc')](function(_0x18a068){_0x46eac8(_0x18a068);})[_0x243b('0xd')](function(_0x542515){_0x24f169(_0x542515);});});}function manageLicense(_0x2e2480,_0x1a121a){var _0x289f0f=_0x1a121a[_0x243b('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x289f0f[_0x243b('0xf')]!==_0x2e2480&&!_0x289f0f['data2']){oldToken=_0x289f0f[_0x243b('0xf')];}httpRequest(_0x2e2480)['then'](function(_0x5def7d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5def7d[_0x243b('0x10')]){isOldTokenSent=![];if(!_0x289f0f[_0x243b('0x5')]&&_0x289f0f[_0x243b('0x5')]!=_0x5def7d[_0x243b('0x5')]||_0x289f0f['license']&&_0x289f0f[_0x243b('0x11')]){logger[_0x243b('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x289f0f['license']&&!_0x289f0f[_0x243b('0x11')]&&_0x289f0f[_0x243b('0x5')]!=_0x5def7d['license']){logger[_0x243b('0x12')](_0x243b('0x13'));}if(_0x289f0f['license']&&!_0x289f0f[_0x243b('0x11')]&&_0x289f0f[_0x243b('0x5')]==_0x5def7d[_0x243b('0x5')]){return _0x1a121a;}return _0x1a121a[_0x243b('0x14')]({'data1':_0x2e2480,'data2':null,'license':_0x5def7d[_0x243b('0x5')]});}else{if(_0x5def7d[_0x243b('0x5')]||_0x289f0f[_0x243b('0x5')]){if(!_0x289f0f[_0x243b('0x11')]){if(_0x289f0f['data1']==_0x2e2480){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x243b('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x243b('0x12')](_0x243b('0x16'),_0x289f0f[_0x243b('0xf')],_0x2e2480);}logger[_0x243b('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x243b('0x17')](),moment()[_0x243b('0x7')](_0x243b('0x18')));return _0x1a121a[_0x243b('0x14')]({'data2':encryptor[_0x243b('0x19')](moment()['format'](_0x243b('0x18')))});}else{if(moment()['diff'](encryptor[_0x243b('0x1a')](_0x289f0f[_0x243b('0x11')]),_0x243b('0x1b'))>DAYS){logger['info'](_0x243b('0x1c'),moment()[_0x243b('0x7')](_0x243b('0x18')));isOldTokenSent=![];return _0x1a121a[_0x243b('0x14')]({'data1':_0x2e2480,'data2':null,'license':null});}}}else{if(_0x289f0f[_0x243b('0xf')]!=_0x2e2480){logger[_0x243b('0x12')](_0x243b('0x16'),_0x289f0f['data1'],_0x2e2480);return _0x1a121a[_0x243b('0x14')]({'data1':_0x2e2480,'data2':null,'license':null});}}}return _0x1a121a;})[_0x243b('0xc')](function(_0x156dcd){_0x1a121a=_0x156dcd;})[_0x243b('0xd')](function(_0x2d7549){logger[_0x243b('0x1d')](_0x2d7549['message']);})[_0x243b('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0x243b('0x1f')](),_0x1a121a);},TIME);});}function defaultLicense(){var _0x2d5858=hardware[_0x243b('0x1f')]();if(_0x2d5858){return db[_0x243b('0x20')][_0x243b('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x2d5858}})[_0x243b('0x22')](function(_0x582ebc,_0x128671){logger['info'](_0x243b('0x23'),_0x2d5858);manageLicense(_0x2d5858,_0x582ebc);})[_0x243b('0xd')](function(_0x1812e5){logger[_0x243b('0x1d')](_0x1812e5[_0x243b('0x24')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xaae2=['NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','default','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','exports','GET','catch','get','data2','data1','then','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xaae2,0x15b));var _0x2aae=function(_0x485339,_0xcc9263){_0x485339=_0x485339-0x0;var _0x2be72b=_0xaae2[_0x485339];return _0x2be72b;};'use strict';var util=require('util');var moment=require(_0x2aae('0x0'));var rp=require(_0x2aae('0x1'));var BPromise=require(_0x2aae('0x2'));var pkginfo=require('pkginfo')(module,_0x2aae('0x3'));var db=require(_0x2aae('0x4'))['db'];var encryptor=require(_0x2aae('0x5'));var hardware=require(_0x2aae('0x6'));var logger=require('../logger')(_0x2aae('0x7'));var HOST=_0x2aae('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1acf15){return new BPromise(function(_0x463010,_0xa06fcb){var _0x62aa6c=util[_0x2aae('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x1acf15,module['exports'][_0x2aae('0x3')]);if(oldToken){_0x62aa6c=util[_0x2aae('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x1acf15,module[_0x2aae('0xa')][_0x2aae('0x3')],oldToken);}var _0x1311b1={'uri':_0x62aa6c,'method':_0x2aae('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x1311b1)['then'](function(_0x535c7e){_0x463010(_0x535c7e);})[_0x2aae('0xc')](function(_0x28db24){_0xa06fcb(_0x28db24);});});}function manageLicense(_0x86d047,_0x3f1ac5){var _0x36d3e6=_0x3f1ac5[_0x2aae('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x36d3e6['data1']!==_0x86d047&&!_0x36d3e6[_0x2aae('0xe')]){oldToken=_0x36d3e6[_0x2aae('0xf')];}httpRequest(_0x86d047)[_0x2aae('0x10')](function(_0x5e9d23){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5e9d23['active']){isOldTokenSent=![];if(!_0x36d3e6['license']&&_0x36d3e6[_0x2aae('0x7')]!=_0x5e9d23[_0x2aae('0x7')]||_0x36d3e6['license']&&_0x36d3e6[_0x2aae('0xe')]){logger[_0x2aae('0x11')](_0x2aae('0x12'));}if(_0x36d3e6[_0x2aae('0x7')]&&!_0x36d3e6[_0x2aae('0xe')]&&_0x36d3e6['license']!=_0x5e9d23[_0x2aae('0x7')]){logger['info'](_0x2aae('0x13'));}if(_0x36d3e6[_0x2aae('0x7')]&&!_0x36d3e6[_0x2aae('0xe')]&&_0x36d3e6[_0x2aae('0x7')]==_0x5e9d23['license']){return _0x3f1ac5;}return _0x3f1ac5[_0x2aae('0x14')]({'data1':_0x86d047,'data2':null,'license':_0x5e9d23[_0x2aae('0x7')]});}else{if(_0x5e9d23['license']||_0x36d3e6[_0x2aae('0x7')]){if(!_0x36d3e6[_0x2aae('0xe')]){if(_0x36d3e6['data1']==_0x86d047){GRAY_PERIOD_REASON=_0x2aae('0x15');logger[_0x2aae('0x11')](_0x2aae('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x2aae('0x11')](_0x2aae('0x17'),_0x36d3e6[_0x2aae('0xf')],_0x86d047);}logger[_0x2aae('0x11')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x2aae('0x18')](),moment()['format'](_0x2aae('0x19')));return _0x3f1ac5[_0x2aae('0x14')]({'data2':encryptor[_0x2aae('0x1a')](moment()[_0x2aae('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x2aae('0x1b')](_0x36d3e6[_0x2aae('0xe')]),_0x2aae('0x1c'))>DAYS){logger[_0x2aae('0x11')](_0x2aae('0x1d'),moment()[_0x2aae('0x9')](_0x2aae('0x19')));isOldTokenSent=![];return _0x3f1ac5[_0x2aae('0x14')]({'data1':_0x86d047,'data2':null,'license':null});}}}else{if(_0x36d3e6[_0x2aae('0xf')]!=_0x86d047){logger[_0x2aae('0x11')](_0x2aae('0x17'),_0x36d3e6[_0x2aae('0xf')],_0x86d047);return _0x3f1ac5[_0x2aae('0x14')]({'data1':_0x86d047,'data2':null,'license':null});}}}return _0x3f1ac5;})[_0x2aae('0x10')](function(_0x4a68fc){_0x3f1ac5=_0x4a68fc;})[_0x2aae('0xc')](function(_0x5b3c45){logger[_0x2aae('0x1e')](_0x5b3c45[_0x2aae('0x1f')]);})[_0x2aae('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x2aae('0x21')](),_0x3f1ac5);},TIME);});}function defaultLicense(){var _0x5761c7=hardware[_0x2aae('0x21')]();if(_0x5761c7){return db['License'][_0x2aae('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x5761c7}})[_0x2aae('0x23')](function(_0x2e1e56,_0x17d69b){logger[_0x2aae('0x11')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x5761c7);manageLicense(_0x5761c7,_0x2e1e56);})[_0x2aae('0xc')](function(_0x52c66a){logger[_0x2aae('0x1e')](_0x52c66a[_0x2aae('0x1f')]);});}}exports[_0x2aae('0x24')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f5bc9b0..c0600b6 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 _0x67e8=['countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','find','defaults','then','catch','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','getUuid','gray','deadline','add','grayReason','uuid','machineUuid','changed','message','User','findAll','role','sequelize','col','admin','user','telephone','telephones','count','pick'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0x67e8,0xe0));var _0x867e=function(_0x271a55,_0x254bf4){_0x271a55=_0x271a55-0x0;var _0x17c23c=_0x67e8[_0x271a55];return _0x17c23c;};'use strict';var util=require(_0x867e('0x0'));var _=require('lodash');var moment=require(_0x867e('0x1'));var BPromise=require(_0x867e('0x2'));var hardware=require(_0x867e('0x3'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x867e('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x867e('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x867e('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x867e('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1ab51a){return new BPromise(function(_0x13c712,_0x47406f){return db[_0x867e('0x7')][_0x867e('0x8')](_[_0x867e('0x9')](_0x1ab51a,{'raw':!![],'where':{'id':0x1}}))[_0x867e('0xa')](function(_0x3cd5f2){return checkLicense(_0x3cd5f2,null);})[_0x867e('0xa')](function(_0x7fe3){_0x13c712(_0x7fe3);return;})[_0x867e('0xb')](function(_0x253a00){_0x47406f(_0x253a00);});});}function checkLicense(_0x31f01d,_0x5282f4){if(!_0x31f01d){demoLicense['uuid']=_0x31f01d[_0x867e('0xc')];return demoLicense;}try{var _0x4160b6=_0x5282f4||_0x31f01d[_0x867e('0xd')];if(_['isEmpty'](_0x4160b6)){throw new Error(_0x867e('0xe'));}var _0x2ca176=_0x31f01d[_0x867e('0xc')];var _0x4aae17=_0x31f01d[_0x867e('0xf')];var _0x1e9a73=_0x2ca176[_0x867e('0x10')]('-')[0x4];var _0x14a106=_0x2ca176[_0x867e('0x10')]('-')[0x0];var _0x572a72=encryptor[_0x867e('0x11')](_0x4160b6,util[_0x867e('0x12')]('%s:%s:%s',_0x1e9a73,_0x2ca176,_0x14a106));var _0x321088=JSON[_0x867e('0x13')](_0x572a72);_0x321088['demo']=![];_0x321088['uuid']=_0x2ca176;_0x321088['machineUuid']=hardware[_0x867e('0x14')]();if(_0x4aae17){var _0x53fbd0=encryptor[_0x867e('0x11')](_0x4aae17);_0x321088[_0x867e('0x15')]=_0x53fbd0;_0x321088[_0x867e('0x16')]=moment(_0x53fbd0)[_0x867e('0x17')](0x7,'days')['format']();_0x321088[_0x867e('0x18')]=_0x321088[_0x867e('0x19')]!=_0x321088[_0x867e('0x1a')]?_0x867e('0x1b'):'disabled';}return _0x321088;}catch(_0xc8d5b6){breakingLicense[_0x867e('0x19')]=_0x31f01d[_0x867e('0xc')];breakingLicense[_0x867e('0x1c')]=_0xc8d5b6[_0x867e('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xfb86c5,_0x168d05){getLicense()['then'](function(_0x46e58){return db[_0x867e('0x1d')][_0x867e('0x1e')]({'attributes':[_0x867e('0x1f'),[db[_0x867e('0x20')]['fn']('COUNT',db['sequelize'][_0x867e('0x21')](_0x867e('0x1f'))),'count']],'group':_0x867e('0x1f'),'where':{'role':{'$or':[_0x867e('0x22'),_0x867e('0x23'),_0x867e('0x24')]}},'raw':!![]})[_0x867e('0xa')](function(_0xaecea4){var _0x3b72c9={'user':_0x46e58['users']||0x0,'telephone':_0x46e58[_0x867e('0x25')]||0x0};_0xaecea4['forEach'](function(_0x31345a){var _0x211009=_0x31345a['role']==='admin'?_0x867e('0x23'):_0x31345a[_0x867e('0x1f')];_0x3b72c9[_0x211009]-=_0x31345a[_0x867e('0x26')];if(_0x3b72c9[_0x211009]<0x0)_0x3b72c9[_0x211009]=0x0;});_0xfb86c5(_0x3b72c9);return;});})[_0x867e('0xb')](function(_0x47b0d1){_0x168d05(_0x47b0d1);});});}function checkUserLimits(_0x5842b8){return new BPromise(function(_0x16c642,_0x3131ee){getLimits()[_0x867e('0xa')](function(_0x26520f){var _0x4717f7=_[_0x867e('0x27')](_[_0x867e('0x28')](_0x5842b8,_0x867e('0x1f')),[_0x867e('0x22'),_0x867e('0x23'),'telephone']);var _0x4a36ee=(_0x4717f7[_0x867e('0x22')]||0x0)+(_0x4717f7[_0x867e('0x23')]||0x0);var _0xe41ed=_0x4717f7['telephone']||0x0;if(_0x4a36ee>_0x26520f['user'])return _0x3131ee(_0x867e('0x29'));if(_0xe41ed>_0x26520f['telephone'])return _0x3131ee(_0x867e('0x2a'));return _0x16c642();})[_0x867e('0xb')](function(_0x5af11e){_0x3131ee(_0x5af11e);});});}module[_0x867e('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x1a20=['add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','col','admin','user','forEach','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','parse','machineUuid','deadline'];(function(_0x2b0f04,_0x590fdd){var _0x8df3db=function(_0x21dc3a){while(--_0x21dc3a){_0x2b0f04['push'](_0x2b0f04['shift']());}};_0x8df3db(++_0x590fdd);}(_0x1a20,0xd0));var _0x01a2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1a20[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x01a2('0x0'));var _=require(_0x01a2('0x1'));var moment=require(_0x01a2('0x2'));var BPromise=require(_0x01a2('0x3'));var hardware=require(_0x01a2('0x4'));var encryptor=require(_0x01a2('0x5'));var db=require(_0x01a2('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x01a2('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x01a2('0x8'),'machineUuid':hardware[_0x01a2('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x01a2('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x01a2('0xa'),'machineUuid':hardware[_0x01a2('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x220055){return new BPromise(function(_0x22c87a,_0x39eba1){return db[_0x01a2('0xb')]['find'](_[_0x01a2('0xc')](_0x220055,{'raw':!![],'where':{'id':0x1}}))[_0x01a2('0xd')](function(_0x5e7be9){return checkLicense(_0x5e7be9,null);})['then'](function(_0x30e1f8){_0x22c87a(_0x30e1f8);return;})[_0x01a2('0xe')](function(_0x3bb747){_0x39eba1(_0x3bb747);});});}function checkLicense(_0x3e0e02,_0x3e39ad){if(!_0x3e0e02){demoLicense[_0x01a2('0xf')]=_0x3e0e02['data1'];return demoLicense;}try{var _0x3163b4=_0x3e39ad||_0x3e0e02[_0x01a2('0x10')];if(_[_0x01a2('0x11')](_0x3163b4)){throw new Error(_0x01a2('0x12'));}var _0x1fd8cc=_0x3e0e02[_0x01a2('0x13')];var _0x547417=_0x3e0e02[_0x01a2('0x14')];var _0x3bf707=_0x1fd8cc[_0x01a2('0x15')]('-')[0x4];var _0x3390e8=_0x1fd8cc[_0x01a2('0x15')]('-')[0x0];var _0x25db1d=encryptor[_0x01a2('0x16')](_0x3163b4,util[_0x01a2('0x17')]('%s:%s:%s',_0x3bf707,_0x1fd8cc,_0x3390e8));var _0x535fa2=JSON[_0x01a2('0x18')](_0x25db1d);_0x535fa2['demo']=![];_0x535fa2[_0x01a2('0xf')]=_0x1fd8cc;_0x535fa2[_0x01a2('0x19')]=hardware['getUuid']();if(_0x547417){var _0x40839a=encryptor['decryptString'](_0x547417);_0x535fa2['gray']=_0x40839a;_0x535fa2[_0x01a2('0x1a')]=moment(_0x40839a)[_0x01a2('0x1b')](0x7,_0x01a2('0x1c'))['format']();_0x535fa2[_0x01a2('0x1d')]=_0x535fa2['uuid']!=_0x535fa2[_0x01a2('0x19')]?_0x01a2('0x1e'):_0x01a2('0x1f');}return _0x535fa2;}catch(_0x16fa7d){breakingLicense['uuid']=_0x3e0e02[_0x01a2('0x13')];breakingLicense[_0x01a2('0x20')]=_0x16fa7d[_0x01a2('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xcf7c20,_0x3f7418){getLicense()['then'](function(_0x453a8a){return db[_0x01a2('0x21')][_0x01a2('0x22')]({'attributes':[_0x01a2('0x23'),[db[_0x01a2('0x24')]['fn']('COUNT',db[_0x01a2('0x24')][_0x01a2('0x25')](_0x01a2('0x23'))),'count']],'group':_0x01a2('0x23'),'where':{'role':{'$or':[_0x01a2('0x26'),_0x01a2('0x27'),'telephone']}},'raw':!![]})[_0x01a2('0xd')](function(_0x440b57){var _0x2d1e88={'user':_0x453a8a['users']||0x0,'telephone':_0x453a8a['telephones']||0x0};_0x440b57[_0x01a2('0x28')](function(_0x1159db){var _0x4d6b3e=_0x1159db[_0x01a2('0x23')]===_0x01a2('0x26')?_0x01a2('0x27'):_0x1159db[_0x01a2('0x23')];_0x2d1e88[_0x4d6b3e]-=_0x1159db[_0x01a2('0x29')];if(_0x2d1e88[_0x4d6b3e]<0x0)_0x2d1e88[_0x4d6b3e]=0x0;});_0xcf7c20(_0x2d1e88);return;});})[_0x01a2('0xe')](function(_0x49b2b6){_0x3f7418(_0x49b2b6);});});}function checkUserLimits(_0x381091){return new BPromise(function(_0xddd892,_0x15df39){getLimits()[_0x01a2('0xd')](function(_0x50c40b){var _0x631cd9=_[_0x01a2('0x2a')](_[_0x01a2('0x2b')](_0x381091,'role'),[_0x01a2('0x26'),_0x01a2('0x27'),_0x01a2('0x2c')]);var _0x3e4677=(_0x631cd9[_0x01a2('0x26')]||0x0)+(_0x631cd9[_0x01a2('0x27')]||0x0);var _0x4ace09=_0x631cd9[_0x01a2('0x2c')]||0x0;if(_0x3e4677>_0x50c40b[_0x01a2('0x27')])return _0x15df39(_0x01a2('0x2d'));if(_0x4ace09>_0x50c40b[_0x01a2('0x2c')])return _0x15df39(_0x01a2('0x2e'));return _0xddd892();})[_0x01a2('0xe')](function(_0x11a5b2){_0x15df39(_0x11a5b2);});});}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 e14ec37..7c1294b 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 _0xf2e3=['myappanuglar-secret','app-id','secret','exports'];(function(_0x54006d,_0x5f1fed){var _0x147408=function(_0x248f4d){while(--_0x248f4d){_0x54006d['push'](_0x54006d['shift']());}};_0x147408(++_0x5f1fed);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xf2e3[_0x2e4e19];return _0x9ba20b;};'use strict';module[_0x3f2e('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3f2e('0x1'),'GOOGLE_ID':_0x3f2e('0x2'),'GOOGLE_SECRET':_0x3f2e('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x1399=['app-id','exports','http://localhost:9000'];(function(_0x4775e5,_0x174143){var _0x5489f9=function(_0x4537cd){while(--_0x4537cd){_0x4775e5['push'](_0x4775e5['shift']());}};_0x5489f9(++_0x174143);}(_0x1399,0x16c));var _0x9139=function(_0x24c1d0,_0x4dec43){_0x24c1d0=_0x24c1d0-0x0;var _0x388583=_0x1399[_0x24c1d0];return _0x388583;};'use strict';module[_0x9139('0x0')]={'DOMAIN':_0x9139('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x9139('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 174febb..0c6f6b4 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb929=['fileLogger','../utils/loggers'];(function(_0x8feb4e,_0xf32a5b){var _0x92e04c=function(_0xb58a4b){while(--_0xb58a4b){_0x8feb4e['push'](_0x8feb4e['shift']());}};_0x92e04c(++_0xf32a5b);}(_0xb929,0xf9));var _0x9b92=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb929[_0x321bb2];return _0x9c12ed;};'use strict';var fileLogger=require(_0x9b92('0x0'))[_0x9b92('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x169b=['exports','fileLogger'];(function(_0x245e10,_0x38a356){var _0x207281=function(_0x5a273a){while(--_0x5a273a){_0x245e10['push'](_0x245e10['shift']());}};_0x207281(++_0x38a356);}(_0x169b,0x117));var _0xb169=function(_0x4b4812,_0x50db53){_0x4b4812=_0x4b4812-0x0;var _0x8438c7=_0x169b[_0x4b4812];return _0x8438c7;};'use strict';var fileLogger=require('../utils/loggers')[_0xb169('0x0')];module[_0xb169('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 8975295..89c5727 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 _0x7acc=['routing','xdr','path','../../config/environment','resolve','join','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','../../services/email/index.js'];(function(_0x167c4d,_0x42cf51){var _0x2ae722=function(_0x45e276){while(--_0x45e276){_0x167c4d['push'](_0x167c4d['shift']());}};_0x2ae722(++_0x42cf51);}(_0x7acc,0xde));var _0xc7ac=function(_0x38ade5,_0x50a6e4){_0x38ade5=_0x38ade5-0x0;var _0x31c40b=_0x7acc[_0x38ade5];return _0x31c40b;};'use strict';var path=require(_0xc7ac('0x0'));var cfg=require(_0xc7ac('0x1'));var env={'NODE_PATH':path[_0xc7ac('0x2')](path[_0xc7ac('0x3')](cfg['root'],_0xc7ac('0x4')))};var pm2config={'apps':[{'name':_0xc7ac('0x5'),'script':path[_0xc7ac('0x3')](__dirname,_0xc7ac('0x6')),'env':env},{'name':'ami','script':path['join'](__dirname,_0xc7ac('0x7')),'env':env},{'name':'agi','script':path[_0xc7ac('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0xc7ac('0x3')](__dirname,_0xc7ac('0x8')),'env':env},{'name':_0xc7ac('0x9'),'script':path[_0xc7ac('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xc7ac('0xa'),'script':path[_0xc7ac('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x6cbe=['legacy-libs','express','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','resolve','join','root'];(function(_0x2ef2dc,_0x40be6a){var _0xefdade=function(_0x165f33){while(--_0x165f33){_0x2ef2dc['push'](_0x2ef2dc['shift']());}};_0xefdade(++_0x40be6a);}(_0x6cbe,0x106));var _0xe6cb=function(_0x37e0ff,_0x7b4c73){_0x37e0ff=_0x37e0ff-0x0;var _0x4dbeb6=_0x6cbe[_0x37e0ff];return _0x4dbeb6;};'use strict';var path=require(_0xe6cb('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xe6cb('0x1')](path[_0xe6cb('0x2')](cfg[_0xe6cb('0x3')],_0xe6cb('0x4')))};var pm2config={'apps':[{'name':_0xe6cb('0x5'),'script':path[_0xe6cb('0x2')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xe6cb('0x6'),'script':path[_0xe6cb('0x2')](__dirname,_0xe6cb('0x7')),'env':env},{'name':_0xe6cb('0x8'),'script':path[_0xe6cb('0x2')](__dirname,_0xe6cb('0x9')),'env':env},{'name':'email','script':path['join'](__dirname,_0xe6cb('0xa')),'env':env},{'name':'routing','script':path[_0xe6cb('0x2')](__dirname,_0xe6cb('0xb')),'env':env},{'name':_0xe6cb('0xc'),'script':path['join'](__dirname,_0xe6cb('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index f8081ce..ee84c66 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 _0x8e0d=['describe','dump','pm2','connect','connected','start','then','disconnect','stop','list'];(function(_0x4f027d,_0x3f9587){var _0xc46890=function(_0x27d06c){while(--_0x27d06c){_0x4f027d['push'](_0x4f027d['shift']());}};_0xc46890(++_0x3f9587);}(_0x8e0d,0x1a6));var _0xd8e0=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x8e0d[_0x95942];return _0x6d7f81;};'use strict';var pm2=require(_0xd8e0('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x265a0a,_0x10b233){return pm2[_0xd8e0('0x1')](function(_0xf1f214){if(_0xf1f214){return _0x10b233(_0xf1f214);}return _0x265a0a(_0xd8e0('0x2'));});});};exports[_0xd8e0('0x3')]=function(_0x19c7cc){return connect()[_0xd8e0('0x4')](function(){return new BPromise(function(_0x47b9bf,_0x581c22){return pm2[_0xd8e0('0x3')](_0x19c7cc,function(_0x4f16ba,_0xe840f6){if(_0x4f16ba){return _0x581c22(_0x4f16ba);}pm2[_0xd8e0('0x5')]();return _0x47b9bf(_0xe840f6);});});});};exports[_0xd8e0('0x6')]=function(_0x2b8579){return connect()[_0xd8e0('0x4')](function(){return new BPromise(function(_0x296384,_0x48a2fe){return pm2[_0xd8e0('0x6')](_0x2b8579,function(_0x4e65ff,_0x13e85){if(_0x4e65ff){return _0x48a2fe(_0x4e65ff);}pm2[_0xd8e0('0x5')]();return _0x296384(_0x13e85);});});});};exports['restart']=function(_0x2d2853){return connect()[_0xd8e0('0x4')](function(){return new BPromise(function(_0x1e9e7c,_0x4c55c3){return pm2['restart'](_0x2d2853,function(_0x692e29,_0x23ed5b){if(_0x692e29){return _0x4c55c3(_0x692e29);}pm2[_0xd8e0('0x5')]();return _0x1e9e7c(_0x23ed5b);});});});};exports[_0xd8e0('0x7')]=function(){return connect()[_0xd8e0('0x4')](function(){return new BPromise(function(_0x52af9e,_0x398ace){return pm2['list'](function(_0x4be274,_0x1e5e07){if(_0x4be274){return _0x398ace(_0x4be274);}pm2['disconnect']();return _0x52af9e(_0x1e5e07);});});});};exports[_0xd8e0('0x8')]=function(_0x4539cc){return connect()[_0xd8e0('0x4')](function(){return new BPromise(function(_0x1bcd45,_0xe5aac1){return pm2['describe'](_0x4539cc,function(_0x3b5ff5,_0x5ddefd){if(_0x3b5ff5){return _0xe5aac1(_0x3b5ff5);}pm2[_0xd8e0('0x5')]();return _0x1bcd45(_0x5ddefd);});});});};exports['delete']=function(_0x41eb55){return connect()[_0xd8e0('0x4')](function(){return new BPromise(function(_0x402de9,_0x12869b){return pm2['delete'](_0x41eb55,function(_0x37cbd4,_0x5cbb1f){if(_0x37cbd4){return _0x12869b(_0x37cbd4);}pm2[_0xd8e0('0x5')]();return _0x402de9(_0x5cbb1f);});});});};exports[_0xd8e0('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2efcf7,_0x4f6158){return pm2[_0xd8e0('0x9')](function(_0x4953f5){if(_0x4953f5){return _0x4f6158(_0x4953f5);}return _0x2efcf7('saved');});});});}; \ No newline at end of file +var _0x3c78=['connect','connected','start','then','disconnect','stop','restart','describe','delete','dump','saved','pm2','./config'];(function(_0x5a0f4b,_0x4c6bc0){var _0x493a46=function(_0x5c6ffb){while(--_0x5c6ffb){_0x5a0f4b['push'](_0x5a0f4b['shift']());}};_0x493a46(++_0x4c6bc0);}(_0x3c78,0x1ab));var _0x83c7=function(_0xbbe8da,_0x49a528){_0xbbe8da=_0xbbe8da-0x0;var _0x4780ec=_0x3c78[_0xbbe8da];return _0x4780ec;};'use strict';var pm2=require(_0x83c7('0x0'));var BPromise=require('bluebird');var config=require(_0x83c7('0x1'));function connect(){return new BPromise(function(_0x20e5ec,_0x5e068c){return pm2[_0x83c7('0x2')](function(_0x23f53b){if(_0x23f53b){return _0x5e068c(_0x23f53b);}return _0x20e5ec(_0x83c7('0x3'));});});};exports[_0x83c7('0x4')]=function(_0x3b1a47){return connect()[_0x83c7('0x5')](function(){return new BPromise(function(_0x488f13,_0x5b4a92){return pm2[_0x83c7('0x4')](_0x3b1a47,function(_0x39623e,_0x5e61f8){if(_0x39623e){return _0x5b4a92(_0x39623e);}pm2[_0x83c7('0x6')]();return _0x488f13(_0x5e61f8);});});});};exports[_0x83c7('0x7')]=function(_0x5bb63b){return connect()['then'](function(){return new BPromise(function(_0x1775ad,_0x337f74){return pm2[_0x83c7('0x7')](_0x5bb63b,function(_0x18e5a5,_0x5da729){if(_0x18e5a5){return _0x337f74(_0x18e5a5);}pm2['disconnect']();return _0x1775ad(_0x5da729);});});});};exports[_0x83c7('0x8')]=function(_0x4c198e){return connect()[_0x83c7('0x5')](function(){return new BPromise(function(_0x3cfde0,_0x5dcf8b){return pm2[_0x83c7('0x8')](_0x4c198e,function(_0x5af265,_0x519dba){if(_0x5af265){return _0x5dcf8b(_0x5af265);}pm2['disconnect']();return _0x3cfde0(_0x519dba);});});});};exports['list']=function(){return connect()[_0x83c7('0x5')](function(){return new BPromise(function(_0x496766,_0x55b17e){return pm2['list'](function(_0xd18aea,_0x2d642d){if(_0xd18aea){return _0x55b17e(_0xd18aea);}pm2[_0x83c7('0x6')]();return _0x496766(_0x2d642d);});});});};exports[_0x83c7('0x9')]=function(_0x172b7f){return connect()[_0x83c7('0x5')](function(){return new BPromise(function(_0x48438d,_0x23a71a){return pm2[_0x83c7('0x9')](_0x172b7f,function(_0x53d5c0,_0x782c0b){if(_0x53d5c0){return _0x23a71a(_0x53d5c0);}pm2[_0x83c7('0x6')]();return _0x48438d(_0x782c0b);});});});};exports['delete']=function(_0x4841c0){return connect()[_0x83c7('0x5')](function(){return new BPromise(function(_0x270be1,_0x4176c2){return pm2[_0x83c7('0xa')](_0x4841c0,function(_0x5b08ed,_0x59c094){if(_0x5b08ed){return _0x4176c2(_0x5b08ed);}pm2[_0x83c7('0x6')]();return _0x270be1(_0x59c094);});});});};exports[_0x83c7('0xb')]=function(){return connect()[_0x83c7('0x5')](function(){return new BPromise(function(_0x1b7991,_0x16391e){return pm2[_0x83c7('0xb')](function(_0x34fc37){if(_0x34fc37){return _0x16391e(_0x34fc37);}return _0x1b7991(_0x83c7('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a8ef515..d1ccb1c 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 _0xacb4=['[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','Setting','chatTimeout','then','findAll','lastMsgAt','subtract','length','info','[CHAT]\x20Interactions\x20to\x20close:','update','timeout','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5a39c3,_0x7fa035){var _0x366141=function(_0x8e64fd){while(--_0x8e64fd){_0x5a39c3['push'](_0x5a39c3['shift']());}};_0x366141(++_0x7fa035);}(_0xacb4,0xbc));var _0x4acb=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xacb4[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x4acb('0x0'));var moment=require(_0x4acb('0x1'));var Redis=require(_0x4acb('0x2'));var util=require(_0x4acb('0x3'));var config=require(_0x4acb('0x4'));var db=require(_0x4acb('0x5'))['db'];var logger=require(_0x4acb('0x6'))(_0x4acb('0x7'));config['redis']=_[_0x4acb('0x8')](config[_0x4acb('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4acb('0x9')]));function closeInteractions(){var _0x124301=0x0;var _0x151be3=[];return db[_0x4acb('0xa')]['find']({'raw':!![],'attributes':['id',_0x4acb('0xb')],'where':{'id':0x1}})[_0x4acb('0xc')](function(_0x2d64be){_0x124301=_0x2d64be[_0x4acb('0xb')];if(_0x124301){return db['ChatInteraction'][_0x4acb('0xd')]({'raw':!![],'attributes':['id',_0x4acb('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4acb('0xf')](_0x2d64be['chatTimeout'],'minutes')}}});}else{return[];}})[_0x4acb('0xc')](function(_0x4f9fd2){if(_0x4f9fd2&&_0x4f9fd2[_0x4acb('0x10')]){_0x151be3=_['map'](_0x4f9fd2||[],'id');logger[_0x4acb('0x11')](_0x4acb('0x12'),_0x151be3['join']());return db['ChatInteraction'][_0x4acb('0x13')]({'closeReason':'system','disposition':_0x4acb('0x14'),'closed':!![],'closedAt':moment()['format'](_0x4acb('0x15'))},{'where':{'id':_0x151be3}});}})[_0x4acb('0xc')](function(){if(_0x151be3&&_0x151be3[_0x4acb('0x10')]){logger[_0x4acb('0x11')](_0x4acb('0x16'),_0x151be3[_0x4acb('0x17')]());for(var _0x56be56=0x0;_0x56be56<_0x151be3[_0x4acb('0x10')];_0x56be56++){io[_0x4acb('0x18')](_0x4acb('0x19'),{'id':_0x151be3[_0x56be56],'closed':!![]});}}})[_0x4acb('0x1a')](function(_0x3fa668){logger[_0x4acb('0x1b')](_0x4acb('0x1c'),_0x3fa668?util[_0x4acb('0x1d')](_0x3fa668,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xed6d=['../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','map','info','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xed6d,0x65));var _0xded6=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xed6d[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0xded6('0x0'));var moment=require(_0xded6('0x1'));var Redis=require(_0xded6('0x2'));var util=require(_0xded6('0x3'));var config=require('../../config/environment');var db=require(_0xded6('0x4'))['db'];var logger=require(_0xded6('0x5'))(_0xded6('0x6'));config[_0xded6('0x7')]=_[_0xded6('0x8')](config[_0xded6('0x7')],{'host':_0xded6('0x9'),'port':0x18eb});var io=require(_0xded6('0xa'))(new Redis(config[_0xded6('0x7')]));function closeInteractions(){var _0x150aaf=0x0;var _0x4d248b=[];return db[_0xded6('0xb')][_0xded6('0xc')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0xbdeaa4){_0x150aaf=_0xbdeaa4[_0xded6('0xd')];if(_0x150aaf){return db[_0xded6('0xe')][_0xded6('0xf')]({'raw':!![],'attributes':['id',_0xded6('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xded6('0x11')](_0xbdeaa4[_0xded6('0xd')],_0xded6('0x12'))}}});}else{return[];}})[_0xded6('0x13')](function(_0x56558f){if(_0x56558f&&_0x56558f[_0xded6('0x14')]){_0x4d248b=_[_0xded6('0x15')](_0x56558f||[],'id');logger[_0xded6('0x16')]('[CHAT]\x20Interactions\x20to\x20close:',_0x4d248b[_0xded6('0x17')]());return db['ChatInteraction'][_0xded6('0x18')]({'closeReason':_0xded6('0x19'),'disposition':_0xded6('0x1a'),'closed':!![],'closedAt':moment()[_0xded6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4d248b}});}})['then'](function(){if(_0x4d248b&&_0x4d248b[_0xded6('0x14')]){logger[_0xded6('0x16')](_0xded6('0x1c'),_0x4d248b[_0xded6('0x17')]());for(var _0x227aa9=0x0;_0x227aa9<_0x4d248b[_0xded6('0x14')];_0x227aa9++){io['emit'](_0xded6('0x1d'),{'id':_0x4d248b[_0x227aa9],'closed':!![]});}}})[_0xded6('0x1e')](function(_0x199137){logger[_0xded6('0x1f')](_0xded6('0x20'),_0x199137?util[_0xded6('0x21')](_0x199137,{'showHidden':![],'depth':null}):'');});}exports[_0xded6('0x22')]=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 d159763..14a3d7d 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 _0x3ba5=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x3fa10c,_0x1db998){var _0x1ed01b=function(_0x1b9482){while(--_0x1b9482){_0x3fa10c['push'](_0x3fa10c['shift']());}};_0x1ed01b(++_0x1db998);}(_0x3ba5,0xdf));var _0x53ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ba5[_0x3dd15e];return _0x231fd0;};'use strict';function start(){var _0x16f195=require(_0x53ba('0x0'));return _0x16f195[_0x53ba('0x1')]();}module[_0x53ba('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x18e4=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x91e5da,_0x25ce34){var _0x5533f3=function(_0x15b980){while(--_0x15b980){_0x91e5da['push'](_0x91e5da['shift']());}};_0x5533f3(++_0x25ce34);}(_0x18e4,0xb3));var _0x418e=function(_0x398ec3,_0x403e6c){_0x398ec3=_0x398ec3-0x0;var _0x231f76=_0x18e4[_0x398ec3];return _0x231f76;};'use strict';function start(){var _0x3a6a05=require(_0x418e('0x0'));return _0x3a6a05[_0x418e('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 479fe6d..caaa40e 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 _0x5810=['runReport','CustomReportId','Schedule','findAll','CloudProvider','keys','jobs','map','keyBy','difference','length','toString','exists','stop','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','isBetween','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s'];(function(_0x3b7743,_0x4a832a){var _0x4cd81f=function(_0x3f921d){while(--_0x3f921d){_0x3b7743['push'](_0x3b7743['shift']());}};_0x4cd81f(++_0x4a832a);}(_0x5810,0x70));var _0x0581=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5810[_0xfae23b];return _0x200640;};'use strict';var fs=require('fs');var util=require(_0x0581('0x0'));var path=require('path');var _=require(_0x0581('0x1'));var moment=require(_0x0581('0x2'));var CronJobManager=require(_0x0581('0x3'));var jayson=require(_0x0581('0x4'));var BPromise=require(_0x0581('0x5'));var logger=require(_0x0581('0x6'))('schedule');var db=require(_0x0581('0x7'))['db'];var analyticCustomReportController=require(_0x0581('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x0581('0x9')][_0x0581('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x179db6,_0x457357){return function(){logger[_0x0581('0xb')](_0x0581('0xc'),_0x179db6[_0x0581('0xd')]);var _0x5cdddf=!![];var _0x56ba1a=_0x179db6[_0x0581('0xe')]['getSmtpOptions']();var _0x390703={'account':_0x56ba1a,'message':{'from':util[_0x0581('0xf')](_0x0581('0x10'),_0x179db6['MailAccount']['name'],_0x179db6['MailAccount'][_0x0581('0xd')]||_0x179db6[_0x0581('0xe')]['Smtp'][_0x0581('0x11')]),'to':_0x179db6[_0x0581('0xd')],'cc':_0x179db6['cc'],'bcc':_0x179db6[_0x0581('0x12')],'subject':util['format'](_0x0581('0x13'),_0x457357[_0x0581('0x14')],_0x179db6[_0x0581('0x15')],_0x179db6[_0x0581('0x16')])}};var _0x59a9b1=path[_0x0581('0x17')](__dirname,_0x0581('0x18'));var _0x3f74ae=_0x457357['savename'];var _0x2baa0c=util[_0x0581('0xf')](_0x0581('0x19'),path[_0x0581('0x1a')](_0x457357[_0x0581('0x1b')],path['extname'](_0x457357['savename'])),'zip');var _0x132275=path[_0x0581('0x17')](_0x59a9b1,_0x3f74ae);var _0x27d224=path[_0x0581('0x17')](_0x59a9b1,_0x2baa0c);if(fs[_0x0581('0x1c')](_0x132275)){_0x457357[_0x0581('0x1d')]=_0x0581('0x1e');_0x390703['message'][_0x0581('0x1f')]=[{'filename':_0x3f74ae,'path':_0x132275}];_0x390703[_0x0581('0x20')][_0x0581('0x21')]=util[_0x0581('0xf')](_0x0581('0x22'),JSON[_0x0581('0x23')](_0x457357,null,0x2));}else if(fs[_0x0581('0x1c')](_0x27d224)){_0x457357[_0x0581('0x1d')]=_0x0581('0x1e');_0x390703[_0x0581('0x20')][_0x0581('0x1f')]=[{'filename':_0x2baa0c,'path':_0x27d224}];}else{_0x390703[_0x0581('0x20')][_0x0581('0x21')]=_0x0581('0x24');if(!_0x179db6['sendIfEmpty']){_0x5cdddf=![];logger[_0x0581('0xb')](_0x0581('0x25'));}}if(_0x5cdddf){return client[_0x0581('0x26')](_0x0581('0x27'),_0x390703)[_0x0581('0x28')](function(_0x126db2){if(_0x126db2[_0x0581('0x29')]){return logger[_0x0581('0x29')](_0x0581('0x2a'),JSON[_0x0581('0x23')](_0x126db2));}return logger['info'](_0x0581('0x2b'));})[_0x0581('0x2c')](function(_0x1ec9e4){return logger[_0x0581('0x29')](_0x0581('0x2a'),JSON[_0x0581('0x23')](_0x1ec9e4));});}};}function handleError(){return function(_0x3a00be){return logger[_0x0581('0x29')](JSON[_0x0581('0x23')](_0x3a00be));};}function handleResult(_0xa7d08d){return function(_0x27a78c){logger[_0x0581('0xb')](_0x0581('0x2d'),JSON[_0x0581('0x23')](_0x27a78c));if(_0xa7d08d[_0x0581('0xe')]&&_0xa7d08d['MailAccount'][_0x0581('0x2e')]&&!_[_0x0581('0x2f')](_0xa7d08d[_0x0581('0xd')])){setTimeout(handleSendEmail(_0xa7d08d,_0x27a78c),0x3c*0x3e8);}};}function handleJob(_0x952551){return function(){try{if(_[_0x0581('0x2f')](_0x952551[_0x0581('0x15')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x0581('0x2f')](_0x952551[_0x0581('0x16')])){return logger[_0x0581('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x323031={'startDate':moment()[_0x0581('0x30')](_0x952551[_0x0581('0x15')],_0x952551[_0x0581('0x16')])[_0x0581('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x0581('0x31')),'type':_0x0581('0x32'),'output':_0x952551[_0x0581('0x33')],'name':_0x952551[_0x0581('0x14')]};if(!_[_0x0581('0x2f')](_0x952551[_0x0581('0x34')])){logger[_0x0581('0xb')](_0x0581('0x35'),_0x952551[_0x0581('0x34')]);return analyticDefaultReportController[_0x0581('0x36')]({'id':_0x952551[_0x0581('0x34')]},_0x323031)[_0x0581('0x28')](handleResult(_0x952551))[_0x0581('0x2c')](handleError());}if(!_[_0x0581('0x2f')](_0x952551[_0x0581('0x37')])){logger[_0x0581('0xb')]('exec\x20custom\x20report\x20id:%s',_0x952551[_0x0581('0x37')]);return analyticCustomReportController[_0x0581('0x36')]({'id':_0x952551[_0x0581('0x37')]},_0x323031)[_0x0581('0x28')](handleResult(_0x952551))[_0x0581('0x2c')](handleError());}}catch(_0x5e6b4f){logger[_0x0581('0x29')](JSON[_0x0581('0x23')](_0x5e6b4f));}return logger[_0x0581('0xb')]('no\x20report\x20id');};}function getJobs(_0xd394cb){var _0x3cfc25={};if(_0xd394cb){_0x3cfc25['id']=_0xd394cb;}return db[_0x0581('0x38')][_0x0581('0x39')]({'where':_0x3cfc25,'include':[{'model':db[_0x0581('0xe')],'attributes':['id','name',_0x0581('0xd')],'include':[{'model':db['MailServerOut'],'as':_0x0581('0x2e'),'include':[{'model':db['CloudProvider'],'as':_0x0581('0x3a')}]}]}]})['then'](function(_0x472513){var _0x4ca479=_[_0x0581('0x3b')](manager[_0x0581('0x3c')]);var _0x29be36=_[_0x0581('0x3d')](_0x472513,function(_0x3be394){return _0x3be394['id']['toString']();});var _0x171bc0=_[_0x0581('0x3e')](_0x472513,function(_0x1983cb){return _0x1983cb['id']['toString']();});var _0x15f299=_0xd394cb?_0x29be36:_[_0x0581('0x3f')](_0x29be36,_0x4ca479);var _0x122d58=_['intersection'](_0x29be36,_0x4ca479);var _0x131719=_[_0x0581('0x3f')](_0x4ca479,_0x29be36);var _0x492b8f;var _0x83107e;for(_0x492b8f=0x0;_0x492b8f<_0x131719[_0x0581('0x40')]&&!_0xd394cb;_0x492b8f+=0x1){_0x83107e=_0x131719[_0x492b8f][_0x0581('0x41')]();if(manager[_0x0581('0x42')](_0x83107e)){manager[_0x0581('0x43')](_0x83107e);manager[_0x0581('0x44')](_0x83107e);logger[_0x0581('0xb')](_0x0581('0x45'),_0x83107e);}}logger[_0x0581('0xb')](_0x0581('0x46'),JSON['stringify'](_0x15f299));for(_0x492b8f=0x0;_0x492b8f<_0x15f299[_0x0581('0x40')];_0x492b8f+=0x1){_0x83107e=_0x15f299[_0x492b8f][_0x0581('0x41')]();logger[_0x0581('0xb')](_0x0581('0x47'),_0x83107e);if(_0xd394cb){logger[_0x0581('0xb')]('my\x20id',_0xd394cb);logger[_0x0581('0xb')](JSON[_0x0581('0x23')](_0x171bc0[_0x83107e]));BPromise[_0x0581('0x48')]()[_0x0581('0x28')](handleJob(_0x171bc0[_0x83107e]));logger[_0x0581('0xb')](_0x0581('0x49'),_0x171bc0[_0x83107e]['name'],_0x171bc0[_0x83107e][_0x0581('0x4a')]);}else if(_0x171bc0[_0x83107e][_0x0581('0x4a')]&&_0x171bc0[_0x83107e][_0x0581('0x4b')]&&moment()[_0x0581('0x4c')](_0x171bc0[_0x83107e]['startAt'],_0x171bc0[_0x83107e]['endAt'])){manager['add'](_0x83107e,_0x171bc0[_0x83107e][_0x0581('0x4a')],handleJob(_0x171bc0[_0x83107e]));manager[_0x0581('0x4d')](_0x83107e);logger[_0x0581('0xb')](_0x0581('0x4e'),_0x171bc0[_0x83107e]['name'],_0x171bc0[_0x83107e][_0x0581('0x4a')]);}else if(manager['exists'](_0x83107e)){manager['stop'](_0x83107e);manager[_0x0581('0x44')](_0x83107e);logger[_0x0581('0xb')](_0x0581('0x4f'),_0x171bc0[_0x83107e][_0x0581('0x14')],_0x171bc0[_0x83107e][_0x0581('0x4a')]);}}for(_0x492b8f=0x0,_0x83107e;_0x492b8f<_0x122d58[_0x0581('0x40')]&&!_0xd394cb;_0x492b8f+=0x1){_0x83107e=_0x122d58[_0x492b8f]['toString']();if(manager[_0x0581('0x42')](_0x83107e)){if(_0x171bc0[_0x83107e][_0x0581('0x4a')]&&_0x171bc0[_0x83107e][_0x0581('0x4b')]&&moment()[_0x0581('0x4c')](_0x171bc0[_0x83107e]['startAt'],_0x171bc0[_0x83107e]['endAt'])){manager[_0x0581('0x50')](_0x83107e,_0x171bc0[_0x83107e][_0x0581('0x4a')],handleJob(_0x171bc0[_0x83107e]));logger[_0x0581('0xb')](_0x0581('0x51'),_0x171bc0[_0x83107e][_0x0581('0x14')],_0x171bc0[_0x83107e][_0x0581('0x4a')]);}else{manager['stop'](_0x83107e);manager[_0x0581('0x44')](_0x83107e);logger['info'](_0x0581('0x4f'),_0x171bc0[_0x83107e][_0x0581('0x14')],_0x171bc0[_0x83107e][_0x0581('0x4a')]);}}}})[_0x0581('0x2c')](function(_0x2389b6){logger[_0x0581('0x29')](JSON[_0x0581('0x23')](_0x2389b6));});}exports[_0x0581('0x52')]=function(_0x29ad87){return getJobs(_0x29ad87);};exports[_0x0581('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xced4=['../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','email','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','savename','extname','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','stringify','email\x20sent','catch','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference','intersection','length','exists','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','start','add\x20cron','stop\x20cron','endAt','stop','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule'];(function(_0x142d57,_0x54e075){var _0x561aa2=function(_0x4d9b1d){while(--_0x4d9b1d){_0x142d57['push'](_0x142d57['shift']());}};_0x561aa2(++_0x54e075);}(_0xced4,0x148));var _0x4ced=function(_0x4fe416,_0x5a310a){_0x4fe416=_0x4fe416-0x0;var _0x252725=_0xced4[_0x4fe416];return _0x252725;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x4ced('0x0'));var _=require(_0x4ced('0x1'));var moment=require(_0x4ced('0x2'));var CronJobManager=require(_0x4ced('0x3'));var jayson=require(_0x4ced('0x4'));var BPromise=require(_0x4ced('0x5'));var logger=require(_0x4ced('0x6'))(_0x4ced('0x7'));var db=require(_0x4ced('0x8'))['db'];var analyticCustomReportController=require(_0x4ced('0x9'));var analyticDefaultReportController=require(_0x4ced('0xa'));var client=jayson['client'][_0x4ced('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xc8d0cc,_0x2feff9){return function(){logger[_0x4ced('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0xc8d0cc['email']);var _0x57ad29=!![];var _0x54c474=_0xc8d0cc[_0x4ced('0xd')][_0x4ced('0xe')]();var _0x34a820={'account':_0x54c474,'message':{'from':util[_0x4ced('0xf')](_0x4ced('0x10'),_0xc8d0cc['MailAccount'][_0x4ced('0x11')],_0xc8d0cc[_0x4ced('0xd')][_0x4ced('0x12')]||_0xc8d0cc[_0x4ced('0xd')][_0x4ced('0x13')]['user']),'to':_0xc8d0cc[_0x4ced('0x12')],'cc':_0xc8d0cc['cc'],'bcc':_0xc8d0cc[_0x4ced('0x14')],'subject':util[_0x4ced('0xf')](_0x4ced('0x15'),_0x2feff9[_0x4ced('0x11')],_0xc8d0cc[_0x4ced('0x16')],_0xc8d0cc[_0x4ced('0x17')])}};var _0xb3782f=path[_0x4ced('0x18')](__dirname,_0x4ced('0x19'));var _0x114232=_0x2feff9['savename'];var _0x4dfaeb=util[_0x4ced('0xf')](_0x4ced('0x1a'),path['basename'](_0x2feff9[_0x4ced('0x1b')],path[_0x4ced('0x1c')](_0x2feff9[_0x4ced('0x1b')])),'zip');var _0x5ad360=path['join'](_0xb3782f,_0x114232);var _0x5f300d=path[_0x4ced('0x18')](_0xb3782f,_0x4dfaeb);if(fs[_0x4ced('0x1d')](_0x5ad360)){_0x2feff9[_0x4ced('0x1e')]=_0x4ced('0x1f');_0x34a820[_0x4ced('0x20')][_0x4ced('0x21')]=[{'filename':_0x114232,'path':_0x5ad360}];_0x34a820['message'][_0x4ced('0x22')]=util[_0x4ced('0xf')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x2feff9,null,0x2));}else if(fs[_0x4ced('0x1d')](_0x5f300d)){_0x2feff9[_0x4ced('0x1e')]='Sent';_0x34a820['message'][_0x4ced('0x21')]=[{'filename':_0x4dfaeb,'path':_0x5f300d}];}else{_0x34a820[_0x4ced('0x20')][_0x4ced('0x22')]=_0x4ced('0x23');if(!_0xc8d0cc['sendIfEmpty']){_0x57ad29=![];logger[_0x4ced('0xc')](_0x4ced('0x24'));}}if(_0x57ad29){return client['request'](_0x4ced('0x25'),_0x34a820)[_0x4ced('0x26')](function(_0x42dd11){if(_0x42dd11[_0x4ced('0x27')]){return logger[_0x4ced('0x27')]('error\x20mail',JSON[_0x4ced('0x28')](_0x42dd11));}return logger[_0x4ced('0xc')](_0x4ced('0x29'));})[_0x4ced('0x2a')](function(_0x1a0cb6){return logger[_0x4ced('0x27')](_0x4ced('0x2b'),JSON['stringify'](_0x1a0cb6));});}};}function handleError(){return function(_0x54758c){return logger[_0x4ced('0x27')](JSON[_0x4ced('0x28')](_0x54758c));};}function handleResult(_0x655611){return function(_0x238415){logger[_0x4ced('0xc')](_0x4ced('0x2c'),JSON[_0x4ced('0x28')](_0x238415));if(_0x655611['MailAccount']&&_0x655611[_0x4ced('0xd')][_0x4ced('0x13')]&&!_['isNil'](_0x655611[_0x4ced('0x12')])){setTimeout(handleSendEmail(_0x655611,_0x238415),0x3c*0x3e8);}};}function handleJob(_0x328e61){return function(){try{if(_[_0x4ced('0x2d')](_0x328e61[_0x4ced('0x16')])){return logger[_0x4ced('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x4ced('0x2d')](_0x328e61['subtractUnit'])){return logger[_0x4ced('0xc')](_0x4ced('0x2e'));}var _0x2465df={'startDate':moment()[_0x4ced('0x2f')](_0x328e61[_0x4ced('0x16')],_0x328e61[_0x4ced('0x17')])[_0x4ced('0xf')](_0x4ced('0x30')),'endDate':moment()[_0x4ced('0xf')](_0x4ced('0x30')),'type':_0x4ced('0x31'),'output':_0x328e61[_0x4ced('0x32')],'name':_0x328e61[_0x4ced('0x11')]};if(!_[_0x4ced('0x2d')](_0x328e61[_0x4ced('0x33')])){logger['info'](_0x4ced('0x34'),_0x328e61[_0x4ced('0x33')]);return analyticDefaultReportController[_0x4ced('0x35')]({'id':_0x328e61[_0x4ced('0x33')]},_0x2465df)[_0x4ced('0x26')](handleResult(_0x328e61))[_0x4ced('0x2a')](handleError());}if(!_[_0x4ced('0x2d')](_0x328e61['CustomReportId'])){logger[_0x4ced('0xc')]('exec\x20custom\x20report\x20id:%s',_0x328e61[_0x4ced('0x36')]);return analyticCustomReportController['runReport']({'id':_0x328e61['CustomReportId']},_0x2465df)['then'](handleResult(_0x328e61))[_0x4ced('0x2a')](handleError());}}catch(_0x7d33c3){logger[_0x4ced('0x27')](JSON[_0x4ced('0x28')](_0x7d33c3));}return logger[_0x4ced('0xc')](_0x4ced('0x37'));};}function getJobs(_0x506144){var _0x2b5b9c={};if(_0x506144){_0x2b5b9c['id']=_0x506144;}return db[_0x4ced('0x38')][_0x4ced('0x39')]({'where':_0x2b5b9c,'include':[{'model':db[_0x4ced('0xd')],'attributes':['id',_0x4ced('0x11'),_0x4ced('0x12')],'include':[{'model':db[_0x4ced('0x3a')],'as':'Smtp','include':[{'model':db[_0x4ced('0x3b')],'as':_0x4ced('0x3b')}]}]}]})[_0x4ced('0x26')](function(_0x2524eb){var _0x3a5a81=_[_0x4ced('0x3c')](manager['jobs']);var _0x5b0aae=_[_0x4ced('0x3d')](_0x2524eb,function(_0x3534c8){return _0x3534c8['id'][_0x4ced('0x3e')]();});var _0x4804e4=_[_0x4ced('0x3f')](_0x2524eb,function(_0x5e4579){return _0x5e4579['id'][_0x4ced('0x3e')]();});var _0x43c88d=_0x506144?_0x5b0aae:_[_0x4ced('0x40')](_0x5b0aae,_0x3a5a81);var _0x27d016=_[_0x4ced('0x41')](_0x5b0aae,_0x3a5a81);var _0x579296=_['difference'](_0x3a5a81,_0x5b0aae);var _0x252bec;var _0x44c5d7;for(_0x252bec=0x0;_0x252bec<_0x579296[_0x4ced('0x42')]&&!_0x506144;_0x252bec+=0x1){_0x44c5d7=_0x579296[_0x252bec]['toString']();if(manager[_0x4ced('0x43')](_0x44c5d7)){manager['stop'](_0x44c5d7);manager[_0x4ced('0x44')](_0x44c5d7);logger[_0x4ced('0xc')]('delete\x20cron',_0x44c5d7);}}logger[_0x4ced('0xc')](_0x4ced('0x45'),JSON[_0x4ced('0x28')](_0x43c88d));for(_0x252bec=0x0;_0x252bec<_0x43c88d[_0x4ced('0x42')];_0x252bec+=0x1){_0x44c5d7=_0x43c88d[_0x252bec]['toString']();logger[_0x4ced('0xc')](_0x4ced('0x46'),_0x44c5d7);if(_0x506144){logger[_0x4ced('0xc')](_0x4ced('0x47'),_0x506144);logger[_0x4ced('0xc')](JSON[_0x4ced('0x28')](_0x4804e4[_0x44c5d7]));BPromise[_0x4ced('0x48')]()[_0x4ced('0x26')](handleJob(_0x4804e4[_0x44c5d7]));logger[_0x4ced('0xc')](_0x4ced('0x49'),_0x4804e4[_0x44c5d7][_0x4ced('0x11')],_0x4804e4[_0x44c5d7][_0x4ced('0x4a')]);}else if(_0x4804e4[_0x44c5d7][_0x4ced('0x4a')]&&_0x4804e4[_0x44c5d7][_0x4ced('0x4b')]&&moment()[_0x4ced('0x4c')](_0x4804e4[_0x44c5d7][_0x4ced('0x4d')],_0x4804e4[_0x44c5d7]['endAt'])){manager['add'](_0x44c5d7,_0x4804e4[_0x44c5d7]['cron'],handleJob(_0x4804e4[_0x44c5d7]));manager[_0x4ced('0x4e')](_0x44c5d7);logger[_0x4ced('0xc')](_0x4ced('0x4f'),_0x4804e4[_0x44c5d7][_0x4ced('0x11')],_0x4804e4[_0x44c5d7]['cron']);}else if(manager[_0x4ced('0x43')](_0x44c5d7)){manager['stop'](_0x44c5d7);manager[_0x4ced('0x44')](_0x44c5d7);logger[_0x4ced('0xc')](_0x4ced('0x50'),_0x4804e4[_0x44c5d7][_0x4ced('0x11')],_0x4804e4[_0x44c5d7][_0x4ced('0x4a')]);}}for(_0x252bec=0x0,_0x44c5d7;_0x252bec<_0x27d016['length']&&!_0x506144;_0x252bec+=0x1){_0x44c5d7=_0x27d016[_0x252bec][_0x4ced('0x3e')]();if(manager[_0x4ced('0x43')](_0x44c5d7)){if(_0x4804e4[_0x44c5d7][_0x4ced('0x4a')]&&_0x4804e4[_0x44c5d7]['active']&&moment()[_0x4ced('0x4c')](_0x4804e4[_0x44c5d7]['startAt'],_0x4804e4[_0x44c5d7][_0x4ced('0x51')])){manager['update'](_0x44c5d7,_0x4804e4[_0x44c5d7]['cron'],handleJob(_0x4804e4[_0x44c5d7]));logger[_0x4ced('0xc')]('update\x20cron',_0x4804e4[_0x44c5d7][_0x4ced('0x11')],_0x4804e4[_0x44c5d7][_0x4ced('0x4a')]);}else{manager[_0x4ced('0x52')](_0x44c5d7);manager[_0x4ced('0x44')](_0x44c5d7);logger[_0x4ced('0xc')](_0x4ced('0x50'),_0x4804e4[_0x44c5d7][_0x4ced('0x11')],_0x4804e4[_0x44c5d7][_0x4ced('0x4a')]);}}}})[_0x4ced('0x2a')](function(_0x5634b2){logger[_0x4ced('0x27')](JSON[_0x4ced('0x28')](_0x5634b2));});}exports[_0x4ced('0x53')]=function(_0x30150d){return getJobs(_0x30150d);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 966d6da..f5b9190 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 _0x30fc=['Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Sentiment','Neutral','COMPLETED','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','transcribe','forEach','push','all','error','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive'];(function(_0x45f6e2,_0xe72d77){var _0x573b09=function(_0x3aa398){while(--_0x3aa398){_0x45f6e2['push'](_0x45f6e2['shift']());}};_0x573b09(++_0xe72d77);}(_0x30fc,0x64));var _0xc30f=function(_0x44b694,_0x195b96){_0x44b694=_0x44b694-0x0;var _0x3fd117=_0x30fc[_0x44b694];return _0x3fd117;};var _=require(_0xc30f('0x0'));var AWS=require(_0xc30f('0x1'));var rp=require('request-promise');var util=require(_0xc30f('0x2'));var BPromise=require(_0xc30f('0x3'));var db=require(_0xc30f('0x4'))['db'];var logger=require(_0xc30f('0x5'))('transcribe');function getTranscriptionJob(_0xa8299e,_0x16c57d,_0x342b94,_0x22a3a7){return new Promise(function(_0x2948cb,_0x293391){var _0x54c174=new AWS[(_0xc30f('0x6'))]({'accessKeyId':_0x16c57d,'secretAccessKey':_0xa8299e,'region':_0x342b94});_0x54c174[_0xc30f('0x7')]({'TranscriptionJobName':_0x22a3a7},function(_0x33a769,_0x3d2167){if(_0x33a769){return _0x293391(_0x33a769);}else{return _0x2948cb(_0x3d2167);}});});}function sentiment(_0x2e328e,_0x25a9f1,_0x436059,_0x29a9df,_0x25f066){return new Promise(function(_0x597d99,_0x1c3a1b){var _0x5e1429=new AWS[(_0xc30f('0x8'))]({'accessKeyId':_0x25a9f1,'secretAccessKey':_0x2e328e,'region':_0x436059});_0x5e1429[_0xc30f('0x9')]({'Text':_0x29a9df,'LanguageCode':_0x25f066[_0xc30f('0xa')](0x0,0x2)},function(_0x1ccb60,_0x1bf15a){if(_0x1ccb60){return _0x1c3a1b(_0x1ccb60);}else{return _0x597d99(_0x1bf15a);}});});}function checkTranscribeJob(_0x3cd910,_0x4f6d18,_0x524998){var _0x3bc956;return new BPromise(function(_0x101bc4,_0x38fbc4){logger[_0xc30f('0xb')](util['format'](_0xc30f('0xc'),_0x3cd910['id'],_0x3cd910[_0xc30f('0xd')]));return getTranscriptionJob(_0x524998[_0xc30f('0xe')],_0x524998[_0xc30f('0xf')],_0x4f6d18[_0xc30f('0x10')],_0x3cd910[_0xc30f('0xd')])[_0xc30f('0x11')](function(_0x4fbdcd){logger['info'](util[_0xc30f('0x12')](_0xc30f('0x13'),_0x3cd910['id'],_0x3cd910[_0xc30f('0xd')],_0x4fbdcd[_0xc30f('0x14')][_0xc30f('0x15')]));if(!_0x3cd910[_0xc30f('0x16')]){switch(_0x4fbdcd['TranscriptionJob'][_0xc30f('0x15')]){case'COMPLETED':var _0xce9c9={'transcribeStatus':_0x4fbdcd[_0xc30f('0x14')][_0xc30f('0x15')],'fileUri':_0x4fbdcd[_0xc30f('0x14')][_0xc30f('0x17')][_0xc30f('0x18')]};logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x19'),_0x3cd910['id']));return rp({'uri':_0x4fbdcd['TranscriptionJob'][_0xc30f('0x17')][_0xc30f('0x18')],'json':!![]})['then'](function(_0x218e5b){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x1a'),_0x3cd910['id']));if(_0x218e5b&&_0x218e5b[_0xc30f('0x1b')]&&_0x218e5b[_0xc30f('0x1b')][_0xc30f('0x1c')]&&_0x218e5b[_0xc30f('0x1b')][_0xc30f('0x1c')]['length']){_0xce9c9[_0xc30f('0x16')]='';for(var _0x50122e=0x0;_0x50122e<_0x218e5b[_0xc30f('0x1b')][_0xc30f('0x1c')][_0xc30f('0x1d')];_0x50122e++){_0xce9c9[_0xc30f('0x16')]+=_0x218e5b[_0xc30f('0x1b')][_0xc30f('0x1c')][_0x50122e][_0xc30f('0x1e')]+'';}}return _0x3cd910[_0xc30f('0x1f')](_0xce9c9);})[_0xc30f('0x11')](function(){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x20'),_0x3cd910['id']));if(!_0x3cd910[_0xc30f('0x21')]){throw new db['Sequelize']['ValidationError'](_0xc30f('0x22'));}if(!_0x4f6d18[_0xc30f('0x23')]||!_0x4f6d18[_0xc30f('0x24')]||!_0x4f6d18[_0xc30f('0x25')]||!_0x4f6d18['language']||!_0x4f6d18[_0xc30f('0x26')]){throw new db[(_0xc30f('0x27'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xce9c9[_0xc30f('0x16')]){throw new Error(_0xc30f('0x28'));}if(_0x4f6d18[_0xc30f('0x24')]===_0x524998['id']){return _0x524998;}else{return db[_0xc30f('0x29')][_0xc30f('0x2a')]({'where':{'id':_settings[_0xc30f('0x24')]}});}})['then'](function(_0x2cf0b2){if(!_0x2cf0b2){throw new db[(_0xc30f('0x27'))][(_0xc30f('0x2b'))](_0xc30f('0x2c'));}if(!_0x2cf0b2[_0xc30f('0xe')]||!_0x2cf0b2[_0xc30f('0xf')]){throw new db[(_0xc30f('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x3bc956=_0x2cf0b2;logger[_0xc30f('0xb')](util[_0xc30f('0x12')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3cd910['id']));return sentiment(_0x3bc956[_0xc30f('0xe')],_0x3bc956['data2'],_0x4f6d18['sentimentRegion'],_0xce9c9[_0xc30f('0x16')],_0x4f6d18['language']);})['then'](function(_0x432b18){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x2d'),_0x3cd910['id']));return _0x3cd910['update']({'sentiment':_0x432b18['Sentiment'],'sPositive':_0x432b18[_0xc30f('0x2e')][_0xc30f('0x2f')],'sNegative':_0x432b18['SentimentScore'][_0xc30f('0x30')],'sMixed':_0x432b18[_0xc30f('0x2e')][_0xc30f('0x31')],'sNeutral':_0x432b18['SentimentScore']['Neutral']});})['then'](function(){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x20'),_0x3cd910['id']));_0x101bc4();});case _0xc30f('0x32'):return _0x3cd910[_0xc30f('0x1f')]({'transcribeStatus':_0xc30f('0x32'),'failureReason':_0x4fbdcd[_0xc30f('0x14')][_0xc30f('0x33')]})[_0xc30f('0x11')](function(){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x20'),_0x3cd910['id']));_0x101bc4();});default:logger['info'](util[_0xc30f('0x12')](_0xc30f('0x34'),_0x3cd910['id']));break;}}else{return BPromise[_0xc30f('0x35')]()[_0xc30f('0x11')](function(){if(!_0x3cd910[_0xc30f('0x21')]){throw new db['Sequelize'][(_0xc30f('0x2b'))](_0xc30f('0x22'));}if(!_0x4f6d18['sentiment']||!_0x4f6d18[_0xc30f('0x24')]||!_0x4f6d18[_0xc30f('0x25')]||!_0x4f6d18[_0xc30f('0x36')]||!_0x4f6d18[_0xc30f('0x26')]){throw new db[(_0xc30f('0x27'))][(_0xc30f('0x2b'))](_0xc30f('0x37'));}if(!_0x3cd910[_0xc30f('0x16')]){throw new Error(_0xc30f('0x28'));}if(_0x4f6d18[_0xc30f('0x24')]===_0x524998['id']){return _0x524998;}else{return db[_0xc30f('0x29')][_0xc30f('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xc30f('0x11')](function(_0x20d0dd){if(!_0x20d0dd){throw new db['Sequelize'][(_0xc30f('0x2b'))](_0xc30f('0x2c'));}if(!_0x20d0dd[_0xc30f('0xe')]||!_0x20d0dd[_0xc30f('0xf')]){throw new db[(_0xc30f('0x27'))]['ValidationError'](_0xc30f('0x38'));}_0x3bc956=_0x20d0dd;logger[_0xc30f('0xb')](util[_0xc30f('0x12')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3cd910['id']));return sentiment(_0x3bc956[_0xc30f('0xe')],_0x3bc956[_0xc30f('0xf')],_0x4f6d18[_0xc30f('0x25')],_0x3cd910['fileText'],_0x4f6d18[_0xc30f('0x36')]);})[_0xc30f('0x11')](function(_0x35acc3){logger[_0xc30f('0xb')](util[_0xc30f('0x12')](_0xc30f('0x2d'),_0x3cd910['id']));return _0x3cd910['update']({'sentiment':_0x35acc3[_0xc30f('0x39')],'sPositive':_0x35acc3['SentimentScore'][_0xc30f('0x2f')],'sNegative':_0x35acc3[_0xc30f('0x2e')][_0xc30f('0x30')],'sMixed':_0x35acc3[_0xc30f('0x2e')]['Mixed'],'sNeutral':_0x35acc3['SentimentScore'][_0xc30f('0x3a')],'transcribeStatus':_0xc30f('0x3b')});})[_0xc30f('0x11')](function(){logger[_0xc30f('0xb')](util['format'](_0xc30f('0x20'),_0x3cd910['id']));_0x101bc4();});}})[_0xc30f('0x3c')](function(_0x2da350){if(_0x2da350){if(!_0x2da350[_0xc30f('0x3d')]||_0x2da350[_0xc30f('0x3d')]!==_0xc30f('0x3e')){logger['error'](util[_0xc30f('0x12')](_0xc30f('0x3f'),_0x3cd910['id']),util[_0xc30f('0x40')](_0x2da350,{'showHidden':![],'depth':null}));}}_0x101bc4();});});}function checkTranscribe(){var _0x5dc074;var _0x507316;var _0x23d9dc;return db[_0xc30f('0x41')][_0xc30f('0x42')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xc30f('0x11')](function(_0x24b3de){if(!_0x24b3de||!_0x24b3de[_0xc30f('0x1d')]){throw new db[(_0xc30f('0x27'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x5dc074=_0x24b3de;return db['Setting'][_0xc30f('0x2a')]({'where':{'id':0x1}});})[_0xc30f('0x11')](function(_0x3ddda2){if(!_0x3ddda2){throw new db[(_0xc30f('0x27'))]['ValidationError'](_0xc30f('0x43'));}_0x507316=_0x3ddda2;if(!_0x507316[_0xc30f('0x44')]||!_0x507316['transcribeAccountId']||!_0x507316[_0xc30f('0x10')]||!_0x507316[_0xc30f('0x36')]||!_0x507316[_0xc30f('0x26')]){throw new db[(_0xc30f('0x27'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0xc30f('0x29')]['findOne']({'where':{'id':_0x507316['transcribeAccountId']}});})[_0xc30f('0x11')](function(_0x20bc25){if(!_0x20bc25){throw new db[(_0xc30f('0x27'))][(_0xc30f('0x2b'))](_0xc30f('0x2c'));}if(!_0x20bc25['data1']||!_0x20bc25[_0xc30f('0xf')]){throw new db[(_0xc30f('0x27'))][(_0xc30f('0x2b'))]('Cloud\x20Provider\x20not\x20configured');}_0x23d9dc=_0x20bc25;var _0x3593a6=[];_0x5dc074[_0xc30f('0x45')](function(_0x4166bf){_0x3593a6[_0xc30f('0x46')](checkTranscribeJob(_0x4166bf,_0x507316,_0x23d9dc));});return BPromise[_0xc30f('0x47')](_0x3593a6);})['catch'](function(_0x2e692e){if(_0x2e692e){if(!_0x2e692e['name']||_0x2e692e[_0xc30f('0x3d')]!==_0xc30f('0x3e')){logger[_0xc30f('0x48')](util[_0xc30f('0x40')](_0x2e692e,{'showHidden':![],'depth':null}));}}});}exports[_0xc30f('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x5f6a=['detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','results','length','fileText','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Transcript\x20not\x20available','Negative','Mixed','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','lodash','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend'];(function(_0x1f2858,_0x5f4ddc){var _0xcf648e=function(_0x365e2c){while(--_0x365e2c){_0x1f2858['push'](_0x1f2858['shift']());}};_0xcf648e(++_0x5f4ddc);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x2df5df,_0x3b2392){_0x2df5df=_0x2df5df-0x0;var _0x561f8d=_0x5f6a[_0x2df5df];return _0x561f8d;};var _=require(_0xa5f6('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xa5f6('0x1'));var BPromise=require(_0xa5f6('0x2'));var db=require(_0xa5f6('0x3'))['db'];var logger=require(_0xa5f6('0x4'))('transcribe');function getTranscriptionJob(_0x2e8b33,_0x8e175a,_0x199819,_0xde771e){return new Promise(function(_0xb6a42e,_0x9c569c){var _0x19ac7d=new AWS[(_0xa5f6('0x5'))]({'accessKeyId':_0x8e175a,'secretAccessKey':_0x2e8b33,'region':_0x199819});_0x19ac7d[_0xa5f6('0x6')]({'TranscriptionJobName':_0xde771e},function(_0x135782,_0x5cfc62){if(_0x135782){return _0x9c569c(_0x135782);}else{return _0xb6a42e(_0x5cfc62);}});});}function sentiment(_0x55b0d0,_0x543e48,_0x832065,_0x133fff,_0x4386f6){return new Promise(function(_0xe6dc69,_0x475336){var _0x4885e4=new AWS[(_0xa5f6('0x7'))]({'accessKeyId':_0x543e48,'secretAccessKey':_0x55b0d0,'region':_0x832065});_0x4885e4[_0xa5f6('0x8')]({'Text':_0x133fff,'LanguageCode':_0x4386f6['substring'](0x0,0x2)},function(_0x9c44d5,_0x546e46){if(_0x9c44d5){return _0x475336(_0x9c44d5);}else{return _0xe6dc69(_0x546e46);}});});}function checkTranscribeJob(_0x28c394,_0x483f66,_0x13c988){var _0xc8eb34;return new BPromise(function(_0x5286b7,_0x42480a){logger[_0xa5f6('0x9')](util[_0xa5f6('0xa')](_0xa5f6('0xb'),_0x28c394['id'],_0x28c394['transcribeName']));return getTranscriptionJob(_0x13c988[_0xa5f6('0xc')],_0x13c988[_0xa5f6('0xd')],_0x483f66[_0xa5f6('0xe')],_0x28c394['transcribeName'])[_0xa5f6('0xf')](function(_0x3b2b23){logger[_0xa5f6('0x9')](util[_0xa5f6('0xa')](_0xa5f6('0x10'),_0x28c394['id'],_0x28c394['transcribeName'],_0x3b2b23[_0xa5f6('0x11')][_0xa5f6('0x12')]));if(!_0x28c394['fileText']){switch(_0x3b2b23[_0xa5f6('0x11')][_0xa5f6('0x12')]){case _0xa5f6('0x13'):var _0x4b1744={'transcribeStatus':_0x3b2b23['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x3b2b23[_0xa5f6('0x11')]['Transcript'][_0xa5f6('0x14')]};logger[_0xa5f6('0x9')](util[_0xa5f6('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x28c394['id']));return rp({'uri':_0x3b2b23[_0xa5f6('0x11')]['Transcript'][_0xa5f6('0x14')],'json':!![]})[_0xa5f6('0xf')](function(_0x30caba){logger[_0xa5f6('0x9')](util[_0xa5f6('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x28c394['id']));if(_0x30caba&&_0x30caba['results']&&_0x30caba[_0xa5f6('0x15')]['transcripts']&&_0x30caba[_0xa5f6('0x15')]['transcripts'][_0xa5f6('0x16')]){_0x4b1744[_0xa5f6('0x17')]='';for(var _0x4330c4=0x0;_0x4330c4<_0x30caba[_0xa5f6('0x15')][_0xa5f6('0x18')][_0xa5f6('0x16')];_0x4330c4++){_0x4b1744[_0xa5f6('0x17')]+=_0x30caba[_0xa5f6('0x15')][_0xa5f6('0x18')][_0x4330c4][_0xa5f6('0x19')]+'';}}return _0x28c394[_0xa5f6('0x1a')](_0x4b1744);})['then'](function(){logger['info'](util[_0xa5f6('0xa')](_0xa5f6('0x1b'),_0x28c394['id']));if(!_0x28c394[_0xa5f6('0x1c')]){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x1f'));}if(!_0x483f66['sentiment']||!_0x483f66[_0xa5f6('0x20')]||!_0x483f66[_0xa5f6('0x21')]||!_0x483f66[_0xa5f6('0x22')]||!_0x483f66[_0xa5f6('0x23')]){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x24'));}if(!_0x4b1744[_0xa5f6('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x483f66[_0xa5f6('0x20')]===_0x13c988['id']){return _0x13c988;}else{return db[_0xa5f6('0x25')][_0xa5f6('0x26')]({'where':{'id':_settings[_0xa5f6('0x20')]}});}})[_0xa5f6('0xf')](function(_0x4bc914){if(!_0x4bc914){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x27'));}if(!_0x4bc914['data1']||!_0x4bc914[_0xa5f6('0xd')]){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x28'));}_0xc8eb34=_0x4bc914;logger[_0xa5f6('0x9')](util['format'](_0xa5f6('0x29'),_0x28c394['id']));return sentiment(_0xc8eb34[_0xa5f6('0xc')],_0xc8eb34[_0xa5f6('0xd')],_0x483f66[_0xa5f6('0x21')],_0x4b1744['fileText'],_0x483f66[_0xa5f6('0x22')]);})[_0xa5f6('0xf')](function(_0x16d38d){logger[_0xa5f6('0x9')](util['format'](_0xa5f6('0x2a'),_0x28c394['id']));return _0x28c394[_0xa5f6('0x1a')]({'sentiment':_0x16d38d[_0xa5f6('0x2b')],'sPositive':_0x16d38d[_0xa5f6('0x2c')][_0xa5f6('0x2d')],'sNegative':_0x16d38d[_0xa5f6('0x2c')]['Negative'],'sMixed':_0x16d38d[_0xa5f6('0x2c')]['Mixed'],'sNeutral':_0x16d38d[_0xa5f6('0x2c')]['Neutral']});})['then'](function(){logger[_0xa5f6('0x9')](util['format'](_0xa5f6('0x1b'),_0x28c394['id']));_0x5286b7();});case _0xa5f6('0x2e'):return _0x28c394['update']({'transcribeStatus':_0xa5f6('0x2e'),'failureReason':_0x3b2b23['TranscriptionJob']['FailureReason']})['then'](function(){logger[_0xa5f6('0x9')](util[_0xa5f6('0xa')](_0xa5f6('0x1b'),_0x28c394['id']));_0x5286b7();});default:logger[_0xa5f6('0x9')](util[_0xa5f6('0xa')](_0xa5f6('0x2f'),_0x28c394['id']));break;}}else{return BPromise[_0xa5f6('0x30')]()[_0xa5f6('0xf')](function(){if(!_0x28c394[_0xa5f6('0x1c')]){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x1f'));}if(!_0x483f66[_0xa5f6('0x31')]||!_0x483f66[_0xa5f6('0x20')]||!_0x483f66['sentimentRegion']||!_0x483f66[_0xa5f6('0x22')]||!_0x483f66[_0xa5f6('0x23')]){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x24'));}if(!_0x28c394[_0xa5f6('0x17')]){throw new Error(_0xa5f6('0x32'));}if(_0x483f66[_0xa5f6('0x20')]===_0x13c988['id']){return _0x13c988;}else{return db[_0xa5f6('0x25')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2a8b11){if(!_0x2a8b11){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x27'));}if(!_0x2a8b11[_0xa5f6('0xc')]||!_0x2a8b11[_0xa5f6('0xd')]){throw new db['Sequelize'][(_0xa5f6('0x1e'))](_0xa5f6('0x28'));}_0xc8eb34=_0x2a8b11;logger['info'](util[_0xa5f6('0xa')](_0xa5f6('0x29'),_0x28c394['id']));return sentiment(_0xc8eb34[_0xa5f6('0xc')],_0xc8eb34[_0xa5f6('0xd')],_0x483f66[_0xa5f6('0x21')],_0x28c394[_0xa5f6('0x17')],_0x483f66[_0xa5f6('0x22')]);})[_0xa5f6('0xf')](function(_0x2f8a2d){logger[_0xa5f6('0x9')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x28c394['id']));return _0x28c394[_0xa5f6('0x1a')]({'sentiment':_0x2f8a2d[_0xa5f6('0x2b')],'sPositive':_0x2f8a2d[_0xa5f6('0x2c')]['Positive'],'sNegative':_0x2f8a2d[_0xa5f6('0x2c')][_0xa5f6('0x33')],'sMixed':_0x2f8a2d[_0xa5f6('0x2c')][_0xa5f6('0x34')],'sNeutral':_0x2f8a2d['SentimentScore'][_0xa5f6('0x35')],'transcribeStatus':_0xa5f6('0x13')});})[_0xa5f6('0xf')](function(){logger[_0xa5f6('0x9')](util[_0xa5f6('0xa')](_0xa5f6('0x1b'),_0x28c394['id']));_0x5286b7();});}})[_0xa5f6('0x36')](function(_0x6af7d4){if(_0x6af7d4){if(!_0x6af7d4[_0xa5f6('0x37')]||_0x6af7d4[_0xa5f6('0x37')]!==_0xa5f6('0x38')){logger[_0xa5f6('0x39')](util['format'](_0xa5f6('0x3a'),_0x28c394['id']),util[_0xa5f6('0x3b')](_0x6af7d4,{'showHidden':![],'depth':null}));}}_0x5286b7();});});}function checkTranscribe(){var _0x419306;var _0x3476dc;var _0x586893;return db[_0xa5f6('0x3c')][_0xa5f6('0x3d')]({'where':{'transcribeStatus':_0xa5f6('0x3e')}})[_0xa5f6('0xf')](function(_0x9be1f4){if(!_0x9be1f4||!_0x9be1f4[_0xa5f6('0x16')]){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x3f'));}_0x419306=_0x9be1f4;return db['Setting'][_0xa5f6('0x26')]({'where':{'id':0x1}});})[_0xa5f6('0xf')](function(_0x158604){if(!_0x158604){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x40'));}_0x3476dc=_0x158604;if(!_0x3476dc[_0xa5f6('0x41')]||!_0x3476dc['transcribeAccountId']||!_0x3476dc[_0xa5f6('0xe')]||!_0x3476dc[_0xa5f6('0x22')]||!_0x3476dc['bucket']){throw new db[(_0xa5f6('0x1d'))][(_0xa5f6('0x1e'))](_0xa5f6('0x42'));}return db['CloudProvider'][_0xa5f6('0x26')]({'where':{'id':_0x3476dc[_0xa5f6('0x43')]}});})[_0xa5f6('0xf')](function(_0x50669e){if(!_0x50669e){throw new db[(_0xa5f6('0x1d'))]['ValidationError'](_0xa5f6('0x27'));}if(!_0x50669e[_0xa5f6('0xc')]||!_0x50669e['data2']){throw new db['Sequelize'][(_0xa5f6('0x1e'))](_0xa5f6('0x28'));}_0x586893=_0x50669e;var _0x162939=[];_0x419306['forEach'](function(_0x42f254){_0x162939['push'](checkTranscribeJob(_0x42f254,_0x3476dc,_0x586893));});return BPromise['all'](_0x162939);})[_0xa5f6('0x36')](function(_0x1d292c){if(_0x1d292c){if(!_0x1d292c[_0xa5f6('0x37')]||_0x1d292c[_0xa5f6('0x37')]!==_0xa5f6('0x38')){logger['error'](util[_0xa5f6('0x3b')](_0x1d292c,{'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 803d2b4..3680311 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 _0x2046=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','join','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update'];(function(_0x26eaf8,_0x3ae08c){var _0x5a08bc=function(_0x41f2f0){while(--_0x41f2f0){_0x26eaf8['push'](_0x26eaf8['shift']());}};_0x5a08bc(++_0x3ae08c);}(_0x2046,0x147));var _0x6204=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2046[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6204('0x0'));var moment=require(_0x6204('0x1'));var Redis=require('ioredis');var util=require(_0x6204('0x2'));var config=require(_0x6204('0x3'));var db=require(_0x6204('0x4'))['db'];var logger=require(_0x6204('0x5'))(_0x6204('0x6'));config['redis']=_['defaults'](config[_0x6204('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6204('0x7')]));function closeInteractions(){var _0x5f003e=[];return db[_0x6204('0x8')][_0x6204('0x9')]({'raw':!![],'attributes':['id',_0x6204('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6204('0xb')](0x18,_0x6204('0xc'))}}})[_0x6204('0xd')](function(_0x350ffc){if(_0x350ffc&&_0x350ffc[_0x6204('0xe')]){_0x5f003e=_[_0x6204('0xf')](_0x350ffc||[],'id');logger[_0x6204('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x5f003e[_0x6204('0x11')]());return db['WhatsappInteraction'][_0x6204('0x12')]({'closeReason':_0x6204('0x13'),'disposition':_0x6204('0x14'),'closed':!![],'closedAt':moment()[_0x6204('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x5f003e}});}})[_0x6204('0xd')](function(){if(_0x5f003e&&_0x5f003e['length']){logger[_0x6204('0x10')](_0x6204('0x16'),_0x5f003e[_0x6204('0x11')]());for(var _0x594013=0x0;_0x594013<_0x5f003e[_0x6204('0xe')];_0x594013++){io['emit'](_0x6204('0x17'),{'id':_0x5f003e[_0x594013],'closed':!![]});}}})['catch'](function(_0x15aeaa){logger['error'](_0x6204('0x18'),_0x15aeaa?util[_0x6204('0x19')](_0x15aeaa,{'showHidden':![],'depth':null}):'');});}exports[_0x6204('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x61ef=['WhatsappInteraction','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','lastMsgAt','subtract','hours','then','length','map','info','join'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x61ef,0x1ce));var _0xf61e=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x61ef[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xf61e('0x0'));var moment=require(_0xf61e('0x1'));var Redis=require(_0xf61e('0x2'));var util=require(_0xf61e('0x3'));var config=require(_0xf61e('0x4'));var db=require(_0xf61e('0x5'))['db'];var logger=require('../logger')('schedule');config[_0xf61e('0x6')]=_[_0xf61e('0x7')](config['redis'],{'host':_0xf61e('0x8'),'port':0x18eb});var io=require(_0xf61e('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x4f247c=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xf61e('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf61e('0xb')](0x18,_0xf61e('0xc'))}}})[_0xf61e('0xd')](function(_0xae44fe){if(_0xae44fe&&_0xae44fe[_0xf61e('0xe')]){_0x4f247c=_[_0xf61e('0xf')](_0xae44fe||[],'id');logger[_0xf61e('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4f247c[_0xf61e('0x11')]());return db[_0xf61e('0x12')][_0xf61e('0x13')]({'closeReason':'system','disposition':_0xf61e('0x14'),'closed':!![],'closedAt':moment()[_0xf61e('0x15')](_0xf61e('0x16'))},{'where':{'id':_0x4f247c}});}})[_0xf61e('0xd')](function(){if(_0x4f247c&&_0x4f247c[_0xf61e('0xe')]){logger[_0xf61e('0x10')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4f247c['join']());for(var _0x560f7b=0x0;_0x560f7b<_0x4f247c[_0xf61e('0xe')];_0x560f7b++){io[_0xf61e('0x17')](_0xf61e('0x18'),{'id':_0x4f247c[_0x560f7b],'closed':!![]});}}})[_0xf61e('0x19')](function(_0x527ce0){logger[_0xf61e('0x1a')](_0xf61e('0x1b'),_0x527ce0?util[_0xf61e('0x1c')](_0x527ce0,{'showHidden':![],'depth':null}):'');});}exports[_0xf61e('0x1d')]=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 54f998a..fef7388 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf48=['contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','push','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xdf48,0xa3));var _0x8df4=function(_0x15fa4c,_0x4da348){_0x15fa4c=_0x15fa4c-0x0;var _0x372fbe=_0xdf48[_0x15fa4c];return _0x372fbe;};'use strict';var util=require(_0x8df4('0x0'));var db=require(_0x8df4('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x8df4('0x2')+i,'lastName':_0x8df4('0x3')+i,'phone':0xf879fb460+i,'email':_0x8df4('0x4')+i+_0x8df4('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8df4('0x6')](),'updatedAt':Date[_0x8df4('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8df4('0x7')]({'id':i,'firstName':_0x8df4('0x2')+i,'lastName':_0x8df4('0x3')+i,'phone':0xf879fb460+i,'email':_0x8df4('0x4')+i+_0x8df4('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8df4('0x7')]({'id':i,'active':![],'scheduledat':Date[_0x8df4('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8df4('0x6')](),'updatedAt':Date[_0x8df4('0x6')]()});}db[_0x8df4('0x8')][_0x8df4('0x9')]({'where':{}})[_0x8df4('0xa')](function(){return db[_0x8df4('0x8')][_0x8df4('0xb')](contacts);})[_0x8df4('0xa')](function(){console[_0x8df4('0xc')](_0x8df4('0xd'),_0x8df4('0xe'));return db[_0x8df4('0xf')][_0x8df4('0x9')]({'where':{}});})[_0x8df4('0xa')](function(){return db[_0x8df4('0xf')]['bulkCreate'](hopper);})[_0x8df4('0xa')](function(){console[_0x8df4('0xc')](_0x8df4('0xd'),_0x8df4('0x10'));return db[_0x8df4('0x8')]['bulkCreate'](contacts2);})[_0x8df4('0xa')](function(){console['log'](_0x8df4('0xd'),_0x8df4('0x11'));return db[_0x8df4('0xf')][_0x8df4('0xb')](hopper2);})[_0x8df4('0xa')](function(){console[_0x8df4('0xc')](_0x8df4('0xd'),_0x8df4('0x12'));})[_0x8df4('0x13')](function(_0x1b3869){console[_0x8df4('0xc')](_0x1b3869);}); \ No newline at end of file +var _0x82c5=['push','Innocenzo','Biondo','@xcally.com','now','destroy','then','CmContact','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','catch','util','../mysqldb'];(function(_0x49b267,_0x5e99b3){var _0x3f3d18=function(_0x590f02){while(--_0x590f02){_0x49b267['push'](_0x49b267['shift']());}};_0x3f3d18(++_0x5e99b3);}(_0x82c5,0xb2));var _0x582c=function(_0x244ecc,_0xec0ffa){_0x244ecc=_0x244ecc-0x0;var _0x31d80f=_0x82c5[_0x244ecc];return _0x31d80f;};'use strict';var util=require(_0x582c('0x0'));var db=require(_0x582c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x582c('0x2')]({'id':i,'firstName':_0x582c('0x3')+i,'lastName':_0x582c('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x582c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x582c('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x582c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x582c('0x6')](),'updatedAt':Date[_0x582c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x582c('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x582c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x582c('0x6')](),'updatedAt':Date[_0x582c('0x6')]()});}db['CmContact'][_0x582c('0x7')]({'where':{}})[_0x582c('0x8')](function(){return db[_0x582c('0x9')][_0x582c('0xa')](contacts);})[_0x582c('0x8')](function(){console['log'](_0x582c('0xb'),_0x582c('0xc'));return db['CmHopper'][_0x582c('0x7')]({'where':{}});})['then'](function(){return db[_0x582c('0xd')]['bulkCreate'](hopper);})[_0x582c('0x8')](function(){console[_0x582c('0xe')](_0x582c('0xb'),_0x582c('0xf'));return db[_0x582c('0x9')][_0x582c('0xa')](contacts2);})[_0x582c('0x8')](function(){console['log']('finished\x20populating',_0x582c('0x10'));return db['CmHopper'][_0x582c('0xa')](hopper2);})[_0x582c('0x8')](function(){console[_0x582c('0xe')](_0x582c('0xb'),'hopper2');})[_0x582c('0x11')](function(_0x3fa4e7){console[_0x582c('0xe')](_0x3fa4e7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 7def489..1792818 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9dd3=['log','add\x20user','catch','../mysqldb','format','%s%s','agent','friend','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then'];(function(_0x3f8e20,_0x1daf92){var _0x54b65e=function(_0x4cf6b8){while(--_0x4cf6b8){_0x3f8e20['push'](_0x3f8e20['shift']());}};_0x54b65e(++_0x1daf92);}(_0x9dd3,0xc9));var _0x39dd=function(_0xc8cbaa,_0x2bba3d){_0xc8cbaa=_0xc8cbaa-0x0;var _0xcd8180=_0x9dd3[_0xc8cbaa];return _0xcd8180;};'use strict';var util=require('util');var db=require(_0x39dd('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x39dd('0x1')](_0x39dd('0x2'),_0x39dd('0x3'),i),'fullname':util[_0x39dd('0x1')](_0x39dd('0x2'),_0x39dd('0x3'),i),'email':util[_0x39dd('0x1')]('%s%s@xcally.com',_0x39dd('0x3'),i),'role':_0x39dd('0x3'),'password':'password','internal':0xfa0+i,'type':_0x39dd('0x4'),'transport':[_0x39dd('0x5'),'ws','wss'],'disallow':[_0x39dd('0x6')],'allow':[_0x39dd('0x7')],'defaultuser':util[_0x39dd('0x1')](_0x39dd('0x2'),_0x39dd('0x3'),i),'encryption':_0x39dd('0x8'),'avpf':_0x39dd('0x8'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x39dd('0x8'),'dtlsverify':'no','dtlscertfile':_0x39dd('0x9'),'dtlsprivatekey':_0x39dd('0xa'),'dtlssetup':_0x39dd('0xb'),'callerid':util[_0x39dd('0x1')](_0x39dd('0xc'),util[_0x39dd('0x1')]('%s%s','agent',i),0xfa0+i)});}db['User'][_0x39dd('0xd')](users)[_0x39dd('0xe')](function(){console[_0x39dd('0xf')](_0x39dd('0x10'));})[_0x39dd('0x11')](function(_0x25c9be){console['log'](_0x25c9be);}); \ No newline at end of file +var _0x2a5b=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','add\x20user','catch','log','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','all','ulaw'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x2a5b,0xd2));var _0xb2a5=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0x2a5b[_0x52684f];return _0x4a55f0;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xb2a5('0x0'),_0xb2a5('0x1'),i),'fullname':util[_0xb2a5('0x2')]('%s%s','agent',i),'email':util[_0xb2a5('0x2')](_0xb2a5('0x3'),_0xb2a5('0x1'),i),'role':'agent','password':_0xb2a5('0x4'),'internal':0xfa0+i,'type':_0xb2a5('0x5'),'transport':[_0xb2a5('0x6'),'ws',_0xb2a5('0x7')],'disallow':[_0xb2a5('0x8')],'allow':[_0xb2a5('0x9')],'defaultuser':util[_0xb2a5('0x2')](_0xb2a5('0x0'),'agent',i),'encryption':_0xb2a5('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0xb2a5('0xa'),'dtlsenable':_0xb2a5('0xa'),'dtlsverify':'no','dtlscertfile':_0xb2a5('0xb'),'dtlsprivatekey':_0xb2a5('0xc'),'dtlssetup':_0xb2a5('0xd'),'callerid':util[_0xb2a5('0x2')](_0xb2a5('0xe'),util[_0xb2a5('0x2')]('%s%s',_0xb2a5('0x1'),i),0xfa0+i)});}db[_0xb2a5('0xf')]['bulkCreate'](users)[_0xb2a5('0x10')](function(){console['log'](_0xb2a5('0x11'));})[_0xb2a5('0x12')](function(_0xe37480){console[_0xb2a5('0x13')](_0xe37480);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 49b3ffe..3314f2c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x042a=['where','type','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:inbound','voice:outbound','VoiceQueue','FaxQueue','OpenchannelQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','chat','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','address','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','ivr','UserProfileSection','findOne','then','VoiceQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','Campaign'];(function(_0x377255,_0x4c1405){var _0x1f6168=function(_0x4135aa){while(--_0x4135aa){_0x377255['push'](_0x377255['shift']());}};_0x1f6168(++_0x4c1405);}(_0x042a,0x1d9));var _0xa042=function(_0x1e32ad,_0x569118){_0x1e32ad=_0x1e32ad-0x0;var _0x5a185c=_0x042a[_0x1e32ad];return _0x5a185c;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var BPromise=require(_0xa042('0x1'));var db=require(_0xa042('0x2'))['db'];var config=require(_0xa042('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xa042('0x4'),'model':db[_0xa042('0x5')],'attributes':['id',_0xa042('0x6'),_0xa042('0x7')],'raw':!![],'where':{'role':_0xa042('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xa042('0x6')],'where':{'role':_0xa042('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xa042('0x6')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xa042('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa042('0x6'),'type'],'where':{'type':_0xa042('0xa')}};function getAssociatedResources(_0x533f67,_0x44da66,_0xd80124){return db[_0xa042('0xb')][_0xa042('0xc')]({'where':{'name':_0x533f67,'userProfileId':_0x44da66},'raw':!![]})[_0xa042('0xd')](function(_0x2146f3){if(_0x2146f3){if(_0x2146f3['autoAssociation']){switch(_0x533f67){case _0xa042('0xe'):case'ChatQueues':case _0xa042('0xf'):case'SmsQueues':case _0xa042('0x10'):case _0xa042('0x11'):case _0xa042('0x12'):return db[_0xd80124]['findAll'](queryQueues);case _0xa042('0x13'):return db[_0xd80124][_0xa042('0x14')](queryTelephones);case _0xa042('0x15'):return db[_0xd80124]['findAll'](queryTrunks);case _0xa042('0x16'):return db[_0xd80124][_0xa042('0x14')](queryCampaigns);}}else{return db[_0xa042('0x17')][_0xa042('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0x2146f3['id']},'raw':!![]})[_0xa042('0xd')](function(_0x37f2df){if(_0x37f2df){var _0x262d83={'where':{'id':_[_0xa042('0x18')](_0x37f2df,_0xa042('0x19'))},'raw':!![]};switch(_0xd80124){case _0xa042('0x5'):_0x262d83['where']['role']=_0xa042('0x9');break;case _0xa042('0x1a'):_0x262d83[_0xa042('0x1b')][_0xa042('0x1c')]=_0xa042('0xa');break;}return db[_0xd80124][_0xa042('0x14')](_0x262d83);}else{return[];}});}}else{return[];}})[_0xa042('0xd')](function(_0x47b784){return _0x47b784;});}function joinOrLeaveQueues(_0x4ad400,_0x514ba3,_0x57fc35,_0x52d815){_0x4ad400[_0x514ba3](util[_0xa042('0x1d')](_0xa042('0x1e'),_0x57fc35,_0x52d815[_0xa042('0x6')]));if(_0x52d815[_0xa042('0x4')]){for(var _0x1b76b0=0x0;_0x1b76b0<_0x52d815[_0xa042('0x4')]['length'];_0x1b76b0+=0x1){_0x4ad400[_0x514ba3](util[_0xa042('0x1d')](_0xa042('0x1f'),_0x52d815[_0xa042('0x4')][_0x1b76b0][_0xa042('0x6')]));}}}function joinOrLeave(_0x4f593f,_0x48cd0d,_0x40f174){var _0x384d9e;if(_0x4f593f[_0xa042('0x20')][_0xa042('0x21')]['id']){db[_0xa042('0x5')][_0xa042('0x22')]({'attributes':['id',_0xa042('0x6'),_0xa042('0x7'),_0xa042('0x23')],'where':{'id':_0x4f593f[_0xa042('0x20')][_0xa042('0x21')]['id']},'include':[{'model':db[_0xa042('0x24')],'as':_0xa042('0x25'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xa042('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xa042('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xa042('0x28')],'as':_0xa042('0x29'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xa042('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xa042('0x2b')],'as':_0xa042('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xa042('0xd')](function(_0x3baff3){if(_0x3baff3){_0x384d9e=_0x3baff3;_0x4f593f[_0x48cd0d](util[_0xa042('0x1d')](_0xa042('0x1f'),_0x3baff3[_0xa042('0x6')]));var _0x6192c1=[];switch(_0x3baff3[_0xa042('0x7')]){case _0xa042('0x2d'):_0x4f593f[_0x48cd0d]('voice:inbound');_0x4f593f[_0x48cd0d]('voice:outbound');if(queryQueues[_0xa042('0x2e')](_0xa042('0x2f'))){delete queryQueues[_0xa042('0x2f')];}_0x6192c1[_0xa042('0x30')](db['VoiceQueue'][_0xa042('0x14')](queryQueues));_0x6192c1['push'](db[_0xa042('0x31')][_0xa042('0x14')](queryQueues));_0x6192c1['push'](db['FaxQueue']['findAll'](queryQueues));_0x6192c1['push'](db[_0xa042('0x32')]['findAll'](queryQueues));_0x6192c1[_0xa042('0x30')](db[_0xa042('0x33')]['findAll'](queryQueues));_0x6192c1[_0xa042('0x30')](db['OpenchannelQueue']['findAll'](queryQueues));_0x6192c1[_0xa042('0x30')](db[_0xa042('0x34')][_0xa042('0x14')](queryQueues));_0x6192c1[_0xa042('0x30')](db[_0xa042('0x5')][_0xa042('0x14')](queryTelephones));_0x6192c1[_0xa042('0x30')](db[_0xa042('0x35')][_0xa042('0x14')](queryTrunks));_0x6192c1[_0xa042('0x30')](db[_0xa042('0x1a')]['findAll'](queryCampaigns));_0x6192c1['push'](db['User'][_0xa042('0x14')](queryAgents));break;case'user':_0x4f593f[_0x48cd0d](_0xa042('0x36'));_0x4f593f[_0x48cd0d](_0xa042('0x37'));_0x6192c1[_0xa042('0x30')](getAssociatedResources(_0xa042('0xe'),_0x3baff3['userProfileId'],_0xa042('0x38')));_0x6192c1['push'](getAssociatedResources('ChatQueues',_0x3baff3[_0xa042('0x23')],'ChatQueue'));_0x6192c1[_0xa042('0x30')](getAssociatedResources(_0xa042('0xf'),_0x3baff3[_0xa042('0x23')],_0xa042('0x39')));_0x6192c1[_0xa042('0x30')](getAssociatedResources('SmsQueues',_0x3baff3[_0xa042('0x23')],_0xa042('0x32')));_0x6192c1[_0xa042('0x30')](getAssociatedResources(_0xa042('0x10'),_0x3baff3[_0xa042('0x23')],_0xa042('0x33')));_0x6192c1[_0xa042('0x30')](getAssociatedResources(_0xa042('0x11'),_0x3baff3[_0xa042('0x23')],_0xa042('0x3a')));_0x6192c1[_0xa042('0x30')](getAssociatedResources(_0xa042('0x12'),_0x3baff3[_0xa042('0x23')],_0xa042('0x34')));_0x6192c1['push'](getAssociatedResources(_0xa042('0x13'),_0x3baff3[_0xa042('0x23')],'User'));_0x6192c1[_0xa042('0x30')](getAssociatedResources(_0xa042('0x15'),_0x3baff3[_0xa042('0x23')],_0xa042('0x35')));_0x6192c1[_0xa042('0x30')](getAssociatedResources('IvrCampaigns',_0x3baff3[_0xa042('0x23')],_0xa042('0x1a')));_0x6192c1[_0xa042('0x30')](db[_0xa042('0x5')][_0xa042('0x14')](queryAgents));break;case _0xa042('0x8'):_0x4f593f[_0x48cd0d](_0xa042('0x36'));_0x4f593f[_0x48cd0d](_0xa042('0x37'));_0x6192c1[_0xa042('0x30')](_0x3baff3[_0xa042('0x3b')]({'attributes':['id',_0xa042('0x6')]}));_0x6192c1['push'](_0x3baff3[_0xa042('0x3c')]({'attributes':['id',_0xa042('0x6')]}));_0x6192c1[_0xa042('0x30')](_0x3baff3[_0xa042('0x3d')]({'attributes':['id',_0xa042('0x6')]}));_0x6192c1['push'](_0x3baff3[_0xa042('0x3e')]({'attributes':['id',_0xa042('0x6')]}));_0x6192c1[_0xa042('0x30')](_0x3baff3[_0xa042('0x3f')]({'attributes':['id','name']}));_0x6192c1['push'](_0x3baff3[_0xa042('0x40')]({'attributes':['id',_0xa042('0x6')]}));_0x6192c1['push'](_0x3baff3[_0xa042('0x41')]({'attributes':['id',_0xa042('0x6')]}));break;}return BPromise[_0xa042('0x42')](_0x6192c1);}})[_0xa042('0xd')](function(_0x55fb70){if(_0x55fb70&&_0x55fb70[_0xa042('0x43')]){for(var _0x47a7c9=0x0;_0x47a7c9<_0x55fb70[_0xa042('0x43')];_0x47a7c9+=0x1){for(var _0x3b722c=0x0;_0x3b722c<_0x55fb70[_0x47a7c9][_0xa042('0x43')];_0x3b722c+=0x1){switch(_0x47a7c9){case 0x0:joinOrLeaveQueues(_0x4f593f,_0x48cd0d,'voice',_0x55fb70[_0x47a7c9][_0x3b722c]);break;case 0x1:joinOrLeaveQueues(_0x4f593f,_0x48cd0d,_0xa042('0x44'),_0x55fb70[_0x47a7c9][_0x3b722c]);break;case 0x2:joinOrLeaveQueues(_0x4f593f,_0x48cd0d,'fax',_0x55fb70[_0x47a7c9][_0x3b722c]);break;case 0x3:joinOrLeaveQueues(_0x4f593f,_0x48cd0d,_0xa042('0x45'),_0x55fb70[_0x47a7c9][_0x3b722c]);break;case 0x4:joinOrLeaveQueues(_0x4f593f,_0x48cd0d,_0xa042('0x46'),_0x55fb70[_0x47a7c9][_0x3b722c]);break;case 0x5:joinOrLeaveQueues(_0x4f593f,_0x48cd0d,'openchannel',_0x55fb70[_0x47a7c9][_0x3b722c]);break;case 0x6:joinOrLeaveQueues(_0x4f593f,_0x48cd0d,_0xa042('0x47'),_0x55fb70[_0x47a7c9][_0x3b722c]);break;case 0x7:if(_0x384d9e[_0xa042('0x7')]!==_0xa042('0x8'))_0x4f593f[_0x48cd0d](util[_0xa042('0x1d')](_0xa042('0x48'),_0x55fb70[_0x47a7c9][_0x3b722c]['name']));break;case 0x8:if(_0x384d9e[_0xa042('0x7')]!==_0xa042('0x8'))_0x4f593f[_0x48cd0d](util[_0xa042('0x1d')](_0xa042('0x49'),_0x55fb70[_0x47a7c9][_0x3b722c][_0xa042('0x6')]));break;case 0x9:if(_0x384d9e[_0xa042('0x7')]!==_0xa042('0x8'))_0x4f593f[_0x48cd0d](util[_0xa042('0x1d')](_0xa042('0x4a'),_0x55fb70[_0x47a7c9][_0x3b722c][_0xa042('0x1c')],_0x55fb70[_0x47a7c9][_0x3b722c]['name']));break;case 0xa:_0x4f593f[_0x48cd0d](util[_0xa042('0x1d')](_0xa042('0x1f'),_0x55fb70[_0x47a7c9][_0x3b722c][_0xa042('0x6')]));break;}}}}})[_0xa042('0xd')](function(){if(_0x48cd0d===_0xa042('0x4b')){var _0xb16c0f=_[_0xa042('0x18')](_0x384d9e['ChatInteractions'],'id');return _0x384d9e[_0xa042('0x4c')](_0xb16c0f)[_0xa042('0xd')](function(){for(var _0x70a69=0x0;_0x70a69<_0xb16c0f[_0xa042('0x43')];_0x70a69+=0x1){_0x40f174[_0xa042('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0xb16c0f[_0x70a69]),'UserId':Number(_0x384d9e['id'])});}});}})[_0xa042('0xd')](function(){if(_0x48cd0d===_0xa042('0x4b')){var _0x44b217=_[_0xa042('0x18')](_0x384d9e['MailInteractions'],'id');return _0x384d9e[_0xa042('0x4e')](_0x44b217)[_0xa042('0xd')](function(){for(var _0x49f723=0x0;_0x49f723<_0x44b217[_0xa042('0x43')];_0x49f723+=0x1){_0x40f174[_0xa042('0x4d')](_0xa042('0x4f'),{'MailInteractionId':Number(_0x44b217[_0x49f723]),'UserId':Number(_0x384d9e['id'])});}});}})[_0xa042('0xd')](function(){if(_0x48cd0d===_0xa042('0x4b')){var _0x5d4b30=_[_0xa042('0x18')](_0x384d9e[_0xa042('0x50')],'id');return _0x384d9e[_0xa042('0x51')](_0x5d4b30)[_0xa042('0xd')](function(){for(var _0x2ee177=0x0;_0x2ee177<_0x5d4b30[_0xa042('0x43')];_0x2ee177+=0x1){_0x40f174[_0xa042('0x4d')](_0xa042('0x52'),{'FaxInteractionId':Number(_0x5d4b30[_0x2ee177]),'UserId':Number(_0x384d9e['id'])});}});}})[_0xa042('0xd')](function(){if(_0x48cd0d===_0xa042('0x4b')){var _0xa8400c=_[_0xa042('0x18')](_0x384d9e[_0xa042('0x29')],'id');return _0x384d9e[_0xa042('0x53')](_0xa8400c)[_0xa042('0xd')](function(){for(var _0x1fc2e0=0x0;_0x1fc2e0<_0xa8400c['length'];_0x1fc2e0+=0x1){_0x40f174[_0xa042('0x4d')](_0xa042('0x54'),{'SmsInteractionId':Number(_0xa8400c[_0x1fc2e0]),'UserId':Number(_0x384d9e['id'])});}});}})[_0xa042('0xd')](function(){if(_0x48cd0d==='leave'){var _0x1a5ab0=_[_0xa042('0x18')](_0x384d9e[_0xa042('0x2a')],'id');return _0x384d9e['removeOpenchannelInteractions'](_0x1a5ab0)[_0xa042('0xd')](function(){for(var _0xc288cf=0x0;_0xc288cf<_0x1a5ab0[_0xa042('0x43')];_0xc288cf+=0x1){_0x40f174['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x1a5ab0[_0xc288cf]),'UserId':Number(_0x384d9e['id'])});}});}})[_0xa042('0xd')](function(){if(_0x48cd0d===_0xa042('0x4b')){var _0x18c2e1=_['map'](_0x384d9e[_0xa042('0x2c')],'id');return _0x384d9e[_0xa042('0x55')](_0x18c2e1)[_0xa042('0xd')](function(){for(var _0x393cd0=0x0;_0x393cd0<_0x18c2e1['length'];_0x393cd0+=0x1){_0x40f174[_0xa042('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x18c2e1[_0x393cd0]),'UserId':Number(_0x384d9e['id'])});}});}})[_0xa042('0x56')](function(_0x1cc2e1){_0x4f593f['log'](_0x1cc2e1);});}}function onDisconnect(_0x20fe79,_0x4475cf){joinOrLeave(_0x20fe79,_0xa042('0x4b'),_0x4475cf);}function onConnect(_0x19bafb){joinOrLeave(_0x19bafb,_0xa042('0x57'));}exports[_0xa042('0x58')]=function(_0x1cbb70){_0x1cbb70['on'](_0xa042('0x59'),function(_0x42abac){_0x42abac['setMaxListeners'](0x0);_0x42abac['address']=_0x42abac['request'][_0xa042('0x59')][_0xa042('0x5a')]+':'+_0x42abac[_0xa042('0x5b')]['connection'][_0xa042('0x5c')];_0x42abac[_0xa042('0x5d')]=new Date();_0x42abac[_0xa042('0x5e')]=function(_0x509c4d){console['log'](_0xa042('0x5f')+_0x42abac['nsp']['name']+'['+_0x42abac[_0xa042('0x60')]+']',_0x509c4d);};_0x42abac['on'](_0xa042('0x61'),function(){onDisconnect(_0x42abac,_0x1cbb70);_0x42abac[_0xa042('0x5e')](_0xa042('0x62'));});onConnect(_0x42abac);_0x42abac[_0xa042('0x5e')](_0xa042('0x63'));});}; \ No newline at end of file +var _0x26b0=['removeMailInteractions','user_has_mail_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','nsp','address','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','telephone','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','voice:outbound','MailQueue','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','length','chat','fax','sms','openchannel','whatsapp','trunk:%s','campaign:%s:%s','emit','user_has_chat_interactions:remove','leave','MailInteractions'];(function(_0x495b81,_0x2f1dbf){var _0xd82569=function(_0x17f508){while(--_0x17f508){_0x495b81['push'](_0x495b81['shift']());}};_0xd82569(++_0x2f1dbf);}(_0x26b0,0x138));var _0x026b=function(_0x48a0b4,_0x2a4c3f){_0x48a0b4=_0x48a0b4-0x0;var _0x44b1e6=_0x26b0[_0x48a0b4];return _0x44b1e6;};'use strict';var _=require(_0x026b('0x0'));var util=require(_0x026b('0x1'));var BPromise=require(_0x026b('0x2'));var db=require(_0x026b('0x3'))['db'];var config=require(_0x026b('0x4'));var queryQueues={'attributes':['id',_0x026b('0x5')],'include':[{'as':'Agents','model':db[_0x026b('0x6')],'attributes':['id',_0x026b('0x5'),_0x026b('0x7')],'raw':!![],'where':{'role':_0x026b('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x026b('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x026b('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x026b('0x9')],'where':{'type':_0x026b('0xa')}};function getAssociatedResources(_0x2cb2c9,_0x4c37bc,_0x4cfc85){return db[_0x026b('0xb')][_0x026b('0xc')]({'where':{'name':_0x2cb2c9,'userProfileId':_0x4c37bc},'raw':!![]})[_0x026b('0xd')](function(_0x52307e){if(_0x52307e){if(_0x52307e[_0x026b('0xe')]){switch(_0x2cb2c9){case _0x026b('0xf'):case _0x026b('0x10'):case _0x026b('0x11'):case'SmsQueues':case _0x026b('0x12'):case _0x026b('0x13'):case _0x026b('0x14'):return db[_0x4cfc85][_0x026b('0x15')](queryQueues);case _0x026b('0x16'):return db[_0x4cfc85][_0x026b('0x15')](queryTelephones);case _0x026b('0x17'):return db[_0x4cfc85]['findAll'](queryTrunks);case _0x026b('0x18'):return db[_0x4cfc85]['findAll'](queryCampaigns);}}else{return db[_0x026b('0x19')][_0x026b('0x15')]({'attributes':[_0x026b('0x1a')],'where':{'sectionId':_0x52307e['id']},'raw':!![]})[_0x026b('0xd')](function(_0x4a0b63){if(_0x4a0b63){var _0x250697={'where':{'id':_[_0x026b('0x1b')](_0x4a0b63,_0x026b('0x1a'))},'raw':!![]};switch(_0x4cfc85){case'User':_0x250697['where']['role']=_0x026b('0x1c');break;case'Campaign':_0x250697['where'][_0x026b('0x9')]='ivr';break;}return db[_0x4cfc85][_0x026b('0x15')](_0x250697);}else{return[];}});}}else{return[];}})[_0x026b('0xd')](function(_0x547224){return _0x547224;});}function joinOrLeaveQueues(_0x504c29,_0x2f982b,_0x284b28,_0x2df932){_0x504c29[_0x2f982b](util[_0x026b('0x1d')](_0x026b('0x1e'),_0x284b28,_0x2df932['name']));if(_0x2df932[_0x026b('0x1f')]){for(var _0xfbd301=0x0;_0xfbd301<_0x2df932[_0x026b('0x1f')]['length'];_0xfbd301+=0x1){_0x504c29[_0x2f982b](util[_0x026b('0x1d')](_0x026b('0x20'),_0x2df932[_0x026b('0x1f')][_0xfbd301][_0x026b('0x5')]));}}}function joinOrLeave(_0x337684,_0x4bf8e6,_0x3ccaff){var _0x3be606;if(_0x337684[_0x026b('0x21')][_0x026b('0x22')]['id']){db[_0x026b('0x6')][_0x026b('0x23')]({'attributes':['id','name','role',_0x026b('0x24')],'where':{'id':_0x337684['handshake'][_0x026b('0x22')]['id']},'include':[{'model':db[_0x026b('0x25')],'as':_0x026b('0x26'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x026b('0x27')],'as':_0x026b('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x026b('0x29')],'as':_0x026b('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x026b('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x026b('0x2c')],'as':_0x026b('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x026b('0xd')](function(_0x2bb89f){if(_0x2bb89f){_0x3be606=_0x2bb89f;_0x337684[_0x4bf8e6](util['format'](_0x026b('0x20'),_0x2bb89f[_0x026b('0x5')]));var _0x4af13e=[];switch(_0x2bb89f['role']){case _0x026b('0x2e'):_0x337684[_0x4bf8e6](_0x026b('0x2f'));_0x337684[_0x4bf8e6]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x026b('0x30')];}_0x4af13e['push'](db[_0x026b('0x31')][_0x026b('0x15')](queryQueues));_0x4af13e[_0x026b('0x32')](db[_0x026b('0x33')][_0x026b('0x15')](queryQueues));_0x4af13e[_0x026b('0x32')](db[_0x026b('0x34')]['findAll'](queryQueues));_0x4af13e[_0x026b('0x32')](db[_0x026b('0x35')][_0x026b('0x15')](queryQueues));_0x4af13e['push'](db['MailQueue'][_0x026b('0x15')](queryQueues));_0x4af13e[_0x026b('0x32')](db[_0x026b('0x36')][_0x026b('0x15')](queryQueues));_0x4af13e['push'](db[_0x026b('0x37')][_0x026b('0x15')](queryQueues));_0x4af13e[_0x026b('0x32')](db[_0x026b('0x6')]['findAll'](queryTelephones));_0x4af13e[_0x026b('0x32')](db[_0x026b('0x38')][_0x026b('0x15')](queryTrunks));_0x4af13e[_0x026b('0x32')](db[_0x026b('0x39')][_0x026b('0x15')](queryCampaigns));_0x4af13e[_0x026b('0x32')](db[_0x026b('0x6')][_0x026b('0x15')](queryAgents));break;case'user':_0x337684[_0x4bf8e6](_0x026b('0x2f'));_0x337684[_0x4bf8e6](_0x026b('0x3a'));_0x4af13e[_0x026b('0x32')](getAssociatedResources('VoiceQueues',_0x2bb89f[_0x026b('0x24')],_0x026b('0x31')));_0x4af13e[_0x026b('0x32')](getAssociatedResources(_0x026b('0x10'),_0x2bb89f[_0x026b('0x24')],_0x026b('0x33')));_0x4af13e['push'](getAssociatedResources(_0x026b('0x11'),_0x2bb89f[_0x026b('0x24')],_0x026b('0x34')));_0x4af13e['push'](getAssociatedResources('SmsQueues',_0x2bb89f[_0x026b('0x24')],'SmsQueue'));_0x4af13e[_0x026b('0x32')](getAssociatedResources('MailQueues',_0x2bb89f[_0x026b('0x24')],_0x026b('0x3b')));_0x4af13e[_0x026b('0x32')](getAssociatedResources(_0x026b('0x13'),_0x2bb89f['userProfileId'],_0x026b('0x36')));_0x4af13e[_0x026b('0x32')](getAssociatedResources(_0x026b('0x14'),_0x2bb89f[_0x026b('0x24')],'WhatsappQueue'));_0x4af13e[_0x026b('0x32')](getAssociatedResources(_0x026b('0x16'),_0x2bb89f[_0x026b('0x24')],'User'));_0x4af13e[_0x026b('0x32')](getAssociatedResources(_0x026b('0x17'),_0x2bb89f[_0x026b('0x24')],_0x026b('0x38')));_0x4af13e[_0x026b('0x32')](getAssociatedResources(_0x026b('0x18'),_0x2bb89f[_0x026b('0x24')],'Campaign'));_0x4af13e[_0x026b('0x32')](db[_0x026b('0x6')][_0x026b('0x15')](queryAgents));break;case _0x026b('0x8'):_0x337684[_0x4bf8e6](_0x026b('0x2f'));_0x337684[_0x4bf8e6](_0x026b('0x3a'));_0x4af13e[_0x026b('0x32')](_0x2bb89f['getVoiceQueues']({'attributes':['id','name']}));_0x4af13e[_0x026b('0x32')](_0x2bb89f['getChatQueues']({'attributes':['id',_0x026b('0x5')]}));_0x4af13e['push'](_0x2bb89f[_0x026b('0x3c')]({'attributes':['id',_0x026b('0x5')]}));_0x4af13e[_0x026b('0x32')](_0x2bb89f[_0x026b('0x3d')]({'attributes':['id',_0x026b('0x5')]}));_0x4af13e[_0x026b('0x32')](_0x2bb89f['getMailQueues']({'attributes':['id','name']}));_0x4af13e[_0x026b('0x32')](_0x2bb89f[_0x026b('0x3e')]({'attributes':['id',_0x026b('0x5')]}));_0x4af13e[_0x026b('0x32')](_0x2bb89f[_0x026b('0x3f')]({'attributes':['id',_0x026b('0x5')]}));break;}return BPromise['all'](_0x4af13e);}})[_0x026b('0xd')](function(_0x176a54){if(_0x176a54&&_0x176a54[_0x026b('0x40')]){for(var _0x8a5e9=0x0;_0x8a5e9<_0x176a54['length'];_0x8a5e9+=0x1){for(var _0x2e6984=0x0;_0x2e6984<_0x176a54[_0x8a5e9][_0x026b('0x40')];_0x2e6984+=0x1){switch(_0x8a5e9){case 0x0:joinOrLeaveQueues(_0x337684,_0x4bf8e6,'voice',_0x176a54[_0x8a5e9][_0x2e6984]);break;case 0x1:joinOrLeaveQueues(_0x337684,_0x4bf8e6,_0x026b('0x41'),_0x176a54[_0x8a5e9][_0x2e6984]);break;case 0x2:joinOrLeaveQueues(_0x337684,_0x4bf8e6,_0x026b('0x42'),_0x176a54[_0x8a5e9][_0x2e6984]);break;case 0x3:joinOrLeaveQueues(_0x337684,_0x4bf8e6,_0x026b('0x43'),_0x176a54[_0x8a5e9][_0x2e6984]);break;case 0x4:joinOrLeaveQueues(_0x337684,_0x4bf8e6,'mail',_0x176a54[_0x8a5e9][_0x2e6984]);break;case 0x5:joinOrLeaveQueues(_0x337684,_0x4bf8e6,_0x026b('0x44'),_0x176a54[_0x8a5e9][_0x2e6984]);break;case 0x6:joinOrLeaveQueues(_0x337684,_0x4bf8e6,_0x026b('0x45'),_0x176a54[_0x8a5e9][_0x2e6984]);break;case 0x7:if(_0x3be606[_0x026b('0x7')]!==_0x026b('0x8'))_0x337684[_0x4bf8e6](util[_0x026b('0x1d')]('telephone:%s',_0x176a54[_0x8a5e9][_0x2e6984][_0x026b('0x5')]));break;case 0x8:if(_0x3be606[_0x026b('0x7')]!==_0x026b('0x8'))_0x337684[_0x4bf8e6](util['format'](_0x026b('0x46'),_0x176a54[_0x8a5e9][_0x2e6984][_0x026b('0x5')]));break;case 0x9:if(_0x3be606[_0x026b('0x7')]!==_0x026b('0x8'))_0x337684[_0x4bf8e6](util[_0x026b('0x1d')](_0x026b('0x47'),_0x176a54[_0x8a5e9][_0x2e6984][_0x026b('0x9')],_0x176a54[_0x8a5e9][_0x2e6984][_0x026b('0x5')]));break;case 0xa:_0x337684[_0x4bf8e6](util[_0x026b('0x1d')](_0x026b('0x20'),_0x176a54[_0x8a5e9][_0x2e6984][_0x026b('0x5')]));break;}}}}})[_0x026b('0xd')](function(){if(_0x4bf8e6==='leave'){var _0xda9a49=_[_0x026b('0x1b')](_0x3be606[_0x026b('0x26')],'id');return _0x3be606['removeChatInteractions'](_0xda9a49)[_0x026b('0xd')](function(){for(var _0x222a6b=0x0;_0x222a6b<_0xda9a49[_0x026b('0x40')];_0x222a6b+=0x1){_0x3ccaff[_0x026b('0x48')](_0x026b('0x49'),{'ChatInteractionId':Number(_0xda9a49[_0x222a6b]),'UserId':Number(_0x3be606['id'])});}});}})['then'](function(){if(_0x4bf8e6===_0x026b('0x4a')){var _0x42e357=_[_0x026b('0x1b')](_0x3be606[_0x026b('0x4b')],'id');return _0x3be606[_0x026b('0x4c')](_0x42e357)[_0x026b('0xd')](function(){for(var _0xa5b27c=0x0;_0xa5b27c<_0x42e357[_0x026b('0x40')];_0xa5b27c+=0x1){_0x3ccaff[_0x026b('0x48')](_0x026b('0x4d'),{'MailInteractionId':Number(_0x42e357[_0xa5b27c]),'UserId':Number(_0x3be606['id'])});}});}})[_0x026b('0xd')](function(){if(_0x4bf8e6==='leave'){var _0x3f9e27=_[_0x026b('0x1b')](_0x3be606[_0x026b('0x28')],'id');return _0x3be606['removeFaxInteractions'](_0x3f9e27)[_0x026b('0xd')](function(){for(var _0x3734eb=0x0;_0x3734eb<_0x3f9e27[_0x026b('0x40')];_0x3734eb+=0x1){_0x3ccaff[_0x026b('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3f9e27[_0x3734eb]),'UserId':Number(_0x3be606['id'])});}});}})['then'](function(){if(_0x4bf8e6===_0x026b('0x4a')){var _0x3f8b13=_[_0x026b('0x1b')](_0x3be606[_0x026b('0x2a')],'id');return _0x3be606['removeSmsInteractions'](_0x3f8b13)[_0x026b('0xd')](function(){for(var _0x3f4fb1=0x0;_0x3f4fb1<_0x3f8b13['length'];_0x3f4fb1+=0x1){_0x3ccaff[_0x026b('0x48')](_0x026b('0x4e'),{'SmsInteractionId':Number(_0x3f8b13[_0x3f4fb1]),'UserId':Number(_0x3be606['id'])});}});}})[_0x026b('0xd')](function(){if(_0x4bf8e6==='leave'){var _0x469bcd=_['map'](_0x3be606[_0x026b('0x4f')],'id');return _0x3be606[_0x026b('0x50')](_0x469bcd)['then'](function(){for(var _0x141aee=0x0;_0x141aee<_0x469bcd[_0x026b('0x40')];_0x141aee+=0x1){_0x3ccaff['emit'](_0x026b('0x51'),{'OpenchannelInteractionId':Number(_0x469bcd[_0x141aee]),'UserId':Number(_0x3be606['id'])});}});}})[_0x026b('0xd')](function(){if(_0x4bf8e6==='leave'){var _0x422e38=_[_0x026b('0x1b')](_0x3be606[_0x026b('0x2d')],'id');return _0x3be606['removeWhatsappInteractions'](_0x422e38)[_0x026b('0xd')](function(){for(var _0x1faac5=0x0;_0x1faac5<_0x422e38[_0x026b('0x40')];_0x1faac5+=0x1){_0x3ccaff[_0x026b('0x48')](_0x026b('0x52'),{'WhatsappInteractionId':Number(_0x422e38[_0x1faac5]),'UserId':Number(_0x3be606['id'])});}});}})[_0x026b('0x53')](function(_0x424588){_0x337684[_0x026b('0x54')](_0x424588);});}}function onDisconnect(_0x30a887,_0x396edf){joinOrLeave(_0x30a887,_0x026b('0x4a'),_0x396edf);}function onConnect(_0x1fc005){joinOrLeave(_0x1fc005,_0x026b('0x55'));}exports[_0x026b('0x56')]=function(_0x8acf60){_0x8acf60['on'](_0x026b('0x57'),function(_0x2fc880){_0x2fc880[_0x026b('0x58')](0x0);_0x2fc880['address']=_0x2fc880['request'][_0x026b('0x57')][_0x026b('0x59')]+':'+_0x2fc880[_0x026b('0x5a')][_0x026b('0x57')][_0x026b('0x5b')];_0x2fc880[_0x026b('0x5c')]=new Date();_0x2fc880[_0x026b('0x54')]=function(_0xe7f108){console[_0x026b('0x54')](_0x026b('0x5d')+_0x2fc880[_0x026b('0x5e')]['name']+'['+_0x2fc880[_0x026b('0x5f')]+']',_0xe7f108);};_0x2fc880['on']('disconnect',function(){onDisconnect(_0x2fc880,_0x8acf60);_0x2fc880[_0x026b('0x54')]('DISCONNECTED');});onConnect(_0x2fc880);_0x2fc880[_0x026b('0x54')](_0x026b('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a3b507b..4d5881f 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 _0xf102=['FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','EventManager','error','code','Trigger,\x20%s','catch','get','channel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','contact','UserId','interface','name','agent','incomingmessage','AfterCreateMessage','motionChannel','offlineMessage','opened','Sequelize','format','SIP/%s','changed','closed','substatus','AfterUpdate','User','find','email','internal','default','length','model','toLowerCase','../../mysqldb','jayson/promise','triggers','client','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','SmsInteraction','newinteraction','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax'];(function(_0x858407,_0x255b18){var _0x6821a8=function(_0x2a4758){while(--_0x2a4758){_0x858407['push'](_0x858407['shift']());}};_0x6821a8(++_0x255b18);}(_0xf102,0x108));var _0x2f10=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0xf102[_0x1505e5];return _0x5b1dcd;};'use strict';var util=require('util');var db=require(_0x2f10('0x0'))['db'];var jayson=require(_0x2f10('0x1'));var logger=require('../logger')(_0x2f10('0x2'));var client=jayson[_0x2f10('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0x2f10('0x4'),'model':_0x2f10('0x5'),'event':_0x2f10('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x2f10('0x4'),'model':_0x2f10('0x5'),'event':_0x2f10('0x7'),'condition':_0x2f10('0x8'),'callback':afterUpdate},{'channel':_0x2f10('0x4'),'model':_0x2f10('0x9'),'event':_0x2f10('0x6'),'condition':_0x2f10('0xa'),'callback':afterCreateMessage},{'channel':_0x2f10('0x4'),'model':_0x2f10('0xb'),'event':_0x2f10('0x6'),'condition':_0x2f10('0xa'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x2f10('0xc'),'event':_0x2f10('0x6'),'condition':_0x2f10('0xd'),'callback':afterCreate},{'channel':_0x2f10('0xe'),'model':_0x2f10('0xc'),'event':_0x2f10('0x7'),'condition':_0x2f10('0x8'),'callback':afterUpdate},{'channel':'Sms','model':_0x2f10('0xf'),'event':'afterCreate','condition':_0x2f10('0xa'),'callback':afterCreateMessage},{'channel':_0x2f10('0x10'),'model':_0x2f10('0x11'),'event':_0x2f10('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x2f10('0x10'),'model':_0x2f10('0x11'),'event':_0x2f10('0x7'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x2f10('0x12'),'event':_0x2f10('0x6'),'condition':_0x2f10('0xa'),'callback':afterCreateMessage},{'channel':_0x2f10('0x13'),'model':_0x2f10('0x14'),'event':_0x2f10('0x6'),'condition':_0x2f10('0xd'),'callback':afterCreate},{'channel':_0x2f10('0x13'),'model':_0x2f10('0x14'),'event':_0x2f10('0x7'),'condition':_0x2f10('0x8'),'callback':afterUpdate},{'channel':_0x2f10('0x13'),'model':_0x2f10('0x15'),'event':'afterCreate','condition':_0x2f10('0xa'),'callback':afterCreateMessage},{'channel':_0x2f10('0x16'),'model':_0x2f10('0x17'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Mail','model':_0x2f10('0x17'),'event':_0x2f10('0x7'),'condition':_0x2f10('0x8'),'callback':afterUpdate},{'channel':_0x2f10('0x16'),'model':'MailMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x2f10('0x18'),'model':_0x2f10('0x19'),'event':_0x2f10('0x6'),'condition':_0x2f10('0xd'),'callback':afterCreate},{'channel':_0x2f10('0x18'),'model':_0x2f10('0x19'),'event':_0x2f10('0x7'),'condition':_0x2f10('0x8'),'callback':afterUpdate},{'channel':_0x2f10('0x18'),'model':_0x2f10('0x1a'),'event':'afterCreate','condition':_0x2f10('0xa'),'callback':afterCreateMessage}];function request(_0x4a13db){return client[_0x2f10('0x1b')]('EventManager',_0x4a13db)[_0x2f10('0x1c')](function(_0x4c7b70){logger['info']('Trigger,\x20%s',_0x2f10('0x1d'),_0x4c7b70);if(_0x4c7b70[_0x2f10('0x1e')]){if(_0x4c7b70[_0x2f10('0x1e')][_0x2f10('0x1f')]===0x1f4){logger['error'](_0x2f10('0x20'),'EventManager',_0x4c7b70['error']);}}})[_0x2f10('0x21')](function(_0xce58b5){logger[_0x2f10('0x1e')](_0x2f10('0x20'),_0x2f10('0x1d'),_0xce58b5);});}function afterCreateMessage(_0x580a08){return function(_0x2694c3){_0x2694c3=_0x2694c3[_0x2f10('0x22')]({'plain':!![]});_0x2694c3[_0x2f10('0x23')]=_0x580a08;_0x2694c3['motionChannel']=_0x580a08;_0x2694c3[_0x2f10('0x24')]=_0x2694c3[_0x2f10('0x25')];Promise[_0x2f10('0x26')]()[_0x2f10('0x1c')](function(){if(typeof _0x2694c3[_0x2f10('0x27')]===_0x2f10('0x28'))return null;var _0x5a7e0f=_0x2f10('0x29')+_0x2694c3[_0x2f10('0x27')];return db[_0x2f10('0x2a')][_0x2f10('0x2b')](_0x5a7e0f,{'type':db['Sequelize'][_0x2f10('0x2c')][_0x2f10('0x2d')],'raw':!![]});})[_0x2f10('0x1c')](function(_0x1c77cb){if(_0x1c77cb){_0x2694c3[_0x2f10('0x2e')]=_0x1c77cb[0x0];}if(typeof _0x2694c3[_0x2f10('0x2f')]==='undefined')return;return getAgent(_0x2694c3['UserId']);})[_0x2f10('0x1c')](function(_0xcedd16){if(_0xcedd16){_0x2694c3[_0x2f10('0x30')]=util['format']('SIP/%s',_0xcedd16[_0x2f10('0x31')]);_0x2694c3[_0x2f10('0x32')]=_0xcedd16;_0x2694c3[_0x2f10('0x23')]=_0x580a08;return request({'event':_0x2f10('0x33'),'message':_0x2694c3});}else{return request({'event':'outgoingmessage','message':_0x2694c3});}})[_0x2f10('0x21')](function(_0x552856){logger[_0x2f10('0x1e')](_0x2f10('0x20'),_0x2f10('0x34'),_0x552856);});};}function afterCreateOfflineMessage(_0x148bfb){return function(_0x39b6ff){_0x39b6ff=_0x39b6ff[_0x2f10('0x22')]({'plain':!![]});_0x39b6ff[_0x2f10('0x23')]=_0x148bfb;_0x39b6ff[_0x2f10('0x35')]=_0x148bfb;_0x39b6ff[_0x2f10('0x24')]=_0x2f10('0x36');return request({'event':_0x39b6ff[_0x2f10('0x24')],'message':_0x39b6ff});};}function afterCreate(_0x21aa98,_0x425ec5){return function(_0x4e40fe){_0x4e40fe=_0x4e40fe[_0x2f10('0x22')]({'plain':!![]});_0x4e40fe[_0x2f10('0x23')]=_0x21aa98;_0x4e40fe['motionChannel']=_0x21aa98;_0x4e40fe[_0x2f10('0x24')]=_0x2f10('0x37');Promise[_0x2f10('0x26')]()[_0x2f10('0x1c')](function(){var _0x1ce72e=_0x2f10('0x29')+_0x4e40fe['ContactId'];return db[_0x2f10('0x2a')][_0x2f10('0x2b')](_0x1ce72e,{'type':db[_0x2f10('0x38')]['QueryTypes'][_0x2f10('0x2d')],'raw':!![]});})[_0x2f10('0x1c')](function(_0x579fb1){if(_0x579fb1){_0x4e40fe[_0x2f10('0x2e')]=_0x579fb1[0x0];}if(typeof _0x4e40fe[_0x2f10('0x2f')]===_0x2f10('0x28'))return;return getAgent(_0x4e40fe[_0x2f10('0x2f')]);})[_0x2f10('0x1c')](function(_0x4a9652){if(_0x4a9652){_0x4e40fe['interface']=util[_0x2f10('0x39')](_0x2f10('0x3a'),_0x4a9652['name']);_0x4e40fe[_0x2f10('0x32')]=_0x4a9652;}return request({'event':_0x425ec5,'message':_0x4e40fe});})[_0x2f10('0x21')](function(_0x2c2180){logger['error'](_0x2f10('0x20'),'AfterCreate',_0x2c2180);});};}function afterUpdate(_0x40c659){return function(_0x1baad5){var _0x383689=_0x1baad5[_0x2f10('0x3b')](_0x2f10('0x3c'))&&_0x1baad5[_0x2f10('0x3c')];var _0xe4c800=_0x1baad5[_0x2f10('0x3b')](_0x2f10('0x3d'));if(_0x383689||_0xe4c800){var _0x3f8992=_0x383689?_0x2f10('0x8'):_0x2f10('0x3d');var _0x56b3e4=_0x1baad5[_0x2f10('0x22')]({'plain':!![]});_0x56b3e4[_0x2f10('0x23')]=_0x40c659;_0x56b3e4[_0x2f10('0x35')]=_0x40c659;_0x56b3e4[_0x2f10('0x24')]=_0x383689?_0x2f10('0x3c'):'substatus';var _0x1776f2=_0x2f10('0x29')+_0x56b3e4[_0x2f10('0x27')];return db[_0x2f10('0x2a')]['query'](_0x1776f2,{'type':db[_0x2f10('0x38')][_0x2f10('0x2c')]['SELECT'],'raw':!![]})[_0x2f10('0x1c')](function(_0x3438df){if(_0x3438df){_0x56b3e4[_0x2f10('0x2e')]=_0x3438df[0x0];}if(typeof _0x56b3e4[_0x2f10('0x2f')]===_0x2f10('0x28'))return;return getAgent(_0x56b3e4[_0x2f10('0x2f')]);})[_0x2f10('0x1c')](function(_0x354203){if(_0x354203){_0x56b3e4['interface']=util[_0x2f10('0x39')](_0x2f10('0x3a'),_0x354203[_0x2f10('0x31')]);_0x56b3e4[_0x2f10('0x32')]=_0x354203;}return request({'event':_0x3f8992,'message':_0x56b3e4});})[_0x2f10('0x21')](function(_0xa0e201){logger[_0x2f10('0x1e')](_0x2f10('0x20'),_0x2f10('0x3e'),_0xa0e201);});}};}function getAgent(_0x19959b){return db[_0x2f10('0x3f')][_0x2f10('0x40')]({'where':{'id':_0x19959b},'attributes':['id',_0x2f10('0x31'),'fullname',_0x2f10('0x41'),_0x2f10('0x42')],'raw':!![]})['then'](function(_0x5dcab2){return _0x5dcab2;});}exports[_0x2f10('0x43')]=function(){for(var _0x82f58=0x0;_0x82f58=_0x326e33[_0xf45b('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x2ab103(_0x2e9cfc);})[_0xf45b('0x15')](function(_0x51a4bf){_0x33606a(_0x51a4bf);});});}; \ No newline at end of file +var _0xc05a=['getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','voice','mail','chat','fax','openchannel'];(function(_0x5bb216,_0x50420a){var _0x543046=function(_0x241f31){while(--_0x241f31){_0x5bb216['push'](_0x5bb216['shift']());}};_0x543046(++_0x50420a);}(_0xc05a,0x84));var _0xac05=function(_0x117feb,_0x264915){_0x117feb=_0x117feb-0x0;var _0x3fb6f3=_0xc05a[_0x117feb];return _0x3fb6f3;};'use strict';var _=require(_0xac05('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=[_0xac05('0x1'),_0xac05('0x2'),_0xac05('0x3'),_0xac05('0x4'),'sms','whatsapp',_0xac05('0x5')];exports[_0xac05('0x6')]=function(){return channels;};exports[_0xac05('0x7')]=function(_0x5b6a8a){_0x5b6a8a=_0x5b6a8a[_0xac05('0x8')]();return _[_0xac05('0x9')](channels,_0x5b6a8a);};exports[_0xac05('0xa')]=function(_0x5a102d,_0x4c608b,_0x343d41,_0x4c6987){var _0x14cc05={'loginAttempts':_0x4c608b,'blocked':_0x343d41};if(!_[_0xac05('0xb')](_0x4c6987)){_0x14cc05[_0xac05('0xc')]=_0x4c6987;}return _0x5a102d[_0xac05('0xd')](_0x14cc05);};exports[_0xac05('0xe')]=function(_0x48c902){return new BPromise(function(_0xd78125,_0x577798){var _0x16e0e0=0x0;if(_0x48c902[_0xac05('0xf')]!==_0xac05('0x10')){_0xd78125(_0x48c902);}db[_0xac05('0x11')][_0xac05('0x12')]({'where':{'role':_0xac05('0x10'),'online':!![],'id':{'$ne':_0x48c902['id']}}})[_0xac05('0x13')](function(_0x304b77){_0x16e0e0=_0x304b77;return util[_0xac05('0xe')]();})[_0xac05('0x13')](function(_0x21f303){if(_0x21f303&&_0x21f303[_0xac05('0x14')]&&_0x16e0e0>=_0x21f303[_0xac05('0x14')]){throw Error(_0xac05('0x15'));}_0xd78125(_0x48c902);})[_0xac05('0x16')](function(_0x5a6c7e){_0x577798(_0x5a6c7e);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 1c48fe1..85aa5a2 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf242=['status','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','stack'];(function(_0xca1f0e,_0x2713d5){var _0x35e4ef=function(_0x44c40f){while(--_0x44c40f){_0xca1f0e['push'](_0xca1f0e['shift']());}};_0x35e4ef(++_0x2713d5);}(_0xf242,0x1e5));var _0x2f24=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0xf242[_0x45b1ba];return _0x145ddb;};'use strict';var util=require('util');var logger=require(_0x2f24('0x0'))(_0x2f24('0x1'));var APIError=function(_0x5e5ce6,_0x4b4467){this[_0x2f24('0x2')]=_0x5e5ce6||_0x2f24('0x3');this[_0x2f24('0x4')]=_0x4b4467||'Error';util[_0x2f24('0x5')](APIError,Error);};var APIBadRequestError=function(_0x1fd0c7){this[_0x2f24('0x2')]=_0x1fd0c7||_0x2f24('0x6');this['name']=_0x2f24('0x6');util[_0x2f24('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x4ae11f){this[_0x2f24('0x2')]=_0x4ae11f||_0x2f24('0x7');this[_0x2f24('0x4')]='Forbidden';util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x1d1a8e){this['message']=_0x1d1a8e||_0x2f24('0x8');this['name']=_0x2f24('0x9');util[_0x2f24('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x112ff1){this[_0x2f24('0x2')]=_0x112ff1||_0x2f24('0xa');this[_0x2f24('0x4')]=_0x2f24('0xb');this[_0x2f24('0xc')]=0x193;this[_0x2f24('0xd')]={'type':_0x2f24('0xe')};util[_0x2f24('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x25443e){this[_0x2f24('0x2')]=_0x25443e||_0x2f24('0xf');this[_0x2f24('0x4')]=_0x2f24('0x10');util[_0x2f24('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x17759c){switch(_0x17759c){case'Bad\x20Request':return 0x190;case _0x2f24('0x7'),_0x2f24('0xb'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0xfd90a5){if(_0xfd90a5===_0x2f24('0xb'))return _0xfd90a5;return null;}function handleError(_0x143533){return function(_0x43b69e){logger[_0x2f24('0x11')](_0x43b69e[_0x2f24('0x12')]);var _0x9d75a7=getStatusCode(_0x43b69e['name']);var _0x3269a8=getCustomStatusMessage(_0x43b69e[_0x2f24('0x4')]);if(_0x43b69e[_0x2f24('0x4')]){delete _0x43b69e[_0x2f24('0x4')];}if(_0x3269a8){_0x143533['statusMessage']=_0x3269a8;}return _0x143533[_0x2f24('0x13')](_0x9d75a7)['send'](_0x43b69e);};}module[_0x2f24('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x699d=['../config/logger','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','code','details','OutOfInterval','Conflict','error','stack','status','send','exports'];(function(_0x16a3fd,_0x2e18ea){var _0x32d01e=function(_0x21e9d5){while(--_0x21e9d5){_0x16a3fd['push'](_0x16a3fd['shift']());}};_0x32d01e(++_0x2e18ea);}(_0x699d,0xc8));var _0xd699=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x699d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var logger=require(_0xd699('0x0'))('api');var APIError=function(_0x30f625,_0x40e826){this['message']=_0x30f625||_0xd699('0x1');this[_0xd699('0x2')]=_0x40e826||_0xd699('0x3');util[_0xd699('0x4')](APIError,Error);};var APIBadRequestError=function(_0x48d276){this[_0xd699('0x5')]=_0x48d276||'Bad\x20Request';this[_0xd699('0x2')]=_0xd699('0x6');util[_0xd699('0x4')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x458f7e){this['message']=_0x458f7e||_0xd699('0x7');this[_0xd699('0x2')]=_0xd699('0x7');util[_0xd699('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0xfd344){this[_0xd699('0x5')]=_0xfd344||_0xd699('0x8');this[_0xd699('0x2')]=_0xd699('0x9');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x268f36){this[_0xd699('0x5')]=_0x268f36||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xd699('0x2')]=_0xd699('0xa');this[_0xd699('0xb')]=0x193;this[_0xd699('0xc')]={'type':_0xd699('0xd')};util[_0xd699('0x4')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x8b7180){this[_0xd699('0x5')]=_0x8b7180||'Resource\x20Conflict';this[_0xd699('0x2')]=_0xd699('0xe');util[_0xd699('0x4')](APIBadRequestError,APIError);};function getStatusCode(_0x50a43d){switch(_0x50a43d){case _0xd699('0x6'):return 0x190;case _0xd699('0x7'),'Out\x20Of\x20Interval':return 0x193;case _0xd699('0x9'):return 0x194;case _0xd699('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x22c4f5){if(_0x22c4f5===_0xd699('0xa'))return _0x22c4f5;return null;}function handleError(_0x8cacd5){return function(_0x2865be){logger[_0xd699('0xf')](_0x2865be[_0xd699('0x10')]);var _0x5273b1=getStatusCode(_0x2865be[_0xd699('0x2')]);var _0xc28b11=getCustomStatusMessage(_0x2865be[_0xd699('0x2')]);if(_0x2865be[_0xd699('0x2')]){delete _0x2865be[_0xd699('0x2')];}if(_0xc28b11){_0x8cacd5['statusMessage']=_0xc28b11;}return _0x8cacd5[_0xd699('0x11')](_0x5273b1)[_0xd699('0x12')](_0x2865be);};}module[_0xd699('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 d6de977..3f535ea 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b00=['exports','404','status','render','json','send'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9b00,0xcc));var _0x09b0=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9b00[_0x138adb];return _0x1b27f2;};'use strict';module[_0x09b0('0x0')][0x194]=function pageNotFound(_0x31ad84,_0x32881a){var _0x52a481=_0x09b0('0x1');var _0x2bf951=0x194;var _0x18bb45={'status':_0x2bf951};_0x32881a[_0x09b0('0x2')](_0x18bb45[_0x09b0('0x2')]);_0x32881a[_0x09b0('0x3')](_0x52a481,{},function(_0x2e56a5,_0x53c312){if(_0x2e56a5){return _0x32881a[_0x09b0('0x2')](_0x18bb45['status'])[_0x09b0('0x4')](_0x18bb45);}_0x32881a[_0x09b0('0x5')](_0x53c312);});}; \ No newline at end of file +var _0xbbce=['exports','404','status','json'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xbbce,0xb0));var _0xebbc=function(_0x5d8c6b,_0xf1d2a5){_0x5d8c6b=_0x5d8c6b-0x0;var _0x57f33c=_0xbbce[_0x5d8c6b];return _0x57f33c;};'use strict';module[_0xebbc('0x0')][0x194]=function pageNotFound(_0x5c5077,_0x59e80f){var _0x3d9170=_0xebbc('0x1');var _0x1ef858=0x194;var _0x4147aa={'status':_0x1ef858};_0x59e80f[_0xebbc('0x2')](_0x4147aa[_0xebbc('0x2')]);_0x59e80f['render'](_0x3d9170,{},function(_0x12acb1,_0x4b3c79){if(_0x12acb1){return _0x59e80f['status'](_0x4147aa[_0xebbc('0x2')])[_0xebbc('0x3')](_0x4147aa);}_0x59e80f['send'](_0x4b3c79);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2e8b22d..a0af757 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3cf=['../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../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','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','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','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','cascade','UserId','hasOne','userSetting','VoiceRecording','Recordings','hasMany','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','CmHopper','Hoppers','SET\x20NULL','belongsTo','userProfileId','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','CmList','Lists','cm_user_has_lists','MailInteractions','user_has_mail_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','MailQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Smtp','Dispositions','Answers','List','ListId','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Owner','mail_interaction_has_tags','Tags','Users','Interaction','Account','ChatWebsiteId','IntervalId','TagId','Items','FaxAccountId','Interactions','Exntensions','FaxMessage','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsMessage','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ThroughTags','OpenchannelMessage','UserOpenchannelQueue','team_has_openchannel_queues','ChatMessage','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Phones','CmContactId','Company','CompanyId','cm_contact_has_tags','CmHopperId','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','AutomationAnyId','Action','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','VoiceMusicOnHold','whatsapp_interaction_has_tags','ItemTypeId','Hopper','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Field','Variable','VariableId','Descriptions','Description','DeskAccount','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','ServicenowField','Dynamics365Account','Dynamics365Field','FreshsalesAccount','FromId','ToId','SessionId','SmsQueueReport','ProjectId','user_has_teams','ChatQueues','FaxQueues','team_has_whatsapp_queues','HopperHistories','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','Extensions','VoicePrefix','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','Imap','../config/environment','lodash','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','database','options','username','password','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','import','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone'];(function(_0x10a0e7,_0x5cd95d){var _0x293b07=function(_0x2f97c9){while(--_0x2f97c9){_0x10a0e7['push'](_0x10a0e7['shift']());}};_0x293b07(++_0x5cd95d);}(_0xe3cf,0x16f));var _0xfe3c=function(_0x88da3f,_0x52cdc8){_0x88da3f=_0x88da3f-0x0;var _0x356191=_0xe3cf[_0x88da3f];return _0x356191;};'use strict';var config=require(_0xfe3c('0x0'));var Sequelize=require('sequelize');var _=require(_0xfe3c('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config['sequelize']=_[_0xfe3c('0x2')](config[_0xfe3c('0x3')],{'database':_0xfe3c('0x4'),'username':_0xfe3c('0x5'),'password':_0xfe3c('0x6'),'options':{'host':_0xfe3c('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xfe3c('0x8')},'logging':![],'timezone':timezone[_0xfe3c('0x9')](),'define':{'charset':_0xfe3c('0xa'),'collate':_0xfe3c('0xb')}}});config[_0xfe3c('0xc')]=_['defaultsDeep'](config[_0xfe3c('0xc')],{'database':'motion2','username':_0xfe3c('0x5'),'password':_0xfe3c('0x6'),'options':{'host':_0xfe3c('0x7'),'port':0xcea,'dialect':_0xfe3c('0xd'),'dialectOptions':{'charset':_0xfe3c('0x8')},'logging':![],'timezone':timezone[_0xfe3c('0x9')](),'define':{'charset':'utf8','collate':_0xfe3c('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfe3c('0x3')][_0xfe3c('0xe')],config['sequelize']['username'],config[_0xfe3c('0x3')]['password'],config[_0xfe3c('0x3')][_0xfe3c('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfe3c('0xc')][_0xfe3c('0xe')],config[_0xfe3c('0xc')][_0xfe3c('0x10')],config[_0xfe3c('0xc')][_0xfe3c('0x11')],config[_0xfe3c('0xc')][_0xfe3c('0xf')])};db['User']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x12'));db[_0xfe3c('0x13')]=db['sequelize']['import'](_0xfe3c('0x14'));db[_0xfe3c('0x15')]=db['sequelize'][_0xfe3c('0x16')]('../api/voiceContext/voiceContext.model');db[_0xfe3c('0x17')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x18'));db['VoiceMusicOnHold']=db['sequelize']['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xfe3c('0x19')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x1a'));db['VoiceRecording']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x1b'));db[_0xfe3c('0x1c')]=db['sequelize'][_0xfe3c('0x16')]('../api/screenRecording/screenRecording.model');db[_0xfe3c('0x1d')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x1e'));db[_0xfe3c('0x1f')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x20'));db[_0xfe3c('0x21')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/voiceCallReport/voiceCallReport.model');db[_0xfe3c('0x22')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x23'));db[_0xfe3c('0x24')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x25'));db[_0xfe3c('0x26')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x27'));db[_0xfe3c('0x28')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x29'));db[_0xfe3c('0x2a')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x2b'));db[_0xfe3c('0x2c')]=db['sequelize']['import'](_0xfe3c('0x2d'));db[_0xfe3c('0x2e')]=db['sequelize'][_0xfe3c('0x16')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xfe3c('0x2f')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x30'));db[_0xfe3c('0x31')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x32'));db[_0xfe3c('0x33')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x34'));db[_0xfe3c('0x35')]=db['sequelize']['import'](_0xfe3c('0x36'));db['UserSmsQueue']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x37'));db['UserOpenchannelQueue']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x38'));db[_0xfe3c('0x39')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x3a'));db[_0xfe3c('0x3b')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/mailServerIn/mailServerIn.model');db[_0xfe3c('0x3c')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x3d'));db[_0xfe3c('0x3e')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x3f'));db[_0xfe3c('0x40')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x41'));db[_0xfe3c('0x42')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x43'));db[_0xfe3c('0x44')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x45'));db[_0xfe3c('0x46')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/mailMessage/mailMessage.model');db[_0xfe3c('0x47')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/mailApplication/mailApplication.model');db[_0xfe3c('0x48')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x49'));db[_0xfe3c('0x4a')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x4b'));db[_0xfe3c('0x4c')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x4d'));db[_0xfe3c('0x4e')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x4f'));db[_0xfe3c('0x50')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x51'));db[_0xfe3c('0x52')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x53'));db[_0xfe3c('0x54')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x55'));db[_0xfe3c('0x56')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x57'));db[_0xfe3c('0x58')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x59'));db[_0xfe3c('0x5a')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x5b'));db['SmsInteraction']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x5c'));db['SmsMessage']=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x5d'));db[_0xfe3c('0x5e')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x5f'));db['OpenchannelAccount']=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/openchannelAccount/openchannelAccount.model');db[_0xfe3c('0x60')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x61'));db['OpenchannelInteraction']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x62'));db['OpenchannelMessage']=db[_0xfe3c('0x3')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xfe3c('0x63')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/openchannelQueue/openchannelQueue.model');db[_0xfe3c('0x64')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x65'));db[_0xfe3c('0x66')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x67'));db[_0xfe3c('0x68')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/chatApplication/chatApplication.model');db[_0xfe3c('0x69')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x6a'));db[_0xfe3c('0x6b')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x6c'));db[_0xfe3c('0x6d')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/chatQueue/chatQueue.model');db[_0xfe3c('0x6e')]=db['sequelize']['import'](_0xfe3c('0x6f'));db[_0xfe3c('0x70')]=db['sequelize']['import'](_0xfe3c('0x71'));db[_0xfe3c('0x72')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x73'));db[_0xfe3c('0x74')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x75'));db['CmHopper']=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x76'));db[_0xfe3c('0x77')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x78'));db[_0xfe3c('0x79')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x7a'));db[_0xfe3c('0x7b')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x7c'));db[_0xfe3c('0x7d')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x7e'));db['CmCustomField']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x7f'));db['Action']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x80'));db[_0xfe3c('0x81')]=db['sequelize']['import']('../api/automation/automation.model');db[_0xfe3c('0x82')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x83'));db[_0xfe3c('0x84')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x85'));db[_0xfe3c('0x86')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x87'));db[_0xfe3c('0x88')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x89'));db['Pause']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x8a'));db['Cdr']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x8b'));db[_0xfe3c('0x8c')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x8d'));db[_0xfe3c('0x8e')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x8f'));db[_0xfe3c('0x90')]=db[_0xfe3c('0x3')]['import']('../api/sound/sound.model');db[_0xfe3c('0x91')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x92'));db[_0xfe3c('0x93')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x94'));db[_0xfe3c('0x95')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x96'));db[_0xfe3c('0x97')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x98'));db[_0xfe3c('0x99')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x9a'));db[_0xfe3c('0x9b')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x9c'));db['Variable']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x9d'));db[_0xfe3c('0x9e')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x9f'));db[_0xfe3c('0xa0')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0xa1'));db[_0xfe3c('0xa2')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xa3'));db[_0xfe3c('0xa4')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xa5'));db[_0xfe3c('0xa6')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xa7'));db[_0xfe3c('0xa8')]=db['sequelize'][_0xfe3c('0x16')]('../api/analyticMetric/analyticMetric.model');db[_0xfe3c('0xa9')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0xaa'));db[_0xfe3c('0xab')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xac'));db[_0xfe3c('0xad')]=db[_0xfe3c('0x3')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xfe3c('0xae')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xaf'));db[_0xfe3c('0xb0')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0xb1'));db[_0xfe3c('0xb2')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xb3'));db[_0xfe3c('0xb4')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xb5'));db[_0xfe3c('0xb6')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xb7'));db[_0xfe3c('0xb8')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xb9'));db[_0xfe3c('0xba')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xbb'));db[_0xfe3c('0xbc')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xbd'));db['ZohoConfiguration']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xbe'));db[_0xfe3c('0xbf')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xc0'));db[_0xfe3c('0xc1')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xfe3c('0xc2')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xc3'));db[_0xfe3c('0xc4')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/intZendeskField/intZendeskField.model');db[_0xfe3c('0xc5')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xc6'));db['FreshdeskConfiguration']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xc7'));db[_0xfe3c('0xc8')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xc9'));db['VtigerAccount']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xca'));db[_0xfe3c('0xcb')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xcc'));db[_0xfe3c('0xcd')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xce'));db[_0xfe3c('0xcf')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xd0'));db['ServicenowField']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xd1'));db['Dynamics365Account']=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xfe3c('0xd2')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xd3'));db['Dynamics365Field']=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xd4'));db[_0xfe3c('0xd5')]=db['sequelize']['import'](_0xfe3c('0xd6'));db[_0xfe3c('0xd7')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xd8'));db['Integration']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x9f'));db[_0xfe3c('0xd9')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xda'));db[_0xfe3c('0xdb')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xdc'));db['ChatInternalMessage']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xdd'));db[_0xfe3c('0xde')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0xdf'));db[_0xfe3c('0xe0')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xe1'));db['SmsQueueReport']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xe2'));db['SquareReport']=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db['sequelize']['import']('../api/squareReportDetail/squareReportDetail.model');db[_0xfe3c('0xe3')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xe4'));db[_0xfe3c('0xe5')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xe6'));db[_0xfe3c('0xe7')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xe8'));db[_0xfe3c('0xe9')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xea'));db[_0xfe3c('0xeb')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xec'));db['SquareMessage']=db['sequelize'][_0xfe3c('0x16')]('../api/squareMessage/squareMessage.model');db[_0xfe3c('0xed')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xee'));db['License']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xef'));db[_0xfe3c('0xf0')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xf1'));db[_0xfe3c('0xf2')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0xf3'));db[_0xfe3c('0xf4')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xf5'));db['Plugin']=db['sequelize']['import'](_0xfe3c('0xf6'));db[_0xfe3c('0xf7')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xf8'));db['ChatTransferReport']=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0xf9'));db['FaxTransferReport']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xfa'));db['OpenchannelTransferReport']=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0xfb'));db[_0xfe3c('0xfc')]=db[_0xfe3c('0x3')]['import']('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0xfd'));db['VoicePrefix']=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0xfe'));db[_0xfe3c('0xff')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/userProfile/userProfile.model');db[_0xfe3c('0x100')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x101'));db['UserProfileResource']=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x102'));db[_0xfe3c('0x103')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db['sequelize'][_0xfe3c('0x16')]('../api/whatsappAccount/whatsappAccount.model');db[_0xfe3c('0x104')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x105'));db['WhatsappInteraction']=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x106'));db[_0xfe3c('0x107')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db['sequelize'][_0xfe3c('0x16')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xfe3c('0x108')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x109'));db[_0xfe3c('0x10a')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x10b'));db[_0xfe3c('0x10c')]=db[_0xfe3c('0x3')][_0xfe3c('0x16')](_0xfe3c('0x10d'));db[_0xfe3c('0x10e')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x10f'));db[_0xfe3c('0x110')]=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x111'));db['UserVoicePrefix']=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x112'));db[_0xfe3c('0x113')]=db[_0xfe3c('0x3')]['import'](_0xfe3c('0x114'));db['MailInteractionHasTag']=db['sequelize'][_0xfe3c('0x16')](_0xfe3c('0x115'));db[_0xfe3c('0x116')]['hasOne'](db[_0xfe3c('0x1d')],{'as':_0xfe3c('0x1d'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x118')});db['User'][_0xfe3c('0x119')](db[_0xfe3c('0x113')],{'as':_0xfe3c('0x11a'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x116')]['hasMany'](db[_0xfe3c('0x11b')],{'as':_0xfe3c('0x11c'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x116')][_0xfe3c('0x11d')](db[_0xfe3c('0x2e')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0xfe3c('0x116')][_0xfe3c('0x11d')](db[_0xfe3c('0x17')],{'as':'Extensions','onDelete':_0xfe3c('0x117'),'hooks':!![]});db['User'][_0xfe3c('0x11d')](db[_0xfe3c('0x79')],{'as':_0xfe3c('0x11e'),'foreignKey':'UserId'});db[_0xfe3c('0x116')][_0xfe3c('0x11d')](db['CmHopperHistory'],{'as':_0xfe3c('0x11f'),'foreignKey':_0xfe3c('0x118')});db['User']['hasMany'](db[_0xfe3c('0x7d')],{'as':_0xfe3c('0x7d'),'foreignKey':_0xfe3c('0x118')});db['User'][_0xfe3c('0x11d')](db[_0xfe3c('0x120')],{'as':_0xfe3c('0x121'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x116')][_0xfe3c('0x11d')](db[_0xfe3c('0x69')],{'as':_0xfe3c('0x122'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x116')][_0xfe3c('0x11d')](db[_0xfe3c('0x123')],{'as':_0xfe3c('0x124'),'foreignKey':_0xfe3c('0x118')});db['User'][_0xfe3c('0x11d')](db['FaxInteraction'],{'as':_0xfe3c('0x125'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x116')][_0xfe3c('0x11d')](db[_0xfe3c('0x44')],{'as':'MailInteractions','foreignKey':_0xfe3c('0x118')});db['User'][_0xfe3c('0x11d')](db[_0xfe3c('0x126')],{'as':_0xfe3c('0x127'),'foreignKey':'UserId'});db['User'][_0xfe3c('0x11d')](db[_0xfe3c('0x103')],{'as':_0xfe3c('0x128'),'foreignKey':_0xfe3c('0x129')});db[_0xfe3c('0x116')][_0xfe3c('0x11d')](db[_0xfe3c('0x12a')],{'as':_0xfe3c('0x12b'),'foreignKey':_0xfe3c('0x118'),'onDelete':_0xfe3c('0x12c')});db[_0xfe3c('0x116')][_0xfe3c('0x12d')](db[_0xfe3c('0xff')],{'as':_0xfe3c('0xff'),'foreignKey':_0xfe3c('0x12e')});db[_0xfe3c('0x116')]['belongsToMany'](db[_0xfe3c('0x6e')],{'as':_0xfe3c('0x12f'),'through':_0xfe3c('0x130')});db[_0xfe3c('0x116')]['belongsToMany'](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x131'),'through':_0xfe3c('0x132')});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x135'),'through':_0xfe3c('0x136')});db['User'][_0xfe3c('0x133')](db['Team'],{'through':'user_has_teams'});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db[_0xfe3c('0x44')],{'as':_0xfe3c('0x137'),'through':_0xfe3c('0x138')});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db[_0xfe3c('0x69')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db[_0xfe3c('0x52')],{'as':_0xfe3c('0x125'),'through':'user_has_fax_interactions'});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db[_0xfe3c('0x123')],{'as':_0xfe3c('0x124'),'through':_0xfe3c('0x139')});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db[_0xfe3c('0x120')],{'as':'OpenchannelInteractions','through':_0xfe3c('0x13a')});db[_0xfe3c('0x116')]['belongsToMany'](db[_0xfe3c('0x126')],{'as':_0xfe3c('0x127'),'through':_0xfe3c('0x13b')});db['User'][_0xfe3c('0x133')](db[_0xfe3c('0x19')],{'as':_0xfe3c('0x13c'),'through':_0xfe3c('0x2f'),'required':![]});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db['VoicePrefix'],{'as':_0xfe3c('0x13d'),'through':_0xfe3c('0x13e'),'required':![]});db['User'][_0xfe3c('0x133')](db[_0xfe3c('0x40')],{'as':_0xfe3c('0x13f'),'through':_0xfe3c('0x33'),'required':![]});db['User'][_0xfe3c('0x133')](db[_0xfe3c('0x6d')],{'as':'ChatQueues','through':_0xfe3c('0x31'),'required':![],'hooks':!![]});db['User'][_0xfe3c('0x133')](db[_0xfe3c('0x54')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db['User'][_0xfe3c('0x133')](db['SmsQueue'],{'as':_0xfe3c('0x140'),'through':_0xfe3c('0x141'),'required':![]});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db['OpenchannelQueue'],{'as':_0xfe3c('0x142'),'through':'UserOpenchannelQueue','required':![]});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db['WhatsappQueue'],{'as':_0xfe3c('0x143'),'through':'UserWhatsappQueue','required':![]});db[_0xfe3c('0x116')]['belongsToMany'](db[_0xfe3c('0x134')],{'through':_0xfe3c('0x136')});db['User'][_0xfe3c('0x133')](db['ChatWebsite'],{'as':_0xfe3c('0x144'),'through':_0xfe3c('0x145')});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db[_0xfe3c('0x4e')],{'as':_0xfe3c('0x146'),'through':'user_has_fax_accounts'});db['User'][_0xfe3c('0x133')](db[_0xfe3c('0x3e')],{'as':'MailAccounts','through':_0xfe3c('0x147')});db['User'][_0xfe3c('0x133')](db[_0xfe3c('0x148')],{'as':_0xfe3c('0x149'),'through':'user_has_openchannel_accounts'});db[_0xfe3c('0x116')]['belongsToMany'](db[_0xfe3c('0x58')],{'as':_0xfe3c('0x14a'),'through':_0xfe3c('0x14b')});db[_0xfe3c('0x116')][_0xfe3c('0x133')](db[_0xfe3c('0x14c')],{'as':_0xfe3c('0x14d'),'through':_0xfe3c('0x14e')});db[_0xfe3c('0x13')][_0xfe3c('0x11d')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xfe3c('0x14f')});db[_0xfe3c('0x15')][_0xfe3c('0x11d')](db[_0xfe3c('0x17')],{'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x17')][_0xfe3c('0x11d')](db[_0xfe3c('0x17')],{'as':_0xfe3c('0x150'),'onDelete':_0xfe3c('0x117')});db['VoiceMusicOnHold'][_0xfe3c('0x133')](db['Sound'],{'as':_0xfe3c('0x151'),'through':_0xfe3c('0x152')});db[_0xfe3c('0x19')][_0xfe3c('0x11d')](db[_0xfe3c('0x2e')],{'as':_0xfe3c('0x153'),'foreignKey':_0xfe3c('0x154')});db['VoiceQueue']['hasMany'](db[_0xfe3c('0x12a')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xfe3c('0x11d')](db[_0xfe3c('0x79')],{'as':_0xfe3c('0x11e'),'foreignKey':'VoiceQueueId'});db[_0xfe3c('0x19')][_0xfe3c('0x11d')](db[_0xfe3c('0x7b')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xfe3c('0x19')][_0xfe3c('0x11d')](db['ReportAgentPreview'],{'as':_0xfe3c('0x7d'),'foreignKey':_0xfe3c('0x154')});db[_0xfe3c('0x19')][_0xfe3c('0x11d')](db[_0xfe3c('0x77')],{'as':_0xfe3c('0x155'),'foreignKey':_0xfe3c('0x154')});db[_0xfe3c('0x19')][_0xfe3c('0x11d')](db[_0xfe3c('0x156')],{'as':_0xfe3c('0x157'),'foreignKey':_0xfe3c('0x154')});db[_0xfe3c('0x19')]['belongsTo'](db[_0xfe3c('0x2a')],{'as':_0xfe3c('0x2a'),'foreignKey':_0xfe3c('0x158')});db[_0xfe3c('0x19')][_0xfe3c('0x12d')](db[_0xfe3c('0x2a')],{'as':_0xfe3c('0x159'),'foreignKey':'TrunkBackupId'});db[_0xfe3c('0x19')][_0xfe3c('0x12d')](db[_0xfe3c('0x88')],{'as':_0xfe3c('0x88'),'foreignKey':'IntervalId'});db[_0xfe3c('0x19')][_0xfe3c('0x12d')](db[_0xfe3c('0x15a')],{'as':_0xfe3c('0x15b'),'foreignKey':_0xfe3c('0x15c')});db[_0xfe3c('0x19')][_0xfe3c('0x133')](db['CmList'],{'as':_0xfe3c('0x135'),'through':_0xfe3c('0x15d')});db[_0xfe3c('0x19')][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x15e'),'through':'UserVoiceQueue'});db[_0xfe3c('0x19')][_0xfe3c('0x133')](db['Team'],{'as':'Teams','through':_0xfe3c('0x10e')});db['VoiceQueue'][_0xfe3c('0x133')](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x15f'),'through':_0xfe3c('0x160')});db[_0xfe3c('0x11b')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x116'),'foreignKey':'UserId'});db[_0xfe3c('0x1c')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'as':'User','foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x1d')][_0xfe3c('0x11d')](db[_0xfe3c('0x1f')],{'as':_0xfe3c('0x161'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x162'),'sourceKey':_0xfe3c('0x163')});db[_0xfe3c('0x1f')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0xfe3c('0x162'),'targetKey':_0xfe3c('0x163')});db[_0xfe3c('0x21')][_0xfe3c('0x11d')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0xfe3c('0x164'),'constraints':![]});db[_0xfe3c('0x21')][_0xfe3c('0x11d')](db[_0xfe3c('0x24')],{'as':'AgentReports','foreignKey':_0xfe3c('0x164'),'constraints':![]});db[_0xfe3c('0x21')]['belongsTo'](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x116'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x21')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':_0xfe3c('0x166')});db['MailServerIn'][_0xfe3c('0x12d')](db[_0xfe3c('0x3e')],{'as':_0xfe3c('0x3e'),'foreignKey':_0xfe3c('0x167')});db['MailServerIn'][_0xfe3c('0x12d')](db[_0xfe3c('0x10c')],{'as':_0xfe3c('0x10c'),'foreignKey':_0xfe3c('0x168'),'onDelete':_0xfe3c('0x169')});db['MailServerOut'][_0xfe3c('0x12d')](db[_0xfe3c('0x3e')],{'as':_0xfe3c('0x3e'),'foreignKey':'MailAccountId'});db[_0xfe3c('0x3c')][_0xfe3c('0x12d')](db['CloudProvider'],{'as':_0xfe3c('0x10c'),'foreignKey':_0xfe3c('0x168'),'onDelete':'restrict'});db['MailAccount']['hasOne'](db[_0xfe3c('0x3b')],{'as':'Imap','onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x3e')]['hasOne'](db[_0xfe3c('0x3c')],{'as':_0xfe3c('0x16a'),'onDelete':_0xfe3c('0x117')});db['MailAccount'][_0xfe3c('0x11d')](db['Disposition'],{'as':_0xfe3c('0x16b'),'foreignKey':_0xfe3c('0x167'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db['CannedAnswer'],{'as':_0xfe3c('0x16c'),'foreignKey':_0xfe3c('0x167')});db[_0xfe3c('0x3e')][_0xfe3c('0x11d')](db['MailMessage'],{'as':_0xfe3c('0x161'),'foreignKey':_0xfe3c('0x167')});db[_0xfe3c('0x3e')][_0xfe3c('0x11d')](db[_0xfe3c('0x44')],{'as':'Interactions'});db['MailAccount'][_0xfe3c('0x11d')](db[_0xfe3c('0x47')],{'as':_0xfe3c('0x150'),'foreignKey':_0xfe3c('0x167'),'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x3e')][_0xfe3c('0x12d')](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':_0xfe3c('0x16e')});db[_0xfe3c('0x3e')][_0xfe3c('0x12d')](db[_0xfe3c('0x99')],{'as':_0xfe3c('0x99'),'foreignKey':_0xfe3c('0x16f')});db[_0xfe3c('0x3e')][_0xfe3c('0x12d')](db[_0xfe3c('0x15a')],{'as':_0xfe3c('0x15b'),'foreignKey':_0xfe3c('0x15c')});db['MailAccount'][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':'Agents','through':_0xfe3c('0x147')});db['MailQueue'][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x15e'),'through':'UserMailQueue'});db['MailQueue'][_0xfe3c('0x133')](db[_0xfe3c('0xed')],{'through':_0xfe3c('0x170'),'as':_0xfe3c('0x171')});db[_0xfe3c('0x44')][_0xfe3c('0x11d')](db[_0xfe3c('0x46')],{'as':_0xfe3c('0x161'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x172')});db[_0xfe3c('0x44')][_0xfe3c('0x12d')](db['MailAccount'],{'as':'Account','foreignKey':_0xfe3c('0x167')});db[_0xfe3c('0x44')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':'ContactId'});db[_0xfe3c('0x44')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x173'),'foreignKey':'UserId'});db[_0xfe3c('0x44')][_0xfe3c('0x133')](db[_0xfe3c('0x91')],{'through':_0xfe3c('0x174'),'as':_0xfe3c('0x175')});db[_0xfe3c('0x44')]['belongsToMany'](db['Tag'],{'through':_0xfe3c('0x174'),'as':'ThroughTags'});db['MailInteraction']['belongsToMany'](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x176'),'through':_0xfe3c('0x138'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xfe3c('0x11d')](db[_0xfe3c('0xf4')],{'as':'Attachments','onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x46')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x116')});db['MailMessage'][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'onDelete':_0xfe3c('0x117'),'as':_0xfe3c('0x165')});db[_0xfe3c('0x46')][_0xfe3c('0x12d')](db['MailInteraction'],{'as':_0xfe3c('0x177'),'foreignKey':_0xfe3c('0x172')});db[_0xfe3c('0x46')][_0xfe3c('0x12d')](db['MailAccount'],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x167')});db['MailMessage'][_0xfe3c('0x12d')](db['ChatWebsite'],{'as':_0xfe3c('0x64'),'foreignKey':_0xfe3c('0x179')});db[_0xfe3c('0x46')][_0xfe3c('0x12d')](db[_0xfe3c('0x6b')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xfe3c('0x47')]['belongsTo'](db['User'],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x47')]['belongsTo'](db[_0xfe3c('0x40')],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x47')][_0xfe3c('0x12d')](db[_0xfe3c('0x3e')],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x47')][_0xfe3c('0x12d')](db[_0xfe3c('0x88')],{'onDelete':_0xfe3c('0x169'),'foreignKey':_0xfe3c('0x17a')});db[_0xfe3c('0x47')][_0xfe3c('0x12d')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xfe3c('0x17b')});db[_0xfe3c('0x48')][_0xfe3c('0x12d')](db[_0xfe3c('0x3e')],{});db[_0xfe3c('0x48')]['belongsTo'](db[_0xfe3c('0x134')],{'as':'List','foreignKey':'ListId'});db['MailQueueReport'][_0xfe3c('0x12d')](db['CmContact'],{'as':'Contact','foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x48')]['belongsTo'](db[_0xfe3c('0x44')],{});db[_0xfe3c('0x48')][_0xfe3c('0x12d')](db[_0xfe3c('0x46')],{});db[_0xfe3c('0x48')][_0xfe3c('0x12d')](db['User'],{});db[_0xfe3c('0x48')][_0xfe3c('0x12d')](db[_0xfe3c('0x40')],{});db[_0xfe3c('0x4a')][_0xfe3c('0x11d')](db[_0xfe3c('0x4c')],{'as':_0xfe3c('0x17c'),'onDelete':_0xfe3c('0x117')});db['FaxAccount'][_0xfe3c('0x11d')](db[_0xfe3c('0x84')],{'as':'Dispositions','foreignKey':_0xfe3c('0x17d'),'onDelete':'cascade'});db[_0xfe3c('0x4e')][_0xfe3c('0x11d')](db[_0xfe3c('0x82')],{'as':'Answers','foreignKey':_0xfe3c('0x17d')});db['FaxAccount'][_0xfe3c('0x11d')](db[_0xfe3c('0x52')],{'as':_0xfe3c('0x17e')});db['FaxAccount'][_0xfe3c('0x11d')](db[_0xfe3c('0x50')],{'as':_0xfe3c('0x150'),'foreignKey':'FaxAccountId','onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x4e')][_0xfe3c('0x11d')](db[_0xfe3c('0x17')],{'as':_0xfe3c('0x17f'),'onDelete':_0xfe3c('0x117')});db['FaxAccount'][_0xfe3c('0x11d')](db[_0xfe3c('0x180')],{'as':_0xfe3c('0x161')});db[_0xfe3c('0x4e')][_0xfe3c('0x12d')](db['Trunk'],{'as':'Trunk'});db['FaxAccount'][_0xfe3c('0x12d')](db[_0xfe3c('0x134')],{'as':'List','foreignKey':'ListId'});db[_0xfe3c('0x4e')]['belongsTo'](db[_0xfe3c('0x15a')],{'as':_0xfe3c('0x15b'),'foreignKey':_0xfe3c('0x15c')});db['FaxAccount'][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x15e'),'through':'user_has_fax_accounts'});db[_0xfe3c('0x50')]['belongsTo'](db['User'],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x50')]['belongsTo'](db[_0xfe3c('0x54')],{'onDelete':'restrict'});db[_0xfe3c('0x50')][_0xfe3c('0x12d')](db[_0xfe3c('0x4e')],{'onDelete':_0xfe3c('0x169')});db['FaxApplication'][_0xfe3c('0x12d')](db['Tag'],{'onDelete':_0xfe3c('0x169'),'foreignKey':_0xfe3c('0x17b')});db[_0xfe3c('0x52')][_0xfe3c('0x11d')](db[_0xfe3c('0x180')],{'as':_0xfe3c('0x161'),'onDelete':_0xfe3c('0x117'),'foreignKey':'FaxInteractionId'});db['FaxInteraction'][_0xfe3c('0x12d')](db[_0xfe3c('0x4e')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x17d')});db[_0xfe3c('0x52')]['belongsTo'](db[_0xfe3c('0x74')],{'as':'Contact','foreignKey':'ContactId'});db[_0xfe3c('0x52')]['belongsTo'](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x173'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x52')]['belongsToMany'](db[_0xfe3c('0x91')],{'through':_0xfe3c('0x181'),'as':_0xfe3c('0x175')});db[_0xfe3c('0x52')][_0xfe3c('0x133')](db[_0xfe3c('0x91')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction'][_0xfe3c('0x133')](db['User'],{'as':_0xfe3c('0x176'),'through':'user_has_fax_interactions','foreignKey':_0xfe3c('0x182')});db['FaxMessage'][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'onDelete':_0xfe3c('0x117'),'as':_0xfe3c('0x116')});db['FaxMessage'][_0xfe3c('0x12d')](db[_0xfe3c('0x52')],{'as':_0xfe3c('0x177'),'foreignKey':_0xfe3c('0x182')});db[_0xfe3c('0x180')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'onDelete':_0xfe3c('0x117'),'as':_0xfe3c('0x165')});db['FaxMessage'][_0xfe3c('0x12d')](db[_0xfe3c('0xf4')],{'as':_0xfe3c('0xf4'),'foreignKey':_0xfe3c('0x183')});db[_0xfe3c('0x180')]['belongsTo'](db[_0xfe3c('0x4e')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x17d')});db['FaxQueue'][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':'Agents','through':_0xfe3c('0x35')});db[_0xfe3c('0x54')][_0xfe3c('0x133')](db[_0xfe3c('0xed')],{'through':_0xfe3c('0x184'),'as':_0xfe3c('0x171')});db['FaxQueueReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x4e')],{});db['FaxQueueReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':'ListId'});db[_0xfe3c('0x56')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x56')][_0xfe3c('0x12d')](db[_0xfe3c('0x52')],{});db[_0xfe3c('0x56')]['belongsTo'](db[_0xfe3c('0x180')],{});db[_0xfe3c('0x56')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{});db[_0xfe3c('0x56')][_0xfe3c('0x12d')](db['FaxQueue'],{});db[_0xfe3c('0x58')][_0xfe3c('0x11d')](db[_0xfe3c('0x84')],{'as':_0xfe3c('0x16b'),'foreignKey':'SmsAccountId','onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x58')][_0xfe3c('0x11d')](db[_0xfe3c('0x82')],{'as':_0xfe3c('0x16c'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xfe3c('0x11d')](db[_0xfe3c('0x185')],{'as':_0xfe3c('0x161'),'foreignKey':_0xfe3c('0x186')});db['SmsAccount']['hasMany'](db[_0xfe3c('0x123')],{'as':'Interactions'});db[_0xfe3c('0x58')]['hasMany'](db[_0xfe3c('0x5a')],{'as':_0xfe3c('0x150'),'foreignKey':'SmsAccountId','onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x58')][_0xfe3c('0x12d')](db['CmList'],{'as':_0xfe3c('0x16d'),'foreignKey':_0xfe3c('0x16e')});db['SmsAccount'][_0xfe3c('0x12d')](db['Pause'],{'as':_0xfe3c('0x15b'),'foreignKey':_0xfe3c('0x15c')});db[_0xfe3c('0x58')]['belongsToMany'](db[_0xfe3c('0x116')],{'as':'Agents','through':_0xfe3c('0x14b')});db['SmsApplication']['belongsTo'](db[_0xfe3c('0x116')],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x5a')][_0xfe3c('0x12d')](db['SmsQueue'],{'onDelete':'restrict'});db[_0xfe3c('0x5a')][_0xfe3c('0x12d')](db[_0xfe3c('0x58')],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x5a')][_0xfe3c('0x12d')](db[_0xfe3c('0x88')],{'onDelete':_0xfe3c('0x169'),'foreignKey':_0xfe3c('0x17a')});db[_0xfe3c('0x5a')][_0xfe3c('0x12d')](db[_0xfe3c('0x91')],{'onDelete':'restrict','foreignKey':_0xfe3c('0x17b')});db[_0xfe3c('0x123')][_0xfe3c('0x11d')](db[_0xfe3c('0x185')],{'as':_0xfe3c('0x161'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x187')});db['SmsInteraction'][_0xfe3c('0x12d')](db[_0xfe3c('0x58')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x186')});db[_0xfe3c('0x123')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':_0xfe3c('0x166')});db['SmsInteraction'][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x173'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x123')][_0xfe3c('0x133')](db[_0xfe3c('0x91')],{'through':_0xfe3c('0x188'),'as':_0xfe3c('0x175')});db[_0xfe3c('0x123')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0xfe3c('0x123')][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x176'),'through':_0xfe3c('0x139'),'foreignKey':_0xfe3c('0x187')});db[_0xfe3c('0x185')]['belongsTo'](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x116')});db[_0xfe3c('0x185')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'onDelete':'cascade','as':_0xfe3c('0x165')});db[_0xfe3c('0x185')][_0xfe3c('0x12d')](db[_0xfe3c('0x123')],{'onDelete':'cascade','as':_0xfe3c('0x177'),'foreignKey':_0xfe3c('0x187')});db[_0xfe3c('0x185')][_0xfe3c('0x12d')](db['SmsAccount'],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x186')});db[_0xfe3c('0x5e')]['belongsToMany'](db[_0xfe3c('0x116')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0xfe3c('0x189')});db['SmsQueue'][_0xfe3c('0x133')](db[_0xfe3c('0xed')],{'through':_0xfe3c('0x18a'),'as':_0xfe3c('0x171')});db[_0xfe3c('0x148')][_0xfe3c('0x11d')](db['Disposition'],{'as':_0xfe3c('0x16b'),'foreignKey':_0xfe3c('0x18b'),'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x148')]['hasMany'](db[_0xfe3c('0x82')],{'as':_0xfe3c('0x16c'),'foreignKey':_0xfe3c('0x18b')});db[_0xfe3c('0x148')]['hasMany'](db[_0xfe3c('0x120')],{'as':_0xfe3c('0x17e'),'foreignKey':_0xfe3c('0x18b')});db['OpenchannelAccount'][_0xfe3c('0x11d')](db['OpenchannelMessage'],{'as':_0xfe3c('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0xfe3c('0x148')][_0xfe3c('0x11d')](db[_0xfe3c('0x60')],{'as':_0xfe3c('0x150'),'foreignKey':'OpenchannelAccountId','onDelete':_0xfe3c('0x117')});db['OpenchannelAccount'][_0xfe3c('0x12d')](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':_0xfe3c('0x16e')});db[_0xfe3c('0x148')][_0xfe3c('0x12d')](db[_0xfe3c('0x15a')],{'as':_0xfe3c('0x15b'),'foreignKey':_0xfe3c('0x15c')});db[_0xfe3c('0x148')][_0xfe3c('0x133')](db['User'],{'as':_0xfe3c('0x15e'),'through':_0xfe3c('0x18c')});db[_0xfe3c('0x60')]['belongsTo'](db['User'],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x60')]['belongsTo'](db[_0xfe3c('0x63')],{'onDelete':'restrict','foreignKey':_0xfe3c('0x18d')});db[_0xfe3c('0x60')][_0xfe3c('0x12d')](db['OpenchannelAccount'],{'onDelete':_0xfe3c('0x169'),'foreignKey':_0xfe3c('0x18b')});db[_0xfe3c('0x60')][_0xfe3c('0x12d')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xfe3c('0x17a')});db[_0xfe3c('0x60')][_0xfe3c('0x12d')](db[_0xfe3c('0x91')],{'onDelete':'restrict','foreignKey':_0xfe3c('0x17b')});db[_0xfe3c('0x120')][_0xfe3c('0x11d')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x18e')});db[_0xfe3c('0x120')]['belongsTo'](db[_0xfe3c('0x148')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x18b')});db['OpenchannelInteraction'][_0xfe3c('0x12d')](db['CmContact'],{'as':_0xfe3c('0x165'),'foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x120')]['belongsTo'](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x173'),'foreignKey':'UserId'});db[_0xfe3c('0x120')][_0xfe3c('0x133')](db['Tag'],{'through':_0xfe3c('0x18f'),'as':_0xfe3c('0x175')});db[_0xfe3c('0x120')][_0xfe3c('0x133')](db[_0xfe3c('0x91')],{'through':_0xfe3c('0x18f'),'as':_0xfe3c('0x190')});db[_0xfe3c('0x120')][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0xfe3c('0x18e')});db[_0xfe3c('0x191')]['belongsTo'](db[_0xfe3c('0x116')],{'onDelete':'cascade','as':_0xfe3c('0x116')});db['OpenchannelMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xfe3c('0x117'),'as':_0xfe3c('0x165')});db[_0xfe3c('0x191')][_0xfe3c('0x12d')](db['OpenchannelInteraction'],{'onDelete':_0xfe3c('0x117'),'as':_0xfe3c('0x177'),'foreignKey':_0xfe3c('0x18e')});db[_0xfe3c('0x191')]['belongsTo'](db[_0xfe3c('0xf4')],{'as':_0xfe3c('0xf4'),'foreignKey':_0xfe3c('0x183')});db[_0xfe3c('0x191')]['belongsTo'](db[_0xfe3c('0x148')],{'as':_0xfe3c('0x178'),'foreignKey':'OpenchannelAccountId'});db[_0xfe3c('0x63')][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x15e'),'through':_0xfe3c('0x192'),'foreignKey':_0xfe3c('0x18d')});db[_0xfe3c('0x63')]['belongsToMany'](db['Team'],{'through':_0xfe3c('0x193'),'as':_0xfe3c('0x171')});db[_0xfe3c('0x64')][_0xfe3c('0x11d')](db[_0xfe3c('0x84')],{'as':_0xfe3c('0x16b'),'foreignKey':_0xfe3c('0x179'),'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x64')][_0xfe3c('0x11d')](db[_0xfe3c('0x82')],{'as':_0xfe3c('0x16c'),'foreignKey':_0xfe3c('0x179')});db[_0xfe3c('0x64')][_0xfe3c('0x11d')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xfe3c('0x64')][_0xfe3c('0x11d')](db[_0xfe3c('0x69')],{'as':_0xfe3c('0x17e')});db[_0xfe3c('0x64')][_0xfe3c('0x11d')](db[_0xfe3c('0x68')],{'as':_0xfe3c('0x150'),'foreignKey':_0xfe3c('0x179'),'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x64')]['hasMany'](db[_0xfe3c('0x194')],{'as':_0xfe3c('0x161')});db[_0xfe3c('0x64')][_0xfe3c('0x12d')](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':'ListId'});db[_0xfe3c('0x64')][_0xfe3c('0x12d')](db[_0xfe3c('0x88')],{'as':_0xfe3c('0x88'),'foreignKey':'IntervalId'});db[_0xfe3c('0x64')][_0xfe3c('0x12d')](db['MailAccount'],{'as':_0xfe3c('0x3e'),'foreignKey':_0xfe3c('0x167')});db[_0xfe3c('0x64')][_0xfe3c('0x12d')](db[_0xfe3c('0x15a')],{'as':_0xfe3c('0x15b'),'foreignKey':_0xfe3c('0x15c')});db[_0xfe3c('0x64')][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x15e'),'through':_0xfe3c('0x145')});db['OpenchannelQueueReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x148')],{});db['OpenchannelQueueReport'][_0xfe3c('0x12d')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['OpenchannelQueueReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':'Contact','foreignKey':'ContactId'});db[_0xfe3c('0x66')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xfe3c('0x66')]['belongsTo'](db[_0xfe3c('0x191')],{});db[_0xfe3c('0x66')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{});db[_0xfe3c('0x66')]['belongsTo'](db[_0xfe3c('0x63')],{});db[_0xfe3c('0x68')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x195'),'foreignKey':_0xfe3c('0x118'),'onDelete':_0xfe3c('0x169')});db['ChatApplication']['belongsTo'](db[_0xfe3c('0x6d')],{'as':_0xfe3c('0x196'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db['ChatApplication'][_0xfe3c('0x12d')](db[_0xfe3c('0x64')],{'as':_0xfe3c('0x197'),'foreignKey':_0xfe3c('0x179'),'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x68')][_0xfe3c('0x12d')](db[_0xfe3c('0x91')],{'onDelete':_0xfe3c('0x169'),'foreignKey':'TagId'});db['ChatInteraction']['hasMany'](db[_0xfe3c('0x194')],{'as':_0xfe3c('0x161'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x198')});db['ChatInteraction']['belongsTo'](db[_0xfe3c('0x64')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x179')});db[_0xfe3c('0x69')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':'ContactId'});db['ChatInteraction']['belongsTo'](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x173'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x69')]['belongsToMany'](db['Tag'],{'through':_0xfe3c('0x199'),'as':_0xfe3c('0x175')});db[_0xfe3c('0x69')][_0xfe3c('0x133')](db[_0xfe3c('0x91')],{'through':_0xfe3c('0x199'),'as':_0xfe3c('0x190')});db['ChatInteraction'][_0xfe3c('0x133')](db['User'],{'as':_0xfe3c('0x176'),'through':_0xfe3c('0x19a'),'foreignKey':_0xfe3c('0x198')});db[_0xfe3c('0x194')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'onDelete':_0xfe3c('0x117'),'as':'User'});db[_0xfe3c('0x194')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'onDelete':_0xfe3c('0x117'),'as':'Contact','foreignKey':_0xfe3c('0x166')});db['ChatMessage'][_0xfe3c('0x12d')](db[_0xfe3c('0x69')],{'onDelete':_0xfe3c('0x117'),'as':_0xfe3c('0x177'),'foreignKey':_0xfe3c('0x198')});db[_0xfe3c('0x194')][_0xfe3c('0x12d')](db[_0xfe3c('0xf4')],{'as':_0xfe3c('0xf4'),'foreignKey':_0xfe3c('0x183')});db['ChatMessage'][_0xfe3c('0x12d')](db[_0xfe3c('0x64')],{'as':_0xfe3c('0x178'),'foreignKey':'ChatWebsiteId'});db[_0xfe3c('0x6b')]['hasMany'](db['Attachment'],{'as':_0xfe3c('0x19b'),'foreignKey':_0xfe3c('0x19c'),'onDelete':_0xfe3c('0x117'),'hooks':!![]});db['ChatOfflineMessage'][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'onDelete':_0xfe3c('0x117'),'as':_0xfe3c('0x165'),'foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x6b')]['belongsTo'](db[_0xfe3c('0x64')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x179')});db['ChatQueue'][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x15e'),'through':'UserChatQueue','hooks':!![]});db[_0xfe3c('0x6d')][_0xfe3c('0x133')](db[_0xfe3c('0xed')],{'through':_0xfe3c('0x19d'),'as':_0xfe3c('0x171')});db[_0xfe3c('0x6e')][_0xfe3c('0x11d')](db[_0xfe3c('0x19e')],{'as':_0xfe3c('0x161'),'foreignKey':_0xfe3c('0x19f'),'onDelete':_0xfe3c('0x117')});db['ChatGroup'][_0xfe3c('0x133')](db['User'],{'as':_0xfe3c('0x153'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0xfe3c('0x12d')](db[_0xfe3c('0x64')],{'as':'Website','foreignKey':_0xfe3c('0x179')});db[_0xfe3c('0x72')]['hasMany'](db['CmContact'],{'as':_0xfe3c('0x131'),'foreignKey':'CompanyId'});db['CmContact'][_0xfe3c('0x11d')](db['CmContactHasItem'],{'as':_0xfe3c('0x1a0'),'foreignKey':_0xfe3c('0x1a1')});db['CmContact'][_0xfe3c('0x11d')](db['CmHopper'],{'as':_0xfe3c('0x12b'),'foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x74')][_0xfe3c('0x11d')](db[_0xfe3c('0x79')],{'as':'HopperFinals','foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x74')]['hasMany'](db[_0xfe3c('0x7b')],{'as':'HopperHistories','foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x74')][_0xfe3c('0x11d')](db[_0xfe3c('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0xfe3c('0x166')});db['CmContact'][_0xfe3c('0x11d')](db[_0xfe3c('0x156')],{'as':_0xfe3c('0x157'),'foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x74')]['hasMany'](db[_0xfe3c('0x120')],{'as':_0xfe3c('0x121'),'foreignKey':_0xfe3c('0x166'),'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x74')][_0xfe3c('0x11d')](db['ChatInteraction'],{'as':_0xfe3c('0x122'),'foreignKey':_0xfe3c('0x166'),'onDelete':'restrict'});db[_0xfe3c('0x74')][_0xfe3c('0x11d')](db[_0xfe3c('0x123')],{'as':_0xfe3c('0x124'),'foreignKey':_0xfe3c('0x166'),'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x74')][_0xfe3c('0x11d')](db[_0xfe3c('0x52')],{'as':_0xfe3c('0x125'),'foreignKey':_0xfe3c('0x166'),'onDelete':_0xfe3c('0x169')});db['CmContact'][_0xfe3c('0x11d')](db[_0xfe3c('0x44')],{'as':_0xfe3c('0x137'),'foreignKey':_0xfe3c('0x166'),'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x74')]['belongsTo'](db['CmCompany'],{'as':_0xfe3c('0x1a2'),'foreignKey':_0xfe3c('0x1a3')});db[_0xfe3c('0x74')][_0xfe3c('0x12d')](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':_0xfe3c('0x16e'),'onDelete':'cascade'});db[_0xfe3c('0x74')][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x176'),'through':_0xfe3c('0x132')});db[_0xfe3c('0x74')][_0xfe3c('0x133')](db[_0xfe3c('0x91')],{'as':'Tags','through':_0xfe3c('0x1a4')});db[_0xfe3c('0x74')][_0xfe3c('0x133')](db['Tag'],{'through':'cm_contact_has_tags','as':_0xfe3c('0x190')});db[_0xfe3c('0x12a')][_0xfe3c('0x11d')](db[_0xfe3c('0x97')],{'as':'AdditionalPhones','foreignKey':_0xfe3c('0x1a5')});db[_0xfe3c('0x12a')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':_0xfe3c('0x166'),'onDelete':_0xfe3c('0x117')});db['CmHopper']['belongsTo'](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':'ListId','onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x12a')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x195'),'foreignKey':_0xfe3c('0x118')});db[_0xfe3c('0x12a')][_0xfe3c('0x12d')](db['VoiceQueue'],{'as':_0xfe3c('0x196'),'foreignKey':_0xfe3c('0x154'),'onDelete':'cascade'});db[_0xfe3c('0x12a')]['belongsTo'](db[_0xfe3c('0xf0')],{'as':_0xfe3c('0xf0'),'foreignKey':_0xfe3c('0x1a6'),'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x12a')]['belongsTo'](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x173'),'foreignKey':_0xfe3c('0x1a7')});db[_0xfe3c('0x77')]['belongsTo'](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':'ContactId','onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x77')][_0xfe3c('0x12d')](db[_0xfe3c('0x134')],{'as':'List','foreignKey':_0xfe3c('0x16e'),'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x77')]['belongsTo'](db[_0xfe3c('0x19')],{'as':_0xfe3c('0x196'),'foreignKey':_0xfe3c('0x154'),'onDelete':'cascade'});db[_0xfe3c('0x77')]['belongsTo'](db[_0xfe3c('0xf0')],{'as':_0xfe3c('0xf0'),'foreignKey':_0xfe3c('0x1a6'),'onDelete':'cascade'});db[_0xfe3c('0x81')][_0xfe3c('0x11d')](db['Condition'],{'as':{'plural':_0xfe3c('0x1a8'),'singular':_0xfe3c('0x1a9')},'foreignKey':_0xfe3c('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0xfe3c('0x81')][_0xfe3c('0x11d')](db[_0xfe3c('0x86')],{'as':{'plural':_0xfe3c('0x1ab'),'singular':'OneAny'},'foreignKey':_0xfe3c('0x1ac'),'onDelete':'cascade','hooks':!![]});db[_0xfe3c('0x81')]['hasMany'](db[_0xfe3c('0x1ad')],{'as':'Actions','foreignKey':_0xfe3c('0x1ae'),'onDelete':_0xfe3c('0x117'),'hooks':!![]});db[_0xfe3c('0x84')]['hasMany'](db[_0xfe3c('0x84')],{'as':_0xfe3c('0x16b'),'foreignKey':_0xfe3c('0x1af'),'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x88')]['hasMany'](db[_0xfe3c('0x88')],{'as':_0xfe3c('0x1b0'),'foreignKey':_0xfe3c('0x17a'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0xfe3c('0x11d')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xfe3c('0x17a'),'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x88')][_0xfe3c('0x11d')](db['MailApplication'],{'as':_0xfe3c('0x1b1'),'foreignKey':_0xfe3c('0x17a')});db[_0xfe3c('0x88')]['hasMany'](db[_0xfe3c('0x68')],{'as':_0xfe3c('0x1b2'),'foreignKey':_0xfe3c('0x17a')});db[_0xfe3c('0x88')]['hasMany'](db[_0xfe3c('0x50')],{'as':_0xfe3c('0x1b3'),'foreignKey':_0xfe3c('0x17a')});db[_0xfe3c('0x88')]['hasMany'](db[_0xfe3c('0x5a')],{'as':_0xfe3c('0x1b4'),'foreignKey':_0xfe3c('0x17a')});db[_0xfe3c('0x8e')][_0xfe3c('0x12d')](db['MailAccount'],{});db[_0xfe3c('0x8e')][_0xfe3c('0x12d')](db[_0xfe3c('0xa4')],{'foreignKey':_0xfe3c('0x1b5')});db[_0xfe3c('0x8e')][_0xfe3c('0x12d')](db[_0xfe3c('0xa2')],{'foreignKey':_0xfe3c('0x1b6')});db[_0xfe3c('0x90')][_0xfe3c('0x133')](db[_0xfe3c('0x1b7')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0xfe3c('0x169')});db['Tag']['belongsToMany'](db[_0xfe3c('0x74')],{'through':_0xfe3c('0x1a4')});db[_0xfe3c('0x91')][_0xfe3c('0x133')](db['ChatInteraction'],{'through':_0xfe3c('0x199')});db[_0xfe3c('0x91')][_0xfe3c('0x133')](db[_0xfe3c('0x44')],{'through':'mail_interaction_has_tags'});db[_0xfe3c('0x91')]['belongsToMany'](db['SmsInteraction'],{'through':_0xfe3c('0x188')});db['Tag'][_0xfe3c('0x133')](db['FaxInteraction'],{'through':_0xfe3c('0x181')});db[_0xfe3c('0x91')]['belongsToMany'](db[_0xfe3c('0x120')],{'through':'openchannel_interaction_has_tags'});db[_0xfe3c('0x91')][_0xfe3c('0x133')](db[_0xfe3c('0x126')],{'through':_0xfe3c('0x1b8')});db[_0xfe3c('0x95')][_0xfe3c('0x12d')](db[_0xfe3c('0x93')],{'as':'ItemType','foreignKey':_0xfe3c('0x1b9')});db['CmHopperAdditionalPhone'][_0xfe3c('0x12d')](db[_0xfe3c('0x12a')],{'as':_0xfe3c('0x1ba'),'foreignKey':_0xfe3c('0x1a5')});db[_0xfe3c('0x95')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':_0xfe3c('0x1a1')});db[_0xfe3c('0x9b')][_0xfe3c('0x11d')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xfe3c('0x1bb')},'foreignKey':'TriggerAllId','onDelete':_0xfe3c('0x117'),'hooks':!![]});db[_0xfe3c('0x9b')][_0xfe3c('0x11d')](db['Condition'],{'as':{'plural':_0xfe3c('0x1bc'),'singular':_0xfe3c('0x1bd')},'foreignKey':_0xfe3c('0x1be'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0xfe3c('0x11d')](db[_0xfe3c('0x1ad')],{'as':'Actions','foreignKey':_0xfe3c('0x1bf'),'onDelete':_0xfe3c('0x117'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xfe3c('0xa9')],{'as':_0xfe3c('0x1c0'),'onDelete':'cascade','foreignKey':_0xfe3c('0x1b6'),'hooks':!![]});db[_0xfe3c('0xa4')][_0xfe3c('0x11d')](db[_0xfe3c('0xa9')],{'as':_0xfe3c('0x1c0'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1b5')});db[_0xfe3c('0xa8')][_0xfe3c('0x11d')](db['AnalyticFieldReport'],{'as':_0xfe3c('0x1c0'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c1')});db[_0xfe3c('0xa9')][_0xfe3c('0x12d')](db[_0xfe3c('0xa8')],{'foreignKey':_0xfe3c('0x1c1')});db['SalesforceAccount'][_0xfe3c('0x11d')](db[_0xfe3c('0xae')],{'as':_0xfe3c('0x1c2'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c3')});db['SalesforceConfiguration'][_0xfe3c('0x11d')](db[_0xfe3c('0xb0')],{'as':_0xfe3c('0x1c4'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0xae')][_0xfe3c('0x11d')](db[_0xfe3c('0xb0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xae')]['hasMany'](db[_0xfe3c('0xb0')],{'as':_0xfe3c('0x1c0'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xae')][_0xfe3c('0x12d')](db[_0xfe3c('0xad')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x1c3')});db['SalesforceField'][_0xfe3c('0x11d')](db[_0xfe3c('0xb0')],{'as':_0xfe3c('0x1c8'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0xb0')][_0xfe3c('0x11d')](db[_0xfe3c('0xb0')],{'as':'Description','foreignKey':'DescriptionId'});db['SalesforceField'][_0xfe3c('0x11d')](db[_0xfe3c('0xb0')],{'as':_0xfe3c('0x1c9'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xb0')][_0xfe3c('0x12d')](db[_0xfe3c('0x1ca')],{'as':_0xfe3c('0x1ca'),'foreignKey':_0xfe3c('0x1cb')});db[_0xfe3c('0xb2')][_0xfe3c('0x11d')](db[_0xfe3c('0xb4')],{'as':_0xfe3c('0x1c2'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c3')});db['SugarcrmConfiguration'][_0xfe3c('0x11d')](db[_0xfe3c('0xb6')],{'as':'Subjects','onDelete':_0xfe3c('0x117'),'foreignKey':'SubjectId'});db[_0xfe3c('0xb4')][_0xfe3c('0x11d')](db[_0xfe3c('0xb6')],{'as':_0xfe3c('0x1cc'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xb4')][_0xfe3c('0x11d')](db[_0xfe3c('0xb6')],{'as':_0xfe3c('0x1c0'),'onDelete':_0xfe3c('0x117'),'foreignKey':'FieldId'});db[_0xfe3c('0xb4')]['belongsTo'](db[_0xfe3c('0xb2')],{'as':_0xfe3c('0x178'),'foreignKey':'AccountId'});db[_0xfe3c('0xb6')][_0xfe3c('0x11d')](db[_0xfe3c('0xb6')],{'as':_0xfe3c('0x1c8'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0xb6')][_0xfe3c('0x11d')](db[_0xfe3c('0xb6')],{'as':_0xfe3c('0x1cd'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xb6')]['hasMany'](db['SugarcrmField'],{'as':_0xfe3c('0x1c9'),'foreignKey':_0xfe3c('0x1c7')});db['SugarcrmField'][_0xfe3c('0x12d')](db['Variable'],{'as':_0xfe3c('0x1ca'),'foreignKey':_0xfe3c('0x1cb')});db[_0xfe3c('0x1ce')][_0xfe3c('0x11d')](db[_0xfe3c('0xb8')],{'as':_0xfe3c('0x1c2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xfe3c('0xb8')]['hasMany'](db[_0xfe3c('0xba')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xfe3c('0x1c5')});db['DeskConfiguration'][_0xfe3c('0x11d')](db[_0xfe3c('0xba')],{'as':_0xfe3c('0x1cc'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xb8')][_0xfe3c('0x11d')](db[_0xfe3c('0xba')],{'as':_0xfe3c('0x1c0'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xb8')]['belongsTo'](db[_0xfe3c('0x1ce')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0xb8')][_0xfe3c('0x133')](db[_0xfe3c('0x91')],{'through':'int_desk_configuration_has_tags'});db[_0xfe3c('0xba')]['hasMany'](db[_0xfe3c('0xba')],{'as':_0xfe3c('0x1c8'),'foreignKey':'SubjectId'});db['DeskField']['hasMany'](db[_0xfe3c('0xba')],{'as':_0xfe3c('0x1cd'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xba')][_0xfe3c('0x11d')](db[_0xfe3c('0xba')],{'as':_0xfe3c('0x1c9'),'foreignKey':_0xfe3c('0x1c7')});db['DeskField']['belongsTo'](db['Variable'],{'as':_0xfe3c('0x1ca'),'foreignKey':_0xfe3c('0x1cb')});db['ZohoAccount']['hasMany'](db[_0xfe3c('0x1cf')],{'as':'Configurations','onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0x1cf')][_0xfe3c('0x11d')](db[_0xfe3c('0xbf')],{'as':_0xfe3c('0x1c4'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c5')});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':'Descriptions','onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c6')});db['ZohoConfiguration'][_0xfe3c('0x11d')](db[_0xfe3c('0xbf')],{'as':'Fields','onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0x1cf')]['belongsTo'](db[_0xfe3c('0xbc')],{'as':_0xfe3c('0x178'),'foreignKey':'AccountId'});db['ZohoField'][_0xfe3c('0x11d')](db[_0xfe3c('0xbf')],{'as':_0xfe3c('0x1c8'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0xbf')][_0xfe3c('0x11d')](db[_0xfe3c('0xbf')],{'as':_0xfe3c('0x1cd'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xbf')][_0xfe3c('0x11d')](db[_0xfe3c('0xbf')],{'as':_0xfe3c('0x1c9'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xbf')]['belongsTo'](db[_0xfe3c('0x1ca')],{'as':_0xfe3c('0x1ca'),'foreignKey':_0xfe3c('0x1cb')});db[_0xfe3c('0xc1')][_0xfe3c('0x11d')](db[_0xfe3c('0xc2')],{'as':_0xfe3c('0x1c2'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0xc2')]['hasMany'](db['ZendeskField'],{'as':_0xfe3c('0x1c4'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0xc2')][_0xfe3c('0x11d')](db['ZendeskField'],{'as':_0xfe3c('0x1cc'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xc2')][_0xfe3c('0x11d')](db[_0xfe3c('0xc4')],{'as':_0xfe3c('0x1c0'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xc2')][_0xfe3c('0x12d')](db[_0xfe3c('0xc1')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x1c3')});db['ZendeskConfiguration'][_0xfe3c('0x133')](db['Tag'],{'through':_0xfe3c('0x1d0')});db[_0xfe3c('0xc4')][_0xfe3c('0x11d')](db[_0xfe3c('0xc4')],{'as':_0xfe3c('0x1c8'),'foreignKey':'SubjectId'});db[_0xfe3c('0xc4')][_0xfe3c('0x11d')](db[_0xfe3c('0xc4')],{'as':'Description','foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xc4')][_0xfe3c('0x11d')](db[_0xfe3c('0xc4')],{'as':_0xfe3c('0x1c9'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xc4')][_0xfe3c('0x12d')](db['Variable'],{'as':_0xfe3c('0x1ca'),'foreignKey':'VariableId'});db[_0xfe3c('0xc5')][_0xfe3c('0x11d')](db[_0xfe3c('0x1d1')],{'as':_0xfe3c('0x1c2'),'onDelete':'cascade','foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0x1d1')][_0xfe3c('0x11d')](db[_0xfe3c('0xc8')],{'as':_0xfe3c('0x1c4'),'onDelete':'cascade','foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0x1d1')][_0xfe3c('0x11d')](db['FreshdeskField'],{'as':_0xfe3c('0x1cc'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0x1d1')][_0xfe3c('0x11d')](db['FreshdeskField'],{'as':_0xfe3c('0x1c0'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0x1d1')][_0xfe3c('0x12d')](db[_0xfe3c('0xc5')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0x1d1')][_0xfe3c('0x133')](db['Tag'],{'through':_0xfe3c('0x1d2')});db[_0xfe3c('0xc8')]['hasMany'](db['FreshdeskField'],{'as':_0xfe3c('0x1c8'),'foreignKey':_0xfe3c('0x1c5')});db['FreshdeskField'][_0xfe3c('0x11d')](db[_0xfe3c('0xc8')],{'as':_0xfe3c('0x1cd'),'foreignKey':_0xfe3c('0x1c6')});db['FreshdeskField'][_0xfe3c('0x11d')](db[_0xfe3c('0xc8')],{'as':_0xfe3c('0x1c9'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xc8')][_0xfe3c('0x12d')](db[_0xfe3c('0x1ca')],{'as':_0xfe3c('0x1ca'),'foreignKey':_0xfe3c('0x1cb')});db[_0xfe3c('0x1d3')]['hasMany'](db[_0xfe3c('0xcb')],{'as':_0xfe3c('0x1c2'),'onDelete':'cascade','foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0xcb')][_0xfe3c('0x11d')](db[_0xfe3c('0xcd')],{'as':_0xfe3c('0x1c4'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0xcb')][_0xfe3c('0x11d')](db['VtigerField'],{'as':_0xfe3c('0x1cc'),'foreignKey':'DescriptionId'});db[_0xfe3c('0xcb')][_0xfe3c('0x11d')](db[_0xfe3c('0xcd')],{'as':'Fields','foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xcb')][_0xfe3c('0x12d')](db[_0xfe3c('0x1d3')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x1c3')});db['VtigerField'][_0xfe3c('0x11d')](db[_0xfe3c('0xcd')],{'as':_0xfe3c('0x1c8'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0xcd')]['hasMany'](db[_0xfe3c('0xcd')],{'as':_0xfe3c('0x1cd'),'foreignKey':_0xfe3c('0x1c6')});db['VtigerField'][_0xfe3c('0x11d')](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db[_0xfe3c('0xcd')][_0xfe3c('0x12d')](db[_0xfe3c('0x1ca')],{'as':_0xfe3c('0x1ca'),'foreignKey':_0xfe3c('0x1cb')});db[_0xfe3c('0xcf')][_0xfe3c('0x11d')](db[_0xfe3c('0x1d4')],{'as':'Configurations','onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0x1d4')][_0xfe3c('0x11d')](db['ServicenowField'],{'as':_0xfe3c('0x1c4'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0x1d4')][_0xfe3c('0x11d')](db[_0xfe3c('0x1d5')],{'as':_0xfe3c('0x1cc'),'foreignKey':_0xfe3c('0x1c6')});db['ServicenowConfiguration'][_0xfe3c('0x11d')](db[_0xfe3c('0x1d5')],{'as':_0xfe3c('0x1c0'),'foreignKey':_0xfe3c('0x1c7')});db['ServicenowConfiguration']['belongsTo'](db[_0xfe3c('0xcf')],{'as':_0xfe3c('0x178'),'foreignKey':'AccountId'});db[_0xfe3c('0x1d5')][_0xfe3c('0x11d')](db[_0xfe3c('0x1d5')],{'as':'Subject','foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0x1d5')]['hasMany'](db[_0xfe3c('0x1d5')],{'as':_0xfe3c('0x1cd'),'foreignKey':'DescriptionId'});db[_0xfe3c('0x1d5')]['hasMany'](db[_0xfe3c('0x1d5')],{'as':_0xfe3c('0x1c9'),'foreignKey':'FieldId'});db[_0xfe3c('0x1d5')]['belongsTo'](db[_0xfe3c('0x1ca')],{'as':_0xfe3c('0x1ca'),'foreignKey':'VariableId'});db[_0xfe3c('0x1d6')][_0xfe3c('0x11d')](db[_0xfe3c('0xd2')],{'as':_0xfe3c('0x1c2'),'onDelete':_0xfe3c('0x117'),'foreignKey':'AccountId'});db[_0xfe3c('0x1d6')][_0xfe3c('0x12d')](db[_0xfe3c('0x10c')],{'as':'CloudProvider','foreignKey':_0xfe3c('0x168')});db[_0xfe3c('0xd2')][_0xfe3c('0x11d')](db[_0xfe3c('0x1d7')],{'as':_0xfe3c('0x1c4'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0xd2')][_0xfe3c('0x11d')](db[_0xfe3c('0x1d7')],{'as':_0xfe3c('0x1cc'),'onDelete':'cascade','foreignKey':_0xfe3c('0x1c6')});db['Dynamics365Configuration'][_0xfe3c('0x11d')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xd2')]['belongsTo'](db['Dynamics365Account'],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0x1d7')][_0xfe3c('0x11d')](db[_0xfe3c('0x1d7')],{'as':_0xfe3c('0x1c8'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0x1d7')][_0xfe3c('0x11d')](db[_0xfe3c('0x1d7')],{'as':_0xfe3c('0x1cd'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0x1d7')][_0xfe3c('0x11d')](db[_0xfe3c('0x1d7')],{'as':'Field','foreignKey':_0xfe3c('0x1c7')});db['Dynamics365Field'][_0xfe3c('0x12d')](db[_0xfe3c('0x1ca')],{'as':_0xfe3c('0x1ca'),'foreignKey':_0xfe3c('0x1cb')});db[_0xfe3c('0x1d8')][_0xfe3c('0x11d')](db['FreshsalesConfiguration'],{'as':_0xfe3c('0x1c2'),'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0xd5')][_0xfe3c('0x11d')](db[_0xfe3c('0xd7')],{'as':_0xfe3c('0x1c4'),'foreignKey':_0xfe3c('0x1c5')});db[_0xfe3c('0xd5')][_0xfe3c('0x11d')](db[_0xfe3c('0xd7')],{'as':_0xfe3c('0x1cc'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xd5')][_0xfe3c('0x11d')](db[_0xfe3c('0xd7')],{'as':_0xfe3c('0x1c0'),'foreignKey':'FieldId'});db[_0xfe3c('0xd5')][_0xfe3c('0x12d')](db[_0xfe3c('0x1d8')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x1c3')});db[_0xfe3c('0xd7')]['hasMany'](db[_0xfe3c('0xd7')],{'as':_0xfe3c('0x1c8'),'foreignKey':'SubjectId'});db[_0xfe3c('0xd7')][_0xfe3c('0x11d')](db['FreshsalesField'],{'as':_0xfe3c('0x1cd'),'foreignKey':_0xfe3c('0x1c6')});db[_0xfe3c('0xd7')][_0xfe3c('0x11d')](db['FreshsalesField'],{'as':_0xfe3c('0x1c9'),'foreignKey':_0xfe3c('0x1c7')});db[_0xfe3c('0xd7')][_0xfe3c('0x12d')](db[_0xfe3c('0x1ca')],{'as':_0xfe3c('0x1ca'),'foreignKey':_0xfe3c('0x1cb')});db[_0xfe3c('0xdb')][_0xfe3c('0x12d')](db[_0xfe3c('0x64')],{});db[_0xfe3c('0xdb')]['belongsTo'](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':'ListId'});db[_0xfe3c('0xdb')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0xdb')][_0xfe3c('0x12d')](db[_0xfe3c('0x69')],{});db['ChatQueueReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x194')],{});db[_0xfe3c('0xdb')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{});db['ChatQueueReport']['belongsTo'](db[_0xfe3c('0x6d')],{});db[_0xfe3c('0x19e')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1d9')});db[_0xfe3c('0x19e')][_0xfe3c('0x12d')](db['User'],{'onDelete':_0xfe3c('0x117'),'foreignKey':_0xfe3c('0x1da')});db[_0xfe3c('0x156')][_0xfe3c('0x11d')](db[_0xfe3c('0xe0')],{'foreignKey':_0xfe3c('0x1db'),'onDelete':'cascade'});db[_0xfe3c('0x156')][_0xfe3c('0x11d')](db[_0xfe3c('0xde')],{'foreignKey':'SessionId','onDelete':_0xfe3c('0x117')});db['SmsQueueReport']['belongsTo'](db[_0xfe3c('0x58')],{});db[_0xfe3c('0x1dc')][_0xfe3c('0x12d')](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':'ListId'});db[_0xfe3c('0x1dc')]['belongsTo'](db[_0xfe3c('0x74')],{'as':'Contact','foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x1dc')][_0xfe3c('0x12d')](db['SmsInteraction'],{});db['SmsQueueReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x185')],{});db[_0xfe3c('0x1dc')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{});db[_0xfe3c('0x1dc')]['belongsTo'](db[_0xfe3c('0x5e')],{});db[_0xfe3c('0xe3')][_0xfe3c('0x11d')](db[_0xfe3c('0x156')],{'foreignKey':_0xfe3c('0x1dd')});db[_0xfe3c('0xe3')][_0xfe3c('0x11d')](db['JscriptyQuestionReport'],{'foreignKey':_0xfe3c('0x1dd')});db['JscriptyProject'][_0xfe3c('0x11d')](db[_0xfe3c('0xde')],{'foreignKey':_0xfe3c('0x1dd')});db['Team'][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x15e'),'through':_0xfe3c('0x1de')});db[_0xfe3c('0xed')][_0xfe3c('0x133')](db[_0xfe3c('0x19')],{'through':_0xfe3c('0x10e'),'as':_0xfe3c('0x13c')});db[_0xfe3c('0xed')][_0xfe3c('0x133')](db[_0xfe3c('0x40')],{'through':_0xfe3c('0x170'),'as':'MailQueues'});db[_0xfe3c('0xed')][_0xfe3c('0x133')](db[_0xfe3c('0x6d')],{'through':_0xfe3c('0x19d'),'as':_0xfe3c('0x1df')});db[_0xfe3c('0xed')][_0xfe3c('0x133')](db[_0xfe3c('0x54')],{'through':_0xfe3c('0x184'),'as':_0xfe3c('0x1e0')});db[_0xfe3c('0xed')][_0xfe3c('0x133')](db['SmsQueue'],{'through':_0xfe3c('0x18a'),'as':_0xfe3c('0x140')});db[_0xfe3c('0xed')][_0xfe3c('0x133')](db[_0xfe3c('0x63')],{'through':'team_has_openchannel_queues','as':_0xfe3c('0x142')});db['Team']['belongsToMany'](db[_0xfe3c('0x10a')],{'through':_0xfe3c('0x1e1'),'as':_0xfe3c('0x143')});db[_0xfe3c('0xed')][_0xfe3c('0x133')](db['VoicePrefix'],{'through':_0xfe3c('0x110'),'as':_0xfe3c('0x13d')});db[_0xfe3c('0xf0')]['hasMany'](db['CmHopper'],{'as':_0xfe3c('0x12b'),'foreignKey':_0xfe3c('0x1a6')});db[_0xfe3c('0xf0')]['hasMany'](db[_0xfe3c('0x79')],{'as':_0xfe3c('0x11e'),'foreignKey':_0xfe3c('0x1a6')});db[_0xfe3c('0xf0')][_0xfe3c('0x11d')](db[_0xfe3c('0x7b')],{'as':_0xfe3c('0x1e2'),'foreignKey':_0xfe3c('0x1a6')});db['Campaign'][_0xfe3c('0x11d')](db[_0xfe3c('0x77')],{'as':_0xfe3c('0x155'),'foreignKey':_0xfe3c('0x1a6')});db[_0xfe3c('0xf0')][_0xfe3c('0x12d')](db[_0xfe3c('0x2a')],{'as':_0xfe3c('0x2a'),'foreignKey':_0xfe3c('0x158')});db[_0xfe3c('0xf0')][_0xfe3c('0x12d')](db[_0xfe3c('0x2a')],{'as':'TrunkBackup','foreignKey':_0xfe3c('0x1e3')});db[_0xfe3c('0xf0')][_0xfe3c('0x12d')](db['Interval'],{'as':'Interval','foreignKey':_0xfe3c('0x17a')});db[_0xfe3c('0xf0')][_0xfe3c('0x12d')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0xfe3c('0x1e4')});db[_0xfe3c('0xf0')]['belongsToMany'](db[_0xfe3c('0x134')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xfe3c('0xf0')]['belongsToMany'](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x15f'),'through':_0xfe3c('0x1e5')});db['Attachment'][_0xfe3c('0x12d')](db[_0xfe3c('0x6b')],{'as':_0xfe3c('0x6b'),'foreignKey':_0xfe3c('0x19c')});db[_0xfe3c('0xf7')][_0xfe3c('0x12d')](db['MailMessage'],{});db[_0xfe3c('0xf7')][_0xfe3c('0x12d')](db[_0xfe3c('0x44')],{});db[_0xfe3c('0xf7')][_0xfe3c('0x12d')](db['MailAccount'],{'foreignKey':_0xfe3c('0x1e6'),'as':_0xfe3c('0x1e7')});db['MailTransferReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'foreignKey':_0xfe3c('0x1e8'),'as':_0xfe3c('0x1e9')});db[_0xfe3c('0xf7')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'foreignKey':_0xfe3c('0x1ea'),'as':_0xfe3c('0x1eb')});db[_0xfe3c('0xf7')][_0xfe3c('0x12d')](db[_0xfe3c('0x40')],{'foreignKey':_0xfe3c('0x1ec'),'as':_0xfe3c('0x1ed')});db[_0xfe3c('0xf7')][_0xfe3c('0x12d')](db['MailAccount'],{'foreignKey':_0xfe3c('0x1ee'),'as':'ToAccount'});db[_0xfe3c('0x1ef')][_0xfe3c('0x12d')](db['ChatMessage'],{});db[_0xfe3c('0x1ef')]['belongsTo'](db[_0xfe3c('0x69')],{});db[_0xfe3c('0x1ef')][_0xfe3c('0x12d')](db['ChatWebsite'],{'foreignKey':_0xfe3c('0x1f0'),'as':'FromAccount'});db[_0xfe3c('0x1ef')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'foreignKey':_0xfe3c('0x1e8'),'as':_0xfe3c('0x1e9')});db[_0xfe3c('0x1ef')]['belongsTo'](db[_0xfe3c('0x116')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xfe3c('0x1ef')][_0xfe3c('0x12d')](db[_0xfe3c('0x6d')],{'foreignKey':_0xfe3c('0x1f1'),'as':_0xfe3c('0x1ed')});db['ChatTransferReport'][_0xfe3c('0x12d')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0xfe3c('0x1f2')});db[_0xfe3c('0x1f3')]['belongsTo'](db[_0xfe3c('0x180')],{});db[_0xfe3c('0x1f3')][_0xfe3c('0x12d')](db[_0xfe3c('0x52')],{});db[_0xfe3c('0x1f3')]['belongsTo'](db[_0xfe3c('0x4e')],{'foreignKey':_0xfe3c('0x1f4'),'as':'FromAccount'});db[_0xfe3c('0x1f3')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'foreignKey':_0xfe3c('0x1e8'),'as':_0xfe3c('0x1e9')});db['FaxTransferReport'][_0xfe3c('0x12d')](db['User'],{'foreignKey':_0xfe3c('0x1ea'),'as':_0xfe3c('0x1eb')});db['FaxTransferReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x54')],{'foreignKey':_0xfe3c('0x1f5'),'as':'ToQueue'});db['FaxTransferReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x4e')],{'foreignKey':_0xfe3c('0x1f6'),'as':_0xfe3c('0x1f2')});db[_0xfe3c('0x1f7')][_0xfe3c('0x12d')](db[_0xfe3c('0x191')],{});db[_0xfe3c('0x1f7')]['belongsTo'](db[_0xfe3c('0x120')],{});db[_0xfe3c('0x1f7')][_0xfe3c('0x12d')](db[_0xfe3c('0x148')],{'foreignKey':_0xfe3c('0x1f8'),'as':_0xfe3c('0x1e7')});db[_0xfe3c('0x1f7')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'foreignKey':_0xfe3c('0x1e8'),'as':_0xfe3c('0x1e9')});db[_0xfe3c('0x1f7')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xfe3c('0x1f7')][_0xfe3c('0x12d')](db[_0xfe3c('0x63')],{'foreignKey':_0xfe3c('0x1f9'),'as':_0xfe3c('0x1ed')});db[_0xfe3c('0x1f7')][_0xfe3c('0x12d')](db[_0xfe3c('0x148')],{'foreignKey':'ToOpenchannelAccountId','as':_0xfe3c('0x1f2')});db['SmsTransferReport']['belongsTo'](db[_0xfe3c('0x185')],{});db['SmsTransferReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x123')],{});db[_0xfe3c('0xfc')][_0xfe3c('0x12d')](db[_0xfe3c('0x58')],{'foreignKey':_0xfe3c('0x1fa'),'as':'FromAccount'});db[_0xfe3c('0xfc')]['belongsTo'](db[_0xfe3c('0x116')],{'foreignKey':_0xfe3c('0x1e8'),'as':'FromAgent'});db[_0xfe3c('0xfc')]['belongsTo'](db['User'],{'foreignKey':_0xfe3c('0x1ea'),'as':_0xfe3c('0x1eb')});db[_0xfe3c('0xfc')][_0xfe3c('0x12d')](db['SmsQueue'],{'foreignKey':_0xfe3c('0x1fb'),'as':_0xfe3c('0x1ed')});db['SmsTransferReport'][_0xfe3c('0x12d')](db[_0xfe3c('0x58')],{'foreignKey':'ToSmsAccountId','as':_0xfe3c('0x1f2')});db[_0xfe3c('0x134')][_0xfe3c('0x11d')](db[_0xfe3c('0x84')],{'as':_0xfe3c('0x16b'),'foreignKey':_0xfe3c('0x16e'),'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x134')][_0xfe3c('0x11d')](db['CmCustomField'],{'as':_0xfe3c('0x1fc'),'foreignKey':'ListId'});db[_0xfe3c('0x134')][_0xfe3c('0x11d')](db['CmContact'],{'as':'Contacts','onDelete':_0xfe3c('0x117'),'foreignKey':'ListId'});db[_0xfe3c('0x134')]['hasMany'](db[_0xfe3c('0x79')],{'as':'HopperFinals','foreignKey':_0xfe3c('0x16e')});db['CmList'][_0xfe3c('0x11d')](db['CmHopperHistory'],{'as':_0xfe3c('0x11f'),'foreignKey':_0xfe3c('0x16e')});db[_0xfe3c('0x134')][_0xfe3c('0x11d')](db[_0xfe3c('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0xfe3c('0x16e')});db['CmList'][_0xfe3c('0x133')](db[_0xfe3c('0x19')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db['CmList'][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x15e'),'through':_0xfe3c('0x136')});db['VoicePrefix']['hasMany'](db[_0xfe3c('0x17')],{'as':_0xfe3c('0x1fd'),'onDelete':'cascade'});db[_0xfe3c('0x1fe')][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':'Agents','through':_0xfe3c('0x13e')});db['VoicePrefix'][_0xfe3c('0x133')](db['Team'],{'through':_0xfe3c('0x110'),'as':_0xfe3c('0x171')});db['UserProfile'][_0xfe3c('0x11d')](db['User'],{'as':'Users','foreignKey':_0xfe3c('0x12e')});db[_0xfe3c('0xff')][_0xfe3c('0x11d')](db[_0xfe3c('0x100')],{'as':_0xfe3c('0x1ff'),'foreignKey':_0xfe3c('0x12e'),'onDelete':_0xfe3c('0x117')});db[_0xfe3c('0x100')][_0xfe3c('0x11d')](db[_0xfe3c('0x200')],{'as':'Resources','foreignKey':_0xfe3c('0x201'),'onDelete':'cascade'});db['WhatsappAccount'][_0xfe3c('0x11d')](db[_0xfe3c('0x84')],{'as':_0xfe3c('0x16b'),'foreignKey':_0xfe3c('0x202'),'onDelete':_0xfe3c('0x117')});db['WhatsappAccount'][_0xfe3c('0x11d')](db[_0xfe3c('0x82')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xfe3c('0x14c')][_0xfe3c('0x11d')](db['WhatsappMessage'],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0xfe3c('0x14c')]['hasMany'](db[_0xfe3c('0x126')],{'as':_0xfe3c('0x17e')});db[_0xfe3c('0x14c')][_0xfe3c('0x11d')](db[_0xfe3c('0x104')],{'as':'Applications','foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0xfe3c('0x14c')]['belongsTo'](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':_0xfe3c('0x16e')});db['WhatsappAccount'][_0xfe3c('0x12d')](db['Pause'],{'as':_0xfe3c('0x15b'),'foreignKey':_0xfe3c('0x15c')});db[_0xfe3c('0x14c')][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':_0xfe3c('0x15e'),'through':_0xfe3c('0x14e')});db[_0xfe3c('0x104')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x104')][_0xfe3c('0x12d')](db[_0xfe3c('0x10a')],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x104')][_0xfe3c('0x12d')](db[_0xfe3c('0x14c')],{'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x104')][_0xfe3c('0x12d')](db[_0xfe3c('0x88')],{'onDelete':_0xfe3c('0x169'),'foreignKey':_0xfe3c('0x17a')});db['WhatsappApplication'][_0xfe3c('0x12d')](db[_0xfe3c('0x91')],{'onDelete':_0xfe3c('0x169'),'foreignKey':'TagId'});db[_0xfe3c('0x126')]['hasMany'](db[_0xfe3c('0x107')],{'as':_0xfe3c('0x161'),'onDelete':_0xfe3c('0x117'),'foreignKey':'WhatsappInteractionId'});db[_0xfe3c('0x126')]['belongsTo'](db[_0xfe3c('0x14c')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x202')});db[_0xfe3c('0x126')]['belongsTo'](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':'ContactId'});db[_0xfe3c('0x126')][_0xfe3c('0x12d')](db['User'],{'as':_0xfe3c('0x173'),'foreignKey':'UserId'});db[_0xfe3c('0x126')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0xfe3c('0x126')][_0xfe3c('0x133')](db[_0xfe3c('0x91')],{'through':_0xfe3c('0x1b8'),'as':_0xfe3c('0x190')});db['WhatsappInteraction'][_0xfe3c('0x133')](db['User'],{'as':_0xfe3c('0x176'),'through':'user_has_whatsapp_interactions','foreignKey':_0xfe3c('0x203')});db[_0xfe3c('0x107')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{'as':'User'});db[_0xfe3c('0x107')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'onDelete':_0xfe3c('0x117'),'as':_0xfe3c('0x165')});db['WhatsappMessage'][_0xfe3c('0x12d')](db[_0xfe3c('0x126')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xfe3c('0x203')});db[_0xfe3c('0x107')][_0xfe3c('0x12d')](db[_0xfe3c('0x14c')],{'as':_0xfe3c('0x178'),'foreignKey':_0xfe3c('0x202')});db[_0xfe3c('0x204')]['belongsTo'](db[_0xfe3c('0x14c')],{});db[_0xfe3c('0x204')][_0xfe3c('0x12d')](db[_0xfe3c('0x134')],{'as':_0xfe3c('0x16d'),'foreignKey':_0xfe3c('0x16e')});db[_0xfe3c('0x204')][_0xfe3c('0x12d')](db[_0xfe3c('0x74')],{'as':_0xfe3c('0x165'),'foreignKey':_0xfe3c('0x166')});db[_0xfe3c('0x204')][_0xfe3c('0x12d')](db[_0xfe3c('0x126')],{});db[_0xfe3c('0x204')][_0xfe3c('0x12d')](db[_0xfe3c('0x10a')],{});db[_0xfe3c('0x204')][_0xfe3c('0x12d')](db[_0xfe3c('0x107')],{});db[_0xfe3c('0x204')][_0xfe3c('0x12d')](db[_0xfe3c('0x116')],{});db[_0xfe3c('0x108')]['belongsTo'](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0xfe3c('0x12d')](db['WhatsappInteraction'],{});db[_0xfe3c('0x108')][_0xfe3c('0x12d')](db[_0xfe3c('0x14c')],{'foreignKey':_0xfe3c('0x205'),'as':_0xfe3c('0x1e7')});db['WhatsappTransferReport']['belongsTo'](db[_0xfe3c('0x14c')],{'foreignKey':'ToWhatsappAccountId','as':_0xfe3c('0x1f2')});db[_0xfe3c('0x108')][_0xfe3c('0x12d')](db[_0xfe3c('0x10a')],{'foreignKey':'ToQueueId','as':_0xfe3c('0x1ed')});db[_0xfe3c('0x108')][_0xfe3c('0x12d')](db['User'],{'foreignKey':'FromUserId','as':_0xfe3c('0x1e9')});db['WhatsappTransferReport']['belongsTo'](db[_0xfe3c('0x116')],{'foreignKey':_0xfe3c('0x1ea'),'as':_0xfe3c('0x1eb')});db[_0xfe3c('0x10a')][_0xfe3c('0x133')](db[_0xfe3c('0x116')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xfe3c('0x10a')][_0xfe3c('0x133')](db[_0xfe3c('0xed')],{'through':'team_has_whatsapp_queues','as':_0xfe3c('0x171')});db[_0xfe3c('0x113')]['belongsTo'](db['User'],{'as':'user','foreignKey':_0xfe3c('0x118'),'onDelete':_0xfe3c('0x117'),'hooks':!![]});db[_0xfe3c('0x10c')][_0xfe3c('0x119')](db[_0xfe3c('0x1d6')],{'as':'Dynamics365Account','onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x10c')][_0xfe3c('0x119')](db[_0xfe3c('0x3b')],{'as':_0xfe3c('0x206'),'onDelete':_0xfe3c('0x169')});db[_0xfe3c('0x10c')][_0xfe3c('0x119')](db[_0xfe3c('0x3c')],{'as':_0xfe3c('0x16a'),'onDelete':_0xfe3c('0x169')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x5d20=['MailQueues','ChatQueues','UserFaxQueue','SmsQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','AgentReports','CloudProviderId','restrict','MailAccountId','Imap','Smtp','Dispositions','Interactions','Template','MailQueue','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','List','ListId','ContactId','DashboardItem','Items','FaxAccountId','Answers','user_has_fax_accounts','fax_interaction_has_tags','Tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueue','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','ChatWebsite','ProactiveActions','OpenchannelQueueReport','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','CompanyId','Phones','CmContactId','JscriptySessions','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','Queue','CampaignId','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ItemTypeId','Hopper','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerId','AnalyticFieldReport','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','Variable','VariableId','SugarcrmAccount','DescriptionId','Field','ZohoAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FreshdeskField','VtigerConfiguration','FreshsalesField','FromId','ToId','SessionId','SmsQueueReport','ProjectId','VoiceQueues','FaxQueues','team_has_openchannel_queues','OpenchannelQueues','WhatsappQueues','HopperHistories','SquareProject','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Contacts','Queues','TeamVoicePrefix','userProfileId','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','exports','jstz','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../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','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','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','Pause','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../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','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','hasOne','cascade','UserId','hasMany','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotification','UserNotifications','SenderId','Hoppers','SET\x20NULL','UserProfile','belongsToMany','Groups','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','OpenchannelInteraction','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x5d20,0xcb));var _0x05d2=function(_0x55d898,_0x4ecf5e){_0x55d898=_0x55d898-0x0;var _0x41fdfb=_0x5d20[_0x55d898];return _0x41fdfb;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x05d2('0x0'));var timezone=jstz['determine']();config[_0x05d2('0x1')]=_[_0x05d2('0x2')](config[_0x05d2('0x1')],{'database':_0x05d2('0x3'),'username':_0x05d2('0x4'),'password':_0x05d2('0x5'),'options':{'host':_0x05d2('0x6'),'port':0xcea,'dialect':_0x05d2('0x7'),'dialectOptions':{'charset':_0x05d2('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x05d2('0x9'),'collate':_0x05d2('0xa')}}});config[_0x05d2('0xb')]=_['defaultsDeep'](config[_0x05d2('0xb')],{'database':_0x05d2('0x3'),'username':_0x05d2('0x4'),'password':_0x05d2('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x05d2('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x05d2('0x9'),'collate':_0x05d2('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x05d2('0xc')],config['sequelize'][_0x05d2('0xd')],config[_0x05d2('0x1')][_0x05d2('0xe')],config[_0x05d2('0x1')][_0x05d2('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x05d2('0xc')],config[_0x05d2('0xb')]['username'],config[_0x05d2('0xb')]['password'],config[_0x05d2('0xb')][_0x05d2('0xf')])};db['User']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x11'));db[_0x05d2('0x12')]=db['sequelize'][_0x05d2('0x10')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x05d2('0x13')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x14'));db[_0x05d2('0x15')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x16'));db[_0x05d2('0x17')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x18'));db[_0x05d2('0x19')]=db['sequelize']['import'](_0x05d2('0x1a'));db[_0x05d2('0x1b')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x1c'));db[_0x05d2('0x1d')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x1e'));db[_0x05d2('0x1f')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x20'));db['VoiceMailMessage']=db['sequelize']['import'](_0x05d2('0x21'));db['VoiceCallReport']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x22'));db[_0x05d2('0x23')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x24'));db[_0x05d2('0x25')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x26'));db[_0x05d2('0x27')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x05d2('0x28')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x29'));db[_0x05d2('0x2a')]=db['sequelize']['import'](_0x05d2('0x2b'));db[_0x05d2('0x2c')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x2d'));db[_0x05d2('0x2e')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x2f'));db[_0x05d2('0x30')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x31'));db[_0x05d2('0x32')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x33'));db[_0x05d2('0x34')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x35'));db['UserFaxQueue']=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/userFaxQueue/userFaxQueue.model');db[_0x05d2('0x36')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x37'));db[_0x05d2('0x38')]=db['sequelize'][_0x05d2('0x10')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x05d2('0x39')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x3a'));db[_0x05d2('0x3b')]=db['sequelize']['import'](_0x05d2('0x3c'));db[_0x05d2('0x3d')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x3e'));db[_0x05d2('0x3f')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x40'));db['MailQueue']=db['sequelize']['import']('../api/mailQueue/mailQueue.model');db[_0x05d2('0x41')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x42'));db[_0x05d2('0x43')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x44'));db[_0x05d2('0x45')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x46'));db[_0x05d2('0x47')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x48'));db[_0x05d2('0x49')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x4a'));db[_0x05d2('0x4b')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x4c'));db['DashboardItem']=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x4d'));db[_0x05d2('0x4e')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x4f'));db[_0x05d2('0x50')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x51'));db[_0x05d2('0x52')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x53'));db[_0x05d2('0x54')]=db[_0x05d2('0x1')]['import']('../api/faxMessage/faxMessage.model');db[_0x05d2('0x55')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x56'));db[_0x05d2('0x57')]=db[_0x05d2('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x05d2('0x58')]=db[_0x05d2('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x05d2('0x59')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x5a'));db[_0x05d2('0x5b')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x5c'));db[_0x05d2('0x5d')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/smsMessage/smsMessage.model');db[_0x05d2('0x5e')]=db['sequelize']['import'](_0x05d2('0x5f'));db[_0x05d2('0x60')]=db['sequelize']['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x05d2('0x61')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x62'));db['OpenchannelInteraction']=db[_0x05d2('0x1')]['import'](_0x05d2('0x63'));db[_0x05d2('0x64')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x65'));db['OpenchannelQueue']=db['sequelize'][_0x05d2('0x10')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db['sequelize']['import'](_0x05d2('0x66'));db['OpenchannelQueueReport']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x67'));db[_0x05d2('0x68')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x69'));db['ChatInteraction']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x6a'));db[_0x05d2('0x6b')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x6c'));db[_0x05d2('0x6d')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x05d2('0x6e')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x6f'));db[_0x05d2('0x70')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x71'));db[_0x05d2('0x72')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x73'));db[_0x05d2('0x74')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x75'));db[_0x05d2('0x76')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x77'));db[_0x05d2('0x78')]=db['sequelize'][_0x05d2('0x10')]('../api/cmHopper/cmHopper.model');db[_0x05d2('0x79')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x7a'));db[_0x05d2('0x7b')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x7c'));db['CmHopperHistory']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x7d'));db[_0x05d2('0x7e')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x7f'));db['CmCustomField']=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x80'));db[_0x05d2('0x81')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x82'));db[_0x05d2('0x83')]=db['sequelize']['import'](_0x05d2('0x84'));db[_0x05d2('0x85')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x86'));db[_0x05d2('0x87')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x88'));db[_0x05d2('0x89')]=db['sequelize']['import'](_0x05d2('0x8a'));db[_0x05d2('0x8b')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/interval/interval.model');db[_0x05d2('0x8c')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/pause/pause.model');db[_0x05d2('0x8d')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x8e'));db[_0x05d2('0x8f')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x90'));db[_0x05d2('0x91')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/sound/sound.model');db[_0x05d2('0x92')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/tag/tag.model');db[_0x05d2('0x93')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x94'));db[_0x05d2('0x95')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x05d2('0x96')]=db[_0x05d2('0x1')]['import'](_0x05d2('0x97'));db['Template']=db[_0x05d2('0x1')]['import'](_0x05d2('0x98'));db[_0x05d2('0x99')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/trigger/trigger.model');db['Variable']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x9a'));db['Integration']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x9b'));db[_0x05d2('0x9c')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/integrationReport/integrationReport.model');db[_0x05d2('0x9d')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x9e'));db[_0x05d2('0x9f')]=db['sequelize'][_0x05d2('0x10')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0x05d2('0x10')](_0x05d2('0xa0'));db[_0x05d2('0xa1')]=db[_0x05d2('0x1')]['import'](_0x05d2('0xa2'));db['AnalyticFieldReport']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xa3'));db['AnalyticTreeReport']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xa4'));db[_0x05d2('0xa5')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xa6'));db[_0x05d2('0xa7')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xa8'));db['SugarcrmAccount']=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x05d2('0xa9')]=db[_0x05d2('0x1')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x05d2('0xaa')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xab'));db[_0x05d2('0xac')]=db['sequelize']['import'](_0x05d2('0xad'));db[_0x05d2('0xae')]=db[_0x05d2('0x1')]['import'](_0x05d2('0xaf'));db[_0x05d2('0xb0')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xb1'));db['ZohoAccount']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xb2'));db[_0x05d2('0xb3')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x05d2('0xb4')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0xb5'));db[_0x05d2('0xb6')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xb7'));db['ZendeskField']=db[_0x05d2('0x1')]['import'](_0x05d2('0xb8'));db[_0x05d2('0xb9')]=db['sequelize'][_0x05d2('0x10')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x05d2('0xba')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xbb'));db['FreshdeskField']=db[_0x05d2('0x1')]['import'](_0x05d2('0xbc'));db[_0x05d2('0xbd')]=db[_0x05d2('0x1')]['import'](_0x05d2('0xbe'));db['VtigerConfiguration']=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x05d2('0xbf')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xc0'));db[_0x05d2('0xc1')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xc2'));db[_0x05d2('0xc3')]=db['sequelize'][_0x05d2('0x10')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x05d2('0xc4')]=db[_0x05d2('0x1')]['import'](_0x05d2('0xc5'));db[_0x05d2('0xc6')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xc7'));db[_0x05d2('0xc8')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xc9'));db[_0x05d2('0xca')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xcb'));db[_0x05d2('0xcc')]=db[_0x05d2('0x1')]['import'](_0x05d2('0xcd'));db[_0x05d2('0xce')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xcf'));db['FreshsalesField']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xd0'));db[_0x05d2('0xd1')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x9b'));db[_0x05d2('0xd2')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xd3'));db[_0x05d2('0xd4')]=db['sequelize'][_0x05d2('0x10')]('../api/chatQueueReport/chatQueueReport.model');db[_0x05d2('0xd5')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xd6'));db[_0x05d2('0xd7')]=db['sequelize']['import'](_0x05d2('0xd8'));db[_0x05d2('0xd9')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x05d2('0xda')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0xdb'));db['SmsQueueReport']=db[_0x05d2('0x1')]['import'](_0x05d2('0xdc'));db[_0x05d2('0xdd')]=db['sequelize'][_0x05d2('0x10')]('../api/squareReport/squareReport.model');db[_0x05d2('0xde')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xdf'));db[_0x05d2('0xe0')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0xe1'));db[_0x05d2('0xe2')]=db['sequelize']['import'](_0x05d2('0xe3'));db[_0x05d2('0xe4')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xe5'));db['SquareProject']=db['sequelize'][_0x05d2('0x10')](_0x05d2('0xe6'));db[_0x05d2('0xe7')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/squareRecording/squareRecording.model');db[_0x05d2('0xe8')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0xe9'));db[_0x05d2('0xea')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xeb'));db['License']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xec'));db[_0x05d2('0xed')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/campaign/campaign.model');db['Migration']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xee'));db[_0x05d2('0xef')]=db[_0x05d2('0x1')]['import'](_0x05d2('0xf0'));db[_0x05d2('0xf1')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/plugin/plugin.model');db[_0x05d2('0xf2')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/mailTransferReport/mailTransferReport.model');db[_0x05d2('0xf3')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0xf4'));db[_0x05d2('0xf5')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xf6'));db[_0x05d2('0xf7')]=db[_0x05d2('0x1')]['import'](_0x05d2('0xf8'));db[_0x05d2('0xf9')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/smsTransferReport/smsTransferReport.model');db[_0x05d2('0xfa')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0xfb'));db[_0x05d2('0xfc')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0xfd'));db['UserProfile']=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/userProfile/userProfile.model');db[_0x05d2('0xfe')]=db[_0x05d2('0x1')]['import'](_0x05d2('0xff'));db[_0x05d2('0x100')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x101'));db['UserNotification']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x102'));db[_0x05d2('0x103')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x104'));db['WhatsappApplication']=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x105'));db['WhatsappInteraction']=db[_0x05d2('0x1')]['import'](_0x05d2('0x106'));db[_0x05d2('0x107')]=db['sequelize']['import'](_0x05d2('0x108'));db[_0x05d2('0x109')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x05d2('0x10a')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x10b'));db[_0x05d2('0x10c')]=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/whatsappQueue/whatsappQueue.model');db[_0x05d2('0x10d')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x10e'));db['TeamVoiceQueue']=db[_0x05d2('0x1')][_0x05d2('0x10')]('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x10f'));db[_0x05d2('0x110')]=db['sequelize'][_0x05d2('0x10')](_0x05d2('0x111'));db[_0x05d2('0x112')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x113'));db[_0x05d2('0x114')]=db[_0x05d2('0x1')][_0x05d2('0x10')](_0x05d2('0x115'));db[_0x05d2('0x116')][_0x05d2('0x117')](db[_0x05d2('0x1f')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x05d2('0x116')][_0x05d2('0x117')](db['UserSetting'],{'as':'userSetting','onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x119')});db[_0x05d2('0x116')][_0x05d2('0x11a')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x05d2('0x119')});db['User'][_0x05d2('0x11a')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0x05d2('0x119')});db[_0x05d2('0x116')][_0x05d2('0x11a')](db[_0x05d2('0x15')],{'as':_0x05d2('0x11b'),'onDelete':_0x05d2('0x118'),'hooks':!![]});db[_0x05d2('0x116')][_0x05d2('0x11a')](db[_0x05d2('0x7b')],{'as':_0x05d2('0x11c'),'foreignKey':'UserId'});db[_0x05d2('0x116')][_0x05d2('0x11a')](db[_0x05d2('0x11d')],{'as':_0x05d2('0x11e'),'foreignKey':_0x05d2('0x119')});db[_0x05d2('0x116')][_0x05d2('0x11a')](db[_0x05d2('0x7e')],{'as':_0x05d2('0x7e'),'foreignKey':_0x05d2('0x119')});db[_0x05d2('0x116')][_0x05d2('0x11a')](db['OpenchannelInteraction'],{'as':_0x05d2('0x11f'),'foreignKey':_0x05d2('0x119')});db[_0x05d2('0x116')][_0x05d2('0x11a')](db['ChatInteraction'],{'as':_0x05d2('0x120'),'foreignKey':_0x05d2('0x119')});db[_0x05d2('0x116')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'UserId'});db['User'][_0x05d2('0x11a')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x05d2('0x119')});db['User'][_0x05d2('0x11a')](db['MailInteraction'],{'as':_0x05d2('0x121'),'foreignKey':'UserId'});db[_0x05d2('0x116')][_0x05d2('0x11a')](db[_0x05d2('0x122')],{'as':_0x05d2('0x123'),'foreignKey':_0x05d2('0x119')});db[_0x05d2('0x116')][_0x05d2('0x11a')](db[_0x05d2('0x124')],{'as':_0x05d2('0x125'),'foreignKey':_0x05d2('0x126')});db[_0x05d2('0x116')]['hasMany'](db['CmHopper'],{'as':_0x05d2('0x127'),'foreignKey':_0x05d2('0x119'),'onDelete':_0x05d2('0x128')});db[_0x05d2('0x116')]['belongsTo'](db[_0x05d2('0x129')],{'as':_0x05d2('0x129'),'foreignKey':'userProfileId'});db['User'][_0x05d2('0x12a')](db[_0x05d2('0x70')],{'as':_0x05d2('0x12b'),'through':'chat_group_has_users'});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0x76')],{'as':'Contacts','through':_0x05d2('0x12c')});db['User'][_0x05d2('0x12a')](db[_0x05d2('0xfa')],{'as':_0x05d2('0x12d'),'through':_0x05d2('0x12e')});db['User'][_0x05d2('0x12a')](db['Team'],{'through':_0x05d2('0x12f')});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0x43')],{'as':_0x05d2('0x121'),'through':_0x05d2('0x130')});db['User'][_0x05d2('0x12a')](db[_0x05d2('0x131')],{'as':_0x05d2('0x120'),'through':_0x05d2('0x132')});db[_0x05d2('0x116')]['belongsToMany'](db['FaxInteraction'],{'as':_0x05d2('0x133'),'through':_0x05d2('0x134')});db['User']['belongsToMany'](db['SmsInteraction'],{'as':_0x05d2('0x135'),'through':'user_has_sms_interactions'});db['User']['belongsToMany'](db[_0x05d2('0x136')],{'as':'OpenchannelInteractions','through':_0x05d2('0x137')});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0x122')],{'as':_0x05d2('0x123'),'through':_0x05d2('0x138')});db[_0x05d2('0x116')]['belongsToMany'](db[_0x05d2('0x19')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0xfc')],{'as':_0x05d2('0x139'),'through':'UserVoicePrefix','required':![]});db[_0x05d2('0x116')][_0x05d2('0x12a')](db['MailQueue'],{'as':_0x05d2('0x13a'),'through':'UserMailQueue','required':![]});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0x6e')],{'as':_0x05d2('0x13b'),'through':_0x05d2('0x32'),'required':![],'hooks':!![]});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0x55')],{'as':'FaxQueues','through':_0x05d2('0x13c'),'required':![]});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0x5e')],{'as':_0x05d2('0x13d'),'through':_0x05d2('0x36'),'required':![]});db['User'][_0x05d2('0x12a')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x05d2('0x38'),'required':![]});db[_0x05d2('0x116')][_0x05d2('0x12a')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0x05d2('0x39'),'required':![]});db['User']['belongsToMany'](db['CmList'],{'through':'cm_user_has_lists'});db[_0x05d2('0x116')][_0x05d2('0x12a')](db['ChatWebsite'],{'as':_0x05d2('0x13e'),'through':_0x05d2('0x13f')});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0x4e')],{'as':_0x05d2('0x140'),'through':'user_has_fax_accounts'});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0x3f')],{'as':_0x05d2('0x141'),'through':_0x05d2('0x142')});db[_0x05d2('0x116')][_0x05d2('0x12a')](db['OpenchannelAccount'],{'as':_0x05d2('0x143'),'through':_0x05d2('0x144')});db[_0x05d2('0x116')][_0x05d2('0x12a')](db[_0x05d2('0x58')],{'as':_0x05d2('0x145'),'through':'user_has_sms_accounts'});db['User'][_0x05d2('0x12a')](db[_0x05d2('0x103')],{'as':_0x05d2('0x146'),'through':_0x05d2('0x147')});db['VoiceChanSpy'][_0x05d2('0x11a')](db[_0x05d2('0x15')],{'as':_0x05d2('0x148'),'onDelete':'cascade','foreignKey':_0x05d2('0x149')});db['VoiceContext'][_0x05d2('0x11a')](db[_0x05d2('0x15')],{'onDelete':'cascade'});db['VoiceExtension'][_0x05d2('0x11a')](db[_0x05d2('0x15')],{'as':_0x05d2('0x14a'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x17')]['belongsToMany'](db['Sound'],{'as':_0x05d2('0x14b'),'through':'moh_has_sounds'});db['VoiceQueue'][_0x05d2('0x11a')](db[_0x05d2('0x2e')],{'as':_0x05d2('0x14c'),'foreignKey':_0x05d2('0x14d')});db[_0x05d2('0x19')][_0x05d2('0x11a')](db[_0x05d2('0x78')],{'as':_0x05d2('0x127'),'foreignKey':_0x05d2('0x14d')});db[_0x05d2('0x19')][_0x05d2('0x11a')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x05d2('0x14d')});db[_0x05d2('0x19')]['hasMany'](db[_0x05d2('0x11d')],{'as':'HopperHistories','foreignKey':_0x05d2('0x14d')});db[_0x05d2('0x19')][_0x05d2('0x11a')](db[_0x05d2('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x05d2('0x14d')});db['VoiceQueue'][_0x05d2('0x11a')](db[_0x05d2('0x79')],{'as':'HopperBlacks','foreignKey':_0x05d2('0x14d')});db[_0x05d2('0x19')][_0x05d2('0x11a')](db[_0x05d2('0xda')],{'as':'JscriptySessions','foreignKey':_0x05d2('0x14d')});db['VoiceQueue'][_0x05d2('0x14e')](db[_0x05d2('0x2a')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x05d2('0x19')]['belongsTo'](db[_0x05d2('0x2a')],{'as':_0x05d2('0x14f'),'foreignKey':_0x05d2('0x150')});db[_0x05d2('0x19')][_0x05d2('0x14e')](db[_0x05d2('0x8b')],{'as':'Interval','foreignKey':_0x05d2('0x151')});db['VoiceQueue'][_0x05d2('0x14e')](db[_0x05d2('0x8c')],{'as':_0x05d2('0x152'),'foreignKey':_0x05d2('0x153')});db[_0x05d2('0x19')][_0x05d2('0x12a')](db[_0x05d2('0xfa')],{'as':_0x05d2('0x12d'),'through':_0x05d2('0x154')});db[_0x05d2('0x19')]['belongsToMany'](db['User'],{'as':_0x05d2('0x155'),'through':'UserVoiceQueue'});db['VoiceQueue'][_0x05d2('0x12a')](db[_0x05d2('0xea')],{'as':_0x05d2('0x156'),'through':_0x05d2('0x157')});db[_0x05d2('0x19')][_0x05d2('0x12a')](db[_0x05d2('0xfa')],{'as':_0x05d2('0x158'),'through':_0x05d2('0x159')});db['VoiceRecording'][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'as':_0x05d2('0x116'),'foreignKey':_0x05d2('0x119')});db[_0x05d2('0x1d')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'as':_0x05d2('0x116'),'foreignKey':'UserId'});db['VoiceMail'][_0x05d2('0x11a')](db[_0x05d2('0x15a')],{'as':_0x05d2('0x15b'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x15c'),'sourceKey':_0x05d2('0x15d')});db[_0x05d2('0x15a')][_0x05d2('0x14e')](db[_0x05d2('0x1f')],{'foreignKey':_0x05d2('0x15c'),'targetKey':_0x05d2('0x15d')});db['VoiceCallReport'][_0x05d2('0x11a')](db[_0x05d2('0x27')],{'as':_0x05d2('0x15e'),'foreignKey':_0x05d2('0x15f'),'constraints':![]});db[_0x05d2('0x160')][_0x05d2('0x11a')](db[_0x05d2('0x25')],{'as':_0x05d2('0x161'),'foreignKey':_0x05d2('0x15f'),'constraints':![]});db[_0x05d2('0x160')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'as':_0x05d2('0x116'),'foreignKey':'UserId'});db[_0x05d2('0x160')]['belongsTo'](db[_0x05d2('0x76')],{'as':'Contact','foreignKey':'ContactId'});db[_0x05d2('0x3b')]['belongsTo'](db[_0x05d2('0x3f')],{'as':_0x05d2('0x3f'),'foreignKey':'MailAccountId'});db[_0x05d2('0x3b')][_0x05d2('0x14e')](db[_0x05d2('0x10d')],{'as':_0x05d2('0x10d'),'foreignKey':_0x05d2('0x162'),'onDelete':_0x05d2('0x163')});db[_0x05d2('0x3d')][_0x05d2('0x14e')](db[_0x05d2('0x3f')],{'as':_0x05d2('0x3f'),'foreignKey':_0x05d2('0x164')});db[_0x05d2('0x3d')]['belongsTo'](db['CloudProvider'],{'as':_0x05d2('0x10d'),'foreignKey':_0x05d2('0x162'),'onDelete':'restrict'});db[_0x05d2('0x3f')][_0x05d2('0x117')](db['MailServerIn'],{'as':_0x05d2('0x165'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x3f')]['hasOne'](db[_0x05d2('0x3d')],{'as':_0x05d2('0x166'),'onDelete':_0x05d2('0x118')});db['MailAccount'][_0x05d2('0x11a')](db[_0x05d2('0x87')],{'as':_0x05d2('0x167'),'foreignKey':_0x05d2('0x164'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x3f')][_0x05d2('0x11a')](db[_0x05d2('0x85')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x05d2('0x3f')][_0x05d2('0x11a')](db[_0x05d2('0x45')],{'as':_0x05d2('0x15b'),'foreignKey':'MailAccountId'});db[_0x05d2('0x3f')][_0x05d2('0x11a')](db[_0x05d2('0x43')],{'as':_0x05d2('0x168')});db[_0x05d2('0x3f')]['hasMany'](db['MailApplication'],{'as':_0x05d2('0x14a'),'foreignKey':_0x05d2('0x164'),'onDelete':'cascade'});db[_0x05d2('0x3f')][_0x05d2('0x14e')](db[_0x05d2('0xfa')],{'as':'List','foreignKey':'ListId'});db[_0x05d2('0x3f')][_0x05d2('0x14e')](db[_0x05d2('0x169')],{'as':_0x05d2('0x169'),'foreignKey':'TemplateId'});db['MailAccount'][_0x05d2('0x14e')](db[_0x05d2('0x8c')],{'as':_0x05d2('0x152'),'foreignKey':_0x05d2('0x153')});db[_0x05d2('0x3f')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':'Agents','through':_0x05d2('0x142')});db[_0x05d2('0x16a')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':_0x05d2('0x155'),'through':_0x05d2('0x34')});db[_0x05d2('0x16a')]['belongsToMany'](db[_0x05d2('0xea')],{'through':_0x05d2('0x16b'),'as':'Teams'});db[_0x05d2('0x43')][_0x05d2('0x11a')](db[_0x05d2('0x45')],{'as':_0x05d2('0x15b'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x16c')});db[_0x05d2('0x43')][_0x05d2('0x14e')](db[_0x05d2('0x3f')],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x164')});db['MailInteraction'][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'as':_0x05d2('0x16e'),'foreignKey':'ContactId'});db['MailInteraction']['belongsTo'](db[_0x05d2('0x116')],{'as':_0x05d2('0x16f'),'foreignKey':'UserId'});db[_0x05d2('0x43')][_0x05d2('0x12a')](db[_0x05d2('0x92')],{'through':'mail_interaction_has_tags','as':'Tags'});db['MailInteraction'][_0x05d2('0x12a')](db[_0x05d2('0x92')],{'through':_0x05d2('0x170'),'as':_0x05d2('0x171')});db[_0x05d2('0x43')][_0x05d2('0x12a')](db['User'],{'as':_0x05d2('0x172'),'through':_0x05d2('0x130'),'foreignKey':'MailInteractionId'});db[_0x05d2('0x45')]['hasMany'](db[_0x05d2('0xef')],{'as':'Attachments','onDelete':'cascade'});db[_0x05d2('0x45')]['belongsTo'](db['User'],{'as':_0x05d2('0x116')});db[_0x05d2('0x45')][_0x05d2('0x14e')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x05d2('0x45')][_0x05d2('0x14e')](db[_0x05d2('0x43')],{'as':_0x05d2('0x173'),'foreignKey':_0x05d2('0x16c')});db[_0x05d2('0x45')]['belongsTo'](db[_0x05d2('0x3f')],{'as':'Account','foreignKey':_0x05d2('0x164')});db[_0x05d2('0x45')][_0x05d2('0x14e')](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0x05d2('0x174')});db[_0x05d2('0x45')][_0x05d2('0x14e')](db['ChatOfflineMessage'],{'as':_0x05d2('0x6d'),'foreignKey':_0x05d2('0x175')});db[_0x05d2('0x47')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x47')][_0x05d2('0x14e')](db[_0x05d2('0x16a')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x47')][_0x05d2('0x14e')](db[_0x05d2('0x3f')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x47')]['belongsTo'](db[_0x05d2('0x8b')],{'onDelete':_0x05d2('0x163'),'foreignKey':_0x05d2('0x151')});db[_0x05d2('0x47')]['belongsTo'](db[_0x05d2('0x92')],{'onDelete':'restrict','foreignKey':_0x05d2('0x176')});db[_0x05d2('0x49')][_0x05d2('0x14e')](db[_0x05d2('0x3f')],{});db['MailQueueReport'][_0x05d2('0x14e')](db['CmList'],{'as':_0x05d2('0x177'),'foreignKey':_0x05d2('0x178')});db[_0x05d2('0x49')]['belongsTo'](db['CmContact'],{'as':_0x05d2('0x16e'),'foreignKey':_0x05d2('0x179')});db[_0x05d2('0x49')][_0x05d2('0x14e')](db[_0x05d2('0x43')],{});db['MailQueueReport']['belongsTo'](db[_0x05d2('0x45')],{});db[_0x05d2('0x49')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{});db[_0x05d2('0x49')][_0x05d2('0x14e')](db[_0x05d2('0x16a')],{});db[_0x05d2('0x4b')]['hasMany'](db[_0x05d2('0x17a')],{'as':_0x05d2('0x17b'),'onDelete':'cascade'});db[_0x05d2('0x4e')][_0x05d2('0x11a')](db[_0x05d2('0x87')],{'as':_0x05d2('0x167'),'foreignKey':_0x05d2('0x17c'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x4e')]['hasMany'](db[_0x05d2('0x85')],{'as':_0x05d2('0x17d'),'foreignKey':_0x05d2('0x17c')});db[_0x05d2('0x4e')]['hasMany'](db[_0x05d2('0x52')],{'as':'Interactions'});db[_0x05d2('0x4e')]['hasMany'](db[_0x05d2('0x50')],{'as':_0x05d2('0x14a'),'foreignKey':_0x05d2('0x17c'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x4e')]['hasMany'](db[_0x05d2('0x15')],{'as':'Exntensions','onDelete':_0x05d2('0x118')});db['FaxAccount'][_0x05d2('0x11a')](db[_0x05d2('0x54')],{'as':'Messages'});db[_0x05d2('0x4e')][_0x05d2('0x14e')](db[_0x05d2('0x2a')],{'as':_0x05d2('0x2a')});db[_0x05d2('0x4e')][_0x05d2('0x14e')](db[_0x05d2('0xfa')],{'as':_0x05d2('0x177'),'foreignKey':_0x05d2('0x178')});db['FaxAccount']['belongsTo'](db[_0x05d2('0x8c')],{'as':_0x05d2('0x152'),'foreignKey':_0x05d2('0x153')});db[_0x05d2('0x4e')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':'Agents','through':_0x05d2('0x17e')});db[_0x05d2('0x50')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x50')][_0x05d2('0x14e')](db[_0x05d2('0x55')],{'onDelete':_0x05d2('0x163')});db['FaxApplication'][_0x05d2('0x14e')](db[_0x05d2('0x4e')],{'onDelete':'restrict'});db['FaxApplication'][_0x05d2('0x14e')](db[_0x05d2('0x92')],{'onDelete':_0x05d2('0x163'),'foreignKey':_0x05d2('0x176')});db[_0x05d2('0x52')][_0x05d2('0x11a')](db[_0x05d2('0x54')],{'as':_0x05d2('0x15b'),'onDelete':_0x05d2('0x118'),'foreignKey':'FaxInteractionId'});db[_0x05d2('0x52')][_0x05d2('0x14e')](db[_0x05d2('0x4e')],{'as':_0x05d2('0x16d'),'foreignKey':'FaxAccountId'});db[_0x05d2('0x52')]['belongsTo'](db[_0x05d2('0x76')],{'as':_0x05d2('0x16e'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x05d2('0x14e')](db['User'],{'as':'Owner','foreignKey':_0x05d2('0x119')});db[_0x05d2('0x52')][_0x05d2('0x12a')](db[_0x05d2('0x92')],{'through':_0x05d2('0x17f'),'as':_0x05d2('0x180')});db[_0x05d2('0x52')][_0x05d2('0x12a')](db[_0x05d2('0x92')],{'through':_0x05d2('0x17f'),'as':_0x05d2('0x171')});db[_0x05d2('0x52')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':_0x05d2('0x172'),'through':_0x05d2('0x134'),'foreignKey':_0x05d2('0x181')});db[_0x05d2('0x54')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'onDelete':_0x05d2('0x118'),'as':_0x05d2('0x116')});db[_0x05d2('0x54')]['belongsTo'](db[_0x05d2('0x52')],{'as':_0x05d2('0x173'),'foreignKey':_0x05d2('0x181')});db[_0x05d2('0x54')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'onDelete':_0x05d2('0x118'),'as':_0x05d2('0x16e')});db[_0x05d2('0x54')][_0x05d2('0x14e')](db['Attachment'],{'as':_0x05d2('0xef'),'foreignKey':_0x05d2('0x182')});db['FaxMessage'][_0x05d2('0x14e')](db['FaxAccount'],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x17c')});db['FaxQueue'][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':_0x05d2('0x155'),'through':_0x05d2('0x13c')});db[_0x05d2('0x55')]['belongsToMany'](db['Team'],{'through':_0x05d2('0x183'),'as':_0x05d2('0x156')});db[_0x05d2('0x57')][_0x05d2('0x14e')](db[_0x05d2('0x4e')],{});db[_0x05d2('0x57')][_0x05d2('0x14e')](db[_0x05d2('0xfa')],{'as':'List','foreignKey':_0x05d2('0x178')});db[_0x05d2('0x57')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'as':_0x05d2('0x16e'),'foreignKey':_0x05d2('0x179')});db[_0x05d2('0x57')][_0x05d2('0x14e')](db['FaxInteraction'],{});db[_0x05d2('0x57')][_0x05d2('0x14e')](db[_0x05d2('0x54')],{});db[_0x05d2('0x57')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{});db[_0x05d2('0x57')][_0x05d2('0x14e')](db[_0x05d2('0x55')],{});db[_0x05d2('0x58')]['hasMany'](db[_0x05d2('0x87')],{'as':_0x05d2('0x167'),'foreignKey':_0x05d2('0x184'),'onDelete':'cascade'});db[_0x05d2('0x58')][_0x05d2('0x11a')](db['CannedAnswer'],{'as':_0x05d2('0x17d'),'foreignKey':'SmsAccountId'});db[_0x05d2('0x58')]['hasMany'](db[_0x05d2('0x5d')],{'as':_0x05d2('0x15b'),'foreignKey':_0x05d2('0x184')});db[_0x05d2('0x58')][_0x05d2('0x11a')](db[_0x05d2('0x5b')],{'as':_0x05d2('0x168')});db[_0x05d2('0x58')]['hasMany'](db[_0x05d2('0x59')],{'as':_0x05d2('0x14a'),'foreignKey':_0x05d2('0x184'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x58')]['belongsTo'](db[_0x05d2('0xfa')],{'as':_0x05d2('0x177'),'foreignKey':_0x05d2('0x178')});db[_0x05d2('0x58')]['belongsTo'](db[_0x05d2('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x05d2('0x153')});db['SmsAccount']['belongsToMany'](db['User'],{'as':'Agents','through':_0x05d2('0x185')});db[_0x05d2('0x59')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x59')]['belongsTo'](db[_0x05d2('0x5e')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x59')][_0x05d2('0x14e')](db[_0x05d2('0x58')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x59')]['belongsTo'](db[_0x05d2('0x8b')],{'onDelete':_0x05d2('0x163'),'foreignKey':_0x05d2('0x151')});db[_0x05d2('0x59')][_0x05d2('0x14e')](db[_0x05d2('0x92')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x05d2('0x5b')][_0x05d2('0x11a')](db[_0x05d2('0x5d')],{'as':_0x05d2('0x15b'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x186')});db[_0x05d2('0x5b')][_0x05d2('0x14e')](db[_0x05d2('0x58')],{'as':'Account','foreignKey':_0x05d2('0x184')});db[_0x05d2('0x5b')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'as':'Contact','foreignKey':_0x05d2('0x179')});db['SmsInteraction'][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'as':_0x05d2('0x16f'),'foreignKey':_0x05d2('0x119')});db['SmsInteraction']['belongsToMany'](db[_0x05d2('0x92')],{'through':_0x05d2('0x187'),'as':_0x05d2('0x180')});db[_0x05d2('0x5b')][_0x05d2('0x12a')](db['Tag'],{'through':_0x05d2('0x187'),'as':_0x05d2('0x171')});db[_0x05d2('0x5b')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':_0x05d2('0x172'),'through':_0x05d2('0x188'),'foreignKey':'SmsInteractionId'});db[_0x05d2('0x5d')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'as':_0x05d2('0x116')});db[_0x05d2('0x5d')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'onDelete':_0x05d2('0x118'),'as':'Contact'});db[_0x05d2('0x5d')]['belongsTo'](db[_0x05d2('0x5b')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x05d2('0x186')});db[_0x05d2('0x5d')][_0x05d2('0x14e')](db[_0x05d2('0x58')],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x184')});db[_0x05d2('0x5e')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':'Agents','through':_0x05d2('0x36'),'foreignKey':_0x05d2('0x189')});db['SmsQueue'][_0x05d2('0x12a')](db[_0x05d2('0xea')],{'through':_0x05d2('0x18a'),'as':_0x05d2('0x156')});db[_0x05d2('0x60')][_0x05d2('0x11a')](db[_0x05d2('0x87')],{'as':_0x05d2('0x167'),'foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0x05d2('0x60')][_0x05d2('0x11a')](db['CannedAnswer'],{'as':_0x05d2('0x17d'),'foreignKey':_0x05d2('0x18b')});db[_0x05d2('0x60')][_0x05d2('0x11a')](db[_0x05d2('0x136')],{'as':_0x05d2('0x168'),'foreignKey':_0x05d2('0x18b')});db[_0x05d2('0x60')][_0x05d2('0x11a')](db['OpenchannelMessage'],{'as':_0x05d2('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0x05d2('0x60')]['hasMany'](db[_0x05d2('0x61')],{'as':_0x05d2('0x14a'),'foreignKey':'OpenchannelAccountId','onDelete':_0x05d2('0x118')});db['OpenchannelAccount'][_0x05d2('0x14e')](db[_0x05d2('0xfa')],{'as':_0x05d2('0x177'),'foreignKey':_0x05d2('0x178')});db[_0x05d2('0x60')]['belongsTo'](db['Pause'],{'as':_0x05d2('0x152'),'foreignKey':_0x05d2('0x153')});db[_0x05d2('0x60')][_0x05d2('0x12a')](db['User'],{'as':_0x05d2('0x155'),'through':_0x05d2('0x144')});db['OpenchannelApplication'][_0x05d2('0x14e')](db['User'],{'onDelete':'restrict'});db[_0x05d2('0x61')][_0x05d2('0x14e')](db[_0x05d2('0x18c')],{'onDelete':_0x05d2('0x163'),'foreignKey':'OpenchannelQueueId'});db[_0x05d2('0x61')][_0x05d2('0x14e')](db['OpenchannelAccount'],{'onDelete':_0x05d2('0x163'),'foreignKey':_0x05d2('0x18b')});db[_0x05d2('0x61')]['belongsTo'](db[_0x05d2('0x8b')],{'onDelete':_0x05d2('0x163'),'foreignKey':_0x05d2('0x151')});db[_0x05d2('0x61')]['belongsTo'](db[_0x05d2('0x92')],{'onDelete':_0x05d2('0x163'),'foreignKey':'TagId'});db[_0x05d2('0x136')][_0x05d2('0x11a')](db[_0x05d2('0x64')],{'as':'Messages','onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x18d')});db[_0x05d2('0x136')][_0x05d2('0x14e')](db[_0x05d2('0x60')],{'as':_0x05d2('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0x05d2('0x136')][_0x05d2('0x14e')](db['CmContact'],{'as':'Contact','foreignKey':_0x05d2('0x179')});db[_0x05d2('0x136')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'as':'Owner','foreignKey':_0x05d2('0x119')});db[_0x05d2('0x136')][_0x05d2('0x12a')](db[_0x05d2('0x92')],{'through':_0x05d2('0x18e'),'as':_0x05d2('0x180')});db[_0x05d2('0x136')]['belongsToMany'](db[_0x05d2('0x92')],{'through':_0x05d2('0x18e'),'as':_0x05d2('0x171')});db['OpenchannelInteraction'][_0x05d2('0x12a')](db['User'],{'as':_0x05d2('0x172'),'through':_0x05d2('0x137'),'foreignKey':_0x05d2('0x18d')});db[_0x05d2('0x64')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'onDelete':_0x05d2('0x118'),'as':_0x05d2('0x116')});db[_0x05d2('0x64')]['belongsTo'](db['CmContact'],{'onDelete':_0x05d2('0x118'),'as':_0x05d2('0x16e')});db[_0x05d2('0x64')][_0x05d2('0x14e')](db[_0x05d2('0x136')],{'onDelete':_0x05d2('0x118'),'as':_0x05d2('0x173'),'foreignKey':_0x05d2('0x18d')});db[_0x05d2('0x64')][_0x05d2('0x14e')](db[_0x05d2('0xef')],{'as':_0x05d2('0xef'),'foreignKey':_0x05d2('0x182')});db[_0x05d2('0x64')][_0x05d2('0x14e')](db[_0x05d2('0x60')],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x18b')});db[_0x05d2('0x18c')][_0x05d2('0x12a')](db['User'],{'as':_0x05d2('0x155'),'through':_0x05d2('0x38'),'foreignKey':_0x05d2('0x18f')});db['OpenchannelQueue'][_0x05d2('0x12a')](db[_0x05d2('0xea')],{'through':'team_has_openchannel_queues','as':_0x05d2('0x156')});db[_0x05d2('0x190')]['hasMany'](db[_0x05d2('0x87')],{'as':'Dispositions','foreignKey':_0x05d2('0x174'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x190')][_0x05d2('0x11a')](db[_0x05d2('0x85')],{'as':_0x05d2('0x17d'),'foreignKey':_0x05d2('0x174')});db[_0x05d2('0x190')][_0x05d2('0x11a')](db['ChatProactiveAction'],{'as':_0x05d2('0x191')});db[_0x05d2('0x190')][_0x05d2('0x11a')](db[_0x05d2('0x131')],{'as':'Interactions'});db[_0x05d2('0x190')][_0x05d2('0x11a')](db[_0x05d2('0x68')],{'as':_0x05d2('0x14a'),'foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x05d2('0x190')][_0x05d2('0x11a')](db[_0x05d2('0x6b')],{'as':_0x05d2('0x15b')});db['ChatWebsite'][_0x05d2('0x14e')](db[_0x05d2('0xfa')],{'as':_0x05d2('0x177'),'foreignKey':_0x05d2('0x178')});db['ChatWebsite'][_0x05d2('0x14e')](db['Interval'],{'as':'Interval','foreignKey':_0x05d2('0x151')});db[_0x05d2('0x190')]['belongsTo'](db[_0x05d2('0x3f')],{'as':'MailAccount','foreignKey':_0x05d2('0x164')});db[_0x05d2('0x190')]['belongsTo'](db['Pause'],{'as':_0x05d2('0x152'),'foreignKey':_0x05d2('0x153')});db[_0x05d2('0x190')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':_0x05d2('0x155'),'through':_0x05d2('0x13f')});db[_0x05d2('0x192')][_0x05d2('0x14e')](db[_0x05d2('0x60')],{});db[_0x05d2('0x192')][_0x05d2('0x14e')](db[_0x05d2('0xfa')],{'as':_0x05d2('0x177'),'foreignKey':_0x05d2('0x178')});db[_0x05d2('0x192')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'as':_0x05d2('0x16e'),'foreignKey':_0x05d2('0x179')});db[_0x05d2('0x192')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x05d2('0x192')][_0x05d2('0x14e')](db[_0x05d2('0x64')],{});db['OpenchannelQueueReport'][_0x05d2('0x14e')](db['User'],{});db[_0x05d2('0x192')][_0x05d2('0x14e')](db[_0x05d2('0x18c')],{});db[_0x05d2('0x68')]['belongsTo'](db[_0x05d2('0x116')],{'as':'Agent','foreignKey':_0x05d2('0x119'),'onDelete':_0x05d2('0x163')});db[_0x05d2('0x68')][_0x05d2('0x14e')](db[_0x05d2('0x6e')],{'as':'Queue','foreignKey':_0x05d2('0x193'),'onDelete':_0x05d2('0x163')});db['ChatApplication']['belongsTo'](db[_0x05d2('0x190')],{'as':_0x05d2('0x194'),'foreignKey':_0x05d2('0x174'),'onDelete':'restrict'});db[_0x05d2('0x68')][_0x05d2('0x14e')](db['Tag'],{'onDelete':_0x05d2('0x163'),'foreignKey':_0x05d2('0x176')});db['ChatInteraction'][_0x05d2('0x11a')](db[_0x05d2('0x6b')],{'as':_0x05d2('0x15b'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x195')});db[_0x05d2('0x131')]['belongsTo'](db[_0x05d2('0x190')],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x174')});db['ChatInteraction']['belongsTo'](db[_0x05d2('0x76')],{'as':'Contact','foreignKey':_0x05d2('0x179')});db['ChatInteraction']['belongsTo'](db[_0x05d2('0x116')],{'as':'Owner','foreignKey':'UserId'});db[_0x05d2('0x131')][_0x05d2('0x12a')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x05d2('0x180')});db[_0x05d2('0x131')]['belongsToMany'](db['Tag'],{'through':_0x05d2('0x196'),'as':'ThroughTags'});db[_0x05d2('0x131')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':'Users','through':_0x05d2('0x132'),'foreignKey':_0x05d2('0x195')});db[_0x05d2('0x6b')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'onDelete':_0x05d2('0x118'),'as':'User'});db[_0x05d2('0x6b')][_0x05d2('0x14e')](db['CmContact'],{'onDelete':_0x05d2('0x118'),'as':'Contact','foreignKey':_0x05d2('0x179')});db['ChatMessage'][_0x05d2('0x14e')](db[_0x05d2('0x131')],{'onDelete':_0x05d2('0x118'),'as':_0x05d2('0x173'),'foreignKey':_0x05d2('0x195')});db[_0x05d2('0x6b')]['belongsTo'](db['Attachment'],{'as':_0x05d2('0xef'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x05d2('0x14e')](db[_0x05d2('0x190')],{'as':_0x05d2('0x16d'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x05d2('0x11a')](db[_0x05d2('0xef')],{'as':_0x05d2('0x197'),'foreignKey':_0x05d2('0x175'),'onDelete':_0x05d2('0x118'),'hooks':!![]});db[_0x05d2('0x6d')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'onDelete':_0x05d2('0x118'),'as':_0x05d2('0x16e'),'foreignKey':_0x05d2('0x179')});db[_0x05d2('0x6d')]['belongsTo'](db['ChatWebsite'],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x174')});db[_0x05d2('0x6e')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':_0x05d2('0x155'),'through':_0x05d2('0x32'),'hooks':!![]});db[_0x05d2('0x6e')]['belongsToMany'](db[_0x05d2('0xea')],{'through':_0x05d2('0x198'),'as':'Teams'});db[_0x05d2('0x70')][_0x05d2('0x11a')](db[_0x05d2('0xd5')],{'as':_0x05d2('0x15b'),'foreignKey':_0x05d2('0x199'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x70')]['belongsToMany'](db[_0x05d2('0x116')],{'as':_0x05d2('0x14c'),'through':'chat_group_has_users'});db[_0x05d2('0x72')]['belongsTo'](db[_0x05d2('0x190')],{'as':'Website','foreignKey':_0x05d2('0x174')});db[_0x05d2('0x74')][_0x05d2('0x11a')](db['CmContact'],{'as':'Contacts','foreignKey':_0x05d2('0x19a')});db[_0x05d2('0x76')][_0x05d2('0x11a')](db[_0x05d2('0x95')],{'as':_0x05d2('0x19b'),'foreignKey':_0x05d2('0x19c')});db['CmContact']['hasMany'](db[_0x05d2('0x78')],{'as':_0x05d2('0x127'),'foreignKey':_0x05d2('0x179')});db['CmContact'][_0x05d2('0x11a')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x05d2('0x179')});db['CmContact'][_0x05d2('0x11a')](db[_0x05d2('0x11d')],{'as':'HopperHistories','foreignKey':_0x05d2('0x179')});db[_0x05d2('0x76')][_0x05d2('0x11a')](db[_0x05d2('0x7e')],{'as':_0x05d2('0x7e'),'foreignKey':_0x05d2('0x179')});db[_0x05d2('0x76')][_0x05d2('0x11a')](db['JscriptySessionReport'],{'as':_0x05d2('0x19d'),'foreignKey':_0x05d2('0x179')});db[_0x05d2('0x76')][_0x05d2('0x11a')](db['OpenchannelInteraction'],{'as':_0x05d2('0x11f'),'foreignKey':'ContactId','onDelete':_0x05d2('0x163')});db['CmContact'][_0x05d2('0x11a')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0x05d2('0x179'),'onDelete':_0x05d2('0x163')});db[_0x05d2('0x76')][_0x05d2('0x11a')](db['SmsInteraction'],{'as':_0x05d2('0x135'),'foreignKey':_0x05d2('0x179'),'onDelete':_0x05d2('0x163')});db[_0x05d2('0x76')][_0x05d2('0x11a')](db[_0x05d2('0x52')],{'as':'FaxInteractions','foreignKey':_0x05d2('0x179'),'onDelete':_0x05d2('0x163')});db['CmContact'][_0x05d2('0x11a')](db[_0x05d2('0x43')],{'as':_0x05d2('0x121'),'foreignKey':_0x05d2('0x179'),'onDelete':_0x05d2('0x163')});db['CmContact'][_0x05d2('0x14e')](db[_0x05d2('0x74')],{'as':_0x05d2('0x19e'),'foreignKey':'CompanyId'});db[_0x05d2('0x76')][_0x05d2('0x14e')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0x05d2('0x118')});db[_0x05d2('0x76')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':_0x05d2('0x172'),'through':_0x05d2('0x12c')});db['CmContact'][_0x05d2('0x12a')](db[_0x05d2('0x92')],{'as':_0x05d2('0x180'),'through':_0x05d2('0x19f')});db[_0x05d2('0x76')][_0x05d2('0x12a')](db[_0x05d2('0x92')],{'through':'cm_contact_has_tags','as':_0x05d2('0x171')});db[_0x05d2('0x78')]['hasMany'](db[_0x05d2('0x96')],{'as':_0x05d2('0x1a0'),'foreignKey':_0x05d2('0x1a1')});db[_0x05d2('0x78')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x05d2('0x78')][_0x05d2('0x14e')](db[_0x05d2('0xfa')],{'as':_0x05d2('0x177'),'foreignKey':_0x05d2('0x178'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x78')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'as':_0x05d2('0x1a2'),'foreignKey':_0x05d2('0x119')});db[_0x05d2('0x78')][_0x05d2('0x14e')](db['VoiceQueue'],{'as':_0x05d2('0x1a3'),'foreignKey':_0x05d2('0x14d'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x78')]['belongsTo'](db[_0x05d2('0xed')],{'as':_0x05d2('0xed'),'foreignKey':_0x05d2('0x1a4'),'onDelete':'cascade'});db[_0x05d2('0x78')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'as':_0x05d2('0x16f'),'foreignKey':_0x05d2('0x1a5')});db[_0x05d2('0x79')][_0x05d2('0x14e')](db['CmContact'],{'as':'Contact','foreignKey':_0x05d2('0x179'),'onDelete':'cascade'});db[_0x05d2('0x79')][_0x05d2('0x14e')](db['CmList'],{'as':'List','foreignKey':_0x05d2('0x178'),'onDelete':_0x05d2('0x118')});db['CmHopperBlack'][_0x05d2('0x14e')](db[_0x05d2('0x19')],{'as':'Queue','foreignKey':_0x05d2('0x14d'),'onDelete':'cascade'});db[_0x05d2('0x79')][_0x05d2('0x14e')](db['Campaign'],{'as':_0x05d2('0xed'),'foreignKey':_0x05d2('0x1a4'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x83')]['hasMany'](db[_0x05d2('0x89')],{'as':{'plural':_0x05d2('0x1a6'),'singular':_0x05d2('0x1a7')},'foreignKey':'AutomationAllId','onDelete':_0x05d2('0x118'),'hooks':!![]});db[_0x05d2('0x83')][_0x05d2('0x11a')](db[_0x05d2('0x89')],{'as':{'plural':_0x05d2('0x1a8'),'singular':_0x05d2('0x1a9')},'foreignKey':_0x05d2('0x1aa'),'onDelete':_0x05d2('0x118'),'hooks':!![]});db[_0x05d2('0x83')][_0x05d2('0x11a')](db['Action'],{'as':_0x05d2('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x05d2('0x87')][_0x05d2('0x11a')](db[_0x05d2('0x87')],{'as':'Dispositions','foreignKey':_0x05d2('0x1ac'),'onDelete':_0x05d2('0x118')});db['Interval'][_0x05d2('0x11a')](db['Interval'],{'as':_0x05d2('0x1ad'),'foreignKey':'IntervalId','onDelete':_0x05d2('0x118'),'hooks':!![],'required':![]});db[_0x05d2('0x8b')][_0x05d2('0x11a')](db[_0x05d2('0x15')],{'as':'Extensions','foreignKey':_0x05d2('0x151'),'onDelete':'restrict'});db[_0x05d2('0x8b')][_0x05d2('0x11a')](db[_0x05d2('0x47')],{'as':_0x05d2('0x1ae'),'foreignKey':_0x05d2('0x151')});db[_0x05d2('0x8b')][_0x05d2('0x11a')](db[_0x05d2('0x68')],{'as':_0x05d2('0x1af'),'foreignKey':_0x05d2('0x151')});db[_0x05d2('0x8b')]['hasMany'](db[_0x05d2('0x50')],{'as':_0x05d2('0x1b0'),'foreignKey':_0x05d2('0x151')});db['Interval']['hasMany'](db[_0x05d2('0x59')],{'as':'SmsApplications','foreignKey':_0x05d2('0x151')});db[_0x05d2('0x8f')]['belongsTo'](db[_0x05d2('0x3f')],{});db[_0x05d2('0x8f')][_0x05d2('0x14e')](db[_0x05d2('0x9f')],{'foreignKey':_0x05d2('0x1b1')});db[_0x05d2('0x8f')]['belongsTo'](db[_0x05d2('0x9d')],{'foreignKey':_0x05d2('0x1b2')});db['Sound'][_0x05d2('0x12a')](db[_0x05d2('0x17')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0x05d2('0x163')});db[_0x05d2('0x92')]['belongsToMany'](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x05d2('0x92')]['belongsToMany'](db[_0x05d2('0x131')],{'through':_0x05d2('0x196')});db[_0x05d2('0x92')][_0x05d2('0x12a')](db[_0x05d2('0x43')],{'through':_0x05d2('0x170')});db[_0x05d2('0x92')][_0x05d2('0x12a')](db[_0x05d2('0x5b')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x05d2('0x12a')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x05d2('0x92')]['belongsToMany'](db[_0x05d2('0x136')],{'through':_0x05d2('0x18e')});db[_0x05d2('0x92')][_0x05d2('0x12a')](db[_0x05d2('0x122')],{'through':_0x05d2('0x1b3')});db['CmContactHasItem'][_0x05d2('0x14e')](db[_0x05d2('0x93')],{'as':'ItemType','foreignKey':_0x05d2('0x1b4')});db[_0x05d2('0x96')][_0x05d2('0x14e')](db[_0x05d2('0x78')],{'as':_0x05d2('0x1b5'),'foreignKey':'CmHopperId'});db[_0x05d2('0x95')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'as':_0x05d2('0x16e'),'foreignKey':'CmContactId'});db[_0x05d2('0x99')][_0x05d2('0x11a')](db['Condition'],{'as':{'plural':_0x05d2('0x1b6'),'singular':'AllCondition'},'foreignKey':_0x05d2('0x1b7'),'onDelete':_0x05d2('0x118'),'hooks':!![]});db[_0x05d2('0x99')][_0x05d2('0x11a')](db[_0x05d2('0x89')],{'as':{'plural':_0x05d2('0x1b8'),'singular':_0x05d2('0x1b9')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0x05d2('0x99')][_0x05d2('0x11a')](db[_0x05d2('0x81')],{'as':'Actions','foreignKey':_0x05d2('0x1ba'),'onDelete':_0x05d2('0x118'),'hooks':!![]});db[_0x05d2('0x9d')][_0x05d2('0x11a')](db[_0x05d2('0x1bb')],{'as':_0x05d2('0x1bc'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x05d2('0x9f')][_0x05d2('0x11a')](db[_0x05d2('0x1bb')],{'as':_0x05d2('0x1bc'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1b1')});db['AnalyticMetric'][_0x05d2('0x11a')](db[_0x05d2('0x1bb')],{'as':_0x05d2('0x1bc'),'onDelete':'cascade','foreignKey':'MetricId'});db[_0x05d2('0x1bb')][_0x05d2('0x14e')](db[_0x05d2('0xa1')],{'foreignKey':_0x05d2('0x1bd')});db[_0x05d2('0xa5')][_0x05d2('0x11a')](db[_0x05d2('0x1be')],{'as':_0x05d2('0x1bf'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0x1be')][_0x05d2('0x11a')](db['SalesforceField'],{'as':_0x05d2('0x1c1'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0x1be')]['hasMany'](db['SalesforceField'],{'as':_0x05d2('0x1c3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x05d2('0x1be')][_0x05d2('0x11a')](db[_0x05d2('0xa7')],{'as':_0x05d2('0x1bc'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c4')});db[_0x05d2('0x1be')]['belongsTo'](db[_0x05d2('0xa5')],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0xa7')][_0x05d2('0x11a')](db['SalesforceField'],{'as':_0x05d2('0x1c5'),'foreignKey':'SubjectId'});db[_0x05d2('0xa7')]['hasMany'](db[_0x05d2('0xa7')],{'as':_0x05d2('0x1c6'),'foreignKey':'DescriptionId'});db[_0x05d2('0xa7')][_0x05d2('0x11a')](db[_0x05d2('0xa7')],{'as':'Field','foreignKey':'FieldId'});db[_0x05d2('0xa7')][_0x05d2('0x14e')](db[_0x05d2('0x1c7')],{'as':_0x05d2('0x1c7'),'foreignKey':_0x05d2('0x1c8')});db[_0x05d2('0x1c9')][_0x05d2('0x11a')](db[_0x05d2('0xa9')],{'as':_0x05d2('0x1bf'),'onDelete':'cascade','foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0xa9')][_0x05d2('0x11a')](db[_0x05d2('0xaa')],{'as':_0x05d2('0x1c1'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0xa9')]['hasMany'](db[_0x05d2('0xaa')],{'as':_0x05d2('0x1c3'),'onDelete':'cascade','foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0xa9')][_0x05d2('0x11a')](db[_0x05d2('0xaa')],{'as':_0x05d2('0x1bc'),'onDelete':'cascade','foreignKey':_0x05d2('0x1c4')});db[_0x05d2('0xa9')][_0x05d2('0x14e')](db['SugarcrmAccount'],{'as':_0x05d2('0x16d'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x05d2('0x11a')](db['SugarcrmField'],{'as':_0x05d2('0x1c5'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0xaa')][_0x05d2('0x11a')](db[_0x05d2('0xaa')],{'as':'Description','foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0xaa')][_0x05d2('0x11a')](db['SugarcrmField'],{'as':_0x05d2('0x1cb'),'foreignKey':'FieldId'});db[_0x05d2('0xaa')]['belongsTo'](db[_0x05d2('0x1c7')],{'as':'Variable','foreignKey':'VariableId'});db[_0x05d2('0xac')]['hasMany'](db[_0x05d2('0xae')],{'as':'Configurations','onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0xae')]['hasMany'](db['DeskField'],{'as':'Subjects','onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c2')});db['DeskConfiguration'][_0x05d2('0x11a')](db['DeskField'],{'as':_0x05d2('0x1c3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x05d2('0xae')][_0x05d2('0x11a')](db['DeskField'],{'as':'Fields','onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c4')});db[_0x05d2('0xae')][_0x05d2('0x14e')](db[_0x05d2('0xac')],{'as':'Account','foreignKey':_0x05d2('0x1c0')});db['DeskConfiguration']['belongsToMany'](db[_0x05d2('0x92')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x05d2('0x11a')](db[_0x05d2('0xb0')],{'as':_0x05d2('0x1c5'),'foreignKey':'SubjectId'});db[_0x05d2('0xb0')][_0x05d2('0x11a')](db[_0x05d2('0xb0')],{'as':'Description','foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0xb0')][_0x05d2('0x11a')](db[_0x05d2('0xb0')],{'as':_0x05d2('0x1cb'),'foreignKey':_0x05d2('0x1c4')});db[_0x05d2('0xb0')][_0x05d2('0x14e')](db[_0x05d2('0x1c7')],{'as':_0x05d2('0x1c7'),'foreignKey':'VariableId'});db['ZohoAccount']['hasMany'](db[_0x05d2('0xb3')],{'as':'Configurations','onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0xb3')]['hasMany'](db[_0x05d2('0xb4')],{'as':'Subjects','onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0xb3')]['hasMany'](db[_0x05d2('0xb4')],{'as':_0x05d2('0x1c3'),'onDelete':'cascade','foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0xb3')][_0x05d2('0x11a')](db[_0x05d2('0xb4')],{'as':_0x05d2('0x1bc'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c4')});db['ZohoConfiguration'][_0x05d2('0x14e')](db[_0x05d2('0x1cc')],{'as':'Account','foreignKey':'AccountId'});db[_0x05d2('0xb4')]['hasMany'](db['ZohoField'],{'as':_0x05d2('0x1c5'),'foreignKey':_0x05d2('0x1c2')});db['ZohoField'][_0x05d2('0x11a')](db[_0x05d2('0xb4')],{'as':_0x05d2('0x1c6'),'foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0xb4')][_0x05d2('0x11a')](db[_0x05d2('0xb4')],{'as':'Field','foreignKey':'FieldId'});db[_0x05d2('0xb4')][_0x05d2('0x14e')](db['Variable'],{'as':_0x05d2('0x1c7'),'foreignKey':_0x05d2('0x1c8')});db[_0x05d2('0xb6')][_0x05d2('0x11a')](db[_0x05d2('0x1cd')],{'as':_0x05d2('0x1bf'),'onDelete':_0x05d2('0x118'),'foreignKey':'AccountId'});db[_0x05d2('0x1cd')][_0x05d2('0x11a')](db[_0x05d2('0x1ce')],{'as':_0x05d2('0x1c1'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0x1cd')]['hasMany'](db['ZendeskField'],{'as':_0x05d2('0x1c3'),'foreignKey':_0x05d2('0x1ca')});db['ZendeskConfiguration']['hasMany'](db[_0x05d2('0x1ce')],{'as':_0x05d2('0x1bc'),'foreignKey':'FieldId'});db[_0x05d2('0x1cd')]['belongsTo'](db['ZendeskAccount'],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x1c0')});db['ZendeskConfiguration'][_0x05d2('0x12a')](db[_0x05d2('0x92')],{'through':_0x05d2('0x1cf')});db['ZendeskField'][_0x05d2('0x11a')](db[_0x05d2('0x1ce')],{'as':_0x05d2('0x1c5'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0x1ce')]['hasMany'](db['ZendeskField'],{'as':_0x05d2('0x1c6'),'foreignKey':'DescriptionId'});db[_0x05d2('0x1ce')][_0x05d2('0x11a')](db[_0x05d2('0x1ce')],{'as':_0x05d2('0x1cb'),'foreignKey':'FieldId'});db['ZendeskField']['belongsTo'](db[_0x05d2('0x1c7')],{'as':_0x05d2('0x1c7'),'foreignKey':_0x05d2('0x1c8')});db[_0x05d2('0xb9')]['hasMany'](db[_0x05d2('0xba')],{'as':_0x05d2('0x1bf'),'onDelete':'cascade','foreignKey':_0x05d2('0x1c0')});db['FreshdeskConfiguration'][_0x05d2('0x11a')](db['FreshdeskField'],{'as':_0x05d2('0x1c1'),'onDelete':_0x05d2('0x118'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x05d2('0x11a')](db['FreshdeskField'],{'as':_0x05d2('0x1c3'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0xba')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x05d2('0x14e')](db[_0x05d2('0xb9')],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0xba')]['belongsToMany'](db[_0x05d2('0x92')],{'through':_0x05d2('0x1d0')});db[_0x05d2('0x1d1')][_0x05d2('0x11a')](db[_0x05d2('0x1d1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x05d2('0x1d1')]['hasMany'](db[_0x05d2('0x1d1')],{'as':_0x05d2('0x1c6'),'foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0x1d1')][_0x05d2('0x11a')](db[_0x05d2('0x1d1')],{'as':'Field','foreignKey':_0x05d2('0x1c4')});db[_0x05d2('0x1d1')][_0x05d2('0x14e')](db['Variable'],{'as':_0x05d2('0x1c7'),'foreignKey':_0x05d2('0x1c8')});db[_0x05d2('0xbd')]['hasMany'](db[_0x05d2('0x1d2')],{'as':_0x05d2('0x1bf'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0x1d2')][_0x05d2('0x11a')](db[_0x05d2('0xbf')],{'as':_0x05d2('0x1c1'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0x1d2')][_0x05d2('0x11a')](db[_0x05d2('0xbf')],{'as':_0x05d2('0x1c3'),'foreignKey':_0x05d2('0x1ca')});db['VtigerConfiguration']['hasMany'](db[_0x05d2('0xbf')],{'as':_0x05d2('0x1bc'),'foreignKey':_0x05d2('0x1c4')});db['VtigerConfiguration'][_0x05d2('0x14e')](db[_0x05d2('0xbd')],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0xbf')][_0x05d2('0x11a')](db['VtigerField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x05d2('0xbf')]['hasMany'](db[_0x05d2('0xbf')],{'as':_0x05d2('0x1c6'),'foreignKey':_0x05d2('0x1ca')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Field','foreignKey':_0x05d2('0x1c4')});db['VtigerField']['belongsTo'](db['Variable'],{'as':_0x05d2('0x1c7'),'foreignKey':_0x05d2('0x1c8')});db[_0x05d2('0xc1')]['hasMany'](db['ServicenowConfiguration'],{'as':_0x05d2('0x1bf'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0xc3')][_0x05d2('0x11a')](db[_0x05d2('0xc4')],{'as':_0x05d2('0x1c1'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0xc3')]['hasMany'](db[_0x05d2('0xc4')],{'as':_0x05d2('0x1c3'),'foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0xc3')][_0x05d2('0x11a')](db[_0x05d2('0xc4')],{'as':_0x05d2('0x1bc'),'foreignKey':_0x05d2('0x1c4')});db['ServicenowConfiguration'][_0x05d2('0x14e')](db[_0x05d2('0xc1')],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x1c0')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x05d2('0x1c5'),'foreignKey':_0x05d2('0x1c2')});db['ServicenowField'][_0x05d2('0x11a')](db[_0x05d2('0xc4')],{'as':'Description','foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0xc4')][_0x05d2('0x11a')](db[_0x05d2('0xc4')],{'as':'Field','foreignKey':_0x05d2('0x1c4')});db[_0x05d2('0xc4')][_0x05d2('0x14e')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x05d2('0xc6')][_0x05d2('0x11a')](db[_0x05d2('0xc8')],{'as':_0x05d2('0x1bf'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0xc6')][_0x05d2('0x14e')](db[_0x05d2('0x10d')],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db['Dynamics365Configuration'][_0x05d2('0x11a')](db[_0x05d2('0xca')],{'as':_0x05d2('0x1c1'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0xc8')][_0x05d2('0x11a')](db[_0x05d2('0xca')],{'as':_0x05d2('0x1c3'),'onDelete':'cascade','foreignKey':_0x05d2('0x1ca')});db['Dynamics365Configuration'][_0x05d2('0x11a')](db[_0x05d2('0xca')],{'as':_0x05d2('0x1bc'),'onDelete':'cascade','foreignKey':_0x05d2('0x1c4')});db['Dynamics365Configuration'][_0x05d2('0x14e')](db[_0x05d2('0xc6')],{'as':_0x05d2('0x16d'),'foreignKey':'AccountId'});db[_0x05d2('0xca')][_0x05d2('0x11a')](db['Dynamics365Field'],{'as':_0x05d2('0x1c5'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0xca')][_0x05d2('0x11a')](db[_0x05d2('0xca')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x05d2('0xca')][_0x05d2('0x11a')](db['Dynamics365Field'],{'as':_0x05d2('0x1cb'),'foreignKey':_0x05d2('0x1c4')});db[_0x05d2('0xca')][_0x05d2('0x14e')](db[_0x05d2('0x1c7')],{'as':_0x05d2('0x1c7'),'foreignKey':_0x05d2('0x1c8')});db[_0x05d2('0xcc')]['hasMany'](db[_0x05d2('0xce')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x05d2('0x1c0')});db['FreshsalesConfiguration'][_0x05d2('0x11a')](db[_0x05d2('0x1d3')],{'as':_0x05d2('0x1c1'),'foreignKey':_0x05d2('0x1c2')});db[_0x05d2('0xce')]['hasMany'](db[_0x05d2('0x1d3')],{'as':_0x05d2('0x1c3'),'foreignKey':_0x05d2('0x1ca')});db['FreshsalesConfiguration'][_0x05d2('0x11a')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x05d2('0x1c4')});db[_0x05d2('0xce')][_0x05d2('0x14e')](db[_0x05d2('0xcc')],{'as':'Account','foreignKey':_0x05d2('0x1c0')});db[_0x05d2('0x1d3')]['hasMany'](db[_0x05d2('0x1d3')],{'as':'Subject','foreignKey':_0x05d2('0x1c2')});db['FreshsalesField'][_0x05d2('0x11a')](db[_0x05d2('0x1d3')],{'as':'Description','foreignKey':_0x05d2('0x1ca')});db[_0x05d2('0x1d3')][_0x05d2('0x11a')](db[_0x05d2('0x1d3')],{'as':_0x05d2('0x1cb'),'foreignKey':'FieldId'});db['FreshsalesField'][_0x05d2('0x14e')](db[_0x05d2('0x1c7')],{'as':_0x05d2('0x1c7'),'foreignKey':_0x05d2('0x1c8')});db[_0x05d2('0xd4')][_0x05d2('0x14e')](db[_0x05d2('0x190')],{});db[_0x05d2('0xd4')][_0x05d2('0x14e')](db[_0x05d2('0xfa')],{'as':_0x05d2('0x177'),'foreignKey':_0x05d2('0x178')});db['ChatQueueReport']['belongsTo'](db[_0x05d2('0x76')],{'as':_0x05d2('0x16e'),'foreignKey':_0x05d2('0x179')});db[_0x05d2('0xd4')][_0x05d2('0x14e')](db[_0x05d2('0x131')],{});db[_0x05d2('0xd4')][_0x05d2('0x14e')](db[_0x05d2('0x6b')],{});db[_0x05d2('0xd4')][_0x05d2('0x14e')](db['User'],{});db['ChatQueueReport'][_0x05d2('0x14e')](db[_0x05d2('0x6e')],{});db[_0x05d2('0xd5')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'onDelete':'cascade','foreignKey':_0x05d2('0x1d4')});db['ChatInternalMessage'][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x1d5')});db[_0x05d2('0xda')]['hasMany'](db[_0x05d2('0xd9')],{'foreignKey':_0x05d2('0x1d6'),'onDelete':_0x05d2('0x118')});db['JscriptySessionReport'][_0x05d2('0x11a')](db[_0x05d2('0xd7')],{'foreignKey':_0x05d2('0x1d6'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x1d7')][_0x05d2('0x14e')](db[_0x05d2('0x58')],{});db['SmsQueueReport'][_0x05d2('0x14e')](db[_0x05d2('0xfa')],{'as':'List','foreignKey':_0x05d2('0x178')});db[_0x05d2('0x1d7')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'as':_0x05d2('0x16e'),'foreignKey':_0x05d2('0x179')});db[_0x05d2('0x1d7')][_0x05d2('0x14e')](db['SmsInteraction'],{});db[_0x05d2('0x1d7')][_0x05d2('0x14e')](db[_0x05d2('0x5d')],{});db[_0x05d2('0x1d7')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{});db[_0x05d2('0x1d7')][_0x05d2('0x14e')](db[_0x05d2('0x5e')],{});db[_0x05d2('0xe0')][_0x05d2('0x11a')](db[_0x05d2('0xda')],{'foreignKey':_0x05d2('0x1d8')});db[_0x05d2('0xe0')][_0x05d2('0x11a')](db[_0x05d2('0xd9')],{'foreignKey':_0x05d2('0x1d8')});db['JscriptyProject'][_0x05d2('0x11a')](db[_0x05d2('0xd7')],{'foreignKey':_0x05d2('0x1d8')});db[_0x05d2('0xea')][_0x05d2('0x12a')](db['User'],{'as':_0x05d2('0x155'),'through':_0x05d2('0x12f')});db[_0x05d2('0xea')][_0x05d2('0x12a')](db[_0x05d2('0x19')],{'through':'TeamVoiceQueue','as':_0x05d2('0x1d9')});db['Team'][_0x05d2('0x12a')](db[_0x05d2('0x16a')],{'through':_0x05d2('0x16b'),'as':'MailQueues'});db['Team']['belongsToMany'](db[_0x05d2('0x6e')],{'through':_0x05d2('0x198'),'as':'ChatQueues'});db[_0x05d2('0xea')]['belongsToMany'](db[_0x05d2('0x55')],{'through':'team_has_fax_queues','as':_0x05d2('0x1da')});db[_0x05d2('0xea')]['belongsToMany'](db[_0x05d2('0x5e')],{'through':_0x05d2('0x18a'),'as':'SmsQueues'});db[_0x05d2('0xea')][_0x05d2('0x12a')](db['OpenchannelQueue'],{'through':_0x05d2('0x1db'),'as':_0x05d2('0x1dc')});db[_0x05d2('0xea')]['belongsToMany'](db[_0x05d2('0x10c')],{'through':'team_has_whatsapp_queues','as':_0x05d2('0x1dd')});db[_0x05d2('0xea')]['belongsToMany'](db[_0x05d2('0xfc')],{'through':'TeamVoicePrefix','as':_0x05d2('0x139')});db['Campaign'][_0x05d2('0x11a')](db[_0x05d2('0x78')],{'as':_0x05d2('0x127'),'foreignKey':_0x05d2('0x1a4')});db[_0x05d2('0xed')][_0x05d2('0x11a')](db['CmHopperFinal'],{'as':_0x05d2('0x11c'),'foreignKey':_0x05d2('0x1a4')});db['Campaign'][_0x05d2('0x11a')](db[_0x05d2('0x11d')],{'as':_0x05d2('0x1de'),'foreignKey':'CampaignId'});db['Campaign'][_0x05d2('0x11a')](db[_0x05d2('0x79')],{'as':'HopperBlacks','foreignKey':_0x05d2('0x1a4')});db[_0x05d2('0xed')][_0x05d2('0x14e')](db[_0x05d2('0x2a')],{'as':_0x05d2('0x2a'),'foreignKey':'TrunkId'});db[_0x05d2('0xed')][_0x05d2('0x14e')](db[_0x05d2('0x2a')],{'as':'TrunkBackup','foreignKey':_0x05d2('0x150')});db['Campaign'][_0x05d2('0x14e')](db[_0x05d2('0x8b')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x05d2('0xed')][_0x05d2('0x14e')](db['SquareProject'],{'as':_0x05d2('0x1df'),'foreignKey':'SquareProjectId'});db[_0x05d2('0xed')]['belongsToMany'](db[_0x05d2('0xfa')],{'as':'Lists','through':_0x05d2('0x1e0')});db[_0x05d2('0xed')]['belongsToMany'](db['CmList'],{'as':_0x05d2('0x158'),'through':_0x05d2('0x1e1')});db[_0x05d2('0xef')]['belongsTo'](db[_0x05d2('0x6d')],{'as':'ChatOfflineMessage','foreignKey':_0x05d2('0x175')});db[_0x05d2('0xf2')][_0x05d2('0x14e')](db[_0x05d2('0x45')],{});db[_0x05d2('0xf2')][_0x05d2('0x14e')](db[_0x05d2('0x43')],{});db[_0x05d2('0xf2')]['belongsTo'](db[_0x05d2('0x3f')],{'foreignKey':_0x05d2('0x1e2'),'as':'FromAccount'});db[_0x05d2('0xf2')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'foreignKey':'FromUserId','as':_0x05d2('0x1e3')});db['MailTransferReport'][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'foreignKey':_0x05d2('0x1e4'),'as':_0x05d2('0x1e5')});db['MailTransferReport'][_0x05d2('0x14e')](db[_0x05d2('0x16a')],{'foreignKey':_0x05d2('0x1e6'),'as':_0x05d2('0x1e7')});db[_0x05d2('0xf2')][_0x05d2('0x14e')](db['MailAccount'],{'foreignKey':_0x05d2('0x1e8'),'as':_0x05d2('0x1e9')});db[_0x05d2('0xf3')]['belongsTo'](db[_0x05d2('0x6b')],{});db[_0x05d2('0xf3')]['belongsTo'](db['ChatInteraction'],{});db['ChatTransferReport']['belongsTo'](db[_0x05d2('0x190')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x05d2('0xf3')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'foreignKey':_0x05d2('0x1ea'),'as':_0x05d2('0x1e3')});db[_0x05d2('0xf3')][_0x05d2('0x14e')](db['User'],{'foreignKey':_0x05d2('0x1e4'),'as':_0x05d2('0x1e5')});db[_0x05d2('0xf3')][_0x05d2('0x14e')](db[_0x05d2('0x6e')],{'foreignKey':_0x05d2('0x1eb'),'as':_0x05d2('0x1e7')});db['ChatTransferReport'][_0x05d2('0x14e')](db[_0x05d2('0x190')],{'foreignKey':_0x05d2('0x1ec'),'as':_0x05d2('0x1e9')});db[_0x05d2('0xf5')]['belongsTo'](db[_0x05d2('0x54')],{});db[_0x05d2('0xf5')]['belongsTo'](db[_0x05d2('0x52')],{});db[_0x05d2('0xf5')][_0x05d2('0x14e')](db[_0x05d2('0x4e')],{'foreignKey':_0x05d2('0x1ed'),'as':_0x05d2('0x1ee')});db[_0x05d2('0xf5')][_0x05d2('0x14e')](db['User'],{'foreignKey':_0x05d2('0x1ea'),'as':_0x05d2('0x1e3')});db[_0x05d2('0xf5')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'foreignKey':_0x05d2('0x1e4'),'as':_0x05d2('0x1e5')});db['FaxTransferReport'][_0x05d2('0x14e')](db[_0x05d2('0x55')],{'foreignKey':_0x05d2('0x1ef'),'as':_0x05d2('0x1e7')});db['FaxTransferReport'][_0x05d2('0x14e')](db['FaxAccount'],{'foreignKey':_0x05d2('0x1f0'),'as':'ToAccount'});db[_0x05d2('0xf7')][_0x05d2('0x14e')](db[_0x05d2('0x64')],{});db[_0x05d2('0xf7')][_0x05d2('0x14e')](db[_0x05d2('0x136')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x05d2('0x60')],{'foreignKey':_0x05d2('0x1f1'),'as':_0x05d2('0x1ee')});db['OpenchannelTransferReport'][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'foreignKey':_0x05d2('0x1ea'),'as':_0x05d2('0x1e3')});db[_0x05d2('0xf7')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'foreignKey':_0x05d2('0x1e4'),'as':'ToAgent'});db[_0x05d2('0xf7')][_0x05d2('0x14e')](db[_0x05d2('0x18c')],{'foreignKey':_0x05d2('0x1f2'),'as':_0x05d2('0x1e7')});db[_0x05d2('0xf7')]['belongsTo'](db[_0x05d2('0x60')],{'foreignKey':_0x05d2('0x1f3'),'as':_0x05d2('0x1e9')});db[_0x05d2('0xf9')][_0x05d2('0x14e')](db[_0x05d2('0x5d')],{});db[_0x05d2('0xf9')][_0x05d2('0x14e')](db[_0x05d2('0x5b')],{});db[_0x05d2('0xf9')][_0x05d2('0x14e')](db[_0x05d2('0x58')],{'foreignKey':_0x05d2('0x1f4'),'as':_0x05d2('0x1ee')});db[_0x05d2('0xf9')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'foreignKey':_0x05d2('0x1ea'),'as':'FromAgent'});db[_0x05d2('0xf9')]['belongsTo'](db[_0x05d2('0x116')],{'foreignKey':_0x05d2('0x1e4'),'as':_0x05d2('0x1e5')});db['SmsTransferReport'][_0x05d2('0x14e')](db[_0x05d2('0x5e')],{'foreignKey':_0x05d2('0x1f5'),'as':_0x05d2('0x1e7')});db[_0x05d2('0xf9')]['belongsTo'](db[_0x05d2('0x58')],{'foreignKey':_0x05d2('0x1f6'),'as':'ToAccount'});db[_0x05d2('0xfa')][_0x05d2('0x11a')](db['Disposition'],{'as':_0x05d2('0x167'),'foreignKey':_0x05d2('0x178'),'onDelete':_0x05d2('0x118')});db['CmList']['hasMany'](db[_0x05d2('0x1f7')],{'as':_0x05d2('0x1f8'),'foreignKey':'ListId'});db[_0x05d2('0xfa')][_0x05d2('0x11a')](db[_0x05d2('0x76')],{'as':_0x05d2('0x1f9'),'onDelete':_0x05d2('0x118'),'foreignKey':_0x05d2('0x178')});db[_0x05d2('0xfa')][_0x05d2('0x11a')](db[_0x05d2('0x7b')],{'as':'HopperFinals','foreignKey':_0x05d2('0x178')});db['CmList'][_0x05d2('0x11a')](db['CmHopperHistory'],{'as':_0x05d2('0x11e'),'foreignKey':_0x05d2('0x178')});db[_0x05d2('0xfa')][_0x05d2('0x11a')](db[_0x05d2('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x05d2('0x178')});db[_0x05d2('0xfa')][_0x05d2('0x12a')](db[_0x05d2('0x19')],{'as':_0x05d2('0x1fa'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x05d2('0x12a')](db['User'],{'as':_0x05d2('0x155'),'through':_0x05d2('0x12e')});db[_0x05d2('0xfc')][_0x05d2('0x11a')](db[_0x05d2('0x15')],{'as':'Extensions','onDelete':_0x05d2('0x118')});db[_0x05d2('0xfc')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':'Agents','through':_0x05d2('0x110')});db['VoicePrefix'][_0x05d2('0x12a')](db['Team'],{'through':_0x05d2('0x1fb'),'as':_0x05d2('0x156')});db[_0x05d2('0x129')][_0x05d2('0x11a')](db[_0x05d2('0x116')],{'as':'Users','foreignKey':_0x05d2('0x1fc')});db[_0x05d2('0x129')][_0x05d2('0x11a')](db[_0x05d2('0xfe')],{'as':'UserProfileSections','foreignKey':_0x05d2('0x1fc'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0xfe')][_0x05d2('0x11a')](db[_0x05d2('0x100')],{'as':_0x05d2('0x1fd'),'foreignKey':_0x05d2('0x1fe'),'onDelete':_0x05d2('0x118')});db['WhatsappAccount']['hasMany'](db[_0x05d2('0x87')],{'as':_0x05d2('0x167'),'foreignKey':_0x05d2('0x1ff'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x103')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x05d2('0x1ff')});db[_0x05d2('0x103')]['hasMany'](db[_0x05d2('0x107')],{'as':_0x05d2('0x15b'),'foreignKey':_0x05d2('0x1ff')});db['WhatsappAccount'][_0x05d2('0x11a')](db[_0x05d2('0x122')],{'as':_0x05d2('0x168')});db[_0x05d2('0x103')][_0x05d2('0x11a')](db[_0x05d2('0x200')],{'as':_0x05d2('0x14a'),'foreignKey':_0x05d2('0x1ff'),'onDelete':_0x05d2('0x118')});db[_0x05d2('0x103')]['belongsTo'](db[_0x05d2('0xfa')],{'as':_0x05d2('0x177'),'foreignKey':'ListId'});db[_0x05d2('0x103')][_0x05d2('0x14e')](db[_0x05d2('0x8c')],{'as':_0x05d2('0x152'),'foreignKey':_0x05d2('0x153')});db[_0x05d2('0x103')][_0x05d2('0x12a')](db[_0x05d2('0x116')],{'as':_0x05d2('0x155'),'through':_0x05d2('0x147')});db['WhatsappApplication'][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x200')]['belongsTo'](db[_0x05d2('0x10c')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x200')][_0x05d2('0x14e')](db[_0x05d2('0x103')],{'onDelete':_0x05d2('0x163')});db[_0x05d2('0x200')][_0x05d2('0x14e')](db[_0x05d2('0x8b')],{'onDelete':'restrict','foreignKey':_0x05d2('0x151')});db[_0x05d2('0x200')][_0x05d2('0x14e')](db[_0x05d2('0x92')],{'onDelete':_0x05d2('0x163'),'foreignKey':_0x05d2('0x176')});db[_0x05d2('0x122')][_0x05d2('0x11a')](db['WhatsappMessage'],{'as':_0x05d2('0x15b'),'onDelete':'cascade','foreignKey':_0x05d2('0x201')});db['WhatsappInteraction'][_0x05d2('0x14e')](db[_0x05d2('0x103')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x05d2('0x122')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'as':_0x05d2('0x16e'),'foreignKey':'ContactId'});db[_0x05d2('0x122')]['belongsTo'](db[_0x05d2('0x116')],{'as':'Owner','foreignKey':'UserId'});db[_0x05d2('0x122')]['belongsToMany'](db[_0x05d2('0x92')],{'through':'whatsapp_interaction_has_tags','as':_0x05d2('0x180')});db[_0x05d2('0x122')][_0x05d2('0x12a')](db[_0x05d2('0x92')],{'through':_0x05d2('0x1b3'),'as':_0x05d2('0x171')});db['WhatsappInteraction'][_0x05d2('0x12a')](db['User'],{'as':_0x05d2('0x172'),'through':'user_has_whatsapp_interactions','foreignKey':_0x05d2('0x201')});db[_0x05d2('0x107')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{'as':_0x05d2('0x116')});db[_0x05d2('0x107')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'onDelete':_0x05d2('0x118'),'as':_0x05d2('0x16e')});db['WhatsappMessage'][_0x05d2('0x14e')](db['WhatsappInteraction'],{'onDelete':_0x05d2('0x118'),'as':_0x05d2('0x173'),'foreignKey':'WhatsappInteractionId'});db[_0x05d2('0x107')][_0x05d2('0x14e')](db[_0x05d2('0x103')],{'as':_0x05d2('0x16d'),'foreignKey':_0x05d2('0x1ff')});db[_0x05d2('0x109')][_0x05d2('0x14e')](db[_0x05d2('0x103')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x05d2('0xfa')],{'as':'List','foreignKey':_0x05d2('0x178')});db[_0x05d2('0x109')][_0x05d2('0x14e')](db[_0x05d2('0x76')],{'as':_0x05d2('0x16e'),'foreignKey':_0x05d2('0x179')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x05d2('0x109')][_0x05d2('0x14e')](db[_0x05d2('0x10c')],{});db['WhatsappQueueReport'][_0x05d2('0x14e')](db[_0x05d2('0x107')],{});db[_0x05d2('0x109')][_0x05d2('0x14e')](db[_0x05d2('0x116')],{});db[_0x05d2('0x10a')]['belongsTo'](db[_0x05d2('0x107')],{});db[_0x05d2('0x10a')]['belongsTo'](db[_0x05d2('0x122')],{});db['WhatsappTransferReport'][_0x05d2('0x14e')](db[_0x05d2('0x103')],{'foreignKey':_0x05d2('0x202'),'as':'FromAccount'});db[_0x05d2('0x10a')]['belongsTo'](db[_0x05d2('0x103')],{'foreignKey':'ToWhatsappAccountId','as':_0x05d2('0x1e9')});db[_0x05d2('0x10a')][_0x05d2('0x14e')](db[_0x05d2('0x10c')],{'foreignKey':_0x05d2('0x203'),'as':'ToQueue'});db[_0x05d2('0x10a')]['belongsTo'](db[_0x05d2('0x116')],{'foreignKey':'FromUserId','as':_0x05d2('0x1e3')});db[_0x05d2('0x10a')][_0x05d2('0x14e')](db['User'],{'foreignKey':_0x05d2('0x1e4'),'as':_0x05d2('0x1e5')});db[_0x05d2('0x10c')][_0x05d2('0x12a')](db['User'],{'as':_0x05d2('0x155'),'through':_0x05d2('0x39'),'foreignKey':'WhatsappQueueId'});db[_0x05d2('0x10c')]['belongsToMany'](db[_0x05d2('0xea')],{'through':'team_has_whatsapp_queues','as':_0x05d2('0x156')});db[_0x05d2('0x112')][_0x05d2('0x14e')](db['User'],{'as':'user','foreignKey':_0x05d2('0x119'),'onDelete':_0x05d2('0x118'),'hooks':!![]});db[_0x05d2('0x10d')]['hasOne'](db[_0x05d2('0xc6')],{'as':_0x05d2('0xc6'),'onDelete':_0x05d2('0x163')});db[_0x05d2('0x10d')][_0x05d2('0x117')](db[_0x05d2('0x3b')],{'as':_0x05d2('0x165'),'onDelete':_0x05d2('0x163')});db['CloudProvider'][_0x05d2('0x117')](db['MailServerOut'],{'as':_0x05d2('0x166'),'onDelete':_0x05d2('0x163')});module[_0x05d2('0x204')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 848b384..aaca591 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a3c=['/api/pm2','./api/pm2','/api/webbar','./api/webbar','static','root','/apidoc','/www','join','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','get','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./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/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system'];(function(_0x4bb167,_0x3dbed8){var _0xac58f2=function(_0x885639){while(--_0x885639){_0x4bb167['push'](_0x4bb167['shift']());}};_0xac58f2(++_0x3dbed8);}(_0x9a3c,0x12c));var _0xc9a3=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x9a3c[_0x43d11d];return _0x38cd08;};'use strict';var path=require(_0xc9a3('0x0'));var express=require(_0xc9a3('0x1'));var errors=require(_0xc9a3('0x2'));var config=require(_0xc9a3('0x3'));var setupLoggers=require(_0xc9a3('0x4'))[_0xc9a3('0x5')];var clientSideLogs=require('./api/client-side-logs');exports[_0xc9a3('0x6')]=function(_0x5141f9){return setupLoggers(_0x5141f9)[_0xc9a3('0x7')](function(){_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x9'),require(_0xc9a3('0xa')));_0x5141f9[_0xc9a3('0x8')]('/api/voice/chanspy',require(_0xc9a3('0xb')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xc'),require(_0xc9a3('0xd')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xe'),require('./api/voiceExtension'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xf'),require(_0xc9a3('0x10')));_0x5141f9['use'](_0xc9a3('0x11'),require(_0xc9a3('0x12')));_0x5141f9['use'](_0xc9a3('0x13'),require(_0xc9a3('0x14')));_0x5141f9[_0xc9a3('0x8')]('/api/screen/recordings',require(_0xc9a3('0x15')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x16'),require('./api/voiceMail'));_0x5141f9['use'](_0xc9a3('0x17'),require('./api/voiceMailMessage'));_0x5141f9[_0xc9a3('0x8')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x18'),require(_0xc9a3('0x19')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x1a'),require(_0xc9a3('0x1b')));_0x5141f9[_0xc9a3('0x8')]('/api/voice/queues/reports',require(_0xc9a3('0x1c')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x1d'),require(_0xc9a3('0x1e')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x1f'),require('./api/trunk'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x20'),require(_0xc9a3('0x21')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x22'),require(_0xc9a3('0x23')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x24'),require(_0xc9a3('0x25')));_0x5141f9[_0xc9a3('0x8')]('/api/mail/queues',require('./api/mailQueue'));_0x5141f9['use']('/api/mail/substatuses',require(_0xc9a3('0x26')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x27'),require(_0xc9a3('0x28')));_0x5141f9[_0xc9a3('0x8')]('/api/mail/messages',require(_0xc9a3('0x29')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x2a'),require('./api/mailApplication'));_0x5141f9['use'](_0xc9a3('0x2b'),require(_0xc9a3('0x2c')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x2d'),require('./api/dashboard'));_0x5141f9['use']('/api/dashboards/items',require('./api/dashboardItem'));_0x5141f9['use'](_0xc9a3('0x2e'),require(_0xc9a3('0x2f')));_0x5141f9[_0xc9a3('0x8')]('/api/fax/applications',require(_0xc9a3('0x30')));_0x5141f9['use'](_0xc9a3('0x31'),require(_0xc9a3('0x32')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x33'),require(_0xc9a3('0x34')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x35'),require(_0xc9a3('0x36')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x37'),require('./api/faxQueueReport'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x38'),require('./api/smsAccount'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x39'),require(_0xc9a3('0x3a')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x3b'),require(_0xc9a3('0x3c')));_0x5141f9['use'](_0xc9a3('0x3d'),require(_0xc9a3('0x3e')));_0x5141f9[_0xc9a3('0x8')]('/api/sms/queues',require(_0xc9a3('0x3f')));_0x5141f9[_0xc9a3('0x8')]('/api/openchannel/accounts',require(_0xc9a3('0x40')));_0x5141f9['use'](_0xc9a3('0x41'),require(_0xc9a3('0x42')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x43'),require(_0xc9a3('0x44')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x45'),require(_0xc9a3('0x46')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x47'),require(_0xc9a3('0x48')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x49'),require(_0xc9a3('0x4a')));_0x5141f9[_0xc9a3('0x8')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x4b'),require(_0xc9a3('0x4c')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x4d'),require(_0xc9a3('0x4e')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x4f'),require(_0xc9a3('0x50')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x51'),require(_0xc9a3('0x52')));_0x5141f9['use']('/api/chat/queues',require(_0xc9a3('0x53')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x54'),require(_0xc9a3('0x55')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x56'),require(_0xc9a3('0x57')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x58'),require(_0xc9a3('0x59')));_0x5141f9[_0xc9a3('0x8')]('/api/cm/contacts',require('./api/cmContact'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x5a'),require(_0xc9a3('0x5b')));_0x5141f9['use'](_0xc9a3('0x5c'),require(_0xc9a3('0x5d')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x5e'),require(_0xc9a3('0x5f')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x60'),require(_0xc9a3('0x61')));_0x5141f9['use'](_0xc9a3('0x62'),require(_0xc9a3('0x63')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x64'),require(_0xc9a3('0x65')));_0x5141f9[_0xc9a3('0x8')]('/api/automations',require(_0xc9a3('0x66')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x67'),require(_0xc9a3('0x68')));_0x5141f9['use'](_0xc9a3('0x69'),require(_0xc9a3('0x6a')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x6b'),require(_0xc9a3('0x6c')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x6d'),require(_0xc9a3('0x6e')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x6f'),require(_0xc9a3('0x70')));_0x5141f9['use'](_0xc9a3('0x71'),require(_0xc9a3('0x72')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x73'),require(_0xc9a3('0x74')));_0x5141f9['use'](_0xc9a3('0x75'),require(_0xc9a3('0x76')));_0x5141f9[_0xc9a3('0x8')]('/api/sounds',require(_0xc9a3('0x77')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x78'),require(_0xc9a3('0x79')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x7a'),require(_0xc9a3('0x7b')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x7c'),require(_0xc9a3('0x7d')));_0x5141f9['use']('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x7e'),require(_0xc9a3('0x7f')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x80'),require(_0xc9a3('0x81')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x82'),require(_0xc9a3('0x83')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x84'),require(_0xc9a3('0x85')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x86'),require('./api/integrationReport'));_0x5141f9['use'](_0xc9a3('0x87'),require('./api/analyticCustomReport'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x88'),require(_0xc9a3('0x89')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x8a'),require('./api/analyticExtractedReport'));_0x5141f9[_0xc9a3('0x8')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x5141f9[_0xc9a3('0x8')]('/api/analytics/field_reports',require(_0xc9a3('0x8b')));_0x5141f9['use']('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x8c'),require(_0xc9a3('0x8d')));_0x5141f9[_0xc9a3('0x8')]('/api/integrations/salesforce/configurations',require(_0xc9a3('0x8e')));_0x5141f9['use'](_0xc9a3('0x8f'),require('./api/intSalesforceField'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x90'),require('./api/intSugarcrmAccount'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x91'),require('./api/intSugarcrmConfiguration'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x92'),require('./api/intSugarcrmField'));_0x5141f9['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x5141f9['use'](_0xc9a3('0x93'),require(_0xc9a3('0x94')));_0x5141f9['use'](_0xc9a3('0x95'),require(_0xc9a3('0x96')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x97'),require('./api/intZohoAccount'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x98'),require(_0xc9a3('0x99')));_0x5141f9['use'](_0xc9a3('0x9a'),require(_0xc9a3('0x9b')));_0x5141f9[_0xc9a3('0x8')]('/api/integrations/zendesk/accounts',require(_0xc9a3('0x9c')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x9d'),require('./api/intZendeskConfiguration'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x9e'),require(_0xc9a3('0x9f')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xa0'),require(_0xc9a3('0xa1')));_0x5141f9[_0xc9a3('0x8')]('/api/integrations/freshdesk/configurations',require(_0xc9a3('0xa2')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xa3'),require('./api/intFreshdeskField'));_0x5141f9['use'](_0xc9a3('0xa4'),require(_0xc9a3('0xa5')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xa6'),require(_0xc9a3('0xa7')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xa8'),require(_0xc9a3('0xa9')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xaa'),require('./api/intServicenowAccount'));_0x5141f9['use'](_0xc9a3('0xab'),require(_0xc9a3('0xac')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xad'),require(_0xc9a3('0xae')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xaf'),require(_0xc9a3('0xb0')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xb1'),require(_0xc9a3('0xb2')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xb3'),require('./api/intDynamics365Field'));_0x5141f9['use'](_0xc9a3('0xb4'),require(_0xc9a3('0xb5')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xb6'),require('./api/intFreshsalesConfiguration'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xb7'),require(_0xc9a3('0xb8')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xb9'),require(_0xc9a3('0xba')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xbb'),require(_0xc9a3('0xbc')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xbd'),require(_0xc9a3('0xbe')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xbf'),require('./api/jscriptyAnswerReport'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xc0'),require(_0xc9a3('0xc1')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xc2'),require('./api/jscriptySessionReport'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xc3'),require(_0xc9a3('0xc4')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xc5'),require('./api/squareReport'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xc6'),require(_0xc9a3('0xc7')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xc8'),require(_0xc9a3('0xc9')));_0x5141f9['use'](_0xc9a3('0xca'),require(_0xc9a3('0xcb')));_0x5141f9['use'](_0xc9a3('0xcc'),require(_0xc9a3('0xcd')));_0x5141f9['use'](_0xc9a3('0xce'),require(_0xc9a3('0xcf')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xd0'),require(_0xc9a3('0xd1')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xd2'),require(_0xc9a3('0xd3')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xd4'),require(_0xc9a3('0xd5')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xd6'),require(_0xc9a3('0xd7')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xd8'),require('./api/campaign'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xd9'),require('./api/migration'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xda'),require(_0xc9a3('0xdb')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xdc'),require(_0xc9a3('0xdd')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xde'),require(_0xc9a3('0xdf')));_0x5141f9['use']('/api/chat/reports/transfer',require(_0xc9a3('0xe0')));_0x5141f9['use'](_0xc9a3('0xe1'),require(_0xc9a3('0xe2')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xe3'),require(_0xc9a3('0xe4')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xe5'),require('./api/smsTransferReport'));_0x5141f9['use'](_0xc9a3('0xe6'),require('./api/cmList'));_0x5141f9[_0xc9a3('0x8')]('/api/voice/prefixes',require(_0xc9a3('0xe7')));_0x5141f9['use'](_0xc9a3('0xe8'),require(_0xc9a3('0xe9')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xea'),require(_0xc9a3('0xeb')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xec'),require(_0xc9a3('0xed')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xee'),require('./api/userNotification'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xef'),require('./api/whatsappAccount'));_0x5141f9['use'](_0xc9a3('0xf0'),require(_0xc9a3('0xf1')));_0x5141f9['use']('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x5141f9[_0xc9a3('0x8')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x5141f9[_0xc9a3('0x8')]('/api/whatsapp/reports/queue',require(_0xc9a3('0xf2')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xf3'),require('./api/whatsappTransferReport'));_0x5141f9[_0xc9a3('0x8')]('/api/whatsapp/queues',require(_0xc9a3('0xf4')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xf5'),require(_0xc9a3('0xf6')));_0x5141f9['use'](_0xc9a3('0xf7'),require(_0xc9a3('0xf8')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xf9'),require(_0xc9a3('0xfa')));_0x5141f9['use'](_0xc9a3('0xfb'),require(_0xc9a3('0xfc')));_0x5141f9[_0xc9a3('0x8')]('/api/auth/local',require('./api/authLocal'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0xfd'),require(_0xc9a3('0xfe')));_0x5141f9['use']('/api/auth/activedirectory',require(_0xc9a3('0xff')));_0x5141f9['use']('/api/jira',require(_0xc9a3('0x100')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x101'),require('./api/rpc'));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x102'),require(_0xc9a3('0x103')));_0x5141f9['use'](_0xc9a3('0x104'),require(_0xc9a3('0x105')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x106'),require(_0xc9a3('0x107')));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x108'),require(_0xc9a3('0x109')));_0x5141f9[_0xc9a3('0x8')]('/api/logs',clientSideLogs);_0x5141f9[_0xc9a3('0x8')]('/apidoc',express[_0xc9a3('0x10a')](path['join'](config[_0xc9a3('0x10b')],_0xc9a3('0x10c'))));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x10d'),express['static'](path[_0xc9a3('0x10e')](config[_0xc9a3('0x10b')],_0xc9a3('0x10d'))));_0x5141f9['use'](_0xc9a3('0x10f'),express[_0xc9a3('0x10a')](path['join'](config[_0xc9a3('0x10b')],_0xc9a3('0x10f'))));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x110'),express[_0xc9a3('0x10a')](path[_0xc9a3('0x10e')](config[_0xc9a3('0x10b')],_0xc9a3('0x111'),_0xc9a3('0x112'))));_0x5141f9[_0xc9a3('0x8')](_0xc9a3('0x113'),express[_0xc9a3('0x10a')](path[_0xc9a3('0x10e')](config[_0xc9a3('0x10b')],_0xc9a3('0x114'))));_0x5141f9[_0xc9a3('0x115')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xc9a3('0x116')](errors[0x194]);_0x5141f9[_0xc9a3('0x115')]('/*')[_0xc9a3('0x116')](function(_0x375939,_0x17e95b){_0x17e95b['sendFile'](path[_0xc9a3('0x117')](_0x5141f9[_0xc9a3('0x116')](_0xc9a3('0x118'))+'/index.html'));});return _0x5141f9;});}; \ No newline at end of file +var _0x21ba=['/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/dispositions','./api/condition','/api/intervals','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/schedule','/api/sounds','./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/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','./api/cloudProvider','/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/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','join','/www','root','static','/demo','snippet','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','appPath','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue'];(function(_0x2ef140,_0x243d23){var _0xb55d20=function(_0x4b3049){while(--_0x4b3049){_0x2ef140['push'](_0x2ef140['shift']());}};_0xb55d20(++_0x243d23);}(_0x21ba,0x1f4));var _0xa21b=function(_0x2c2336,_0x14b67c){_0x2c2336=_0x2c2336-0x0;var _0x1d1d1d=_0x21ba[_0x2c2336];return _0x1d1d1d;};'use strict';var path=require('path');var express=require('express');var errors=require(_0xa21b('0x0'));var config=require(_0xa21b('0x1'));var setupLoggers=require(_0xa21b('0x2'))[_0xa21b('0x3')];var clientSideLogs=require(_0xa21b('0x4'));exports[_0xa21b('0x5')]=function(_0x337b20){return setupLoggers(_0x337b20)[_0xa21b('0x6')](function(){_0x337b20[_0xa21b('0x7')](_0xa21b('0x8'),require('./api/user'));_0x337b20[_0xa21b('0x7')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x337b20['use'](_0xa21b('0x9'),require('./api/voiceContext'));_0x337b20[_0xa21b('0x7')](_0xa21b('0xa'),require(_0xa21b('0xb')));_0x337b20['use'](_0xa21b('0xc'),require('./api/voiceMusicOnHold'));_0x337b20[_0xa21b('0x7')](_0xa21b('0xd'),require(_0xa21b('0xe')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xf'),require(_0xa21b('0x10')));_0x337b20[_0xa21b('0x7')]('/api/screen/recordings',require(_0xa21b('0x11')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x12'),require(_0xa21b('0x13')));_0x337b20[_0xa21b('0x7')]('/api/voice/mails/messages',require(_0xa21b('0x14')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x15'),require('./api/voiceCallReport'));_0x337b20[_0xa21b('0x7')](_0xa21b('0x16'),require(_0xa21b('0x17')));_0x337b20['use'](_0xa21b('0x18'),require(_0xa21b('0x19')));_0x337b20[_0xa21b('0x7')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x337b20['use']('/api/members/reports',require(_0xa21b('0x1a')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x1b'),require(_0xa21b('0x1c')));_0x337b20['use'](_0xa21b('0x1d'),require(_0xa21b('0x1e')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x1f'),require(_0xa21b('0x20')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x21'),require(_0xa21b('0x22')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x23'),require(_0xa21b('0x24')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x25'),require(_0xa21b('0x26')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x27'),require('./api/mailInteraction'));_0x337b20['use']('/api/mail/messages',require(_0xa21b('0x28')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x29'),require(_0xa21b('0x2a')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x2b'),require(_0xa21b('0x2c')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x2d'),require(_0xa21b('0x2e')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x2f'),require(_0xa21b('0x30')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x31'),require(_0xa21b('0x32')));_0x337b20['use'](_0xa21b('0x33'),require(_0xa21b('0x34')));_0x337b20[_0xa21b('0x7')]('/api/fax/interactions',require(_0xa21b('0x35')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x36'),require('./api/faxMessage'));_0x337b20['use'](_0xa21b('0x37'),require(_0xa21b('0x38')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x39'),require('./api/faxQueueReport'));_0x337b20['use'](_0xa21b('0x3a'),require(_0xa21b('0x3b')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x3c'),require(_0xa21b('0x3d')));_0x337b20[_0xa21b('0x7')]('/api/sms/interactions',require(_0xa21b('0x3e')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x3f'),require(_0xa21b('0x40')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x41'),require(_0xa21b('0x42')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x43'),require(_0xa21b('0x44')));_0x337b20[_0xa21b('0x7')]('/api/openchannel/applications',require(_0xa21b('0x45')));_0x337b20['use'](_0xa21b('0x46'),require(_0xa21b('0x47')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x48'),require(_0xa21b('0x49')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x4a'),require('./api/openchannelQueue'));_0x337b20['use'](_0xa21b('0x4b'),require(_0xa21b('0x4c')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x4d'),require(_0xa21b('0x4e')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x4f'),require(_0xa21b('0x50')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x51'),require(_0xa21b('0x52')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x53'),require(_0xa21b('0x54')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x55'),require('./api/chatOfflineMessage'));_0x337b20['use'](_0xa21b('0x56'),require(_0xa21b('0x57')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x58'),require(_0xa21b('0x59')));_0x337b20[_0xa21b('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x337b20[_0xa21b('0x7')](_0xa21b('0x5a'),require(_0xa21b('0x5b')));_0x337b20[_0xa21b('0x7')]('/api/cm/contacts',require(_0xa21b('0x5c')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x5d'),require(_0xa21b('0x5e')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x5f'),require(_0xa21b('0x60')));_0x337b20['use']('/api/cm/hopper_final',require(_0xa21b('0x61')));_0x337b20['use'](_0xa21b('0x62'),require(_0xa21b('0x63')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x64'),require('./api/cmCustomField'));_0x337b20['use']('/api/actions',require(_0xa21b('0x65')));_0x337b20['use'](_0xa21b('0x66'),require(_0xa21b('0x67')));_0x337b20[_0xa21b('0x7')]('/api/canned_answers',require('./api/cannedAnswer'));_0x337b20[_0xa21b('0x7')](_0xa21b('0x68'),require('./api/disposition'));_0x337b20[_0xa21b('0x7')]('/api/conditions',require(_0xa21b('0x69')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x6a'),require('./api/interval'));_0x337b20['use']('/api/pauses',require('./api/pause'));_0x337b20[_0xa21b('0x7')](_0xa21b('0x6b'),require(_0xa21b('0x6c')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x6d'),require('./api/voiceQueuesLog'));_0x337b20[_0xa21b('0x7')]('/api/schedules',require(_0xa21b('0x6e')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x6f'),require(_0xa21b('0x70')));_0x337b20[_0xa21b('0x7')]('/api/tags',require(_0xa21b('0x71')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x72'),require(_0xa21b('0x73')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x74'),require(_0xa21b('0x75')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x76'),require(_0xa21b('0x77')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x78'),require(_0xa21b('0x79')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x7a'),require(_0xa21b('0x7b')));_0x337b20['use']('/api/variables',require(_0xa21b('0x7c')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x7d'),require(_0xa21b('0x7e')));_0x337b20[_0xa21b('0x7')]('/api/integrations/reports',require(_0xa21b('0x7f')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x80'),require(_0xa21b('0x81')));_0x337b20['use']('/api/analytics/default_reports',require(_0xa21b('0x82')));_0x337b20[_0xa21b('0x7')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x337b20['use'](_0xa21b('0x83'),require(_0xa21b('0x84')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x85'),require(_0xa21b('0x86')));_0x337b20[_0xa21b('0x7')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x337b20['use'](_0xa21b('0x87'),require(_0xa21b('0x88')));_0x337b20['use'](_0xa21b('0x89'),require('./api/intSalesforceConfiguration'));_0x337b20[_0xa21b('0x7')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x337b20[_0xa21b('0x7')](_0xa21b('0x8a'),require(_0xa21b('0x8b')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x8c'),require(_0xa21b('0x8d')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x8e'),require(_0xa21b('0x8f')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x90'),require(_0xa21b('0x91')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x92'),require(_0xa21b('0x93')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x94'),require(_0xa21b('0x95')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x96'),require('./api/intZohoAccount'));_0x337b20[_0xa21b('0x7')]('/api/integrations/zoho/configurations',require(_0xa21b('0x97')));_0x337b20['use'](_0xa21b('0x98'),require(_0xa21b('0x99')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x9a'),require('./api/intZendeskAccount'));_0x337b20[_0xa21b('0x7')](_0xa21b('0x9b'),require(_0xa21b('0x9c')));_0x337b20[_0xa21b('0x7')]('/api/integrations/zendesk/fields',require(_0xa21b('0x9d')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x9e'),require('./api/intFreshdeskAccount'));_0x337b20[_0xa21b('0x7')](_0xa21b('0x9f'),require(_0xa21b('0xa0')));_0x337b20[_0xa21b('0x7')]('/api/integrations/freshdesk/fields',require(_0xa21b('0xa1')));_0x337b20['use'](_0xa21b('0xa2'),require(_0xa21b('0xa3')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xa4'),require(_0xa21b('0xa5')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xa6'),require(_0xa21b('0xa7')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xa8'),require(_0xa21b('0xa9')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xaa'),require(_0xa21b('0xab')));_0x337b20['use'](_0xa21b('0xac'),require(_0xa21b('0xad')));_0x337b20[_0xa21b('0x7')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x337b20[_0xa21b('0x7')](_0xa21b('0xae'),require('./api/intDynamics365Configuration'));_0x337b20['use'](_0xa21b('0xaf'),require('./api/intDynamics365Field'));_0x337b20[_0xa21b('0x7')](_0xa21b('0xb0'),require(_0xa21b('0xb1')));_0x337b20[_0xa21b('0x7')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x337b20[_0xa21b('0x7')]('/api/integrations/freshsales/fields',require(_0xa21b('0xb2')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xb3'),require(_0xa21b('0xb4')));_0x337b20['use']('/api/chat/reports/queue',require(_0xa21b('0xb5')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xb6'),require(_0xa21b('0xb7')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xb8'),require(_0xa21b('0xb9')));_0x337b20['use']('/api/jscripty/questions/reports',require(_0xa21b('0xba')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xbb'),require(_0xa21b('0xbc')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xbd'),require('./api/smsQueueReport'));_0x337b20[_0xa21b('0x7')](_0xa21b('0xbe'),require(_0xa21b('0xbf')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xc0'),require(_0xa21b('0xc1')));_0x337b20['use'](_0xa21b('0xc2'),require(_0xa21b('0xc3')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xc4'),require(_0xa21b('0xc5')));_0x337b20[_0xa21b('0x7')]('/api/square/odbc',require('./api/squareOdbc'));_0x337b20['use'](_0xa21b('0xc6'),require(_0xa21b('0xc7')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xc8'),require('./api/squareRecording'));_0x337b20[_0xa21b('0x7')](_0xa21b('0xc9'),require(_0xa21b('0xca')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xcb'),require(_0xa21b('0xcc')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xcd'),require(_0xa21b('0xce')));_0x337b20[_0xa21b('0x7')]('/api/campaigns',require(_0xa21b('0xcf')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xd0'),require(_0xa21b('0xd1')));_0x337b20['use'](_0xa21b('0xd2'),require(_0xa21b('0xd3')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xd4'),require('./api/plugin'));_0x337b20[_0xa21b('0x7')](_0xa21b('0xd5'),require(_0xa21b('0xd6')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xd7'),require(_0xa21b('0xd8')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xd9'),require('./api/faxTransferReport'));_0x337b20['use'](_0xa21b('0xda'),require(_0xa21b('0xdb')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xdc'),require(_0xa21b('0xdd')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xde'),require(_0xa21b('0xdf')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xe0'),require(_0xa21b('0xe1')));_0x337b20[_0xa21b('0x7')]('/api/userProfiles',require(_0xa21b('0xe2')));_0x337b20[_0xa21b('0x7')]('/api/userProfile/sections',require(_0xa21b('0xe3')));_0x337b20['use'](_0xa21b('0xe4'),require(_0xa21b('0xe5')));_0x337b20['use'](_0xa21b('0xe6'),require(_0xa21b('0xe7')));_0x337b20['use'](_0xa21b('0xe8'),require(_0xa21b('0xe9')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xea'),require(_0xa21b('0xeb')));_0x337b20[_0xa21b('0x7')]('/api/whatsapp/interactions',require(_0xa21b('0xec')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xed'),require(_0xa21b('0xee')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xef'),require('./api/whatsappQueueReport'));_0x337b20['use'](_0xa21b('0xf0'),require(_0xa21b('0xf1')));_0x337b20['use']('/api/whatsapp/queues',require(_0xa21b('0xf2')));_0x337b20[_0xa21b('0x7')]('/api/cloudProviders',require(_0xa21b('0xf3')));_0x337b20[_0xa21b('0x7')]('/api/realtime',require('./api/realtime'));_0x337b20[_0xa21b('0x7')](_0xa21b('0xf4'),require(_0xa21b('0xf5')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xf6'),require(_0xa21b('0xf7')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xf8'),require(_0xa21b('0xf9')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xfa'),require(_0xa21b('0xfb')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xfc'),require('./api/authActiveDirectory'));_0x337b20[_0xa21b('0x7')](_0xa21b('0xfd'),require(_0xa21b('0xfe')));_0x337b20[_0xa21b('0x7')](_0xa21b('0xff'),require(_0xa21b('0x100')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x101'),require(_0xa21b('0x102')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x103'),require(_0xa21b('0x104')));_0x337b20['use'](_0xa21b('0x105'),require(_0xa21b('0x106')));_0x337b20['use'](_0xa21b('0x107'),require(_0xa21b('0x108')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x109'),clientSideLogs);_0x337b20[_0xa21b('0x7')](_0xa21b('0x10a'),express['static'](path[_0xa21b('0x10b')](config['root'],_0xa21b('0x10a'))));_0x337b20[_0xa21b('0x7')](_0xa21b('0x10c'),express['static'](path[_0xa21b('0x10b')](config[_0xa21b('0x10d')],_0xa21b('0x10c'))));_0x337b20[_0xa21b('0x7')]('/demo',express[_0xa21b('0x10e')](path[_0xa21b('0x10b')](config[_0xa21b('0x10d')],_0xa21b('0x10f'))));_0x337b20[_0xa21b('0x7')]('/snippet',express['static'](path[_0xa21b('0x10b')](config[_0xa21b('0x10d')],_0xa21b('0x110'),'3.9.0')));_0x337b20[_0xa21b('0x7')](_0xa21b('0x111'),express['static'](path[_0xa21b('0x10b')](config['root'],'/server/files/plugins')));_0x337b20['route'](_0xa21b('0x112'))[_0xa21b('0x113')](errors[0x194]);_0x337b20[_0xa21b('0x114')]('/*')['get'](function(_0x5bea8a,_0xf3393b){_0xf3393b[_0xa21b('0x115')](path['resolve'](_0x337b20[_0xa21b('0x113')](_0xa21b('0x116'))+'/index.html'));});return _0x337b20;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 872032f..5e7343f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe64b=['../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.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','server','http','rpc','port','error','log','../config/triggers','default','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xe64b,0xc4));var _0xbe64=function(_0x1b4876,_0x3e8420){_0x1b4876=_0x1b4876-0x0;var _0x30b37b=_0xe64b[_0x1b4876];return _0x30b37b;};'use strict';var jayson=require(_0xbe64('0x0'));var _=require('lodash');var config=require(_0xbe64('0x1'));exports[_0xbe64('0x2')]=function(){return new Promise(function(_0x5d9c8d,_0xe2e71b){var _0x33d390={};_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x4')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x5')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x6')));_0x33d390=_['merge'](_0x33d390,require(_0xbe64('0x7')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x8')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x9')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0xa')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0xb')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0xc')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0xd')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0xe')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/mailAccount/mailAccount.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0xf')));_0x33d390=_['merge'](_0x33d390,require(_0xbe64('0x10')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x11')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x12')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/faxAccount/faxAccount.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/faxApplication/faxApplication.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x13')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x14')));_0x33d390=_['merge'](_0x33d390,require(_0xbe64('0x15')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x16')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/smsAccount/smsAccount.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x17')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x18')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x19')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x1a')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x1b')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x1c')));_0x33d390=_['merge'](_0x33d390,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x33d390=_['merge'](_0x33d390,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x1d')));_0x33d390=_['merge'](_0x33d390,require('../api/chatMessage/chatMessage.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x1e')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x1f')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x20')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x21')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x22')));_0x33d390=_['merge'](_0x33d390,require(_0xbe64('0x23')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x24')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x25')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x26')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x27')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x28')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x29')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x2a')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x2b')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x2c')));_0x33d390=_['merge'](_0x33d390,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x2d')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x33d390=_['merge'](_0x33d390,require(_0xbe64('0x2e')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x2f')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x30')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x31')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x33d390=_['merge'](_0x33d390,require(_0xbe64('0x32')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x33')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x34')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x35')));_0x33d390=_['merge'](_0x33d390,require('../api/squareProject/squareProject.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x36')));_0x33d390=_['merge'](_0x33d390,require(_0xbe64('0x37')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x38')));_0x33d390=_['merge'](_0x33d390,require(_0xbe64('0x39')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x3a')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x3b')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x3c')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require(_0xbe64('0x3d')));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x33d390=_[_0xbe64('0x3')](_0x33d390,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x394b50=jayson[_0xbe64('0x3e')](_0x33d390)[_0xbe64('0x3f')]();var _0x154541=config[_0xbe64('0x40')][_0xbe64('0x41')]||config['port']+0x1;var _0x131263=config['rpc']['ip']||'localhost';_0x394b50['on'](_0xbe64('0x42'),function(_0x10a4e0){return _0xe2e71b(_0x10a4e0);});_0x394b50['listen'](_0x154541,_0x131263,function(){console[_0xbe64('0x43')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x131263,_0x154541);require(_0xbe64('0x44'))[_0xbe64('0x45')]();return _0x5d9c8d('RPC\x20listening\x20on\x20'+_0x131263+':'+_0x154541);});});}; \ No newline at end of file +var _0x2687=['merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.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','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','listen'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x2687,0x8f));var _0x7268=function(_0x22889a,_0x4b75f7){_0x22889a=_0x22889a-0x0;var _0x763d34=_0x2687[_0x22889a];return _0x763d34;};'use strict';var jayson=require(_0x7268('0x0'));var _=require(_0x7268('0x1'));var config=require('../config/environment');exports[_0x7268('0x2')]=function(){return new Promise(function(_0x390936,_0x3acb){var _0x514926={};_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x4')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/voiceExtension/voiceExtension.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x5')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/voiceRecording/voiceRecording.rpc'));_0x514926=_['merge'](_0x514926,require(_0x7268('0x6')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x7')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x8')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x9')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0xa')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0xb')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0xc')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0xd')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0xe')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0xf')));_0x514926=_['merge'](_0x514926,require('../api/mailInteraction/mailInteraction.rpc'));_0x514926=_['merge'](_0x514926,require(_0x7268('0x10')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x11')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x12')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x13')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/faxApplication/faxApplication.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/faxInteraction/faxInteraction.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x14')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x15')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/smsAccount/smsAccount.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x16')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x17')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x18')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x19')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x1a')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x1b')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x1c')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x1d')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/chatMessage/chatMessage.rpc'));_0x514926=_['merge'](_0x514926,require('../api/chatQueue/chatQueue.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x1e')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x1f')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x20')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x21')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x22')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x23')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x24')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x25')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x26')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x27')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x28')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x29')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x2a')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x2b')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x2c')));_0x514926=_['merge'](_0x514926,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x514926=_['merge'](_0x514926,require(_0x7268('0x2d')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x2e')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x514926=_['merge'](_0x514926,require(_0x7268('0x2f')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x30')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x31')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x32')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x33')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/squareReport/squareReport.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x34')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/setting/setting.rpc'));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x35')));_0x514926=_[_0x7268('0x3')](_0x514926,require('../api/squareProject/squareProject.rpc'));_0x514926=_['merge'](_0x514926,require(_0x7268('0x36')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x37')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x38')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x39')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x3a')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x3b')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x3c')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x3d')));_0x514926=_['merge'](_0x514926,require(_0x7268('0x3e')));_0x514926=_[_0x7268('0x3')](_0x514926,require(_0x7268('0x3f')));var _0xcd8697=jayson['server'](_0x514926)[_0x7268('0x40')]();var _0x2e01da=config[_0x7268('0x41')][_0x7268('0x42')]||config['port']+0x1;var _0x1e530f=config['rpc']['ip']||_0x7268('0x43');_0xcd8697['on'](_0x7268('0x44'),function(_0x223d05){return _0x3acb(_0x223d05);});_0xcd8697[_0x7268('0x2')](_0x2e01da,_0x1e530f,function(){console[_0x7268('0x45')](_0x7268('0x46'),_0x1e530f,_0x2e01da);require(_0x7268('0x47'))[_0x7268('0x48')]();return _0x390936('RPC\x20listening\x20on\x20'+_0x1e530f+':'+_0x2e01da);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6060b56..3e43402 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 _0x3c04=['substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','setPriority','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','exports','lodash','EventEmitter','./reply','./error','call','utf8','setEncoding','headers','emit','ready','line','hangup'];(function(_0x2c0ce3,_0x1baadc){var _0x523482=function(_0x57e5cc){while(--_0x57e5cc){_0x2c0ce3['push'](_0x2c0ce3['shift']());}};_0x523482(++_0x1baadc);}(_0x3c04,0x192));var _0x43c0=function(_0x46893f,_0x30bd0c){_0x46893f=_0x46893f-0x0;var _0x430f86=_0x3c04[_0x46893f];return _0x430f86;};'use strict';var util=require('util');var _=require(_0x43c0('0x0'));var EventEmitter=require('events')[_0x43c0('0x1')];var AGIReply=require(_0x43c0('0x2'));var AGIError=require(_0x43c0('0x3'));function AGIChannel(_0x2acce3){var _0x212986=this,_0x43818b=new AGIReply(),_0xda1f1f=![],_0x23b839={};EventEmitter[_0x43c0('0x4')](_0x212986);_0x2acce3['setEncoding'](_0x43c0('0x5'));_0x2acce3['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x43818b[_0x43c0('0x6')]('utf8');_0x43818b['on'](_0x43c0('0x7'),function(_0x53b4b1){for(var _0x100fb8 in _0x53b4b1){_0x212986[_0x100fb8]=_0x53b4b1[_0x100fb8];}_0x212986[_0x43c0('0x8')](_0x43c0('0x9'));});_0x43818b['on'](_0x43c0('0xa'),function(_0x506f13){if(_0x506f13['toLowerCase']()==_0x43c0('0xb')){_0x212986['emit'](_0x43c0('0xb'));return;}if(_0x506f13[_0x43c0('0xc')](0x0,0xb)==_0x43c0('0xd')){_0xda1f1f=!![];}if(_0xda1f1f){_0x23b839['rx']+=_0x506f13+'\x0a';if(_0x506f13['search'](_0x43c0('0xe'))!=-0x1){_0xda1f1f=![];}}else{_0x23b839['rx']=_0x506f13;}if(_0xda1f1f){return;}if(typeof _0x23b839['cb']==_0x43c0('0xf')){var _0x3ad25d=_0x23b839['rx']['substring'](0x0,0x3),_0x3f235e=null,_0x4649fc=null;_0x3ad25d=parseInt(_0x3ad25d);if(isNaN(_0x3ad25d)){_0x23b839['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x43c0('0x10')});return;}if(_0x3ad25d!=0xc8){_0x23b839['cb'](null,{'code':_0x3ad25d,'result':-0x1,'extra':'KO'});return;}_0x3f235e=_0x23b839['rx'][_0x43c0('0xc')](0x4)[_0x43c0('0x11')](_0x43c0('0x12'),'');if(_0x3f235e[_0x43c0('0x13')]('\x20')!=-0x1){_0x3f235e=_0x3f235e['substr'](0x0,_0x3f235e[_0x43c0('0x13')]('\x20'));}if(_['startsWith'](_0x3f235e,'-1')){_0x3f235e=parseInt(_0x3f235e);}_0x4649fc=_0x23b839['rx'][_0x43c0('0x14')]('\x20');if(_0x4649fc['length']==0x3){_0x4649fc=_0x4649fc[0x2][_0x43c0('0xc')](0x1,_0x4649fc[0x2][_0x43c0('0x15')]-0x1);}else if(_0x4649fc[_0x43c0('0x15')]>0x3){var _0x2c5b6e=/\((.+)\)/;var _0x3f7db7=_0x23b839['rx']['match'](_0x2c5b6e);if(_0x3f7db7){_0x4649fc=_0x3f7db7[0x1];}else{_0x4649fc=null;}}else{_0x4649fc=null;}_0x23b839['cb'](null,{'code':_0x3ad25d,'result':_0x3f235e,'extra':_0x4649fc});}});_0x2acce3['on']('error',function(_0x5119e9){_0x212986[_0x43c0('0x8')](_0x43c0('0x16'),new AGIError(_0x43c0('0x17'),_0x5119e9[_0x43c0('0x18')]));});_0x2acce3['on'](_0x43c0('0x19'),function(){_0x212986[_0x43c0('0x8')]('close',new AGIError(_0x43c0('0x1a')));});_0x2acce3['on'](_0x43c0('0x1b'),function(){_0x212986[_0x43c0('0x8')](_0x43c0('0x1b'),new AGIError(_0x43c0('0x1c')));_0x2acce3[_0x43c0('0x1d')]();});_0x2acce3[_0x43c0('0x1e')](_0x43818b);this[_0x43c0('0x1f')]=function(_0xad2b9,_0x3873c0){var _0xad2b9=_0xad2b9||'',_0x3873c0=typeof _0x3873c0==_0x43c0('0xf')?_0x3873c0:new Function();_0x23b839={'tx':_0xad2b9,'rx':'','cb':_0x3873c0};_0x2acce3[_0x43c0('0x20')](_0xad2b9+'\x0a');},this['close']=function(){_0x2acce3[_0x43c0('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x43c0('0x21')][_0x43c0('0x22')]=function(_0x3f85c4){return this[_0x43c0('0x1f')]['sync'](this,_0x3f85c4);};AGIChannel[_0x43c0('0x21')]['answer']=function(){return this[_0x43c0('0x22')](_0x43c0('0x23'));};AGIChannel['prototype'][_0x43c0('0x24')]=function(_0x1080a0,_0x31fde5,_0x30b428){_0x1080a0=_0x1080a0===undefined?_0x43c0('0x25'):_0x1080a0;_0x31fde5=_0x31fde5===undefined?'5':_0x31fde5;_0x30b428=_0x30b428===undefined?'1':_0x30b428;return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x27'),_0x1080a0,_0x31fde5*0x3e8,_0x30b428));};AGIChannel['prototype'][_0x43c0('0x28')]=function(_0x4c4e3d){_0x4c4e3d=_0x4c4e3d||_0x43c0('0x29');return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x2a'),_0x4c4e3d));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x2b')]=function(_0x5b9828,_0x2dcc60){if(_['isArray'](_0x2dcc60)){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x2c'),_0x5b9828,_0x2dcc60['join'](',')));}return this[_0x43c0('0x22')](util[_0x43c0('0x26')]('EXEC\x20%s\x20%s',_0x5b9828,_0x2dcc60));};AGIChannel['prototype'][_0x43c0('0x2d')]=function(_0x3d0faa){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x2e'),_0x3d0faa));};AGIChannel[_0x43c0('0x21')]['setExtension']=function(_0x449abf){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x2f'),_0x449abf));};AGIChannel['prototype']['setPriority']=function(_0x11455e){return this['sendRequest'](util[_0x43c0('0x26')]('SET\x20PRIORITY\x20%s',_0x11455e));};AGIChannel[_0x43c0('0x21')][_0x43c0('0xb')]=function(){return this[_0x43c0('0x22')]('HANGUP');};AGIChannel['prototype'][_0x43c0('0x30')]=function(_0x3b9dfa,_0x4275da){var _0x42efbc=_['isBoolean'](_0x4275da)||_[_0x43c0('0x31')](_0x4275da)?_0x4275da[_0x43c0('0x32')]():_0x4275da;return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x33'),_0x3b9dfa,_0x42efbc?_0x42efbc['toString']()[_0x43c0('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x34')]=function(_0x1aff97,_0x3285df){return this[_0x43c0('0x22')](util[_0x43c0('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x1aff97,_0x3285df));};AGIChannel[_0x43c0('0x21')]['sayDigits']=function(_0x43473,_0x4da289){return this[_0x43c0('0x22')](util['format'](_0x43c0('0x35'),_0x43473,_0x4da289));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x36')]=function(_0x442aaa,_0x450c62){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x37'),_0x442aaa,_0x450c62));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x38')]=function(_0x4fa430,_0x537276,_0x26ed59){_0x537276=_0x537276||this['extension'];_0x26ed59=_0x26ed59||0x1;this['setContext'](_0x4fa430);this[_0x43c0('0x39')](_0x537276);this[_0x43c0('0x3a')](_0x26ed59);return this['noop'](util[_0x43c0('0x26')]('GOTO\x20%s\x20%s\x20%s',_0x4fa430,_0x537276,_0x26ed59));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x3b')]=function(_0x1d3ef7){return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x3c'),_0x1d3ef7));};AGIChannel[_0x43c0('0x21')][_0x43c0('0x3d')]=function(_0x437ae9,_0x2088ed,_0x11e23d,_0x6d5913,_0x64e1f2,_0x489c0a){_0x2088ed=_0x2088ed||_0x43c0('0x3e');_0x11e23d=_0x11e23d||'';_0x6d5913=_0x6d5913===undefined?-0x1:_0x6d5913==='-1'?-0x1:_0x6d5913*0x3e8;_0x64e1f2=_0x64e1f2===undefined?'':'s='+_0x64e1f2;_0x489c0a=_0x489c0a?_0x43c0('0x3f'):'';return this[_0x43c0('0x22')](util[_0x43c0('0x26')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x437ae9,_0x2088ed,_0x11e23d,_0x6d5913,_0x489c0a,_0x64e1f2));};AGIChannel[_0x43c0('0x21')]['streamFile']=function(_0x31dca4,_0x498c3c){_0x498c3c=_0x498c3c||'';return this[_0x43c0('0x22')](util[_0x43c0('0x26')](_0x43c0('0x40'),_0x31dca4,_0x498c3c));};AGIChannel['prototype'][_0x43c0('0x41')]=function(_0x120952){return this[_0x43c0('0x2b')](_0x43c0('0x42'),_0x120952);};AGIChannel['prototype'][_0x43c0('0x43')]=function(_0x3abc2a){return this[_0x43c0('0x2b')]('WAIT',_0x3abc2a);};AGIChannel[_0x43c0('0x21')][_0x43c0('0x16')]=function(_0x496f84,_0x19ac3c){this[_0x43c0('0x28')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x496f84['id'],_0x496f84['label'],_0x19ac3c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x43c0('0x44')]=AGIChannel; \ No newline at end of file +var _0x11ec=['search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','destroy','pipe','command','inherits','sendRequest','prototype','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','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','exec','AGI','wait','WAIT','label','exports','events','EventEmitter','./reply','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','520-Invalid'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0x11ec,0xd1));var _0xc11e=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0x11ec[_0x1d9163];return _0xb42197;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0xc11e('0x0'))[_0xc11e('0x1')];var AGIReply=require(_0xc11e('0x2'));var AGIError=require('./error');function AGIChannel(_0x22c5f3){var _0x5b8346=this,_0x2c2364=new AGIReply(),_0x376b48=![],_0x117bcb={};EventEmitter[_0xc11e('0x3')](_0x5b8346);_0x22c5f3[_0xc11e('0x4')](_0xc11e('0x5'));_0x22c5f3['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2c2364[_0xc11e('0x4')](_0xc11e('0x5'));_0x2c2364['on'](_0xc11e('0x6'),function(_0x2c9d32){for(var _0x1fee3b in _0x2c9d32){_0x5b8346[_0x1fee3b]=_0x2c9d32[_0x1fee3b];}_0x5b8346[_0xc11e('0x7')]('ready');});_0x2c2364['on'](_0xc11e('0x8'),function(_0x287706){if(_0x287706[_0xc11e('0x9')]()==_0xc11e('0xa')){_0x5b8346[_0xc11e('0x7')](_0xc11e('0xa'));return;}if(_0x287706[_0xc11e('0xb')](0x0,0xb)==_0xc11e('0xc')){_0x376b48=!![];}if(_0x376b48){_0x117bcb['rx']+=_0x287706+'\x0a';if(_0x287706[_0xc11e('0xd')](_0xc11e('0xe'))!=-0x1){_0x376b48=![];}}else{_0x117bcb['rx']=_0x287706;}if(_0x376b48){return;}if(typeof _0x117bcb['cb']==_0xc11e('0xf')){var _0x55868a=_0x117bcb['rx'][_0xc11e('0xb')](0x0,0x3),_0x16f94a=null,_0x8292f4=null;_0x55868a=parseInt(_0x55868a);if(isNaN(_0x55868a)){_0x117bcb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc11e('0x10')});return;}if(_0x55868a!=0xc8){_0x117bcb['cb'](null,{'code':_0x55868a,'result':-0x1,'extra':'KO'});return;}_0x16f94a=_0x117bcb['rx'][_0xc11e('0xb')](0x4)[_0xc11e('0x11')]('result=','');if(_0x16f94a[_0xc11e('0x12')]('\x20')!=-0x1){_0x16f94a=_0x16f94a[_0xc11e('0x13')](0x0,_0x16f94a[_0xc11e('0x12')]('\x20'));}if(_[_0xc11e('0x14')](_0x16f94a,'-1')){_0x16f94a=parseInt(_0x16f94a);}_0x8292f4=_0x117bcb['rx']['split']('\x20');if(_0x8292f4['length']==0x3){_0x8292f4=_0x8292f4[0x2][_0xc11e('0xb')](0x1,_0x8292f4[0x2][_0xc11e('0x15')]-0x1);}else if(_0x8292f4[_0xc11e('0x15')]>0x3){var _0x5dbefb=/\((.+)\)/;var _0x4fbedc=_0x117bcb['rx']['match'](_0x5dbefb);if(_0x4fbedc){_0x8292f4=_0x4fbedc[0x1];}else{_0x8292f4=null;}}else{_0x8292f4=null;}_0x117bcb['cb'](null,{'code':_0x55868a,'result':_0x16f94a,'extra':_0x8292f4});}});_0x22c5f3['on'](_0xc11e('0x16'),function(_0x21566d){_0x5b8346['emit'](_0xc11e('0x16'),new AGIError(_0xc11e('0x17'),_0x21566d['code']));});_0x22c5f3['on']('close',function(){_0x5b8346[_0xc11e('0x7')](_0xc11e('0x18'),new AGIError(_0xc11e('0x19')));});_0x22c5f3['on']('timeout',function(){_0x5b8346[_0xc11e('0x7')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x22c5f3[_0xc11e('0x1a')]();});_0x22c5f3[_0xc11e('0x1b')](_0x2c2364);this[_0xc11e('0x1c')]=function(_0x277da5,_0xb148ca){var _0x277da5=_0x277da5||'',_0xb148ca=typeof _0xb148ca==_0xc11e('0xf')?_0xb148ca:new Function();_0x117bcb={'tx':_0x277da5,'rx':'','cb':_0xb148ca};_0x22c5f3['write'](_0x277da5+'\x0a');},this[_0xc11e('0x18')]=function(){_0x22c5f3['destroy']();};}util[_0xc11e('0x1d')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xc11e('0x1e')]=function(_0xfec4fe){return this[_0xc11e('0x1c')]['sync'](this,_0xfec4fe);};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x20')]=function(){return this['sendRequest'](_0xc11e('0x21'));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x22')]=function(_0x1c49ce,_0x987a1f,_0x2d6670){_0x1c49ce=_0x1c49ce===undefined?_0xc11e('0x23'):_0x1c49ce;_0x987a1f=_0x987a1f===undefined?'5':_0x987a1f;_0x2d6670=_0x2d6670===undefined?'1':_0x2d6670;return this[_0xc11e('0x1e')](util[_0xc11e('0x24')](_0xc11e('0x25'),_0x1c49ce,_0x987a1f*0x3e8,_0x2d6670));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x26')]=function(_0x33d578){_0x33d578=_0x33d578||_0xc11e('0x27');return this[_0xc11e('0x1e')](util[_0xc11e('0x24')]('VERBOSE\x20\x22%s\x22',_0x33d578));};AGIChannel[_0xc11e('0x1f')]['exec']=function(_0x5dcc49,_0x162ec4){if(_['isArray'](_0x162ec4)){return this[_0xc11e('0x1e')](util['format']('EXEC\x20%s\x20%s',_0x5dcc49,_0x162ec4[_0xc11e('0x28')](',')));}return this[_0xc11e('0x1e')](util['format'](_0xc11e('0x29'),_0x5dcc49,_0x162ec4));};AGIChannel['prototype'][_0xc11e('0x2a')]=function(_0x3c67c5){return this[_0xc11e('0x1e')](util[_0xc11e('0x24')](_0xc11e('0x2b'),_0x3c67c5));};AGIChannel[_0xc11e('0x1f')]['setExtension']=function(_0x4d1b79){return this[_0xc11e('0x1e')](util[_0xc11e('0x24')](_0xc11e('0x2c'),_0x4d1b79));};AGIChannel['prototype']['setPriority']=function(_0x42571f){return this[_0xc11e('0x1e')](util['format'](_0xc11e('0x2d'),_0x42571f));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0xa')]=function(){return this[_0xc11e('0x1e')](_0xc11e('0x2e'));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x2f')]=function(_0x5e4193,_0x89ed8){var _0xd51b92=_[_0xc11e('0x30')](_0x89ed8)||_[_0xc11e('0x31')](_0x89ed8)?_0x89ed8[_0xc11e('0x32')]():_0x89ed8;return this['sendRequest'](util[_0xc11e('0x24')](_0xc11e('0x33'),_0x5e4193,_0xd51b92?_0xd51b92[_0xc11e('0x32')]()[_0xc11e('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x34')]=function(_0x2a2283,_0x4d321a){return this[_0xc11e('0x1e')](util[_0xc11e('0x24')]('SAY\x20NUMBER\x20%s\x20%s',_0x2a2283,_0x4d321a));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x35')]=function(_0x365e5d,_0x47db3c){return this['sendRequest'](util[_0xc11e('0x24')](_0xc11e('0x36'),_0x365e5d,_0x47db3c));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x37')]=function(_0x405fb4,_0xac03b4){return this[_0xc11e('0x1e')](util[_0xc11e('0x24')](_0xc11e('0x38'),_0x405fb4,_0xac03b4));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x39')]=function(_0x33942e,_0x1d19bf,_0x488159){_0x1d19bf=_0x1d19bf||this[_0xc11e('0x3a')];_0x488159=_0x488159||0x1;this[_0xc11e('0x2a')](_0x33942e);this['setExtension'](_0x1d19bf);this[_0xc11e('0x3b')](_0x488159);return this[_0xc11e('0x26')](util[_0xc11e('0x24')](_0xc11e('0x3c'),_0x33942e,_0x1d19bf,_0x488159));};AGIChannel['prototype'][_0xc11e('0x3d')]=function(_0x30b47f){return this[_0xc11e('0x1e')](util[_0xc11e('0x24')](_0xc11e('0x3e'),_0x30b47f));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x3f')]=function(_0x7c5879,_0x5a7b9a,_0xaa38ec,_0x4eabb7,_0x53594a,_0x2cd87b){_0x5a7b9a=_0x5a7b9a||_0xc11e('0x40');_0xaa38ec=_0xaa38ec||'';_0x4eabb7=_0x4eabb7===undefined?-0x1:_0x4eabb7==='-1'?-0x1:_0x4eabb7*0x3e8;_0x53594a=_0x53594a===undefined?'':'s='+_0x53594a;_0x2cd87b=_0x2cd87b?'BEEP':'';return this[_0xc11e('0x1e')](util[_0xc11e('0x24')](_0xc11e('0x41'),_0x7c5879,_0x5a7b9a,_0xaa38ec,_0x4eabb7,_0x2cd87b,_0x53594a));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x42')]=function(_0x1a3ea2,_0x33be6f){_0x33be6f=_0x33be6f||'';return this[_0xc11e('0x1e')](util[_0xc11e('0x24')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x1a3ea2,_0x33be6f));};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x43')]=function(_0x2c229d){return this[_0xc11e('0x44')](_0xc11e('0x45'),_0x2c229d);};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x46')]=function(_0x5804e0){return this['exec'](_0xc11e('0x47'),_0x5804e0);};AGIChannel[_0xc11e('0x1f')][_0xc11e('0x16')]=function(_0x4fd71c,_0x43dbdb){this[_0xc11e('0x26')](util[_0xc11e('0x24')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4fd71c['id'],_0x4fd71c[_0xc11e('0x48')],_0x43dbdb));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc11e('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d08c657..fec727a 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 _0x0632=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x9b7f1e,_0x10a7e7){var _0x1c893c=function(_0x458fda){while(--_0x458fda){_0x9b7f1e['push'](_0x9b7f1e['shift']());}};_0x1c893c(++_0x10a7e7);}(_0x0632,0x7d));var _0x2063=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x0632[_0x3b6652];return _0x14d39f;};'use strict';var util=require(_0x2063('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x2063('0x1'),'E_AGI_SERVER_ERROR':_0x2063('0x2'),'E_AGI_SERVER_CLOSE':_0x2063('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x2063('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x2063('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x2063('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x2063('0x7'),'E_AGI_COMMAND_EMPTY':_0x2063('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2063('0x9'),'E_AGI_IVR_ENTRY':_0x2063('0xa')};function AGIError(_0x32d5e1){var _0x32d5e1=_0x32d5e1||null,_0x1a6672=_0x1a6672||[],_0x465214=0x1,_0x52ec01='';if(!error[_0x32d5e1]){_0x32d5e1=_0x2063('0xb');}_0x1a6672['push'](error[_0x32d5e1]);while(arguments[_0x465214]){_0x1a6672[_0x2063('0xc')](arguments[_0x465214]);_0x465214++;}_0x52ec01=util['format'][_0x2063('0xd')](util,_0x1a6672);this[_0x2063('0xe')]=_0x52ec01;this[_0x2063('0xf')]=_0x32d5e1;}module['exports']=AGIError; \ No newline at end of file +var _0xf75e=['Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x334b22,_0xdeb4a1){var _0x41dee7=function(_0x3c1764){while(--_0x3c1764){_0x334b22['push'](_0x334b22['shift']());}};_0x41dee7(++_0xdeb4a1);}(_0xf75e,0x1d7));var _0xef75=function(_0x5d8ed0,_0x227783){_0x5d8ed0=_0x5d8ed0-0x0;var _0x401b08=_0xf75e[_0x5d8ed0];return _0x401b08;};'use strict';var util=require(_0xef75('0x0'));var error={'E_AGI_UNDEFINED':_0xef75('0x1'),'E_AGI_ARGUMENT_PORT':_0xef75('0x2'),'E_AGI_SERVER_ERROR':_0xef75('0x3'),'E_AGI_SERVER_CLOSE':_0xef75('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xef75('0x5'),'E_AGI_SOCKET_ERROR':_0xef75('0x6'),'E_AGI_SOCKET_CLOSE':_0xef75('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xef75('0x8'),'E_AGI_COMMAND_EMPTY':_0xef75('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xef75('0xa')};function AGIError(_0x50a323){var _0x50a323=_0x50a323||null,_0x338a5f=_0x338a5f||[],_0x1174e7=0x1,_0x96da10='';if(!error[_0x50a323]){_0x50a323=_0xef75('0xb');}_0x338a5f[_0xef75('0xc')](error[_0x50a323]);while(arguments[_0x1174e7]){_0x338a5f[_0xef75('0xc')](arguments[_0x1174e7]);_0x1174e7++;}_0x96da10=util[_0xef75('0xd')]['apply'](util,_0x338a5f);this[_0xef75('0xe')]=_0x96da10;this[_0xef75('0xf')]=_0x50a323;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 3104702..0418307 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 _0x56e5=['parse','projectUpdate','lodash','events','EventEmitter','ioredis','./error','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message'];(function(_0x2645c6,_0x47b0e8){var _0x1faa54=function(_0x5694d1){while(--_0x5694d1){_0x2645c6['push'](_0x2645c6['shift']());}};_0x1faa54(++_0x47b0e8);}(_0x56e5,0x197));var _0x556e=function(_0x4b84ae,_0x26f981){_0x4b84ae=_0x4b84ae-0x0;var _0x3325f8=_0x56e5[_0x4b84ae];return _0x3325f8;};'use strict';var _=require(_0x556e('0x0'));var EventEmitter=require(_0x556e('0x1'))[_0x556e('0x2')];var Redis=require(_0x556e('0x3'));var AGIError=require(_0x556e('0x4'));var config=require('../../config/environment');config[_0x556e('0x5')]=_['defaults'](config['redis'],{'host':_0x556e('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x556e('0x7')](_0x556e('0x8'),function(_0x3ff164){if(_0x3ff164)return eventEmitter[_0x556e('0x9')](_0x556e('0xa'),new AGIError(_0x556e('0xb'),_0x3ff164));});sub['on'](_0x556e('0xc'),function(_0x95ca7a,_0x2298b1){if(_0x95ca7a!=='agi')return;try{var _0x5b5e41=JSON[_0x556e('0xd')](_0x2298b1);eventEmitter[_0x556e('0x9')](_0x556e('0xe'),_0x5b5e41);}catch(_0x5c4f7a){eventEmitter['emit'](_0x556e('0xa'),new AGIError(_0x556e('0xb'),_0x5c4f7a));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xafe1=['exports','EventEmitter','ioredis','../../config/environment','redis','defaults','localhost','agi','error','E_AGI_SERVER_ERROR','message','parse','emit'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xafe1,0x83));var _0x1afe=function(_0x1b2971,_0xc76e70){_0x1b2971=_0x1b2971-0x0;var _0x2882d1=_0xafe1[_0x1b2971];return _0x2882d1;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x1afe('0x0')];var Redis=require(_0x1afe('0x1'));var AGIError=require('./error');var config=require(_0x1afe('0x2'));config[_0x1afe('0x3')]=_[_0x1afe('0x4')](config[_0x1afe('0x3')],{'host':_0x1afe('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1afe('0x3')]);sub['subscribe'](_0x1afe('0x6'),function(_0x3576c3){if(_0x3576c3)return eventEmitter['emit'](_0x1afe('0x7'),new AGIError(_0x1afe('0x8'),_0x3576c3));});sub['on'](_0x1afe('0x9'),function(_0x432f76,_0x3b3329){if(_0x432f76!==_0x1afe('0x6'))return;try{var _0x1a3346=JSON[_0x1afe('0xa')](_0x3b3329);eventEmitter[_0x1afe('0xb')]('projectUpdate',_0x1a3346);}catch(_0x317f98){eventEmitter[_0x1afe('0xb')](_0x1afe('0x7'),new AGIError(_0x1afe('0x8'),_0x317f98));}});module[_0x1afe('0xc')]={'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 af213ac..8a6c5dc 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 _0xfde1=['getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','size','getVertex','traverseBFS','no\x20vertex\x20found','stop\x20traverse','info','no\x20edge/s\x20available','condition','split','length','agicommand','vswitch','target','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits'];(function(_0x101c7b,_0x4df652){var _0x16a6f2=function(_0x21fc98){while(--_0x21fc98){_0x101c7b['push'](_0x101c7b['shift']());}};_0x16a6f2(++_0x4df652);}(_0xfde1,0x1d7));var _0x1fde=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfde1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1fde('0x0'));var logger=require(_0x1fde('0x1'))(_0x1fde('0x2'));var verticesWithRetry=[_0x1fde('0x3'),_0x1fde('0x4'),_0x1fde('0x5')];var Graph=function(){this[_0x1fde('0x6')]={};this[_0x1fde('0x7')]={};this[_0x1fde('0x8')]=0x0;};Graph[_0x1fde('0x9')][_0x1fde('0xa')]=function(_0x3e6799){this[_0x1fde('0x6')][_0x3e6799['id']]=_0x3e6799;this[_0x1fde('0x7')][_0x3e6799['id']]=[];};Graph[_0x1fde('0x9')]['addEdge']=function(_0x24c931,_0x26dc2b,_0x40f625){this['edges'][_0x24c931]['push']({'target':_0x26dc2b,'condition':_0x40f625});this[_0x1fde('0x8')]+=0x1;};Graph[_0x1fde('0x9')][_0x1fde('0xb')]=function(){return _['size'](this[_0x1fde('0x6')]);};Graph[_0x1fde('0x9')]['relations']=function(){return this[_0x1fde('0x8')];};Graph[_0x1fde('0x9')][_0x1fde('0xc')]=function(_0x11ab29){return this[_0x1fde('0x6')][_0x11ab29];};Graph[_0x1fde('0x9')][_0x1fde('0xd')]=function(_0x20a702,_0x2150b4){if(!this[_0x1fde('0x6')][_0x20a702]){return logger['info'](_0x1fde('0xe'));}var _0x2394d6=_0x2150b4(this[_0x1fde('0x6')][_0x20a702]);if(!_0x2394d6){return logger['info'](_0x1fde('0xf'));}if(this[_0x1fde('0x7')][_0x20a702]['length']===0x0){return logger[_0x1fde('0x10')](_0x1fde('0x11'));}for(var _0x2ef845=0x0,_0x402216=[],_0x2b89e9=![];_0x2ef845\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','catch','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','then','[LICENSE]','finally'];(function(_0x24db47,_0x369ba0){var _0x248c57=function(_0x1b1926){while(--_0x1b1926){_0x24db47['push'](_0x24db47['shift']());}};_0x248c57(++_0x369ba0);}(_0x778a,0xfb));var _0xa778=function(_0x44731a,_0x3417bb){_0x44731a=_0x44731a-0x0;var _0x5541bd=_0x778a[_0x44731a];return _0x5541bd;};'use strict';var _=require(_0xa778('0x0'));var syncho=require(_0xa778('0x1'));var util=require(_0xa778('0x2'));var config=require(_0xa778('0x3'));var logger=require(_0xa778('0x4'))(_0xa778('0x5'));var utilLicense=require(_0xa778('0x6'));var rpc=require(_0xa778('0x7'));var Project=require('./project');var AGIEmitter=require('./events')[_0xa778('0x8')];var projects=[];config[_0xa778('0x5')]=_[_0xa778('0x9')](config[_0xa778('0x5')],{'ip':_0xa778('0xa'),'port':0x11dd});AGIEmitter['on'](_0xa778('0xb'),projectUpdateHandler);function connectionHandler(_0x42ec3f){process[_0xa778('0xc')](function(){syncho(function(){try{setChannelVariables(_0x42ec3f);agiHandler(_0x42ec3f);}catch(_0x358542){logger[_0xa778('0xd')](_0x358542[_0xa778('0xe')]);}});});}function projectUpdateHandler(_0x432e18){try{var _0x146c17=_[_0xa778('0xf')](projects,['id',_0x432e18['id']]);if(_0x146c17>-0x1){if(_0x432e18[_0xa778('0x10')]===!![]){projects['splice'](_0x146c17,0x1);}else{projects[_0x146c17]=_0x432e18;}}else{projects[_0xa778('0x11')](_0x432e18);}}catch(_0x474e4b){logger[_0xa778('0xd')](_0x474e4b['stack']);}}function listeningHandler(){console[_0xa778('0x12')](_0xa778('0x13'),config[_0xa778('0x5')]['port']);logger[_0xa778('0x14')](util[_0xa778('0x15')](_0xa778('0x16'),config[_0xa778('0x5')]['ip'],config[_0xa778('0x5')][_0xa778('0x17')]));}function errorHandler(_0xfc5e8c){if(_0xfc5e8c&&_0xfc5e8c['name']&&_0xfc5e8c[_0xa778('0x18')]){logger['error'](util[_0xa778('0x15')](_0xa778('0x19'),_0xfc5e8c[_0xa778('0x1a')],_0xfc5e8c[_0xa778('0x18')]));}else{logger[_0xa778('0xd')](util[_0xa778('0x15')](_0xa778('0x1b'),_0xfc5e8c['stack']));}}function closeHandler(){logger[_0xa778('0x14')](util['format'](_0xa778('0x1c'),this[_0xa778('0x1d')],this[_0xa778('0x1e')],this['callerid'],this[_0xa778('0x1f')],this[_0xa778('0x20')]));try{createSquareReport(this);}catch(_0x4ef21a){logger[_0xa778('0xd')](_0x4ef21a['stack']);}}function timeoutHandler(){logger[_0xa778('0x14')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa778('0x1d')],this[_0xa778('0x1e')],this['callerid'],this[_0xa778('0x1f')],this[_0xa778('0x20')]));}function hangupHandler(){logger[_0xa778('0x14')](util[_0xa778('0x15')](_0xa778('0x21'),this[_0xa778('0x1d')],this[_0xa778('0x1e')],this[_0xa778('0x22')],this[_0xa778('0x1f')],this[_0xa778('0x20')]));this[_0xa778('0x23')]=!![];}function createSquareReport(_0x1fc6d4,_0x22dbe2){rpc['createSquareReport'](_0x1fc6d4)['then'](function(_0x10e58b){if(_0x22dbe2){_0x22dbe2(null,_0x10e58b);}})[_0xa778('0x24')](function(_0x213f0d){if(_0x22dbe2){_0x22dbe2(null,_0x213f0d);}});}function setChannelVariables(_0x9f7ac9){for(var _0x36d111 in _0x9f7ac9){if(_0x9f7ac9['hasOwnProperty'](_0x36d111)){if(_0x36d111[_0xa778('0x25')](_0xa778('0x26'))===0x0){_0x9f7ac9[_0x36d111['substring'](0x4)]=_0x9f7ac9[_0x36d111];delete _0x9f7ac9[_0x36d111];}}}}function agiHandler(_0x2fa166){logger[_0xa778('0x27')](_0xa778('0x28'),JSON[_0xa778('0x29')](_0x2fa166,null,0x2));logger[_0xa778('0x14')](util[_0xa778('0x15')](_0xa778('0x2a'),_0x2fa166[_0xa778('0x1d')],_0x2fa166['calleridname'],_0x2fa166['callerid'],_0x2fa166[_0xa778('0x1f')],_0x2fa166[_0xa778('0x20')]));_0x2fa166['on'](_0xa778('0xd'),errorHandler);_0x2fa166['on']('close',closeHandler);_0x2fa166['on'](_0xa778('0x2b'),timeoutHandler);_0x2fa166[_0xa778('0x23')]=![];_0x2fa166['on'](_0xa778('0x2c'),hangupHandler);var _0x27691a=_[_0xa778('0x2d')](projects,['name',_0x2fa166['arg_1']]);if(!_0x27691a)return Project[_0xa778('0x2e')](_0x2fa166);if(!_0x27691a[_0xa778('0x2f')])return Project[_0xa778('0x30')](_0x2fa166);return Project[_0xa778('0x31')](_0x27691a,_0x2fa166);}function main(){var _0x31a602;return utilLicense['getLicense']()['then'](function(_0x318249){if(!_0x318249)return;if(_0x318249[_0xa778('0x32')]){if(_0x318249[_0xa778('0x33')]&&_0x318249[_0xa778('0x33')]>0x0){logger[_0xa778('0x14')](util['format'](_0xa778('0x34'),_0x318249[_0xa778('0x33')]));_0x31a602=_0x318249['callysquare'];}else{logger[_0xa778('0x14')](_0xa778('0x35'));}}else{logger[_0xa778('0x14')](_0xa778('0x36'));_0x31a602=-0x1;}})['then'](function(){return Project[_0xa778('0x37')]();})[_0xa778('0x38')](function(_0x3463a0){projects=_0x3463a0;return;})[_0xa778('0x24')](function(_0x27b353){logger['error'](_0xa778('0x39'),_0x27b353['stack']);})[_0xa778('0x3a')](function(){var _0xd28ef=require(_0xa778('0x3b'))(config[_0xa778('0x5')]['port'],config['agi']['ip'],_0x31a602);_0xd28ef['on'](_0xa778('0xd'),errorHandler);_0xd28ef['on'](_0xa778('0x3c'),listeningHandler);_0xd28ef['on']('connection',connectionHandler);_0xd28ef['on'](_0xa778('0x3d'),closeHandler);});}main(); \ No newline at end of file +var _0x6269=['syncho','../../config/environment','../../config/logger','agi','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','findIndex','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','error','[%s]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','hasOwnProperty','indexOf','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','production','handleUnpublished','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','./server','listening','connection','lodash'];(function(_0x37f934,_0x3465d3){var _0x24190e=function(_0x33b7a3){while(--_0x33b7a3){_0x37f934['push'](_0x37f934['shift']());}};_0x24190e(++_0x3465d3);}(_0x6269,0x1af));var _0x9626=function(_0x4e643f,_0x15fc94){_0x4e643f=_0x4e643f-0x0;var _0x5029ee=_0x6269[_0x4e643f];return _0x5029ee;};'use strict';var _=require(_0x9626('0x0'));var syncho=require(_0x9626('0x1'));var util=require('util');var config=require(_0x9626('0x2'));var logger=require(_0x9626('0x3'))(_0x9626('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x9626('0x5'));var Project=require(_0x9626('0x6'));var AGIEmitter=require(_0x9626('0x7'))[_0x9626('0x8')];var projects=[];config[_0x9626('0x4')]=_[_0x9626('0x9')](config['agi'],{'ip':_0x9626('0xa'),'port':0x11dd});AGIEmitter['on'](_0x9626('0xb'),projectUpdateHandler);function connectionHandler(_0x1077d5){process[_0x9626('0xc')](function(){syncho(function(){try{setChannelVariables(_0x1077d5);agiHandler(_0x1077d5);}catch(_0x15508a){logger['error'](_0x15508a['stack']);}});});}function projectUpdateHandler(_0x28fc4a){try{var _0x2001b6=_[_0x9626('0xd')](projects,['id',_0x28fc4a['id']]);if(_0x2001b6>-0x1){if(_0x28fc4a['deleted']===!![]){projects[_0x9626('0xe')](_0x2001b6,0x1);}else{projects[_0x2001b6]=_0x28fc4a;}}else{projects['push'](_0x28fc4a);}}catch(_0x45ecf2){logger['error'](_0x45ecf2['stack']);}}function listeningHandler(){console[_0x9626('0xf')](_0x9626('0x10'),config[_0x9626('0x4')][_0x9626('0x11')]);logger[_0x9626('0x12')](util[_0x9626('0x13')](_0x9626('0x14'),config[_0x9626('0x4')]['ip'],config[_0x9626('0x4')]['port']));}function errorHandler(_0x366319){if(_0x366319&&_0x366319[_0x9626('0x15')]&&_0x366319[_0x9626('0x16')]){logger[_0x9626('0x17')](util[_0x9626('0x13')](_0x9626('0x18'),_0x366319[_0x9626('0x15')],_0x366319['message']));}else{logger[_0x9626('0x17')](util[_0x9626('0x13')]('[ERROR]\x20%s',_0x366319[_0x9626('0x19')]));}}function closeHandler(){logger[_0x9626('0x12')](util[_0x9626('0x13')](_0x9626('0x1a'),this[_0x9626('0x1b')],this[_0x9626('0x1c')],this['callerid'],this[_0x9626('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x584690){logger['error'](_0x584690[_0x9626('0x19')]);}}function timeoutHandler(){logger[_0x9626('0x12')](util['format'](_0x9626('0x1e'),this['arg_1'],this[_0x9626('0x1c')],this[_0x9626('0x1f')],this[_0x9626('0x1d')],this[_0x9626('0x20')]));}function hangupHandler(){logger[_0x9626('0x12')](util[_0x9626('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x9626('0x1b')],this['calleridname'],this[_0x9626('0x1f')],this['dnid'],this[_0x9626('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0x9eec9,_0x14d257){rpc['createSquareReport'](_0x9eec9)['then'](function(_0x5b1507){if(_0x14d257){_0x14d257(null,_0x5b1507);}})['catch'](function(_0x2e5b08){if(_0x14d257){_0x14d257(null,_0x2e5b08);}});}function setChannelVariables(_0x41713b){for(var _0x1a3c15 in _0x41713b){if(_0x41713b[_0x9626('0x21')](_0x1a3c15)){if(_0x1a3c15[_0x9626('0x22')]('agi_')===0x0){_0x41713b[_0x1a3c15['substring'](0x4)]=_0x41713b[_0x1a3c15];delete _0x41713b[_0x1a3c15];}}}}function agiHandler(_0x5bd57a){logger[_0x9626('0x23')](_0x9626('0x24'),JSON[_0x9626('0x25')](_0x5bd57a,null,0x2));logger['info'](util[_0x9626('0x13')](_0x9626('0x26'),_0x5bd57a[_0x9626('0x1b')],_0x5bd57a[_0x9626('0x1c')],_0x5bd57a['callerid'],_0x5bd57a[_0x9626('0x1d')],_0x5bd57a[_0x9626('0x20')]));_0x5bd57a['on']('error',errorHandler);_0x5bd57a['on']('close',closeHandler);_0x5bd57a['on']('timeout',timeoutHandler);_0x5bd57a[_0x9626('0x27')]=![];_0x5bd57a['on']('hangup',hangupHandler);var _0x13f7f3=_['find'](projects,[_0x9626('0x15'),_0x5bd57a[_0x9626('0x1b')]]);if(!_0x13f7f3)return Project['handleNotFound'](_0x5bd57a);if(!_0x13f7f3[_0x9626('0x28')])return Project[_0x9626('0x29')](_0x5bd57a);return Project['initialize'](_0x13f7f3,_0x5bd57a);}function main(){var _0x3eb4ba;return utilLicense[_0x9626('0x2a')]()[_0x9626('0x2b')](function(_0x286791){if(!_0x286791)return;if(_0x286791[_0x9626('0x2c')]){if(_0x286791[_0x9626('0x2d')]&&_0x286791['callysquare']>0x0){logger[_0x9626('0x12')](util[_0x9626('0x13')](_0x9626('0x2e'),_0x286791[_0x9626('0x2d')]));_0x3eb4ba=_0x286791[_0x9626('0x2d')];}else{logger['info'](_0x9626('0x2f'));}}else{logger['info'](_0x9626('0x30'));_0x3eb4ba=-0x1;}})[_0x9626('0x2b')](function(){return Project['getAll']();})[_0x9626('0x2b')](function(_0x2eb398){projects=_0x2eb398;return;})[_0x9626('0x31')](function(_0x175a81){logger['error'](_0x9626('0x32'),_0x175a81[_0x9626('0x19')]);})['finally'](function(){var _0x75fcc4=require(_0x9626('0x33'))(config[_0x9626('0x4')][_0x9626('0x11')],config[_0x9626('0x4')]['ip'],_0x3eb4ba);_0x75fcc4['on']('error',errorHandler);_0x75fcc4['on'](_0x9626('0x34'),listeningHandler);_0x75fcc4['on'](_0x9626('0x35'),connectionHandler);_0x75fcc4['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 53e9540..5ae200c 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 _0x7fce=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then','error','message'];(function(_0x5b3fb5,_0xdbf661){var _0x3113d9=function(_0x15a34e){while(--_0x15a34e){_0x5b3fb5['push'](_0x5b3fb5['shift']());}};_0x3113d9(++_0xdbf661);}(_0x7fce,0x9e));var _0xe7fc=function(_0x4eb2c9,_0x4af956){_0x4eb2c9=_0x4eb2c9-0x0;var _0x4f6588=_0x7fce[_0x4eb2c9];return _0x4f6588;};'use strict';var BPromise=require(_0xe7fc('0x0'));var jayson=require(_0xe7fc('0x1'));var client=jayson[_0xe7fc('0x2')][_0xe7fc('0x3')]({'port':0x232b});function request(_0x15db28,_0x492d93){return new BPromise(function(_0x3e7342,_0x12c2e3){return client['request'](_0x15db28,_0x492d93)[_0xe7fc('0x4')](function(_0x1e72b5){if(_0x1e72b5[_0xe7fc('0x5')]){return _0x12c2e3(_0x1e72b5[_0xe7fc('0x5')][_0xe7fc('0x6')]);}else{return _0x3e7342(_0x1e72b5[_0xe7fc('0x7')]);}})[_0xe7fc('0x8')](function(_0x45aed1){return _0x12c2e3(_0x45aed1);});});}exports[_0xe7fc('0x9')]=function(_0x10d6f3,_0xfb0278){return request(_0xe7fc('0xa'),{'account':_0x10d6f3,'message':_0xfb0278});}; \ No newline at end of file +var _0x4350=['sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','message','catch'];(function(_0x3c8261,_0x5f02e5){var _0x7e7218=function(_0x2e0a08){while(--_0x2e0a08){_0x3c8261['push'](_0x3c8261['shift']());}};_0x7e7218(++_0x5f02e5);}(_0x4350,0x192));var _0x0435=function(_0x74b1a9,_0x414165){_0x74b1a9=_0x74b1a9-0x0;var _0x46ff5a=_0x4350[_0x74b1a9];return _0x46ff5a;};'use strict';var BPromise=require(_0x0435('0x0'));var jayson=require(_0x0435('0x1'));var client=jayson[_0x0435('0x2')][_0x0435('0x3')]({'port':0x232b});function request(_0x73de26,_0x57ef96){return new BPromise(function(_0x865fcf,_0xcd6ce5){return client[_0x0435('0x4')](_0x73de26,_0x57ef96)[_0x0435('0x5')](function(_0x196a3e){if(_0x196a3e['error']){return _0xcd6ce5(_0x196a3e['error'][_0x0435('0x6')]);}else{return _0x865fcf(_0x196a3e['result']);}})[_0x0435('0x7')](function(_0x285982){return _0xcd6ce5(_0x285982);});});}exports[_0x0435('0x8')]=function(_0x19333d,_0x17a8c6){return request(_0x0435('0x9'),{'account':_0x19333d,'message':_0x17a8c6});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 8953998..55e07b6 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 _0x2309=['start','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','clear','[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','context','continueAt','close','Project\x20%s\x20not\x20found','lodash','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','length','addEdge','source','target','value','toJson','mxGraphModel','root','inspect','production','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','arg_1','calleridname','callerid','dnid','traverseBFS'];(function(_0x9d21bd,_0x37450b){var _0x5ae55a=function(_0x195d57){while(--_0x195d57){_0x9d21bd['push'](_0x9d21bd['shift']());}};_0x5ae55a(++_0x37450b);}(_0x2309,0x143));var _0x9230=function(_0x166fbf,_0x538fa7){_0x166fbf=_0x166fbf-0x0;var _0x48ed24=_0x2309[_0x166fbf];return _0x48ed24;};'use strict';var _=require(_0x9230('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require(_0x9230('0x1'));var logger=require(_0x9230('0x2'))(_0x9230('0x3'));var rpc=require(_0x9230('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0x9230('0x5'));var Vertices=require(_0x9230('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9230('0x7')]()[_0x9230('0x8')](function(_0x2ce4cf){logger[_0x9230('0x9')](_0x9230('0xa'),_0x2ce4cf[_0x9230('0xb')]);return[];});}function addVertex(_0x33fc25,_0x1460f3,_0x168dfa){_0x1460f3[_0x9230('0xc')]=_0x168dfa;if(_0x1460f3[_0x9230('0xd')]('retry')){_0x1460f3['maxRetry']=parseInt(_0x1460f3[_0x9230('0xe')],0xa);}_0x33fc25['addVertex'](_[_0x9230('0xf')](_0x1460f3,'mxCell'));}function initGraph(_0x2f8485,_0x26f93a){var _0x313e1d=new Graph();for(var _0x457f35 in _0x2f8485){if(_0x2f8485[_0x9230('0xd')](_0x457f35)){if(_['isArray'](_0x2f8485[_0x457f35])){for(var _0x4760d8=0x0;_0x4760d8<_0x2f8485[_0x457f35][_0x9230('0x10')];_0x4760d8+=0x1){addVertex(_0x313e1d,_0x2f8485[_0x457f35][_0x4760d8],_0x457f35);}}else{addVertex(_0x313e1d,_0x2f8485[_0x457f35],_0x457f35);}}}for(var _0x206eb6=0x0;_0x206eb6<_0x26f93a['length'];_0x206eb6+=0x1){if(_0x26f93a[_0x206eb6]['source']&&_0x26f93a[_0x206eb6]['target']){_0x313e1d[_0x9230('0x11')](_0x26f93a[_0x206eb6][_0x9230('0x12')],_0x26f93a[_0x206eb6][_0x9230('0x13')],_0x26f93a[_0x206eb6][_0x9230('0x14')]);}}return _0x313e1d;}function getRoot(_0x385059){return parser[_0x9230('0x15')](_0x385059,{'object':!![]})[_0x9230('0x16')][_0x9230('0x17')];}function inspect(_0x2e1b2f){return util[_0x9230('0x18')](_0x2e1b2f,{'showHidden':![],'depth':null});}function initialize(_0x22f841,_0x5ee67f){var _0x261d96=getRoot(_0x22f841[_0x9230('0x19')]);if(!_0x261d96||!_0x261d96['start'])return;var _0x46d7a2,_0x318c0e,_0x3ea1d4;logger['debug']('root',JSON[_0x9230('0x1a')](_0x261d96,null,0x2));_0x5ee67f[_0x9230('0x1b')]=moment()[_0x9230('0x1c')](_0x9230('0x1d'));_0x46d7a2=initGraph(_[_0x9230('0xf')](_0x261d96,_0x9230('0x1e')),_0x261d96[_0x9230('0x1e')]);_0x318c0e=new Vertices(_0x5ee67f,rpc,mailRpc);logger[_0x9230('0x1f')](util[_0x9230('0x1c')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5ee67f[_0x9230('0x20')],_0x5ee67f[_0x9230('0x21')],_0x5ee67f[_0x9230('0x22')],_0x5ee67f[_0x9230('0x23')],_0x5ee67f['uniqueid']));_0x46d7a2[_0x9230('0x24')](_0x261d96[_0x9230('0x25')]['id'],function(_0x12a005){try{_0x12a005=_0x318c0e['clear'](_0x12a005);logger[_0x9230('0x26')](_0x9230('0x27'),JSON[_0x9230('0x1a')](_0x12a005,null,0x2));if(_0x12a005[_0x9230('0xc')]===_0x9230('0x28')){logger[_0x9230('0x1f')](_0x9230('0x29'));_0x5ee67f['context']=_0x12a005['context']||_0x5ee67f['context'];_0x5ee67f[_0x9230('0x2a')]=_0x12a005['extension'];_0x5ee67f[_0x9230('0x2b')]=_0x12a005[_0x9230('0x2b')]?_0x12a005['priority']-0x1:0x1;return null;}else if(_0x12a005&&_0x318c0e[_0x12a005['agicommand']]){_0x3ea1d4=_0x318c0e[_0x12a005[_0x9230('0xc')]](_0x12a005);logger[_0x9230('0x1f')]('response',JSON['stringify'](_0x3ea1d4,null,0x2));if(_0x3ea1d4&&_0x3ea1d4[_0x9230('0x2c')]===AGI_CODE_SUCCESS&&_0x3ea1d4[_0x9230('0x2d')]!==AGI_RESULT_ERROR&&!_0x5ee67f['evtHangup']){logger[_0x9230('0x26')](_0x9230('0x2e'),inspect(_0x3ea1d4));return _[_0x9230('0x2f')](_0x3ea1d4[_0x9230('0x2d')])?null:_0x3ea1d4['result'][_0x9230('0x30')]();}else{logger['error'](_0x9230('0x2e'),inspect(_0x3ea1d4));return null;}}else{logger[_0x9230('0x9')](_0x9230('0x31'));return null;}}catch(_0x126a2b){logger[_0x9230('0x9')](_0x126a2b[_0x9230('0xb')]);return null;}});if(_0x261d96[_0x9230('0x32')]){logger[_0x9230('0x1f')](util[_0x9230('0x1c')](_0x9230('0x33'),_0x5ee67f['arg_1'],_0x5ee67f[_0x9230('0x21')],_0x5ee67f[_0x9230('0x22')],_0x5ee67f[_0x9230('0x23')],_0x5ee67f[_0x9230('0x34')]));_0x46d7a2[_0x9230('0x24')](_0x261d96[_0x9230('0x32')]['id'],function(_0x1f6432){try{_0x1f6432=_0x318c0e[_0x9230('0x35')](_0x1f6432);logger[_0x9230('0x26')]('vertex',JSON[_0x9230('0x1a')](_0x1f6432,null,0x2));if(_0x1f6432&&_0x318c0e[_0x1f6432['agicommand']]){_0x3ea1d4=_0x318c0e[_0x1f6432[_0x9230('0xc')]](_0x1f6432);if(_0x3ea1d4){logger[_0x9230('0x26')](_0x9230('0x2e'),inspect(_0x3ea1d4));return _[_0x9230('0x2f')](_0x3ea1d4[_0x9230('0x2d')])?null:_0x3ea1d4[_0x9230('0x2d')][_0x9230('0x30')]();}else{logger[_0x9230('0x9')](_0x9230('0x2e'),inspect(_0x3ea1d4));return null;}}else{logger[_0x9230('0x9')](_0x9230('0x31'));return null;}}catch(_0x42b143){logger[_0x9230('0x9')](_0x42b143['stack']);return null;}});}logger['info'](util[_0x9230('0x1c')](_0x9230('0x36'),_0x5ee67f[_0x9230('0x20')],_0x5ee67f[_0x9230('0x21')],_0x5ee67f[_0x9230('0x22')],_0x5ee67f['dnid'],_0x5ee67f[_0x9230('0x34')]));logger['info'](util['format'](_0x9230('0x37'),_0x5ee67f[_0x9230('0x38')],_0x5ee67f[_0x9230('0x2a')],parseInt(_0x5ee67f['priority'],0xa)+0x1));_0x5ee67f[_0x9230('0x39')](_0x5ee67f[_0x9230('0x38')],_0x5ee67f[_0x9230('0x2a')],parseInt(_0x5ee67f[_0x9230('0x2b')],0xa)+0x1);_0x5ee67f[_0x9230('0x3a')]();}function handleNotFound(_0x2bd19d){logger[_0x9230('0x9')](util[_0x9230('0x1c')](_0x9230('0x3b'),_0x2bd19d['arg_1']));_0x2bd19d[_0x9230('0x39')](_0x2bd19d[_0x9230('0x38')],_0x2bd19d['extension'],parseInt(_0x2bd19d[_0x9230('0x2b')],0xa)+0x1);_0x2bd19d[_0x9230('0x3a')]();}function handleUnpublished(_0x28677a){logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x28677a[_0x9230('0x20')]));_0x28677a[_0x9230('0x39')](_0x28677a[_0x9230('0x38')],_0x28677a[_0x9230('0x2a')],parseInt(_0x28677a[_0x9230('0x2b')],0xa)+0x1);_0x28677a[_0x9230('0x3a')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xcfc5=['callerid','uniqueid','clear','vertex','agicommand','gotoc','context','extension','priority','response','code','result','isUndefined','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','traverseBFS','finally','format','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','value','toJson','root','inspect','production','start','debug','stringify','joinAt','info'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcfc5,0x98));var _0x5cfc=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xcfc5[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x5cfc('0x0'));var moment=require(_0x5cfc('0x1'));var parser=require(_0x5cfc('0x2'));var util=require(_0x5cfc('0x3'));var logger=require(_0x5cfc('0x4'))(_0x5cfc('0x5'));var rpc=require(_0x5cfc('0x6'));var mailRpc=require(_0x5cfc('0x7'));var Graph=require('./graph');var Vertices=require(_0x5cfc('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x5cfc('0x9')]()[_0x5cfc('0xa')](function(_0x1e67e2){logger[_0x5cfc('0xb')](_0x5cfc('0xc'),_0x1e67e2[_0x5cfc('0xd')]);return[];});}function addVertex(_0x5cc372,_0x1701eb,_0x127cfb){_0x1701eb['agicommand']=_0x127cfb;if(_0x1701eb['hasOwnProperty'](_0x5cfc('0xe'))){_0x1701eb['maxRetry']=parseInt(_0x1701eb[_0x5cfc('0xe')],0xa);}_0x5cc372[_0x5cfc('0xf')](_[_0x5cfc('0x10')](_0x1701eb,_0x5cfc('0x11')));}function initGraph(_0x515a3d,_0x1986fe){var _0x4a0e9a=new Graph();for(var _0x2a5dc1 in _0x515a3d){if(_0x515a3d[_0x5cfc('0x12')](_0x2a5dc1)){if(_[_0x5cfc('0x13')](_0x515a3d[_0x2a5dc1])){for(var _0x4bf09d=0x0;_0x4bf09d<_0x515a3d[_0x2a5dc1][_0x5cfc('0x14')];_0x4bf09d+=0x1){addVertex(_0x4a0e9a,_0x515a3d[_0x2a5dc1][_0x4bf09d],_0x2a5dc1);}}else{addVertex(_0x4a0e9a,_0x515a3d[_0x2a5dc1],_0x2a5dc1);}}}for(var _0x2a94b9=0x0;_0x2a94b9<_0x1986fe[_0x5cfc('0x14')];_0x2a94b9+=0x1){if(_0x1986fe[_0x2a94b9][_0x5cfc('0x15')]&&_0x1986fe[_0x2a94b9]['target']){_0x4a0e9a[_0x5cfc('0x16')](_0x1986fe[_0x2a94b9]['source'],_0x1986fe[_0x2a94b9][_0x5cfc('0x17')],_0x1986fe[_0x2a94b9][_0x5cfc('0x18')]);}}return _0x4a0e9a;}function getRoot(_0x5dc08a){return parser[_0x5cfc('0x19')](_0x5dc08a,{'object':!![]})['mxGraphModel'][_0x5cfc('0x1a')];}function inspect(_0x1b12bc){return util[_0x5cfc('0x1b')](_0x1b12bc,{'showHidden':![],'depth':null});}function initialize(_0xad9676,_0x148505){var _0x476cd4=getRoot(_0xad9676[_0x5cfc('0x1c')]);if(!_0x476cd4||!_0x476cd4[_0x5cfc('0x1d')])return;var _0x5453f2,_0x4b4296,_0x144388;logger[_0x5cfc('0x1e')](_0x5cfc('0x1a'),JSON[_0x5cfc('0x1f')](_0x476cd4,null,0x2));_0x148505[_0x5cfc('0x20')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5453f2=initGraph(_[_0x5cfc('0x10')](_0x476cd4,_0x5cfc('0x11')),_0x476cd4[_0x5cfc('0x11')]);_0x4b4296=new Vertices(_0x148505,rpc,mailRpc);logger[_0x5cfc('0x21')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x148505['arg_1'],_0x148505['calleridname'],_0x148505[_0x5cfc('0x22')],_0x148505['dnid'],_0x148505[_0x5cfc('0x23')]));_0x5453f2['traverseBFS'](_0x476cd4[_0x5cfc('0x1d')]['id'],function(_0xf3a89e){try{_0xf3a89e=_0x4b4296[_0x5cfc('0x24')](_0xf3a89e);logger[_0x5cfc('0x1e')](_0x5cfc('0x25'),JSON['stringify'](_0xf3a89e,null,0x2));if(_0xf3a89e[_0x5cfc('0x26')]===_0x5cfc('0x27')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x148505['context']=_0xf3a89e[_0x5cfc('0x28')]||_0x148505['context'];_0x148505[_0x5cfc('0x29')]=_0xf3a89e[_0x5cfc('0x29')];_0x148505[_0x5cfc('0x2a')]=_0xf3a89e[_0x5cfc('0x2a')]?_0xf3a89e[_0x5cfc('0x2a')]-0x1:0x1;return null;}else if(_0xf3a89e&&_0x4b4296[_0xf3a89e[_0x5cfc('0x26')]]){_0x144388=_0x4b4296[_0xf3a89e[_0x5cfc('0x26')]](_0xf3a89e);logger[_0x5cfc('0x21')](_0x5cfc('0x2b'),JSON[_0x5cfc('0x1f')](_0x144388,null,0x2));if(_0x144388&&_0x144388[_0x5cfc('0x2c')]===AGI_CODE_SUCCESS&&_0x144388[_0x5cfc('0x2d')]!==AGI_RESULT_ERROR&&!_0x148505['evtHangup']){logger['debug']('response',inspect(_0x144388));return _[_0x5cfc('0x2e')](_0x144388[_0x5cfc('0x2d')])?null:_0x144388['result']['toString']();}else{logger[_0x5cfc('0xb')](_0x5cfc('0x2b'),inspect(_0x144388));return null;}}else{logger[_0x5cfc('0xb')](_0x5cfc('0x2f'));return null;}}catch(_0x5b9857){logger[_0x5cfc('0xb')](_0x5b9857[_0x5cfc('0xd')]);return null;}});if(_0x476cd4['finally']){logger[_0x5cfc('0x21')](util['format'](_0x5cfc('0x30'),_0x148505[_0x5cfc('0x31')],_0x148505[_0x5cfc('0x32')],_0x148505[_0x5cfc('0x22')],_0x148505[_0x5cfc('0x33')],_0x148505['uniqueid']));_0x5453f2[_0x5cfc('0x34')](_0x476cd4[_0x5cfc('0x35')]['id'],function(_0x31e4f4){try{_0x31e4f4=_0x4b4296[_0x5cfc('0x24')](_0x31e4f4);logger[_0x5cfc('0x1e')]('vertex',JSON[_0x5cfc('0x1f')](_0x31e4f4,null,0x2));if(_0x31e4f4&&_0x4b4296[_0x31e4f4['agicommand']]){_0x144388=_0x4b4296[_0x31e4f4['agicommand']](_0x31e4f4);if(_0x144388){logger[_0x5cfc('0x1e')](_0x5cfc('0x2b'),inspect(_0x144388));return _[_0x5cfc('0x2e')](_0x144388[_0x5cfc('0x2d')])?null:_0x144388[_0x5cfc('0x2d')]['toString']();}else{logger['error'](_0x5cfc('0x2b'),inspect(_0x144388));return null;}}else{logger[_0x5cfc('0xb')](_0x5cfc('0x2f'));return null;}}catch(_0x4cf701){logger[_0x5cfc('0xb')](_0x4cf701[_0x5cfc('0xd')]);return null;}});}logger[_0x5cfc('0x21')](util[_0x5cfc('0x36')](_0x5cfc('0x37'),_0x148505[_0x5cfc('0x31')],_0x148505['calleridname'],_0x148505[_0x5cfc('0x22')],_0x148505['dnid'],_0x148505['uniqueid']));logger['info'](util['format'](_0x5cfc('0x38'),_0x148505[_0x5cfc('0x28')],_0x148505[_0x5cfc('0x29')],parseInt(_0x148505[_0x5cfc('0x2a')],0xa)+0x1));_0x148505[_0x5cfc('0x39')](_0x148505[_0x5cfc('0x28')],_0x148505[_0x5cfc('0x29')],parseInt(_0x148505[_0x5cfc('0x2a')],0xa)+0x1);_0x148505[_0x5cfc('0x3a')]();}function handleNotFound(_0x5e1394){logger['error'](util['format'](_0x5cfc('0x3b'),_0x5e1394[_0x5cfc('0x31')]));_0x5e1394[_0x5cfc('0x39')](_0x5e1394[_0x5cfc('0x28')],_0x5e1394[_0x5cfc('0x29')],parseInt(_0x5e1394[_0x5cfc('0x2a')],0xa)+0x1);_0x5e1394['close']();}function handleUnpublished(_0x37d7f7){logger['error'](util[_0x5cfc('0x36')](_0x5cfc('0x3c'),_0x37d7f7['arg_1']));_0x37d7f7[_0x5cfc('0x39')](_0x37d7f7['context'],_0x37d7f7[_0x5cfc('0x29')],parseInt(_0x37d7f7[_0x5cfc('0x2a')],0xa)+0x1);_0x37d7f7[_0x5cfc('0x3a')]();}module[_0x5cfc('0x3d')]={'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 622d6a7..ded52d3 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 _0xaa4c=['emit','headers','line','exports','stream','Transform','_localBuffer','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','slice'];(function(_0x59b890,_0x5bbe52){var _0x598d87=function(_0xd68673){while(--_0xd68673){_0x59b890['push'](_0x59b890['shift']());}};_0x598d87(++_0x5bbe52);}(_0xaa4c,0x112));var _0xcaa4=function(_0x10c75d,_0x567cb1){_0x10c75d=_0x10c75d-0x0;var _0x474277=_0xaa4c[_0x10c75d];return _0x474277;};'use strict';var util=require('util');var Transform=require(_0xcaa4('0x0'))[_0xcaa4('0x1')];function AGIReply(_0x394410){Transform['call'](this,_0x394410);this[_0xcaa4('0x2')]='';this[_0xcaa4('0x3')]=![];}util[_0xcaa4('0x4')](AGIReply,Transform);AGIReply[_0xcaa4('0x5')]['_transform']=function(_0x4091e7,_0x211f17,_0x423a7d){var _0x56854c='\x0a',_0x127469=['\x0a\x0a',_0xcaa4('0x6')],_0x712498=-0x1,_0x13e596=-0x1,_0xd31a38='',_0x123c55=0x0,_0x3813c2='',_0x1d750b='';this['_localBuffer']+=_0x4091e7[_0xcaa4('0x7')]();_0x3813c2=this[_0xcaa4('0x2')];if(!this[_0xcaa4('0x3')]){_0x123c55=0x0;while(_0x127469[_0x123c55]){while((_0x13e596=_0x3813c2[_0xcaa4('0x8')](_0x127469[_0x123c55]))!=-0x1){_0xd31a38=_0x127469[_0x123c55];_0x1d750b=_0x3813c2[_0xcaa4('0x9')](0x0,_0x13e596);_0x3813c2=_0x3813c2[_0xcaa4('0x9')](_0x13e596+_0xd31a38[_0xcaa4('0xa')]);var _0x3d955d=_0x1d750b[_0xcaa4('0xb')](_0x56854c),_0x3d7c6a=0x0,_0x205714={},_0x43ed85='',_0x15875c='',_0x166194=-0x1;while(_0x3d955d[_0x3d7c6a]){_0x166194=_0x3d955d[_0x3d7c6a][_0xcaa4('0x8')](':');if(_0x166194!=-0x1){_0x43ed85=_0x3d955d[_0x3d7c6a]['slice'](0x0,_0x166194)[_0xcaa4('0xc')]();_0x15875c=_0x3d955d[_0x3d7c6a][_0xcaa4('0xd')](_0x166194+0x1)['trim']();if(_0x43ed85[_0xcaa4('0xa')]>0x0){_0x205714[_0x43ed85]=_0x15875c;}}else{}_0x3d7c6a++;}this[_0xcaa4('0xe')](_0xcaa4('0xf'),_0x205714);this[_0xcaa4('0x3')]=!![];}_0x123c55++;}this[_0xcaa4('0x2')]=_0x3813c2;}else{while((_0x712498=_0x3813c2[_0xcaa4('0x8')](_0x56854c))!=-0x1){_0x1d750b=_0x3813c2[_0xcaa4('0x9')](0x0,_0x712498);this[_0xcaa4('0xe')](_0xcaa4('0x10'),_0x1d750b);_0x3813c2=_0x3813c2[_0xcaa4('0x9')](_0x712498+_0x56854c[_0xcaa4('0xa')]);}this['_localBuffer']=_0x3813c2;}_0x423a7d();};module[_0xcaa4('0x11')]=AGIReply; \ No newline at end of file +var _0xbb59=['toString','indexOf','length','split','slice','emit','headers','substring','line','exports','util','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0x1fdf44,_0x242e49){var _0x3dc67c=function(_0x4304bd){while(--_0x4304bd){_0x1fdf44['push'](_0x1fdf44['shift']());}};_0x3dc67c(++_0x242e49);}(_0xbb59,0x1d2));var _0x9bb5=function(_0x368bf5,_0x4b50b7){_0x368bf5=_0x368bf5-0x0;var _0x31d0f4=_0xbb59[_0x368bf5];return _0x31d0f4;};'use strict';var util=require(_0x9bb5('0x0'));var Transform=require('stream')[_0x9bb5('0x1')];function AGIReply(_0x1674a7){Transform[_0x9bb5('0x2')](this,_0x1674a7);this[_0x9bb5('0x3')]='';this[_0x9bb5('0x4')]=![];}util[_0x9bb5('0x5')](AGIReply,Transform);AGIReply[_0x9bb5('0x6')][_0x9bb5('0x7')]=function(_0xd0fe9f,_0x1845e9,_0x2cf9a6){var _0x539756='\x0a',_0x5930df=['\x0a\x0a',_0x9bb5('0x8')],_0x2a195e=-0x1,_0x107b28=-0x1,_0x327a6a='',_0xe176c1=0x0,_0x59c1d3='',_0x928f1a='';this[_0x9bb5('0x3')]+=_0xd0fe9f[_0x9bb5('0x9')]();_0x59c1d3=this[_0x9bb5('0x3')];if(!this[_0x9bb5('0x4')]){_0xe176c1=0x0;while(_0x5930df[_0xe176c1]){while((_0x107b28=_0x59c1d3[_0x9bb5('0xa')](_0x5930df[_0xe176c1]))!=-0x1){_0x327a6a=_0x5930df[_0xe176c1];_0x928f1a=_0x59c1d3['substring'](0x0,_0x107b28);_0x59c1d3=_0x59c1d3['substring'](_0x107b28+_0x327a6a[_0x9bb5('0xb')]);var _0x5a6a3b=_0x928f1a[_0x9bb5('0xc')](_0x539756),_0x1ce475=0x0,_0x28d45b={},_0x563be6='',_0x312799='',_0x5a48e7=-0x1;while(_0x5a6a3b[_0x1ce475]){_0x5a48e7=_0x5a6a3b[_0x1ce475][_0x9bb5('0xa')](':');if(_0x5a48e7!=-0x1){_0x563be6=_0x5a6a3b[_0x1ce475]['slice'](0x0,_0x5a48e7)['trim']();_0x312799=_0x5a6a3b[_0x1ce475][_0x9bb5('0xd')](_0x5a48e7+0x1)['trim']();if(_0x563be6[_0x9bb5('0xb')]>0x0){_0x28d45b[_0x563be6]=_0x312799;}}else{}_0x1ce475++;}this[_0x9bb5('0xe')](_0x9bb5('0xf'),_0x28d45b);this['_inBody']=!![];}_0xe176c1++;}this[_0x9bb5('0x3')]=_0x59c1d3;}else{while((_0x2a195e=_0x59c1d3['indexOf'](_0x539756))!=-0x1){_0x928f1a=_0x59c1d3[_0x9bb5('0x10')](0x0,_0x2a195e);this['emit'](_0x9bb5('0x11'),_0x928f1a);_0x59c1d3=_0x59c1d3['substring'](_0x2a195e+_0x539756[_0x9bb5('0xb')]);}this['_localBuffer']=_0x59c1d3;}_0x2cf9a6();};module[_0x9bb5('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 0e511ec..2a895db 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 _0x68fc=['getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','then','error','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById'];(function(_0x3080a8,_0x4a688f){var _0x3f05b7=function(_0x3f8a73){while(--_0x3f8a73){_0x3080a8['push'](_0x3080a8['shift']());}};_0x3f05b7(++_0x4a688f);}(_0x68fc,0xa5));var _0xc68f=function(_0x49efc8,_0x5cb565){_0x49efc8=_0x49efc8-0x0;var _0x2fa473=_0x68fc[_0x49efc8];return _0x2fa473;};'use strict';var _=require(_0xc68f('0x0'));var moment=require(_0xc68f('0x1'));var jayson=require(_0xc68f('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x26513f,_0x506fb5){return new Promise(function(_0xe70787,_0x593648){return client['request'](_0x26513f,_0x506fb5)[_0xc68f('0x3')](function(_0x2ad310){if(_0x2ad310[_0xc68f('0x4')]){return _0x593648(_0x2ad310[_0xc68f('0x4')]['message']);}else{return _0xe70787(_0x2ad310['result']);}})[_0xc68f('0x5')](function(_0x2bf3fd){return _0x593648(_0x2bf3fd);});});}exports[_0xc68f('0x6')]=function(){return request(_0xc68f('0x7'),{'options':{'raw':![],'attributes':['id',_0xc68f('0x8'),_0xc68f('0x9')]}});};exports[_0xc68f('0xa')]=function(_0x3bd373){return request(_0xc68f('0xb'),{'options':{'raw':![],'where':{'name':_0x3bd373},'attributes':[_0xc68f('0x9')]}});};exports['getMailAccountById']=function(_0x3b1a43){return request(_0xc68f('0xc'),{'options':{'raw':![],'where':{'id':_0x3b1a43},'include':[{'model':_0xc68f('0xd'),'as':_0xc68f('0xe'),'include':[{'model':_0xc68f('0xf'),'as':_0xc68f('0xf')}]}],'attributes':['id',_0xc68f('0x8'),_0xc68f('0x10')],'smtp':!![]}});};exports[_0xc68f('0x11')]=function(_0x4112df){return request(_0xc68f('0xb'),{'options':{'where':{'id':_0x4112df},'attributes':['name']}});};exports[_0xc68f('0x12')]=function(_0x90ccbd){return request(_0xc68f('0x13'),{'options':{'where':{'id':_0x90ccbd},'attributes':[_0xc68f('0x8')]}});};exports[_0xc68f('0x14')]=function(_0x2673b4){return request(_0xc68f('0x15'),{'options':{'where':{'id':_0x2673b4},'attributes':[_0xc68f('0x8')]}});};exports[_0xc68f('0x16')]=function(_0x5e1e5b){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5e1e5b},'attributes':[_0xc68f('0x17')]}});};exports[_0xc68f('0x18')]=function(_0x171eea){return request(_0xc68f('0x19'),{'options':{'where':{'id':_0x171eea},'attributes':[_0xc68f('0x8')]}});};exports[_0xc68f('0x1a')]=function(_0x50fab4){return request(_0xc68f('0x1b'),{'options':{'where':{'phone':_0x50fab4[_0xc68f('0x1c')]},'attributes':['id']}});};exports[_0xc68f('0x1d')]=function(_0x2c058c){return request(_0xc68f('0x1e'),{'options':{'where':{'id':_0x2c058c},'attributes':[_0xc68f('0x8')]}});};exports[_0xc68f('0x1f')]=function(_0x3c32c8){return request('ShowSound',{'options':{'where':{'id':_0x3c32c8},'attributes':[_0xc68f('0x20')]}});};exports[_0xc68f('0x21')]=function(_0x2e27b9){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2e27b9},'include':[{'model':_0xc68f('0x22'),'as':_0xc68f('0x23')}]}});};exports[_0xc68f('0x24')]=function(_0x2064db){return request(_0xc68f('0x25'),{'options':{'where':{'id':_0x2064db},'attributes':['id',_0xc68f('0x8')]}});};exports[_0xc68f('0x26')]=function(_0x547d46){return request(_0xc68f('0x27'),{'body':_0x547d46});};exports[_0xc68f('0x28')]=function(_0x512c9c){return request(_0xc68f('0x29'),{'body':_0x512c9c});};exports[_0xc68f('0x2a')]=function(_0x35945b){return request(_0xc68f('0x2b'),{'body':_[_0xc68f('0x2c')](_0x35945b,{'project_name':_0x35945b['arg_1'],'prev_project_name':_0x35945b[_0xc68f('0x2d')]||'','is_subproject':_0x35945b[_0xc68f('0x2d')]?!![]:![],'leaveAt':moment()['format'](_0xc68f('0x2e'))})});};exports[_0xc68f('0x2f')]=function(_0x4d26e3){return request(_0xc68f('0x30'),{'body':_0x4d26e3});};exports[_0xc68f('0x31')]=function(_0x2a4a5d){return request(_0xc68f('0x32'),{'body':_0x2a4a5d});};exports['createCmContact']=function(_0x477a1c){return request(_0xc68f('0x33'),{'options':{'raw':![],'where':{'phone':_0x477a1c[_0xc68f('0x1c')],'ListId':_0x477a1c[_0xc68f('0x34')]}}})[_0xc68f('0x3')](function(_0x11b203){if(_0x11b203){return _0x11b203;}return request(_0xc68f('0x35'),{'body':_0x477a1c});});};exports[_0xc68f('0x36')]=function(_0x4bb052){return request(_0xc68f('0x37'),{'options':{'where':{'id':_0x4bb052},'attributes':[_0xc68f('0x8')]}});};exports['agentLogin']=function(_0x323677,_0x6d2d34){return request(_0xc68f('0x38'),{'body':{'interface':_0x6d2d34},'options':{'where':_0x323677}});};exports[_0xc68f('0x39')]=function(_0x51e82c,_0x1deee7,_0x16e1d0){return request('PauseUser',{'body':{'type':_0x1deee7,'uniqueid':_0x16e1d0},'options':{'where':_0x51e82c}});};exports[_0xc68f('0x3a')]=function(_0x1f1101){return request(_0xc68f('0x3b'),{'body':{},'options':{'where':_0x1f1101}});};exports[_0xc68f('0x3c')]=function(_0xd6cf9a){return request('LogoutUser',{'body':{},'options':{'where':_0xd6cf9a}});}; \ No newline at end of file +var _0x851c=['ShowVoiceQueue','getVariableById','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareReport','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','error','message','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById'];(function(_0x44a5f0,_0x4a64b6){var _0x5ef6df=function(_0x44a2be){while(--_0x44a2be){_0x44a5f0['push'](_0x44a5f0['shift']());}};_0x5ef6df(++_0x4a64b6);}(_0x851c,0x19d));var _0xc851=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x851c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xc851('0x0'));var moment=require(_0xc851('0x1'));var jayson=require(_0xc851('0x2'));var client=jayson[_0xc851('0x3')][_0xc851('0x4')]({'port':0x2329});function request(_0x24a12f,_0x205792){return new Promise(function(_0x4ad892,_0x2fddd4){return client[_0xc851('0x5')](_0x24a12f,_0x205792)['then'](function(_0x4635e5){if(_0x4635e5[_0xc851('0x6')]){return _0x2fddd4(_0x4635e5['error'][_0xc851('0x7')]);}else{return _0x4ad892(_0x4635e5['result']);}})['catch'](function(_0x12a405){return _0x2fddd4(_0x12a405);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xc851('0x8'),_0xc851('0x9')]}});};exports[_0xc851('0xa')]=function(_0x177de0){return request(_0xc851('0xb'),{'options':{'raw':![],'where':{'name':_0x177de0},'attributes':[_0xc851('0x9')]}});};exports[_0xc851('0xc')]=function(_0x69ce5a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x69ce5a},'include':[{'model':_0xc851('0xd'),'as':_0xc851('0xe'),'include':[{'model':_0xc851('0xf'),'as':_0xc851('0xf')}]}],'attributes':['id',_0xc851('0x8'),_0xc851('0x10')],'smtp':!![]}});};exports[_0xc851('0x11')]=function(_0xd619c3){return request(_0xc851('0xb'),{'options':{'where':{'id':_0xd619c3},'attributes':[_0xc851('0x8')]}});};exports[_0xc851('0x12')]=function(_0x3fddbe){return request(_0xc851('0x13'),{'options':{'where':{'id':_0x3fddbe},'attributes':[_0xc851('0x8')]}});};exports[_0xc851('0x14')]=function(_0x458951){return request('ShowVariable',{'options':{'where':{'id':_0x458951},'attributes':[_0xc851('0x8')]}});};exports['getSquareOdbcById']=function(_0x2b4839){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2b4839},'attributes':[_0xc851('0x15')]}});};exports[_0xc851('0x16')]=function(_0x2235b9){return request(_0xc851('0x17'),{'options':{'where':{'id':_0x2235b9},'attributes':[_0xc851('0x8')]}});};exports[_0xc851('0x18')]=function(_0x2c1894){return request('GetContactByPhone',{'options':{'where':{'phone':_0x2c1894[_0xc851('0x19')]},'attributes':['id']}});};exports[_0xc851('0x1a')]=function(_0x543377){return request(_0xc851('0x1b'),{'options':{'where':{'id':_0x543377},'attributes':[_0xc851('0x8')]}});};exports[_0xc851('0x1c')]=function(_0x162945){return request('ShowSound',{'options':{'where':{'id':_0x162945},'attributes':[_0xc851('0x1d')]}});};exports[_0xc851('0x1e')]=function(_0x138277){return request(_0xc851('0x1f'),{'options':{'raw':![],'where':{'id':_0x138277},'include':[{'model':_0xc851('0x20'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x442271){return request(_0xc851('0x21'),{'options':{'where':{'id':_0x442271},'attributes':['id',_0xc851('0x8')]}});};exports[_0xc851('0x22')]=function(_0x2c4cb4){return request(_0xc851('0x23'),{'body':_0x2c4cb4});};exports['createSquareDetailsReport']=function(_0x3f95d5){return request('CreateSquareDetailsReport',{'body':_0x3f95d5});};exports['createSquareReport']=function(_0x7a59cd){return request(_0xc851('0x24'),{'body':_['merge'](_0x7a59cd,{'project_name':_0x7a59cd[_0xc851('0x25')],'prev_project_name':_0x7a59cd[_0xc851('0x26')]||'','is_subproject':_0x7a59cd[_0xc851('0x26')]?!![]:![],'leaveAt':moment()['format'](_0xc851('0x27'))})});};exports[_0xc851('0x28')]=function(_0x283b10){return request(_0xc851('0x29'),{'body':_0x283b10});};exports[_0xc851('0x2a')]=function(_0x2fc8f1){return request(_0xc851('0x2b'),{'body':_0x2fc8f1});};exports[_0xc851('0x2c')]=function(_0x3f9a52){return request(_0xc851('0x2d'),{'options':{'raw':![],'where':{'phone':_0x3f9a52[_0xc851('0x19')],'ListId':_0x3f9a52[_0xc851('0x2e')]}}})['then'](function(_0x2989b9){if(_0x2989b9){return _0x2989b9;}return request(_0xc851('0x2f'),{'body':_0x3f9a52});});};exports['getPauseById']=function(_0x1e35d6){return request('ShowPause',{'options':{'where':{'id':_0x1e35d6},'attributes':['name']}});};exports['agentLogin']=function(_0x3a04fd,_0x4bba14){return request(_0xc851('0x30'),{'body':{'interface':_0x4bba14},'options':{'where':_0x3a04fd}});};exports['agentPause']=function(_0x233a73,_0xe5c563,_0x11d4a7){return request(_0xc851('0x31'),{'body':{'type':_0xe5c563,'uniqueid':_0x11d4a7},'options':{'where':_0x233a73}});};exports[_0xc851('0x32')]=function(_0x107ff7){return request(_0xc851('0x33'),{'body':{},'options':{'where':_0x107ff7}});};exports[_0xc851('0x34')]=function(_0x3da3b8){return request(_0xc851('0x35'),{'body':{},'options':{'where':_0x3da3b8}});}; \ 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 e2bae88..9202fcc 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 _0x2709=['exports','./polly'];(function(_0xf346f1,_0x558ad3){var _0x128587=function(_0x4a61ca){while(--_0x4a61ca){_0xf346f1['push'](_0xf346f1['shift']());}};_0x128587(++_0x558ad3);}(_0x2709,0x189));var _0x9270=function(_0x188641,_0x59a603){_0x188641=_0x188641-0x0;var _0xbaa1d4=_0x2709[_0x188641];return _0xbaa1d4;};var polly=require(_0x9270('0x0'));var lex=require('./lex');module[_0x9270('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xcb04=['exports','./polly','./lex'];(function(_0xe8d62d,_0x3b9aff){var _0x22ce04=function(_0x1ba08b){while(--_0x1ba08b){_0xe8d62d['push'](_0xe8d62d['shift']());}};_0x22ce04(++_0x3b9aff);}(_0xcb04,0x9a));var _0x4cb0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcb04[_0x20a584];return _0x4b41a8;};var polly=require(_0x4cb0('0x0'));var lex=require(_0x4cb0('0x1'));module[_0x4cb0('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 b51dcb7..615ed92 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 _0xf109=['./lib/api','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf109,0xce));var _0x9f10=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xf109[_0x4fbfd9];return _0x31dc94;};'use strict';var lex=require(_0x9f10('0x0'));module[_0x9f10('0x1')]=function(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517){return lex(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517);}; \ No newline at end of file +var _0xbdb7=['./lib/api','exports'];(function(_0x29fd3b,_0x5ede1a){var _0x1a5a29=function(_0x147765){while(--_0x147765){_0x29fd3b['push'](_0x29fd3b['shift']());}};_0x1a5a29(++_0x5ede1a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xed58fb,_0x3ad96e){_0xed58fb=_0xed58fb-0x0;var _0x34ff8a=_0xbdb7[_0xed58fb];return _0x34ff8a;};'use strict';var lex=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]=function(_0x44467d,_0x2a2c1c,_0x23c326,_0x433850,_0x4496ac,_0x2c7e07){return lex(_0x44467d,_0x2a2c1c,_0x23c326,_0x433850,_0x4496ac,_0x2c7e07);}; \ 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 72031f1..373e88d 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(_0x1cf431,_0x86e66d){var _0x48d4ad=function(_0x3e37bc){while(--_0x3e37bc){_0x1cf431['push'](_0x1cf431['shift']());}};_0x48d4ad(++_0x86e66d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x51e546,_0x4d886c){var _0x5a2203=function(_0x3daaef){while(--_0x3daaef){_0x51e546['push'](_0x51e546['shift']());}};_0x5a2203(++_0x4d886c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 f4baf09..f33a754 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 _0x279e=['./lib/api','exports'];(function(_0x1fffcc,_0xb258ec){var _0xa83ea3=function(_0x327fcc){while(--_0x327fcc){_0x1fffcc['push'](_0x1fffcc['shift']());}};_0xa83ea3(++_0xb258ec);}(_0x279e,0x84));var _0xe279=function(_0x17fd28,_0x5d6f95){_0x17fd28=_0x17fd28-0x0;var _0x3dc275=_0x279e[_0x17fd28];return _0x3dc275;};'use strict';var polly=require(_0xe279('0x0'));module[_0xe279('0x1')]=function(_0x218b2f,_0x3cdfb3,_0x31ab7c,_0x21dd74,_0xb37ed6,_0x41ec61,_0xdde903){return polly(_0x218b2f,_0x3cdfb3,_0x31ab7c,_0x21dd74,_0xb37ed6,_0x41ec61,_0xdde903);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x53a2b2,_0x5e49b1,_0x790fd8,_0x5c4cfc,_0x2f0811,_0x37d044,_0x14aac7){return polly(_0x53a2b2,_0x5e49b1,_0x790fd8,_0x5c4cfc,_0x2f0811,_0x37d044,_0x14aac7);}; \ 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 49d226d..4a77fab 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 _0xc1a7=['exports','Polly','text','mp3','path','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x497513,_0x114370){var _0x94baac=function(_0x2b8311){while(--_0x2b8311){_0x497513['push'](_0x497513['shift']());}};_0x94baac(++_0x114370);}(_0xc1a7,0x136));var _0x7c1a=function(_0x2aab8e,_0x440d3b){_0x2aab8e=_0x2aab8e-0x0;var _0x2a67=_0xc1a7[_0x2aab8e];return _0x2a67;};'use strict';var fs=require('fs');var path=require(_0x7c1a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x17bfb0,_0x19ef08,_0x58c2dd){return new BPromise(function(_0x3cfbec,_0xb74393){_0x17bfb0[_0x7c1a('0x1')](_0x19ef08,function(_0x44d23d,_0x2f7654){if(_0x44d23d){_0xb74393(_0x44d23d);}else if(_0x2f7654){if(_0x2f7654['AudioStream']instanceof Buffer){fs[_0x7c1a('0x2')](_0x58c2dd,_0x2f7654['AudioStream'],function(_0x1b5bfc){if(_0x1b5bfc){_0xb74393(_0x1b5bfc);}else{_0x3cfbec();}});}else{_0xb74393(new Error(_0x7c1a('0x3')));}}else{_0xb74393(new Error(_0x7c1a('0x4')));}});});}module[_0x7c1a('0x5')]=function(_0xe89f1e,_0x81fd60,_0x2fc704,_0x43e69a,_0x39dcad,_0x30a1d6,_0x55ee62){var _0x10b6e3=new AWS[(_0x7c1a('0x6'))]({'accessKeyId':_0xe89f1e,'secretAccessKey':_0x81fd60,'region':_0x2fc704});var _0x16a4c9={'Text':_0x39dcad,'TextType':_0x30a1d6||_0x7c1a('0x7'),'OutputFormat':_0x7c1a('0x8'),'VoiceId':_0x43e69a};return pollyResult(_0x10b6e3,_0x16a4c9,_0x55ee62);}; \ No newline at end of file +var _0x1d62=['text','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x31021e,_0x248900){var _0x1e6fe5=function(_0x420acf){while(--_0x420acf){_0x31021e['push'](_0x31021e['shift']());}};_0x1e6fe5(++_0x248900);}(_0x1d62,0xbf));var _0x21d6=function(_0x539c3a,_0x2f5b2c){_0x539c3a=_0x539c3a-0x0;var _0x5de048=_0x1d62[_0x539c3a];return _0x5de048;};'use strict';var fs=require('fs');var path=require(_0x21d6('0x0'));var BPromise=require(_0x21d6('0x1'));var rs=require(_0x21d6('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x17e5b3,_0x3efbf4,_0x470095){return new BPromise(function(_0x34ba21,_0x4cc644){_0x17e5b3[_0x21d6('0x3')](_0x3efbf4,function(_0x1a1efc,_0x5886d8){if(_0x1a1efc){_0x4cc644(_0x1a1efc);}else if(_0x5886d8){if(_0x5886d8[_0x21d6('0x4')]instanceof Buffer){fs[_0x21d6('0x5')](_0x470095,_0x5886d8[_0x21d6('0x4')],function(_0x47be55){if(_0x47be55){_0x4cc644(_0x47be55);}else{_0x34ba21();}});}else{_0x4cc644(new Error(_0x21d6('0x6')));}}else{_0x4cc644(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x21d6('0x7')]=function(_0x60dd51,_0x27cfc1,_0x633434,_0x139e55,_0x226842,_0x5b3340,_0x183855){var _0x13b42d=new AWS[(_0x21d6('0x8'))]({'accessKeyId':_0x60dd51,'secretAccessKey':_0x27cfc1,'region':_0x633434});var _0x1af7a2={'Text':_0x226842,'TextType':_0x5b3340||_0x21d6('0x9'),'OutputFormat':'mp3','VoiceId':_0x139e55};return pollyResult(_0x13b42d,_0x1af7a2,_0x183855);}; \ 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 82c9327..d89abc5 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 _0x9606=['exports'];(function(_0x2e4a84,_0x3de6e1){var _0x16ffe8=function(_0x43382f){while(--_0x43382f){_0x2e4a84['push'](_0x2e4a84['shift']());}};_0x16ffe8(++_0x3de6e1);}(_0x9606,0xfc));var _0x6960=function(_0x2d88fa,_0x38406b){_0x2d88fa=_0x2d88fa-0x0;var _0x1a62de=_0x9606[_0x2d88fa];return _0x1a62de;};'use strict';var asr=require('./lib/api');module[_0x6960('0x0')]=function(_0x27db95,_0x407978,_0x43bd12,_0x32d28a){return asr(_0x27db95,_0x407978,_0x43bd12);}; \ No newline at end of file +var _0xa1b0=['./lib/api'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa1b0,0x1d1));var _0x0a1b=function(_0x57feac,_0x4dbcda){_0x57feac=_0x57feac-0x0;var _0x1335ad=_0xa1b0[_0x57feac];return _0x1335ad;};'use strict';var asr=require(_0x0a1b('0x0'));module['exports']=function(_0x3bba0c,_0x6e3750,_0x30f369,_0xc3a07f){return asr(_0x3bba0c,_0x6e3750,_0x30f369);}; \ 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 57b74f5..e715090 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 _0x4522=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','8000','https://speech.googleapis.com','exports','string','length'];(function(_0x5cc5ff,_0x57d334){var _0x33b588=function(_0x599cc3){while(--_0x599cc3){_0x5cc5ff['push'](_0x5cc5ff['shift']());}};_0x33b588(++_0x57d334);}(_0x4522,0x1a0));var _0x2452=function(_0x2df537,_0x1359a8){_0x2df537=_0x2df537-0x0;var _0x288850=_0x4522[_0x2df537];return _0x288850;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x2452('0x0');module[_0x2452('0x1')]=function(_0x4a08d4,_0x5080f5,_0x229028){return new BPromise(function(_0x1fdf5b,_0x35e30a){var _0x2f21dc;if(typeof _0x4a08d4!==_0x2452('0x2')||_0x4a08d4[_0x2452('0x3')]===0x0){return _0x35e30a(_0x2452('0x4'));}if(typeof _0x5080f5!==_0x2452('0x2')||_0x5080f5[_0x2452('0x3')]===0x0){return _0x35e30a(_0x2452('0x5'));}if(typeof _0x229028!==_0x2452('0x6')&&(typeof _0x229028!==_0x2452('0x2')||_0x229028[_0x2452('0x3')]===0x0)){return _0x35e30a(_0x2452('0x7'));}try{_0x2f21dc=fs[_0x2452('0x8')](_0x4a08d4)[_0x2452('0x9')]('base64');}catch(_0x5dc630){return _0x35e30a(_0x5dc630);}return _0x1fdf5b({'method':_0x2452('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x5080f5,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x2452('0xb'),'languageCode':_0x229028},'audio':{'content':_0x2f21dc}},'json':!![]});});}; \ No newline at end of file +var _0x7846=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x47cfcc,_0x4426b7){var _0xfc92b3=function(_0x4e23e6){while(--_0x4e23e6){_0x47cfcc['push'](_0x47cfcc['shift']());}};_0xfc92b3(++_0x4426b7);}(_0x7846,0xf4));var _0x6784=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x7846[_0x41f2f5];return _0x3d49f1;};'use strict';var url=require('url');var BPromise=require(_0x6784('0x0'));var fs=require('fs');var host=_0x6784('0x1');module[_0x6784('0x2')]=function(_0xebf76a,_0x3c868d,_0x7653ef){return new BPromise(function(_0x479b0a,_0x13ba3e){var _0x24c16b;if(typeof _0xebf76a!==_0x6784('0x3')||_0xebf76a[_0x6784('0x4')]===0x0){return _0x13ba3e(_0x6784('0x5'));}if(typeof _0x3c868d!==_0x6784('0x3')||_0x3c868d[_0x6784('0x4')]===0x0){return _0x13ba3e('key\x20should\x20be\x20a\x20string');}if(typeof _0x7653ef!=='undefined'&&(typeof _0x7653ef!==_0x6784('0x3')||_0x7653ef[_0x6784('0x4')]===0x0)){return _0x13ba3e(_0x6784('0x6'));}try{_0x24c16b=fs[_0x6784('0x7')](_0xebf76a)[_0x6784('0x8')](_0x6784('0x9'));}catch(_0x8d18c2){return _0x13ba3e(_0x8d18c2);}return _0x479b0a({'method':_0x6784('0xa'),'uri':host+_0x6784('0xb')+_0x3c868d,'body':{'config':{'encoding':_0x6784('0xc'),'sampleRateHertz':_0x6784('0xd'),'languageCode':_0x7653ef},'audio':{'content':_0x24c16b}},'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 0ce073c..794d0e2 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 _0x0436=['exports','./asr'];(function(_0x2d2309,_0x360354){var _0x51e163=function(_0x51ad18){while(--_0x51ad18){_0x2d2309['push'](_0x2d2309['shift']());}};_0x51e163(++_0x360354);}(_0x0436,0x145));var _0x6043=function(_0x334e13,_0x5cfd03){_0x334e13=_0x334e13-0x0;var _0x5632cf=_0x0436[_0x334e13];return _0x5632cf;};var asr=require(_0x6043('0x0'));module[_0x6043('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf1c9=['./asr'];(function(_0x26447e,_0x2e9c94){var _0x38cc1a=function(_0x4f1170){while(--_0x4f1170){_0x26447e['push'](_0x26447e['shift']());}};_0x38cc1a(++_0x2e9c94);}(_0xf1c9,0x1e8));var _0x9f1c=function(_0x21551b,_0x1cd7d1){_0x21551b=_0x21551b-0x0;var _0x168329=_0xf1c9[_0x21551b];return _0x168329;};var asr=require(_0x9f1c('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 8acead7..16809ad 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 _0xe873=['fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','lex','ispeechTTS','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','freeform=3','sestekNDA','channelData','CustomActionData','AudioFromTts','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./google','./sestek','./tilde','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','from','audioContent','writeFile','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','data','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','queryResult','diagnosticInfo'];(function(_0x46b501,_0x50b017){var _0x26a68d=function(_0x3fc948){while(--_0x3fc948){_0x46b501['push'](_0x46b501['shift']());}};_0x26a68d(++_0x50b017);}(_0xe873,0x1b1));var _0x3e87=function(_0x4c0685,_0x4657b5){_0x4c0685=_0x4c0685-0x0;var _0x1d73ab=_0xe873[_0x4c0685];return _0x1d73ab;};'use strict';var apiai=require(_0x3e87('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x3e87('0x1'));var fs=require('fs');var http=require(_0x3e87('0x2'));var https=require(_0x3e87('0x3'));var md5=require(_0x3e87('0x4'));var path=require(_0x3e87('0x5'));var querystring=require(_0x3e87('0x6'));var rp=require(_0x3e87('0x7'));var rs=require(_0x3e87('0x8'));var sox=require(_0x3e87('0x9'));var tts=require(_0x3e87('0xa'));var urlParse=require(_0x3e87('0xb'))[_0x3e87('0xc')];var util=require(_0x3e87('0xd'));var aws=require('./aws');var google=require(_0x3e87('0xe'));var sestek=require(_0x3e87('0xf'));var tilde=require(_0x3e87('0x10'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x3e87('0x11');function downloadFile(_0x2a7350,_0x2c45eb){return new BPromise(function(_0x706725,_0x4fd0d1){var _0x423eb3=urlParse(_0x2a7350);var _0x5b2f86=_0x423eb3[_0x3e87('0x12')]===_0x3e87('0x13')?https:http;var _0x11b411={'host':_0x423eb3[_0x3e87('0x14')],'path':_0x423eb3[_0x3e87('0x5')],'headers':{'user-agent':_0x3e87('0x15')}};_0x5b2f86[_0x3e87('0x16')](_0x11b411,function(_0x3ea3bd){if(_0x3ea3bd[_0x3e87('0x17')]!==0xc8){logger[_0x3e87('0x18')](_0x3e87('0x19')+_0x2a7350+_0x3e87('0x1a')+_0x3ea3bd[_0x3e87('0x17')]+'\x20('+_0x3ea3bd[_0x3e87('0x1b')]+')');_0x4fd0d1(new Error(_0x3e87('0x19')+_0x2a7350+_0x3e87('0x1a')+_0x3ea3bd[_0x3e87('0x17')]+'\x20('+_0x3ea3bd[_0x3e87('0x1b')]+')'));return;}var _0x497021=fs[_0x3e87('0x1c')](_0x2c45eb);_0x497021['on'](_0x3e87('0x1d'),function(){logger[_0x3e87('0x1e')](_0x3e87('0x1f'));_0x497021[_0x3e87('0x20')](_0x706725);});_0x497021['on'](_0x3e87('0x18'),function(_0x2f043f){fs[_0x3e87('0x21')](_0x2c45eb);logger[_0x3e87('0x18')](_0x3e87('0x22'),_0x2f043f);_0x4fd0d1(_0x2f043f);});_0x3ea3bd[_0x3e87('0x23')](_0x497021);})['on'](_0x3e87('0x18'),function(_0x22ade2){logger[_0x3e87('0x18')](_0x22ade2);_0x4fd0d1(_0x22ade2);})[_0x3e87('0x24')]();});}function uploadFile(_0x5dbf69){return new BPromise(function(_0x3f892a,_0xdcb44c){var _0x117953=urlParse(_0x5dbf69);var _0x273b60=_0x117953[_0x3e87('0x12')]==='https:'?https:http;var _0x2ee0db={'host':_0x117953[_0x3e87('0x14')],'path':_0x117953[_0x3e87('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x273b60[_0x3e87('0x16')](_0x2ee0db,function(_0x4feee3){if(_0x4feee3[_0x3e87('0x17')]!==0xc8){_0xdcb44c(new Error('request\x20to\x20'+_0x5dbf69+_0x3e87('0x1a')+_0x4feee3[_0x3e87('0x17')]+'\x20('+_0x4feee3['statusMessage']+')'));return;}var _0x173629='';_0x4feee3['on']('data',function(_0x535200){_0x173629+=_0x535200;});_0x4feee3['on'](_0x3e87('0x24'),function(){_0x3f892a(_0x173629);});})['on'](_0x3e87('0x18'),function(_0x26bc98){_0xdcb44c(_0x26bc98);})['end']();});}function convertFile(_0x1d8fb3,_0x17b5a5){return new BPromise(function(_0x3a5709,_0x4191f2){var _0x44142c=sox[_0x3e87('0x25')](_0x1d8fb3,_0x17b5a5,{'sampleRate':0x1f40,'format':_0x3e87('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x44142c['on']('error',function(_0xe36954){logger[_0x3e87('0x18')](_0x3e87('0x27'),_0xe36954);_0x4191f2(_0xe36954);});_0x44142c['on']('end',function(){logger[_0x3e87('0x1e')](_0x3e87('0x28'));_0x3a5709();});_0x44142c['start']();});}function base64Decode(_0x36c11e,_0x3133e5){var _0x52012d=path[_0x3e87('0x29')](__dirname,_0x3e87('0x2a'),rs[_0x3e87('0x2b')](0x4)+_0x3e87('0x2c'));fs[_0x3e87('0x2d')](_0x52012d,_0x36c11e,_0x3e87('0x2e'));return convertFile(_0x52012d,_0x3133e5)[_0x3e87('0x2f')](function(){try{fs['unlink'](_0x52012d);fs[_0x3e87('0x30')](_0x3133e5,_0x3e87('0x31'));}catch(_0x17d612){logger[_0x3e87('0x18')](_0x17d612);}return _0x3133e5['split']('.')[0x0];});}function base64Encode(_0x428d49){var _0x845737=fs[_0x3e87('0x32')](_0x428d49);return new Buffer(_0x845737)[_0x3e87('0x33')](_0x3e87('0x2e'));}exports['googleCloudTTS']=function(_0x554343,_0x1e4aa2,_0x1ba8c0,_0x2b6722,_0x3a4f37,_0x151473){var _0xd40be6,_0x3d6ab4;var _0x55ba91=_0x3e87('0x34');var _0x196be2=_0x3e87('0x35')+_0x554343;var _0x35179e={};if(_0x1e4aa2===_0x3e87('0x36')){_0x35179e[_0x3e87('0x37')]={'ssml':_0x1ba8c0};}else{_0x35179e['input']={'text':_0x1ba8c0};};_0x35179e[_0x3e87('0x38')]={'languageCode':_0x2b6722,'ssmlGender':_0x3a4f37};_0x35179e[_0x3e87('0x39')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5578fb={'url':_0x55ba91+_0x3e87('0x3a')+_0x196be2,'method':_0x3e87('0x3b'),'json':!![],'body':_0x35179e};return rp(_0x5578fb)[_0x3e87('0x2f')](function(_0x2a50b1){return new BPromise(function(_0x55102e,_0x3188aa){_0xd40be6=path[_0x3e87('0x29')](__dirname,_0x3e87('0x2a'),rs[_0x3e87('0x2b')](0x4)+'.mp3');var _0x388963=Buffer[_0x3e87('0x3c')](_0x2a50b1[_0x3e87('0x3d')],_0x3e87('0x2e'));return fs[_0x3e87('0x3e')](_0xd40be6,_0x388963,function(_0x237404){_0x3188aa(_0x237404);},function(_0x579aba){fs[_0x3e87('0x30')](_0xd40be6,_0x3e87('0x31'));_0x55102e(_0x579aba);});});})[_0x3e87('0x2f')](function(_0x6c4711){_0x3d6ab4=path[_0x3e87('0x29')](__dirname,_0x3e87('0x2a'),rs['generate'](0x4)+_0x3e87('0x2c'));return convertFile(_0xd40be6,_0x3d6ab4);})[_0x3e87('0x2f')](function(){try{fs[_0x3e87('0x21')](_0xd40be6);fs[_0x3e87('0x30')](_0x3d6ab4,_0x3e87('0x31'));}catch(_0x34d5ab){logger[_0x3e87('0x18')](_0x34d5ab);}logger['info'](_0x3e87('0x3f'),_0x3d6ab4[_0x3e87('0x40')]('.')[0x0]);return _0x3d6ab4[_0x3e87('0x40')]('.')[0x0];});};exports['googleTTS']=function(_0x5442d,_0x268aa5){var _0x2ca4fa=_0x3e87('0x41');var _0x58e13f,_0x21c4d1;var _0x30b34e;var _0x29f192={'encoding':_0x3e87('0x42'),'method':_0x3e87('0x3b'),'timeout':0x2710,'url':_0x2ca4fa,'headers':{'Content-Type':_0x3e87('0x43')},'body':_0x3e87('0x44')+encodeURIComponent(JSON[_0x3e87('0x45')]([[[_0x3e87('0x46'),JSON[_0x3e87('0x45')]([_0x5442d,_0x268aa5||'en',![],'null']),null,_0x3e87('0x47')]]]))};return rp(_0x29f192)[_0x3e87('0x2f')](function(_0x4660f7){try{_0x30b34e=eval(_0x4660f7[_0x3e87('0x48')](0x5))[0x0][0x2];}catch(_0x5b0d9e){throw new Error('parse\x20response\x20failed:\x0a'+_0x4660f7[_0x3e87('0x49')]);}if(!_0x30b34e){if(_0x5442d['length']>0xc8){throw new Error(_0x3e87('0x4a'));}else{throw new Error(_0x3e87('0x4b')+_0x268aa5+_0x3e87('0x4c'));}}try{_0x30b34e=eval(_0x30b34e)[0x0];}catch(_0x2b70b0){throw new Error(_0x3e87('0x4d')+res[_0x3e87('0x49')]);}const _0x2c704e=_0x30b34e;_0x58e13f=path['resolve'](__dirname,_0x3e87('0x2a'),rs[_0x3e87('0x2b')](0x4)+_0x3e87('0x4e'));fs[_0x3e87('0x2d')](_0x58e13f,_0x30b34e,{'encoding':_0x3e87('0x2e')});_0x21c4d1=path[_0x3e87('0x29')](__dirname,_0x3e87('0x2a'),rs['generate'](0x4)+_0x3e87('0x2c'));return convertFile(_0x58e13f,_0x21c4d1);})[_0x3e87('0x2f')](function(){try{fs[_0x3e87('0x21')](_0x58e13f);fs[_0x3e87('0x30')](_0x21c4d1,'777');}catch(_0x4131d7){logger[_0x3e87('0x18')](_0x4131d7);}logger[_0x3e87('0x1e')]('goggleTTS\x20path',_0x21c4d1[_0x3e87('0x40')]('.')[0x0]);return _0x21c4d1['split']('.')[0x0];});};exports['googleASR']=function(_0x221aa0,_0x2e039b,_0x32427a){return google[_0x3e87('0x4f')](_0x221aa0,_0x2e039b,_0x32427a)[_0x3e87('0x2f')](function(_0x2e6d8b){logger['info'](_0x2e6d8b[_0x3e87('0x50')]);return rp(_0x2e6d8b);})['then'](function(_0x1c2d56){var _0x90a4c0='';var _0x422c05=0x0;try{fs[_0x3e87('0x21')](_0x221aa0);}catch(_0x4c528c){logger[_0x3e87('0x18')](_0x4c528c);}if(_0x1c2d56&&_0x1c2d56[_0x3e87('0x51')]){_0x90a4c0=_0x1c2d56['results'][_0x3e87('0x52')](function(_0x4447d3){return _0x4447d3&&_0x4447d3[_0x3e87('0x53')][0x0]&&_0x4447d3[_0x3e87('0x53')][0x0]['transcript']?_0x4447d3[_0x3e87('0x53')][0x0][_0x3e87('0x54')]:'';})[_0x3e87('0x55')]('\x0a');_0x422c05=_0x1c2d56[_0x3e87('0x51')][_0x3e87('0x52')](function(_0x47c922){return _0x47c922&&_0x47c922[_0x3e87('0x53')][0x0]&&_0x47c922[_0x3e87('0x53')][0x0][_0x3e87('0x56')]?_0x47c922[_0x3e87('0x53')][0x0][_0x3e87('0x56')]:0x0;})[_0x3e87('0x55')]('\x0a');}logger[_0x3e87('0x1e')]('googleASR\x20transcription',_0x90a4c0);logger[_0x3e87('0x1e')](_0x3e87('0x57'),_0x422c05);return{'transcript':_0x90a4c0,'confidence':_0x422c05};})[_0x3e87('0x58')](function(_0x42474e){logger[_0x3e87('0x18')]('[%s]\x20%s:%s',_0x42474e[_0x3e87('0x17')],_0x42474e[_0x3e87('0x59')],_0x42474e[_0x3e87('0x5a')]);});};exports[_0x3e87('0x5b')]=function(_0x1af149,_0x2afb63,_0x37ee5c,_0x301465){var _0x727969=apiai(_0x2afb63,{'language':_0x301465||'en'});return _0x727969[_0x3e87('0x5c')](_0x37ee5c,{'sessionId':md5(_0x1af149)})['then'](function(_0x2233d4){logger[_0x3e87('0x1e')](JSON['stringify'](_0x2233d4));return{'source':_0x2233d4['result'][_0x3e87('0x5d')],'resolvedQuery':_0x2233d4[_0x3e87('0x5e')][_0x3e87('0x5f')],'action':_0x2233d4[_0x3e87('0x5e')][_0x3e87('0x60')],'actionIncomplete':_0x2233d4[_0x3e87('0x5e')][_0x3e87('0x61')],'speech':_0x2233d4[_0x3e87('0x5e')][_0x3e87('0x62')][_0x3e87('0x63')],'score':_0x2233d4[_0x3e87('0x5e')][_0x3e87('0x64')],'statusCode':_0x2233d4['status']['code'],'endConversation':_0x2233d4[_0x3e87('0x5e')]['metadata']['endConversation']||![],'isFallbackIntent':_0x2233d4[_0x3e87('0x5e')][_0x3e87('0x65')][_0x3e87('0x66')]};});};exports[_0x3e87('0x67')]=function(_0x5495c0,_0x4954dd,_0x692057,_0x3ab390,_0x20e427,_0x5c2d2c){var _0x176b84=_0x3ab390[_0x3e87('0x68')](/\\n/g,'\x0a');var _0x8b940e={'credentials':{'private_key':_0x176b84,'client_email':_0x692057}};var _0x1ab8f3=new dialogflow[(_0x3e87('0x69'))](_0x8b940e);var _0x322be1=_0x1ab8f3[_0x3e87('0x6a')](_0x4954dd,md5(_0x5495c0));var _0x1fd117={'session':_0x322be1,'queryInput':{'text':{'text':_0x20e427,'languageCode':_0x5c2d2c}}};return _0x1ab8f3[_0x3e87('0x6b')](_0x1fd117)['then'](function(_0x361cc7){if(_0x361cc7&&_0x361cc7[_0x3e87('0x6c')]){logger[_0x3e87('0x1e')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x361cc7));var _0x210e3b=_0x361cc7[0x0];if(_0x210e3b){var _0x11b6ab={'action':_0x210e3b['queryResult']['action'],'allRequiredParamsPresent':_0x210e3b['queryResult']['allRequiredParamsPresent'],'endConversation':_0x210e3b[_0x3e87('0x6d')]['diagnosticInfo']&&_0x210e3b[_0x3e87('0x6d')][_0x3e87('0x6e')][_0x3e87('0x6f')]?_0x210e3b[_0x3e87('0x6d')][_0x3e87('0x6e')][_0x3e87('0x6f')][_0x3e87('0x70')][_0x3e87('0x71')]:![],'fulfillmentText':_0x210e3b[_0x3e87('0x6d')][_0x3e87('0x72')],'intentName':_0x210e3b[_0x3e87('0x6d')][_0x3e87('0x73')][_0x3e87('0x59')],'intentDisplayName':_0x210e3b[_0x3e87('0x6d')][_0x3e87('0x73')][_0x3e87('0x74')],'isFallbackIntent':_0x210e3b[_0x3e87('0x6d')]['intent'][_0x3e87('0x75')],'languageCode':_0x210e3b['queryResult'][_0x3e87('0x76')],'queryText':_0x210e3b[_0x3e87('0x6d')][_0x3e87('0x77')],'responseId':_0x210e3b[_0x3e87('0x78')],'score':_0x210e3b[_0x3e87('0x6d')][_0x3e87('0x79')],'speech':_0x210e3b[_0x3e87('0x6d')]['fulfillmentText'],'providerResponse':JSON[_0x3e87('0x45')](_0x361cc7)};return _0x11b6ab;}}});};exports[_0x3e87('0x7a')]=function(_0x2f588e,_0x443135,_0x33141a,_0x33bddd){return tilde[_0x3e87('0x4f')](_0x2f588e,_0x443135,_0x33141a,_0x33bddd)[_0x3e87('0x2f')](function(_0x4f9011){try{fs[_0x3e87('0x21')](_0x2f588e);}catch(_0x524d09){logger[_0x3e87('0x18')](_0x524d09);}logger[_0x3e87('0x1e')](_0x3e87('0x7b'),_0x4f9011[_0x3e87('0x54')]);logger['info'](_0x3e87('0x7c'),_0x4f9011[_0x3e87('0x56')]);return _0x4f9011;});};exports['awsPolly']=function(_0x2e47bd,_0x25e72a,_0x1d9e0d,_0x2d5dea,_0x436c36,_0x21faf3){var _0x4b75ba=path[_0x3e87('0x29')](__dirname,_0x3e87('0x2a'),rs['generate'](0x4)+_0x3e87('0x4e'));var _0x1ba8bc;return aws[_0x3e87('0x7d')](_0x2e47bd,_0x25e72a,_0x1d9e0d,_0x2d5dea,_0x436c36,_0x21faf3,_0x4b75ba)[_0x3e87('0x2f')](function(){_0x1ba8bc=path[_0x3e87('0x29')](__dirname,_0x3e87('0x2a'),rs[_0x3e87('0x2b')](0x4)+_0x3e87('0x2c'));return convertFile(_0x4b75ba,_0x1ba8bc);})['then'](function(){try{fs[_0x3e87('0x21')](_0x4b75ba);fs[_0x3e87('0x30')](_0x1ba8bc,_0x3e87('0x31'));}catch(_0x21b129){logger['error'](_0x21b129);}return _0x1ba8bc[_0x3e87('0x40')]('.')[0x0];});};exports['awsLex']=function(_0x85e94b,_0x666a1f,_0x3a029e,_0x3fe30f,_0x3a863e,_0x2b8fc5){return aws[_0x3e87('0x7e')](_0x85e94b,_0x666a1f,_0x3a029e,_0x3fe30f,_0x3a863e,_0x2b8fc5)[_0x3e87('0x2f')](function(_0x299ad7){logger[_0x3e87('0x1e')](JSON[_0x3e87('0x45')](_0x299ad7));return _0x299ad7;});};exports[_0x3e87('0x7f')]=function(_0x3d237a,_0x450cd8,_0x1368ab,_0x26767d){var _0x390ef2=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3d237a,encodeURIComponent(_0x450cd8),_0x1368ab,_0x26767d);var _0x2a14a3=path[_0x3e87('0x29')](__dirname,_0x3e87('0x2a'),rs['generate'](0x4)+_0x3e87('0x4e'));var _0x3f7212;return downloadFile(_0x390ef2,_0x2a14a3)[_0x3e87('0x2f')](function(){_0x3f7212=path['resolve'](__dirname,_0x3e87('0x2a'),rs[_0x3e87('0x2b')](0x4)+_0x3e87('0x2c'));return convertFile(_0x2a14a3,_0x3f7212);})['then'](function(){try{fs[_0x3e87('0x21')](_0x2a14a3);fs[_0x3e87('0x30')](_0x3f7212,_0x3e87('0x31'));}catch(_0x5396a8){logger[_0x3e87('0x18')](_0x5396a8);}return _0x3f7212['split']('.')[0x0];});};exports['ispeechASR']=function(_0x5eb363,_0x291889,_0x38ced6,_0x5701ce){var _0x42338e=util['format'](_0x3e87('0x80'),ISPEECH_API,_0x291889,_0x38ced6,base64Encode(_0x5eb363),_0x5701ce?util[_0x3e87('0x81')]('model=%s',encodeURIComponent(_0x5701ce)):_0x3e87('0x82'));return uploadFile(_0x42338e)[_0x3e87('0x2f')](function(_0x990f98){return querystring[_0x3e87('0xc')](_0x990f98);});};exports[_0x3e87('0x83')]=function(_0x380a57,_0x1d4c07){return sestek['nda'](_0x380a57,_0x1d4c07)[_0x3e87('0x2f')](function(_0x4085e0){logger[_0x3e87('0x1e')](JSON[_0x3e87('0x45')](_0x4085e0));var _0x48ba1f={'speech':_0x4085e0['text'],'action':_0x4085e0[_0x3e87('0x84')]?_0x4085e0[_0x3e87('0x84')]['CustomAction']:undefined,'actiondata':_0x4085e0['channelData']?_0x4085e0[_0x3e87('0x84')][_0x3e87('0x85')]:undefined};if(_0x4085e0[_0x3e87('0x84')]&&_0x4085e0[_0x3e87('0x84')][_0x3e87('0x86')]){return base64Decode(_0x4085e0[_0x3e87('0x84')][_0x3e87('0x86')]['Data'],path[_0x3e87('0x29')](__dirname,_0x3e87('0x2a'),rs[_0x3e87('0x2b')](0x4)+'.wav'))[_0x3e87('0x2f')](function(_0x13861f){_0x48ba1f['audiofile']=_0x13861f;return _0x48ba1f;});}return _0x48ba1f;});};exports[_0x3e87('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x5221=['goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','action','actionIncomplete','fulfillment','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','parse','./google','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','transcode','error\x20convert','resolve','generate','.wav','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','tmp','from','audioContent','777','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','length','lang\x20\x22','data','.mp3','writeFileSync'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x5221,0x1de));var _0x1522=function(_0x2100ce,_0x4efea6){_0x2100ce=_0x2100ce-0x0;var _0x724854=_0x5221[_0x2100ce];return _0x724854;};'use strict';var apiai=require(_0x1522('0x0'));var BPromise=require(_0x1522('0x1'));var dialogflow=require(_0x1522('0x2'));var fs=require('fs');var http=require(_0x1522('0x3'));var https=require(_0x1522('0x4'));var md5=require(_0x1522('0x5'));var path=require(_0x1522('0x6'));var querystring=require(_0x1522('0x7'));var rp=require(_0x1522('0x8'));var rs=require(_0x1522('0x9'));var sox=require(_0x1522('0xa'));var tts=require('google-tts-api');var urlParse=require('url')[_0x1522('0xb')];var util=require('util');var aws=require('./aws');var google=require(_0x1522('0xc'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0x1522('0xd'))(_0x1522('0xe'));var ISPEECH_API=_0x1522('0xf');function downloadFile(_0x1b2fd2,_0x173082){return new BPromise(function(_0x37fea8,_0x42bbb7){var _0x51c577=urlParse(_0x1b2fd2);var _0x8f6544=_0x51c577[_0x1522('0x10')]===_0x1522('0x11')?https:http;var _0x407585={'host':_0x51c577[_0x1522('0x12')],'path':_0x51c577[_0x1522('0x6')],'headers':{'user-agent':_0x1522('0x13')}};_0x8f6544[_0x1522('0x14')](_0x407585,function(_0x1fd22e){if(_0x1fd22e[_0x1522('0x15')]!==0xc8){logger['error'](_0x1522('0x16')+_0x1b2fd2+_0x1522('0x17')+_0x1fd22e[_0x1522('0x15')]+'\x20('+_0x1fd22e[_0x1522('0x18')]+')');_0x42bbb7(new Error(_0x1522('0x16')+_0x1b2fd2+_0x1522('0x17')+_0x1fd22e[_0x1522('0x15')]+'\x20('+_0x1fd22e[_0x1522('0x18')]+')'));return;}var _0x1a5ea1=fs[_0x1522('0x19')](_0x173082);_0x1a5ea1['on'](_0x1522('0x1a'),function(){logger[_0x1522('0x1b')](_0x1522('0x1c'));_0x1a5ea1[_0x1522('0x1d')](_0x37fea8);});_0x1a5ea1['on'](_0x1522('0x1e'),function(_0x2c0d3e){fs[_0x1522('0x1f')](_0x173082);logger['error'](_0x1522('0x20'),_0x2c0d3e);_0x42bbb7(_0x2c0d3e);});_0x1fd22e[_0x1522('0x21')](_0x1a5ea1);})['on']('error',function(_0x1fe037){logger[_0x1522('0x1e')](_0x1fe037);_0x42bbb7(_0x1fe037);})[_0x1522('0x22')]();});}function uploadFile(_0x4cee55){return new BPromise(function(_0x4de4c4,_0x42421b){var _0x283326=urlParse(_0x4cee55);var _0xb9f31b=_0x283326[_0x1522('0x10')]===_0x1522('0x11')?https:http;var _0x7b9f97={'host':_0x283326['host'],'path':_0x283326[_0x1522('0x6')],'headers':{'user-agent':'WHAT_EVER'}};_0xb9f31b[_0x1522('0x14')](_0x7b9f97,function(_0x58c710){if(_0x58c710[_0x1522('0x15')]!==0xc8){_0x42421b(new Error(_0x1522('0x16')+_0x4cee55+'\x20failed,\x20status\x20code\x20=\x20'+_0x58c710[_0x1522('0x15')]+'\x20('+_0x58c710[_0x1522('0x18')]+')'));return;}var _0x8cf1ed='';_0x58c710['on']('data',function(_0x42a79d){_0x8cf1ed+=_0x42a79d;});_0x58c710['on'](_0x1522('0x22'),function(){_0x4de4c4(_0x8cf1ed);});})['on'](_0x1522('0x1e'),function(_0x2b8f4c){_0x42421b(_0x2b8f4c);})[_0x1522('0x22')]();});}function convertFile(_0x48f903,_0x447fe2){return new BPromise(function(_0x779b91,_0x4fc75a){var _0x2a4f1e=sox[_0x1522('0x23')](_0x48f903,_0x447fe2,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2a4f1e['on']('error',function(_0x10bb94){logger[_0x1522('0x1e')](_0x1522('0x24'),_0x10bb94);_0x4fc75a(_0x10bb94);});_0x2a4f1e['on']('end',function(){logger[_0x1522('0x1b')]('finish\x20to\x20convert');_0x779b91();});_0x2a4f1e['start']();});}function base64Decode(_0x28bc4e,_0x4a2b47){var _0x22ab96=path[_0x1522('0x25')](__dirname,'tmp',rs[_0x1522('0x26')](0x4)+_0x1522('0x27'));fs['writeFileSync'](_0x22ab96,_0x28bc4e,_0x1522('0x28'));return convertFile(_0x22ab96,_0x4a2b47)[_0x1522('0x29')](function(){try{fs['unlink'](_0x22ab96);fs[_0x1522('0x2a')](_0x4a2b47,'777');}catch(_0x755cdc){logger[_0x1522('0x1e')](_0x755cdc);}return _0x4a2b47[_0x1522('0x2b')]('.')[0x0];});}function base64Encode(_0x424134){var _0x1a3111=fs[_0x1522('0x2c')](_0x424134);return new Buffer(_0x1a3111)[_0x1522('0x2d')]('base64');}exports[_0x1522('0x2e')]=function(_0x1e1a96,_0x4bbd9c,_0x121def,_0x16770,_0x5012fc,_0x2ae448){var _0x2532ee,_0x5625df;var _0x38ed1d=_0x1522('0x2f');var _0x162644=_0x1522('0x30')+_0x1e1a96;var _0x43bc5b={};if(_0x4bbd9c===_0x1522('0x31')){_0x43bc5b[_0x1522('0x32')]={'ssml':_0x121def};}else{_0x43bc5b[_0x1522('0x32')]={'text':_0x121def};};_0x43bc5b[_0x1522('0x33')]={'languageCode':_0x16770,'ssmlGender':_0x5012fc};_0x43bc5b[_0x1522('0x34')]={'audioEncoding':_0x1522('0x35'),'sampleRateHertz':0x1f40};var _0x407878={'url':_0x38ed1d+'text:synthesize'+_0x162644,'method':_0x1522('0x36'),'json':!![],'body':_0x43bc5b};return rp(_0x407878)[_0x1522('0x29')](function(_0x1c8f24){return new BPromise(function(_0x1dfd31,_0xd175ef){_0x2532ee=path[_0x1522('0x25')](__dirname,_0x1522('0x37'),rs['generate'](0x4)+'.mp3');var _0x4bfcbc=Buffer[_0x1522('0x38')](_0x1c8f24[_0x1522('0x39')],'base64');return fs['writeFile'](_0x2532ee,_0x4bfcbc,function(_0x46d60a){_0xd175ef(_0x46d60a);},function(_0xe36fef){fs[_0x1522('0x2a')](_0x2532ee,_0x1522('0x3a'));_0x1dfd31(_0xe36fef);});});})[_0x1522('0x29')](function(_0x23c7d1){_0x5625df=path[_0x1522('0x25')](__dirname,_0x1522('0x37'),rs[_0x1522('0x26')](0x4)+_0x1522('0x27'));return convertFile(_0x2532ee,_0x5625df);})[_0x1522('0x29')](function(){try{fs[_0x1522('0x1f')](_0x2532ee);fs[_0x1522('0x2a')](_0x5625df,'777');}catch(_0x565734){logger[_0x1522('0x1e')](_0x565734);}logger[_0x1522('0x1b')]('googleCloudTTS\x20path',_0x5625df[_0x1522('0x2b')]('.')[0x0]);return _0x5625df[_0x1522('0x2b')]('.')[0x0];});};exports[_0x1522('0x3b')]=function(_0x444aed,_0x308662){var _0x27e7a0=_0x1522('0x3c');var _0x45803d,_0xfb3a7b;var _0x357fdd;var _0x4808be={'encoding':_0x1522('0x3d'),'method':_0x1522('0x36'),'timeout':0x2710,'url':_0x27e7a0,'headers':{'Content-Type':_0x1522('0x3e')},'body':_0x1522('0x3f')+encodeURIComponent(JSON[_0x1522('0x40')]([[[_0x1522('0x41'),JSON[_0x1522('0x40')]([_0x444aed,_0x308662||'en',![],_0x1522('0x42')]),null,_0x1522('0x43')]]]))};return rp(_0x4808be)[_0x1522('0x29')](function(_0x459b79){try{_0x357fdd=eval(_0x459b79[_0x1522('0x44')](0x5))[0x0][0x2];}catch(_0xed704c){throw new Error('parse\x20response\x20failed:\x0a'+_0x459b79['data']);}if(!_0x357fdd){if(_0x444aed[_0x1522('0x45')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x1522('0x46')+_0x308662+'\x22\x20might\x20not\x20exist');}}try{_0x357fdd=eval(_0x357fdd)[0x0];}catch(_0x4308c1){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x1522('0x47')]);}const _0x528ce7=_0x357fdd;_0x45803d=path['resolve'](__dirname,_0x1522('0x37'),rs['generate'](0x4)+_0x1522('0x48'));fs[_0x1522('0x49')](_0x45803d,_0x357fdd,{'encoding':_0x1522('0x28')});_0xfb3a7b=path['resolve'](__dirname,_0x1522('0x37'),rs[_0x1522('0x26')](0x4)+'.wav');return convertFile(_0x45803d,_0xfb3a7b);})[_0x1522('0x29')](function(){try{fs[_0x1522('0x1f')](_0x45803d);fs['chmodSync'](_0xfb3a7b,_0x1522('0x3a'));}catch(_0x225b33){logger[_0x1522('0x1e')](_0x225b33);}logger[_0x1522('0x1b')](_0x1522('0x4a'),_0xfb3a7b[_0x1522('0x2b')]('.')[0x0]);return _0xfb3a7b[_0x1522('0x2b')]('.')[0x0];});};exports[_0x1522('0x4b')]=function(_0x48190e,_0x40ad1f,_0x331e12){return google[_0x1522('0x4c')](_0x48190e,_0x40ad1f,_0x331e12)['then'](function(_0x4d6c74){logger['info'](_0x4d6c74[_0x1522('0x4d')]);return rp(_0x4d6c74);})[_0x1522('0x29')](function(_0x42fe19){var _0x423d16='';var _0x328920=0x0;try{fs[_0x1522('0x1f')](_0x48190e);}catch(_0x4b45e4){logger[_0x1522('0x1e')](_0x4b45e4);}if(_0x42fe19&&_0x42fe19[_0x1522('0x4e')]){_0x423d16=_0x42fe19[_0x1522('0x4e')][_0x1522('0x4f')](function(_0x5ac24f){return _0x5ac24f&&_0x5ac24f[_0x1522('0x50')][0x0]&&_0x5ac24f[_0x1522('0x50')][0x0][_0x1522('0x51')]?_0x5ac24f[_0x1522('0x50')][0x0][_0x1522('0x51')]:'';})['join']('\x0a');_0x328920=_0x42fe19[_0x1522('0x4e')]['map'](function(_0x4e3d57){return _0x4e3d57&&_0x4e3d57[_0x1522('0x50')][0x0]&&_0x4e3d57[_0x1522('0x50')][0x0][_0x1522('0x52')]?_0x4e3d57['alternatives'][0x0]['confidence']:0x0;})[_0x1522('0x53')]('\x0a');}logger[_0x1522('0x1b')](_0x1522('0x54'),_0x423d16);logger[_0x1522('0x1b')]('googleASR\x20confidence',_0x328920);return{'transcript':_0x423d16,'confidence':_0x328920};})[_0x1522('0x55')](function(_0x33910c){logger[_0x1522('0x1e')](_0x1522('0x56'),_0x33910c[_0x1522('0x15')],_0x33910c[_0x1522('0x57')],_0x33910c[_0x1522('0x58')]);});};exports[_0x1522('0x59')]=function(_0x1d6949,_0xa439ca,_0xde60ca,_0x53316a){var _0x4760d1=apiai(_0xa439ca,{'language':_0x53316a||'en'});return _0x4760d1['textRequest'](_0xde60ca,{'sessionId':md5(_0x1d6949)})[_0x1522('0x29')](function(_0x403249){logger[_0x1522('0x1b')](JSON[_0x1522('0x40')](_0x403249));return{'source':_0x403249[_0x1522('0x5a')][_0x1522('0x5b')],'resolvedQuery':_0x403249[_0x1522('0x5a')][_0x1522('0x5c')],'action':_0x403249[_0x1522('0x5a')][_0x1522('0x5d')],'actionIncomplete':_0x403249[_0x1522('0x5a')][_0x1522('0x5e')],'speech':_0x403249[_0x1522('0x5a')][_0x1522('0x5f')]['speech'],'score':_0x403249[_0x1522('0x5a')]['score'],'statusCode':_0x403249['status'][_0x1522('0x60')],'endConversation':_0x403249[_0x1522('0x5a')][_0x1522('0x61')][_0x1522('0x62')]||![],'isFallbackIntent':_0x403249[_0x1522('0x5a')][_0x1522('0x61')][_0x1522('0x63')]};});};exports[_0x1522('0x64')]=function(_0x1246b4,_0x40f3be,_0x1aa1ac,_0x3594f3,_0x2bcb0e,_0x3d2ce7){var _0x518c9b=_0x3594f3[_0x1522('0x65')](/\\n/g,'\x0a');var _0x4b12c1={'credentials':{'private_key':_0x518c9b,'client_email':_0x1aa1ac}};var _0x15b414=new dialogflow[(_0x1522('0x66'))](_0x4b12c1);var _0x1c81bb=_0x15b414[_0x1522('0x67')](_0x40f3be,md5(_0x1246b4));var _0x5efe5f={'session':_0x1c81bb,'queryInput':{'text':{'text':_0x2bcb0e,'languageCode':_0x3d2ce7}}};return _0x15b414[_0x1522('0x68')](_0x5efe5f)[_0x1522('0x29')](function(_0x4bc367){if(_0x4bc367&&_0x4bc367[_0x1522('0x45')]){logger[_0x1522('0x1b')](_0x1522('0x69'),JSON['stringify'](_0x4bc367));var _0x121862=_0x4bc367[0x0];if(_0x121862){var _0x127e64={'action':_0x121862[_0x1522('0x6a')][_0x1522('0x5d')],'allRequiredParamsPresent':_0x121862[_0x1522('0x6a')][_0x1522('0x6b')],'endConversation':_0x121862[_0x1522('0x6a')][_0x1522('0x6c')]&&_0x121862[_0x1522('0x6a')]['diagnosticInfo'][_0x1522('0x6d')]?_0x121862[_0x1522('0x6a')][_0x1522('0x6c')][_0x1522('0x6d')][_0x1522('0x6e')]['boolValue']:![],'fulfillmentText':_0x121862[_0x1522('0x6a')]['fulfillmentText'],'intentName':_0x121862[_0x1522('0x6a')][_0x1522('0x6f')][_0x1522('0x57')],'intentDisplayName':_0x121862[_0x1522('0x6a')][_0x1522('0x6f')][_0x1522('0x70')],'isFallbackIntent':_0x121862[_0x1522('0x6a')][_0x1522('0x6f')][_0x1522('0x71')],'languageCode':_0x121862[_0x1522('0x6a')][_0x1522('0x72')],'queryText':_0x121862[_0x1522('0x6a')][_0x1522('0x73')],'responseId':_0x121862[_0x1522('0x74')],'score':_0x121862[_0x1522('0x6a')][_0x1522('0x75')],'speech':_0x121862['queryResult'][_0x1522('0x76')],'providerResponse':JSON[_0x1522('0x40')](_0x4bc367)};return _0x127e64;}}});};exports[_0x1522('0x77')]=function(_0x5d02e9,_0x44f94d,_0x2383d1,_0x32f79f){return tilde[_0x1522('0x4c')](_0x5d02e9,_0x44f94d,_0x2383d1,_0x32f79f)[_0x1522('0x29')](function(_0x32427b){try{fs[_0x1522('0x1f')](_0x5d02e9);}catch(_0x3a3da0){logger[_0x1522('0x1e')](_0x3a3da0);}logger[_0x1522('0x1b')](_0x1522('0x78'),_0x32427b[_0x1522('0x51')]);logger[_0x1522('0x1b')](_0x1522('0x79'),_0x32427b[_0x1522('0x52')]);return _0x32427b;});};exports['awsPolly']=function(_0x11cb7c,_0x41eaee,_0x46c5ad,_0x4780fa,_0x100ed4,_0x3280e6){var _0x51e5f1=path[_0x1522('0x25')](__dirname,'tmp',rs[_0x1522('0x26')](0x4)+'.mp3');var _0x5d3f4a;return aws[_0x1522('0x7a')](_0x11cb7c,_0x41eaee,_0x46c5ad,_0x4780fa,_0x100ed4,_0x3280e6,_0x51e5f1)[_0x1522('0x29')](function(){_0x5d3f4a=path[_0x1522('0x25')](__dirname,_0x1522('0x37'),rs[_0x1522('0x26')](0x4)+_0x1522('0x27'));return convertFile(_0x51e5f1,_0x5d3f4a);})[_0x1522('0x29')](function(){try{fs[_0x1522('0x1f')](_0x51e5f1);fs[_0x1522('0x2a')](_0x5d3f4a,_0x1522('0x3a'));}catch(_0x29001e){logger[_0x1522('0x1e')](_0x29001e);}return _0x5d3f4a[_0x1522('0x2b')]('.')[0x0];});};exports[_0x1522('0x7b')]=function(_0xabd74c,_0xdce01a,_0x63222c,_0x574b1,_0x5a9b96,_0x4ecf8b){return aws[_0x1522('0x7c')](_0xabd74c,_0xdce01a,_0x63222c,_0x574b1,_0x5a9b96,_0x4ecf8b)[_0x1522('0x29')](function(_0x2af88b){logger[_0x1522('0x1b')](JSON[_0x1522('0x40')](_0x2af88b));return _0x2af88b;});};exports[_0x1522('0x7d')]=function(_0x275a6c,_0x34ad2d,_0x3489a1,_0x58c167){var _0x583b92=util[_0x1522('0x7e')](_0x1522('0x7f'),ISPEECH_API,_0x275a6c,encodeURIComponent(_0x34ad2d),_0x3489a1,_0x58c167);var _0x4a6c64=path[_0x1522('0x25')](__dirname,_0x1522('0x37'),rs[_0x1522('0x26')](0x4)+_0x1522('0x48'));var _0x4d9b22;return downloadFile(_0x583b92,_0x4a6c64)[_0x1522('0x29')](function(){_0x4d9b22=path[_0x1522('0x25')](__dirname,_0x1522('0x37'),rs[_0x1522('0x26')](0x4)+_0x1522('0x27'));return convertFile(_0x4a6c64,_0x4d9b22);})[_0x1522('0x29')](function(){try{fs['unlink'](_0x4a6c64);fs[_0x1522('0x2a')](_0x4d9b22,_0x1522('0x3a'));}catch(_0x110acd){logger[_0x1522('0x1e')](_0x110acd);}return _0x4d9b22[_0x1522('0x2b')]('.')[0x0];});};exports[_0x1522('0x80')]=function(_0x47ad18,_0x280c1c,_0x9974d0,_0x3a2cad){var _0x151050=util[_0x1522('0x7e')](_0x1522('0x81'),ISPEECH_API,_0x280c1c,_0x9974d0,base64Encode(_0x47ad18),_0x3a2cad?util[_0x1522('0x7e')]('model=%s',encodeURIComponent(_0x3a2cad)):_0x1522('0x82'));return uploadFile(_0x151050)['then'](function(_0x526ba9){return querystring[_0x1522('0xb')](_0x526ba9);});};exports[_0x1522('0x83')]=function(_0x15a839,_0x252d06){return sestek[_0x1522('0x84')](_0x15a839,_0x252d06)[_0x1522('0x29')](function(_0x5c9701){logger[_0x1522('0x1b')](JSON[_0x1522('0x40')](_0x5c9701));var _0x183878={'speech':_0x5c9701[_0x1522('0x85')],'action':_0x5c9701[_0x1522('0x86')]?_0x5c9701[_0x1522('0x86')][_0x1522('0x87')]:undefined,'actiondata':_0x5c9701[_0x1522('0x86')]?_0x5c9701[_0x1522('0x86')][_0x1522('0x88')]:undefined};if(_0x5c9701['channelData']&&_0x5c9701['channelData'][_0x1522('0x89')]){return base64Decode(_0x5c9701['channelData']['AudioFromTts']['Data'],path[_0x1522('0x25')](__dirname,_0x1522('0x37'),rs[_0x1522('0x26')](0x4)+_0x1522('0x27')))[_0x1522('0x29')](function(_0x46e14f){_0x183878['audiofile']=_0x46e14f;return _0x183878;});}return _0x183878;});};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 946b32d..692718f 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 _0x76bd=['./nda','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x76bd,0x102));var _0xd76b=function(_0x131f42,_0x102c01){_0x131f42=_0x131f42-0x0;var _0x3a72ba=_0x76bd[_0x131f42];return _0x3a72ba;};var nda=require(_0xd76b('0x0'));module[_0xd76b('0x1')]={'nda':nda}; \ No newline at end of file +var _0x1184=['exports','./nda'];(function(_0x38ce60,_0x123fe2){var _0x44ab67=function(_0x1d0cb4){while(--_0x1d0cb4){_0x38ce60['push'](_0x38ce60['shift']());}};_0x44ab67(++_0x123fe2);}(_0x1184,0x10b));var _0x4118=function(_0x5c77c2,_0x42bf6e){_0x5c77c2=_0x5c77c2-0x0;var _0x441ea4=_0x1184[_0x5c77c2];return _0x441ea4;};var nda=require(_0x4118('0x0'));module[_0x4118('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index e6823db..1c74d4d 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 _0xb945=['Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','stringify','request-promise','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension'];(function(_0x595c73,_0x3a5e9c){var _0x561590=function(_0x5443f3){while(--_0x5443f3){_0x595c73['push'](_0x595c73['shift']());}};_0x561590(++_0x3a5e9c);}(_0xb945,0x97));var _0x5b94=function(_0x438dcd,_0x4894ef){_0x438dcd=_0x438dcd-0x0;var _0x1446ab=_0xb945[_0x438dcd];return _0x1446ab;};'use strict';var rp=require(_0x5b94('0x0'));var url=require('url');var logger=require(_0x5b94('0x1'))('agi');module[_0x5b94('0x2')]=function(_0x4cc83f,_0x488e8d){var _0x43c9d3={'method':_0x5b94('0x3'),'uri':url[_0x5b94('0x4')](_0x488e8d[_0x5b94('0x5')],_0x5b94('0x6')),'form':{'grant_type':'password','username':_0x488e8d['username'],'password':_0x488e8d[_0x5b94('0x7')]},'json':!![]};return rp(_0x43c9d3)[_0x5b94('0x8')](function(_0x42bd69){var _0x186d22={'method':'POST','uri':url[_0x5b94('0x4')](_0x488e8d['ndassistant_url'],_0x5b94('0x9')),'body':{'type':_0x488e8d[_0x5b94('0xa')]||_0x5b94('0xb'),'channelId':_0x5b94('0xc'),'conversation':{'id':_0x4cc83f[_0x5b94('0xd')]},'from':{'id':_0x4cc83f[_0x5b94('0xe')],'name':_0x4cc83f[_0x5b94('0xf')]},'recipient':{'id':_0x4cc83f['dnid'],'name':_0x4cc83f[_0x5b94('0x10')]},'text':_0x488e8d['text'],'channelData':{}},'headers':{'Authorization':_0x5b94('0x11')+_0x42bd69[_0x5b94('0x12')]},'json':!![]};if(_0x488e8d[_0x5b94('0x13')]){_0x186d22[_0x5b94('0x14')][_0x5b94('0x15')]['ProjectName']=_0x488e8d[_0x5b94('0x13')];}if(_0x488e8d[_0x5b94('0x16')]=='1'){_0x186d22[_0x5b94('0x14')][_0x5b94('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5b94('0x17')};}if(_0x488e8d['custom_action']){_0x186d22[_0x5b94('0x14')][_0x5b94('0x15')]['CustomAction']=_0x488e8d[_0x5b94('0x18')];if(_0x488e8d[_0x5b94('0x19')]){_0x186d22[_0x5b94('0x14')]['channelData'][_0x5b94('0x1a')]=_0x488e8d[_0x5b94('0x19')];}}logger['info'](JSON[_0x5b94('0x1b')](_0x186d22));return rp(_0x186d22);});}; \ No newline at end of file +var _0xb98f=['ndaactivity_type','message','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password'];(function(_0x9a5a9f,_0x2680bb){var _0x2a91d7=function(_0x576c28){while(--_0x576c28){_0x9a5a9f['push'](_0x9a5a9f['shift']());}};_0x2a91d7(++_0x2680bb);}(_0xb98f,0xce));var _0xfb98=function(_0x5053b0,_0x1ee399){_0x5053b0=_0x5053b0-0x0;var _0x3f6711=_0xb98f[_0x5053b0];return _0x3f6711;};'use strict';var rp=require(_0xfb98('0x0'));var url=require(_0xfb98('0x1'));var logger=require(_0xfb98('0x2'))(_0xfb98('0x3'));module[_0xfb98('0x4')]=function(_0x4f16b2,_0x5570ce){var _0x593d54={'method':_0xfb98('0x5'),'uri':url[_0xfb98('0x6')](_0x5570ce[_0xfb98('0x7')],_0xfb98('0x8')),'form':{'grant_type':'password','username':_0x5570ce[_0xfb98('0x9')],'password':_0x5570ce[_0xfb98('0xa')]},'json':!![]};return rp(_0x593d54)['then'](function(_0x27b394){var _0x4d06fc={'method':'POST','uri':url['resolve'](_0x5570ce['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5570ce[_0xfb98('0xb')]||_0xfb98('0xc'),'channelId':'Nda','conversation':{'id':_0x4f16b2['uniqueid']},'from':{'id':_0x4f16b2[_0xfb98('0xd')],'name':_0x4f16b2['calleridname']},'recipient':{'id':_0x4f16b2[_0xfb98('0xe')],'name':_0x4f16b2[_0xfb98('0xf')]},'text':_0x5570ce[_0xfb98('0x10')],'channelData':{}},'headers':{'Authorization':_0xfb98('0x11')+_0x27b394[_0xfb98('0x12')]},'json':!![]};if(_0x5570ce[_0xfb98('0x13')]){_0x4d06fc[_0xfb98('0x14')][_0xfb98('0x15')][_0xfb98('0x16')]=_0x5570ce[_0xfb98('0x13')];}if(_0x5570ce[_0xfb98('0x17')]=='1'){_0x4d06fc[_0xfb98('0x14')][_0xfb98('0x15')][_0xfb98('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5570ce[_0xfb98('0x19')]){_0x4d06fc['body'][_0xfb98('0x15')][_0xfb98('0x1a')]=_0x5570ce[_0xfb98('0x19')];if(_0x5570ce[_0xfb98('0x1b')]){_0x4d06fc[_0xfb98('0x14')]['channelData'][_0xfb98('0x1c')]=_0x5570ce[_0xfb98('0x1b')];}}logger[_0xfb98('0x1d')](JSON[_0xfb98('0x1e')](_0x4d06fc));return rp(_0x4d06fc);});}; \ 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 f10fcd0..98504ab 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 _0xfe89=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe89,0x12b));var _0x9fe8=function(_0x29959e,_0x1f6bcb){_0x29959e=_0x29959e-0x0;var _0x3aa706=_0xfe89[_0x29959e];return _0x3aa706;};'use strict';var asr=require('./lib/api');module[_0x9fe8('0x0')]=function(_0x43a969,_0x26e8cb,_0x18e7ab,_0x59dcec){return asr(_0x43a969,_0x26e8cb,_0x18e7ab,_0x59dcec);}; \ No newline at end of file +var _0x9a6d=['exports','./lib/api'];(function(_0x5414c5,_0x34cd74){var _0xb64a=function(_0x341a34){while(--_0x341a34){_0x5414c5['push'](_0x5414c5['shift']());}};_0xb64a(++_0x34cd74);}(_0x9a6d,0x171));var _0xd9a6=function(_0x4ad802,_0x4c7cc5){_0x4ad802=_0x4ad802-0x0;var _0x2e2105=_0x9a6d[_0x4ad802];return _0x2e2105;};'use strict';var asr=require(_0xd9a6('0x0'));module[_0xd9a6('0x1')]=function(_0x1c21ad,_0x5154b9,_0x318495,_0x6ae67d){return asr(_0x1c21ad,_0x5154b9,_0x318495,_0x6ae67d);}; \ 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 c5910c9..9f333bb 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 _0x1eaf=['update','digest','unix','send','stringify','createReadStream','data','EOS','terminate','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','crypto','../../../../../../config/logger','info','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'];(function(_0x5d99c6,_0x2447af){var _0x2d2c9a=function(_0x2130f9){while(--_0x2130f9){_0x5d99c6['push'](_0x5d99c6['shift']());}};_0x2d2c9a(++_0x2447af);}(_0x1eaf,0x1c8));var _0xf1ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1eaf[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xf1ea('0x0'));var logger=require(_0xf1ea('0x1'))('agi');module['exports']=function(_0x2cb895,_0x40b936,_0x436017,_0x51ad9b){return new BPromise(function(_0x1d4b86,_0x4f9a73){logger[_0xf1ea('0x2')]('Tilde\x20URI',_0x51ad9b||_0xf1ea('0x3'));var _0xdbcaf8=new WebSocket(_0x51ad9b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x37318='';var _0x5b7b13='0';var _0xec6d45='1';var _0x19c9d0=_0xf1ea('0x4');function _0x33e939(_0x1fed63){var _0x4081b5=crypto['createHash'](_0xf1ea('0x5'));_0x4081b5[_0xf1ea('0x6')](_0x1fed63);return _0x4081b5[_0xf1ea('0x7')]('hex');}function _0x38e721(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x2112b8=moment()[_0xf1ea('0x8')]();var _0x526717=_0x33e939(_0x2112b8+_0x40b936+_0x436017);_0xdbcaf8[_0xf1ea('0x9')](JSON[_0xf1ea('0xa')]({'appID':_0x40b936,'timestamp':_0x2112b8,'appKey':_0x526717}));var _0x3fb4e6=fs[_0xf1ea('0xb')](_0x2cb895);_0x3fb4e6['on'](_0xf1ea('0xc'),function(_0x3a9cd4){_0xdbcaf8['send'](_0x3a9cd4);});_0x3fb4e6['on']('close',function(){_0xdbcaf8[_0xf1ea('0x9')](_0xf1ea('0xd'));});}catch(_0x42d056){logger['error']('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x42d056));_0xdbcaf8[_0xf1ea('0xe')]();}}function _0x20717c(_0x200071){try{if(_0x200071){var _0x120c1b=JSON['parse'](_0x200071);switch(_0x120c1b[_0xf1ea('0xf')]){case 0x0:if(_0x120c1b['result']){if(_0x120c1b['result'][_0xf1ea('0x10')]){logger[_0xf1ea('0x2')](_0xf1ea('0x11'),JSON[_0xf1ea('0xa')](_0x120c1b[_0xf1ea('0x12')][_0xf1ea('0x13')]));_0x37318=_0x120c1b[_0xf1ea('0x12')][_0xf1ea('0x13')][0x0][_0xf1ea('0x14')];_0x5b7b13=_0x120c1b[_0xf1ea('0x12')][_0xf1ea('0x13')][0x0][_0xf1ea('0x15')];_0xec6d45='0';_0x19c9d0='Success.';_0xdbcaf8[_0xf1ea('0xe')]();}}break;case 0x1:logger[_0xf1ea('0x2')](_0xf1ea('0x4'));_0xec6d45='1';_0x19c9d0='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xf1ea('0x2')](_0xf1ea('0x16'));_0xec6d45='2';_0x19c9d0=_0xf1ea('0x16');break;case 0x9:logger['info'](_0xf1ea('0x17'));_0xec6d45='9';_0x19c9d0=_0xf1ea('0x17');break;case 0xa:logger[_0xf1ea('0x2')]('Authentication\x20failed.');_0xec6d45='10';_0x19c9d0='Authentication\x20failed.';break;case 0xb:logger[_0xf1ea('0x2')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xec6d45='11';_0x19c9d0=_0xf1ea('0x18');}}}catch(_0x35dd94){logger[_0xf1ea('0x19')](_0xf1ea('0x1a'),JSON['stringify'](_0x35dd94));_0xdbcaf8['terminate']();}}function _0x19ce3f(){logger[_0xf1ea('0x2')](_0xf1ea('0x1b'));_0x1d4b86({'transcript':_0x37318,'confidence':_0x5b7b13,'status':_0xec6d45,'status_message':_0x19c9d0});}function _0x23d95e(_0x2d0562){logger[_0xf1ea('0x19')](_0xf1ea('0x1c'));if(!_[_0xf1ea('0x1d')](_0x2d0562)){logger['error'](_[_0xf1ea('0x1e')](_0x2d0562)?JSON[_0xf1ea('0xa')](_0x2d0562):_0x2d0562);}}_0xdbcaf8['on'](_0xf1ea('0x1f'),_0x38e721);_0xdbcaf8['on']('message',_0x20717c);_0xdbcaf8['on'](_0xf1ea('0x20'),_0x19ce3f);_0xdbcaf8['on'](_0xf1ea('0x19'),_0x23d95e);});}; \ No newline at end of file +var _0xd7b0=['Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message','close','bluebird','lodash','moment','../../../../../../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','sha1','update','digest','hex','unix','stringify','createReadStream','data','send','error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x26bb34,_0x29f03f){var _0x24a482=function(_0x27acfd){while(--_0x27acfd){_0x26bb34['push'](_0x26bb34['shift']());}};_0x24a482(++_0x29f03f);}(_0xd7b0,0xec));var _0x0d7b=function(_0x2dbdcb,_0x27e2bd){_0x2dbdcb=_0x2dbdcb-0x0;var _0x4bdb33=_0xd7b0[_0x2dbdcb];return _0x4bdb33;};'use strict';var BPromise=require(_0x0d7b('0x0'));var _=require(_0x0d7b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0d7b('0x2'));var crypto=require('crypto');var logger=require(_0x0d7b('0x3'))(_0x0d7b('0x4'));module[_0x0d7b('0x5')]=function(_0x438bd3,_0x1b40fe,_0x2e6fda,_0xedfcf1){return new BPromise(function(_0x2b785d,_0x28105c){logger[_0x0d7b('0x6')](_0x0d7b('0x7'),_0xedfcf1||_0x0d7b('0x8'));var _0x3ef1f0=new WebSocket(_0xedfcf1||_0x0d7b('0x8'),{'perMessageDeflate':![]});var _0x34c5ef='';var _0x2d194a='0';var _0x1e3eb5='1';var _0x5bbd19=_0x0d7b('0x9');function _0x16f2e2(_0x5b2c86){var _0x4c8a5a=crypto[_0x0d7b('0xa')](_0x0d7b('0xb'));_0x4c8a5a[_0x0d7b('0xc')](_0x5b2c86);return _0x4c8a5a[_0x0d7b('0xd')](_0x0d7b('0xe'));}function _0x35d8f6(){try{logger[_0x0d7b('0x6')]('Open\x20Tilde\x20ASR\x20socket');var _0x39b0dc=moment()[_0x0d7b('0xf')]();var _0x614535=_0x16f2e2(_0x39b0dc+_0x1b40fe+_0x2e6fda);_0x3ef1f0['send'](JSON[_0x0d7b('0x10')]({'appID':_0x1b40fe,'timestamp':_0x39b0dc,'appKey':_0x614535}));var _0x5d6ea5=fs[_0x0d7b('0x11')](_0x438bd3);_0x5d6ea5['on'](_0x0d7b('0x12'),function(_0x4c0ea3){_0x3ef1f0[_0x0d7b('0x13')](_0x4c0ea3);});_0x5d6ea5['on']('close',function(){_0x3ef1f0[_0x0d7b('0x13')]('EOS');});}catch(_0x5829f4){logger[_0x0d7b('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x0d7b('0x10')](_0x5829f4));_0x3ef1f0['terminate']();}}function _0x49aa93(_0x16c947){try{if(_0x16c947){var _0x134991=JSON[_0x0d7b('0x15')](_0x16c947);switch(_0x134991[_0x0d7b('0x16')]){case 0x0:if(_0x134991['result']){if(_0x134991[_0x0d7b('0x17')][_0x0d7b('0x18')]){logger['info'](_0x0d7b('0x19'),JSON[_0x0d7b('0x10')](_0x134991['result'][_0x0d7b('0x1a')]));_0x34c5ef=_0x134991[_0x0d7b('0x17')][_0x0d7b('0x1a')][0x0]['transcript'];_0x2d194a=_0x134991[_0x0d7b('0x17')]['hypotheses'][0x0][_0x0d7b('0x1b')];_0x1e3eb5='0';_0x5bbd19='Success.';_0x3ef1f0[_0x0d7b('0x1c')]();}}break;case 0x1:logger[_0x0d7b('0x6')](_0x0d7b('0x9'));_0x1e3eb5='1';_0x5bbd19=_0x0d7b('0x9');break;case 0x2:logger[_0x0d7b('0x6')](_0x0d7b('0x1d'));_0x1e3eb5='2';_0x5bbd19=_0x0d7b('0x1d');break;case 0x9:logger['info'](_0x0d7b('0x1e'));_0x1e3eb5='9';_0x5bbd19='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x0d7b('0x6')](_0x0d7b('0x1f'));_0x1e3eb5='10';_0x5bbd19=_0x0d7b('0x1f');break;case 0xb:logger[_0x0d7b('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x1e3eb5='11';_0x5bbd19='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x1a5d60){logger['error'](_0x0d7b('0x20'),JSON[_0x0d7b('0x10')](_0x1a5d60));_0x3ef1f0['terminate']();}}function _0x50f703(){logger[_0x0d7b('0x6')](_0x0d7b('0x21'));_0x2b785d({'transcript':_0x34c5ef,'confidence':_0x2d194a,'status':_0x1e3eb5,'status_message':_0x5bbd19});}function _0x4539eb(_0x22456d){logger[_0x0d7b('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x0d7b('0x22')](_0x22456d)){logger[_0x0d7b('0x14')](_[_0x0d7b('0x23')](_0x22456d)?JSON['stringify'](_0x22456d):_0x22456d);}}_0x3ef1f0['on']('open',_0x35d8f6);_0x3ef1f0['on'](_0x0d7b('0x24'),_0x49aa93);_0x3ef1f0['on'](_0x0d7b('0x25'),_0x50f703);_0x3ef1f0['on'](_0x0d7b('0x14'),_0x4539eb);});}; \ 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 b266744..675afb9 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 _0x0732=['exports'];(function(_0x3305e0,_0x2439c0){var _0x36218c=function(_0x1ab339){while(--_0x1ab339){_0x3305e0['push'](_0x3305e0['shift']());}};_0x36218c(++_0x2439c0);}(_0x0732,0x18b));var _0x2073=function(_0x5d8d5f,_0x1adf93){_0x5d8d5f=_0x5d8d5f-0x0;var _0x10be5c=_0x0732[_0x5d8d5f];return _0x10be5c;};var asr=require('./asr');module[_0x2073('0x0')]={'asr':asr}; \ No newline at end of file +var _0xf91e=['./asr'];(function(_0x2c094f,_0xe5a1b0){var _0x2f7176=function(_0x28e5f5){while(--_0x28e5f5){_0x2c094f['push'](_0x2c094f['shift']());}};_0x2f7176(++_0xe5a1b0);}(_0xf91e,0xd0));var _0xef91=function(_0x5a1215,_0xe16f29){_0x5a1215=_0x5a1215-0x0;var _0x36093c=_0xf91e[_0x5a1215];return _0x36093c;};var asr=require(_0xef91('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 346da93..fe32b5b 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +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(_0x59fffa,_0x5a61db){var _0x281d4e=function(_0x5327ca){while(--_0x5327ca){_0x59fffa['push'](_0x59fffa['shift']());}};_0x281d4e(++_0x5a61db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index adc14c0..29283c9 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 _0x4bc3=['exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','body','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','length','saveRestApiResult','isEmpty','%s.%s','isArray','setVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','scheduledAt','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20client_email\x20configured','no\x20private_key\x20configured','bot','providerResponse','speech','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','toUpperCase','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','.wav','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','menu','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','no\x20find\x20by\x20configured','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','escape_digits','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','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','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','replaceAll','join','exports','util','lodash','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','getsecretdigits','channel','rpc','getVariable','getVariableById','name','catch','prototype','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','then','getSoundById','getSoundPath','save_name','getMailAccountById','mailRpc','sendMailMessage','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','priority','dnid','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand'];(function(_0x217ecd,_0x5b35da){var _0x50b480=function(_0x40cb44){while(--_0x40cb44){_0x217ecd['push'](_0x217ecd['shift']());}};_0x50b480(++_0x5b35da);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x4bc3[_0x5f1391];return _0x50ebe3;};'use strict';var fs=require('fs');var util=require(_0x34bc('0x0'));var _=require(_0x34bc('0x1'));var sh=require('shelljs');var odbc=require(_0x34bc('0x2'))();var rs=require(_0x34bc('0x3'));var moment=require('moment');var Mustache=require(_0x34bc('0x4'));var rp=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var scripts=require(_0x34bc('0x9'));var FILES_PATH=_0x34bc('0xa');var recursiveMapAttributes=['rawHeaders',_0x34bc('0xb')];var verticesWithRetry=['menu','getdigits',_0x34bc('0xc')];var AGIVertices=function(_0x474108,_0x1f72d8,_0x365e49){this[_0x34bc('0xd')]=_0x474108;this[_0x34bc('0xe')]=_0x1f72d8;this['mailRpc']=_0x365e49;};AGIVertices['prototype'][_0x34bc('0xf')]=function(_0x33025c,_0x2a35f3){this['rpc'][_0x34bc('0x10')](_0x33025c)['then'](function(_0x1ecedf){_0x2a35f3(null,_0x1ecedf?_0x1ecedf[_0x34bc('0x11')]:![]);})[_0x34bc('0x12')](function(_0x536ebd){_0x2a35f3(_0x536ebd);});};AGIVertices[_0x34bc('0x13')]['getVoiceQueue']=function(_0x12cf72,_0x43ff68){this[_0x34bc('0xe')]['getVoiceQueueById'](_0x12cf72)['then'](function(_0x354868){_0x43ff68(null,_0x354868?_0x354868['name']:![]);})[_0x34bc('0x12')](function(_0x217605){_0x43ff68(_0x217605);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x14')]=function(_0x2db2dd,_0x69542f){this['rpc']['getSquareProjectById'](_0x2db2dd)['then'](function(_0x4205eb){_0x69542f(null,_0x4205eb?_0x4205eb[_0x34bc('0x11')]:![]);})[_0x34bc('0x12')](function(_0x239e6c){_0x69542f(_0x239e6c);});};AGIVertices['prototype'][_0x34bc('0x15')]=function(_0x3ca9e8,_0x50106a){this[_0x34bc('0xe')][_0x34bc('0x16')](_0x3ca9e8)['then'](function(_0x14cec8){_0x50106a(null,_0x14cec8?_0x14cec8[_0x34bc('0x17')]:![]);})[_0x34bc('0x12')](function(_0x120bd3){_0x50106a(_0x120bd3);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x18')]=function(_0x48087e,_0x40e128){this[_0x34bc('0xe')][_0x34bc('0x19')](_0x48087e)['then'](function(_0x4c4b9a){_0x40e128(null,_0x4c4b9a?_0x4c4b9a[_0x34bc('0x11')]:![]);})[_0x34bc('0x12')](function(_0x4263de){_0x40e128(_0x4263de);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x1a')]=function(_0x2e22e3,_0x3f3653){this[_0x34bc('0xe')][_0x34bc('0x1b')](_0x2e22e3)[_0x34bc('0x1c')](function(_0x2de017){_0x3f3653(null,_0x2de017?_0x2de017[_0x34bc('0x11')]:![]);})['catch'](function(_0x43e527){_0x3f3653(_0x43e527);});};AGIVertices['prototype']['getSound']=function(_0x3da96b,_0x5332c8){var _0x4082c3=this;this[_0x34bc('0xe')][_0x34bc('0x1d')](_0x3da96b)['then'](function(_0x2e6d96){_0x5332c8(null,_0x2e6d96?_0x4082c3[_0x34bc('0x1e')](_0x2e6d96[_0x34bc('0x1f')]):![]);})[_0x34bc('0x12')](function(_0x2bb874){_0x5332c8(_0x2bb874);});};AGIVertices[_0x34bc('0x13')]['getMailAccount']=function(_0xff07bd,_0x1fb7c5){this[_0x34bc('0xe')][_0x34bc('0x20')](_0xff07bd)[_0x34bc('0x1c')](function(_0xd92957){_0x1fb7c5(null,_0xd92957?_0xd92957:![]);})['catch'](function(_0x155e44){_0x1fb7c5(_0x155e44);});};AGIVertices['prototype']['sendMailMessage']=function(_0x42fd40,_0x540aa3,_0x1e8445){this[_0x34bc('0x21')][_0x34bc('0x22')](_0x42fd40,_0x540aa3)[_0x34bc('0x1c')](function(){_0x1e8445(null);})[_0x34bc('0x12')](function(_0x246c39){_0x1e8445(_0x246c39);});};AGIVertices[_0x34bc('0x13')]['getIntervals']=function(_0xbd59f9,_0x3a5a74){this[_0x34bc('0xe')][_0x34bc('0x23')](_0xbd59f9)[_0x34bc('0x1c')](function(_0x5c7e56){if(_0x5c7e56){if(_0x5c7e56[_0x34bc('0x24')]){_0x3a5a74(null,[_0x5c7e56[_0x34bc('0x25')]]);}else{_0x3a5a74(null,_[_0x34bc('0x26')](_0x5c7e56[_0x34bc('0x27')],_0x34bc('0x25')));}}else{_0x3a5a74(null,![]);}})['catch'](function(_0x4ad3c7){_0x3a5a74(_0x4ad3c7);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x1e')]=function(_0xf9453c){return util[_0x34bc('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0xf9453c);};AGIVertices[_0x34bc('0x13')][_0x34bc('0x29')]=function(_0x32cf3b,_0x5b6acd,_0x37cd30){odbc[_0x34bc('0x2a')](_0x32cf3b,function(_0xd0e121){if(_0xd0e121){logger[_0x34bc('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0xd0e121);_0x37cd30(_0xd0e121);}else{logger[_0x34bc('0x2c')](_0x34bc('0x2d'));odbc[_0x34bc('0x2e')](_0x5b6acd,function(_0x4ddef6,_0x246a86){if(_0x4ddef6){logger[_0x34bc('0x2c')](_0x34bc('0x2f'),_0x5b6acd);_0x37cd30(_0x4ddef6);}else{logger[_0x34bc('0x2c')](_0x34bc('0x30'),_0x5b6acd);odbc['close'](function(_0xca2aaf){if(_0xca2aaf){logger[_0x34bc('0x2b')](_0x34bc('0x31'),_0xca2aaf);}_0x37cd30(null,_0x246a86);});}});}});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x32')]=function(_0x4bf331,_0x4105d8){this['rpc'][_0x34bc('0x33')](_0x4bf331)[_0x34bc('0x1c')](function(_0xfaa92d){_0x4105d8(null,_0xfaa92d?_0xfaa92d:![]);})[_0x34bc('0x12')](function(_0x53feca){_0x4105d8(_0x53feca);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x34')]=function(_0x5671fa,_0x16893d){this[_0x34bc('0xe')][_0x34bc('0x34')](_0x5671fa)['then'](function(_0x31afd3){_0x16893d(null,_0x31afd3);})[_0x34bc('0x12')](function(_0x397c64){_0x16893d(_0x397c64);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x35')]=function(_0x20debf,_0x428326,_0x2e4059){this[_0x34bc('0xe')][_0x34bc('0x35')]({'uniqueid':this[_0x34bc('0xd')]['uniqueid'],'node':_0x20debf['label'],'application':_0x20debf[_0x34bc('0x36')],'data':_0x428326||null,'project_name':this[_0x34bc('0xd')][_0x34bc('0x37')],'callerid':this[_0x34bc('0xd')][_0x34bc('0x38')]})[_0x34bc('0x1c')](function(_0x5af850){if(_0x2e4059){_0x2e4059(null,_0x5af850);}})[_0x34bc('0x12')](function(_0x4f912a){if(_0x2e4059){_0x2e4059(_0x4f912a);}});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x39')]=function(_0x30d5f1,_0x4ba4eb,_0xc57588,_0xf7c0be){this[_0x34bc('0xe')][_0x34bc('0x39')]({'uniqueid':this[_0x34bc('0xd')][_0x34bc('0x3a')],'callerid':this[_0x34bc('0xd')][_0x34bc('0x38')],'calleridname':this[_0x34bc('0xd')][_0x34bc('0x3b')],'context':this[_0x34bc('0xd')][_0x34bc('0x3c')],'extension':this['channel']['extension'],'priority':this[_0x34bc('0xd')][_0x34bc('0x3d')],'accountcode':this[_0x34bc('0xd')]['accountcode'],'dnid':this['channel'][_0x34bc('0x3e')],'projectName':this[_0x34bc('0xd')][_0x34bc('0x37')],'saveName':_0x4ba4eb,'filename':_0x30d5f1['file']||_0x4ba4eb,'savePath':_0xc57588})[_0x34bc('0x1c')](function(_0x25b02e){_0xf7c0be(null,_0x25b02e);})['catch'](function(_0x4627de){_0xf7c0be(_0x4627de);});};AGIVertices['prototype'][_0x34bc('0x3f')]=function(_0x487678,_0x281d6f,_0xbed144,_0x1f0cd9,_0x374271){this['rpc'][_0x34bc('0x3f')]({'uniqueid':this[_0x34bc('0xd')][_0x34bc('0x3a')],'body':_0x487678,'direction':_0x281d6f,'providerName':_0xbed144,'providerResponse':_0x1f0cd9})[_0x34bc('0x1c')](function(_0x13ce50){if(_0x374271){_0x374271(null,_0x13ce50);}})[_0x34bc('0x12')](function(_0x18eadd){if(_0x374271){_0x374271(_0x18eadd);}});};AGIVertices[_0x34bc('0x13')]['createCmContact']=function(_0x592557,_0x561ee8){this[_0x34bc('0xe')][_0x34bc('0x40')]({'firstName':_['isEmpty'](_0x592557[_0x34bc('0x11')])||_[_0x34bc('0x41')](_0x592557[_0x34bc('0x11')])?_0x34bc('0x42')+Math[_0x34bc('0x43')]():_0x592557['name'],'lastName':_['isEmpty'](_0x592557['lastName'])||_[_0x34bc('0x41')](_0x592557[_0x34bc('0x44')])?null:_0x592557[_0x34bc('0x44')],'phone':_0x592557[_0x34bc('0x45')],'ListId':_0x592557[_0x34bc('0x46')],'scheduledat':_0x592557['scheduledAt'],'callbackUniqueid':this[_0x34bc('0xd')][_0x34bc('0x3a')],'tags':_0x34bc('0x47'),'description':_0x34bc('0x48')+_0x592557['scheduledAt'][_0x34bc('0x49')](),'priority':_0x592557[_0x34bc('0x4a')]})[_0x34bc('0x1c')](function(_0x91e6c5){_0x561ee8(null,_0x91e6c5);})[_0x34bc('0x12')](function(_0x31c40b){_0x561ee8(_0x31c40b);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x4b')]=function(_0x3cb7df,_0x1f789a){this[_0x34bc('0xe')][_0x34bc('0x4c')](_0x3cb7df)[_0x34bc('0x1c')](function(_0x592e81){_0x1f789a(null,_0x592e81?_0x592e81[_0x34bc('0x11')]:![]);})[_0x34bc('0x12')](function(_0x35e9ad){_0x1f789a(_0x35e9ad);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x4d')]=function(_0x1b3704,_0x31cf3a,_0x43337d){var _0x38c45c={'role':_0x34bc('0x4e')};_0x38c45c[_0x1b3704]=this[_0x34bc('0xd')][_0x34bc('0x38')];this[_0x34bc('0xe')][_0x34bc('0x4d')](_0x38c45c,_0x31cf3a,this['channel'][_0x34bc('0x3a')])[_0x34bc('0x1c')](function(_0x36143f){_0x43337d(null,_[_0x34bc('0x41')](_0x36143f)?![]:!![]);})[_0x34bc('0x12')](function(_0x2b46b8){logger[_0x34bc('0x2b')](_0x2b46b8);_0x43337d(null,![]);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x4f')]=function(_0x32041a,_0x5ba13a){var _0x837259={'role':_0x34bc('0x4e')};_0x837259[_0x32041a]=this[_0x34bc('0xd')]['callerid'];this[_0x34bc('0xe')][_0x34bc('0x4f')](_0x837259)[_0x34bc('0x1c')](function(_0x3b087){_0x5ba13a(null,_['isNil'](_0x3b087)?![]:!![]);})[_0x34bc('0x12')](function(_0x284b55){logger[_0x34bc('0x2b')](_0x284b55);_0x5ba13a(null,![]);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x50')]=function(_0x378690,_0x3c4a72){var _0x3b8f72={'role':'agent'};_0x3b8f72[_0x378690]=this['channel'][_0x34bc('0x38')];this[_0x34bc('0xe')][_0x34bc('0x50')](_0x3b8f72)[_0x34bc('0x1c')](function(_0x1108c5){_0x3c4a72(null,_[_0x34bc('0x41')](_0x1108c5)?![]:!![]);})[_0x34bc('0x12')](function(_0x2e49b9){logger[_0x34bc('0x2b')](_0x2e49b9);_0x3c4a72(null,![]);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x51')]=function(_0x2d0d2c,_0x46c64e){var _0x98f897={'role':'agent'};_0x98f897[_0x2d0d2c]=this[_0x34bc('0xd')][_0x34bc('0x38')];var _0xa4e120=_0x2d0d2c!='internal'?util[_0x34bc('0x28')](_0x34bc('0x52'),_0x34bc('0x53'),this[_0x34bc('0xd')]['callerid']):undefined;this[_0x34bc('0xe')][_0x34bc('0x51')](_0x98f897,_0xa4e120)[_0x34bc('0x1c')](function(_0x190689){_0x46c64e(null,_[_0x34bc('0x41')](_0x190689)?![]:!![]);})['catch'](function(_0xc08131){logger[_0x34bc('0x2b')](_0xc08131);_0x46c64e(null,![]);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x54')]=function(_0x52b73a,_0x1b4f1e){sh[_0x34bc('0x55')](_[_0x34bc('0x56')](_0x52b73a),function(_0x2915ec,_0x2b9750){var _0x368b92=_0x2b9750['replace'](/(\r\n|\n|\r)/gm,'');_0x1b4f1e(null,_0x368b92);});};AGIVertices['prototype'][_0x34bc('0x57')]=function(_0x913c76,_0x561528){scripts[_0x34bc('0x57')](_0x913c76[_0x34bc('0x58')],_0x913c76[_0x34bc('0x59')]||_0x34bc('0x5a'),_0x913c76['text'],_0x913c76['languageCode']||_0x34bc('0x5b'),_0x913c76[_0x34bc('0x5c')]||_0x34bc('0x5d'),_0x913c76[_0x34bc('0x5e')]||_0x34bc('0x5f'))[_0x34bc('0x1c')](function(_0xa508f4){_0x561528(null,_0xa508f4);})[_0x34bc('0x12')](function(_0x1a6fdb){_0x561528(_0x1a6fdb);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x60')]=function(_0x348be3,_0x21e18b){scripts[_0x34bc('0x60')](_0x348be3[_0x34bc('0x5a')],_0x348be3[_0x34bc('0x61')]||'en',0x1)['then'](function(_0x1a587a){_0x21e18b(null,_0x1a587a);})[_0x34bc('0x12')](function(_0x1d9f60){_0x21e18b(_0x1d9f60);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x62')]=function(_0x48b13c,_0x415c29){var _0x2d68f6={'uri':_0x48b13c[_0x34bc('0x63')],'method':_0x48b13c[_0x34bc('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x48b13c[_0x34bc('0x65')])==='number'&&parseInt(_0x48b13c[_0x34bc('0x65')])>=0x1?parseInt(_0x48b13c[_0x34bc('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x34bc('0x66')]([_0x34bc('0x67'),_0x34bc('0x68')],_0x2d68f6[_0x34bc('0x64')]['toUpperCase']())){try{_0x2d68f6[_0x34bc('0x69')]=_0x48b13c[_0x34bc('0xb')]?JSON['parse'](_0x48b13c[_0x34bc('0xb')]):{};}catch(_0x1685ef){logger[_0x34bc('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1685ef);}}try{_0x2d68f6['headers']=_0x48b13c[_0x34bc('0x6a')]?JSON['parse'](_0x48b13c['rawHeaders']):{};}catch(_0x55055d){logger[_0x34bc('0x2b')](_0x34bc('0x6b'),_0x55055d);}if(_0x48b13c[_0x34bc('0x6c')]){try{var _0x5529b3=require(_0x48b13c[_0x34bc('0x6c')])[_0x34bc('0x6d')](this,_0x2d68f6);_0x2d68f6[_0x34bc('0x6e')]=Mustache[_0x34bc('0x6f')](_0x48b13c[_0x34bc('0x63')],_0x5529b3,{},['$$','$$']);if(_0x2d68f6[_0x34bc('0x70')]){_0x2d68f6[_0x34bc('0x70')]=JSON[_0x34bc('0x71')](Mustache[_0x34bc('0x6f')](JSON[_0x34bc('0x72')](_0x2d68f6[_0x34bc('0x70')]),_0x5529b3,{},['$$','$$']));}if(_0x2d68f6[_0x34bc('0x69')]){_0x2d68f6['body']=JSON['parse'](Mustache[_0x34bc('0x6f')](JSON[_0x34bc('0x72')](_0x2d68f6[_0x34bc('0x69')]),_0x5529b3,{},['$$','$$']));}}catch(_0x2423a3){logger[_0x34bc('0x2b')](_0x34bc('0x73'),_0x2423a3);}}rp(_0x2d68f6)[_0x34bc('0x1c')](function(_0x2acd0b){var _0x2a5455={'statusCode':_0x2acd0b[_0x34bc('0x74')]||0xc8,'statusMessage':_0x2acd0b['statusMessage']||'OK','headers':_0x2acd0b[_0x34bc('0x70')]||{},'body':_0x2acd0b[_0x34bc('0x69')]||{}};_0x415c29(null,_0x2a5455);})[_0x34bc('0x12')](function(_0x3726d8){var _0xe77c37={'statusCode':_0x3726d8[_0x34bc('0x74')]||0x1f4,'statusMessage':_0x3726d8[_0x34bc('0x75')]||_0x34bc('0x76'),'headers':_0x3726d8[_0x34bc('0x77')]['headers']||{},'body':_0x3726d8[_0x34bc('0x77')]['body']||{}};_0x415c29(null,_0xe77c37);});};AGIVertices['prototype'][_0x34bc('0x78')]=function(_0x5dac93,_0x4d25e2){scripts[_0x34bc('0x78')](this[_0x34bc('0xd')]['uniqueid'],_0x5dac93[_0x34bc('0x79')],_0x5dac93[_0x34bc('0x5a')],_0x5dac93[_0x34bc('0x7a')]||'en')[_0x34bc('0x1c')](function(_0x4eea4e){_0x4d25e2(null,_0x4eea4e);})[_0x34bc('0x12')](function(_0x35974b){_0x4d25e2(_0x35974b);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x49da95,_0x18c493){scripts[_0x34bc('0x7b')](this[_0x34bc('0xd')][_0x34bc('0x3a')],_0x49da95[_0x34bc('0x7c')],_0x49da95[_0x34bc('0x7d')],_0x49da95[_0x34bc('0x7e')],_0x49da95[_0x34bc('0x5a')],_0x49da95[_0x34bc('0x7f')]||'en')['then'](function(_0x31a30c){_0x18c493(null,_0x31a30c);})[_0x34bc('0x12')](function(_0x1716e3){_0x18c493(_0x1716e3);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x80')]=function(_0x443af6,_0x549da9){scripts[_0x34bc('0x80')](this[_0x34bc('0xd')],_0x443af6)[_0x34bc('0x1c')](function(_0x21cbfc){_0x549da9(null,_0x21cbfc);})[_0x34bc('0x12')](function(_0x56fe9c){_0x549da9(_0x56fe9c);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x81')]=function(_0x497a4a,_0x3d0ede){scripts[_0x34bc('0x81')](_0x497a4a[_0x34bc('0x79')],_0x497a4a['text'],_0x497a4a['ispeech_tts_language']||_0x34bc('0x5b'),_0x497a4a[_0x34bc('0x82')])[_0x34bc('0x1c')](function(_0x181c0f){_0x3d0ede(null,_0x181c0f);})['catch'](function(_0x43aa1e){_0x3d0ede(_0x43aa1e);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x83')]=function(_0x2491b8,_0x4cad49,_0x29d344){scripts[_0x34bc('0x83')](_0x4cad49,_0x2491b8[_0x34bc('0x79')],_0x2491b8[_0x34bc('0x84')]||_0x34bc('0x5b'),this[_0x34bc('0x85')](_0x2491b8['model'])?_0x2491b8[_0x34bc('0x86')]:undefined)[_0x34bc('0x1c')](function(_0x4094e4){_0x29d344(null,_0x4094e4);})[_0x34bc('0x12')](function(_0x4d318b){_0x29d344(_0x4d318b);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x87')]=function(_0x910451,_0x579ea0){scripts[_0x34bc('0x87')](_0x910451[_0x34bc('0x88')],_0x910451[_0x34bc('0x89')],_0x910451[_0x34bc('0x8a')],_0x910451['aws_polly_voice']||_0x34bc('0x8b'),_0x910451['text'],_0x910451['aws_text_type']||_0x34bc('0x5a'))['then'](function(_0xe31c4e){_0x579ea0(null,_0xe31c4e);})[_0x34bc('0x12')](function(_0x20139e){_0x579ea0(_0x20139e);});};AGIVertices[_0x34bc('0x13')]['awsLex']=function(_0x33b943,_0x5cf3a6){scripts[_0x34bc('0x8c')](this[_0x34bc('0xd')]['uniqueid'],_0x33b943[_0x34bc('0x88')],_0x33b943[_0x34bc('0x89')],_0x33b943[_0x34bc('0x8d')],_0x33b943['text'],_0x33b943['aws_bot_name'])['then'](function(_0x54965b){_0x5cf3a6(null,_0x54965b);})['catch'](function(_0x41057b){_0x5cf3a6(_0x41057b);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x8e')]=function(_0x352698,_0x597d42,_0x381322){scripts[_0x34bc('0x8e')](_0x597d42,_0x352698[_0x34bc('0x79')],_0x352698[_0x34bc('0x8f')]||_0x34bc('0x5b'))[_0x34bc('0x1c')](function(_0x1979e6){_0x381322(null,_0x1979e6);})[_0x34bc('0x12')](function(_0x3b4f56){_0x381322(_0x3b4f56);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x90')]=function(_0x3ccdd9,_0x46ae25,_0x220317){scripts[_0x34bc('0x90')](_0x46ae25,_0x3ccdd9[_0x34bc('0x91')],_0x3ccdd9[_0x34bc('0x92')],_0x3ccdd9[_0x34bc('0x6e')])['then'](function(_0x529ea0){_0x220317(null,_0x529ea0);})['catch'](function(_0x653f3){_0x220317(_0x653f3);});};AGIVertices[_0x34bc('0x13')][_0x34bc('0x93')]=function(_0x3d2e41){var _0x529d16=_[_0x34bc('0x66')](verticesWithRetry,_0x3d2e41[_0x34bc('0x36')])?_0x3d2e41:_[_0x34bc('0x94')](_0x3d2e41);for(var _0x2aaa14 in _0x529d16){if(_0x529d16['hasOwnProperty'](_0x2aaa14)){if(_0x529d16[_0x2aaa14]&&_[_0x34bc('0x95')](_0x529d16[_0x2aaa14])){if(_['includes'](recursiveMapAttributes,_0x2aaa14)){_0x529d16[_0x2aaa14]=this[_0x34bc('0x96')](_0x529d16[_0x2aaa14]);}else{_0x529d16[_0x2aaa14]=this[_0x34bc('0x97')](_0x529d16[_0x2aaa14]);}}}}return _0x529d16;};AGIVertices['prototype'][_0x34bc('0x98')]=function(_0x5ab98a){for(var _0x37b4d6 in _0x5ab98a){if(_0x5ab98a[_0x34bc('0x99')](_0x37b4d6)){if(_[_0x34bc('0x9a')](_0x5ab98a[_0x37b4d6])){this[_0x34bc('0x98')](_0x5ab98a[_0x37b4d6]);}else if(_['isArray'](_0x5ab98a[_0x37b4d6])){for(var _0x182850=0x0;_0x182850<_0x5ab98a[_0x37b4d6][_0x34bc('0x9b')];_0x182850++){this[_0x34bc('0x98')](_0x5ab98a[_0x37b4d6][_0x182850]);}}else if(_['isString'](_0x5ab98a[_0x37b4d6])){_0x5ab98a[_0x37b4d6]=this[_0x34bc('0x97')](_0x5ab98a[_0x37b4d6]);}}}};AGIVertices[_0x34bc('0x13')][_0x34bc('0x9c')]=function(_0x40405e,_0x283182){for(var _0x308223 in _0x40405e){if(_0x40405e[_0x34bc('0x99')](_0x308223)){if(_[_0x34bc('0x9a')](_0x40405e[_0x308223])){if(!_[_0x34bc('0x9d')](_0x40405e[_0x308223])){this[_0x34bc('0x9c')](_0x40405e[_0x308223],util['format'](_0x34bc('0x9e'),_0x283182,_0x308223));}}else if(_[_0x34bc('0x9f')](_0x40405e[_0x308223])){for(var _0x44b2cb=0x0;_0x44b2cb<_0x40405e[_0x308223][_0x34bc('0x9b')];_0x44b2cb++){this[_0x34bc('0x9c')](_0x40405e[_0x308223][_0x44b2cb],util[_0x34bc('0x28')](_0x34bc('0x9e'),_0x283182,_0x308223+'['+_0x44b2cb+']'));}}else{if(!_[_0x34bc('0x41')](_0x40405e[_0x308223])){this[_0x34bc('0xd')][_0x34bc('0xa0')](util['format'](_0x34bc('0x9e'),_0x283182,_0x308223),_0x40405e[_0x308223]);}}}}};AGIVertices[_0x34bc('0x13')][_0x34bc('0x96')]=function(_0x440aab){try{var _0x324269=JSON[_0x34bc('0x71')](_0x440aab);this[_0x34bc('0x98')](_0x324269);return JSON[_0x34bc('0x72')](_0x324269);}catch(_0x1d6966){return this[_0x34bc('0x97')](_0x440aab);}};AGIVertices[_0x34bc('0x13')][_0x34bc('0x97')]=function(_0x455206){var _0x2a8c1d=_0x455206['split']('{');for(var _0x19c29b=0x1;_0x19c29b<_0x2a8c1d[_0x34bc('0x9b')];_0x19c29b+=0x1){var _0x3d4373=_0x2a8c1d[_0x19c29b]['split']('}');if(_0x3d4373['length']>0x1){_0x455206=_0x455206['replaceAll']('{'+_0x3d4373[0x0]+'}',this[_0x34bc('0xd')]['getVariable'](_0x3d4373[0x0])[_0x34bc('0xa1')]||_0x3d4373[0x0]);}}if(_0x2a8c1d[_0x34bc('0x9b')]===0x1){return _0x455206['toString']();}return this['replaceAllVariables'](_0x455206);};AGIVertices[_0x34bc('0x13')][_0x34bc('0xa2')]=function(_0x4e3361,_0x33022b){var _0x4bba26=this[_0x34bc('0xd')][_0x34bc('0xf')](_0x4e3361);if(_0x4bba26[_0x34bc('0xa3')]===-0x1){return _0x4bba26;}logger[_0x34bc('0x2c')](util['format'](_0x34bc('0xa4'),_0x33022b,_0x4bba26[_0x34bc('0xa1')]));return this[_0x34bc('0xd')][_0x34bc('0xa0')](_0x33022b,_0x4bba26[_0x34bc('0xa1')]);};AGIVertices[_0x34bc('0x13')][_0x34bc('0x85')]=function(_0x52b208){return _0x52b208&&_0x52b208!=='0'&&_0x52b208!=='-1'&&_0x52b208!=='';};AGIVertices['prototype'][_0x34bc('0xa5')]=function(_0x1c6b4b){this[_0x34bc('0x35')]['sync'](this,_0x1c6b4b,'-');_0x1c6b4b[_0x34bc('0xa6')]=_0x1c6b4b[_0x34bc('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x34bc('0x13')][_0x34bc('0xa7')]=function(_0x57fd82){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0xa8'),_0x57fd82[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x57fd82[_0x34bc('0x5a')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xab'));}var _0x524a52='\x22'+_0x57fd82[_0x34bc('0x5a')]+'\x22';if(this[_0x34bc('0x85')](_0x57fd82[_0x34bc('0x77')])){_0x524a52+=','+_0x57fd82[_0x34bc('0x77')];}var _0x554e5f=this[_0x34bc('0xd')][_0x34bc('0x55')]('MRCPSynth',_0x524a52);if(_0x554e5f[_0x34bc('0xa3')]===-0x1){return _0x554e5f;}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0xac'),_0x524a52));};AGIVertices[_0x34bc('0x13')]['mrcprecog']=function(_0x283a47){logger['info'](util[_0x34bc('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x283a47[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x283a47['grammar'])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xad'));}var _0x5894b3=_0x283a47[_0x34bc('0xae')];if(this[_0x34bc('0x85')](_0x283a47[_0x34bc('0x77')])){_0x5894b3+=','+_0x283a47[_0x34bc('0x77')];}var _0x190601=this[_0x34bc('0xd')]['exec'](_0x34bc('0xaf'),_0x5894b3);if(_0x190601[_0x34bc('0xa3')]===-0x1){return _0x190601;}var _0x4c6c58=this[_0x34bc('0xa2')](_0x34bc('0xb0'),'MRCP_RECOG_CONFIDENCE');if(_0x4c6c58[_0x34bc('0xa3')]===-0x1){return _0x4c6c58;}var _0x2fc389=this[_0x34bc('0xa2')]('RECOG_INPUT()',_0x34bc('0xb1'));if(_0x2fc389['result']===-0x1){return _0x2fc389;}var _0x484d79=this['getAndSetVariable'](_0x34bc('0xb2'),'MRCP_RECOG_INSTANCE');if(_0x484d79[_0x34bc('0xa3')]===-0x1){return _0x484d79;}return this['channel']['noop'](util[_0x34bc('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5894b3));};AGIVertices['prototype'][_0x34bc('0x7')]=function(_0x47a273){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0xb3'),_0x47a273[_0x34bc('0xa9')]));return this['channel'][_0x34bc('0x7')]([_0x47a273[_0x34bc('0xb4')],_0x47a273[_0x34bc('0xb5')]]);};AGIVertices[_0x34bc('0x13')]['answer']=function(_0x3e48c6){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0xb6'),_0x3e48c6[_0x34bc('0xa9')]));if(this[_0x34bc('0x85')](_0x3e48c6[_0x34bc('0x65')])){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0xb7'),_0x3e48c6[_0x34bc('0x65')]));var _0x596197=this['channel']['wait'](_0x3e48c6[_0x34bc('0x65')]);if(_0x596197[_0x34bc('0xa3')]===-0x1){return _0x596197;}}return this['channel'][_0x34bc('0xb8')]();};AGIVertices[_0x34bc('0x13')]['callback']=function(_0x4808e8){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4808e8['label']));if(!this[_0x34bc('0x85')](_0x4808e8[_0x34bc('0x46')])){return this[_0x34bc('0xd')]['error'](_0x4808e8,'no\x20list\x20selected');}_0x4808e8['scheduledAt']=moment();if(this[_0x34bc('0x85')](_0x4808e8['delay'])){_0x4808e8[_0x34bc('0xb9')]=moment()['add'](_0x4808e8['delay'],_0x34bc('0xba'));}if(!this[_0x34bc('0x85')](_0x4808e8[_0x34bc('0x4a')])){_0x4808e8[_0x34bc('0x4a')]=0x2;}this[_0x34bc('0x40')][_0x34bc('0x6d')](this,_0x4808e8);return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0xbb'),_0x4808e8[_0x34bc('0x45')],_0x4808e8['list_id'],_0x4808e8[_0x34bc('0xb9')]));};AGIVertices[_0x34bc('0x13')][_0x34bc('0xbc')]=function(_0x33afa3){logger[_0x34bc('0x2c')](util['format'](_0x34bc('0xbd'),_0x33afa3['label']));var _0x61e569=this['channel']['exec'](_0x33afa3[_0x34bc('0xbe')],_0x33afa3[_0x34bc('0x77')]);if(_0x61e569[_0x34bc('0xa3')]===-0x1){return _0x61e569;}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util['format']('Executed\x20command\x20%s\x20%s',_0x33afa3[_0x34bc('0xbe')],_0x33afa3[_0x34bc('0x77')]));};AGIVertices[_0x34bc('0x13')][_0x34bc('0xbf')]=function(_0x2c6225){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2c6225['label']));if(!this[_0x34bc('0x85')](_0x2c6225[_0x34bc('0x5a')])){return this['channel'][_0x34bc('0xaa')](_0x34bc('0xab'));}var _0x2979ac='\x22'+_0x2c6225[_0x34bc('0x5a')]+'\x22';if(this['isConfigured'](_0x2c6225[_0x34bc('0x77')])){_0x2979ac+=','+_0x2c6225[_0x34bc('0x77')];}var _0x1fa6ba=this[_0x34bc('0xd')][_0x34bc('0x55')](_0x34bc('0xc0'),_0x2979ac);if(_0x1fa6ba['result']===-0x1){return _0x1fa6ba;}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2979ac));};AGIVertices[_0x34bc('0x13')][_0x34bc('0xc1')]=function(_0x478701){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0xc2'),_0x478701[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x478701['text'])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xab'));}var _0x5e0e3f='\x22'+_0x478701[_0x34bc('0x5a')]+'\x22';if(this['isConfigured'](_0x478701['options'])){_0x5e0e3f+=','+_0x478701['options'];}var _0x29a038=this['channel']['exec']('MRCPSynth',_0x5e0e3f);if(_0x29a038['result']===-0x1){return _0x29a038;}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0xac'),_0x5e0e3f));};AGIVertices[_0x34bc('0x13')][_0x34bc('0xc3')]=function(_0x4025e7){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x4025e7[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x4025e7[_0x34bc('0xae')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xad'));}var _0x1bb62d=_0x4025e7[_0x34bc('0xae')];if(this[_0x34bc('0x85')](_0x4025e7['options'])){_0x1bb62d+=','+_0x4025e7[_0x34bc('0x77')];}var _0x5ae468=this['channel'][_0x34bc('0x55')]('MRCPRecog',_0x1bb62d);if(_0x5ae468[_0x34bc('0xa3')]===-0x1){return _0x5ae468;}var _0x5b9a25=this['getAndSetVariable'](_0x34bc('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5b9a25[_0x34bc('0xa3')]===-0x1){return _0x5b9a25;}var _0xa77cea=this['getAndSetVariable'](_0x34bc('0xc4'),_0x34bc('0xc5'));if(_0xa77cea[_0x34bc('0xa3')]===-0x1){return _0xa77cea;}var _0x1e9083=this[_0x34bc('0xa2')](_0x34bc('0xb2'),_0x34bc('0xc6'));if(_0x1e9083[_0x34bc('0xa3')]===-0x1){return _0x1e9083;}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0xc7'),_0x1bb62d));};AGIVertices[_0x34bc('0x13')]['sestekasr']=function(_0x7f2aaf){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0xc8'),_0x7f2aaf[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x7f2aaf[_0x34bc('0xae')])){return this['channel'][_0x34bc('0xaa')](_0x34bc('0xad'));}var _0xa667dc=_0x7f2aaf[_0x34bc('0xae')];if(this[_0x34bc('0x85')](_0x7f2aaf[_0x34bc('0x77')])){_0xa667dc+=','+_0x7f2aaf['options'];}var _0x4bbf51=this[_0x34bc('0xd')][_0x34bc('0x55')]('MRCPRecog',_0xa667dc);if(_0x4bbf51[_0x34bc('0xa3')]===-0x1){return _0x4bbf51;}var _0x593802=this[_0x34bc('0xa2')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x593802['result']===-0x1){return _0x593802;}var _0x3bb206=this[_0x34bc('0xa2')](_0x34bc('0xc4'),_0x34bc('0xc9'));if(_0x3bb206[_0x34bc('0xa3')]===-0x1){return _0x3bb206;}var _0x1153d0=this['getAndSetVariable'](_0x34bc('0xb2'),_0x34bc('0xca'));if(_0x1153d0[_0x34bc('0xa3')]===-0x1){return _0x1153d0;}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0xa667dc));};AGIVertices[_0x34bc('0x13')][_0x34bc('0xcb')]=function(_0x18f6b4){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0xcc'),_0x18f6b4[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x18f6b4[_0x34bc('0xcd')])){return this[_0x34bc('0xd')]['error'](_0x18f6b4,'no\x20database\x20selected');}var _0x4339b9=this[_0x34bc('0x15')][_0x34bc('0x6d')](this,_0x18f6b4['odbc_id']);if(!_0x4339b9){return this[_0x34bc('0xd')]['error'](_0x18f6b4,_0x34bc('0xce'));}if(!this[_0x34bc('0x85')](_0x18f6b4[_0x34bc('0x2e')])){return this[_0x34bc('0xd')]['error'](_0x18f6b4,_0x34bc('0xcf'));}var _0x526111=_0x18f6b4[_0x34bc('0x2e')][_0x34bc('0xd0')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x34bc('0xaa')](util[_0x34bc('0x28')]('query:\x20%s',_0x526111));var _0x4dab7c=this[_0x34bc('0x29')][_0x34bc('0x6d')](this,_0x4339b9,_0x526111);this['createSquareDetailsReport']['sync'](this,_0x18f6b4,_0x526111);if(!this[_0x34bc('0x85')](_0x18f6b4[_0x34bc('0xd1')])){return this[_0x34bc('0xd')]['noop'](_0x34bc('0xd2'));}var _0x40b723=this['getVariable'][_0x34bc('0x6d')](this,_0x18f6b4['variable_id']);if(!_0x40b723){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x18f6b4,_0x34bc('0xd3'));}var _0x3bf43a=this;_0x4dab7c[_0x34bc('0xd4')](function(_0x13e1c9,_0x55d529){Object['keys'](_0x13e1c9)[_0x34bc('0xd4')](function(_0x4bcac0){_0x3bf43a[_0x34bc('0xd')][_0x34bc('0xa0')](util['format'](_0x34bc('0xd5'),_0x40b723,_0x55d529,_0x4bcac0),_0x13e1c9[_0x4bcac0]);});});this[_0x34bc('0xd')][_0x34bc('0xa0')](util[_0x34bc('0x28')](_0x34bc('0xd6'),_0x40b723),_0x4dab7c['length']);return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0xd7'),_0x40b723));};AGIVertices[_0x34bc('0x13')][_0x34bc('0xd8')]=function(_0x2bffca){logger['debug'](util[_0x34bc('0x28')](_0x34bc('0xd9'),_0x2bffca[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x2bffca[_0x34bc('0xda')])){return this[_0x34bc('0xd')]['error'](_0x2bffca,_0x34bc('0xdb'));}var _0x2ad23b=this[_0x34bc('0x18')][_0x34bc('0x6d')](this,_0x2bffca[_0x34bc('0xda')]);if(!_0x2ad23b){return this[_0x34bc('0xd')]['error'](_0x2bffca,_0x34bc('0xdc'));}var _0x19a166=this[_0x34bc('0xd')][_0x34bc('0x55')](_0x34bc('0xdd'),[util[_0x34bc('0x28')](_0x34bc('0xde'),_0x2ad23b),_0x2bffca['timeout'],_0x2bffca['opts'],_0x2bffca[_0x34bc('0x63')]]);if(_0x19a166[_0x34bc('0xa3')]===-0x1){return _0x19a166;}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0xdf'),'DIAL'));};AGIVertices[_0x34bc('0x13')][_0x34bc('0xe0')]=function(_0x5d6d9e){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5d6d9e['label']));if(!this[_0x34bc('0x85')](_0x5d6d9e[_0x34bc('0x79')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xe1'));}if(!this[_0x34bc('0x85')](_0x5d6d9e[_0x34bc('0x5a')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xab'));}this[_0x34bc('0xd')]['bot']=!![];this[_0x34bc('0x35')](_0x5d6d9e);this[_0x34bc('0x3f')](_0x5d6d9e[_0x34bc('0x5a')],'in','','');this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('Trying\x20Dialogflow:\x20%s',_0x5d6d9e[_0x34bc('0x5a')]));var _0x51ead1=this[_0x34bc('0x78')]['sync'](this,_0x5d6d9e);if(_0x51ead1){for(var _0x4a059c in _0x51ead1){if(_0x51ead1[_0x34bc('0x99')](_0x4a059c)){this[_0x34bc('0xd')][_0x34bc('0xa0')](util['format'](_0x34bc('0xe2'),_0x4a059c['toUpperCase']()),_0x51ead1[_0x4a059c]);}}this[_0x34bc('0x3f')](_0x51ead1['speech'],_0x34bc('0xe3'),_0x34bc('0xe0'),'');return this[_0x34bc('0xd')]['noop'](util['format'](_0x34bc('0xe4'),_0x51ead1['speech']));}return this['channel'][_0x34bc('0x2b')](_0x5d6d9e,_0x34bc('0xe5'));};AGIVertices[_0x34bc('0x13')][_0x34bc('0xe6')]=function(_0x10deff){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x10deff['label']));if(!this[_0x34bc('0x85')](_0x10deff[_0x34bc('0x7c')])){return this['channel'][_0x34bc('0xaa')]('no\x20project_id\x20configured');}if(!this[_0x34bc('0x85')](_0x10deff[_0x34bc('0x7d')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xe7'));}if(!this[_0x34bc('0x85')](_0x10deff['private_key'])){return this['channel'][_0x34bc('0xaa')](_0x34bc('0xe8'));}if(!this[_0x34bc('0x85')](_0x10deff['dialogflowV2_language'])){return this['channel'][_0x34bc('0xaa')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x10deff[_0x34bc('0x5a')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xab'));}this[_0x34bc('0xd')][_0x34bc('0xe9')]=!![];this[_0x34bc('0x35')](_0x10deff);this['createSquareMessage'](_0x10deff[_0x34bc('0x5a')],'in','','');this['channel'][_0x34bc('0xaa')](util[_0x34bc('0x28')]('Trying\x20DialogflowV2:\x20%s',_0x10deff[_0x34bc('0x5a')]));var _0x5f4598=this[_0x34bc('0x7b')]['sync'](this,_0x10deff);if(_0x5f4598){for(var _0x57a3bd in _0x5f4598){if(_0x5f4598[_0x34bc('0x99')](_0x57a3bd)){if(_0x57a3bd!==_0x34bc('0xea')){this['channel']['setVariable'](util[_0x34bc('0x28')]('DIALOGFLOW_%s',_0x57a3bd['toUpperCase']()),_0x5f4598[_0x57a3bd]);}}}this[_0x34bc('0x3f')](_0x5f4598[_0x34bc('0xeb')],_0x34bc('0xe3'),'dialogflowV2',_0x5f4598[_0x34bc('0xea')]);return this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')](_0x34bc('0xec'),_0x5f4598['speech']));}return this[_0x34bc('0xd')]['error'](_0x10deff,_0x34bc('0xed'));};AGIVertices[_0x34bc('0x13')]['sesteknda']=function(_0x51a21b){logger[_0x34bc('0x2c')](util['format'](_0x34bc('0xee'),_0x51a21b[_0x34bc('0xa9')]));if(!this['isConfigured'](_0x51a21b[_0x34bc('0xef')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x34bc('0x85')](_0x51a21b[_0x34bc('0xf0')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xf1'));}if(!this[_0x34bc('0x85')](_0x51a21b[_0x34bc('0xf2')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')]('no\x20password\x20configured');}if(!this[_0x34bc('0x85')](_0x51a21b[_0x34bc('0xf3')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xab'));}this[_0x34bc('0xd')][_0x34bc('0xe9')]=!![];this[_0x34bc('0x35')](_0x51a21b);this[_0x34bc('0x3f')](_0x51a21b[_0x34bc('0x5a')],'in','','');this['channel']['noop'](util['format'](_0x34bc('0xf4'),_0x51a21b[_0x34bc('0x5a')]));var _0x271a27=this[_0x34bc('0x80')][_0x34bc('0x6d')](this,_0x51a21b);if(_0x271a27){for(var _0x2dad53 in _0x271a27){if(_0x271a27[_0x34bc('0x99')](_0x2dad53)){this[_0x34bc('0xd')][_0x34bc('0xa0')](util['format'](_0x34bc('0xf5'),_0x2dad53[_0x34bc('0xf6')]()),_0x271a27[_0x2dad53]);}}this[_0x34bc('0x3f')](_0x271a27[_0x34bc('0xeb')],'out','sesteknda','');if(_0x271a27[_0x34bc('0xf7')]){this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0xf8'),_0x271a27[_0x34bc('0xf7')]));var _0x586528=this[_0x34bc('0xd')]['streamFile'](_0x271a27[_0x34bc('0xf7')]);try{fs[_0x34bc('0xf9')](_0x271a27[_0x34bc('0xf7')]+'.wav');}catch(_0x15905c){logger[_0x34bc('0x2b')](_0x15905c);}return _0x586528;}else{return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('SestekNDA\x20Result\x20%s',_0x271a27[_0x34bc('0xeb')]));}}return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x51a21b,_0x34bc('0xfa'));};AGIVertices[_0x34bc('0x13')][_0x34bc('0xfb')]=function(_0x3bec77){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0xfc'),_0x3bec77['label']));return this[_0x34bc('0xd')][_0x34bc('0xaa')]('end');};AGIVertices[_0x34bc('0x13')][_0x34bc('0xfd')]=function(_0xa4df24){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0xfe'),_0xa4df24[_0x34bc('0xa9')]));var _0x5ba34b='';if(_0xa4df24[_0x34bc('0xff')]){if(!this[_0x34bc('0x85')](_0xa4df24[_0x34bc('0xff')])){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0xa4df24,_0x34bc('0x100'));}else{var _0xe4bce6=parseInt(_0xa4df24[_0x34bc('0xff')],0xa);if(isNaN(_0xe4bce6)){_0x5ba34b=_0xa4df24['trunk_id'];}else{_0x5ba34b=this[_0x34bc('0x1a')][_0x34bc('0x6d')](this,_0xa4df24[_0x34bc('0xff')]);if(!_0x5ba34b){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0xa4df24,'no\x20trunk\x20found');}}}}else if(_0xa4df24[_0x34bc('0x101')]){_0x5ba34b=_0xa4df24[_0x34bc('0x101')];}else{return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0xa4df24,'no\x20trunk\x20selected');}var _0x103985=this[_0x34bc('0xd')][_0x34bc('0x55')](_0x34bc('0xdd'),[util[_0x34bc('0x28')](_0x34bc('0x102'),_0x5ba34b,_0xa4df24['phone']),_0xa4df24['timeout'],_0xa4df24[_0x34bc('0x103')],_0xa4df24[_0x34bc('0x63')]]);if(_0x103985[_0x34bc('0xa3')]===-0x1){return _0x103985;}return this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')](_0x34bc('0xdf'),_0x34bc('0xdd')));};AGIVertices[_0x34bc('0x13')]['finally']=function(_0x488c55){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x104'),_0x488c55[_0x34bc('0xa9')]));return this['channel'][_0x34bc('0xaa')]('finally');};AGIVertices[_0x34bc('0x13')][_0x34bc('0x105')]=function(_0x28d185){logger['info'](util[_0x34bc('0x28')](_0x34bc('0x106'),_0x28d185[_0x34bc('0xa9')]));if(_0x28d185[_0x34bc('0xa6')]===0x0){return this[_0x34bc('0xa5')](_0x28d185);}_0x28d185[_0x34bc('0xa6')]-=0x1;if(!this[_0x34bc('0x85')](_0x28d185['file_id'])){return this['channel'][_0x34bc('0x2b')](_0x28d185,_0x34bc('0x107'));}var _0x37b5b8=this[_0x34bc('0x108')]['sync'](this,_0x28d185[_0x34bc('0x109')]);if(!_0x37b5b8){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x28d185,_0x34bc('0x10a'));}if(!this[_0x34bc('0x85')](_0x28d185[_0x34bc('0xd1')])){return this['channel'][_0x34bc('0x2b')](_0x34bc('0xd2'));}var _0x3ab42a=this[_0x34bc('0xd')][_0x34bc('0x10b')](_0x37b5b8,_0x28d185[_0x34bc('0x10c')],_0x28d185[_0x34bc('0x10d')]);var _0x270827=_0x3ab42a[_0x34bc('0xa3')]?_0x3ab42a[_0x34bc('0xa3')][_0x34bc('0x49')]():'';logger[_0x34bc('0x2c')](_0x34bc('0x10e'),JSON[_0x34bc('0x72')](_0x3ab42a));if(_0x3ab42a[_0x34bc('0xa3')]===-0x1){this[_0x34bc('0x35')][_0x34bc('0x6d')](this,_0x28d185,_0x270827);return _0x3ab42a;}else if(_0x3ab42a['extra']===_0x34bc('0x65')){_0x3ab42a[_0x34bc('0xa3')]=_0x270827['length']>=parseInt(_0x28d185[_0x34bc('0x10f')])?'x':'i';}else{_0x3ab42a[_0x34bc('0xa3')]=_0x270827[_0x34bc('0x9b')]>=parseInt(_0x28d185[_0x34bc('0x10f')])&&_0x270827[_0x34bc('0x9b')]<=parseInt(_0x28d185['maxdigit'])?'x':'i';}var _0x1d3ca7=this[_0x34bc('0xf')][_0x34bc('0x6d')](this,_0x28d185[_0x34bc('0xd1')]);if(!_0x1d3ca7){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x28d185,_0x34bc('0xd3'));}this['channel'][_0x34bc('0xa0')](_0x1d3ca7,_0x270827);if(this[_0x34bc('0x85')](_0x28d185[_0x34bc('0x110')])){var _0x2ddd8b=parseInt(_0x28d185[_0x34bc('0x110')],0xa);var _0x5b00d4=rs[_0x34bc('0x111')]({'charset':'*','length':_0x2ddd8b});var _0x33bc51=_0x270827[_0x34bc('0x9b')];if(_0x33bc51>0x0){if(_0x33bc51>_0x2ddd8b){this['createSquareDetailsReport'][_0x34bc('0x6d')](this,_0x28d185,_0x28d185['hiddendigitspos']===_0x34bc('0x112')?_0x5b00d4+_0x270827['substr'](_0x2ddd8b):_0x270827[_0x34bc('0x113')](0x0,_0x33bc51-_0x2ddd8b)+_0x5b00d4);}else{this[_0x34bc('0x35')][_0x34bc('0x6d')](this,_0x28d185,rs[_0x34bc('0x111')]({'charset':'*','length':_0x33bc51}));}}else{this[_0x34bc('0x35')][_0x34bc('0x6d')](this,_0x28d185,'');}}else{this[_0x34bc('0x35')][_0x34bc('0x6d')](this,_0x28d185,_0x270827);}return _0x3ab42a;};AGIVertices[_0x34bc('0x13')]['getsecretdigits']=function(_0x29a700){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x114'),_0x29a700[_0x34bc('0xa9')]));return this[_0x34bc('0x105')](_0x29a700);};AGIVertices[_0x34bc('0x13')][_0x34bc('0x115')]=function(_0x3f56ab){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x116'),_0x3f56ab[_0x34bc('0xa9')]));this[_0x34bc('0x35')][_0x34bc('0x6d')](this,_0x3f56ab,_0x3f56ab[_0x34bc('0x117')]);return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x118'),_0x3f56ab[_0x34bc('0x117')]));};AGIVertices[_0x34bc('0x13')]['awspolly']=function(_0x3c5d51){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x119'),_0x3c5d51['label']));if(!this[_0x34bc('0x85')](_0x3c5d51[_0x34bc('0x88')])||!this[_0x34bc('0x85')](_0x3c5d51[_0x34bc('0x89')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0x11a'));}if(!this[_0x34bc('0x85')](_0x3c5d51['text'])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x11b'),_0x3c5d51[_0x34bc('0x5a')]));var _0xec4fd3=this[_0x34bc('0x87')][_0x34bc('0x6d')](this,_0x3c5d51);if(_0xec4fd3){this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0xec4fd3));var _0x102058=this['channel'][_0x34bc('0x11c')](_0xec4fd3);try{fs[_0x34bc('0xf9')](_0xec4fd3+'.wav');}catch(_0x16ecdb){logger[_0x34bc('0x2b')](_0x16ecdb);}return _0x102058;}return this[_0x34bc('0xd')]['error'](_0x3c5d51,_0x34bc('0x11d'));};AGIVertices[_0x34bc('0x13')][_0x34bc('0x11e')]=function(_0x1f3fc5){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x11f'),_0x1f3fc5[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x1f3fc5[_0x34bc('0x88')])||!this[_0x34bc('0x85')](_0x1f3fc5[_0x34bc('0x89')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0x11a'));}if(!this[_0x34bc('0x85')](_0x1f3fc5[_0x34bc('0x120')])){return this[_0x34bc('0xd')]['noop'](_0x34bc('0x121'));}if(!this[_0x34bc('0x85')](_0x1f3fc5['text'])){return this['channel'][_0x34bc('0xaa')](_0x34bc('0xab'));}this[_0x34bc('0xd')][_0x34bc('0xe9')]=!![];this[_0x34bc('0x35')](_0x1f3fc5);this['createSquareMessage'](_0x1f3fc5['text'],'in','','');this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x122'),_0x1f3fc5['text']));var _0x3a243e=this[_0x34bc('0x8c')][_0x34bc('0x6d')](this,_0x1f3fc5);if(_0x3a243e){for(var _0x2f0572 in _0x3a243e){if(_0x3a243e[_0x34bc('0x99')](_0x2f0572)&&_[_0x34bc('0x95')](_0x3a243e[_0x2f0572])){this[_0x34bc('0xd')][_0x34bc('0xa0')](util[_0x34bc('0x28')](_0x34bc('0x123'),_0x2f0572[_0x34bc('0xf6')]()),_0x3a243e[_0x2f0572]);}}if(_[_0x34bc('0x41')](_0x3a243e['message'])){return this['channel'][_0x34bc('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x3a243e[_0x34bc('0x75')],_0x34bc('0xe3'),_0x34bc('0x124'),'');return this[_0x34bc('0xd')][_0x34bc('0xaa')](util['format'](_0x34bc('0x125'),_0x3a243e[_0x34bc('0x75')]));}}return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x1f3fc5,_0x34bc('0x126'));};AGIVertices[_0x34bc('0x13')][_0x34bc('0x127')]=function(_0x82596a){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x128'),_0x82596a[_0x34bc('0xa9')],_0x82596a[_0x34bc('0x65')]));if(!this['isConfigured'](_0x82596a[_0x34bc('0x79')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xe1'));}var _0x53cb6f='wav';var _0x48fcec=util[_0x34bc('0x28')](_0x34bc('0x129'),FILES_PATH,rs[_0x34bc('0x111')](0x4));var _0xee5898=util[_0x34bc('0x28')]('%s.%s',_0x48fcec,_0x53cb6f);var _0x2e59e4=!![];if(_0x82596a[_0x34bc('0x12a')]===_0x34bc('0x12b')){_0x2e59e4=![];}var _0x56e1b5=this['channel'][_0x34bc('0x12c')](_0x48fcec,_0x53cb6f,_0x82596a['intKey'],_0x82596a[_0x34bc('0x65')],undefined,_0x2e59e4);if(_0x56e1b5['result']!==-0x1){this[_0x34bc('0xd')]['noop'](util['format'](_0x34bc('0x12d'),_0xee5898));var _0x209c32=this[_0x34bc('0x8e')][_0x34bc('0x6d')](this,_0x82596a,_0xee5898);if(_0x209c32){for(var _0x55d1ee in _0x209c32){if(_0x209c32[_0x34bc('0x99')](_0x55d1ee)){this['channel']['setVariable'](util['format'](_0x34bc('0x12e'),_0x55d1ee[_0x34bc('0xf6')]()),_0x209c32[_0x55d1ee]);}}return this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0x34bc('0x72')](_0x209c32)));}}return _0x56e1b5;};AGIVertices[_0x34bc('0x13')]['tildeasr']=function(_0x5eb024){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x12f'),_0x5eb024[_0x34bc('0xa9')]));if(!this['isConfigured'](_0x5eb024[_0x34bc('0x91')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0x130'));}if(!this[_0x34bc('0x85')](_0x5eb024[_0x34bc('0x92')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0x131'));}var _0x4343be='wav';var _0x180757=util[_0x34bc('0x28')](_0x34bc('0x129'),FILES_PATH,rs[_0x34bc('0x111')](0x4));var _0x5d4b13=util[_0x34bc('0x28')](_0x34bc('0x9e'),_0x180757,_0x4343be);var _0x2c8d68=!![];if(_0x5eb024[_0x34bc('0x12a')]===_0x34bc('0x12b')){_0x2c8d68=![];}var _0x1b303c=this['channel'][_0x34bc('0x12c')](_0x180757,_0x4343be,_0x5eb024['intKey'],_0x5eb024[_0x34bc('0x65')],undefined,_0x2c8d68);if(_0x1b303c[_0x34bc('0xa3')]!==-0x1){this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')](_0x34bc('0x132'),_0x5d4b13));var _0xedf340=this[_0x34bc('0x90')][_0x34bc('0x6d')](this,_0x5eb024,_0x5d4b13);if(_0xedf340){for(var _0x2bbbb3 in _0xedf340){if(_0xedf340['hasOwnProperty'](_0x2bbbb3)){this[_0x34bc('0xd')][_0x34bc('0xa0')](util[_0x34bc('0x28')](_0x34bc('0x133'),_0x2bbbb3[_0x34bc('0xf6')]()),_0xedf340[_0x2bbbb3]);}}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x134'),JSON[_0x34bc('0x72')](_0xedf340)));}}return _0x1b303c;};AGIVertices[_0x34bc('0x13')][_0x34bc('0x135')]=function(_0x2f61f0){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x136'),_0x2f61f0['label']));return this['channel'][_0x34bc('0x137')](_0x2f61f0['context'],_0x2f61f0[_0x34bc('0x138')],_0x2f61f0['priority']);};AGIVertices[_0x34bc('0x13')][_0x34bc('0x139')]=function(_0x5c710a){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x13a'),_0x5c710a[_0x34bc('0xa9')]));if(!this['isConfigured'](_0x5c710a['condition'])){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x5c710a,'no\x20condition\x20configured');}try{var _0x2fdacd=eval(_0x5c710a['condition'])?_0x34bc('0x13b'):_0x34bc('0x13c');this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')](_0x34bc('0x13d'),_0x5c710a[_0x34bc('0x13e')],_0x2fdacd));return{'code':0xc8,'result':_0x2fdacd};}catch(_0x30be37){return{'code':0xc8,'result':_0x34bc('0x13c')};}};AGIVertices[_0x34bc('0x13')][_0x34bc('0x13f')]=function(_0x5c2ab8){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x140'),_0x5c2ab8['label']));if(!this[_0x34bc('0x85')](_0x5c2ab8[_0x34bc('0x141')])){return this['channel'][_0x34bc('0x2b')](_0x5c2ab8,_0x34bc('0x142'));}var _0x48c153=this[_0x34bc('0x143')][_0x34bc('0x6d')](this,_0x5c2ab8[_0x34bc('0x141')]);if(!_0x48c153){return this[_0x34bc('0xd')]['error'](_0x5c2ab8,'no\x20intervals\x20found');}for(var _0x3d3555=0x0;_0x3d3555<_0x48c153[_0x34bc('0x9b')];_0x3d3555+=0x1){var _0x5cb344=this[_0x34bc('0xd')][_0x34bc('0xf')](util[_0x34bc('0x28')](_0x34bc('0x144'),_0x48c153[_0x3d3555]));if(_0x5cb344[_0x34bc('0xa3')]===-0x1){return _0x5cb344;}logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('IFTIME\x20%s\x20%s',_0x48c153[_0x3d3555],_0x5cb344[_0x34bc('0xa1')]));if(_0x5cb344['extra']===_0x34bc('0x13b')){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x145'),_0x48c153[_0x3d3555],'true'));this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')](_0x34bc('0x145'),_0x48c153[_0x3d3555],_0x34bc('0x13b')));return{'code':0xc8,'result':_0x34bc('0x13b')};}else{logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('IFTIME\x20%s\x20%s',_0x48c153[_0x3d3555],_0x34bc('0x13c')));this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')](_0x34bc('0x145'),_0x48c153[_0x3d3555],'false'));}}return{'code':0xc8,'result':_0x34bc('0x13c')};};AGIVertices[_0x34bc('0x13')][_0x34bc('0x146')]=function(_0x28e8a8){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x147'),_0x28e8a8['label']));return this['channel'][_0x34bc('0x146')]();};AGIVertices[_0x34bc('0x13')][_0x34bc('0x148')]=function(_0x5d33f){logger[_0x34bc('0x2c')](util['format'](_0x34bc('0x149'),_0x5d33f[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x5d33f[_0x34bc('0x79')])){return this['channel'][_0x34bc('0xaa')](_0x34bc('0xe1'));}var _0x431b03='wav';var _0x35aba3=util[_0x34bc('0x28')](_0x34bc('0x129'),FILES_PATH,rs[_0x34bc('0x111')](0x4));var _0x1fbca2=util[_0x34bc('0x28')](_0x34bc('0x9e'),_0x35aba3,_0x431b03);var _0x26b5ad=!![];if(_0x5d33f[_0x34bc('0x12a')]===_0x34bc('0x12b')){_0x26b5ad=![];}var _0xc897ad=this[_0x34bc('0xd')][_0x34bc('0x12c')](_0x35aba3,_0x431b03,_0x5d33f[_0x34bc('0x14a')],_0x5d33f[_0x34bc('0x65')],undefined,_0x26b5ad);if(_0xc897ad['result']!==-0x1){this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x14b'),_0x1fbca2));var _0x586a0f=this['ispeechASR'][_0x34bc('0x6d')](this,_0x5d33f,_0x1fbca2);if(_0x586a0f){for(var _0x1e2428 in _0x586a0f){if(_0x586a0f[_0x34bc('0x99')](_0x1e2428)){this[_0x34bc('0xd')][_0x34bc('0xa0')](util['format'](_0x34bc('0x14c'),_0x1e2428[_0x34bc('0xf6')]()),_0x586a0f[_0x1e2428]);}}return this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')](_0x34bc('0x14d'),JSON[_0x34bc('0x72')](_0x586a0f)));}}return _0xc897ad;};AGIVertices[_0x34bc('0x13')][_0x34bc('0x14e')]=function(_0x146131){logger['info'](util[_0x34bc('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x146131['label']));if(!this['isConfigured'](_0x146131[_0x34bc('0x79')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xe1'));}if(!this['isConfigured'](_0x146131[_0x34bc('0x5a')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')]('no\x20text\x20configured');}this['channel'][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x14f'),_0x146131[_0x34bc('0x5a')]));var _0x3a1d35=this[_0x34bc('0x81')][_0x34bc('0x6d')](this,_0x146131);if(_0x3a1d35){this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x14b'),_0x3a1d35));var _0x5f095f=this['channel'][_0x34bc('0x11c')](_0x3a1d35,_0x146131[_0x34bc('0x14a')]);try{fs[_0x34bc('0xf9')](_0x3a1d35+_0x34bc('0x150'));}catch(_0x545109){logger[_0x34bc('0x2b')](_0x545109);}return _0x5f095f;}return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x146131,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x34bc('0x13')]['login']=function(_0x752ab0){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x151'),_0x752ab0['label']));if(!this[_0x34bc('0x85')](_0x752ab0[_0x34bc('0x152')])){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x752ab0,'no\x20find\x20by\x20configured');}logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x34bc('0xd')][_0x34bc('0x38')],_0x752ab0[_0x34bc('0x152')]));var _0x190881=this[_0x34bc('0x51')][_0x34bc('0x6d')](this,_0x752ab0['findBy']);if(_0x190881){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x153'),this['channel'][_0x34bc('0x38')],_0x752ab0[_0x34bc('0x152')]));this[_0x34bc('0xd')][_0x34bc('0xaa')](util['format'](_0x34bc('0x153'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x752ab0[_0x34bc('0x152')]));return{'code':0xc8,'result':_0x34bc('0x154')};}else{logger['info'](util[_0x34bc('0x28')](_0x34bc('0x155'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x752ab0['findBy']));this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x34bc('0x38')],_0x752ab0[_0x34bc('0x152')]));return{'code':0xc8,'result':_0x34bc('0x156')};}};AGIVertices[_0x34bc('0x13')][_0x34bc('0x157')]=function(_0x38f6bd){logger['info'](util[_0x34bc('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x38f6bd[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x38f6bd[_0x34bc('0x152')])){return this[_0x34bc('0xd')]['error'](_0x38f6bd,'no\x20find\x20by\x20configured');}logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x158'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x38f6bd[_0x34bc('0x152')]));var _0x23618c=this[_0x34bc('0x50')][_0x34bc('0x6d')](this,_0x38f6bd[_0x34bc('0x152')]);if(_0x23618c){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x153'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x38f6bd[_0x34bc('0x152')]));this['channel'][_0x34bc('0xaa')](util['format'](_0x34bc('0x153'),this['channel']['callerid'],_0x38f6bd[_0x34bc('0x152')]));return{'code':0xc8,'result':_0x34bc('0x154')};}else{logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x34bc('0x38')],_0x38f6bd[_0x34bc('0x152')]));this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x155'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x38f6bd['findBy']));return{'code':0xc8,'result':_0x34bc('0x156')};}};AGIVertices[_0x34bc('0x13')]['math']=function(_0x1a07fd){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x159'),_0x1a07fd[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x1a07fd['operation'])){return this[_0x34bc('0xd')]['error'](_0x1a07fd,'no\x20operation\x20configured');}this[_0x34bc('0xd')][_0x34bc('0xaa')](util['format'](_0x34bc('0x15a'),_0x1a07fd[_0x34bc('0x15b')]));var _0x19f9cb=eval(_0x1a07fd[_0x34bc('0x15b')]);if(!this['isConfigured'](_0x1a07fd['variable_id'])){return this[_0x34bc('0xd')][_0x34bc('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1b41f2=this[_0x34bc('0xf')][_0x34bc('0x6d')](this,_0x1a07fd[_0x34bc('0xd1')]);if(!_0x1b41f2){return this[_0x34bc('0xd')]['error'](_0x1a07fd,_0x34bc('0xd3'));}if(_[_0x34bc('0x9f')](_0x19f9cb)){var _0x2b7124=this;_0x19f9cb[_0x34bc('0xd4')](function(_0x458c70,_0x305702){_0x2b7124[_0x34bc('0xd')][_0x34bc('0xa0')](util[_0x34bc('0x28')](_0x34bc('0x15c'),_0x1b41f2,_0x305702),_0x458c70);});return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x15d'),_0x1b41f2));}else{return this[_0x34bc('0xd')][_0x34bc('0xa0')](_0x1b41f2,_0x19f9cb);}};AGIVertices[_0x34bc('0x13')][_0x34bc('0x15e')]=function(_0x55f57f){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x55f57f['label']));if(_0x55f57f['retry']===0x0){return this[_0x34bc('0xa5')](_0x55f57f);}_0x55f57f[_0x34bc('0xa6')]-=0x1;if(!this['isConfigured'](_0x55f57f[_0x34bc('0x109')])){return this['channel']['error'](_0x55f57f,_0x34bc('0x107'));}var _0x39d594=this[_0x34bc('0x108')][_0x34bc('0x6d')](this,_0x55f57f[_0x34bc('0x109')]);if(!_0x39d594){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x55f57f,_0x34bc('0x10a'));}var _0x1c2e7c=this[_0x34bc('0xd')][_0x34bc('0x10b')](_0x39d594,_0x55f57f[_0x34bc('0x10c')],_0x55f57f[_0x34bc('0x15f')]);var _0x1b1862=_0x1c2e7c['result'];if(_0x1c2e7c[_0x34bc('0xa3')]===-0x1){this[_0x34bc('0x35')][_0x34bc('0x6d')](this,_0x55f57f,'-1');return _0x1c2e7c;}else if(_0x1c2e7c['extra']==='timeout'){_0x1c2e7c[_0x34bc('0xa3')]=_0x1c2e7c[_0x34bc('0xa3')][_0x34bc('0x9b')]>0x0?_0x1c2e7c['result']:'t';}else if(_[_0x34bc('0x9d')](_0x1c2e7c['result'])){_0x1c2e7c['result']='#';_0x1b1862='#';}if(!this[_0x34bc('0x85')](_0x55f57f[_0x34bc('0xd1')])){this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0xd2'));}else{var _0x15acfd=this[_0x34bc('0xf')]['sync'](this,_0x55f57f['variable_id']);if(!_0x15acfd){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x55f57f,_0x34bc('0xd3'));}this[_0x34bc('0xd')][_0x34bc('0xa0')](_0x15acfd,_0x1b1862);}this[_0x34bc('0x35')][_0x34bc('0x6d')](this,_0x55f57f,_0x1b1862);return _0x1c2e7c;};AGIVertices[_0x34bc('0x13')]['noop']=function(_0xbcb397){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x160'),_0xbcb397['label']));return this['channel'][_0x34bc('0xaa')](_0xbcb397['output']||_0xbcb397[_0x34bc('0xa9')]);};AGIVertices[_0x34bc('0x13')]['pause']=function(_0x4ed076){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4ed076[_0x34bc('0xa9')]));if(!this['isConfigured'](_0x4ed076['findBy'])){return this[_0x34bc('0xd')]['error'](_0x4ed076,_0x34bc('0x161'));}logger['info'](util[_0x34bc('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x34bc('0xd')][_0x34bc('0x38')],_0x4ed076[_0x34bc('0x152')]));var _0x1943a2=this[_0x34bc('0x4b')][_0x34bc('0x6d')](this,_0x4ed076[_0x34bc('0x162')]);var _0x1ab3b0=this[_0x34bc('0x4d')][_0x34bc('0x6d')](this,_0x4ed076[_0x34bc('0x152')],_0x1943a2);if(_0x1ab3b0){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x153'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x4ed076[_0x34bc('0x152')]));this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x153'),this[_0x34bc('0xd')]['callerid'],_0x4ed076[_0x34bc('0x152')]));return{'code':0xc8,'result':_0x34bc('0x154')};}else{logger[_0x34bc('0x2c')](util['format'](_0x34bc('0x155'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x4ed076[_0x34bc('0x152')]));this['channel'][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x153'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x4ed076[_0x34bc('0x152')]));return{'code':0xc8,'result':_0x34bc('0x156')};}};AGIVertices[_0x34bc('0x13')][_0x34bc('0x163')]=function(_0x2e8be6){logger[_0x34bc('0x2c')](util['format'](_0x34bc('0x164'),_0x2e8be6[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x2e8be6[_0x34bc('0x109')])){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x2e8be6,_0x34bc('0x107'));}var _0x173955=this[_0x34bc('0x108')][_0x34bc('0x6d')](this,_0x2e8be6['file_id']);if(!_0x173955){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x2e8be6,_0x34bc('0x10a'));}var _0x55d11e=this[_0x34bc('0xd')][_0x34bc('0x55')](_0x34bc('0x165'),[_0x173955,_0x2e8be6[_0x34bc('0x103')]]);if(_0x55d11e[_0x34bc('0xa3')]===-0x1){return _0x55d11e;}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x166'),'PLAYBACK',_0x173955));};AGIVertices[_0x34bc('0x13')][_0x34bc('0x167')]=function(_0x91b3ad){logger['info'](util[_0x34bc('0x28')](_0x34bc('0x168'),_0x91b3ad['label']));if(!this[_0x34bc('0x85')](_0x91b3ad[_0x34bc('0x169')])){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x91b3ad,_0x34bc('0x16a'));}var _0x3fea92='';var _0x30238f=parseInt(_0x91b3ad[_0x34bc('0x169')],0xa);if(isNaN(_0x30238f)){_0x3fea92=_0x91b3ad[_0x34bc('0x169')];}else{_0x3fea92=this[_0x34bc('0x16b')][_0x34bc('0x6d')](this,_0x91b3ad[_0x34bc('0x169')]);if(!_0x3fea92){return this['channel'][_0x34bc('0x2b')](_0x91b3ad,_0x34bc('0x16c'));}}var _0x8b47a6='';if(this[_0x34bc('0x85')](_0x91b3ad[_0x34bc('0x109')])){var _0x32a161=this[_0x34bc('0x108')][_0x34bc('0x6d')](this,_0x91b3ad['file_id']);if(_0x32a161){_0x8b47a6=_0x32a161;}}this['createSquareDetailsReport'][_0x34bc('0x6d')](this,_0x91b3ad,_0x3fea92);if(_0x91b3ad[_0x34bc('0x103')][_0x34bc('0x16d')]('x')<0x0){_0x91b3ad['opts']+='x';}if(_0x91b3ad[_0x34bc('0x103')][_0x34bc('0x16d')]('X')<0x0){_0x91b3ad[_0x34bc('0x103')]+='X';}this[_0x34bc('0xd')][_0x34bc('0xa0')](_0x34bc('0x16e'),_0x3fea92?_0x3fea92[_0x34bc('0x16f')]():'');var _0x54e003=this[_0x34bc('0xd')][_0x34bc('0x55')](_0x34bc('0x170'),[_0x3fea92,_0x91b3ad[_0x34bc('0x103')],_0x91b3ad[_0x34bc('0x63')],_0x8b47a6,_0x91b3ad[_0x34bc('0x65')],_0x91b3ad['agi'],_0x91b3ad['macro'],_0x91b3ad[_0x34bc('0x171')],'',_0x91b3ad['position']]);if(_0x54e003[_0x34bc('0xa3')]===-0x1){return _0x54e003;}return this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')]('Executed\x20command\x20%s\x20%s',_0x34bc('0x170'),_0x3fea92));};AGIVertices['prototype']['record']=function(_0xd0295a){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x172'),_0xd0295a[_0x34bc('0xa9')]));var _0x5147a1=_0xd0295a['recordingFormat']||'wav';var _0x20b516=util[_0x34bc('0x28')](_0x34bc('0x173'),this[_0x34bc('0xd')][_0x34bc('0x3a')],rs[_0x34bc('0x111')](0x5));var _0x1783fc=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x20b516,_0x5147a1);var _0x20b802=util[_0x34bc('0x28')](_0x34bc('0x129'),FILES_PATH,_0x20b516);this[_0x34bc('0x39')][_0x34bc('0x6d')](this,_0xd0295a,_0x20b516,_0x1783fc);this[_0x34bc('0xd')][_0x34bc('0xa0')](_0x34bc('0x174'),_0x20b516);logger[_0x34bc('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x20b802,_0x5147a1,_0xd0295a[_0x34bc('0x175')],_0xd0295a[_0x34bc('0x65')]);return this[_0x34bc('0xd')]['recordFile'](_0x20b802,_0x5147a1,_0xd0295a['escape_digits'],_0xd0295a['timeout'],undefined,!![]);};AGIVertices[_0x34bc('0x13')]['restapi']=function(_0x50b65d){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x50b65d[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x50b65d[_0x34bc('0x63')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x2d56fd=this[_0x34bc('0x62')][_0x34bc('0x6d')](this,_0x50b65d);logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x176'),util[_0x34bc('0x177')](_0x2d56fd,{'showHidden':![],'depth':null})));if(!this[_0x34bc('0x85')](_0x50b65d['variable_id'])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0x178'));}var _0x58a094=this[_0x34bc('0xf')][_0x34bc('0x6d')](this,_0x50b65d['variable_id']);if(!_0x58a094){return this[_0x34bc('0xd')]['error'](_0x50b65d,_0x34bc('0xd3'));}this[_0x34bc('0xd')][_0x34bc('0xa0')](util[_0x34bc('0x28')]('%s_STATUS_CODE',_0x58a094),_0x2d56fd[_0x34bc('0x74')]?_0x2d56fd['statusCode']:_0x34bc('0x179'));this[_0x34bc('0xd')][_0x34bc('0xa0')](util[_0x34bc('0x28')](_0x34bc('0x17a'),_0x58a094),_0x2d56fd['statusMessage']?_0x2d56fd[_0x34bc('0x17b')]:'OK');if(_0x2d56fd[_0x34bc('0x69')]){try{this[_0x34bc('0x9c')](_0x2d56fd[_0x34bc('0x69')],_0x58a094);}catch(_0x43999d){logger['error'](util['format'](_0x34bc('0x17c'),_0x58a094));}}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0xd7'),_0x58a094));};AGIVertices['prototype'][_0x34bc('0x17d')]=function(_0x5c099a){logger['info'](util[_0x34bc('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5c099a['label']));return this[_0x34bc('0xd')][_0x34bc('0x17e')](_0x5c099a[_0x34bc('0x17f')][_0x34bc('0xd0')](/\s+/g,''),_0x5c099a[_0x34bc('0x175')]);};AGIVertices[_0x34bc('0x13')][_0x34bc('0x180')]=function(_0x91b695){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x181'),_0x91b695['label']));return this[_0x34bc('0xd')][_0x34bc('0x182')](_0x91b695[_0x34bc('0x183')][_0x34bc('0xd0')](/\s+/g,''),_0x91b695[_0x34bc('0x175')]);};AGIVertices[_0x34bc('0x13')]['sayphonetic']=function(_0x1c815a){logger[_0x34bc('0x2c')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1c815a['label']));return this[_0x34bc('0xd')][_0x34bc('0x184')](_0x1c815a[_0x34bc('0x5a')],_0x1c815a[_0x34bc('0x175')]);};AGIVertices[_0x34bc('0x13')][_0x34bc('0x185')]=function(_0xb20562){logger[_0x34bc('0x2c')](util['format'](_0x34bc('0x186'),_0xb20562['label']));if(!this[_0x34bc('0x85')](_0xb20562[_0x34bc('0x187')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0x188'));}var _0x214532=this[_0x34bc('0x189')][_0x34bc('0x6d')](this,_0xb20562[_0x34bc('0x187')]);if(!_0x214532||!_0x214532[_0x34bc('0x18a')]){return this[_0x34bc('0xd')]['error'](_0xb20562,_0x34bc('0x18b'));}var _0x41c9a1={'from':util['format'](_0x34bc('0x18c'),_0x214532[_0x34bc('0x11')],_0x214532[_0x34bc('0x18d')]||_0x214532[_0x34bc('0x18a')][_0x34bc('0x18e')]),'to':_0xb20562['to']||'','cc':_0xb20562['cc']||'','bcc':_0xb20562['bcc']||'','subject':_0xb20562['subject'],'html':_0xb20562['text'],'text':_0xb20562[_0x34bc('0x5a')]};if(this[_0x34bc('0x85')](_0xb20562[_0x34bc('0x18f')])){}logger[_0x34bc('0x190')](_0x34bc('0x191'),JSON[_0x34bc('0x72')](_0x41c9a1));this[_0x34bc('0x35')][_0x34bc('0x6d')](this,_0xb20562,_0xb20562[_0x34bc('0x187')]);this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x192'),_0x214532[_0x34bc('0x11')]));this[_0x34bc('0x22')]['sync'](this,_0x214532[_0x34bc('0x193')],_0x41c9a1);return this['channel'][_0x34bc('0xaa')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['sendFax']=function(_0x59ad27){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x194'),_0x59ad27[_0x34bc('0xa9')]));return this[_0x34bc('0xd')]['noop'](_0x34bc('0x195'));};AGIVertices[_0x34bc('0x13')]['sendSMS']=function(_0x2aa6b5){logger['info'](util[_0x34bc('0x28')](_0x34bc('0x196'),_0x2aa6b5[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x2aa6b5[_0x34bc('0x197')])){return this['channel'][_0x34bc('0xaa')](_0x34bc('0x198'));}var _0x5cb65f=this[_0x34bc('0x32')]['sync'](this,_0x2aa6b5[_0x34bc('0x197')]);if(!_0x5cb65f){return this['channel'][_0x34bc('0x2b')](_0x2aa6b5,_0x34bc('0x199'));}var _0x4b3236={'body':_0x2aa6b5[_0x34bc('0x19a')],'phone':_0x2aa6b5['to']||'','SmsAccountId':_0x5cb65f['id']};logger[_0x34bc('0x190')](_0x34bc('0x19b'),JSON[_0x34bc('0x72')](_0x4b3236));this[_0x34bc('0x35')][_0x34bc('0x6d')](this,_0x2aa6b5,_0x2aa6b5['sms_account_id']);this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')](_0x34bc('0x19c'),_0x5cb65f[_0x34bc('0x11')]));this[_0x34bc('0x34')][_0x34bc('0x6d')](this,_0x4b3236);return this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0x19d'));};AGIVertices['prototype'][_0x34bc('0x19e')]=function(_0x3c4817){logger['info'](util[_0x34bc('0x28')](_0x34bc('0x19f'),_0x3c4817[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x3c4817[_0x34bc('0xd1')])){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x3c4817,'no\x20variable\x20selected');}var _0x13b3e0=this['getVariable'][_0x34bc('0x6d')](this,_0x3c4817['variable_id']);if(!_0x13b3e0){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x3c4817,_0x34bc('0xd3'));}return this[_0x34bc('0xd')][_0x34bc('0xa0')](_0x13b3e0,_0x3c4817[_0x34bc('0x1a0')]);};AGIVertices[_0x34bc('0x13')][_0x34bc('0x1a1')]=function(_0x46dd31){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x46dd31[_0x34bc('0xa9')]));this[_0x34bc('0xd')][_0x34bc('0xaa')](_0x34bc('0x1a2'));var _0x242a63=this[_0x34bc('0xd')][_0x34bc('0xf')]('XMCS-UNIQUEID');if(!_[_0x34bc('0x9d')](_0x242a63[_0x34bc('0xa1')])){this[_0x34bc('0xd')][_0x34bc('0x3a')]=_0x242a63[_0x34bc('0xa1')];}if(_0x46dd31[_0x34bc('0xb8')]==='yes'){this[_0x34bc('0xd')]['noop'](_0x34bc('0x1a3'));return this[_0x34bc('0xd')][_0x34bc('0xb8')]();}return this['channel'][_0x34bc('0xaa')](_0x34bc('0x1a4'));};AGIVertices[_0x34bc('0x13')][_0x34bc('0x1a5')]=function(_0x493c7b){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x1a6'),_0x493c7b['label']));if(!this['isConfigured'](_0x493c7b[_0x34bc('0x1a7')])){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x493c7b,_0x34bc('0x1a8'));}var _0x57e9cb=this[_0x34bc('0x14')][_0x34bc('0x6d')](this,_0x493c7b[_0x34bc('0x1a7')]);if(!this[_0x34bc('0x85')](_0x57e9cb)){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x493c7b,util['format'](_0x34bc('0x1a9'),_0x493c7b['project_id']));}if(_0x57e9cb===this['channel'][_0x34bc('0x37')]){return this[_0x34bc('0xd')]['error'](_0x493c7b,_0x34bc('0x1aa'));}this[_0x34bc('0x35')]['sync'](this,_0x493c7b,_0x57e9cb);var _0x1890e8=this[_0x34bc('0xd')][_0x34bc('0x55')](_0x34bc('0x1ab'),util[_0x34bc('0x28')](_0x34bc('0x1ac'),config[_0x34bc('0x7')][_0x34bc('0x1ad')]||_0x34bc('0x1ae'),_0x57e9cb,this[_0x34bc('0xd')][_0x34bc('0x37')]));if(_0x1890e8[_0x34bc('0xa3')]===-0x1){return _0x1890e8;}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('Executed\x20command\x20%s\x20%s','AGI',_0x57e9cb));};AGIVertices[_0x34bc('0x13')]['system']=function(_0xbd3ce0){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x1af'),_0xbd3ce0[_0x34bc('0xa9')]));var _0x24cbea=this[_0x34bc('0x54')][_0x34bc('0x6d')](this,_0xbd3ce0[_0x34bc('0xb4')]);this[_0x34bc('0x35')]['sync'](this,_0xbd3ce0,_0xbd3ce0[_0x34bc('0xb4')]);if(this['isConfigured'](_0xbd3ce0['variable_id'])){var _0x3e0cb3=this['getVariable'][_0x34bc('0x6d')](this,_0xbd3ce0[_0x34bc('0xd1')]);if(_0x3e0cb3){this['channel'][_0x34bc('0xa0')](_0x3e0cb3,_0x24cbea);return this[_0x34bc('0xd')]['noop'](util[_0x34bc('0x28')](_0x34bc('0x1b0'),_0xbd3ce0[_0x34bc('0xb4')],_0x3e0cb3));}}return this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xbd3ce0[_0x34bc('0xb4')]));};AGIVertices[_0x34bc('0x13')][_0x34bc('0x1b1')]=function(_0x597630){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x597630['label']));_0x597630[_0x34bc('0x5a')]=_0x597630['text'][_0x34bc('0xd0')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x34bc('0x85')](_0x597630[_0x34bc('0x58')])){return this['channel'][_0x34bc('0xaa')](_0x34bc('0x1b2'));}if(!this[_0x34bc('0x85')](_0x597630[_0x34bc('0x5a')])){return this[_0x34bc('0xd')]['noop'](_0x34bc('0xab'));}this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x597630['text']));var _0x279fe0=this[_0x34bc('0x57')]['sync'](this,_0x597630);if(_0x279fe0){this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x1b3'),_0x279fe0));var _0x31159f=this[_0x34bc('0xd')][_0x34bc('0x11c')](_0x279fe0);try{fs[_0x34bc('0xf9')](_0x279fe0+_0x34bc('0x150'));}catch(_0x3fbd23){logger[_0x34bc('0x2b')](_0x3fbd23);}return _0x31159f;}return this['channel'][_0x34bc('0x2b')](_0x597630,_0x34bc('0x1b4'));};AGIVertices[_0x34bc('0x13')][_0x34bc('0x1b5')]=function(_0x24c69d){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x1b6'),_0x24c69d[_0x34bc('0xa9')]));_0x24c69d[_0x34bc('0x5a')]=_0x24c69d['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x24c69d[_0x34bc('0x5a')])){return this[_0x34bc('0xd')][_0x34bc('0xaa')]('no\x20text\x20configured');}this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')](_0x34bc('0x1b7'),_0x24c69d[_0x34bc('0x5a')]));var _0x310d3b=this['googleTTS']['sync'](this,_0x24c69d);if(_0x310d3b){this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x310d3b));var _0x2c161f=this['channel'][_0x34bc('0x11c')](_0x310d3b);try{fs['unlink'](_0x310d3b+'.wav');}catch(_0xe04ce4){logger[_0x34bc('0x2b')](_0xe04ce4);}return _0x2c161f;}return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x24c69d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x34bc('0x1b8')]=function(_0x5bef89){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x1b9'),_0x5bef89[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x5bef89['findBy'])){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x5bef89,_0x34bc('0x161'));}logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x158'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x5bef89[_0x34bc('0x152')]));var _0x40035c=this[_0x34bc('0x4f')]['sync'](this,_0x5bef89[_0x34bc('0x152')]);if(_0x40035c){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x34bc('0xd')][_0x34bc('0x38')],_0x5bef89['findBy']));this[_0x34bc('0xd')]['noop'](util['format'](_0x34bc('0x153'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x5bef89[_0x34bc('0x152')]));return{'code':0xc8,'result':_0x34bc('0x154')};}else{logger[_0x34bc('0x2c')](util['format'](_0x34bc('0x155'),this[_0x34bc('0xd')][_0x34bc('0x38')],_0x5bef89[_0x34bc('0x152')]));this[_0x34bc('0xd')][_0x34bc('0xaa')](util[_0x34bc('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x34bc('0xd')][_0x34bc('0x38')],_0x5bef89[_0x34bc('0x152')]));return{'code':0xc8,'result':_0x34bc('0x156')};}};AGIVertices['prototype'][_0x34bc('0x1ba')]=function(_0x38e722){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')](_0x34bc('0x1bb'),_0x38e722[_0x34bc('0xa9')]));var _0x2b5447=this[_0x34bc('0xd')]['exec'](_0x34bc('0x1bc'),[_0x38e722['mailbox'],_0x38e722[_0x34bc('0x77')]]);if(_0x2b5447[_0x34bc('0xa3')]===-0x1){return _0x2b5447;}return this['channel']['noop'](util[_0x34bc('0x28')](_0x34bc('0x166'),_0x34bc('0x1bc'),_0x38e722[_0x34bc('0x1bd')]));};AGIVertices['prototype'][_0x34bc('0x1be')]=function(_0x4ff45b){logger[_0x34bc('0x2c')](util[_0x34bc('0x28')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4ff45b[_0x34bc('0xa9')]));if(!this[_0x34bc('0x85')](_0x4ff45b[_0x34bc('0xd1')])){return this[_0x34bc('0xd')][_0x34bc('0x2b')](_0x4ff45b,_0x34bc('0x1bf'));}var _0x38b2a6=this['getVariable'][_0x34bc('0x6d')](this,_0x4ff45b['variable_id']);if(!_0x38b2a6){return this[_0x34bc('0xd')]['error'](_0x4ff45b,_0x34bc('0xd3'));}var _0x1dac5b=this[_0x34bc('0xd')]['getVariable'](_0x38b2a6);return{'code':0xc8,'result':_0x1dac5b['extra']?_0x1dac5b['extra']:'-'};};String[_0x34bc('0x13')][_0x34bc('0x1c0')]=function(_0x5b1a4b,_0x1b9d27){return this['split'](_0x5b1a4b)[_0x34bc('0x1c1')](_0x1b9d27);};module[_0x34bc('0x1c2')]=AGIVertices; \ No newline at end of file +var _0x6334=['grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','noop','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','list_id','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','debug','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','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\x20found','email','Smtp','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','answer','yes','Answer','subproject','project_id','no\x20subproject\x20selected','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','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','unlink','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getSquareProject','getSquareProjectById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','lastName','isNil','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','LOCAL','shellCommand','exec','trim','replace','apiKey','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','PUT','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','body','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','ispeechTTS','key','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','MRCPSynth','result'];(function(_0x39afbf,_0x2a4f57){var _0x489130=function(_0x22d400){while(--_0x22d400){_0x39afbf['push'](_0x39afbf['shift']());}};_0x489130(++_0x2a4f57);}(_0x6334,0x119));var _0x4633=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x6334[_0x35f7f5];return _0x5567a4;};'use strict';var fs=require('fs');var util=require(_0x4633('0x0'));var _=require(_0x4633('0x1'));var sh=require(_0x4633('0x2'));var odbc=require(_0x4633('0x3'))();var rs=require(_0x4633('0x4'));var moment=require(_0x4633('0x5'));var Mustache=require('mustache');var rp=require(_0x4633('0x6'));var logger=require(_0x4633('0x7'))(_0x4633('0x8'));var config=require(_0x4633('0x9'));var scripts=require(_0x4633('0xa'));var FILES_PATH=_0x4633('0xb');var recursiveMapAttributes=[_0x4633('0xc'),'rawBody'];var verticesWithRetry=[_0x4633('0xd'),'getdigits',_0x4633('0xe')];var AGIVertices=function(_0x148e72,_0x4ec5b1,_0x3c202f){this[_0x4633('0xf')]=_0x148e72;this[_0x4633('0x10')]=_0x4ec5b1;this['mailRpc']=_0x3c202f;};AGIVertices[_0x4633('0x11')][_0x4633('0x12')]=function(_0x5157a7,_0x6a63b){this[_0x4633('0x10')][_0x4633('0x13')](_0x5157a7)[_0x4633('0x14')](function(_0x5564c4){_0x6a63b(null,_0x5564c4?_0x5564c4[_0x4633('0x15')]:![]);})[_0x4633('0x16')](function(_0x438e87){_0x6a63b(_0x438e87);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x49f5c3,_0x28e2bc){this[_0x4633('0x10')]['getVoiceQueueById'](_0x49f5c3)['then'](function(_0x1d967e){_0x28e2bc(null,_0x1d967e?_0x1d967e['name']:![]);})[_0x4633('0x16')](function(_0x33b6e7){_0x28e2bc(_0x33b6e7);});};AGIVertices[_0x4633('0x11')][_0x4633('0x17')]=function(_0x5358a3,_0x2c38e5){this[_0x4633('0x10')][_0x4633('0x18')](_0x5358a3)['then'](function(_0xa8a6c1){_0x2c38e5(null,_0xa8a6c1?_0xa8a6c1[_0x4633('0x15')]:![]);})[_0x4633('0x16')](function(_0x2ad562){_0x2c38e5(_0x2ad562);});};AGIVertices[_0x4633('0x11')]['getSquareOdbc']=function(_0x4691f2,_0xfe3446){this['rpc']['getSquareOdbcById'](_0x4691f2)[_0x4633('0x14')](function(_0x49e5c7){_0xfe3446(null,_0x49e5c7?_0x49e5c7[_0x4633('0x19')]:![]);})['catch'](function(_0x57dfb8){_0xfe3446(_0x57dfb8);});};AGIVertices[_0x4633('0x11')][_0x4633('0x1a')]=function(_0x23bc5e,_0x604f3d){this[_0x4633('0x10')][_0x4633('0x1b')](_0x23bc5e)['then'](function(_0x2b1976){_0x604f3d(null,_0x2b1976?_0x2b1976['name']:![]);})[_0x4633('0x16')](function(_0xcfac3f){_0x604f3d(_0xcfac3f);});};AGIVertices[_0x4633('0x11')][_0x4633('0x1c')]=function(_0x45db49,_0x49880a){this[_0x4633('0x10')][_0x4633('0x1d')](_0x45db49)[_0x4633('0x14')](function(_0x13ec10){_0x49880a(null,_0x13ec10?_0x13ec10[_0x4633('0x15')]:![]);})[_0x4633('0x16')](function(_0x1ba1ed){_0x49880a(_0x1ba1ed);});};AGIVertices[_0x4633('0x11')][_0x4633('0x1e')]=function(_0x7d7f2,_0x1b9ed8){var _0x2539a2=this;this[_0x4633('0x10')][_0x4633('0x1f')](_0x7d7f2)[_0x4633('0x14')](function(_0x3f03aa){_0x1b9ed8(null,_0x3f03aa?_0x2539a2[_0x4633('0x20')](_0x3f03aa[_0x4633('0x21')]):![]);})['catch'](function(_0x197aa6){_0x1b9ed8(_0x197aa6);});};AGIVertices[_0x4633('0x11')][_0x4633('0x22')]=function(_0x308ad6,_0x45a58f){this[_0x4633('0x10')]['getMailAccountById'](_0x308ad6)[_0x4633('0x14')](function(_0x52fc85){_0x45a58f(null,_0x52fc85?_0x52fc85:![]);})[_0x4633('0x16')](function(_0x20aa07){_0x45a58f(_0x20aa07);});};AGIVertices[_0x4633('0x11')][_0x4633('0x23')]=function(_0xf32012,_0x1c4652,_0x43e23f){this[_0x4633('0x24')][_0x4633('0x23')](_0xf32012,_0x1c4652)[_0x4633('0x14')](function(){_0x43e23f(null);})[_0x4633('0x16')](function(_0x53eeea){_0x43e23f(_0x53eeea);});};AGIVertices[_0x4633('0x11')][_0x4633('0x25')]=function(_0x4c8bc4,_0x5afdf2){this[_0x4633('0x10')][_0x4633('0x26')](_0x4c8bc4)['then'](function(_0x34b211){if(_0x34b211){if(_0x34b211[_0x4633('0x27')]){_0x5afdf2(null,[_0x34b211[_0x4633('0x28')]]);}else{_0x5afdf2(null,_[_0x4633('0x29')](_0x34b211['Intervals'],_0x4633('0x28')));}}else{_0x5afdf2(null,![]);}})['catch'](function(_0xd606e5){_0x5afdf2(_0xd606e5);});};AGIVertices[_0x4633('0x11')][_0x4633('0x20')]=function(_0x204be9){return util[_0x4633('0x2a')](_0x4633('0x2b'),FILES_PATH,_0x204be9);};AGIVertices[_0x4633('0x11')][_0x4633('0x2c')]=function(_0x546390,_0x29b0b5,_0x107616){odbc['open'](_0x546390,function(_0x10c45f){if(_0x10c45f){logger[_0x4633('0x2d')](_0x4633('0x2e'),_0x10c45f);_0x107616(_0x10c45f);}else{logger[_0x4633('0x2f')]('ODBC\x20connection\x20successfully');odbc['query'](_0x29b0b5,function(_0x9d7056,_0x4d54ae){if(_0x9d7056){logger['info'](_0x4633('0x30'),_0x29b0b5);_0x107616(_0x9d7056);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x29b0b5);odbc[_0x4633('0x31')](function(_0x433d2d){if(_0x433d2d){logger[_0x4633('0x2d')](_0x4633('0x32'),_0x433d2d);}_0x107616(null,_0x4d54ae);});}});}});};AGIVertices[_0x4633('0x11')]['getSmsAccount']=function(_0x6873d0,_0x530ced){this[_0x4633('0x10')][_0x4633('0x33')](_0x6873d0)[_0x4633('0x14')](function(_0x402708){_0x530ced(null,_0x402708?_0x402708:![]);})['catch'](function(_0x2c9aba){_0x530ced(_0x2c9aba);});};AGIVertices['prototype'][_0x4633('0x34')]=function(_0x33a273,_0x3c26d6){this[_0x4633('0x10')][_0x4633('0x34')](_0x33a273)['then'](function(_0x4de806){_0x3c26d6(null,_0x4de806);})[_0x4633('0x16')](function(_0x43f5ab){_0x3c26d6(_0x43f5ab);});};AGIVertices[_0x4633('0x11')][_0x4633('0x35')]=function(_0x45fe39,_0x53669c,_0x2660ca){this['rpc'][_0x4633('0x35')]({'uniqueid':this['channel'][_0x4633('0x36')],'node':_0x45fe39['label'],'application':_0x45fe39[_0x4633('0x37')],'data':_0x53669c||null,'project_name':this[_0x4633('0xf')][_0x4633('0x38')],'callerid':this[_0x4633('0xf')][_0x4633('0x39')]})[_0x4633('0x14')](function(_0x460dce){if(_0x2660ca){_0x2660ca(null,_0x460dce);}})[_0x4633('0x16')](function(_0x18f3fd){if(_0x2660ca){_0x2660ca(_0x18f3fd);}});};AGIVertices[_0x4633('0x11')][_0x4633('0x3a')]=function(_0x2b6b8f,_0x4022b4,_0xdec8df,_0x42fb6a){this[_0x4633('0x10')][_0x4633('0x3a')]({'uniqueid':this[_0x4633('0xf')][_0x4633('0x36')],'callerid':this[_0x4633('0xf')][_0x4633('0x39')],'calleridname':this['channel']['calleridname'],'context':this[_0x4633('0xf')]['context'],'extension':this['channel']['extension'],'priority':this[_0x4633('0xf')][_0x4633('0x3b')],'accountcode':this['channel'][_0x4633('0x3c')],'dnid':this[_0x4633('0xf')][_0x4633('0x3d')],'projectName':this[_0x4633('0xf')][_0x4633('0x38')],'saveName':_0x4022b4,'filename':_0x2b6b8f[_0x4633('0x3e')]||_0x4022b4,'savePath':_0xdec8df})['then'](function(_0x4ca3d6){_0x42fb6a(null,_0x4ca3d6);})['catch'](function(_0x99c493){_0x42fb6a(_0x99c493);});};AGIVertices[_0x4633('0x11')][_0x4633('0x3f')]=function(_0x5b6fec,_0x3a565d,_0x1aa16c,_0x55f204,_0x2d18f6){this[_0x4633('0x10')][_0x4633('0x3f')]({'uniqueid':this['channel']['uniqueid'],'body':_0x5b6fec,'direction':_0x3a565d,'providerName':_0x1aa16c,'providerResponse':_0x55f204})[_0x4633('0x14')](function(_0x4bab8d){if(_0x2d18f6){_0x2d18f6(null,_0x4bab8d);}})[_0x4633('0x16')](function(_0x4222d){if(_0x2d18f6){_0x2d18f6(_0x4222d);}});};AGIVertices[_0x4633('0x11')]['createCmContact']=function(_0xc37769,_0xf812ca){this[_0x4633('0x10')][_0x4633('0x40')]({'firstName':_[_0x4633('0x41')](_0xc37769[_0x4633('0x15')])||_['isNil'](_0xc37769[_0x4633('0x15')])?'callback_'+Math['random']():_0xc37769['name'],'lastName':_[_0x4633('0x41')](_0xc37769[_0x4633('0x42')])||_[_0x4633('0x43')](_0xc37769[_0x4633('0x42')])?null:_0xc37769['lastName'],'phone':_0xc37769[_0x4633('0x44')],'ListId':_0xc37769['list_id'],'scheduledat':_0xc37769[_0x4633('0x45')],'callbackUniqueid':this[_0x4633('0xf')][_0x4633('0x36')],'tags':_0x4633('0x46'),'description':_0x4633('0x47')+_0xc37769[_0x4633('0x45')][_0x4633('0x48')](),'priority':_0xc37769[_0x4633('0x49')]})['then'](function(_0x170082){_0xf812ca(null,_0x170082);})['catch'](function(_0x413707){_0xf812ca(_0x413707);});};AGIVertices[_0x4633('0x11')][_0x4633('0x4a')]=function(_0x2f89cc,_0x2e5967){this[_0x4633('0x10')][_0x4633('0x4b')](_0x2f89cc)[_0x4633('0x14')](function(_0x18163a){_0x2e5967(null,_0x18163a?_0x18163a[_0x4633('0x15')]:![]);})[_0x4633('0x16')](function(_0x20990d){_0x2e5967(_0x20990d);});};AGIVertices[_0x4633('0x11')]['agentPause']=function(_0x2c3c44,_0x82beee,_0xbc6448){var _0x2bee59={'role':_0x4633('0x4c')};_0x2bee59[_0x2c3c44]=this[_0x4633('0xf')][_0x4633('0x39')];this[_0x4633('0x10')][_0x4633('0x4d')](_0x2bee59,_0x82beee,this[_0x4633('0xf')][_0x4633('0x36')])['then'](function(_0x5848d7){_0xbc6448(null,_[_0x4633('0x43')](_0x5848d7)?![]:!![]);})['catch'](function(_0x3c6dc6){logger[_0x4633('0x2d')](_0x3c6dc6);_0xbc6448(null,![]);});};AGIVertices['prototype'][_0x4633('0x4e')]=function(_0x344536,_0x327103){var _0x40815d={'role':_0x4633('0x4c')};_0x40815d[_0x344536]=this['channel'][_0x4633('0x39')];this[_0x4633('0x10')][_0x4633('0x4e')](_0x40815d)[_0x4633('0x14')](function(_0x34f4d4){_0x327103(null,_['isNil'](_0x34f4d4)?![]:!![]);})[_0x4633('0x16')](function(_0x24c316){logger[_0x4633('0x2d')](_0x24c316);_0x327103(null,![]);});};AGIVertices['prototype'][_0x4633('0x4f')]=function(_0x2f232c,_0x42fd2a){var _0x2efee0={'role':_0x4633('0x4c')};_0x2efee0[_0x2f232c]=this[_0x4633('0xf')][_0x4633('0x39')];this[_0x4633('0x10')][_0x4633('0x4f')](_0x2efee0)[_0x4633('0x14')](function(_0x210ee1){_0x42fd2a(null,_['isNil'](_0x210ee1)?![]:!![]);})['catch'](function(_0x144ae3){logger[_0x4633('0x2d')](_0x144ae3);_0x42fd2a(null,![]);});};AGIVertices[_0x4633('0x11')]['agentLogin']=function(_0x5ed2b3,_0x2f2e2a){var _0x23303b={'role':_0x4633('0x4c')};_0x23303b[_0x5ed2b3]=this['channel'][_0x4633('0x39')];var _0x370122=_0x5ed2b3!=_0x4633('0x50')?util['format']('%s/%s@from-sip/n',_0x4633('0x51'),this['channel'][_0x4633('0x39')]):undefined;this[_0x4633('0x10')]['agentLogin'](_0x23303b,_0x370122)[_0x4633('0x14')](function(_0x47108f){_0x2f2e2a(null,_[_0x4633('0x43')](_0x47108f)?![]:!![]);})[_0x4633('0x16')](function(_0x4f338c){logger[_0x4633('0x2d')](_0x4f338c);_0x2f2e2a(null,![]);});};AGIVertices[_0x4633('0x11')][_0x4633('0x52')]=function(_0x36b0c2,_0x2ea1a5){sh[_0x4633('0x53')](_[_0x4633('0x54')](_0x36b0c2),function(_0x4d263a,_0x2ddc25){var _0x2ee936=_0x2ddc25[_0x4633('0x55')](/(\r\n|\n|\r)/gm,'');_0x2ea1a5(null,_0x2ee936);});};AGIVertices[_0x4633('0x11')]['googleCloudTTS']=function(_0x51453e,_0x29a1c4){scripts['googleCloudTTS'](_0x51453e[_0x4633('0x56')],_0x51453e['google_cloud_tts_text_type']||'text',_0x51453e[_0x4633('0x57')],_0x51453e[_0x4633('0x58')]||'en-US',_0x51453e[_0x4633('0x59')]||_0x4633('0x5a'),_0x51453e[_0x4633('0x5b')]||_0x4633('0x5c'))[_0x4633('0x14')](function(_0x131467){_0x29a1c4(null,_0x131467);})[_0x4633('0x16')](function(_0x24b115){_0x29a1c4(_0x24b115);});};AGIVertices['prototype'][_0x4633('0x5d')]=function(_0x5c52e6,_0x1ba99d){scripts['googleTTS'](_0x5c52e6[_0x4633('0x57')],_0x5c52e6[_0x4633('0x5e')]||'en',0x1)[_0x4633('0x14')](function(_0x18516e){_0x1ba99d(null,_0x18516e);})[_0x4633('0x16')](function(_0x2a5a56){_0x1ba99d(_0x2a5a56);});};AGIVertices['prototype'][_0x4633('0x5f')]=function(_0x2f3405,_0x27ab67){var _0x5ce875={'uri':_0x2f3405[_0x4633('0x60')],'method':_0x2f3405[_0x4633('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2f3405[_0x4633('0x62')])===_0x4633('0x63')&&parseInt(_0x2f3405[_0x4633('0x62')])>=0x1?parseInt(_0x2f3405[_0x4633('0x62')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0x4633('0x64')],_0x5ce875['method']['toUpperCase']())){try{_0x5ce875['body']=_0x2f3405['rawBody']?JSON[_0x4633('0x65')](_0x2f3405[_0x4633('0x66')]):{};}catch(_0x474dfb){logger[_0x4633('0x2d')](_0x4633('0x67'),_0x474dfb);}}try{_0x5ce875['headers']=_0x2f3405[_0x4633('0xc')]?JSON[_0x4633('0x65')](_0x2f3405[_0x4633('0xc')]):{};}catch(_0x3d4ada){logger[_0x4633('0x2d')](_0x4633('0x68'),_0x3d4ada);}if(_0x2f3405['computedVariables']){try{var _0x17306b=require(_0x2f3405['computedVariables'])[_0x4633('0x69')](this,_0x5ce875);_0x5ce875[_0x4633('0x6a')]=Mustache['render'](_0x2f3405[_0x4633('0x60')],_0x17306b,{},['$$','$$']);if(_0x5ce875[_0x4633('0x6b')]){_0x5ce875['headers']=JSON[_0x4633('0x65')](Mustache[_0x4633('0x6c')](JSON[_0x4633('0x6d')](_0x5ce875['headers']),_0x17306b,{},['$$','$$']));}if(_0x5ce875['body']){_0x5ce875['body']=JSON[_0x4633('0x65')](Mustache['render'](JSON[_0x4633('0x6d')](_0x5ce875['body']),_0x17306b,{},['$$','$$']));}}catch(_0x109a23){logger[_0x4633('0x2d')](_0x4633('0x6e'),_0x109a23);}}rp(_0x5ce875)[_0x4633('0x14')](function(_0x12ec6d){var _0x40e4ae={'statusCode':_0x12ec6d[_0x4633('0x6f')]||0xc8,'statusMessage':_0x12ec6d[_0x4633('0x70')]||'OK','headers':_0x12ec6d[_0x4633('0x6b')]||{},'body':_0x12ec6d[_0x4633('0x71')]||{}};_0x27ab67(null,_0x40e4ae);})[_0x4633('0x16')](function(_0x4ea2bd){var _0xcff574={'statusCode':_0x4ea2bd[_0x4633('0x6f')]||0x1f4,'statusMessage':_0x4ea2bd[_0x4633('0x72')]||_0x4633('0x73'),'headers':_0x4ea2bd[_0x4633('0x74')][_0x4633('0x6b')]||{},'body':_0x4ea2bd['options'][_0x4633('0x71')]||{}};_0x27ab67(null,_0xcff574);});};AGIVertices[_0x4633('0x11')][_0x4633('0x75')]=function(_0x46195b,_0x4d1d30){scripts[_0x4633('0x75')](this[_0x4633('0xf')]['uniqueid'],_0x46195b['key'],_0x46195b[_0x4633('0x57')],_0x46195b['dialogflow_language']||'en')['then'](function(_0x3f6f29){_0x4d1d30(null,_0x3f6f29);})['catch'](function(_0x5876f3){_0x4d1d30(_0x5876f3);});};AGIVertices[_0x4633('0x11')][_0x4633('0x76')]=function(_0x20a6c5,_0xdc710f){scripts[_0x4633('0x76')](this[_0x4633('0xf')]['uniqueid'],_0x20a6c5[_0x4633('0x77')],_0x20a6c5[_0x4633('0x78')],_0x20a6c5['private_key'],_0x20a6c5[_0x4633('0x57')],_0x20a6c5[_0x4633('0x79')]||'en')[_0x4633('0x14')](function(_0x3d0f14){_0xdc710f(null,_0x3d0f14);})[_0x4633('0x16')](function(_0x419ad5){_0xdc710f(_0x419ad5);});};AGIVertices[_0x4633('0x11')]['sestekNDA']=function(_0x35d846,_0x1f5b0e){scripts['sestekNDA'](this[_0x4633('0xf')],_0x35d846)[_0x4633('0x14')](function(_0x82ef5a){_0x1f5b0e(null,_0x82ef5a);})[_0x4633('0x16')](function(_0x5c59ac){_0x1f5b0e(_0x5c59ac);});};AGIVertices[_0x4633('0x11')][_0x4633('0x7a')]=function(_0x15d271,_0x2ed130){scripts[_0x4633('0x7a')](_0x15d271[_0x4633('0x7b')],_0x15d271[_0x4633('0x57')],_0x15d271['ispeech_tts_language']||_0x4633('0x7c'),_0x15d271[_0x4633('0x7d')])[_0x4633('0x14')](function(_0x3136a4){_0x2ed130(null,_0x3136a4);})[_0x4633('0x16')](function(_0xc523b5){_0x2ed130(_0xc523b5);});};AGIVertices[_0x4633('0x11')][_0x4633('0x7e')]=function(_0x5c74e8,_0x5ca0ff,_0x606605){scripts[_0x4633('0x7e')](_0x5ca0ff,_0x5c74e8['key'],_0x5c74e8[_0x4633('0x7f')]||_0x4633('0x7c'),this[_0x4633('0x80')](_0x5c74e8[_0x4633('0x81')])?_0x5c74e8[_0x4633('0x81')]:undefined)[_0x4633('0x14')](function(_0x35b95d){_0x606605(null,_0x35b95d);})[_0x4633('0x16')](function(_0x399738){_0x606605(_0x399738);});};AGIVertices[_0x4633('0x11')][_0x4633('0x82')]=function(_0x2293db,_0x5596ae){scripts[_0x4633('0x82')](_0x2293db['aws_access_key_id'],_0x2293db[_0x4633('0x83')],_0x2293db[_0x4633('0x84')],_0x2293db[_0x4633('0x85')]||_0x4633('0x86'),_0x2293db[_0x4633('0x57')],_0x2293db[_0x4633('0x87')]||_0x4633('0x57'))['then'](function(_0x125d90){_0x5596ae(null,_0x125d90);})[_0x4633('0x16')](function(_0x4811ea){_0x5596ae(_0x4811ea);});};AGIVertices[_0x4633('0x11')][_0x4633('0x88')]=function(_0x11ef2c,_0x2d1a66){scripts[_0x4633('0x88')](this[_0x4633('0xf')]['uniqueid'],_0x11ef2c[_0x4633('0x89')],_0x11ef2c['aws_secret_access_key'],_0x11ef2c['aws_lex_region'],_0x11ef2c[_0x4633('0x57')],_0x11ef2c[_0x4633('0x8a')])[_0x4633('0x14')](function(_0xcbd3a3){_0x2d1a66(null,_0xcbd3a3);})[_0x4633('0x16')](function(_0xe451f2){_0x2d1a66(_0xe451f2);});};AGIVertices[_0x4633('0x11')][_0x4633('0x8b')]=function(_0x1a1de7,_0x26d45c,_0x568e1d){scripts[_0x4633('0x8b')](_0x26d45c,_0x1a1de7['key'],_0x1a1de7[_0x4633('0x8c')]||_0x4633('0x7c'))[_0x4633('0x14')](function(_0x47e944){_0x568e1d(null,_0x47e944);})[_0x4633('0x16')](function(_0x391229){_0x568e1d(_0x391229);});};AGIVertices[_0x4633('0x11')][_0x4633('0x8d')]=function(_0x2a9c3b,_0x38712e,_0x50bbf7){scripts[_0x4633('0x8d')](_0x38712e,_0x2a9c3b[_0x4633('0x8e')],_0x2a9c3b[_0x4633('0x8f')],_0x2a9c3b['uri'])['then'](function(_0x31dab5){_0x50bbf7(null,_0x31dab5);})[_0x4633('0x16')](function(_0x53fdc5){_0x50bbf7(_0x53fdc5);});};AGIVertices['prototype'][_0x4633('0x90')]=function(_0x45298e){var _0x214f21=_[_0x4633('0x91')](verticesWithRetry,_0x45298e['agicommand'])?_0x45298e:_[_0x4633('0x92')](_0x45298e);for(var _0x403a22 in _0x214f21){if(_0x214f21[_0x4633('0x93')](_0x403a22)){if(_0x214f21[_0x403a22]&&_['isString'](_0x214f21[_0x403a22])){if(_[_0x4633('0x91')](recursiveMapAttributes,_0x403a22)){_0x214f21[_0x403a22]=this[_0x4633('0x94')](_0x214f21[_0x403a22]);}else{_0x214f21[_0x403a22]=this['replaceAllVariables'](_0x214f21[_0x403a22]);}}}}return _0x214f21;};AGIVertices[_0x4633('0x11')][_0x4633('0x95')]=function(_0x2415a4){for(var _0x3f5236 in _0x2415a4){if(_0x2415a4[_0x4633('0x93')](_0x3f5236)){if(_[_0x4633('0x96')](_0x2415a4[_0x3f5236])){this[_0x4633('0x95')](_0x2415a4[_0x3f5236]);}else if(_[_0x4633('0x97')](_0x2415a4[_0x3f5236])){for(var _0x1adc76=0x0;_0x1adc76<_0x2415a4[_0x3f5236][_0x4633('0x98')];_0x1adc76++){this[_0x4633('0x95')](_0x2415a4[_0x3f5236][_0x1adc76]);}}else if(_[_0x4633('0x99')](_0x2415a4[_0x3f5236])){_0x2415a4[_0x3f5236]=this[_0x4633('0x9a')](_0x2415a4[_0x3f5236]);}}}};AGIVertices[_0x4633('0x11')][_0x4633('0x9b')]=function(_0x59d869,_0x71c9ef){for(var _0x34798f in _0x59d869){if(_0x59d869[_0x4633('0x93')](_0x34798f)){if(_[_0x4633('0x96')](_0x59d869[_0x34798f])){if(!_[_0x4633('0x41')](_0x59d869[_0x34798f])){this[_0x4633('0x9b')](_0x59d869[_0x34798f],util['format']('%s.%s',_0x71c9ef,_0x34798f));}}else if(_[_0x4633('0x97')](_0x59d869[_0x34798f])){for(var _0x95656a=0x0;_0x95656a<_0x59d869[_0x34798f]['length'];_0x95656a++){this['saveRestApiResult'](_0x59d869[_0x34798f][_0x95656a],util['format'](_0x4633('0x9c'),_0x71c9ef,_0x34798f+'['+_0x95656a+']'));}}else{if(!_[_0x4633('0x43')](_0x59d869[_0x34798f])){this['channel'][_0x4633('0x9d')](util[_0x4633('0x2a')]('%s.%s',_0x71c9ef,_0x34798f),_0x59d869[_0x34798f]);}}}}};AGIVertices[_0x4633('0x11')][_0x4633('0x94')]=function(_0x581506){try{var _0x49a1e3=JSON[_0x4633('0x65')](_0x581506);this[_0x4633('0x95')](_0x49a1e3);return JSON['stringify'](_0x49a1e3);}catch(_0x284c38){return this[_0x4633('0x9a')](_0x581506);}};AGIVertices[_0x4633('0x11')]['replaceAllVariables']=function(_0x4e40a8){var _0x4baaf6=_0x4e40a8[_0x4633('0x9e')]('{');for(var _0x10fbfb=0x1;_0x10fbfb<_0x4baaf6[_0x4633('0x98')];_0x10fbfb+=0x1){var _0x4713a5=_0x4baaf6[_0x10fbfb]['split']('}');if(_0x4713a5['length']>0x1){_0x4e40a8=_0x4e40a8['replaceAll']('{'+_0x4713a5[0x0]+'}',this['channel'][_0x4633('0x12')](_0x4713a5[0x0])['extra']||_0x4713a5[0x0]);}}if(_0x4baaf6[_0x4633('0x98')]===0x1){return _0x4e40a8[_0x4633('0x48')]();}return this[_0x4633('0x9a')](_0x4e40a8);};AGIVertices['prototype'][_0x4633('0x9f')]=function(_0x24f572,_0x37cb38){var _0x2691e1=this['channel'][_0x4633('0x12')](_0x24f572);if(_0x2691e1['result']===-0x1){return _0x2691e1;}logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0xa0'),_0x37cb38,_0x2691e1['extra']));return this['channel'][_0x4633('0x9d')](_0x37cb38,_0x2691e1[_0x4633('0xa1')]);};AGIVertices[_0x4633('0x11')]['isConfigured']=function(_0x5a9823){return _0x5a9823&&_0x5a9823!=='0'&&_0x5a9823!=='-1'&&_0x5a9823!=='';};AGIVertices[_0x4633('0x11')][_0x4633('0xa2')]=function(_0x297ff9){this[_0x4633('0x35')][_0x4633('0x69')](this,_0x297ff9,'-');_0x297ff9['retry']=_0x297ff9[_0x4633('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x4633('0xa3')]=function(_0x1c9335){logger['info'](util['format'](_0x4633('0xa4'),_0x1c9335[_0x4633('0xa5')]));if(!this['isConfigured'](_0x1c9335[_0x4633('0x57')])){return this['channel']['noop']('no\x20text\x20configured');}var _0xd663ef='\x22'+_0x1c9335[_0x4633('0x57')]+'\x22';if(this[_0x4633('0x80')](_0x1c9335[_0x4633('0x74')])){_0xd663ef+=','+_0x1c9335[_0x4633('0x74')];}var _0x588ac7=this[_0x4633('0xf')][_0x4633('0x53')](_0x4633('0xa6'),_0xd663ef);if(_0x588ac7[_0x4633('0xa7')]===-0x1){return _0x588ac7;}return this[_0x4633('0xf')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0xd663ef));};AGIVertices[_0x4633('0x11')]['mrcprecog']=function(_0x7357e1){logger[_0x4633('0x2f')](util[_0x4633('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x7357e1[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x7357e1[_0x4633('0xa8')])){return this[_0x4633('0xf')]['noop'](_0x4633('0xa9'));}var _0x564f85=_0x7357e1['grammar'];if(this[_0x4633('0x80')](_0x7357e1['options'])){_0x564f85+=','+_0x7357e1[_0x4633('0x74')];}var _0x4d5257=this['channel']['exec'](_0x4633('0xaa'),_0x564f85);if(_0x4d5257[_0x4633('0xa7')]===-0x1){return _0x4d5257;}var _0x260258=this[_0x4633('0x9f')](_0x4633('0xab'),_0x4633('0xac'));if(_0x260258[_0x4633('0xa7')]===-0x1){return _0x260258;}var _0x2f45e1=this[_0x4633('0x9f')](_0x4633('0xad'),_0x4633('0xae'));if(_0x2f45e1[_0x4633('0xa7')]===-0x1){return _0x2f45e1;}var _0x590d2c=this[_0x4633('0x9f')](_0x4633('0xaf'),_0x4633('0xb0'));if(_0x590d2c[_0x4633('0xa7')]===-0x1){return _0x590d2c;}return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x564f85));};AGIVertices[_0x4633('0x11')]['agi']=function(_0x3915a2){logger[_0x4633('0x2f')](util[_0x4633('0x2a')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3915a2['label']));return this[_0x4633('0xf')]['agi']([_0x3915a2['command'],_0x3915a2[_0x4633('0xb2')]]);};AGIVertices['prototype']['answer']=function(_0x25732f){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0xb3'),_0x25732f[_0x4633('0xa5')]));if(this[_0x4633('0x80')](_0x25732f['timeout'])){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0xb4'),_0x25732f[_0x4633('0x62')]));var _0x4cd748=this[_0x4633('0xf')][_0x4633('0xb5')](_0x25732f['timeout']);if(_0x4cd748[_0x4633('0xa7')]===-0x1){return _0x4cd748;}}return this[_0x4633('0xf')]['answer']();};AGIVertices[_0x4633('0x11')][_0x4633('0x46')]=function(_0x61768d){logger['info'](util[_0x4633('0x2a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x61768d[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x61768d[_0x4633('0xb6')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x61768d,'no\x20list\x20selected');}_0x61768d['scheduledAt']=moment();if(this[_0x4633('0x80')](_0x61768d[_0x4633('0xb7')])){_0x61768d[_0x4633('0x45')]=moment()[_0x4633('0xb8')](_0x61768d[_0x4633('0xb7')],_0x4633('0xb9'));}if(!this[_0x4633('0x80')](_0x61768d['callback_priority'])){_0x61768d[_0x4633('0x49')]=0x2;}this[_0x4633('0x40')][_0x4633('0x69')](this,_0x61768d);return this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x61768d[_0x4633('0x44')],_0x61768d[_0x4633('0xb6')],_0x61768d[_0x4633('0x45')]));};AGIVertices['prototype'][_0x4633('0xba')]=function(_0x236cb){logger[_0x4633('0x2f')](util['format'](_0x4633('0xbb'),_0x236cb['label']));var _0x475e89=this['channel'][_0x4633('0x53')](_0x236cb[_0x4633('0xbc')],_0x236cb['options']);if(_0x475e89['result']===-0x1){return _0x475e89;}return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xbd'),_0x236cb[_0x4633('0xbc')],_0x236cb['options']));};AGIVertices['prototype'][_0x4633('0xbe')]=function(_0x576589){logger[_0x4633('0x2f')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x576589[_0x4633('0xa5')]));if(!this['isConfigured'](_0x576589[_0x4633('0x57')])){return this[_0x4633('0xf')][_0x4633('0xb1')]('no\x20text\x20configured');}var _0x41ebf3='\x22'+_0x576589[_0x4633('0x57')]+'\x22';if(this['isConfigured'](_0x576589[_0x4633('0x74')])){_0x41ebf3+=','+_0x576589[_0x4633('0x74')];}var _0x36e793=this[_0x4633('0xf')]['exec'](_0x4633('0xa6'),_0x41ebf3);if(_0x36e793['result']===-0x1){return _0x36e793;}return this['channel']['noop'](util[_0x4633('0x2a')](_0x4633('0xbf'),_0x41ebf3));};AGIVertices[_0x4633('0x11')][_0x4633('0xc0')]=function(_0x53d2d8){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0xc1'),_0x53d2d8[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x53d2d8['text'])){return this[_0x4633('0xf')][_0x4633('0xb1')]('no\x20text\x20configured');}var _0x367ab5='\x22'+_0x53d2d8[_0x4633('0x57')]+'\x22';if(this[_0x4633('0x80')](_0x53d2d8[_0x4633('0x74')])){_0x367ab5+=','+_0x53d2d8[_0x4633('0x74')];}var _0x584adc=this[_0x4633('0xf')]['exec'](_0x4633('0xa6'),_0x367ab5);if(_0x584adc[_0x4633('0xa7')]===-0x1){return _0x584adc;}return this[_0x4633('0xf')]['noop'](util[_0x4633('0x2a')](_0x4633('0xbf'),_0x367ab5));};AGIVertices[_0x4633('0x11')][_0x4633('0xc2')]=function(_0x3a20ae){logger['info'](util[_0x4633('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x3a20ae[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x3a20ae[_0x4633('0xa8')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0xa9'));}var _0x3a5164=_0x3a20ae[_0x4633('0xa8')];if(this[_0x4633('0x80')](_0x3a20ae[_0x4633('0x74')])){_0x3a5164+=','+_0x3a20ae[_0x4633('0x74')];}var _0x4886a7=this['channel'][_0x4633('0x53')](_0x4633('0xaa'),_0x3a5164);if(_0x4886a7[_0x4633('0xa7')]===-0x1){return _0x4886a7;}var _0x4f17c4=this[_0x4633('0x9f')](_0x4633('0xab'),_0x4633('0xc3'));if(_0x4f17c4['result']===-0x1){return _0x4f17c4;}var _0x592020=this[_0x4633('0x9f')](_0x4633('0xad'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x592020[_0x4633('0xa7')]===-0x1){return _0x592020;}var _0x499a8d=this[_0x4633('0x9f')](_0x4633('0xaf'),'LUMENVOX_ASR_INSTANCE');if(_0x499a8d[_0x4633('0xa7')]===-0x1){return _0x499a8d;}return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xc4'),_0x3a5164));};AGIVertices[_0x4633('0x11')][_0x4633('0xc5')]=function(_0x149a19){logger[_0x4633('0x2f')](util[_0x4633('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x149a19[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x149a19[_0x4633('0xa8')])){return this[_0x4633('0xf')][_0x4633('0xb1')]('no\x20grammar\x20configured');}var _0x51e4c3=_0x149a19[_0x4633('0xa8')];if(this[_0x4633('0x80')](_0x149a19[_0x4633('0x74')])){_0x51e4c3+=','+_0x149a19[_0x4633('0x74')];}var _0x179b4d=this['channel']['exec'](_0x4633('0xaa'),_0x51e4c3);if(_0x179b4d[_0x4633('0xa7')]===-0x1){return _0x179b4d;}var _0x208f67=this['getAndSetVariable'](_0x4633('0xab'),'SESTEK_ASR_CONFIDENCE');if(_0x208f67[_0x4633('0xa7')]===-0x1){return _0x208f67;}var _0x3d6664=this[_0x4633('0x9f')](_0x4633('0xad'),_0x4633('0xc6'));if(_0x3d6664[_0x4633('0xa7')]===-0x1){return _0x3d6664;}var _0x116a6b=this[_0x4633('0x9f')]('RECOG_INSTANCE()',_0x4633('0xc7'));if(_0x116a6b['result']===-0x1){return _0x116a6b;}return this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xc4'),_0x51e4c3));};AGIVertices[_0x4633('0x11')]['database']=function(_0x299d6c){logger['info'](util[_0x4633('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x299d6c[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x299d6c['odbc_id'])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x299d6c,_0x4633('0xc8'));}var _0x46f774=this[_0x4633('0xc9')][_0x4633('0x69')](this,_0x299d6c[_0x4633('0xca')]);if(!_0x46f774){return this[_0x4633('0xf')]['error'](_0x299d6c,'no\x20odbc\x20database\x20found');}if(!this[_0x4633('0x80')](_0x299d6c['query'])){return this[_0x4633('0xf')]['error'](_0x299d6c,_0x4633('0xcb'));}var _0x231b74=_0x299d6c[_0x4633('0xcc')][_0x4633('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4633('0xf')]['noop'](util[_0x4633('0x2a')](_0x4633('0xcd'),_0x231b74));var _0x3a88a3=this['getQueryOdbc'][_0x4633('0x69')](this,_0x46f774,_0x231b74);this[_0x4633('0x35')][_0x4633('0x69')](this,_0x299d6c,_0x231b74);if(!this[_0x4633('0x80')](_0x299d6c[_0x4633('0xce')])){return this['channel']['noop'](_0x4633('0xcf'));}var _0x14a5d3=this['getVariable'][_0x4633('0x69')](this,_0x299d6c[_0x4633('0xce')]);if(!_0x14a5d3){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x299d6c,'no\x20variable\x20found');}var _0x3d9a23=this;_0x3a88a3[_0x4633('0xd0')](function(_0x190bc3,_0x4af377){Object[_0x4633('0xd1')](_0x190bc3)['forEach'](function(_0x3187b4){_0x3d9a23['channel']['setVariable'](util['format'](_0x4633('0xd2'),_0x14a5d3,_0x4af377,_0x3187b4),_0x190bc3[_0x3187b4]);});});this[_0x4633('0xf')]['setVariable'](util[_0x4633('0x2a')]('%s_ROWS_COUNT',_0x14a5d3),_0x3a88a3[_0x4633('0x98')]);return this[_0x4633('0xf')]['noop'](util[_0x4633('0x2a')](_0x4633('0xd3'),_0x14a5d3));};AGIVertices[_0x4633('0x11')]['dial']=function(_0x415e13){logger[_0x4633('0xd4')](util[_0x4633('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x415e13['label']));if(!this[_0x4633('0x80')](_0x415e13['sip_id'])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x415e13,_0x4633('0xd5'));}var _0x24021e=this[_0x4633('0x1a')][_0x4633('0x69')](this,_0x415e13[_0x4633('0xd6')]);if(!_0x24021e){return this['channel']['error'](_0x415e13,_0x4633('0xd7'));}var _0x289899=this['channel']['exec'](_0x4633('0xd8'),[util[_0x4633('0x2a')](_0x4633('0xd9'),_0x24021e),_0x415e13[_0x4633('0x62')],_0x415e13['opts'],_0x415e13[_0x4633('0x60')]]);if(_0x289899[_0x4633('0xa7')]===-0x1){return _0x289899;}return this[_0x4633('0xf')]['noop'](util[_0x4633('0x2a')](_0x4633('0xda'),_0x4633('0xd8')));};AGIVertices[_0x4633('0x11')][_0x4633('0xdb')]=function(_0x812def){logger['info'](util[_0x4633('0x2a')](_0x4633('0xdc'),_0x812def['label']));if(!this['isConfigured'](_0x812def[_0x4633('0x7b')])){return this[_0x4633('0xf')]['noop'](_0x4633('0xdd'));}if(!this['isConfigured'](_0x812def[_0x4633('0x57')])){return this['channel'][_0x4633('0xb1')](_0x4633('0xde'));}this[_0x4633('0xf')][_0x4633('0xdf')]=!![];this[_0x4633('0x35')](_0x812def);this[_0x4633('0x3f')](_0x812def['text'],'in','','');this[_0x4633('0xf')]['noop'](util[_0x4633('0x2a')](_0x4633('0xe0'),_0x812def[_0x4633('0x57')]));var _0x515e31=this[_0x4633('0x75')][_0x4633('0x69')](this,_0x812def);if(_0x515e31){for(var _0x46fca5 in _0x515e31){if(_0x515e31[_0x4633('0x93')](_0x46fca5)){this[_0x4633('0xf')][_0x4633('0x9d')](util[_0x4633('0x2a')](_0x4633('0xe1'),_0x46fca5[_0x4633('0xe2')]()),_0x515e31[_0x46fca5]);}}this[_0x4633('0x3f')](_0x515e31[_0x4633('0xe3')],_0x4633('0xe4'),_0x4633('0xdb'),'');return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xe5'),_0x515e31[_0x4633('0xe3')]));}return this[_0x4633('0xf')][_0x4633('0x2d')](_0x812def,_0x4633('0xe6'));};AGIVertices[_0x4633('0x11')][_0x4633('0xe7')]=function(_0x36be6a){logger[_0x4633('0x2f')](util['format'](_0x4633('0xe8'),_0x36be6a[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x36be6a['dialogflowV2_project_id'])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0xe9'));}if(!this['isConfigured'](_0x36be6a[_0x4633('0x78')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0xea'));}if(!this[_0x4633('0x80')](_0x36be6a[_0x4633('0xeb')])){return this['channel'][_0x4633('0xb1')](_0x4633('0xec'));}if(!this[_0x4633('0x80')](_0x36be6a[_0x4633('0x79')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0xed'));}if(!this['isConfigured'](_0x36be6a[_0x4633('0x57')])){return this[_0x4633('0xf')]['noop']('no\x20text\x20configured');}this[_0x4633('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x36be6a);this[_0x4633('0x3f')](_0x36be6a[_0x4633('0x57')],'in','','');this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xee'),_0x36be6a['text']));var _0x5f505c=this['googleDialogflowV2'][_0x4633('0x69')](this,_0x36be6a);if(_0x5f505c){for(var _0x3bd908 in _0x5f505c){if(_0x5f505c[_0x4633('0x93')](_0x3bd908)){if(_0x3bd908!==_0x4633('0xef')){this[_0x4633('0xf')][_0x4633('0x9d')](util[_0x4633('0x2a')](_0x4633('0xe1'),_0x3bd908[_0x4633('0xe2')]()),_0x5f505c[_0x3bd908]);}}}this[_0x4633('0x3f')](_0x5f505c[_0x4633('0xe3')],'out','dialogflowV2',_0x5f505c[_0x4633('0xef')]);return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')]('DialogflowV2\x20Result\x20%s',_0x5f505c[_0x4633('0xe3')]));}return this[_0x4633('0xf')][_0x4633('0x2d')](_0x36be6a,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x4633('0x11')][_0x4633('0xf0')]=function(_0x29f30e){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0xf1'),_0x29f30e[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x29f30e[_0x4633('0xf2')])){return this[_0x4633('0xf')]['noop'](_0x4633('0xf3'));}if(!this[_0x4633('0x80')](_0x29f30e[_0x4633('0xf4')])){return this[_0x4633('0xf')]['noop'](_0x4633('0xf5'));}if(!this['isConfigured'](_0x29f30e['password'])){return this[_0x4633('0xf')]['noop'](_0x4633('0xf6'));}if(!this[_0x4633('0x80')](_0x29f30e[_0x4633('0xf7')])){return this['channel'][_0x4633('0xb1')](_0x4633('0xde'));}this['channel'][_0x4633('0xdf')]=!![];this[_0x4633('0x35')](_0x29f30e);this['createSquareMessage'](_0x29f30e[_0x4633('0x57')],'in','','');this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xf8'),_0x29f30e[_0x4633('0x57')]));var _0x3b5d34=this[_0x4633('0xf9')][_0x4633('0x69')](this,_0x29f30e);if(_0x3b5d34){for(var _0x811aea in _0x3b5d34){if(_0x3b5d34['hasOwnProperty'](_0x811aea)){this[_0x4633('0xf')]['setVariable'](util['format'](_0x4633('0xfa'),_0x811aea[_0x4633('0xe2')]()),_0x3b5d34[_0x811aea]);}}this[_0x4633('0x3f')](_0x3b5d34[_0x4633('0xe3')],_0x4633('0xe4'),_0x4633('0xf0'),'');if(_0x3b5d34['audiofile']){this[_0x4633('0xf')]['noop'](util['format'](_0x4633('0xfb'),_0x3b5d34[_0x4633('0xfc')]));var _0x3e12aa=this[_0x4633('0xf')]['streamFile'](_0x3b5d34[_0x4633('0xfc')]);try{fs['unlink'](_0x3b5d34[_0x4633('0xfc')]+'.wav');}catch(_0x23b3ad){logger[_0x4633('0x2d')](_0x23b3ad);}return _0x3e12aa;}else{return this[_0x4633('0xf')]['noop'](util['format']('SestekNDA\x20Result\x20%s',_0x3b5d34[_0x4633('0xe3')]));}}return this[_0x4633('0xf')]['error'](_0x29f30e,_0x4633('0xfd'));};AGIVertices[_0x4633('0x11')][_0x4633('0xfe')]=function(_0x39a371){logger[_0x4633('0x2f')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x39a371[_0x4633('0xa5')]));return this['channel'][_0x4633('0xb1')]('end');};AGIVertices[_0x4633('0x11')][_0x4633('0xff')]=function(_0x1d800b){logger[_0x4633('0x2f')](util['format'](_0x4633('0x100'),_0x1d800b[_0x4633('0xa5')]));var _0x4c0a98='';if(_0x1d800b['trunk_id']){if(!this[_0x4633('0x80')](_0x1d800b['trunk_id'])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x1d800b,_0x4633('0x101'));}else{var _0x557661=parseInt(_0x1d800b[_0x4633('0x102')],0xa);if(isNaN(_0x557661)){_0x4c0a98=_0x1d800b[_0x4633('0x102')];}else{_0x4c0a98=this['getTrunk'][_0x4633('0x69')](this,_0x1d800b[_0x4633('0x102')]);if(!_0x4c0a98){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x1d800b,_0x4633('0x103'));}}}}else if(_0x1d800b[_0x4633('0x104')]){_0x4c0a98=_0x1d800b['trunk_name'];}else{return this['channel'][_0x4633('0x2d')](_0x1d800b,'no\x20trunk\x20selected');}var _0x57f732=this[_0x4633('0xf')][_0x4633('0x53')](_0x4633('0xd8'),[util[_0x4633('0x2a')](_0x4633('0x105'),_0x4c0a98,_0x1d800b[_0x4633('0x44')]),_0x1d800b['timeout'],_0x1d800b['opts'],_0x1d800b['url']]);if(_0x57f732[_0x4633('0xa7')]===-0x1){return _0x57f732;}return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xda'),'DIAL'));};AGIVertices[_0x4633('0x11')][_0x4633('0x106')]=function(_0x274e5f){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x107'),_0x274e5f[_0x4633('0xa5')]));return this['channel'][_0x4633('0xb1')](_0x4633('0x106'));};AGIVertices[_0x4633('0x11')][_0x4633('0x108')]=function(_0x13dd2c){logger[_0x4633('0x2f')](util['format'](_0x4633('0x109'),_0x13dd2c[_0x4633('0xa5')]));if(_0x13dd2c[_0x4633('0x10a')]===0x0){return this['maxRetry'](_0x13dd2c);}_0x13dd2c[_0x4633('0x10a')]-=0x1;if(!this[_0x4633('0x80')](_0x13dd2c[_0x4633('0x10b')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x13dd2c,'no\x20file\x20audio\x20selected');}var _0x1f4843=this['getSound'][_0x4633('0x69')](this,_0x13dd2c[_0x4633('0x10b')]);if(!_0x1f4843){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x13dd2c,_0x4633('0x10c'));}if(!this[_0x4633('0x80')](_0x13dd2c['variable_id'])){return this['channel'][_0x4633('0x2d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x483a1f=this[_0x4633('0xf')][_0x4633('0x10d')](_0x1f4843,_0x13dd2c[_0x4633('0x10e')],_0x13dd2c['maxdigit']);var _0x103a07=_0x483a1f[_0x4633('0xa7')]?_0x483a1f[_0x4633('0xa7')][_0x4633('0x48')]():'';logger[_0x4633('0x2f')](_0x4633('0x10f'),JSON[_0x4633('0x6d')](_0x483a1f));if(_0x483a1f[_0x4633('0xa7')]===-0x1){this['createSquareDetailsReport'][_0x4633('0x69')](this,_0x13dd2c,_0x103a07);return _0x483a1f;}else if(_0x483a1f['extra']==='timeout'){_0x483a1f[_0x4633('0xa7')]=_0x103a07[_0x4633('0x98')]>=parseInt(_0x13dd2c['mindigit'])?'x':'i';}else{_0x483a1f['result']=_0x103a07[_0x4633('0x98')]>=parseInt(_0x13dd2c[_0x4633('0x110')])&&_0x103a07[_0x4633('0x98')]<=parseInt(_0x13dd2c[_0x4633('0x111')])?'x':'i';}var _0x3218a7=this['getVariable'][_0x4633('0x69')](this,_0x13dd2c[_0x4633('0xce')]);if(!_0x3218a7){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x13dd2c,_0x4633('0x112'));}this[_0x4633('0xf')]['setVariable'](_0x3218a7,_0x103a07);if(this['isConfigured'](_0x13dd2c[_0x4633('0x113')])){var _0x2c9242=parseInt(_0x13dd2c[_0x4633('0x113')],0xa);var _0x2536ad=rs[_0x4633('0x114')]({'charset':'*','length':_0x2c9242});var _0x4e13d6=_0x103a07[_0x4633('0x98')];if(_0x4e13d6>0x0){if(_0x4e13d6>_0x2c9242){this[_0x4633('0x35')][_0x4633('0x69')](this,_0x13dd2c,_0x13dd2c['hiddendigitspos']===_0x4633('0x115')?_0x2536ad+_0x103a07[_0x4633('0x116')](_0x2c9242):_0x103a07[_0x4633('0x116')](0x0,_0x4e13d6-_0x2c9242)+_0x2536ad);}else{this[_0x4633('0x35')][_0x4633('0x69')](this,_0x13dd2c,rs[_0x4633('0x114')]({'charset':'*','length':_0x4e13d6}));}}else{this[_0x4633('0x35')][_0x4633('0x69')](this,_0x13dd2c,'');}}else{this[_0x4633('0x35')]['sync'](this,_0x13dd2c,_0x103a07);}return _0x483a1f;};AGIVertices[_0x4633('0x11')][_0x4633('0xe')]=function(_0x36c92e){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x117'),_0x36c92e[_0x4633('0xa5')]));return this['getdigits'](_0x36c92e);};AGIVertices[_0x4633('0x11')][_0x4633('0x118')]=function(_0x1d5adf){logger[_0x4633('0x2f')](util['format'](_0x4633('0x119'),_0x1d5adf[_0x4633('0xa5')]));this['createSquareDetailsReport'][_0x4633('0x69')](this,_0x1d5adf,_0x1d5adf[_0x4633('0x11a')]);return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')]('GOAL\x20%s',_0x1d5adf[_0x4633('0x11a')]));};AGIVertices[_0x4633('0x11')]['awspolly']=function(_0x2eff9f){logger[_0x4633('0x2f')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2eff9f[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x2eff9f[_0x4633('0x89')])||!this[_0x4633('0x80')](_0x2eff9f[_0x4633('0x83')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0x11b'));}if(!this['isConfigured'](_0x2eff9f[_0x4633('0x57')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0xde'));}this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0x2eff9f['text']));var _0xd60f08=this[_0x4633('0x82')][_0x4633('0x69')](this,_0x2eff9f);if(_0xd60f08){this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x11c'),_0xd60f08));var _0x40ccba=this[_0x4633('0xf')][_0x4633('0x11d')](_0xd60f08);try{fs['unlink'](_0xd60f08+_0x4633('0x11e'));}catch(_0x3116af){logger[_0x4633('0x2d')](_0x3116af);}return _0x40ccba;}return this[_0x4633('0xf')]['error'](_0x2eff9f,_0x4633('0x11f'));};AGIVertices[_0x4633('0x11')][_0x4633('0x120')]=function(_0x6398d4){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x121'),_0x6398d4[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x6398d4[_0x4633('0x89')])||!this['isConfigured'](_0x6398d4[_0x4633('0x83')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0x11b'));}if(!this[_0x4633('0x80')](_0x6398d4[_0x4633('0x8a')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0x122'));}if(!this[_0x4633('0x80')](_0x6398d4[_0x4633('0x57')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0xde'));}this[_0x4633('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x6398d4);this[_0x4633('0x3f')](_0x6398d4[_0x4633('0x57')],'in','','');this['channel'][_0x4633('0xb1')](util['format'](_0x4633('0x123'),_0x6398d4[_0x4633('0x57')]));var _0x4ea9fa=this[_0x4633('0x88')]['sync'](this,_0x6398d4);if(_0x4ea9fa){for(var _0x338b33 in _0x4ea9fa){if(_0x4ea9fa[_0x4633('0x93')](_0x338b33)&&_['isString'](_0x4ea9fa[_0x338b33])){this[_0x4633('0xf')]['setVariable'](util[_0x4633('0x2a')]('AWS_LEX_%s',_0x338b33[_0x4633('0xe2')]()),_0x4ea9fa[_0x338b33]);}}if(_[_0x4633('0x43')](_0x4ea9fa['message'])){return this[_0x4633('0xf')][_0x4633('0xb1')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x4633('0x3f')](_0x4ea9fa[_0x4633('0x72')],_0x4633('0xe4'),_0x4633('0x124'),'');return this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x125'),_0x4ea9fa[_0x4633('0x72')]));}}return this[_0x4633('0xf')][_0x4633('0x2d')](_0x6398d4,_0x4633('0x126'));};AGIVertices[_0x4633('0x11')][_0x4633('0x127')]=function(_0x3279be){logger['info'](util[_0x4633('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x3279be['label'],_0x3279be[_0x4633('0x62')]));if(!this['isConfigured'](_0x3279be[_0x4633('0x7b')])){return this['channel'][_0x4633('0xb1')](_0x4633('0xdd'));}var _0x1a7fe9=_0x4633('0x128');var _0x553b1b=util['format'](_0x4633('0x129'),FILES_PATH,rs[_0x4633('0x114')](0x4));var _0x20c9d6=util[_0x4633('0x2a')](_0x4633('0x9c'),_0x553b1b,_0x1a7fe9);var _0x5a43db=!![];if(_0x3279be[_0x4633('0x12a')]==='NOBEEP'){_0x5a43db=![];}var _0x160ef=this['channel'][_0x4633('0x12b')](_0x553b1b,_0x1a7fe9,_0x3279be['intKey'],_0x3279be[_0x4633('0x62')],undefined,_0x5a43db);if(_0x160ef['result']!==-0x1){this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x12c'),_0x20c9d6));var _0x2afd0a=this[_0x4633('0x8b')][_0x4633('0x69')](this,_0x3279be,_0x20c9d6);if(_0x2afd0a){for(var _0xb82de1 in _0x2afd0a){if(_0x2afd0a[_0x4633('0x93')](_0xb82de1)){this['channel'][_0x4633('0x9d')](util[_0x4633('0x2a')](_0x4633('0x12d'),_0xb82de1[_0x4633('0xe2')]()),_0x2afd0a[_0xb82de1]);}}return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')]('GoogleASR\x20Result\x20%s',JSON[_0x4633('0x6d')](_0x2afd0a)));}}return _0x160ef;};AGIVertices[_0x4633('0x11')][_0x4633('0x12e')]=function(_0x58da67){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x12f'),_0x58da67['label']));if(!this[_0x4633('0x80')](_0x58da67[_0x4633('0x8e')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0x130'));}if(!this[_0x4633('0x80')](_0x58da67['appsecret'])){return this['channel'][_0x4633('0xb1')](_0x4633('0x131'));}var _0x11eaef='wav';var _0x33ce0c=util[_0x4633('0x2a')](_0x4633('0x129'),FILES_PATH,rs['generate'](0x4));var _0x33a90b=util[_0x4633('0x2a')](_0x4633('0x9c'),_0x33ce0c,_0x11eaef);var _0x408a0e=!![];if(_0x58da67[_0x4633('0x12a')]==='NOBEEP'){_0x408a0e=![];}var _0x2d3ddc=this[_0x4633('0xf')]['recordFile'](_0x33ce0c,_0x11eaef,_0x58da67[_0x4633('0x132')],_0x58da67[_0x4633('0x62')],undefined,_0x408a0e);if(_0x2d3ddc[_0x4633('0xa7')]!==-0x1){this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x133'),_0x33a90b));var _0x5be346=this['tildeASR']['sync'](this,_0x58da67,_0x33a90b);if(_0x5be346){for(var _0x439fd1 in _0x5be346){if(_0x5be346[_0x4633('0x93')](_0x439fd1)){this[_0x4633('0xf')]['setVariable'](util['format'](_0x4633('0x134'),_0x439fd1[_0x4633('0xe2')]()),_0x5be346[_0x439fd1]);}}return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x135'),JSON['stringify'](_0x5be346)));}}return _0x2d3ddc;};AGIVertices[_0x4633('0x11')][_0x4633('0x136')]=function(_0x32cacf){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x137'),_0x32cacf[_0x4633('0xa5')]));return this['channel'][_0x4633('0x138')](_0x32cacf['context'],_0x32cacf['extension'],_0x32cacf[_0x4633('0x3b')]);};AGIVertices[_0x4633('0x11')]['gotoif']=function(_0x4fae3e){logger['info'](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4fae3e[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x4fae3e[_0x4633('0x139')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x4fae3e,_0x4633('0x13a'));}try{var _0x1ae953=eval(_0x4fae3e['condition'])?_0x4633('0x13b'):_0x4633('0x13c');this['channel'][_0x4633('0xb1')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x4fae3e[_0x4633('0x139')],_0x1ae953));return{'code':0xc8,'result':_0x1ae953};}catch(_0x53a863){return{'code':0xc8,'result':_0x4633('0x13c')};}};AGIVertices['prototype'][_0x4633('0x13d')]=function(_0x237a1d){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x13e'),_0x237a1d['label']));if(!this[_0x4633('0x80')](_0x237a1d['interval_id'])){return this['channel'][_0x4633('0x2d')](_0x237a1d,'no\x20interval\x20configured');}var _0x536b83=this['getIntervals'][_0x4633('0x69')](this,_0x237a1d[_0x4633('0x13f')]);if(!_0x536b83){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x237a1d,'no\x20intervals\x20found');}for(var _0x4fba82=0x0;_0x4fba82<_0x536b83['length'];_0x4fba82+=0x1){var _0x2447ce=this[_0x4633('0xf')][_0x4633('0x12')](util['format'](_0x4633('0x140'),_0x536b83[_0x4fba82]));if(_0x2447ce[_0x4633('0xa7')]===-0x1){return _0x2447ce;}logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x141'),_0x536b83[_0x4fba82],_0x2447ce['extra']));if(_0x2447ce[_0x4633('0xa1')]===_0x4633('0x13b')){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x141'),_0x536b83[_0x4fba82],_0x4633('0x13b')));this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x141'),_0x536b83[_0x4fba82],_0x4633('0x13b')));return{'code':0xc8,'result':_0x4633('0x13b')};}else{logger[_0x4633('0x2f')](util[_0x4633('0x2a')]('IFTIME\x20%s\x20%s',_0x536b83[_0x4fba82],_0x4633('0x13c')));this['channel']['noop'](util[_0x4633('0x2a')](_0x4633('0x141'),_0x536b83[_0x4fba82],_0x4633('0x13c')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x4633('0x11')]['hangup']=function(_0x340afd){logger['info'](util[_0x4633('0x2a')](_0x4633('0x142'),_0x340afd[_0x4633('0xa5')]));return this[_0x4633('0xf')][_0x4633('0x143')]();};AGIVertices[_0x4633('0x11')][_0x4633('0x144')]=function(_0x167a8a){logger[_0x4633('0x2f')](util['format'](_0x4633('0x145'),_0x167a8a['label']));if(!this[_0x4633('0x80')](_0x167a8a[_0x4633('0x7b')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0xdd'));}var _0xc92fb=_0x4633('0x128');var _0x4ad94e=util[_0x4633('0x2a')](_0x4633('0x129'),FILES_PATH,rs[_0x4633('0x114')](0x4));var _0x4b00bd=util[_0x4633('0x2a')]('%s.%s',_0x4ad94e,_0xc92fb);var _0x1f42fc=!![];if(_0x167a8a[_0x4633('0x12a')]===_0x4633('0x146')){_0x1f42fc=![];}var _0x269829=this[_0x4633('0xf')][_0x4633('0x12b')](_0x4ad94e,_0xc92fb,_0x167a8a[_0x4633('0x132')],_0x167a8a[_0x4633('0x62')],undefined,_0x1f42fc);if(_0x269829[_0x4633('0xa7')]!==-0x1){this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x147'),_0x4b00bd));var _0x3084a0=this[_0x4633('0x7e')][_0x4633('0x69')](this,_0x167a8a,_0x4b00bd);if(_0x3084a0){for(var _0x3ed3f1 in _0x3084a0){if(_0x3084a0[_0x4633('0x93')](_0x3ed3f1)){this['channel']['setVariable'](util['format']('ISPEECH_ASR_%s',_0x3ed3f1['toUpperCase']()),_0x3084a0[_0x3ed3f1]);}}return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x148'),JSON['stringify'](_0x3084a0)));}}return _0x269829;};AGIVertices[_0x4633('0x11')]['ispeechtts']=function(_0x4c3198){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x149'),_0x4c3198[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x4c3198[_0x4633('0x7b')])){return this[_0x4633('0xf')]['noop'](_0x4633('0xdd'));}if(!this[_0x4633('0x80')](_0x4c3198[_0x4633('0x57')])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0xde'));}this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x14a'),_0x4c3198[_0x4633('0x57')]));var _0x38157f=this[_0x4633('0x7a')]['sync'](this,_0x4c3198);if(_0x38157f){this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x147'),_0x38157f));var _0xb346b5=this[_0x4633('0xf')]['streamFile'](_0x38157f,_0x4c3198[_0x4633('0x132')]);try{fs['unlink'](_0x38157f+_0x4633('0x11e'));}catch(_0x15ff75){logger[_0x4633('0x2d')](_0x15ff75);}return _0xb346b5;}return this[_0x4633('0xf')][_0x4633('0x2d')](_0x4c3198,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4633('0x11')][_0x4633('0x14b')]=function(_0x4b843b){logger['info'](util['format'](_0x4633('0x14c'),_0x4b843b[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x4b843b[_0x4633('0x14d')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x4b843b,_0x4633('0x14e'));}logger[_0x4633('0x2f')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x4633('0x39')],_0x4b843b['findBy']));var _0x10c3a8=this[_0x4633('0x14f')][_0x4633('0x69')](this,_0x4b843b[_0x4633('0x14d')]);if(_0x10c3a8){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x150'),this[_0x4633('0xf')]['callerid'],_0x4b843b[_0x4633('0x14d')]));this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x150'),this['channel'][_0x4633('0x39')],_0x4b843b[_0x4633('0x14d')]));return{'code':0xc8,'result':_0x4633('0x151')};}else{logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x152'),this['channel']['callerid'],_0x4b843b[_0x4633('0x14d')]));this[_0x4633('0xf')]['noop'](util['format'](_0x4633('0x152'),this['channel'][_0x4633('0x39')],_0x4b843b[_0x4633('0x14d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4633('0x11')]['logout']=function(_0x3522ee){logger['info'](util[_0x4633('0x2a')](_0x4633('0x153'),_0x3522ee[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x3522ee[_0x4633('0x14d')])){return this['channel'][_0x4633('0x2d')](_0x3522ee,_0x4633('0x14e'));}logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x154'),this['channel'][_0x4633('0x39')],_0x3522ee['findBy']));var _0x3ef7d8=this[_0x4633('0x4f')][_0x4633('0x69')](this,_0x3522ee[_0x4633('0x14d')]);if(_0x3ef7d8){logger[_0x4633('0x2f')](util[_0x4633('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x4633('0x39')],_0x3522ee[_0x4633('0x14d')]));this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4633('0xf')]['callerid'],_0x3522ee[_0x4633('0x14d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x152'),this[_0x4633('0xf')][_0x4633('0x39')],_0x3522ee[_0x4633('0x14d')]));this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x152'),this['channel'][_0x4633('0x39')],_0x3522ee[_0x4633('0x14d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x1b0114){logger['info'](util[_0x4633('0x2a')](_0x4633('0x155'),_0x1b0114[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x1b0114[_0x4633('0x156')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x1b0114,_0x4633('0x157'));}this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x158'),_0x1b0114[_0x4633('0x156')]));var _0x45220c=eval(_0x1b0114[_0x4633('0x156')]);if(!this['isConfigured'](_0x1b0114[_0x4633('0xce')])){return this['channel']['noop'](_0x4633('0xcf'));}var _0x11a34d=this[_0x4633('0x12')][_0x4633('0x69')](this,_0x1b0114[_0x4633('0xce')]);if(!_0x11a34d){return this['channel'][_0x4633('0x2d')](_0x1b0114,_0x4633('0x112'));}if(_[_0x4633('0x97')](_0x45220c)){var _0x545baa=this;_0x45220c['forEach'](function(_0x418f07,_0x5c9be4){_0x545baa[_0x4633('0xf')][_0x4633('0x9d')](util[_0x4633('0x2a')](_0x4633('0x159'),_0x11a34d,_0x5c9be4),_0x418f07);});return this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x15a'),_0x11a34d));}else{return this[_0x4633('0xf')][_0x4633('0x9d')](_0x11a34d,_0x45220c);}};AGIVertices['prototype'][_0x4633('0xd')]=function(_0x4dc457){logger[_0x4633('0x2f')](util['format'](_0x4633('0x15b'),_0x4dc457['label']));if(_0x4dc457[_0x4633('0x10a')]===0x0){return this[_0x4633('0xa2')](_0x4dc457);}_0x4dc457[_0x4633('0x10a')]-=0x1;if(!this['isConfigured'](_0x4dc457[_0x4633('0x10b')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x4dc457,'no\x20file\x20audio\x20selected');}var _0x7572ed=this[_0x4633('0x1e')]['sync'](this,_0x4dc457[_0x4633('0x10b')]);if(!_0x7572ed){return this[_0x4633('0xf')]['error'](_0x4dc457,'no\x20file\x20audio\x20found');}var _0x2ed23c=this['channel'][_0x4633('0x10d')](_0x7572ed,_0x4dc457['response'],_0x4dc457[_0x4633('0x15c')]);var _0x2267a6=_0x2ed23c[_0x4633('0xa7')];if(_0x2ed23c['result']===-0x1){this[_0x4633('0x35')][_0x4633('0x69')](this,_0x4dc457,'-1');return _0x2ed23c;}else if(_0x2ed23c[_0x4633('0xa1')]===_0x4633('0x62')){_0x2ed23c['result']=_0x2ed23c[_0x4633('0xa7')][_0x4633('0x98')]>0x0?_0x2ed23c[_0x4633('0xa7')]:'t';}else if(_[_0x4633('0x41')](_0x2ed23c[_0x4633('0xa7')])){_0x2ed23c['result']='#';_0x2267a6='#';}if(!this[_0x4633('0x80')](_0x4dc457[_0x4633('0xce')])){this['channel'][_0x4633('0xb1')](_0x4633('0xcf'));}else{var _0x5d3bf5=this[_0x4633('0x12')]['sync'](this,_0x4dc457[_0x4633('0xce')]);if(!_0x5d3bf5){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x4dc457,'no\x20variable\x20found');}this['channel'][_0x4633('0x9d')](_0x5d3bf5,_0x2267a6);}this[_0x4633('0x35')][_0x4633('0x69')](this,_0x4dc457,_0x2267a6);return _0x2ed23c;};AGIVertices[_0x4633('0x11')]['noop']=function(_0x397edd){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x15d'),_0x397edd[_0x4633('0xa5')]));return this[_0x4633('0xf')][_0x4633('0xb1')](_0x397edd['output']||_0x397edd['label']);};AGIVertices[_0x4633('0x11')][_0x4633('0x15e')]=function(_0x2abf48){logger[_0x4633('0x2f')](util['format'](_0x4633('0x15f'),_0x2abf48[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x2abf48[_0x4633('0x14d')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x2abf48,_0x4633('0x14e'));}logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x154'),this[_0x4633('0xf')][_0x4633('0x39')],_0x2abf48[_0x4633('0x14d')]));var _0x2b02ce=this[_0x4633('0x4a')][_0x4633('0x69')](this,_0x2abf48[_0x4633('0x160')]);var _0x4c7754=this[_0x4633('0x4d')][_0x4633('0x69')](this,_0x2abf48[_0x4633('0x14d')],_0x2b02ce);if(_0x4c7754){logger['info'](util[_0x4633('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4633('0xf')][_0x4633('0x39')],_0x2abf48[_0x4633('0x14d')]));this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x150'),this[_0x4633('0xf')]['callerid'],_0x2abf48[_0x4633('0x14d')]));return{'code':0xc8,'result':_0x4633('0x151')};}else{logger['info'](util['format'](_0x4633('0x152'),this['channel'][_0x4633('0x39')],_0x2abf48['findBy']));this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4633('0xf')]['callerid'],_0x2abf48['findBy']));return{'code':0xc8,'result':_0x4633('0x161')};}};AGIVertices['prototype']['playback']=function(_0x3d92d6){logger[_0x4633('0x2f')](util['format'](_0x4633('0x162'),_0x3d92d6[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x3d92d6[_0x4633('0x10b')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x3d92d6,_0x4633('0x163'));}var _0x12bad1=this[_0x4633('0x1e')][_0x4633('0x69')](this,_0x3d92d6[_0x4633('0x10b')]);if(!_0x12bad1){return this['channel'][_0x4633('0x2d')](_0x3d92d6,_0x4633('0x10c'));}var _0x54bc9c=this[_0x4633('0xf')][_0x4633('0x53')](_0x4633('0x164'),[_0x12bad1,_0x3d92d6[_0x4633('0x165')]]);if(_0x54bc9c[_0x4633('0xa7')]===-0x1){return _0x54bc9c;}return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xbd'),_0x4633('0x164'),_0x12bad1));};AGIVertices[_0x4633('0x11')][_0x4633('0x166')]=function(_0x5e8790){logger['info'](util['format'](_0x4633('0x167'),_0x5e8790['label']));if(!this[_0x4633('0x80')](_0x5e8790[_0x4633('0x168')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x5e8790,_0x4633('0x169'));}var _0x315aef='';var _0x47f0b6=parseInt(_0x5e8790[_0x4633('0x168')],0xa);if(isNaN(_0x47f0b6)){_0x315aef=_0x5e8790[_0x4633('0x168')];}else{_0x315aef=this['getVoiceQueue'][_0x4633('0x69')](this,_0x5e8790[_0x4633('0x168')]);if(!_0x315aef){return this[_0x4633('0xf')]['error'](_0x5e8790,_0x4633('0x16a'));}}var _0x1bc5cc='';if(this[_0x4633('0x80')](_0x5e8790[_0x4633('0x10b')])){var _0x442c1a=this['getSound'][_0x4633('0x69')](this,_0x5e8790['file_id']);if(_0x442c1a){_0x1bc5cc=_0x442c1a;}}this[_0x4633('0x35')][_0x4633('0x69')](this,_0x5e8790,_0x315aef);if(_0x5e8790[_0x4633('0x165')][_0x4633('0x16b')]('x')<0x0){_0x5e8790[_0x4633('0x165')]+='x';}if(_0x5e8790[_0x4633('0x165')][_0x4633('0x16b')]('X')<0x0){_0x5e8790[_0x4633('0x165')]+='X';}this['channel'][_0x4633('0x9d')](_0x4633('0x16c'),_0x315aef?_0x315aef['toLowerCase']():'');var _0x51678e=this[_0x4633('0xf')][_0x4633('0x53')]('QUEUE',[_0x315aef,_0x5e8790['opts'],_0x5e8790[_0x4633('0x60')],_0x1bc5cc,_0x5e8790['timeout'],_0x5e8790[_0x4633('0x8')],_0x5e8790[_0x4633('0x16d')],_0x5e8790['gosub'],'',_0x5e8790[_0x4633('0x16e')]]);if(_0x51678e[_0x4633('0xa7')]===-0x1){return _0x51678e;}return this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xbd'),_0x4633('0x16f'),_0x315aef));};AGIVertices[_0x4633('0x11')][_0x4633('0x170')]=function(_0x352785){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x171'),_0x352785[_0x4633('0xa5')]));var _0x341e61=_0x352785[_0x4633('0x172')]||_0x4633('0x128');var _0x2f3ee3=util['format'](_0x4633('0x173'),this[_0x4633('0xf')][_0x4633('0x36')],rs[_0x4633('0x114')](0x5));var _0x547a40=util[_0x4633('0x2a')](_0x4633('0x174'),FILES_PATH,_0x2f3ee3,_0x341e61);var _0x166bad=util['format'](_0x4633('0x129'),FILES_PATH,_0x2f3ee3);this['createSquareRecording']['sync'](this,_0x352785,_0x2f3ee3,_0x547a40);this[_0x4633('0xf')][_0x4633('0x9d')](_0x4633('0x175'),_0x2f3ee3);logger[_0x4633('0x2f')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x166bad,_0x341e61,_0x352785[_0x4633('0x176')],_0x352785['timeout']);return this[_0x4633('0xf')][_0x4633('0x12b')](_0x166bad,_0x341e61,_0x352785['escape_digits'],_0x352785[_0x4633('0x62')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x39b48a){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x177'),_0x39b48a[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x39b48a[_0x4633('0x60')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x115a6b=this[_0x4633('0x5f')]['sync'](this,_0x39b48a);logger[_0x4633('0x2f')](util['format'](_0x4633('0x178'),util['inspect'](_0x115a6b,{'showHidden':![],'depth':null})));if(!this[_0x4633('0x80')](_0x39b48a[_0x4633('0xce')])){return this[_0x4633('0xf')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x444fe2=this[_0x4633('0x12')][_0x4633('0x69')](this,_0x39b48a[_0x4633('0xce')]);if(!_0x444fe2){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x39b48a,_0x4633('0x112'));}this[_0x4633('0xf')][_0x4633('0x9d')](util[_0x4633('0x2a')]('%s_STATUS_CODE',_0x444fe2),_0x115a6b[_0x4633('0x6f')]?_0x115a6b[_0x4633('0x6f')]:_0x4633('0x179'));this[_0x4633('0xf')]['setVariable'](util[_0x4633('0x2a')](_0x4633('0x17a'),_0x444fe2),_0x115a6b[_0x4633('0x70')]?_0x115a6b[_0x4633('0x70')]:'OK');if(_0x115a6b[_0x4633('0x71')]){try{this[_0x4633('0x9b')](_0x115a6b[_0x4633('0x71')],_0x444fe2);}catch(_0x31bfa6){logger['error'](util['format'](_0x4633('0x17b'),_0x444fe2));}}return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xd3'),_0x444fe2));};AGIVertices['prototype'][_0x4633('0x17c')]=function(_0x3b4c44){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x17d'),_0x3b4c44[_0x4633('0xa5')]));return this[_0x4633('0xf')][_0x4633('0x17e')](_0x3b4c44['digits'][_0x4633('0x55')](/\s+/g,''),_0x3b4c44[_0x4633('0x176')]);};AGIVertices[_0x4633('0x11')][_0x4633('0x17f')]=function(_0x300be9){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x180'),_0x300be9[_0x4633('0xa5')]));return this['channel'][_0x4633('0x181')](_0x300be9[_0x4633('0x63')]['replace'](/\s+/g,''),_0x300be9[_0x4633('0x176')]);};AGIVertices[_0x4633('0x11')][_0x4633('0x182')]=function(_0x1c7930){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x183'),_0x1c7930[_0x4633('0xa5')]));return this[_0x4633('0xf')][_0x4633('0x184')](_0x1c7930[_0x4633('0x57')],_0x1c7930[_0x4633('0x176')]);};AGIVertices[_0x4633('0x11')]['sendMail']=function(_0x15012f){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x185'),_0x15012f[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x15012f['account_id'])){return this[_0x4633('0xf')][_0x4633('0xb1')]('no\x20mail\x20account\x20configured');}var _0x3ddb9b=this[_0x4633('0x22')][_0x4633('0x69')](this,_0x15012f[_0x4633('0x186')]);if(!_0x3ddb9b||!_0x3ddb9b['Smtp']){return this['channel'][_0x4633('0x2d')](_0x15012f,_0x4633('0x187'));}var _0x2b3dd9={'from':util[_0x4633('0x2a')]('\x22%s\x22\x20<%s>',_0x3ddb9b['name'],_0x3ddb9b[_0x4633('0x188')]||_0x3ddb9b[_0x4633('0x189')][_0x4633('0x18a')]),'to':_0x15012f['to']||'','cc':_0x15012f['cc']||'','bcc':_0x15012f[_0x4633('0x18b')]||'','subject':_0x15012f[_0x4633('0x18c')],'html':_0x15012f[_0x4633('0x57')],'text':_0x15012f[_0x4633('0x57')]};if(this['isConfigured'](_0x15012f['template_id'])){}logger['debug'](_0x4633('0x18d'),JSON[_0x4633('0x6d')](_0x2b3dd9));this['createSquareDetailsReport'][_0x4633('0x69')](this,_0x15012f,_0x15012f[_0x4633('0x186')]);this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x18e'),_0x3ddb9b[_0x4633('0x15')]));this[_0x4633('0x23')][_0x4633('0x69')](this,_0x3ddb9b['smtpOptions'],_0x2b3dd9);return this[_0x4633('0xf')][_0x4633('0xb1')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x4633('0x18f')]=function(_0x5635b6){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x190'),_0x5635b6['label']));return this[_0x4633('0xf')][_0x4633('0xb1')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x4633('0x191')]=function(_0x2c409e){logger['info'](util[_0x4633('0x2a')](_0x4633('0x192'),_0x2c409e[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x2c409e['sms_account_id'])){return this[_0x4633('0xf')]['noop'](_0x4633('0x193'));}var _0x2d0636=this[_0x4633('0x194')][_0x4633('0x69')](this,_0x2c409e['sms_account_id']);if(!_0x2d0636){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x2c409e,_0x4633('0x195'));}var _0x496b33={'body':_0x2c409e[_0x4633('0x196')],'phone':_0x2c409e['to']||'','SmsAccountId':_0x2d0636['id']};logger[_0x4633('0xd4')]('sendSMS\x20message',JSON[_0x4633('0x6d')](_0x496b33));this[_0x4633('0x35')]['sync'](this,_0x2c409e,_0x2c409e['sms_account_id']);this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x197'),_0x2d0636['name']));this[_0x4633('0x34')][_0x4633('0x69')](this,_0x496b33);return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0x198'));};AGIVertices['prototype'][_0x4633('0x199')]=function(_0x45fe8e){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x19a'),_0x45fe8e[_0x4633('0xa5')]));if(!this['isConfigured'](_0x45fe8e[_0x4633('0xce')])){return this['channel'][_0x4633('0x2d')](_0x45fe8e,_0x4633('0x19b'));}var _0x175635=this[_0x4633('0x12')]['sync'](this,_0x45fe8e['variable_id']);if(!_0x175635){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x45fe8e,_0x4633('0x112'));}return this[_0x4633('0xf')][_0x4633('0x9d')](_0x175635,_0x45fe8e[_0x4633('0x19c')]);};AGIVertices['prototype'][_0x4633('0x19d')]=function(_0x32e6e7){logger['info'](util[_0x4633('0x2a')](_0x4633('0x19e'),_0x32e6e7[_0x4633('0xa5')]));this['channel']['noop']('START\x20CALLY\x20SQUARE');var _0x57cb8a=this['channel'][_0x4633('0x12')](_0x4633('0x19f'));if(!_[_0x4633('0x41')](_0x57cb8a[_0x4633('0xa1')])){this[_0x4633('0xf')][_0x4633('0x36')]=_0x57cb8a[_0x4633('0xa1')];}if(_0x32e6e7[_0x4633('0x1a0')]===_0x4633('0x1a1')){this['channel'][_0x4633('0xb1')](_0x4633('0x1a2'));return this[_0x4633('0xf')]['answer']();}return this['channel'][_0x4633('0xb1')]('Skipped\x20Answer');};AGIVertices[_0x4633('0x11')][_0x4633('0x1a3')]=function(_0x36f89a){logger[_0x4633('0x2f')](util[_0x4633('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x36f89a['label']));if(!this[_0x4633('0x80')](_0x36f89a[_0x4633('0x1a4')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x36f89a,_0x4633('0x1a5'));}var _0x208a46=this['getSquareProject'][_0x4633('0x69')](this,_0x36f89a[_0x4633('0x1a4')]);if(!this[_0x4633('0x80')](_0x208a46)){return this[_0x4633('0xf')]['error'](_0x36f89a,util[_0x4633('0x2a')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x36f89a[_0x4633('0x1a4')]));}if(_0x208a46===this[_0x4633('0xf')]['arg_1']){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x36f89a,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x4633('0x35')][_0x4633('0x69')](this,_0x36f89a,_0x208a46);var _0x3d6d3b=this[_0x4633('0xf')][_0x4633('0x53')](_0x4633('0x1a6'),util[_0x4633('0x2a')](_0x4633('0x1a7'),config[_0x4633('0x8')][_0x4633('0x1a8')]||_0x4633('0x1a9'),_0x208a46,this[_0x4633('0xf')][_0x4633('0x38')]));if(_0x3d6d3b[_0x4633('0xa7')]===-0x1){return _0x3d6d3b;}return this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xbd'),'AGI',_0x208a46));};AGIVertices[_0x4633('0x11')][_0x4633('0x1aa')]=function(_0x25558a){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x1ab'),_0x25558a[_0x4633('0xa5')]));var _0x2ad643=this['shellCommand'][_0x4633('0x69')](this,_0x25558a[_0x4633('0x1ac')]);this[_0x4633('0x35')][_0x4633('0x69')](this,_0x25558a,_0x25558a['command']);if(this[_0x4633('0x80')](_0x25558a['variable_id'])){var _0x12b199=this[_0x4633('0x12')][_0x4633('0x69')](this,_0x25558a['variable_id']);if(_0x12b199){this['channel'][_0x4633('0x9d')](_0x12b199,_0x2ad643);return this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x1ad'),_0x25558a[_0x4633('0x1ac')],_0x12b199));}}return this[_0x4633('0xf')]['noop'](util[_0x4633('0x2a')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x25558a[_0x4633('0x1ac')]));};AGIVertices['prototype'][_0x4633('0x1ae')]=function(_0x3b3bbe){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x1af'),_0x3b3bbe[_0x4633('0xa5')]));_0x3b3bbe[_0x4633('0x57')]=_0x3b3bbe[_0x4633('0x57')][_0x4633('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4633('0x80')](_0x3b3bbe['apiKey'])){return this['channel']['noop'](_0x4633('0x1b0'));}if(!this['isConfigured'](_0x3b3bbe['text'])){return this[_0x4633('0xf')][_0x4633('0xb1')](_0x4633('0xde'));}this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x1b1'),_0x3b3bbe[_0x4633('0x57')]));var _0xfaa304=this[_0x4633('0x1b2')][_0x4633('0x69')](this,_0x3b3bbe);if(_0xfaa304){this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x1b3'),_0xfaa304));var _0x4e7324=this['channel'][_0x4633('0x11d')](_0xfaa304);try{fs[_0x4633('0x1b4')](_0xfaa304+_0x4633('0x11e'));}catch(_0x30f678){logger[_0x4633('0x2d')](_0x30f678);}return _0x4e7324;}return this[_0x4633('0xf')][_0x4633('0x2d')](_0x3b3bbe,_0x4633('0x1b5'));};AGIVertices[_0x4633('0x11')][_0x4633('0x1b6')]=function(_0x4283b6){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x1b7'),_0x4283b6[_0x4633('0xa5')]));_0x4283b6['text']=_0x4283b6['text'][_0x4633('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4633('0x80')](_0x4283b6[_0x4633('0x57')])){return this['channel'][_0x4633('0xb1')]('no\x20text\x20configured');}this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x4283b6[_0x4633('0x57')]));var _0x117706=this[_0x4633('0x5d')][_0x4633('0x69')](this,_0x4283b6);if(_0x117706){this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x1b8'),_0x117706));var _0x3da9f4=this['channel'][_0x4633('0x11d')](_0x117706);try{fs['unlink'](_0x117706+'.wav');}catch(_0x233687){logger[_0x4633('0x2d')](_0x233687);}return _0x3da9f4;}return this['channel'][_0x4633('0x2d')](_0x4283b6,_0x4633('0x1b9'));};AGIVertices['prototype'][_0x4633('0x1ba')]=function(_0x25cace){logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x1bb'),_0x25cace[_0x4633('0xa5')]));if(!this['isConfigured'](_0x25cace['findBy'])){return this['channel'][_0x4633('0x2d')](_0x25cace,_0x4633('0x14e'));}logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x154'),this[_0x4633('0xf')][_0x4633('0x39')],_0x25cace[_0x4633('0x14d')]));var _0x3438d7=this[_0x4633('0x4e')][_0x4633('0x69')](this,_0x25cace[_0x4633('0x14d')]);if(_0x3438d7){logger[_0x4633('0x2f')](util['format'](_0x4633('0x150'),this['channel'][_0x4633('0x39')],_0x25cace['findBy']));this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4633('0xf')][_0x4633('0x39')],_0x25cace[_0x4633('0x14d')]));return{'code':0xc8,'result':_0x4633('0x151')};}else{logger[_0x4633('0x2f')](util[_0x4633('0x2a')](_0x4633('0x152'),this['channel'][_0x4633('0x39')],_0x25cace[_0x4633('0x14d')]));this[_0x4633('0xf')][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0x152'),this[_0x4633('0xf')][_0x4633('0x39')],_0x25cace['findBy']));return{'code':0xc8,'result':_0x4633('0x161')};}};AGIVertices['prototype'][_0x4633('0x1bc')]=function(_0x4f7947){logger[_0x4633('0x2f')](util[_0x4633('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x4f7947['label']));var _0x43b0c3=this[_0x4633('0xf')][_0x4633('0x53')]('VOICEMAIL',[_0x4f7947[_0x4633('0x1bd')],_0x4f7947[_0x4633('0x74')]]);if(_0x43b0c3['result']===-0x1){return _0x43b0c3;}return this['channel'][_0x4633('0xb1')](util[_0x4633('0x2a')](_0x4633('0xbd'),_0x4633('0x1be'),_0x4f7947[_0x4633('0x1bd')]));};AGIVertices['prototype']['vswitch']=function(_0x9c479b){logger['info'](util[_0x4633('0x2a')](_0x4633('0x1bf'),_0x9c479b[_0x4633('0xa5')]));if(!this[_0x4633('0x80')](_0x9c479b[_0x4633('0xce')])){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x9c479b,'no\x20variable\x20selected');}var _0x2cda64=this[_0x4633('0x12')]['sync'](this,_0x9c479b[_0x4633('0xce')]);if(!_0x2cda64){return this[_0x4633('0xf')][_0x4633('0x2d')](_0x9c479b,'no\x20variable\x20found');}var _0x336df6=this['channel'][_0x4633('0x12')](_0x2cda64);return{'code':0xc8,'result':_0x336df6[_0x4633('0xa1')]?_0x336df6[_0x4633('0xa1')]:'-'};};String[_0x4633('0x11')][_0x4633('0x1c0')]=function(_0x348251,_0x34ce22){return this[_0x4633('0x9e')](_0x348251)['join'](_0x34ce22);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c77784f..88626e1 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 _0xeec8=['channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncAgentRingNoAnswer','syncBlindTransfer','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timers','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','pauseType','saveUnpause','update','error','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents'];(function(_0x149a64,_0x10e365){var _0x38d6c0=function(_0x1454c6){while(--_0x1454c6){_0x149a64['push'](_0x149a64['shift']());}};_0x38d6c0(++_0x10e365);}(_0xeec8,0xfd));var _0x8eec=function(_0x5ba745,_0x54d837){_0x5ba745=_0x5ba745-0x0;var _0x2595fb=_0xeec8[_0x5ba745];return _0x2595fb;};'use strict';var _=require(_0x8eec('0x0'));var moment=require('moment');var ami=require(_0x8eec('0x1'));var logger=require(_0x8eec('0x2'))(_0x8eec('0x3'));var RpcUser=require(_0x8eec('0x4'));var RpcVoiceAgentReport=require(_0x8eec('0x5'));function Acw(_0x57a5b5){this[_0x8eec('0x6')]=_0x57a5b5['voiceQueues'];this[_0x8eec('0x7')]=_0x57a5b5[_0x8eec('0x7')];this['timers']=_0x57a5b5['timers'];this[_0x8eec('0x8')]={};ami['on'](_0x8eec('0x9'),this[_0x8eec('0xa')]['bind'](this));ami['on'](_0x8eec('0xb'),this[_0x8eec('0xc')][_0x8eec('0xd')](this));ami['on'](_0x8eec('0xe'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x8eec('0xf')][_0x8eec('0xd')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x8eec('0xd')](this));ami['on']('blindtransfer',this[_0x8eec('0x10')]['bind'](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x8eec('0xd')](this));}function getDiff(_0x15d376){var _0x734fa9=moment()[_0x8eec('0x11')](0x0);var _0x351d7b=moment(_0x15d376)[_0x8eec('0x11')](0x0);return _0x734fa9[_0x8eec('0x12')](_0x351d7b,_0x8eec('0x13'));}Acw[_0x8eec('0x14')][_0x8eec('0x15')]=function(_0x4ff8ec,_0x3c9813){var _0x155753=this;var _0x2a5736=getDiff(_0x155753['timers'][_0x4ff8ec][_0x8eec('0x16')]);clearTimeout(_0x155753[_0x8eec('0x17')][_0x4ff8ec][_0x8eec('0x18')]);_0x155753[_0x8eec('0x17')][_0x4ff8ec][_0x8eec('0x18')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x2a5736},_0x155753['timers'][_0x4ff8ec][_0x8eec('0x19')],_0x4ff8ec)[_0x8eec('0x1a')](function(_0x19af6c){logger[_0x8eec('0x1b')](_0x8eec('0x1c'),_0x3c9813,_0x2a5736,_0x19af6c);})[_0x8eec('0x1d')](function(_0x341ce9){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x3c9813,_0x341ce9);})[_0x8eec('0x1e')](function(){delete _0x155753['timers'][_0x4ff8ec];});};Acw[_0x8eec('0x14')][_0x8eec('0x1f')]=function(_0x244387){try{var _0x16a602=this;var _0x593fe1=this['channels'][_0x244387][_0x8eec('0x20')];var _0x42b5a5=this[_0x8eec('0x8')][_0x244387][_0x8eec('0x21')];var _0x1494b2=this[_0x8eec('0x6')][_0x42b5a5];var _0x56a22a=![];var _0x4292e1=_0x8eec('0x22');if(_0x1494b2[_0x8eec('0x23')]&&_0x1494b2[_0x8eec('0x24')]['name']){_0x56a22a=!![];_0x4292e1=_0x1494b2[_0x8eec('0x24')]['name'];}return ami[_0x8eec('0x25')]({'action':_0x8eec('0x26'),'interface':_0x593fe1,'paused':!![],'reason':_0x4292e1})[_0x8eec('0x1a')](function(){if(_0x16a602[_0x8eec('0x7')][_0x593fe1]){return RpcUser[_0x8eec('0x27')](_0x16a602[_0x8eec('0x7')][_0x593fe1]['id'])['then'](function(_0x19ac51){if(!_0x19ac51||_0x19ac51[_0x8eec('0x28')]){logger[_0x8eec('0x1b')](_0x8eec('0x29'),_0x244387,_0x593fe1,_0x42b5a5);return;}logger[_0x8eec('0x1b')](_0x8eec('0x2a'),_0x244387,_0x593fe1,_0x42b5a5);var _0x5a5476=_0x16a602[_0x8eec('0x8')][_0x244387][_0x8eec('0x2b')]&&_0x16a602[_0x8eec('0x8')][_0x244387][_0x8eec('0x2c')]?_0x16a602['channels'][_0x244387][_0x8eec('0x2c')]:_0x244387;return RpcUser[_0x8eec('0x2d')](_0x16a602[_0x8eec('0x7')][_0x593fe1],_0x4292e1,_0x5a5476)[_0x8eec('0x1a')](function(_0x17aba9){_0x16a602[_0x8eec('0x6')][_0x42b5a5]['available']-=0x1;_0x16a602[_0x8eec('0x6')][_0x42b5a5]['paused']+=0x1;return _0x17aba9;});})[_0x8eec('0x1a')](function(_0x6279c5){if(_0x56a22a||!_0x6279c5){return;}_0x16a602[_0x8eec('0x17')][_0x593fe1]={};logger[_0x8eec('0x1b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x244387,_0x16a602[_0x8eec('0x6')][_0x42b5a5][_0x8eec('0x2e')],_0x593fe1,_0x42b5a5);_0x16a602[_0x8eec('0x17')][_0x593fe1][_0x8eec('0x18')]=setTimeout(_0x16a602[_0x8eec('0x2f')][_0x8eec('0xd')](_0x16a602,_0x593fe1),_0x16a602[_0x8eec('0x6')][_0x42b5a5][_0x8eec('0x2e')]*0x3e8);_0x16a602['timers'][_0x593fe1][_0x8eec('0x16')]=moment()[_0x8eec('0x30')](_0x8eec('0x31'));_0x16a602[_0x8eec('0x17')][_0x593fe1][_0x8eec('0x19')]=_0x244387;_0x16a602[_0x8eec('0x17')][_0x593fe1][_0x8eec('0x21')]=_0x42b5a5;_0x16a602['timers'][_0x593fe1]['updateAcw']=_0x16a602[_0x8eec('0x15')]['bind'](_0x16a602,_0x593fe1,_0x244387);});}})['catch'](function(){logger['error'](_0x8eec('0x32'),_0x244387,_0x16a602[_0x8eec('0x6')][_0x42b5a5][_0x8eec('0x2e')],_0x593fe1,_0x42b5a5);})[_0x8eec('0x1e')](function(){delete _0x16a602['channels'][_0x244387];});}catch(_0x35eb2d){logger['error'](_0x8eec('0x33'),_0x35eb2d[_0x8eec('0x34')]);}};Acw['prototype'][_0x8eec('0x2f')]=function(_0x212570){try{var _0x24ba53=this;if(_0x24ba53[_0x8eec('0x17')][_0x212570]){_0x24ba53[_0x8eec('0x17')][_0x212570][_0x8eec('0x18')]=![];var _0x724b23=_0x24ba53[_0x8eec('0x17')][_0x212570]['uniqueid'];var _0x3077b3=_0x24ba53[_0x8eec('0x17')][_0x212570][_0x8eec('0x21')];var _0x10d6f7=_0x24ba53[_0x8eec('0x6')][_0x3077b3][_0x8eec('0x2e')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x724b23,_0x212570);RpcUser['getAgent'](this[_0x8eec('0x7')][_0x212570]['id'])[_0x8eec('0x1a')](function(_0x58aca5){if(_0x58aca5[_0x8eec('0x35')]==='ACW'){return RpcUser[_0x8eec('0x36')](_0x24ba53[_0x8eec('0x7')][_0x212570]);}});RpcVoiceAgentReport[_0x8eec('0x37')]({'acwtime':_0x10d6f7,'agentacw':!![]},_0x724b23,_0x212570)[_0x8eec('0x1a')](function(_0x1e9bf3){logger[_0x8eec('0x1b')](_0x8eec('0x1c'),_0x724b23,_0x10d6f7,_0x1e9bf3);})[_0x8eec('0x1d')](function(_0x4cd907){logger[_0x8eec('0x38')](_0x8eec('0x39'),_0x724b23,_0x4cd907);});}else{logger[_0x8eec('0x38')](_0x8eec('0x3a'),_0x212570);if(_0x24ba53['timers']){logger[_0x8eec('0x1b')](_0x8eec('0x3b'),JSON['stringify'](_0x24ba53[_0x8eec('0x17')]));}}}catch(_0x4e0c60){logger[_0x8eec('0x38')](_0x8eec('0x3c'),_0x4e0c60['message']);}};Acw[_0x8eec('0x14')][_0x8eec('0xa')]=function(_0x1cb2ff){try{if(this[_0x8eec('0x6')][_0x1cb2ff[_0x8eec('0x21')]]&&(this[_0x8eec('0x6')][_0x1cb2ff['queue']][_0x8eec('0x3')]||this[_0x8eec('0x6')][_0x1cb2ff['queue']]['mandatoryDisposition'])){if(this[_0x8eec('0x7')][_0x1cb2ff[_0x8eec('0x20')]]){this[_0x8eec('0x8')][_0x1cb2ff[_0x8eec('0x19')]]={'queue':_0x1cb2ff[_0x8eec('0x21')],'interface':_0x1cb2ff[_0x8eec('0x20')],'destlinkedid':_0x1cb2ff['destlinkedid']};}}}catch(_0x2b0a11){logger[_0x8eec('0x38')](_0x8eec('0x3d'),_0x2b0a11[_0x8eec('0x34')]);}};Acw['prototype'][_0x8eec('0x3e')]=function(_0x3302ca){try{if(this['voiceQueues'][_0x3302ca[_0x8eec('0x21')]]&&(this[_0x8eec('0x6')][_0x3302ca[_0x8eec('0x21')]][_0x8eec('0x3')]||this['voiceQueues'][_0x3302ca[_0x8eec('0x21')]]['mandatoryDisposition'])){if(this[_0x8eec('0x7')][_0x3302ca['interface']]){this[_0x8eec('0x8')][_0x3302ca[_0x8eec('0x19')]]={'queue':_0x3302ca[_0x8eec('0x21')],'interface':_0x3302ca[_0x8eec('0x20')]};}}}catch(_0x4732cd){logger['error'](_0x8eec('0x3f'),_0x4732cd[_0x8eec('0x34')]);}};Acw[_0x8eec('0x14')][_0x8eec('0xc')]=function(_0x12eeeb){try{if(this[_0x8eec('0x8')][_0x12eeeb['uniqueid']]&&_[_0x8eec('0x40')](this[_0x8eec('0x8')][_0x12eeeb[_0x8eec('0x19')]][_0x8eec('0x2b')])){logger[_0x8eec('0x1b')](_0x8eec('0x41'),_0x12eeeb[_0x8eec('0x19')]);this['startAcw'](_0x12eeeb['uniqueid']);}else if(this[_0x8eec('0x8')][_0x12eeeb[_0x8eec('0x42')]]&&_[_0x8eec('0x40')](this[_0x8eec('0x8')][_0x12eeeb[_0x8eec('0x42')]][_0x8eec('0x2b')])){logger[_0x8eec('0x1b')]('[%s][HANGUP:LINKEDID]',_0x12eeeb[_0x8eec('0x42')]);this[_0x8eec('0x1f')](_0x12eeeb[_0x8eec('0x42')]);}}catch(_0x17f739){logger[_0x8eec('0x38')](_0x8eec('0x43'),_0x17f739[_0x8eec('0x34')]);}};Acw['prototype'][_0x8eec('0x44')]=function(_0x50719f){try{if(this[_0x8eec('0x8')][_0x50719f['uniqueid']]&&this['channels'][_0x50719f[_0x8eec('0x19')]][_0x8eec('0x2b')]){logger[_0x8eec('0x1b')](_0x8eec('0x45'),_0x50719f[_0x8eec('0x19')]);this[_0x8eec('0x1f')](_0x50719f[_0x8eec('0x19')]);}else if(this[_0x8eec('0x8')][_0x50719f[_0x8eec('0x42')]]&&this[_0x8eec('0x8')][_0x50719f[_0x8eec('0x42')]][_0x8eec('0x2b')]){logger[_0x8eec('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x50719f['linkedid']);this[_0x8eec('0x1f')](_0x50719f['linkedid']);}}catch(_0x4d39d1){logger[_0x8eec('0x38')](_0x8eec('0x46'),_0x4d39d1['message']);}};Acw['prototype'][_0x8eec('0x47')]=function(_0x260c18){try{if(!_[_0x8eec('0x48')](this['channels'][_0x260c18[_0x8eec('0x49')]])){this[_0x8eec('0x1f')](_0x260c18[_0x8eec('0x49')]);if(this['channels'][_0x260c18[_0x8eec('0x4a')]]){this[_0x8eec('0x8')][_0x260c18[_0x8eec('0x4a')]][_0x8eec('0x2b')]=!![];this['channels'][_0x260c18[_0x8eec('0x4b')]]=this[_0x8eec('0x8')][_0x260c18['secondtransfereruniqueid']];delete this[_0x8eec('0x8')][_0x260c18[_0x8eec('0x4a')]];}}else if(!_[_0x8eec('0x48')](this[_0x8eec('0x8')][_0x260c18[_0x8eec('0x4b')]])){this[_0x8eec('0x1f')](_0x260c18[_0x8eec('0x4b')]);if(this[_0x8eec('0x8')][_0x260c18['origtransfereruniqueid']]){this[_0x8eec('0x8')][_0x260c18[_0x8eec('0x4c')]][_0x8eec('0x2b')]=!![];this[_0x8eec('0x8')][_0x260c18[_0x8eec('0x49')]]=this[_0x8eec('0x8')][_0x260c18[_0x8eec('0x4c')]];delete this[_0x8eec('0x8')][_0x260c18[_0x8eec('0x4c')]];}}}catch(_0x92aab9){logger['error'](_0x8eec('0x4d'),_0x92aab9['message']);}};Acw[_0x8eec('0x14')][_0x8eec('0x10')]=function(_0x5b008f){try{if(this[_0x8eec('0x8')][_0x5b008f[_0x8eec('0x4e')]]){logger[_0x8eec('0x1b')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x8eec('0x4f')](_0x5b008f[_0x8eec('0x4e')]));this[_0x8eec('0x1f')](_0x5b008f[_0x8eec('0x4e')]);}else if(this['channels'][_0x5b008f[_0x8eec('0x50')]]){logger[_0x8eec('0x1b')](_0x8eec('0x51'),JSON[_0x8eec('0x4f')](_0x5b008f[_0x8eec('0x50')]));this['startAcw'](_0x5b008f['transfererlinkedid']);}}catch(_0x3bcbc5){logger[_0x8eec('0x38')]('[ACW][syncBlindTransfer]\x20%s',_0x3bcbc5['message']);}};Acw[_0x8eec('0x14')][_0x8eec('0xf')]=function(_0x3990aa){try{if(this[_0x8eec('0x6')][_0x3990aa[_0x8eec('0x21')]]&&this['voiceQueues'][_0x3990aa['queue']][_0x8eec('0x52')]===_0x8eec('0x53')){if(this['agents'][_0x3990aa[_0x8eec('0x20')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3990aa[_0x8eec('0x19')],_0x3990aa[_0x8eec('0x20')],_0x3990aa[_0x8eec('0x21')]);return RpcUser[_0x8eec('0x2d')](this[_0x8eec('0x7')][_0x3990aa['interface']],_0x8eec('0x54'),_0x3990aa[_0x8eec('0x19')]);}}}catch(_0x3b5917){logger[_0x8eec('0x38')](_0x8eec('0x55'),_0x3b5917[_0x8eec('0x34')]);}};module[_0x8eec('0x56')]=Acw; \ No newline at end of file +var _0x3b92=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','update','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','syncHangupRequest','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','savePause','Auto-Pause','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','hangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','updateAcw','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','available','paused','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5a9600,_0x46da77){var _0x20b0e6=function(_0x351865){while(--_0x351865){_0x5a9600['push'](_0x5a9600['shift']());}};_0x20b0e6(++_0x46da77);}(_0x3b92,0x1ca));var _0x23b9=function(_0x298d44,_0xeba121){_0x298d44=_0x298d44-0x0;var _0xbb7094=_0x3b92[_0x298d44];return _0xbb7094;};'use strict';var _=require(_0x23b9('0x0'));var moment=require('moment');var ami=require(_0x23b9('0x1'));var logger=require(_0x23b9('0x2'))(_0x23b9('0x3'));var RpcUser=require(_0x23b9('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x12fc0c){this[_0x23b9('0x5')]=_0x12fc0c[_0x23b9('0x5')];this[_0x23b9('0x6')]=_0x12fc0c[_0x23b9('0x6')];this['timers']=_0x12fc0c[_0x23b9('0x7')];this[_0x23b9('0x8')]={};ami['on']('agentconnect',this[_0x23b9('0x9')][_0x23b9('0xa')](this));ami['on'](_0x23b9('0xb'),this['syncHangupRequest'][_0x23b9('0xa')](this));ami['on'](_0x23b9('0xc'),this['syncHangup'][_0x23b9('0xa')](this));ami['on']('agentringnoanswer',this[_0x23b9('0xd')][_0x23b9('0xa')](this));ami['on'](_0x23b9('0xe'),this[_0x23b9('0xf')][_0x23b9('0xa')](this));ami['on'](_0x23b9('0x10'),this[_0x23b9('0x11')][_0x23b9('0xa')](this));ami['on'](_0x23b9('0x12'),this[_0x23b9('0x13')]['bind'](this));}function getDiff(_0x54f67d){var _0x2465b6=moment()[_0x23b9('0x14')](0x0);var _0x1cbc7b=moment(_0x54f67d)[_0x23b9('0x14')](0x0);return _0x2465b6['diff'](_0x1cbc7b,_0x23b9('0x15'));}Acw[_0x23b9('0x16')][_0x23b9('0x17')]=function(_0x2244c5,_0x377a40){var _0xef78b1=this;var _0x381490=getDiff(_0xef78b1[_0x23b9('0x7')][_0x2244c5][_0x23b9('0x18')]);clearTimeout(_0xef78b1[_0x23b9('0x7')][_0x2244c5]['timer']);_0xef78b1[_0x23b9('0x7')][_0x2244c5][_0x23b9('0x19')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x381490},_0xef78b1['timers'][_0x2244c5][_0x23b9('0x1a')],_0x2244c5)[_0x23b9('0x1b')](function(_0x379fdd){logger[_0x23b9('0x1c')](_0x23b9('0x1d'),_0x377a40,_0x381490,_0x379fdd);})[_0x23b9('0x1e')](function(_0x5d40c6){logger[_0x23b9('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x377a40,_0x5d40c6);})[_0x23b9('0x20')](function(){delete _0xef78b1[_0x23b9('0x7')][_0x2244c5];});};Acw[_0x23b9('0x16')][_0x23b9('0x21')]=function(_0x5e901b){try{var _0x494e39=this;var _0x54eb4a=this[_0x23b9('0x8')][_0x5e901b][_0x23b9('0x22')];var _0x5e4299=this[_0x23b9('0x8')][_0x5e901b][_0x23b9('0x23')];var _0xa91d9c=this['voiceQueues'][_0x5e4299];var _0x55e27=![];var _0x454d6d=_0x23b9('0x24');if(_0xa91d9c['mandatoryDisposition']&&_0xa91d9c[_0x23b9('0x25')][_0x23b9('0x26')]){_0x55e27=!![];_0x454d6d=_0xa91d9c[_0x23b9('0x25')][_0x23b9('0x26')];}return ami[_0x23b9('0x27')]({'action':_0x23b9('0x28'),'interface':_0x54eb4a,'paused':!![],'reason':_0x454d6d})['then'](function(){if(_0x494e39[_0x23b9('0x6')][_0x54eb4a]){return RpcUser[_0x23b9('0x29')](_0x494e39['agents'][_0x54eb4a]['id'])['then'](function(_0x465766){if(!_0x465766||_0x465766[_0x23b9('0x2a')]){logger[_0x23b9('0x1c')](_0x23b9('0x2b'),_0x5e901b,_0x54eb4a,_0x5e4299);return;}logger[_0x23b9('0x1c')](_0x23b9('0x2c'),_0x5e901b,_0x54eb4a,_0x5e4299);var _0x133386=_0x494e39[_0x23b9('0x8')][_0x5e901b]['attended']&&_0x494e39[_0x23b9('0x8')][_0x5e901b][_0x23b9('0x2d')]?_0x494e39[_0x23b9('0x8')][_0x5e901b]['destlinkedid']:_0x5e901b;return RpcUser['savePause'](_0x494e39[_0x23b9('0x6')][_0x54eb4a],_0x454d6d,_0x133386)[_0x23b9('0x1b')](function(_0x45a78a){_0x494e39[_0x23b9('0x5')][_0x5e4299][_0x23b9('0x2e')]-=0x1;_0x494e39[_0x23b9('0x5')][_0x5e4299][_0x23b9('0x2f')]+=0x1;return _0x45a78a;});})[_0x23b9('0x1b')](function(_0x7f9f3f){if(_0x55e27||!_0x7f9f3f){return;}_0x494e39[_0x23b9('0x7')][_0x54eb4a]={};logger[_0x23b9('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5e901b,_0x494e39[_0x23b9('0x5')][_0x5e4299][_0x23b9('0x30')],_0x54eb4a,_0x5e4299);_0x494e39[_0x23b9('0x7')][_0x54eb4a]['timer']=setTimeout(_0x494e39[_0x23b9('0x31')][_0x23b9('0xa')](_0x494e39,_0x54eb4a),_0x494e39[_0x23b9('0x5')][_0x5e4299][_0x23b9('0x30')]*0x3e8);_0x494e39['timers'][_0x54eb4a][_0x23b9('0x18')]=moment()[_0x23b9('0x32')](_0x23b9('0x33'));_0x494e39[_0x23b9('0x7')][_0x54eb4a]['uniqueid']=_0x5e901b;_0x494e39[_0x23b9('0x7')][_0x54eb4a][_0x23b9('0x23')]=_0x5e4299;_0x494e39[_0x23b9('0x7')][_0x54eb4a]['updateAcw']=_0x494e39[_0x23b9('0x17')][_0x23b9('0xa')](_0x494e39,_0x54eb4a,_0x5e901b);});}})[_0x23b9('0x1e')](function(){logger[_0x23b9('0x1f')](_0x23b9('0x34'),_0x5e901b,_0x494e39[_0x23b9('0x5')][_0x5e4299]['acwTimeout'],_0x54eb4a,_0x5e4299);})[_0x23b9('0x20')](function(){delete _0x494e39[_0x23b9('0x8')][_0x5e901b];});}catch(_0x433333){logger['error'](_0x23b9('0x35'),_0x433333[_0x23b9('0x36')]);}};Acw[_0x23b9('0x16')][_0x23b9('0x31')]=function(_0x4957c1){try{var _0x123bec=this;if(_0x123bec[_0x23b9('0x7')][_0x4957c1]){_0x123bec['timers'][_0x4957c1][_0x23b9('0x19')]=![];var _0x5e1dc2=_0x123bec[_0x23b9('0x7')][_0x4957c1][_0x23b9('0x1a')];var _0x2d7d8e=_0x123bec[_0x23b9('0x7')][_0x4957c1][_0x23b9('0x23')];var _0x47535a=_0x123bec[_0x23b9('0x5')][_0x2d7d8e][_0x23b9('0x30')];logger[_0x23b9('0x1c')](_0x23b9('0x37'),_0x5e1dc2,_0x4957c1);RpcUser['getAgent'](this[_0x23b9('0x6')][_0x4957c1]['id'])[_0x23b9('0x1b')](function(_0x4b9b7f){if(_0x4b9b7f['pauseType']===_0x23b9('0x24')){return RpcUser['saveUnpause'](_0x123bec[_0x23b9('0x6')][_0x4957c1]);}});RpcVoiceAgentReport[_0x23b9('0x38')]({'acwtime':_0x47535a,'agentacw':!![]},_0x5e1dc2,_0x4957c1)[_0x23b9('0x1b')](function(_0x5e991b){logger[_0x23b9('0x1c')]('[%s][UPDATE][ACWTIME:%s]',_0x5e1dc2,_0x47535a,_0x5e991b);})[_0x23b9('0x1e')](function(_0x3e79d6){logger[_0x23b9('0x1f')](_0x23b9('0x39'),_0x5e1dc2,_0x3e79d6);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x4957c1);if(_0x123bec[_0x23b9('0x7')]){logger['info'](_0x23b9('0x3a'),JSON['stringify'](_0x123bec[_0x23b9('0x7')]));}}}catch(_0x305125){logger[_0x23b9('0x1f')](_0x23b9('0x3b'),_0x305125[_0x23b9('0x36')]);}};Acw['prototype']['syncAgentConnect']=function(_0xb0e784){try{if(this['voiceQueues'][_0xb0e784[_0x23b9('0x23')]]&&(this[_0x23b9('0x5')][_0xb0e784['queue']]['acw']||this['voiceQueues'][_0xb0e784[_0x23b9('0x23')]]['mandatoryDisposition'])){if(this['agents'][_0xb0e784[_0x23b9('0x22')]]){this[_0x23b9('0x8')][_0xb0e784['uniqueid']]={'queue':_0xb0e784['queue'],'interface':_0xb0e784[_0x23b9('0x22')],'destlinkedid':_0xb0e784[_0x23b9('0x2d')]};}}}catch(_0x13d046){logger[_0x23b9('0x1f')](_0x23b9('0x3c'),_0x13d046[_0x23b9('0x36')]);}};Acw['prototype'][_0x23b9('0x13')]=function(_0x334a93){try{if(this[_0x23b9('0x5')][_0x334a93['queue']]&&(this['voiceQueues'][_0x334a93[_0x23b9('0x23')]][_0x23b9('0x3')]||this[_0x23b9('0x5')][_0x334a93['queue']][_0x23b9('0x3d')])){if(this['agents'][_0x334a93['interface']]){this[_0x23b9('0x8')][_0x334a93[_0x23b9('0x1a')]]={'queue':_0x334a93['queue'],'interface':_0x334a93[_0x23b9('0x22')]};}}}catch(_0x2577c0){logger[_0x23b9('0x1f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x2577c0[_0x23b9('0x36')]);}};Acw[_0x23b9('0x16')][_0x23b9('0x3e')]=function(_0x559e01){try{if(this['channels'][_0x559e01[_0x23b9('0x1a')]]&&_[_0x23b9('0x3f')](this['channels'][_0x559e01[_0x23b9('0x1a')]][_0x23b9('0x40')])){logger['info'](_0x23b9('0x41'),_0x559e01['uniqueid']);this[_0x23b9('0x21')](_0x559e01[_0x23b9('0x1a')]);}else if(this[_0x23b9('0x8')][_0x559e01[_0x23b9('0x42')]]&&_[_0x23b9('0x3f')](this[_0x23b9('0x8')][_0x559e01[_0x23b9('0x42')]][_0x23b9('0x40')])){logger[_0x23b9('0x1c')](_0x23b9('0x43'),_0x559e01[_0x23b9('0x42')]);this['startAcw'](_0x559e01[_0x23b9('0x42')]);}}catch(_0x493490){logger[_0x23b9('0x1f')]('[ACW][syncHangupRequest]\x20%s',_0x493490['message']);}};Acw[_0x23b9('0x16')][_0x23b9('0x44')]=function(_0x13cfda){try{if(this['channels'][_0x13cfda[_0x23b9('0x1a')]]&&this[_0x23b9('0x8')][_0x13cfda[_0x23b9('0x1a')]][_0x23b9('0x40')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x13cfda['uniqueid']);this['startAcw'](_0x13cfda['uniqueid']);}else if(this[_0x23b9('0x8')][_0x13cfda[_0x23b9('0x42')]]&&this['channels'][_0x13cfda['linkedid']]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x13cfda['linkedid']);this[_0x23b9('0x21')](_0x13cfda['linkedid']);}}catch(_0x5de849){logger['error']('[ACW][syncHangup]\x20%s',_0x5de849[_0x23b9('0x36')]);}};Acw[_0x23b9('0x16')]['syncAttendedTransfer']=function(_0x20c3d8){try{if(!_['isNil'](this[_0x23b9('0x8')][_0x20c3d8[_0x23b9('0x45')]])){this[_0x23b9('0x21')](_0x20c3d8[_0x23b9('0x45')]);if(this[_0x23b9('0x8')][_0x20c3d8[_0x23b9('0x46')]]){this[_0x23b9('0x8')][_0x20c3d8[_0x23b9('0x46')]][_0x23b9('0x40')]=!![];this['channels'][_0x20c3d8[_0x23b9('0x47')]]=this[_0x23b9('0x8')][_0x20c3d8['secondtransfereruniqueid']];delete this[_0x23b9('0x8')][_0x20c3d8['secondtransfereruniqueid']];}}else if(!_[_0x23b9('0x48')](this[_0x23b9('0x8')][_0x20c3d8[_0x23b9('0x47')]])){this[_0x23b9('0x21')](_0x20c3d8[_0x23b9('0x47')]);if(this[_0x23b9('0x8')][_0x20c3d8[_0x23b9('0x49')]]){this[_0x23b9('0x8')][_0x20c3d8[_0x23b9('0x49')]][_0x23b9('0x40')]=!![];this[_0x23b9('0x8')][_0x20c3d8[_0x23b9('0x45')]]=this[_0x23b9('0x8')][_0x20c3d8[_0x23b9('0x49')]];delete this[_0x23b9('0x8')][_0x20c3d8[_0x23b9('0x49')]];}}}catch(_0x2c10d3){logger[_0x23b9('0x1f')](_0x23b9('0x4a'),_0x2c10d3[_0x23b9('0x36')]);}};Acw[_0x23b9('0x16')]['syncBlindTransfer']=function(_0x3a11ca){try{if(this[_0x23b9('0x8')][_0x3a11ca[_0x23b9('0x4b')]]){logger[_0x23b9('0x1c')](_0x23b9('0x4c'),JSON[_0x23b9('0x4d')](_0x3a11ca[_0x23b9('0x4b')]));this[_0x23b9('0x21')](_0x3a11ca[_0x23b9('0x4b')]);}else if(this[_0x23b9('0x8')][_0x3a11ca[_0x23b9('0x4e')]]){logger[_0x23b9('0x1c')](_0x23b9('0x4f'),JSON[_0x23b9('0x4d')](_0x3a11ca[_0x23b9('0x4e')]));this[_0x23b9('0x21')](_0x3a11ca['transfererlinkedid']);}}catch(_0x378c6d){logger[_0x23b9('0x1f')](_0x23b9('0x50'),_0x378c6d['message']);}};Acw['prototype'][_0x23b9('0xd')]=function(_0xe3d717){try{if(this[_0x23b9('0x5')][_0xe3d717['queue']]&&this[_0x23b9('0x5')][_0xe3d717[_0x23b9('0x23')]]['autopause']===_0x23b9('0x51')){if(this[_0x23b9('0x6')][_0xe3d717['interface']]){logger[_0x23b9('0x1c')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0xe3d717['uniqueid'],_0xe3d717[_0x23b9('0x22')],_0xe3d717[_0x23b9('0x23')]);return RpcUser[_0x23b9('0x52')](this[_0x23b9('0x6')][_0xe3d717['interface']],_0x23b9('0x53'),_0xe3d717[_0x23b9('0x1a')]);}}}catch(_0x49ee58){logger[_0x23b9('0x1f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x49ee58['message']);}};module[_0x23b9('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 690b416..f4a99aa 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 _0xfff0=['close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','catch','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionQueueSummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once'];(function(_0x461027,_0x1e813d){var _0x1fc793=function(_0x5d8ef8){while(--_0x5d8ef8){_0x461027['push'](_0x461027['shift']());}};_0x1fc793(++_0x1e813d);}(_0xfff0,0x76));var _0x0fff=function(_0x36f2e4,_0x3ed63d){_0x36f2e4=_0x36f2e4-0x0;var _0x12dbf1=_0xfff0[_0x36f2e4];return _0x12dbf1;};'use strict';var Manager=require(_0x0fff('0x0'));var BPromise=require(_0x0fff('0x1'));var util=require(_0x0fff('0x2'));var logger=require(_0x0fff('0x3'))(_0x0fff('0x4'));var config=require(_0x0fff('0x5'));var ami=new Manager(config['asterisk'][_0x0fff('0x6')],config['asterisk']['ip'],config[_0x0fff('0x7')][_0x0fff('0x8')],config[_0x0fff('0x7')][_0x0fff('0x9')],!![]);ami[_0x0fff('0xa')]();ami[_0x0fff('0xb')]=BPromise[_0x0fff('0xc')](ami[_0x0fff('0xd')]);function error(_0x25994d){logger[_0x0fff('0xe')](util['format'](_0x0fff('0xf'),config[_0x0fff('0x7')][_0x0fff('0x8')],config[_0x0fff('0x7')]['ip'],config[_0x0fff('0x7')][_0x0fff('0x6')],util[_0x0fff('0x10')](_0x25994d,![],null)));}function close(){logger['error'](util[_0x0fff('0x11')](_0x0fff('0x12'),config[_0x0fff('0x7')][_0x0fff('0x8')],config[_0x0fff('0x7')]['ip'],config[_0x0fff('0x7')][_0x0fff('0x6')]));}ami[_0x0fff('0x13')]=function(){return function(){return ami[_0x0fff('0xb')]({'action':_0x0fff('0x14')});};};ami[_0x0fff('0x15')]=function(){return function(){return ami[_0x0fff('0xb')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x0fff('0xb')]({'action':'sippeerstatus'});};};ami[_0x0fff('0x16')]=function(){return function(){return ami[_0x0fff('0xb')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x0fff('0xb')]({'action':'coreshowchannels'});};};function connect(){logger[_0x0fff('0x17')](util[_0x0fff('0x11')](_0x0fff('0x18'),config[_0x0fff('0x7')][_0x0fff('0x8')],config['asterisk']['ip'],config[_0x0fff('0x7')][_0x0fff('0x6')]));ami['once']('error',error);ami[_0x0fff('0x19')](_0x0fff('0x1a'),close);}ami['on'](_0x0fff('0x1b'),connect);ami['on'](_0x0fff('0x1c'),function(_0x39a32f){logger[_0x0fff('0x17')](util[_0x0fff('0x11')](_0x0fff('0x1d'),config['asterisk'][_0x0fff('0x8')],config[_0x0fff('0x7')]['ip'],config['asterisk']['port'],util['inspect'](_0x39a32f,![],null)));});ami['on']('fullybooted',function(){logger[_0x0fff('0x17')](util[_0x0fff('0x11')](_0x0fff('0x1e'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0fff('0x7')][_0x0fff('0x6')]));return Promise[_0x0fff('0x1f')]()[_0x0fff('0x20')](ami[_0x0fff('0x13')]())[_0x0fff('0x20')](ami['actionDeviceStateList']())[_0x0fff('0x20')](ami[_0x0fff('0x21')]())[_0x0fff('0x20')](ami[_0x0fff('0x16')]())['then'](ami['actionCoreShowChannels']())[_0x0fff('0x22')](function(_0x387bfd){logger[_0x0fff('0xe')]('[ami.js][fullybooted]',util[_0x0fff('0x10')](_0x387bfd,{'showHidden':![],'depth':null}));});});ami[_0x0fff('0x19')](_0x0fff('0xe'),error);ami[_0x0fff('0x19')](_0x0fff('0x1a'),close);module[_0x0fff('0x23')]=ami; \ No newline at end of file +var _0xbd5a=['Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','[ami.js][fullybooted]','asterisk-manager','util','../../config/logger','ami','../../config/environment','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','Action','queuesummary','info'];(function(_0x1234cd,_0x3a11e3){var _0x5e83b2=function(_0x3ca27d){while(--_0x3ca27d){_0x1234cd['push'](_0x1234cd['shift']());}};_0x5e83b2(++_0x3a11e3);}(_0xbd5a,0x119));var _0xabd5=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xbd5a[_0x279d37];return _0x530173;};'use strict';var Manager=require(_0xabd5('0x0'));var BPromise=require('bluebird');var util=require(_0xabd5('0x1'));var logger=require(_0xabd5('0x2'))(_0xabd5('0x3'));var config=require(_0xabd5('0x4'));var ami=new Manager(config[_0xabd5('0x5')][_0xabd5('0x6')],config[_0xabd5('0x5')]['ip'],config[_0xabd5('0x5')]['username'],config[_0xabd5('0x5')][_0xabd5('0x7')],!![]);ami[_0xabd5('0x8')]();ami['Action']=BPromise[_0xabd5('0x9')](ami[_0xabd5('0xa')]);function error(_0x51a444){logger[_0xabd5('0xb')](util[_0xabd5('0xc')](_0xabd5('0xd'),config[_0xabd5('0x5')]['username'],config[_0xabd5('0x5')]['ip'],config[_0xabd5('0x5')][_0xabd5('0x6')],util[_0xabd5('0xe')](_0x51a444,![],null)));}function close(){logger[_0xabd5('0xb')](util[_0xabd5('0xc')](_0xabd5('0xf'),config[_0xabd5('0x5')][_0xabd5('0x10')],config[_0xabd5('0x5')]['ip'],config[_0xabd5('0x5')][_0xabd5('0x6')]));}ami[_0xabd5('0x11')]=function(){return function(){return ami['Action']({'action':_0xabd5('0x12')});};};ami[_0xabd5('0x13')]=function(){return function(){return ami['Action']({'action':_0xabd5('0x14')});};};ami[_0xabd5('0x15')]=function(){return function(){return ami[_0xabd5('0x16')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xabd5('0x16')]({'action':_0xabd5('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xabd5('0x16')]({'action':'coreshowchannels'});};};function connect(){logger[_0xabd5('0x18')](util[_0xabd5('0xc')](_0xabd5('0x19'),config[_0xabd5('0x5')]['username'],config['asterisk']['ip'],config[_0xabd5('0x5')][_0xabd5('0x6')]));ami[_0xabd5('0x1a')](_0xabd5('0xb'),error);ami[_0xabd5('0x1a')](_0xabd5('0x1b'),close);}ami['on'](_0xabd5('0x1c'),connect);ami['on']('shutdown',function(_0x3d75ed){logger[_0xabd5('0x18')](util[_0xabd5('0xc')](_0xabd5('0x1d'),config['asterisk'][_0xabd5('0x10')],config['asterisk']['ip'],config[_0xabd5('0x5')][_0xabd5('0x6')],util[_0xabd5('0xe')](_0x3d75ed,![],null)));});ami['on']('fullybooted',function(){logger['info'](util[_0xabd5('0xc')](_0xabd5('0x1e'),config[_0xabd5('0x5')][_0xabd5('0x10')],config['asterisk']['ip'],config[_0xabd5('0x5')]['port']));return Promise['resolve']()[_0xabd5('0x1f')](ami['actionSipShowRegistry']())[_0xabd5('0x1f')](ami[_0xabd5('0x13')]())[_0xabd5('0x1f')](ami[_0xabd5('0x15')]())['then'](ami[_0xabd5('0x20')]())[_0xabd5('0x1f')](ami['actionCoreShowChannels']())['catch'](function(_0x1ef5b8){logger['error'](_0xabd5('0x21'),util[_0xabd5('0xe')](_0x1ef5b8,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0xabd5('0x1a')]('close',close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 51cd04a..c2772bc 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xda3f,0xec));var _0xfda3=function(_0x167f87,_0x2b0933){_0x167f87=_0x167f87-0x0;var _0x35f802=_0xda3f[_0x167f87];return _0x35f802;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x70e0,0x17b));var _0x070e=function(_0x3abf83,_0x41d57e){_0x3abf83=_0x3abf83-0x0;var _0x121e1a=_0x70e0[_0x3abf83];return _0x121e1a;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 3fa4828..5c12730 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 _0x5576=['[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','syncNewExten','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','push','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','getQueue','Success','callProgressDetecting','variable','amdstatus','exten','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','value','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Normal\x20Clearing','Unknow','queuesSummary','running','statusMessage','getQueueCampaignStatusMessage','inUse','pTalking','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','Agent','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','setXMDContactVariables','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countcongestionretry','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','talking','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalTotalCalls','predictiveIntervalPauses','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','booked','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','getContactDialer','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/agentComplete','env','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','startProgressive','ivrOriginated','queueBooked','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','inspect','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','Action','command','content','indexOf','catch','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','loopCampaigns','syncCampaigns','undefined','isIVRCampaign','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueid','type','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','agiafterat','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','queueCallerAbandonCreateState','CampaignId'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x5576,0x12d));var _0x6557=function(_0x813d0a,_0x4fd3d7){_0x813d0a=_0x813d0a-0x0;var _0x241352=_0x5576[_0x813d0a];return _0x241352;};'use strict';var util=require(_0x6557('0x0'));var _=require(_0x6557('0x1'));var uuid=require('uuid');var moment=require(_0x6557('0x2'));var rr=require('rr');var Redis=require(_0x6557('0x3'));var utils=require(_0x6557('0x4'));var hopperUtils=require(_0x6557('0x5'));var ut=require(_0x6557('0x6'));var config=require(_0x6557('0x7'));var logger=require(_0x6557('0x8'))(_0x6557('0x9'));var loggerBooked=require(_0x6557('0x8'))('booked');var loggerPredictive=require(_0x6557('0x8'))(_0x6557('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x6557('0xb'));var loggerSyncQueueSummary=require(_0x6557('0x8'))(_0x6557('0xc'));var ami=require(_0x6557('0xd'));config[_0x6557('0xe')]=_[_0x6557('0xf')](config[_0x6557('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x6557('0x10'))(new Redis(config[_0x6557('0xe')]));var cmHopper=require(_0x6557('0x11'));var voiceQueueRt=require(_0x6557('0x12'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x6557('0x13'));var Action=require('./models/action');var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x6557('0x14'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process[_0x6557('0x15')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x6557('0x16')][_0x6557('0x17')]=function(_0x4f18ff){this[_0x6557('0x18')]=this[_0x6557('0x18')]?this[_0x6557('0x18')][_0x6557('0x19')](_0x4f18ff):_0x4f18ff();};function Dialer(_0x19c1ee,_0xbc76){this['sequence']=new Sequence();this[_0x6557('0x1a')]=_0xbc76;this['voiceQueues']=_0x19c1ee[_0x6557('0x1b')];this[_0x6557('0x1c')]=_0x19c1ee['campaigns'];this[_0x6557('0x1d')]=_0x19c1ee[_0x6557('0x1d')];this[_0x6557('0x1e')]=_0x19c1ee[_0x6557('0x1e')];this[_0x6557('0x1f')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x6557('0x20')]={};this[_0x6557('0x21')]={};this[_0x6557('0x22')]={};this['optionPredictive']={};this['startPredictive']={};this[_0x6557('0x23')]={};this[_0x6557('0x24')]={};this[_0x6557('0x25')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0x6557('0x26'),this['syncAgentConnect']['bind'](this));ami['on'](_0x6557('0x27'),this[_0x6557('0x28')][_0x6557('0x29')](this));ami['on'](_0x6557('0x2a'),this[_0x6557('0x2b')]['bind'](this));ami['on'](_0x6557('0x2c'),this[_0x6557('0x2d')][_0x6557('0x29')](this));ami['on']('custom:queuesummary',this[_0x6557('0xc')][_0x6557('0x29')](this));ami['on'](_0x6557('0x2e'),this[_0x6557('0x2f')]['bind'](this));ami['on'](_0x6557('0x30'),this[_0x6557('0x31')][_0x6557('0x29')](this));ami['on'](_0x6557('0x32'),this['syncNewExten'][_0x6557('0x29')](this));ami['on'](_0x6557('0x33'),this[_0x6557('0x34')][_0x6557('0x29')](this));ami['on'](_0x6557('0x35'),this['syncQueueMember'][_0x6557('0x29')](this));ami['on'](_0x6557('0x36'),this[_0x6557('0x37')][_0x6557('0x29')](this));this['loopCampaigns']();this[_0x6557('0x38')]();RpcSetting[_0x6557('0x39')]()[_0x6557('0x3a')](function(_0x40d27e){previewRecallmeReminderInterval=_0x40d27e[_0x6557('0x3b')];});}function isNotNull(_0xa0bb26){return _0xa0bb26!==null&&!_[_0x6557('0x3c')](_0xa0bb26);}function msgResponse(_0x151b83,_0x3bab98,_0x27a577){return{'action':_0x151b83,'response':_0x3bab98,'message':_0x27a577,'stack':_0x27a577};}function emit(_0x157627,_0x148018,_0xfee11b){io['to'](_0x157627)[_0x6557('0x3d')](_0x148018,_0xfee11b);}function emitOutboundVoiceQueueSummary(_0x266eb4){if(_0x266eb4['type']==='outbound'){logger['debug'](_0x6557('0x3e'),util['inspect'](_0x266eb4,{'showHidden':![],'depth':null}));emit(util[_0x6557('0x3f')](_0x6557('0x40'),_0x266eb4[_0x6557('0x41')]),_0x6557('0x42'),_0x266eb4);}}function checkGetDataPredictive(_0x16a989){if(isNotNull(_0x16a989)&&!_[_0x6557('0x43')](_0x16a989)){loggerPredictive['info'](_0x6557('0x44'));loggerPredictive['info'](_0x6557('0x45'),_0x16a989['predictiveIntervalTotalCalls']);loggerPredictive[_0x6557('0x46')](_0x6557('0x47'),_0x16a989['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x6557('0x48'),_0x16a989[_0x6557('0x49')]);loggerPredictive[_0x6557('0x46')](_0x6557('0x4a'),_0x16a989[_0x6557('0x4b')]);loggerPredictive[_0x6557('0x46')](_0x6557('0x4c'),_0x16a989[_0x6557('0x4d')]);loggerPredictive[_0x6557('0x46')](_0x6557('0x4e'),_0x16a989['predictiveIntervalAvgTalktime']);loggerPredictive[_0x6557('0x46')](_0x6557('0x4f'));if(_0x16a989['predictiveIntervalTotalCalls']>0x0){if(!_[_0x6557('0x3c')](_0x16a989[_0x6557('0x50')])&&_0x16a989[_0x6557('0x50')]>0x0){return!![];}loggerPredictive[_0x6557('0x46')](_0x6557('0x51'));if(!_[_0x6557('0x3c')](_0x16a989[_0x6557('0x4d')])&&_0x16a989[_0x6557('0x4d')]>0x0){return!![];}loggerPredictive[_0x6557('0x46')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x6557('0x46')](_0x6557('0x52'));}}else{loggerPredictive['info'](_0x6557('0x53'));}return![];}function mergeDataErlangB(_0x601f05){return function(_0xa09a70){loggerPredictive[_0x6557('0x46')](_0x6557('0x54'));loggerPredictive[_0x6557('0x46')](_0x6557('0x55'),_0xa09a70[_0x6557('0x56')]);loggerPredictive[_0x6557('0x46')](_0x6557('0x57'),_0xa09a70['erlangCallToSecond']);loggerPredictive[_0x6557('0x46')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa09a70[_0x6557('0x58')]);loggerPredictive['info'](_0x6557('0x59'),_0xa09a70[_0x6557('0x5a')]);loggerPredictive[_0x6557('0x46')](_0x6557('0x5b'),_0xa09a70['erlangAbandonmentRate']);loggerPredictive[_0x6557('0x46')]('---------------------------');_[_0x6557('0x5c')](_0x601f05,_0xa09a70);};}function ifInterval(_0x3d2010,_0x2977ee){if(_[_0x6557('0x3c')](_0x2977ee)){return![];}return utils[_0x6557('0x5d')](undefined,_0x2977ee)<_0x3d2010*0x3c;}function clearPredictiveAttributes(_0x4f24f9){if(_0x4f24f9[_0x6557('0x23')]){_0x4f24f9[_0x6557('0x23')]=undefined;loggerPredictive[_0x6557('0x5e')](_0x4f24f9[_0x6557('0x41')],_0x6557('0x5f'));}if(_0x4f24f9[_0x6557('0x60')]){_0x4f24f9[_0x6557('0x60')]=undefined;loggerPredictive['debug'](_0x4f24f9['name'],_0x6557('0x61'));}if(_0x4f24f9['handlePredictive']){clearInterval(_0x4f24f9['handlePredictive']);_0x4f24f9[_0x6557('0x62')]=undefined;loggerPredictive[_0x6557('0x5e')](_0x4f24f9[_0x6557('0x41')],_0x6557('0x63'));}}function loggerCatchPredictive(_0x4bfbc7,_0x37d8fa){return function(_0xfa46f3){loggerPredictive['error'](_0x37d8fa[_0x6557('0x41')],_0x4bfbc7);loggerPredictive[_0x6557('0x64')](_0xfa46f3['stack']);clearPredictiveAttributes(_0x37d8fa);};}function loggerCatch(_0x3e7ab9){return function(_0x134374){logger[_0x6557('0x64')](_0x3e7ab9,util['inspect'](_0x134374,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4995e4,_0xd2c104,_0x429ac8){return function(_0x335beb){utils[_0x6557('0x65')](_0xd2c104,_0x429ac8,0x0);_0xd2c104['temp']=0x0;logger[_0x6557('0x64')](_0x4995e4,util[_0x6557('0x66')](_0x335beb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x39fbed){return function(_0x202e5a){if(isNotNull(_0x202e5a)&&isNotNull(_0x202e5a[0x0])){if(_0x202e5a[0x0][_0x6557('0x67')]>0x0){_0x39fbed[_0x6557('0x68')]=utils[_0x6557('0x69')][_0x6557('0x6a')];logger[_0x6557('0x46')]('[getContactDialer2][ReScheduled]'+_0x39fbed[_0x6557('0x41')],_0x202e5a[0x0][_0x6557('0x67')],'contacts');}else{_0x39fbed['message']=utils[_0x6557('0x69')]['NO_AVAILABLE_CONTACTS'];logger[_0x6557('0x46')]('[getContactDialer2][Empty]'+_0x39fbed[_0x6557('0x41')]);}}};}function createObjHistory(_0x3e8349,_0x592088,_0x36d581,_0x2db04b,_0x5233f2){_0x3e8349[_0x6557('0x68')]=_0x36d581;var _0x69328d=new Action(_0x3e8349,_0x592088);var _0x2f388d=new History(_0x69328d);_0x2f388d[_0x6557('0x6b')]=_0x2db04b;_0x2f388d[_0x6557('0x6c')]=_0x5233f2;_0x2f388d[_0x6557('0x6d')]=_0x69328d[_0x6557('0x6e')];return _0x2f388d;}function unlockQueueStatus(_0x33afc9,_0x53b1f0){setTimeout(function(){if(_[_0x6557('0x3c')](_0x33afc9[_0x6557('0x6f')])){loggerBooked['error'](_0x6557('0x70'),_0x53b1f0);}_0x33afc9[_0x6557('0x6f')]=!![];loggerBooked['info'](_0x6557('0x71'),_0x53b1f0,JSON[_0x6557('0x72')](_[_0x6557('0x73')](_0x33afc9,[_0x6557('0x41'),_0x6557('0x6f')])));},0x1f3);}function checkInterval(_0x472bf4){return function(){if(!isNotNull(_0x472bf4[_0x6557('0x74')])){_0x472bf4[_0x6557('0x68')]=utils['CAMPAIGN_STATUS'][_0x6557('0x75')];throw _0x472bf4[_0x6557('0x41')]+_0x6557('0x76');}if(!isNotNull(_0x472bf4[_0x6557('0x74')][_0x6557('0x77')])){_0x472bf4[_0x6557('0x68')]=utils[_0x6557('0x69')]['NULL_INTERVAL'];throw _0x472bf4[_0x6557('0x41')]+_0x6557('0x76');}if(!isNotNull(_['isEmpty'](_0x472bf4['Interval'][_0x6557('0x77')]))){_0x472bf4['message']=utils['CAMPAIGN_STATUS'][_0x6557('0x75')];throw _0x472bf4['name']+_0x6557('0x76');}};}function checkIsIVRCampaignActive(_0x56637e){return function(){if(!utils[_0x6557('0x78')](_0x56637e)){_0x56637e[_0x6557('0x68')]=utils['CAMPAIGN_STATUS'][_0x6557('0x79')];throw _0x56637e['name']+_0x6557('0x7a');}};}function emitCampaignSummary(_0x45f483){if(utils['isIVRCampaign'](_0x45f483)){emit(util[_0x6557('0x3f')](_0x6557('0x7b'),_0x45f483[_0x6557('0x41')]),_0x6557('0x7c'),_0x45f483);}}function loggerCatchQueueSummary(_0x192eb3,_0x28eb5c){return function(_0x11129e){clearPredictiveAttributes(_0x28eb5c);emitCampaignSummary(_0x28eb5c);loggerSyncQueueSummary[_0x6557('0x5e')](_0x192eb3,util['inspect'](_0x11129e,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0xbe12a0){if(_0xbe12a0[_0x6557('0x7d')]){if(_0xbe12a0[_0x6557('0x7e')]===0x0){_0xbe12a0[_0x6557('0x7d')]=![];_0xbe12a0[_0x6557('0x68')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0x6557('0x5e')](_0x6557('0x7f'),_0xbe12a0[_0x6557('0x41')],_0x6557('0x80'));}else{_0xbe12a0[_0x6557('0x68')]=utils[_0x6557('0x69')][_0x6557('0x81')];loggerSyncQueueSummary['debug'](_0x6557('0x7f'),_0xbe12a0['name'],_0x6557('0x82'));}emitCampaignSummary(_0xbe12a0);}}function myreject(_0x4728f5){return function(_0x4b24a2){return _0x4728f5(msgResponse(_0x6557('0x83'),_0x6557('0x84'),JSON['stringify'](_0x4b24a2)));};}Dialer[_0x6557('0x16')]['isTrunkReachable']=function(_0x362d99){return!_[_0x6557('0x3c')](_0x362d99)&&_0x362d99&&!_[_0x6557('0x3c')](_0x362d99['name'])&&!_[_0x6557('0x3c')](_0x362d99[_0x6557('0x85')])&&_0x362d99['active']&&(this[_0x6557('0x1e')][util['format'](_0x6557('0x86'),_0x362d99['name'])]['status']===_0x6557('0x87')||this[_0x6557('0x1e')][util['format'](_0x6557('0x86'),_0x362d99['name'])][_0x6557('0x88')]===_0x6557('0x89'));};Dialer[_0x6557('0x16')][_0x6557('0x8a')]=function(_0x7f3df1){var _0x111300=this;return function(){if(!_0x111300['isTrunkReachable'](_0x7f3df1[_0x6557('0x8b')])){if(!_0x111300[_0x6557('0x8c')](_0x7f3df1[_0x6557('0x8d')])){_0x7f3df1[_0x6557('0x68')]=utils[_0x6557('0x69')][_0x6557('0x8e')];throw _0x7f3df1[_0x6557('0x41')]+_0x6557('0x8f');}}};};Dialer[_0x6557('0x16')][_0x6557('0x90')]=function(_0x472c4b,_0x5832a1,_0x130880,_0x2af083){var _0x6a267a=this;return function(){var _0x54a9bb=!![];return _0x6a267a[_0x6557('0x91')](_0x472c4b,_0x5832a1,_0x130880,_0x2af083,_0x54a9bb);};};Dialer[_0x6557('0x16')][_0x6557('0x92')]=function(_0x125ee5,_0x715c9,_0x2821e2,_0x1e60cf){var _0x5cf8c8=this;return function(){var _0x2959b8=![];return _0x5cf8c8['ifTimeIvr'](_0x125ee5[_0x6557('0x77')],_0x715c9,_0x2821e2,_0x1e60cf,_0x2959b8);};};Dialer[_0x6557('0x16')]['ifTimeIvr']=function(_0x1572e6,_0x27b778,_0x28e5db,_0x445657,_0x428100){var _0x3e57d4=[];return new Promise(function(_0xe4d78e,_0x1950cd){if(!isNotNull(_0x1572e6)){_0x445657[_0x6557('0x68')]=utils[_0x6557('0x69')][_0x6557('0x75')];return _0x1950cd(msgResponse(_0x6557('0x93'),'Failure',_0x28e5db+_0x6557('0x94')));}if(_[_0x6557('0x43')](_0x1572e6)){_0x445657[_0x6557('0x68')]=utils[_0x6557('0x69')][_0x6557('0x95')];return _0x1950cd(msgResponse(_0x6557('0x93'),_0x6557('0x96'),_0x28e5db+_0x6557('0x97')));}if(_0x27b778&&_[_0x6557('0x3c')](config[_0x6557('0x98')][_0x27b778])){_0x445657[_0x6557('0x68')]=utils[_0x6557('0x69')][_0x6557('0x99')];return _0x1950cd(msgResponse(_0x6557('0x93'),'Failure',_0x28e5db+_0x6557('0x9a')+_0x27b778));}if(_[_0x6557('0x9b')](_0x1572e6)){for(var _0x2c863e=0x0;_0x2c863e<_0x1572e6[_0x6557('0x9c')];_0x2c863e+=0x1){_0x3e57d4['push'](ami[_0x6557('0x9d')]({'action':_0x6557('0x9e'),'command':util[_0x6557('0x3f')]('iftime\x20%s,%s',_0x1572e6[_0x2c863e]['interval'],!_[_0x6557('0x3c')](config[_0x6557('0x98')][_0x27b778])?_0x27b778:'')})[_0x6557('0x3a')](function(_0x3cf6a8){return _0x3cf6a8[_0x6557('0x9f')][_0x6557('0xa0')]('true')>=0x0;})[_0x6557('0xa1')](myreject(_0x1950cd)));}}else{_0x3e57d4['push'](ami['Action']({'action':_0x6557('0x9e'),'command':util[_0x6557('0x3f')]('iftime\x20%s,%s',_0x1572e6,!_[_0x6557('0x3c')](config['timezones'][_0x27b778])?_0x27b778:'')})[_0x6557('0x3a')](function(_0x700e81){return _0x700e81['content'][_0x6557('0xa0')](_0x6557('0xa2'))>=0x0;})['catch'](myreject(_0x1950cd)));}Promise[_0x6557('0xa3')](_0x3e57d4)[_0x6557('0x3a')](function(_0x12b837){var _0x2da4ae=_[_0x6557('0xa4')](_0x12b837);if(_0x2da4ae){return _0xe4d78e(_0x2da4ae);}else{_0x445657[_0x6557('0x68')]=_0x428100?utils[_0x6557('0x69')][_0x6557('0xa5')]:utils[_0x6557('0x69')][_0x6557('0xa6')];return _0x1950cd(msgResponse(_0x6557('0xa7'),'Failure',_0x6557('0xa8')+_0x428100+'\x20'+_0x28e5db+'\x20Interval\x20is\x20overtime:\x20'+util[_0x6557('0x66')](_0x1572e6,{'showHidden':![],'depth':null})+_0x6557('0xa9')+_0x27b778));}})[_0x6557('0xa1')](function(_0x25b796){return _0x1950cd(msgResponse('ifTime',_0x6557('0x96'),JSON[_0x6557('0x72')](_0x25b796)));});});};Dialer[_0x6557('0x16')][_0x6557('0xaa')]=function(){var _0x4e99f6=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x6557('0x3a')](function(){setInterval(function(){_0x4e99f6[_0x6557('0xab')]();},0x3e8);});};Dialer[_0x6557('0x16')][_0x6557('0xab')]=function(){var _0x1b5f94=this;var _0x5c019d;for(var _0x3a0dce in this[_0x6557('0x1c')]){if(typeof this[_0x6557('0x1c')][_0x3a0dce]!==_0x6557('0xac')){_0x5c019d=this['campaigns'][_0x3a0dce];if(utils[_0x6557('0xad')](_0x5c019d)&&utils[_0x6557('0x78')](_0x5c019d)){_0x5c019d[_0x6557('0x7d')]=!![];Promise[_0x6557('0xae')]()[_0x6557('0x3a')](checkIsIVRCampaignActive(_0x5c019d))[_0x6557('0x3a')](checkInterval(_0x5c019d))[_0x6557('0x3a')](_0x1b5f94['checkIsTrunkReachable'](_0x5c019d))[_0x6557('0x3a')](_0x1b5f94[_0x6557('0x90')](_0x5c019d['dialGlobalInterval'],_0x5c019d['dialTimezone'],_0x5c019d[_0x6557('0x41')],_0x5c019d))[_0x6557('0x3a')](_0x1b5f94[_0x6557('0x92')](_0x5c019d[_0x6557('0x74')],_0x5c019d[_0x6557('0xaf')],_0x5c019d['name'],_0x5c019d))['then'](_0x1b5f94[_0x6557('0xb0')](_0x5c019d))['catch'](loggerCatchQueueSummary(_0x6557('0xb1'),_0x5c019d));}else{notSendMessagesCampaign(_0x5c019d);}}}};Dialer[_0x6557('0x16')][_0x6557('0xb2')]=function(_0x378c09){if(_0x378c09['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x378c09);}switch(_0x378c09[_0x6557('0xb3')]){case _0x6557('0xb4'):this[_0x6557('0xb5')](_0x378c09,0x1);break;case _0x6557('0xb6'):this[_0x6557('0xb5')](_0x378c09,_0x378c09[_0x6557('0xb7')]);break;case _0x6557('0xa'):this[_0x6557('0xa')](_0x378c09);break;case'booked':this[_0x6557('0xb5')](_0x378c09,0x1);break;default:logger[_0x6557('0x64')](_0x6557('0xb8'),_0x378c09[_0x6557('0x41')],'method\x20not\x20recognized');}};Dialer[_0x6557('0x16')][_0x6557('0x93')]=function(_0x387b2f,_0x253699){var _0x158af7=_0x387b2f[_0x6557('0xaf')];var _0x23ecd5=_0x253699?_0x387b2f[_0x6557('0xb9')]:_0x387b2f[_0x6557('0x74')][_0x6557('0x77')];logger[_0x6557('0xba')](_0x6557('0xbb'),_0x23ecd5,_0x158af7,_0x387b2f[_0x6557('0x41')],util[_0x6557('0x3f')](_0x6557('0xbc'),_0x387b2f[_0x6557('0x41')],_0x387b2f['id']));var _0x18b00a=null;return Interval[_0x6557('0xbd')](_0x23ecd5,_0x158af7)[_0x6557('0x3a')](function(_0x1aab2e){if(_0x1aab2e===!![]){return _0x1aab2e;}else{_0x387b2f['message']=_0x253699?utils[_0x6557('0x69')][_0x6557('0xa5')]:utils['CAMPAIGN_STATUS'][_0x6557('0xa6')];_0x18b00a=msgResponse(_0x6557('0xa7'),_0x6557('0x96'),_0x6557('0xa8')+_0x253699+'\x20'+_0x387b2f['name']+_0x6557('0xbe')+util[_0x6557('0x66')](_0x23ecd5,{'showHidden':![],'depth':null})+_0x6557('0xa9')+_0x158af7);}if(_0x18b00a!==null){logger[_0x6557('0xba')](_0x6557('0xbf'),_0x18b00a);_0x18b00a[_0x6557('0xc0')]=_0x253699;throw _0x18b00a;}})['catch'](function(_0x792cf0){logger[_0x6557('0x64')](_0x6557('0xc1'),_0x792cf0);throw msgResponse(_0x6557('0x83'),_0x6557('0x84'),util['inspect'](_0x792cf0,{'showHidden':![],'depth':null}));});};Dialer[_0x6557('0x16')][_0x6557('0xc2')]=function(_0x5ab22d){if(this[_0x6557('0x1b')][_0x5ab22d[_0x6557('0xc3')]]){if(this[_0x6557('0x22')][_0x5ab22d[_0x6557('0xc4')]]&&this[_0x6557('0x22')][_0x5ab22d['uniqueid']][_0x6557('0xc5')]!=='ivr'){this[_0x6557('0xc6')](this[_0x6557('0x1b')][_0x5ab22d['queue']]);this['uniqueId'][_0x5ab22d[_0x6557('0xc4')]][_0x6557('0xc7')]=moment()[_0x6557('0x3f')](_0x6557('0xc8'));}}};Dialer[_0x6557('0x16')][_0x6557('0x2d')]=function(_0x58fcab){var _0x39aa37=this['uniqueId'][_0x58fcab['uniqueid']];if(this['voiceQueues'][_0x58fcab[_0x6557('0xc3')]]){if(_0x39aa37&&_0x39aa37[_0x6557('0xc5')]!==_0x6557('0xc9')){delete this[_0x6557('0x22')][_0x58fcab[_0x6557('0xc4')]];this[_0x6557('0x1b')][_0x58fcab[_0x6557('0xc3')]][_0x6557('0xca')]+=0x1;var _0x10b9b4=new AgentComplete(_0x39aa37,_0x58fcab);if(_0x58fcab['reason']==='agent'){_0x10b9b4['agiafterat']=this[_0x6557('0x1b')][_0x58fcab[_0x6557('0xc3')]]['dialQueueProject2']&&this[_0x6557('0x1b')][_0x58fcab['queue']]['dialAgiAfterHangupAgent']?moment()[_0x6557('0x3f')](_0x6557('0xc8')):undefined;}hopperUtils[_0x6557('0xcb')](_0x10b9b4)[_0x6557('0xa1')](loggerCatch(_0x6557('0xcc')));hopperUtils[_0x6557('0xcd')](_0x10b9b4)['catch'](loggerCatch(_0x6557('0xce')));}}};Dialer[_0x6557('0x16')]['syncQueueCallerAbandon']=function(_0x3f16d8){var _0x2bb068=this[_0x6557('0x22')][_0x3f16d8[_0x6557('0xc4')]];var _0x2b73a7=this;var _0x47746d=![];var _0x42cd57;var _0x5a0d2f;if(this[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]]){if(_0x2bb068&&_0x2bb068['type']!=='ivr'){delete this[_0x6557('0x22')][_0x3f16d8[_0x6557('0xc4')]];this[_0x6557('0xc6')](this[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]]);_0x2bb068[_0x6557('0xcf')]=moment()[_0x6557('0x3f')](_0x6557('0xc8'));var _0x3356e1=new QueueCallerAbandon(_0x2bb068,_0x3f16d8);if(utils[_0x6557('0x5d')](_0x2bb068[_0x6557('0xcf')],_0x2bb068[_0x6557('0xd0')])>=_0x2bb068[_0x6557('0xd1')]){this[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0x49')]+=0x1;this['voiceQueues'][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xd2')]+=0x1;this[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xd3')]+=0x1;_0x3356e1[_0x6557('0x6b')]=0xa;_0x3356e1[_0x6557('0x6c')]='Drop';_0x3356e1[_0x6557('0xd4')]=_0x6557('0xd5');_0x3356e1[_0x6557('0xd6')]=this[_0x6557('0x1b')][_0x3f16d8['queue']][_0x6557('0xd7')]?moment()[_0x6557('0x3f')](_0x6557('0xc8')):undefined;_0x3356e1[_0x6557('0xd8')]+=0x1;_0x3356e1[_0x6557('0xd9')]+=0x1;_0x42cd57=this['voiceQueues'][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xda')];_0x5a0d2f=this[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xdb')];hopperUtils[_0x6557('0xdc')](_0x3356e1,_0x3356e1[_0x6557('0x6b')],_0x2bb068['voiceQueue'])[_0x6557('0x3a')](function(_0x32a99f){_0x47746d=_0x32a99f[_0x6557('0xdd')]==0x1;if(_0x3356e1[_0x6557('0xd8')]>=_0x2b73a7[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xde')]){_0x2b73a7['queueCallerAbandonCreateState'](_0x3356e1,_0x32a99f[_0x6557('0xdd')]);}else{hopperUtils[_0x6557('0xdf')]({'active':![],'countdropretry':_0x3356e1[_0x6557('0xd8')],'scheduledat':moment()[_0x6557('0xe0')](_0x2b73a7['voiceQueues'][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xda')],_0x6557('0xe1'))[_0x6557('0x3f')](_0x6557('0xc8')),'ContactId':_0x2bb068[_0x6557('0xe2')],'ListId':_0x2bb068[_0x6557('0xe3')],'VoiceQueueId':_0x2bb068[_0x6557('0xe4')]||undefined,'CampaignId':_0x2bb068['CampaignId']||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0xe5')));var _0x171167=new History(_0x3356e1);_0x171167[_0x6557('0x6b')]=0xa;_0x171167[_0x6557('0x6c')]=_0x6557('0xe6');_0x171167[_0x6557('0x6e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x171167[_0x6557('0x6d')]=_0x171167[_0x6557('0x6e')];_0x171167[_0x6557('0xe7')]=_0x3356e1[_0x6557('0xe7')];_0x171167[_0x6557('0xe8')]=_0x3356e1[_0x6557('0xe8')];hopperUtils[_0x6557('0xcb')](_0x171167)[_0x6557('0xa1')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x6557('0x3a')](function(){if(_0x47746d)hopperUtils['swapAdditionalPhones'](_0x3356e1,_0x42cd57,_0x5a0d2f)[_0x6557('0x3a')](function(){return 0x1;});});}else{this['voiceQueues'][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0x4b')]+=0x1;this[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xe9')]+=0x1;_0x3356e1['state']=0xb;_0x3356e1[_0x6557('0x6c')]=_0x6557('0xea');_0x3356e1[_0x6557('0xd4')]=_0x6557('0xeb');_0x3356e1[_0x6557('0xec')]+=0x1;_0x3356e1[_0x6557('0xd9')]+=0x1;_0x42cd57=this[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xed')];_0x5a0d2f=this[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xdb')];hopperUtils['verifyAdditionalPhones'](_0x3356e1,_0x3356e1[_0x6557('0x6b')],_0x2bb068[_0x6557('0xee')])['then'](function(_0x565c72){if(_0x3356e1[_0x6557('0xec')]>=_0x2b73a7[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]][_0x6557('0xef')]){_0x2b73a7[_0x6557('0xf0')](_0x3356e1,_0x565c72[_0x6557('0xdd')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3356e1[_0x6557('0xec')],'scheduledat':moment()[_0x6557('0xe0')](_0x2b73a7[_0x6557('0x1b')][_0x3f16d8[_0x6557('0xc3')]]['dialAbandonedRetryFrequency'],_0x6557('0xe1'))[_0x6557('0x3f')](_0x6557('0xc8')),'ContactId':_0x2bb068[_0x6557('0xe2')],'ListId':_0x2bb068['ListId'],'VoiceQueueId':_0x2bb068[_0x6557('0xe4')]||undefined,'CampaignId':_0x2bb068[_0x6557('0xf1')]||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0xf2')));var _0x55b6ea=new History(_0x3356e1);_0x55b6ea[_0x6557('0x6b')]=0xb;_0x55b6ea['statedesc']=_0x6557('0xea');_0x55b6ea[_0x6557('0x6e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55b6ea[_0x6557('0x6d')]=_0x55b6ea[_0x6557('0x6e')];_0x55b6ea[_0x6557('0xe7')]=_0x3356e1[_0x6557('0xe7')];_0x55b6ea[_0x6557('0xe8')]=_0x3356e1[_0x6557('0xe8')];hopperUtils['createHistory'](_0x55b6ea)['catch'](loggerCatch(_0x6557('0xf3')));}})[_0x6557('0x3a')](function(){if(_0x47746d)hopperUtils[_0x6557('0xf4')](_0x3356e1,_0x42cd57,_0x5a0d2f)[_0x6557('0x3a')](function(){return 0x1;});});}}}};Dialer[_0x6557('0x16')][_0x6557('0xf5')]=function(_0x9aec04){if(this[_0x6557('0x20')][_0x9aec04[_0x6557('0xc4')]]){this[_0x6557('0x20')][_0x9aec04[_0x6557('0xc4')]]['channel']=_0x9aec04[_0x6557('0xf6')];}if(this[_0x6557('0x22')][_0x9aec04[_0x6557('0xc4')]]){this[_0x6557('0x22')][_0x9aec04[_0x6557('0xc4')]][_0x6557('0xf6')]=_0x9aec04[_0x6557('0xf6')];}};Dialer[_0x6557('0x16')][_0x6557('0xf7')]=function(_0x5cf04e){if(!this['actions'][_0x5cf04e[_0x6557('0xf8')]]){return;}var _0x2e419b=this[_0x6557('0x1b')][this[_0x6557('0x20')][_0x5cf04e[_0x6557('0xf8')]]['queue']][_0x6557('0xf9')]||_0x6557('0xfa');if(_0x2e419b===_0x6557('0xfb')){if(this[_0x6557('0x20')][_0x5cf04e[_0x6557('0xf8')]]&&_[_0x6557('0xfc')](this[_0x6557('0x20')][_0x5cf04e[_0x6557('0xf8')]][_0x6557('0xfd')])&&_0x5cf04e[_0x6557('0x88')]==='1'&&_0x5cf04e[_0x6557('0xfe')]==='0'){if(this[_0x6557('0x1d')][_0x5cf04e[_0x6557('0xff')]]){if(!this[_0x6557('0x1d')][_0x5cf04e[_0x6557('0xff')]]['locked']){this[_0x6557('0x1d')][_0x5cf04e[_0x6557('0xff')]]['locked']=!![];this[_0x6557('0x20')][_0x5cf04e[_0x6557('0xf8')]][_0x6557('0xfd')]=!![];this[_0x6557('0x20')][_0x5cf04e[_0x6557('0xf8')]]['stateinterface']=_0x5cf04e[_0x6557('0xff')];}}}}else if(_0x2e419b===_0x6557('0xfa')){if(this[_0x6557('0x20')][_0x5cf04e['actionid']]){if(this[_0x6557('0x1d')][_0x5cf04e[_0x6557('0xff')]]){this[_0x6557('0x20')][_0x5cf04e[_0x6557('0xf8')]]['stateinterface']=_0x5cf04e[_0x6557('0xff')];if(_[_0x6557('0xfc')](this[_0x6557('0x25')][this['actions'][_0x5cf04e[_0x6557('0xf8')]][_0x6557('0xc3')]])){this['queueBooked'][this[_0x6557('0x20')][_0x5cf04e[_0x6557('0xf8')]]['queue']]=[];}this[_0x6557('0x25')][this[_0x6557('0x20')][_0x5cf04e['actionid']][_0x6557('0xc3')]][_0x6557('0x100')](_['merge'](_[_0x6557('0x73')](this[_0x6557('0x20')][_0x5cf04e['actionid']],[_0x6557('0x101'),_0x6557('0xff')]),{'status':_0x5cf04e[_0x6557('0x88')],'paused':_0x5cf04e[_0x6557('0xfe')]}));}}}};Dialer['prototype'][_0x6557('0x37')]=function(_0x196bbe){if(!this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]]){return;}var _0x5539b4=this;var _0x2ac8eb=this[_0x6557('0x1b')][this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]][_0x6557('0xc3')]];var _0x178b01=_0x2ac8eb[_0x6557('0xf9')]||'rrmemory';if(_0x178b01===_0x6557('0xfb')){if(this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]]&&this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]][_0x6557('0xff')]){this[_0x6557('0x1a')][_0x6557('0x102')](this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]][_0x6557('0x101')],this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]][_0x6557('0xff')])['catch'](function(_0x2eb130){logger['error'](_0x6557('0x103'),util['inspect'](_0x2eb130,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5539b4[_0x6557('0xc6')](_0x5539b4['voiceQueues'][_0x5539b4[_0x6557('0x20')][_0x196bbe['actionid']][_0x6557('0xc3')]]);_0x5539b4[_0x6557('0x1d')][_0x5539b4['actions'][_0x196bbe['actionid']][_0x6557('0xff')]][_0x6557('0xfd')]=![];delete _0x5539b4[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]];unlockQueueStatus(_0x2ac8eb);});}else{this[_0x6557('0xc6')](this[_0x6557('0x1b')][this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]][_0x6557('0xc3')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]][_0x6557('0xe2')],'ListId':this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]]['ListId'],'VoiceQueueId':this[_0x6557('0x20')][_0x196bbe['actionid']][_0x6557('0xe4')]||undefined,'CampaignId':this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]][_0x6557('0xf1')]||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0x104')));delete this['actions'][_0x196bbe[_0x6557('0xf8')]];unlockQueueStatus(_0x2ac8eb);}}else if(_0x178b01===_0x6557('0xfa')){var _0x247e9c;if(this[_0x6557('0x20')][_0x196bbe['actionid']]&&!_[_0x6557('0x43')](this[_0x6557('0x25')][this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]][_0x6557('0xc3')]])){if(this['queueBookedRR'][_0x5539b4[_0x6557('0x20')][_0x196bbe['actionid']][_0x6557('0xc3')]]){this['queueBookedRR'][_0x5539b4[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]]['queue']]=this[_0x6557('0x105')][this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]]['queue']]?this[_0x6557('0x105')][this['actions'][_0x196bbe[_0x6557('0xf8')]][_0x6557('0xc3')]]:this[_0x6557('0x25')][this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]][_0x6557('0xc3')]]?this[_0x6557('0x25')][this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]]['queue']]['_rr']||0x0:0x0;}this[_0x6557('0x25')][this['actions'][_0x196bbe[_0x6557('0xf8')]]['queue']][_0x6557('0x106')]=this[_0x6557('0x105')][this[_0x6557('0x20')][_0x196bbe[_0x6557('0xf8')]]['queue']];for(var _0x204134=0x0;_0x204134=_0x236deb[_0x6557('0x124')]){_0x5578e2[_0x6557('0x125')](_0x2a0eee,_0x1c1a6e,_0xcabdfd,'reason19\x20machine....');}else{if(_0x2a0eee['countmachineretry']>=_0x236deb[_0x6557('0x126')]){_0x5578e2[_0x6557('0x127')](_0x2a0eee,_0x1c1a6e,_0xcabdfd,_0x6557('0x128'));}else{hopperUtils[_0x6557('0xdf')]({'active':![],'countmachineretry':_0x2a0eee[_0x6557('0x11f')],'scheduledat':moment()[_0x6557('0xe0')](_0x236deb[_0x6557('0x129')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a0eee['ContactId'],'ListId':_0x2a0eee[_0x6557('0xe3')],'VoiceQueueId':_0x2a0eee[_0x6557('0xe4')]||undefined,'CampaignId':_0x2a0eee[_0x6557('0xf1')]||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0x12a')));_0x1c1a6e({'reschedule':0x1});}}});}if(_0x2264a1[_0x6557('0xc5')]===_0x6557('0xc9')&&this['campaigns'][_0x2264a1[_0x6557('0xc3')]]['dialAMDActive']&&_0xf34702[_0x6557('0x11d')]===_0x6557('0x113')){delete this['uniqueId'][_0xf34702['uniqueid']];this['updateOriginated'](this['campaigns'][_0x2264a1['queue']]);_0x32757c=new Hangup(_0x2264a1,_0xf34702);_0x32757c[_0x6557('0x6b')]=0x12;_0x32757c[_0x6557('0x6c')]=_0x6557('0x115');_0x32757c['membername']=_0x6557('0x117');ami['emit'](_0x6557('0x118'),ut[_0x6557('0x119')](_0x32757c,'amd'));this[_0x6557('0x11b')](_0x32757c,_0x6557('0x12b'),'[syncHangupInAMDIvr]');}if(_0x2264a1[_0x6557('0xc5')]==='ivr'&&this[_0x6557('0x1c')][_0x2264a1[_0x6557('0xc3')]][_0x6557('0x112')]&&_0xf34702[_0x6557('0x11d')]===_0x6557('0x12c')){return new Promise(function(_0x46f192,_0x4606ea){delete _0x5578e2[_0x6557('0x22')][_0xf34702[_0x6557('0xc4')]];_0x5578e2[_0x6557('0xc6')](_0x5578e2['campaigns'][_0x2264a1[_0x6557('0xc3')]]);_0x5578e2['campaigns'][_0x2264a1[_0x6557('0xc3')]][_0x6557('0xca')]+=0x1;_0x5578e2['campaigns'][_0x2264a1[_0x6557('0xc3')]][_0x6557('0x114')]+=0x1;var _0x48247e=_0x5578e2[_0x6557('0x1c')][_0x2264a1['queue']];var _0x3beb03=new Hangup(_0x2264a1,_0xf34702);_0x3beb03[_0x6557('0x6b')]=0x13;_0x3beb03[_0x6557('0x6c')]=_0x6557('0x11e');_0x3beb03[_0x6557('0x116')]=_0x6557('0x117');_0x3beb03[_0x6557('0x11f')]+=0x1;_0x3beb03['countglobal']+=0x1;_0x3beb03[_0x6557('0x11a')]=!![];ami['emit'](_0x6557('0x118'),ut['buildObj'](_0x3beb03,_0x6557('0x11a')));hopperUtils[_0x6557('0xcb')](_0x3beb03)[_0x6557('0xa1')](loggerCatch(_0x6557('0x120')));if(_0x3beb03[_0x6557('0x121')]+_0x3beb03['countcongestionretry']+_0x3beb03['countnoanswerretry']+_0x3beb03[_0x6557('0x122')]+_0x3beb03[_0x6557('0xd8')]+_0x3beb03['countabandonedretry']+_0x3beb03['countmachineretry']+_0x3beb03[_0x6557('0x123')]>=_0x48247e[_0x6557('0x124')]){_0x5578e2[_0x6557('0x125')](_0x3beb03,_0x46f192,_0x4606ea,'reason19\x20machine....');}else{if(_0x3beb03[_0x6557('0x11f')]>=_0x48247e[_0x6557('0x126')]){_0x5578e2[_0x6557('0x127')](_0x3beb03,_0x46f192,_0x4606ea,'reason\x2019\x20machine....');}else{hopperUtils[_0x6557('0xdf')]({'active':![],'countmachineretry':_0x3beb03['countmachineretry'],'scheduledat':moment()[_0x6557('0xe0')](_0x48247e[_0x6557('0x129')],_0x6557('0xe1'))[_0x6557('0x3f')](_0x6557('0xc8')),'ContactId':_0x3beb03[_0x6557('0xe2')],'ListId':_0x3beb03['ListId'],'VoiceQueueId':_0x3beb03['VoiceQueueId']||undefined,'CampaignId':_0x3beb03[_0x6557('0xf1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x46f192({'reschedule':0x1});}}});}}};Dialer[_0x6557('0x16')][_0x6557('0x31')]=function(_0x1ea443){var _0x303244=this[_0x6557('0x22')][_0x1ea443['uniqueid']];var _0x201565;if(_0x303244&&_0x303244[_0x6557('0xc5')]==='ivr'){delete this[_0x6557('0x22')][_0x1ea443[_0x6557('0xc4')]];this[_0x6557('0xc6')](this[_0x6557('0x1c')][_0x303244[_0x6557('0xc3')]]);this[_0x6557('0x1c')][_0x303244['queue']][_0x6557('0x12d')]+=0x1;_0x201565=new Hangup(_0x303244,_0x1ea443);hopperUtils['createHistory'](_0x201565)[_0x6557('0xa1')](loggerCatch(_0x6557('0x12e')));hopperUtils['moveContactManagedDialer'](_0x201565)[_0x6557('0xa1')](loggerCatch(_0x6557('0x12f')));}if(_0x303244&&_0x303244[_0x6557('0xc5')]!==_0x6557('0xc9')&&isNotNull(this[_0x6557('0x1b')][_0x303244['queue']][_0x6557('0x130')])){delete this[_0x6557('0x22')][_0x1ea443[_0x6557('0xc4')]];this[_0x6557('0xc6')](this['voiceQueues'][_0x303244[_0x6557('0xc3')]]);this['voiceQueues'][_0x303244[_0x6557('0xc3')]][_0x6557('0xca')]+=0x1;this[_0x6557('0x1b')][_0x303244[_0x6557('0xc3')]][_0x6557('0x114')]+=0x1;_0x201565=new Hangup(_0x303244,_0x1ea443);_0x201565[_0x6557('0x6b')]=0x10;_0x201565['statedesc']=_0x6557('0x131');_0x201565[_0x6557('0x116')]=_0x6557('0x132');hopperUtils[_0x6557('0xcb')](_0x201565)[_0x6557('0xa1')](loggerCatch(_0x6557('0x12e')));hopperUtils[_0x6557('0xcd')](_0x201565)[_0x6557('0xa1')](loggerCatch(_0x6557('0x12f')));}if(_0x303244&&_0x303244[_0x6557('0xc5')]!==_0x6557('0xc9')&&!isNotNull(this[_0x6557('0x1b')][_0x303244[_0x6557('0xc3')]][_0x6557('0x130')])){if(_0x1ea443[_0x6557('0x133')]===_0x6557('0x134')){delete this['uniqueId'][_0x1ea443[_0x6557('0xc4')]];this[_0x6557('0x1b')][_0x303244['queue']]['outboundAnswerCallsDay']+=0x1;const _0x2c7deb=new AgentComplete(_0x303244,_0x1ea443);_0x2c7deb['CampaignId']=this[_0x6557('0x1b')][_0x303244[_0x6557('0xc3')]]['id'];hopperUtils['createHistory'](_0x2c7deb)[_0x6557('0xa1')](loggerCatch(_0x6557('0xcc')));hopperUtils[_0x6557('0xcd')](_0x2c7deb)[_0x6557('0xa1')](loggerCatch('[syncAgentComplete]'));}else{delete this[_0x6557('0x22')][_0x1ea443[_0x6557('0xc4')]];this['updateOriginated'](this['voiceQueues'][_0x303244[_0x6557('0xc3')]]);this[_0x6557('0x1b')][_0x303244[_0x6557('0xc3')]]['outboundUnknownCallsDay']+=0x1;_0x201565=new Hangup(_0x303244,_0x1ea443);_0x201565['state']=0xc;_0x201565['statedesc']=_0x1ea443[_0x6557('0x133')];_0x201565['membername']=_0x6557('0x135');hopperUtils['createHistory'](_0x201565)[_0x6557('0xa1')](loggerCatch(_0x6557('0x12e')));hopperUtils[_0x6557('0xcd')](_0x201565)[_0x6557('0xa1')](loggerCatch(_0x6557('0x12f')));}}};Dialer[_0x6557('0x16')]['syncQueueSummary']=function(_0x132295){var _0x14d82c=this;if(!_0x14d82c[_0x6557('0x136')][_0x132295[_0x6557('0x41')]]){_0x14d82c[_0x6557('0x136')][_0x132295['name']]={'running':![]};}else if(_0x14d82c[_0x6557('0x136')][_0x132295[_0x6557('0x41')]][_0x6557('0x137')]===!![]){return;}else if(_0x14d82c['queuesSummary'][_0x132295[_0x6557('0x41')]]['running']===![]){_0x14d82c[_0x6557('0x136')][_0x132295[_0x6557('0x41')]][_0x6557('0x137')]=!![];}var _0x5aed7f=_0x14d82c[_0x6557('0x1b')][_0x132295['name']];var _0xc61e34=_0x5aed7f[_0x6557('0x68')]!==utils[_0x6557('0x69')][_0x6557('0x79')];var _0x545a68=utils['isPreviewCampaign'](_0x5aed7f);_0x5aed7f[_0x6557('0x138')]=utils[_0x6557('0x139')](_0x5aed7f,_0x14d82c['trunks']);Promise[_0x6557('0xae')]()[_0x6557('0x3a')](function(){if(_0x5aed7f['statusMessage']===utils[_0x6557('0x69')][_0x6557('0x79')]){if(_0xc61e34){clearPredictiveAttributes(_0x5aed7f);_0x132295[_0x6557('0x60')]=undefined;_0x132295[_0x6557('0x23')]=undefined;}if(_0x5aed7f[_0x6557('0x138')]===utils['CAMPAIGN_STATUS'][_0x6557('0x79')]){_0x132295['available']=0x0;_0x132295[_0x6557('0xfe')]=0x0;_0x132295[_0x6557('0x13a')]=0x0;_0x132295['talking']=0x0;_0x132295[_0x6557('0x13b')]=0x0;}}else if(_0x5aed7f['statusMessage']===utils[_0x6557('0x69')]['ACTIVE']&&!_0x545a68){return _0x14d82c[_0x6557('0x93')](_0x5aed7f,!![])[_0x6557('0x3a')](function(){return _0x14d82c['ifTime'](_0x5aed7f,![]);})['then'](function(){return _0x14d82c['checkDialMethod'](_0x5aed7f);})['catch'](function(_0x43ffc6){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util['inspect'](_0x43ffc6,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5aed7f);});}else{clearPredictiveAttributes(_0x5aed7f);}})[_0x6557('0x3a')](function(){var _0x105ad5=_0x132295[_0x6557('0x13c')](_0x5aed7f);if(_0x105ad5||_0x5aed7f[_0x6557('0x13d')]){_0x5aed7f['queueSummaryCountersUpdated']=![];_0x132295[_0x6557('0x13e')](_0x5aed7f);Object['assign'](_0x5aed7f,_0x132295);emitOutboundVoiceQueueSummary(_0x132295);}_0x14d82c[_0x6557('0x136')][_0x5aed7f[_0x6557('0x41')]][_0x6557('0x137')]=![];})[_0x6557('0xa1')](function(_0x4064c3){logger[_0x6557('0x64')](_0x6557('0x13f'),util[_0x6557('0x66')](_0x4064c3,{'showHidden':![],'depth':null}));_0x14d82c['queuesSummary'][_0x5aed7f[_0x6557('0x41')]]['running']=![];});};Dialer[_0x6557('0x16')][_0x6557('0x2f')]=_[_0x6557('0x140')](function(){var _0x3608db=_[_0x6557('0x141')](this[_0x6557('0x1b')],function(_0x3bf553){return _0x3bf553[_0x6557('0x142')];});var _0x440c9f=_[_0x6557('0x141')](this[_0x6557('0x1d')],function(_0x5b294b){return _0x5b294b['online']&&_0x5b294b[_0x6557('0x88')]===_0x6557('0x87');});if(_0x3608db[_0x6557('0x9c')]>0x0&&_0x440c9f[_0x6557('0x9c')]>0x0){return Promise['resolve']()[_0x6557('0x3a')](cmHopper[_0x6557('0x143')](_['map'](_0x3608db,'id'),previewRecallmeReminderInterval,_[_0x6557('0x144')](_0x440c9f,'id')))[_0x6557('0x3a')](function(_0x278949){for(var _0x29a503=0x0;_0x29a503<_0x278949[_0x6557('0x9c')];_0x29a503++){var _0x242ea1=_0x278949[_0x29a503]['Agent'][_0x6557('0x41')];if(_0x242ea1)io['to'](util[_0x6557('0x3f')](_0x6557('0x145'),_0x242ea1))['emit'](_0x6557('0x146'),{'hopper':_0x278949[_0x29a503]});}})['catch'](function(_0x3bdb94){logger[_0x6557('0x64')](_0x6557('0x147'),_0x3bdb94);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x6557('0x38')]=function(){var _0x4f32c3=this;setInterval(function(){_0x4f32c3[_0x6557('0x148')](_0x4f32c3[_0x6557('0x22')],_0x6557('0x149'));_0x4f32c3[_0x6557('0x148')](_0x4f32c3['actions'],_0x6557('0x14a'));},0x32c8);};Dialer[_0x6557('0x16')][_0x6557('0x148')]=function(_0x1f184c,_0x376259){var _0x13fb7a=this;for(var _0x4abb80 in _0x1f184c){if(typeof _0x1f184c[_0x4abb80]!==_0x6557('0xac')){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x1f184c[_0x4abb80])){return ami[_0x6557('0x9d')]({'action':_0x6557('0x88'),'channel':_0x1f184c[_0x4abb80][_0x6557('0xf6')]})['catch'](function(_0x5b9253){if(_0x5b9253[_0x6557('0x68')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1f184c[_0x4abb80]&&_0x1f184c[_0x4abb80][_0x6557('0xc5')]!==_0x6557('0xc9')){_0x13fb7a[_0x6557('0xc6')](_0x13fb7a['voiceQueues'][_0x1f184c[_0x4abb80][_0x6557('0xc3')]]);logger[_0x6557('0x64')]('[Dialer][checkChannel]',_0x376259,_0x4abb80,_0x1f184c[_0x4abb80][_0x6557('0xc3')]);delete _0x1f184c[_0x4abb80];}if(_0x1f184c[_0x4abb80]&&_0x1f184c[_0x4abb80][_0x6557('0xc5')]===_0x6557('0xc9')){_0x13fb7a['updateOriginated'](_0x13fb7a[_0x6557('0x1c')][_0x1f184c[_0x4abb80]['queue']]);logger['error'](_0x6557('0x14b'),_0x376259,_0x4abb80,_0x1f184c[_0x4abb80]['queue']);delete _0x1f184c[_0x4abb80];}},0x2328);}});}});}}};Dialer['prototype'][_0x6557('0x14c')]=function(_0x3a9771){return Promise[_0x6557('0xae')]()[_0x6557('0x3a')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3a9771))[_0x6557('0xa1')](loggerCatch(_0x6557('0x14d')));};Dialer[_0x6557('0x16')][_0x6557('0xc6')]=function(_0x177f8c){if(!_[_0x6557('0x3c')](_0x177f8c)&&_0x177f8c!==null){if(typeof _0x177f8c['originated']!=='undefined'){if(_0x177f8c[_0x6557('0x7e')]>0x0){_0x177f8c[_0x6557('0x7e')]-=0x1;}else{logger[_0x6557('0x64')](_0x6557('0x14e'));}}}else{logger[_0x6557('0x64')](_0x6557('0x14f'));}};Dialer[_0x6557('0x16')][_0x6557('0x150')]=function(_0x42c89a,_0x197ceb){var _0x53d612=this;return function(_0x4ad0b7){_0x53d612[_0x6557('0xc6')](_0x197ceb);logger[_0x6557('0x64')](_0x42c89a,util[_0x6557('0x66')](_0x4ad0b7,{'showHidden':![],'depth':null}));};};Dialer[_0x6557('0x16')][_0x6557('0x151')]=function(_0x411e87,_0x37d35b,_0x54b1b5){var _0x45632b={'state':0x19,'statedesc':_0x6557('0x152')};this[_0x6557('0xc6')](_0x37d35b);this[_0x6557('0x11b')](_[_0x6557('0x5c')](_0x45632b,_[_0x6557('0x73')](_0x54b1b5,[_0x6557('0xe2'),_0x6557('0xe3'),_0x6557('0x153'),_0x6557('0xe4'),'CampaignId'])),'[emptyContact][createHistory]','[emptyContact]');logger[_0x6557('0x64')](_0x411e87);};Dialer['prototype'][_0x6557('0x11b')]=function(_0x3147a5,_0x4e43f5,_0x3c3788){hopperUtils[_0x6557('0xcb')](_0x3147a5)[_0x6557('0xa1')](loggerCatch(_0x4e43f5));hopperUtils[_0x6557('0xcd')](_0x3147a5)['catch'](loggerCatch(_0x3c3788));};Dialer[_0x6557('0x16')][_0x6557('0xf0')]=function(_0x35c7e2,_0x3968b3){hopperUtils['createHistory'](_0x35c7e2)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x3968b3==0x0){hopperUtils[_0x6557('0xcd')](_0x35c7e2)[_0x6557('0xa1')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x6557('0x16')]['checkPreviewRecallReminder']=function(_0x474267){return Promise['resolve']()[_0x6557('0x3a')](cmHopper[_0x6557('0x143')](_0x474267['id'],previewRecallmeReminderInterval))[_0x6557('0x3a')](function(_0x498e8c){for(var _0x5702c6=0x0;_0x5702c6<_0x498e8c[_0x6557('0x9c')];_0x5702c6++){var _0x1293c2=_0x498e8c[_0x5702c6][_0x6557('0x154')]['name'];if(_0x1293c2)io['to'](util[_0x6557('0x3f')](_0x6557('0x145'),_0x1293c2))[_0x6557('0x3d')](_0x6557('0x146'),{'hopper':_0x498e8c[_0x5702c6]});}})[_0x6557('0xa1')](function(){});};Dialer['prototype'][_0x6557('0xb0')]=function(_0x20603e){var _0x3776cf=this;return function(){_0x3776cf[_0x6557('0x155')](_0x20603e);};};Dialer['prototype'][_0x6557('0x156')]=function(_0x21d215,_0x36a285){var _0x465107=this;var _0x41d785=uuid['v4']();this['actions'][_0x41d785]=new Action(_0x21d215,_0x36a285,_0x41d785);return new Promise(function(_0x1654bc,_0x5575d6){if(_[_0x6557('0x3c')](_0x21d215)&&typeof _0x21d215!==_0x6557('0x157')){return _0x5575d6(msgResponse(_0x6557('0x158'),_0x6557('0x96'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x36a285['phone'])||_0x36a285[_0x6557('0x159')]===null){return _0x5575d6(msgResponse('originate','Failure',_0x6557('0x15a')));}var _0xa8d834={'XMD-CALLERID':_0x465107[_0x6557('0x20')][_0x41d785][_0x6557('0x15b')](),'XMD-AGI':_0x21d215['dialQueueProject']?util[_0x6557('0x3f')](_0x6557('0x15c'),ipAgi,_0x21d215[_0x6557('0x130')]):'NONE','XMD-AGIAFTER':_0x21d215[_0x6557('0xd7')]?util[_0x6557('0x3f')](_0x6557('0x15c'),ipAgi,_0x21d215['dialQueueProject2']):_0x6557('0x15d'),'XMD-QUEUE':utils[_0x6557('0x15e')](_0x21d215)?util['format'](_0x6557('0x15f'),_0x21d215['name'],_0x21d215[_0x6557('0x160')]||'',_0x21d215[_0x6557('0x161')]?'c':'',_0x21d215[_0x6557('0xd1')]||0x3):_0x6557('0x15d'),'XMD-CONTACTID':_0x36a285[_0x6557('0xe2')],'XMD-CDRTYPE':_0x6557('0x9'),'CALLERID(all)':_0x465107['actions'][_0x41d785][_0x6557('0x15b')](),'XMD-AMD':_0x21d215[_0x6557('0x112')]?_0x6557('0x162'):'NONE','XMD-DESTINATION':_0x6557('0x163')};if(_0x21d215[_0x6557('0x112')]){_0xa8d834['XMD-AMDINITIALSILENCE']=_0x21d215[_0x6557('0x164')]||0x9c4;_0xa8d834[_0x6557('0x165')]=_0x21d215['dialAMDGreeting']||0x5dc;_0xa8d834['XMD-AMDAFTERGREETINGSILENCE']=_0x21d215[_0x6557('0x166')]||0x320;_0xa8d834['XMD-AMDTOTALANALYSISTIME']=_0x21d215[_0x6557('0x167')]||0x1388;_0xa8d834['XMD-AMDMINWORDLENGTH']=_0x21d215['dialAMDMinWordLength']||0x64;_0xa8d834[_0x6557('0x168')]=_0x21d215[_0x6557('0x169')]||0x32;_0xa8d834[_0x6557('0x16a')]=_0x21d215[_0x6557('0x16b')]||0x3;_0xa8d834[_0x6557('0x16c')]=_0x21d215[_0x6557('0x16d')]||0x100;_0xa8d834[_0x6557('0x16e')]=_0x21d215[_0x6557('0x16f')]||0x1388;}if(utils[_0x6557('0x15e')](_0x21d215)){_0xa8d834['XMD-VOICEQUEUEID']=_0x36a285[_0x6557('0xe4')];}else{_0xa8d834['XMD-CAMPAIGNID']=_0x36a285[_0x6557('0xf1')];}var _0x353c43=utils[_0x6557('0x170')](_0x36a285['Contact']);Object['assign'](_0xa8d834,_0x353c43);var _0x2faf5f=_0x465107[_0x6557('0x8c')](_0x21d215[_0x6557('0x8b')])?utils['getCallerId'](_0x21d215[_0x6557('0x8b')][_0x6557('0x171')],_0x21d215[_0x6557('0x172')],_0x21d215['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x6557('0x173')](_0x21d215[_0x6557('0x174')],_0x21d215['dialRandomLastDigitCallerIdNumber']):_0x21d215[_0x6557('0x174')]):utils['getCallerId'](_['isNil'](_0x21d215[_0x6557('0x8d')])?_0x21d215[_0x6557('0x8b')][_0x6557('0x171')]:_0x21d215[_0x6557('0x8d')][_0x6557('0x171')],_0x21d215[_0x6557('0x172')],_0x21d215[_0x6557('0x175')]>0x0?utils[_0x6557('0x173')](_0x21d215[_0x6557('0x174')],_0x21d215['dialRandomLastDigitCallerIdNumber']):_0x21d215[_0x6557('0x174')]);if(_0x2faf5f){_0xa8d834[_0x6557('0x176')]=_0x465107['actions'][_0x41d785]['originatecalleridname']=utils[_0x6557('0x177')](_0x2faf5f);_0xa8d834[_0x6557('0x178')]=_0x36a285[_0x6557('0x159')];}_0x21d215[_0x6557('0x179')]=_0xa8d834;return ami[_0x6557('0x9d')]({'actionid':_0x41d785,'action':_0x6557('0x158'),'channel':_0x465107['isTrunkReachable'](_0x21d215[_0x6557('0x8b')])?util[_0x6557('0x3f')](_0x6557('0x17a'),_0x21d215[_0x6557('0x8b')]['name'],isNotNull(_0x21d215[_0x6557('0x17b')])?_0x21d215[_0x6557('0x17b')][_0x6557('0x17c')]()||'':'',_0x21d215['dialCutDigit']>0x0?_0x36a285['phone']['substring'](_0x21d215['dialCutDigit']):_0x36a285[_0x6557('0x159')]):util[_0x6557('0x3f')](_0x6557('0x17a'),_[_0x6557('0xfc')](_0x21d215[_0x6557('0x8d')])?_0x21d215[_0x6557('0x8b')][_0x6557('0x41')]:_0x21d215[_0x6557('0x8d')][_0x6557('0x41')],isNotNull(_0x21d215[_0x6557('0x17b')])?_0x21d215[_0x6557('0x17b')][_0x6557('0x17c')]()||'':'',_0x21d215[_0x6557('0x17d')]>0x0?_0x36a285[_0x6557('0x159')][_0x6557('0x17e')](_0x21d215['dialCutDigit']):_0x36a285[_0x6557('0x159')]),'callerid':_0x2faf5f,'Exten':'xcally-motion-dialer','Context':_0x6557('0x17f'),'Priority':'1','variable':_0xa8d834,'timeout':(_0x21d215[_0x6557('0x180')]||0x1e)*0x3e8,'async':!![],'channelid':_0x41d785})[_0x6557('0x3a')](function(_0x29af51){return _0x1654bc(_0x29af51);})[_0x6557('0xa1')](function(_0x13450e){_0x21d215[_0x6557('0x181')]+=0x1;var _0x3e0e55=new History(_0x465107[_0x6557('0x20')][_0x41d785]);logger[_0x6557('0x64')](util[_0x6557('0x3f')]('[originateError]:\x20%s',JSON['stringify'](_0x13450e)));_0x3e0e55[_0x6557('0x6b')]=0xe;_0x3e0e55[_0x6557('0x6c')]=_0x6557('0x182');_0x3e0e55[_0x6557('0x6e')]=moment()[_0x6557('0x3f')](_0x6557('0xc8'));_0x3e0e55[_0x6557('0x6d')]=_0x3e0e55[_0x6557('0x6e')];hopperUtils[_0x6557('0xcb')](_0x3e0e55)['catch'](loggerCatch(_0x6557('0x183')));_0x465107[_0x6557('0xcd')](_0x3e0e55)[_0x6557('0xa1')](loggerCatch('[originate][error]'))[_0x6557('0x19')](function(){delete _0x465107[_0x6557('0x20')][_0x41d785];return _0x5575d6(msgResponse(_0x6557('0x158'),_0x6557('0x84'),_0x6557('0x184')));});});});};Dialer['prototype'][_0x6557('0x185')]=function(_0x161dd9,_0x390f88,_0x34a2fe){var _0x18528a=new History(_0x390f88);if(_0x18528a['countbusyretry']+_0x18528a[_0x6557('0x186')]+_0x18528a[_0x6557('0x187')]+_0x18528a['countnosuchnumberretry']+_0x18528a[_0x6557('0xd8')]+_0x18528a[_0x6557('0xec')]+_0x18528a['countmachineretry']+_0x18528a[_0x6557('0x123')]>=_0x34a2fe['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x161dd9){case 0x3:if(_0x18528a[_0x6557('0x187')]>=_0x34a2fe[_0x6557('0x188')]-0x1){return!![];}hopperUtils[_0x6557('0xdf')]({'active':![],'countnoanswerretry':_0x18528a[_0x6557('0x187')]+=0x1,'scheduledat':moment()['add'](_0x34a2fe[_0x6557('0x189')],_0x6557('0xe1'))[_0x6557('0x3f')](_0x6557('0xc8')),'ContactId':_0x18528a[_0x6557('0xe2')],'ListId':_0x18528a[_0x6557('0xe3')],'VoiceQueueId':_0x18528a[_0x6557('0xe4')]||undefined,'CampaignId':_0x18528a[_0x6557('0xf1')]||undefined})[_0x6557('0xa1')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x18528a[_0x6557('0x121')]>=_0x34a2fe[_0x6557('0x18a')]-0x1){return!![];}hopperUtils[_0x6557('0xdf')]({'active':![],'countbusyretry':_0x18528a[_0x6557('0x121')]+=0x1,'scheduledat':moment()[_0x6557('0xe0')](_0x34a2fe['dialBusyRetryFrequency'],_0x6557('0xe1'))[_0x6557('0x3f')](_0x6557('0xc8')),'ContactId':_0x18528a[_0x6557('0xe2')],'ListId':_0x18528a[_0x6557('0xe3')],'VoiceQueueId':_0x18528a['VoiceQueueId']||undefined,'CampaignId':_0x18528a[_0x6557('0xf1')]||undefined})['catch'](loggerCatch(_0x6557('0x18b')));break;case 0x8:if(_0x18528a[_0x6557('0x186')]>=_0x34a2fe[_0x6557('0x18c')]-0x1){return!![];}hopperUtils[_0x6557('0xdf')]({'active':![],'countcongestionretry':_0x18528a[_0x6557('0x186')]+=0x1,'scheduledat':moment()[_0x6557('0xe0')](_0x34a2fe[_0x6557('0x18d')],_0x6557('0xe1'))[_0x6557('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x18528a[_0x6557('0xe2')],'ListId':_0x18528a[_0x6557('0xe3')],'VoiceQueueId':_0x18528a[_0x6557('0xe4')]||undefined,'CampaignId':_0x18528a['CampaignId']||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0x18e')));break;case 0x0:if(_0x18528a['countnosuchnumberretry']>=_0x34a2fe[_0x6557('0x18f')]-0x1){return!![];}else{hopperUtils[_0x6557('0xdf')]({'active':![],'countnosuchnumberretry':_0x18528a['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x34a2fe[_0x6557('0x190')],'minutes')['format'](_0x6557('0xc8')),'ContactId':_0x18528a[_0x6557('0xe2')],'ListId':_0x18528a[_0x6557('0xe3')],'VoiceQueueId':_0x18528a[_0x6557('0xe4')]||undefined,'CampaignId':_0x18528a['CampaignId']||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0x191')));}break;case 0xa:if(_0x18528a['countdropretry']>=_0x34a2fe[_0x6557('0xde')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x18528a[_0x6557('0xd8')]+=0x1,'scheduledat':moment()[_0x6557('0xe0')](_0x34a2fe['dialDropRetryFrequency'],_0x6557('0xe1'))[_0x6557('0x3f')](_0x6557('0xc8')),'ContactId':_0x18528a[_0x6557('0xe2')],'ListId':_0x18528a[_0x6557('0xe3')],'VoiceQueueId':_0x18528a[_0x6557('0xe4')]||undefined,'CampaignId':_0x18528a['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x18528a['countabandonedretry']>=_0x34a2fe[_0x6557('0xef')]-0x1){return!![];}hopperUtils[_0x6557('0xdf')]({'active':![],'countabandonedretry':_0x18528a[_0x6557('0xec')]+=0x1,'scheduledat':moment()[_0x6557('0xe0')](_0x34a2fe['dialAbandonedRetryFrequency'],_0x6557('0xe1'))[_0x6557('0x3f')](_0x6557('0xc8')),'ContactId':_0x18528a[_0x6557('0xe2')],'ListId':_0x18528a['ListId'],'VoiceQueueId':_0x18528a[_0x6557('0xe4')]||undefined,'CampaignId':_0x18528a['CampaignId']||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0xf2')));break;case 0x13:if(_0x18528a[_0x6557('0x11f')]>=_0x34a2fe[_0x6557('0x126')]-0x1){return!![];}hopperUtils[_0x6557('0xdf')]({'active':![],'countmachineretry':_0x18528a[_0x6557('0x11f')]+=0x1,'scheduledat':moment()[_0x6557('0xe0')](_0x34a2fe['dialMachineRetryFrequency'],_0x6557('0xe1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x18528a[_0x6557('0xe2')],'ListId':_0x18528a['ListId'],'VoiceQueueId':_0x18528a[_0x6557('0xe4')]||undefined,'CampaignId':_0x18528a[_0x6557('0xf1')]||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0x12a')));break;case 0x14:if(_0x18528a[_0x6557('0x123')]>=_0x34a2fe['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x6557('0xdf')]({'active':![],'countagentrejectretry':_0x18528a[_0x6557('0x123')]+=0x1,'scheduledat':moment()['add'](_0x34a2fe[_0x6557('0x192')],_0x6557('0xe1'))[_0x6557('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x18528a['ContactId'],'ListId':_0x18528a['ListId'],'VoiceQueueId':_0x18528a[_0x6557('0xe4')]||undefined,'CampaignId':_0x18528a[_0x6557('0xf1')]||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0x193')));break;default:return!![];}};Dialer[_0x6557('0x16')][_0x6557('0x10e')]=function(_0x26641e,_0x4c1b40,_0x5ec7c2){var _0x5e005c=this;var _0x3557c6=new History(_0x26641e);var _0x47f3ec=![];var _0xbbc94;var _0x4f772b;return new Promise(function(_0x173acb,_0x2d6c87){if(_[_0x6557('0x3c')](_0x4c1b40)&&typeof _0x4c1b40!==_0x6557('0x157')){return _0x2d6c87(msgResponse('[callProgressDetecting]',_0x6557('0x96'),_0x6557('0x194')));}if(_[_0x6557('0x3c')](_0x5ec7c2)&&typeof _0x5ec7c2!==_0x6557('0x157')){return _0x2d6c87(msgResponse('[callProgressDetecting]','Failure',_0x6557('0x195')));}hopperUtils[_0x6557('0xdc')](_0x3557c6,_0x5ec7c2['reason'],_0x4c1b40)[_0x6557('0x3a')](function(_0x68f333){if(_0x68f333[_0x6557('0xdd')]==0x1)_0x47f3ec=!![];switch(_0x5ec7c2[_0x6557('0x196')]){case'0':_0x4c1b40[_0x6557('0x197')]+=0x1;_0x3557c6[_0x6557('0x6b')]=0x0;_0x3557c6['statedesc']=_0x6557('0x198');_0x3557c6[_0x6557('0x122')]+=0x1;_0x3557c6[_0x6557('0xd9')]+=0x1;ami[_0x6557('0x3d')](_0x6557('0x199'),ut[_0x6557('0x119')](_0x26641e,_0x6557('0x19a')));_0xbbc94=_0x4c1b40['dialNoSuchNumberRetryFrequency'];_0x4f772b=_0x4c1b40[_0x6557('0xdb')];hopperUtils[_0x6557('0xcb')](_0x3557c6)[_0x6557('0xa1')](loggerCatch(_0x6557('0x120')));if(_0x5e005c[_0x6557('0x185')](0x0,_0x26641e,_0x4c1b40)&&!_0x47f3ec){if(_0x3557c6[_0x6557('0x122')]>=_0x4c1b40['dialNoSuchNumberMaxRetry']){_0x5e005c['createStateFinal'](_0x3557c6,_0x173acb,_0x2d6c87,_0x6557('0x19b'));}else{_0x5e005c[_0x6557('0x125')](_0x3557c6,_0x173acb,_0x2d6c87,_0x6557('0x19b'));}}break;case'3':_0x4c1b40[_0x6557('0x19c')]+=0x1;_0x3557c6['state']=0x3;_0x3557c6[_0x6557('0x6c')]=_0x6557('0x19d');_0x3557c6[_0x6557('0x187')]+=0x1;_0x3557c6[_0x6557('0xd9')]+=0x1;var _0x24c1e2=ut['buildNoAnswerEventPayload'](_0x26641e,_0x4c1b40);ami['emit'](_0x6557('0x19e'),_0x24c1e2);_0xbbc94=_0x4c1b40[_0x6557('0x189')];_0x4f772b=_0x4c1b40[_0x6557('0xdb')];hopperUtils[_0x6557('0xcb')](_0x3557c6)[_0x6557('0xa1')](loggerCatch(_0x6557('0x19f')));if(_0x5e005c[_0x6557('0x185')](0x3,_0x26641e,_0x4c1b40)&&!_0x47f3ec){if(_0x3557c6[_0x6557('0x187')]>=_0x4c1b40[_0x6557('0x188')]){_0x5e005c[_0x6557('0x127')](_0x3557c6,_0x173acb,_0x2d6c87,'reason\x203\x20ringing\x20no\x20answer');}else{_0x5e005c[_0x6557('0x125')](_0x3557c6,_0x173acb,_0x2d6c87,_0x6557('0x1a0'));}}break;case'5':_0x4c1b40['outboundBusyCallsDay']+=0x1;_0x3557c6[_0x6557('0x6b')]=0x5;_0x3557c6[_0x6557('0x6c')]=_0x6557('0x1a1');_0x3557c6[_0x6557('0x121')]+=0x1;_0x3557c6['countglobal']+=0x1;ami[_0x6557('0x3d')](_0x6557('0x1a2'),ut[_0x6557('0x119')](_0x26641e,_0x6557('0x1a3')));_0xbbc94=_0x4c1b40[_0x6557('0x1a4')];_0x4f772b=_0x4c1b40[_0x6557('0xdb')];hopperUtils['createHistory'](_0x3557c6)[_0x6557('0xa1')](loggerCatch(_0x6557('0x1a5')));if(_0x5e005c[_0x6557('0x185')](0x5,_0x26641e,_0x4c1b40)&&!_0x47f3ec){if(_0x3557c6[_0x6557('0x121')]>=_0x4c1b40['dialBusyMaxRetry']){_0x5e005c[_0x6557('0x127')](_0x3557c6,_0x173acb,_0x2d6c87,_0x6557('0x1a6'));}else{_0x5e005c[_0x6557('0x125')](_0x3557c6,_0x173acb,_0x2d6c87,_0x6557('0x1a6'));}}break;case'8':_0x4c1b40[_0x6557('0x1a7')]+=0x1;_0x3557c6[_0x6557('0x6b')]=0x8;_0x3557c6['statedesc']='Congestion';_0x3557c6[_0x6557('0x186')]+=0x1;_0x3557c6['countglobal']+=0x1;_0xbbc94=_0x4c1b40['dialCongestionRetryFrequency'];_0x4f772b=_0x4c1b40[_0x6557('0xdb')];ami[_0x6557('0x3d')](_0x6557('0x1a8'),ut['buildObj'](_0x26641e,_0x6557('0x1a9')));hopperUtils[_0x6557('0xcb')](_0x3557c6)[_0x6557('0xa1')](loggerCatch(_0x6557('0x1aa')));if(_0x5e005c[_0x6557('0x185')](0x8,_0x26641e,_0x4c1b40)&&!_0x47f3ec){if(_0x3557c6[_0x6557('0x186')]>=_0x4c1b40[_0x6557('0x18c')]){_0x5e005c[_0x6557('0x127')](_0x3557c6,_0x173acb,_0x2d6c87,_0x6557('0x1ab'));}else{_0x5e005c[_0x6557('0x125')](_0x3557c6,_0x173acb,_0x2d6c87,'reason\x208\x20congestion');}}break;case'11':_0x4c1b40[_0x6557('0x1ac')]+=0x1;_0x3557c6[_0x6557('0x6b')]=0xb;_0x3557c6[_0x6557('0x6c')]=_0x6557('0xea');_0x3557c6[_0x6557('0xec')]+=0x1;_0x3557c6['countglobal']+=0x1;_0xbbc94=_0x4c1b40[_0x6557('0xed')];_0x4f772b=_0x4c1b40[_0x6557('0xdb')];hopperUtils[_0x6557('0xcb')](_0x3557c6)[_0x6557('0xa1')](loggerCatch(_0x6557('0xf3')));if(_0x5e005c[_0x6557('0x185')](0xb,_0x26641e,_0x4c1b40)&&!_0x47f3ec){if(_0x3557c6[_0x6557('0xec')]>=_0x4c1b40[_0x6557('0xef')]){_0x5e005c[_0x6557('0x127')](_0x3557c6,_0x173acb,_0x2d6c87,'reason\x2011\x20abandoned');}else{_0x5e005c[_0x6557('0x125')](_0x3557c6,_0x173acb,_0x2d6c87,'reason\x2011\x20abandoned');}}break;case'20':_0x4c1b40['outboundRejectCallsDay']+=0x1;_0x3557c6[_0x6557('0x6b')]=0x14;_0x3557c6[_0x6557('0x6c')]=_0x6557('0x1ad');_0x3557c6['countagentrejectretry']+=0x1;_0x3557c6[_0x6557('0xd9')]+=0x1;_0xbbc94=_0x4c1b40['dialAgentRejectRetryFrequency'];_0x4f772b=_0x4c1b40[_0x6557('0xdb')];ami['emit'](_0x6557('0x1ae'),ut[_0x6557('0x119')](_0x26641e,_0x6557('0x1af')));hopperUtils[_0x6557('0xcb')](_0x3557c6)[_0x6557('0xa1')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5e005c[_0x6557('0x185')](0x14,_0x26641e,_0x4c1b40)&&!_0x47f3ec){if(_0x3557c6[_0x6557('0x123')]>=_0x4c1b40[_0x6557('0x1b0')]){_0x5e005c[_0x6557('0x127')](_0x3557c6,_0x173acb,_0x2d6c87,'reason\x2020\x20agentreject');}else{_0x5e005c['stateGlobal'](_0x3557c6,_0x173acb,_0x2d6c87,_0x6557('0x1b1'));}}break;default:_0x4c1b40[_0x6557('0x1b2')]+=0x1;_0x3557c6[_0x6557('0x6b')]=0xc;_0x3557c6[_0x6557('0x6c')]=_0x5ec7c2[_0x6557('0x196')];_0xbbc94=_0x4c1b40['dialAgentRejectRetryFrequency'];_0x4f772b=_0x4c1b40[_0x6557('0xdb')];hopperUtils['createHistory'](_0x3557c6)[_0x6557('0xa1')](loggerCatch(_0x6557('0x1b3')));if(_0x5e005c['checkRetriveMax'](_0x5ec7c2[_0x6557('0x196')],_0x26641e,_0x4c1b40)&&!_0x47f3ec){if(_0x3557c6[_0x6557('0x121')]+_0x3557c6[_0x6557('0x186')]+_0x3557c6['countnoanswerretry']+_0x3557c6[_0x6557('0x122')]+_0x3557c6[_0x6557('0xd8')]+_0x3557c6[_0x6557('0xec')]+_0x3557c6[_0x6557('0x11f')]+_0x3557c6[_0x6557('0x123')]>=_0x4c1b40[_0x6557('0x124')]){_0x5e005c[_0x6557('0x125')](_0x3557c6,_0x173acb,_0x2d6c87,_0x5ec7c2[_0x6557('0x196')]);}else{_0x5e005c['createStateFinal'](_0x3557c6,_0x173acb,_0x2d6c87,_0x5ec7c2[_0x6557('0x196')]);}}}})[_0x6557('0x3a')](function(){if(_0x47f3ec){hopperUtils['swapAdditionalPhones'](_0x3557c6,_0xbbc94,_0x4f772b)[_0x6557('0x3a')](function(){return _0x173acb(0x1);});}});});};Dialer[_0x6557('0x16')][_0x6557('0x125')]=function(_0x50bbcb,_0x341d7f,_0x38cb7f,_0x45e625){var _0x553900=new Final(_0x50bbcb);_0x553900['state']=0xf;_0x553900[_0x6557('0x6c')]=_0x6557('0x1b4');this[_0x6557('0x127')](_0x553900,_0x341d7f,_0x38cb7f,_0x45e625);};Dialer[_0x6557('0x16')][_0x6557('0x127')]=function(_0x4f2b56,_0x3c3a4e,_0x192e03,_0x27e798){hopperUtils['moveContactManagedDialer'](_0x4f2b56)[_0x6557('0x3a')](function(){return _0x3c3a4e(msgResponse(_0x6557('0x1b5'),'Success',_0x27e798));})[_0x6557('0xa1')](function(){return _0x192e03(msgResponse(_0x6557('0x1b6'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x6557('0x16')]['predictive']=function(_0x55f0d5){var _0x3ad61d=_0x55f0d5[_0x6557('0x1b7')]/0x64;var _0x394e6d=_0x55f0d5[_0x6557('0xd2')]/(_0x55f0d5[_0x6557('0xd2')]+_0x55f0d5[_0x6557('0xca')]);var _0x4b4b79=Math[_0x6557('0x1b8')](_0x55f0d5['predictiveIntervalAvailable']*(_0x55f0d5[_0x6557('0x1b9')]/0x64));var _0x341ec3=Math[_0x6557('0x1b8')](_0x55f0d5['predictiveIntervalAvailable']*(_0x55f0d5[_0x6557('0x1ba')]/0x64));var _0x15278d=_0x55f0d5[_0x6557('0x1bb')]+_0x55f0d5[_0x6557('0x1bc')];var _0x457e9a=Math[_0x6557('0x1bd')](_0x55f0d5['erlangCalls']*_0x55f0d5[_0x6557('0x58')]*_0x55f0d5['predictiveIntervalHitRate']*_0x55f0d5['predictiveIntervalMultiplicativeFactor']);if(_[_0x6557('0x3c')](_0x55f0d5[_0x6557('0x23')])){if(!_[_0x6557('0x3c')](_0x55f0d5[_0x6557('0x60')])){_0x55f0d5[_0x6557('0x60')]=undefined;loggerPredictive['error'](_0x6557('0x1be'),_0x6557('0x1bf'));}if(!_[_0x6557('0x3c')](_0x55f0d5[_0x6557('0x62')])){loggerPredictive[_0x6557('0x64')]('[startMethodPredictive][StartProgressive]',_0x6557('0x1c0'));clearInterval(_0x55f0d5[_0x6557('0x62')]);_0x55f0d5[_0x6557('0x62')]=undefined;}_0x55f0d5['startProgressive']=moment()[_0x6557('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x6557('0x46')](_0x55f0d5[_0x6557('0x41')],_0x6557('0x1c1'),_0x55f0d5[_0x6557('0x23')]);this[_0x6557('0xb5')](_0x55f0d5,0x1);}else if(ifInterval(_0x55f0d5[_0x6557('0x1c2')],_0x55f0d5[_0x6557('0x23')])){this['handlePower'](_0x55f0d5,0x1);loggerPredictiveCalls[_0x6557('0x46')](_0x6557('0x1c3'),_0x55f0d5[_0x6557('0x23')],_0x55f0d5[_0x6557('0x41')]);_0x55f0d5[_0x6557('0x56')]=0x0;_0x55f0d5[_0x6557('0xd3')]=0x0;}else if(_0x3ad61d<_0x394e6d&&_0x55f0d5['dialPredictiveOptimization']===_0x6557('0x1c4')){clearPredictiveAttributes(_0x55f0d5);loggerPredictive[_0x6557('0x46')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x6557('0x1c5'),_0x394e6d,_0x6557('0x23'),_0x55f0d5[_0x6557('0x41')]);}else if(_0x457e9a<_0x55f0d5[_0x6557('0xd3')]&&_0x55f0d5[_0x6557('0x1c6')]===_0x6557('0x1c4')){clearPredictiveAttributes(_0x55f0d5);loggerPredictive[_0x6557('0x46')](_0x6557('0x1c7'),_0x6557('0x1c8'),_0x457e9a,'Drop\x20in\x20this\x20interval',_0x55f0d5[_0x6557('0xd3')],_0x6557('0x23'),_0x55f0d5['name']);}else if(!ifInterval(_0x55f0d5[_0x6557('0x1c2')],_0x55f0d5['startProgressive'])&&_[_0x6557('0x3c')](_0x55f0d5[_0x6557('0x60')])&&!_[_0x6557('0x3c')](_0x55f0d5[_0x6557('0x23')])){_0x55f0d5['startPredictive']=moment()['format'](_0x6557('0xc8'));loggerPredictive['info'](_0x55f0d5[_0x6557('0x41')],_0x6557('0x1c9'),_0x55f0d5[_0x6557('0x60')]);hopperUtils[_0x6557('0x1ca')](_0x55f0d5['dialPredictiveInterval'])[_0x6557('0x3a')](this[_0x6557('0x1cb')](_0x55f0d5))['then'](mergeDataErlangB(_0x55f0d5))['then'](this['startMethodPredictive'](_0x55f0d5))[_0x6557('0xa1')](loggerCatchPredictive(_0x6557('0x1cc'),_0x55f0d5));}else if(!ifInterval(_0x55f0d5[_0x6557('0x1c2')],_0x55f0d5[_0x6557('0x60')])){_0x55f0d5[_0x6557('0xd3')]=0x0;_0x55f0d5[_0x6557('0x60')]=moment()[_0x6557('0x3f')](_0x6557('0xc8'));loggerPredictive[_0x6557('0x46')](_0x55f0d5[_0x6557('0x41')],_0x6557('0x1cd'),_0x55f0d5[_0x6557('0x60')]);clearInterval(_0x55f0d5[_0x6557('0x62')]);_0x55f0d5[_0x6557('0x62')]=undefined;hopperUtils['avgHandleTime'](_0x55f0d5[_0x6557('0x1c2')])[_0x6557('0x3a')](this[_0x6557('0x1cb')](_0x55f0d5))[_0x6557('0x3a')](mergeDataErlangB(_0x55f0d5))[_0x6557('0x3a')](this[_0x6557('0x1ce')](_0x55f0d5))['catch'](loggerCatchPredictive(_0x6557('0x1cf'),_0x55f0d5));}else if(_0x55f0d5[_0x6557('0x1d0')]&&_0x15278d<_0x55f0d5[_0x6557('0x1d0')]-_0x341ec3){clearPredictiveAttributes(_0x55f0d5);loggerPredictive[_0x6557('0x46')](_0x55f0d5[_0x6557('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x15278d,')\x20are\x20less\x20than\x20threshold\x20(',_0x55f0d5[_0x6557('0x1d0')],'-',_0x341ec3,'=',_0x55f0d5[_0x6557('0x1d0')]-_0x341ec3,')');}else if(_0x55f0d5[_0x6557('0x1d0')]&&_0x15278d>_0x55f0d5['predictiveIntervalAvailable']+_0x4b4b79){clearPredictiveAttributes(_0x55f0d5);loggerPredictive[_0x6557('0x46')](_0x55f0d5[_0x6557('0x41')],_0x6557('0x1d1'),_0x15278d,_0x6557('0x1d2'),_0x55f0d5[_0x6557('0x1d0')],'+',_0x4b4b79,'=',_0x55f0d5[_0x6557('0x1d0')]+_0x4b4b79,')');}};Dialer[_0x6557('0x16')][_0x6557('0x1cb')]=function(_0x479134){var _0x33da41=this;return function(_0x3aa297){return new Promise(function(_0x3b91d1,_0x5582cb){_[_0x6557('0x5c')](_0x479134,_0x3aa297[0x0]);if(checkGetDataPredictive(_0x3aa297[0x0])){var _0x58554a=_0x479134[_0x6557('0x1d0')]=_0x479134[_0x6557('0x1bc')]+_0x479134[_0x6557('0x1bb')];var _0x18fbb9=_0x479134['dialPredictiveInterval']*0x3c;var _0x5d3ade=_0x3aa297[0x0][_0x6557('0x50')]+_0x3aa297[0x0][_0x6557('0x4d')];var _0x41c344=(_0x3aa297[0x0][_0x6557('0x1d3')]+_0x3aa297[0x0][_0x6557('0x49')]+_0x3aa297[0x0][_0x6557('0x4b')])/_0x3aa297[0x0]['predictiveIntervalTotalCalls'];_0x479134[_0x6557('0x1d4')]=_0x41c344>0x0?_0x41c344:0x1;switch(_0x479134[_0x6557('0x1c6')]){case _0x6557('0x1c4'):var _0x2f333a=_0x479134[_0x6557('0x1b7')]/0x64;return _0x33da41[_0x6557('0x1d5')](_0x58554a,_0x18fbb9,_0x5d3ade,_0x41c344,_0x2f333a)['then'](function(_0x94ba38){return _0x3b91d1(_0x94ba38);});case _0x6557('0x1d6'):var _0x4e7492=_0x479134[_0x6557('0x1b7')]/0x64;return _0x33da41[_0x6557('0x1d7')](_0x58554a,_0x18fbb9,_0x5d3ade,_0x41c344,_0x4e7492)[_0x6557('0x3a')](function(_0x4b971a){return _0x3b91d1(_0x4b971a);});default:return _0x5582cb(msgResponse(_0x6557('0x1d8'),_0x6557('0x96'),'Unknown\x20Predictive'));}}else{return _0x5582cb(msgResponse('[getDataPredictive]',_0x6557('0x96'),_0x6557('0x1d9')));}});};};Dialer[_0x6557('0x16')][_0x6557('0x1da')]=function(_0x3b1b0e){var _0xb34fb1=this;return function(_0x59e6b1){return new Promise(function(_0x4697d7,_0x5a0148){_[_0x6557('0x5c')](_0x3b1b0e,_0x59e6b1[0x0]);if(checkGetDataPredictive(_0x59e6b1[0x0])){loggerPredictive['info'](JSON['stringify'](_0x59e6b1[0x0]));if(_0x3b1b0e[_0x6557('0x1c6')]==='dropRate'){return _0xb34fb1['getVoiceQueueRtPauses'](_0x3b1b0e['id'])[_0x6557('0x3a')](function(_0x1c1147){var _0x189bae=_0x3b1b0e[_0x6557('0x1db')]-_0x1c1147[0x0][_0x6557('0x1dc')];var _0x16e9d9=_0x3b1b0e['dialPredictiveInterval']*0x3c;var _0x59c083=_0x59e6b1[0x0][_0x6557('0x50')]+_0x59e6b1[0x0][_0x6557('0x4d')];var _0x2caa38=(_0x59e6b1[0x0]['predictiveIntervalAnsweredCalls']+_0x59e6b1[0x0][_0x6557('0x49')]+_0x59e6b1[0x0][_0x6557('0x4b')])/_0x59e6b1[0x0][_0x6557('0x1dd')];var _0x448869=_0x3b1b0e['dialPredictiveOptimizationPercentage']/0x64;_0x3b1b0e[_0x6557('0x1de')]=_0x1c1147[0x0]['outboundQueuePauses']||0x0;_0x3b1b0e['predictiveIntervalHitRate']=_0x2caa38>0x0?_0x2caa38:0x1;return _0xb34fb1[_0x6557('0x1d5')](_0x189bae,_0x16e9d9,_0x59c083,_0x2caa38,_0x448869);})[_0x6557('0x3a')](function(_0x2c6310){return _0x4697d7(_0x2c6310);})[_0x6557('0xa1')](function(_0x447ade){return _0x5a0148(msgResponse('[CatchErlangB]',_0x6557('0x96'),JSON['stringify'](_0x447ade)));});}if(_0x3b1b0e[_0x6557('0x1c6')]===_0x6557('0x1d6')){return _0xb34fb1['getVoiceQueueRtPauses'](_0x3b1b0e['id'])['then'](function(_0x2fb6cf){var _0x56c14=_0x3b1b0e['loggedIn']-_0x2fb6cf[0x0][_0x6557('0x1dc')];var _0x32eafe=_0x3b1b0e['dialPredictiveInterval']*0x3c;var _0x2b1dc8=_0x59e6b1[0x0][_0x6557('0x50')]+_0x59e6b1[0x0][_0x6557('0x4d')];var _0x99b783=(_0x59e6b1[0x0][_0x6557('0x1d3')]+_0x59e6b1[0x0][_0x6557('0x49')]+_0x59e6b1[0x0][_0x6557('0x4b')])/_0x59e6b1[0x0][_0x6557('0x1dd')];var _0x1d2edc=_0x3b1b0e[_0x6557('0x1b7')]/0x64;_0x3b1b0e[_0x6557('0x1de')]=_0x2fb6cf[0x0][_0x6557('0x1dc')]||0x0;_0x3b1b0e[_0x6557('0x1d4')]=_0x99b783>0x0?_0x99b783:0x1;return _0xb34fb1[_0x6557('0x1d7')](_0x56c14,_0x32eafe,_0x2b1dc8,_0x99b783,_0x1d2edc);})[_0x6557('0x3a')](function(_0x53a26b){return _0x4697d7(_0x53a26b);})['catch'](function(_0x1c27e2){return _0x5a0148(msgResponse('[CatchErlangB]',_0x6557('0x96'),JSON['stringify'](_0x1c27e2)));});}}else{return _0x5a0148(msgResponse('[getDataPredictive]',_0x6557('0x96'),_0x6557('0x1d9')));}});};};Dialer[_0x6557('0x16')][_0x6557('0x1ce')]=function(_0x3e9318){var _0x4a1ca4=this;return function(){var _0x33f3a1=0x0;var _0x4778ee=Math['floor'](_0x3e9318['erlangCallToSecond']*0x3e8);if(_0x4778ee>0x0){_0x4778ee=_0x4778ee<0x64?0x64:_0x4778ee;loggerPredictive[_0x6557('0x46')](_0x3e9318[_0x6557('0x41')],_0x6557('0x1df'),_0x4778ee,_0x6557('0x1e0'));_0x3e9318['handlePredictive']=setInterval(function(){_0x4a1ca4[_0x6557('0x62')](_0x3e9318);loggerPredictiveCalls[_0x6557('0x46')](_0x6557('0x1e1'),_0x33f3a1+=0x1);},_0x4778ee);}else{loggerPredictive['info'](_0x3e9318['name'],_0x6557('0x1e2'));}};};Dialer['prototype'][_0x6557('0x1e3')]=function(_0x4b9350,_0x3f3955){var _0x29dee6=this;return function(_0x2904e9){if(_[_0x6557('0x43')](_0x2904e9)){if(_[_0x6557('0xfc')](_0x3f3955[_0x6557('0x153')])||!_0x3f3955[_0x6557('0x1e4')]){if(_0x4b9350['dialMethod']===_0x6557('0x1e5')){_0x4b9350['queueStatusComplete']=_[_0x6557('0x3c')](_0x4b9350['queueStatusComplete'])?!![]:_0x4b9350[_0x6557('0x6f')];var _0x26c474=uuid['v4']();_0x29dee6[_0x6557('0x20')][_0x26c474]=new Action(_0x4b9350,_0x3f3955,_0x26c474);loggerBooked['info']('[booked][checkContactBlack]',_0x26c474,_0x6557('0x1e6'),JSON[_0x6557('0x72')](_0x4b9350['queueStatusComplete']),_0x6557('0x1e7'),_0x4b9350[_0x6557('0x41')]);if(_0x4b9350[_0x6557('0x6f')]){_0x4b9350[_0x6557('0x6f')]=![];_0x29dee6[_0x6557('0x25')][_0x29dee6['actions'][_0x26c474]['queue']]=[];ami[_0x6557('0x9d')]({'actionid':_0x26c474,'action':'queuestatus','queue':_0x4b9350[_0x6557('0x41')]})[_0x6557('0xa1')](function(){_0x29dee6['updateOriginated'](_0x4b9350);hopperUtils[_0x6557('0xdf')]({'active':![],'ContactId':_0x29dee6[_0x6557('0x20')][_0x26c474]['ContactId'],'ListId':_0x29dee6[_0x6557('0x20')][_0x26c474][_0x6557('0xe3')],'VoiceQueueId':_0x29dee6[_0x6557('0x20')][_0x26c474][_0x6557('0xe4')]||undefined,'CampaignId':_0x29dee6[_0x6557('0x20')][_0x26c474]['CampaignId']||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0x1e8')));delete _0x29dee6[_0x6557('0x20')][_0x26c474];});}else{loggerBooked[_0x6557('0x46')](_0x6557('0x1e9'),JSON[_0x6557('0x72')](_0x4b9350[_0x6557('0x6f')]),_0x6557('0x1e7'),_0x4b9350[_0x6557('0x41')]);_0x29dee6[_0x6557('0xc6')](_0x4b9350);hopperUtils[_0x6557('0xdf')]({'active':![],'ContactId':_0x29dee6[_0x6557('0x20')][_0x26c474][_0x6557('0xe2')],'ListId':_0x29dee6[_0x6557('0x20')][_0x26c474]['ListId'],'VoiceQueueId':_0x29dee6['actions'][_0x26c474]['VoiceQueueId']||undefined,'CampaignId':_0x29dee6['actions'][_0x26c474]['CampaignId']||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0x1e8')));delete _0x29dee6[_0x6557('0x20')][_0x26c474];}}else{return _0x29dee6[_0x6557('0x156')](_0x4b9350,_0x3f3955);}}else{if(utils['getSeconds'](undefined,_0x3f3955['scheduledat'])<_0x4b9350[_0x6557('0x1ea')]*0x3c){if(_0x3f3955[_0x6557('0x154')]&&!_0x3f3955[_0x6557('0x154')]['voicePause']){_0x29dee6[_0x6557('0x1a')]['run'](_0x3f3955['id'])[_0x6557('0x19')](function(){_0x29dee6['updateOriginated'](_0x4b9350);});}else{hopperUtils[_0x6557('0x1eb')]({'active':![]},_0x3f3955['id'],0x1)[_0x6557('0x19')](function(){_0x29dee6['updateOriginated'](_0x4b9350);});}}else{_0x4b9350[_0x6557('0x1ec')]+=0x1;_0x29dee6[_0x6557('0xc6')](_0x4b9350);if(_0x4b9350[_0x6557('0x1ed')]){hopperUtils[_0x6557('0xdf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3f3955[_0x6557('0xe2')],'ListId':_0x3f3955['ListId'],'VoiceQueueId':_0x3f3955['VoiceQueueId']||undefined,'CampaignId':_0x3f3955[_0x6557('0xf1')]||undefined})[_0x6557('0xa1')](loggerCatch(_0x6557('0x1ee')));hopperUtils[_0x6557('0xcb')](createObjHistory(_0x4b9350,_0x3f3955,utils[_0x6557('0x69')][_0x6557('0x1ef')],0x17,'RecallInQueue'))[_0x6557('0xa1')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x29dee6[_0x6557('0x11b')](createObjHistory(_0x4b9350,_0x3f3955,utils[_0x6557('0x69')]['RECALL_TIMEOUT'],0x16,_0x6557('0x1f0')),_0x6557('0x1f1'),_0x6557('0x1f2'));}}}}else{_0x4b9350[_0x6557('0x1f3')]+=0x1;_0x29dee6[_0x6557('0x11b')](createObjHistory(_0x4b9350,_0x3f3955,utils[_0x6557('0x69')][_0x6557('0x1f4')],0xd,_0x6557('0x1f5')),_0x6557('0x1f6'),_0x6557('0x1f7'));throw _0x6557('0x1f8');}};};Dialer[_0x6557('0x16')][_0x6557('0x155')]=function(_0x1ed555){var _0x485a88=this;var _0x302a2f=_0x1ed555[_0x6557('0x1f9')]-_0x1ed555[_0x6557('0x7e')];emitCampaignSummary(_0x1ed555);if(_0x302a2f>0x0&&_0x1ed555[_0x6557('0x1fa')]==0x0){if(_0x302a2f>this[_0x6557('0x1f')]){_0x302a2f=this[_0x6557('0x1f')];}_0x1ed555[_0x6557('0x1fa')]=0x1;hopperUtils[_0x6557('0x1fb')](_0x1ed555,_0x302a2f)[_0x6557('0x3a')](function(_0x13b0dc){_0x1ed555[_0x6557('0x1fa')]=0x0;if(_0x13b0dc){if(!utils[_0x6557('0x1fc')](_0x13b0dc)){_0x1ed555['message']=utils[_0x6557('0x69')][_0x6557('0x1fd')];logger['info'](_0x6557('0x1fe')+_0x1ed555['name']);}else{_0x1ed555[_0x6557('0x7e')]+=_0x13b0dc[_0x6557('0x9c')];_0x1ed555[_0x6557('0x68')]=utils[_0x6557('0x69')][_0x6557('0x1ff')];for(var _0x2e224e=0x0;_0x2e224e<_0x13b0dc[_0x6557('0x9c')];_0x2e224e+=0x1){_0x1ed555[_0x6557('0x200')]+=0x1;if(_[_0x6557('0xfc')](_0x13b0dc[_0x2e224e])||_[_0x6557('0xfc')](_0x13b0dc[_0x2e224e][_0x6557('0x201')])||_[_0x6557('0xfc')](_0x13b0dc[_0x2e224e]['phone'])){_0x485a88[_0x6557('0x151')](_0x6557('0x202'),_0x1ed555,_0x13b0dc[_0x2e224e]);}else{hopperUtils[_0x6557('0x203')](_[_0x6557('0x73')](_0x13b0dc[_0x2e224e],[_0x6557('0xf1'),_0x6557('0x159')]))['then'](_0x485a88['checkContactBlack'](_0x1ed555,_0x13b0dc[_0x2e224e]))[_0x6557('0xa1')](_0x485a88[_0x6557('0x150')](_0x6557('0x204'),_0x1ed555));}}}}})[_0x6557('0xa1')](loggerGetContactDialer(_0x6557('0x205'),_0x1ed555,_0x302a2f));}};Dialer[_0x6557('0x16')][_0x6557('0xb5')]=function(_0x2a41b1,_0x1d5fbc){var _0x295294=this;var _0x312ef5=[];if(_0x1d5fbc<0x1||_0x2a41b1['dialMethod']===_0x6557('0x1e5')){_0x1d5fbc=0x1;}var _0x2d3f37=Math['floor'](_0x2a41b1[_0x6557('0x1bb')]*_0x1d5fbc)-_0x2a41b1['originated'];if(_0x2a41b1[_0x6557('0x206')]>0x0){var _0x26ca26=_0x2a41b1[_0x6557('0x206')]-_0x2a41b1[_0x6557('0x7e')]-_0x2a41b1[_0x6557('0x1bc')]-_0x2a41b1[_0x6557('0x13b')];if(_0x2d3f37>_0x26ca26){_0x2d3f37=_0x26ca26;}}if(_0x2d3f37>0x0&&_0x2a41b1[_0x6557('0x1fa')]==0x0){if(_0x2a41b1[_0x6557('0xb3')]===_0x6557('0x1e5')){_0x2d3f37=0x1;}if(_0x2d3f37>this[_0x6557('0x1f')]){_0x2d3f37=this['maxNumberOriginate'];}for(var _0x59aaa2 in this[_0x6557('0x1d')]){if(typeof this[_0x6557('0x1d')][_0x59aaa2]!==_0x6557('0xac')){if(this['agents'][_0x59aaa2][_0x6557('0x6b')]===_0x6557('0x207')&&this[_0x6557('0x1d')][_0x59aaa2][_0x6557('0x88')]===_0x6557('0x87')){_0x312ef5['push'](this['agents'][_0x59aaa2]['id']);}}}_0x2a41b1['temp']=0x1;hopperUtils['getContactDialer'](_0x2a41b1,_0x312ef5,_0x2d3f37)[_0x6557('0x3a')](function(_0x55dc05){_0x2a41b1['temp']=0x0;if(_0x55dc05){if(!utils['checkContactEmpty'](_0x55dc05)){hopperUtils[_0x6557('0x208')](_0x2a41b1)['then'](sendMessageReschedule(_0x2a41b1))['catch'](loggerCatch(_0x6557('0x209')));}else{_0x2a41b1[_0x6557('0x7e')]+=_0x55dc05['length'];_0x2a41b1[_0x6557('0x68')]=_0x2a41b1[_0x6557('0xb3')]===_0x6557('0x1e5')?utils[_0x6557('0x69')][_0x6557('0x162')]:utils['CAMPAIGN_STATUS'][_0x6557('0x1ff')];for(var _0x44cf12=0x0;_0x44cf12<_0x55dc05[_0x6557('0x9c')];_0x44cf12+=0x1){if(_[_0x6557('0xfc')](_0x55dc05[_0x44cf12])||_[_0x6557('0xfc')](_0x55dc05[_0x44cf12]['Contact'])||_[_0x6557('0xfc')](_0x55dc05[_0x44cf12][_0x6557('0x159')])){_0x295294['emptyContact']('[actionOriginate]\x20',_0x2a41b1,_0x55dc05[_0x44cf12]);}else{hopperUtils[_0x6557('0x20a')](_[_0x6557('0x73')](_0x55dc05[_0x44cf12],[_0x6557('0xe4'),_0x6557('0x159')]))[_0x6557('0x3a')](_0x295294[_0x6557('0x1e3')](_0x2a41b1,_0x55dc05[_0x44cf12]))[_0x6557('0xa1')](_0x295294[_0x6557('0x150')](_0x6557('0x202'),_0x2a41b1));}}}}})['catch'](loggerGetContactDialer(_0x6557('0x20b'),_0x2a41b1,_0x2d3f37));}};Dialer['prototype'][_0x6557('0x62')]=function(_0x5ef54d){if(_0x5ef54d['dialLimitQueue']>0x0){var _0x4e9ba9=_0x5ef54d[_0x6557('0x206')]-_0x5ef54d[_0x6557('0x7e')]-_0x5ef54d[_0x6557('0x1bc')];if(_0x4e9ba9>0x0&&_0x5ef54d['temp']==0x0){this[_0x6557('0x20c')](_0x5ef54d);}else{loggerPredictiveCalls[_0x6557('0x46')]('[handlePredictive][limitChannel]');}}else{this[_0x6557('0x20c')](_0x5ef54d);}};Dialer[_0x6557('0x16')][_0x6557('0x20c')]=function(_0x8092ad){var _0x2a874d=this;var _0x96700b=[];_0x8092ad[_0x6557('0x7e')]+=0x1;for(var _0x57542f in this[_0x6557('0x1d')]){if(typeof this[_0x6557('0x1d')][_0x57542f]!==_0x6557('0xac')){if(this['agents'][_0x57542f][_0x6557('0x6b')]===_0x6557('0x207')&&this['agents'][_0x57542f][_0x6557('0x88')]==='reachable'){_0x96700b[_0x6557('0x100')](this[_0x6557('0x1d')][_0x57542f]['id']);}}}_0x8092ad[_0x6557('0x1fa')]=0x1;return this[_0x6557('0x20d')](_0x8092ad['id'],_0x96700b,0x1,_0x8092ad[_0x6557('0x20e')],_0x8092ad)[_0x6557('0x3a')](function(_0x1848af){_0x8092ad['temp']=0x1;if(_0x1848af){if(!utils['checkContactEmpty'](_0x1848af)){utils['checkContactLowerLimitOriginate'](_0x8092ad,0x1,0x0);return hopperUtils['countReScheduled'](_0x8092ad)['then'](sendMessageReschedule(_0x8092ad))['catch'](loggerCatch(_0x6557('0x209')));}else{_0x8092ad['message']=utils['CAMPAIGN_STATUS'][_0x6557('0x1ff')];if(_[_0x6557('0xfc')](_0x1848af[0x0])||_[_0x6557('0xfc')](_0x1848af[0x0][_0x6557('0x201')])||_[_0x6557('0xfc')](_0x1848af[0x0][_0x6557('0x159')])){_0x2a874d['emptyContact']('[actionOriginate]\x20',_0x8092ad,_0x1848af[0x0]);}else{return hopperUtils[_0x6557('0x20a')](_[_0x6557('0x73')](_0x1848af[0x0],[_0x6557('0xe4'),_0x6557('0x159')]))[_0x6557('0x3a')](_0x2a874d['checkContactBlack'](_0x8092ad,_0x1848af[0x0]))[_0x6557('0xa1')](_0x2a874d[_0x6557('0x150')](_0x6557('0x20f'),_0x8092ad));}}}})[_0x6557('0xa1')](loggerGetContactDialer(_0x6557('0x210'),_0x8092ad,0x1));};Dialer[_0x6557('0x16')][_0x6557('0x1d5')]=function(_0x280406,_0xea2716,_0x29b2f7,_0x48b567,_0x1cbece,_0x565a2a){loggerPredictive[_0x6557('0x46')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x6557('0x46')](_0x6557('0x211'),_0x280406);loggerPredictive[_0x6557('0x46')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xea2716);loggerPredictive[_0x6557('0x46')]('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',_0x29b2f7);loggerPredictive['info']('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',_0x48b567);loggerPredictive[_0x6557('0x46')](_0x6557('0x212'),_0x1cbece);loggerPredictive['info'](_0x6557('0x4f'));return new Promise(function(_0x2591f6,_0x15ed17){if(_0x280406<=0x0||isNaN(_0x280406)){return _0x15ed17(msgResponse('[abandonmentRate]',_0x6557('0x84'),'m\x20=\x20'+_0x280406));}if(_0x29b2f7<=0x0||isNaN(_0x29b2f7)){return _0x15ed17(msgResponse(_0x6557('0x213'),_0x6557('0x84'),_0x6557('0x214')+_0x29b2f7));}if(_0x48b567<=0x0||isNaN(_0x48b567)){return _0x15ed17(msgResponse(_0x6557('0x213'),_0x6557('0x84'),_0x6557('0x215')+_0x48b567));}if(_0xea2716<=0x0||isNaN(_0xea2716)){return _0x15ed17(msgResponse(_0x6557('0x213'),_0x6557('0x84'),'interval\x20=\x20'+_0xea2716));}if(_0x1cbece<=0x0||isNaN(_0x1cbece)){return _0x15ed17(msgResponse(_0x6557('0x213'),_0x6557('0x84'),_0x6557('0x216')+_0x1cbece));}_0x565a2a=_0x565a2a||0x0;var _0x295b13=0x1/_0x29b2f7;var _0x15bd2b=0x0;var _0x1f8ae7=0x0;var _0x27e244=0x0;var _0x1f66f7=0x0;for(var _0x304606=0x0;_0x27e244<_0x1cbece;_0x304606+=0x1){_0x1f8ae7=_0x304606/_0xea2716;_0x15bd2b=(_0x48b567*_0x1f8ae7+_0x565a2a)/_0x295b13;_0x27e244=utils[_0x6557('0x217')](_0x15bd2b,_0x280406);_0x1f66f7=_0x15bd2b/_0x280406*(0x1-utils['erlangb'](_0x15bd2b,_0x280406));}return _0x2591f6({'erlangCalls':_0x304606,'erlangCallToSecond':_0xea2716/_0x304606,'erlangAbandonmentRate':_0x27e244,'erlangBusyFactor':_0x1f66f7});});};Dialer[_0x6557('0x16')]['busyFactor']=function(_0x46d488,_0x5adb40,_0xa9dc02,_0x5ceb7f,_0x2c19e9,_0x3dbd2d){loggerPredictive[_0x6557('0x46')](_0x6557('0x218'));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',_0x46d488);loggerPredictive[_0x6557('0x46')](_0x6557('0x219'),_0x5adb40);loggerPredictive[_0x6557('0x46')](_0x6557('0x21a'),_0xa9dc02);loggerPredictive[_0x6557('0x46')]('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',_0x5ceb7f);loggerPredictive[_0x6557('0x46')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c19e9);loggerPredictive[_0x6557('0x46')](_0x6557('0x4f'));return new Promise(function(_0x24b149,_0x4299b2){if(_0x46d488<=0x0||isNaN(_0x46d488)){return _0x4299b2(msgResponse('[busyFactor]',_0x6557('0x84'),'m\x20=\x20'+_0x46d488));}if(_0xa9dc02<=0x0||isNaN(_0xa9dc02)){return _0x4299b2(msgResponse('[busyFactor]',_0x6557('0x84'),_0x6557('0x214')+_0xa9dc02));}if(_0x5ceb7f<=0x0||isNaN(_0x5ceb7f)){return _0x4299b2(msgResponse(_0x6557('0x21b'),_0x6557('0x84'),_0x6557('0x215')+_0x5ceb7f));}if(_0x5adb40<=0x0||isNaN(_0x5adb40)){return _0x4299b2(msgResponse(_0x6557('0x21b'),'Error',_0x6557('0x21c')+_0x5adb40));}if(_0x2c19e9<=0x0||isNaN(_0x2c19e9)){return _0x4299b2(msgResponse('[busyFactor]',_0x6557('0x84'),_0x6557('0x21d')+_0x2c19e9));}_0x3dbd2d=_0x3dbd2d||0x0;var _0x586b60=0x1/_0xa9dc02;var _0x1adb30=0x0;var _0x6ee738=0x0;var _0x4d5c7c=0x0;var _0x46b11e=0x0;for(var _0x3b3f97=0x0;_0x46b11e<_0x2c19e9;_0x3b3f97+=0x1){_0x6ee738=_0x3b3f97/_0x5adb40;_0x1adb30=(_0x5ceb7f*_0x6ee738+_0x3dbd2d)/_0x586b60;_0x4d5c7c=utils[_0x6557('0x217')](_0x1adb30,_0x46d488);_0x46b11e=_0x1adb30/_0x46d488*(0x1-utils[_0x6557('0x217')](_0x1adb30,_0x46d488));}return _0x24b149({'erlangCalls':_0x3b3f97,'erlangCallToSecond':_0x5adb40/_0x3b3f97,'erlangAbandonmentRate':_0x4d5c7c,'erlangBusyFactor':_0x46b11e});});};module[_0x6557('0x21e')]=Dialer; \ No newline at end of file +var _0x1fb8=['Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:save','originated','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','stringify','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','content','indexOf','true','catch','push','all','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','intervalIftime','OVERTIME_INTERVAL','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','uniqueid','type','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','queue','ivr','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','minutes','ContactId','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','verifyAdditionalPhones','voiceQueue','countabandonedretry','rescheduleContact','add','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','swapAdditionalPhones','channel','actionid','rrmemory','isNil','paused','stateinterface','locked','pick','strategy','roundrobin','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','Success','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','AMD','custom:amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerAgiCallsDay','membername','amd','buildObj','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countbusyretry','dialGlobalMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','cause-txt','Normal\x20Clearing','[syncAgentComplete]','running','statusMessage','available','inUse','talking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','stateGlobal','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','handlePower','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalAnsweredCalls','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL'];(function(_0x2b744a,_0x40e950){var _0x1cf3e0=function(_0x3dcc30){while(--_0x3dcc30){_0x2b744a['push'](_0x2b744a['shift']());}};_0x1cf3e0(++_0x40e950);}(_0x1fb8,0x1ac));var _0x81fb=function(_0x2fc5d4,_0x514199){_0x2fc5d4=_0x2fc5d4-0x0;var _0x3b273c=_0x1fb8[_0x2fc5d4];return _0x3b273c;};'use strict';var util=require(_0x81fb('0x0'));var _=require(_0x81fb('0x1'));var uuid=require(_0x81fb('0x2'));var moment=require(_0x81fb('0x3'));var rr=require('rr');var Redis=require(_0x81fb('0x4'));var utils=require('./utils');var hopperUtils=require(_0x81fb('0x5'));var ut=require(_0x81fb('0x6'));var config=require(_0x81fb('0x7'));var logger=require(_0x81fb('0x8'))(_0x81fb('0x9'));var loggerBooked=require(_0x81fb('0x8'))(_0x81fb('0xa'));var loggerPredictive=require(_0x81fb('0x8'))(_0x81fb('0xb'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x81fb('0xc'));var ami=require(_0x81fb('0xd'));config[_0x81fb('0xe')]=_[_0x81fb('0xf')](config[_0x81fb('0xe')],{'host':_0x81fb('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x81fb('0xe')]));var cmHopper=require(_0x81fb('0x11'));var voiceQueueRt=require(_0x81fb('0x12'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x81fb('0x13'));var Action=require(_0x81fb('0x14'));var History=require(_0x81fb('0x15'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x81fb('0x16'));var Hangup=require(_0x81fb('0x17'));var ipAgi=process['env'][_0x81fb('0x18')]||_0x81fb('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x81fb('0x1a')]['enqueue']=function(_0x17fc2d){this['tail']=this[_0x81fb('0x1b')]?this[_0x81fb('0x1b')][_0x81fb('0x1c')](_0x17fc2d):_0x17fc2d();};function Dialer(_0x377323,_0x3b2078){this[_0x81fb('0x1d')]=new Sequence();this[_0x81fb('0x1e')]=_0x3b2078;this[_0x81fb('0x1f')]=_0x377323[_0x81fb('0x1f')];this[_0x81fb('0x20')]=_0x377323[_0x81fb('0x20')];this['agents']=_0x377323[_0x81fb('0x21')];this[_0x81fb('0x22')]=_0x377323[_0x81fb('0x22')];this[_0x81fb('0x23')]=config[_0x81fb('0x23')]||0x2;this[_0x81fb('0x24')]={};this[_0x81fb('0x25')]={};this[_0x81fb('0x26')]={};this[_0x81fb('0x27')]={};this[_0x81fb('0x28')]={};this[_0x81fb('0x29')]={};this[_0x81fb('0x2a')]={};this[_0x81fb('0x2b')]={};this[_0x81fb('0x2c')]={};this[_0x81fb('0x2d')]={};this[_0x81fb('0x2e')]={};ami['on'](_0x81fb('0x2f'),this[_0x81fb('0x30')][_0x81fb('0x31')](this));ami['on'](_0x81fb('0x32'),this[_0x81fb('0x33')][_0x81fb('0x31')](this));ami['on'](_0x81fb('0x34'),this[_0x81fb('0x35')][_0x81fb('0x31')](this));ami['on'](_0x81fb('0x36'),this[_0x81fb('0x37')][_0x81fb('0x31')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x81fb('0x31')](this));ami['on'](_0x81fb('0x38'),this['syncQueueSummaryComplete'][_0x81fb('0x31')](this));ami['on']('hangup',this[_0x81fb('0x39')][_0x81fb('0x31')](this));ami['on']('newexten',this[_0x81fb('0x3a')][_0x81fb('0x31')](this));ami['on'](_0x81fb('0x3b'),this[_0x81fb('0x3c')][_0x81fb('0x31')](this));ami['on'](_0x81fb('0x3d'),this[_0x81fb('0x3e')][_0x81fb('0x31')](this));ami['on'](_0x81fb('0x3f'),this[_0x81fb('0x40')][_0x81fb('0x31')](this));this[_0x81fb('0x41')]();this[_0x81fb('0x42')]();RpcSetting[_0x81fb('0x43')]()[_0x81fb('0x44')](function(_0x398d15){previewRecallmeReminderInterval=_0x398d15[_0x81fb('0x45')];});}function isNotNull(_0x788628){return _0x788628!==null&&!_['isUndefined'](_0x788628);}function msgResponse(_0x34bfff,_0x2163d1,_0x1d331d){return{'action':_0x34bfff,'response':_0x2163d1,'message':_0x1d331d,'stack':_0x1d331d};}function emit(_0x242826,_0x240a3f,_0x52aa82){io['to'](_0x242826)[_0x81fb('0x46')](_0x240a3f,_0x52aa82);}function emitOutboundVoiceQueueSummary(_0x59679f){if(_0x59679f['type']===_0x81fb('0x47')){logger[_0x81fb('0x48')](_0x81fb('0x49'),util[_0x81fb('0x4a')](_0x59679f,{'showHidden':![],'depth':null}));emit(util[_0x81fb('0x4b')](_0x81fb('0x4c'),_0x59679f['name']),'voice_queue:save',_0x59679f);}}function checkGetDataPredictive(_0x217da6){if(isNotNull(_0x217da6)&&!_[_0x81fb('0x4d')](_0x217da6)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x4f'),_0x217da6[_0x81fb('0x50')]);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x51'),_0x217da6['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x52'),_0x217da6[_0x81fb('0x53')]);loggerPredictive['info'](_0x81fb('0x54'),_0x217da6[_0x81fb('0x55')]);loggerPredictive['info'](_0x81fb('0x56'),_0x217da6[_0x81fb('0x57')]);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x58'),_0x217da6['predictiveIntervalAvgTalktime']);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x59'));if(_0x217da6[_0x81fb('0x50')]>0x0){if(!_[_0x81fb('0x5a')](_0x217da6['predictiveIntervalAvgTalktime'])&&_0x217da6[_0x81fb('0x5b')]>0x0){return!![];}loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x5c'));if(!_['isUndefined'](_0x217da6[_0x81fb('0x57')])&&_0x217da6[_0x81fb('0x57')]>0x0){return!![];}loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x5d'));}else{loggerPredictive[_0x81fb('0x4e')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x5e'));}return![];}function mergeDataErlangB(_0x36b461){return function(_0x504cdf){loggerPredictive[_0x81fb('0x4e')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x5f'),_0x504cdf['erlangCalls']);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x60'),_0x504cdf[_0x81fb('0x61')]);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x62'),_0x504cdf[_0x81fb('0x63')]);loggerPredictive[_0x81fb('0x4e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x504cdf[_0x81fb('0x64')]);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x62'),_0x504cdf[_0x81fb('0x63')]);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x59'));_[_0x81fb('0x65')](_0x36b461,_0x504cdf);};}function ifInterval(_0x2e584e,_0x432c9e){if(_[_0x81fb('0x5a')](_0x432c9e)){return![];}return utils[_0x81fb('0x66')](undefined,_0x432c9e)<_0x2e584e*0x3c;}function clearPredictiveAttributes(_0x57cd63){if(_0x57cd63[_0x81fb('0x2a')]){_0x57cd63['startProgressive']=undefined;loggerPredictive[_0x81fb('0x48')](_0x57cd63[_0x81fb('0x67')],_0x81fb('0x68'));}if(_0x57cd63[_0x81fb('0x29')]){_0x57cd63['startPredictive']=undefined;loggerPredictive[_0x81fb('0x48')](_0x57cd63[_0x81fb('0x67')],_0x81fb('0x69'));}if(_0x57cd63[_0x81fb('0x6a')]){clearInterval(_0x57cd63['handlePredictive']);_0x57cd63[_0x81fb('0x6a')]=undefined;loggerPredictive[_0x81fb('0x48')](_0x57cd63['name'],_0x81fb('0x6b'));}}function loggerCatchPredictive(_0x4ada40,_0x25d917){return function(_0x1b6229){loggerPredictive[_0x81fb('0x6c')](_0x25d917['name'],_0x4ada40);loggerPredictive[_0x81fb('0x6c')](_0x1b6229['stack']);clearPredictiveAttributes(_0x25d917);};}function loggerCatch(_0x5a0cdc){return function(_0x4d3c44){logger[_0x81fb('0x6c')](_0x5a0cdc,util['inspect'](_0x4d3c44,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x163bb6,_0x231f69,_0x4d9522){return function(_0x445eb0){utils[_0x81fb('0x6d')](_0x231f69,_0x4d9522,0x0);_0x231f69[_0x81fb('0x6e')]=0x0;logger[_0x81fb('0x6c')](_0x163bb6,util['inspect'](_0x445eb0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4ff1c0){return function(_0x14f168){if(isNotNull(_0x14f168)&&isNotNull(_0x14f168[0x0])){if(_0x14f168[0x0][_0x81fb('0x6f')]>0x0){_0x4ff1c0['message']=utils[_0x81fb('0x70')][_0x81fb('0x71')];logger[_0x81fb('0x4e')](_0x81fb('0x72')+_0x4ff1c0[_0x81fb('0x67')],_0x14f168[0x0][_0x81fb('0x6f')],'contacts');}else{_0x4ff1c0[_0x81fb('0x73')]=utils[_0x81fb('0x70')][_0x81fb('0x74')];logger[_0x81fb('0x4e')](_0x81fb('0x75')+_0x4ff1c0[_0x81fb('0x67')]);}}};}function createObjHistory(_0x4228b3,_0x496106,_0x2e8bfa,_0x506fe4,_0x4e7021){_0x4228b3[_0x81fb('0x73')]=_0x2e8bfa;var _0x1bbf78=new Action(_0x4228b3,_0x496106);var _0x582813=new History(_0x1bbf78);_0x582813[_0x81fb('0x76')]=_0x506fe4;_0x582813[_0x81fb('0x77')]=_0x4e7021;_0x582813[_0x81fb('0x78')]=_0x1bbf78[_0x81fb('0x79')];return _0x582813;}function unlockQueueStatus(_0x3d6e2b,_0x59d84c){setTimeout(function(){if(_['isUndefined'](_0x3d6e2b[_0x81fb('0x7a')])){loggerBooked[_0x81fb('0x6c')](_0x81fb('0x7b'),_0x59d84c);}_0x3d6e2b[_0x81fb('0x7a')]=!![];loggerBooked[_0x81fb('0x4e')](_0x81fb('0x7c'),_0x59d84c,JSON['stringify'](_['pick'](_0x3d6e2b,[_0x81fb('0x67'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x58f52a){return function(){if(!isNotNull(_0x58f52a[_0x81fb('0x7d')])){_0x58f52a[_0x81fb('0x73')]=utils['CAMPAIGN_STATUS'][_0x81fb('0x7e')];throw _0x58f52a[_0x81fb('0x67')]+_0x81fb('0x7f');}if(!isNotNull(_0x58f52a['Interval'][_0x81fb('0x80')])){_0x58f52a[_0x81fb('0x73')]=utils[_0x81fb('0x70')][_0x81fb('0x7e')];throw _0x58f52a[_0x81fb('0x67')]+_0x81fb('0x7f');}if(!isNotNull(_['isEmpty'](_0x58f52a[_0x81fb('0x7d')]['Intervals']))){_0x58f52a[_0x81fb('0x73')]=utils[_0x81fb('0x70')][_0x81fb('0x7e')];throw _0x58f52a[_0x81fb('0x67')]+_0x81fb('0x7f');}};}function checkIsIVRCampaignActive(_0x2656e2){return function(){if(!utils[_0x81fb('0x81')](_0x2656e2)){_0x2656e2['message']=utils[_0x81fb('0x70')]['INACTIVE'];throw _0x2656e2[_0x81fb('0x67')]+_0x81fb('0x82');}};}function emitCampaignSummary(_0x356178){if(utils[_0x81fb('0x83')](_0x356178)){emit(util[_0x81fb('0x4b')]('campaign:ivr:%s',_0x356178[_0x81fb('0x67')]),_0x81fb('0x84'),_0x356178);}}function loggerCatchQueueSummary(_0x3712cd,_0x25fea1){return function(_0x4e7f05){clearPredictiveAttributes(_0x25fea1);emitCampaignSummary(_0x25fea1);loggerSyncQueueSummary['debug'](_0x3712cd,util[_0x81fb('0x4a')](_0x4e7f05,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x20e6fd){if(_0x20e6fd['sendMessageOneNotActive']){if(_0x20e6fd[_0x81fb('0x85')]===0x0){_0x20e6fd[_0x81fb('0x86')]=![];_0x20e6fd[_0x81fb('0x73')]=utils[_0x81fb('0x70')][_0x81fb('0x87')];loggerSyncQueueSummary['debug'](_0x81fb('0x88'),_0x20e6fd['name'],'is\x20not\x20active');}else{_0x20e6fd['message']=utils[_0x81fb('0x70')][_0x81fb('0x89')];loggerSyncQueueSummary['debug'](_0x81fb('0x88'),_0x20e6fd[_0x81fb('0x67')],_0x81fb('0x8a'));}emitCampaignSummary(_0x20e6fd);}}function myreject(_0x4e5564){return function(_0x406a12){return _0x4e5564(msgResponse(_0x81fb('0x8b'),_0x81fb('0x8c'),JSON[_0x81fb('0x8d')](_0x406a12)));};}Dialer[_0x81fb('0x1a')][_0x81fb('0x8e')]=function(_0x47f21c){return!_[_0x81fb('0x5a')](_0x47f21c)&&_0x47f21c&&!_[_0x81fb('0x5a')](_0x47f21c['name'])&&!_[_0x81fb('0x5a')](_0x47f21c[_0x81fb('0x8f')])&&_0x47f21c[_0x81fb('0x8f')]&&(this[_0x81fb('0x22')][util[_0x81fb('0x4b')](_0x81fb('0x90'),_0x47f21c[_0x81fb('0x67')])][_0x81fb('0x91')]===_0x81fb('0x92')||this['trunks'][util['format'](_0x81fb('0x90'),_0x47f21c[_0x81fb('0x67')])]['status']===_0x81fb('0x93'));};Dialer[_0x81fb('0x1a')][_0x81fb('0x94')]=function(_0x49c867){var _0x508092=this;return function(){if(!_0x508092[_0x81fb('0x8e')](_0x49c867[_0x81fb('0x95')])){if(!_0x508092[_0x81fb('0x8e')](_0x49c867[_0x81fb('0x96')])){_0x49c867[_0x81fb('0x73')]=utils[_0x81fb('0x70')]['TRUNK_NOT_REACHABLE'];throw _0x49c867['name']+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x81fb('0x1a')][_0x81fb('0x97')]=function(_0x52048b,_0x40206a,_0xcfc1a0,_0x2a337b){var _0x9eb1aa=this;return function(){var _0x2a7b09=!![];return _0x9eb1aa[_0x81fb('0x98')](_0x52048b,_0x40206a,_0xcfc1a0,_0x2a337b,_0x2a7b09);};};Dialer['prototype'][_0x81fb('0x99')]=function(_0x555e84,_0x12fd9c,_0x25bd7c,_0x6cfeae){var _0xf01bf7=this;return function(){var _0x59d519=![];return _0xf01bf7['ifTimeIvr'](_0x555e84[_0x81fb('0x80')],_0x12fd9c,_0x25bd7c,_0x6cfeae,_0x59d519);};};Dialer[_0x81fb('0x1a')][_0x81fb('0x98')]=function(_0x282f79,_0x3f6847,_0x1de08a,_0xa7dfb0,_0x32ce44){var _0x4a09b7=[];return new Promise(function(_0x9216b5,_0x517791){if(!isNotNull(_0x282f79)){_0xa7dfb0['message']=utils[_0x81fb('0x70')]['NULL_INTERVAL'];return _0x517791(msgResponse(_0x81fb('0x9a'),_0x81fb('0x9b'),_0x1de08a+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x81fb('0x4d')](_0x282f79)){_0xa7dfb0['message']=utils['CAMPAIGN_STATUS'][_0x81fb('0x9c')];return _0x517791(msgResponse('ifTime',_0x81fb('0x9b'),_0x1de08a+_0x81fb('0x9d')));}if(_0x3f6847&&_[_0x81fb('0x5a')](config[_0x81fb('0x9e')][_0x3f6847])){_0xa7dfb0[_0x81fb('0x73')]=utils[_0x81fb('0x70')][_0x81fb('0x9f')];return _0x517791(msgResponse(_0x81fb('0x9a'),_0x81fb('0x9b'),_0x1de08a+_0x81fb('0xa0')+_0x3f6847));}if(_[_0x81fb('0xa1')](_0x282f79)){for(var _0x33ff26=0x0;_0x33ff26<_0x282f79['length'];_0x33ff26+=0x1){_0x4a09b7['push'](ami[_0x81fb('0xa2')]({'action':_0x81fb('0xa3'),'command':util['format'](_0x81fb('0xa4'),_0x282f79[_0x33ff26]['interval'],!_[_0x81fb('0x5a')](config[_0x81fb('0x9e')][_0x3f6847])?_0x3f6847:'')})[_0x81fb('0x44')](function(_0x86786b){return _0x86786b[_0x81fb('0xa5')][_0x81fb('0xa6')](_0x81fb('0xa7'))>=0x0;})[_0x81fb('0xa8')](myreject(_0x517791)));}}else{_0x4a09b7[_0x81fb('0xa9')](ami[_0x81fb('0xa2')]({'action':_0x81fb('0xa3'),'command':util[_0x81fb('0x4b')](_0x81fb('0xa4'),_0x282f79,!_[_0x81fb('0x5a')](config[_0x81fb('0x9e')][_0x3f6847])?_0x3f6847:'')})[_0x81fb('0x44')](function(_0x75c709){return _0x75c709[_0x81fb('0xa5')][_0x81fb('0xa6')](_0x81fb('0xa7'))>=0x0;})[_0x81fb('0xa8')](myreject(_0x517791)));}Promise[_0x81fb('0xaa')](_0x4a09b7)[_0x81fb('0x44')](function(_0x4c449a){var _0x5a7a99=_['some'](_0x4c449a);if(_0x5a7a99){return _0x9216b5(_0x5a7a99);}else{_0xa7dfb0[_0x81fb('0x73')]=_0x32ce44?utils[_0x81fb('0x70')][_0x81fb('0xab')]:utils[_0x81fb('0x70')]['OVERTIME_INTERVAL'];return _0x517791(msgResponse(_0x81fb('0xac'),_0x81fb('0x9b'),'Global:\x20'+_0x32ce44+'\x20'+_0x1de08a+_0x81fb('0xad')+util['inspect'](_0x282f79,{'showHidden':![],'depth':null})+_0x81fb('0xae')+_0x3f6847));}})[_0x81fb('0xa8')](function(_0x25570b){return _0x517791(msgResponse(_0x81fb('0x9a'),_0x81fb('0x9b'),JSON[_0x81fb('0x8d')](_0x25570b)));});});};Dialer[_0x81fb('0x1a')][_0x81fb('0x41')]=function(){var _0x476f7e=this;return cmHopper[_0x81fb('0xaf')]({'active':![]},{'where':{'active':!![]}})[_0x81fb('0x44')](function(){setInterval(function(){_0x476f7e['syncCampaigns']();},0x3e8);});};Dialer['prototype'][_0x81fb('0xb0')]=function(){var _0x564080=this;var _0x514782;for(var _0x3cec7b in this[_0x81fb('0x20')]){if(typeof this[_0x81fb('0x20')][_0x3cec7b]!==_0x81fb('0xb1')){_0x514782=this[_0x81fb('0x20')][_0x3cec7b];if(utils[_0x81fb('0x83')](_0x514782)&&utils[_0x81fb('0x81')](_0x514782)){_0x514782['sendMessageOneNotActive']=!![];Promise[_0x81fb('0xb2')]()[_0x81fb('0x44')](checkIsIVRCampaignActive(_0x514782))[_0x81fb('0x44')](checkInterval(_0x514782))[_0x81fb('0x44')](_0x564080['checkIsTrunkReachable'](_0x514782))[_0x81fb('0x44')](_0x564080[_0x81fb('0x97')](_0x514782[_0x81fb('0xb3')],_0x514782[_0x81fb('0xb4')],_0x514782['name'],_0x514782))[_0x81fb('0x44')](_0x564080[_0x81fb('0x99')](_0x514782['Interval'],_0x514782[_0x81fb('0xb4')],_0x514782[_0x81fb('0x67')],_0x514782))[_0x81fb('0x44')](_0x564080[_0x81fb('0xb5')](_0x514782))[_0x81fb('0xa8')](loggerCatchQueueSummary(_0x81fb('0xb6'),_0x514782));}else{notSendMessagesCampaign(_0x514782);}}}};Dialer['prototype'][_0x81fb('0xb7')]=function(_0x422cd9){if(_0x422cd9[_0x81fb('0xb8')]!==_0x81fb('0xb')){clearPredictiveAttributes(_0x422cd9);}switch(_0x422cd9[_0x81fb('0xb8')]){case _0x81fb('0xb9'):this['handlePower'](_0x422cd9,0x1);break;case'power':this['handlePower'](_0x422cd9,_0x422cd9[_0x81fb('0xba')]);break;case _0x81fb('0xb'):this[_0x81fb('0xb')](_0x422cd9);break;case'booked':this['handlePower'](_0x422cd9,0x1);break;default:logger['error'](_0x81fb('0xbb'),_0x422cd9['name'],_0x81fb('0xbc'));}};Dialer[_0x81fb('0x1a')]['ifTime']=function(_0x416c03,_0x3d4d5d){var _0x53af53=_0x416c03[_0x81fb('0xb4')];var _0xc19bed=_0x3d4d5d?_0x416c03[_0x81fb('0xb3')]:_0x416c03[_0x81fb('0x7d')][_0x81fb('0x80')];logger[_0x81fb('0xbd')](_0x81fb('0xbe'),_0xc19bed,_0x53af53,_0x416c03[_0x81fb('0x67')],util[_0x81fb('0x4b')]('Voice\x20Queue\x20%s\x20$s',_0x416c03[_0x81fb('0x67')],_0x416c03['id']));var _0x3806ba=null;return Interval[_0x81fb('0xbf')](_0xc19bed,_0x53af53)[_0x81fb('0x44')](function(_0x5f1a12){if(_0x5f1a12===!![]){return _0x5f1a12;}else{_0x416c03[_0x81fb('0x73')]=_0x3d4d5d?utils['CAMPAIGN_STATUS'][_0x81fb('0xab')]:utils[_0x81fb('0x70')][_0x81fb('0xc0')];_0x3806ba=msgResponse(_0x81fb('0xac'),_0x81fb('0x9b'),_0x81fb('0xc1')+_0x3d4d5d+'\x20'+_0x416c03[_0x81fb('0x67')]+_0x81fb('0xad')+util[_0x81fb('0x4a')](_0xc19bed,{'showHidden':![],'depth':null})+_0x81fb('0xae')+_0x53af53);}if(_0x3806ba!==null){logger[_0x81fb('0xbd')](_0x81fb('0xc2'),_0x3806ba);_0x3806ba[_0x81fb('0xc3')]=_0x3d4d5d;throw _0x3806ba;}})[_0x81fb('0xa8')](function(_0x445be0){logger[_0x81fb('0x6c')]('AMI\x20IfTime',_0x445be0);throw msgResponse(_0x81fb('0x8b'),'Error',util[_0x81fb('0x4a')](_0x445be0,{'showHidden':![],'depth':null}));});};Dialer[_0x81fb('0x1a')][_0x81fb('0x30')]=function(_0x542a09){if(this[_0x81fb('0x1f')][_0x542a09['queue']]){if(this[_0x81fb('0x27')][_0x542a09[_0x81fb('0xc4')]]&&this[_0x81fb('0x27')][_0x542a09[_0x81fb('0xc4')]][_0x81fb('0xc5')]!=='ivr'){this[_0x81fb('0xc6')](this['voiceQueues'][_0x542a09['queue']]);this[_0x81fb('0x27')][_0x542a09[_0x81fb('0xc4')]]['answertime']=moment()['format'](_0x81fb('0xc7'));}}};Dialer['prototype'][_0x81fb('0x37')]=function(_0x15082a){var _0x5a7834=this['uniqueId'][_0x15082a['uniqueid']];if(this[_0x81fb('0x1f')][_0x15082a[_0x81fb('0xc8')]]){if(_0x5a7834&&_0x5a7834[_0x81fb('0xc5')]!==_0x81fb('0xc9')){delete this[_0x81fb('0x27')][_0x15082a[_0x81fb('0xc4')]];this[_0x81fb('0x1f')][_0x15082a['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3b9ca1=new AgentComplete(_0x5a7834,_0x15082a);if(_0x15082a[_0x81fb('0xca')]===_0x81fb('0xcb')){_0x3b9ca1[_0x81fb('0xcc')]=this[_0x81fb('0x1f')][_0x15082a[_0x81fb('0xc8')]]['dialQueueProject2']&&this['voiceQueues'][_0x15082a[_0x81fb('0xc8')]][_0x81fb('0xcd')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x81fb('0xce')](_0x3b9ca1)['catch'](loggerCatch(_0x81fb('0xcf')));hopperUtils[_0x81fb('0xd0')](_0x3b9ca1)[_0x81fb('0xa8')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x81fb('0x1a')]['syncQueueCallerAbandon']=function(_0x600841){var _0x2cb594=this[_0x81fb('0x27')][_0x600841[_0x81fb('0xc4')]];var _0x5dd313=this;var _0x1e4194=![];var _0x3705ec;var _0x3f3050;if(this[_0x81fb('0x1f')][_0x600841['queue']]){if(_0x2cb594&&_0x2cb594['type']!==_0x81fb('0xc9')){delete this[_0x81fb('0x27')][_0x600841[_0x81fb('0xc4')]];this[_0x81fb('0xc6')](this['voiceQueues'][_0x600841[_0x81fb('0xc8')]]);_0x2cb594[_0x81fb('0xd1')]=moment()['format'](_0x81fb('0xc7'));var _0x43d638=new QueueCallerAbandon(_0x2cb594,_0x600841);if(utils[_0x81fb('0x66')](_0x2cb594[_0x81fb('0xd1')],_0x2cb594[_0x81fb('0xd2')])>=_0x2cb594[_0x81fb('0xd3')]){this[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]][_0x81fb('0x53')]+=0x1;this[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]][_0x81fb('0xd4')]+=0x1;this[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]][_0x81fb('0xd5')]+=0x1;_0x43d638[_0x81fb('0x76')]=0xa;_0x43d638['statedesc']=_0x81fb('0xd6');_0x43d638[_0x81fb('0xd7')]=_0x81fb('0xd8');_0x43d638[_0x81fb('0xcc')]=this[_0x81fb('0x1f')][_0x600841['queue']]['dialQueueProject2']?moment()[_0x81fb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x43d638['countdropretry']+=0x1;_0x43d638[_0x81fb('0xd9')]+=0x1;_0x3705ec=this[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]][_0x81fb('0xda')];_0x3f3050=this['voiceQueues'][_0x600841['queue']][_0x81fb('0xdb')];hopperUtils['verifyAdditionalPhones'](_0x43d638,_0x43d638[_0x81fb('0x76')],_0x2cb594['voiceQueue'])[_0x81fb('0x44')](function(_0x4b6f9f){_0x1e4194=_0x4b6f9f[_0x81fb('0xdc')]==0x1;if(_0x43d638[_0x81fb('0xdd')]>=_0x5dd313[_0x81fb('0x1f')][_0x600841['queue']][_0x81fb('0xde')]){_0x5dd313[_0x81fb('0xdf')](_0x43d638,_0x4b6f9f['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x43d638[_0x81fb('0xdd')],'scheduledat':moment()['add'](_0x5dd313[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]][_0x81fb('0xda')],_0x81fb('0xe0'))[_0x81fb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cb594[_0x81fb('0xe1')],'ListId':_0x2cb594[_0x81fb('0xe2')],'VoiceQueueId':_0x2cb594[_0x81fb('0xe3')]||undefined,'CampaignId':_0x2cb594[_0x81fb('0xe4')]||undefined})[_0x81fb('0xa8')](loggerCatch('[rescheduleContact][Drop]'));var _0x231495=new History(_0x43d638);_0x231495[_0x81fb('0x76')]=0xa;_0x231495['statedesc']=_0x81fb('0xd6');_0x231495[_0x81fb('0x79')]=moment()[_0x81fb('0x4b')](_0x81fb('0xc7'));_0x231495[_0x81fb('0x78')]=_0x231495['starttime'];_0x231495['calleridname']=_0x43d638[_0x81fb('0xe5')];_0x231495[_0x81fb('0xe6')]=_0x43d638[_0x81fb('0xe6')];hopperUtils[_0x81fb('0xce')](_0x231495)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0xe7')));}})[_0x81fb('0x44')](function(){if(_0x1e4194)hopperUtils['swapAdditionalPhones'](_0x43d638,_0x3705ec,_0x3f3050)[_0x81fb('0x44')](function(){return 0x1;});});}else{this[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]][_0x81fb('0x55')]+=0x1;this[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]]['outboundDropCallsDayCallersExit']+=0x1;_0x43d638['state']=0xb;_0x43d638['statedesc']='Abandoned';_0x43d638[_0x81fb('0xd7')]='CALLEREXIT';_0x43d638['countabandonedretry']+=0x1;_0x43d638[_0x81fb('0xd9')]+=0x1;_0x3705ec=this[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]]['dialAbandonedRetryFrequency'];_0x3f3050=this[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]][_0x81fb('0xdb')];hopperUtils[_0x81fb('0xe8')](_0x43d638,_0x43d638[_0x81fb('0x76')],_0x2cb594[_0x81fb('0xe9')])['then'](function(_0x37b1a1){if(_0x43d638[_0x81fb('0xea')]>=_0x5dd313[_0x81fb('0x1f')][_0x600841[_0x81fb('0xc8')]]['dialAbandonedMaxRetry']){_0x5dd313['queueCallerAbandonCreateState'](_0x43d638,_0x37b1a1[_0x81fb('0xdc')]);}else{hopperUtils[_0x81fb('0xeb')]({'active':![],'countabandonedretry':_0x43d638[_0x81fb('0xea')],'scheduledat':moment()[_0x81fb('0xec')](_0x5dd313['voiceQueues'][_0x600841['queue']][_0x81fb('0xed')],_0x81fb('0xe0'))[_0x81fb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2cb594[_0x81fb('0xe1')],'ListId':_0x2cb594[_0x81fb('0xe2')],'VoiceQueueId':_0x2cb594['VoiceQueueId']||undefined,'CampaignId':_0x2cb594[_0x81fb('0xe4')]||undefined})[_0x81fb('0xa8')](loggerCatch(_0x81fb('0xee')));var _0x4d3218=new History(_0x43d638);_0x4d3218['state']=0xb;_0x4d3218[_0x81fb('0x77')]=_0x81fb('0xef');_0x4d3218['starttime']=moment()[_0x81fb('0x4b')](_0x81fb('0xc7'));_0x4d3218[_0x81fb('0x78')]=_0x4d3218[_0x81fb('0x79')];_0x4d3218[_0x81fb('0xe5')]=_0x43d638[_0x81fb('0xe5')];_0x4d3218[_0x81fb('0xe6')]=_0x43d638[_0x81fb('0xe6')];hopperUtils[_0x81fb('0xce')](_0x4d3218)[_0x81fb('0xa8')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x81fb('0x44')](function(){if(_0x1e4194)hopperUtils[_0x81fb('0xf0')](_0x43d638,_0x3705ec,_0x3f3050)[_0x81fb('0x44')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x81fb('0x3a')]=function(_0x3a762b){if(this['actions'][_0x3a762b[_0x81fb('0xc4')]]){this[_0x81fb('0x25')][_0x3a762b[_0x81fb('0xc4')]]['channel']=_0x3a762b[_0x81fb('0xf1')];}if(this[_0x81fb('0x27')][_0x3a762b[_0x81fb('0xc4')]]){this[_0x81fb('0x27')][_0x3a762b['uniqueid']][_0x81fb('0xf1')]=_0x3a762b['channel'];}};Dialer['prototype'][_0x81fb('0x3e')]=function(_0x50019b){if(!this['actions'][_0x50019b[_0x81fb('0xf2')]]){return;}var _0x44b52d=this[_0x81fb('0x1f')][this[_0x81fb('0x25')][_0x50019b[_0x81fb('0xf2')]][_0x81fb('0xc8')]]['strategy']||_0x81fb('0xf3');if(_0x44b52d==='roundrobin'){if(this[_0x81fb('0x25')][_0x50019b[_0x81fb('0xf2')]]&&_[_0x81fb('0xf4')](this['actions'][_0x50019b[_0x81fb('0xf2')]]['locked'])&&_0x50019b[_0x81fb('0x91')]==='1'&&_0x50019b[_0x81fb('0xf5')]==='0'){if(this[_0x81fb('0x21')][_0x50019b[_0x81fb('0xf6')]]){if(!this[_0x81fb('0x21')][_0x50019b[_0x81fb('0xf6')]][_0x81fb('0xf7')]){this[_0x81fb('0x21')][_0x50019b[_0x81fb('0xf6')]][_0x81fb('0xf7')]=!![];this[_0x81fb('0x25')][_0x50019b['actionid']][_0x81fb('0xf7')]=!![];this[_0x81fb('0x25')][_0x50019b['actionid']][_0x81fb('0xf6')]=_0x50019b[_0x81fb('0xf6')];}}}}else if(_0x44b52d===_0x81fb('0xf3')){if(this['actions'][_0x50019b[_0x81fb('0xf2')]]){if(this[_0x81fb('0x21')][_0x50019b['stateinterface']]){this['actions'][_0x50019b[_0x81fb('0xf2')]]['stateinterface']=_0x50019b[_0x81fb('0xf6')];if(_['isNil'](this[_0x81fb('0x2c')][this[_0x81fb('0x25')][_0x50019b['actionid']][_0x81fb('0xc8')]])){this[_0x81fb('0x2c')][this['actions'][_0x50019b[_0x81fb('0xf2')]][_0x81fb('0xc8')]]=[];}this[_0x81fb('0x2c')][this['actions'][_0x50019b[_0x81fb('0xf2')]][_0x81fb('0xc8')]][_0x81fb('0xa9')](_[_0x81fb('0x65')](_[_0x81fb('0xf8')](this[_0x81fb('0x25')][_0x50019b[_0x81fb('0xf2')]],['idHopper',_0x81fb('0xf6')]),{'status':_0x50019b['status'],'paused':_0x50019b[_0x81fb('0xf5')]}));}}}};Dialer[_0x81fb('0x1a')][_0x81fb('0x40')]=function(_0x4d9f37){if(!this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]]){return;}var _0x5c1448=this;var _0x154696=this[_0x81fb('0x1f')][this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]]['queue']];var _0xfb782e=_0x154696[_0x81fb('0xf9')]||_0x81fb('0xf3');if(_0xfb782e===_0x81fb('0xfa')){if(this['actions'][_0x4d9f37[_0x81fb('0xf2')]]&&this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]]['stateinterface']){this[_0x81fb('0x1e')]['run'](this[_0x81fb('0x25')][_0x4d9f37['actionid']][_0x81fb('0xfb')],this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xf6')])[_0x81fb('0xa8')](function(_0xa13977){logger[_0x81fb('0x6c')](_0x81fb('0xfc'),util['inspect'](_0xa13977,{'showHidden':![],'depth':null}));})[_0x81fb('0x1c')](function(){_0x5c1448[_0x81fb('0xc6')](_0x5c1448['voiceQueues'][_0x5c1448[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]]['queue']]);_0x5c1448[_0x81fb('0x21')][_0x5c1448[_0x81fb('0x25')][_0x4d9f37['actionid']][_0x81fb('0xf6')]][_0x81fb('0xf7')]=![];delete _0x5c1448[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]];unlockQueueStatus(_0x154696);});}else{this[_0x81fb('0xc6')](this[_0x81fb('0x1f')][this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xc8')]]);hopperUtils[_0x81fb('0xeb')]({'active':![],'ContactId':this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]]['ContactId'],'ListId':this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xe2')],'VoiceQueueId':this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xe3')]||undefined,'CampaignId':this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xe4')]||undefined})[_0x81fb('0xa8')](loggerCatch(_0x81fb('0xfd')));delete this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]];unlockQueueStatus(_0x154696);}}else if(_0xfb782e===_0x81fb('0xf3')){var _0x5287e4;if(this['actions'][_0x4d9f37[_0x81fb('0xf2')]]&&!_[_0x81fb('0x4d')](this[_0x81fb('0x2c')][this[_0x81fb('0x25')][_0x4d9f37['actionid']][_0x81fb('0xc8')]])){if(this[_0x81fb('0x2d')][_0x5c1448[_0x81fb('0x25')][_0x4d9f37['actionid']][_0x81fb('0xc8')]]){this[_0x81fb('0x2d')][_0x5c1448[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xc8')]]=this[_0x81fb('0x2d')][this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xc8')]]?this[_0x81fb('0x2d')][this['actions'][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xc8')]]:this['queueBooked'][this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xc8')]]?this[_0x81fb('0x2c')][this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xc8')]]['_rr']||0x0:0x0;}this[_0x81fb('0x2c')][this[_0x81fb('0x25')][_0x4d9f37['actionid']][_0x81fb('0xc8')]][_0x81fb('0xfe')]=this[_0x81fb('0x2d')][this[_0x81fb('0x25')][_0x4d9f37[_0x81fb('0xf2')]][_0x81fb('0xc8')]];for(var _0x13fe33=0x0;_0x13fe33=_0x415825['dialGlobalMaxRetry']){_0x139c96['stateGlobal'](_0x58184f,_0x18c2f5,_0x3f1458,_0x81fb('0x124'));}else{if(_0x58184f['countmachineretry']>=_0x415825[_0x81fb('0x125')]){_0x139c96[_0x81fb('0x126')](_0x58184f,_0x18c2f5,_0x3f1458,_0x81fb('0x127'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x58184f['countmachineretry'],'scheduledat':moment()['add'](_0x415825['dialMachineRetryFrequency'],_0x81fb('0xe0'))[_0x81fb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x58184f[_0x81fb('0xe1')],'ListId':_0x58184f[_0x81fb('0xe2')],'VoiceQueueId':_0x58184f['VoiceQueueId']||undefined,'CampaignId':_0x58184f[_0x81fb('0xe4')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x18c2f5({'reschedule':0x1});}}});}if(_0x2874a3[_0x81fb('0xc5')]===_0x81fb('0xc9')&&this['campaigns'][_0x2874a3[_0x81fb('0xc8')]][_0x81fb('0x119')]&&_0x172a01[_0x81fb('0x110')]==='HANGUP'){delete this[_0x81fb('0x27')][_0x172a01['uniqueid']];this[_0x81fb('0xc6')](this[_0x81fb('0x20')][_0x2874a3[_0x81fb('0xc8')]]);_0x4d64fc=new Hangup(_0x2874a3,_0x172a01);_0x4d64fc['state']=0x12;_0x4d64fc['statedesc']=_0x81fb('0x113');_0x4d64fc[_0x81fb('0x11c')]=_0x81fb('0x114');ami['emit']('custom:amd',ut[_0x81fb('0x11e')](_0x4d64fc,_0x81fb('0x11d')));this['saveInDb'](_0x4d64fc,_0x81fb('0x128'),_0x81fb('0x129'));}if(_0x2874a3['type']===_0x81fb('0xc9')&&this[_0x81fb('0x20')][_0x2874a3[_0x81fb('0xc8')]][_0x81fb('0x119')]&&_0x172a01[_0x81fb('0x110')]==='MACHINE'){return new Promise(function(_0x478311,_0x232cdf){delete _0x139c96[_0x81fb('0x27')][_0x172a01['uniqueid']];_0x139c96[_0x81fb('0xc6')](_0x139c96[_0x81fb('0x20')][_0x2874a3[_0x81fb('0xc8')]]);_0x139c96['campaigns'][_0x2874a3[_0x81fb('0xc8')]][_0x81fb('0x112')]+=0x1;_0x139c96[_0x81fb('0x20')][_0x2874a3[_0x81fb('0xc8')]][_0x81fb('0x11b')]+=0x1;var _0x36dca7=_0x139c96[_0x81fb('0x20')][_0x2874a3[_0x81fb('0xc8')]];var _0x55adb5=new Hangup(_0x2874a3,_0x172a01);_0x55adb5[_0x81fb('0x76')]=0x13;_0x55adb5[_0x81fb('0x77')]=_0x81fb('0x12a');_0x55adb5[_0x81fb('0x11c')]='AMD';_0x55adb5[_0x81fb('0x122')]+=0x1;_0x55adb5[_0x81fb('0xd9')]+=0x1;_0x55adb5[_0x81fb('0x11d')]=!![];ami[_0x81fb('0x46')](_0x81fb('0x115'),ut[_0x81fb('0x11e')](_0x55adb5,_0x81fb('0x11d')));hopperUtils[_0x81fb('0xce')](_0x55adb5)[_0x81fb('0xa8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x55adb5[_0x81fb('0x12b')]+_0x55adb5[_0x81fb('0x11f')]+_0x55adb5['countnoanswerretry']+_0x55adb5['countnosuchnumberretry']+_0x55adb5['countdropretry']+_0x55adb5[_0x81fb('0xea')]+_0x55adb5[_0x81fb('0x122')]+_0x55adb5[_0x81fb('0x123')]>=_0x36dca7[_0x81fb('0x12c')]){_0x139c96['stateGlobal'](_0x55adb5,_0x478311,_0x232cdf,_0x81fb('0x124'));}else{if(_0x55adb5[_0x81fb('0x122')]>=_0x36dca7[_0x81fb('0x125')]){_0x139c96[_0x81fb('0x126')](_0x55adb5,_0x478311,_0x232cdf,'reason\x2019\x20machine....');}else{hopperUtils[_0x81fb('0xeb')]({'active':![],'countmachineretry':_0x55adb5[_0x81fb('0x122')],'scheduledat':moment()['add'](_0x36dca7[_0x81fb('0x12d')],_0x81fb('0xe0'))[_0x81fb('0x4b')](_0x81fb('0xc7')),'ContactId':_0x55adb5[_0x81fb('0xe1')],'ListId':_0x55adb5['ListId'],'VoiceQueueId':_0x55adb5[_0x81fb('0xe3')]||undefined,'CampaignId':_0x55adb5['CampaignId']||undefined})['catch'](loggerCatch(_0x81fb('0x12e')));_0x478311({'reschedule':0x1});}}});}}};Dialer[_0x81fb('0x1a')][_0x81fb('0x39')]=function(_0x505b21){var _0x5c186d=this[_0x81fb('0x27')][_0x505b21[_0x81fb('0xc4')]];var _0x524e60;if(_0x5c186d&&_0x5c186d[_0x81fb('0xc5')]===_0x81fb('0xc9')){delete this[_0x81fb('0x27')][_0x505b21[_0x81fb('0xc4')]];this[_0x81fb('0xc6')](this[_0x81fb('0x20')][_0x5c186d[_0x81fb('0xc8')]]);this[_0x81fb('0x20')][_0x5c186d[_0x81fb('0xc8')]]['ivrAnswerCallsDay']+=0x1;_0x524e60=new Hangup(_0x5c186d,_0x505b21);hopperUtils[_0x81fb('0xce')](_0x524e60)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x12f')));hopperUtils[_0x81fb('0xd0')](_0x524e60)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x130')));}if(_0x5c186d&&_0x5c186d['type']!==_0x81fb('0xc9')&&isNotNull(this['voiceQueues'][_0x5c186d[_0x81fb('0xc8')]]['dialQueueProject'])){delete this[_0x81fb('0x27')][_0x505b21['uniqueid']];this[_0x81fb('0xc6')](this['voiceQueues'][_0x5c186d[_0x81fb('0xc8')]]);this[_0x81fb('0x1f')][_0x5c186d[_0x81fb('0xc8')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x5c186d[_0x81fb('0xc8')]][_0x81fb('0x11b')]+=0x1;_0x524e60=new Hangup(_0x5c186d,_0x505b21);_0x524e60[_0x81fb('0x76')]=0x10;_0x524e60[_0x81fb('0x77')]=_0x81fb('0x131');_0x524e60['membername']='AGI';hopperUtils[_0x81fb('0xce')](_0x524e60)[_0x81fb('0xa8')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x81fb('0xd0')](_0x524e60)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x130')));}if(_0x5c186d&&_0x5c186d[_0x81fb('0xc5')]!==_0x81fb('0xc9')&&!isNotNull(this[_0x81fb('0x1f')][_0x5c186d['queue']]['dialQueueProject'])){if(_0x505b21[_0x81fb('0x132')]===_0x81fb('0x133')){delete this[_0x81fb('0x27')][_0x505b21[_0x81fb('0xc4')]];this[_0x81fb('0x1f')][_0x5c186d[_0x81fb('0xc8')]][_0x81fb('0x112')]+=0x1;const _0x4303db=new AgentComplete(_0x5c186d,_0x505b21);_0x4303db[_0x81fb('0xe4')]=this['voiceQueues'][_0x5c186d[_0x81fb('0xc8')]]['id'];hopperUtils[_0x81fb('0xce')](_0x4303db)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0xcf')));hopperUtils[_0x81fb('0xd0')](_0x4303db)['catch'](loggerCatch(_0x81fb('0x134')));}else{delete this[_0x81fb('0x27')][_0x505b21['uniqueid']];this[_0x81fb('0xc6')](this[_0x81fb('0x1f')][_0x5c186d[_0x81fb('0xc8')]]);this[_0x81fb('0x1f')][_0x5c186d[_0x81fb('0xc8')]]['outboundUnknownCallsDay']+=0x1;_0x524e60=new Hangup(_0x5c186d,_0x505b21);_0x524e60[_0x81fb('0x76')]=0xc;_0x524e60['statedesc']=_0x505b21[_0x81fb('0x132')];_0x524e60[_0x81fb('0x11c')]='Unknow';hopperUtils[_0x81fb('0xce')](_0x524e60)['catch'](loggerCatch(_0x81fb('0x12f')));hopperUtils[_0x81fb('0xd0')](_0x524e60)['catch'](loggerCatch(_0x81fb('0x130')));}}};Dialer[_0x81fb('0x1a')][_0x81fb('0xc')]=function(_0x442590){var _0x546fc0=this;if(!_0x546fc0[_0x81fb('0x2e')][_0x442590[_0x81fb('0x67')]]){_0x546fc0[_0x81fb('0x2e')][_0x442590[_0x81fb('0x67')]]={'running':![]};}else if(_0x546fc0[_0x81fb('0x2e')][_0x442590['name']][_0x81fb('0x135')]===!![]){return;}else if(_0x546fc0[_0x81fb('0x2e')][_0x442590[_0x81fb('0x67')]][_0x81fb('0x135')]===![]){_0x546fc0[_0x81fb('0x2e')][_0x442590['name']][_0x81fb('0x135')]=!![];}var _0x549d02=_0x546fc0[_0x81fb('0x1f')][_0x442590[_0x81fb('0x67')]];var _0x443efe=_0x549d02['message']!==utils['CAMPAIGN_STATUS'][_0x81fb('0x87')];var _0xc333b=utils['isPreviewCampaign'](_0x549d02);_0x549d02[_0x81fb('0x136')]=utils['getQueueCampaignStatusMessage'](_0x549d02,_0x546fc0[_0x81fb('0x22')]);Promise['resolve']()[_0x81fb('0x44')](function(){if(_0x549d02[_0x81fb('0x136')]===utils[_0x81fb('0x70')][_0x81fb('0x87')]){if(_0x443efe){clearPredictiveAttributes(_0x549d02);_0x442590[_0x81fb('0x29')]=undefined;_0x442590[_0x81fb('0x2a')]=undefined;}if(_0x549d02[_0x81fb('0x136')]===utils[_0x81fb('0x70')][_0x81fb('0x87')]){_0x442590[_0x81fb('0x137')]=0x0;_0x442590[_0x81fb('0xf5')]=0x0;_0x442590[_0x81fb('0x138')]=0x0;_0x442590[_0x81fb('0x139')]=0x0;_0x442590['pTalking']=0x0;}}else if(_0x549d02['statusMessage']===utils[_0x81fb('0x70')][_0x81fb('0x13a')]&&!_0xc333b){return _0x546fc0[_0x81fb('0x9a')](_0x549d02,!![])['then'](function(){return _0x546fc0[_0x81fb('0x9a')](_0x549d02,![]);})[_0x81fb('0x44')](function(){return _0x546fc0[_0x81fb('0xb7')](_0x549d02);})[_0x81fb('0xa8')](function(_0x43c7a0){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0x81fb('0x4a')](_0x43c7a0,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x549d02);});}else{clearPredictiveAttributes(_0x549d02);}})['then'](function(){var _0x3839ea=_0x442590[_0x81fb('0x13b')](_0x549d02);if(_0x3839ea||_0x549d02[_0x81fb('0x13c')]){_0x549d02['queueSummaryCountersUpdated']=![];_0x442590[_0x81fb('0x13d')](_0x549d02);Object[_0x81fb('0x13e')](_0x549d02,_0x442590);emitOutboundVoiceQueueSummary(_0x442590);}_0x546fc0[_0x81fb('0x2e')][_0x549d02[_0x81fb('0x67')]][_0x81fb('0x135')]=![];})[_0x81fb('0xa8')](function(_0x3f18b8){logger[_0x81fb('0x6c')](_0x81fb('0x13f'),util['inspect'](_0x3f18b8,{'showHidden':![],'depth':null}));_0x546fc0[_0x81fb('0x2e')][_0x549d02[_0x81fb('0x67')]][_0x81fb('0x135')]=![];});};Dialer[_0x81fb('0x1a')][_0x81fb('0x140')]=_[_0x81fb('0x141')](function(){var _0xaef9e3=_[_0x81fb('0x142')](this[_0x81fb('0x1f')],function(_0x46863f){return _0x46863f[_0x81fb('0x143')];});var _0xfaa441=_['filter'](this['agents'],function(_0x448b18){return _0x448b18[_0x81fb('0x144')]&&_0x448b18[_0x81fb('0x91')]===_0x81fb('0x92');});if(_0xaef9e3[_0x81fb('0xff')]>0x0&&_0xfaa441[_0x81fb('0xff')]>0x0){return Promise['resolve']()[_0x81fb('0x44')](cmHopper[_0x81fb('0x145')](_[_0x81fb('0x146')](_0xaef9e3,'id'),previewRecallmeReminderInterval,_[_0x81fb('0x146')](_0xfaa441,'id')))[_0x81fb('0x44')](function(_0x180b29){for(var _0x3af3da=0x0;_0x3af3da<_0x180b29[_0x81fb('0xff')];_0x3af3da++){var _0x131753=_0x180b29[_0x3af3da][_0x81fb('0x147')]['name'];if(_0x131753)io['to'](util['format'](_0x81fb('0x148'),_0x131753))['emit'](_0x81fb('0x149'),{'hopper':_0x180b29[_0x3af3da]});}})['catch'](function(_0x101114){logger[_0x81fb('0x6c')](_0x81fb('0x14a'),_0x101114);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x81fb('0x1a')][_0x81fb('0x42')]=function(){var _0x5b672c=this;setInterval(function(){_0x5b672c[_0x81fb('0x14b')](_0x5b672c['uniqueId'],_0x81fb('0x14c'));_0x5b672c[_0x81fb('0x14b')](_0x5b672c[_0x81fb('0x25')],_0x81fb('0x14d'));},0x32c8);};Dialer[_0x81fb('0x1a')][_0x81fb('0x14b')]=function(_0x570c5c,_0x3da9ca){var _0x26095d=this;for(var _0x7da40a in _0x570c5c){if(typeof _0x570c5c[_0x7da40a]!==_0x81fb('0xb1')){this[_0x81fb('0x1d')][_0x81fb('0x14e')](function(){if(!_[_0x81fb('0xf4')](_0x570c5c[_0x7da40a])){return ami[_0x81fb('0xa2')]({'action':_0x81fb('0x91'),'channel':_0x570c5c[_0x7da40a]['channel']})[_0x81fb('0xa8')](function(_0x5a2fb0){if(_0x5a2fb0[_0x81fb('0x73')]===_0x81fb('0x14f')){setTimeout(function(){if(_0x570c5c[_0x7da40a]&&_0x570c5c[_0x7da40a][_0x81fb('0xc5')]!=='ivr'){_0x26095d[_0x81fb('0xc6')](_0x26095d['voiceQueues'][_0x570c5c[_0x7da40a]['queue']]);logger['error'](_0x81fb('0x150'),_0x3da9ca,_0x7da40a,_0x570c5c[_0x7da40a][_0x81fb('0xc8')]);delete _0x570c5c[_0x7da40a];}if(_0x570c5c[_0x7da40a]&&_0x570c5c[_0x7da40a][_0x81fb('0xc5')]==='ivr'){_0x26095d[_0x81fb('0xc6')](_0x26095d[_0x81fb('0x20')][_0x570c5c[_0x7da40a]['queue']]);logger[_0x81fb('0x6c')](_0x81fb('0x151'),_0x3da9ca,_0x7da40a,_0x570c5c[_0x7da40a][_0x81fb('0xc8')]);delete _0x570c5c[_0x7da40a];}},0x2328);}});}});}}};Dialer['prototype'][_0x81fb('0x152')]=function(_0x3dc048){return Promise[_0x81fb('0xb2')]()[_0x81fb('0x44')](voiceQueueRt[_0x81fb('0x152')](_0x3dc048))['catch'](loggerCatch(_0x81fb('0x153')));};Dialer[_0x81fb('0x1a')][_0x81fb('0xc6')]=function(_0x356c83){if(!_[_0x81fb('0x5a')](_0x356c83)&&_0x356c83!==null){if(typeof _0x356c83[_0x81fb('0x85')]!==_0x81fb('0xb1')){if(_0x356c83[_0x81fb('0x85')]>0x0){_0x356c83[_0x81fb('0x85')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x81fb('0x1a')][_0x81fb('0x154')]=function(_0x38787a,_0x5c57f8){var _0x4ca4c3=this;return function(_0x18ee39){_0x4ca4c3['updateOriginated'](_0x5c57f8);logger[_0x81fb('0x6c')](_0x38787a,util[_0x81fb('0x4a')](_0x18ee39,{'showHidden':![],'depth':null}));};};Dialer[_0x81fb('0x1a')][_0x81fb('0x155')]=function(_0x3c1d44,_0x1cd9f2,_0x7dfdba){var _0x453fa5={'state':0x19,'statedesc':_0x81fb('0x156')};this[_0x81fb('0xc6')](_0x1cd9f2);this[_0x81fb('0x116')](_[_0x81fb('0x65')](_0x453fa5,_[_0x81fb('0xf8')](_0x7dfdba,[_0x81fb('0xe1'),_0x81fb('0xe2'),_0x81fb('0x157'),_0x81fb('0xe3'),_0x81fb('0xe4')])),_0x81fb('0x158'),'[emptyContact]');logger[_0x81fb('0x6c')](_0x3c1d44);};Dialer[_0x81fb('0x1a')][_0x81fb('0x116')]=function(_0x658208,_0x20e44b,_0x77c0cc){hopperUtils[_0x81fb('0xce')](_0x658208)[_0x81fb('0xa8')](loggerCatch(_0x20e44b));hopperUtils['moveContactManagedDialer'](_0x658208)[_0x81fb('0xa8')](loggerCatch(_0x77c0cc));};Dialer['prototype'][_0x81fb('0xdf')]=function(_0xe2703a,_0x20483a){hopperUtils[_0x81fb('0xce')](_0xe2703a)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0xcf')));if(_0x20483a==0x0){hopperUtils['moveContactManagedDialer'](_0xe2703a)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x159')));}};Dialer[_0x81fb('0x1a')][_0x81fb('0x14a')]=function(_0xb02f9){return Promise[_0x81fb('0xb2')]()[_0x81fb('0x44')](cmHopper[_0x81fb('0x145')](_0xb02f9['id'],previewRecallmeReminderInterval))['then'](function(_0x2cdc56){for(var _0x58c89b=0x0;_0x58c89b<_0x2cdc56[_0x81fb('0xff')];_0x58c89b++){var _0x42ce31=_0x2cdc56[_0x58c89b][_0x81fb('0x147')][_0x81fb('0x67')];if(_0x42ce31)io['to'](util[_0x81fb('0x4b')](_0x81fb('0x148'),_0x42ce31))[_0x81fb('0x46')](_0x81fb('0x149'),{'hopper':_0x2cdc56[_0x58c89b]});}})[_0x81fb('0xa8')](function(){});};Dialer[_0x81fb('0x1a')][_0x81fb('0xb5')]=function(_0x4fa39f){var _0xf0e372=this;return function(){_0xf0e372[_0x81fb('0x15a')](_0x4fa39f);};};Dialer[_0x81fb('0x1a')][_0x81fb('0x15b')]=function(_0x2531cd,_0x2b5514){var _0x2efc71=this;var _0x4795db=uuid['v4']();this[_0x81fb('0x25')][_0x4795db]=new Action(_0x2531cd,_0x2b5514,_0x4795db);return new Promise(function(_0x473dd6,_0x4e2a3c){if(_[_0x81fb('0x5a')](_0x2531cd)&&typeof _0x2531cd!==_0x81fb('0x15c')){return _0x4e2a3c(msgResponse(_0x81fb('0x15d'),_0x81fb('0x9b'),_0x81fb('0x15e')));}if(_[_0x81fb('0x5a')](_0x2b5514[_0x81fb('0x15f')])||_0x2b5514[_0x81fb('0x15f')]===null){return _0x4e2a3c(msgResponse('originate',_0x81fb('0x9b'),'contact\x20is\x20undefine'));}var _0x1cef02={'XMD-CALLERID':_0x2efc71[_0x81fb('0x25')][_0x4795db]['getCaller'](),'XMD-AGI':_0x2531cd[_0x81fb('0x160')]?util[_0x81fb('0x4b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2531cd[_0x81fb('0x160')]):_0x81fb('0x161'),'XMD-AGIAFTER':_0x2531cd[_0x81fb('0x162')]?util[_0x81fb('0x4b')](_0x81fb('0x163'),ipAgi,_0x2531cd[_0x81fb('0x162')]):_0x81fb('0x161'),'XMD-QUEUE':utils[_0x81fb('0x164')](_0x2531cd)?util['format'](_0x81fb('0x165'),_0x2531cd['name'],_0x2531cd[_0x81fb('0x166')]||'',_0x2531cd[_0x81fb('0xcd')]?'c':'',_0x2531cd[_0x81fb('0xd3')]||0x3):_0x81fb('0x161'),'XMD-CONTACTID':_0x2b5514['ContactId'],'XMD-CDRTYPE':_0x81fb('0x9'),'CALLERID(all)':_0x2efc71[_0x81fb('0x25')][_0x4795db][_0x81fb('0x167')](),'XMD-AMD':_0x2531cd[_0x81fb('0x119')]?_0x81fb('0x13a'):_0x81fb('0x161'),'XMD-DESTINATION':_0x81fb('0x10f')};if(_0x2531cd[_0x81fb('0x119')]){_0x1cef02['XMD-AMDINITIALSILENCE']=_0x2531cd[_0x81fb('0x168')]||0x9c4;_0x1cef02['XMD-AMDGREETING']=_0x2531cd['dialAMDGreeting']||0x5dc;_0x1cef02[_0x81fb('0x169')]=_0x2531cd[_0x81fb('0x16a')]||0x320;_0x1cef02[_0x81fb('0x16b')]=_0x2531cd[_0x81fb('0x16c')]||0x1388;_0x1cef02[_0x81fb('0x16d')]=_0x2531cd[_0x81fb('0x16e')]||0x64;_0x1cef02[_0x81fb('0x16f')]=_0x2531cd[_0x81fb('0x170')]||0x32;_0x1cef02['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2531cd[_0x81fb('0x171')]||0x3;_0x1cef02[_0x81fb('0x172')]=_0x2531cd[_0x81fb('0x173')]||0x100;_0x1cef02[_0x81fb('0x174')]=_0x2531cd['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x81fb('0x164')](_0x2531cd)){_0x1cef02[_0x81fb('0x175')]=_0x2b5514[_0x81fb('0xe3')];}else{_0x1cef02[_0x81fb('0x176')]=_0x2b5514['CampaignId'];}var _0x20c01c=utils[_0x81fb('0x177')](_0x2b5514['Contact']);Object[_0x81fb('0x13e')](_0x1cef02,_0x20c01c);var _0x306a65=_0x2efc71[_0x81fb('0x8e')](_0x2531cd[_0x81fb('0x95')])?utils[_0x81fb('0x178')](_0x2531cd[_0x81fb('0x95')][_0x81fb('0x179')],_0x2531cd[_0x81fb('0x17a')],_0x2531cd[_0x81fb('0x17b')]>0x0?utils['getCallerIdRandom'](_0x2531cd[_0x81fb('0x17c')],_0x2531cd[_0x81fb('0x17b')]):_0x2531cd[_0x81fb('0x17c')]):utils[_0x81fb('0x178')](_[_0x81fb('0xf4')](_0x2531cd[_0x81fb('0x96')])?_0x2531cd[_0x81fb('0x95')][_0x81fb('0x179')]:_0x2531cd[_0x81fb('0x96')][_0x81fb('0x179')],_0x2531cd['dialOriginateCallerIdName'],_0x2531cd[_0x81fb('0x17b')]>0x0?utils[_0x81fb('0x17d')](_0x2531cd[_0x81fb('0x17c')],_0x2531cd[_0x81fb('0x17b')]):_0x2531cd[_0x81fb('0x17c')]);if(_0x306a65){_0x1cef02[_0x81fb('0x17e')]=_0x2efc71['actions'][_0x4795db][_0x81fb('0x17f')]=utils[_0x81fb('0x180')](_0x306a65);_0x1cef02['XMD-ORIGINATECALLERIDNUM']=_0x2b5514[_0x81fb('0x15f')];}_0x2531cd[_0x81fb('0x181')]=_0x1cef02;return ami[_0x81fb('0xa2')]({'actionid':_0x4795db,'action':'originate','channel':_0x2efc71[_0x81fb('0x8e')](_0x2531cd[_0x81fb('0x95')])?util[_0x81fb('0x4b')](_0x81fb('0x182'),_0x2531cd[_0x81fb('0x95')][_0x81fb('0x67')],isNotNull(_0x2531cd[_0x81fb('0x183')])?_0x2531cd[_0x81fb('0x183')][_0x81fb('0x184')]()||'':'',_0x2531cd['dialCutDigit']>0x0?_0x2b5514['phone']['substring'](_0x2531cd[_0x81fb('0x185')]):_0x2b5514[_0x81fb('0x15f')]):util[_0x81fb('0x4b')]('SIP/%s/%s%s',_[_0x81fb('0xf4')](_0x2531cd[_0x81fb('0x96')])?_0x2531cd['Trunk'][_0x81fb('0x67')]:_0x2531cd[_0x81fb('0x96')]['name'],isNotNull(_0x2531cd[_0x81fb('0x183')])?_0x2531cd[_0x81fb('0x183')]['trim']()||'':'',_0x2531cd['dialCutDigit']>0x0?_0x2b5514['phone'][_0x81fb('0x186')](_0x2531cd[_0x81fb('0x185')]):_0x2b5514[_0x81fb('0x15f')]),'callerid':_0x306a65,'Exten':_0x81fb('0x10f'),'Context':_0x81fb('0x187'),'Priority':'1','variable':_0x1cef02,'timeout':(_0x2531cd[_0x81fb('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4795db})[_0x81fb('0x44')](function(_0x5f17ab){return _0x473dd6(_0x5f17ab);})[_0x81fb('0xa8')](function(_0xfe5dcf){_0x2531cd[_0x81fb('0x189')]+=0x1;var _0x1be562=new History(_0x2efc71['actions'][_0x4795db]);logger[_0x81fb('0x6c')](util[_0x81fb('0x4b')](_0x81fb('0x18a'),JSON[_0x81fb('0x8d')](_0xfe5dcf)));_0x1be562[_0x81fb('0x76')]=0xe;_0x1be562[_0x81fb('0x77')]=_0x81fb('0x18b');_0x1be562[_0x81fb('0x79')]=moment()[_0x81fb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1be562['endtime']=_0x1be562['starttime'];hopperUtils[_0x81fb('0xce')](_0x1be562)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x18c')));_0x2efc71[_0x81fb('0xd0')](_0x1be562)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x18c')))[_0x81fb('0x1c')](function(){delete _0x2efc71[_0x81fb('0x25')][_0x4795db];return _0x4e2a3c(msgResponse('originate',_0x81fb('0x8c'),_0x81fb('0x18d')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x16acac,_0x5a3d90,_0x4c631f){var _0x1ab6c1=new History(_0x5a3d90);if(_0x1ab6c1['countbusyretry']+_0x1ab6c1['countcongestionretry']+_0x1ab6c1[_0x81fb('0x120')]+_0x1ab6c1['countnosuchnumberretry']+_0x1ab6c1['countdropretry']+_0x1ab6c1[_0x81fb('0xea')]+_0x1ab6c1[_0x81fb('0x122')]+_0x1ab6c1['countagentrejectretry']>=_0x4c631f[_0x81fb('0x12c')]-0x1){return!![];}switch(_0x16acac){case 0x3:if(_0x1ab6c1[_0x81fb('0x120')]>=_0x4c631f[_0x81fb('0x18e')]-0x1){return!![];}hopperUtils[_0x81fb('0xeb')]({'active':![],'countnoanswerretry':_0x1ab6c1['countnoanswerretry']+=0x1,'scheduledat':moment()['add'](_0x4c631f[_0x81fb('0x18f')],_0x81fb('0xe0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ab6c1['ContactId'],'ListId':_0x1ab6c1[_0x81fb('0xe2')],'VoiceQueueId':_0x1ab6c1[_0x81fb('0xe3')]||undefined,'CampaignId':_0x1ab6c1[_0x81fb('0xe4')]||undefined})['catch'](loggerCatch(_0x81fb('0x190')));break;case 0x5:if(_0x1ab6c1[_0x81fb('0x12b')]>=_0x4c631f['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x81fb('0xeb')]({'active':![],'countbusyretry':_0x1ab6c1[_0x81fb('0x12b')]+=0x1,'scheduledat':moment()['add'](_0x4c631f[_0x81fb('0x191')],_0x81fb('0xe0'))[_0x81fb('0x4b')](_0x81fb('0xc7')),'ContactId':_0x1ab6c1[_0x81fb('0xe1')],'ListId':_0x1ab6c1[_0x81fb('0xe2')],'VoiceQueueId':_0x1ab6c1[_0x81fb('0xe3')]||undefined,'CampaignId':_0x1ab6c1['CampaignId']||undefined})[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x192')));break;case 0x8:if(_0x1ab6c1[_0x81fb('0x11f')]>=_0x4c631f['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x81fb('0xeb')]({'active':![],'countcongestionretry':_0x1ab6c1[_0x81fb('0x11f')]+=0x1,'scheduledat':moment()[_0x81fb('0xec')](_0x4c631f[_0x81fb('0x193')],'minutes')[_0x81fb('0x4b')](_0x81fb('0xc7')),'ContactId':_0x1ab6c1[_0x81fb('0xe1')],'ListId':_0x1ab6c1[_0x81fb('0xe2')],'VoiceQueueId':_0x1ab6c1['VoiceQueueId']||undefined,'CampaignId':_0x1ab6c1[_0x81fb('0xe4')]||undefined})[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x194')));break;case 0x0:if(_0x1ab6c1[_0x81fb('0x121')]>=_0x4c631f[_0x81fb('0x195')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1ab6c1['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x81fb('0xec')](_0x4c631f[_0x81fb('0x196')],'minutes')[_0x81fb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ab6c1[_0x81fb('0xe1')],'ListId':_0x1ab6c1[_0x81fb('0xe2')],'VoiceQueueId':_0x1ab6c1[_0x81fb('0xe3')]||undefined,'CampaignId':_0x1ab6c1[_0x81fb('0xe4')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1ab6c1[_0x81fb('0xdd')]>=_0x4c631f[_0x81fb('0xde')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1ab6c1[_0x81fb('0xdd')]+=0x1,'scheduledat':moment()[_0x81fb('0xec')](_0x4c631f[_0x81fb('0xda')],_0x81fb('0xe0'))[_0x81fb('0x4b')](_0x81fb('0xc7')),'ContactId':_0x1ab6c1['ContactId'],'ListId':_0x1ab6c1[_0x81fb('0xe2')],'VoiceQueueId':_0x1ab6c1['VoiceQueueId']||undefined,'CampaignId':_0x1ab6c1[_0x81fb('0xe4')]||undefined})[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x197')));break;case 0xb:if(_0x1ab6c1[_0x81fb('0xea')]>=_0x4c631f['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x81fb('0xeb')]({'active':![],'countabandonedretry':_0x1ab6c1['countabandonedretry']+=0x1,'scheduledat':moment()[_0x81fb('0xec')](_0x4c631f[_0x81fb('0xed')],_0x81fb('0xe0'))[_0x81fb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ab6c1[_0x81fb('0xe1')],'ListId':_0x1ab6c1[_0x81fb('0xe2')],'VoiceQueueId':_0x1ab6c1[_0x81fb('0xe3')]||undefined,'CampaignId':_0x1ab6c1[_0x81fb('0xe4')]||undefined})[_0x81fb('0xa8')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x1ab6c1[_0x81fb('0x122')]>=_0x4c631f['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x81fb('0xeb')]({'active':![],'countmachineretry':_0x1ab6c1[_0x81fb('0x122')]+=0x1,'scheduledat':moment()['add'](_0x4c631f['dialMachineRetryFrequency'],_0x81fb('0xe0'))[_0x81fb('0x4b')](_0x81fb('0xc7')),'ContactId':_0x1ab6c1[_0x81fb('0xe1')],'ListId':_0x1ab6c1['ListId'],'VoiceQueueId':_0x1ab6c1['VoiceQueueId']||undefined,'CampaignId':_0x1ab6c1[_0x81fb('0xe4')]||undefined})[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x12e')));break;case 0x14:if(_0x1ab6c1[_0x81fb('0x123')]>=_0x4c631f['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x81fb('0xeb')]({'active':![],'countagentrejectretry':_0x1ab6c1['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x4c631f[_0x81fb('0x198')],_0x81fb('0xe0'))[_0x81fb('0x4b')](_0x81fb('0xc7')),'ContactId':_0x1ab6c1[_0x81fb('0xe1')],'ListId':_0x1ab6c1[_0x81fb('0xe2')],'VoiceQueueId':_0x1ab6c1[_0x81fb('0xe3')]||undefined,'CampaignId':_0x1ab6c1[_0x81fb('0xe4')]||undefined})[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x199')));break;default:return!![];}};Dialer[_0x81fb('0x1a')][_0x81fb('0x10b')]=function(_0x50b7ff,_0x1e137c,_0x45fe1a){var _0x2ec239=this;var _0x290c65=new History(_0x50b7ff);var _0x2287ee=![];var _0x37fb22;var _0x58d75c;return new Promise(function(_0xf7de36,_0x3f7029){if(_[_0x81fb('0x5a')](_0x1e137c)&&typeof _0x1e137c!=='object'){return _0x3f7029(msgResponse(_0x81fb('0x19a'),_0x81fb('0x9b'),'entity\x20is\x20undefine'));}if(_[_0x81fb('0x5a')](_0x45fe1a)&&typeof _0x45fe1a!==_0x81fb('0x15c')){return _0x3f7029(msgResponse(_0x81fb('0x19a'),_0x81fb('0x9b'),'evt\x20is\x20undefine'));}hopperUtils[_0x81fb('0xe8')](_0x290c65,_0x45fe1a[_0x81fb('0xca')],_0x1e137c)['then'](function(_0xd97faf){if(_0xd97faf['additional']==0x1)_0x2287ee=!![];switch(_0x45fe1a[_0x81fb('0xca')]){case'0':_0x1e137c[_0x81fb('0x19b')]+=0x1;_0x290c65[_0x81fb('0x76')]=0x0;_0x290c65[_0x81fb('0x77')]=_0x81fb('0x19c');_0x290c65[_0x81fb('0x121')]+=0x1;_0x290c65['countglobal']+=0x1;ami['emit'](_0x81fb('0x19d'),ut['buildObj'](_0x50b7ff,'nosuchnumber'));_0x37fb22=_0x1e137c[_0x81fb('0x196')];_0x58d75c=_0x1e137c[_0x81fb('0xdb')];hopperUtils[_0x81fb('0xce')](_0x290c65)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x19e')));if(_0x2ec239['checkRetriveMax'](0x0,_0x50b7ff,_0x1e137c)&&!_0x2287ee){if(_0x290c65['countnosuchnumberretry']>=_0x1e137c['dialNoSuchNumberMaxRetry']){_0x2ec239[_0x81fb('0x126')](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x19f'));}else{_0x2ec239[_0x81fb('0x1a0')](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x19f'));}}break;case'3':_0x1e137c[_0x81fb('0x1a1')]+=0x1;_0x290c65[_0x81fb('0x76')]=0x3;_0x290c65[_0x81fb('0x77')]=_0x81fb('0x1a2');_0x290c65[_0x81fb('0x120')]+=0x1;_0x290c65[_0x81fb('0xd9')]+=0x1;var _0xcd1309=ut['buildNoAnswerEventPayload'](_0x50b7ff,_0x1e137c);ami[_0x81fb('0x46')](_0x81fb('0x1a3'),_0xcd1309);_0x37fb22=_0x1e137c['dialNoAnswerRetryFrequency'];_0x58d75c=_0x1e137c['callAdditionalPhoneAfterMin'];hopperUtils[_0x81fb('0xce')](_0x290c65)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x1a4')));if(_0x2ec239[_0x81fb('0x1a5')](0x3,_0x50b7ff,_0x1e137c)&&!_0x2287ee){if(_0x290c65['countnoanswerretry']>=_0x1e137c[_0x81fb('0x18e')]){_0x2ec239[_0x81fb('0x126')](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x1a6'));}else{_0x2ec239[_0x81fb('0x1a0')](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x1a6'));}}break;case'5':_0x1e137c[_0x81fb('0x1a7')]+=0x1;_0x290c65['state']=0x5;_0x290c65[_0x81fb('0x77')]=_0x81fb('0x1a8');_0x290c65[_0x81fb('0x12b')]+=0x1;_0x290c65['countglobal']+=0x1;ami[_0x81fb('0x46')](_0x81fb('0x1a9'),ut['buildObj'](_0x50b7ff,_0x81fb('0x1aa')));_0x37fb22=_0x1e137c['dialBusyRetryFrequency'];_0x58d75c=_0x1e137c[_0x81fb('0xdb')];hopperUtils[_0x81fb('0xce')](_0x290c65)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x1ab')));if(_0x2ec239[_0x81fb('0x1a5')](0x5,_0x50b7ff,_0x1e137c)&&!_0x2287ee){if(_0x290c65[_0x81fb('0x12b')]>=_0x1e137c[_0x81fb('0x1ac')]){_0x2ec239[_0x81fb('0x126')](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x1ad'));}else{_0x2ec239[_0x81fb('0x1a0')](_0x290c65,_0xf7de36,_0x3f7029,'reason\x205\x20busy');}}break;case'8':_0x1e137c[_0x81fb('0x1ae')]+=0x1;_0x290c65['state']=0x8;_0x290c65[_0x81fb('0x77')]=_0x81fb('0x1af');_0x290c65[_0x81fb('0x11f')]+=0x1;_0x290c65['countglobal']+=0x1;_0x37fb22=_0x1e137c[_0x81fb('0x193')];_0x58d75c=_0x1e137c[_0x81fb('0xdb')];ami[_0x81fb('0x46')](_0x81fb('0x1b0'),ut['buildObj'](_0x50b7ff,_0x81fb('0x1b1')));hopperUtils[_0x81fb('0xce')](_0x290c65)[_0x81fb('0xa8')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2ec239['checkRetriveMax'](0x8,_0x50b7ff,_0x1e137c)&&!_0x2287ee){if(_0x290c65['countcongestionretry']>=_0x1e137c[_0x81fb('0x1b2')]){_0x2ec239[_0x81fb('0x126')](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x1b3'));}else{_0x2ec239[_0x81fb('0x1a0')](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x1b3'));}}break;case'11':_0x1e137c[_0x81fb('0x1b4')]+=0x1;_0x290c65[_0x81fb('0x76')]=0xb;_0x290c65[_0x81fb('0x77')]=_0x81fb('0xef');_0x290c65[_0x81fb('0xea')]+=0x1;_0x290c65[_0x81fb('0xd9')]+=0x1;_0x37fb22=_0x1e137c['dialAbandonedRetryFrequency'];_0x58d75c=_0x1e137c['callAdditionalPhoneAfterMin'];hopperUtils[_0x81fb('0xce')](_0x290c65)['catch'](loggerCatch(_0x81fb('0x1b5')));if(_0x2ec239['checkRetriveMax'](0xb,_0x50b7ff,_0x1e137c)&&!_0x2287ee){if(_0x290c65[_0x81fb('0xea')]>=_0x1e137c[_0x81fb('0x1b6')]){_0x2ec239['createStateFinal'](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x1b7'));}else{_0x2ec239[_0x81fb('0x1a0')](_0x290c65,_0xf7de36,_0x3f7029,'reason\x2011\x20abandoned');}}break;case'20':_0x1e137c[_0x81fb('0x1b8')]+=0x1;_0x290c65[_0x81fb('0x76')]=0x14;_0x290c65['statedesc']='AgentReject';_0x290c65['countagentrejectretry']+=0x1;_0x290c65[_0x81fb('0xd9')]+=0x1;_0x37fb22=_0x1e137c[_0x81fb('0x198')];_0x58d75c=_0x1e137c[_0x81fb('0xdb')];ami[_0x81fb('0x46')]('custom:agentreject',ut[_0x81fb('0x11e')](_0x50b7ff,_0x81fb('0x1b9')));hopperUtils[_0x81fb('0xce')](_0x290c65)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x1ba')));if(_0x2ec239[_0x81fb('0x1a5')](0x14,_0x50b7ff,_0x1e137c)&&!_0x2287ee){if(_0x290c65[_0x81fb('0x123')]>=_0x1e137c[_0x81fb('0x1bb')]){_0x2ec239[_0x81fb('0x126')](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x1bc'));}else{_0x2ec239['stateGlobal'](_0x290c65,_0xf7de36,_0x3f7029,_0x81fb('0x1bc'));}}break;default:_0x1e137c[_0x81fb('0x1bd')]+=0x1;_0x290c65['state']=0xc;_0x290c65[_0x81fb('0x77')]=_0x45fe1a[_0x81fb('0xca')];_0x37fb22=_0x1e137c[_0x81fb('0x198')];_0x58d75c=_0x1e137c[_0x81fb('0xdb')];hopperUtils[_0x81fb('0xce')](_0x290c65)[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x1be')));if(_0x2ec239[_0x81fb('0x1a5')](_0x45fe1a[_0x81fb('0xca')],_0x50b7ff,_0x1e137c)&&!_0x2287ee){if(_0x290c65['countbusyretry']+_0x290c65['countcongestionretry']+_0x290c65[_0x81fb('0x120')]+_0x290c65[_0x81fb('0x121')]+_0x290c65[_0x81fb('0xdd')]+_0x290c65[_0x81fb('0xea')]+_0x290c65[_0x81fb('0x122')]+_0x290c65['countagentrejectretry']>=_0x1e137c[_0x81fb('0x12c')]){_0x2ec239['stateGlobal'](_0x290c65,_0xf7de36,_0x3f7029,_0x45fe1a[_0x81fb('0xca')]);}else{_0x2ec239['createStateFinal'](_0x290c65,_0xf7de36,_0x3f7029,_0x45fe1a[_0x81fb('0xca')]);}}}})[_0x81fb('0x44')](function(){if(_0x2287ee){hopperUtils[_0x81fb('0xf0')](_0x290c65,_0x37fb22,_0x58d75c)[_0x81fb('0x44')](function(){return _0xf7de36(0x1);});}});});};Dialer['prototype'][_0x81fb('0x1a0')]=function(_0x2b7384,_0x162454,_0x4e0eb3,_0xf7fdf4){var _0x295805=new Final(_0x2b7384);_0x295805['state']=0xf;_0x295805[_0x81fb('0x77')]='Global';this['createStateFinal'](_0x295805,_0x162454,_0x4e0eb3,_0xf7fdf4);};Dialer[_0x81fb('0x1a')][_0x81fb('0x126')]=function(_0x7f1ef8,_0x189df8,_0x1b07fb,_0x2ee595){hopperUtils[_0x81fb('0xd0')](_0x7f1ef8)['then'](function(){return _0x189df8(msgResponse(_0x81fb('0x19a'),_0x81fb('0x10a'),_0x2ee595));})[_0x81fb('0xa8')](function(){return _0x1b07fb(msgResponse(_0x81fb('0x1bf'),_0x81fb('0x9b'),_0x81fb('0x1c0')));});};Dialer[_0x81fb('0x1a')][_0x81fb('0xb')]=function(_0x426abb){var _0x285dba=_0x426abb[_0x81fb('0x1c1')]/0x64;var _0x21be77=_0x426abb[_0x81fb('0xd4')]/(_0x426abb[_0x81fb('0xd4')]+_0x426abb[_0x81fb('0x112')]);var _0x3c33ff=Math['round'](_0x426abb[_0x81fb('0x1c2')]*(_0x426abb[_0x81fb('0x1c3')]/0x64));var _0x2c6316=Math[_0x81fb('0x1c4')](_0x426abb[_0x81fb('0x1c2')]*(_0x426abb[_0x81fb('0x1c5')]/0x64));var _0x36aa6d=_0x426abb[_0x81fb('0x137')]+_0x426abb[_0x81fb('0x139')];var _0x47767a=Math[_0x81fb('0x1c6')](_0x426abb[_0x81fb('0x1c7')]*_0x426abb[_0x81fb('0x63')]*_0x426abb[_0x81fb('0x1c8')]*_0x426abb[_0x81fb('0x1c9')]);if(_[_0x81fb('0x5a')](_0x426abb[_0x81fb('0x2a')])){if(!_[_0x81fb('0x5a')](_0x426abb[_0x81fb('0x29')])){_0x426abb['startPredictive']=undefined;loggerPredictive[_0x81fb('0x6c')](_0x81fb('0x1ca'),_0x81fb('0x1cb'));}if(!_[_0x81fb('0x5a')](_0x426abb[_0x81fb('0x6a')])){loggerPredictive['error'](_0x81fb('0x1ca'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x426abb[_0x81fb('0x6a')]);_0x426abb[_0x81fb('0x6a')]=undefined;}_0x426abb[_0x81fb('0x2a')]=moment()['format'](_0x81fb('0xc7'));loggerPredictive[_0x81fb('0x4e')](_0x426abb[_0x81fb('0x67')],_0x81fb('0x1cc'),_0x426abb[_0x81fb('0x2a')]);this[_0x81fb('0x1cd')](_0x426abb,0x1);}else if(ifInterval(_0x426abb[_0x81fb('0x1ce')],_0x426abb[_0x81fb('0x2a')])){this[_0x81fb('0x1cd')](_0x426abb,0x1);loggerPredictiveCalls[_0x81fb('0x4e')](_0x81fb('0x1cf'),_0x426abb[_0x81fb('0x2a')],_0x426abb[_0x81fb('0x67')]);_0x426abb[_0x81fb('0x1c7')]=0x0;_0x426abb[_0x81fb('0xd5')]=0x0;}else if(_0x285dba<_0x21be77&&_0x426abb['dialPredictiveOptimization']===_0x81fb('0x1d0')){clearPredictiveAttributes(_0x426abb);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x1d1'),_0x81fb('0x1d2'),_0x21be77,'startProgressive',_0x426abb[_0x81fb('0x67')]);}else if(_0x47767a<_0x426abb[_0x81fb('0xd5')]&&_0x426abb['dialPredictiveOptimization']===_0x81fb('0x1d0')){clearPredictiveAttributes(_0x426abb);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x1d3'),_0x81fb('0x1d4'),_0x47767a,'Drop\x20in\x20this\x20interval',_0x426abb['predictiveIntervalErlangCallsDroppedCalls'],_0x81fb('0x2a'),_0x426abb[_0x81fb('0x67')]);}else if(!ifInterval(_0x426abb[_0x81fb('0x1ce')],_0x426abb[_0x81fb('0x2a')])&&_['isUndefined'](_0x426abb['startPredictive'])&&!_[_0x81fb('0x5a')](_0x426abb['startProgressive'])){_0x426abb[_0x81fb('0x29')]=moment()[_0x81fb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x81fb('0x4e')](_0x426abb[_0x81fb('0x67')],'started\x20in\x20predictive\x20at',_0x426abb[_0x81fb('0x29')]);hopperUtils['avgHandleTime'](_0x426abb[_0x81fb('0x1ce')])['then'](this[_0x81fb('0x1d5')](_0x426abb))['then'](mergeDataErlangB(_0x426abb))['then'](this[_0x81fb('0x1d6')](_0x426abb))[_0x81fb('0xa8')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x426abb));}else if(!ifInterval(_0x426abb[_0x81fb('0x1ce')],_0x426abb[_0x81fb('0x29')])){_0x426abb['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x426abb[_0x81fb('0x29')]=moment()[_0x81fb('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x81fb('0x4e')](_0x426abb[_0x81fb('0x67')],_0x81fb('0x1d7'),_0x426abb[_0x81fb('0x29')]);clearInterval(_0x426abb[_0x81fb('0x6a')]);_0x426abb[_0x81fb('0x6a')]=undefined;hopperUtils[_0x81fb('0x1d8')](_0x426abb[_0x81fb('0x1ce')])[_0x81fb('0x44')](this[_0x81fb('0x1d5')](_0x426abb))[_0x81fb('0x44')](mergeDataErlangB(_0x426abb))[_0x81fb('0x44')](this[_0x81fb('0x1d6')](_0x426abb))['catch'](loggerCatchPredictive(_0x81fb('0x1d9'),_0x426abb));}else if(_0x426abb[_0x81fb('0x1c2')]&&_0x36aa6d<_0x426abb[_0x81fb('0x1c2')]-_0x2c6316){clearPredictiveAttributes(_0x426abb);loggerPredictive[_0x81fb('0x4e')](_0x426abb['name'],_0x81fb('0x1da'),_0x36aa6d,')\x20are\x20less\x20than\x20threshold\x20(',_0x426abb[_0x81fb('0x1c2')],'-',_0x2c6316,'=',_0x426abb[_0x81fb('0x1c2')]-_0x2c6316,')');}else if(_0x426abb[_0x81fb('0x1c2')]&&_0x36aa6d>_0x426abb['predictiveIntervalAvailable']+_0x3c33ff){clearPredictiveAttributes(_0x426abb);loggerPredictive[_0x81fb('0x4e')](_0x426abb['name'],_0x81fb('0x1da'),_0x36aa6d,')\x20are\x20more\x20than\x20threshold\x20(',_0x426abb[_0x81fb('0x1c2')],'+',_0x3c33ff,'=',_0x426abb[_0x81fb('0x1c2')]+_0x3c33ff,')');}};Dialer[_0x81fb('0x1a')][_0x81fb('0x1d5')]=function(_0x2e0786){var _0x5e1d10=this;return function(_0x87cd69){return new Promise(function(_0x2b7c9a,_0x256eaf){_['merge'](_0x2e0786,_0x87cd69[0x0]);if(checkGetDataPredictive(_0x87cd69[0x0])){var _0x52ba46=_0x2e0786[_0x81fb('0x1c2')]=_0x2e0786[_0x81fb('0x139')]+_0x2e0786[_0x81fb('0x137')];var _0x537e4f=_0x2e0786[_0x81fb('0x1ce')]*0x3c;var _0x36bdb1=_0x87cd69[0x0][_0x81fb('0x5b')]+_0x87cd69[0x0][_0x81fb('0x57')];var _0x3f575d=(_0x87cd69[0x0][_0x81fb('0x1db')]+_0x87cd69[0x0][_0x81fb('0x53')]+_0x87cd69[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x87cd69[0x0][_0x81fb('0x50')];_0x2e0786[_0x81fb('0x1c8')]=_0x3f575d>0x0?_0x3f575d:0x1;switch(_0x2e0786[_0x81fb('0x1dc')]){case _0x81fb('0x1d0'):var _0x5de02c=_0x2e0786[_0x81fb('0x1c1')]/0x64;return _0x5e1d10[_0x81fb('0x1dd')](_0x52ba46,_0x537e4f,_0x36bdb1,_0x3f575d,_0x5de02c)[_0x81fb('0x44')](function(_0x4f0919){return _0x2b7c9a(_0x4f0919);});case _0x81fb('0x1de'):var _0x298c7e=_0x2e0786[_0x81fb('0x1c1')]/0x64;return _0x5e1d10[_0x81fb('0x1df')](_0x52ba46,_0x537e4f,_0x36bdb1,_0x3f575d,_0x298c7e)['then'](function(_0x24569d){return _0x2b7c9a(_0x24569d);});default:return _0x256eaf(msgResponse(_0x81fb('0x1e0'),'Failure',_0x81fb('0x1e1')));}}else{return _0x256eaf(msgResponse(_0x81fb('0x1e0'),_0x81fb('0x9b'),_0x81fb('0x1e2')));}});};};Dialer[_0x81fb('0x1a')][_0x81fb('0x1e3')]=function(_0xc6945){var _0xbf0cbf=this;return function(_0x548d10){return new Promise(function(_0x772383,_0x43b635){_['merge'](_0xc6945,_0x548d10[0x0]);if(checkGetDataPredictive(_0x548d10[0x0])){loggerPredictive[_0x81fb('0x4e')](JSON[_0x81fb('0x8d')](_0x548d10[0x0]));if(_0xc6945['dialPredictiveOptimization']===_0x81fb('0x1d0')){return _0xbf0cbf['getVoiceQueueRtPauses'](_0xc6945['id'])[_0x81fb('0x44')](function(_0x5bee2c){var _0x14f535=_0xc6945['loggedIn']-_0x5bee2c[0x0][_0x81fb('0x1e4')];var _0x388a5d=_0xc6945[_0x81fb('0x1ce')]*0x3c;var _0x175e69=_0x548d10[0x0][_0x81fb('0x5b')]+_0x548d10[0x0][_0x81fb('0x57')];var _0x525667=(_0x548d10[0x0][_0x81fb('0x1db')]+_0x548d10[0x0][_0x81fb('0x53')]+_0x548d10[0x0][_0x81fb('0x55')])/_0x548d10[0x0][_0x81fb('0x50')];var _0xb7c4c2=_0xc6945['dialPredictiveOptimizationPercentage']/0x64;_0xc6945[_0x81fb('0x1e5')]=_0x5bee2c[0x0]['outboundQueuePauses']||0x0;_0xc6945[_0x81fb('0x1c8')]=_0x525667>0x0?_0x525667:0x1;return _0xbf0cbf[_0x81fb('0x1dd')](_0x14f535,_0x388a5d,_0x175e69,_0x525667,_0xb7c4c2);})[_0x81fb('0x44')](function(_0x3d6e33){return _0x772383(_0x3d6e33);})[_0x81fb('0xa8')](function(_0x4bfae1){return _0x43b635(msgResponse('[CatchErlangB]',_0x81fb('0x9b'),JSON['stringify'](_0x4bfae1)));});}if(_0xc6945[_0x81fb('0x1dc')]==='agentBusyFactor'){return _0xbf0cbf[_0x81fb('0x152')](_0xc6945['id'])[_0x81fb('0x44')](function(_0x1b6b9e){var _0x2059ed=_0xc6945['loggedIn']-_0x1b6b9e[0x0][_0x81fb('0x1e4')];var _0x2589a8=_0xc6945[_0x81fb('0x1ce')]*0x3c;var _0x51c3e2=_0x548d10[0x0][_0x81fb('0x5b')]+_0x548d10[0x0][_0x81fb('0x57')];var _0x55d6c8=(_0x548d10[0x0][_0x81fb('0x1db')]+_0x548d10[0x0][_0x81fb('0x53')]+_0x548d10[0x0][_0x81fb('0x55')])/_0x548d10[0x0][_0x81fb('0x50')];var _0x5ce181=_0xc6945[_0x81fb('0x1c1')]/0x64;_0xc6945['predictiveIntervalPauses']=_0x1b6b9e[0x0][_0x81fb('0x1e4')]||0x0;_0xc6945['predictiveIntervalHitRate']=_0x55d6c8>0x0?_0x55d6c8:0x1;return _0xbf0cbf[_0x81fb('0x1df')](_0x2059ed,_0x2589a8,_0x51c3e2,_0x55d6c8,_0x5ce181);})[_0x81fb('0x44')](function(_0x3fcd68){return _0x772383(_0x3fcd68);})[_0x81fb('0xa8')](function(_0x53bc27){return _0x43b635(msgResponse(_0x81fb('0x1e6'),_0x81fb('0x9b'),JSON[_0x81fb('0x8d')](_0x53bc27)));});}}else{return _0x43b635(msgResponse(_0x81fb('0x1e0'),_0x81fb('0x9b'),_0x81fb('0x1e2')));}});};};Dialer[_0x81fb('0x1a')]['startMethodPredictive']=function(_0x538c6a){var _0x30bce4=this;return function(){var _0x540866=0x0;var _0x59ab27=Math[_0x81fb('0x1c6')](_0x538c6a[_0x81fb('0x61')]*0x3e8);if(_0x59ab27>0x0){_0x59ab27=_0x59ab27<0x64?0x64:_0x59ab27;loggerPredictive[_0x81fb('0x4e')](_0x538c6a['name'],_0x81fb('0x1e7'),_0x59ab27,_0x81fb('0x1e8'));_0x538c6a[_0x81fb('0x6a')]=setInterval(function(){_0x30bce4[_0x81fb('0x6a')](_0x538c6a);loggerPredictiveCalls[_0x81fb('0x4e')](_0x81fb('0x1e9'),_0x540866+=0x1);},_0x59ab27);}else{loggerPredictive[_0x81fb('0x4e')](_0x538c6a['name'],_0x81fb('0x1ea'));}};};Dialer[_0x81fb('0x1a')][_0x81fb('0x1eb')]=function(_0x61259,_0x22292c){var _0x1eee30=this;return function(_0x392706){if(_[_0x81fb('0x4d')](_0x392706)){if(_[_0x81fb('0xf4')](_0x22292c['UserId'])||!_0x22292c['recallme']){if(_0x61259[_0x81fb('0xb8')]===_0x81fb('0xa')){_0x61259[_0x81fb('0x7a')]=_[_0x81fb('0x5a')](_0x61259[_0x81fb('0x7a')])?!![]:_0x61259[_0x81fb('0x7a')];var _0x451f48=uuid['v4']();_0x1eee30[_0x81fb('0x25')][_0x451f48]=new Action(_0x61259,_0x22292c,_0x451f48);loggerBooked[_0x81fb('0x4e')](_0x81fb('0x1ec'),_0x451f48,_0x81fb('0x1ed'),JSON[_0x81fb('0x8d')](_0x61259[_0x81fb('0x7a')]),_0x81fb('0x1ee'),_0x61259['name']);if(_0x61259[_0x81fb('0x7a')]){_0x61259[_0x81fb('0x7a')]=![];_0x1eee30['queueBooked'][_0x1eee30[_0x81fb('0x25')][_0x451f48][_0x81fb('0xc8')]]=[];ami[_0x81fb('0xa2')]({'actionid':_0x451f48,'action':_0x81fb('0x1ef'),'queue':_0x61259[_0x81fb('0x67')]})[_0x81fb('0xa8')](function(){_0x1eee30[_0x81fb('0xc6')](_0x61259);hopperUtils[_0x81fb('0xeb')]({'active':![],'ContactId':_0x1eee30[_0x81fb('0x25')][_0x451f48][_0x81fb('0xe1')],'ListId':_0x1eee30['actions'][_0x451f48][_0x81fb('0xe2')],'VoiceQueueId':_0x1eee30[_0x81fb('0x25')][_0x451f48][_0x81fb('0xe3')]||undefined,'CampaignId':_0x1eee30[_0x81fb('0x25')][_0x451f48][_0x81fb('0xe4')]||undefined})[_0x81fb('0xa8')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1eee30[_0x81fb('0x25')][_0x451f48];});}else{loggerBooked[_0x81fb('0x4e')](_0x81fb('0x1f0'),JSON[_0x81fb('0x8d')](_0x61259[_0x81fb('0x7a')]),_0x81fb('0x1ee'),_0x61259['name']);_0x1eee30[_0x81fb('0xc6')](_0x61259);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x1eee30[_0x81fb('0x25')][_0x451f48][_0x81fb('0xe1')],'ListId':_0x1eee30['actions'][_0x451f48][_0x81fb('0xe2')],'VoiceQueueId':_0x1eee30[_0x81fb('0x25')][_0x451f48][_0x81fb('0xe3')]||undefined,'CampaignId':_0x1eee30[_0x81fb('0x25')][_0x451f48]['CampaignId']||undefined})[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x1f1')));delete _0x1eee30['actions'][_0x451f48];}}else{return _0x1eee30[_0x81fb('0x15b')](_0x61259,_0x22292c);}}else{if(utils[_0x81fb('0x66')](undefined,_0x22292c[_0x81fb('0x1f2')])<_0x61259[_0x81fb('0x1f3')]*0x3c){if(_0x22292c[_0x81fb('0x147')]&&!_0x22292c['Agent'][_0x81fb('0x1f4')]){_0x1eee30[_0x81fb('0x1e')][_0x81fb('0x103')](_0x22292c['id'])[_0x81fb('0x1c')](function(){_0x1eee30[_0x81fb('0xc6')](_0x61259);});}else{hopperUtils[_0x81fb('0x1f5')]({'active':![]},_0x22292c['id'],0x1)['finally'](function(){_0x1eee30['updateOriginated'](_0x61259);});}}else{_0x61259[_0x81fb('0x1f6')]+=0x1;_0x1eee30[_0x81fb('0xc6')](_0x61259);if(_0x61259[_0x81fb('0x1f7')]){hopperUtils[_0x81fb('0xeb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x22292c['ContactId'],'ListId':_0x22292c[_0x81fb('0xe2')],'VoiceQueueId':_0x22292c[_0x81fb('0xe3')]||undefined,'CampaignId':_0x22292c['CampaignId']||undefined})[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x1f8')));hopperUtils['createHistory'](createObjHistory(_0x61259,_0x22292c,utils[_0x81fb('0x70')][_0x81fb('0x1f9')],0x17,_0x81fb('0x1fa')))[_0x81fb('0xa8')](loggerCatch(_0x81fb('0x1fb')));}else{_0x1eee30['saveInDb'](createObjHistory(_0x61259,_0x22292c,utils['CAMPAIGN_STATUS'][_0x81fb('0x1fc')],0x16,'RecallFailedTimeout'),_0x81fb('0x1fd'),_0x81fb('0x1fe'));}}}}else{_0x61259[_0x81fb('0x1ff')]+=0x1;_0x1eee30[_0x81fb('0x116')](createObjHistory(_0x61259,_0x22292c,utils['CAMPAIGN_STATUS'][_0x81fb('0x200')],0xd,_0x81fb('0x201')),_0x81fb('0x202'),_0x81fb('0x203'));throw _0x81fb('0x204');}};};Dialer[_0x81fb('0x1a')][_0x81fb('0x15a')]=function(_0x1fbc2b){var _0x596806=this;var _0x375bf=_0x1fbc2b[_0x81fb('0x205')]-_0x1fbc2b[_0x81fb('0x85')];emitCampaignSummary(_0x1fbc2b);if(_0x375bf>0x0&&_0x1fbc2b[_0x81fb('0x6e')]==0x0){if(_0x375bf>this['maxNumberOriginate']){_0x375bf=this[_0x81fb('0x23')];}_0x1fbc2b[_0x81fb('0x6e')]=0x1;hopperUtils['getContactDialerIvr'](_0x1fbc2b,_0x375bf)['then'](function(_0x6639bc){_0x1fbc2b['temp']=0x0;if(_0x6639bc){if(!utils['checkContactEmpty'](_0x6639bc)){_0x1fbc2b['message']=utils[_0x81fb('0x70')][_0x81fb('0x74')];logger['info'](_0x81fb('0x206')+_0x1fbc2b[_0x81fb('0x67')]);}else{_0x1fbc2b[_0x81fb('0x85')]+=_0x6639bc[_0x81fb('0xff')];_0x1fbc2b[_0x81fb('0x73')]=utils[_0x81fb('0x70')][_0x81fb('0x207')];for(var _0x22f2eb=0x0;_0x22f2eb<_0x6639bc[_0x81fb('0xff')];_0x22f2eb+=0x1){_0x1fbc2b[_0x81fb('0x208')]+=0x1;if(_[_0x81fb('0xf4')](_0x6639bc[_0x22f2eb])||_['isNil'](_0x6639bc[_0x22f2eb][_0x81fb('0x209')])||_[_0x81fb('0xf4')](_0x6639bc[_0x22f2eb][_0x81fb('0x15f')])){_0x596806['emptyContact'](_0x81fb('0x20a'),_0x1fbc2b,_0x6639bc[_0x22f2eb]);}else{hopperUtils[_0x81fb('0x20b')](_[_0x81fb('0xf8')](_0x6639bc[_0x22f2eb],[_0x81fb('0xe4'),_0x81fb('0x15f')]))[_0x81fb('0x44')](_0x596806[_0x81fb('0x1eb')](_0x1fbc2b,_0x6639bc[_0x22f2eb]))[_0x81fb('0xa8')](_0x596806[_0x81fb('0x154')](_0x81fb('0x20c'),_0x1fbc2b));}}}}})[_0x81fb('0xa8')](loggerGetContactDialer('[getContactCampaign2]',_0x1fbc2b,_0x375bf));}};Dialer[_0x81fb('0x1a')][_0x81fb('0x1cd')]=function(_0x5698ac,_0x1c79dc){var _0x2fad22=this;var _0x22ab64=[];if(_0x1c79dc<0x1||_0x5698ac[_0x81fb('0xb8')]===_0x81fb('0xa')){_0x1c79dc=0x1;}var _0x5b7ada=Math[_0x81fb('0x1c6')](_0x5698ac['available']*_0x1c79dc)-_0x5698ac[_0x81fb('0x85')];if(_0x5698ac['dialLimitQueue']>0x0){var _0x5c45d9=_0x5698ac[_0x81fb('0x20d')]-_0x5698ac[_0x81fb('0x85')]-_0x5698ac[_0x81fb('0x139')]-_0x5698ac[_0x81fb('0x20e')];if(_0x5b7ada>_0x5c45d9){_0x5b7ada=_0x5c45d9;}}if(_0x5b7ada>0x0&&_0x5698ac[_0x81fb('0x6e')]==0x0){if(_0x5698ac[_0x81fb('0xb8')]===_0x81fb('0xa')){_0x5b7ada=0x1;}if(_0x5b7ada>this['maxNumberOriginate']){_0x5b7ada=this[_0x81fb('0x23')];}for(var _0x159606 in this[_0x81fb('0x21')]){if(typeof this[_0x81fb('0x21')][_0x159606]!==_0x81fb('0xb1')){if(this[_0x81fb('0x21')][_0x159606][_0x81fb('0x76')]===_0x81fb('0x20f')&&this['agents'][_0x159606][_0x81fb('0x91')]===_0x81fb('0x92')){_0x22ab64['push'](this['agents'][_0x159606]['id']);}}}_0x5698ac['temp']=0x1;hopperUtils[_0x81fb('0x210')](_0x5698ac,_0x22ab64,_0x5b7ada)[_0x81fb('0x44')](function(_0x51e1dc){_0x5698ac[_0x81fb('0x6e')]=0x0;if(_0x51e1dc){if(!utils[_0x81fb('0x211')](_0x51e1dc)){hopperUtils[_0x81fb('0x212')](_0x5698ac)['then'](sendMessageReschedule(_0x5698ac))[_0x81fb('0xa8')](loggerCatch('[countReScheduled]\x20'));}else{_0x5698ac['originated']+=_0x51e1dc[_0x81fb('0xff')];_0x5698ac[_0x81fb('0x73')]=_0x5698ac[_0x81fb('0xb8')]==='booked'?utils[_0x81fb('0x70')][_0x81fb('0x13a')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x39783c=0x0;_0x39783c<_0x51e1dc[_0x81fb('0xff')];_0x39783c+=0x1){if(_[_0x81fb('0xf4')](_0x51e1dc[_0x39783c])||_[_0x81fb('0xf4')](_0x51e1dc[_0x39783c][_0x81fb('0x209')])||_[_0x81fb('0xf4')](_0x51e1dc[_0x39783c]['phone'])){_0x2fad22[_0x81fb('0x155')]('[actionOriginate]\x20',_0x5698ac,_0x51e1dc[_0x39783c]);}else{hopperUtils[_0x81fb('0x213')](_[_0x81fb('0xf8')](_0x51e1dc[_0x39783c],['VoiceQueueId',_0x81fb('0x15f')]))[_0x81fb('0x44')](_0x2fad22[_0x81fb('0x1eb')](_0x5698ac,_0x51e1dc[_0x39783c]))[_0x81fb('0xa8')](_0x2fad22[_0x81fb('0x154')](_0x81fb('0x20a'),_0x5698ac));}}}}})[_0x81fb('0xa8')](loggerGetContactDialer(_0x81fb('0x214'),_0x5698ac,_0x5b7ada));}};Dialer[_0x81fb('0x1a')]['handlePredictive']=function(_0x322f4b){if(_0x322f4b[_0x81fb('0x20d')]>0x0){var _0x17f578=_0x322f4b[_0x81fb('0x20d')]-_0x322f4b[_0x81fb('0x85')]-_0x322f4b[_0x81fb('0x139')];if(_0x17f578>0x0&&_0x322f4b[_0x81fb('0x6e')]==0x0){this[_0x81fb('0x215')](_0x322f4b);}else{loggerPredictiveCalls[_0x81fb('0x4e')](_0x81fb('0x216'));}}else{this['tryOriginatePredictive'](_0x322f4b);}};Dialer[_0x81fb('0x1a')][_0x81fb('0x215')]=function(_0x134dfa){var _0x1bbfa0=this;var _0x1b372f=[];_0x134dfa[_0x81fb('0x85')]+=0x1;for(var _0x624756 in this[_0x81fb('0x21')]){if(typeof this['agents'][_0x624756]!==_0x81fb('0xb1')){if(this[_0x81fb('0x21')][_0x624756][_0x81fb('0x76')]===_0x81fb('0x20f')&&this[_0x81fb('0x21')][_0x624756][_0x81fb('0x91')]===_0x81fb('0x92')){_0x1b372f[_0x81fb('0xa9')](this[_0x81fb('0x21')][_0x624756]['id']);}}}_0x134dfa[_0x81fb('0x6e')]=0x1;return this[_0x81fb('0x210')](_0x134dfa['id'],_0x1b372f,0x1,_0x134dfa[_0x81fb('0x217')],_0x134dfa)['then'](function(_0xd25adc){_0x134dfa['temp']=0x1;if(_0xd25adc){if(!utils[_0x81fb('0x211')](_0xd25adc)){utils[_0x81fb('0x6d')](_0x134dfa,0x1,0x0);return hopperUtils[_0x81fb('0x212')](_0x134dfa)['then'](sendMessageReschedule(_0x134dfa))[_0x81fb('0xa8')](loggerCatch('[countReScheduled]\x20'));}else{_0x134dfa[_0x81fb('0x73')]=utils[_0x81fb('0x70')]['RUNNING'];if(_[_0x81fb('0xf4')](_0xd25adc[0x0])||_[_0x81fb('0xf4')](_0xd25adc[0x0][_0x81fb('0x209')])||_[_0x81fb('0xf4')](_0xd25adc[0x0][_0x81fb('0x15f')])){_0x1bbfa0[_0x81fb('0x155')](_0x81fb('0x20a'),_0x134dfa,_0xd25adc[0x0]);}else{return hopperUtils[_0x81fb('0x213')](_[_0x81fb('0xf8')](_0xd25adc[0x0],[_0x81fb('0xe3'),_0x81fb('0x15f')]))[_0x81fb('0x44')](_0x1bbfa0[_0x81fb('0x1eb')](_0x134dfa,_0xd25adc[0x0]))[_0x81fb('0xa8')](_0x1bbfa0['loggerHandler'](_0x81fb('0x218'),_0x134dfa));}}}})[_0x81fb('0xa8')](loggerGetContactDialer(_0x81fb('0x219'),_0x134dfa,0x1));};Dialer['prototype'][_0x81fb('0x1dd')]=function(_0x278429,_0x26498d,_0x109289,_0x179cce,_0x3fb96c,_0x455452){loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x21a'));loggerPredictive[_0x81fb('0x4e')]('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',_0x278429);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x21b'),_0x26498d);loggerPredictive['info'](_0x81fb('0x21c'),_0x109289);loggerPredictive[_0x81fb('0x4e')]('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',_0x179cce);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x21d'),_0x3fb96c);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x59'));return new Promise(function(_0x16342f,_0x5325df){if(_0x278429<=0x0||isNaN(_0x278429)){return _0x5325df(msgResponse(_0x81fb('0x21e'),_0x81fb('0x8c'),_0x81fb('0x21f')+_0x278429));}if(_0x109289<=0x0||isNaN(_0x109289)){return _0x5325df(msgResponse(_0x81fb('0x21e'),'Error','Ts\x20=\x20'+_0x109289));}if(_0x179cce<=0x0||isNaN(_0x179cce)){return _0x5325df(msgResponse(_0x81fb('0x21e'),_0x81fb('0x8c'),_0x81fb('0x220')+_0x179cce));}if(_0x26498d<=0x0||isNaN(_0x26498d)){return _0x5325df(msgResponse('[abandonmentRate]',_0x81fb('0x8c'),'interval\x20=\x20'+_0x26498d));}if(_0x3fb96c<=0x0||isNaN(_0x3fb96c)){return _0x5325df(msgResponse('[abandonmentRate]','Error',_0x81fb('0x221')+_0x3fb96c));}_0x455452=_0x455452||0x0;var _0x5a76c3=0x1/_0x109289;var _0x241772=0x0;var _0x170060=0x0;var _0x1764dc=0x0;var _0x2913ce=0x0;for(var _0x2ced9e=0x0;_0x1764dc<_0x3fb96c;_0x2ced9e+=0x1){_0x170060=_0x2ced9e/_0x26498d;_0x241772=(_0x179cce*_0x170060+_0x455452)/_0x5a76c3;_0x1764dc=utils[_0x81fb('0x222')](_0x241772,_0x278429);_0x2913ce=_0x241772/_0x278429*(0x1-utils[_0x81fb('0x222')](_0x241772,_0x278429));}return _0x16342f({'erlangCalls':_0x2ced9e,'erlangCallToSecond':_0x26498d/_0x2ced9e,'erlangAbandonmentRate':_0x1764dc,'erlangBusyFactor':_0x2913ce});});};Dialer['prototype'][_0x81fb('0x1df')]=function(_0x4d3343,_0x565528,_0xbd3d3,_0x219770,_0x330036,_0x5a003c){loggerPredictive['info'](_0x81fb('0x223'));loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x224'),_0x4d3343);loggerPredictive['info'](_0x81fb('0x21b'),_0x565528);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x21c'),_0xbd3d3);loggerPredictive[_0x81fb('0x4e')](_0x81fb('0x225'),_0x219770);loggerPredictive['info'](_0x81fb('0x226'),_0x330036);loggerPredictive[_0x81fb('0x4e')]('---------------------------');return new Promise(function(_0x4a0406,_0x3317fd){if(_0x4d3343<=0x0||isNaN(_0x4d3343)){return _0x3317fd(msgResponse(_0x81fb('0x227'),_0x81fb('0x8c'),_0x81fb('0x21f')+_0x4d3343));}if(_0xbd3d3<=0x0||isNaN(_0xbd3d3)){return _0x3317fd(msgResponse('[busyFactor]',_0x81fb('0x8c'),_0x81fb('0x228')+_0xbd3d3));}if(_0x219770<=0x0||isNaN(_0x219770)){return _0x3317fd(msgResponse(_0x81fb('0x227'),'Error',_0x81fb('0x220')+_0x219770));}if(_0x565528<=0x0||isNaN(_0x565528)){return _0x3317fd(msgResponse(_0x81fb('0x227'),_0x81fb('0x8c'),_0x81fb('0x229')+_0x565528));}if(_0x330036<=0x0||isNaN(_0x330036)){return _0x3317fd(msgResponse(_0x81fb('0x227'),'Error',_0x81fb('0x22a')+_0x330036));}_0x5a003c=_0x5a003c||0x0;var _0x136dd7=0x1/_0xbd3d3;var _0x2e0353=0x0;var _0x5dd7f6=0x0;var _0x3f223e=0x0;var _0x421914=0x0;for(var _0x38b417=0x0;_0x421914<_0x330036;_0x38b417+=0x1){_0x5dd7f6=_0x38b417/_0x565528;_0x2e0353=(_0x219770*_0x5dd7f6+_0x5a003c)/_0x136dd7;_0x3f223e=utils[_0x81fb('0x222')](_0x2e0353,_0x4d3343);_0x421914=_0x2e0353/_0x4d3343*(0x1-utils['erlangb'](_0x2e0353,_0x4d3343));}return _0x4a0406({'erlangCalls':_0x38b417,'erlangCallToSecond':_0x565528/_0x38b417,'erlangAbandonmentRate':_0x3f223e,'erlangBusyFactor':_0x421914});});};module[_0x81fb('0x22b')]=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 3c2c493..99d23fe 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 _0x1dc4=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','prototype','getQueue','queue','exports','util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x21f3c3,_0x42e32c){var _0x15957=function(_0x271f01){while(--_0x271f01){_0x21f3c3['push'](_0x21f3c3['shift']());}};_0x15957(++_0x42e32c);}(_0x1dc4,0x97));var _0x41dc=function(_0x5cdb66,_0x52d970){_0x5cdb66=_0x5cdb66-0x0;var _0x37d2ed=_0x1dc4[_0x5cdb66];return _0x37d2ed;};'use strict';var util=require(_0x41dc('0x0'));var _=require(_0x41dc('0x1'));var moment=require(_0x41dc('0x2'));function checkNameSurname(_0x3c8b33,_0xde41e4,_0x273508){var _0x4b1125='';if(!_['isNil'](_0xde41e4)&&_0x41dc('0x3')===typeof _0xde41e4){_0x4b1125+=_0xde41e4;}if(!_[_0x41dc('0x4')](_0x273508)&&_0x41dc('0x3')===typeof _0x273508){_0x4b1125+='\x20'+_0x273508;}if(_0x4b1125!==''){return _0x4b1125;}return _0x3c8b33;}function Action(_0x5b1e5a,_0x47f4d3,_0x128d84){this[_0x41dc('0x5')]=_0x5b1e5a;this[_0x41dc('0x6')]=_0x128d84||undefined;this[_0x41dc('0x7')]=checkNameSurname(_0x47f4d3[_0x41dc('0x8')][_0x41dc('0x9')],_0x47f4d3[_0x41dc('0x8')][_0x41dc('0xa')],_0x47f4d3[_0x41dc('0x8')]['lastName']);this['number']=_0x47f4d3[_0x41dc('0x9')];this['queue']=_0x5b1e5a[_0x41dc('0x7')];this[_0x41dc('0xb')]=_0x47f4d3[_0x41dc('0xb')]||![];this[_0x41dc('0xc')]=_0x5b1e5a[_0x41dc('0xc')];this['dialQueueTimeout']=_0x5b1e5a[_0x41dc('0xd')]||0x3;this[_0x41dc('0xe')]=_0x47f4d3[_0x41dc('0xe')];this[_0x41dc('0xf')]=_0x47f4d3[_0x41dc('0xf')];this['countcongestionretry']=_0x47f4d3[_0x41dc('0x10')];this['countnoanswerretry']=_0x47f4d3['countnoanswerretry'];this[_0x41dc('0x11')]=_0x47f4d3[_0x41dc('0x11')];this['countdropretry']=_0x47f4d3[_0x41dc('0x12')];this['countabandonedretry']=_0x47f4d3[_0x41dc('0x13')];this['countmachineretry']=_0x47f4d3[_0x41dc('0x14')];this[_0x41dc('0x15')]=_0x47f4d3[_0x41dc('0x15')];this[_0x41dc('0x16')]=_0x47f4d3['ContactId'];this[_0x41dc('0x17')]=_0x47f4d3[_0x41dc('0x17')];this[_0x41dc('0x18')]=_0x47f4d3['UserId'];this[_0x41dc('0x19')]=_0x47f4d3[_0x41dc('0x19')];this['CampaignId']=_0x47f4d3['CampaignId'];this[_0x41dc('0x1a')]=_0x47f4d3['id'];this['ContactFirstName']=_0x47f4d3[_0x41dc('0x8')][_0x41dc('0xa')]||'';this[_0x41dc('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x41dc('0x1c')]=_0x47f4d3['callback'];this[_0x41dc('0x1d')]=_0x47f4d3['callbackuniqueid'];this['callbackat']=_0x47f4d3[_0x41dc('0x1e')];this[_0x41dc('0x1f')]=_0x47f4d3[_0x41dc('0x1f')];this[_0x41dc('0x20')]='';this[_0x41dc('0x21')]='';}Action['prototype'][_0x41dc('0x22')]=function(){return util['format'](_0x41dc('0x23'),this['name'],this['voiceQueue'][_0x41dc('0x24')]>0x0?this[_0x41dc('0x25')][_0x41dc('0x26')](this[_0x41dc('0x5')][_0x41dc('0x24')]):this['number']);};Action[_0x41dc('0x27')][_0x41dc('0x28')]=function(){return this[_0x41dc('0x29')];};module[_0x41dc('0x2a')]=Action; \ No newline at end of file +var _0x2802=['countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','dialCutDigit','substring','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x2802,0xe2));var _0x2280=function(_0x5c468f,_0x2e5c25){_0x5c468f=_0x5c468f-0x0;var _0x2136b0=_0x2802[_0x5c468f];return _0x2136b0;};'use strict';var util=require(_0x2280('0x0'));var _=require('lodash');var moment=require(_0x2280('0x1'));function checkNameSurname(_0x45d152,_0x2f39cf,_0x3ed057){var _0x17b284='';if(!_[_0x2280('0x2')](_0x2f39cf)&&'string'===typeof _0x2f39cf){_0x17b284+=_0x2f39cf;}if(!_[_0x2280('0x2')](_0x3ed057)&&_0x2280('0x3')===typeof _0x3ed057){_0x17b284+='\x20'+_0x3ed057;}if(_0x17b284!==''){return _0x17b284;}return _0x45d152;}function Action(_0x773fb,_0x88ca5b,_0x55fd3b){this[_0x2280('0x4')]=_0x773fb;this[_0x2280('0x5')]=_0x55fd3b||undefined;this[_0x2280('0x6')]=checkNameSurname(_0x88ca5b[_0x2280('0x7')][_0x2280('0x8')],_0x88ca5b[_0x2280('0x7')][_0x2280('0x9')],_0x88ca5b[_0x2280('0x7')]['lastName']);this[_0x2280('0xa')]=_0x88ca5b[_0x2280('0x8')];this[_0x2280('0xb')]=_0x773fb[_0x2280('0x6')];this[_0x2280('0xc')]=_0x88ca5b['active']||![];this['type']=_0x773fb['type'];this[_0x2280('0xd')]=_0x773fb[_0x2280('0xd')]||0x3;this[_0x2280('0xe')]=_0x88ca5b[_0x2280('0xe')];this[_0x2280('0xf')]=_0x88ca5b[_0x2280('0xf')];this[_0x2280('0x10')]=_0x88ca5b[_0x2280('0x10')];this['countnoanswerretry']=_0x88ca5b[_0x2280('0x11')];this[_0x2280('0x12')]=_0x88ca5b[_0x2280('0x12')];this[_0x2280('0x13')]=_0x88ca5b['countdropretry'];this[_0x2280('0x14')]=_0x88ca5b[_0x2280('0x14')];this[_0x2280('0x15')]=_0x88ca5b[_0x2280('0x15')];this[_0x2280('0x16')]=_0x88ca5b[_0x2280('0x16')];this['ContactId']=_0x88ca5b[_0x2280('0x17')];this['ListId']=_0x88ca5b[_0x2280('0x18')];this[_0x2280('0x19')]=_0x88ca5b[_0x2280('0x19')];this[_0x2280('0x1a')]=_0x88ca5b[_0x2280('0x1a')];this[_0x2280('0x1b')]=_0x88ca5b[_0x2280('0x1b')];this[_0x2280('0x1c')]=_0x88ca5b['id'];this[_0x2280('0x1d')]=_0x88ca5b[_0x2280('0x7')][_0x2280('0x9')]||'';this['starttime']=moment()[_0x2280('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2280('0x1f')]=_0x88ca5b[_0x2280('0x1f')];this['callbackuniqueid']=_0x88ca5b[_0x2280('0x20')];this[_0x2280('0x21')]=_0x88ca5b[_0x2280('0x21')];this[_0x2280('0x22')]=_0x88ca5b[_0x2280('0x22')];this[_0x2280('0x23')]='';this['originatecalleridname']='';}Action[_0x2280('0x24')]['getCaller']=function(){return util[_0x2280('0x1e')]('\x22%s\x22\x20<%s>',this[_0x2280('0x6')],this[_0x2280('0x4')][_0x2280('0x25')]>0x0?this['number'][_0x2280('0x26')](this[_0x2280('0x4')]['dialCutDigit']):this[_0x2280('0xa')]);};Action[_0x2280('0x24')][_0x2280('0x27')]=function(){return this[_0x2280('0xb')];};module[_0x2280('0x28')]=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 3e1c468..649f705 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 _0xe736=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum'];(function(_0x442bdf,_0x2846b8){var _0x20001d=function(_0x1b9644){while(--_0x1b9644){_0x442bdf['push'](_0x442bdf['shift']());}};_0x20001d(++_0x2846b8);}(_0xe736,0x1d1));var _0x6e73=function(_0x9f8cde,_0x31885a){_0x9f8cde=_0x9f8cde-0x0;var _0x3ae74c=_0xe736[_0x9f8cde];return _0x3ae74c;};'use strict';var moment=require('moment');var utils=require(_0x6e73('0x0'));function AgentComplete(_0x7fe512,_0x2de4ee){this[_0x6e73('0x1')]=0x4;this['statedesc']=_0x6e73('0x2');this['scheduledat']=_0x7fe512[_0x6e73('0x3')];this[_0x6e73('0x4')]=_0x7fe512[_0x6e73('0x4')];this['campaigntype']=_0x7fe512[_0x6e73('0x4')]===_0x6e73('0x5')?_0x6e73('0x6'):_0x7fe512['type'];this[_0x6e73('0x7')]=_0x7fe512['countbusyretry'];this[_0x6e73('0x8')]=_0x7fe512[_0x6e73('0x8')];this[_0x6e73('0x9')]=_0x7fe512[_0x6e73('0x9')];this[_0x6e73('0xa')]=_0x7fe512[_0x6e73('0x7')]+_0x7fe512[_0x6e73('0x8')]+_0x7fe512['countnoanswerretry']+_0x7fe512[_0x6e73('0xb')]+_0x7fe512['countdropretry']+_0x7fe512[_0x6e73('0xc')]+_0x7fe512[_0x6e73('0xd')]+_0x7fe512[_0x6e73('0xe')];this[_0x6e73('0xb')]=_0x7fe512[_0x6e73('0xb')];this['countdropretry']=_0x7fe512[_0x6e73('0xf')];this[_0x6e73('0xc')]=_0x7fe512['countabandonedretry'];this[_0x6e73('0xd')]=_0x7fe512['countmachineretry'];this[_0x6e73('0xe')]=_0x7fe512[_0x6e73('0xe')];this[_0x6e73('0x10')]=_0x2de4ee['uniqueid'];this['calleridname']=_0x7fe512[_0x6e73('0x11')];this[_0x6e73('0x12')]=_0x7fe512['number'];this[_0x6e73('0x13')]=_0x7fe512['starttime'];this[_0x6e73('0x14')]=_0x7fe512[_0x6e73('0x14')];this[_0x6e73('0x15')]=_0x7fe512[_0x6e73('0x15')];this[_0x6e73('0x16')]=moment()[_0x6e73('0x17')](_0x6e73('0x18'));this[_0x6e73('0x19')]=utils['getSeconds'](_0x7fe512[_0x6e73('0x14')],_0x7fe512[_0x6e73('0x13')]);this[_0x6e73('0x1a')]=utils[_0x6e73('0x1b')](_0x7fe512[_0x6e73('0x15')],_0x7fe512[_0x6e73('0x14')]);this[_0x6e73('0x1c')]=utils[_0x6e73('0x1b')](this[_0x6e73('0x16')],_0x7fe512['answertime']);this[_0x6e73('0x6')]=_0x2de4ee[_0x6e73('0x6')];this[_0x6e73('0x1d')]=_0x2de4ee[_0x6e73('0x1d')];this[_0x6e73('0x1e')]=_0x2de4ee[_0x6e73('0x1e')];this[_0x6e73('0x1f')]=_0x7fe512['callback'];this['callbackuniqueid']=_0x7fe512[_0x6e73('0x20')];this[_0x6e73('0x21')]=_0x7fe512[_0x6e73('0x21')];this[_0x6e73('0x22')]=_0x7fe512['recallme'];this['ContactId']=_0x7fe512[_0x6e73('0x23')];this[_0x6e73('0x24')]=_0x7fe512[_0x6e73('0x24')];this[_0x6e73('0x25')]=_0x7fe512[_0x6e73('0x25')];this[_0x6e73('0x26')]=_0x7fe512[_0x6e73('0x26')];this[_0x6e73('0x27')]=_0x7fe512[_0x6e73('0x27')];this[_0x6e73('0x28')]=_0x7fe512[_0x6e73('0x28')]||'';this[_0x6e73('0x29')]=_0x7fe512[_0x6e73('0x29')]||'';this[_0x6e73('0x2a')]=_0x7fe512[_0x6e73('0x2a')];}module[_0x6e73('0x2b')]=AgentComplete; \ No newline at end of file +var _0xbb7e=['originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x3bee6c,_0x4cb1ac){var _0x533667=function(_0x3b395e){while(--_0x3b395e){_0x3bee6c['push'](_0x3bee6c['shift']());}};_0x533667(++_0x4cb1ac);}(_0xbb7e,0xe0));var _0xebb7=function(_0x4e2566,_0x4c2467){_0x4e2566=_0x4e2566-0x0;var _0x595276=_0xbb7e[_0x4e2566];return _0x595276;};'use strict';var moment=require(_0xebb7('0x0'));var utils=require(_0xebb7('0x1'));function AgentComplete(_0x970233,_0x5a0acc){this[_0xebb7('0x2')]=0x4;this['statedesc']=_0xebb7('0x3');this[_0xebb7('0x4')]=_0x970233['scheduledat'];this[_0xebb7('0x5')]=_0x970233[_0xebb7('0x5')];this[_0xebb7('0x6')]=_0x970233[_0xebb7('0x5')]==='outbound'?'queue':_0x970233[_0xebb7('0x5')];this[_0xebb7('0x7')]=_0x970233[_0xebb7('0x7')];this[_0xebb7('0x8')]=_0x970233['countcongestionretry'];this[_0xebb7('0x9')]=_0x970233[_0xebb7('0x9')];this['countglobal']=_0x970233['countbusyretry']+_0x970233['countcongestionretry']+_0x970233[_0xebb7('0x9')]+_0x970233[_0xebb7('0xa')]+_0x970233['countdropretry']+_0x970233[_0xebb7('0xb')]+_0x970233[_0xebb7('0xc')]+_0x970233[_0xebb7('0xd')];this[_0xebb7('0xa')]=_0x970233[_0xebb7('0xa')];this[_0xebb7('0xe')]=_0x970233['countdropretry'];this['countabandonedretry']=_0x970233[_0xebb7('0xb')];this[_0xebb7('0xc')]=_0x970233[_0xebb7('0xc')];this['countagentrejectretry']=_0x970233[_0xebb7('0xd')];this[_0xebb7('0xf')]=_0x5a0acc[_0xebb7('0xf')];this['calleridname']=_0x970233['name'];this[_0xebb7('0x10')]=_0x970233[_0xebb7('0x11')];this['starttime']=_0x970233[_0xebb7('0x12')];this[_0xebb7('0x13')]=_0x970233[_0xebb7('0x13')];this[_0xebb7('0x14')]=_0x970233[_0xebb7('0x14')];this[_0xebb7('0x15')]=moment()[_0xebb7('0x16')](_0xebb7('0x17'));this[_0xebb7('0x18')]=utils[_0xebb7('0x19')](_0x970233[_0xebb7('0x13')],_0x970233[_0xebb7('0x12')]);this[_0xebb7('0x1a')]=utils[_0xebb7('0x19')](_0x970233[_0xebb7('0x14')],_0x970233['responsetime']);this[_0xebb7('0x1b')]=utils[_0xebb7('0x19')](this[_0xebb7('0x15')],_0x970233[_0xebb7('0x14')]);this['queue']=_0x5a0acc[_0xebb7('0x1c')];this[_0xebb7('0x1d')]=_0x5a0acc[_0xebb7('0x1d')];this[_0xebb7('0x1e')]=_0x5a0acc[_0xebb7('0x1e')];this[_0xebb7('0x1f')]=_0x970233[_0xebb7('0x1f')];this[_0xebb7('0x20')]=_0x970233[_0xebb7('0x20')];this[_0xebb7('0x21')]=_0x970233['callbackat'];this[_0xebb7('0x22')]=_0x970233[_0xebb7('0x22')];this[_0xebb7('0x23')]=_0x970233['ContactId'];this[_0xebb7('0x24')]=_0x970233['ListId'];this[_0xebb7('0x25')]=_0x970233[_0xebb7('0x25')];this[_0xebb7('0x26')]=_0x970233['VoiceQueueId'];this[_0xebb7('0x27')]=_0x970233[_0xebb7('0x27')];this[_0xebb7('0x28')]=_0x970233[_0xebb7('0x28')]||'';this[_0xebb7('0x29')]=_0x970233['originatecalleridname']||'';this[_0xebb7('0x2a')]=_0x970233[_0xebb7('0x2a')];}module[_0xebb7('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 63c8b40..80b6c31 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 _0x70be=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','type','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0x70be,0x179));var _0xe70b=function(_0xeb5e2f,_0x2c2352){_0xeb5e2f=_0xeb5e2f-0x0;var _0x3f014c=_0x70be[_0xeb5e2f];return _0x3f014c;};'use strict';function Final(_0x516faf){this[_0xe70b('0x0')]=_0x516faf['uniqueid'];this['scheduledat']=_0x516faf['scheduledat'];this[_0xe70b('0x1')]=_0x516faf['type'];this['campaigntype']=_0x516faf[_0xe70b('0x1')]===_0xe70b('0x2')?'queue':_0x516faf[_0xe70b('0x1')];this[_0xe70b('0x3')]=_0x516faf[_0xe70b('0x3')];this['countcongestionretry']=_0x516faf['countcongestionretry'];this[_0xe70b('0x4')]=_0x516faf[_0xe70b('0x4')];this[_0xe70b('0x5')]=_0x516faf['countbusyretry']+_0x516faf[_0xe70b('0x6')]+_0x516faf['countnoanswerretry']+_0x516faf[_0xe70b('0x7')]+_0x516faf[_0xe70b('0x8')]+_0x516faf[_0xe70b('0x9')]+_0x516faf[_0xe70b('0xa')]+_0x516faf[_0xe70b('0xb')];this[_0xe70b('0x7')]=_0x516faf[_0xe70b('0x7')];this[_0xe70b('0x8')]=_0x516faf[_0xe70b('0x8')];this['countabandonedretry']=_0x516faf[_0xe70b('0x9')];this[_0xe70b('0xa')]=_0x516faf['countmachineretry'];this[_0xe70b('0xb')]=_0x516faf[_0xe70b('0xb')];this['queue']=_0x516faf[_0xe70b('0xc')];this[_0xe70b('0xd')]=_0x516faf[_0xe70b('0xd')];this[_0xe70b('0xe')]=_0x516faf[_0xe70b('0xe')];this[_0xe70b('0xf')]=_0x516faf[_0xe70b('0xf')];this[_0xe70b('0x10')]=_0x516faf[_0xe70b('0x10')];this[_0xe70b('0x11')]=_0x516faf[_0xe70b('0x10')];this[_0xe70b('0x12')]=_0x516faf[_0xe70b('0x12')]||0x0;this[_0xe70b('0x13')]=_0x516faf[_0xe70b('0x13')]||0x0;this[_0xe70b('0x14')]=_0x516faf[_0xe70b('0x14')]||0x0;this[_0xe70b('0x15')]=_0x516faf[_0xe70b('0x15')];this['callbackuniqueid']=_0x516faf[_0xe70b('0x16')];this[_0xe70b('0x17')]=_0x516faf[_0xe70b('0x17')];this[_0xe70b('0x18')]=_0x516faf[_0xe70b('0x18')];this[_0xe70b('0x19')]=_0x516faf[_0xe70b('0x19')];this[_0xe70b('0x1a')]=_0x516faf['ListId'];this[_0xe70b('0x1b')]=_0x516faf[_0xe70b('0x1b')];this[_0xe70b('0x1c')]=_0x516faf[_0xe70b('0x1c')];this[_0xe70b('0x1d')]=_0x516faf[_0xe70b('0x1d')];this[_0xe70b('0x1e')]=_0x516faf[_0xe70b('0x1e')]||'';this[_0xe70b('0x1f')]=_0x516faf[_0xe70b('0x1f')]||'';this[_0xe70b('0x20')]=_0x516faf[_0xe70b('0x20')];this[_0xe70b('0x21')]=_0x516faf['statedesc'];}module[_0xe70b('0x22')]=Final; \ No newline at end of file +var _0x5182=['exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc'];(function(_0xdb4e73,_0x30b446){var _0x4578b4=function(_0x119eb5){while(--_0x119eb5){_0xdb4e73['push'](_0xdb4e73['shift']());}};_0x4578b4(++_0x30b446);}(_0x5182,0x1cf));var _0x2518=function(_0x5188a4,_0x41866d){_0x5188a4=_0x5188a4-0x0;var _0x218c30=_0x5182[_0x5188a4];return _0x218c30;};'use strict';function Final(_0x478805){this[_0x2518('0x0')]=_0x478805[_0x2518('0x0')];this[_0x2518('0x1')]=_0x478805[_0x2518('0x1')];this[_0x2518('0x2')]=_0x478805[_0x2518('0x2')];this['campaigntype']=_0x478805['type']===_0x2518('0x3')?_0x2518('0x4'):_0x478805[_0x2518('0x2')];this[_0x2518('0x5')]=_0x478805[_0x2518('0x5')];this[_0x2518('0x6')]=_0x478805[_0x2518('0x6')];this[_0x2518('0x7')]=_0x478805[_0x2518('0x7')];this[_0x2518('0x8')]=_0x478805[_0x2518('0x5')]+_0x478805[_0x2518('0x6')]+_0x478805[_0x2518('0x7')]+_0x478805[_0x2518('0x9')]+_0x478805['countdropretry']+_0x478805['countabandonedretry']+_0x478805[_0x2518('0xa')]+_0x478805[_0x2518('0xb')];this[_0x2518('0x9')]=_0x478805[_0x2518('0x9')];this['countdropretry']=_0x478805[_0x2518('0xc')];this[_0x2518('0xd')]=_0x478805[_0x2518('0xd')];this['countmachineretry']=_0x478805[_0x2518('0xa')];this[_0x2518('0xb')]=_0x478805[_0x2518('0xb')];this[_0x2518('0x4')]=_0x478805['queue'];this[_0x2518('0xe')]=_0x478805[_0x2518('0xe')];this['calleridnum']=_0x478805[_0x2518('0xf')];this['starttime']=_0x478805['starttime'];this['responsetime']=_0x478805[_0x2518('0x10')];this[_0x2518('0x11')]=_0x478805[_0x2518('0x10')];this['ringtime']=_0x478805[_0x2518('0x12')]||0x0;this[_0x2518('0x13')]=_0x478805['holdtime']||0x0;this['talktime']=_0x478805['talktime']||0x0;this['callback']=_0x478805[_0x2518('0x14')];this[_0x2518('0x15')]=_0x478805[_0x2518('0x15')];this[_0x2518('0x16')]=_0x478805[_0x2518('0x16')];this[_0x2518('0x17')]=_0x478805[_0x2518('0x17')];this[_0x2518('0x18')]=_0x478805[_0x2518('0x18')];this[_0x2518('0x19')]=_0x478805['ListId'];this[_0x2518('0x1a')]=_0x478805[_0x2518('0x1a')];this[_0x2518('0x1b')]=_0x478805['VoiceQueueId'];this[_0x2518('0x1c')]=_0x478805[_0x2518('0x1c')];this[_0x2518('0x1d')]=_0x478805[_0x2518('0x1d')]||'';this['originatecalleridname']=_0x478805['originatecalleridname']||'';this[_0x2518('0x1e')]=_0x478805[_0x2518('0x1e')];this['statedesc']=_0x478805[_0x2518('0x1f')];}module[_0x2518('0x20')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 3651677..dfafc33 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 _0xdeed=['IVR','reason','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','../utils','state','Answer','scheduledat','type','outbound','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','queue','membername'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0xdeed,0xaf));var _0xddee=function(_0x5cc5cb,_0x392abe){_0x5cc5cb=_0x5cc5cb-0x0;var _0x41f677=_0xdeed[_0x5cc5cb];return _0x41f677;};'use strict';var moment=require('moment');var utils=require(_0xddee('0x0'));function Hangup(_0x247a03,_0x50ff27){this[_0xddee('0x1')]=0x4;this['statedesc']=_0xddee('0x2');this['scheduledat']=_0x247a03[_0xddee('0x3')];this[_0xddee('0x4')]=_0x247a03[_0xddee('0x4')];this['campaigntype']=_0x247a03['type']===_0xddee('0x5')?'queue':_0x247a03['type'];this[_0xddee('0x6')]=_0x247a03[_0xddee('0x6')]||![];this[_0xddee('0x7')]=_0x247a03['countbusyretry'];this['countcongestionretry']=_0x247a03[_0xddee('0x8')];this['countnoanswerretry']=_0x247a03['countnoanswerretry'];this[_0xddee('0x9')]=_0x247a03[_0xddee('0x7')]+_0x247a03[_0xddee('0x8')]+_0x247a03[_0xddee('0xa')]+_0x247a03['countnosuchnumberretry']+_0x247a03[_0xddee('0xb')]+_0x247a03[_0xddee('0xc')]+_0x247a03['countmachineretry']+_0x247a03[_0xddee('0xd')];this['countnosuchnumberretry']=_0x247a03[_0xddee('0xe')];this[_0xddee('0xb')]=_0x247a03['countdropretry'];this[_0xddee('0xc')]=_0x247a03[_0xddee('0xc')];this[_0xddee('0xf')]=_0x247a03['countmachineretry'];this[_0xddee('0xd')]=_0x247a03[_0xddee('0xd')];this[_0xddee('0x10')]=_0x50ff27[_0xddee('0x10')];this[_0xddee('0x11')]=_0x247a03[_0xddee('0x12')];this[_0xddee('0x13')]=_0x247a03[_0xddee('0x14')];this[_0xddee('0x15')]=_0x247a03['starttime'];this['responsetime']=_0x247a03[_0xddee('0x16')];this[_0xddee('0x17')]=moment()['format'](_0xddee('0x18'));this[_0xddee('0x19')]=utils[_0xddee('0x1a')](_0x247a03[_0xddee('0x16')],_0x247a03[_0xddee('0x15')]);this['holdtime']=0x0;this[_0xddee('0x1b')]=utils[_0xddee('0x1a')](this['endtime'],_0x247a03[_0xddee('0x16')]);this[_0xddee('0x1c')]=_0x247a03[_0xddee('0x1c')];this[_0xddee('0x1d')]=_0xddee('0x1e');this[_0xddee('0x1f')]=_0x50ff27[_0xddee('0x20')];this['callback']=_0x247a03['callback'];this['callbackuniqueid']=_0x247a03[_0xddee('0x21')];this[_0xddee('0x22')]=_0x247a03['callbackat'];this[_0xddee('0x23')]=_0x247a03[_0xddee('0x23')];this[_0xddee('0x24')]=_0x247a03[_0xddee('0x24')];this[_0xddee('0x25')]=_0x247a03['ListId'];this['UserId']=_0x247a03['UserId'];this['VoiceQueueId']=_0x247a03[_0xddee('0x26')];this['CampaignId']=_0x247a03[_0xddee('0x27')];}module[_0xddee('0x28')]=Hangup; \ No newline at end of file +var _0xd593=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','format','holdtime','talktime','getSeconds','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat'];(function(_0x250d5b,_0x58d310){var _0x8f0853=function(_0x9b5fc6){while(--_0x9b5fc6){_0x250d5b['push'](_0x250d5b['shift']());}};_0x8f0853(++_0x58d310);}(_0xd593,0x102));var _0x3d59=function(_0x2d67b4,_0x4ca8fe){_0x2d67b4=_0x2d67b4-0x0;var _0x4cd582=_0xd593[_0x2d67b4];return _0x4cd582;};'use strict';var moment=require(_0x3d59('0x0'));var utils=require(_0x3d59('0x1'));function Hangup(_0x2b06dd,_0x1bc845){this[_0x3d59('0x2')]=0x4;this[_0x3d59('0x3')]=_0x3d59('0x4');this[_0x3d59('0x5')]=_0x2b06dd['scheduledat'];this[_0x3d59('0x6')]=_0x2b06dd[_0x3d59('0x6')];this[_0x3d59('0x7')]=_0x2b06dd[_0x3d59('0x6')]===_0x3d59('0x8')?_0x3d59('0x9'):_0x2b06dd['type'];this['amd']=_0x2b06dd['amd']||![];this[_0x3d59('0xa')]=_0x2b06dd['countbusyretry'];this[_0x3d59('0xb')]=_0x2b06dd[_0x3d59('0xb')];this[_0x3d59('0xc')]=_0x2b06dd[_0x3d59('0xc')];this[_0x3d59('0xd')]=_0x2b06dd['countbusyretry']+_0x2b06dd[_0x3d59('0xb')]+_0x2b06dd[_0x3d59('0xc')]+_0x2b06dd[_0x3d59('0xe')]+_0x2b06dd['countdropretry']+_0x2b06dd['countabandonedretry']+_0x2b06dd['countmachineretry']+_0x2b06dd['countagentrejectretry'];this['countnosuchnumberretry']=_0x2b06dd[_0x3d59('0xe')];this[_0x3d59('0xf')]=_0x2b06dd[_0x3d59('0xf')];this[_0x3d59('0x10')]=_0x2b06dd[_0x3d59('0x10')];this['countmachineretry']=_0x2b06dd[_0x3d59('0x11')];this[_0x3d59('0x12')]=_0x2b06dd[_0x3d59('0x12')];this['uniqueid']=_0x1bc845['uniqueid'];this[_0x3d59('0x13')]=_0x2b06dd[_0x3d59('0x14')];this[_0x3d59('0x15')]=_0x2b06dd['number'];this[_0x3d59('0x16')]=_0x2b06dd[_0x3d59('0x16')];this[_0x3d59('0x17')]=_0x2b06dd[_0x3d59('0x17')];this[_0x3d59('0x18')]=moment()[_0x3d59('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils['getSeconds'](_0x2b06dd[_0x3d59('0x17')],_0x2b06dd['starttime']);this[_0x3d59('0x1a')]=0x0;this[_0x3d59('0x1b')]=utils[_0x3d59('0x1c')](this[_0x3d59('0x18')],_0x2b06dd[_0x3d59('0x17')]);this[_0x3d59('0x9')]=_0x2b06dd[_0x3d59('0x9')];this[_0x3d59('0x1d')]=_0x3d59('0x1e');this[_0x3d59('0x1f')]=_0x1bc845[_0x3d59('0x20')];this[_0x3d59('0x21')]=_0x2b06dd['callback'];this['callbackuniqueid']=_0x2b06dd[_0x3d59('0x22')];this[_0x3d59('0x23')]=_0x2b06dd[_0x3d59('0x23')];this[_0x3d59('0x24')]=_0x2b06dd[_0x3d59('0x24')];this[_0x3d59('0x25')]=_0x2b06dd[_0x3d59('0x25')];this['ListId']=_0x2b06dd[_0x3d59('0x26')];this[_0x3d59('0x27')]=_0x2b06dd[_0x3d59('0x27')];this[_0x3d59('0x28')]=_0x2b06dd[_0x3d59('0x28')];this[_0x3d59('0x29')]=_0x2b06dd[_0x3d59('0x29')];}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 a09540d..45a9a44 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 _0x559a=['number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x559a,0xe3));var _0xa559=function(_0x272cf5,_0x194b2e){_0x272cf5=_0x272cf5-0x0;var _0x103505=_0x559a[_0x272cf5];return _0x103505;};'use strict';var utils=require(_0xa559('0x0'));function History(_0x191c3d){this[_0xa559('0x1')]=_0x191c3d[_0xa559('0x1')];this['scheduledat']=_0x191c3d[_0xa559('0x2')]||undefined;this[_0xa559('0x3')]=_0x191c3d['type'];this[_0xa559('0x4')]=_0x191c3d[_0xa559('0x3')]===_0xa559('0x5')?_0xa559('0x6'):_0x191c3d[_0xa559('0x3')];this[_0xa559('0x7')]=_0x191c3d[_0xa559('0x7')];this[_0xa559('0x8')]=_0x191c3d[_0xa559('0x8')];this[_0xa559('0x9')]=_0x191c3d['countnoanswerretry'];this[_0xa559('0xa')]=_0x191c3d['countbusyretry']+_0x191c3d[_0xa559('0x8')]+_0x191c3d[_0xa559('0x9')]+_0x191c3d[_0xa559('0xb')]+_0x191c3d[_0xa559('0xc')]+_0x191c3d['countabandonedretry']+_0x191c3d[_0xa559('0xd')]+_0x191c3d[_0xa559('0xe')];this[_0xa559('0xb')]=_0x191c3d['countnosuchnumberretry'];this[_0xa559('0xc')]=_0x191c3d[_0xa559('0xc')];this[_0xa559('0xf')]=_0x191c3d['countabandonedretry'];this[_0xa559('0xd')]=_0x191c3d['countmachineretry'];this[_0xa559('0xe')]=_0x191c3d['countagentrejectretry'];this[_0xa559('0x6')]=_0x191c3d[_0xa559('0x6')];this[_0xa559('0x10')]=_0x191c3d[_0xa559('0x11')];this[_0xa559('0x12')]=_0x191c3d[_0xa559('0x13')];this['starttime']=_0x191c3d[_0xa559('0x14')];this[_0xa559('0x15')]=_0x191c3d[_0xa559('0x15')];this[_0xa559('0x16')]=_0x191c3d[_0xa559('0x15')];this[_0xa559('0x17')]=utils[_0xa559('0x18')](_0x191c3d['responsetime'],_0x191c3d['starttime']);this[_0xa559('0x19')]=0x0;this[_0xa559('0x1a')]=0x0;this[_0xa559('0x1b')]=_0x191c3d[_0xa559('0x1b')];this[_0xa559('0x1c')]=_0x191c3d[_0xa559('0x1c')];this[_0xa559('0x1d')]=_0x191c3d[_0xa559('0x1d')];this[_0xa559('0x1e')]=_0x191c3d['recallme'];this[_0xa559('0x1f')]=_0x191c3d[_0xa559('0x1f')];this[_0xa559('0x20')]=_0x191c3d['ListId'];this['UserId']=_0x191c3d[_0xa559('0x21')];this[_0xa559('0x22')]=_0x191c3d[_0xa559('0x22')];this[_0xa559('0x23')]=_0x191c3d[_0xa559('0x23')];this['originatecalleridnum']=_0x191c3d[_0xa559('0x24')]||'';this[_0xa559('0x25')]=_0x191c3d[_0xa559('0x25')]||'';this[_0xa559('0x26')]=_0x191c3d[_0xa559('0x26')];this[_0xa559('0x27')]=_0x191c3d[_0xa559('0x27')];}module[_0xa559('0x28')]=History; \ No newline at end of file +var _0xfed2=['exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc'];(function(_0x5debab,_0x2abef8){var _0x20333e=function(_0x170f2b){while(--_0x170f2b){_0x5debab['push'](_0x5debab['shift']());}};_0x20333e(++_0x2abef8);}(_0xfed2,0x112));var _0x2fed=function(_0x1832c5,_0x19d074){_0x1832c5=_0x1832c5-0x0;var _0x59769c=_0xfed2[_0x1832c5];return _0x59769c;};'use strict';var utils=require(_0x2fed('0x0'));function History(_0x53d536){this[_0x2fed('0x1')]=_0x53d536[_0x2fed('0x1')];this[_0x2fed('0x2')]=_0x53d536['scheduledat']||undefined;this[_0x2fed('0x3')]=_0x53d536['type'];this[_0x2fed('0x4')]=_0x53d536[_0x2fed('0x3')]===_0x2fed('0x5')?_0x2fed('0x6'):_0x53d536['type'];this[_0x2fed('0x7')]=_0x53d536[_0x2fed('0x7')];this['countcongestionretry']=_0x53d536['countcongestionretry'];this[_0x2fed('0x8')]=_0x53d536[_0x2fed('0x8')];this[_0x2fed('0x9')]=_0x53d536[_0x2fed('0x7')]+_0x53d536[_0x2fed('0xa')]+_0x53d536[_0x2fed('0x8')]+_0x53d536['countnosuchnumberretry']+_0x53d536[_0x2fed('0xb')]+_0x53d536[_0x2fed('0xc')]+_0x53d536['countmachineretry']+_0x53d536[_0x2fed('0xd')];this['countnosuchnumberretry']=_0x53d536[_0x2fed('0xe')];this[_0x2fed('0xb')]=_0x53d536[_0x2fed('0xb')];this[_0x2fed('0xc')]=_0x53d536[_0x2fed('0xc')];this[_0x2fed('0xf')]=_0x53d536[_0x2fed('0xf')];this[_0x2fed('0xd')]=_0x53d536['countagentrejectretry'];this[_0x2fed('0x6')]=_0x53d536[_0x2fed('0x6')];this[_0x2fed('0x10')]=_0x53d536[_0x2fed('0x11')];this[_0x2fed('0x12')]=_0x53d536[_0x2fed('0x13')];this[_0x2fed('0x14')]=_0x53d536[_0x2fed('0x14')];this[_0x2fed('0x15')]=_0x53d536[_0x2fed('0x15')];this[_0x2fed('0x16')]=_0x53d536['responsetime'];this[_0x2fed('0x17')]=utils[_0x2fed('0x18')](_0x53d536[_0x2fed('0x15')],_0x53d536[_0x2fed('0x14')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x2fed('0x19')]=_0x53d536['callback'];this[_0x2fed('0x1a')]=_0x53d536[_0x2fed('0x1a')];this[_0x2fed('0x1b')]=_0x53d536[_0x2fed('0x1b')];this['recallme']=_0x53d536[_0x2fed('0x1c')];this[_0x2fed('0x1d')]=_0x53d536[_0x2fed('0x1d')];this[_0x2fed('0x1e')]=_0x53d536[_0x2fed('0x1e')];this[_0x2fed('0x1f')]=_0x53d536[_0x2fed('0x1f')];this['VoiceQueueId']=_0x53d536[_0x2fed('0x20')];this[_0x2fed('0x21')]=_0x53d536['CampaignId'];this['originatecalleridnum']=_0x53d536[_0x2fed('0x22')]||'';this['originatecalleridname']=_0x53d536[_0x2fed('0x23')]||'';this[_0x2fed('0x24')]=_0x53d536['state'];this[_0x2fed('0x25')]=_0x53d536[_0x2fed('0x25')];}module[_0x2fed('0x26')]=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 e26bed4..3bf2897 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 _0x7e16=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry'];(function(_0x3e9c8f,_0x521402){var _0x110a5a=function(_0x4130f8){while(--_0x4130f8){_0x3e9c8f['push'](_0x3e9c8f['shift']());}};_0x110a5a(++_0x521402);}(_0x7e16,0x1b5));var _0x67e1=function(_0x5209db,_0x2cfdf2){_0x5209db=_0x5209db-0x0;var _0x2fb2c2=_0x7e16[_0x5209db];return _0x2fb2c2;};'use strict';var utils=require(_0x67e1('0x0'));function QueueCallerAbandon(_0x578221,_0x3e2588){this[_0x67e1('0x1')]=_0x578221[_0x67e1('0x1')];this[_0x67e1('0x2')]=_0x578221[_0x67e1('0x2')];this[_0x67e1('0x3')]=_0x578221['type']==='outbound'?_0x67e1('0x4'):_0x578221[_0x67e1('0x2')];this['countbusyretry']=_0x578221[_0x67e1('0x5')];this[_0x67e1('0x6')]=_0x578221[_0x67e1('0x6')];this['countnoanswerretry']=_0x578221[_0x67e1('0x7')];this[_0x67e1('0x8')]=_0x578221[_0x67e1('0x5')]+_0x578221[_0x67e1('0x6')]+_0x578221[_0x67e1('0x7')]+_0x578221['countnosuchnumberretry']+_0x578221[_0x67e1('0x9')]+_0x578221[_0x67e1('0xa')]+_0x578221['countmachineretry']+_0x578221[_0x67e1('0xb')];this[_0x67e1('0xc')]=_0x578221['countnosuchnumberretry'];this[_0x67e1('0x9')]=_0x578221[_0x67e1('0x9')];this[_0x67e1('0xa')]=_0x578221['countabandonedretry'];this[_0x67e1('0xd')]=_0x578221[_0x67e1('0xd')];this[_0x67e1('0xb')]=_0x578221[_0x67e1('0xb')];this[_0x67e1('0xe')]=_0x3e2588[_0x67e1('0xe')];this[_0x67e1('0xf')]=_0x578221[_0x67e1('0x10')];this[_0x67e1('0x11')]=_0x578221[_0x67e1('0x12')];this[_0x67e1('0x13')]=_0x578221[_0x67e1('0x13')];this['responsetime']=_0x578221[_0x67e1('0x14')];this['droptime']=_0x578221[_0x67e1('0x15')];this['dropreason']=_0x578221['dropreason'];this[_0x67e1('0x16')]=this[_0x67e1('0x15')];this[_0x67e1('0x17')]=utils['getSeconds'](_0x578221[_0x67e1('0x14')],_0x578221[_0x67e1('0x13')]);this['holdtime']=utils['getSeconds'](this[_0x67e1('0x15')],_0x578221[_0x67e1('0x14')]);this[_0x67e1('0x18')]=0x0;this[_0x67e1('0x4')]=_0x3e2588[_0x67e1('0x4')];this[_0x67e1('0x19')]=_0x3e2588[_0x67e1('0x1a')];this['reason']=_0x3e2588[_0x67e1('0x1b')];this[_0x67e1('0x1c')]=_0x578221[_0x67e1('0x1c')];this[_0x67e1('0x1d')]=_0x578221['callbackuniqueid'];this[_0x67e1('0x1e')]=_0x578221[_0x67e1('0x1e')];this[_0x67e1('0x1f')]=_0x578221[_0x67e1('0x1f')];this[_0x67e1('0x20')]=_0x578221[_0x67e1('0x20')];this[_0x67e1('0x21')]=_0x578221[_0x67e1('0x21')];this['UserId']=_0x578221[_0x67e1('0x22')];this['VoiceQueueId']=_0x578221[_0x67e1('0x23')];this['CampaignId']=_0x578221['CampaignId'];this[_0x67e1('0x24')]=_0x578221[_0x67e1('0x24')]||'';this[_0x67e1('0x25')]=_0x578221[_0x67e1('0x25')]||'';this[_0x67e1('0x26')]=_0x578221['agiafterat'];this['state']=_0x578221['state'];this[_0x67e1('0x27')]=_0x578221[_0x67e1('0x27')];}module[_0x67e1('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xb6a5=['countnoanswerretry','countbusyretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countcongestionretry'];(function(_0x5600d1,_0x33b9ea){var _0x44ba4d=function(_0x458d8f){while(--_0x458d8f){_0x5600d1['push'](_0x5600d1['shift']());}};_0x44ba4d(++_0x33b9ea);}(_0xb6a5,0x127));var _0x5b6a=function(_0x3253d8,_0x193063){_0x3253d8=_0x3253d8-0x0;var _0x2c4713=_0xb6a5[_0x3253d8];return _0x2c4713;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0xb97239,_0x525036){this[_0x5b6a('0x0')]=_0xb97239['scheduledat'];this['type']=_0xb97239[_0x5b6a('0x1')];this[_0x5b6a('0x2')]=_0xb97239[_0x5b6a('0x1')]===_0x5b6a('0x3')?_0x5b6a('0x4'):_0xb97239[_0x5b6a('0x1')];this['countbusyretry']=_0xb97239['countbusyretry'];this[_0x5b6a('0x5')]=_0xb97239[_0x5b6a('0x5')];this[_0x5b6a('0x6')]=_0xb97239[_0x5b6a('0x6')];this['countglobal']=_0xb97239[_0x5b6a('0x7')]+_0xb97239[_0x5b6a('0x5')]+_0xb97239['countnoanswerretry']+_0xb97239['countnosuchnumberretry']+_0xb97239[_0x5b6a('0x8')]+_0xb97239[_0x5b6a('0x9')]+_0xb97239['countmachineretry']+_0xb97239[_0x5b6a('0xa')];this['countnosuchnumberretry']=_0xb97239[_0x5b6a('0xb')];this[_0x5b6a('0x8')]=_0xb97239[_0x5b6a('0x8')];this[_0x5b6a('0x9')]=_0xb97239[_0x5b6a('0x9')];this[_0x5b6a('0xc')]=_0xb97239[_0x5b6a('0xc')];this[_0x5b6a('0xa')]=_0xb97239[_0x5b6a('0xa')];this[_0x5b6a('0xd')]=_0x525036[_0x5b6a('0xd')];this['calleridname']=_0xb97239[_0x5b6a('0xe')];this['calleridnum']=_0xb97239[_0x5b6a('0xf')];this[_0x5b6a('0x10')]=_0xb97239['starttime'];this[_0x5b6a('0x11')]=_0xb97239[_0x5b6a('0x11')];this[_0x5b6a('0x12')]=_0xb97239[_0x5b6a('0x12')];this['dropreason']=_0xb97239[_0x5b6a('0x13')];this[_0x5b6a('0x14')]=this[_0x5b6a('0x12')];this[_0x5b6a('0x15')]=utils[_0x5b6a('0x16')](_0xb97239[_0x5b6a('0x11')],_0xb97239[_0x5b6a('0x10')]);this[_0x5b6a('0x17')]=utils[_0x5b6a('0x16')](this[_0x5b6a('0x12')],_0xb97239[_0x5b6a('0x11')]);this[_0x5b6a('0x18')]=0x0;this[_0x5b6a('0x4')]=_0x525036[_0x5b6a('0x4')];this[_0x5b6a('0x19')]=_0x525036[_0x5b6a('0x1a')];this['reason']=_0x525036[_0x5b6a('0x1b')];this['callback']=_0xb97239[_0x5b6a('0x1c')];this[_0x5b6a('0x1d')]=_0xb97239['callbackuniqueid'];this['callbackat']=_0xb97239[_0x5b6a('0x1e')];this[_0x5b6a('0x1f')]=_0xb97239[_0x5b6a('0x1f')];this[_0x5b6a('0x20')]=_0xb97239[_0x5b6a('0x20')];this[_0x5b6a('0x21')]=_0xb97239['ListId'];this['UserId']=_0xb97239[_0x5b6a('0x22')];this[_0x5b6a('0x23')]=_0xb97239[_0x5b6a('0x23')];this[_0x5b6a('0x24')]=_0xb97239[_0x5b6a('0x24')];this[_0x5b6a('0x25')]=_0xb97239[_0x5b6a('0x25')]||'';this[_0x5b6a('0x26')]=_0xb97239[_0x5b6a('0x26')]||'';this[_0x5b6a('0x27')]=_0xb97239[_0x5b6a('0x27')];this['state']=_0xb97239[_0x5b6a('0x28')];this[_0x5b6a('0x29')]=_0xb97239['statedesc'];}module[_0x5b6a('0x2a')]=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 75e4cc5..9f73b92 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 _0x4819=['[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','error','[getContactDialer]','dialOrderByScheduledAt','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','catch','rescheduleContact','[rescheduleContact]','unlockContact'];(function(_0x5538d5,_0x190032){var _0x323b1a=function(_0x179caa){while(--_0x179caa){_0x5538d5['push'](_0x5538d5['shift']());}};_0x323b1a(++_0x190032);}(_0x4819,0xcd));var _0x9481=function(_0x3ee935,_0x293a98){_0x3ee935=_0x3ee935-0x0;var _0x586db7=_0x4819[_0x3ee935];return _0x586db7;};'use strict';var util=require('util');var logger=require(_0x9481('0x0'))(_0x9481('0x1'));var cmHopper=require(_0x9481('0x2'));var cmHopperAdditionalPhone=require(_0x9481('0x3'));var cmHopperBlack=require(_0x9481('0x4'));var cmHopperHistory=require(_0x9481('0x5'));function inspectError(_0x40a703){return util[_0x9481('0x6')](_0x40a703,{'showHidden':![],'depth':null});}function getContactDialer(_0xc39edf,_0x16c617,_0x5ac51c){return cmHopper[_0x9481('0x7')](_0xc39edf['id'],_0x16c617,_0x5ac51c,_0xc39edf['dialOrderByScheduledAt'])['catch'](function(_0x14e05a){_0xc39edf[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xa'),inspectError(_0x14e05a));});}exports[_0x9481('0x7')]=getContactDialer;function getContactDialerIvr(_0x4c7d9c,_0x1818cf){return cmHopper['getContactDialerIvr'](_0x4c7d9c['id'],_0x1818cf,_0x4c7d9c[_0x9481('0xb')])['catch'](function(_0x411d24){_0x4c7d9c[_0x9481('0x8')]=0x0;logger[_0x9481('0x9')](_0x9481('0xc'),inspectError(_0x411d24));});}exports[_0x9481('0xd')]=getContactDialerIvr;function countReScheduled(_0x29515a){return cmHopper[_0x9481('0xe')](_0x29515a)[_0x9481('0xf')](function(_0xed8e9){logger['error']('[countReScheduled]',inspectError(_0xed8e9));});}exports[_0x9481('0xe')]=countReScheduled;function rescheduleContact(_0x150276){return cmHopper[_0x9481('0x10')](_0x150276)[_0x9481('0xf')](function(_0x3d23c2){logger[_0x9481('0x9')](_0x9481('0x11'),inspectError(_0x3d23c2));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x4220f1,_0x7a7ee,_0x5b1fe6){return cmHopper[_0x9481('0x12')](_0x4220f1,_0x7a7ee,_0x5b1fe6)['catch'](function(_0x34108d){logger[_0x9481('0x9')](_0x9481('0x13'),inspectError(_0x34108d));});}exports[_0x9481('0x12')]=unlockContact;function moveContactManagedDialer(_0x546fce){return cmHopper['moveContactManagedDialer'](_0x546fce)[_0x9481('0xf')](function(_0x50a559){logger['error'](_0x9481('0x14'),inspectError(_0x50a559));});}exports[_0x9481('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x18c6f5){return cmHopperBlack[_0x9481('0x16')](_0x18c6f5)[_0x9481('0xf')](function(_0x3dc33f){logger['error'](_0x9481('0x17'),inspectError(_0x3dc33f));});}exports[_0x9481('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x45f9df){return cmHopperBlack[_0x9481('0x18')](_0x45f9df)[_0x9481('0xf')](function(_0x56da97){logger[_0x9481('0x9')](_0x9481('0x19'),inspectError(_0x56da97));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bcf37,_0xd1cd1a,_0x352b3a){return cmHopperAdditionalPhone[_0x9481('0x1a')](_0x2bcf37,_0xd1cd1a,_0x352b3a)[_0x9481('0xf')](function(_0x49ecfa){logger[_0x9481('0x9')](_0x9481('0x1b'),inspectError(_0x49ecfa));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x5eb4f5,_0x12b0c3,_0x299e28){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5eb4f5,_0x12b0c3,_0x299e28)[_0x9481('0xf')](function(_0x20ff9a){logger[_0x9481('0x9')](_0x9481('0x1c'),inspectError(_0x20ff9a));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x14f03e){return cmHopperHistory[_0x9481('0x1d')](_0x14f03e)[_0x9481('0xf')](function(_0x587706){logger[_0x9481('0x9')]('[avgHandleTime]',inspectError(_0x587706));});}exports[_0x9481('0x1d')]=avgHandleTime;function createHistory(_0xe153ab){return cmHopperHistory[_0x9481('0x1e')](_0xe153ab)[_0x9481('0xf')](function(_0x2e5e63){logger['error'](_0x9481('0x1f'),inspectError(_0x2e5e63));});}exports[_0x9481('0x1e')]=createHistory; \ No newline at end of file +var _0xa6b0=['[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x16d87d,_0x3393f5){_0x16d87d=_0x16d87d-0x0;var _0xd2774=_0xa6b0[_0x16d87d];return _0xd2774;};'use strict';var util=require(_0x0a6b('0x0'));var logger=require(_0x0a6b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x0a6b('0x2'));var cmHopperBlack=require(_0x0a6b('0x3'));var cmHopperHistory=require(_0x0a6b('0x4'));function inspectError(_0x4c9a84){return util[_0x0a6b('0x5')](_0x4c9a84,{'showHidden':![],'depth':null});}function getContactDialer(_0x33e8c3,_0x195697,_0xc7140c){return cmHopper[_0x0a6b('0x6')](_0x33e8c3['id'],_0x195697,_0xc7140c,_0x33e8c3[_0x0a6b('0x7')])[_0x0a6b('0x8')](function(_0xa908dd){_0x33e8c3[_0x0a6b('0x9')]=0x0;logger[_0x0a6b('0xa')](_0x0a6b('0xb'),inspectError(_0xa908dd));});}exports[_0x0a6b('0x6')]=getContactDialer;function getContactDialerIvr(_0x5046d8,_0x493948){return cmHopper[_0x0a6b('0xc')](_0x5046d8['id'],_0x493948,_0x5046d8[_0x0a6b('0x7')])[_0x0a6b('0x8')](function(_0x25ad47){_0x5046d8[_0x0a6b('0x9')]=0x0;logger[_0x0a6b('0xa')](_0x0a6b('0xd'),inspectError(_0x25ad47));});}exports[_0x0a6b('0xc')]=getContactDialerIvr;function countReScheduled(_0x8bbed9){return cmHopper[_0x0a6b('0xe')](_0x8bbed9)[_0x0a6b('0x8')](function(_0x890493){logger[_0x0a6b('0xa')](_0x0a6b('0xf'),inspectError(_0x890493));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x5e59a5){return cmHopper[_0x0a6b('0x10')](_0x5e59a5)[_0x0a6b('0x8')](function(_0x2abc4e){logger[_0x0a6b('0xa')](_0x0a6b('0x11'),inspectError(_0x2abc4e));});}exports[_0x0a6b('0x10')]=rescheduleContact;function unlockContact(_0x9bb98e,_0x19e84c,_0x1205a3){return cmHopper[_0x0a6b('0x12')](_0x9bb98e,_0x19e84c,_0x1205a3)['catch'](function(_0xa36d75){logger[_0x0a6b('0xa')]('[unlockContact]',inspectError(_0xa36d75));});}exports[_0x0a6b('0x12')]=unlockContact;function moveContactManagedDialer(_0x4d0e3b){return cmHopper[_0x0a6b('0x13')](_0x4d0e3b)[_0x0a6b('0x8')](function(_0x2cb10b){logger[_0x0a6b('0xa')]('[moveContactManagedDialer]',inspectError(_0x2cb10b));});}exports[_0x0a6b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x296162){return cmHopperBlack['checkIsBlackList'](_0x296162)[_0x0a6b('0x8')](function(_0x3f23b4){logger[_0x0a6b('0xa')]('[checkIsBlackList]',inspectError(_0x3f23b4));});}exports[_0x0a6b('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x93a465){return cmHopperBlack[_0x0a6b('0x15')](_0x93a465)['catch'](function(_0x220d3e){logger[_0x0a6b('0xa')](_0x0a6b('0x16'),inspectError(_0x220d3e));});}exports[_0x0a6b('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x122c19,_0x53848c,_0x1e5065){return cmHopperAdditionalPhone[_0x0a6b('0x17')](_0x122c19,_0x53848c,_0x1e5065)[_0x0a6b('0x8')](function(_0x5c77fb){logger[_0x0a6b('0xa')](_0x0a6b('0x18'),inspectError(_0x5c77fb));});}exports[_0x0a6b('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1b8b78,_0x3b12a2,_0x5b2229){return cmHopperAdditionalPhone[_0x0a6b('0x19')](_0x1b8b78,_0x3b12a2,_0x5b2229)[_0x0a6b('0x8')](function(_0x19a653){logger['error'](_0x0a6b('0x1a'),inspectError(_0x19a653));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0xecbf0c){return cmHopperHistory[_0x0a6b('0x1b')](_0xecbf0c)[_0x0a6b('0x8')](function(_0x4884a1){logger['error'](_0x0a6b('0x1c'),inspectError(_0x4884a1));});}exports[_0x0a6b('0x1b')]=avgHandleTime;function createHistory(_0x1aecc7){return cmHopperHistory[_0x0a6b('0x1d')](_0x1aecc7)[_0x0a6b('0x8')](function(_0x2bbcb1){logger['error'](_0x0a6b('0x1e'),inspectError(_0x2bbcb1));});}exports[_0x0a6b('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 476a1ee..c06b1ec 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 _0x92ff=['NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22\x22\x20<>','getCallerId','pow','replace','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0x92ff,0x129));var _0xf92f=function(_0x2afa06,_0x2df940){_0x2afa06=_0x2afa06-0x0;var _0x4a7d50=_0x92ff[_0x2afa06];return _0x4a7d50;};'use strict';var _=require(_0xf92f('0x0'));var moment=require(_0xf92f('0x1'));var util=require('util');var logger=require('../../../../config/logger')(_0xf92f('0x2'));var timezones=require('../../../../config/environment/shared')[_0xf92f('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0xf92f('0x4'),'BLACKLIST':_0xf92f('0x5'),'CONTACTS_RESCHEDULED':_0xf92f('0x6'),'DEACTIVATED':_0xf92f('0x7'),'DISACTIVED':_0xf92f('0x8'),'EMPTY_INTERVAL':_0xf92f('0x9'),'INACTIVE':_0xf92f('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xf92f('0xb'),'NULL_INTERVAL':_0xf92f('0xc'),'OVERTIME_INTERVAL':_0xf92f('0xd'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xf92f('0xe'),'RECALL_TIMEOUT':_0xf92f('0xf'),'RUNNING':_0xf92f('0x10'),'UNKNOWN_TIMEZONE':_0xf92f('0x11'),'UNREACHABLE_TRUNK':_0xf92f('0x12')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x396645){return _0x396645[_0xf92f('0x13')]===_0xf92f('0x14');}exports[_0xf92f('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x168066){return _0x168066[_0xf92f('0x16')]===_0xf92f('0x17');}exports[_0xf92f('0x18')]=isIVRCampaign;function isOutboundQueue(_0x4fb4d0){return _0x4fb4d0[_0xf92f('0x16')]==='outbound';}exports[_0xf92f('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x1629f5){return _0x1629f5[_0xf92f('0x1a')];}exports[_0xf92f('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x219cd9){return _0x219cd9[_0xf92f('0x1c')];}exports[_0xf92f('0x1d')]=isIVRCampaignActive;function getSeconds(_0x52a7ef,_0x11fd4c){var _0x2172f8=moment(_0x52a7ef)[_0xf92f('0x1e')](0x0);var _0x137be2=moment(_0x11fd4c)[_0xf92f('0x1e')](0x0);return _0x2172f8[_0xf92f('0x1f')](_0x137be2,_0xf92f('0x20'));}exports[_0xf92f('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x216029,_0x4ac8df){var _0xdbdd0e=![];var _0x21c66=_0x216029[_0xf92f('0x13')]!==_0x4ac8df[_0xf92f('0x13')]||_0x216029['dialActive']!==_0x4ac8df[_0xf92f('0x1a')]||_0x216029[_0xf92f('0x22')]!==_0x4ac8df['message'];var _0x7797c=_0x216029[_0xf92f('0x23')]!==_0x4ac8df[_0xf92f('0x23')]||_0x216029[_0xf92f('0x24')]!==_0x4ac8df[_0xf92f('0x24')]||_0x216029['loggedInDb']!==_0x4ac8df[_0xf92f('0x25')]||_0x216029['paused']!==_0x4ac8df['paused']||_0x216029['talking']!==_0x4ac8df[_0xf92f('0x26')]||_0x216029[_0xf92f('0x27')]!==_0x4ac8df['pTalking']||_0x216029[_0xf92f('0x28')]!==_0x4ac8df[_0xf92f('0x28')]||_0x216029['inUse']!==_0x4ac8df[_0xf92f('0x29')]||_0x216029[_0xf92f('0x2a')]!==_0x4ac8df[_0xf92f('0x2a')];if(_0x216029[_0xf92f('0x2b')]&&_0x4ac8df['Trunk']){_0xdbdd0e=_0x216029[_0xf92f('0x2b')][_0xf92f('0x2c')]!==_0x4ac8df[_0xf92f('0x2b')][_0xf92f('0x2c')]||_0x216029['Trunk'][_0xf92f('0x1c')]!==_0x4ac8df[_0xf92f('0x2b')]['active'];}return _0x21c66||_0x7797c||_0xdbdd0e;}exports[_0xf92f('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x38ba43){var _0x5a68b1=null;var _0x5f2761=_0x38ba43[_0xf92f('0x2e')];if(_[_0xf92f('0x2f')](_0x38ba43[_0xf92f('0x30')])||_[_0xf92f('0x2f')](_0x38ba43[_0xf92f('0x31')])||_[_0xf92f('0x2f')](_0x38ba43['Interval'][_0xf92f('0x32')])){_0x5a68b1=CAMPAIGN_STATUS[_0xf92f('0x33')];}else if(_[_0xf92f('0x34')](_0x38ba43['dialGlobalInterval'])||_['isEmpty'](_0x38ba43[_0xf92f('0x31')]['Intervals'])){_0x5a68b1=CAMPAIGN_STATUS[_0xf92f('0x35')];}else if(_0x5f2761&&!timezones[_0x5f2761]){_0x5a68b1=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x5a68b1;}function checkAnyValidTrunk(_0x3341dd,_0x247a6f){var _0x4c5dc8=null;var _0x3c576a=_0xf92f('0x36');var _0x13c628=[_0xf92f('0x37'),'unmonitored'];var _0x2f78aa=!![];if(_0x3341dd[_0xf92f('0x2b')]&&_0x3341dd[_0xf92f('0x2b')]['active']){_0x3c576a+=_0x3341dd[_0xf92f('0x2b')]['name'];_0x4c5dc8=_0x247a6f[_0x3c576a];_0x2f78aa=_0x13c628['includes'](_0x4c5dc8[_0xf92f('0x38')]);}else if(_0x3341dd[_0xf92f('0x39')]&&_0x3341dd['TrunkBackup'][_0xf92f('0x1c')]){_0x3c576a+=_0x3341dd['TrunkBackup']['name'];_0x4c5dc8=_0x247a6f[_0x3c576a];_0x2f78aa=_0x13c628[_0xf92f('0x3a')](_0x4c5dc8[_0xf92f('0x38')]);}return _0x2f78aa;}function getQueueCampaignStatusMessage(_0x128a9c,_0x39d805){var _0x231fdd=CAMPAIGN_STATUS[_0xf92f('0x4')];var _0x8176f4=isPreviewCampaign(_0x128a9c);if(!isQueueCampaignActive(_0x128a9c)){if(_0x8176f4){_0x231fdd=CAMPAIGN_STATUS[_0xf92f('0x3b')];}else{if(_0x128a9c[_0xf92f('0x2a')]===0x0&&_0x128a9c[_0xf92f('0x26')]===0x0&&_0x128a9c[_0xf92f('0x28')]===0x0&&(_0x128a9c[_0xf92f('0x27')]||0x0)===0x0){_0x231fdd=CAMPAIGN_STATUS['INACTIVE'];}else{_0x231fdd=CAMPAIGN_STATUS[_0xf92f('0x3c')];}}}else if(_0x128a9c[_0xf92f('0x24')]===0x0){_0x231fdd=CAMPAIGN_STATUS[_0xf92f('0x3d')];}else if(!checkAnyValidTrunk(_0x128a9c,_0x39d805)){_0x231fdd=CAMPAIGN_STATUS[_0xf92f('0x3e')];}else if(!isPreviewCampaign(_0x128a9c)){var _0x581f25=checkAnyValidQueueCampaignInterval(_0x128a9c);if(_0x581f25){_0x231fdd=_0x581f25;}}return _0x231fdd;}exports[_0xf92f('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4d65a2){var _0x1c0094=CAMPAIGN_STATUS[_0xf92f('0x3c')];if(_0x4d65a2[_0xf92f('0x2a')]===0x0&&_0x4d65a2['talking']===0x0&&_0x4d65a2[_0xf92f('0x28')]===0x0&&(_0x4d65a2['pTalking']||0x0)===0x0){_0x1c0094=CAMPAIGN_STATUS[_0xf92f('0x3b')];}return _0x1c0094;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5c3a02){var _0x3202f2=_0x5c3a02[_0xf92f('0x40')](/"(.*?)"/);return _0x3202f2?_0x3202f2[0x1]:_0x5c3a02;}exports[_0xf92f('0x41')]=extractCalleridName;function getCallerId(_0x16d763,_0x215e6a,_0x4a02e9){if(!_['isUndefined'](_0x4a02e9)&&typeof _0x4a02e9==='string'&&!_[_0xf92f('0x34')](_0x4a02e9)){if(!_[_0xf92f('0x42')](_0x215e6a)&&typeof _0x215e6a===_0xf92f('0x43')&&!_[_0xf92f('0x34')](_0x215e6a)){return util['format']('\x22%s\x22\x20<%s>',_0x215e6a,_0x4a02e9);}return util[_0xf92f('0x44')]('\x22%s\x22\x20<%s>',_0x4a02e9,_0x4a02e9);}if(!_['isUndefined'](_0x16d763)&&typeof _0x16d763==='string'&&!_[_0xf92f('0x34')](_0x16d763)){return _0x16d763;}return _0xf92f('0x45');}exports[_0xf92f('0x46')]=getCallerId;function getCallerIdRandom(_0x1bae8b,_0x2f5938){var _0x3226df;var _0x22f20f;var _0x9aa21e;if(_0x2f5938<=0x0){_0x2f5938=0x1;}_0x3226df=new RegExp('\x5cw{0,'+_0x2f5938+'}$');_0x22f20f=Math[_0xf92f('0x47')](0xa,_0x2f5938-0x1);_0x9aa21e=Math['pow'](0xa,_0x2f5938)-0x1;return util[_0xf92f('0x44')]('%s',_[_0xf92f('0x48')](_0x1bae8b,_0x3226df,_['random'](_0x22f20f,_0x9aa21e)[_0xf92f('0x49')]()));}exports[_0xf92f('0x4a')]=getCallerIdRandom;function decrementOriginate(_0x21e054){if(_0x21e054['originated']&&_0x21e054[_0xf92f('0x2a')]>0x0){_0x21e054['originated']-=0x1;}else{logger['error'](_0xf92f('0x4b'));}}exports[_0xf92f('0x4c')]=decrementOriginate;function checkContactEmpty(_0x3c1ca4){return _0x3c1ca4&&_0x3c1ca4[_0xf92f('0x4d')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x4a0723,_0x5eb65d){if(_0x5eb65d===0x0){return 0x0;}var _0x2001c1=0x1;for(var _0x55807f=0x1;_0x55807f<=_0x5eb65d;_0x55807f+=0x1){_0x2001c1=0x1+_0x2001c1*_0x55807f/_0x4a0723;}return 0x1/_0x2001c1;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x4c0c56,_0xa1a2c,_0x4c9309){if(_0xa1a2c>_0x4c9309){for(var _0x3c0c80=0x0;_0x3c0c80<_0xa1a2c-_0x4c9309;_0x3c0c80+=0x1){decrementOriginate(_0x4c0c56);}}}exports[_0xf92f('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x258841){var _0x602990={};var _0x43c80a=['id',_0xf92f('0x4f'),_0xf92f('0x50'),_0xf92f('0x51')];const _0x5eb0dd=0xfa;if(_0x258841){for(var _0x1088ab in _0x258841){if(typeof _0x258841[_0x1088ab]!==_0xf92f('0x52')){if(!_['isNil'](_0x258841[_0x1088ab])&&!_0x43c80a['includes'](_0x1088ab)){if(_0x1088ab==='description'&&_0x258841[_0x1088ab][_0xf92f('0x4d')]>_0x5eb0dd){_0x602990[_0xf92f('0x53')+_0x1088ab[_0xf92f('0x54')]()]=_0x258841[_0x1088ab][_0xf92f('0x49')]()[_0xf92f('0x55')](0x0,_0x5eb0dd);}else{_0x602990['XMD-'+_0x1088ab[_0xf92f('0x54')]()]=_0x258841[_0x1088ab];}}}}}return _0x602990;}exports[_0xf92f('0x56')]=setXMDContactVariables; \ No newline at end of file +var _0xf6b2=['toUpperCase','setXMDContactVariables','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','waiting','getQueueCampaignActiveStatusMessage','isUndefined','string','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','decrementOriginate','length','checkContactEmpty','erlangb','createdAt','tags','undefined','description','XMD-','substring'];(function(_0x58caf2,_0x13777e){var _0x219b1d=function(_0x427c52){while(--_0x427c52){_0x58caf2['push'](_0x58caf2['shift']());}};_0x219b1d(++_0x13777e);}(_0xf6b2,0xb8));var _0x2f6b=function(_0x4b387b,_0xbc912){_0x4b387b=_0x4b387b-0x0;var _0x43578c=_0xf6b2[_0x4b387b];return _0x43578c;};'use strict';var _=require('lodash');var moment=require(_0x2f6b('0x0'));var util=require(_0x2f6b('0x1'));var logger=require(_0x2f6b('0x2'))(_0x2f6b('0x3'));var timezones=require(_0x2f6b('0x4'))[_0x2f6b('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0x2f6b('0x6'),'BLACKLIST':_0x2f6b('0x7'),'CONTACTS_RESCHEDULED':_0x2f6b('0x8'),'DEACTIVATED':_0x2f6b('0x9'),'DISACTIVED':_0x2f6b('0xa'),'EMPTY_INTERVAL':_0x2f6b('0xb'),'INACTIVE':_0x2f6b('0xc'),'NO_AGENTS_LOGGED':_0x2f6b('0xd'),'NO_AVAILABLE_CONTACTS':_0x2f6b('0xe'),'NULL_INTERVAL':_0x2f6b('0xf'),'OVERTIME_INTERVAL':_0x2f6b('0x10'),'OVERTIME_GLOBAL_INTERVAL':_0x2f6b('0x11'),'QUEUE_RECALL':_0x2f6b('0x12'),'RECALL_TIMEOUT':_0x2f6b('0x13'),'RUNNING':_0x2f6b('0x14'),'UNKNOWN_TIMEZONE':_0x2f6b('0x15'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x2f6b('0x16')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x4ccf27){return _0x4ccf27[_0x2f6b('0x17')]===_0x2f6b('0x18');}exports[_0x2f6b('0x19')]=isPreviewCampaign;function isIVRCampaign(_0x342467){return _0x342467[_0x2f6b('0x1a')]===_0x2f6b('0x1b');}exports[_0x2f6b('0x1c')]=isIVRCampaign;function isOutboundQueue(_0x3cfa25){return _0x3cfa25['type']===_0x2f6b('0x1d');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x10f0b4){return _0x10f0b4[_0x2f6b('0x1e')];}exports[_0x2f6b('0x1f')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2a91a6){return _0x2a91a6['active'];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x54b0ce,_0x1c4b73){var _0x507f93=moment(_0x54b0ce)[_0x2f6b('0x20')](0x0);var _0x3ac75d=moment(_0x1c4b73)['milliseconds'](0x0);return _0x507f93[_0x2f6b('0x21')](_0x3ac75d,'seconds');}exports[_0x2f6b('0x22')]=getSeconds;function hasQueueCampaignDataChanged(_0x5289a1,_0x1a444b){var _0xd4a7a5=![];var _0x4959c8=_0x5289a1[_0x2f6b('0x17')]!==_0x1a444b[_0x2f6b('0x17')]||_0x5289a1[_0x2f6b('0x1e')]!==_0x1a444b['dialActive']||_0x5289a1['message']!==_0x1a444b[_0x2f6b('0x23')];var _0x1f4baf=_0x5289a1[_0x2f6b('0x24')]!==_0x1a444b['available']||_0x5289a1[_0x2f6b('0x25')]!==_0x1a444b[_0x2f6b('0x25')]||_0x5289a1[_0x2f6b('0x26')]!==_0x1a444b[_0x2f6b('0x26')]||_0x5289a1[_0x2f6b('0x27')]!==_0x1a444b['paused']||_0x5289a1['talking']!==_0x1a444b[_0x2f6b('0x28')]||_0x5289a1[_0x2f6b('0x29')]!==_0x1a444b[_0x2f6b('0x29')]||_0x5289a1['waiting']!==_0x1a444b['waiting']||_0x5289a1[_0x2f6b('0x2a')]!==_0x1a444b[_0x2f6b('0x2a')]||_0x5289a1[_0x2f6b('0x2b')]!==_0x1a444b[_0x2f6b('0x2b')];if(_0x5289a1[_0x2f6b('0x2c')]&&_0x1a444b[_0x2f6b('0x2c')]){_0xd4a7a5=_0x5289a1['Trunk'][_0x2f6b('0x2d')]!==_0x1a444b[_0x2f6b('0x2c')][_0x2f6b('0x2d')]||_0x5289a1[_0x2f6b('0x2c')]['active']!==_0x1a444b[_0x2f6b('0x2c')][_0x2f6b('0x2e')];}return _0x4959c8||_0x1f4baf||_0xd4a7a5;}exports[_0x2f6b('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0xefc694){var _0x57a2a2=null;var _0x1ef271=_0xefc694[_0x2f6b('0x30')];if(_['isNil'](_0xefc694['dialGlobalInterval'])||_[_0x2f6b('0x31')](_0xefc694[_0x2f6b('0x32')])||_['isNil'](_0xefc694[_0x2f6b('0x32')][_0x2f6b('0x33')])){_0x57a2a2=CAMPAIGN_STATUS[_0x2f6b('0x34')];}else if(_['isEmpty'](_0xefc694['dialGlobalInterval'])||_[_0x2f6b('0x35')](_0xefc694[_0x2f6b('0x32')][_0x2f6b('0x33')])){_0x57a2a2=CAMPAIGN_STATUS[_0x2f6b('0x36')];}else if(_0x1ef271&&!timezones[_0x1ef271]){_0x57a2a2=CAMPAIGN_STATUS[_0x2f6b('0x37')];}return _0x57a2a2;}function checkAnyValidTrunk(_0x5ec164,_0x461cd6){var _0x18e642=null;var _0x256715=_0x2f6b('0x38');var _0x4893a2=[_0x2f6b('0x39'),_0x2f6b('0x3a')];var _0x4ff28a=!![];if(_0x5ec164[_0x2f6b('0x2c')]&&_0x5ec164[_0x2f6b('0x2c')][_0x2f6b('0x2e')]){_0x256715+=_0x5ec164[_0x2f6b('0x2c')][_0x2f6b('0x2d')];_0x18e642=_0x461cd6[_0x256715];_0x4ff28a=_0x4893a2[_0x2f6b('0x3b')](_0x18e642[_0x2f6b('0x3c')]);}else if(_0x5ec164['TrunkBackup']&&_0x5ec164['TrunkBackup'][_0x2f6b('0x2e')]){_0x256715+=_0x5ec164['TrunkBackup']['name'];_0x18e642=_0x461cd6[_0x256715];_0x4ff28a=_0x4893a2[_0x2f6b('0x3b')](_0x18e642[_0x2f6b('0x3c')]);}return _0x4ff28a;}function getQueueCampaignStatusMessage(_0x147356,_0x42fe8a){var _0xe0bf6c=CAMPAIGN_STATUS[_0x2f6b('0x6')];var _0x2ea044=isPreviewCampaign(_0x147356);if(!isQueueCampaignActive(_0x147356)){if(_0x2ea044){_0xe0bf6c=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x147356[_0x2f6b('0x2b')]===0x0&&_0x147356[_0x2f6b('0x28')]===0x0&&_0x147356['waiting']===0x0&&(_0x147356[_0x2f6b('0x29')]||0x0)===0x0){_0xe0bf6c=CAMPAIGN_STATUS[_0x2f6b('0x3d')];}else{_0xe0bf6c=CAMPAIGN_STATUS[_0x2f6b('0x3e')];}}}else if(_0x147356[_0x2f6b('0x25')]===0x0){_0xe0bf6c=CAMPAIGN_STATUS[_0x2f6b('0x3f')];}else if(!checkAnyValidTrunk(_0x147356,_0x42fe8a)){_0xe0bf6c=CAMPAIGN_STATUS[_0x2f6b('0x40')];}else if(!isPreviewCampaign(_0x147356)){var _0x394ebf=checkAnyValidQueueCampaignInterval(_0x147356);if(_0x394ebf){_0xe0bf6c=_0x394ebf;}}return _0xe0bf6c;}exports[_0x2f6b('0x41')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1fecec){var _0x49f06f=CAMPAIGN_STATUS['DISACTIVED'];if(_0x1fecec['originated']===0x0&&_0x1fecec[_0x2f6b('0x28')]===0x0&&_0x1fecec[_0x2f6b('0x42')]===0x0&&(_0x1fecec['pTalking']||0x0)===0x0){_0x49f06f=CAMPAIGN_STATUS['INACTIVE'];}return _0x49f06f;}exports[_0x2f6b('0x43')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x396be9){var _0x5e7302=_0x396be9['match'](/"(.*?)"/);return _0x5e7302?_0x5e7302[0x1]:_0x396be9;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x36c0e2,_0x32a502,_0x56b87e){if(!_[_0x2f6b('0x44')](_0x56b87e)&&typeof _0x56b87e==='string'&&!_[_0x2f6b('0x35')](_0x56b87e)){if(!_[_0x2f6b('0x44')](_0x32a502)&&typeof _0x32a502===_0x2f6b('0x45')&&!_['isEmpty'](_0x32a502)){return util[_0x2f6b('0x46')](_0x2f6b('0x47'),_0x32a502,_0x56b87e);}return util[_0x2f6b('0x46')](_0x2f6b('0x47'),_0x56b87e,_0x56b87e);}if(!_['isUndefined'](_0x36c0e2)&&typeof _0x36c0e2==='string'&&!_[_0x2f6b('0x35')](_0x36c0e2)){return _0x36c0e2;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x26c181,_0x22a716){var _0x1ad91d;var _0x5d8b90;var _0x201922;if(_0x22a716<=0x0){_0x22a716=0x1;}_0x1ad91d=new RegExp(_0x2f6b('0x48')+_0x22a716+'}$');_0x5d8b90=Math[_0x2f6b('0x49')](0xa,_0x22a716-0x1);_0x201922=Math[_0x2f6b('0x49')](0xa,_0x22a716)-0x1;return util[_0x2f6b('0x46')]('%s',_[_0x2f6b('0x4a')](_0x26c181,_0x1ad91d,_[_0x2f6b('0x4b')](_0x5d8b90,_0x201922)[_0x2f6b('0x4c')]()));}exports[_0x2f6b('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x2fa029){if(_0x2fa029[_0x2f6b('0x2b')]&&_0x2fa029[_0x2f6b('0x2b')]>0x0){_0x2fa029['originated']-=0x1;}else{logger[_0x2f6b('0x4e')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x2f6b('0x4f')]=decrementOriginate;function checkContactEmpty(_0x65525c){return _0x65525c&&_0x65525c[_0x2f6b('0x50')]>0x0;}exports[_0x2f6b('0x51')]=checkContactEmpty;function erlangb(_0x1b19f5,_0x321a04){if(_0x321a04===0x0){return 0x0;}var _0x3c28ff=0x1;for(var _0x1ef596=0x1;_0x1ef596<=_0x321a04;_0x1ef596+=0x1){_0x3c28ff=0x1+_0x3c28ff*_0x1ef596/_0x1b19f5;}return 0x1/_0x3c28ff;}exports[_0x2f6b('0x52')]=erlangb;function checkContactLowerLimitOriginate(_0x59b519,_0x2f1ddb,_0x2d924d){if(_0x2f1ddb>_0x2d924d){for(var _0xa95597=0x0;_0xa95597<_0x2f1ddb-_0x2d924d;_0xa95597+=0x1){decrementOriginate(_0x59b519);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x27d702){var _0x3f9051={};var _0x2b1c8c=['id',_0x2f6b('0x53'),_0x2f6b('0x54'),'updatedAt'];const _0x5b172e=0xfa;if(_0x27d702){for(var _0x232f87 in _0x27d702){if(typeof _0x27d702[_0x232f87]!==_0x2f6b('0x55')){if(!_['isNil'](_0x27d702[_0x232f87])&&!_0x2b1c8c[_0x2f6b('0x3b')](_0x232f87)){if(_0x232f87===_0x2f6b('0x56')&&_0x27d702[_0x232f87][_0x2f6b('0x50')]>_0x5b172e){_0x3f9051[_0x2f6b('0x57')+_0x232f87['toUpperCase']()]=_0x27d702[_0x232f87]['toString']()[_0x2f6b('0x58')](0x0,_0x5b172e);}else{_0x3f9051[_0x2f6b('0x57')+_0x232f87[_0x2f6b('0x59')]()]=_0x27d702[_0x232f87];}}}}}return _0x3f9051;}exports[_0x2f6b('0x5a')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0d11796..7867674 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(_0x56c889,_0x33bcc4){var _0x99ee3a=function(_0x5e7f05){while(--_0x5e7f05){_0x56c889['push'](_0x56c889['shift']());}};_0x99ee3a(++_0x33bcc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x2abfae,_0x212d91){var _0x2b3e2a=function(_0x4e6f03){while(--_0x4e6f03){_0x2abfae['push'](_0x2abfae['shift']());}};_0x2b3e2a(++_0x212d91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 38a8102..c5a3a8d 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 _0xaf2b=['uniqueid','channel','channels','name','\x20syncNewchannel\x20','info','variable','syncNewState','channelstate','channelstatedesc','value','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','moment','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten'];(function(_0x7bf050,_0x36368d){var _0x4742b5=function(_0x41d31f){while(--_0x41d31f){_0x7bf050['push'](_0x7bf050['shift']());}};_0x4742b5(++_0x36368d);}(_0xaf2b,0x13f));var _0xbaf2=function(_0x585234,_0x3ae470){_0x585234=_0x585234-0x0;var _0x28b8a7=_0xaf2b[_0x585234];return _0x28b8a7;};'use strict';var util=require(_0xbaf2('0x0'));var _=require(_0xbaf2('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xbaf2('0x2'));var path=require(_0xbaf2('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xbaf2('0x4'));var logger=require(_0xbaf2('0x5'))(_0xbaf2('0x6'));var ami=require(_0xbaf2('0x7'));var rpcDb=require(_0xbaf2('0x8'));var Channel=require(_0xbaf2('0x9'));var ut=require(_0xbaf2('0xa'));var Action=require(_0xbaf2('0xb'));var faxAccount=require(_0xbaf2('0xc'));var attachment=require(_0xbaf2('0xd'));var faxMessage=require(_0xbaf2('0xe'));function Fax(_0x2fbb01){this['channels']={};this[_0xbaf2('0xf')]=_0x2fbb01['faxAccounts'];this[_0xbaf2('0x10')]=_0x2fbb01[_0xbaf2('0x10')];this[_0xbaf2('0x11')]={};ami['on']('newchannel',this[_0xbaf2('0x12')][_0xbaf2('0x13')](this));ami['on'](_0xbaf2('0x14'),this[_0xbaf2('0x15')][_0xbaf2('0x13')](this));ami['on']('newstate',this['syncNewState'][_0xbaf2('0x13')](this));ami['on'](_0xbaf2('0x16'),this[_0xbaf2('0x17')]['bind'](this));ami['on'](_0xbaf2('0x18'),this[_0xbaf2('0x19')]['bind'](this));ami['on'](_0xbaf2('0x1a'),this[_0xbaf2('0x1b')][_0xbaf2('0x13')](this));ami['on']('hangup',this[_0xbaf2('0x1c')][_0xbaf2('0x13')](this));ami['on'](_0xbaf2('0x1d'),this['syncOriginateResponse'][_0xbaf2('0x13')](this));}Fax[_0xbaf2('0x1e')][_0xbaf2('0x12')]=function(_0x509c9d){if(_0x509c9d[_0xbaf2('0x1f')]===_0xbaf2('0x20')){for(var _0x364c88 in this[_0xbaf2('0xf')]){if(this['faxAccounts'][_0xbaf2('0x21')](_0x364c88)){if(_0x509c9d[_0xbaf2('0x22')]===this[_0xbaf2('0xf')][_0x364c88]['localstationid']){this['channels'][_0x509c9d['uniqueid']]={};this['channels'][_0x509c9d[_0xbaf2('0x23')]][_0xbaf2('0x24')]=_0x509c9d['channel'];this['channels'][_0x509c9d[_0xbaf2('0x23')]]['id']=this[_0xbaf2('0xf')][_0x364c88]['id'];this[_0xbaf2('0x25')][_0x509c9d['uniqueid']][_0xbaf2('0x26')]=this[_0xbaf2('0xf')][_0x364c88]['name'];logger['info'](_0x509c9d['uniqueid'],_0xbaf2('0x27'));}}}}if(this[_0xbaf2('0x11')][_0x509c9d[_0xbaf2('0x23')]]){this[_0xbaf2('0x25')][_0x509c9d[_0xbaf2('0x23')]]={};this[_0xbaf2('0x25')][_0x509c9d[_0xbaf2('0x23')]][_0xbaf2('0x24')]=_0x509c9d[_0xbaf2('0x24')];logger[_0xbaf2('0x28')](_0x509c9d[_0xbaf2('0x23')],_0xbaf2('0x27'));}};Fax[_0xbaf2('0x1e')][_0xbaf2('0x15')]=function(_0x4abd1d){if(this[_0xbaf2('0x25')][_0x4abd1d['uniqueid']]){for(var _0x2ab4c3 in _0x4abd1d['variable']){if(_0x4abd1d[_0xbaf2('0x29')]['hasOwnProperty'](_0x2ab4c3)){this[_0xbaf2('0x25')][_0x4abd1d[_0xbaf2('0x23')]][_0x2ab4c3]=_0x4abd1d['value'];}}}};Fax[_0xbaf2('0x1e')][_0xbaf2('0x2a')]=function(_0x5cd74e){if(this[_0xbaf2('0x25')][_0x5cd74e[_0xbaf2('0x23')]]){this[_0xbaf2('0x25')][_0x5cd74e[_0xbaf2('0x23')]][_0xbaf2('0x2b')]=_0x5cd74e['channelstate'];this['channels'][_0x5cd74e['uniqueid']][_0xbaf2('0x2c')]=_0x5cd74e[_0xbaf2('0x2c')];}};Fax['prototype'][_0xbaf2('0x17')]=function(_0x1cdd19){if(this[_0xbaf2('0x25')][_0x1cdd19['uniqueid']]){for(var _0x2a0ea9 in _0x1cdd19[_0xbaf2('0x29')]){if(_0x1cdd19[_0xbaf2('0x29')][_0xbaf2('0x21')](_0x2a0ea9)){this[_0xbaf2('0x25')][_0x1cdd19[_0xbaf2('0x23')]][_0x2a0ea9]=_0x1cdd19[_0xbaf2('0x2d')];}}}};Fax['prototype'][_0xbaf2('0x19')]=function(_0x5febb3){if(this['channels'][_0x5febb3[_0xbaf2('0x23')]]){this['channels'][_0x5febb3[_0xbaf2('0x23')]][_0xbaf2('0x2e')]=_0x5febb3[_0xbaf2('0x2e')];this[_0xbaf2('0x25')][_0x5febb3['uniqueid']][_0xbaf2('0x2f')]=_0x5febb3[_0xbaf2('0x2f')];this[_0xbaf2('0x25')][_0x5febb3[_0xbaf2('0x23')]][_0xbaf2('0x30')]=_0x5febb3[_0xbaf2('0x30')];this[_0xbaf2('0x25')][_0x5febb3[_0xbaf2('0x23')]][_0xbaf2('0x31')]=_0x5febb3['filename'];logger[_0xbaf2('0x28')](_0x5febb3[_0xbaf2('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0xbaf2('0x1e')][_0xbaf2('0x1b')]=function(_0x292450){var _0x1ff228=this;if(this['channels'][_0x292450['uniqueid']]){var _0x16e0d0=this['channels'][_0x292450['uniqueid']]['id'];this[_0xbaf2('0x25')][_0x292450[_0xbaf2('0x23')]][_0xbaf2('0x32')]=_0x292450[_0xbaf2('0x32')];this['channels'][_0x292450[_0xbaf2('0x23')]][_0xbaf2('0x33')]=_0x292450[_0xbaf2('0x33')];this['channels'][_0x292450[_0xbaf2('0x23')]][_0xbaf2('0x30')]=_0x292450[_0xbaf2('0x30')];this['channels'][_0x292450[_0xbaf2('0x23')]][_0xbaf2('0x34')]=_0x292450['resolution'];this[_0xbaf2('0x25')][_0x292450[_0xbaf2('0x23')]]['transferrate']=_0x292450[_0xbaf2('0x35')];this[_0xbaf2('0x25')][_0x292450[_0xbaf2('0x23')]][_0xbaf2('0x31')]=_0x292450[_0xbaf2('0x31')];this[_0xbaf2('0x25')][_0x292450[_0xbaf2('0x23')]][_0xbaf2('0x36')]=_0x292450['calleridnum'];if(this[_0xbaf2('0x25')][_0x292450[_0xbaf2('0x23')]][_0xbaf2('0x33')]>0x0){tiff2pdf(_0x292450[_0xbaf2('0x31')],_0xbaf2('0x37'),function(_0xaa38fd){logger[_0xbaf2('0x28')](_0x292450['uniqueid'],_0xbaf2('0x38'),_0xaa38fd[_0xbaf2('0x39')]);attachment[_0xbaf2('0x3a')]({'name':path[_0xbaf2('0x3b')](_0x292450[_0xbaf2('0x31')])[_0xbaf2('0x26')],'basename':path[_0xbaf2('0x3b')](_0x292450[_0xbaf2('0x31')])['name']+_0xbaf2('0x3c'),'type':'application/pdf'})[_0xbaf2('0x3d')](function(_0xa41bc1){faxAccount[_0xbaf2('0x3e')](_0x16e0d0,{'from':_0x292450[_0xbaf2('0x36')],'mapKey':_0xbaf2('0x6'),'body':path['parse'](_0x292450[_0xbaf2('0x31')])[_0xbaf2('0x26')]+'.pdf','AttachmentId':_0xa41bc1['id']})['catch'](function(_0x3d5440){logger[_0xbaf2('0x3f')](_0x292450[_0xbaf2('0x23')],_0xbaf2('0x40'),JSON[_0xbaf2('0x41')](_0x3d5440));});})['catch'](function(_0xe119ad){logger[_0xbaf2('0x3f')](_0x292450[_0xbaf2('0x23')],_0xbaf2('0x42'),JSON[_0xbaf2('0x41')](_0xe119ad));});});}logger[_0xbaf2('0x28')](_0x292450[_0xbaf2('0x23')],_0xbaf2('0x42'));}};Fax['prototype'][_0xbaf2('0x43')]=function(_0x47000e){if(this[_0xbaf2('0x11')][_0x47000e['uniqueid']]){_[_0xbaf2('0x44')](this[_0xbaf2('0x25')][_0x47000e[_0xbaf2('0x23')]],_[_0xbaf2('0x45')](_0x47000e,[_0xbaf2('0x46'),_0xbaf2('0x47')]));}};function updateStatus(_0x26f4a5){if(_0x26f4a5[_0xbaf2('0x48')]){faxMessage['update'](_0x26f4a5[_0xbaf2('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xbaf2('0x3d')](function(_0x329f6a){ut[_0xbaf2('0x49')](_0xbaf2('0x4a'),_0x329f6a);})[_0xbaf2('0x4b')](function(_0x5109d7){ut[_0xbaf2('0x49')](_0xbaf2('0x4c'),_0x5109d7);});}else{ut['logger'](_0xbaf2('0x4d'));}}Fax[_0xbaf2('0x1e')][_0xbaf2('0x4e')]=function(_0xb78cac,_0x138876,_0x1a42c3){var _0x2f177a=this;var _0x1b8631={};if(_0x138876){_0x1b8631={'read':_0x138876};}else{_0x1b8631={'failMessage':_0x1a42c3};}if(this[_0xbaf2('0x11')][_0xb78cac][_0xbaf2('0x48')]){faxMessage[_0xbaf2('0x4f')](this[_0xbaf2('0x11')][_0xb78cac][_0xbaf2('0x48')],_0x1b8631)[_0xbaf2('0x3d')](function(_0x1a6059){ut[_0xbaf2('0x49')]('[Fax][Message][Updated]',_0x1a6059);})[_0xbaf2('0x4b')](function(_0x159d4e){ut[_0xbaf2('0x49')](_0xbaf2('0x50'),_0x159d4e);})[_0xbaf2('0x51')](function(){delete _0x2f177a[_0xbaf2('0x25')][_0xb78cac];delete _0x2f177a[_0xbaf2('0x11')][_0xb78cac];});}else{ut[_0xbaf2('0x49')]('[Fax][Message][NoUpdate2]');delete this[_0xbaf2('0x25')][_0xb78cac];delete this['actions'][_0xb78cac];}};Fax[_0xbaf2('0x1e')][_0xbaf2('0x1c')]=function(_0x4d3575){var _0x3c3965=this;if(this[_0xbaf2('0x25')][_0x4d3575['uniqueid']]){if(this[_0xbaf2('0x11')][_0x4d3575['uniqueid']]){this[_0xbaf2('0x25')][_0x4d3575['uniqueid']]['id']=this[_0xbaf2('0x11')][_0x4d3575[_0xbaf2('0x23')]]['id'];this[_0xbaf2('0x25')][_0x4d3575[_0xbaf2('0x23')]][_0xbaf2('0x26')]=this['actions'][_0x4d3575[_0xbaf2('0x23')]][_0xbaf2('0x26')];}logger[_0xbaf2('0x28')](_0x4d3575[_0xbaf2('0x23')],this[_0xbaf2('0x11')][_0x4d3575[_0xbaf2('0x23')]]?_0xbaf2('0x52'):_0xbaf2('0x53'),JSON['stringify'](this[_0xbaf2('0x25')][_0x4d3575[_0xbaf2('0x23')]]));if(this[_0xbaf2('0x11')][_0x4d3575[_0xbaf2('0x23')]]){if(this[_0xbaf2('0x25')][_0x4d3575[_0xbaf2('0x23')]][_0xbaf2('0x54')]>0x0&&this[_0xbaf2('0x25')][_0x4d3575[_0xbaf2('0x23')]][_0xbaf2('0x18')]==='SUCCESS'){this[_0xbaf2('0x4e')](_0x4d3575[_0xbaf2('0x23')],!![]);}else{this['updateStatus'](_0x4d3575[_0xbaf2('0x23')],![],this[_0xbaf2('0x25')][_0x4d3575['uniqueid']]['faxstatusstring']?_0xbaf2('0x55')+this[_0xbaf2('0x25')][_0x4d3575['uniqueid']][_0xbaf2('0x56')]:_0xbaf2('0x57'));}}}};Fax[_0xbaf2('0x1e')]['send']=function(_0x482d9f){var _0x5f2f93=this;return new BPromise(function(_0x5be7c8,_0x59c157){_0x5f2f93[_0xbaf2('0x58')](_0x482d9f,_0x5f2f93[_0xbaf2('0xf')][_0x482d9f[_0xbaf2('0x59')]])['then'](function(_0x2a8763){ut[_0xbaf2('0x49')](_0xbaf2('0x5a'),_0x2a8763);_0x5be7c8(ut[_0xbaf2('0x39')](_0xbaf2('0x5b')));})[_0xbaf2('0x4b')](function(_0x433455){ut['logger']('[Fax][execOriginate][failure]',_0x433455);updateStatus(_0x482d9f);_0x59c157(ut[_0xbaf2('0x39')](_0xbaf2('0x5c')));});});};Fax[_0xbaf2('0x1e')][_0xbaf2('0x5d')]=function(_0x4d680c){var _0x23b550=this;return new BPromise(function(_0x22892d,_0x1c1200){var _0x52ad3a=_0x23b550[_0xbaf2('0x5e')](_0x23b550['faxAccounts'][_0x4d680c['FaxAccountId']][_0xbaf2('0x5f')],_0x4d680c);if(_0x52ad3a[_0xbaf2('0x60')]){_0x22892d(ut['message'](_0xbaf2('0x61')));}else{_0x1c1200(ut[_0xbaf2('0x39')](_0x52ad3a[_0xbaf2('0x39')]));}});};function originate(_0x4eba59,_0x3c8c87,_0x526840){return new BPromise(function(_0x3a0be7,_0x46a0d1){if(_0x526840){var _0x13d10b=util[_0xbaf2('0x62')](_0xbaf2('0x63'),path[_0xbaf2('0x3b')](_0x4eba59['path'])[_0xbaf2('0x26')],_0x4eba59[_0xbaf2('0x3')]);gs[_0xbaf2('0x64')](_0x13d10b)[_0xbaf2('0x3d')](function(){_0x4eba59[_0xbaf2('0x3')]=util[_0xbaf2('0x62')](_0xbaf2('0x65'),path[_0xbaf2('0x3b')](_0x4eba59[_0xbaf2('0x3')])[_0xbaf2('0x66')],path[_0xbaf2('0x3b')](_0x4eba59[_0xbaf2('0x3')])[_0xbaf2('0x26')]);_0x3c8c87[_0xbaf2('0x67')]=_0x4eba59[_0xbaf2('0x3')];ut[_0xbaf2('0x49')](_0xbaf2('0x68'),'');ami[_0xbaf2('0x69')](ut[_0xbaf2('0x6a')](_0x4eba59,_0x3c8c87))[_0xbaf2('0x3d')](function(_0x506e56){_0x3a0be7(_0x506e56);})[_0xbaf2('0x4b')](function(_0xae1f3a){_0x46a0d1(_0xae1f3a);});})['catch'](function(_0x402ca1){_0x46a0d1(_0x402ca1);});}else{ami['Action'](ut[_0xbaf2('0x6a')](_0x4eba59,_0x3c8c87))[_0xbaf2('0x3d')](function(_0x3b4d6b){_0x3a0be7(_0x3b4d6b);})[_0xbaf2('0x4b')](function(_0x648b45){_0x46a0d1(_0x648b45);});}});}Fax[_0xbaf2('0x1e')][_0xbaf2('0x58')]=function(_0x543fdf,_0x53836b){var _0x1e7999=this;return new BPromise(function(_0xa39069,_0x2a19fb){var _0x4fdde9=uuid['v4']();var _0x460bcd=ut['addVariables'](_0x543fdf,_0x53836b);_0x1e7999[_0xbaf2('0x11')][_0x4fdde9]=new Action(_0x4fdde9,_0x53836b,_0x543fdf);var _0x53a4e8=_0x1e7999[_0xbaf2('0x11')][_0x4fdde9];if(path[_0xbaf2('0x3b')](_0x543fdf[_0xbaf2('0x3')])['ext']===_0xbaf2('0x3c')){originate(_0x53a4e8,_0x460bcd,!![])[_0xbaf2('0x3d')](function(_0x270ae8){_0xa39069(_0x270ae8);})[_0xbaf2('0x4b')](function(_0x85b0cc){_0x2a19fb(_0x85b0cc);});}else{originate(_0x53a4e8,_0x460bcd,![])[_0xbaf2('0x3d')](function(_0x3228d0){_0xa39069(_0x3228d0);})[_0xbaf2('0x4b')](function(_0x2b72e2){_0x2a19fb(_0x2b72e2);});}});};Fax[_0xbaf2('0x1e')]['isTrunkReachable']=function(_0x236e22){return!_[_0xbaf2('0x6b')](_0x236e22)&&!_[_0xbaf2('0x6b')](_0x236e22[_0xbaf2('0x26')])&&!_[_0xbaf2('0x6b')](_0x236e22[_0xbaf2('0x6c')])&&_0x236e22['active']&&!_['isNil'](this[_0xbaf2('0x10')][util[_0xbaf2('0x62')](_0xbaf2('0x6d'),_0x236e22['name'])])&&!_[_0xbaf2('0x6b')](this[_0xbaf2('0x10')][util[_0xbaf2('0x62')](_0xbaf2('0x6d'),_0x236e22['name'])][_0xbaf2('0x2f')])&&(this[_0xbaf2('0x10')][util[_0xbaf2('0x62')](_0xbaf2('0x6d'),_0x236e22[_0xbaf2('0x26')])]['status']===_0xbaf2('0x6e')||this[_0xbaf2('0x10')][util[_0xbaf2('0x62')](_0xbaf2('0x6d'),_0x236e22[_0xbaf2('0x26')])]['status']===_0xbaf2('0x6f'));};Fax[_0xbaf2('0x1e')][_0xbaf2('0x5e')]=function(_0x247267,_0x3b63ed){if(!this[_0xbaf2('0x70')](_0x247267)){ut[_0xbaf2('0x49')](_0xbaf2('0x71'),_[_0xbaf2('0x6b')](_0x247267)?'':_0x247267['name']+_0xbaf2('0x72'));return{'isValid':![],'message':_0xbaf2('0x73')};}if(_[_0xbaf2('0x6b')](_0x3b63ed[_0xbaf2('0x6')])){ut[_0xbaf2('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xbaf2('0x41')](_0x3b63ed));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xbaf2('0x6b')](_0x3b63ed[_0xbaf2('0x3')])){ut[_0xbaf2('0x49')](_0xbaf2('0x74'),JSON['stringify'](_0x3b63ed));return{'isValid':![],'message':_0xbaf2('0x75')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0x7203=['tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','varset','syncVarSet','bind','newstate','syncNewState','syncNewExten','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','value','syncFaxStatus','operation','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','moment','path'];(function(_0x3625e1,_0x253bc7){var _0x7f97f1=function(_0x2c4708){while(--_0x2c4708){_0x3625e1['push'](_0x3625e1['shift']());}};_0x7f97f1(++_0x253bc7);}(_0x7203,0x74));var _0x3720=function(_0x5967df,_0x4c334f){_0x5967df=_0x5967df-0x0;var _0x43d062=_0x7203[_0x5967df];return _0x43d062;};'use strict';var util=require(_0x3720('0x0'));var _=require(_0x3720('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x3720('0x2'));var path=require(_0x3720('0x3'));var tiff2pdf=require(_0x3720('0x4'));var gs=require(_0x3720('0x5'));var logger=require(_0x3720('0x6'))(_0x3720('0x7'));var ami=require(_0x3720('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x3720('0x9'));var ut=require(_0x3720('0xa'));var Action=require(_0x3720('0xb'));var faxAccount=require(_0x3720('0xc'));var attachment=require(_0x3720('0xd'));var faxMessage=require(_0x3720('0xe'));function Fax(_0x4b6580){this['channels']={};this[_0x3720('0xf')]=_0x4b6580[_0x3720('0xf')];this[_0x3720('0x10')]=_0x4b6580[_0x3720('0x10')];this[_0x3720('0x11')]={};ami['on'](_0x3720('0x12'),this['syncNewchannel']['bind'](this));ami['on'](_0x3720('0x13'),this[_0x3720('0x14')][_0x3720('0x15')](this));ami['on'](_0x3720('0x16'),this[_0x3720('0x17')][_0x3720('0x15')](this));ami['on']('newexten',this[_0x3720('0x18')][_0x3720('0x15')](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0x3720('0x19'),this['syncReceiveFax'][_0x3720('0x15')](this));ami['on'](_0x3720('0x1a'),this[_0x3720('0x1b')][_0x3720('0x15')](this));ami['on'](_0x3720('0x1c'),this[_0x3720('0x1d')]['bind'](this));}Fax[_0x3720('0x1e')][_0x3720('0x1f')]=function(_0x513aea){if(_0x513aea[_0x3720('0x20')]===_0x3720('0x21')){for(var _0x4652a5 in this['faxAccounts']){if(this[_0x3720('0xf')]['hasOwnProperty'](_0x4652a5)){if(_0x513aea['exten']===this[_0x3720('0xf')][_0x4652a5][_0x3720('0x22')]){this[_0x3720('0x23')][_0x513aea[_0x3720('0x24')]]={};this[_0x3720('0x23')][_0x513aea[_0x3720('0x24')]]['channel']=_0x513aea[_0x3720('0x25')];this[_0x3720('0x23')][_0x513aea['uniqueid']]['id']=this['faxAccounts'][_0x4652a5]['id'];this[_0x3720('0x23')][_0x513aea[_0x3720('0x24')]][_0x3720('0x26')]=this[_0x3720('0xf')][_0x4652a5][_0x3720('0x26')];logger[_0x3720('0x27')](_0x513aea[_0x3720('0x24')],_0x3720('0x28'));}}}}if(this[_0x3720('0x11')][_0x513aea[_0x3720('0x24')]]){this[_0x3720('0x23')][_0x513aea['uniqueid']]={};this['channels'][_0x513aea[_0x3720('0x24')]][_0x3720('0x25')]=_0x513aea[_0x3720('0x25')];logger[_0x3720('0x27')](_0x513aea['uniqueid'],_0x3720('0x28'));}};Fax[_0x3720('0x1e')][_0x3720('0x14')]=function(_0x264789){if(this[_0x3720('0x23')][_0x264789[_0x3720('0x24')]]){for(var _0x1da341 in _0x264789[_0x3720('0x29')]){if(_0x264789[_0x3720('0x29')][_0x3720('0x2a')](_0x1da341)){this['channels'][_0x264789[_0x3720('0x24')]][_0x1da341]=_0x264789['value'];}}}};Fax[_0x3720('0x1e')][_0x3720('0x17')]=function(_0x5a7ae3){if(this['channels'][_0x5a7ae3[_0x3720('0x24')]]){this[_0x3720('0x23')][_0x5a7ae3[_0x3720('0x24')]][_0x3720('0x2b')]=_0x5a7ae3['channelstate'];this[_0x3720('0x23')][_0x5a7ae3[_0x3720('0x24')]][_0x3720('0x2c')]=_0x5a7ae3['channelstatedesc'];}};Fax[_0x3720('0x1e')][_0x3720('0x18')]=function(_0x1ee560){if(this[_0x3720('0x23')][_0x1ee560[_0x3720('0x24')]]){for(var _0x17ec6d in _0x1ee560[_0x3720('0x29')]){if(_0x1ee560['variable']['hasOwnProperty'](_0x17ec6d)){this[_0x3720('0x23')][_0x1ee560[_0x3720('0x24')]][_0x17ec6d]=_0x1ee560[_0x3720('0x2d')];}}}};Fax[_0x3720('0x1e')][_0x3720('0x2e')]=function(_0x5c66f4){if(this[_0x3720('0x23')][_0x5c66f4[_0x3720('0x24')]]){this[_0x3720('0x23')][_0x5c66f4['uniqueid']][_0x3720('0x2f')]=_0x5c66f4['operation'];this['channels'][_0x5c66f4[_0x3720('0x24')]]['status']=_0x5c66f4['status'];this['channels'][_0x5c66f4[_0x3720('0x24')]][_0x3720('0x22')]=_0x5c66f4[_0x3720('0x22')];this[_0x3720('0x23')][_0x5c66f4[_0x3720('0x24')]][_0x3720('0x30')]=_0x5c66f4[_0x3720('0x30')];logger[_0x3720('0x27')](_0x5c66f4['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x3720('0x1e')]['syncReceiveFax']=function(_0x2bd382){var _0x25d8a6=this;if(this[_0x3720('0x23')][_0x2bd382[_0x3720('0x24')]]){var _0x4a4fda=this['channels'][_0x2bd382['uniqueid']]['id'];this[_0x3720('0x23')][_0x2bd382[_0x3720('0x24')]][_0x3720('0x31')]=_0x2bd382['remotestationid'];this['channels'][_0x2bd382[_0x3720('0x24')]]['pagestransferred']=_0x2bd382[_0x3720('0x32')];this['channels'][_0x2bd382[_0x3720('0x24')]][_0x3720('0x22')]=_0x2bd382['localstationid'];this[_0x3720('0x23')][_0x2bd382[_0x3720('0x24')]][_0x3720('0x33')]=_0x2bd382[_0x3720('0x33')];this[_0x3720('0x23')][_0x2bd382[_0x3720('0x24')]][_0x3720('0x34')]=_0x2bd382[_0x3720('0x34')];this[_0x3720('0x23')][_0x2bd382[_0x3720('0x24')]]['filename']=_0x2bd382[_0x3720('0x30')];this[_0x3720('0x23')][_0x2bd382[_0x3720('0x24')]][_0x3720('0x35')]=_0x2bd382['calleridnum'];if(this['channels'][_0x2bd382[_0x3720('0x24')]][_0x3720('0x32')]>0x0){tiff2pdf(_0x2bd382[_0x3720('0x30')],_0x3720('0x36'),function(_0x4eda99){logger[_0x3720('0x27')](_0x2bd382[_0x3720('0x24')],_0x3720('0x37'),_0x4eda99[_0x3720('0x38')]);attachment[_0x3720('0x39')]({'name':path['parse'](_0x2bd382['filename'])[_0x3720('0x26')],'basename':path[_0x3720('0x3a')](_0x2bd382['filename'])['name']+'.pdf','type':_0x3720('0x3b')})['then'](function(_0x28712c){faxAccount[_0x3720('0x3c')](_0x4a4fda,{'from':_0x2bd382[_0x3720('0x35')],'mapKey':_0x3720('0x7'),'body':path[_0x3720('0x3a')](_0x2bd382[_0x3720('0x30')])[_0x3720('0x26')]+_0x3720('0x3d'),'AttachmentId':_0x28712c['id']})[_0x3720('0x3e')](function(_0x391560){logger[_0x3720('0x3f')](_0x2bd382['uniqueid'],_0x3720('0x40'),JSON[_0x3720('0x41')](_0x391560));});})[_0x3720('0x3e')](function(_0x78b986){logger[_0x3720('0x3f')](_0x2bd382['uniqueid'],_0x3720('0x42'),JSON[_0x3720('0x41')](_0x78b986));});});}logger[_0x3720('0x27')](_0x2bd382[_0x3720('0x24')],'\x20receiveFax\x20');}};Fax[_0x3720('0x1e')][_0x3720('0x1d')]=function(_0x35ed7a){if(this[_0x3720('0x11')][_0x35ed7a[_0x3720('0x24')]]){_[_0x3720('0x43')](this[_0x3720('0x23')][_0x35ed7a[_0x3720('0x24')]],_['pick'](_0x35ed7a,[_0x3720('0x44'),_0x3720('0x45')]));}};function updateStatus(_0x4a8614){if(_0x4a8614['AttachmentId']){faxMessage[_0x3720('0x46')](_0x4a8614[_0x3720('0x47')],{'failMessage':_0x3720('0x48')})[_0x3720('0x49')](function(_0x17990b){ut[_0x3720('0x4a')](_0x3720('0x4b'),_0x17990b);})[_0x3720('0x3e')](function(_0x15e418){ut[_0x3720('0x4a')](_0x3720('0x4c'),_0x15e418);});}else{ut[_0x3720('0x4a')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x3720('0x1e')][_0x3720('0x4d')]=function(_0x4c9362,_0x32fcf0,_0x50dd7a){var _0x51c4c4=this;var _0x3f45be={};if(_0x32fcf0){_0x3f45be={'read':_0x32fcf0};}else{_0x3f45be={'failMessage':_0x50dd7a};}if(this[_0x3720('0x11')][_0x4c9362][_0x3720('0x47')]){faxMessage['update'](this[_0x3720('0x11')][_0x4c9362]['AttachmentId'],_0x3f45be)['then'](function(_0x4ba4f7){ut['logger'](_0x3720('0x4e'),_0x4ba4f7);})[_0x3720('0x3e')](function(_0x5eaea9){ut[_0x3720('0x4a')](_0x3720('0x4f'),_0x5eaea9);})['finally'](function(){delete _0x51c4c4['channels'][_0x4c9362];delete _0x51c4c4[_0x3720('0x11')][_0x4c9362];});}else{ut[_0x3720('0x4a')](_0x3720('0x50'));delete this[_0x3720('0x23')][_0x4c9362];delete this['actions'][_0x4c9362];}};Fax[_0x3720('0x1e')]['syncHangup']=function(_0x354c05){var _0x5bccdc=this;if(this[_0x3720('0x23')][_0x354c05['uniqueid']]){if(this[_0x3720('0x11')][_0x354c05[_0x3720('0x24')]]){this[_0x3720('0x23')][_0x354c05[_0x3720('0x24')]]['id']=this[_0x3720('0x11')][_0x354c05[_0x3720('0x24')]]['id'];this[_0x3720('0x23')][_0x354c05['uniqueid']][_0x3720('0x26')]=this[_0x3720('0x11')][_0x354c05[_0x3720('0x24')]][_0x3720('0x26')];}logger[_0x3720('0x27')](_0x354c05[_0x3720('0x24')],this['actions'][_0x354c05[_0x3720('0x24')]]?_0x3720('0x51'):_0x3720('0x52'),JSON[_0x3720('0x41')](this[_0x3720('0x23')][_0x354c05[_0x3720('0x24')]]));if(this[_0x3720('0x11')][_0x354c05[_0x3720('0x24')]]){if(this[_0x3720('0x23')][_0x354c05['uniqueid']][_0x3720('0x53')]>0x0&&this[_0x3720('0x23')][_0x354c05[_0x3720('0x24')]][_0x3720('0x54')]===_0x3720('0x55')){this[_0x3720('0x4d')](_0x354c05['uniqueid'],!![]);}else{this[_0x3720('0x4d')](_0x354c05[_0x3720('0x24')],![],this[_0x3720('0x23')][_0x354c05[_0x3720('0x24')]][_0x3720('0x56')]?_0x3720('0x57')+this[_0x3720('0x23')][_0x354c05[_0x3720('0x24')]][_0x3720('0x56')]:_0x3720('0x58'));}}}};Fax[_0x3720('0x1e')][_0x3720('0x59')]=function(_0x1dbea5){var _0x1f7473=this;return new BPromise(function(_0xe917e5,_0x130990){_0x1f7473[_0x3720('0x5a')](_0x1dbea5,_0x1f7473[_0x3720('0xf')][_0x1dbea5[_0x3720('0x5b')]])[_0x3720('0x49')](function(_0x376aca){ut[_0x3720('0x4a')](_0x3720('0x5c'),_0x376aca);_0xe917e5(ut['message']('Fax\x20received'));})[_0x3720('0x3e')](function(_0x836590){ut['logger']('[Fax][execOriginate][failure]',_0x836590);updateStatus(_0x1dbea5);_0x130990(ut[_0x3720('0x38')](_0x3720('0x5d')));});});};Fax['prototype'][_0x3720('0x5e')]=function(_0x4ad252){var _0x3abee3=this;return new BPromise(function(_0x354c94,_0x151d29){var _0x131481=_0x3abee3[_0x3720('0x5f')](_0x3abee3['faxAccounts'][_0x4ad252[_0x3720('0x5b')]][_0x3720('0x60')],_0x4ad252);if(_0x131481[_0x3720('0x61')]){_0x354c94(ut[_0x3720('0x38')](_0x3720('0x62')));}else{_0x151d29(ut['message'](_0x131481[_0x3720('0x38')]));}});};function originate(_0x43b190,_0xd3fc2,_0xf13e69){return new BPromise(function(_0x299222,_0x46686a){if(_0xf13e69){var _0x1f93b8=util[_0x3720('0x63')]('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[_0x3720('0x3a')](_0x43b190['path'])[_0x3720('0x26')],_0x43b190[_0x3720('0x3')]);gs[_0x3720('0x64')](_0x1f93b8)['then'](function(){_0x43b190[_0x3720('0x3')]=util[_0x3720('0x63')]('%s/%s.tif',path[_0x3720('0x3a')](_0x43b190['path'])['dir'],path[_0x3720('0x3a')](_0x43b190[_0x3720('0x3')])[_0x3720('0x26')]);_0xd3fc2[_0x3720('0x65')]=_0x43b190['path'];ut[_0x3720('0x4a')](_0x3720('0x66'),'');ami[_0x3720('0x67')](ut['variablesAction'](_0x43b190,_0xd3fc2))[_0x3720('0x49')](function(_0x3342da){_0x299222(_0x3342da);})[_0x3720('0x3e')](function(_0x3c1612){_0x46686a(_0x3c1612);});})[_0x3720('0x3e')](function(_0x3f1f40){_0x46686a(_0x3f1f40);});}else{ami['Action'](ut[_0x3720('0x68')](_0x43b190,_0xd3fc2))[_0x3720('0x49')](function(_0x40d9f6){_0x299222(_0x40d9f6);})['catch'](function(_0x56ebd9){_0x46686a(_0x56ebd9);});}});}Fax[_0x3720('0x1e')][_0x3720('0x5a')]=function(_0x2f708a,_0x1b7dbd){var _0x117ab3=this;return new BPromise(function(_0x3749fc,_0xb8f913){var _0x2e6de9=uuid['v4']();var _0x3ff4e2=ut['addVariables'](_0x2f708a,_0x1b7dbd);_0x117ab3[_0x3720('0x11')][_0x2e6de9]=new Action(_0x2e6de9,_0x1b7dbd,_0x2f708a);var _0x3cb18e=_0x117ab3[_0x3720('0x11')][_0x2e6de9];if(path[_0x3720('0x3a')](_0x2f708a[_0x3720('0x3')])[_0x3720('0x69')]==='.pdf'){originate(_0x3cb18e,_0x3ff4e2,!![])[_0x3720('0x49')](function(_0x1707ba){_0x3749fc(_0x1707ba);})['catch'](function(_0x30a648){_0xb8f913(_0x30a648);});}else{originate(_0x3cb18e,_0x3ff4e2,![])[_0x3720('0x49')](function(_0x4f092d){_0x3749fc(_0x4f092d);})[_0x3720('0x3e')](function(_0x249306){_0xb8f913(_0x249306);});}});};Fax[_0x3720('0x1e')][_0x3720('0x6a')]=function(_0x464d6a){return!_[_0x3720('0x6b')](_0x464d6a)&&!_[_0x3720('0x6b')](_0x464d6a[_0x3720('0x26')])&&!_[_0x3720('0x6b')](_0x464d6a[_0x3720('0x6c')])&&_0x464d6a[_0x3720('0x6c')]&&!_[_0x3720('0x6b')](this[_0x3720('0x10')][util[_0x3720('0x63')](_0x3720('0x6d'),_0x464d6a[_0x3720('0x26')])])&&!_['isNil'](this['trunks'][util[_0x3720('0x63')](_0x3720('0x6d'),_0x464d6a[_0x3720('0x26')])][_0x3720('0x6e')])&&(this[_0x3720('0x10')][util[_0x3720('0x63')]('SIP/%s',_0x464d6a[_0x3720('0x26')])][_0x3720('0x6e')]===_0x3720('0x6f')||this[_0x3720('0x10')][util[_0x3720('0x63')](_0x3720('0x6d'),_0x464d6a['name'])][_0x3720('0x6e')]==='unmonitored');};Fax[_0x3720('0x1e')][_0x3720('0x5f')]=function(_0x2f091f,_0x4138b5){if(!this[_0x3720('0x6a')](_0x2f091f)){ut[_0x3720('0x4a')](_0x3720('0x70'),_[_0x3720('0x6b')](_0x2f091f)?'':_0x2f091f[_0x3720('0x26')]+_0x3720('0x71'));return{'isValid':![],'message':_0x3720('0x72')};}if(_[_0x3720('0x6b')](_0x4138b5[_0x3720('0x7')])){ut[_0x3720('0x4a')]('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0x4138b5));return{'isValid':![],'message':_0x3720('0x73')};}if(_['isNil'](_0x4138b5['path'])){ut[_0x3720('0x4a')](_0x3720('0x74'),JSON[_0x3720('0x41')](_0x4138b5));return{'isValid':![],'message':_0x3720('0x75')};}return{'isValid':!![],'message':_0x3720('0x76')};};module[_0x3720('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 383ac89..1c50442 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 _0xfae1=['error','inspect','notify','resolve','catch','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x176c68,_0x7cb222){var _0x51e751=function(_0x391d22){while(--_0x391d22){_0x176c68['push'](_0x176c68['shift']());}};_0x51e751(++_0x7cb222);}(_0xfae1,0xd7));var _0x1fae=function(_0x35d414,_0x213fa5){_0x35d414=_0x35d414-0x0;var _0x1a0b9b=_0xfae1[_0x35d414];return _0x1a0b9b;};'use strict';var util=require(_0x1fae('0x0'));var BPromise=require('bluebird');var logger=require(_0x1fae('0x1'))(_0x1fae('0x2'));var _=require(_0x1fae('0x3'));var faxAccount=require(_0x1fae('0x4'));function loggerCatch(_0xcee474){return function(_0x4c4493){logger[_0x1fae('0x5')](_0xcee474,util[_0x1fae('0x6')](_0x4c4493,{'showHidden':![],'depth':null}));};}exports[_0x1fae('0x7')]=function(_0x13613a,_0x55e066){return BPromise[_0x1fae('0x8')]()['then'](faxAccount['notify'](_0x13613a,_0x55e066))[_0x1fae('0x9')](loggerCatch(_0x1fae('0xa')));}; \ No newline at end of file +var _0xb021=['bluebird','lodash','../rpc/faxAccount','error','inspect','resolve','then','catch','[Notify]\x20'];(function(_0x687ce7,_0x39db4f){var _0x8bb835=function(_0x1fe8f7){while(--_0x1fe8f7){_0x687ce7['push'](_0x687ce7['shift']());}};_0x8bb835(++_0x39db4f);}(_0xb021,0x15f));var _0x1b02=function(_0x5e5b5e,_0x1d4bde){_0x5e5b5e=_0x5e5b5e-0x0;var _0x296489=_0xb021[_0x5e5b5e];return _0x296489;};'use strict';var util=require('util');var BPromise=require(_0x1b02('0x0'));var logger=require('../../../config/logger')('preview');var _=require(_0x1b02('0x1'));var faxAccount=require(_0x1b02('0x2'));function loggerCatch(_0x231995){return function(_0x55af2f){logger[_0x1b02('0x3')](_0x231995,util[_0x1b02('0x4')](_0x55af2f,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2a1d6c,_0x36c9b5){return BPromise[_0x1b02('0x5')]()[_0x1b02('0x6')](faxAccount['notify'](_0x2a1d6c,_0x36c9b5))[_0x1b02('0x7')](loggerCatch(_0x1b02('0x8')));}; \ 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 ae35afc..7d5e1d2 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 _0x2f4e=['bluebird','child_process','exec','Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f4e,0x115));var _0xe2f4=function(_0x413a76,_0x51d84a){_0x413a76=_0x413a76-0x0;var _0x3aeeb6=_0x2f4e[_0x413a76];return _0x3aeeb6;};'use strict';var util=require(_0xe2f4('0x0'));var logger=require(_0xe2f4('0x1'))(_0xe2f4('0x2'));var BPromise=require(_0xe2f4('0x3'));var exec=require(_0xe2f4('0x4'))[_0xe2f4('0x5')];exports['execute']=function(_0x2b60da){return new BPromise(function(_0x1915fd,_0x125034){exec(_0x2b60da,function(_0x489f29,_0x26bc0a,_0x3320c9){logger['info'](_0xe2f4('0x6'),_0x26bc0a);if(_0x489f29){logger[_0xe2f4('0x7')](_0xe2f4('0x6'),_0xe2f4('0x8'),util[_0xe2f4('0x9')](_0x489f29,{'showHidden':![],'depth':null}),_0x26bc0a,_0x3320c9);_0x125034(_0x489f29);}_0x1915fd(_0x26bc0a);});});}; \ No newline at end of file +var _0x9b8a=['\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x9b8a,0x14f));var _0xa9b8=function(_0x48ccc1,_0x55e9cb){_0x48ccc1=_0x48ccc1-0x0;var _0x9ffe13=_0x9b8a[_0x48ccc1];return _0x9ffe13;};'use strict';var util=require('util');var logger=require(_0xa9b8('0x0'))(_0xa9b8('0x1'));var BPromise=require(_0xa9b8('0x2'));var exec=require('child_process')[_0xa9b8('0x3')];exports[_0xa9b8('0x4')]=function(_0x28e53b){return new BPromise(function(_0x132253,_0x4ed1c6){exec(_0x28e53b,function(_0x2ce8e3,_0x16fcfe,_0x4870af){logger[_0xa9b8('0x5')](_0xa9b8('0x6'),_0x16fcfe);if(_0x2ce8e3){logger[_0xa9b8('0x5')](_0xa9b8('0x6'),_0xa9b8('0x7'),util[_0xa9b8('0x8')](_0x2ce8e3,{'showHidden':![],'depth':null}),_0x16fcfe,_0x4870af);_0x4ed1c6(_0x2ce8e3);}_0x132253(_0x16fcfe);});});}; \ 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 a982d8a..7bddf70 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 _0x01bf=['maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','channel','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate'];(function(_0x276c56,_0x4b6105){var _0x37c7d5=function(_0x4aceac){while(--_0x4aceac){_0x276c56['push'](_0x276c56['shift']());}};_0x37c7d5(++_0x4b6105);}(_0x01bf,0xbb));var _0xf01b=function(_0x50cb5c,_0x377a47){_0x50cb5c=_0x50cb5c-0x0;var _0x361ad4=_0x01bf[_0x50cb5c];return _0x361ad4;};'use strict';var util=require(_0xf01b('0x0'));var _=require(_0xf01b('0x1'));var moment=require(_0xf01b('0x2'));var logger=require(_0xf01b('0x3'))(_0xf01b('0x4'));exports[_0xf01b('0x5')]=function(_0x4cfcef){return{'message':_0x4cfcef};};exports[_0xf01b('0x6')]=function(_0x2a9e44,_0x4ddee7){logger[_0xf01b('0x7')](_0x2a9e44,util[_0xf01b('0x8')](_0x4ddee7,{'showHidden':![],'depth':null}));};exports[_0xf01b('0x9')]=function(_0x314d58,_0x30448d){var _0x223d8a={'XMF-ECM':_0x30448d[_0xf01b('0xa')],'XMF-HEADERINFO':_0x30448d[_0xf01b('0xb')],'XMF-MINRATE':_0x30448d[_0xf01b('0xc')],'XMF-MAXRATE':_0x30448d[_0xf01b('0xd')],'XMF-MODEM':util[_0xf01b('0xe')](_0xf01b('0xf'),_0x30448d[_0xf01b('0x10')]),'XMF-GATEWAY':_0x30448d[_0xf01b('0x11')],'XMF-FAXDETECT':_0x30448d[_0xf01b('0x12')],'XMF-T38TIMEOUT':_0x30448d[_0xf01b('0x13')],'XMF-LOCALSTATIONID':_0x30448d[_0xf01b('0x14')],'XMF-PATH':_0x314d58[_0xf01b('0x15')]};return _0x223d8a;};exports[_0xf01b('0x16')]=function(_0x5eee82,_0x1c0321){return{'actionid':_0x5eee82['uniqueid'],'action':'originate','channel':_0x5eee82[_0xf01b('0x17')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0xf01b('0xe')](_0xf01b('0x18'),_0x5eee82[_0xf01b('0xb')]?_0x5eee82['headerinfo']:'',_0x5eee82[_0xf01b('0x14')]),'variable':_0x1c0321,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5eee82['uniqueid']};}; \ No newline at end of file +var _0x2bad=['message','logger','info','inspect','addVariables','ecm','maxrate','format','gateway','path','variablesAction','uniqueid','headerinfo','localstationid','util','moment','fax'];(function(_0x2e71c0,_0x123a28){var _0x2db90f=function(_0x48deaf){while(--_0x48deaf){_0x2e71c0['push'](_0x2e71c0['shift']());}};_0x2db90f(++_0x123a28);}(_0x2bad,0x11e));var _0xd2ba=function(_0x741a7b,_0x5cb899){_0x741a7b=_0x741a7b-0x0;var _0x43a8e6=_0x2bad[_0x741a7b];return _0x43a8e6;};'use strict';var util=require(_0xd2ba('0x0'));var _=require('lodash');var moment=require(_0xd2ba('0x1'));var logger=require('../../../../config/logger')(_0xd2ba('0x2'));exports[_0xd2ba('0x3')]=function(_0x4f61c3){return{'message':_0x4f61c3};};exports[_0xd2ba('0x4')]=function(_0x25387b,_0x40aed1){logger[_0xd2ba('0x5')](_0x25387b,util[_0xd2ba('0x6')](_0x40aed1,{'showHidden':![],'depth':null}));};exports[_0xd2ba('0x7')]=function(_0x3eba25,_0x296b70){var _0x506157={'XMF-ECM':_0x296b70[_0xd2ba('0x8')],'XMF-HEADERINFO':_0x296b70['headerinfo'],'XMF-MINRATE':_0x296b70['minrate'],'XMF-MAXRATE':_0x296b70[_0xd2ba('0x9')],'XMF-MODEM':util[_0xd2ba('0xa')]('\x22%s\x22',_0x296b70['modem']),'XMF-GATEWAY':_0x296b70[_0xd2ba('0xb')],'XMF-FAXDETECT':_0x296b70['faxdetect'],'XMF-T38TIMEOUT':_0x296b70['t38timeout'],'XMF-LOCALSTATIONID':_0x296b70['localstationid'],'XMF-PATH':_0x3eba25[_0xd2ba('0xc')]};return _0x506157;};exports[_0xd2ba('0xd')]=function(_0x4ff991,_0x13ce6e){return{'actionid':_0x4ff991[_0xd2ba('0xe')],'action':'originate','channel':_0x4ff991['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x4ff991['headerinfo']?_0x4ff991[_0xd2ba('0xf')]:'',_0x4ff991[_0xd2ba('0x10')]),'variable':_0x13ce6e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4ff991[_0xd2ba('0xe')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index cb043c9..715b68c 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 _0x3ef5=['initSalesforceAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','sync','[index.js][main]','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts'];(function(_0x645adc,_0x23ab56){var _0x253557=function(_0x1852b9){while(--_0x1852b9){_0x645adc['push'](_0x645adc['shift']());}};_0x253557(++_0x23ab56);}(_0x3ef5,0x64));var _0x53ef=function(_0x13c0b3,_0x4c7bb3){_0x13c0b3=_0x13c0b3-0x0;var _0x3f50fa=_0x3ef5[_0x13c0b3];return _0x3f50fa;};'use strict';var util=require(_0x53ef('0x0'));var moment=require(_0x53ef('0x1'));var server=require(_0x53ef('0x2'));var Realtime=require(_0x53ef('0x3'));var Report=require('./report');var Acw=require(_0x53ef('0x4'));var Trigger=require(_0x53ef('0x5'));var Dialer=require(_0x53ef('0x6'));var Preview=require(_0x53ef('0x7'));var Fax=require(_0x53ef('0x8'));var user=require(_0x53ef('0x9'));var voiceQueue=require(_0x53ef('0xa'));var voiceQueueReport=require(_0x53ef('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x53ef('0xc'));var trigger=require(_0x53ef('0xd'));var template=require(_0x53ef('0xe'));var cmHopperHistory=require(_0x53ef('0xf'));var campaign=require(_0x53ef('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x53ef('0x11'));var zendesk=require(_0x53ef('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x53ef('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x53ef('0x14'));var zoho=require(_0x53ef('0x15'));var vtiger=require(_0x53ef('0x16'));var freshsales=require(_0x53ef('0x17'));var servicenow=require(_0x53ef('0x18'));var dynamics365=require(_0x53ef('0x19'));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(_0x53ef('0x1a'))(_0x53ef('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x53ef('0x1c')](_0x53ef('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x53ef('0x1c')](_0x53ef('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x53ef('0x1e')](user[_0x53ef('0x1f')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x20')]())[_0x53ef('0x1e')](user[_0x53ef('0x21')]())['then'](realtime[_0x53ef('0x22')]())[_0x53ef('0x1e')](trunk[_0x53ef('0x23')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x24')]())['then'](voiceQueue[_0x53ef('0x25')]())[_0x53ef('0x1e')](realtime['initVoiceQueues']())[_0x53ef('0x1e')](trigger[_0x53ef('0x26')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x27')]())['then'](template[_0x53ef('0x28')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x29')]())['then'](zendesk[_0x53ef('0x2a')]())[_0x53ef('0x1e')](realtime['initZendeskAccounts']())[_0x53ef('0x1e')](salesforce[_0x53ef('0x2b')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x2c')]())[_0x53ef('0x1e')](sugarcrm['getSugarcrmAccounts']())[_0x53ef('0x1e')](realtime[_0x53ef('0x2d')]())['then'](freshdesk['getFreshdeskAccounts']())[_0x53ef('0x1e')](realtime['initFreshdeskAccounts']())[_0x53ef('0x1e')](desk[_0x53ef('0x2e')]())['then'](realtime[_0x53ef('0x2f')]())[_0x53ef('0x1e')](zoho[_0x53ef('0x30')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x31')]())[_0x53ef('0x1e')](vtiger[_0x53ef('0x32')]())['then'](realtime['initVtigerAccounts']())[_0x53ef('0x1e')](freshsales[_0x53ef('0x33')]())[_0x53ef('0x1e')](realtime['initFreshsalesAccounts']())[_0x53ef('0x1e')](servicenow[_0x53ef('0x34')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x35')]())['then'](dynamics365[_0x53ef('0x36')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x37')]())[_0x53ef('0x1e')](campaign['getCampaigns']())['then'](realtime['initCampaigns']())[_0x53ef('0x1e')](voiceExtension[_0x53ef('0x38')]())['then'](realtime[_0x53ef('0x39')]())[_0x53ef('0x1e')](faxAccount[_0x53ef('0x3a')]())[_0x53ef('0x1e')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise[_0x53ef('0x3b')]()['then'](voiceQueueReport[_0x53ef('0x3c')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x3d')]())[_0x53ef('0x1e')](cmHopperHistory[_0x53ef('0x3e')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x3f')]())[_0x53ef('0x1e')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x53ef('0x40')]())[_0x53ef('0x1e')](voiceCallReport[_0x53ef('0x41')]())[_0x53ef('0x1e')](realtime[_0x53ef('0x42')]())[_0x53ef('0x43')](function(_0x476d46){logger[_0x53ef('0x44')](_0x53ef('0x45'),util['inspect'](_0x476d46,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x53ef('0x1e')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x53ef('0x1e')](function(){report[_0x53ef('0x46')]();setInterval(initRealtime,0x1388);})[_0x53ef('0x43')](function(_0x38019d){logger[_0x53ef('0x44')](_0x53ef('0x47'),util['inspect'](_0x38019d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xc8ef=['getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','initCampaigns','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','error','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts'];(function(_0x4d774f,_0x5d50a5){var _0x426d5a=function(_0x4c080b){while(--_0x4c080b){_0x4d774f['push'](_0x4d774f['shift']());}};_0x426d5a(++_0x5d50a5);}(_0xc8ef,0xe0));var _0xfc8e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xc8ef[_0x49ca18];return _0x145d54;};'use strict';var util=require(_0xfc8e('0x0'));var moment=require(_0xfc8e('0x1'));var server=require(_0xfc8e('0x2'));var Realtime=require(_0xfc8e('0x3'));var Report=require(_0xfc8e('0x4'));var Acw=require(_0xfc8e('0x5'));var Trigger=require(_0xfc8e('0x6'));var Dialer=require(_0xfc8e('0x7'));var Preview=require(_0xfc8e('0x8'));var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xfc8e('0x9'));var trunk=require(_0xfc8e('0xa'));var trigger=require(_0xfc8e('0xb'));var template=require(_0xfc8e('0xc'));var cmHopperHistory=require(_0xfc8e('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xfc8e('0xe'));var faxAccount=require(_0xfc8e('0xf'));var zendesk=require(_0xfc8e('0x10'));var salesforce=require(_0xfc8e('0x11'));var sugarcrm=require(_0xfc8e('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xfc8e('0x13'));var zoho=require(_0xfc8e('0x14'));var vtiger=require(_0xfc8e('0x15'));var freshsales=require(_0xfc8e('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xfc8e('0x17'));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(_0xfc8e('0x18'))(_0xfc8e('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xfc8e('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xfc8e('0x1a')](_0xfc8e('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xfc8e('0x1c')]()[_0xfc8e('0x1d')](user[_0xfc8e('0x1e')]())[_0xfc8e('0x1d')](realtime['initAgents']())[_0xfc8e('0x1d')](user[_0xfc8e('0x1f')]())[_0xfc8e('0x1d')](realtime['initTelephones']())[_0xfc8e('0x1d')](trunk[_0xfc8e('0x20')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x21')]())['then'](voiceQueue[_0xfc8e('0x22')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x23')]())['then'](trigger['getTriggers']())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x24')]())[_0xfc8e('0x1d')](template[_0xfc8e('0x25')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x26')]())[_0xfc8e('0x1d')](zendesk[_0xfc8e('0x27')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x28')]())[_0xfc8e('0x1d')](salesforce[_0xfc8e('0x29')]())[_0xfc8e('0x1d')](realtime['initSalesforceAccounts']())[_0xfc8e('0x1d')](sugarcrm[_0xfc8e('0x2a')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x2b')]())[_0xfc8e('0x1d')](freshdesk[_0xfc8e('0x2c')]())[_0xfc8e('0x1d')](realtime['initFreshdeskAccounts']())[_0xfc8e('0x1d')](desk[_0xfc8e('0x2d')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x2e')]())['then'](zoho[_0xfc8e('0x2f')]())[_0xfc8e('0x1d')](realtime['initZohoAccounts']())[_0xfc8e('0x1d')](vtiger[_0xfc8e('0x30')]())[_0xfc8e('0x1d')](realtime['initVtigerAccounts']())[_0xfc8e('0x1d')](freshsales[_0xfc8e('0x31')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x32')]())['then'](servicenow[_0xfc8e('0x33')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x34')]())[_0xfc8e('0x1d')](dynamics365['getDynamics365Accounts']())[_0xfc8e('0x1d')](realtime['initDynamics365Accounts']())[_0xfc8e('0x1d')](campaign[_0xfc8e('0x35')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x36')]())[_0xfc8e('0x1d')](voiceExtension['getVoiceExtensions']())[_0xfc8e('0x1d')](realtime['initVoiceExtensions']())[_0xfc8e('0x1d')](faxAccount[_0xfc8e('0x37')]())[_0xfc8e('0x1d')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xfc8e('0x1d')](voiceQueueReport[_0xfc8e('0x38')]())[_0xfc8e('0x1d')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xfc8e('0x39')]())[_0xfc8e('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0xfc8e('0x1d')](cmHopperHistory[_0xfc8e('0x3a')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x3b')]())['then'](voiceCallReport[_0xfc8e('0x3c')]())[_0xfc8e('0x1d')](realtime[_0xfc8e('0x3d')]())[_0xfc8e('0x3e')](function(_0xcb1ba2){logger['error'](_0xfc8e('0x3f'),util[_0xfc8e('0x40')](_0xcb1ba2,{'showHidden':![],'depth':null}));});}function main(){return server[_0xfc8e('0x41')](realtime,preview,fax)[_0xfc8e('0x1d')](function(){return initRealtime();})[_0xfc8e('0x1d')](function(){return initParams();})[_0xfc8e('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xfc8e('0x3e')](function(_0x376050){logger[_0xfc8e('0x42')](_0xfc8e('0x43'),util[_0xfc8e('0x40')](_0x376050,{'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 6d7d529..c7bdbeb 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 _0xd46b=['ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','format','interface','onhold','stringify','user:%s','emit','omit','exports','lodash','util','moment','md5'];(function(_0x3ba527,_0x446a5e){var _0x5ee6ad=function(_0x5978c7){while(--_0x5978c7){_0x3ba527['push'](_0x3ba527['shift']());}};_0x5ee6ad(++_0x446a5e);}(_0xd46b,0x12c));var _0xbd46=function(_0x4a71f5,_0x401424){_0x4a71f5=_0x4a71f5-0x0;var _0x27162f=_0xd46b[_0x4a71f5];return _0x27162f;};'use strict';var _=require(_0xbd46('0x0'));var util=require(_0xbd46('0x1'));var moment=require(_0xbd46('0x2'));var md5=require(_0xbd46('0x3'));var Redis=require(_0xbd46('0x4'));var config=require('../../../config/environment');config[_0xbd46('0x5')]=_[_0xbd46('0x6')](config[_0xbd46('0x5')],{'host':_0xbd46('0x7'),'port':0x18eb});var io=require(_0xbd46('0x8'))(new Redis(config[_0xbd46('0x5')]));function Agent(_0x38edb4){this['id']=_0x38edb4['id']||0x0;this[_0xbd46('0x9')]=_0x38edb4[_0xbd46('0x9')]||'';this[_0xbd46('0xa')]=_0x38edb4[_0xbd46('0xa')]||'';this[_0xbd46('0xb')]=_0x38edb4[_0xbd46('0xb')]||'';this[_0xbd46('0xc')]=_0x38edb4[_0xbd46('0xc')]||'';this[_0xbd46('0xd')]='unknown';this[_0xbd46('0xe')]=0x0;this[_0xbd46('0xf')]='unknown';this[_0xbd46('0x10')]='';this['phone']='';this['mobile']='';this['interface']='';this[_0xbd46('0x11')]=_0x38edb4[_0xbd46('0x11')]||![];this[_0xbd46('0x12')]='unknown';this[_0xbd46('0x13')]=0x0;this[_0xbd46('0x14')]='';this[_0xbd46('0x15')]='';this['onhold']=![];this[_0xbd46('0x16')]=![];this[_0xbd46('0x3')]='';}Agent[_0xbd46('0x17')][_0xbd46('0x18')]=function(_0x5e0b66){var _0x20d128;if(_0x5e0b66&&_0x5e0b66[_0xbd46('0xd')]){_0x20d128=_0x5e0b66[_0xbd46('0xd')][_0xbd46('0x19')]();switch(_0x20d128){case _0xbd46('0x1a'):_0x20d128=_0xbd46('0x1b');break;case _0xbd46('0x1c'):_0x20d128=_0xbd46('0x1d');break;}}if(_0x20d128&&this[_0xbd46('0x12')]!==_0x20d128||_0x5e0b66['statePause']){this[_0xbd46('0x13')]=_['toNumber'](moment()[_0xbd46('0x1e')]('x'));}if(_0x20d128){this['voiceStatus']=_0x20d128;}var _0x69ebda={'id':this['id'],'name':this[_0xbd46('0x9')],'email':this[_0xbd46('0xa')],'accountcode':this['accountcode'],'fullname':this[_0xbd46('0xc')],'state':this[_0xbd46('0xd')],'stateTime':this['stateTime'],'status':this[_0xbd46('0xf')],'address':this[_0xbd46('0x10')],'online':this[_0xbd46('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xbd46('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xbd46('0x1f')],'onhold':this[_0xbd46('0x20')]};var _0x554fc5=md5(JSON[_0xbd46('0x21')](_0x69ebda));if(this[_0xbd46('0x3')]!==_0x554fc5){this[_0xbd46('0x3')]=_0x554fc5;io['to'](util[_0xbd46('0x1e')](_0xbd46('0x22'),_0x69ebda[_0xbd46('0x9')]))[_0xbd46('0x23')]('user:ami:update',_[_0xbd46('0x24')](_0x69ebda,[_0xbd46('0x11')]));io['emit']('user:presence',_0x69ebda);}};module[_0xbd46('0x25')]=Agent; \ No newline at end of file +var _0x7393=['toNumber','format','interface','stringify','user:%s','user:ami:update','omit','emit','lodash','util','moment','md5','ioredis','redis','socket.io-emitter','name','accountcode','fullname','state','unknown','stateTime','status','phone','mobile','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','idle','talking','statePause','voiceStatusTime'];(function(_0x3e9329,_0x192531){var _0x888a31=function(_0x2d93f8){while(--_0x2d93f8){_0x3e9329['push'](_0x3e9329['shift']());}};_0x888a31(++_0x192531);}(_0x7393,0x1dc));var _0x3739=function(_0xd2a15b,_0x5ce203){_0xd2a15b=_0xd2a15b-0x0;var _0xa366db=_0x7393[_0xd2a15b];return _0xa366db;};'use strict';var _=require(_0x3739('0x0'));var util=require(_0x3739('0x1'));var moment=require(_0x3739('0x2'));var md5=require(_0x3739('0x3'));var Redis=require(_0x3739('0x4'));var config=require('../../../config/environment');config[_0x3739('0x5')]=_['defaults'](config[_0x3739('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3739('0x6'))(new Redis(config[_0x3739('0x5')]));function Agent(_0x334f46){this['id']=_0x334f46['id']||0x0;this[_0x3739('0x7')]=_0x334f46[_0x3739('0x7')]||'';this['email']=_0x334f46['email']||'';this['accountcode']=_0x334f46[_0x3739('0x8')]||'';this['fullname']=_0x334f46[_0x3739('0x9')]||'';this[_0x3739('0xa')]=_0x3739('0xb');this[_0x3739('0xc')]=0x0;this[_0x3739('0xd')]=_0x3739('0xb');this['address']='';this[_0x3739('0xe')]='';this[_0x3739('0xf')]='';this['interface']='';this[_0x3739('0x10')]=_0x334f46[_0x3739('0x10')]||![];this[_0x3739('0x11')]=_0x3739('0xb');this['voiceStatusTime']=0x0;this[_0x3739('0x12')]='';this[_0x3739('0x13')]='';this[_0x3739('0x14')]=![];this['local']=![];this[_0x3739('0x3')]='';}Agent[_0x3739('0x15')][_0x3739('0x16')]=function(_0x67a2d5){var _0x510b58;if(_0x67a2d5&&_0x67a2d5[_0x3739('0xa')]){_0x510b58=_0x67a2d5[_0x3739('0xa')][_0x3739('0x17')]();switch(_0x510b58){case'not_inuse':_0x510b58=_0x3739('0x18');break;case'inuse':_0x510b58=_0x3739('0x19');break;}}if(_0x510b58&&this[_0x3739('0x11')]!==_0x510b58||_0x67a2d5[_0x3739('0x1a')]){this[_0x3739('0x1b')]=_[_0x3739('0x1c')](moment()[_0x3739('0x1d')]('x'));}if(_0x510b58){this[_0x3739('0x11')]=_0x510b58;}var _0x5a8613={'id':this['id'],'name':this[_0x3739('0x7')],'email':this['email'],'accountcode':this[_0x3739('0x8')],'fullname':this[_0x3739('0x9')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x3739('0xd')],'address':this['address'],'online':this[_0x3739('0x10')],'voiceStatus':this[_0x3739('0x11')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x3739('0x12')],'voiceStatusQueue':this[_0x3739('0x13')],'interface':this[_0x3739('0x1e')],'onhold':this[_0x3739('0x14')]};var _0x1931d5=md5(JSON[_0x3739('0x1f')](_0x5a8613));if(this[_0x3739('0x3')]!==_0x1931d5){this[_0x3739('0x3')]=_0x1931d5;io['to'](util[_0x3739('0x1d')](_0x3739('0x20'),_0x5a8613[_0x3739('0x7')]))['emit'](_0x3739('0x21'),_[_0x3739('0x22')](_0x5a8613,[_0x3739('0x10')]));io[_0x3739('0x23')]('user:presence',_0x5a8613);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 34d8589..bb2cde2 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 _0x7ac9=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7ac9,0x151));var _0x97ac=function(_0x308216,_0x55f80b){_0x308216=_0x308216-0x0;var _0xd7244a=_0x7ac9[_0x308216];return _0xd7244a;};'use strict';function Campaign(_0x16c13b){this['id']=_0x16c13b['id']||0x0;this[_0x97ac('0x0')]=_0x16c13b[_0x97ac('0x0')]||'';this[_0x97ac('0x1')]=_0x16c13b[_0x97ac('0x1')]||_0x97ac('0x2');this[_0x97ac('0x3')]=0x0;this[_0x97ac('0x4')]=0x0;this[_0x97ac('0x5')]=0x0;this[_0x97ac('0x6')]=0x0;this[_0x97ac('0x7')]='';this[_0x97ac('0x8')]=!![];this[_0x97ac('0x9')]=_0x16c13b[_0x97ac('0x9')];this[_0x97ac('0xa')]=_0x16c13b[_0x97ac('0xa')];this[_0x97ac('0xb')]=_0x16c13b[_0x97ac('0xb')]||null;this['dialGlobalInterval']=_0x16c13b[_0x97ac('0xc')]?_0x16c13b[_0x97ac('0xc')]:null;this['dialOriginateCallerIdName']=_0x16c13b[_0x97ac('0xd')];this[_0x97ac('0xe')]=_0x16c13b[_0x97ac('0xe')];this['dialOriginateTimeout']=_0x16c13b[_0x97ac('0xf')]||0x1e;this[_0x97ac('0x10')]=_0x16c13b['dialCongestionMaxRetry'];this[_0x97ac('0x11')]=_0x16c13b[_0x97ac('0x11')];this[_0x97ac('0x12')]=_0x16c13b[_0x97ac('0x12')];this[_0x97ac('0x13')]=_0x16c13b[_0x97ac('0x13')];this[_0x97ac('0x14')]=_0x16c13b['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x16c13b[_0x97ac('0x15')];this[_0x97ac('0x16')]=_0x16c13b[_0x97ac('0x16')];this[_0x97ac('0x17')]=_0x16c13b[_0x97ac('0x17')]||0x3;this[_0x97ac('0x18')]=_0x16c13b[_0x97ac('0x18')]||0x96;this[_0x97ac('0x19')]=_0x16c13b[_0x97ac('0x19')]||0x3;this['dialDropRetryFrequency']=_0x16c13b[_0x97ac('0x1a')]||0x96;this['dialAbandonedMaxRetry']=_0x16c13b[_0x97ac('0x1b')]||0x3;this[_0x97ac('0x1c')]=_0x16c13b[_0x97ac('0x1c')]||0x96;this[_0x97ac('0x1d')]=_0x16c13b['dialMachineMaxRetry']||0x3;this[_0x97ac('0x1e')]=_0x16c13b[_0x97ac('0x1e')]||0x96;this['dialAgentRejectMaxRetry']=_0x16c13b[_0x97ac('0x1f')]||0x3;this[_0x97ac('0x20')]=_0x16c13b[_0x97ac('0x20')]||0x96;this[_0x97ac('0x21')]=_0x16c13b[_0x97ac('0x21')]||'DESC';this[_0x97ac('0x22')]=_0x16c13b['dialPrefix']||undefined;this[_0x97ac('0x23')]=_0x16c13b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x97ac('0x24')]=_0x16c13b[_0x97ac('0x24')]||undefined;this[_0x97ac('0x25')]=_0x16c13b[_0x97ac('0x25')]?_0x16c13b[_0x97ac('0x25')]:undefined;this[_0x97ac('0x26')]=_0x16c13b['Trunk']?_0x16c13b[_0x97ac('0x26')]:undefined;this[_0x97ac('0x27')]=_0x16c13b[_0x97ac('0x27')]?_0x16c13b[_0x97ac('0x27')]:undefined;this[_0x97ac('0x28')]=_0x16c13b[_0x97ac('0x28')]?_0x16c13b[_0x97ac('0x28')]:undefined;this[_0x97ac('0x29')]=_0x16c13b[_0x97ac('0x28')]?_0x16c13b[_0x97ac('0x28')][_0x97ac('0x0')]:undefined;this[_0x97ac('0x2a')]=_0x16c13b[_0x97ac('0x2a')]||![];this[_0x97ac('0x2b')]=_0x16c13b[_0x97ac('0x2b')];this['dialAMDGreeting']=_0x16c13b[_0x97ac('0x2c')];this[_0x97ac('0x2d')]=_0x16c13b['dialAMDAfterGreetingSilence'];this[_0x97ac('0x2e')]=_0x16c13b[_0x97ac('0x2e')];this[_0x97ac('0x2f')]=_0x16c13b[_0x97ac('0x2f')];this[_0x97ac('0x30')]=_0x16c13b[_0x97ac('0x30')];this['dialAMDMaximumNumberOfWords']=_0x16c13b[_0x97ac('0x31')];this[_0x97ac('0x32')]=_0x16c13b[_0x97ac('0x32')];this[_0x97ac('0x33')]=_0x16c13b[_0x97ac('0x33')];}module['exports']=Campaign; \ No newline at end of file +var _0xd4fe=['exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x228a4a,_0x23d65e){var _0x3d3937=function(_0x3e9511){while(--_0x3e9511){_0x228a4a['push'](_0x228a4a['shift']());}};_0x3d3937(++_0x23d65e);}(_0xd4fe,0xc1));var _0xed4f=function(_0x7906b1,_0x593ad4){_0x7906b1=_0x7906b1-0x0;var _0x504067=_0xd4fe[_0x7906b1];return _0x504067;};'use strict';function Campaign(_0x4ac466){this['id']=_0x4ac466['id']||0x0;this[_0xed4f('0x0')]=_0x4ac466['name']||'';this[_0xed4f('0x1')]=_0x4ac466[_0xed4f('0x1')]||_0xed4f('0x2');this['originated']=0x0;this[_0xed4f('0x3')]=0x0;this[_0xed4f('0x4')]=0x0;this[_0xed4f('0x5')]=0x0;this['message']='';this[_0xed4f('0x6')]=!![];this[_0xed4f('0x7')]=_0x4ac466['active'];this[_0xed4f('0x8')]=_0x4ac466[_0xed4f('0x8')];this[_0xed4f('0x9')]=_0x4ac466[_0xed4f('0x9')]||null;this[_0xed4f('0xa')]=_0x4ac466[_0xed4f('0xa')]?_0x4ac466['dialGlobalInterval']:null;this[_0xed4f('0xb')]=_0x4ac466[_0xed4f('0xb')];this['dialOriginateCallerIdNumber']=_0x4ac466[_0xed4f('0xc')];this[_0xed4f('0xd')]=_0x4ac466[_0xed4f('0xd')]||0x1e;this[_0xed4f('0xe')]=_0x4ac466['dialCongestionMaxRetry'];this[_0xed4f('0xf')]=_0x4ac466['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x4ac466[_0xed4f('0x10')];this['dialBusyRetryFrequency']=_0x4ac466[_0xed4f('0x11')];this[_0xed4f('0x12')]=_0x4ac466[_0xed4f('0x12')];this['dialNoAnswerRetryFrequency']=_0x4ac466['dialNoAnswerRetryFrequency'];this[_0xed4f('0x13')]=_0x4ac466[_0xed4f('0x13')];this[_0xed4f('0x14')]=_0x4ac466[_0xed4f('0x14')]||0x3;this[_0xed4f('0x15')]=_0x4ac466[_0xed4f('0x15')]||0x96;this[_0xed4f('0x16')]=_0x4ac466[_0xed4f('0x16')]||0x3;this[_0xed4f('0x17')]=_0x4ac466[_0xed4f('0x17')]||0x96;this[_0xed4f('0x18')]=_0x4ac466[_0xed4f('0x18')]||0x3;this[_0xed4f('0x19')]=_0x4ac466[_0xed4f('0x19')]||0x96;this[_0xed4f('0x1a')]=_0x4ac466[_0xed4f('0x1a')]||0x3;this[_0xed4f('0x1b')]=_0x4ac466[_0xed4f('0x1b')]||0x96;this[_0xed4f('0x1c')]=_0x4ac466[_0xed4f('0x1c')]||0x3;this[_0xed4f('0x1d')]=_0x4ac466[_0xed4f('0x1d')]||0x96;this[_0xed4f('0x1e')]=_0x4ac466['dialOrderByScheduledAt']||'DESC';this[_0xed4f('0x1f')]=_0x4ac466['dialPrefix']||undefined;this[_0xed4f('0x20')]=_0x4ac466[_0xed4f('0x20')]||undefined;this[_0xed4f('0x21')]=_0x4ac466[_0xed4f('0x21')]||undefined;this['TrunkBackup']=_0x4ac466[_0xed4f('0x22')]?_0x4ac466['TrunkBackup']:undefined;this[_0xed4f('0x23')]=_0x4ac466[_0xed4f('0x23')]?_0x4ac466[_0xed4f('0x23')]:undefined;this[_0xed4f('0x24')]=_0x4ac466[_0xed4f('0x24')]?_0x4ac466['Interval']:undefined;this[_0xed4f('0x25')]=_0x4ac466[_0xed4f('0x25')]?_0x4ac466[_0xed4f('0x25')]:undefined;this['dialQueueProject']=_0x4ac466[_0xed4f('0x25')]?_0x4ac466['SquareProject']['name']:undefined;this[_0xed4f('0x26')]=_0x4ac466[_0xed4f('0x26')]||![];this['dialAMDInitialSilence']=_0x4ac466[_0xed4f('0x27')];this[_0xed4f('0x28')]=_0x4ac466['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x4ac466[_0xed4f('0x29')];this[_0xed4f('0x2a')]=_0x4ac466[_0xed4f('0x2a')];this['dialAMDMinWordLength']=_0x4ac466['dialAMDMinWordLength'];this[_0xed4f('0x2b')]=_0x4ac466['dialAMDBetweenWordsSilence'];this[_0xed4f('0x2c')]=_0x4ac466[_0xed4f('0x2c')];this[_0xed4f('0x2d')]=_0x4ac466[_0xed4f('0x2d')];this[_0xed4f('0x2e')]=_0x4ac466[_0xed4f('0x2e')];}module[_0xed4f('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 95c94f1..c1366e2 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 _0x7a12=['disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','duration','billableseconds','type','tag'];(function(_0x47015f,_0x4f4c81){var _0x1ef447=function(_0x3b9375){while(--_0x3b9375){_0x47015f['push'](_0x47015f['shift']());}};_0x1ef447(++_0x4f4c81);}(_0x7a12,0xe8));var _0x27a1=function(_0x39fa1b,_0x8c0e3f){_0x39fa1b=_0x39fa1b-0x0;var _0x2c0f69=_0x7a12[_0x39fa1b];return _0x2c0f69;};'use strict';function Channel(){this[_0x27a1('0x0')]=null;this[_0x27a1('0x1')]='';this[_0x27a1('0x2')]='';this[_0x27a1('0x3')]=0x0;this[_0x27a1('0x4')]='';this[_0x27a1('0x5')]=undefined;this[_0x27a1('0x6')]=undefined;this[_0x27a1('0x7')]=0x0;this['context']='';this[_0x27a1('0x8')]=0x0;this[_0x27a1('0x9')]=0x0;this[_0x27a1('0xa')]=0x0;this[_0x27a1('0xb')]=![];this[_0x27a1('0xc')]=null;this[_0x27a1('0xd')]=null;this['unmanaged']=![];this[_0x27a1('0xe')]=![];this[_0x27a1('0xf')]='';this['lastdata']='';this[_0x27a1('0x10')]=0x0;this[_0x27a1('0x11')]=0x0;this['holdtime']=0x0;this[_0x27a1('0x12')]=null;this[_0x27a1('0x13')]=null;this[_0x27a1('0x14')]=null;this['monitor']=![];this[_0x27a1('0x15')]=null;this[_0x27a1('0x16')]=null;this[_0x27a1('0x17')]=[];this[_0x27a1('0x18')]=undefined;this[_0x27a1('0x19')]=undefined;this[_0x27a1('0x1a')]=undefined;this[_0x27a1('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x0c07=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','abandoned','lastapplication','lastdata','duration','holdtime','tag','monitor','queue','monitors','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname'];(function(_0x392ea3,_0x3132af){var _0x355e30=function(_0x46100f){while(--_0x46100f){_0x392ea3['push'](_0x392ea3['shift']());}};_0x355e30(++_0x3132af);}(_0x0c07,0x8b));var _0x70c0=function(_0x3ba2a0,_0x5453a5){_0x3ba2a0=_0x3ba2a0-0x0;var _0x575d6c=_0x0c07[_0x3ba2a0];return _0x575d6c;};'use strict';function Channel(){this[_0x70c0('0x0')]=null;this[_0x70c0('0x1')]='';this[_0x70c0('0x2')]='';this[_0x70c0('0x3')]=0x0;this[_0x70c0('0x4')]='';this[_0x70c0('0x5')]=undefined;this[_0x70c0('0x6')]=undefined;this[_0x70c0('0x7')]=0x0;this[_0x70c0('0x8')]='';this[_0x70c0('0x9')]=0x0;this[_0x70c0('0xa')]=0x0;this[_0x70c0('0xb')]=0x0;this['answered']=![];this[_0x70c0('0xc')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x70c0('0xd')]=![];this[_0x70c0('0xe')]='';this[_0x70c0('0xf')]='';this[_0x70c0('0x10')]=0x0;this['billableseconds']=0x0;this[_0x70c0('0x11')]=0x0;this['type']=null;this[_0x70c0('0x12')]=null;this['disposition']=null;this[_0x70c0('0x13')]=![];this['monitorFilename']=null;this[_0x70c0('0x14')]=null;this[_0x70c0('0x15')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this[_0x70c0('0x16')]=0x0;}module[_0x70c0('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 2d7a114..daa191e 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 _0x2264=['consumerSecret','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2264,0x1ce));var _0x4226=function(_0x9646f,_0x3ee827){_0x9646f=_0x9646f-0x0;var _0x2863f2=_0x2264[_0x9646f];return _0x2863f2;};'use strict';function DeskAccount(_0x1c4514){this['id']=_0x1c4514['id']||0x0;this[_0x4226('0x0')]=_0x1c4514[_0x4226('0x0')]||'';this['username']=_0x1c4514[_0x4226('0x1')]||'';this[_0x4226('0x2')]=_0x1c4514[_0x4226('0x2')]||'';this[_0x4226('0x3')]=_0x1c4514['authType']||'';this[_0x4226('0x4')]=_0x1c4514['password']||'';this[_0x4226('0x5')]=_0x1c4514[_0x4226('0x5')]||'';this[_0x4226('0x6')]=_0x1c4514[_0x4226('0x6')]||'';this['token']=_0x1c4514['token']||'';this[_0x4226('0x7')]=_0x1c4514['tokenSecret']||'';this[_0x4226('0x8')]=_0x1c4514[_0x4226('0x8')]||'';this[_0x4226('0x9')]=_0x1c4514[_0x4226('0x9')]||'';this[_0x4226('0xa')]=_0x1c4514[_0x4226('0xa')]||{};}module[_0x4226('0xb')]=DeskAccount; \ No newline at end of file +var _0x764c=['consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name','remoteUri','authType','password'];(function(_0x47d18a,_0xd53074){var _0x130c43=function(_0x380f11){while(--_0x380f11){_0x47d18a['push'](_0x47d18a['shift']());}};_0x130c43(++_0xd53074);}(_0x764c,0xee));var _0xc764=function(_0x58785c,_0x1894df){_0x58785c=_0x58785c-0x0;var _0x4da8c7=_0x764c[_0x58785c];return _0x4da8c7;};'use strict';function DeskAccount(_0x21928c){this['id']=_0x21928c['id']||0x0;this['name']=_0x21928c[_0xc764('0x0')]||'';this['username']=_0x21928c['username']||'';this['remoteUri']=_0x21928c[_0xc764('0x1')]||'';this[_0xc764('0x2')]=_0x21928c['authType']||'';this['password']=_0x21928c[_0xc764('0x3')]||'';this[_0xc764('0x4')]=_0x21928c[_0xc764('0x4')]||'';this[_0xc764('0x5')]=_0x21928c[_0xc764('0x5')]||'';this[_0xc764('0x6')]=_0x21928c['token']||'';this['tokenSecret']=_0x21928c[_0xc764('0x7')]||'';this['type']=_0x21928c['type']||'';this[_0xc764('0x8')]=_0x21928c[_0xc764('0x8')]||'';this[_0xc764('0x9')]=_0x21928c[_0xc764('0x9')]||{};}module[_0xc764('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index b2c71c3..2b893f2 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 _0x30ea=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x30ea,0x152));var _0xa30e=function(_0x23a825,_0x3718d6){_0x23a825=_0x23a825-0x0;var _0x5d4088=_0x30ea[_0x23a825];return _0x5d4088;};'use strict';function Dynamics365Account(_0x11a5bc){this['id']=_0x11a5bc['id']||0x0;this['name']=_0x11a5bc[_0xa30e('0x0')]||'';this['username']=_0x11a5bc[_0xa30e('0x1')]||'';this[_0xa30e('0x2')]=_0x11a5bc[_0xa30e('0x2')]||'';this[_0xa30e('0x3')]=_0x11a5bc[_0xa30e('0x3')]||'';this['tenantId']=_0x11a5bc[_0xa30e('0x4')]||'';this[_0xa30e('0x5')]=_0x11a5bc[_0xa30e('0x5')]||'';this[_0xa30e('0x6')]=_0x11a5bc[_0xa30e('0x6')]||{};this[_0xa30e('0x7')]=_0x11a5bc['serverUrl']||'';this[_0xa30e('0x8')]=_0x11a5bc[_0xa30e('0x8')]||![];this[_0xa30e('0x9')]=_0x11a5bc[_0xa30e('0x9')]||{};this[_0xa30e('0xa')]=_0x11a5bc[_0xa30e('0xa')]||{};}module[_0xa30e('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x1224=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x1224,0x10e));var _0x4122=function(_0x23bf7f,_0x578f6c){_0x23bf7f=_0x23bf7f-0x0;var _0x64b00e=_0x1224[_0x23bf7f];return _0x64b00e;};'use strict';function Dynamics365Account(_0x907347){this['id']=_0x907347['id']||0x0;this[_0x4122('0x0')]=_0x907347[_0x4122('0x0')]||'';this[_0x4122('0x1')]=_0x907347['username']||'';this[_0x4122('0x2')]=_0x907347[_0x4122('0x2')]||'';this['remoteUri']=_0x907347[_0x4122('0x3')]||'';this[_0x4122('0x4')]=_0x907347[_0x4122('0x4')]||'';this[_0x4122('0x5')]=_0x907347['clientId']||'';this['clientSecret']=_0x907347[_0x4122('0x6')]||{};this[_0x4122('0x7')]=_0x907347[_0x4122('0x7')]||'';this[_0x4122('0x8')]=_0x907347[_0x4122('0x8')]||![];this['Configurations']=_0x907347[_0x4122('0x9')]||{};this[_0x4122('0xa')]=_0x907347[_0x4122('0xa')]||{};}module[_0x4122('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f51c38b..29e5c6f 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 _0x6fb9=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x1a077a,_0xe2bb6b){var _0x2d6e4c=function(_0x1a95db){while(--_0x1a95db){_0x1a077a['push'](_0x1a077a['shift']());}};_0x2d6e4c(++_0xe2bb6b);}(_0x6fb9,0x84));var _0x96fb=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x6fb9[_0x35d3a8];return _0x182378;};'use strict';function FaxAccount(_0x22b7a7){this['id']=_0x22b7a7['id']||0x0;this[_0x96fb('0x0')]=_0x22b7a7['name']||'';this[_0x96fb('0x1')]=_0x22b7a7['description'];this['ecm']=_0x22b7a7[_0x96fb('0x2')];this[_0x96fb('0x3')]=_0x22b7a7['headerinfo'];this[_0x96fb('0x4')]=_0x22b7a7[_0x96fb('0x4')];this[_0x96fb('0x5')]=_0x22b7a7[_0x96fb('0x5')]||0x960;this['maxrate']=_0x22b7a7[_0x96fb('0x6')]||0x3840;this[_0x96fb('0x7')]=_0x22b7a7['modem']||_0x96fb('0x8');this[_0x96fb('0x9')]=_0x22b7a7[_0x96fb('0x9')]||'no';this[_0x96fb('0xa')]=_0x22b7a7[_0x96fb('0xa')]||'no';this[_0x96fb('0xb')]=_0x22b7a7[_0x96fb('0xb')]||0x1388;this[_0x96fb('0xc')]=_0x22b7a7[_0x96fb('0xc')]||'SIP';this['Trunk']=_0x22b7a7[_0x96fb('0xd')]?_0x22b7a7[_0x96fb('0xd')]:undefined;this[_0x96fb('0xe')]=_0x22b7a7[_0x96fb('0xe')];this['key']=_0x22b7a7[_0x96fb('0xf')];}module[_0x96fb('0x10')]=FaxAccount; \ No newline at end of file +var _0xc715=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc715,0x1a5));var _0x5c71=function(_0x3f1861,_0x7b4285){_0x3f1861=_0x3f1861-0x0;var _0x7ca70a=_0xc715[_0x3f1861];return _0x7ca70a;};'use strict';function FaxAccount(_0x440ec1){this['id']=_0x440ec1['id']||0x0;this[_0x5c71('0x0')]=_0x440ec1['name']||'';this[_0x5c71('0x1')]=_0x440ec1['description'];this[_0x5c71('0x2')]=_0x440ec1[_0x5c71('0x2')];this[_0x5c71('0x3')]=_0x440ec1[_0x5c71('0x3')];this['localstationid']=_0x440ec1[_0x5c71('0x4')];this[_0x5c71('0x5')]=_0x440ec1[_0x5c71('0x5')]||0x960;this[_0x5c71('0x6')]=_0x440ec1[_0x5c71('0x6')]||0x3840;this[_0x5c71('0x7')]=_0x440ec1[_0x5c71('0x7')]||_0x5c71('0x8');this[_0x5c71('0x9')]=_0x440ec1[_0x5c71('0x9')]||'no';this[_0x5c71('0xa')]=_0x440ec1['faxdetect']||'no';this[_0x5c71('0xb')]=_0x440ec1[_0x5c71('0xb')]||0x1388;this['tech']=_0x440ec1['tech']||_0x5c71('0xc');this[_0x5c71('0xd')]=_0x440ec1['Trunk']?_0x440ec1[_0x5c71('0xd')]:undefined;this[_0x5c71('0xe')]=_0x440ec1[_0x5c71('0xe')];this[_0x5c71('0xf')]=_0x440ec1[_0x5c71('0xf')];}module[_0x5c71('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 3e9ceb6..a6b85bb 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 _0xe1b8=['serverUrl','Configurations','name','username','token','remoteUri'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0xe1b8,0xaa));var _0x8e1b=function(_0x505a2b,_0x264f14){_0x505a2b=_0x505a2b-0x0;var _0x1835e4=_0xe1b8[_0x505a2b];return _0x1835e4;};'use strict';function FreshdeskAccount(_0x17ca9b){this['id']=_0x17ca9b['id']||0x0;this[_0x8e1b('0x0')]=_0x17ca9b[_0x8e1b('0x0')]||'';this['username']=_0x17ca9b[_0x8e1b('0x1')]||'';this['apiKey']=_0x17ca9b[_0x8e1b('0x2')]||'';this[_0x8e1b('0x3')]=_0x17ca9b[_0x8e1b('0x3')]||'';this[_0x8e1b('0x4')]=_0x17ca9b[_0x8e1b('0x4')]||'';this[_0x8e1b('0x5')]=_0x17ca9b[_0x8e1b('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x13c4=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x5340fb,_0x53d5a2){var _0x35701e=function(_0x47ce2f){while(--_0x47ce2f){_0x5340fb['push'](_0x5340fb['shift']());}};_0x35701e(++_0x53d5a2);}(_0x13c4,0xc3));var _0x413c=function(_0x49f845,_0xc86219){_0x49f845=_0x49f845-0x0;var _0x150476=_0x13c4[_0x49f845];return _0x150476;};'use strict';function FreshdeskAccount(_0x407a9e){this['id']=_0x407a9e['id']||0x0;this[_0x413c('0x0')]=_0x407a9e[_0x413c('0x0')]||'';this[_0x413c('0x1')]=_0x407a9e[_0x413c('0x1')]||'';this[_0x413c('0x2')]=_0x407a9e[_0x413c('0x3')]||'';this[_0x413c('0x4')]=_0x407a9e['remoteUri']||'';this[_0x413c('0x5')]=_0x407a9e[_0x413c('0x5')]||'';this[_0x413c('0x6')]=_0x407a9e[_0x413c('0x6')]||{};}module[_0x413c('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 96093c7..fcdfe66 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 _0x2caf=['exports','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x122c39,_0x3b3c02){var _0x45ad86=function(_0x5cdb68){while(--_0x5cdb68){_0x122c39['push'](_0x122c39['shift']());}};_0x45ad86(++_0x3b3c02);}(_0x2caf,0x6a));var _0xf2ca=function(_0x142f1a,_0x22d051){_0x142f1a=_0x142f1a-0x0;var _0x54b553=_0x2caf[_0x142f1a];return _0x54b553;};'use strict';function FreshsalesAccount(_0x382b2c){this['id']=_0x382b2c['id']||0x0;this['name']=_0x382b2c['name']||'';this[_0xf2ca('0x0')]=_0x382b2c['username']||'';this[_0xf2ca('0x1')]=_0x382b2c[_0xf2ca('0x2')]||'';this[_0xf2ca('0x3')]=_0x382b2c[_0xf2ca('0x3')]||'';this[_0xf2ca('0x4')]=_0x382b2c[_0xf2ca('0x4')]||'';this[_0xf2ca('0x5')]=_0x382b2c['Configurations']||{};}module[_0xf2ca('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xb76d=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xb76d,0x119));var _0xdb76=function(_0x169b17,_0x16ad7d){_0x169b17=_0x169b17-0x0;var _0x5d41a3=_0xb76d[_0x169b17];return _0x5d41a3;};'use strict';function FreshsalesAccount(_0x249a57){this['id']=_0x249a57['id']||0x0;this['name']=_0x249a57[_0xdb76('0x0')]||'';this[_0xdb76('0x1')]=_0x249a57[_0xdb76('0x1')]||'';this['apiKey']=_0x249a57[_0xdb76('0x2')]||'';this[_0xdb76('0x3')]=_0x249a57[_0xdb76('0x3')]||'';this[_0xdb76('0x4')]=_0x249a57[_0xdb76('0x4')]||'';this[_0xdb76('0x5')]=_0x249a57['Configurations']||{};}module[_0xdb76('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 4b70e40..70bab38 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 _0x03e4=['inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','exports','type'];(function(_0x5a6d8f,_0xf4c16b){var _0x351cf0=function(_0x4d8890){while(--_0x4d8890){_0x5a6d8f['push'](_0x5a6d8f['shift']());}};_0x351cf0(++_0xf4c16b);}(_0x03e4,0x1ec));var _0x403e=function(_0x4fd75e,_0x219e4a){_0x4fd75e=_0x4fd75e-0x0;var _0x5b6338=_0x03e4[_0x4fd75e];return _0x5b6338;};'use strict';function QueueReport(){this[_0x403e('0x0')]=_0x403e('0x1');this[_0x403e('0x2')]='';this[_0x403e('0x3')]='';this[_0x403e('0x4')]='';this[_0x403e('0x5')]='';this[_0x403e('0x6')]=null;this[_0x403e('0x7')]=null;this[_0x403e('0x8')]=0x1;this[_0x403e('0x9')]=0x1;this[_0x403e('0xa')]=![];this['queuecallerabandonAt']=null;this[_0x403e('0xb')]=![];this[_0x403e('0xc')]=null;this[_0x403e('0xd')]=![];this[_0x403e('0xe')]=null;this['originalposition']=0x1;this[_0x403e('0xf')]='';this[_0x403e('0x10')]='';this[_0x403e('0x11')]='';this[_0x403e('0x12')]='';this[_0x403e('0x13')]='';this[_0x403e('0x14')]='';this[_0x403e('0x15')]='';this[_0x403e('0x16')]=0x0;this[_0x403e('0x17')]=![];this[_0x403e('0x18')]='';this[_0x403e('0x19')]=_0x403e('0x1a');this['routealias']=null;this[_0x403e('0x1b')]=0x0;this['variables']={};}module[_0x403e('0x1c')]=QueueReport; \ No newline at end of file +var _0x7b91=['queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','exten','priority','assigned','motionChannel','voice','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x7b91,0xb4));var _0x17b9=function(_0x177a7b,_0x5451a9){_0x177a7b=_0x177a7b-0x0;var _0x29164b=_0x7b91[_0x177a7b];return _0x29164b;};'use strict';function QueueReport(){this[_0x17b9('0x0')]=_0x17b9('0x1');this[_0x17b9('0x2')]='';this[_0x17b9('0x3')]='';this[_0x17b9('0x4')]='';this[_0x17b9('0x5')]='';this['queuecallerjoinAt']=null;this[_0x17b9('0x6')]=null;this['position']=0x1;this['count']=0x1;this[_0x17b9('0x7')]=![];this[_0x17b9('0x8')]=null;this[_0x17b9('0x9')]=![];this[_0x17b9('0xa')]=null;this[_0x17b9('0xb')]=![];this[_0x17b9('0xc')]=null;this[_0x17b9('0xd')]=0x1;this[_0x17b9('0xe')]='';this[_0x17b9('0xf')]='';this[_0x17b9('0x10')]='';this['accountcode']='';this['context']='';this[_0x17b9('0x11')]='';this[_0x17b9('0x12')]='';this['holdtime']=0x0;this[_0x17b9('0x13')]=![];this['lastAssignedTo']='';this[_0x17b9('0x14')]=_0x17b9('0x15');this['routealias']=null;this['mohtime']=0x0;this[_0x17b9('0x16')]={};}module[_0x17b9('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index aed1261..40787c1 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 _0xcd3e=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x3d001f,_0x31546a){var _0xf294f8=function(_0x58eab){while(--_0x58eab){_0x3d001f['push'](_0x3d001f['shift']());}};_0xf294f8(++_0x31546a);}(_0xcd3e,0x132));var _0xecd3=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xcd3e[_0x593564];return _0x211a89;};'use strict';function SalesforceAccount(_0x45bb4e){this['id']=_0x45bb4e['id']||0x0;this[_0xecd3('0x0')]=_0x45bb4e[_0xecd3('0x0')]||'';this[_0xecd3('0x1')]=_0x45bb4e[_0xecd3('0x1')]||'';this['remoteUri']=_0x45bb4e['remoteUri']||'';this[_0xecd3('0x2')]=_0x45bb4e[_0xecd3('0x2')]||'';this[_0xecd3('0x3')]=_0x45bb4e[_0xecd3('0x3')]||'';this[_0xecd3('0x4')]=_0x45bb4e[_0xecd3('0x4')]||'';this[_0xecd3('0x5')]=_0x45bb4e['securityToken']||'';this[_0xecd3('0x6')]=_0x45bb4e[_0xecd3('0x6')]||_0xecd3('0x7');this[_0xecd3('0x8')]=_0x45bb4e['serverUrl']||'';this[_0xecd3('0x9')]=_0x45bb4e[_0xecd3('0x9')]||{};}module[_0xecd3('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xc12c=['name','username','remoteUri','password','clientSecret','securityToken','type','serverUrl','Configurations','exports'];(function(_0x4dd812,_0x449259){var _0x36a9f5=function(_0x134327){while(--_0x134327){_0x4dd812['push'](_0x4dd812['shift']());}};_0x36a9f5(++_0x449259);}(_0xc12c,0x1ae));var _0xcc12=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc12c[_0x56482c];return _0x5aae7a;};'use strict';function SalesforceAccount(_0x4750e4){this['id']=_0x4750e4['id']||0x0;this[_0xcc12('0x0')]=_0x4750e4['name']||'';this[_0xcc12('0x1')]=_0x4750e4[_0xcc12('0x1')]||'';this['remoteUri']=_0x4750e4[_0xcc12('0x2')]||'';this[_0xcc12('0x3')]=_0x4750e4['password']||'';this['clientId']=_0x4750e4['clientId']||'';this[_0xcc12('0x4')]=_0x4750e4['clientSecret']||'';this[_0xcc12('0x5')]=_0x4750e4[_0xcc12('0x5')]||'';this[_0xcc12('0x6')]=_0x4750e4[_0xcc12('0x6')]||'integrationTab';this[_0xcc12('0x7')]=_0x4750e4[_0xcc12('0x7')]||'';this[_0xcc12('0x8')]=_0x4750e4[_0xcc12('0x8')]||{};}module[_0xcc12('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index fd29cdc..b85e451 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 _0x0590=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x5659f4,_0x3a072a){var _0x18e9a5=function(_0x4816e1){while(--_0x4816e1){_0x5659f4['push'](_0x5659f4['shift']());}};_0x18e9a5(++_0x3a072a);}(_0x0590,0x10d));var _0x0059=function(_0x1537c0,_0x22c923){_0x1537c0=_0x1537c0-0x0;var _0x12e6b1=_0x0590[_0x1537c0];return _0x12e6b1;};'use strict';function ServicenowAccount(_0x131834){this['id']=_0x131834['id']||0x0;this[_0x0059('0x0')]=_0x131834['name']||'';this[_0x0059('0x1')]=_0x131834[_0x0059('0x1')]||'';this[_0x0059('0x2')]=_0x131834[_0x0059('0x2')]||'';this[_0x0059('0x3')]=_0x131834[_0x0059('0x3')]||'';this[_0x0059('0x4')]=_0x131834['serverUrl']||'';this[_0x0059('0x5')]=_0x131834[_0x0059('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xb4b1=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x541075,_0x528408){var _0x5c7863=function(_0x358120){while(--_0x358120){_0x541075['push'](_0x541075['shift']());}};_0x5c7863(++_0x528408);}(_0xb4b1,0xc8));var _0x1b4b=function(_0x34d60c,_0x5d4bcb){_0x34d60c=_0x34d60c-0x0;var _0x1f07b2=_0xb4b1[_0x34d60c];return _0x1f07b2;};'use strict';function ServicenowAccount(_0x2daf25){this['id']=_0x2daf25['id']||0x0;this[_0x1b4b('0x0')]=_0x2daf25['name']||'';this[_0x1b4b('0x1')]=_0x2daf25[_0x1b4b('0x1')]||'';this[_0x1b4b('0x2')]=_0x2daf25[_0x1b4b('0x2')]||'';this[_0x1b4b('0x3')]=_0x2daf25[_0x1b4b('0x3')]||'';this[_0x1b4b('0x4')]=_0x2daf25[_0x1b4b('0x4')]||'';this['Configurations']=_0x2daf25[_0x1b4b('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 222e453..b055e98 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 _0xc966=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2d0783,_0xddce4b){var _0x21fda6=function(_0x271317){while(--_0x271317){_0x2d0783['push'](_0x2d0783['shift']());}};_0x21fda6(++_0xddce4b);}(_0xc966,0x187));var _0x6c96=function(_0x5752af,_0x3a3bff){_0x5752af=_0x5752af-0x0;var _0x116ad4=_0xc966[_0x5752af];return _0x116ad4;};'use strict';function SugarcrmAccount(_0x199d0a){this['id']=_0x199d0a['id']||0x0;this[_0x6c96('0x0')]=_0x199d0a['name']||'';this['username']=_0x199d0a[_0x6c96('0x1')]||'';this['password']=_0x199d0a[_0x6c96('0x2')]||'';this[_0x6c96('0x3')]=_0x199d0a[_0x6c96('0x3')]||'';this[_0x6c96('0x4')]=_0x199d0a['serverUrl']||'';this[_0x6c96('0x5')]=_0x199d0a[_0x6c96('0x5')]||{};}module[_0x6c96('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x9d95=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x527330,_0x29b618){var _0x573c92=function(_0x61f40e){while(--_0x61f40e){_0x527330['push'](_0x527330['shift']());}};_0x573c92(++_0x29b618);}(_0x9d95,0xbb));var _0x59d9=function(_0x129ed5,_0x4c5b10){_0x129ed5=_0x129ed5-0x0;var _0x46443c=_0x9d95[_0x129ed5];return _0x46443c;};'use strict';function SugarcrmAccount(_0x1f6b71){this['id']=_0x1f6b71['id']||0x0;this[_0x59d9('0x0')]=_0x1f6b71['name']||'';this[_0x59d9('0x1')]=_0x1f6b71['username']||'';this[_0x59d9('0x2')]=_0x1f6b71[_0x59d9('0x2')]||'';this[_0x59d9('0x3')]=_0x1f6b71[_0x59d9('0x3')]||'';this['serverUrl']=_0x1f6b71[_0x59d9('0x4')]||'';this[_0x59d9('0x5')]=_0x1f6b71['Configurations']||{};}module[_0x59d9('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index eca07f7..1b75bf4 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 _0x2fee=['name','accountcode','unknown','stateTime','address','exports'];(function(_0x2a9299,_0x31e726){var _0xa023c7=function(_0x14bdc6){while(--_0x14bdc6){_0x2a9299['push'](_0x2a9299['shift']());}};_0xa023c7(++_0x31e726);}(_0x2fee,0x11a));var _0xe2fe=function(_0x3e5b7b,_0x1ca279){_0x3e5b7b=_0x3e5b7b-0x0;var _0x441af8=_0x2fee[_0x3e5b7b];return _0x441af8;};'use strict';function Telephone(_0x57774a){this['id']=_0x57774a['id']||0x0;this['name']=_0x57774a[_0xe2fe('0x0')]||'';this['accountcode']=_0x57774a[_0xe2fe('0x1')]||'';this['state']=_0xe2fe('0x2');this[_0xe2fe('0x3')]=0x0;this['status']=_0xe2fe('0x2');this[_0xe2fe('0x4')]='';}module[_0xe2fe('0x5')]=Telephone; \ No newline at end of file +var _0x3145=['stateTime','status','address','name','accountcode','state','unknown'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0x3145,0xc7));var _0x5314=function(_0x452d96,_0xff6a56){_0x452d96=_0x452d96-0x0;var _0x444d61=_0x3145[_0x452d96];return _0x444d61;};'use strict';function Telephone(_0x212f41){this['id']=_0x212f41['id']||0x0;this[_0x5314('0x0')]=_0x212f41[_0x5314('0x0')]||'';this[_0x5314('0x1')]=_0x212f41[_0x5314('0x1')]||'';this[_0x5314('0x2')]=_0x5314('0x3');this[_0x5314('0x4')]=0x0;this[_0x5314('0x5')]='unknown';this[_0x5314('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 700e0fb..40ad323 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(_0x462620,_0x362b93){var _0x2469ae=function(_0x237745){while(--_0x237745){_0x462620['push'](_0x462620['shift']());}};_0x2469ae(++_0x362b93);}(_0xb10b,0x12a));var _0xbb10=function(_0x368a3e,_0x47b292){_0x368a3e=_0x368a3e-0x0;var _0x3cb213=_0xb10b[_0x368a3e];return _0x3cb213;};'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(_0x4a2ae5,_0x431e9a){var _0x4487a=function(_0x18a1db){while(--_0x18a1db){_0x4a2ae5['push'](_0x4a2ae5['shift']());}};_0x4487a(++_0x431e9a);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e882,_0x16185c){_0x20e882=_0x20e882-0x0;var _0x3e0dbe=_0xb10b[_0x20e882];return _0x3e0dbe;};'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 07ab009..0a4ff7a 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x110543,_0x2134eb){var _0x302ae4=function(_0x408383){while(--_0x408383){_0x110543['push'](_0x110543['shift']());}};_0x302ae4(++_0x2134eb);}(_0x8603,0x190));var _0x3860=function(_0x237c79,_0x2425fa){_0x237c79=_0x237c79-0x0;var _0x3576a1=_0x8603[_0x237c79];return _0x3576a1;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x10ceef,_0x290db3){var _0x1eb48d=function(_0x361522){while(--_0x361522){_0x10ceef['push'](_0x10ceef['shift']());}};_0x1eb48d(++_0x290db3);}(_0xb7e7,0x121));var _0x7b7e=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb7e7[_0x173441];return _0x2423a8;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index c1de7ad..01d8901 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 _0x3de0=['indexOf','host','port','domain','domainport','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x3de0,0xd6));var _0x03de=function(_0x4337bd,_0x516be8){_0x4337bd=_0x4337bd-0x0;var _0x5aea5a=_0x3de0[_0x4337bd];return _0x5aea5a;};'use strict';function Trunk(_0x5de6ae){this['id']=_0x5de6ae['id']||0x0;this[_0x03de('0x0')]=_0x5de6ae[_0x03de('0x0')]||![];this[_0x03de('0x1')]=_0x5de6ae[_0x03de('0x1')]||'';this[_0x03de('0x2')]=_0x03de('0x3');this[_0x03de('0x4')]=0x0;this[_0x03de('0x5')]=_0x03de('0x3');this['registry']=_0x5de6ae[_0x03de('0x6')]&&_0x5de6ae[_0x03de('0x6')][_0x03de('0x7')](':')?_0x5de6ae['registry']['split'](':')[0x0]:'';this[_0x03de('0x8')]='';this[_0x03de('0x9')]='';this[_0x03de('0xa')]='';this[_0x03de('0xb')]='';this['refresh']='';this[_0x03de('0xc')]='unknown';this[_0x03de('0xd')]='';this[_0x03de('0xe')]='';this[_0x03de('0xf')]=_0x5de6ae[_0x03de('0xf')]||'';}module[_0x03de('0x10')]=Trunk; \ No newline at end of file +var _0xf95d=['indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','state','unknown','stateTime','registry'];(function(_0x348bf2,_0x49655d){var _0x5a5208=function(_0xcfbf7d){while(--_0xcfbf7d){_0x348bf2['push'](_0x348bf2['shift']());}};_0x5a5208(++_0x49655d);}(_0xf95d,0x1eb));var _0xdf95=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf95d[_0x21a9d9];return _0x46adce;};'use strict';function Trunk(_0xc9933c){this['id']=_0xc9933c['id']||0x0;this[_0xdf95('0x0')]=_0xc9933c['active']||![];this['name']=_0xc9933c['name']||'';this[_0xdf95('0x1')]=_0xdf95('0x2');this[_0xdf95('0x3')]=0x0;this['status']=_0xdf95('0x2');this[_0xdf95('0x4')]=_0xc9933c[_0xdf95('0x4')]&&_0xc9933c[_0xdf95('0x4')][_0xdf95('0x5')](':')?_0xc9933c['registry'][_0xdf95('0x6')](':')[0x0]:'';this[_0xdf95('0x7')]='';this[_0xdf95('0x8')]='';this[_0xdf95('0x9')]='';this[_0xdf95('0xa')]='';this[_0xdf95('0xb')]='';this[_0xdf95('0xc')]='unknown';this[_0xdf95('0xd')]='';this['address']='';this[_0xdf95('0xe')]=_0xc9933c[_0xdf95('0xe')]||'';}module[_0xdf95('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 5096236..2e11405 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 _0xd526=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x1c895d,_0x2eae76){var _0xbdfc24=function(_0x1ab22e){while(--_0x1ab22e){_0x1c895d['push'](_0x1c895d['shift']());}};_0xbdfc24(++_0x2eae76);}(_0xd526,0x9e));var _0x6d52=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd526[_0x3947c9];return _0x2e7871;};'use strict';function voiceExtension(_0x3e307a){this['id']=_0x3e307a['id']||0x0;this[_0x6d52('0x0')]=_0x3e307a[_0x6d52('0x0')]||'';this[_0x6d52('0x1')]=_0x3e307a[_0x6d52('0x1')]||_0x6d52('0x2');this[_0x6d52('0x3')]=_0x3e307a['mandatoryDisposition']||![];}module[_0x6d52('0x4')]=voiceExtension; \ No newline at end of file +var _0xaea8=['mandatoryDisposition','exten','recordingFormat'];(function(_0x1495db,_0x20f0c3){var _0x53919a=function(_0x827bbb){while(--_0x827bbb){_0x1495db['push'](_0x1495db['shift']());}};_0x53919a(++_0x20f0c3);}(_0xaea8,0x142));var _0x8aea=function(_0x566d6f,_0x3677e0){_0x566d6f=_0x566d6f-0x0;var _0xa3b3ed=_0xaea8[_0x566d6f];return _0xa3b3ed;};'use strict';function voiceExtension(_0x5605b9){this['id']=_0x5605b9['id']||0x0;this[_0x8aea('0x0')]=_0x5605b9[_0x8aea('0x0')]||'';this[_0x8aea('0x1')]=_0x5605b9[_0x8aea('0x1')]||'none';this[_0x8aea('0x2')]=_0x5605b9[_0x8aea('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index c8497f8..12933b1 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 _0x423b=['callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','fewestcalls','linear','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','invalid','notInUse','onHold','paused','ringInUse','unavailable','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x423b,0x12b));var _0xb423=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x423b[_0x4a747d];return _0x3a5b5c;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xb423('0x0'),'gsm':'gsm'};var strategy={'fewestcalls':_0xb423('0x1'),'leastrecent':'leastrecent','linear':_0xb423('0x2'),'random':'random','ringall':'ringall','rr':'roundrobin','rrmemory':_0xb423('0x3'),'rrordered':_0xb423('0x4'),'wrandom':'wrandom'};function VoiceQueue(_0x1be92e){this['id']=_0x1be92e['id']||0x0;this[_0xb423('0x5')]=_0x1be92e[_0xb423('0x5')]||'';this[_0xb423('0x6')]=_0x1be92e['monitor_format']||'';this[_0xb423('0x7')]=_0x1be92e[_0xb423('0x7')]||_0xb423('0x8');this[_0xb423('0x9')]=0x0;this[_0xb423('0xa')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0xb423('0xb')]=0x0;this[_0xb423('0xc')]=0x0;this[_0xb423('0xd')]=0x0;this[_0xb423('0xe')]=0x0;this[_0xb423('0xf')]=0x0;this['busy']=0x0;this[_0xb423('0x10')]=0x0;this[_0xb423('0x11')]=0x0;this['loggedIn']=0x0;this[_0xb423('0x12')]=0x0;this[_0xb423('0x13')]=0x0;this[_0xb423('0x14')]=0x0;this['ringing']=0x0;this[_0xb423('0x15')]=0x0;this['talking']=0x0;this[_0xb423('0x16')]=0x0;this['unknown']=0x0;this['acw']=_0x1be92e['acw']||![];this[_0xb423('0x17')]=_0x1be92e[_0xb423('0x17')]||0xa;this[_0xb423('0x18')]=_0x1be92e['autopause']||'no';this[_0xb423('0x19')]=!![];this[_0xb423('0x1a')]='';this[_0xb423('0x1b')]='';this[_0xb423('0x1c')]=0x0;this['temp']=0x0;this[_0xb423('0x1d')]=_0x1be92e[_0xb423('0x1d')]||null;this['dialGlobalInterval']=_0x1be92e['dialGlobalInterval']?_0x1be92e[_0xb423('0x1e')]:null;this['dialActive']=_0x1be92e[_0xb423('0x1f')];this[_0xb423('0x20')]=_0x1be92e[_0xb423('0x20')]||_0xb423('0x21');this[_0xb423('0x22')]=_0x1be92e[_0xb423('0x22')]||0x0;this[_0xb423('0x23')]=_0x1be92e[_0xb423('0x23')]||0x0;this['dialPowerLevel']=_0x1be92e[_0xb423('0x24')]||0x1;this[_0xb423('0x25')]=_0x1be92e[_0xb423('0x25')]||'dropRate';this[_0xb423('0x26')]=_0x1be92e[_0xb423('0x26')]||0.03;this['dialPredictiveInterval']=_0x1be92e[_0xb423('0x27')]||0x258;this[_0xb423('0x28')]=_0x1be92e[_0xb423('0x28')]||'anonymous';this[_0xb423('0x29')]=_0x1be92e['dialOriginateCallerIdNumber']||_0xb423('0x2a');this['dialOriginateTimeout']=_0x1be92e[_0xb423('0x2b')]||0x1e;this[_0xb423('0x2c')]=_0x1be92e['dialQueueOptions']||_0xb423('0x2d');this[_0xb423('0x2e')]=_0x1be92e[_0xb423('0x2e')]||0x3;this['dialQueueProject']=_0x1be92e['dialQueueProject']||undefined;this[_0xb423('0x2f')]=_0x1be92e['dialCongestionMaxRetry']||0x3;this[_0xb423('0x30')]=_0x1be92e['dialCongestionRetryFrequency']||0x96;this[_0xb423('0x31')]=_0x1be92e[_0xb423('0x31')]||0x3;this[_0xb423('0x32')]=_0x1be92e[_0xb423('0x32')]||0x96;this[_0xb423('0x33')]=_0x1be92e['dialNoAnswerMaxRetry']||0x3;this[_0xb423('0x34')]=_0x1be92e['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x1be92e['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1be92e[_0xb423('0x35')]||0x96;this[_0xb423('0x36')]=_0x1be92e[_0xb423('0x36')]||0x3;this['dialDropRetryFrequency']=_0x1be92e['dialDropRetryFrequency']||0x96;this[_0xb423('0x37')]=_0x1be92e[_0xb423('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0x1be92e[_0xb423('0x38')]||0x96;this[_0xb423('0x39')]=_0x1be92e[_0xb423('0x39')]||0x3;this[_0xb423('0x3a')]=_0x1be92e[_0xb423('0x3a')]||0x96;this['dialAgentRejectMaxRetry']=_0x1be92e[_0xb423('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1be92e[_0xb423('0x3c')]||0x96;this[_0xb423('0x3d')]=_0x1be92e[_0xb423('0x3d')]||0x3;this[_0xb423('0x3e')]=_0x1be92e[_0xb423('0x3e')]||0x4;this[_0xb423('0x3f')]=_0x1be92e['Trunk']?_0x1be92e[_0xb423('0x3f')]:undefined;this[_0xb423('0x40')]=_0x1be92e['TrunkBackup']?_0x1be92e[_0xb423('0x40')]:undefined;this['dialPrefix']=_0x1be92e[_0xb423('0x41')]||undefined;this[_0xb423('0x42')]=_0x1be92e['Interval']?_0x1be92e[_0xb423('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x1be92e[_0xb423('0x43')]||_0xb423('0x44');this[_0xb423('0x45')]=_0x1be92e[_0xb423('0x45')]||undefined;this[_0xb423('0x46')]=_0x1be92e['dialCutDigit']||undefined;this['strategy']=strategy[_0x1be92e[_0xb423('0x47')]];this[_0xb423('0x48')]=!![];this['dialAMDActive']=_0x1be92e[_0xb423('0x49')]||![];this[_0xb423('0x4a')]=_0x1be92e['dialAMDInitialSilence'];this[_0xb423('0x4b')]=_0x1be92e[_0xb423('0x4b')];this[_0xb423('0x4c')]=_0x1be92e[_0xb423('0x4c')];this[_0xb423('0x4d')]=_0x1be92e[_0xb423('0x4d')];this[_0xb423('0x4e')]=_0x1be92e[_0xb423('0x4e')];this[_0xb423('0x4f')]=_0x1be92e[_0xb423('0x4f')];this[_0xb423('0x50')]=_0x1be92e[_0xb423('0x50')];this[_0xb423('0x51')]=_0x1be92e[_0xb423('0x51')];this['dialAMDMaximumWordLength']=_0x1be92e[_0xb423('0x52')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this['timeout']=_0x1be92e['timeout'];this[_0xb423('0x53')]=0x0;this[_0xb423('0x54')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xb423('0x55')]=0x0;this[_0xb423('0x56')]=0x0;this[_0xb423('0x57')]=0x0;this[_0xb423('0x58')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xb423('0x59')]=0x0;this[_0xb423('0x5a')]=0x0;this[_0xb423('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb423('0x5c')]=0x0;this[_0xb423('0x5d')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xb423('0x5e')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xb423('0x5f')]=0x0;this[_0xb423('0x60')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xb423('0x61')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xb423('0x62')]=0x0;this[_0xb423('0x63')]=0x0;this[_0xb423('0x64')]=0x0;this[_0xb423('0x65')]=_0x1be92e[_0xb423('0x66')]||0x14;this[_0xb423('0x67')]=_0x1be92e[_0xb423('0x66')]||0xa;this[_0xb423('0x68')]=0x0;this[_0xb423('0x69')]=0x0;this[_0xb423('0x6a')]=0x1;this[_0xb423('0x6b')]=0x0;this[_0xb423('0x6c')]=0x0;this[_0xb423('0x6d')]=0x0;this[_0xb423('0x6e')]=0x0;this[_0xb423('0x6f')]=_0x1be92e[_0xb423('0x6f')]||0x1e;this[_0xb423('0x70')]=_0x1be92e[_0xb423('0x70')]||![];this[_0xb423('0x71')]=!!_0x1be92e['dialPreviewAutoRecallMe']||![];this[_0xb423('0x72')]=!!_0x1be92e[_0xb423('0x72')]||![];this[_0xb423('0x73')]=_0x1be92e[_0xb423('0x73')]||undefined;this[_0xb423('0x74')]=_0x1be92e[_0xb423('0x74')]||![];this['dialAgiAfterHangupAgent']=_0x1be92e['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1be92e[_0xb423('0x6')]]?monitorFormat[_0x1be92e[_0xb423('0x6')]]:undefined;this[_0xb423('0x75')]=_0x1be92e[_0xb423('0x75')]||![];this[_0xb423('0x76')]=_0x1be92e['mandatoryDispositionPause']?_0x1be92e['mandatoryDispositionPause']:undefined;this[_0xb423('0x77')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0xfcf8=['predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','ringall','roundrobin','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','busy','invalid','loggedIn','notInUse','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','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','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold'];(function(_0x509494,_0x24cbe7){var _0x383afd=function(_0x24871f){while(--_0x24871f){_0x509494['push'](_0x509494['shift']());}};_0x383afd(++_0x24cbe7);}(_0xfcf8,0x8f));var _0x8fcf=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xfcf8[_0x5608a3];return _0x1ed50a;};'use strict';var monitorFormat={'wav':_0x8fcf('0x0'),'wav49':_0x8fcf('0x1'),'gsm':_0x8fcf('0x2')};var strategy={'fewestcalls':_0x8fcf('0x3'),'leastrecent':_0x8fcf('0x4'),'linear':_0x8fcf('0x5'),'random':'random','ringall':_0x8fcf('0x6'),'rr':_0x8fcf('0x7'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0x8fcf('0x8')};function VoiceQueue(_0x50416f){this['id']=_0x50416f['id']||0x0;this[_0x8fcf('0x9')]=_0x50416f[_0x8fcf('0x9')]||'';this[_0x8fcf('0xa')]=_0x50416f[_0x8fcf('0xa')]||'';this[_0x8fcf('0xb')]=_0x50416f[_0x8fcf('0xb')]||_0x8fcf('0xc');this['waiting']=0x0;this[_0x8fcf('0xd')]=0x0;this[_0x8fcf('0xe')]=0x0;this[_0x8fcf('0xf')]=0x0;this[_0x8fcf('0x10')]=0x0;this['sumBillable']=0x0;this[_0x8fcf('0x11')]=0x0;this[_0x8fcf('0x12')]=0x0;this['available']=0x0;this[_0x8fcf('0x13')]=0x0;this['inUse']=0x0;this[_0x8fcf('0x14')]=0x0;this[_0x8fcf('0x15')]=0x0;this[_0x8fcf('0x16')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x8fcf('0x17')]=0x0;this[_0x8fcf('0x18')]=0x0;this[_0x8fcf('0x19')]=0x0;this[_0x8fcf('0x1a')]=0x0;this[_0x8fcf('0x1b')]=0x0;this[_0x8fcf('0x1c')]=_0x50416f[_0x8fcf('0x1c')]||![];this[_0x8fcf('0x1d')]=_0x50416f[_0x8fcf('0x1d')]||0xa;this[_0x8fcf('0x1e')]=_0x50416f[_0x8fcf('0x1e')]||'no';this['sendMessageOneNotActive']=!![];this[_0x8fcf('0x1f')]='';this[_0x8fcf('0x20')]='';this[_0x8fcf('0x21')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x50416f[_0x8fcf('0x22')]||null;this[_0x8fcf('0x23')]=_0x50416f[_0x8fcf('0x23')]?_0x50416f[_0x8fcf('0x23')]:null;this[_0x8fcf('0x24')]=_0x50416f['dialActive'];this[_0x8fcf('0x25')]=_0x50416f[_0x8fcf('0x25')]||_0x8fcf('0x26');this[_0x8fcf('0x27')]=_0x50416f[_0x8fcf('0x27')]||0x0;this[_0x8fcf('0x28')]=_0x50416f[_0x8fcf('0x28')]||0x0;this[_0x8fcf('0x29')]=_0x50416f[_0x8fcf('0x29')]||0x1;this[_0x8fcf('0x2a')]=_0x50416f[_0x8fcf('0x2a')]||_0x8fcf('0x2b');this[_0x8fcf('0x2c')]=_0x50416f[_0x8fcf('0x2c')]||0.03;this[_0x8fcf('0x2d')]=_0x50416f['dialPredictiveInterval']||0x258;this[_0x8fcf('0x2e')]=_0x50416f[_0x8fcf('0x2e')]||'anonymous';this[_0x8fcf('0x2f')]=_0x50416f['dialOriginateCallerIdNumber']||_0x8fcf('0x30');this['dialOriginateTimeout']=_0x50416f['dialOriginateTimeout']||0x1e;this[_0x8fcf('0x31')]=_0x50416f[_0x8fcf('0x31')]||'tTxX';this['dialQueueTimeout']=_0x50416f['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x50416f['dialQueueProject']||undefined;this[_0x8fcf('0x32')]=_0x50416f['dialCongestionMaxRetry']||0x3;this[_0x8fcf('0x33')]=_0x50416f[_0x8fcf('0x33')]||0x96;this['dialBusyMaxRetry']=_0x50416f['dialBusyMaxRetry']||0x3;this[_0x8fcf('0x34')]=_0x50416f[_0x8fcf('0x34')]||0x96;this[_0x8fcf('0x35')]=_0x50416f[_0x8fcf('0x35')]||0x3;this[_0x8fcf('0x36')]=_0x50416f['dialNoAnswerRetryFrequency']||0x96;this[_0x8fcf('0x37')]=_0x50416f['dialNoSuchNumberMaxRetry']||0x3;this[_0x8fcf('0x38')]=_0x50416f['dialNoSuchNumberRetryFrequency']||0x96;this[_0x8fcf('0x39')]=_0x50416f['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x50416f[_0x8fcf('0x3a')]||0x96;this[_0x8fcf('0x3b')]=_0x50416f['dialAbandonedMaxRetry']||0x3;this[_0x8fcf('0x3c')]=_0x50416f[_0x8fcf('0x3c')]||0x96;this[_0x8fcf('0x3d')]=_0x50416f[_0x8fcf('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x50416f['dialMachineRetryFrequency']||0x96;this[_0x8fcf('0x3e')]=_0x50416f['dialAgentRejectMaxRetry']||0x3;this[_0x8fcf('0x3f')]=_0x50416f[_0x8fcf('0x3f')]||0x96;this[_0x8fcf('0x40')]=_0x50416f[_0x8fcf('0x40')]||0x3;this[_0x8fcf('0x41')]=_0x50416f[_0x8fcf('0x41')]||0x4;this['Trunk']=_0x50416f[_0x8fcf('0x42')]?_0x50416f['Trunk']:undefined;this[_0x8fcf('0x43')]=_0x50416f[_0x8fcf('0x43')]?_0x50416f[_0x8fcf('0x43')]:undefined;this['dialPrefix']=_0x50416f[_0x8fcf('0x44')]||undefined;this[_0x8fcf('0x45')]=_0x50416f[_0x8fcf('0x45')]?_0x50416f[_0x8fcf('0x45')]:undefined;this[_0x8fcf('0x46')]=_0x50416f[_0x8fcf('0x46')]||_0x8fcf('0x47');this[_0x8fcf('0x48')]=_0x50416f['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x8fcf('0x49')]=_0x50416f[_0x8fcf('0x49')]||undefined;this[_0x8fcf('0x4a')]=strategy[_0x50416f['strategy']];this[_0x8fcf('0x4b')]=!![];this[_0x8fcf('0x4c')]=_0x50416f['dialAMDActive']||![];this[_0x8fcf('0x4d')]=_0x50416f['dialAMDInitialSilence'];this[_0x8fcf('0x4e')]=_0x50416f[_0x8fcf('0x4e')];this[_0x8fcf('0x4f')]=_0x50416f[_0x8fcf('0x4f')];this[_0x8fcf('0x50')]=_0x50416f['dialAMDTotalAnalysisTime'];this[_0x8fcf('0x51')]=_0x50416f['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x50416f[_0x8fcf('0x52')];this['dialAMDMaximumNumberOfWords']=_0x50416f[_0x8fcf('0x53')];this[_0x8fcf('0x54')]=_0x50416f[_0x8fcf('0x54')];this['dialAMDMaximumWordLength']=_0x50416f[_0x8fcf('0x55')];this['outboundRejectCallsDay']=0x0;this[_0x8fcf('0x56')]=0x0;this[_0x8fcf('0x57')]=_0x50416f[_0x8fcf('0x57')];this[_0x8fcf('0x58')]=0x0;this[_0x8fcf('0x59')]=0x0;this[_0x8fcf('0x5a')]=0x0;this[_0x8fcf('0x5b')]=0x0;this[_0x8fcf('0x5c')]=0x0;this[_0x8fcf('0x5d')]=0x0;this[_0x8fcf('0x5e')]=0x0;this[_0x8fcf('0x5f')]=0x0;this[_0x8fcf('0x60')]=0x0;this[_0x8fcf('0x61')]=0x0;this[_0x8fcf('0x62')]=0x0;this[_0x8fcf('0x63')]=0x0;this[_0x8fcf('0x64')]=0x0;this[_0x8fcf('0x65')]=0x0;this[_0x8fcf('0x66')]=undefined;this[_0x8fcf('0x67')]=undefined;this[_0x8fcf('0x68')]=undefined;this[_0x8fcf('0x69')]=1.05;this[_0x8fcf('0x6a')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x8fcf('0x6b')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x8fcf('0x6c')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x8fcf('0x6d')]=_0x50416f[_0x8fcf('0x6e')]||0x14;this[_0x8fcf('0x6f')]=_0x50416f['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x8fcf('0x70')]=0x0;this[_0x8fcf('0x71')]=0x0;this[_0x8fcf('0x72')]=0x1;this[_0x8fcf('0x73')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x8fcf('0x74')]=0x0;this[_0x8fcf('0x75')]=_0x50416f[_0x8fcf('0x75')]||0x1e;this[_0x8fcf('0x76')]=_0x50416f[_0x8fcf('0x76')]||![];this['dialPreviewAutoRecallMe']=!!_0x50416f[_0x8fcf('0x77')]||![];this[_0x8fcf('0x78')]=!!_0x50416f['dialPreviewRecallmeReminder']||![];this[_0x8fcf('0x79')]=_0x50416f[_0x8fcf('0x79')]||undefined;this['dialAgiAfterHangupClient']=_0x50416f[_0x8fcf('0x7a')]||![];this[_0x8fcf('0x7b')]=_0x50416f[_0x8fcf('0x7b')]||![];this[_0x8fcf('0xa')]=monitorFormat[_0x50416f['monitor_format']]?monitorFormat[_0x50416f[_0x8fcf('0xa')]]:undefined;this[_0x8fcf('0x7c')]=_0x50416f['mandatoryDisposition']||![];this[_0x8fcf('0x7d')]=_0x50416f[_0x8fcf('0x7d')]?_0x50416f[_0x8fcf('0x7d')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x8fcf('0x7e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 762d22f..44dddf1 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 _0xff3c=['erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','ringInUse','callers','length','SIP/','online','incall','includes','status','booked','queue','dialer','xcally-motion-preview','prototype','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','exports','available','loggedIn','paused','ringing','answered','inUse','loggedInDb','originated','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','talking','total','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','sumBillable','sumDuration','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls'];(function(_0x4ef151,_0x5d2909){var _0x20d902=function(_0x45b4ee){while(--_0x45b4ee){_0x4ef151['push'](_0x4ef151['shift']());}};_0x20d902(++_0x5d2909);}(_0xff3c,0x179));var _0xcff3=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0xff3c[_0x503564];return _0x4be9fd;};'use strict';var INBOUND_COUNTERS=[_0xcff3('0x0'),_0xcff3('0x1'),'loggedInDb',_0xcff3('0x2'),_0xcff3('0x3'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0xcff3('0x0'),_0xcff3('0x4'),_0xcff3('0x5'),_0xcff3('0x1'),_0xcff3('0x6'),_0xcff3('0x7'),'outboundAbandonedCallsDay','outboundAnswerCallsDay',_0xcff3('0x8'),'outboundBusyCallsDay',_0xcff3('0x9'),'outboundNoAnswerCallsDay',_0xcff3('0xa'),_0xcff3('0xb'),_0xcff3('0xc'),_0xcff3('0xd'),_0xcff3('0x2'),_0xcff3('0xe'),_0xcff3('0xf'),'sumBillable','sumDuration',_0xcff3('0x10'),_0xcff3('0x11')];function VoiceQueueSummary(_0x3e5fbc){this['id']=_0x3e5fbc['id'];this[_0xcff3('0x12')]=_0x3e5fbc[_0xcff3('0x12')];this[_0xcff3('0x13')]=_0x3e5fbc[_0xcff3('0x13')];this[_0xcff3('0x14')]=_0x3e5fbc[_0xcff3('0x14')]||0x0;this[_0xcff3('0x4')]=_0x3e5fbc[_0xcff3('0x4')]||0x0;this[_0xcff3('0x0')]=_0x3e5fbc[_0xcff3('0x0')]||0x0;this[_0xcff3('0x15')]=_0x3e5fbc[_0xcff3('0x15')]||0x0;this[_0xcff3('0x5')]=_0x3e5fbc['inUse']||0x0;this[_0xcff3('0x16')]=_0x3e5fbc['invalid']||0x0;this[_0xcff3('0x1')]=_0x3e5fbc[_0xcff3('0x1')]||0x0;this[_0xcff3('0x6')]=_0x3e5fbc['loggedInDb']||0x0;this[_0xcff3('0x17')]=_0x3e5fbc[_0xcff3('0x17')]||0x0;this['notInUse']=_0x3e5fbc[_0xcff3('0x18')]||0x0;this['paused']=_0x3e5fbc[_0xcff3('0x2')]||0x0;this[_0xcff3('0x3')]=_0x3e5fbc[_0xcff3('0x3')]||0x0;this['ringInUse']=_0x3e5fbc['ringInUse'];this[_0xcff3('0x19')]=_0x3e5fbc[_0xcff3('0x19')];this['sumDuration']=_0x3e5fbc[_0xcff3('0x1a')];this['sumHoldTime']=_0x3e5fbc[_0xcff3('0x1b')]||0x0;this['talking']=_0x3e5fbc[_0xcff3('0xf')]||0x0;this['total']=_0x3e5fbc[_0xcff3('0x10')]||0x0;this['type']=_0x3e5fbc[_0xcff3('0x1c')];this[_0xcff3('0x1d')]=_0x3e5fbc['unavailable']||0x0;this[_0xcff3('0x1e')]=_0x3e5fbc[_0xcff3('0x1e')]||0x0;this[_0xcff3('0x1f')]=_0x3e5fbc[_0xcff3('0x1f')]||0x0;this['waiting']=_0x3e5fbc[_0xcff3('0x11')]||0x0;if(_0x3e5fbc['type']==='outbound'){this[_0xcff3('0xe')]=_0x3e5fbc[_0xcff3('0xe')]||0x0;this[_0xcff3('0x20')]=_0x3e5fbc[_0xcff3('0x20')];this['dialMethod']=_0x3e5fbc[_0xcff3('0x21')];this['dialOriginateCallerIdName']=_0x3e5fbc[_0xcff3('0x22')];this[_0xcff3('0x23')]=_0x3e5fbc[_0xcff3('0x23')];this[_0xcff3('0x24')]=_0x3e5fbc[_0xcff3('0x24')];this[_0xcff3('0x25')]=_0x3e5fbc[_0xcff3('0x25')];this[_0xcff3('0x26')]=_0x3e5fbc[_0xcff3('0x26')];this[_0xcff3('0x27')]=_0x3e5fbc[_0xcff3('0x27')];this[_0xcff3('0x28')]=_0x3e5fbc[_0xcff3('0x28')];this[_0xcff3('0x8')]=_0x3e5fbc[_0xcff3('0x8')];this[_0xcff3('0x29')]=_0x3e5fbc[_0xcff3('0x29')];this['outboundCongestionCallsDay']=_0x3e5fbc[_0xcff3('0x9')];this[_0xcff3('0x2a')]=_0x3e5fbc['outboundDropCallsDayACS'];this[_0xcff3('0x2b')]=_0x3e5fbc['outboundDropCallsDayCallersExit'];this[_0xcff3('0x2c')]=_0x3e5fbc[_0xcff3('0x2c')];this[_0xcff3('0x2d')]=_0x3e5fbc[_0xcff3('0x2d')];this[_0xcff3('0xa')]=_0x3e5fbc[_0xcff3('0xa')];this[_0xcff3('0x2e')]=_0x3e5fbc[_0xcff3('0x2e')];this[_0xcff3('0xb')]=_0x3e5fbc['outboundReCallsDay'];this[_0xcff3('0xc')]=_0x3e5fbc['outboundRejectCallsDay'];this[_0xcff3('0xd')]=_0x3e5fbc['outboundUnknownCallsDay'];this[_0xcff3('0x2f')]=_0x3e5fbc[_0xcff3('0x2f')];this[_0xcff3('0x30')]=_0x3e5fbc[_0xcff3('0x30')];this[_0xcff3('0x31')]=_0x3e5fbc[_0xcff3('0x31')];this[_0xcff3('0x32')]=_0x3e5fbc[_0xcff3('0x32')];this[_0xcff3('0x33')]=_0x3e5fbc[_0xcff3('0x33')];this[_0xcff3('0x34')]=_0x3e5fbc[_0xcff3('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x3e5fbc['predictiveIntervalErlangCallsDroppedCalls'];this[_0xcff3('0x35')]=_0x3e5fbc[_0xcff3('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x3e5fbc['predictiveIntervalMultiplicativeFactor'];this[_0xcff3('0x36')]=_0x3e5fbc[_0xcff3('0x36')];this[_0xcff3('0x37')]=_0x3e5fbc[_0xcff3('0x37')];this[_0xcff3('0x38')]=_0x3e5fbc['predictiveIntervalTotalCalls'];this['originated']=_0x3e5fbc[_0xcff3('0x7')];this[_0xcff3('0x39')]=_0x3e5fbc[_0xcff3('0x39')];this['erlangCallToSecond']=_0x3e5fbc[_0xcff3('0x3a')];this[_0xcff3('0x3b')]=_0x3e5fbc[_0xcff3('0x3b')];this[_0xcff3('0x3c')]=_0x3e5fbc[_0xcff3('0x3c')];this[_0xcff3('0x3d')]=_0x3e5fbc[_0xcff3('0x3d')];this[_0xcff3('0x3e')]=_0x3e5fbc['startProgressive'];this[_0xcff3('0x3f')]=_0x3e5fbc[_0xcff3('0x3f')];this[_0xcff3('0x40')]=_0x3e5fbc[_0xcff3('0x40')];}if(_0x3e5fbc['Trunk']){this[_0xcff3('0x41')]={'id':_0x3e5fbc[_0xcff3('0x41')]['id'],'name':_0x3e5fbc['Trunk']['name'],'active':_0x3e5fbc[_0xcff3('0x41')][_0xcff3('0x42')],'callerid':_0x3e5fbc['Trunk'][_0xcff3('0x43')]};}}VoiceQueueSummary['prototype'][_0xcff3('0x44')]=function(_0x5496a6,_0x4ab30a,_0x10e66d,_0x89308e){this['loggedInDb']=0x0;this[_0xcff3('0xf')]=0x0;this['paused']=0x0;this[_0xcff3('0x1e')]=0x0;this[_0xcff3('0x18')]=0x0;this[_0xcff3('0x5')]=0x0;this[_0xcff3('0x15')]=0x0;this['invalid']=0x0;this[_0xcff3('0x1d')]=0x0;this['ringing']=0x0;this[_0xcff3('0x45')]=0x0;this[_0xcff3('0x17')]=0x0;if(_0x10e66d){if(_0x10e66d[_0xcff3('0x0')]){this[_0xcff3('0x0')]=Number(_0x10e66d[_0xcff3('0x0')]);}if(_0x10e66d['loggedin']){this[_0xcff3('0x1')]=Number(_0x10e66d['loggedin']);}if(_0x10e66d[_0xcff3('0x46')]){this['waiting']=Number(_0x10e66d[_0xcff3('0x46')]);}}for(var _0x4e86af=0x0;_0x4e86af<_0x5496a6[_0xcff3('0x47')];_0x4e86af++){var _0x4afe50=_0x4ab30a[_0xcff3('0x48')+_0x5496a6[_0x4e86af][_0xcff3('0x12')]];if(_0x4afe50&&_0x4afe50[_0xcff3('0x49')]){this['loggedInDb']+=0x1;}if(_0x5496a6[_0x4e86af][_0xcff3('0x4a')]==='1'){this[_0xcff3('0xf')]+=0x1;}if(_0x5496a6[_0x4e86af]['paused']==='1'&&!['2','7','8'][_0xcff3('0x4b')](_0x5496a6[_0x4e86af][_0xcff3('0x4c')])){this['paused']+=0x1;}switch(_0x5496a6[_0x4e86af][_0xcff3('0x4c')]){case'0':this[_0xcff3('0x1e')]+=0x1;break;case'1':this[_0xcff3('0x18')]+=0x1;break;case'2':this[_0xcff3('0x5')]+=0x1;break;case'3':this[_0xcff3('0x15')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xcff3('0x1d')]+=0x1;break;case'6':this[_0xcff3('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xcff3('0x17')]+=0x1;break;}}if(this[_0xcff3('0x21')]===_0xcff3('0x4d')){var _0x43b112=Object['keys'](_0x89308e);for(var _0x3d6ff1=0x0;_0x3d6ff1<_0x43b112[_0xcff3('0x47')];_0x3d6ff1++){var _0xe65192=_0x43b112[_0x3d6ff1];var _0x44ac5d=_0x89308e[_0xe65192];if(_0x44ac5d[_0xcff3('0x4e')]===this[_0xcff3('0x12')]&&_0x44ac5d[_0xcff3('0x1c')]===_0xcff3('0x4f')&&_0x44ac5d['exten']===_0xcff3('0x50')){this[_0xcff3('0xf')]+=0x1;}}if(this[_0xcff3('0xf')]>this[_0xcff3('0x5')]){this[_0xcff3('0xf')]=this[_0xcff3('0x5')];}this[_0xcff3('0xe')]=0x0;}return this;};VoiceQueueSummary[_0xcff3('0x51')][_0xcff3('0x52')]=function(_0x27cc77){var _0x4ebe51=![];if(_0x27cc77){_0x4ebe51=INBOUND_COUNTERS[_0xcff3('0x53')](function(_0x9c8282){return this[_0x9c8282]!==_0x27cc77[_0x9c8282];},this);}return _0x4ebe51;};VoiceQueueSummary[_0xcff3('0x51')]['compareToOutboundQueue']=function(_0x3f971c){var _0x1279c1=![];var _0x92c66e=![];var _0x18d11f=![];if(_0x3f971c){_0x1279c1=this[_0xcff3('0x21')]!==_0x3f971c[_0xcff3('0x21')]||this[_0xcff3('0x20')]!==_0x3f971c['dialActive']||this['message']!==_0x3f971c[_0xcff3('0x3f')]||this['statusMessage']!==_0x3f971c[_0xcff3('0x40')];_0x92c66e=OUTBOUND_COUNTERS[_0xcff3('0x53')](function(_0x5028db){return this[_0x5028db]!==_0x3f971c[_0x5028db];},this);if(this[_0xcff3('0x41')]&&_0x3f971c[_0xcff3('0x41')]){_0x18d11f=this[_0xcff3('0x41')][_0xcff3('0x12')]!==_0x3f971c[_0xcff3('0x41')][_0xcff3('0x12')]||this[_0xcff3('0x41')]['active']!==_0x3f971c[_0xcff3('0x41')][_0xcff3('0x42')];}}return _0x1279c1||_0x92c66e||_0x18d11f;};VoiceQueueSummary[_0xcff3('0x51')][_0xcff3('0x54')]=function(_0x1821da){this[_0xcff3('0x4')]=_0x1821da['answered'];this['message']=_0x1821da[_0xcff3('0x3f')];this[_0xcff3('0x40')]=_0x1821da[_0xcff3('0x40')];this[_0xcff3('0x7')]=_0x1821da['originated'];this['outboundAbandonedCallsDay']=_0x1821da['outboundAbandonedCallsDay'];this[_0xcff3('0x28')]=_0x1821da[_0xcff3('0x28')];this[_0xcff3('0x8')]=_0x1821da[_0xcff3('0x8')];this[_0xcff3('0x29')]=_0x1821da[_0xcff3('0x29')];this[_0xcff3('0x9')]=_0x1821da[_0xcff3('0x9')];this[_0xcff3('0x2d')]=_0x1821da[_0xcff3('0x2d')];this[_0xcff3('0xa')]=_0x1821da['outboundNoSuchCallsDay'];this[_0xcff3('0xb')]=_0x1821da[_0xcff3('0xb')];this[_0xcff3('0xc')]=_0x1821da[_0xcff3('0xc')];this[_0xcff3('0xd')]=_0x1821da[_0xcff3('0xd')];this[_0xcff3('0x19')]=_0x1821da['sumBillable'];this[_0xcff3('0x1a')]=_0x1821da[_0xcff3('0x1a')];this[_0xcff3('0x10')]=_0x1821da['total'];if(this[_0xcff3('0x21')]===_0xcff3('0x55')){this['pTalking']=_0x1821da[_0xcff3('0xe')];}};module[_0xcff3('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0xa7be=['outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','talking','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','prototype','createReport','loggedin','callers','SIP/','incall','includes','status','booked','keys','length','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','active','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay'];(function(_0x434571,_0x4402d5){var _0x4a5f89=function(_0x2f5e25){while(--_0x2f5e25){_0x434571['push'](_0x434571['shift']());}};_0x4a5f89(++_0x4402d5);}(_0xa7be,0xfd));var _0xea7b=function(_0x55be01,_0x14eabc){_0x55be01=_0x55be01-0x0;var _0xea7261=_0xa7be[_0x55be01];return _0xea7261;};'use strict';var INBOUND_COUNTERS=[_0xea7b('0x0'),_0xea7b('0x1'),_0xea7b('0x2'),_0xea7b('0x3'),_0xea7b('0x4'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0xea7b('0x0'),_0xea7b('0x5'),_0xea7b('0x6'),'loggedIn',_0xea7b('0x2'),_0xea7b('0x7'),_0xea7b('0x8'),_0xea7b('0x9'),_0xea7b('0xa'),_0xea7b('0xb'),_0xea7b('0xc'),_0xea7b('0xd'),_0xea7b('0xe'),_0xea7b('0xf'),'outboundRejectCallsDay',_0xea7b('0x10'),_0xea7b('0x3'),_0xea7b('0x11'),_0xea7b('0x12'),'sumBillable',_0xea7b('0x13'),_0xea7b('0x14'),'waiting'];function VoiceQueueSummary(_0x109ee1){this['id']=_0x109ee1['id'];this[_0xea7b('0x15')]=_0x109ee1[_0xea7b('0x15')];this[_0xea7b('0x16')]=_0x109ee1[_0xea7b('0x16')];this[_0xea7b('0x17')]=_0x109ee1[_0xea7b('0x17')]||0x0;this[_0xea7b('0x5')]=_0x109ee1['answered']||0x0;this['available']=_0x109ee1[_0xea7b('0x0')]||0x0;this['busy']=_0x109ee1[_0xea7b('0x18')]||0x0;this[_0xea7b('0x6')]=_0x109ee1['inUse']||0x0;this['invalid']=_0x109ee1[_0xea7b('0x19')]||0x0;this['loggedIn']=_0x109ee1[_0xea7b('0x1')]||0x0;this[_0xea7b('0x2')]=_0x109ee1[_0xea7b('0x2')]||0x0;this[_0xea7b('0x1a')]=_0x109ee1[_0xea7b('0x1a')]||0x0;this['notInUse']=_0x109ee1[_0xea7b('0x1b')]||0x0;this[_0xea7b('0x3')]=_0x109ee1[_0xea7b('0x3')]||0x0;this['ringing']=_0x109ee1[_0xea7b('0x4')]||0x0;this[_0xea7b('0x1c')]=_0x109ee1['ringInUse'];this[_0xea7b('0x1d')]=_0x109ee1[_0xea7b('0x1d')];this[_0xea7b('0x13')]=_0x109ee1['sumDuration'];this['sumHoldTime']=_0x109ee1[_0xea7b('0x1e')]||0x0;this[_0xea7b('0x12')]=_0x109ee1['talking']||0x0;this[_0xea7b('0x14')]=_0x109ee1[_0xea7b('0x14')]||0x0;this[_0xea7b('0x1f')]=_0x109ee1['type'];this['unavailable']=_0x109ee1[_0xea7b('0x20')]||0x0;this[_0xea7b('0x21')]=_0x109ee1[_0xea7b('0x21')]||0x0;this['unmanaged']=_0x109ee1['unmanaged']||0x0;this['waiting']=_0x109ee1[_0xea7b('0x22')]||0x0;if(_0x109ee1['type']==='outbound'){this['pTalking']=_0x109ee1[_0xea7b('0x11')]||0x0;this[_0xea7b('0x23')]=_0x109ee1['dialActive'];this['dialMethod']=_0x109ee1[_0xea7b('0x24')];this[_0xea7b('0x25')]=_0x109ee1[_0xea7b('0x25')];this[_0xea7b('0x26')]=_0x109ee1[_0xea7b('0x26')];this[_0xea7b('0x27')]=_0x109ee1[_0xea7b('0x27')];this[_0xea7b('0x28')]=_0x109ee1['dialPrefix'];this[_0xea7b('0x29')]=_0x109ee1[_0xea7b('0x29')];this[_0xea7b('0x2a')]=_0x109ee1[_0xea7b('0x2a')];this[_0xea7b('0x9')]=_0x109ee1[_0xea7b('0x9')];this[_0xea7b('0xa')]=_0x109ee1[_0xea7b('0xa')];this[_0xea7b('0xb')]=_0x109ee1['outboundBusyCallsDay'];this[_0xea7b('0xc')]=_0x109ee1[_0xea7b('0xc')];this[_0xea7b('0x2b')]=_0x109ee1[_0xea7b('0x2b')];this[_0xea7b('0x2c')]=_0x109ee1[_0xea7b('0x2c')];this[_0xea7b('0x2d')]=_0x109ee1[_0xea7b('0x2d')];this['outboundNoAnswerCallsDay']=_0x109ee1[_0xea7b('0xd')];this[_0xea7b('0xe')]=_0x109ee1['outboundNoSuchCallsDay'];this[_0xea7b('0x2e')]=_0x109ee1[_0xea7b('0x2e')];this[_0xea7b('0xf')]=_0x109ee1['outboundReCallsDay'];this[_0xea7b('0x2f')]=_0x109ee1['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0x109ee1[_0xea7b('0x10')];this[_0xea7b('0x30')]=_0x109ee1['predictiveIntervalAnsweredCalls'];this[_0xea7b('0x31')]=_0x109ee1[_0xea7b('0x31')];this[_0xea7b('0x32')]=_0x109ee1[_0xea7b('0x32')];this[_0xea7b('0x33')]=_0x109ee1['predictiveIntervalDroppedCallsCallersExit'];this[_0xea7b('0x34')]=_0x109ee1[_0xea7b('0x34')];this[_0xea7b('0x35')]=_0x109ee1['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x109ee1[_0xea7b('0x36')];this[_0xea7b('0x37')]=_0x109ee1[_0xea7b('0x37')];this[_0xea7b('0x38')]=_0x109ee1[_0xea7b('0x38')];this['predictiveIntervalPauses']=_0x109ee1[_0xea7b('0x39')];this[_0xea7b('0x3a')]=_0x109ee1['predictiveIntervalAvailable'];this[_0xea7b('0x3b')]=_0x109ee1[_0xea7b('0x3b')];this[_0xea7b('0x7')]=_0x109ee1[_0xea7b('0x7')];this[_0xea7b('0x3c')]=_0x109ee1['erlangCalls'];this[_0xea7b('0x3d')]=_0x109ee1['erlangCallToSecond'];this[_0xea7b('0x3e')]=_0x109ee1[_0xea7b('0x3e')];this[_0xea7b('0x3f')]=_0x109ee1[_0xea7b('0x3f')];this[_0xea7b('0x40')]=_0x109ee1['startPredictive'];this[_0xea7b('0x41')]=_0x109ee1[_0xea7b('0x41')];this[_0xea7b('0x42')]=_0x109ee1[_0xea7b('0x42')];this['statusMessage']=_0x109ee1[_0xea7b('0x43')];}if(_0x109ee1[_0xea7b('0x44')]){this['Trunk']={'id':_0x109ee1['Trunk']['id'],'name':_0x109ee1[_0xea7b('0x44')][_0xea7b('0x15')],'active':_0x109ee1[_0xea7b('0x44')]['active'],'callerid':_0x109ee1[_0xea7b('0x44')]['callerid']};}}VoiceQueueSummary[_0xea7b('0x45')][_0xea7b('0x46')]=function(_0xb174a,_0x73768b,_0x567928,_0x18f8f6){this[_0xea7b('0x2')]=0x0;this[_0xea7b('0x12')]=0x0;this[_0xea7b('0x3')]=0x0;this['unknown']=0x0;this[_0xea7b('0x1b')]=0x0;this[_0xea7b('0x6')]=0x0;this[_0xea7b('0x18')]=0x0;this['invalid']=0x0;this[_0xea7b('0x20')]=0x0;this[_0xea7b('0x4')]=0x0;this['ringInUse']=0x0;this[_0xea7b('0x1a')]=0x0;if(_0x567928){if(_0x567928['available']){this['available']=Number(_0x567928[_0xea7b('0x0')]);}if(_0x567928[_0xea7b('0x47')]){this['loggedIn']=Number(_0x567928['loggedin']);}if(_0x567928['callers']){this[_0xea7b('0x22')]=Number(_0x567928[_0xea7b('0x48')]);}}for(var _0x4c52cf=0x0;_0x4c52cf<_0xb174a['length'];_0x4c52cf++){var _0x2e2341=_0x73768b[_0xea7b('0x49')+_0xb174a[_0x4c52cf][_0xea7b('0x15')]];if(_0x2e2341&&_0x2e2341['online']){this[_0xea7b('0x2')]+=0x1;}if(_0xb174a[_0x4c52cf][_0xea7b('0x4a')]==='1'){this[_0xea7b('0x12')]+=0x1;}if(_0xb174a[_0x4c52cf]['paused']==='1'&&!['2','7','8'][_0xea7b('0x4b')](_0xb174a[_0x4c52cf][_0xea7b('0x4c')])){this[_0xea7b('0x3')]+=0x1;}switch(_0xb174a[_0x4c52cf]['status']){case'0':this[_0xea7b('0x21')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xea7b('0x6')]+=0x1;break;case'3':this[_0xea7b('0x18')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xea7b('0x20')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xea7b('0x1c')]+=0x1;break;case'8':this[_0xea7b('0x1a')]+=0x1;break;}}if(this[_0xea7b('0x24')]===_0xea7b('0x4d')){var _0x3ef7e9=Object[_0xea7b('0x4e')](_0x18f8f6);for(var _0x1343a6=0x0;_0x1343a6<_0x3ef7e9[_0xea7b('0x4f')];_0x1343a6++){var _0x360b3c=_0x3ef7e9[_0x1343a6];var _0x5ebe9b=_0x18f8f6[_0x360b3c];if(_0x5ebe9b[_0xea7b('0x50')]===this[_0xea7b('0x15')]&&_0x5ebe9b[_0xea7b('0x1f')]===_0xea7b('0x51')&&_0x5ebe9b[_0xea7b('0x52')]===_0xea7b('0x53')){this[_0xea7b('0x12')]+=0x1;}}if(this[_0xea7b('0x12')]>this[_0xea7b('0x6')]){this[_0xea7b('0x12')]=this[_0xea7b('0x6')];}this[_0xea7b('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xea7b('0x45')][_0xea7b('0x54')]=function(_0x2e4b48){var _0xa9de03=![];if(_0x2e4b48){_0xa9de03=INBOUND_COUNTERS['some'](function(_0x250327){return this[_0x250327]!==_0x2e4b48[_0x250327];},this);}return _0xa9de03;};VoiceQueueSummary[_0xea7b('0x45')]['compareToOutboundQueue']=function(_0x32ac3c){var _0x1c1596=![];var _0x46930d=![];var _0x3a5b7d=![];if(_0x32ac3c){_0x1c1596=this['dialMethod']!==_0x32ac3c[_0xea7b('0x24')]||this[_0xea7b('0x23')]!==_0x32ac3c['dialActive']||this[_0xea7b('0x42')]!==_0x32ac3c['message']||this[_0xea7b('0x43')]!==_0x32ac3c[_0xea7b('0x43')];_0x46930d=OUTBOUND_COUNTERS['some'](function(_0xe1097b){return this[_0xe1097b]!==_0x32ac3c[_0xe1097b];},this);if(this['Trunk']&&_0x32ac3c['Trunk']){_0x3a5b7d=this[_0xea7b('0x44')][_0xea7b('0x15')]!==_0x32ac3c[_0xea7b('0x44')][_0xea7b('0x15')]||this['Trunk'][_0xea7b('0x55')]!==_0x32ac3c['Trunk']['active'];}}return _0x1c1596||_0x46930d||_0x3a5b7d;};VoiceQueueSummary[_0xea7b('0x45')][_0xea7b('0x56')]=function(_0x589b23){this[_0xea7b('0x5')]=_0x589b23[_0xea7b('0x5')];this[_0xea7b('0x42')]=_0x589b23[_0xea7b('0x42')];this[_0xea7b('0x43')]=_0x589b23[_0xea7b('0x43')];this[_0xea7b('0x7')]=_0x589b23[_0xea7b('0x7')];this[_0xea7b('0x8')]=_0x589b23[_0xea7b('0x8')];this[_0xea7b('0x9')]=_0x589b23[_0xea7b('0x9')];this[_0xea7b('0xa')]=_0x589b23[_0xea7b('0xa')];this[_0xea7b('0xb')]=_0x589b23[_0xea7b('0xb')];this['outboundCongestionCallsDay']=_0x589b23['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x589b23[_0xea7b('0xd')];this['outboundNoSuchCallsDay']=_0x589b23[_0xea7b('0xe')];this[_0xea7b('0xf')]=_0x589b23[_0xea7b('0xf')];this[_0xea7b('0x2f')]=_0x589b23[_0xea7b('0x2f')];this[_0xea7b('0x10')]=_0x589b23[_0xea7b('0x10')];this[_0xea7b('0x1d')]=_0x589b23['sumBillable'];this[_0xea7b('0x13')]=_0x589b23[_0xea7b('0x13')];this['total']=_0x589b23[_0xea7b('0x14')];if(this[_0xea7b('0x24')]===_0xea7b('0x57')){this[_0xea7b('0x11')]=_0x589b23['pTalking'];}};module[_0xea7b('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 21918a7..fc812fc 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 _0x8db7=['Configurations','exports','username','accessKey','remoteUri','serverUrl'];(function(_0x2dc711,_0x79a73c){var _0x3deb75=function(_0x22c5a3){while(--_0x22c5a3){_0x2dc711['push'](_0x2dc711['shift']());}};_0x3deb75(++_0x79a73c);}(_0x8db7,0x140));var _0x78db=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x8db7[_0x49b207];return _0x2dc8fa;};'use strict';function VtigerAccount(_0xa4ae6d){this['id']=_0xa4ae6d['id']||0x0;this['name']=_0xa4ae6d['name']||'';this[_0x78db('0x0')]=_0xa4ae6d[_0x78db('0x0')]||'';this[_0x78db('0x1')]=_0xa4ae6d['accessKey']||'';this[_0x78db('0x2')]=_0xa4ae6d[_0x78db('0x2')]||'';this[_0x78db('0x3')]=_0xa4ae6d['serverUrl']||'';this[_0x78db('0x4')]=_0xa4ae6d['Configurations']||{};}module[_0x78db('0x5')]=VtigerAccount; \ No newline at end of file +var _0x3d5f=['Configurations','exports','username','accessKey','remoteUri','serverUrl'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x3d5f,0x1be));var _0xf3d5=function(_0x15feff,_0x1af737){_0x15feff=_0x15feff-0x0;var _0x45a0ac=_0x3d5f[_0x15feff];return _0x45a0ac;};'use strict';function VtigerAccount(_0x2cc9d8){this['id']=_0x2cc9d8['id']||0x0;this['name']=_0x2cc9d8['name']||'';this[_0xf3d5('0x0')]=_0x2cc9d8['username']||'';this[_0xf3d5('0x1')]=_0x2cc9d8[_0xf3d5('0x1')]||'';this['remoteUri']=_0x2cc9d8[_0xf3d5('0x2')]||'';this[_0xf3d5('0x3')]=_0x2cc9d8[_0xf3d5('0x3')]||'';this['Configurations']=_0x2cc9d8[_0xf3d5('0x4')]||{};}module[_0xf3d5('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index dc92a52..3995544 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 _0xb463=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xb463,0xaf));var _0x3b46=function(_0x5a51af,_0x184b9f){_0x5a51af=_0x5a51af-0x0;var _0x11c74f=_0xb463[_0x5a51af];return _0x11c74f;};'use strict';function ZendeskAccount(_0xb53ccd){this['id']=_0xb53ccd['id']||0x0;this[_0x3b46('0x0')]=_0xb53ccd[_0x3b46('0x0')]||'';this[_0x3b46('0x1')]=_0xb53ccd['username']||'';this['password']=_0xb53ccd[_0x3b46('0x2')]||'';this['token']=_0xb53ccd[_0x3b46('0x3')]||'';this[_0x3b46('0x4')]=_0xb53ccd[_0x3b46('0x4')]||'';this['authType']=_0xb53ccd[_0x3b46('0x5')]||'';this[_0x3b46('0x6')]=_0xb53ccd['type']||_0x3b46('0x7');this[_0x3b46('0x8')]=_0xb53ccd[_0x3b46('0x8')]||'';this['Configurations']=_0xb53ccd[_0x3b46('0x9')]||{};}module[_0x3b46('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x85b3=['username','password','token','remoteUri','type','integrationTab','serverUrl','Configurations','name'];(function(_0x545dd8,_0x404f75){var _0x44cd80=function(_0xec3ca3){while(--_0xec3ca3){_0x545dd8['push'](_0x545dd8['shift']());}};_0x44cd80(++_0x404f75);}(_0x85b3,0xa1));var _0x385b=function(_0x17032a,_0x51b77a){_0x17032a=_0x17032a-0x0;var _0x4ae33e=_0x85b3[_0x17032a];return _0x4ae33e;};'use strict';function ZendeskAccount(_0x2e0c45){this['id']=_0x2e0c45['id']||0x0;this[_0x385b('0x0')]=_0x2e0c45[_0x385b('0x0')]||'';this['username']=_0x2e0c45[_0x385b('0x1')]||'';this[_0x385b('0x2')]=_0x2e0c45[_0x385b('0x2')]||'';this[_0x385b('0x3')]=_0x2e0c45[_0x385b('0x3')]||'';this[_0x385b('0x4')]=_0x2e0c45[_0x385b('0x4')]||'';this['authType']=_0x2e0c45['authType']||'';this[_0x385b('0x5')]=_0x2e0c45[_0x385b('0x5')]||_0x385b('0x6');this[_0x385b('0x7')]=_0x2e0c45['serverUrl']||'';this[_0x385b('0x8')]=_0x2e0c45['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 758dd1d..afd150e 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 _0x712d=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x712d,0x155));var _0xd712=function(_0x530cc6,_0x3bf6b0){_0x530cc6=_0x530cc6-0x0;var _0x142f0e=_0x712d[_0x530cc6];return _0x142f0e;};'use strict';function ZohoAccount(_0x224f42){this['id']=_0x224f42['id']||0x0;this[_0xd712('0x0')]=_0x224f42[_0xd712('0x0')]||'';this[_0xd712('0x1')]=_0x224f42[_0xd712('0x1')]||'';this[_0xd712('0x2')]=_0x224f42[_0xd712('0x2')]||'';this[_0xd712('0x3')]=_0x224f42[_0xd712('0x3')]||'';this[_0xd712('0x4')]=_0x224f42[_0xd712('0x4')]||'';this[_0xd712('0x5')]=_0x224f42[_0xd712('0x5')]||'';this[_0xd712('0x6')]=_0x224f42[_0xd712('0x6')]||'';this[_0xd712('0x7')]=_0x224f42['code']||'';this[_0xd712('0x8')]=_0x224f42[_0xd712('0x8')]||'';this['Configurations']=_0x224f42[_0xd712('0x9')]||{};}module[_0xd712('0xa')]=ZohoAccount; \ No newline at end of file +var _0x46d1=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0xec74fe,_0x2dce88){var _0x50bda2=function(_0x538a6d){while(--_0x538a6d){_0xec74fe['push'](_0xec74fe['shift']());}};_0x50bda2(++_0x2dce88);}(_0x46d1,0xbb));var _0x146d=function(_0x8ca1b1,_0x636153){_0x8ca1b1=_0x8ca1b1-0x0;var _0x4610b1=_0x46d1[_0x8ca1b1];return _0x4610b1;};'use strict';function ZohoAccount(_0x35b9ab){this['id']=_0x35b9ab['id']||0x0;this['name']=_0x35b9ab[_0x146d('0x0')]||'';this[_0x146d('0x1')]=_0x35b9ab[_0x146d('0x1')]||'';this[_0x146d('0x2')]=_0x35b9ab[_0x146d('0x2')]||'';this[_0x146d('0x3')]=_0x35b9ab[_0x146d('0x3')]||'';this[_0x146d('0x4')]=_0x35b9ab[_0x146d('0x4')]||'';this[_0x146d('0x5')]=_0x35b9ab['clientSecret']||'';this['serverUrl']=_0x35b9ab[_0x146d('0x6')]||'';this[_0x146d('0x7')]=_0x35b9ab[_0x146d('0x7')]||'';this['refreshToken']=_0x35b9ab[_0x146d('0x8')]||'';this['Configurations']=_0x35b9ab[_0x146d('0x9')]||{};}module[_0x146d('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 2a72066..fd2d996 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 _0x1399=['type','queue','dialAnswer','Agent','name','channelAgent','membername','calleridname','phone','Contact','firstName','active','scheduledat','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','idContact'];(function(_0x20dd89,_0x2a5c08){var _0x56aa24=function(_0x46dff0){while(--_0x46dff0){_0x20dd89['push'](_0x20dd89['shift']());}};_0x56aa24(++_0x2a5c08);}(_0x1399,0x16c));var _0x9139=function(_0x438726,_0x4ea8db){_0x438726=_0x438726-0x0;var _0x2cd3ef=_0x1399[_0x438726];return _0x2cd3ef;};'use strict';var util=require(_0x9139('0x0'));var _=require(_0x9139('0x1'));var moment=require('moment');function checkNameSurname(_0x474911,_0x4f01ae,_0x10c98f){var _0x8bba08='';if(!_[_0x9139('0x2')](_0x4f01ae)&&_0x9139('0x3')===typeof _0x4f01ae){_0x8bba08+=_0x4f01ae;}if(!_[_0x9139('0x2')](_0x10c98f)&&_0x9139('0x3')===typeof _0x10c98f){_0x8bba08+='\x20'+_0x10c98f;}if(_0x8bba08!==''){return _0x8bba08;}return _0x474911;}function Action(_0x5ac80b,_0x54af2d,_0x8f086b,_0x11d2ed,_0x4d5d1e){this['uniqueid']=_0x8f086b||undefined;this[_0x9139('0x4')]=_0x5ac80b['id'];this['queue']=_0x54af2d['name'];this[_0x9139('0x5')]=_0x54af2d[_0x9139('0x5')];this['campaigntype']=_0x9139('0x6');this[_0x9139('0x7')]=![];this['membername']=_['isNil'](_0x5ac80b[_0x9139('0x8')])?undefined:_0x5ac80b[_0x9139('0x8')][_0x9139('0x9')];this[_0x9139('0xa')]=this[_0x9139('0xb')]?util['format']('SIP/%s',this['membername']):_0x11d2ed||undefined;this[_0x9139('0xc')]=checkNameSurname(_0x5ac80b['Contact'][_0x9139('0xd')],_0x5ac80b[_0x9139('0xe')][_0x9139('0xf')],_0x5ac80b[_0x9139('0xe')]['lastName']);this[_0x9139('0x10')]=_0x5ac80b['active']||![];this['calleridnum']=_0x5ac80b['phone'];this[_0x9139('0x11')]=_0x5ac80b[_0x9139('0x11')];this[_0x9139('0x12')]=_0x5ac80b[_0x9139('0x12')]||0x0;this[_0x9139('0x13')]=_0x5ac80b[_0x9139('0x13')]||0x0;this['countnoanswerretry']=_0x5ac80b['countnoanswerretry']||0x0;this[_0x9139('0x14')]=(_0x5ac80b[_0x9139('0x12')]||0x0)+(_0x5ac80b['countcongestionretry']||0x0)+(_0x5ac80b['countnoanswerretry']||0x0)+(_0x5ac80b[_0x9139('0x15')]||0x0)+(_0x5ac80b[_0x9139('0x16')]||0x0)+(_0x5ac80b['countabandonedretry']||0x0)+(_0x5ac80b[_0x9139('0x17')]||0x0)+(_0x5ac80b[_0x9139('0x18')]||0x0);this[_0x9139('0x15')]=_0x5ac80b[_0x9139('0x15')]||0x0;this[_0x9139('0x16')]=_0x5ac80b[_0x9139('0x16')]||0x0;this[_0x9139('0x19')]=_0x5ac80b[_0x9139('0x19')]||0x0;this[_0x9139('0x17')]=_0x5ac80b[_0x9139('0x17')]||0x0;this[_0x9139('0x18')]=_0x5ac80b[_0x9139('0x18')]||0x0;this[_0x9139('0x1a')]=_0x5ac80b[_0x9139('0x1a')];this[_0x9139('0x1b')]=_0x5ac80b[_0x9139('0x1b')];this[_0x9139('0x1c')]=_0x5ac80b[_0x9139('0x1c')];this[_0x9139('0x1d')]=_0x5ac80b['recallme'];this[_0x9139('0x1e')]=_0x5ac80b[_0x9139('0x1e')];this['ListId']=_0x5ac80b[_0x9139('0x1f')];this[_0x9139('0x20')]=_[_0x9139('0x2')](_0x5ac80b['Agent'])?_0x5ac80b[_0x9139('0x20')]:_0x5ac80b[_0x9139('0x8')]['id'];this['VoiceQueueId']=_0x5ac80b[_0x9139('0x21')];this[_0x9139('0x22')]='';this[_0x9139('0x23')]='';}Action['prototype'][_0x9139('0x24')]=function(){return util[_0x9139('0x25')](_0x9139('0x26'),this[_0x9139('0xc')],this[_0x9139('0x27')]);};module[_0x9139('0x28')]=Action; \ No newline at end of file +var _0x6a55=['countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','util','isNil','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry'];(function(_0x29859f,_0x2f7896){var _0x3a4118=function(_0x724cc7){while(--_0x724cc7){_0x29859f['push'](_0x29859f['shift']());}};_0x3a4118(++_0x2f7896);}(_0x6a55,0xdb));var _0x56a5=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x6a55[_0x2134b7];return _0x6c5914;};'use strict';var util=require(_0x56a5('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x4ec858,_0x173b37,_0x47b337){var _0x561353='';if(!_[_0x56a5('0x1')](_0x173b37)&&'string'===typeof _0x173b37){_0x561353+=_0x173b37;}if(!_[_0x56a5('0x1')](_0x47b337)&&'string'===typeof _0x47b337){_0x561353+='\x20'+_0x47b337;}if(_0x561353!==''){return _0x561353;}return _0x4ec858;}function Action(_0x28bb2b,_0x380b1b,_0x42d164,_0x293ea1,_0x444c65){this[_0x56a5('0x2')]=_0x42d164||undefined;this[_0x56a5('0x3')]=_0x28bb2b['id'];this[_0x56a5('0x4')]=_0x380b1b['name'];this[_0x56a5('0x5')]=_0x380b1b[_0x56a5('0x5')];this[_0x56a5('0x6')]=_0x56a5('0x4');this[_0x56a5('0x7')]=![];this[_0x56a5('0x8')]=_[_0x56a5('0x1')](_0x28bb2b[_0x56a5('0x9')])?undefined:_0x28bb2b[_0x56a5('0x9')]['name'];this['channelAgent']=this[_0x56a5('0x8')]?util[_0x56a5('0xa')](_0x56a5('0xb'),this[_0x56a5('0x8')]):_0x293ea1||undefined;this[_0x56a5('0xc')]=checkNameSurname(_0x28bb2b[_0x56a5('0xd')]['phone'],_0x28bb2b['Contact'][_0x56a5('0xe')],_0x28bb2b[_0x56a5('0xd')][_0x56a5('0xf')]);this[_0x56a5('0x10')]=_0x28bb2b[_0x56a5('0x10')]||![];this[_0x56a5('0x11')]=_0x28bb2b[_0x56a5('0x12')];this['scheduledat']=_0x28bb2b[_0x56a5('0x13')];this['countbusyretry']=_0x28bb2b[_0x56a5('0x14')]||0x0;this['countcongestionretry']=_0x28bb2b[_0x56a5('0x15')]||0x0;this[_0x56a5('0x16')]=_0x28bb2b[_0x56a5('0x16')]||0x0;this[_0x56a5('0x17')]=(_0x28bb2b[_0x56a5('0x14')]||0x0)+(_0x28bb2b[_0x56a5('0x15')]||0x0)+(_0x28bb2b[_0x56a5('0x16')]||0x0)+(_0x28bb2b['countnosuchnumberretry']||0x0)+(_0x28bb2b[_0x56a5('0x18')]||0x0)+(_0x28bb2b[_0x56a5('0x19')]||0x0)+(_0x28bb2b[_0x56a5('0x1a')]||0x0)+(_0x28bb2b[_0x56a5('0x1b')]||0x0);this['countnosuchnumberretry']=_0x28bb2b[_0x56a5('0x1c')]||0x0;this[_0x56a5('0x18')]=_0x28bb2b[_0x56a5('0x18')]||0x0;this[_0x56a5('0x19')]=_0x28bb2b[_0x56a5('0x19')]||0x0;this['countmachineretry']=_0x28bb2b['countmachineretry']||0x0;this[_0x56a5('0x1b')]=_0x28bb2b[_0x56a5('0x1b')]||0x0;this['callback']=_0x28bb2b[_0x56a5('0x1d')];this[_0x56a5('0x1e')]=_0x28bb2b[_0x56a5('0x1e')];this[_0x56a5('0x1f')]=_0x28bb2b[_0x56a5('0x1f')];this[_0x56a5('0x20')]=_0x28bb2b[_0x56a5('0x20')];this[_0x56a5('0x21')]=_0x28bb2b[_0x56a5('0x21')];this[_0x56a5('0x22')]=_0x28bb2b[_0x56a5('0x22')];this[_0x56a5('0x23')]=_[_0x56a5('0x1')](_0x28bb2b['Agent'])?_0x28bb2b[_0x56a5('0x23')]:_0x28bb2b[_0x56a5('0x9')]['id'];this[_0x56a5('0x24')]=_0x28bb2b[_0x56a5('0x24')];this[_0x56a5('0x25')]='';this['originatecalleridname']='';}Action[_0x56a5('0x26')]['getCaller']=function(){return util[_0x56a5('0xa')](_0x56a5('0x27'),this[_0x56a5('0xc')],this[_0x56a5('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0280275..a45a7da 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x3d993d,_0x3b15b1){var _0x13688d=function(_0x5a92fc){while(--_0x5a92fc){_0x3d993d['push'](_0x3d993d['shift']());}};_0x13688d(++_0x3b15b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x579273,_0x341f2b){var _0x3bdac7=function(_0x44576d){while(--_0x44576d){_0x579273['push'](_0x579273['shift']());}};_0x3bdac7(++_0x341f2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index e7e4aa2..121ec23 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 _0xbb4a=['util','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20'];(function(_0x5f411c,_0x1e1c9b){var _0x47eb5f=function(_0x50db65){while(--_0x50db65){_0x5f411c['push'](_0x5f411c['shift']());}};_0x47eb5f(++_0x1e1c9b);}(_0xbb4a,0x181));var _0xabb4=function(_0x5c1981,_0x2836c5){_0x5c1981=_0x5c1981-0x0;var _0x3892ce=_0xbb4a[_0x5c1981];return _0x3892ce;};'use strict';var util=require(_0xabb4('0x0'));var BPromise=require(_0xabb4('0x1'));var logger=require(_0xabb4('0x2'))(_0xabb4('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xabb4('0x4'));var cmHopperBlack=require(_0xabb4('0x5'));var agentReportPreview=require(_0xabb4('0x6'));var voiceQueueReport=require(_0xabb4('0x7'));function loggerCatch(_0x28677d){return function(_0x6e9fef){logger[_0xabb4('0x8')](_0x28677d,util['inspect'](_0x6e9fef,{'showHidden':![],'depth':null}));};}function create(_0x2651ae){return cmHopperHistory[_0xabb4('0x9')](_0x2651ae)[_0xabb4('0xa')](loggerCatch(_0xabb4('0xb')));}function createAgent(_0x57eda7){return BPromise[_0xabb4('0xc')]()[_0xabb4('0xd')](agentReportPreview[_0xabb4('0x9')](_0x57eda7))[_0xabb4('0xa')](loggerCatch(_0xabb4('0xb')));}function moveContact(_0x429fcc){return cmHopper[_0xabb4('0xe')](_0x429fcc,!![])[_0xabb4('0xa')](loggerCatch(_0xabb4('0xf')));}exports[_0xabb4('0x10')]=function(_0x418aed){return cmHopperBlack[_0xabb4('0x10')](_0x418aed)['catch'](loggerCatch(_0xabb4('0x11')));};exports['getContactPreview']=function(_0x148868){return BPromise[_0xabb4('0xc')]()[_0xabb4('0xd')](cmHopper[_0xabb4('0x12')](_0x148868))[_0xabb4('0xa')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x231df8,_0x437694){create(_0x231df8)[_0xabb4('0xa')](loggerCatch(_0x437694));moveContact(_0x231df8)[_0xabb4('0xa')](loggerCatch(_0x437694));};exports[_0xabb4('0x13')]=function(_0x4609e8,_0x38b8e0){createAgent(_0x4609e8)[_0xabb4('0xa')](loggerCatch(_0x38b8e0));};exports[_0xabb4('0x14')]=function(_0x105591,_0x32c962){create(_0x105591)['catch'](loggerCatch(_0x32c962));};exports[_0xabb4('0x15')]=function(_0x155f2e,_0x38a03c){moveContact(_0x155f2e)[_0xabb4('0xa')](loggerCatch(_0x38a03c));};exports[_0xabb4('0x16')]=function(_0x133f9d,_0x21c035,_0x82e71d){if(_0x21c035){_0x133f9d[_0xabb4('0x17')]=null;}if(_0x82e71d){_0x133f9d[_0xabb4('0x18')]=![];}return cmHopper[_0xabb4('0x16')](_0x133f9d)[_0xabb4('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xabb4('0x19')]=function(_0x11efb6){return cmHopper[_0xabb4('0x19')](_0x11efb6)[_0xabb4('0xa')](loggerCatch(_0xabb4('0x1a')));};exports['unlockContact']=function(_0x1e742d){return cmHopper[_0xabb4('0x1b')]({'UserId':null},_0x1e742d,0x1)[_0xabb4('0xa')](loggerCatch(_0xabb4('0x1c')));};exports[_0xabb4('0x1d')]=function(_0x57c5f6){return cmHopper[_0xabb4('0x1b')]({'active':![]},_0x57c5f6,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xabb4('0x1e')]=function(_0x50f0b4){var _0x2abc59={};_0x2abc59[_0xabb4('0x1f')]=_0x50f0b4[_0xabb4('0x1f')];_0x2abc59[_0xabb4('0x20')]=_0x50f0b4[_0xabb4('0x20')];_0x2abc59[_0xabb4('0x21')]=_0x50f0b4['calleridnum'];_0x2abc59[_0xabb4('0x22')]=_0x50f0b4['calleridname'];_0x2abc59[_0xabb4('0x23')]=_0x50f0b4[_0xabb4('0x23')];_0x2abc59[_0xabb4('0x24')]=_0x50f0b4[_0xabb4('0x25')];_0x2abc59[_0xabb4('0x26')]=_0x50f0b4[_0xabb4('0x25')];_0x2abc59[_0xabb4('0x27')]=0x1;_0x2abc59['queuecallercompleteAt']=_0x50f0b4[_0xabb4('0x28')];_0x2abc59[_0xabb4('0x29')]=_0x50f0b4[_0xabb4('0x2a')];_0x2abc59[_0xabb4('0x2b')]=_0xabb4('0x2c');_0x2abc59['exten']='xcally-motion-preview';_0x2abc59[_0xabb4('0x2d')]=0x0;_0x2abc59[_0xabb4('0x2e')]=0x1;_0x2abc59[_0xabb4('0x2f')]=_0x50f0b4[_0xabb4('0x2a')];_0x2abc59[_0xabb4('0x30')]=_0xabb4('0x31');return BPromise[_0xabb4('0xc')]()[_0xabb4('0xd')](voiceQueueReport[_0xabb4('0x32')](_0x2abc59))['catch'](loggerCatch(_0xabb4('0x33')));};exports[_0xabb4('0x34')]=function(_0x40c23a,_0x66e3c9){return BPromise['resolve']()[_0xabb4('0xd')](cmHopper[_0xabb4('0x34')](_0x40c23a,_0x66e3c9))['catch'](loggerCatch(_0xabb4('0x35')));};exports['rescheduleContactInQueue']=function(_0x15d470){return cmHopper[_0xabb4('0x16')](_0x15d470,!![],!![])['catch'](loggerCatch(_0xabb4('0x36')));}; \ No newline at end of file +var _0x3b6c=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','membername','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','resolve','then','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled'];(function(_0x68d47,_0x50e472){var _0x5ed143=function(_0x2cae36){while(--_0x2cae36){_0x68d47['push'](_0x68d47['shift']());}};_0x5ed143(++_0x50e472);}(_0x3b6c,0x16d));var _0xc3b6=function(_0x2976b5,_0x467147){_0x2976b5=_0x2976b5-0x0;var _0x545eaa=_0x3b6c[_0x2976b5];return _0x545eaa;};'use strict';var util=require('util');var BPromise=require(_0xc3b6('0x0'));var logger=require(_0xc3b6('0x1'))(_0xc3b6('0x2'));var cmHopper=require(_0xc3b6('0x3'));var cmHopperHistory=require(_0xc3b6('0x4'));var cmHopperBlack=require(_0xc3b6('0x5'));var agentReportPreview=require(_0xc3b6('0x6'));var voiceQueueReport=require(_0xc3b6('0x7'));function loggerCatch(_0x31360e){return function(_0x1ecdf6){logger['error'](_0x31360e,util[_0xc3b6('0x8')](_0x1ecdf6,{'showHidden':![],'depth':null}));};}function create(_0x1838f8){return cmHopperHistory[_0xc3b6('0x9')](_0x1838f8)[_0xc3b6('0xa')](loggerCatch(_0xc3b6('0xb')));}function createAgent(_0x2952c3){return BPromise[_0xc3b6('0xc')]()[_0xc3b6('0xd')](agentReportPreview[_0xc3b6('0x9')](_0x2952c3))[_0xc3b6('0xa')](loggerCatch(_0xc3b6('0xb')));}function moveContact(_0x41c677){return cmHopper['moveContactManagedDialer'](_0x41c677,!![])[_0xc3b6('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xc3b6('0xe')]=function(_0x415a6d){return cmHopperBlack[_0xc3b6('0xe')](_0x415a6d)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xc3b6('0xf')]=function(_0x9794f7){return BPromise[_0xc3b6('0xc')]()[_0xc3b6('0xd')](cmHopper[_0xc3b6('0xf')](_0x9794f7))[_0xc3b6('0xa')](loggerCatch(_0xc3b6('0x10')));};exports[_0xc3b6('0x9')]=function(_0x479758,_0x14af54){create(_0x479758)[_0xc3b6('0xa')](loggerCatch(_0x14af54));moveContact(_0x479758)[_0xc3b6('0xa')](loggerCatch(_0x14af54));};exports['createAgentHistory']=function(_0x504c34,_0x23e789){createAgent(_0x504c34)[_0xc3b6('0xa')](loggerCatch(_0x23e789));};exports['createCustomerHistory']=function(_0x47f558,_0x1c0e27){create(_0x47f558)[_0xc3b6('0xa')](loggerCatch(_0x1c0e27));};exports[_0xc3b6('0x11')]=function(_0x5ba088,_0x48e67f){moveContact(_0x5ba088)[_0xc3b6('0xa')](loggerCatch(_0x48e67f));};exports[_0xc3b6('0x12')]=function(_0x158178,_0x190e97,_0x5e23ec){if(_0x190e97){_0x158178[_0xc3b6('0x13')]=null;}if(_0x5e23ec){_0x158178[_0xc3b6('0x14')]=![];}return cmHopper[_0xc3b6('0x12')](_0x158178)[_0xc3b6('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xc3b6('0x15')]=function(_0xcbce4f){return cmHopper[_0xc3b6('0x15')](_0xcbce4f)[_0xc3b6('0xa')](loggerCatch(_0xc3b6('0x16')));};exports[_0xc3b6('0x17')]=function(_0xda107e){return cmHopper[_0xc3b6('0x17')]({'UserId':null},_0xda107e,0x1)['catch'](loggerCatch(_0xc3b6('0x18')));};exports[_0xc3b6('0x19')]=function(_0x30b8fe){return cmHopper[_0xc3b6('0x17')]({'active':![]},_0x30b8fe,0x1)[_0xc3b6('0xa')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x144267){var _0x1f9480={};_0x1f9480['type']=_0x144267['type'];_0x1f9480[_0xc3b6('0x1a')]=_0x144267[_0xc3b6('0x1a')];_0x1f9480[_0xc3b6('0x1b')]=_0x144267[_0xc3b6('0x1b')];_0x1f9480[_0xc3b6('0x1c')]=_0x144267[_0xc3b6('0x1c')];_0x1f9480[_0xc3b6('0x1d')]=_0x144267[_0xc3b6('0x1d')];_0x1f9480[_0xc3b6('0x1e')]=_0x144267[_0xc3b6('0x1f')];_0x1f9480[_0xc3b6('0x20')]=_0x144267[_0xc3b6('0x1f')];_0x1f9480[_0xc3b6('0x21')]=0x1;_0x1f9480[_0xc3b6('0x22')]=_0x144267['endtime'];_0x1f9480['connectedlinename']=_0x144267[_0xc3b6('0x23')];_0x1f9480['context']='from-sip';_0x1f9480['exten']='xcally-motion-preview';_0x1f9480[_0xc3b6('0x24')]=0x0;_0x1f9480[_0xc3b6('0x25')]=0x1;_0x1f9480[_0xc3b6('0x26')]=_0x144267['membername'];_0x1f9480['queuecallerexitreason']=_0xc3b6('0x27');return BPromise[_0xc3b6('0xc')]()[_0xc3b6('0xd')](voiceQueueReport[_0xc3b6('0x28')](_0x1f9480))['catch'](loggerCatch(_0xc3b6('0x29')));};exports[_0xc3b6('0x2a')]=function(_0x390bee,_0x10a8fc){return BPromise[_0xc3b6('0xc')]()['then'](cmHopper[_0xc3b6('0x2a')](_0x390bee,_0x10a8fc))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x5ef3d8){return cmHopper['rescheduleContact'](_0x5ef3d8,!![],!![])[_0xc3b6('0xa')](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 3626a50..8258658 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 _0xde33=['diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','scheduledat','countbusyretry','countcongestionretry','countglobal','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','extractCalleridNumber','match','noanswer','variables','toLowerCase','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','originated','error','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','getSeconds','talktime','answertime','isFailure','Failure','variablesAction','calleridname','originate','channelAgent','xcally-motion-preview','from-sip','timeout','uniqueid','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','add','minutes','ListId','VoiceQueueId','pTalking','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','getDiff','milliseconds'];(function(_0x405c62,_0x36f70b){var _0x3fb841=function(_0x244213){while(--_0x244213){_0x405c62['push'](_0x405c62['shift']());}};_0x3fb841(++_0x36f70b);}(_0xde33,0x14d));var _0x3de3=function(_0x452602,_0x1ceb2b){_0x452602=_0x452602-0x0;var _0x5b940c=_0xde33[_0x452602];return _0x5b940c;};'use strict';var util=require(_0x3de3('0x0'));var _=require(_0x3de3('0x1'));var moment=require(_0x3de3('0x2'));var logger=require('../../../../config/logger')(_0x3de3('0x3'));var ipAgi=process[_0x3de3('0x4')][_0x3de3('0x5')]||_0x3de3('0x6');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x4eedba){return function(_0x580d91){logger['error'](_0x4eedba,util['inspect'](_0x580d91,{'showHidden':![],'depth':null}));};};exports[_0x3de3('0x7')]=function(_0x46848c,_0x365e0c){logger[_0x3de3('0x8')](_0x46848c,util[_0x3de3('0x9')](_0x365e0c,{'showHidden':![],'depth':null}));};exports[_0x3de3('0xa')]=function(_0x188171,_0xa79251){logger['error'](_0x188171,util[_0x3de3('0x9')](_0xa79251,{'showHidden':![],'depth':null}));};exports[_0x3de3('0xb')]=function(_0x9b6a10){return function(_0x42914b){logger[_0x3de3('0x8')](_0x9b6a10,util[_0x3de3('0x9')](_0x42914b,{'showHidden':![],'depth':null}));};};exports[_0x3de3('0xc')]=function(_0x39e5b3,_0x4903f2,_0x421338){return{'message':_0x39e5b3,'unlock':_0x4903f2,'active':_0x421338};};exports[_0x3de3('0xd')]=function(_0x3e4e61,_0x4098ba,_0xfc950c){if(!_[_0x3de3('0xe')](_0xfc950c)&&_0x3de3('0xf')===typeof _0xfc950c&&!_[_0x3de3('0x10')](_0xfc950c)){if(!_[_0x3de3('0xe')](_0x4098ba)&&_0x3de3('0xf')===typeof _0x4098ba&&!_['isEmpty'](_0x4098ba)){return util[_0x3de3('0x11')](_0x3de3('0x12'),_0x4098ba,_0xfc950c);}return util[_0x3de3('0x11')](_0x3de3('0x12'),_0xfc950c,_0xfc950c);}if(!_['isUndefined'](_0x3e4e61)&&_0x3de3('0xf')===typeof _0x3e4e61&&!_[_0x3de3('0x10')](_0x3e4e61)){return _0x3e4e61;}return _0x3de3('0x13');};exports[_0x3de3('0x14')]=function(_0x32b70f){if(_[_0x3de3('0x15')](_0x32b70f)){return![];}return _0x32b70f;};exports[_0x3de3('0x16')]=function(_0x298d4d,_0x24bc36,_0x4f2fed,_0x26d88f,_0x5c5adf,_0x3b8cd9){var _0x24aac5={'XMD-QUEUE':_0x24bc36[_0x3de3('0x17')]?_0x24bc36['Queue'][_0x3de3('0x18')]:'','XMD-CALLERID':_0x26d88f,'XMD-CALLERID-PREVIEW':_0x3b8cd9?util[_0x3de3('0x11')](_0x3de3('0x12'),_0x3b8cd9['calleridname'],_0x3b8cd9[_0x3de3('0x19')]):_0x26d88f,'XMD-DIALID':_0x5c5adf,'XMD-CONTACTID':_0x24bc36[_0x3de3('0x1a')],'XMD-CDRTYPE':_0x3de3('0x1b'),'CALLERID(all)':_0x26d88f,'XMD-VOICEQUEUEID':_0x24bc36['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4f2fed,'XMD-DIALTIMEOUT':_0x298d4d[_0x3de3('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x3de3('0x11')](_0x3de3('0x1d'),_0x298d4d[_0x3de3('0x1e')]?'g':'',_[_0x3de3('0x10')](_0x298d4d[_0x3de3('0x1f')])?'':_0x3de3('0x20')),'XMD-DIALURL':_0x298d4d[_0x3de3('0x21')]||'','XMD-AGI':_0x298d4d['dialQueueProject']?util['format'](_0x3de3('0x22'),ipAgi,_0x298d4d[_0x3de3('0x23')]):_0x3de3('0x24'),'XMD-AGIAFTER':_0x298d4d[_0x3de3('0x1e')]?util[_0x3de3('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x298d4d[_0x3de3('0x1e')]):_0x3de3('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x3b8cd9?_0x3b8cd9[_0x3de3('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x3b8cd9?_0x3b8cd9[_0x3de3('0x26')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x3de3('0x27')};if(!_[_0x3de3('0x10')](_0x298d4d[_0x3de3('0x1f')])){_0x24aac5[util[_0x3de3('0x11')]('%s',_0x3de3('0x28'))]=_0x298d4d[_0x3de3('0x1f')];_0x24aac5[util[_0x3de3('0x11')]('%s',_0x3de3('0x29'))]=_0x5c5adf;}return _0x24aac5;};exports[_0x3de3('0x2a')]=function(_0x4548f5){var _0x16d3ec={};for(var _0x515bc2 in _0x4548f5){if(_0x4548f5[_0x3de3('0x2b')](_0x515bc2)){_0x16d3ec[util[_0x3de3('0x11')]('%s',_['toLower'](_0x515bc2))]=_0x4548f5[_0x515bc2];}}return{'variables':_0x16d3ec};};exports['updateOriginated']=function(_0x4105c6,_0x45ed1b){if(!_['isNil'](_0x4105c6)){if(_0x4105c6['hasOwnProperty'](_0x3de3('0x2c'))){if(_0x4105c6['originated']>0x0){_0x4105c6[_0x3de3('0x2c')]-=0x1;}else{logger[_0x3de3('0x2d')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x45ed1b);}}}else{logger[_0x3de3('0x2d')](_0x3de3('0x2e'),_0x45ed1b);}};exports[_0x3de3('0x2f')]=function(_0x258208){var _0x542af4=moment()[_0x3de3('0x11')](_0x3de3('0x30'));_0x258208[_0x3de3('0x31')]=0xd;_0x258208[_0x3de3('0x32')]=_0x3de3('0x33');_0x258208[_0x3de3('0x34')]=_0x542af4;_0x258208[_0x3de3('0x35')]=_0x542af4;_0x258208['endtime']=_0x542af4;};exports[_0x3de3('0x36')]=function(_0x351504,_0x1c4b2f,_0x2f3047){var _0x2998db=moment()[_0x3de3('0x11')](_0x3de3('0x30'));_0x351504[_0x3de3('0x31')]=_0x1c4b2f;_0x351504[_0x3de3('0x32')]=_0x2f3047;_0x351504['responsetime']=_0x2998db;_0x351504[_0x3de3('0x37')]=utils['getSeconds'](_0x351504['responsetime'],_0x351504[_0x3de3('0x34')]);};exports[_0x3de3('0x38')]=function(_0x373673,_0x8ec97a,_0x225611){_0x373673[_0x3de3('0x39')]=_0x8ec97a;_0x373673[_0x3de3('0x3a')]=_0x225611;};exports[_0x3de3('0x3b')]=function(_0x1c7ec4,_0x1acfe1,_0x3cfa72){var _0x51e2ee=moment()[_0x3de3('0x11')](_0x3de3('0x30'));_0x1c7ec4['state']=_0x1acfe1;_0x1c7ec4['statedesc']=_0x3cfa72;_0x1c7ec4[_0x3de3('0x35')]=_0x1c7ec4[_0x3de3('0x35')]?_0x1c7ec4[_0x3de3('0x35')]:_0x51e2ee;_0x1c7ec4[_0x3de3('0x3c')]=_0x1c7ec4[_0x3de3('0x3c')]?_0x1c7ec4[_0x3de3('0x3c')]:_0x51e2ee;_0x1c7ec4[_0x3de3('0x37')]=utils[_0x3de3('0x3d')](_0x1c7ec4[_0x3de3('0x35')]||0x0,_0x1c7ec4[_0x3de3('0x34')]||0x0);_0x1c7ec4[_0x3de3('0x3e')]=_0x1c7ec4[_0x3de3('0x3f')]?utils[_0x3de3('0x3d')](_0x1c7ec4[_0x3de3('0x3c')],_0x1c7ec4[_0x3de3('0x3f')]):0x0;};exports[_0x3de3('0x40')]=function(_0x45095d){return _0x45095d===_0x3de3('0x41');};exports[_0x3de3('0x42')]=function(_0x247310,_0x3be376,_0x5f1fd7,_0x4351ef,_0x342876){var _0x2c2849=_0x4351ef?'RECALL':_0x247310[_0x3de3('0x43')];_0x2c2849=_0x342876?'BOOKED':_0x2c2849;return{'actionid':_0x247310['uniqueid'],'action':_0x3de3('0x44'),'channel':_0x247310[_0x3de3('0x45')],'callerid':util[_0x3de3('0x11')]('\x22%s\x22\x20<%s>',_0x2c2849,_0x247310[_0x3de3('0x19')]),'Exten':_0x3de3('0x46'),'Context':_0x3de3('0x47'),'Priority':'1','variable':_0x5f1fd7,'timeout':(_0x3be376[_0x3de3('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x247310[_0x3de3('0x49')]};};exports[_0x3de3('0x4a')]=function(_0x20390f){return _0x20390f['countbusyretry']+_0x20390f['countcongestionretry']+_0x20390f[_0x3de3('0x4b')]+_0x20390f[_0x3de3('0x4c')]+_0x20390f[_0x3de3('0x4d')];};exports[_0x3de3('0x4e')]=function(_0x8bf44e){var _0x4e3bb6=_[_0x3de3('0x4f')](_0x8bf44e);_0x4e3bb6[_0x3de3('0x31')]=0xf;_0x4e3bb6[_0x3de3('0x32')]=_0x3de3('0x50');return _0x4e3bb6;};exports['scheduledAt']=function(_0x2119f0,_0x242c7d,_0x546a08){var _0x569eaf={};_0x569eaf[_0x242c7d]=_0x2119f0[_0x242c7d];_0x569eaf['active']=![];_0x569eaf['scheduledat']=moment()[_0x3de3('0x51')](_0x546a08,_0x3de3('0x52'))[_0x3de3('0x11')](_0x3de3('0x30'));_0x569eaf['ContactId']=_0x2119f0[_0x3de3('0x1a')];_0x569eaf[_0x3de3('0x53')]=_0x2119f0[_0x3de3('0x53')];_0x569eaf[_0x3de3('0x54')]=_0x2119f0[_0x3de3('0x54')]||undefined;return _0x569eaf;};exports['decrementTalkink']=function(_0x9bce47,_0x39f3d7){if(!_[_0x3de3('0x15')](_0x9bce47)){if(_0x9bce47[_0x3de3('0x55')]>0x0){_0x9bce47[_0x3de3('0x55')]-=0x1;}else{logger['error'](_0x39f3d7,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x3de3('0x2d')](_0x39f3d7,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x594053){if(_0x594053<=0x0){return!![];}return![];};function buildObj(_0x792670,_0x5905cf,_0x436533){_0x792670[_0x3de3('0x56')]=_0x5905cf;_0x792670[_0x3de3('0x18')]=_0x792670[_0x3de3('0x57')];_0x792670[_0x3de3('0x58')]=_0x792670[_0x3de3('0x45')];_0x792670[_0x3de3('0x59')]=_0x3de3('0x5a');if(_0x436533){_0x792670[_0x3de3('0x5b')]=_0x436533[_0x3de3('0x5b')];}return _0x792670;}exports[_0x3de3('0x5c')]=buildObj;exports[_0x3de3('0x5d')]=function(_0x3a7779){var _0x40f475=[];for(var _0x146bff in _0x3a7779){if(_0x3a7779[_0x3de3('0x2b')](_0x146bff)){if(!_['isNil'](_0x3a7779[_0x146bff])&&_0x3a7779[_0x146bff][_0x3de3('0x31')]==='not_inuse'&&_0x3a7779[_0x146bff][_0x3de3('0x5e')]===_0x3de3('0x5f')){_0x40f475[_0x3de3('0x60')](_0x3a7779[_0x146bff]['id']);}}}return _0x40f475;};exports[_0x3de3('0x61')]=function(_0x6bd4ef){var _0x461f9e=moment()[_0x3de3('0x62')](0x0);var _0x4e6b32=moment(_0x6bd4ef)['milliseconds'](0x0);return _0x461f9e[_0x3de3('0x63')](_0x4e6b32,'seconds');};exports[_0x3de3('0x64')]=function(_0x2e6b64){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2e6b64[_0x3de3('0x1a')],'ListId':_0x2e6b64[_0x3de3('0x53')],'VoiceQueueId':_0x2e6b64['VoiceQueueId']||undefined,'CampaignId':_0x2e6b64[_0x3de3('0x65')]||undefined};};exports[_0x3de3('0x66')]=function(_0x23c13d){if(_0x23c13d===_0x3de3('0x49')||_0x23c13d===_0x3de3('0x67')||_0x23c13d==='queue'||_0x23c13d===_0x3de3('0x68')||_0x23c13d===_0x3de3('0x69')||_0x23c13d===_0x3de3('0x6a')||_0x23c13d===_0x3de3('0x39')||_0x23c13d===_0x3de3('0x45')||_0x23c13d===_0x3de3('0x43')||_0x23c13d===_0x3de3('0x6b')||_0x23c13d===_0x3de3('0x19')||_0x23c13d===_0x3de3('0x6c')||_0x23c13d===_0x3de3('0x6d')||_0x23c13d===_0x3de3('0x6e')||_0x23c13d===_0x3de3('0x4b')||_0x23c13d===_0x3de3('0x6f')||_0x23c13d==='callback'||_0x23c13d===_0x3de3('0x70')||_0x23c13d===_0x3de3('0x71')||_0x23c13d===_0x3de3('0x72')||_0x23c13d==='ContactId'||_0x23c13d===_0x3de3('0x53')||_0x23c13d===_0x3de3('0x3a')||_0x23c13d==='VoiceQueueId'||_0x23c13d===_0x3de3('0x73')||_0x23c13d==='xmd-voicequeueid'||_0x23c13d===_0x3de3('0x74')||_0x23c13d===_0x3de3('0x75')||_0x23c13d===_0x3de3('0x76')||_0x23c13d===_0x3de3('0x77')||_0x23c13d===_0x3de3('0x78')||_0x23c13d===_0x3de3('0x79')||_0x23c13d===_0x3de3('0x7a')||_0x23c13d===_0x3de3('0x7b')||_0x23c13d==='xmd-contactid'||_0x23c13d==='xmd-cdrtype'||_0x23c13d===_0x3de3('0x7c')||_0x23c13d===_0x3de3('0x7d')||_0x23c13d===_0x3de3('0x7e')||_0x23c13d==='rtpaudioqos'||_0x23c13d===_0x3de3('0x7f')||_0x23c13d===_0x3de3('0x80')||_0x23c13d===_0x3de3('0x81')||_0x23c13d===_0x3de3('0x82')||_0x23c13d===_0x3de3('0x83')||_0x23c13d===_0x3de3('0x84')||_0x23c13d===_0x3de3('0x85')||_0x23c13d===_0x3de3('0x86')||_0x23c13d===_0x3de3('0x7f')||_0x23c13d===_0x3de3('0x80')||_0x23c13d==='rtpaudioqosjitterbridged'||_0x23c13d===_0x3de3('0x82')||_0x23c13d==='rtpaudioqoslossbridged'||_0x23c13d==='rtpaudioqosrtt'||_0x23c13d==='rtpaudioqosrttbridged'||_0x23c13d===_0x3de3('0x87')||_0x23c13d===_0x3de3('0x88')||_0x23c13d===_0x3de3('0x31')||_0x23c13d===_0x3de3('0x32')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5ef170,_0x421aa3){var _0x507ac7,_0x545c50,_0x47ebfa;if(_0x421aa3<=0x0){_0x421aa3=0x1;}_0x507ac7=new RegExp(_0x3de3('0x89')+_0x421aa3+'}$');_0x545c50=Math[_0x3de3('0x8a')](0xa,_0x421aa3-0x1);_0x47ebfa=Math['pow'](0xa,_0x421aa3)-0x1;return util[_0x3de3('0x11')]('%s',_['replace'](_0x5ef170,_0x507ac7,_['random'](_0x545c50,_0x47ebfa)));};exports['extractCalleridName']=function(_0x517261){var _0x2fb00b=_0x517261['match'](/"(.*?)"/);return _0x2fb00b?_0x2fb00b[0x1]:_0x517261;};exports[_0x3de3('0x8b')]=function(_0x5b33ac){var _0x305fe2=_0x5b33ac[_0x3de3('0x8c')](/<(.*?)>/);return _0x305fe2?_0x305fe2[0x1]:_0x5b33ac;};function buildNoAnswerEventPayload(_0x23ed4f,_0x129137){var _0x48ca62=buildObj(_0x23ed4f,_0x3de3('0x8d'));if(!_['isEmpty'](_0x129137[_0x3de3('0x8e')])){Object['keys'](_0x129137[_0x3de3('0x8e')])['forEach'](function(_0x5df3b0){_0x48ca62[_0x5df3b0[_0x3de3('0x8f')]()]=_0x129137[_0x3de3('0x8e')][_0x5df3b0];});}return _0x48ca62;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x4b26=['random','extractCalleridName','match','extractCalleridNumber','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','logger','inspect','loggerError','info','message','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','getSeconds','logLookAgent','membername','logCustomer','endtime','talktime','answertime','isFailure','variablesAction','RECALL','calleridname','BOOKED','originate','channelAgent','from-sip','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','queue','voice','mandatoryDisposition','agentReadyId','not_inuse','status','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','type','campaigntype','countglobal','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4b26,0x98));var _0x64b2=function(_0x59cf64,_0x9c2955){_0x59cf64=_0x59cf64-0x0;var _0x13ec35=_0x4b26[_0x59cf64];return _0x13ec35;};'use strict';var util=require(_0x64b2('0x0'));var _=require(_0x64b2('0x1'));var moment=require(_0x64b2('0x2'));var logger=require(_0x64b2('0x3'))(_0x64b2('0x4'));var ipAgi=process['env'][_0x64b2('0x5')]||_0x64b2('0x6');var utils=require(_0x64b2('0x7'));exports[_0x64b2('0x8')]=function(_0xba2ed0){return function(_0x3b42f5){logger[_0x64b2('0x9')](_0xba2ed0,util['inspect'](_0x3b42f5,{'showHidden':![],'depth':null}));};};exports[_0x64b2('0xa')]=function(_0x4c646d,_0x1207f2){logger['info'](_0x4c646d,util[_0x64b2('0xb')](_0x1207f2,{'showHidden':![],'depth':null}));};exports[_0x64b2('0xc')]=function(_0x57a753,_0xf97ee2){logger[_0x64b2('0x9')](_0x57a753,util[_0x64b2('0xb')](_0xf97ee2,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4504f0){return function(_0x2f1070){logger[_0x64b2('0xd')](_0x4504f0,util[_0x64b2('0xb')](_0x2f1070,{'showHidden':![],'depth':null}));};};exports[_0x64b2('0xe')]=function(_0xc57a31,_0x119f1b,_0x401cff){return{'message':_0xc57a31,'unlock':_0x119f1b,'active':_0x401cff};};exports['getCallerId']=function(_0x384bd3,_0x2cabe0,_0x22c2f6){if(!_[_0x64b2('0xf')](_0x22c2f6)&&'string'===typeof _0x22c2f6&&!_[_0x64b2('0x10')](_0x22c2f6)){if(!_[_0x64b2('0xf')](_0x2cabe0)&&_0x64b2('0x11')===typeof _0x2cabe0&&!_['isEmpty'](_0x2cabe0)){return util[_0x64b2('0x12')](_0x64b2('0x13'),_0x2cabe0,_0x22c2f6);}return util[_0x64b2('0x12')](_0x64b2('0x13'),_0x22c2f6,_0x22c2f6);}if(!_['isUndefined'](_0x384bd3)&&_0x64b2('0x11')===typeof _0x384bd3&&!_['isEmpty'](_0x384bd3)){return _0x384bd3;}return _0x64b2('0x14');};exports[_0x64b2('0x15')]=function(_0x38ff8c){if(_[_0x64b2('0x16')](_0x38ff8c)){return![];}return _0x38ff8c;};exports['addVariables']=function(_0x15dd5c,_0x60d5f8,_0x33a83e,_0x1c1dd2,_0x5446e7,_0x5f393f){var _0x219dc8={'XMD-QUEUE':_0x60d5f8[_0x64b2('0x17')]?_0x60d5f8[_0x64b2('0x17')][_0x64b2('0x18')]:'','XMD-CALLERID':_0x1c1dd2,'XMD-CALLERID-PREVIEW':_0x5f393f?util['format'](_0x64b2('0x13'),_0x5f393f['calleridname'],_0x5f393f[_0x64b2('0x19')]):_0x1c1dd2,'XMD-DIALID':_0x5446e7,'XMD-CONTACTID':_0x60d5f8[_0x64b2('0x1a')],'XMD-CDRTYPE':_0x64b2('0x1b'),'CALLERID(all)':_0x1c1dd2,'XMD-VOICEQUEUEID':_0x60d5f8[_0x64b2('0x1c')],'XMD-DIALCHANNEL':_0x33a83e,'XMD-DIALTIMEOUT':_0x15dd5c[_0x64b2('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x64b2('0x12')](_0x64b2('0x1e'),_0x15dd5c[_0x64b2('0x1f')]?'g':'',_['isEmpty'](_0x15dd5c[_0x64b2('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x15dd5c[_0x64b2('0x21')]||'','XMD-AGI':_0x15dd5c[_0x64b2('0x22')]?util[_0x64b2('0x12')](_0x64b2('0x23'),ipAgi,_0x15dd5c[_0x64b2('0x22')]):_0x64b2('0x24'),'XMD-AGIAFTER':_0x15dd5c['dialQueueProject2']?util['format'](_0x64b2('0x23'),ipAgi,_0x15dd5c[_0x64b2('0x1f')]):_0x64b2('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x5f393f?_0x5f393f[_0x64b2('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x5f393f?_0x5f393f[_0x64b2('0x26')]:'','XMD-DESTINATION':_0x64b2('0x27'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x64b2('0x10')](_0x15dd5c['monitor_format'])){_0x219dc8[util[_0x64b2('0x12')]('%s',_0x64b2('0x28'))]=_0x15dd5c[_0x64b2('0x20')];_0x219dc8[util[_0x64b2('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x5446e7;}return _0x219dc8;};exports['toLowerVariables']=function(_0x111f53){var _0x265122={};for(var _0x2c23fe in _0x111f53){if(_0x111f53[_0x64b2('0x29')](_0x2c23fe)){_0x265122[util[_0x64b2('0x12')]('%s',_[_0x64b2('0x2a')](_0x2c23fe))]=_0x111f53[_0x2c23fe];}}return{'variables':_0x265122};};exports[_0x64b2('0x2b')]=function(_0x3a2a74,_0x454db6){if(!_[_0x64b2('0x16')](_0x3a2a74)){if(_0x3a2a74['hasOwnProperty']('originated')){if(_0x3a2a74[_0x64b2('0x2c')]>0x0){_0x3a2a74[_0x64b2('0x2c')]-=0x1;}else{logger[_0x64b2('0x9')](_0x64b2('0x2d'),_0x454db6);}}}else{logger['error'](_0x64b2('0x2e'),_0x454db6);}};exports[_0x64b2('0x2f')]=function(_0x57beea){var _0x211d4b=moment()[_0x64b2('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x57beea[_0x64b2('0x30')]=0xd;_0x57beea[_0x64b2('0x31')]=_0x64b2('0x32');_0x57beea[_0x64b2('0x33')]=_0x211d4b;_0x57beea['responsetime']=_0x211d4b;_0x57beea['endtime']=_0x211d4b;};exports[_0x64b2('0x34')]=function(_0x20c993,_0x211b11,_0x48db9a){var _0x556b21=moment()[_0x64b2('0x12')](_0x64b2('0x35'));_0x20c993[_0x64b2('0x30')]=_0x211b11;_0x20c993['statedesc']=_0x48db9a;_0x20c993[_0x64b2('0x36')]=_0x556b21;_0x20c993[_0x64b2('0x37')]=utils[_0x64b2('0x38')](_0x20c993['responsetime'],_0x20c993[_0x64b2('0x33')]);};exports[_0x64b2('0x39')]=function(_0x2d5b14,_0x2f8023,_0x581475){_0x2d5b14[_0x64b2('0x3a')]=_0x2f8023;_0x2d5b14['UserId']=_0x581475;};exports[_0x64b2('0x3b')]=function(_0x3a6a6c,_0x374805,_0xfe9a14){var _0x393a86=moment()['format'](_0x64b2('0x35'));_0x3a6a6c['state']=_0x374805;_0x3a6a6c[_0x64b2('0x31')]=_0xfe9a14;_0x3a6a6c[_0x64b2('0x36')]=_0x3a6a6c[_0x64b2('0x36')]?_0x3a6a6c['responsetime']:_0x393a86;_0x3a6a6c[_0x64b2('0x3c')]=_0x3a6a6c[_0x64b2('0x3c')]?_0x3a6a6c['endtime']:_0x393a86;_0x3a6a6c[_0x64b2('0x37')]=utils[_0x64b2('0x38')](_0x3a6a6c['responsetime']||0x0,_0x3a6a6c['starttime']||0x0);_0x3a6a6c[_0x64b2('0x3d')]=_0x3a6a6c[_0x64b2('0x3e')]?utils[_0x64b2('0x38')](_0x3a6a6c[_0x64b2('0x3c')],_0x3a6a6c[_0x64b2('0x3e')]):0x0;};exports[_0x64b2('0x3f')]=function(_0x3899fa){return _0x3899fa==='Failure';};exports[_0x64b2('0x40')]=function(_0x4d8465,_0x2f32c7,_0x1e7e01,_0x1a3230,_0x3b47df){var _0x1ed9aa=_0x1a3230?_0x64b2('0x41'):_0x4d8465[_0x64b2('0x42')];_0x1ed9aa=_0x3b47df?_0x64b2('0x43'):_0x1ed9aa;return{'actionid':_0x4d8465['uniqueid'],'action':_0x64b2('0x44'),'channel':_0x4d8465[_0x64b2('0x45')],'callerid':util[_0x64b2('0x12')]('\x22%s\x22\x20<%s>',_0x1ed9aa,_0x4d8465[_0x64b2('0x19')]),'Exten':_0x64b2('0x27'),'Context':_0x64b2('0x46'),'Priority':'1','variable':_0x1e7e01,'timeout':(_0x2f32c7['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4d8465[_0x64b2('0x47')]};};exports[_0x64b2('0x48')]=function(_0x4bd50e){return _0x4bd50e[_0x64b2('0x49')]+_0x4bd50e[_0x64b2('0x4a')]+_0x4bd50e[_0x64b2('0x4b')]+_0x4bd50e[_0x64b2('0x4c')]+_0x4bd50e[_0x64b2('0x4d')];};exports[_0x64b2('0x4e')]=function(_0x357c39){var _0x1b5ae6=_[_0x64b2('0x4f')](_0x357c39);_0x1b5ae6[_0x64b2('0x30')]=0xf;_0x1b5ae6[_0x64b2('0x31')]=_0x64b2('0x50');return _0x1b5ae6;};exports['scheduledAt']=function(_0x5f5cee,_0x24e7b2,_0x25448f){var _0xaf1574={};_0xaf1574[_0x24e7b2]=_0x5f5cee[_0x24e7b2];_0xaf1574[_0x64b2('0x51')]=![];_0xaf1574[_0x64b2('0x52')]=moment()[_0x64b2('0x53')](_0x25448f,_0x64b2('0x54'))[_0x64b2('0x12')](_0x64b2('0x35'));_0xaf1574[_0x64b2('0x1a')]=_0x5f5cee[_0x64b2('0x1a')];_0xaf1574[_0x64b2('0x55')]=_0x5f5cee[_0x64b2('0x55')];_0xaf1574[_0x64b2('0x1c')]=_0x5f5cee[_0x64b2('0x1c')]||undefined;return _0xaf1574;};exports[_0x64b2('0x56')]=function(_0xca480c,_0x212933){if(!_['isNil'](_0xca480c)){if(_0xca480c[_0x64b2('0x57')]>0x0){_0xca480c['pTalking']-=0x1;}else{logger[_0x64b2('0x9')](_0x212933,_0x64b2('0x58'));}}else{logger[_0x64b2('0x9')](_0x212933,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x64b2('0x59')]=function(_0x486743){if(_0x486743<=0x0){return!![];}return![];};function buildObj(_0x22eca6,_0x3197e4,_0x16119e){_0x22eca6['lastevent']=_0x3197e4;_0x22eca6[_0x64b2('0x18')]=_0x22eca6[_0x64b2('0x5a')];_0x22eca6['interface']=_0x22eca6[_0x64b2('0x45')];_0x22eca6['motionChannel']=_0x64b2('0x5b');if(_0x16119e){_0x22eca6[_0x64b2('0x5c')]=_0x16119e[_0x64b2('0x5c')];}return _0x22eca6;}exports['buildObj']=buildObj;exports[_0x64b2('0x5d')]=function(_0x375fff){var _0x1fe630=[];for(var _0x282e10 in _0x375fff){if(_0x375fff[_0x64b2('0x29')](_0x282e10)){if(!_['isNil'](_0x375fff[_0x282e10])&&_0x375fff[_0x282e10]['state']===_0x64b2('0x5e')&&_0x375fff[_0x282e10][_0x64b2('0x5f')]==='reachable'){_0x1fe630[_0x64b2('0x60')](_0x375fff[_0x282e10]['id']);}}}return _0x1fe630;};exports[_0x64b2('0x61')]=function(_0x52c216){var _0x410966=moment()[_0x64b2('0x62')](0x0);var _0x3e4a99=moment(_0x52c216)[_0x64b2('0x62')](0x0);return _0x410966[_0x64b2('0x63')](_0x3e4a99,_0x64b2('0x64'));};exports[_0x64b2('0x65')]=function(_0x13579d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x13579d[_0x64b2('0x1a')],'ListId':_0x13579d[_0x64b2('0x55')],'VoiceQueueId':_0x13579d[_0x64b2('0x1c')]||undefined,'CampaignId':_0x13579d['CampaignId']||undefined};};exports[_0x64b2('0x66')]=function(_0x3b292a){if(_0x3b292a===_0x64b2('0x47')||_0x3b292a==='idContact'||_0x3b292a===_0x64b2('0x5a')||_0x3b292a===_0x64b2('0x67')||_0x3b292a===_0x64b2('0x68')||_0x3b292a==='dialAnswer'||_0x3b292a===_0x64b2('0x3a')||_0x3b292a===_0x64b2('0x45')||_0x3b292a===_0x64b2('0x42')||_0x3b292a===_0x64b2('0x51')||_0x3b292a===_0x64b2('0x19')||_0x3b292a===_0x64b2('0x52')||_0x3b292a===_0x64b2('0x49')||_0x3b292a===_0x64b2('0x4a')||_0x3b292a===_0x64b2('0x4b')||_0x3b292a===_0x64b2('0x69')||_0x3b292a==='callback'||_0x3b292a==='callbackuniqueid'||_0x3b292a===_0x64b2('0x6a')||_0x3b292a===_0x64b2('0x6b')||_0x3b292a===_0x64b2('0x1a')||_0x3b292a===_0x64b2('0x55')||_0x3b292a===_0x64b2('0x6c')||_0x3b292a===_0x64b2('0x1c')||_0x3b292a===_0x64b2('0x6d')||_0x3b292a===_0x64b2('0x6e')||_0x3b292a===_0x64b2('0x6f')||_0x3b292a===_0x64b2('0x70')||_0x3b292a===_0x64b2('0x71')||_0x3b292a===_0x64b2('0x72')||_0x3b292a===_0x64b2('0x73')||_0x3b292a===_0x64b2('0x74')||_0x3b292a===_0x64b2('0x75')||_0x3b292a===_0x64b2('0x76')||_0x3b292a===_0x64b2('0x77')||_0x3b292a===_0x64b2('0x78')||_0x3b292a===_0x64b2('0x79')||_0x3b292a==='xmd-agiafter'||_0x3b292a===_0x64b2('0x7a')||_0x3b292a==='rtpaudioqos'||_0x3b292a==='rtpaudioqosbridged'||_0x3b292a==='rtpaudioqosjitter'||_0x3b292a==='rtpaudioqosjitterbridged'||_0x3b292a===_0x64b2('0x7b')||_0x3b292a===_0x64b2('0x7c')||_0x3b292a==='rtpaudioqosrtt'||_0x3b292a===_0x64b2('0x7d')||_0x3b292a==='rtpaudioqos'||_0x3b292a===_0x64b2('0x7e')||_0x3b292a===_0x64b2('0x7f')||_0x3b292a===_0x64b2('0x80')||_0x3b292a===_0x64b2('0x7b')||_0x3b292a===_0x64b2('0x7c')||_0x3b292a==='rtpaudioqosrtt'||_0x3b292a===_0x64b2('0x7d')||_0x3b292a===_0x64b2('0x81')||_0x3b292a==='bridgepvtcallid'||_0x3b292a==='state'||_0x3b292a===_0x64b2('0x31')){return![];}return!![];};exports[_0x64b2('0x82')]=function(_0x56e8b6,_0x5b4e27){var _0xab55fe,_0x1ebbc1,_0x41c24a;if(_0x5b4e27<=0x0){_0x5b4e27=0x1;}_0xab55fe=new RegExp(_0x64b2('0x83')+_0x5b4e27+'}$');_0x1ebbc1=Math[_0x64b2('0x84')](0xa,_0x5b4e27-0x1);_0x41c24a=Math[_0x64b2('0x84')](0xa,_0x5b4e27)-0x1;return util[_0x64b2('0x12')]('%s',_[_0x64b2('0x85')](_0x56e8b6,_0xab55fe,_[_0x64b2('0x86')](_0x1ebbc1,_0x41c24a)));};exports[_0x64b2('0x87')]=function(_0x3d4f31){var _0x1fdf43=_0x3d4f31[_0x64b2('0x88')](/"(.*?)"/);return _0x1fdf43?_0x1fdf43[0x1]:_0x3d4f31;};exports[_0x64b2('0x89')]=function(_0x48128b){var _0x5ea4ee=_0x48128b[_0x64b2('0x88')](/<(.*?)>/);return _0x5ea4ee?_0x5ea4ee[0x1]:_0x48128b;};function buildNoAnswerEventPayload(_0x272cc6,_0x370aa0){var _0x30be0e=buildObj(_0x272cc6,'noanswer');if(!_[_0x64b2('0x10')](_0x370aa0['variables'])){Object[_0x64b2('0x8a')](_0x370aa0[_0x64b2('0x8b')])[_0x64b2('0x8c')](function(_0x386327){_0x30be0e[_0x386327[_0x64b2('0x8d')]()]=_0x370aa0[_0x64b2('0x8b')][_0x386327];});}return _0x30be0e;}exports[_0x64b2('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3f07e61..7ae433c 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 _0x9b46=['queueadd','string','number','boolean','queueremove','queuepause','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x4d72d1,_0x23e4e6){var _0x2dcaff=function(_0x3b7088){while(--_0x3b7088){_0x4d72d1['push'](_0x4d72d1['shift']());}};_0x2dcaff(++_0x23e4e6);}(_0x9b46,0xea));var _0x69b4=function(_0x2d4958,_0x46806d){_0x2d4958=_0x2d4958-0x0;var _0x2cd107=_0x9b46[_0x2d4958];return _0x2cd107;};'use strict';exports[_0x69b4('0x0')]={'queue':{'type':_0x69b4('0x1'),'required':!![]},'interface':{'type':_0x69b4('0x1'),'required':!![]},'membername':{'type':_0x69b4('0x1'),'required':!![]},'penalty':{'type':_0x69b4('0x2'),'required':![]},'paused':{'type':_0x69b4('0x3'),'required':![]}};exports[_0x69b4('0x4')]={'queue':{'type':_0x69b4('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0x69b4('0x5')]={'interface':{'type':_0x69b4('0x1'),'required':!![]},'paused':{'type':_0x69b4('0x3')},'reason':{'type':_0x69b4('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x69b4('0x1'),'required':!![]}};exports[_0x69b4('0x6')]={'uniqueid':{'type':_0x69b4('0x1'),'required':!![]},'filename':{'type':_0x69b4('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x69b4('0x1')}};exports[_0x69b4('0x7')]={'uniqueid':{'type':_0x69b4('0x1'),'required':!![]}};exports[_0x69b4('0x8')]={'uniqueid':{'type':_0x69b4('0x1'),'required':!![]},'exten':{'type':_0x69b4('0x1'),'required':!![]},'context':{'type':_0x69b4('0x1')}}; \ No newline at end of file +var _0xb8e2=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','voicequeuechannel','voicechannel'];(function(_0x6c32ac,_0x4d1c5c){var _0x38ce7e=function(_0x565382){while(--_0x565382){_0x6c32ac['push'](_0x6c32ac['shift']());}};_0x38ce7e(++_0x4d1c5c);}(_0xb8e2,0x16e));var _0x2b8e=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0xb8e2[_0x1deee5];return _0x1d6c3a;};'use strict';exports[_0x2b8e('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x2b8e('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x2b8e('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x2b8e('0x1'),'required':!![]},'interface':{'type':_0x2b8e('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x2b8e('0x1'),'required':!![]},'paused':{'type':_0x2b8e('0x2')},'reason':{'type':_0x2b8e('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x2b8e('0x3')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x2b8e('0x4')]={'uniqueid':{'type':_0x2b8e('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x2b8e('0x1')},'mixmonitorid':{'type':_0x2b8e('0x1')}};exports[_0x2b8e('0x5')]={'uniqueid':{'type':_0x2b8e('0x1'),'required':!![]}};exports[_0x2b8e('0x6')]={'uniqueid':{'type':_0x2b8e('0x1'),'required':!![]},'exten':{'type':_0x2b8e('0x1'),'required':!![]},'context':{'type':_0x2b8e('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index c980f66..0c84e00 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x517483,_0x3bee35){var _0x3fb283=function(_0x4f465d){while(--_0x4f465d){_0x517483['push'](_0x517483['shift']());}};_0x3fb283(++_0x3bee35);}(_0xadb5,0xad));var _0x5adb=function(_0x3bdd38,_0x3a17a4){_0x3bdd38=_0x3bdd38-0x0;var _0x2656e7=_0xadb5[_0x3bdd38];return _0x2656e7;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0x39e4b7,_0x4f6227){var _0x30647c=function(_0x20938b){while(--_0x20938b){_0x39e4b7['push'](_0x39e4b7['shift']());}};_0x30647c(++_0x4f6227);}(_0x757a,0xde));var _0xa757=function(_0x4d3793,_0x5a83c8){_0x4d3793=_0x4d3793-0x0;var _0x262002=_0x757a[_0x4d3793];return _0x262002;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index e352222..e1d2186 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 _0x4e63=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x20140a,_0x1684d5){var _0x2b5fb6=function(_0x289323){while(--_0x289323){_0x20140a['push'](_0x20140a['shift']());}};_0x2b5fb6(++_0x1684d5);}(_0x4e63,0x19d));var _0x34e6=function(_0x302d2a,_0x20761f){_0x302d2a=_0x302d2a-0x0;var _0xda1beb=_0x4e63[_0x302d2a];return _0xda1beb;};'use strict';function mergeDBDataToRealtime(_0x41365d,_0x7da06c){var _0x5c2a88=Object[_0x34e6('0x0')]({},_0x41365d);for(var _0x44278f in _0x7da06c){if(_0x5c2a88[_0x34e6('0x1')](_0x44278f)){_0x5c2a88[_0x44278f]=_0x7da06c[_0x44278f];}}return _0x5c2a88;}exports[_0x34e6('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x6b05=['hasOwnProperty','mergeDBDataToRealtime'];(function(_0x352a56,_0x3fbf13){var _0x30ba2b=function(_0x4ab5e7){while(--_0x4ab5e7){_0x352a56['push'](_0x352a56['shift']());}};_0x30ba2b(++_0x3fbf13);}(_0x6b05,0x1be));var _0x56b0=function(_0x15adb9,_0xf2c816){_0x15adb9=_0x15adb9-0x0;var _0x55ea70=_0x6b05[_0x15adb9];return _0x55ea70;};'use strict';function mergeDBDataToRealtime(_0x5b0aa7,_0x3510c4){var _0x425ed6=Object['assign']({},_0x5b0aa7);for(var _0x4be3ec in _0x3510c4){if(_0x425ed6[_0x56b0('0x0')](_0x4be3ec)){_0x425ed6[_0x4be3ec]=_0x3510c4[_0x4be3ec];}}return _0x425ed6;}exports[_0x56b0('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 17f1998..9070336 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 _0xd0cb=['from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitors','monitorFilename','filename','createdAt','connectedlinename','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','interface','format','length','findAgent','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','destination','exten','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid'];(function(_0x1d6db6,_0x5b1c04){var _0x498f2b=function(_0x42dc16){while(--_0x42dc16){_0x1d6db6['push'](_0x1d6db6['shift']());}};_0x498f2b(++_0x5b1c04);}(_0xd0cb,0x19a));var _0xbd0c=function(_0x54f97e,_0x5aa5cd){_0x54f97e=_0x54f97e-0x0;var _0x40d7eb=_0xd0cb[_0x54f97e];return _0x40d7eb;};'use strict';var _=require(_0xbd0c('0x0'));var moment=require(_0xbd0c('0x1'));var util=require('util');var config=require(_0xbd0c('0x2'));var ami=require(_0xbd0c('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xbd0c('0x4'));var RpcVoiceDialReport=require(_0xbd0c('0x5'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xbd0c('0x6'));var RpcVoiceRecording=require(_0xbd0c('0x7'));var RpcVoiceTransferReport=require(_0xbd0c('0x8'));var VoiceQueueReport=require(_0xbd0c('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xbd0c('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xbd0c('0xb'));function Report(_0x25eff2){this[_0xbd0c('0xc')]=_0x25eff2;this['agents']=_0x25eff2[_0xbd0c('0xd')];this[_0xbd0c('0xe')]=_0x25eff2[_0xbd0c('0xe')];}Report[_0xbd0c('0xf')][_0xbd0c('0x10')]=function(_0xc62596){var _0x5a040e=new VoiceQueueReport(this[_0xbd0c('0xc')]);var _0x213394=new VoiceAgentReport(this[_0xbd0c('0xc')]);var _0x476750=new VoiceDialReport(this['realtime']);var _0x12760d=new VoiceCallReport(this['realtime']);var _0x11895e=new UserReport(this['realtime']);if(config['xdr']&&config[_0xbd0c('0x11')][_0xbd0c('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xbd0c('0x13')][_0xbd0c('0x14')](this));ami['on'](_0xbd0c('0x15'),this[_0xbd0c('0x16')][_0xbd0c('0x14')](this));ami['on'](_0xbd0c('0x17'),this[_0xbd0c('0x18')][_0xbd0c('0x14')](this));ami['on'](_0xbd0c('0x19'),this[_0xbd0c('0x1a')]['bind'](this));ami['on'](_0xbd0c('0x1b'),this['blindTransfer'][_0xbd0c('0x14')](this));ami['on'](_0xbd0c('0x1c'),this[_0xbd0c('0x1d')]['bind'](this));}};Report['prototype']['findAgent']=function(_0x44c3e2){var _0x4d671a;_0x4d671a=_[_0xbd0c('0x1e')](this[_0xbd0c('0xd')],function(_0x102ffd){return _0x102ffd[_0xbd0c('0x1f')]==_0x44c3e2||_0x102ffd[_0xbd0c('0x20')]==_0x44c3e2;});if(_[_0xbd0c('0x21')](_0x4d671a)){var _0x2bd38e=_['find'](this[_0xbd0c('0xe')],function(_0x93573d){return _0x93573d['accountcode']==_0x44c3e2||_0x93573d[_0xbd0c('0x20')]==_0x44c3e2;});if(_0x2bd38e){_0x4d671a=_[_0xbd0c('0x1e')](this[_0xbd0c('0xd')],function(_0x2e79d9){return _0x2e79d9[_0xbd0c('0x22')]==util[_0xbd0c('0x23')]('SIP/%s',_0x2bd38e['name']);});}}return _0x4d671a;};Report[_0xbd0c('0xf')][_0xbd0c('0x13')]=function(_0x6baa80){for(var _0x2b2d11=0x0;_0x2b2d11<_0x6baa80[_0xbd0c('0x24')];_0x2b2d11+=0x1){var _0x2badb4=this[_0xbd0c('0x25')](_0x6baa80[_0x2b2d11][_0xbd0c('0x26')]);if(_0x2badb4){_0x6baa80[_0x2b2d11][_0xbd0c('0x1f')]=_0x2badb4[_0xbd0c('0x1f')];_0x6baa80[_0x2b2d11][_0xbd0c('0x27')]=!![];_0x6baa80[_0x2b2d11][_0xbd0c('0x28')]=_0x2badb4['name'];_0x6baa80[_0x2b2d11][_0xbd0c('0x22')]=_[_0xbd0c('0x21')](_0x2badb4[_0xbd0c('0x22')])?util[_0xbd0c('0x23')](_0xbd0c('0x29'),_0x2badb4[_0xbd0c('0x20')]):_0x2badb4['interface'];if(_0x6baa80[_0x2b2d11]['queuecallercomplete']){_0x6baa80[_0x2b2d11][_0xbd0c('0x2a')]=moment()['format'](_0xbd0c('0x2b'));}if(_0x6baa80[_0x2b2d11][_0xbd0c('0x2c')]){_0x6baa80[_0x2b2d11][_0xbd0c('0x2d')]=moment()['format'](_0xbd0c('0x2b'));}RpcMemberReport[_0xbd0c('0x13')](_0x6baa80[_0x2b2d11]);}RpcVoiceQueueReport[_0xbd0c('0x2e')](_0x6baa80[_0x2b2d11]);}};function extractCalleridNumber(_0x3891b4){var _0x5c9015=_0x3891b4[_0xbd0c('0x2f')](/<(.*?)>/);return _0x5c9015?_0x5c9015[0x1]:_0x3891b4;}Report[_0xbd0c('0xf')][_0xbd0c('0x30')]=function(_0x1bee30){for(var _0x15f4c8=0x0;_0x15f4c8','linkedid','uniqueid','UserId','membername','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','startsWith','indexOf','mobile','substring','lastIndexOf','transfers','transfererlinkedid','exports','lodash','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','findAgent','accountcode','name','isNil','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','getAgentByInternal','keys','length','getCallType','channel','split','calleridnum','outbound','internal'];(function(_0x5a5c11,_0x358f6b){var _0x5d6ba7=function(_0x272c72){while(--_0x272c72){_0x5a5c11['push'](_0x5a5c11['shift']());}};_0x5d6ba7(++_0x358f6b);}(_0x4566,0xcd));var _0x6456=function(_0x3f5a1f,_0x43b9a3){_0x3f5a1f=_0x3f5a1f-0x0;var _0x115ed1=_0x4566[_0x3f5a1f];return _0x115ed1;};'use strict';var _=require(_0x6456('0x0'));var moment=require('moment');var util=require(_0x6456('0x1'));var config=require(_0x6456('0x2'));var ami=require(_0x6456('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x6456('0x4'));var RpcMemberReport=require(_0x6456('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x6456('0x6'));var RpcVoiceTransferReport=require(_0x6456('0x7'));var VoiceQueueReport=require(_0x6456('0x8'));var VoiceCallReport=require(_0x6456('0x9'));var VoiceAgentReport=require(_0x6456('0xa'));var VoiceDialReport=require(_0x6456('0xb'));var UserReport=require(_0x6456('0xc'));function Report(_0x1ed597){this['realtime']=_0x1ed597;this[_0x6456('0xd')]=_0x1ed597['agents'];this['telephones']=_0x1ed597[_0x6456('0xe')];}Report[_0x6456('0xf')][_0x6456('0x10')]=function(_0x30cae4){var _0x2212c0=new VoiceQueueReport(this[_0x6456('0x11')]);var _0x392075=new VoiceAgentReport(this['realtime']);var _0x7f0d0b=new VoiceDialReport(this['realtime']);var _0x1d9105=new VoiceCallReport(this[_0x6456('0x11')]);var _0xbe9f7d=new UserReport(this[_0x6456('0x11')]);if(config[_0x6456('0x12')]&&config[_0x6456('0x12')][_0x6456('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x6456('0x14')][_0x6456('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x6456('0x16')][_0x6456('0x15')](this));ami['on'](_0x6456('0x17'),this[_0x6456('0x18')]['bind'](this));ami['on'](_0x6456('0x19'),this[_0x6456('0x1a')][_0x6456('0x15')](this));ami['on']('blindtransfer',this[_0x6456('0x1b')][_0x6456('0x15')](this));ami['on']('attendedtransfer',this[_0x6456('0x1c')][_0x6456('0x15')](this));}};Report[_0x6456('0xf')][_0x6456('0x1d')]=function(_0x31c244){var _0x4c66e3;_0x4c66e3=_['find'](this[_0x6456('0xd')],function(_0x3fce4b){return _0x3fce4b[_0x6456('0x1e')]==_0x31c244||_0x3fce4b[_0x6456('0x1f')]==_0x31c244;});if(_[_0x6456('0x20')](_0x4c66e3)){var _0x197d1b=_['find'](this[_0x6456('0xe')],function(_0x147a5b){return _0x147a5b[_0x6456('0x1e')]==_0x31c244||_0x147a5b[_0x6456('0x1f')]==_0x31c244;});if(_0x197d1b){_0x4c66e3=_['find'](this[_0x6456('0xd')],function(_0x450f1a){return _0x450f1a[_0x6456('0x21')]==util[_0x6456('0x22')](_0x6456('0x23'),_0x197d1b['name']);});}}return _0x4c66e3;};Report[_0x6456('0xf')]['voiceQueueReport']=function(_0x34cc3c){for(var _0x513408=0x0;_0x513408<_0x34cc3c['length'];_0x513408+=0x1){var _0x2a605f=this[_0x6456('0x1d')](_0x34cc3c[_0x513408][_0x6456('0x24')]);if(_0x2a605f){_0x34cc3c[_0x513408]['accountcode']=_0x2a605f[_0x6456('0x1e')];_0x34cc3c[_0x513408][_0x6456('0x25')]=!![];_0x34cc3c[_0x513408][_0x6456('0x26')]=_0x2a605f[_0x6456('0x1f')];_0x34cc3c[_0x513408][_0x6456('0x21')]=_[_0x6456('0x20')](_0x2a605f[_0x6456('0x21')])?util[_0x6456('0x22')](_0x6456('0x23'),_0x2a605f['name']):_0x2a605f[_0x6456('0x21')];if(_0x34cc3c[_0x513408]['queuecallercomplete']){_0x34cc3c[_0x513408][_0x6456('0x27')]=moment()[_0x6456('0x22')](_0x6456('0x28'));}if(_0x34cc3c[_0x513408][_0x6456('0x29')]){_0x34cc3c[_0x513408]['queuecallerexitAt']=moment()[_0x6456('0x22')](_0x6456('0x28'));}RpcMemberReport[_0x6456('0x14')](_0x34cc3c[_0x513408]);}RpcVoiceQueueReport[_0x6456('0x2a')](_0x34cc3c[_0x513408]);}};function extractCalleridNumber(_0x74499d){var _0x47d70c=_0x74499d[_0x6456('0x2b')](/<(.*?)>/);return _0x47d70c?_0x47d70c[0x1]:_0x74499d;}Report[_0x6456('0xf')][_0x6456('0x2c')]=function(_0x5c9195){for(var _0x3fe3cf=0x0;_0x3fe3cf0x0?!![]:![];if(!_0x7967fb){return this[_0x9345('0x17')](this[_0x9345('0x46')][_0x9345('0x6b')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x3a3d6b){var _0x2e9a34=this['summary']['id'];if(this['summary']['queuestatus'][_0x2e9a34]&&this[_0x9345('0x46')][_0x9345('0x62')][_0x2e9a34][_0x3a3d6b[_0x9345('0x61')]]){this[_0x9345('0x46')]['queuestatus'][_0x2e9a34][_0x3a3d6b[_0x9345('0x61')]][_0x9345('0x10')][_0x9345('0x6c')](_0x3a3d6b);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x3ade2a){var _0x34ae69=this;try{if(this['isNotNull'](_0x3ade2a)&&this['isNotNull'](_0x3ade2a[_0x9345('0x54')])){logger[_0x9345('0x48')](_0x9345('0x6d'),util[_0x9345('0x42')](_0x3ade2a,{'showHidden':![],'depth':null}));var _0x4f7c5f=this[_0x9345('0x45')][_0x3ade2a[_0x9345('0x54')]];if(_0x4f7c5f){logger['debug'](_0x9345('0x6e'),_0x4f7c5f[_0x9345('0x5a')]);this[_0x9345('0x46')][_0x9345('0x5d')][_0x4f7c5f[_0x9345('0x5a')]]={'summaryEvent':_0x3ade2a};this[_0x9345('0x46')][_0x9345('0x6a')]+=0x1;return ami[_0x9345('0x3d')]({'action':_0x9345('0x62'),'queue':_0x4f7c5f[_0x9345('0x5a')]})[_0x9345('0x60')](function(_0x4ea3bf){if(!_0x34ae69['summary'][_0x9345('0x62')][_0x3ade2a['actionid']]){_0x34ae69[_0x9345('0x46')]['queuestatus'][_0x3ade2a[_0x9345('0x61')]]={};}_0x34ae69[_0x9345('0x46')][_0x9345('0x62')][_0x3ade2a[_0x9345('0x61')]][_0x4ea3bf['actionid']]={'queue':_0x4f7c5f[_0x9345('0x5a')],'agents':[]};})[_0x9345('0x3e')](function(_0x4c04b6){throw _0x4c04b6;});}}}catch(_0xdfb9e0){logger['error'](_0x9345('0x63'),util[_0x9345('0x42')](_0xdfb9e0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9345('0x17')]=function(_0x40c72f){if(this[_0x9345('0x46')][_0x9345('0x6a')]>0x0){this[_0x9345('0x46')][_0x9345('0x6b')]=_0x40c72f;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x40c72f,{'showHidden':![],'depth':null}));this[_0x9345('0x46')]=initializeSummary();ami['emit'](_0x9345('0x6f'),{});};VoiceQueueReport[_0x9345('0xa')][_0x9345('0x1d')]=function(_0x4314c6){try{if(this['isNotNull'](_0x4314c6)){logger[_0x9345('0x48')](_0x9345('0x70'),_0x4314c6['uniqueid'],util[_0x9345('0x42')](_0x4314c6,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x9345('0xe')][_0x4314c6[_0x9345('0x51')]])){this[_0x9345('0xe')][_0x4314c6['uniqueid']]=[];}if(_[_0x9345('0x71')](this[_0x9345('0x11')][_0x4314c6[_0x9345('0x51')]])){this['channels'][_0x4314c6[_0x9345('0x51')]]={};}var _0x325187=new QueueReport();_0x325187[_0x9345('0x54')]=_0x4314c6[_0x9345('0x54')];_0x325187[_0x9345('0x58')]=this[_0x9345('0x45')][_0x325187[_0x9345('0x54')]]&&this[_0x9345('0x45')][_0x325187[_0x9345('0x54')]][_0x9345('0x58')]?this[_0x9345('0x45')][_0x325187[_0x9345('0x54')]]['type']||'inbound':_0x9345('0x68');_0x325187[_0x9345('0x72')]=moment()['format'](_0x9345('0x73'));_0x325187['position']=_0x4314c6[_0x9345('0x74')];_0x325187[_0x9345('0x75')]=_0x4314c6[_0x9345('0x75')];_0x325187[_0x9345('0x51')]=_0x4314c6[_0x9345('0x51')];_0x325187[_0x9345('0x76')]=this[_0x9345('0x11')][_0x4314c6[_0x9345('0x51')]]['routealias'];logger[_0x9345('0x77')](_0x9345('0x78'),_0x325187[_0x9345('0x54')],_0x325187['type']);Object[_0x9345('0x67')](_0x325187,_[_0x9345('0x79')](_0x4314c6,_[_0x9345('0x7a')](_0x325187)));this[_0x9345('0xe')][_0x4314c6['uniqueid']][_0x9345('0x6c')](_0x325187);this[_0x9345('0x11')][_0x4314c6[_0x9345('0x51')]]=_0x325187;this['emitVoiceQueueChannelSave'](_0x325187,_0x9345('0x1c'));}}catch(_0x221e7b){logger['error'](_0x9345('0x70'),_0x4314c6['uniqueid'],util[_0x9345('0x42')](_0x221e7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9345('0xa')][_0x9345('0x1f')]=function(_0x50b838){try{if(this[_0x9345('0x5c')](_0x50b838)){logger[_0x9345('0x48')]('[%s][voiceQueueReport][queuecallerabandon]',_0x50b838[_0x9345('0x51')],util[_0x9345('0x42')](_0x50b838,{'showHidden':![],'depth':null}));if(this[_0x9345('0xe')][_0x50b838[_0x9345('0x51')]]){var _0x4871cc=_[_0x9345('0x7b')](this[_0x9345('0xe')][_0x50b838[_0x9345('0x51')]]);_0x4871cc['queuecallercomplete']=![];_0x4871cc[_0x9345('0x7c')]=null;_0x4871cc[_0x9345('0x7d')]=_0x50b838['holdtime'];_0x4871cc['originalposition']=_0x50b838[_0x9345('0x7e')];_0x4871cc[_0x9345('0x1e')]=!![];_0x4871cc[_0x9345('0x7f')]=moment()[_0x9345('0x4b')](_0x9345('0x73'));_0x4871cc[_0x9345('0x52')]=_0x9345('0x80');_0x4871cc[_0x9345('0x81')]=null;logger[_0x9345('0x77')](_0x9345('0x82'),_0x4871cc['queue'],_0x4871cc[_0x9345('0x58')]);this[_0x9345('0x11')][_0x50b838[_0x9345('0x51')]]=_0x4871cc;this[_0x9345('0x4f')](_0x4871cc,_0x9345('0x1e'));}}}catch(_0x4ff980){logger[_0x9345('0x41')](_0x9345('0x83'),_0x50b838[_0x9345('0x51')],util['inspect'](_0x4ff980,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9345('0x20')]=function(_0x1cd780){try{if(this['isNotNull'](_0x1cd780)){logger['debug'](_0x9345('0x84'),_0x1cd780['uniqueid'],util[_0x9345('0x42')](_0x1cd780,{'showHidden':![],'depth':null}));if(this[_0x9345('0xe')][_0x1cd780['uniqueid']]){var _0x37d14f=_[_0x9345('0x7b')](this[_0x9345('0xe')][_0x1cd780['uniqueid']]);_0x37d14f['queuecallerleaveAt']=moment()['format'](_0x9345('0x73'));_0x37d14f[_0x9345('0x85')]=_0x1cd780[_0x9345('0x85')];_0x37d14f[_0x9345('0x86')]=_0x1cd780[_0x9345('0x86')];logger[_0x9345('0x77')](_0x9345('0x87'),_0x37d14f[_0x9345('0x54')],_0x37d14f[_0x9345('0x58')],_0x1cd780[_0x9345('0x85')],_0x1cd780['connectedlinename']);this['channels'][_0x1cd780[_0x9345('0x51')]]=_0x37d14f;this[_0x9345('0x88')](_0x37d14f,'queuecallerleave');}}}catch(_0x3ea6c3){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x1cd780[_0x9345('0x51')],util[_0x9345('0x42')](_0x3ea6c3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9345('0xa')]['syncAgentConnect']=function(_0x466a23){try{if(this['isNotNull'](_0x466a23)){logger[_0x9345('0x48')](_0x9345('0x89'),_0x466a23[_0x9345('0x51')],util[_0x9345('0x42')](_0x466a23,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x466a23[_0x9345('0x51')]]){var _0x543bd8=_['last'](this[_0x9345('0xe')][_0x466a23[_0x9345('0x51')]]);_0x543bd8[_0x9345('0x39')]=!![];_0x543bd8[_0x9345('0x52')]='COMPLETEDBYAGENT';logger[_0x9345('0x77')](_0x9345('0x8a'),_0x543bd8[_0x9345('0x54')],_0x543bd8[_0x9345('0x58')]);}}}catch(_0x2abdd0){logger[_0x9345('0x41')](_0x9345('0x89'),_0x466a23[_0x9345('0x51')],util[_0x9345('0x42')](_0x2abdd0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9345('0xa')][_0x9345('0x22')]=function(_0x25c739){try{if(this[_0x9345('0x5c')](_0x25c739)){logger[_0x9345('0x48')](_0x9345('0x8b'),_0x25c739[_0x9345('0x51')],util[_0x9345('0x42')](_0x25c739,{'showHidden':![],'depth':null}));if(this[_0x9345('0xe')][_0x25c739['uniqueid']]){var _0x5aa450=_[_0x9345('0x7b')](this[_0x9345('0xe')][_0x25c739[_0x9345('0x51')]]);_0x5aa450['queuecallerabandon']=![];_0x5aa450[_0x9345('0x7f')]=null;_0x5aa450[_0x9345('0x8c')]=!![];_0x5aa450['lastAssignedTo']=_0x25c739[_0x9345('0x8d')];_0x5aa450['holdtime']=_0x25c739[_0x9345('0x7d')];_0x5aa450[_0x9345('0x39')]=!![];_0x5aa450['queuecallerexit']=![];_0x5aa450['queuecallerexitAt']=null;if(!_0x5aa450['transfer']){if(_0x25c739[_0x9345('0x8e')]==_0x9345('0x8f')){_0x5aa450['queuecallerexitreason']='COMPLETED';logger[_0x9345('0x77')](_0x9345('0x90'),_0x5aa450[_0x9345('0x54')],_0x5aa450[_0x9345('0x58')]);}else{if(_[_0x9345('0x91')](_0x25c739['channel'][_0x9345('0x92')](),_0x9345('0x93'))){if(this[_0x9345('0xe')][_0x25c739[_0x9345('0x94')]]){var _0x50a214=_[_0x9345('0x7b')](this[_0x9345('0xe')][_0x25c739[_0x9345('0x94')]]);_0x50a214[_0x9345('0x39')]=![];_0x50a214[_0x9345('0x95')]=!![];_0x50a214['queuecallerexitAt']=moment(_0x5aa450[_0x9345('0x72')])[_0x9345('0x96')](_0x25c739['holdtime'],'seconds')[_0x9345('0x4b')](_0x9345('0x73'));_0x50a214[_0x9345('0x52')]=_0x9345('0x97');_0x50a214['transfer']=!![];_0x50a214['transfertype']=_0x9345('0x98');_0x50a214[_0x9345('0x99')]=_0x25c739['destexten'];_0x50a214[_0x9345('0x9a')]=_0x25c739[_0x9345('0x51')];logger[_0x9345('0x77')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x50a214[_0x9345('0x54')],_0x50a214[_0x9345('0x58')]);var _0x41ee76=this[_0x9345('0xe')][_0x25c739['linkedid']];this[_0x9345('0xe')][_0x25c739['linkedid']]=this[_0x9345('0xe')][_0x25c739[_0x9345('0x51')]];this[_0x9345('0xe')][_0x25c739[_0x9345('0x51')]]=_0x41ee76;}}else{_0x5aa450[_0x9345('0x52')]='COMPLETEDBY'+_0x25c739['reason'][_0x9345('0x9b')]();logger[_0x9345('0x77')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5aa450['queue'],_0x5aa450[_0x9345('0x58')],_0x5aa450['queuecallerexitreason']);}}}this[_0x9345('0x11')][_0x25c739[_0x9345('0x51')]]=_0x5aa450;}}}catch(_0xf257bd){logger[_0x9345('0x41')]('[%s][voiceQueueReport][agentcomplete]',_0x25c739[_0x9345('0x51')],util['inspect'](_0xf257bd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x9345('0x25')]=function(_0x27f0dd){try{if(this[_0x9345('0x5c')](_0x27f0dd)){logger[_0x9345('0x48')](_0x9345('0x9c'),_0x27f0dd[_0x9345('0x51')],util['inspect'](_0x27f0dd,{'showHidden':![],'depth':null}));this[_0x9345('0x9d')](_0x27f0dd[_0x9345('0x51')],_[_0x9345('0x7a')](_0x27f0dd[_0x9345('0x9e')])[0x0],_0x27f0dd[_0x9345('0x9f')]);if(this['queueReports'][_0x27f0dd[_0x9345('0x51')]]){var _0x1c47f0=_[_0x9345('0x7b')](this[_0x9345('0xe')][_0x27f0dd['uniqueid']]);if(_0x1c47f0){if(this[_0x9345('0x5c')](_0x27f0dd[_0x9345('0x9e')])&&this[_0x9345('0x5c')](_0x27f0dd[_0x9345('0x9e')][_0x9345('0x62')])){switch(_0x27f0dd[_0x9345('0x9f')]){case _0x9345('0xa0'):_0x1c47f0[_0x9345('0x95')]=![];_0x1c47f0['queuecallerexitAt']=null;break;case _0x9345('0xa1'):_0x1c47f0[_0x9345('0xa2')]='timeout';_0x1c47f0[_0x9345('0x95')]=!![];_0x1c47f0[_0x9345('0xa3')]=moment()[_0x9345('0x4b')](_0x9345('0x73'));_0x1c47f0['queuecallerleaveAt']=moment()['format'](_0x9345('0x73'));logger[_0x9345('0x48')](_0x9345('0xa4'),_0x27f0dd[_0x9345('0x51')],util[_0x9345('0x42')](_0x1c47f0,{'showHidden':![],'depth':null}));ami['emit'](_0x9345('0xa5'),_0x1c47f0);break;default:_0x1c47f0[_0x9345('0x95')]=!![];_0x1c47f0[_0x9345('0xa3')]=moment()[_0x9345('0x4b')](_0x9345('0x73'));_0x1c47f0['queuecallerleaveAt']=moment()['format'](_0x9345('0x73'));}_0x1c47f0['queuecallerabandon']=![];_0x1c47f0[_0x9345('0x7f')]=null;_0x1c47f0[_0x9345('0x52')]=_0x27f0dd[_0x9345('0x9f')];this['channels'][_0x27f0dd[_0x9345('0x51')]]=_0x1c47f0;this['emitVoiceQueueChannelRemove'](_0x1c47f0,_0x9345('0x24'));}else if(this[_0x9345('0x5c')](_0x27f0dd[_0x9345('0x9e')])&&this['isNotNull'](_0x27f0dd['variable'][_0x9345('0xa6')])){if(!_0x1c47f0['queuecallerabandon']){_0x1c47f0[_0x9345('0x95')]=!![];_0x1c47f0[_0x9345('0xa3')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1c47f0[_0x9345('0x52')]=_0x9345('0xa7');_0x1c47f0['queuecallerleaveAt']=moment()['format'](_0x9345('0x73'));this[_0x9345('0x11')][_0x27f0dd[_0x9345('0x51')]]=_0x1c47f0;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x27f0dd[_0x9345('0x51')],_0x1c47f0[_0x9345('0x54')],_0x1c47f0[_0x9345('0x58')],_[_0x9345('0x7a')](_0x27f0dd[_0x9345('0x9e')])[0x0],_0x27f0dd[_0x9345('0x9f')]);_0x1c47f0['variables']=this[_0x9345('0x13')][_0x27f0dd['uniqueid']];}}}}catch(_0x2233c7){logger['error'](_0x9345('0x9c'),_0x27f0dd['uniqueid'],util[_0x9345('0x42')](_0x2233c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9345('0xa')][_0x9345('0x9d')]=function(_0x30097e,_0x195eea,_0x21906c){var _0x365d74=[_0x9345('0xa8'),_0x9345('0xa9'),_0x9345('0xaa'),_0x9345('0xab'),'rtpaudioqosloss',_0x9345('0xac'),'rtpaudioqosrtt',_0x9345('0xad'),'sipcallid',_0x9345('0xae'),_0x9345('0xaf'),'bridgepvtcallid',_0x9345('0xb0'),_0x9345('0xb1'),_0x9345('0xb2'),_0x9345('0xb3'),_0x9345('0x8d'),'memberpenalty','memberrealtime'];if(!_[_0x9345('0x3c')](_0x195eea)&&!_[_0x9345('0xb4')](_0x365d74,_0x195eea)){if(_['isUndefined'](this[_0x9345('0x13')][_0x30097e])){this['variables'][_0x30097e]={};}this[_0x9345('0x13')][_0x30097e][_0x195eea]=_0x21906c;}};VoiceQueueReport[_0x9345('0xa')][_0x9345('0xb5')]=function(_0xd46b6b,_0x182160,_0x15473c){try{var _0x108179={};if(this[_0x9345('0xe')][_0xd46b6b]){for(var _0x233c07=0x0;_0x233c070x0?!![]:![];if(!_0x478ac9){return this[_0xd739('0x66')](this[_0xd739('0x3f')][_0xd739('0x67')]);}};VoiceQueueReport[_0xd739('0x8')][_0xd739('0x68')]=function(_0x5d9cd7){var _0x48b9f3=this[_0xd739('0x3f')]['id'];if(this['summary'][_0xd739('0x59')][_0x48b9f3]&&this[_0xd739('0x3f')]['queuestatus'][_0x48b9f3][_0x5d9cd7[_0xd739('0x5a')]]){this[_0xd739('0x3f')][_0xd739('0x59')][_0x48b9f3][_0x5d9cd7[_0xd739('0x5a')]]['agents']['push'](_0x5d9cd7);}};VoiceQueueReport[_0xd739('0x8')][_0xd739('0x15')]=function(_0x19637a){var _0x41c2e8=this;try{if(this['isNotNull'](_0x19637a)&&this[_0xd739('0x69')](_0x19637a[_0xd739('0x4d')])){logger[_0xd739('0x43')]('[voiceQueueReport][queuesummary]\x20event:',util[_0xd739('0x39')](_0x19637a,{'showHidden':![],'depth':null}));var _0x23561a=this[_0xd739('0x11')][_0x19637a['queue']];if(_0x23561a){logger[_0xd739('0x43')](_0xd739('0x6a'),_0x23561a[_0xd739('0x53')]);this[_0xd739('0x3f')][_0xd739('0x5d')][_0x23561a[_0xd739('0x53')]]={'summaryEvent':_0x19637a};this[_0xd739('0x3f')][_0xd739('0x65')]+=0x1;return ami[_0xd739('0x34')]({'action':'queuestatus','queue':_0x23561a[_0xd739('0x53')]})[_0xd739('0x6b')](function(_0x310650){if(!_0x41c2e8[_0xd739('0x3f')]['queuestatus'][_0x19637a[_0xd739('0x5a')]]){_0x41c2e8[_0xd739('0x3f')][_0xd739('0x59')][_0x19637a[_0xd739('0x5a')]]={};}_0x41c2e8[_0xd739('0x3f')]['queuestatus'][_0x19637a[_0xd739('0x5a')]][_0x310650[_0xd739('0x5a')]]={'queue':_0x23561a[_0xd739('0x53')],'agents':[]};})[_0xd739('0x36')](function(_0x5e9cee){throw _0x5e9cee;});}}}catch(_0x25db4e){logger['error']('[voiceQueueReport][queuesummary]',util[_0xd739('0x39')](_0x25db4e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd739('0x66')]=function(_0x488811){if(this[_0xd739('0x3f')][_0xd739('0x65')]>0x0){this[_0xd739('0x3f')][_0xd739('0x67')]=_0x488811;return;}logger['debug'](_0xd739('0x6c'),util['inspect'](_0x488811,{'showHidden':![],'depth':null}));this[_0xd739('0x3f')]=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xd739('0x8')]['syncQueueCallerJoin']=function(_0x3cbc55){try{if(this['isNotNull'](_0x3cbc55)){logger[_0xd739('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x3cbc55[_0xd739('0x46')],util[_0xd739('0x39')](_0x3cbc55,{'showHidden':![],'depth':null}));if(_[_0xd739('0x55')](this['queueReports'][_0x3cbc55[_0xd739('0x46')]])){this[_0xd739('0xc')][_0x3cbc55[_0xd739('0x46')]]=[];}if(_[_0xd739('0x55')](this[_0xd739('0xf')][_0x3cbc55[_0xd739('0x46')]])){this['channels'][_0x3cbc55[_0xd739('0x46')]]={};}var _0xf509d3=new QueueReport();_0xf509d3[_0xd739('0x4d')]=_0x3cbc55[_0xd739('0x4d')];_0xf509d3[_0xd739('0x50')]=this[_0xd739('0x11')][_0xf509d3['queue']]&&this[_0xd739('0x11')][_0xf509d3['queue']][_0xd739('0x50')]?this[_0xd739('0x11')][_0xf509d3['queue']][_0xd739('0x50')]||'inbound':_0xd739('0x51');_0xf509d3[_0xd739('0x6d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xf509d3[_0xd739('0x6e')]=_0x3cbc55['position'];_0xf509d3[_0xd739('0x6f')]=_0x3cbc55['count'];_0xf509d3[_0xd739('0x46')]=_0x3cbc55[_0xd739('0x46')];_0xf509d3[_0xd739('0x70')]=this[_0xd739('0xf')][_0x3cbc55[_0xd739('0x46')]]['routealias'];logger[_0xd739('0x71')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0xf509d3['queue'],_0xf509d3[_0xd739('0x50')]);Object[_0xd739('0x62')](_0xf509d3,_[_0xd739('0x72')](_0x3cbc55,_[_0xd739('0x73')](_0xf509d3)));this[_0xd739('0xc')][_0x3cbc55[_0xd739('0x46')]][_0xd739('0x74')](_0xf509d3);this[_0xd739('0xf')][_0x3cbc55[_0xd739('0x46')]]=_0xf509d3;this['emitVoiceQueueChannelSave'](_0xf509d3,_0xd739('0x1a'));}}catch(_0x26f48a){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x3cbc55['uniqueid'],util[_0xd739('0x39')](_0x26f48a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd739('0x8')][_0xd739('0x1c')]=function(_0x47e457){try{if(this[_0xd739('0x69')](_0x47e457)){logger[_0xd739('0x43')]('[%s][voiceQueueReport][queuecallerabandon]',_0x47e457[_0xd739('0x46')],util['inspect'](_0x47e457,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x47e457[_0xd739('0x46')]]){var _0x5b8364=_[_0xd739('0x75')](this[_0xd739('0xc')][_0x47e457['uniqueid']]);_0x5b8364[_0xd739('0x32')]=![];_0x5b8364[_0xd739('0x76')]=null;_0x5b8364[_0xd739('0x77')]=_0x47e457[_0xd739('0x77')];_0x5b8364[_0xd739('0x78')]=_0x47e457['originalposition'];_0x5b8364[_0xd739('0x31')]=!![];_0x5b8364[_0xd739('0x79')]=moment()['format'](_0xd739('0x7a'));_0x5b8364[_0xd739('0x4a')]=_0xd739('0x7b');_0x5b8364[_0xd739('0x7c')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5b8364['queue'],_0x5b8364[_0xd739('0x50')]);this[_0xd739('0xf')][_0x47e457[_0xd739('0x46')]]=_0x5b8364;this[_0xd739('0x40')](_0x5b8364,_0xd739('0x31'));}}}catch(_0x5c1d56){logger[_0xd739('0x37')](_0xd739('0x7d'),_0x47e457[_0xd739('0x46')],util[_0xd739('0x39')](_0x5c1d56,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd739('0x8')][_0xd739('0x1e')]=function(_0x436089){try{if(this[_0xd739('0x69')](_0x436089)){logger['debug'](_0xd739('0x7e'),_0x436089[_0xd739('0x46')],util['inspect'](_0x436089,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x436089[_0xd739('0x46')]]){var _0x4c368a=_[_0xd739('0x75')](this['queueReports'][_0x436089[_0xd739('0x46')]]);_0x4c368a[_0xd739('0x7f')]=moment()[_0xd739('0x4c')](_0xd739('0x7a'));_0x4c368a[_0xd739('0x80')]=_0x436089[_0xd739('0x80')];_0x4c368a['connectedlinename']=_0x436089[_0xd739('0x81')];logger[_0xd739('0x71')](_0xd739('0x82'),_0x4c368a[_0xd739('0x4d')],_0x4c368a['type'],_0x436089[_0xd739('0x80')],_0x436089['connectedlinename']);this[_0xd739('0xf')][_0x436089['uniqueid']]=_0x4c368a;this[_0xd739('0x83')](_0x4c368a,_0xd739('0x1d'));}}}catch(_0x3393a2){logger[_0xd739('0x37')]('[%s][voiceQueueReport][queuecallerleave]',_0x436089[_0xd739('0x46')],util[_0xd739('0x39')](_0x3393a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd739('0x8')][_0xd739('0x84')]=function(_0x4aee1e){try{if(this[_0xd739('0x69')](_0x4aee1e)){logger[_0xd739('0x43')](_0xd739('0x85'),_0x4aee1e[_0xd739('0x46')],util[_0xd739('0x39')](_0x4aee1e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4aee1e[_0xd739('0x46')]]){var _0x4ffc37=_[_0xd739('0x75')](this[_0xd739('0xc')][_0x4aee1e['uniqueid']]);_0x4ffc37[_0xd739('0x32')]=!![];_0x4ffc37['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xd739('0x71')](_0xd739('0x86'),_0x4ffc37[_0xd739('0x4d')],_0x4ffc37[_0xd739('0x50')]);}}}catch(_0xb0ac20){logger[_0xd739('0x37')](_0xd739('0x85'),_0x4aee1e[_0xd739('0x46')],util[_0xd739('0x39')](_0xb0ac20,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd739('0x8')][_0xd739('0x20')]=function(_0x2c4e91){try{if(this[_0xd739('0x69')](_0x2c4e91)){logger[_0xd739('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x2c4e91[_0xd739('0x46')],util['inspect'](_0x2c4e91,{'showHidden':![],'depth':null}));if(this[_0xd739('0xc')][_0x2c4e91[_0xd739('0x46')]]){var _0x31f1ad=_['last'](this[_0xd739('0xc')][_0x2c4e91['uniqueid']]);_0x31f1ad[_0xd739('0x31')]=![];_0x31f1ad[_0xd739('0x79')]=null;_0x31f1ad[_0xd739('0x87')]=!![];_0x31f1ad['lastAssignedTo']=_0x2c4e91['membername'];_0x31f1ad[_0xd739('0x77')]=_0x2c4e91[_0xd739('0x77')];_0x31f1ad[_0xd739('0x32')]=!![];_0x31f1ad[_0xd739('0x30')]=![];_0x31f1ad[_0xd739('0x88')]=null;if(!_0x31f1ad[_0xd739('0x89')]){if(_0x2c4e91['reason']==_0xd739('0x89')){_0x31f1ad[_0xd739('0x4a')]=_0xd739('0x8a');logger[_0xd739('0x71')](_0xd739('0x8b'),_0x31f1ad['queue'],_0x31f1ad[_0xd739('0x50')]);}else{if(_[_0xd739('0x8c')](_0x2c4e91['channel'][_0xd739('0x8d')](),_0xd739('0x8e'))){if(this[_0xd739('0xc')][_0x2c4e91[_0xd739('0x8f')]]){var _0x47ee84=_[_0xd739('0x75')](this['queueReports'][_0x2c4e91[_0xd739('0x8f')]]);_0x47ee84[_0xd739('0x32')]=![];_0x47ee84['queuecallerexit']=!![];_0x47ee84[_0xd739('0x88')]=moment(_0x31f1ad['queuecallerjoinAt'])[_0xd739('0x90')](_0x2c4e91[_0xd739('0x77')],_0xd739('0x91'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x47ee84[_0xd739('0x4a')]=_0xd739('0x92');_0x47ee84['transfer']=!![];_0x47ee84[_0xd739('0x93')]='FORWARD';_0x47ee84[_0xd739('0x94')]=_0x2c4e91[_0xd739('0x95')];_0x47ee84[_0xd739('0x96')]=_0x2c4e91[_0xd739('0x46')];logger['info'](_0xd739('0x97'),_0x47ee84[_0xd739('0x4d')],_0x47ee84[_0xd739('0x50')]);var _0x55631f=this['queueReports'][_0x2c4e91['linkedid']];this['queueReports'][_0x2c4e91['linkedid']]=this['queueReports'][_0x2c4e91[_0xd739('0x46')]];this[_0xd739('0xc')][_0x2c4e91[_0xd739('0x46')]]=_0x55631f;}}else{_0x31f1ad['queuecallerexitreason']=_0xd739('0x98')+_0x2c4e91[_0xd739('0x99')][_0xd739('0x9a')]();logger[_0xd739('0x71')](_0xd739('0x9b'),_0x31f1ad[_0xd739('0x4d')],_0x31f1ad['type'],_0x31f1ad[_0xd739('0x4a')]);}}}this[_0xd739('0xf')][_0x2c4e91['uniqueid']]=_0x31f1ad;}}}catch(_0x16297b){logger[_0xd739('0x37')]('[%s][voiceQueueReport][agentcomplete]',_0x2c4e91[_0xd739('0x46')],util[_0xd739('0x39')](_0x16297b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd739('0x8')][_0xd739('0x9c')]=function(_0x5c5f2e){try{if(this[_0xd739('0x69')](_0x5c5f2e)){logger[_0xd739('0x43')]('[%s][voiceQueueReport][varset]',_0x5c5f2e[_0xd739('0x46')],util['inspect'](_0x5c5f2e,{'showHidden':![],'depth':null}));this[_0xd739('0x9d')](_0x5c5f2e['uniqueid'],_['keys'](_0x5c5f2e[_0xd739('0x9e')])[0x0],_0x5c5f2e[_0xd739('0x9f')]);if(this[_0xd739('0xc')][_0x5c5f2e[_0xd739('0x46')]]){var _0x3c8f30=_[_0xd739('0x75')](this[_0xd739('0xc')][_0x5c5f2e[_0xd739('0x46')]]);if(_0x3c8f30){if(this[_0xd739('0x69')](_0x5c5f2e[_0xd739('0x9e')])&&this[_0xd739('0x69')](_0x5c5f2e[_0xd739('0x9e')]['queuestatus'])){switch(_0x5c5f2e['value']){case _0xd739('0xa0'):_0x3c8f30[_0xd739('0x30')]=![];_0x3c8f30[_0xd739('0x88')]=null;break;case _0xd739('0xa1'):_0x3c8f30['lastevent']=_0xd739('0xa2');_0x3c8f30[_0xd739('0x30')]=!![];_0x3c8f30['queuecallerexitAt']=moment()[_0xd739('0x4c')](_0xd739('0x7a'));_0x3c8f30['queuecallerleaveAt']=moment()[_0xd739('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0xd739('0xa3'),_0x5c5f2e[_0xd739('0x46')],util['inspect'](_0x3c8f30,{'showHidden':![],'depth':null}));ami[_0xd739('0x42')](_0xd739('0xa4'),_0x3c8f30);break;default:_0x3c8f30['queuecallerexit']=!![];_0x3c8f30['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3c8f30[_0xd739('0x7f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3c8f30[_0xd739('0x31')]=![];_0x3c8f30[_0xd739('0x79')]=null;_0x3c8f30[_0xd739('0x4a')]=_0x5c5f2e[_0xd739('0x9f')];this[_0xd739('0xf')][_0x5c5f2e[_0xd739('0x46')]]=_0x3c8f30;this[_0xd739('0x40')](_0x3c8f30,'varset');}else if(this['isNotNull'](_0x5c5f2e[_0xd739('0x9e')])&&this[_0xd739('0x69')](_0x5c5f2e[_0xd739('0x9e')][_0xd739('0xa5')])){if(!_0x3c8f30[_0xd739('0x31')]){_0x3c8f30['queuecallerexit']=!![];_0x3c8f30['queuecallerexitAt']=moment()['format'](_0xd739('0x7a'));_0x3c8f30[_0xd739('0x4a')]=_0xd739('0xa6');_0x3c8f30[_0xd739('0x7f')]=moment()[_0xd739('0x4c')](_0xd739('0x7a'));this['channels'][_0x5c5f2e[_0xd739('0x46')]]=_0x3c8f30;}}logger['info'](_0xd739('0xa7'),_0x5c5f2e[_0xd739('0x46')],_0x3c8f30['queue'],_0x3c8f30[_0xd739('0x50')],_['keys'](_0x5c5f2e[_0xd739('0x9e')])[0x0],_0x5c5f2e[_0xd739('0x9f')]);_0x3c8f30['variables']=this[_0xd739('0x13')][_0x5c5f2e['uniqueid']];}}}}catch(_0x55f1f9){logger['error'](_0xd739('0xa8'),_0x5c5f2e[_0xd739('0x46')],util['inspect'](_0x55f1f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd739('0x8')]['addVariable']=function(_0x5b8c36,_0x1ee526,_0x521eda){var _0x4384de=[_0xd739('0xa9'),_0xd739('0xaa'),_0xd739('0xab'),_0xd739('0xac'),_0xd739('0xad'),'rtpaudioqoslossbridged',_0xd739('0xae'),_0xd739('0xaf'),'sipcallid',_0xd739('0xb0'),_0xd739('0xb1'),_0xd739('0xb2'),_0xd739('0xb3'),_0xd739('0xb4'),_0xd739('0xb5'),_0xd739('0xb6'),_0xd739('0xb7'),_0xd739('0xb8'),_0xd739('0xb9')];if(!_[_0xd739('0xba')](_0x1ee526)&&!_[_0xd739('0xbb')](_0x4384de,_0x1ee526)){if(_[_0xd739('0x55')](this[_0xd739('0x13')][_0x5b8c36])){this[_0xd739('0x13')][_0x5b8c36]={};}this[_0xd739('0x13')][_0x5b8c36][_0x1ee526]=_0x521eda;}};VoiceQueueReport[_0xd739('0x8')][_0xd739('0xbc')]=function(_0x899bd9,_0x252476,_0x1f4bf0){try{var _0x13c138={};if(this[_0xd739('0xc')][_0x899bd9]){for(var _0x231d92=0x0;_0x231d92=0x0?moment(_0x2fdb75[_0x7085('0x18')])[_0x7085('0xb')](_0x2fdb75[_0x7085('0x17')],_0x7085('0xc')):null,'data1':_0x7085('0x19'),'data2':_0x2fdb75[_0x7085('0x11')],'data3':_0x2fdb75[_0x7085('0xf')],'data4':_0x2fdb75[_0x7085('0x1a')]||null,'role':_0x7085('0x10'),'internal':_0x2fdb75[_0x7085('0x11')]?_[_0x7085('0x12')](_0x2fdb75['accountcode']):undefined,'uniqueid':_0x2fdb75['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x5f9e=['moment','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','seconds','exten','queue','agent','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','accountcode','dialstring'];(function(_0x5b351d,_0x10ecb0){var _0x2a14d6=function(_0xbb6758){while(--_0xbb6758){_0x5b351d['push'](_0x5b351d['shift']());}};_0x2a14d6(++_0x10ecb0);}(_0x5f9e,0x134));var _0xe5f9=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0x5f9e[_0x2cacef];return _0x289ba6;};'use strict';var moment=require(_0xe5f9('0x0'));var _=require('lodash');var util=require(_0xe5f9('0x1'));var client=require(_0xe5f9('0x2'));exports[_0xe5f9('0x3')]=function(_0x35390b){var _0x2b4b28=_0x35390b[_0xe5f9('0x4')]||_0x35390b[_0xe5f9('0x5')];return client[_0xe5f9('0x6')](_0xe5f9('0x7'),{'body':{'channel':_0xe5f9('0x8'),'membername':_0x35390b[_0xe5f9('0x9')],'interface':_[_0xe5f9('0xa')](_0x35390b[_0xe5f9('0xb')])?util[_0xe5f9('0xc')](_0xe5f9('0xd'),_0x35390b[_0xe5f9('0x9')]):_0x35390b[_0xe5f9('0xb')],'type':_0xe5f9('0xe'),'enterAt':_0x35390b['queuecallerleaveAt'],'exitAt':_0x2b4b28,'duration':moment(_0x2b4b28)[_0xe5f9('0xf')](_0x35390b['queuecallerleaveAt'],_0xe5f9('0x10')),'data1':'inbound','data2':_0x35390b['calleridnum'],'data3':_0x35390b[_0xe5f9('0x11')],'data4':null,'data5':_0x35390b[_0xe5f9('0x12')],'role':_0xe5f9('0x13'),'internal':_0x35390b['accountcode']?_[_0xe5f9('0x14')](_0x35390b['accountcode']):undefined,'uniqueid':_0x35390b[_0xe5f9('0x15')]},'log':_0xe5f9('0x7')});};exports[_0xe5f9('0x16')]=function(_0x23ab55){return client[_0xe5f9('0x6')](_0xe5f9('0x7'),{'body':{'channel':_0xe5f9('0x8'),'membername':_0x23ab55[_0xe5f9('0x17')],'interface':_0x23ab55[_0xe5f9('0xb')],'type':_0xe5f9('0xe'),'enterAt':_0x23ab55[_0xe5f9('0x18')],'exitAt':_0x23ab55[_0xe5f9('0x19')],'duration':moment(_0x23ab55[_0xe5f9('0x19')])[_0xe5f9('0xf')](_0x23ab55['starttime'],'seconds')>=0x0?moment(_0x23ab55[_0xe5f9('0x19')])[_0xe5f9('0xf')](_0x23ab55['starttime'],_0xe5f9('0x10')):null,'data1':'outbound','data2':_0x23ab55[_0xe5f9('0x1a')],'data3':_0x23ab55[_0xe5f9('0x11')],'data4':_0x23ab55[_0xe5f9('0x1b')]||null,'role':_0xe5f9('0x13'),'internal':_0x23ab55[_0xe5f9('0x1a')]?_[_0xe5f9('0x14')](_0x23ab55[_0xe5f9('0x1a')]):undefined,'uniqueid':_0x23ab55[_0xe5f9('0x15')]},'log':_0xe5f9('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index ef1a62a..cea1e17 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 _0x9037=['GetSettings','getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x166d1b,_0x4852c4){var _0x540656=function(_0x9f662d){while(--_0x9f662d){_0x166d1b['push'](_0x166d1b['shift']());}};_0x540656(++_0x4852c4);}(_0x9037,0xbf));var _0x7903=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9037[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x7903('0x0')]=function(){return client['Request'](_0x7903('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7903('0x2'),_0x7903('0x3')]},'log':_0x7903('0x4')});}; \ No newline at end of file +var _0xdc15=['GetSettings','../client','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x2fc2bf,_0x25b3d5){var _0x293756=function(_0x2227c8){while(--_0x2227c8){_0x2fc2bf['push'](_0x2fc2bf['shift']());}};_0x293756(++_0x25b3d5);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0xdc15[_0x90a39a];return _0x2b62f7;};'use strict';var client=require(_0x5dc1('0x0'));exports['getSettings']=function(){return client[_0x5dc1('0x1')](_0x5dc1('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5dc1('0x3'),_0x5dc1('0x4')]},'log':_0x5dc1('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f42aa71..ca6a689 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 _0x1637=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x31dabc,_0x4762d4){var _0x22c853=function(_0x5d81b2){while(--_0x5d81b2){_0x31dabc['push'](_0x31dabc['shift']());}};_0x22c853(++_0x4762d4);}(_0x1637,0x14c));var _0x7163=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1637[_0x27af45];return _0x18df21;};'use strict';var client=require(_0x7163('0x0'));exports[_0x7163('0x1')]=function(_0x4d4113){return function(_0x3d99a0){return client[_0x7163('0x2')](_0x7163('0x3'),{'options':{'raw':!![],'attributes':['id',_0x7163('0x4'),_0x7163('0x5')]},'log':_0x7163('0x3')});};}; \ No newline at end of file +var _0xa099=['html','Request','GetTemplate','name'];(function(_0x3fb0d0,_0x423d2f){var _0x269f0c=function(_0x40be37){while(--_0x40be37){_0x3fb0d0['push'](_0x3fb0d0['shift']());}};_0x269f0c(++_0x423d2f);}(_0xa099,0x69));var _0x9a09=function(_0x24fd9c,_0x4d880e){_0x24fd9c=_0x24fd9c-0x0;var _0x330642=_0xa099[_0x24fd9c];return _0x330642;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x4936ba){return function(_0x2f01dc){return client[_0x9a09('0x0')](_0x9a09('0x1'),{'options':{'raw':!![],'attributes':['id',_0x9a09('0x2'),_0x9a09('0x3')]},'log':_0x9a09('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7a9a87b..6df686e 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 _0xf41c=['operator','AnyConditions','value','Action','Actions','action','data1','data3','data4','data5','data6','getTriggers','Request','GetTrigger','name','status','Condition','AllConditions','field'];(function(_0x53b5bd,_0x2929f5){var _0x110607=function(_0x2e78fc){while(--_0x2e78fc){_0x53b5bd['push'](_0x53b5bd['shift']());}};_0x110607(++_0x2929f5);}(_0xf41c,0x115));var _0xcf41=function(_0x13041f,_0x3ee890){_0x13041f=_0x13041f-0x0;var _0x1eb3b0=_0xf41c[_0x13041f];return _0x1eb3b0;};'use strict';var client=require('../client');exports[_0xcf41('0x0')]=function(_0x2dd771){return function(_0x2aa82e){return client[_0xcf41('0x1')](_0xcf41('0x2'),{'options':{'raw':![],'attributes':['id',_0xcf41('0x3'),'channel',_0xcf41('0x4')],'include':[{'model':_0xcf41('0x5'),'as':_0xcf41('0x6'),'attributes':['id',_0xcf41('0x7'),_0xcf41('0x8'),'value']},{'model':_0xcf41('0x5'),'as':_0xcf41('0x9'),'attributes':['id',_0xcf41('0x7'),_0xcf41('0x8'),_0xcf41('0xa')]},{'model':_0xcf41('0xb'),'as':_0xcf41('0xc'),'attributes':['id',_0xcf41('0xd'),_0xcf41('0xe'),'data2',_0xcf41('0xf'),_0xcf41('0x10'),_0xcf41('0x11'),_0xcf41('0x12'),'data7']}]},'log':_0xcf41('0x2')});};}; \ No newline at end of file +var _0xef85=['../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','value','AnyConditions','field','operator','Action','Actions','data2','data3','data4','data5','data6','data7'];(function(_0x2df413,_0x5303ae){var _0x1f5133=function(_0xb2347c){while(--_0xb2347c){_0x2df413['push'](_0x2df413['shift']());}};_0x1f5133(++_0x5303ae);}(_0xef85,0x111));var _0x5ef8=function(_0x4dd5d8,_0x4daf1b){_0x4dd5d8=_0x4dd5d8-0x0;var _0x412aed=_0xef85[_0x4dd5d8];return _0x412aed;};'use strict';var client=require(_0x5ef8('0x0'));exports[_0x5ef8('0x1')]=function(_0x2a349c){return function(_0x43ed85){return client[_0x5ef8('0x2')](_0x5ef8('0x3'),{'options':{'raw':![],'attributes':['id',_0x5ef8('0x4'),_0x5ef8('0x5'),_0x5ef8('0x6')],'include':[{'model':_0x5ef8('0x7'),'as':_0x5ef8('0x8'),'attributes':['id','field','operator',_0x5ef8('0x9')]},{'model':_0x5ef8('0x7'),'as':_0x5ef8('0xa'),'attributes':['id',_0x5ef8('0xb'),_0x5ef8('0xc'),_0x5ef8('0x9')]},{'model':_0x5ef8('0xd'),'as':_0x5ef8('0xe'),'attributes':['id','action','data1',_0x5ef8('0xf'),_0x5ef8('0x10'),_0x5ef8('0x11'),_0x5ef8('0x12'),_0x5ef8('0x13'),_0x5ef8('0x14')]}]},'log':_0x5ef8('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 0a39133..58f845c 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 _0x008c=['../client','getTrunks','Request','name','registry','defaultuser','GetTrunk'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x008c,0x188));var _0xc008=function(_0x1bb11e,_0x58fd78){_0x1bb11e=_0x1bb11e-0x0;var _0x422492=_0x008c[_0x1bb11e];return _0x422492;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return function(_0xae17af){return client[_0xc008('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc008('0x3'),_0xc008('0x4'),_0xc008('0x5')]},'log':_0xc008('0x6')});};}; \ No newline at end of file +var _0x94c9=['defaultuser','../client','getTrunks','Request','GetTrunk','name','registry'];(function(_0x320afe,_0xd1094d){var _0x202576=function(_0x5123f2){while(--_0x5123f2){_0x320afe['push'](_0x320afe['shift']());}};_0x202576(++_0xd1094d);}(_0x94c9,0x1dd));var _0x994c=function(_0x86d449,_0x69cf24){_0x86d449=_0x86d449-0x0;var _0x4f654e=_0x94c9[_0x86d449];return _0x4f654e;};'use strict';var client=require(_0x994c('0x0'));exports[_0x994c('0x1')]=function(_0x67066e){return function(_0x5b31bb){return client[_0x994c('0x2')](_0x994c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x994c('0x4'),_0x994c('0x5'),_0x994c('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 6e42862..e27a98e 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x2c08dc,_0x37345e){var _0x471a06=function(_0x1bd3a8){while(--_0x1bd3a8){_0x2c08dc['push'](_0x2c08dc['shift']());}};_0x471a06(++_0x37345e);}(_0x70e0,0x17b));var _0x070e=function(_0x47fcf0,_0x280188){_0x47fcf0=_0x47fcf0-0x0;var _0x3f6ad2=_0x70e0[_0x47fcf0];return _0x3f6ad2;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x2cb9e2,_0x45999a){var _0x2c4bae=function(_0x2aaaa8){while(--_0x2aaaa8){_0x2cb9e2['push'](_0x2cb9e2['shift']());}};_0x2c4bae(++_0x45999a);}(_0xedd9,0xfc));var _0x9edd=function(_0x2409cb,_0x26b709){_0x2409cb=_0x2409cb-0x0;var _0xe25c7=_0xedd9[_0x2409cb];return _0xe25c7;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 8a4bc1c..8190610 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 _0x8e18=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x1a5620,_0x4672b0){var _0x5bd59f=function(_0x4c4037){while(--_0x4c4037){_0x1a5620['push'](_0x1a5620['shift']());}};_0x5bd59f(++_0x4672b0);}(_0x8e18,0x19b));var _0x88e1=function(_0x491470,_0x2c5b1c){_0x491470=_0x491470-0x0;var _0x3fab03=_0x8e18[_0x491470];return _0x3fab03;};'use strict';var client=require(_0x88e1('0x0'));exports[_0x88e1('0x1')]=function(_0x143a4a){return client[_0x88e1('0x2')]('CreateVoiceAgentReport',{'body':_0x143a4a,'log':_0x88e1('0x3')});};exports[_0x88e1('0x4')]=function(_0x357c9c,_0x1494fb,_0x261926){return client['Request'](_0x88e1('0x5'),{'body':_0x357c9c,'options':{'where':{'uniqueid':_0x1494fb,'interface':_0x261926,'agentcomplete':!![]}},'log':_0x88e1('0x5')});}; \ No newline at end of file +var _0x5b7f=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x1f389d,_0xf17070){var _0x30bc85=function(_0x301107){while(--_0x301107){_0x1f389d['push'](_0x1f389d['shift']());}};_0x30bc85(++_0xf17070);}(_0x5b7f,0x1bd));var _0xf5b7=function(_0x8457fa,_0x464905){_0x8457fa=_0x8457fa-0x0;var _0x399475=_0x5b7f[_0x8457fa];return _0x399475;};'use strict';var client=require(_0xf5b7('0x0'));exports[_0xf5b7('0x1')]=function(_0x4e0b33){return client[_0xf5b7('0x2')](_0xf5b7('0x3'),{'body':_0x4e0b33,'log':_0xf5b7('0x3')});};exports[_0xf5b7('0x4')]=function(_0x1ef175,_0x4739cc,_0x2fe18a){return client[_0xf5b7('0x2')]('UpdateVoiceAgentReport',{'body':_0x1ef175,'options':{'where':{'uniqueid':_0x4739cc,'interface':_0x2fe18a,'agentcomplete':!![]}},'log':_0xf5b7('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 10b9955..d1abf80 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 _0x6bbb=['billableseconds','GetVoiceCallReports','moment','lodash','../client','Request','CreateVoiceCallReport','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration'];(function(_0x42ff14,_0x17281f){var _0x3ba175=function(_0x3e624b){while(--_0x3e624b){_0x42ff14['push'](_0x42ff14['shift']());}};_0x3ba175(++_0x17281f);}(_0x6bbb,0x92));var _0xb6bb=function(_0x3d61c6,_0x4571e6){_0x3d61c6=_0x3d61c6-0x0;var _0x47e0df=_0x6bbb[_0x3d61c6];return _0x47e0df;};'use strict';var moment=require(_0xb6bb('0x0'));var util=require('util');var _=require(_0xb6bb('0x1'));var client=require(_0xb6bb('0x2'));exports['create']=function(_0x5c0989){return client[_0xb6bb('0x3')](_0xb6bb('0x4'),{'body':_['merge'](_0x5c0989,{'source':_0x5c0989['calleridnum'],'destinationcontext':_0x5c0989['context'],'callerid':_0x5c0989['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0xb6bb('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xb6bb('0x3')](_0xb6bb('0x5'),{'options':{'where':{'type':[_0xb6bb('0x6')],'createdAt':{'$between':[moment()[_0xb6bb('0x7')](_0xb6bb('0x8'))[_0xb6bb('0x9')](_0xb6bb('0xa')),moment()['endOf'](_0xb6bb('0x8'))['format'](_0xb6bb('0xa'))]}},'attributes':[_0xb6bb('0xb'),_0xb6bb('0xc'),_0xb6bb('0xd'),_0xb6bb('0xe')]},'log':_0xb6bb('0xf')});};}; \ No newline at end of file +var _0x3c4d=['day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','util','lodash','../client','create','Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf'];(function(_0x5685fb,_0xc990e4){var _0x595ab4=function(_0x185706){while(--_0x185706){_0x5685fb['push'](_0x5685fb['shift']());}};_0x595ab4(++_0xc990e4);}(_0x3c4d,0x1e7));var _0xd3c4=function(_0x377cf6,_0x33afd1){_0x377cf6=_0x377cf6-0x0;var _0x1e05de=_0x3c4d[_0x377cf6];return _0x1e05de;};'use strict';var moment=require('moment');var util=require(_0xd3c4('0x0'));var _=require(_0xd3c4('0x1'));var client=require(_0xd3c4('0x2'));exports[_0xd3c4('0x3')]=function(_0x1bb42e){return client[_0xd3c4('0x4')](_0xd3c4('0x5'),{'body':_['merge'](_0x1bb42e,{'source':_0x1bb42e['calleridnum'],'destinationcontext':_0x1bb42e[_0xd3c4('0x6')],'callerid':_0x1bb42e[_0xd3c4('0x7')],'amaflags':_0xd3c4('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0xd3c4('0x9')]=function(){return function(){return client[_0xd3c4('0x4')](_0xd3c4('0xa'),{'options':{'where':{'type':[_0xd3c4('0xb')],'createdAt':{'$between':[moment()[_0xd3c4('0xc')](_0xd3c4('0xd'))['format'](_0xd3c4('0xe')),moment()[_0xd3c4('0xf')](_0xd3c4('0xd'))[_0xd3c4('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xd3c4('0x11'),_0xd3c4('0x12'),_0xd3c4('0x13'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 902335b..fdce78b 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 _0x95e4=['create','Request','CreateVoiceDialReport','../client'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x95e4,0x173));var _0x495e=function(_0xc7d8f4,_0x6bf77f){_0xc7d8f4=_0xc7d8f4-0x0;var _0x2cfbb3=_0x95e4[_0xc7d8f4];return _0x2cfbb3;};'use strict';var client=require(_0x495e('0x0'));exports[_0x495e('0x1')]=function(_0x48f173){return client[_0x495e('0x2')]('CreateVoiceDialReport',{'body':_0x48f173,'log':_0x495e('0x3')});}; \ No newline at end of file +var _0x89e1=['CreateVoiceDialReport','Request'];(function(_0xdd5504,_0x395651){var _0xfc9c28=function(_0x324e92){while(--_0x324e92){_0xdd5504['push'](_0xdd5504['shift']());}};_0xfc9c28(++_0x395651);}(_0x89e1,0xfb));var _0x189e=function(_0x47504c,_0x2238ed){_0x47504c=_0x47504c-0x0;var _0xfce3f2=_0x89e1[_0x47504c];return _0xfce3f2;};'use strict';var client=require('../client');exports['create']=function(_0x127e8d){return client[_0x189e('0x0')]('CreateVoiceDialReport',{'body':_0x127e8d,'log':_0x189e('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2b0f20a..d1e8ed3 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 _0x4dd3=['recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4dd3,0xf5));var _0x34dd=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x4dd3[_0x118139];return _0x2fece9;};'use strict';var client=require(_0x34dd('0x0'));exports[_0x34dd('0x1')]=function(){return function(){return client[_0x34dd('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x34dd('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xe5b5=['getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x1eab98,_0x5148a1){var _0x25816d=function(_0x4a3b35){while(--_0x4a3b35){_0x1eab98['push'](_0x1eab98['shift']());}};_0x25816d(++_0x5148a1);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0xe5b5[_0x4715d2];return _0x141811;};'use strict';var client=require(_0x5e5b('0x0'));exports[_0x5e5b('0x1')]=function(){return function(){return client[_0x5e5b('0x2')](_0x5e5b('0x3'),{'options':{'raw':!![],'attributes':['id',_0x5e5b('0x4'),_0x5e5b('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x5e5b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 5ff0312..58f7efa 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 _0x0e5a=['dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','active','Pause','mandatoryDispositionPause','callerid','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel'];(function(_0x19beab,_0x2c9e3e){var _0x14d7fe=function(_0x96cb5){while(--_0x96cb5){_0x19beab['push'](_0x19beab['shift']());}};_0x14d7fe(++_0x2c9e3e);}(_0x0e5a,0x16f));var _0xa0e5=function(_0x2a0bfc,_0x1400d2){_0x2a0bfc=_0x2a0bfc-0x0;var _0x378362=_0x0e5a[_0x2a0bfc];return _0x378362;};'use strict';var client=require(_0xa0e5('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xa0e5('0x1')](_0xa0e5('0x2'),{'options':{'raw':![],'attributes':['id',_0xa0e5('0x3'),_0xa0e5('0x4'),_0xa0e5('0x5'),_0xa0e5('0x6'),'monitor_format','type','dialActive',_0xa0e5('0x7'),_0xa0e5('0x8'),_0xa0e5('0x9'),_0xa0e5('0xa'),_0xa0e5('0xb'),'dialPredictiveOptimizationPercentage',_0xa0e5('0xc'),_0xa0e5('0xd'),_0xa0e5('0xe'),_0xa0e5('0xf'),_0xa0e5('0x10'),_0xa0e5('0x11'),'dialQueueProject',_0xa0e5('0x12'),_0xa0e5('0x13'),_0xa0e5('0x14'),_0xa0e5('0x15'),_0xa0e5('0x16'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0xa0e5('0x17'),_0xa0e5('0x18'),_0xa0e5('0x19'),_0xa0e5('0x1a'),_0xa0e5('0x1b'),'dialAMDGreeting',_0xa0e5('0x1c'),_0xa0e5('0x1d'),_0xa0e5('0x1e'),_0xa0e5('0x1f'),_0xa0e5('0x20'),'dialAMDSilenceThreshold',_0xa0e5('0x21'),_0xa0e5('0x22'),_0xa0e5('0x23'),_0xa0e5('0x24'),_0xa0e5('0x25'),_0xa0e5('0x26'),'dialAgiAfterHangupClient',_0xa0e5('0x27'),_0xa0e5('0x28'),'strategy',_0xa0e5('0x29'),_0xa0e5('0x2a'),_0xa0e5('0x2b'),_0xa0e5('0x2c'),_0xa0e5('0x2d'),_0xa0e5('0x2e'),_0xa0e5('0x2f'),_0xa0e5('0x30'),_0xa0e5('0x31'),_0xa0e5('0x32'),_0xa0e5('0x33'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0xa0e5('0x34'),'dialPredictiveIntervalMinThreshold',_0xa0e5('0x35'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xa0e5('0x36'),'attributes':['id',_0xa0e5('0x3'),'callerid',_0xa0e5('0x37')]},{'model':_0xa0e5('0x38'),'as':_0xa0e5('0x39'),'attributes':['id',_0xa0e5('0x3')]},{'model':_0xa0e5('0x36'),'as':'TrunkBackup','attributes':['id',_0xa0e5('0x3'),_0xa0e5('0x3a'),_0xa0e5('0x37')]},{'model':_0xa0e5('0x3b'),'as':_0xa0e5('0x3b'),'attributes':['id',_0xa0e5('0x3')],'include':[{'model':'Interval','as':_0xa0e5('0x3c'),'attributes':['id',_0xa0e5('0x3'),_0xa0e5('0x3d')]}]}]},'log':_0xa0e5('0x3e')});};}; \ No newline at end of file +var _0xebd5=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','callerid','Interval','Intervals','../client','getVoiceQueues','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry'];(function(_0x13e144,_0x549cf3){var _0x885cd2=function(_0x5772cf){while(--_0x5772cf){_0x13e144['push'](_0x13e144['shift']());}};_0x885cd2(++_0x549cf3);}(_0xebd5,0xbb));var _0x5ebd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xebd5[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x5ebd('0x0'));exports[_0x5ebd('0x1')]=function(){return function(){return client['Request'](_0x5ebd('0x2'),{'options':{'raw':![],'attributes':['id',_0x5ebd('0x3'),'acw',_0x5ebd('0x4'),'autopause',_0x5ebd('0x5'),_0x5ebd('0x6'),_0x5ebd('0x7'),'dialMethod',_0x5ebd('0x8'),'dialLimitQueue',_0x5ebd('0x9'),_0x5ebd('0xa'),'dialPredictiveOptimizationPercentage',_0x5ebd('0xb'),_0x5ebd('0xc'),_0x5ebd('0xd'),'dialOriginateTimeout','dialQueueOptions','dialQueueTimeout',_0x5ebd('0xe'),_0x5ebd('0xf'),_0x5ebd('0x10'),_0x5ebd('0x11'),_0x5ebd('0x12'),_0x5ebd('0x13'),_0x5ebd('0x14'),_0x5ebd('0x15'),_0x5ebd('0x16'),'dialGlobalInterval',_0x5ebd('0x17'),'dialCheckDuplicateType',_0x5ebd('0x18'),_0x5ebd('0x19'),_0x5ebd('0x1a'),'dialAMDAfterGreetingSilence',_0x5ebd('0x1b'),'dialAMDMinWordLength',_0x5ebd('0x1c'),_0x5ebd('0x1d'),_0x5ebd('0x1e'),_0x5ebd('0x1f'),_0x5ebd('0x20'),_0x5ebd('0x21'),_0x5ebd('0x22'),_0x5ebd('0x23'),'dialAgiAfterHangupAgent',_0x5ebd('0x24'),_0x5ebd('0x25'),_0x5ebd('0x5'),_0x5ebd('0x26'),'dialRandomLastDigitCallerIdNumber',_0x5ebd('0x27'),'dialNoSuchNumberMaxRetry',_0x5ebd('0x28'),_0x5ebd('0x29'),_0x5ebd('0x2a'),_0x5ebd('0x2b'),'dialAbandonedRetryFrequency',_0x5ebd('0x2c'),'dialMachineRetryFrequency',_0x5ebd('0x2d'),_0x5ebd('0x2e'),_0x5ebd('0x2f'),_0x5ebd('0x30'),'dialPredictiveIntervalMinThreshold',_0x5ebd('0x31'),_0x5ebd('0x32')],'include':[{'model':_0x5ebd('0x33'),'as':_0x5ebd('0x33'),'attributes':['id','name','callerid',_0x5ebd('0x34')]},{'model':_0x5ebd('0x35'),'as':_0x5ebd('0x36'),'attributes':['id',_0x5ebd('0x3')]},{'model':_0x5ebd('0x33'),'as':'TrunkBackup','attributes':['id',_0x5ebd('0x3'),_0x5ebd('0x37'),_0x5ebd('0x34')]},{'model':_0x5ebd('0x38'),'as':_0x5ebd('0x38'),'attributes':['id','name'],'include':[{'model':_0x5ebd('0x38'),'as':_0x5ebd('0x39'),'attributes':['id','name','interval']}]}]},'log':_0x5ebd('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f9c0e1a..6d23536 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(_0x26e98b,_0x1206c6){var _0x1c9aa1=function(_0x32c487){while(--_0x32c487){_0x26e98b['push'](_0x26e98b['shift']());}};_0x1c9aa1(++_0x1206c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0xda3858,_0x2a1cbb){var _0x559114=function(_0x4a6e64){while(--_0x4a6e64){_0xda3858['push'](_0xda3858['shift']());}};_0x559114(++_0x2a1cbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 169e8b2..e7c1c91 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 _0x086a=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x086a,0x180));var _0xa086=function(_0x2468f0,_0xc0b76e){_0x2468f0=_0x2468f0-0x0;var _0x2b65bf=_0x086a[_0x2468f0];return _0x2b65bf;};'use strict';var client=require(_0xa086('0x0'));exports[_0xa086('0x1')]=function(_0x485efa){return function(){return client[_0xa086('0x2')](_0xa086('0x3'),{'options':{'where':{'VoiceQueueId':_0x485efa,'paused':!![]},'raw':!![]},'log':_0xa086('0x1')});};}; \ No newline at end of file +var _0x7275=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x7275,0x98));var _0x5727=function(_0x12dfa1,_0x36ff32){_0x12dfa1=_0x12dfa1-0x0;var _0x5db581=_0x7275[_0x12dfa1];return _0x5db581;};'use strict';var client=require('../client');exports[_0x5727('0x0')]=function(_0x35aa86){return function(){return client['Request'](_0x5727('0x1'),{'options':{'where':{'VoiceQueueId':_0x35aa86,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3f3125a..0a2f5a3 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xd0945a,_0xcb3cb2){var _0x4a234f=function(_0x137290){while(--_0x137290){_0xd0945a['push'](_0xd0945a['shift']());}};_0x4a234f(++_0xcb3cb2);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x44b7bf,_0x46e126){var _0x32a1f2=function(_0x558651){while(--_0x558651){_0x44b7bf['push'](_0x44b7bf['shift']());}};_0x32a1f2(++_0x46e126);}(_0x7a54,0x106));var _0x47a5=function(_0x401569,_0x343ea7){_0x401569=_0x401569-0x0;var _0x458816=_0x7a54[_0x401569];return _0x458816;};'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 e879c2a..0eeccf7 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 _0x41fc=['transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel'];(function(_0x5767c1,_0xc8267c){var _0x4e3bfc=function(_0x2bc29d){while(--_0x2bc29d){_0x5767c1['push'](_0x5767c1['shift']());}};_0x4e3bfc(++_0xc8267c);}(_0x41fc,0x128));var _0xc41f=function(_0x47a328,_0x52ac15){_0x47a328=_0x47a328-0x0;var _0x16ad43=_0x41fc[_0x47a328];return _0x16ad43;};'use strict';var client=require('../client');exports[_0xc41f('0x0')]={};exports[_0xc41f('0x1')]=function(_0x20ea21){return client['Request'](_0xc41f('0x2'),{'body':{'result':_0x20ea21[_0xc41f('0x3')],'transfererchannel':_0x20ea21[_0xc41f('0x4')],'transferercalleridnum':_0x20ea21[_0xc41f('0x5')],'transferercalleridname':_0x20ea21[_0xc41f('0x6')],'transfererconnectedlinenum':_0x20ea21[_0xc41f('0x7')],'transfererconnectedlinename':_0x20ea21['transfererconnectedlinename'],'transfereraccountcode':_0x20ea21[_0xc41f('0x8')],'transferercontext':_0x20ea21[_0xc41f('0x9')],'transfererexten':_0x20ea21[_0xc41f('0xa')],'transfererlinkedid':_0x20ea21[_0xc41f('0xb')],'transfereechannel':_0x20ea21[_0xc41f('0xc')],'transfereecalleridnum':_0x20ea21[_0xc41f('0xd')],'transfereecalleridname':_0x20ea21[_0xc41f('0xe')],'transfereeconnectedlinenum':_0x20ea21['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x20ea21[_0xc41f('0xf')],'transfereeaccountcode':_0x20ea21[_0xc41f('0x10')],'transfereecontext':_0x20ea21[_0xc41f('0x11')],'transfereeexten':_0x20ea21[_0xc41f('0x12')],'transfereelinkedid':_0x20ea21[_0xc41f('0x13')],'isexternal':_0x20ea21['isexternal'],'context':_0x20ea21[_0xc41f('0x14')],'extension':_0x20ea21[_0xc41f('0x15')],'type':_0xc41f('0x16')},'log':_0xc41f('0x2')});};exports[_0xc41f('0x17')]=function(_0x557331){return client[_0xc41f('0x18')](_0xc41f('0x2'),{'body':{'result':_0x557331['result'],'transfererchannel':_0x557331[_0xc41f('0x19')],'transferercalleridnum':_0x557331[_0xc41f('0x1a')],'transferercalleridname':_0x557331[_0xc41f('0x1b')],'transfererconnectedlinenum':_0x557331['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x557331['secondtransfererconnectedlinename'],'transfereraccountcode':_0x557331[_0xc41f('0x1c')],'transferercontext':_0x557331[_0xc41f('0x1d')],'transfererexten':_0x557331[_0xc41f('0x1e')],'transfererlinkedid':_0x557331['origtransfererlinkedid'],'transfereechannel':_0x557331[_0xc41f('0x1f')],'transfereecalleridnum':_0x557331[_0xc41f('0x20')],'transfereecalleridname':_0x557331[_0xc41f('0x21')],'transfereeconnectedlinenum':_0x557331[_0xc41f('0x22')],'transfereeconnectedlinename':_0x557331[_0xc41f('0x23')],'transfereeaccountcode':_0x557331[_0xc41f('0x24')],'transfereecontext':_0x557331[_0xc41f('0x25')],'transfereeexten':_0x557331[_0xc41f('0x26')],'transfereelinkedid':_0x557331[_0xc41f('0x27')],'isexternal':_0x557331['isexternal'],'context':_0x557331[_0xc41f('0x28')],'extension':_0x557331[_0xc41f('0x29')],'type':_0xc41f('0x2a')},'log':_0xc41f('0x2')});}; \ No newline at end of file +var _0xb2d9=['transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext'];(function(_0x2dcb3e,_0x26414d){var _0x884bc5=function(_0x30b958){while(--_0x30b958){_0x2dcb3e['push'](_0x2dcb3e['shift']());}};_0x884bc5(++_0x26414d);}(_0xb2d9,0x160));var _0x9b2d=function(_0x6ef6fb,_0x5f4b1c){_0x6ef6fb=_0x6ef6fb-0x0;var _0x5cd62b=_0xb2d9[_0x6ef6fb];return _0x5cd62b;};'use strict';var client=require(_0x9b2d('0x0'));exports[_0x9b2d('0x1')]={};exports[_0x9b2d('0x2')]=function(_0x258a6d){return client[_0x9b2d('0x3')](_0x9b2d('0x4'),{'body':{'result':_0x258a6d[_0x9b2d('0x5')],'transfererchannel':_0x258a6d[_0x9b2d('0x6')],'transferercalleridnum':_0x258a6d['transferercalleridnum'],'transferercalleridname':_0x258a6d['transferercalleridname'],'transfererconnectedlinenum':_0x258a6d[_0x9b2d('0x7')],'transfererconnectedlinename':_0x258a6d[_0x9b2d('0x8')],'transfereraccountcode':_0x258a6d['transfereraccountcode'],'transferercontext':_0x258a6d[_0x9b2d('0x9')],'transfererexten':_0x258a6d[_0x9b2d('0xa')],'transfererlinkedid':_0x258a6d['transfererlinkedid'],'transfereechannel':_0x258a6d[_0x9b2d('0xb')],'transfereecalleridnum':_0x258a6d[_0x9b2d('0xc')],'transfereecalleridname':_0x258a6d[_0x9b2d('0xd')],'transfereeconnectedlinenum':_0x258a6d['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x258a6d[_0x9b2d('0xe')],'transfereeaccountcode':_0x258a6d[_0x9b2d('0xf')],'transfereecontext':_0x258a6d[_0x9b2d('0x10')],'transfereeexten':_0x258a6d['transfereeexten'],'transfereelinkedid':_0x258a6d[_0x9b2d('0x11')],'isexternal':_0x258a6d[_0x9b2d('0x12')],'context':_0x258a6d[_0x9b2d('0x13')],'extension':_0x258a6d['extension'],'type':_0x9b2d('0x14')},'log':_0x9b2d('0x4')});};exports[_0x9b2d('0x15')]=function(_0x395aa4){return client['Request'](_0x9b2d('0x4'),{'body':{'result':_0x395aa4[_0x9b2d('0x5')],'transfererchannel':_0x395aa4[_0x9b2d('0x16')],'transferercalleridnum':_0x395aa4[_0x9b2d('0x17')],'transferercalleridname':_0x395aa4[_0x9b2d('0x18')],'transfererconnectedlinenum':_0x395aa4[_0x9b2d('0x19')],'transfererconnectedlinename':_0x395aa4[_0x9b2d('0x1a')],'transfereraccountcode':_0x395aa4[_0x9b2d('0x1b')],'transferercontext':_0x395aa4[_0x9b2d('0x1c')],'transfererexten':_0x395aa4[_0x9b2d('0x1d')],'transfererlinkedid':_0x395aa4[_0x9b2d('0x1e')],'transfereechannel':_0x395aa4[_0x9b2d('0x1f')],'transfereecalleridnum':_0x395aa4[_0x9b2d('0x20')],'transfereecalleridname':_0x395aa4['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x395aa4[_0x9b2d('0x21')],'transfereeconnectedlinename':_0x395aa4[_0x9b2d('0x22')],'transfereeaccountcode':_0x395aa4[_0x9b2d('0x23')],'transfereecontext':_0x395aa4[_0x9b2d('0x24')],'transfereeexten':_0x395aa4[_0x9b2d('0x25')],'transfereelinkedid':_0x395aa4[_0x9b2d('0x26')],'isexternal':_0x395aa4[_0x9b2d('0x12')],'context':_0x395aa4[_0x9b2d('0x27')],'extension':_0x395aa4[_0x9b2d('0x28')],'type':'attended'},'log':_0x9b2d('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0263941..9dd0092 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x2e9c46,_0x1350e0){var _0xab228d=function(_0x300471){while(--_0x300471){_0x2e9c46['push'](_0x2e9c46['shift']());}};_0xab228d(++_0x1350e0);}(_0x7a54,0x106));var _0x47a5=function(_0x5aea97,_0x34f9df){_0x5aea97=_0x5aea97-0x0;var _0x15d375=_0x7a54[_0x5aea97];return _0x15d375;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +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(_0x104c8f,_0x51181e){var _0x3fec6d=function(_0x4617fe){while(--_0x4617fe){_0x104c8f['push'](_0x104c8f['shift']());}};_0x3fec6d(++_0x51181e);}(_0xb10b,0x12a));var _0xbb10=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xb10b[_0x35af23];return _0x340506;};'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 6b35ba4..7d8836c 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 _0xa37a=['stringify','emit','exec','data1','data2','data5','xmd-contactid','data3','split','phone','map','routeId','calleridnum','lastName','mobile','createdAt','updatedAt','union','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','destcalleridname','Unknown','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','destcalleridnum','format','user:%s','name','trigger:%s','toLowerCase','bluebird','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info'];(function(_0x92acb8,_0x56453f){var _0x149647=function(_0x2e8f94){while(--_0x2e8f94){_0x92acb8['push'](_0x92acb8['shift']());}};_0x149647(++_0x56453f);}(_0xa37a,0x135));var _0xaa37=function(_0x1aa59b,_0x440e6b){_0x1aa59b=_0x1aa59b-0x0;var _0x3d32ea=_0xa37a[_0x1aa59b];return _0x3d32ea;};'use strict';var _=require('lodash');var BPromise=require(_0xaa37('0x0'));var Redis=require('ioredis');var util=require('util');var config=require('../../../../config/environment');var logger=require(_0xaa37('0x1'))(_0xaa37('0x2'));var cmContactRpc=require(_0xaa37('0x3'));config[_0xaa37('0x4')]=_[_0xaa37('0x5')](config[_0xaa37('0x4')],{'host':_0xaa37('0x6'),'port':0x18eb});var io=require(_0xaa37('0x7'))(new Redis(config[_0xaa37('0x4')]));function emit(_0x52a806,_0x1ca119,_0xaa05ca,_0x312d48,_0x2d4d55){logger[_0xaa37('0x8')]('[CM][%s][%s]',_0x52a806,_0x1ca119['id'],_0xaa05ca,_0x312d48,JSON[_0xaa37('0x9')](_0x2d4d55));io['to'](_0xaa05ca)[_0xaa37('0xa')](_0x312d48,_0x2d4d55);}exports[_0xaa37('0xb')]=function(_0x419edc,_0x5a630d,_0x45b5e0,_0x364e22){var _0x39d691,_0x1e89de;var _0x1dbf67={};var _0xf9dd70;var _0x115c36=Number(_0x45b5e0[_0xaa37('0xc')]);var _0x240bdc=_0x45b5e0[_0xaa37('0xd')]?Boolean(Number(_0x45b5e0[_0xaa37('0xd')])):![];var _0x309699;var _0x17c7a4=![];if(!_['isNil'](_0x45b5e0[_0xaa37('0xe')])){if(_0x45b5e0[_0xaa37('0xe')]=='1')_0x17c7a4=!![];}if(!_0x17c7a4){if(_0x364e22[_0xaa37('0xf')]){_0x1dbf67['id']=_0x364e22[_0xaa37('0xf')];}}if(!_0x1dbf67['id']){_0x1dbf67['ListId']=_0x115c36;_0x309699=_0x45b5e0['data3']&&_0x45b5e0['data3']!=='0'?_0x45b5e0[_0xaa37('0x10')][_0xaa37('0x11')](','):[_0xaa37('0x12')];_0x1dbf67['$or']=_[_0xaa37('0x13')](_0x309699,function(_0x36551a){var _0x211555={};_0x211555[_0x36551a]=_0x364e22[_0xaa37('0x14')]?_0x364e22['destcalleridnum']:_0x364e22[_0xaa37('0x15')];return _0x211555;});_0xf9dd70=_0x364e22[_0xaa37('0x14')]?_0x364e22['destcalleridnum']:_0x364e22['calleridnum'];}var _0xa1d7d5=['id','firstName',_0xaa37('0x16'),_0xaa37('0x12'),_0xaa37('0x17'),'fax','ListId',_0xaa37('0x18'),'scheduledAt',_0xaa37('0x19')];var _0x1097d4=_[_0xaa37('0x1a')](_0xa1d7d5,_0x309699);BPromise['resolve']()[_0xaa37('0x1b')](cmContactRpc[_0xaa37('0x1c')]({'attributes':_0x1097d4,'where':_0x1dbf67,'phone':_0xf9dd70}))[_0xaa37('0x1b')](function(_0x59f311){_0x1e89de=_0x59f311;if(!_['isEmpty'](_0x1e89de)){if(_0x1e89de[_0xaa37('0x1d')]===0x1){_0x39d691=_0x1e89de[0x0];logger[_0xaa37('0x8')](_0xaa37('0x1e'),_0x364e22[_0xaa37('0x1f')],_0x5a630d['id'],_0x39d691['id']);}else{logger['info'](_0xaa37('0x20'),_0x364e22[_0xaa37('0x1f')],_0x5a630d['id'],_[_0xaa37('0x13')](_0x1e89de,'id')[_0xaa37('0x21')](','));}return;}else{logger[_0xaa37('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x364e22['uniqueid'],_0x5a630d['id']);var _0x59a602={'ListId':_0x115c36};var _0x4a480d=_0x45b5e0[_0xaa37('0x22')]&&_0x45b5e0['data4']!=='0'?_0x45b5e0[_0xaa37('0x22')]:_0xaa37('0x12');if(_0x240bdc){logger[_0xaa37('0x8')](_0xaa37('0x23'),_0x364e22[_0xaa37('0x1f')],_0x5a630d['id']);_0x59a602[_0x4a480d]=_['isNil'](_0x364e22[_0xaa37('0x14')])?_0x364e22[_0xaa37('0x15')]:_0x364e22['destcalleridnum'];if(_['isNil'](_0x364e22[_0xaa37('0x14')])){_0x59a602[_0xaa37('0x24')]=_0x364e22[_0xaa37('0x25')]&&_0x364e22[_0xaa37('0x25')]!==_0xaa37('0x26')?_0x364e22[_0xaa37('0x25')]:'Unknown';}else{_0x59a602[_0xaa37('0x24')]=_0x364e22[_0xaa37('0x27')]&&_0x364e22['destcalleridname']!==''?_0x364e22['destcalleridname']:_0xaa37('0x28');}return BPromise[_0xaa37('0x29')]()[_0xaa37('0x1b')](cmContactRpc[_0xaa37('0x2a')](_0x59a602))['then'](function(_0x19ec1e){_0x39d691=_0x19ec1e;_0x1e89de[_0xaa37('0x2b')](_0x19ec1e);if(_0x39d691){logger[_0xaa37('0x8')](_0xaa37('0x2c'),_0x364e22[_0xaa37('0x1f')],_0x5a630d['id'],_0x39d691['id']);}return;});}else{logger[_0xaa37('0x8')](_0xaa37('0x2d'),_0x364e22[_0xaa37('0x1f')],_0x5a630d['id']);_0x59a602[_0x4a480d]=_[_0xaa37('0x2e')](_0x364e22[_0xaa37('0x14')])?_0x364e22[_0xaa37('0x15')]:_0x364e22[_0xaa37('0x2f')];if(_[_0xaa37('0x2e')](_0x364e22[_0xaa37('0x14')])){_0x59a602[_0xaa37('0x24')]=_0x364e22[_0xaa37('0x25')]&&_0x364e22[_0xaa37('0x25')]!==_0xaa37('0x26')?_0x364e22[_0xaa37('0x25')]:_0xaa37('0x28');}else{_0x59a602[_0xaa37('0x24')]=_0x364e22[_0xaa37('0x27')]&&_0x364e22['destcalleridname']!==''?_0x364e22[_0xaa37('0x27')]:'Unknown';}_0x39d691=_0x59a602;_0x1e89de[_0xaa37('0x2b')](_0x59a602);return;}}})[_0xaa37('0x1b')](function(){if(_0x419edc){emit(_0x364e22[_0xaa37('0x1f')],_0x5a630d,util[_0xaa37('0x30')](_0xaa37('0x31'),_0x419edc[_0xaa37('0x32')]),util[_0xaa37('0x30')](_0xaa37('0x33'),_0x45b5e0['action'][_0xaa37('0x34')]()),{'evt':_['merge'](_0x364e22,{'autoCreate':_0x240bdc}),'contact':_0x39d691===undefined?{}:_0x39d691,'contacts':_0x1e89de[_0xaa37('0x1d')]===0x0?undefined:_0x1e89de});}});}; \ No newline at end of file +var _0xcb27=['firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','info','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','calleridname','format','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','destcalleridnum','calleridnum','routeId'];(function(_0x2c6fb9,_0xc7d7c0){var _0x49fd5e=function(_0x3dcbaf){while(--_0x3dcbaf){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x49fd5e(++_0xc7d7c0);}(_0xcb27,0x115));var _0x7cb2=function(_0x31a53a,_0x1028f7){_0x31a53a=_0x31a53a-0x0;var _0xab85ca=_0xcb27[_0x31a53a];return _0xab85ca;};'use strict';var _=require(_0x7cb2('0x0'));var BPromise=require(_0x7cb2('0x1'));var Redis=require(_0x7cb2('0x2'));var util=require(_0x7cb2('0x3'));var config=require(_0x7cb2('0x4'));var logger=require(_0x7cb2('0x5'))('trigger');var cmContactRpc=require(_0x7cb2('0x6'));config['redis']=_[_0x7cb2('0x7')](config[_0x7cb2('0x8')],{'host':_0x7cb2('0x9'),'port':0x18eb});var io=require(_0x7cb2('0xa'))(new Redis(config['redis']));function emit(_0x35451e,_0x108c71,_0x35f375,_0x164853,_0xb0229f){logger['info'](_0x7cb2('0xb'),_0x35451e,_0x108c71['id'],_0x35f375,_0x164853,JSON[_0x7cb2('0xc')](_0xb0229f));io['to'](_0x35f375)[_0x7cb2('0xd')](_0x164853,_0xb0229f);}exports[_0x7cb2('0xe')]=function(_0x46825d,_0x4c3a40,_0x21eca3,_0x31868b){var _0xe1ddeb,_0x32e4f6;var _0x219675={};var _0x304df7;var _0x4bd1c3=Number(_0x21eca3[_0x7cb2('0xf')]);var _0x18d867=_0x21eca3[_0x7cb2('0x10')]?Boolean(Number(_0x21eca3[_0x7cb2('0x10')])):![];var _0x403c64;var _0x43f905=![];if(!_[_0x7cb2('0x11')](_0x21eca3['data5'])){if(_0x21eca3[_0x7cb2('0x12')]=='1')_0x43f905=!![];}if(!_0x43f905){if(_0x31868b['xmd-contactid']){_0x219675['id']=_0x31868b[_0x7cb2('0x13')];}}if(!_0x219675['id']){_0x219675[_0x7cb2('0x14')]=_0x4bd1c3;_0x403c64=_0x21eca3[_0x7cb2('0x15')]&&_0x21eca3['data3']!=='0'?_0x21eca3[_0x7cb2('0x15')][_0x7cb2('0x16')](','):['phone'];_0x219675[_0x7cb2('0x17')]=_[_0x7cb2('0x18')](_0x403c64,function(_0x1a4a7d){var _0x2dd407={};_0x2dd407[_0x1a4a7d]=_0x31868b['routeId']?_0x31868b[_0x7cb2('0x19')]:_0x31868b[_0x7cb2('0x1a')];return _0x2dd407;});_0x304df7=_0x31868b[_0x7cb2('0x1b')]?_0x31868b[_0x7cb2('0x19')]:_0x31868b[_0x7cb2('0x1a')];}var _0x4faab2=['id',_0x7cb2('0x1c'),_0x7cb2('0x1d'),'phone',_0x7cb2('0x1e'),_0x7cb2('0x1f'),_0x7cb2('0x14'),_0x7cb2('0x20'),_0x7cb2('0x21'),_0x7cb2('0x22')];var _0x392941=_[_0x7cb2('0x23')](_0x4faab2,_0x403c64);BPromise[_0x7cb2('0x24')]()[_0x7cb2('0x25')](cmContactRpc[_0x7cb2('0x26')]({'attributes':_0x392941,'where':_0x219675,'phone':_0x304df7}))[_0x7cb2('0x25')](function(_0x4e0963){_0x32e4f6=_0x4e0963;if(!_[_0x7cb2('0x27')](_0x32e4f6)){if(_0x32e4f6[_0x7cb2('0x28')]===0x1){_0xe1ddeb=_0x32e4f6[0x0];logger[_0x7cb2('0x29')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x31868b[_0x7cb2('0x2a')],_0x4c3a40['id'],_0xe1ddeb['id']);}else{logger[_0x7cb2('0x29')](_0x7cb2('0x2b'),_0x31868b['uniqueid'],_0x4c3a40['id'],_[_0x7cb2('0x18')](_0x32e4f6,'id')[_0x7cb2('0x2c')](','));}return;}else{logger['info'](_0x7cb2('0x2d'),_0x31868b[_0x7cb2('0x2a')],_0x4c3a40['id']);var _0x389416={'ListId':_0x4bd1c3};var _0xb175da=_0x21eca3['data4']&&_0x21eca3[_0x7cb2('0x2e')]!=='0'?_0x21eca3[_0x7cb2('0x2e')]:_0x7cb2('0x2f');if(_0x18d867){logger[_0x7cb2('0x29')](_0x7cb2('0x30'),_0x31868b['uniqueid'],_0x4c3a40['id']);_0x389416[_0xb175da]=_[_0x7cb2('0x11')](_0x31868b['routeId'])?_0x31868b[_0x7cb2('0x1a')]:_0x31868b[_0x7cb2('0x19')];if(_[_0x7cb2('0x11')](_0x31868b[_0x7cb2('0x1b')])){_0x389416[_0x7cb2('0x1c')]=_0x31868b['calleridname']&&_0x31868b['calleridname']!==_0x7cb2('0x31')?_0x31868b['calleridname']:_0x7cb2('0x32');}else{_0x389416[_0x7cb2('0x1c')]=_0x31868b[_0x7cb2('0x33')]&&_0x31868b['destcalleridname']!==_0x7cb2('0x31')?_0x31868b[_0x7cb2('0x33')]:'Unknown';}return BPromise[_0x7cb2('0x24')]()[_0x7cb2('0x25')](cmContactRpc['createContact'](_0x389416))[_0x7cb2('0x25')](function(_0x1e6bae){_0xe1ddeb=_0x1e6bae;_0x32e4f6[_0x7cb2('0x34')](_0x1e6bae);if(_0xe1ddeb){logger[_0x7cb2('0x29')](_0x7cb2('0x35'),_0x31868b[_0x7cb2('0x2a')],_0x4c3a40['id'],_0xe1ddeb['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x31868b[_0x7cb2('0x2a')],_0x4c3a40['id']);_0x389416[_0xb175da]=_[_0x7cb2('0x11')](_0x31868b['routeId'])?_0x31868b[_0x7cb2('0x1a')]:_0x31868b['destcalleridnum'];if(_[_0x7cb2('0x11')](_0x31868b['routeId'])){_0x389416['firstName']=_0x31868b['calleridname']&&_0x31868b['calleridname']!==_0x7cb2('0x31')?_0x31868b[_0x7cb2('0x36')]:_0x7cb2('0x32');}else{_0x389416['firstName']=_0x31868b[_0x7cb2('0x33')]&&_0x31868b[_0x7cb2('0x33')]!==_0x7cb2('0x31')?_0x31868b['destcalleridname']:_0x7cb2('0x32');}_0xe1ddeb=_0x389416;_0x32e4f6['push'](_0x389416);return;}}})[_0x7cb2('0x25')](function(){if(_0x46825d){emit(_0x31868b['uniqueid'],_0x4c3a40,util[_0x7cb2('0x37')]('user:%s',_0x46825d[_0x7cb2('0x38')]),util[_0x7cb2('0x37')](_0x7cb2('0x39'),_0x21eca3[_0x7cb2('0x3a')][_0x7cb2('0x3b')]()),{'evt':_[_0x7cb2('0x3c')](_0x31868b,{'autoCreate':_0x18d867}),'contact':_0xe1ddeb===undefined?{}:_0xe1ddeb,'contacts':_0x32e4f6[_0x7cb2('0x28')]===0x0?undefined:_0x32e4f6});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0828a28..653284b 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 _0x90b3=['queue','routeId','exec','parse','query','replace','channel','AllConditions','AnyConditions','some','checkConditions','checkTrigger:\x20trigger','evt','field','chat','ChatWebsiteId','value','AccountId','operator','upperFirst','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','undefined','offlineMessage','created','equals','exports','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','emit','info','stringify','motionChannel','voice','inspect','prototype','checkTriggers','status','checkTrigger','merge','length','Actions','interface','action','toLowerCase','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','render','name','format','trigger:%s:%s','user:%s','trigger:%s','contactmanager'];(function(_0x19c19f,_0x41ae97){var _0x228a2c=function(_0x2847c2){while(--_0x2847c2){_0x19c19f['push'](_0x19c19f['shift']());}};_0x228a2c(++_0x41ae97);}(_0x90b3,0x123));var _0x390b=function(_0x76dd6e,_0x14dd80){_0x76dd6e=_0x76dd6e-0x0;var _0x35fb11=_0x90b3[_0x76dd6e];return _0x35fb11;};'use strict';var util=require(_0x390b('0x0'));var _=require(_0x390b('0x1'));var url=require(_0x390b('0x2'));var Mustache=require(_0x390b('0x3'));var Redis=require(_0x390b('0x4'));var urlforward=require('./urlforward');var integration=require(_0x390b('0x5'));var cmContact=require(_0x390b('0x6'));var script=require(_0x390b('0x7'));var config=require('../../../config/environment');var logger=require(_0x390b('0x8'))(_0x390b('0x9'));var ami=require(_0x390b('0xa'));config[_0x390b('0xb')]=_[_0x390b('0xc')](config['redis'],{'host':_0x390b('0xd'),'port':0x18eb});var io=require(_0x390b('0xe'))(new Redis(config[_0x390b('0xb')]));var operators={'equals':function(_0x55737b,_0xbd1df2){return _0x55737b==_0xbd1df2;},'not_equals':function(_0x38f114,_0x5a39b8){return _0x38f114!=_0x5a39b8;}};var barAndWebActions=[_0x390b('0xf'),'url',_0x390b('0x10')];function Trigger(_0x48bd54){this[_0x390b('0x11')]=_0x48bd54[_0x390b('0x11')];this[_0x390b('0x12')]=_0x48bd54[_0x390b('0x12')];this[_0x390b('0x13')]=_0x48bd54[_0x390b('0x13')];this[_0x390b('0x14')]=_0x48bd54['templates'];this[_0x390b('0x15')]=_0x48bd54['voiceExtensions'];this[_0x390b('0x16')]=_0x48bd54['zendeskAccounts'];this[_0x390b('0x17')]=_0x48bd54[_0x390b('0x17')];this['salesforceAccounts']=_0x48bd54[_0x390b('0x18')];this[_0x390b('0x19')]=_0x48bd54['sugarcrmAccounts'];this[_0x390b('0x1a')]=_0x48bd54[_0x390b('0x1a')];this[_0x390b('0x1b')]=_0x48bd54[_0x390b('0x1b')];this[_0x390b('0x1c')]=_0x48bd54[_0x390b('0x1c')];this[_0x390b('0x1d')]=_0x48bd54['servicenowAccounts'];this[_0x390b('0x1e')]=_0x48bd54['dynamics365Accounts'];this[_0x390b('0x1f')]=_0x48bd54[_0x390b('0x1f')];this[_0x390b('0x20')]={'zendesk':this[_0x390b('0x16')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x390b('0x17')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0x390b('0x1b')],'vtiger':this[_0x390b('0x1c')],'dynamics365':this[_0x390b('0x1e')],'freshsales':this[_0x390b('0x1f')],'servicenow':this[_0x390b('0x1d')]};ami['on'](_0x390b('0x21'),this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on'](_0x390b('0x24'),this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on']('custom:agentringnoanswer',this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on'](_0x390b('0x25'),this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on'](_0x390b('0x26'),this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on'](_0x390b('0x27'),this['syncCustomEvent'][_0x390b('0x23')](this));ami['on'](_0x390b('0x28'),this[_0x390b('0x22')]['bind'](this));ami['on'](_0x390b('0x29'),this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on'](_0x390b('0x2a'),this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on']('custom:amd',this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on'](_0x390b('0x2b'),this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on']('custom:timeout',this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on'](_0x390b('0x2c'),this[_0x390b('0x2d')][_0x390b('0x23')](this));ami['on'](_0x390b('0x2e'),this[_0x390b('0x2d')][_0x390b('0x23')](this));ami['on'](_0x390b('0x2f'),this[_0x390b('0x2d')][_0x390b('0x23')](this));ami['on'](_0x390b('0x30'),this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on'](_0x390b('0x31'),this[_0x390b('0x22')]['bind'](this));ami['on'](_0x390b('0x32'),this['syncCustomEvent']['bind'](this));ami['on'](_0x390b('0x33'),this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on'](_0x390b('0x34'),this['syncCustomEvent'][_0x390b('0x23')](this));ami['on'](_0x390b('0x35'),this[_0x390b('0x22')]['bind'](this));ami['on']('custom:rejectmessage',this[_0x390b('0x22')][_0x390b('0x23')](this));ami['on']('custom:offlineMessage',this[_0x390b('0x22')][_0x390b('0x23')](this));}Trigger['prototype'][_0x390b('0x36')]=function(_0x1bb42b,_0x283086,_0x20f9a8){logger[_0x390b('0x37')](_0x1bb42b,_0x283086,JSON[_0x390b('0x38')](_0x20f9a8));io['to'](_0x1bb42b)[_0x390b('0x36')](_0x283086,_0x20f9a8);};Trigger['prototype']['syncCustomEvent']=function(_0x50333b){var _0x132880=_['clone'](_0x50333b);if(typeof _0x132880[_0x390b('0x39')]==='undefined'){_0x132880[_0x390b('0x39')]=_0x390b('0x3a');}logger['debug'](_0x390b('0x22'),util[_0x390b('0x3b')](_0x132880,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x132880);};Trigger[_0x390b('0x3c')][_0x390b('0x2d')]=function(_0x46b99e){if(this[_0x390b('0x12')][_0x46b99e['interface']]){this['syncCustomEvent'](_0x46b99e);}};Trigger[_0x390b('0x3c')][_0x390b('0x3d')]=function(_0x20f0ce){var _0x2b8c4e;for(var _0xeabc1f in this[_0x390b('0x11')]){if(this[_0x390b('0x11')]['hasOwnProperty'](_0xeabc1f)){if(this['triggers'][_0xeabc1f][_0x390b('0x3e')]){_0x2b8c4e=this[_0x390b('0x3f')](this[_0x390b('0x11')][_0xeabc1f],_0x20f0ce);if(_0x2b8c4e){_[_0x390b('0x40')](_0x20f0ce,_0x20f0ce['variables']);for(var _0x1b3d00=0x0,_0x1ece9b,_0xf00cb4,_0x54da7b;_0x1b3d000x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x2580b8,_0x366aec){var _0x2687b8=function(_0x5d3bac){while(--_0x5d3bac){_0x2580b8['push'](_0x2580b8['shift']());}};_0x2687b8(++_0x366aec);}(_0x814b,0x1a2));var _0xb814=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x814b[_0x59ae8f];return _0x3900b5;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index b78cfeb..99fee45 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 _0x5f3e=['data2','resolve','POST','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','userId','toLowerCase','outbound','calleridnum','contacts','/systemusers(','4.0','headers','substring','lastIndexOf','enduserId','destcalleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','incidents','getString','Subjects','Descriptions','/contacts(','ticketType','phonecall','callDirection','queue','phonecalls','assign','Fields','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','dynamics365','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','data7','CloudProvider'];(function(_0x3a25e8,_0x84dc5c){var _0x55b8f3=function(_0x4e8119){while(--_0x4e8119){_0x3a25e8['push'](_0x3a25e8['shift']());}};_0x55b8f3(++_0x84dc5c);}(_0x5f3e,0x64));var _0xe5f3=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x5f3e[_0x36f47c];return _0x296c55;};'use strict';var _=require(_0xe5f3('0x0'));var rp=require(_0xe5f3('0x1'));var util=require('util');var intUtil=require(_0xe5f3('0x2'));var md5=require('md5');var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0xe5f3('0x3'));var config=require(_0xe5f3('0x4'));config[_0xe5f3('0x5')]=_['defaults'](config['redis'],{'host':_0xe5f3('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe5f3('0x5')]));function getAuthToken(_0x10e25a,_0x1c538d,_0x6a5844){if(_0x10e25a[_0xe5f3('0x7')]){_0x10e25a[_0xe5f3('0x8')]=_0x10e25a['CloudProvider'][_0xe5f3('0x9')];_0x10e25a['tenantId']=_0x10e25a[_0xe5f3('0xa')][_0xe5f3('0xb')];return Promise[_0xe5f3('0xc')](_0x10e25a['CloudProvider']['data5']);}var _0x2bfa90={'method':_0xe5f3('0xd'),'uri':_0x1c538d,'form':{'client_id':_0x10e25a['clientId'],'resource':_0x10e25a[_0xe5f3('0x8')],'username':_0x10e25a['username'],'password':_0x10e25a[_0xe5f3('0xe')],'grant_type':_0xe5f3('0xe'),'client_secret':_0x10e25a[_0xe5f3('0xf')]},'json':!![]};return rp(_0x2bfa90)[_0xe5f3('0x10')](function(_0x2c30b2){return _0x2c30b2[_0xe5f3('0x11')];})[_0xe5f3('0x12')](function(_0x1929c3){logger['error']('['+[_0x6a5844[_0xe5f3('0x13')]()]+_0xe5f3('0x14'));return _0x1929c3[_0xe5f3('0x15')];});}function getUser(_0x454cb6,_0x21fa61,_0x2ea2f6,_0x5c67e5,_0x26be38,_0x4e39a2){return new Promise(function(_0x51e6b8,_0x376d76){return getAuthToken(_0x21fa61,_0x5c67e5,_0x4e39a2)[_0xe5f3('0x10')](function(_0x549c73){var _0x50a683={'method':_0xe5f3('0x16'),'uri':_0x26be38+_0xe5f3('0x17'),'headers':{'Authorization':_0xe5f3('0x18')+_0x549c73,'OData-Version':'4.0'},'json':!![]};return rp(_0x50a683);})['then'](function(_0x43cdc5){var _0x40dd74=_0x43cdc5[_0xe5f3('0x19')];var _0x53b1d4=![];var _0x4e91b4=null;if(!_[_0xe5f3('0x1a')](_0x2ea2f6)){if(intUtil[_0xe5f3('0x1b')](_0x2ea2f6[_0xe5f3('0x1c')])){_0x454cb6[_0xe5f3('0x1d')]=_0x2ea2f6['email'];for(_0x4e91b4=0x0;_0x4e91b4<_0x40dd74[_0xe5f3('0x1e')];_0x4e91b4++){if(_0x40dd74[_0x4e91b4][_0xe5f3('0x1f')]===_0x2ea2f6['email']&&!_0x40dd74[_0x4e91b4][_0xe5f3('0x20')]){_0x53b1d4=!![];logger[_0xe5f3('0x21')]('['+[_0x4e39a2['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x40dd74[_0x4e91b4][_0xe5f3('0x22')]+'!');_0x454cb6['userId']=_0x40dd74[_0x4e91b4][_0xe5f3('0x22')];}}}}if(!_0x53b1d4){logger[_0xe5f3('0x21')]('['+[_0x4e39a2[_0xe5f3('0x13')]()]+_0xe5f3('0x23'));_0x454cb6[_0xe5f3('0x1d')]=_0x21fa61['username'];for(_0x4e91b4=0x0;_0x4e91b4<_0x40dd74[_0xe5f3('0x1e')];_0x4e91b4++){if(_0x40dd74[_0x4e91b4]['internalemailaddress']===_0x21fa61[_0xe5f3('0x24')]){_0x454cb6[_0xe5f3('0x25')]=_0x40dd74[_0x4e91b4][_0xe5f3('0x22')];}}}_0x51e6b8(_0x454cb6);})['catch'](function(_0x1b910e){_0x376d76(_0x1b910e[_0xe5f3('0x15')]);});});}function createEndUser(_0x363c2f,_0x2e33ac,_0x4e8f5a,_0x4f9a8f,_0x5c3c1f,_0x5ece4e,_0x389ce8){return new Promise(function(_0x1a7c08,_0x4906a5){return getAuthToken(_0x2e33ac,_0x4e8f5a,_0x5ece4e)[_0xe5f3('0x10')](function(_0x2fc5c2){var _0x3647a9=_0x5ece4e[_0xe5f3('0x26')]()===_0xe5f3('0x27')?_0x5c3c1f['destcalleridnum']:_0x5c3c1f[_0xe5f3('0x28')];var _0x3b6917={'method':_0xe5f3('0xd'),'uri':_0x4f9a8f+_0xe5f3('0x29'),'body':{'fullname':_0x3647a9,'firstname':_0x3647a9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe5f3('0x2a')+_0x363c2f[_0xe5f3('0x25')]+')'},'headers':{'Authorization':_0xe5f3('0x18')+_0x2fc5c2,'OData-Version':_0xe5f3('0x2b')},'json':!![],'resolveWithFullResponse':!![]};_0x3b6917['body'][_0x389ce8]=_0x3647a9;return rp(_0x3b6917);})['then'](function(_0x2c66da){var _0x1f257c=_0x2c66da[_0xe5f3('0x2c')]['odata-entityid'];var _0x153702=_0x1f257c[_0xe5f3('0x2d')](_0x1f257c['lastIndexOf']('(')+0x1,_0x1f257c[_0xe5f3('0x2e')](')'));_0x363c2f[_0xe5f3('0x2f')]=_0x153702;_0x1a7c08(_0x363c2f);})['catch'](function(_0x565ead){_0x4906a5(_0x565ead['message']);});});}function getEndUser(_0x2e9df2,_0x4c5ff2,_0x1f4472,_0x3e0311,_0x13d66c,_0x494d4d,_0x34542d,_0x547e2b){var _0x4ca330=_0x494d4d[_0xe5f3('0x26')]()===_0xe5f3('0x27')?_0x13d66c[_0xe5f3('0x30')]:_0x13d66c[_0xe5f3('0x28')];return getAuthToken(_0x4c5ff2,_0x1f4472,_0x494d4d)['then'](function(_0x18f621){_0x547e2b=_0x547e2b?_0x547e2b:_0xe5f3('0x31');var _0x1bad48={'method':_0xe5f3('0x16'),'uri':_0x3e0311+_0xe5f3('0x32')+_0x547e2b+_0xe5f3('0x33')+_0x547e2b+_0xe5f3('0x34')+_0x4ca330['replace']('+',_0xe5f3('0x35'))+'\x27','headers':{'Authorization':_0xe5f3('0x18')+_0x18f621,'If-None-Match':null,'OData-Version':_0xe5f3('0x2b')},'json':!![]};return rp(_0x1bad48);})[_0xe5f3('0x10')](function(_0x402a77){var _0x2ba7be=![];if(!_0x402a77)return _0x2ba7be;var _0x33ed6b=_0x402a77[_0xe5f3('0x19')];for(var _0x4d451a=0x0;_0x4d451a<_0x33ed6b['length'];_0x4d451a++){if(_0x33ed6b[_0x4d451a][_0x547e2b]===_0x4ca330){_0x2ba7be=!![];_0x2e9df2[_0xe5f3('0x2f')]=_0x33ed6b[_0x4d451a]['contactid'];}}return _0x2ba7be;})['then'](function(_0x84419f){if(_0x84419f)return _0x2e9df2;if(_0x34542d===_0xe5f3('0x36')){logger[_0xe5f3('0x21')]('['+[_0x494d4d[_0xe5f3('0x13')]()]+_0xe5f3('0x37'));return _0x2e9df2;}return createEndUser(_0x2e9df2,_0x4c5ff2,_0x1f4472,_0x3e0311,_0x13d66c,_0x494d4d,_0x547e2b)['then'](function(_0x944740){logger[_0xe5f3('0x21')]('['+[_0x494d4d[_0xe5f3('0x13')]()]+_0xe5f3('0x38'),_0x944740[_0xe5f3('0x2f')]);return _0x944740;});});}function getCustomFields(_0x56c409,_0x5beb4b,_0x44b896){var _0x2cafa4={};if(_0x56c409['length']>0x0){_[_0xe5f3('0x39')](_0x56c409,function(_0x51b7cd){if(_[_0xe5f3('0x3a')]([_0xe5f3('0x3b'),_0xe5f3('0x3c')],_0x51b7cd[_0xe5f3('0x3d')])&&_0x51b7cd[_0xe5f3('0x3e')]&&!_0x51b7cd[_0xe5f3('0x3f')]){var _0x24af7f=_0x51b7cd[_0xe5f3('0x40')][_0xe5f3('0x26')]();var _0x3c5606=_0x24af7f['substring'](0x0,_0x24af7f['indexOf']('_'));var _0x1b5957=_0x24af7f[_0xe5f3('0x2d')](_0x24af7f[_0xe5f3('0x41')]('_')+0x1);if(_0x3c5606===_0x44b896){_0x2cafa4[_0x1b5957]=_0x51b7cd[_0xe5f3('0x42')];}}});}return _0x2cafa4;}function getTicket(_0xd219e7,_0x34ed94,_0x27714d,_0x127f1c,_0x3025f7,_0x3770fd,_0x3ecdf9){return new Promise(function(_0x5ebe3f,_0x3e07be){var _0x185401;return getAuthToken(_0x34ed94,_0x27714d,_0x3ecdf9)[_0xe5f3('0x10')](function(_0x1bcfdf){if(_0x3770fd['ticketType']==='incident'){_0x185401={'method':_0xe5f3('0xd'),'uri':_0x127f1c+_0xe5f3('0x43'),'body':Object['assign']({},{'title':intUtil[_0xe5f3('0x44')](_0x3770fd[_0xe5f3('0x45')],_0x3025f7,'\x20'),'description':intUtil[_0xe5f3('0x44')](_0x3770fd[_0xe5f3('0x46')],_0x3025f7,'\x0a'),'customerid_contact@odata.bind':_0xd219e7['enduserId']?_0xe5f3('0x47')+_0xd219e7[_0xe5f3('0x2f')]+')':undefined,'ownerid@odata.bind':_0xe5f3('0x2a')+_0xd219e7[_0xe5f3('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x3770fd['Fields'],_0x3025f7,_0x3770fd['ticketType'])),'headers':{'Authorization':_0xe5f3('0x18')+_0x1bcfdf,'OData-Version':_0xe5f3('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3770fd[_0xe5f3('0x48')]===_0xe5f3('0x49')){var _0x379de2=_0xd219e7[_0xe5f3('0x2f')]?[{'partyid_systemuser@odata.bind':_0xe5f3('0x2a')+_0xd219e7['userId']+')','participationtypemask':_0xd219e7[_0xe5f3('0x4a')]===_0xe5f3('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0xe5f3('0x47')+_0xd219e7[_0xe5f3('0x2f')]+')','participationtypemask':_0xd219e7[_0xe5f3('0x4a')]===_0xe5f3('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe5f3('0x2a')+_0xd219e7['userId']+')','participationtypemask':_0xd219e7[_0xe5f3('0x4a')]==='queue'?0x2:0x1}];_0x185401={'method':_0xe5f3('0xd'),'uri':_0x127f1c+_0xe5f3('0x4c'),'body':Object[_0xe5f3('0x4d')]({},{'subject':intUtil[_0xe5f3('0x44')](_0x3770fd['Subjects'],_0x3025f7,'\x20'),'phonenumber':String(_0x3025f7[_0xe5f3('0x28')]),'description':intUtil['getString'](_0x3770fd[_0xe5f3('0x46')],_0x3025f7,'\x0a'),'regardingobjectid_contact@odata.bind':_0xd219e7[_0xe5f3('0x2f')]?_0xe5f3('0x47')+_0xd219e7['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0xd219e7[_0xe5f3('0x25')]+')','directioncode':_0xd219e7[_0xe5f3('0x4a')]===_0xe5f3('0x4b')?![]:!![],'phonecall_activity_parties':_0x379de2},getCustomFields(_0x3770fd[_0xe5f3('0x4e')],_0x3025f7,_0x3770fd[_0xe5f3('0x48')])),'headers':{'Authorization':_0xe5f3('0x18')+_0x1bcfdf,'OData-Version':_0xe5f3('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x185401);})[_0xe5f3('0x10')](function(_0x2fd9dc){var _0x5313c2=_0x2fd9dc[_0xe5f3('0x2c')]['odata-entityid'];var _0x513941=_0x5313c2[_0xe5f3('0x2d')](_0x5313c2['lastIndexOf']('(')+0x1,_0x5313c2['lastIndexOf'](')'));_0xd219e7[_0xe5f3('0x4f')]=_0x513941;_0x5ebe3f(_0xd219e7);})['catch'](function(_0x51ee99){_0x3e07be(_0x51ee99[_0xe5f3('0x15')]);});});}function emit(_0x4e297a,_0x387937,_0xe420e4,_0x9532ad){var _0x504a51={'uri':util[_0xe5f3('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x4e297a,_0xe420e4,_0x9532ad)};io['to'](util[_0xe5f3('0x50')](_0xe5f3('0x51'),_0x387937))[_0xe5f3('0x52')](_0xe5f3('0x53'),_0x504a51);}exports['cs']=function(_0x8e0bab,_0x18b399,_0x23b839,_0x3b1046,_0x354f04,_0x3773a8,_0x38ca2c,_0x4d786a){var _0x215b93={};_0x3773a8[_0xe5f3('0x8')]=_0x3773a8['modernAuthentication']?intUtil[_0xe5f3('0x54')](_0x3773a8[_0xe5f3('0xa')][_0xe5f3('0x9')]):intUtil[_0xe5f3('0x54')](_0x3773a8[_0xe5f3('0x8')]);_0x3773a8[_0xe5f3('0x55')]=intUtil[_0xe5f3('0x54')](_0x3773a8['serverUrl']);_0x215b93[_0xe5f3('0x4a')]=_0x4d786a===_0xe5f3('0x4b')||_0x4d786a===_0xe5f3('0x56')?_0xe5f3('0x4b'):'outbound';var _0x138e95=_0x3773a8[_0xe5f3('0x7')]?util[_0xe5f3('0x50')](_0xe5f3('0x57'),_0x3773a8[_0xe5f3('0xa')][_0xe5f3('0x9')]):util[_0xe5f3('0x50')]('%s/api/data/v9.0/',_0x3773a8[_0xe5f3('0x8')]);var _0x17af05=util['format'](_0xe5f3('0x58'),_0x3773a8[_0xe5f3('0x59')]);var _0x114e35=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3773a8[_0xe5f3('0x55')],_0x18b399[_0xe5f3('0x5a')],md5(_0x18b399[_0xe5f3('0x5a')]));if(_0x354f04&&_0x354f04[_0xe5f3('0x5b')]){logger[_0xe5f3('0x21')](_0xe5f3('0x5c'),_0xe5f3('0x5d'));_0x18b399[_0xe5f3('0x5e')]=_0x114e35;}else if(_0x38ca2c&&_0x38ca2c[_0xe5f3('0x5f')]&&_0x38ca2c[_0xe5f3('0x5f')]!==_0xe5f3('0x60')){logger[_0xe5f3('0x21')](_0xe5f3('0x61'),'Recording\x20is\x20enabled!');_0x18b399['recordingURL']=_0x114e35;}else{_0x18b399[_0xe5f3('0x5e')]='';}return getUser(_0x215b93,_0x3773a8,_0x3b1046,_0x17af05,_0x138e95,_0x4d786a)[_0xe5f3('0x10')](function(_0xc4a9b1){logger['info']('['+_0x4d786a[_0xe5f3('0x13')]()+_0xe5f3('0x62'),_0xc4a9b1[_0xe5f3('0x25')]);logger['info']('['+_0x4d786a[_0xe5f3('0x13')]()+_0xe5f3('0x63'),_0xc4a9b1[_0xe5f3('0x1d')]);return getEndUser(_0xc4a9b1,_0x3773a8,_0x17af05,_0x138e95,_0x18b399,_0x4d786a,_0x23b839[_0xe5f3('0x64')],_0x23b839[_0xe5f3('0x65')]);})['then'](function(_0x24ac53){logger[_0xe5f3('0x21')]('['+_0x4d786a[_0xe5f3('0x13')]()+_0xe5f3('0x66'),_0x24ac53[_0xe5f3('0x2f')]);logger[_0xe5f3('0x21')]('['+_0x4d786a[_0xe5f3('0x13')]()+_0xe5f3('0x67'),_0x18b399[_0xe5f3('0x28')]);return getTicket(_0x24ac53,_0x3773a8,_0x17af05,_0x138e95,_0x18b399,_0x23b839,_0x4d786a);})[_0xe5f3('0x10')](function(_0x444f08){logger[_0xe5f3('0x21')](util[_0xe5f3('0x50')]('['+_0x4d786a[_0xe5f3('0x13')]()+_0xe5f3('0x68'),_0x23b839[_0xe5f3('0x48')],_0x444f08[_0xe5f3('0x4f')]));logger[_0xe5f3('0x21')](util[_0xe5f3('0x50')]('['+_0x4d786a[_0xe5f3('0x13')]()+_0xe5f3('0x69'),_0x4d786a));if(_0x4d786a!==_0xe5f3('0x56')&&_0x23b839[_0xe5f3('0x6a')]){logger['info']('['+_0x4d786a[_0xe5f3('0x13')]()+']',_0xe5f3('0x6b'));emit(_0x3773a8['remoteUri'],_0x3b1046[_0xe5f3('0x6c')],_0x23b839[_0xe5f3('0x48')],_0x444f08['ticketId']);}})[_0xe5f3('0x12')](function(_0xc72d81){logger[_0xe5f3('0x6d')]('['+_0x4d786a[_0xe5f3('0x13')]()+_0xe5f3('0x6e'),_0xc72d81[_0xe5f3('0x15')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0xc72d81);});}; \ No newline at end of file +var _0x23af=['tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','resolve','POST','clientId','remoteUri','username','password','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','info','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','lastIndexOf','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','enduserId','includes','string','picklist','type','nameField','customField','idField','indexOf','substring','ticketType','incidents','Subjects','getString','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','assign','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x23af,0x1d6));var _0xf23a=function(_0x1d3271,_0x5155d8){_0x1d3271=_0x1d3271-0x0;var _0x5801f2=_0x23af[_0x1d3271];return _0x5801f2;};'use strict';var _=require(_0xf23a('0x0'));var rp=require(_0xf23a('0x1'));var util=require(_0xf23a('0x2'));var intUtil=require(_0xf23a('0x3'));var md5=require(_0xf23a('0x4'));var Redis=require(_0xf23a('0x5'));var logger=require(_0xf23a('0x6'))(_0xf23a('0x7'));var config=require(_0xf23a('0x8'));config['redis']=_[_0xf23a('0x9')](config[_0xf23a('0xa')],{'host':_0xf23a('0xb'),'port':0x18eb});var io=require(_0xf23a('0xc'))(new Redis(config[_0xf23a('0xa')]));function getAuthToken(_0x460266,_0x25bc43,_0x156735){if(_0x460266[_0xf23a('0xd')]){_0x460266['remoteUri']=_0x460266[_0xf23a('0xe')][_0xf23a('0xf')];_0x460266['tenantId']=_0x460266[_0xf23a('0xe')]['data2'];return Promise[_0xf23a('0x10')](_0x460266[_0xf23a('0xe')]['data5']);}var _0xc95a5b={'method':_0xf23a('0x11'),'uri':_0x25bc43,'form':{'client_id':_0x460266[_0xf23a('0x12')],'resource':_0x460266[_0xf23a('0x13')],'username':_0x460266[_0xf23a('0x14')],'password':_0x460266[_0xf23a('0x15')],'grant_type':_0xf23a('0x15'),'client_secret':_0x460266['clientSecret']},'json':!![]};return rp(_0xc95a5b)[_0xf23a('0x16')](function(_0x38e223){return _0x38e223[_0xf23a('0x17')];})[_0xf23a('0x18')](function(_0x2d965a){logger[_0xf23a('0x19')]('['+[_0x156735['toUpperCase']()]+_0xf23a('0x1a'));return _0x2d965a[_0xf23a('0x1b')];});}function getUser(_0x5edb58,_0x49398b,_0x6bd7f9,_0x50336f,_0x1e6dfd,_0x5ed83a){return new Promise(function(_0x1607f9,_0x5cac2d){return getAuthToken(_0x49398b,_0x50336f,_0x5ed83a)[_0xf23a('0x16')](function(_0x1c8f81){var _0x58ce54={'method':_0xf23a('0x1c'),'uri':_0x1e6dfd+_0xf23a('0x1d'),'headers':{'Authorization':_0xf23a('0x1e')+_0x1c8f81,'OData-Version':_0xf23a('0x1f')},'json':!![]};return rp(_0x58ce54);})[_0xf23a('0x16')](function(_0x5878f4){var _0x3cac57=_0x5878f4[_0xf23a('0x20')];var _0x400f90=![];var _0x433996=null;if(!_[_0xf23a('0x21')](_0x6bd7f9)){if(intUtil[_0xf23a('0x22')](_0x6bd7f9[_0xf23a('0x23')])){_0x5edb58[_0xf23a('0x24')]=_0x6bd7f9[_0xf23a('0x23')];for(_0x433996=0x0;_0x433996<_0x3cac57[_0xf23a('0x25')];_0x433996++){if(_0x3cac57[_0x433996]['internalemailaddress']===_0x6bd7f9[_0xf23a('0x23')]&&!_0x3cac57[_0x433996]['isdisabled']){_0x400f90=!![];logger[_0xf23a('0x26')]('['+[_0x5ed83a[_0xf23a('0x27')]()]+_0xf23a('0x28')+_0x3cac57[_0x433996]['systemuserid']+'!');_0x5edb58[_0xf23a('0x29')]=_0x3cac57[_0x433996][_0xf23a('0x2a')];}}}}if(!_0x400f90){logger[_0xf23a('0x26')]('['+[_0x5ed83a[_0xf23a('0x27')]()]+_0xf23a('0x2b'));_0x5edb58['userEmail']=_0x49398b[_0xf23a('0x14')];for(_0x433996=0x0;_0x433996<_0x3cac57['length'];_0x433996++){if(_0x3cac57[_0x433996][_0xf23a('0x2c')]===_0x49398b[_0xf23a('0x14')]){_0x5edb58[_0xf23a('0x29')]=_0x3cac57[_0x433996][_0xf23a('0x2a')];}}}_0x1607f9(_0x5edb58);})['catch'](function(_0x27ace5){_0x5cac2d(_0x27ace5[_0xf23a('0x1b')]);});});}function createEndUser(_0x2fa682,_0xe4863,_0x24f9c4,_0x3c8a55,_0x5ed717,_0x15382e,_0x3367a9){return new Promise(function(_0x4fef4f,_0x162f54){return getAuthToken(_0xe4863,_0x24f9c4,_0x15382e)[_0xf23a('0x16')](function(_0x122f93){var _0xea44a3=_0x15382e[_0xf23a('0x2d')]()===_0xf23a('0x2e')?_0x5ed717[_0xf23a('0x2f')]:_0x5ed717[_0xf23a('0x30')];var _0x283dcc={'method':'POST','uri':_0x3c8a55+_0xf23a('0x31'),'body':{'fullname':_0xea44a3,'firstname':_0xea44a3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2fa682[_0xf23a('0x29')]+')'},'headers':{'Authorization':_0xf23a('0x1e')+_0x122f93,'OData-Version':_0xf23a('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x283dcc['body'][_0x3367a9]=_0xea44a3;return rp(_0x283dcc);})[_0xf23a('0x16')](function(_0xe796ee){var _0x436fc0=_0xe796ee[_0xf23a('0x32')][_0xf23a('0x33')];var _0x5ea9e9=_0x436fc0['substring'](_0x436fc0[_0xf23a('0x34')]('(')+0x1,_0x436fc0[_0xf23a('0x34')](')'));_0x2fa682['enduserId']=_0x5ea9e9;_0x4fef4f(_0x2fa682);})[_0xf23a('0x18')](function(_0x5d0313){_0x162f54(_0x5d0313['message']);});});}function getEndUser(_0x3fa092,_0x1ebb6e,_0x57dd5e,_0x46638c,_0x106076,_0x21cab1,_0x4409e5,_0x316102){var _0x3c8b66=_0x21cab1[_0xf23a('0x2d')]()===_0xf23a('0x2e')?_0x106076['destcalleridnum']:_0x106076[_0xf23a('0x30')];return getAuthToken(_0x1ebb6e,_0x57dd5e,_0x21cab1)[_0xf23a('0x16')](function(_0x4cc51){_0x316102=_0x316102?_0x316102:_0xf23a('0x35');var _0x430cce={'method':'GET','uri':_0x46638c+_0xf23a('0x36')+_0x316102+_0xf23a('0x37')+_0x316102+_0xf23a('0x38')+_0x3c8b66[_0xf23a('0x39')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4cc51,'If-None-Match':null,'OData-Version':_0xf23a('0x1f')},'json':!![]};return rp(_0x430cce);})['then'](function(_0x1148fb){var _0x5bc564=![];if(!_0x1148fb)return _0x5bc564;var _0x442f9a=_0x1148fb[_0xf23a('0x20')];for(var _0x530db8=0x0;_0x530db8<_0x442f9a['length'];_0x530db8++){if(_0x442f9a[_0x530db8][_0x316102]===_0x3c8b66){_0x5bc564=!![];_0x3fa092['enduserId']=_0x442f9a[_0x530db8][_0xf23a('0x3a')];}}return _0x5bc564;})[_0xf23a('0x16')](function(_0x54f30e){if(_0x54f30e)return _0x3fa092;if(_0x4409e5===_0xf23a('0x3b')){logger[_0xf23a('0x26')]('['+[_0x21cab1[_0xf23a('0x27')]()]+_0xf23a('0x3c'));return _0x3fa092;}return createEndUser(_0x3fa092,_0x1ebb6e,_0x57dd5e,_0x46638c,_0x106076,_0x21cab1,_0x316102)[_0xf23a('0x16')](function(_0x5cf7e7){logger['info']('['+[_0x21cab1[_0xf23a('0x27')]()]+_0xf23a('0x3d'),_0x5cf7e7[_0xf23a('0x3e')]);return _0x5cf7e7;});});}function getCustomFields(_0x55a48b,_0x5cda89,_0x2c0bdc){var _0x38fde3={};if(_0x55a48b[_0xf23a('0x25')]>0x0){_['forEach'](_0x55a48b,function(_0x44949f){if(_[_0xf23a('0x3f')]([_0xf23a('0x40'),_0xf23a('0x41')],_0x44949f[_0xf23a('0x42')])&&_0x44949f[_0xf23a('0x43')]&&!_0x44949f[_0xf23a('0x44')]){var _0x47fe4f=_0x44949f[_0xf23a('0x45')][_0xf23a('0x2d')]();var _0xd4c7cd=_0x47fe4f['substring'](0x0,_0x47fe4f[_0xf23a('0x46')]('_'));var _0x587632=_0x47fe4f[_0xf23a('0x47')](_0x47fe4f[_0xf23a('0x46')]('_')+0x1);if(_0xd4c7cd===_0x2c0bdc){_0x38fde3[_0x587632]=_0x44949f['content'];}}});}return _0x38fde3;}function getTicket(_0x2898cf,_0x41371a,_0x4df25f,_0x2900bc,_0x586a96,_0x385120,_0x2f9b60){return new Promise(function(_0x1a3283,_0x1acd8b){var _0x2f7ce6;return getAuthToken(_0x41371a,_0x4df25f,_0x2f9b60)[_0xf23a('0x16')](function(_0x1ecef3){if(_0x385120[_0xf23a('0x48')]==='incident'){_0x2f7ce6={'method':_0xf23a('0x11'),'uri':_0x2900bc+_0xf23a('0x49'),'body':Object['assign']({},{'title':intUtil['getString'](_0x385120[_0xf23a('0x4a')],_0x586a96,'\x20'),'description':intUtil[_0xf23a('0x4b')](_0x385120['Descriptions'],_0x586a96,'\x0a'),'customerid_contact@odata.bind':_0x2898cf[_0xf23a('0x3e')]?_0xf23a('0x4c')+_0x2898cf[_0xf23a('0x3e')]+')':undefined,'ownerid@odata.bind':_0xf23a('0x4d')+_0x2898cf['userId']+')','caseorigincode':'1'},getCustomFields(_0x385120[_0xf23a('0x4e')],_0x586a96,_0x385120[_0xf23a('0x48')])),'headers':{'Authorization':_0xf23a('0x1e')+_0x1ecef3,'OData-Version':_0xf23a('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x385120['ticketType']===_0xf23a('0x4f')){var _0xe534d0=_0x2898cf['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2898cf[_0xf23a('0x29')]+')','participationtypemask':_0x2898cf[_0xf23a('0x50')]===_0xf23a('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0xf23a('0x4c')+_0x2898cf['enduserId']+')','participationtypemask':_0x2898cf[_0xf23a('0x50')]===_0xf23a('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf23a('0x4d')+_0x2898cf[_0xf23a('0x29')]+')','participationtypemask':_0x2898cf[_0xf23a('0x50')]===_0xf23a('0x51')?0x2:0x1}];_0x2f7ce6={'method':_0xf23a('0x11'),'uri':_0x2900bc+_0xf23a('0x52'),'body':Object[_0xf23a('0x53')]({},{'subject':intUtil['getString'](_0x385120[_0xf23a('0x4a')],_0x586a96,'\x20'),'phonenumber':String(_0x586a96[_0xf23a('0x30')]),'description':intUtil[_0xf23a('0x4b')](_0x385120[_0xf23a('0x54')],_0x586a96,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2898cf[_0xf23a('0x3e')]?_0xf23a('0x4c')+_0x2898cf['enduserId']+')':undefined,'ownerid@odata.bind':_0xf23a('0x4d')+_0x2898cf[_0xf23a('0x29')]+')','directioncode':_0x2898cf[_0xf23a('0x50')]===_0xf23a('0x51')?![]:!![],'phonecall_activity_parties':_0xe534d0},getCustomFields(_0x385120[_0xf23a('0x4e')],_0x586a96,_0x385120[_0xf23a('0x48')])),'headers':{'Authorization':_0xf23a('0x1e')+_0x1ecef3,'OData-Version':_0xf23a('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2f7ce6);})[_0xf23a('0x16')](function(_0x327c01){var _0x1d55c4=_0x327c01['headers'][_0xf23a('0x33')];var _0x5d975d=_0x1d55c4['substring'](_0x1d55c4[_0xf23a('0x34')]('(')+0x1,_0x1d55c4[_0xf23a('0x34')](')'));_0x2898cf[_0xf23a('0x55')]=_0x5d975d;_0x1a3283(_0x2898cf);})['catch'](function(_0x3dfd4b){_0x1acd8b(_0x3dfd4b[_0xf23a('0x1b')]);});});}function emit(_0x391d12,_0x5f5423,_0x3ae515,_0x56b196){var _0x55ec51={'uri':util[_0xf23a('0x56')](_0xf23a('0x57'),_0x391d12,_0x3ae515,_0x56b196)};io['to'](util['format']('user:%s',_0x5f5423))[_0xf23a('0x58')](_0xf23a('0x59'),_0x55ec51);}exports['cs']=function(_0xc7c09e,_0x315749,_0x25656b,_0x5908a4,_0x24d2fb,_0x2a5601,_0x5f20e2,_0x1c516c){var _0x1d0d5a={};_0x2a5601[_0xf23a('0x13')]=_0x2a5601[_0xf23a('0xd')]?intUtil[_0xf23a('0x5a')](_0x2a5601['CloudProvider'][_0xf23a('0xf')]):intUtil[_0xf23a('0x5a')](_0x2a5601[_0xf23a('0x13')]);_0x2a5601['serverUrl']=intUtil[_0xf23a('0x5a')](_0x2a5601[_0xf23a('0x5b')]);_0x1d0d5a[_0xf23a('0x50')]=_0x1c516c===_0xf23a('0x51')||_0x1c516c===_0xf23a('0x5c')?_0xf23a('0x51'):_0xf23a('0x2e');var _0x598275=_0x2a5601[_0xf23a('0xd')]?util[_0xf23a('0x56')](_0xf23a('0x5d'),_0x2a5601[_0xf23a('0xe')][_0xf23a('0xf')]):util[_0xf23a('0x56')](_0xf23a('0x5d'),_0x2a5601[_0xf23a('0x13')]);var _0x3ec42d=util[_0xf23a('0x56')](_0xf23a('0x5e'),_0x2a5601[_0xf23a('0x5f')]);var _0xee61be=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a5601[_0xf23a('0x5b')],_0x315749[_0xf23a('0x60')],md5(_0x315749[_0xf23a('0x60')]));if(_0x24d2fb&&_0x24d2fb['monitor_format']){logger[_0xf23a('0x26')](_0xf23a('0x61'),_0xf23a('0x62'));_0x315749[_0xf23a('0x63')]=_0xee61be;}else if(_0x5f20e2&&_0x5f20e2[_0xf23a('0x64')]&&_0x5f20e2[_0xf23a('0x64')]!==_0xf23a('0x65')){logger[_0xf23a('0x26')](_0xf23a('0x66'),'Recording\x20is\x20enabled!');_0x315749[_0xf23a('0x63')]=_0xee61be;}else{_0x315749[_0xf23a('0x63')]='';}return getUser(_0x1d0d5a,_0x2a5601,_0x5908a4,_0x3ec42d,_0x598275,_0x1c516c)['then'](function(_0x3628a1){logger['info']('['+_0x1c516c[_0xf23a('0x27')]()+_0xf23a('0x67'),_0x3628a1[_0xf23a('0x29')]);logger[_0xf23a('0x26')]('['+_0x1c516c[_0xf23a('0x27')]()+']\x20The\x20User\x20email\x20is:',_0x3628a1[_0xf23a('0x24')]);return getEndUser(_0x3628a1,_0x2a5601,_0x3ec42d,_0x598275,_0x315749,_0x1c516c,_0x25656b[_0xf23a('0x68')],_0x25656b[_0xf23a('0x69')]);})[_0xf23a('0x16')](function(_0x1359d6){logger[_0xf23a('0x26')]('['+_0x1c516c['toUpperCase']()+_0xf23a('0x6a'),_0x1359d6[_0xf23a('0x3e')]);logger['info']('['+_0x1c516c['toUpperCase']()+_0xf23a('0x6b'),_0x315749[_0xf23a('0x30')]);return getTicket(_0x1359d6,_0x2a5601,_0x3ec42d,_0x598275,_0x315749,_0x25656b,_0x1c516c);})[_0xf23a('0x16')](function(_0x2ec221){logger['info'](util[_0xf23a('0x56')]('['+_0x1c516c[_0xf23a('0x27')]()+_0xf23a('0x6c'),_0x25656b['ticketType'],_0x2ec221[_0xf23a('0x55')]));logger[_0xf23a('0x26')](util[_0xf23a('0x56')]('['+_0x1c516c[_0xf23a('0x27')]()+_0xf23a('0x6d'),_0x1c516c));if(_0x1c516c!==_0xf23a('0x5c')&&_0x25656b[_0xf23a('0x6e')]){logger['info']('['+_0x1c516c[_0xf23a('0x27')]()+']',_0xf23a('0x6f'));emit(_0x2a5601[_0xf23a('0x13')],_0x5908a4[_0xf23a('0x70')],_0x25656b['ticketType'],_0x2ec221[_0xf23a('0x55')]);}})[_0xf23a('0x18')](function(_0x124288){logger['error']('['+_0x1c516c[_0xf23a('0x27')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x124288[_0xf23a('0x1b')]);console[_0xf23a('0x19')]('Error\x20running\x20Dynamics365\x20integration',_0x124288);});}; \ 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 2926b5d..bb2be21 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 _0x1271=['emit','info','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','string','type','nameField','toLowerCase','content','picklist','idField','customField','push','variable','variableName','Variable','queue','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','Authorization','destcalleridname','destcalleridnum','trigger:browser:url','%s/helpdesk/tickets/%d','catch','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json'];(function(_0x1f602c,_0xd76e79){var _0x368d3e=function(_0x47d491){while(--_0x47d491){_0x1f602c['push'](_0x1f602c['shift']());}};_0x368d3e(++_0xd76e79);}(_0x1271,0x1cb));var _0x1127=function(_0x3bc2e1,_0x363f8c){_0x3bc2e1=_0x3bc2e1-0x0;var _0x25bc6d=_0x1271[_0x3bc2e1];return _0x25bc6d;};'use strict';var _=require(_0x1127('0x0'));var rp=require(_0x1127('0x1'));var md5=require(_0x1127('0x2'));var util=require(_0x1127('0x3'));var Redis=require(_0x1127('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x1127('0x5'))('freshdesk');config[_0x1127('0x6')]=_[_0x1127('0x7')](config[_0x1127('0x6')],{'host':_0x1127('0x8'),'port':0x18eb});var io=require(_0x1127('0x9'))(new Redis(config[_0x1127('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x1127('0xa')};function emit(_0x1aeb6e,_0x1cde3f,_0x3657ea){io['to'](_0x1aeb6e)[_0x1127('0xb')](_0x1cde3f,_0x3657ea);}function getTicket(_0x1039aa,_0x1b9c4e,_0x57e8cc,_0x3185fe,_0x133925){logger[_0x1127('0xc')]('Creating\x20new\x20ticket...');var _0x3e75f6=_[_0x1127('0xd')]({'responder_id':_0x1b9c4e['id'],'requester_id':_0x57e8cc['id'],'name':util[_0x1127('0xe')](_0x1127('0xf'),_0x133925['calleridname']),'phone':_0x133925[_0x1127('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1127('0x11')](_0x3185fe[_0x1127('0x12')],_0x133925,'\x20'),'description':intUtil['getString'](_0x3185fe[_0x1127('0x13')],_0x133925,_0x1127('0x14')),'tags':getTags(_0x3185fe[_0x1127('0x15')],_0x1127('0x16'))},getCustomFields(_0x3185fe['Fields'],_0x133925));_0x3e75f6[_0x1127('0x17')]=_[_0x1127('0x18')](_[_0x1127('0x19')](_0x3e75f6[_0x1127('0x17')],'id'),'value');return request({'uri':util[_0x1127('0xe')]('%s/api/v2/tickets',_0x1039aa[_0x1127('0x1a')]),'method':'POST','body':_0x3e75f6})['then'](function(_0x53729c){logger['info'](_0x1127('0x1b'));return _0x53729c;});}function getUser(_0x4d85e6,_0xcea770){if(intUtil[_0x1127('0x1c')](_0xcea770)){return request({'uri':util[_0x1127('0xe')](_0x1127('0x1d'),_0x4d85e6[_0x1127('0x1a')]),'qs':{'email':_0xcea770}})[_0x1127('0x1e')](function(_0x55b125){if(_0x55b125[_0x1127('0x1f')]){logger[_0x1127('0xc')](_0x1127('0x20'));return _[_0x1127('0x21')](_0x55b125,function(_0x498d72){return _0x498d72[_0x1127('0x22')][_0x1127('0x23')]===_0xcea770;});}else{logger[_0x1127('0xc')](_0x1127('0x24'));return request({'uri':util[_0x1127('0xe')](_0x1127('0x25'),_0x4d85e6['remoteUri'])})['then'](function(_0x91cbbb){logger[_0x1127('0xc')](_0x1127('0x26'));return _0x91cbbb;});}});}else{logger[_0x1127('0xc')](_0x1127('0x27'));return request({'uri':util[_0x1127('0xe')](_0x1127('0x25'),_0x4d85e6['remoteUri'])})['then'](function(_0x56cfea){logger[_0x1127('0xc')](_0x1127('0x26'));return _0x56cfea;});}}function getEndUser(_0x17d60d,_0x4c2f77,_0x27cc39){logger[_0x1127('0xc')](_0x1127('0x28'),_0x27cc39);return request({'uri':util[_0x1127('0xe')](_0x1127('0x29'),_0x17d60d[_0x1127('0x1a')]),'qs':{'phone':_0x27cc39}})[_0x1127('0x1e')](function(_0x49dee1){if(_0x49dee1[_0x1127('0x1f')]){logger[_0x1127('0xc')]('Enduser\x20found!');return _['find'](_0x49dee1,{'phone':_0x27cc39});}else{logger['info'](_0x1127('0x2a'));return request({'uri':util[_0x1127('0xe')](_0x1127('0x29'),_0x17d60d[_0x1127('0x1a')]),'method':_0x1127('0x2b'),'body':{'name':_0x4c2f77,'phone':_0x27cc39}})['then'](function(_0x4e8122){logger[_0x1127('0xc')](_0x1127('0x2c'));return _0x4e8122;});}});}function getAuth(_0x42c186){return util[_0x1127('0xe')](_0x1127('0x2d'),new Buffer(_0x42c186[_0x1127('0x2e')]+':X')[_0x1127('0x2f')](_0x1127('0x30')));}function request(_0x2c62a6){logger[_0x1127('0x31')](_0x1127('0x32'),JSON[_0x1127('0x33')](_0x2c62a6));return rp(_[_0x1127('0x7')](_0x2c62a6,{'method':_0x1127('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x5280bd,_0x307165){var _0x84fa9e=[];if(_0x5280bd&&_0x5280bd[_0x1127('0x1f')]>0x0){_0x84fa9e=_[_0x1127('0x35')](_0x5280bd,_0x307165);}return _0x84fa9e;}function getCustomFields(_0x4ad6b2,_0x2eaa8b){var _0x3bb6f7=[];var _0x40a4fa={'custom_fields':[]};if(_0x4ad6b2['length']>0x0){_['forEach'](_0x4ad6b2,function(_0x1c739b){if(_['includes']([_0x1127('0x36'),'picklist'],_0x1c739b[_0x1127('0x37')])&&_0x1c739b[_0x1127('0x38')]&&!_0x1c739b['customField']){_0x40a4fa[_0x1c739b[_0x1127('0x38')][_0x1127('0x39')]()]=_0x1c739b[_0x1127('0x3a')][_0x1127('0x2f')]();}else if(_['includes']([_0x1127('0x36'),_0x1127('0x3b')],_0x1c739b[_0x1127('0x37')])&&_0x1c739b[_0x1127('0x3c')]&&_0x1c739b[_0x1127('0x3d')]){_0x40a4fa['custom_fields'][_0x1127('0x3e')]({'id':_0x1c739b[_0x1127('0x3c')],'value':_0x1c739b['content']['toString']()});}else if(_0x1c739b[_0x1127('0x37')]===_0x1127('0x3f')&&_0x1c739b[_0x1127('0x40')]&&_0x1c739b[_0x1127('0x3c')]&&_0x1c739b[_0x1127('0x3d')]){_0x2eaa8b[_0x1c739b[_0x1127('0x40')]]&&_0x40a4fa['custom_fields'][_0x1127('0x3e')]({'id':_0x1c739b['idField'],'value':_0x2eaa8b[_0x1c739b[_0x1127('0x40')]]['toString']()});}else if(_0x1c739b[_0x1127('0x37')]==='customVariable'&&_0x1c739b[_0x1127('0x41')]&&_0x1c739b[_0x1127('0x41')][_0x1127('0x16')]&&_0x1c739b[_0x1127('0x3c')]&&_0x1c739b['customField']){_0x2eaa8b[_0x1c739b[_0x1127('0x41')]['name'][_0x1127('0x39')]()]&&_0x40a4fa[_0x1127('0x17')][_0x1127('0x3e')]({'id':_0x1c739b[_0x1127('0x3c')],'value':_0x2eaa8b[_0x1c739b[_0x1127('0x41')]['name'][_0x1127('0x39')]()][_0x1127('0x2f')]()});}});}return _0x40a4fa;}exports[_0x1127('0x42')]=function(_0x4f5b64,_0x312d58,_0x2ab1c6,_0xcc7b2e,_0x1069ea,_0x2f24fb){var _0x47aa96,_0x157cf8;_0x2f24fb['remoteUri']=intUtil['stripTrailingSlash'](_0x2f24fb[_0x1127('0x1a')]);_0x2f24fb[_0x1127('0x43')]=intUtil['stripTrailingSlash'](_0x2f24fb[_0x1127('0x43')]);if(_0x1069ea&&_0x1069ea[_0x1127('0x44')]){logger[_0x1127('0xc')](_0x1127('0x45'),'Recording\x20is\x20enabled!');_0x312d58['recordingURL']=util[_0x1127('0xe')](_0x1127('0x46'),_0x2f24fb['serverUrl'],_0x312d58[_0x1127('0x47')],md5(_0x312d58[_0x1127('0x47')]));}else{_0x312d58['recordingURL']='';}headers['Authorization']=getAuth(_0x2f24fb);return getUser(_0x2f24fb,_0xcc7b2e[_0x1127('0x23')])[_0x1127('0x1e')](function(_0x5801ce){_0x47aa96=_0x5801ce;logger[_0x1127('0xc')](_0x1127('0x48'),_0x47aa96['id']);return getEndUser(_0x2f24fb,_0x312d58[_0x1127('0x49')],_0x312d58[_0x1127('0x10')]);})[_0x1127('0x1e')](function(_0x3a8043){_0x157cf8=_0x3a8043;logger[_0x1127('0xc')](_0x1127('0x4a'),_0x157cf8['id']);return getTicket(_0x2f24fb,_0x47aa96,_0x157cf8,_0x2ab1c6,_0x312d58);})[_0x1127('0x1e')](function(_0x5db604){if(_0x5db604&&_0x5db604['id']){logger[_0x1127('0xc')](_0x1127('0x1b'));logger['info'](_0x1127('0x4b'),_0x5db604['id']);logger[_0x1127('0xc')]('[QUEUE]',_0x1127('0x4c'));emit(util[_0x1127('0xe')](_0x1127('0x4d'),_0xcc7b2e[_0x1127('0x16')]),'trigger:browser:url',{'uri':util[_0x1127('0xe')]('%s/helpdesk/tickets/%d',_0x2f24fb[_0x1127('0x1a')],_0x5db604['id'])});}})['catch'](function(_0x4ea8c8){logger[_0x1127('0x4e')](_0x1127('0x45'),JSON[_0x1127('0x33')](_0x4ea8c8));});};exports['outbound']=function(_0x144887,_0x297621,_0x5cf60c,_0x58b4dc,_0x5c7b20,_0x3548bd,_0x307b42){var _0x8f334c,_0x35a003;_0x3548bd[_0x1127('0x1a')]=intUtil[_0x1127('0x4f')](_0x3548bd[_0x1127('0x1a')]);_0x3548bd[_0x1127('0x43')]=intUtil[_0x1127('0x4f')](_0x3548bd[_0x1127('0x43')]);if(_0x307b42&&_0x307b42[_0x1127('0x50')]&&_0x307b42[_0x1127('0x50')]!==_0x1127('0x51')){logger[_0x1127('0xc')](_0x1127('0x52'),_0x1127('0x53'));_0x297621[_0x1127('0x54')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3548bd[_0x1127('0x43')],_0x297621[_0x1127('0x47')],md5(_0x297621[_0x1127('0x47')]));}headers[_0x1127('0x55')]=getAuth(_0x3548bd);return getUser(_0x3548bd,_0x58b4dc[_0x1127('0x23')])[_0x1127('0x1e')](function(_0x18f272){_0x8f334c=_0x18f272;logger[_0x1127('0xc')](_0x1127('0x48'),_0x8f334c['id']);return getEndUser(_0x3548bd,_0x297621[_0x1127('0x56')],_0x297621[_0x1127('0x57')]);})[_0x1127('0x1e')](function(_0x567d1e){_0x35a003=_0x567d1e;logger[_0x1127('0xc')](_0x1127('0x4a'),_0x35a003['id']);return getTicket(_0x3548bd,_0x8f334c,_0x35a003,_0x5cf60c,_0x297621);})['then'](function(_0x5ae2d4){if(_0x5ae2d4&&_0x5ae2d4['id']){logger[_0x1127('0xc')]('Ticket\x20created!');logger[_0x1127('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5ae2d4['id']);logger['info'](_0x1127('0x52'),_0x1127('0x4c'));emit(util[_0x1127('0xe')](_0x1127('0x4d'),_0x58b4dc['name']),_0x1127('0x58'),{'uri':util[_0x1127('0xe')](_0x1127('0x59'),_0x3548bd[_0x1127('0x1a')],_0x5ae2d4['id'])});}})[_0x1127('0x5a')](function(_0xad8539){logger[_0x1127('0x4e')](_0x1127('0x52'),JSON[_0x1127('0x33')](_0xad8539));});};exports[_0x1127('0x5b')]=function(_0x2e4eba,_0x57a25,_0xd079bc,_0x471f48,_0x540168,_0x4e3ae8){var _0x47fea7,_0x2c2af7;_0x4e3ae8[_0x1127('0x1a')]=intUtil[_0x1127('0x4f')](_0x4e3ae8[_0x1127('0x1a')]);_0x4e3ae8[_0x1127('0x43')]=intUtil[_0x1127('0x4f')](_0x4e3ae8['serverUrl']);if(_0x540168&&_0x540168[_0x1127('0x44')]){logger[_0x1127('0xc')]('['+_0x57a25[_0x1127('0x5c')][_0x1127('0x5d')]()+']',_0x1127('0x53'));_0x57a25[_0x1127('0x54')]=util[_0x1127('0xe')](_0x1127('0x46'),_0x4e3ae8[_0x1127('0x43')],_0x57a25[_0x1127('0x47')],md5(_0x57a25['uniqueid']));}else{_0x57a25['recordingURL']='';}headers[_0x1127('0x55')]=getAuth(_0x4e3ae8);return getUser(_0x4e3ae8,'')[_0x1127('0x1e')](function(_0x4467e8){_0x47fea7=_0x4467e8;logger[_0x1127('0xc')](_0x1127('0x48'),_0x47fea7['id']);return getEndUser(_0x4e3ae8,_0x57a25[_0x1127('0x49')],_0x57a25[_0x1127('0x10')]);})['then'](function(_0x1e5b28){_0x2c2af7=_0x1e5b28;logger[_0x1127('0xc')](_0x1127('0x4a'),_0x2c2af7['id']);return getTicket(_0x4e3ae8,_0x47fea7,_0x2c2af7,_0xd079bc,_0x57a25);})[_0x1127('0x1e')](function(_0xcb389d){if(_0xcb389d){logger['info'](_0x1127('0x1b'));logger[_0x1127('0xc')](_0x1127('0x4b'),_0xcb389d['id']);}})[_0x1127('0x5a')](function(_0x590e3c){logger[_0x1127('0x4e')]('['+_0x57a25[_0x1127('0x5c')][_0x1127('0x5d')]()+']',JSON[_0x1127('0x33')](_0x590e3c));});}; \ No newline at end of file +var _0x79b3=['toUpperCase','catch','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','name','Fields','keyBy','custom_fields','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','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','error','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridnum','[OUTBOUND]','lastevent'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x79b3,0x110));var _0x379b=function(_0x19f47d,_0x2e0c3a){_0x19f47d=_0x19f47d-0x0;var _0x264b83=_0x79b3[_0x19f47d];return _0x264b83;};'use strict';var _=require(_0x379b('0x0'));var rp=require(_0x379b('0x1'));var md5=require(_0x379b('0x2'));var util=require(_0x379b('0x3'));var Redis=require(_0x379b('0x4'));var intUtil=require(_0x379b('0x5'));var config=require(_0x379b('0x6'));var logger=require('../../../../config/logger')(_0x379b('0x7'));config[_0x379b('0x8')]=_[_0x379b('0x9')](config[_0x379b('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x379b('0xa'))(new Redis(config[_0x379b('0x8')]));var headers={'Content-Type':_0x379b('0xb'),'Accept':_0x379b('0xb')};function emit(_0x45a032,_0x522619,_0x317fc5){io['to'](_0x45a032)[_0x379b('0xc')](_0x522619,_0x317fc5);}function getTicket(_0x11af82,_0x541739,_0x4c8ba3,_0x53abc5,_0x289a44){logger[_0x379b('0xd')]('Creating\x20new\x20ticket...');var _0x3c5518=_[_0x379b('0xe')]({'responder_id':_0x541739['id'],'requester_id':_0x4c8ba3['id'],'name':util[_0x379b('0xf')](_0x379b('0x10'),_0x289a44[_0x379b('0x11')]),'phone':_0x289a44[_0x379b('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x379b('0x13')](_0x53abc5['Subjects'],_0x289a44,'\x20'),'description':intUtil[_0x379b('0x13')](_0x53abc5[_0x379b('0x14')],_0x289a44,_0x379b('0x15')),'tags':getTags(_0x53abc5['Tags'],_0x379b('0x16'))},getCustomFields(_0x53abc5[_0x379b('0x17')],_0x289a44));_0x3c5518['custom_fields']=_['mapValues'](_[_0x379b('0x18')](_0x3c5518[_0x379b('0x19')],'id'),_0x379b('0x1a'));return request({'uri':util[_0x379b('0xf')]('%s/api/v2/tickets',_0x11af82[_0x379b('0x1b')]),'method':_0x379b('0x1c'),'body':_0x3c5518})[_0x379b('0x1d')](function(_0x57a86c){logger[_0x379b('0xd')](_0x379b('0x1e'));return _0x57a86c;});}function getUser(_0x4aae03,_0x344d83){if(intUtil[_0x379b('0x1f')](_0x344d83)){return request({'uri':util[_0x379b('0xf')]('%s/api/v2/agents',_0x4aae03[_0x379b('0x1b')]),'qs':{'email':_0x344d83}})['then'](function(_0x33d743){if(_0x33d743[_0x379b('0x20')]){logger[_0x379b('0xd')](_0x379b('0x21'));return _[_0x379b('0x22')](_0x33d743,function(_0x375e17){return _0x375e17[_0x379b('0x23')]['email']===_0x344d83;});}else{logger[_0x379b('0xd')](_0x379b('0x24'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x4aae03[_0x379b('0x1b')])})['then'](function(_0x1c50fd){logger[_0x379b('0xd')](_0x379b('0x25'));return _0x1c50fd;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x4aae03[_0x379b('0x1b')])})[_0x379b('0x1d')](function(_0x4d0550){logger[_0x379b('0xd')](_0x379b('0x25'));return _0x4d0550;});}}function getEndUser(_0x373778,_0x1b5320,_0x9039e4){logger[_0x379b('0xd')](_0x379b('0x26'),_0x9039e4);return request({'uri':util[_0x379b('0xf')](_0x379b('0x27'),_0x373778[_0x379b('0x1b')]),'qs':{'phone':_0x9039e4}})[_0x379b('0x1d')](function(_0x174e25){if(_0x174e25[_0x379b('0x20')]){logger['info'](_0x379b('0x28'));return _[_0x379b('0x22')](_0x174e25,{'phone':_0x9039e4});}else{logger[_0x379b('0xd')](_0x379b('0x29'));return request({'uri':util[_0x379b('0xf')](_0x379b('0x27'),_0x373778[_0x379b('0x1b')]),'method':_0x379b('0x1c'),'body':{'name':_0x1b5320,'phone':_0x9039e4}})[_0x379b('0x1d')](function(_0x169ffe){logger[_0x379b('0xd')](_0x379b('0x2a'));return _0x169ffe;});}});}function getAuth(_0x29e75a){return util['format'](_0x379b('0x2b'),new Buffer(_0x29e75a[_0x379b('0x2c')]+':X')[_0x379b('0x2d')](_0x379b('0x2e')));}function request(_0x4fdcf5){logger[_0x379b('0x2f')](_0x379b('0x30'),JSON[_0x379b('0x31')](_0x4fdcf5));return rp(_[_0x379b('0x9')](_0x4fdcf5,{'method':_0x379b('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x10fb41,_0x547d5c){var _0x5211bb=[];if(_0x10fb41&&_0x10fb41[_0x379b('0x20')]>0x0){_0x5211bb=_[_0x379b('0x33')](_0x10fb41,_0x547d5c);}return _0x5211bb;}function getCustomFields(_0x59108a,_0x4a660d){var _0xce27e3=[];var _0x810794={'custom_fields':[]};if(_0x59108a[_0x379b('0x20')]>0x0){_[_0x379b('0x34')](_0x59108a,function(_0xf33190){if(_[_0x379b('0x35')]([_0x379b('0x36'),_0x379b('0x37')],_0xf33190[_0x379b('0x38')])&&_0xf33190['nameField']&&!_0xf33190[_0x379b('0x39')]){_0x810794[_0xf33190[_0x379b('0x3a')][_0x379b('0x3b')]()]=_0xf33190[_0x379b('0x3c')][_0x379b('0x2d')]();}else if(_[_0x379b('0x35')]([_0x379b('0x36'),_0x379b('0x37')],_0xf33190[_0x379b('0x38')])&&_0xf33190[_0x379b('0x3d')]&&_0xf33190[_0x379b('0x39')]){_0x810794['custom_fields'][_0x379b('0x3e')]({'id':_0xf33190[_0x379b('0x3d')],'value':_0xf33190[_0x379b('0x3c')][_0x379b('0x2d')]()});}else if(_0xf33190[_0x379b('0x38')]===_0x379b('0x3f')&&_0xf33190[_0x379b('0x40')]&&_0xf33190[_0x379b('0x3d')]&&_0xf33190['customField']){_0x4a660d[_0xf33190[_0x379b('0x40')]]&&_0x810794['custom_fields'][_0x379b('0x3e')]({'id':_0xf33190['idField'],'value':_0x4a660d[_0xf33190[_0x379b('0x40')]][_0x379b('0x2d')]()});}else if(_0xf33190['type']===_0x379b('0x41')&&_0xf33190[_0x379b('0x42')]&&_0xf33190[_0x379b('0x42')][_0x379b('0x16')]&&_0xf33190[_0x379b('0x3d')]&&_0xf33190[_0x379b('0x39')]){_0x4a660d[_0xf33190['Variable']['name'][_0x379b('0x3b')]()]&&_0x810794[_0x379b('0x19')][_0x379b('0x3e')]({'id':_0xf33190[_0x379b('0x3d')],'value':_0x4a660d[_0xf33190[_0x379b('0x42')]['name'][_0x379b('0x3b')]()][_0x379b('0x2d')]()});}});}return _0x810794;}exports['queue']=function(_0x7bb9d7,_0x1ef361,_0x2f40db,_0x187e38,_0x3f9974,_0x399fcb){var _0x58df8c,_0x546405;_0x399fcb[_0x379b('0x1b')]=intUtil[_0x379b('0x43')](_0x399fcb[_0x379b('0x1b')]);_0x399fcb[_0x379b('0x44')]=intUtil[_0x379b('0x43')](_0x399fcb[_0x379b('0x44')]);if(_0x3f9974&&_0x3f9974[_0x379b('0x45')]){logger[_0x379b('0xd')](_0x379b('0x46'),_0x379b('0x47'));_0x1ef361[_0x379b('0x48')]=util[_0x379b('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x399fcb[_0x379b('0x44')],_0x1ef361['uniqueid'],md5(_0x1ef361[_0x379b('0x49')]));}else{_0x1ef361['recordingURL']='';}headers['Authorization']=getAuth(_0x399fcb);return getUser(_0x399fcb,_0x187e38['email'])[_0x379b('0x1d')](function(_0x4defa7){_0x58df8c=_0x4defa7;logger[_0x379b('0xd')](_0x379b('0x4a'),_0x58df8c['id']);return getEndUser(_0x399fcb,_0x1ef361[_0x379b('0x11')],_0x1ef361[_0x379b('0x12')]);})[_0x379b('0x1d')](function(_0x2197e2){_0x546405=_0x2197e2;logger[_0x379b('0xd')](_0x379b('0x4b'),_0x546405['id']);return getTicket(_0x399fcb,_0x58df8c,_0x546405,_0x2f40db,_0x1ef361);})[_0x379b('0x1d')](function(_0x8bb4bf){if(_0x8bb4bf&&_0x8bb4bf['id']){logger[_0x379b('0xd')](_0x379b('0x1e'));logger[_0x379b('0xd')](_0x379b('0x4c'),_0x8bb4bf['id']);logger[_0x379b('0xd')]('[QUEUE]',_0x379b('0x4d'));emit(util[_0x379b('0xf')](_0x379b('0x4e'),_0x187e38[_0x379b('0x16')]),_0x379b('0x4f'),{'uri':util['format'](_0x379b('0x50'),_0x399fcb['remoteUri'],_0x8bb4bf['id'])});}})['catch'](function(_0x3840e9){logger[_0x379b('0x51')](_0x379b('0x46'),JSON[_0x379b('0x31')](_0x3840e9));});};exports['outbound']=function(_0x49cc6f,_0x2c0543,_0x43a504,_0x45d12b,_0x471705,_0x4d2bad,_0x3a1658){var _0x1e70dd,_0x31502c;_0x4d2bad[_0x379b('0x1b')]=intUtil[_0x379b('0x43')](_0x4d2bad['remoteUri']);_0x4d2bad[_0x379b('0x44')]=intUtil[_0x379b('0x43')](_0x4d2bad[_0x379b('0x44')]);if(_0x3a1658&&_0x3a1658['recordingFormat']&&_0x3a1658[_0x379b('0x52')]!=='none'){logger[_0x379b('0xd')]('[OUTBOUND]',_0x379b('0x47'));_0x2c0543[_0x379b('0x48')]=util['format'](_0x379b('0x53'),_0x4d2bad['serverUrl'],_0x2c0543[_0x379b('0x49')],md5(_0x2c0543[_0x379b('0x49')]));}headers['Authorization']=getAuth(_0x4d2bad);return getUser(_0x4d2bad,_0x45d12b[_0x379b('0x54')])['then'](function(_0x256293){_0x1e70dd=_0x256293;logger[_0x379b('0xd')](_0x379b('0x4a'),_0x1e70dd['id']);return getEndUser(_0x4d2bad,_0x2c0543['destcalleridname'],_0x2c0543[_0x379b('0x55')]);})[_0x379b('0x1d')](function(_0x7a70df){_0x31502c=_0x7a70df;logger[_0x379b('0xd')](_0x379b('0x4b'),_0x31502c['id']);return getTicket(_0x4d2bad,_0x1e70dd,_0x31502c,_0x43a504,_0x2c0543);})[_0x379b('0x1d')](function(_0x386d52){if(_0x386d52&&_0x386d52['id']){logger[_0x379b('0xd')](_0x379b('0x1e'));logger[_0x379b('0xd')](_0x379b('0x4c'),_0x386d52['id']);logger[_0x379b('0xd')](_0x379b('0x56'),_0x379b('0x4d'));emit(util[_0x379b('0xf')](_0x379b('0x4e'),_0x45d12b[_0x379b('0x16')]),_0x379b('0x4f'),{'uri':util[_0x379b('0xf')](_0x379b('0x50'),_0x4d2bad[_0x379b('0x1b')],_0x386d52['id'])});}})['catch'](function(_0x489f32){logger[_0x379b('0x51')](_0x379b('0x56'),JSON['stringify'](_0x489f32));});};exports['unmanaged']=function(_0x3a5b5e,_0x1b2674,_0xb04282,_0x5ee151,_0x19633d,_0x5919a1){var _0x3b17bb,_0x4f0401;_0x5919a1['remoteUri']=intUtil[_0x379b('0x43')](_0x5919a1[_0x379b('0x1b')]);_0x5919a1[_0x379b('0x44')]=intUtil[_0x379b('0x43')](_0x5919a1[_0x379b('0x44')]);if(_0x19633d&&_0x19633d[_0x379b('0x45')]){logger[_0x379b('0xd')]('['+_0x1b2674[_0x379b('0x57')][_0x379b('0x58')]()+']',_0x379b('0x47'));_0x1b2674[_0x379b('0x48')]=util[_0x379b('0xf')](_0x379b('0x53'),_0x5919a1[_0x379b('0x44')],_0x1b2674['uniqueid'],md5(_0x1b2674[_0x379b('0x49')]));}else{_0x1b2674[_0x379b('0x48')]='';}headers['Authorization']=getAuth(_0x5919a1);return getUser(_0x5919a1,'')[_0x379b('0x1d')](function(_0x1e66da){_0x3b17bb=_0x1e66da;logger[_0x379b('0xd')](_0x379b('0x4a'),_0x3b17bb['id']);return getEndUser(_0x5919a1,_0x1b2674[_0x379b('0x11')],_0x1b2674[_0x379b('0x12')]);})['then'](function(_0x2b35e6){_0x4f0401=_0x2b35e6;logger['info'](_0x379b('0x4b'),_0x4f0401['id']);return getTicket(_0x5919a1,_0x3b17bb,_0x4f0401,_0xb04282,_0x1b2674);})[_0x379b('0x1d')](function(_0x45d494){if(_0x45d494){logger[_0x379b('0xd')](_0x379b('0x1e'));logger[_0x379b('0xd')](_0x379b('0x4c'),_0x45d494['id']);}})[_0x379b('0x59')](function(_0x140640){logger[_0x379b('0x51')]('['+_0x1b2674['lastevent'][_0x379b('0x58')]()+']',JSON[_0x379b('0x31')](_0x140640));});}; \ 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 eee9e34..0d821a9 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 _0x5787=['Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','userEmail','info','userId','message','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','username','calleridnum','callDirection','queue','unmanaged','serverUrl','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x5787,0x183));var _0x7578=function(_0x259845,_0x3034bf){_0x259845=_0x259845-0x0;var _0x3276da=_0x5787[_0x259845];return _0x3276da;};'use strict';var _=require(_0x7578('0x0'));var rp=require(_0x7578('0x1'));var md5=require(_0x7578('0x2'));var util=require(_0x7578('0x3'));var moment=require('moment');var Promise=require(_0x7578('0x4'));var Redis=require(_0x7578('0x5'));var intUtil=require(_0x7578('0x6'));var config=require(_0x7578('0x7'));var logger=require(_0x7578('0x8'))('freshsales');config[_0x7578('0x9')]=_['defaults'](config[_0x7578('0x9')],{'host':_0x7578('0xa'),'port':0x18eb});var io=require(_0x7578('0xb'))(new Redis(config['redis']));function getAdminId(_0x1e37bc,_0x1aad25,_0x1501ee,_0x34f067){return new Promise(function(_0x4f66d1,_0x12f562){var _0x1a4f7f=![];var _0x11124a={'method':_0x7578('0xc'),'uri':_0x34f067+_0x7578('0xd'),'json':!![]};_0x11124a[_0x7578('0xe')]=_0x1501ee;logger['info'](_0x7578('0xf'));return rp(_0x11124a)[_0x7578('0x10')](function(_0x11311b){if(_0x11311b){var _0x39e522=_0x11311b[_0x7578('0x11')];var _0x39303b=null;for(_0x39303b=0x0;_0x39303b<_0x39e522[_0x7578('0x12')];_0x39303b++){if(_0x39e522[_0x39303b][_0x7578('0x13')]===_0x1e37bc[_0x7578('0x14')]){_0x1e37bc[_0x7578('0x15')]=_0x39e522[_0x39303b]['id'];_0x1a4f7f=!![];}}if(_0x1a4f7f){logger['info'](_0x7578('0x16'),_0x1e37bc[_0x7578('0x15')]);_0x4f66d1(_0x1e37bc);}else{_0x12f562({'statusCode':0x194,'message':_0x7578('0x17')});}}else{_0x12f562({'statusCode':0x194,'message':_0x7578('0x17')});}})[_0x7578('0x18')](function(_0x33570f){logger[_0x7578('0x19')]('['+[_0x1aad25[_0x7578('0x1a')]()]+']',_0x33570f['message']);_0x12f562(_0x33570f);});});}function getUser(_0x170a0a,_0x2753d5,_0x13b267){return function(_0x5a96a0){return new Promise(function(_0xa863e6,_0x3f9f82){var _0x37e1a0={'method':_0x7578('0xc'),'uri':_0x13b267+'/api/selector/owners','json':!![]};_0x37e1a0[_0x7578('0xe')]=_0x2753d5;logger['info'](_0x7578('0x1b'));return rp(_0x37e1a0)[_0x7578('0x10')](function(_0x3a757f){if(_0x3a757f){var _0x5a52f5=_0x3a757f[_0x7578('0x11')];var _0x4a2c80=![];var _0x5a22a1=null;if(_0x5a96a0[_0x7578('0x1c')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x5a96a0['agentEmail']);_0x5a96a0[_0x7578('0x1d')]=_0x5a96a0[_0x7578('0x1c')];for(_0x5a22a1=0x0;_0x5a22a1<_0x5a52f5['length'];_0x5a22a1++){if(_0x5a52f5[_0x5a22a1][_0x7578('0x13')]===_0x5a96a0[_0x7578('0x1c')]){_0x4a2c80=!![];_0x5a96a0['userId']=_0x5a52f5[_0x5a22a1]['id'];logger[_0x7578('0x1e')]('User\x20found:',_0x5a96a0['userId']);}}}if(!_0x4a2c80){logger[_0x7578('0x1e')]('Admin\x20selected');_0x5a96a0[_0x7578('0x1d')]=_0x5a96a0[_0x7578('0x14')];_0x5a96a0[_0x7578('0x1f')]=_0x5a96a0['adminId'];_0x4a2c80=!![];}if(_0x4a2c80){_0xa863e6(_0x5a96a0);}else{_0x3f9f82({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3f9f82({'statusCode':0x194,'message':_0x7578('0x17')});}})[_0x7578('0x18')](function(_0x146773){logger['error']('['+[_0x170a0a[_0x7578('0x1a')]()]+']',_0x146773[_0x7578('0x20')]);_0x3f9f82(_0x146773);});});};}function searchContact(_0x2c8196,_0x42e28f,_0x5caabe,_0x4c4673){return new Promise(function(_0x4c6ef3,_0x239185){var _0x5b38ad={'method':_0x7578('0xc'),'headers':_0x42e28f,'uri':_0x2c8196+_0x7578('0x21')+_0x4c4673+'&f='+_0x5caabe+_0x7578('0x22'),'json':!![]};rp(_0x5b38ad)['then'](function(_0xf1688e){var _0x359079=_[_0x7578('0x23')](_0xf1688e[_0x7578('0x24')][_0x7578('0x24')],[_0x5caabe,_0x4c4673]);_0x4c6ef3(_0x359079);})['catch'](function(_0x5258d0){_0x239185(_0x5258d0);});});}function getEndUser(_0x17d76d,_0x13cc5a,_0x123cee){return function(_0x24cbcb){return new Promise(function(_0x3685f4,_0x2b40dc){logger['info'](util[_0x7578('0x25')](_0x7578('0x26'),_0x24cbcb[_0x7578('0x27')]));searchContact(_0x123cee,_0x13cc5a,_0x7578('0x28'),_0x24cbcb['contactNumber'])['then'](function(_0x59386a){if(_0x59386a){_0x24cbcb[_0x7578('0x29')]=_0x59386a['id'];logger[_0x7578('0x1e')](_0x7578('0x2a'),_0x24cbcb[_0x7578('0x29')]);return _0x3685f4(_0x24cbcb);}searchContact(_0x123cee,_0x13cc5a,_0x7578('0x2b'),_0x24cbcb['contactNumber'])[_0x7578('0x10')](function(_0x2da829){if(_0x2da829){_0x24cbcb['endUserId']=_0x2da829['id'];logger[_0x7578('0x1e')](_0x7578('0x2c'),_0x24cbcb[_0x7578('0x29')]);return _0x3685f4(_0x24cbcb);}createEndUser(_0x24cbcb,_0x17d76d,_0x13cc5a,_0x123cee)[_0x7578('0x10')](function(_0x14306f){logger['info']('Contact\x20created:',_0x14306f[_0x7578('0x29')]);return _0x3685f4(_0x14306f);});});})[_0x7578('0x18')](function(_0x5f4f6c){_0x2b40dc(_0x5f4f6c);});});};}function createEndUser(_0x2a3aa9,_0x183233,_0x513e5b,_0xeb9ce6){return new Promise(function(_0x9ce59e,_0xc36b4d){var _0xbbaef1=moment();var _0x5330fd={'method':_0x7578('0x2d'),'uri':_0xeb9ce6+_0x7578('0x2e'),'body':{'contact':{'last_name':_0x2a3aa9['contactNumber'],'work_number':_0x2a3aa9['contactNumber'],'mobile_number':_0x2a3aa9[_0x7578('0x27')],'owner_id':_0x2a3aa9['userId'],'created_at':_0xbbaef1[_0x7578('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x5330fd[_0x7578('0xe')]=_0x513e5b;logger[_0x7578('0x1e')](_0x7578('0x2f'));return rp(_0x5330fd)['then'](function(_0x2d3a24){_0x2a3aa9[_0x7578('0x29')]=_0x2d3a24[_0x7578('0x30')]['id'];_0x9ce59e(_0x2a3aa9);})['catch'](function(_0x2790e1){logger[_0x7578('0x19')]('['+[_0x183233[_0x7578('0x1a')]()]+']',_0x2790e1[_0x7578('0x20')]);_0xc36b4d(_0x2790e1[_0x7578('0x20')]);});});}function getTicket(_0x1e364a,_0x22519c,_0x4be625,_0x370db9,_0x458480){return function(_0x9610f8){logger[_0x7578('0x1e')](_0x7578('0x31'));return new Promise(function(_0x3e826b,_0x3649d2){var _0x224770=moment();var _0x48d729={'method':_0x7578('0x2d'),'uri':_0x4be625+'/api/tasks','body':{'title':intUtil[_0x7578('0x32')](_0x370db9[_0x7578('0x33')],_0x458480,'\x20'),'description':intUtil[_0x7578('0x32')](_0x370db9[_0x7578('0x34')],_0x458480,'\x0a'),'owner_id':_0x9610f8[_0x7578('0x1f')],'creater_id':_0x9610f8['adminId'],'targetable_id':_0x9610f8[_0x7578('0x29')],'targetable_type':_0x7578('0x35'),'created_at':_0x224770[_0x7578('0x25')](_0x7578('0x36')),'due_date':_0x224770[_0x7578('0x37')](0x1e,'m')[_0x7578('0x25')](_0x7578('0x36'))},'json':!![]};_0x48d729[_0x7578('0xe')]=_0x22519c;return rp(_0x48d729)[_0x7578('0x10')](function(_0x272ecf){_0x9610f8[_0x7578('0x38')]=_0x272ecf[_0x7578('0x39')]['id'];logger[_0x7578('0x1e')](_0x7578('0x3a'),_0x9610f8[_0x7578('0x38')]);_0x3e826b(_0x9610f8);})[_0x7578('0x18')](function(_0x45cb8d){logger[_0x7578('0x19')]('['+[_0x1e364a[_0x7578('0x1a')]()]+']',_0x45cb8d['message']);_0x3649d2(_0x45cb8d[_0x7578('0x20')]);});});};}function emit(_0x1e73e8,_0x1a7298,_0x25ea00){var _0x328d0b={'uri':_0x1e73e8+'/contacts/'+_0x25ea00};io['to'](util[_0x7578('0x25')](_0x7578('0x3b'),_0x1a7298))[_0x7578('0x3c')](_0x7578('0x3d'),_0x328d0b);}exports['cs']=function(_0x5b1dc5,_0x5ea0ba,_0x4fd1eb,_0x313104,_0x40fd59,_0x29f383,_0x18a067,_0x4d1812){var _0x500ad4={};var _0xa01cf={'Authorization':_0x7578('0x3e')+_0x29f383[_0x7578('0x3f')]};_0x29f383[_0x7578('0x40')]=intUtil[_0x7578('0x41')](_0x29f383[_0x7578('0x40')]);_0x29f383['serverUrl']=intUtil[_0x7578('0x41')](_0x29f383['serverUrl']);var _0x37b0e9=_0x29f383[_0x7578('0x40')];_0x500ad4[_0x7578('0x14')]=_0x29f383[_0x7578('0x42')];_0x500ad4[_0x7578('0x27')]=_0x4d1812['toLowerCase']()==='outbound'?_0x5ea0ba['destcalleridnum']:_0x5ea0ba[_0x7578('0x43')];_0x500ad4[_0x7578('0x44')]=_0x4d1812===_0x7578('0x45')||_0x4d1812===_0x7578('0x46')?'queue':'outbound';if(_0x313104){_0x500ad4[_0x7578('0x1c')]=_0x313104[_0x7578('0x13')];}var _0x1031c4=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29f383[_0x7578('0x47')],_0x5ea0ba[_0x7578('0x48')],md5(_0x5ea0ba[_0x7578('0x48')]));if(_0x40fd59&&_0x40fd59['monitor_format']){logger['info'](_0x7578('0x49'),_0x7578('0x4a'));_0x5ea0ba[_0x7578('0x4b')]=_0x1031c4;}else if(_0x18a067&&_0x18a067[_0x7578('0x4c')]&&_0x18a067['recordingFormat']!==_0x7578('0x4d')){logger[_0x7578('0x1e')](_0x7578('0x4e'),'Recording\x20is\x20enabled!');_0x5ea0ba['recordingURL']=_0x1031c4;}else{_0x5ea0ba[_0x7578('0x4b')]='';}return getAdminId(_0x500ad4,_0x4d1812,_0xa01cf,_0x37b0e9)[_0x7578('0x10')](getUser(_0x4d1812,_0xa01cf,_0x37b0e9))['then'](getEndUser(_0x4d1812,_0xa01cf,_0x37b0e9))[_0x7578('0x10')](getTicket(_0x4d1812,_0xa01cf,_0x37b0e9,_0x4fd1eb,_0x5ea0ba))[_0x7578('0x10')](function(_0x21a433){logger[_0x7578('0x1e')](util[_0x7578('0x25')](_0x7578('0x4f'),_0x21a433[_0x7578('0x38')]));if(_0x4d1812!==_0x7578('0x46')){logger[_0x7578('0x1e')]('['+[_0x4d1812[_0x7578('0x1a')]()]+']',_0x7578('0x50'));emit(_0x37b0e9,_0x313104['name'],_0x21a433[_0x7578('0x29')]);}})[_0x7578('0x18')](function(_0x1ad51d){logger['error']('['+[_0x4d1812['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x7578('0x51')](_0x1ad51d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbc78=['POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','agentEmail','info','userEmail','userId','Admin\x20selected','adminEmail','catch','/api/lookup?q=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xbc78,0x1a5));var _0x8bc7=function(_0x5927f3,_0x3a6e74){_0x5927f3=_0x5927f3-0x0;var _0x10f5ab=_0xbc78[_0x5927f3];return _0x10f5ab;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x8bc7('0x0'));var util=require(_0x8bc7('0x1'));var moment=require(_0x8bc7('0x2'));var Promise=require(_0x8bc7('0x3'));var Redis=require(_0x8bc7('0x4'));var intUtil=require(_0x8bc7('0x5'));var config=require(_0x8bc7('0x6'));var logger=require(_0x8bc7('0x7'))(_0x8bc7('0x8'));config[_0x8bc7('0x9')]=_['defaults'](config[_0x8bc7('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x8bc7('0xa'))(new Redis(config[_0x8bc7('0x9')]));function getAdminId(_0x5c3538,_0x568e4b,_0x3f1ef7,_0x385d90){return new Promise(function(_0x29cd06,_0x2293ef){var _0x49f552=![];var _0x42dcd6={'method':_0x8bc7('0xb'),'uri':_0x385d90+_0x8bc7('0xc'),'json':!![]};_0x42dcd6[_0x8bc7('0xd')]=_0x3f1ef7;logger['info'](_0x8bc7('0xe'));return rp(_0x42dcd6)[_0x8bc7('0xf')](function(_0x2ca53d){if(_0x2ca53d){var _0x26b297=_0x2ca53d[_0x8bc7('0x10')];var _0x32e10a=null;for(_0x32e10a=0x0;_0x32e10a<_0x26b297[_0x8bc7('0x11')];_0x32e10a++){if(_0x26b297[_0x32e10a][_0x8bc7('0x12')]===_0x5c3538['adminEmail']){_0x5c3538[_0x8bc7('0x13')]=_0x26b297[_0x32e10a]['id'];_0x49f552=!![];}}if(_0x49f552){logger['info']('Admin\x20found:',_0x5c3538[_0x8bc7('0x13')]);_0x29cd06(_0x5c3538);}else{_0x2293ef({'statusCode':0x194,'message':_0x8bc7('0x14')});}}else{_0x2293ef({'statusCode':0x194,'message':_0x8bc7('0x14')});}})['catch'](function(_0x336642){logger[_0x8bc7('0x15')]('['+[_0x568e4b[_0x8bc7('0x16')]()]+']',_0x336642[_0x8bc7('0x17')]);_0x2293ef(_0x336642);});});}function getUser(_0x56f2dc,_0x5aa77e,_0x3bf1ba){return function(_0x35e189){return new Promise(function(_0x492320,_0x5096c7){var _0x30fe5f={'method':_0x8bc7('0xb'),'uri':_0x3bf1ba+_0x8bc7('0xc'),'json':!![]};_0x30fe5f['headers']=_0x5aa77e;logger['info']('Getting\x20user\x20list');return rp(_0x30fe5f)['then'](function(_0x9bad4c){if(_0x9bad4c){var _0x2bf3c8=_0x9bad4c[_0x8bc7('0x10')];var _0x171fec=![];var _0x55269a=null;if(_0x35e189[_0x8bc7('0x18')]!==null){logger[_0x8bc7('0x19')]('Getting\x20user\x20with\x20email',_0x35e189[_0x8bc7('0x18')]);_0x35e189[_0x8bc7('0x1a')]=_0x35e189[_0x8bc7('0x18')];for(_0x55269a=0x0;_0x55269a<_0x2bf3c8[_0x8bc7('0x11')];_0x55269a++){if(_0x2bf3c8[_0x55269a][_0x8bc7('0x12')]===_0x35e189[_0x8bc7('0x18')]){_0x171fec=!![];_0x35e189[_0x8bc7('0x1b')]=_0x2bf3c8[_0x55269a]['id'];logger[_0x8bc7('0x19')]('User\x20found:',_0x35e189[_0x8bc7('0x1b')]);}}}if(!_0x171fec){logger[_0x8bc7('0x19')](_0x8bc7('0x1c'));_0x35e189[_0x8bc7('0x1a')]=_0x35e189[_0x8bc7('0x1d')];_0x35e189['userId']=_0x35e189[_0x8bc7('0x13')];_0x171fec=!![];}if(_0x171fec){_0x492320(_0x35e189);}else{_0x5096c7({'statusCode':0x194,'message':_0x8bc7('0x14')});}}else{_0x5096c7({'statusCode':0x194,'message':_0x8bc7('0x14')});}})[_0x8bc7('0x1e')](function(_0x5f2820){logger[_0x8bc7('0x15')]('['+[_0x56f2dc[_0x8bc7('0x16')]()]+']',_0x5f2820[_0x8bc7('0x17')]);_0x5096c7(_0x5f2820);});});};}function searchContact(_0x72fda1,_0x3f68c7,_0x1c95b7,_0x43c74e){return new Promise(function(_0x1c97bd,_0x4a9005){var _0xd931f0={'method':'GET','headers':_0x3f68c7,'uri':_0x72fda1+_0x8bc7('0x1f')+_0x43c74e+'&f='+_0x1c95b7+_0x8bc7('0x20'),'json':!![]};rp(_0xd931f0)[_0x8bc7('0xf')](function(_0x59c39f){var _0x4acd84=_[_0x8bc7('0x21')](_0x59c39f[_0x8bc7('0x22')][_0x8bc7('0x22')],[_0x1c95b7,_0x43c74e]);_0x1c97bd(_0x4acd84);})[_0x8bc7('0x1e')](function(_0x46dc83){_0x4a9005(_0x46dc83);});});}function getEndUser(_0x4e1492,_0x3a6498,_0xacdd9c){return function(_0x381713){return new Promise(function(_0x134dcc,_0x36a58a){logger[_0x8bc7('0x19')](util['format'](_0x8bc7('0x23'),_0x381713['contactNumber']));searchContact(_0xacdd9c,_0x3a6498,'mobile_number',_0x381713[_0x8bc7('0x24')])[_0x8bc7('0xf')](function(_0x19bed5){if(_0x19bed5){_0x381713[_0x8bc7('0x25')]=_0x19bed5['id'];logger[_0x8bc7('0x19')](_0x8bc7('0x26'),_0x381713[_0x8bc7('0x25')]);return _0x134dcc(_0x381713);}searchContact(_0xacdd9c,_0x3a6498,'work_number',_0x381713[_0x8bc7('0x24')])[_0x8bc7('0xf')](function(_0x4a2d41){if(_0x4a2d41){_0x381713[_0x8bc7('0x25')]=_0x4a2d41['id'];logger[_0x8bc7('0x19')](_0x8bc7('0x27'),_0x381713['endUserId']);return _0x134dcc(_0x381713);}createEndUser(_0x381713,_0x4e1492,_0x3a6498,_0xacdd9c)[_0x8bc7('0xf')](function(_0x24f297){logger[_0x8bc7('0x19')](_0x8bc7('0x28'),_0x24f297['endUserId']);return _0x134dcc(_0x24f297);});});})[_0x8bc7('0x1e')](function(_0x14774e){_0x36a58a(_0x14774e);});});};}function createEndUser(_0xa93107,_0x54a795,_0x70555e,_0x593fbd){return new Promise(function(_0x1db648,_0x1d283d){var _0x2925fe=moment();var _0x35f46c={'method':_0x8bc7('0x29'),'uri':_0x593fbd+_0x8bc7('0x2a'),'body':{'contact':{'last_name':_0xa93107[_0x8bc7('0x24')],'work_number':_0xa93107[_0x8bc7('0x24')],'mobile_number':_0xa93107[_0x8bc7('0x24')],'owner_id':_0xa93107[_0x8bc7('0x1b')],'created_at':_0x2925fe[_0x8bc7('0x2b')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x35f46c['headers']=_0x70555e;logger[_0x8bc7('0x19')](_0x8bc7('0x2c'));return rp(_0x35f46c)[_0x8bc7('0xf')](function(_0x397454){_0xa93107[_0x8bc7('0x25')]=_0x397454['contact']['id'];_0x1db648(_0xa93107);})[_0x8bc7('0x1e')](function(_0x3c23d2){logger[_0x8bc7('0x15')]('['+[_0x54a795['toUpperCase']()]+']',_0x3c23d2[_0x8bc7('0x17')]);_0x1d283d(_0x3c23d2[_0x8bc7('0x17')]);});});}function getTicket(_0x5213f4,_0x53762e,_0x4dd2d5,_0x340f09,_0x4ede9d){return function(_0x307b51){logger[_0x8bc7('0x19')](_0x8bc7('0x2d'));return new Promise(function(_0x31acd1,_0x1bb855){var _0x2989f2=moment();var _0x4edb74={'method':'POST','uri':_0x4dd2d5+_0x8bc7('0x2e'),'body':{'title':intUtil[_0x8bc7('0x2f')](_0x340f09[_0x8bc7('0x30')],_0x4ede9d,'\x20'),'description':intUtil[_0x8bc7('0x2f')](_0x340f09[_0x8bc7('0x31')],_0x4ede9d,'\x0a'),'owner_id':_0x307b51[_0x8bc7('0x1b')],'creater_id':_0x307b51[_0x8bc7('0x13')],'targetable_id':_0x307b51[_0x8bc7('0x25')],'targetable_type':_0x8bc7('0x32'),'created_at':_0x2989f2['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2989f2[_0x8bc7('0x33')](0x1e,'m')[_0x8bc7('0x2b')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4edb74[_0x8bc7('0xd')]=_0x53762e;return rp(_0x4edb74)[_0x8bc7('0xf')](function(_0x32f495){_0x307b51[_0x8bc7('0x34')]=_0x32f495[_0x8bc7('0x35')]['id'];logger[_0x8bc7('0x19')](_0x8bc7('0x36'),_0x307b51[_0x8bc7('0x34')]);_0x31acd1(_0x307b51);})['catch'](function(_0x4e3f33){logger['error']('['+[_0x5213f4[_0x8bc7('0x16')]()]+']',_0x4e3f33[_0x8bc7('0x17')]);_0x1bb855(_0x4e3f33[_0x8bc7('0x17')]);});});};}function emit(_0x224221,_0x38ab04,_0x26a46e){var _0xe28d68={'uri':_0x224221+'/contacts/'+_0x26a46e};io['to'](util[_0x8bc7('0x2b')]('user:%s',_0x38ab04))[_0x8bc7('0x37')](_0x8bc7('0x38'),_0xe28d68);}exports['cs']=function(_0x5902aa,_0x3927d1,_0x1989af,_0x383fc4,_0x55c829,_0x33a662,_0x176ed3,_0x563ad1){var _0x66a701={};var _0x4e5efa={'Authorization':'Token\x20token='+_0x33a662[_0x8bc7('0x39')]};_0x33a662[_0x8bc7('0x3a')]=intUtil[_0x8bc7('0x3b')](_0x33a662[_0x8bc7('0x3a')]);_0x33a662[_0x8bc7('0x3c')]=intUtil[_0x8bc7('0x3b')](_0x33a662[_0x8bc7('0x3c')]);var _0x1007b5=_0x33a662[_0x8bc7('0x3a')];_0x66a701[_0x8bc7('0x1d')]=_0x33a662[_0x8bc7('0x3d')];_0x66a701['contactNumber']=_0x563ad1['toLowerCase']()===_0x8bc7('0x3e')?_0x3927d1['destcalleridnum']:_0x3927d1['calleridnum'];_0x66a701['callDirection']=_0x563ad1==='queue'||_0x563ad1===_0x8bc7('0x3f')?'queue':_0x8bc7('0x3e');if(_0x383fc4){_0x66a701[_0x8bc7('0x18')]=_0x383fc4[_0x8bc7('0x12')];}var _0x41f7d5=util[_0x8bc7('0x2b')](_0x8bc7('0x40'),_0x33a662[_0x8bc7('0x3c')],_0x3927d1[_0x8bc7('0x41')],md5(_0x3927d1[_0x8bc7('0x41')]));if(_0x55c829&&_0x55c829['monitor_format']){logger['info'](_0x8bc7('0x42'),_0x8bc7('0x43'));_0x3927d1[_0x8bc7('0x44')]=_0x41f7d5;}else if(_0x176ed3&&_0x176ed3[_0x8bc7('0x45')]&&_0x176ed3['recordingFormat']!==_0x8bc7('0x46')){logger[_0x8bc7('0x19')](_0x8bc7('0x47'),_0x8bc7('0x43'));_0x3927d1[_0x8bc7('0x44')]=_0x41f7d5;}else{_0x3927d1['recordingURL']='';}return getAdminId(_0x66a701,_0x563ad1,_0x4e5efa,_0x1007b5)[_0x8bc7('0xf')](getUser(_0x563ad1,_0x4e5efa,_0x1007b5))['then'](getEndUser(_0x563ad1,_0x4e5efa,_0x1007b5))[_0x8bc7('0xf')](getTicket(_0x563ad1,_0x4e5efa,_0x1007b5,_0x1989af,_0x3927d1))[_0x8bc7('0xf')](function(_0x279d12){logger[_0x8bc7('0x19')](util[_0x8bc7('0x2b')](_0x8bc7('0x48'),_0x279d12['ticketId']));if(_0x563ad1!=='unmanaged'){logger[_0x8bc7('0x19')]('['+[_0x563ad1[_0x8bc7('0x16')]()]+']',_0x8bc7('0x49'));emit(_0x1007b5,_0x383fc4[_0x8bc7('0x4a')],_0x279d12[_0x8bc7('0x25')]);}})[_0x8bc7('0x1e')](function(_0x4f8d7e){logger[_0x8bc7('0x15')]('['+[_0x563ad1[_0x8bc7('0x16')]()]+_0x8bc7('0x4b'),util[_0x8bc7('0x4c')](_0x4f8d7e,{'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 80c143c..4962318 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 _0x2ea0=['./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','salesforce','log','error','[EXEC]','format','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x2ea0,0x80));var _0x02ea=function(_0x3e8de2,_0x468431){_0x3e8de2=_0x3e8de2-0x0;var _0x56b736=_0x2ea0[_0x3e8de2];return _0x56b736;};'use strict';var _=require(_0x02ea('0x0'));var util=require(_0x02ea('0x1'));var zendesk=require(_0x02ea('0x2'));var salesforce=require(_0x02ea('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x02ea('0x4'));var zoho=require(_0x02ea('0x5'));var desk=require(_0x02ea('0x6'));var vtiger=require(_0x02ea('0x7'));var servicenow=require(_0x02ea('0x8'));var dynamics365=require(_0x02ea('0x9'));var freshsales=require(_0x02ea('0xa'));var integrations=[_0x02ea('0xb'),'salesforce',_0x02ea('0xc'),_0x02ea('0xd'),_0x02ea('0xe'),_0x02ea('0xf'),_0x02ea('0x10'),_0x02ea('0x11'),_0x02ea('0x12'),_0x02ea('0x13')];exports['exec']=function(_0x2ea1d1,_0x21a469,_0x150bd8,_0x50d116,_0x93ab56,_0x3075ed){if(_0x150bd8){if(_[_0x02ea('0x14')](integrations,_0x2ea1d1['data1']['toLowerCase']())){try{var _0x26a2bc=null;var _0x3cbfbb='';var _0x342d28=_0x150bd8[_0x2ea1d1[_0x02ea('0x15')][_0x02ea('0x16')]()];if(_0x342d28){var _0x1ec5bc=_0x342d28[_0x2ea1d1[_0x02ea('0x17')]];if(_0x1ec5bc){var _0x3775b2=_[_0x02ea('0x18')](_0x1ec5bc[_0x02ea('0x19')],{'id':parseInt(_0x2ea1d1[_0x02ea('0x1a')],0xa)});if(_0x3775b2){if(_0x50d116){if(_0x93ab56&&_0x21a469[_0x02ea('0x1b')]){_0x3cbfbb='queue';}else if(_0x21a469[_0x02ea('0x1c')]){_0x3cbfbb='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x21a469);}}else{_0x3cbfbb='unmanaged';}switch(_0x2ea1d1[_0x02ea('0x15')][_0x02ea('0x16')]()){case _0x02ea('0xb'):zendesk[_0x3cbfbb](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed);break;case _0x02ea('0x1d'):salesforce[_0x3cbfbb](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed);break;case _0x02ea('0xc'):sugarcrm[_0x3cbfbb](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed);break;case _0x02ea('0xd'):freshdesk[_0x3cbfbb](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed);break;case _0x02ea('0xe'):zoho[_0x3cbfbb](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed);break;case _0x02ea('0xf'):desk[_0x3cbfbb](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed);break;case _0x02ea('0x10'):vtiger[_0x3cbfbb](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed);break;case _0x02ea('0x12'):freshsales['cs'](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed,_0x3cbfbb);break;case _0x02ea('0x13'):servicenow['cs'](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed,_0x3cbfbb);break;case'dynamics365':dynamics365['cs'](_0x2ea1d1,_0x21a469,_0x3775b2,_0x50d116,_0x93ab56,_0x1ec5bc,_0x3075ed,_0x3cbfbb);break;default:console[_0x02ea('0x1e')]('unknown\x20integration');}}else{_0x26a2bc=require('../../../../config/logger')(_0x2ea1d1['data1'][_0x02ea('0x16')]());_0x26a2bc[_0x02ea('0x1f')](_0x02ea('0x20'),util[_0x02ea('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x2ea1d1['data1'][_0x02ea('0x16')](),_0x2ea1d1['data3']));}}else{_0x26a2bc=require('../../../../config/logger')(_0x2ea1d1[_0x02ea('0x15')][_0x02ea('0x16')]());_0x26a2bc['error']('[EXEC]',util[_0x02ea('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x2ea1d1[_0x02ea('0x15')][_0x02ea('0x16')](),_0x2ea1d1[_0x02ea('0x17')]));}}else{}}catch(_0x31454f){console[_0x02ea('0x1f')](_0x31454f);}}}}; \ No newline at end of file +var _0x8dd0=['dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','desk','vtiger','exec','data1','data2','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','toLowerCase','zendesk','salesforce'];(function(_0x11b8ae,_0x485fa8){var _0x35a448=function(_0x188a5b){while(--_0x188a5b){_0x11b8ae['push'](_0x11b8ae['shift']());}};_0x35a448(++_0x485fa8);}(_0x8dd0,0x71));var _0x08dd=function(_0x524042,_0x1b85d7){_0x524042=_0x524042-0x0;var _0x2f6e83=_0x8dd0[_0x524042];return _0x2f6e83;};'use strict';var _=require('lodash');var util=require(_0x08dd('0x0'));var zendesk=require(_0x08dd('0x1'));var salesforce=require(_0x08dd('0x2'));var sugarcrm=require(_0x08dd('0x3'));var freshdesk=require(_0x08dd('0x4'));var zoho=require('./zoho');var desk=require(_0x08dd('0x5'));var vtiger=require(_0x08dd('0x6'));var servicenow=require(_0x08dd('0x7'));var dynamics365=require(_0x08dd('0x8'));var freshsales=require(_0x08dd('0x9'));var integrations=['zendesk','salesforce',_0x08dd('0xa'),_0x08dd('0xb'),'zoho',_0x08dd('0xc'),_0x08dd('0xd'),'dynamics365','freshsales','servicenow'];exports[_0x08dd('0xe')]=function(_0x117b6a,_0x55da2e,_0x5a2d89,_0xdda3fa,_0x5baf00,_0x369c84){if(_0x5a2d89){if(_['includes'](integrations,_0x117b6a[_0x08dd('0xf')]['toLowerCase']())){try{var _0x322740=null;var _0x585638='';var _0x186c9f=_0x5a2d89[_0x117b6a[_0x08dd('0xf')]['toLowerCase']()];if(_0x186c9f){var _0x478439=_0x186c9f[_0x117b6a[_0x08dd('0x10')]];if(_0x478439){var _0x41c6b7=_['find'](_0x478439['Configurations'],{'id':parseInt(_0x117b6a[_0x08dd('0x11')],0xa)});if(_0x41c6b7){if(_0xdda3fa){if(_0x5baf00&&_0x55da2e[_0x08dd('0x12')]){_0x585638=_0x08dd('0x12');}else if(_0x55da2e[_0x08dd('0x13')]){_0x585638=_0x08dd('0x14');}else{console[_0x08dd('0x15')](_0x08dd('0x16'),_0x55da2e);}}else{_0x585638=_0x08dd('0x17');}switch(_0x117b6a[_0x08dd('0xf')][_0x08dd('0x18')]()){case _0x08dd('0x19'):zendesk[_0x585638](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84);break;case _0x08dd('0x1a'):salesforce[_0x585638](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84);break;case _0x08dd('0xa'):sugarcrm[_0x585638](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84);break;case _0x08dd('0xb'):freshdesk[_0x585638](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84);break;case'zoho':zoho[_0x585638](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84);break;case _0x08dd('0xc'):desk[_0x585638](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84);break;case _0x08dd('0xd'):vtiger[_0x585638](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84);break;case'freshsales':freshsales['cs'](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84,_0x585638);break;case'servicenow':servicenow['cs'](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84,_0x585638);break;case _0x08dd('0x1b'):dynamics365['cs'](_0x117b6a,_0x55da2e,_0x41c6b7,_0xdda3fa,_0x5baf00,_0x478439,_0x369c84,_0x585638);break;default:console[_0x08dd('0x15')](_0x08dd('0x1c'));}}else{_0x322740=require(_0x08dd('0x1d'))(_0x117b6a[_0x08dd('0xf')][_0x08dd('0x18')]());_0x322740[_0x08dd('0x1e')](_0x08dd('0x1f'),util[_0x08dd('0x20')](_0x08dd('0x21'),_0x117b6a[_0x08dd('0xf')][_0x08dd('0x18')](),_0x117b6a[_0x08dd('0x11')]));}}else{_0x322740=require(_0x08dd('0x1d'))(_0x117b6a[_0x08dd('0xf')][_0x08dd('0x18')]());_0x322740[_0x08dd('0x1e')]('[EXEC]',util[_0x08dd('0x20')](_0x08dd('0x22'),_0x117b6a[_0x08dd('0xf')][_0x08dd('0x18')](),_0x117b6a[_0x08dd('0x10')]));}}else{}}catch(_0xab935f){console[_0x08dd('0x1e')](_0xab935f);}}}}; \ 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 cf64f4d..23a34f0 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 _0x2137=['Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','$or','Contact','execute','cloneDeep','additionalSearchLead','merge','additionalSearchAccount','Lead','Account','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','Caller\x20-\x20%s','','Company','No\x20Company','format','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','newTab','trigger:browser:url','error','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','util','./util','../../../../config/logger','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','account','WhatId','contact','ContactId','AccountId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','ticketType','create','isNil','sobject','User','find','then','length','Email','info'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x2137,0x1ca));var _0x7213=function(_0x5e9b8a,_0x15fc70){_0x5e9b8a=_0x5e9b8a-0x0;var _0xffd6d6=_0x2137[_0x5e9b8a];return _0xffd6d6;};'use strict';var _=require(_0x7213('0x0'));var rp=require(_0x7213('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x7213('0x2'));var jsforce=require('jsforce');var util=require(_0x7213('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7213('0x4'));var config=require('../../../../config/environment');var logger=require(_0x7213('0x5'))('salesforce');config[_0x7213('0x6')]=_[_0x7213('0x7')](config[_0x7213('0x6')],{'host':_0x7213('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x31c565,_0x206685,_0x13202f){io['to'](_0x31c565)[_0x7213('0x9')](_0x206685,_0x13202f);}function getTicket(_0x1e01dc,_0x201d24,_0xf8bc8b,_0xdf307a,_0x2a5dde,_0x32392a,_0x42e26d,_0x30fcbf){var _0x4f3b4e=Object[_0x7213('0xa')]({},{'OwnerId':_0x201d24['id'],'Subject':intUtil[_0x7213('0xb')](_0xdf307a[_0x7213('0xc')],_0x2a5dde,'\x20'),'Description':intUtil[_0x7213('0xb')](_0xdf307a[_0x7213('0xd')],_0x2a5dde,'\x0a')},getCustomFields(_0x32392a,_0x2a5dde));if(_0xf8bc8b){if(_0xdf307a['ticketType']===_0x7213('0xe')){_0x4f3b4e[_0x7213('0xf')]=moment[_0x7213('0x10')]();_0x4f3b4e[_0x7213('0x11')]=![];_0x4f3b4e[_0x7213('0x12')]=![];if(_0xf8bc8b[_0x7213('0x13')]==='contact'||_0xf8bc8b[_0x7213('0x13')]==='lead'){_0x4f3b4e['WhoId']=_0xf8bc8b['id'];}else if(_0xf8bc8b[_0x7213('0x13')]===_0x7213('0x14')){_0x4f3b4e[_0x7213('0x15')]=_0xf8bc8b['id'];}}else if(_0xdf307a['ticketType']==='Case'){if(_0xf8bc8b[_0x7213('0x13')]===_0x7213('0x16')){_0x4f3b4e[_0x7213('0x17')]=_0xf8bc8b['id'];}else if(_0xf8bc8b[_0x7213('0x13')]===_0x7213('0x14')){_0x4f3b4e[_0x7213('0x18')]=_0xf8bc8b['id'];}else if(_0xf8bc8b[_0x7213('0x13')]===_0x7213('0x19')&&_0xdf307a[_0x7213('0x1a')]){_0x4f3b4e[_0xdf307a[_0x7213('0x1a')]]=_0xf8bc8b['id'];}else{logger['info'](_0x7213('0x1b'));}}}return _0x42e26d['sobject'](_0xdf307a[_0x7213('0x1c')])[_0x7213('0x1d')](_0x4f3b4e);}function getUser(_0x189757,_0x5a9ae6,_0x2fde4c){if(!_[_0x7213('0x1e')](_0x5a9ae6)&&intUtil['validateEmail'](_0x5a9ae6)){var _0x302ed7={'Email':_0x5a9ae6};var _0x59632b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2fde4c[_0x7213('0x1f')](_0x7213('0x20'))[_0x7213('0x21')](_0x302ed7,_0x59632b)['execute']()[_0x7213('0x22')](function(_0x128eb1){if(_0x128eb1[_0x7213('0x23')]){var _0x15d70d=_[_0x7213('0x21')](_0x128eb1,function(_0x24e651){return _0x24e651[_0x7213('0x24')]===_0x5a9ae6;});if(_0x15d70d){logger[_0x7213('0x25')](_0x7213('0x26'),_0x5a9ae6);return BPromise[_0x7213('0x27')]({'id':_0x15d70d['Id'],'name':_0x15d70d[_0x7213('0x28')]});}}else{logger['info'](_0x7213('0x29'),_0x5a9ae6);return _0x2fde4c[_0x7213('0x2a')]()[_0x7213('0x22')](function(_0x2e9e8a){return BPromise[_0x7213('0x27')]({'id':_0x2e9e8a[_0x7213('0x2b')],'name':_0x2e9e8a[_0x7213('0x2c')]});});}});}else{logger[_0x7213('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5a9ae6);return _0x2fde4c[_0x7213('0x2a')]()[_0x7213('0x22')](function(_0x542be7){return BPromise[_0x7213('0x27')]({'id':_0x542be7[_0x7213('0x2b')],'name':_0x542be7[_0x7213('0x2c')]});});}}function getEndUser(_0x1fc0d6,_0x4840a5,_0x49208a,_0x909eb3,_0x3973c2){var _0x414c79={'$or':{'Phone':_0x909eb3}};var _0x91d05c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7213('0x27')]()['then'](function(){logger[_0x7213('0x25')](_0x7213('0x2d'),_0x909eb3,_0x4840a5[_0x7213('0x2e')]);switch(_0x4840a5[_0x7213('0x2e')]){case _0x7213('0x2f'):var _0x5c48ad=_['cloneDeep'](_0x414c79);if(_0x4840a5[_0x7213('0x30')]){var _0x485a23={};_0x485a23[_0x4840a5[_0x7213('0x30')]]=_0x909eb3;_['merge'](_0x5c48ad[_0x7213('0x31')],_0x485a23);}return _0x3973c2[_0x7213('0x1f')](_0x7213('0x32'))['find'](_0x5c48ad,_0x91d05c)[_0x7213('0x33')]()[_0x7213('0x22')](function(_0x12e9eb){if(_0x12e9eb&&_0x12e9eb[_0x7213('0x23')]){return _0x12e9eb;}else{var _0x1e505a=_[_0x7213('0x34')](_0x414c79);if(_0x4840a5[_0x7213('0x35')]){var _0x129975={};_0x129975[_0x4840a5[_0x7213('0x35')]]=_0x909eb3;_[_0x7213('0x36')](_0x1e505a['$or'],_0x129975);}return _0x3973c2[_0x7213('0x1f')]('Lead')[_0x7213('0x21')](_0x1e505a,_0x91d05c);}});case'account_contact_lead':var _0x46baaf=_[_0x7213('0x34')](_0x414c79);if(_0x4840a5[_0x7213('0x37')]){var _0x485a23={};_0x485a23[_0x4840a5['additionalSearchAccount']]=_0x909eb3;_['merge'](_0x46baaf[_0x7213('0x31')],_0x485a23);}return _0x3973c2[_0x7213('0x1f')]('Account')[_0x7213('0x21')](_0x46baaf,_0x91d05c)[_0x7213('0x33')]()[_0x7213('0x22')](function(_0x255311){if(_0x255311&&_0x255311[_0x7213('0x23')]){return _0x255311;}else{var _0x1fe935=_[_0x7213('0x34')](_0x414c79);if(_0x4840a5[_0x7213('0x30')]){var _0x122187={};_0x122187[_0x4840a5[_0x7213('0x30')]]=_0x909eb3;_[_0x7213('0x36')](_0x1fe935[_0x7213('0x31')],_0x122187);}return _0x3973c2[_0x7213('0x1f')](_0x7213('0x32'))[_0x7213('0x21')](_0x1fe935,_0x91d05c)[_0x7213('0x22')](function(_0x55e897){if(_0x55e897&&_0x55e897['length']){return _0x55e897;}else{var _0x3b4106=_['cloneDeep'](_0x414c79);if(_0x4840a5[_0x7213('0x35')]){var _0x33caed={};_0x33caed[_0x4840a5[_0x7213('0x35')]]=_0x909eb3;_['merge'](_0x3b4106[_0x7213('0x31')],_0x33caed);}return _0x3973c2[_0x7213('0x1f')]('Lead')[_0x7213('0x21')](_0x3b4106,_0x91d05c);}});}});case _0x7213('0x16'):var _0x5c48ad=_['cloneDeep'](_0x414c79);if(_0x4840a5[_0x7213('0x30')]){var _0x485a23={};_0x485a23[_0x4840a5[_0x7213('0x30')]]=_0x909eb3;_['merge'](_0x5c48ad['$or'],_0x485a23);}return _0x3973c2[_0x7213('0x1f')](_0x7213('0x32'))[_0x7213('0x21')](_0x5c48ad,_0x91d05c)[_0x7213('0x33')]();case _0x7213('0x19'):var _0x2f548e=_[_0x7213('0x34')](_0x414c79);if(_0x4840a5[_0x7213('0x35')]){var _0x485a23={};_0x485a23[_0x4840a5['additionalSearchLead']]=_0x909eb3;_[_0x7213('0x36')](_0x2f548e[_0x7213('0x31')],_0x485a23);}return _0x3973c2['sobject'](_0x7213('0x38'))[_0x7213('0x21')](_0x2f548e,_0x91d05c);case _0x7213('0x14'):var _0x46baaf=_['cloneDeep'](_0x414c79);if(_0x4840a5[_0x7213('0x37')]){var _0x485a23={};_0x485a23[_0x4840a5['additionalSearchAccount']]=_0x909eb3;_[_0x7213('0x36')](_0x46baaf[_0x7213('0x31')],_0x485a23);}return _0x3973c2[_0x7213('0x1f')](_0x7213('0x39'))['find'](_0x46baaf,_0x91d05c);default:return null;}})[_0x7213('0x22')](function(_0x5eac9e){if(_0x5eac9e&&_0x5eac9e['length']){var _0x194b3d=_['first'](_0x5eac9e);if(_0x194b3d){return BPromise[_0x7213('0x27')]({'id':_0x194b3d['Id'],'name':_0x194b3d[_0x7213('0x28')],'phone':_0x194b3d['Phone'],'endUserType':_0x194b3d['attributes'][_0x7213('0x3a')][_0x7213('0x3b')]()});}}})[_0x7213('0x22')](function(_0x305336){if(_0x305336){logger[_0x7213('0x25')](_0x7213('0x3c'),_0x305336['endUserType'],_0x909eb3);return BPromise[_0x7213('0x27')](_0x305336);}else{logger[_0x7213('0x25')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x909eb3);var _0x552899={'Phone':_0x909eb3};if(_0x4840a5['moduleCreate']){if(_0x4840a5[_0x7213('0x3d')]===_0x7213('0x16')){logger[_0x7213('0x25')](_0x7213('0x3e'),_0x909eb3,_0x4840a5['moduleCreate']);_0x552899[_0x7213('0x3f')]=_0x49208a!==''?_0x49208a:util['format'](_0x7213('0x40'),_0x909eb3);}else if(_0x4840a5[_0x7213('0x3d')]===_0x7213('0x19')){logger[_0x7213('0x25')](_0x7213('0x3e'),_0x909eb3,_0x4840a5[_0x7213('0x3d')]);_0x552899['LastName']=_0x49208a!==_0x7213('0x41')?_0x49208a:util['format'](_0x7213('0x40'),_0x909eb3);_0x552899[_0x7213('0x42')]=_0x7213('0x43');}else if(_0x4840a5[_0x7213('0x3d')]==='account'){logger['info'](_0x7213('0x3e'),_0x909eb3,_0x4840a5[_0x7213('0x3d')]);_0x552899[_0x7213('0x28')]=_0x49208a!==_0x7213('0x41')?_0x49208a:util[_0x7213('0x44')](_0x7213('0x40'),_0x909eb3);}else{return null;}}return _0x3973c2[_0x7213('0x1f')](_[_0x7213('0x45')](_0x4840a5[_0x7213('0x3d')]))[_0x7213('0x1d')](_0x552899)[_0x7213('0x22')](function(_0x463a41){return BPromise[_0x7213('0x27')]({'id':_0x463a41['id'],'endUserType':_0x4840a5[_0x7213('0x3d')]});});}});}function getCustomFields(_0x2df90d,_0x545e41){var _0x5ee271={};if(_0x2df90d[_0x7213('0x23')]>0x0){_[_0x7213('0x46')](_0x2df90d,function(_0x3e8a37){if(_[_0x7213('0x47')]([_0x7213('0x48'),'picklist'],_0x3e8a37['type'])&&_0x3e8a37['idField']){_0x5ee271[_0x3e8a37[_0x7213('0x49')]]=_0x3e8a37[_0x7213('0x4a')][_0x7213('0x4b')]();}else if(_0x3e8a37[_0x7213('0x3a')]===_0x7213('0x4c')&&_0x3e8a37['variableName']&&_0x3e8a37[_0x7213('0x49')]){_0x545e41[_0x3e8a37[_0x7213('0x4d')]]&&(_0x5ee271[_0x3e8a37['idField']]=_0x545e41[_0x3e8a37[_0x7213('0x4d')]][_0x7213('0x4b')]());}else if(_0x3e8a37[_0x7213('0x3a')]===_0x7213('0x4e')&&_0x3e8a37[_0x7213('0x4f')]&&_0x3e8a37['Variable'][_0x7213('0x50')]&&_0x3e8a37[_0x7213('0x49')]){_0x545e41[_0x3e8a37[_0x7213('0x4f')][_0x7213('0x50')][_0x7213('0x3b')]()]&&(_0x5ee271[_0x3e8a37[_0x7213('0x49')]]=_0x545e41[_0x3e8a37[_0x7213('0x4f')][_0x7213('0x50')][_0x7213('0x3b')]()][_0x7213('0x4b')]());}});}return _0x5ee271;}function getConnection(_0x2d27eb){var _0x4ac73f=_0x2d27eb[_0x7213('0x51')]['concat'](_0x2d27eb[_0x7213('0x52')]);var _0x1efe4d=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2d27eb[_0x7213('0x53')]||_0x7213('0x54'),'clientId':_0x2d27eb[_0x7213('0x55')],'clientSecret':_0x2d27eb[_0x7213('0x56')]}});return _0x1efe4d['login'](_0x2d27eb[_0x7213('0x57')],_0x4ac73f)['then'](function(){logger[_0x7213('0x25')](_0x7213('0x58'));return _0x1efe4d;});}exports[_0x7213('0x59')]=function(_0xed5f72,_0xa7af29,_0x22d7bd,_0x2653cb,_0x40a2c7,_0x966429){var _0x4d3ced,_0x6d13e7,_0x19bad4,_0x682dd1;_0x966429[_0x7213('0x5a')]=intUtil[_0x7213('0x5b')](_0x966429[_0x7213('0x5a')]);_0x966429[_0x7213('0x53')]=intUtil[_0x7213('0x5b')](_0x966429[_0x7213('0x53')]);if(_0x40a2c7&&_0x40a2c7[_0x7213('0x5c')]){logger['info'](_0x7213('0x5d'),_0x7213('0x5e'));_0xa7af29['recordingURL']=util[_0x7213('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x966429['serverUrl'],_0xa7af29[_0x7213('0x5f')],md5(_0xa7af29[_0x7213('0x5f')]));}else{_0xa7af29[_0x7213('0x60')]='';}return getConnection(_0x966429)[_0x7213('0x22')](function(_0x46be0b){_0x682dd1=_0x46be0b;return getUser(_0x966429,_0x2653cb[_0x7213('0x61')],_0x682dd1);})[_0x7213('0x22')](function(_0x3d4abc){_0x4d3ced=_0x3d4abc;return getEndUser(_0x966429,_0x22d7bd,_0xa7af29[_0x7213('0x62')],_0xa7af29[_0x7213('0x63')],_0x682dd1);})[_0x7213('0x22')](function(_0x2eab87){_0x6d13e7=_0x2eab87;return getTicket(_0x966429,_0x4d3ced,_0x6d13e7,_0x22d7bd,_0xa7af29,_0x22d7bd[_0x7213('0x64')],_0x682dd1,_0x7213('0x59'));})[_0x7213('0x22')](function(_0x2a75fb){_0x19bad4=_0x2a75fb;logger['info'](_0x7213('0x65'),_0x19bad4['id']);logger[_0x7213('0x25')](_0x7213('0x66'),_0x19bad4['id'],_0x2653cb[_0x7213('0x50')],_0x966429['type']);switch(_0x966429['type']){case'integrationTab':emit(util['format'](_0x7213('0x67'),_0x2653cb[_0x7213('0x50')]),'trigger:salesforce:display',{'recordId':_0x19bad4['id']});break;case _0x7213('0x68'):emit(util['format'](_0x7213('0x67'),_0x2653cb[_0x7213('0x50')]),_0x7213('0x69'),{'uri':util[_0x7213('0x44')]('%s/%s/e',_0x682dd1['instanceUrl'],_0x19bad4['id'])});break;default:logger[_0x7213('0x6a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x7213('0x6b')](function(_0x243f0e){logger[_0x7213('0x6a')]('[QUEUE]',_0x243f0e);});};exports[_0x7213('0x6c')]=function(_0xcfe95a,_0x57e12a,_0xe9130c,_0x208900,_0x5d4ec9,_0x6a628d,_0x1057c4){var _0x1ccb86,_0x13cc11,_0x319fd1,_0x4ef9b3;_0x6a628d[_0x7213('0x5a')]=intUtil[_0x7213('0x5b')](_0x6a628d[_0x7213('0x5a')]);_0x6a628d[_0x7213('0x53')]=intUtil[_0x7213('0x5b')](_0x6a628d['remoteUri']);if(_0x1057c4&&_0x1057c4[_0x7213('0x6d')]&&_0x1057c4['recordingFormat']!==_0x7213('0x6e')){logger[_0x7213('0x25')](_0x7213('0x6f'),_0x7213('0x5e'));_0x57e12a[_0x7213('0x60')]=util[_0x7213('0x44')](_0x7213('0x70'),_0x6a628d[_0x7213('0x5a')],_0x57e12a[_0x7213('0x5f')],md5(_0x57e12a[_0x7213('0x5f')]));}return getConnection(_0x6a628d)[_0x7213('0x22')](function(_0x676b5f){_0x4ef9b3=_0x676b5f;return getUser(_0x6a628d,_0x208900[_0x7213('0x61')],_0x4ef9b3);})['then'](function(_0x15d14b){_0x1ccb86=_0x15d14b;return getEndUser(_0x6a628d,_0xe9130c,_0x57e12a[_0x7213('0x71')],_0x57e12a[_0x7213('0x72')],_0x4ef9b3);})['then'](function(_0x32f2b1){_0x13cc11=_0x32f2b1;return getTicket(_0x6a628d,_0x1ccb86,_0x13cc11,_0xe9130c,_0x57e12a,_0xe9130c['Fields'],_0x4ef9b3,_0x7213('0x6c'));})[_0x7213('0x22')](function(_0x4b19ff){_0x319fd1=_0x4b19ff;logger[_0x7213('0x25')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x319fd1['id']);logger[_0x7213('0x25')](_0x7213('0x73'),_0x319fd1['id'],_0x208900['name'],_0x6a628d[_0x7213('0x3a')]);switch(_0x6a628d[_0x7213('0x3a')]){case'integrationTab':emit(util[_0x7213('0x44')](_0x7213('0x67'),_0x208900[_0x7213('0x50')]),_0x7213('0x74'),{'recordId':_0x319fd1['id']});break;case _0x7213('0x68'):emit(util[_0x7213('0x44')](_0x7213('0x67'),_0x208900[_0x7213('0x50')]),_0x7213('0x69'),{'uri':util[_0x7213('0x44')]('%s/%s/e',_0x4ef9b3[_0x7213('0x75')],_0x319fd1['id'])});break;default:logger['error']('[OUTBOUND]',_0x7213('0x76'));}})[_0x7213('0x6b')](function(_0x1102f3){logger[_0x7213('0x6a')](_0x7213('0x6f'),_0x1102f3);});};exports[_0x7213('0x77')]=function(_0x4446e9,_0x3a1a95,_0x474c6c,_0x22a50f,_0xca6d16,_0x37e5ab){var _0x3703a6,_0x10df02,_0x272a64,_0x4d824d;_0x37e5ab[_0x7213('0x5a')]=intUtil[_0x7213('0x5b')](_0x37e5ab['serverUrl']);_0x37e5ab['remoteUri']=intUtil['stripTrailingSlash'](_0x37e5ab[_0x7213('0x53')]);if(_0xca6d16&&_0xca6d16[_0x7213('0x5c')]){logger[_0x7213('0x25')]('['+_0x3a1a95[_0x7213('0x78')][_0x7213('0x79')]()+']',_0x7213('0x5e'));_0x3a1a95[_0x7213('0x60')]=util[_0x7213('0x44')](_0x7213('0x70'),_0x37e5ab[_0x7213('0x5a')],_0x3a1a95['uniqueid'],md5(_0x3a1a95['uniqueid']));}else{_0x3a1a95[_0x7213('0x60')]='';}return getConnection(_0x37e5ab)[_0x7213('0x22')](function(_0x54c11a){_0x4d824d=_0x54c11a;if(!_[_0x7213('0x1e')](_0x22a50f)){return getUser(_0x37e5ab,_0x22a50f['name'],_0x4d824d);}else{return getUser(_0x37e5ab,null,_0x4d824d);}})[_0x7213('0x22')](function(_0x21857a){_0x3703a6=_0x21857a;return getEndUser(_0x37e5ab,_0x474c6c,_0x3a1a95[_0x7213('0x62')],_0x3a1a95[_0x7213('0x63')],_0x4d824d);})['then'](function(_0x488e33){_0x10df02=_0x488e33;return getTicket(_0x37e5ab,_0x3703a6,_0x10df02,_0x474c6c,_0x3a1a95,_0x474c6c[_0x7213('0x64')],_0x4d824d);})[_0x7213('0x22')](function(_0x187bfc){_0x272a64=_0x187bfc;logger[_0x7213('0x25')]('['+_0x3a1a95[_0x7213('0x78')]['toUpperCase']()+_0x7213('0x7a'),_0x272a64['id']);logger[_0x7213('0x25')]('['+_0x3a1a95['lastevent'][_0x7213('0x79')]()+_0x7213('0x7b'),_0x37e5ab[_0x7213('0x3a')]);})[_0x7213('0x6b')](function(_0x19c84a){logger[_0x7213('0x6a')]('['+_0x3a1a95[_0x7213('0x78')]['toUpperCase']()+']',_0x19c84a);});}; \ No newline at end of file +var _0x0163=['monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','destcalleridname','destcalleridnum','Fields','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','Recording\x20is\x20enabled!','lastevent',']\x20Integration\x20account\x20type\x20%s.','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','account','WhatId','ticketType','Case','ContactId','lead','leadId','info','sobject','isNil','validateEmail','find','execute','then','Email','Name','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','length','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','attributes','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','create','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','remoteUri','https://login.salesforce.com','login','username','serverUrl','stripTrailingSlash'];(function(_0x1e78ea,_0x5a9d61){var _0x5ce73f=function(_0x977491){while(--_0x977491){_0x1e78ea['push'](_0x1e78ea['shift']());}};_0x5ce73f(++_0x5a9d61);}(_0x0163,0xa2));var _0x3016=function(_0x5a3620,_0x440fb1){_0x5a3620=_0x5a3620-0x0;var _0x16e7b3=_0x0163[_0x5a3620];return _0x16e7b3;};'use strict';var _=require('lodash');var rp=require(_0x3016('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x3016('0x1'));var jsforce=require('jsforce');var util=require(_0x3016('0x2'));var Redis=require('ioredis');var intUtil=require(_0x3016('0x3'));var config=require(_0x3016('0x4'));var logger=require(_0x3016('0x5'))(_0x3016('0x6'));config[_0x3016('0x7')]=_[_0x3016('0x8')](config[_0x3016('0x7')],{'host':_0x3016('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3016('0x7')]));function emit(_0x25e653,_0x3515ce,_0x152f30){io['to'](_0x25e653)[_0x3016('0xa')](_0x3515ce,_0x152f30);}function getTicket(_0x219a31,_0x4fc159,_0x4e1c12,_0x43dbe5,_0x1b3119,_0x251a82,_0xb022d6,_0x446e90){var _0x2f63aa=Object[_0x3016('0xb')]({},{'OwnerId':_0x4fc159['id'],'Subject':intUtil[_0x3016('0xc')](_0x43dbe5[_0x3016('0xd')],_0x1b3119,'\x20'),'Description':intUtil['getString'](_0x43dbe5[_0x3016('0xe')],_0x1b3119,'\x0a')},getCustomFields(_0x251a82,_0x1b3119));if(_0x4e1c12){if(_0x43dbe5['ticketType']===_0x3016('0xf')){_0x2f63aa[_0x3016('0x10')]=moment[_0x3016('0x11')]();_0x2f63aa[_0x3016('0x12')]=![];_0x2f63aa[_0x3016('0x13')]=![];if(_0x4e1c12['endUserType']===_0x3016('0x14')||_0x4e1c12['endUserType']==='lead'){_0x2f63aa['WhoId']=_0x4e1c12['id'];}else if(_0x4e1c12[_0x3016('0x15')]===_0x3016('0x16')){_0x2f63aa[_0x3016('0x17')]=_0x4e1c12['id'];}}else if(_0x43dbe5[_0x3016('0x18')]===_0x3016('0x19')){if(_0x4e1c12[_0x3016('0x15')]==='contact'){_0x2f63aa[_0x3016('0x1a')]=_0x4e1c12['id'];}else if(_0x4e1c12['endUserType']===_0x3016('0x16')){_0x2f63aa['AccountId']=_0x4e1c12['id'];}else if(_0x4e1c12[_0x3016('0x15')]===_0x3016('0x1b')&&_0x43dbe5[_0x3016('0x1c')]){_0x2f63aa[_0x43dbe5[_0x3016('0x1c')]]=_0x4e1c12['id'];}else{logger[_0x3016('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xb022d6[_0x3016('0x1e')](_0x43dbe5[_0x3016('0x18')])['create'](_0x2f63aa);}function getUser(_0x1e0529,_0x59b0b1,_0x19d21b){if(!_[_0x3016('0x1f')](_0x59b0b1)&&intUtil[_0x3016('0x20')](_0x59b0b1)){var _0x265114={'Email':_0x59b0b1};var _0x4f1e5a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x19d21b[_0x3016('0x1e')]('User')[_0x3016('0x21')](_0x265114,_0x4f1e5a)[_0x3016('0x22')]()[_0x3016('0x23')](function(_0x3fb413){if(_0x3fb413['length']){var _0x5ef793=_['find'](_0x3fb413,function(_0x132c31){return _0x132c31[_0x3016('0x24')]===_0x59b0b1;});if(_0x5ef793){logger['info']('Agent\x20%s\x20found.',_0x59b0b1);return BPromise['resolve']({'id':_0x5ef793['Id'],'name':_0x5ef793[_0x3016('0x25')]});}}else{logger[_0x3016('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x59b0b1);return _0x19d21b['identity']()['then'](function(_0x34c0f9){return BPromise[_0x3016('0x26')]({'id':_0x34c0f9['user_id'],'name':_0x34c0f9['display_name']});});}});}else{logger[_0x3016('0x1d')](_0x3016('0x27'),_0x59b0b1);return _0x19d21b[_0x3016('0x28')]()[_0x3016('0x23')](function(_0x116511){return BPromise[_0x3016('0x26')]({'id':_0x116511[_0x3016('0x29')],'name':_0x116511[_0x3016('0x2a')]});});}}function getEndUser(_0x4f8636,_0xb55f00,_0x365452,_0x980fdd,_0x100a96){var _0xc564ed={'$or':{'Phone':_0x980fdd}};var _0x3bc5b8={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3016('0x26')]()[_0x3016('0x23')](function(){logger[_0x3016('0x1d')](_0x3016('0x2b'),_0x980fdd,_0xb55f00['moduleSearch']);switch(_0xb55f00[_0x3016('0x2c')]){case _0x3016('0x2d'):var _0x4273fd=_[_0x3016('0x2e')](_0xc564ed);if(_0xb55f00['additionalSearchContact']){var _0x1f5def={};_0x1f5def[_0xb55f00[_0x3016('0x2f')]]=_0x980fdd;_['merge'](_0x4273fd[_0x3016('0x30')],_0x1f5def);}return _0x100a96['sobject']('Contact')[_0x3016('0x21')](_0x4273fd,_0x3bc5b8)['execute']()['then'](function(_0x4d18c7){if(_0x4d18c7&&_0x4d18c7[_0x3016('0x31')]){return _0x4d18c7;}else{var _0x51e4fc=_[_0x3016('0x2e')](_0xc564ed);if(_0xb55f00['additionalSearchLead']){var _0x503dac={};_0x503dac[_0xb55f00[_0x3016('0x32')]]=_0x980fdd;_[_0x3016('0x33')](_0x51e4fc[_0x3016('0x30')],_0x503dac);}return _0x100a96[_0x3016('0x1e')](_0x3016('0x34'))['find'](_0x51e4fc,_0x3bc5b8);}});case _0x3016('0x35'):var _0x515b24=_[_0x3016('0x2e')](_0xc564ed);if(_0xb55f00[_0x3016('0x36')]){var _0x1f5def={};_0x1f5def[_0xb55f00[_0x3016('0x36')]]=_0x980fdd;_[_0x3016('0x33')](_0x515b24[_0x3016('0x30')],_0x1f5def);}return _0x100a96[_0x3016('0x1e')](_0x3016('0x37'))[_0x3016('0x21')](_0x515b24,_0x3bc5b8)[_0x3016('0x22')]()[_0x3016('0x23')](function(_0x3e0dcb){if(_0x3e0dcb&&_0x3e0dcb[_0x3016('0x31')]){return _0x3e0dcb;}else{var _0x5b5379=_['cloneDeep'](_0xc564ed);if(_0xb55f00[_0x3016('0x2f')]){var _0x1fbc53={};_0x1fbc53[_0xb55f00['additionalSearchContact']]=_0x980fdd;_[_0x3016('0x33')](_0x5b5379[_0x3016('0x30')],_0x1fbc53);}return _0x100a96[_0x3016('0x1e')](_0x3016('0x38'))[_0x3016('0x21')](_0x5b5379,_0x3bc5b8)['then'](function(_0x3dce87){if(_0x3dce87&&_0x3dce87[_0x3016('0x31')]){return _0x3dce87;}else{var _0x151144=_[_0x3016('0x2e')](_0xc564ed);if(_0xb55f00['additionalSearchLead']){var _0x287db9={};_0x287db9[_0xb55f00[_0x3016('0x32')]]=_0x980fdd;_['merge'](_0x151144[_0x3016('0x30')],_0x287db9);}return _0x100a96['sobject']('Lead')[_0x3016('0x21')](_0x151144,_0x3bc5b8);}});}});case'contact':var _0x4273fd=_[_0x3016('0x2e')](_0xc564ed);if(_0xb55f00[_0x3016('0x2f')]){var _0x1f5def={};_0x1f5def[_0xb55f00['additionalSearchContact']]=_0x980fdd;_['merge'](_0x4273fd[_0x3016('0x30')],_0x1f5def);}return _0x100a96[_0x3016('0x1e')](_0x3016('0x38'))[_0x3016('0x21')](_0x4273fd,_0x3bc5b8)[_0x3016('0x22')]();case _0x3016('0x1b'):var _0x18305d=_['cloneDeep'](_0xc564ed);if(_0xb55f00[_0x3016('0x32')]){var _0x1f5def={};_0x1f5def[_0xb55f00['additionalSearchLead']]=_0x980fdd;_[_0x3016('0x33')](_0x18305d[_0x3016('0x30')],_0x1f5def);}return _0x100a96[_0x3016('0x1e')](_0x3016('0x34'))[_0x3016('0x21')](_0x18305d,_0x3bc5b8);case _0x3016('0x16'):var _0x515b24=_[_0x3016('0x2e')](_0xc564ed);if(_0xb55f00['additionalSearchAccount']){var _0x1f5def={};_0x1f5def[_0xb55f00['additionalSearchAccount']]=_0x980fdd;_['merge'](_0x515b24[_0x3016('0x30')],_0x1f5def);}return _0x100a96[_0x3016('0x1e')](_0x3016('0x37'))[_0x3016('0x21')](_0x515b24,_0x3bc5b8);default:return null;}})[_0x3016('0x23')](function(_0x1b9129){if(_0x1b9129&&_0x1b9129[_0x3016('0x31')]){var _0x586d10=_[_0x3016('0x39')](_0x1b9129);if(_0x586d10){return BPromise[_0x3016('0x26')]({'id':_0x586d10['Id'],'name':_0x586d10[_0x3016('0x25')],'phone':_0x586d10[_0x3016('0x3a')],'endUserType':_0x586d10[_0x3016('0x3b')]['type']['toLowerCase']()});}}})['then'](function(_0x2f069c){if(_0x2f069c){logger[_0x3016('0x1d')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x2f069c['endUserType'],_0x980fdd);return BPromise['resolve'](_0x2f069c);}else{logger['info'](_0x3016('0x3c'),_0x980fdd);var _0x1cea68={'Phone':_0x980fdd};if(_0xb55f00[_0x3016('0x3d')]){if(_0xb55f00[_0x3016('0x3d')]===_0x3016('0x14')){logger['info'](_0x3016('0x3e'),_0x980fdd,_0xb55f00[_0x3016('0x3d')]);_0x1cea68[_0x3016('0x3f')]=_0x365452!==''?_0x365452:util[_0x3016('0x40')](_0x3016('0x41'),_0x980fdd);}else if(_0xb55f00[_0x3016('0x3d')]===_0x3016('0x1b')){logger['info'](_0x3016('0x3e'),_0x980fdd,_0xb55f00[_0x3016('0x3d')]);_0x1cea68[_0x3016('0x3f')]=_0x365452!==_0x3016('0x42')?_0x365452:util['format'](_0x3016('0x41'),_0x980fdd);_0x1cea68[_0x3016('0x43')]=_0x3016('0x44');}else if(_0xb55f00['moduleCreate']===_0x3016('0x16')){logger[_0x3016('0x1d')](_0x3016('0x3e'),_0x980fdd,_0xb55f00[_0x3016('0x3d')]);_0x1cea68[_0x3016('0x25')]=_0x365452!==''?_0x365452:util['format'](_0x3016('0x41'),_0x980fdd);}else{return null;}}return _0x100a96[_0x3016('0x1e')](_['upperFirst'](_0xb55f00['moduleCreate']))[_0x3016('0x45')](_0x1cea68)[_0x3016('0x23')](function(_0x27b564){return BPromise['resolve']({'id':_0x27b564['id'],'endUserType':_0xb55f00[_0x3016('0x3d')]});});}});}function getCustomFields(_0x218d07,_0x5032e4){var _0x35b939={};if(_0x218d07['length']>0x0){_[_0x3016('0x46')](_0x218d07,function(_0x1f2201){if(_[_0x3016('0x47')]([_0x3016('0x48'),_0x3016('0x49')],_0x1f2201['type'])&&_0x1f2201[_0x3016('0x4a')]){_0x35b939[_0x1f2201[_0x3016('0x4a')]]=_0x1f2201[_0x3016('0x4b')][_0x3016('0x4c')]();}else if(_0x1f2201[_0x3016('0x4d')]===_0x3016('0x4e')&&_0x1f2201['variableName']&&_0x1f2201[_0x3016('0x4a')]){_0x5032e4[_0x1f2201[_0x3016('0x4f')]]&&(_0x35b939[_0x1f2201[_0x3016('0x4a')]]=_0x5032e4[_0x1f2201[_0x3016('0x4f')]][_0x3016('0x4c')]());}else if(_0x1f2201[_0x3016('0x4d')]===_0x3016('0x50')&&_0x1f2201[_0x3016('0x51')]&&_0x1f2201[_0x3016('0x51')]['name']&&_0x1f2201[_0x3016('0x4a')]){_0x5032e4[_0x1f2201[_0x3016('0x51')]['name']['toLowerCase']()]&&(_0x35b939[_0x1f2201[_0x3016('0x4a')]]=_0x5032e4[_0x1f2201[_0x3016('0x51')][_0x3016('0x52')][_0x3016('0x53')]()][_0x3016('0x4c')]());}});}return _0x35b939;}function getConnection(_0x30dd1b){var _0x25d421=_0x30dd1b[_0x3016('0x54')]['concat'](_0x30dd1b[_0x3016('0x55')]);var _0x2976c8=new jsforce['Connection']({'oauth2':{'loginUrl':_0x30dd1b[_0x3016('0x56')]||_0x3016('0x57'),'clientId':_0x30dd1b['clientId'],'clientSecret':_0x30dd1b['clientSecret']}});return _0x2976c8[_0x3016('0x58')](_0x30dd1b[_0x3016('0x59')],_0x25d421)[_0x3016('0x23')](function(){logger[_0x3016('0x1d')]('Connection\x20established.');return _0x2976c8;});}exports['queue']=function(_0x112fba,_0x4b0da8,_0x5840a6,_0x353612,_0x5b69ef,_0x409a46){var _0x51da6c,_0x1979f3,_0x40988e,_0x2e8340;_0x409a46[_0x3016('0x5a')]=intUtil[_0x3016('0x5b')](_0x409a46[_0x3016('0x5a')]);_0x409a46['remoteUri']=intUtil[_0x3016('0x5b')](_0x409a46[_0x3016('0x56')]);if(_0x5b69ef&&_0x5b69ef[_0x3016('0x5c')]){logger[_0x3016('0x1d')](_0x3016('0x5d'),'Recording\x20is\x20enabled!');_0x4b0da8[_0x3016('0x5e')]=util[_0x3016('0x40')](_0x3016('0x5f'),_0x409a46['serverUrl'],_0x4b0da8[_0x3016('0x60')],md5(_0x4b0da8[_0x3016('0x60')]));}else{_0x4b0da8[_0x3016('0x5e')]='';}return getConnection(_0x409a46)['then'](function(_0x3691fe){_0x2e8340=_0x3691fe;return getUser(_0x409a46,_0x353612[_0x3016('0x61')],_0x2e8340);})[_0x3016('0x23')](function(_0xc2a334){_0x51da6c=_0xc2a334;return getEndUser(_0x409a46,_0x5840a6,_0x4b0da8[_0x3016('0x62')],_0x4b0da8[_0x3016('0x63')],_0x2e8340);})['then'](function(_0x4db9c6){_0x1979f3=_0x4db9c6;return getTicket(_0x409a46,_0x51da6c,_0x1979f3,_0x5840a6,_0x4b0da8,_0x5840a6['Fields'],_0x2e8340,_0x3016('0x64'));})[_0x3016('0x23')](function(_0x585f4b){_0x40988e=_0x585f4b;logger[_0x3016('0x1d')](_0x3016('0x65'),_0x40988e['id']);logger['info'](_0x3016('0x66'),_0x40988e['id'],_0x353612['name'],_0x409a46[_0x3016('0x4d')]);switch(_0x409a46[_0x3016('0x4d')]){case _0x3016('0x67'):emit(util[_0x3016('0x40')]('user:%s',_0x353612[_0x3016('0x52')]),_0x3016('0x68'),{'recordId':_0x40988e['id']});break;case _0x3016('0x69'):emit(util[_0x3016('0x40')](_0x3016('0x6a'),_0x353612[_0x3016('0x52')]),_0x3016('0x6b'),{'uri':util[_0x3016('0x40')](_0x3016('0x6c'),_0x2e8340[_0x3016('0x6d')],_0x40988e['id'])});break;default:logger[_0x3016('0x6e')](_0x3016('0x6f'));}})[_0x3016('0x70')](function(_0x4a8936){logger['error']('[QUEUE]',_0x4a8936);});};exports['outbound']=function(_0x3e738e,_0x4ea0e9,_0x467d10,_0x38b782,_0x479545,_0x2d0f60,_0x379acf){var _0x23e8b1,_0x30b813,_0xc752f3,_0x34588a;_0x2d0f60[_0x3016('0x5a')]=intUtil[_0x3016('0x5b')](_0x2d0f60[_0x3016('0x5a')]);_0x2d0f60[_0x3016('0x56')]=intUtil[_0x3016('0x5b')](_0x2d0f60[_0x3016('0x56')]);if(_0x379acf&&_0x379acf[_0x3016('0x71')]&&_0x379acf[_0x3016('0x71')]!==_0x3016('0x72')){logger[_0x3016('0x1d')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4ea0e9[_0x3016('0x5e')]=util[_0x3016('0x40')](_0x3016('0x5f'),_0x2d0f60[_0x3016('0x5a')],_0x4ea0e9[_0x3016('0x60')],md5(_0x4ea0e9[_0x3016('0x60')]));}return getConnection(_0x2d0f60)['then'](function(_0x687df1){_0x34588a=_0x687df1;return getUser(_0x2d0f60,_0x38b782[_0x3016('0x61')],_0x34588a);})[_0x3016('0x23')](function(_0x371c07){_0x23e8b1=_0x371c07;return getEndUser(_0x2d0f60,_0x467d10,_0x4ea0e9[_0x3016('0x73')],_0x4ea0e9[_0x3016('0x74')],_0x34588a);})[_0x3016('0x23')](function(_0xac22ea){_0x30b813=_0xac22ea;return getTicket(_0x2d0f60,_0x23e8b1,_0x30b813,_0x467d10,_0x4ea0e9,_0x467d10[_0x3016('0x75')],_0x34588a,_0x3016('0x76'));})['then'](function(_0x19062d){_0xc752f3=_0x19062d;logger[_0x3016('0x1d')](_0x3016('0x77'),_0xc752f3['id']);logger[_0x3016('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xc752f3['id'],_0x38b782[_0x3016('0x52')],_0x2d0f60[_0x3016('0x4d')]);switch(_0x2d0f60[_0x3016('0x4d')]){case _0x3016('0x67'):emit(util[_0x3016('0x40')](_0x3016('0x6a'),_0x38b782[_0x3016('0x52')]),_0x3016('0x68'),{'recordId':_0xc752f3['id']});break;case'newTab':emit(util[_0x3016('0x40')]('user:%s',_0x38b782['name']),_0x3016('0x6b'),{'uri':util[_0x3016('0x40')]('%s/%s/e',_0x34588a[_0x3016('0x6d')],_0xc752f3['id'])});break;default:logger[_0x3016('0x6e')](_0x3016('0x78'),_0x3016('0x79'));}})[_0x3016('0x70')](function(_0x2bbf7c){logger[_0x3016('0x6e')](_0x3016('0x78'),_0x2bbf7c);});};exports[_0x3016('0x7a')]=function(_0x5e4427,_0x4f487c,_0x5d664d,_0x4f90a0,_0xddc500,_0x190f7c){var _0x16f87e,_0x1cbcc4,_0x40d962,_0x6c6c5f;_0x190f7c[_0x3016('0x5a')]=intUtil[_0x3016('0x5b')](_0x190f7c[_0x3016('0x5a')]);_0x190f7c['remoteUri']=intUtil[_0x3016('0x5b')](_0x190f7c[_0x3016('0x56')]);if(_0xddc500&&_0xddc500[_0x3016('0x5c')]){logger['info']('['+_0x4f487c['lastevent'][_0x3016('0x7b')]()+']',_0x3016('0x7c'));_0x4f487c['recordingURL']=util[_0x3016('0x40')](_0x3016('0x5f'),_0x190f7c[_0x3016('0x5a')],_0x4f487c['uniqueid'],md5(_0x4f487c[_0x3016('0x60')]));}else{_0x4f487c[_0x3016('0x5e')]='';}return getConnection(_0x190f7c)['then'](function(_0x21f9ce){_0x6c6c5f=_0x21f9ce;if(!_['isNil'](_0x4f90a0)){return getUser(_0x190f7c,_0x4f90a0[_0x3016('0x52')],_0x6c6c5f);}else{return getUser(_0x190f7c,null,_0x6c6c5f);}})[_0x3016('0x23')](function(_0x269c18){_0x16f87e=_0x269c18;return getEndUser(_0x190f7c,_0x5d664d,_0x4f487c[_0x3016('0x62')],_0x4f487c['calleridnum'],_0x6c6c5f);})[_0x3016('0x23')](function(_0x1e27d5){_0x1cbcc4=_0x1e27d5;return getTicket(_0x190f7c,_0x16f87e,_0x1cbcc4,_0x5d664d,_0x4f487c,_0x5d664d[_0x3016('0x75')],_0x6c6c5f);})[_0x3016('0x23')](function(_0x50e52d){_0x40d962=_0x50e52d;logger[_0x3016('0x1d')]('['+_0x4f487c[_0x3016('0x7d')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x40d962['id']);logger[_0x3016('0x1d')]('['+_0x4f487c[_0x3016('0x7d')][_0x3016('0x7b')]()+_0x3016('0x7e'),_0x190f7c['type']);})[_0x3016('0x70')](function(_0x46377b){logger[_0x3016('0x6e')]('['+_0x4f487c['lastevent']['toUpperCase']()+']',_0x46377b);});}; \ 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 2077eea..cbae1b2 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 _0x1d57=['],\x20getUser\x20crm','error','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','label','?sysparm_query=name%3D','Incident','ticketId','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','adminEmail','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','length','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message','info','],\x20getUser\x20input\x20crm','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','active','true','userId','adminId'];(function(_0x461ff7,_0x172913){var _0x1b8ddf=function(_0x422b88){while(--_0x422b88){_0x461ff7['push'](_0x461ff7['shift']());}};_0x1b8ddf(++_0x172913);}(_0x1d57,0x1a1));var _0x71d5=function(_0x7b4397,_0x50ab04){_0x7b4397=_0x7b4397-0x0;var _0x16de0b=_0x1d57[_0x7b4397];return _0x16de0b;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x71d5('0x0'));var md5=require(_0x71d5('0x1'));var Redis=require(_0x71d5('0x2'));var intUtil=require(_0x71d5('0x3'));var config=require(_0x71d5('0x4'));var logger=require(_0x71d5('0x5'))(_0x71d5('0x6'));config[_0x71d5('0x7')]=_[_0x71d5('0x8')](config[_0x71d5('0x7')],{'host':_0x71d5('0x9'),'port':0x18eb});var io=require(_0x71d5('0xa'))(new Redis(config[_0x71d5('0x7')]));function getAdminUser(_0x1f6a16,_0x5a50f4,_0x5efee1,_0x41b442,_0x4dc028,_0x1df79b){return new Promise(function(_0x3d0084,_0x4f3965){var _0x474cef={'method':'GET','uri':_0x41b442+_0x71d5('0xb')+'&'+_0x4dc028+'&'+_0x1df79b,'auth':_0x5a50f4,'json':!![]};return rp(_0x474cef)[_0x71d5('0xc')](function(_0x73fffa){if(_0x73fffa['result'][_0x71d5('0xd')]>0x0){_0x5efee1['adminId']=_0x73fffa['result'][0x0][_0x71d5('0xe')];}logger['info']('['+[_0x1f6a16[_0x71d5('0xf')]()]+_0x71d5('0x10'),_0x5efee1);_0x3d0084(_0x5efee1);})[_0x71d5('0x11')](function(_0x5a2107){logger['error']('['+[_0x1f6a16[_0x71d5('0xf')]()]+']',_0x5a2107[_0x71d5('0x12')]);_0x4f3965(_0x5a2107[_0x71d5('0x12')]);});});}function getUser(_0x1ad9ad,_0x28f6ff,_0x43ff56,_0x4f106a,_0x47831d){return function(_0x9c2c3c){logger[_0x71d5('0x13')]('['+[_0x1ad9ad[_0x71d5('0xf')]()]+_0x71d5('0x14'),_0x9c2c3c);return new Promise(function(_0xb1bcb3,_0x18fff3){if(intUtil['validateEmail'](_0x9c2c3c[_0x71d5('0x15')])){var _0x5d8cc3={'method':_0x71d5('0x16'),'uri':_0x43ff56+_0x71d5('0x17')+_0x9c2c3c[_0x71d5('0x15')]+'&'+_0x4f106a+'&'+_0x47831d,'auth':_0x28f6ff,'json':!![]};logger[_0x71d5('0x13')]('['+[_0x1ad9ad['toUpperCase']()]+_0x71d5('0x18'),_0x5d8cc3);return rp(_0x5d8cc3)[_0x71d5('0xc')](function(_0x4b1e15){logger['info']('['+[_0x1ad9ad[_0x71d5('0xf')]()]+_0x71d5('0x19'),_0x4b1e15);if(_0x4b1e15[_0x71d5('0x1a')][_0x71d5('0xd')]>0x0&&String(_0x4b1e15[_0x71d5('0x1a')][0x0][_0x71d5('0x1b')])===_0x71d5('0x1c')){_0x9c2c3c[_0x71d5('0x1d')]=_0x4b1e15[_0x71d5('0x1a')][0x0][_0x71d5('0xe')];}else{_0x9c2c3c[_0x71d5('0x1d')]=_0x9c2c3c[_0x71d5('0x1e')];_0x9c2c3c[_0x71d5('0x15')]=_0x9c2c3c['adminEmail'];}logger[_0x71d5('0x13')]('['+[_0x1ad9ad[_0x71d5('0xf')]()]+_0x71d5('0x1f'),_0x9c2c3c);_0xb1bcb3(_0x9c2c3c);})['catch'](function(_0x15064a){logger[_0x71d5('0x20')]('['+[_0x1ad9ad[_0x71d5('0xf')]()]+']',_0x15064a[_0x71d5('0x12')]);_0x18fff3(_0x15064a['message']);});}else{logger[_0x71d5('0x13')]('['+[_0x1ad9ad['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x9c2c3c[_0x71d5('0x1d')]=_0x9c2c3c[_0x71d5('0x1e')];_0x9c2c3c[_0x71d5('0x15')]=_0x9c2c3c['adminEmail'];_0xb1bcb3(_0x9c2c3c);}});};}function createEndUser(_0x55ad83,_0x1aaa91,_0x16aa3f,_0x554333,_0xc8fd4d){logger[_0x71d5('0x13')]('['+[_0x55ad83['toUpperCase']()]+_0x71d5('0x21'),_0x16aa3f);return new Promise(function(_0x589d01,_0x343a47){var _0x2bbb00={'method':_0x71d5('0x22'),'uri':_0x554333+_0x71d5('0x23')+_0xc8fd4d,'body':{'user_name':_0x16aa3f[_0x71d5('0x24')],'roles':_0x71d5('0x25'),'first_name':_0x16aa3f['endUserNumber'],'active':_0x71d5('0x1c'),'date_format':'System','phone':_0x16aa3f['endUserNumber']},'auth':_0x1aaa91,'json':!![]};return rp(_0x2bbb00)[_0x71d5('0xc')](function(_0x9f7ca9){logger[_0x71d5('0x13')]('['+[_0x55ad83[_0x71d5('0xf')]()]+_0x71d5('0x26'),_0x9f7ca9[_0x71d5('0x1a')]);_0x16aa3f['endUserId']=_0x9f7ca9['result'][_0x71d5('0xe')];_0x589d01(_0x16aa3f);})[_0x71d5('0x11')](function(_0x428441){logger[_0x71d5('0x20')]('['+[_0x55ad83[_0x71d5('0xf')]()]+']',_0x428441['message']);_0x343a47(_0x428441[_0x71d5('0x12')]);});});}function getEndUser(_0x2b4584,_0x2247fa,_0x28f196,_0x1542e8,_0x2082e7){return function(_0x5884df){logger['info']('['+[_0x2b4584[_0x71d5('0xf')]()]+_0x71d5('0x27'),_0x5884df);return new Promise(function(_0x31f2d4,_0x286911){var _0x23906c={'method':_0x71d5('0x16'),'uri':_0x28f196+_0x71d5('0x28')+_0x5884df[_0x71d5('0x24')]+'&'+_0x1542e8+'&'+_0x2082e7,'auth':_0x2247fa,'json':!![]};return rp(_0x23906c)[_0x71d5('0xc')](function(_0x40d90c){if(_0x40d90c[_0x71d5('0x1a')][_0x71d5('0xd')]>0x0){_0x5884df[_0x71d5('0x29')]=_0x40d90c[_0x71d5('0x1a')][0x0][_0x71d5('0xe')];logger[_0x71d5('0x13')]('['+[_0x2b4584[_0x71d5('0xf')]()]+_0x71d5('0x2a'),_0x5884df);_0x31f2d4(_0x5884df);}else{return createEndUser(_0x2b4584,_0x2247fa,_0x5884df,_0x28f196,_0x1542e8)[_0x71d5('0xc')](function(_0x29d708){logger[_0x71d5('0x13')]('['+[_0x2b4584[_0x71d5('0xf')]()]+_0x71d5('0x2b'),_0x29d708);_0x31f2d4(_0x29d708);});}})[_0x71d5('0x11')](function(_0x168ac7){logger[_0x71d5('0x20')]('['+[_0x2b4584[_0x71d5('0xf')]()]+']',_0x168ac7['message']);_0x286911(_0x168ac7[_0x71d5('0x12')]);});});};}function getCustomFields(_0x5d037e,_0x590403){var _0x5dd68f={};if(_0x5d037e[_0x71d5('0xd')]>0x0){_[_0x71d5('0x2c')](_0x5d037e,function(_0x4c4108){if(_['includes']([_0x71d5('0x2d'),'picklist'],_0x4c4108[_0x71d5('0x2e')])&&_0x4c4108[_0x71d5('0x2f')]&&!_0x4c4108[_0x71d5('0x30')]){_0x5dd68f[_0x4c4108[_0x71d5('0x2f')][_0x71d5('0x31')]()]=_0x4c4108[_0x71d5('0x32')][_0x71d5('0x33')]();}else if(_['includes'](['string','picklist'],_0x4c4108[_0x71d5('0x2e')])&&_0x4c4108[_0x71d5('0x34')]&&_0x4c4108[_0x71d5('0x30')]){_0x5dd68f[_0x4c4108[_0x71d5('0x34')]['toLowerCase']()]=_0x4c4108['content'][_0x71d5('0x33')]();}else if(_0x4c4108[_0x71d5('0x2e')]===_0x71d5('0x35')&&_0x4c4108[_0x71d5('0x36')]&&_0x4c4108[_0x71d5('0x34')]&&_0x4c4108[_0x71d5('0x30')]){_0x5dd68f[_0x4c4108[_0x71d5('0x34')]['toLowerCase']()]=_0x590403[_0x4c4108[_0x71d5('0x36')]]['toString']();}else if(_0x4c4108[_0x71d5('0x2e')]===_0x71d5('0x37')&&_0x4c4108['Variable']&&_0x4c4108[_0x71d5('0x38')][_0x71d5('0x39')]&&_0x4c4108[_0x71d5('0x34')]&&_0x4c4108[_0x71d5('0x30')]){_0x5dd68f[_0x4c4108[_0x71d5('0x34')][_0x71d5('0x31')]()]=_0x590403[_0x4c4108['Variable'][_0x71d5('0x39')]['toLowerCase']()][_0x71d5('0x33')]();}});}return _0x5dd68f;}function getTicket(_0x1c912b,_0x231025,_0x2c28a5,_0x1dc27c,_0x45974d,_0x18f113){return function(_0x54314d){logger['info']('['+[_0x1c912b['toUpperCase']()]+_0x71d5('0x3a'),_0x54314d);return new Promise(function(_0x1470ba,_0x40f76c){var _0x3d7571=_0x1c912b[_0x71d5('0x31')]()===_0x71d5('0x3b')?_0x54314d['userId']:_0x54314d[_0x71d5('0x29')];var _0x2f1562={'method':_0x71d5('0x22'),'uri':_0x2c28a5+_0x71d5('0x3c')+'?'+_0x18f113,'body':Object['assign']({},{'active':_0x71d5('0x1c'),'caller_id':_0x3d7571,'assigned_to':_0x54314d[_0x71d5('0x1d')],'short_description':intUtil[_0x71d5('0x3d')](_0x1dc27c[_0x71d5('0x3e')],_0x45974d,'\x20'),'description':intUtil[_0x71d5('0x3d')](_0x1dc27c[_0x71d5('0x3f')],_0x45974d,'\x0a')},getCustomFields(_0x1dc27c[_0x71d5('0x40')],_0x45974d)),'auth':_0x231025,'json':!![]};return rp(_0x2f1562)[_0x71d5('0xc')](function(_0x11fa2d){logger[_0x71d5('0x13')]('['+[_0x1c912b[_0x71d5('0xf')]()]+_0x71d5('0x41'),_0x11fa2d[_0x71d5('0x1a')]);_0x54314d['ticketId']=_0x11fa2d[_0x71d5('0x1a')][_0x71d5('0xe')];_0x54314d['ticketNumber']=_0x11fa2d[_0x71d5('0x1a')]['number'];logger[_0x71d5('0x13')]('['+[_0x1c912b[_0x71d5('0xf')]()]+']\x20getTicket\x20crm',_0x54314d);_0x1470ba(_0x54314d);})[_0x71d5('0x11')](function(_0x32407a){logger['error']('['+[_0x1c912b['toUpperCase']()]+']',_0x32407a[_0x71d5('0x12')]);_0x40f76c(_0x32407a[_0x71d5('0x12')]);});});};}function createRemoteTag(_0x28db57,_0x268f69,_0x1a635c,_0x5d0cd4){return new Promise(function(_0x3761ce,_0x372d62){var _0x11da28={'method':'POST','uri':_0x1a635c+'label'+'?'+_0x5d0cd4,'body':{'short_description':_0x28db57,'global':!![],'active':!![],'name':_0x28db57},'auth':_0x268f69,'json':!![]};return rp(_0x11da28)[_0x71d5('0xc')](function(_0x3cdf46){var _0x25d5b0=_0x3cdf46[_0x71d5('0x1a')][_0x71d5('0xe')];_0x3761ce(_0x25d5b0);});});}function getRemoteTag(_0xf07a6e,_0x3ad1f0,_0x424304,_0xece6da,_0x1b2839){return new Promise(function(_0x1d118d,_0x61da15){var _0x3632de={'method':_0x71d5('0x16'),'uri':_0x424304+_0x71d5('0x42')+_0x71d5('0x43')+_0xf07a6e+'&'+_0xece6da,'auth':_0x3ad1f0,'json':!![]};return rp(_0x3632de)[_0x71d5('0xc')](function(_0x436982){if(_0x436982[_0x71d5('0x1a')]['length']>0x0){var _0xa26b85=_0x436982[_0x71d5('0x1a')][0x0][_0x71d5('0xe')];_0x1d118d(_0xa26b85);}else{return createRemoteTag(_0xf07a6e,_0x3ad1f0,_0x424304,_0xece6da)['then'](function(_0x338349){_0x1d118d(_0x338349);});}});});}function assignTagToIncident(_0x24f885,_0xacccb0,_0x4f82ae,_0x4ae73c,_0x476317){return new Promise(function(_0x1add71,_0x1fd958){var _0xe75e0c={'method':_0x71d5('0x22'),'uri':_0x4f82ae+'label_entry'+'?'+_0x476317,'body':{'label':_0x24f885,'table':_0x71d5('0x3c'),'id_type':_0x71d5('0x44'),'table_key':_0x4ae73c[_0x71d5('0x45')],'title':'Incident\x20-\x20'+_0x4ae73c[_0x71d5('0x46')],'id_display':_0x4ae73c[_0x71d5('0x46')]},'auth':_0xacccb0,'json':!![]};return rp(_0xe75e0c)[_0x71d5('0xc')](function(_0x18da2e){_0x1add71();})[_0x71d5('0x11')](function(){_0x1add71();});});}function manageTags(_0xf6c140,_0x443742,_0x58a9fd,_0x1b5fa5,_0x1473d0,_0x5d1893,_0x4dd2e9){return new Promise(function(_0x34e118,_0x42bf85){var _0x6ce39d=[];_0x443742['forEach'](function(_0xf03e22){_0x6ce39d[_0x71d5('0x47')](getRemoteTag(_0xf03e22,_0x58a9fd,_0x1b5fa5,_0x5d1893,_0x4dd2e9));});return Promise[_0x71d5('0x48')](_0x6ce39d)['then'](function(_0x5acba2){if(_0x5acba2[_0x71d5('0xd')]){logger['info']('['+[_0xf6c140[_0x71d5('0xf')]()]+_0x71d5('0x49'),_0x5acba2);var _0x1b22b0=[];_0x5acba2[_0x71d5('0x2c')](function(_0x837c48){_0x1b22b0[_0x71d5('0x47')](assignTagToIncident(_0x837c48,_0x58a9fd,_0x1b5fa5,_0x1473d0,_0x5d1893));});return Promise[_0x71d5('0x48')](_0x1b22b0)[_0x71d5('0xc')](function(){_0x34e118();})[_0x71d5('0x11')](function(){_0x34e118();});}else{_0x34e118();}});});}function getTags(_0x3afc76,_0x2f24a4,_0xc4f6cd,_0x534482,_0xbe3baf,_0x196001){return function(_0x18a63d){return new Promise(function(_0x73c1ae,_0x5e767c){var _0x48e708=[];var _0x1a2a78=_0x534482[_0x71d5('0x4a')];if(_0x1a2a78&&_0x1a2a78[_0x71d5('0xd')]>0x0){_0x48e708=_[_0x71d5('0x4b')](_0x1a2a78,_0x71d5('0x39'));}if(_0x48e708['length']>0x0){return manageTags(_0x3afc76,_0x48e708,_0x2f24a4,_0xc4f6cd,_0x18a63d,_0xbe3baf,_0x196001)[_0x71d5('0xc')](function(){_0x73c1ae(_0x18a63d);});}else{_0x73c1ae(_0x18a63d);}});};}function emit(_0x28b173,_0x407cc8,_0x426c46){var _0x38258e=_0x71d5('0x4c')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x71d5('0x4d')+_0x71d5('0x4e');var _0x391be9={'uri':_0x28b173+_0x71d5('0x4f')+_0x426c46+_0x38258e};io['to'](util[_0x71d5('0x50')](_0x71d5('0x51'),_0x407cc8))[_0x71d5('0x52')](_0x71d5('0x53'),_0x391be9);}exports['cs']=function(_0x3f447c,_0x530a57,_0x5629d3,_0x58fc19,_0x1525d5,_0x352727,_0xf8bfde,_0x12c6c3){var _0x21f6dd={};var _0x440f60={'user':_0x352727[_0x71d5('0x54')],'pass':_0x352727[_0x71d5('0x55')]};var _0x1dceaa=_0x71d5('0x56');var _0x1bed7=_0x71d5('0x57');_0x352727[_0x71d5('0x58')]=intUtil['stripTrailingSlash'](_0x352727['remoteUri']);_0x352727[_0x71d5('0x59')]=intUtil[_0x71d5('0x5a')](_0x352727[_0x71d5('0x59')]);var _0x56af50=util[_0x71d5('0x50')](_0x71d5('0x5b'),_0x352727[_0x71d5('0x58')]);_0x21f6dd['userEmail']=!_[_0x71d5('0x5c')](_0x58fc19)?_0x58fc19[_0x71d5('0x5d')]:null;_0x21f6dd[_0x71d5('0x5e')]=_0x352727[_0x71d5('0x5d')];_0x21f6dd[_0x71d5('0x24')]=_0x12c6c3[_0x71d5('0x31')]()==='outbound'?_0x530a57['destcalleridnum']:_0x530a57[_0x71d5('0x5f')];_0x21f6dd[_0x71d5('0x60')]=_0x12c6c3===_0x71d5('0x61')||_0x12c6c3===_0x71d5('0x62')?_0x71d5('0x61'):_0x71d5('0x3b');var _0x56d47e=util['format'](_0x71d5('0x63'),_0x352727[_0x71d5('0x59')],_0x530a57[_0x71d5('0x64')],md5(_0x530a57['uniqueid']));if(_0x1525d5&&_0x1525d5[_0x71d5('0x65')]){logger[_0x71d5('0x13')](_0x71d5('0x66'),_0x71d5('0x67'));_0x530a57[_0x71d5('0x68')]=_0x56d47e;}else if(_0xf8bfde&&_0xf8bfde[_0x71d5('0x69')]&&_0xf8bfde[_0x71d5('0x69')]!==_0x71d5('0x6a')){logger[_0x71d5('0x13')]('[OUTBOUND]',_0x71d5('0x67'));_0x530a57['recordingURL']=_0x56d47e;}else{_0x530a57[_0x71d5('0x68')]='';}return getAdminUser(_0x12c6c3,_0x440f60,_0x21f6dd,_0x56af50,_0x1bed7,_0x1dceaa)[_0x71d5('0xc')](getUser(_0x12c6c3,_0x440f60,_0x56af50,_0x1bed7,_0x1dceaa))[_0x71d5('0xc')](getEndUser(_0x12c6c3,_0x440f60,_0x56af50,_0x1bed7,_0x1dceaa))[_0x71d5('0xc')](getTicket(_0x12c6c3,_0x440f60,_0x56af50,_0x5629d3,_0x530a57,_0x1bed7))['then'](function(_0x44b369){logger[_0x71d5('0x13')](util[_0x71d5('0x50')](_0x71d5('0x6b'),_0x44b369['ticketId']));logger[_0x71d5('0x13')](util[_0x71d5('0x50')](_0x71d5('0x6c'),_0x12c6c3));if(_0x12c6c3!=='unmanaged'){logger['info']('['+[_0x12c6c3[_0x71d5('0xf')]()]+']',_0x71d5('0x6d'));emit(_0x352727[_0x71d5('0x58')],_0x58fc19[_0x71d5('0x39')],_0x44b369[_0x71d5('0x45')]);}})['catch'](function(_0x3cee95){logger[_0x71d5('0x20')]('['+[_0x12c6c3['toUpperCase']()]+_0x71d5('0x6e'),util[_0x71d5('0x6f')](_0x3cee95,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6fcf=['forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString','variableName','idField','customVariable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','password','sysparm_limit=1','remoteUri','serverUrl','%s/api/now/table/','isNil','email','adminEmail','destcalleridnum','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm'];(function(_0x149083,_0x4047b6){var _0x4dc74e=function(_0x1211f9){while(--_0x1211f9){_0x149083['push'](_0x149083['shift']());}};_0x4dc74e(++_0x4047b6);}(_0x6fcf,0x11b));var _0xf6fc=function(_0x3303fb,_0x1266dd){_0x3303fb=_0x3303fb-0x0;var _0x71a686=_0x6fcf[_0x3303fb];return _0x71a686;};'use strict';var _=require(_0xf6fc('0x0'));var Promise=require('bluebird');var rp=require(_0xf6fc('0x1'));var util=require('util');var md5=require(_0xf6fc('0x2'));var Redis=require(_0xf6fc('0x3'));var intUtil=require('./util');var config=require(_0xf6fc('0x4'));var logger=require(_0xf6fc('0x5'))('servicenow');config[_0xf6fc('0x6')]=_['defaults'](config[_0xf6fc('0x6')],{'host':_0xf6fc('0x7'),'port':0x18eb});var io=require(_0xf6fc('0x8'))(new Redis(config[_0xf6fc('0x6')]));function getAdminUser(_0xe4537e,_0x3f7ec8,_0x579693,_0x4a7a07,_0x5a4d06,_0x1dda97){return new Promise(function(_0x2aa49e,_0x24fcf0){var _0x591027={'method':'GET','uri':_0x4a7a07+_0xf6fc('0x9')+'&'+_0x5a4d06+'&'+_0x1dda97,'auth':_0x3f7ec8,'json':!![]};return rp(_0x591027)[_0xf6fc('0xa')](function(_0x92c090){if(_0x92c090[_0xf6fc('0xb')]['length']>0x0){_0x579693[_0xf6fc('0xc')]=_0x92c090[_0xf6fc('0xb')][0x0][_0xf6fc('0xd')];}logger[_0xf6fc('0xe')]('['+[_0xe4537e[_0xf6fc('0xf')]()]+_0xf6fc('0x10'),_0x579693);_0x2aa49e(_0x579693);})[_0xf6fc('0x11')](function(_0x3f4102){logger[_0xf6fc('0x12')]('['+[_0xe4537e[_0xf6fc('0xf')]()]+']',_0x3f4102[_0xf6fc('0x13')]);_0x24fcf0(_0x3f4102[_0xf6fc('0x13')]);});});}function getUser(_0x8c1530,_0x5f059c,_0x110f31,_0x35d929,_0x435c36){return function(_0xae3aef){logger['info']('['+[_0x8c1530['toUpperCase']()]+_0xf6fc('0x14'),_0xae3aef);return new Promise(function(_0x57296a,_0x15921c){if(intUtil[_0xf6fc('0x15')](_0xae3aef[_0xf6fc('0x16')])){var _0x14228b={'method':_0xf6fc('0x17'),'uri':_0x110f31+_0xf6fc('0x18')+_0xae3aef[_0xf6fc('0x16')]+'&'+_0x35d929+'&'+_0x435c36,'auth':_0x5f059c,'json':!![]};logger[_0xf6fc('0xe')]('['+[_0x8c1530['toUpperCase']()]+_0xf6fc('0x19'),_0x14228b);return rp(_0x14228b)[_0xf6fc('0xa')](function(_0x453e8a){logger['info']('['+[_0x8c1530['toUpperCase']()]+'],\x20getUser\x20entity',_0x453e8a);if(_0x453e8a['result'][_0xf6fc('0x1a')]>0x0&&String(_0x453e8a[_0xf6fc('0xb')][0x0]['active'])===_0xf6fc('0x1b')){_0xae3aef['userId']=_0x453e8a[_0xf6fc('0xb')][0x0][_0xf6fc('0xd')];}else{_0xae3aef['userId']=_0xae3aef['adminId'];_0xae3aef[_0xf6fc('0x16')]=_0xae3aef['adminEmail'];}logger[_0xf6fc('0xe')]('['+[_0x8c1530[_0xf6fc('0xf')]()]+_0xf6fc('0x1c'),_0xae3aef);_0x57296a(_0xae3aef);})['catch'](function(_0x3e58cf){logger[_0xf6fc('0x12')]('['+[_0x8c1530[_0xf6fc('0xf')]()]+']',_0x3e58cf[_0xf6fc('0x13')]);_0x15921c(_0x3e58cf[_0xf6fc('0x13')]);});}else{logger[_0xf6fc('0xe')]('['+[_0x8c1530[_0xf6fc('0xf')]()]+_0xf6fc('0x1d'));_0xae3aef[_0xf6fc('0x1e')]=_0xae3aef['adminId'];_0xae3aef[_0xf6fc('0x16')]=_0xae3aef['adminEmail'];_0x57296a(_0xae3aef);}});};}function createEndUser(_0x39cb0d,_0xd8a8ef,_0x3ff2b1,_0x230d1a,_0x3ba2c7){logger[_0xf6fc('0xe')]('['+[_0x39cb0d[_0xf6fc('0xf')]()]+'],\x20createEndUser\x20input\x20crm',_0x3ff2b1);return new Promise(function(_0x1678d5,_0x5b052b){var _0x1d36b0={'method':_0xf6fc('0x1f'),'uri':_0x230d1a+_0xf6fc('0x20')+_0x3ba2c7,'body':{'user_name':_0x3ff2b1[_0xf6fc('0x21')],'roles':_0xf6fc('0x22'),'first_name':_0x3ff2b1[_0xf6fc('0x21')],'active':_0xf6fc('0x1b'),'date_format':_0xf6fc('0x23'),'phone':_0x3ff2b1[_0xf6fc('0x21')]},'auth':_0xd8a8ef,'json':!![]};return rp(_0x1d36b0)[_0xf6fc('0xa')](function(_0x3e375e){logger[_0xf6fc('0xe')]('['+[_0x39cb0d[_0xf6fc('0xf')]()]+_0xf6fc('0x24'),_0x3e375e[_0xf6fc('0xb')]);_0x3ff2b1[_0xf6fc('0x25')]=_0x3e375e[_0xf6fc('0xb')][_0xf6fc('0xd')];_0x1678d5(_0x3ff2b1);})[_0xf6fc('0x11')](function(_0x314dac){logger[_0xf6fc('0x12')]('['+[_0x39cb0d[_0xf6fc('0xf')]()]+']',_0x314dac['message']);_0x5b052b(_0x314dac[_0xf6fc('0x13')]);});});}function getEndUser(_0x33a9d4,_0x3ab5d2,_0x489cf9,_0x5f1bfd,_0x16fd61){return function(_0x57192c){logger[_0xf6fc('0xe')]('['+[_0x33a9d4[_0xf6fc('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x57192c);return new Promise(function(_0x54dde0,_0x2eb138){var _0x39fe71={'method':_0xf6fc('0x17'),'uri':_0x489cf9+_0xf6fc('0x26')+_0x57192c['endUserNumber']+'&'+_0x5f1bfd+'&'+_0x16fd61,'auth':_0x3ab5d2,'json':!![]};return rp(_0x39fe71)[_0xf6fc('0xa')](function(_0x32cf25){if(_0x32cf25[_0xf6fc('0xb')][_0xf6fc('0x1a')]>0x0){_0x57192c[_0xf6fc('0x25')]=_0x32cf25[_0xf6fc('0xb')][0x0][_0xf6fc('0xd')];logger['info']('['+[_0x33a9d4[_0xf6fc('0xf')]()]+_0xf6fc('0x27'),_0x57192c);_0x54dde0(_0x57192c);}else{return createEndUser(_0x33a9d4,_0x3ab5d2,_0x57192c,_0x489cf9,_0x5f1bfd)[_0xf6fc('0xa')](function(_0x3a28a5){logger[_0xf6fc('0xe')]('['+[_0x33a9d4[_0xf6fc('0xf')]()]+_0xf6fc('0x28'),_0x3a28a5);_0x54dde0(_0x3a28a5);});}})[_0xf6fc('0x11')](function(_0x1a834d){logger[_0xf6fc('0x12')]('['+[_0x33a9d4['toUpperCase']()]+']',_0x1a834d['message']);_0x2eb138(_0x1a834d[_0xf6fc('0x13')]);});});};}function getCustomFields(_0x571e4f,_0x2a83db){var _0x6c318c={};if(_0x571e4f[_0xf6fc('0x1a')]>0x0){_[_0xf6fc('0x29')](_0x571e4f,function(_0x3e68df){if(_[_0xf6fc('0x2a')]([_0xf6fc('0x2b'),_0xf6fc('0x2c')],_0x3e68df[_0xf6fc('0x2d')])&&_0x3e68df['nameField']&&!_0x3e68df[_0xf6fc('0x2e')]){_0x6c318c[_0x3e68df[_0xf6fc('0x2f')][_0xf6fc('0x30')]()]=_0x3e68df[_0xf6fc('0x31')][_0xf6fc('0x32')]();}else if(_[_0xf6fc('0x2a')]([_0xf6fc('0x2b'),_0xf6fc('0x2c')],_0x3e68df[_0xf6fc('0x2d')])&&_0x3e68df['idField']&&_0x3e68df[_0xf6fc('0x2e')]){_0x6c318c[_0x3e68df['idField'][_0xf6fc('0x30')]()]=_0x3e68df[_0xf6fc('0x31')][_0xf6fc('0x32')]();}else if(_0x3e68df[_0xf6fc('0x2d')]==='variable'&&_0x3e68df[_0xf6fc('0x33')]&&_0x3e68df['idField']&&_0x3e68df[_0xf6fc('0x2e')]){_0x6c318c[_0x3e68df[_0xf6fc('0x34')]['toLowerCase']()]=_0x2a83db[_0x3e68df[_0xf6fc('0x33')]][_0xf6fc('0x32')]();}else if(_0x3e68df['type']===_0xf6fc('0x35')&&_0x3e68df['Variable']&&_0x3e68df['Variable'][_0xf6fc('0x36')]&&_0x3e68df[_0xf6fc('0x34')]&&_0x3e68df[_0xf6fc('0x2e')]){_0x6c318c[_0x3e68df[_0xf6fc('0x34')][_0xf6fc('0x30')]()]=_0x2a83db[_0x3e68df['Variable']['name'][_0xf6fc('0x30')]()]['toString']();}});}return _0x6c318c;}function getTicket(_0x4534aa,_0x41c39e,_0x5338ba,_0x498e66,_0x1e72cf,_0x3cb93f){return function(_0x4c91dd){logger[_0xf6fc('0xe')]('['+[_0x4534aa[_0xf6fc('0xf')]()]+_0xf6fc('0x37'),_0x4c91dd);return new Promise(function(_0x14d63b,_0x59d4fb){var _0x1d25bb=_0x4534aa[_0xf6fc('0x30')]()===_0xf6fc('0x38')?_0x4c91dd[_0xf6fc('0x1e')]:_0x4c91dd[_0xf6fc('0x25')];var _0x159dc4={'method':_0xf6fc('0x1f'),'uri':_0x5338ba+_0xf6fc('0x39')+'?'+_0x3cb93f,'body':Object[_0xf6fc('0x3a')]({},{'active':_0xf6fc('0x1b'),'caller_id':_0x1d25bb,'assigned_to':_0x4c91dd[_0xf6fc('0x1e')],'short_description':intUtil[_0xf6fc('0x3b')](_0x498e66['Subjects'],_0x1e72cf,'\x20'),'description':intUtil[_0xf6fc('0x3b')](_0x498e66[_0xf6fc('0x3c')],_0x1e72cf,'\x0a')},getCustomFields(_0x498e66[_0xf6fc('0x3d')],_0x1e72cf)),'auth':_0x41c39e,'json':!![]};return rp(_0x159dc4)['then'](function(_0x1fbd54){logger[_0xf6fc('0xe')]('['+[_0x4534aa[_0xf6fc('0xf')]()]+_0xf6fc('0x3e'),_0x1fbd54[_0xf6fc('0xb')]);_0x4c91dd[_0xf6fc('0x3f')]=_0x1fbd54[_0xf6fc('0xb')][_0xf6fc('0xd')];_0x4c91dd[_0xf6fc('0x40')]=_0x1fbd54['result'][_0xf6fc('0x41')];logger['info']('['+[_0x4534aa[_0xf6fc('0xf')]()]+_0xf6fc('0x42'),_0x4c91dd);_0x14d63b(_0x4c91dd);})[_0xf6fc('0x11')](function(_0x135f1e){logger[_0xf6fc('0x12')]('['+[_0x4534aa[_0xf6fc('0xf')]()]+']',_0x135f1e['message']);_0x59d4fb(_0x135f1e[_0xf6fc('0x13')]);});});};}function createRemoteTag(_0x39c47d,_0x46aa72,_0x34f0a6,_0x341c73){return new Promise(function(_0xd59b69,_0x5dff65){var _0x246e40={'method':_0xf6fc('0x1f'),'uri':_0x34f0a6+_0xf6fc('0x43')+'?'+_0x341c73,'body':{'short_description':_0x39c47d,'global':!![],'active':!![],'name':_0x39c47d},'auth':_0x46aa72,'json':!![]};return rp(_0x246e40)[_0xf6fc('0xa')](function(_0x3a6275){var _0x4f7c74=_0x3a6275[_0xf6fc('0xb')][_0xf6fc('0xd')];_0xd59b69(_0x4f7c74);});});}function getRemoteTag(_0x44dd0a,_0x59be79,_0x843194,_0x26acba,_0x31f798){return new Promise(function(_0x3ab925,_0x48d043){var _0x52f0a5={'method':_0xf6fc('0x17'),'uri':_0x843194+_0xf6fc('0x43')+_0xf6fc('0x44')+_0x44dd0a+'&'+_0x26acba,'auth':_0x59be79,'json':!![]};return rp(_0x52f0a5)[_0xf6fc('0xa')](function(_0x531669){if(_0x531669[_0xf6fc('0xb')]['length']>0x0){var _0x49c1bc=_0x531669[_0xf6fc('0xb')][0x0]['sys_id'];_0x3ab925(_0x49c1bc);}else{return createRemoteTag(_0x44dd0a,_0x59be79,_0x843194,_0x26acba)['then'](function(_0x4e6e41){_0x3ab925(_0x4e6e41);});}});});}function assignTagToIncident(_0x470721,_0x7cbbc9,_0x1c69a8,_0x1aceb2,_0x1cad34){return new Promise(function(_0x3aee23,_0x16eb01){var _0x484bd8={'method':'POST','uri':_0x1c69a8+'label_entry'+'?'+_0x1cad34,'body':{'label':_0x470721,'table':'incident','id_type':_0xf6fc('0x45'),'table_key':_0x1aceb2['ticketId'],'title':_0xf6fc('0x46')+_0x1aceb2['ticketNumber'],'id_display':_0x1aceb2[_0xf6fc('0x40')]},'auth':_0x7cbbc9,'json':!![]};return rp(_0x484bd8)[_0xf6fc('0xa')](function(_0x156588){_0x3aee23();})[_0xf6fc('0x11')](function(){_0x3aee23();});});}function manageTags(_0x30015c,_0x42c7c1,_0x2a98d9,_0x4adb4f,_0x45cf3f,_0x216302,_0x3e75ac){return new Promise(function(_0x52dfe9,_0x395a0){var _0x1b9b98=[];_0x42c7c1[_0xf6fc('0x29')](function(_0x37f53b){_0x1b9b98[_0xf6fc('0x47')](getRemoteTag(_0x37f53b,_0x2a98d9,_0x4adb4f,_0x216302,_0x3e75ac));});return Promise[_0xf6fc('0x48')](_0x1b9b98)['then'](function(_0x303501){if(_0x303501['length']){logger[_0xf6fc('0xe')]('['+[_0x30015c[_0xf6fc('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x303501);var _0x2c5ee1=[];_0x303501['forEach'](function(_0x4d9d1b){_0x2c5ee1[_0xf6fc('0x47')](assignTagToIncident(_0x4d9d1b,_0x2a98d9,_0x4adb4f,_0x45cf3f,_0x216302));});return Promise['all'](_0x2c5ee1)[_0xf6fc('0xa')](function(){_0x52dfe9();})[_0xf6fc('0x11')](function(){_0x52dfe9();});}else{_0x52dfe9();}});});}function getTags(_0x53787a,_0x12acf0,_0x3cbdd0,_0x46f3e3,_0x4df5a4,_0x43964d){return function(_0x4f603){return new Promise(function(_0x49c43f,_0x3bf2b4){var _0x242a7a=[];var _0x5ac2f5=_0x46f3e3[_0xf6fc('0x49')];if(_0x5ac2f5&&_0x5ac2f5[_0xf6fc('0x1a')]>0x0){_0x242a7a=_[_0xf6fc('0x4a')](_0x5ac2f5,_0xf6fc('0x36'));}if(_0x242a7a[_0xf6fc('0x1a')]>0x0){return manageTags(_0x53787a,_0x242a7a,_0x12acf0,_0x3cbdd0,_0x4f603,_0x4df5a4,_0x43964d)['then'](function(){_0x49c43f(_0x4f603);});}else{_0x49c43f(_0x4f603);}});};}function emit(_0x383552,_0x312227,_0x410895){var _0x5de4a6=_0xf6fc('0x4b')+_0xf6fc('0x4c')+_0xf6fc('0x4d')+_0xf6fc('0x4e');var _0x2bb21d={'uri':_0x383552+_0xf6fc('0x4f')+_0x410895+_0x5de4a6};io['to'](util[_0xf6fc('0x50')](_0xf6fc('0x51'),_0x312227))['emit'](_0xf6fc('0x52'),_0x2bb21d);}exports['cs']=function(_0x2a5e66,_0x296b7a,_0x40917e,_0x10fb5f,_0x422cc3,_0x2f01fd,_0x392fd7,_0x513fde){var _0x170a0f={};var _0x118996={'user':_0x2f01fd['username'],'pass':_0x2f01fd[_0xf6fc('0x53')]};var _0x5e5e12=_0xf6fc('0x54');var _0x50dee8='sysparm_display_value=true';_0x2f01fd[_0xf6fc('0x55')]=intUtil['stripTrailingSlash'](_0x2f01fd[_0xf6fc('0x55')]);_0x2f01fd[_0xf6fc('0x56')]=intUtil['stripTrailingSlash'](_0x2f01fd[_0xf6fc('0x56')]);var _0x5eac74=util['format'](_0xf6fc('0x57'),_0x2f01fd[_0xf6fc('0x55')]);_0x170a0f[_0xf6fc('0x16')]=!_[_0xf6fc('0x58')](_0x10fb5f)?_0x10fb5f[_0xf6fc('0x59')]:null;_0x170a0f[_0xf6fc('0x5a')]=_0x2f01fd[_0xf6fc('0x59')];_0x170a0f[_0xf6fc('0x21')]=_0x513fde[_0xf6fc('0x30')]()===_0xf6fc('0x38')?_0x296b7a[_0xf6fc('0x5b')]:_0x296b7a[_0xf6fc('0x5c')];_0x170a0f[_0xf6fc('0x5d')]=_0x513fde==='queue'||_0x513fde===_0xf6fc('0x5e')?'queue':_0xf6fc('0x38');var _0x15d484=util[_0xf6fc('0x50')](_0xf6fc('0x5f'),_0x2f01fd['serverUrl'],_0x296b7a[_0xf6fc('0x60')],md5(_0x296b7a[_0xf6fc('0x60')]));if(_0x422cc3&&_0x422cc3[_0xf6fc('0x61')]){logger[_0xf6fc('0xe')](_0xf6fc('0x62'),'Recording\x20is\x20enabled!');_0x296b7a[_0xf6fc('0x63')]=_0x15d484;}else if(_0x392fd7&&_0x392fd7[_0xf6fc('0x64')]&&_0x392fd7[_0xf6fc('0x64')]!==_0xf6fc('0x65')){logger[_0xf6fc('0xe')](_0xf6fc('0x66'),_0xf6fc('0x67'));_0x296b7a[_0xf6fc('0x63')]=_0x15d484;}else{_0x296b7a[_0xf6fc('0x63')]='';}return getAdminUser(_0x513fde,_0x118996,_0x170a0f,_0x5eac74,_0x50dee8,_0x5e5e12)[_0xf6fc('0xa')](getUser(_0x513fde,_0x118996,_0x5eac74,_0x50dee8,_0x5e5e12))['then'](getEndUser(_0x513fde,_0x118996,_0x5eac74,_0x50dee8,_0x5e5e12))['then'](getTicket(_0x513fde,_0x118996,_0x5eac74,_0x40917e,_0x296b7a,_0x50dee8))['then'](function(_0x221e69){logger[_0xf6fc('0xe')](util[_0xf6fc('0x50')](_0xf6fc('0x68'),_0x221e69['ticketId']));logger[_0xf6fc('0xe')](util[_0xf6fc('0x50')](_0xf6fc('0x69'),_0x513fde));if(_0x513fde!=='unmanaged'){logger[_0xf6fc('0xe')]('['+[_0x513fde[_0xf6fc('0xf')]()]+']',_0xf6fc('0x6a'));emit(_0x2f01fd[_0xf6fc('0x55')],_0x10fb5f[_0xf6fc('0x36')],_0x221e69['ticketId']);}})['catch'](function(_0x266213){logger[_0xf6fc('0x12')]('['+[_0x513fde[_0xf6fc('0xf')]()]+_0xf6fc('0x6b'),util['inspect'](_0x266213,{'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 68de939..ff46afe 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 _0xb417=['value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','variable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','serverUrl','uri','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','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','trigger:browser:url','catch','stripTrailingSlash','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','contacts','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','unmanaged','%s/service/v4_1/rest.php','monitor_format','lastevent','toUpperCase','Inbound','error','lodash','request-promise','bluebird','md5','util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','created_by','description','Descriptions','date_start','slice','duration_hours','duration_minutes','parent_type','Contacts','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','entry_list','user_name','name_value_list'];(function(_0x4babeb,_0x28aaa){var _0x40bc6f=function(_0x29559e){while(--_0x29559e){_0x4babeb['push'](_0x4babeb['shift']());}};_0x40bc6f(++_0x28aaa);}(_0xb417,0xb9));var _0x7b41=function(_0x3c3b81,_0x3bd581){_0x3c3b81=_0x3c3b81-0x0;var _0x5a1daa=_0xb417[_0x3c3b81];return _0x5a1daa;};'use strict';var _=require(_0x7b41('0x0'));var rp=require(_0x7b41('0x1'));var BPromise=require(_0x7b41('0x2'));var md5=require(_0x7b41('0x3'));var util=require(_0x7b41('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x7b41('0x5'));var logger=require('../../../../config/logger')(_0x7b41('0x6'));config[_0x7b41('0x7')]=_[_0x7b41('0x8')](config[_0x7b41('0x7')],{'host':_0x7b41('0x9'),'port':0x18eb});var io=require(_0x7b41('0xa'))(new Redis(config['redis']));var def={'method':_0x7b41('0xb'),'json':!![]};function emit(_0x39e786,_0x564689,_0x5c222e){io['to'](_0x39e786)[_0x7b41('0xc')](_0x564689,_0x5c222e);}function getTicket(_0x168df9,_0xe3bfe8,_0x557543,_0x739203,_0x1c5698,_0x4d6391,_0x1a180e,_0x421e84){logger[_0x7b41('0xd')](_0x7b41('0xe'));var _0x163121=new Date();var _0xc4f02f=[{'name':'name','value':intUtil[_0x7b41('0xf')](_0x739203['Subjects'],_0x1c5698,'\x20')},{'name':'assigned_user_id','value':_0xe3bfe8['id']},{'name':_0x7b41('0x10'),'value':_0xe3bfe8['id']},{'name':_0x7b41('0x11'),'value':intUtil[_0x7b41('0xf')](_0x739203[_0x7b41('0x12')],_0x1c5698,'\x0a')},{'name':_0x7b41('0x13'),'value':_0x163121['toISOString']()[_0x7b41('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x7b41('0x15'),'value':'0'},{'name':_0x7b41('0x16'),'value':'15'},{'name':'parent_id','value':_0x557543['id']},{'name':_0x7b41('0x17'),'value':_0x7b41('0x18')},{'name':_0x7b41('0x19'),'value':_0x557543['name']},{'name':'direction','value':_0x421e84}];if(_0x4d6391[_0x7b41('0x1a')]){_[_0x7b41('0x1b')](_0x4d6391,function(_0x35e1ee){if(_0x1c5698[_0x35e1ee[_0x7b41('0x1c')]]){_0xc4f02f[_0x7b41('0x1d')]({'name':_0x35e1ee[_0x7b41('0x1e')],'value':_0x1c5698[_0x35e1ee['variableName']]});}});}return request({'form':{'method':_0x7b41('0x1f'),'input_type':'JSON','response_type':_0x7b41('0x20'),'rest_data':JSON[_0x7b41('0x21')]({'session':_0x1a180e['id'],'module_name':_0x7b41('0x22'),'name_value_list':_0xc4f02f})}});}function getAuth(_0x4a40b3){return util[_0x7b41('0x23')](_0x7b41('0x24'),new Buffer(_0x4a40b3[_0x7b41('0x25')]+':X')['toString']('base64'));}function getServerInfo(_0x41bcf7){return request({'form':{'method':_0x7b41('0x26'),'input_type':_0x7b41('0x20'),'response_type':_0x7b41('0x20'),'rest_data':JSON[_0x7b41('0x21')]({'session':_0x41bcf7['id']})}});}function getUser(_0x354068,_0x1e092f,_0x531ef9){if(!_[_0x7b41('0x27')](_0x1e092f)){logger[_0x7b41('0xd')](_0x7b41('0x28'),_0x1e092f);return request({'form':{'method':_0x7b41('0x29'),'input_type':_0x7b41('0x20'),'response_type':'JSON','rest_data':JSON[_0x7b41('0x21')]({'session':_0x531ef9['id'],'module_name':'Employees','query':util['format'](_0x7b41('0x2a'),_0x1e092f),'order_by':'','offset':'0','select_fields':['id',_0x7b41('0x2b'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3cd690){if(_0x3cd690['entry_list']['length']){var _0x16f2e7=_['find'](_0x3cd690[_0x7b41('0x2c')],function(_0x4776dd){return _0x4776dd['name_value_list'][_0x7b41('0x2d')]['value']===_0x1e092f;});if(_0x16f2e7){logger['info']('Agent\x20found!');return BPromise['resolve']({'id':_0x16f2e7[_0x7b41('0x2e')]['id'][_0x7b41('0x2f')],'name':_0x16f2e7['name_value_list'][_0x7b41('0x2b')]['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x531ef9[_0x7b41('0x2e')]['user_id'][_0x7b41('0x2f')],'name':_0x531ef9['name_value_list'][_0x7b41('0x2d')][_0x7b41('0x2f')]});});}else{logger[_0x7b41('0xd')](_0x7b41('0x30'));return BPromise[_0x7b41('0x31')]({'id':_0x531ef9[_0x7b41('0x2e')][_0x7b41('0x32')][_0x7b41('0x2f')],'name':_0x531ef9['name_value_list'][_0x7b41('0x2d')][_0x7b41('0x2f')]});}}function getEndUser(_0x59dcf6,_0x2a1988,_0x265b0e,_0x555f16){logger[_0x7b41('0xd')]('Searching\x20enduser\x20with\x20phone',_0x265b0e);return request({'form':{'method':_0x7b41('0x29'),'input_type':_0x7b41('0x20'),'response_type':_0x7b41('0x20'),'rest_data':JSON[_0x7b41('0x21')]({'session':_0x555f16['id'],'module_name':_0x7b41('0x18'),'query':util[_0x7b41('0x23')](_0x7b41('0x33'),_0x265b0e),'order_by':'','offset':'0','select_fields':['id',_0x7b41('0x2b'),_0x7b41('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x14f2a6){if(_0x14f2a6[_0x7b41('0x2c')][_0x7b41('0x1a')]){var _0x104097=_['find'](_0x14f2a6[_0x7b41('0x2c')],function(_0x3b83d9){return _0x3b83d9[_0x7b41('0x2e')][_0x7b41('0x34')][_0x7b41('0x2f')]===_0x265b0e;});if(_0x104097){logger['info'](_0x7b41('0x35'));return BPromise['resolve']({'id':_0x104097['name_value_list']['id'][_0x7b41('0x2f')],'name':_0x104097['name_value_list'][_0x7b41('0x2b')][_0x7b41('0x2f')],'phone':_0x104097[_0x7b41('0x2e')][_0x7b41('0x34')]['value']});}}else{logger[_0x7b41('0xd')](_0x7b41('0x36'));return request({'form':{'method':_0x7b41('0x1f'),'input_type':_0x7b41('0x20'),'response_type':_0x7b41('0x20'),'rest_data':JSON[_0x7b41('0x21')]({'session':_0x555f16['id'],'module_name':'Contacts','name_value_list':[{'name':_0x7b41('0x37'),'value':_0x2a1988!==_0x7b41('0x38')?_0x2a1988:util['format'](_0x7b41('0x39'),_0x265b0e)},{'name':'phone_home','value':_0x265b0e}]})}})[_0x7b41('0x3a')](function(_0x2d6546){logger[_0x7b41('0xd')](_0x7b41('0x3b'));return BPromise[_0x7b41('0x31')]({'id':_0x2d6546['id'],'name':_0x2d6546[_0x7b41('0x2c')][_0x7b41('0x37')][_0x7b41('0x2f')],'phone':_0x2d6546[_0x7b41('0x2c')]['phone_home']['value']});});}});}function request(_0x4197c3){logger[_0x7b41('0x3c')](_0x7b41('0x3d'),JSON[_0x7b41('0x21')](_0x4197c3));return rp(_['merge'](def,_0x4197c3));}function getTags(_0x471210,_0x144805){var _0xeb8b8f=[];if(_0x471210&&_0x471210[_0x7b41('0x1a')]>0x0){_0xeb8b8f=_[_0x7b41('0x3e')](_0x471210,_0x144805);}return _0xeb8b8f;}function getCustomFields(_0x3b0a0d,_0x3bb389){var _0x59cd4f=[];var _0x3a3c56={'custom_fields':[]};if(_0x3b0a0d['length']>0x0){_[_0x7b41('0x1b')](_0x3b0a0d,function(_0x145daa){if(_0x145daa[_0x7b41('0x3f')]===_0x7b41('0x40')&&_0x145daa[_0x7b41('0x41')]&&!_0x145daa[_0x7b41('0x42')]){_0x3a3c56[_0x145daa[_0x7b41('0x41')][_0x7b41('0x43')]()]=_0x145daa[_0x7b41('0x44')][_0x7b41('0x45')]();}else if(_0x145daa[_0x7b41('0x3f')]===_0x7b41('0x40')&&_0x145daa['idField']&&_0x145daa[_0x7b41('0x42')]){_0x3a3c56[_0x7b41('0x46')][_0x7b41('0x1d')]({'id':_0x145daa['idField'],'value':_0x145daa[_0x7b41('0x44')]['toString']()});}else if(_0x145daa[_0x7b41('0x3f')]===_0x7b41('0x47')&&_0x145daa[_0x7b41('0x1c')]&&_0x145daa['idField']&&_0x145daa[_0x7b41('0x42')]){_0x3bb389[_0x145daa['variableName']]&&_0x3a3c56[_0x7b41('0x46')][_0x7b41('0x1d')]({'id':_0x145daa[_0x7b41('0x1e')],'value':_0x3bb389[_0x145daa[_0x7b41('0x1c')]][_0x7b41('0x45')]()});}else if(_0x145daa[_0x7b41('0x3f')]==='customVariable'&&_0x145daa[_0x7b41('0x48')]&&_0x145daa[_0x7b41('0x48')][_0x7b41('0x2b')]&&_0x145daa['idField']&&_0x145daa[_0x7b41('0x42')]){_0x3bb389[_0x145daa['Variable'][_0x7b41('0x2b')][_0x7b41('0x43')]()]&&_0x3a3c56[_0x7b41('0x46')][_0x7b41('0x1d')]({'id':_0x145daa['idField'],'value':_0x3bb389[_0x145daa['Variable']['name'][_0x7b41('0x43')]()]['toString']()});}});}return _0x3a3c56;}function getConnection(_0x3604bf){return request({'method':'POST','form':{'method':_0x7b41('0x49'),'input_type':_0x7b41('0x20'),'response_type':_0x7b41('0x20'),'rest_data':JSON[_0x7b41('0x21')]({'user_auth':{'user_name':_0x3604bf[_0x7b41('0x4a')],'password':_0x3604bf['password'],'encryption':_0x7b41('0x4b')},'application':_0x7b41('0x4c')})}})['then'](function(_0x47d5c2){var _0x38647d=_0x47d5c2;if(_0x38647d['id']){def[_0x7b41('0x4d')]=_0x38647d['id'];return BPromise[_0x7b41('0x31')](_0x38647d);}else{throw new Error(util[_0x7b41('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x3604bf['id']));}});}function setRelationship(_0x560145,_0x19f04f,_0x551613,_0x11a1e5){return request({'form':{'method':_0x7b41('0x4e'),'input_type':_0x7b41('0x20'),'response_type':_0x7b41('0x20'),'rest_data':JSON[_0x7b41('0x21')]({'session':_0x560145['id'],'module_name':_0x7b41('0x22'),'module_id':_0x551613['id'],'link_field_name':_0x11a1e5,'related_ids':[_0x19f04f['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x423069,_0x35f8d3,_0xfd7de0,_0x27564b,_0x2acaf0,_0x1ea16b){var _0x584a0b,_0x54f543,_0x141d5b,_0x5bcb5a;_0x1ea16b['remoteUri']=intUtil['stripTrailingSlash'](_0x1ea16b['remoteUri']);_0x1ea16b[_0x7b41('0x4f')]=intUtil['stripTrailingSlash'](_0x1ea16b['serverUrl']);def[_0x7b41('0x50')]=util[_0x7b41('0x23')]('%s/service/v4_1/rest.php',_0x1ea16b[_0x7b41('0x51')]);if(_0x2acaf0&&_0x2acaf0['monitor_format']){logger[_0x7b41('0xd')](_0x7b41('0x52'),_0x7b41('0x53'));_0x35f8d3[_0x7b41('0x54')]=util[_0x7b41('0x23')](_0x7b41('0x55'),_0x1ea16b[_0x7b41('0x4f')],_0x35f8d3[_0x7b41('0x56')],md5(_0x35f8d3[_0x7b41('0x56')]));}else{_0x35f8d3['recordingURL']='';}return getConnection(_0x1ea16b)['then'](function(_0xc91908){_0x5bcb5a=_0xc91908;return getUser(_0x1ea16b,_0x27564b[_0x7b41('0x2b')],_0x5bcb5a);})['then'](function(_0x3b200a){_0x584a0b=_0x3b200a;logger[_0x7b41('0xd')](_0x7b41('0x57'),_0x584a0b['id']);return getEndUser(_0x1ea16b,_0x35f8d3[_0x7b41('0x58')],_0x35f8d3[_0x7b41('0x59')],_0x5bcb5a);})[_0x7b41('0x3a')](function(_0x112e96){_0x54f543=_0x112e96;logger[_0x7b41('0xd')](_0x7b41('0x5a'),_0x54f543['id']);return getTicket(_0x1ea16b,_0x584a0b,_0x54f543,_0xfd7de0,_0x35f8d3,_0xfd7de0['Fields'],_0x5bcb5a,'Inbound');})[_0x7b41('0x3a')](function(_0xe3eb28){_0x141d5b=_0xe3eb28;logger[_0x7b41('0xd')](_0x7b41('0x5b'));logger[_0x7b41('0xd')](_0x7b41('0x5c'),_0x141d5b['id']);return setRelationship(_0x5bcb5a,_0x584a0b,_0x141d5b,_0x7b41('0x5d'));})[_0x7b41('0x3a')](function(){return setRelationship(_0x5bcb5a,_0x54f543,_0x141d5b,'contacts');})[_0x7b41('0x3a')](function(){return getServerInfo(_0x5bcb5a);})[_0x7b41('0x3a')](function(_0x3dd544){var _0x46ac80=parseInt(_0x3dd544['version'][_0x7b41('0x5e')](0x0));var _0x466b63=util['format'](_0x7b41('0x5f'),_0x1ea16b['remoteUri'],_0x141d5b['id']);if(_0x46ac80>0x6){_0x466b63=util[_0x7b41('0x23')](_0x7b41('0x60'),_0x1ea16b[_0x7b41('0x51')],_0x141d5b['id']);}logger['info'](_0x7b41('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7b41('0x23')]('user:%s',_0x27564b['name']),_0x7b41('0x61'),{'uri':_0x466b63});})[_0x7b41('0x62')](function(_0x2ec3cb){logger['error'](_0x7b41('0x52'),JSON[_0x7b41('0x21')](_0x2ec3cb));});};exports['outbound']=function(_0x5b64c3,_0x3b184f,_0x2ec05b,_0x47b796,_0x23b1d7,_0xf31ffe,_0x2a8b26){var _0x46615f,_0x57dc23,_0x158278,_0x55269e;_0xf31ffe[_0x7b41('0x51')]=intUtil[_0x7b41('0x63')](_0xf31ffe[_0x7b41('0x51')]);_0xf31ffe[_0x7b41('0x4f')]=intUtil[_0x7b41('0x63')](_0xf31ffe[_0x7b41('0x4f')]);def[_0x7b41('0x50')]=util[_0x7b41('0x23')]('%s/service/v4_1/rest.php',_0xf31ffe['remoteUri']);if(_0x2a8b26&&_0x2a8b26['recordingFormat']&&_0x2a8b26['recordingFormat']!==_0x7b41('0x64')){logger['info'](_0x7b41('0x65'),_0x7b41('0x53'));_0x3b184f[_0x7b41('0x54')]=util[_0x7b41('0x23')](_0x7b41('0x55'),_0xf31ffe['serverUrl'],_0x3b184f[_0x7b41('0x56')],md5(_0x3b184f[_0x7b41('0x56')]));}return getConnection(_0xf31ffe)[_0x7b41('0x3a')](function(_0x295936){_0x55269e=_0x295936;return getUser(_0xf31ffe,_0x47b796['name'],_0x55269e);})[_0x7b41('0x3a')](function(_0x155f84){_0x46615f=_0x155f84;logger[_0x7b41('0xd')](_0x7b41('0x57'),_0x46615f['id']);return getEndUser(_0xf31ffe,_0x3b184f[_0x7b41('0x66')],_0x3b184f[_0x7b41('0x67')],_0x55269e);})[_0x7b41('0x3a')](function(_0x385485){_0x57dc23=_0x385485;logger[_0x7b41('0xd')](_0x7b41('0x5a'),_0x57dc23['id']);return getTicket(_0xf31ffe,_0x46615f,_0x57dc23,_0x2ec05b,_0x3b184f,_0x2ec05b[_0x7b41('0x68')],_0x55269e,'Outbound');})['then'](function(_0x5e647b){_0x158278=_0x5e647b;logger[_0x7b41('0xd')](_0x7b41('0x5b'));logger['info'](_0x7b41('0x5c'),_0x158278['id']);return setRelationship(_0x55269e,_0x46615f,_0x158278,_0x7b41('0x5d'));})[_0x7b41('0x3a')](function(){return setRelationship(_0x55269e,_0x57dc23,_0x158278,_0x7b41('0x69'));})[_0x7b41('0x3a')](function(){return getServerInfo(_0x55269e);})[_0x7b41('0x3a')](function(_0xe4dcbe){var _0x594f25=parseInt(_0xe4dcbe[_0x7b41('0x6a')][_0x7b41('0x5e')](0x0));var _0x32ddce=util['format'](_0x7b41('0x5f'),_0xf31ffe[_0x7b41('0x51')],_0x158278['id']);if(_0x594f25>0x6){_0x32ddce=util[_0x7b41('0x23')](_0x7b41('0x60'),_0xf31ffe['remoteUri'],_0x158278['id']);}logger[_0x7b41('0xd')](_0x7b41('0x65'),_0x7b41('0x6b'));emit(util[_0x7b41('0x23')](_0x7b41('0x6c'),_0x47b796['name']),_0x7b41('0x61'),{'uri':_0x32ddce});})['catch'](function(_0x24e0e8){logger['error'](_0x7b41('0x65'),JSON[_0x7b41('0x21')](_0x24e0e8));});};exports[_0x7b41('0x6d')]=function(_0x227617,_0x81f75c,_0x41cd18,_0x2bfb12,_0xb10199,_0x1ef820){var _0x48e01b,_0x3b09b8,_0x11eee4,_0x18d6dd;_0x1ef820['remoteUri']=intUtil[_0x7b41('0x63')](_0x1ef820['remoteUri']);_0x1ef820[_0x7b41('0x4f')]=intUtil[_0x7b41('0x63')](_0x1ef820[_0x7b41('0x4f')]);def[_0x7b41('0x50')]=util[_0x7b41('0x23')](_0x7b41('0x6e'),_0x1ef820['remoteUri']);if(_0xb10199&&_0xb10199[_0x7b41('0x6f')]){logger[_0x7b41('0xd')]('['+_0x81f75c[_0x7b41('0x70')][_0x7b41('0x71')]()+']',_0x7b41('0x53'));_0x81f75c[_0x7b41('0x54')]=util[_0x7b41('0x23')](_0x7b41('0x55'),_0x1ef820[_0x7b41('0x4f')],_0x81f75c[_0x7b41('0x56')],md5(_0x81f75c['uniqueid']));}else{_0x81f75c['recordingURL']='';}return getConnection(_0x1ef820)[_0x7b41('0x3a')](function(_0xc0e7c0){_0x18d6dd=_0xc0e7c0;if(!_['isNil'](_0x2bfb12)){return getUser(_0x1ef820,_0x2bfb12['name'],_0x18d6dd);}else{return getUser(_0x1ef820,null,_0x18d6dd);}})[_0x7b41('0x3a')](function(_0xaf17eb){_0x48e01b=_0xaf17eb;logger[_0x7b41('0xd')](_0x7b41('0x57'),_0x48e01b['id']);return getEndUser(_0x1ef820,_0x81f75c[_0x7b41('0x58')],_0x81f75c[_0x7b41('0x59')],_0x18d6dd);})[_0x7b41('0x3a')](function(_0x48d401){_0x3b09b8=_0x48d401;logger['info'](_0x7b41('0x5a'),_0x3b09b8['id']);return getTicket(_0x1ef820,_0x48e01b,_0x3b09b8,_0x41cd18,_0x81f75c,_0x41cd18[_0x7b41('0x68')],_0x18d6dd,_0x7b41('0x72'));})['then'](function(_0x539cc2){_0x11eee4=_0x539cc2;logger[_0x7b41('0xd')](_0x7b41('0x5b'));logger[_0x7b41('0xd')](_0x7b41('0x5c'),_0x11eee4['id']);return setRelationship(_0x18d6dd,_0x48e01b,_0x11eee4,'users');})[_0x7b41('0x3a')](function(){return setRelationship(_0x18d6dd,_0x3b09b8,_0x11eee4,_0x7b41('0x69'));})[_0x7b41('0x3a')](function(){return getServerInfo(_0x18d6dd);})[_0x7b41('0x62')](function(_0x4aef09){logger[_0x7b41('0x73')]('['+_0x81f75c[_0x7b41('0x70')][_0x7b41('0x71')]()+']',JSON[_0x7b41('0x21')](_0x4aef09));});}; \ No newline at end of file +var _0xa8de=['Inbound','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','info','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','Agent\x20found!','resolve','value','user_id','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','custom_fields','Variable','push','login','username','password','PLAIN','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','[QUEUE]','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','users','unmanaged','monitor_format','lastevent','toUpperCase','calleridname'];(function(_0x380fa1,_0x41625e){var _0x5aba16=function(_0x3986c5){while(--_0x3986c5){_0x380fa1['push'](_0x380fa1['shift']());}};_0x5aba16(++_0x41625e);}(_0xa8de,0xfd));var _0xea8d=function(_0x2d52c2,_0x578fdf){_0x2d52c2=_0x2d52c2-0x0;var _0x1ddabe=_0xa8de[_0x2d52c2];return _0x1ddabe;};'use strict';var _=require(_0xea8d('0x0'));var rp=require(_0xea8d('0x1'));var BPromise=require(_0xea8d('0x2'));var md5=require(_0xea8d('0x3'));var util=require(_0xea8d('0x4'));var Redis=require(_0xea8d('0x5'));var intUtil=require(_0xea8d('0x6'));var config=require(_0xea8d('0x7'));var logger=require(_0xea8d('0x8'))(_0xea8d('0x9'));config[_0xea8d('0xa')]=_[_0xea8d('0xb')](config[_0xea8d('0xa')],{'host':_0xea8d('0xc'),'port':0x18eb});var io=require(_0xea8d('0xd'))(new Redis(config[_0xea8d('0xa')]));var def={'method':_0xea8d('0xe'),'json':!![]};function emit(_0x18eabf,_0x175848,_0x243a10){io['to'](_0x18eabf)[_0xea8d('0xf')](_0x175848,_0x243a10);}function getTicket(_0x1cce4b,_0x4aff19,_0x23a5bb,_0xdec24e,_0x14b233,_0x1733eb,_0x16dec6,_0x163e74){logger['info'](_0xea8d('0x10'));var _0x258a53=new Date();var _0xdfdf9e=[{'name':_0xea8d('0x11'),'value':intUtil['getString'](_0xdec24e[_0xea8d('0x12')],_0x14b233,'\x20')},{'name':_0xea8d('0x13'),'value':_0x4aff19['id']},{'name':_0xea8d('0x14'),'value':_0x4aff19['id']},{'name':_0xea8d('0x15'),'value':intUtil[_0xea8d('0x16')](_0xdec24e[_0xea8d('0x17')],_0x14b233,'\x0a')},{'name':_0xea8d('0x18'),'value':_0x258a53[_0xea8d('0x19')]()[_0xea8d('0x1a')](0x0,0x13)[_0xea8d('0x1b')]('T','\x20')},{'name':_0xea8d('0x1c'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xea8d('0x1d'),'value':_0x23a5bb['id']},{'name':_0xea8d('0x1e'),'value':_0xea8d('0x1f')},{'name':_0xea8d('0x20'),'value':_0x23a5bb[_0xea8d('0x11')]},{'name':_0xea8d('0x21'),'value':_0x163e74}];if(_0x1733eb[_0xea8d('0x22')]){_[_0xea8d('0x23')](_0x1733eb,function(_0xaeec69){if(_0x14b233[_0xaeec69[_0xea8d('0x24')]]){_0xdfdf9e['push']({'name':_0xaeec69[_0xea8d('0x25')],'value':_0x14b233[_0xaeec69['variableName']]});}});}return request({'form':{'method':_0xea8d('0x26'),'input_type':_0xea8d('0x27'),'response_type':_0xea8d('0x27'),'rest_data':JSON[_0xea8d('0x28')]({'session':_0x16dec6['id'],'module_name':_0xea8d('0x29'),'name_value_list':_0xdfdf9e})}});}function getAuth(_0x12d76b){return util[_0xea8d('0x2a')](_0xea8d('0x2b'),new Buffer(_0x12d76b[_0xea8d('0x2c')]+':X')[_0xea8d('0x2d')]('base64'));}function getServerInfo(_0x17f3fd){return request({'form':{'method':_0xea8d('0x2e'),'input_type':_0xea8d('0x27'),'response_type':_0xea8d('0x27'),'rest_data':JSON['stringify']({'session':_0x17f3fd['id']})}});}function getUser(_0x297ea0,_0x3d95d,_0x127bc0){if(!_[_0xea8d('0x2f')](_0x3d95d)){logger[_0xea8d('0x30')]('Getting\x20agent\x20with\x20name',_0x3d95d);return request({'form':{'method':'get_entry_list','input_type':_0xea8d('0x27'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x127bc0['id'],'module_name':_0xea8d('0x31'),'query':util[_0xea8d('0x2a')](_0xea8d('0x32'),_0x3d95d),'order_by':'','offset':'0','select_fields':['id',_0xea8d('0x11'),_0xea8d('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3ce99c){if(_0x3ce99c[_0xea8d('0x34')][_0xea8d('0x22')]){var _0x3d8e9d=_['find'](_0x3ce99c[_0xea8d('0x34')],function(_0x3a5f56){return _0x3a5f56[_0xea8d('0x35')][_0xea8d('0x33')]['value']===_0x3d95d;});if(_0x3d8e9d){logger[_0xea8d('0x30')](_0xea8d('0x36'));return BPromise[_0xea8d('0x37')]({'id':_0x3d8e9d[_0xea8d('0x35')]['id'][_0xea8d('0x38')],'name':_0x3d8e9d[_0xea8d('0x35')][_0xea8d('0x11')][_0xea8d('0x38')]});}}logger[_0xea8d('0x30')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xea8d('0x37')]({'id':_0x127bc0[_0xea8d('0x35')]['user_id'][_0xea8d('0x38')],'name':_0x127bc0[_0xea8d('0x35')][_0xea8d('0x33')][_0xea8d('0x38')]});});}else{logger[_0xea8d('0x30')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x127bc0[_0xea8d('0x35')][_0xea8d('0x39')][_0xea8d('0x38')],'name':_0x127bc0[_0xea8d('0x35')][_0xea8d('0x33')]['value']});}}function getEndUser(_0x36346d,_0xdf0c10,_0x473171,_0x497e53){logger[_0xea8d('0x30')]('Searching\x20enduser\x20with\x20phone',_0x473171);return request({'form':{'method':_0xea8d('0x3a'),'input_type':_0xea8d('0x27'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x497e53['id'],'module_name':_0xea8d('0x1f'),'query':util[_0xea8d('0x2a')](_0xea8d('0x3b'),_0x473171),'order_by':'','offset':'0','select_fields':['id',_0xea8d('0x11'),_0xea8d('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x19a950){if(_0x19a950['entry_list'][_0xea8d('0x22')]){var _0x2ae2ac=_[_0xea8d('0x3d')](_0x19a950[_0xea8d('0x34')],function(_0x52a991){return _0x52a991[_0xea8d('0x35')]['phone_home'][_0xea8d('0x38')]===_0x473171;});if(_0x2ae2ac){logger[_0xea8d('0x30')](_0xea8d('0x3e'));return BPromise[_0xea8d('0x37')]({'id':_0x2ae2ac[_0xea8d('0x35')]['id']['value'],'name':_0x2ae2ac[_0xea8d('0x35')][_0xea8d('0x11')][_0xea8d('0x38')],'phone':_0x2ae2ac[_0xea8d('0x35')][_0xea8d('0x3c')][_0xea8d('0x38')]});}}else{logger['info'](_0xea8d('0x3f'));return request({'form':{'method':_0xea8d('0x26'),'input_type':_0xea8d('0x27'),'response_type':'JSON','rest_data':JSON[_0xea8d('0x28')]({'session':_0x497e53['id'],'module_name':_0xea8d('0x1f'),'name_value_list':[{'name':_0xea8d('0x40'),'value':_0xdf0c10!==_0xea8d('0x41')?_0xdf0c10:util[_0xea8d('0x2a')](_0xea8d('0x42'),_0x473171)},{'name':'phone_home','value':_0x473171}]})}})[_0xea8d('0x43')](function(_0x3574e9){logger[_0xea8d('0x30')](_0xea8d('0x44'));return BPromise[_0xea8d('0x37')]({'id':_0x3574e9['id'],'name':_0x3574e9[_0xea8d('0x34')][_0xea8d('0x40')]['value'],'phone':_0x3574e9[_0xea8d('0x34')][_0xea8d('0x3c')][_0xea8d('0x38')]});});}});}function request(_0x3b231a){logger[_0xea8d('0x45')](_0xea8d('0x46'),JSON['stringify'](_0x3b231a));return rp(_[_0xea8d('0x47')](def,_0x3b231a));}function getTags(_0x377cb7,_0x200614){var _0x5c8ff4=[];if(_0x377cb7&&_0x377cb7['length']>0x0){_0x5c8ff4=_['map'](_0x377cb7,_0x200614);}return _0x5c8ff4;}function getCustomFields(_0x3f440e,_0x324ec4){var _0x26abdf=[];var _0x22cb4e={'custom_fields':[]};if(_0x3f440e['length']>0x0){_[_0xea8d('0x23')](_0x3f440e,function(_0x5e9efc){if(_0x5e9efc[_0xea8d('0x48')]===_0xea8d('0x49')&&_0x5e9efc[_0xea8d('0x4a')]&&!_0x5e9efc[_0xea8d('0x4b')]){_0x22cb4e[_0x5e9efc['nameField'][_0xea8d('0x4c')]()]=_0x5e9efc[_0xea8d('0x4d')][_0xea8d('0x2d')]();}else if(_0x5e9efc[_0xea8d('0x48')]===_0xea8d('0x49')&&_0x5e9efc[_0xea8d('0x25')]&&_0x5e9efc[_0xea8d('0x4b')]){_0x22cb4e[_0xea8d('0x4e')]['push']({'id':_0x5e9efc[_0xea8d('0x25')],'value':_0x5e9efc[_0xea8d('0x4d')]['toString']()});}else if(_0x5e9efc[_0xea8d('0x48')]==='variable'&&_0x5e9efc[_0xea8d('0x24')]&&_0x5e9efc[_0xea8d('0x25')]&&_0x5e9efc['customField']){_0x324ec4[_0x5e9efc['variableName']]&&_0x22cb4e[_0xea8d('0x4e')]['push']({'id':_0x5e9efc[_0xea8d('0x25')],'value':_0x324ec4[_0x5e9efc['variableName']]['toString']()});}else if(_0x5e9efc[_0xea8d('0x48')]==='customVariable'&&_0x5e9efc[_0xea8d('0x4f')]&&_0x5e9efc[_0xea8d('0x4f')][_0xea8d('0x11')]&&_0x5e9efc['idField']&&_0x5e9efc[_0xea8d('0x4b')]){_0x324ec4[_0x5e9efc['Variable'][_0xea8d('0x11')][_0xea8d('0x4c')]()]&&_0x22cb4e[_0xea8d('0x4e')][_0xea8d('0x50')]({'id':_0x5e9efc[_0xea8d('0x25')],'value':_0x324ec4[_0x5e9efc[_0xea8d('0x4f')][_0xea8d('0x11')][_0xea8d('0x4c')]()][_0xea8d('0x2d')]()});}});}return _0x22cb4e;}function getConnection(_0x439e87){return request({'method':'POST','form':{'method':_0xea8d('0x51'),'input_type':_0xea8d('0x27'),'response_type':_0xea8d('0x27'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x439e87[_0xea8d('0x52')],'password':_0x439e87[_0xea8d('0x53')],'encryption':_0xea8d('0x54')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xea8d('0x43')](function(_0x2b5962){var _0x561be8=_0x2b5962;if(_0x561be8['id']){def[_0xea8d('0x55')]=_0x561be8['id'];return BPromise[_0xea8d('0x37')](_0x561be8);}else{throw new Error(util[_0xea8d('0x2a')]('Account\x20%d\x20is\x20not\x20valid',_0x439e87['id']));}});}function setRelationship(_0x357dc7,_0x5b51e0,_0x31784c,_0x33e595){return request({'form':{'method':_0xea8d('0x56'),'input_type':_0xea8d('0x27'),'response_type':_0xea8d('0x27'),'rest_data':JSON['stringify']({'session':_0x357dc7['id'],'module_name':_0xea8d('0x29'),'module_id':_0x31784c['id'],'link_field_name':_0x33e595,'related_ids':[_0x5b51e0['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xea8d('0x57')]=function(_0x2776b5,_0x3a05ab,_0x131f64,_0x4171e6,_0x34f1e9,_0xda141a){var _0x5d77ec,_0x5c43c9,_0x4e3dc5,_0x245d1e;_0xda141a[_0xea8d('0x58')]=intUtil[_0xea8d('0x59')](_0xda141a[_0xea8d('0x58')]);_0xda141a[_0xea8d('0x5a')]=intUtil[_0xea8d('0x59')](_0xda141a[_0xea8d('0x5a')]);def['uri']=util['format'](_0xea8d('0x5b'),_0xda141a[_0xea8d('0x58')]);if(_0x34f1e9&&_0x34f1e9['monitor_format']){logger[_0xea8d('0x30')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3a05ab[_0xea8d('0x5c')]=util[_0xea8d('0x2a')](_0xea8d('0x5d'),_0xda141a[_0xea8d('0x5a')],_0x3a05ab[_0xea8d('0x5e')],md5(_0x3a05ab['uniqueid']));}else{_0x3a05ab[_0xea8d('0x5c')]='';}return getConnection(_0xda141a)[_0xea8d('0x43')](function(_0x4baf04){_0x245d1e=_0x4baf04;return getUser(_0xda141a,_0x4171e6[_0xea8d('0x11')],_0x245d1e);})[_0xea8d('0x43')](function(_0x12fbe0){_0x5d77ec=_0x12fbe0;logger[_0xea8d('0x30')](_0xea8d('0x5f'),_0x5d77ec['id']);return getEndUser(_0xda141a,_0x3a05ab['calleridname'],_0x3a05ab[_0xea8d('0x60')],_0x245d1e);})['then'](function(_0x21114e){_0x5c43c9=_0x21114e;logger[_0xea8d('0x30')](_0xea8d('0x61'),_0x5c43c9['id']);return getTicket(_0xda141a,_0x5d77ec,_0x5c43c9,_0x131f64,_0x3a05ab,_0x131f64[_0xea8d('0x62')],_0x245d1e,'Inbound');})['then'](function(_0x39200a){_0x4e3dc5=_0x39200a;logger[_0xea8d('0x30')](_0xea8d('0x63'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4e3dc5['id']);return setRelationship(_0x245d1e,_0x5d77ec,_0x4e3dc5,'users');})[_0xea8d('0x43')](function(){return setRelationship(_0x245d1e,_0x5c43c9,_0x4e3dc5,_0xea8d('0x64'));})[_0xea8d('0x43')](function(){return getServerInfo(_0x245d1e);})[_0xea8d('0x43')](function(_0x10c51d){var _0x4ffb1c=parseInt(_0x10c51d[_0xea8d('0x65')][_0xea8d('0x66')](0x0));var _0x2f4131=util[_0xea8d('0x2a')](_0xea8d('0x67'),_0xda141a[_0xea8d('0x58')],_0x4e3dc5['id']);if(_0x4ffb1c>0x6){_0x2f4131=util[_0xea8d('0x2a')](_0xea8d('0x68'),_0xda141a[_0xea8d('0x58')],_0x4e3dc5['id']);}logger[_0xea8d('0x30')]('[QUEUE]',_0xea8d('0x69'));emit(util[_0xea8d('0x2a')](_0xea8d('0x6a'),_0x4171e6[_0xea8d('0x11')]),_0xea8d('0x6b'),{'uri':_0x2f4131});})[_0xea8d('0x6c')](function(_0xaacdb8){logger[_0xea8d('0x6d')](_0xea8d('0x6e'),JSON[_0xea8d('0x28')](_0xaacdb8));});};exports[_0xea8d('0x6f')]=function(_0x5e7966,_0x18162b,_0x1efe51,_0x54543e,_0x327b5c,_0x54b238,_0x5e1046){var _0x362ea1,_0xfbb997,_0x16ced8,_0x93e51;_0x54b238['remoteUri']=intUtil[_0xea8d('0x59')](_0x54b238[_0xea8d('0x58')]);_0x54b238[_0xea8d('0x5a')]=intUtil['stripTrailingSlash'](_0x54b238['serverUrl']);def[_0xea8d('0x70')]=util[_0xea8d('0x2a')](_0xea8d('0x5b'),_0x54b238[_0xea8d('0x58')]);if(_0x5e1046&&_0x5e1046[_0xea8d('0x71')]&&_0x5e1046[_0xea8d('0x71')]!==_0xea8d('0x72')){logger[_0xea8d('0x30')](_0xea8d('0x73'),'Recording\x20is\x20enabled!');_0x18162b['recordingURL']=util[_0xea8d('0x2a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54b238['serverUrl'],_0x18162b['uniqueid'],md5(_0x18162b[_0xea8d('0x5e')]));}return getConnection(_0x54b238)[_0xea8d('0x43')](function(_0x56e495){_0x93e51=_0x56e495;return getUser(_0x54b238,_0x54543e[_0xea8d('0x11')],_0x93e51);})[_0xea8d('0x43')](function(_0x34af94){_0x362ea1=_0x34af94;logger[_0xea8d('0x30')](_0xea8d('0x5f'),_0x362ea1['id']);return getEndUser(_0x54b238,_0x18162b['destcalleridname'],_0x18162b[_0xea8d('0x74')],_0x93e51);})['then'](function(_0x17ee73){_0xfbb997=_0x17ee73;logger[_0xea8d('0x30')](_0xea8d('0x61'),_0xfbb997['id']);return getTicket(_0x54b238,_0x362ea1,_0xfbb997,_0x1efe51,_0x18162b,_0x1efe51[_0xea8d('0x62')],_0x93e51,_0xea8d('0x75'));})[_0xea8d('0x43')](function(_0x2514d9){_0x16ced8=_0x2514d9;logger[_0xea8d('0x30')](_0xea8d('0x63'));logger[_0xea8d('0x30')](_0xea8d('0x76'),_0x16ced8['id']);return setRelationship(_0x93e51,_0x362ea1,_0x16ced8,_0xea8d('0x77'));})[_0xea8d('0x43')](function(){return setRelationship(_0x93e51,_0xfbb997,_0x16ced8,_0xea8d('0x64'));})[_0xea8d('0x43')](function(){return getServerInfo(_0x93e51);})[_0xea8d('0x43')](function(_0x13bf3b){var _0x930656=parseInt(_0x13bf3b[_0xea8d('0x65')]['charAt'](0x0));var _0x10d72b=util[_0xea8d('0x2a')](_0xea8d('0x67'),_0x54b238['remoteUri'],_0x16ced8['id']);if(_0x930656>0x6){_0x10d72b=util['format'](_0xea8d('0x68'),_0x54b238['remoteUri'],_0x16ced8['id']);}logger['info'](_0xea8d('0x73'),_0xea8d('0x69'));emit(util[_0xea8d('0x2a')](_0xea8d('0x6a'),_0x54543e['name']),_0xea8d('0x6b'),{'uri':_0x10d72b});})[_0xea8d('0x6c')](function(_0x591b5a){logger['error'](_0xea8d('0x73'),JSON[_0xea8d('0x28')](_0x591b5a));});};exports[_0xea8d('0x78')]=function(_0x2587e7,_0x4d05d5,_0x43c62d,_0x38d04d,_0x38061e,_0x2bb45a){var _0x53b5e3,_0x395cb8,_0x1435d3,_0x62399e;_0x2bb45a[_0xea8d('0x58')]=intUtil[_0xea8d('0x59')](_0x2bb45a['remoteUri']);_0x2bb45a[_0xea8d('0x5a')]=intUtil[_0xea8d('0x59')](_0x2bb45a['serverUrl']);def[_0xea8d('0x70')]=util[_0xea8d('0x2a')]('%s/service/v4_1/rest.php',_0x2bb45a[_0xea8d('0x58')]);if(_0x38061e&&_0x38061e[_0xea8d('0x79')]){logger[_0xea8d('0x30')]('['+_0x4d05d5[_0xea8d('0x7a')][_0xea8d('0x7b')]()+']','Recording\x20is\x20enabled!');_0x4d05d5[_0xea8d('0x5c')]=util[_0xea8d('0x2a')](_0xea8d('0x5d'),_0x2bb45a[_0xea8d('0x5a')],_0x4d05d5[_0xea8d('0x5e')],md5(_0x4d05d5[_0xea8d('0x5e')]));}else{_0x4d05d5[_0xea8d('0x5c')]='';}return getConnection(_0x2bb45a)[_0xea8d('0x43')](function(_0x3644c5){_0x62399e=_0x3644c5;if(!_[_0xea8d('0x2f')](_0x38d04d)){return getUser(_0x2bb45a,_0x38d04d[_0xea8d('0x11')],_0x62399e);}else{return getUser(_0x2bb45a,null,_0x62399e);}})['then'](function(_0x2579be){_0x53b5e3=_0x2579be;logger[_0xea8d('0x30')](_0xea8d('0x5f'),_0x53b5e3['id']);return getEndUser(_0x2bb45a,_0x4d05d5[_0xea8d('0x7c')],_0x4d05d5[_0xea8d('0x60')],_0x62399e);})[_0xea8d('0x43')](function(_0x59af94){_0x395cb8=_0x59af94;logger[_0xea8d('0x30')](_0xea8d('0x61'),_0x395cb8['id']);return getTicket(_0x2bb45a,_0x53b5e3,_0x395cb8,_0x43c62d,_0x4d05d5,_0x43c62d[_0xea8d('0x62')],_0x62399e,_0xea8d('0x7d'));})[_0xea8d('0x43')](function(_0x4814e5){_0x1435d3=_0x4814e5;logger['info'](_0xea8d('0x63'));logger[_0xea8d('0x30')]('The\x20Ticket\x20ID\x20is:',_0x1435d3['id']);return setRelationship(_0x62399e,_0x53b5e3,_0x1435d3,_0xea8d('0x77'));})[_0xea8d('0x43')](function(){return setRelationship(_0x62399e,_0x395cb8,_0x1435d3,'contacts');})['then'](function(){return getServerInfo(_0x62399e);})[_0xea8d('0x6c')](function(_0x7bfc4c){logger[_0xea8d('0x6d')]('['+_0x4d05d5[_0xea8d('0x7a')][_0xea8d('0x7b')]()+']',JSON['stringify'](_0x7bfc4c));});}; \ 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 dd315a4..87c9043 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 _0xcee4=['util','getString','length','sortBy','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','join','substring','isNil','test'];(function(_0x833f60,_0xac65d2){var _0x13becd=function(_0x46d2e5){while(--_0x46d2e5){_0x833f60['push'](_0x833f60['shift']());}};_0x13becd(++_0xac65d2);}(_0xcee4,0x1db));var _0x4cee=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xcee4[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x4cee('0x0'));exports[_0x4cee('0x1')]=function(_0x3e417e,_0xfa0766,_0x33fd68){var _0x3d23be=[];if(_0x3e417e[_0x4cee('0x2')]>0x0){var _0x2b525d=_[_0x4cee('0x3')](_0x3e417e,['id']);for(var _0x18af5c=0x0;_0x18af5c<_0x2b525d[_0x4cee('0x2')];_0x18af5c++){var _0x3ed953=_0x2b525d[_0x18af5c];if(_0x3ed953[_0x4cee('0x4')]===_0x4cee('0x5')){_0x3d23be[_0x4cee('0x6')](_0x3ed953[_0x4cee('0x7')]);}else if(_0x3ed953[_0x4cee('0x4')]==='variable'&&_0x3ed953[_0x4cee('0x8')]){_0xfa0766[_0x3ed953[_0x4cee('0x8')]]&&_0x3d23be[_0x4cee('0x6')](_0xfa0766[_0x3ed953[_0x4cee('0x8')]][_0x4cee('0x9')]());}else if(_0x3ed953[_0x4cee('0x4')]===_0x4cee('0xa')&&_0x3ed953[_0x4cee('0xb')]&&_0x3ed953[_0x4cee('0xb')][_0x4cee('0xc')]){_0xfa0766[_0x3ed953['Variable'][_0x4cee('0xc')][_0x4cee('0xd')]()]&&_0x3d23be['push'](_0xfa0766[_0x3ed953[_0x4cee('0xb')][_0x4cee('0xc')][_0x4cee('0xd')]()]['toString']());}else if(_0x3ed953['type']===_0x4cee('0xe')){if(_0x3ed953[_0x4cee('0xf')]==='string'&&_0x3ed953[_0x4cee('0x10')]){_0x3d23be[_0x4cee('0x6')](util[_0x4cee('0x11')](_0x4cee('0x12'),_0x3ed953[_0x4cee('0x10')],_0x3ed953[_0x4cee('0x13')]));}else if(_0x3ed953['keyType']===_0x4cee('0x14')&&_0x3ed953[_0x4cee('0x8')]&&_0x3ed953[_0x4cee('0x10')]){_0xfa0766[_0x3ed953[_0x4cee('0x8')]]&&_0x3d23be[_0x4cee('0x6')](util[_0x4cee('0x11')](_0x4cee('0x12'),_0x3ed953[_0x4cee('0x10')],_0xfa0766[_0x3ed953[_0x4cee('0x8')]]));}else if(_0x3ed953[_0x4cee('0xf')]==='customVariable'&&_0x3ed953[_0x4cee('0xb')]&&_0x3ed953[_0x4cee('0xb')][_0x4cee('0xc')]&&_0x3ed953[_0x4cee('0x10')]){_0xfa0766[_0x3ed953[_0x4cee('0xb')][_0x4cee('0xc')][_0x4cee('0xd')]()]&&_0x3d23be['push'](util[_0x4cee('0x11')](_0x4cee('0x12'),_0x3ed953['key'],_0xfa0766[_0x3ed953[_0x4cee('0xb')][_0x4cee('0xc')][_0x4cee('0xd')]()]));}}}}return _0x3d23be[_0x4cee('0x15')](_0x33fd68);};exports['stripTrailingSlash']=function(_0x49498f){var _0x4a74ac=_0x49498f['slice'](-0x1);if(_0x4a74ac==='/'){_0x49498f=_0x49498f[_0x4cee('0x16')](0x0,_0x49498f['lastIndexOf'](_0x4a74ac));}return _0x49498f;};exports['validateEmail']=function(_0x51b5dd){if(!_[_0x4cee('0x17')](_0x51b5dd)&&_0x51b5dd!==''){var _0x774bf1=/^(([^<>()\[\]\\.,;:\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 _0x774bf1[_0x4cee('0x18')](String(_0x51b5dd)[_0x4cee('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x4820=['sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','join','slice','substring','validateEmail','isNil','test','lodash','util','getString','length'];(function(_0x288f42,_0x11da23){var _0x13957c=function(_0x538dc0){while(--_0x538dc0){_0x288f42['push'](_0x288f42['shift']());}};_0x13957c(++_0x11da23);}(_0x4820,0x10a));var _0x0482=function(_0x376c33,_0x8b3e7b){_0x376c33=_0x376c33-0x0;var _0x348b36=_0x4820[_0x376c33];return _0x348b36;};'use strict';var _=require(_0x0482('0x0'));var util=require(_0x0482('0x1'));exports[_0x0482('0x2')]=function(_0xd076ea,_0x516bc3,_0x29979f){var _0xde09d0=[];if(_0xd076ea[_0x0482('0x3')]>0x0){var _0x51ffc1=_[_0x0482('0x4')](_0xd076ea,['id']);for(var _0x212cde=0x0;_0x212cde<_0x51ffc1[_0x0482('0x3')];_0x212cde++){var _0x30d71d=_0x51ffc1[_0x212cde];if(_0x30d71d[_0x0482('0x5')]===_0x0482('0x6')){_0xde09d0[_0x0482('0x7')](_0x30d71d[_0x0482('0x8')]);}else if(_0x30d71d[_0x0482('0x5')]===_0x0482('0x9')&&_0x30d71d[_0x0482('0xa')]){_0x516bc3[_0x30d71d['variableName']]&&_0xde09d0[_0x0482('0x7')](_0x516bc3[_0x30d71d[_0x0482('0xa')]][_0x0482('0xb')]());}else if(_0x30d71d[_0x0482('0x5')]===_0x0482('0xc')&&_0x30d71d['Variable']&&_0x30d71d[_0x0482('0xd')]['name']){_0x516bc3[_0x30d71d[_0x0482('0xd')][_0x0482('0xe')][_0x0482('0xf')]()]&&_0xde09d0['push'](_0x516bc3[_0x30d71d[_0x0482('0xd')][_0x0482('0xe')][_0x0482('0xf')]()][_0x0482('0xb')]());}else if(_0x30d71d[_0x0482('0x5')]==='keyValue'){if(_0x30d71d[_0x0482('0x10')]===_0x0482('0x6')&&_0x30d71d[_0x0482('0x11')]){_0xde09d0['push'](util[_0x0482('0x12')](_0x0482('0x13'),_0x30d71d['key'],_0x30d71d[_0x0482('0x14')]));}else if(_0x30d71d['keyType']==='variable'&&_0x30d71d[_0x0482('0xa')]&&_0x30d71d[_0x0482('0x11')]){_0x516bc3[_0x30d71d['variableName']]&&_0xde09d0[_0x0482('0x7')](util['format']('%s:\x20%s',_0x30d71d[_0x0482('0x11')],_0x516bc3[_0x30d71d[_0x0482('0xa')]]));}else if(_0x30d71d[_0x0482('0x10')]===_0x0482('0xc')&&_0x30d71d[_0x0482('0xd')]&&_0x30d71d[_0x0482('0xd')][_0x0482('0xe')]&&_0x30d71d[_0x0482('0x11')]){_0x516bc3[_0x30d71d['Variable'][_0x0482('0xe')][_0x0482('0xf')]()]&&_0xde09d0[_0x0482('0x7')](util[_0x0482('0x12')](_0x0482('0x13'),_0x30d71d[_0x0482('0x11')],_0x516bc3[_0x30d71d[_0x0482('0xd')][_0x0482('0xe')][_0x0482('0xf')]()]));}}}}return _0xde09d0[_0x0482('0x15')](_0x29979f);};exports['stripTrailingSlash']=function(_0x39a881){var _0x68b8ff=_0x39a881[_0x0482('0x16')](-0x1);if(_0x68b8ff==='/'){_0x39a881=_0x39a881[_0x0482('0x17')](0x0,_0x39a881['lastIndexOf'](_0x68b8ff));}return _0x39a881;};exports[_0x0482('0x18')]=function(_0x59667e){if(!_[_0x0482('0x19')](_0x59667e)&&_0x59667e!==''){var _0x57cd4d=/^(([^<>()\[\]\\.,;:\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 _0x57cd4d[_0x0482('0x1a')](String(_0x59667e)[_0x0482('0xf')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a06b9d0..bb041ef 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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','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','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x2ec15d,_0x31aef4){var _0x21cb11=function(_0xd6358b){while(--_0xd6358b){_0x2ec15d['push'](_0x2ec15d['shift']());}};_0x21cb11(++_0x31aef4);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x361b47,_0x5bb965){var _0x1f0f9c=function(_0x137c15){while(--_0x137c15){_0x361b47['push'](_0x361b47['shift']());}};_0x1f0f9c(++_0x5bb965);}(_0xe706,0xa3));var _0x6e70=function(_0x32917a,_0x3559ea){_0x32917a=_0x32917a-0x0;var _0x1881e1=_0xe706[_0x32917a];return _0x1881e1;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index aba50a6..c3a1877 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 _0xb885=['replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','results','length','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','type','nameField','toLowerCase','content','push','variableName','customField','idField','custom_fields','Variable','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:'];(function(_0x58f726,_0x130d4b){var _0x1bf5c=function(_0x2fe70f){while(--_0x2fe70f){_0x58f726['push'](_0x58f726['shift']());}};_0x1bf5c(++_0x130d4b);}(_0xb885,0x1b2));var _0x5b88=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0xb885[_0x2d1971];return _0x4d7759;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x5b88('0x0'));var Redis=require('ioredis');var intUtil=require(_0x5b88('0x1'));var config=require(_0x5b88('0x2'));var logger=require(_0x5b88('0x3'))(_0x5b88('0x4'));config[_0x5b88('0x5')]=_[_0x5b88('0x6')](config[_0x5b88('0x5')],{'host':_0x5b88('0x7'),'port':0x18eb});var io=require(_0x5b88('0x8'))(new Redis(config[_0x5b88('0x5')]));function emit(_0x56fda7,_0x309958,_0x137f17){io['to'](_0x56fda7)[_0x5b88('0x9')](_0x309958,_0x137f17);}var headers={'Content-Type':_0x5b88('0xa'),'Accept':_0x5b88('0xa')};function getTicket(_0x36baf,_0x4353e9,_0x57fcac,_0x22d788,_0x3968dd){logger[_0x5b88('0xb')](_0x5b88('0xc'));return request({'uri':util[_0x5b88('0xd')]('%s/tickets.json',_0x36baf[_0x5b88('0xe')]),'method':_0x5b88('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x57fcac['id'],'submitter_id':_0x4353e9?_0x4353e9['id']:undefined,'assignee_id':_0x4353e9?_0x4353e9['id']:undefined,'tags':getTags(_0x22d788[_0x5b88('0x10')],_0x5b88('0x11')),'subject':intUtil[_0x5b88('0x12')](_0x22d788[_0x5b88('0x13')],_0x3968dd,'\x20'),'description':intUtil['getString'](_0x22d788[_0x5b88('0x14')],_0x3968dd,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5b88('0x12')](_0x22d788['Descriptions'],_0x3968dd,'\x0a')}},getCustomFields(_0x22d788[_0x5b88('0x15')],_0x3968dd))}})['then'](function(_0x8fa247){logger[_0x5b88('0xb')](_0x5b88('0x16'));return _0x8fa247['ticket'];});}function getUser(_0x43e476,_0x546ed1){if(intUtil[_0x5b88('0x17')](_0x546ed1)){logger[_0x5b88('0xb')](_0x5b88('0x18'),_0x546ed1);return request({'uri':util[_0x5b88('0xd')](_0x5b88('0x19'),_0x43e476['remoteUri']),'qs':{'query':util['format'](_0x5b88('0x1a'),_0x546ed1)}})[_0x5b88('0x1b')](function(_0x23a65c){if(_0x23a65c[_0x5b88('0x1c')]){logger[_0x5b88('0xb')](_0x5b88('0x1d'));return _[_0x5b88('0x1e')](_0x23a65c['results'],{'email':_0x546ed1,'role':_0x5b88('0x1f')});}else{logger[_0x5b88('0xb')](_0x5b88('0x20'));return request({'uri':util[_0x5b88('0xd')](_0x5b88('0x21'),_0x43e476[_0x5b88('0xe')])})['then'](function(_0x32c8f8){logger[_0x5b88('0xb')]('Admin\x20account\x20selected.');return _0x32c8f8[_0x5b88('0x22')];});}});}else{logger[_0x5b88('0xb')](_0x5b88('0x20'));return request({'uri':util[_0x5b88('0xd')](_0x5b88('0x21'),_0x43e476[_0x5b88('0xe')])})[_0x5b88('0x1b')](function(_0x19a301){logger[_0x5b88('0xb')]('Admin\x20account\x20selected.');return _0x19a301[_0x5b88('0x22')];});}}function getEndUser(_0x528103,_0xe7da60,_0x12002e){logger[_0x5b88('0xb')](_0x5b88('0x23'),_0x12002e);return request({'uri':util['format']('%s/search.json',_0x528103[_0x5b88('0xe')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x12002e)}})['then'](function(_0x4f4c1a){var _0xcef225;if(_0x4f4c1a[_0x5b88('0x24')][_0x5b88('0x25')]){_0x4f4c1a[_0x5b88('0x24')]=_['filter'](_0x4f4c1a[_0x5b88('0x24')],{'suspended':![],'role':_0x5b88('0x26')});if(_0x4f4c1a[_0x5b88('0x24')]['length']){_0xcef225=_['first'](_0x4f4c1a[_0x5b88('0x24')]);}}if(_0xcef225){logger[_0x5b88('0xb')](_0x5b88('0x27'));return _0xcef225;}else{logger[_0x5b88('0xb')](_0x5b88('0x28'));return request({'uri':util[_0x5b88('0xd')](_0x5b88('0x29'),_0x528103[_0x5b88('0xe')]),'method':_0x5b88('0xf'),'body':{'user':{'role':_0x5b88('0x26'),'name':util[_0x5b88('0xd')](_0x5b88('0x2a'),_0xe7da60||_0x12002e),'phone':_0x12002e}}})[_0x5b88('0x1b')](function(_0x1b1485){logger[_0x5b88('0xb')](_0x5b88('0x2b'));return _0x1b1485[_0x5b88('0x22')];});}});}function getAuth(_0x44c633){var _0x26ca11;if(_0x44c633[_0x5b88('0x2c')]===_0x5b88('0x2d')){_0x26ca11=util[_0x5b88('0xd')](_0x5b88('0x2e'),_0x44c633[_0x5b88('0x2f')],_0x44c633[_0x5b88('0x2d')]);}else if(_0x44c633[_0x5b88('0x2c')]===_0x5b88('0x30')){_0x26ca11=util['format'](_0x5b88('0x31'),_0x44c633['username'],_0x44c633[_0x5b88('0x30')]);}return util['format']('Basic\x20%s',new Buffer(_0x26ca11)[_0x5b88('0x32')](_0x5b88('0x33')));}function request(_0x15b248){logger[_0x5b88('0x34')](_0x5b88('0x35'),JSON[_0x5b88('0x36')](_0x15b248));return rp(_[_0x5b88('0x6')](_0x15b248,{'method':_0x5b88('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x38f6c4,_0x23f438){var _0x452096=[];if(_0x38f6c4&&_0x38f6c4[_0x5b88('0x25')]>0x0){_0x452096=_[_0x5b88('0x38')](_0x38f6c4,_0x23f438);}return _0x452096;}function getCustomFields(_0x4edbab,_0x1d0ad3){var _0x246788=[];var _0x37ac8c={'custom_fields':[]};if(_0x4edbab[_0x5b88('0x25')]>0x0){_['forEach'](_0x4edbab,function(_0x4513b3){if(_[_0x5b88('0x39')]([_0x5b88('0x3a'),_0x5b88('0x3b')],_0x4513b3[_0x5b88('0x3c')])&&_0x4513b3['nameField']&&!_0x4513b3['customField']){_0x37ac8c[_0x4513b3[_0x5b88('0x3d')][_0x5b88('0x3e')]()]=_0x4513b3[_0x5b88('0x3f')]['toString']();}else if(_[_0x5b88('0x39')]([_0x5b88('0x3a'),_0x5b88('0x3b')],_0x4513b3[_0x5b88('0x3c')])&&_0x4513b3['idField']&&_0x4513b3['customField']){_0x37ac8c['custom_fields'][_0x5b88('0x40')]({'id':_0x4513b3['idField'],'value':_0x4513b3[_0x5b88('0x3f')]['toString']()});}else if(_0x4513b3['type']==='variable'&&_0x4513b3[_0x5b88('0x41')]&&_0x4513b3['idField']&&_0x4513b3[_0x5b88('0x42')]){_0x1d0ad3[_0x4513b3[_0x5b88('0x41')]]&&_0x37ac8c['custom_fields']['push']({'id':_0x4513b3[_0x5b88('0x43')],'value':_0x1d0ad3[_0x4513b3[_0x5b88('0x41')]]['toString']()});}else if(_0x4513b3[_0x5b88('0x3c')]==='customVariable'&&_0x4513b3['Variable']&&_0x4513b3['Variable'][_0x5b88('0x11')]&&_0x4513b3['idField']&&_0x4513b3['customField']){_0x1d0ad3[_0x4513b3['Variable'][_0x5b88('0x11')][_0x5b88('0x3e')]()]&&_0x37ac8c[_0x5b88('0x44')][_0x5b88('0x40')]({'id':_0x4513b3['idField'],'value':_0x1d0ad3[_0x4513b3[_0x5b88('0x45')]['name'][_0x5b88('0x3e')]()][_0x5b88('0x32')]()});}});}return _0x37ac8c;}exports[_0x5b88('0x46')]=function(_0x2734c3,_0xc8c419,_0x40331b,_0x3f4197,_0x1e2c00,_0x84a8e6){var _0x182850,_0x5b994a;_0x84a8e6[_0x5b88('0xe')]=intUtil[_0x5b88('0x47')](_0x84a8e6[_0x5b88('0xe')]);_0x84a8e6['serverUrl']=intUtil[_0x5b88('0x47')](_0x84a8e6[_0x5b88('0x48')]);if(_0x1e2c00&&_0x1e2c00['monitor_format']){logger[_0x5b88('0xb')]('[QUEUE]',_0x5b88('0x49'));_0xc8c419['recordingURL']=util[_0x5b88('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x84a8e6[_0x5b88('0x48')],_0xc8c419[_0x5b88('0x4a')],md5(_0xc8c419[_0x5b88('0x4a')]));}else{_0xc8c419[_0x5b88('0x4b')]='';}headers['Authorization']=getAuth(_0x84a8e6);return getUser(_0x84a8e6,_0x3f4197[_0x5b88('0x4c')])[_0x5b88('0x1b')](function(_0x5a21b6){_0x182850=_0x5a21b6;logger[_0x5b88('0xb')](_0x5b88('0x4d'),_0x182850['id']);return getEndUser(_0x84a8e6,_0xc8c419['calleridname'],_0xc8c419[_0x5b88('0x4e')]);})['then'](function(_0x531c69){_0x5b994a=_0x531c69;logger[_0x5b88('0xb')](_0x5b88('0x4f'),_0x5b994a['id']);return getTicket(_0x84a8e6,_0x182850,_0x5b994a,_0x40331b,_0xc8c419);})['then'](function(_0x5825d8){if(_0x5825d8){logger[_0x5b88('0xb')]('The\x20Ticket\x20ID\x20is:',_0x5825d8['id']);switch(_0x84a8e6[_0x5b88('0x3c')]){case'integrationTab':logger['info'](_0x5b88('0x50'),_0x5b88('0x51'));return request({'uri':util['format'](_0x5b88('0x52'),_0x84a8e6[_0x5b88('0xe')],_0x182850['id'],_0x5825d8['id']),'method':_0x5b88('0xf')});case _0x5b88('0x53'):logger[_0x5b88('0xb')]('[QUEUE]',_0x5b88('0x54'));emit(util[_0x5b88('0xd')](_0x5b88('0x55'),_0x3f4197[_0x5b88('0x11')]),_0x5b88('0x56'),{'uri':util['format'](_0x5b88('0x57'),_0x84a8e6[_0x5b88('0xe')]['replace'](_0x5b88('0x58'),''),_0x5825d8['id'])});break;default:logger['error'](_0x5b88('0x50'),_0x5b88('0x59'));}}})[_0x5b88('0x5a')](function(_0x1d8470){logger[_0x5b88('0x5b')](_0x5b88('0x5c'),util[_0x5b88('0x5d')](_0x1d8470,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5daa04,_0x3f9f13,_0x1be807,_0x2d6a07,_0x1be8db,_0x29bf8b,_0x3a47ed){var _0x549493,_0xf6409;_0x29bf8b[_0x5b88('0xe')]=intUtil['stripTrailingSlash'](_0x29bf8b[_0x5b88('0xe')]);_0x29bf8b[_0x5b88('0x48')]=intUtil[_0x5b88('0x47')](_0x29bf8b[_0x5b88('0x48')]);if(_0x3a47ed&&_0x3a47ed[_0x5b88('0x5e')]&&_0x3a47ed[_0x5b88('0x5e')]!==_0x5b88('0x5f')){logger[_0x5b88('0xb')](_0x5b88('0x60'),_0x5b88('0x49'));_0x3f9f13[_0x5b88('0x4b')]=util[_0x5b88('0xd')](_0x5b88('0x61'),_0x29bf8b[_0x5b88('0x48')],_0x3f9f13[_0x5b88('0x4a')],md5(_0x3f9f13[_0x5b88('0x4a')]));}headers['Authorization']=getAuth(_0x29bf8b);return getUser(_0x29bf8b,_0x2d6a07[_0x5b88('0x4c')])[_0x5b88('0x1b')](function(_0x4939c2){_0x549493=_0x4939c2;logger['info']('The\x20User\x20ID\x20is:',_0x549493['id']);return getEndUser(_0x29bf8b,_0x3f9f13[_0x5b88('0x62')],_0x3f9f13[_0x5b88('0x63')]);})['then'](function(_0x55e4e4){_0xf6409=_0x55e4e4;logger[_0x5b88('0xb')](_0x5b88('0x4f'),_0xf6409['id']);return getTicket(_0x29bf8b,_0x549493,_0xf6409,_0x1be807,_0x3f9f13);})[_0x5b88('0x1b')](function(_0x57687b){if(_0x57687b){logger[_0x5b88('0xb')](_0x5b88('0x64'),_0x57687b['id']);switch(_0x29bf8b[_0x5b88('0x3c')]){case'integrationTab':logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x5b88('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x29bf8b[_0x5b88('0xe')],_0x549493['id'],_0x57687b['id']),'method':_0x5b88('0xf')});case'newTab':logger[_0x5b88('0xb')](_0x5b88('0x60'),_0x5b88('0x54'));emit(util[_0x5b88('0xd')](_0x5b88('0x55'),_0x2d6a07[_0x5b88('0x11')]),_0x5b88('0x56'),{'uri':util[_0x5b88('0xd')]('%s/agent/tickets/%s',_0x29bf8b['remoteUri'][_0x5b88('0x65')](_0x5b88('0x58'),''),_0x57687b['id'])});break;default:logger['error'](_0x5b88('0x60'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5b88('0x5a')](function(_0x5e838d){logger[_0x5b88('0x5b')](_0x5b88('0x66'),util['inspect'](_0x5e838d,{'showHidden':!![],'depth':null}));});};exports[_0x5b88('0x67')]=function(_0x569c01,_0x534ff5,_0x2c025c,_0x4b8eba,_0x8fb459,_0x2fcaaa){var _0x1c0091,_0x159f11;_0x2fcaaa['remoteUri']=intUtil['stripTrailingSlash'](_0x2fcaaa[_0x5b88('0xe')]);_0x2fcaaa['serverUrl']=intUtil[_0x5b88('0x47')](_0x2fcaaa[_0x5b88('0x48')]);if(_0x8fb459&&_0x8fb459[_0x5b88('0x68')]){logger[_0x5b88('0xb')]('['+_0x534ff5[_0x5b88('0x69')][_0x5b88('0x6a')]()+']',_0x5b88('0x49'));_0x534ff5['recordingURL']=util[_0x5b88('0xd')](_0x5b88('0x61'),_0x2fcaaa[_0x5b88('0x48')],_0x534ff5[_0x5b88('0x4a')],md5(_0x534ff5[_0x5b88('0x4a')]));}else{_0x534ff5[_0x5b88('0x4b')]='';}headers['Authorization']=getAuth(_0x2fcaaa);return getUser(_0x2fcaaa)[_0x5b88('0x1b')](function(_0x37dc40){_0x1c0091=_0x37dc40;logger[_0x5b88('0xb')](_0x5b88('0x4d'),_0x1c0091['id']);return getEndUser(_0x2fcaaa,_0x534ff5['calleridname'],_0x534ff5['calleridnum']);})['then'](function(_0x3c3fa4){_0x159f11=_0x3c3fa4;logger[_0x5b88('0xb')]('The\x20Enduser\x20ID\x20is:',_0x159f11['id']);return getTicket(_0x2fcaaa,_0x1c0091,_0x159f11,_0x2c025c,_0x534ff5);})[_0x5b88('0x1b')](function(_0x3687b4){if(_0x3687b4){logger[_0x5b88('0xb')](_0x5b88('0x64'),_0x3687b4['id']);}})[_0x5b88('0x5a')](function(_0x435b1b){logger[_0x5b88('0x5b')]('['+_0x534ff5[_0x5b88('0x69')][_0x5b88('0x6a')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x5b88('0x5d')](_0x435b1b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x85aa=['Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','username','password','token','base64','[HTTP]','stringify','GET','map','string','type','nameField','customField','toLowerCase','toString','includes','picklist','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','none','email','destcalleridname','[OUTBOUND]','/api/v2','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','socket.io-emitter','redis','application/json','info','format','%s/tickets.json','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','ticket','validateEmail'];(function(_0x43d4a8,_0x17fba9){var _0x1b4502=function(_0x4d40ed){while(--_0x4d40ed){_0x43d4a8['push'](_0x43d4a8['shift']());}};_0x1b4502(++_0x17fba9);}(_0x85aa,0x1f3));var _0xa85a=function(_0x1597cf,_0x5eaba2){_0x1597cf=_0x1597cf-0x0;var _0x49fbd9=_0x85aa[_0x1597cf];return _0x49fbd9;};'use strict';var _=require(_0xa85a('0x0'));var rp=require(_0xa85a('0x1'));var md5=require(_0xa85a('0x2'));var util=require('util');var Redis=require(_0xa85a('0x3'));var intUtil=require(_0xa85a('0x4'));var config=require(_0xa85a('0x5'));var logger=require(_0xa85a('0x6'))(_0xa85a('0x7'));config['redis']=_[_0xa85a('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa85a('0x9'))(new Redis(config[_0xa85a('0xa')]));function emit(_0x4e1182,_0x357ef7,_0x329449){io['to'](_0x4e1182)['emit'](_0x357ef7,_0x329449);}var headers={'Content-Type':_0xa85a('0xb'),'Accept':_0xa85a('0xb')};function getTicket(_0x7e7eb3,_0x4f8670,_0x5290ae,_0x1150a1,_0x52b675){logger[_0xa85a('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xa85a('0xd')](_0xa85a('0xe'),_0x7e7eb3['remoteUri']),'method':_0xa85a('0xf'),'body':{'ticket':_[_0xa85a('0x10')]({'requester_id':_0x5290ae['id'],'submitter_id':_0x4f8670?_0x4f8670['id']:undefined,'assignee_id':_0x4f8670?_0x4f8670['id']:undefined,'tags':getTags(_0x1150a1[_0xa85a('0x11')],_0xa85a('0x12')),'subject':intUtil['getString'](_0x1150a1[_0xa85a('0x13')],_0x52b675,'\x20'),'description':intUtil[_0xa85a('0x14')](_0x1150a1[_0xa85a('0x15')],_0x52b675,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa85a('0x14')](_0x1150a1[_0xa85a('0x15')],_0x52b675,'\x0a')}},getCustomFields(_0x1150a1[_0xa85a('0x16')],_0x52b675))}})[_0xa85a('0x17')](function(_0x5d9ffb){logger['info']('Ticket\x20created!');return _0x5d9ffb[_0xa85a('0x18')];});}function getUser(_0x30f8e2,_0x317491){if(intUtil[_0xa85a('0x19')](_0x317491)){logger[_0xa85a('0xc')](_0xa85a('0x1a'),_0x317491);return request({'uri':util[_0xa85a('0xd')](_0xa85a('0x1b'),_0x30f8e2['remoteUri']),'qs':{'query':util['format'](_0xa85a('0x1c'),_0x317491)}})[_0xa85a('0x17')](function(_0x15d911){if(_0x15d911[_0xa85a('0x1d')]){logger[_0xa85a('0xc')](_0xa85a('0x1e'));return _[_0xa85a('0x1f')](_0x15d911[_0xa85a('0x20')],{'email':_0x317491,'role':_0xa85a('0x21')});}else{logger[_0xa85a('0xc')](_0xa85a('0x22'));return request({'uri':util[_0xa85a('0xd')]('%s/users/me.json',_0x30f8e2[_0xa85a('0x23')])})['then'](function(_0x260879){logger['info'](_0xa85a('0x24'));return _0x260879[_0xa85a('0x25')];});}});}else{logger[_0xa85a('0xc')](_0xa85a('0x22'));return request({'uri':util[_0xa85a('0xd')]('%s/users/me.json',_0x30f8e2['remoteUri'])})[_0xa85a('0x17')](function(_0xe04e7c){logger['info'](_0xa85a('0x24'));return _0xe04e7c['user'];});}}function getEndUser(_0x124650,_0x58a7dc,_0x1efcad){logger[_0xa85a('0xc')](_0xa85a('0x26'),_0x1efcad);return request({'uri':util[_0xa85a('0xd')](_0xa85a('0x1b'),_0x124650[_0xa85a('0x23')]),'qs':{'query':util['format'](_0xa85a('0x27'),_0x1efcad)}})[_0xa85a('0x17')](function(_0xccce44){var _0x35c979;if(_0xccce44['results'][_0xa85a('0x28')]){_0xccce44[_0xa85a('0x20')]=_[_0xa85a('0x29')](_0xccce44[_0xa85a('0x20')],{'suspended':![],'role':_0xa85a('0x2a')});if(_0xccce44[_0xa85a('0x20')][_0xa85a('0x28')]){_0x35c979=_['first'](_0xccce44[_0xa85a('0x20')]);}}if(_0x35c979){logger[_0xa85a('0xc')]('Enduser\x20found!');return _0x35c979;}else{logger[_0xa85a('0xc')](_0xa85a('0x2b'));return request({'uri':util['format']('%s/users.json',_0x124650[_0xa85a('0x23')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xa85a('0xd')](_0xa85a('0x2c'),_0x58a7dc||_0x1efcad),'phone':_0x1efcad}}})[_0xa85a('0x17')](function(_0x167cbf){logger[_0xa85a('0xc')]('Enduser\x20created.');return _0x167cbf['user'];});}});}function getAuth(_0x41cd58){var _0x307f22;if(_0x41cd58[_0xa85a('0x2d')]==='password'){_0x307f22=util[_0xa85a('0xd')]('%s:%s',_0x41cd58[_0xa85a('0x2e')],_0x41cd58[_0xa85a('0x2f')]);}else if(_0x41cd58[_0xa85a('0x2d')]===_0xa85a('0x30')){_0x307f22=util['format']('%s/token:%s',_0x41cd58[_0xa85a('0x2e')],_0x41cd58['token']);}return util['format']('Basic\x20%s',new Buffer(_0x307f22)['toString'](_0xa85a('0x31')));}function request(_0x287553){logger['debug'](_0xa85a('0x32'),JSON[_0xa85a('0x33')](_0x287553));return rp(_['defaults'](_0x287553,{'method':_0xa85a('0x34'),'headers':headers,'json':!![]}));}function getTags(_0xb7f26d,_0x2f51d3){var _0x1fbbb7=[];if(_0xb7f26d&&_0xb7f26d[_0xa85a('0x28')]>0x0){_0x1fbbb7=_[_0xa85a('0x35')](_0xb7f26d,_0x2f51d3);}return _0x1fbbb7;}function getCustomFields(_0xb1c78e,_0x21ad41){var _0x39d19b=[];var _0x4c6339={'custom_fields':[]};if(_0xb1c78e[_0xa85a('0x28')]>0x0){_['forEach'](_0xb1c78e,function(_0x541f40){if(_['includes']([_0xa85a('0x36'),'picklist'],_0x541f40[_0xa85a('0x37')])&&_0x541f40[_0xa85a('0x38')]&&!_0x541f40[_0xa85a('0x39')]){_0x4c6339[_0x541f40['nameField'][_0xa85a('0x3a')]()]=_0x541f40['content'][_0xa85a('0x3b')]();}else if(_[_0xa85a('0x3c')]([_0xa85a('0x36'),_0xa85a('0x3d')],_0x541f40['type'])&&_0x541f40[_0xa85a('0x3e')]&&_0x541f40[_0xa85a('0x39')]){_0x4c6339[_0xa85a('0x3f')][_0xa85a('0x40')]({'id':_0x541f40[_0xa85a('0x3e')],'value':_0x541f40['content'][_0xa85a('0x3b')]()});}else if(_0x541f40[_0xa85a('0x37')]===_0xa85a('0x41')&&_0x541f40[_0xa85a('0x42')]&&_0x541f40['idField']&&_0x541f40[_0xa85a('0x39')]){_0x21ad41[_0x541f40[_0xa85a('0x42')]]&&_0x4c6339[_0xa85a('0x3f')][_0xa85a('0x40')]({'id':_0x541f40[_0xa85a('0x3e')],'value':_0x21ad41[_0x541f40[_0xa85a('0x42')]][_0xa85a('0x3b')]()});}else if(_0x541f40[_0xa85a('0x37')]===_0xa85a('0x43')&&_0x541f40['Variable']&&_0x541f40[_0xa85a('0x44')][_0xa85a('0x12')]&&_0x541f40[_0xa85a('0x3e')]&&_0x541f40[_0xa85a('0x39')]){_0x21ad41[_0x541f40['Variable'][_0xa85a('0x12')][_0xa85a('0x3a')]()]&&_0x4c6339['custom_fields'][_0xa85a('0x40')]({'id':_0x541f40['idField'],'value':_0x21ad41[_0x541f40[_0xa85a('0x44')][_0xa85a('0x12')][_0xa85a('0x3a')]()]['toString']()});}});}return _0x4c6339;}exports[_0xa85a('0x45')]=function(_0xad5f95,_0x24974d,_0x5adfb6,_0xca0423,_0x5a87e9,_0x4f1a45){var _0x422d5e,_0x499161;_0x4f1a45[_0xa85a('0x23')]=intUtil[_0xa85a('0x46')](_0x4f1a45[_0xa85a('0x23')]);_0x4f1a45[_0xa85a('0x47')]=intUtil[_0xa85a('0x46')](_0x4f1a45[_0xa85a('0x47')]);if(_0x5a87e9&&_0x5a87e9[_0xa85a('0x48')]){logger[_0xa85a('0xc')](_0xa85a('0x49'),'Recording\x20is\x20enabled!');_0x24974d['recordingURL']=util[_0xa85a('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4f1a45[_0xa85a('0x47')],_0x24974d[_0xa85a('0x4a')],md5(_0x24974d['uniqueid']));}else{_0x24974d[_0xa85a('0x4b')]='';}headers[_0xa85a('0x4c')]=getAuth(_0x4f1a45);return getUser(_0x4f1a45,_0xca0423['email'])[_0xa85a('0x17')](function(_0x2b006a){_0x422d5e=_0x2b006a;logger[_0xa85a('0xc')](_0xa85a('0x4d'),_0x422d5e['id']);return getEndUser(_0x4f1a45,_0x24974d['calleridname'],_0x24974d['calleridnum']);})[_0xa85a('0x17')](function(_0x2b6848){_0x499161=_0x2b6848;logger[_0xa85a('0xc')](_0xa85a('0x4e'),_0x499161['id']);return getTicket(_0x4f1a45,_0x422d5e,_0x499161,_0x5adfb6,_0x24974d);})['then'](function(_0xc12cb6){if(_0xc12cb6){logger['info'](_0xa85a('0x4f'),_0xc12cb6['id']);switch(_0x4f1a45[_0xa85a('0x37')]){case _0xa85a('0x50'):logger['info'](_0xa85a('0x49'),_0xa85a('0x51'));return request({'uri':util[_0xa85a('0xd')](_0xa85a('0x52'),_0x4f1a45['remoteUri'],_0x422d5e['id'],_0xc12cb6['id']),'method':'POST'});case'newTab':logger[_0xa85a('0xc')](_0xa85a('0x49'),_0xa85a('0x53'));emit(util[_0xa85a('0xd')](_0xa85a('0x54'),_0xca0423[_0xa85a('0x12')]),_0xa85a('0x55'),{'uri':util[_0xa85a('0xd')](_0xa85a('0x56'),_0x4f1a45['remoteUri'][_0xa85a('0x57')]('/api/v2',''),_0xc12cb6['id'])});break;default:logger['error'](_0xa85a('0x49'),_0xa85a('0x58'));}}})[_0xa85a('0x59')](function(_0x1df228){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1df228,{'showHidden':!![],'depth':null}));});};exports[_0xa85a('0x5a')]=function(_0xdd79e2,_0x287e2f,_0x2283c5,_0x1a5a76,_0x561b07,_0x20d46e,_0x1e9c69){var _0x28e213,_0x2e9b8a;_0x20d46e['remoteUri']=intUtil[_0xa85a('0x46')](_0x20d46e[_0xa85a('0x23')]);_0x20d46e[_0xa85a('0x47')]=intUtil[_0xa85a('0x46')](_0x20d46e[_0xa85a('0x47')]);if(_0x1e9c69&&_0x1e9c69['recordingFormat']&&_0x1e9c69['recordingFormat']!==_0xa85a('0x5b')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x287e2f['recordingURL']=util[_0xa85a('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20d46e['serverUrl'],_0x287e2f[_0xa85a('0x4a')],md5(_0x287e2f[_0xa85a('0x4a')]));}headers[_0xa85a('0x4c')]=getAuth(_0x20d46e);return getUser(_0x20d46e,_0x1a5a76[_0xa85a('0x5c')])[_0xa85a('0x17')](function(_0xf70950){_0x28e213=_0xf70950;logger[_0xa85a('0xc')](_0xa85a('0x4d'),_0x28e213['id']);return getEndUser(_0x20d46e,_0x287e2f[_0xa85a('0x5d')],_0x287e2f['destcalleridnum']);})[_0xa85a('0x17')](function(_0x4a0ed7){_0x2e9b8a=_0x4a0ed7;logger['info'](_0xa85a('0x4e'),_0x2e9b8a['id']);return getTicket(_0x20d46e,_0x28e213,_0x2e9b8a,_0x2283c5,_0x287e2f);})[_0xa85a('0x17')](function(_0x1492c6){if(_0x1492c6){logger[_0xa85a('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1492c6['id']);switch(_0x20d46e[_0xa85a('0x37')]){case _0xa85a('0x50'):logger['info'](_0xa85a('0x5e'),_0xa85a('0x51'));return request({'uri':util[_0xa85a('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x20d46e[_0xa85a('0x23')],_0x28e213['id'],_0x1492c6['id']),'method':_0xa85a('0xf')});case'newTab':logger[_0xa85a('0xc')](_0xa85a('0x5e'),_0xa85a('0x53'));emit(util[_0xa85a('0xd')](_0xa85a('0x54'),_0x1a5a76[_0xa85a('0x12')]),_0xa85a('0x55'),{'uri':util[_0xa85a('0xd')](_0xa85a('0x56'),_0x20d46e['remoteUri'][_0xa85a('0x57')](_0xa85a('0x5f'),''),_0x1492c6['id'])});break;default:logger[_0xa85a('0x60')](_0xa85a('0x5e'),_0xa85a('0x58'));}}})[_0xa85a('0x59')](function(_0x399f1f){logger[_0xa85a('0x60')](_0xa85a('0x61'),util[_0xa85a('0x62')](_0x399f1f,{'showHidden':!![],'depth':null}));});};exports[_0xa85a('0x63')]=function(_0x396ac6,_0x54cfbb,_0x641333,_0x239b34,_0x2b8f36,_0x3c02c2){var _0x20918e,_0x3e4f5e;_0x3c02c2[_0xa85a('0x23')]=intUtil[_0xa85a('0x46')](_0x3c02c2['remoteUri']);_0x3c02c2[_0xa85a('0x47')]=intUtil[_0xa85a('0x46')](_0x3c02c2[_0xa85a('0x47')]);if(_0x2b8f36&&_0x2b8f36['monitor_format']){logger[_0xa85a('0xc')]('['+_0x54cfbb[_0xa85a('0x64')][_0xa85a('0x65')]()+']','Recording\x20is\x20enabled!');_0x54cfbb[_0xa85a('0x4b')]=util['format'](_0xa85a('0x66'),_0x3c02c2[_0xa85a('0x47')],_0x54cfbb[_0xa85a('0x4a')],md5(_0x54cfbb[_0xa85a('0x4a')]));}else{_0x54cfbb[_0xa85a('0x4b')]='';}headers[_0xa85a('0x4c')]=getAuth(_0x3c02c2);return getUser(_0x3c02c2)[_0xa85a('0x17')](function(_0x56cade){_0x20918e=_0x56cade;logger[_0xa85a('0xc')](_0xa85a('0x4d'),_0x20918e['id']);return getEndUser(_0x3c02c2,_0x54cfbb['calleridname'],_0x54cfbb[_0xa85a('0x67')]);})[_0xa85a('0x17')](function(_0x48573f){_0x3e4f5e=_0x48573f;logger[_0xa85a('0xc')](_0xa85a('0x4e'),_0x3e4f5e['id']);return getTicket(_0x3c02c2,_0x20918e,_0x3e4f5e,_0x641333,_0x54cfbb);})['then'](function(_0x37709b){if(_0x37709b){logger[_0xa85a('0xc')](_0xa85a('0x4f'),_0x37709b['id']);}})[_0xa85a('0x59')](function(_0x30f4eb){logger[_0xa85a('0x60')]('['+_0x54cfbb['lastevent'][_0xa85a('0x65')]()+']'+_0xa85a('0x68'),util[_0xa85a('0x62')](_0x30f4eb,{'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 370a924..407d37d 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 _0xfbac=['Full_Name','First_Name','Last_Name','What_Id','talktime','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','connect','Answered','rejected','Rejected','timeout','Timeout','Call_Start_Time','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','/downloads?type=uniqueid&token=','zoho.eu','request-promise','md5','util','./util','moment','ioredis','../../../../config/logger','zoho','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','refresh_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','info','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','details','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','Contacts','nothing','lead','Creating\x20new\x20call...','Owner','getString','Subjects','Description','Who_Id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfbac,0x167));var _0xcfba=function(_0x516b06,_0x383cac){_0x516b06=_0x516b06-0x0;var _0x26dc08=_0xfbac[_0x516b06];return _0x26dc08;};'use strict';var _=require('lodash');var rp=require(_0xcfba('0x0'));var md5=require(_0xcfba('0x1'));var util=require(_0xcfba('0x2'));var intUtil=require(_0xcfba('0x3'));var moment=require(_0xcfba('0x4'));var Redis=require(_0xcfba('0x5'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xcfba('0x6'))(_0xcfba('0x7'));config['redis']=_['defaults'](config[_0xcfba('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xcfba('0x9'))(new Redis(config['redis']));function emit(_0x15e8d6,_0x2c68cd,_0x5bbb82){io['to'](_0x15e8d6)[_0xcfba('0xa')](_0x2c68cd,_0x5bbb82);}function request(_0xeae9f2){logger[_0xcfba('0xb')](_0xcfba('0xc'),JSON[_0xcfba('0xd')](_0xeae9f2));return rp(_0xeae9f2);}function getCustomFields(_0x44af2e,_0x37ed2d){var _0x4779bc={};if(_0x44af2e[_0xcfba('0xe')]>0x0){_[_0xcfba('0xf')](_0x44af2e,function(_0x3e0c34){if(_[_0xcfba('0x10')](['string','picklist'],_0x3e0c34[_0xcfba('0x11')])&&_0x3e0c34[_0xcfba('0x12')]){_0x4779bc[_0x3e0c34['idField']]=_0x3e0c34[_0xcfba('0x13')][_0xcfba('0x14')]();}else if(_0x3e0c34[_0xcfba('0x11')]===_0xcfba('0x15')&&_0x3e0c34[_0xcfba('0x16')]&&_0x3e0c34[_0xcfba('0x12')]&&_0x37ed2d[_0x3e0c34[_0xcfba('0x16')]]){_0x4779bc[_0x3e0c34[_0xcfba('0x12')]]=_0x37ed2d[_0x3e0c34[_0xcfba('0x16')]][_0xcfba('0x14')]();}else if(_0x3e0c34[_0xcfba('0x11')]===_0xcfba('0x17')&&_0x3e0c34[_0xcfba('0x18')]&&_0x3e0c34['Variable'][_0xcfba('0x19')]&&_0x3e0c34[_0xcfba('0x12')]&&_0x37ed2d[_0x3e0c34[_0xcfba('0x18')][_0xcfba('0x19')][_0xcfba('0x1a')]()]){_0x4779bc[_0x3e0c34[_0xcfba('0x12')]]=_0x37ed2d[_0x3e0c34[_0xcfba('0x18')]['name'][_0xcfba('0x1a')]()][_0xcfba('0x14')]();}});}return _0x4779bc;}function getName(_0x35cec9){if(_0x35cec9['indexOf']('\x20')>0x0){var _0x5832d4=_0x35cec9[_0xcfba('0x1b')](/ (.+)/);if(_0x5832d4[0x1]){return _0x5832d4;}}return[_0x35cec9,_0x35cec9];}var accountsTokens={};function getAccessToken(_0x43b745){return new Promise(function(_0x40a0df,_0x467762){if(!_[_0xcfba('0x1c')](accountsTokens[_0x43b745['id']])&&!_[_0xcfba('0x1c')](accountsTokens[_0x43b745['id']]['access_token'])){if(moment()[_0xcfba('0x1d')](accountsTokens[_0x43b745['id']]['expires_in'])){_0x40a0df(accountsTokens[_0x43b745['id']][_0xcfba('0x1e')]);}}var _0x1e187f;switch(_0x43b745['zone']){case'US':_0x1e187f=_0xcfba('0x1f');break;case'AU':_0x1e187f=_0xcfba('0x20');break;case'EU':_0x1e187f=_0xcfba('0x21');break;case'IN':_0x1e187f=_0xcfba('0x22');break;case'CN':_0x1e187f='https://accounts.zoho.com.cn';break;default:_0x1e187f='https://accounts.zoho.eu';break;}var _0x387a32={'method':_0xcfba('0x23'),'uri':_0x1e187f+_0xcfba('0x24'),'qs':{'refresh_token':_0x43b745['refreshToken'],'client_id':_0x43b745[_0xcfba('0x25')],'client_secret':_0x43b745['clientSecret'],'grant_type':_0xcfba('0x26')},'json':!![]};return rp(_0x387a32)['then'](function(_0x4ee825){accountsTokens[_0x43b745['id']]={'access_token':_0x4ee825[_0xcfba('0x1e')],'expires_in':moment()[_0xcfba('0x27')](_0x4ee825['expires_in'],_0xcfba('0x28'))};_0x40a0df(_0x4ee825[_0xcfba('0x1e')]);})[_0xcfba('0x29')](function(_0x334d97){logger[_0xcfba('0x2a')](_0xcfba('0x2b'),_0x334d97[_0xcfba('0x2c')]);_0x467762(_0x334d97);});});}function getUser(_0x4585ec,_0x5c77c4,_0x7c7d76,_0x4aa981){logger['info'](_0xcfba('0x2d'));return request({'method':'GET','uri':util[_0xcfba('0x2e')]('https://www.zohoapis.%s/crm/v2/users',_0x5c77c4),'qs':{'type':_0xcfba('0x2f')},'headers':{'Authorization':_0xcfba('0x30')+_0x4585ec},'json':!![]})[_0xcfba('0x31')](function(_0x127ad5){if(_0x127ad5[_0xcfba('0x32')]){var _0x1aaf34=-0x1;if(_[_0xcfba('0x33')](_0x127ad5[_0xcfba('0x32')])){if(!_['isNil'](_0x4aa981)){_0x1aaf34=_['findIndex'](_0x127ad5['users'],function(_0x34b172){return _0x34b172[_0xcfba('0x34')]===_0x4aa981;});}if(_0x1aaf34>=0x0){logger['info'](_0xcfba('0x35'));}else{logger['info'](_0xcfba('0x36'));_0x1aaf34=_[_0xcfba('0x37')](_0x127ad5[_0xcfba('0x32')],function(_0x3a1458){return _0x3a1458[_0xcfba('0x38')][_0xcfba('0x19')]===_0xcfba('0x39');});}return _0x127ad5[_0xcfba('0x32')][_0x1aaf34];}else{if(_0x127ad5['user'][_0xcfba('0x38')][_0xcfba('0x19')]===_0xcfba('0x39')){logger[_0xcfba('0x3a')](_0xcfba('0x36'));user=_0x127ad5[_0xcfba('0x3b')];return user;}else{logger[_0xcfba('0x2a')]('The\x20failing\x20result\x20is',JSON[_0xcfba('0xd')](_0x127ad5));throw new Error(_0xcfba('0x3c')+JSON[_0xcfba('0xd')](_0x127ad5));}}}else{logger[_0xcfba('0x2a')](_0xcfba('0x3d'),JSON['stringify'](_0x127ad5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xcfba('0xd')](_0x127ad5));}})[_0xcfba('0x29')](function(_0x476dc3){console[_0xcfba('0x2a')](_0x476dc3);});}function getZohoUser(_0x548c3c,_0x40a6ae){return new BPromise(function(_0x3c3a3c,_0x4fc962){request(_0x548c3c)['then'](function(_0x14ccc9){var _0x3e2757=null;if(_0x14ccc9){_0x3e2757=_0x14ccc9[_0xcfba('0x3e')][0x0];_0x3e2757[_0xcfba('0x3f')]=_0x40a6ae;}_0x3c3a3c(_0x3e2757);})[_0xcfba('0x29')](function(_0x173903){_0x4fc962(_0x173903);});});}function createEndUser(_0x58ffb6,_0x497fcc,_0x36fb80,_0x43c206,_0x577b46,_0x438aeb){var _0x36fb80=getName(_0x36fb80);return request({'method':_0xcfba('0x23'),'uri':'https://www.zohoapis.'+_0x497fcc+_0xcfba('0x40')+_[_0xcfba('0x41')](_0x438aeb[_0xcfba('0x42')])+'s','body':{'data':[{'Last_Name':_0x36fb80[0x1],'First_Name':_0x36fb80[0x0],'Phone':_0x43c206,'Owner':{'name':!_[_0xcfba('0x1c')](_0x577b46[_0xcfba('0x43')][_0xcfba('0x19')])?_0x577b46['role'][_0xcfba('0x19')]:!_['isNil'](_0x577b46['first_name'])?_0x577b46[_0xcfba('0x44')]+'\x20'+_0x577b46[_0xcfba('0x45')]:_0x577b46[_0xcfba('0x45')],'id':_0x577b46['id']}}]},'headers':{'Authorization':_0xcfba('0x30')+_0x58ffb6},'json':!![]})[_0xcfba('0x31')](function(_0x1ea9d9){if(_0x1ea9d9&&_0x1ea9d9['data'][0x0]['code']==='SUCCESS'){var _0x148f62=_0x1ea9d9[_0xcfba('0x3e')][0x0][_0xcfba('0x46')];_0x148f62[_0xcfba('0x3f')]=_[_0xcfba('0x41')](_0x438aeb[_0xcfba('0x42')])+'s';return _0x148f62;}logger[_0xcfba('0x2a')](_0xcfba('0x3d'),JSON[_0xcfba('0xd')](data));throw new Error('Error:\x20'+JSON[_0xcfba('0xd')](data));})[_0xcfba('0x29')](function(_0xd2a387){console[_0xcfba('0x47')](_0xcfba('0x48'),_0xd2a387);});}function getEndUser(_0x816aa5,_0x1fe0de,_0x5a82fe,_0x1c2f9b,_0x33cb33,_0x2072b8,_0xfe324b){var _0x4d3906={'method':_0xcfba('0x49'),'uri':'','headers':{'Authorization':_0xcfba('0x30')+_0x816aa5},'json':!![]};switch(_0xfe324b[_0xcfba('0x4a')]){case _0xcfba('0x4b'):_0x4d3906[_0xcfba('0x4c')]=_0xcfba('0x4d')+_0x1fe0de+_0xcfba('0x4e')+_0x33cb33+'))';return getZohoUser(_0x4d3906,'Contacts')['then'](function(_0x11ad05){if(_0x11ad05)return _0x11ad05;_0x4d3906[_0xcfba('0x4c')]=_0xcfba('0x4d')+_0x1fe0de+_0xcfba('0x4f')+_0x33cb33+'))';return getZohoUser(_0x4d3906,_0xcfba('0x50'))[_0xcfba('0x31')](function(_0x53bd26){if(_0x53bd26)return _0x53bd26;if(_0xfe324b['moduleCreate']!='nothing'){return createEndUser(_0x816aa5,_0x1fe0de,_0x1c2f9b,_0x33cb33,_0x2072b8,_0xfe324b);}else{return{};}});});break;case _0xcfba('0x51'):_0x4d3906['uri']=_0xcfba('0x4d')+_0x1fe0de+_0xcfba('0x4e')+_0x33cb33+'))';return getZohoUser(_0x4d3906,_0xcfba('0x52'))[_0xcfba('0x31')](function(_0x56d259){if(_0x56d259)return _0x56d259;if(_0xfe324b['moduleCreate']!=_0xcfba('0x53')){return createEndUser(_0x816aa5,_0x1fe0de,_0x1c2f9b,_0x33cb33,_0x2072b8,_0xfe324b);}else{return{};}});break;case _0xcfba('0x54'):_0x4d3906[_0xcfba('0x4c')]=_0xcfba('0x4d')+_0x1fe0de+_0xcfba('0x4f')+_0x33cb33+'))';return getZohoUser(_0x4d3906,_0xcfba('0x50'))[_0xcfba('0x31')](function(_0x2b749f){if(_0x2b749f)return _0x2b749f;if(_0xfe324b['moduleCreate']!='nothing'){return createEndUser(_0x816aa5,_0x1fe0de,_0x1c2f9b,_0x33cb33,_0x2072b8,_0xfe324b);}else{return{};}});break;}}function getCall(_0x27e75b,_0x2c88e6,_0x358477,_0x1193c3,_0x47056f,_0x187711,_0x3fc544,_0x3c76a4){logger[_0xcfba('0x3a')](_0xcfba('0x55'));var _0x68130a={};_0x68130a[_0xcfba('0x56')]={'name':!_[_0xcfba('0x1c')](_0x1193c3[_0xcfba('0x43')]['name'])&&!_['isNil'](_0x1193c3[_0xcfba('0x38')][_0xcfba('0x19')])&&_0x1193c3[_0xcfba('0x38')][_0xcfba('0x19')]==='administrator'?_0x1193c3[_0xcfba('0x43')][_0xcfba('0x19')]:!_[_0xcfba('0x1c')](_0x1193c3['first_name'])?_0x1193c3[_0xcfba('0x44')]+'\x20'+_0x1193c3[_0xcfba('0x45')]:_0x1193c3[_0xcfba('0x45')],'id':_0x1193c3['id']};_0x68130a['Subject']=intUtil[_0xcfba('0x57')](_0x187711[_0xcfba('0x58')],_0x3fc544,'\x20');_0x68130a[_0xcfba('0x59')]=intUtil[_0xcfba('0x57')](_0x187711['Descriptions'],_0x3fc544,'\x0a');if(_0x47056f['enduserType']===_0xcfba('0x52')){_0x68130a[_0xcfba('0x5a')]={'name':!_['isNil'](_0x47056f['Full_Name'])?_0x47056f[_0xcfba('0x5b')]:!_['isNil'](_0x47056f[_0xcfba('0x5c')])?_0x47056f[_0xcfba('0x5c')]+'\x20'+_0x47056f[_0xcfba('0x5d')]:_0x47056f['Last_Name'],'id':_0x47056f['id']};}if(_0x47056f[_0xcfba('0x3f')]===_0xcfba('0x50')){_0x68130a[_0xcfba('0x5e')]={'name':!_[_0xcfba('0x1c')](_0x47056f['Full_Name'])?_0x47056f[_0xcfba('0x5b')]:!_[_0xcfba('0x1c')](_0x47056f[_0xcfba('0x5c')])?_0x47056f[_0xcfba('0x5c')]+'\x20'+_0x47056f[_0xcfba('0x5d')]:_0x47056f[_0xcfba('0x5d')],'id':_0x47056f['id']};_0x68130a['$se_module']=_[_0xcfba('0x41')](_0x47056f[_0xcfba('0x3f')]);}if(_0x3fc544[_0xcfba('0x5f')]){_0x68130a['Call_Duration']=moment[_0xcfba('0x60')](parseInt(_0x3fc544['talktime'])*0x3e8)[_0xcfba('0x2e')](_0xcfba('0x61'));}else if(_0x3fc544[_0xcfba('0x62')]&&_0x3fc544[_0xcfba('0x63')]){_0x68130a['Call_Duration']=moment[_0xcfba('0x60')](moment(_0x3fc544[_0xcfba('0x63')],_0xcfba('0x64'))[_0xcfba('0x65')](moment(_0x3fc544['starttime'],_0xcfba('0x64'))))['format'](_0xcfba('0x61'));}switch(_0x3fc544[_0xcfba('0x66')]){case _0xcfba('0x67'):_0x68130a[_0xcfba('0x68')]=_0xcfba('0x69');break;case'complete':case _0xcfba('0x6a'):_0x68130a['Call_Result']=_0xcfba('0x6b');break;case _0xcfba('0x6c'):_0x68130a[_0xcfba('0x68')]=_0xcfba('0x6d');break;case'abandoned':_0x68130a[_0xcfba('0x68')]='Abandoned';break;case _0xcfba('0x6e'):_0x68130a['Call_Result']=_0xcfba('0x6f');default:}_0x68130a[_0xcfba('0x70')]=(_0x3c76a4==='outbound'?moment(_0x3fc544['starttime'])[_0xcfba('0x2e')](_0xcfba('0x64')):moment(_0x3fc544['agentcalledAt'])[_0xcfba('0x2e')](_0xcfba('0x64')))||moment()[_0xcfba('0x2e')](_0xcfba('0x64'));_0x68130a[_0xcfba('0x71')]=_0x3c76a4||'Inbound';_0x68130a=_[_0xcfba('0x72')](_0x68130a,getCustomFields(_0x187711[_0xcfba('0x73')],_0x3fc544));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x2c88e6+_0xcfba('0x74'),'headers':{'Authorization':_0xcfba('0x30')+_0x27e75b},'body':{'data':[_0x68130a]},'json':!![]})[_0xcfba('0x31')](function(_0x475d25){if(_0x475d25&&_0x475d25['data'][0x0]['code']==='SUCCESS'){logger['info'](_0xcfba('0x75'));return{'id':_0x475d25[_0xcfba('0x3e')][0x0][_0xcfba('0x46')]['id']};}})[_0xcfba('0x29')](function(_0x407012){logger[_0xcfba('0x3a')](_0xcfba('0x76'),_0x407012[_0xcfba('0x2c')]);console['log'](_0xcfba('0x76'),_0x407012);});}exports[_0xcfba('0x77')]=function(_0x3e5b25,_0x3769c2,_0x8e5974,_0x40ecdf,_0x3da7e9,_0x3d575e){var _0x2e7a5b,_0xb1fed0,_0x5a81f7;_0x3d575e['host']=intUtil[_0xcfba('0x78')](_0x3d575e[_0xcfba('0x79')]);_0x3d575e[_0xcfba('0x7a')]=intUtil[_0xcfba('0x78')](_0x3d575e[_0xcfba('0x7a')]);if(_0x3da7e9&&_0x3da7e9[_0xcfba('0x7b')]){logger[_0xcfba('0x3a')](_0xcfba('0x7c'),_0xcfba('0x7d'));_0x3769c2[_0xcfba('0x7e')]=_0x3d575e[_0xcfba('0x7a')]+_0xcfba('0x7f')+_0x3769c2[_0xcfba('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x3769c2[_0xcfba('0x80')]);}else{_0x3769c2[_0xcfba('0x7e')]='';}var _0x24a8b9=_0x3d575e[_0xcfba('0x79')]==='zoho.eu'?'eu':_0xcfba('0x81');return getAccessToken(_0x3d575e)[_0xcfba('0x31')](function(_0x4395ee){_0x5a81f7=_0x4395ee;return getUser(_0x5a81f7,_0x24a8b9,_0x3d575e,_0x40ecdf[_0xcfba('0x34')]);})[_0xcfba('0x31')](function(_0x523e34){_0x2e7a5b=_0x523e34;logger[_0xcfba('0x3a')](_0xcfba('0x82'),_0x2e7a5b['id']);return getEndUser(_0x5a81f7,_0x24a8b9,_0x3d575e,_0x3769c2[_0xcfba('0x83')],_0x3769c2[_0xcfba('0x84')],_0x2e7a5b,_0x8e5974);})[_0xcfba('0x31')](function(_0xab6bfc){_0xb1fed0=_0xab6bfc;return getCall(_0x5a81f7,_0x24a8b9,_0x3d575e,_0x2e7a5b,_0xb1fed0,_0x8e5974,_0x3769c2,_0xcfba('0x85'));})[_0xcfba('0x31')](function(_0x324b8a){if(_0x324b8a){logger[_0xcfba('0x3a')](_0xcfba('0x86'),_0x324b8a['id']);logger['info'](_0xcfba('0x7c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xcfba('0x87'),_0x40ecdf[_0xcfba('0x19')]),_0xcfba('0x88'),{'uri':_0xcfba('0x89')+_0x3d575e['host']+_0xcfba('0x8a')+_0x324b8a['id']});}})[_0xcfba('0x29')](function(_0x34bf88){logger[_0xcfba('0x2a')](_0xcfba('0x7c'),JSON[_0xcfba('0xd')](_0x34bf88));});};exports[_0xcfba('0x8b')]=function(_0x18d77f,_0x420cca,_0x21ad6e,_0x4423f7,_0xae7f01,_0x321809,_0x3f9edb){var _0x5713a8,_0x1da6f1,_0xb76c3d;_0x321809[_0xcfba('0x79')]=intUtil[_0xcfba('0x78')](_0x321809[_0xcfba('0x79')]);_0x321809[_0xcfba('0x7a')]=intUtil['stripTrailingSlash'](_0x321809['serverUrl']);if(_0x3f9edb&&_0x3f9edb[_0xcfba('0x8c')]&&_0x3f9edb[_0xcfba('0x8c')]!==_0xcfba('0x8d')){logger[_0xcfba('0x3a')](_0xcfba('0x8e'),'Recording\x20is\x20enabled!');_0x420cca['recordingURL']=_0x321809[_0xcfba('0x7a')]+_0xcfba('0x7f')+_0x420cca[_0xcfba('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x420cca[_0xcfba('0x80')]);}var _0x58c4c5=_0x321809[_0xcfba('0x79')]==='zoho.eu'?'eu':_0xcfba('0x81');return getAccessToken(_0x321809)[_0xcfba('0x31')](function(_0x361edf){_0xb76c3d=_0x361edf;return getUser(_0xb76c3d,_0x58c4c5,_0x321809,_0x4423f7[_0xcfba('0x34')]);})['then'](function(_0x3fdf2b){_0x5713a8=_0x3fdf2b;logger[_0xcfba('0x3a')](_0xcfba('0x82'),_0x5713a8['id']);return getEndUser(_0xb76c3d,_0x58c4c5,_0x321809,_0x420cca[_0xcfba('0x8f')],_0x420cca[_0xcfba('0x90')],_0x5713a8,_0x21ad6e);})[_0xcfba('0x31')](function(_0x4ee341){_0x1da6f1=_0x4ee341;return getCall(_0xb76c3d,_0x58c4c5,_0x321809,_0x5713a8,_0x1da6f1,_0x21ad6e,_0x420cca,'Outbound');})[_0xcfba('0x31')](function(_0x4f5f67){if(_0x4f5f67){logger[_0xcfba('0x3a')](_0xcfba('0x86'),_0x4f5f67['id']);logger[_0xcfba('0x3a')](_0xcfba('0x8e'),_0xcfba('0x91'));emit(util[_0xcfba('0x2e')](_0xcfba('0x87'),_0x4423f7['name']),_0xcfba('0x88'),{'uri':'https://crm.'+_0x321809[_0xcfba('0x79')]+_0xcfba('0x8a')+_0x4f5f67['id']});}})[_0xcfba('0x29')](function(_0x6e2a9){logger[_0xcfba('0x2a')](_0xcfba('0x8e'),JSON[_0xcfba('0xd')](_0x6e2a9));});};exports[_0xcfba('0x92')]=function(_0x204b61,_0x3393a2,_0x1d7df9,_0x5aca59,_0x4ee5a0,_0x3ce7bb){var _0x2dd7ba,_0x39084c,_0x26796b;_0x3ce7bb[_0xcfba('0x79')]=intUtil[_0xcfba('0x78')](_0x3ce7bb[_0xcfba('0x79')]);_0x3ce7bb['serverUrl']=intUtil[_0xcfba('0x78')](_0x3ce7bb['serverUrl']);if(_0x4ee5a0&&_0x4ee5a0['monitor_format']){logger[_0xcfba('0x3a')]('['+_0x3393a2['lastevent'][_0xcfba('0x93')]()+']','Recording\x20is\x20enabled!');_0x3393a2[_0xcfba('0x7e')]=_0x3ce7bb['serverUrl']+_0xcfba('0x7f')+_0x3393a2[_0xcfba('0x80')]+_0xcfba('0x94')+md5(_0x3393a2[_0xcfba('0x80')]);}else{_0x3393a2[_0xcfba('0x7e')]='';}var _0x160654=_0x3ce7bb['host']===_0xcfba('0x95')?'eu':_0xcfba('0x81');return getAccessToken(_0x3ce7bb)[_0xcfba('0x31')](function(_0x9e4433){_0x26796b=_0x9e4433;return getUser(_0x26796b,_0x160654,_0x3ce7bb);})[_0xcfba('0x31')](function(_0x26bd98){_0x2dd7ba=_0x26bd98;logger[_0xcfba('0x3a')](_0xcfba('0x82'),_0x2dd7ba['id']);return getEndUser(_0x26796b,_0x160654,_0x3ce7bb,_0x3393a2[_0xcfba('0x83')],_0x3393a2[_0xcfba('0x84')],_0x2dd7ba,_0x1d7df9);})[_0xcfba('0x31')](function(_0x78a94a){_0x39084c=_0x78a94a;return getCall(_0x26796b,_0x160654,_0x3ce7bb,_0x2dd7ba,_0x39084c,_0x1d7df9,_0x3393a2,'Inbound');})[_0xcfba('0x31')](function(_0x88f6ab){if(_0x88f6ab){logger[_0xcfba('0x3a')](_0xcfba('0x86'),_0x88f6ab['id']);}})[_0xcfba('0x29')](function(_0x4f6fee){logger[_0xcfba('0x2a')]('['+_0x3393a2[_0xcfba('0x66')][_0xcfba('0x93')]()+']',JSON[_0xcfba('0xd')](_0x4f6fee));});}; \ No newline at end of file +var _0x923f=['indexOf','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','access_token','add','catch','error','Failing\x20creating\x20the\x20access_token','info','format','https://www.zohoapis.%s/crm/v2/users','then','users','isArrayLikeObject','isNil','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','log','CREATE\x20ERROR','GET','Zoho-oauthtoken\x20','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','administrator','Subject','getString','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','utc','talktime','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','stack','queue','stripTrailingSlash','host','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridnum','Outbound','user:%s','unmanaged','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/environment','zoho','defaults','localhost','socket.io-emitter','redis','[HTTP]','length','forEach','includes','string','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x2fff6b,_0x29752f){var _0xc562b2=function(_0x19bd81){while(--_0x19bd81){_0x2fff6b['push'](_0x2fff6b['shift']());}};_0xc562b2(++_0x29752f);}(_0x923f,0x7b));var _0xf923=function(_0x354489,_0x4f148f){_0x354489=_0x354489-0x0;var _0x5ae6e9=_0x923f[_0x354489];return _0x5ae6e9;};'use strict';var _=require(_0xf923('0x0'));var rp=require(_0xf923('0x1'));var md5=require(_0xf923('0x2'));var util=require(_0xf923('0x3'));var intUtil=require(_0xf923('0x4'));var moment=require('moment');var Redis=require(_0xf923('0x5'));var BPromise=require(_0xf923('0x6'));var config=require(_0xf923('0x7'));var logger=require('../../../../config/logger')(_0xf923('0x8'));config['redis']=_[_0xf923('0x9')](config['redis'],{'host':_0xf923('0xa'),'port':0x18eb});var io=require(_0xf923('0xb'))(new Redis(config[_0xf923('0xc')]));function emit(_0x3db5ab,_0x2cfc53,_0x447318){io['to'](_0x3db5ab)['emit'](_0x2cfc53,_0x447318);}function request(_0x3ab9b){logger['debug'](_0xf923('0xd'),JSON['stringify'](_0x3ab9b));return rp(_0x3ab9b);}function getCustomFields(_0x3616e0,_0x38a25d){var _0x20276d={};if(_0x3616e0[_0xf923('0xe')]>0x0){_[_0xf923('0xf')](_0x3616e0,function(_0x49f972){if(_[_0xf923('0x10')]([_0xf923('0x11'),'picklist'],_0x49f972[_0xf923('0x12')])&&_0x49f972['idField']){_0x20276d[_0x49f972[_0xf923('0x13')]]=_0x49f972['content'][_0xf923('0x14')]();}else if(_0x49f972[_0xf923('0x12')]===_0xf923('0x15')&&_0x49f972[_0xf923('0x16')]&&_0x49f972[_0xf923('0x13')]&&_0x38a25d[_0x49f972[_0xf923('0x16')]]){_0x20276d[_0x49f972['idField']]=_0x38a25d[_0x49f972[_0xf923('0x16')]][_0xf923('0x14')]();}else if(_0x49f972[_0xf923('0x12')]===_0xf923('0x17')&&_0x49f972[_0xf923('0x18')]&&_0x49f972[_0xf923('0x18')][_0xf923('0x19')]&&_0x49f972[_0xf923('0x13')]&&_0x38a25d[_0x49f972[_0xf923('0x18')][_0xf923('0x19')][_0xf923('0x1a')]()]){_0x20276d[_0x49f972['idField']]=_0x38a25d[_0x49f972['Variable'][_0xf923('0x19')]['toLowerCase']()][_0xf923('0x14')]();}});}return _0x20276d;}function getName(_0x20f469){if(_0x20f469[_0xf923('0x1b')]('\x20')>0x0){var _0x15d231=_0x20f469['split'](/ (.+)/);if(_0x15d231[0x1]){return _0x15d231;}}return[_0x20f469,_0x20f469];}var accountsTokens={};function getAccessToken(_0x5d091f){return new Promise(function(_0x1b7c21,_0x3d1b30){if(!_['isNil'](accountsTokens[_0x5d091f['id']])&&!_['isNil'](accountsTokens[_0x5d091f['id']]['access_token'])){if(moment()[_0xf923('0x1c')](accountsTokens[_0x5d091f['id']][_0xf923('0x1d')])){_0x1b7c21(accountsTokens[_0x5d091f['id']]['access_token']);}}var _0x355dd0;switch(_0x5d091f[_0xf923('0x1e')]){case'US':_0x355dd0=_0xf923('0x1f');break;case'AU':_0x355dd0=_0xf923('0x20');break;case'EU':_0x355dd0=_0xf923('0x21');break;case'IN':_0x355dd0='https://accounts.zoho.in';break;case'CN':_0x355dd0=_0xf923('0x22');break;default:_0x355dd0=_0xf923('0x21');break;}var _0x318a34={'method':_0xf923('0x23'),'uri':_0x355dd0+_0xf923('0x24'),'qs':{'refresh_token':_0x5d091f[_0xf923('0x25')],'client_id':_0x5d091f['clientId'],'client_secret':_0x5d091f[_0xf923('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x318a34)['then'](function(_0x578c51){accountsTokens[_0x5d091f['id']]={'access_token':_0x578c51[_0xf923('0x27')],'expires_in':moment()[_0xf923('0x28')](_0x578c51['expires_in'],'seconds')};_0x1b7c21(_0x578c51['access_token']);})[_0xf923('0x29')](function(_0x48dbeb){logger[_0xf923('0x2a')](_0xf923('0x2b'),_0x48dbeb['stack']);_0x3d1b30(_0x48dbeb);});});}function getUser(_0x299568,_0x11b72a,_0x24e4c8,_0x2b3a4b){logger[_0xf923('0x2c')]('Search\x20user');return request({'method':'GET','uri':util[_0xf923('0x2d')](_0xf923('0x2e'),_0x11b72a),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x299568},'json':!![]})[_0xf923('0x2f')](function(_0x55d484){if(_0x55d484[_0xf923('0x30')]){var _0x31d279=-0x1;if(_[_0xf923('0x31')](_0x55d484[_0xf923('0x30')])){if(!_[_0xf923('0x32')](_0x2b3a4b)){_0x31d279=_[_0xf923('0x33')](_0x55d484[_0xf923('0x30')],function(_0x13079f){return _0x13079f[_0xf923('0x34')]===_0x2b3a4b;});}if(_0x31d279>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xf923('0x2c')](_0xf923('0x35'));_0x31d279=_['findIndex'](_0x55d484[_0xf923('0x30')],function(_0x38f2b6){return _0x38f2b6[_0xf923('0x36')]['name']===_0xf923('0x37');});}return _0x55d484[_0xf923('0x30')][_0x31d279];}else{if(_0x55d484[_0xf923('0x38')][_0xf923('0x36')][_0xf923('0x19')]===_0xf923('0x37')){logger[_0xf923('0x2c')](_0xf923('0x35'));user=_0x55d484['user'];return user;}else{logger[_0xf923('0x2a')](_0xf923('0x39'),JSON[_0xf923('0x3a')](_0x55d484));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x55d484));}}}else{logger[_0xf923('0x2a')](_0xf923('0x39'),JSON[_0xf923('0x3a')](_0x55d484));throw new Error(_0xf923('0x3b')+JSON[_0xf923('0x3a')](_0x55d484));}})[_0xf923('0x29')](function(_0x34592f){console[_0xf923('0x2a')](_0x34592f);});}function getZohoUser(_0x19f268,_0x591988){return new BPromise(function(_0xf20ed6,_0x3c2a63){request(_0x19f268)[_0xf923('0x2f')](function(_0x3280fa){var _0x2720b2=null;if(_0x3280fa){_0x2720b2=_0x3280fa[_0xf923('0x3c')][0x0];_0x2720b2['enduserType']=_0x591988;}_0xf20ed6(_0x2720b2);})['catch'](function(_0xe11b54){_0x3c2a63(_0xe11b54);});});}function createEndUser(_0x3b17be,_0x74f565,_0x4d2702,_0x22d9c5,_0x46def4,_0x44f903){var _0x4d2702=getName(_0x4d2702);return request({'method':_0xf923('0x23'),'uri':_0xf923('0x3d')+_0x74f565+'/crm/v2/'+_[_0xf923('0x3e')](_0x44f903[_0xf923('0x3f')])+'s','body':{'data':[{'Last_Name':_0x4d2702[0x1],'First_Name':_0x4d2702[0x0],'Phone':_0x22d9c5,'Owner':{'name':!_[_0xf923('0x32')](_0x46def4[_0xf923('0x40')][_0xf923('0x19')])?_0x46def4['role'][_0xf923('0x19')]:!_['isNil'](_0x46def4[_0xf923('0x41')])?_0x46def4[_0xf923('0x41')]+'\x20'+_0x46def4[_0xf923('0x42')]:_0x46def4[_0xf923('0x42')],'id':_0x46def4['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3b17be},'json':!![]})['then'](function(_0x30f9ef){if(_0x30f9ef&&_0x30f9ef[_0xf923('0x3c')][0x0][_0xf923('0x43')]==='SUCCESS'){var _0x22c633=_0x30f9ef['data'][0x0][_0xf923('0x44')];_0x22c633['enduserType']=_[_0xf923('0x3e')](_0x44f903[_0xf923('0x3f')])+'s';return _0x22c633;}logger['error'](_0xf923('0x39'),JSON[_0xf923('0x3a')](data));throw new Error(_0xf923('0x45')+JSON[_0xf923('0x3a')](data));})[_0xf923('0x29')](function(_0x1d039f){console[_0xf923('0x46')](_0xf923('0x47'),_0x1d039f);});}function getEndUser(_0x172e9f,_0x5c80ba,_0x2e216a,_0x43bcf8,_0x152176,_0xea614e,_0x45d41e){var _0x2ba784={'method':_0xf923('0x48'),'uri':'','headers':{'Authorization':_0xf923('0x49')+_0x172e9f},'json':!![]};switch(_0x45d41e[_0xf923('0x4a')]){case'contact_lead':_0x2ba784['uri']=_0xf923('0x3d')+_0x5c80ba+_0xf923('0x4b')+_0x152176+'))';return getZohoUser(_0x2ba784,_0xf923('0x4c'))[_0xf923('0x2f')](function(_0x31a705){if(_0x31a705)return _0x31a705;_0x2ba784[_0xf923('0x4d')]=_0xf923('0x3d')+_0x5c80ba+_0xf923('0x4e')+_0x152176+'))';return getZohoUser(_0x2ba784,_0xf923('0x4f'))[_0xf923('0x2f')](function(_0x1a6070){if(_0x1a6070)return _0x1a6070;if(_0x45d41e[_0xf923('0x3f')]!=_0xf923('0x50')){return createEndUser(_0x172e9f,_0x5c80ba,_0x43bcf8,_0x152176,_0xea614e,_0x45d41e);}else{return{};}});});break;case'contact':_0x2ba784[_0xf923('0x4d')]=_0xf923('0x3d')+_0x5c80ba+_0xf923('0x4b')+_0x152176+'))';return getZohoUser(_0x2ba784,_0xf923('0x4c'))[_0xf923('0x2f')](function(_0x229dd9){if(_0x229dd9)return _0x229dd9;if(_0x45d41e[_0xf923('0x3f')]!=_0xf923('0x50')){return createEndUser(_0x172e9f,_0x5c80ba,_0x43bcf8,_0x152176,_0xea614e,_0x45d41e);}else{return{};}});break;case _0xf923('0x51'):_0x2ba784['uri']='https://www.zohoapis.'+_0x5c80ba+_0xf923('0x4e')+_0x152176+'))';return getZohoUser(_0x2ba784,_0xf923('0x4f'))[_0xf923('0x2f')](function(_0x443d61){if(_0x443d61)return _0x443d61;if(_0x45d41e[_0xf923('0x3f')]!=_0xf923('0x50')){return createEndUser(_0x172e9f,_0x5c80ba,_0x43bcf8,_0x152176,_0xea614e,_0x45d41e);}else{return{};}});break;}}function getCall(_0x31ae93,_0x8acd5d,_0x3a6dd6,_0x577bf6,_0x3c9626,_0x3f5c84,_0x137c19,_0x20a192){logger[_0xf923('0x2c')]('Creating\x20new\x20call...');var _0x366a4f={};_0x366a4f['Owner']={'name':!_['isNil'](_0x577bf6[_0xf923('0x40')][_0xf923('0x19')])&&!_[_0xf923('0x32')](_0x577bf6['profile']['name'])&&_0x577bf6[_0xf923('0x36')][_0xf923('0x19')]===_0xf923('0x52')?_0x577bf6[_0xf923('0x40')][_0xf923('0x19')]:!_['isNil'](_0x577bf6[_0xf923('0x41')])?_0x577bf6['first_name']+'\x20'+_0x577bf6['last_name']:_0x577bf6['last_name'],'id':_0x577bf6['id']};_0x366a4f[_0xf923('0x53')]=intUtil[_0xf923('0x54')](_0x3f5c84['Subjects'],_0x137c19,'\x20');_0x366a4f['Description']=intUtil['getString'](_0x3f5c84[_0xf923('0x55')],_0x137c19,'\x0a');if(_0x3c9626[_0xf923('0x56')]===_0xf923('0x4c')){_0x366a4f[_0xf923('0x57')]={'name':!_[_0xf923('0x32')](_0x3c9626[_0xf923('0x58')])?_0x3c9626['Full_Name']:!_[_0xf923('0x32')](_0x3c9626[_0xf923('0x59')])?_0x3c9626[_0xf923('0x59')]+'\x20'+_0x3c9626[_0xf923('0x5a')]:_0x3c9626[_0xf923('0x5a')],'id':_0x3c9626['id']};}if(_0x3c9626[_0xf923('0x56')]===_0xf923('0x4f')){_0x366a4f[_0xf923('0x5b')]={'name':!_['isNil'](_0x3c9626[_0xf923('0x58')])?_0x3c9626[_0xf923('0x58')]:!_[_0xf923('0x32')](_0x3c9626[_0xf923('0x59')])?_0x3c9626[_0xf923('0x59')]+'\x20'+_0x3c9626[_0xf923('0x5a')]:_0x3c9626[_0xf923('0x5a')],'id':_0x3c9626['id']};_0x366a4f[_0xf923('0x5c')]=_[_0xf923('0x3e')](_0x3c9626[_0xf923('0x56')]);}if(_0x137c19['talktime']){_0x366a4f['Call_Duration']=moment[_0xf923('0x5d')](parseInt(_0x137c19[_0xf923('0x5e')])*0x3e8)['format'](_0xf923('0x5f'));}else if(_0x137c19[_0xf923('0x60')]&&_0x137c19[_0xf923('0x61')]){_0x366a4f[_0xf923('0x62')]=moment['utc'](moment(_0x137c19[_0xf923('0x61')],_0xf923('0x63'))['diff'](moment(_0x137c19[_0xf923('0x64')],_0xf923('0x63'))))[_0xf923('0x2d')](_0xf923('0x5f'));}switch(_0x137c19[_0xf923('0x65')]){case _0xf923('0x66'):_0x366a4f['Call_Result']=_0xf923('0x67');break;case _0xf923('0x68'):case _0xf923('0x69'):_0x366a4f[_0xf923('0x6a')]=_0xf923('0x6b');break;case'rejected':_0x366a4f[_0xf923('0x6a')]=_0xf923('0x6c');break;case _0xf923('0x6d'):_0x366a4f[_0xf923('0x6a')]=_0xf923('0x6e');break;case _0xf923('0x6f'):_0x366a4f['Call_Result']='Timeout';default:}_0x366a4f[_0xf923('0x70')]=(_0x20a192===_0xf923('0x71')?moment(_0x137c19[_0xf923('0x64')])[_0xf923('0x2d')](_0xf923('0x63')):moment(_0x137c19['agentcalledAt'])[_0xf923('0x2d')](_0xf923('0x63')))||moment()[_0xf923('0x2d')]('YYYY-MM-DDTHH:mm:ss');_0x366a4f[_0xf923('0x72')]=_0x20a192||_0xf923('0x73');_0x366a4f=_['merge'](_0x366a4f,getCustomFields(_0x3f5c84[_0xf923('0x74')],_0x137c19));return request({'method':_0xf923('0x23'),'uri':_0xf923('0x3d')+_0x8acd5d+_0xf923('0x75'),'headers':{'Authorization':_0xf923('0x49')+_0x31ae93},'body':{'data':[_0x366a4f]},'json':!![]})[_0xf923('0x2f')](function(_0x1ac922){if(_0x1ac922&&_0x1ac922[_0xf923('0x3c')][0x0][_0xf923('0x43')]===_0xf923('0x76')){logger[_0xf923('0x2c')](_0xf923('0x77'));return{'id':_0x1ac922[_0xf923('0x3c')][0x0]['details']['id']};}})['catch'](function(_0x449366){logger['info'](_0xf923('0x78'),_0x449366[_0xf923('0x79')]);console[_0xf923('0x46')](_0xf923('0x78'),_0x449366);});}exports[_0xf923('0x7a')]=function(_0x4f589b,_0x247c79,_0xc23758,_0x40af24,_0x187306,_0x4c5e2a){var _0x46057b,_0x17b532,_0x1c5c08;_0x4c5e2a['host']=intUtil[_0xf923('0x7b')](_0x4c5e2a[_0xf923('0x7c')]);_0x4c5e2a['serverUrl']=intUtil[_0xf923('0x7b')](_0x4c5e2a['serverUrl']);if(_0x187306&&_0x187306[_0xf923('0x7d')]){logger['info'](_0xf923('0x7e'),_0xf923('0x7f'));_0x247c79[_0xf923('0x80')]=_0x4c5e2a[_0xf923('0x81')]+'/api/voice/recordings/'+_0x247c79['uniqueid']+_0xf923('0x82')+md5(_0x247c79[_0xf923('0x83')]);}else{_0x247c79[_0xf923('0x80')]='';}var _0x2e95cd=_0x4c5e2a[_0xf923('0x7c')]===_0xf923('0x84')?'eu':_0xf923('0x85');return getAccessToken(_0x4c5e2a)[_0xf923('0x2f')](function(_0x2e79d2){_0x1c5c08=_0x2e79d2;return getUser(_0x1c5c08,_0x2e95cd,_0x4c5e2a,_0x40af24['email']);})[_0xf923('0x2f')](function(_0x41b5f1){_0x46057b=_0x41b5f1;logger[_0xf923('0x2c')](_0xf923('0x86'),_0x46057b['id']);return getEndUser(_0x1c5c08,_0x2e95cd,_0x4c5e2a,_0x247c79[_0xf923('0x87')],_0x247c79[_0xf923('0x88')],_0x46057b,_0xc23758);})[_0xf923('0x2f')](function(_0x4b5b24){_0x17b532=_0x4b5b24;return getCall(_0x1c5c08,_0x2e95cd,_0x4c5e2a,_0x46057b,_0x17b532,_0xc23758,_0x247c79,_0xf923('0x73'));})['then'](function(_0x57b1c4){if(_0x57b1c4){logger[_0xf923('0x2c')](_0xf923('0x89'),_0x57b1c4['id']);logger[_0xf923('0x2c')](_0xf923('0x7e'),_0xf923('0x8a'));emit(util[_0xf923('0x2d')]('user:%s',_0x40af24[_0xf923('0x19')]),_0xf923('0x8b'),{'uri':_0xf923('0x8c')+_0x4c5e2a[_0xf923('0x7c')]+_0xf923('0x8d')+_0x57b1c4['id']});}})['catch'](function(_0x333504){logger[_0xf923('0x2a')](_0xf923('0x7e'),JSON[_0xf923('0x3a')](_0x333504));});};exports[_0xf923('0x71')]=function(_0xb04f2f,_0x420f85,_0x191110,_0x3ffb97,_0x330a8b,_0x48aff4,_0x52e295){var _0x1234e2,_0x4d1a21,_0x1222b2;_0x48aff4[_0xf923('0x7c')]=intUtil['stripTrailingSlash'](_0x48aff4['host']);_0x48aff4['serverUrl']=intUtil[_0xf923('0x7b')](_0x48aff4['serverUrl']);if(_0x52e295&&_0x52e295[_0xf923('0x8e')]&&_0x52e295[_0xf923('0x8e')]!==_0xf923('0x8f')){logger[_0xf923('0x2c')](_0xf923('0x90'),_0xf923('0x7f'));_0x420f85[_0xf923('0x80')]=_0x48aff4[_0xf923('0x81')]+_0xf923('0x91')+_0x420f85[_0xf923('0x83')]+_0xf923('0x82')+md5(_0x420f85[_0xf923('0x83')]);}var _0x2c036e=_0x48aff4[_0xf923('0x7c')]===_0xf923('0x84')?'eu':_0xf923('0x85');return getAccessToken(_0x48aff4)[_0xf923('0x2f')](function(_0x2011d2){_0x1222b2=_0x2011d2;return getUser(_0x1222b2,_0x2c036e,_0x48aff4,_0x3ffb97[_0xf923('0x34')]);})[_0xf923('0x2f')](function(_0x3c4c9b){_0x1234e2=_0x3c4c9b;logger[_0xf923('0x2c')]('The\x20User\x20ID\x20is:',_0x1234e2['id']);return getEndUser(_0x1222b2,_0x2c036e,_0x48aff4,_0x420f85['destcalleridname'],_0x420f85[_0xf923('0x92')],_0x1234e2,_0x191110);})[_0xf923('0x2f')](function(_0x355410){_0x4d1a21=_0x355410;return getCall(_0x1222b2,_0x2c036e,_0x48aff4,_0x1234e2,_0x4d1a21,_0x191110,_0x420f85,_0xf923('0x93'));})['then'](function(_0x2dce20){if(_0x2dce20){logger[_0xf923('0x2c')](_0xf923('0x89'),_0x2dce20['id']);logger[_0xf923('0x2c')](_0xf923('0x90'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf923('0x2d')](_0xf923('0x94'),_0x3ffb97[_0xf923('0x19')]),_0xf923('0x8b'),{'uri':_0xf923('0x8c')+_0x48aff4[_0xf923('0x7c')]+_0xf923('0x8d')+_0x2dce20['id']});}})[_0xf923('0x29')](function(_0xd1df82){logger['error'](_0xf923('0x90'),JSON[_0xf923('0x3a')](_0xd1df82));});};exports[_0xf923('0x95')]=function(_0x20cc1d,_0x2d8e8b,_0x280b13,_0xeba518,_0x6a0104,_0x1d561e){var _0x8b37a9,_0x41659d,_0x1a7e44;_0x1d561e[_0xf923('0x7c')]=intUtil[_0xf923('0x7b')](_0x1d561e[_0xf923('0x7c')]);_0x1d561e[_0xf923('0x81')]=intUtil[_0xf923('0x7b')](_0x1d561e[_0xf923('0x81')]);if(_0x6a0104&&_0x6a0104['monitor_format']){logger['info']('['+_0x2d8e8b[_0xf923('0x65')]['toUpperCase']()+']',_0xf923('0x7f'));_0x2d8e8b[_0xf923('0x80')]=_0x1d561e[_0xf923('0x81')]+_0xf923('0x91')+_0x2d8e8b[_0xf923('0x83')]+_0xf923('0x82')+md5(_0x2d8e8b[_0xf923('0x83')]);}else{_0x2d8e8b[_0xf923('0x80')]='';}var _0x538e6b=_0x1d561e['host']==='zoho.eu'?'eu':_0xf923('0x85');return getAccessToken(_0x1d561e)['then'](function(_0x1bf66d){_0x1a7e44=_0x1bf66d;return getUser(_0x1a7e44,_0x538e6b,_0x1d561e);})[_0xf923('0x2f')](function(_0x155a2d){_0x8b37a9=_0x155a2d;logger[_0xf923('0x2c')](_0xf923('0x86'),_0x8b37a9['id']);return getEndUser(_0x1a7e44,_0x538e6b,_0x1d561e,_0x2d8e8b[_0xf923('0x87')],_0x2d8e8b[_0xf923('0x88')],_0x8b37a9,_0x280b13);})[_0xf923('0x2f')](function(_0x2f3232){_0x41659d=_0x2f3232;return getCall(_0x1a7e44,_0x538e6b,_0x1d561e,_0x8b37a9,_0x41659d,_0x280b13,_0x2d8e8b,'Inbound');})['then'](function(_0x280422){if(_0x280422){logger[_0xf923('0x2c')](_0xf923('0x89'),_0x280422['id']);}})[_0xf923('0x29')](function(_0x5b8b08){logger[_0xf923('0x2a')]('['+_0x2d8e8b[_0xf923('0x65')]['toUpperCase']()+']',JSON[_0xf923('0x3a')](_0x5b8b08));});}; \ 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 d873128..9d3c9fc 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 _0x8d3d=['shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info'];(function(_0x3c2abc,_0x2ced12){var _0x34be33=function(_0x519b81){while(--_0x519b81){_0x3c2abc['push'](_0x3c2abc['shift']());}};_0x34be33(++_0x2ced12);}(_0x8d3d,0x1ee));var _0xd8d3=function(_0x13bb76,_0x39491f){_0x13bb76=_0x13bb76-0x0;var _0x2cbfb4=_0x8d3d[_0x13bb76];return _0x2cbfb4;};'use strict';var util=require('util');var sh=require(_0xd8d3('0x0'));var Mustache=require(_0xd8d3('0x1'));var logger=require(_0xd8d3('0x2'))(_0xd8d3('0x3'));exports[_0xd8d3('0x4')]=function(_0x1f4d6f,_0x433b98){var _0x2eb18d=_0x1f4d6f[_0xd8d3('0x5')]?_0x1f4d6f[_0xd8d3('0x5')]:_0xd8d3('0x6');var _0x299173=_0x1f4d6f[_0xd8d3('0x7')]?Mustache[_0xd8d3('0x8')](_0x1f4d6f[_0xd8d3('0x7')],_0x433b98):_0x433b98;sh[_0xd8d3('0x4')](_0x299173,function(_0x3c5b3c,_0x5dfb75,_0x586a25){if(_0x3c5b3c!==0x0){logger[_0xd8d3('0x9')](util[_0xd8d3('0xa')](_0xd8d3('0xb'),_0x2eb18d,_0x299173,_0x3c5b3c,_0x586a25));}else{logger[_0xd8d3('0xc')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x2eb18d,_0x299173,_0x5dfb75));}});}; \ No newline at end of file +var _0x0f58=['util','shelljs','../../../../config/logger','trigger','exec','Script','render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f58,0x104));var _0x80f5=function(_0x46012c,_0x66bacf){_0x46012c=_0x46012c-0x0;var _0x26d30f=_0x0f58[_0x46012c];return _0x26d30f;};'use strict';var util=require(_0x80f5('0x0'));var sh=require(_0x80f5('0x1'));var Mustache=require('mustache');var logger=require(_0x80f5('0x2'))(_0x80f5('0x3'));exports[_0x80f5('0x4')]=function(_0x28339f,_0x28842f){var _0x30c6f5=_0x28339f['data2']?_0x28339f['data2']:_0x80f5('0x5');var _0x4c1803=_0x28339f['data3']?Mustache[_0x80f5('0x6')](_0x28339f[_0x80f5('0x7')],_0x28842f):_0x28842f;sh['exec'](_0x4c1803,function(_0x3e68b2,_0x1c2d85,_0x3ac6fe){if(_0x3e68b2!==0x0){logger[_0x80f5('0x8')](util[_0x80f5('0x9')](_0x80f5('0xa'),_0x30c6f5,_0x4c1803,_0x3e68b2,_0x3ac6fe));}else{logger[_0x80f5('0xb')](util[_0x80f5('0x9')](_0x80f5('0xc'),_0x30c6f5,_0x4c1803,_0x1c2d85));}});}; \ 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 2487906..9437602 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 _0x0e25=['data2','data5','number','headers','parse','data6','error','DELETE','POST','body','stack','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','message','request-promise','util','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render'];(function(_0x2898cf,_0x3ba370){var _0x474e4c=function(_0x55352f){while(--_0x55352f){_0x2898cf['push'](_0x2898cf['shift']());}};_0x474e4c(++_0x3ba370);}(_0x0e25,0xef));var _0x50e2=function(_0x5ab9c7,_0x45d524){_0x5ab9c7=_0x5ab9c7-0x0;var _0x4ecbe7=_0x0e25[_0x5ab9c7];return _0x4ecbe7;};'use strict';var rp=require(_0x50e2('0x0'));var util=require(_0x50e2('0x1'));var _=require('lodash');var Mustache=require(_0x50e2('0x2'));var logger=require(_0x50e2('0x3'))(_0x50e2('0x4'));exports[_0x50e2('0x5')]=function(_0x98d147,_0x5a30b6){var _0x4f210d,_0x2483b9;var _0x2d1e40={'method':_0x98d147[_0x50e2('0x6')][_0x50e2('0x7')](),'uri':Mustache[_0x50e2('0x8')](_0x98d147[_0x50e2('0x9')],_0x5a30b6),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x98d147[_0x50e2('0xa')])===_0x50e2('0xb')&&parseInt(_0x98d147[_0x50e2('0xa')])>=0x1&&parseInt(_0x98d147[_0x50e2('0xa')])<=0xa?parseInt(_0x98d147['data5'])*0x3e8:0x5*0x3e8};try{_0x2d1e40[_0x50e2('0xc')]=_0x98d147['data6']?JSON[_0x50e2('0xd')](Mustache['render'](_0x98d147[_0x50e2('0xe')],_0x5a30b6)):{};}catch(_0x31a337){logger[_0x50e2('0xf')](_0x31a337['stack']);}switch(_0x98d147['data1'][_0x50e2('0x7')]()){case'GET':case _0x50e2('0x10'):_0x4f210d=null;_0x2d1e40['qs']=_0x5a30b6;break;case _0x50e2('0x11'):case'PUT':if(_0x98d147['data7']){try{_0x4f210d=JSON[_0x50e2('0xd')](Mustache[_0x50e2('0x8')](_0x98d147['data7'],_0x5a30b6));_0x2d1e40[_0x50e2('0x12')]=_0x4f210d;}catch(_0x90d53d){logger[_0x50e2('0xf')](_0x90d53d[_0x50e2('0x13')]);logger[_0x50e2('0xf')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x4f210d=_0x5a30b6;_0x2d1e40[_0x50e2('0x12')]=_0x4f210d;}break;}logger[_0x50e2('0x14')](util[_0x50e2('0x15')](_0x50e2('0x16'),_0x98d147['data1'],_0x98d147[_0x50e2('0x9')],JSON['stringify'](_0x2d1e40)));rp(_0x2d1e40)[_0x50e2('0x17')](function(_0x48e4d5){_0x4f210d=!_[_0x50e2('0x18')](_0x4f210d)?_0x50e2('0x19')+_0x4f210d:'';_0x2483b9=typeof _0x48e4d5[_0x50e2('0x12')]===_0x50e2('0x1a')?JSON['stringify'](_0x48e4d5[_0x50e2('0x12')]):_0x48e4d5['body'];logger[_0x50e2('0x14')](util[_0x50e2('0x15')](_0x50e2('0x1b'),_0x98d147['data1'],_0x98d147[_0x50e2('0x9')],_0x48e4d5[_0x50e2('0x1c')],_0x2483b9));})['catch'](function(_0x303b9b){logger[_0x50e2('0xf')](util[_0x50e2('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x98d147[_0x50e2('0x6')],_0x98d147[_0x50e2('0x9')],_0x303b9b[_0x50e2('0x1c')],_0x303b9b[_0x50e2('0x1d')],_0x303b9b[_0x50e2('0x1e')]));});}; \ No newline at end of file +var _0x7ad9=['data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','object','info','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','../../../../config/logger','exec','data1','toUpperCase','render','number','data5','headers','data6','parse','error','stack','GET','DELETE','POST'];(function(_0xdcbb99,_0x5af4ca){var _0x55ca74=function(_0x2662a3){while(--_0x2662a3){_0xdcbb99['push'](_0xdcbb99['shift']());}};_0x55ca74(++_0x5af4ca);}(_0x7ad9,0x6e));var _0x97ad=function(_0x4cfe1a,_0x4a8bb0){_0x4cfe1a=_0x4cfe1a-0x0;var _0x48ce16=_0x7ad9[_0x4cfe1a];return _0x48ce16;};'use strict';var rp=require(_0x97ad('0x0'));var util=require(_0x97ad('0x1'));var _=require(_0x97ad('0x2'));var Mustache=require('mustache');var logger=require(_0x97ad('0x3'))('trigger');exports[_0x97ad('0x4')]=function(_0x5a673b,_0x4525a2){var _0x1a2410,_0x49d393;var _0x5062e8={'method':_0x5a673b[_0x97ad('0x5')][_0x97ad('0x6')](),'uri':Mustache[_0x97ad('0x7')](_0x5a673b['data2'],_0x4525a2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5a673b['data5'])===_0x97ad('0x8')&&parseInt(_0x5a673b[_0x97ad('0x9')])>=0x1&&parseInt(_0x5a673b[_0x97ad('0x9')])<=0xa?parseInt(_0x5a673b[_0x97ad('0x9')])*0x3e8:0x5*0x3e8};try{_0x5062e8[_0x97ad('0xa')]=_0x5a673b[_0x97ad('0xb')]?JSON[_0x97ad('0xc')](Mustache[_0x97ad('0x7')](_0x5a673b[_0x97ad('0xb')],_0x4525a2)):{};}catch(_0x25001b){logger[_0x97ad('0xd')](_0x25001b[_0x97ad('0xe')]);}switch(_0x5a673b['data1']['toUpperCase']()){case _0x97ad('0xf'):case _0x97ad('0x10'):_0x1a2410=null;_0x5062e8['qs']=_0x4525a2;break;case _0x97ad('0x11'):case'PUT':if(_0x5a673b[_0x97ad('0x12')]){try{_0x1a2410=JSON['parse'](Mustache['render'](_0x5a673b['data7'],_0x4525a2));_0x5062e8[_0x97ad('0x13')]=_0x1a2410;}catch(_0x4f8064){logger[_0x97ad('0xd')](_0x4f8064[_0x97ad('0xe')]);logger[_0x97ad('0xd')](_0x97ad('0x14'));}}else{_0x1a2410=_0x4525a2;_0x5062e8[_0x97ad('0x13')]=_0x1a2410;}break;}logger['info'](util[_0x97ad('0x15')](_0x97ad('0x16'),_0x5a673b[_0x97ad('0x5')],_0x5a673b[_0x97ad('0x17')],JSON[_0x97ad('0x18')](_0x5062e8)));rp(_0x5062e8)[_0x97ad('0x19')](function(_0x2d4122){_0x1a2410=!_['isNil'](_0x1a2410)?',\x20request\x20body:\x20'+_0x1a2410:'';_0x49d393=typeof _0x2d4122[_0x97ad('0x13')]===_0x97ad('0x1a')?JSON[_0x97ad('0x18')](_0x2d4122[_0x97ad('0x13')]):_0x2d4122[_0x97ad('0x13')];logger[_0x97ad('0x1b')](util[_0x97ad('0x15')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x5a673b['data1'],_0x5a673b[_0x97ad('0x17')],_0x2d4122[_0x97ad('0x1c')],_0x49d393));})[_0x97ad('0x1d')](function(_0x5f19a2){logger[_0x97ad('0xd')](util['format'](_0x97ad('0x1e'),_0x5a673b[_0x97ad('0x5')],_0x5a673b[_0x97ad('0x17')],_0x5f19a2['statusCode'],_0x5f19a2['name'],_0x5f19a2[_0x97ad('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 2ab4b60..d051cc1 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 _0x7ba3=['http','request','then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x178b4e,_0x3810c2){var _0x176a81=function(_0x490fc4){while(--_0x490fc4){_0x178b4e['push'](_0x178b4e['shift']());}};_0x176a81(++_0x3810c2);}(_0x7ba3,0x89));var _0x37ba=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x7ba3[_0x53b8e0];return _0x10630c;};'use strict';var jayson=require(_0x37ba('0x0'));var BPromise=require(_0x37ba('0x1'));var logger=require(_0x37ba('0x2'))('routing');var client=jayson['client'][_0x37ba('0x3')]({'port':0x2329});client['Request']=function(_0x4804fe,_0x167888){return new BPromise(function(_0x1d24a9,_0x263c2b){return client[_0x37ba('0x4')](_0x4804fe,_0x167888)[_0x37ba('0x5')](function(_0x300f4c){logger[_0x37ba('0x6')](_0x37ba('0x7'),_0x37ba('0x8'),_0x4804fe,_0x167888,_0x300f4c);if(_0x300f4c[_0x37ba('0x9')]){logger[_0x37ba('0x9')](_0x37ba('0x7'),_0x37ba('0x8'),_0x4804fe,_0x300f4c[_0x37ba('0x9')][_0x37ba('0xa')],_0x167888);return _0x263c2b(_0x300f4c[_0x37ba('0x9')]['message']);}else{return _0x1d24a9(_0x300f4c[_0x37ba('0xb')]);}})[_0x37ba('0xc')](function(_0x4a4289){logger[_0x37ba('0x9')]('rpc','routing',_0x4804fe,_0x4a4289,_0x167888);return _0x263c2b(_0x4a4289);});});};module[_0x37ba('0xd')]=client; \ No newline at end of file +var _0x4aaa=['debug','routing','error','message','result','catch','rpc','exports','bluebird','../../config/logger','client','http','request'];(function(_0x11020f,_0x4321ed){var _0x1e82e1=function(_0x249d81){while(--_0x249d81){_0x11020f['push'](_0x11020f['shift']());}};_0x1e82e1(++_0x4321ed);}(_0x4aaa,0xe5));var _0xa4aa=function(_0x57ac76,_0x8f28c2){_0x57ac76=_0x57ac76-0x0;var _0x2a5453=_0x4aaa[_0x57ac76];return _0x2a5453;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa4aa('0x0'));var logger=require(_0xa4aa('0x1'))('routing');var client=jayson[_0xa4aa('0x2')][_0xa4aa('0x3')]({'port':0x2329});client['Request']=function(_0x1c8fd3,_0x232741){return new BPromise(function(_0x1fd893,_0x5391d2){return client[_0xa4aa('0x4')](_0x1c8fd3,_0x232741)['then'](function(_0xc6e3e2){logger[_0xa4aa('0x5')]('rpc',_0xa4aa('0x6'),_0x1c8fd3,_0x232741,_0xc6e3e2);if(_0xc6e3e2[_0xa4aa('0x7')]){logger[_0xa4aa('0x7')]('rpc',_0xa4aa('0x6'),_0x1c8fd3,_0xc6e3e2[_0xa4aa('0x7')][_0xa4aa('0x8')],_0x232741);return _0x5391d2(_0xc6e3e2[_0xa4aa('0x7')][_0xa4aa('0x8')]);}else{return _0x1fd893(_0xc6e3e2[_0xa4aa('0x9')]);}})[_0xa4aa('0xa')](function(_0x43d646){logger[_0xa4aa('0x7')](_0xa4aa('0xb'),_0xa4aa('0x6'),_0x1c8fd3,_0x43d646,_0x232741);return _0x5391d2(_0x43d646);});});};module[_0xa4aa('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index e20f2e5..7143e7c 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 _0xfaf0=['./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x37924b,_0x57761d){var _0x2fe583=function(_0x3ac8f7){while(--_0x3ac8f7){_0x37924b['push'](_0x37924b['shift']());}};_0x2fe583(++_0x57761d);}(_0xfaf0,0x19e));var _0x0faf=function(_0xcaa633,_0x2ca23b){_0xcaa633=_0xcaa633-0x0;var _0x288cf6=_0xfaf0[_0xcaa633];return _0x288cf6;};'use strict';var server=require(_0x0faf('0x0'));var Realtime=require(_0x0faf('0x1'));var EmailChannel=require(_0x0faf('0x2'));var mailAccount=require(_0x0faf('0x3'));var setting=require(_0x0faf('0x4'));var logger=require(_0x0faf('0x5'))(_0x0faf('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x0faf('0x7')](mailAccount[_0x0faf('0x8')]())[_0x0faf('0x7')](realtime[_0x0faf('0x9')]())['then'](function(){email[_0x0faf('0xa')](realtime[_0x0faf('0xb')]);return realtime;});}function main(){return server[_0x0faf('0xc')](realtime,email)[_0x0faf('0x7')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x0faf('0x7')](function(_0x5cc8d4){return setInterval(initRealtime,_0x5cc8d4[_0x0faf('0xd')]*0x3e8);})['catch'](function(_0x368625){logger[_0x0faf('0xe')](_0x0faf('0xf'),_0x368625);});}main(); \ No newline at end of file +var _0x7967=['catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency'];(function(_0x254c6d,_0x5116ae){var _0x1aeb44=function(_0x18bc72){while(--_0x18bc72){_0x254c6d['push'](_0x254c6d['shift']());}};_0x1aeb44(++_0x5116ae);}(_0x7967,0xed));var _0x7796=function(_0x26c7e7,_0x2238f9){_0x26c7e7=_0x26c7e7-0x0;var _0x127bfc=_0x7967[_0x26c7e7];return _0x127bfc;};'use strict';var server=require(_0x7796('0x0'));var Realtime=require(_0x7796('0x1'));var EmailChannel=require(_0x7796('0x2'));var mailAccount=require(_0x7796('0x3'));var setting=require(_0x7796('0x4'));var logger=require(_0x7796('0x5'))(_0x7796('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7796('0x7')]()[_0x7796('0x8')](mailAccount[_0x7796('0x9')]())[_0x7796('0x8')](realtime['initMailAccounts']())[_0x7796('0x8')](function(){email[_0x7796('0xa')](realtime[_0x7796('0xb')]);return realtime;});}function main(){return server[_0x7796('0xc')](realtime,email)['then'](function(){return initRealtime();})[_0x7796('0x8')](function(){return setting[_0x7796('0xd')]();})['then'](function(_0x2225f6){return setInterval(initRealtime,_0x2225f6[_0x7796('0xe')]*0x3e8);})[_0x7796('0xf')](function(_0x33a2c7){logger[_0x7796('0x10')](_0x7796('0x11'),_0x33a2c7);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 39ef393..39a8590 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 _0x2d1e=['lastSync','handleImapError','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','key','active','status','Imap','total','isNil','mailAccount:update','hasOwnProperty','service','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','connected','messageStatus','name','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','stringify'];(function(_0x559c26,_0x4073f6){var _0x21896a=function(_0x1f967b){while(--_0x1f967b){_0x559c26['push'](_0x559c26['shift']());}};_0x21896a(++_0x4073f6);}(_0x2d1e,0x15d));var _0xe2d1=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x2d1e[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0xe2d1('0x0'));var moment=require(_0xe2d1('0x1'));var BPromise=require(_0xe2d1('0x2'));var md5=require(_0xe2d1('0x3'));var Redis=require(_0xe2d1('0x4'));var config=require(_0xe2d1('0x5'));var logger=require(_0xe2d1('0x6'))(_0xe2d1('0x7'));config['redis']=_[_0xe2d1('0x8')](config['redis'],{'host':_0xe2d1('0x9'),'port':0x18eb});var io=require(_0xe2d1('0xa'))(new Redis(config[_0xe2d1('0xb')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xe2d1('0xc'));var mailAccount=require(_0xe2d1('0xd'));var md5Accounts={};function EmailChannel(_0xeff721){logger['info'](_0xe2d1('0xe'));this[_0xe2d1('0xf')]=_0xeff721[_0xe2d1('0xf')];this['imapAccounts']={};this[_0xe2d1('0x10')]=new EmailSmtp();}EmailChannel[_0xe2d1('0x11')][_0xe2d1('0x12')]=function(_0x424607){var _0x1e299=this[_0xe2d1('0xf')][_0x424607];var _0x464cfb={'id':_0x1e299['id'],'name':_0x1e299['name'],'key':_0x1e299[_0xe2d1('0x13')],'active':_0x1e299[_0xe2d1('0x14')],'Imap':{'status':_0x1e299['Imap'][_0xe2d1('0x15')],'messageStatus':_0x1e299['Imap']['messageStatus'],'total':_0x1e299[_0xe2d1('0x16')][_0xe2d1('0x17')]}};if(_[_0xe2d1('0x18')](md5Accounts[_0x424607])){md5Accounts[_0x424607]={};}var _0x428499=md5(JSON['stringify'](_0x464cfb));if(md5Accounts[_0x424607][_0xe2d1('0x3')]!==_0x428499){md5Accounts[_0x424607][_0xe2d1('0x3')]=_0x428499;io['emit'](_0xe2d1('0x19'),_0x464cfb);}};EmailChannel[_0xe2d1('0x11')]['refresh']=function(_0x50cbb6){for(var _0x593ff3 in _0x50cbb6){if(_0x50cbb6[_0xe2d1('0x1a')](_0x593ff3)){if(_0x50cbb6[_0x593ff3]['Imap']&&_0x50cbb6[_0x593ff3][_0xe2d1('0x14')]){var _0x47463b=_0x50cbb6[_0x593ff3][_0xe2d1('0x16')];if(!_0x47463b[_0xe2d1('0x1b')]&&_0x50cbb6[_0x593ff3]['provider']!=='custom')_0x47463b[_0xe2d1('0x1b')]=_0x50cbb6[_0x593ff3][_0xe2d1('0x1c')];if(!this[_0xe2d1('0x1d')]['hasOwnProperty'](_0x47463b['id'])){this['imapAccounts'][_0x47463b['id']]=new EmailImap(_0x47463b,_0x50cbb6[_0x593ff3]['email']);this[_0xe2d1('0x1d')][_0x47463b['id']]['on'](_0xe2d1('0x1e'),this[_0xe2d1('0x1f')][_0xe2d1('0x20')](this,_0x593ff3));this[_0xe2d1('0x1d')][_0x47463b['id']]['on'](_0xe2d1('0x7'),this[_0xe2d1('0x21')][_0xe2d1('0x20')](this,_0x593ff3));this[_0xe2d1('0x1d')][_0x47463b['id']]['on'](_0xe2d1('0x22'),this[_0xe2d1('0x23')][_0xe2d1('0x20')](this,_0x593ff3));this['imapAccounts'][_0x47463b['id']]['on'](_0xe2d1('0x24'),this['handleImapError'][_0xe2d1('0x20')](this,_0x593ff3));}}else{if(_['isNil'](this[_0xe2d1('0xf')][_0x593ff3][_0xe2d1('0x16')])){this[_0xe2d1('0xf')][_0x593ff3]['Imap']={};}this['mailAccounts'][_0x593ff3][_0xe2d1('0x16')]['status']=_0xe2d1('0x25');this[_0xe2d1('0xf')][_0x593ff3][_0xe2d1('0x16')]['messageStatus']='';this[_0xe2d1('0x12')](_0x593ff3);}}}};EmailChannel[_0xe2d1('0x11')][_0xe2d1('0x1f')]=function(_0x564e0b,_0x412f74){if(this['mailAccounts'][_0x564e0b]){this[_0xe2d1('0xf')][_0x564e0b][_0xe2d1('0x16')][_0xe2d1('0x15')]=_0xe2d1('0x26');this[_0xe2d1('0xf')][_0x564e0b][_0xe2d1('0x16')][_0xe2d1('0x27')]=_0x412f74[_0xe2d1('0x28')];if(_0x412f74[_0xe2d1('0x29')]){this[_0xe2d1('0xf')][_0x564e0b][_0xe2d1('0x16')]['total']=_0x412f74[_0xe2d1('0x29')][_0xe2d1('0x17')];}return this[_0xe2d1('0x12')](_0x564e0b);}};EmailChannel[_0xe2d1('0x11')][_0xe2d1('0x21')]=function(_0xf203c8,_0x297d91){logger[_0xe2d1('0x2a')](_0xe2d1('0x2b'),_0x297d91[_0xe2d1('0x2c')],_0x297d91[_0xe2d1('0x2d')],_0x297d91[_0xe2d1('0x2e')],_0xf203c8);if(this['mailAccounts'][_0xf203c8]){return mailAccount[_0xe2d1('0x2f')](_0xf203c8,_0x297d91)['then'](function(_0x5c4910){if(_0x5c4910){logger[_0xe2d1('0x2a')](_0xe2d1('0x30'));}})['catch'](function(_0x314b30){logger[_0xe2d1('0x24')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xe2d1('0x31')](_0x314b30));});}};EmailChannel[_0xe2d1('0x11')][_0xe2d1('0x23')]=function(_0x305caf){if(this['mailAccounts'][_0x305caf]&&this[_0xe2d1('0xf')][_0x305caf]['Imap']){if(this['imapAccounts'][this[_0xe2d1('0xf')][_0x305caf][_0xe2d1('0x16')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x305caf][_0xe2d1('0x16')]['id']];}this[_0xe2d1('0xf')][_0x305caf][_0xe2d1('0x16')][_0xe2d1('0x32')]=moment();this[_0xe2d1('0x12')](_0x305caf);}};EmailChannel[_0xe2d1('0x11')][_0xe2d1('0x33')]=function(_0x478c9d,_0x1af215){if(this[_0xe2d1('0xf')][_0x478c9d]){this[_0xe2d1('0xf')][_0x478c9d][_0xe2d1('0x16')][_0xe2d1('0x15')]=_0xe2d1('0x24');this[_0xe2d1('0xf')][_0x478c9d][_0xe2d1('0x16')]['messageStatus']=_0x1af215;return this[_0xe2d1('0x12')](_0x478c9d);}};EmailChannel[_0xe2d1('0x11')]['sendMail']=function(_0xb9bdd7,_0x572469){return this['smtp']['send'](_0xb9bdd7,_0x572469);};EmailChannel[_0xe2d1('0x11')][_0xe2d1('0x34')]=function(_0x80eb3b){var _0x134c9d=this;if(this[_0xe2d1('0xf')][_0x80eb3b['id']]){if(_[_0xe2d1('0x18')](this[_0xe2d1('0xf')][_0x80eb3b['id']]['Smtp'])){this[_0xe2d1('0xf')][_0x80eb3b['id']][_0xe2d1('0x35')]={};}this['mailAccounts'][_0x80eb3b['id']][_0xe2d1('0x35')][_0xe2d1('0x32')]=moment();return new BPromise(function(_0x146954,_0xf4d275){return _0x134c9d[_0xe2d1('0x10')][_0xe2d1('0x36')](_0x80eb3b)['then'](function(_0x569041){_0x134c9d[_0xe2d1('0xf')][_0x80eb3b['id']][_0xe2d1('0x35')][_0xe2d1('0x15')]=_0xe2d1('0x37');_0x134c9d['mailAccounts'][_0x80eb3b['id']][_0xe2d1('0x35')][_0xe2d1('0x27')]='';_0x134c9d[_0xe2d1('0x12')](_0x80eb3b['id']);_0x146954(_0x569041);})['catch'](function(_0x395bc7){_0x134c9d['mailAccounts'][_0x80eb3b['id']][_0xe2d1('0x35')]['status']='error';_0x134c9d[_0xe2d1('0xf')][_0x80eb3b['id']][_0xe2d1('0x35')][_0xe2d1('0x27')]=_0x395bc7;_0x134c9d[_0xe2d1('0x12')](_0x80eb3b['id']);_0xf4d275(_0x395bc7);});});}return this[_0xe2d1('0x10')][_0xe2d1('0x36')](_0x80eb3b);};module[_0xe2d1('0x38')]=EmailChannel; \ No newline at end of file +var _0xd731=['lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','moment','bluebird','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','custom','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName'];(function(_0x21aef3,_0x2637f0){var _0x40316c=function(_0x539b01){while(--_0x539b01){_0x21aef3['push'](_0x21aef3['shift']());}};_0x40316c(++_0x2637f0);}(_0xd731,0xbf));var _0x1d73=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd731[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1d73('0x0'));var moment=require(_0x1d73('0x1'));var BPromise=require(_0x1d73('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x1d73('0x3'))(_0x1d73('0x4'));config[_0x1d73('0x5')]=_[_0x1d73('0x6')](config[_0x1d73('0x5')],{'host':_0x1d73('0x7'),'port':0x18eb});var io=require(_0x1d73('0x8'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x1d73('0x9'));var mailAccount=require(_0x1d73('0xa'));var md5Accounts={};function EmailChannel(_0x1fdb3b){logger[_0x1d73('0xb')](_0x1d73('0xc'));this[_0x1d73('0xd')]=_0x1fdb3b['mailAccounts'];this[_0x1d73('0xe')]={};this[_0x1d73('0xf')]=new EmailSmtp();}EmailChannel[_0x1d73('0x10')][_0x1d73('0x11')]=function(_0x476712){var _0xf165fa=this[_0x1d73('0xd')][_0x476712];var _0x54f2d8={'id':_0xf165fa['id'],'name':_0xf165fa[_0x1d73('0x12')],'key':_0xf165fa[_0x1d73('0x13')],'active':_0xf165fa[_0x1d73('0x14')],'Imap':{'status':_0xf165fa[_0x1d73('0x15')][_0x1d73('0x16')],'messageStatus':_0xf165fa[_0x1d73('0x15')][_0x1d73('0x17')],'total':_0xf165fa[_0x1d73('0x15')]['total']}};if(_[_0x1d73('0x18')](md5Accounts[_0x476712])){md5Accounts[_0x476712]={};}var _0x4f77dc=md5(JSON[_0x1d73('0x19')](_0x54f2d8));if(md5Accounts[_0x476712]['md5']!==_0x4f77dc){md5Accounts[_0x476712]['md5']=_0x4f77dc;io[_0x1d73('0x11')](_0x1d73('0x1a'),_0x54f2d8);}};EmailChannel[_0x1d73('0x10')][_0x1d73('0x1b')]=function(_0x3e700a){for(var _0x1c3b3c in _0x3e700a){if(_0x3e700a[_0x1d73('0x1c')](_0x1c3b3c)){if(_0x3e700a[_0x1c3b3c]['Imap']&&_0x3e700a[_0x1c3b3c][_0x1d73('0x14')]){var _0x264771=_0x3e700a[_0x1c3b3c][_0x1d73('0x15')];if(!_0x264771[_0x1d73('0x1d')]&&_0x3e700a[_0x1c3b3c]['provider']!==_0x1d73('0x1e'))_0x264771[_0x1d73('0x1d')]=_0x3e700a[_0x1c3b3c][_0x1d73('0x1f')];if(!this[_0x1d73('0xe')][_0x1d73('0x1c')](_0x264771['id'])){this[_0x1d73('0xe')][_0x264771['id']]=new EmailImap(_0x264771,_0x3e700a[_0x1c3b3c][_0x1d73('0x4')]);this[_0x1d73('0xe')][_0x264771['id']]['on'](_0x1d73('0x20'),this[_0x1d73('0x21')][_0x1d73('0x22')](this,_0x1c3b3c));this[_0x1d73('0xe')][_0x264771['id']]['on'](_0x1d73('0x4'),this[_0x1d73('0x23')][_0x1d73('0x22')](this,_0x1c3b3c));this[_0x1d73('0xe')][_0x264771['id']]['on'](_0x1d73('0x24'),this[_0x1d73('0x25')][_0x1d73('0x22')](this,_0x1c3b3c));this[_0x1d73('0xe')][_0x264771['id']]['on'](_0x1d73('0x26'),this[_0x1d73('0x27')]['bind'](this,_0x1c3b3c));}}else{if(_[_0x1d73('0x18')](this[_0x1d73('0xd')][_0x1c3b3c][_0x1d73('0x15')])){this[_0x1d73('0xd')][_0x1c3b3c][_0x1d73('0x15')]={};}this[_0x1d73('0xd')][_0x1c3b3c]['Imap'][_0x1d73('0x16')]=_0x1d73('0x28');this[_0x1d73('0xd')][_0x1c3b3c]['Imap'][_0x1d73('0x17')]='';this[_0x1d73('0x11')](_0x1c3b3c);}}}};EmailChannel[_0x1d73('0x10')][_0x1d73('0x21')]=function(_0x1c6e69,_0x105197){if(this[_0x1d73('0xd')][_0x1c6e69]){this[_0x1d73('0xd')][_0x1c6e69][_0x1d73('0x15')][_0x1d73('0x16')]=_0x1d73('0x29');this[_0x1d73('0xd')][_0x1c6e69]['Imap'][_0x1d73('0x17')]=_0x105197[_0x1d73('0x12')];if(_0x105197['messages']){this[_0x1d73('0xd')][_0x1c6e69][_0x1d73('0x15')]['total']=_0x105197['messages'][_0x1d73('0x2a')];}return this[_0x1d73('0x11')](_0x1c6e69);}};EmailChannel[_0x1d73('0x10')][_0x1d73('0x23')]=function(_0x438323,_0x417436){logger[_0x1d73('0xb')](_0x1d73('0x2b'),_0x417436[_0x1d73('0x2c')],_0x417436[_0x1d73('0x2d')],_0x417436[_0x1d73('0x2e')],_0x438323);if(this['mailAccounts'][_0x438323]){return mailAccount[_0x1d73('0x2f')](_0x438323,_0x417436)[_0x1d73('0x30')](function(_0x58b104){if(_0x58b104){logger[_0x1d73('0xb')](_0x1d73('0x31'));}})[_0x1d73('0x32')](function(_0x40c3e0){logger['error'](_0x1d73('0x33'),JSON['stringify'](_0x40c3e0));});}};EmailChannel[_0x1d73('0x10')][_0x1d73('0x25')]=function(_0x1bf8d4){if(this[_0x1d73('0xd')][_0x1bf8d4]&&this[_0x1d73('0xd')][_0x1bf8d4]['Imap']){if(this['imapAccounts'][this[_0x1d73('0xd')][_0x1bf8d4][_0x1d73('0x15')]['id']]){delete this[_0x1d73('0xe')][this[_0x1d73('0xd')][_0x1bf8d4][_0x1d73('0x15')]['id']];}this[_0x1d73('0xd')][_0x1bf8d4][_0x1d73('0x15')][_0x1d73('0x34')]=moment();this[_0x1d73('0x11')](_0x1bf8d4);}};EmailChannel[_0x1d73('0x10')]['handleImapError']=function(_0xee961e,_0x514fba){if(this['mailAccounts'][_0xee961e]){this[_0x1d73('0xd')][_0xee961e][_0x1d73('0x15')]['status']=_0x1d73('0x26');this[_0x1d73('0xd')][_0xee961e][_0x1d73('0x15')][_0x1d73('0x17')]=_0x514fba;return this[_0x1d73('0x11')](_0xee961e);}};EmailChannel[_0x1d73('0x10')][_0x1d73('0x35')]=function(_0x45c9f2,_0x2b6115){return this[_0x1d73('0xf')][_0x1d73('0x36')](_0x45c9f2,_0x2b6115);};EmailChannel[_0x1d73('0x10')][_0x1d73('0x37')]=function(_0x18b988){var _0x4d4e9c=this;if(this['mailAccounts'][_0x18b988['id']]){if(_['isNil'](this[_0x1d73('0xd')][_0x18b988['id']][_0x1d73('0x38')])){this[_0x1d73('0xd')][_0x18b988['id']]['Smtp']={};}this[_0x1d73('0xd')][_0x18b988['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x532436,_0xf4c6c5){return _0x4d4e9c[_0x1d73('0xf')][_0x1d73('0x39')](_0x18b988)[_0x1d73('0x30')](function(_0x2f82e3){_0x4d4e9c[_0x1d73('0xd')][_0x18b988['id']][_0x1d73('0x38')][_0x1d73('0x16')]=_0x1d73('0x3a');_0x4d4e9c[_0x1d73('0xd')][_0x18b988['id']]['Smtp'][_0x1d73('0x17')]='';_0x4d4e9c[_0x1d73('0x11')](_0x18b988['id']);_0x532436(_0x2f82e3);})[_0x1d73('0x32')](function(_0x185aef){_0x4d4e9c[_0x1d73('0xd')][_0x18b988['id']][_0x1d73('0x38')][_0x1d73('0x16')]=_0x1d73('0x26');_0x4d4e9c[_0x1d73('0xd')][_0x18b988['id']]['Smtp']['messageStatus']=_0x185aef;_0x4d4e9c['emit'](_0x18b988['id']);_0xf4c6c5(_0x185aef);});});}return this['smtp']['verify'](_0x18b988);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index dadc448..79667c3 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 _0x5db4=['mailbox','getAccount','account','once','ready','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','handleReady','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','handleFetchMessage','handleFetchError','handleFetchEnd','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','hasOwnProperty','exports','lodash','imap','simpleParser','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x5db4,0xe3));var _0x45db=function(_0x4f906b,_0x247831){_0x4f906b=_0x4f906b-0x0;var _0x5a4a00=_0x5db4[_0x4f906b];return _0x5a4a00;};'use strict';var _=require(_0x45db('0x0'));var util=require('util');var Imap=require(_0x45db('0x1'));var simpleParser=require('mailparser')[_0x45db('0x2')];var Iconv=require(_0x45db('0x3'))[_0x45db('0x4')];var EventEmitter=require('events')[_0x45db('0x5')];var utils=require(_0x45db('0x6'));var logger=require(_0x45db('0x7'))(_0x45db('0x8'));function EmailImap(_0x31297b,_0x42809f){this['mailbox']=_0x31297b[_0x45db('0x9')];this['account']=this[_0x45db('0xa')](_0x31297b,_0x42809f);this['imap']=new Imap(this[_0x45db('0xb')]);this[_0x45db('0x1')][_0x45db('0xc')](_0x45db('0xd'),this['handleReady'][_0x45db('0xe')](this));this[_0x45db('0x1')][_0x45db('0xc')](_0x45db('0xf'),this[_0x45db('0x10')][_0x45db('0xe')](this));this[_0x45db('0x1')]['on'](_0x45db('0x11'),this[_0x45db('0x12')]['bind'](this));this[_0x45db('0x1')][_0x45db('0x13')]();}util[_0x45db('0x14')](EmailImap,EventEmitter);EmailImap[_0x45db('0x15')][_0x45db('0xa')]=function(_0x17c5ac,_0x3105c0){var _0x334bac={'connTimeout':_0x17c5ac[_0x45db('0x16')]?_0x17c5ac[_0x45db('0x16')]*0x3e8:0x2710,'authTimeout':_0x17c5ac[_0x45db('0x17')]?_0x17c5ac[_0x45db('0x17')]*0x3e8:0x1388};if(_0x17c5ac[_0x45db('0x18')]){_0x334bac[_0x45db('0x19')]=_0x17c5ac['user'];if(_0x17c5ac['modernAuthentication']){_0x334bac[_0x45db('0x1a')]=utils[_0x45db('0x1b')](_0x17c5ac[_0x45db('0x1c')][_0x45db('0x1d')],_0x17c5ac[_0x45db('0x19')]);}else{_0x334bac['password']=_0x17c5ac[_0x45db('0x1e')];}}else{if(_0x17c5ac[_0x45db('0x1f')]){_0x334bac['user']=_0x17c5ac[_0x45db('0x19')];_0x334bac['password']=_0x17c5ac[_0x45db('0x1e')];}}_0x334bac[_0x45db('0x8')]=_0x3105c0||_0x17c5ac[_0x45db('0x19')]||'anonymous@xcally.com';_0x334bac[_0x45db('0x20')]=_0x17c5ac[_0x45db('0x20')];_0x334bac['port']=_0x17c5ac[_0x45db('0x21')]||0x3e1;if(_0x17c5ac[_0x45db('0x22')]){_0x334bac['tls']=!![];}else{_0x334bac['tls']=![];_0x334bac['autotls']='required';}return _0x334bac;};EmailImap[_0x45db('0x15')][_0x45db('0x23')]=function(){this[_0x45db('0x1')][_0x45db('0x24')](this[_0x45db('0x9')],![],this['handleOpenBox'][_0x45db('0xe')](this));};EmailImap[_0x45db('0x15')][_0x45db('0x25')]=function(_0x2cebc8,_0x4cae16){if(_0x2cebc8){this[_0x45db('0x12')](_0x2cebc8,!![]);}else{this[_0x45db('0x26')]('box',_0x4cae16);this[_0x45db('0x27')]();}};EmailImap[_0x45db('0x15')][_0x45db('0x28')]=function(_0x552f65){if(_0x552f65){this[_0x45db('0x12')](_0x552f65,!![]);}else{this['imap'][_0x45db('0xf')]();}};EmailImap[_0x45db('0x15')][_0x45db('0x27')]=function(){this['imap'][_0x45db('0x29')]([_0x45db('0x2a')],this['handleReadUnseen'][_0x45db('0xe')](this));};EmailImap[_0x45db('0x15')][_0x45db('0x2b')]=function(_0x58bcaf,_0x32cee4){if(_0x58bcaf){this['handleError'](_0x58bcaf,!![]);}else{if(_0x32cee4[_0x45db('0x2c')]){try{var _0x6a8029=this[_0x45db('0x1')]['fetch'](_0x32cee4,{'bodies':'','markSeen':!![]});_0x6a8029['on']('message',this[_0x45db('0x2d')][_0x45db('0xe')](this));_0x6a8029[_0x45db('0xc')](_0x45db('0x11'),this[_0x45db('0x2e')][_0x45db('0xe')](this));_0x6a8029[_0x45db('0xc')]('end',this[_0x45db('0x2f')][_0x45db('0xe')](this));}catch(_0x342c18){logger[_0x45db('0x11')](_0x342c18);}}else{this[_0x45db('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x45db('0xe')](this));}}};EmailImap[_0x45db('0x15')][_0x45db('0x2d')]=function(_0x1483fe){_0x1483fe['on']('body',this[_0x45db('0x30')]['bind'](this));_0x1483fe['once'](_0x45db('0x31'),this[_0x45db('0x32')][_0x45db('0xe')](this));_0x1483fe[_0x45db('0xc')](_0x45db('0xf'),this[_0x45db('0x33')][_0x45db('0xe')](this));};EmailImap[_0x45db('0x15')][_0x45db('0x30')]=function(_0x57f9d3){simpleParser(_0x57f9d3,{'Iconv':Iconv},this[_0x45db('0x34')][_0x45db('0xe')](this));};EmailImap[_0x45db('0x15')]['handleMessageAttributes']=function(){};EmailImap[_0x45db('0x15')]['handleMessageEnd']=function(){};EmailImap[_0x45db('0x15')][_0x45db('0x34')]=function(_0x50217a,_0x3b9f58){if(_0x50217a){logger['error'](_0x50217a);}else{var _0x47e144=this;utils[_0x45db('0x35')](this[_0x45db('0xb')],_0x3b9f58,function(_0x418ddb){_0x47e144[_0x45db('0x26')](_0x45db('0x8'),_0x418ddb);});}};EmailImap[_0x45db('0x15')][_0x45db('0x2f')]=function(){this[_0x45db('0x1')][_0x45db('0x36')](!![],this[_0x45db('0x28')]['bind'](this));};EmailImap[_0x45db('0x15')][_0x45db('0x2e')]=function(_0x258269){this[_0x45db('0x12')](_0x258269);this[_0x45db('0x1')][_0x45db('0x36')](!![],this[_0x45db('0x28')][_0x45db('0xe')](this));};EmailImap[_0x45db('0x15')][_0x45db('0x10')]=function(){this[_0x45db('0x26')](_0x45db('0xf'));};EmailImap['prototype']['handleError']=function(_0xe766be,_0x4a7c26){logger[_0x45db('0x11')](_0x45db('0x12'),this[_0x45db('0xb')]['email'],JSON[_0x45db('0x37')](_0xe766be));var _0x2a4f5d='';if(_0xe766be){if(_0xe766be[_0x45db('0x38')]){_0x2a4f5d=_0xe766be[_0x45db('0x38')];}else{for(var _0x54c322 in _0xe766be){if(_0xe766be[_0x45db('0x39')](_0x54c322)){_0x2a4f5d+=_['upperFirst'](_0x54c322)+':\x20'+_0xe766be[_0x54c322]+'\x0a';}}}}if(_0x4a7c26){this['imap'][_0x45db('0xf')]();}else{this[_0x45db('0x26')](_0x45db('0x11'),_0x2a4f5d);this[_0x45db('0x26')]('end');}};module[_0x45db('0x3a')]=EmailImap; \ No newline at end of file +var _0xbdbc=['../../../config/logger','email','mailbox','getAccount','account','once','bind','end','handleEnd','connect','inherits','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','prototype','openBox','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xbdbc,0xb4));var _0xcbdb=function(_0xb415fc,_0x5f4555){_0xb415fc=_0xb415fc-0x0;var _0x5d05ba=_0xbdbc[_0xb415fc];return _0x5d05ba;};'use strict';var _=require(_0xcbdb('0x0'));var util=require(_0xcbdb('0x1'));var Imap=require(_0xcbdb('0x2'));var simpleParser=require(_0xcbdb('0x3'))[_0xcbdb('0x4')];var Iconv=require(_0xcbdb('0x5'))[_0xcbdb('0x6')];var EventEmitter=require('events')[_0xcbdb('0x7')];var utils=require(_0xcbdb('0x8'));var logger=require(_0xcbdb('0x9'))(_0xcbdb('0xa'));function EmailImap(_0x14ff32,_0x5baf50){this[_0xcbdb('0xb')]=_0x14ff32[_0xcbdb('0xb')];this['account']=this[_0xcbdb('0xc')](_0x14ff32,_0x5baf50);this[_0xcbdb('0x2')]=new Imap(this[_0xcbdb('0xd')]);this['imap'][_0xcbdb('0xe')]('ready',this['handleReady'][_0xcbdb('0xf')](this));this[_0xcbdb('0x2')][_0xcbdb('0xe')](_0xcbdb('0x10'),this[_0xcbdb('0x11')]['bind'](this));this[_0xcbdb('0x2')]['on']('error',this['handleError'][_0xcbdb('0xf')](this));this['imap'][_0xcbdb('0x12')]();}util[_0xcbdb('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0xcbdb('0xc')]=function(_0x5383c6,_0xa3695f){var _0x2c3c5f={'connTimeout':_0x5383c6[_0xcbdb('0x14')]?_0x5383c6[_0xcbdb('0x14')]*0x3e8:0x2710,'authTimeout':_0x5383c6[_0xcbdb('0x15')]?_0x5383c6['authTimeout']*0x3e8:0x1388};if(_0x5383c6[_0xcbdb('0x16')]){_0x2c3c5f['user']=_0x5383c6[_0xcbdb('0x17')];if(_0x5383c6[_0xcbdb('0x18')]){_0x2c3c5f[_0xcbdb('0x19')]=utils[_0xcbdb('0x1a')](_0x5383c6['CloudProvider'][_0xcbdb('0x1b')],_0x5383c6[_0xcbdb('0x17')]);}else{_0x2c3c5f[_0xcbdb('0x1c')]=_0x5383c6['password'];}}else{if(_0x5383c6[_0xcbdb('0x1d')]){_0x2c3c5f[_0xcbdb('0x17')]=_0x5383c6[_0xcbdb('0x17')];_0x2c3c5f[_0xcbdb('0x1c')]=_0x5383c6[_0xcbdb('0x1c')];}}_0x2c3c5f[_0xcbdb('0xa')]=_0xa3695f||_0x5383c6[_0xcbdb('0x17')]||_0xcbdb('0x1e');_0x2c3c5f[_0xcbdb('0x1f')]=_0x5383c6[_0xcbdb('0x1f')];_0x2c3c5f[_0xcbdb('0x20')]=_0x5383c6[_0xcbdb('0x20')]||0x3e1;if(_0x5383c6[_0xcbdb('0x21')]){_0x2c3c5f[_0xcbdb('0x21')]=!![];}else{_0x2c3c5f[_0xcbdb('0x21')]=![];_0x2c3c5f[_0xcbdb('0x22')]=_0xcbdb('0x23');}return _0x2c3c5f;};EmailImap[_0xcbdb('0x24')]['handleReady']=function(){this[_0xcbdb('0x2')][_0xcbdb('0x25')](this[_0xcbdb('0xb')],![],this['handleOpenBox']['bind'](this));};EmailImap['prototype'][_0xcbdb('0x26')]=function(_0x5e41d4,_0x54a43c){if(_0x5e41d4){this[_0xcbdb('0x27')](_0x5e41d4,!![]);}else{this[_0xcbdb('0x28')]('box',_0x54a43c);this[_0xcbdb('0x29')]();}};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x2a')]=function(_0x52beb6){if(_0x52beb6){this[_0xcbdb('0x27')](_0x52beb6,!![]);}else{this['imap']['end']();}};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x29')]=function(){this[_0xcbdb('0x2')]['search'](['UNSEEN'],this['handleReadUnseen'][_0xcbdb('0xf')](this));};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x2b')]=function(_0x564b0f,_0x2b97f5){if(_0x564b0f){this['handleError'](_0x564b0f,!![]);}else{if(_0x2b97f5[_0xcbdb('0x2c')]){try{var _0x1cd609=this['imap'][_0xcbdb('0x2d')](_0x2b97f5,{'bodies':'','markSeen':!![]});_0x1cd609['on'](_0xcbdb('0x2e'),this[_0xcbdb('0x2f')]['bind'](this));_0x1cd609[_0xcbdb('0xe')](_0xcbdb('0x30'),this[_0xcbdb('0x31')][_0xcbdb('0xf')](this));_0x1cd609['once'](_0xcbdb('0x10'),this[_0xcbdb('0x32')][_0xcbdb('0xf')](this));}catch(_0x241c7e){logger[_0xcbdb('0x30')](_0x241c7e);}}else{this[_0xcbdb('0x2')][_0xcbdb('0x33')](!![],this[_0xcbdb('0x2a')]['bind'](this));}}};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x2f')]=function(_0x29f184){_0x29f184['on'](_0xcbdb('0x34'),this[_0xcbdb('0x35')][_0xcbdb('0xf')](this));_0x29f184[_0xcbdb('0xe')](_0xcbdb('0x36'),this[_0xcbdb('0x37')]['bind'](this));_0x29f184['once'](_0xcbdb('0x10'),this[_0xcbdb('0x38')][_0xcbdb('0xf')](this));};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x35')]=function(_0x1c99a7){simpleParser(_0x1c99a7,{'Iconv':Iconv},this[_0xcbdb('0x39')]['bind'](this));};EmailImap['prototype'][_0xcbdb('0x37')]=function(){};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x38')]=function(){};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x39')]=function(_0x32fb20,_0x27313f){if(_0x32fb20){logger[_0xcbdb('0x30')](_0x32fb20);}else{var _0x389dd2=this;utils[_0xcbdb('0x3a')](this['account'],_0x27313f,function(_0x4b0e4c){_0x389dd2[_0xcbdb('0x28')]('email',_0x4b0e4c);});}};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x32')]=function(){this['imap'][_0xcbdb('0x33')](!![],this[_0xcbdb('0x2a')][_0xcbdb('0xf')](this));};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x31')]=function(_0x52aa1a){this[_0xcbdb('0x27')](_0x52aa1a);this['imap']['closeBox'](!![],this[_0xcbdb('0x2a')][_0xcbdb('0xf')](this));};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x11')]=function(){this[_0xcbdb('0x28')](_0xcbdb('0x10'));};EmailImap[_0xcbdb('0x24')][_0xcbdb('0x27')]=function(_0x34c916,_0x96f7b0){logger[_0xcbdb('0x30')]('handleError',this[_0xcbdb('0xd')][_0xcbdb('0xa')],JSON['stringify'](_0x34c916));var _0x12525f='';if(_0x34c916){if(_0x34c916[_0xcbdb('0x3b')]){_0x12525f=_0x34c916[_0xcbdb('0x3b')];}else{for(var _0x4dd581 in _0x34c916){if(_0x34c916[_0xcbdb('0x3c')](_0x4dd581)){_0x12525f+=_[_0xcbdb('0x3d')](_0x4dd581)+':\x20'+_0x34c916[_0x4dd581]+'\x0a';}}}}if(_0x96f7b0){this['imap'][_0xcbdb('0x10')]();}else{this[_0xcbdb('0x28')](_0xcbdb('0x30'),_0x12525f);this['emit'](_0xcbdb('0x10'));}};module[_0xcbdb('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 028b890..2e3927b 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6de=['compile','sendMail','verify','toString','exports','nodemailer-plugin-inline-base64','prototype','createTransport','use'];(function(_0x480df0,_0xf7a04c){var _0x162446=function(_0x561dc2){while(--_0x561dc2){_0x480df0['push'](_0x480df0['shift']());}};_0x162446(++_0xf7a04c);}(_0xd6de,0x188));var _0xed6d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd6de[_0xfae23b];return _0x200640;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xed6d('0x0'));function EmailSmtp(){}EmailSmtp[_0xed6d('0x1')]['send']=function(_0x244023,_0xeb61e9){return new Promise(function(_0x3b0529,_0x4f9a36){var _0x2e2b32=nodemailer[_0xed6d('0x2')](_0x244023);_0x2e2b32[_0xed6d('0x3')](_0xed6d('0x4'),inlineBase64());_0x2e2b32[_0xed6d('0x5')](_0xeb61e9,function(_0x22ff08,_0x44ca1a){if(_0x22ff08){_0x4f9a36(_0x22ff08['toString']());}else{_0x3b0529(_0x44ca1a);}});});};EmailSmtp[_0xed6d('0x1')][_0xed6d('0x6')]=function(_0x158729){return new Promise(function(_0x572427,_0x11eba4){var _0x1e4f78=nodemailer['createTransport'](_0x158729);_0x1e4f78['verify'](function(_0x14c82b,_0xa3d091){if(_0x14c82b){_0x11eba4(_0x14c82b[_0xed6d('0x7')]());}else{if(_0xa3d091){_0x572427(_0xa3d091);}else{_0x11eba4('Not\x20verifired');}}});});};module[_0xed6d('0x8')]=EmailSmtp; \ No newline at end of file +var _0x8142=['nodemailer-plugin-inline-base64','prototype','send','createTransport','compile','sendMail','toString','verify','nodemailer'];(function(_0x5098d3,_0x245091){var _0x285389=function(_0x2a32c9){while(--_0x2a32c9){_0x5098d3['push'](_0x5098d3['shift']());}};_0x285389(++_0x245091);}(_0x8142,0x1c1));var _0x2814=function(_0x38b3cb,_0x4ad7b3){_0x38b3cb=_0x38b3cb-0x0;var _0x5a9a84=_0x8142[_0x38b3cb];return _0x5a9a84;};'use strict';var nodemailer=require(_0x2814('0x0'));var inlineBase64=require(_0x2814('0x1'));function EmailSmtp(){}EmailSmtp[_0x2814('0x2')][_0x2814('0x3')]=function(_0x1de62c,_0x2ba9e0){return new Promise(function(_0xb0ab7f,_0x499942){var _0x555a26=nodemailer[_0x2814('0x4')](_0x1de62c);_0x555a26['use'](_0x2814('0x5'),inlineBase64());_0x555a26[_0x2814('0x6')](_0x2ba9e0,function(_0x15960c,_0x8d0b99){if(_0x15960c){_0x499942(_0x15960c[_0x2814('0x7')]());}else{_0xb0ab7f(_0x8d0b99);}});});};EmailSmtp['prototype'][_0x2814('0x8')]=function(_0x49519f){return new Promise(function(_0x63ac2b,_0x25f608){var _0x56629e=nodemailer[_0x2814('0x4')](_0x49519f);_0x56629e[_0x2814('0x8')](function(_0x277a72,_0x11e082){if(_0x277a72){_0x25f608(_0x277a72[_0x2814('0x7')]());}else{if(_0x11e082){_0x63ac2b(_0x11e082);}else{_0x25f608('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 62537a2..72c3bba 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6140=['substring','length','join','pop','isEmpty','html','test','replace','includes','forEach','filename','_IMG','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','utf-8','base64','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name'];(function(_0x137b53,_0x300e4a){var _0x554a40=function(_0x8c3da3){while(--_0x8c3da3){_0x137b53['push'](_0x137b53['shift']());}};_0x554a40(++_0x300e4a);}(_0x6140,0x101));var _0x0614=function(_0x5241ff,_0x4fa868){_0x5241ff=_0x5241ff-0x0;var _0x10974a=_0x6140[_0x5241ff];return _0x10974a;};'use strict';var _=require(_0x0614('0x0'));var moment=require(_0x0614('0x1'));var random=require(_0x0614('0x2'));var fs=require('fs');var path=require(_0x0614('0x3'));var util=require('util');var tnef=require(_0x0614('0x4'));var logger=require(_0x0614('0x5'))(_0x0614('0x6'));var config=require(_0x0614('0x7'));function getAddress(_0x53c3d3){var _0x43dcb6=_[_0x0614('0x8')](_0x53c3d3[_0x0614('0x9')]);return _0x43dcb6&&_0x43dcb6[_0x0614('0xa')]?_0x43dcb6[_0x0614('0xa')]:_0x0614('0xb')+random[_0x0614('0xc')](0x6)+_0x0614('0xd');}function getFirstName(_0x1e9eff){var _0x39e4c5=_[_0x0614('0x8')](_0x1e9eff[_0x0614('0x9')]);if(_0x39e4c5&&_0x39e4c5[_0x0614('0xe')]){if(_0x39e4c5[_0x0614('0xe')]==_0x39e4c5[_0x0614('0xa')]){return _0x39e4c5[_0x0614('0xe')][_0x0614('0xf')](0x0,_0x39e4c5['name']['indexOf']('@'));}var _0x550a04=_0x39e4c5[_0x0614('0xe')]['split'](/\s+/);return _0x550a04[_0x0614('0x10')]>0x1?_0x550a04['slice'](0x0,-0x1)[_0x0614('0x11')]('\x20'):_0x39e4c5['name'];}return'Anonymous';}function getLastName(_0x643234){var _0x483c32=_[_0x0614('0x8')](_0x643234[_0x0614('0x9')]);if(_0x483c32&&_0x483c32['name']){var _0x532b92=_0x483c32[_0x0614('0xe')]['split'](/\s+/);return _0x532b92['length']>0x1?_0x532b92[_0x0614('0x12')]():'';}return'';}function getMails(_0x2e9bf6,_0x3d76b9){var _0x192cb3='';for(var _0x20c69c=0x0;_0x20c69c<_0x3d76b9[_0x0614('0x9')][_0x0614('0x10')];_0x20c69c+=0x1){if(_0x3d76b9[_0x0614('0x9')][_0x20c69c][_0x0614('0xa')]!==_0x2e9bf6){if(!_[_0x0614('0x13')](_0x192cb3)){_0x192cb3+=',';}_0x192cb3+=_0x3d76b9['value'][_0x20c69c][_0x0614('0xe')]||_0x3d76b9[_0x0614('0x9')][_0x20c69c][_0x0614('0xa')]||'';_0x192cb3+='\x20<';_0x192cb3+=_0x3d76b9[_0x0614('0x9')][_0x20c69c]['address']?_0x3d76b9[_0x0614('0x9')][_0x20c69c][_0x0614('0xa')]:_0x0614('0xb')+random[_0x0614('0xc')](0x6)+_0x0614('0xd');_0x192cb3+='>';}}return _0x192cb3;}function parseEmail(_0x5494f4,_0x11a948,_0x5d45a6){if(_0x11a948[_0x0614('0x14')]){var _0x54ffc5=/)<[^<]*)*<\/script>/gi;while(_0x54ffc5[_0x0614('0x15')](_0x11a948[_0x0614('0x14')])){_0x11a948[_0x0614('0x14')]=_0x11a948['html'][_0x0614('0x16')](_0x54ffc5,'');}if(_0x11a948[_0x0614('0x14')][_0x0614('0x17')]('{_0x472df6['push'](_0x2ecee5[_0x0614('0x19')]);});var _0xb59274=/]+>/g;var _0x4db25e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x24d747=_0x11a948[_0x0614('0x14')][_0x0614('0x16')](_0x4db25e,'_SRC');var _0x5ce6b3=_0x24d747['replace'](_0xb59274,_0x0614('0x1a'));for(let _0x30caee=0x0;_0x30caee<_0x472df6[_0x0614('0x10')];_0x30caee++){var _0x213995=_0x5ce6b3[_0x0614('0x16')]('_IMG',_0x0614('0x1b')+_0x472df6[_0x30caee]+_0x0614('0x1c'));_0x5ce6b3=_0x213995;}_0x11a948[_0x0614('0x14')]=_0x5ce6b3;}_0x5d45a6['body']=_0x11a948[_0x0614('0x14')];}else{_0x5d45a6[_0x0614('0x1d')]=_0x11a948['textAsHtml'];}if(_0x5d45a6[_0x0614('0x1d')]){_0x5d45a6[_0x0614('0x1d')]=_0x5d45a6['body']['replace'](/0x0){var _0x280e84=['Auto-Submitted:\x20auto-replied',_0x0614('0x2c'),_0x0614('0x2d')];for(var _0x18db45=0x0;_0x18db45<_0x11a948[_0x0614('0x2b')][_0x0614('0x10')];_0x18db45++){var _0x1ed567=_['indexOf'](_0x280e84,_0x11a948[_0x0614('0x2b')][_0x18db45][_0x0614('0x2e')]);if(_0x1ed567>=0x0){_0x5d45a6[_0x0614('0x2f')]=!![];}}}return _0x5d45a6;}exports[_0x0614('0x30')]=function(_0x5aa332,_0x59e2a2,_0x54e206){var _0x21d95d={'from':getAddress(_0x59e2a2[_0x0614('0x31')]),'firstName':getFirstName(_0x59e2a2['from']),'lastName':getLastName(_0x59e2a2['from']),'mapKey':_0x0614('0x6'),'message':{'from':getMails(_0x5aa332[_0x0614('0x6')],_0x59e2a2[_0x0614('0x31')]),'to':_0x5aa332['email'],'cc':'','subject':_0x59e2a2[_0x0614('0x32')]||'','messageId':_0x59e2a2[_0x0614('0x33')],'inReplyTo':_0x59e2a2[_0x0614('0x34')],'sentAt':moment(_0x59e2a2[_0x0614('0x35')])['format'](_0x0614('0x36')),'attach':![],'attachments':[]}};if(!_0x59e2a2['html']&&!_0x59e2a2[_0x0614('0x37')]){var _0x2ce0e1=_['filter'](_0x59e2a2[_0x0614('0x23')],{'contentType':'application/ms-tnef'});if(_0x2ce0e1[_0x0614('0x10')]){logger['info'](util[_0x0614('0x38')](_0x0614('0x39'),_0x59e2a2[_0x0614('0x33')]));tnef[_0x0614('0x3a')](_[_0x0614('0x3b')](_0x2ce0e1)['content'],function(_0x12e66e,_0x404432){if(_0x404432){_0x59e2a2[_0x0614('0x14')]=_0x404432[_0x0614('0x3c')]||_0x0614('0x3d');if(_0x404432[_0x0614('0x3e')]){for(var _0x261856=0x0;_0x261856<_0x404432[_0x0614('0x3e')][_0x0614('0x10')];_0x261856++){var _0x3764ab=_0x404432[_0x0614('0x3e')][_0x261856];_0x21d95d[_0x0614('0x1f')][_0x0614('0x23')][_0x0614('0x29')]({'filename':_0x3764ab[_0x0614('0x3f')],'content':Buffer[_0x0614('0x31')](_0x3764ab[_0x0614('0x40')])});}}}_0x54e206(parseEmail(_0x5aa332,_0x59e2a2,_0x21d95d));});}else{_0x59e2a2['html']=_0x0614('0x3d');_0x54e206(parseEmail(_0x5aa332,_0x59e2a2,_0x21d95d));}}else{_0x54e206(parseEmail(_0x5aa332,_0x59e2a2,_0x21d95d));}};exports[_0x0614('0x41')]=function(_0x4f4718,_0x5ebe9a){var _0x40c746=['user='+(_0x5ebe9a||''),'auth=Bearer\x20'+_0x4f4718,'',''];return Buffer[_0x0614('0x31')](_0x40c746[_0x0614('0x11')](''),_0x0614('0x42'))['toString'](_0x0614('0x43'));}; \ No newline at end of file +var _0x01a6=['Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','value','isEmpty','html','test','replace','includes','attachments','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x5d8c65[_0x601a('0x12')](0x0,-0x1)[_0x601a('0x13')]('\x20'):_0x566826['name'];}return _0x601a('0x14');}function getLastName(_0x46ed8c){var _0x5e7e57=_[_0x601a('0x8')](_0x46ed8c[_0x601a('0x15')]);if(_0x5e7e57&&_0x5e7e57[_0x601a('0xd')]){var _0x2e739a=_0x5e7e57[_0x601a('0xd')][_0x601a('0x10')](/\s+/);return _0x2e739a[_0x601a('0x11')]>0x1?_0x2e739a['pop']():'';}return'';}function getMails(_0x601a3c,_0x5532db){var _0x4c76e4='';for(var _0x3a413f=0x0;_0x3a413f<_0x5532db[_0x601a('0x15')][_0x601a('0x11')];_0x3a413f+=0x1){if(_0x5532db['value'][_0x3a413f][_0x601a('0x9')]!==_0x601a3c){if(!_[_0x601a('0x16')](_0x4c76e4)){_0x4c76e4+=',';}_0x4c76e4+=_0x5532db['value'][_0x3a413f][_0x601a('0xd')]||_0x5532db['value'][_0x3a413f][_0x601a('0x9')]||'';_0x4c76e4+='\x20<';_0x4c76e4+=_0x5532db[_0x601a('0x15')][_0x3a413f][_0x601a('0x9')]?_0x5532db[_0x601a('0x15')][_0x3a413f][_0x601a('0x9')]:'anonymous'+random[_0x601a('0xb')](0x6)+_0x601a('0xc');_0x4c76e4+='>';}}return _0x4c76e4;}function parseEmail(_0x54faa7,_0x11057d,_0x2f9726){if(_0x11057d[_0x601a('0x17')]){var _0x119879=/)<[^<]*)*<\/script>/gi;while(_0x119879[_0x601a('0x18')](_0x11057d[_0x601a('0x17')])){_0x11057d['html']=_0x11057d[_0x601a('0x17')][_0x601a('0x19')](_0x119879,'');}if(_0x11057d[_0x601a('0x17')][_0x601a('0x1a')]('{_0x180878[_0x601a('0x1d')](_0x30882d['filename']);});var _0x30a9c8=/]+>/g;var _0x45e3b0=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x39c597=_0x11057d[_0x601a('0x17')][_0x601a('0x19')](_0x45e3b0,_0x601a('0x1e'));var _0x6e9ae2=_0x39c597[_0x601a('0x19')](_0x30a9c8,_0x601a('0x1f'));for(let _0xf4308b=0x0;_0xf4308b<_0x180878[_0x601a('0x11')];_0xf4308b++){var _0x323aa9=_0x6e9ae2[_0x601a('0x19')](_0x601a('0x1f'),_0x601a('0x20')+_0x180878[_0xf4308b]+'\x20]');_0x6e9ae2=_0x323aa9;}_0x11057d[_0x601a('0x17')]=_0x6e9ae2;}_0x2f9726[_0x601a('0x21')]=_0x11057d[_0x601a('0x17')];}else{_0x2f9726[_0x601a('0x21')]=_0x11057d[_0x601a('0x22')];}if(_0x2f9726[_0x601a('0x21')]){_0x2f9726[_0x601a('0x21')]=_0x2f9726['body'][_0x601a('0x19')](/0x0){var _0x318800=[_0x601a('0x32'),_0x601a('0x33'),_0x601a('0x34')];for(var _0x1ab2e0=0x0;_0x1ab2e0<_0x11057d[_0x601a('0x31')][_0x601a('0x11')];_0x1ab2e0++){var _0x4a606e=_['indexOf'](_0x318800,_0x11057d['headerLines'][_0x1ab2e0][_0x601a('0x35')]);if(_0x4a606e>=0x0){_0x2f9726[_0x601a('0x36')]=!![];}}}return _0x2f9726;}exports[_0x601a('0x37')]=function(_0x41b12d,_0x1d11b3,_0x551a36){var _0x4da9c6={'from':getAddress(_0x1d11b3[_0x601a('0x38')]),'firstName':getFirstName(_0x1d11b3[_0x601a('0x38')]),'lastName':getLastName(_0x1d11b3[_0x601a('0x38')]),'mapKey':_0x601a('0x6'),'message':{'from':getMails(_0x41b12d['email'],_0x1d11b3['from']),'to':_0x41b12d[_0x601a('0x6')],'cc':'','subject':_0x1d11b3[_0x601a('0x39')]||'','messageId':_0x1d11b3['messageId'],'inReplyTo':_0x1d11b3[_0x601a('0x3a')],'sentAt':moment(_0x1d11b3[_0x601a('0x3b')])['format'](_0x601a('0x3c')),'attach':![],'attachments':[]}};if(!_0x1d11b3['html']&&!_0x1d11b3[_0x601a('0x22')]){var _0x1d3c45=_[_0x601a('0x3d')](_0x1d11b3['attachments'],{'contentType':_0x601a('0x3e')});if(_0x1d3c45['length']){logger['info'](util['format'](_0x601a('0x3f'),_0x1d11b3[_0x601a('0x40')]));tnef[_0x601a('0x41')](_['first'](_0x1d3c45)[_0x601a('0x30')],function(_0x2a1bda,_0x1cd1f3){if(_0x1cd1f3){_0x1d11b3[_0x601a('0x17')]=_0x1cd1f3['BodyHTML']||'

Empty\x20message

';if(_0x1cd1f3['Attachments']){for(var _0x3dfc1e=0x0;_0x3dfc1e<_0x1cd1f3[_0x601a('0x42')][_0x601a('0x11')];_0x3dfc1e++){var _0x22a610=_0x1cd1f3[_0x601a('0x42')][_0x3dfc1e];_0x4da9c6[_0x601a('0x24')][_0x601a('0x1b')][_0x601a('0x1d')]({'filename':_0x22a610['Title'],'content':Buffer[_0x601a('0x38')](_0x22a610[_0x601a('0x43')])});}}}_0x551a36(parseEmail(_0x41b12d,_0x1d11b3,_0x4da9c6));});}else{_0x1d11b3[_0x601a('0x17')]='

Empty\x20message

';_0x551a36(parseEmail(_0x41b12d,_0x1d11b3,_0x4da9c6));}}else{_0x551a36(parseEmail(_0x41b12d,_0x1d11b3,_0x4da9c6));}};exports[_0x601a('0x44')]=function(_0x22d18b,_0x2c5eb8){var _0x2f4d73=[_0x601a('0x45')+(_0x2c5eb8||''),_0x601a('0x46')+_0x22d18b,'',''];return Buffer[_0x601a('0x38')](_0x2f4d73[_0x601a('0x13')](''),_0x601a('0x47'))['toString'](_0x601a('0x48'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 3aff39c..a123eb4 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 _0x9f73=['name','Service','key','SERV','active','Imap','Smtp','lodash'];(function(_0x62353a,_0x554ea9){var _0x5d547f=function(_0x323b2a){while(--_0x323b2a){_0x62353a['push'](_0x62353a['shift']());}};_0x5d547f(++_0x554ea9);}(_0x9f73,0xb7));var _0x39f7=function(_0x3ea713,_0x58b9e8){_0x3ea713=_0x3ea713-0x0;var _0x922692=_0x9f73[_0x3ea713];return _0x922692;};'use strict';var _=require(_0x39f7('0x0'));function MailAccount(_0x511ff3){this['id']=_0x511ff3['id']||0x0;this[_0x39f7('0x1')]=_0x511ff3['name']||_0x39f7('0x2');this[_0x39f7('0x3')]=_0x511ff3[_0x39f7('0x3')]||_0x39f7('0x4');this['active']=_0x511ff3[_0x39f7('0x5')]||![];this[_0x39f7('0x6')]=_0x511ff3[_0x39f7('0x6')]||[];this[_0x39f7('0x7')]=_0x511ff3[_0x39f7('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x3203=['SERV','active','Imap','Smtp','exports','name','Service','key'];(function(_0x2deb4a,_0x2f672a){var _0x146b33=function(_0x65f62d){while(--_0x65f62d){_0x2deb4a['push'](_0x2deb4a['shift']());}};_0x146b33(++_0x2f672a);}(_0x3203,0xfd));var _0x3320=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0x3203[_0x2f3d29];return _0x53d69d;};'use strict';var _=require('lodash');function MailAccount(_0x54fbdd){this['id']=_0x54fbdd['id']||0x0;this[_0x3320('0x0')]=_0x54fbdd['name']||_0x3320('0x1');this[_0x3320('0x2')]=_0x54fbdd[_0x3320('0x2')]||_0x3320('0x3');this[_0x3320('0x4')]=_0x54fbdd[_0x3320('0x4')]||![];this[_0x3320('0x5')]=_0x54fbdd[_0x3320('0x5')]||[];this[_0x3320('0x6')]=_0x54fbdd['Smtp']||[];}module[_0x3320('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 2a63903..39f8e44 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 _0x6d77=['length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x250f95,_0x5a5728){var _0x4ada97=function(_0x392edc){while(--_0x392edc){_0x250f95['push'](_0x250f95['shift']());}};_0x4ada97(++_0x5a5728);}(_0x6d77,0x13a));var _0x76d7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6d77[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x76d7('0x0'));var MailAccount=require(_0x76d7('0x1'));var Realtime=function(){this[_0x76d7('0x2')]={};};function freeIsNotKey(_0x2d5eb5,_0x51cab1,_0x25f0c1){var _0x4fb544=_[_0x76d7('0x3')](_0x2d5eb5,function(_0x105e82,_0x26807f){return _0x105e82[_0x25f0c1];});for(var _0x3cce99 in _0x51cab1){if(_0x51cab1['hasOwnProperty'](_0x3cce99)){if(!_0x4fb544[_0x3cce99]){delete _0x51cab1[_0x3cce99];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x327fbc,_0x562a37){for(var _0x4a10e8 in _0x562a37){if(_0x327fbc[_0x76d7('0x4')](_0x4a10e8)){_0x327fbc[_0x4a10e8]=_0x562a37[_0x4a10e8];}}};Realtime[_0x76d7('0x5')]['initMailAccounts']=function(){var _0x5c4aab=this;return function(_0x11d311){if(_0x11d311){freeIsNotKey(_0x11d311,_0x5c4aab['mailAccounts'],'id');for(var _0x1a258d=0x0,_0x3b58ec={},_0x57a821={};_0x1a258d<_0x11d311[_0x76d7('0x6')];_0x1a258d+=0x1){_0x3b58ec=_0x11d311[_0x1a258d];if(_[_0x76d7('0x7')](_0x5c4aab['mailAccounts'][_0x3b58ec['id']])){_0x5c4aab['mailAccounts'][_0x3b58ec['id']]=new MailAccount(_0x3b58ec);}else{_[_0x76d7('0x8')](_0x5c4aab[_0x76d7('0x2')][_0x3b58ec['id']],_0x3b58ec);}}}return _0x5c4aab[_0x76d7('0x2')];};};module[_0x76d7('0x9')]=Realtime; \ No newline at end of file +var _0xcfbf=['mailAccounts','length','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype'];(function(_0x5ca9fa,_0x313a3f){var _0x3cc732=function(_0x5083a4){while(--_0x5083a4){_0x5ca9fa['push'](_0x5ca9fa['shift']());}};_0x3cc732(++_0x313a3f);}(_0xcfbf,0x11b));var _0xfcfb=function(_0x4d741f,_0x450365){_0x4d741f=_0x4d741f-0x0;var _0x30252f=_0xcfbf[_0x4d741f];return _0x30252f;};'use strict';var _=require(_0xfcfb('0x0'));var MailAccount=require(_0xfcfb('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4e4188,_0x26bbbb,_0x55697f){var _0x5a0d39=_[_0xfcfb('0x2')](_0x4e4188,function(_0xbaab82,_0x2c5841){return _0xbaab82[_0x55697f];});for(var _0x25e2d8 in _0x26bbbb){if(_0x26bbbb[_0xfcfb('0x3')](_0x25e2d8)){if(!_0x5a0d39[_0x25e2d8]){delete _0x26bbbb[_0x25e2d8];}}}}Realtime[_0xfcfb('0x4')]['mergeFromDatabase']=function(_0x341e60,_0x5efbb0){for(var _0x11bfbe in _0x5efbb0){if(_0x341e60[_0xfcfb('0x3')](_0x11bfbe)){_0x341e60[_0x11bfbe]=_0x5efbb0[_0x11bfbe];}}};Realtime[_0xfcfb('0x4')]['initMailAccounts']=function(){var _0x81f81f=this;return function(_0x274067){if(_0x274067){freeIsNotKey(_0x274067,_0x81f81f[_0xfcfb('0x5')],'id');for(var _0x305e63=0x0,_0x2c7549={},_0x3bb88e={};_0x305e63<_0x274067[_0xfcfb('0x6')];_0x305e63+=0x1){_0x2c7549=_0x274067[_0x305e63];if(_['isUndefined'](_0x81f81f[_0xfcfb('0x5')][_0x2c7549['id']])){_0x81f81f[_0xfcfb('0x5')][_0x2c7549['id']]=new MailAccount(_0x2c7549);}else{_['merge'](_0x81f81f[_0xfcfb('0x5')][_0x2c7549['id']],_0x2c7549);}}}return _0x81f81f[_0xfcfb('0x5')];};};module[_0xfcfb('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 0f4fee6..09fe52b 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 _0xd9a8=['MailServerIn','CloudProvider','service','data5','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name','provider','active','key','ListId','TemplateId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x1ff085,_0xa5d361){_0x1ff085=_0x1ff085-0x0;var _0x229856=_0xd9a8[_0x1ff085];return _0x229856;};'use strict';var client=require(_0x8d9a('0x0'));exports[_0x8d9a('0x1')]=function(){return function(){return client[_0x8d9a('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x8d9a('0x3'),_0x8d9a('0x4'),'service','email',_0x8d9a('0x5'),_0x8d9a('0x6'),_0x8d9a('0x7'),_0x8d9a('0x8')],'raw':![],'include':[{'model':_0x8d9a('0x9'),'as':'Imap','include':[{'model':_0x8d9a('0xa'),'attributes':['id',_0x8d9a('0x3'),_0x8d9a('0xb'),'type',_0x8d9a('0xc')],'as':_0x8d9a('0xa')}]},{'model':_0x8d9a('0xd'),'as':'Smtp','include':[{'model':_0x8d9a('0xa'),'attributes':['id',_0x8d9a('0x3'),_0x8d9a('0xb'),'type',_0x8d9a('0xc')],'as':'CloudProvider'}]}]},'log':_0x8d9a('0xe')});};};exports[_0x8d9a('0xf')]=function(_0x58d5c8,_0x4050f3){return client[_0x8d9a('0x2')]('NotifyMailAccount',{'account':{'id':_0x58d5c8},'body':_0x4050f3,'log':_0x8d9a('0x10')});}; \ No newline at end of file +var _0xba38=['NotifyMailAccount','getMailAccounts','Request','GetMailAccount','provider','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','service','type','data5','MailServerOut','Smtp','getMailAccount','notify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xba38,0x190));var _0x8ba3=function(_0x34007c,_0x1c9d6b){_0x34007c=_0x34007c-0x0;var _0x556cfe=_0xba38[_0x34007c];return _0x556cfe;};'use strict';var client=require('../client');exports[_0x8ba3('0x0')]=function(){return function(){return client[_0x8ba3('0x1')](_0x8ba3('0x2'),{'options':{'attributes':['id','name',_0x8ba3('0x3'),'service',_0x8ba3('0x4'),_0x8ba3('0x5'),_0x8ba3('0x6'),_0x8ba3('0x7'),_0x8ba3('0x8')],'raw':![],'include':[{'model':_0x8ba3('0x9'),'as':_0x8ba3('0xa'),'include':[{'model':_0x8ba3('0xb'),'attributes':['id',_0x8ba3('0xc'),_0x8ba3('0xd'),_0x8ba3('0xe'),_0x8ba3('0xf')],'as':'CloudProvider'}]},{'model':_0x8ba3('0x10'),'as':_0x8ba3('0x11'),'include':[{'model':'CloudProvider','attributes':['id',_0x8ba3('0xc'),'service',_0x8ba3('0xe'),_0x8ba3('0xf')],'as':_0x8ba3('0xb')}]}]},'log':_0x8ba3('0x12')});};};exports[_0x8ba3('0x13')]=function(_0x3ccff8,_0x2087a9){return client[_0x8ba3('0x1')](_0x8ba3('0x14'),{'account':{'id':_0x3ccff8},'body':_0x2087a9,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 22372b9..a5456cb 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 _0x642e=['../client','Request','ShowSetting','loginMailFrequency'];(function(_0x37fc84,_0x12306f){var _0x5edcd9=function(_0x64a8e3){while(--_0x64a8e3){_0x37fc84['push'](_0x37fc84['shift']());}};_0x5edcd9(++_0x12306f);}(_0x642e,0xd8));var _0xe642=function(_0x7e031b,_0x28163d){_0x7e031b=_0x7e031b-0x0;var _0x46f619=_0x642e[_0x7e031b];return _0x46f619;};'use strict';var client=require(_0xe642('0x0'));exports['getSettings']=function(){return client[_0xe642('0x1')](_0xe642('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe642('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x5a37=['../client','Request','ShowSetting','loginMailFrequency'];(function(_0x9dd37c,_0x3e255e){var _0x2a522c=function(_0x2ce2ca){while(--_0x2ce2ca){_0x9dd37c['push'](_0x9dd37c['shift']());}};_0x2a522c(++_0x3e255e);}(_0x5a37,0x194));var _0x75a3=function(_0x5a2358,_0x16bfff){_0x5a2358=_0x5a2358-0x0;var _0x2be9f1=_0x5a37[_0x5a2358];return _0x2be9f1;};'use strict';var client=require(_0x75a3('0x0'));exports['getSettings']=function(){return client[_0x75a3('0x1')](_0x75a3('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x75a3('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 183e835..a828a2a 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(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 11cf930..93aab04 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 _0xe036=['ioredis','../../config/environment','listen','port','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session'];(function(_0x278cd4,_0x26eb74){var _0x3d2cb1=function(_0x11283c){while(--_0x11283c){_0x278cd4['push'](_0x278cd4['shift']());}};_0x3d2cb1(++_0x26eb74);}(_0xe036,0x6a));var _0x6e03=function(_0x27179b,_0x56eabc){_0x27179b=_0x27179b-0x0;var _0x2971b1=_0xe036[_0x27179b];return _0x2971b1;};'use strict';var _=require(_0x6e03('0x0'));var http=require(_0x6e03('0x1'));var express=require(_0x6e03('0x2'));var sticky=require(_0x6e03('0x3'));var Redis=require(_0x6e03('0x4'));var config=require(_0x6e03('0x5'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x6e03('0x6')](server,config[_0x6e03('0x7')])){var socketio=require(_0x6e03('0x8'))(server,{'transports':[_0x6e03('0x9'),_0x6e03('0xa')]});config[_0x6e03('0xb')]=_[_0x6e03('0xc')](config[_0x6e03('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x6e03('0xd')](require(_0x6e03('0xe'))({'pubClient':new Redis(config[_0x6e03('0xb')]),'subClient':new Redis(config[_0x6e03('0xb')])}));require(_0x6e03('0xf'))['default']();require(_0x6e03('0x10'))[_0x6e03('0x11')](socketio);require(_0x6e03('0x12'))[_0x6e03('0x11')](app);require(_0x6e03('0x13'))[_0x6e03('0x11')](app);}else{server[_0x6e03('0x14')]('listening',function(){console['log'](_0x6e03('0x15'),config['port']);});}exports=module['exports']=app; \ No newline at end of file +var _0x5756=['listen','port','socket.io','websocket','polling','redis','localhost','adapter','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','createServer','timeout'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x5756,0x69));var _0x6575=function(_0x5a9a6d,_0x318da0){_0x5a9a6d=_0x5a9a6d-0x0;var _0x2f940c=_0x5756[_0x5a9a6d];return _0x2f940c;};'use strict';var _=require(_0x6575('0x0'));var http=require(_0x6575('0x1'));var express=require(_0x6575('0x2'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x6575('0x3')](app);server[_0x6575('0x4')]=0xdbba0;if(sticky[_0x6575('0x5')](server,config[_0x6575('0x6')])){var socketio=require(_0x6575('0x7'))(server,{'transports':[_0x6575('0x8'),_0x6575('0x9')]});config[_0x6575('0xa')]=_['defaults'](config[_0x6575('0xa')],{'host':_0x6575('0xb'),'port':0x18eb});socketio[_0x6575('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0x6575('0xa')]),'subClient':new Redis(config[_0x6575('0xa')])}));require(_0x6575('0xd'))['default']();require(_0x6575('0xe'))[_0x6575('0xf')](socketio);require(_0x6575('0x10'))[_0x6575('0xf')](app);require(_0x6575('0x11'))[_0x6575('0xf')](app);}else{server[_0x6575('0x12')]('listening',function(){console[_0x6575('0x13')](_0x6575('0x14'),config[_0x6575('0x6')]);});}exports=module[_0x6575('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d4ee091..6109a80 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 _0x1f5d=['result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','request','then','debug','rpc','error','message'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0x1f5d,0x107));var _0xd1f5=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x1f5d[_0x1a0600];return _0x734670;};'use strict';var jayson=require(_0xd1f5('0x0'));var BPromise=require(_0xd1f5('0x1'));var logger=require(_0xd1f5('0x2'))(_0xd1f5('0x3'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x313f02,_0x88c6cf){return new BPromise(function(_0x249e07,_0x372eca){return client[_0xd1f5('0x4')](_0x313f02,_0x88c6cf)[_0xd1f5('0x5')](function(_0x2b869b){logger[_0xd1f5('0x6')](_0xd1f5('0x7'),'routing',_0x313f02,_0x88c6cf,_0x2b869b);if(_0x2b869b[_0xd1f5('0x8')]){logger[_0xd1f5('0x8')](_0xd1f5('0x7'),'routing',_0x313f02,_0x2b869b['error']['message'],_0x88c6cf);return _0x372eca(_0x2b869b[_0xd1f5('0x8')][_0xd1f5('0x9')]);}else{return _0x249e07(_0x2b869b[_0xd1f5('0xa')]);}})[_0xd1f5('0xb')](function(_0x2cdcff){logger[_0xd1f5('0x8')](_0xd1f5('0x7'),_0xd1f5('0x3'),_0x313f02,_0x2cdcff,_0x88c6cf);return _0x372eca(_0x2cdcff);});});};module[_0xd1f5('0xc')]=client; \ No newline at end of file +var _0x500e=['error','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc'];(function(_0x20a424,_0x2ac71a){var _0x28911f=function(_0x22cffe){while(--_0x22cffe){_0x20a424['push'](_0x20a424['shift']());}};_0x28911f(++_0x2ac71a);}(_0x500e,0xb8));var _0xe500=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x500e[_0x1ac595];return _0x455fff;};'use strict';var jayson=require(_0xe500('0x0'));var BPromise=require(_0xe500('0x1'));var logger=require(_0xe500('0x2'))(_0xe500('0x3'));var client=jayson[_0xe500('0x4')][_0xe500('0x5')]({'port':0x2329});client[_0xe500('0x6')]=function(_0x2b259c,_0x59c625){return new BPromise(function(_0x22b2be,_0x16c7dd){return client[_0xe500('0x7')](_0x2b259c,_0x59c625)[_0xe500('0x8')](function(_0x3cba09){logger[_0xe500('0x9')]('rpc',_0xe500('0x3'),_0x2b259c,_0x59c625,_0x3cba09);if(_0x3cba09['error']){logger['error'](_0xe500('0xa'),_0xe500('0x3'),_0x2b259c,_0x3cba09[_0xe500('0xb')]['message'],_0x59c625);return _0x16c7dd(_0x3cba09[_0xe500('0xb')]['message']);}else{return _0x22b2be(_0x3cba09[_0xe500('0xc')]);}})[_0xe500('0xd')](function(_0x537901){logger['error'](_0xe500('0xa'),'routing',_0x2b259c,_0x537901,_0x59c625);return _0x16c7dd(_0x537901);});});};module[_0xe500('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 419bdd8..af27b6a 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 _0x0d62=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user'];(function(_0x2b2806,_0xb2b700){var _0x5661bc=function(_0x23bcfa){while(--_0x23bcfa){_0x2b2806['push'](_0x2b2806['shift']());}};_0x5661bc(++_0xb2b700);}(_0x0d62,0x74));var _0x20d6=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x0d62[_0x149083];return _0x4dc74e;};'use strict';var BPromise=require(_0x20d6('0x0'));var server=require(_0x20d6('0x1'));var Realtime=require(_0x20d6('0x2'));var user=require(_0x20d6('0x3'));var interval=require(_0x20d6('0x4'));var openchannelQueue=require(_0x20d6('0x5'));var chatQueue=require(_0x20d6('0x6'));var smsQueue=require(_0x20d6('0x7'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x20d6('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x20d6('0x9')]()[_0x20d6('0xa')](user[_0x20d6('0xb')]())[_0x20d6('0xa')](realtime[_0x20d6('0xc')]())[_0x20d6('0xa')](interval[_0x20d6('0xd')]())[_0x20d6('0xa')](realtime[_0x20d6('0xe')]())[_0x20d6('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x20d6('0xa')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())[_0x20d6('0xa')](realtime['initChatQueues']())['then'](smsQueue['getSmsQueues']())[_0x20d6('0xa')](realtime['initSmsQueues']())['then'](mailQueue[_0x20d6('0xf')]())[_0x20d6('0xa')](realtime[_0x20d6('0x10')]())[_0x20d6('0xa')](faxQueue[_0x20d6('0x11')]())[_0x20d6('0xa')](realtime[_0x20d6('0x12')]())[_0x20d6('0xa')](whatsappQueue[_0x20d6('0x13')]())[_0x20d6('0xa')](realtime[_0x20d6('0x14')]())[_0x20d6('0xa')](function(){return realtime;});}function main(){return server[_0x20d6('0x15')](realtime)[_0x20d6('0xa')](function(_0x17260e){return initRealtime();})[_0x20d6('0xa')](function(_0x58a27a){return setInterval(initRealtime,0x1388);})[_0x20d6('0x16')](function(_0x14fef4){console[_0x20d6('0x17')](_0x14fef4);});}main(); \ No newline at end of file +var _0x6d3d=['./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./realtime','./rpc/user'];(function(_0x3bad2a,_0xf3bf05){var _0x505d07=function(_0x1b8f06){while(--_0x1b8f06){_0x3bad2a['push'](_0x3bad2a['shift']());}};_0x505d07(++_0xf3bf05);}(_0x6d3d,0x99));var _0xd6d3=function(_0xe25def,_0x1c8b00){_0xe25def=_0xe25def-0x0;var _0x4ecd58=_0x6d3d[_0xe25def];return _0x4ecd58;};'use strict';var BPromise=require(_0xd6d3('0x0'));var server=require('./server');var Realtime=require(_0xd6d3('0x1'));var user=require(_0xd6d3('0x2'));var interval=require(_0xd6d3('0x3'));var openchannelQueue=require(_0xd6d3('0x4'));var chatQueue=require(_0xd6d3('0x5'));var smsQueue=require(_0xd6d3('0x6'));var mailQueue=require(_0xd6d3('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xd6d3('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd6d3('0x9')]()[_0xd6d3('0xa')](user[_0xd6d3('0xb')]())['then'](realtime['initAgents']())[_0xd6d3('0xa')](interval[_0xd6d3('0xc')]())[_0xd6d3('0xa')](realtime[_0xd6d3('0xd')]())[_0xd6d3('0xa')](openchannelQueue[_0xd6d3('0xe')]())[_0xd6d3('0xa')](realtime['initOpenchannelQueues']())[_0xd6d3('0xa')](chatQueue[_0xd6d3('0xf')]())[_0xd6d3('0xa')](realtime[_0xd6d3('0x10')]())[_0xd6d3('0xa')](smsQueue['getSmsQueues']())[_0xd6d3('0xa')](realtime[_0xd6d3('0x11')]())[_0xd6d3('0xa')](mailQueue[_0xd6d3('0x12')]())[_0xd6d3('0xa')](realtime[_0xd6d3('0x13')]())[_0xd6d3('0xa')](faxQueue[_0xd6d3('0x14')]())[_0xd6d3('0xa')](realtime[_0xd6d3('0x15')]())[_0xd6d3('0xa')](whatsappQueue[_0xd6d3('0x16')]())[_0xd6d3('0xa')](realtime[_0xd6d3('0x17')]())[_0xd6d3('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xd6d3('0xa')](function(_0x21906c){return initRealtime();})['then'](function(_0x5adbb9){return setInterval(initRealtime,0x1388);})[_0xd6d3('0x18')](function(_0x4b0749){console[_0xd6d3('0x19')](_0x4b0749);});}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 7b9017b..74d4374 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(_0x67743b,_0x1feaf2){var _0x29e9f9=function(_0x509291){while(--_0x509291){_0x67743b['push'](_0x67743b['shift']());}};_0x29e9f9(++_0x1feaf2);}(_0x7a54,0x106));var _0x47a5=function(_0x5449de,_0x30ae8c){_0x5449de=_0x5449de-0x0;var _0x2162a8=_0x7a54[_0x5449de];return _0x2162a8;};'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 _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(_0x2045d8,_0x2f55d2){var _0x364e08=function(_0x4e8797){while(--_0x4e8797){_0x2045d8['push'](_0x2045d8['shift']());}};_0x364e08(++_0x2f55d2);}(_0x7a54,0x106));var _0x47a5=function(_0x358112,_0x2022b5){_0x358112=_0x358112-0x0;var _0x1a6e1f=_0x7a54[_0x358112];return _0x1a6e1f;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index fc3c98c..9a5ea27 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 _0x05e3=['http','error','message','result','sendMailMessage','SendMail','bluebird'];(function(_0x15260f,_0x5eef15){var _0x56ce05=function(_0x27ae7f){while(--_0x27ae7f){_0x15260f['push'](_0x15260f['shift']());}};_0x56ce05(++_0x5eef15);}(_0x05e3,0x180));var _0x305e=function(_0x12a57d,_0x738bd1){_0x12a57d=_0x12a57d-0x0;var _0x4b26f6=_0x05e3[_0x12a57d];return _0x4b26f6;};'use strict';var BPromise=require(_0x305e('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x305e('0x1')]({'port':0x232b});function request(_0x40ca51,_0x10be03){return new BPromise(function(_0x3dbd5d,_0x593b5f){return client['request'](_0x40ca51,_0x10be03)['then'](function(_0x22c31f){if(_0x22c31f[_0x305e('0x2')]){return _0x593b5f(_0x22c31f[_0x305e('0x2')][_0x305e('0x3')]);}else{return _0x3dbd5d(_0x22c31f[_0x305e('0x4')]);}})['catch'](function(_0x1d65f6){return _0x593b5f(_0x1d65f6);});});}exports[_0x305e('0x5')]=function(_0x3e6abe,_0x8928f1){return request(_0x305e('0x6'),{'account':_0x3e6abe,'message':_0x8928f1});}; \ No newline at end of file +var _0x062a=['jayson/promise','http','request','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x062a,0x17b));var _0xa062=function(_0x32a548,_0x2cbe5a){_0x32a548=_0x32a548-0x0;var _0x2a7d54=_0x062a[_0x32a548];return _0x2a7d54;};'use strict';var BPromise=require(_0xa062('0x0'));var jayson=require(_0xa062('0x1'));var client=jayson['client'][_0xa062('0x2')]({'port':0x232b});function request(_0x32bf6f,_0x41041c){return new BPromise(function(_0x34b6b9,_0x485573){return client[_0xa062('0x3')](_0x32bf6f,_0x41041c)['then'](function(_0x3b5a69){if(_0x3b5a69['error']){return _0x485573(_0x3b5a69[_0xa062('0x4')][_0xa062('0x5')]);}else{return _0x34b6b9(_0x3b5a69[_0xa062('0x6')]);}})[_0xa062('0x7')](function(_0x53f2c7){return _0x485573(_0x53f2c7);});});}exports[_0xa062('0x8')]=function(_0x32e3cf,_0x5a0238){return request(_0xa062('0x9'),{'account':_0x32e3cf,'message':_0x5a0238});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 1c9c518..0aca3fd 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 _0x2272=['Capacity','maxcapacity','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','mailStatusTime','mailCapacity','faxStatus','whatsappStatusTime','stringify','emit','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','defaults','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity'];(function(_0x139e6e,_0x564ce2){var _0x87ef9d=function(_0x9cd128){while(--_0x9cd128){_0x139e6e['push'](_0x139e6e['shift']());}};_0x87ef9d(++_0x564ce2);}(_0x2272,0xd8));var _0x2227=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2272[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2227('0x0'));var md5=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var Redis=require(_0x2227('0x3'));var config=require(_0x2227('0x4'));config['redis']=_[_0x2227('0x5')](config[_0x2227('0x6')],{'host':_0x2227('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x1e5a8a){this['id']=_0x1e5a8a['id']||0x0;this[_0x2227('0x8')]=_0x1e5a8a[_0x2227('0x8')]||'';this[_0x2227('0x9')]=_0x1e5a8a[_0x2227('0x9')]||!![];this[_0x2227('0xa')]=_0x1e5a8a[_0x2227('0xa')]||![];this[_0x2227('0xb')]=_0x1e5a8a[_0x2227('0xb')]||![];this[_0x2227('0xc')]=_0x1e5a8a['mailPause']||![];this[_0x2227('0xd')]=_0x1e5a8a['faxPause']||![];this[_0x2227('0xe')]=_0x1e5a8a[_0x2227('0xe')]||![];this[_0x2227('0xf')]=_0x1e5a8a[_0x2227('0xf')]||![];this[_0x2227('0x10')]='unknown';this[_0x2227('0x11')]=0x0;this[_0x2227('0x12')]=_0x1e5a8a[_0x2227('0x12')]||0x0;this[_0x2227('0x13')]=0x0;this[_0x2227('0x14')]=_0x2227('0x15');this['mailStatusTime']=0x0;this['mailCapacity']=_0x1e5a8a['mailCapacity']||0x0;this[_0x2227('0x16')]=0x0;this['faxStatus']=_0x2227('0x15');this[_0x2227('0x17')]=0x0;this['faxCapacity']=_0x1e5a8a[_0x2227('0x18')]||0x0;this[_0x2227('0x19')]=0x0;this[_0x2227('0x1a')]=_0x2227('0x15');this[_0x2227('0x1b')]=0x0;this[_0x2227('0x1c')]=_0x1e5a8a['smsCapacity']||0x0;this[_0x2227('0x1d')]=0x0;this[_0x2227('0x1e')]=_0x2227('0x15');this['whatsappStatusTime']=0x0;this[_0x2227('0x1f')]=_0x1e5a8a[_0x2227('0x1f')]||0x0;this[_0x2227('0x20')]=0x0;this[_0x2227('0x21')]=_0x2227('0x15');this[_0x2227('0x22')]=0x0;this[_0x2227('0x23')]=_0x1e5a8a['openchannelCapacity']||0x0;this[_0x2227('0x24')]=0x0;this['busy']=![];this[_0x2227('0x25')]=undefined;this[_0x2227('0x1')]='';this[_0x2227('0x26')]={};this[_0x2227('0x27')]={};this[_0x2227('0x28')]={};this[_0x2227('0x29')]={};this[_0x2227('0x2a')]={};this[_0x2227('0x2b')]={};this[_0x2227('0x2c')]();}Agent[_0x2227('0x2d')][_0x2227('0x2e')]=function(_0x5a454f){if(this[_0x5a454f+_0x2227('0x2f')]>0x0){if(this[_0x5a454f+_0x2227('0x30')]>0x0&&this[_0x5a454f+'CurrentCapacity']>=this[_0x5a454f+_0x2227('0x30')]){return _0x2227('0x31');}else{return'working';}}else{return'idle';}};Agent[_0x2227('0x2d')][_0x2227('0x2c')]=function(){var _0x35333f=[_0x2227('0x32'),'chat',_0x2227('0x33'),_0x2227('0x34'),_0x2227('0x35'),_0x2227('0x36')];for(var _0x5d852f=0x0;_0x5d852f<_0x35333f[_0x2227('0x37')];_0x5d852f+=0x1){var _0xbe1ffb=this[_0x2227('0x2e')](_0x35333f[_0x5d852f]);if(this[_0x35333f[_0x5d852f]+_0x2227('0x38')]!==_0xbe1ffb){this[_0x35333f[_0x5d852f]+_0x2227('0x39')]=_['toNumber'](moment()['format']('x'));}this[_0x35333f[_0x5d852f]+'Status']=_0xbe1ffb;}var _0x2dc38d={'id':this['id'],'name':this['name'],'online':this[_0x2227('0x9')],'voicePause':this[_0x2227('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x2227('0xe')],'faxPause':this[_0x2227('0xd')],'openchannelPause':this[_0x2227('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x2227('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2227('0x13')],'mailStatus':this[_0x2227('0x14')],'mailStatusTime':this[_0x2227('0x3a')],'mailCapacity':this[_0x2227('0x3b')],'mailCurrentCapacity':this[_0x2227('0x16')],'faxStatus':this[_0x2227('0x3c')],'faxStatusTime':this[_0x2227('0x17')],'faxCapacity':this[_0x2227('0x18')],'faxCurrentCapacity':this[_0x2227('0x19')],'smsStatus':this[_0x2227('0x1a')],'smsStatusTime':this[_0x2227('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x2227('0x1d')],'whatsappStatus':this[_0x2227('0x1e')],'whatsappStatusTime':this[_0x2227('0x3d')],'whatsappCapacity':this[_0x2227('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x2227('0x21')],'openchannelStatusTime':this[_0x2227('0x22')],'openchannelCapacity':this[_0x2227('0x23')],'openchannelCurrentCapacity':this[_0x2227('0x24')],'busy':this['busy'],'busyQueue':this[_0x2227('0x25')],'chatWaitingInteractions':this[_0x2227('0x26')],'faxWaitingInteractions':this[_0x2227('0x27')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x2227('0x2a')],'whatsappWaitingInteractions':this[_0x2227('0x2b')]};var _0x5e4fc6=md5(JSON[_0x2227('0x3e')](_0x2dc38d));if(this[_0x2227('0x1')]!==_0x5e4fc6){this['md5']=_0x5e4fc6;io[_0x2227('0x3f')]('user:routing:update',_[_0x2227('0x40')](_0x2dc38d,[_0x2227('0x9')]));}};module[_0x2227('0x41')]=Agent; \ No newline at end of file +var _0x32f4=['whatsappCurrentCapacity','whatsappWaitingInteractions','stringify','emit','omit','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','Capacity','CurrentCapacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','StatusTime','format','faxCurrentCapacity'];(function(_0x109cf1,_0x24732b){var _0x2ad6c6=function(_0x46726c){while(--_0x46726c){_0x109cf1['push'](_0x109cf1['shift']());}};_0x2ad6c6(++_0x24732b);}(_0x32f4,0x154));var _0x432f=function(_0x2240dc,_0x2d3d3b){_0x2240dc=_0x2240dc-0x0;var _0x2e865d=_0x32f4[_0x2240dc];return _0x2e865d;};'use strict';var _=require(_0x432f('0x0'));var md5=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var Redis=require(_0x432f('0x3'));var config=require('../../../config/environment');config[_0x432f('0x4')]=_[_0x432f('0x5')](config['redis'],{'host':_0x432f('0x6'),'port':0x18eb});var io=require(_0x432f('0x7'))(new Redis(config[_0x432f('0x4')]));function Agent(_0x355b02){this['id']=_0x355b02['id']||0x0;this[_0x432f('0x8')]=_0x355b02['name']||'';this['online']=_0x355b02[_0x432f('0x9')]||!![];this[_0x432f('0xa')]=_0x355b02['voicePause']||![];this[_0x432f('0xb')]=_0x355b02['chatPause']||![];this[_0x432f('0xc')]=_0x355b02[_0x432f('0xc')]||![];this[_0x432f('0xd')]=_0x355b02[_0x432f('0xd')]||![];this[_0x432f('0xe')]=_0x355b02['smsPause']||![];this[_0x432f('0xf')]=_0x355b02['openchannelPause']||![];this[_0x432f('0x10')]='unknown';this[_0x432f('0x11')]=0x0;this[_0x432f('0x12')]=_0x355b02['chatCapacity']||0x0;this[_0x432f('0x13')]=0x0;this[_0x432f('0x14')]='unknown';this[_0x432f('0x15')]=0x0;this[_0x432f('0x16')]=_0x355b02['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x432f('0x17')]=_0x432f('0x18');this[_0x432f('0x19')]=0x0;this[_0x432f('0x1a')]=_0x355b02[_0x432f('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x432f('0x1b')]=_0x432f('0x18');this[_0x432f('0x1c')]=0x0;this[_0x432f('0x1d')]=_0x355b02['smsCapacity']||0x0;this[_0x432f('0x1e')]=0x0;this[_0x432f('0x1f')]=_0x432f('0x18');this[_0x432f('0x20')]=0x0;this[_0x432f('0x21')]=_0x355b02[_0x432f('0x21')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x432f('0x22')]='unknown';this[_0x432f('0x23')]=0x0;this[_0x432f('0x24')]=_0x355b02[_0x432f('0x24')]||0x0;this[_0x432f('0x25')]=0x0;this[_0x432f('0x26')]=![];this[_0x432f('0x27')]=undefined;this[_0x432f('0x1')]='';this[_0x432f('0x28')]={};this[_0x432f('0x29')]={};this[_0x432f('0x2a')]={};this[_0x432f('0x2b')]={};this[_0x432f('0x2c')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x432f('0x2d')]['getChannelStatus']=function(_0x28968e){if(this[_0x28968e+'CurrentCapacity']>0x0){if(this[_0x28968e+_0x432f('0x2e')]>0x0&&this[_0x28968e+_0x432f('0x2f')]>=this[_0x28968e+_0x432f('0x2e')]){return _0x432f('0x30');}else{return _0x432f('0x31');}}else{return _0x432f('0x32');}};Agent['prototype'][_0x432f('0x33')]=function(){var _0x33edec=['mail',_0x432f('0x34'),_0x432f('0x35'),_0x432f('0x36'),_0x432f('0x37'),_0x432f('0x38')];for(var _0x781862=0x0;_0x781862<_0x33edec[_0x432f('0x39')];_0x781862+=0x1){var _0x5a3d18=this[_0x432f('0x3a')](_0x33edec[_0x781862]);if(this[_0x33edec[_0x781862]+'Status']!==_0x5a3d18){this[_0x33edec[_0x781862]+_0x432f('0x3b')]=_['toNumber'](moment()[_0x432f('0x3c')]('x'));}this[_0x33edec[_0x781862]+'Status']=_0x5a3d18;}var _0x3f768b={'id':this['id'],'name':this['name'],'online':this[_0x432f('0x9')],'voicePause':this[_0x432f('0xa')],'chatPause':this[_0x432f('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0x432f('0xe')],'faxPause':this[_0x432f('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x432f('0x11')],'chatCapacity':this[_0x432f('0x12')],'chatCurrentCapacity':this[_0x432f('0x13')],'mailStatus':this[_0x432f('0x14')],'mailStatusTime':this[_0x432f('0x15')],'mailCapacity':this[_0x432f('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x432f('0x19')],'faxCapacity':this[_0x432f('0x1a')],'faxCurrentCapacity':this[_0x432f('0x3d')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x432f('0x1c')],'smsCapacity':this[_0x432f('0x1d')],'smsCurrentCapacity':this[_0x432f('0x1e')],'whatsappStatus':this[_0x432f('0x1f')],'whatsappStatusTime':this[_0x432f('0x20')],'whatsappCapacity':this[_0x432f('0x21')],'whatsappCurrentCapacity':this[_0x432f('0x3e')],'openchannelStatus':this[_0x432f('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x432f('0x25')],'busy':this[_0x432f('0x26')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x432f('0x2a')],'openchannelWaitingInteractions':this[_0x432f('0x2b')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x432f('0x3f')]};var _0x2c1bc1=md5(JSON[_0x432f('0x40')](_0x3f768b));if(this['md5']!==_0x2c1bc1){this[_0x432f('0x1')]=_0x2c1bc1;io[_0x432f('0x41')]('user:routing:update',_[_0x432f('0x42')](_0x3f768b,[_0x432f('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 246bb38..0cefda5 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 _0x3349=['prototype','map','_rr','loggedIn','length','online','available','paused','waiting','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','md5','updateRouting'];(function(_0x1896da,_0x3d8504){var _0x2d4bb3=function(_0x31680d){while(--_0x31680d){_0x1896da['push'](_0x1896da['shift']());}};_0x2d4bb3(++_0x3d8504);}(_0x3349,0x196));var _0x9334=function(_0x4ef8a0,_0x4bbbcb){_0x4ef8a0=_0x4ef8a0-0x0;var _0x11c017=_0x3349[_0x4ef8a0];return _0x11c017;};'use strict';var _=require(_0x9334('0x0'));var md5=require('md5');var util=require(_0x9334('0x1'));var Redis=require(_0x9334('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x9334('0x3')](config[_0x9334('0x4')],{'host':_0x9334('0x5'),'port':0x18eb});var io=require(_0x9334('0x6'))(new Redis(config[_0x9334('0x4')]));function ChatQueue(_0xf7ff){this['id']=_0xf7ff['id']||0x0;this[_0x9334('0x7')]=_0xf7ff[_0x9334('0x7')]||'';this[_0x9334('0x8')]=_0xf7ff['timeout']||0xa;this[_0x9334('0x9')]=_0xf7ff['strategy']||'beepall';this['Agents']=_0xf7ff[_0x9334('0xa')];this[_0x9334('0xb')]={};this['waiting']=0x0;this[_0x9334('0xc')]='';this[_0x9334('0xd')]();this['updateRealtime']();}ChatQueue[_0x9334('0xe')][_0x9334('0xd')]=function(){var _0x1f5733=this[_0x9334('0xb')]['_rr'];this[_0x9334('0xb')]=_[_0x9334('0xf')](this['Agents'],'id');this[_0x9334('0xb')][_0x9334('0x10')]=_0x1f5733;};ChatQueue[_0x9334('0xe')]['updateRealtime']=function(){this[_0x9334('0x11')]=0x0;this['paused']=0x0;for(var _0x15da2f=0x0;_0x15da2f=0x0?this[_0x9334('0x14')]:0x0;var _0x2bde2a={'id':this['id'],'available':this[_0x9334('0x14')],'loggedIn':this[_0x9334('0x11')],'name':this[_0x9334('0x7')],'paused':this[_0x9334('0x15')],'waiting':this[_0x9334('0x16')]};var _0x1fb494=md5(JSON['stringify'](_0x2bde2a));if(this[_0x9334('0xc')]!==_0x1fb494){this[_0x9334('0xc')]=_0x1fb494;io['to'](util[_0x9334('0x17')](_0x9334('0x18'),_0x2bde2a[_0x9334('0x7')]))[_0x9334('0x19')](_0x9334('0x1a'),_0x2bde2a);}};module[_0x9334('0x1b')]=ChatQueue; \ No newline at end of file +var _0xea32=['defaults','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online','chatPause','available','paused','stringify','emit','chat_queue:save','lodash','md5','util','ioredis'];(function(_0x33cade,_0x1b2b31){var _0xd46623=function(_0x45710f){while(--_0x45710f){_0x33cade['push'](_0x33cade['shift']());}};_0xd46623(++_0x1b2b31);}(_0xea32,0x68));var _0x2ea3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea32[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2ea3('0x0'));var md5=require(_0x2ea3('0x1'));var util=require(_0x2ea3('0x2'));var Redis=require(_0x2ea3('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x2ea3('0x4')](config[_0x2ea3('0x5')],{'host':_0x2ea3('0x6'),'port':0x18eb});var io=require(_0x2ea3('0x7'))(new Redis(config['redis']));function ChatQueue(_0x64908c){this['id']=_0x64908c['id']||0x0;this[_0x2ea3('0x8')]=_0x64908c[_0x2ea3('0x8')]||'';this['timeout']=_0x64908c['timeout']||0xa;this[_0x2ea3('0x9')]=_0x64908c['strategy']||_0x2ea3('0xa');this[_0x2ea3('0xb')]=_0x64908c['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x2ea3('0x1')]='';this[_0x2ea3('0xc')]();this[_0x2ea3('0xd')]();}ChatQueue[_0x2ea3('0xe')][_0x2ea3('0xc')]=function(){var _0x3d8768=this[_0x2ea3('0xf')][_0x2ea3('0x10')];this[_0x2ea3('0xf')]=_[_0x2ea3('0x11')](this[_0x2ea3('0xb')],'id');this[_0x2ea3('0xf')][_0x2ea3('0x10')]=_0x3d8768;};ChatQueue[_0x2ea3('0xe')][_0x2ea3('0xd')]=function(){this[_0x2ea3('0x12')]=0x0;this['paused']=0x0;for(var _0x3f0dc1=0x0;_0x3f0dc1=0x0?this[_0x2ea3('0x16')]:0x0;var _0x24fcb2={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x2ea3('0x8')],'paused':this[_0x2ea3('0x17')],'waiting':this['waiting']};var _0x5c9ecc=md5(JSON[_0x2ea3('0x18')](_0x24fcb2));if(this['md5']!==_0x5c9ecc){this['md5']=_0x5c9ecc;io['to'](util['format']('chat:queue:%s',_0x24fcb2['name']))[_0x2ea3('0x19')](_0x2ea3('0x1a'),_0x24fcb2);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 4715286..4d80645 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 _0x59a8=['timeout','strategy','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name'];(function(_0xa1cfa8,_0x252403){var _0x158a5f=function(_0x14c809){while(--_0x14c809){_0xa1cfa8['push'](_0xa1cfa8['shift']());}};_0x158a5f(++_0x252403);}(_0x59a8,0x9b));var _0x859a=function(_0x313551,_0x20d1e9){_0x313551=_0x313551-0x0;var _0x2d2030=_0x59a8[_0x313551];return _0x2d2030;};'use strict';var _=require('lodash');var md5=require(_0x859a('0x0'));var util=require(_0x859a('0x1'));var Redis=require(_0x859a('0x2'));var config=require(_0x859a('0x3'));config[_0x859a('0x4')]=_['defaults'](config[_0x859a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x859a('0x5'))(new Redis(config[_0x859a('0x4')]));function FaxQueue(_0x251082){this['id']=_0x251082['id']||0x0;this['name']=_0x251082[_0x859a('0x6')]||'';this[_0x859a('0x7')]=_0x251082[_0x859a('0x7')]||0xa;this[_0x859a('0x8')]=_0x251082[_0x859a('0x8')]||'beepall';this['Agents']=_0x251082[_0x859a('0x9')];this[_0x859a('0xa')]={};this[_0x859a('0xb')]=0x0;this[_0x859a('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x859a('0xc')][_0x859a('0xd')]=function(){var _0x1d66df=this[_0x859a('0xa')][_0x859a('0xe')];this[_0x859a('0xa')]=_[_0x859a('0xf')](this['Agents'],'id');this[_0x859a('0xa')][_0x859a('0xe')]=_0x1d66df;};FaxQueue[_0x859a('0xc')][_0x859a('0x10')]=function(){this[_0x859a('0x11')]=0x0;this[_0x859a('0x12')]=0x0;for(var _0x3ee3cc=0x0;_0x3ee3cc=0x0?this[_0x859a('0x15')]:0x0;var _0x3d3f5a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x859a('0x11')],'name':this[_0x859a('0x6')],'paused':this[_0x859a('0x12')],'waiting':this[_0x859a('0xb')]};var _0x5464bf=md5(JSON[_0x859a('0x16')](_0x3d3f5a));if(this['md5']!==_0x5464bf){this['md5']=_0x5464bf;io['to'](util['format'](_0x859a('0x17'),_0x3d3f5a['name']))[_0x859a('0x18')](_0x859a('0x19'),_0x3d3f5a);}};module[_0x859a('0x1a')]=FaxQueue; \ No newline at end of file +var _0xd941=['strategy','Agents','waiting','updateRouting','_rr','mapAgentsId','updateRealtime','paused','length','online','loggedIn','available','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xd941,0x1a7));var _0x1d94=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xd941[_0x16b1a5];return _0x475e25;};'use strict';var _=require('lodash');var md5=require(_0x1d94('0x0'));var util=require(_0x1d94('0x1'));var Redis=require(_0x1d94('0x2'));var config=require(_0x1d94('0x3'));config['redis']=_[_0x1d94('0x4')](config[_0x1d94('0x5')],{'host':_0x1d94('0x6'),'port':0x18eb});var io=require(_0x1d94('0x7'))(new Redis(config[_0x1d94('0x5')]));function FaxQueue(_0x3f2387){this['id']=_0x3f2387['id']||0x0;this['name']=_0x3f2387['name']||'';this[_0x1d94('0x8')]=_0x3f2387[_0x1d94('0x8')]||0xa;this[_0x1d94('0x9')]=_0x3f2387[_0x1d94('0x9')]||'beepall';this[_0x1d94('0xa')]=_0x3f2387['Agents'];this['mapAgentsId']={};this[_0x1d94('0xb')]=0x0;this[_0x1d94('0x0')]='';this[_0x1d94('0xc')]();this['updateRealtime']();}FaxQueue['prototype'][_0x1d94('0xc')]=function(){var _0x48ed48=this['mapAgentsId'][_0x1d94('0xd')];this['mapAgentsId']=_['map'](this[_0x1d94('0xa')],'id');this[_0x1d94('0xe')][_0x1d94('0xd')]=_0x48ed48;};FaxQueue['prototype'][_0x1d94('0xf')]=function(){this['loggedIn']=0x0;this[_0x1d94('0x10')]=0x0;for(var _0x277419=0x0;_0x277419=0x0?this[_0x1d94('0x14')]:0x0;var _0x10f8ee={'id':this['id'],'available':this[_0x1d94('0x14')],'loggedIn':this[_0x1d94('0x13')],'name':this['name'],'paused':this[_0x1d94('0x10')],'waiting':this[_0x1d94('0xb')]};var _0x428d0c=md5(JSON['stringify'](_0x10f8ee));if(this[_0x1d94('0x0')]!==_0x428d0c){this[_0x1d94('0x0')]=_0x428d0c;io['to'](util['format'](_0x1d94('0x15'),_0x10f8ee['name']))[_0x1d94('0x16')](_0x1d94('0x17'),_0x10f8ee);}};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 c80d876..5e015b3 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 _0x7699=['exports','name','Intervals'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7699,0x1a2));var _0x9769=function(_0x502036,_0x502686){_0x502036=_0x502036-0x0;var _0x485247=_0x7699[_0x502036];return _0x485247;};'use strict';function Interval(_0x39f5d9){this['id']=_0x39f5d9['id']||0x0;this['name']=_0x39f5d9[_0x9769('0x0')]||'';this['Intervals']=_0x39f5d9[_0x9769('0x1')]||{};}module[_0x9769('0x2')]=Interval; \ No newline at end of file +var _0x649a=['Intervals','exports','name'];(function(_0x437b14,_0xcf17d4){var _0x1ad24e=function(_0x44b236){while(--_0x44b236){_0x437b14['push'](_0x437b14['shift']());}};_0x1ad24e(++_0xcf17d4);}(_0x649a,0x1be));var _0xa649=function(_0x435ce7,_0x5bf1ef){_0x435ce7=_0x435ce7-0x0;var _0x47edc0=_0x649a[_0x435ce7];return _0x47edc0;};'use strict';function Interval(_0x4b8dda){this['id']=_0x4b8dda['id']||0x0;this[_0xa649('0x0')]=_0x4b8dda[_0xa649('0x0')]||'';this['Intervals']=_0x4b8dda[_0xa649('0x1')]||{};}module[_0xa649('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 5c182ab..c318d65 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 _0x2796=['_rr','map','prototype','loggedIn','paused','length','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting'];(function(_0x36b06c,_0x4927ef){var _0x1564c9=function(_0x19077b){while(--_0x19077b){_0x36b06c['push'](_0x36b06c['shift']());}};_0x1564c9(++_0x4927ef);}(_0x2796,0x1c0));var _0x6279=function(_0x104264,_0x651b2c){_0x104264=_0x104264-0x0;var _0x265a60=_0x2796[_0x104264];return _0x265a60;};'use strict';var _=require(_0x6279('0x0'));var md5=require(_0x6279('0x1'));var util=require(_0x6279('0x2'));var Redis=require(_0x6279('0x3'));var config=require(_0x6279('0x4'));config['redis']=_[_0x6279('0x5')](config[_0x6279('0x6')],{'host':_0x6279('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6279('0x6')]));function MailQueue(_0x553a1c){this['id']=_0x553a1c['id']||0x0;this[_0x6279('0x8')]=_0x553a1c['name']||'';this[_0x6279('0x9')]=_0x553a1c['timeout']||0xa;this[_0x6279('0xa')]=_0x553a1c[_0x6279('0xa')]||_0x6279('0xb');this[_0x6279('0xc')]=_0x553a1c[_0x6279('0xc')];this[_0x6279('0xd')]={};this[_0x6279('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0x6279('0xf')]();}MailQueue['prototype'][_0x6279('0x10')]=function(){var _0x44352c=this[_0x6279('0xd')][_0x6279('0x11')];this[_0x6279('0xd')]=_[_0x6279('0x12')](this['Agents'],'id');this[_0x6279('0xd')][_0x6279('0x11')]=_0x44352c;};MailQueue[_0x6279('0x13')][_0x6279('0xf')]=function(){this[_0x6279('0x14')]=0x0;this[_0x6279('0x15')]=0x0;for(var _0x4b7337=0x0;_0x4b7337=0x0?this[_0x6279('0x19')]:0x0;var _0x4dae19={'id':this['id'],'available':this[_0x6279('0x19')],'loggedIn':this[_0x6279('0x14')],'name':this[_0x6279('0x8')],'paused':this[_0x6279('0x15')],'waiting':this[_0x6279('0xe')]};var _0x10d7bc=md5(JSON[_0x6279('0x1a')](_0x4dae19));if(this[_0x6279('0x1')]!==_0x10d7bc){this[_0x6279('0x1')]=_0x10d7bc;io['to'](util['format'](_0x6279('0x1b'),_0x4dae19[_0x6279('0x8')]))[_0x6279('0x1c')](_0x6279('0x1d'),_0x4dae19);}};module[_0x6279('0x1e')]=MailQueue; \ No newline at end of file +var _0xeaeb=['redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','mailPause','available','stringify','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults'];(function(_0x30afeb,_0x5c809b){var _0xb256cc=function(_0x2eaa4f){while(--_0x2eaa4f){_0x30afeb['push'](_0x30afeb['shift']());}};_0xb256cc(++_0x5c809b);}(_0xeaeb,0x6a));var _0xbeae=function(_0x3fd275,_0xf0cd7){_0x3fd275=_0x3fd275-0x0;var _0xe4f14f=_0xeaeb[_0x3fd275];return _0xe4f14f;};'use strict';var _=require(_0xbeae('0x0'));var md5=require(_0xbeae('0x1'));var util=require(_0xbeae('0x2'));var Redis=require(_0xbeae('0x3'));var config=require(_0xbeae('0x4'));config['redis']=_[_0xbeae('0x5')](config[_0xbeae('0x6')],{'host':_0xbeae('0x7'),'port':0x18eb});var io=require(_0xbeae('0x8'))(new Redis(config[_0xbeae('0x6')]));function MailQueue(_0x3bccbb){this['id']=_0x3bccbb['id']||0x0;this[_0xbeae('0x9')]=_0x3bccbb[_0xbeae('0x9')]||'';this[_0xbeae('0xa')]=_0x3bccbb[_0xbeae('0xa')]||0xa;this[_0xbeae('0xb')]=_0x3bccbb[_0xbeae('0xb')]||'beepall';this[_0xbeae('0xc')]=_0x3bccbb[_0xbeae('0xc')];this[_0xbeae('0xd')]={};this[_0xbeae('0xe')]=0x0;this[_0xbeae('0x1')]='';this['updateRouting']();this[_0xbeae('0xf')]();}MailQueue[_0xbeae('0x10')]['updateRouting']=function(){var _0x130769=this[_0xbeae('0xd')]['_rr'];this[_0xbeae('0xd')]=_[_0xbeae('0x11')](this[_0xbeae('0xc')],'id');this[_0xbeae('0xd')][_0xbeae('0x12')]=_0x130769;};MailQueue[_0xbeae('0x10')][_0xbeae('0xf')]=function(){this[_0xbeae('0x13')]=0x0;this[_0xbeae('0x14')]=0x0;for(var _0x1ec5aa=0x0;_0x1ec5aa=0x0?this[_0xbeae('0x17')]:0x0;var _0x51cde9={'id':this['id'],'available':this[_0xbeae('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xbeae('0x9')],'paused':this[_0xbeae('0x14')],'waiting':this[_0xbeae('0xe')]};var _0x32b198=md5(JSON[_0xbeae('0x18')](_0x51cde9));if(this['md5']!==_0x32b198){this['md5']=_0x32b198;io['to'](util['format']('mail:queue:%s',_0x51cde9['name']))[_0xbeae('0x19')](_0xbeae('0x1a'),_0x51cde9);}};module[_0xbeae('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index a3480ed..eaf6973 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x326f,0xd1));var _0xf326=function(_0x29b108,_0x389fc9){_0x29b108=_0x29b108-0x0;var _0x5a43ca=_0x326f[_0x29b108];return _0x5a43ca;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x2c5ff3,_0xf7e6b2){var _0x131838=function(_0x2cf1c6){while(--_0x2cf1c6){_0x2c5ff3['push'](_0x2c5ff3['shift']());}};_0x131838(++_0xf7e6b2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0x5fc3[_0x2906e6];return _0x12517a;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b46a14c..fb652cd 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 _0x8db0=['updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online','smsPause','available','paused','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','name','timeout','strategy','beepall','Agents','waiting'];(function(_0x1dc462,_0x56e978){var _0x1024e2=function(_0x4085c3){while(--_0x4085c3){_0x1dc462['push'](_0x1dc462['shift']());}};_0x1024e2(++_0x56e978);}(_0x8db0,0x65));var _0x08db=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x8db0[_0x52085a];return _0x5afc1a;};'use strict';var _=require(_0x08db('0x0'));var md5=require(_0x08db('0x1'));var util=require('util');var Redis=require(_0x08db('0x2'));var config=require(_0x08db('0x3'));config[_0x08db('0x4')]=_['defaults'](config[_0x08db('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x218333){this['id']=_0x218333['id']||0x0;this['name']=_0x218333[_0x08db('0x5')]||'';this['timeout']=_0x218333[_0x08db('0x6')]||0xa;this[_0x08db('0x7')]=_0x218333[_0x08db('0x7')]||_0x08db('0x8');this[_0x08db('0x9')]=_0x218333['Agents'];this['mapAgentsId']={};this[_0x08db('0xa')]=0x0;this[_0x08db('0x1')]='';this[_0x08db('0xb')]();this[_0x08db('0xc')]();}SmsQueue[_0x08db('0xd')][_0x08db('0xb')]=function(){var _0x2b1d6f=this[_0x08db('0xe')][_0x08db('0xf')];this[_0x08db('0xe')]=_[_0x08db('0x10')](this[_0x08db('0x9')],'id');this[_0x08db('0xe')][_0x08db('0xf')]=_0x2b1d6f;};SmsQueue[_0x08db('0xd')][_0x08db('0xc')]=function(){this[_0x08db('0x11')]=0x0;this['paused']=0x0;for(var _0x592286=0x0;_0x592286=0x0?this[_0x08db('0x15')]:0x0;var _0x16ca71={'id':this['id'],'available':this[_0x08db('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x08db('0x5')],'paused':this[_0x08db('0x16')],'waiting':this[_0x08db('0xa')]};var _0x27dc5c=md5(JSON[_0x08db('0x17')](_0x16ca71));if(this[_0x08db('0x1')]!==_0x27dc5c){this[_0x08db('0x1')]=_0x27dc5c;io['to'](util[_0x08db('0x18')](_0x08db('0x19'),_0x16ca71[_0x08db('0x5')]))['emit'](_0x08db('0x1a'),_0x16ca71);}};module[_0x08db('0x1b')]=SmsQueue; \ No newline at end of file +var _0x430e=['prototype','_rr','map','updateRealtime','loggedIn','paused','online','available','format','sms:queue:%s','sms_queue:save','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x430e,0x105));var _0xe430=function(_0x365c78,_0x23ab28){_0x365c78=_0x365c78-0x0;var _0x40d398=_0x430e[_0x365c78];return _0x40d398;};'use strict';var _=require('lodash');var md5=require(_0xe430('0x0'));var util=require(_0xe430('0x1'));var Redis=require('ioredis');var config=require(_0xe430('0x2'));config[_0xe430('0x3')]=_[_0xe430('0x4')](config[_0xe430('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xe430('0x5'))(new Redis(config[_0xe430('0x3')]));function SmsQueue(_0x41376b){this['id']=_0x41376b['id']||0x0;this[_0xe430('0x6')]=_0x41376b['name']||'';this[_0xe430('0x7')]=_0x41376b[_0xe430('0x7')]||0xa;this[_0xe430('0x8')]=_0x41376b[_0xe430('0x8')]||_0xe430('0x9');this['Agents']=_0x41376b[_0xe430('0xa')];this[_0xe430('0xb')]={};this[_0xe430('0xc')]=0x0;this[_0xe430('0x0')]='';this[_0xe430('0xd')]();this['updateRealtime']();}SmsQueue[_0xe430('0xe')][_0xe430('0xd')]=function(){var _0xd28c5c=this[_0xe430('0xb')][_0xe430('0xf')];this['mapAgentsId']=_[_0xe430('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xe430('0xf')]=_0xd28c5c;};SmsQueue[_0xe430('0xe')][_0xe430('0x11')]=function(){this[_0xe430('0x12')]=0x0;this[_0xe430('0x13')]=0x0;for(var _0x3c8205=0x0;_0x3c8205=0x0?this[_0xe430('0x15')]:0x0;var _0x6e529b={'id':this['id'],'available':this[_0xe430('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xe430('0x13')],'waiting':this[_0xe430('0xc')]};var _0x1c80f0=md5(JSON['stringify'](_0x6e529b));if(this['md5']!==_0x1c80f0){this['md5']=_0x1c80f0;io['to'](util[_0xe430('0x16')](_0xe430('0x17'),_0x6e529b[_0xe430('0x6')]))['emit'](_0xe430('0x18'),_0x6e529b);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 0a98eef..662984d 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 _0x5bcf=['paused','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','length','online','whatsappPause','available','loggedIn'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x5bcf,0xe6));var _0xf5bc=function(_0x2b8ead,_0x4ac69b){_0x2b8ead=_0x2b8ead-0x0;var _0x2faa50=_0x5bcf[_0x2b8ead];return _0x2faa50;};'use strict';var _=require('lodash');var md5=require(_0xf5bc('0x0'));var util=require('util');var Redis=require(_0xf5bc('0x1'));var config=require(_0xf5bc('0x2'));config['redis']=_[_0xf5bc('0x3')](config[_0xf5bc('0x4')],{'host':_0xf5bc('0x5'),'port':0x18eb});var io=require(_0xf5bc('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x4cd546){this['id']=_0x4cd546['id']||0x0;this[_0xf5bc('0x7')]=_0x4cd546['name']||'';this[_0xf5bc('0x8')]=_0x4cd546[_0xf5bc('0x8')]||0xa;this['strategy']=_0x4cd546[_0xf5bc('0x9')]||'beepall';this[_0xf5bc('0xa')]=_0x4cd546[_0xf5bc('0xa')];this[_0xf5bc('0xb')]={};this[_0xf5bc('0xc')]=0x0;this[_0xf5bc('0x0')]='';this[_0xf5bc('0xd')]();this['updateRealtime']();}WhatsappQueue[_0xf5bc('0xe')][_0xf5bc('0xd')]=function(){var _0x311d13=this['mapAgentsId'][_0xf5bc('0xf')];this[_0xf5bc('0xb')]=_[_0xf5bc('0x10')](this[_0xf5bc('0xa')],'id');this[_0xf5bc('0xb')][_0xf5bc('0xf')]=_0x311d13;};WhatsappQueue[_0xf5bc('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x497553=0x0;_0x497553=0x0?this['available']:0x0;var _0x3d30b7={'id':this['id'],'available':this[_0xf5bc('0x14')],'loggedIn':this[_0xf5bc('0x15')],'name':this[_0xf5bc('0x7')],'paused':this[_0xf5bc('0x16')],'waiting':this[_0xf5bc('0xc')]};var _0x92dcd0=md5(JSON[_0xf5bc('0x17')](_0x3d30b7));if(this['md5']!==_0x92dcd0){this['md5']=_0x92dcd0;io['to'](util[_0xf5bc('0x18')](_0xf5bc('0x19'),_0x3d30b7[_0xf5bc('0x7')]))['emit'](_0xf5bc('0x1a'),_0x3d30b7);}};module[_0xf5bc('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x37f9=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x5e6e4f,_0x221bcc){var _0x1028ec=function(_0xe55784){while(--_0xe55784){_0x5e6e4f['push'](_0x5e6e4f['shift']());}};_0x1028ec(++_0x221bcc);}(_0x37f9,0xb8));var _0x937f=function(_0x18cbde,_0x3af212){_0x18cbde=_0x18cbde-0x0;var _0x3bb3a8=_0x37f9[_0x18cbde];return _0x3bb3a8;};'use strict';var _=require(_0x937f('0x0'));var md5=require(_0x937f('0x1'));var util=require(_0x937f('0x2'));var Redis=require(_0x937f('0x3'));var config=require(_0x937f('0x4'));config[_0x937f('0x5')]=_[_0x937f('0x6')](config[_0x937f('0x5')],{'host':_0x937f('0x7'),'port':0x18eb});var io=require(_0x937f('0x8'))(new Redis(config[_0x937f('0x5')]));function WhatsappQueue(_0x31d918){this['id']=_0x31d918['id']||0x0;this[_0x937f('0x9')]=_0x31d918[_0x937f('0x9')]||'';this[_0x937f('0xa')]=_0x31d918[_0x937f('0xa')]||0xa;this[_0x937f('0xb')]=_0x31d918[_0x937f('0xb')]||_0x937f('0xc');this[_0x937f('0xd')]=_0x31d918[_0x937f('0xd')];this[_0x937f('0xe')]={};this[_0x937f('0xf')]=0x0;this[_0x937f('0x1')]='';this[_0x937f('0x10')]();this[_0x937f('0x11')]();}WhatsappQueue[_0x937f('0x12')][_0x937f('0x10')]=function(){var _0x372ad5=this['mapAgentsId'][_0x937f('0x13')];this['mapAgentsId']=_[_0x937f('0x14')](this['Agents'],'id');this[_0x937f('0xe')]['_rr']=_0x372ad5;};WhatsappQueue[_0x937f('0x12')][_0x937f('0x11')]=function(){this[_0x937f('0x15')]=0x0;this[_0x937f('0x16')]=0x0;for(var _0x5c008e=0x0;_0x5c008e=0x0?this[_0x937f('0x1a')]:0x0;var _0x258fd7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x937f('0x15')],'name':this[_0x937f('0x9')],'paused':this[_0x937f('0x16')],'waiting':this[_0x937f('0xf')]};var _0x38042c=md5(JSON[_0x937f('0x1b')](_0x258fd7));if(this[_0x937f('0x1')]!==_0x38042c){this['md5']=_0x38042c;io['to'](util[_0x937f('0x1c')](_0x937f('0x1d'),_0x258fd7[_0x937f('0x9')]))[_0x937f('0x1e')](_0x937f('0x1f'),_0x258fd7);}};module[_0x937f('0x20')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index fc88cef..e1d4ec8 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(_0x2921ba,_0x591755){var _0x49d2e3=function(_0x29a473){while(--_0x29a473){_0x2921ba['push'](_0x2921ba['shift']());}};_0x49d2e3(++_0x591755);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0xb10b[_0x3d00db];return _0x41f115;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 84bf1f7..24571a9 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 _0x27d9=['update','Request','UpdateChatInteraction','addTags','../client'];(function(_0x2ab324,_0x49fbac){var _0x427c10=function(_0x4674c2){while(--_0x4674c2){_0x2ab324['push'](_0x2ab324['shift']());}};_0x427c10(++_0x49fbac);}(_0x27d9,0xc7));var _0x927d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x27d9[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x927d('0x0'));exports[_0x927d('0x1')]=function(_0x1a5f43,_0x78ac9a){return client[_0x927d('0x2')](_0x927d('0x3'),{'body':_0x78ac9a,'options':{'where':{'id':_0x1a5f43}},'log':'updateChatInteraction'});};exports[_0x927d('0x4')]=function(_0x220b5c,_0x206cb7){return client[_0x927d('0x2')]('AddTagsToChatInteraction',{'body':_0x206cb7,'options':{'where':{'id':_0x220b5c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xf983=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0xb25663,_0xc59fd3){var _0xc871e=function(_0x2819da){while(--_0x2819da){_0xb25663['push'](_0xb25663['shift']());}};_0xc871e(++_0xc59fd3);}(_0xf983,0x74));var _0x3f98=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0xf983[_0x516927];return _0x30749b;};'use strict';var client=require(_0x3f98('0x0'));exports[_0x3f98('0x1')]=function(_0x2a1bfd,_0x5252d6){return client[_0x3f98('0x2')](_0x3f98('0x3'),{'body':_0x5252d6,'options':{'where':{'id':_0x2a1bfd}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x37ac72,_0x57b6fa){return client[_0x3f98('0x2')](_0x3f98('0x4'),{'body':_0x57b6fa,'options':{'where':{'id':_0x37ac72}},'log':_0x3f98('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 86702e5..319599b 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 _0x942c=['createChatMessage','CreateChatMessage'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x942c,0xa3));var _0xc942=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x942c[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports['create']=function(_0x536c2d){return client['Request'](_0xc942('0x0'),{'body':_0x536c2d,'log':_0xc942('0x1')});}; \ No newline at end of file +var _0x282f=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x1534ee,_0xfed830){var _0x34c9e3=function(_0x2728e5){while(--_0x2728e5){_0x1534ee['push'](_0x1534ee['shift']());}};_0x34c9e3(++_0xfed830);}(_0x282f,0x160));var _0xf282=function(_0xf5ce7e,_0xa60a9d){_0xf5ce7e=_0xf5ce7e-0x0;var _0x39b874=_0x282f[_0xf5ce7e];return _0x39b874;};'use strict';var client=require(_0xf282('0x0'));exports[_0xf282('0x1')]=function(_0x49dbd4){return client['Request'](_0xf282('0x2'),{'body':_0x49dbd4,'log':_0xf282('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ed60a95..de166ea 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 _0x9b67=['User','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x9b67,0xf6));var _0x79b6=function(_0x44a6c9,_0x3ec0c1){_0x44a6c9=_0x44a6c9-0x0;var _0x5b683a=_0x9b67[_0x44a6c9];return _0x5b683a;};'use strict';var client=require(_0x79b6('0x0'));exports[_0x79b6('0x1')]=function(){return function(){return client[_0x79b6('0x2')](_0x79b6('0x3'),{'options':{'raw':![],'attributes':['id',_0x79b6('0x4'),'timeout',_0x79b6('0x5')],'include':[{'model':_0x79b6('0x6'),'as':'Agents','attributes':['id','name',_0x79b6('0x7'),_0x79b6('0x8')]}]},'log':_0x79b6('0x1')});};}; \ No newline at end of file +var _0x44ae=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','User','Agents','name','online'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x44ae,0x17d));var _0xe44a=function(_0x55d7c2,_0x4ce6fb){_0x55d7c2=_0x55d7c2-0x0;var _0x1755ef=_0x44ae[_0x55d7c2];return _0x1755ef;};'use strict';var client=require(_0xe44a('0x0'));exports[_0xe44a('0x1')]=function(){return function(){return client[_0xe44a('0x2')](_0xe44a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe44a('0x4'),'strategy'],'include':[{'model':_0xe44a('0x5'),'as':_0xe44a('0x6'),'attributes':['id',_0xe44a('0x7'),_0xe44a('0x8'),_0xe44a('0x9')]}]},'log':_0xe44a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 96ecab2..c54f545 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 _0x5c4a=['DESC','create','CreateChatQueueReport','Request','UpdateChatQueueReport'];(function(_0x4bcb3c,_0x192122){var _0xfe09bb=function(_0xcd8ad2){while(--_0xcd8ad2){_0x4bcb3c['push'](_0x4bcb3c['shift']());}};_0xfe09bb(++_0x192122);}(_0x5c4a,0xfb));var _0xa5c4=function(_0x579fc8,_0x7b1920){_0x579fc8=_0x579fc8-0x0;var _0x5659b7=_0x5c4a[_0x579fc8];return _0x5659b7;};'use strict';var client=require('../client');exports[_0xa5c4('0x0')]=function(_0x1ba095){return client['Request'](_0xa5c4('0x1'),{'body':_0x1ba095,'log':_0xa5c4('0x1')});};exports['update']=function(_0x7411a4,_0x180239){return client[_0xa5c4('0x2')](_0xa5c4('0x3'),{'body':_0x180239,'options':{'where':{'uniqueid':_0x7411a4},'order':[['id',_0xa5c4('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x49e9=['DESC','../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x14f8eb,_0x53f5b4){var _0x4c159d=function(_0x31900e){while(--_0x31900e){_0x14f8eb['push'](_0x14f8eb['shift']());}};_0x4c159d(++_0x53f5b4);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x949e('0x0'));exports[_0x949e('0x1')]=function(_0x4d18e7){return client[_0x949e('0x2')](_0x949e('0x3'),{'body':_0x4d18e7,'log':_0x949e('0x3')});};exports['update']=function(_0x4f1295,_0x114f65){return client['Request'](_0x949e('0x4'),{'body':_0x114f65,'options':{'where':{'uniqueid':_0x4f1295},'order':[['id',_0x949e('0x5')]],'limit':0x1},'log':_0x949e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 5a86657..a0fea84 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(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0x7a54,0x106));var _0x47a5=function(_0x3222b0,_0x2f4ce8){_0x3222b0=_0x3222b0-0x0;var _0x55e031=_0x7a54[_0x3222b0];return _0x55e031;};'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(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0x7a54,0x106));var _0x47a5=function(_0x1012b7,_0x3faf29){_0x1012b7=_0x1012b7-0x0;var _0x374a27=_0x7a54[_0x1012b7];return _0x374a27;};'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 53e1c87..aec664d 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 _0x80b7=['CreateFaxMessage','../client','Request'];(function(_0x17b287,_0x4bed1c){var _0x177054=function(_0x380f78){while(--_0x380f78){_0x17b287['push'](_0x17b287['shift']());}};_0x177054(++_0x4bed1c);}(_0x80b7,0x76));var _0x780b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x80b7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x780b('0x0'));exports['create']=function(_0x3e34dc){return client[_0x780b('0x1')](_0x780b('0x2'),{'body':_0x3e34dc,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xcec7=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x2146e6,_0x4c7f26){var _0x2aad01=function(_0x235900){while(--_0x235900){_0x2146e6['push'](_0x2146e6['shift']());}};_0x2aad01(++_0x4c7f26);}(_0xcec7,0x131));var _0x7cec=function(_0x3386a6,_0x474678){_0x3386a6=_0x3386a6-0x0;var _0x362b74=_0xcec7[_0x3386a6];return _0x362b74;};'use strict';var client=require(_0x7cec('0x0'));exports[_0x7cec('0x1')]=function(_0x2e4d88){return client[_0x7cec('0x2')](_0x7cec('0x3'),{'body':_0x2e4d88,'log':_0x7cec('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2fb447a..2f32ef0 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 _0x16a2=['Request','timeout','strategy','User','Agents','faxPause','getFaxQueues'];(function(_0x447449,_0x28dbe){var _0x396949=function(_0x4e4ce2){while(--_0x4e4ce2){_0x447449['push'](_0x447449['shift']());}};_0x396949(++_0x28dbe);}(_0x16a2,0x16b));var _0x216a=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x16a2[_0x39e164];return _0x13fa6b;};'use strict';var client=require('../client');exports[_0x216a('0x0')]=function(){return function(){return client[_0x216a('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x216a('0x2'),_0x216a('0x3')],'include':[{'model':_0x216a('0x4'),'as':_0x216a('0x5'),'attributes':['id','name','online',_0x216a('0x6')]}]},'log':_0x216a('0x0')});};}; \ No newline at end of file +var _0xa7d9=['Agents','faxPause','getFaxQueues','../client','timeout','User'];(function(_0x31bae4,_0x553ee3){var _0x5dbb97=function(_0x10a2a5){while(--_0x10a2a5){_0x31bae4['push'](_0x31bae4['shift']());}};_0x5dbb97(++_0x553ee3);}(_0xa7d9,0x141));var _0x9a7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7d9[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x9a7d('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x9a7d('0x1'),'strategy'],'include':[{'model':_0x9a7d('0x2'),'as':_0x9a7d('0x3'),'attributes':['id','name','online',_0x9a7d('0x4')]}]},'log':_0x9a7d('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d0f04b9..45d5c93 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 _0x0b48=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0xdd2348,_0x5d3232){var _0x2e0a02=function(_0x38e687){while(--_0x38e687){_0xdd2348['push'](_0xdd2348['shift']());}};_0x2e0a02(++_0x5d3232);}(_0x0b48,0xf1));var _0x80b4=function(_0xdf676b,_0x53983b){_0xdf676b=_0xdf676b-0x0;var _0xb17295=_0x0b48[_0xdf676b];return _0xb17295;};'use strict';var client=require(_0x80b4('0x0'));exports[_0x80b4('0x1')]=function(_0x5a68e6){return client[_0x80b4('0x2')]('CreateFaxQueueReport',{'body':_0x5a68e6,'log':_0x80b4('0x3')});};exports[_0x80b4('0x4')]=function(_0x5700d9,_0x11df5e){return client[_0x80b4('0x2')](_0x80b4('0x5'),{'body':_0x11df5e,'options':{'where':{'uniqueid':_0x5700d9},'order':[['id',_0x80b4('0x6')]],'limit':0x1},'log':_0x80b4('0x5')});}; \ No newline at end of file +var _0xcd5a=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x8f9705,_0x3ff5cf){var _0x37b58b=function(_0x49ff6f){while(--_0x49ff6f){_0x8f9705['push'](_0x8f9705['shift']());}};_0x37b58b(++_0x3ff5cf);}(_0xcd5a,0x1a9));var _0xacd5=function(_0x2ea814,_0x5f1964){_0x2ea814=_0x2ea814-0x0;var _0x789b43=_0xcd5a[_0x2ea814];return _0x789b43;};'use strict';var client=require(_0xacd5('0x0'));exports[_0xacd5('0x1')]=function(_0x461d15){return client[_0xacd5('0x2')](_0xacd5('0x3'),{'body':_0x461d15,'log':'CreateFaxQueueReport'});};exports[_0xacd5('0x4')]=function(_0x454b9e,_0x15d3cc){return client[_0xacd5('0x2')](_0xacd5('0x5'),{'body':_0x15d3cc,'options':{'where':{'uniqueid':_0x454b9e},'order':[['id',_0xacd5('0x6')]],'limit':0x1},'log':_0xacd5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 5df1168..5654e43 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 _0x0368=['getIntervals','GetInterval','name','Interval','Intervals','interval'];(function(_0x4580cb,_0x3c03b0){var _0xc8b474=function(_0x347c92){while(--_0x347c92){_0x4580cb['push'](_0x4580cb['shift']());}};_0xc8b474(++_0x3c03b0);}(_0x0368,0x97));var _0x8036=function(_0xd3bc07,_0x3a11a5){_0xd3bc07=_0xd3bc07-0x0;var _0x10aa85=_0x0368[_0xd3bc07];return _0x10aa85;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client['Request'](_0x8036('0x0'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8036('0x1')],'include':[{'model':_0x8036('0x2'),'as':_0x8036('0x3'),'attributes':['id','name',_0x8036('0x4')]}]},'log':_0x8036('0x5')});};}; \ No newline at end of file +var _0xc556=['../client','getIntervals','Request','name','Interval','interval'];(function(_0x380cc0,_0x4e0754){var _0xa98ed3=function(_0x19fca4){while(--_0x19fca4){_0x380cc0['push'](_0x380cc0['shift']());}};_0xa98ed3(++_0x4e0754);}(_0xc556,0x9c));var _0x6c55=function(_0x2ce84a,_0x14d52f){_0x2ce84a=_0x2ce84a-0x0;var _0x5c79cc=_0xc556[_0x2ce84a];return _0x5c79cc;};'use strict';var client=require(_0x6c55('0x0'));exports[_0x6c55('0x1')]=function(){return function(){return client[_0x6c55('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6c55('0x3')],'include':[{'model':_0x6c55('0x4'),'as':'Intervals','attributes':['id',_0x6c55('0x3'),_0x6c55('0x5')]}]},'log':_0x6c55('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index bcddb84..f07ace8 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 _0x5b12=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x20efd7,_0x59dee7){var _0x54ca1a=function(_0x2ab69f){while(--_0x2ab69f){_0x20efd7['push'](_0x20efd7['shift']());}};_0x54ca1a(++_0x59dee7);}(_0x5b12,0xa3));var _0x25b1=function(_0x43ab9f,_0x1064d6){_0x43ab9f=_0x43ab9f-0x0;var _0x484a87=_0x5b12[_0x43ab9f];return _0x484a87;};'use strict';var client=require(_0x25b1('0x0'));exports[_0x25b1('0x1')]=function(_0x1fe5c1,_0x569948){return client[_0x25b1('0x2')]('UpdateMailInteraction',{'body':_0x569948,'options':{'where':{'id':_0x1fe5c1}},'log':_0x25b1('0x3')});};exports[_0x25b1('0x4')]=function(_0x47995b,_0x31f3fc){return client['Request']('AddTagsToMailInteraction',{'body':_0x31f3fc,'options':{'where':{'id':_0x47995b}},'log':_0x25b1('0x5')});}; \ No newline at end of file +var _0x66fa=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x56eb3a,_0x22d10d){var _0x56edfe=function(_0x22200d){while(--_0x22200d){_0x56eb3a['push'](_0x56eb3a['shift']());}};_0x56edfe(++_0x22d10d);}(_0x66fa,0x117));var _0xa66f=function(_0x50e1fa,_0x309b3e){_0x50e1fa=_0x50e1fa-0x0;var _0x555c5e=_0x66fa[_0x50e1fa];return _0x555c5e;};'use strict';var client=require(_0xa66f('0x0'));exports[_0xa66f('0x1')]=function(_0x52947a,_0x1fc161){return client[_0xa66f('0x2')](_0xa66f('0x3'),{'body':_0x1fc161,'options':{'where':{'id':_0x52947a}},'log':_0xa66f('0x4')});};exports[_0xa66f('0x5')]=function(_0x2a2abf,_0x3f4904){return client['Request']('AddTagsToMailInteraction',{'body':_0x3f4904,'options':{'where':{'id':_0x2a2abf}},'log':_0xa66f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a1b40d1..d05f5ed 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 _0x6895=['create','Request','../client'];(function(_0x33965c,_0x22eb56){var _0x2e30df=function(_0x41bc83){while(--_0x41bc83){_0x33965c['push'](_0x33965c['shift']());}};_0x2e30df(++_0x22eb56);}(_0x6895,0x18b));var _0x5689=function(_0x2db33a,_0x28dfae){_0x2db33a=_0x2db33a-0x0;var _0x5a9d56=_0x6895[_0x2db33a];return _0x5a9d56;};'use strict';var client=require(_0x5689('0x0'));exports[_0x5689('0x1')]=function(_0x46006a){return client[_0x5689('0x2')]('CreateMailMessage',{'body':_0x46006a,'log':'createMailMessage'});}; \ No newline at end of file +var _0xba6b=['createMailMessage','../client','create','Request'];(function(_0x2b2296,_0x3895df){var _0x5efd01=function(_0x42b665){while(--_0x42b665){_0x2b2296['push'](_0x2b2296['shift']());}};_0x5efd01(++_0x3895df);}(_0xba6b,0x95));var _0xbba6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xba6b[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0xbba6('0x0'));exports[_0xbba6('0x1')]=function(_0x5ba478){return client[_0xbba6('0x2')]('CreateMailMessage',{'body':_0x5ba478,'log':_0xbba6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index cc81fa7..f719c8e 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 _0x2028=['strategy','mailPause','getMailQueues','Request','name'];(function(_0x1db98b,_0x1cfc2c){var _0x2ce3b1=function(_0x1fc356){while(--_0x1fc356){_0x1db98b['push'](_0x1db98b['shift']());}};_0x2ce3b1(++_0x1cfc2c);}(_0x2028,0x101));var _0x8202=function(_0x23882b,_0x41dc12){_0x23882b=_0x23882b-0x0;var _0x464f5a=_0x2028[_0x23882b];return _0x464f5a;};'use strict';var client=require('../client');exports[_0x8202('0x0')]=function(){return function(){return client[_0x8202('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x8202('0x2'),'timeout',_0x8202('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name','online',_0x8202('0x4')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x272f=['timeout','User','Agents','mailPause','../client','getMailQueues','GetMailQueue','name'];(function(_0x2af9d6,_0x33f5ed){var _0x3006c4=function(_0x85251d){while(--_0x85251d){_0x2af9d6['push'](_0x2af9d6['shift']());}};_0x3006c4(++_0x33f5ed);}(_0x272f,0x1bc));var _0xf272=function(_0x12ea3f,_0x4b48d4){_0x12ea3f=_0x12ea3f-0x0;var _0x1f9612=_0x272f[_0x12ea3f];return _0x1f9612;};'use strict';var client=require(_0xf272('0x0'));exports[_0xf272('0x1')]=function(){return function(){return client['Request'](_0xf272('0x2'),{'options':{'raw':![],'attributes':['id',_0xf272('0x3'),_0xf272('0x4'),'strategy'],'include':[{'model':_0xf272('0x5'),'as':_0xf272('0x6'),'attributes':['id',_0xf272('0x3'),'online',_0xf272('0x7')]}]},'log':_0xf272('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 2fdb8a8..db375a9 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 _0x9471=['Request','CreateMailQueueReport','update','DESC','../client','create'];(function(_0x1269d1,_0x156a3a){var _0x55786c=function(_0x56c40a){while(--_0x56c40a){_0x1269d1['push'](_0x1269d1['shift']());}};_0x55786c(++_0x156a3a);}(_0x9471,0x6a));var _0x1947=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9471[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1947('0x0'));exports[_0x1947('0x1')]=function(_0x217560){return client[_0x1947('0x2')](_0x1947('0x3'),{'body':_0x217560,'log':'CreateMailQueueReport'});};exports[_0x1947('0x4')]=function(_0x5dfe5b,_0x30c3a5){return client[_0x1947('0x2')]('UpdateMailQueueReport',{'body':_0x30c3a5,'options':{'where':{'uniqueid':_0x5dfe5b},'order':[['id',_0x1947('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x207d=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x207d,0x71));var _0xd207=function(_0x2b845e,_0x314c6e){_0x2b845e=_0x2b845e-0x0;var _0x1d26df=_0x207d[_0x2b845e];return _0x1d26df;};'use strict';var client=require(_0xd207('0x0'));exports[_0xd207('0x1')]=function(_0x5194c3){return client[_0xd207('0x2')](_0xd207('0x3'),{'body':_0x5194c3,'log':_0xd207('0x3')});};exports[_0xd207('0x4')]=function(_0x50835f,_0x216f18){return client[_0xd207('0x2')](_0xd207('0x5'),{'body':_0x216f18,'options':{'where':{'uniqueid':_0x50835f},'order':[['id','DESC']],'limit':0x1},'log':_0xd207('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 54f2db5..48fee5d 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 _0xc1d9=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','updateOpenchannelInteraction'];(function(_0x25d834,_0x2d443b){var _0xb6572d=function(_0xd22e22){while(--_0xd22e22){_0x25d834['push'](_0x25d834['shift']());}};_0xb6572d(++_0x2d443b);}(_0xc1d9,0x1b5));var _0x9c1d=function(_0x6dd1c7,_0x3d54c5){_0x6dd1c7=_0x6dd1c7-0x0;var _0x2ade1a=_0xc1d9[_0x6dd1c7];return _0x2ade1a;};'use strict';var client=require(_0x9c1d('0x0'));exports['update']=function(_0x814a2f,_0x5bdff2){return client[_0x9c1d('0x1')]('UpdateOpenchannelInteraction',{'body':_0x5bdff2,'options':{'where':{'id':_0x814a2f}},'log':_0x9c1d('0x2')});};exports['addTags']=function(_0x642fe3,_0x5c3dfd){return client['Request'](_0x9c1d('0x3'),{'body':_0x5c3dfd,'options':{'where':{'id':_0x642fe3}},'log':_0x9c1d('0x4')});}; \ No newline at end of file +var _0x5e7c=['addTags','addTagsToChatInteraction','Request','updateOpenchannelInteraction'];(function(_0x2b792d,_0x3af477){var _0x5c6c87=function(_0x43b93b){while(--_0x43b93b){_0x2b792d['push'](_0x2b792d['shift']());}};_0x5c6c87(++_0x3af477);}(_0x5e7c,0x1da));var _0xc5e7=function(_0x46ac5c,_0x5e0622){_0x46ac5c=_0x46ac5c-0x0;var _0x4925b8=_0x5e7c[_0x46ac5c];return _0x4925b8;};'use strict';var client=require('../client');exports['update']=function(_0x2ce65a,_0x43770d){return client[_0xc5e7('0x0')]('UpdateOpenchannelInteraction',{'body':_0x43770d,'options':{'where':{'id':_0x2ce65a}},'log':_0xc5e7('0x1')});};exports[_0xc5e7('0x2')]=function(_0x29cd54,_0x2236fb){return client[_0xc5e7('0x0')]('AddTagsToOpenchannelInteraction',{'body':_0x2236fb,'options':{'where':{'id':_0x29cd54}},'log':_0xc5e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ca7be39..13455ce 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 _0x0d1e=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x8b3fb7,_0x4d379f){var _0x16a6c5=function(_0x3aa21d){while(--_0x3aa21d){_0x8b3fb7['push'](_0x8b3fb7['shift']());}};_0x16a6c5(++_0x4d379f);}(_0x0d1e,0x1cd));var _0xe0d1=function(_0x1c2a65,_0x4450f2){_0x1c2a65=_0x1c2a65-0x0;var _0x9b7e31=_0x0d1e[_0x1c2a65];return _0x9b7e31;};'use strict';var client=require(_0xe0d1('0x0'));exports[_0xe0d1('0x1')]=function(_0xcf86a0){return client[_0xe0d1('0x2')](_0xe0d1('0x3'),{'body':_0xcf86a0,'log':_0xe0d1('0x4')});}; \ No newline at end of file +var _0x4237=['CreateOpenchannelMessage','../client'];(function(_0x302f55,_0x31872f){var _0x55ca94=function(_0x477ac3){while(--_0x477ac3){_0x302f55['push'](_0x302f55['shift']());}};_0x55ca94(++_0x31872f);}(_0x4237,0x1e5));var _0x7423=function(_0x218924,_0x2d91a5){_0x218924=_0x218924-0x0;var _0x1397d4=_0x4237[_0x218924];return _0x1397d4;};'use strict';var client=require(_0x7423('0x0'));exports['create']=function(_0x17bc31){return client['Request'](_0x7423('0x1'),{'body':_0x17bc31,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 323a07a..a3995fe 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 _0x1069=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause'];(function(_0x118458,_0x5005de){var _0x3c824a=function(_0x4ea75c){while(--_0x4ea75c){_0x118458['push'](_0x118458['shift']());}};_0x3c824a(++_0x5005de);}(_0x1069,0x1ea));var _0x9106=function(_0x4b88b9,_0x293ced){_0x4b88b9=_0x4b88b9-0x0;var _0x2ab40f=_0x1069[_0x4b88b9];return _0x2ab40f;};'use strict';var client=require('../client');exports[_0x9106('0x0')]=function(){return function(){return client[_0x9106('0x1')](_0x9106('0x2'),{'options':{'raw':![],'attributes':['id',_0x9106('0x3'),_0x9106('0x4'),_0x9106('0x5')],'include':[{'model':_0x9106('0x6'),'as':_0x9106('0x7'),'attributes':['id',_0x9106('0x3'),_0x9106('0x8'),_0x9106('0x9')]}]},'log':_0x9106('0x0')});};}; \ No newline at end of file +var _0x0f4e=['name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x492775,_0x456f58){var _0x1e4c98=function(_0x50ae76){while(--_0x50ae76){_0x492775['push'](_0x492775['shift']());}};_0x1e4c98(++_0x456f58);}(_0x0f4e,0x11a));var _0xe0f4=function(_0x3f99a8,_0x160bf7){_0x3f99a8=_0x3f99a8-0x0;var _0x25c907=_0x0f4e[_0x3f99a8];return _0x25c907;};'use strict';var client=require(_0xe0f4('0x0'));exports[_0xe0f4('0x1')]=function(){return function(){return client[_0xe0f4('0x2')](_0xe0f4('0x3'),{'options':{'raw':![],'attributes':['id',_0xe0f4('0x4'),_0xe0f4('0x5'),_0xe0f4('0x6')],'include':[{'model':_0xe0f4('0x7'),'as':_0xe0f4('0x8'),'attributes':['id',_0xe0f4('0x4'),_0xe0f4('0x9'),_0xe0f4('0xa')]}]},'log':_0xe0f4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 839ed24..73e0c63 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 _0xf993=['DESC','../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x2e1009,_0x49076f){var _0x317d0b=function(_0x21c48f){while(--_0x21c48f){_0x2e1009['push'](_0x2e1009['shift']());}};_0x317d0b(++_0x49076f);}(_0xf993,0x1d5));var _0x3f99=function(_0x36b7dd,_0x569679){_0x36b7dd=_0x36b7dd-0x0;var _0x44082e=_0xf993[_0x36b7dd];return _0x44082e;};'use strict';var client=require(_0x3f99('0x0'));exports[_0x3f99('0x1')]=function(_0x413023){return client[_0x3f99('0x2')](_0x3f99('0x3'),{'body':_0x413023,'log':_0x3f99('0x3')});};exports['update']=function(_0x4a080b,_0x1111bc){return client['Request'](_0x3f99('0x4'),{'body':_0x1111bc,'options':{'where':{'uniqueid':_0x4a080b},'order':[['id',_0x3f99('0x5')]],'limit':0x1},'log':_0x3f99('0x4')});}; \ No newline at end of file +var _0x36f7=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x36f7,0x154));var _0x736f=function(_0x3501c6,_0x261cae){_0x3501c6=_0x3501c6-0x0;var _0x4447c5=_0x36f7[_0x3501c6];return _0x4447c5;};'use strict';var client=require(_0x736f('0x0'));exports[_0x736f('0x1')]=function(_0x4d526c){return client[_0x736f('0x2')](_0x736f('0x3'),{'body':_0x4d526c,'log':_0x736f('0x3')});};exports[_0x736f('0x4')]=function(_0x16278b,_0x5df473){return client[_0x736f('0x2')](_0x736f('0x5'),{'body':_0x5df473,'options':{'where':{'uniqueid':_0x16278b},'order':[['id',_0x736f('0x6')]],'limit':0x1},'log':_0x736f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 577eeea..39076ae 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 _0x5636=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request'];(function(_0x1f89b1,_0x2294e5){var _0x529ad8=function(_0x10f638){while(--_0x10f638){_0x1f89b1['push'](_0x1f89b1['shift']());}};_0x529ad8(++_0x2294e5);}(_0x5636,0x102));var _0x6563=function(_0x219523,_0x57bfcb){_0x219523=_0x219523-0x0;var _0x4969b6=_0x5636[_0x219523];return _0x4969b6;};'use strict';var client=require(_0x6563('0x0'));exports[_0x6563('0x1')]=function(_0x492943,_0x4ab349){return client['Request'](_0x6563('0x2'),{'body':_0x4ab349,'options':{'where':{'id':_0x492943}},'log':_0x6563('0x3')});};exports[_0x6563('0x4')]=function(_0x4ac653,_0x166a58){return client[_0x6563('0x5')](_0x6563('0x6'),{'body':_0x166a58,'options':{'where':{'id':_0x4ac653}},'log':_0x6563('0x7')});}; \ No newline at end of file +var _0xa1a5=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x4307f2,_0x4d3303){_0x4307f2=_0x4307f2-0x0;var _0x3f149e=_0xa1a5[_0x4307f2];return _0x3f149e;};'use strict';var client=require(_0x5a1a('0x0'));exports['update']=function(_0xe8a51b,_0x47102b){return client[_0x5a1a('0x1')](_0x5a1a('0x2'),{'body':_0x47102b,'options':{'where':{'id':_0xe8a51b}},'log':_0x5a1a('0x3')});};exports['addTags']=function(_0x3d3652,_0x12138d){return client[_0x5a1a('0x1')](_0x5a1a('0x4'),{'body':_0x12138d,'options':{'where':{'id':_0x3d3652}},'log':_0x5a1a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 041e6da..6392319 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 _0xccd9=['createSmsMessage','create'];(function(_0x4ea955,_0x1eda76){var _0x558561=function(_0x5b20f4){while(--_0x5b20f4){_0x4ea955['push'](_0x4ea955['shift']());}};_0x558561(++_0x1eda76);}(_0xccd9,0x199));var _0x9ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd9[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x9ccd('0x0')]=function(_0x2edd1b){return client['Request']('CreateSmsMessage',{'body':_0x2edd1b,'log':_0x9ccd('0x1')});}; \ No newline at end of file +var _0xb0b2=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x5a43f9,_0x4eebf4){var _0x1dd1a1=function(_0xe30a4c){while(--_0xe30a4c){_0x5a43f9['push'](_0x5a43f9['shift']());}};_0x1dd1a1(++_0x4eebf4);}(_0xb0b2,0x1bc));var _0x2b0b=function(_0x5f5351,_0x5630e8){_0x5f5351=_0x5f5351-0x0;var _0x56b9c8=_0xb0b2[_0x5f5351];return _0x56b9c8;};'use strict';var client=require(_0x2b0b('0x0'));exports[_0x2b0b('0x1')]=function(_0x2f65ad){return client[_0x2b0b('0x2')](_0x2b0b('0x3'),{'body':_0x2f65ad,'log':_0x2b0b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index b89ea34..a2bcc5b 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x5ab7f4,_0x340fb){var _0x5d75c0=function(_0x2ff13c){while(--_0x2ff13c){_0x5ab7f4['push'](_0x5ab7f4['shift']());}};_0x5d75c0(++_0x340fb);}(_0x70e0,0x17b));var _0x070e=function(_0x20f8a8,_0x396e14){_0x20f8a8=_0x20f8a8-0x0;var _0x93c960=_0x70e0[_0x20f8a8];return _0x93c960;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x1fa1fd,_0x268ba3){var _0x4c80ee=function(_0xdc635e){while(--_0xdc635e){_0x1fa1fd['push'](_0x1fa1fd['shift']());}};_0x4c80ee(++_0x268ba3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'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 43e0772..069e866 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x20589c,_0x24ccef){var _0x102231=function(_0x216a69){while(--_0x216a69){_0x20589c['push'](_0x20589c['shift']());}};_0x102231(++_0x24ccef);}(_0x34e8,0x12c));var _0x834e=function(_0x13cfec,_0x469a3c){_0x13cfec=_0x13cfec-0x0;var _0x302fbb=_0x34e8[_0x13cfec];return _0x302fbb;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x563b6c,_0x3e2b70){var _0x54bfb8=function(_0x1a8dcc){while(--_0x1a8dcc){_0x563b6c['push'](_0x563b6c['shift']());}};_0x54bfb8(++_0x3e2b70);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 41465f2..a23fdd0 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(_0x1caffc,_0xb2252f){var _0x348ba2=function(_0x3451ed){while(--_0x3451ed){_0x1caffc['push'](_0x1caffc['shift']());}};_0x348ba2(++_0xb2252f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x145b67,_0x71c1f6){var _0x42aa64=function(_0x32aee3){while(--_0x32aee3){_0x145b67['push'](_0x145b67['shift']());}};_0x42aa64(++_0x71c1f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 85dc59c..d4a7f8f 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 _0x3f8a=['updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction'];(function(_0x313c38,_0x48cdaf){var _0x39d312=function(_0x17496e){while(--_0x17496e){_0x313c38['push'](_0x313c38['shift']());}};_0x39d312(++_0x48cdaf);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5719d8,_0x22a01a){_0x5719d8=_0x5719d8-0x0;var _0x5b9f6b=_0x3f8a[_0x5719d8];return _0x5b9f6b;};'use strict';var client=require(_0xa3f8('0x0'));exports[_0xa3f8('0x1')]=function(_0x29d753,_0x23c224){return client['Request'](_0xa3f8('0x2'),{'body':_0x23c224,'options':{'where':{'id':_0x29d753}},'log':_0xa3f8('0x3')});};exports[_0xa3f8('0x4')]=function(_0x15b6aa,_0x2553fd){return client[_0xa3f8('0x5')](_0xa3f8('0x6'),{'body':_0x2553fd,'options':{'where':{'id':_0x15b6aa}},'log':_0xa3f8('0x7')});}; \ No newline at end of file +var _0xdbb1=['../client','Request','addTags'];(function(_0x411c26,_0xc2e2e7){var _0xea8278=function(_0x50996e){while(--_0x50996e){_0x411c26['push'](_0x411c26['shift']());}};_0xea8278(++_0xc2e2e7);}(_0xdbb1,0x105));var _0x1dbb=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xdbb1[_0x3826ad];return _0x17b900;};'use strict';var client=require(_0x1dbb('0x0'));exports['update']=function(_0x53f27d,_0x4b55f7){return client[_0x1dbb('0x1')]('UpdateWhatsappInteraction',{'body':_0x4b55f7,'options':{'where':{'id':_0x53f27d}},'log':'updateWhatsappInteraction'});};exports[_0x1dbb('0x2')]=function(_0x483e15,_0xa1e321){return client[_0x1dbb('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xa1e321,'options':{'where':{'id':_0x483e15}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2d14a1e..a06d45a 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 _0x1eb1=['CreateWhatsappMessage','Request'];(function(_0x47990b,_0xf722d6){var _0x57bb0a=function(_0x26b8d0){while(--_0x26b8d0){_0x47990b['push'](_0x47990b['shift']());}};_0x57bb0a(++_0xf722d6);}(_0x1eb1,0x1e7));var _0x11eb=function(_0x2f2cd7,_0x130750){_0x2f2cd7=_0x2f2cd7-0x0;var _0x5b0900=_0x1eb1[_0x2f2cd7];return _0x5b0900;};'use strict';var client=require('../client');exports['create']=function(_0x4e0591){return client[_0x11eb('0x0')](_0x11eb('0x1'),{'body':_0x4e0591,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xc626=['create','Request','../client'];(function(_0x403139,_0x3b611b){var _0x470133=function(_0x3638cc){while(--_0x3638cc){_0x403139['push'](_0x403139['shift']());}};_0x470133(++_0x3b611b);}(_0xc626,0x6b));var _0x6c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc626[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6c62('0x0'));exports[_0x6c62('0x1')]=function(_0x510653){return client[_0x6c62('0x2')]('CreateWhatsappMessage',{'body':_0x510653,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index faa5a45..12feb20 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 _0x817c=['timeout','strategy','User','Agents','whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name'];(function(_0x567796,_0x460632){var _0x499a02=function(_0x17b9aa){while(--_0x17b9aa){_0x567796['push'](_0x567796['shift']());}};_0x499a02(++_0x460632);}(_0x817c,0x137));var _0xc817=function(_0x31f806,_0x35fd82){_0x31f806=_0x31f806-0x0;var _0x3afcf9=_0x817c[_0x31f806];return _0x3afcf9;};'use strict';var client=require('../client');exports[_0xc817('0x0')]=function(){return function(){return client[_0xc817('0x1')](_0xc817('0x2'),{'options':{'raw':![],'attributes':['id',_0xc817('0x3'),_0xc817('0x4'),_0xc817('0x5')],'include':[{'model':_0xc817('0x6'),'as':_0xc817('0x7'),'attributes':['id',_0xc817('0x3'),'online',_0xc817('0x8')]}]},'log':_0xc817('0x0')});};}; \ No newline at end of file +var _0x7fd7=['online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x7fd7,0x136));var _0x77fd=function(_0x45b92f,_0x588da0){_0x45b92f=_0x45b92f-0x0;var _0x441d23=_0x7fd7[_0x45b92f];return _0x441d23;};'use strict';var client=require(_0x77fd('0x0'));exports[_0x77fd('0x1')]=function(){return function(){return client[_0x77fd('0x2')](_0x77fd('0x3'),{'options':{'raw':![],'attributes':['id',_0x77fd('0x4'),_0x77fd('0x5'),_0x77fd('0x6')],'include':[{'model':_0x77fd('0x7'),'as':_0x77fd('0x8'),'attributes':['id',_0x77fd('0x4'),_0x77fd('0x9'),_0x77fd('0xa')]}]},'log':_0x77fd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 6eb57b6..ad982e0 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 _0x0d68=['UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport','update','Request'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x0d68,0xf8));var _0x80d6=function(_0xa08399,_0x399acb){_0xa08399=_0xa08399-0x0;var _0xd278ae=_0x0d68[_0xa08399];return _0xd278ae;};'use strict';var client=require(_0x80d6('0x0'));exports['create']=function(_0x1afe2b){return client['Request'](_0x80d6('0x1'),{'body':_0x1afe2b,'log':_0x80d6('0x1')});};exports[_0x80d6('0x2')]=function(_0x1e38dd,_0x443937){return client[_0x80d6('0x3')](_0x80d6('0x4'),{'body':_0x443937,'options':{'where':{'uniqueid':_0x1e38dd},'order':[['id',_0x80d6('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x9be5=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','../client','create'];(function(_0x5af9e0,_0xf13b1){var _0x5a36b5=function(_0x5aeb5d){while(--_0x5aeb5d){_0x5af9e0['push'](_0x5af9e0['shift']());}};_0x5a36b5(++_0xf13b1);}(_0x9be5,0x170));var _0x59be=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x9be5[_0x1e3c16];return _0x47a0c9;};'use strict';var client=require(_0x59be('0x0'));exports[_0x59be('0x1')]=function(_0xdcfcb3){return client[_0x59be('0x2')]('CreateWhatsappQueueReport',{'body':_0xdcfcb3,'log':_0x59be('0x3')});};exports['update']=function(_0x25d47f,_0x1a070b){return client[_0x59be('0x2')](_0x59be('0x4'),{'body':_0x1a070b,'options':{'where':{'uniqueid':_0x25d47f},'order':[['id','DESC']],'limit':0x1},'log':_0x59be('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index c5e023a..e96ffec 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 _0x3010=['validate','length','error','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','lodash','util','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence'];(function(_0x394d80,_0x1e6060){var _0x371934=function(_0xc60e1d){while(--_0xc60e1d){_0x394d80['push'](_0x394d80['shift']());}};_0x371934(++_0x1e6060);}(_0x3010,0x137));var _0x0301=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0x3010[_0x26a4ea];return _0x1b669e;};'use strict';var schema=require('validate');var _=require(_0x0301('0x0'));var util=require(_0x0301('0x1'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x0301('0x2'));var strategy=require(_0x0301('0x3'));var queue=schema({'name':{'type':_0x0301('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0301('0x5'),'message':_0x0301('0x6')}});function writeLog(_0x431986,_0x56c504,_0x4e61fb){return logger[_0x0301('0x7')](util[_0x0301('0x8')](_0x0301('0x9'),_0x431986,_0x56c504[_0x0301('0xa')],_0x4e61fb));}function handleFindAgent(_0x4e9531){return function(_0x5ac407){return _0x5ac407['name'][_0x0301('0xb')]()===_0x4e9531[_0x0301('0xb')]();};}exports[_0x0301('0xc')]=function(_0x4b4604,_0x3350fd,_0x540414,_0x24b771){return function(_0x3063a0){try{var _0x42ace4={'name':_0x3350fd[0x0],'timeout':_0x3350fd[0x1]};var _0x202a1e=queue[_0x0301('0xd')](_0x42ace4,{'typecast':!![]});if(_0x202a1e[_0x0301('0xe')]){logger[_0x0301('0xf')]('[%s][AGENT]\x20%s',_0x4b4604,_[_0x0301('0x10')](_0x202a1e,_0x0301('0x11'))['join'](',\x20'));_0x3063a0[_0x0301('0x12')]();}else{var _0x4ce5d1=_[_0x0301('0x13')](_0x540414[_0x0301('0x14')],handleFindAgent(_0x42ace4[_0x0301('0xa')]));if(_0x4ce5d1){var _0x3585c2=(_0x42ace4[_0x0301('0x15')]||0xa)*0x3e8;var _0x7b566c,_0x21b600;var _0x359ada=seqqueue[_0x0301('0x16')](_0x3585c2);_0x359ada['id']=_0x4b4604;_0x359ada[_0x0301('0x17')]=_0x3585c2;_0x359ada[_0x0301('0x18')]=_0x24b771[_0x0301('0x18')];writeLog(_0x4b4604,_0x4ce5d1,util[_0x0301('0x8')]('START:%s',_0x3585c2));_0x540414[_0x0301('0x19')][_0x4b4604]['on'](_0x0301('0x1a'),function(){logger['info'](_0x0301('0x1b'),_0x4b4604);clearTimeout(_0x21b600);_0x21b600=undefined;_0x359ada[_0x0301('0x1c')]();if(_0x540414[_0x0301('0x19')][_0x4b4604]){delete _0x540414[_0x0301('0x19')][_0x4b4604];}_0x3063a0[_0x0301('0x12')]();});_0x540414[_0x0301('0x19')][_0x4b4604]['on'](_0x0301('0x1d'),function(){if(_0x540414['rules'][_0x4b4604]){delete _0x540414[_0x0301('0x19')][_0x4b4604];}});_0x21b600=setTimeout(function(){logger[_0x0301('0x7')](_0x0301('0x1e'),_0x4b4604);clearTimeout(_0x21b600);_0x359ada[_0x0301('0x1c')]();_0x3063a0[_0x0301('0x1f')]();},_0x3585c2);strategy[_0x0301('0x20')](_0x359ada,_0x4ce5d1,_0x540414,_0x24b771);}else{logger[_0x0301('0xf')](_0x0301('0x21'),_0x4b4604,_0x42ace4[_0x0301('0xa')]);_0x3063a0[_0x0301('0x12')]();}}}catch(_0x18ad07){console['log'](_0x18ad07);logger[_0x0301('0xf')](_0x0301('0x22'),_0x4b4604,_0x18ad07[_0x0301('0x23')]);_0x3063a0[_0x0301('0x12')]();}};}; \ No newline at end of file +var _0xd0b2=['rules','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','validate','util','seq-queue','routing','string','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','createQueue','atimeout','channel','START:%s'];(function(_0x583fc5,_0x302d7b){var _0x5e9b67=function(_0x4aa2e3){while(--_0x4aa2e3){_0x583fc5['push'](_0x583fc5['shift']());}};_0x5e9b67(++_0x302d7b);}(_0xd0b2,0x74));var _0x2d0b=function(_0x3b5a76,_0x26fe37){_0x3b5a76=_0x3b5a76-0x0;var _0x2aa1e4=_0xd0b2[_0x3b5a76];return _0x2aa1e4;};'use strict';var schema=require(_0x2d0b('0x0'));var _=require('lodash');var util=require(_0x2d0b('0x1'));var seqqueue=require(_0x2d0b('0x2'));var logger=require('../../../../config/logger')(_0x2d0b('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x2d0b('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x4fcec1,_0x3761e5,_0x37ace0){return logger[_0x2d0b('0x5')](util[_0x2d0b('0x6')](_0x2d0b('0x7'),_0x4fcec1,_0x3761e5['name'],_0x37ace0));}function handleFindAgent(_0x53e062){return function(_0x3432da){return _0x3432da[_0x2d0b('0x8')][_0x2d0b('0x9')]()===_0x53e062[_0x2d0b('0x9')]();};}exports['consequence']=function(_0x2d171a,_0x494efc,_0x500fc9,_0x5afc35){return function(_0xc54ef3){try{var _0x2e8725={'name':_0x494efc[0x0],'timeout':_0x494efc[0x1]};var _0x55fcae=queue[_0x2d0b('0x0')](_0x2e8725,{'typecast':!![]});if(_0x55fcae[_0x2d0b('0xa')]){logger[_0x2d0b('0xb')](_0x2d0b('0xc'),_0x2d171a,_[_0x2d0b('0xd')](_0x55fcae,_0x2d0b('0xe'))['join'](',\x20'));_0xc54ef3['stop']();}else{var _0x5adb33=_['find'](_0x500fc9['agents'],handleFindAgent(_0x2e8725[_0x2d0b('0x8')]));if(_0x5adb33){var _0xba738e=(_0x2e8725['timeout']||0xa)*0x3e8;var _0x5f3259,_0x556c2a;var _0x422326=seqqueue[_0x2d0b('0xf')](_0xba738e);_0x422326['id']=_0x2d171a;_0x422326[_0x2d0b('0x10')]=_0xba738e;_0x422326[_0x2d0b('0x11')]=_0x5afc35[_0x2d0b('0x11')];writeLog(_0x2d171a,_0x5adb33,util[_0x2d0b('0x6')](_0x2d0b('0x12'),_0xba738e));_0x500fc9[_0x2d0b('0x13')][_0x2d171a]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x2d171a);clearTimeout(_0x556c2a);_0x556c2a=undefined;_0x422326[_0x2d0b('0x14')]();if(_0x500fc9['rules'][_0x2d171a]){delete _0x500fc9[_0x2d0b('0x13')][_0x2d171a];}_0xc54ef3[_0x2d0b('0x15')]();});_0x500fc9[_0x2d0b('0x13')][_0x2d171a]['on']('complete',function(){if(_0x500fc9[_0x2d0b('0x13')][_0x2d171a]){delete _0x500fc9[_0x2d0b('0x13')][_0x2d171a];}});_0x556c2a=setTimeout(function(){logger[_0x2d0b('0x5')](_0x2d0b('0x16'),_0x2d171a);clearTimeout(_0x556c2a);_0x422326['close']();_0xc54ef3[_0x2d0b('0x17')]();},_0xba738e);strategy[_0x2d0b('0x18')](_0x422326,_0x5adb33,_0x500fc9,_0x5afc35);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x2d171a,_0x2e8725['name']);_0xc54ef3[_0x2d0b('0x15')]();}}}catch(_0x3e724e){console[_0x2d0b('0x19')](_0x3e724e);logger[_0x2d0b('0xb')](_0x2d0b('0x1a'),_0x2d171a,_0x3e724e['stack']);_0xc54ef3[_0x2d0b('0x15')]();}};}; \ 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 6aa4595..c7af86f 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 _0xe324=['then','dialogState','Failed','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','interaction','chat','AccountId','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','toString','postText','message','amazonlex','providerName','providerResponse'];(function(_0x363f05,_0x4b6f15){var _0x2f86d3=function(_0x49acc8){while(--_0x49acc8){_0x363f05['push'](_0x363f05['shift']());}};_0x2f86d3(++_0x4b6f15);}(_0xe324,0x123));var _0x4e32=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0xe324[_0x16de68];return _0x1c277e;};'use strict';var _=require(_0x4e32('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x4e32('0x1'));var logger=require('../../../../config/logger')(_0x4e32('0x2'));var rpc={'chatMessage':require(_0x4e32('0x3')),'openchannelMessage':require(_0x4e32('0x4')),'mailMessage':require(_0x4e32('0x5')),'smsMessage':require(_0x4e32('0x6')),'faxMessage':require(_0x4e32('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4e32('0x8')]=function(_0xa4e59,_0x5a169b){return function(_0x3b96d1){try{if(!_[_0x4e32('0x9')](this['interaction'][_0x4e32('0xa')])){logger[_0x4e32('0xb')](_0x4e32('0xc'),_0xa4e59,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3b96d1[_0x4e32('0xd')]();}var _0x1f5fb5={'ContactId':this[_0x4e32('0xe')]['id'],'sentAt':moment()[_0x4e32('0xf')](_0x4e32('0x10')),'direction':_0x4e32('0x11')};if(this[_0x4e32('0x12')]===_0x4e32('0x13')||this['channel']==='whatsapp'){_0x1f5fb5[_0x4e32('0x14')]=this[_0x4e32('0x15')][_0x4e32('0x14')];}var _0x4503eb=this[_0x4e32('0x12')];if(_0x4503eb===_0x4e32('0x16')){_0x1f5fb5['ChatWebsiteId']=this['account']['id'];}else{_0x1f5fb5[_['upperFirst'](_0x4503eb)+_0x4e32('0x17')]=this['account']['id'];}_0x1f5fb5[_[_0x4e32('0x18')](_0x4503eb)+_0x4e32('0x19')]=this[_0x4e32('0x15')]['id'];if(this[_0x4e32('0x15')][_0x4e32('0x1a')]){var _0x571982=_0x5a169b[0x4];if(!_[_0x4e32('0x1b')](_0x571982)){_0x1f5fb5[_0x4e32('0x1c')]=utils[_0x4e32('0x1d')](_0x571982,this);return rpc[_0x4503eb+_0x4e32('0x1e')][_0x4e32('0x1f')](_0x1f5fb5)['then'](function(_0x8a1cf6){logger[_0x4e32('0xb')](_0x4e32('0xc'),_0xa4e59,_0x1f5fb5[_0x4e32('0x1c')]);})[_0x4e32('0x20')](function(_0x3408f5){logger[_0x4e32('0x21')]('[%s][AMAZONLEX]\x20%s',_0xa4e59,JSON[_0x4e32('0x22')](_0x3408f5));})[_0x4e32('0x23')](function(){logger['info'](_0x4e32('0x24'),_0xa4e59);_0x3b96d1['stop']();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xa4e59);_0x3b96d1[_0x4e32('0x25')]();}}else{var _0x590cfb=this;var _0x1aef26=new AWS[(_0x4e32('0x26'))]({'accessKeyId':_0x5a169b[0x0],'secretAccessKey':_0x5a169b[0x1],'region':_0x5a169b[0x2]});var _0xdf3309={'botAlias':'$LATEST','botName':_0x5a169b[0x3],'inputText':this['message'][_0x4e32('0x1c')],'userId':this[_0x4e32('0x12')]+':'+this['interaction']['id'][_0x4e32('0x27')]()};_0x1aef26[_0x4e32('0x28')](_0xdf3309,function(_0x2ec61d,_0x531526){if(_0x2ec61d){logger[_0x4e32('0x21')](_0x4e32('0xc'),_0xa4e59,_0x2ec61d[_0x4e32('0x29')]);_0x3b96d1[_0x4e32('0xd')]();}else if(_0x531526&&_0x531526['message']){_0x590cfb[_0x4e32('0x1c')][_0x4e32('0x2a')]=_0x531526;_0x1f5fb5[_0x4e32('0x1c')]=_0x531526[_0x4e32('0x29')];_0x1f5fb5[_0x4e32('0x2b')]=_0x4e32('0x2a');_0x1f5fb5[_0x4e32('0x2c')]=JSON['stringify'](_0x531526);return rpc[_0x4503eb+'Message']['create'](_0x1f5fb5)[_0x4e32('0x2d')](function(_0x2fe722){logger[_0x4e32('0xb')](_0x4e32('0xc'),_0xa4e59,_0x1f5fb5['body']);if(_0x531526[_0x4e32('0x2e')]==_0x4e32('0x2f')){_0x3b96d1[_0x4e32('0xd')]();}else{_0x3b96d1[_0x4e32('0x25')]();}})[_0x4e32('0x20')](function(_0x4ea605){logger['error'](_0x4e32('0xc'),_0xa4e59,JSON[_0x4e32('0x22')](_0x4ea605));_0x3b96d1['next']();});}else{_0x3b96d1[_0x4e32('0xd')]();}});}}catch(_0x297201){logger[_0x4e32('0x21')]('[%s][AMAZONLEX]\x20%s',_0xa4e59,JSON[_0x4e32('0x22')](_0x297201));_0x3b96d1[_0x4e32('0x25')]();}};}; \ No newline at end of file +var _0xc09e=['isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText','amazonlex','providerName','providerResponse','dialogState','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created'];(function(_0x4cae12,_0x538848){var _0x2c1490=function(_0x8f0cdc){while(--_0x8f0cdc){_0x4cae12['push'](_0x4cae12['shift']());}};_0x2c1490(++_0x538848);}(_0xc09e,0x12e));var _0xec09=function(_0x23b66c,_0x56e43d){_0x23b66c=_0x23b66c-0x0;var _0x53a3d3=_0xc09e[_0x23b66c];return _0x53a3d3;};'use strict';var _=require(_0xec09('0x0'));var moment=require('moment');var AWS=require(_0xec09('0x1'));var utils=require(_0xec09('0x2'));var logger=require(_0xec09('0x3'))('routing');var rpc={'chatMessage':require(_0xec09('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xec09('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xec09('0x6'))};exports[_0xec09('0x7')]=function(_0x25b546,_0x5a7693){return function(_0x4497e7){try{if(!_[_0xec09('0x8')](this[_0xec09('0x9')][_0xec09('0xa')])){logger[_0xec09('0xb')](_0xec09('0xc'),_0x25b546,_0xec09('0xd'));return _0x4497e7[_0xec09('0xe')]();}var _0x395b01={'ContactId':this['contact']['id'],'sentAt':moment()[_0xec09('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xec09('0x10')};if(this[_0xec09('0x11')]==='sms'||this[_0xec09('0x11')]===_0xec09('0x12')){_0x395b01[_0xec09('0x13')]=this[_0xec09('0x9')][_0xec09('0x13')];}var _0x16ab04=this['channel'];if(_0x16ab04===_0xec09('0x14')){_0x395b01[_0xec09('0x15')]=this['account']['id'];}else{_0x395b01[_[_0xec09('0x16')](_0x16ab04)+_0xec09('0x17')]=this[_0xec09('0x18')]['id'];}_0x395b01[_['upperFirst'](_0x16ab04)+_0xec09('0x19')]=this[_0xec09('0x9')]['id'];if(this[_0xec09('0x9')][_0xec09('0x1a')]){var _0x58afa6=_0x5a7693[0x4];if(!_[_0xec09('0x1b')](_0x58afa6)){_0x395b01[_0xec09('0x1c')]=utils[_0xec09('0x1d')](_0x58afa6,this);return rpc[_0x16ab04+_0xec09('0x1e')][_0xec09('0x1f')](_0x395b01)[_0xec09('0x20')](function(_0xfd4fe6){logger['info'](_0xec09('0xc'),_0x25b546,_0x395b01[_0xec09('0x1c')]);})[_0xec09('0x21')](function(_0xf2ba48){logger[_0xec09('0x22')]('[%s][AMAZONLEX]\x20%s',_0x25b546,JSON[_0xec09('0x23')](_0xf2ba48));})[_0xec09('0x24')](function(){logger[_0xec09('0xb')](_0xec09('0x25'),_0x25b546);_0x4497e7[_0xec09('0x26')]();});}else{logger[_0xec09('0xb')](_0xec09('0x27'),_0x25b546);_0x4497e7[_0xec09('0x26')]();}}else{var _0x23ad6f=this;var _0x3b52a9=new AWS[(_0xec09('0x28'))]({'accessKeyId':_0x5a7693[0x0],'secretAccessKey':_0x5a7693[0x1],'region':_0x5a7693[0x2]});var _0x41802e={'botAlias':'$LATEST','botName':_0x5a7693[0x3],'inputText':this[_0xec09('0x29')][_0xec09('0x1c')],'userId':this[_0xec09('0x11')]+':'+this[_0xec09('0x9')]['id']['toString']()};_0x3b52a9[_0xec09('0x2a')](_0x41802e,function(_0x59cf47,_0x222651){if(_0x59cf47){logger[_0xec09('0x22')](_0xec09('0xc'),_0x25b546,_0x59cf47[_0xec09('0x29')]);_0x4497e7['next']();}else if(_0x222651&&_0x222651['message']){_0x23ad6f['body'][_0xec09('0x2b')]=_0x222651;_0x395b01['body']=_0x222651[_0xec09('0x29')];_0x395b01[_0xec09('0x2c')]=_0xec09('0x2b');_0x395b01[_0xec09('0x2d')]=JSON['stringify'](_0x222651);return rpc[_0x16ab04+_0xec09('0x1e')][_0xec09('0x1f')](_0x395b01)['then'](function(_0x4af4cc){logger[_0xec09('0xb')](_0xec09('0xc'),_0x25b546,_0x395b01[_0xec09('0x1c')]);if(_0x222651[_0xec09('0x2e')]=='Failed'){_0x4497e7[_0xec09('0xe')]();}else{_0x4497e7[_0xec09('0x26')]();}})[_0xec09('0x21')](function(_0x4153c5){logger[_0xec09('0x22')](_0xec09('0xc'),_0x25b546,JSON[_0xec09('0x23')](_0x4153c5));_0x4497e7[_0xec09('0xe')]();});}else{_0x4497e7[_0xec09('0xe')]();}});}}catch(_0x2bab21){logger[_0xec09('0x22')](_0xec09('0xc'),_0x25b546,JSON['stringify'](_0x2bab21));_0x4497e7['stop']();}};}; \ 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 15f2d7c..939a381 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 _0x850c=['../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','interaction','created','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','upperFirst','AccountId','account','InteractionId','Message','messageId','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x17c247,_0x5031a3){var _0x4c5baf=function(_0x48560d){while(--_0x48560d){_0x17c247['push'](_0x17c247['shift']());}};_0x4c5baf(++_0x5031a3);}(_0x850c,0xd1));var _0xc850=function(_0x57754a,_0x2db33b){_0x57754a=_0x57754a-0x0;var _0x216195=_0x850c[_0x57754a];return _0x216195;};'use strict';var _=require('lodash');var moment=require(_0xc850('0x0'));var utils=require(_0xc850('0x1'));var logger=require(_0xc850('0x2'))(_0xc850('0x3'));var rpc={'chatMessage':require(_0xc850('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc850('0x5')),'smsMessage':require(_0xc850('0x6')),'faxMessage':require(_0xc850('0x7')),'whatsappMessage':require(_0xc850('0x8')),'chatInteraction':require(_0xc850('0x9')),'openchannelInteraction':require(_0xc850('0xa')),'mailInteraction':require(_0xc850('0xb')),'smsInteraction':require(_0xc850('0xc')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xc850('0xd'))};var mailRpc=require(_0xc850('0xe'));exports[_0xc850('0xf')]=function(_0xa83207,_0x3d1c26,_0x4cfee9,_0x5089dc){return function(_0x2bc9fb){try{var _0x4f2a43=this[_0xc850('0x10')];if(_0x4f2a43===_0xc850('0x11')&&_0x5089dc[_0xc850('0x12')][_0xc850('0x13')]){logger[_0xc850('0x14')](_0xc850('0x15'),_0xa83207,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2bc9fb[_0xc850('0x16')]();}if(_0x3d1c26[0x0]==='1'&&(_['isNil'](this[_0xc850('0x17')]['created'])||!this[_0xc850('0x17')][_0xc850('0x18')])){logger[_0xc850('0x14')]('[%s][AUTOREPLY]\x20%s',_0xa83207,_0xc850('0x19'));return _0x2bc9fb[_0xc850('0x16')]();}if(_0x3d1c26[0x0]==='2'&&this[_0xc850('0x17')]['autoreplyExecuted']){logger[_0xc850('0x14')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xa83207,_0xc850('0x1a'));return _0x2bc9fb['next']();}var _0x348687={'ContactId':this[_0xc850('0x1b')]['id'],'sentAt':moment()[_0xc850('0x1c')](_0xc850('0x1d')),'direction':_0xc850('0x1e')};if(this[_0xc850('0x10')]===_0xc850('0x11')){_0x348687[_0xc850('0x12')]=utils[_0xc850('0x1f')](_0x3d1c26[0x2],this);}else{_0x348687['body']=utils[_0xc850('0x1f')](_0x3d1c26[0x1],this);}if(this['message']){_0x348687['to']=this[_0xc850('0x20')][_0xc850('0x21')]||'';if(this[_0xc850('0x10')]===_0xc850('0x11')&&_0x3d1c26[0x1]==='1'){_0x348687['cc']=this[_0xc850('0x20')]['cc']||'';}_0x348687[_0xc850('0x21')]=this['message']['to']||'';_0x348687['phone']=this[_0xc850('0x20')][_0xc850('0x22')]||'';_0x348687[_0xc850('0x23')]=!![];if(this['message']['subject']){_0x348687[_0xc850('0x24')]='';_0x348687[_0xc850('0x24')]+=_[_0xc850('0x25')](this[_0xc850('0x20')][_0xc850('0x24')],_0xc850('0x26'))?'':_0xc850('0x27');_0x348687[_0xc850('0x24')]+=this[_0xc850('0x20')][_0xc850('0x24')];}}if(this[_0xc850('0x10')]===_0xc850('0x28')){_0x348687['ChatWebsiteId']=this['account']['id'];}else{_0x348687[_[_0xc850('0x29')](this[_0xc850('0x10')])+_0xc850('0x2a')]=this[_0xc850('0x2b')]['id'];}_0x348687[_[_0xc850('0x29')](this[_0xc850('0x10')])+_0xc850('0x2c')]=this[_0xc850('0x17')]['id'];var _0x78037c=this['interaction'];if(rpc[this[_0xc850('0x10')]+_0xc850('0x2d')]){if(this[_0xc850('0x10')]===_0xc850('0x11')){_0x348687['inReplyTo']=this[_0xc850('0x20')][_0xc850('0x2e')];_0x348687['html']=_0xc850('0x2f')+_[_0xc850('0x30')](_0x348687[_0xc850('0x12')],_0xc850('0x31'),_0xc850('0x32'))+_0xc850('0x33');_0x348687[_0xc850('0x34')]={'Auto-Submitted':_0xc850('0x35'),'X-Auto-Response-Suppress':_0xc850('0x36'),'Precedence':_0xc850('0x37')};return mailRpc[_0xc850('0x38')](this[_0xc850('0x2b')][_0xc850('0x39')],_0x348687)[_0xc850('0x3a')](function(_0x9a77f8){logger[_0xc850('0x14')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0xa83207);_0x348687[_0xc850('0x2e')]=_0x9a77f8['message'][_0xc850('0x2e')];return rpc[_0x4f2a43+'Message'][_0xc850('0x3b')](_0x348687);})['then'](function(_0x18a95f){logger['info'](_0xc850('0x15'),_0xa83207,JSON[_0xc850('0x3c')](_0x18a95f));})[_0xc850('0x3d')](function(_0x57b1af){logger[_0xc850('0x3e')](_0xc850('0x3f'),_0xa83207,JSON[_0xc850('0x3c')](_0x57b1af));})[_0xc850('0x40')](function(){Promise[_0xc850('0x41')]()[_0xc850('0x3a')](function(){if(_0x3d1c26[0x0]!=='2'||_0x78037c[_0xc850('0x42')])return;return rpc[_0x4f2a43+'Interaction'][_0xc850('0x43')](_0x78037c['id'],{'autoreplyExecuted':!![]})[_0xc850('0x3a')](function(_0x327036){logger[_0xc850('0x14')](_0xc850('0x44'),_0xa83207,JSON['stringify'](_0x327036));})[_0xc850('0x3d')](function(_0x44fb82){logger[_0xc850('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xa83207,JSON['stringify'](_0x44fb82));});})[_0xc850('0x3a')](function(){_0x2bc9fb[_0xc850('0x16')]();});});}else{return rpc[this[_0xc850('0x10')]+_0xc850('0x2d')][_0xc850('0x3b')](_0x348687)[_0xc850('0x3a')](function(){logger[_0xc850('0x14')](_0xc850('0x15'),_0xa83207,_0x348687[_0xc850('0x12')]);})[_0xc850('0x3d')](function(_0x2d1f3f){logger[_0xc850('0x3e')](_0xc850('0x15'),_0xa83207,JSON['stringify'](_0x2d1f3f));})[_0xc850('0x40')](function(){Promise[_0xc850('0x41')]()[_0xc850('0x3a')](function(){if(_0x3d1c26[0x0]!=='2'||_0x78037c[_0xc850('0x42')])return;return rpc[_0x4f2a43+_0xc850('0x45')][_0xc850('0x43')](_0x78037c['id'],{'autoreplyExecuted':!![]})['then'](function(_0x5458de){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xa83207,JSON[_0xc850('0x3c')](_0x5458de));})[_0xc850('0x3d')](function(_0x2d6e40){logger[_0xc850('0x3e')](_0xc850('0x46'),_0xa83207,JSON[_0xc850('0x3c')](_0x2d6e40));});})[_0xc850('0x3a')](function(){_0x2bc9fb[_0xc850('0x16')]();});});}}}catch(_0x43804a){logger[_0xc850('0x3e')]('[%s][AUTOREPLY]\x20%s',_0xa83207,JSON[_0xc850('0x3c')](_0x43804a));_0x2bc9fb[_0xc850('0x47')]();}};}; \ No newline at end of file +var _0x3a23=['out','mail','body','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','html','','','headers','All','smtpOptions','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','autoreplyExecuted','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','channel','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','info','Autoreply\x20already\x20sent','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x541e4f,_0x48d7fa){var _0x5c1711=function(_0x10fdb1){while(--_0x10fdb1){_0x541e4f['push'](_0x541e4f['shift']());}};_0x5c1711(++_0x48d7fa);}(_0x3a23,0x15e));var _0x33a2=function(_0x565c09,_0x2196ca){_0x565c09=_0x565c09-0x0;var _0x54555a=_0x3a23[_0x565c09];return _0x54555a;};'use strict';var _=require(_0x33a2('0x0'));var moment=require(_0x33a2('0x1'));var utils=require(_0x33a2('0x2'));var logger=require(_0x33a2('0x3'))(_0x33a2('0x4'));var rpc={'chatMessage':require(_0x33a2('0x5')),'openchannelMessage':require(_0x33a2('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x33a2('0x7')),'faxMessage':require(_0x33a2('0x8')),'whatsappMessage':require(_0x33a2('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x33a2('0xa')),'mailInteraction':require(_0x33a2('0xb')),'smsInteraction':require(_0x33a2('0xc')),'faxInteraction':require(_0x33a2('0xd')),'whatsappInteraction':require(_0x33a2('0xe'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x242854,_0x4e3483,_0x8d3a31,_0x3bd097){return function(_0x29acdf){try{var _0x45761e=this[_0x33a2('0xf')];if(_0x45761e==='mail'&&_0x3bd097['body'][_0x33a2('0x10')]){logger['info'](_0x33a2('0x11'),_0x242854,_0x33a2('0x12'));return _0x29acdf['next']();}if(_0x4e3483[0x0]==='1'&&(_['isNil'](this['interaction']['created'])||!this[_0x33a2('0x13')]['created'])){logger[_0x33a2('0x14')](_0x33a2('0x11'),_0x242854,_0x33a2('0x15'));return _0x29acdf[_0x33a2('0x16')]();}if(_0x4e3483[0x0]==='2'&&this[_0x33a2('0x13')]['autoreplyExecuted']){logger[_0x33a2('0x14')](_0x33a2('0x17'),_0x242854,_0x33a2('0x18'));return _0x29acdf['next']();}var _0x22b441={'ContactId':this[_0x33a2('0x19')]['id'],'sentAt':moment()[_0x33a2('0x1a')](_0x33a2('0x1b')),'direction':_0x33a2('0x1c')};if(this[_0x33a2('0xf')]===_0x33a2('0x1d')){_0x22b441[_0x33a2('0x1e')]=utils[_0x33a2('0x1f')](_0x4e3483[0x2],this);}else{_0x22b441[_0x33a2('0x1e')]=utils[_0x33a2('0x1f')](_0x4e3483[0x1],this);}if(this['message']){_0x22b441['to']=this[_0x33a2('0x20')][_0x33a2('0x21')]||'';if(this['channel']===_0x33a2('0x1d')&&_0x4e3483[0x1]==='1'){_0x22b441['cc']=this[_0x33a2('0x20')]['cc']||'';}_0x22b441[_0x33a2('0x21')]=this[_0x33a2('0x20')]['to']||'';_0x22b441[_0x33a2('0x22')]=this['message'][_0x33a2('0x22')]||'';_0x22b441[_0x33a2('0x23')]=!![];if(this[_0x33a2('0x20')]['subject']){_0x22b441[_0x33a2('0x24')]='';_0x22b441[_0x33a2('0x24')]+=_['startsWith'](this['message'][_0x33a2('0x24')],'Re:')?'':_0x33a2('0x25');_0x22b441[_0x33a2('0x24')]+=this[_0x33a2('0x20')][_0x33a2('0x24')];}}if(this[_0x33a2('0xf')]===_0x33a2('0x26')){_0x22b441[_0x33a2('0x27')]=this[_0x33a2('0x28')]['id'];}else{_0x22b441[_[_0x33a2('0x29')](this[_0x33a2('0xf')])+_0x33a2('0x2a')]=this[_0x33a2('0x28')]['id'];}_0x22b441[_[_0x33a2('0x29')](this['channel'])+_0x33a2('0x2b')]=this[_0x33a2('0x13')]['id'];var _0x1de3d4=this[_0x33a2('0x13')];if(rpc[this[_0x33a2('0xf')]+_0x33a2('0x2c')]){if(this[_0x33a2('0xf')]===_0x33a2('0x1d')){_0x22b441['inReplyTo']=this[_0x33a2('0x20')][_0x33a2('0x2d')];_0x22b441[_0x33a2('0x2e')]=_0x33a2('0x2f')+_['replace'](_0x22b441['body'],']+(>|$)/g,''),'priorityTrue':_0x3b9596[0x1],'priorityFalse':_0x3b9596[0x2]};var _0x325a77=gotoif[_0xf716('0x0')](_0x1c1047,{'typecast':!![]});if(_0x325a77[_0xf716('0xb')]){logger[_0xf716('0xc')](_0xf716('0xd'),_0x24f9dc,_[_0xf716('0xe')](_0x325a77,_0xf716('0xf'))[_0xf716('0x10')](',\x20'));_0x487275[_0xf716('0x11')]();}else{try{var _0x5a0302=eval('('+_0x1c1047[_0xf716('0x12')]+')');var _0x3e5b8d=_0x5a0302?_0x1c1047[_0xf716('0x13')]:_0x1c1047[_0xf716('0x14')];logger[_0xf716('0x15')](_0xf716('0x16'),_0x24f9dc,_0x1c1047[_0xf716('0x12')],_0x5a0302,_0x3e5b8d||_0xf716('0x17'));if(_0x3e5b8d){var _0x1a799b=_[_0xf716('0x18')](_0x487275[_0xf716('0x19')](),{'p':_0x3e5b8d});if(_0x1a799b>=0x0){logger[_0xf716('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x24f9dc,_0x3e5b8d||_0xf716('0x17'),_0x1a799b);_0x487275[_0xf716('0x17')](_0x1a799b);}else{logger[_0xf716('0x15')](_0xf716('0x1a'),_0x24f9dc,_0x3e5b8d||_0xf716('0x17'));_0x487275['stop']();}}else{_0x487275[_0xf716('0x17')]();}}catch(_0x450f11){logger[_0xf716('0xc')](_0xf716('0x1b'),_0x24f9dc,_0x450f11[_0xf716('0xf')]);_0x487275[_0xf716('0x11')]();}}}catch(_0x59a073){logger[_0xf716('0xc')](_0xf716('0xd'),_0x24f9dc,JSON[_0xf716('0x1c')](_0x59a073));_0x487275[_0xf716('0x11')]();}};}; \ No newline at end of file +var _0x2c45=['rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','stringify','validate','lodash','html-to-text','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2c45,0x1ae));var _0x52c4=function(_0x2c9f61,_0x1863df){_0x2c9f61=_0x2c9f61-0x0;var _0x25f1a3=_0x2c45[_0x2c9f61];return _0x25f1a3;};'use strict';var schema=require(_0x52c4('0x0'));var _=require(_0x52c4('0x1'));var htmlToText=require(_0x52c4('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x52c4('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x52c4('0x4')},'priorityTrue':{'type':_0x52c4('0x5'),'message':_0x52c4('0x6')},'priorityFalse':{'type':_0x52c4('0x5'),'message':_0x52c4('0x7')}});exports['consequence']=function(_0x530906,_0x2a51e8){return function(_0x5cce57){try{var _0x381949={'condition':htmlToText[_0x52c4('0x8')](utils['getMustacheRender'](_0x2a51e8[0x0],this),{'wordwrap':![]})[_0x52c4('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2a51e8[0x1],'priorityFalse':_0x2a51e8[0x2]};var _0x4d29c0=gotoif[_0x52c4('0x0')](_0x381949,{'typecast':!![]});if(_0x4d29c0[_0x52c4('0xa')]){logger[_0x52c4('0xb')](_0x52c4('0xc'),_0x530906,_[_0x52c4('0xd')](_0x4d29c0,'message')['join'](',\x20'));_0x5cce57[_0x52c4('0xe')]();}else{try{var _0x4080f5=eval('('+_0x381949[_0x52c4('0xf')]+')');var _0x2f4637=_0x4080f5?_0x381949['priorityTrue']:_0x381949[_0x52c4('0x10')];logger[_0x52c4('0x11')](_0x52c4('0x12'),_0x530906,_0x381949['condition'],_0x4080f5,_0x2f4637||_0x52c4('0x13'));if(_0x2f4637){var _0x1e33ae=_['findIndex'](_0x5cce57[_0x52c4('0x14')](),{'p':_0x2f4637});if(_0x1e33ae>=0x0){logger[_0x52c4('0x11')](_0x52c4('0x15'),_0x530906,_0x2f4637||_0x52c4('0x13'),_0x1e33ae);_0x5cce57[_0x52c4('0x13')](_0x1e33ae);}else{logger['info'](_0x52c4('0x16'),_0x530906,_0x2f4637||_0x52c4('0x13'));_0x5cce57[_0x52c4('0xe')]();}}else{_0x5cce57[_0x52c4('0x13')]();}}catch(_0x40350e){logger[_0x52c4('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x530906,_0x40350e[_0x52c4('0x17')]);_0x5cce57[_0x52c4('0xe')]();}}}catch(_0x3dac76){logger[_0x52c4('0xb')](_0x52c4('0xc'),_0x530906,JSON[_0x52c4('0x18')](_0x3dac76));_0x5cce57['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index d8343cc..aa096d8 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 _0x01b8=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x46ea3a,_0x3477cb){var _0x27cb8a=function(_0x386d1d){while(--_0x386d1d){_0x46ea3a['push'](_0x46ea3a['shift']());}};_0x27cb8a(++_0x3477cb);}(_0x01b8,0x15b));var _0x801b=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0x01b8[_0x5a7d41];return _0x98d8fa;};'use strict';var schema=require('validate');var _=require(_0x801b('0x0'));var logger=require(_0x801b('0x1'))(_0x801b('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x801b('0x3')}});exports[_0x801b('0x4')]=function(_0xb193b6,_0x41927c){return function(_0x3a9f90){try{var _0x30cc24={'priority':_0x41927c[0x0]};var _0x9544bc=gotop[_0x801b('0x5')](_0x30cc24,{'typecast':!![]});if(_0x9544bc['length']){logger[_0x801b('0x6')](_0x801b('0x7'),_0xb193b6,_[_0x801b('0x8')](_0x9544bc,_0x801b('0x9'))['join'](',\x20'));_0x3a9f90[_0x801b('0xa')]();}else{logger[_0x801b('0xb')](_0x801b('0xc'),_0xb193b6,_0x30cc24[_0x801b('0xd')]);if(_0x30cc24[_0x801b('0xd')]){var _0x1b400b=_[_0x801b('0xe')](_0x3a9f90[_0x801b('0xf')](),{'p':_0x30cc24['priority']});if(_0x1b400b>=0x0){logger[_0x801b('0xb')](_0x801b('0x10'),_0xb193b6,_0x30cc24['priority']||'next',_0x1b400b);_0x3a9f90[_0x801b('0x11')](_0x1b400b);}else{logger[_0x801b('0xb')](_0x801b('0x12'),_0xb193b6,_0x30cc24['priority']||_0x801b('0x11'));_0x3a9f90[_0x801b('0xa')]();}}else{_0x3a9f90['next']();}}}catch(_0x269ed8){logger[_0x801b('0x6')](_0x801b('0x7'),_0xb193b6,JSON[_0x801b('0x13')](_0x269ed8));_0x3a9f90[_0x801b('0xa')]();}};}; \ No newline at end of file +var _0x7170=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','stop','info','priority','rules'];(function(_0x11e323,_0x4750e4){var _0x391751=function(_0x32a0f3){while(--_0x32a0f3){_0x11e323['push'](_0x11e323['shift']());}};_0x391751(++_0x4750e4);}(_0x7170,0xf0));var _0x0717=function(_0x4fe155,_0x4f93ab){_0x4fe155=_0x4fe155-0x0;var _0x5c31d0=_0x7170[_0x4fe155];return _0x5c31d0;};'use strict';var schema=require(_0x0717('0x0'));var _=require('lodash');var logger=require(_0x0717('0x1'))('routing');var gotop=schema({'priority':{'type':_0x0717('0x2'),'required':!![],'message':_0x0717('0x3')}});exports[_0x0717('0x4')]=function(_0x462930,_0x553dcb){return function(_0x10d2c4){try{var _0x18502a={'priority':_0x553dcb[0x0]};var _0x16c86b=gotop[_0x0717('0x0')](_0x18502a,{'typecast':!![]});if(_0x16c86b['length']){logger[_0x0717('0x5')](_0x0717('0x6'),_0x462930,_[_0x0717('0x7')](_0x16c86b,'message')['join'](',\x20'));_0x10d2c4[_0x0717('0x8')]();}else{logger[_0x0717('0x9')]('[%s][GOTOP]\x20priority\x20%s',_0x462930,_0x18502a[_0x0717('0xa')]);if(_0x18502a[_0x0717('0xa')]){var _0x27fdf2=_['findIndex'](_0x10d2c4[_0x0717('0xb')](),{'p':_0x18502a[_0x0717('0xa')]});if(_0x27fdf2>=0x0){logger[_0x0717('0x9')](_0x0717('0xc'),_0x462930,_0x18502a['priority']||'next',_0x27fdf2);_0x10d2c4[_0x0717('0xd')](_0x27fdf2);}else{logger[_0x0717('0x9')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x462930,_0x18502a[_0x0717('0xa')]||_0x0717('0xd'));_0x10d2c4[_0x0717('0x8')]();}}else{_0x10d2c4['next']();}}}catch(_0x1e5ff9){logger[_0x0717('0x5')](_0x0717('0x6'),_0x462930,JSON['stringify'](_0x1e5ff9));_0x10d2c4['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 7b5e0c0..b2c0762 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 _0x9434=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9434,0x168));var _0x4943=function(_0xd1104f,_0x3f2499){_0xd1104f=_0xd1104f-0x0;var _0x5ae5b8=_0x9434[_0xd1104f];return _0x5ae5b8;};'use strict';var _=require(_0x4943('0x0'));var utils=require(_0x4943('0x1'));var logger=require(_0x4943('0x2'))(_0x4943('0x3'));var rpc={'chatMessage':require(_0x4943('0x4')),'openchannelMessage':require(_0x4943('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x4943('0x6')),'faxMessage':require(_0x4943('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4943('0x8')]=function(_0x43b5b0,_0x4f930e){return function(_0x394d9d){try{var _0x56a55a={'body':utils['getMustacheRender'](_0x4f930e[0x0],this),'ContactId':this[_0x4943('0x9')]['id']};if(this[_0x4943('0xa')]===_0x4943('0xb')){_0x56a55a[_0x4943('0xc')]=this[_0x4943('0xd')]['id'];}else{_0x56a55a[_['upperFirst'](this['channel'])+_0x4943('0xe')]=this[_0x4943('0xd')]['id'];}_0x56a55a[_[_0x4943('0xf')](this['channel'])+_0x4943('0x10')]=this[_0x4943('0x11')]['id'];if(rpc[this['channel']+_0x4943('0x12')]){return rpc[this['channel']+'Message'][_0x4943('0x13')](_0x56a55a)[_0x4943('0x14')](function(_0x33fd73){logger[_0x4943('0x15')](_0x4943('0x16'),_0x43b5b0,_0x56a55a[_0x4943('0x17')]);_0x394d9d[_0x4943('0x18')]();})['catch'](function(_0x902712){logger[_0x4943('0x19')](_0x4943('0x16'),_0x43b5b0,JSON[_0x4943('0x1a')](_0x902712));_0x394d9d[_0x4943('0x1b')]();});}}catch(_0x39b4e3){logger['error'](_0x4943('0x16'),_0x43b5b0,JSON[_0x4943('0x1a')](_0x39b4e3));_0x394d9d[_0x4943('0x1b')]();}};}; \ No newline at end of file +var _0x8058=['info','body','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8058,0x101));var _0x8805=function(_0x3d5371,_0x24ebd7){_0x3d5371=_0x3d5371-0x0;var _0x4631e3=_0x8058[_0x3d5371];return _0x4631e3;};'use strict';var _=require(_0x8805('0x0'));var utils=require(_0x8805('0x1'));var logger=require('../../../../config/logger')(_0x8805('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x8805('0x3')),'mailMessage':require(_0x8805('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x8805('0x5'))};exports[_0x8805('0x6')]=function(_0x58e3db,_0x438a1c){return function(_0x7a9c5c){try{var _0x5e5c27={'body':utils[_0x8805('0x7')](_0x438a1c[0x0],this),'ContactId':this['contact']['id']};if(this[_0x8805('0x8')]===_0x8805('0x9')){_0x5e5c27[_0x8805('0xa')]=this[_0x8805('0xb')]['id'];}else{_0x5e5c27[_[_0x8805('0xc')](this[_0x8805('0x8')])+_0x8805('0xd')]=this[_0x8805('0xb')]['id'];}_0x5e5c27[_[_0x8805('0xc')](this[_0x8805('0x8')])+_0x8805('0xe')]=this[_0x8805('0xf')]['id'];if(rpc[this[_0x8805('0x8')]+_0x8805('0x10')]){return rpc[this[_0x8805('0x8')]+'Message']['create'](_0x5e5c27)[_0x8805('0x11')](function(_0x17f4c9){logger[_0x8805('0x12')]('[%s][MESSAGE]\x20%s',_0x58e3db,_0x5e5c27[_0x8805('0x13')]);_0x7a9c5c['next']();})[_0x8805('0x14')](function(_0x1434e3){logger[_0x8805('0x15')](_0x8805('0x16'),_0x58e3db,JSON[_0x8805('0x17')](_0x1434e3));_0x7a9c5c[_0x8805('0x18')]();});}}catch(_0x9e286b){logger[_0x8805('0x15')](_0x8805('0x16'),_0x58e3db,JSON['stringify'](_0x9e286b));_0x7a9c5c[_0x8805('0x18')]();}};}; \ 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 b6498e4..e24c050 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 _0x17b4=['consequence','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','stop','./utils','routing'];(function(_0x1fb5d1,_0x95dbe6){var _0x38611d=function(_0x227056){while(--_0x227056){_0x1fb5d1['push'](_0x1fb5d1['shift']());}};_0x38611d(++_0x95dbe6);}(_0x17b4,0x12e));var _0x417b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x17b4[_0x1d9aa0];return _0x226868;};'use strict';var utils=require(_0x417b('0x0'));var logger=require('../../../../config/logger')(_0x417b('0x1'));exports[_0x417b('0x2')]=function(_0x290633,_0x3cc2d3){return function(_0x5f0669){try{logger['info'](_0x417b('0x3'),_0x290633,utils[_0x417b('0x4')](_0x3cc2d3[0x0],this));_0x5f0669['next']();}catch(_0x730f46){logger[_0x417b('0x5')](_0x417b('0x3'),_0x290633,JSON[_0x417b('0x6')](_0x730f46));_0x5f0669[_0x417b('0x7')]();}};}; \ No newline at end of file +var _0xb809=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stop','./utils'];(function(_0x2de072,_0x5b1dd8){var _0x4b9742=function(_0x2fc08a){while(--_0x2fc08a){_0x2de072['push'](_0x2de072['shift']());}};_0x4b9742(++_0x5b1dd8);}(_0xb809,0xa1));var _0x9b80=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0xb809[_0x567bcb];return _0x4eebc2;};'use strict';var utils=require(_0x9b80('0x0'));var logger=require(_0x9b80('0x1'))(_0x9b80('0x2'));exports[_0x9b80('0x3')]=function(_0x2d57e6,_0x42c608){return function(_0x5a542f){try{logger[_0x9b80('0x4')](_0x9b80('0x5'),_0x2d57e6,utils[_0x9b80('0x6')](_0x42c608[0x0],this));_0x5a542f[_0x9b80('0x7')]();}catch(_0x4380c8){logger['error'](_0x9b80('0x5'),_0x2d57e6,JSON['stringify'](_0x4380c8));_0x5a542f[_0x9b80('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 25e56af..40375f4 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 _0x4262=['%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','length','error','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/environment','routing','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','capitalize','format','%sQueuesWaitingInteractions','pick'];(function(_0x8a9d3,_0x421a03){var _0x49220e=function(_0x261557){while(--_0x261557){_0x8a9d3['push'](_0x8a9d3['shift']());}};_0x49220e(++_0x421a03);}(_0x4262,0x138));var _0x2426=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4262[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x2426('0x0'));var _=require(_0x2426('0x1'));var util=require(_0x2426('0x2'));var seqqueue=require(_0x2426('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x2426('0x4'));var logger=require('../../../../config/logger')(_0x2426('0x5'));var strategy=require('./strategy');config[_0x2426('0x6')]=_['defaults'](config[_0x2426('0x6')],{'host':_0x2426('0x7'),'port':0x18eb});var io=require(_0x2426('0x8'))(new Redis(config[_0x2426('0x6')]));var attributes=['id',_0x2426('0x9'),_0x2426('0xa'),_0x2426('0xb'),_0x2426('0xc'),_0x2426('0xd')];function emit(_0x59053d,_0x19fc5b,_0x134801){io['to'](_0x59053d)[_0x2426('0xe')](_0x19fc5b,_0x134801);}function emitChannelQueueInteraction(_0x1c8795,_0x4a5982,_0x3e783b,_0x447a67,_0x5c1168,_0x253e75,_0x36c298,_0x9d7fd2){var _0x309a5d=_[_0x2426('0xf')](_0x3e783b);_0x309a5d[_0x2426('0x9')]=_0x9d7fd2;_0x309a5d[_0x2426('0xb')]=_0x4a5982;_0x309a5d[_0x2426('0xa')]=_0x447a67;_0x309a5d['id']=_0x5c1168;if(_0x253e75){attributes['push'](_[_0x2426('0x10')](_0x1c8795)+'InteractionId');_0x36c298[util[_0x2426('0x11')](_0x2426('0x12'),_0x1c8795)][_0x5c1168]=_[_0x2426('0x13')](_0x309a5d,attributes);}else{delete _0x36c298[util[_0x2426('0x11')](_0x2426('0x12'),_0x1c8795)][_0x5c1168];}emit(util['format']('%s:queue:%s',_0x1c8795,_0x4a5982),util['format'](_0x2426('0x14'),_0x1c8795,_0x253e75?'save':_0x2426('0x15')),_[_0x2426('0x13')](_0x309a5d,attributes));}var rpc={'openchannelQueueReport':require(_0x2426('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x2426('0x17')),'smsQueueReport':require(_0x2426('0x18')),'faxQueueReport':require(_0x2426('0x19')),'whatsappQueueReport':require(_0x2426('0x1a')),'chatInteraction':require(_0x2426('0x1b')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x2426('0x1c')),'openchannelInteraction':require(_0x2426('0x1d')),'smsInteraction':require(_0x2426('0x1e')),'whatsappInteraction':require(_0x2426('0x1f'))};var queue=schema({'name':{'type':_0x2426('0x20'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x2426('0x21'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x46eaa8,_0x3571f3,_0x2b4c13,_0x301786){if(_0x46eaa8&&_0x3571f3&&_0x2b4c13){_0x3571f3[_0x2426('0x22')]+=0x1;var _0x190f8b={'uniqueid':_0x46eaa8,'from':_0x2b4c13[_0x2426('0x23')]?_0x2b4c13[_0x2426('0x23')]['from']:'','joinAt':moment()[_0x2426('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b4c13[_0x2426('0x24')]?_0x2b4c13['contact']['id']:null,'ListId':_0x2b4c13['list']?_0x2b4c13[_0x2426('0x25')]['id']:null};_0x190f8b[_[_0x2426('0x26')](_0x2b4c13[_0x2426('0x27')])+_0x2426('0x28')]=_0x3571f3['id']||null;_0x190f8b[_[_0x2426('0x26')](_0x2b4c13[_0x2426('0x27')])+_0x2426('0x29')]=_0x2b4c13[_0x2426('0x2a')]?_0x2b4c13[_0x2426('0x2a')]['id']:null;_0x190f8b[_[_0x2426('0x26')](_0x2b4c13[_0x2426('0x27')])+'MessageId']=_0x2b4c13[_0x2426('0x2b')]?_0x2b4c13[_0x2426('0x2b')]['id']:null;_0x190f8b[_[_0x2426('0x26')](_0x2b4c13[_0x2426('0x27')])+(_0x2b4c13[_0x2426('0x27')]!=='chat'?'AccountId':_0x2426('0x2c'))]=_0x2b4c13[_0x2426('0xa')]?_0x2b4c13[_0x2426('0xa')]['id']:null;logger[_0x2426('0x2d')](util[_0x2426('0x11')](_0x2426('0x2e'),_0x46eaa8,_0x3571f3[_0x2426('0x2f')]));emitChannelQueueInteraction(_0x2b4c13[_0x2426('0x27')],_0x3571f3[_0x2426('0x2f')],_0x190f8b,_0x2b4c13['account']['name'],_0x2b4c13[_0x2426('0x2b')]['id'],!![],_0x301786,_0x3571f3['id']);if(rpc[_0x2b4c13[_0x2426('0x27')]+_0x2426('0x30')]){return rpc[_0x2b4c13['channel']+_0x2426('0x30')][_0x2426('0x31')](_0x190f8b)[_0x2426('0x32')](function(_0x150b9d){logger['error'](_0x2426('0x33'),_0x150b9d);});}}}function stopRouting(_0x1cd347,_0x278b57,_0x1639a0,_0x3057bd){if(_0x1cd347&&_0x278b57){_0x278b57[_0x2426('0x22')]-=0x1;var _0x15eb04={'leaveAt':moment()[_0x2426('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x2426('0x11')](_0x2426('0x34')),'reason':_0x2426('0x35')};logger['info'](util['format'](_0x2426('0x36'),_0x1cd347,_0x278b57[_0x2426('0x2f')]));emitChannelQueueInteraction(_0x1639a0[_0x2426('0x27')],_0x278b57[_0x2426('0x2f')],_0x1639a0['body'],_0x1639a0[_0x2426('0xa')][_0x2426('0x2f')],_0x1639a0[_0x2426('0x2b')]['id'],![],_0x3057bd,_0x278b57['id']);return rpc[_0x1639a0[_0x2426('0x27')]+_0x2426('0x37')]['update'](_0x1639a0[_0x2426('0x2a')]['id'],{'queueId':_0x278b57['id']})[_0x2426('0x38')](function(){if(rpc[_0x1639a0[_0x2426('0x27')]+_0x2426('0x30')]){return rpc[_0x1639a0[_0x2426('0x27')]+_0x2426('0x30')][_0x2426('0x39')](_0x1cd347,_0x15eb04)['catch'](function(_0x2e289f){logger['error']('update\x20queue\x20report',_0x2e289f);});}});}}function endRouting(_0x180f73,_0x40bee6,_0xa3af66,_0x3ef70c){if(_0x180f73&&_0x40bee6){_0x40bee6[_0x2426('0x22')]-=0x1;var _0x35ad90={'leaveAt':moment()[_0x2426('0x11')](_0x2426('0x34')),'exitAt':moment()['format'](_0x2426('0x34')),'reason':_0x2426('0x3a')};logger['info'](util[_0x2426('0x11')](_0x2426('0x3b'),_0x180f73,_0x40bee6[_0x2426('0x2f')]));emitChannelQueueInteraction(_0xa3af66[_0x2426('0x27')],_0x40bee6[_0x2426('0x2f')],_0xa3af66[_0x2426('0x23')],_0xa3af66['account'][_0x2426('0x2f')],_0xa3af66[_0x2426('0x2b')]['id'],![],_0x3ef70c);if(rpc[_0xa3af66[_0x2426('0x27')]+'QueueReport']){return rpc[_0xa3af66['channel']+_0x2426('0x30')][_0x2426('0x39')](_0x180f73,_0x35ad90)[_0x2426('0x32')](function(_0x1b7769){logger['error'](_0x2426('0x3c'),_0x1b7769);});}}}function handleFindQueue(_0xc87cad){return function(_0x15ff0b){return _0x15ff0b['name'][_0x2426('0x3d')]()===_0xc87cad[_0x2426('0x3d')]();};}exports['consequence']=function(_0x406286,_0x56b662,_0x1274da,_0x11db09){return function(_0x5d6005){try{var _0x17912a={'name':_0x56b662[0x0],'timeout':_0x56b662[0x1]};var _0x491183=queue['validate'](_0x17912a,{'typecast':!![]});if(_0x491183[_0x2426('0x3e')]){logger[_0x2426('0x3f')](_0x2426('0x40'),_0x406286,_[_0x2426('0x41')](_0x491183,_0x2426('0x2b'))[_0x2426('0x42')](',\x20'));_0x5d6005['stop']();}else{var _0x5781f5=_[_0x2426('0x43')](_0x1274da[_0x11db09[_0x2426('0x27')]+_0x2426('0x44')],handleFindQueue(_0x17912a[_0x2426('0x2f')]));if(_0x5781f5){startRouting(_0x406286,_0x5781f5,_0x11db09,_0x1274da);var _0x383b49=(_0x5781f5[_0x2426('0x3a')]||0xa)*0x3e8;var _0x4522b5=(_0x17912a[_0x2426('0x3a')]||0x14)*0x3e8;var _0x15d451;if(_0x383b49>_0x4522b5){_0x4522b5=_0x383b49;}var _0x13e424=seqqueue[_0x2426('0x45')](_0x383b49);_0x13e424['id']=_0x406286;_0x13e424[_0x2426('0x46')]=_0x383b49;_0x13e424['qtimeout']=_0x4522b5;_0x13e424[_0x2426('0x27')]=_0x11db09[_0x2426('0x27')];_0x1274da['rules'][_0x406286]['on'](_0x2426('0x47'),function(){logger[_0x2426('0x2d')](_0x2426('0x48'),_0x406286);stopRouting(_0x406286,_0x5781f5,_0x11db09,_0x1274da);clearTimeout(_0x15d451);_0x15d451=undefined;_0x13e424['close'](!![]);if(_0x1274da[_0x2426('0x49')][_0x406286]){delete _0x1274da['rules'][_0x406286];}_0x5d6005[_0x2426('0x4a')]();});_0x1274da['rules'][_0x406286]['on'](_0x2426('0x4b'),function(){if(_0x1274da[_0x2426('0x49')][_0x406286]){delete _0x1274da[_0x2426('0x49')][_0x406286];}});_0x15d451=setTimeout(function(){logger[_0x2426('0x2d')](_0x2426('0x4c'),_0x406286);endRouting(_0x406286,_0x5781f5,_0x11db09,_0x1274da);clearTimeout(_0x15d451);_0x13e424[_0x2426('0x4d')](!![]);_0x5d6005[_0x2426('0x4e')]();},_0x4522b5);switch(_0x5781f5['strategy']){case _0x2426('0x4f'):strategy[_0x2426('0x4f')](_0x13e424,_0x5781f5,_0x1274da,_0x11db09);break;default:strategy[_0x2426('0x50')](_0x13e424,_0x5781f5,_0x1274da,_0x11db09);}}else{logger[_0x2426('0x3f')](_0x2426('0x51'),_0x406286,_0x17912a[_0x2426('0x2f')]);_0x5d6005['stop']();}}}catch(_0x70a08){logger[_0x2426('0x3f')](_0x2426('0x40'),_0x406286,_0x70a08[_0x2426('0x52')]);_0x5d6005[_0x2426('0x4a')]();}};}; \ No newline at end of file +var _0xb279=['next','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','socket.io-emitter','queue_id','account','from','joinAt','emit','queue','push','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','interaction','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','length','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close'];(function(_0x292911,_0x279a2e){var _0x18dee9=function(_0x43ccf8){while(--_0x43ccf8){_0x292911['push'](_0x292911['shift']());}};_0x18dee9(++_0x279a2e);}(_0xb279,0xb5));var _0x9b27=function(_0xb29f1f,_0x10548c){_0xb29f1f=_0xb29f1f-0x0;var _0x4d6007=_0xb279[_0xb29f1f];return _0x4d6007;};'use strict';var schema=require(_0x9b27('0x0'));var _=require(_0x9b27('0x1'));var util=require(_0x9b27('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x9b27('0x3'));var Redis=require(_0x9b27('0x4'));var config=require(_0x9b27('0x5'));var logger=require(_0x9b27('0x6'))(_0x9b27('0x7'));var strategy=require(_0x9b27('0x8'));config['redis']=_['defaults'](config[_0x9b27('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x9b27('0xa'))(new Redis(config['redis']));var attributes=['id',_0x9b27('0xb'),_0x9b27('0xc'),'queue',_0x9b27('0xd'),_0x9b27('0xe')];function emit(_0x301750,_0x3c0739,_0x200b30){io['to'](_0x301750)[_0x9b27('0xf')](_0x3c0739,_0x200b30);}function emitChannelQueueInteraction(_0x472204,_0xa316c5,_0x48b779,_0x4f28fb,_0x4a3622,_0x154b57,_0x50b6f3,_0x3d8184){var _0x5b8bf7=_['clone'](_0x48b779);_0x5b8bf7[_0x9b27('0xb')]=_0x3d8184;_0x5b8bf7[_0x9b27('0x10')]=_0xa316c5;_0x5b8bf7[_0x9b27('0xc')]=_0x4f28fb;_0x5b8bf7['id']=_0x4a3622;if(_0x154b57){attributes[_0x9b27('0x11')](_['capitalize'](_0x472204)+_0x9b27('0x12'));_0x50b6f3[util[_0x9b27('0x13')](_0x9b27('0x14'),_0x472204)][_0x4a3622]=_['pick'](_0x5b8bf7,attributes);}else{delete _0x50b6f3[util['format'](_0x9b27('0x14'),_0x472204)][_0x4a3622];}emit(util[_0x9b27('0x13')](_0x9b27('0x15'),_0x472204,_0xa316c5),util[_0x9b27('0x13')](_0x9b27('0x16'),_0x472204,_0x154b57?_0x9b27('0x17'):_0x9b27('0x18')),_[_0x9b27('0x19')](_0x5b8bf7,attributes));}var rpc={'openchannelQueueReport':require(_0x9b27('0x1a')),'mailQueueReport':require(_0x9b27('0x1b')),'chatQueueReport':require(_0x9b27('0x1c')),'smsQueueReport':require(_0x9b27('0x1d')),'faxQueueReport':require(_0x9b27('0x1e')),'whatsappQueueReport':require(_0x9b27('0x1f')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x9b27('0x20')),'mailInteraction':require(_0x9b27('0x21')),'openchannelInteraction':require(_0x9b27('0x22')),'smsInteraction':require(_0x9b27('0x23')),'whatsappInteraction':require(_0x9b27('0x24'))};var queue=schema({'name':{'type':_0x9b27('0x25'),'required':!![],'message':_0x9b27('0x26')},'timeout':{'type':_0x9b27('0x27'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x41a6bc,_0x2f530c,_0x215fee,_0x5370e3){if(_0x41a6bc&&_0x2f530c&&_0x215fee){_0x2f530c[_0x9b27('0x28')]+=0x1;var _0x44caa1={'uniqueid':_0x41a6bc,'from':_0x215fee[_0x9b27('0x29')]?_0x215fee[_0x9b27('0x29')][_0x9b27('0xd')]:'','joinAt':moment()[_0x9b27('0x13')](_0x9b27('0x2a')),'ContactId':_0x215fee[_0x9b27('0x2b')]?_0x215fee[_0x9b27('0x2b')]['id']:null,'ListId':_0x215fee['list']?_0x215fee[_0x9b27('0x2c')]['id']:null};_0x44caa1[_[_0x9b27('0x2d')](_0x215fee[_0x9b27('0x2e')])+_0x9b27('0x2f')]=_0x2f530c['id']||null;_0x44caa1[_['upperFirst'](_0x215fee[_0x9b27('0x2e')])+_0x9b27('0x12')]=_0x215fee['interaction']?_0x215fee['interaction']['id']:null;_0x44caa1[_[_0x9b27('0x2d')](_0x215fee['channel'])+_0x9b27('0x30')]=_0x215fee[_0x9b27('0x31')]?_0x215fee[_0x9b27('0x31')]['id']:null;_0x44caa1[_[_0x9b27('0x2d')](_0x215fee[_0x9b27('0x2e')])+(_0x215fee['channel']!==_0x9b27('0x32')?_0x9b27('0x33'):_0x9b27('0x34'))]=_0x215fee[_0x9b27('0xc')]?_0x215fee[_0x9b27('0xc')]['id']:null;logger[_0x9b27('0x35')](util[_0x9b27('0x13')](_0x9b27('0x36'),_0x41a6bc,_0x2f530c[_0x9b27('0x37')]));emitChannelQueueInteraction(_0x215fee['channel'],_0x2f530c[_0x9b27('0x37')],_0x44caa1,_0x215fee[_0x9b27('0xc')][_0x9b27('0x37')],_0x215fee[_0x9b27('0x31')]['id'],!![],_0x5370e3,_0x2f530c['id']);if(rpc[_0x215fee[_0x9b27('0x2e')]+_0x9b27('0x38')]){return rpc[_0x215fee[_0x9b27('0x2e')]+_0x9b27('0x38')][_0x9b27('0x39')](_0x44caa1)['catch'](function(_0x44f207){logger[_0x9b27('0x3a')](_0x9b27('0x3b'),_0x44f207);});}}}function stopRouting(_0x43c965,_0x1d86f0,_0x573c69,_0x12be45){if(_0x43c965&&_0x1d86f0){_0x1d86f0[_0x9b27('0x28')]-=0x1;var _0x599456={'leaveAt':moment()[_0x9b27('0x13')](_0x9b27('0x2a')),'acceptAt':moment()[_0x9b27('0x13')](_0x9b27('0x2a')),'reason':_0x9b27('0x3c')};logger[_0x9b27('0x35')](util['format'](_0x9b27('0x3d'),_0x43c965,_0x1d86f0[_0x9b27('0x37')]));emitChannelQueueInteraction(_0x573c69[_0x9b27('0x2e')],_0x1d86f0[_0x9b27('0x37')],_0x573c69[_0x9b27('0x29')],_0x573c69[_0x9b27('0xc')][_0x9b27('0x37')],_0x573c69[_0x9b27('0x31')]['id'],![],_0x12be45,_0x1d86f0['id']);return rpc[_0x573c69[_0x9b27('0x2e')]+_0x9b27('0x3e')][_0x9b27('0x3f')](_0x573c69[_0x9b27('0x40')]['id'],{'queueId':_0x1d86f0['id']})['then'](function(){if(rpc[_0x573c69[_0x9b27('0x2e')]+_0x9b27('0x38')]){return rpc[_0x573c69[_0x9b27('0x2e')]+'QueueReport'][_0x9b27('0x3f')](_0x43c965,_0x599456)['catch'](function(_0x28da46){logger[_0x9b27('0x3a')](_0x9b27('0x41'),_0x28da46);});}});}}function endRouting(_0x242c03,_0x580840,_0x26067a,_0x10b7f2){if(_0x242c03&&_0x580840){_0x580840[_0x9b27('0x28')]-=0x1;var _0xd2ff4e={'leaveAt':moment()[_0x9b27('0x13')](_0x9b27('0x2a')),'exitAt':moment()['format'](_0x9b27('0x2a')),'reason':_0x9b27('0x42')};logger[_0x9b27('0x35')](util[_0x9b27('0x13')](_0x9b27('0x43'),_0x242c03,_0x580840[_0x9b27('0x37')]));emitChannelQueueInteraction(_0x26067a[_0x9b27('0x2e')],_0x580840[_0x9b27('0x37')],_0x26067a['body'],_0x26067a[_0x9b27('0xc')][_0x9b27('0x37')],_0x26067a[_0x9b27('0x31')]['id'],![],_0x10b7f2);if(rpc[_0x26067a[_0x9b27('0x2e')]+_0x9b27('0x38')]){return rpc[_0x26067a[_0x9b27('0x2e')]+_0x9b27('0x38')][_0x9b27('0x3f')](_0x242c03,_0xd2ff4e)[_0x9b27('0x44')](function(_0x567d7b){logger['error']('update\x20queue\x20report',_0x567d7b);});}}}function handleFindQueue(_0x5819dc){return function(_0x2a6836){return _0x2a6836['name']['toLowerCase']()===_0x5819dc['toLowerCase']();};}exports['consequence']=function(_0x44101d,_0x2323fa,_0x48ca2a,_0x55a167){return function(_0x4de356){try{var _0x2a5e17={'name':_0x2323fa[0x0],'timeout':_0x2323fa[0x1]};var _0x1f2178=queue[_0x9b27('0x0')](_0x2a5e17,{'typecast':!![]});if(_0x1f2178[_0x9b27('0x45')]){logger['error']('[%s][QUEUE]\x20%s',_0x44101d,_[_0x9b27('0x46')](_0x1f2178,_0x9b27('0x31'))['join'](',\x20'));_0x4de356[_0x9b27('0x47')]();}else{var _0x161933=_[_0x9b27('0x48')](_0x48ca2a[_0x55a167['channel']+_0x9b27('0x49')],handleFindQueue(_0x2a5e17[_0x9b27('0x37')]));if(_0x161933){startRouting(_0x44101d,_0x161933,_0x55a167,_0x48ca2a);var _0x2bc29f=(_0x161933[_0x9b27('0x42')]||0xa)*0x3e8;var _0x596f7f=(_0x2a5e17[_0x9b27('0x42')]||0x14)*0x3e8;var _0x4acb8b;if(_0x2bc29f>_0x596f7f){_0x596f7f=_0x2bc29f;}var _0x2b7a34=seqqueue[_0x9b27('0x4a')](_0x2bc29f);_0x2b7a34['id']=_0x44101d;_0x2b7a34[_0x9b27('0x4b')]=_0x2bc29f;_0x2b7a34[_0x9b27('0x4c')]=_0x596f7f;_0x2b7a34[_0x9b27('0x2e')]=_0x55a167[_0x9b27('0x2e')];_0x48ca2a[_0x9b27('0x4d')][_0x44101d]['on'](_0x9b27('0x4e'),function(){logger[_0x9b27('0x35')](_0x9b27('0x4f'),_0x44101d);stopRouting(_0x44101d,_0x161933,_0x55a167,_0x48ca2a);clearTimeout(_0x4acb8b);_0x4acb8b=undefined;_0x2b7a34['close'](!![]);if(_0x48ca2a['rules'][_0x44101d]){delete _0x48ca2a['rules'][_0x44101d];}_0x4de356[_0x9b27('0x47')]();});_0x48ca2a[_0x9b27('0x4d')][_0x44101d]['on'](_0x9b27('0x50'),function(){if(_0x48ca2a[_0x9b27('0x4d')][_0x44101d]){delete _0x48ca2a[_0x9b27('0x4d')][_0x44101d];}});_0x4acb8b=setTimeout(function(){logger[_0x9b27('0x35')](_0x9b27('0x51'),_0x44101d);endRouting(_0x44101d,_0x161933,_0x55a167,_0x48ca2a);clearTimeout(_0x4acb8b);_0x2b7a34[_0x9b27('0x52')](!![]);_0x4de356[_0x9b27('0x53')]();},_0x596f7f);switch(_0x161933['strategy']){case'rrmemory':strategy[_0x9b27('0x54')](_0x2b7a34,_0x161933,_0x48ca2a,_0x55a167);break;default:strategy[_0x9b27('0x55')](_0x2b7a34,_0x161933,_0x48ca2a,_0x55a167);}}else{logger[_0x9b27('0x3a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x44101d,_0x2a5e17[_0x9b27('0x37')]);_0x4de356[_0x9b27('0x47')]();}}}catch(_0x3cb867){logger['error'](_0x9b27('0x56'),_0x44101d,_0x3cb867[_0x9b27('0x57')]);_0x4de356['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 10fa763..0c6ae3e 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 _0x2d17=['routing','notificationId','agent','squeue','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','forcedOwnership','channel','busy','saveWaitingNotification','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','../../../../../config/logger'];(function(_0x6942ea,_0x3674a7){var _0x467695=function(_0x489c39){while(--_0x489c39){_0x6942ea['push'](_0x6942ea['shift']());}};_0x467695(++_0x3674a7);}(_0x2d17,0x17e));var _0x72d1=function(_0x2eca50,_0x46b0ce){_0x2eca50=_0x2eca50-0x0;var _0x192d0f=_0x2d17[_0x2eca50];return _0x192d0f;};'use strict';var _=require(_0x72d1('0x0'));var uuid=require(_0x72d1('0x1'));var util=require('./util');var logger=require(_0x72d1('0x2'))(_0x72d1('0x3'));var Agent=function(_0x531f4e,_0x3687bc,_0x38fec7,_0x55b722){this[_0x72d1('0x4')]=uuid['v4']();this['squeue']=_0x531f4e;this[_0x72d1('0x5')]=_0x3687bc;this['realtime']=_0x38fec7;this[_0x72d1('0x3')]=_0x55b722;this[_0x72d1('0x6')]['push'](this[_0x72d1('0x7')][_0x72d1('0x8')](this),this[_0x72d1('0x9')]['bind'](this));this[_0x72d1('0x6')]['on'](_0x72d1('0xa'),this[_0x72d1('0x9')]['bind'](this));this[_0x72d1('0x6')]['on'](_0x72d1('0xb'),this[_0x72d1('0xc')][_0x72d1('0x8')](this));};Agent[_0x72d1('0xd')][_0x72d1('0xe')]=function(){this[_0x72d1('0x6')][_0x72d1('0xe')](this[_0x72d1('0x7')][_0x72d1('0x8')](this),this['handleTimeout'][_0x72d1('0x8')](this));};Agent[_0x72d1('0xd')][_0x72d1('0xc')]=function(){this[_0x72d1('0x9')](!![]);};Agent[_0x72d1('0xd')][_0x72d1('0x7')]=function(){logger[_0x72d1('0xf')](_0x72d1('0x10'),this[_0x72d1('0x6')]['id'],this[_0x72d1('0x5')]['id']);if(_[_0x72d1('0x11')](this[_0x72d1('0x12')][_0x72d1('0x13')][this['agent']['id']])){logger[_0x72d1('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x72d1('0x6')]['id'],this[_0x72d1('0x5')]['id']);setTimeout(this['push'][_0x72d1('0x8')](this),0x3e8);}else{if(this[_0x72d1('0x3')][_0x72d1('0x14')]||util['isAgentAvailable'](this['squeue']['id'],this[_0x72d1('0x12')][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']],this[_0x72d1('0x6')][_0x72d1('0x15')],![])){this[_0x72d1('0x12')][_0x72d1('0x13')][this['agent']['id']][_0x72d1('0x16')]=!![];this['realtime']['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0x72d1('0x17')](this[_0x72d1('0x12')],this['routing'],this[_0x72d1('0x5')],this[_0x72d1('0x6')][_0x72d1('0x15')]);util[_0x72d1('0x18')](this[_0x72d1('0x4')],this['squeue']['id'],this['realtime'][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']],null,this[_0x72d1('0x3')]);util[_0x72d1('0x19')](this[_0x72d1('0x6')]['id'],this[_0x72d1('0x12')][_0x72d1('0x13')][this['agent']['id']],'RINGING'+(this[_0x72d1('0x3')]['forcedOwnership']?_0x72d1('0x1a'):''));}else{logger[_0x72d1('0xf')](_0x72d1('0x1b'),this['squeue']['id'],this[_0x72d1('0x5')]['id']);setTimeout(this['push'][_0x72d1('0x8')](this),0x3e8);}}};Agent[_0x72d1('0xd')][_0x72d1('0x9')]=function(_0x2cc0c8){if(_['isNil'](this[_0x72d1('0x12')]['agents'][this[_0x72d1('0x5')]['id']])){return logger[_0x72d1('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x72d1('0x6')]['id'],this[_0x72d1('0x5')]['id']);}else{logger[_0x72d1('0xf')](_0x72d1('0x1c'),this[_0x72d1('0x6')]['id'],this['agent']['id']);util[_0x72d1('0x1d')](this[_0x72d1('0x4')],this[_0x72d1('0x6')]['id'],this['realtime'][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']],null,this['routing']);this[_0x72d1('0x12')][_0x72d1('0x13')][this[_0x72d1('0x5')]['id']]['busy']=![];this[_0x72d1('0x12')]['agents'][this[_0x72d1('0x5')]['id']][_0x72d1('0x1e')]=undefined;util[_0x72d1('0x1f')](this[_0x72d1('0x12')],this[_0x72d1('0x3')],this[_0x72d1('0x5')],this[_0x72d1('0x6')][_0x72d1('0x15')]);util[_0x72d1('0x19')](this[_0x72d1('0x6')]['id'],this[_0x72d1('0x12')]['agents'][this[_0x72d1('0x5')]['id']],_0x2cc0c8?_0x72d1('0x20'):_0x72d1('0x21'));}if(!_0x2cc0c8){setTimeout(this[_0x72d1('0xe')]['bind'](this),0x3e8);}};function agent(_0x3eb3da,_0x3ae025,_0x2783bb,_0x4fb07b){return new Agent(_0x3eb3da,_0x3ae025,_0x2783bb,_0x4fb07b);}module[_0x72d1('0x22')]=agent; \ No newline at end of file +var _0x81bd=['writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','bind','timeout','handleTimeout','drained','handleDrained','prototype','push','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x81bd,0x7c));var _0xd81b=function(_0x54ba26,_0x301c1f){_0x54ba26=_0x54ba26-0x0;var _0x36ce4e=_0x81bd[_0x54ba26];return _0x36ce4e;};'use strict';var _=require(_0xd81b('0x0'));var uuid=require(_0xd81b('0x1'));var util=require(_0xd81b('0x2'));var logger=require(_0xd81b('0x3'))(_0xd81b('0x4'));var Agent=function(_0x2ec03a,_0x111a9c,_0x54e096,_0x16e8de){this[_0xd81b('0x5')]=uuid['v4']();this[_0xd81b('0x6')]=_0x2ec03a;this['agent']=_0x111a9c;this[_0xd81b('0x7')]=_0x54e096;this[_0xd81b('0x4')]=_0x16e8de;this[_0xd81b('0x6')]['push'](this['handleRun'][_0xd81b('0x8')](this),this['handleTimeout'][_0xd81b('0x8')](this));this[_0xd81b('0x6')]['on'](_0xd81b('0x9'),this[_0xd81b('0xa')][_0xd81b('0x8')](this));this[_0xd81b('0x6')]['on'](_0xd81b('0xb'),this[_0xd81b('0xc')][_0xd81b('0x8')](this));};Agent[_0xd81b('0xd')][_0xd81b('0xe')]=function(){this[_0xd81b('0x6')][_0xd81b('0xe')](this['handleRun'][_0xd81b('0x8')](this),this['handleTimeout'][_0xd81b('0x8')](this));};Agent[_0xd81b('0xd')]['handleDrained']=function(){this[_0xd81b('0xa')](!![]);};Agent['prototype'][_0xd81b('0xf')]=function(){logger[_0xd81b('0x10')](_0xd81b('0x11'),this[_0xd81b('0x6')]['id'],this[_0xd81b('0x12')]['id']);if(_['isNil'](this[_0xd81b('0x7')][_0xd81b('0x13')][this['agent']['id']])){logger[_0xd81b('0x10')](_0xd81b('0x14'),this[_0xd81b('0x6')]['id'],this[_0xd81b('0x12')]['id']);setTimeout(this[_0xd81b('0xe')][_0xd81b('0x8')](this),0x3e8);}else{if(this[_0xd81b('0x4')][_0xd81b('0x15')]||util[_0xd81b('0x16')](this[_0xd81b('0x6')]['id'],this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']],this[_0xd81b('0x6')][_0xd81b('0x17')],![])){this[_0xd81b('0x7')]['agents'][this['agent']['id']][_0xd81b('0x18')]=!![];this[_0xd81b('0x7')][_0xd81b('0x13')][this['agent']['id']][_0xd81b('0x19')]=undefined;util[_0xd81b('0x1a')](this['realtime'],this[_0xd81b('0x4')],this[_0xd81b('0x12')],this[_0xd81b('0x6')][_0xd81b('0x17')]);util[_0xd81b('0x1b')](this[_0xd81b('0x5')],this[_0xd81b('0x6')]['id'],this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']],null,this[_0xd81b('0x4')]);util[_0xd81b('0x1c')](this['squeue']['id'],this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']],_0xd81b('0x1d')+(this[_0xd81b('0x4')][_0xd81b('0x15')]?_0xd81b('0x1e'):''));}else{logger[_0xd81b('0x10')](_0xd81b('0x1f'),this['squeue']['id'],this[_0xd81b('0x12')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xd81b('0xd')][_0xd81b('0xa')]=function(_0x5141e6){if(_['isNil'](this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']])){return logger[_0xd81b('0x10')](_0xd81b('0x14'),this[_0xd81b('0x6')]['id'],this['agent']['id']);}else{logger[_0xd81b('0x10')](_0xd81b('0x20'),this['squeue']['id'],this['agent']['id']);util[_0xd81b('0x21')](this[_0xd81b('0x5')],this['squeue']['id'],this['realtime']['agents'][this[_0xd81b('0x12')]['id']],null,this[_0xd81b('0x4')]);this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']][_0xd81b('0x18')]=![];this[_0xd81b('0x7')]['agents'][this[_0xd81b('0x12')]['id']]['busyQueue']=undefined;util[_0xd81b('0x22')](this[_0xd81b('0x7')],this[_0xd81b('0x4')],this[_0xd81b('0x12')],this[_0xd81b('0x6')][_0xd81b('0x17')]);util[_0xd81b('0x1c')](this[_0xd81b('0x6')]['id'],this[_0xd81b('0x7')][_0xd81b('0x13')][this[_0xd81b('0x12')]['id']],_0x5141e6?_0xd81b('0x23'):_0xd81b('0x24'));}if(!_0x5141e6){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x413bf6,_0x46119e,_0x401430,_0x59c066){return new Agent(_0x413bf6,_0x46119e,_0x401430,_0x59c066);}module[_0xd81b('0x25')]=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 7dbda71..88f1f4c 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 _0xb05b=['busyQueue','showNotification','notificationId','hideNotification','STOP','TIMEOUT','channel','exports','lodash','uuid','./util','routing','squeue','realtime','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','push','isNil','Agents','queue','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy'];(function(_0x5d5216,_0x295ce5){var _0x154b76=function(_0x2a3f47){while(--_0x2a3f47){_0x5d5216['push'](_0x5d5216['shift']());}};_0x154b76(++_0x295ce5);}(_0xb05b,0x110));var _0xbb05=function(_0x9d53fb,_0x4b898b){_0x9d53fb=_0x9d53fb-0x0;var _0x12f955=_0xb05b[_0x9d53fb];return _0x12f955;};'use strict';var _=require(_0xbb05('0x0'));var uuid=require(_0xbb05('0x1'));var util=require(_0xbb05('0x2'));var logger=require('../../../../../config/logger')(_0xbb05('0x3'));var Beepall=function(_0xb7189,_0x17b5ef,_0x1b9a6d,_0x5989e1){this['notificationId']=uuid['v4']();this[_0xbb05('0x4')]=_0xb7189;this['queue']=_0x17b5ef;this[_0xbb05('0x5')]=_0x1b9a6d;this['routing']=_0x5989e1;this[_0xbb05('0x4')]['push'](this[_0xbb05('0x6')][_0xbb05('0x7')](this),this['handleTimeout']['bind'](this));this[_0xbb05('0x4')]['on'](_0xbb05('0x8'),this[_0xbb05('0x9')][_0xbb05('0x7')](this));this[_0xbb05('0x4')]['on'](_0xbb05('0xa'),this[_0xbb05('0xb')][_0xbb05('0x7')](this));};Beepall[_0xbb05('0xc')][_0xbb05('0xd')]=function(){this[_0xbb05('0x4')][_0xbb05('0xd')](this[_0xbb05('0x6')][_0xbb05('0x7')](this),this[_0xbb05('0x9')][_0xbb05('0x7')](this));};Beepall[_0xbb05('0xc')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall[_0xbb05('0xc')][_0xbb05('0x6')]=function(){var _0x33641f=!![];if(!_[_0xbb05('0xe')](this['queue'])&&!_[_0xbb05('0xe')](this['queue'][_0xbb05('0xf')])&&this[_0xbb05('0x10')][_0xbb05('0xf')][_0xbb05('0x11')]>0x0){for(var _0x440a0f=0x0,_0x441bb9;_0x440a0f0x0){for(var _0x12c1c7=0x0,_0x52b431;_0x12c1c70x0&&_0x5da20a[_0x92f4ad+_0x3d98('0x23')]>=_0x5da20a[_0x92f4ad+_0x3d98('0x22')]){writeLog(_0x35a40f,_0x5da20a,_0x92f4ad['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x229809,_0x5a2067,_0x30692c,_0x867f85,_0x1d6673){return sendNotification(!![],_0x229809,_0x5a2067,_0x30692c,_0x867f85,_0x1d6673);};exports['hideNotification']=function(_0x188041,_0x437df2,_0x2bb81,_0x2dca32,_0x4409ff){return sendNotification(![],_0x188041,_0x437df2,_0x2bb81,_0x2dca32,_0x4409ff);};exports['checkWaitingNotifications']=function(_0x29c14f,_0x105679,_0x4bd15a){var _0x27b631=_0x105679[_0x3d98('0x24')][_0x3d98('0x25')];if(!_0x27b631&&_0x4bd15a){_0x27b631=_0x4bd15a['id'];}var _0x56f39c=_[_0x3d98('0x26')](_0x29c14f[_0x105679['channel']+_0x3d98('0x27')],function(_0x1cfbf4){var _0x26df3c=_[_0x3d98('0x28')](_0x105679['channel'])+_0x3d98('0x29');return _0x1cfbf4[_0x26df3c]===_0x105679[_0x3d98('0x24')]['id'];});if(!_0x56f39c&&_0x27b631&&_0x29c14f[_0x3d98('0x2a')][_0x27b631]){_0x56f39c=_[_0x3d98('0x26')](_0x29c14f[_0x3d98('0x2a')][_0x27b631][_0x105679[_0x3d98('0x2b')]+_0x3d98('0x2c')],function(_0x4351e2){return _0x4351e2['id']===_0x105679['interaction']['id'];});}return _0x56f39c;};exports[_0x3d98('0x2d')]=function(_0xd676b9,_0x422a85,_0x302252,_0x57c385){if(_0x302252&&_0x302252['id']&&_0xd676b9['agents']&&_0xd676b9[_0x3d98('0x2a')][_0x302252['id']]){_0xd676b9['agents'][_0x302252['id']][_0x57c385+_0x3d98('0x2c')][_0x422a85['message']['id']]={'id':_0x422a85['interaction']['id']};}};exports[_0x3d98('0x2e')]=function(_0x561258,_0x52f666,_0x309d48,_0x18d57d){if(_0x309d48&&_0x309d48['id']&&_0x561258[_0x3d98('0x2a')]&&_0x561258[_0x3d98('0x2a')][_0x309d48['id']]){delete _0x561258[_0x3d98('0x2a')][_0x309d48['id']][_0x18d57d+_0x3d98('0x2c')][_0x52f666[_0x3d98('0x15')]['id']];}};exports[_0x3d98('0x2f')]=writeLog; \ No newline at end of file +var _0x74ed=['I\x20can\x27t\x20render\x20your\x20template','format','[%s][QUEUE]\x20%s','message','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','OFFLINE','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','\x20MAXCAPACITY','showNotification','interaction','UserId','some','QueuesWaitingInteractions','capitalize','channel','InteractionId','agents','WaitingInteractions','saveWaitingNotification','util','../utils','../../../../../config/environment','../../../../../config/logger','redis','localhost','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate'];(function(_0x631c23,_0x3e18bc){var _0x37f536=function(_0x2a0d53){while(--_0x2a0d53){_0x631c23['push'](_0x631c23['shift']());}};_0x37f536(++_0x3e18bc);}(_0x74ed,0x109));var _0xd74e=function(_0x2743ca,_0x3c69b0){_0x2743ca=_0x2743ca-0x0;var _0x23a633=_0x74ed[_0x2743ca];return _0x23a633;};'use strict';var _=require('lodash');var util=require(_0xd74e('0x0'));var utils=require(_0xd74e('0x1'));var Redis=require('ioredis');var config=require(_0xd74e('0x2'));var logger=require(_0xd74e('0x3'))('routing');config[_0xd74e('0x4')]=_['defaults'](config['redis'],{'host':_0xd74e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x46d872,_0x32f479,_0x14707d,_0x1bf182,_0x40e323,_0x2f86b5){var _0x1b49da=_0x2f86b5||{};var _0x3b5edc=_0x14707d[_0xd74e('0x6')]('.');var _0x3fbf95={'uniqueid':_0x32f479,'channel':_0x3b5edc[0x0],'id':_0x3b5edc[0x1],'title':_0x3b5edc[0x0]+_0xd74e('0x7'),'interactionId':_0x3b5edc[0x2],'queue':_0x40e323?_0x40e323[_0xd74e('0x8')]:null,'sound':_0x1b49da[_0xd74e('0x9')][_0xd74e('0xa')],'shake':_0x1b49da[_0xd74e('0x9')][_0xd74e('0xb')]};try{if(!_0x1b49da[_0xd74e('0xc')]){_0x1b49da['body']={};}if(_0x40e323){_0x1b49da[_0xd74e('0xc')][_0xd74e('0xd')]=_0x40e323;}else if(_0x1b49da[_0xd74e('0xc')][_0xd74e('0xd')]){delete _0x1b49da[_0xd74e('0xc')][_0xd74e('0xd')];}_0x3fbf95[_0xd74e('0xe')]=utils[_0xd74e('0xf')](_0x1b49da['account'][_0xd74e('0x10')],_0x1b49da);}catch(_0x41177f){_0x3fbf95['msg']=_0xd74e('0x11');logger['error'](util[_0xd74e('0x12')](_0xd74e('0x13'),_0x32f479,_0x41177f[_0xd74e('0x14')]));}io['to'](util['format']('user:%s',_0x1bf182['name']))[_0xd74e('0x15')](util[_0xd74e('0x12')](_0xd74e('0x16'),_0x46d872?_0xd74e('0x17'):_0xd74e('0x18')),_0x3fbf95);}function writeLog(_0x3fbd68,_0x521bad,_0x2918b5){return logger[_0xd74e('0x19')](util['format'](_0xd74e('0x1a'),_0x3fbd68,_0x521bad[_0xd74e('0x8')],_0x2918b5));}exports[_0xd74e('0x1b')]=function(_0x19c9cd,_0x25815f,_0x2a186d,_0x1a0810){if(_0x25815f[_0xd74e('0x1c')]){writeLog(_0x19c9cd,_0x25815f,'BUSY');return![];}if(!_0x25815f[_0xd74e('0x1d')]){writeLog(_0x19c9cd,_0x25815f,_0xd74e('0x1e'));return![];}if(_0x25815f[_0x2a186d+'Pause']){writeLog(_0x19c9cd,_0x25815f,_0xd74e('0x1f'));return![];}if(_0x1a0810&&_0x25815f['hasOwnProperty'](_0x2a186d+_0xd74e('0x20'))&&_0x25815f[_0xd74e('0x21')](_0x2a186d+_0xd74e('0x22'))){if(_0x25815f[_0x2a186d+_0xd74e('0x20')]>0x0&&_0x25815f[_0x2a186d+_0xd74e('0x22')]>=_0x25815f[_0x2a186d+_0xd74e('0x20')]){writeLog(_0x19c9cd,_0x25815f,_0x2a186d['toUpperCase']()+_0xd74e('0x23'));return![];}}return!![];};exports[_0xd74e('0x24')]=function(_0x38360a,_0x4d4327,_0x440638,_0x95a0d,_0x2970b8){return sendNotification(!![],_0x38360a,_0x4d4327,_0x440638,_0x95a0d,_0x2970b8);};exports['hideNotification']=function(_0x16eddd,_0x22bdfc,_0x3b9a62,_0xa7fba6,_0x2c71b1){return sendNotification(![],_0x16eddd,_0x22bdfc,_0x3b9a62,_0xa7fba6,_0x2c71b1);};exports['checkWaitingNotifications']=function(_0xec7ef5,_0x38a521,_0x3dcf98){var _0x296799=_0x38a521[_0xd74e('0x25')][_0xd74e('0x26')];if(!_0x296799&&_0x3dcf98){_0x296799=_0x3dcf98['id'];}var _0x5914bc=_[_0xd74e('0x27')](_0xec7ef5[_0x38a521['channel']+_0xd74e('0x28')],function(_0x4351af){var _0x2fabc4=_[_0xd74e('0x29')](_0x38a521[_0xd74e('0x2a')])+_0xd74e('0x2b');return _0x4351af[_0x2fabc4]===_0x38a521[_0xd74e('0x25')]['id'];});if(!_0x5914bc&&_0x296799&&_0xec7ef5[_0xd74e('0x2c')][_0x296799]){_0x5914bc=_['some'](_0xec7ef5[_0xd74e('0x2c')][_0x296799][_0x38a521['channel']+_0xd74e('0x2d')],function(_0x3f36ef){return _0x3f36ef['id']===_0x38a521['interaction']['id'];});}return _0x5914bc;};exports[_0xd74e('0x2e')]=function(_0x4e1bcf,_0x1dde61,_0x448df9,_0x3b037f){if(_0x448df9&&_0x448df9['id']&&_0x4e1bcf[_0xd74e('0x2c')]&&_0x4e1bcf[_0xd74e('0x2c')][_0x448df9['id']]){_0x4e1bcf[_0xd74e('0x2c')][_0x448df9['id']][_0x3b037f+_0xd74e('0x2d')][_0x1dde61[_0xd74e('0x14')]['id']]={'id':_0x1dde61[_0xd74e('0x25')]['id']};}};exports['removeWaitingNotification']=function(_0x171c0c,_0x547665,_0x289227,_0x175c88){if(_0x289227&&_0x289227['id']&&_0x171c0c[_0xd74e('0x2c')]&&_0x171c0c[_0xd74e('0x2c')][_0x289227['id']]){delete _0x171c0c[_0xd74e('0x2c')][_0x289227['id']][_0x175c88+_0xd74e('0x2d')][_0x547665[_0xd74e('0x14')]['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 028b312..8a07f77 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 _0xff12=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','isNil','isEmpty','body','isObject','stringify','validate','shelljs','routing'];(function(_0x1671d1,_0x105ef0){var _0x3454db=function(_0x4a3997){while(--_0x4a3997){_0x1671d1['push'](_0x1671d1['shift']());}};_0x3454db(++_0x105ef0);}(_0xff12,0xa8));var _0x2ff1=function(_0x49fe06,_0x39a73e){_0x49fe06=_0x49fe06-0x0;var _0x228aef=_0xff12[_0x49fe06];return _0x228aef;};'use strict';var schema=require(_0x2ff1('0x0'));var sh=require(_0x2ff1('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2ff1('0x2'));var system=schema({'command':{'type':_0x2ff1('0x3'),'required':!![],'message':_0x2ff1('0x4')}});exports['consequence']=function(_0x48a8d0,_0x24840b){return function(_0x135568){try{var _0x5d2bf4={'command':_0x24840b[0x0]};var _0x1598c5=system['validate'](_0x5d2bf4,{'typecast':!![]});if(_0x1598c5[_0x2ff1('0x5')]){logger['error'](_0x2ff1('0x6'),_0x48a8d0,_[_0x2ff1('0x7')](_0x1598c5,_0x2ff1('0x8'))['join'](',\x20'));logger[_0x2ff1('0x9')](_0x2ff1('0xa'),_0x48a8d0);_0x135568[_0x2ff1('0xb')]();}else{var _0x26a98e=this;var _0x4d7f5b=utils[_0x2ff1('0xc')](_0x24840b[0x0],this);logger[_0x2ff1('0x9')](_0x2ff1('0xd'),_0x48a8d0,_0x4d7f5b);sh['exec'](_['trim'](_0x4d7f5b),function(_0x47d960,_0x4ea7ec){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x48a8d0,_0x47d960);if(_0x47d960==0x0){var _0x2a8c73=_0x4ea7ec['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x2ff1('0xe')](_0x24840b[0x1])||_[_0x2ff1('0xf')](_0x24840b[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x48a8d0);_0x26a98e[_0x2ff1('0x10')][_0x24840b[0x1]]=_0x2a8c73;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x48a8d0,_0x24840b[0x1],_0x2a8c73);_0x26a98e[_0x2ff1('0x10')][_0x24840b[0x1]]=_0x2a8c73;}}_0x135568['next']();});}}catch(_0x2b1869){logger['error'](_0x2ff1('0x6'),_0x48a8d0,_[_0x2ff1('0x11')](_0x2b1869)?JSON[_0x2ff1('0x12')](_0x2b1869):_0x2b1869);logger[_0x2ff1('0x9')](_0x2ff1('0xa'),_0x48a8d0);_0x135568[_0x2ff1('0xb')]();}};}; \ No newline at end of file +var _0x40d4=['validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x40d4,0x16c));var _0x440d=function(_0x3c60a5,_0x43ba61){_0x3c60a5=_0x3c60a5-0x0;var _0x5093e7=_0x40d4[_0x3c60a5];return _0x5093e7;};'use strict';var schema=require(_0x440d('0x0'));var sh=require(_0x440d('0x1'));var _=require(_0x440d('0x2'));var utils=require(_0x440d('0x3'));var logger=require(_0x440d('0x4'))(_0x440d('0x5'));var system=schema({'command':{'type':_0x440d('0x6'),'required':!![],'message':_0x440d('0x7')}});exports[_0x440d('0x8')]=function(_0x16d155,_0x4cdd92){return function(_0x23ee7a){try{var _0x15e3de={'command':_0x4cdd92[0x0]};var _0x3602b8=system['validate'](_0x15e3de,{'typecast':!![]});if(_0x3602b8['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x16d155,_[_0x440d('0x9')](_0x3602b8,_0x440d('0xa'))[_0x440d('0xb')](',\x20'));logger[_0x440d('0xc')](_0x440d('0xd'),_0x16d155);_0x23ee7a[_0x440d('0xe')]();}else{var _0x1818b8=this;var _0x2b12e1=utils['getMustacheRender'](_0x4cdd92[0x0],this);logger[_0x440d('0xc')](_0x440d('0xf'),_0x16d155,_0x2b12e1);sh[_0x440d('0x10')](_[_0x440d('0x11')](_0x2b12e1),function(_0x21b317,_0x5f1e0c){logger[_0x440d('0xc')](_0x440d('0x12'),_0x16d155,_0x21b317);if(_0x21b317==0x0){var _0x446420=_0x5f1e0c[_0x440d('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x440d('0x14')](_0x4cdd92[0x1])||_[_0x440d('0x15')](_0x4cdd92[0x1])){logger[_0x440d('0xc')](_0x440d('0x16'),_0x16d155);_0x1818b8[_0x440d('0x17')][_0x4cdd92[0x1]]=_0x446420;}else{logger[_0x440d('0xc')](_0x440d('0x18'),_0x16d155,_0x4cdd92[0x1],_0x446420);_0x1818b8[_0x440d('0x17')][_0x4cdd92[0x1]]=_0x446420;}}_0x23ee7a['next']();});}}catch(_0xeac57b){logger[_0x440d('0x19')]('[%s][SYSTEM]\x20%s',_0x16d155,_[_0x440d('0x1a')](_0xeac57b)?JSON[_0x440d('0x1b')](_0xeac57b):_0xeac57b);logger[_0x440d('0xc')](_0x440d('0xd'),_0x16d155);_0x23ee7a['next']();}};}; \ 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 03dff1e..d545d81 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 _0xaece=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','finally','next','isObject','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','message','info'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xaece,0x179));var _0xeaec=function(_0x120649,_0x139606){_0x120649=_0x120649-0x0;var _0x2d78c3=_0xaece[_0x120649];return _0x2d78c3;};'use strict';var schema=require(_0xeaec('0x0'));var _=require(_0xeaec('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xeaec('0x2')),'smsInteraction':require(_0xeaec('0x3')),'mailInteraction':require(_0xeaec('0x4')),'faxInteraction':require(_0xeaec('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xeaec('0x6'))(_0xeaec('0x7'));var tag=schema({'tag':{'type':_0xeaec('0x8'),'required':!![],'message':_0xeaec('0x9')}});exports['consequence']=function(_0x1630c8,_0x4285f4,_0x2ea049,_0x30fc94){return function(_0x45c383){try{var _0x472b9a={'tag':_0x4285f4[0x0]};var _0x2f7b33=tag[_0xeaec('0x0')](_0x472b9a,{'typecast':!![]});if(_0x2f7b33[_0xeaec('0xa')]){logger['error'](_0xeaec('0xb'),_0x1630c8,_[_0xeaec('0xc')](_0x2f7b33,_0xeaec('0xd'))['join'](',\x20'));logger[_0xeaec('0xe')](_0xeaec('0xf'),_0x1630c8);_0x45c383['next']();}else{var _0x23cbd4={'ids':[_0x4285f4[0x0]]};if(rpc[_0x30fc94[_0xeaec('0x10')]+_0xeaec('0x11')]){rpc[_0x30fc94['channel']+_0xeaec('0x11')][_0xeaec('0x12')](_0x30fc94[_0xeaec('0x13')]['id'],_0x23cbd4)[_0xeaec('0x14')](function(_0x33d67c){logger['info'](_0xeaec('0x15'),_0x1630c8,_0x4285f4[0x1],_0x30fc94[_0xeaec('0x10')],_0x30fc94[_0xeaec('0x13')]['id']);})[_0xeaec('0x16')](function(_0x2ef330){logger[_0xeaec('0x17')](_0xeaec('0xb'),_0x1630c8,JSON['stringify'](_0x2ef330));logger[_0xeaec('0xe')](_0xeaec('0xf'),_0x1630c8);})[_0xeaec('0x18')](function(){_0x45c383[_0xeaec('0x19')]();});}}}catch(_0x289fb2){logger[_0xeaec('0x17')](_0xeaec('0xb'),_0x1630c8,_[_0xeaec('0x1a')](_0x289fb2)?JSON[_0xeaec('0x1b')](_0x289fb2):_0x289fb2);logger['info'](_0xeaec('0xf'),_0x1630c8);_0x45c383[_0xeaec('0x19')]();}};}; \ No newline at end of file +var _0x092e=['validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','number','consequence','length','error','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','next','isObject'];(function(_0x30e12c,_0x365cec){var _0x30625d=function(_0x308584){while(--_0x308584){_0x30e12c['push'](_0x30e12c['shift']());}};_0x30625d(++_0x365cec);}(_0x092e,0x186));var _0xe092=function(_0xa75234,_0x2e9f29){_0xa75234=_0xa75234-0x0;var _0x596e0f=_0x092e[_0xa75234];return _0x596e0f;};'use strict';var schema=require(_0xe092('0x0'));var _=require(_0xe092('0x1'));var rpc={'chatInteraction':require(_0xe092('0x2')),'openchannelInteraction':require(_0xe092('0x3')),'smsInteraction':require(_0xe092('0x4')),'mailInteraction':require(_0xe092('0x5')),'faxInteraction':require(_0xe092('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0xe092('0x7'));var tag=schema({'tag':{'type':_0xe092('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xe092('0x9')]=function(_0x4f6960,_0x4d16b3,_0x3ded04,_0x1963d5){return function(_0x282c8c){try{var _0x24bd05={'tag':_0x4d16b3[0x0]};var _0x5d4eea=tag[_0xe092('0x0')](_0x24bd05,{'typecast':!![]});if(_0x5d4eea[_0xe092('0xa')]){logger[_0xe092('0xb')]('[%s][TAG]\x20%s',_0x4f6960,_['map'](_0x5d4eea,_0xe092('0xc'))[_0xe092('0xd')](',\x20'));logger[_0xe092('0xe')](_0xe092('0xf'),_0x4f6960);_0x282c8c['next']();}else{var _0x2ee0da={'ids':[_0x4d16b3[0x0]]};if(rpc[_0x1963d5['channel']+_0xe092('0x10')]){rpc[_0x1963d5['channel']+_0xe092('0x10')][_0xe092('0x11')](_0x1963d5[_0xe092('0x12')]['id'],_0x2ee0da)['then'](function(_0x6e1d9a){logger[_0xe092('0xe')](_0xe092('0x13'),_0x4f6960,_0x4d16b3[0x1],_0x1963d5['channel'],_0x1963d5[_0xe092('0x12')]['id']);})[_0xe092('0x14')](function(_0x5b9bcf){logger[_0xe092('0xb')](_0xe092('0x15'),_0x4f6960,JSON[_0xe092('0x16')](_0x5b9bcf));logger[_0xe092('0xe')](_0xe092('0xf'),_0x4f6960);})[_0xe092('0x17')](function(){_0x282c8c[_0xe092('0x18')]();});}}}catch(_0x32a390){logger['error'](_0xe092('0x15'),_0x4f6960,_[_0xe092('0x19')](_0x32a390)?JSON[_0xe092('0x16')](_0x32a390):_0x32a390);logger[_0xe092('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4f6960);_0x282c8c[_0xe092('0x18')]();}};}; \ 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 8d7976d..42dcbab 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 _0xe4c6=['isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s'];(function(_0x25ecd5,_0x1a7e5f){var _0x4f411e=function(_0x3657de){while(--_0x3657de){_0x25ecd5['push'](_0x25ecd5['shift']());}};_0x4f411e(++_0x1a7e5f);}(_0xe4c6,0x13d));var _0x6e4c=function(_0x5e8e85,_0x5411cb){_0x5e8e85=_0x5e8e85-0x0;var _0x31fd50=_0xe4c6[_0x5e8e85];return _0x31fd50;};'use strict';var rp=require(_0x6e4c('0x0'));var logger=require(_0x6e4c('0x1'))(_0x6e4c('0x2'));var _=require(_0x6e4c('0x3'));var arr=[];exports[_0x6e4c('0x4')]=function(_0x3f77e5,_0x260373){return function(_0x5a1580){var _0x57e08a=_0x260373[0xa];var _0x320972=_0x260373[0xb];var _0x3f679d=_0x260373[0xc];var _0x1215c7=_0x260373[0xd];var _0x590762=_0x260373[0xe];var _0x369bde=_0x260373[0xf][_0x6e4c('0x5')](/\n/g,_0x6e4c('0x6'));var _0x2ad4f7=_0x260373[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x6e4c('0x7')](_0x320972)){arr[_0x6e4c('0x8')](_0x320972);var _0x3f79d4=_0x260373[0x3];var _0x1bfb5c=_0x260373[0x4];var _0x3bb64a=_0x260373[0x1];var _0x1fbf8a=_0x260373[0x0];var _0x3f401a={};_0x3f401a[_0x6e4c('0x9')]=_0x260373[0x8]+_0x6e4c('0xa')+_0x3f679d+'|'+_0x57e08a+'|'+_0x1215c7+'|'+_0x320972+'|'+_0x590762;_0x3f401a['urlOnRing']=_0x260373[0x7]+_0x6e4c('0xa')+_0x3f679d+'|'+_0x57e08a+'|'+_0x1215c7+'|'+_0x320972+'|'+_0x590762+'|'+_0x369bde+'|'+_0x2ad4f7;_0x3f401a[_0x6e4c('0xb')]=_0x260373[0x9];var _0x5c62c8={};_0x5c62c8[_0x6e4c('0xc')]=_0x6e4c('0xd');_0x5c62c8[_0x6e4c('0xe')]=_0x6e4c('0xf');var _0x4262d4=[];_0x4262d4[_0x6e4c('0x8')](_0x260373[0x2]);_0x4262d4[_0x6e4c('0x8')](_0x260373[0x5]);_0x4262d4[_0x6e4c('0x8')](_0x260373[0x6]);_0x5c62c8[_0x6e4c('0x10')]=_0x4262d4;_0x5c62c8['id']=0x1;var _0x52a155=JSON[_0x6e4c('0x11')](_0x5c62c8);var _0xc4aab1={'encoding':'utf8','method':_0x6e4c('0x12'),'timeout':0x2710,'url':_0x3f79d4,'headers':{'Content-Type':_0x6e4c('0x13')},'body':_0x52a155};return rp(_0xc4aab1)['then'](function(_0x50fb56){const _0x27ca0a=JSON[_0x6e4c('0x14')](_0x50fb56);if(!_0x27ca0a[_0x6e4c('0x15')][_0x6e4c('0x16')]){throw new Error(_0x6e4c('0x17'));}var _0x1d42c9=_0x320972;var _0x501a53=_0x6e4c('0x18')+_0x3bb64a+_0x6e4c('0x19')+_0x1fbf8a+_0x6e4c('0x1a')+_0x1d42c9+'&data='+JSON['stringify'](_0x3f401a);var _0x471dce=_0x1bfb5c+'?'+_0x501a53;return rp(_0x471dce);})[_0x6e4c('0x1b')](function(_0xb2aa03){logger[_0x6e4c('0x1c')](_0x6e4c('0x1d'),_0x3f77e5,_0xb2aa03);_0x5a1580[_0x6e4c('0x1e')]();})['catch'](function(_0x194a40){logger[_0x6e4c('0x1f')](_0x6e4c('0x20'),_0x3f77e5,_[_0x6e4c('0x21')](_0x194a40)?JSON[_0x6e4c('0x11')](_0x194a40):_0x194a40);_0x5a1580['stop']();});}else{logger[_0x6e4c('0x1c')](_0x6e4c('0x22'),_0x3f77e5);_0x5a1580['next']();}};}; \ No newline at end of file +var _0x325e=['&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','push','?params=','urlOnRing','title','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application'];(function(_0x1f29a8,_0x15ee9b){var _0xc62ab7=function(_0x276fce){while(--_0x276fce){_0x1f29a8['push'](_0x1f29a8['shift']());}};_0xc62ab7(++_0x15ee9b);}(_0x325e,0x1d9));var _0xe325=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x325e[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xe325('0x0'));var logger=require(_0xe325('0x1'))(_0xe325('0x2'));var _=require('lodash');var arr=[];exports[_0xe325('0x3')]=function(_0x26db5c,_0x1a38d0){return function(_0x5ef1e0){var _0x41a26b=_0x1a38d0[0xa];var _0xdfebd9=_0x1a38d0[0xb];var _0x5262e7=_0x1a38d0[0xc];var _0x5d707e=_0x1a38d0[0xd];var _0xc7f31e=_0x1a38d0[0xe];var _0x1748b3=_0x1a38d0[0xf][_0xe325('0x4')](/\n/g,_0xe325('0x5'));var _0x12b41f=_0x1a38d0[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0xdfebd9)){arr[_0xe325('0x6')](_0xdfebd9);var _0xbb6501=_0x1a38d0[0x3];var _0x187937=_0x1a38d0[0x4];var _0x255c8e=_0x1a38d0[0x1];var _0x53a3db=_0x1a38d0[0x0];var _0x69d111={};_0x69d111['urlOnAnswer']=_0x1a38d0[0x8]+_0xe325('0x7')+_0x5262e7+'|'+_0x41a26b+'|'+_0x5d707e+'|'+_0xdfebd9+'|'+_0xc7f31e;_0x69d111[_0xe325('0x8')]=_0x1a38d0[0x7]+_0xe325('0x7')+_0x5262e7+'|'+_0x41a26b+'|'+_0x5d707e+'|'+_0xdfebd9+'|'+_0xc7f31e+'|'+_0x1748b3+'|'+_0x12b41f;_0x69d111[_0xe325('0x9')]=_0x1a38d0[0x9];var _0xa8c111={};_0xa8c111['jsonrpc']='2.0';_0xa8c111[_0xe325('0xa')]=_0xe325('0xb');var _0x3aaecd=[];_0x3aaecd[_0xe325('0x6')](_0x1a38d0[0x2]);_0x3aaecd[_0xe325('0x6')](_0x1a38d0[0x5]);_0x3aaecd[_0xe325('0x6')](_0x1a38d0[0x6]);_0xa8c111[_0xe325('0xc')]=_0x3aaecd;_0xa8c111['id']=0x1;var _0x1d484d=JSON[_0xe325('0xd')](_0xa8c111);var _0x73a1e={'encoding':_0xe325('0xe'),'method':_0xe325('0xf'),'timeout':0x2710,'url':_0xbb6501,'headers':{'Content-Type':_0xe325('0x10')},'body':_0x1d484d};return rp(_0x73a1e)[_0xe325('0x11')](function(_0x2c5a6e){const _0x34a1f3=JSON[_0xe325('0x12')](_0x2c5a6e);if(!_0x34a1f3[_0xe325('0x13')][_0xe325('0x14')]){throw new Error(_0xe325('0x15'));}var _0x506741=_0xdfebd9;var _0x5e0af6='channelId='+_0x255c8e+_0xe325('0x16')+_0x53a3db+_0xe325('0x17')+_0x506741+_0xe325('0x18')+JSON[_0xe325('0xd')](_0x69d111);var _0xedb61c=_0x187937+'?'+_0x5e0af6;return rp(_0xedb61c);})[_0xe325('0x11')](function(_0x1ae9d6){logger[_0xe325('0x19')](_0xe325('0x1a'),_0x26db5c,_0x1ae9d6);_0x5ef1e0[_0xe325('0x1b')]();})[_0xe325('0x1c')](function(_0x5623c2){logger[_0xe325('0x1d')]('[%s][TVOX]\x20%s',_0x26db5c,_[_0xe325('0x1e')](_0x5623c2)?JSON['stringify'](_0x5623c2):_0x5623c2);_0x5ef1e0['stop']();});}else{logger[_0xe325('0x19')](_0xe325('0x1f'),_0x26db5c);_0x5ef1e0[_0xe325('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 5575333..99fc14c 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(_0x170620,_0xb3cc76){var _0x56988d=function(_0x253653){while(--_0x253653){_0x170620['push'](_0x170620['shift']());}};_0x56988d(++_0xb3cc76);}(_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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x9e0129,_0x4d5a76){var _0x2380be=function(_0x272ef6){while(--_0x272ef6){_0x9e0129['push'](_0x9e0129['shift']());}};_0x2380be(++_0x4d5a76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c1afe0b..437ef44 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 _0xde1a=['Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','UserId','catch','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','name','mailQueues','paused','openchannelQueues','loggedIn','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','push','slice','dialogflowv2','amazonlex','split','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','intervals','./applications/','consequence','priority','info'];(function(_0x52a019,_0x4cf810){var _0x15cad4=function(_0x38f5bd){while(--_0x38f5bd){_0x52a019['push'](_0x52a019['shift']());}};_0x15cad4(++_0x4cf810);}(_0xde1a,0xfd));var _0xade1=function(_0x4dbfed,_0x202f4e){_0x4dbfed=_0x4dbfed-0x0;var _0x3f6bf1=_0xde1a[_0x4dbfed];return _0x3f6bf1;};'use strict';var _=require('lodash');var util=require(_0xade1('0x0'));var path=require(_0xade1('0x1'));var fs=require('fs');var jayson=require(_0xade1('0x2'));var BPromise=require(_0xade1('0x3'));var utils=require(_0xade1('0x4'));var sUtils=require(_0xade1('0x5'));var logger=require(_0xade1('0x6'))(_0xade1('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xade1('0x8')),'chatQueueReport':require(_0xade1('0x9')),'smsQueueReport':require(_0xade1('0xa')),'faxQueueReport':require(_0xade1('0xb')),'whatsappQueueReport':require(_0xade1('0xc'))};var RuleEngine=require(_0xade1('0xd'));function getId(_0x5eb992,_0x3a24e7,_0x41d069){return util[_0xade1('0xe')](_0xade1('0xf'),_0x5eb992,_0x3a24e7||0x0,_0x41d069||0x0);}function getIntervals(_0x120f47,_0x2b3854){var _0x3ebc61=[];if(!_[_0xade1('0x10')](_0x2b3854['IntervalId'])&&!_[_0xade1('0x10')](_0x120f47[_0x2b3854[_0xade1('0x11')]])&&!_['isNil'](_0x120f47[_0x2b3854[_0xade1('0x11')]][_0xade1('0x12')])){_0x3ebc61=_[_0xade1('0x13')](_0x120f47[_0x2b3854['IntervalId']][_0xade1('0x12')],_0xade1('0x14'));}else if(!_[_0xade1('0x10')](_0x2b3854[_0xade1('0x14')])){_0x3ebc61=[_0x2b3854[_0xade1('0x14')]];}return _0x3ebc61;}exports[_0xade1('0x15')]=function(_0x525f90){_0x525f90[_0xade1('0x16')]={};return new BPromise(function(_0x13dda2,_0xf881e1){var _0x10773d={'Start':function(_0x1c9717){var _0x5bd472=this;return new Promise(function(_0x44c001,_0x4623a1){if(_0x1c9717){try{var _0x290566=[];var _0x232e06=getId(_0x1c9717[_0xade1('0x17')],_0x1c9717['message']?_0x1c9717[_0xade1('0x18')]['id']:0x0,_0x1c9717[_0xade1('0x19')]?_0x1c9717[_0xade1('0x19')]['id']:0x0);var _0x1600af=sUtils[_0xade1('0x1a')](_0x525f90,_0x1c9717);if(_0x1c9717[_0xade1('0x1b')]||!_0x1600af&&_0x1c9717[_0xade1('0x1c')]&&_[_0xade1('0x1d')](_0x1c9717[_0xade1('0x1c')])&&_0x1c9717[_0xade1('0x1c')][_0xade1('0x1e')]){for(var _0x12ea91=0x0;_0x12ea91<_0x1c9717['applications']['length'];_0x12ea91+=0x1){var _0xdbecaf=_0x1c9717[_0xade1('0x1c')][_0x12ea91];if(fs[_0xade1('0x1f')](path[_0xade1('0x20')](__dirname,_0xade1('0x1c'),_0xdbecaf[_0xade1('0x21')]+_0xade1('0x22')))){var _0xd9d2e1=[];switch(_0xdbecaf[_0xade1('0x21')][_0xade1('0x23')]()){case _0xade1('0x24'):var _0x4ab3ac=_0xdbecaf[_0xade1('0x25')]['split'](',');if(_0x1c9717[_0xade1('0x17')]==='mail'){_0xd9d2e1[_0xade1('0x26')](_0x4ab3ac[0x0]);_0xd9d2e1[_0xade1('0x26')](_0x4ab3ac[0x1]);_0xd9d2e1[_0xade1('0x26')](_0x4ab3ac[_0xade1('0x27')](0x2,_0x4ab3ac[_0xade1('0x1e')])[_0xade1('0x20')](','));}else{_0xd9d2e1[_0xade1('0x26')](_0x4ab3ac[0x0]);_0xd9d2e1['push'](_0x4ab3ac[_0xade1('0x27')](0x1,_0x4ab3ac[_0xade1('0x1e')])['join'](','));}break;case'dialogflow':var _0x38dd9f=_0xdbecaf[_0xade1('0x25')]['split'](',');_0xd9d2e1['push'](_0x38dd9f[0x0]);_0xd9d2e1[_0xade1('0x26')](_0x38dd9f[0x1]);_0xd9d2e1[_0xade1('0x26')](_0x38dd9f[_0xade1('0x27')](0x2,_0x38dd9f['length'])[_0xade1('0x20')](','));break;case _0xade1('0x28'):var _0x4ff656=_0xdbecaf['appdata']['split'](',');_0xd9d2e1[_0xade1('0x26')](_0x4ff656[0x0]);_0xd9d2e1[_0xade1('0x26')](_0x4ff656[0x1]);_0xd9d2e1[_0xade1('0x26')](_0x4ff656[0x2]);_0xd9d2e1[_0xade1('0x26')](_0x4ff656[0x3]);_0xd9d2e1[_0xade1('0x26')](_0x4ff656[_0xade1('0x27')](0x4,_0x4ff656[_0xade1('0x1e')])[_0xade1('0x20')](','));break;case _0xade1('0x29'):var _0x50fad4=_0xdbecaf[_0xade1('0x25')][_0xade1('0x2a')](',');_0xd9d2e1[_0xade1('0x26')](_0x50fad4[0x0]);_0xd9d2e1['push'](_0x50fad4[0x1]);_0xd9d2e1[_0xade1('0x26')](_0x50fad4[0x2]);_0xd9d2e1[_0xade1('0x26')](_0x50fad4[0x3]);_0xd9d2e1[_0xade1('0x26')](_0x50fad4['slice'](0x4,_0x50fad4[_0xade1('0x1e')])[_0xade1('0x20')](','));break;case _0xade1('0x18'):_0xd9d2e1[_0xade1('0x26')](_0xdbecaf[_0xade1('0x25')]);break;case'tag':_0xd9d2e1[_0xade1('0x26')](_0xdbecaf[_0xade1('0x2b')]);_0xd9d2e1[_0xade1('0x26')](_0xdbecaf['appdata']);break;case _0xade1('0x2c'):var _0x2f826e=utils[_0xade1('0x2d')](_0x1c9717[_0xade1('0x2e')][_0xade1('0x2f')],_0x1c9717);var _0x4201c1=_0xdbecaf[_0xade1('0x25')][_0xade1('0x2a')](',');_0xd9d2e1[_0xade1('0x26')](_0x4201c1[0x0]);_0xd9d2e1[_0xade1('0x26')](_0x4201c1[0x1]);_0xd9d2e1[_0xade1('0x26')](_0x4201c1[0x2]);_0xd9d2e1[_0xade1('0x26')](_0x4201c1[0x3]);_0xd9d2e1['push'](_0x4201c1[0x4]);_0xd9d2e1['push'](_0x4201c1[0x5]);_0xd9d2e1[_0xade1('0x26')](_0x4201c1[0x6]);_0xd9d2e1[_0xade1('0x26')](_0x4201c1[0x7]);_0xd9d2e1[_0xade1('0x26')](_0x4201c1[0x8]);_0xd9d2e1[_0xade1('0x26')](_0x4201c1[0x9]);_0xd9d2e1['push'](_0x4201c1[0xa]);_0xd9d2e1[_0xade1('0x26')](_0x1c9717['interaction']['id']);_0xd9d2e1['push'](_0x1c9717[_0xade1('0x18')]['id']);_0xd9d2e1[_0xade1('0x26')](_0xdbecaf[_0xade1('0x30')]);_0xd9d2e1['push'](_0x1c9717[_0xade1('0x19')]['ContactId']);_0xd9d2e1[_0xade1('0x26')](_0x1c9717[_0xade1('0x31')][_0xade1('0x31')]);_0xd9d2e1[_0xade1('0x26')](_0x2f826e);break;default:_0xd9d2e1=_['isNil'](_0xdbecaf['appdata'])?[]:_0xdbecaf[_0xade1('0x25')][_0xade1('0x2a')](',');}var _0x2ec493={'id':util[_0xade1('0xe')](_0xade1('0x32'),_0x232e06,_0xdbecaf['id'],_0xdbecaf[_0xade1('0x21')]),'condition':require('./interval')['condition'](_0x232e06,getIntervals(_0x525f90[_0xade1('0x33')],_0xdbecaf),_0x525f90),'consequence':require(_0xade1('0x34')+_0xdbecaf[_0xade1('0x21')])[_0xade1('0x35')](_0x232e06,_0xd9d2e1,_0x525f90,_0x1c9717),'p':_0xdbecaf[_0xade1('0x36')]||0x0};logger[_0xade1('0x37')](_0xade1('0x38'),_0x2ec493['id'],_0xade1('0x39'),getIntervals(_0x525f90[_0xade1('0x33')],_0xdbecaf)[_0xade1('0x20')](_0xade1('0x3a')));_0x290566[_0xade1('0x26')](_0x2ec493);}else{logger[_0xade1('0x3b')](_0xade1('0x3c'),path[_0xade1('0x20')](__dirname,_0xade1('0x1c'),_0xdbecaf['app']+_0xade1('0x22')));}}_0x525f90['rules'][_0x232e06]=new RuleEngine(_0x290566);_0x525f90[_0xade1('0x16')][_0x232e06][_0xade1('0x3d')](_0x1c9717,function(_0x347641){logger['info']('Applications\x20executed',JSON[_0xade1('0x3e')](_0x347641[_0xade1('0x3f')]));if(_0x525f90['rules'][_0x232e06]){_0x525f90[_0xade1('0x16')][_0x232e06][_0xade1('0x40')]('complete');}});return _0x44c001({'code':0xc8,'message':_0x1c9717});}else{if(_0x1600af){logger[_0xade1('0x37')](util[_0xade1('0xe')](_0xade1('0x41'),_0x232e06));}else{logger['info'](_0xade1('0x42'));}return _0x44c001({'code':0xc8,'message':_0x1c9717});}}catch(_0x53448a){logger[_0xade1('0x3b')](_0x53448a[_0xade1('0x43')]);return _0x4623a1(_0x5bd472[_0xade1('0x3b')](0x1f4,_0x53448a));}}return _0x4623a1(_0xade1('0x44'));});},'AcceptMessage':function(_0x1f9f26){var _0x38198b=this;return new Promise(function(_0x8505d4,_0x59b090){if(_0x1f9f26[_0xade1('0x45')]&&_0x1f9f26[_0xade1('0x45')]['id']){if(_0x525f90['agents'][_0x1f9f26['agent']['id']]){_0x525f90[_0xade1('0x46')][_0x1f9f26[_0xade1('0x45')]['id']][_0xade1('0x47')]=![];_0x525f90[_0xade1('0x46')][_0x1f9f26[_0xade1('0x45')]['id']][_0xade1('0x48')]=undefined;}}if(_0x1f9f26[_0xade1('0x18')]&&_0x1f9f26[_0xade1('0x18')]['id']){try{var _0xaf7357=getId(_0x1f9f26['channel'],_0x1f9f26['message']?_0x1f9f26[_0xade1('0x18')]['id']:0x0,_0x1f9f26[_0xade1('0x19')]?_0x1f9f26[_0xade1('0x19')]['id']:0x0);if(_0x525f90[_0xade1('0x16')][_0xaf7357]){_0x525f90[_0xade1('0x16')][_0xaf7357]['emit']('end');if(rpc[_0x1f9f26[_0xade1('0x17')]+_0xade1('0x49')]){rpc[_0x1f9f26[_0xade1('0x17')]+_0xade1('0x49')]['update'](_0xaf7357,{'UserId':_0x1f9f26[_0xade1('0x18')][_0xade1('0x4a')]})[_0xade1('0x4b')](function(){logger[_0xade1('0x3b')]('error\x20update\x20queue\x20report');});}}return _0x8505d4({'code':0xc8,'message':_0x1f9f26});}catch(_0x4dbea4){logger['error'](_0x4dbea4['stack']);return _0x59b090(_0x38198b['error'](0x1f4,_0x4dbea4));}}logger['error'](_0xade1('0x4c'));return _0x59b090(_0x38198b[_0xade1('0x3b')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x57d8f1){var _0x2158bb=this;return new Promise(function(_0x486f7a,_0x195573){if(_0x57d8f1[_0xade1('0x45')]&&_0x57d8f1['agent']['id']){try{if(_0x525f90[_0xade1('0x46')][_0x57d8f1[_0xade1('0x45')]['id']]){_0x525f90[_0xade1('0x46')][_0x57d8f1['agent']['id']]['busy']=![];_0x525f90[_0xade1('0x46')][_0x57d8f1['agent']['id']][_0xade1('0x48')]=undefined;}return _0x486f7a({'code':0xc8,'message':_0x57d8f1});}catch(_0x2520a7){logger[_0xade1('0x3b')](_0x2520a7[_0xade1('0x43')]);return _0x195573(_0x2158bb[_0xade1('0x3b')](0x1f4,_0x2520a7));}}logger[_0xade1('0x3b')](_0xade1('0x4c'));return _0x195573(_0x2158bb['error'](0x1f4,_0xade1('0x4c')));});},'AbandonInteraction':function(_0x21bce2){var _0x55bcdf=this;return new Promise(function(_0x4b0997,_0x31a2bd){if(_0x21bce2[_0xade1('0x17')]&&_0x21bce2[_0xade1('0x19')]&&_0x21bce2['interaction']['id']){try{var _0x3543ff=getId(_0x21bce2[_0xade1('0x17')],_0x21bce2[_0xade1('0x18')]?_0x21bce2[_0xade1('0x18')]['id']:0x0,_0x21bce2[_0xade1('0x19')]?_0x21bce2[_0xade1('0x19')]['id']:0x0);if(_0x525f90[_0xade1('0x16')][_0x3543ff]){_0x525f90['rules'][_0x3543ff]['emit'](_0xade1('0x4d'));}return _0x4b0997({'code':0xc8,'message':_0x21bce2});}catch(_0x1d20e0){logger[_0xade1('0x3b')](_0x1d20e0[_0xade1('0x43')]);return _0x31a2bd(_0x55bcdf[_0xade1('0x3b')](0x1f4,_0x1d20e0));}}logger['error']('message\x20is\x20empty');return _0x31a2bd(_0x55bcdf[_0xade1('0x3b')](0x1f4,_0xade1('0x4c')));});},'AgentCapacity':function(_0x58b11c){var _0x59448a=this;return new Promise(function(_0x24d711,_0x5af858){if(_0x525f90[_0xade1('0x46')][_0xade1('0x4e')](_0x58b11c['id'])){for(var _0x1ad53a in _0x58b11c[_0xade1('0x4f')]){if(_0x58b11c[_0xade1('0x4f')]['hasOwnProperty'](_0x1ad53a)){if(_0x525f90['agents'][_0x58b11c['id']][_0xade1('0x4e')](_0x1ad53a+_0xade1('0x50'))){_0x525f90[_0xade1('0x46')][_0x58b11c['id']][_0x1ad53a+_0xade1('0x50')]=parseInt(_0x58b11c['capacity'][_0x1ad53a],0xa);}}}_0x525f90[_0xade1('0x46')][_0x58b11c['id']][_0xade1('0x51')]();return _0x24d711({'code':0xc8,'message':_0x525f90[_0xade1('0x46')][_0x58b11c['id']]});}else{return _0x5af858(_0x59448a[_0xade1('0x3b')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2ee211){return new Promise(function(_0x60145){var _0x6d30af=_[_0xade1('0x52')](_0x525f90[_0xade1('0x46')]);if(_0x2ee211&&_0x2ee211['id']){var _0x428c35=_['find'](_0x6d30af,function(_0x238710){return _0x238710['id']===_0x2ee211['id'];});_0x60145(_0x428c35);}else{_0x60145({'count':_0x6d30af['length'],'rows':_0x6d30af});}});},'ChatQueues':function(){return new Promise(function(_0x338c39){var _0xe88d7f=[];for(var _0x564199 in _0x525f90[_0xade1('0x53')]){if(_0x525f90['chatQueues']['hasOwnProperty'](_0x564199)){var _0x2ba79d=_0x525f90[_0xade1('0x53')][_0x564199];var _0x2e9814={'id':_0x2ba79d['id'],'available':_0x2ba79d[_0xade1('0x54')],'loggedIn':_0x2ba79d['loggedIn'],'name':_0x2ba79d[_0xade1('0x55')],'paused':_0x2ba79d['paused'],'waiting':_0x2ba79d['waiting']};_0xe88d7f[_0xade1('0x26')](_0x2e9814);}}_0x338c39({'count':_0xe88d7f[_0xade1('0x1e')],'rows':_0xe88d7f});});},'MailQueues':function(){return new Promise(function(_0x2f85fa){var _0x18efd1=[];for(var _0x2f0c5b in _0x525f90[_0xade1('0x56')]){if(_0x525f90[_0xade1('0x56')][_0xade1('0x4e')](_0x2f0c5b)){var _0x1ebf91=_0x525f90[_0xade1('0x56')][_0x2f0c5b];var _0x560b9d={'id':_0x1ebf91['id'],'available':_0x1ebf91['available'],'loggedIn':_0x1ebf91['loggedIn'],'name':_0x1ebf91[_0xade1('0x55')],'paused':_0x1ebf91[_0xade1('0x57')],'waiting':_0x1ebf91['waiting']};_0x18efd1[_0xade1('0x26')](_0x560b9d);}}_0x2f85fa({'count':_0x18efd1[_0xade1('0x1e')],'rows':_0x18efd1});});},'OpenchannelQueues':function(){return new Promise(function(_0x17fcb6){var _0x59ff15=[];for(var _0x57355e in _0x525f90[_0xade1('0x58')]){if(_0x525f90['openchannelQueues'][_0xade1('0x4e')](_0x57355e)){var _0x4a8a49=_0x525f90[_0xade1('0x58')][_0x57355e];var _0x5ccf23={'id':_0x4a8a49['id'],'available':_0x4a8a49[_0xade1('0x54')],'loggedIn':_0x4a8a49[_0xade1('0x59')],'name':_0x4a8a49[_0xade1('0x55')],'paused':_0x4a8a49[_0xade1('0x57')],'waiting':_0x4a8a49[_0xade1('0x5a')]};_0x59ff15['push'](_0x5ccf23);}}_0x17fcb6({'count':_0x59ff15[_0xade1('0x1e')],'rows':_0x59ff15});});},'SmsQueues':function(){return new Promise(function(_0x1f45b0){var _0x250fda=[];for(var _0x92fa28 in _0x525f90[_0xade1('0x5b')]){if(_0x525f90[_0xade1('0x5b')][_0xade1('0x4e')](_0x92fa28)){var _0x1a925a=_0x525f90[_0xade1('0x5b')][_0x92fa28];var _0x29aecc={'id':_0x1a925a['id'],'available':_0x1a925a[_0xade1('0x54')],'loggedIn':_0x1a925a[_0xade1('0x59')],'name':_0x1a925a[_0xade1('0x55')],'paused':_0x1a925a[_0xade1('0x57')],'waiting':_0x1a925a[_0xade1('0x5a')]};_0x250fda['push'](_0x29aecc);}}_0x1f45b0({'count':_0x250fda['length'],'rows':_0x250fda});});},'FaxQueues':function(){return new Promise(function(_0x20d5a8){var _0x44d897=[];for(var _0x47bd65 in _0x525f90[_0xade1('0x5c')]){if(_0x525f90[_0xade1('0x5c')]['hasOwnProperty'](_0x47bd65)){var _0x202d04=_0x525f90[_0xade1('0x5c')][_0x47bd65];var _0x32603e={'id':_0x202d04['id'],'available':_0x202d04[_0xade1('0x54')],'loggedIn':_0x202d04['loggedIn'],'name':_0x202d04[_0xade1('0x55')],'paused':_0x202d04[_0xade1('0x57')],'waiting':_0x202d04[_0xade1('0x5a')]};_0x44d897[_0xade1('0x26')](_0x32603e);}}_0x20d5a8({'count':_0x44d897[_0xade1('0x1e')],'rows':_0x44d897});});},'WhatsappQueues':function(){return new Promise(function(_0x38ab12){var _0x51af1a=[];for(var _0x4654e5 in _0x525f90[_0xade1('0x5d')]){if(_0x525f90[_0xade1('0x5d')][_0xade1('0x4e')](_0x4654e5)){var _0x49989a=_0x525f90['whatsappQueues'][_0x4654e5];var _0xb22dc={'id':_0x49989a['id'],'available':_0x49989a[_0xade1('0x54')],'loggedIn':_0x49989a[_0xade1('0x59')],'name':_0x49989a[_0xade1('0x55')],'paused':_0x49989a[_0xade1('0x57')],'waiting':_0x49989a[_0xade1('0x5a')]};_0x51af1a['push'](_0xb22dc);}}_0x38ab12({'count':_0x51af1a['length'],'rows':_0x51af1a});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x551f2c){var _0x1dd121=_[_0xade1('0x52')](_0x525f90[_0xade1('0x5e')]);_0x551f2c({'count':_0x1dd121[_0xade1('0x1e')],'rows':_0x1dd121});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x517c06){var _0x31a854=_['values'](_0x525f90[_0xade1('0x5f')]);_0x517c06({'count':_0x31a854[_0xade1('0x1e')],'rows':_0x31a854});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x87a7f6){var _0x2b2254=_['values'](_0x525f90[_0xade1('0x60')]);_0x87a7f6({'count':_0x2b2254['length'],'rows':_0x2b2254});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x507e57){var _0x53fdda=_['values'](_0x525f90['smsQueuesWaitingInteractions']);_0x507e57({'count':_0x53fdda[_0xade1('0x1e')],'rows':_0x53fdda});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2630e3){var _0x28ff06=_[_0xade1('0x52')](_0x525f90['faxQueuesWaitingInteractions']);_0x2630e3({'count':_0x28ff06['length'],'rows':_0x28ff06});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x56a917){var _0x22d32f=_[_0xade1('0x52')](_0x525f90[_0xade1('0x61')]);_0x56a917({'count':_0x22d32f['length'],'rows':_0x22d32f});});}};var _0x13a12a=jayson[_0xade1('0x62')](_0x10773d)[_0xade1('0x63')]();_0x13a12a['on'](_0xade1('0x3b'),function(_0x3e9264){logger[_0xade1('0x3b')](JSON[_0xade1('0x3e')](_0x3e9264));return _0xf881e1(_0x3e9264);});_0x13a12a[_0xade1('0x15')](0x232c,_0xade1('0x64'),function(){console[_0xade1('0x65')](_0xade1('0x66'),0x232c);return _0x13dda2('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x6b1b=['dialogflow','dialogflowv2','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','format','%s:%s:%s','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','waiting','mailQueues','openchannelQueues','paused','smsQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','rules','channel','message','interaction','transfer','applications','isArray','length','join','.js','app','toLowerCase','autoreply','appdata','split','mail','push','slice'];(function(_0x43989e,_0x385756){var _0x183a83=function(_0x36c13b){while(--_0x36c13b){_0x43989e['push'](_0x43989e['shift']());}};_0x183a83(++_0x385756);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x6b1b[_0x298ed3];return _0x5aad28;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var path=require(_0xb6b1('0x1'));var fs=require('fs');var jayson=require(_0xb6b1('0x2'));var BPromise=require('bluebird');var utils=require(_0xb6b1('0x3'));var sUtils=require(_0xb6b1('0x4'));var logger=require(_0xb6b1('0x5'))(_0xb6b1('0x6'));var rpc={'openchannelQueueReport':require(_0xb6b1('0x7')),'mailQueueReport':require(_0xb6b1('0x8')),'chatQueueReport':require(_0xb6b1('0x9')),'smsQueueReport':require(_0xb6b1('0xa')),'faxQueueReport':require(_0xb6b1('0xb')),'whatsappQueueReport':require(_0xb6b1('0xc'))};var RuleEngine=require(_0xb6b1('0xd'));function getId(_0x5b440a,_0x2734cc,_0x52aa76){return util['format'](_0xb6b1('0xe'),_0x5b440a,_0x2734cc||0x0,_0x52aa76||0x0);}function getIntervals(_0x58027c,_0xcb40e1){var _0x540238=[];if(!_['isNil'](_0xcb40e1['IntervalId'])&&!_['isNil'](_0x58027c[_0xcb40e1[_0xb6b1('0xf')]])&&!_[_0xb6b1('0x10')](_0x58027c[_0xcb40e1['IntervalId']][_0xb6b1('0x11')])){_0x540238=_['map'](_0x58027c[_0xcb40e1['IntervalId']][_0xb6b1('0x11')],_0xb6b1('0x12'));}else if(!_[_0xb6b1('0x10')](_0xcb40e1[_0xb6b1('0x12')])){_0x540238=[_0xcb40e1[_0xb6b1('0x12')]];}return _0x540238;}exports[_0xb6b1('0x13')]=function(_0x360fc7){_0x360fc7[_0xb6b1('0x14')]={};return new BPromise(function(_0x2a4d72,_0x218c98){var _0x2629db={'Start':function(_0x14fef6){var _0x4f770a=this;return new Promise(function(_0x57572a,_0x513207){if(_0x14fef6){try{var _0x51f25f=[];var _0xee229d=getId(_0x14fef6[_0xb6b1('0x15')],_0x14fef6[_0xb6b1('0x16')]?_0x14fef6[_0xb6b1('0x16')]['id']:0x0,_0x14fef6[_0xb6b1('0x17')]?_0x14fef6[_0xb6b1('0x17')]['id']:0x0);var _0x47a204=sUtils['checkWaitingNotifications'](_0x360fc7,_0x14fef6);if(_0x14fef6[_0xb6b1('0x18')]||!_0x47a204&&_0x14fef6[_0xb6b1('0x19')]&&_[_0xb6b1('0x1a')](_0x14fef6[_0xb6b1('0x19')])&&_0x14fef6[_0xb6b1('0x19')][_0xb6b1('0x1b')]){for(var _0x5ba14d=0x0;_0x5ba14d<_0x14fef6['applications'][_0xb6b1('0x1b')];_0x5ba14d+=0x1){var _0x1067ea=_0x14fef6['applications'][_0x5ba14d];if(fs['existsSync'](path[_0xb6b1('0x1c')](__dirname,'applications',_0x1067ea['app']+_0xb6b1('0x1d')))){var _0x2086ea=[];switch(_0x1067ea[_0xb6b1('0x1e')][_0xb6b1('0x1f')]()){case _0xb6b1('0x20'):var _0x3d0864=_0x1067ea[_0xb6b1('0x21')][_0xb6b1('0x22')](',');if(_0x14fef6[_0xb6b1('0x15')]===_0xb6b1('0x23')){_0x2086ea['push'](_0x3d0864[0x0]);_0x2086ea[_0xb6b1('0x24')](_0x3d0864[0x1]);_0x2086ea['push'](_0x3d0864[_0xb6b1('0x25')](0x2,_0x3d0864['length'])[_0xb6b1('0x1c')](','));}else{_0x2086ea['push'](_0x3d0864[0x0]);_0x2086ea[_0xb6b1('0x24')](_0x3d0864[_0xb6b1('0x25')](0x1,_0x3d0864[_0xb6b1('0x1b')])[_0xb6b1('0x1c')](','));}break;case _0xb6b1('0x26'):var _0x188627=_0x1067ea[_0xb6b1('0x21')][_0xb6b1('0x22')](',');_0x2086ea[_0xb6b1('0x24')](_0x188627[0x0]);_0x2086ea['push'](_0x188627[0x1]);_0x2086ea[_0xb6b1('0x24')](_0x188627['slice'](0x2,_0x188627[_0xb6b1('0x1b')])[_0xb6b1('0x1c')](','));break;case _0xb6b1('0x27'):var _0x3f8849=_0x1067ea[_0xb6b1('0x21')][_0xb6b1('0x22')](',');_0x2086ea[_0xb6b1('0x24')](_0x3f8849[0x0]);_0x2086ea['push'](_0x3f8849[0x1]);_0x2086ea[_0xb6b1('0x24')](_0x3f8849[0x2]);_0x2086ea[_0xb6b1('0x24')](_0x3f8849[0x3]);_0x2086ea[_0xb6b1('0x24')](_0x3f8849['slice'](0x4,_0x3f8849[_0xb6b1('0x1b')])[_0xb6b1('0x1c')](','));break;case'amazonlex':var _0x3efb1d=_0x1067ea[_0xb6b1('0x21')][_0xb6b1('0x22')](',');_0x2086ea[_0xb6b1('0x24')](_0x3efb1d[0x0]);_0x2086ea[_0xb6b1('0x24')](_0x3efb1d[0x1]);_0x2086ea[_0xb6b1('0x24')](_0x3efb1d[0x2]);_0x2086ea['push'](_0x3efb1d[0x3]);_0x2086ea[_0xb6b1('0x24')](_0x3efb1d[_0xb6b1('0x25')](0x4,_0x3efb1d['length'])[_0xb6b1('0x1c')](','));break;case'message':_0x2086ea[_0xb6b1('0x24')](_0x1067ea[_0xb6b1('0x21')]);break;case _0xb6b1('0x28'):_0x2086ea[_0xb6b1('0x24')](_0x1067ea[_0xb6b1('0x29')]);_0x2086ea[_0xb6b1('0x24')](_0x1067ea['appdata']);break;case _0xb6b1('0x2a'):var _0x41b6c4=utils[_0xb6b1('0x2b')](_0x14fef6[_0xb6b1('0x2c')]['notificationTemplate'],_0x14fef6);var _0x56f1ff=_0x1067ea['appdata'][_0xb6b1('0x22')](',');_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x0]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x1]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x2]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x3]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x4]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x5]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x6]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x7]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x8]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0x9]);_0x2086ea[_0xb6b1('0x24')](_0x56f1ff[0xa]);_0x2086ea['push'](_0x14fef6[_0xb6b1('0x17')]['id']);_0x2086ea[_0xb6b1('0x24')](_0x14fef6[_0xb6b1('0x16')]['id']);_0x2086ea[_0xb6b1('0x24')](_0x1067ea[_0xb6b1('0x2d')]);_0x2086ea[_0xb6b1('0x24')](_0x14fef6[_0xb6b1('0x17')][_0xb6b1('0x2e')]);_0x2086ea[_0xb6b1('0x24')](_0x14fef6[_0xb6b1('0x2f')][_0xb6b1('0x2f')]);_0x2086ea['push'](_0x41b6c4);break;default:_0x2086ea=_[_0xb6b1('0x10')](_0x1067ea[_0xb6b1('0x21')])?[]:_0x1067ea[_0xb6b1('0x21')][_0xb6b1('0x22')](',');}var _0x2149af={'id':util[_0xb6b1('0x30')](_0xb6b1('0x31'),_0xee229d,_0x1067ea['id'],_0x1067ea[_0xb6b1('0x1e')]),'condition':require('./interval')['condition'](_0xee229d,getIntervals(_0x360fc7[_0xb6b1('0x32')],_0x1067ea),_0x360fc7),'consequence':require(_0xb6b1('0x33')+_0x1067ea[_0xb6b1('0x1e')])['consequence'](_0xee229d,_0x2086ea,_0x360fc7,_0x14fef6),'p':_0x1067ea[_0xb6b1('0x34')]||0x0};logger[_0xb6b1('0x35')](_0xb6b1('0x36'),_0x2149af['id'],_0xb6b1('0x37'),getIntervals(_0x360fc7[_0xb6b1('0x32')],_0x1067ea)[_0xb6b1('0x1c')](_0xb6b1('0x38')));_0x51f25f[_0xb6b1('0x24')](_0x2149af);}else{logger['error'](_0xb6b1('0x39'),path['join'](__dirname,_0xb6b1('0x19'),_0x1067ea[_0xb6b1('0x1e')]+_0xb6b1('0x1d')));}}_0x360fc7[_0xb6b1('0x14')][_0xee229d]=new RuleEngine(_0x51f25f);_0x360fc7[_0xb6b1('0x14')][_0xee229d][_0xb6b1('0x3a')](_0x14fef6,function(_0x571214){logger[_0xb6b1('0x35')](_0xb6b1('0x3b'),JSON['stringify'](_0x571214[_0xb6b1('0x3c')]));if(_0x360fc7['rules'][_0xee229d]){_0x360fc7[_0xb6b1('0x14')][_0xee229d][_0xb6b1('0x3d')](_0xb6b1('0x3e'));}});return _0x57572a({'code':0xc8,'message':_0x14fef6});}else{if(_0x47a204){logger[_0xb6b1('0x35')](util[_0xb6b1('0x30')](_0xb6b1('0x3f'),_0xee229d));}else{logger[_0xb6b1('0x35')](_0xb6b1('0x40'));}return _0x57572a({'code':0xc8,'message':_0x14fef6});}}catch(_0x1d5b09){logger['error'](_0x1d5b09['stack']);return _0x513207(_0x4f770a[_0xb6b1('0x41')](0x1f4,_0x1d5b09));}}return _0x513207(_0xb6b1('0x42'));});},'AcceptMessage':function(_0x5959ca){var _0x29cf46=this;return new Promise(function(_0x185de9,_0x6f7b41){if(_0x5959ca[_0xb6b1('0x43')]&&_0x5959ca[_0xb6b1('0x43')]['id']){if(_0x360fc7['agents'][_0x5959ca[_0xb6b1('0x43')]['id']]){_0x360fc7[_0xb6b1('0x44')][_0x5959ca[_0xb6b1('0x43')]['id']][_0xb6b1('0x45')]=![];_0x360fc7['agents'][_0x5959ca['agent']['id']][_0xb6b1('0x46')]=undefined;}}if(_0x5959ca['message']&&_0x5959ca[_0xb6b1('0x16')]['id']){try{var _0x3f09dc=getId(_0x5959ca['channel'],_0x5959ca[_0xb6b1('0x16')]?_0x5959ca['message']['id']:0x0,_0x5959ca[_0xb6b1('0x17')]?_0x5959ca[_0xb6b1('0x17')]['id']:0x0);if(_0x360fc7[_0xb6b1('0x14')][_0x3f09dc]){_0x360fc7[_0xb6b1('0x14')][_0x3f09dc][_0xb6b1('0x3d')](_0xb6b1('0x47'));if(rpc[_0x5959ca[_0xb6b1('0x15')]+_0xb6b1('0x48')]){rpc[_0x5959ca[_0xb6b1('0x15')]+_0xb6b1('0x48')]['update'](_0x3f09dc,{'UserId':_0x5959ca[_0xb6b1('0x16')][_0xb6b1('0x49')]})[_0xb6b1('0x4a')](function(){logger[_0xb6b1('0x41')](_0xb6b1('0x4b'));});}}return _0x185de9({'code':0xc8,'message':_0x5959ca});}catch(_0x118ec3){logger[_0xb6b1('0x41')](_0x118ec3[_0xb6b1('0x4c')]);return _0x6f7b41(_0x29cf46[_0xb6b1('0x41')](0x1f4,_0x118ec3));}}logger['error'](_0xb6b1('0x4d'));return _0x6f7b41(_0x29cf46['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1a76b5){var _0x2123f5=this;return new Promise(function(_0x5be7bf,_0x3b482b){if(_0x1a76b5[_0xb6b1('0x43')]&&_0x1a76b5[_0xb6b1('0x43')]['id']){try{if(_0x360fc7['agents'][_0x1a76b5[_0xb6b1('0x43')]['id']]){_0x360fc7['agents'][_0x1a76b5['agent']['id']][_0xb6b1('0x45')]=![];_0x360fc7[_0xb6b1('0x44')][_0x1a76b5['agent']['id']]['busyQueue']=undefined;}return _0x5be7bf({'code':0xc8,'message':_0x1a76b5});}catch(_0x5dfee0){logger[_0xb6b1('0x41')](_0x5dfee0['stack']);return _0x3b482b(_0x2123f5['error'](0x1f4,_0x5dfee0));}}logger['error'](_0xb6b1('0x4d'));return _0x3b482b(_0x2123f5[_0xb6b1('0x41')](0x1f4,_0xb6b1('0x4d')));});},'AbandonInteraction':function(_0x18bfa9){var _0x91a20e=this;return new Promise(function(_0x3e441e,_0x4efa6f){if(_0x18bfa9[_0xb6b1('0x15')]&&_0x18bfa9[_0xb6b1('0x17')]&&_0x18bfa9['interaction']['id']){try{var _0x5cf2bf=getId(_0x18bfa9[_0xb6b1('0x15')],_0x18bfa9[_0xb6b1('0x16')]?_0x18bfa9['message']['id']:0x0,_0x18bfa9['interaction']?_0x18bfa9[_0xb6b1('0x17')]['id']:0x0);if(_0x360fc7['rules'][_0x5cf2bf]){_0x360fc7[_0xb6b1('0x14')][_0x5cf2bf][_0xb6b1('0x3d')]('end');}return _0x3e441e({'code':0xc8,'message':_0x18bfa9});}catch(_0x14add3){logger[_0xb6b1('0x41')](_0x14add3[_0xb6b1('0x4c')]);return _0x4efa6f(_0x91a20e[_0xb6b1('0x41')](0x1f4,_0x14add3));}}logger[_0xb6b1('0x41')](_0xb6b1('0x4d'));return _0x4efa6f(_0x91a20e[_0xb6b1('0x41')](0x1f4,_0xb6b1('0x4d')));});},'AgentCapacity':function(_0x10ef87){var _0x1dd8b7=this;return new Promise(function(_0x4de50b,_0x1d6dc1){if(_0x360fc7[_0xb6b1('0x44')][_0xb6b1('0x4e')](_0x10ef87['id'])){for(var _0xbd61f1 in _0x10ef87['capacity']){if(_0x10ef87[_0xb6b1('0x4f')][_0xb6b1('0x4e')](_0xbd61f1)){if(_0x360fc7[_0xb6b1('0x44')][_0x10ef87['id']][_0xb6b1('0x4e')](_0xbd61f1+_0xb6b1('0x50'))){_0x360fc7[_0xb6b1('0x44')][_0x10ef87['id']][_0xbd61f1+_0xb6b1('0x50')]=parseInt(_0x10ef87['capacity'][_0xbd61f1],0xa);}}}_0x360fc7['agents'][_0x10ef87['id']][_0xb6b1('0x51')]();return _0x4de50b({'code':0xc8,'message':_0x360fc7['agents'][_0x10ef87['id']]});}else{return _0x1d6dc1(_0x1dd8b7[_0xb6b1('0x41')](0x1f4,_0xb6b1('0x52')));}});},'Agents':function(_0x280ce9){return new Promise(function(_0x4bd083){var _0x1198d3=_[_0xb6b1('0x53')](_0x360fc7[_0xb6b1('0x44')]);if(_0x280ce9&&_0x280ce9['id']){var _0x24100e=_[_0xb6b1('0x54')](_0x1198d3,function(_0x48791c){return _0x48791c['id']===_0x280ce9['id'];});_0x4bd083(_0x24100e);}else{_0x4bd083({'count':_0x1198d3['length'],'rows':_0x1198d3});}});},'ChatQueues':function(){return new Promise(function(_0x11e94e){var _0xf9363=[];for(var _0x872397 in _0x360fc7[_0xb6b1('0x55')]){if(_0x360fc7[_0xb6b1('0x55')][_0xb6b1('0x4e')](_0x872397)){var _0x340c8e=_0x360fc7[_0xb6b1('0x55')][_0x872397];var _0x1d38a6={'id':_0x340c8e['id'],'available':_0x340c8e[_0xb6b1('0x56')],'loggedIn':_0x340c8e[_0xb6b1('0x57')],'name':_0x340c8e[_0xb6b1('0x58')],'paused':_0x340c8e['paused'],'waiting':_0x340c8e[_0xb6b1('0x59')]};_0xf9363['push'](_0x1d38a6);}}_0x11e94e({'count':_0xf9363[_0xb6b1('0x1b')],'rows':_0xf9363});});},'MailQueues':function(){return new Promise(function(_0x44a5a2){var _0xc831ce=[];for(var _0x5720bf in _0x360fc7[_0xb6b1('0x5a')]){if(_0x360fc7['mailQueues']['hasOwnProperty'](_0x5720bf)){var _0x438778=_0x360fc7['mailQueues'][_0x5720bf];var _0x462175={'id':_0x438778['id'],'available':_0x438778[_0xb6b1('0x56')],'loggedIn':_0x438778['loggedIn'],'name':_0x438778[_0xb6b1('0x58')],'paused':_0x438778['paused'],'waiting':_0x438778[_0xb6b1('0x59')]};_0xc831ce[_0xb6b1('0x24')](_0x462175);}}_0x44a5a2({'count':_0xc831ce[_0xb6b1('0x1b')],'rows':_0xc831ce});});},'OpenchannelQueues':function(){return new Promise(function(_0x53a85e){var _0x309982=[];for(var _0x4ef26a in _0x360fc7[_0xb6b1('0x5b')]){if(_0x360fc7[_0xb6b1('0x5b')][_0xb6b1('0x4e')](_0x4ef26a)){var _0xa740a5=_0x360fc7['openchannelQueues'][_0x4ef26a];var _0x3b1036={'id':_0xa740a5['id'],'available':_0xa740a5[_0xb6b1('0x56')],'loggedIn':_0xa740a5[_0xb6b1('0x57')],'name':_0xa740a5[_0xb6b1('0x58')],'paused':_0xa740a5[_0xb6b1('0x5c')],'waiting':_0xa740a5[_0xb6b1('0x59')]};_0x309982['push'](_0x3b1036);}}_0x53a85e({'count':_0x309982[_0xb6b1('0x1b')],'rows':_0x309982});});},'SmsQueues':function(){return new Promise(function(_0x26fbd8){var _0x9fa359=[];for(var _0x42d3c7 in _0x360fc7['smsQueues']){if(_0x360fc7[_0xb6b1('0x5d')][_0xb6b1('0x4e')](_0x42d3c7)){var _0x4a032e=_0x360fc7['smsQueues'][_0x42d3c7];var _0x579dde={'id':_0x4a032e['id'],'available':_0x4a032e['available'],'loggedIn':_0x4a032e[_0xb6b1('0x57')],'name':_0x4a032e[_0xb6b1('0x58')],'paused':_0x4a032e[_0xb6b1('0x5c')],'waiting':_0x4a032e[_0xb6b1('0x59')]};_0x9fa359[_0xb6b1('0x24')](_0x579dde);}}_0x26fbd8({'count':_0x9fa359[_0xb6b1('0x1b')],'rows':_0x9fa359});});},'FaxQueues':function(){return new Promise(function(_0x31b0df){var _0x59a672=[];for(var _0x1784ab in _0x360fc7['faxQueues']){if(_0x360fc7['faxQueues'][_0xb6b1('0x4e')](_0x1784ab)){var _0x28213e=_0x360fc7['faxQueues'][_0x1784ab];var _0x5ca38b={'id':_0x28213e['id'],'available':_0x28213e[_0xb6b1('0x56')],'loggedIn':_0x28213e[_0xb6b1('0x57')],'name':_0x28213e[_0xb6b1('0x58')],'paused':_0x28213e[_0xb6b1('0x5c')],'waiting':_0x28213e['waiting']};_0x59a672[_0xb6b1('0x24')](_0x5ca38b);}}_0x31b0df({'count':_0x59a672[_0xb6b1('0x1b')],'rows':_0x59a672});});},'WhatsappQueues':function(){return new Promise(function(_0x5ebb82){var _0x4e823b=[];for(var _0x10461d in _0x360fc7[_0xb6b1('0x5e')]){if(_0x360fc7[_0xb6b1('0x5e')][_0xb6b1('0x4e')](_0x10461d)){var _0x12bcf3=_0x360fc7[_0xb6b1('0x5e')][_0x10461d];var _0x17b225={'id':_0x12bcf3['id'],'available':_0x12bcf3[_0xb6b1('0x56')],'loggedIn':_0x12bcf3[_0xb6b1('0x57')],'name':_0x12bcf3['name'],'paused':_0x12bcf3[_0xb6b1('0x5c')],'waiting':_0x12bcf3['waiting']};_0x4e823b[_0xb6b1('0x24')](_0x17b225);}}_0x5ebb82({'count':_0x4e823b[_0xb6b1('0x1b')],'rows':_0x4e823b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x33ea1a){var _0x500945=_[_0xb6b1('0x53')](_0x360fc7[_0xb6b1('0x5f')]);_0x33ea1a({'count':_0x500945['length'],'rows':_0x500945});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x37c3e6){var _0x588390=_['values'](_0x360fc7[_0xb6b1('0x60')]);_0x37c3e6({'count':_0x588390['length'],'rows':_0x588390});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x95c84b){var _0x58da6c=_[_0xb6b1('0x53')](_0x360fc7[_0xb6b1('0x61')]);_0x95c84b({'count':_0x58da6c[_0xb6b1('0x1b')],'rows':_0x58da6c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xc27ba8){var _0x3765ca=_['values'](_0x360fc7[_0xb6b1('0x62')]);_0xc27ba8({'count':_0x3765ca[_0xb6b1('0x1b')],'rows':_0x3765ca});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1fee56){var _0x45574e=_[_0xb6b1('0x53')](_0x360fc7[_0xb6b1('0x63')]);_0x1fee56({'count':_0x45574e[_0xb6b1('0x1b')],'rows':_0x45574e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1936d4){var _0x8e1139=_[_0xb6b1('0x53')](_0x360fc7[_0xb6b1('0x64')]);_0x1936d4({'count':_0x8e1139[_0xb6b1('0x1b')],'rows':_0x8e1139});});}};var _0x523035=jayson[_0xb6b1('0x65')](_0x2629db)[_0xb6b1('0x66')]();_0x523035['on']('error',function(_0x22ebac){logger[_0xb6b1('0x41')](JSON['stringify'](_0x22ebac));return _0x218c98(_0x22ebac);});_0x523035[_0xb6b1('0x13')](0x232c,'127.0.0.1',function(){console[_0xb6b1('0x67')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2a4d72(_0xb6b1('0x68')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 6b066f0..817204b 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 _0xb101=['rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','message','indexOf','true','[%s][INTERVAL]\x20%s','some','info','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','stack','util','bluebird','lodash','../../../config/logger','routing','client','http','request','then','error','catch','condition'];(function(_0x232584,_0xc96043){var _0x482bf3=function(_0x311c81){while(--_0x311c81){_0x232584['push'](_0x232584['shift']());}};_0x482bf3(++_0xc96043);}(_0xb101,0xa2));var _0x1b10=function(_0x46fae9,_0x1b8ebd){_0x46fae9=_0x46fae9-0x0;var _0x55319c=_0xb101[_0x46fae9];return _0x55319c;};'use strict';var util=require(_0x1b10('0x0'));var BPromise=require(_0x1b10('0x1'));var jayson=require('jayson/promise');var _=require(_0x1b10('0x2'));var logger=require(_0x1b10('0x3'))(_0x1b10('0x4'));var client=jayson[_0x1b10('0x5')][_0x1b10('0x6')]({'port':0x232a});function request(_0x3ff246,_0x17760a){return new BPromise(function(_0x232439,_0x3e6d91){return client[_0x1b10('0x7')](_0x3ff246,_0x17760a)[_0x1b10('0x8')](function(_0x17e310){if(_0x17e310[_0x1b10('0x9')]){return _0x3e6d91(_0x17e310[_0x1b10('0x9')]['message']);}else{return _0x232439(_0x17e310['result']);}})[_0x1b10('0xa')](function(_0x116d17){return _0x3e6d91(_0x116d17);});});}exports[_0x1b10('0xb')]=function(_0x2ab9be,_0x5ec3ee,_0x4c4c26){return function(_0x4ae415){if(_0x4c4c26[_0x1b10('0xc')]&&!_0x4c4c26[_0x1b10('0xc')][_0x2ab9be]){logger['info'](_0x1b10('0xd'),_0x2ab9be);return _0x4ae415[_0x1b10('0xe')]();}var _0x59231f=[];for(var _0x28a4ac=0x0;_0x28a4ac<_0x5ec3ee[_0x1b10('0xf')];_0x28a4ac+=0x1){_0x59231f[_0x1b10('0x10')](request(_0x1b10('0x11'),{'command':util['format']('iftime\x20%s',_0x5ec3ee[_0x28a4ac])})[_0x1b10('0x8')](function(_0x16d72a){return _0x16d72a&&_0x16d72a[_0x1b10('0x12')]&&_0x16d72a[_0x1b10('0x12')][_0x1b10('0x13')](_0x1b10('0x14'))>=0x0?!![]:![];})[_0x1b10('0xa')](function(){logger[_0x1b10('0x9')](_0x1b10('0x15'),_0x2ab9be,_0x5ec3ee[_0x28a4ac]);}));}BPromise['all'](_0x59231f)['then'](function(_0x20e787){var _0x5477f2=_[_0x1b10('0x16')](_0x20e787);logger[_0x1b10('0x17')](_0x1b10('0x18'),_0x2ab9be,_0x5ec3ee['join'](_0x1b10('0x19')),_0x5477f2);_0x4ae415[_0x1b10('0x1a')](_0x5477f2);})[_0x1b10('0xa')](function(_0x19eaf8){logger[_0x1b10('0x9')](_0x1b10('0x18'),_0x2ab9be,_0x5ec3ee[_0x1b10('0x1b')](_0x1b10('0x19')),_0x19eaf8[_0x1b10('0x1c')]);_0x4ae415[_0x1b10('0xe')]();});};}; \ No newline at end of file +var _0x8065=['[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','[%s][INTERVAL]\x20%s','all','some','join','when'];(function(_0x20ae2b,_0x1ac40f){var _0xaa6583=function(_0x3d8370){while(--_0x3d8370){_0x20ae2b['push'](_0x20ae2b['shift']());}};_0xaa6583(++_0x1ac40f);}(_0x8065,0x11b));var _0x5806=function(_0x2db432,_0x1713f5){_0x2db432=_0x2db432-0x0;var _0x515b43=_0x8065[_0x2db432];return _0x515b43;};'use strict';var util=require(_0x5806('0x0'));var BPromise=require(_0x5806('0x1'));var jayson=require(_0x5806('0x2'));var _=require(_0x5806('0x3'));var logger=require('../../../config/logger')('routing');var client=jayson['client'][_0x5806('0x4')]({'port':0x232a});function request(_0x22c651,_0x3b8b9b){return new BPromise(function(_0x22dd2d,_0x17b587){return client[_0x5806('0x5')](_0x22c651,_0x3b8b9b)[_0x5806('0x6')](function(_0x4576dc){if(_0x4576dc[_0x5806('0x7')]){return _0x17b587(_0x4576dc[_0x5806('0x7')][_0x5806('0x8')]);}else{return _0x22dd2d(_0x4576dc[_0x5806('0x9')]);}})[_0x5806('0xa')](function(_0x1c31f8){return _0x17b587(_0x1c31f8);});});}exports[_0x5806('0xb')]=function(_0x3b6250,_0x125b22,_0x94098e){return function(_0x40492e){if(_0x94098e[_0x5806('0xc')]&&!_0x94098e[_0x5806('0xc')][_0x3b6250]){logger[_0x5806('0xd')](_0x5806('0xe'),_0x3b6250);return _0x40492e[_0x5806('0xf')]();}var _0x1f6b28=[];for(var _0x2117b8=0x0;_0x2117b8<_0x125b22[_0x5806('0x10')];_0x2117b8+=0x1){_0x1f6b28['push'](request(_0x5806('0x11'),{'command':util[_0x5806('0x12')](_0x5806('0x13'),_0x125b22[_0x2117b8])})[_0x5806('0x6')](function(_0x544562){return _0x544562&&_0x544562[_0x5806('0x8')]&&_0x544562[_0x5806('0x8')]['indexOf']('true')>=0x0?!![]:![];})[_0x5806('0xa')](function(){logger[_0x5806('0x7')](_0x5806('0x14'),_0x3b6250,_0x125b22[_0x2117b8]);}));}BPromise[_0x5806('0x15')](_0x1f6b28)['then'](function(_0x2289b3){var _0x3390fe=_[_0x5806('0x16')](_0x2289b3);logger[_0x5806('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x3b6250,_0x125b22[_0x5806('0x17')]('\x20|\x20'),_0x3390fe);_0x40492e[_0x5806('0x18')](_0x3390fe);})[_0x5806('0xa')](function(_0x5a19d5){logger[_0x5806('0x7')](_0x5806('0x19'),_0x3b6250,_0x125b22['join'](_0x5806('0x1a')),_0x5a19d5[_0x5806('0x1b')]);_0x40492e[_0x5806('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 967d252..e59c93e 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 _0x5b02=['ringtime','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','talktime','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','util','./utils','format','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5b02,0xe9));var _0x25b0=function(_0x41512a,_0xf682f2){_0x41512a=_0x41512a-0x0;var _0x2cd99c=_0x5b02[_0x41512a];return _0x2cd99c;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var utils=require(_0x25b0('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1c3295,_0x4ef71c){utils['info'](util[_0x25b0('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1c3295[_0x25b0('0x4')],_0x1c3295[_0x25b0('0x5')],_0x1c3295[_0x25b0('0x6')],_0x1c3295[_0x25b0('0x7')],_0x1c3295[_0x25b0('0x8')],_0x1c3295['calleridnum'],_0x1c3295[_0x25b0('0x9')],_0x1c3295[_0x25b0('0xa')]));if(_0x1c3295['queue']){utils[_0x25b0('0xb')](_0x1c3295['queue'])['then'](function(_0x24f98b){if(_0x24f98b){_0x1c3295[_0x25b0('0xc')]=_0x24f98b[_0x25b0('0xc')];_0x1c3295['agentacw']=_0x1c3295[_0x25b0('0xd')]?_0x24f98b[_0x25b0('0xe')]:![];_0x1c3295[_0x25b0('0xf')]=_0x1c3295[_0x25b0('0x10')]?_0x24f98b[_0x25b0('0x11')]:0x0;}utils[_0x25b0('0x12')](_0x25b0('0x13'),_0x1c3295);});}else{utils[_0x25b0('0x12')](_0x25b0('0x13'),_0x1c3295);}if(_0x4ef71c){delete transfers[_0x1c3295[_0x25b0('0x4')]];}else{delete agents[_0x1c3295[_0x25b0('0x14')]];}}exports[_0x25b0('0x15')]=function(_0x2048dc){try{utils[_0x25b0('0x16')](util[_0x25b0('0x3')](_0x25b0('0x17'),_0x2048dc[_0x25b0('0x4')]),_0x2048dc);agents[_0x2048dc[_0x25b0('0x14')]]=_0x2048dc;agents[_0x2048dc[_0x25b0('0x14')]][_0x25b0('0x18')]=utils[_0x25b0('0x19')]();agents[_0x2048dc['destuniqueid']]['lastevent']=_0x25b0('0x1a');agents[_0x2048dc['destuniqueid']][_0x25b0('0x9')]=null;agents[_0x2048dc[_0x25b0('0x14')]][_0x25b0('0x1b')]=null;utils[_0x25b0('0x1c')](util['format'](_0x25b0('0x1d'),_0x2048dc[_0x25b0('0x4')],agents[_0x2048dc[_0x25b0('0x14')]][_0x25b0('0x7')],_0x2048dc[_0x25b0('0x14')]));}catch(_0x25872d){utils['error'](util[_0x25b0('0x3')](_0x25b0('0x17'),_0x2048dc[_0x25b0('0x4')]),_0x25872d);}};exports[_0x25b0('0x1e')]=function(_0x1dc691){try{if(!_[_0x25b0('0x1f')](agents[_0x1dc691[_0x25b0('0x14')]])){utils[_0x25b0('0x16')](util[_0x25b0('0x3')](_0x25b0('0x20'),_0x1dc691[_0x25b0('0x4')]),_0x1dc691);utils[_0x25b0('0x1c')](util['format'](_0x25b0('0x21'),_0x1dc691[_0x25b0('0x4')],agents[_0x1dc691['destuniqueid']][_0x25b0('0x7')],_0x1dc691[_0x25b0('0x14')]));agents[_0x1dc691[_0x25b0('0x14')]]['agentringnoanswer']=!![];agents[_0x1dc691['destuniqueid']]['agentringnoanswerAt']=utils[_0x25b0('0x19')]();agents[_0x1dc691[_0x25b0('0x14')]][_0x25b0('0xa')]=_0x25b0('0x22');agents[_0x1dc691[_0x25b0('0x14')]][_0x25b0('0x23')]=_0x25b0('0x22');agents[_0x1dc691[_0x25b0('0x14')]][_0x25b0('0x24')]=_0x1dc691['ringtime']?parseInt(_0x1dc691[_0x25b0('0x25')])/0x3e8:0x0;agents[_0x1dc691[_0x25b0('0x14')]]['talktime']=0x0;unanswered['push'](_0x1dc691['destuniqueid']);}}catch(_0x1a6212){utils[_0x25b0('0x26')](util[_0x25b0('0x3')](_0x25b0('0x20'),_0x1dc691[_0x25b0('0x4')]),_0x1a6212);}};exports[_0x25b0('0x27')]=function(_0x12676b){try{_[_0x25b0('0x28')](agents,function(_0x36b81d,_0x285a2b){if(_0x36b81d[_0x25b0('0x4')]==_0x12676b[_0x25b0('0x4')]&&!_[_0x25b0('0x29')](unanswered,_0x36b81d['destuniqueid'])){utils['debug'](util[_0x25b0('0x3')]('[%s][agents][queuecallerabandon]',_0x12676b['uniqueid']),_0x12676b);utils[_0x25b0('0x1c')](util[_0x25b0('0x3')](_0x25b0('0x2a'),_0x12676b[_0x25b0('0x4')],_0x36b81d[_0x25b0('0x7')],_0x36b81d['destuniqueid']));_0x36b81d[_0x25b0('0x1e')]=!![];_0x36b81d[_0x25b0('0x2b')]=utils['now']();_0x36b81d[_0x25b0('0xa')]=_0x25b0('0x2c');_0x36b81d['reason']=_0x25b0('0x2c');_0x36b81d['holdtime']=_0x12676b[_0x25b0('0x24')];_0x36b81d[_0x25b0('0x2d')]=0x0;writeDB(_0x36b81d);}});}catch(_0x14ccc6){utils[_0x25b0('0x26')](util[_0x25b0('0x3')](_0x25b0('0x2e'),_0x12676b[_0x25b0('0x4')]),_0x14ccc6);}};exports[_0x25b0('0x2f')]=function(_0x2f123c){try{if(agents[_0x2f123c['destuniqueid']]){utils[_0x25b0('0x16')](util[_0x25b0('0x3')](_0x25b0('0x30'),_0x2f123c[_0x25b0('0x4')]),_0x2f123c);utils[_0x25b0('0x1c')](util[_0x25b0('0x3')](_0x25b0('0x31'),_0x2f123c[_0x25b0('0x4')],agents[_0x2f123c[_0x25b0('0x14')]][_0x25b0('0x7')],_0x2f123c['destuniqueid']));agents[_0x2f123c[_0x25b0('0x14')]][_0x25b0('0x32')]=utils[_0x25b0('0x19')]();agents[_0x2f123c['destuniqueid']][_0x25b0('0x9')]=_0x2f123c[_0x25b0('0x9')];agents[_0x2f123c[_0x25b0('0x14')]][_0x25b0('0x1b')]=_0x2f123c[_0x25b0('0x1b')];agents[_0x2f123c[_0x25b0('0x14')]][_0x25b0('0x24')]=_0x2f123c[_0x25b0('0x25')];agents[_0x2f123c['destuniqueid']]['lastevent']=_0x25b0('0x33');_[_0x25b0('0x28')](agents,function(_0x3f4ae0,_0x52c0af){if(_0x3f4ae0[_0x25b0('0x14')]!=_0x2f123c['destuniqueid']&&_0x3f4ae0[_0x25b0('0x4')]==_0x2f123c[_0x25b0('0x4')]){_0x3f4ae0[_0x25b0('0x2d')]=0x0;_0x3f4ae0[_0x25b0('0x24')]=_0x2f123c[_0x25b0('0x25')];_0x3f4ae0['agentringnoanswer']=!![];_0x3f4ae0[_0x25b0('0x2b')]=utils[_0x25b0('0x19')]();_0x3f4ae0[_0x25b0('0xa')]=_0x25b0('0x34');_0x3f4ae0[_0x25b0('0x23')]='answered_elsewhere';_0x3f4ae0[_0x25b0('0x35')]=_0x2f123c[_0x25b0('0x14')];_0x3f4ae0[_0x25b0('0x36')]=_0x2f123c[_0x25b0('0x7')];writeDB(_0x3f4ae0);}});}}catch(_0x35fc00){utils[_0x25b0('0x26')](util[_0x25b0('0x3')](_0x25b0('0x30'),_0x2f123c[_0x25b0('0x4')]),_0x35fc00);}};exports[_0x25b0('0xd')]=function(_0x124d4b){try{if(!_['isNil'](agents[_0x124d4b[_0x25b0('0x14')]])){utils['debug'](util[_0x25b0('0x3')](_0x25b0('0x37'),_0x124d4b[_0x25b0('0x4')]),_0x124d4b);utils[_0x25b0('0x1c')](util['format'](_0x25b0('0x38'),_0x124d4b[_0x25b0('0x4')],agents[_0x124d4b[_0x25b0('0x14')]]['membername'],_0x124d4b[_0x25b0('0x14')]));agents[_0x124d4b[_0x25b0('0x14')]][_0x25b0('0xd')]=!![];agents[_0x124d4b[_0x25b0('0x14')]][_0x25b0('0x39')]=utils[_0x25b0('0x19')]();agents[_0x124d4b[_0x25b0('0x14')]]['talktime']=utils[_0x25b0('0x3a')](agents[_0x124d4b[_0x25b0('0x14')]][_0x25b0('0x39')],agents[_0x124d4b['destuniqueid']][_0x25b0('0x32')]);agents[_0x124d4b[_0x25b0('0x14')]][_0x25b0('0x23')]=_0x124d4b[_0x25b0('0x23')];agents[_0x124d4b[_0x25b0('0x14')]]['lastevent']=_0x25b0('0x3b');writeDB(agents[_0x124d4b[_0x25b0('0x14')]]);}}catch(_0x23de77){utils['error'](util[_0x25b0('0x3')](_0x25b0('0x37'),_0x124d4b[_0x25b0('0x4')]),_0x23de77);}};exports[_0x25b0('0x3c')]=function(_0x29165e){try{if(!_[_0x25b0('0x1f')](agents[_0x29165e['transfereruniqueid']])){utils['debug'](util['format'](_0x25b0('0x3d'),_0x29165e['uniqueid']),_0x29165e);utils['info'](util[_0x25b0('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x29165e[_0x25b0('0x4')],agents[_0x29165e['transfereruniqueid']]['membername'],agents[_0x29165e[_0x25b0('0x3e')]][_0x25b0('0x4')]));agents[_0x29165e[_0x25b0('0x3e')]][_0x25b0('0x3f')]=!![];agents[_0x29165e[_0x25b0('0x3e')]][_0x25b0('0x40')]=_0x25b0('0x41');agents[_0x29165e[_0x25b0('0x3e')]][_0x25b0('0x42')]=_0x29165e[_0x25b0('0x43')];agents[_0x29165e['transfereruniqueid']]['transferuniqueid']=agents[_0x29165e['transfereruniqueid']][_0x25b0('0x4')];}}catch(_0xa45e87){utils[_0x25b0('0x26')](util[_0x25b0('0x3')](_0x25b0('0x3d'),_0x29165e[_0x25b0('0x4')]),_0xa45e87);}};exports[_0x25b0('0x44')]=function(_0x5d671a){try{utils[_0x25b0('0x16')](util['format'](_0x25b0('0x45'),_0x5d671a['origtransfereruniqueid']),_0x5d671a);if(_0x5d671a['origtransfereruniqueid']==_0x5d671a[_0x25b0('0x46')]){if(!_['isNil'](agents[_0x5d671a['secondtransfereruniqueid']])){utils[_0x25b0('0x1c')](util[_0x25b0('0x3')](_0x25b0('0x47'),_0x5d671a[_0x25b0('0x48')],agents[_0x5d671a[_0x25b0('0x49')]][_0x25b0('0x7')]));agents[_0x5d671a[_0x25b0('0x49')]][_0x25b0('0x3f')]=!![];agents[_0x5d671a[_0x25b0('0x49')]][_0x25b0('0x40')]='ATTENDED';agents[_0x5d671a['secondtransfereruniqueid']][_0x25b0('0x42')]=_0x5d671a[_0x25b0('0x4a')];agents[_0x5d671a['secondtransfereruniqueid']][_0x25b0('0x4b')]=_0x5d671a[_0x25b0('0x48')];}if(_0x5d671a[_0x25b0('0x4c')]&&agents[_0x5d671a[_0x25b0('0x4c')]]){agents[_0x5d671a[_0x25b0('0x4c')]]['agententerreason']=0x1;transfers[_0x5d671a[_0x25b0('0x4c')]]=_[_0x25b0('0x4d')](agents[_0x5d671a[_0x25b0('0x4c')]]);transfers[_0x5d671a['transfereeuniqueid']][_0x25b0('0x4e')]=agents[_0x5d671a[_0x25b0('0x49')]][_0x25b0('0x4e')];transfers[_0x5d671a[_0x25b0('0x4c')]][_0x25b0('0x4f')]=agents[_0x5d671a[_0x25b0('0x49')]][_0x25b0('0x4f')];transfers[_0x5d671a[_0x25b0('0x4c')]][_0x25b0('0x18')]=utils[_0x25b0('0x19')]();transfers[_0x5d671a[_0x25b0('0x4c')]][_0x25b0('0x32')]=utils[_0x25b0('0x19')]();transfers[_0x5d671a[_0x25b0('0x4c')]]['holdtime']=0x0;transfers[_0x5d671a[_0x25b0('0x4c')]][_0x25b0('0x50')]=0x2;}}else if(_0x5d671a['secondtransfereruniqueid']==_0x5d671a[_0x25b0('0x51')]){if(!_['isNil'](agents[_0x5d671a[_0x25b0('0x48')]])){utils[_0x25b0('0x1c')](util['format'](_0x25b0('0x47'),_0x5d671a[_0x25b0('0x48')],agents[_0x5d671a[_0x25b0('0x48')]]['membername']));agents[_0x5d671a[_0x25b0('0x48')]]['transfer']=!![];agents[_0x5d671a[_0x25b0('0x48')]][_0x25b0('0x40')]='ATTENDED';agents[_0x5d671a[_0x25b0('0x48')]][_0x25b0('0x42')]=_0x5d671a['secondtransfererexten'];agents[_0x5d671a[_0x25b0('0x48')]]['transferuniqueid']=_0x5d671a['secondtransfereruniqueid'];}if(_0x5d671a['transfertargetuniqueid']&&agents[_0x5d671a[_0x25b0('0x52')]]){agents[_0x5d671a[_0x25b0('0x52')]][_0x25b0('0x50')]=0x1;transfers[_0x5d671a['transfertargetuniqueid']]=_[_0x25b0('0x4d')](agents[_0x5d671a[_0x25b0('0x52')]]);transfers[_0x5d671a[_0x25b0('0x52')]][_0x25b0('0x4e')]=agents[_0x5d671a[_0x25b0('0x48')]][_0x25b0('0x4e')];transfers[_0x5d671a[_0x25b0('0x52')]][_0x25b0('0x4f')]=agents[_0x5d671a[_0x25b0('0x48')]][_0x25b0('0x4f')];transfers[_0x5d671a[_0x25b0('0x52')]][_0x25b0('0x18')]=utils[_0x25b0('0x19')]();transfers[_0x5d671a[_0x25b0('0x52')]][_0x25b0('0x32')]=utils[_0x25b0('0x19')]();transfers[_0x5d671a[_0x25b0('0x52')]]['holdtime']=0x0;transfers[_0x5d671a[_0x25b0('0x52')]]['agententerreason']=0x2;}}}catch(_0x210ae3){utils[_0x25b0('0x26')](util[_0x25b0('0x3')](_0x25b0('0x45'),_0x5d671a['origtransfereruniqueid']),_0x210ae3);}};exports[_0x25b0('0x53')]=function(_0x646457){try{utils[_0x25b0('0x16')](util[_0x25b0('0x3')](_0x25b0('0x54'),_0x646457[_0x25b0('0x4')]),_0x646457);if(agents[_0x646457['uniqueid']]&&agents[_0x646457['uniqueid']][_0x25b0('0x23')]==='timeout'){if(_0x646457[_0x25b0('0x55')]==='21'){agents[_0x646457[_0x25b0('0x4')]][_0x25b0('0x23')]='rejected';agents[_0x646457[_0x25b0('0x4')]][_0x25b0('0xa')]=_0x25b0('0x56');}utils[_0x25b0('0x1c')](util['format'](_0x25b0('0x57'),_0x646457[_0x25b0('0x4')],agents[_0x646457[_0x25b0('0x4')]]['membername'],agents[_0x646457[_0x25b0('0x4')]][_0x25b0('0x23')],agents[_0x646457[_0x25b0('0x4')]][_0x25b0('0xa')]));writeDB(agents[_0x646457[_0x25b0('0x4')]]);var _0x177be4=unanswered[_0x25b0('0x58')](_0x646457[_0x25b0('0x4')]);if(_0x177be4>-0x1){unanswered['splice'](_0x177be4,0x1);}}if(transfers[_0x646457[_0x25b0('0x4')]]){transfers[_0x646457[_0x25b0('0x4')]][_0x25b0('0xd')]=!![];transfers[_0x646457[_0x25b0('0x4')]]['agentcompleteAt']=utils['now']();transfers[_0x646457[_0x25b0('0x4')]][_0x25b0('0x2d')]=utils[_0x25b0('0x3a')](transfers[_0x646457[_0x25b0('0x4')]]['agentcompleteAt'],transfers[_0x646457[_0x25b0('0x4')]][_0x25b0('0x32')]);transfers[_0x646457['uniqueid']][_0x25b0('0x23')]=_0x25b0('0x59');transfers[_0x646457['uniqueid']]['lastevent']=_0x25b0('0x3b');utils[_0x25b0('0x1c')](util[_0x25b0('0x3')](_0x25b0('0x57'),_0x646457[_0x25b0('0x4')],transfers[_0x646457[_0x25b0('0x4')]][_0x25b0('0x7')],transfers[_0x646457[_0x25b0('0x4')]][_0x25b0('0x23')],transfers[_0x646457[_0x25b0('0x4')]][_0x25b0('0xa')]));writeDB(transfers[_0x646457[_0x25b0('0x4')]],!![]);}if(agents[_0x646457[_0x25b0('0x4')]]&&agents[_0x646457['uniqueid']][_0x25b0('0x32')]){agents[_0x646457['uniqueid']][_0x25b0('0xd')]=!![];agents[_0x646457[_0x25b0('0x4')]]['agentcompleteAt']=utils[_0x25b0('0x19')]();agents[_0x646457[_0x25b0('0x4')]][_0x25b0('0x2d')]=utils[_0x25b0('0x3a')](agents[_0x646457[_0x25b0('0x4')]][_0x25b0('0x39')],agents[_0x646457[_0x25b0('0x4')]][_0x25b0('0x32')]);agents[_0x646457[_0x25b0('0x4')]][_0x25b0('0x23')]=agents[_0x646457[_0x25b0('0x4')]]['transfer']?'transfer':_0x25b0('0x59');agents[_0x646457[_0x25b0('0x4')]]['lastevent']='complete';utils[_0x25b0('0x1c')](util['format'](_0x25b0('0x57'),_0x646457[_0x25b0('0x4')],agents[_0x646457['uniqueid']][_0x25b0('0x7')],agents[_0x646457[_0x25b0('0x4')]]['reason'],agents[_0x646457[_0x25b0('0x4')]][_0x25b0('0xa')]));writeDB(agents[_0x646457[_0x25b0('0x4')]]);}}catch(_0x1aba93){utils[_0x25b0('0x26')](util['format']('[%s][agents][hangup]',_0x646457[_0x25b0('0x4')]),_0x1aba93);}}; \ No newline at end of file +var _0x4e81=['[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfer','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][agentconnect]','agentconnectAt','connect','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete'];(function(_0x26411e,_0x1f0e27){var _0x87fd9b=function(_0x247b7f){while(--_0x247b7f){_0x26411e['push'](_0x26411e['shift']());}};_0x87fd9b(++_0x1f0e27);}(_0x4e81,0x1bc));var _0x14e8=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x4e81[_0x64aff8];return _0x5488a3;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var utils=require(_0x14e8('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x533fb3,_0x4b9800){utils['info'](util[_0x14e8('0x3')](_0x14e8('0x4'),_0x533fb3[_0x14e8('0x5')],_0x533fb3[_0x14e8('0x6')],_0x533fb3[_0x14e8('0x7')],_0x533fb3[_0x14e8('0x8')],_0x533fb3['interface'],_0x533fb3['calleridnum'],_0x533fb3[_0x14e8('0x9')],_0x533fb3[_0x14e8('0xa')]));if(_0x533fb3[_0x14e8('0x7')]){utils[_0x14e8('0xb')](_0x533fb3[_0x14e8('0x7')])[_0x14e8('0xc')](function(_0x39127a){if(_0x39127a){_0x533fb3[_0x14e8('0xd')]=_0x39127a[_0x14e8('0xd')];_0x533fb3['agentacw']=_0x533fb3[_0x14e8('0xe')]?_0x39127a[_0x14e8('0xf')]:![];_0x533fb3[_0x14e8('0x10')]=_0x533fb3[_0x14e8('0x11')]?_0x39127a[_0x14e8('0x12')]:0x0;}utils[_0x14e8('0x13')](_0x14e8('0x14'),_0x533fb3);});}else{utils[_0x14e8('0x13')]('CreateVoiceAgentReport',_0x533fb3);}if(_0x4b9800){delete transfers[_0x533fb3[_0x14e8('0x5')]];}else{delete agents[_0x533fb3['destuniqueid']];}}exports[_0x14e8('0x15')]=function(_0x341d40){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x17'),_0x341d40['uniqueid']),_0x341d40);agents[_0x341d40[_0x14e8('0x18')]]=_0x341d40;agents[_0x341d40['destuniqueid']][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0xa')]='called';agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x9')]=null;agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x1b')]=null;utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x1d'),_0x341d40[_0x14e8('0x5')],agents[_0x341d40['destuniqueid']][_0x14e8('0x8')],_0x341d40[_0x14e8('0x18')]));}catch(_0x151f16){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][agentcalled]',_0x341d40[_0x14e8('0x5')]),_0x151f16);}};exports[_0x14e8('0x1f')]=function(_0x2abfec){try{if(!_['isNil'](agents[_0x2abfec[_0x14e8('0x18')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x20'),_0x2abfec[_0x14e8('0x5')]),_0x2abfec);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x2abfec[_0x14e8('0x5')],agents[_0x2abfec['destuniqueid']][_0x14e8('0x8')],_0x2abfec[_0x14e8('0x18')]));agents[_0x2abfec['destuniqueid']]['agentringnoanswer']=!![];agents[_0x2abfec['destuniqueid']][_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x22');agents[_0x2abfec['destuniqueid']][_0x14e8('0x23')]=_0x14e8('0x22');agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0x24')]=_0x2abfec[_0x14e8('0x25')]?parseInt(_0x2abfec[_0x14e8('0x25')])/0x3e8:0x0;agents[_0x2abfec[_0x14e8('0x18')]]['talktime']=0x0;unanswered[_0x14e8('0x26')](_0x2abfec[_0x14e8('0x18')]);}}catch(_0x393ab0){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x2abfec[_0x14e8('0x5')]),_0x393ab0);}};exports[_0x14e8('0x27')]=function(_0x567385){try{_[_0x14e8('0x28')](agents,function(_0x1d71ca,_0x176e8f){if(_0x1d71ca[_0x14e8('0x5')]==_0x567385['uniqueid']&&!_[_0x14e8('0x29')](unanswered,_0x1d71ca[_0x14e8('0x18')])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')](_0x14e8('0x2a'),_0x567385['uniqueid']),_0x567385);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x2b'),_0x567385[_0x14e8('0x5')],_0x1d71ca['membername'],_0x1d71ca[_0x14e8('0x18')]));_0x1d71ca['agentringnoanswer']=!![];_0x1d71ca[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1d71ca[_0x14e8('0xa')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x23')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x24')]=_0x567385[_0x14e8('0x24')];_0x1d71ca[_0x14e8('0x2d')]=0x0;writeDB(_0x1d71ca);}});}catch(_0x2acf6a){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][queuecallerabandon]',_0x567385['uniqueid']),_0x2acf6a);}};exports['agentconnect']=function(_0x16ff09){try{if(agents[_0x16ff09['destuniqueid']]){utils[_0x14e8('0x16')](util['format'](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x16ff09);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x16ff09[_0x14e8('0x5')],agents[_0x16ff09['destuniqueid']][_0x14e8('0x8')],_0x16ff09[_0x14e8('0x18')]));agents[_0x16ff09[_0x14e8('0x18')]][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();agents[_0x16ff09[_0x14e8('0x18')]]['connectedlinenum']=_0x16ff09[_0x14e8('0x9')];agents[_0x16ff09['destuniqueid']][_0x14e8('0x1b')]=_0x16ff09[_0x14e8('0x1b')];agents[_0x16ff09[_0x14e8('0x18')]]['holdtime']=_0x16ff09[_0x14e8('0x25')];agents[_0x16ff09[_0x14e8('0x18')]]['lastevent']=_0x14e8('0x30');_[_0x14e8('0x28')](agents,function(_0x1f429a,_0x3a7aa7){if(_0x1f429a[_0x14e8('0x18')]!=_0x16ff09[_0x14e8('0x18')]&&_0x1f429a[_0x14e8('0x5')]==_0x16ff09[_0x14e8('0x5')]){_0x1f429a[_0x14e8('0x2d')]=0x0;_0x1f429a[_0x14e8('0x24')]=_0x16ff09[_0x14e8('0x25')];_0x1f429a[_0x14e8('0x1f')]=!![];_0x1f429a[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1f429a[_0x14e8('0xa')]='answered_elsewhere';_0x1f429a[_0x14e8('0x23')]='answered_elsewhere';_0x1f429a['answeredelsewheredestinationuniqueid']=_0x16ff09['destuniqueid'];_0x1f429a[_0x14e8('0x31')]=_0x16ff09['membername'];writeDB(_0x1f429a);}});}}catch(_0x46a3c4){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x46a3c4);}};exports[_0x14e8('0xe')]=function(_0x125af5){try{if(!_[_0x14e8('0x32')](agents[_0x125af5[_0x14e8('0x18')]])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')]('[%s][agents][agentcomplete]',_0x125af5[_0x14e8('0x5')]),_0x125af5);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x33'),_0x125af5['uniqueid'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x8')],_0x125af5['destuniqueid']));agents[_0x125af5['destuniqueid']][_0x14e8('0xe')]=!![];agents[_0x125af5['destuniqueid']]['agentcompleteAt']=utils[_0x14e8('0x1a')]();agents[_0x125af5[_0x14e8('0x18')]]['talktime']=utils[_0x14e8('0x34')](agents[_0x125af5[_0x14e8('0x18')]]['agentcompleteAt'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x2f')]);agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x23')]=_0x125af5[_0x14e8('0x23')];agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x35');writeDB(agents[_0x125af5[_0x14e8('0x18')]]);}}catch(_0x42180d){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x36'),_0x125af5[_0x14e8('0x5')]),_0x42180d);}};exports[_0x14e8('0x37')]=function(_0x1f50bc){try{if(!_['isNil'](agents[_0x1f50bc[_0x14e8('0x38')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x1f50bc);utils[_0x14e8('0x1c')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1f50bc['uniqueid'],agents[_0x1f50bc[_0x14e8('0x38')]]['membername'],agents[_0x1f50bc['transfereruniqueid']][_0x14e8('0x5')]));agents[_0x1f50bc[_0x14e8('0x38')]]['transfer']=!![];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3a')]=_0x14e8('0x3b');agents[_0x1f50bc[_0x14e8('0x38')]]['transferexten']=_0x1f50bc['extension'];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3c')]=agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x5')];}}catch(_0x41b5ab){utils[_0x14e8('0x1e')](util['format'](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x41b5ab);}};exports[_0x14e8('0x3d')]=function(_0xd5adc1){try{utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0xd5adc1);if(_0xd5adc1[_0x14e8('0x3f')]==_0xd5adc1['origtransfererlinkedid']){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x40')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x41'),_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x8')]));agents[_0xd5adc1['secondtransfereruniqueid']]['transfer']=!![];agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x43')]=_0xd5adc1['origtransfererexten'];agents[_0xd5adc1['secondtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x3f')];}if(_0xd5adc1[_0x14e8('0x44')]&&agents[_0xd5adc1[_0x14e8('0x44')]]){agents[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x44')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfereeuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x47')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x48')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x48')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x45')]=0x2;}}else if(_0xd5adc1[_0x14e8('0x40')]==_0xd5adc1[_0x14e8('0x49')]){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x3f')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x3f')]]['membername']));agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x4a')]=!![];agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x43')]=_0xd5adc1['secondtransfererexten'];agents[_0xd5adc1['origtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x40')];}if(_0xd5adc1[_0x14e8('0x4b')]&&agents[_0xd5adc1[_0x14e8('0x4b')]]){agents[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x4b')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfertargetuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x47')]=agents[_0xd5adc1['origtransfereruniqueid']][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x4b')]]['calleridname']=agents[_0xd5adc1['origtransfereruniqueid']]['calleridname'];transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]]['agentconnectAt']=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x2;}}}catch(_0x36d0e5){utils['error'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0x36d0e5);}};exports['hangup']=function(_0x5add74){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x4c'),_0x5add74['uniqueid']),_0x5add74);if(agents[_0x5add74[_0x14e8('0x5')]]&&agents[_0x5add74['uniqueid']][_0x14e8('0x23')]===_0x14e8('0x22')){if(_0x5add74['cause']==='21'){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x4d');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x4d');}utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']]['lastevent']));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);var _0x52f0a7=unanswered[_0x14e8('0x4f')](_0x5add74['uniqueid']);if(_0x52f0a7>-0x1){unanswered[_0x14e8('0x50')](_0x52f0a7,0x1);}}if(transfers[_0x5add74['uniqueid']]){transfers[_0x5add74['uniqueid']]['agentcomplete']=!![];transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();transfers[_0x5add74['uniqueid']][_0x14e8('0x2d')]=utils['diffTime'](transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]);transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x52');transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]='complete';utils[_0x14e8('0x1c')](util['format'](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]));writeDB(transfers[_0x5add74[_0x14e8('0x5')]],!![]);}if(agents[_0x5add74['uniqueid']]&&agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xe')]=!![];agents[_0x5add74['uniqueid']][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2d')]=utils['diffTime'](agents[_0x5add74[_0x14e8('0x5')]]['agentcompleteAt'],agents[_0x5add74[_0x14e8('0x5')]]['agentconnectAt']);agents[_0x5add74['uniqueid']][_0x14e8('0x23')]=agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x4a')]?_0x14e8('0x4a'):_0x14e8('0x52');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x35');utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74['uniqueid'],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']][_0x14e8('0xa')]));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);}}catch(_0xc3ebbc){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x4c'),_0x5add74[_0x14e8('0x5')]),_0xc3ebbc);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c3d2bf5..e82d93c 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 _0x19e9=['[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','request','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','[%s][calls][newstate]','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','billableseconds','attendedtransfer','localtwolinkedid'];(function(_0x2c9708,_0x1d042b){var _0x1da302=function(_0x49102c){while(--_0x49102c){_0x2c9708['push'](_0x2c9708['shift']());}};_0x1da302(++_0x1d042b);}(_0x19e9,0x174));var _0x919e=function(_0x4ceed5,_0x4e10a5){_0x4ceed5=_0x4ceed5-0x0;var _0x3ea9af=_0x19e9[_0x4ceed5];return _0x3ea9af;};'use strict';var _=require(_0x919e('0x0'));var util=require(_0x919e('0x1'));var utils=require(_0x919e('0x2'));var dispositions=[_0x919e('0x3'),_0x919e('0x4'),'FAILED','NO\x20ANSWER','NO\x20ANSWER',_0x919e('0x3'),_0x919e('0x5'),_0x919e('0x6'),_0x919e('0x4'),_0x919e('0x4'),_0x919e('0x4')];var channels={};function writeDB(_0x38152f){utils[_0x919e('0x7')](util[_0x919e('0x8')](_0x919e('0x9'),_0x38152f[_0x919e('0xa')],_0x38152f['channel'],_0x38152f['queue'],_0x38152f[_0x919e('0xb')],_0x38152f[_0x919e('0xc')],_0x38152f[_0x919e('0xd')],_0x38152f[_0x919e('0xe')],_0x38152f[_0x919e('0xf')]));if(_0x38152f['accountcode']){utils[_0x919e('0x10')](_0x38152f[_0x919e('0x11')])[_0x919e('0x12')](function(_0xc41de4){if(_0xc41de4){_0x38152f[_0x919e('0x13')]=_0xc41de4['id'];}utils[_0x919e('0x14')]('CreateVoiceCallReport',_0x38152f);});}else{utils[_0x919e('0x14')]('CreateVoiceCallReport',_0x38152f);}if(channels[_0x38152f[_0x919e('0xa')]]){delete channels[_0x38152f[_0x919e('0xa')]];}}exports['newchannel']=function(_0x4a5fd9){try{utils[_0x919e('0x15')](util[_0x919e('0x8')](_0x919e('0x16'),_0x4a5fd9[_0x919e('0xa')]),_0x4a5fd9);if(_0x4a5fd9['uniqueid']==_0x4a5fd9[_0x919e('0x17')]&&_0x4a5fd9[_0x919e('0x18')]!=_0x919e('0x19')){utils[_0x919e('0x7')](util[_0x919e('0x8')](_0x919e('0x1a'),_0x4a5fd9[_0x919e('0xa')],_0x4a5fd9['context'],_0x4a5fd9[_0x919e('0x1b')]));channels[_0x4a5fd9[_0x919e('0xa')]]={'uniqueid':_0x4a5fd9[_0x919e('0xa')],'accountcode':_0x4a5fd9[_0x919e('0x11')],'source':_0x4a5fd9[_0x919e('0xd')],'destination':_0x4a5fd9[_0x919e('0x1b')],'destinationcontext':_0x4a5fd9[_0x919e('0x1c')],'channel':_0x4a5fd9[_0x919e('0x18')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x919e('0x3'),'amaflags':_0x919e('0x1d')};}}catch(_0x3e8184){utils[_0x919e('0x1e')](util[_0x919e('0x8')](_0x919e('0x16'),_0x4a5fd9[_0x919e('0xa')]),_0x3e8184);}};exports['newstate']=function(_0xb399df){try{utils[_0x919e('0x15')](util[_0x919e('0x8')]('[%s][calls][newstate]',_0xb399df['uniqueid']),_0xb399df);if(!_['isNil'](channels[_0xb399df[_0x919e('0xa')]])&&_0xb399df[_0x919e('0x1f')]==0x6){utils[_0x919e('0x7')](util[_0x919e('0x8')](_0x919e('0x20'),_0xb399df[_0x919e('0xa')],_0xb399df[_0x919e('0x1c')],_0xb399df[_0x919e('0x18')]));if(_['isNil'](channels[_0xb399df[_0x919e('0xa')]][_0x919e('0x21')])){channels[_0xb399df[_0x919e('0xa')]][_0x919e('0x21')]=utils[_0x919e('0x22')]();}}else if(!_[_0x919e('0x23')](channels[_0xb399df[_0x919e('0x17')]])&&_0xb399df[_0x919e('0x1f')]==0x6&&_0xb399df['context']!=_0x919e('0x24')){utils[_0x919e('0x7')](util[_0x919e('0x8')](_0x919e('0x25'),_0xb399df[_0x919e('0xa')],_0xb399df[_0x919e('0x17')],_0xb399df['context'],_0xb399df[_0x919e('0x18')]));channels[_0xb399df['linkedid']]['accountcode']=_0xb399df[_0x919e('0x11')];channels[_0xb399df[_0x919e('0x17')]][_0x919e('0x26')]=_0xb399df[_0x919e('0x18')];if(_['isNil'](channels[_0xb399df[_0x919e('0x17')]]['answertime'])){channels[_0xb399df[_0x919e('0x17')]][_0x919e('0x27')]=utils[_0x919e('0x22')]();}channels[_0xb399df[_0x919e('0x17')]]['disposition']=dispositions[_['toNumber'](_0xb399df[_0x919e('0x1f')])]||'ANSWERED';}}catch(_0x4c6587){utils[_0x919e('0x1e')](util['format'](_0x919e('0x28'),_0xb399df[_0x919e('0xa')]),_0x4c6587);}};exports['hangup']=function(_0x5335b3){try{if(!_[_0x919e('0x23')](channels[_0x5335b3['uniqueid']])){utils['debug'](util['format'](_0x919e('0x29'),_0x5335b3[_0x919e('0xa')]),_0x5335b3);if(_[_0x919e('0x23')](channels[_0x5335b3[_0x919e('0xa')]][_0x919e('0x2a')])){channels[_0x5335b3['uniqueid']][_0x919e('0x2a')]=_0x5335b3[_0x919e('0x2b')]+'\x20<'+_0x5335b3['calleridnum']+'>';}utils[_0x919e('0x7')](util['format'](_0x919e('0x2c'),_0x5335b3['uniqueid'],channels[_0x5335b3[_0x919e('0xa')]][_0x919e('0x2a')],_0x5335b3[_0x919e('0x2d')]));channels[_0x5335b3[_0x919e('0xa')]]['endtime']=utils[_0x919e('0x22')]();channels[_0x5335b3[_0x919e('0xa')]][_0x919e('0x2e')]=utils[_0x919e('0x2f')](channels[_0x5335b3[_0x919e('0xa')]][_0x919e('0x30')],channels[_0x5335b3['uniqueid']]['starttime']);channels[_0x5335b3[_0x919e('0xa')]][_0x919e('0x31')]=channels[_0x5335b3[_0x919e('0xa')]][_0x919e('0x27')]?utils[_0x919e('0x2f')](channels[_0x5335b3['uniqueid']]['endtime'],channels[_0x5335b3[_0x919e('0xa')]][_0x919e('0x27')]):0x0;writeDB(channels[_0x5335b3[_0x919e('0xa')]]);}}catch(_0x179412){utils[_0x919e('0x1e')](util[_0x919e('0x8')](_0x919e('0x29'),_0x5335b3[_0x919e('0xa')]),_0x179412);}};exports[_0x919e('0x32')]=function(_0x40cfa7){try{if(!_[_0x919e('0x23')](channels[_0x40cfa7[_0x919e('0x33')]])){utils[_0x919e('0x15')](util[_0x919e('0x8')]('[%s][calls][attendedtransfer]',_0x40cfa7['origtransfereruniqueid']),_0x40cfa7);if(channels[_0x40cfa7[_0x919e('0x33')]][_0x919e('0x18')]==_0x40cfa7['transfereechannel']){utils[_0x919e('0x7')](util['format'](_0x919e('0x34'),_0x40cfa7[_0x919e('0x35')],_0x40cfa7[_0x919e('0x33')],_0x40cfa7[_0x919e('0x36')]));channels[_0x40cfa7[_0x919e('0x33')]]['destinationchannel']=_0x40cfa7[_0x919e('0x36')];channels[_0x40cfa7[_0x919e('0x33')]][_0x919e('0x37')]=_0x919e('0x38');}else if(channels[_0x40cfa7[_0x919e('0x33')]][_0x919e('0x18')]=_0x40cfa7[_0x919e('0x39')]){utils['info'](util[_0x919e('0x8')](_0x919e('0x34'),_0x40cfa7[_0x919e('0x35')],_0x40cfa7[_0x919e('0x33')],_0x40cfa7['origtransfererchannel']));channels[_0x40cfa7[_0x919e('0x33')]][_0x919e('0x26')]=_0x40cfa7[_0x919e('0x3a')];channels[_0x40cfa7['localtwolinkedid']][_0x919e('0x37')]='_attended';}}}catch(_0x549189){utils[_0x919e('0x1e')](util[_0x919e('0x8')]('[%s][calls][attendedtransfer]',_0x40cfa7['origtransfereruniqueid']),_0x549189);}};exports[_0x919e('0x3b')]=function(_0x1c8b03){try{if(!_[_0x919e('0x23')](channels[_0x1c8b03['uniqueid']])){utils[_0x919e('0x15')](util['format'](_0x919e('0x3c'),_0x1c8b03['uniqueid']),_0x1c8b03);channels[_0x1c8b03[_0x919e('0xa')]][_0x919e('0x3d')]=utils[_0x919e('0x22')]();utils['info'](util[_0x919e('0x8')](_0x919e('0x3e'),_0x1c8b03[_0x919e('0xa')],channels[_0x1c8b03[_0x919e('0xa')]][_0x919e('0x3d')]));}}catch(_0x5857e9){utils['error'](util[_0x919e('0x8')](_0x919e('0x3c'),_0x1c8b03[_0x919e('0xa')]),_0x5857e9);}};exports[_0x919e('0x3f')]=function(_0x4fd1f0){try{if(!_[_0x919e('0x23')](channels[_0x4fd1f0['uniqueid']])){utils[_0x919e('0x15')](util[_0x919e('0x8')](_0x919e('0x40'),_0x4fd1f0['uniqueid']),_0x4fd1f0);if(!_['isNil'](channels[_0x4fd1f0['uniqueid']][_0x919e('0x3d')])){channels[_0x4fd1f0[_0x919e('0xa')]]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x4fd1f0[_0x919e('0xa')]][_0x919e('0x3d')]);utils['info'](util[_0x919e('0x8')](_0x919e('0x41'),_0x4fd1f0[_0x919e('0xa')],channels[_0x4fd1f0[_0x919e('0xa')]]['mohtime']));delete channels[_0x4fd1f0[_0x919e('0xa')]]['musiconholdstartAt'];}}}catch(_0x2bbd74){utils[_0x919e('0x1e')](util['format'](_0x919e('0x40'),_0x4fd1f0[_0x919e('0xa')]),_0x2bbd74);}};exports[_0x919e('0x42')]=function(_0x115d1e){try{if(!_[_0x919e('0x23')](channels[_0x115d1e[_0x919e('0xa')]])){utils[_0x919e('0x15')](util['format'](_0x919e('0x43'),_0x115d1e['uniqueid']),_0x115d1e);if(!_[_0x919e('0x23')](_0x115d1e['variable'][_0x919e('0x44')])){utils[_0x919e('0x7')](util['format'](_0x919e('0x45'),_0x115d1e[_0x919e('0xa')],_0x115d1e['value']));channels[_0x115d1e['uniqueid']][_0x919e('0x46')]=_0x115d1e[_0x919e('0x47')];}if(!_[_0x919e('0x23')](_0x115d1e[_0x919e('0x48')]['xmd-phone'])){utils['info'](util['format'](_0x919e('0x49'),_0x115d1e[_0x919e('0xa')],_0x115d1e[_0x919e('0x47')]));channels[_0x115d1e[_0x919e('0xa')]][_0x919e('0x4a')]=_0x115d1e[_0x919e('0x47')];channels[_0x115d1e[_0x919e('0xa')]][_0x919e('0x2a')]='\x22'+_0x115d1e[_0x919e('0x47')]+_0x919e('0x4b')+_0x115d1e[_0x919e('0x47')]+'>';}if(!_['isNil'](_0x115d1e[_0x919e('0x48')]['xmd-callerid-preview'])||!_[_0x919e('0x23')](_0x115d1e[_0x919e('0x48')][_0x919e('0x4c')])){utils[_0x919e('0x7')](util[_0x919e('0x8')](_0x919e('0x4d'),_0x115d1e['uniqueid'],!_['isNil'](_0x115d1e[_0x919e('0x48')]['xmd-callerid-preview'])?_0x919e('0x4e'):_0x919e('0x4c'),_0x115d1e[_0x919e('0x47')]));channels[_0x115d1e[_0x919e('0xa')]]['callerid']=_0x115d1e[_0x919e('0x47')];}if(!_[_0x919e('0x23')](_0x115d1e[_0x919e('0x48')][_0x919e('0x4f')])||!_[_0x919e('0x23')](_0x115d1e[_0x919e('0x48')][_0x919e('0x50')])){utils['info'](util['format'](_0x919e('0x4d'),_0x115d1e[_0x919e('0xa')],!_[_0x919e('0x23')](_0x115d1e[_0x919e('0x48')][_0x919e('0x4f')])?'xmd-queue':_0x919e('0x50'),_0x115d1e[_0x919e('0x47')]));channels[_0x115d1e['uniqueid']][_0x919e('0x51')]=_0x919e('0x52');channels[_0x115d1e[_0x919e('0xa')]][_0x919e('0x53')]=_0x115d1e[_0x919e('0x47')];channels[_0x115d1e['uniqueid']][_0x919e('0x54')]=!![];}if(!_[_0x919e('0x23')](_0x115d1e['variable'][_0x919e('0x55')])){utils[_0x919e('0x7')](util[_0x919e('0x8')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x115d1e[_0x919e('0xa')],_0x115d1e[_0x919e('0x47')]));channels[_0x115d1e[_0x919e('0xa')]][_0x919e('0x56')]=_0x115d1e[_0x919e('0x47')];}if(!_['isNil'](_0x115d1e[_0x919e('0x48')][_0x919e('0x57')])){utils['info'](util[_0x919e('0x8')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x115d1e[_0x919e('0xa')],_0x115d1e['value']));channels[_0x115d1e[_0x919e('0xa')]][_0x919e('0x58')]=_0x115d1e[_0x919e('0x47')];}if(!_[_0x919e('0x23')](_0x115d1e[_0x919e('0x48')][_0x919e('0x59')])){utils[_0x919e('0x7')](util[_0x919e('0x8')](_0x919e('0x5a'),_0x115d1e[_0x919e('0xa')],_0x115d1e[_0x919e('0x47')]));channels[_0x115d1e['uniqueid']][_0x919e('0x5b')]=_0x115d1e['value'];}if(!_['isNil'](_0x115d1e['variable'][_0x919e('0x5c')])){utils['info'](util['format'](_0x919e('0x5d'),_0x115d1e[_0x919e('0xa')],_0x115d1e['value']));channels[_0x115d1e[_0x919e('0xa')]][_0x919e('0x5c')]=_0x115d1e[_0x919e('0x47')];}}}catch(_0x310d8c){utils[_0x919e('0x1e')](util[_0x919e('0x8')]('[%s][calls][varset]',_0x115d1e['uniqueid']),_0x310d8c);}};exports['newexten']=function(_0x1a4991){try{if(!_[_0x919e('0x23')](channels[_0x1a4991['uniqueid']])){utils[_0x919e('0x15')](util[_0x919e('0x8')]('[%s][calls][newexten]',_0x1a4991['uniqueid']),_0x1a4991);utils[_0x919e('0x7')](util[_0x919e('0x8')](_0x919e('0x5e'),_0x1a4991[_0x919e('0xa')],_0x1a4991[_0x919e('0x5f')],_0x1a4991[_0x919e('0x60')]));if(_0x1a4991[_0x919e('0x5f')][_0x919e('0x61')]()==_0x919e('0x62')&&_[_0x919e('0x63')](_0x1a4991[_0x919e('0x60')][_0x919e('0x61')](),_0x919e('0x64'))){var _0x31c6e5=_0x1a4991['appdata'][_0x919e('0x65')]('=');var _0x590fb1=_0x31c6e5[0x0][_0x919e('0x66')](_0x31c6e5[0x0]['lastIndexOf']('(')+0x1,_0x31c6e5[0x0][_0x919e('0x67')](')'));var _0xd7bcb4=_0x31c6e5[0x1];channels[_0x1a4991[_0x919e('0xa')]][_0x590fb1]=_0xd7bcb4;}if(!_[_0x919e('0x68')](['hangup','noop','execif',_0x919e('0x62'),_0x919e('0x69')],_0x1a4991['application'][_0x919e('0x61')]())){channels[_0x1a4991['uniqueid']]['lastapplication']=_0x1a4991[_0x919e('0x5f')];channels[_0x1a4991[_0x919e('0xa')]][_0x919e('0x53')]=_0x1a4991[_0x919e('0x60')];}}}catch(_0x4356fd){utils[_0x919e('0x1e')](util[_0x919e('0x8')]('[%s][calls][newexten]',_0x1a4991[_0x919e('0xa')]),_0x4356fd);}}; \ No newline at end of file +var _0x22d3=['[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','lastIndexOf','noop','execif','set','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','uniqueid','channel','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','context','exten','DOCUMENTATION','[%s][calls][newstate]','isNil','channelstate'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0x22d3,0x170));var _0x322d=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x22d3[_0x4704dc];return _0x254d81;};'use strict';var _=require(_0x322d('0x0'));var util=require(_0x322d('0x1'));var utils=require(_0x322d('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0x322d('0x3'),_0x322d('0x4'),_0x322d('0x4'),_0x322d('0x4'),_0x322d('0x5'),_0x322d('0x6'),'FAILED','FAILED',_0x322d('0x3')];var channels={};function writeDB(_0x3c3568){utils[_0x322d('0x7')](util[_0x322d('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3c3568[_0x322d('0x9')],_0x3c3568[_0x322d('0xa')],_0x3c3568['queue'],_0x3c3568['membername'],_0x3c3568['interface'],_0x3c3568[_0x322d('0xb')],_0x3c3568[_0x322d('0xc')],_0x3c3568[_0x322d('0xd')]));if(_0x3c3568[_0x322d('0xe')]){utils[_0x322d('0xf')](_0x3c3568[_0x322d('0xe')])[_0x322d('0x10')](function(_0x59625f){if(_0x59625f){_0x3c3568['UserId']=_0x59625f['id'];}utils['request'](_0x322d('0x11'),_0x3c3568);});}else{utils['request'](_0x322d('0x11'),_0x3c3568);}if(channels[_0x3c3568[_0x322d('0x9')]]){delete channels[_0x3c3568[_0x322d('0x9')]];}}exports[_0x322d('0x12')]=function(_0x4eb307){try{utils[_0x322d('0x13')](util[_0x322d('0x8')](_0x322d('0x14'),_0x4eb307[_0x322d('0x9')]),_0x4eb307);if(_0x4eb307[_0x322d('0x9')]==_0x4eb307[_0x322d('0x15')]&&_0x4eb307[_0x322d('0xa')]!='OutgoingSpoolFailed'){utils['info'](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x4eb307[_0x322d('0x9')],_0x4eb307[_0x322d('0x16')],_0x4eb307[_0x322d('0x17')]));channels[_0x4eb307[_0x322d('0x9')]]={'uniqueid':_0x4eb307[_0x322d('0x9')],'accountcode':_0x4eb307[_0x322d('0xe')],'source':_0x4eb307[_0x322d('0xb')],'destination':_0x4eb307[_0x322d('0x17')],'destinationcontext':_0x4eb307[_0x322d('0x16')],'channel':_0x4eb307[_0x322d('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x322d('0x4'),'amaflags':_0x322d('0x18')};}}catch(_0x45c25e){utils['error'](util['format'](_0x322d('0x14'),_0x4eb307[_0x322d('0x9')]),_0x45c25e);}};exports['newstate']=function(_0x4109c){try{utils['debug'](util[_0x322d('0x8')](_0x322d('0x19'),_0x4109c[_0x322d('0x9')]),_0x4109c);if(!_[_0x322d('0x1a')](channels[_0x4109c[_0x322d('0x9')]])&&_0x4109c[_0x322d('0x1b')]==0x6){utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x1c'),_0x4109c[_0x322d('0x9')],_0x4109c['context'],_0x4109c['channel']));if(_['isNil'](channels[_0x4109c['uniqueid']][_0x322d('0x1d')])){channels[_0x4109c[_0x322d('0x9')]][_0x322d('0x1d')]=utils[_0x322d('0x1e')]();}}else if(!_[_0x322d('0x1a')](channels[_0x4109c[_0x322d('0x15')]])&&_0x4109c['channelstate']==0x6&&_0x4109c[_0x322d('0x16')]!=_0x322d('0x1f')){utils[_0x322d('0x7')](util[_0x322d('0x8')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4109c[_0x322d('0x9')],_0x4109c['linkedid'],_0x4109c['context'],_0x4109c[_0x322d('0xa')]));channels[_0x4109c[_0x322d('0x15')]][_0x322d('0xe')]=_0x4109c[_0x322d('0xe')];channels[_0x4109c[_0x322d('0x15')]][_0x322d('0x20')]=_0x4109c[_0x322d('0xa')];if(_[_0x322d('0x1a')](channels[_0x4109c[_0x322d('0x15')]][_0x322d('0x21')])){channels[_0x4109c['linkedid']]['answertime']=utils[_0x322d('0x1e')]();}channels[_0x4109c[_0x322d('0x15')]][_0x322d('0x22')]=dispositions[_[_0x322d('0x23')](_0x4109c[_0x322d('0x1b')])]||_0x322d('0x5');}}catch(_0x5ecd87){utils[_0x322d('0x24')](util[_0x322d('0x8')](_0x322d('0x19'),_0x4109c[_0x322d('0x9')]),_0x5ecd87);}};exports[_0x322d('0x25')]=function(_0x21de64){try{if(!_['isNil'](channels[_0x21de64[_0x322d('0x9')]])){utils[_0x322d('0x13')](util['format'](_0x322d('0x26'),_0x21de64[_0x322d('0x9')]),_0x21de64);if(_['isNil'](channels[_0x21de64[_0x322d('0x9')]]['callerid'])){channels[_0x21de64[_0x322d('0x9')]][_0x322d('0x27')]=_0x21de64[_0x322d('0x28')]+'\x20<'+_0x21de64[_0x322d('0xb')]+'>';}utils['info'](util[_0x322d('0x8')](_0x322d('0x29'),_0x21de64[_0x322d('0x9')],channels[_0x21de64[_0x322d('0x9')]][_0x322d('0x27')],_0x21de64[_0x322d('0x2a')]));channels[_0x21de64[_0x322d('0x9')]][_0x322d('0x2b')]=utils[_0x322d('0x1e')]();channels[_0x21de64['uniqueid']][_0x322d('0x2c')]=utils[_0x322d('0x2d')](channels[_0x21de64[_0x322d('0x9')]][_0x322d('0x2b')],channels[_0x21de64['uniqueid']][_0x322d('0x2e')]);channels[_0x21de64[_0x322d('0x9')]]['billableseconds']=channels[_0x21de64[_0x322d('0x9')]][_0x322d('0x21')]?utils[_0x322d('0x2d')](channels[_0x21de64['uniqueid']][_0x322d('0x2b')],channels[_0x21de64[_0x322d('0x9')]][_0x322d('0x21')]):0x0;writeDB(channels[_0x21de64[_0x322d('0x9')]]);}}catch(_0x2b007f){utils[_0x322d('0x24')](util[_0x322d('0x8')](_0x322d('0x26'),_0x21de64[_0x322d('0x9')]),_0x2b007f);}};exports[_0x322d('0x2f')]=function(_0x20a3b0){try{if(!_['isNil'](channels[_0x20a3b0['localtwolinkedid']])){utils[_0x322d('0x13')](util[_0x322d('0x8')]('[%s][calls][attendedtransfer]',_0x20a3b0[_0x322d('0x30')]),_0x20a3b0);if(channels[_0x20a3b0['localtwolinkedid']]['channel']==_0x20a3b0[_0x322d('0x31')]){utils[_0x322d('0x7')](util['format'](_0x322d('0x32'),_0x20a3b0[_0x322d('0x30')],_0x20a3b0[_0x322d('0x33')],_0x20a3b0['secondtransfererchannel']));channels[_0x20a3b0[_0x322d('0x33')]][_0x322d('0x20')]=_0x20a3b0['secondtransfererchannel'];channels[_0x20a3b0[_0x322d('0x33')]][_0x322d('0x34')]=_0x322d('0x35');}else if(channels[_0x20a3b0[_0x322d('0x33')]][_0x322d('0xa')]=_0x20a3b0['transfertargetchannel']){utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x32'),_0x20a3b0[_0x322d('0x30')],_0x20a3b0['localtwolinkedid'],_0x20a3b0[_0x322d('0x36')]));channels[_0x20a3b0[_0x322d('0x33')]]['destinationchannel']=_0x20a3b0['origtransfererchannel'];channels[_0x20a3b0['localtwolinkedid']]['userfield']=_0x322d('0x35');}}}catch(_0x53f7ac){utils[_0x322d('0x24')](util[_0x322d('0x8')]('[%s][calls][attendedtransfer]',_0x20a3b0[_0x322d('0x30')]),_0x53f7ac);}};exports[_0x322d('0x37')]=function(_0x18d98d){try{if(!_['isNil'](channels[_0x18d98d['uniqueid']])){utils['debug'](util[_0x322d('0x8')](_0x322d('0x38'),_0x18d98d[_0x322d('0x9')]),_0x18d98d);channels[_0x18d98d['uniqueid']]['musiconholdstartAt']=utils[_0x322d('0x1e')]();utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x39'),_0x18d98d[_0x322d('0x9')],channels[_0x18d98d[_0x322d('0x9')]][_0x322d('0x3a')]));}}catch(_0x39568f){utils[_0x322d('0x24')](util[_0x322d('0x8')](_0x322d('0x38'),_0x18d98d['uniqueid']),_0x39568f);}};exports[_0x322d('0x3b')]=function(_0x54e8b0){try{if(!_[_0x322d('0x1a')](channels[_0x54e8b0[_0x322d('0x9')]])){utils[_0x322d('0x13')](util[_0x322d('0x8')](_0x322d('0x3c'),_0x54e8b0[_0x322d('0x9')]),_0x54e8b0);if(!_[_0x322d('0x1a')](channels[_0x54e8b0[_0x322d('0x9')]][_0x322d('0x3a')])){channels[_0x54e8b0['uniqueid']][_0x322d('0x3d')]+=utils[_0x322d('0x2d')](utils[_0x322d('0x1e')](),channels[_0x54e8b0['uniqueid']][_0x322d('0x3a')]);utils[_0x322d('0x7')](util['format'](_0x322d('0x3e'),_0x54e8b0[_0x322d('0x9')],channels[_0x54e8b0[_0x322d('0x9')]][_0x322d('0x3d')]));delete channels[_0x54e8b0['uniqueid']][_0x322d('0x3a')];}}}catch(_0x308c10){utils[_0x322d('0x24')](util['format'](_0x322d('0x3c'),_0x54e8b0['uniqueid']),_0x308c10);}};exports[_0x322d('0x3f')]=function(_0x270e50){try{if(!_['isNil'](channels[_0x270e50[_0x322d('0x9')]])){utils['debug'](util['format']('[%s][calls][varset]',_0x270e50['uniqueid']),_0x270e50);if(!_[_0x322d('0x1a')](_0x270e50['variable'][_0x322d('0x40')])){utils['info'](util[_0x322d('0x8')](_0x322d('0x41'),_0x270e50[_0x322d('0x9')],_0x270e50[_0x322d('0x42')]));channels[_0x270e50[_0x322d('0x9')]][_0x322d('0x43')]=_0x270e50['value'];}if(!_[_0x322d('0x1a')](_0x270e50[_0x322d('0x44')]['xmd-phone'])){utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x45'),_0x270e50[_0x322d('0x9')],_0x270e50[_0x322d('0x42')]));channels[_0x270e50[_0x322d('0x9')]][_0x322d('0x46')]=_0x270e50[_0x322d('0x42')];channels[_0x270e50[_0x322d('0x9')]]['callerid']='\x22'+_0x270e50['value']+'\x22\x20<'+_0x270e50['value']+'>';}if(!_[_0x322d('0x1a')](_0x270e50['variable'][_0x322d('0x47')])||!_['isNil'](_0x270e50[_0x322d('0x44')][_0x322d('0x48')])){utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x49'),_0x270e50[_0x322d('0x9')],!_[_0x322d('0x1a')](_0x270e50[_0x322d('0x44')]['xmd-callerid-preview'])?_0x322d('0x47'):'xmd-callerid',_0x270e50[_0x322d('0x42')]));channels[_0x270e50[_0x322d('0x9')]][_0x322d('0x27')]=_0x270e50[_0x322d('0x42')];}if(!_['isNil'](_0x270e50['variable']['xmd-queue'])||!_[_0x322d('0x1a')](_0x270e50[_0x322d('0x44')]['xmcs-queue'])){utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x49'),_0x270e50[_0x322d('0x9')],!_[_0x322d('0x1a')](_0x270e50['variable'][_0x322d('0x4a')])?_0x322d('0x4a'):'xmcs-queue',_0x270e50['value']));channels[_0x270e50[_0x322d('0x9')]][_0x322d('0x4b')]=_0x322d('0x4c');channels[_0x270e50[_0x322d('0x9')]][_0x322d('0x4d')]=_0x270e50[_0x322d('0x42')];channels[_0x270e50['uniqueid']][_0x322d('0x4e')]=!![];}if(!_[_0x322d('0x1a')](_0x270e50[_0x322d('0x44')]['xmd-contactid'])){utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x4f'),_0x270e50[_0x322d('0x9')],_0x270e50['value']));channels[_0x270e50['uniqueid']][_0x322d('0x50')]=_0x270e50['value'];}if(!_['isNil'](_0x270e50['variable'][_0x322d('0x51')])){utils[_0x322d('0x7')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x270e50[_0x322d('0x9')],_0x270e50[_0x322d('0x42')]));channels[_0x270e50[_0x322d('0x9')]][_0x322d('0x52')]=_0x270e50['value'];}if(!_[_0x322d('0x1a')](_0x270e50[_0x322d('0x44')][_0x322d('0x53')])){utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x54'),_0x270e50[_0x322d('0x9')],_0x270e50[_0x322d('0x42')]));channels[_0x270e50['uniqueid']]['routeid']=_0x270e50[_0x322d('0x42')];}if(!_[_0x322d('0x1a')](_0x270e50[_0x322d('0x44')][_0x322d('0x55')])){utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x56'),_0x270e50[_0x322d('0x9')],_0x270e50[_0x322d('0x42')]));channels[_0x270e50[_0x322d('0x9')]][_0x322d('0x55')]=_0x270e50['value'];}}}catch(_0x212691){utils[_0x322d('0x24')](util[_0x322d('0x8')]('[%s][calls][varset]',_0x270e50[_0x322d('0x9')]),_0x212691);}};exports[_0x322d('0x57')]=function(_0x4a2d05){try{if(!_[_0x322d('0x1a')](channels[_0x4a2d05[_0x322d('0x9')]])){utils['debug'](util[_0x322d('0x8')](_0x322d('0x58'),_0x4a2d05['uniqueid']),_0x4a2d05);utils[_0x322d('0x7')](util[_0x322d('0x8')](_0x322d('0x59'),_0x4a2d05[_0x322d('0x9')],_0x4a2d05[_0x322d('0x5a')],_0x4a2d05[_0x322d('0x5b')]));if(_0x4a2d05[_0x322d('0x5a')][_0x322d('0x5c')]()=='set'&&_['startsWith'](_0x4a2d05[_0x322d('0x5b')]['toLowerCase'](),_0x322d('0x5d'))){var _0x168aa4=_0x4a2d05['appdata']['split']('=');var _0x256952=_0x168aa4[0x0]['substring'](_0x168aa4[0x0][_0x322d('0x5e')]('(')+0x1,_0x168aa4[0x0][_0x322d('0x5e')](')'));var _0x53fece=_0x168aa4[0x1];channels[_0x4a2d05[_0x322d('0x9')]][_0x256952]=_0x53fece;}if(!_['includes'](['hangup',_0x322d('0x5f'),_0x322d('0x60'),_0x322d('0x61'),_0x322d('0x62')],_0x4a2d05[_0x322d('0x5a')][_0x322d('0x5c')]())){channels[_0x4a2d05['uniqueid']]['lastapplication']=_0x4a2d05[_0x322d('0x5a')];channels[_0x4a2d05[_0x322d('0x9')]]['lastdata']=_0x4a2d05[_0x322d('0x5b')];}}}catch(_0x45ddd1){utils['error'](util[_0x322d('0x8')](_0x322d('0x58'),_0x4a2d05['uniqueid']),_0x45ddd1);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5a4493e..cbb6320 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 _0x8cd4=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8cd4,0x175));var _0x48cd=function(_0x89ace6,_0x39064b){_0x89ace6=_0x89ace6-0x0;var _0x302694=_0x8cd4[_0x89ace6];return _0x302694;};'use strict';var utils=require(_0x48cd('0x0'));exports[_0x48cd('0x1')]=function(){utils[_0x48cd('0x2')](_0x48cd('0x3'));};exports[_0x48cd('0x4')]=function(){utils[_0x48cd('0x2')](_0x48cd('0x5'));};exports['fullybooted']=function(){utils['info'](_0x48cd('0x6'));};exports[_0x48cd('0x7')]=function(_0x3d6825){utils['error'](_0x48cd('0x8'),_0x3d6825);};exports[_0x48cd('0x9')]=function(){utils['info']('[core]\x20close');};exports[_0x48cd('0xa')]=function(_0x16fd78){}; \ No newline at end of file +var _0x088a=['close','[core]\x20close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','[core]\x20fullybooted','error'];(function(_0x1d96b6,_0x289b87){var _0x2667d2=function(_0x1eddc8){while(--_0x1eddc8){_0x1d96b6['push'](_0x1d96b6['shift']());}};_0x2667d2(++_0x289b87);}(_0x088a,0x1ce));var _0xa088=function(_0x5997f4,_0x482272){_0x5997f4=_0x5997f4-0x0;var _0xa47e6a=_0x088a[_0x5997f4];return _0xa47e6a;};'use strict';var utils=require('./utils');exports[_0xa088('0x0')]=function(){utils[_0xa088('0x1')](_0xa088('0x2'));};exports['shutdown']=function(){utils[_0xa088('0x1')](_0xa088('0x3'));};exports['fullybooted']=function(){utils[_0xa088('0x1')](_0xa088('0x4'));};exports['error']=function(_0x4bba12){utils[_0xa088('0x5')]('[core]\x20error',_0x4bba12);};exports[_0xa088('0x6')]=function(){utils[_0xa088('0x1')](_0xa088('0x7'));};exports[_0xa088('0x8')]=function(_0x2a2689){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 214bad2..8cc2984 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 _0x2e8c=['[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','answertime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','calleridnum','connectedlinenum','CreateVoiceDialReport','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2e8c,0x7d));var _0xc2e8=function(_0x3e19b9,_0xe2b180){_0x3e19b9=_0x3e19b9-0x0;var _0x81c052=_0x2e8c[_0x3e19b9];return _0x81c052;};'use strict';var _=require(_0xc2e8('0x0'));var util=require(_0xc2e8('0x1'));var utils=require(_0xc2e8('0x2'));var dials={};function writeDB(_0x79ed08){utils[_0xc2e8('0x3')](util[_0xc2e8('0x4')](_0xc2e8('0x5'),_0x79ed08[_0xc2e8('0x6')],_0x79ed08['channel'],_0x79ed08['dialstring'],_0x79ed08[_0xc2e8('0x7')],_0x79ed08[_0xc2e8('0x8')],_0x79ed08['dialstatus']));utils['request'](_0xc2e8('0x9'),_0x79ed08);delete dials[_0x79ed08['uniqueid']];}exports['newexten']=function(_0x1a7be1){try{utils[_0xc2e8('0xa')](util[_0xc2e8('0x4')]('[%s][dials][newexten]',_0x1a7be1['uniqueid']),_0x1a7be1);utils[_0xc2e8('0x3')](util['format'](_0xc2e8('0xb'),_0x1a7be1[_0xc2e8('0x6')],_0x1a7be1[_0xc2e8('0xc')],_0x1a7be1[_0xc2e8('0xd')]));if(_0x1a7be1['application'][_0xc2e8('0xe')]()==_0xc2e8('0xf')&&_[_0xc2e8('0x10')](_0x1a7be1['appdata'][_0xc2e8('0xe')](),'cdr(routeid)')){var _0x3eb895=_0x1a7be1[_0xc2e8('0xd')][_0xc2e8('0x11')]('=');dials[_0x1a7be1[_0xc2e8('0x6')]]={'routeId':_0x3eb895[0x1]};}}catch(_0x1ae4f4){utils[_0xc2e8('0x12')](util['format'](_0xc2e8('0x13'),_0x1a7be1[_0xc2e8('0x6')]),_0x1ae4f4);}};exports[_0xc2e8('0x14')]=function(_0x5b8f08){try{utils[_0xc2e8('0xa')](util[_0xc2e8('0x4')](_0xc2e8('0x15'),_0x5b8f08['uniqueid']),_0x5b8f08);if(!_[_0xc2e8('0x16')](_0x5b8f08[_0xc2e8('0x17')][_0xc2e8('0x18')])){utils['info'](util['format'](_0xc2e8('0x19'),_0x5b8f08[_0xc2e8('0x6')],_0x5b8f08[_0xc2e8('0x1a')]));dials[_0x5b8f08[_0xc2e8('0x6')]]={'routeId':_0x5b8f08[_0xc2e8('0x1a')]};}}catch(_0x264604){utils[_0xc2e8('0x12')](util[_0xc2e8('0x4')](_0xc2e8('0x15'),_0x5b8f08['uniqueid']),_0x264604);}};exports[_0xc2e8('0x1b')]=function(_0x4e438f){try{if(!_[_0xc2e8('0x16')](dials[_0x4e438f[_0xc2e8('0x6')]])){utils[_0xc2e8('0xa')](util[_0xc2e8('0x4')](_0xc2e8('0x1c'),_0x4e438f['uniqueid']),_0x4e438f);dials[_0x4e438f[_0xc2e8('0x6')]]=_[_0xc2e8('0x1d')](dials[_0x4e438f[_0xc2e8('0x6')]],_0x4e438f);dials[_0x4e438f[_0xc2e8('0x6')]][_0xc2e8('0x1e')]=utils[_0xc2e8('0x1f')]();dials[_0x4e438f[_0xc2e8('0x6')]][_0xc2e8('0x20')]=_0xc2e8('0x21');utils[_0xc2e8('0x3')](util[_0xc2e8('0x4')](_0xc2e8('0x22'),_0x4e438f['uniqueid'],dials[_0x4e438f[_0xc2e8('0x6')]][_0xc2e8('0x1e')]));}}catch(_0x22fb3c){utils[_0xc2e8('0x12')](util[_0xc2e8('0x4')]('[%s][dials][dialbegin]',_0x4e438f[_0xc2e8('0x6')]),_0x22fb3c);}};exports[_0xc2e8('0x23')]=function(_0x1b1fbd){try{if(!_['isNil'](dials[_0x1b1fbd[_0xc2e8('0x6')]])){utils[_0xc2e8('0xa')](util[_0xc2e8('0x4')](_0xc2e8('0x24'),_0x1b1fbd['uniqueid']),_0x1b1fbd);dials[_0x1b1fbd[_0xc2e8('0x6')]][_0xc2e8('0x25')]=_0x1b1fbd['dialstatus'];if(_0x1b1fbd[_0xc2e8('0x25')]=='ANSWER'){dials[_0x1b1fbd['uniqueid']]=_[_0xc2e8('0x1d')](dials[_0x1b1fbd[_0xc2e8('0x6')]],_0x1b1fbd);dials[_0x1b1fbd[_0xc2e8('0x6')]]['answertime']=utils[_0xc2e8('0x1f')]();dials[_0x1b1fbd['uniqueid']][_0xc2e8('0x20')]='connect';utils[_0xc2e8('0x3')](util['format'](_0xc2e8('0x26'),_0x1b1fbd[_0xc2e8('0x6')],_0x1b1fbd[_0xc2e8('0x25')],dials[_0x1b1fbd['uniqueid']]['answertime']));}else{utils[_0xc2e8('0x3')](util[_0xc2e8('0x4')](_0xc2e8('0x27'),_0x1b1fbd[_0xc2e8('0x6')],_0x1b1fbd[_0xc2e8('0x25')]));}}}catch(_0x2abfcf){utils[_0xc2e8('0x12')](util[_0xc2e8('0x4')](_0xc2e8('0x24'),_0x1b1fbd[_0xc2e8('0x6')]),_0x2abfcf);}};exports[_0xc2e8('0x28')]=function(_0x221dcf){try{if(!_[_0xc2e8('0x16')](dials[_0x221dcf['uniqueid']])){utils[_0xc2e8('0xa')](util[_0xc2e8('0x4')](_0xc2e8('0x29'),_0x221dcf['uniqueid']),_0x221dcf);utils[_0xc2e8('0x3')](util[_0xc2e8('0x4')](_0xc2e8('0x2a'),_0x221dcf[_0xc2e8('0x6')],_0x221dcf[_0xc2e8('0x7')],_0x221dcf[_0xc2e8('0x2b')],_0x221dcf[_0xc2e8('0x2c')]));dials[_0x221dcf[_0xc2e8('0x6')]]=_[_0xc2e8('0x1d')](dials[_0x221dcf[_0xc2e8('0x6')]],{'endtime':utils['now'](),'lastevent':_0xc2e8('0x2d')});dials[_0x221dcf[_0xc2e8('0x6')]]['duration']=utils[_0xc2e8('0x2e')](dials[_0x221dcf[_0xc2e8('0x6')]][_0xc2e8('0x2f')],dials[_0x221dcf[_0xc2e8('0x6')]][_0xc2e8('0x1e')]);dials[_0x221dcf[_0xc2e8('0x6')]]['holdtime']=utils[_0xc2e8('0x2e')](dials[_0x221dcf[_0xc2e8('0x6')]][_0xc2e8('0x30')]||dials[_0x221dcf['uniqueid']]['endtime'],dials[_0x221dcf[_0xc2e8('0x6')]]['starttime']);dials[_0x221dcf['uniqueid']][_0xc2e8('0x31')]=dials[_0x221dcf[_0xc2e8('0x6')]]['answertime']?utils['diffTime'](dials[_0x221dcf[_0xc2e8('0x6')]][_0xc2e8('0x2f')],dials[_0x221dcf['uniqueid']][_0xc2e8('0x30')]):0x0;writeDB(dials[_0x221dcf[_0xc2e8('0x6')]]);}}catch(_0x207399){utils['error'](util[_0xc2e8('0x4')](_0xc2e8('0x29'),_0x221dcf[_0xc2e8('0x6')]),_0x207399);}}; \ No newline at end of file +var _0xfb39=['[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','duration','endtime','holdtime','diffTime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','connectedlinenum','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','split','error','[%s][dials][newexten]','varset','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','isNil','[%s][dials][dialend]','dialstatus','ANSWER','assign','answertime','connect'];(function(_0x2d4929,_0x4523e0){var _0x398027=function(_0xe02481){while(--_0xe02481){_0x2d4929['push'](_0x2d4929['shift']());}};_0x398027(++_0x4523e0);}(_0xfb39,0x70));var _0x9fb3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfb39[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x9fb3('0x0'));var util=require(_0x9fb3('0x1'));var utils=require(_0x9fb3('0x2'));var dials={};function writeDB(_0x34ff5b){utils[_0x9fb3('0x3')](util[_0x9fb3('0x4')](_0x9fb3('0x5'),_0x34ff5b[_0x9fb3('0x6')],_0x34ff5b['channel'],_0x34ff5b[_0x9fb3('0x7')],_0x34ff5b['calleridnum'],_0x34ff5b[_0x9fb3('0x8')],_0x34ff5b['dialstatus']));utils['request'](_0x9fb3('0x9'),_0x34ff5b);delete dials[_0x34ff5b[_0x9fb3('0x6')]];}exports[_0x9fb3('0xa')]=function(_0x50a15a){try{utils[_0x9fb3('0xb')](util['format']('[%s][dials][newexten]',_0x50a15a[_0x9fb3('0x6')]),_0x50a15a);utils[_0x9fb3('0x3')](util[_0x9fb3('0x4')](_0x9fb3('0xc'),_0x50a15a['uniqueid'],_0x50a15a['application'],_0x50a15a[_0x9fb3('0xd')]));if(_0x50a15a['application'][_0x9fb3('0xe')]()==_0x9fb3('0xf')&&_[_0x9fb3('0x10')](_0x50a15a[_0x9fb3('0xd')][_0x9fb3('0xe')](),'cdr(routeid)')){var _0x207a5a=_0x50a15a[_0x9fb3('0xd')][_0x9fb3('0x11')]('=');dials[_0x50a15a[_0x9fb3('0x6')]]={'routeId':_0x207a5a[0x1]};}}catch(_0x134fa5){utils[_0x9fb3('0x12')](util[_0x9fb3('0x4')](_0x9fb3('0x13'),_0x50a15a[_0x9fb3('0x6')]),_0x134fa5);}};exports[_0x9fb3('0x14')]=function(_0x21a64d){try{utils[_0x9fb3('0xb')](util[_0x9fb3('0x4')]('[%s][dials][varset]',_0x21a64d['uniqueid']),_0x21a64d);if(!_['isNil'](_0x21a64d['variable'][_0x9fb3('0x15')])){utils[_0x9fb3('0x3')](util[_0x9fb3('0x4')](_0x9fb3('0x16'),_0x21a64d[_0x9fb3('0x6')],_0x21a64d[_0x9fb3('0x17')]));dials[_0x21a64d[_0x9fb3('0x6')]]={'routeId':_0x21a64d[_0x9fb3('0x17')]};}}catch(_0x61cb43){utils[_0x9fb3('0x12')](util[_0x9fb3('0x4')]('[%s][dials][varset]',_0x21a64d['uniqueid']),_0x61cb43);}};exports[_0x9fb3('0x18')]=function(_0x1af898){try{if(!_['isNil'](dials[_0x1af898[_0x9fb3('0x6')]])){utils['debug'](util[_0x9fb3('0x4')](_0x9fb3('0x19'),_0x1af898[_0x9fb3('0x6')]),_0x1af898);dials[_0x1af898[_0x9fb3('0x6')]]=_['assign'](dials[_0x1af898['uniqueid']],_0x1af898);dials[_0x1af898['uniqueid']]['starttime']=utils[_0x9fb3('0x1a')]();dials[_0x1af898[_0x9fb3('0x6')]][_0x9fb3('0x1b')]='called';utils['info'](util['format'](_0x9fb3('0x1c'),_0x1af898[_0x9fb3('0x6')],dials[_0x1af898[_0x9fb3('0x6')]][_0x9fb3('0x1d')]));}}catch(_0x2c92af){utils[_0x9fb3('0x12')](util[_0x9fb3('0x4')](_0x9fb3('0x19'),_0x1af898['uniqueid']),_0x2c92af);}};exports[_0x9fb3('0x1e')]=function(_0x136b78){try{if(!_[_0x9fb3('0x1f')](dials[_0x136b78['uniqueid']])){utils[_0x9fb3('0xb')](util['format'](_0x9fb3('0x20'),_0x136b78['uniqueid']),_0x136b78);dials[_0x136b78[_0x9fb3('0x6')]][_0x9fb3('0x21')]=_0x136b78['dialstatus'];if(_0x136b78['dialstatus']==_0x9fb3('0x22')){dials[_0x136b78['uniqueid']]=_[_0x9fb3('0x23')](dials[_0x136b78[_0x9fb3('0x6')]],_0x136b78);dials[_0x136b78[_0x9fb3('0x6')]][_0x9fb3('0x24')]=utils[_0x9fb3('0x1a')]();dials[_0x136b78[_0x9fb3('0x6')]]['lastevent']=_0x9fb3('0x25');utils[_0x9fb3('0x3')](util[_0x9fb3('0x4')](_0x9fb3('0x26'),_0x136b78[_0x9fb3('0x6')],_0x136b78[_0x9fb3('0x21')],dials[_0x136b78[_0x9fb3('0x6')]][_0x9fb3('0x24')]));}else{utils[_0x9fb3('0x3')](util[_0x9fb3('0x4')](_0x9fb3('0x27'),_0x136b78[_0x9fb3('0x6')],_0x136b78[_0x9fb3('0x21')]));}}}catch(_0x1b4652){utils['error'](util['format'](_0x9fb3('0x20'),_0x136b78[_0x9fb3('0x6')]),_0x1b4652);}};exports[_0x9fb3('0x28')]=function(_0x3d3073){try{if(!_[_0x9fb3('0x1f')](dials[_0x3d3073[_0x9fb3('0x6')]])){utils['debug'](util['format']('[%s][dials][hangup]',_0x3d3073[_0x9fb3('0x6')]),_0x3d3073);utils[_0x9fb3('0x3')](util[_0x9fb3('0x4')](_0x9fb3('0x29'),_0x3d3073['uniqueid'],_0x3d3073[_0x9fb3('0x2a')],_0x3d3073['calleridname'],_0x3d3073[_0x9fb3('0x2b')]));dials[_0x3d3073[_0x9fb3('0x6')]]=_['assign'](dials[_0x3d3073[_0x9fb3('0x6')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x3d3073[_0x9fb3('0x6')]][_0x9fb3('0x2c')]=utils['diffTime'](dials[_0x3d3073['uniqueid']][_0x9fb3('0x2d')],dials[_0x3d3073[_0x9fb3('0x6')]][_0x9fb3('0x1d')]);dials[_0x3d3073[_0x9fb3('0x6')]][_0x9fb3('0x2e')]=utils[_0x9fb3('0x2f')](dials[_0x3d3073[_0x9fb3('0x6')]][_0x9fb3('0x24')]||dials[_0x3d3073[_0x9fb3('0x6')]][_0x9fb3('0x2d')],dials[_0x3d3073['uniqueid']]['starttime']);dials[_0x3d3073[_0x9fb3('0x6')]][_0x9fb3('0x30')]=dials[_0x3d3073[_0x9fb3('0x6')]][_0x9fb3('0x24')]?utils['diffTime'](dials[_0x3d3073[_0x9fb3('0x6')]][_0x9fb3('0x2d')],dials[_0x3d3073[_0x9fb3('0x6')]][_0x9fb3('0x24')]):0x0;writeDB(dials[_0x3d3073[_0x9fb3('0x6')]]);}}catch(_0x3b531a){utils[_0x9fb3('0x12')](util[_0x9fb3('0x4')](_0x9fb3('0x31'),_0x3d3073['uniqueid']),_0x3b531a);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index d0c255d..b879db9 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 _0x4571=['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]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug'];(function(_0x43f8c8,_0x24e54a){var _0x444639=function(_0x175026){while(--_0x175026){_0x43f8c8['push'](_0x43f8c8['shift']());}};_0x444639(++_0x24e54a);}(_0x4571,0x100));var _0x1457=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x4571[_0xa9eaa0];return _0x30897a;};var AsteriskManager=require(_0x1457('0x0'));var config=require(_0x1457('0x1'));var utils=require(_0x1457('0x2'));var util=require(_0x1457('0x3'));var isXDREnabled=config[_0x1457('0x4')]&&config['xdr'][_0x1457('0x5')]?!config[_0x1457('0x4')]['disabled']:!![];var isProduction=config[_0x1457('0x6')]==='production'||![];var isLocalAsterisk=config['xdr']&&config[_0x1457('0x4')][_0x1457('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x1457('0x8')][_0x1457('0x9')],config[_0x1457('0x8')]['ip'],config[_0x1457('0x8')][_0x1457('0xa')],config[_0x1457('0x8')][_0x1457('0xb')],!![]);ami[_0x1457('0xc')]();if(!isXDREnabled){utils[_0x1457('0xd')](_0x1457('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x1457('0xf'));var queues=require(_0x1457('0x10'));var recordings=require('./recordings.controller');var members=require(_0x1457('0x11'));var dials=require('./dials.controller');var transfers=require(_0x1457('0x12'));var core=require(_0x1457('0x13'));ami['on'](_0x1457('0x14'),core[_0x1457('0x14')]);ami['on'](_0x1457('0x15'),core['shutdown']);ami['on'](_0x1457('0x16'),core[_0x1457('0x16')]);ami['on'](_0x1457('0x17'),core[_0x1457('0x17')]);ami['on'](_0x1457('0x18'),core['close']);ami['on'](_0x1457('0x19'),core[_0x1457('0x19')]);ami['on'](_0x1457('0x1a'),function(_0x126082){try{utils[_0x1457('0x1b')](util[_0x1457('0x1c')](_0x1457('0x1d'),_0x126082[_0x1457('0x1e')]),_0x126082);members[_0x1457('0x1a')](_0x126082);}catch(_0x216123){utils[_0x1457('0x17')](util[_0x1457('0x1c')]('[%s][index][devicestatechange]',_0x126082[_0x1457('0x1e')]),_0x216123);}});ami['on'](_0x1457('0x1f'),function(_0xbf7119){try{utils[_0x1457('0x1b')](util['format'](_0x1457('0x20'),_0xbf7119[_0x1457('0x21')]),_0xbf7119);agents[_0x1457('0x1f')](_0xbf7119);}catch(_0x132122){utils[_0x1457('0x17')](util[_0x1457('0x1c')]('[%s][index][agentcalled]',_0xbf7119[_0x1457('0x21')]),_0x132122);}});ami['on'](_0x1457('0x22'),function(_0x16670c){try{utils['debug'](util[_0x1457('0x1c')](_0x1457('0x23'),_0x16670c['uniqueid']),_0x16670c);agents[_0x1457('0x22')](_0x16670c);}catch(_0x5b3d9b){utils[_0x1457('0x17')](util['format']('[%s][index][agentringnoanswer]',_0x16670c[_0x1457('0x21')]),_0x5b3d9b);}});ami['on'](_0x1457('0x24'),function(_0x17c691){try{utils['debug'](util['format'](_0x1457('0x25'),_0x17c691['uniqueid']),_0x17c691);agents[_0x1457('0x24')](_0x17c691);queues[_0x1457('0x24')](_0x17c691);}catch(_0x3dfd91){utils[_0x1457('0x17')](util[_0x1457('0x1c')]('[%s][index][agentconnect]',_0x17c691['uniqueid']),_0x3dfd91);}});ami['on'](_0x1457('0x26'),function(_0xf07388){try{utils[_0x1457('0x1b')](util['format']('[%s][index][agentcomplete]',_0xf07388['uniqueid']),_0xf07388);agents[_0x1457('0x26')](_0xf07388);queues['agentcomplete'](_0xf07388);members[_0x1457('0x26')](_0xf07388);}catch(_0x437eb3){utils[_0x1457('0x17')](util['format'](_0x1457('0x27'),_0xf07388[_0x1457('0x21')]),_0x437eb3);}});ami['on'](_0x1457('0x28'),function(_0x28661b){try{utils[_0x1457('0x1b')](util['format'](_0x1457('0x29'),_0x28661b['uniqueid']),_0x28661b);agents[_0x1457('0x28')](_0x28661b);queues[_0x1457('0x28')](_0x28661b);}catch(_0x359ec0){utils[_0x1457('0x17')](util[_0x1457('0x1c')](_0x1457('0x29'),_0x28661b[_0x1457('0x21')]),_0x359ec0);}});ami['on'](_0x1457('0x2a'),function(_0x1d3cac){try{utils[_0x1457('0x1b')](util[_0x1457('0x1c')](_0x1457('0x2b'),_0x1d3cac[_0x1457('0x21')]),_0x1d3cac);queues[_0x1457('0x2a')](_0x1d3cac);recordings['queuecallerjoin'](_0x1d3cac);}catch(_0x19d66a){utils[_0x1457('0x17')](util[_0x1457('0x1c')](_0x1457('0x2b'),_0x1d3cac['uniqueid']),_0x19d66a);}});ami['on'](_0x1457('0x2c'),function(_0x1d85f2){try{utils[_0x1457('0x1b')](util['format'](_0x1457('0x2d'),_0x1d85f2[_0x1457('0x21')]),_0x1d85f2);queues[_0x1457('0x2c')](_0x1d85f2);}catch(_0x1eaa0d){utils['error'](util[_0x1457('0x1c')](_0x1457('0x2d'),_0x1d85f2['uniqueid']),_0x1eaa0d);}});ami['on'](_0x1457('0x2e'),function(_0x3d5afa){try{utils['debug'](util['format'](_0x1457('0x2f'),_0x3d5afa[_0x1457('0x21')]),_0x3d5afa);queues[_0x1457('0x2e')](_0x3d5afa);calls[_0x1457('0x2e')](_0x3d5afa);}catch(_0x27cd47){utils[_0x1457('0x17')](util[_0x1457('0x1c')](_0x1457('0x2f'),_0x3d5afa[_0x1457('0x21')]),_0x27cd47);}});ami['on'](_0x1457('0x30'),function(_0x22962a){try{utils[_0x1457('0x1b')](util['format'](_0x1457('0x31'),_0x22962a[_0x1457('0x21')]),_0x22962a);queues[_0x1457('0x30')](_0x22962a);calls[_0x1457('0x30')](_0x22962a);}catch(_0x1bfef7){utils[_0x1457('0x17')](util[_0x1457('0x1c')](_0x1457('0x31'),_0x22962a['uniqueid']),_0x1bfef7);}});ami['on'](_0x1457('0x32'),function(_0x37b273){try{utils['debug'](util['format']('[%s][index][newstate]',_0x37b273['uniqueid']),_0x37b273);calls[_0x1457('0x32')](_0x37b273);recordings['newstate'](_0x37b273);}catch(_0x1f7f33){utils[_0x1457('0x17')](util[_0x1457('0x1c')]('[%s][index][newstate]',_0x37b273[_0x1457('0x21')]),_0x1f7f33);}});ami['on']('hangup',function(_0x4af799){try{utils[_0x1457('0x1b')](util['format']('[%s][index][hangup]',_0x4af799[_0x1457('0x21')]),_0x4af799);calls['hangup'](_0x4af799);recordings['hangup'](_0x4af799);dials[_0x1457('0x33')](_0x4af799);agents[_0x1457('0x33')](_0x4af799);queues['hangup'](_0x4af799);}catch(_0x26cb1e){utils[_0x1457('0x17')](util[_0x1457('0x1c')](_0x1457('0x34'),_0x4af799[_0x1457('0x21')]),_0x26cb1e);}});ami['on'](_0x1457('0x35'),function(_0x4f1fc1){try{utils[_0x1457('0x1b')](util['format'](_0x1457('0x36'),_0x4f1fc1[_0x1457('0x21')]),_0x4f1fc1);members['cdr'](_0x4f1fc1);}catch(_0x3179aa){utils[_0x1457('0x17')](util[_0x1457('0x1c')]('[%s][index][cdr]',_0x4f1fc1[_0x1457('0x21')]),_0x3179aa);}});ami['on'](_0x1457('0x37'),function(_0x156d93){try{utils[_0x1457('0x1b')](util[_0x1457('0x1c')](_0x1457('0x38'),_0x156d93[_0x1457('0x21')]),_0x156d93);queues[_0x1457('0x37')](_0x156d93);agents[_0x1457('0x37')](_0x156d93);transfers['blindtransfer'](_0x156d93);}catch(_0x569290){utils[_0x1457('0x17')](util[_0x1457('0x1c')](_0x1457('0x38'),_0x156d93[_0x1457('0x21')]),_0x569290);}});ami['on'](_0x1457('0x39'),function(_0x362303){try{utils[_0x1457('0x1b')](util['format']('[%s][index][attendedtransfer]',_0x362303[_0x1457('0x3a')]),_0x362303);queues[_0x1457('0x39')](_0x362303);transfers[_0x1457('0x39')](_0x362303);agents[_0x1457('0x39')](_0x362303);calls[_0x1457('0x39')](_0x362303);}catch(_0x346565){utils[_0x1457('0x17')](util[_0x1457('0x1c')](_0x1457('0x3b'),_0x362303[_0x1457('0x3a')]),_0x346565);}});ami['on']('varset',function(_0x587081){try{utils['debug'](util['format'](_0x1457('0x3c'),_0x587081[_0x1457('0x21')]),_0x587081);queues[_0x1457('0x3d')](_0x587081);recordings[_0x1457('0x3d')](_0x587081);calls[_0x1457('0x3d')](_0x587081);dials[_0x1457('0x3d')](_0x587081);}catch(_0x2e8cc0){utils[_0x1457('0x17')](util[_0x1457('0x1c')](_0x1457('0x3c'),_0x587081[_0x1457('0x21')]),_0x2e8cc0);}});ami['on'](_0x1457('0x3e'),function(_0x18c31f){try{utils['debug'](util[_0x1457('0x1c')]('[%s][index][newexten]',_0x18c31f[_0x1457('0x21')]),_0x18c31f);calls[_0x1457('0x3e')](_0x18c31f);recordings['newexten'](_0x18c31f);dials[_0x1457('0x3e')](_0x18c31f);}catch(_0x57a5a6){utils[_0x1457('0x17')](util['format'](_0x1457('0x3f'),_0x18c31f[_0x1457('0x21')]),_0x57a5a6);}});ami['on'](_0x1457('0x40'),function(_0x61400e){try{utils['debug'](util[_0x1457('0x1c')](_0x1457('0x41'),_0x61400e[_0x1457('0x21')]),_0x61400e);calls[_0x1457('0x40')](_0x61400e);recordings[_0x1457('0x40')](_0x61400e);}catch(_0x5ed482){utils['error'](util['format'](_0x1457('0x41'),_0x61400e['uniqueid']),_0x5ed482);}});ami['on'](_0x1457('0x42'),function(_0x5e498b){try{utils[_0x1457('0x1b')](util[_0x1457('0x1c')](_0x1457('0x43'),_0x5e498b[_0x1457('0x21')]),_0x5e498b);dials[_0x1457('0x42')](_0x5e498b);}catch(_0x500928){utils[_0x1457('0x17')](util['format'](_0x1457('0x44'),_0x5e498b[_0x1457('0x21')]),_0x500928);}});ami['on'](_0x1457('0x45'),function(_0x1b38c4){try{utils['debug'](util[_0x1457('0x1c')](_0x1457('0x46'),_0x1b38c4[_0x1457('0x21')]),_0x1b38c4);dials['dialend'](_0x1b38c4);}catch(_0x4a4ea4){utils[_0x1457('0x17')](util[_0x1457('0x1c')](_0x1457('0x46'),_0x1b38c4['uniqueid']),_0x4a4ea4);}});} \ No newline at end of file +var _0x41ef=['connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%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]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41ef,0x197));var _0xf41e=function(_0x2c0cd0,_0x4d669e){_0x2c0cd0=_0x2c0cd0-0x0;var _0x30f63c=_0x41ef[_0x2c0cd0];return _0x30f63c;};var AsteriskManager=require(_0xf41e('0x0'));var config=require('../../config/environment');var utils=require(_0xf41e('0x1'));var util=require(_0xf41e('0x2'));var isXDREnabled=config['xdr']&&config[_0xf41e('0x3')][_0xf41e('0x4')]?!config[_0xf41e('0x3')]['disabled']:!![];var isProduction=config[_0xf41e('0x5')]===_0xf41e('0x6')||![];var isLocalAsterisk=config[_0xf41e('0x3')]&&config[_0xf41e('0x3')][_0xf41e('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xf41e('0x8')][_0xf41e('0x9')],config[_0xf41e('0x8')]['ip'],config[_0xf41e('0x8')][_0xf41e('0xa')],config[_0xf41e('0x8')][_0xf41e('0xb')],!![]);ami[_0xf41e('0xc')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0xf41e('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0xf41e('0xe'));var members=require(_0xf41e('0xf'));var dials=require(_0xf41e('0x10'));var transfers=require(_0xf41e('0x11'));var core=require(_0xf41e('0x12'));ami['on'](_0xf41e('0x13'),core[_0xf41e('0x13')]);ami['on'](_0xf41e('0x14'),core['shutdown']);ami['on'](_0xf41e('0x15'),core[_0xf41e('0x15')]);ami['on'](_0xf41e('0x16'),core[_0xf41e('0x16')]);ami['on']('close',core[_0xf41e('0x17')]);ami['on'](_0xf41e('0x18'),core[_0xf41e('0x18')]);ami['on'](_0xf41e('0x19'),function(_0x4799b9){try{utils['debug'](util[_0xf41e('0x1a')](_0xf41e('0x1b'),_0x4799b9[_0xf41e('0x1c')]),_0x4799b9);members[_0xf41e('0x19')](_0x4799b9);}catch(_0xf38eee){utils['error'](util['format'](_0xf41e('0x1b'),_0x4799b9[_0xf41e('0x1c')]),_0xf38eee);}});ami['on'](_0xf41e('0x1d'),function(_0x19aedc){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x1f'),_0x19aedc[_0xf41e('0x20')]),_0x19aedc);agents[_0xf41e('0x1d')](_0x19aedc);}catch(_0x1b8e40){utils['error'](util[_0xf41e('0x1a')]('[%s][index][agentcalled]',_0x19aedc[_0xf41e('0x20')]),_0x1b8e40);}});ami['on'](_0xf41e('0x21'),function(_0x5b4141){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x22'),_0x5b4141[_0xf41e('0x20')]),_0x5b4141);agents[_0xf41e('0x21')](_0x5b4141);}catch(_0x4be0f5){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')](_0xf41e('0x22'),_0x5b4141[_0xf41e('0x20')]),_0x4be0f5);}});ami['on'](_0xf41e('0x23'),function(_0x160fef){try{utils['debug'](util[_0xf41e('0x1a')](_0xf41e('0x24'),_0x160fef['uniqueid']),_0x160fef);agents['agentconnect'](_0x160fef);queues[_0xf41e('0x23')](_0x160fef);}catch(_0x21ad02){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')](_0xf41e('0x24'),_0x160fef[_0xf41e('0x20')]),_0x21ad02);}});ami['on'](_0xf41e('0x25'),function(_0x1b5d57){try{utils['debug'](util['format'](_0xf41e('0x26'),_0x1b5d57['uniqueid']),_0x1b5d57);agents['agentcomplete'](_0x1b5d57);queues[_0xf41e('0x25')](_0x1b5d57);members[_0xf41e('0x25')](_0x1b5d57);}catch(_0x2549d4){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')](_0xf41e('0x26'),_0x1b5d57['uniqueid']),_0x2549d4);}});ami['on'](_0xf41e('0x27'),function(_0x2801ae){try{utils[_0xf41e('0x1e')](util['format'](_0xf41e('0x28'),_0x2801ae[_0xf41e('0x20')]),_0x2801ae);agents[_0xf41e('0x27')](_0x2801ae);queues['queuecallerabandon'](_0x2801ae);}catch(_0x31bc48){utils[_0xf41e('0x16')](util['format'](_0xf41e('0x28'),_0x2801ae['uniqueid']),_0x31bc48);}});ami['on'](_0xf41e('0x29'),function(_0x3a5076){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x2a'),_0x3a5076[_0xf41e('0x20')]),_0x3a5076);queues[_0xf41e('0x29')](_0x3a5076);recordings[_0xf41e('0x29')](_0x3a5076);}catch(_0x5b6128){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')](_0xf41e('0x2a'),_0x3a5076[_0xf41e('0x20')]),_0x5b6128);}});ami['on'](_0xf41e('0x2b'),function(_0x4a1f86){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x2c'),_0x4a1f86[_0xf41e('0x20')]),_0x4a1f86);queues[_0xf41e('0x2b')](_0x4a1f86);}catch(_0x2ac215){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')](_0xf41e('0x2c'),_0x4a1f86[_0xf41e('0x20')]),_0x2ac215);}});ami['on'](_0xf41e('0x2d'),function(_0x336573){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x2e'),_0x336573[_0xf41e('0x20')]),_0x336573);queues[_0xf41e('0x2d')](_0x336573);calls[_0xf41e('0x2d')](_0x336573);}catch(_0x1847e0){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')]('[%s][index][musiconholdstart]',_0x336573[_0xf41e('0x20')]),_0x1847e0);}});ami['on'](_0xf41e('0x2f'),function(_0x27d3e5){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x30'),_0x27d3e5[_0xf41e('0x20')]),_0x27d3e5);queues[_0xf41e('0x2f')](_0x27d3e5);calls[_0xf41e('0x2f')](_0x27d3e5);}catch(_0x3c3fde){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')]('[%s][index][musiconholdstop]',_0x27d3e5[_0xf41e('0x20')]),_0x3c3fde);}});ami['on']('newstate',function(_0x819b32){try{utils['debug'](util[_0xf41e('0x1a')]('[%s][index][newstate]',_0x819b32[_0xf41e('0x20')]),_0x819b32);calls[_0xf41e('0x31')](_0x819b32);recordings[_0xf41e('0x31')](_0x819b32);}catch(_0x4d9f06){utils[_0xf41e('0x16')](util['format'](_0xf41e('0x32'),_0x819b32[_0xf41e('0x20')]),_0x4d9f06);}});ami['on'](_0xf41e('0x33'),function(_0x2b0063){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x34'),_0x2b0063[_0xf41e('0x20')]),_0x2b0063);calls[_0xf41e('0x33')](_0x2b0063);recordings[_0xf41e('0x33')](_0x2b0063);dials[_0xf41e('0x33')](_0x2b0063);agents['hangup'](_0x2b0063);queues['hangup'](_0x2b0063);}catch(_0x54ebe5){utils[_0xf41e('0x16')](util['format'](_0xf41e('0x34'),_0x2b0063['uniqueid']),_0x54ebe5);}});ami['on'](_0xf41e('0x35'),function(_0x58e838){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x36'),_0x58e838[_0xf41e('0x20')]),_0x58e838);members[_0xf41e('0x35')](_0x58e838);}catch(_0x218979){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')](_0xf41e('0x36'),_0x58e838[_0xf41e('0x20')]),_0x218979);}});ami['on'](_0xf41e('0x37'),function(_0x47bc52){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x38'),_0x47bc52[_0xf41e('0x20')]),_0x47bc52);queues[_0xf41e('0x37')](_0x47bc52);agents[_0xf41e('0x37')](_0x47bc52);transfers[_0xf41e('0x37')](_0x47bc52);}catch(_0x22dac0){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')](_0xf41e('0x38'),_0x47bc52[_0xf41e('0x20')]),_0x22dac0);}});ami['on'](_0xf41e('0x39'),function(_0x2556e5){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x3a'),_0x2556e5[_0xf41e('0x3b')]),_0x2556e5);queues[_0xf41e('0x39')](_0x2556e5);transfers[_0xf41e('0x39')](_0x2556e5);agents['attendedtransfer'](_0x2556e5);calls[_0xf41e('0x39')](_0x2556e5);}catch(_0x3d1935){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')](_0xf41e('0x3a'),_0x2556e5[_0xf41e('0x3b')]),_0x3d1935);}});ami['on']('varset',function(_0x3adf6a){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x3c'),_0x3adf6a[_0xf41e('0x20')]),_0x3adf6a);queues[_0xf41e('0x3d')](_0x3adf6a);recordings[_0xf41e('0x3d')](_0x3adf6a);calls[_0xf41e('0x3d')](_0x3adf6a);dials['varset'](_0x3adf6a);}catch(_0x226b67){utils[_0xf41e('0x16')](util['format'](_0xf41e('0x3c'),_0x3adf6a[_0xf41e('0x20')]),_0x226b67);}});ami['on'](_0xf41e('0x3e'),function(_0x49d722){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x3f'),_0x49d722[_0xf41e('0x20')]),_0x49d722);calls[_0xf41e('0x3e')](_0x49d722);recordings[_0xf41e('0x3e')](_0x49d722);dials[_0xf41e('0x3e')](_0x49d722);}catch(_0x23f3a8){utils['error'](util[_0xf41e('0x1a')](_0xf41e('0x3f'),_0x49d722[_0xf41e('0x20')]),_0x23f3a8);}});ami['on']('newchannel',function(_0x82bb03){try{utils['debug'](util[_0xf41e('0x1a')](_0xf41e('0x40'),_0x82bb03['uniqueid']),_0x82bb03);calls['newchannel'](_0x82bb03);recordings[_0xf41e('0x41')](_0x82bb03);}catch(_0x4a13aa){utils[_0xf41e('0x16')](util[_0xf41e('0x1a')]('[%s][index][newchannel]',_0x82bb03[_0xf41e('0x20')]),_0x4a13aa);}});ami['on'](_0xf41e('0x42'),function(_0x17b56){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')](_0xf41e('0x43'),_0x17b56[_0xf41e('0x20')]),_0x17b56);dials[_0xf41e('0x42')](_0x17b56);}catch(_0x263e8b){utils['error'](util[_0xf41e('0x1a')](_0xf41e('0x44'),_0x17b56[_0xf41e('0x20')]),_0x263e8b);}});ami['on'](_0xf41e('0x45'),function(_0x1c5153){try{utils[_0xf41e('0x1e')](util[_0xf41e('0x1a')]('[%s][index][dialend]',_0x1c5153['uniqueid']),_0x1c5153);dials[_0xf41e('0x45')](_0x1c5153);}catch(_0x246626){utils['error'](util['format'](_0xf41e('0x46'),_0x1c5153[_0xf41e('0x20')]),_0x246626);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b65598a..e8372b4 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 _0xcca0=['agent','NOT_INUSE','isNil','exitAt','duration','enterAt','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','type','source','data3','destination','data1','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','getUserByInterface','then','internal','CreateMemberReport','getUserByName','split','name','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xcca0,0x1d3));var _0x0cca=function(_0x4f2d17,_0x13156c){_0x4f2d17=_0x4f2d17-0x0;var _0x277b0d=_0xcca0[_0x4f2d17];return _0x277b0d;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0cca('0x0'));var members={};var exclude=['Local/_attended@transfer',_0x0cca('0x1')];function writeDB(_0x60637f){utils[_0x0cca('0x2')](util[_0x0cca('0x3')](_0x0cca('0x4'),_0x60637f[_0x0cca('0x5')],_0x60637f[_0x0cca('0x6')],_0x60637f[_0x0cca('0x7')],_0x60637f[_0x0cca('0x8')],_0x60637f[_0x0cca('0x9')],_0x60637f['type']));if(_0x60637f[_0x0cca('0x6')]){utils[_0x0cca('0xa')](_0x60637f[_0x0cca('0x6')])[_0x0cca('0xb')](function(_0x5682a7){if(_0x5682a7){_0x60637f[_0x0cca('0x9')]=_0x5682a7['name'];_0x60637f['internal']=_0x5682a7[_0x0cca('0xc')];utils['request'](_0x0cca('0xd'),_0x60637f);}else{utils[_0x0cca('0xe')](_0x60637f['interface'][_0x0cca('0xf')]('/')[0x1])[_0x0cca('0xb')](function(_0x39d81e){if(_0x39d81e){_0x60637f[_0x0cca('0x9')]=_0x39d81e[_0x0cca('0x10')];_0x60637f['internal']=_0x39d81e[_0x0cca('0xc')];utils['request']('CreateMemberReport',_0x60637f);}});}})[_0x0cca('0x11')](function(_0x320210){utils[_0x0cca('0x12')](util[_0x0cca('0x3')](_0x0cca('0x13'),_0x60637f[_0x0cca('0x5')]),_0x320210);});}delete members[_0x60637f[_0x0cca('0x6')]];}function startsWith(_0x4544de,_0x48de99){return _[_0x0cca('0x14')](_0x4544de,function(_0x4e694d){return _[_0x0cca('0x15')](_0x48de99,_0x4e694d);});}exports[_0x0cca('0x16')]=function(_0x3bdfbe){try{utils[_0x0cca('0x17')](util['format'](_0x0cca('0x18'),members[_0x3bdfbe[_0x0cca('0x19')]]?members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x5')]:_0x3bdfbe[_0x0cca('0x19')]),_0x3bdfbe);utils[_0x0cca('0x2')](util['format'](_0x0cca('0x1a'),members[_0x3bdfbe[_0x0cca('0x19')]]?members[_0x3bdfbe['device']]['uniqueid']:_0x3bdfbe[_0x0cca('0x19')],_0x3bdfbe[_0x0cca('0x1b')],_0x3bdfbe[_0x0cca('0x19')]));switch(_0x3bdfbe[_0x0cca('0x1b')]){case _0x0cca('0x1c'):case _0x0cca('0x1d'):if(!startsWith(exclude,_0x3bdfbe[_0x0cca('0x19')])){members[_0x3bdfbe[_0x0cca('0x19')]]={'channel':_0x0cca('0x1e'),'interface':_0x3bdfbe['device'],'type':_0x0cca('0x1f'),'enterAt':utils[_0x0cca('0x20')](),'role':_0x0cca('0x21')};}break;case _0x0cca('0x22'):if(!_[_0x0cca('0x23')](members[_0x3bdfbe[_0x0cca('0x19')]])){members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x24')]=utils[_0x0cca('0x20')]();members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x25')]=utils['diffTime'](members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x24')],members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x26')]);if(members[_0x3bdfbe['device']][_0x0cca('0x5')]){writeDB(members[_0x3bdfbe[_0x0cca('0x19')]]);}}break;default:break;}}catch(_0xa2fe58){utils['error'](util[_0x0cca('0x3')](_0x0cca('0x18'),members[_0x3bdfbe[_0x0cca('0x19')]]?members[_0x3bdfbe['device']]['uniqueid']:_0x3bdfbe[_0x0cca('0x19')]),_0xa2fe58);}};exports['agentcomplete']=function(_0x38f513){try{if(!_[_0x0cca('0x23')](members[_0x38f513[_0x0cca('0x6')]])){utils[_0x0cca('0x17')](util[_0x0cca('0x3')]('[%s][members][agentcomplete]',_0x38f513[_0x0cca('0x5')]),_0x38f513);utils[_0x0cca('0x2')](util[_0x0cca('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x38f513[_0x0cca('0x5')],_0x38f513['interface'],_0x38f513['queue']));members[_0x38f513['interface']]=_[_0x0cca('0x27')](members[_0x38f513[_0x0cca('0x6')]],{'data4':_0x38f513['queue'],'uniqueid':_0x38f513[_0x0cca('0x5')]});}}catch(_0x475a23){utils['error'](util['format'](_0x0cca('0x28'),_0x38f513[_0x0cca('0x5')]),_0x475a23);}};exports[_0x0cca('0x29')]=function(_0x2949f3){try{utils['debug'](util[_0x0cca('0x3')](_0x0cca('0x2a'),_0x2949f3[_0x0cca('0x5')]),_0x2949f3);if(_0x2949f3[_0x0cca('0x7')]){var _0x22d210=_0x2949f3['channel'][_0x0cca('0xf')]('-')[0x0];if(!_[_0x0cca('0x23')](members[_0x22d210])){members[_0x22d210]=_[_0x0cca('0x27')](members[_0x22d210],{'data1':members[_0x22d210]['data1']||_0x2949f3[_0x0cca('0x2b')],'data2':members[_0x22d210]['data2']||_0x2949f3[_0x0cca('0x2c')],'data3':members[_0x22d210][_0x0cca('0x2d')]||_0x2949f3[_0x0cca('0x2e')],'uniqueid':members[_0x22d210][_0x0cca('0x5')]||_0x2949f3[_0x0cca('0x5')]});utils[_0x0cca('0x2')](util[_0x0cca('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2949f3[_0x0cca('0x5')],members[_0x22d210][_0x0cca('0x2f')],members[_0x22d210][_0x0cca('0x8')],members[_0x22d210][_0x0cca('0x2d')]));if(members[_0x22d210][_0x0cca('0x24')]){writeDB(members[_0x22d210]);}}}if(_0x2949f3['destinationchannel']){var _0x378976=_0x2949f3[_0x0cca('0x30')][_0x0cca('0xf')]('-')[0x0];if(!_[_0x0cca('0x23')](members[_0x378976])){members[_0x378976]=_['assign'](members[_0x378976],{'data1':members[_0x378976][_0x0cca('0x2f')]||_0x2949f3['type'],'data2':members[_0x378976][_0x0cca('0x8')]||_0x2949f3[_0x0cca('0x2c')],'data3':members[_0x378976]['data3']||_0x2949f3[_0x0cca('0x2e')],'uniqueid':members[_0x378976]['uniqueid']||_0x2949f3['uniqueid']});utils[_0x0cca('0x2')](util[_0x0cca('0x3')](_0x0cca('0x31'),_0x2949f3[_0x0cca('0x5')],members[_0x378976][_0x0cca('0x2f')],members[_0x378976][_0x0cca('0x8')],members[_0x378976]['data3']));if(members[_0x378976][_0x0cca('0x24')]){writeDB(members[_0x378976]);}}}}catch(_0x3fa7a5){utils[_0x0cca('0x12')](util[_0x0cca('0x3')](_0x0cca('0x2a'),_0x2949f3[_0x0cca('0x5')]),_0x3fa7a5);}}; \ No newline at end of file +var _0x953e=['destinationchannel','split','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','getUserByName','request','CreateMemberReport','catch','error','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','data2','source','data3','destination'];(function(_0x57d5a2,_0x265ca5){var _0x4395c1=function(_0x502366){while(--_0x502366){_0x57d5a2['push'](_0x57d5a2['shift']());}};_0x4395c1(++_0x265ca5);}(_0x953e,0xc6));var _0xe953=function(_0x189391,_0x326bb5){_0x189391=_0x189391-0x0;var _0x27b409=_0x953e[_0x189391];return _0x27b409;};'use strict';var _=require(_0xe953('0x0'));var util=require(_0xe953('0x1'));var utils=require(_0xe953('0x2'));var members={};var exclude=[_0xe953('0x3'),_0xe953('0x4')];function writeDB(_0x4f2140){utils[_0xe953('0x5')](util[_0xe953('0x6')](_0xe953('0x7'),_0x4f2140[_0xe953('0x8')],_0x4f2140[_0xe953('0x9')],_0x4f2140[_0xe953('0xa')],_0x4f2140['data2'],_0x4f2140[_0xe953('0xb')],_0x4f2140[_0xe953('0xc')]));if(_0x4f2140[_0xe953('0x9')]){utils[_0xe953('0xd')](_0x4f2140[_0xe953('0x9')])[_0xe953('0xe')](function(_0x325cb4){if(_0x325cb4){_0x4f2140[_0xe953('0xb')]=_0x325cb4[_0xe953('0xf')];_0x4f2140[_0xe953('0x10')]=_0x325cb4[_0xe953('0x10')];utils['request']('CreateMemberReport',_0x4f2140);}else{utils[_0xe953('0x11')](_0x4f2140['interface']['split']('/')[0x1])[_0xe953('0xe')](function(_0x19e36e){if(_0x19e36e){_0x4f2140['membername']=_0x19e36e[_0xe953('0xf')];_0x4f2140[_0xe953('0x10')]=_0x19e36e[_0xe953('0x10')];utils[_0xe953('0x12')](_0xe953('0x13'),_0x4f2140);}});}})[_0xe953('0x14')](function(_0x33c14e){utils[_0xe953('0x15')](util[_0xe953('0x6')]('[%s][members][writeDB]',_0x4f2140[_0xe953('0x8')]),_0x33c14e);});}delete members[_0x4f2140[_0xe953('0x9')]];}function startsWith(_0x5c6af4,_0xfa4963){return _[_0xe953('0x16')](_0x5c6af4,function(_0x374cab){return _[_0xe953('0x17')](_0xfa4963,_0x374cab);});}exports['devicestatechange']=function(_0x3db6f5){try{utils[_0xe953('0x18')](util[_0xe953('0x6')]('[%s][members][devicestatechange]',members[_0x3db6f5[_0xe953('0x19')]]?members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x8')]:_0x3db6f5['device']),_0x3db6f5);utils['info'](util[_0xe953('0x6')](_0xe953('0x1a'),members[_0x3db6f5[_0xe953('0x19')]]?members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x8')]:_0x3db6f5[_0xe953('0x19')],_0x3db6f5[_0xe953('0x1b')],_0x3db6f5[_0xe953('0x19')]));switch(_0x3db6f5[_0xe953('0x1b')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x3db6f5[_0xe953('0x19')])){members[_0x3db6f5[_0xe953('0x19')]]={'channel':'voice','interface':_0x3db6f5[_0xe953('0x19')],'type':_0xe953('0x1c'),'enterAt':utils[_0xe953('0x1d')](),'role':_0xe953('0x1e')};}break;case _0xe953('0x1f'):if(!_[_0xe953('0x20')](members[_0x3db6f5[_0xe953('0x19')]])){members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x21')]=utils[_0xe953('0x1d')]();members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x22')]=utils[_0xe953('0x23')](members[_0x3db6f5[_0xe953('0x19')]]['exitAt'],members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x24')]);if(members[_0x3db6f5[_0xe953('0x19')]]['uniqueid']){writeDB(members[_0x3db6f5[_0xe953('0x19')]]);}}break;default:break;}}catch(_0x1f49a9){utils['error'](util['format']('[%s][members][devicestatechange]',members[_0x3db6f5[_0xe953('0x19')]]?members[_0x3db6f5[_0xe953('0x19')]][_0xe953('0x8')]:_0x3db6f5[_0xe953('0x19')]),_0x1f49a9);}};exports['agentcomplete']=function(_0x4b8ee5){try{if(!_[_0xe953('0x20')](members[_0x4b8ee5[_0xe953('0x9')]])){utils[_0xe953('0x18')](util[_0xe953('0x6')](_0xe953('0x25'),_0x4b8ee5[_0xe953('0x8')]),_0x4b8ee5);utils[_0xe953('0x5')](util[_0xe953('0x6')](_0xe953('0x26'),_0x4b8ee5[_0xe953('0x8')],_0x4b8ee5[_0xe953('0x9')],_0x4b8ee5[_0xe953('0x27')]));members[_0x4b8ee5[_0xe953('0x9')]]=_[_0xe953('0x28')](members[_0x4b8ee5[_0xe953('0x9')]],{'data4':_0x4b8ee5['queue'],'uniqueid':_0x4b8ee5[_0xe953('0x8')]});}}catch(_0x1e2105){utils[_0xe953('0x15')](util[_0xe953('0x6')]('[%s][members][agentcomplete]',_0x4b8ee5[_0xe953('0x8')]),_0x1e2105);}};exports['cdr']=function(_0x1d4a37){try{utils[_0xe953('0x18')](util[_0xe953('0x6')](_0xe953('0x29'),_0x1d4a37[_0xe953('0x8')]),_0x1d4a37);if(_0x1d4a37[_0xe953('0xa')]){var _0x2e06b=_0x1d4a37[_0xe953('0xa')]['split']('-')[0x0];if(!_[_0xe953('0x20')](members[_0x2e06b])){members[_0x2e06b]=_[_0xe953('0x28')](members[_0x2e06b],{'data1':members[_0x2e06b][_0xe953('0x2a')]||_0x1d4a37[_0xe953('0xc')],'data2':members[_0x2e06b][_0xe953('0x2b')]||_0x1d4a37[_0xe953('0x2c')],'data3':members[_0x2e06b][_0xe953('0x2d')]||_0x1d4a37[_0xe953('0x2e')],'uniqueid':members[_0x2e06b][_0xe953('0x8')]||_0x1d4a37['uniqueid']});utils[_0xe953('0x5')](util[_0xe953('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1d4a37['uniqueid'],members[_0x2e06b][_0xe953('0x2a')],members[_0x2e06b][_0xe953('0x2b')],members[_0x2e06b][_0xe953('0x2d')]));if(members[_0x2e06b][_0xe953('0x21')]){writeDB(members[_0x2e06b]);}}}if(_0x1d4a37['destinationchannel']){var _0xaf2893=_0x1d4a37[_0xe953('0x2f')][_0xe953('0x30')]('-')[0x0];if(!_[_0xe953('0x20')](members[_0xaf2893])){members[_0xaf2893]=_[_0xe953('0x28')](members[_0xaf2893],{'data1':members[_0xaf2893][_0xe953('0x2a')]||_0x1d4a37['type'],'data2':members[_0xaf2893]['data2']||_0x1d4a37['source'],'data3':members[_0xaf2893][_0xe953('0x2d')]||_0x1d4a37[_0xe953('0x2e')],'uniqueid':members[_0xaf2893][_0xe953('0x8')]||_0x1d4a37[_0xe953('0x8')]});utils[_0xe953('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1d4a37[_0xe953('0x8')],members[_0xaf2893]['data1'],members[_0xaf2893][_0xe953('0x2b')],members[_0xaf2893]['data3']));if(members[_0xaf2893]['exitAt']){writeDB(members[_0xaf2893]);}}}}catch(_0xe3df3d){utils[_0xe953('0x15')](util[_0xe953('0x6')](_0xe953('0x29'),_0x1d4a37[_0xe953('0x8')]),_0xe3df3d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 20c9329..0cbd285 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 _0x8e28=['position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','accountcode','lastAssignedTo','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','info','channel','queue','calleridnum','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x8e28,0x11e));var _0x88e2=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x8e28[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x88e2('0x0'));var util=require('util');var utils=require(_0x88e2('0x1'));var queues={};function writeDB(_0x26974b){utils[_0x88e2('0x2')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x26974b['uniqueid'],_0x26974b[_0x88e2('0x3')],_0x26974b[_0x88e2('0x4')],_0x26974b['lastAssignedTo'],_0x26974b[_0x88e2('0x5')],_0x26974b['accountcode'],_0x26974b[_0x88e2('0x6')]));if(_0x26974b['queue']){utils['getVoiceQueueByName'](_0x26974b[_0x88e2('0x4')])[_0x88e2('0x7')](function(_0x5731c4){if(_0x5731c4){_0x26974b[_0x88e2('0x8')]=_0x5731c4[_0x88e2('0x8')];}utils[_0x88e2('0x9')](_0x88e2('0xa'),_0x26974b);});}else{utils[_0x88e2('0x9')](_0x88e2('0xa'),_0x26974b);}if(_0x26974b[_0x88e2('0xb')]){delete queues[_0x26974b[_0x88e2('0xb')]];}else{delete queues[_0x26974b[_0x88e2('0xc')]];}}exports[_0x88e2('0xd')]=function(_0x13fc24){try{utils[_0x88e2('0xe')](util[_0x88e2('0xf')](_0x88e2('0x10'),_0x13fc24[_0x88e2('0xc')]),_0x13fc24);utils[_0x88e2('0x2')](util[_0x88e2('0xf')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x13fc24['uniqueid'],_0x13fc24[_0x88e2('0x4')],_0x13fc24[_0x88e2('0x11')]));queues[_0x13fc24[_0x88e2('0xc')]]=_[_0x88e2('0x12')](_0x13fc24,{'originalposition':_0x13fc24[_0x88e2('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x35f5ee){utils[_0x88e2('0x13')](util['format'](_0x88e2('0x10'),_0x13fc24[_0x88e2('0xc')]),_0x35f5ee);}};exports[_0x88e2('0x14')]=function(_0x43f86e){try{if(!_[_0x88e2('0x15')](queues[_0x43f86e['uniqueid']])){utils[_0x88e2('0xe')](util[_0x88e2('0xf')](_0x88e2('0x16'),_0x43f86e[_0x88e2('0xc')]),_0x43f86e);if(queues[_0x43f86e['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x43f86e[_0x88e2('0xc')]][_0x88e2('0x17')]&&!queues[_0x43f86e[_0x88e2('0xc')]][_0x88e2('0x18')]){queues[_0x43f86e[_0x88e2('0xc')]][_0x88e2('0x19')]=!![];queues[_0x43f86e[_0x88e2('0xc')]][_0x88e2('0x1a')]=utils[_0x88e2('0x1b')]();queues[_0x43f86e[_0x88e2('0xc')]][_0x88e2('0x6')]='COMPLETEDBYAGENT';}utils[_0x88e2('0x2')](util[_0x88e2('0xf')](_0x88e2('0x1c'),_0x43f86e[_0x88e2('0xc')],queues[_0x43f86e[_0x88e2('0xc')]][_0x88e2('0x1d')],queues[_0x43f86e[_0x88e2('0xc')]]['queuecallerexitreason']));writeDB(queues[_0x43f86e[_0x88e2('0xc')]]);}else if(queues[_0x43f86e[_0x88e2('0xc')]][_0x88e2('0xb')]){utils[_0x88e2('0x2')](util[_0x88e2('0xf')](_0x88e2('0x1e'),_0x43f86e[_0x88e2('0xc')],queues[_0x43f86e[_0x88e2('0xc')]][_0x88e2('0x1d')],queues[_0x43f86e[_0x88e2('0xc')]][_0x88e2('0xb')]));queues[queues[_0x43f86e['uniqueid']][_0x88e2('0xb')]]=queues[_0x43f86e[_0x88e2('0xc')]];queues[queues[_0x43f86e['uniqueid']][_0x88e2('0xb')]][_0x88e2('0x1f')]=0x2;delete queues[_0x43f86e[_0x88e2('0xc')]];}}}catch(_0x10ac92){utils[_0x88e2('0x13')](util['format']('[%s][queues][hangup]',_0x43f86e[_0x88e2('0xc')]),_0x10ac92);}};exports[_0x88e2('0x20')]=function(_0x340cf3){try{utils[_0x88e2('0xe')](util[_0x88e2('0xf')](_0x88e2('0x21'),_0x340cf3['uniqueid']),_0x340cf3);if(!_[_0x88e2('0x15')](_0x340cf3[_0x88e2('0x22')][_0x88e2('0x23')])&&_0x340cf3[_0x88e2('0x24')][_0x88e2('0x25')]()!==_0x88e2('0x26')){if(!_['isNil'](queues[_0x340cf3[_0x88e2('0xc')]])){queues[_0x340cf3[_0x88e2('0xc')]][_0x88e2('0x17')]=![];queues[_0x340cf3[_0x88e2('0xc')]]['queuecallerabandonAt']=null;queues[_0x340cf3[_0x88e2('0xc')]][_0x88e2('0x18')]=!![];queues[_0x340cf3[_0x88e2('0xc')]][_0x88e2('0x27')]=utils[_0x88e2('0x1b')]();queues[_0x340cf3['uniqueid']][_0x88e2('0x6')]=_0x340cf3[_0x88e2('0x24')][_0x88e2('0x25')]();utils[_0x88e2('0x2')](util[_0x88e2('0xf')](_0x88e2('0x28'),_0x340cf3[_0x88e2('0xc')],queues[_0x340cf3[_0x88e2('0xc')]][_0x88e2('0x1d')],_0x340cf3[_0x88e2('0x24')],queues[_0x340cf3[_0x88e2('0xc')]][_0x88e2('0x6')]));writeDB(queues[_0x340cf3[_0x88e2('0xc')]]);}}else if(!_[_0x88e2('0x15')](_0x340cf3[_0x88e2('0x22')]['queueposition'])){if(!_[_0x88e2('0x15')](queues[_0x340cf3[_0x88e2('0xc')]])&&!queues[_0x340cf3['uniqueid']][_0x88e2('0x17')]){queues[_0x340cf3[_0x88e2('0xc')]][_0x88e2('0x17')]=![];queues[_0x340cf3['uniqueid']]['queuecallerabandonAt']=null;queues[_0x340cf3['uniqueid']][_0x88e2('0x18')]=!![];queues[_0x340cf3[_0x88e2('0xc')]]['queuecallerexitAt']=utils[_0x88e2('0x1b')]();queues[_0x340cf3['uniqueid']]['queuecallerexitreason']=_0x88e2('0x29');utils['info'](util['format'](_0x88e2('0x2a'),_0x340cf3['uniqueid'],queues[_0x340cf3['uniqueid']]['name'],_0x340cf3[_0x88e2('0x24')],queues[_0x340cf3[_0x88e2('0xc')]][_0x88e2('0x6')]));}}}catch(_0x46cf7c){utils[_0x88e2('0x13')](util['format'](_0x88e2('0x21'),_0x340cf3[_0x88e2('0xc')]),_0x46cf7c);}};exports[_0x88e2('0x17')]=function(_0x5bb557){try{if(!_[_0x88e2('0x15')](queues[_0x5bb557[_0x88e2('0xc')]])){utils['debug'](util[_0x88e2('0xf')](_0x88e2('0x2b'),_0x5bb557[_0x88e2('0xc')]),_0x5bb557);queues[_0x5bb557[_0x88e2('0xc')]][_0x88e2('0x18')]=![];queues[_0x5bb557[_0x88e2('0xc')]][_0x88e2('0x27')]=null;queues[_0x5bb557[_0x88e2('0xc')]][_0x88e2('0x17')]=!![];queues[_0x5bb557[_0x88e2('0xc')]][_0x88e2('0x2c')]=utils[_0x88e2('0x1b')]();queues[_0x5bb557[_0x88e2('0xc')]][_0x88e2('0x6')]='ABANDONED';utils['info'](util[_0x88e2('0xf')](_0x88e2('0x2d'),_0x5bb557[_0x88e2('0xc')],queues[_0x5bb557[_0x88e2('0xc')]]['name'],queues[_0x5bb557['uniqueid']][_0x88e2('0x6')]));}}catch(_0xd44c5){utils[_0x88e2('0x13')](util[_0x88e2('0xf')](_0x88e2('0x2b'),_0x5bb557[_0x88e2('0xc')]),_0xd44c5);}};exports[_0x88e2('0x2e')]=function(_0x3d5f50){try{if(!_[_0x88e2('0x15')](queues[_0x3d5f50['uniqueid']])){utils['debug'](util['format']('[%s][queues][queuecallerleave]',_0x3d5f50[_0x88e2('0xc')]),_0x3d5f50);utils[_0x88e2('0x2')](util[_0x88e2('0xf')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3d5f50[_0x88e2('0xc')],queues[_0x3d5f50['uniqueid']][_0x88e2('0x1d')],_0x3d5f50[_0x88e2('0x2f')],_0x3d5f50[_0x88e2('0x30')]));queues[_0x3d5f50['uniqueid']]['queuecallerleave']=!![];queues[_0x3d5f50[_0x88e2('0xc')]][_0x88e2('0x31')]=utils['now']();queues[_0x3d5f50[_0x88e2('0xc')]]['holdtime']=utils[_0x88e2('0x32')](queues[_0x3d5f50['uniqueid']][_0x88e2('0x31')],queues[_0x3d5f50[_0x88e2('0xc')]][_0x88e2('0x33')]);queues[_0x3d5f50[_0x88e2('0xc')]][_0x88e2('0x11')]=_0x3d5f50['position'];queues[_0x3d5f50['uniqueid']][_0x88e2('0x34')]=_0x3d5f50['count'];queues[_0x3d5f50[_0x88e2('0xc')]]['connectedlinenum']=_0x3d5f50['connectedlinenum'];queues[_0x3d5f50[_0x88e2('0xc')]][_0x88e2('0x30')]=_0x3d5f50[_0x88e2('0x30')];}}catch(_0x371c62){utils[_0x88e2('0x13')](util[_0x88e2('0xf')]('[%s][queues][queuecallerleave]',_0x3d5f50['uniqueid']),_0x371c62);}};exports[_0x88e2('0x35')]=function(_0x279591){try{if(!_['isNil'](queues[_0x279591['uniqueid']])){utils[_0x88e2('0xe')](util[_0x88e2('0xf')](_0x88e2('0x36'),_0x279591[_0x88e2('0xc')]),_0x279591);utils[_0x88e2('0x2')](util[_0x88e2('0xf')](_0x88e2('0x37'),_0x279591[_0x88e2('0xc')],queues[_0x279591['uniqueid']]['name'],_0x279591['membername'],_0x279591[_0x88e2('0x38')]));queues[_0x279591[_0x88e2('0xc')]][_0x88e2('0x17')]=![];queues[_0x279591[_0x88e2('0xc')]][_0x88e2('0x17')]=![];queues[_0x279591[_0x88e2('0xc')]][_0x88e2('0x2c')]=null;queues[_0x279591[_0x88e2('0xc')]][_0x88e2('0x18')]=![];queues[_0x279591['uniqueid']][_0x88e2('0x6')]=null;queues[_0x279591[_0x88e2('0xc')]][_0x88e2('0x27')]=null;queues[_0x279591[_0x88e2('0xc')]][_0x88e2('0x39')]=!![];queues[_0x279591[_0x88e2('0xc')]][_0x88e2('0x3a')]=_0x279591[_0x88e2('0x38')];queues[_0x279591[_0x88e2('0xc')]][_0x88e2('0x3b')]=_0x279591[_0x88e2('0x3c')];}}catch(_0x3bb4ce){utils[_0x88e2('0x13')](util[_0x88e2('0xf')](_0x88e2('0x36'),_0x279591[_0x88e2('0xc')]),_0x3bb4ce);}};exports[_0x88e2('0x3d')]=function(_0x1cf25e){try{if(!_[_0x88e2('0x15')](queues[_0x1cf25e[_0x88e2('0xc')]])){if(queues[_0x1cf25e[_0x88e2('0xc')]]['queuecallerleaveAt']){utils[_0x88e2('0xe')](util[_0x88e2('0xf')](_0x88e2('0x3e'),_0x1cf25e[_0x88e2('0xc')]),_0x1cf25e);queues[_0x1cf25e[_0x88e2('0xc')]]['queuecallerabandon']=![];queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x17')]=![];queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x2c')]=null;queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x18')]=![];queues[_0x1cf25e['uniqueid']]['queuecallerexitAt']=null;queues[_0x1cf25e[_0x88e2('0xc')]]['assigned']=!![];queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x3b')]=_0x1cf25e[_0x88e2('0x3c')];queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x19')]=!![];queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x1a')]=utils[_0x88e2('0x1b')]();if(_0x1cf25e[_0x88e2('0x3f')]==_0x88e2('0x40')){if(!queues[_0x1cf25e['uniqueid']]['transfer']){queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x6')]=_0x88e2('0x41');}}else{queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x6')]='COMPLETEDBY'+_0x1cf25e[_0x88e2('0x3f')]['toUpperCase']();}utils['info'](util[_0x88e2('0xf')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1cf25e[_0x88e2('0xc')],queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x1d')],_0x1cf25e[_0x88e2('0x3c')],queues[_0x1cf25e[_0x88e2('0xc')]][_0x88e2('0x6')]));writeDB(queues[_0x1cf25e[_0x88e2('0xc')]]);}}}catch(_0x541c1f){utils[_0x88e2('0x13')](util[_0x88e2('0xf')](_0x88e2('0x3e'),_0x1cf25e[_0x88e2('0xc')]),_0x541c1f);}};exports[_0x88e2('0x42')]=function(_0x2607af){try{if(!_[_0x88e2('0x15')](queues[_0x2607af[_0x88e2('0x43')]])){utils['debug'](util[_0x88e2('0xf')](_0x88e2('0x44'),_0x2607af['uniqueid']),_0x2607af);queues[_0x2607af[_0x88e2('0x43')]]['transfer']=!![];queues[_0x2607af['transfereeuniqueid']][_0x88e2('0x45')]=_0x88e2('0x46');queues[_0x2607af[_0x88e2('0x43')]][_0x88e2('0x47')]=_0x2607af[_0x88e2('0x48')];queues[_0x2607af[_0x88e2('0x43')]]['transferuniqueid']=_0x2607af[_0x88e2('0x43')];queues[_0x2607af[_0x88e2('0x43')]][_0x88e2('0x6')]='BLINDTRANSFER';utils[_0x88e2('0x2')](util['format'](_0x88e2('0x49'),_0x2607af[_0x88e2('0xc')],queues[_0x2607af['transfereeuniqueid']][_0x88e2('0x1d')],_0x2607af[_0x88e2('0x43')],_0x2607af['extension']));}}catch(_0x1e3aab){utils[_0x88e2('0x13')](util[_0x88e2('0xf')](_0x88e2('0x44'),_0x2607af['uniqueid']),_0x1e3aab);}};exports['attendedtransfer']=function(_0x527ec8){try{utils[_0x88e2('0xe')](util['format']('[%s][queues][attendedtransfer]',_0x527ec8[_0x88e2('0x4a')]),_0x527ec8);if(_0x527ec8[_0x88e2('0x4a')]==_0x527ec8[_0x88e2('0x4b')]){if(!_[_0x88e2('0x15')](queues[_0x527ec8[_0x88e2('0x4c')]])){utils[_0x88e2('0x2')](util[_0x88e2('0xf')](_0x88e2('0x4d'),_0x527ec8[_0x88e2('0x4a')],queues[_0x527ec8[_0x88e2('0x4c')]][_0x88e2('0x1d')],_0x527ec8[_0x88e2('0x4e')]));queues[_0x527ec8[_0x88e2('0x4c')]][_0x88e2('0x40')]=!![];queues[_0x527ec8['secondtransfererlinkedid']]['transfertype']=_0x88e2('0x4f');queues[_0x527ec8[_0x88e2('0x4c')]]['transferexten']=_0x527ec8[_0x88e2('0x4e')];queues[_0x527ec8['secondtransfererlinkedid']]['transferuniqueid']=_0x527ec8[_0x88e2('0x4a')];queues[_0x527ec8['secondtransfererlinkedid']][_0x88e2('0x6')]=_0x88e2('0x50');}if(!_[_0x88e2('0x15')](queues[_0x527ec8[_0x88e2('0x4b')]])){if(_0x527ec8[_0x88e2('0x51')]&&queues[_0x527ec8[_0x88e2('0x51')]]){queues[_0x527ec8[_0x88e2('0x51')]][_0x88e2('0x1f')]=0x1;queues[_0x527ec8[_0x88e2('0x43')]]=_['clone'](queues[_0x527ec8[_0x88e2('0x51')]]);queues[_0x527ec8[_0x88e2('0x43')]][_0x88e2('0xb')]=_0x527ec8[_0x88e2('0x52')];queues[_0x527ec8[_0x88e2('0x43')]][_0x88e2('0x1f')]=0x2;queues[_0x527ec8[_0x88e2('0x43')]][_0x88e2('0x5')]=queues[_0x527ec8[_0x88e2('0x4c')]][_0x88e2('0x5')];queues[_0x527ec8[_0x88e2('0x43')]][_0x88e2('0x53')]=queues[_0x527ec8[_0x88e2('0x4c')]][_0x88e2('0x53')];queues[_0x527ec8[_0x88e2('0x43')]][_0x88e2('0x33')]=utils[_0x88e2('0x1b')]();queues[_0x527ec8[_0x88e2('0x43')]][_0x88e2('0x31')]=utils[_0x88e2('0x1b')]();queues[_0x527ec8['transfereeuniqueid']][_0x88e2('0x54')]=0x0;queues[_0x527ec8[_0x88e2('0x43')]][_0x88e2('0x55')]=0x0;utils['info'](util[_0x88e2('0xf')](_0x88e2('0x56'),_0x527ec8[_0x88e2('0x4a')],queues[_0x527ec8[_0x88e2('0x43')]][_0x88e2('0x1d')],queues[_0x527ec8['transfereeuniqueid']][_0x88e2('0x5')],queues[_0x527ec8[_0x88e2('0x43')]][_0x88e2('0x53')]));}else{utils[_0x88e2('0x2')](util[_0x88e2('0xf')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x527ec8[_0x88e2('0x4a')],queues[_0x527ec8[_0x88e2('0x4b')]]['name'],_0x527ec8[_0x88e2('0x4c')]));queues[_0x527ec8['origtransfererlinkedid']][_0x88e2('0xb')]=_0x527ec8[_0x88e2('0x4c')];}}}else if(_0x527ec8[_0x88e2('0x57')]==_0x527ec8[_0x88e2('0x4c')]){if(!_['isNil'](queues[_0x527ec8[_0x88e2('0x4b')]])){utils[_0x88e2('0x2')](util[_0x88e2('0xf')](_0x88e2('0x58'),_0x527ec8[_0x88e2('0x4a')],queues[_0x527ec8[_0x88e2('0x4b')]]['name'],_0x527ec8[_0x88e2('0x57')],_0x527ec8[_0x88e2('0x59')]));queues[_0x527ec8[_0x88e2('0x4b')]][_0x88e2('0x40')]=!![];queues[_0x527ec8['origtransfererlinkedid']][_0x88e2('0x45')]='ATTENDED';queues[_0x527ec8['origtransfererlinkedid']][_0x88e2('0x47')]=_0x527ec8[_0x88e2('0x59')];queues[_0x527ec8[_0x88e2('0x4b')]]['transferuniqueid']=_0x527ec8[_0x88e2('0x57')];queues[_0x527ec8[_0x88e2('0x4b')]][_0x88e2('0x6')]=_0x88e2('0x50');}if(!_[_0x88e2('0x15')](queues[_0x527ec8[_0x88e2('0x4c')]])){if(_0x527ec8[_0x88e2('0x5a')]&&queues[_0x527ec8[_0x88e2('0x5a')]]){queues[_0x527ec8['transfertargetlinkedid']][_0x88e2('0x1f')]=0x1;queues[_0x527ec8[_0x88e2('0x52')]]=_[_0x88e2('0x5b')](queues[_0x527ec8[_0x88e2('0x5a')]]);queues[_0x527ec8[_0x88e2('0x52')]][_0x88e2('0xb')]=_0x527ec8['transfertargetuniqueid'];queues[_0x527ec8['transfertargetuniqueid']][_0x88e2('0x1f')]=0x2;queues[_0x527ec8[_0x88e2('0x52')]]['calleridnum']=queues[_0x527ec8[_0x88e2('0x4b')]][_0x88e2('0x5')];queues[_0x527ec8[_0x88e2('0x52')]][_0x88e2('0x53')]=queues[_0x527ec8[_0x88e2('0x4b')]][_0x88e2('0x53')];queues[_0x527ec8[_0x88e2('0x52')]][_0x88e2('0x33')]=utils[_0x88e2('0x1b')]();queues[_0x527ec8[_0x88e2('0x52')]][_0x88e2('0x31')]=utils[_0x88e2('0x1b')]();queues[_0x527ec8[_0x88e2('0x52')]][_0x88e2('0x54')]=0x0;queues[_0x527ec8['transfertargetuniqueid']][_0x88e2('0x55')]=0x0;utils['info'](util['format'](_0x88e2('0x5c'),_0x527ec8[_0x88e2('0x4a')],queues[_0x527ec8['transfertargetuniqueid']][_0x88e2('0x1d')],queues[_0x527ec8['transfertargetuniqueid']][_0x88e2('0xb')],queues[_0x527ec8[_0x88e2('0x52')]][_0x88e2('0x5')],queues[_0x527ec8[_0x88e2('0x52')]][_0x88e2('0x53')]));}else{utils['info'](util['format'](_0x88e2('0x5d'),_0x527ec8[_0x88e2('0x4a')],queues[_0x527ec8[_0x88e2('0x4c')]][_0x88e2('0x1d')],_0x527ec8[_0x88e2('0x4b')]));queues[_0x527ec8['secondtransfererlinkedid']][_0x88e2('0xb')]=_0x527ec8[_0x88e2('0x4b')];}}}}catch(_0x4a2b0e){utils['error'](util[_0x88e2('0xf')](_0x88e2('0x5e'),_0x527ec8[_0x88e2('0x4a')]),_0x4a2b0e);}};exports[_0x88e2('0x5f')]=function(_0x5ac412){try{if(!_['isNil'](queues[_0x5ac412[_0x88e2('0xc')]])){utils['debug'](util['format'](_0x88e2('0x60'),_0x5ac412[_0x88e2('0xc')]),_0x5ac412);queues[_0x5ac412['uniqueid']]['musiconholdstartAt']=utils[_0x88e2('0x1b')]();utils[_0x88e2('0x2')](util[_0x88e2('0xf')](_0x88e2('0x61'),_0x5ac412[_0x88e2('0xc')],queues[_0x5ac412['uniqueid']]['name'],queues[_0x5ac412['uniqueid']][_0x88e2('0x62')]));}}catch(_0x21af26){utils[_0x88e2('0x13')](util[_0x88e2('0xf')](_0x88e2('0x60'),_0x5ac412['uniqueid']),_0x21af26);}};exports[_0x88e2('0x63')]=function(_0x317c6f){try{if(!_['isNil'](queues[_0x317c6f[_0x88e2('0xc')]])){if(!_[_0x88e2('0x15')](queues[_0x317c6f[_0x88e2('0xc')]][_0x88e2('0x62')])){utils['debug'](util[_0x88e2('0xf')](_0x88e2('0x64'),_0x317c6f[_0x88e2('0xc')]),_0x317c6f);queues[_0x317c6f['uniqueid']]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x317c6f[_0x88e2('0xc')]][_0x88e2('0x62')]);utils[_0x88e2('0x2')](util[_0x88e2('0xf')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x317c6f[_0x88e2('0xc')],queues[_0x317c6f['uniqueid']][_0x88e2('0x1d')],queues[_0x317c6f[_0x88e2('0xc')]][_0x88e2('0x55')]));delete queues[_0x317c6f[_0x88e2('0xc')]][_0x88e2('0x62')];}}}catch(_0x2de621){utils[_0x88e2('0x13')](util[_0x88e2('0xf')](_0x88e2('0x64'),_0x317c6f[_0x88e2('0xc')]),_0x2de621);}}; \ No newline at end of file +var _0xd9a1=['[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','musiconholdstartAt','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','queuecallerabandon','queuecallerexit','now','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','queuecallerexitAt','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s'];(function(_0x20fed4,_0x2f7f12){var _0x4398b2=function(_0x577326){while(--_0x577326){_0x20fed4['push'](_0x20fed4['shift']());}};_0x4398b2(++_0x2f7f12);}(_0xd9a1,0x135));var _0x1d9a=function(_0x4af766,_0x3294c0){_0x4af766=_0x4af766-0x0;var _0x137dac=_0xd9a1[_0x4af766];return _0x137dac;};'use strict';var _=require(_0x1d9a('0x0'));var util=require(_0x1d9a('0x1'));var utils=require(_0x1d9a('0x2'));var queues={};function writeDB(_0x5eddb5){utils[_0x1d9a('0x3')](util[_0x1d9a('0x4')](_0x1d9a('0x5'),_0x5eddb5['uniqueid'],_0x5eddb5['channel'],_0x5eddb5[_0x1d9a('0x6')],_0x5eddb5[_0x1d9a('0x7')],_0x5eddb5['calleridnum'],_0x5eddb5[_0x1d9a('0x8')],_0x5eddb5[_0x1d9a('0x9')]));if(_0x5eddb5[_0x1d9a('0x6')]){utils[_0x1d9a('0xa')](_0x5eddb5[_0x1d9a('0x6')])[_0x1d9a('0xb')](function(_0x35464e){if(_0x35464e){_0x5eddb5[_0x1d9a('0xc')]=_0x35464e[_0x1d9a('0xc')];}utils[_0x1d9a('0xd')](_0x1d9a('0xe'),_0x5eddb5);});}else{utils[_0x1d9a('0xd')]('CreateVoiceQueueReport',_0x5eddb5);}if(_0x5eddb5['transfereduniqueid']){delete queues[_0x5eddb5[_0x1d9a('0xf')]];}else{delete queues[_0x5eddb5[_0x1d9a('0x10')]];}}exports[_0x1d9a('0x11')]=function(_0xea186c){try{utils[_0x1d9a('0x12')](util[_0x1d9a('0x4')](_0x1d9a('0x13'),_0xea186c[_0x1d9a('0x10')]),_0xea186c);utils['info'](util[_0x1d9a('0x4')](_0x1d9a('0x14'),_0xea186c[_0x1d9a('0x10')],_0xea186c['queue'],_0xea186c[_0x1d9a('0x15')]));queues[_0xea186c['uniqueid']]=_[_0x1d9a('0x16')](_0xea186c,{'originalposition':_0xea186c[_0x1d9a('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x2d9e85){utils[_0x1d9a('0x17')](util['format']('[%s][queues][queuecallerjoin]',_0xea186c[_0x1d9a('0x10')]),_0x2d9e85);}};exports[_0x1d9a('0x18')]=function(_0x5ca0f4){try{if(!_[_0x1d9a('0x19')](queues[_0x5ca0f4['uniqueid']])){utils[_0x1d9a('0x12')](util[_0x1d9a('0x4')]('[%s][queues][hangup]',_0x5ca0f4['uniqueid']),_0x5ca0f4);if(queues[_0x5ca0f4[_0x1d9a('0x10')]]['queuecallerleaveAt']){if(!queues[_0x5ca0f4[_0x1d9a('0x10')]][_0x1d9a('0x1a')]&&!queues[_0x5ca0f4[_0x1d9a('0x10')]][_0x1d9a('0x1b')]){queues[_0x5ca0f4[_0x1d9a('0x10')]]['queuecallercomplete']=!![];queues[_0x5ca0f4['uniqueid']]['queuecallercompleteAt']=utils[_0x1d9a('0x1c')]();queues[_0x5ca0f4[_0x1d9a('0x10')]][_0x1d9a('0x9')]='COMPLETEDBYAGENT';}utils[_0x1d9a('0x3')](util[_0x1d9a('0x4')](_0x1d9a('0x1d'),_0x5ca0f4[_0x1d9a('0x10')],queues[_0x5ca0f4[_0x1d9a('0x10')]][_0x1d9a('0x1e')],queues[_0x5ca0f4['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x5ca0f4[_0x1d9a('0x10')]]);}else if(queues[_0x5ca0f4['uniqueid']][_0x1d9a('0xf')]){utils[_0x1d9a('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x5ca0f4['uniqueid'],queues[_0x5ca0f4['uniqueid']]['name'],queues[_0x5ca0f4[_0x1d9a('0x10')]][_0x1d9a('0xf')]));queues[queues[_0x5ca0f4[_0x1d9a('0x10')]][_0x1d9a('0xf')]]=queues[_0x5ca0f4[_0x1d9a('0x10')]];queues[queues[_0x5ca0f4[_0x1d9a('0x10')]][_0x1d9a('0xf')]][_0x1d9a('0x1f')]=0x2;delete queues[_0x5ca0f4[_0x1d9a('0x10')]];}}}catch(_0x33b651){utils[_0x1d9a('0x17')](util[_0x1d9a('0x4')](_0x1d9a('0x20'),_0x5ca0f4['uniqueid']),_0x33b651);}};exports[_0x1d9a('0x21')]=function(_0x20440e){try{utils[_0x1d9a('0x12')](util[_0x1d9a('0x4')](_0x1d9a('0x22'),_0x20440e[_0x1d9a('0x10')]),_0x20440e);if(!_[_0x1d9a('0x19')](_0x20440e[_0x1d9a('0x23')][_0x1d9a('0x24')])&&_0x20440e[_0x1d9a('0x25')][_0x1d9a('0x26')]()!=='CONTINUE'){if(!_[_0x1d9a('0x19')](queues[_0x20440e[_0x1d9a('0x10')]])){queues[_0x20440e[_0x1d9a('0x10')]][_0x1d9a('0x1a')]=![];queues[_0x20440e[_0x1d9a('0x10')]]['queuecallerabandonAt']=null;queues[_0x20440e[_0x1d9a('0x10')]][_0x1d9a('0x1b')]=!![];queues[_0x20440e[_0x1d9a('0x10')]][_0x1d9a('0x27')]=utils[_0x1d9a('0x1c')]();queues[_0x20440e[_0x1d9a('0x10')]][_0x1d9a('0x9')]=_0x20440e[_0x1d9a('0x25')][_0x1d9a('0x26')]();utils['info'](util[_0x1d9a('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x20440e[_0x1d9a('0x10')],queues[_0x20440e[_0x1d9a('0x10')]][_0x1d9a('0x1e')],_0x20440e[_0x1d9a('0x25')],queues[_0x20440e['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x20440e[_0x1d9a('0x10')]]);}}else if(!_[_0x1d9a('0x19')](_0x20440e[_0x1d9a('0x23')][_0x1d9a('0x28')])){if(!_[_0x1d9a('0x19')](queues[_0x20440e[_0x1d9a('0x10')]])&&!queues[_0x20440e['uniqueid']][_0x1d9a('0x1a')]){queues[_0x20440e['uniqueid']][_0x1d9a('0x1a')]=![];queues[_0x20440e[_0x1d9a('0x10')]][_0x1d9a('0x29')]=null;queues[_0x20440e[_0x1d9a('0x10')]]['queuecallerexit']=!![];queues[_0x20440e[_0x1d9a('0x10')]][_0x1d9a('0x27')]=utils[_0x1d9a('0x1c')]();queues[_0x20440e[_0x1d9a('0x10')]][_0x1d9a('0x9')]=_0x1d9a('0x2a');utils[_0x1d9a('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x20440e[_0x1d9a('0x10')],queues[_0x20440e[_0x1d9a('0x10')]]['name'],_0x20440e[_0x1d9a('0x25')],queues[_0x20440e[_0x1d9a('0x10')]][_0x1d9a('0x9')]));}}}catch(_0x73c1c3){utils[_0x1d9a('0x17')](util[_0x1d9a('0x4')](_0x1d9a('0x22'),_0x20440e[_0x1d9a('0x10')]),_0x73c1c3);}};exports[_0x1d9a('0x1a')]=function(_0x58a5a1){try{if(!_[_0x1d9a('0x19')](queues[_0x58a5a1[_0x1d9a('0x10')]])){utils[_0x1d9a('0x12')](util[_0x1d9a('0x4')](_0x1d9a('0x2b'),_0x58a5a1['uniqueid']),_0x58a5a1);queues[_0x58a5a1[_0x1d9a('0x10')]][_0x1d9a('0x1b')]=![];queues[_0x58a5a1[_0x1d9a('0x10')]][_0x1d9a('0x27')]=null;queues[_0x58a5a1['uniqueid']][_0x1d9a('0x1a')]=!![];queues[_0x58a5a1[_0x1d9a('0x10')]][_0x1d9a('0x29')]=utils[_0x1d9a('0x1c')]();queues[_0x58a5a1[_0x1d9a('0x10')]][_0x1d9a('0x9')]='ABANDONED';utils['info'](util['format'](_0x1d9a('0x2c'),_0x58a5a1[_0x1d9a('0x10')],queues[_0x58a5a1[_0x1d9a('0x10')]]['name'],queues[_0x58a5a1[_0x1d9a('0x10')]]['queuecallerexitreason']));}}catch(_0x4c25d1){utils[_0x1d9a('0x17')](util[_0x1d9a('0x4')]('[%s][queues][queuecallerabandon]',_0x58a5a1['uniqueid']),_0x4c25d1);}};exports['queuecallerleave']=function(_0x4bf668){try{if(!_[_0x1d9a('0x19')](queues[_0x4bf668[_0x1d9a('0x10')]])){utils[_0x1d9a('0x12')](util['format'](_0x1d9a('0x2d'),_0x4bf668[_0x1d9a('0x10')]),_0x4bf668);utils[_0x1d9a('0x3')](util['format'](_0x1d9a('0x2e'),_0x4bf668[_0x1d9a('0x10')],queues[_0x4bf668[_0x1d9a('0x10')]]['name'],_0x4bf668[_0x1d9a('0x2f')],_0x4bf668[_0x1d9a('0x30')]));queues[_0x4bf668['uniqueid']][_0x1d9a('0x31')]=!![];queues[_0x4bf668[_0x1d9a('0x10')]]['queuecallerleaveAt']=utils[_0x1d9a('0x1c')]();queues[_0x4bf668['uniqueid']][_0x1d9a('0x32')]=utils[_0x1d9a('0x33')](queues[_0x4bf668['uniqueid']][_0x1d9a('0x34')],queues[_0x4bf668[_0x1d9a('0x10')]][_0x1d9a('0x35')]);queues[_0x4bf668['uniqueid']][_0x1d9a('0x15')]=_0x4bf668[_0x1d9a('0x15')];queues[_0x4bf668['uniqueid']][_0x1d9a('0x36')]=_0x4bf668['count'];queues[_0x4bf668[_0x1d9a('0x10')]][_0x1d9a('0x2f')]=_0x4bf668[_0x1d9a('0x2f')];queues[_0x4bf668[_0x1d9a('0x10')]][_0x1d9a('0x30')]=_0x4bf668[_0x1d9a('0x30')];}}catch(_0x457a3c){utils['error'](util[_0x1d9a('0x4')](_0x1d9a('0x2d'),_0x4bf668[_0x1d9a('0x10')]),_0x457a3c);}};exports[_0x1d9a('0x37')]=function(_0x8197ef){try{if(!_[_0x1d9a('0x19')](queues[_0x8197ef[_0x1d9a('0x10')]])){utils[_0x1d9a('0x12')](util[_0x1d9a('0x4')](_0x1d9a('0x38'),_0x8197ef['uniqueid']),_0x8197ef);utils['info'](util['format'](_0x1d9a('0x39'),_0x8197ef[_0x1d9a('0x10')],queues[_0x8197ef[_0x1d9a('0x10')]][_0x1d9a('0x1e')],_0x8197ef[_0x1d9a('0x3a')],_0x8197ef['destaccountcode']));queues[_0x8197ef[_0x1d9a('0x10')]][_0x1d9a('0x1a')]=![];queues[_0x8197ef[_0x1d9a('0x10')]][_0x1d9a('0x1a')]=![];queues[_0x8197ef[_0x1d9a('0x10')]]['queuecallerabandonAt']=null;queues[_0x8197ef[_0x1d9a('0x10')]]['queuecallerexit']=![];queues[_0x8197ef[_0x1d9a('0x10')]][_0x1d9a('0x9')]=null;queues[_0x8197ef['uniqueid']][_0x1d9a('0x27')]=null;queues[_0x8197ef[_0x1d9a('0x10')]][_0x1d9a('0x3b')]=!![];queues[_0x8197ef['uniqueid']][_0x1d9a('0x8')]=_0x8197ef['destaccountcode'];queues[_0x8197ef['uniqueid']][_0x1d9a('0x7')]=_0x8197ef[_0x1d9a('0x3a')];}}catch(_0x14f9b2){utils[_0x1d9a('0x17')](util['format'](_0x1d9a('0x38'),_0x8197ef[_0x1d9a('0x10')]),_0x14f9b2);}};exports['agentcomplete']=function(_0x5bfdc0){try{if(!_[_0x1d9a('0x19')](queues[_0x5bfdc0[_0x1d9a('0x10')]])){if(queues[_0x5bfdc0[_0x1d9a('0x10')]]['queuecallerleaveAt']){utils['debug'](util[_0x1d9a('0x4')](_0x1d9a('0x3c'),_0x5bfdc0[_0x1d9a('0x10')]),_0x5bfdc0);queues[_0x5bfdc0[_0x1d9a('0x10')]]['queuecallerabandon']=![];queues[_0x5bfdc0['uniqueid']]['queuecallerabandon']=![];queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x29')]=null;queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x1b')]=![];queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x27')]=null;queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x3b')]=!![];queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x7')]=_0x5bfdc0['membername'];queues[_0x5bfdc0['uniqueid']][_0x1d9a('0x3d')]=!![];queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x3e')]=utils['now']();if(_0x5bfdc0[_0x1d9a('0x3f')]==_0x1d9a('0x40')){if(!queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x40')]){queues[_0x5bfdc0['uniqueid']][_0x1d9a('0x9')]=_0x1d9a('0x41');}}else{queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x9')]=_0x1d9a('0x42')+_0x5bfdc0[_0x1d9a('0x3f')][_0x1d9a('0x26')]();}utils[_0x1d9a('0x3')](util[_0x1d9a('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x5bfdc0[_0x1d9a('0x10')],queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x1e')],_0x5bfdc0[_0x1d9a('0x3a')],queues[_0x5bfdc0[_0x1d9a('0x10')]][_0x1d9a('0x9')]));writeDB(queues[_0x5bfdc0[_0x1d9a('0x10')]]);}}}catch(_0x2faf58){utils['error'](util[_0x1d9a('0x4')](_0x1d9a('0x3c'),_0x5bfdc0[_0x1d9a('0x10')]),_0x2faf58);}};exports['blindtransfer']=function(_0x17d7a6){try{if(!_['isNil'](queues[_0x17d7a6['transfereeuniqueid']])){utils[_0x1d9a('0x12')](util['format']('[%s][queues][blindtransfer]',_0x17d7a6[_0x1d9a('0x10')]),_0x17d7a6);queues[_0x17d7a6[_0x1d9a('0x43')]]['transfer']=!![];queues[_0x17d7a6[_0x1d9a('0x43')]][_0x1d9a('0x44')]='BLIND';queues[_0x17d7a6[_0x1d9a('0x43')]][_0x1d9a('0x45')]=_0x17d7a6[_0x1d9a('0x46')];queues[_0x17d7a6[_0x1d9a('0x43')]][_0x1d9a('0x47')]=_0x17d7a6[_0x1d9a('0x43')];queues[_0x17d7a6['transfereeuniqueid']]['queuecallerexitreason']='BLINDTRANSFER';utils['info'](util[_0x1d9a('0x4')](_0x1d9a('0x48'),_0x17d7a6['uniqueid'],queues[_0x17d7a6[_0x1d9a('0x43')]]['name'],_0x17d7a6[_0x1d9a('0x43')],_0x17d7a6[_0x1d9a('0x46')]));}}catch(_0x20cde8){utils[_0x1d9a('0x17')](util[_0x1d9a('0x4')]('[%s][queues][blindtransfer]',_0x17d7a6[_0x1d9a('0x10')]),_0x20cde8);}};exports[_0x1d9a('0x49')]=function(_0x46e35a){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x46e35a[_0x1d9a('0x4a')]),_0x46e35a);if(_0x46e35a[_0x1d9a('0x4a')]==_0x46e35a[_0x1d9a('0x4b')]){if(!_[_0x1d9a('0x19')](queues[_0x46e35a[_0x1d9a('0x4c')]])){utils[_0x1d9a('0x3')](util[_0x1d9a('0x4')](_0x1d9a('0x4d'),_0x46e35a[_0x1d9a('0x4a')],queues[_0x46e35a[_0x1d9a('0x4c')]]['name'],_0x46e35a[_0x1d9a('0x4e')]));queues[_0x46e35a[_0x1d9a('0x4c')]][_0x1d9a('0x40')]=!![];queues[_0x46e35a[_0x1d9a('0x4c')]][_0x1d9a('0x44')]=_0x1d9a('0x4f');queues[_0x46e35a[_0x1d9a('0x4c')]]['transferexten']=_0x46e35a['origtransfererexten'];queues[_0x46e35a[_0x1d9a('0x4c')]][_0x1d9a('0x47')]=_0x46e35a[_0x1d9a('0x4a')];queues[_0x46e35a[_0x1d9a('0x4c')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x1d9a('0x19')](queues[_0x46e35a[_0x1d9a('0x4b')]])){if(_0x46e35a[_0x1d9a('0x50')]&&queues[_0x46e35a[_0x1d9a('0x50')]]){queues[_0x46e35a[_0x1d9a('0x50')]][_0x1d9a('0x1f')]=0x1;queues[_0x46e35a['transfereeuniqueid']]=_[_0x1d9a('0x51')](queues[_0x46e35a[_0x1d9a('0x50')]]);queues[_0x46e35a['transfereeuniqueid']][_0x1d9a('0xf')]=_0x46e35a[_0x1d9a('0x52')];queues[_0x46e35a[_0x1d9a('0x43')]]['queuecallerenterreason']=0x2;queues[_0x46e35a[_0x1d9a('0x43')]][_0x1d9a('0x53')]=queues[_0x46e35a[_0x1d9a('0x4c')]]['calleridnum'];queues[_0x46e35a['transfereeuniqueid']][_0x1d9a('0x54')]=queues[_0x46e35a['secondtransfererlinkedid']][_0x1d9a('0x54')];queues[_0x46e35a['transfereeuniqueid']][_0x1d9a('0x35')]=utils[_0x1d9a('0x1c')]();queues[_0x46e35a['transfereeuniqueid']][_0x1d9a('0x34')]=utils[_0x1d9a('0x1c')]();queues[_0x46e35a[_0x1d9a('0x43')]][_0x1d9a('0x32')]=0x0;queues[_0x46e35a['transfereeuniqueid']][_0x1d9a('0x55')]=0x0;utils['info'](util[_0x1d9a('0x4')](_0x1d9a('0x56'),_0x46e35a[_0x1d9a('0x4a')],queues[_0x46e35a['transfereeuniqueid']][_0x1d9a('0x1e')],queues[_0x46e35a['transfereeuniqueid']][_0x1d9a('0x53')],queues[_0x46e35a['transfereeuniqueid']]['calleridname']));}else{utils[_0x1d9a('0x3')](util['format'](_0x1d9a('0x57'),_0x46e35a[_0x1d9a('0x4a')],queues[_0x46e35a[_0x1d9a('0x4b')]]['name'],_0x46e35a['secondtransfererlinkedid']));queues[_0x46e35a['origtransfererlinkedid']][_0x1d9a('0xf')]=_0x46e35a[_0x1d9a('0x4c')];}}}else if(_0x46e35a['secondtransfereruniqueid']==_0x46e35a['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x46e35a[_0x1d9a('0x4b')]])){utils[_0x1d9a('0x3')](util[_0x1d9a('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x46e35a[_0x1d9a('0x4a')],queues[_0x46e35a['origtransfererlinkedid']][_0x1d9a('0x1e')],_0x46e35a[_0x1d9a('0x58')],_0x46e35a[_0x1d9a('0x59')]));queues[_0x46e35a[_0x1d9a('0x4b')]]['transfer']=!![];queues[_0x46e35a[_0x1d9a('0x4b')]][_0x1d9a('0x44')]='ATTENDED';queues[_0x46e35a[_0x1d9a('0x4b')]][_0x1d9a('0x45')]=_0x46e35a['secondtransfererexten'];queues[_0x46e35a[_0x1d9a('0x4b')]][_0x1d9a('0x47')]=_0x46e35a['secondtransfereruniqueid'];queues[_0x46e35a[_0x1d9a('0x4b')]][_0x1d9a('0x9')]=_0x1d9a('0x5a');}if(!_[_0x1d9a('0x19')](queues[_0x46e35a[_0x1d9a('0x4c')]])){if(_0x46e35a[_0x1d9a('0x5b')]&&queues[_0x46e35a['transfertargetlinkedid']]){queues[_0x46e35a[_0x1d9a('0x5b')]]['queuecallerenterreason']=0x1;queues[_0x46e35a[_0x1d9a('0x52')]]=_[_0x1d9a('0x51')](queues[_0x46e35a[_0x1d9a('0x5b')]]);queues[_0x46e35a[_0x1d9a('0x52')]]['transfereduniqueid']=_0x46e35a['transfertargetuniqueid'];queues[_0x46e35a['transfertargetuniqueid']][_0x1d9a('0x1f')]=0x2;queues[_0x46e35a[_0x1d9a('0x52')]][_0x1d9a('0x53')]=queues[_0x46e35a[_0x1d9a('0x4b')]][_0x1d9a('0x53')];queues[_0x46e35a[_0x1d9a('0x52')]][_0x1d9a('0x54')]=queues[_0x46e35a[_0x1d9a('0x4b')]][_0x1d9a('0x54')];queues[_0x46e35a[_0x1d9a('0x52')]][_0x1d9a('0x35')]=utils[_0x1d9a('0x1c')]();queues[_0x46e35a[_0x1d9a('0x52')]]['queuecallerleaveAt']=utils[_0x1d9a('0x1c')]();queues[_0x46e35a[_0x1d9a('0x52')]][_0x1d9a('0x32')]=0x0;queues[_0x46e35a[_0x1d9a('0x52')]][_0x1d9a('0x55')]=0x0;utils['info'](util[_0x1d9a('0x4')](_0x1d9a('0x5c'),_0x46e35a[_0x1d9a('0x4a')],queues[_0x46e35a[_0x1d9a('0x52')]][_0x1d9a('0x1e')],queues[_0x46e35a[_0x1d9a('0x52')]]['transfereduniqueid'],queues[_0x46e35a[_0x1d9a('0x52')]][_0x1d9a('0x53')],queues[_0x46e35a[_0x1d9a('0x52')]][_0x1d9a('0x54')]));}else{utils[_0x1d9a('0x3')](util['format'](_0x1d9a('0x57'),_0x46e35a[_0x1d9a('0x4a')],queues[_0x46e35a['secondtransfererlinkedid']][_0x1d9a('0x1e')],_0x46e35a[_0x1d9a('0x4b')]));queues[_0x46e35a[_0x1d9a('0x4c')]][_0x1d9a('0xf')]=_0x46e35a[_0x1d9a('0x4b')];}}}}catch(_0x42a73f){utils[_0x1d9a('0x17')](util['format'](_0x1d9a('0x5d'),_0x46e35a[_0x1d9a('0x4a')]),_0x42a73f);}};exports[_0x1d9a('0x5e')]=function(_0x7dfa8a){try{if(!_[_0x1d9a('0x19')](queues[_0x7dfa8a[_0x1d9a('0x10')]])){utils['debug'](util[_0x1d9a('0x4')](_0x1d9a('0x5f'),_0x7dfa8a[_0x1d9a('0x10')]),_0x7dfa8a);queues[_0x7dfa8a['uniqueid']]['musiconholdstartAt']=utils['now']();utils[_0x1d9a('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x7dfa8a[_0x1d9a('0x10')],queues[_0x7dfa8a[_0x1d9a('0x10')]][_0x1d9a('0x1e')],queues[_0x7dfa8a['uniqueid']]['musiconholdstartAt']));}}catch(_0x1432e4){utils['error'](util[_0x1d9a('0x4')]('[%s][queues][musiconholdstart]',_0x7dfa8a[_0x1d9a('0x10')]),_0x1432e4);}};exports[_0x1d9a('0x60')]=function(_0x29fe1a){try{if(!_['isNil'](queues[_0x29fe1a['uniqueid']])){if(!_['isNil'](queues[_0x29fe1a[_0x1d9a('0x10')]]['musiconholdstartAt'])){utils['debug'](util['format'](_0x1d9a('0x61'),_0x29fe1a[_0x1d9a('0x10')]),_0x29fe1a);queues[_0x29fe1a['uniqueid']]['mohtime']+=utils[_0x1d9a('0x33')](utils[_0x1d9a('0x1c')](),queues[_0x29fe1a['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0x1d9a('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x29fe1a[_0x1d9a('0x10')],queues[_0x29fe1a[_0x1d9a('0x10')]][_0x1d9a('0x1e')],queues[_0x29fe1a[_0x1d9a('0x10')]][_0x1d9a('0x55')]));delete queues[_0x29fe1a[_0x1d9a('0x10')]][_0x1d9a('0x62')];}}}catch(_0x2ec735){utils[_0x1d9a('0x17')](util[_0x1d9a('0x4')](_0x1d9a('0x61'),_0x29fe1a['uniqueid']),_0x2ec735);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 89ef7cf..9a84fc6 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 _0xa3e1=['lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','context','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','find','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','forEach','clone','newexten','application','appdata','toLowerCase','set','split','substring'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xa3e1,0x13b));var _0x1a3e=function(_0x17925d,_0x46543f){_0x17925d=_0x17925d-0x0;var _0x5492b7=_0xa3e1[_0x17925d];return _0x5492b7;};'use strict';var _=require('lodash');var util=require(_0x1a3e('0x0'));var utils=require(_0x1a3e('0x1'));var recordings={};function writeDB(_0x6f30ac){utils[_0x1a3e('0x2')](util[_0x1a3e('0x3')](_0x1a3e('0x4'),_0x6f30ac['uniqueid']));if(_0x6f30ac[_0x1a3e('0x5')]){utils[_0x1a3e('0x6')](_0x6f30ac['accountcode'])['then'](function(_0x4cbdc5){if(_0x4cbdc5){_0x6f30ac[_0x1a3e('0x7')]=_0x4cbdc5[_0x1a3e('0x8')];_0x6f30ac[_0x1a3e('0x9')]=_0x4cbdc5['id'];}utils[_0x1a3e('0xa')](_0x1a3e('0xb'),_0x6f30ac);});}else{utils[_0x1a3e('0xa')](_0x1a3e('0xb'),_0x6f30ac);}}exports[_0x1a3e('0xc')]=function(_0x2ba883){try{utils[_0x1a3e('0xd')](util['format'](_0x1a3e('0xe'),_0x2ba883[_0x1a3e('0xf')]),_0x2ba883);if(_0x2ba883[_0x1a3e('0xf')]==_0x2ba883[_0x1a3e('0x10')]){utils['info'](util[_0x1a3e('0x3')](_0x1a3e('0x11'),_0x2ba883[_0x1a3e('0xf')],_0x2ba883['context'],_0x2ba883['exten']));recordings[_0x2ba883[_0x1a3e('0xf')]]={'uniqueid':_0x2ba883[_0x1a3e('0xf')],'accountcode':_0x2ba883[_0x1a3e('0x5')],'exten':_0x2ba883[_0x1a3e('0x12')],'context':_0x2ba883['context'],'channel':_0x2ba883[_0x1a3e('0x13')],'monitors':[]};}}catch(_0x5005c9){utils[_0x1a3e('0x14')](util['format'](_0x1a3e('0xe'),_0x2ba883[_0x1a3e('0xf')]),_0x5005c9);}};exports[_0x1a3e('0x15')]=function(_0x16dcb4){try{utils['debug'](util['format'](_0x1a3e('0x16'),_0x16dcb4['uniqueid']),_0x16dcb4);if(!_[_0x1a3e('0x17')](recordings[_0x16dcb4[_0x1a3e('0xf')]])&&_0x16dcb4[_0x1a3e('0x18')]==0x6){utils[_0x1a3e('0x2')](util[_0x1a3e('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x16dcb4[_0x1a3e('0xf')],_0x16dcb4[_0x1a3e('0x19')],_0x16dcb4[_0x1a3e('0x13')]));}else if(!_[_0x1a3e('0x17')](recordings[_0x16dcb4[_0x1a3e('0x10')]])&&_0x16dcb4[_0x1a3e('0x18')]==0x6&&_0x16dcb4[_0x1a3e('0x19')]!=_0x1a3e('0x1a')){utils[_0x1a3e('0x2')](util[_0x1a3e('0x3')](_0x1a3e('0x1b'),_0x16dcb4[_0x1a3e('0xf')],_0x16dcb4[_0x1a3e('0x10')],_0x16dcb4['context'],_0x16dcb4[_0x1a3e('0x13')]));recordings[_0x16dcb4[_0x1a3e('0x10')]][_0x1a3e('0x5')]=_0x16dcb4[_0x1a3e('0x5')];}}catch(_0x5a94ea){utils[_0x1a3e('0x14')](util[_0x1a3e('0x3')]('[%s][recordings][newstate]',_0x16dcb4['uniqueid']),_0x5a94ea);}};exports[_0x1a3e('0x1c')]=function(_0x1abdf2){try{if(!_[_0x1a3e('0x17')](_0x1abdf2['variable'])&&!_[_0x1a3e('0x17')](_0x1abdf2[_0x1a3e('0x1d')][_0x1a3e('0x1e')])){utils['debug'](util[_0x1a3e('0x3')](_0x1a3e('0x1f'),_0x1abdf2[_0x1a3e('0xf')]),_0x1abdf2);utils[_0x1a3e('0x2')](util[_0x1a3e('0x3')](_0x1a3e('0x20'),_0x1abdf2[_0x1a3e('0xf')],_0x1abdf2[_0x1a3e('0x1d')],_0x1abdf2[_0x1a3e('0x21')]));if(_[_0x1a3e('0x22')](_0x1abdf2[_0x1a3e('0x21')],_0x1a3e('0x23'))){_0x1abdf2[_0x1a3e('0x21')]=_0x1abdf2[_0x1a3e('0x21')][_0x1a3e('0x24')](_0x1a3e('0x23'),_0x1a3e('0x25'));}if(recordings[_0x1abdf2['linkedid']]){var _0x2df155=_[_0x1a3e('0x26')](recordings[_0x1abdf2[_0x1a3e('0x10')]]['monitors'],{'value':_0x1abdf2[_0x1a3e('0x21')]});if(_['isNil'](_0x2df155)){recordings[_0x1abdf2[_0x1a3e('0x10')]]['monitors'][_0x1a3e('0x27')]({'value':_0x1abdf2[_0x1a3e('0x21')]});}}}}catch(_0xf02d48){utils[_0x1a3e('0x14')](util[_0x1a3e('0x3')](_0x1a3e('0x1f'),_0x1abdf2[_0x1a3e('0xf')]),_0xf02d48);}};exports[_0x1a3e('0x28')]=function(_0x88d58a){try{if(!_[_0x1a3e('0x17')](recordings[_0x88d58a[_0x1a3e('0xf')]])){utils[_0x1a3e('0xd')](util[_0x1a3e('0x3')](_0x1a3e('0x29'),_0x88d58a['uniqueid']),_0x88d58a);utils[_0x1a3e('0x2')](util[_0x1a3e('0x3')](_0x1a3e('0x2a'),_0x88d58a[_0x1a3e('0xf')],_0x88d58a[_0x1a3e('0x2b')],_0x88d58a[_0x1a3e('0x2c')],_0x88d58a[_0x1a3e('0x2d')]));recordings[_0x88d58a['uniqueid']][_0x1a3e('0x2b')]=_0x88d58a[_0x1a3e('0x2b')];recordings[_0x88d58a[_0x1a3e('0xf')]][_0x1a3e('0x2c')]=_0x88d58a[_0x1a3e('0x2c')];recordings[_0x88d58a[_0x1a3e('0xf')]][_0x1a3e('0x2e')]=_0x88d58a[_0x1a3e('0x2e')];recordings[_0x88d58a[_0x1a3e('0xf')]][_0x1a3e('0x2f')]=_0x88d58a[_0x1a3e('0x2f')];if(recordings[_0x88d58a['uniqueid']]['type']=='outbound'&&recordings[_0x88d58a['uniqueid']][_0x1a3e('0x5')]){recordings[_0x88d58a[_0x1a3e('0xf')]][_0x1a3e('0x2e')]=recordings[_0x88d58a[_0x1a3e('0xf')]][_0x1a3e('0x5')];recordings[_0x88d58a[_0x1a3e('0xf')]][_0x1a3e('0x2f')]='';}recordings[_0x88d58a[_0x1a3e('0xf')]]['monitors'][_0x1a3e('0x30')](function(_0x2b1dd4){var _0x49fc58=_[_0x1a3e('0x31')](recordings[_0x88d58a['uniqueid']]);_0x49fc58[_0x1a3e('0x21')]=_0x2b1dd4[_0x1a3e('0x21')];writeDB(_0x49fc58);});delete recordings[_0x88d58a[_0x1a3e('0xf')]];}}catch(_0x3719b9){utils['error'](util[_0x1a3e('0x3')](_0x1a3e('0x29'),_0x88d58a[_0x1a3e('0xf')]),_0x3719b9);}};exports[_0x1a3e('0x32')]=function(_0x5e7bc2){try{if(!_[_0x1a3e('0x17')](recordings[_0x5e7bc2[_0x1a3e('0xf')]])){utils[_0x1a3e('0xd')](util[_0x1a3e('0x3')]('[%s][recordings][newexten]',_0x5e7bc2[_0x1a3e('0xf')]),_0x5e7bc2);utils['info'](util[_0x1a3e('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x5e7bc2[_0x1a3e('0xf')],_0x5e7bc2[_0x1a3e('0x33')],_0x5e7bc2[_0x1a3e('0x34')]));if(_0x5e7bc2[_0x1a3e('0x33')][_0x1a3e('0x35')]()==_0x1a3e('0x36')&&_['startsWith'](_0x5e7bc2[_0x1a3e('0x34')][_0x1a3e('0x35')](),'cdr')){var _0x2972f0=_0x5e7bc2[_0x1a3e('0x34')][_0x1a3e('0x37')]('=');var _0x37a143=_0x2972f0[0x0][_0x1a3e('0x38')](_0x2972f0[0x0][_0x1a3e('0x39')]('(')+0x1,_0x2972f0[0x0][_0x1a3e('0x39')](')'));var _0x47be74=_0x2972f0[0x1];recordings[_0x5e7bc2[_0x1a3e('0xf')]][_0x37a143]=_0x47be74;}}}catch(_0x5255ad){utils['error'](util['format']('[%s][recordings][newexten]',_0x5e7bc2[_0x1a3e('0xf')]),_0x5255ad);}};exports[_0x1a3e('0x3a')]=function(_0x53296c){try{if(!_['isNil'](recordings[_0x53296c[_0x1a3e('0xf')]])){utils[_0x1a3e('0xd')](util[_0x1a3e('0x3')](_0x1a3e('0x3b'),_0x53296c['uniqueid']),_0x53296c);utils['info'](util[_0x1a3e('0x3')](_0x1a3e('0x3c'),_0x53296c['uniqueid'],_0x53296c[_0x1a3e('0x3d')]));recordings[_0x53296c[_0x1a3e('0xf')]]['queue']=_0x53296c[_0x1a3e('0x3d')];}}catch(_0x2fa8c3){utils[_0x1a3e('0x14')](util[_0x1a3e('0x3')](_0x1a3e('0x3b'),_0x53296c[_0x1a3e('0xf')]),_0x2fa8c3);}}; \ No newline at end of file +var _0x5de6=['linkedid','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s'];(function(_0x8ada75,_0x1c97e5){var _0x421ceb=function(_0xc15b56){while(--_0xc15b56){_0x8ada75['push'](_0x8ada75['shift']());}};_0x421ceb(++_0x1c97e5);}(_0x5de6,0x1bf));var _0x65de=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5de6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x65de('0x0'));var util=require(_0x65de('0x1'));var utils=require(_0x65de('0x2'));var recordings={};function writeDB(_0x3a8cb4){utils[_0x65de('0x3')](util[_0x65de('0x4')]('[%s][recordings][writeDB]',_0x3a8cb4[_0x65de('0x5')]));if(_0x3a8cb4[_0x65de('0x6')]){utils[_0x65de('0x7')](_0x3a8cb4[_0x65de('0x6')])['then'](function(_0x335d70){if(_0x335d70){_0x3a8cb4['membername']=_0x335d70[_0x65de('0x8')];_0x3a8cb4['UserId']=_0x335d70['id'];}utils[_0x65de('0x9')](_0x65de('0xa'),_0x3a8cb4);});}else{utils[_0x65de('0x9')](_0x65de('0xa'),_0x3a8cb4);}}exports[_0x65de('0xb')]=function(_0x4e3e91){try{utils[_0x65de('0xc')](util[_0x65de('0x4')]('[%s][recordings][newchannel]',_0x4e3e91['uniqueid']),_0x4e3e91);if(_0x4e3e91['uniqueid']==_0x4e3e91['linkedid']){utils['info'](util['format'](_0x65de('0xd'),_0x4e3e91[_0x65de('0x5')],_0x4e3e91[_0x65de('0xe')],_0x4e3e91[_0x65de('0xf')]));recordings[_0x4e3e91[_0x65de('0x5')]]={'uniqueid':_0x4e3e91[_0x65de('0x5')],'accountcode':_0x4e3e91['accountcode'],'exten':_0x4e3e91[_0x65de('0xf')],'context':_0x4e3e91[_0x65de('0xe')],'channel':_0x4e3e91['channel'],'monitors':[]};}}catch(_0x2e1d33){utils[_0x65de('0x10')](util[_0x65de('0x4')](_0x65de('0x11'),_0x4e3e91[_0x65de('0x5')]),_0x2e1d33);}};exports['newstate']=function(_0x55563d){try{utils['debug'](util[_0x65de('0x4')](_0x65de('0x12'),_0x55563d[_0x65de('0x5')]),_0x55563d);if(!_['isNil'](recordings[_0x55563d[_0x65de('0x5')]])&&_0x55563d[_0x65de('0x13')]==0x6){utils[_0x65de('0x3')](util[_0x65de('0x4')](_0x65de('0x14'),_0x55563d['uniqueid'],_0x55563d[_0x65de('0xe')],_0x55563d[_0x65de('0x15')]));}else if(!_[_0x65de('0x16')](recordings[_0x55563d['linkedid']])&&_0x55563d[_0x65de('0x13')]==0x6&&_0x55563d[_0x65de('0xe')]!=_0x65de('0x17')){utils[_0x65de('0x3')](util[_0x65de('0x4')](_0x65de('0x18'),_0x55563d[_0x65de('0x5')],_0x55563d[_0x65de('0x19')],_0x55563d[_0x65de('0xe')],_0x55563d['channel']));recordings[_0x55563d[_0x65de('0x19')]]['accountcode']=_0x55563d[_0x65de('0x6')];}}catch(_0x279010){utils[_0x65de('0x10')](util[_0x65de('0x4')](_0x65de('0x12'),_0x55563d[_0x65de('0x5')]),_0x279010);}};exports[_0x65de('0x1a')]=function(_0x1d4b15){try{if(!_['isNil'](_0x1d4b15[_0x65de('0x1b')])&&!_[_0x65de('0x16')](_0x1d4b15[_0x65de('0x1b')][_0x65de('0x1c')])){utils['debug'](util[_0x65de('0x4')](_0x65de('0x1d'),_0x1d4b15[_0x65de('0x5')]),_0x1d4b15);utils[_0x65de('0x3')](util[_0x65de('0x4')](_0x65de('0x1e'),_0x1d4b15[_0x65de('0x5')],_0x1d4b15[_0x65de('0x1b')],_0x1d4b15[_0x65de('0x1f')]));if(_[_0x65de('0x20')](_0x1d4b15[_0x65de('0x1f')],_0x65de('0x21'))){_0x1d4b15[_0x65de('0x1f')]=_0x1d4b15[_0x65de('0x1f')][_0x65de('0x22')](_0x65de('0x21'),'.WAV');}if(recordings[_0x1d4b15[_0x65de('0x19')]]){var _0x1dcce6=_[_0x65de('0x23')](recordings[_0x1d4b15[_0x65de('0x19')]]['monitors'],{'value':_0x1d4b15[_0x65de('0x1f')]});if(_['isNil'](_0x1dcce6)){recordings[_0x1d4b15[_0x65de('0x19')]]['monitors'][_0x65de('0x24')]({'value':_0x1d4b15['value']});}}}}catch(_0x4b253a){utils[_0x65de('0x10')](util['format'](_0x65de('0x1d'),_0x1d4b15['uniqueid']),_0x4b253a);}};exports[_0x65de('0x25')]=function(_0x3022e7){try{if(!_[_0x65de('0x16')](recordings[_0x3022e7[_0x65de('0x5')]])){utils[_0x65de('0xc')](util[_0x65de('0x4')](_0x65de('0x26'),_0x3022e7[_0x65de('0x5')]),_0x3022e7);utils['info'](util[_0x65de('0x4')](_0x65de('0x27'),_0x3022e7[_0x65de('0x5')],_0x3022e7[_0x65de('0x28')],_0x3022e7['calleridname'],_0x3022e7[_0x65de('0x29')]));recordings[_0x3022e7[_0x65de('0x5')]]['calleridnum']=_0x3022e7[_0x65de('0x28')];recordings[_0x3022e7[_0x65de('0x5')]][_0x65de('0x2a')]=_0x3022e7[_0x65de('0x2a')];recordings[_0x3022e7['uniqueid']][_0x65de('0x2b')]=_0x3022e7[_0x65de('0x2b')];recordings[_0x3022e7[_0x65de('0x5')]][_0x65de('0x2c')]=_0x3022e7[_0x65de('0x2c')];if(recordings[_0x3022e7[_0x65de('0x5')]][_0x65de('0x2d')]==_0x65de('0x2e')&&recordings[_0x3022e7['uniqueid']]['accountcode']){recordings[_0x3022e7[_0x65de('0x5')]][_0x65de('0x2b')]=recordings[_0x3022e7[_0x65de('0x5')]][_0x65de('0x6')];recordings[_0x3022e7[_0x65de('0x5')]][_0x65de('0x2c')]='';}recordings[_0x3022e7['uniqueid']]['monitors']['forEach'](function(_0x657d4c){var _0x46fe94=_['clone'](recordings[_0x3022e7[_0x65de('0x5')]]);_0x46fe94['value']=_0x657d4c['value'];writeDB(_0x46fe94);});delete recordings[_0x3022e7[_0x65de('0x5')]];}}catch(_0x4df8cb){utils[_0x65de('0x10')](util['format'](_0x65de('0x26'),_0x3022e7[_0x65de('0x5')]),_0x4df8cb);}};exports[_0x65de('0x2f')]=function(_0x5ab8b8){try{if(!_['isNil'](recordings[_0x5ab8b8[_0x65de('0x5')]])){utils[_0x65de('0xc')](util[_0x65de('0x4')]('[%s][recordings][newexten]',_0x5ab8b8[_0x65de('0x5')]),_0x5ab8b8);utils[_0x65de('0x3')](util['format'](_0x65de('0x30'),_0x5ab8b8[_0x65de('0x5')],_0x5ab8b8[_0x65de('0x31')],_0x5ab8b8[_0x65de('0x32')]));if(_0x5ab8b8['application']['toLowerCase']()==_0x65de('0x33')&&_['startsWith'](_0x5ab8b8['appdata'][_0x65de('0x34')](),_0x65de('0x35'))){var _0x36f335=_0x5ab8b8[_0x65de('0x32')]['split']('=');var _0x1f7d03=_0x36f335[0x0][_0x65de('0x36')](_0x36f335[0x0][_0x65de('0x37')]('(')+0x1,_0x36f335[0x0][_0x65de('0x37')](')'));var _0x201c8a=_0x36f335[0x1];recordings[_0x5ab8b8[_0x65de('0x5')]][_0x1f7d03]=_0x201c8a;}}}catch(_0x184345){utils[_0x65de('0x10')](util[_0x65de('0x4')]('[%s][recordings][newexten]',_0x5ab8b8[_0x65de('0x5')]),_0x184345);}};exports[_0x65de('0x38')]=function(_0x1eab1c){try{if(!_[_0x65de('0x16')](recordings[_0x1eab1c['uniqueid']])){utils[_0x65de('0xc')](util[_0x65de('0x4')]('[%s][recordings][queuecallerjoin]',_0x1eab1c[_0x65de('0x5')]),_0x1eab1c);utils[_0x65de('0x3')](util[_0x65de('0x4')](_0x65de('0x39'),_0x1eab1c[_0x65de('0x5')],_0x1eab1c[_0x65de('0x3a')]));recordings[_0x1eab1c[_0x65de('0x5')]][_0x65de('0x3a')]=_0x1eab1c['queue'];}}catch(_0xcfacb4){utils[_0x65de('0x10')](util[_0x65de('0x4')]('[%s][recordings][queuecallerjoin]',_0x1eab1c['uniqueid']),_0xcfacb4);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index d12c886..a3d4ada 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 _0xb9c7=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','./utils','format','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','[%s][transfers][blindtransfer]','info','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','attended','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename'];(function(_0x59e8c6,_0x847c24){var _0x4e6c5b=function(_0x34f364){while(--_0x34f364){_0x59e8c6['push'](_0x59e8c6['shift']());}};_0x4e6c5b(++_0x847c24);}(_0xb9c7,0xff));var _0x7b9c=function(_0x38befe,_0x553755){_0x38befe=_0x38befe-0x0;var _0x3cb5e1=_0xb9c7[_0x38befe];return _0x3cb5e1;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x7b9c('0x0'));function writeDB(_0x19b81a){utils['info'](util[_0x7b9c('0x1')]('[%s][transfers][writeDB]\x20type:%s',_0x19b81a[_0x7b9c('0x2')]==='attended'?_0x19b81a[_0x7b9c('0x3')]:_0x19b81a[_0x7b9c('0x4')],_0x19b81a[_0x7b9c('0x2')]));utils[_0x7b9c('0x5')](_0x7b9c('0x6'),_0x19b81a);}exports['blindtransfer']=function(_0x390d2c){try{utils[_0x7b9c('0x7')](util[_0x7b9c('0x1')](_0x7b9c('0x8'),_0x390d2c[_0x7b9c('0x4')]),_0x390d2c);utils[_0x7b9c('0x9')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x390d2c[_0x7b9c('0x4')],_0x390d2c[_0x7b9c('0xa')],_0x390d2c[_0x7b9c('0xb')],_0x390d2c[_0x7b9c('0xc')],_0x390d2c[_0x7b9c('0xd')]));_0x390d2c['type']=_0x7b9c('0xe');writeDB(_0x390d2c);}catch(_0x23d1c5){utils[_0x7b9c('0xf')](util[_0x7b9c('0x1')](_0x7b9c('0x8'),_0x390d2c['uniqueid']),_0x23d1c5);}};exports['attendedtransfer']=function(_0x2edb09){try{utils[_0x7b9c('0x7')](util[_0x7b9c('0x1')](_0x7b9c('0x10'),_0x2edb09[_0x7b9c('0x3')]),_0x2edb09);utils[_0x7b9c('0x9')](util[_0x7b9c('0x1')](_0x7b9c('0x11'),_0x2edb09['origtransfereruniqueid'],_0x2edb09[_0x7b9c('0x12')],_0x2edb09[_0x7b9c('0x13')],_0x2edb09['transfertargetcalleridnum'],_0x2edb09[_0x7b9c('0x14')]));_0x2edb09=_[_0x7b9c('0x15')](_0x2edb09,{'transfererchannel':_0x2edb09[_0x7b9c('0x16')],'transferercalleridnum':_0x2edb09[_0x7b9c('0x12')],'transferercalleridname':_0x2edb09[_0x7b9c('0x13')],'transfererconnectedlinenum':_0x2edb09[_0x7b9c('0x17')],'transfererconnectedlinename':_0x2edb09[_0x7b9c('0x18')],'transfereraccountcode':_0x2edb09[_0x7b9c('0x19')],'transferercontext':_0x2edb09[_0x7b9c('0x1a')],'transfererexten':_0x2edb09['secondtransfererexten'],'transfererlinkedid':_0x2edb09[_0x7b9c('0x1b')],'context':_0x2edb09['origtransferercontext'],'extension':_0x2edb09['origtransfererexten'],'type':_0x7b9c('0x1c')});if(_['isNil'](_0x2edb09[_0x7b9c('0x1d')])){_0x2edb09=_['assign'](_0x2edb09,{'transfereechannel':_0x2edb09[_0x7b9c('0x1e')],'transfereecalleridnum':_0x2edb09[_0x7b9c('0x1f')],'transfereecalleridname':_0x2edb09['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2edb09['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2edb09[_0x7b9c('0x20')],'transfereeaccountcode':_0x2edb09['transfertargetaccountcode'],'transfereecontext':_0x2edb09[_0x7b9c('0x21')],'transfereeexten':_0x2edb09[_0x7b9c('0x22')],'transfereelinkedid':_0x2edb09[_0x7b9c('0x23')]});}writeDB(_0x2edb09);}catch(_0x841aa4){utils['error'](util['format'](_0x7b9c('0x10'),_0x2edb09[_0x7b9c('0x3')]),_0x841aa4);}}; \ No newline at end of file +var _0x6ef1=['transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetconnectedlinenum'];(function(_0x47bbd5,_0xfab6bc){var _0xea2a13=function(_0xc1964c){while(--_0xc1964c){_0x47bbd5['push'](_0x47bbd5['shift']());}};_0xea2a13(++_0xfab6bc);}(_0x6ef1,0x76));var _0x16ef=function(_0x765fe4,_0x2d0b5c){_0x765fe4=_0x765fe4-0x0;var _0x5226af=_0x6ef1[_0x765fe4];return _0x5226af;};'use strict';var _=require(_0x16ef('0x0'));var util=require(_0x16ef('0x1'));var utils=require('./utils');function writeDB(_0x4e0d68){utils[_0x16ef('0x2')](util[_0x16ef('0x3')](_0x16ef('0x4'),_0x4e0d68['type']===_0x16ef('0x5')?_0x4e0d68['origtransfereruniqueid']:_0x4e0d68[_0x16ef('0x6')],_0x4e0d68['type']));utils['request'](_0x16ef('0x7'),_0x4e0d68);}exports[_0x16ef('0x8')]=function(_0x5c3fe){try{utils[_0x16ef('0x9')](util[_0x16ef('0x3')](_0x16ef('0xa'),_0x5c3fe['uniqueid']),_0x5c3fe);utils[_0x16ef('0x2')](util[_0x16ef('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5c3fe['uniqueid'],_0x5c3fe[_0x16ef('0xb')],_0x5c3fe[_0x16ef('0xc')],_0x5c3fe[_0x16ef('0xd')],_0x5c3fe[_0x16ef('0xe')]));_0x5c3fe[_0x16ef('0xf')]=_0x16ef('0x10');writeDB(_0x5c3fe);}catch(_0x240b7e){utils[_0x16ef('0x11')](util[_0x16ef('0x3')](_0x16ef('0xa'),_0x5c3fe[_0x16ef('0x6')]),_0x240b7e);}};exports[_0x16ef('0x12')]=function(_0x3f2f35){try{utils[_0x16ef('0x9')](util[_0x16ef('0x3')](_0x16ef('0x13'),_0x3f2f35[_0x16ef('0x14')]),_0x3f2f35);utils[_0x16ef('0x2')](util[_0x16ef('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3f2f35['origtransfereruniqueid'],_0x3f2f35[_0x16ef('0x15')],_0x3f2f35[_0x16ef('0x16')],_0x3f2f35[_0x16ef('0x17')],_0x3f2f35[_0x16ef('0x18')]));_0x3f2f35=_['assign'](_0x3f2f35,{'transfererchannel':_0x3f2f35['origtransfererchannel'],'transferercalleridnum':_0x3f2f35[_0x16ef('0x15')],'transferercalleridname':_0x3f2f35['origtransferercalleridname'],'transfererconnectedlinenum':_0x3f2f35['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3f2f35[_0x16ef('0x19')],'transfereraccountcode':_0x3f2f35['origtransfereraccountcode'],'transferercontext':_0x3f2f35['secondtransferercontext'],'transfererexten':_0x3f2f35[_0x16ef('0x1a')],'transfererlinkedid':_0x3f2f35[_0x16ef('0x1b')],'context':_0x3f2f35[_0x16ef('0x1c')],'extension':_0x3f2f35[_0x16ef('0x1d')],'type':'attended'});if(_[_0x16ef('0x1e')](_0x3f2f35[_0x16ef('0x1f')])){_0x3f2f35=_[_0x16ef('0x20')](_0x3f2f35,{'transfereechannel':_0x3f2f35['transfertargetchannel'],'transfereecalleridnum':_0x3f2f35['transfertargetcalleridnum'],'transfereecalleridname':_0x3f2f35[_0x16ef('0x18')],'transfereeconnectedlinenum':_0x3f2f35[_0x16ef('0x21')],'transfereeconnectedlinename':_0x3f2f35['transfertargetconnectedlinename'],'transfereeaccountcode':_0x3f2f35[_0x16ef('0x22')],'transfereecontext':_0x3f2f35[_0x16ef('0x23')],'transfereeexten':_0x3f2f35[_0x16ef('0x24')],'transfereelinkedid':_0x3f2f35[_0x16ef('0x25')]});}writeDB(_0x3f2f35);}catch(_0x1fade6){utils['error'](util[_0x16ef('0x3')](_0x16ef('0x13'),_0x3f2f35[_0x16ef('0x14')]),_0x1fade6);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 2c5286d..1bd1709 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 _0xfce5=['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]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','seconds','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','stringify','result'];(function(_0x27e11e,_0x41e13b){var _0x362466=function(_0x2f7ec5){while(--_0x2f7ec5){_0x27e11e['push'](_0x27e11e['shift']());}};_0x362466(++_0x41e13b);}(_0xfce5,0x1d5));var _0x5fce=function(_0xafdec6,_0x3d94df){_0xafdec6=_0xafdec6-0x0;var _0x372bdb=_0xfce5[_0xafdec6];return _0x372bdb;};'use strict';var BPromise=require(_0x5fce('0x0'));var jayson=require(_0x5fce('0x1'));var moment=require(_0x5fce('0x2'));var util=require(_0x5fce('0x3'));var client=jayson['client'][_0x5fce('0x4')]({'port':0x2329});var logger=require(_0x5fce('0x5'))(_0x5fce('0x6'));exports['info']=function(_0x301c5c,_0x4606b8){logger[_0x5fce('0x7')](_0x301c5c,_0x4606b8?util[_0x5fce('0x8')](_0x4606b8,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x345bce,_0xb94cff){logger[_0x5fce('0x9')](_0x345bce,_0xb94cff?util[_0x5fce('0x8')](_0xb94cff,{'showHidden':![],'depth':null}):'');};exports[_0x5fce('0xa')]=function(_0x53fce4,_0x4e438d){logger[_0x5fce('0xa')](_0x53fce4,_0x4e438d?util[_0x5fce('0x8')](_0x4e438d,{'showHidden':![],'depth':null}):'');};exports[_0x5fce('0xb')]=function(_0x5d02ad,_0x4bbe1a){return client['request'](_0x5d02ad,{'body':_0x4bbe1a})[_0x5fce('0xc')](function(_0x2d7971){logger[_0x5fce('0x9')](_0x5fce('0xd'),_0x5d02ad,_0x2d7971?util[_0x5fce('0x8')](_0x2d7971,{'showHidden':![],'depth':null}):'');})[_0x5fce('0xe')](function(_0xbafa62){logger[_0x5fce('0xa')](_0x5fce('0xd'),_0x5d02ad,_0xbafa62?util[_0x5fce('0x8')](_0xbafa62,{'showHidden':![],'depth':null}):'');});};function getUser(_0x594df4){return client[_0x5fce('0xb')](_0x5fce('0xf'),{'options':{'raw':!![],'attributes':['id',_0x5fce('0x10'),_0x5fce('0x11'),_0x5fce('0x12')],'where':_0x594df4,'limit':0x1}})['then'](function(_0x13c9ae){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0x5fce('0x13')](_0x594df4),_0x13c9ae?util[_0x5fce('0x8')](_0x13c9ae,{'showHidden':![],'depth':null}):'');return _0x13c9ae[_0x5fce('0x14')][_0x5fce('0x15')]?_0x13c9ae[_0x5fce('0x14')][0x0]:null;});}exports['getUserByInternal']=function(_0x426bd4){return new BPromise(function(_0x273653,_0x1827a5){if(_0x426bd4){return getUser({'internal':_0x426bd4})['then'](function(_0x5617b2){logger[_0x5fce('0x7')](_0x5fce('0x16'),_0x426bd4,_0x5617b2?_0x5fce('0x17'):_0x5fce('0x18'));return _0x273653(_0x5617b2);})['catch'](function(_0x1bd215){logger[_0x5fce('0xa')](_0x5fce('0x19'),_0x1bd215?util[_0x5fce('0x8')](_0x1bd215,{'showHidden':![],'depth':null}):'');return _0x273653(null);});}return _0x273653(null);});};exports[_0x5fce('0x1a')]=function(_0x52fd16){return new BPromise(function(_0x544160,_0x3d0cf8){if(_0x52fd16){return getUser({'interface':_0x52fd16})[_0x5fce('0xc')](function(_0x3fb355){logger[_0x5fce('0x7')](_0x5fce('0x1b'),_0x52fd16,_0x3fb355?_0x5fce('0x17'):_0x5fce('0x18'));return _0x544160(_0x3fb355);})[_0x5fce('0xe')](function(_0x529955){logger[_0x5fce('0xa')](_0x5fce('0x1c'),_0x529955?util[_0x5fce('0x8')](_0x529955,{'showHidden':![],'depth':null}):'');return _0x544160(null);});}return _0x544160(null);});};exports['getUserByName']=function(_0x1028e4){return new BPromise(function(_0x3a5506,_0x43a1fa){if(_0x1028e4){return getUser({'name':_0x1028e4})[_0x5fce('0xc')](function(_0x49157e){logger[_0x5fce('0x7')](_0x5fce('0x1d'),_0x1028e4,_0x49157e?_0x5fce('0x17'):_0x5fce('0x18'));return _0x3a5506(_0x49157e);})[_0x5fce('0xe')](function(_0x35f7a1){logger['error'](_0x5fce('0x1e'),_0x35f7a1?util[_0x5fce('0x8')](_0x35f7a1,{'showHidden':![],'depth':null}):'');return _0x3a5506(null);});}return _0x3a5506(null);});};exports[_0x5fce('0x1f')]=function(_0x1accec){return new BPromise(function(_0x3f27bb,_0x32c907){if(_0x1accec){return client[_0x5fce('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x5fce('0x11'),_0x5fce('0x20'),_0x5fce('0x21'),_0x5fce('0x22')],'where':{'name':_0x1accec},'limit':0x1}})['then'](function(_0x269100){logger[_0x5fce('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x1accec,_0x269100?util[_0x5fce('0x8')](_0x269100,{'showHidden':![],'depth':null}):'');logger['info'](_0x5fce('0x23'),_0x1accec,_0x269100?_0x5fce('0x17'):_0x5fce('0x18'));return _0x3f27bb(_0x269100[_0x5fce('0x14')]['length']?_0x269100['result'][0x0]:null);})[_0x5fce('0xe')](function(_0xdf86c0){logger[_0x5fce('0xa')](_0x5fce('0x24'),_0xdf86c0?util[_0x5fce('0x8')](_0xdf86c0,{'showHidden':![],'depth':null}):'');return _0x3f27bb(null);});}return _0x3f27bb(null);});};exports[_0x5fce('0x25')]=function(_0x58ac44,_0x31c56b){return moment(_0x58ac44)[_0x5fce('0x26')](_0x31c56b,'seconds')[_0x5fce('0x27')](_0x5fce('0x28'));};exports['subtractTime']=function(_0xf8539a,_0x338ec8){return moment(_0xf8539a)[_0x5fce('0x29')](_0x338ec8,'seconds')[_0x5fce('0x27')](_0x5fce('0x28'));};exports[_0x5fce('0x2a')]=function(_0x205043,_0x278fe4){return moment(_0x205043)[_0x5fce('0x2b')](moment(_0x278fe4),_0x5fce('0x2c'));};exports[_0x5fce('0x2d')]=function(_0x4e3624,_0x547cec){return parseInt(_0x4e3624,0xa)+parseInt(_0x547cec,0xa);};exports[_0x5fce('0x2e')]=function(){return moment()[_0x5fce('0x27')](_0x5fce('0x28'));};exports[_0x5fce('0x2f')]=function(_0x423d2c,_0x5a3043){if(_0x5a3043){return moment(_0x423d2c)['isAfter'](_0x5a3043);}return!![];};exports[_0x5fce('0x30')]=function(_0x543953,_0x20aadc){if(_0x20aadc){return moment(_0x543953)[_0x5fce('0x30')](_0x20aadc);}else if(_0x543953){return!![];}return![];}; \ No newline at end of file +var _0xa498=['isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','inspect','error','request','then','catch','internal','name','[utils][getUser]\x20where:%s','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','debug','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter'];(function(_0x2fd5fd,_0x48858c){var _0x70b7c9=function(_0x3bcac4){while(--_0x3bcac4){_0x2fd5fd['push'](_0x2fd5fd['shift']());}};_0x70b7c9(++_0x48858c);}(_0xa498,0x179));var _0x8a49=function(_0x4080dd,_0x5b595d){_0x4080dd=_0x4080dd-0x0;var _0x4ecf85=_0xa498[_0x4080dd];return _0x4ecf85;};'use strict';var BPromise=require(_0x8a49('0x0'));var jayson=require(_0x8a49('0x1'));var moment=require(_0x8a49('0x2'));var util=require('util');var client=jayson[_0x8a49('0x3')][_0x8a49('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x8a49('0x5'));exports[_0x8a49('0x6')]=function(_0xecc049,_0x2e7948){logger[_0x8a49('0x6')](_0xecc049,_0x2e7948?util[_0x8a49('0x7')](_0x2e7948,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x3208de,_0x4fd343){logger['debug'](_0x3208de,_0x4fd343?util[_0x8a49('0x7')](_0x4fd343,{'showHidden':![],'depth':null}):'');};exports[_0x8a49('0x8')]=function(_0x3f8837,_0x43f5ff){logger[_0x8a49('0x8')](_0x3f8837,_0x43f5ff?util[_0x8a49('0x7')](_0x43f5ff,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2ae425,_0x224a4b){return client[_0x8a49('0x9')](_0x2ae425,{'body':_0x224a4b})[_0x8a49('0xa')](function(_0x6ba9d){logger['debug']('[utils][request]\x20name:%s',_0x2ae425,_0x6ba9d?util['inspect'](_0x6ba9d,{'showHidden':![],'depth':null}):'');})[_0x8a49('0xb')](function(_0x5b7fe8){logger[_0x8a49('0x8')]('[utils][request]\x20name:%s',_0x2ae425,_0x5b7fe8?util['inspect'](_0x5b7fe8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x6c9f58){return client[_0x8a49('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x8a49('0xc'),_0x8a49('0xd'),'interface'],'where':_0x6c9f58,'limit':0x1}})[_0x8a49('0xa')](function(_0x424925){logger['debug'](_0x8a49('0xe'),JSON['stringify'](_0x6c9f58),_0x424925?util[_0x8a49('0x7')](_0x424925,{'showHidden':![],'depth':null}):'');return _0x424925['result']['length']?_0x424925['result'][0x0]:null;});}exports[_0x8a49('0xf')]=function(_0x29f19d){return new BPromise(function(_0x563bbc,_0x4425ee){if(_0x29f19d){return getUser({'internal':_0x29f19d})[_0x8a49('0xa')](function(_0x38a547){logger[_0x8a49('0x6')](_0x8a49('0x10'),_0x29f19d,_0x38a547?_0x8a49('0x11'):'notfound');return _0x563bbc(_0x38a547);})[_0x8a49('0xb')](function(_0x546c25){logger[_0x8a49('0x8')](_0x8a49('0x12'),_0x546c25?util['inspect'](_0x546c25,{'showHidden':![],'depth':null}):'');return _0x563bbc(null);});}return _0x563bbc(null);});};exports['getUserByInterface']=function(_0x14bfb2){return new BPromise(function(_0x301051,_0x413ee6){if(_0x14bfb2){return getUser({'interface':_0x14bfb2})[_0x8a49('0xa')](function(_0xcebf3e){logger['info'](_0x8a49('0x13'),_0x14bfb2,_0xcebf3e?_0x8a49('0x11'):_0x8a49('0x14'));return _0x301051(_0xcebf3e);})[_0x8a49('0xb')](function(_0x4b895f){logger[_0x8a49('0x8')](_0x8a49('0x15'),_0x4b895f?util[_0x8a49('0x7')](_0x4b895f,{'showHidden':![],'depth':null}):'');return _0x301051(null);});}return _0x301051(null);});};exports[_0x8a49('0x16')]=function(_0x3f9ea6){return new BPromise(function(_0x493380,_0x4d177a){if(_0x3f9ea6){return getUser({'name':_0x3f9ea6})[_0x8a49('0xa')](function(_0x2ab78a){logger['info'](_0x8a49('0x17'),_0x3f9ea6,_0x2ab78a?_0x8a49('0x11'):_0x8a49('0x14'));return _0x493380(_0x2ab78a);})[_0x8a49('0xb')](function(_0x4d133e){logger[_0x8a49('0x8')](_0x8a49('0x18'),_0x4d133e?util[_0x8a49('0x7')](_0x4d133e,{'showHidden':![],'depth':null}):'');return _0x493380(null);});}return _0x493380(null);});};exports[_0x8a49('0x19')]=function(_0x59e4a9){return new BPromise(function(_0x1dc14a,_0x31673a){if(_0x59e4a9){return client[_0x8a49('0x9')](_0x8a49('0x1a'),{'options':{'raw':!![],'attributes':['id',_0x8a49('0xd'),_0x8a49('0x1b'),_0x8a49('0x1c'),'acwTimeout'],'where':{'name':_0x59e4a9},'limit':0x1}})['then'](function(_0x37df1e){logger[_0x8a49('0x1d')](_0x8a49('0x1e'),_0x59e4a9,_0x37df1e?util[_0x8a49('0x7')](_0x37df1e,{'showHidden':![],'depth':null}):'');logger['info'](_0x8a49('0x1f'),_0x59e4a9,_0x37df1e?_0x8a49('0x11'):_0x8a49('0x14'));return _0x1dc14a(_0x37df1e[_0x8a49('0x20')][_0x8a49('0x21')]?_0x37df1e['result'][0x0]:null);})[_0x8a49('0xb')](function(_0x53858c){logger[_0x8a49('0x8')](_0x8a49('0x22'),_0x53858c?util[_0x8a49('0x7')](_0x53858c,{'showHidden':![],'depth':null}):'');return _0x1dc14a(null);});}return _0x1dc14a(null);});};exports[_0x8a49('0x23')]=function(_0x4871ec,_0x3ef235){return moment(_0x4871ec)[_0x8a49('0x24')](_0x3ef235,_0x8a49('0x25'))[_0x8a49('0x26')](_0x8a49('0x27'));};exports['subtractTime']=function(_0x2220cb,_0x2ed4d6){return moment(_0x2220cb)[_0x8a49('0x28')](_0x2ed4d6,_0x8a49('0x25'))['format'](_0x8a49('0x27'));};exports[_0x8a49('0x29')]=function(_0x561f9f,_0x556051){return moment(_0x561f9f)[_0x8a49('0x2a')](moment(_0x556051),_0x8a49('0x25'));};exports[_0x8a49('0x2b')]=function(_0x11f616,_0x5f31b7){return parseInt(_0x11f616,0xa)+parseInt(_0x5f31b7,0xa);};exports[_0x8a49('0x2c')]=function(){return moment()['format'](_0x8a49('0x27'));};exports[_0x8a49('0x2d')]=function(_0x346f0c,_0x15ab50){if(_0x15ab50){return moment(_0x346f0c)[_0x8a49('0x2d')](_0x15ab50);}return!![];};exports[_0x8a49('0x2e')]=function(_0x332614,_0x1676d3){if(_0x1676d3){return moment(_0x332614)[_0x8a49('0x2e')](_0x1676d3);}else if(_0x332614){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 ee0f052..a14c42c 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 _0x1040=['fs-extra','lodash','express-winston','path','util','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','name','ensureDir','catch','user','then','no-user','data','api','auth','set','use','logger','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','role','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x1040,0x12d));var _0x0104=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x1040[_0x3c4062];return _0x3f5bf3;};var fs=require(_0x0104('0x0'));var _=require(_0x0104('0x1'));var ewinston=require(_0x0104('0x2'));var path=require(_0x0104('0x3'));var util=require(_0x0104('0x4'));var fileLogger=require('./loggers')[_0x0104('0x5')];var safeTemplate=require('./safe-template')[_0x0104('0x6')];var maskSensitiveData=require(_0x0104('0x7'))[_0x0104('0x8')];function ClientSideLogger(){function _0x734e77(_0x864667){var _0x414f0a=path[_0x0104('0x9')](_0x0104('0xa'),_0x0104('0xb'),'xcally');var _0x4a2e50=path['join'](_0x0104('0xc'),_0x864667['role']+'-'+_0x864667[_0x0104('0xd')]);return fs[_0x0104('0xe')](path[_0x0104('0x9')](_0x414f0a,_0x4a2e50))['then'](function(){var _0x12c39e=fileLogger('client',path[_0x0104('0x9')](_0x414f0a,_0x4a2e50));return _0x12c39e;})[_0x0104('0xf')](function(_0x5f0772){throw _0x5f0772;});}this[_0x0104('0xb')]=function(_0x470e52,_0x41b5bc,_0x3fc2b0,_0x4c5279){return _0x734e77(_0x470e52[_0x0104('0x10')])[_0x0104('0x11')](function(_0x378096){var _0x3e49c4=_0x378096[_0x41b5bc];return _0x3e49c4;})[_0x0104('0x11')](function(_0x53b1b1){var _0x23ae8e=_0x470e52['user']?_0x470e52[_0x0104('0x10')]['id']:_0x0104('0x12');var _0xdb39be=_0x4c5279[_0x0104('0x13')];var _0x31c74a=_0x4c5279['timestamp'];var _0x1e4ec4=new Date(Number(_0x31c74a));return _0x53b1b1(_0x23ae8e,_0x1e4ec4,_0x3fc2b0,_0xdb39be);})[_0x0104('0xf')](function(_0x5f3b49){fileLogger('client')['error'](_0x5f3b49);});};}function setupLoggers(_0x21323c){return new Promise(function(_0x5ea7ca){var _0x5645ba=new ClientSideLogger();var _0x8b2c2c=fileLogger(_0x0104('0x14'));var _0x208b0f=fileLogger(_0x0104('0x15'));_0x21323c[_0x0104('0x16')]('client-side-logger',_0x5645ba);_0x21323c[_0x0104('0x17')](ewinston[_0x0104('0x18')]({'winstonInstance':_0x8b2c2c,'meta':![],'statusLevels':!![],'msg':function(_0x27888f,_0x203f57){var _0x1137a5='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x0104('0x19')](_0x27888f[_0x0104('0x1a')])){_0x1137a5+=_0x0104('0x1b');var _0x238e16=_0x27888f[_0x0104('0x1a')];maskSensitiveData(_0x238e16);}return safeTemplate(util[_0x0104('0x1c')](_0x1137a5,_0x27888f[_0x0104('0x1d')],_0x27888f[_0x0104('0x1e')][_0x0104('0x1f')]?_0x27888f['headers'][_0x0104('0x1f')]:_0x27888f[_0x0104('0x20')][_0x0104('0x21')]||_0x27888f['ip'],_0x27888f[_0x0104('0x22')],_0x203f57[_0x0104('0x23')],_0x203f57['responseTime'],_0x27888f[_0x0104('0x10')]?_0x27888f[_0x0104('0x10')]['id']:null,_0x27888f['user']?_0x27888f[_0x0104('0x10')]['name']:null,_0x27888f[_0x0104('0x10')]?_0x27888f[_0x0104('0x10')][_0x0104('0x24')]:null,_0x238e16?util[_0x0104('0x25')](_0x238e16,![],null):''));}}));_0x21323c['use'](ewinston[_0x0104('0x18')]({'winstonInstance':_0x208b0f,'meta':![],'statusLevels':!![],'msg':function(_0x175229,_0x3574a0){var _0xe5610a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x175229[_0x0104('0x1a')]&&_0x175229[_0x0104('0x1a')][_0x0104('0x26')]&&_0x175229[_0x0104('0x1a')][_0x0104('0x27')]){_0xe5610a=_0x0104('0x28');}return util[_0x0104('0x1c')](_0xe5610a,_0x175229[_0x0104('0x1d')],_0x175229[_0x0104('0x1e')][_0x0104('0x1f')]?_0x175229[_0x0104('0x1e')][_0x0104('0x1f')]:_0x175229['connection'][_0x0104('0x21')]||_0x175229['ip'],_0x175229[_0x0104('0x22')],_0x3574a0[_0x0104('0x23')],_0x3574a0['responseTime'],_0x175229['user']?_0x175229['user']['id']:null,_0x175229[_0x0104('0x10')]?_0x175229['user']['name']:null,_0x175229[_0x0104('0x10')]?_0x175229['user'][_0x0104('0x24')]:null,_0x175229[_0x0104('0x1a')]&&_0x175229[_0x0104('0x1a')]['device']?_0x175229['body']['device']:_0x0104('0x29'),_0x175229[_0x0104('0x1a')]&&_0x175229[_0x0104('0x1a')][_0x0104('0x27')]?_0x175229[_0x0104('0x1a')]['agent_id']:'',_0x175229[_0x0104('0x1a')]&&_0x175229[_0x0104('0x1a')][_0x0104('0x2a')]?_0x175229[_0x0104('0x1a')][_0x0104('0x2a')]:'');},'ignoreRoute':function(_0x49c868){var _0x105da0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x105da0['test'](_0x49c868['url']);}}));return _0x5ea7ca();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x20cb=['user','no-user','timestamp','error','api','auth','set','client-side-logger','use','logger','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','statusCode','responseTime','name','role','agent_id','remoteAddress','url','device','other','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','then','client','catch','log'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x20cb,0x18d));var _0xb20c=function(_0x924cad,_0x4f647b){_0x924cad=_0x924cad-0x0;var _0xf57374=_0x20cb[_0x924cad];return _0xf57374;};var fs=require(_0xb20c('0x0'));var _=require('lodash');var ewinston=require(_0xb20c('0x1'));var path=require(_0xb20c('0x2'));var util=require(_0xb20c('0x3'));var fileLogger=require(_0xb20c('0x4'))[_0xb20c('0x5')];var safeTemplate=require(_0xb20c('0x6'))[_0xb20c('0x7')];var maskSensitiveData=require(_0xb20c('0x8'))[_0xb20c('0x9')];function ClientSideLogger(){function _0x7f8fcc(_0x11d0fd){var _0x3de74a=path[_0xb20c('0xa')](_0xb20c('0xb'),'log',_0xb20c('0xc'));var _0x2f7cc5=path[_0xb20c('0xa')]('client',_0x11d0fd['role']+'-'+_0x11d0fd['name']);return fs['ensureDir'](path[_0xb20c('0xa')](_0x3de74a,_0x2f7cc5))[_0xb20c('0xd')](function(){var _0x45cd33=fileLogger(_0xb20c('0xe'),path[_0xb20c('0xa')](_0x3de74a,_0x2f7cc5));return _0x45cd33;})[_0xb20c('0xf')](function(_0x25a89c){throw _0x25a89c;});}this[_0xb20c('0x10')]=function(_0x1a44b5,_0x43fe73,_0x4f38e5,_0xa8d7d){return _0x7f8fcc(_0x1a44b5[_0xb20c('0x11')])['then'](function(_0x32f832){var _0x5a6b78=_0x32f832[_0x43fe73];return _0x5a6b78;})[_0xb20c('0xd')](function(_0x38450d){var _0x32a99b=_0x1a44b5[_0xb20c('0x11')]?_0x1a44b5['user']['id']:_0xb20c('0x12');var _0x109567=_0xa8d7d['data'];var _0x507d90=_0xa8d7d[_0xb20c('0x13')];var _0x837592=new Date(Number(_0x507d90));return _0x38450d(_0x32a99b,_0x837592,_0x4f38e5,_0x109567);})[_0xb20c('0xf')](function(_0x4d3b64){fileLogger('client')[_0xb20c('0x14')](_0x4d3b64);});};}function setupLoggers(_0x32520f){return new Promise(function(_0x578cb6){var _0xb0e022=new ClientSideLogger();var _0x178a5b=fileLogger(_0xb20c('0x15'));var _0x38359b=fileLogger(_0xb20c('0x16'));_0x32520f[_0xb20c('0x17')](_0xb20c('0x18'),_0xb0e022);_0x32520f[_0xb20c('0x19')](ewinston[_0xb20c('0x1a')]({'winstonInstance':_0x178a5b,'meta':![],'statusLevels':!![],'msg':function(_0x4a520d,_0x42daa9){var _0x115e6b='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x4a520d['body'])){_0x115e6b+=_0xb20c('0x1b');var _0x5298bd=_0x4a520d[_0xb20c('0x1c')];maskSensitiveData(_0x5298bd);}return safeTemplate(util[_0xb20c('0x1d')](_0x115e6b,_0x4a520d[_0xb20c('0x1e')],_0x4a520d[_0xb20c('0x1f')][_0xb20c('0x20')]?_0x4a520d['headers'][_0xb20c('0x20')]:_0x4a520d[_0xb20c('0x21')]['remoteAddress']||_0x4a520d['ip'],_0x4a520d['url'],_0x42daa9[_0xb20c('0x22')],_0x42daa9[_0xb20c('0x23')],_0x4a520d[_0xb20c('0x11')]?_0x4a520d[_0xb20c('0x11')]['id']:null,_0x4a520d[_0xb20c('0x11')]?_0x4a520d[_0xb20c('0x11')][_0xb20c('0x24')]:null,_0x4a520d[_0xb20c('0x11')]?_0x4a520d[_0xb20c('0x11')][_0xb20c('0x25')]:null,_0x5298bd?util['inspect'](_0x5298bd,![],null):''));}}));_0x32520f[_0xb20c('0x19')](ewinston[_0xb20c('0x1a')]({'winstonInstance':_0x38359b,'meta':![],'statusLevels':!![],'msg':function(_0x486692,_0x3ab6be){var _0x36fc45='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x486692[_0xb20c('0x1c')]&&_0x486692['body']['device']&&_0x486692[_0xb20c('0x1c')][_0xb20c('0x26')]){_0x36fc45='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xb20c('0x1d')](_0x36fc45,_0x486692['method'],_0x486692[_0xb20c('0x1f')][_0xb20c('0x20')]?_0x486692['headers'][_0xb20c('0x20')]:_0x486692[_0xb20c('0x21')][_0xb20c('0x27')]||_0x486692['ip'],_0x486692[_0xb20c('0x28')],_0x3ab6be[_0xb20c('0x22')],_0x3ab6be['responseTime'],_0x486692[_0xb20c('0x11')]?_0x486692[_0xb20c('0x11')]['id']:null,_0x486692[_0xb20c('0x11')]?_0x486692[_0xb20c('0x11')][_0xb20c('0x24')]:null,_0x486692[_0xb20c('0x11')]?_0x486692[_0xb20c('0x11')][_0xb20c('0x25')]:null,_0x486692['body']&&_0x486692[_0xb20c('0x1c')]['device']?_0x486692[_0xb20c('0x1c')][_0xb20c('0x29')]:_0xb20c('0x2a'),_0x486692['body']&&_0x486692[_0xb20c('0x1c')]['agent_id']?_0x486692[_0xb20c('0x1c')][_0xb20c('0x26')]:'',_0x486692[_0xb20c('0x1c')]&&_0x486692[_0xb20c('0x1c')][_0xb20c('0x2b')]?_0x486692[_0xb20c('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x1d803b){var _0x23e7f6=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x23e7f6[_0xb20c('0x2c')](_0x1d803b[_0xb20c('0x28')]);}}));return _0x578cb6();});}exports[_0xb20c('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 0c453d7..89743a7 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb096=['max','min','domCompare','format','MMM','guess','test','isMoment','split','padStart','length','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','map','locale','weekdaysShort','indexOf','slice','concat','exports','toLowerCase','circularMonthInterval','clone','isBefore','startOf','day','endOf','isBetween','timeCompare','ddd','includes','dowCompare','date','daysInMonth'];(function(_0x7ff255,_0x262c6a){var _0x2c99e4=function(_0x5b2b06){while(--_0x5b2b06){_0x7ff255['push'](_0x7ff255['shift']());}};_0x2c99e4(++_0x262c6a);}(_0xb096,0x1af));var _0x6b09=function(_0x79978c,_0x34af45){_0x79978c=_0x79978c-0x0;var _0x29f59c=_0xb096[_0x79978c];return _0x29f59c;};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(_0x4b3a51){return _0x4b3a51[_0x6b09('0x0')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6b09('0x1');var EINVALID_DATE=_0x6b09('0x2');function throwIfDateNotValid(_0x936d1f){if(!_0x936d1f['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0xcaa8cd){var _0x37b9d0=_0xcaa8cd['split'](':')[_0x6b09('0x3')](function(_0x30ac3a){return parseInt(_0x30ac3a,0xa);});var _0x49d8be=_0x37b9d0[0x0];var _0x55a907=_0x37b9d0[0x1];if(_0x49d8be<0x0||_0x49d8be>0x17||_0x55a907<0x0||_0x55a907>0x3b){throw new Error(EINVALID_DATE);}return[_0x49d8be,_0x55a907];}function circularDoWInterval(_0x4d8306,_0x44bc36){if(_0x4d8306===_0x44bc36){return[_0x4d8306];}else{var _0x1e3767=moment[_0x6b09('0x4')]();moment[_0x6b09('0x4')]('en');var _0x1087cb=moment[_0x6b09('0x5')]()[_0x6b09('0x3')](function(_0x1f2c97){return _0x1f2c97['toLowerCase']();});moment[_0x6b09('0x4')](_0x1e3767);var _0x54776a=_0x1087cb['indexOf'](_0x4d8306);var _0x27d66e=_0x1087cb[_0x6b09('0x6')](_0x44bc36);if(_0x27d66e>_0x54776a){return _0x1087cb['slice'](_0x54776a,_0x27d66e+0x1);}else{var _0x5323a0=_0x1087cb[_0x6b09('0x7')](0x0,_0x27d66e+0x1);var _0x1a5ec4=_0x1087cb[_0x6b09('0x7')](_0x54776a);return _0x1a5ec4[_0x6b09('0x8')](_0x5323a0);}}}module[_0x6b09('0x9')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x25d4fc,_0x2c0190){if(_0x25d4fc===_0x2c0190){return[_0x25d4fc];}else{var _0x508c47=moment[_0x6b09('0x4')]();moment[_0x6b09('0x4')]('en');var _0x525446=moment['monthsShort']()['map'](function(_0x3e4215){return _0x3e4215[_0x6b09('0xa')]();});moment[_0x6b09('0x4')](_0x508c47);var _0x235a3d=_0x525446['indexOf'](_0x25d4fc);var _0x1f8c4f=_0x525446[_0x6b09('0x6')](_0x2c0190);if(_0x1f8c4f>_0x235a3d){return _0x525446[_0x6b09('0x7')](_0x235a3d,_0x1f8c4f+0x1);}else{var _0x376a79=_0x525446[_0x6b09('0x7')](0x0,_0x1f8c4f+0x1);var _0x55ced7=_0x525446[_0x6b09('0x7')](_0x235a3d);return _0x55ced7[_0x6b09('0x8')](_0x376a79);}}}module[_0x6b09('0x9')][_0x6b09('0xb')]=circularMonthInterval;function parseDom(_0x2741d2){var _0x23751e=parseInt(_0x2741d2,0xa);if(_0x23751e<0x1||_0x23751e>0x1f){throw new Error(EINVALID_DATE);}return _0x23751e;}function timeCompare(_0x58d9ee,_0x396c7d,_0x7ef5d9){var _0x446dbb=_0x58d9ee[_0x6b09('0xc')]();var _0x4fdb32=extractTime(_0x396c7d);var _0x46f13f=_0x4fdb32[0x0];var _0x172bcd=_0x4fdb32[0x1];var _0x29d5dd=_0x58d9ee[_0x6b09('0xc')]()['hours'](_0x46f13f)['minutes'](_0x172bcd);throwIfDateNotValid(_0x29d5dd);var _0x423cb3=extractTime(_0x7ef5d9);var _0x12beb8=_0x423cb3[0x0];var _0x4543e6=_0x423cb3[0x1];var _0xeb65af=_0x58d9ee['clone']()['hours'](_0x12beb8)['minutes'](_0x4543e6);throwIfDateNotValid(_0xeb65af);if(_0xeb65af[_0x6b09('0xd')](_0x29d5dd)){var _0x564f4e=_0x446dbb[_0x6b09('0xc')]()[_0x6b09('0xe')](_0x6b09('0xf'));var _0x4b301b=_0x446dbb[_0x6b09('0xc')]()[_0x6b09('0x10')](_0x6b09('0xf'));return _0x446dbb[_0x6b09('0x11')](_0x29d5dd,_0x4b301b,undefined,'[]')||_0x446dbb[_0x6b09('0x11')](_0x564f4e,_0xeb65af,undefined,'[]');}else{return _0x446dbb[_0x6b09('0x11')](_0x29d5dd,_0xeb65af,undefined,'[]');}}module[_0x6b09('0x9')][_0x6b09('0x12')]=timeCompare;function dowCompare(_0x32c92e,_0x45410a,_0x5a9f14){var _0x175403=_0x32c92e[_0x6b09('0x4')]('en')['format'](_0x6b09('0x13'))[_0x6b09('0xa')]();return circularDoWInterval(_0x45410a,_0x5a9f14)[_0x6b09('0x14')](_0x175403);}module[_0x6b09('0x9')][_0x6b09('0x15')]=dowCompare;function domCompare(_0x504d37,_0x1f3b63,_0x3f2cab){var _0x150d13=_0x504d37[_0x6b09('0x16')]();if(_0x1f3b63===_0x3f2cab){return _0x150d13===_0x1f3b63;}else{var _0x2fa486=_0x504d37[_0x6b09('0x17')]();var _0x2230d8=_0x1f3b63<_0x3f2cab;let _0x1aad80=![];var _0x185a34=0x0;var _0x1b1e96=0x0;if(_0x2230d8){_0x185a34=Math[_0x6b09('0x18')](0x1,_0x1f3b63);_0x1b1e96=Math[_0x6b09('0x19')](_0x3f2cab,_0x2fa486);_0x1aad80=_0x150d13>=_0x185a34&&_0x150d13<=_0x1b1e96;}else{_0x185a34=Math[_0x6b09('0x19')](_0x1f3b63,_0x2fa486);_0x1b1e96=Math['max'](0x1,_0x3f2cab);_0x1aad80=_0x150d13>=_0x185a34||_0x150d13<=_0x1b1e96;}return _0x1aad80;}}module['exports'][_0x6b09('0x1a')]=domCompare;function monthCompare(_0x180663,_0x568528,_0x1dbc9e){var _0x2f2249=_0x180663[_0x6b09('0x4')]('en')[_0x6b09('0x1b')](_0x6b09('0x1c'))['toLowerCase']();return circularMonthInterval(_0x568528,_0x1dbc9e)[_0x6b09('0x14')](_0x2f2249);}module[_0x6b09('0x9')]['monthCompare']=monthCompare;function iftime(_0x43f797,_0x3ad604=moment['tz'][_0x6b09('0x1d')](),_0x3ab481=moment()){if(!validateRx[_0x6b09('0x1e')](_0x43f797)){throw new Error(EINVALID_STRING);}else{var _0x23e4ab=(moment[_0x6b09('0x1f')](_0x3ab481)?_0x3ab481['clone']():moment(_0x3ab481))['tz'](_0x3ad604)['locale']('en');throwIfDateNotValid(_0x23e4ab);var _0x485b76=_0x43f797[_0x6b09('0x20')](',');var _0x500b33=_0x485b76[0x0];var _0x1999a1=_0x485b76[0x1];var _0x290542=_0x485b76[0x2];var _0x5c0518=_0x485b76[0x3];let _0x12907f=!![];if(_0x500b33!=='*'){var _0x388b9b=_0x500b33['split']('-');var _0xab4584=_[_0x6b09('0x21')](_0x388b9b[0x0],0x5,'0');var _0x2b0130=_0x388b9b[_0x6b09('0x22')]===0x2?_[_0x6b09('0x21')](_0x388b9b[0x1],0x5,'0'):_0xab4584;_0x12907f=timeCompare(_0x23e4ab,_0xab4584,_0x2b0130);}let _0x16f4fc=!![];if(_0x1999a1!=='*'){var _0x336a9e=_0x1999a1[_0x6b09('0x20')]('-');var _0x56b359=_0x336a9e[0x0];var _0x28afc1=_0x336a9e[_0x6b09('0x22')]===0x2?_0x336a9e[0x1]:_0x56b359;_0x16f4fc=dowCompare(_0x23e4ab,_0x56b359,_0x28afc1);}let _0x12e8ba=!![];if(_0x290542!=='*'){var _0x570802=_0x290542[_0x6b09('0x20')]('-');var _0x2504b7=parseDom(_0x570802[0x0]);var _0x150453=_0x570802[_0x6b09('0x22')]===0x2?parseDom(_0x570802[0x1]):_0x2504b7;_0x12e8ba=domCompare(_0x23e4ab,_0x2504b7,_0x150453);}let _0x3dc39f=!![];if(_0x5c0518!=='*'){var _0x200468=_0x5c0518['split']('-');var _0x276aeb=_0x200468[0x0];var _0xb29d43=_0x200468[_0x6b09('0x22')]===0x2?_0x200468[0x1]:_0x200468[0x0];_0x3dc39f=monthCompare(_0x23e4ab,_0x276aeb,_0xb29d43);}return _0x12907f&&_0x16f4fc&&_0x12e8ba&&_0x3dc39f;}}module[_0x6b09('0x9')]['iftime']=iftime; \ No newline at end of file +var _0x39b7=['timeCompare','ddd','includes','date','daysInMonth','max','min','domCompare','format','monthCompare','guess','test','padStart','length','iftime','lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','toLowerCase','circularMonthInterval','clone','minutes','hours','isBefore','startOf','day','endOf','isBetween'];(function(_0x57a19f,_0x15a9af){var _0x5c072c=function(_0x1f4165){while(--_0x1f4165){_0x57a19f['push'](_0x57a19f['shift']());}};_0x5c072c(++_0x15a9af);}(_0x39b7,0x157));var _0x739b=function(_0x300093,_0x5d46c3){_0x300093=_0x300093-0x0;var _0x3d9ab4=_0x39b7[_0x300093];return _0x3d9ab4;};var _=require(_0x739b('0x0'));var moment=require(_0x739b('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][_0x739b('0x2')](function(_0x302f65){return _0x302f65[_0x739b('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x739b('0x4');var EINVALID_DATE=_0x739b('0x5');function throwIfDateNotValid(_0x525ae1){if(!_0x525ae1[_0x739b('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2f633e){var _0x27b5b8=_0x2f633e[_0x739b('0x7')](':')['map'](function(_0x480929){return parseInt(_0x480929,0xa);});var _0x3476ae=_0x27b5b8[0x0];var _0x3ee9bd=_0x27b5b8[0x1];if(_0x3476ae<0x0||_0x3476ae>0x17||_0x3ee9bd<0x0||_0x3ee9bd>0x3b){throw new Error(EINVALID_DATE);}return[_0x3476ae,_0x3ee9bd];}function circularDoWInterval(_0x248c2b,_0x3fb40a){if(_0x248c2b===_0x3fb40a){return[_0x248c2b];}else{var _0x22293c=moment[_0x739b('0x8')]();moment[_0x739b('0x8')]('en');var _0xff14ca=moment[_0x739b('0x9')]()[_0x739b('0x2')](function(_0x2f39b9){return _0x2f39b9['toLowerCase']();});moment[_0x739b('0x8')](_0x22293c);var _0x58e0d6=_0xff14ca[_0x739b('0xa')](_0x248c2b);var _0x245766=_0xff14ca['indexOf'](_0x3fb40a);if(_0x245766>_0x58e0d6){return _0xff14ca[_0x739b('0xb')](_0x58e0d6,_0x245766+0x1);}else{var _0x1c04d7=_0xff14ca[_0x739b('0xb')](0x0,_0x245766+0x1);var _0x9d6b5c=_0xff14ca['slice'](_0x58e0d6);return _0x9d6b5c[_0x739b('0xc')](_0x1c04d7);}}}module[_0x739b('0xd')][_0x739b('0xe')]=circularDoWInterval;function circularMonthInterval(_0x5037e9,_0x55a59b){if(_0x5037e9===_0x55a59b){return[_0x5037e9];}else{var _0xcce096=moment[_0x739b('0x8')]();moment['locale']('en');var _0x2e6991=moment[_0x739b('0xf')]()[_0x739b('0x2')](function(_0x508fb5){return _0x508fb5[_0x739b('0x10')]();});moment[_0x739b('0x8')](_0xcce096);var _0x11f6e4=_0x2e6991[_0x739b('0xa')](_0x5037e9);var _0x2e5ee6=_0x2e6991[_0x739b('0xa')](_0x55a59b);if(_0x2e5ee6>_0x11f6e4){return _0x2e6991[_0x739b('0xb')](_0x11f6e4,_0x2e5ee6+0x1);}else{var _0x1afb02=_0x2e6991[_0x739b('0xb')](0x0,_0x2e5ee6+0x1);var _0x5ab034=_0x2e6991['slice'](_0x11f6e4);return _0x5ab034['concat'](_0x1afb02);}}}module[_0x739b('0xd')][_0x739b('0x11')]=circularMonthInterval;function parseDom(_0x4bc788){var _0xdc01ae=parseInt(_0x4bc788,0xa);if(_0xdc01ae<0x1||_0xdc01ae>0x1f){throw new Error(EINVALID_DATE);}return _0xdc01ae;}function timeCompare(_0x99ecb7,_0x228e97,_0x36e860){var _0x40538c=_0x99ecb7[_0x739b('0x12')]();var _0x1b8291=extractTime(_0x228e97);var _0x1de684=_0x1b8291[0x0];var _0x4f8231=_0x1b8291[0x1];var _0x253d0b=_0x99ecb7['clone']()['hours'](_0x1de684)[_0x739b('0x13')](_0x4f8231);throwIfDateNotValid(_0x253d0b);var _0x99a889=extractTime(_0x36e860);var _0x337def=_0x99a889[0x0];var _0x4be3de=_0x99a889[0x1];var _0x409abe=_0x99ecb7[_0x739b('0x12')]()[_0x739b('0x14')](_0x337def)[_0x739b('0x13')](_0x4be3de);throwIfDateNotValid(_0x409abe);if(_0x409abe[_0x739b('0x15')](_0x253d0b)){var _0x3bf5d0=_0x40538c[_0x739b('0x12')]()[_0x739b('0x16')](_0x739b('0x17'));var _0x3d5f39=_0x40538c[_0x739b('0x12')]()[_0x739b('0x18')](_0x739b('0x17'));return _0x40538c[_0x739b('0x19')](_0x253d0b,_0x3d5f39,undefined,'[]')||_0x40538c[_0x739b('0x19')](_0x3bf5d0,_0x409abe,undefined,'[]');}else{return _0x40538c[_0x739b('0x19')](_0x253d0b,_0x409abe,undefined,'[]');}}module[_0x739b('0xd')][_0x739b('0x1a')]=timeCompare;function dowCompare(_0x11a1d7,_0x1479cb,_0x167d0d){var _0x17c145=_0x11a1d7[_0x739b('0x8')]('en')['format'](_0x739b('0x1b'))[_0x739b('0x10')]();return circularDoWInterval(_0x1479cb,_0x167d0d)[_0x739b('0x1c')](_0x17c145);}module['exports']['dowCompare']=dowCompare;function domCompare(_0x24e2eb,_0x4f8dd6,_0x14c273){var _0x590622=_0x24e2eb[_0x739b('0x1d')]();if(_0x4f8dd6===_0x14c273){return _0x590622===_0x4f8dd6;}else{var _0x40ecad=_0x24e2eb[_0x739b('0x1e')]();var _0x128372=_0x4f8dd6<_0x14c273;let _0x5103fd=![];var _0x2f53d5=0x0;var _0x366fbe=0x0;if(_0x128372){_0x2f53d5=Math[_0x739b('0x1f')](0x1,_0x4f8dd6);_0x366fbe=Math['min'](_0x14c273,_0x40ecad);_0x5103fd=_0x590622>=_0x2f53d5&&_0x590622<=_0x366fbe;}else{_0x2f53d5=Math[_0x739b('0x20')](_0x4f8dd6,_0x40ecad);_0x366fbe=Math['max'](0x1,_0x14c273);_0x5103fd=_0x590622>=_0x2f53d5||_0x590622<=_0x366fbe;}return _0x5103fd;}}module[_0x739b('0xd')][_0x739b('0x21')]=domCompare;function monthCompare(_0x25472f,_0x49d60a,_0xc4147b){var _0x10f342=_0x25472f[_0x739b('0x8')]('en')[_0x739b('0x22')]('MMM')[_0x739b('0x10')]();return circularMonthInterval(_0x49d60a,_0xc4147b)[_0x739b('0x1c')](_0x10f342);}module['exports'][_0x739b('0x23')]=monthCompare;function iftime(_0x16db15,_0x505742=moment['tz'][_0x739b('0x24')](),_0x4b592c=moment()){if(!validateRx[_0x739b('0x25')](_0x16db15)){throw new Error(EINVALID_STRING);}else{var _0x11f237=(moment['isMoment'](_0x4b592c)?_0x4b592c['clone']():moment(_0x4b592c))['tz'](_0x505742)['locale']('en');throwIfDateNotValid(_0x11f237);var _0x2aced4=_0x16db15['split'](',');var _0x1aa801=_0x2aced4[0x0];var _0x5dd4b8=_0x2aced4[0x1];var _0x39b478=_0x2aced4[0x2];var _0x51366c=_0x2aced4[0x3];let _0x51f429=!![];if(_0x1aa801!=='*'){var _0x38f0d6=_0x1aa801['split']('-');var _0x3f940f=_[_0x739b('0x26')](_0x38f0d6[0x0],0x5,'0');var _0x1a3409=_0x38f0d6[_0x739b('0x27')]===0x2?_['padStart'](_0x38f0d6[0x1],0x5,'0'):_0x3f940f;_0x51f429=timeCompare(_0x11f237,_0x3f940f,_0x1a3409);}let _0x3599c7=!![];if(_0x5dd4b8!=='*'){var _0x4a6537=_0x5dd4b8[_0x739b('0x7')]('-');var _0x30f1c7=_0x4a6537[0x0];var _0x4090da=_0x4a6537[_0x739b('0x27')]===0x2?_0x4a6537[0x1]:_0x30f1c7;_0x3599c7=dowCompare(_0x11f237,_0x30f1c7,_0x4090da);}let _0x1a76b6=!![];if(_0x39b478!=='*'){var _0x3baa6c=_0x39b478[_0x739b('0x7')]('-');var _0x4219e2=parseDom(_0x3baa6c[0x0]);var _0xb2c39d=_0x3baa6c[_0x739b('0x27')]===0x2?parseDom(_0x3baa6c[0x1]):_0x4219e2;_0x1a76b6=domCompare(_0x11f237,_0x4219e2,_0xb2c39d);}let _0x160ec4=!![];if(_0x51366c!=='*'){var _0x51ead4=_0x51366c[_0x739b('0x7')]('-');var _0xec087c=_0x51ead4[0x0];var _0x3e9684=_0x51ead4[_0x739b('0x27')]===0x2?_0x51ead4[0x1]:_0x51ead4[0x0];_0x160ec4=monthCompare(_0x11f237,_0xec087c,_0x3e9684);}return _0x51f429&&_0x3599c7&&_0x1a76b6&&_0x160ec4;}}module[_0x739b('0xd')][_0x739b('0x28')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 174fb05..c82a96f 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4513=['../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','bold\x20green','gray','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','warn','File','%s-%s','error','Console','fileLogger','path','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4513,0x17f));var _0x3451=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4513[_0x4b369d];return _0x571a98;};'use strict';var path=require(_0x3451('0x0'));var util=require(_0x3451('0x1'));var moment=require('moment');var winston=require('winston');var config=require(_0x3451('0x2'));var debugLevel=config[_0x3451('0x3')]?config[_0x3451('0x3')][_0x3451('0x4')]():_0x3451('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':'redBG\x20white','error':_0x3451('0x6'),'warn':_0x3451('0x7'),'info':'white','print':'bold\x20white','success':_0x3451('0x8'),'http':_0x3451('0x9'),'verbose':'bold\x20magenta','debug':_0x3451('0xa'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x1ec370,_0x34a3e1,_0x376fc6){var _0x1d5e88=_0x1ec370||_0x3451('0xb');return path[_0x3451('0xc')](_0x1d5e88,util[_0x3451('0xd')](_0x3451('0xe'),_0x34a3e1,_0x376fc6));}function formatter(_0x5dcfea,_0x1edef8){_0x1edef8[_0x3451('0xf')]=_0x1edef8[_0x3451('0xf')]['replace'](/@@{/g,_0x3451('0x10'))[_0x3451('0x11')](/}@@/g,_0x3451('0x12'))[_0x3451('0x11')](/@{/g,'{{')[_0x3451('0x11')](/}@/g,'}}');return util['format'](_0x3451('0x13'),moment()[_0x3451('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),_0x1edef8[_0x3451('0x14')][_0x3451('0x15')](),_0x5dcfea,_0x1edef8[_0x3451('0xf')]);}function fileFormat(_0x5ac9ac,_0x309865){_0x309865['message']=_0x309865[_0x3451('0xf')][_0x3451('0x11')](/@@{/g,_0x3451('0x10'))[_0x3451('0x11')](/}@@/g,_0x3451('0x12'))['replace'](/@{/g,'{{')[_0x3451('0x11')](/}@/g,'}}');var _0x174238=_0x309865[_0x3451('0x16')]&&Object['keys'](_0x309865[_0x3451('0x16')])[_0x3451('0x17')]?'\x0a\x09'+JSON[_0x3451('0x18')](_0x309865[_0x3451('0x16')]):'';return util[_0x3451('0xd')](_0x3451('0x19'),moment()['format'](_0x3451('0x1a')),_0x309865[_0x3451('0x14')][_0x3451('0x15')](),_0x5ac9ac,_0x309865['message'],_0x174238);}function consoleLogger(){var _0x1c90ee=new winston[(_0x3451('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3451('0x1c'))]['Console']({'level':_0x3451('0x1d'),'json':![],'formatter':function(_0xbc4caa){return formatter('',_0xbc4caa);}})]});return _0x1c90ee;}function fileLogger(_0x174d4b,_0x1fdc25){var _0x2028fb=new winston[(_0x3451('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x3451('0x1e'))]({'name':util['format'](_0x3451('0x1f'),_0x174d4b,'error'),'filename':getLogFileName(_0x1fdc25,_0x174d4b,'error'),'level':_0x3451('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x33f9f1){return fileFormat(_0x174d4b,_0x33f9f1);}}),new winston[(_0x3451('0x1c'))][(_0x3451('0x1e'))]({'name':util[_0x3451('0xd')](_0x3451('0x1f'),_0x174d4b,debugLevel),'filename':getLogFileName(_0x1fdc25,_0x174d4b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xb7b9e1){return fileFormat(_0x174d4b,_0xb7b9e1);}}),new winston[(_0x3451('0x1c'))][(_0x3451('0x21'))]({'level':_0x3451('0x1d'),'json':![],'formatter':function(_0x5f4100){return fileFormat(_0x174d4b,_0x5f4100);}})]});return _0x2028fb;}exports['consoleLogger']=consoleLogger;exports[_0x3451('0x22')]=fileLogger; \ No newline at end of file +var _0xebf4=['%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','bold\x20yellow','white','gray','bold\x20cyan','addColors','/var/log/xcally','join','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','level','Logger','transports','warn','File'];(function(_0x32cfb6,_0x5794a7){var _0x45ccd0=function(_0xe4b45d){while(--_0xe4b45d){_0x32cfb6['push'](_0x32cfb6['shift']());}};_0x45ccd0(++_0x5794a7);}(_0xebf4,0x162));var _0x4ebf=function(_0x22ec12,_0x34135d){_0x22ec12=_0x22ec12-0x0;var _0x17affd=_0xebf4[_0x22ec12];return _0x17affd;};'use strict';var path=require(_0x4ebf('0x0'));var util=require(_0x4ebf('0x1'));var moment=require(_0x4ebf('0x2'));var winston=require(_0x4ebf('0x3'));var config=require(_0x4ebf('0x4'));var debugLevel=config[_0x4ebf('0x5')]?config[_0x4ebf('0x5')]['toLowerCase']():_0x4ebf('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x4ebf('0x7'),'error':'red','warn':_0x4ebf('0x8'),'info':_0x4ebf('0x9'),'print':'bold\x20white','success':'bold\x20green','http':_0x4ebf('0xa'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x4ebf('0xb')};winston[_0x4ebf('0xc')](XC_LOG_COLORS);function getLogFileName(_0x39910b,_0x30cb1a,_0x5be639){var _0x39b6f1=_0x39910b||_0x4ebf('0xd');return path[_0x4ebf('0xe')](_0x39b6f1,util['format']('%s-%s.log',_0x30cb1a,_0x5be639));}function formatter(_0x278e56,_0x1c594f){_0x1c594f[_0x4ebf('0xf')]=_0x1c594f['message'][_0x4ebf('0x10')](/@@{/g,'{{{')[_0x4ebf('0x10')](/}@@/g,_0x4ebf('0x11'))[_0x4ebf('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x4ebf('0x12')](_0x4ebf('0x13'),moment()['format'](_0x4ebf('0x14')),_0x1c594f['level'][_0x4ebf('0x15')](),_0x278e56,_0x1c594f[_0x4ebf('0xf')]);}function fileFormat(_0x2fb411,_0x47f202){_0x47f202[_0x4ebf('0xf')]=_0x47f202[_0x4ebf('0xf')][_0x4ebf('0x10')](/@@{/g,'{{{')[_0x4ebf('0x10')](/}@@/g,'}}}')[_0x4ebf('0x10')](/@{/g,'{{')[_0x4ebf('0x10')](/}@/g,'}}');var _0x1f0a86=_0x47f202[_0x4ebf('0x16')]&&Object[_0x4ebf('0x17')](_0x47f202['meta'])[_0x4ebf('0x18')]?'\x0a\x09'+JSON[_0x4ebf('0x19')](_0x47f202[_0x4ebf('0x16')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x4ebf('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),_0x47f202[_0x4ebf('0x1a')][_0x4ebf('0x15')](),_0x2fb411,_0x47f202['message'],_0x1f0a86);}function consoleLogger(){var _0x5e7eb2=new winston[(_0x4ebf('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4ebf('0x1c'))]['Console']({'level':_0x4ebf('0x1d'),'json':![],'formatter':function(_0x20d004){return formatter('',_0x20d004);}})]});return _0x5e7eb2;}function fileLogger(_0x5aa6e3,_0x19a8e2){var _0x527e8e=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4ebf('0x1c'))][(_0x4ebf('0x1e'))]({'name':util['format'](_0x4ebf('0x1f'),_0x5aa6e3,_0x4ebf('0x20')),'filename':getLogFileName(_0x19a8e2,_0x5aa6e3,_0x4ebf('0x20')),'level':_0x4ebf('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x379a63){return fileFormat(_0x5aa6e3,_0x379a63);}}),new winston[(_0x4ebf('0x1c'))][(_0x4ebf('0x1e'))]({'name':util['format'](_0x4ebf('0x1f'),_0x5aa6e3,debugLevel),'filename':getLogFileName(_0x19a8e2,_0x5aa6e3,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x16588c){return fileFormat(_0x5aa6e3,_0x16588c);}}),new winston[(_0x4ebf('0x1c'))]['Console']({'level':_0x4ebf('0x1d'),'json':![],'formatter':function(_0x3120f4){return fileFormat(_0x5aa6e3,_0x3120f4);}})]});return _0x527e8e;}exports[_0x4ebf('0x21')]=consoleLogger;exports[_0x4ebf('0x22')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index dfd1a5f..83d5809 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 _0x1261=['fax','clientSecret','securityToken','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','calleridname','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','oldPassword','length','isPlainObject','replace','@@{','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile'];(function(_0x1bf9a5,_0x51ed54){var _0x52ff78=function(_0x231ca2){while(--_0x231ca2){_0x1bf9a5['push'](_0x1bf9a5['shift']());}};_0x52ff78(++_0x51ed54);}(_0x1261,0x144));var _0x1126=function(_0x302f55,_0x31872f){_0x302f55=_0x302f55-0x0;var _0x55ca94=_0x1261[_0x302f55];return _0x55ca94;};var _=require('lodash');var sensitiveFields=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2'),_0x1126('0x3'),_0x1126('0x4'),_0x1126('0x5'),_0x1126('0x6'),_0x1126('0x7'),_0x1126('0x8'),_0x1126('0x9'),'email','clientId',_0x1126('0xa'),_0x1126('0xb'),'code',_0x1126('0xc'),_0x1126('0xd'),_0x1126('0xe'),_0x1126('0xf'),_0x1126('0x10'),'accessTokenSecret',_0x1126('0x11'),_0x1126('0x12'),_0x1126('0x13'),'membername',_0x1126('0x14'),'calleridnum','exten',_0x1126('0x15'),'clientEmail',_0x1126('0x16'),_0x1126('0x17'),_0x1126('0x18'),_0x1126('0x19'),_0x1126('0x1a'),_0x1126('0x1b'),_0x1126('0x1c'),_0x1126('0x1d'),_0x1126('0x1e'),'secret','registry',_0x1126('0x1f')];function maskSensitiveData(_0x154e20){const _0x279455=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x154e20)){for(const _0x45149c in _0x154e20){if(_['isArray'](_0x154e20[_0x45149c])){for(let _0x35fe9f=0x0;_0x35fe9f<_0x154e20[_0x45149c][_0x1126('0x20')];_0x35fe9f++){maskSensitiveData(_0x154e20[_0x45149c][_0x35fe9f]);}}else if(_[_0x1126('0x21')](_0x154e20[_0x45149c])){maskSensitiveData(_0x154e20[_0x45149c]);}else if(_['isString'](_0x154e20[_0x45149c])){_0x154e20[_0x45149c]=_0x154e20[_0x45149c][_0x1126('0x22')](/{{{/g,_0x1126('0x23'))['replace'](/}}}/g,'}@@')[_0x1126('0x22')](/{{/g,'@{')[_0x1126('0x22')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x45149c)){_0x154e20[_0x45149c]=_0x154e20[_0x45149c]['replace'](_0x279455,'*');}}}}}module[_0x1126('0x24')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x57c939,_0x4b0914){var _0x2320b0=function(_0x20a859){while(--_0x20a859){_0x57c939['push'](_0x57c939['shift']());}};_0x2320b0(++_0x4b0914);}(_0xadb5,0xad));var _0x5adb=function(_0x497347,_0x40054e){_0x497347=_0x497347-0x0;var _0x17681c=_0xadb5[_0x497347];return _0x17681c;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 2ff3e96..a82352b 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['\x5c$&','exports','replace'];(function(_0x4f0a5c,_0xcd980c){var _0xb704c4=function(_0x2a15eb){while(--_0x2a15eb){_0x4f0a5c['push'](_0x4f0a5c['shift']());}};_0xb704c4(++_0xcd980c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4611e0,_0x9e2aa9){_0x4611e0=_0x4611e0-0x0;var _0x218136=_0x5f2f[_0x4611e0];return _0x218136;};module[_0xf5f2('0x0')]={'escapeRegExp'(_0x423dd9,_0x2dcf60=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x423dd9[_0xf5f2('0x1')](_0x2dcf60,_0xf5f2('0x2'));}}; \ No newline at end of file +var _0x326f=['replace','\x5c$&','exports'];(function(_0x5eaa0f,_0x46a60e){var _0x552af0=function(_0x478422){while(--_0x478422){_0x5eaa0f['push'](_0x5eaa0f['shift']());}};_0x552af0(++_0x46a60e);}(_0x326f,0xd1));var _0xf326=function(_0x67b1e5,_0x20e93a){_0x67b1e5=_0x67b1e5-0x0;var _0x4b9483=_0x326f[_0x67b1e5];return _0x4b9483;};module[_0xf326('0x0')]={'escapeRegExp'(_0x55c50e,_0x5452cc=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x55c50e[_0xf326('0x1')](_0x5452cc,_0xf326('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index e42242a..6f95a18 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 _0xb10b=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x4bdf34,_0x259214){var _0x45800b=function(_0x417376){while(--_0x417376){_0x4bdf34['push'](_0x4bdf34['shift']());}};_0x45800b(++_0x259214);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fb334,_0x4ca8c9){_0x4fb334=_0x4fb334-0x0;var _0x56dc84=_0xb10b[_0x4fb334];return _0x56dc84;};var _=require(_0xbb10('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4bb7bb){return _0x4bb7bb==='{{'?_0xbb10('0x1'):_0xbb10('0x2');}function safeTemplate(_0x1dcb08){var _0x4d688c=_0x1dcb08;if(typeof _0x1dcb08===_0xbb10('0x3')){_0x4d688c=_0x1dcb08[_0xbb10('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xbb10('0x5')](_0x1dcb08)){_0x4d688c=_0x1dcb08[_0xbb10('0x6')](function(_0x49baf4){return safeTemplate(_0x49baf4);});}else if(_[_0xbb10('0x7')](_0x1dcb08)){_0x4d688c=Object['keys'](_0x1dcb08)[_0xbb10('0x8')](function(_0x3cdd53,_0x513741){_0x3cdd53[_0x513741]=safeTemplate(_0x1dcb08[_0x513741]);return _0x3cdd53;},{});}return _0x4d688c;}module[_0xbb10('0x9')][_0xbb10('0xa')]=safeTemplate; \ No newline at end of file +var _0x1eba=['\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20'];(function(_0x22e690,_0x5f570e){var _0x2b515f=function(_0x2bd741){while(--_0x2bd741){_0x22e690['push'](_0x22e690['shift']());}};_0x2b515f(++_0x5f570e);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0x1eba[_0x50cd41];return _0x399475;};var _=require(_0xa1eb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b1355){return _0x2b1355==='{{'?_0xa1eb('0x1'):_0xa1eb('0x2');}function safeTemplate(_0x3ef7ee){var _0x5865fc=_0x3ef7ee;if(typeof _0x3ef7ee==='string'){_0x5865fc=_0x3ef7ee[_0xa1eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa1eb('0x4')](_0x3ef7ee)){_0x5865fc=_0x3ef7ee[_0xa1eb('0x5')](function(_0xf9d704){return safeTemplate(_0xf9d704);});}else if(_[_0xa1eb('0x6')](_0x3ef7ee)){_0x5865fc=Object[_0xa1eb('0x7')](_0x3ef7ee)[_0xa1eb('0x8')](function(_0x2bfbb0,_0x39a5a3){_0x2bfbb0[_0x39a5a3]=safeTemplate(_0x3ef7ee[_0x39a5a3]);return _0x2bfbb0;},{});}return _0x5865fc;}module[_0xa1eb('0x9')][_0xa1eb('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 58724a7..5387c54 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 _0xfce2=['findIndex','name','env','NODE_PATH','string','pathExists','then','readJSON','Updating\x20app.json','writeJSON','fs-extra','../config/environment','resolve','server/app.json','apps'];(function(_0x103375,_0x200a62){var _0x35e752=function(_0x1341e8){while(--_0x1341e8){_0x103375['push'](_0x103375['shift']());}};_0x35e752(++_0x200a62);}(_0xfce2,0x145));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};var fs=require(_0x2fce('0x0'));var path=require('path');var config=require(_0x2fce('0x1'));var root=config['root'];var APP_JSON_PATH=path[_0x2fce('0x2')](root,_0x2fce('0x3'));var NODEPATH=path[_0x2fce('0x2')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x516e2d){let _0x1c7744=![];if(Array['isArray'](_0x516e2d[_0x2fce('0x4')])){var _0x28a90d=_0x516e2d[_0x2fce('0x4')][_0x2fce('0x5')](function(_0x159bd9){return _0x159bd9[_0x2fce('0x6')]==='motion2';});if(_0x28a90d>-0x1){var _0x30eb43=_0x516e2d[_0x2fce('0x4')][_0x28a90d];if(typeof _0x30eb43[_0x2fce('0x7')][_0x2fce('0x8')]!==_0x2fce('0x9')){_0x30eb43[_0x2fce('0x7')][_0x2fce('0x8')]=NODEPATH;_0x1c7744=!![];}}return{'appConfig':_0x516e2d,'updated':_0x1c7744};}}function updateAppConfig(_0xff0f36){return fs[_0x2fce('0xa')](APP_JSON_PATH)[_0x2fce('0xb')](function(_0x34dce9){if(_0x34dce9){return fs[_0x2fce('0xc')](APP_JSON_PATH)['then'](function(_0x1e1079){var _0x2ae0c9=setLegacyLibsNodeEnvPath(_0x1e1079);if(_0x2ae0c9['updated']){_0xff0f36['info'](_0x2fce('0xd'));return fs[_0x2fce('0xe')](APP_JSON_PATH,_0x1e1079,{'spaces':0x2});}else{return Promise[_0x2fce('0x2')]();}});}else{return Promise[_0x2fce('0x2')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0xa92c=['root','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','pathExists','readJSON','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment'];(function(_0x281305,_0x2998d6){var _0x56ffbe=function(_0x270b4c){while(--_0x270b4c){_0x281305['push'](_0x281305['shift']());}};_0x56ffbe(++_0x2998d6);}(_0xa92c,0x189));var _0xca92=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa92c[_0x5f1391];return _0x50ebe3;};var fs=require(_0xca92('0x0'));var path=require(_0xca92('0x1'));var config=require(_0xca92('0x2'));var root=config[_0xca92('0x3')];var APP_JSON_PATH=path[_0xca92('0x4')](root,'server/app.json');var NODEPATH=path[_0xca92('0x4')](root,_0xca92('0x5'));function setLegacyLibsNodeEnvPath(_0x77fe56){let _0x3bca17=![];if(Array[_0xca92('0x6')](_0x77fe56['apps'])){var _0x50908e=_0x77fe56[_0xca92('0x7')][_0xca92('0x8')](function(_0x18ea60){return _0x18ea60[_0xca92('0x9')]===_0xca92('0xa');});if(_0x50908e>-0x1){var _0x45baf9=_0x77fe56[_0xca92('0x7')][_0x50908e];if(typeof _0x45baf9[_0xca92('0xb')][_0xca92('0xc')]!=='string'){_0x45baf9[_0xca92('0xb')][_0xca92('0xc')]=NODEPATH;_0x3bca17=!![];}}return{'appConfig':_0x77fe56,'updated':_0x3bca17};}}function updateAppConfig(_0x3f1bdf){return fs[_0xca92('0xd')](APP_JSON_PATH)['then'](function(_0x396461){if(_0x396461){return fs[_0xca92('0xe')](APP_JSON_PATH)['then'](function(_0x58ac12){var _0x45489e=setLegacyLibsNodeEnvPath(_0x58ac12);if(_0x45489e['updated']){_0x3f1bdf['info'](_0xca92('0xf'));return fs[_0xca92('0x10')](APP_JSON_PATH,_0x58ac12,{'spaces':0x2});}else{return Promise[_0xca92('0x4')]();}});}else{return Promise[_0xca92('0x4')]();}});}module[_0xca92('0x11')]=updateAppConfig; \ No newline at end of file